From d3b80b9c390669734bfe388a88a861b86e8e2bc8 Mon Sep 17 00:00:00 2001 From: zhaohuidu Date: Thu, 26 May 2016 11:05:27 +0800 Subject: [PATCH 01/33] Update .gitignore --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..c634f5eb38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +#object file +.o + +#library +.a + +#share object +.so +.so.* From 532875d0193bf831004eb5a31676a87d7d968091 Mon Sep 17 00:00:00 2001 From: Angie Chinchilla Date: Thu, 23 Jun 2016 17:24:11 -0400 Subject: [PATCH 02/33] Initial README.md for project --- README.md | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..d0dd507f1b --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +Intel(R) Software Guard Extensions for Linux\* OS +================================================ + +# linux-sgx + +Introduction +------------ +Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for application developers seeking to protect select code and data from disclosure or modification. + +The Linux SGX software stack is comprised of the SGX driver, the SGX SDK, and the SGX Platform Software. The SGX SDK and SGX PSW are hosted in the [linux-sgx](https://github.com/01org/linux-sgx) project. + +The [linux-sgx-driver](https://github.com/01org/linux-sgx-driver) project hosts the out-of-tree driver for the Linux SGX software stack, which will be used until the driver upstreaming process is complete. + +License +------- +See License.txt for details. + +Documentation +------------- +- [Intel(R) SGX for Linux\* OS][1] project home page on [01.org](http://01.org) +- [Intel(R) SGX Programming Reference][2] +[1]: https://01.org/intel-softwareguard-extensions +[2]: https://software.intel.com/sites/default/files/managed/48/88/329298-002.pdf + +Build and Install the Intel(R) SGX Driver +----------------------------------------- +Follow the instructions in the [linux-sgx-driver](https://github.com/01org/linux-sgx-driver) project to build and install the SGX driver. + +Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package +------------------------------------------------------- +###Prerequisites: +- Ensure that you have the following required operating systems: + Ubuntu\*-14.04-LTS 64bits +- Use the following command to install the required tools to build Intel(R) SGX SDK: + `$ sudo apt-get install build-essential ocaml automake autoconf libtool` +- Use the following command to install additional required tools to build Intel(R) SGX PSW: + `$ sudo apt-get install libcurl4-openssl-dev protobuf-compiler protobuf-c-compiler libprotobuf-dev libprotobuf-c0-dev` +- Use the script *download_prebuilt.sh* inside source code package to download prebuilt binaries to prebuilt folder + You may need set http proxy for wget tool used by the script (such as `export http_proxy=http://test-proxy:test-port`) + `$ ./download_prebuilt.sh` + +###Build the Intel(R) SGX SDK and Intel(R) SGX PSW +The following steps describe how to build the Intel SGX SDK and PSW. You can build the project according to your requirement. +1. To build both Intel SGX SDK and PSW with default configuration, enter the following command: + `$ make` + You can find the tools and libraries generated in the `build/linux` directory. + Note: You can also go to the sdk folder and use the `make` command to build the Intel SGX SDK component only. However, the building of PSW component is dependent on the building result of Intel SGX SDK. +2. To build Intel SGX SDK and PSW with debug information, enter the following command: + `$ make DEBUG=1` +3. To clean the files generated by previous `make` command, enter the following command: + `$ make clean` + +###Build Intel(R) SGX SDK Installer +To build Intel(R) SGX SDK installer, enter the following command: + `$ make sdk_install_pkg` +You can find the generated Intel SGX SDK installer `sgx_linux_x64_sdk_${version}.bin` located under `linux/installer/bin/`, where `${version}` refers to the version number. + +###Build Intel(R) SGX PSW Installer +To build Intel(R) SGX PSW installer, enter the following command: + `$ make psw_install_pkg` +You can find the generated Intel SGX PSW installer `sgx_linux_x64_psw_${version}.bin` located under `linux/installer/bin/`, where `${version}` refers to the version number. + +Install Intel(R) SGX SDK +------------------------ +###Prerequisites +- Ensure that you have the following required operating systems: + Ubuntu\*-14.04-LTS +- Use the following command to install the required tool to use Intel(R) SGX SDK: + `$ sudo apt-get install build-essential` + +###Install Intel(R) SGX SDK +To install Intel(R) SGX SDK, execute the installer with root privilege: + `$ sudo ./sgx_linux_x64_sdk_${version}.bin ` + +###Test Intel(R) SGX SDK Package with the Sample Codes +1. Copy the sample codes installed by Intel(R) SGX SDK package into your work folder, such as + `$ cp -r /opt/intel/sgxsdk/SampleCode ~` +2. Compile and run each sample codes in the simulation mode to make sure the package works well. + `$ cd SampleCode/LocalAttestation` + `$ make` + `$ ./app` + Use similar commands for other sample codes. + +###Compile and Run the Sample Codes in the Hardware Mode +If you use an SGX hardware enabled machine, you need to run the sample codes in the hardware mode. +Ensure that you install SGX driver and Intel(R) SGX PSW installer on the machine. +See the topic, Install Intel(R) SGX PSW, on how to install the PSW package. +1. Copy the sample codes installed by the Intel(R) SGX SDK package into your work folder, such as + `$ cp -r /opt/intel/sgxsdk/SampleCode ~` +2. Compile and run each sample codes in the debug mode. + `$ cd SampleCode/LocalAttestation` + `$ make SGX_MODE=HW SGX_DEBUG=1` + `$ ./app` + Use similar commands for other sample codes. + +Install Intel(R) SGX PSW +------------------------ +###Prerequisites +- Ensure that you have the following required operating systems: + Ubuntu\*-14.04-LTS 64bits +- Ensure that you have the following required hardware: + 6th Generation Intel(R) Core(TM) Processor (code named Skylake) +- Configure the system with the **SGX hardware enabled** option and install SGX driver in advance. + See the topic, Build and Install the Intel(R) SGX Driver, on how to install the SGX driver. +- Install the library using the following command: + `$ sudo apt-get install libcurl4-openssl-dev libprotobuf-dev libprotobuf-c0-dev` + +###Install Intel(R) SGX PSW +To install Intel(R) SGX PSW, execute the installer with root privilege: + `$ sudo ./sgx_linux_x64_psw_${version}.bin` + +###Start or Stop aesmd Service +The Intel(R) SGX PSW installer installs an aesmd service in your machine which is running in a special linux account aesmd. +To stop the service: `$ sudo service aesmd stop` +To start the service: `$ sudo service aesmd start` +To restart the service: `$ sudo service aesmd restart` + +###Configure the Proxy for aesmd Service +The aesmd service uses HTTP protocol to initialize some services. +If proxy is required for HTTP protocol, you may need manually setup the proxy for aesmd service. +You should manually edit file `/etc/aesmd.conf` (refer the comment in the file) to set the proxy for aesmd service. +After you configure the proxy, you need to restart the service to enable the proxy. + From ba82cfcbb02cc3b21bdfffa58c001325c5b9bd76 Mon Sep 17 00:00:00 2001 From: Angie Chinchilla Date: Thu, 23 Jun 2016 17:35:04 -0400 Subject: [PATCH 03/33] Add License file to project. --- License.txt | 1396 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1396 insertions(+) create mode 100644 License.txt diff --git a/License.txt b/License.txt new file mode 100644 index 0000000000..8e1d1f882e --- /dev/null +++ b/License.txt @@ -0,0 +1,1396 @@ +BSD License + +Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +================================================================= + +SGX Eclipse plug-in is licensed under Eclipse Public License-v1.0 +http://www.eclipse.org/legal/epl-v10.html + + + +============================================================== + +libsgx_le.signed.so, libsgx_pve.signed.so and libsgx_qe.signed.so are licensed as Intel redistributable binary firmware and other blobs. + + +Copyright (c) Intel Corporation. + +Redistribution. Redistribution and use in binary form, without +modification, are permitted provided that the following conditions are +met: + +* Redistributions must reproduce the above copyright notice and the + following disclaimer in the documentation and/or other materials + provided with the distribution. +* Neither the name of Intel Corporation nor the names of its suppliers + may be used to endorse or promote products derived from this software + without specific prior written permission. +* No reverse engineering, decompilation, or disassembly of this software + is permitted. + +Limited patent license. Intel Corporation grants a world-wide, +royalty-free, non-exclusive license under patents it now or hereafter +owns or controls to make, have made, use, import, offer to sell and +sell ("Utilize") this software, but solely to the extent that any +such patent is necessary to Utilize the software alone, or in +combination with an operating system licensed under an approved Open +Source license as listed by the Open Source Initiative at +http://opensource.org/licenses. The patent license shall not apply to +any other combinations which include this software. No hardware per +se is licensed hereunder. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + + + +=========================================================================================================================================================== + +SGX software for Linux also uses third-party projects that may be distributed under different licenses. Please see below for details. + + +1. Android Open Source Project + +Copyright (C) 2012 The Android Open Source Project +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +2. compiler_rt + +The compiler_rt library is dual licensed under both the University of Illinois +"BSD-Like" license and the MIT license. As a user of this code you may choose +to use it under either license. As a contributor, you agree to allow your code +to be used under both. + +Full text of the relevant licenses is included below. + +============================================================================= + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal with the +Software without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the +Software, and to permit persons to whom the Software is furnished to do so, subject +to the following conditions: + +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimers. + +- Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimers in the documentation and/or +other materials provided with the distribution. + +- Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign, +nor the names of its contributors may be used to endorse or romote products derived +from this Software without specific prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS WITH THE SOFTWARE. + +============================================================================= + +Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +============================================================================= +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================= +The LLVM software contains code written by third parties. Such software will have its +own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply to that code. + +The disclaimer of warranty in the University of Illinois Open Source License applies to all +code in the LLVM Distribution, and nothing in any of the other licenses gives permission to +use the names of the LLVM Team or the University of Illinois to endorse or promote products +derived from this Software. + +The following pieces of software have additional or alternate copyrights, licenses, and/or +restrictions: + +Program Directory +------- --------- +mach_override lib/interception/mach_override + + + +3. DLmalloc + + +Public domain +http://g.oswego.edu/dl/html/malloc.html + +CC0 1.0 Universal + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. +DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. +CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS +MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS +PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF +THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. + +Statement of Purpose +The laws of most jurisdictions throughout the world automatically confer exclusive +Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) +(each and all, an "owner") of an original work of authorship and/or a database (each, +a "Work"). +Certain owners wish to permanently relinquish those rights to a Work for the purpose +of contributing to a commons of creative, cultural and scientific works ("Commons") +that the public can reliably and without fear of later claims of infringement build +upon, modify, incorporate in other works, reuse and redistribute as freely as possible +in any form whatsoever and for any purposes, including without limitation commercial +purposes. These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific works, or to +gain reputation or greater distribution for their Work in part through the use and +efforts of others. +For these and/or other purposes and motivations, and without any expectation of +additional consideration or compensation, the person associating CC0 with a Work +(the "Affirmer"), to the extent that he or she is an owner of Copyright and Related +Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute +the Work under its terms, with knowledge of his or her Copyright and Related Rights +in the Work and the meaning and intended legal effect of CC0 on those rights. +1. Copyright and Related Rights. A Work made available under CC0 may be protected by +copyright and related or neighboring rights ("Copyright and Related Rights"). +Copyright and Related Rights include, but are not limited to, the following: +i. the right to reproduce, adapt, distribute, perform, display, communicate, + and translate a Work; +ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or likeness +depicted in a Work; +iv. rights protecting against unfair competition in regards to a Work, subject +to the limitations in paragraph 4(a), below; +v. rights protecting the extraction, dissemination, use and reuse of data in a Work; +vi. database rights (such as those arising under Directive 96/9/EC of the European +Parliament and of the Council of 11 March 1996 on the legal protection of databases, +and under any national implementation thereof, including any amended or successor +version of such directive); and +vii. other similar, equivalent or corresponding rights throughout the world based on +applicable law or treaty, and any national implementations thereof. +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable +law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, +abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated +claims and causes of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for +the maximum duration provided by applicable law or treaty (including future time extensions), + (iii) in any current or future medium and for any number of copies, and (iv) for any purpose + whatsoever, including without limitation commercial, advertising or promotional purposes +(the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at +large and to the detriment of Affirmer's heirs and successors, fully intending that such +Waiver shall not be subject to revocation, rescission, cancellation, termination, or any +other legal or equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally +invalid or ineffective under applicable law, then the Waiver shall be preserved to the +maximum extent permitted taking into account Affirmer's express Statement of Purpose. In +addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable +and unconditional license to exercise Affirmer's Copyright and Related Rights in the +Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable +law or treaty (including future time extensions), (iii) in any current or future medium and +for any number of copies, and (iv) for any purpose whatsoever, including without limitation +commercial, advertising or promotional purposes (the "License"). The License shall be deemed +effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the +License for any reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder of the License, +and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his +or her remaining Copyright and Related Rights in the Work or (ii) assert any associated +claims and causes of action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. +4. Limitations and Disclaimers. +a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, +licensed or otherwise affected by this document. +b. Affirmer offers the Work as-is and makes no representations or warranties of any +kind concerning the Work, express, implied, statutory or otherwise, including without limitation +warranties of title, merchantability, fitness for a particular purpose, non infringement, or +the absence of latent or other defects, accuracy, or the present or absence of errors, whether +or not discoverable, all to the greatest extent permissible under applicable law. +c. Affirmer disclaims responsibility for clearing rights of other persons that may apply + +to the Work or any use thereof, including without limitation any person's Copyright and Related +Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary +consents, permissions or other rights required for any use of the Work. +d. Affirmer understands and acknowledges that Creative Commons is not a party to this +document and has no duty or obligation with respect to this CC0 or use of the Work. + + + + +4. FreeBSD + +http://www.freebsd.org/ + +The FreeBSD* Copyright +Copyright 1992-2013 The FreeBSD Project. All rights reserved. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. +THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +The views and conclusions contained in the software and documentation are those +of the authors and should not be interpreted as representing official policies, +either expressed or implied, of the FreeBSD Project. + + + + +5. libcxxrt + +The BSD License + +Copyright 2010-2011 PathScale, Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +The views and conclusions contained in the software and documentation are those of +the authors and should not be interpreted as representing official policies, either +expressed or implied, of PathScale, Inc. + + + + + +6. NetBSD + +=============================================================================================== + +/*- + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +________________________________________ +For complete copyright and licensing terms, see: http://www.netbsd.org/about/redistribution.html + + + + +7. OpenBSD + +http://openbsd.org/ + +OpenBSD* Copyright Policy +________________________________________ +- Goal +Copyright law is complex, OpenBSD* policy is simple - OpenBSD strives to maintain the spirit +of the original Berkeley Unix copyrights. +OpenBSD can exist as it does today because of the example set by the Computer Systems Research +Group at Berkeley and the battles which they and others fought to create a relatively +un-encumbered Unix source distribution. +The ability of a freely redistributable "Berkeley" Unix to move forward on a competitive +basis with other operating systems depends on the willingness of the various development +groups to exchange code amongst themselves and with other projects. Understanding the legal +issues surrounding copyright is fundamental to the ability to exchange and re-distribute code, +while honoring the spirit of the copyright and concept of attribution is fundamental to +promoting the cooperation of the people involved. +- The Berkeley* Copyright +The Berkeley* copyright poses no restrictions on private or commercial use of the software +and imposes only simple and uniform requirements for maintaining copyright notices in +redistributed versions and crediting the originator of the material only in advertising. +For instance: + * Copyright (c) 1982, 1986, 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * +Berkeley rescinded the 3rd term (the advertising term) on 22 July 1999. Verbatim copies +of the Berkeley license in the OpenBSD tree have that term removed. In addition, many +3rd-party BSD-style licenses consist solely of the first two terms. +Because the OpenBSD copyright imposes no conditions beyond those imposed by the Berkeley +copyright, OpenBSD can hope to share the same wide distribution and applicability as the +Berkeley distributions. It follows however, that OpenBSD cannot include material which +includes copyrights which are more restrictive than the Berkeley copyright, or must +relegate this material to a secondary status, i.e. OpenBSD as a whole is freely +redistributable, but some optional components may not be. +- Copyright Law +While the overall subject of copyright law is far beyond the scope of this document, some +basics are in order. Under the current copyright law, copyrights are implicit in the +creation of a new work and reside with the creator, unless otherwise assigned. In general +the copyright applies only to the new work, not the material the work was derived from, +nor those portions of the derivative material included in the new work. +Copyright law admits to three general categories of works: +Original Work +A new work that is not derived from an existing work. +Derivative Work +Work that is derived from, includes or amends existing works. +Compilations +A work that is a compilation of existing new and derivative works. +The fundamental concept is that there is primacy of the copyright, that is a copyright of a +derivative work does not affect the rights held by the owner of the copyright of the original +work, rather only the part added. Likewise the copyright of a compilation does not affect the +rights of the owner of the included works, only the compilation as an entity. +It is vitally important to understand that copyrights are broad protections as defined by +national and international copyright law. The "copyright notices" usually included in source +files are not copyrights, but rather notices that a party asserts that they hold copyright +to the material or to part of the material. Typically these notices are associated with +license terms which grant permissions subject to copyright law and with disclaimers that +state the position of the copyright holder/distributor with respect to liability surrounding +use of the material. +- Permissions - the flip side +Because copyrights arise from the creation of a work, rather than through a registration process, +there needs to be a practical way to extend permission to use a work beyond what might be allowed +by "fair use" provisions of the copyright laws. +This permission typically takes the form of a "release" or "license" included in the work, which +grants the additional uses beyond those granted by copyright law, usually subject to a variety of +conditions. At one extreme sits "public domain" where the originator asserts that he imposes no +restrictions on use of the material, at the other restrictive clauses that actually grant no +additional rights or impose restrictive, discriminatory or impractical conditions on use of the +work. +Again, an important point to note is that the release and conditions can only apply to the +portion of the work that was originated by the copyright holder - the holder of a copyright +on a derivative work can neither grant additional permissions for use of the original work, +nor impose more restrictive conditions for use of that work. +Because copyright arises from the creation of a work and not the text or a registration process, +removing or altering a copyright notice or associated release terms has no bearing on the +existence of the copyright, rather all that is accomplished is to cast doubt upon whatever rights +the person making the modifications had to use the material in the first place. Likewise, adding +terms and conditions in conflict with the original terms and conditions does not supersede them, +rather it casts doubts on the rights of the person making the amendments to use the material and +creates confusion as to whether anyone can use the amended version or derivatives thereof. +Finally, releases are generally binding on the material that they are distributed with. This means +that if the originator of a work distributes that work with a release granting certain permissions, +those permissions apply as stated, without discrimination, to all persons legitimately possessing +a copy of the work. That means that having granted a permission, the copyright holder can not +retroactively say that an individual or class of individuals are no longer granted those permissions. +Likewise should the copyright holder decide to "go commercial" he can not revoke permissions already +granted for the use of the work as distributed, though he may impose more restrictive permissions in +his future distributions of that work. +- Specific Cases +This section attempts to summarize the position of OpenBSD relative to some commonly encountered +copyrights. +Berkeley* +The Berkeley copyright is the model for the OpenBSD copyright. It retains the rights of the +copyright holder, while imposing minimal conditions on the use of the copyrighted material. +Material with Berkeley copyrights, or copyrights closely adhering to the Berkeley model can +generally be included in OpenBSD. +AT&T* +As part of its settlement with AT&T*, Berkeley included an AT&T copyright notice on some of the +files in 4.4BSD lite and lite2. The terms of this license are identical to the standard Berkeley +license. +Additionally, OpenBSD includes some other AT&T code with non-restrictive copyrights, such as the +reference implementation of awk. +Caldera* +Caldera* (now known as the SCO group) is the current owner of the Unix code copyrights. On 23 +January 2002, the original Unix code (versions 1 through seven, including 32V) was freed by Caldera. +This code is now available under a 4-term BSD-style license. As a result, it is now possible to +incorporate real Unix code into OpenBSD (though this code is quite old and generally requires significant +changes to bring it up to date). +DEC*, Sun*, other manufacturers/software houses. +In general OpenBSD does not include material copyrighted by manufacturers or software houses. +Material may be included where the copyright owner has granted general permission for reuse +without conditions, with terms similar to the Berkeley copyright, or where the material is the +product of an employee and the employer's copyright notice effectively releases any rights they +might have to the work. +Carnegie-Mellon* (CMU, Mach) +The Carnegie-Mellon copyright is similar to the Berkeley copyright, except that it requests that +derivative works be made available to Carnegie-Mellon. Because this is only a request and not a +condition, such material can still be included in OpenBSD. It should be noted that existing +versions of Mach are still subject to AT&T copyrights, which prevents the general distribution +of Mach sources. +Apache* +The original Apache* copyright is similar to the Berkeley copyright, except that it stipulates +that products derived from the code may not have "Apache" in their name. The purpose of this +clause is to avoid a situation in which another party releases a modified version of the code +named in such a way to make users think that it is the "official" version. This is not an issue +with OpenBSD because OpenBSD is a Compilation, and not a Derived Work. Source code published under +version 2 of the Apache license cannot be included into OpenBSD. As a consequence, OpenBSD now +maintains its own version of Apache based on version 1.3.29. The OpenBSD version includes many +enhancements and bugfixes. +ISC* +The ISC* copyright is functionally equivalent to a two-term BSD copyright with language removed +that is made unnecessary by the Berne convention. This is the preferred license for new code +incorporated into OpenBSD. A sample license is included in the source tree as +/usr/src/share/misc/license.template. +GNU* General Public License, GPL, LGPL, copyleft, etc. +The GNU* Public License and licenses modeled on it impose the restriction that source code must +be distributed or made available for all works that are derivatives of the GNU copyrighted code. +While this may be a noble strategy in terms of software sharing, it is a condition that is +typically unacceptable for commercial use of software. As a consequence, software bound by the +GPL terms can not be included in the kernel or "runtime" of OpenBSD, though software subject to + GPL terms may be included as development tools or as part of the system that are "optional" as +long as such use does not result in OpenBSD as a whole becoming subject to the GPL terms. +As an example, GCC and other GNU tools are included in the OpenBSD tool chain. However, it is +quite possible to distribute a system for many applications without a tool chain, or the +distributor can choose to include a tool chain as an optional bundle which conforms to the +GPL terms. +NetBSD* +Much of OpenBSD is originally based on and evolved from NetBSD*, since some of the OpenBSD +developers were involved in the NetBSD project. The general NetBSD license terms are compatible +with the Berkeley license and permit such use. Material subject only to the general NetBSD license +can generally be included in OpenBSD. +In the past, NetBSD has included material copyrighted by individuals who have imposed license +conditions beyond that of the general NetBSD license, but granted the NetBSD Foundation license +to distribute the material. Such material can not be included in OpenBSD as long as the conditions +imposed are at odds with the OpenBSD license terms or releases from those terms are offered on a +discriminatory basis. +FreeBSD* +Most of FreeBSD* is also based on Berkeley licensed material or includes copyright notices based +on the Berkeley model. Such material can be included in OpenBSD, while those parts that are subject +to GPL or various individual copyright terms that are at odds with the OpenBSD license can not be +included in OpenBSD. +Linux* +Most of Linux* is subject to GPL style licensing terms and therefore can not be included in +OpenBSD. Individual components may be eligible, subject to the terms of the originator's copyright +notices. Note that Linux "distributions" may also be subject to additional copyright claims of the +distributing organization, either as a compilation or on material included that is not part of the +Linux core. +X*, XFree86*, X.Org* +X*, X.Org* or XFree86* are not parts of OpenBSD, rather X.Org and parts of XFree86 3.3.6 are +distributed with many OpenBSD ports as a convenience to the user, subject to applicable license +terms. +Shareware, Charityware, Freeware, etc. +Most "shareware" copyright notices impose conditions for redistribution, use or visibility that +are at conflict with the OpenBSD project goals. Review on a case-by-case basis is required as to +whether the wording of the conditions is acceptable in terms of conditions being requested vs. +demanded and whether the spirit of the conditions is compatible with goals of the OpenBSD project. +Public Domain +While material that is truly entered into the "Public Domain" can be included in OpenBSD, review +is required on a case by case basis. Frequently the "public domain" assertion is made by someone +who does not really hold all rights under Copyright law to grant that status or there are a variety +of conditions imposed on use. For a work to be truly in the "Public Domain" all rights are abandoned +and the material is offered without restrictions. + + + + +8. Openssl + + +http://www.openssl.org/ + + LICENSE ISSUES + ============== + + The OpenSSL* toolkit stays under a dual license, i.e. both the conditions of + the OpenSSL License and the original SSLeay license apply to the toolkit. + See below for the actual license texts. Actually both licenses are BSD-style + Open Source licenses. In case of any license issues related to OpenSSL + please contact openssl-core@openssl.org. + + OpenSSL License + --------------- + +/* ==================================================================== + * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * openssl-core@openssl.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.openssl.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + + Original SSLeay* License + ----------------------- + +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + + + + +9. Protocol Buffers + +Protocol Buffers - Google's data interchange format +Copyright 2008 Google Inc. All rights reserved. +http://code.google.com/p/protobuf/ +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. +3. Neither the name of the Google Inc. nor the names of its contributors may be used + to endorse or promote products derived from this software without specific prior + written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + + + +10. rdrand + +Intel Sample Source Code license. + +This license governs use of the accompanying software. By installing or +copying all or any part of the software components in this package, you +("you" or "Licensee") agree to the terms of this agreement. Do +not install or copy the software until you have carefully read and +agreed to the following terms and conditions. If you do not agree to the +terms of this agreement, promptly return the software to Intel +Corporation ("Intel"). + +1. Definitions: + +A. "Materials" are defined as the software (including the +Redistributables and Sample Source as defined herein), documentation, +and other materials, including any updates and upgrade thereto, that are +provided to you under this Agreement. + +B. "Redistributables" are the files listed in the "redist.txt" file that +is included in the Materials or are otherwise clearly identified as +redistributable files by Intel. + +C. "Sample Source" is the source code file(s) that: (i) +demonstrate(s) certain functions for particular purposes; (ii) are +identified as sample source code; and (iii) are provided hereunder in +source code form. + +D. "Intel's Licensed Patent Claims" means those claims of +Intel's patents that (a) are infringed by the Sample Source or +Redistributables, alone and not in combination, in their unmodified +form, as furnished by Intel to Licensee and (b) Intel has the right to +license. + +2. License Grant: Subject to all of the terms and conditions of this +Agreement: + +A. Intel grants to you a non-exclusive, non-assignable, copyright +license to use the Material for your internal development purposes only. + +B. Intel grants to you a non-exclusive, non-assignable copyright license +to reproduce the Sample Source, prepare derivative works of the Sample +Source and distribute the Sample Source or any derivative works thereof +that you create, as part of the product or application you develop using +the Materials. + +C. Intel grants to you a non-exclusive, non-assignable copyright license +to distribute the Redistributables, or any portions thereof, as part of +the product or application you develop using the Materials. + +D. Intel grants Licensee a non-transferable, non-exclusive, worldwide, +non-sublicenseable license under Intel's Licensed Patent Claims to +make, use, sell, and import the Sample Source and the Redistributables. + +3. Conditions and Limitations: + +A. This license does not grant you any rights to use Intel's name, +logo or trademarks. + +B. Title to the Materials and all copies thereof remain with Intel. The +Materials are copyrighted and are protected by United States copyright +laws. You will not remove any copyright notice from the Materials. You +agree to prevent any unauthorized copying of the Materials. Except as +expressly provided herein, Intel does not grant any express or implied +right to you under Intel patents, copyrights, trademarks, or trade +secret information. + +C. You may NOT: (i) use or copy the Materials except as provided in this +Agreement; (ii) rent or lease the Materials to any third party; (iii) +assign this Agreement or transfer the Materials without the express +written consent of Intel; (iv) modify, adapt, or translate the Materials +in whole or in part except as provided in this Agreement; (v) reverse +engineer, decompile, or disassemble the Materials not provided to you in +source code form; or (vii) distribute, sublicense or transfer the source +code form of any components of the Materials and derivatives thereof to +any third party except as provided in this Agreement. + +D. Platform Limitation - The licenses granted in section 2 extend only +to the software or derivative works that you create that run directly on +a Microsoft Windows operating system product, Microsoft run-time +technology (such as the .NET Framework or Silverlight), or Microsoft +application platform (such as Microsoft Office or Microsoft Dynamics). + +4. No Warranty: + +THE MATERIALS ARE PROVIDED "AS IS". INTEL DISCLAIMS ALL EXPRESS OR +IMPLIED WARRANTIES WITH RESPECT TO THEM, INCLUDING ANY IMPLIED +WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, AND FITNESS FOR ANY +PARTICULAR PURPOSE. + +5. LIMITATION OF LIABILITY: NEITHER INTEL NOR ITS SUPPLIERS SHALL BE +LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, +DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF +BUSINESS INFORMATION, OR OTHER LOSS) ARISING OUT OF THE USE OF OR +INABILITY TO USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE +EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL +DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU. + +6. USER SUBMISSIONS: You agree that any material, information or other +communication, including all data, images, sounds, text, and other +things embodied therein, you transmit or post to an Intel website or +provide to Intel under this Agreement will be considered +non-confidential ("Communications"). Intel will have no confidentiality +obligations with respect to the Communications. You agree that Intel and +its designees will be free to copy, modify, create derivative works, +publicly display, disclose, distribute, license and sublicense through +multiple tiers of distribution and licensees, incorporate and otherwise +use the Communications, including derivative works thereto, for any and +all commercial or non-commercial purposes + +7. TERMINATION OF THIS LICENSE: This Agreement becomes effective on the +date you accept this Agreement and will continue until terminated as +provided for in this Agreement. Intel may terminate this license at any +time if you are in breach of any of its terms and conditions. Upon +termination, you will immediately return to Intel or destroy the +Materials and all copies thereof. + +8. U.S. GOVERNMENT RESTRICTED RIGHTS: The Materials are provided with +"RESTRICTED RIGHTS". Use, duplication or disclosure by the Government is +subject to restrictions set forth in FAR52.227-14 and DFAR252.227-7013 +et seq. or its successor. Use of the Materials by the Government +constitutes acknowledgment of Intel's rights in them. + +9. APPLICABLE LAWS: Any claim arising under or relating to this +Agreement shall be governed by the internal substantive laws of the +State of Delaware, without regard to principles of conflict of laws. You +may not export the Materials in violation of applicable export laws. + + + + + + + + +11. SQLite + +http://sqlite.org/ + +SQLite* Copyright + +All of the code and documentation in SQLite has been dedicated to the public +domain by the authors. All code authors, and representatives of the companies +they work for, have signed affidavits dedicating their contributions to the +public domain and originals of those signed affidavits are stored in a firesafe +at the main offices of Hwaci. Anyone is free to copy, modify, publish, use, +compile, sell, or distribute the original SQLite code, either in source code +form or as a compiled binary, for any purpose, commercial or non-commercial, +and by any means. +The previous paragraph applies to the deliverable code and documentation in +SQLite - those parts of the SQLite library that you actually bundle and ship +with a larger application. Some scripts used as part of the build process +(for example the "configure" scripts generated by autoconf) might fall under +other open-source licenses. Nothing from these build scripts ever reaches the +final deliverable SQLite library, however, and so the licenses associated with +those scripts should not be a factor in assessing your rights to copy and use +the SQLite library. +All of the deliverable code in SQLite has been written from scratch. No code +has been taken from other projects or from the open internet. Every line of +code can be traced back to its original author, and all of those authors have +public domain dedications on file. So the SQLite code base is clean and is +uncontaminated with licensed code from other projects. + + + + + + + +12. STLPort + +License Agreement + +Boris Fomitchev grants Licensee a non-exclusive, non-transferable, + +royalty-free license to use STLport* and its documentation without +fee. + +By downloading, using, +or copying STLport or any portion thereof, +Licensee agrees to abide by the intellectual +property laws and all +other applicable laws of the United States of America, and to all of + +the terms and conditions of this Agreement. + +Licensee shall maintain the following copyright +and permission notices +on STLport sources and its documentation unchanged: + +Copyright 1999,2000 +Boris Fomitchev + +This material is provided "as is", with absolutely no warranty +expressed or +implied. Any use is at your own risk. + +Permission to use or copy this software for any purpose +is hereby +granted without fee, provided the above notices are retained on all +copies. Permission +to modify the code and to distribute modified code +is granted, provided the above notices are +retained, and a notice that +the code was modified is included with the above copyright notice. + + +The Licensee may distribute binaries compiled with STLport whether +original or modified) without +any royalties or restrictions. + +The Licensee may distribute original or modified STLport sources, + +provided that: + + - The conditions indicated in the above permission notice are met; + - The +following copyright notices are retained when present, and + conditions provided in +accompanying permission notices are met : + +Copyright 1994 Hewlett-Packard Company +Copyright +1996,97 Silicon Graphics Computer Systems, Inc. +Copyright 1997 Moscow Center for SPARC +Technology. + + Permission to use, copy, modify, distribute and sell this software + and its +documentation for any purpose is hereby granted without fee, + provided that the above +copyright notice appear in all copies and + that both that copyright notice and this permission +notice appear in + supporting documentation. Hewlett-Packard Company makes no + representations +about the suitability of this software for any + purpose. It is provided "as is" without +express or implied warranty. + + Permission to use, copy, modify, distribute and sell this +software + and its documentation for any purpose is hereby granted without fee, + provided that +the above copyright notice appear in all copies and + that both that copyright notice and this +permission notice appear in + supporting documentation. Silicon Graphics makes no representations + +about the suitability of this software for any purpose. It is + provided "as is" without express +or implied warranty. + + Permission to use, copy, modify, distribute and sell this software + and +its documentation for any purpose is hereby granted without fee, + provided that the above +copyright notice appear in all copies and + that both that copyright notice and this permission +notice appear in + supporting documentation. Moscow Center for SPARC Technology?makes + no +representations about the suitability of this software for any + purpose. It is provided "as is" +without express or implied warranty. + + + +http://www.stlport.org/doc/license.html + + + + + + +13. TinyXML + +http://www.grinninglizard.com/tinyxml/ + + +The zlib/libpng License +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the +use of this software. +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: +1. The origin of this software must not be misrepresented; you must not claim + that you wrote the original software. If you use this software in a product, + an acknowledgment in the product documentation would be appreciated but is + not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + + + + + +14. libunwind + +Copyright (C) 1996 X Consortium +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. +X Window System is a trademark of X Consortium, Inc. + + + +15. ittnotify library + +BSD/GPLv2 dual license + +Copyright (c) 2011, Intel Corporation +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +The GNU General Public License (GPL) +Version 2, June 1991 +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + + + +16. EPID SDK + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + + +17. Eclipse Plug-in + +Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: +i) changes to the Program, and +ii) additions to the Program; +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and +b) its license agreement: +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and +b) a copy of this Agreement must be included with each copy of the Program. +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. From 9441de4c38700bbc573bb0d363c34387022b7b1c Mon Sep 17 00:00:00 2001 From: Angie Chinchilla Date: Thu, 23 Jun 2016 18:51:53 -0400 Subject: [PATCH 04/33] Initial release of Intel SGX for Linux. This release is used in conjunction with the linux-sgx-driver Intial release: https://github.com/01org/linux-sgx-driver commit-id: 0e865ce5e6b297a787bcdc12d98bada8174be6d7 Intel-id: 33399 Signed-off-by: Angie Chinchilla --- Linux_SGXEclipsePlugin/build.sh | 202 + .../build_config/allElements.xml | 52 + .../build_config/build.properties | 307 + .../build_config/buildUpdateSite.xml | 13 + .../build_config/customAssembly.xml | 66 + .../build_config/customTargets.xml | 208 + .../features/com.intel.sgx.feature/.project | 28 + .../com.intel.sgx.feature/build.properties | 15 + .../com.intel.sgx.feature/feature.xml | 145 + .../com.intel.sgx.userguide/.classpath | 18 + .../plugins/com.intel.sgx.userguide/.project | 39 + .../META-INF/MANIFEST.MF | 11 + .../com.intel.sgx.userguide/build.properties | 19 + .../html/Adding_SGX_Nature_to_a_Project.htm | 22 + ...Adding_SGX_Nature_to_a_non_SGX_project.htm | 55 + .../html/Adding_an_SGX_Enclave.htm | 54 + .../html/Adding_an_SGX_Trusted_Library.htm | 39 + .../html/Adding_an_SGX_Untrusted_Module.htm | 39 + .../html/Building_and_Running_SGX_Code.htm | 25 + .../html/Command_Reference.htm | 30 + ...tware_Guard_Extensions_Eclipse_Plug-in.htm | 31 + ...ting_a_New_C_C_Project_with_SGX_Nature.htm | 37 + .../html/Generate_Hash.htm | 45 + .../html/Generate_Signed_Enclaves.htm | 39 + .../html/Getting_Started.htm | 23 + ...ftware_Guard_Extensions_Eclipse_Plugin.htm | 40 + ...tware_Guard _Extensions_Eclipse_Plugin.htm | 42 + ...ducing_Intel_Software_Guard_Extensions.htm | 23 + .../html/Introduction.htm | 21 + .../html/Legal_Information.htm | 70 + .../html/Prerequisites.htm | 27 + .../Images/A_Generated_Trusted_Library.png | Bin 0 -> 33927 bytes .../Add_New_Intel_SGX_Enclave_Dialog.png | Bin 0 -> 35118 bytes ..._New_SGX_Static_Trusted_Library_Dialog.png | Bin 0 -> 31507 bytes .../Images/Add_Repository_Dialog.png | Bin 0 -> 119018 bytes .../html/Resources/Images/Add_SGX_Nature.png | Bin 0 -> 146667 bytes .../Images/Add_SGX_Untrusted_Module.png | Bin 0 -> 29680 bytes ...tions_Specific_to_Intel_SGX_Technology.png | Bin 0 -> 34117 bytes .../Configure_SGX_Hardware_Release_Mode.png | Bin 0 -> 23884 bytes ...ying_the_Untrusted_Module_to_a_Project.png | Bin 0 -> 23980 bytes .../Customization_of_SGX_build_command.png | Bin 0 -> 52127 bytes .../Resources/Images/Down_Arrow_Button.png | Bin 0 -> 1119 bytes .../Images/Enclave_Configuration_Settings.png | Bin 0 -> 43019 bytes .../Images/Generate_Signed_Enclave_Dialog.png | Bin 0 -> 108783 bytes ...Enclave_Dialog_with_Pre_configurations.png | Bin 0 -> 82977 bytes ...Generated_Sample_Untrusted_Application.png | Bin 0 -> 56910 bytes .../Generated_Skeleton_for_an_Enclave.png | Bin 0 -> 28990 bytes .../Generating_Hash_Completion_Dialog.png | Bin 0 -> 54082 bytes ...ort_or_Re_Generate_Enclave_Signing_Key.png | Bin 0 -> 82732 bytes .../Images/Intel_SGX_Configurations.png | Bin 0 -> 23884 bytes .../html/Resources/Images/Intel_SGX_Tools.png | Bin 0 -> 46580 bytes .../Images/Makefile_for_Intel_SGX.png | Bin 0 -> 46699 bytes .../html/Resources/Images/New_Project.png | Bin 0 -> 30093 bytes .../Resources/Images/Project_Explorer.png | Bin 0 -> 123188 bytes .../html/Resources/Images/Project_Menu.png | Bin 0 -> 41992 bytes .../Resources/Images/SGX_Preference_Page.png | Bin 0 -> 32021 bytes .../Resources/Images/Sample_Application.png | Bin 0 -> 175374 bytes .../Images/Select_Configuration_File.png | Bin 0 -> 40998 bytes ...The_Location_of_the_Plugin_zip_Archive.png | Bin 0 -> 61479 bytes ...Running_Samples_Generated_for_Enclaves.png | Bin 0 -> 45589 bytes .../Two_StepSigne_Enclave_Generate_Hash.png | Bin 0 -> 56527 bytes .../Images/Two_Step_Sign_Enclave_Menu.png | Bin 0 -> 55509 bytes .../html/Resources/PageLayouts/Default.flpgl | 22 + .../Stylesheets/intel_css_styles.css | 443 + ...Running_Samples_Generated_for_Enclaves.htm | 31 + .../html/SGX_Build_Configurations.htm | 97 + .../html/SGX_title.htm | 30 + .../html/Two_Steps_Sign_Enclave.htm | 59 + .../Updating_Enclave_Configuration_Files.htm | 39 + .../html/Updating_SGX_Enclave_Signing_Key.htm | 37 + .../com.intel.sgx.userguide/html/content.html | 557 + .../com.intel.sgx.userguide/plugin.xml | 24 + .../com/intel/sgx/userguide/Activator.java | 73 + .../plugins/com.intel.sgx.userguide/toc.xml | 90 + .../plugins/com.intel.sgx/.classpath | 18 + .../plugins/com.intel.sgx/.project | 39 + .../.settings/org.eclipse.jdt.core.prefs | 12 + .../com.intel.sgx/META-INF/MANIFEST.MF | 26 + .../OSGI-INF/l10n/bundle.properties | 15 + .../plugins/com.intel.sgx/build.properties | 24 + .../plugins/com.intel.sgx/discovery/test.c | 2 + .../plugins/com.intel.sgx/discovery/test.cpp | 2 + .../plugins/com.intel.sgx/plugin.xml | 786 ++ .../src/com/intel/sgx/Activator.java | 75 + .../sgx/CConfigurationDataProvider2.java | 46 + .../src/com/intel/sgx/Messages.java | 37 + .../intel/sgx/SdkPathVariableProvider.java | 70 + .../sgx/build/SGXSDKCommandLauncher.java | 38 + .../sgx/dialogs/AddEnclaveFileDialog.java | 126 + .../AddTrustedStaticLibFileDialog.java | 109 + .../sgx/dialogs/AddUntrustedModuleDialog.java | 138 + .../sgx/dialogs/EnclaveConfigDialog.java | 257 + .../sgx/dialogs/RemoveEnclaveFileDialog.java | 122 + .../com/intel/sgx/dialogs/SGXDialogBase.java | 222 + .../sgx/dialogs/TwoStepSignDialogBase.java | 174 + .../sgx/dialogs/TwoStepSignStep1Dialog1.java | 72 + .../sgx/dialogs/TwoStepSignStep1Dialog2.java | 89 + .../sgx/dialogs/TwoStepSignStep1Dialog3.java | 105 + .../sgx/dialogs/TwoStepSignStep2Dialog.java | 92 + .../sgx/dialogs/UpdateSignKeyDialog.java | 191 + .../discovery/SGXSDKDiscoveredPathInfo.java | 202 + .../sgx/discovery/SGXSDKDiscoveryUpdater.java | 310 + .../discovery/SGXSDKScannerInfoCollector.java | 103 + .../com/intel/sgx/handlers/AddEnclave.java | 213 + .../com/intel/sgx/handlers/AddSGXNature.java | 163 + .../sgx/handlers/AddTrustedStaticLib.java | 193 + .../sgx/handlers/AddUntrustedModule.java | 231 + .../sgx/handlers/EnclaveConfigHandler.java | 156 + .../handlers/ModuleCreationBaseHandler.java | 39 + .../com/intel/sgx/handlers/RemoveEnclave.java | 169 + .../com/intel/sgx/handlers/SGXHandler.java | 206 + .../sgx/handlers/SGXSDKWizardHandler.java | 38 + .../sgx/handlers/TwoStepSignHandlerBase.java | 196 + .../intel/sgx/handlers/TwoStepSignStep1.java | 74 + .../intel/sgx/handlers/TwoStepSignStep2.java | 39 + .../intel/sgx/handlers/UpdateSigningKey.java | 101 + .../src/com/intel/sgx/handlers/about.html | 37 + .../src/com/intel/sgx/messages.properties | 16 + .../com/intel/sgx/natures/SGXCCNature.java | 45 + .../src/com/intel/sgx/natures/SGXNature.java | 45 + .../intel/sgx/natures/SGXStaticCCNature.java | 45 + .../intel/sgx/preferences/ISDKDescriptor.java | 29 + .../sgx/preferences/PreferenceConstants.java | 112 + .../preferences/PreferenceInitializer.java | 32 + .../sgx/preferences/SGXPreferencePage.java | 110 + .../sgx/templates/CreateNativeFolders.java | 230 + .../com/intel/sgx/templates/SetCCNature.java | 77 + .../sgx/templates/SetStaticCCNature.java | 75 + .../intel/sgx/testers/SGXPropertyTester.java | 79 + .../intel/sgx/wizards/SGXCCProjectWizard.java | 145 + .../intel/sgx/wizards/SGXCProjectWizard.java | 146 + .../plugins/com.intel.sgx/templates/SGX.gif | Bin 0 -> 51766 bytes .../c++/minimal/enclavetemplate.xml | 61 + .../c++/minimal/trustedstatictemplate.xml | 52 + .../c++/minimal/untrusted_module_template.xml | 37 + .../c++/with_sample/enclavetemplate.xml | 76 + .../c/minimal/enclavetemplate.xml | 61 + .../c/minimal/trustedstatictemplate.xml | 51 + .../c/minimal/untrusted_module_template.xml | 36 + .../c/with_sample/enclavetemplate.xml | 76 + .../SGXtemplates/common/addnaturetemplate.xml | 46 + .../templates/SGXtemplates/configtemplate.xml | 26 + .../templates/SGXtemplates/ctemplate.xml | 83 + .../SGXtemplates/cxxstaticlibtemplate.xml | 109 + .../templates/SGXtemplates/cxxtemplate.xml | 44 + .../SGXtemplates/template.properties | 63 + .../com.intel.sgx/templates/newmngc_app.gif | Bin 0 -> 612 bytes .../com.intel.sgx/templates/newmngcc_app.gif | Bin 0 -> 630 bytes .../templates/resources/Basename.config.xml | 9 + .../templates/resources/Basename_private.pem | 39 + .../sgx/SGXEnclave/makefiles/c++/sgx_t.mk | 127 + .../sgx/SGXEnclave/makefiles/c++/sgx_u.mk | 129 + .../makefiles/c++/sgx_u.without_app.mk | 71 + .../sgx/SGXEnclave/makefiles/c/sgx_t.mk | 115 + .../sgx/SGXEnclave/makefiles/c/sgx_u.mk | 126 + .../makefiles/c/sgx_u.without_app.mk | 70 + .../sgx/SGXEnclave/makefiles/common/Makefile | 8 + .../SGXEnclave/trusted/Enclave1.config.xml | 10 + .../sgx/SGXEnclave/trusted/Enclave1.cpp | 26 + .../sgx/SGXEnclave/trusted/Enclave1.edl | 18 + .../sgx/SGXEnclave/trusted/Enclave1.h | 17 + .../sgx/SGXEnclave/trusted/Enclave1.lds | 9 + .../SGXEnclave/trusted/Enclave1_minimal.cpp | 7 + .../SGXEnclave/trusted/Enclave1_minimal.edl | 10 + .../SGXEnclave/trusted/Enclave1_private.pem | 39 + .../sgx/SGXEnclave/untrusted/sample.cpp | 247 + .../sgx/SGXEnclave/untrusted/sample.h | 34 + .../templates/sgx/SGXNature/Makefile | 17 + .../makefiles/c++/sgx_t_static.mk | 105 + .../makefiles/c++/sgx_u.without_app.mk | 71 + .../makefiles/c/sgx_t_static.mk | 95 + .../makefiles/c/sgx_u.without_app.mk | 70 + .../makefiles/common/Makefile | 8 + .../makefiles/common/Makefile.without_app | 8 + .../static_trusted/Enclave2_minimal.cpp | 7 + .../static_trusted/Enclave2_minimal.edl | 11 + .../makefiles/c++/sgx_u.without_app.mk | 75 + .../makefiles/c/sgx_u.without_app.mk | 75 + .../makefiles/common/Makefile | 6 + .../untrusted/untrusted_module.cpp | 1 + .../build_directory/sites/site.xml | 21 + Linux_SGXEclipsePlugin/clean.sh | 20 + Linux_SGXEclipsePlugin/readme.txt | 21 + .../src/main/groovy/preprocessHtml.groovy | 34 + Makefile | 56 + SampleCode/LocalAttestation/.cproject | 219 + SampleCode/LocalAttestation/.project | 28 + SampleCode/LocalAttestation/App/App.cpp | 446 + .../Enclave1/Enclave1.config.xml | 11 + .../LocalAttestation/Enclave1/Enclave1.cpp | 373 + .../LocalAttestation/Enclave1/Enclave1.edl | 43 + .../Enclave1/Enclave1_private.pem | 39 + .../LocalAttestation/Enclave1/Utility_E1.cpp | 222 + .../LocalAttestation/Enclave1/Utility_E1.h | 65 + .../Enclave2/Enclave2.config.xml | 11 + .../LocalAttestation/Enclave2/Enclave2.cpp | 339 + .../LocalAttestation/Enclave2/Enclave2.edl | 43 + .../Enclave2/Enclave2_private.pem | 39 + .../LocalAttestation/Enclave2/Utility_E2.cpp | 213 + .../LocalAttestation/Enclave2/Utility_E2.h | 59 + .../Enclave3/Enclave3.config.xml | 11 + .../LocalAttestation/Enclave3/Enclave3.cpp | 366 + .../LocalAttestation/Enclave3/Enclave3.edl | 42 + .../Enclave3/Enclave3_private.pem | 39 + .../LocalAttestation/Enclave3/Utility_E3.cpp | 223 + .../LocalAttestation/Enclave3/Utility_E3.h | 73 + .../Include/dh_session_protocol.h | 68 + .../EnclaveMessageExchange.cpp | 721 ++ .../EnclaveMessageExchange.h | 54 + .../LocalAttestationCode.edl | 49 + .../LocalAttestationCode/datatypes.h | 105 + .../LocalAttestationCode/error_codes.h | 53 + SampleCode/LocalAttestation/Makefile | 297 + SampleCode/LocalAttestation/README.txt | 27 + .../UntrustedEnclaveMessageExchange.cpp | 184 + .../UntrustedEnclaveMessageExchange.h | 73 + SampleCode/PowerTransition/.cproject | 219 + SampleCode/PowerTransition/.project | 28 + SampleCode/PowerTransition/App/App.cpp | 319 + .../PowerTransition/App/ErrorSupport.cpp | 89 + SampleCode/PowerTransition/App/ErrorSupport.h | 49 + SampleCode/PowerTransition/App/rwlock.cpp | 84 + SampleCode/PowerTransition/App/rwlock.h | 57 + SampleCode/PowerTransition/Common/types.h | 48 + .../Enclave/Enclave.config.xml | 11 + .../PowerTransition/Enclave/Enclave.cpp | 164 + .../PowerTransition/Enclave/Enclave.edl | 47 + .../PowerTransition/Enclave/Enclave.lds | 9 + .../Enclave/Enclave_private.pem | 39 + SampleCode/PowerTransition/Makefile | 212 + SampleCode/PowerTransition/README.txt | 26 + SampleCode/RemoteAttestation/.cproject | 219 + SampleCode/RemoteAttestation/.project | 28 + SampleCode/RemoteAttestation/Makefile | 230 + SampleCode/RemoteAttestation/README.txt | 27 + .../RemoteAttestation/isv_app/isv_app.cpp | 644 ++ .../isv_app/sample_messages.h | 537 + .../isv_enclave/isv_enclave.config.xml | 11 + .../isv_enclave/isv_enclave.cpp | 265 + .../isv_enclave/isv_enclave.edl | 53 + .../isv_enclave/isv_enclave.lds | 9 + .../isv_enclave/isv_enclave_private.pem | 39 + .../service_provider/ecp.cpp | 172 + .../RemoteAttestation/service_provider/ecp.h | 96 + .../service_provider/ias_ra.cpp | 258 + .../service_provider/ias_ra.h | 210 + .../service_provider/network_ra.cpp | 123 + .../service_provider/network_ra.h | 92 + .../remote_attestation_result.h | 105 + .../service_provider/service_provider.cpp | 660 ++ .../service_provider/service_provider.h | 130 + SampleCode/SampleEnclave/.cproject | 219 + SampleCode/SampleEnclave/.project | 28 + SampleCode/SampleEnclave/App/App.cpp | 265 + SampleCode/SampleEnclave/App/App.h | 74 + .../App/Edger8rSyntax/Arrays.cpp | 92 + .../App/Edger8rSyntax/Functions.cpp | 72 + .../App/Edger8rSyntax/Pointers.cpp | 149 + .../SampleEnclave/App/Edger8rSyntax/Types.cpp | 77 + .../SampleEnclave/App/TrustedLibrary/Libc.cpp | 51 + .../App/TrustedLibrary/Libcxx.cpp | 51 + .../App/TrustedLibrary/Thread.cpp | 98 + .../Enclave/Edger8rSyntax/Arrays.cpp | 102 + .../Enclave/Edger8rSyntax/Arrays.edl | 98 + .../Enclave/Edger8rSyntax/Functions.cpp | 84 + .../Enclave/Edger8rSyntax/Functions.edl | 88 + .../Enclave/Edger8rSyntax/Pointers.cpp | 217 + .../Enclave/Edger8rSyntax/Pointers.edl | 190 + .../Enclave/Edger8rSyntax/Types.cpp | 155 + .../Enclave/Edger8rSyntax/Types.edl | 87 + .../SampleEnclave/Enclave/Enclave.config.xml | 12 + SampleCode/SampleEnclave/Enclave/Enclave.cpp | 51 + SampleCode/SampleEnclave/Enclave/Enclave.edl | 62 + SampleCode/SampleEnclave/Enclave/Enclave.h | 49 + SampleCode/SampleEnclave/Enclave/Enclave.lds | 9 + .../SampleEnclave/Enclave/Enclave_private.pem | 39 + .../Enclave/TrustedLibrary/Libc.cpp | 59 + .../Enclave/TrustedLibrary/Libc.edl | 55 + .../Enclave/TrustedLibrary/Libcxx.cpp | 89 + .../Enclave/TrustedLibrary/Libcxx.edl | 52 + .../Enclave/TrustedLibrary/Thread.cpp | 104 + .../Enclave/TrustedLibrary/Thread.edl | 51 + SampleCode/SampleEnclave/Include/user_types.h | 40 + SampleCode/SampleEnclave/Makefile | 209 + SampleCode/SampleEnclave/README.txt | 29 + build-scripts/enclave.lds | 9 + buildenv.mk | 153 + common/inc/internal/ae_ipp.h | 39 + common/inc/internal/arch.h | 297 + common/inc/internal/cpprt_internal.h | 38 + common/inc/internal/cpputil.h | 65 + common/inc/internal/cpuid.h | 38 + common/inc/internal/dh.h | 43 + common/inc/internal/driver_api.h | 50 + common/inc/internal/ecp_interface.h | 53 + common/inc/internal/elf_util.h | 72 + common/inc/internal/elfheader/README.txt | 59 + common/inc/internal/elfheader/elf_common.h | 975 ++ common/inc/internal/elfheader/elfstructs.h | 527 + common/inc/internal/enclave_creator.h | 85 + common/inc/internal/global_data.h | 70 + common/inc/internal/global_init.h | 48 + common/inc/internal/inst.h | 60 + common/inc/internal/ipp_wrapper.h | 89 + common/inc/internal/linux/cpuid_gnu.h | 76 + common/inc/internal/linux/linux-regs.h | 272 + common/inc/internal/linux/xsave_gnu.h | 92 + common/inc/internal/metadata.h | 150 + common/inc/internal/oal/uae_oal_api.h | 125 + common/inc/internal/routine.h | 55 + common/inc/internal/rts.h | 74 + common/inc/internal/rts_cmd.h | 40 + common/inc/internal/se_atomic.h | 60 + common/inc/internal/se_cdefs.h | 103 + common/inc/internal/se_cpu_feature.h | 49 + common/inc/internal/se_cpu_feature_defs.h | 294 + common/inc/internal/se_debugger_lib.h | 115 + common/inc/internal/se_enclave_type.h | 41 + common/inc/internal/se_error_internal.h | 90 + common/inc/internal/se_event.h | 61 + common/inc/internal/se_lock.hpp | 61 + common/inc/internal/se_macro.h | 40 + common/inc/internal/se_map.h | 67 + common/inc/internal/se_memcpy.h | 54 + common/inc/internal/se_memory.h | 136 + common/inc/internal/se_page_attr.h | 47 + common/inc/internal/se_quote_internal.h | 73 + common/inc/internal/se_rwlock.h | 56 + common/inc/internal/se_stdio.h | 155 + common/inc/internal/se_string.h | 73 + common/inc/internal/se_thread.h | 75 + common/inc/internal/se_time.h | 52 + common/inc/internal/se_trace.h | 89 + common/inc/internal/se_types.h | 93 + common/inc/internal/se_vendor.h | 38 + common/inc/internal/se_version.h | 32 + common/inc/internal/se_wrapper.h | 50 + common/inc/internal/sgx_memset_s.h | 40 + common/inc/internal/sgx_profile.h | 104 + common/inc/internal/sgx_read_rand.h | 40 + common/inc/internal/sgx_tcrypto_internal.h | 64 + common/inc/internal/tae_service_internal.h | 61 + common/inc/internal/thread_data.h | 125 + common/inc/internal/trts_inst.h | 70 + common/inc/internal/uae_service_internal.h | 74 + common/inc/internal/uncopyable.h | 47 + common/inc/internal/util.h | 79 + common/inc/internal/xsave.h | 63 + common/inc/sgx.h | 40 + common/inc/sgx_attributes.h | 67 + common/inc/sgx_cpuid.h | 57 + common/inc/sgx_defs.h | 54 + common/inc/sgx_dh.h | 161 + common/inc/sgx_ecp_types.h | 60 + common/inc/sgx_edger8r.h | 107 + common/inc/sgx_eid.h | 39 + common/inc/sgx_error.h | 92 + common/inc/sgx_intrin.h | 64 + common/inc/sgx_key.h | 88 + common/inc/sgx_key_exchange.h | 86 + common/inc/sgx_quote.h | 109 + common/inc/sgx_report.h | 98 + common/inc/sgx_sha256_128.h | 47 + common/inc/sgx_spinlock.h | 57 + common/inc/sgx_tae_service.edl | 52 + common/inc/sgx_tae_service.h | 124 + common/inc/sgx_tcrypto.h | 588 + common/inc/sgx_thread.h | 113 + common/inc/sgx_tkey_exchange.edl | 50 + common/inc/sgx_tkey_exchange.h | 116 + common/inc/sgx_trts.h | 81 + common/inc/sgx_trts_exception.h | 148 + common/inc/sgx_tseal.h | 257 + common/inc/sgx_tstdc.edl | 48 + common/inc/sgx_uae_service.h | 146 + common/inc/sgx_ukey_exchange.h | 199 + common/inc/sgx_urts.h | 65 + common/inc/sgx_utils.h | 90 + common/inc/stdc++/exception | 38 + common/inc/stdc++/linux/exception | 77 + common/inc/stdc++/linux/typeinfo | 138 + common/inc/stdc++/new | 69 + common/inc/stdc++/typeinfo | 38 + common/inc/tlibc/assert.h | 63 + common/inc/tlibc/complex.h | 134 + common/inc/tlibc/ctype.h | 64 + common/inc/tlibc/endian.h | 33 + common/inc/tlibc/errno.h | 187 + common/inc/tlibc/float.h | 84 + common/inc/tlibc/inttypes.h | 330 + common/inc/tlibc/iso646.h | 26 + common/inc/tlibc/limits.h | 41 + common/inc/tlibc/math.h | 430 + common/inc/tlibc/stdarg.h | 48 + common/inc/tlibc/stdbool.h | 44 + common/inc/tlibc/stddef.h | 70 + common/inc/tlibc/stdint.h | 24 + common/inc/tlibc/stdio.h | 95 + common/inc/tlibc/stdlib.h | 159 + common/inc/tlibc/string.h | 125 + common/inc/tlibc/sys/_types.h | 133 + common/inc/tlibc/sys/cdefs.h | 132 + common/inc/tlibc/sys/endian.h | 54 + common/inc/tlibc/sys/ieee.h | 145 + common/inc/tlibc/sys/limits.h | 77 + common/inc/tlibc/sys/stdint.h | 253 + common/inc/tlibc/sys/types.h | 128 + common/inc/tlibc/time.h | 104 + common/inc/tlibc/unistd.h | 59 + common/inc/tlibc/wchar.h | 139 + common/inc/tlibc/wctype.h | 83 + common/se_wrapper/Makefile | 61 + common/src/dh.cpp | 77 + common/src/ecp.cpp | 111 + common/src/ipp_bn.cpp | 125 + common/src/ipp_rsa_key.cpp | 351 + common/src/ipp_rsa_pub_key.cpp | 110 + common/src/se_event.c | 68 + common/src/se_map.c | 69 + common/src/se_memory.c | 153 + common/src/se_rwlock.c | 85 + common/src/se_thread.c | 87 + common/src/se_time.c | 54 + common/src/se_trace.c | 48 + common/src/sgx_memset_s.cpp | 78 + common/src/sgx_profile.cpp | 149 + common/src/sgx_read_rand.cpp | 101 + common/src/sgx_sha256_128.cpp | 81 + download_prebuilt.sh | 42 + external/crypto_px/Makefile | 62 + external/crypto_px/include/ippbase.h | 195 + external/crypto_px/include/ippcore.h | 395 + external/crypto_px/include/ippcp.h | 327 + external/crypto_px/include/ippcpdefs.h | 211 + external/crypto_px/include/ippdefs.h | 129 + external/crypto_px/include/ipptypes.h | 1104 ++ external/crypto_px/include/ippversion.h | 41 + external/crypto_px/sources/include/cpudef.h | 264 + external/crypto_px/sources/include/ippver.gen | 56 + external/crypto_px/sources/include/ippver.h | 46 + .../crypto_px/sources/include/ippverstr.gen | 120 + external/crypto_px/sources/include/owndefs.h | 944 ++ external/crypto_px/sources/ippcp/src/owncp.h | 149 + .../sources/ippcp/src/pcpaesauthcmacca.c | 396 + .../sources/ippcp/src/pcpaesauthgcm.h | 141 + .../sources/ippcp/src/pcpaesauthgcmca.c | 731 ++ .../sources/ippcp/src/pcpaesgcmtableca.c | 52 + .../sources/ippcp/src/pcpaesgcmtbl2kca.c | 229 + .../crypto_px/sources/ippcp/src/pcpaesm.h | 50 + .../sources/ippcp/src/pcpaesmctrca.c | 150 + .../sources/ippcp/src/pcpaesminitca.c | 173 + external/crypto_px/sources/ippcp/src/pcpbn.h | 210 + .../crypto_px/sources/ippcp/src/pcpbnca.c | 1058 ++ .../sources/ippcp/src/pcpbnresource.h | 51 + .../sources/ippcp/src/pcpbnresourceca.c | 93 + .../crypto_px/sources/ippcp/src/pcpbnsetca.c | 119 + .../sources/ippcp/src/pcpbnu32arith.c | 234 + .../sources/ippcp/src/pcpbnu32arith.h | 46 + .../sources/ippcp/src/pcpbnu32misc.c | 53 + .../sources/ippcp/src/pcpbnu32misc.h | 49 + .../crypto_px/sources/ippcp/src/pcpbnuarith.c | 301 + .../crypto_px/sources/ippcp/src/pcpbnuarith.h | 114 + .../crypto_px/sources/ippcp/src/pcpbnuimpl.h | 141 + .../crypto_px/sources/ippcp/src/pcpbnumisc.c | 208 + .../crypto_px/sources/ippcp/src/pcpbnumisc.h | 149 + .../crypto_px/sources/ippcp/src/pcpcmac.h | 70 + .../crypto_px/sources/ippcp/src/pcpeccp.h | 230 + .../crypto_px/sources/ippcp/src/pcpeccpdpca.c | 370 + .../sources/ippcp/src/pcpeccpgenkeyca.c | 107 + .../sources/ippcp/src/pcpeccpinitca.c | 305 + .../sources/ippcp/src/pcpeccpmethod.h | 93 + .../sources/ippcp/src/pcpeccpmethodcom.h | 133 + .../sources/ippcp/src/pcpeccpmethodcomca.c | 731 ++ .../sources/ippcp/src/pcpeccppoint.h | 60 + .../sources/ippcp/src/pcpeccppointca.c | 128 + .../sources/ippcp/src/pcpeccppointopca.c | 476 + .../sources/ippcp/src/pcpeccppublickeyca.c | 89 + .../sources/ippcp/src/pcpeccpsecretdhca.c | 116 + .../sources/ippcp/src/pcpeccpsetkeyca.c | 105 + .../sources/ippcp/src/pcpeccpsigndsaca.c | 149 + .../crypto_px/sources/ippcp/src/pcpeccpsscm.c | 161 + .../crypto_px/sources/ippcp/src/pcpeccpsscm.h | 49 + .../sources/ippcp/src/pcpeccpstdca.c | 324 + .../sources/ippcp/src/pcpeccpverifydsaca.c | 145 + .../crypto_px/sources/ippcp/src/pcphash.h | 159 + .../crypto_px/sources/ippcp/src/pcphashca.c | 513 + .../crypto_px/sources/ippcp/src/pcphashcnt.c | 216 + .../sources/ippcp/src/pcphashmd5px.c | 197 + .../sources/ippcp/src/pcphashsha1px.c | 174 + .../sources/ippcp/src/pcphashsha256px.c | 199 + .../sources/ippcp/src/pcphashsha512px.c | 207 + .../crypto_px/sources/ippcp/src/pcphmac.h | 55 + .../crypto_px/sources/ippcp/src/pcphmacca.c | 332 + .../sources/ippcp/src/pcpmontexpbinca.c | 116 + .../sources/ippcp/src/pcpmontgomery.h | 190 + .../sources/ippcp/src/pcpmontgomeryca.c | 296 + .../crypto_px/sources/ippcp/src/pcpmontred.c | 64 + .../crypto_px/sources/ippcp/src/pcpname.h | 56 + .../crypto_px/sources/ippcp/src/pcpngrsa.h | 110 + .../sources/ippcp/src/pcpngrsaencodec.c | 437 + .../sources/ippcp/src/pcpngrsaesoaepca.c | 176 + .../sources/ippcp/src/pcpngrsagenerate.c | 323 + .../sources/ippcp/src/pcpngrsakeyprivate.c | 496 + .../sources/ippcp/src/pcpngrsakeypublic.c | 272 + .../sources/ippcp/src/pcpngrsamontstuff.c | 531 + .../sources/ippcp/src/pcpngrsamontstuff.h | 229 + .../sources/ippcp/src/pcpngrsassapkcsv15ca.c | 278 + external/crypto_px/sources/ippcp/src/pcppma.h | 83 + .../crypto_px/sources/ippcp/src/pcpprimeg.h | 78 + .../sources/ippcp/src/pcpprimegenca.c | 472 + .../sources/ippcp/src/pcpprimeginitca.c | 124 + .../crypto_px/sources/ippcp/src/pcpprng.h | 65 + .../crypto_px/sources/ippcp/src/pcpprngenca.c | 178 + .../sources/ippcp/src/pcpprnginitca.c | 113 + external/crypto_px/sources/ippcp/src/pcprij.h | 141 + .../sources/ippcp/src/pcprij128safe2.h | 79 + .../sources/ippcp/src/pcprij128safedec2pxca.c | 133 + .../sources/ippcp/src/pcprij128safeenc2pxca.c | 125 + .../sources/ippcp/src/pcprijdecsboxca.c | 37 + .../sources/ippcp/src/pcprijencsboxca.c | 37 + .../sources/ippcp/src/pcprijkeysca.c | 196 + .../sources/ippcp/src/pcprijtables.h | 199 + .../crypto_px/sources/ippcp/src/pcpscramble.h | 170 + .../crypto_px/sources/ippcp/src/pcpshsmgfca.c | 109 + .../crypto_px/sources/ippcp/src/pcptool.h | 177 + external/crypto_px/sources/ippcp/src/pcpver.c | 41 + external/crypto_px/sources/ippcp/src/pcpver.h | 36 + external/epid/inc/epid_types.h | 305 + external/rdrand/rdrand.h | 156 + external/rdrand/src/Makefile.in | 29 + external/rdrand/src/README | 26 + external/rdrand/src/config.h.in | 53 + external/rdrand/src/configure | 4284 ++++++++ external/rdrand/src/configure.ac | 21 + external/rdrand/src/main.c | 95 + external/rdrand/src/rdrand.c | 385 + external/rdrand/src/rdrand.h | 169 + external/sgx_libm/ia32/acos_wmt.S | 1927 ++++ external/sgx_libm/ia32/acosf_wmt.S | 551 + external/sgx_libm/ia32/acosh_wmt.S | 1922 ++++ external/sgx_libm/ia32/acoshf_wmt.S | 1292 +++ external/sgx_libm/ia32/acoshl.S | 883 ++ external/sgx_libm/ia32/acosl.S | 1211 +++ external/sgx_libm/ia32/asin_wmt.S | 2008 ++++ external/sgx_libm/ia32/asinf_wmt.S | 514 + external/sgx_libm/ia32/asinh_wmt.S | 1860 ++++ external/sgx_libm/ia32/asinhf_wmt.S | 1256 +++ external/sgx_libm/ia32/asinhl.S | 1003 ++ external/sgx_libm/ia32/asinl.S | 1176 ++ external/sgx_libm/ia32/atan2_wmt.S | 1219 +++ external/sgx_libm/ia32/atan2dl.S | 1431 +++ external/sgx_libm/ia32/atan2f_wmt.S | 791 ++ external/sgx_libm/ia32/atan2l.S | 1195 +++ external/sgx_libm/ia32/atan_wmt.S | 922 ++ external/sgx_libm/ia32/atandl_table.S | 2100 ++++ external/sgx_libm/ia32/atanf_wmt.S | 596 ++ external/sgx_libm/ia32/atanh_wmt.S | 1380 +++ external/sgx_libm/ia32/atanhf_wmt.S | 1328 +++ external/sgx_libm/ia32/atanhl.S | 905 ++ external/sgx_libm/ia32/atanl.S | 732 ++ external/sgx_libm/ia32/atanl_table.S | 1074 ++ external/sgx_libm/ia32/cabs.S | 76 + external/sgx_libm/ia32/cabsf.S | 71 + external/sgx_libm/ia32/cabsl.S | 76 + external/sgx_libm/ia32/cacos.S | 779 ++ external/sgx_libm/ia32/cacosf.S | 638 ++ external/sgx_libm/ia32/cacosh.S | 789 ++ external/sgx_libm/ia32/cacoshf.S | 639 ++ external/sgx_libm/ia32/cacoshl.S | 459 + external/sgx_libm/ia32/cacosl.S | 455 + external/sgx_libm/ia32/carg.S | 94 + external/sgx_libm/ia32/cargf.S | 71 + external/sgx_libm/ia32/cargl.S | 76 + external/sgx_libm/ia32/casin.S | 237 + external/sgx_libm/ia32/casinh.S | 783 ++ external/sgx_libm/ia32/casinhf.S | 630 ++ external/sgx_libm/ia32/casinhl.S | 441 + external/sgx_libm/ia32/casinl.S | 210 + external/sgx_libm/ia32/catan.S | 237 + external/sgx_libm/ia32/catanh.S | 727 ++ external/sgx_libm/ia32/catanhf.S | 557 + external/sgx_libm/ia32/catanhl.S | 2875 +++++ external/sgx_libm/ia32/catanl.S | 210 + external/sgx_libm/ia32/cbrt_wmt.S | 735 ++ external/sgx_libm/ia32/cbrtf_wmt.S | 504 + external/sgx_libm/ia32/cbrtl.S | 374 + external/sgx_libm/ia32/cbrtl_table.S | 560 + external/sgx_libm/ia32/ccos.S | 181 + external/sgx_libm/ia32/ccosh.S | 468 + external/sgx_libm/ia32/ccoshf.S | 410 + external/sgx_libm/ia32/ccoshl.S | 698 ++ external/sgx_libm/ia32/ccosl.S | 183 + external/sgx_libm/ia32/ceil_wmt.S | 164 + external/sgx_libm/ia32/ceilf_gen.S | 140 + external/sgx_libm/ia32/ceill.S | 247 + external/sgx_libm/ia32/cexp_gen.S | 739 ++ external/sgx_libm/ia32/cexpf_gen.S | 223 + external/sgx_libm/ia32/cexpl.S | 611 ++ external/sgx_libm/ia32/cimag.S | 58 + external/sgx_libm/ia32/cimagf.S | 58 + external/sgx_libm/ia32/cimagl.S | 58 + external/sgx_libm/ia32/clog10.S | 716 ++ external/sgx_libm/ia32/clog10l.S | 975 ++ external/sgx_libm/ia32/clog_gen.S | 756 ++ external/sgx_libm/ia32/clogf_wmt.S | 2539 +++++ external/sgx_libm/ia32/clogl.S | 751 ++ external/sgx_libm/ia32/complex_real.S | 291 + external/sgx_libm/ia32/conj.S | 91 + external/sgx_libm/ia32/conjf.S | 65 + external/sgx_libm/ia32/conjl.S | 98 + external/sgx_libm/ia32/copysign_wmt.S | 108 + external/sgx_libm/ia32/copysignf_wmt.S | 118 + external/sgx_libm/ia32/copysignl.S | 119 + external/sgx_libm/ia32/cos_wmt.S | 765 ++ external/sgx_libm/ia32/cosdl.S | 689 ++ external/sgx_libm/ia32/cosf_wmt.S | 590 ++ external/sgx_libm/ia32/cosh_wmt.S | 1351 +++ external/sgx_libm/ia32/coshf_wmt.S | 405 + external/sgx_libm/ia32/coshl.S | 942 ++ external/sgx_libm/ia32/cosl.S | 1022 ++ external/sgx_libm/ia32/cpow.S | 898 ++ external/sgx_libm/ia32/cpowl.S | 190 + external/sgx_libm/ia32/cproj.S | 164 + external/sgx_libm/ia32/cprojf.S | 110 + external/sgx_libm/ia32/cprojl.S | 155 + external/sgx_libm/ia32/creal.S | 58 + external/sgx_libm/ia32/crealf.S | 58 + external/sgx_libm/ia32/creall.S | 58 + external/sgx_libm/ia32/csin.S | 237 + external/sgx_libm/ia32/csinh.S | 408 + external/sgx_libm/ia32/csinhf.S | 368 + external/sgx_libm/ia32/csinhl.S | 655 ++ external/sgx_libm/ia32/csinl.S | 210 + external/sgx_libm/ia32/csqrt_wmt.S | 763 ++ external/sgx_libm/ia32/csqrtf_wmt.S | 351 + external/sgx_libm/ia32/csqrtl.S | 739 ++ external/sgx_libm/ia32/ctan.S | 237 + external/sgx_libm/ia32/ctanh.S | 565 + external/sgx_libm/ia32/ctanhf.S | 470 + external/sgx_libm/ia32/ctanhl.S | 975 ++ external/sgx_libm/ia32/ctanl.S | 210 + external/sgx_libm/ia32/dpml_ux_bessel.S | 7116 +++++++++++++ external/sgx_libm/ia32/dpml_ux_log.S | 365 + external/sgx_libm/ia32/dpml_ux_ops.S | 3653 +++++++ external/sgx_libm/ia32/dpml_ux_ops_64.S | 4636 ++++++++ external/sgx_libm/ia32/dpml_ux_sqrt.S | 1321 +++ external/sgx_libm/ia32/dpml_ux_trig.S | 4138 ++++++++ external/sgx_libm/ia32/erf.S | 583 + external/sgx_libm/ia32/erfc.S | 3498 ++++++ external/sgx_libm/ia32/erfcf.S | 635 ++ external/sgx_libm/ia32/erfcl.S | 3850 +++++++ external/sgx_libm/ia32/erff.S | 251 + external/sgx_libm/ia32/erfl.S | 1925 ++++ external/sgx_libm/ia32/exp10_wmt.S | 580 + external/sgx_libm/ia32/exp10f_wmt.S | 763 ++ external/sgx_libm/ia32/exp10l.S | 1162 ++ external/sgx_libm/ia32/exp2_wmt.S | 908 ++ external/sgx_libm/ia32/exp2f_wmt.S | 754 ++ external/sgx_libm/ia32/exp2l.S | 1010 ++ external/sgx_libm/ia32/exp_table.S | 522 + external/sgx_libm/ia32/exp_wmt.S | 587 + external/sgx_libm/ia32/expf_wmt.S | 759 ++ external/sgx_libm/ia32/expl.S | 969 ++ external/sgx_libm/ia32/expl_table.S | 562 + external/sgx_libm/ia32/expm1_wmt.S | 703 ++ external/sgx_libm/ia32/expm1f_wmt.S | 808 ++ external/sgx_libm/ia32/expm1l.S | 1235 +++ external/sgx_libm/ia32/fabs.S | 61 + external/sgx_libm/ia32/fabsf.S | 61 + external/sgx_libm/ia32/fabsl.S | 121 + external/sgx_libm/ia32/fdim_wmt.S | 181 + external/sgx_libm/ia32/fdimf_wmt.S | 181 + external/sgx_libm/ia32/fdiml.S | 292 + external/sgx_libm/ia32/feclearexcept.S | 94 + external/sgx_libm/ia32/fedisableexcept.S | 99 + external/sgx_libm/ia32/feenableexcept.S | 102 + external/sgx_libm/ia32/fegetenv.S | 75 + external/sgx_libm/ia32/fegetexcept.S | 64 + external/sgx_libm/ia32/fegetexceptflag.S | 73 + external/sgx_libm/ia32/fegetround.S | 63 + external/sgx_libm/ia32/feholdexcept.S | 102 + external/sgx_libm/ia32/feraiseexcept.S | 185 + external/sgx_libm/ia32/fesetenv.S | 124 + external/sgx_libm/ia32/fesetexceptflag.S | 109 + external/sgx_libm/ia32/fesetround.S | 107 + external/sgx_libm/ia32/fetestexcept.S | 74 + external/sgx_libm/ia32/feupdateenv.S | 83 + external/sgx_libm/ia32/floor_wmt.S | 152 + external/sgx_libm/ia32/floorf_gen.S | 145 + external/sgx_libm/ia32/floorl.S | 246 + external/sgx_libm/ia32/fma.S | 1208 +++ external/sgx_libm/ia32/fmaf_wmt.S | 425 + external/sgx_libm/ia32/fmal.S | 1483 +++ external/sgx_libm/ia32/fmax_wmt.S | 113 + external/sgx_libm/ia32/fmaxf_wmt.S | 113 + external/sgx_libm/ia32/fmaxl.S | 189 + external/sgx_libm/ia32/fmin_wmt.S | 113 + external/sgx_libm/ia32/fminf_wmt.S | 113 + external/sgx_libm/ia32/fminl.S | 190 + external/sgx_libm/ia32/fmod_wmt.S | 214 + external/sgx_libm/ia32/fmodf.S | 156 + external/sgx_libm/ia32/fmodl.S | 336 + external/sgx_libm/ia32/fpclassify.S | 465 + external/sgx_libm/ia32/frexp_wmt.S | 149 + external/sgx_libm/ia32/frexpf.S | 112 + external/sgx_libm/ia32/frexpl.S | 171 + external/sgx_libm/ia32/hypot_wmt.S | 230 + external/sgx_libm/ia32/hypotf.S | 183 + external/sgx_libm/ia32/hypotl.S | 858 ++ external/sgx_libm/ia32/ilogb_wmt.S | 171 + external/sgx_libm/ia32/ilogbf.S | 129 + external/sgx_libm/ia32/ilogbl.S | 200 + external/sgx_libm/ia32/intel_quad_exception.S | 2258 ++++ external/sgx_libm/ia32/isfinite.S | 389 + external/sgx_libm/ia32/isinf.S | 313 + external/sgx_libm/ia32/isnan.S | 271 + external/sgx_libm/ia32/isnormal.S | 241 + external/sgx_libm/ia32/j0.S | 2689 +++++ external/sgx_libm/ia32/j0f.S | 588 + external/sgx_libm/ia32/j0l.S | 106 + external/sgx_libm/ia32/j1.S | 2716 +++++ external/sgx_libm/ia32/j1f.S | 695 ++ external/sgx_libm/ia32/j1l.S | 106 + external/sgx_libm/ia32/jn.S | 1477 +++ external/sgx_libm/ia32/jnf.S | 1401 +++ external/sgx_libm/ia32/jnl.S | 109 + external/sgx_libm/ia32/l2q.S | 109 + external/sgx_libm/ia32/ldexp_wmt.S | 242 + external/sgx_libm/ia32/ldexpf.S | 202 + external/sgx_libm/ia32/ldexpl.S | 337 + external/sgx_libm/ia32/lgamma.S | 6404 +++++++++++ external/sgx_libm/ia32/lgammaf.S | 2280 ++++ external/sgx_libm/ia32/lgammal.S | 8398 +++++++++++++++ external/sgx_libm/ia32/libm_atan2l_k80.S | 1634 +++ external/sgx_libm/ia32/libm_coshl_k80.S | 724 ++ external/sgx_libm/ia32/libm_cosl_k80.S | 703 ++ external/sgx_libm/ia32/libm_exp_k32.S | 237 + external/sgx_libm/ia32/libm_expl_k80.S | 386 + external/sgx_libm/ia32/libm_hypot2l_k80.S | 497 + external/sgx_libm/ia32/libm_log1pl_k80.S | 1912 ++++ external/sgx_libm/ia32/libm_log_k32.S | 164 + external/sgx_libm/ia32/libm_logl.S | 737 ++ external/sgx_libm/ia32/libm_logl_k80.S | 1277 +++ external/sgx_libm/ia32/libm_normalizel_k80.S | 163 + external/sgx_libm/ia32/libm_recacoshl_k80.S | 1806 ++++ .../ia32/libm_recacosl_recasinl_k80.S | 6111 +++++++++++ external/sgx_libm/ia32/libm_reduce_pi04d.S | 365 + external/sgx_libm/ia32/libm_reduce_pi04l.S | 3729 +++++++ external/sgx_libm/ia32/libm_scalbl_k80.S | 264 + external/sgx_libm/ia32/libm_sincos_huge.S | 708 ++ external/sgx_libm/ia32/libm_sincos_k32.S | 337 + external/sgx_libm/ia32/libm_sinhl_k80.S | 723 ++ external/sgx_libm/ia32/libm_sinl_k80.S | 676 ++ external/sgx_libm/ia32/libm_strtoull.S | 1128 ++ external/sgx_libm/ia32/libm_tancot_huge.S | 800 ++ external/sgx_libm/ia32/llrint.S | 171 + external/sgx_libm/ia32/llrintf.S | 143 + external/sgx_libm/ia32/llrintl.S | 339 + external/sgx_libm/ia32/llround_wmt.S | 239 + external/sgx_libm/ia32/llroundf_wmt.S | 195 + external/sgx_libm/ia32/llroundl.S | 383 + external/sgx_libm/ia32/log10_wmt.S | 815 ++ external/sgx_libm/ia32/log10f_wmt.S | 745 ++ external/sgx_libm/ia32/log10l.S | 921 ++ external/sgx_libm/ia32/log10l_table.S | 560 + external/sgx_libm/ia32/log1p_wmt.S | 847 ++ external/sgx_libm/ia32/log1pf_wmt.S | 751 ++ external/sgx_libm/ia32/log1pl.S | 949 ++ external/sgx_libm/ia32/log2_wmt.S | 808 ++ external/sgx_libm/ia32/log2f_wmt.S | 745 ++ external/sgx_libm/ia32/log2l.S | 532 + external/sgx_libm/ia32/log2l_table.S | 560 + external/sgx_libm/ia32/log_table.S | 560 + external/sgx_libm/ia32/log_wmt.S | 800 ++ external/sgx_libm/ia32/logb_wmt.S | 171 + external/sgx_libm/ia32/logbf.S | 122 + external/sgx_libm/ia32/logbl.S | 161 + external/sgx_libm/ia32/logf_table.S | 304 + external/sgx_libm/ia32/logf_wmt.S | 742 ++ external/sgx_libm/ia32/logl.S | 70 + external/sgx_libm/ia32/logl_table.S | 560 + external/sgx_libm/ia32/lrint_wmt.S | 188 + external/sgx_libm/ia32/lrintf_wmt.S | 153 + external/sgx_libm/ia32/lrintl.S | 292 + external/sgx_libm/ia32/lround_wmt.S | 220 + external/sgx_libm/ia32/lroundf_wmt.S | 228 + external/sgx_libm/ia32/lroundl.S | 253 + external/sgx_libm/ia32/modf_wmt.S | 150 + external/sgx_libm/ia32/modff.S | 132 + external/sgx_libm/ia32/modfl.S | 263 + external/sgx_libm/ia32/nan.S | 120 + external/sgx_libm/ia32/nearbyint_wmt.S | 295 + external/sgx_libm/ia32/nearbyintf_gen.S | 375 + external/sgx_libm/ia32/nearbyintl.S | 663 ++ external/sgx_libm/ia32/nextafter_wmt.S | 210 + external/sgx_libm/ia32/nextafterf_wmt.S | 200 + external/sgx_libm/ia32/nextafterl.S | 371 + external/sgx_libm/ia32/nexttoward_wmt.S | 246 + external/sgx_libm/ia32/nexttowardf_wmt.S | 212 + external/sgx_libm/ia32/nexttowardl.S | 371 + external/sgx_libm/ia32/pow_wmt.S | 4274 ++++++++ external/sgx_libm/ia32/powf_wmt.S | 986 ++ external/sgx_libm/ia32/powl.S | 2423 +++++ external/sgx_libm/ia32/q2l.S | 353 + external/sgx_libm/ia32/rcp_table.S | 822 ++ external/sgx_libm/ia32/remainder.S | 199 + external/sgx_libm/ia32/remainderf.S | 161 + external/sgx_libm/ia32/remainderl.S | 340 + external/sgx_libm/ia32/remquo.S | 573 + external/sgx_libm/ia32/remquof.S | 75 + external/sgx_libm/ia32/remquol.S | 900 ++ external/sgx_libm/ia32/rint_gen.S | 61 + external/sgx_libm/ia32/rintf_gen.S | 61 + external/sgx_libm/ia32/rintl.S | 160 + external/sgx_libm/ia32/round_wmt.S | 147 + external/sgx_libm/ia32/roundf_wmt.S | 133 + external/sgx_libm/ia32/roundl.S | 248 + external/sgx_libm/ia32/scalb_wmt.S | 328 + external/sgx_libm/ia32/scalbf.S | 410 + external/sgx_libm/ia32/scalbl.S | 641 ++ external/sgx_libm/ia32/scalbln_wmt.S | 243 + external/sgx_libm/ia32/scalblnf.S | 202 + external/sgx_libm/ia32/scalblnl.S | 337 + external/sgx_libm/ia32/scalbn_wmt.S | 243 + external/sgx_libm/ia32/scalbnf.S | 202 + external/sgx_libm/ia32/scalbnl.S | 337 + external/sgx_libm/ia32/signbit.S | 201 + external/sgx_libm/ia32/significand_wmt.S | 136 + external/sgx_libm/ia32/significandf.S | 97 + external/sgx_libm/ia32/significandl.S | 160 + external/sgx_libm/ia32/sin_wmt.S | 779 ++ external/sgx_libm/ia32/sincos_pi4l.S | 3894 +++++++ external/sgx_libm/ia32/sincos_wmt.S | 1343 +++ external/sgx_libm/ia32/sincosdl_table.S | 768 ++ external/sgx_libm/ia32/sincosf_wmt.S | 576 + external/sgx_libm/ia32/sincosl.S | 1173 ++ external/sgx_libm/ia32/sindl.S | 871 ++ external/sgx_libm/ia32/sinf_wmt.S | 585 + external/sgx_libm/ia32/sinh_wmt.S | 1404 +++ external/sgx_libm/ia32/sinhcosh_wmt.S | 1518 +++ external/sgx_libm/ia32/sinhcoshl.S | 1273 +++ external/sgx_libm/ia32/sinhf_wmt.S | 422 + external/sgx_libm/ia32/sinhl.S | 1005 ++ external/sgx_libm/ia32/sinl.S | 1038 ++ external/sgx_libm/ia32/sqrt_tab_t.S | 816 ++ external/sgx_libm/ia32/sqrt_wmt.S | 135 + external/sgx_libm/ia32/sqrtf_wmt.S | 114 + external/sgx_libm/ia32/sqrtl.S | 200 + external/sgx_libm/ia32/tan_wmt.S | 1713 +++ external/sgx_libm/ia32/tanf_wmt.S | 1045 ++ external/sgx_libm/ia32/tanh_wmt.S | 1329 +++ external/sgx_libm/ia32/tanhf_wmt.S | 291 + external/sgx_libm/ia32/tanhl.S | 992 ++ external/sgx_libm/ia32/tanl.S | 1683 +++ external/sgx_libm/ia32/tgamma.S | 3035 ++++++ external/sgx_libm/ia32/tgammaf.S | 1018 ++ external/sgx_libm/ia32/tgammal.S | 3738 +++++++ external/sgx_libm/ia32/trig_pi_bits.S | 311 + external/sgx_libm/ia32/trunc_wmt.S | 130 + external/sgx_libm/ia32/truncf.S | 84 + external/sgx_libm/ia32/truncl.S | 171 + external/sgx_libm/ia32/y0.S | 3324 ++++++ external/sgx_libm/ia32/y0f.S | 805 ++ external/sgx_libm/ia32/y0l.S | 106 + external/sgx_libm/ia32/y1.S | 3196 ++++++ external/sgx_libm/ia32/y1f.S | 880 ++ external/sgx_libm/ia32/y1l.S | 106 + external/sgx_libm/ia32/yn.S | 1341 +++ external/sgx_libm/ia32/ynf.S | 1442 +++ external/sgx_libm/ia32/ynl.S | 109 + external/sgx_libm/intel64/acos.S | 1912 ++++ external/sgx_libm/intel64/acosf_gen.S | 291 + external/sgx_libm/intel64/acosh_gen.S | 384 + external/sgx_libm/intel64/acoshf_gen.S | 248 + external/sgx_libm/intel64/acoshl.S | 947 ++ external/sgx_libm/intel64/acosl.S | 1366 +++ external/sgx_libm/intel64/asin.S | 1998 ++++ external/sgx_libm/intel64/asinf_gen.S | 394 + external/sgx_libm/intel64/asinh_gen.S | 382 + external/sgx_libm/intel64/asinhf_gen.S | 295 + external/sgx_libm/intel64/asinhl.S | 1088 ++ external/sgx_libm/intel64/asinl.S | 1320 +++ external/sgx_libm/intel64/atan2.S | 1197 +++ external/sgx_libm/intel64/atan2dl.S | 1433 +++ external/sgx_libm/intel64/atan2f_gen.S | 556 + external/sgx_libm/intel64/atan2l.S | 1202 +++ external/sgx_libm/intel64/atan_gen.S | 887 ++ external/sgx_libm/intel64/atandl_table.S | 2099 ++++ external/sgx_libm/intel64/atanf_gen.S | 338 + external/sgx_libm/intel64/atanh_gen.S | 360 + external/sgx_libm/intel64/atanhf_gen.S | 324 + external/sgx_libm/intel64/atanhl.S | 966 ++ external/sgx_libm/intel64/atanl.S | 745 ++ external/sgx_libm/intel64/atanl_table.S | 1073 ++ external/sgx_libm/intel64/cabs.S | 73 + external/sgx_libm/intel64/cabsf.S | 76 + external/sgx_libm/intel64/cabsl.S | 74 + external/sgx_libm/intel64/cacos.S | 743 ++ external/sgx_libm/intel64/cacosh.S | 739 ++ external/sgx_libm/intel64/cacoshl.S | 483 + external/sgx_libm/intel64/cacosl.S | 476 + external/sgx_libm/intel64/carg.S | 73 + external/sgx_libm/intel64/cargf.S | 76 + external/sgx_libm/intel64/cargl.S | 74 + external/sgx_libm/intel64/casin.S | 201 + external/sgx_libm/intel64/casinh.S | 699 ++ external/sgx_libm/intel64/casinhl.S | 463 + external/sgx_libm/intel64/casinl.S | 201 + external/sgx_libm/intel64/catan.S | 201 + external/sgx_libm/intel64/catanh.S | 713 ++ external/sgx_libm/intel64/catanhl.S | 2753 +++++ external/sgx_libm/intel64/catanl.S | 201 + external/sgx_libm/intel64/cbrt_gen.S | 737 ++ external/sgx_libm/intel64/cbrtf_gen.S | 494 + external/sgx_libm/intel64/cbrtl.S | 379 + external/sgx_libm/intel64/cbrtl_table.S | 559 + external/sgx_libm/intel64/ccos.S | 147 + external/sgx_libm/intel64/ccosh.S | 566 + external/sgx_libm/intel64/ccoshl.S | 742 ++ external/sgx_libm/intel64/ccosl.S | 175 + external/sgx_libm/intel64/ceil_gen.S | 167 + external/sgx_libm/intel64/ceilf_gen.S | 141 + external/sgx_libm/intel64/ceill.S | 257 + external/sgx_libm/intel64/cexp.S | 2052 ++++ external/sgx_libm/intel64/cexpf.S | 1892 ++++ external/sgx_libm/intel64/cexpl.S | 649 ++ external/sgx_libm/intel64/cimag.S | 65 + external/sgx_libm/intel64/cimagf.S | 66 + external/sgx_libm/intel64/cimagl.S | 65 + external/sgx_libm/intel64/clog.S | 615 ++ external/sgx_libm/intel64/clog10.S | 789 ++ external/sgx_libm/intel64/clog10l.S | 1000 ++ external/sgx_libm/intel64/clogf.S | 2614 +++++ external/sgx_libm/intel64/clogl.S | 783 ++ external/sgx_libm/intel64/complex_real.S | 322 + external/sgx_libm/intel64/conj.S | 72 + external/sgx_libm/intel64/conjf.S | 78 + external/sgx_libm/intel64/conjl.S | 97 + external/sgx_libm/intel64/copysign_gen.S | 89 + external/sgx_libm/intel64/copysignf_gen.S | 73 + external/sgx_libm/intel64/copysignl.S | 119 + external/sgx_libm/intel64/cos_gen.S | 1132 ++ external/sgx_libm/intel64/cosdl.S | 692 ++ external/sgx_libm/intel64/cosf_gen.S | 543 + external/sgx_libm/intel64/cosh_gen.S | 409 + external/sgx_libm/intel64/coshf_gen.S | 323 + external/sgx_libm/intel64/coshl.S | 897 ++ external/sgx_libm/intel64/cosl.S | 1008 ++ external/sgx_libm/intel64/cpow.S | 931 ++ external/sgx_libm/intel64/cpowl.S | 137 + external/sgx_libm/intel64/cproj.S | 132 + external/sgx_libm/intel64/cprojf.S | 107 + external/sgx_libm/intel64/cprojl.S | 152 + external/sgx_libm/intel64/creal.S | 64 + external/sgx_libm/intel64/crealf.S | 66 + external/sgx_libm/intel64/creall.S | 65 + external/sgx_libm/intel64/csin.S | 201 + external/sgx_libm/intel64/csinh.S | 522 + external/sgx_libm/intel64/csinhl.S | 694 ++ external/sgx_libm/intel64/csinl.S | 201 + external/sgx_libm/intel64/csqrt.S | 696 ++ external/sgx_libm/intel64/csqrtf.S | 386 + external/sgx_libm/intel64/csqrtl.S | 714 ++ external/sgx_libm/intel64/ctan.S | 201 + external/sgx_libm/intel64/ctanh.S | 771 ++ external/sgx_libm/intel64/ctanhl.S | 1012 ++ external/sgx_libm/intel64/ctanl.S | 201 + external/sgx_libm/intel64/dpml_ux_bessel.S | 8227 ++++++++++++++ external/sgx_libm/intel64/dpml_ux_log.S | 356 + external/sgx_libm/intel64/dpml_ux_ops.S | 1405 +++ external/sgx_libm/intel64/dpml_ux_ops_64.S | 1964 ++++ external/sgx_libm/intel64/dpml_ux_sqrt.S | 686 ++ external/sgx_libm/intel64/dpml_ux_trig.S | 2192 ++++ external/sgx_libm/intel64/erf.S | 1390 +++ external/sgx_libm/intel64/erfc.S | 2064 ++++ external/sgx_libm/intel64/erfcf.S | 705 ++ external/sgx_libm/intel64/erfcl.S | 4944 +++++++++ external/sgx_libm/intel64/erff.S | 254 + external/sgx_libm/intel64/erfl.S | 2357 +++++ external/sgx_libm/intel64/exp10_gen.S | 427 + external/sgx_libm/intel64/exp10f_gen.S | 260 + external/sgx_libm/intel64/exp10l.S | 1282 +++ external/sgx_libm/intel64/exp2_gen.S | 517 + external/sgx_libm/intel64/exp2f_gen.S | 306 + external/sgx_libm/intel64/exp2l.S | 683 ++ external/sgx_libm/intel64/exp_gen.S | 604 ++ external/sgx_libm/intel64/exp_table.S | 515 + external/sgx_libm/intel64/expf_gen.S | 721 ++ external/sgx_libm/intel64/expf_table.S | 112 + external/sgx_libm/intel64/expl.S | 599 ++ external/sgx_libm/intel64/expl_table.S | 561 + external/sgx_libm/intel64/expm1_gen.S | 387 + external/sgx_libm/intel64/expm1f_gen.S | 348 + external/sgx_libm/intel64/expm1l.S | 1156 ++ external/sgx_libm/intel64/fabs.S | 85 + external/sgx_libm/intel64/fabsf.S | 82 + external/sgx_libm/intel64/fabsl.S | 127 + external/sgx_libm/intel64/fdim_gen.S | 148 + external/sgx_libm/intel64/fdimf_gen.S | 133 + external/sgx_libm/intel64/fdiml.S | 291 + external/sgx_libm/intel64/feclearexcept.S | 98 + external/sgx_libm/intel64/fedisableexcept.S | 105 + external/sgx_libm/intel64/feenableexcept.S | 107 + external/sgx_libm/intel64/fegetexcept.S | 74 + external/sgx_libm/intel64/fegetexceptflag.S | 81 + external/sgx_libm/intel64/fegetround.S | 73 + external/sgx_libm/intel64/feholdexcept.S | 110 + external/sgx_libm/intel64/feraiseexcept.S | 159 + external/sgx_libm/intel64/fesetenv.S | 119 + external/sgx_libm/intel64/fesetexceptflag.S | 110 + external/sgx_libm/intel64/fesetround.S | 115 + external/sgx_libm/intel64/fetestexcept.S | 85 + external/sgx_libm/intel64/feupdateenv.S | 99 + external/sgx_libm/intel64/floor_gen.S | 167 + external/sgx_libm/intel64/floorf_gen.S | 141 + external/sgx_libm/intel64/floorl.S | 256 + external/sgx_libm/intel64/fma_gen.S | 1644 +++ external/sgx_libm/intel64/fmaf_gen.S | 683 ++ external/sgx_libm/intel64/fmal.S | 2062 ++++ external/sgx_libm/intel64/fmax_gen.S | 97 + external/sgx_libm/intel64/fmaxf_gen.S | 91 + external/sgx_libm/intel64/fmaxl.S | 203 + external/sgx_libm/intel64/fmin_gen.S | 97 + external/sgx_libm/intel64/fminf_gen.S | 91 + external/sgx_libm/intel64/fminl.S | 187 + external/sgx_libm/intel64/fmod_gen.S | 212 + external/sgx_libm/intel64/fmodf_gen.S | 74 + external/sgx_libm/intel64/fmodl.S | 308 + external/sgx_libm/intel64/fpclassify.S | 423 + external/sgx_libm/intel64/frexp_gen.S | 115 + external/sgx_libm/intel64/frexpf.S | 114 + external/sgx_libm/intel64/frexpl.S | 174 + external/sgx_libm/intel64/hypot_gen.S | 143 + external/sgx_libm/intel64/hypotf_gen.S | 100 + external/sgx_libm/intel64/hypotl.S | 849 ++ external/sgx_libm/intel64/ilogb_gen.S | 134 + external/sgx_libm/intel64/ilogbf.S | 116 + external/sgx_libm/intel64/ilogbl.S | 200 + .../sgx_libm/intel64/intel_quad_exception.S | 1993 ++++ external/sgx_libm/intel64/isfinite.S | 449 + external/sgx_libm/intel64/isinf.S | 309 + external/sgx_libm/intel64/isnan.S | 259 + external/sgx_libm/intel64/isnormal.S | 273 + external/sgx_libm/intel64/j0.S | 2957 ++++++ external/sgx_libm/intel64/j0f.S | 596 ++ external/sgx_libm/intel64/j0l.S | 86 + external/sgx_libm/intel64/j1.S | 3028 ++++++ external/sgx_libm/intel64/j1f.S | 733 ++ external/sgx_libm/intel64/j1l.S | 86 + external/sgx_libm/intel64/jn.S | 1714 +++ external/sgx_libm/intel64/jnf.S | 1156 ++ external/sgx_libm/intel64/jnl.S | 95 + external/sgx_libm/intel64/l2q.S | 106 + external/sgx_libm/intel64/ldexp_gen.S | 194 + external/sgx_libm/intel64/ldexpf.S | 185 + external/sgx_libm/intel64/ldexpl.S | 321 + external/sgx_libm/intel64/lgamma.S | 7348 +++++++++++++ external/sgx_libm/intel64/lgammaf.S | 6068 +++++++++++ external/sgx_libm/intel64/lgammal.S | 9424 +++++++++++++++++ external/sgx_libm/intel64/libm_atan2_k64.S | 1434 +++ external/sgx_libm/intel64/libm_atan2l_k80.S | 1835 ++++ external/sgx_libm/intel64/libm_cosh_k64.S | 341 + external/sgx_libm/intel64/libm_coshl_k80.S | 748 ++ external/sgx_libm/intel64/libm_cosl_k80.S | 848 ++ external/sgx_libm/intel64/libm_exp_k32.S | 220 + external/sgx_libm/intel64/libm_exp_k64.S | 260 + external/sgx_libm/intel64/libm_expl_k80.S | 395 + external/sgx_libm/intel64/libm_fegetenv.S | 85 + external/sgx_libm/intel64/libm_hypot2_k64.S | 320 + external/sgx_libm/intel64/libm_hypot2l_k80.S | 496 + external/sgx_libm/intel64/libm_log1pl_k80.S | 2003 ++++ external/sgx_libm/intel64/libm_log_k32.S | 164 + external/sgx_libm/intel64/libm_log_k64.S | 632 ++ external/sgx_libm/intel64/libm_logl.S | 778 ++ external/sgx_libm/intel64/libm_logl_k80.S | 966 ++ external/sgx_libm/intel64/libm_mul_k64.S | 320 + .../sgx_libm/intel64/libm_normalizel_k80.S | 163 + .../sgx_libm/intel64/libm_recacoshl_k80.S | 1655 +++ .../intel64/libm_recacosl_recasinl_k80.S | 5813 ++++++++++ external/sgx_libm/intel64/libm_reduce_pi04d.S | 313 + external/sgx_libm/intel64/libm_reduce_pi04l.S | 4808 +++++++++ external/sgx_libm/intel64/libm_reduce_pio2.S | 543 + external/sgx_libm/intel64/libm_scalbl_k80.S | 247 + external/sgx_libm/intel64/libm_sincos_k32.S | 366 + external/sgx_libm/intel64/libm_sincos_k64.S | 846 ++ external/sgx_libm/intel64/libm_sinh_k64.S | 394 + external/sgx_libm/intel64/libm_sinhl_k80.S | 745 ++ external/sgx_libm/intel64/libm_sinl_k80.S | 830 ++ external/sgx_libm/intel64/libm_sse2_sincos.S | 1406 +++ external/sgx_libm/intel64/libm_strtoull.S | 1006 ++ external/sgx_libm/intel64/llrint_gen.S | 88 + external/sgx_libm/intel64/llrintf_gen.S | 88 + external/sgx_libm/intel64/llrintl.S | 314 + external/sgx_libm/intel64/llround_gen.S | 138 + external/sgx_libm/intel64/llroundf_gen.S | 138 + external/sgx_libm/intel64/llroundl.S | 236 + external/sgx_libm/intel64/log10_gen.S | 784 ++ external/sgx_libm/intel64/log10f_gen.S | 285 + external/sgx_libm/intel64/log10l.S | 1052 ++ external/sgx_libm/intel64/log10l_table.S | 559 + external/sgx_libm/intel64/log1p_gen.S | 574 + external/sgx_libm/intel64/log1pf_gen.S | 163 + external/sgx_libm/intel64/log1pl.S | 1027 ++ external/sgx_libm/intel64/log2_gen.S | 774 ++ external/sgx_libm/intel64/log2f_gen.S | 243 + external/sgx_libm/intel64/log2l.S | 541 + external/sgx_libm/intel64/log2l_table.S | 559 + external/sgx_libm/intel64/log_gen.S | 758 ++ external/sgx_libm/intel64/log_table.S | 559 + external/sgx_libm/intel64/logb_gen.S | 132 + external/sgx_libm/intel64/logbf.S | 123 + external/sgx_libm/intel64/logbl.S | 165 + external/sgx_libm/intel64/logf_gen.S | 234 + external/sgx_libm/intel64/logf_table.S | 303 + external/sgx_libm/intel64/logl.S | 66 + external/sgx_libm/intel64/logl_table.S | 559 + external/sgx_libm/intel64/lrint_gen.S | 88 + external/sgx_libm/intel64/lrintf_gen.S | 88 + external/sgx_libm/intel64/lrintl.S | 314 + external/sgx_libm/intel64/lround_gen.S | 138 + external/sgx_libm/intel64/lroundf_gen.S | 138 + external/sgx_libm/intel64/lroundl.S | 243 + external/sgx_libm/intel64/modf_gen.S | 153 + external/sgx_libm/intel64/modff.S | 126 + external/sgx_libm/intel64/modfl.S | 262 + external/sgx_libm/intel64/nan.S | 144 + external/sgx_libm/intel64/nearbyint_gen.S | 435 + external/sgx_libm/intel64/nearbyintf_gen.S | 336 + external/sgx_libm/intel64/nearbyintl.S | 617 ++ external/sgx_libm/intel64/nextafter_gen.S | 202 + external/sgx_libm/intel64/nextafterf_gen.S | 182 + external/sgx_libm/intel64/nextafterl.S | 382 + external/sgx_libm/intel64/nexttoward_gen.S | 212 + external/sgx_libm/intel64/nexttowardf_gen.S | 201 + external/sgx_libm/intel64/nexttowardl.S | 382 + external/sgx_libm/intel64/pow_gen.S | 4493 ++++++++ external/sgx_libm/intel64/powf_gen.S | 892 ++ external/sgx_libm/intel64/powl.S | 2945 ++++++ external/sgx_libm/intel64/q2l.S | 289 + external/sgx_libm/intel64/rcp_table.S | 820 ++ external/sgx_libm/intel64/remainder_gen.S | 311 + external/sgx_libm/intel64/remainderf_gen.S | 78 + external/sgx_libm/intel64/remainderl.S | 313 + external/sgx_libm/intel64/remquo.S | 411 + external/sgx_libm/intel64/remquof.S | 75 + external/sgx_libm/intel64/remquol.S | 1244 +++ external/sgx_libm/intel64/rint_gen.S | 89 + external/sgx_libm/intel64/rintf_gen.S | 89 + external/sgx_libm/intel64/rintl.S | 163 + external/sgx_libm/intel64/round_gen.S | 181 + external/sgx_libm/intel64/roundf_gen.S | 118 + external/sgx_libm/intel64/roundl.S | 245 + external/sgx_libm/intel64/scalb_gen.S | 369 + external/sgx_libm/intel64/scalbf.S | 321 + external/sgx_libm/intel64/scalbl.S | 623 ++ external/sgx_libm/intel64/scalbln_gen.S | 195 + external/sgx_libm/intel64/scalblnf.S | 186 + external/sgx_libm/intel64/scalblnl.S | 322 + external/sgx_libm/intel64/scalbn_gen.S | 194 + external/sgx_libm/intel64/scalbnf.S | 185 + external/sgx_libm/intel64/scalbnl.S | 321 + external/sgx_libm/intel64/signbit.S | 233 + external/sgx_libm/intel64/significand_gen.S | 119 + external/sgx_libm/intel64/significandf_gen.S | 101 + external/sgx_libm/intel64/significandl.S | 164 + external/sgx_libm/intel64/sin_gen.S | 1150 ++ external/sgx_libm/intel64/sincos_gen.S | 1479 +++ external/sgx_libm/intel64/sincos_pi4l.S | 5050 +++++++++ external/sgx_libm/intel64/sincosd_table.S | 767 ++ external/sgx_libm/intel64/sincosf_gen.S | 531 + external/sgx_libm/intel64/sincosl.S | 1226 +++ external/sgx_libm/intel64/sindl.S | 837 ++ external/sgx_libm/intel64/sinf_gen.S | 543 + external/sgx_libm/intel64/sinh_gen.S | 457 + external/sgx_libm/intel64/sinhf_gen.S | 365 + external/sgx_libm/intel64/sinhl.S | 960 ++ external/sgx_libm/intel64/sinl.S | 1048 ++ external/sgx_libm/intel64/sqrt.S | 80 + external/sgx_libm/intel64/sqrt_tab_t.S | 815 ++ external/sgx_libm/intel64/sqrtf_gen.S | 93 + external/sgx_libm/intel64/sqrtl.S | 211 + external/sgx_libm/intel64/tan_gen.S | 2170 ++++ external/sgx_libm/intel64/tanf_gen.S | 858 ++ external/sgx_libm/intel64/tanh_gen.S | 501 + external/sgx_libm/intel64/tanhf_gen.S | 419 + external/sgx_libm/intel64/tanhl.S | 1042 ++ external/sgx_libm/intel64/tanl.S | 1843 ++++ external/sgx_libm/intel64/tgamma.S | 3885 +++++++ external/sgx_libm/intel64/tgammaf.S | 1280 +++ external/sgx_libm/intel64/tgammal.S | 4186 ++++++++ external/sgx_libm/intel64/trig_pi_bits.S | 310 + external/sgx_libm/intel64/trunc_gen.S | 126 + external/sgx_libm/intel64/truncf.S | 90 + external/sgx_libm/intel64/truncl.S | 180 + external/sgx_libm/intel64/y0.S | 4231 ++++++++ external/sgx_libm/intel64/y0f.S | 805 ++ external/sgx_libm/intel64/y0l.S | 86 + external/sgx_libm/intel64/y1.S | 3354 ++++++ external/sgx_libm/intel64/y1f.S | 921 ++ external/sgx_libm/intel64/y1l.S | 86 + external/sgx_libm/intel64/yn.S | 1623 +++ external/sgx_libm/intel64/ynf.S | 1220 +++ external/sgx_libm/intel64/ynl.S | 95 + external/sgx_libm/makefile | 25 + external/tinyxml/tinystr.cpp | 117 + external/tinyxml/tinystr.h | 319 + external/tinyxml/tinyxml.cpp | 1840 ++++ external/tinyxml/tinyxml.h | 1799 ++++ external/tinyxml/tinyxmlerror.cpp | 53 + external/tinyxml/tinyxmlparser.cpp | 1635 +++ .../vtune/linux/include/advisor-annotate.h | 528 + .../vtune/linux/include/advisor_annotate.f90 | 706 ++ .../vtune/linux/include/internal/ittnotify.h | 260 + external/vtune/linux/include/ittnotify.f90 | 473 + external/vtune/linux/include/ittnotify.h | 4123 ++++++++ external/vtune/linux/include/jitprofiling.h | 694 ++ .../vtune/linux/include/legacy/ittnotify.h | 1039 ++ external/vtune/linux/include/libittnotify.h | 71 + .../linux/include/llvm_jit_event_listener.hpp | 241 + .../vtune/linux/include/prototype/ittnotify.h | 263 + .../vtune/linux/sdk/src/ittnotify/LICENSE.BSD | 7 + .../vtune/linux/sdk/src/ittnotify/LICENSE.GPL | 65 + .../vtune/linux/sdk/src/ittnotify/Makefile | 17 + .../sdk/src/ittnotify/disable_warnings.h | 77 + .../sdk/src/ittnotify/ittnotify_config.h | 541 + .../sdk/src/ittnotify/ittnotify_static.c | 1080 ++ .../sdk/src/ittnotify/ittnotify_static.h | 376 + .../linux/sdk/src/ittnotify/ittnotify_types.h | 115 + .../linux/sdk/src/ittnotify/jitprofiling.c | 315 + linux/installer/bin/build-installpkg.sh | 105 + linux/installer/bin/install-sgx-psw.bin.tmpl | 110 + linux/installer/bin/install-sgx-sdk.bin.tmpl | 91 + .../installer/common/gen_source/gen_source.py | 210 + .../installer/common/licenses/BOM_license.txt | 2 + linux/installer/common/psw/BOMs/psw_base.txt | 12 + linux/installer/common/psw/BOMs/psw_x64.txt | 4 + linux/installer/common/psw/BOMs/psw_x86.txt | 4 + linux/installer/common/psw/Makefile | 52 + linux/installer/common/psw/createTarball.sh | 69 + linux/installer/common/psw/install.sh | 143 + linux/installer/common/psw/installConfig.x64 | 8 + linux/installer/common/psw/installConfig.x86 | 8 + linux/installer/common/sdk/BOMs/sdk_base.txt | 449 + linux/installer/common/sdk/BOMs/sdk_x64.txt | 25 + linux/installer/common/sdk/BOMs/sdk_x86.txt | 25 + linux/installer/common/sdk/Makefile | 51 + linux/installer/common/sdk/createTarball.sh | 69 + linux/installer/common/sdk/install.sh | 105 + linux/installer/common/sdk/installConfig.x64 | 8 + linux/installer/common/sdk/installConfig.x86 | 8 + psw/Makefile | 61 + psw/ae/Makefile | 78 + psw/ae/aesm_service/Makefile | 325 + .../config/aesmd_service/aesmd.conf | 29 + .../config/aesmd_service/aesmd.service | 18 + psw/ae/aesm_service/config/network/aesmd.conf | 10 + .../aesm_service/include/oal/aesm_network.h | 69 + .../include/oal/aesm_persistent_storage.h | 134 + psw/ae/aesm_service/include/oal/aesm_thread.h | 50 + .../aesm_service/include/oal/error_report.h | 55 + .../aesm_service/include/oal/internal_log.h | 89 + psw/ae/aesm_service/include/oal/oal.h | 46 + psw/ae/aesm_service/include/oal/power.h | 38 + .../source/aesm/application/AEClass.h | 157 + .../source/aesm/application/aesm_config.cpp | 233 + .../source/aesm/application/aesm_config.h | 44 + .../source/aesm/application/aesm_logic.cpp | 549 + .../source/aesm/application/aesm_logic.h | 152 + .../source/aesm/application/aesm_proxy_type.h | 40 + .../source/aesm/application/aesm_rand.cpp | 57 + .../source/aesm/application/aesm_rand.h | 40 + .../source/aesm/application/event_strings.cpp | 72 + .../source/aesm/application/event_strings.h | 71 + .../source/aesm/application/main.cpp | 125 + .../source/aesm/application/prof_fun.h | 64 + .../source/aesm/extension/aesm_ecdsa.cpp | 50 + .../source/aesm/extension/aesm_encode.cpp | 276 + .../source/aesm/extension/aesm_encode.h | 74 + .../source/aesm/extension/aesm_epid_blob.cpp | 139 + .../source/aesm/extension/aesm_epid_blob.h | 65 + .../source/aesm/extension/aesm_http_msg.cpp | 213 + .../aesm/extension/aesm_long_lived_thread.cpp | 510 + .../aesm/extension/aesm_long_lived_thread.h | 41 + .../aesm/extension/endpoint_select_info.cpp | 290 + .../aesm/extension/endpoint_select_info.h | 89 + .../aesm/extension/platform_info_logic.cpp | 345 + .../aesm/extension/platform_info_logic.h | 64 + .../aesm/extension/type_length_value.cpp | 526 + .../source/aesm/extension/type_length_value.h | 344 + .../aesm_wrapper/inc/AESMLogicWrapper.h | 99 + .../source/aesm_wrapper/inc/AESMQueue.h | 212 + .../aesm_wrapper/inc/AESMQueueManager.h | 62 + .../aesm_wrapper/inc/AESMWorkerThread.h | 58 + .../source/aesm_wrapper/inc/CAESMServer.h | 75 + .../source/aesm_wrapper/inc/CSelector.h | 64 + .../source/aesm_wrapper/inc/IAESMQueue.h | 43 + .../source/aesm_wrapper/inc/IServerSocket.h | 49 + .../source/aesm_wrapper/inc/RequestData.h | 58 + .../source/aesm_wrapper/inc/Thread.h | 60 + .../aesm_wrapper/inc/UnixServerSocket.h | 59 + .../source/aesm_wrapper/inc/aesm_exception.h | 48 + .../aesm_wrapper/src/AESMLogicWrapper.cpp | 145 + .../aesm_wrapper/src/AESMQueueManager.cpp | 90 + .../aesm_wrapper/src/AESMWorkerThread.cpp | 77 + .../source/aesm_wrapper/src/CAESMServer.cpp | 146 + .../source/aesm_wrapper/src/CSelector.cpp | 120 + .../source/aesm_wrapper/src/Thread.cpp | 104 + .../aesm_wrapper/src/UnixServerSocket.cpp | 110 + .../epid_endpoint_selection.cpp | 212 + .../epid_provision/epid_provision_msg1.cpp | 162 + .../epid_provision/epid_provision_msg2.cpp | 537 + .../epid_provision/epid_provision_msg4.cpp | 272 + .../source/epid_provision/epid_utility.cpp | 123 + .../source/epid_provision/epid_utility.h | 45 + psw/ae/aesm_service/source/le/LEClass.cpp | 271 + psw/ae/aesm_service/source/le/LEClass.h | 66 + .../network/network_encoding_wrapper.cpp | 141 + .../source/network/network_encoding_wrapper.h | 56 + .../aesm_service/source/oal/aesm_thread.cpp | 285 + psw/ae/aesm_service/source/oal/aesm_util.cpp | 243 + .../aesm_service/source/oal/error_report.cpp | 67 + .../aesm_service/source/oal/internal_log.cpp | 232 + psw/ae/aesm_service/source/oal/oal_power.cpp | 42 + psw/ae/aesm_service/source/protobuf/Makefile | 54 + psw/ae/aesm_service/source/pve/PVEClass.cpp | 172 + psw/ae/aesm_service/source/pve/PVEClass.h | 117 + .../aesm_service/source/pve/prov_msg_size.h | 103 + psw/ae/aesm_service/source/pve/pve_logic.cpp | 436 + psw/ae/aesm_service/source/pve/pve_logic.h | 58 + psw/ae/aesm_service/source/qe/QEClass.cpp | 166 + psw/ae/aesm_service/source/qe/QEClass.h | 72 + psw/ae/aesm_service/source/qe/qe_logic.cpp | 248 + psw/ae/aesm_service/source/qe/qe_logic.h | 60 + .../source/storage/persistent_storage_info.h | 53 + .../storage/persistent_storage_table.cpp | 113 + .../source/upse/platform_info_blob.h | 94 + psw/ae/buildenv.mk | 95 + psw/ae/common/inc/AECloseSessionRequest.h | 71 + psw/ae/common/inc/AECloseSessionResponse.h | 62 + psw/ae/common/inc/AECreateSessionRequest.h | 69 + psw/ae/common/inc/AECreateSessionResponse.h | 70 + psw/ae/common/inc/AEExchangeReportRequest.h | 75 + psw/ae/common/inc/AEExchangeReportResponse.h | 69 + psw/ae/common/inc/AEGetLaunchTokenRequest.h | 95 + psw/ae/common/inc/AEGetLaunchTokenResponse.h | 69 + psw/ae/common/inc/AEGetPsCapRequest.h | 62 + psw/ae/common/inc/AEGetPsCapResponse.h | 75 + psw/ae/common/inc/AEGetQuoteRequest.h | 121 + psw/ae/common/inc/AEGetQuoteResponse.h | 77 + psw/ae/common/inc/AEInitQuoteRequest.h | 66 + psw/ae/common/inc/AEInitQuoteResponse.h | 85 + psw/ae/common/inc/AEInvokeServiceRequest.h | 74 + psw/ae/common/inc/AEInvokeServiceResponse.h | 68 + .../common/inc/AEReportAttestationRequest.h | 78 + .../common/inc/AEReportAttestationResponse.h | 69 + psw/ae/common/inc/Config.h | 45 + psw/ae/common/inc/IAERequest.h | 149 + psw/ae/common/inc/IAEResponse.h | 96 + psw/ae/common/inc/IAESMLogic.h | 84 + psw/ae/common/inc/ICommunicationSocket.h | 57 + psw/ae/common/inc/ISerializer.h | 109 + psw/ae/common/inc/ISocketFactory.h | 44 + psw/ae/common/inc/ITransporter.h | 51 + .../inc/NonBlockingUnixCommunicationSocket.h | 69 + .../common/inc/NonBlockingUnixSocketFactory.h | 45 + psw/ae/common/inc/ProtobufSerializer.h | 99 + psw/ae/common/inc/SocketTransporter.h | 65 + psw/ae/common/inc/UnixCommunicationSocket.h | 70 + psw/ae/common/inc/UnixSocketFactory.h | 52 + psw/ae/common/pek_pub_key.cpp | 63 + psw/ae/common/proto/Makefile | 58 + psw/ae/common/proto/messages.proto | 131 + psw/ae/common/pve_pub_key.cpp | 66 + psw/ae/common/se_sig_rl.cpp | 74 + psw/ae/common/src/AECloseSessionRequest.cpp | 128 + psw/ae/common/src/AECloseSessionResponse.cpp | 113 + psw/ae/common/src/AECreateSessionRequest.cpp | 140 + psw/ae/common/src/AECreateSessionResponse.cpp | 162 + psw/ae/common/src/AEExchangeReportRequest.cpp | 187 + .../common/src/AEExchangeReportResponse.cpp | 157 + psw/ae/common/src/AEGetLaunchTokenRequest.cpp | 248 + .../common/src/AEGetLaunchTokenResponse.cpp | 160 + psw/ae/common/src/AEGetPsCapRequest.cpp | 117 + psw/ae/common/src/AEGetPsCapResponse.cpp | 126 + psw/ae/common/src/AEGetQuoteRequest.cpp | 324 + psw/ae/common/src/AEGetQuoteResponse.cpp | 175 + psw/ae/common/src/AEInitQuoteRequest.cpp | 122 + psw/ae/common/src/AEInitQuoteResponse.cpp | 191 + psw/ae/common/src/AEInvokeServiceRequest.cpp | 182 + psw/ae/common/src/AEInvokeServiceResponse.cpp | 156 + .../common/src/AEReportAttestationRequest.cpp | 192 + .../src/AEReportAttestationResponse.cpp | 155 + .../NonBlockingUnixCommunicationSocket.cpp | 445 + .../src/NonBlockingUnixSocketFactory.cpp | 50 + psw/ae/common/src/ProtobufSerializer.cpp | 1289 +++ psw/ae/common/src/SocketTransporter.cpp | 146 + psw/ae/common/src/UnixCommunicationSocket.cpp | 232 + psw/ae/common/src/UnixSocketFactory.cpp | 75 + psw/ae/data/constants/linux/ae_debug_flag.hh | 39 + .../data/constants/linux/default_url_info.hh | 37 + psw/ae/data/constants/linux/isk_pub.hh | 50 + .../linux/launch_enclave_mrsigner.hh | 46 + psw/ae/data/constants/linux/peksk_pub.hh | 49 + psw/ae/data/constants/linux/pibsk_pub.hh | 46 + .../constants/linux/pse_op_isv_svn_min.hh | 37 + psw/ae/data/constants/linux/pse_op_prod_id.hh | 37 + psw/ae/data/constants/linux/qsdk_pub.hh | 65 + .../linux/service_enclave_mrsigner.hh | 47 + psw/ae/data/constants/linux/wl_pub.hh | 50 + psw/ae/data/prebuilt/le_prod_css.bin | Bin 0 -> 1808 bytes .../prebuilt/white_list_cert_to_be_verify.bin | Bin 0 -> 280 bytes psw/ae/inc/aeerror.h | 129 + psw/ae/inc/byte_order.h | 72 + psw/ae/inc/internal/aesm_error.h | 71 + psw/ae/inc/internal/cipher.h | 124 + psw/ae/inc/internal/epid_pve_type.h | 179 + psw/ae/inc/internal/le2be_macros.h | 183 + psw/ae/inc/internal/pek_pub_key.h | 42 + psw/ae/inc/internal/provision_msg.h | 172 + psw/ae/inc/internal/pse_inc.h | 43 + psw/ae/inc/internal/pse_types.h | 464 + psw/ae/inc/internal/pve_qe_common.h | 91 + psw/ae/inc/internal/tlv_common.h | 187 + psw/ae/inc/internal/utility.h | 55 + psw/ae/inc/se_sig_rl.h | 75 + psw/ae/le/Makefile | 77 + psw/ae/le/config_debug.xml | 12 + psw/ae/le/config_linux.xml | 13 + psw/ae/le/launch_enclave.cpp | 604 ++ psw/ae/le/launch_enclave.edl | 52 + psw/ae/le/launch_enclave.h | 34 + psw/ae/pve/provision_enclave.edl | 53 + psw/ae/qe/quoting_enclave.edl | 53 + psw/uae_service/config.h | 48 + psw/uae_service/linux/Makefile | 153 + psw/uae_service/sgx_uae_service.cpp | 516 + psw/uae_service/uae_service_assert.cpp | 43 + psw/uae_service/uae_service_version.cpp | 51 + .../uae_wrapper/inc/AEInternalServices.h | 57 + .../inc/AEInternalServicesProvider.h | 47 + psw/uae_service/uae_wrapper/inc/AEServices.h | 262 + .../uae_wrapper/inc/AEServicesImpl.h | 79 + .../uae_wrapper/inc/AEServicesProvider.h | 49 + .../src/AEInternalServicesProvider.cpp | 57 + .../uae_wrapper/src/AEServicesImpl.cpp | 397 + .../uae_wrapper/src/AEServicesProvider.cpp | 66 + .../uae_wrapper/src/tae_ocall_api.cpp | 180 + psw/uae_service/uae_wrapper/src/uae_api.cpp | 286 + psw/urts/cpu_features.cpp | 173 + psw/urts/cpu_features.h | 59 + psw/urts/create_param.h | 53 + psw/urts/enclave.cpp | 503 + psw/urts/enclave.h | 119 + psw/urts/enclave_creator_hw.h | 71 + psw/urts/enclave_creator_hw_com.cpp | 230 + psw/urts/enclave_mutex.cpp | 95 + psw/urts/file.h | 50 + psw/urts/launch_checker.cpp | 128 + psw/urts/launch_checker.h | 62 + psw/urts/linux/Makefile | 147 + psw/urts/linux/debugger_support.cpp | 134 + psw/urts/linux/debugger_support.h | 42 + psw/urts/linux/enclave_creator_hw.cpp | 253 + psw/urts/linux/enter_enclave.S | 284 + psw/urts/linux/enter_enclave.h | 137 + psw/urts/linux/get_thread_id.cpp | 65 + psw/urts/linux/isgx_user.h | 102 + psw/urts/linux/misc.cpp | 61 + psw/urts/linux/read_xcr0.h | 51 + psw/urts/linux/sig_handler.cpp | 260 + psw/urts/linux/sig_handler.h | 38 + psw/urts/linux/urts.cpp | 64 + psw/urts/linux/urts_internal.cpp | 78 + psw/urts/loader.cpp | 779 ++ psw/urts/loader.h | 100 + psw/urts/node.cpp | 86 + psw/urts/node.h | 54 + psw/urts/parser/Makefile | 57 + psw/urts/parser/binparser.h | 109 + psw/urts/parser/clearvars.h | 49 + psw/urts/parser/elf32parser.cpp | 33 + psw/urts/parser/elf32parser.h | 48 + psw/urts/parser/elf64parser.cpp | 33 + psw/urts/parser/elf64parser.h | 48 + psw/urts/parser/elfparser.cpp | 850 ++ psw/urts/parser/elfparser.h | 106 + psw/urts/parser/parserfactory.cpp | 76 + psw/urts/parser/parserfactory.h | 45 + psw/urts/parser/section.cpp | 70 + psw/urts/parser/section.h | 65 + psw/urts/parser/update_global_data.hxx | 51 + psw/urts/prd_css_util.cpp | 92 + psw/urts/prd_css_util.h | 50 + psw/urts/routine.cpp | 69 + psw/urts/se_detect.cpp | 88 + psw/urts/se_detect.h | 51 + psw/urts/se_ocalls.cpp | 45 + psw/urts/section_info.h | 53 + psw/urts/tcs.cpp | 352 + psw/urts/tcs.h | 114 + psw/urts/urts_com.h | 378 + psw/urts/urts_version.cpp | 51 + psw/urts/urts_xsave.cpp | 91 + sdk/Makefile | 222 + sdk/compiler-rt/LICENSE.TXT | 98 + sdk/compiler-rt/Makefile | 54 + sdk/compiler-rt/addtf3.c | 25 + sdk/compiler-rt/ashldi3.c | 43 + sdk/compiler-rt/ashlti3.c | 45 + sdk/compiler-rt/ashrdi3.c | 44 + sdk/compiler-rt/ashrti3.c | 46 + sdk/compiler-rt/clear_cache.c | 96 + sdk/compiler-rt/clzdi2.c | 29 + sdk/compiler-rt/clzsi2.c | 53 + sdk/compiler-rt/clzti2.c | 33 + sdk/compiler-rt/cmpdi2.c | 51 + sdk/compiler-rt/cmpti2.c | 42 + sdk/compiler-rt/comparetf2.c | 133 + sdk/compiler-rt/ctzdi2.c | 29 + sdk/compiler-rt/ctzsi2.c | 57 + sdk/compiler-rt/ctzti2.c | 33 + sdk/compiler-rt/divdi3.c | 29 + sdk/compiler-rt/divsi3.c | 37 + sdk/compiler-rt/divtf3.c | 203 + sdk/compiler-rt/divti3.c | 33 + sdk/compiler-rt/extenddftf2.c | 23 + sdk/compiler-rt/extendsftf2.c | 23 + sdk/compiler-rt/ffsdi2.c | 33 + sdk/compiler-rt/ffsti2.c | 37 + sdk/compiler-rt/fixtfsi.c | 26 + sdk/compiler-rt/floatsitf.c | 52 + sdk/compiler-rt/floatunsitf.c | 40 + sdk/compiler-rt/fp_extend.h | 76 + sdk/compiler-rt/fp_lib.h | 270 + sdk/compiler-rt/fp_trunc.h | 64 + sdk/compiler-rt/int_endianness.h | 113 + sdk/compiler-rt/int_lib.h | 70 + sdk/compiler-rt/int_types.h | 143 + sdk/compiler-rt/int_util.h | 29 + sdk/compiler-rt/lshrdi3.c | 43 + sdk/compiler-rt/lshrti3.c | 45 + sdk/compiler-rt/moddi3.c | 30 + sdk/compiler-rt/modsi3.c | 23 + sdk/compiler-rt/modti3.c | 34 + sdk/compiler-rt/muldi3.c | 56 + sdk/compiler-rt/multf3.c | 25 + sdk/compiler-rt/multi3.c | 58 + sdk/compiler-rt/negdi2.c | 26 + sdk/compiler-rt/negti2.c | 30 + sdk/compiler-rt/paritydi2.c | 25 + sdk/compiler-rt/paritysi2.c | 27 + sdk/compiler-rt/parityti2.c | 29 + sdk/compiler-rt/popcountdi2.c | 36 + sdk/compiler-rt/popcountsi2.c | 33 + sdk/compiler-rt/popcountti2.c | 44 + sdk/compiler-rt/stack_chk.c | 62 + sdk/compiler-rt/subtf3.c | 27 + sdk/compiler-rt/trunctfdf2.c | 22 + sdk/compiler-rt/trunctfsf2.c | 22 + sdk/compiler-rt/ucmpdi2.c | 51 + sdk/compiler-rt/ucmpti2.c | 42 + sdk/compiler-rt/udivdi3.c | 23 + sdk/compiler-rt/udivmoddi4.c | 231 + sdk/compiler-rt/udivmodti4.c | 238 + sdk/compiler-rt/udivsi3.c | 66 + sdk/compiler-rt/udivti3.c | 27 + sdk/compiler-rt/umoddi3.c | 25 + sdk/compiler-rt/umodsi3.c | 23 + sdk/compiler-rt/umodti3.c | 29 + sdk/cpprt/Makefile | 104 + sdk/cpprt/linux/abi_namespace.h | 5 + sdk/cpprt/linux/atomic.h | 28 + sdk/cpprt/linux/auxhelper.cc | 67 + sdk/cpprt/linux/cxa_finalize.c | 8 + sdk/cpprt/linux/cxxabi.h | 241 + sdk/cpprt/linux/dwarf_eh.h | 479 + sdk/cpprt/linux/dynamic_cast.cc | 210 + sdk/cpprt/linux/exception.cc | 1419 +++ sdk/cpprt/linux/gcc_personality_v0.c | 254 + sdk/cpprt/linux/guard.cc | 169 + sdk/cpprt/linux/libelftc_dem_gnu3.c | 3474 ++++++ sdk/cpprt/linux/libunwind/AUTHORS | 1 + sdk/cpprt/linux/libunwind/COPYING | 20 + sdk/cpprt/linux/libunwind/ChangeLog | 55 + sdk/cpprt/linux/libunwind/LICENSE | 18 + sdk/cpprt/linux/libunwind/Makefile.am | 75 + sdk/cpprt/linux/libunwind/NEWS | 221 + sdk/cpprt/linux/libunwind/README | 212 + sdk/cpprt/linux/libunwind/TODO | 97 + sdk/cpprt/linux/libunwind/acinclude.m4 | 32 + sdk/cpprt/linux/libunwind/autogen-linux.sh | 75 + sdk/cpprt/linux/libunwind/configure.in | 308 + sdk/cpprt/linux/libunwind/doc/Makefile.am | 71 + sdk/cpprt/linux/libunwind/doc/NOTES | 127 + .../linux/libunwind/doc/_U_dyn_cancel.man | 66 + .../linux/libunwind/doc/_U_dyn_cancel.tex | 46 + .../linux/libunwind/doc/_U_dyn_register.man | 68 + .../linux/libunwind/doc/_U_dyn_register.tex | 47 + sdk/cpprt/linux/libunwind/doc/common.tex.in | 11 + .../linux/libunwind/doc/libunwind-dynamic.man | 538 + .../linux/libunwind/doc/libunwind-dynamic.tex | 401 + .../linux/libunwind/doc/libunwind-ia64.man | 314 + .../linux/libunwind/doc/libunwind-ia64.tex | 216 + .../linux/libunwind/doc/libunwind-ptrace.man | 220 + .../linux/libunwind/doc/libunwind-ptrace.tex | 134 + .../linux/libunwind/doc/libunwind-setjmp.man | 132 + .../linux/libunwind/doc/libunwind-setjmp.tex | 87 + sdk/cpprt/linux/libunwind/doc/libunwind.man | 500 + sdk/cpprt/linux/libunwind/doc/libunwind.tex | 355 + sdk/cpprt/linux/libunwind/doc/libunwind.trans | 34 + .../libunwind/doc/unw_create_addr_space.man | 457 + .../libunwind/doc/unw_create_addr_space.tex | 265 + .../libunwind/doc/unw_destroy_addr_space.man | 57 + .../libunwind/doc/unw_destroy_addr_space.tex | 40 + .../linux/libunwind/doc/unw_flush_cache.man | 92 + .../linux/libunwind/doc/unw_flush_cache.tex | 57 + .../linux/libunwind/doc/unw_get_accessors.man | 79 + .../linux/libunwind/doc/unw_get_accessors.tex | 55 + .../linux/libunwind/doc/unw_get_fpreg.man | 111 + .../linux/libunwind/doc/unw_get_fpreg.tex | 77 + .../linux/libunwind/doc/unw_get_proc_info.man | 203 + .../linux/libunwind/doc/unw_get_proc_info.tex | 123 + .../libunwind/doc/unw_get_proc_info_by_ip.man | 134 + .../libunwind/doc/unw_get_proc_info_by_ip.tex | 91 + .../linux/libunwind/doc/unw_get_proc_name.man | 123 + .../linux/libunwind/doc/unw_get_proc_name.tex | 82 + sdk/cpprt/linux/libunwind/doc/unw_get_reg.man | 112 + sdk/cpprt/linux/libunwind/doc/unw_get_reg.tex | 77 + .../linux/libunwind/doc/unw_getcontext.man | 93 + .../linux/libunwind/doc/unw_getcontext.tex | 63 + .../linux/libunwind/doc/unw_init_local.man | 119 + .../linux/libunwind/doc/unw_init_local.tex | 81 + .../linux/libunwind/doc/unw_init_remote.man | 123 + .../linux/libunwind/doc/unw_init_remote.tex | 79 + .../linux/libunwind/doc/unw_is_fpreg.man | 73 + .../linux/libunwind/doc/unw_is_fpreg.tex | 52 + .../libunwind/doc/unw_is_signal_frame.man | 88 + .../libunwind/doc/unw_is_signal_frame.tex | 67 + sdk/cpprt/linux/libunwind/doc/unw_regname.man | 68 + sdk/cpprt/linux/libunwind/doc/unw_regname.tex | 47 + sdk/cpprt/linux/libunwind/doc/unw_resume.man | 146 + sdk/cpprt/linux/libunwind/doc/unw_resume.tex | 99 + .../libunwind/doc/unw_set_caching_policy.man | 118 + .../libunwind/doc/unw_set_caching_policy.tex | 80 + .../linux/libunwind/doc/unw_set_fpreg.man | 117 + .../linux/libunwind/doc/unw_set_fpreg.tex | 79 + sdk/cpprt/linux/libunwind/doc/unw_set_reg.man | 117 + sdk/cpprt/linux/libunwind/doc/unw_set_reg.tex | 79 + sdk/cpprt/linux/libunwind/doc/unw_step.man | 106 + sdk/cpprt/linux/libunwind/doc/unw_step.tex | 68 + .../linux/libunwind/doc/unw_strerror.man | 63 + .../linux/libunwind/doc/unw_strerror.tex | 42 + sdk/cpprt/linux/libunwind/include/dwarf-eh.h | 128 + sdk/cpprt/linux/libunwind/include/dwarf.h | 433 + sdk/cpprt/linux/libunwind/include/dwarf_i.h | 490 + .../linux/libunwind/include/libunwind-arm.h | 302 + .../libunwind/include/libunwind-common.h.in | 257 + .../libunwind/include/libunwind-coredump.h | 73 + .../libunwind/include/libunwind-dynamic.h | 210 + .../linux/libunwind/include/libunwind-hppa.h | 125 + .../linux/libunwind/include/libunwind-ia64.h | 194 + .../linux/libunwind/include/libunwind-mips.h | 155 + .../linux/libunwind/include/libunwind-ppc32.h | 207 + .../linux/libunwind/include/libunwind-ppc64.h | 264 + .../libunwind/include/libunwind-ptrace.h | 63 + .../linux/libunwind/include/libunwind-x86.h | 187 + .../libunwind/include/libunwind-x86_64.h | 139 + .../linux/libunwind/include/libunwind.h.in | 30 + .../linux/libunwind/include/libunwind_i.h | 377 + sdk/cpprt/linux/libunwind/include/mempool.h | 89 + sdk/cpprt/linux/libunwind/include/remote.h | 127 + .../libunwind/include/tdep-arm/dwarf-config.h | 51 + .../libunwind/include/tdep-arm/ex_tables.h | 55 + .../linux/libunwind/include/tdep-arm/jmpbuf.h | 32 + .../libunwind/include/tdep-arm/libunwind_i.h | 298 + .../include/tdep-hppa/dwarf-config.h | 54 + .../libunwind/include/tdep-hppa/jmpbuf.h | 33 + .../libunwind/include/tdep-hppa/libunwind_i.h | 275 + .../libunwind/include/tdep-ia64/jmpbuf.h | 32 + .../libunwind/include/tdep-ia64/libunwind_i.h | 275 + .../linux/libunwind/include/tdep-ia64/rse.h | 67 + .../libunwind/include/tdep-ia64/script.h | 85 + .../include/tdep-mips/dwarf-config.h | 54 + .../libunwind/include/tdep-mips/jmpbuf.h | 32 + .../libunwind/include/tdep-mips/libunwind_i.h | 329 + .../include/tdep-ppc32/dwarf-config.h | 56 + .../libunwind/include/tdep-ppc32/jmpbuf.h | 37 + .../include/tdep-ppc32/libunwind_i.h | 312 + .../include/tdep-ppc64/dwarf-config.h | 56 + .../libunwind/include/tdep-ppc64/jmpbuf.h | 37 + .../include/tdep-ppc64/libunwind_i.h | 312 + .../libunwind/include/tdep-x86/dwarf-config.h | 52 + .../linux/libunwind/include/tdep-x86/jmpbuf.h | 42 + .../libunwind/include/tdep-x86/libunwind_i.h | 291 + .../include/tdep-x86_64/dwarf-config.h | 59 + .../libunwind/include/tdep-x86_64/jmpbuf.h | 43 + .../include/tdep-x86_64/libunwind_i.h | 259 + .../libunwind/include/tdep/dwarf-config.h | 22 + .../linux/libunwind/include/tdep/jmpbuf.h | 26 + .../libunwind/include/tdep/libunwind_i.h.in | 31 + sdk/cpprt/linux/libunwind/include/unwind.h | 154 + .../linux/libunwind/include/x86/jmpbuf.h | 31 + .../linux/libunwind/scripts/kernel-diff.sh | 10 + .../linux/libunwind/scripts/kernel-files.txt | 19 + .../linux/libunwind/scripts/make-L-files | 30 + sdk/cpprt/linux/libunwind/src/Makefile.am | 565 + .../libunwind/src/arm/Gcreate_addr_space.c | 62 + .../linux/libunwind/src/arm/Gex_tables.c | 569 + .../linux/libunwind/src/arm/Gget_proc_info.c | 41 + .../linux/libunwind/src/arm/Gget_save_loc.c | 81 + sdk/cpprt/linux/libunwind/src/arm/Gglobal.c | 76 + sdk/cpprt/linux/libunwind/src/arm/Ginit.c | 180 + .../linux/libunwind/src/arm/Ginit_local.c | 55 + .../linux/libunwind/src/arm/Ginit_remote.c | 45 + .../libunwind/src/arm/Gis_signal_frame.c | 84 + sdk/cpprt/linux/libunwind/src/arm/Gregs.c | 81 + sdk/cpprt/linux/libunwind/src/arm/Gresume.c | 147 + sdk/cpprt/linux/libunwind/src/arm/Gstep.c | 264 + .../libunwind/src/arm/Lcreate_addr_space.c | 5 + .../linux/libunwind/src/arm/Lex_tables.c | 5 + .../linux/libunwind/src/arm/Lget_proc_info.c | 5 + .../linux/libunwind/src/arm/Lget_save_loc.c | 5 + sdk/cpprt/linux/libunwind/src/arm/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/arm/Linit.c | 5 + .../linux/libunwind/src/arm/Linit_local.c | 5 + .../linux/libunwind/src/arm/Linit_remote.c | 5 + .../libunwind/src/arm/Lis_signal_frame.c | 5 + sdk/cpprt/linux/libunwind/src/arm/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/arm/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/arm/Lstep.c | 5 + .../linux/libunwind/src/arm/gen-offsets.c | 54 + .../linux/libunwind/src/arm/getcontext.S | 56 + sdk/cpprt/linux/libunwind/src/arm/init.h | 78 + sdk/cpprt/linux/libunwind/src/arm/is_fpreg.c | 39 + sdk/cpprt/linux/libunwind/src/arm/offsets.h | 36 + sdk/cpprt/linux/libunwind/src/arm/regname.c | 90 + .../linux/libunwind/src/arm/siglongjmp.S | 12 + sdk/cpprt/linux/libunwind/src/arm/unwind_i.h | 43 + sdk/cpprt/linux/libunwind/src/coredump/README | 8 + .../libunwind/src/coredump/_UCD_access_mem.c | 102 + .../src/coredump/_UCD_access_reg_freebsd.c | 118 + .../src/coredump/_UCD_access_reg_linux.c | 90 + .../libunwind/src/coredump/_UCD_accessors.c | 36 + .../libunwind/src/coredump/_UCD_create.c | 417 + .../libunwind/src/coredump/_UCD_destroy.c | 50 + .../src/coredump/_UCD_elf_map_image.c | 98 + .../src/coredump/_UCD_find_proc_info.c | 163 + .../src/coredump/_UCD_get_proc_name.c | 70 + .../libunwind/src/coredump/_UCD_internal.h | 106 + .../linux/libunwind/src/coredump/_UCD_lib.h | 57 + .../src/coredump/_UPT_access_fpreg.c | 34 + .../linux/libunwind/src/coredump/_UPT_elf.c | 5 + .../coredump/_UPT_get_dyn_info_list_addr.c | 108 + .../src/coredump/_UPT_put_unwind_info.c | 36 + .../libunwind/src/coredump/_UPT_resume.c | 35 + sdk/cpprt/linux/libunwind/src/dwarf/Gexpr.c | 647 ++ sdk/cpprt/linux/libunwind/src/dwarf/Gfde.c | 357 + .../libunwind/src/dwarf/Gfind_proc_info-lsb.c | 942 ++ .../libunwind/src/dwarf/Gfind_unwind_table.c | 228 + sdk/cpprt/linux/libunwind/src/dwarf/Gparser.c | 908 ++ sdk/cpprt/linux/libunwind/src/dwarf/Gpe.c | 39 + sdk/cpprt/linux/libunwind/src/dwarf/Gstep.c | 41 + sdk/cpprt/linux/libunwind/src/dwarf/Lexpr.c | 5 + sdk/cpprt/linux/libunwind/src/dwarf/Lfde.c | 5 + .../libunwind/src/dwarf/Lfind_proc_info-lsb.c | 5 + .../libunwind/src/dwarf/Lfind_unwind_table.c | 5 + sdk/cpprt/linux/libunwind/src/dwarf/Lparser.c | 5 + sdk/cpprt/linux/libunwind/src/dwarf/Lpe.c | 5 + sdk/cpprt/linux/libunwind/src/dwarf/Lstep.c | 5 + sdk/cpprt/linux/libunwind/src/dwarf/global.c | 37 + sdk/cpprt/linux/libunwind/src/elf32.c | 4 + sdk/cpprt/linux/libunwind/src/elf32.h | 9 + sdk/cpprt/linux/libunwind/src/elf64.c | 4 + sdk/cpprt/linux/libunwind/src/elf64.h | 9 + sdk/cpprt/linux/libunwind/src/elfxx.c | 174 + sdk/cpprt/linux/libunwind/src/elfxx.h | 108 + .../libunwind/src/hppa/Gcreate_addr_space.c | 52 + .../linux/libunwind/src/hppa/Gget_proc_info.c | 46 + .../linux/libunwind/src/hppa/Gget_save_loc.c | 59 + sdk/cpprt/linux/libunwind/src/hppa/Gglobal.c | 55 + sdk/cpprt/linux/libunwind/src/hppa/Ginit.c | 194 + .../linux/libunwind/src/hppa/Ginit_local.c | 54 + .../linux/libunwind/src/hppa/Ginit_remote.c | 46 + .../libunwind/src/hppa/Gis_signal_frame.c | 74 + sdk/cpprt/linux/libunwind/src/hppa/Gregs.c | 87 + sdk/cpprt/linux/libunwind/src/hppa/Gresume.c | 145 + sdk/cpprt/linux/libunwind/src/hppa/Gstep.c | 96 + .../libunwind/src/hppa/Lcreate_addr_space.c | 5 + .../linux/libunwind/src/hppa/Lget_proc_info.c | 5 + .../linux/libunwind/src/hppa/Lget_save_loc.c | 5 + sdk/cpprt/linux/libunwind/src/hppa/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/hppa/Linit.c | 5 + .../linux/libunwind/src/hppa/Linit_local.c | 5 + .../linux/libunwind/src/hppa/Linit_remote.c | 5 + .../libunwind/src/hppa/Lis_signal_frame.c | 5 + sdk/cpprt/linux/libunwind/src/hppa/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/hppa/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/hppa/Lstep.c | 5 + .../linux/libunwind/src/hppa/get_accessors.c | 37 + .../linux/libunwind/src/hppa/getcontext.S | 74 + sdk/cpprt/linux/libunwind/src/hppa/init.h | 47 + sdk/cpprt/linux/libunwind/src/hppa/offsets.h | 17 + sdk/cpprt/linux/libunwind/src/hppa/regname.c | 50 + .../linux/libunwind/src/hppa/setcontext.S | 77 + .../linux/libunwind/src/hppa/siglongjmp.S | 16 + sdk/cpprt/linux/libunwind/src/hppa/tables.c | 43 + sdk/cpprt/linux/libunwind/src/hppa/unwind_i.h | 48 + .../libunwind/src/ia64/Gcreate_addr_space.c | 63 + .../libunwind/src/ia64/Gfind_unwind_table.c | 143 + .../linux/libunwind/src/ia64/Gget_proc_info.c | 38 + .../linux/libunwind/src/ia64/Gget_save_loc.c | 168 + sdk/cpprt/linux/libunwind/src/ia64/Gglobal.c | 123 + sdk/cpprt/linux/libunwind/src/ia64/Ginit.c | 505 + .../linux/libunwind/src/ia64/Ginit_local.c | 110 + .../linux/libunwind/src/ia64/Ginit_remote.c | 61 + .../libunwind/src/ia64/Ginstall_cursor.S | 348 + .../libunwind/src/ia64/Gis_signal_frame.c | 54 + sdk/cpprt/linux/libunwind/src/ia64/Gparser.c | 1131 ++ sdk/cpprt/linux/libunwind/src/ia64/Grbs.c | 319 + sdk/cpprt/linux/libunwind/src/ia64/Gregs.c | 612 ++ sdk/cpprt/linux/libunwind/src/ia64/Gresume.c | 274 + sdk/cpprt/linux/libunwind/src/ia64/Gscript.c | 765 ++ sdk/cpprt/linux/libunwind/src/ia64/Gstep.c | 359 + sdk/cpprt/linux/libunwind/src/ia64/Gtables.c | 729 ++ .../libunwind/src/ia64/Lcreate_addr_space.c | 5 + .../libunwind/src/ia64/Lfind_unwind_table.c | 5 + .../linux/libunwind/src/ia64/Lget_proc_info.c | 5 + .../linux/libunwind/src/ia64/Lget_save_loc.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Linit.c | 5 + .../linux/libunwind/src/ia64/Linit_local.c | 5 + .../linux/libunwind/src/ia64/Linit_remote.c | 5 + .../libunwind/src/ia64/Linstall_cursor.S | 6 + .../libunwind/src/ia64/Lis_signal_frame.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lparser.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lrbs.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lscript.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Lstep.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/Ltables.c | 5 + sdk/cpprt/linux/libunwind/src/ia64/NOTES | 65 + .../linux/libunwind/src/ia64/dyn_info_list.S | 26 + .../linux/libunwind/src/ia64/getcontext.S | 177 + sdk/cpprt/linux/libunwind/src/ia64/init.h | 134 + sdk/cpprt/linux/libunwind/src/ia64/longjmp.S | 42 + .../linux/libunwind/src/ia64/mk_Gcursor_i.c | 106 + .../linux/libunwind/src/ia64/mk_Lcursor_i.c | 2 + sdk/cpprt/linux/libunwind/src/ia64/offsets.h | 137 + sdk/cpprt/linux/libunwind/src/ia64/regname.c | 189 + sdk/cpprt/linux/libunwind/src/ia64/regs.h | 73 + sdk/cpprt/linux/libunwind/src/ia64/setjmp.S | 51 + .../linux/libunwind/src/ia64/siglongjmp.S | 69 + .../linux/libunwind/src/ia64/sigsetjmp.S | 69 + .../linux/libunwind/src/ia64/ucontext_i.h | 68 + .../linux/libunwind/src/ia64/unwind_decoder.h | 477 + sdk/cpprt/linux/libunwind/src/ia64/unwind_i.h | 633 ++ .../libunwind/src/mi/Gdestroy_addr_space.c | 37 + .../linux/libunwind/src/mi/Gdyn-extract.c | 62 + .../linux/libunwind/src/mi/Gdyn-remote.c | 330 + .../src/mi/Gfind_dynamic_proc_info.c | 91 + .../linux/libunwind/src/mi/Gget_accessors.c | 34 + sdk/cpprt/linux/libunwind/src/mi/Gget_fpreg.c | 34 + .../libunwind/src/mi/Gget_proc_info_by_ip.c | 39 + .../linux/libunwind/src/mi/Gget_proc_name.c | 106 + sdk/cpprt/linux/libunwind/src/mi/Gget_reg.c | 41 + .../src/mi/Gput_dynamic_unwind_info.c | 55 + .../libunwind/src/mi/Gset_caching_policy.c | 46 + sdk/cpprt/linux/libunwind/src/mi/Gset_fpreg.c | 34 + sdk/cpprt/linux/libunwind/src/mi/Gset_reg.c | 34 + .../libunwind/src/mi/Ldestroy_addr_space.c | 5 + .../linux/libunwind/src/mi/Ldyn-extract.c | 5 + .../linux/libunwind/src/mi/Ldyn-remote.c | 5 + .../src/mi/Lfind_dynamic_proc_info.c | 5 + .../linux/libunwind/src/mi/Lget_accessors.c | 5 + sdk/cpprt/linux/libunwind/src/mi/Lget_fpreg.c | 5 + .../libunwind/src/mi/Lget_proc_info_by_ip.c | 5 + .../linux/libunwind/src/mi/Lget_proc_name.c | 5 + sdk/cpprt/linux/libunwind/src/mi/Lget_reg.c | 5 + .../src/mi/Lput_dynamic_unwind_info.c | 5 + .../libunwind/src/mi/Lset_caching_policy.c | 5 + sdk/cpprt/linux/libunwind/src/mi/Lset_fpreg.c | 5 + sdk/cpprt/linux/libunwind/src/mi/Lset_reg.c | 5 + sdk/cpprt/linux/libunwind/src/mi/_ReadSLEB.c | 25 + sdk/cpprt/linux/libunwind/src/mi/_ReadULEB.c | 20 + sdk/cpprt/linux/libunwind/src/mi/backtrace.c | 81 + sdk/cpprt/linux/libunwind/src/mi/dyn-cancel.c | 46 + .../linux/libunwind/src/mi/dyn-info-list.c | 34 + .../linux/libunwind/src/mi/dyn-register.c | 44 + .../linux/libunwind/src/mi/flush_cache.c | 59 + sdk/cpprt/linux/libunwind/src/mi/init.c | 62 + sdk/cpprt/linux/libunwind/src/mi/mempool.c | 176 + sdk/cpprt/linux/libunwind/src/mi/strerror.c | 51 + .../libunwind/src/mips/Gcreate_addr_space.c | 65 + .../linux/libunwind/src/mips/Gget_proc_info.c | 41 + .../linux/libunwind/src/mips/Gget_save_loc.c | 99 + sdk/cpprt/linux/libunwind/src/mips/Gglobal.c | 64 + sdk/cpprt/linux/libunwind/src/mips/Ginit.c | 208 + .../linux/libunwind/src/mips/Ginit_local.c | 53 + .../linux/libunwind/src/mips/Ginit_remote.c | 45 + .../libunwind/src/mips/Gis_signal_frame.c | 35 + sdk/cpprt/linux/libunwind/src/mips/Gregs.c | 99 + sdk/cpprt/linux/libunwind/src/mips/Gresume.c | 45 + sdk/cpprt/linux/libunwind/src/mips/Gstep.c | 48 + .../libunwind/src/mips/Lcreate_addr_space.c | 5 + .../linux/libunwind/src/mips/Lget_proc_info.c | 5 + .../linux/libunwind/src/mips/Lget_save_loc.c | 5 + sdk/cpprt/linux/libunwind/src/mips/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/mips/Linit.c | 5 + .../linux/libunwind/src/mips/Linit_local.c | 5 + .../linux/libunwind/src/mips/Linit_remote.c | 5 + .../libunwind/src/mips/Lis_signal_frame.c | 5 + sdk/cpprt/linux/libunwind/src/mips/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/mips/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/mips/Lstep.c | 5 + sdk/cpprt/linux/libunwind/src/mips/elfxx.c | 27 + .../linux/libunwind/src/mips/gen-offsets.c | 30 + .../linux/libunwind/src/mips/getcontext.S | 85 + sdk/cpprt/linux/libunwind/src/mips/init.h | 58 + sdk/cpprt/linux/libunwind/src/mips/is_fpreg.c | 35 + sdk/cpprt/linux/libunwind/src/mips/offsets.h | 39 + sdk/cpprt/linux/libunwind/src/mips/regname.c | 46 + .../linux/libunwind/src/mips/siglongjmp.S | 8 + sdk/cpprt/linux/libunwind/src/mips/unwind_i.h | 48 + sdk/cpprt/linux/libunwind/src/os-freebsd.c | 145 + sdk/cpprt/linux/libunwind/src/os-hpux.c | 67 + sdk/cpprt/linux/libunwind/src/os-linux.c | 67 + sdk/cpprt/linux/libunwind/src/os-linux.h | 302 + .../libunwind/src/ppc/Gcreate_addr_space.c | 54 + .../linux/libunwind/src/ppc/Gget_proc_info.c | 34 + .../linux/libunwind/src/ppc/Gget_save_loc.c | 34 + .../linux/libunwind/src/ppc/Ginit_local.c | 65 + .../linux/libunwind/src/ppc/Ginit_remote.c | 60 + .../libunwind/src/ppc/Gis_signal_frame.c | 66 + .../libunwind/src/ppc/Lcreate_addr_space.c | 5 + .../linux/libunwind/src/ppc/Lget_proc_info.c | 5 + .../linux/libunwind/src/ppc/Lget_save_loc.c | 5 + .../linux/libunwind/src/ppc/Linit_local.c | 5 + .../linux/libunwind/src/ppc/Linit_remote.c | 5 + .../libunwind/src/ppc/Lis_signal_frame.c | 5 + sdk/cpprt/linux/libunwind/src/ppc/longjmp.S | 36 + .../linux/libunwind/src/ppc/siglongjmp.S | 31 + sdk/cpprt/linux/libunwind/src/ppc32/Gglobal.c | 135 + sdk/cpprt/linux/libunwind/src/ppc32/Ginit.c | 221 + sdk/cpprt/linux/libunwind/src/ppc32/Gregs.c | 90 + sdk/cpprt/linux/libunwind/src/ppc32/Gresume.c | 77 + sdk/cpprt/linux/libunwind/src/ppc32/Gstep.c | 309 + sdk/cpprt/linux/libunwind/src/ppc32/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/ppc32/Linit.c | 5 + sdk/cpprt/linux/libunwind/src/ppc32/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/ppc32/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/ppc32/Lstep.c | 5 + .../linux/libunwind/src/ppc32/Make-arch.in | 11 + .../linux/libunwind/src/ppc32/get_func_addr.c | 36 + sdk/cpprt/linux/libunwind/src/ppc32/init.h | 73 + .../linux/libunwind/src/ppc32/is_fpreg.c | 34 + sdk/cpprt/linux/libunwind/src/ppc32/regname.c | 112 + .../linux/libunwind/src/ppc32/setcontext.S | 9 + .../linux/libunwind/src/ppc32/ucontext_i.h | 128 + .../linux/libunwind/src/ppc32/unwind_i.h | 47 + sdk/cpprt/linux/libunwind/src/ppc64/Gglobal.c | 182 + sdk/cpprt/linux/libunwind/src/ppc64/Ginit.c | 230 + sdk/cpprt/linux/libunwind/src/ppc64/Gregs.c | 100 + sdk/cpprt/linux/libunwind/src/ppc64/Gresume.c | 77 + sdk/cpprt/linux/libunwind/src/ppc64/Gstep.c | 436 + sdk/cpprt/linux/libunwind/src/ppc64/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/ppc64/Linit.c | 5 + sdk/cpprt/linux/libunwind/src/ppc64/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/ppc64/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/ppc64/Lstep.c | 5 + .../linux/libunwind/src/ppc64/get_func_addr.c | 45 + sdk/cpprt/linux/libunwind/src/ppc64/init.h | 83 + .../linux/libunwind/src/ppc64/is_fpreg.c | 34 + sdk/cpprt/linux/libunwind/src/ppc64/regname.c | 161 + .../linux/libunwind/src/ppc64/setcontext.S | 9 + .../linux/libunwind/src/ppc64/ucontext_i.h | 173 + .../linux/libunwind/src/ppc64/unwind_i.h | 53 + .../libunwind/src/ptrace/_UPT_access_fpreg.c | 105 + .../libunwind/src/ptrace/_UPT_access_mem.c | 85 + .../libunwind/src/ptrace/_UPT_access_reg.c | 293 + .../libunwind/src/ptrace/_UPT_accessors.c | 38 + .../linux/libunwind/src/ptrace/_UPT_create.c | 46 + .../linux/libunwind/src/ptrace/_UPT_destroy.c | 34 + .../linux/libunwind/src/ptrace/_UPT_elf.c | 5 + .../src/ptrace/_UPT_find_proc_info.c | 145 + .../src/ptrace/_UPT_get_dyn_info_list_addr.c | 105 + .../libunwind/src/ptrace/_UPT_get_proc_name.c | 42 + .../libunwind/src/ptrace/_UPT_internal.h | 59 + .../src/ptrace/_UPT_put_unwind_info.c | 35 + .../libunwind/src/ptrace/_UPT_reg_offset.c | 361 + .../linux/libunwind/src/ptrace/_UPT_resume.c | 40 + .../linux/libunwind/src/se-iterate-phdr.c | 66 + sdk/cpprt/linux/libunwind/src/se-libc-stubs.c | 99 + .../linux/libunwind/src/setjmp/longjmp.c | 115 + sdk/cpprt/linux/libunwind/src/setjmp/setjmp.c | 49 + .../linux/libunwind/src/setjmp/setjmp_i.h | 118 + .../linux/libunwind/src/setjmp/siglongjmp.c | 127 + .../linux/libunwind/src/setjmp/sigsetjmp.c | 50 + .../linux/libunwind/src/unwind/Backtrace.c | 56 + .../libunwind/src/unwind/DeleteException.c | 38 + .../src/unwind/FindEnclosingFunction.c | 42 + .../linux/libunwind/src/unwind/ForcedUnwind.c | 52 + sdk/cpprt/linux/libunwind/src/unwind/GetBSP.c | 42 + sdk/cpprt/linux/libunwind/src/unwind/GetCFA.c | 38 + .../libunwind/src/unwind/GetDataRelBase.c | 39 + sdk/cpprt/linux/libunwind/src/unwind/GetGR.c | 43 + sdk/cpprt/linux/libunwind/src/unwind/GetIP.c | 38 + .../linux/libunwind/src/unwind/GetIPInfo.c | 42 + .../src/unwind/GetLanguageSpecificData.c | 40 + .../libunwind/src/unwind/GetRegionStart.c | 39 + .../libunwind/src/unwind/GetTextRelBase.c | 35 + .../libunwind/src/unwind/RaiseException.c | 103 + sdk/cpprt/linux/libunwind/src/unwind/Resume.c | 42 + .../libunwind/src/unwind/Resume_or_Rethrow.c | 47 + sdk/cpprt/linux/libunwind/src/unwind/SetGR.c | 47 + sdk/cpprt/linux/libunwind/src/unwind/SetIP.c | 35 + .../libunwind/src/unwind/unwind-internal.h | 140 + .../libunwind/src/x86/Gcreate_addr_space.c | 58 + .../linux/libunwind/src/x86/Gget_proc_info.c | 45 + .../linux/libunwind/src/x86/Gget_save_loc.c | 133 + sdk/cpprt/linux/libunwind/src/x86/Gglobal.c | 69 + sdk/cpprt/linux/libunwind/src/x86/Ginit.c | 248 + .../linux/libunwind/src/x86/Ginit_local.c | 56 + .../linux/libunwind/src/x86/Ginit_remote.c | 56 + .../linux/libunwind/src/x86/Gos-freebsd.c | 364 + sdk/cpprt/linux/libunwind/src/x86/Gos-linux.c | 309 + sdk/cpprt/linux/libunwind/src/x86/Gregs.c | 178 + sdk/cpprt/linux/libunwind/src/x86/Gresume.c | 82 + sdk/cpprt/linux/libunwind/src/x86/Gstep.c | 115 + .../libunwind/src/x86/Lcreate_addr_space.c | 5 + .../linux/libunwind/src/x86/Lget_proc_info.c | 5 + .../linux/libunwind/src/x86/Lget_save_loc.c | 5 + sdk/cpprt/linux/libunwind/src/x86/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/x86/Linit.c | 5 + .../linux/libunwind/src/x86/Linit_local.c | 5 + .../linux/libunwind/src/x86/Linit_remote.c | 5 + .../linux/libunwind/src/x86/Los-freebsd.c | 5 + sdk/cpprt/linux/libunwind/src/x86/Los-linux.c | 5 + sdk/cpprt/linux/libunwind/src/x86/Lregs.c | 5 + sdk/cpprt/linux/libunwind/src/x86/Lresume.c | 5 + sdk/cpprt/linux/libunwind/src/x86/Lstep.c | 5 + .../libunwind/src/x86/getcontext-freebsd.S | 112 + .../libunwind/src/x86/getcontext-linux.S | 74 + sdk/cpprt/linux/libunwind/src/x86/init.h | 70 + sdk/cpprt/linux/libunwind/src/x86/is_fpreg.c | 34 + sdk/cpprt/linux/libunwind/src/x86/longjmp.S | 39 + sdk/cpprt/linux/libunwind/src/x86/offsets.h | 142 + sdk/cpprt/linux/libunwind/src/x86/regname.c | 27 + .../linux/libunwind/src/x86/siglongjmp.S | 92 + sdk/cpprt/linux/libunwind/src/x86/unwind_i.h | 64 + .../libunwind/src/x86_64/Gcreate_addr_space.c | 59 + .../libunwind/src/x86_64/Gget_proc_info.c | 48 + .../libunwind/src/x86_64/Gget_save_loc.c | 73 + .../linux/libunwind/src/x86_64/Gglobal.c | 103 + sdk/cpprt/linux/libunwind/src/x86_64/Ginit.c | 273 + .../linux/libunwind/src/x86_64/Ginit_local.c | 58 + .../linux/libunwind/src/x86_64/Ginit_remote.c | 57 + .../linux/libunwind/src/x86_64/Gos-freebsd.c | 199 + .../linux/libunwind/src/x86_64/Gos-linux.c | 154 + sdk/cpprt/linux/libunwind/src/x86_64/Gregs.c | 138 + .../linux/libunwind/src/x86_64/Gresume.c | 114 + .../linux/libunwind/src/x86_64/Gstash_frame.c | 98 + sdk/cpprt/linux/libunwind/src/x86_64/Gstep.c | 222 + sdk/cpprt/linux/libunwind/src/x86_64/Gtrace.c | 533 + .../libunwind/src/x86_64/Lcreate_addr_space.c | 5 + .../libunwind/src/x86_64/Lget_proc_info.c | 5 + .../libunwind/src/x86_64/Lget_save_loc.c | 5 + .../linux/libunwind/src/x86_64/Lglobal.c | 5 + sdk/cpprt/linux/libunwind/src/x86_64/Linit.c | 5 + .../linux/libunwind/src/x86_64/Linit_local.c | 5 + .../linux/libunwind/src/x86_64/Linit_remote.c | 5 + .../libunwind/src/x86_64/Lis_signal_frame.c | 5 + .../linux/libunwind/src/x86_64/Los-freebsd.c | 5 + .../linux/libunwind/src/x86_64/Los-linux.c | 5 + sdk/cpprt/linux/libunwind/src/x86_64/Lregs.c | 5 + .../linux/libunwind/src/x86_64/Lresume.c | 5 + .../linux/libunwind/src/x86_64/Lstash_frame.c | 5 + sdk/cpprt/linux/libunwind/src/x86_64/Lstep.c | 5 + sdk/cpprt/linux/libunwind/src/x86_64/Ltrace.c | 5 + .../linux/libunwind/src/x86_64/getcontext.S | 134 + sdk/cpprt/linux/libunwind/src/x86_64/init.h | 89 + .../linux/libunwind/src/x86_64/is_fpreg.c | 38 + .../linux/libunwind/src/x86_64/longjmp.S | 34 + .../linux/libunwind/src/x86_64/offsets.h | 3 + .../linux/libunwind/src/x86_64/regname.c | 56 + .../linux/libunwind/src/x86_64/siglongjmp.S | 32 + .../linux/libunwind/src/x86_64/ucontext_i.h | 82 + .../linux/libunwind/src/x86_64/unwind_i.h | 92 + sdk/cpprt/linux/pthread_compat.h | 57 + sdk/cpprt/linux/stdexcept.cc | 96 + sdk/cpprt/linux/terminate.cc | 43 + sdk/cpprt/linux/typeinfo.cc | 126 + sdk/cpprt/linux/typeinfo.h | 234 + sdk/cpprt/linux/unwind-arm.h | 223 + sdk/cpprt/linux/unwind-itanium.h | 170 + sdk/cpprt/linux/unwind.h | 40 + sdk/cpprt/memory_manage/delete1.cpp | 43 + sdk/cpprt/memory_manage/delete2.cpp | 44 + sdk/cpprt/memory_manage/delete3.cpp | 44 + sdk/cpprt/memory_manage/delete4.cpp | 43 + sdk/cpprt/memory_manage/delete5.cpp | 42 + sdk/cpprt/memory_manage/delete6.cpp | 44 + sdk/cpprt/memory_manage/new1.cpp | 52 + sdk/cpprt/memory_manage/new2.cpp | 56 + sdk/cpprt/memory_manage/new3.cpp | 47 + sdk/cpprt/memory_manage/new4.cpp | 43 + sdk/cpprt/memory_manage/new5.cpp | 42 + sdk/cpprt/memory_manage/new6.cpp | 46 + sdk/cpprt/memory_manage/new_handler.cpp | 89 + sdk/cpprt/tstdcxx_version.cpp | 48 + sdk/debugger_interface/linux/Makefile | 89 + .../linux/gdb-sgx-plugin/gdb_sgx_cmd | 35 + .../linux/gdb-sgx-plugin/gdb_sgx_plugin.py | 597 ++ .../linux/gdb-sgx-plugin/load_symbol_cmd.py | 132 + .../linux/gdb-sgx-plugin/readelf.py | 50 + .../linux/gdb-sgx-plugin/sgx_emmt.py | 94 + sdk/debugger_interface/linux/ptrace_version.c | 44 + sdk/debugger_interface/linux/se_ptrace.c | 594 ++ sdk/ec_dh_lib/Makefile | 67 + sdk/ec_dh_lib/ec_dh.cpp | 821 ++ sdk/ec_dh_lib/sgx_dh_internal.h | 85 + sdk/edger8r/linux/Ast.ml | 251 + sdk/edger8r/linux/CodeGen.ml | 1552 +++ sdk/edger8r/linux/Edger8r.ml | 46 + sdk/edger8r/linux/Lexer.mll | 124 + sdk/edger8r/linux/Makefile | 48 + sdk/edger8r/linux/Parser.mly | 606 ++ sdk/edger8r/linux/SimpleStack.ml | 40 + sdk/edger8r/linux/Util.ml | 308 + sdk/sample_libcrypto/Makefile | 73 + sdk/sample_libcrypto/sample_libcrypto.cpp | 931 ++ sdk/sample_libcrypto/sample_libcrypto.h | 238 + sdk/sample_libcrypto/sample_libcrypto.lds | 23 + sdk/selib/linux/Makefile | 61 + sdk/selib/sgx_create_report.cpp | 150 + sdk/selib/sgx_get_key.cpp | 181 + sdk/selib/sgx_verify_report.cpp | 101 + sdk/selib/tservice_version.cpp | 48 + sdk/sign_tool/SignTool/Makefile | 109 + sdk/sign_tool/SignTool/README.txt | 27 + sdk/sign_tool/SignTool/elf_helper.h | 106 + .../SignTool/enclave_creator_sign.cpp | 278 + sdk/sign_tool/SignTool/enclave_creator_sign.h | 65 + sdk/sign_tool/SignTool/manage_metadata.cpp | 662 ++ sdk/sign_tool/SignTool/manage_metadata.h | 107 + sdk/sign_tool/SignTool/parse_key_file.cpp | 517 + sdk/sign_tool/SignTool/parse_key_file.h | 79 + sdk/sign_tool/SignTool/sign_tool.cpp | 1177 ++ sdk/sign_tool/SignTool/util_st.cpp | 109 + sdk/sign_tool/SignTool/util_st.h | 129 + sdk/simulation/Makefile | 54 + .../SEConfigureCPUSVN/linux/Makefile | 72 + .../SEConfigureCPUSVN/linux/config_cpusvn.cpp | 196 + .../SEConfigureCPUSVN/linux/cpusvn_helper.h | 61 + sdk/simulation/assembly/Makefile | 38 + sdk/simulation/assembly/linux/Makefile | 42 + sdk/simulation/assembly/linux/gnu_tls.h | 100 + sdk/simulation/assembly/linux/lowlib.S | 65 + sdk/simulation/assembly/linux/sgxsim.S | 43 + sdk/simulation/assembly/linux/sw_emu.h | 121 + sdk/simulation/assembly/lowlib.h | 68 + sdk/simulation/assembly/sgxsim.h | 60 + sdk/simulation/driver_api/Makefile | 52 + sdk/simulation/driver_api/driver_api.cpp | 156 + sdk/simulation/tae_service_sim/Makefile | 122 + .../tae_service_sim/tae_service_sim.cpp | 485 + sdk/simulation/tinst/Makefile | 63 + sdk/simulation/tinst/deriv.cpp | 93 + sdk/simulation/tinst/deriv.h | 138 + sdk/simulation/tinst/rts_sim.h | 74 + sdk/simulation/tinst/t_instructions.cpp | 351 + sdk/simulation/tinst/t_instructions.h | 52 + sdk/simulation/trtssim/Makefile | 37 + sdk/simulation/trtssim/linux/Makefile | 134 + .../uae_service_sim/licensing_sim.cpp | 152 + sdk/simulation/uae_service_sim/linux/Makefile | 124 + .../linux/platform_service_sim.cpp | 210 + .../linux/uae_service_sim.linux.version | 15 + .../platform_service_sim_com.cpp | 363 + .../uae_service_sim/quoting_sim.cpp | 462 + .../uae_service_sim/uae_service_deploy.c | 42 + .../uae_service_sim/uae_service_sim.h | 71 + sdk/simulation/uinst/Makefile | 77 + sdk/simulation/uinst/enclave_mngr.cpp | 253 + sdk/simulation/uinst/enclave_mngr.h | 104 + sdk/simulation/uinst/linux/Makefile | 58 + sdk/simulation/uinst/linux/get_tcs.c | 46 + sdk/simulation/uinst/linux/restore_tls.c | 58 + sdk/simulation/uinst/linux/set_tls.c | 66 + sdk/simulation/uinst/td_mngr.h | 73 + sdk/simulation/uinst/u_instructions.cpp | 320 + sdk/simulation/uinst/u_instructions.h | 72 + sdk/simulation/urtssim/Makefile | 37 + sdk/simulation/urtssim/cpusvn_util.cpp | 166 + sdk/simulation/urtssim/cpusvn_util.h | 54 + .../urtssim/enclave_creator_sim.cpp | 243 + sdk/simulation/urtssim/enclave_creator_sim.h | 53 + sdk/simulation/urtssim/linux/Makefile | 173 + sdk/simulation/urtssim/urts_deploy.c | 51 + sdk/simulation/urtssim/urts_sim.h | 48 + sdk/tae_service/Makefile | 97 + sdk/tae_service/tae_config.h | 62 + sdk/tae_service/tae_service.cpp | 729 ++ sdk/tkey_exchange/Makefile | 94 + sdk/tkey_exchange/simple_vector.cpp | 131 + sdk/tkey_exchange/simple_vector.h | 71 + sdk/tkey_exchange/tkey_exchange.cpp | 698 ++ sdk/tkey_exchange/tkey_exchange_version.cpp | 48 + sdk/tlibc/Makefile | 77 + sdk/tlibc/gdtoa/arith.h | 16 + sdk/tlibc/gdtoa/dmisc.c | 224 + sdk/tlibc/gdtoa/dtoa.c | 839 ++ sdk/tlibc/gdtoa/gd_qnan.h | 12 + sdk/tlibc/gdtoa/gdtoa.c | 829 ++ sdk/tlibc/gdtoa/gdtoa.h | 118 + sdk/tlibc/gdtoa/gdtoaimp.h | 627 ++ sdk/tlibc/gdtoa/gethex.c | 360 + sdk/tlibc/gdtoa/gmisc.c | 86 + sdk/tlibc/gdtoa/hd_init.c | 55 + sdk/tlibc/gdtoa/hdtoa.c | 332 + sdk/tlibc/gdtoa/hexnan.c | 150 + sdk/tlibc/gdtoa/ldtoa.c | 124 + sdk/tlibc/gdtoa/locks.c | 7 + sdk/tlibc/gdtoa/misc.c | 895 ++ sdk/tlibc/gdtoa/smisc.c | 201 + sdk/tlibc/gdtoa/strtod.c | 1105 ++ sdk/tlibc/gdtoa/strtodg.c | 1156 ++ sdk/tlibc/gdtoa/strtof.c | 81 + sdk/tlibc/gdtoa/strtold.c | 40 + sdk/tlibc/gdtoa/strtord.c | 73 + sdk/tlibc/gdtoa/strtorx.c | 123 + sdk/tlibc/gdtoa/sum.c | 102 + sdk/tlibc/gdtoa/ulp.c | 70 + sdk/tlibc/gen/__memcpy_chk.cpp | 50 + sdk/tlibc/gen/__memmove_chk.cpp | 50 + sdk/tlibc/gen/__mempcpy_chk.cpp | 50 + sdk/tlibc/gen/__memset_chk.cpp | 49 + sdk/tlibc/gen/__stpcpy_chk.cpp | 50 + sdk/tlibc/gen/__stpncpy_chk.cpp | 50 + sdk/tlibc/gen/__strcat_chk.cpp | 58 + sdk/tlibc/gen/__strcpy_chk.cpp | 50 + sdk/tlibc/gen/__strlen_chk.cpp | 64 + sdk/tlibc/gen/__strncat_chk.cpp | 69 + sdk/tlibc/gen/__strncpy_chk.cpp | 50 + sdk/tlibc/gen/__vsnprintf_chk.cpp | 83 + sdk/tlibc/gen/__vsprintf_chk.cpp | 83 + sdk/tlibc/gen/alloca.S | 67 + sdk/tlibc/gen/assert.c | 52 + sdk/tlibc/gen/ctype_.c | 77 + sdk/tlibc/gen/ctype_private.h | 21 + sdk/tlibc/gen/errlist.c | 148 + sdk/tlibc/gen/errno.c | 47 + sdk/tlibc/gen/infinity.c | 8 + sdk/tlibc/gen/isctype.c | 124 + sdk/tlibc/gen/nan.c | 9 + sdk/tlibc/gen/sbrk.c | 75 + sdk/tlibc/gen/se_cpuid.c | 58 + sdk/tlibc/gen/spinlock.c | 79 + sdk/tlibc/gen/tolower_.c | 56 + sdk/tlibc/gen/toupper_.c | 57 + sdk/tlibc/locale/btowc.c | 54 + sdk/tlibc/locale/mblen.c | 48 + sdk/tlibc/locale/mbrlen.c | 39 + sdk/tlibc/locale/mbstowcs.c | 43 + sdk/tlibc/locale/mbtowc.c | 49 + sdk/tlibc/locale/multibyte_citrus_none.c | 179 + sdk/tlibc/locale/runetype.h | 45 + sdk/tlibc/locale/wcscoll.c | 41 + sdk/tlibc/locale/wcstombs.c | 43 + sdk/tlibc/locale/wcsxfrm.c | 44 + sdk/tlibc/locale/wctob.c | 43 + sdk/tlibc/locale/wctomb.c | 47 + sdk/tlibc/math/w_drem.c | 14 + sdk/tlibc/math/w_dremf.c | 14 + sdk/tlibc/math/w_dreml.c | 42 + sdk/tlibc/math/w_pow10.c | 39 + sdk/tlibc/math/w_pow10f.c | 39 + sdk/tlibc/math/w_pow10l.c | 42 + sdk/tlibc/stdio/fileext.h | 54 + sdk/tlibc/stdio/floatio.h | 58 + sdk/tlibc/stdio/fvwrite.c | 217 + sdk/tlibc/stdio/fvwrite.h | 49 + sdk/tlibc/stdio/local.h | 102 + sdk/tlibc/stdio/snprintf.c | 68 + sdk/tlibc/stdio/swprintf.c | 45 + sdk/tlibc/stdio/vfprintf.c | 1517 +++ sdk/tlibc/stdio/vfwprintf.c | 1487 +++ sdk/tlibc/stdio/vsnprintf.c | 64 + sdk/tlibc/stdio/vswprintf.c | 97 + sdk/tlibc/stdio/wcio.h | 61 + sdk/tlibc/stdlib/abs.c | 37 + sdk/tlibc/stdlib/atof.c | 37 + sdk/tlibc/stdlib/atoi.c | 37 + sdk/tlibc/stdlib/atol.c | 37 + sdk/tlibc/stdlib/atoll.c | 37 + sdk/tlibc/stdlib/bsearch.c | 71 + sdk/tlibc/stdlib/div.c | 71 + sdk/tlibc/stdlib/imaxabs.c | 38 + sdk/tlibc/stdlib/imaxdiv.c | 50 + sdk/tlibc/stdlib/labs.c | 37 + sdk/tlibc/stdlib/ldiv.c | 50 + sdk/tlibc/stdlib/llabs.c | 38 + sdk/tlibc/stdlib/lldiv.c | 50 + sdk/tlibc/stdlib/malloc.c | 6363 +++++++++++ sdk/tlibc/stdlib/qsort.c | 164 + sdk/tlibc/stdlib/strtoimax.c | 140 + sdk/tlibc/stdlib/strtol.c | 151 + sdk/tlibc/stdlib/strtoll.c | 143 + sdk/tlibc/stdlib/strtoul.c | 104 + sdk/tlibc/stdlib/strtoull.c | 107 + sdk/tlibc/stdlib/strtoumax.c | 104 + sdk/tlibc/string/bcmp.c | 51 + sdk/tlibc/string/bcopy.c | 112 + sdk/tlibc/string/bzero.c | 44 + sdk/tlibc/string/consttime_memequal.c | 29 + sdk/tlibc/string/ffs.c | 40 + sdk/tlibc/string/ffsl.c | 40 + sdk/tlibc/string/ffsll.c | 40 + sdk/tlibc/string/index.c | 38 + sdk/tlibc/string/memchr.c | 48 + sdk/tlibc/string/memcmp.c | 59 + sdk/tlibc/string/memcpy.c | 105 + sdk/tlibc/string/memmove.c | 112 + sdk/tlibc/string/mempcpy.c | 2 + sdk/tlibc/string/memset.c | 56 + sdk/tlibc/string/memset_s.c | 83 + sdk/tlibc/string/rindex.c | 37 + sdk/tlibc/string/se_string_init.c | 43 + sdk/tlibc/string/stpncpy.c | 56 + sdk/tlibc/string/strcasecmp.c | 105 + sdk/tlibc/string/strchr.c | 48 + sdk/tlibc/string/strcmp.c | 48 + sdk/tlibc/string/strcoll.c | 44 + sdk/tlibc/string/strcspn.c | 65 + sdk/tlibc/string/strerror.c | 44 + sdk/tlibc/string/strerror_r.c | 100 + sdk/tlibc/string/strlcpy.c | 50 + sdk/tlibc/string/strlen.c | 44 + sdk/tlibc/string/strncat.c | 59 + sdk/tlibc/string/strncmp.c | 47 + sdk/tlibc/string/strncpy.c | 60 + sdk/tlibc/string/strndup.c | 39 + sdk/tlibc/string/strnlen.c | 32 + sdk/tlibc/string/strpbrk.c | 56 + sdk/tlibc/string/strrchr.c | 50 + sdk/tlibc/string/strspn.c | 59 + sdk/tlibc/string/strstr.c | 56 + sdk/tlibc/string/strtok.c | 86 + sdk/tlibc/string/strxfrm.c | 51 + sdk/tlibc/string/wcschr.c | 49 + sdk/tlibc/string/wcscmp.c | 51 + sdk/tlibc/string/wcscspn.c | 53 + sdk/tlibc/string/wcslcpy.c | 50 + sdk/tlibc/string/wcslen.c | 44 + sdk/tlibc/string/wcsncat.c | 52 + sdk/tlibc/string/wcsncmp.c | 52 + sdk/tlibc/string/wcsncpy.c | 50 + sdk/tlibc/string/wcspbrk.c | 52 + sdk/tlibc/string/wcsrchr.c | 49 + sdk/tlibc/string/wcsspn.c | 55 + sdk/tlibc/string/wcsstr.c | 68 + sdk/tlibc/string/wcstok.c | 93 + sdk/tlibc/string/wcswcs.c | 5 + sdk/tlibc/string/wmemchr.c | 46 + sdk/tlibc/string/wmemcmp.c | 50 + sdk/tlibc/string/wmemcpy.c | 40 + sdk/tlibc/string/wmemmove.c | 40 + sdk/tlibc/string/wmemset.c | 46 + sdk/tlibc/time/asctime.c | 154 + sdk/tlibc/time/difftime.c | 60 + sdk/tlibc/time/private.h | 65 + sdk/tlibc/time/strftime.c | 763 ++ sdk/tlibc/time/tzfile.h | 72 + sdk/tlibc/tstdc_version.cpp | 47 + sdk/tlibcrypto/Makefile | 70 + sdk/tlibcrypto/init_crypto_lib.cpp | 48 + sdk/tlibcrypto/sgx_aes_ctr.cpp | 169 + sdk/tlibcrypto/sgx_aes_gcm.cpp | 235 + sdk/tlibcrypto/sgx_cmac128.cpp | 230 + sdk/tlibcrypto/sgx_ecc256.cpp | 484 + sdk/tlibcrypto/sgx_ecc256_common.cpp | 129 + sdk/tlibcrypto/sgx_ecc256_common.h | 64 + sdk/tlibcrypto/sgx_ecc256_ecdsa.cpp | 299 + sdk/tlibcrypto/sgx_sha256.cpp | 135 + sdk/tlibcrypto/sgx_sha256_msg.cpp | 65 + sdk/tlibcrypto/tcrypto_version.cpp | 48 + sdk/tlibstdcxx/Makefile | 60 + sdk/tlibstdcxx/README.sgx | 22 + sdk/tlibstdcxx/etc/stlport.natvis | 524 + sdk/tlibstdcxx/src/_stdio_file.h | 117 + sdk/tlibstdcxx/src/acquire_release.h | 46 + sdk/tlibstdcxx/src/aligned_buffer.h | 21 + sdk/tlibstdcxx/src/allocators.cpp | 1121 ++ sdk/tlibstdcxx/src/bitset.cpp | 156 + sdk/tlibstdcxx/src/c_locale.c | 29 + sdk/tlibstdcxx/src/c_locale.h | 450 + .../src/c_locale_dummy/c_locale_dummy.c | 485 + .../src/c_locale_glibc/c_locale_glibc2.c | 705 ++ sdk/tlibstdcxx/src/codecvt.cpp | 143 + sdk/tlibstdcxx/src/collate.cpp | 69 + sdk/tlibstdcxx/src/complex.cpp | 347 + sdk/tlibstdcxx/src/complex_io.cpp | 157 + sdk/tlibstdcxx/src/complex_trig.cpp | 192 + sdk/tlibstdcxx/src/ctype.cpp | 486 + sdk/tlibstdcxx/src/cxa.c | 198 + sdk/tlibstdcxx/src/details/fstream_stdio.cpp | 387 + sdk/tlibstdcxx/src/details/fstream_unistd.cpp | 347 + sdk/tlibstdcxx/src/dll_main.cpp | 262 + sdk/tlibstdcxx/src/facets_byname.cpp | 1057 ++ sdk/tlibstdcxx/src/fstream.cpp | 114 + sdk/tlibstdcxx/src/ios.cpp | 318 + sdk/tlibstdcxx/src/iostream.cpp | 354 + sdk/tlibstdcxx/src/istream.cpp | 48 + sdk/tlibstdcxx/src/locale.cpp | 445 + sdk/tlibstdcxx/src/locale_catalog.cpp | 288 + sdk/tlibstdcxx/src/locale_impl.cpp | 765 ++ sdk/tlibstdcxx/src/locale_impl.h | 133 + sdk/tlibstdcxx/src/lock_free_slist.h | 307 + sdk/tlibstdcxx/src/message_facets.h | 152 + sdk/tlibstdcxx/src/messages.cpp | 247 + sdk/tlibstdcxx/src/monetary.cpp | 152 + sdk/tlibstdcxx/src/num_get.cpp | 120 + sdk/tlibstdcxx/src/num_get_float.cpp | 883 ++ sdk/tlibstdcxx/src/num_put.cpp | 183 + sdk/tlibstdcxx/src/num_put_float.cpp | 918 ++ sdk/tlibstdcxx/src/numpunct.cpp | 46 + sdk/tlibstdcxx/src/ostream.cpp | 47 + sdk/tlibstdcxx/src/sparc_atomic.s | 68 + sdk/tlibstdcxx/src/sparc_atomic64.s | 65 + sdk/tlibstdcxx/src/sstream.cpp | 45 + sdk/tlibstdcxx/src/stdio_streambuf.cpp | 239 + sdk/tlibstdcxx/src/stdio_streambuf.h | 102 + sdk/tlibstdcxx/src/stlport_prefix.h | 48 + sdk/tlibstdcxx/src/string.cpp | 94 + sdk/tlibstdcxx/src/strstream.cpp | 391 + sdk/tlibstdcxx/src/time_facets.cpp | 565 + sdk/tlibstdcxx/src/warning_disable.h | 61 + sdk/tlibstdcxx/stlport/algorithm | 62 + sdk/tlibstdcxx/stlport/assert.h | 50 + sdk/tlibstdcxx/stlport/bitset | 70 + sdk/tlibstdcxx/stlport/cassert | 46 + sdk/tlibstdcxx/stlport/cctype | 47 + sdk/tlibstdcxx/stlport/cerrno | 55 + sdk/tlibstdcxx/stlport/cfloat | 45 + sdk/tlibstdcxx/stlport/ciso646 | 45 + sdk/tlibstdcxx/stlport/climits | 53 + sdk/tlibstdcxx/stlport/cmath | 53 + sdk/tlibstdcxx/stlport/complex | 57 + sdk/tlibstdcxx/stlport/cstdarg | 47 + sdk/tlibstdcxx/stlport/cstddef | 47 + sdk/tlibstdcxx/stlport/cstdio | 53 + sdk/tlibstdcxx/stlport/cstdlib | 54 + sdk/tlibstdcxx/stlport/cstring | 47 + sdk/tlibstdcxx/stlport/ctime | 53 + sdk/tlibstdcxx/stlport/ctype.h | 114 + sdk/tlibstdcxx/stlport/cwchar | 48 + sdk/tlibstdcxx/stlport/cwctype | 47 + sdk/tlibstdcxx/stlport/deque | 57 + sdk/tlibstdcxx/stlport/errno.h | 70 + sdk/tlibstdcxx/stlport/exception | 68 + sdk/tlibstdcxx/stlport/float.h | 52 + sdk/tlibstdcxx/stlport/functional | 148 + sdk/tlibstdcxx/stlport/iso646.h | 39 + sdk/tlibstdcxx/stlport/iterator | 61 + sdk/tlibstdcxx/stlport/limits | 50 + sdk/tlibstdcxx/stlport/limits.h | 39 + sdk/tlibstdcxx/stlport/list | 57 + sdk/tlibstdcxx/stlport/map | 57 + sdk/tlibstdcxx/stlport/math.h | 53 + sdk/tlibstdcxx/stlport/memory | 130 + sdk/tlibstdcxx/stlport/new | 47 + sdk/tlibstdcxx/stlport/new.h | 50 + sdk/tlibstdcxx/stlport/numeric | 54 + sdk/tlibstdcxx/stlport/queue | 57 + sdk/tlibstdcxx/stlport/set | 57 + sdk/tlibstdcxx/stlport/stack | 57 + sdk/tlibstdcxx/stlport/stdarg.h | 47 + sdk/tlibstdcxx/stlport/stddef.h | 44 + sdk/tlibstdcxx/stlport/stdexcept | 56 + sdk/tlibstdcxx/stlport/stdio.h | 57 + sdk/tlibstdcxx/stlport/stdlib.h | 67 + sdk/tlibstdcxx/stlport/stl/_abbrevs.h | 77 + sdk/tlibstdcxx/stlport/stl/_algo.c | 2040 ++++ sdk/tlibstdcxx/stlport/stl/_algo.h | 777 ++ sdk/tlibstdcxx/stlport/stl/_algobase.c | 484 + sdk/tlibstdcxx/stlport/stl/_algobase.h | 728 ++ sdk/tlibstdcxx/stlport/stl/_alloc.c | 87 + sdk/tlibstdcxx/stlport/stl/_alloc.h | 580 + sdk/tlibstdcxx/stlport/stl/_auto_ptr.h | 133 + sdk/tlibstdcxx/stlport/stl/_bitset.c | 235 + sdk/tlibstdcxx/stlport/stl/_bitset.h | 928 ++ sdk/tlibstdcxx/stlport/stl/_bvector.h | 841 ++ sdk/tlibstdcxx/stlport/stl/_carray.h | 61 + sdk/tlibstdcxx/stlport/stl/_cctype.h | 49 + sdk/tlibstdcxx/stlport/stl/_clocale.h | 43 + sdk/tlibstdcxx/stlport/stl/_cmath.h | 579 + sdk/tlibstdcxx/stlport/stl/_codecvt.h | 442 + sdk/tlibstdcxx/stlport/stl/_collate.h | 176 + sdk/tlibstdcxx/stlport/stl/_complex.c | 145 + sdk/tlibstdcxx/stlport/stl/_complex.h | 935 ++ .../stlport/stl/_config_compat_post.h | 51 + sdk/tlibstdcxx/stlport/stl/_construct.h | 289 + sdk/tlibstdcxx/stlport/stl/_cprolog.h | 25 + sdk/tlibstdcxx/stlport/stl/_csetjmp.h | 68 + sdk/tlibstdcxx/stlport/stl/_csignal.h | 41 + sdk/tlibstdcxx/stlport/stl/_cstdarg.h | 34 + sdk/tlibstdcxx/stlport/stl/_cstddef.h | 44 + sdk/tlibstdcxx/stlport/stl/_cstdio.h | 129 + sdk/tlibstdcxx/stlport/stl/_cstdlib.h | 188 + sdk/tlibstdcxx/stlport/stl/_cstring.h | 35 + sdk/tlibstdcxx/stlport/stl/_ctime.h | 57 + sdk/tlibstdcxx/stlport/stl/_ctraits_fns.h | 91 + sdk/tlibstdcxx/stlport/stl/_ctype.h | 280 + sdk/tlibstdcxx/stlport/stl/_cwchar.h | 355 + sdk/tlibstdcxx/stlport/stl/_cwctype.h | 93 + sdk/tlibstdcxx/stlport/stl/_deque.c | 823 ++ sdk/tlibstdcxx/stlport/stl/_deque.h | 1115 ++ sdk/tlibstdcxx/stlport/stl/_epilog.h | 42 + sdk/tlibstdcxx/stlport/stl/_exception.h | 194 + sdk/tlibstdcxx/stlport/stl/_facets_fwd.h | 53 + sdk/tlibstdcxx/stlport/stl/_fstream.c | 766 ++ sdk/tlibstdcxx/stlport/stl/_fstream.h | 714 ++ sdk/tlibstdcxx/stlport/stl/_function.h | 433 + .../stlport/stl/_function_adaptors.h | 783 ++ sdk/tlibstdcxx/stlport/stl/_function_base.h | 217 + sdk/tlibstdcxx/stlport/stl/_hash_fun.h | 146 + sdk/tlibstdcxx/stlport/stl/_hash_map.h | 500 + sdk/tlibstdcxx/stlport/stl/_hash_set.h | 495 + sdk/tlibstdcxx/stlport/stl/_hashtable.c | 553 + sdk/tlibstdcxx/stlport/stl/_hashtable.h | 658 ++ sdk/tlibstdcxx/stlport/stl/_heap.c | 246 + sdk/tlibstdcxx/stlport/stl/_heap.h | 125 + sdk/tlibstdcxx/stlport/stl/_iomanip.h | 165 + sdk/tlibstdcxx/stlport/stl/_ios.c | 127 + sdk/tlibstdcxx/stlport/stl/_ios.h | 187 + sdk/tlibstdcxx/stlport/stl/_ios_base.h | 345 + sdk/tlibstdcxx/stlport/stl/_ioserr.h | 12 + sdk/tlibstdcxx/stlport/stl/_iosfwd.h | 159 + sdk/tlibstdcxx/stlport/stl/_iostream_string.h | 140 + sdk/tlibstdcxx/stlport/stl/_istream.c | 1429 +++ sdk/tlibstdcxx/stlport/stl/_istream.h | 359 + .../stlport/stl/_istreambuf_iterator.h | 161 + sdk/tlibstdcxx/stlport/stl/_iterator.h | 265 + sdk/tlibstdcxx/stlport/stl/_iterator_base.h | 528 + sdk/tlibstdcxx/stlport/stl/_iterator_old.h | 334 + sdk/tlibstdcxx/stlport/stl/_limits.c | 405 + sdk/tlibstdcxx/stlport/stl/_limits.h | 519 + sdk/tlibstdcxx/stlport/stl/_list.c | 250 + sdk/tlibstdcxx/stlport/stl/_list.h | 742 ++ sdk/tlibstdcxx/stlport/stl/_locale.h | 364 + sdk/tlibstdcxx/stlport/stl/_map.h | 435 + sdk/tlibstdcxx/stlport/stl/_mbstate_t.h | 41 + sdk/tlibstdcxx/stlport/stl/_messages_facets.h | 185 + sdk/tlibstdcxx/stlport/stl/_monetary.c | 527 + sdk/tlibstdcxx/stlport/stl/_monetary.h | 435 + .../stlport/stl/_move_construct_fwk.h | 159 + sdk/tlibstdcxx/stlport/stl/_new.h | 145 + sdk/tlibstdcxx/stlport/stl/_num_get.c | 623 ++ sdk/tlibstdcxx/stlport/stl/_num_get.h | 237 + sdk/tlibstdcxx/stlport/stl/_num_put.c | 522 + sdk/tlibstdcxx/stlport/stl/_num_put.h | 187 + sdk/tlibstdcxx/stlport/stl/_numeric.c | 106 + sdk/tlibstdcxx/stlport/stl/_numeric.h | 191 + sdk/tlibstdcxx/stlport/stl/_numpunct.h | 176 + sdk/tlibstdcxx/stlport/stl/_ostream.c | 455 + sdk/tlibstdcxx/stlport/stl/_ostream.h | 387 + .../stlport/stl/_ostreambuf_iterator.h | 102 + sdk/tlibstdcxx/stlport/stl/_pair.h | 182 + sdk/tlibstdcxx/stlport/stl/_prolog.h | 18 + sdk/tlibstdcxx/stlport/stl/_pthread_alloc.h | 461 + sdk/tlibstdcxx/stlport/stl/_ptrs_specialize.h | 83 + sdk/tlibstdcxx/stlport/stl/_queue.h | 268 + sdk/tlibstdcxx/stlport/stl/_range_errors.c | 84 + sdk/tlibstdcxx/stlport/stl/_range_errors.h | 60 + .../stlport/stl/_raw_storage_iter.h | 80 + sdk/tlibstdcxx/stlport/stl/_relops_cont.h | 29 + .../stlport/stl/_relops_hash_cont.h | 13 + sdk/tlibstdcxx/stlport/stl/_rope.c | 1407 +++ sdk/tlibstdcxx/stlport/stl/_rope.h | 2389 +++++ sdk/tlibstdcxx/stlport/stl/_set.h | 412 + sdk/tlibstdcxx/stlport/stl/_slist.c | 231 + sdk/tlibstdcxx/stlport/stl/_slist.h | 914 ++ sdk/tlibstdcxx/stlport/stl/_slist_base.c | 104 + sdk/tlibstdcxx/stlport/stl/_slist_base.h | 90 + sdk/tlibstdcxx/stlport/stl/_sparc_atomic.h | 61 + sdk/tlibstdcxx/stlport/stl/_sstream.c | 465 + sdk/tlibstdcxx/stlport/stl/_sstream.h | 266 + sdk/tlibstdcxx/stlport/stl/_stack.h | 133 + sdk/tlibstdcxx/stlport/stl/_stdexcept.h | 110 + sdk/tlibstdcxx/stlport/stl/_stdexcept_base.c | 95 + sdk/tlibstdcxx/stlport/stl/_stdexcept_base.h | 98 + sdk/tlibstdcxx/stlport/stl/_stlport_version.h | 30 + sdk/tlibstdcxx/stlport/stl/_stream_iterator.h | 253 + sdk/tlibstdcxx/stlport/stl/_streambuf.c | 208 + sdk/tlibstdcxx/stlport/stl/_streambuf.h | 287 + sdk/tlibstdcxx/stlport/stl/_string.c | 674 ++ sdk/tlibstdcxx/stlport/stl/_string.h | 1182 +++ sdk/tlibstdcxx/stlport/stl/_string_base.h | 231 + sdk/tlibstdcxx/stlport/stl/_string_fwd.h | 60 + sdk/tlibstdcxx/stlport/stl/_string_hash.h | 71 + sdk/tlibstdcxx/stlport/stl/_string_io.c | 172 + sdk/tlibstdcxx/stlport/stl/_string_io.h | 77 + sdk/tlibstdcxx/stlport/stl/_string_npos.h | 27 + .../stlport/stl/_string_operators.h | 602 ++ sdk/tlibstdcxx/stlport/stl/_string_sum.h | 414 + .../stlport/stl/_string_sum_methods.h | 155 + .../stlport/stl/_string_workaround.h | 599 ++ sdk/tlibstdcxx/stlport/stl/_strstream.h | 165 + sdk/tlibstdcxx/stlport/stl/_tempbuf.c | 57 + sdk/tlibstdcxx/stlport/stl/_tempbuf.h | 167 + sdk/tlibstdcxx/stlport/stl/_threads.c | 167 + sdk/tlibstdcxx/stlport/stl/_threads.h | 687 ++ sdk/tlibstdcxx/stlport/stl/_time_facets.c | 441 + sdk/tlibstdcxx/stlport/stl/_time_facets.h | 329 + sdk/tlibstdcxx/stlport/stl/_tree.c | 730 ++ sdk/tlibstdcxx/stlport/stl/_tree.h | 684 ++ sdk/tlibstdcxx/stlport/stl/_typeinfo.h | 84 + sdk/tlibstdcxx/stlport/stl/_uninitialized.h | 443 + sdk/tlibstdcxx/stlport/stl/_unordered_map.h | 443 + sdk/tlibstdcxx/stlport/stl/_unordered_set.h | 418 + sdk/tlibstdcxx/stlport/stl/_valarray.c | 194 + sdk/tlibstdcxx/stlport/stl/_valarray.h | 1684 +++ sdk/tlibstdcxx/stlport/stl/_vector.c | 242 + sdk/tlibstdcxx/stlport/stl/_vector.h | 773 ++ .../stlport/stl/boost_type_traits.h | 150 + sdk/tlibstdcxx/stlport/stl/c_locale.h | 131 + sdk/tlibstdcxx/stlport/stl/char_traits.h | 278 + sdk/tlibstdcxx/stlport/stl/concept_checks.h | 810 ++ sdk/tlibstdcxx/stlport/stl/config/_aix.h | 3 + sdk/tlibstdcxx/stlport/stl/config/_apcc.h | 30 + sdk/tlibstdcxx/stlport/stl/config/_apple.h | 118 + sdk/tlibstdcxx/stlport/stl/config/_as400.h | 55 + .../stlport/stl/config/_auto_link.h | 61 + sdk/tlibstdcxx/stlport/stl/config/_bc.h | 138 + sdk/tlibstdcxx/stlport/stl/config/_como.h | 207 + sdk/tlibstdcxx/stlport/stl/config/_cray.h | 65 + sdk/tlibstdcxx/stlport/stl/config/_cygwin.h | 9 + sdk/tlibstdcxx/stlport/stl/config/_dec.h | 113 + sdk/tlibstdcxx/stlport/stl/config/_dec_vms.h | 89 + .../stlport/stl/config/_detect_dll_or_lib.h | 74 + sdk/tlibstdcxx/stlport/stl/config/_dm.h | 121 + sdk/tlibstdcxx/stlport/stl/config/_epilog.h | 29 + sdk/tlibstdcxx/stlport/stl/config/_evc.h | 333 + sdk/tlibstdcxx/stlport/stl/config/_feedback.h | 43 + sdk/tlibstdcxx/stlport/stl/config/_freebsd.h | 3 + sdk/tlibstdcxx/stlport/stl/config/_fujitsu.h | 7 + sdk/tlibstdcxx/stlport/stl/config/_gcc.h | 204 + sdk/tlibstdcxx/stlport/stl/config/_hpacc.h | 129 + sdk/tlibstdcxx/stlport/stl/config/_hpux.h | 17 + sdk/tlibstdcxx/stlport/stl/config/_ibm.h | 144 + sdk/tlibstdcxx/stlport/stl/config/_icc.h | 45 + sdk/tlibstdcxx/stlport/stl/config/_intel.h | 72 + sdk/tlibstdcxx/stlport/stl/config/_kai.h | 43 + sdk/tlibstdcxx/stlport/stl/config/_linux.h | 126 + sdk/tlibstdcxx/stlport/stl/config/_mac.h | 6 + sdk/tlibstdcxx/stlport/stl/config/_macosx.h | 9 + sdk/tlibstdcxx/stlport/stl/config/_mlc.h | 7 + sdk/tlibstdcxx/stlport/stl/config/_msvc.h | 265 + sdk/tlibstdcxx/stlport/stl/config/_mwerks.h | 159 + .../stlport/stl/config/_native_headers.h | 50 + sdk/tlibstdcxx/stlport/stl/config/_openbsd.h | 12 + sdk/tlibstdcxx/stlport/stl/config/_prolog.h | 43 + sdk/tlibstdcxx/stlport/stl/config/_sgi.h | 94 + sdk/tlibstdcxx/stlport/stl/config/_sgx.h | 57 + sdk/tlibstdcxx/stlport/stl/config/_solaris.h | 77 + sdk/tlibstdcxx/stlport/stl/config/_sunprocc.h | 166 + sdk/tlibstdcxx/stlport/stl/config/_system.h | 171 + .../stlport/stl/config/_warnings_off.h | 51 + sdk/tlibstdcxx/stlport/stl/config/_watcom.h | 151 + sdk/tlibstdcxx/stlport/stl/config/_windows.h | 293 + sdk/tlibstdcxx/stlport/stl/config/compat.h | 80 + sdk/tlibstdcxx/stlport/stl/config/features.h | 1084 ++ sdk/tlibstdcxx/stlport/stl/config/host.h | 342 + .../stlport/stl/config/stl_confix.h | 97 + .../stlport/stl/config/stl_mycomp.h | 282 + .../stlport/stl/config/user_config.h | 326 + sdk/tlibstdcxx/stlport/stl/debug/_debug.c | 628 ++ sdk/tlibstdcxx/stlport/stl/debug/_debug.h | 473 + sdk/tlibstdcxx/stlport/stl/debug/_deque.h | 414 + sdk/tlibstdcxx/stlport/stl/debug/_hashtable.h | 340 + sdk/tlibstdcxx/stlport/stl/debug/_iterator.h | 457 + sdk/tlibstdcxx/stlport/stl/debug/_list.h | 495 + sdk/tlibstdcxx/stlport/stl/debug/_slist.h | 613 ++ sdk/tlibstdcxx/stlport/stl/debug/_string.h | 828 ++ .../stlport/stl/debug/_string_sum_methods.h | 111 + sdk/tlibstdcxx/stlport/stl/debug/_tree.h | 317 + sdk/tlibstdcxx/stlport/stl/debug/_vector.h | 425 + sdk/tlibstdcxx/stlport/stl/msl_string.h | 47 + sdk/tlibstdcxx/stlport/stl/pointers/_deque.h | 390 + sdk/tlibstdcxx/stlport/stl/pointers/_list.h | 345 + sdk/tlibstdcxx/stlport/stl/pointers/_set.h | 564 + sdk/tlibstdcxx/stlport/stl/pointers/_slist.h | 427 + sdk/tlibstdcxx/stlport/stl/pointers/_tools.h | 471 + sdk/tlibstdcxx/stlport/stl/pointers/_vector.h | 243 + sdk/tlibstdcxx/stlport/stl/type_manips.h | 321 + sdk/tlibstdcxx/stlport/stl/type_traits.h | 626 ++ sdk/tlibstdcxx/stlport/string | 59 + sdk/tlibstdcxx/stlport/string.h | 66 + sdk/tlibstdcxx/stlport/time.h | 44 + sdk/tlibstdcxx/stlport/type_traits | 798 ++ sdk/tlibstdcxx/stlport/typeinfo | 53 + sdk/tlibstdcxx/stlport/typeinfo.h | 87 + sdk/tlibstdcxx/stlport/unordered_map | 39 + sdk/tlibstdcxx/stlport/unordered_set | 39 + sdk/tlibstdcxx/stlport/using/cstring | 73 + sdk/tlibstdcxx/stlport/using/export | 12 + sdk/tlibstdcxx/stlport/using/fstream | 19 + sdk/tlibstdcxx/stlport/using/h/fstream.h | 4 + sdk/tlibstdcxx/stlport/using/h/iomanip.h | 6 + sdk/tlibstdcxx/stlport/using/h/iostream.h | 24 + sdk/tlibstdcxx/stlport/using/h/ostream.h | 6 + sdk/tlibstdcxx/stlport/using/h/streambuf.h | 1 + sdk/tlibstdcxx/stlport/using/h/strstream.h | 4 + sdk/tlibstdcxx/stlport/using/iomanip | 6 + sdk/tlibstdcxx/stlport/using/ios | 41 + sdk/tlibstdcxx/stlport/using/iosfwd | 54 + sdk/tlibstdcxx/stlport/using/iostream | 14 + sdk/tlibstdcxx/stlport/using/istream | 16 + sdk/tlibstdcxx/stlport/using/locale | 65 + sdk/tlibstdcxx/stlport/using/ostream | 10 + sdk/tlibstdcxx/stlport/using/sstream | 16 + sdk/tlibstdcxx/stlport/using/streambuf | 5 + sdk/tlibstdcxx/stlport/using/strstream | 4 + sdk/tlibstdcxx/stlport/utility | 60 + sdk/tlibstdcxx/stlport/valarray | 51 + sdk/tlibstdcxx/stlport/vector | 59 + sdk/tlibstdcxx/stlport/wchar.h | 64 + sdk/tlibstdcxx/stlport/wctype.h | 47 + sdk/tlibthread/Makefile | 62 + sdk/tlibthread/sethread_cond.cpp | 162 + sdk/tlibthread/sethread_internal.h | 96 + sdk/tlibthread/sethread_mutex.cpp | 227 + sdk/tlibthread/sethread_utils.cpp | 44 + sdk/trts/Makefile | 66 + sdk/trts/init_enclave.cpp | 137 + sdk/trts/init_optimized_lib.cpp | 126 + sdk/trts/init_optimized_lib.h | 49 + sdk/trts/linux/Makefile | 91 + sdk/trts/linux/elf_parser.c | 419 + sdk/trts/linux/elf_parser.h | 59 + sdk/trts/linux/global_init.c | 95 + sdk/trts/linux/metadata_sec.S | 42 + sdk/trts/linux/tls_support.c | 55 + sdk/trts/linux/trts_pic.S | 494 + sdk/trts/linux/trts_pic.h | 113 + sdk/trts/linux/x86/Makefile | 45 + sdk/trts/linux/x86/setcontext.S | 66 + sdk/trts/linux/x86_64/Makefile | 46 + sdk/trts/linux/x86_64/setcontext.S | 117 + sdk/trts/trts.cpp | 323 + sdk/trts/trts_ecall.cpp | 189 + sdk/trts/trts_internal.h | 79 + sdk/trts/trts_ocall.cpp | 143 + sdk/trts/trts_util.cpp | 55 + sdk/trts/trts_util.h | 52 + sdk/trts/trts_veh.cpp | 395 + sdk/trts/trts_version.cpp | 48 + sdk/trts/trts_xsave.cpp | 112 + sdk/tseal/linux/Makefile | 60 + sdk/tseal/tSeal.cpp | 237 + sdk/tseal/tSeal_aad.cpp | 218 + sdk/tseal/tSeal_internal.cpp | 157 + sdk/tseal/tSeal_internal.h | 61 + sdk/tseal/tSeal_util.cpp | 63 + sdk/ukey_exchange/Makefile | 70 + sdk/ukey_exchange/ukey_exchange.cpp | 210 + sdk/ukey_exchange/ukey_exchange_version.cpp | 48 + 2767 files changed, 820699 insertions(+) create mode 100755 Linux_SGXEclipsePlugin/build.sh create mode 100644 Linux_SGXEclipsePlugin/build_config/allElements.xml create mode 100644 Linux_SGXEclipsePlugin/build_config/build.properties create mode 100644 Linux_SGXEclipsePlugin/build_config/buildUpdateSite.xml create mode 100644 Linux_SGXEclipsePlugin/build_config/customAssembly.xml create mode 100644 Linux_SGXEclipsePlugin/build_config/customTargets.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/.project create mode 100644 Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/build.properties create mode 100644 Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/feature.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.classpath create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.project create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/META-INF/MANIFEST.MF create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/build.properties create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/A_Generated_Trusted_Library.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_New_Intel_SGX_Enclave_Dialog.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_New_SGX_Static_Trusted_Library_Dialog.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_Repository_Dialog.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_SGX_Nature.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_SGX_Untrusted_Module.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Configurations_Specific_to_Intel_SGX_Technology.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Configure_SGX_Hardware_Release_Mode.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Copying_the_Untrusted_Module_to_a_Project.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Customization_of_SGX_build_command.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Down_Arrow_Button.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Enclave_Configuration_Settings.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generate_Signed_Enclave_Dialog.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generate_Signed_Enclave_Dialog_with_Pre_configurations.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generated_Sample_Untrusted_Application.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generated_Skeleton_for_an_Enclave.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generating_Hash_Completion_Dialog.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Import_or_Re_Generate_Enclave_Signing_Key.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Intel_SGX_Configurations.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Intel_SGX_Tools.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Makefile_for_Intel_SGX.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/New_Project.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Project_Explorer.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Project_Menu.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/SGX_Preference_Page.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Sample_Application.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Select_Configuration_File.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/The_Location_of_the_Plugin_zip_Archive.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/The_Result_of_Running_Samples_Generated_for_Enclaves.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Two_StepSigne_Enclave_Generate_Hash.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Two_Step_Sign_Enclave_Menu.png create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/PageLayouts/Default.flpgl create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/plugin.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/src/com/intel/sgx/userguide/Activator.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.classpath create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.project create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.settings/org.eclipse.jdt.core.prefs create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/META-INF/MANIFEST.MF create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/OSGI-INF/l10n/bundle.properties create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/build.properties create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.c create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.cpp create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/plugin.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Activator.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/CConfigurationDataProvider2.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Messages.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/SdkPathVariableProvider.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/build/SGXSDKCommandLauncher.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddEnclaveFileDialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddTrustedStaticLibFileDialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddUntrustedModuleDialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/EnclaveConfigDialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/RemoveEnclaveFileDialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/SGXDialogBase.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignDialogBase.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog1.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog2.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog3.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep2Dialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/UpdateSignKeyDialog.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveredPathInfo.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveryUpdater.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKScannerInfoCollector.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddEnclave.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddSGXNature.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddTrustedStaticLib.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddUntrustedModule.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/EnclaveConfigHandler.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/ModuleCreationBaseHandler.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/RemoveEnclave.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXHandler.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXSDKWizardHandler.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignHandlerBase.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep1.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep2.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/UpdateSigningKey.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/about.html create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/messages.properties create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXCCNature.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXNature.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXStaticCCNature.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/ISDKDescriptor.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceConstants.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceInitializer.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/SGXPreferencePage.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/CreateNativeFolders.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetCCNature.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetStaticCCNature.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/testers/SGXPropertyTester.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCCProjectWizard.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCProjectWizard.java create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGX.gif create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/enclavetemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/trustedstatictemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/untrusted_module_template.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/with_sample/enclavetemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/enclavetemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/trustedstatictemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/untrusted_module_template.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/with_sample/enclavetemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/common/addnaturetemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/configtemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/ctemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxstaticlibtemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxtemplate.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/template.properties create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/newmngc_app.gif create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/newmngcc_app.gif create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename.config.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename_private.pem create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_t.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.without_app.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_t.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.without_app.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/common/Makefile create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.cpp create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.edl create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.h create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.lds create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.cpp create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.edl create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_private.pem create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.cpp create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.h create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXNature/Makefile create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_u.without_app.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_u.without_app.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile.without_app create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.cpp create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.edl create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c++/sgx_u.without_app.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c/sgx_u.without_app.mk create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/common/Makefile create mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/untrusted/untrusted_module.cpp create mode 100644 Linux_SGXEclipsePlugin/build_directory/sites/site.xml create mode 100755 Linux_SGXEclipsePlugin/clean.sh create mode 100644 Linux_SGXEclipsePlugin/readme.txt create mode 100644 Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy create mode 100644 Makefile create mode 100644 SampleCode/LocalAttestation/.cproject create mode 100644 SampleCode/LocalAttestation/.project create mode 100644 SampleCode/LocalAttestation/App/App.cpp create mode 100644 SampleCode/LocalAttestation/Enclave1/Enclave1.config.xml create mode 100644 SampleCode/LocalAttestation/Enclave1/Enclave1.cpp create mode 100644 SampleCode/LocalAttestation/Enclave1/Enclave1.edl create mode 100644 SampleCode/LocalAttestation/Enclave1/Enclave1_private.pem create mode 100644 SampleCode/LocalAttestation/Enclave1/Utility_E1.cpp create mode 100644 SampleCode/LocalAttestation/Enclave1/Utility_E1.h create mode 100644 SampleCode/LocalAttestation/Enclave2/Enclave2.config.xml create mode 100644 SampleCode/LocalAttestation/Enclave2/Enclave2.cpp create mode 100644 SampleCode/LocalAttestation/Enclave2/Enclave2.edl create mode 100644 SampleCode/LocalAttestation/Enclave2/Enclave2_private.pem create mode 100644 SampleCode/LocalAttestation/Enclave2/Utility_E2.cpp create mode 100644 SampleCode/LocalAttestation/Enclave2/Utility_E2.h create mode 100644 SampleCode/LocalAttestation/Enclave3/Enclave3.config.xml create mode 100644 SampleCode/LocalAttestation/Enclave3/Enclave3.cpp create mode 100644 SampleCode/LocalAttestation/Enclave3/Enclave3.edl create mode 100644 SampleCode/LocalAttestation/Enclave3/Enclave3_private.pem create mode 100644 SampleCode/LocalAttestation/Enclave3/Utility_E3.cpp create mode 100644 SampleCode/LocalAttestation/Enclave3/Utility_E3.h create mode 100644 SampleCode/LocalAttestation/Include/dh_session_protocol.h create mode 100644 SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.cpp create mode 100644 SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.h create mode 100644 SampleCode/LocalAttestation/LocalAttestationCode/LocalAttestationCode.edl create mode 100644 SampleCode/LocalAttestation/LocalAttestationCode/datatypes.h create mode 100644 SampleCode/LocalAttestation/LocalAttestationCode/error_codes.h create mode 100644 SampleCode/LocalAttestation/Makefile create mode 100644 SampleCode/LocalAttestation/README.txt create mode 100644 SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.cpp create mode 100644 SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.h create mode 100644 SampleCode/PowerTransition/.cproject create mode 100644 SampleCode/PowerTransition/.project create mode 100644 SampleCode/PowerTransition/App/App.cpp create mode 100644 SampleCode/PowerTransition/App/ErrorSupport.cpp create mode 100644 SampleCode/PowerTransition/App/ErrorSupport.h create mode 100644 SampleCode/PowerTransition/App/rwlock.cpp create mode 100644 SampleCode/PowerTransition/App/rwlock.h create mode 100644 SampleCode/PowerTransition/Common/types.h create mode 100644 SampleCode/PowerTransition/Enclave/Enclave.config.xml create mode 100644 SampleCode/PowerTransition/Enclave/Enclave.cpp create mode 100644 SampleCode/PowerTransition/Enclave/Enclave.edl create mode 100644 SampleCode/PowerTransition/Enclave/Enclave.lds create mode 100644 SampleCode/PowerTransition/Enclave/Enclave_private.pem create mode 100644 SampleCode/PowerTransition/Makefile create mode 100644 SampleCode/PowerTransition/README.txt create mode 100644 SampleCode/RemoteAttestation/.cproject create mode 100644 SampleCode/RemoteAttestation/.project create mode 100644 SampleCode/RemoteAttestation/Makefile create mode 100644 SampleCode/RemoteAttestation/README.txt create mode 100644 SampleCode/RemoteAttestation/isv_app/isv_app.cpp create mode 100644 SampleCode/RemoteAttestation/isv_app/sample_messages.h create mode 100644 SampleCode/RemoteAttestation/isv_enclave/isv_enclave.config.xml create mode 100644 SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp create mode 100644 SampleCode/RemoteAttestation/isv_enclave/isv_enclave.edl create mode 100644 SampleCode/RemoteAttestation/isv_enclave/isv_enclave.lds create mode 100644 SampleCode/RemoteAttestation/isv_enclave/isv_enclave_private.pem create mode 100644 SampleCode/RemoteAttestation/service_provider/ecp.cpp create mode 100644 SampleCode/RemoteAttestation/service_provider/ecp.h create mode 100644 SampleCode/RemoteAttestation/service_provider/ias_ra.cpp create mode 100644 SampleCode/RemoteAttestation/service_provider/ias_ra.h create mode 100644 SampleCode/RemoteAttestation/service_provider/network_ra.cpp create mode 100644 SampleCode/RemoteAttestation/service_provider/network_ra.h create mode 100644 SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h create mode 100644 SampleCode/RemoteAttestation/service_provider/service_provider.cpp create mode 100644 SampleCode/RemoteAttestation/service_provider/service_provider.h create mode 100644 SampleCode/SampleEnclave/.cproject create mode 100644 SampleCode/SampleEnclave/.project create mode 100644 SampleCode/SampleEnclave/App/App.cpp create mode 100644 SampleCode/SampleEnclave/App/App.h create mode 100644 SampleCode/SampleEnclave/App/Edger8rSyntax/Arrays.cpp create mode 100644 SampleCode/SampleEnclave/App/Edger8rSyntax/Functions.cpp create mode 100644 SampleCode/SampleEnclave/App/Edger8rSyntax/Pointers.cpp create mode 100644 SampleCode/SampleEnclave/App/Edger8rSyntax/Types.cpp create mode 100644 SampleCode/SampleEnclave/App/TrustedLibrary/Libc.cpp create mode 100644 SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp create mode 100644 SampleCode/SampleEnclave/App/TrustedLibrary/Thread.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.edl create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.edl create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.edl create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.edl create mode 100644 SampleCode/SampleEnclave/Enclave/Enclave.config.xml create mode 100644 SampleCode/SampleEnclave/Enclave/Enclave.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/Enclave.edl create mode 100644 SampleCode/SampleEnclave/Enclave/Enclave.h create mode 100644 SampleCode/SampleEnclave/Enclave/Enclave.lds create mode 100644 SampleCode/SampleEnclave/Enclave/Enclave_private.pem create mode 100644 SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.edl create mode 100644 SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl create mode 100644 SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.cpp create mode 100644 SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.edl create mode 100644 SampleCode/SampleEnclave/Include/user_types.h create mode 100644 SampleCode/SampleEnclave/Makefile create mode 100644 SampleCode/SampleEnclave/README.txt create mode 100644 build-scripts/enclave.lds create mode 100644 buildenv.mk create mode 100644 common/inc/internal/ae_ipp.h create mode 100644 common/inc/internal/arch.h create mode 100644 common/inc/internal/cpprt_internal.h create mode 100644 common/inc/internal/cpputil.h create mode 100644 common/inc/internal/cpuid.h create mode 100644 common/inc/internal/dh.h create mode 100644 common/inc/internal/driver_api.h create mode 100644 common/inc/internal/ecp_interface.h create mode 100644 common/inc/internal/elf_util.h create mode 100644 common/inc/internal/elfheader/README.txt create mode 100644 common/inc/internal/elfheader/elf_common.h create mode 100644 common/inc/internal/elfheader/elfstructs.h create mode 100644 common/inc/internal/enclave_creator.h create mode 100644 common/inc/internal/global_data.h create mode 100644 common/inc/internal/global_init.h create mode 100644 common/inc/internal/inst.h create mode 100644 common/inc/internal/ipp_wrapper.h create mode 100644 common/inc/internal/linux/cpuid_gnu.h create mode 100644 common/inc/internal/linux/linux-regs.h create mode 100644 common/inc/internal/linux/xsave_gnu.h create mode 100644 common/inc/internal/metadata.h create mode 100644 common/inc/internal/oal/uae_oal_api.h create mode 100644 common/inc/internal/routine.h create mode 100644 common/inc/internal/rts.h create mode 100644 common/inc/internal/rts_cmd.h create mode 100644 common/inc/internal/se_atomic.h create mode 100644 common/inc/internal/se_cdefs.h create mode 100644 common/inc/internal/se_cpu_feature.h create mode 100644 common/inc/internal/se_cpu_feature_defs.h create mode 100644 common/inc/internal/se_debugger_lib.h create mode 100644 common/inc/internal/se_enclave_type.h create mode 100644 common/inc/internal/se_error_internal.h create mode 100644 common/inc/internal/se_event.h create mode 100644 common/inc/internal/se_lock.hpp create mode 100644 common/inc/internal/se_macro.h create mode 100644 common/inc/internal/se_map.h create mode 100644 common/inc/internal/se_memcpy.h create mode 100644 common/inc/internal/se_memory.h create mode 100644 common/inc/internal/se_page_attr.h create mode 100644 common/inc/internal/se_quote_internal.h create mode 100644 common/inc/internal/se_rwlock.h create mode 100644 common/inc/internal/se_stdio.h create mode 100644 common/inc/internal/se_string.h create mode 100644 common/inc/internal/se_thread.h create mode 100644 common/inc/internal/se_time.h create mode 100644 common/inc/internal/se_trace.h create mode 100644 common/inc/internal/se_types.h create mode 100644 common/inc/internal/se_vendor.h create mode 100644 common/inc/internal/se_version.h create mode 100644 common/inc/internal/se_wrapper.h create mode 100644 common/inc/internal/sgx_memset_s.h create mode 100644 common/inc/internal/sgx_profile.h create mode 100644 common/inc/internal/sgx_read_rand.h create mode 100644 common/inc/internal/sgx_tcrypto_internal.h create mode 100644 common/inc/internal/tae_service_internal.h create mode 100644 common/inc/internal/thread_data.h create mode 100644 common/inc/internal/trts_inst.h create mode 100644 common/inc/internal/uae_service_internal.h create mode 100644 common/inc/internal/uncopyable.h create mode 100644 common/inc/internal/util.h create mode 100644 common/inc/internal/xsave.h create mode 100644 common/inc/sgx.h create mode 100644 common/inc/sgx_attributes.h create mode 100644 common/inc/sgx_cpuid.h create mode 100644 common/inc/sgx_defs.h create mode 100644 common/inc/sgx_dh.h create mode 100644 common/inc/sgx_ecp_types.h create mode 100644 common/inc/sgx_edger8r.h create mode 100644 common/inc/sgx_eid.h create mode 100644 common/inc/sgx_error.h create mode 100644 common/inc/sgx_intrin.h create mode 100644 common/inc/sgx_key.h create mode 100644 common/inc/sgx_key_exchange.h create mode 100644 common/inc/sgx_quote.h create mode 100644 common/inc/sgx_report.h create mode 100644 common/inc/sgx_sha256_128.h create mode 100644 common/inc/sgx_spinlock.h create mode 100644 common/inc/sgx_tae_service.edl create mode 100644 common/inc/sgx_tae_service.h create mode 100644 common/inc/sgx_tcrypto.h create mode 100644 common/inc/sgx_thread.h create mode 100644 common/inc/sgx_tkey_exchange.edl create mode 100644 common/inc/sgx_tkey_exchange.h create mode 100644 common/inc/sgx_trts.h create mode 100644 common/inc/sgx_trts_exception.h create mode 100644 common/inc/sgx_tseal.h create mode 100644 common/inc/sgx_tstdc.edl create mode 100644 common/inc/sgx_uae_service.h create mode 100644 common/inc/sgx_ukey_exchange.h create mode 100644 common/inc/sgx_urts.h create mode 100644 common/inc/sgx_utils.h create mode 100644 common/inc/stdc++/exception create mode 100644 common/inc/stdc++/linux/exception create mode 100644 common/inc/stdc++/linux/typeinfo create mode 100644 common/inc/stdc++/new create mode 100644 common/inc/stdc++/typeinfo create mode 100644 common/inc/tlibc/assert.h create mode 100644 common/inc/tlibc/complex.h create mode 100644 common/inc/tlibc/ctype.h create mode 100644 common/inc/tlibc/endian.h create mode 100644 common/inc/tlibc/errno.h create mode 100644 common/inc/tlibc/float.h create mode 100644 common/inc/tlibc/inttypes.h create mode 100644 common/inc/tlibc/iso646.h create mode 100644 common/inc/tlibc/limits.h create mode 100644 common/inc/tlibc/math.h create mode 100644 common/inc/tlibc/stdarg.h create mode 100644 common/inc/tlibc/stdbool.h create mode 100644 common/inc/tlibc/stddef.h create mode 100644 common/inc/tlibc/stdint.h create mode 100644 common/inc/tlibc/stdio.h create mode 100644 common/inc/tlibc/stdlib.h create mode 100644 common/inc/tlibc/string.h create mode 100644 common/inc/tlibc/sys/_types.h create mode 100644 common/inc/tlibc/sys/cdefs.h create mode 100644 common/inc/tlibc/sys/endian.h create mode 100644 common/inc/tlibc/sys/ieee.h create mode 100644 common/inc/tlibc/sys/limits.h create mode 100644 common/inc/tlibc/sys/stdint.h create mode 100644 common/inc/tlibc/sys/types.h create mode 100644 common/inc/tlibc/time.h create mode 100644 common/inc/tlibc/unistd.h create mode 100644 common/inc/tlibc/wchar.h create mode 100644 common/inc/tlibc/wctype.h create mode 100644 common/se_wrapper/Makefile create mode 100644 common/src/dh.cpp create mode 100644 common/src/ecp.cpp create mode 100644 common/src/ipp_bn.cpp create mode 100644 common/src/ipp_rsa_key.cpp create mode 100644 common/src/ipp_rsa_pub_key.cpp create mode 100644 common/src/se_event.c create mode 100644 common/src/se_map.c create mode 100644 common/src/se_memory.c create mode 100644 common/src/se_rwlock.c create mode 100644 common/src/se_thread.c create mode 100644 common/src/se_time.c create mode 100644 common/src/se_trace.c create mode 100644 common/src/sgx_memset_s.cpp create mode 100644 common/src/sgx_profile.cpp create mode 100644 common/src/sgx_read_rand.cpp create mode 100644 common/src/sgx_sha256_128.cpp create mode 100755 download_prebuilt.sh create mode 100644 external/crypto_px/Makefile create mode 100755 external/crypto_px/include/ippbase.h create mode 100755 external/crypto_px/include/ippcore.h create mode 100755 external/crypto_px/include/ippcp.h create mode 100755 external/crypto_px/include/ippcpdefs.h create mode 100755 external/crypto_px/include/ippdefs.h create mode 100755 external/crypto_px/include/ipptypes.h create mode 100755 external/crypto_px/include/ippversion.h create mode 100644 external/crypto_px/sources/include/cpudef.h create mode 100644 external/crypto_px/sources/include/ippver.gen create mode 100644 external/crypto_px/sources/include/ippver.h create mode 100644 external/crypto_px/sources/include/ippverstr.gen create mode 100644 external/crypto_px/sources/include/owndefs.h create mode 100644 external/crypto_px/sources/ippcp/src/owncp.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesauthgcm.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesm.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesmctrca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpaesminitca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbn.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnresource.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnresourceca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnsetca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnu32arith.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnu32arith.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnu32misc.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnu32misc.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnuarith.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnuarith.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnuimpl.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnumisc.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpbnumisc.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpcmac.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccp.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpdpca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpinitca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpmethod.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpmethodcom.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpmethodcomca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccppoint.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccppointca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccppointopca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpsscm.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpsscm.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpstdca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpeccpverifydsaca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphash.h create mode 100644 external/crypto_px/sources/ippcp/src/pcphashca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphashcnt.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphashmd5px.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphashsha1px.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphashsha256px.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphashsha512px.c create mode 100644 external/crypto_px/sources/ippcp/src/pcphmac.h create mode 100644 external/crypto_px/sources/ippcp/src/pcphmacca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpmontgomery.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpmontred.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpname.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsa.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcppma.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpprimeg.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpprimegenca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpprimeginitca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpprng.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpprngenca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpprnginitca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcprij.h create mode 100644 external/crypto_px/sources/ippcp/src/pcprij128safe2.h create mode 100644 external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcprijdecsboxca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcprijencsboxca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcprijkeysca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcprijtables.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpscramble.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpshsmgfca.c create mode 100644 external/crypto_px/sources/ippcp/src/pcptool.h create mode 100644 external/crypto_px/sources/ippcp/src/pcpver.c create mode 100644 external/crypto_px/sources/ippcp/src/pcpver.h create mode 100644 external/epid/inc/epid_types.h create mode 100644 external/rdrand/rdrand.h create mode 100644 external/rdrand/src/Makefile.in create mode 100644 external/rdrand/src/README create mode 100644 external/rdrand/src/config.h.in create mode 100755 external/rdrand/src/configure create mode 100644 external/rdrand/src/configure.ac create mode 100644 external/rdrand/src/main.c create mode 100644 external/rdrand/src/rdrand.c create mode 100644 external/rdrand/src/rdrand.h create mode 100644 external/sgx_libm/ia32/acos_wmt.S create mode 100644 external/sgx_libm/ia32/acosf_wmt.S create mode 100644 external/sgx_libm/ia32/acosh_wmt.S create mode 100644 external/sgx_libm/ia32/acoshf_wmt.S create mode 100644 external/sgx_libm/ia32/acoshl.S create mode 100644 external/sgx_libm/ia32/acosl.S create mode 100644 external/sgx_libm/ia32/asin_wmt.S create mode 100644 external/sgx_libm/ia32/asinf_wmt.S create mode 100644 external/sgx_libm/ia32/asinh_wmt.S create mode 100644 external/sgx_libm/ia32/asinhf_wmt.S create mode 100644 external/sgx_libm/ia32/asinhl.S create mode 100644 external/sgx_libm/ia32/asinl.S create mode 100644 external/sgx_libm/ia32/atan2_wmt.S create mode 100644 external/sgx_libm/ia32/atan2dl.S create mode 100644 external/sgx_libm/ia32/atan2f_wmt.S create mode 100644 external/sgx_libm/ia32/atan2l.S create mode 100644 external/sgx_libm/ia32/atan_wmt.S create mode 100644 external/sgx_libm/ia32/atandl_table.S create mode 100644 external/sgx_libm/ia32/atanf_wmt.S create mode 100644 external/sgx_libm/ia32/atanh_wmt.S create mode 100644 external/sgx_libm/ia32/atanhf_wmt.S create mode 100644 external/sgx_libm/ia32/atanhl.S create mode 100644 external/sgx_libm/ia32/atanl.S create mode 100644 external/sgx_libm/ia32/atanl_table.S create mode 100644 external/sgx_libm/ia32/cabs.S create mode 100644 external/sgx_libm/ia32/cabsf.S create mode 100644 external/sgx_libm/ia32/cabsl.S create mode 100644 external/sgx_libm/ia32/cacos.S create mode 100644 external/sgx_libm/ia32/cacosf.S create mode 100644 external/sgx_libm/ia32/cacosh.S create mode 100644 external/sgx_libm/ia32/cacoshf.S create mode 100644 external/sgx_libm/ia32/cacoshl.S create mode 100644 external/sgx_libm/ia32/cacosl.S create mode 100644 external/sgx_libm/ia32/carg.S create mode 100644 external/sgx_libm/ia32/cargf.S create mode 100644 external/sgx_libm/ia32/cargl.S create mode 100644 external/sgx_libm/ia32/casin.S create mode 100644 external/sgx_libm/ia32/casinh.S create mode 100644 external/sgx_libm/ia32/casinhf.S create mode 100644 external/sgx_libm/ia32/casinhl.S create mode 100644 external/sgx_libm/ia32/casinl.S create mode 100644 external/sgx_libm/ia32/catan.S create mode 100644 external/sgx_libm/ia32/catanh.S create mode 100644 external/sgx_libm/ia32/catanhf.S create mode 100644 external/sgx_libm/ia32/catanhl.S create mode 100644 external/sgx_libm/ia32/catanl.S create mode 100644 external/sgx_libm/ia32/cbrt_wmt.S create mode 100644 external/sgx_libm/ia32/cbrtf_wmt.S create mode 100644 external/sgx_libm/ia32/cbrtl.S create mode 100644 external/sgx_libm/ia32/cbrtl_table.S create mode 100644 external/sgx_libm/ia32/ccos.S create mode 100644 external/sgx_libm/ia32/ccosh.S create mode 100644 external/sgx_libm/ia32/ccoshf.S create mode 100644 external/sgx_libm/ia32/ccoshl.S create mode 100644 external/sgx_libm/ia32/ccosl.S create mode 100644 external/sgx_libm/ia32/ceil_wmt.S create mode 100644 external/sgx_libm/ia32/ceilf_gen.S create mode 100644 external/sgx_libm/ia32/ceill.S create mode 100644 external/sgx_libm/ia32/cexp_gen.S create mode 100644 external/sgx_libm/ia32/cexpf_gen.S create mode 100644 external/sgx_libm/ia32/cexpl.S create mode 100644 external/sgx_libm/ia32/cimag.S create mode 100644 external/sgx_libm/ia32/cimagf.S create mode 100644 external/sgx_libm/ia32/cimagl.S create mode 100644 external/sgx_libm/ia32/clog10.S create mode 100644 external/sgx_libm/ia32/clog10l.S create mode 100644 external/sgx_libm/ia32/clog_gen.S create mode 100644 external/sgx_libm/ia32/clogf_wmt.S create mode 100644 external/sgx_libm/ia32/clogl.S create mode 100644 external/sgx_libm/ia32/complex_real.S create mode 100644 external/sgx_libm/ia32/conj.S create mode 100644 external/sgx_libm/ia32/conjf.S create mode 100644 external/sgx_libm/ia32/conjl.S create mode 100644 external/sgx_libm/ia32/copysign_wmt.S create mode 100644 external/sgx_libm/ia32/copysignf_wmt.S create mode 100644 external/sgx_libm/ia32/copysignl.S create mode 100644 external/sgx_libm/ia32/cos_wmt.S create mode 100644 external/sgx_libm/ia32/cosdl.S create mode 100644 external/sgx_libm/ia32/cosf_wmt.S create mode 100644 external/sgx_libm/ia32/cosh_wmt.S create mode 100644 external/sgx_libm/ia32/coshf_wmt.S create mode 100644 external/sgx_libm/ia32/coshl.S create mode 100644 external/sgx_libm/ia32/cosl.S create mode 100644 external/sgx_libm/ia32/cpow.S create mode 100644 external/sgx_libm/ia32/cpowl.S create mode 100644 external/sgx_libm/ia32/cproj.S create mode 100644 external/sgx_libm/ia32/cprojf.S create mode 100644 external/sgx_libm/ia32/cprojl.S create mode 100644 external/sgx_libm/ia32/creal.S create mode 100644 external/sgx_libm/ia32/crealf.S create mode 100644 external/sgx_libm/ia32/creall.S create mode 100644 external/sgx_libm/ia32/csin.S create mode 100644 external/sgx_libm/ia32/csinh.S create mode 100644 external/sgx_libm/ia32/csinhf.S create mode 100644 external/sgx_libm/ia32/csinhl.S create mode 100644 external/sgx_libm/ia32/csinl.S create mode 100644 external/sgx_libm/ia32/csqrt_wmt.S create mode 100644 external/sgx_libm/ia32/csqrtf_wmt.S create mode 100644 external/sgx_libm/ia32/csqrtl.S create mode 100644 external/sgx_libm/ia32/ctan.S create mode 100644 external/sgx_libm/ia32/ctanh.S create mode 100644 external/sgx_libm/ia32/ctanhf.S create mode 100644 external/sgx_libm/ia32/ctanhl.S create mode 100644 external/sgx_libm/ia32/ctanl.S create mode 100644 external/sgx_libm/ia32/dpml_ux_bessel.S create mode 100644 external/sgx_libm/ia32/dpml_ux_log.S create mode 100644 external/sgx_libm/ia32/dpml_ux_ops.S create mode 100644 external/sgx_libm/ia32/dpml_ux_ops_64.S create mode 100644 external/sgx_libm/ia32/dpml_ux_sqrt.S create mode 100644 external/sgx_libm/ia32/dpml_ux_trig.S create mode 100644 external/sgx_libm/ia32/erf.S create mode 100644 external/sgx_libm/ia32/erfc.S create mode 100644 external/sgx_libm/ia32/erfcf.S create mode 100644 external/sgx_libm/ia32/erfcl.S create mode 100644 external/sgx_libm/ia32/erff.S create mode 100644 external/sgx_libm/ia32/erfl.S create mode 100644 external/sgx_libm/ia32/exp10_wmt.S create mode 100644 external/sgx_libm/ia32/exp10f_wmt.S create mode 100644 external/sgx_libm/ia32/exp10l.S create mode 100644 external/sgx_libm/ia32/exp2_wmt.S create mode 100644 external/sgx_libm/ia32/exp2f_wmt.S create mode 100644 external/sgx_libm/ia32/exp2l.S create mode 100644 external/sgx_libm/ia32/exp_table.S create mode 100644 external/sgx_libm/ia32/exp_wmt.S create mode 100644 external/sgx_libm/ia32/expf_wmt.S create mode 100644 external/sgx_libm/ia32/expl.S create mode 100644 external/sgx_libm/ia32/expl_table.S create mode 100644 external/sgx_libm/ia32/expm1_wmt.S create mode 100644 external/sgx_libm/ia32/expm1f_wmt.S create mode 100644 external/sgx_libm/ia32/expm1l.S create mode 100644 external/sgx_libm/ia32/fabs.S create mode 100644 external/sgx_libm/ia32/fabsf.S create mode 100644 external/sgx_libm/ia32/fabsl.S create mode 100644 external/sgx_libm/ia32/fdim_wmt.S create mode 100644 external/sgx_libm/ia32/fdimf_wmt.S create mode 100644 external/sgx_libm/ia32/fdiml.S create mode 100644 external/sgx_libm/ia32/feclearexcept.S create mode 100644 external/sgx_libm/ia32/fedisableexcept.S create mode 100644 external/sgx_libm/ia32/feenableexcept.S create mode 100644 external/sgx_libm/ia32/fegetenv.S create mode 100644 external/sgx_libm/ia32/fegetexcept.S create mode 100644 external/sgx_libm/ia32/fegetexceptflag.S create mode 100644 external/sgx_libm/ia32/fegetround.S create mode 100644 external/sgx_libm/ia32/feholdexcept.S create mode 100644 external/sgx_libm/ia32/feraiseexcept.S create mode 100644 external/sgx_libm/ia32/fesetenv.S create mode 100644 external/sgx_libm/ia32/fesetexceptflag.S create mode 100644 external/sgx_libm/ia32/fesetround.S create mode 100644 external/sgx_libm/ia32/fetestexcept.S create mode 100644 external/sgx_libm/ia32/feupdateenv.S create mode 100644 external/sgx_libm/ia32/floor_wmt.S create mode 100644 external/sgx_libm/ia32/floorf_gen.S create mode 100644 external/sgx_libm/ia32/floorl.S create mode 100644 external/sgx_libm/ia32/fma.S create mode 100644 external/sgx_libm/ia32/fmaf_wmt.S create mode 100644 external/sgx_libm/ia32/fmal.S create mode 100644 external/sgx_libm/ia32/fmax_wmt.S create mode 100644 external/sgx_libm/ia32/fmaxf_wmt.S create mode 100644 external/sgx_libm/ia32/fmaxl.S create mode 100644 external/sgx_libm/ia32/fmin_wmt.S create mode 100644 external/sgx_libm/ia32/fminf_wmt.S create mode 100644 external/sgx_libm/ia32/fminl.S create mode 100644 external/sgx_libm/ia32/fmod_wmt.S create mode 100644 external/sgx_libm/ia32/fmodf.S create mode 100644 external/sgx_libm/ia32/fmodl.S create mode 100644 external/sgx_libm/ia32/fpclassify.S create mode 100644 external/sgx_libm/ia32/frexp_wmt.S create mode 100644 external/sgx_libm/ia32/frexpf.S create mode 100644 external/sgx_libm/ia32/frexpl.S create mode 100644 external/sgx_libm/ia32/hypot_wmt.S create mode 100644 external/sgx_libm/ia32/hypotf.S create mode 100644 external/sgx_libm/ia32/hypotl.S create mode 100644 external/sgx_libm/ia32/ilogb_wmt.S create mode 100644 external/sgx_libm/ia32/ilogbf.S create mode 100644 external/sgx_libm/ia32/ilogbl.S create mode 100644 external/sgx_libm/ia32/intel_quad_exception.S create mode 100644 external/sgx_libm/ia32/isfinite.S create mode 100644 external/sgx_libm/ia32/isinf.S create mode 100644 external/sgx_libm/ia32/isnan.S create mode 100644 external/sgx_libm/ia32/isnormal.S create mode 100644 external/sgx_libm/ia32/j0.S create mode 100644 external/sgx_libm/ia32/j0f.S create mode 100644 external/sgx_libm/ia32/j0l.S create mode 100644 external/sgx_libm/ia32/j1.S create mode 100644 external/sgx_libm/ia32/j1f.S create mode 100644 external/sgx_libm/ia32/j1l.S create mode 100644 external/sgx_libm/ia32/jn.S create mode 100644 external/sgx_libm/ia32/jnf.S create mode 100644 external/sgx_libm/ia32/jnl.S create mode 100644 external/sgx_libm/ia32/l2q.S create mode 100644 external/sgx_libm/ia32/ldexp_wmt.S create mode 100644 external/sgx_libm/ia32/ldexpf.S create mode 100644 external/sgx_libm/ia32/ldexpl.S create mode 100644 external/sgx_libm/ia32/lgamma.S create mode 100644 external/sgx_libm/ia32/lgammaf.S create mode 100644 external/sgx_libm/ia32/lgammal.S create mode 100644 external/sgx_libm/ia32/libm_atan2l_k80.S create mode 100644 external/sgx_libm/ia32/libm_coshl_k80.S create mode 100644 external/sgx_libm/ia32/libm_cosl_k80.S create mode 100644 external/sgx_libm/ia32/libm_exp_k32.S create mode 100644 external/sgx_libm/ia32/libm_expl_k80.S create mode 100644 external/sgx_libm/ia32/libm_hypot2l_k80.S create mode 100644 external/sgx_libm/ia32/libm_log1pl_k80.S create mode 100644 external/sgx_libm/ia32/libm_log_k32.S create mode 100644 external/sgx_libm/ia32/libm_logl.S create mode 100644 external/sgx_libm/ia32/libm_logl_k80.S create mode 100644 external/sgx_libm/ia32/libm_normalizel_k80.S create mode 100644 external/sgx_libm/ia32/libm_recacoshl_k80.S create mode 100644 external/sgx_libm/ia32/libm_recacosl_recasinl_k80.S create mode 100644 external/sgx_libm/ia32/libm_reduce_pi04d.S create mode 100644 external/sgx_libm/ia32/libm_reduce_pi04l.S create mode 100644 external/sgx_libm/ia32/libm_scalbl_k80.S create mode 100644 external/sgx_libm/ia32/libm_sincos_huge.S create mode 100644 external/sgx_libm/ia32/libm_sincos_k32.S create mode 100644 external/sgx_libm/ia32/libm_sinhl_k80.S create mode 100644 external/sgx_libm/ia32/libm_sinl_k80.S create mode 100644 external/sgx_libm/ia32/libm_strtoull.S create mode 100644 external/sgx_libm/ia32/libm_tancot_huge.S create mode 100644 external/sgx_libm/ia32/llrint.S create mode 100644 external/sgx_libm/ia32/llrintf.S create mode 100644 external/sgx_libm/ia32/llrintl.S create mode 100644 external/sgx_libm/ia32/llround_wmt.S create mode 100644 external/sgx_libm/ia32/llroundf_wmt.S create mode 100644 external/sgx_libm/ia32/llroundl.S create mode 100644 external/sgx_libm/ia32/log10_wmt.S create mode 100644 external/sgx_libm/ia32/log10f_wmt.S create mode 100644 external/sgx_libm/ia32/log10l.S create mode 100644 external/sgx_libm/ia32/log10l_table.S create mode 100644 external/sgx_libm/ia32/log1p_wmt.S create mode 100644 external/sgx_libm/ia32/log1pf_wmt.S create mode 100644 external/sgx_libm/ia32/log1pl.S create mode 100644 external/sgx_libm/ia32/log2_wmt.S create mode 100644 external/sgx_libm/ia32/log2f_wmt.S create mode 100644 external/sgx_libm/ia32/log2l.S create mode 100644 external/sgx_libm/ia32/log2l_table.S create mode 100644 external/sgx_libm/ia32/log_table.S create mode 100644 external/sgx_libm/ia32/log_wmt.S create mode 100644 external/sgx_libm/ia32/logb_wmt.S create mode 100644 external/sgx_libm/ia32/logbf.S create mode 100644 external/sgx_libm/ia32/logbl.S create mode 100644 external/sgx_libm/ia32/logf_table.S create mode 100644 external/sgx_libm/ia32/logf_wmt.S create mode 100644 external/sgx_libm/ia32/logl.S create mode 100644 external/sgx_libm/ia32/logl_table.S create mode 100644 external/sgx_libm/ia32/lrint_wmt.S create mode 100644 external/sgx_libm/ia32/lrintf_wmt.S create mode 100644 external/sgx_libm/ia32/lrintl.S create mode 100644 external/sgx_libm/ia32/lround_wmt.S create mode 100644 external/sgx_libm/ia32/lroundf_wmt.S create mode 100644 external/sgx_libm/ia32/lroundl.S create mode 100644 external/sgx_libm/ia32/modf_wmt.S create mode 100644 external/sgx_libm/ia32/modff.S create mode 100644 external/sgx_libm/ia32/modfl.S create mode 100644 external/sgx_libm/ia32/nan.S create mode 100644 external/sgx_libm/ia32/nearbyint_wmt.S create mode 100644 external/sgx_libm/ia32/nearbyintf_gen.S create mode 100644 external/sgx_libm/ia32/nearbyintl.S create mode 100644 external/sgx_libm/ia32/nextafter_wmt.S create mode 100644 external/sgx_libm/ia32/nextafterf_wmt.S create mode 100644 external/sgx_libm/ia32/nextafterl.S create mode 100644 external/sgx_libm/ia32/nexttoward_wmt.S create mode 100644 external/sgx_libm/ia32/nexttowardf_wmt.S create mode 100644 external/sgx_libm/ia32/nexttowardl.S create mode 100644 external/sgx_libm/ia32/pow_wmt.S create mode 100644 external/sgx_libm/ia32/powf_wmt.S create mode 100644 external/sgx_libm/ia32/powl.S create mode 100644 external/sgx_libm/ia32/q2l.S create mode 100644 external/sgx_libm/ia32/rcp_table.S create mode 100644 external/sgx_libm/ia32/remainder.S create mode 100644 external/sgx_libm/ia32/remainderf.S create mode 100644 external/sgx_libm/ia32/remainderl.S create mode 100644 external/sgx_libm/ia32/remquo.S create mode 100644 external/sgx_libm/ia32/remquof.S create mode 100644 external/sgx_libm/ia32/remquol.S create mode 100644 external/sgx_libm/ia32/rint_gen.S create mode 100644 external/sgx_libm/ia32/rintf_gen.S create mode 100644 external/sgx_libm/ia32/rintl.S create mode 100644 external/sgx_libm/ia32/round_wmt.S create mode 100644 external/sgx_libm/ia32/roundf_wmt.S create mode 100644 external/sgx_libm/ia32/roundl.S create mode 100644 external/sgx_libm/ia32/scalb_wmt.S create mode 100644 external/sgx_libm/ia32/scalbf.S create mode 100644 external/sgx_libm/ia32/scalbl.S create mode 100644 external/sgx_libm/ia32/scalbln_wmt.S create mode 100644 external/sgx_libm/ia32/scalblnf.S create mode 100644 external/sgx_libm/ia32/scalblnl.S create mode 100644 external/sgx_libm/ia32/scalbn_wmt.S create mode 100644 external/sgx_libm/ia32/scalbnf.S create mode 100644 external/sgx_libm/ia32/scalbnl.S create mode 100644 external/sgx_libm/ia32/signbit.S create mode 100644 external/sgx_libm/ia32/significand_wmt.S create mode 100644 external/sgx_libm/ia32/significandf.S create mode 100644 external/sgx_libm/ia32/significandl.S create mode 100644 external/sgx_libm/ia32/sin_wmt.S create mode 100644 external/sgx_libm/ia32/sincos_pi4l.S create mode 100644 external/sgx_libm/ia32/sincos_wmt.S create mode 100644 external/sgx_libm/ia32/sincosdl_table.S create mode 100644 external/sgx_libm/ia32/sincosf_wmt.S create mode 100644 external/sgx_libm/ia32/sincosl.S create mode 100644 external/sgx_libm/ia32/sindl.S create mode 100644 external/sgx_libm/ia32/sinf_wmt.S create mode 100644 external/sgx_libm/ia32/sinh_wmt.S create mode 100644 external/sgx_libm/ia32/sinhcosh_wmt.S create mode 100644 external/sgx_libm/ia32/sinhcoshl.S create mode 100644 external/sgx_libm/ia32/sinhf_wmt.S create mode 100644 external/sgx_libm/ia32/sinhl.S create mode 100644 external/sgx_libm/ia32/sinl.S create mode 100644 external/sgx_libm/ia32/sqrt_tab_t.S create mode 100644 external/sgx_libm/ia32/sqrt_wmt.S create mode 100644 external/sgx_libm/ia32/sqrtf_wmt.S create mode 100644 external/sgx_libm/ia32/sqrtl.S create mode 100644 external/sgx_libm/ia32/tan_wmt.S create mode 100644 external/sgx_libm/ia32/tanf_wmt.S create mode 100644 external/sgx_libm/ia32/tanh_wmt.S create mode 100644 external/sgx_libm/ia32/tanhf_wmt.S create mode 100644 external/sgx_libm/ia32/tanhl.S create mode 100644 external/sgx_libm/ia32/tanl.S create mode 100644 external/sgx_libm/ia32/tgamma.S create mode 100644 external/sgx_libm/ia32/tgammaf.S create mode 100644 external/sgx_libm/ia32/tgammal.S create mode 100644 external/sgx_libm/ia32/trig_pi_bits.S create mode 100644 external/sgx_libm/ia32/trunc_wmt.S create mode 100644 external/sgx_libm/ia32/truncf.S create mode 100644 external/sgx_libm/ia32/truncl.S create mode 100644 external/sgx_libm/ia32/y0.S create mode 100644 external/sgx_libm/ia32/y0f.S create mode 100644 external/sgx_libm/ia32/y0l.S create mode 100644 external/sgx_libm/ia32/y1.S create mode 100644 external/sgx_libm/ia32/y1f.S create mode 100644 external/sgx_libm/ia32/y1l.S create mode 100644 external/sgx_libm/ia32/yn.S create mode 100644 external/sgx_libm/ia32/ynf.S create mode 100644 external/sgx_libm/ia32/ynl.S create mode 100644 external/sgx_libm/intel64/acos.S create mode 100644 external/sgx_libm/intel64/acosf_gen.S create mode 100644 external/sgx_libm/intel64/acosh_gen.S create mode 100644 external/sgx_libm/intel64/acoshf_gen.S create mode 100644 external/sgx_libm/intel64/acoshl.S create mode 100644 external/sgx_libm/intel64/acosl.S create mode 100644 external/sgx_libm/intel64/asin.S create mode 100644 external/sgx_libm/intel64/asinf_gen.S create mode 100644 external/sgx_libm/intel64/asinh_gen.S create mode 100644 external/sgx_libm/intel64/asinhf_gen.S create mode 100644 external/sgx_libm/intel64/asinhl.S create mode 100644 external/sgx_libm/intel64/asinl.S create mode 100644 external/sgx_libm/intel64/atan2.S create mode 100644 external/sgx_libm/intel64/atan2dl.S create mode 100644 external/sgx_libm/intel64/atan2f_gen.S create mode 100644 external/sgx_libm/intel64/atan2l.S create mode 100644 external/sgx_libm/intel64/atan_gen.S create mode 100644 external/sgx_libm/intel64/atandl_table.S create mode 100644 external/sgx_libm/intel64/atanf_gen.S create mode 100644 external/sgx_libm/intel64/atanh_gen.S create mode 100644 external/sgx_libm/intel64/atanhf_gen.S create mode 100644 external/sgx_libm/intel64/atanhl.S create mode 100644 external/sgx_libm/intel64/atanl.S create mode 100644 external/sgx_libm/intel64/atanl_table.S create mode 100644 external/sgx_libm/intel64/cabs.S create mode 100644 external/sgx_libm/intel64/cabsf.S create mode 100644 external/sgx_libm/intel64/cabsl.S create mode 100644 external/sgx_libm/intel64/cacos.S create mode 100644 external/sgx_libm/intel64/cacosh.S create mode 100644 external/sgx_libm/intel64/cacoshl.S create mode 100644 external/sgx_libm/intel64/cacosl.S create mode 100644 external/sgx_libm/intel64/carg.S create mode 100644 external/sgx_libm/intel64/cargf.S create mode 100644 external/sgx_libm/intel64/cargl.S create mode 100644 external/sgx_libm/intel64/casin.S create mode 100644 external/sgx_libm/intel64/casinh.S create mode 100644 external/sgx_libm/intel64/casinhl.S create mode 100644 external/sgx_libm/intel64/casinl.S create mode 100644 external/sgx_libm/intel64/catan.S create mode 100644 external/sgx_libm/intel64/catanh.S create mode 100644 external/sgx_libm/intel64/catanhl.S create mode 100644 external/sgx_libm/intel64/catanl.S create mode 100644 external/sgx_libm/intel64/cbrt_gen.S create mode 100644 external/sgx_libm/intel64/cbrtf_gen.S create mode 100644 external/sgx_libm/intel64/cbrtl.S create mode 100644 external/sgx_libm/intel64/cbrtl_table.S create mode 100644 external/sgx_libm/intel64/ccos.S create mode 100644 external/sgx_libm/intel64/ccosh.S create mode 100644 external/sgx_libm/intel64/ccoshl.S create mode 100644 external/sgx_libm/intel64/ccosl.S create mode 100644 external/sgx_libm/intel64/ceil_gen.S create mode 100644 external/sgx_libm/intel64/ceilf_gen.S create mode 100644 external/sgx_libm/intel64/ceill.S create mode 100644 external/sgx_libm/intel64/cexp.S create mode 100644 external/sgx_libm/intel64/cexpf.S create mode 100644 external/sgx_libm/intel64/cexpl.S create mode 100644 external/sgx_libm/intel64/cimag.S create mode 100644 external/sgx_libm/intel64/cimagf.S create mode 100644 external/sgx_libm/intel64/cimagl.S create mode 100644 external/sgx_libm/intel64/clog.S create mode 100644 external/sgx_libm/intel64/clog10.S create mode 100644 external/sgx_libm/intel64/clog10l.S create mode 100644 external/sgx_libm/intel64/clogf.S create mode 100644 external/sgx_libm/intel64/clogl.S create mode 100644 external/sgx_libm/intel64/complex_real.S create mode 100644 external/sgx_libm/intel64/conj.S create mode 100644 external/sgx_libm/intel64/conjf.S create mode 100644 external/sgx_libm/intel64/conjl.S create mode 100644 external/sgx_libm/intel64/copysign_gen.S create mode 100644 external/sgx_libm/intel64/copysignf_gen.S create mode 100644 external/sgx_libm/intel64/copysignl.S create mode 100644 external/sgx_libm/intel64/cos_gen.S create mode 100644 external/sgx_libm/intel64/cosdl.S create mode 100644 external/sgx_libm/intel64/cosf_gen.S create mode 100644 external/sgx_libm/intel64/cosh_gen.S create mode 100644 external/sgx_libm/intel64/coshf_gen.S create mode 100644 external/sgx_libm/intel64/coshl.S create mode 100644 external/sgx_libm/intel64/cosl.S create mode 100644 external/sgx_libm/intel64/cpow.S create mode 100644 external/sgx_libm/intel64/cpowl.S create mode 100644 external/sgx_libm/intel64/cproj.S create mode 100644 external/sgx_libm/intel64/cprojf.S create mode 100644 external/sgx_libm/intel64/cprojl.S create mode 100644 external/sgx_libm/intel64/creal.S create mode 100644 external/sgx_libm/intel64/crealf.S create mode 100644 external/sgx_libm/intel64/creall.S create mode 100644 external/sgx_libm/intel64/csin.S create mode 100644 external/sgx_libm/intel64/csinh.S create mode 100644 external/sgx_libm/intel64/csinhl.S create mode 100644 external/sgx_libm/intel64/csinl.S create mode 100644 external/sgx_libm/intel64/csqrt.S create mode 100644 external/sgx_libm/intel64/csqrtf.S create mode 100644 external/sgx_libm/intel64/csqrtl.S create mode 100644 external/sgx_libm/intel64/ctan.S create mode 100644 external/sgx_libm/intel64/ctanh.S create mode 100644 external/sgx_libm/intel64/ctanhl.S create mode 100644 external/sgx_libm/intel64/ctanl.S create mode 100644 external/sgx_libm/intel64/dpml_ux_bessel.S create mode 100644 external/sgx_libm/intel64/dpml_ux_log.S create mode 100644 external/sgx_libm/intel64/dpml_ux_ops.S create mode 100644 external/sgx_libm/intel64/dpml_ux_ops_64.S create mode 100644 external/sgx_libm/intel64/dpml_ux_sqrt.S create mode 100644 external/sgx_libm/intel64/dpml_ux_trig.S create mode 100644 external/sgx_libm/intel64/erf.S create mode 100644 external/sgx_libm/intel64/erfc.S create mode 100644 external/sgx_libm/intel64/erfcf.S create mode 100644 external/sgx_libm/intel64/erfcl.S create mode 100644 external/sgx_libm/intel64/erff.S create mode 100644 external/sgx_libm/intel64/erfl.S create mode 100644 external/sgx_libm/intel64/exp10_gen.S create mode 100644 external/sgx_libm/intel64/exp10f_gen.S create mode 100644 external/sgx_libm/intel64/exp10l.S create mode 100644 external/sgx_libm/intel64/exp2_gen.S create mode 100644 external/sgx_libm/intel64/exp2f_gen.S create mode 100644 external/sgx_libm/intel64/exp2l.S create mode 100644 external/sgx_libm/intel64/exp_gen.S create mode 100644 external/sgx_libm/intel64/exp_table.S create mode 100644 external/sgx_libm/intel64/expf_gen.S create mode 100644 external/sgx_libm/intel64/expf_table.S create mode 100644 external/sgx_libm/intel64/expl.S create mode 100644 external/sgx_libm/intel64/expl_table.S create mode 100644 external/sgx_libm/intel64/expm1_gen.S create mode 100644 external/sgx_libm/intel64/expm1f_gen.S create mode 100644 external/sgx_libm/intel64/expm1l.S create mode 100644 external/sgx_libm/intel64/fabs.S create mode 100644 external/sgx_libm/intel64/fabsf.S create mode 100644 external/sgx_libm/intel64/fabsl.S create mode 100644 external/sgx_libm/intel64/fdim_gen.S create mode 100644 external/sgx_libm/intel64/fdimf_gen.S create mode 100644 external/sgx_libm/intel64/fdiml.S create mode 100644 external/sgx_libm/intel64/feclearexcept.S create mode 100644 external/sgx_libm/intel64/fedisableexcept.S create mode 100644 external/sgx_libm/intel64/feenableexcept.S create mode 100644 external/sgx_libm/intel64/fegetexcept.S create mode 100644 external/sgx_libm/intel64/fegetexceptflag.S create mode 100644 external/sgx_libm/intel64/fegetround.S create mode 100644 external/sgx_libm/intel64/feholdexcept.S create mode 100644 external/sgx_libm/intel64/feraiseexcept.S create mode 100644 external/sgx_libm/intel64/fesetenv.S create mode 100644 external/sgx_libm/intel64/fesetexceptflag.S create mode 100644 external/sgx_libm/intel64/fesetround.S create mode 100644 external/sgx_libm/intel64/fetestexcept.S create mode 100644 external/sgx_libm/intel64/feupdateenv.S create mode 100644 external/sgx_libm/intel64/floor_gen.S create mode 100644 external/sgx_libm/intel64/floorf_gen.S create mode 100644 external/sgx_libm/intel64/floorl.S create mode 100644 external/sgx_libm/intel64/fma_gen.S create mode 100644 external/sgx_libm/intel64/fmaf_gen.S create mode 100644 external/sgx_libm/intel64/fmal.S create mode 100644 external/sgx_libm/intel64/fmax_gen.S create mode 100644 external/sgx_libm/intel64/fmaxf_gen.S create mode 100644 external/sgx_libm/intel64/fmaxl.S create mode 100644 external/sgx_libm/intel64/fmin_gen.S create mode 100644 external/sgx_libm/intel64/fminf_gen.S create mode 100644 external/sgx_libm/intel64/fminl.S create mode 100644 external/sgx_libm/intel64/fmod_gen.S create mode 100644 external/sgx_libm/intel64/fmodf_gen.S create mode 100644 external/sgx_libm/intel64/fmodl.S create mode 100644 external/sgx_libm/intel64/fpclassify.S create mode 100644 external/sgx_libm/intel64/frexp_gen.S create mode 100644 external/sgx_libm/intel64/frexpf.S create mode 100644 external/sgx_libm/intel64/frexpl.S create mode 100644 external/sgx_libm/intel64/hypot_gen.S create mode 100644 external/sgx_libm/intel64/hypotf_gen.S create mode 100644 external/sgx_libm/intel64/hypotl.S create mode 100644 external/sgx_libm/intel64/ilogb_gen.S create mode 100644 external/sgx_libm/intel64/ilogbf.S create mode 100644 external/sgx_libm/intel64/ilogbl.S create mode 100644 external/sgx_libm/intel64/intel_quad_exception.S create mode 100644 external/sgx_libm/intel64/isfinite.S create mode 100644 external/sgx_libm/intel64/isinf.S create mode 100644 external/sgx_libm/intel64/isnan.S create mode 100644 external/sgx_libm/intel64/isnormal.S create mode 100644 external/sgx_libm/intel64/j0.S create mode 100644 external/sgx_libm/intel64/j0f.S create mode 100644 external/sgx_libm/intel64/j0l.S create mode 100644 external/sgx_libm/intel64/j1.S create mode 100644 external/sgx_libm/intel64/j1f.S create mode 100644 external/sgx_libm/intel64/j1l.S create mode 100644 external/sgx_libm/intel64/jn.S create mode 100644 external/sgx_libm/intel64/jnf.S create mode 100644 external/sgx_libm/intel64/jnl.S create mode 100644 external/sgx_libm/intel64/l2q.S create mode 100644 external/sgx_libm/intel64/ldexp_gen.S create mode 100644 external/sgx_libm/intel64/ldexpf.S create mode 100644 external/sgx_libm/intel64/ldexpl.S create mode 100644 external/sgx_libm/intel64/lgamma.S create mode 100644 external/sgx_libm/intel64/lgammaf.S create mode 100644 external/sgx_libm/intel64/lgammal.S create mode 100644 external/sgx_libm/intel64/libm_atan2_k64.S create mode 100644 external/sgx_libm/intel64/libm_atan2l_k80.S create mode 100644 external/sgx_libm/intel64/libm_cosh_k64.S create mode 100644 external/sgx_libm/intel64/libm_coshl_k80.S create mode 100644 external/sgx_libm/intel64/libm_cosl_k80.S create mode 100644 external/sgx_libm/intel64/libm_exp_k32.S create mode 100644 external/sgx_libm/intel64/libm_exp_k64.S create mode 100644 external/sgx_libm/intel64/libm_expl_k80.S create mode 100644 external/sgx_libm/intel64/libm_fegetenv.S create mode 100644 external/sgx_libm/intel64/libm_hypot2_k64.S create mode 100644 external/sgx_libm/intel64/libm_hypot2l_k80.S create mode 100644 external/sgx_libm/intel64/libm_log1pl_k80.S create mode 100644 external/sgx_libm/intel64/libm_log_k32.S create mode 100644 external/sgx_libm/intel64/libm_log_k64.S create mode 100644 external/sgx_libm/intel64/libm_logl.S create mode 100644 external/sgx_libm/intel64/libm_logl_k80.S create mode 100644 external/sgx_libm/intel64/libm_mul_k64.S create mode 100644 external/sgx_libm/intel64/libm_normalizel_k80.S create mode 100644 external/sgx_libm/intel64/libm_recacoshl_k80.S create mode 100644 external/sgx_libm/intel64/libm_recacosl_recasinl_k80.S create mode 100644 external/sgx_libm/intel64/libm_reduce_pi04d.S create mode 100644 external/sgx_libm/intel64/libm_reduce_pi04l.S create mode 100644 external/sgx_libm/intel64/libm_reduce_pio2.S create mode 100644 external/sgx_libm/intel64/libm_scalbl_k80.S create mode 100644 external/sgx_libm/intel64/libm_sincos_k32.S create mode 100644 external/sgx_libm/intel64/libm_sincos_k64.S create mode 100644 external/sgx_libm/intel64/libm_sinh_k64.S create mode 100644 external/sgx_libm/intel64/libm_sinhl_k80.S create mode 100644 external/sgx_libm/intel64/libm_sinl_k80.S create mode 100644 external/sgx_libm/intel64/libm_sse2_sincos.S create mode 100644 external/sgx_libm/intel64/libm_strtoull.S create mode 100644 external/sgx_libm/intel64/llrint_gen.S create mode 100644 external/sgx_libm/intel64/llrintf_gen.S create mode 100644 external/sgx_libm/intel64/llrintl.S create mode 100644 external/sgx_libm/intel64/llround_gen.S create mode 100644 external/sgx_libm/intel64/llroundf_gen.S create mode 100644 external/sgx_libm/intel64/llroundl.S create mode 100644 external/sgx_libm/intel64/log10_gen.S create mode 100644 external/sgx_libm/intel64/log10f_gen.S create mode 100644 external/sgx_libm/intel64/log10l.S create mode 100644 external/sgx_libm/intel64/log10l_table.S create mode 100644 external/sgx_libm/intel64/log1p_gen.S create mode 100644 external/sgx_libm/intel64/log1pf_gen.S create mode 100644 external/sgx_libm/intel64/log1pl.S create mode 100644 external/sgx_libm/intel64/log2_gen.S create mode 100644 external/sgx_libm/intel64/log2f_gen.S create mode 100644 external/sgx_libm/intel64/log2l.S create mode 100644 external/sgx_libm/intel64/log2l_table.S create mode 100644 external/sgx_libm/intel64/log_gen.S create mode 100644 external/sgx_libm/intel64/log_table.S create mode 100644 external/sgx_libm/intel64/logb_gen.S create mode 100644 external/sgx_libm/intel64/logbf.S create mode 100644 external/sgx_libm/intel64/logbl.S create mode 100644 external/sgx_libm/intel64/logf_gen.S create mode 100644 external/sgx_libm/intel64/logf_table.S create mode 100644 external/sgx_libm/intel64/logl.S create mode 100644 external/sgx_libm/intel64/logl_table.S create mode 100644 external/sgx_libm/intel64/lrint_gen.S create mode 100644 external/sgx_libm/intel64/lrintf_gen.S create mode 100644 external/sgx_libm/intel64/lrintl.S create mode 100644 external/sgx_libm/intel64/lround_gen.S create mode 100644 external/sgx_libm/intel64/lroundf_gen.S create mode 100644 external/sgx_libm/intel64/lroundl.S create mode 100644 external/sgx_libm/intel64/modf_gen.S create mode 100644 external/sgx_libm/intel64/modff.S create mode 100644 external/sgx_libm/intel64/modfl.S create mode 100644 external/sgx_libm/intel64/nan.S create mode 100644 external/sgx_libm/intel64/nearbyint_gen.S create mode 100644 external/sgx_libm/intel64/nearbyintf_gen.S create mode 100644 external/sgx_libm/intel64/nearbyintl.S create mode 100644 external/sgx_libm/intel64/nextafter_gen.S create mode 100644 external/sgx_libm/intel64/nextafterf_gen.S create mode 100644 external/sgx_libm/intel64/nextafterl.S create mode 100644 external/sgx_libm/intel64/nexttoward_gen.S create mode 100644 external/sgx_libm/intel64/nexttowardf_gen.S create mode 100644 external/sgx_libm/intel64/nexttowardl.S create mode 100644 external/sgx_libm/intel64/pow_gen.S create mode 100644 external/sgx_libm/intel64/powf_gen.S create mode 100644 external/sgx_libm/intel64/powl.S create mode 100644 external/sgx_libm/intel64/q2l.S create mode 100644 external/sgx_libm/intel64/rcp_table.S create mode 100644 external/sgx_libm/intel64/remainder_gen.S create mode 100644 external/sgx_libm/intel64/remainderf_gen.S create mode 100644 external/sgx_libm/intel64/remainderl.S create mode 100644 external/sgx_libm/intel64/remquo.S create mode 100644 external/sgx_libm/intel64/remquof.S create mode 100644 external/sgx_libm/intel64/remquol.S create mode 100644 external/sgx_libm/intel64/rint_gen.S create mode 100644 external/sgx_libm/intel64/rintf_gen.S create mode 100644 external/sgx_libm/intel64/rintl.S create mode 100644 external/sgx_libm/intel64/round_gen.S create mode 100644 external/sgx_libm/intel64/roundf_gen.S create mode 100644 external/sgx_libm/intel64/roundl.S create mode 100644 external/sgx_libm/intel64/scalb_gen.S create mode 100644 external/sgx_libm/intel64/scalbf.S create mode 100644 external/sgx_libm/intel64/scalbl.S create mode 100644 external/sgx_libm/intel64/scalbln_gen.S create mode 100644 external/sgx_libm/intel64/scalblnf.S create mode 100644 external/sgx_libm/intel64/scalblnl.S create mode 100644 external/sgx_libm/intel64/scalbn_gen.S create mode 100644 external/sgx_libm/intel64/scalbnf.S create mode 100644 external/sgx_libm/intel64/scalbnl.S create mode 100644 external/sgx_libm/intel64/signbit.S create mode 100644 external/sgx_libm/intel64/significand_gen.S create mode 100644 external/sgx_libm/intel64/significandf_gen.S create mode 100644 external/sgx_libm/intel64/significandl.S create mode 100644 external/sgx_libm/intel64/sin_gen.S create mode 100644 external/sgx_libm/intel64/sincos_gen.S create mode 100644 external/sgx_libm/intel64/sincos_pi4l.S create mode 100644 external/sgx_libm/intel64/sincosd_table.S create mode 100644 external/sgx_libm/intel64/sincosf_gen.S create mode 100644 external/sgx_libm/intel64/sincosl.S create mode 100644 external/sgx_libm/intel64/sindl.S create mode 100644 external/sgx_libm/intel64/sinf_gen.S create mode 100644 external/sgx_libm/intel64/sinh_gen.S create mode 100644 external/sgx_libm/intel64/sinhf_gen.S create mode 100644 external/sgx_libm/intel64/sinhl.S create mode 100644 external/sgx_libm/intel64/sinl.S create mode 100644 external/sgx_libm/intel64/sqrt.S create mode 100644 external/sgx_libm/intel64/sqrt_tab_t.S create mode 100644 external/sgx_libm/intel64/sqrtf_gen.S create mode 100644 external/sgx_libm/intel64/sqrtl.S create mode 100644 external/sgx_libm/intel64/tan_gen.S create mode 100644 external/sgx_libm/intel64/tanf_gen.S create mode 100644 external/sgx_libm/intel64/tanh_gen.S create mode 100644 external/sgx_libm/intel64/tanhf_gen.S create mode 100644 external/sgx_libm/intel64/tanhl.S create mode 100644 external/sgx_libm/intel64/tanl.S create mode 100644 external/sgx_libm/intel64/tgamma.S create mode 100644 external/sgx_libm/intel64/tgammaf.S create mode 100644 external/sgx_libm/intel64/tgammal.S create mode 100644 external/sgx_libm/intel64/trig_pi_bits.S create mode 100644 external/sgx_libm/intel64/trunc_gen.S create mode 100644 external/sgx_libm/intel64/truncf.S create mode 100644 external/sgx_libm/intel64/truncl.S create mode 100644 external/sgx_libm/intel64/y0.S create mode 100644 external/sgx_libm/intel64/y0f.S create mode 100644 external/sgx_libm/intel64/y0l.S create mode 100644 external/sgx_libm/intel64/y1.S create mode 100644 external/sgx_libm/intel64/y1f.S create mode 100644 external/sgx_libm/intel64/y1l.S create mode 100644 external/sgx_libm/intel64/yn.S create mode 100644 external/sgx_libm/intel64/ynf.S create mode 100644 external/sgx_libm/intel64/ynl.S create mode 100644 external/sgx_libm/makefile create mode 100644 external/tinyxml/tinystr.cpp create mode 100644 external/tinyxml/tinystr.h create mode 100644 external/tinyxml/tinyxml.cpp create mode 100644 external/tinyxml/tinyxml.h create mode 100644 external/tinyxml/tinyxmlerror.cpp create mode 100644 external/tinyxml/tinyxmlparser.cpp create mode 100644 external/vtune/linux/include/advisor-annotate.h create mode 100644 external/vtune/linux/include/advisor_annotate.f90 create mode 100644 external/vtune/linux/include/internal/ittnotify.h create mode 100644 external/vtune/linux/include/ittnotify.f90 create mode 100644 external/vtune/linux/include/ittnotify.h create mode 100644 external/vtune/linux/include/jitprofiling.h create mode 100644 external/vtune/linux/include/legacy/ittnotify.h create mode 100644 external/vtune/linux/include/libittnotify.h create mode 100644 external/vtune/linux/include/llvm_jit_event_listener.hpp create mode 100644 external/vtune/linux/include/prototype/ittnotify.h create mode 100644 external/vtune/linux/sdk/src/ittnotify/LICENSE.BSD create mode 100644 external/vtune/linux/sdk/src/ittnotify/LICENSE.GPL create mode 100644 external/vtune/linux/sdk/src/ittnotify/Makefile create mode 100644 external/vtune/linux/sdk/src/ittnotify/disable_warnings.h create mode 100644 external/vtune/linux/sdk/src/ittnotify/ittnotify_config.h create mode 100644 external/vtune/linux/sdk/src/ittnotify/ittnotify_static.c create mode 100644 external/vtune/linux/sdk/src/ittnotify/ittnotify_static.h create mode 100644 external/vtune/linux/sdk/src/ittnotify/ittnotify_types.h create mode 100644 external/vtune/linux/sdk/src/ittnotify/jitprofiling.c create mode 100755 linux/installer/bin/build-installpkg.sh create mode 100755 linux/installer/bin/install-sgx-psw.bin.tmpl create mode 100755 linux/installer/bin/install-sgx-sdk.bin.tmpl create mode 100755 linux/installer/common/gen_source/gen_source.py create mode 100644 linux/installer/common/licenses/BOM_license.txt create mode 100644 linux/installer/common/psw/BOMs/psw_base.txt create mode 100644 linux/installer/common/psw/BOMs/psw_x64.txt create mode 100644 linux/installer/common/psw/BOMs/psw_x86.txt create mode 100644 linux/installer/common/psw/Makefile create mode 100755 linux/installer/common/psw/createTarball.sh create mode 100755 linux/installer/common/psw/install.sh create mode 100644 linux/installer/common/psw/installConfig.x64 create mode 100644 linux/installer/common/psw/installConfig.x86 create mode 100644 linux/installer/common/sdk/BOMs/sdk_base.txt create mode 100644 linux/installer/common/sdk/BOMs/sdk_x64.txt create mode 100644 linux/installer/common/sdk/BOMs/sdk_x86.txt create mode 100644 linux/installer/common/sdk/Makefile create mode 100755 linux/installer/common/sdk/createTarball.sh create mode 100755 linux/installer/common/sdk/install.sh create mode 100644 linux/installer/common/sdk/installConfig.x64 create mode 100644 linux/installer/common/sdk/installConfig.x86 create mode 100644 psw/Makefile create mode 100644 psw/ae/Makefile create mode 100644 psw/ae/aesm_service/Makefile create mode 100644 psw/ae/aesm_service/config/aesmd_service/aesmd.conf create mode 100644 psw/ae/aesm_service/config/aesmd_service/aesmd.service create mode 100644 psw/ae/aesm_service/config/network/aesmd.conf create mode 100644 psw/ae/aesm_service/include/oal/aesm_network.h create mode 100644 psw/ae/aesm_service/include/oal/aesm_persistent_storage.h create mode 100644 psw/ae/aesm_service/include/oal/aesm_thread.h create mode 100644 psw/ae/aesm_service/include/oal/error_report.h create mode 100644 psw/ae/aesm_service/include/oal/internal_log.h create mode 100644 psw/ae/aesm_service/include/oal/oal.h create mode 100644 psw/ae/aesm_service/include/oal/power.h create mode 100644 psw/ae/aesm_service/source/aesm/application/AEClass.h create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_config.cpp create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_config.h create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_logic.h create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_proxy_type.h create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_rand.cpp create mode 100644 psw/ae/aesm_service/source/aesm/application/aesm_rand.h create mode 100644 psw/ae/aesm_service/source/aesm/application/event_strings.cpp create mode 100644 psw/ae/aesm_service/source/aesm/application/event_strings.h create mode 100644 psw/ae/aesm_service/source/aesm/application/main.cpp create mode 100644 psw/ae/aesm_service/source/aesm/application/prof_fun.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_encode.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/type_length_value.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/AESMLogicWrapper.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueue.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueueManager.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/AESMWorkerThread.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/CAESMServer.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/CSelector.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/IAESMQueue.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/IServerSocket.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/RequestData.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/Thread.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/UnixServerSocket.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/inc/aesm_exception.h create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/AESMQueueManager.cpp create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/AESMWorkerThread.cpp create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/CAESMServer.cpp create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/CSelector.cpp create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/Thread.cpp create mode 100644 psw/ae/aesm_service/source/aesm_wrapper/src/UnixServerSocket.cpp create mode 100644 psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp create mode 100644 psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp create mode 100644 psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp create mode 100644 psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp create mode 100644 psw/ae/aesm_service/source/epid_provision/epid_utility.cpp create mode 100644 psw/ae/aesm_service/source/epid_provision/epid_utility.h create mode 100644 psw/ae/aesm_service/source/le/LEClass.cpp create mode 100644 psw/ae/aesm_service/source/le/LEClass.h create mode 100644 psw/ae/aesm_service/source/network/network_encoding_wrapper.cpp create mode 100644 psw/ae/aesm_service/source/network/network_encoding_wrapper.h create mode 100644 psw/ae/aesm_service/source/oal/aesm_thread.cpp create mode 100644 psw/ae/aesm_service/source/oal/aesm_util.cpp create mode 100644 psw/ae/aesm_service/source/oal/error_report.cpp create mode 100644 psw/ae/aesm_service/source/oal/internal_log.cpp create mode 100644 psw/ae/aesm_service/source/oal/oal_power.cpp create mode 100644 psw/ae/aesm_service/source/protobuf/Makefile create mode 100644 psw/ae/aesm_service/source/pve/PVEClass.cpp create mode 100644 psw/ae/aesm_service/source/pve/PVEClass.h create mode 100644 psw/ae/aesm_service/source/pve/prov_msg_size.h create mode 100644 psw/ae/aesm_service/source/pve/pve_logic.cpp create mode 100644 psw/ae/aesm_service/source/pve/pve_logic.h create mode 100644 psw/ae/aesm_service/source/qe/QEClass.cpp create mode 100644 psw/ae/aesm_service/source/qe/QEClass.h create mode 100644 psw/ae/aesm_service/source/qe/qe_logic.cpp create mode 100644 psw/ae/aesm_service/source/qe/qe_logic.h create mode 100644 psw/ae/aesm_service/source/storage/persistent_storage_info.h create mode 100644 psw/ae/aesm_service/source/storage/persistent_storage_table.cpp create mode 100644 psw/ae/aesm_service/source/upse/platform_info_blob.h create mode 100644 psw/ae/buildenv.mk create mode 100644 psw/ae/common/inc/AECloseSessionRequest.h create mode 100644 psw/ae/common/inc/AECloseSessionResponse.h create mode 100644 psw/ae/common/inc/AECreateSessionRequest.h create mode 100644 psw/ae/common/inc/AECreateSessionResponse.h create mode 100644 psw/ae/common/inc/AEExchangeReportRequest.h create mode 100644 psw/ae/common/inc/AEExchangeReportResponse.h create mode 100644 psw/ae/common/inc/AEGetLaunchTokenRequest.h create mode 100644 psw/ae/common/inc/AEGetLaunchTokenResponse.h create mode 100644 psw/ae/common/inc/AEGetPsCapRequest.h create mode 100644 psw/ae/common/inc/AEGetPsCapResponse.h create mode 100644 psw/ae/common/inc/AEGetQuoteRequest.h create mode 100644 psw/ae/common/inc/AEGetQuoteResponse.h create mode 100644 psw/ae/common/inc/AEInitQuoteRequest.h create mode 100644 psw/ae/common/inc/AEInitQuoteResponse.h create mode 100644 psw/ae/common/inc/AEInvokeServiceRequest.h create mode 100644 psw/ae/common/inc/AEInvokeServiceResponse.h create mode 100644 psw/ae/common/inc/AEReportAttestationRequest.h create mode 100644 psw/ae/common/inc/AEReportAttestationResponse.h create mode 100644 psw/ae/common/inc/Config.h create mode 100644 psw/ae/common/inc/IAERequest.h create mode 100644 psw/ae/common/inc/IAEResponse.h create mode 100644 psw/ae/common/inc/IAESMLogic.h create mode 100644 psw/ae/common/inc/ICommunicationSocket.h create mode 100644 psw/ae/common/inc/ISerializer.h create mode 100644 psw/ae/common/inc/ISocketFactory.h create mode 100644 psw/ae/common/inc/ITransporter.h create mode 100644 psw/ae/common/inc/NonBlockingUnixCommunicationSocket.h create mode 100644 psw/ae/common/inc/NonBlockingUnixSocketFactory.h create mode 100644 psw/ae/common/inc/ProtobufSerializer.h create mode 100644 psw/ae/common/inc/SocketTransporter.h create mode 100644 psw/ae/common/inc/UnixCommunicationSocket.h create mode 100644 psw/ae/common/inc/UnixSocketFactory.h create mode 100644 psw/ae/common/pek_pub_key.cpp create mode 100644 psw/ae/common/proto/Makefile create mode 100644 psw/ae/common/proto/messages.proto create mode 100644 psw/ae/common/pve_pub_key.cpp create mode 100644 psw/ae/common/se_sig_rl.cpp create mode 100644 psw/ae/common/src/AECloseSessionRequest.cpp create mode 100644 psw/ae/common/src/AECloseSessionResponse.cpp create mode 100644 psw/ae/common/src/AECreateSessionRequest.cpp create mode 100644 psw/ae/common/src/AECreateSessionResponse.cpp create mode 100644 psw/ae/common/src/AEExchangeReportRequest.cpp create mode 100644 psw/ae/common/src/AEExchangeReportResponse.cpp create mode 100644 psw/ae/common/src/AEGetLaunchTokenRequest.cpp create mode 100644 psw/ae/common/src/AEGetLaunchTokenResponse.cpp create mode 100644 psw/ae/common/src/AEGetPsCapRequest.cpp create mode 100644 psw/ae/common/src/AEGetPsCapResponse.cpp create mode 100644 psw/ae/common/src/AEGetQuoteRequest.cpp create mode 100644 psw/ae/common/src/AEGetQuoteResponse.cpp create mode 100644 psw/ae/common/src/AEInitQuoteRequest.cpp create mode 100644 psw/ae/common/src/AEInitQuoteResponse.cpp create mode 100644 psw/ae/common/src/AEInvokeServiceRequest.cpp create mode 100644 psw/ae/common/src/AEInvokeServiceResponse.cpp create mode 100644 psw/ae/common/src/AEReportAttestationRequest.cpp create mode 100644 psw/ae/common/src/AEReportAttestationResponse.cpp create mode 100644 psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp create mode 100644 psw/ae/common/src/NonBlockingUnixSocketFactory.cpp create mode 100644 psw/ae/common/src/ProtobufSerializer.cpp create mode 100644 psw/ae/common/src/SocketTransporter.cpp create mode 100644 psw/ae/common/src/UnixCommunicationSocket.cpp create mode 100644 psw/ae/common/src/UnixSocketFactory.cpp create mode 100644 psw/ae/data/constants/linux/ae_debug_flag.hh create mode 100644 psw/ae/data/constants/linux/default_url_info.hh create mode 100644 psw/ae/data/constants/linux/isk_pub.hh create mode 100644 psw/ae/data/constants/linux/launch_enclave_mrsigner.hh create mode 100644 psw/ae/data/constants/linux/peksk_pub.hh create mode 100644 psw/ae/data/constants/linux/pibsk_pub.hh create mode 100644 psw/ae/data/constants/linux/pse_op_isv_svn_min.hh create mode 100644 psw/ae/data/constants/linux/pse_op_prod_id.hh create mode 100644 psw/ae/data/constants/linux/qsdk_pub.hh create mode 100644 psw/ae/data/constants/linux/service_enclave_mrsigner.hh create mode 100644 psw/ae/data/constants/linux/wl_pub.hh create mode 100644 psw/ae/data/prebuilt/le_prod_css.bin create mode 100644 psw/ae/data/prebuilt/white_list_cert_to_be_verify.bin create mode 100644 psw/ae/inc/aeerror.h create mode 100644 psw/ae/inc/byte_order.h create mode 100644 psw/ae/inc/internal/aesm_error.h create mode 100644 psw/ae/inc/internal/cipher.h create mode 100644 psw/ae/inc/internal/epid_pve_type.h create mode 100644 psw/ae/inc/internal/le2be_macros.h create mode 100644 psw/ae/inc/internal/pek_pub_key.h create mode 100644 psw/ae/inc/internal/provision_msg.h create mode 100644 psw/ae/inc/internal/pse_inc.h create mode 100644 psw/ae/inc/internal/pse_types.h create mode 100644 psw/ae/inc/internal/pve_qe_common.h create mode 100644 psw/ae/inc/internal/tlv_common.h create mode 100644 psw/ae/inc/internal/utility.h create mode 100644 psw/ae/inc/se_sig_rl.h create mode 100644 psw/ae/le/Makefile create mode 100644 psw/ae/le/config_debug.xml create mode 100644 psw/ae/le/config_linux.xml create mode 100644 psw/ae/le/launch_enclave.cpp create mode 100644 psw/ae/le/launch_enclave.edl create mode 100644 psw/ae/le/launch_enclave.h create mode 100644 psw/ae/pve/provision_enclave.edl create mode 100644 psw/ae/qe/quoting_enclave.edl create mode 100644 psw/uae_service/config.h create mode 100644 psw/uae_service/linux/Makefile create mode 100644 psw/uae_service/sgx_uae_service.cpp create mode 100644 psw/uae_service/uae_service_assert.cpp create mode 100644 psw/uae_service/uae_service_version.cpp create mode 100644 psw/uae_service/uae_wrapper/inc/AEInternalServices.h create mode 100644 psw/uae_service/uae_wrapper/inc/AEInternalServicesProvider.h create mode 100644 psw/uae_service/uae_wrapper/inc/AEServices.h create mode 100644 psw/uae_service/uae_wrapper/inc/AEServicesImpl.h create mode 100644 psw/uae_service/uae_wrapper/inc/AEServicesProvider.h create mode 100644 psw/uae_service/uae_wrapper/src/AEInternalServicesProvider.cpp create mode 100644 psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp create mode 100644 psw/uae_service/uae_wrapper/src/AEServicesProvider.cpp create mode 100644 psw/uae_service/uae_wrapper/src/tae_ocall_api.cpp create mode 100644 psw/uae_service/uae_wrapper/src/uae_api.cpp create mode 100644 psw/urts/cpu_features.cpp create mode 100644 psw/urts/cpu_features.h create mode 100644 psw/urts/create_param.h create mode 100644 psw/urts/enclave.cpp create mode 100644 psw/urts/enclave.h create mode 100644 psw/urts/enclave_creator_hw.h create mode 100644 psw/urts/enclave_creator_hw_com.cpp create mode 100644 psw/urts/enclave_mutex.cpp create mode 100644 psw/urts/file.h create mode 100644 psw/urts/launch_checker.cpp create mode 100644 psw/urts/launch_checker.h create mode 100644 psw/urts/linux/Makefile create mode 100644 psw/urts/linux/debugger_support.cpp create mode 100644 psw/urts/linux/debugger_support.h create mode 100644 psw/urts/linux/enclave_creator_hw.cpp create mode 100644 psw/urts/linux/enter_enclave.S create mode 100644 psw/urts/linux/enter_enclave.h create mode 100644 psw/urts/linux/get_thread_id.cpp create mode 100644 psw/urts/linux/isgx_user.h create mode 100644 psw/urts/linux/misc.cpp create mode 100644 psw/urts/linux/read_xcr0.h create mode 100644 psw/urts/linux/sig_handler.cpp create mode 100644 psw/urts/linux/sig_handler.h create mode 100644 psw/urts/linux/urts.cpp create mode 100644 psw/urts/linux/urts_internal.cpp create mode 100644 psw/urts/loader.cpp create mode 100644 psw/urts/loader.h create mode 100644 psw/urts/node.cpp create mode 100644 psw/urts/node.h create mode 100644 psw/urts/parser/Makefile create mode 100644 psw/urts/parser/binparser.h create mode 100644 psw/urts/parser/clearvars.h create mode 100644 psw/urts/parser/elf32parser.cpp create mode 100644 psw/urts/parser/elf32parser.h create mode 100644 psw/urts/parser/elf64parser.cpp create mode 100644 psw/urts/parser/elf64parser.h create mode 100644 psw/urts/parser/elfparser.cpp create mode 100644 psw/urts/parser/elfparser.h create mode 100644 psw/urts/parser/parserfactory.cpp create mode 100644 psw/urts/parser/parserfactory.h create mode 100644 psw/urts/parser/section.cpp create mode 100644 psw/urts/parser/section.h create mode 100644 psw/urts/parser/update_global_data.hxx create mode 100644 psw/urts/prd_css_util.cpp create mode 100644 psw/urts/prd_css_util.h create mode 100644 psw/urts/routine.cpp create mode 100644 psw/urts/se_detect.cpp create mode 100644 psw/urts/se_detect.h create mode 100644 psw/urts/se_ocalls.cpp create mode 100644 psw/urts/section_info.h create mode 100644 psw/urts/tcs.cpp create mode 100644 psw/urts/tcs.h create mode 100644 psw/urts/urts_com.h create mode 100644 psw/urts/urts_version.cpp create mode 100644 psw/urts/urts_xsave.cpp create mode 100644 sdk/Makefile create mode 100644 sdk/compiler-rt/LICENSE.TXT create mode 100644 sdk/compiler-rt/Makefile create mode 100644 sdk/compiler-rt/addtf3.c create mode 100644 sdk/compiler-rt/ashldi3.c create mode 100644 sdk/compiler-rt/ashlti3.c create mode 100644 sdk/compiler-rt/ashrdi3.c create mode 100644 sdk/compiler-rt/ashrti3.c create mode 100644 sdk/compiler-rt/clear_cache.c create mode 100644 sdk/compiler-rt/clzdi2.c create mode 100644 sdk/compiler-rt/clzsi2.c create mode 100644 sdk/compiler-rt/clzti2.c create mode 100644 sdk/compiler-rt/cmpdi2.c create mode 100644 sdk/compiler-rt/cmpti2.c create mode 100644 sdk/compiler-rt/comparetf2.c create mode 100644 sdk/compiler-rt/ctzdi2.c create mode 100644 sdk/compiler-rt/ctzsi2.c create mode 100644 sdk/compiler-rt/ctzti2.c create mode 100644 sdk/compiler-rt/divdi3.c create mode 100644 sdk/compiler-rt/divsi3.c create mode 100644 sdk/compiler-rt/divtf3.c create mode 100644 sdk/compiler-rt/divti3.c create mode 100644 sdk/compiler-rt/extenddftf2.c create mode 100644 sdk/compiler-rt/extendsftf2.c create mode 100644 sdk/compiler-rt/ffsdi2.c create mode 100644 sdk/compiler-rt/ffsti2.c create mode 100644 sdk/compiler-rt/fixtfsi.c create mode 100644 sdk/compiler-rt/floatsitf.c create mode 100644 sdk/compiler-rt/floatunsitf.c create mode 100644 sdk/compiler-rt/fp_extend.h create mode 100644 sdk/compiler-rt/fp_lib.h create mode 100644 sdk/compiler-rt/fp_trunc.h create mode 100644 sdk/compiler-rt/int_endianness.h create mode 100644 sdk/compiler-rt/int_lib.h create mode 100644 sdk/compiler-rt/int_types.h create mode 100644 sdk/compiler-rt/int_util.h create mode 100644 sdk/compiler-rt/lshrdi3.c create mode 100644 sdk/compiler-rt/lshrti3.c create mode 100644 sdk/compiler-rt/moddi3.c create mode 100644 sdk/compiler-rt/modsi3.c create mode 100644 sdk/compiler-rt/modti3.c create mode 100644 sdk/compiler-rt/muldi3.c create mode 100644 sdk/compiler-rt/multf3.c create mode 100644 sdk/compiler-rt/multi3.c create mode 100644 sdk/compiler-rt/negdi2.c create mode 100644 sdk/compiler-rt/negti2.c create mode 100644 sdk/compiler-rt/paritydi2.c create mode 100644 sdk/compiler-rt/paritysi2.c create mode 100644 sdk/compiler-rt/parityti2.c create mode 100644 sdk/compiler-rt/popcountdi2.c create mode 100644 sdk/compiler-rt/popcountsi2.c create mode 100644 sdk/compiler-rt/popcountti2.c create mode 100644 sdk/compiler-rt/stack_chk.c create mode 100644 sdk/compiler-rt/subtf3.c create mode 100644 sdk/compiler-rt/trunctfdf2.c create mode 100644 sdk/compiler-rt/trunctfsf2.c create mode 100644 sdk/compiler-rt/ucmpdi2.c create mode 100644 sdk/compiler-rt/ucmpti2.c create mode 100644 sdk/compiler-rt/udivdi3.c create mode 100644 sdk/compiler-rt/udivmoddi4.c create mode 100644 sdk/compiler-rt/udivmodti4.c create mode 100644 sdk/compiler-rt/udivsi3.c create mode 100644 sdk/compiler-rt/udivti3.c create mode 100644 sdk/compiler-rt/umoddi3.c create mode 100644 sdk/compiler-rt/umodsi3.c create mode 100644 sdk/compiler-rt/umodti3.c create mode 100644 sdk/cpprt/Makefile create mode 100644 sdk/cpprt/linux/abi_namespace.h create mode 100644 sdk/cpprt/linux/atomic.h create mode 100644 sdk/cpprt/linux/auxhelper.cc create mode 100644 sdk/cpprt/linux/cxa_finalize.c create mode 100644 sdk/cpprt/linux/cxxabi.h create mode 100644 sdk/cpprt/linux/dwarf_eh.h create mode 100644 sdk/cpprt/linux/dynamic_cast.cc create mode 100644 sdk/cpprt/linux/exception.cc create mode 100644 sdk/cpprt/linux/gcc_personality_v0.c create mode 100644 sdk/cpprt/linux/guard.cc create mode 100644 sdk/cpprt/linux/libelftc_dem_gnu3.c create mode 100644 sdk/cpprt/linux/libunwind/AUTHORS create mode 100644 sdk/cpprt/linux/libunwind/COPYING create mode 100644 sdk/cpprt/linux/libunwind/ChangeLog create mode 100644 sdk/cpprt/linux/libunwind/LICENSE create mode 100644 sdk/cpprt/linux/libunwind/Makefile.am create mode 100644 sdk/cpprt/linux/libunwind/NEWS create mode 100644 sdk/cpprt/linux/libunwind/README create mode 100644 sdk/cpprt/linux/libunwind/TODO create mode 100644 sdk/cpprt/linux/libunwind/acinclude.m4 create mode 100755 sdk/cpprt/linux/libunwind/autogen-linux.sh create mode 100644 sdk/cpprt/linux/libunwind/configure.in create mode 100644 sdk/cpprt/linux/libunwind/doc/Makefile.am create mode 100644 sdk/cpprt/linux/libunwind/doc/NOTES create mode 100644 sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.man create mode 100644 sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/_U_dyn_register.man create mode 100644 sdk/cpprt/linux/libunwind/doc/_U_dyn_register.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/common.tex.in create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.man create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-ia64.man create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-ia64.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.man create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.man create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind.man create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/libunwind.trans create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_flush_cache.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_flush_cache.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_accessors.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_accessors.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_reg.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_get_reg.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_getcontext.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_getcontext.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_init_local.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_init_local.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_init_remote.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_init_remote.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_regname.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_regname.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_resume.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_resume.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_set_reg.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_set_reg.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_step.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_step.tex create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_strerror.man create mode 100644 sdk/cpprt/linux/libunwind/doc/unw_strerror.tex create mode 100644 sdk/cpprt/linux/libunwind/include/dwarf-eh.h create mode 100644 sdk/cpprt/linux/libunwind/include/dwarf.h create mode 100644 sdk/cpprt/linux/libunwind/include/dwarf_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-arm.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-common.h.in create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-coredump.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-dynamic.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-hppa.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-ia64.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-mips.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-ppc32.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-ppc64.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-ptrace.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-x86.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind-x86_64.h create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind.h.in create mode 100644 sdk/cpprt/linux/libunwind/include/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/mempool.h create mode 100644 sdk/cpprt/linux/libunwind/include/remote.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-arm/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-arm/ex_tables.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-arm/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-arm/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-hppa/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-hppa/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-hppa/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ia64/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ia64/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ia64/rse.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ia64/script.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-mips/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-mips/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-mips/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ppc32/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ppc32/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ppc32/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ppc64/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ppc64/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-ppc64/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-x86/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-x86/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-x86/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-x86_64/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-x86_64/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep-x86_64/libunwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep/dwarf-config.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep/jmpbuf.h create mode 100644 sdk/cpprt/linux/libunwind/include/tdep/libunwind_i.h.in create mode 100644 sdk/cpprt/linux/libunwind/include/unwind.h create mode 100644 sdk/cpprt/linux/libunwind/include/x86/jmpbuf.h create mode 100755 sdk/cpprt/linux/libunwind/scripts/kernel-diff.sh create mode 100644 sdk/cpprt/linux/libunwind/scripts/kernel-files.txt create mode 100755 sdk/cpprt/linux/libunwind/scripts/make-L-files create mode 100644 sdk/cpprt/linux/libunwind/src/Makefile.am create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gex_tables.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lex_tables.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/gen-offsets.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/getcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/arm/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/arm/is_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/offsets.h create mode 100644 sdk/cpprt/linux/libunwind/src/arm/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/arm/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/arm/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/README create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_mem.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_freebsd.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_linux.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_accessors.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_create.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_destroy.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_elf_map_image.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_find_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_get_proc_name.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_internal.h create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UCD_lib.h create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UPT_access_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UPT_elf.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UPT_put_unwind_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/coredump/_UPT_resume.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gexpr.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gfde.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gfind_proc_info-lsb.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gfind_unwind_table.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gparser.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gpe.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lexpr.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lfde.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lfind_proc_info-lsb.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lfind_unwind_table.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lparser.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lpe.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/dwarf/global.c create mode 100644 sdk/cpprt/linux/libunwind/src/elf32.c create mode 100644 sdk/cpprt/linux/libunwind/src/elf32.h create mode 100644 sdk/cpprt/linux/libunwind/src/elf64.c create mode 100644 sdk/cpprt/linux/libunwind/src/elf64.h create mode 100644 sdk/cpprt/linux/libunwind/src/elfxx.c create mode 100644 sdk/cpprt/linux/libunwind/src/elfxx.h create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/get_accessors.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/getcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/offsets.h create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/setcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/tables.c create mode 100644 sdk/cpprt/linux/libunwind/src/hppa/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gfind_unwind_table.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Ginstall_cursor.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gparser.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Grbs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gscript.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Gtables.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lfind_unwind_table.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Linstall_cursor.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lparser.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lrbs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lscript.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/Ltables.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/NOTES create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/dyn_info_list.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/getcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/longjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/mk_Gcursor_i.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/mk_Lcursor_i.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/offsets.h create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/regs.h create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/setjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/sigsetjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/ucontext_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/unwind_decoder.h create mode 100644 sdk/cpprt/linux/libunwind/src/ia64/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gdestroy_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gdyn-extract.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gdyn-remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gfind_dynamic_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gget_accessors.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gget_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gget_proc_info_by_ip.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gget_proc_name.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gget_reg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gput_dynamic_unwind_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gset_caching_policy.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gset_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Gset_reg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Ldestroy_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Ldyn-extract.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Ldyn-remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lfind_dynamic_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lget_accessors.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lget_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lget_proc_info_by_ip.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lget_proc_name.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lget_reg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lput_dynamic_unwind_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lset_caching_policy.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lset_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/Lset_reg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/_ReadSLEB.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/_ReadULEB.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/backtrace.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/dyn-cancel.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/dyn-info-list.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/dyn-register.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/flush_cache.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/init.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/mempool.c create mode 100644 sdk/cpprt/linux/libunwind/src/mi/strerror.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/elfxx.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/gen-offsets.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/getcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/mips/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/mips/is_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/offsets.h create mode 100644 sdk/cpprt/linux/libunwind/src/mips/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/mips/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/mips/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/os-freebsd.c create mode 100644 sdk/cpprt/linux/libunwind/src/os-hpux.c create mode 100644 sdk/cpprt/linux/libunwind/src/os-linux.c create mode 100644 sdk/cpprt/linux/libunwind/src/os-linux.h create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Gis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/Lis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/longjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/ppc/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/Make-arch.in create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/get_func_addr.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/is_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/setcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/ucontext_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/ppc32/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/get_func_addr.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/is_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/setcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/ucontext_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/ppc64/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_mem.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_reg.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_accessors.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_create.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_destroy.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_elf.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_find_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_proc_name.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_internal.h create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_put_unwind_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_reg_offset.c create mode 100644 sdk/cpprt/linux/libunwind/src/ptrace/_UPT_resume.c create mode 100644 sdk/cpprt/linux/libunwind/src/se-iterate-phdr.c create mode 100644 sdk/cpprt/linux/libunwind/src/se-libc-stubs.c create mode 100644 sdk/cpprt/linux/libunwind/src/setjmp/longjmp.c create mode 100644 sdk/cpprt/linux/libunwind/src/setjmp/setjmp.c create mode 100644 sdk/cpprt/linux/libunwind/src/setjmp/setjmp_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c create mode 100644 sdk/cpprt/linux/libunwind/src/setjmp/sigsetjmp.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/Backtrace.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/DeleteException.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/FindEnclosingFunction.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/ForcedUnwind.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetBSP.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetCFA.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetDataRelBase.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetGR.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetIP.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetIPInfo.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetLanguageSpecificData.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetRegionStart.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/GetTextRelBase.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/RaiseException.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/Resume.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/Resume_or_Rethrow.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/SetGR.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/SetIP.c create mode 100644 sdk/cpprt/linux/libunwind/src/unwind/unwind-internal.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gos-freebsd.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gos-linux.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Los-freebsd.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Los-linux.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/getcontext-freebsd.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86/getcontext-linux.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86/is_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/longjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86/offsets.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86/unwind_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Ginit.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Ginit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Ginit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gos-freebsd.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gos-linux.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gstash_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Gtrace.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lcreate_addr_space.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lget_proc_info.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lget_save_loc.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lglobal.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Linit.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Linit_local.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Linit_remote.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lis_signal_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Los-freebsd.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Los-linux.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lregs.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lresume.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lstash_frame.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Lstep.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/Ltrace.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/getcontext.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/init.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/is_fpreg.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/longjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/offsets.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/regname.c create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/siglongjmp.S create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/ucontext_i.h create mode 100644 sdk/cpprt/linux/libunwind/src/x86_64/unwind_i.h create mode 100644 sdk/cpprt/linux/pthread_compat.h create mode 100644 sdk/cpprt/linux/stdexcept.cc create mode 100644 sdk/cpprt/linux/terminate.cc create mode 100644 sdk/cpprt/linux/typeinfo.cc create mode 100644 sdk/cpprt/linux/typeinfo.h create mode 100644 sdk/cpprt/linux/unwind-arm.h create mode 100644 sdk/cpprt/linux/unwind-itanium.h create mode 100644 sdk/cpprt/linux/unwind.h create mode 100644 sdk/cpprt/memory_manage/delete1.cpp create mode 100644 sdk/cpprt/memory_manage/delete2.cpp create mode 100644 sdk/cpprt/memory_manage/delete3.cpp create mode 100644 sdk/cpprt/memory_manage/delete4.cpp create mode 100644 sdk/cpprt/memory_manage/delete5.cpp create mode 100644 sdk/cpprt/memory_manage/delete6.cpp create mode 100644 sdk/cpprt/memory_manage/new1.cpp create mode 100644 sdk/cpprt/memory_manage/new2.cpp create mode 100644 sdk/cpprt/memory_manage/new3.cpp create mode 100644 sdk/cpprt/memory_manage/new4.cpp create mode 100644 sdk/cpprt/memory_manage/new5.cpp create mode 100644 sdk/cpprt/memory_manage/new6.cpp create mode 100644 sdk/cpprt/memory_manage/new_handler.cpp create mode 100644 sdk/cpprt/tstdcxx_version.cpp create mode 100644 sdk/debugger_interface/linux/Makefile create mode 100644 sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_cmd create mode 100755 sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py create mode 100755 sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py create mode 100755 sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py create mode 100755 sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py create mode 100644 sdk/debugger_interface/linux/ptrace_version.c create mode 100644 sdk/debugger_interface/linux/se_ptrace.c create mode 100644 sdk/ec_dh_lib/Makefile create mode 100644 sdk/ec_dh_lib/ec_dh.cpp create mode 100644 sdk/ec_dh_lib/sgx_dh_internal.h create mode 100644 sdk/edger8r/linux/Ast.ml create mode 100644 sdk/edger8r/linux/CodeGen.ml create mode 100644 sdk/edger8r/linux/Edger8r.ml create mode 100644 sdk/edger8r/linux/Lexer.mll create mode 100644 sdk/edger8r/linux/Makefile create mode 100644 sdk/edger8r/linux/Parser.mly create mode 100644 sdk/edger8r/linux/SimpleStack.ml create mode 100644 sdk/edger8r/linux/Util.ml create mode 100644 sdk/sample_libcrypto/Makefile create mode 100644 sdk/sample_libcrypto/sample_libcrypto.cpp create mode 100644 sdk/sample_libcrypto/sample_libcrypto.h create mode 100644 sdk/sample_libcrypto/sample_libcrypto.lds create mode 100644 sdk/selib/linux/Makefile create mode 100644 sdk/selib/sgx_create_report.cpp create mode 100644 sdk/selib/sgx_get_key.cpp create mode 100644 sdk/selib/sgx_verify_report.cpp create mode 100644 sdk/selib/tservice_version.cpp create mode 100644 sdk/sign_tool/SignTool/Makefile create mode 100644 sdk/sign_tool/SignTool/README.txt create mode 100644 sdk/sign_tool/SignTool/elf_helper.h create mode 100644 sdk/sign_tool/SignTool/enclave_creator_sign.cpp create mode 100644 sdk/sign_tool/SignTool/enclave_creator_sign.h create mode 100644 sdk/sign_tool/SignTool/manage_metadata.cpp create mode 100644 sdk/sign_tool/SignTool/manage_metadata.h create mode 100644 sdk/sign_tool/SignTool/parse_key_file.cpp create mode 100644 sdk/sign_tool/SignTool/parse_key_file.h create mode 100644 sdk/sign_tool/SignTool/sign_tool.cpp create mode 100644 sdk/sign_tool/SignTool/util_st.cpp create mode 100644 sdk/sign_tool/SignTool/util_st.h create mode 100644 sdk/simulation/Makefile create mode 100644 sdk/simulation/SEConfigureCPUSVN/linux/Makefile create mode 100644 sdk/simulation/SEConfigureCPUSVN/linux/config_cpusvn.cpp create mode 100644 sdk/simulation/SEConfigureCPUSVN/linux/cpusvn_helper.h create mode 100644 sdk/simulation/assembly/Makefile create mode 100644 sdk/simulation/assembly/linux/Makefile create mode 100644 sdk/simulation/assembly/linux/gnu_tls.h create mode 100644 sdk/simulation/assembly/linux/lowlib.S create mode 100644 sdk/simulation/assembly/linux/sgxsim.S create mode 100644 sdk/simulation/assembly/linux/sw_emu.h create mode 100644 sdk/simulation/assembly/lowlib.h create mode 100644 sdk/simulation/assembly/sgxsim.h create mode 100644 sdk/simulation/driver_api/Makefile create mode 100644 sdk/simulation/driver_api/driver_api.cpp create mode 100644 sdk/simulation/tae_service_sim/Makefile create mode 100644 sdk/simulation/tae_service_sim/tae_service_sim.cpp create mode 100644 sdk/simulation/tinst/Makefile create mode 100644 sdk/simulation/tinst/deriv.cpp create mode 100644 sdk/simulation/tinst/deriv.h create mode 100644 sdk/simulation/tinst/rts_sim.h create mode 100644 sdk/simulation/tinst/t_instructions.cpp create mode 100644 sdk/simulation/tinst/t_instructions.h create mode 100644 sdk/simulation/trtssim/Makefile create mode 100644 sdk/simulation/trtssim/linux/Makefile create mode 100644 sdk/simulation/uae_service_sim/licensing_sim.cpp create mode 100644 sdk/simulation/uae_service_sim/linux/Makefile create mode 100644 sdk/simulation/uae_service_sim/linux/platform_service_sim.cpp create mode 100644 sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version create mode 100644 sdk/simulation/uae_service_sim/platform_service_sim_com.cpp create mode 100644 sdk/simulation/uae_service_sim/quoting_sim.cpp create mode 100644 sdk/simulation/uae_service_sim/uae_service_deploy.c create mode 100644 sdk/simulation/uae_service_sim/uae_service_sim.h create mode 100644 sdk/simulation/uinst/Makefile create mode 100644 sdk/simulation/uinst/enclave_mngr.cpp create mode 100644 sdk/simulation/uinst/enclave_mngr.h create mode 100644 sdk/simulation/uinst/linux/Makefile create mode 100644 sdk/simulation/uinst/linux/get_tcs.c create mode 100644 sdk/simulation/uinst/linux/restore_tls.c create mode 100644 sdk/simulation/uinst/linux/set_tls.c create mode 100644 sdk/simulation/uinst/td_mngr.h create mode 100644 sdk/simulation/uinst/u_instructions.cpp create mode 100644 sdk/simulation/uinst/u_instructions.h create mode 100644 sdk/simulation/urtssim/Makefile create mode 100644 sdk/simulation/urtssim/cpusvn_util.cpp create mode 100644 sdk/simulation/urtssim/cpusvn_util.h create mode 100644 sdk/simulation/urtssim/enclave_creator_sim.cpp create mode 100644 sdk/simulation/urtssim/enclave_creator_sim.h create mode 100644 sdk/simulation/urtssim/linux/Makefile create mode 100644 sdk/simulation/urtssim/urts_deploy.c create mode 100644 sdk/simulation/urtssim/urts_sim.h create mode 100644 sdk/tae_service/Makefile create mode 100644 sdk/tae_service/tae_config.h create mode 100644 sdk/tae_service/tae_service.cpp create mode 100644 sdk/tkey_exchange/Makefile create mode 100644 sdk/tkey_exchange/simple_vector.cpp create mode 100644 sdk/tkey_exchange/simple_vector.h create mode 100644 sdk/tkey_exchange/tkey_exchange.cpp create mode 100644 sdk/tkey_exchange/tkey_exchange_version.cpp create mode 100644 sdk/tlibc/Makefile create mode 100644 sdk/tlibc/gdtoa/arith.h create mode 100644 sdk/tlibc/gdtoa/dmisc.c create mode 100644 sdk/tlibc/gdtoa/dtoa.c create mode 100644 sdk/tlibc/gdtoa/gd_qnan.h create mode 100644 sdk/tlibc/gdtoa/gdtoa.c create mode 100644 sdk/tlibc/gdtoa/gdtoa.h create mode 100644 sdk/tlibc/gdtoa/gdtoaimp.h create mode 100644 sdk/tlibc/gdtoa/gethex.c create mode 100644 sdk/tlibc/gdtoa/gmisc.c create mode 100644 sdk/tlibc/gdtoa/hd_init.c create mode 100644 sdk/tlibc/gdtoa/hdtoa.c create mode 100644 sdk/tlibc/gdtoa/hexnan.c create mode 100644 sdk/tlibc/gdtoa/ldtoa.c create mode 100644 sdk/tlibc/gdtoa/locks.c create mode 100644 sdk/tlibc/gdtoa/misc.c create mode 100644 sdk/tlibc/gdtoa/smisc.c create mode 100644 sdk/tlibc/gdtoa/strtod.c create mode 100644 sdk/tlibc/gdtoa/strtodg.c create mode 100644 sdk/tlibc/gdtoa/strtof.c create mode 100644 sdk/tlibc/gdtoa/strtold.c create mode 100644 sdk/tlibc/gdtoa/strtord.c create mode 100644 sdk/tlibc/gdtoa/strtorx.c create mode 100644 sdk/tlibc/gdtoa/sum.c create mode 100644 sdk/tlibc/gdtoa/ulp.c create mode 100644 sdk/tlibc/gen/__memcpy_chk.cpp create mode 100644 sdk/tlibc/gen/__memmove_chk.cpp create mode 100644 sdk/tlibc/gen/__mempcpy_chk.cpp create mode 100644 sdk/tlibc/gen/__memset_chk.cpp create mode 100644 sdk/tlibc/gen/__stpcpy_chk.cpp create mode 100644 sdk/tlibc/gen/__stpncpy_chk.cpp create mode 100644 sdk/tlibc/gen/__strcat_chk.cpp create mode 100644 sdk/tlibc/gen/__strcpy_chk.cpp create mode 100644 sdk/tlibc/gen/__strlen_chk.cpp create mode 100644 sdk/tlibc/gen/__strncat_chk.cpp create mode 100644 sdk/tlibc/gen/__strncpy_chk.cpp create mode 100644 sdk/tlibc/gen/__vsnprintf_chk.cpp create mode 100644 sdk/tlibc/gen/__vsprintf_chk.cpp create mode 100644 sdk/tlibc/gen/alloca.S create mode 100644 sdk/tlibc/gen/assert.c create mode 100644 sdk/tlibc/gen/ctype_.c create mode 100644 sdk/tlibc/gen/ctype_private.h create mode 100644 sdk/tlibc/gen/errlist.c create mode 100644 sdk/tlibc/gen/errno.c create mode 100644 sdk/tlibc/gen/infinity.c create mode 100644 sdk/tlibc/gen/isctype.c create mode 100644 sdk/tlibc/gen/nan.c create mode 100644 sdk/tlibc/gen/sbrk.c create mode 100644 sdk/tlibc/gen/se_cpuid.c create mode 100644 sdk/tlibc/gen/spinlock.c create mode 100644 sdk/tlibc/gen/tolower_.c create mode 100644 sdk/tlibc/gen/toupper_.c create mode 100644 sdk/tlibc/locale/btowc.c create mode 100644 sdk/tlibc/locale/mblen.c create mode 100644 sdk/tlibc/locale/mbrlen.c create mode 100644 sdk/tlibc/locale/mbstowcs.c create mode 100644 sdk/tlibc/locale/mbtowc.c create mode 100644 sdk/tlibc/locale/multibyte_citrus_none.c create mode 100644 sdk/tlibc/locale/runetype.h create mode 100644 sdk/tlibc/locale/wcscoll.c create mode 100644 sdk/tlibc/locale/wcstombs.c create mode 100644 sdk/tlibc/locale/wcsxfrm.c create mode 100644 sdk/tlibc/locale/wctob.c create mode 100644 sdk/tlibc/locale/wctomb.c create mode 100644 sdk/tlibc/math/w_drem.c create mode 100644 sdk/tlibc/math/w_dremf.c create mode 100644 sdk/tlibc/math/w_dreml.c create mode 100644 sdk/tlibc/math/w_pow10.c create mode 100644 sdk/tlibc/math/w_pow10f.c create mode 100644 sdk/tlibc/math/w_pow10l.c create mode 100644 sdk/tlibc/stdio/fileext.h create mode 100644 sdk/tlibc/stdio/floatio.h create mode 100644 sdk/tlibc/stdio/fvwrite.c create mode 100644 sdk/tlibc/stdio/fvwrite.h create mode 100644 sdk/tlibc/stdio/local.h create mode 100644 sdk/tlibc/stdio/snprintf.c create mode 100644 sdk/tlibc/stdio/swprintf.c create mode 100644 sdk/tlibc/stdio/vfprintf.c create mode 100644 sdk/tlibc/stdio/vfwprintf.c create mode 100644 sdk/tlibc/stdio/vsnprintf.c create mode 100644 sdk/tlibc/stdio/vswprintf.c create mode 100644 sdk/tlibc/stdio/wcio.h create mode 100644 sdk/tlibc/stdlib/abs.c create mode 100644 sdk/tlibc/stdlib/atof.c create mode 100644 sdk/tlibc/stdlib/atoi.c create mode 100644 sdk/tlibc/stdlib/atol.c create mode 100644 sdk/tlibc/stdlib/atoll.c create mode 100644 sdk/tlibc/stdlib/bsearch.c create mode 100644 sdk/tlibc/stdlib/div.c create mode 100644 sdk/tlibc/stdlib/imaxabs.c create mode 100644 sdk/tlibc/stdlib/imaxdiv.c create mode 100644 sdk/tlibc/stdlib/labs.c create mode 100644 sdk/tlibc/stdlib/ldiv.c create mode 100644 sdk/tlibc/stdlib/llabs.c create mode 100644 sdk/tlibc/stdlib/lldiv.c create mode 100755 sdk/tlibc/stdlib/malloc.c create mode 100644 sdk/tlibc/stdlib/qsort.c create mode 100644 sdk/tlibc/stdlib/strtoimax.c create mode 100644 sdk/tlibc/stdlib/strtol.c create mode 100644 sdk/tlibc/stdlib/strtoll.c create mode 100644 sdk/tlibc/stdlib/strtoul.c create mode 100644 sdk/tlibc/stdlib/strtoull.c create mode 100644 sdk/tlibc/stdlib/strtoumax.c create mode 100644 sdk/tlibc/string/bcmp.c create mode 100644 sdk/tlibc/string/bcopy.c create mode 100644 sdk/tlibc/string/bzero.c create mode 100644 sdk/tlibc/string/consttime_memequal.c create mode 100644 sdk/tlibc/string/ffs.c create mode 100644 sdk/tlibc/string/ffsl.c create mode 100644 sdk/tlibc/string/ffsll.c create mode 100644 sdk/tlibc/string/index.c create mode 100644 sdk/tlibc/string/memchr.c create mode 100644 sdk/tlibc/string/memcmp.c create mode 100644 sdk/tlibc/string/memcpy.c create mode 100644 sdk/tlibc/string/memmove.c create mode 100644 sdk/tlibc/string/mempcpy.c create mode 100644 sdk/tlibc/string/memset.c create mode 100644 sdk/tlibc/string/memset_s.c create mode 100644 sdk/tlibc/string/rindex.c create mode 100644 sdk/tlibc/string/se_string_init.c create mode 100644 sdk/tlibc/string/stpncpy.c create mode 100644 sdk/tlibc/string/strcasecmp.c create mode 100644 sdk/tlibc/string/strchr.c create mode 100644 sdk/tlibc/string/strcmp.c create mode 100644 sdk/tlibc/string/strcoll.c create mode 100644 sdk/tlibc/string/strcspn.c create mode 100644 sdk/tlibc/string/strerror.c create mode 100644 sdk/tlibc/string/strerror_r.c create mode 100644 sdk/tlibc/string/strlcpy.c create mode 100644 sdk/tlibc/string/strlen.c create mode 100644 sdk/tlibc/string/strncat.c create mode 100644 sdk/tlibc/string/strncmp.c create mode 100644 sdk/tlibc/string/strncpy.c create mode 100644 sdk/tlibc/string/strndup.c create mode 100644 sdk/tlibc/string/strnlen.c create mode 100644 sdk/tlibc/string/strpbrk.c create mode 100644 sdk/tlibc/string/strrchr.c create mode 100644 sdk/tlibc/string/strspn.c create mode 100644 sdk/tlibc/string/strstr.c create mode 100644 sdk/tlibc/string/strtok.c create mode 100644 sdk/tlibc/string/strxfrm.c create mode 100644 sdk/tlibc/string/wcschr.c create mode 100644 sdk/tlibc/string/wcscmp.c create mode 100644 sdk/tlibc/string/wcscspn.c create mode 100644 sdk/tlibc/string/wcslcpy.c create mode 100644 sdk/tlibc/string/wcslen.c create mode 100644 sdk/tlibc/string/wcsncat.c create mode 100644 sdk/tlibc/string/wcsncmp.c create mode 100644 sdk/tlibc/string/wcsncpy.c create mode 100644 sdk/tlibc/string/wcspbrk.c create mode 100644 sdk/tlibc/string/wcsrchr.c create mode 100644 sdk/tlibc/string/wcsspn.c create mode 100644 sdk/tlibc/string/wcsstr.c create mode 100644 sdk/tlibc/string/wcstok.c create mode 100644 sdk/tlibc/string/wcswcs.c create mode 100644 sdk/tlibc/string/wmemchr.c create mode 100644 sdk/tlibc/string/wmemcmp.c create mode 100644 sdk/tlibc/string/wmemcpy.c create mode 100644 sdk/tlibc/string/wmemmove.c create mode 100644 sdk/tlibc/string/wmemset.c create mode 100644 sdk/tlibc/time/asctime.c create mode 100644 sdk/tlibc/time/difftime.c create mode 100644 sdk/tlibc/time/private.h create mode 100644 sdk/tlibc/time/strftime.c create mode 100644 sdk/tlibc/time/tzfile.h create mode 100644 sdk/tlibc/tstdc_version.cpp create mode 100644 sdk/tlibcrypto/Makefile create mode 100644 sdk/tlibcrypto/init_crypto_lib.cpp create mode 100644 sdk/tlibcrypto/sgx_aes_ctr.cpp create mode 100644 sdk/tlibcrypto/sgx_aes_gcm.cpp create mode 100644 sdk/tlibcrypto/sgx_cmac128.cpp create mode 100644 sdk/tlibcrypto/sgx_ecc256.cpp create mode 100644 sdk/tlibcrypto/sgx_ecc256_common.cpp create mode 100644 sdk/tlibcrypto/sgx_ecc256_common.h create mode 100644 sdk/tlibcrypto/sgx_ecc256_ecdsa.cpp create mode 100644 sdk/tlibcrypto/sgx_sha256.cpp create mode 100644 sdk/tlibcrypto/sgx_sha256_msg.cpp create mode 100644 sdk/tlibcrypto/tcrypto_version.cpp create mode 100644 sdk/tlibstdcxx/Makefile create mode 100644 sdk/tlibstdcxx/README.sgx create mode 100755 sdk/tlibstdcxx/etc/stlport.natvis create mode 100644 sdk/tlibstdcxx/src/_stdio_file.h create mode 100644 sdk/tlibstdcxx/src/acquire_release.h create mode 100644 sdk/tlibstdcxx/src/aligned_buffer.h create mode 100644 sdk/tlibstdcxx/src/allocators.cpp create mode 100644 sdk/tlibstdcxx/src/bitset.cpp create mode 100644 sdk/tlibstdcxx/src/c_locale.c create mode 100644 sdk/tlibstdcxx/src/c_locale.h create mode 100644 sdk/tlibstdcxx/src/c_locale_dummy/c_locale_dummy.c create mode 100644 sdk/tlibstdcxx/src/c_locale_glibc/c_locale_glibc2.c create mode 100644 sdk/tlibstdcxx/src/codecvt.cpp create mode 100644 sdk/tlibstdcxx/src/collate.cpp create mode 100644 sdk/tlibstdcxx/src/complex.cpp create mode 100644 sdk/tlibstdcxx/src/complex_io.cpp create mode 100644 sdk/tlibstdcxx/src/complex_trig.cpp create mode 100644 sdk/tlibstdcxx/src/ctype.cpp create mode 100644 sdk/tlibstdcxx/src/cxa.c create mode 100644 sdk/tlibstdcxx/src/details/fstream_stdio.cpp create mode 100644 sdk/tlibstdcxx/src/details/fstream_unistd.cpp create mode 100644 sdk/tlibstdcxx/src/dll_main.cpp create mode 100644 sdk/tlibstdcxx/src/facets_byname.cpp create mode 100644 sdk/tlibstdcxx/src/fstream.cpp create mode 100644 sdk/tlibstdcxx/src/ios.cpp create mode 100644 sdk/tlibstdcxx/src/iostream.cpp create mode 100644 sdk/tlibstdcxx/src/istream.cpp create mode 100644 sdk/tlibstdcxx/src/locale.cpp create mode 100644 sdk/tlibstdcxx/src/locale_catalog.cpp create mode 100644 sdk/tlibstdcxx/src/locale_impl.cpp create mode 100644 sdk/tlibstdcxx/src/locale_impl.h create mode 100644 sdk/tlibstdcxx/src/lock_free_slist.h create mode 100644 sdk/tlibstdcxx/src/message_facets.h create mode 100644 sdk/tlibstdcxx/src/messages.cpp create mode 100644 sdk/tlibstdcxx/src/monetary.cpp create mode 100644 sdk/tlibstdcxx/src/num_get.cpp create mode 100644 sdk/tlibstdcxx/src/num_get_float.cpp create mode 100644 sdk/tlibstdcxx/src/num_put.cpp create mode 100644 sdk/tlibstdcxx/src/num_put_float.cpp create mode 100644 sdk/tlibstdcxx/src/numpunct.cpp create mode 100644 sdk/tlibstdcxx/src/ostream.cpp create mode 100644 sdk/tlibstdcxx/src/sparc_atomic.s create mode 100644 sdk/tlibstdcxx/src/sparc_atomic64.s create mode 100644 sdk/tlibstdcxx/src/sstream.cpp create mode 100644 sdk/tlibstdcxx/src/stdio_streambuf.cpp create mode 100644 sdk/tlibstdcxx/src/stdio_streambuf.h create mode 100644 sdk/tlibstdcxx/src/stlport_prefix.h create mode 100644 sdk/tlibstdcxx/src/string.cpp create mode 100644 sdk/tlibstdcxx/src/strstream.cpp create mode 100644 sdk/tlibstdcxx/src/time_facets.cpp create mode 100644 sdk/tlibstdcxx/src/warning_disable.h create mode 100644 sdk/tlibstdcxx/stlport/algorithm create mode 100644 sdk/tlibstdcxx/stlport/assert.h create mode 100644 sdk/tlibstdcxx/stlport/bitset create mode 100644 sdk/tlibstdcxx/stlport/cassert create mode 100644 sdk/tlibstdcxx/stlport/cctype create mode 100644 sdk/tlibstdcxx/stlport/cerrno create mode 100644 sdk/tlibstdcxx/stlport/cfloat create mode 100644 sdk/tlibstdcxx/stlport/ciso646 create mode 100644 sdk/tlibstdcxx/stlport/climits create mode 100644 sdk/tlibstdcxx/stlport/cmath create mode 100644 sdk/tlibstdcxx/stlport/complex create mode 100644 sdk/tlibstdcxx/stlport/cstdarg create mode 100644 sdk/tlibstdcxx/stlport/cstddef create mode 100644 sdk/tlibstdcxx/stlport/cstdio create mode 100644 sdk/tlibstdcxx/stlport/cstdlib create mode 100644 sdk/tlibstdcxx/stlport/cstring create mode 100644 sdk/tlibstdcxx/stlport/ctime create mode 100644 sdk/tlibstdcxx/stlport/ctype.h create mode 100644 sdk/tlibstdcxx/stlport/cwchar create mode 100644 sdk/tlibstdcxx/stlport/cwctype create mode 100644 sdk/tlibstdcxx/stlport/deque create mode 100644 sdk/tlibstdcxx/stlport/errno.h create mode 100644 sdk/tlibstdcxx/stlport/exception create mode 100644 sdk/tlibstdcxx/stlport/float.h create mode 100644 sdk/tlibstdcxx/stlport/functional create mode 100644 sdk/tlibstdcxx/stlport/iso646.h create mode 100644 sdk/tlibstdcxx/stlport/iterator create mode 100644 sdk/tlibstdcxx/stlport/limits create mode 100644 sdk/tlibstdcxx/stlport/limits.h create mode 100644 sdk/tlibstdcxx/stlport/list create mode 100644 sdk/tlibstdcxx/stlport/map create mode 100644 sdk/tlibstdcxx/stlport/math.h create mode 100644 sdk/tlibstdcxx/stlport/memory create mode 100644 sdk/tlibstdcxx/stlport/new create mode 100644 sdk/tlibstdcxx/stlport/new.h create mode 100644 sdk/tlibstdcxx/stlport/numeric create mode 100644 sdk/tlibstdcxx/stlport/queue create mode 100644 sdk/tlibstdcxx/stlport/set create mode 100644 sdk/tlibstdcxx/stlport/stack create mode 100644 sdk/tlibstdcxx/stlport/stdarg.h create mode 100644 sdk/tlibstdcxx/stlport/stddef.h create mode 100644 sdk/tlibstdcxx/stlport/stdexcept create mode 100644 sdk/tlibstdcxx/stlport/stdio.h create mode 100644 sdk/tlibstdcxx/stlport/stdlib.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_abbrevs.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_algo.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_algo.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_algobase.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_algobase.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_alloc.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_alloc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_auto_ptr.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_bitset.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_bitset.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_bvector.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_carray.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cctype.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_clocale.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cmath.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_codecvt.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_collate.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_complex.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_complex.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_config_compat_post.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_construct.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cprolog.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_csetjmp.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_csignal.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cstdarg.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cstddef.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cstdio.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cstdlib.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cstring.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ctime.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ctraits_fns.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ctype.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cwchar.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_cwctype.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_deque.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_deque.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_epilog.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_exception.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_facets_fwd.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_fstream.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_fstream.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_function.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_function_adaptors.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_function_base.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_hash_fun.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_hash_map.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_hash_set.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_hashtable.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_hashtable.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_heap.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_heap.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_iomanip.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ios.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_ios.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ios_base.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ioserr.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_iosfwd.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_iostream_string.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_istream.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_istream.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_istreambuf_iterator.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_iterator.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_iterator_base.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_iterator_old.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_limits.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_limits.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_list.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_list.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_locale.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_map.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_mbstate_t.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_messages_facets.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_monetary.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_monetary.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_move_construct_fwk.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_new.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_num_get.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_num_get.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_num_put.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_num_put.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_numeric.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_numeric.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_numpunct.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ostream.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_ostream.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ostreambuf_iterator.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_pair.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_prolog.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_pthread_alloc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_ptrs_specialize.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_queue.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_range_errors.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_range_errors.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_raw_storage_iter.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_relops_cont.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_relops_hash_cont.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_rope.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_rope.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_set.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_slist.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_slist.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_slist_base.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_slist_base.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_sparc_atomic.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_sstream.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_sstream.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_stack.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_stdexcept.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_stdexcept_base.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_stdexcept_base.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_stlport_version.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_stream_iterator.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_streambuf.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_streambuf.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_string.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_base.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_fwd.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_hash.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_io.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_io.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_npos.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_operators.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_sum.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_sum_methods.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_string_workaround.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_strstream.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_tempbuf.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_tempbuf.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_threads.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_threads.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_time_facets.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_time_facets.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_tree.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_tree.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_typeinfo.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_uninitialized.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_unordered_map.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_unordered_set.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_valarray.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_valarray.h create mode 100644 sdk/tlibstdcxx/stlport/stl/_vector.c create mode 100644 sdk/tlibstdcxx/stlport/stl/_vector.h create mode 100644 sdk/tlibstdcxx/stlport/stl/boost_type_traits.h create mode 100644 sdk/tlibstdcxx/stlport/stl/c_locale.h create mode 100644 sdk/tlibstdcxx/stlport/stl/char_traits.h create mode 100644 sdk/tlibstdcxx/stlport/stl/concept_checks.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_aix.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_apcc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_apple.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_as400.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_auto_link.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_bc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_como.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_cray.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_cygwin.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_dec.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_dec_vms.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_detect_dll_or_lib.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_dm.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_epilog.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_evc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_feedback.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_freebsd.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_fujitsu.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_gcc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_hpacc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_hpux.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_ibm.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_icc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_intel.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_kai.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_linux.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_mac.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_macosx.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_mlc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_msvc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_mwerks.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_native_headers.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_openbsd.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_prolog.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_sgi.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_sgx.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_solaris.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_sunprocc.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_system.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_warnings_off.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_watcom.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/_windows.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/compat.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/features.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/host.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/stl_confix.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/stl_mycomp.h create mode 100644 sdk/tlibstdcxx/stlport/stl/config/user_config.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_debug.c create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_debug.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_deque.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_hashtable.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_iterator.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_list.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_slist.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_string.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_string_sum_methods.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_tree.h create mode 100644 sdk/tlibstdcxx/stlport/stl/debug/_vector.h create mode 100644 sdk/tlibstdcxx/stlport/stl/msl_string.h create mode 100644 sdk/tlibstdcxx/stlport/stl/pointers/_deque.h create mode 100644 sdk/tlibstdcxx/stlport/stl/pointers/_list.h create mode 100644 sdk/tlibstdcxx/stlport/stl/pointers/_set.h create mode 100644 sdk/tlibstdcxx/stlport/stl/pointers/_slist.h create mode 100644 sdk/tlibstdcxx/stlport/stl/pointers/_tools.h create mode 100644 sdk/tlibstdcxx/stlport/stl/pointers/_vector.h create mode 100644 sdk/tlibstdcxx/stlport/stl/type_manips.h create mode 100644 sdk/tlibstdcxx/stlport/stl/type_traits.h create mode 100644 sdk/tlibstdcxx/stlport/string create mode 100644 sdk/tlibstdcxx/stlport/string.h create mode 100644 sdk/tlibstdcxx/stlport/time.h create mode 100644 sdk/tlibstdcxx/stlport/type_traits create mode 100644 sdk/tlibstdcxx/stlport/typeinfo create mode 100644 sdk/tlibstdcxx/stlport/typeinfo.h create mode 100644 sdk/tlibstdcxx/stlport/unordered_map create mode 100644 sdk/tlibstdcxx/stlport/unordered_set create mode 100644 sdk/tlibstdcxx/stlport/using/cstring create mode 100644 sdk/tlibstdcxx/stlport/using/export create mode 100644 sdk/tlibstdcxx/stlport/using/fstream create mode 100644 sdk/tlibstdcxx/stlport/using/h/fstream.h create mode 100644 sdk/tlibstdcxx/stlport/using/h/iomanip.h create mode 100644 sdk/tlibstdcxx/stlport/using/h/iostream.h create mode 100644 sdk/tlibstdcxx/stlport/using/h/ostream.h create mode 100644 sdk/tlibstdcxx/stlport/using/h/streambuf.h create mode 100644 sdk/tlibstdcxx/stlport/using/h/strstream.h create mode 100644 sdk/tlibstdcxx/stlport/using/iomanip create mode 100644 sdk/tlibstdcxx/stlport/using/ios create mode 100644 sdk/tlibstdcxx/stlport/using/iosfwd create mode 100644 sdk/tlibstdcxx/stlport/using/iostream create mode 100644 sdk/tlibstdcxx/stlport/using/istream create mode 100644 sdk/tlibstdcxx/stlport/using/locale create mode 100644 sdk/tlibstdcxx/stlport/using/ostream create mode 100644 sdk/tlibstdcxx/stlport/using/sstream create mode 100644 sdk/tlibstdcxx/stlport/using/streambuf create mode 100644 sdk/tlibstdcxx/stlport/using/strstream create mode 100644 sdk/tlibstdcxx/stlport/utility create mode 100644 sdk/tlibstdcxx/stlport/valarray create mode 100644 sdk/tlibstdcxx/stlport/vector create mode 100644 sdk/tlibstdcxx/stlport/wchar.h create mode 100644 sdk/tlibstdcxx/stlport/wctype.h create mode 100755 sdk/tlibthread/Makefile create mode 100644 sdk/tlibthread/sethread_cond.cpp create mode 100644 sdk/tlibthread/sethread_internal.h create mode 100644 sdk/tlibthread/sethread_mutex.cpp create mode 100644 sdk/tlibthread/sethread_utils.cpp create mode 100644 sdk/trts/Makefile create mode 100644 sdk/trts/init_enclave.cpp create mode 100644 sdk/trts/init_optimized_lib.cpp create mode 100644 sdk/trts/init_optimized_lib.h create mode 100644 sdk/trts/linux/Makefile create mode 100644 sdk/trts/linux/elf_parser.c create mode 100644 sdk/trts/linux/elf_parser.h create mode 100644 sdk/trts/linux/global_init.c create mode 100644 sdk/trts/linux/metadata_sec.S create mode 100644 sdk/trts/linux/tls_support.c create mode 100644 sdk/trts/linux/trts_pic.S create mode 100644 sdk/trts/linux/trts_pic.h create mode 100644 sdk/trts/linux/x86/Makefile create mode 100644 sdk/trts/linux/x86/setcontext.S create mode 100644 sdk/trts/linux/x86_64/Makefile create mode 100644 sdk/trts/linux/x86_64/setcontext.S create mode 100644 sdk/trts/trts.cpp create mode 100644 sdk/trts/trts_ecall.cpp create mode 100644 sdk/trts/trts_internal.h create mode 100644 sdk/trts/trts_ocall.cpp create mode 100644 sdk/trts/trts_util.cpp create mode 100644 sdk/trts/trts_util.h create mode 100644 sdk/trts/trts_veh.cpp create mode 100644 sdk/trts/trts_version.cpp create mode 100644 sdk/trts/trts_xsave.cpp create mode 100644 sdk/tseal/linux/Makefile create mode 100644 sdk/tseal/tSeal.cpp create mode 100644 sdk/tseal/tSeal_aad.cpp create mode 100644 sdk/tseal/tSeal_internal.cpp create mode 100644 sdk/tseal/tSeal_internal.h create mode 100644 sdk/tseal/tSeal_util.cpp create mode 100644 sdk/ukey_exchange/Makefile create mode 100644 sdk/ukey_exchange/ukey_exchange.cpp create mode 100644 sdk/ukey_exchange/ukey_exchange_version.cpp diff --git a/Linux_SGXEclipsePlugin/build.sh b/Linux_SGXEclipsePlugin/build.sh new file mode 100755 index 0000000000..9c36296fd6 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build.sh @@ -0,0 +1,202 @@ +#!/bin/bash +export PATH=/home/jenkins/jdk/bin/:$PATH + + +# Get the Eclipse launcher and build script to use +set -x +set -e + +TRUNK_HOME=$(cd $(pwd)/../../ ; pwd) +#gives you the posibility to overwrite eclipse, if you do not use URL +[ -n "${ECLIPSE_HOME}" ] || { echo "using default ECLIPSE_HOME=${TRUNK_HOME}/eclipse"; ECLIPSE_HOME=${TRUNK_HOME}/eclipse; } + + +BUILD_RELEASE_ID_PREFIX=Linux_SGX_1.5 + +if [ "$RELEASE_ID" != "${RELEASE_ID%$BUILD_RELEASE_ID_PREFIX*}" ]; then + echo "$BUILD_RELEASE_ID_PREFIX IS in $RELEASE_ID, so it is an triggered build. Change the RELEASE_ID to an accepted form." + temp=${RELEASE_ID#$BUILD_RELEASE_ID_PREFIX} + RELEASE_ID=v`echo ${temp} | tr -d _ | tr -d -` +else + echo "$BUILD_RELEASE_ID_PREFIX is NOT in $RELEASE_ID. Keeping the user specified RELEASE_ID." +fi + +function main() { + validate-jenkins-parameters + cleanupPreBuild + checkEnvironment + buildPlugin + archivePlugin +} + +function validate-jenkins-parameters { + validate-parameter "DELETE_CURRENT_ECLIPSE" "$DELETE_CURRENT_ECLIPSE" + [[ "ECLIPSE_DOWNLOAD_URL" != "" ]] && + echo "[WARNING] ECLIPSE_DOWNLOAD_URL is not set; assume eclipse archive is already downloaded" +} + +function validate-parameter { + local NAME="$1" + local VALUE="$2" + [[ ! -z "$VALUE" ]] || { + echo "Mandatory Jenkins parameter '\$$NAME' not set !" + exit 1 + } +} + +function cleanupPreBuild() { + ./clean.sh + + [[ "false" == "${DELETE_CURRENT_ECLIPSE}" ]] || { + forceRemoveEclipse + } +} + +function forceRemoveEclipse() { + pushd ${TRUNK_HOME} + rm -fr eclipse + popd +} + +function checkEnvironment() { + if [ ! -d "${ECLIPSE_HOME}" ]; then + echo "Eclipse does not exist" + echo "Downloading eclipse" + + getEclipse + fi + + if [ -z "$RELEASE_ID" ]; then + echo "Mandatory variable RELEASE_ID not defined; exiting" + exit + fi +} + +function getEclipse() { + local eclipseArchiveURL="${ECLIPSE_DOWNLOAD_URL}" + + pushd $TRUNK_HOME + cleanupEclipseArchive + downloadEclipse "${eclipseArchiveURL}" + unzipEclipse + installPDE + cleanupEclipseArchive + popd +} + +function cleanupEclipseArchive() { + find . -maxdepth 1 -mindepth 1 -name "*eclipse*.zip*" | xargs rm -f +} + +function downloadEclipse() { + local URL="$1" + if [[ "$1" != "" ]] ; then + echo " wget --no-proxy "$1"" + wget --no-proxy "$1" + else + echo "skip downloaded empty url" + fi + +} + +function unzipEclipse() { + pwd + rm -fr eclipse + local eclipseArchiveName="$(find . -maxdepth 1 -mindepth 1 -name "*eclipse*.zip*")" + unzip "${eclipseArchiveName}" + + [[ -d eclipse ]] || { + echo "Eclipse directory does not exist!" + exit + } + +# local eclipseFolderName=${eclipseArchiveName%.zip} +# local eclipseArchiveName="eclipse" +# mv "${eclipseFolderName}" eclipse +} + +function installPDE() { +echo "~~~~>" +pwd +${ECLIPSE_HOME}/eclipse -nosplash \ + -application org.eclipse.equinox.p2.director \ + -repository http://download.eclipse.org/eclipse/updates/4.4 \ + -destination ${ECLIPSE_HOME} \ + -installIU org.eclipse.pde.source.feature.group \ + -installIU org.eclipse.pde.feature.group +} + +function buildPlugin() { + pwd + + echo "PWD=`pwd`" + echo "ECLIPSE_HOME=$ECLIPSE_HOME" + + #BASELOCATION="$PWD/target_platform" + BASELOCATION="$ECLIPSE_HOME" + BUILDVERSION="$RELEASE_ID" + BUILDDIR="$PWD/build_directory" + BUILDCONFIG="$PWD/build_config" + LAUNCHER=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.equinox.launcher_*.jar` + BUILDFILE=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.pde.build_*/scripts/build.xml` + + # make sure we found valid files + if [ ! -f "$LAUNCHER" ]; then + echo "Installation Error: Eclipse plugin org.eclipse.equinox.launcher...jar not detected. " \ + "Found '$LAUNCHER'. Aborting." + exit 1 + fi + if [ ! -f "$BUILDFILE" ]; then + echo "Installation Error: Eclipse build file org.eclipse.pde.build_.../scripts/build.xml " \ + "not detected. Found '$BUILDFILE'. Aborting." + exit 1 + fi + + # + # -- Print configuration used and actually execute the build -- + # + echo "Eclipse configuration found:" + echo " Eclipse Home: $ECLIPSE_HOME" + echo " Launcher: $LAUNCHER" + echo " Build File: $BUILDFILE" + echo " Build Config: $BUILDCONFIG" + echo " Base Location: $BASELOCATION" + echo " Build Directory: $BUILDDIR" + echo " Build Version: $BUILDVERSION" + echo " Java: " $(which java) + java -version + +# CURRENT_DIR=$(pwd) +# ${ECLIPSE_HOME}/eclipse -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/${CURRENT_DIR}/build_directory/updatesite/sgx-eclipse-plugin -artifactRepository file:/${CURRENT_DIR}/build_directory/updatesite/featuresAndBundles -source ${CURRENT_DIR}/build_directory/ -config gtk.linux.x86 -compress -publishArtifacts +# cp ./build_directory/updatesite/featuresAndBundles/artifacts.jar ./build_directory/updatesite/sgx-eclipse-plugin/ + + java \ + -jar $LAUNCHER \ + -application org.eclipse.ant.core.antRunner \ + -buildfile $BUILDFILE \ + -DbuildDirectory=$BUILDDIR \ + -DbaseLocation=$BASELOCATION \ + -Dbuilder=$BUILDCONFIG \ + -DforceContextQualifier=$BUILDVERSION \ + -v -v -v -v + +} + +function findFirst() { + echo "enter Find First, $@" 1>&2 + for i in "$@"; do + if [ -f "$i" ]; then + echo "found $i" 1>&2 + echo "$i" + return + fi + done +} + +function archivePlugin() { + pushd build_directory/updatesite/sgx-eclipse-plugin + zip -r Intel-sgx-eclipse-plugin.zip * + popd +} + +main diff --git a/Linux_SGXEclipsePlugin/build_config/allElements.xml b/Linux_SGXEclipsePlugin/build_config/allElements.xml new file mode 100644 index 0000000000..0bb5016556 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_config/allElements.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_config/build.properties b/Linux_SGXEclipsePlugin/build_config/build.properties new file mode 100644 index 0000000000..beda7eaf99 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_config/build.properties @@ -0,0 +1,307 @@ + +############################################################################### +# Copyright (c) 2003, 2011 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +# Compuware Corporation - Sebastien Angers +# - Enabled additional mirror slicingOptions in Headless PDE Build +# - Enabled 'raw' attribute for mirror step in Headless PDE Build +# - https://bugs.eclipse.org/338878 +############################################################################### +##################### +# Parameters describing how and where to execute the build. +# Typical users need only update the following properties: +# baseLocation - where things you are building against are installed +# bootclasspath - The base jars to compile against (typicaly rt.jar) +# configs - the list of {os, ws, arch} configurations to build. +# +# Of course any of the settings here can be overridden by spec'ing +# them on the command line (e.g., -DbaseLocation=d:/eclipse + +#The type of the top level element we are building, generally "feature" +topLevelElementType = feature +#The id of the top level element we are building +# the following feature will not be include in the final archive +topLevelElementId = com.intel.sgx.build.driver + +############# PRODUCT/PACKAGING CONTROL ############# +#product=/plugin or feature id/path/to/.product +#product=com.intel.sgx.feature +runPackager=false + +#Set the name of the archive that will result from the product build. +#archiveNamePrefix= + +# The prefix that will be used in the generated archive. +archivePrefix=sgx-eclipse-plugin + +# The location underwhich all of the build output will be collected. +collectingFolder=${archivePrefix} + +# The list of {os, ws, arch} configurations to build. This +# value is a '&' separated list of ',' separate triples. For example, +# configs=win32,win32,x86 & linux,motif,x86 +# By default the value is *,*,* +configs = *, *, * +#configs=win32, win32, x86 & \ +# win32,win32,x86_64 & \ +# win32,win32,wpf & \ +# linux, gtk, ppc & \ +# linux, gtk, x86 & \ +# linux, gtk, x86_64 & \ +# linux, motif, x86 & \ +# solaris, motif, sparc & \ +# solaris, gtk, sparc & \ +# aix, motif, ppc & \ +# hpux, motif, ia64_32 & \ +# macosx, carbon, ppc & \ +# macosx, carbon, x86 & \ +# macosx, cocoa, ppc & \ +# macosx, cocoa, x86 & \ +# macosx, cocoa, x86_64 + +# By default PDE creates one archive (result) per entry listed in the configs property. +# Setting this value to true will cause PDE to only create one output containing all +# artifacts for all the platforms listed in the configs property. +# To control the output format for the group, add a "group, group, group - " entry to the +# archivesFormat. +#groupConfigurations=true + +#The format of the archive. By default a zip is created using antZip. +#The list can only contain the configuration for which the desired format is different than zip. +#archivesFormat=win32, win32, x86 - antZip& \ +# linux, gtk, ppc - antZip &\ +# linux, gtk, x86 - antZip& \ +# linux, gtk, x86_64 - antZip& \ +# linux, motif, x86 - antZip& \ +# solaris, motif, sparc - antZip& \ +# solaris, gtk, sparc - antZip& \ +# aix, motif, ppc - antZip& \ +# hpux, motif, PA_RISC - antZip& \ +# macosx, carbon, ppc - antZip + +#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. +allowBinaryCycles = true + +#Sort bundles depenedencies across all features instead of just within a given feature. +#flattenDependencies = true + +#Parallel compilation, requires flattenedDependencies=true +#parallelCompilation=true +#parallelThreadCount= +#parallelThreadsPerProcessor= + +#Set to true if you want the output to be ready for an update jar (no site.xml generated) +outputUpdateJars = true + +#Set to true for Jnlp generation +#codebase should be a URL that will be used as the root of all relative URLs in the output. +#generateJnlp=false +#jnlp.codebase= +#jnlp.j2se= +#jnlp.locale= +#jnlp.generateOfflineAllowed=true or false generate attribute in the generated features +#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built + +#Set to true if you want to sign jars +#signJars=false +#sign.alias= +#sign.keystore= +#sign.storepass= +#sign.keypass= + +#Arguments to send to the zip executable +zipargs= + +#Arguments to send to the tar executable +tarargs= + +#individualSourceBundles=true + +#Control the creation of a file containing the version included in each configuration - on by default +#generateVersionsLists=false + +############ REPO MIRROR OPTIONS CONTROL ############ +# Default values for the slicingOptions and raw attribute of the p2.mirror Ant target used to generate the p2 repo (buildRepo) +# Note that the default values used by PDE/Build are different from the default values for p2.mirror's slicingOptions and raw attribute +# See http://help.eclipse.org/topic//org.eclipse.platform.doc.isv/guide/p2_repositorytasks.htm for the details +# of each setting. +#p2.mirror.slicing.filter= +#p2.mirror.slicing.followOnlyFilteredRequirements=false +#p2.mirror.slicing.followStrict=false +#p2.mirror.slicing.includeFeatures=true +#p2.mirror.slicing.includeNonGreedy=false +#p2.mirror.slicing.includeOptional=true +#p2.mirror.slicing.platformFilter= +#p2.mirror.slicing.latestVersionOnly=false + +#p2.mirror.raw=false + +############## SOURCE BUNDLE CONTROL ################ +# Set this property to have source bundles created and output into build repository. +# This does NOT put them in the build output (e.g., product) itself. +# Valid values are: not set, built, all. +# built = only source for bundles that are actually built/compiled in this run are output +# all = all available source is collected and output +#sourceBundleMode=all + +# When outputting autogenerated source bundles a feature is created to contain all the automatic +# source bundles. Typically this feature is not needed and can be ignored. As such, it is given a default +# name and version. These properties can be used to override the defaults. +# sourceBundleTemplateFeature - can specify an existing feature which will be augmented to form the generated source feature +# sourceBundleFeatureId - will be the id of generated source feature which contains all the generated source bundles, default value +# is sourceBundleTemplateFeature + ".source" if sourceBundleTemplateFeature is specified +#sourceBundleTemplateFeature= +#sourceBundleFeatureId= +#sourceBundleFeatureVersion= + +############## BUILD NAMING CONTROL ################ +# The directory into which the build elements are fetched and where +# the build takes place. +#buildDirectory= + +# Type of build. Used in naming the build output. Typically this value is +# one of I, N, M, S, ... +buildType=build + +# ID of the build. Used in naming the build output. +buildId=${forceContextQualifier} + +# Label for the build. Used in naming the build output +buildLabel=${buildId} + +# Timestamp for the build. Used in naming the build output +timestamp=007 + +#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. +#The value will only be applied to plugin or features indicating build.properties, qualifier = context +#forceContextQualifier= + +#Enable / disable the generation of a suffix for the features that use .qualifier. +#The generated suffix is computed according to the content of the feature +#generateFeatureVersionSuffix=true + +############# BASE CONTROL ############# +# Settings for the base Eclipse components and Java class libraries +# against which you are building. +# Base location for anything the build needs to compile against. For example, +# in most RCP app or a plug-in, the baseLocation should be the location of a previously +# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. + +base= +#baseLocation= + +#Folder containing repositories whose content is needed to compile against +#repoBaseLocation=${base}/repos +#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against +#transformedRepoLocation=${base}/transformedRepos + +#Os/Ws/Arch/nl of the eclipse specified by baseLocation +baseos=win32 +basews=win32 +basearch=x86 + +#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built +filteredDependencyCheck=false + +#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) +resolution.devMode=false + +#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) +#a location is one of: +#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo +#- a directory that contains a /plugins or /features subdirectory +#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml +#pluginPath= + +skipBase=true +eclipseURL= +eclipseBuildId= +eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip + + +############# MAP FILE CONTROL ################ +# This section defines CVS tags to use when fetching the map files from the repository. +# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml + +skipMaps=true +mapsRepo=:pserver:anonymous@example.com/path/to/repo +mapsRoot=path/to/maps +mapsCheckoutTag=HEAD + +#tagMaps=true +mapsTagTag=v${buildId} + + +############ REPOSITORY CONTROL ############### +# This section defines properties parameterizing the repositories where plugins, fragments +# bundles and features are being obtained from. + +# The tags to use when fetching elements to build. +# By default thebuilder will use whatever is in the maps. +# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the +# overriding value +# For example fetchTag=CVS=HEAD, SVN=v20050101 +# fetchTag=HEAD +skipFetch=true + + +############# JAVA COMPILER OPTIONS ############## +# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE +#bootclasspath=${java.home}/lib/rt.jar + +# specific JRE locations to compile against. These values are used to compile bundles specifying a +# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support +#CDC-1.0/Foundation-1.0= /path/to/rt.jar +#CDC-1.1/Foundation-1.1= +#OSGi/Minimum-1.0= +#OSGi/Minimum-1.1= +#JRE-1.1= +#J2SE-1.2= +#J2SE-1.3= +#J2SE-1.4= +#J2SE-1.5= +#JavaSE-1.6= +#PersonalJava-1.1= +#PersonalJava-1.2= +#CDC-1.0/PersonalBasis-1.0= +#CDC-1.0/PersonalJava-1.0= +#CDC-1.1/PersonalBasis-1.1= +#CDC-1.1/PersonalJava-1.1= + +# Specify the output format of the compiler log when eclipse jdt is used +logExtension=.log + +# Whether or not to include debug info in the output jars +javacDebugInfo=false + +# Whether or not to fail the build if there are compiler errors +javacFailOnError=true + +# Enable or disable verbose mode of the compiler +javacVerbose=true + +# Extra arguments for the compiler. These are specific to the java compiler being used. +#compilerArg= + +# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties +javacSource=1.6 + +# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. +javacTarget=1.6 + +################### CUSTOM PROPERTIES ####################################### +# repository location for update site +# comment out - this is passed in from command line +updateSiteSource=${buildDirectory}/sites +# where to place update site build +#updateSiteRoot=${user.home}/www/no_crawl/ +updateSiteRoot=${buildDirectory}/updatesite +updateSiteFolder=${archivePrefix} +updateSiteDestination=${updateSiteRoot}/${updateSiteFolder} + diff --git a/Linux_SGXEclipsePlugin/build_config/buildUpdateSite.xml b/Linux_SGXEclipsePlugin/build_config/buildUpdateSite.xml new file mode 100644 index 0000000000..a01006f811 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_config/buildUpdateSite.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_config/customAssembly.xml b/Linux_SGXEclipsePlugin/build_config/customAssembly.xml new file mode 100644 index 0000000000..ebe2861da3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_config/customAssembly.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_config/customTargets.xml b/Linux_SGXEclipsePlugin/build_config/customTargets.xml new file mode 100644 index 0000000000..0a7316b142 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_config/customTargets.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/.project b/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/.project new file mode 100644 index 0000000000..2320c4af2d --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/.project @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + com.intel.sgx.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/build.properties b/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/build.properties new file mode 100644 index 0000000000..6fe048450c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/build.properties @@ -0,0 +1,15 @@ +######################################################################### +# Copyright (c) 2016 Intel Corporation. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Eclipse Public License v1.0 # +# which accompanies this distribution, and is available at # +# http://www.eclipse.org/legal/epl-v10.html # +# # +# Contributors: # +# Intel Corporation - initial implementation and documentation # +######################################################################### + +bin.includes = feature.xml,\ + build.properties +generate.plugin@com.intel.sgx.source = com.intel.sgx.feature diff --git a/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/feature.xml b/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/feature.xml new file mode 100644 index 0000000000..f9047a713e --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/features/com.intel.sgx.feature/feature.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + The Software Guard Extensions Plug-in enables Independent Service +Vendors in developing Linux applications +with Software Guard Extensions. The Plug-in extends the C/C++ Development +tools Plug-in to allow ISVs develop secure extensions in C or +C++. The Plug-in also allows conversion of an Linux Application +project into an Linux Application project with Software Guard +Extensions. +Using the Plug-in features and SGX Plug-in Menu options, a developer +can modify the Signing keys and Enclave Configuration for an +Enclave project and can add enclaves inside a project with SGX Nature. +Once development is complete, the developer can build the Enclave +and the Linux project using the SGX SDK for Linux with Release/Debug Configurations in Simulation/Hardware +mode and Hardware Prerelease mode. + + + + All rights reserved with Intel Corporation and its Licensors. + + + + Eclipse Public License - v 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and +b) in the case of each subsequent Contributor: +i) changes to the Program, and +ii) additions to the Program; +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. + +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and +b) its license agreement: +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and +b) a copy of this Agreement must be included with each copy of the Program. +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.classpath b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.classpath new file mode 100644 index 0000000000..791c66decf --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.classpath @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.project b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.project new file mode 100644 index 0000000000..76c2e17b70 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/.project @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + com.intel.sgx.userguide + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/META-INF/MANIFEST.MF b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5db6ad6bff --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +License: Eclipse Public License Version 1.0 ("EPL") +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: SGX Eclipse Plugin Userguide +Bundle-SymbolicName: com.intel.sgx.userguide;singleton:=true +Bundle-Version: 1.0.1.qualifier +Bundle-Activator: com.intel.sgx.userguide.Activator +Bundle-Vendor: INTEL +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime +Bundle-ActivationPolicy: lazy diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/build.properties b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/build.properties new file mode 100644 index 0000000000..b148cda4b4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/build.properties @@ -0,0 +1,19 @@ +######################################################################### +# Copyright (c) 2016 Intel Corporation. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Eclipse Public License v1.0 # +# which accompanies this distribution, and is available at # +# http://www.eclipse.org/legal/epl-v10.html # +# # +# Contributors: # +# Intel Corporation - initial implementation and documentation # +######################################################################### + +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + html/,\ + *.xml diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm new file mode 100644 index 0000000000..ca61b8308c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + Adding SGX Nature to a Project + + + +

Adding SGX Nature to a Project

+

The nature of an Eclipse project is a concept defined by an Eclipse Platform which allows a plug-in to tag a project as a specific kind of project. Intel(R) Software Guard Extensions uses an SGX nature to add SGX-specific behavior to projects. Project natures are defined by plug-ins, and are typically added or removed per-project when the user performs some action defined by the plug-in.

+

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm new file mode 100644 index 0000000000..19e6eaa3f4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + Adding SGX Nature to a non-SGX project + + + +

Adding SGX Nature to a non-SGX project

+

When you have a C/C++ project created without Intel SGX, you cannot use Intel SGX support. In this case, you need to add SGX nature to this project to use Intel SGX support:

+
    +
  1. Right-click on the project root
  2. +
  3. +

    Select Software Guard Extension Tools → Add SGX Nature

    +

    + +

    +

    Add SGX Nature

    +
  4. +
+

After you add the SGX nature to your project, you should see:

+
    +
  • +

    A subdirectory sgx in the project which contains a Makefile file.

    +

    + +

    +

    Makefile for Intel(R) SGX

    +
  • +
  • +

    The Intel SGX tools as shown in the following graphic:

    +

    + +

    +

    Intel(R) SGX Tools

    +
  • +
  • +

    New configurations specific to SGX technology. You may see the configurations for the project by clicking to the down arrow of button usually found at the top of the Eclipse window:

    +

    + +

    +

    Configurations Specific to Intel(R) SGX Technology

    +
  • +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm new file mode 100644 index 0000000000..fac206c107 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + Adding an SGX Enclave + + + +

Adding an SGX Enclave

+

After you add the SGX nature to a project, you can start creating a minimal but complete skeleton for a new enclave:

+
    +
  1. Right-click on the project root in Project Explorer.
  2. +
  3. +

    Open the dialog Add New SGX Enclave by selecting Software Guard Extensions Tools → Add SGX Enclave from the contextual menu.

    +

    + +

    +

    Add New Intel® SGX Enclave Dialog

    +
  4. +
  5. +

    Choose a name for the enclave in Enclave name field. This name is used in the process of generation of the skeleton to give unicity to the source files and the name of the resulting executable, so you can add more than one enclave to the same project.

    +
      +
    • +

      If you do not select the Generate sample untrusted application checkbox, the plugin generates only a trusted file and a Makefile fragment to build and compile the trusted part. See the following graphic. All the code for the enclave, including build Makefile, is put in a directory <root>/sgx/enclave_<name> . C/C++ code for the enclave proper are in <root>/sgx/enclave_<name>/trusted.

      +

      + +

      +

      Generated Skeleton for an Enclave. The option to Generate Sample was not Used

      +
    • +
    • +

      If you select Generate sample untrusted application checkbox, a simple ready to work sample application is generated, including untrusted stubs and implementation for a sample OCALL and ECALL.

      +

      + +

      +

      Generated Sample Untrusted Application

      +
    • +
    +
  6. +
+
+

NOTE:

+

If you select the Generate sample untrusted application checkbox, ecalls from the untrusted part are not be resolved by Eclipse C/C++ indexer. These functions are marked with a red line. The declaration of these ecalls resides in the unstrusted stub header which is generated during the build proces and is not indexed by Eclipse. To resolve this problem, right-click on project root and select Index → Freshen All Files.

+
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm new file mode 100644 index 0000000000..fb0d63b836 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + Adding an SGX Trusted Library + + + +

Adding an SGX Trusted Library

+

Trusted Static Libraries helps enclave author have libraries of shared code to be reused by enclaves, in exactly the same manner as usual static libxxx.a libraries are used to share code between regular non-SGX applications. The plugin adds a command to generate the skeleton of a trusted shared library.

+

To add a new SGX Trusted Library:

+
    +
  1. +

    Open Add New SGX Static Trusted Library dialog by right-click on the root of the project and select the appropriate command from Software Guard Extensions Tools menu:

    +

    + +

    +

    Add New SGX Static Trusted Library Dialog

    +
  2. +
  3. +

    Choose a name for the library and click OK. A skeleton for a trusted library is generated in directory <root>/sgx/trustedlib_<name>:

    +

    + +

    +

    A Generated Trusted Library

    +
  4. +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm new file mode 100644 index 0000000000..c2d90ce205 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + Adding an SGX Untrusted Module + + + +

Adding an SGX Untrusted Module

+

Add an untrusted module to generate the untrusted stubs so you use an enclave, provided you have access to its .edl file. The enclave might have been built in the current project or in a different project.

+

To use trusted functionality of an enclave for which its *.edl is known, use the command Add SGX Untrusted Module:

+
    +
  1. +

    Open dialog Add Sgx Untrusted Module by right-click-ing the project root in Package Explorer and chose the command from Software Guard Extension Tools.

    +

    + +

    +

    Add SGX Untrusted Module

    +
  2. +
  3. +

    Use the Browse button to navigate the file system using a file dialog, and click OK. The untrusted module is copied to <root>/sgx/untrusted_<edl file name>. The selected *.edl is copied to the project.

    +

    + +

    +

    Copying the Untrusted Module to a Project

    +
  4. +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm new file mode 100644 index 0000000000..1f57f2335c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + Building and Running SGX Code + + + +

Building and Running SGX Code

+

This section describes the following topics about building and running SGX code:

+
    +
  • SGX build configurations
  • +
  • Running samples generated for enclaves
  • +
  + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm new file mode 100644 index 0000000000..03f9ab1eae --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + Command Reference + + + +

Command Reference

+

This topic provides the command reference for the following scenarios of using Intel(R) Software Guard Extensions Eclipse* Plug-in:

+
    +
  • Adding SGX nature to a project
  • +
  • Adding an SGX enclave
  • +
  • Adding an SGX trusted library
  • +
  • Adding an SGX untrusted module
  • +
  • Updating SGX enclave signing key
  • +
  • Updating enclave configuration files
  • +
  • Two steps sign enclave
  • +
+

All commands brought by Intel(R) Software Guard Extensions Eclipse Plug-in are available by right-clicking on the Project root in Project explorer view in menu Software Guard Extension Tools:

 

Project Explorer

  + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm new file mode 100644 index 0000000000..4c8bc41c4a --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in + + + +

Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

+

If you do not install Intel(R) SGX SDK for Linux* OS in the default location, you need to specify the path for Intel SGX SDK using the following steps:

+
    +
  1. +

    Go to Window menu ->Preferences. Enter SGX in the filter text field to quickly locate the SGX Preferences page.

    +

    + +

    +

    SGX Preference Page

    +
  2. +
  3. Enter the path for Intel SGX SDK for Linux OS in the SGX SDK Directory field.
  4. +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm new file mode 100644 index 0000000000..f3db754ab1 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + Creating a New C/C++ Project with SGX Nature + + + +

Creating a New C/C++ Project with SGX Nature

+

You can create a new project with SGX nature. To create such a project, follow these steps:

+
    +
  1. +

    Open a standard Eclipse new project: File menu → Project... . If you have installed Intel® Software Guard Extensions Eclipse Plug-in, you can see the category C/C++ with SGX Enabled in the New Project dialog.

    +

    + +

    +

    New Project

    +

    This category has 2 sub-categories, SGX C project and SGX C++ project. These sub-categories are similar to the sub-categories C Project and C++ Project of standard C/C++ category.

    +
  2. +
  3. Select one of the 2 sub-categories, SGX C project or SGX C++ project, and click Next.
  4. +
  5. Complete creating the project using the regular process of creating a standard C or C++ project.
  6. +
+
+

NOTE:

+

Projects created following the subcategories under C/C++ with SGX Enabled are identical with their standard counterparts, except that they have SGX Nature added. There is no difference between creating a C or C++ project with SGX enabled, or creating a standard C/C++ project and launch Add SGX nature from it, as described in precedent paragraph.

+
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm new file mode 100644 index 0000000000..83326534d3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + Generate Hash + + + +

Generate Hash

+

Generating hash is the first step in the 2-Steps signing process.To generate hash, use the following steps:

+
    +
  1. +

    Right-click on project root, go to Software Guard Extensions Tools menu → Two StepSigne Enclave → Generate Hash

    +

    + +

    +

    Two StepSigne Enclave - Generate Hash

    +
  2. +
  3. In the Generate Hash dialog, enter the required inputs to the corresponding fields:
    • Enter the path to the compiled enclave to be signed in the Enclave Path field. Click Select Enclave to open a file dialog to select the enclave.
    • In the Hash File Location field , enter the path of the output file that will contain signing materials. By default this file has the same file name as the unsigned enclave, with .hex extension added. To change the path, click Select File Path to open a file dialog to select the file path.
    • In the Configuration File path field, enter the path of the configuration filefor the generated hash. Click Select Config to open a dialog to select from all enclave configuration files in the project (similar with the one of the command Update Config).
  4. +
  5. +

    Click OK after you fill in all the fields. The Intel(R) SGX SDK is launched under the hood with the provided parameters and the hash file is generated. A dialog box appears to confirm the completion:

    +

    + +

    +

    Generating Hash Completion Dialog

    +
  6. +
+

You complete the first step, generating hash, in the two step signing enclave. The *.hex file may be signed with the external facility, which generates a signature for it and a public verification key.

+

If you click OK, the Generate Signed Enclave dialog appears. The required fileds in this dialog have been pre-configured with the paths of the unsigned enclave, the configuration file and of the *.hex file. To generated the final signed enclave ready for production immediately, click OK.

+

+ +

+

Generate Signed Enclave Dialog with Pre-configurations

+

If you click Cancel in the Generate Signed Enclave dialog, you can continue the signing process later using the Generate Signed Enclave command.

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm new file mode 100644 index 0000000000..f0427d7d28 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + Generate Signed Enclaves + + + +

Generate Signed Enclaves

+

Generating signed enclave is the second step in the 2-Steps signing process. You should have the following files to complete this step:

+
    +
  • The .hex file generated with Generate Hash command
  • +
  • The files produced from the external signing facility
  • +
  • The signature of the .hex file
  • +
  • The public verification key
  • +
+

To generate signed encalves, use the following steps:

+
    +
  1. +

    Right-click on the project root, and go to Software Guard Extensions Tools menu → Two Step Sign Enclave → Generate Signed Enclave.

    +

    + +

    +

    Generate Signed Enclave Dialog

    +
  2. +
  3. Enter the inputs to all the fields and click OK.
  4. +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm new file mode 100644 index 0000000000..64c4de51c9 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + Getting Started with Intel(R) Software Guard Extensions Eclipse* Plugin + + + +

Getting Started with Intel(R) Software Guard Extensions Eclipse* Plugin

+

This section contains steps to set up your Intel(R) Software Guard Extensions Eclipse* Plugin on a Linux* system, including necessary softwares, steps to install the product, and steps to configure your preferred product directory.

+

• Pre-requisites

+

• Installation Intel(R) Software Guard Extensions Eclipse* Plug-in

+

• Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

  + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm new file mode 100644 index 0000000000..ab27b83cd9 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + Installing Intel(R) Software Guard Extensions Eclipse* Plug-in + + + +

Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

+

Install Intel(R) Software Guard Extensions Eclipse* Plug-in as a regular Eclipse Plugin:

+
    +
  1. Download the zip archive of Intel(R) Software Guard Extensions Eclipse Plug-in from Intel Site
  2. +
  3. +

    Go to Help menu -> Install New Software. Click the Add button for the Work with field to open the Add Repository dialog as shown in the following graphic:

    +

    + +

    +

    Add Repository Dialog

    +
  4. +
  5. +

    Enter SGX Archive in the Name field . Click the Archive... button and select the location of the downloaded archive as shown in the following graphic:

    +

    + +

    +

    The Location of the Plugin zip Archive

    +
  6. +
  7. Press OK to add the archive as a repository.
  8. +
  9. In the Install dialog, select the Software Guard Extensions Plugin check-box and proceed with the usual steps.
  10. +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm new file mode 100644 index 0000000000..8d58e09d73 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + What is Intel(R) Software Guard Extensions? + + + +

Introducing Intel(R) Software Guard Extensions

+

Intel(R) Software Guard Extensions is a new Intel technology, whose objective is to enable a high level of protection of secrets. It operates by allocating hardware-protected memory where code and data reside. The protected memory area within an application process is called an enclave. Data within the enclave memory can only be accessed by code that resides within that enclave. Enclave code can be invoked by special instructions.

+

An enclave can be built and loaded as a shared object.

+

Throughout this document, Intel(R) SGX refers to Intel(R) Software Guard Extensions.

+

An Intel(R) SGX application design is different from the design of non- Intel(R) SGX application as it specifies dividing the application into two logical parts:

+
    +
  • Trusted part. The code that accesses the secret resides here and it is called an enclave. More than one enclave can exist in an application.
  • +
  • Untrusted part. This includes the rest of the modules in the application, that is outside in an enclave.
  • +
+

The trusted components and untrusted components are developed as separate modules.

+

The trusted part or the enclave is implemented in C or C++. It is supplied as a collection of functions and data packaged in the form of a dynamically loaded library, a DLL in Windows* OS and a shared object in Linux* OS. It may be supplied either as a pre-built signed library or as a signed shared library built during compilation of the untrusted component.

+

Enclave functions within an enclave library are wrapped by auto-generated proxy and bridge functions that simplify the mechanism of using the Intel(R) SGX technology by developers.

+

The role of these functions is to handle the following tasks:

+
    +
  • Call an enclave function from untrusted code, also called an ECALL (enclave call).
  • +
  • Call an untrusted function from within an enclave, also called an OCALL (outside call).
  • +
  • Handle interrupts.
  • +
  • Handle exceptions.
  • +
+

The proxy and bridge functions are generated by the sgx_edger8r tool provided by Intel(R) SGX SDK. It reads an edl file (Enclave Descriptor Language) which describes the functions that form the trusted and untrusted component boundaries within the application.

+

After the enclave is built, a signed version of it is created using the tool sgx_sign also provided by Intel(R) SGX SDK. It is this signed version may be loaded and executed in the encrypted memory.

+

Enclaves may have some specific properties which are added as meta-information during the signing process. The meta-information is stored in one configuration xml file per enclave, whose details may be seen in Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm new file mode 100644 index 0000000000..e65c2fbaa1 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + What can be done with Linux SGX Eclipse Plugin? + + + +

Introducing Intel(R) Software Guard Extensions Eclipse* Plugin

+

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

+

Once the SGX nature is added to a project, you will have access to the SGX commands. SGX nature adds also a folder called sgx to the root of the project, and a Makefile inside it. All resources of the project managed by Intel(R) Software Guard Extensions Eclipse Plug-inare located inside this directory. You can build and run enclaves related code using GNU* Make tool through the Makefile.

+

The plugin is generating minimal but ready-to-work code skeletons, complete with their own Makefile having all the required make targets as to call sgx_edger8r tool to generate the proxies and bridges, compile these source, generate a shared object and finally, to sign the enclave with the sgx_sign tool. This provide a starting point you may build upon.

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm new file mode 100644 index 0000000000..ae45b4eaf4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + Introduction + + + +

Introduction

+

This Developer Guide is intended for use by Independent Service Vendors who wish to harden their Linux* applications using Intel(R) SGX Technology, code named Intel(R) Software Guard Extensions. The guide describes the procedure for installation of Intel(R) SGX Plugin for Eclipse* IDE and development of Intel(R) SGX components using the plugin. The Intel(R) SGX Plugin for Eclipse leverages on the Intel(R) Software Guard Extensions Evaluation SDK, which is a collection of APIs, libraries and tools that enable you to develop, build and debug Intel(R) SGX applications in C/C++.

+

To learn more about the Intel(R) Software Guard Extensions Evaluation SDK, see the Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

  + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm new file mode 100644 index 0000000000..fd43d5c6e7 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + Legal Information + + + + +

Legal Information

+

No license (express or implied, by estoppel or otherwise) to any intellectual + property rights is granted by this document.

+

Intel disclaims all express and implied warranties, including without + limitation, the implied warranties of merchantability, fitness for a particular + purpose, and non-infringement, as well as any warranty arising from course + of performance, course of dealing, or usage in trade.

+

This document contains information on products, services and/or processes + in development.  All information provided here is subject to change + without notice. Contact your Intel representative to obtain the latest + forecast, schedule, specifications and roadmaps.

+

The products and services described may contain defects or errors known + as errata which may cause deviations from published specifications. Current + characterized errata are available on request.

+

Intel technologies features and benefits depend on system configuration + and may require enabled hardware, software or service activation. Learn + more at Intel.com, or from the OEM or retailer.

+

Copies of documents which have an order number and are referenced in + this document may be obtained by calling 1-800-548-4725 or by visiting + www.intel.com/design/literature.htm.

+

Intel, the Intel logo, Xeon, and Xeon Phi are trademarks of Intel Corporation + in the U.S. and/or other countries.

+ + + + + + + + +
+

Optimization Notice

+
+

Intel's compilers may or may not optimize to the same degree + for non-Intel microprocessors for optimizations that are not unique + to Intel microprocessors. These optimizations include SSE2, SSE3, + and SSSE3 instruction sets and other optimizations. Intel does + not guarantee the availability, functionality, or effectiveness + of any optimization on microprocessors not manufactured by Intel. + Microprocessor-dependent optimizations in this product are intended + for use with Intel microprocessors. Certain optimizations not + specific to Intel microarchitecture are reserved for Intel microprocessors. + Please refer to the applicable product User and Reference Guides + for more information regarding the specific instruction sets covered + by this notice.

+

Notice revision #20110804

+
+

* Other names and brands may be claimed as the property of others.

+

© 2016 Intel Corporation.

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm new file mode 100644 index 0000000000..462873fae3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + Pre-requisites + + + +

Pre-requisites

+

To use Intel(R) Software Guard Extensions Eclipse Plug-in, install the following softwares:

+
    +
  • Eclipse* Mars 1 with CDT IDE for C/C++ Developpers (version 4.5.1). To use this version, install Java* Development Kit (JDK) or Java* Runtime Environment (JRE) version 1.8 or above.
  • +
  • gcc/g++ tools
  • +
  • Openssl*
  • +
  • Intel(R) SGX SDK for Linux* OS
  • +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/A_Generated_Trusted_Library.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/A_Generated_Trusted_Library.png new file mode 100644 index 0000000000000000000000000000000000000000..d6cb5308c4b5a96983a45176a4ae1d996313c5c3 GIT binary patch literal 33927 zcmV)$K#sqOP)|AG00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>Dgd9mkK~#8N?fnOE z9LKuniE`t`doSkgM$AmSw;MCFyR$p@-kCe*-gA#XN9V|UN;;B`bYw_Mq7xlRkZ=S* z4+5Y8Nf6$9@4W{aXm~W*d+)vX-qp+MZjvAfNF)VHYAJv5MMrg|sjRHb{AX5HW$iNP z^}x(l7X?#{qmxC}kkI54n0yKcqB837li8G^qvMrt%LHVT*%tMD-%LiMQmM$ga%K1K z-5-7Q(a_+a)oL*q9`X}4lhGiN%1BIsT&1TlnR2yKrc%gN3WZupVXL0R;vYpHwDz|bQ-nNX0w5f zO-{gof1|;0v2mtncDAUt<91o`sf*WdH;yUwR+d1NQQMDWitLunNdjrqYBV=)Tz}`C z-5-4LL1$;j)@Nw{I2Py?gU!UTShu#_>-olU}bn`RB2QTS~diYIhoqMv%lu z1KO2@|Wm2ixWZLX4Vn%~eA(yPJVI&$CW?eFemyRv*hOyigs)|6u zv6%#$)wbynI-Qo!V=EOhaPAxTM-4dpT=oTq^p#UJX~mP}7{(VR~`nPch8ImJY=n2DdS zSE^JX^EU+nX0e!AOy=?9$KHPX?fv_|A`tNCDLmp0n8)VqSsQ)*?#HvdS*O>TJ9ZyE*t2JOvBqj~ZVCbnBo-%g=|qrY`}Xc# zURv7nqFan6g-ZEB`O#n8_+vh{Q0LHT@5|d?qtXSHvry^&bD@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|N!tn|BQIUG(er%id4NdjH^AcPA; z^to)tf#PN`KYzRNxDd5$1QKvf#4q^2A++ji{MK?2-^gih7y8Vf--uPL#vS&`%JAqA z;|rb9baBJbB~#iH`dd$N@+?5lyOx3}}P40=ey_2FI+*~c}zvvm#~(& z6`UYzuz;ZggN4mb4aM0XN{J3vstMzJW+OcAuZmBHySVaHKdD+)#F8f$_Y2Vte%n#* zM6v%&Vqse_&f?ze8V)hS9F~XwyDPV-L`D0x3Z`MmG4q?Dtg8M%J2cvsmD?6IyEeA# z=Vkrc74Q6Z#XC|~M7!{O=Wsw{DaA~WsnEK+mI!xK7b_}wXk~pyfIZIJdT|(K4sq3} z&3CnN{(xAFPDvaPm9%iX`0iZiWNg?{ehli3C=Cm`hiJ}U!JO34T5$g=Tm_|xoT30V z#Ptv+r_?obzWJQx8cAp?qS5fS|igBA-Q@ z%bUjqS5UiXM4Vm))Zl1SVzScoWbJx>pF}Um99!%6-*zO(A)P#XC#Q(Fjh+w+dt_$} z>R+qbO)liir`6|G)Z~iSth6=zwxHp4PQ9`J7kgZ#6bz=qNR;Z8yP|t$$EPJ)nH!5N z*OSKZ(95%2QdYt-+cR}zXf-)%#-3aRx z&hvjpT99$aa{T)z5aYqG|MOpC2m8k;`p19(*#e>6zij;fKfC<*ipq&p3F-U)f2UkxP5=M^ literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_New_Intel_SGX_Enclave_Dialog.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_New_Intel_SGX_Enclave_Dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..c857d803772794dd1e4d7103aa0631ad7be61bab GIT binary patch literal 35118 zcmX_mWmH>D8!b|-I26}HaVNOD7I$}df(37JFU8&6o#0U1-KDs@6~B4EyY79~%E`=+ zOlBURy-$R)qBQDf!p~4pP^hvp5~@&8FrOgfMno9M)10#)3-SdGRFxKks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R^_4c=9MO-ikM_>D=pHkUbN#(-{^ z{Q!#obY-*e<5gS6nk+VUH)?crRPr}b$aM(wjxF#OYujI}^BBKDa)GZX0QNQOG6u71 z`c^KlRE)Ysdy)3Q^Df<69OLJAzse|Re`HuSY|Dhe#t?ZA`=63M1N5AS5gEQuQMpYB zie!)`v#sO%bbn#W_sB^)A9P20$eHwC`INO^fr_EZ-|yzuPa~f^?y13Y=?CJ5j_}h*rpSc=sGq68^%d~&xsWAVX$<# zn1?$eQ|mpqIs2#%HLj?-zu00*dsBD3-B#SbS6X!OF2UM=eJRDgm`jb#_{RYM$XA%^6%I literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_New_SGX_Static_Trusted_Library_Dialog.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_New_SGX_Static_Trusted_Library_Dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..8fd22a4260b9d0f74d3c5d7a30b1d4d9ce6d1bff GIT binary patch literal 31507 zcmX_nV{~Orv~6s4$F^;EtWHjRVw)Y?NyoNrCnvU(jytwGwym4*zVYrHW21iTHCF9a zt1xF(xT3riG6Eg~7#J9`jI_8i7#IZP*Lxlu#Mhmu=E?Hw0q&$MB??wEMR5F8fHD^W zh=76B$0EKNLVuOv?WHxHz`#%j{=2|O?8;2Qz&y)j#6?uy_0GG1?)YmNj2R=h-j{P8 zt&iTNuQ|gTUP^x_Fs2Y{?W0)5CMKd-M<%{tv%*%01Y$57eR!9pq>q90Qo6jLaH^^& z09q~tKm$%A zwly+ET^H^Dg)4kg%)h84nCr&U`%lYsMMjLQA&I{J*8E`t zM7UtWZ_`;IZ~?ryA#gUx-i8piB2%LAuEvtJHSNowJ53uhk}r5;DYv~r6)Afmm7@`_ zg{YQLKKNHY%Et^5V&5Uvj}wPU8lcjN{pW+WcZKk?!12L)sWpae!Old@AirF>9V#Yf z#yJU4ceux)r>=V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Ma6MOki|dFUJ*MQksHD0RE<( ztCo0V!yvMOA|MGh;eEq55J<6yU7mvOPHTqqD7YT zffRrEs%xckzV|X40NS-3TCWuq> zubBhHw^qZTSD}@~?puGHAG!oK`No*2>^f;QZ5f7;5xeqVJ0A=;H(ZuEb+23fZyDxuQ_=lS{sTGO^ zP=w}60n1C;{OpfJ2v^6TnY%$*h#dHews=-^QyE?FEn@W{q@{?EiNn5;TlXnKx= z?&fqxuNT}xuE69Oo~vro_})PUj^c`Q_h(OSd2p*JqZ{ffpYIt|?XmUdlmsRAolqS} zdg^ca7^_fL1rDRF#ObXMJAG?sVvW3?6XXzU!Bk639yX sqmL#pIRF0+|LErbH)Uul#c+hgV!r)MpI*DI1_GLbtg1|@lu6M40W53{l>h($ literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_SGX_Nature.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Add_SGX_Nature.png new file mode 100644 index 0000000000000000000000000000000000000000..d6dbf14a6d3b35fe0075479cf696871c4bb85967 GIT binary patch literal 146667 zcmV*7Kytr{P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D|D{PpK~#8N?0pAd z9mSdd_I9;m%aSe0y&GfG!SoIxfshc=b9cE*xx4fu_rFVWsU(3Ugccz5-oZBR zy~<5i@2|J*yZ>)?pJZ89W@l$-W@o@m)GzRpoly#V+?Dd zNfgzH0~b~JkD`4@7SM2l7@dTQvd{Z0QFij&e99z*mt%gk=*u1d^4?4Y0 zJ0H#Rl1wph9Wok2Jt(201NC(BeiJ54m@x5i0>9>}i}PMMAuukhNvv<`^l4KoLKZ?z z4<6dSY5QPS#Ta@hYPsy6|M}*U!QcGwr>oONO><^UuPL-MI2Z5SwP|x#R3NOZEb_UW z$U5u{NdN=k1g=VAHY>1p;4R|#%04I9>K4tb4?0+ep$LMcg_gJ9YUvu1EiB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_DfQ+a27d1Nok`1tWEJHwSgn;faZf`T2>F`S}s7a~~3kKp@7(=4NKFqY;;o5EKy+ z0Rn-tva+J0qEb@OhK4Ha_OY>%Saxl5bMuD9oSDm5k9WQj2m4V~)_hu__~zsP0UueB ARR910 literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generate_Signed_Enclave_Dialog_with_Pre_configurations.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generate_Signed_Enclave_Dialog_with_Pre_configurations.png new file mode 100644 index 0000000000000000000000000000000000000000..538d68743a0e0b7c2b35c81f5c51c56ac4096d51 GIT binary patch literal 82977 zcmXV01yCGavqghjaJL|V;O-KFYj9m0g1awH2)4Le0>MIXcXxMpcb8ojc;x$ES4~aL z)KtyAx4TdG>Fx+sWf=@q5>yx%7z{aCsjo0Fa0xIluu{lyZ*NE~(zsB*W8=tr<|GxQQx1`WDL$knIFleYb+Ad|0gUVo%Nrh=%NVOg6?J$vU=r; zd=qkVj@D;Jo^wXOmgQYE44d1~$qaCl6Sx8$|Rh7e&uD-s$A)>0--_K&q;r=P9SUP$}g}?p@c<1sf?8c)2wgSNj z>(5Q3!;gJ7yJ7JliS(Zv(2zWv{EVF3{_L#G-kznbjHQfajDel{eP zn|t;d@9wUS`#*V2Xr=aM6ZjPGF;$Dk7&tw%FHQBgtZXc4yq*_+?9AE`9m2xem#W?Ia(v7OFnl8Qd)@|+{3jV5i9M)K zg5s%;0k7Wz#mt<32KZ)T?Qc>Be)MwFI2=1UXoo_t7XU^@|DDAzaP}p}-9?=~9~q@s ztB5FX|IU>t5gFOz^$l}wfX~s$M8)*ve*(p9@?PVhW{vFG^Pikv_1fDmVH1TP1}=fl zAk%XrR%`%aS1`?EYICE<9vQM2+1Y^K)e`f1*!@;1#p*(Csl~Hd0(9#nNhJEYC87&c{&(1yF5e2R4Rb(Jvg^? z`kQ^3+7m`?w|PQK!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*GfK-c3k&Sq zb{^WWtuGXn8uu($#r8Qf&mLDe8_jak<_04OOp&swYK={_V(B98|df=`G(@4ZB*$;~ zL?VK6jA{ZzFbtWNW_G(x1_KfFCt6wp`}Xwj*w(x1!^Z2cf9j>BJ7lphH>2~7*M9Zf z^Y@>1_LLibReQxXHQEGYcnT&<1REx0Ft^Dk!d9ETh^8QGtKRB?u#V2yLWnHLn3NMy5F{(~_NSceZYCBKdq@W{pC-$7Ua!d@m|wQ&+mQU z?^~9=RZo)OBNGBoCBl>hCYeb2&`A+PInu19qoXsX;AhW&Q~Oh)jiSL!7-)l{V3G*` zp&`*IBMVK`H`X0Iw990YE6b|O%Vv`V9gnlxAWiVVNs7i)S>;(Uzhu(*YUWm31q2Bg z>@QrxJDcucb zf|1uGtzra4V&dpFE!v3MwA=-G2|XUx(K#{j`P1$br35N+LK5SG6q9A1AaSG7YBoFL z39--HHNJR!UT!6hQ)pd0F3PeYmW}dUOcZz!Dn*)U+Dg-As8E!}fOaitEllJ;YaTRV vpwxu3>CU7b*2Za}@zS~-*3mgpFzo*Wqf+k=B?S~V00000NkvXXu0mjf1|tbg literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generated_Skeleton_for_an_Enclave.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generated_Skeleton_for_an_Enclave.png new file mode 100644 index 0000000000000000000000000000000000000000..55e27af3ab52a4091c6b59f4a8e24ca47d4ecdee GIT binary patch literal 28990 zcmV)*K#9MJP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>DaMMXdK~#8N?fnOM zW5RXy z1Bd?G_closE}ypxfj}UTZz2ai_|~5@w&@C$QY;orZUClJ3UJC&sWfr!kW?V~hu@0` zAQbMGfF273@?<#h{|&14x&MvX?JP$vy&#UoVhN=lX0sXG-R$h_00ksv z0QrUjigQq|v)OEL50?-;>U)h&C{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hi-(VmjH6^)|mRVt#(X75OnA+mWcKV*xYd*)pAxK&Kwa+fe&1#wmPdOy3zK+ZejD*W8r=?T9;;u z?{%q;FTy{bDHCKB)(dO_1tKZ%Eg95F7h0nRJ@OlzY=JQ{qwOn(;t*DdDj6UV<=p>kKYMcyih%_IhByE^U{U@1;1jC_i9EZogejqZh^J-7-$ zx})z>FQSrtqm5|+w+nJ?XqDpXbPu(S|7Dp0n~`Q(BYJ_IC~7fjDU*IS@MtGB`l4P6 z&;QPV1+xRy-lPOPr68O#unp}1zIllM4SIjl2}KXrV$Q12@!#Mb+b;uSdL+*W!pG;+ z@P)#HoTIc=(AIP)&=-BmF$Yt=nnqw47ZvTaLmayc=~zJXJRAsSbZN|joB{aBY$ckK zeG;#h8-hehoStmPqZC9`A}`o>8v}pNEiMW-2aCw-K;R`76jNY}0q14<-YvYT@-qah zKj8@We#G5tJho^cxaV26!&Ek-8Y6Ae!Fxm_u8(q^U$)Pe!U*o8bAr QH=u9AVeHV4EW8r`2fdo*aR2}S literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Intel_SGX_Tools.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Intel_SGX_Tools.png new file mode 100644 index 0000000000000000000000000000000000000000..fb9ec29775ec7d14913537bc72a28ab5076a2ae3 GIT binary patch literal 46580 zcmV*1KzP52P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>DwTVeYK~#8N?EQ6g zBuT#KiQaSG?s@yy%(=7k_RY+`-GRGz?!DbrnJEQ12Xlx*%*@QpETyDOL5i7~SrKAR z#>%Q>QVLR#T-DuG&paZeR4J>vyRx#2I_!LpSSlW-xNBQF~q9zGLfXKiL>BoeS73}x`8GHV+PYcr{k#lUd{oQ2Ed7|4x4JT_)h zF&Dv623I7uvaztW&=YfDf`CC77Kogqcd~nUtRl?L%FM<@Ea0Ggk{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`^;ggkv)lmfzlO5JrQokaDne33C zfJOgXGYbH_IjhjwC738?XeS;Qk2sdVdXW8StIJz$w4A%uK_s~Vi5mp}ge)&z{yk7C zr|=q=38kw!I2(z6Tua^kyPZUU4PLou0{p4j|HFh7Gdrq7}~dt6|jQhgyU=mN7fy-W*^4R4o;N~iuamC_C9CU=5##pt-9f_@V43e zGIclCAXB7(d8@4An2)PdQp>LLfEchDe#}5=I>dfIE<}Ce7?iGUo>c z1guDCd3Gf7KwvG>vS9L*OkMCR{J4rOZYmU9*h+s-G)yKd|9FXS_yjVPZw2D7lB;lD`*@i9`x_^`TjH&tm@>j9$q+@k*t{a z(-^7>LF{7;TU;DBS%vx)>M+kdH8Z2wTjPGdlk)og5n=g43$xEvyN_ z8UMNOUh1N}Y6bM+DOs$5hEx)D56u(!31n3on0+XGD(pdRmyrqfgdYBsi)N@3`{+Zk z;|;bckwq9C2#Jn_k}U6zu>(BGGdP^i3_mPOu!aMCCULYq(>C-F}5&U-)D^ zS=``fqyhcOEHlTL|0!YZ|Hy1bOqah;8@z8hA!OMsBan?;-y%RdQ$h`fe1EjVo6Q#; zB5ggJHlps$EOwC5 zZ{#79R5FEHlY=Kl6hNU{6acGz%qOqpR?Z}E4RMfh);{cR&te?O({XMqhvK`-MPY+en_>T%g7<=?3dRpDvWawH>O+{n= zXN0GwPc1`m)U0fg&`*b+VNa8k0W%SSmB14Sa23dn36Xkv*l>2fVXEoU|ruZCT_aBI=wbo48ECqD?c3k9w>3+J@-!)2hjHRlFmsX>x$-sG8 zQ?D^YC0CbpeG`YS#FIn%1Zjy3X@%3WK5=jdh?k-8P#=!_T?C$0&no&K_S4(nci4Hi Vmw?S{YncBo1zBa8S}D`e{|`5u{@?%r literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Makefile_for_Intel_SGX.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Makefile_for_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YwR^#1@r5ZclJ literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Project_Explorer.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Project_Explorer.png new file mode 100644 index 0000000000000000000000000000000000000000..94913f39808064a258837b36546fab568d154528 GIT binary patch literal 123188 zcmV*eKvBPmP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D|D{PpK~#8N?7an8 z99h~n%=drq_pZQwZyL)hV2oNJ!NN{%z1SeQ|EcbV zA&_K}ne6WDr0(mcICZS5PMzo6=c%f$Vp5P5k(U*gN0y>=D$0pS2$6+^`4r^D4pN`X z@TOFdJFG-lUPf5%`KlD;M8!n-#YA|O8kGiwnq0!-j-pk;QVyP#|EhQ<4 zR7CV0UhT8I$`qC6%OIbdGgeZk5W>h^mkayciKu94V zF}<#~qN%>JEX`X-f=g12UtCO3Sb#@HoKIR(5GWxoBqYEiEyhbZzhhm=jh2wh8MSvH>NomDygVznj32c54R%w>K2nRPe zfsdPj6H-kq&G%5|<|1&4i3>_f2q5CYjpgFP@$&OXNC=9H@sW9D;v2dK?)fRfs)V?r z7%v~6fWEVLNo9F^ZLX_($Ng{xj`P~i-t`s9TKs%h!xI|n%Ny!S^WtymOOd#Q zmHiUZDvELoGsBD|x%ebC{Ns{~i*k!Hqpw^9my9efE+BytB}$Yie?Vli=lPOM#`95# z6dsbOAU9S(Eu*%hEX;&Y!fI${IL=y@%yx#4m&C(`BlAmY8rb?rCk~8tW&~WfG*D90 zGW84y?Hud9AMNdIrYt2y66WU?kXE+4>f+^o)zL^sgr6iT%uA+7N0!x3_19IDn%_|vCc|>U&^>&lr$ARgB)O%nG0|N~LAR)_ry|Z# zOv12zX0$OU+)h^(j}i1tD47|qjt=yzY9AUZ_m}176cy$Z6G4d*B}$Y(95SW5X$x}` zDExvlQv6&5f`XO*=va-jJc%H1v2t*vJ;O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8BX+VCDQ=QBl$Vt3z0Q13nCQ?B&zTQrVeA)EnoN zRqVf)U%;Aj>7tnM6$B~z*NYX zIc1oB>W6yRsKckeY@dca2#Mt80&MkAiFW;%Fp0yC?C`IFc^yqo%I(Vs~$PMs5M6QNE1NtuTl8X>h)7g z(2x#uGnU`#>r)pb4zEIDufPa4=kLN!!kB){&o?WDtddj<^7Hqc%xTbQe$@J*!Yj1Z z%H}!`39V1Tu<>T-?vLa|-@KWc!gGzY>eK}dS_=Mb^-hdnLbP$S1aBlF8mm+?S)ib{ zwYT%dwcCE*s#4I<3g-aMs^iet#1{ks9{>d%|<~8{zBSbd^4N108~0T0#UIngs~2 z86_DR84b;VdiuiVFix}*x7p#(lUCrAG*E)K+sfVEx;`yN0_y=~Ykq z3Hv1SV(Oo#({roSQ*-lv)m3-fo4y+_%lHgh-f%j6>pHE3tBy4^5a#2Dasg zj%O~)Eqw=5_cGq!9GA9=`VCB!ZH>0Td_Syh{8&3sx(Z{Zf5!+-wa$NfI{$-9k=w>| TQ*{3Y0e+|`XvkN~nuq^CIw`5` literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/SGX_Preference_Page.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/SGX_Preference_Page.png new file mode 100644 index 0000000000000000000000000000000000000000..90170646b4a6ba16f50e165e574b893fb3e8d03a GIT binary patch literal 32021 zcmX_n19TnV7jA4cZra#R8aqv6G)ZHpv2D9Iwr$(Kv2EKnZ*pIL|F_pg-vI0_mtI@e87AlHla?2F6tQ zw=e`mZ8S1SANKPe(N0ps5ds3O@4pjr$hO1?0>Z0IN>o_cP50tm&FTA6+cx^CzOKnc zU&TWGB3NH_ir?w!;*#&_F>+{VNOh8DEGa&~m>ymc({YkVX`JUM!;wlDN|X!&j>V5e zGGLe|Fr^wICXXgI$w&*%>#^A<4@srnYk)+S(YQB=VHauZGUYh04!#x zkx~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SMI^+2_SSExZf?{vlq2>jiV+DOfe zQuD<<9n!r-8_C~@&Mrg0IN_}1>=-H7hxsC{yyc9H^3hRXdvk0lipqWnM?pCg?&JQZ zrImt@AG1(kOcJ7<@WJT`5`j#BJ<3akTbN;ZS|)$>Nn zDcK}NamJx80c?4xDk;o#cypNcfXxm!L%tK@d2}!$Rjm&$x_wWa(sLR=Q~>b0B#K9f zPlQiEd_b~uxEm1QCuw8jVj`+1?`GyHt|cvPBrL42V6UL=F5zYFrLAr4Y&}%^Nh1vC zGl;pdfw5t-VUo9DoFo6H+VGUdl7{^?86DY@h^dEW5B$1Owok-+#$ZUuuTW*>wtThi zym`0aTCO~EKpw;A|J`yT3Y1mQA-oQJ*%@y*9MF~-+xhfU5Jwgt7S*=T3TS2iOj=w) KtU|;v@c#qD0Q3F; literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Sample_Application.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Sample_Application.png new file mode 100644 index 0000000000000000000000000000000000000000..9c25b6282313ba220b0155795d3823cbfd0fdf69 GIT binary patch literal 175374 zcmYhi1yGz#(*+6ym*DOY+!EZ~-QC@t;1C=_fF!uPTX2`f-Q8UlcUWXE-~V!N-KT1I z>)Bd4(>>jN`pis}vZ53UA^{=<1O$qVw74n+1XKN!d-Iv;5z6@SV-A={ZT)VK8@F zo|SDSK$AtJLHBRrN||bDsP5dGxyngA%$*VrhoFus*j(`{KI#U1%>8OpI@xqwr=vfCp+kYqit!|e7+VSQf(sdwIa zXFU8UJ=s2OF?8*TRg5Zs%;a-Q^BRV~*k}t(#IU=vhKEABM0^PrMHGNsNekaVCB~lo z$3=e{t*vjeJ=$?-6j5gSN-9#poBE*~keMUinjl^m(>9=&)kTbU%{sdCy9h(0OOS9O zh6^`FVqJgn_N6#)e3)a5ia>c9*RP00XvpnC3pY2+j5s?xyRE)27*RW=@bK_~-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linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Select_Configuration_File.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Select_Configuration_File.png new file mode 100644 index 0000000000000000000000000000000000000000..a5fb4f811bc89870b4eff7c877370ffd296b4349 GIT binary patch literal 40998 zcmZ5{Q+Q?3(rs)TopjW(ZQC7V$F^#i-wr#6pr~jODzWZ_?=2~k$t*UR< zsH!=tDpFZd3K@X_0SpWbSw>o11q=-Q`s@1`4&v+CIxQpi^#XTMkrD-~nfiA6wSlq_ zQ4j$GtB*%~H-i4!!#hfAyMTeA4E$$-4?C2Zf`R3A$cT%mdFo$$czAwWPTPimW16n< zIO6iZ(3_sj+9kH!TO=1Rzh)<4G%$q2S#?B?V=dFVF`wu z?=r=6oIQK;q^8NS0wn{FL?T_*Jx!|RcD_)p%jJ8vaCvqX@UYtRmgVv9!9YE`XK;T$ z1tDYpv~InstS@QZN-2Hv@RnOoKW+WEZavLU!_1w~6guFNlbIb|TY-Yo>ksl=0oI9z zE50pIX~UMYa?u>Lkra2Z^VGh{7{0xa^tvI~GH}>B8KhyvnYV1hlErSFqFBj7a4%i1 z@me+Z4dvilev=_e`26W@6}Ly)I1ToVB_f-B8XeE(X`oAxdE35|QI_P7ysRAI_&Vcr z=cxHpCtg3rQa-Es3S@%*L$~%1l+y8C$DzBMtt+h_W5>NZ&EFUs(n7((ZN79H8YYf4 z{w-7o$h`(>$`z$dZ+HNF1$Ii zZJt5$@|2L~?pe#{_ufQ;d6={lm%?YZ#nZ?k{p2u(bBF>?4~vKtjxYONCz<=VrCF>Zlh=1DI7fGPx2$YzO#1Dm3L7lLM6- z298Kqh!ZqnP$yP8Yy zOlrZKS94=lvb%NqZH6jLmOo4|WOK9i%Tgx>-;NcuhdLbi3yZ`TcHZ}Q9MRg?E?orn zH}H#HHTvv1EuT5pYx4-48NG7=lwnnAoB6Uq+q24^#^$oM^HGDMjjMQIvVD&7&-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z!1sOb0`)m@>#{Q;Y0aE)WAC#Q;u%ln{kFK(T931!FF%LC>}i=bTR$K2ZlR#E{gS}h zWVy7;N|Cy$#*ZKSZzHtxqVR*`oRd9Om$_X=iyk4`=LYg7BJoNLnzVxp&pNq|wG8={ zA|j;0)Px_6=_4)8%&u@=in0a*Iato=gD9aZ4FbRGdJw5^wI}AMG2atU$t~@BSspV$ z+aNe|zr}hRrJPd*w>}lPqdwfQP&1D_^xn_eB75;4Xbc?)&rvJ}m9Mp1BS;t&*KEtlASus zdxq)bhLsX6`2Ish9y=UZjvAaSl?-wS9Lq`Lv`3FVGw*xr``} z4^zvDwt@QduGQmQgGWCDUaSQRf{>{>_E$pt5a2HsF|5l&r*S=BlxD3B)*KjKeTQ1* zRn^Wve0U$xiZIkEK~Ai@mLOk@rbAQ=Uc|rbPfVp_95`NF^mY2~!)agC_23fld2mln KzF6*Qz<&X@1Df3c literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/The_Location_of_the_Plugin_zip_Archive.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/The_Location_of_the_Plugin_zip_Archive.png new file mode 100644 index 0000000000000000000000000000000000000000..afa17c33ebe373e0af4305ffd765649e63058157 GIT binary patch literal 61479 zcmbTdcUTkM^FB)M~GkUK0=y6%r5- z8j}-UUs*lpH@p5K^nR_XNKih^vU7cM!%;y?fqOe_$SD5oRl(BO9Y0uBOG-)x0RRWT(K6xP5D9F82A6{htUPuUAvoJSjj#MP{OzwX>4&&!=2NCb9bV}7x z;0zb`arwKQ){>c!y1JgXB1|`Vu=#}I2y$uO?^Fwz`?IlsKasy~mn7RKGc%K!*|mDE zbYcfaw0riEL6ieRym_NP3VOa1qU(d)<>%)=gz2cMX%q4A@;=~c9r*Pt0%+$rQd?XHzCwRBY?=hb+RckA$Edd7z_qqJ-path&tb2t^&+l zjx;*X#Idix|GT%^F&NzJx4+O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TnO+>K}JQo`rXIi{|{`>jRF7w literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Two_StepSigne_Enclave_Generate_Hash.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Two_StepSigne_Enclave_Generate_Hash.png new file mode 100644 index 0000000000000000000000000000000000000000..7b9b49b640ee03506b9a2aadb8f9ee75f9ac748f GIT binary patch literal 56527 zcmXt91y~zf)22|MxVx7Yio3fPcb62WxVvj{4IbRJxCSX!EV#S7yZ_vKzki=+lReLF z=Il=9%)Il?Y`Btw6bd3CA`}!9iu8AJ6(}g^^!MYgPtfn5blYm^?_VFBRHQ_qsvyJ% z?}Lx#BJv_oP&Khg&xWw?V+8x}+D=eVs6GGe9|r77OrW5aO{B#|)Z7h@Utrz73^r0B z&c>#4l+P)R9o{`ct}}dBe9ma(%!-DFjN}wp*kp6jL$Qte(b?X&VC-BdST?U5>^cTf z71}!1BQ;RsU1nKp$6SgG+m+2yV_L?N`R<18D{1V&mOZx~qno8=UPo1HYgt8Ef{L=T zj)8`XhK3vs19Va{c5)JS680V*9tAee4i3&|Y~1ZdWu>?)%m+J3Ujt55Vs88Ou8S(D zkpvJ(;d9>y^7E%J>6Dn>Ffq!-Ai0y}2&E)=Yoz)}B^6;BhL4Pl`PeW_nn@|pghWTU zxVWiuRMC<_on2dJ-9osL!0eQVDKs>}PQQ~n#cKX$znM@gDgWy+p(j(lfdClz_sL$n z?>D<|n1nhJ{JX5eUM<|C)d77hl5l~q$5Z71{^pJI=YgVrUS3cK7(Dued39-JM@gvuWu>949>$?bk^hT2Rd-OPi0Ey-py`M($n6iXio!u|@H}2f* z0Bs&GfA+FhJ`(>V-MAVv7zpAjeStO@j(lD1d|fD>Q@%GJ>h#}ojf)33!yG!Eo!(e! zGVwRN-9+C!a=2GEGYPgi94)pGaWM+`YyTNb@)Iy%ds=^8+g~LLuzro$_0euUi6RaK zX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`fdK~R93&6{vjMEa`oF&>#q?C?@U5s6_ytH1FlO(J|gnfZ(%xdMEuvu zt(7i#gSu5PXJ=<77M6?d*0YS80w0S1Av}P9)_%aZ$;rw6{e7Fu+?&}}_;Q?#_NFz* z|AReI3a#?W@;W3^=f#Ul&iuURMXA3tzS;jx9-yU+!^FhI{{DU&0Ut&O+9&@kj{}Yj z9Ba7SBdn}gDc2a|$PaOz^}ii)ui$XFtgP(V*jVd2d#(XLC>8PbUq;0V4N>#~!(2;o zEkPlW6ULjtn{!Fc7=6aLg~_;o$W}AFs1Jd`;Bs?xbo33o4j$guM&WmTc(~`eiuSV# ICEJMq1B#r->Hq)$ literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Two_Step_Sign_Enclave_Menu.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Two_Step_Sign_Enclave_Menu.png new file mode 100644 index 0000000000000000000000000000000000000000..374fd094fd1e4217103ad3f41d7c5a8e1be7ab97 GIT binary patch literal 55509 zcmV*dKvKVnP)0ssI2r$3C300001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D*lI~cK~#8N?EQsz z9LE+uir)X^zV+6-zk5z%kTlpmJxr2D%*@Qp%*@Qp%uJST$&9ik+p;B#nauR6yGODt zCpnJeI8HKqeU`hbtBa;R%{;#)~ym|BHH72iKy?Tks^XJc>J$tslzrVM)x3jae zwY9arzP_@uvbeaoy}gr`mLem4ipxRREZV;TEGEoip7fMJf^P*b8zB*;8XFs*K7Ben zJ3Eib^78V=#s+A5paFtr2pS`3lAvMYEfh3W&|pE!1%kKYcZc%+Q~4kfiAY2u$3#N> zpMp(e&`2;$1=lPF#5^Q>3Gqwtr$R#f5|M~RzMFi1;)emVQbWMf^h|Q*B1%&Bzx~-3Yh?52bK|2HzNbpAh zUO5K+N`M2Di*~6*vfq&VV?4zM+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4+RGLbMvV5{ z^ZZ+es^k1`dJW9>h1Vd^Ud!OVTYeA8!9k+Ky2B5^Tw5!Z2UvAdBNRPwLNsv=@wW3| z9abEDGc70VXlL9g+pqb_dsHu7idiT-apcZEdB3{ZZv$i2ntZQPxEcC9M3i(sb%0p{ z&l*4Qu`5NSNT5!@dxcGn9_KU)rYs5Tu?HwUjNs38i4CaZjt0-ydYS*a!q5e4j1SK87n^)I5X@2Hp+Qc#Z|3y^8O|4cZq2Js z7ubP}YYek^*b`S2b>;r&3p^-vy|*f5R#k6CIijM7&b>xcRR*}2IBB<#T7%swR%eM}3FOp4x;;YAcTxX6B6(|zMEjR9slUKUVEhrGCAgxu9MW*UnKB3jY zk**^I8>pb}utYkxu+u&6zrn{;u#W@r+kX7zY8=Qrva@^wcW9DD3eD!EIl(yk_HwXMb+&c%lGSuz*=zcb$zQQ5}N)Q(c>LeAViJuG1b# zSUK~5A4Fcul>&d+GXhQv?o{Dc1fT~gI)DtJjG@3@%vmg>hzmsZ*(fZ(0A_F}E>*(b zlQcJ2q*ly26faF`&^;Xv?82!}Z0QFd_lH^-%^&xf8MGOOh&}Vxa{hCDK>&O%8k!qa I={rUL2RV{k + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css new file mode 100644 index 0000000000..6c2190cf4c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css @@ -0,0 +1,443 @@ +/*************************************************************************/ +/* Copyright (c) 2016 Intel Corporation. */ +/* */ +/* All rights reserved. This program and the accompanying materials */ +/* are made available under the terms of the Eclipse Public License v1.0 */ +/* which accompanies this distribution, and is available at */ +/* http://www.eclipse.org/legal/epl-v10.html */ +/* */ +/* Contributors: */ +/* Intel Corporation - initial implementation and documentation */ +/*************************************************************************/ +/**/ + +/*begin-old-version{{*/ + +body +{ + color: #333333; + background-color: #ffffff; + font-family: "Intel Clear", Verdana, Arial, sans-serif; + font-size: 12pt; + margin-left: 30px; + margin-right: 30px; + margin-bottom: 7%; + color: #333333; + background-color: #ffffff; + font-family: "Intel Clear", Verdana, Arial, sans-serif; + font-size: 12pt; + margin-left: 30px; + margin-right: 30px; + margin-bottom: 7%; +} + +.RevUpdate +{ + background-color: #FFFF99; + font-weight: normal; + line-height: 100%; + background-color: #FFFF99; + font-weight: normal; + line-height: 100%; +} + +.NonStdFortran +{ + color: #007F00; + color: #007F00; +} + +body.OH_VSIP_body +{ + margin-left: 30px; + margin-left: 30px; +} + +DIV.OH_outerContent +{ + border: 0px none #FFFFFF; + border: 0px none #ffffff; +} + +h1 +{ + color: #0071c5; + font-size: 15pt; + font-weight: normal; + padding-bottom: 1px; + margin-left: 0pt; + margin-bottom: 0px; + color: #0071c5; + font-size: 15pt; + font-weight: normal; + padding-bottom: 1px; + margin-left: 0pt; + margin-bottom: 0px; +} + +h1.firsttitle +{ + font-weight: normal; + border-bottom: 0 none; + margin-left: 0; + font-size: 18pt; + border-bottom: 1px solid #0071c5; + line-height: 100%; + padding-bottom: 10px; + margin-bottom: 20px; + margin-top: 20px; + font-weight: normal; + border-bottom: 0 none; + margin-left: 0; + font-size: 18pt; + border-bottom: 1px solid #0071c5; + line-height: 100%; + padding-bottom: 10px; + margin-bottom: 20px; + margin-top: 20px; +} + +h2 +{ + color: #0071c5; + margin-top: 15pt; + margin-bottom: 5pt; + font-size: 12pt; + color: #0071c5; + margin-top: 15pt; + margin-bottom: 5pt; + font-size: 12pt; +} + +h3 +{ + color: #333333; + font-weight: bold; + margin-top: 15pt; + margin-bottom: 5pt; + font-size: 11pt; + color: #333333; + font-weight: bold; + margin-top: 15pt; + margin-bottom: 5pt; + font-size: 11pt; +} + +h4 +{ + color: #0071c5; + margin-top: 12pt; + margin-bottom: 5pt; + padding-left: 0px; + font-size: 12pt; + color: #0071c5; + margin-top: 12pt; + margin-bottom: 5pt; + padding-left: 0px; + font-size: 12pt; +} + +h5 +{ + color: #0071c5; + margin-top: 12pt; + margin-bottom: 5pt; + padding-left: 0px; + font-size: 12pt; + color: #0071c5; + margin-top: 12pt; + margin-bottom: 5pt; + padding-left: 0px; + font-size: 12pt; +} + +h6 +{ + color: #0071c5; + margin-top: 12pt; + margin-bottom: 5pt; + padding-left: 0px; + font-size: 12pt; + color: #0071c5; + margin-top: 12pt; + margin-bottom: 5pt; + padding-left: 0px; + font-size: 12pt; +} + +.relinfo +{ + padding-left: 30px; + padding-left: 30px; +} + +.tablecap +{ + color: #0071c5; +} + +caption +{ + font-size: 12pt; + font-weight: bold; + text-align: left; + font-size: 12pt; + font-weight: bold; + text-align: left; +} + +.figcap +{ + margin-left: 24px; + font-size: 12pt; + font-weight: bold; + text-align: center; + margin-left: 24px; + font-size: 12pt; + font-weight: bold; + text-align: center; +} + +.sectiontitle +{ + padding-left: 0px; + padding-left: 0px; +} + +.linklist +{ + padding-left: 0px; + padding-left: 0px; +} + +h1.topictitle1 +{ + color: #0071c5; + font-size: 18pt; + margin-left: 0pt; + margin-bottom: 15px; + color: #0071c5; + font-size: 18pt; + margin-left: 0pt; + margin-bottom: 15px; +} + +#header_text +{ + color: #0071C5; + text-align: right; + color: #0071C5; + text-align: right; +} + +.titlepage +{ + margin-right: 15%; + margin-right: 15%; +} + +.familylinks +{ + margin-top: 1em; + margin-top: 1em; +} + +a.start +{ + font-size: 18pt; + text-decoration: underline; + font-size: 18pt; + text-decoration: underline; +} + +a.underlined +{ + text-decoration: underline; + text-decoration: underline; +} + +.shortdesc +{ + font-size: inherit; + padding-left: inherit; + line-height: 16pt; + margin-top: 0px; + margin-bottom: 0.5em; + font-size: inherit; + padding-left: inherit; + line-height: 16pt; + margin-top: 0px; + margin-bottom: 0.5em; +} + +.shortdesc-it +{ + font-style: italic; + font-style: italic; +} + +p +{ + font-size: inherit; + margin-left: 0px; + line-height: 120%; + margin-top: 0; + margin-bottom: 10px; + font-size: inherit; + margin-left: 0px; + line-height: 120%; + margin-top: 0; + margin-bottom: 10px; +} + +.p +{ + font-size: inherit; + margin-left: 0px; + line-height: 170%; + margin-top: 0; + margin-bottom: 5pt; + padding-left: 0pt; + font-size: inherit; + margin-left: 0px; + line-height: 170%; + margin-top: 0; + margin-bottom: 5pt; + padding-left: 0pt; +} + +table +{ + margin-bottom: 5pt; + border-collapse: collapse; + margin-left: 0px; + margin-top: 0.3em; + font-size: 12pt; + margin-bottom: 5pt; + border-collapse: collapse; + margin-left: 0px; + margin-top: 0.3em; + font-size: 12pt; +} + +tr +{ + vertical-align: top; + vertical-align: top; +} + +DIV.Note +{ + margin-top: 20pt; + margin-bottom: 20pt; + margin-right: 0.46cm; + padding-left: 5px; + border-top-style: solid; + border-top-width: 1px; + border-bottom-style: solid; + border-bottom-width: 1px; +} + +p.NoteTipHead +{ + font-weight: bold; + font-style: italic; + margin-top: 9pt; + margin-bottom: 3pt; + line-height: 15pt; + margin-left: 0.202cm; + font-family: "Verdana", "sans-serif"; + font-size: 9pt; + text-transform: uppercase; + text-align: justify; +} + +MadCap|xref +{ + color: #0860a8; + mc-format: '{paratext}'; + text-decoration: none; +} + +div.NoteCont +{ + border-bottom-style: solid; + border-bottom-width: 1px; + border-top-style: solid; + border-top-width: 1px; +} + +p.figcap +{ + text-align: left; +} + +th +{ + text-align: left; +} + +a:link +{ + color: #0071c5; + text-decoration: none; + color: #0071c5; + text-decoration: none; +} + +a:visited +{ + color: #0071c5; + text-decoration: none; + color: #0071c5; + text-decoration: none; +} + +a:hover +{ + color: #00aeef; + text-decoration: underline; + color: #00aeef; + text-decoration: underline; +} + +a:active +{ + color: #0071c5; + text-decoration: underline; + color: #0071c5; + text-decoration: underline; +} + +a.start:visited +{ + color: #0071c5; + text-decoration: underline; + color: #0071c5; + text-decoration: underline; +} + +a.start:active +{ + color: #0071c5; + text-decoration: underline; + color: #0071c5; + text-decoration: underline; +} + +a.underlined:visited +{ + color: #0071c5; + text-decoration: underline; + color: #0071c5; + text-decoration: underline; +} + +a.underlined:active +{ + color: #0071c5; + text-decoration: underline; + color: #0071c5; + text-decoration: underline; +} + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm new file mode 100644 index 0000000000..1fc481290d --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + Running Samples Generated for Enclaves + + + +

Running Samples Generated for Enclaves

+

Intel(R) Software Guard Extensions Eclipse* Plugin provides an option to generate a sample application together with the enclave code when the enclave is created. After the project is build, the sample application is built also and ready to run. You can see the sample application named sample in the enclave directory in Project Explorer. You can run this sample as a local C/C++ application as shown in the following figure:

+

+ +

+

Sample Application

+

See the result of the execution in Eclipse console window as shown below:

+

+ +

+

The Result of Running Samples Generated for Enclaves

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm new file mode 100644 index 0000000000..c41301eea7 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + SGX Build Configurations + + + +

SGX Build Configurations

+

There are usually two types of builds that a regular non-SGX project defines:

+
    +
  • Debug
  • +
  • Release
  • +
+

SGX-enabled projects add to this picture support to build and test SGX-enabled application on non-SGX platforms (or emulator) using simulation libraries. This approach doubles the set of build types, creating four possible combinations. For these combinations, you need to use different sets of compilation and linking flags and link different libraries.

+

The non-debug hardware build is meant to give production code, so it requires the maximum attention when signed. The Two Steps Sign schema is required for production enclaves, which involves an external signing facility, not part of Intel SGX SDK. The other configurations are not meant for production but they have to be signed too. The simplest and more convenient Single Step schema is used for them.

+

Again for testing purpose, you might want to experiment with a non-production enclave built with release compilation and linking flags, on a real hardware SGX-enabled platform. That would be an enclave built exactly as a production enclave, except for the sign process which would be Single Step. To support the construction of such enclave, there is a hardware non-debug build configuration dubbed Prerelease.

+

So there are five SGX related configurations when SGX Nature is added to a project:

+

+ +

+

Intel(R) SGX Configurations

+

The following table resumes the existing SGX configurations and relate them with compilation/linking flags (debug/non-debug) and signing scheme (single vs. two steps):

+

Intel(R) SGX Configurations

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Configuration NameSimulation?Debug?Signing Schema
SGX Hardware DebugHardwareDebugSingle Step
SGX Hardware Pre-releaseHardwareNon-debugSingle Step
SGX Hardware ReleaseHardwareNon-debugTwo Step
SGX SimulationSimulationNon-debugSingle Step
SGX SimulationDebug SimulationDebugSingle step
+

Intel® Software Guard Extensions Eclipse Plug-in uses standard GNU* make tool to build the trusted and the untrusted code, using the generated file sgx/Makefile.

+

This fact does not impose any restriction on the build tool chosen for the hosting project. Intel® Software Guard Extensions Eclipse* Plug-in uses its own build configurations which do not interfere with the configurations that you might have in your project.

+

When SGX configurations are selected, by default only code under <root>/sgx directory get built.

+

You can customize SGX configurations as any other Eclipse build configurations from the project properties dialog. For example:

+
    +
  1. Right-click in Project Explorer Properties → C/C++ Build
  2. +
  3. Uncheck the Use default build command checkbox.
  4. +
+

Then you can customize and integrate SGX build process. You can use Makefile instead of sgx/Makefile in the example shown in the following figure:

+

+ +

+

Customization of SGX Build Command

+

The build process is done using standard Eclipse interface for build, by example from the main Project menu:

+

+ +

+

Project Menu

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm new file mode 100644 index 0000000000..bbf44bea76 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + Intel(R) Software Guard Extensions + + + + +

Intel(R) Software Guard Extensions

+

Developer Reference

+

Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for a +pplication developers seeking to protect select code and data from disclosure or +modification. Intel(R) SGX makes such protections possible through the use of +enclaves. Enclaves are protected areas of execution. Application code can be put +into an enclave through special instructions and software made available to +developers by the Intel(R) SGX SDK.

+

Legal Information +

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm new file mode 100644 index 0000000000..6201863d5c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + Two Steps Sign Enclave + + + +

Two Steps Sign Enclave

+

To help you develop enclaves, Intel(R) Software Guard Extensions Eclipse Plug-in generates all required structure including:

+
    +
  • c/c++ files and header files
  • +
  • .edl file
  • +
  • *.config.xml file
  • +
  • a sample Makefile
  • +
  • a sample signing key
  • +
+

While these structure might be appropriate for development and debugging, you need a 2-step process to integrate your own signing schema for generating production enclaves.

+
    +
  1. Generate hash: the signer tool generates signing material from the unsigned compiled enclave and from the configuration file for the enclave. The signed material comes as an opaque sequence of bytes which are put in a file with extension .hex. This file is used with the external signing facility. You come back with a signature for the .hex file plus the public key of your signing facility, and proceed to Step 2.
  2. +
  3. Generate signed enclaves : the signer tool generates the final signed enclave.
  4. +
+

To complete this task, provide the following input parameters:

+
    +
  • The unsigned enclave
  • +
  • The configuration file
  • +
  • The output file produced when you generate hash (the .hex file)
  • +
  • The files produced by the external signing facility: the signature of the .hex file and public key for it
  • +
  • The plugin checks if the input parameters are consistent:
  • +
  • The .hex file matches the unsigned enclave and the configuration file,
  • +
  • The signed material is verified with the public key
  • +
+

If the parameters are consistenet, the production signed enclave is produced.

+
+

NOTE:

+

If you generate signed enclave right after generating hash, you can only enter the parameters specific for generating signed enclave.

+
+

To use the two-step signing function, activate the configuration SGX Hardware Release mode. When this configuration is active, the compilation does not produce a signed enclave, as in the other SGX configurations; the process only produces unsigned enclaves.

+

+ +

+

Configure SGX Hardware Release Mode

+

When you configure the plugin in the SGX Hardware Release Mode, you can see the Generate Hash and Generate Signed Enclave options through Software Guard Extension Tools->Two Step Sign Enclave.

+

+ +

+

Two Step Sign Enclave Menu

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm new file mode 100644 index 0000000000..d416791d27 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + Updating Enclave Configuration Files + + + +

Updating Enclave Configuration Files

+

A configuration file is an important part in the definition of an enclave. Intel(R) SGX SDK signer tool requires such *.xml configuration file as necessary input.

+

To update this configuration file, use the Update Config command:

+
    +
  1. +

    Right-click on the root project, Software Extension Guards Tools->Select Config File.

    +

    + +

    +

    Select Configuration File

    +
  2. +
  3. +

    Click OK or double-click the selected configuration file to open the Enclave Configuration Settings dialog.

    +

    + +

    +

    Enclave Configuration Settings

    +

    For details on the meaning of the fields, see Intel(R) Software Guard Extensions Developer Guide.

    +
  4. +
+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm new file mode 100644 index 0000000000..d536de1c6d --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + Updating SGX Enclave Signing Key + + + +

Updating SGX Enclave Signing Key

+

All skeletons enclave samples produced by the plugin contain a sample signing key. You might want to import another sign key that you already have, or generate a new one. Use the command Update SGX Enclave Signing Key to complete this task.

+
    +
  1. Choose Update SGX Enclave Signing Key by right-click on the project in Project Explorer -> Software Guard Extension Tools menu. The Import or (Re)Generate Enclave Signing Key dialog appears.
  2. +
  3. In the Import or (Re)Generate Enclave Signing Key dialog, click Select to open a file dialog to select the output key.
  4. +
  5. +

    Click Improt Key to update a selected signing key by copying another existing key or click Generate Key to update the selected signing key by generating a new key. In both cases, the new signature key is put into the file in text field Enclave Signing Key.

    +

    + +

    +

    Import or (Re)Generate Enclave Signing Key

    +
  6. +
  7. Click OK to update the enclave signing key.
  8. +
+

Under the hood, a new key is generated using openssl*, which needs to be installed on the machine:

+

openssl genrsa -out ../../../encl1_private.pem.key.pem -3 3072 +

+

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html new file mode 100644 index 0000000000..40f03550f3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html @@ -0,0 +1,557 @@ + + + + + + + + + + + + + + + + + + + +

Intel(R) Software Guard Extensions Plug-in for Eclipse*

+

Developer Guide

+

Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for a +pplication developers seeking to protect select code and data from disclosure or +modification. Intel(R) SGX makes such protections possible through the use of +enclaves. Enclaves are protected areas of execution. Application code can be put +into an enclave through special instructions and software made available to +developers by the Intel(R) SGX SDK.

+

Legal Information +

+ + +

Legal Information

+

No license (express or implied, by estoppel or otherwise) to any intellectual + property rights is granted by this document.

+

Intel disclaims all express and implied warranties, including without + limitation, the implied warranties of merchantability, fitness for a particular + purpose, and non-infringement, as well as any warranty arising from course + of performance, course of dealing, or usage in trade.

+

This document contains information on products, services and/or processes + in development.  All information provided here is subject to change + without notice. Contact your Intel representative to obtain the latest + forecast, schedule, specifications and roadmaps.

+

The products and services described may contain defects or errors known + as errata which may cause deviations from published specifications. Current + characterized errata are available on request.

+

Intel technologies features and benefits depend on system configuration + and may require enabled hardware, software or service activation. Learn + more at Intel.com, or from the OEM or retailer.

+

Copies of documents which have an order number and are referenced in + this document may be obtained by calling 1-800-548-4725 or by visiting + www.intel.com/design/literature.htm.

+

Intel, the Intel logo, Xeon, and Xeon Phi are trademarks of Intel Corporation + in the U.S. and/or other countries.

+ + + + + + + + +
+

Optimization Notice

+
+

Intel's compilers may or may not optimize to the same degree + for non-Intel microprocessors for optimizations that are not unique + to Intel microprocessors. These optimizations include SSE2, SSE3, + and SSSE3 instruction sets and other optimizations. Intel does + not guarantee the availability, functionality, or effectiveness + of any optimization on microprocessors not manufactured by Intel. + Microprocessor-dependent optimizations in this product are intended + for use with Intel microprocessors. Certain optimizations not + specific to Intel microarchitecture are reserved for Intel microprocessors. + Please refer to the applicable product User and Reference Guides + for more information regarding the specific instruction sets covered + by this notice.

+

Notice revision #20110804

+
+

* Other names and brands may be claimed as the property of others.

+

© 2016 Intel Corporation.

+ + +

Introduction

+

This Developer Guide is intended for use by Independent Service Vendors who wish to harden their Linux* applications using Intel(R) SGX Technology, code named Intel(R) Software Guard Extensions. The guide describes the procedure for installation of Intel(R) SGX Plugin for Eclipse* IDE and development of Intel(R) SGX components using the plugin. The Intel(R) SGX Plugin for Eclipse leverages on the Intel(R) Software Guard Extensions Evaluation SDK, which is a collection of APIs, libraries and tools that enable you to develop, build and debug Intel(R) SGX applications in C/C++.

+

To learn more about the Intel(R) Software Guard Extensions Evaluation SDK, see the Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

  + +

Introducing Intel(R) Software Guard Extensions

+

Intel(R) Software Guard Extensions is a new Intel technology, whose objective is to enable a high level of protection of secrets. It operates by allocating hardware-protected memory where code and data reside. The protected memory area within an application process is called an enclave. Data within the enclave memory can only be accessed by code that resides within that enclave. Enclave code can be invoked by special instructions.

+

An enclave can be built and loaded as a shared object.

+

Throughout this document, Intel(R) SGX refers to Intel(R) Software Guard Extensions.

+

An Intel(R) SGX application design is different from the design of non- Intel(R) SGX application as it specifies dividing the application into two logical parts:

+
    +
  • Trusted part. The code that accesses the secret resides here and it is called an enclave. More than one enclave can exist in an application.
  • +
  • Untrusted part. This includes the rest of the modules in the application, that is outside in an enclave.
  • +
+

The trusted components and untrusted components are developed as separate modules.

+

The trusted part or the enclave is implemented in C or C++. It is supplied as a collection of functions and data packaged in the form of a dynamically loaded library, a DLL in Windows* OS and a shared object in Linux* OS. It may be supplied either as a pre-built signed library or as a signed shared library built during compilation of the untrusted component.

+

Enclave functions within an enclave library are wrapped by auto-generated proxy and bridge functions that simplify the mechanism of using the Intel(R) SGX technology by developers.

+

The role of these functions is to handle the following tasks:

+
    +
  • Call an enclave function from untrusted code, also called an ECALL (enclave call).
  • +
  • Call an untrusted function from within an enclave, also called an OCALL (outside call).
  • +
  • Handle interrupts.
  • +
  • Handle exceptions.
  • +
+

The proxy and bridge functions are generated by the sgx_edger8r tool provided by Intel(R) SGX SDK. It reads an edl file (Enclave Descriptor Language) which describes the functions that form the trusted and untrusted component boundaries within the application.

+

After the enclave is built, a signed version of it is created using the tool sgx_sign also provided by Intel(R) SGX SDK. It is this signed version may be loaded and executed in the encrypted memory.

+

Enclaves may have some specific properties which are added as meta-information during the signing process. The meta-information is stored in one configuration xml file per enclave, whose details may be seen in Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

+ + +

Introducing Intel(R) Software Guard Extensions Eclipse* Plug-in

+

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

+

Once the SGX nature is added to a project, you will have access to the SGX commands. SGX nature adds also a folder called sgx to the root of the project, and a Makefile inside it. All resources of the project managed by Intel(R) Software Guard Extensions Eclipse Plug-inare located inside this directory. You can build and run enclaves related code using GNU* Make tool through the Makefile.

+

The plugin is generating minimal but ready-to-work code skeletons, complete with their own Makefile having all the required make targets as to call sgx_edger8r tool to generate the proxies and bridges, compile these source, generate a shared object and finally, to sign the enclave with the sgx_sign tool. This provide a starting point you may build upon.

+ + +

Getting Started with Intel(R) Software Guard Extensions Eclipse* Plug-in

+

This section contains steps to set up your Intel(R) Software Guard Extensions Eclipse* Plug-in on a Linux* system, including necessary softwares, steps to install the product, and steps to configure your preferred product directory.

+

• Pre-requisites

+

• Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

+

• Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

  + +

Pre-requisites

+

To use Intel(R) Software Guard Extensions Eclipse Plug-in, install the following softwares:

+
    +
  • Eclipse* Mars 1 with CDT IDE for C/C++ Developpers (version 4.5.1). To use this version, install Java* Development Kit (JDK) or Java* Runtime Environment (JRE) version 1.8 or above.
  • +
  • gcc/g++ tools
  • +
  • Openssl*
  • +
  • Intel(R) SGX SDK for Linux* OS
  • +
+ + +

Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

+

Install Intel(R) Software Guard Extensions Eclipse* Plug-in as a regular Eclipse Plugin:

+
    +
  1. Download the zip archive of Intel(R) Software Guard Extensions Eclipse Plug-in from Intel Site
  2. +
  3. +

    Go to Help menu -> Install New Software. Click the Add button for the Work with field to open the Add Repository dialog as shown in the following graphic:

    +

    + +

    +

    Add Repository Dialog

    +
  4. +
  5. +

    Enter SGX Archive in the Name field . Click the Archive... button and select the location of the downloaded archive as shown in the following graphic:

    +

    + +

    +

    The Location of the Plugin zip Archive

    +
  6. +
  7. Press OK to add the archive as a repository.
  8. +
  9. In the Install dialog, select the Software Guard Extensions Plugin check-box and proceed with the usual steps.
  10. +
+ + +

Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

+

If you do not install Intel(R) SGX SDK for Linux* OS in the default location, you need to specify the path for Intel SGX SDK using the following steps:

+
    +
  1. +

    Go to Window menu ->Preferences. Enter SGX in the filter text field to quickly locate the SGX Preferences page.

    +

    + +

    +

    SGX Preference Page

    +
  2. +
  3. Enter the path for Intel SGX SDK for Linux OS in the SGX SDK Directory field.
  4. +
+ + +

Command Reference

+

This topic provides the command reference for the following scenarios of using Intel(R) Software Guard Extensions Eclipse* Plug-in:

+
    +
  • Adding SGX nature to a project
  • +
  • Adding an SGX enclave
  • +
  • Adding an SGX trusted library
  • +
  • Adding an SGX untrusted module
  • +
  • Updating SGX enclave signing key
  • +
  • Updating enclave configuration files
  • +
  • Two steps sign enclave
  • +
+

All commands brought by Intel(R) Software Guard Extensions Eclipse Plug-in are available by right-clicking on the Project root in Project explorer view in menu Software Guard Extension Tools:

 

Project Explorer

  + +

Adding SGX Nature to a Project

+

The nature of an Eclipse project is a concept defined by an Eclipse Platform which allows a plug-in to tag a project as a specific kind of project. Intel(R) Software Guard Extensions uses an SGX nature to add SGX-specific behavior to projects. Project natures are defined by plug-ins, and are typically added or removed per-project when the user performs some action defined by the plug-in.

+

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

+ + +

Adding SGX Nature to a non-SGX project

+

When you have a C/C++ project created without Intel SGX, you cannot use Intel SGX support. In this case, you need to add SGX nature to this project to use Intel SGX support:

+
    +
  1. Right-click on the project root
  2. +
  3. +

    Select Software Guard Extension Tools → Add SGX Nature

    +

    + +

    +

    Add SGX Nature

    +
  4. +
+

After you add the SGX nature to your project, you should see:

+
    +
  • +

    A subdirectory sgx in the project which contains a Makefile file.

    +

    + +

    +

    Makefile for Intel(R) SGX

    +
  • +
  • +

    The Intel SGX tools as shown in the following graphic:

    +

    + +

    +

    Intel(R) SGX Tools

    +
  • +
  • +

    New configurations specific to SGX technology. You may see the configurations for the project by clicking to the down arrow of button usually found at the top of the Eclipse window:

    +

    + +

    +

    Configurations Specific to Intel(R) SGX Technology

    +
  • +
+ + +

Creating a New C/C++ Project with SGX Nature

+

You can create a new project with SGX nature. To create such a project, follow these steps:

+
    +
  1. +

    Open a standard Eclipse new project: File menu → Project... . If you have installed Intel® Software Guard Extensions Eclipse Plug-in, you can see the category C/C++ with SGX Enabled in the New Project dialog.

    +

    + +

    +

    New Project

    +

    This category has 2 sub-categories, SGX C project and SGX C++ project. These sub-categories are similar to the sub-categories C Project and C++ Project of standard C/C++ category.

    +
  2. +
  3. Select one of the 2 sub-categories, SGX C project or SGX C++ project, and click Next.
  4. +
  5. Complete creating the project using the regular process of creating a standard C or C++ project.
  6. +
+
+

NOTE:

+

Projects created following the subcategories under C/C++ with SGX Enabled are identical with their standard counterparts, except that they have SGX Nature added. There is no difference between creating a C or C++ project with SGX enabled, or creating a standard C/C++ project and launch Add SGX nature from it, as described in precedent paragraph.

+
+ + +

Adding an SGX Enclave

+

After you add the SGX nature to a project, you can start creating a minimal but complete skeleton for a new enclave:

+
    +
  1. Right-click on the project root in Project Explorer.
  2. +
  3. +

    Open the dialog Add New SGX Enclave by selecting Software Guard Extensions Tools → Add SGX Enclave from the contextual menu.

    +

    + +

    +

    Add New Intel® SGX Enclave Dialog

    +
  4. +
  5. +

    Choose a name for the enclave in Enclave name field. This name is used in the process of generation of the skeleton to give unicity to the source files and the name of the resulting executable, so you can add more than one enclave to the same project.

    +
      +
    • +

      If you do not select the Generate sample untrusted application checkbox, the plugin generates only a trusted file and a Makefile fragment to build and compile the trusted part. See the following graphic. All the code for the enclave, including build Makefile, is put in a directory <root>/sgx/enclave_<name> . C/C++ code for the enclave proper are in <root>/sgx/enclave_<name>/trusted.

      +

      + +

      +

      Generated Skeleton for an Enclave. The option to Generate Sample was not Used

      +
    • +
    • +

      If you select Generate sample untrusted application checkbox, a simple ready to work sample application is generated, including untrusted stubs and implementation for a sample OCALL and ECALL.

      +

      + +

      +

      Generated Sample Untrusted Application

      +
    • +
    +
  6. +
+
+

NOTE:

+

If you select the Generate sample untrusted application checkbox, ecalls from the untrusted part are not be resolved by Eclipse C/C++ indexer. These functions are marked with a red line. The declaration of these ecalls resides in the unstrusted stub header which is generated during the build proces and is not indexed by Eclipse. To resolve this problem, right-click on project root and select Index → Freshen All Files.

+
+ + +

Adding an SGX Trusted Library

+

Trusted Static Libraries helps enclave author have libraries of shared code to be reused by enclaves, in exactly the same manner as usual static libxxx.a libraries are used to share code between regular non-SGX applications. The plugin adds a command to generate the skeleton of a trusted shared library.

+

To add a new SGX Trusted Library:

+
    +
  1. +

    Open Add New SGX Static Trusted Library dialog by right-click on the root of the project and select the appropriate command from Software Guard Extensions Tools menu:

    +

    + +

    +

    Add New SGX Static Trusted Library Dialog

    +
  2. +
  3. +

    Choose a name for the library and click OK. A skeleton for a trusted library is generated in directory <root>/sgx/trustedlib_<name>:

    +

    + +

    +

    A Generated Trusted Library

    +
  4. +
+ + +

Adding an SGX Untrusted Module

+

Add an untrusted module to generate the untrusted stubs so you use an enclave, provided you have access to its .edl file. The enclave might have been built in the current project or in a different project.

+

To use trusted functionality of an enclave for which its *.edl is known, use the command Add SGX Untrusted Module:

+
    +
  1. +

    Open dialog Add Sgx Untrusted Module by right-click-ing the project root in Package Explorer and chose the command from Software Guard Extension Tools.

    +

    + +

    +

    Add SGX Untrusted Module

    +
  2. +
  3. +

    Use the Browse button to navigate the file system using a file dialog, and click OK. The untrusted module is copied to <root>/sgx/untrusted_<edl file name>. The selected *.edl is copied to the project.

    +

    + +

    +

    Copying the Untrusted Module to a Project

    +
  4. +
+ + +

Updating SGX Enclave Signing Key

+

All skeletons enclave samples produced by the plugin contain a sample signing key. You might want to import another sign key that you already have, or generate a new one. Use the command Update SGX Enclave Signing Key to complete this task.

+
    +
  1. Choose Update SGX Enclave Signing Key by right-click on the project in Project Explorer -> Software Guard Extension Tools menu. The Import or (Re)Generate Enclave Signing Key dialog appears.
  2. +
  3. In the Import or (Re)Generate Enclave Signing Key dialog, click Select to open a file dialog to select the output key.
  4. +
  5. +

    Click Improt Key to update a selected signing key by copying another existing key or click Generate Key to update the selected signing key by generating a new key. In both cases, the new signature key is put into the file in text field Enclave Signing Key.

    +

    + +

    +

    Import or (Re)Generate Enclave Signing Key

    +
  6. +
  7. Click OK to update the enclave signing key.
  8. +
+

Under the hood, a new key is generated using openssl*, which needs to be installed on the machine:

+

openssl genrsa -out ../../../encl1_private.pem.key.pem -3 3072 +

+

+ + +

Updating Enclave Configuration Files

+

A configuration file is an important part in the definition of an enclave. Intel(R) SGX SDK signer tool requires such *.xml configuration file as necessary input.

+

To update this configuration file, use the Update Config command:

+
    +
  1. +

    Right-click on the root project, Software Extension Guards Tools->Select Config File.

    +

    + +

    +

    Select Configuration File

    +
  2. +
  3. +

    Click OK or double-click the selected configuration file to open the Enclave Configuration Settings dialog.

    +

    + +

    +

    Enclave Configuration Settings

    +

    For details on the meaning of the fields, see Intel(R) Software Guard Extensions Developer Guide.

    +
  4. +
+ + +

Two Steps Sign Enclave

+

To help you develop enclaves, Intel(R) Software Guard Extensions Eclipse Plug-in generates all required structure including:

+
    +
  • c/c++ files and header files
  • +
  • .edl file
  • +
  • *.config.xml file
  • +
  • a sample Makefile
  • +
  • a sample signing key
  • +
+

While these structure might be appropriate for development and debugging, you need a 2-step process to integrate your own signing schema for generating production enclaves.

+
    +
  1. Generate hash: the signer tool generates signing material from the unsigned compiled enclave and from the configuration file for the enclave. The signed material comes as an opaque sequence of bytes which are put in a file with extension .hex. This file is used with the external signing facility. You come back with a signature for the .hex file plus the public key of your signing facility, and proceed to Step 2.
  2. +
  3. Generate signed enclaves : the signer tool generates the final signed enclave.
  4. +
+

To complete this task, provide the following input parameters:

+
    +
  • The unsigned enclave
  • +
  • The configuration file
  • +
  • The output file produced when you generate hash (the .hex file)
  • +
  • The files produced by the external signing facility: the signature of the .hex file and public key for it
  • +
  • The plugin checks if the input parameters are consistent:
  • +
  • The .hex file matches the unsigned enclave and the configuration file,
  • +
  • The signed material is verified with the public key
  • +
+

If the parameters are consistenet, the production signed enclave is produced.

+
+

NOTE:

+

If you generate signed enclave right after generating hash, you can only enter the parameters specific for generating signed enclave.

+
+

To use the two-step signing function, activate the configuration SGX Hardware Release mode. When this configuration is active, the compilation does not produce a signed enclave, as in the other SGX configurations; the process only produces unsigned enclaves.

+

+ +

+

Configure SGX Hardware Release Mode

+

When you configure the plugin in the SGX Hardware Release Mode, you can see the Generate Hash and Generate Signed Enclave options through Software Guard Extension Tools->Two Step Sign Enclave.

+

+ +

+

Two Step Sign Enclave Menu

+ + +

Generate Hash

+

Generating hash is the first step in the 2-Steps signing process.To generate hash, use the following steps:

+
    +
  1. +

    Right-click on project root, go to Software Guard Extensions Tools menu → Two StepSigne Enclave → Generate Hash

    +

    + +

    +

    Two StepSigne Enclave - Generate Hash

    +
  2. +
  3. In the Generate Hash dialog, enter the required inputs to the corresponding fields:
    • Enter the path to the compiled enclave to be signed in the Enclave Path field. Click Select Enclave to open a file dialog to select the enclave.
    • In the Hash File Location field , enter the path of the output file that will contain signing materials. By default this file has the same file name as the unsigned enclave, with .hex extension added. To change the path, click Select File Path to open a file dialog to select the file path.
    • In the Configuration File path field, enter the path of the configuration filefor the generated hash. Click Select Config to open a dialog to select from all enclave configuration files in the project (similar with the one of the command Update Config).
  4. +
  5. +

    Click OK after you fill in all the fields. The Intel(R) SGX SDK is launched under the hood with the provided parameters and the hash file is generated. A dialog box appears to confirm the completion:

    +

    + +

    +

    Generating Hash Completion Dialog

    +
  6. +
+

You complete the first step, generating hash, in the two step signing enclave. The *.hex file may be signed with the external facility, which generates a signature for it and a public verification key.

+

If you click OK, the Generate Signed Enclave dialog appears. The required fileds in this dialog have been pre-configured with the paths of the unsigned enclave, the configuration file and of the *.hex file. To generated the final signed enclave ready for production immediately, click OK.

+

+ +

+

Generate Signed Enclave Dialog with Pre-configurations

+

If you click Cancel in the Generate Signed Enclave dialog, you can continue the signing process later using the Generate Signed Enclave command.

+ + +

Generate Signed Enclaves

+

Generating signed enclave is the second step in the 2-Steps signing process. You should have the following files to complete this step:

+
    +
  • The .hex file generated with Generate Hash command
  • +
  • The files produced from the external signing facility
  • +
  • The signature of the .hex file
  • +
  • The public verification key
  • +
+

To generate signed encalves, use the following steps:

+
    +
  1. +

    Right-click on the project root, and go to Software Guard Extensions Tools menu → Two Step Sign Enclave → Generate Signed Enclave.

    +

    + +

    +

    Generate Signed Enclave Dialog

    +
  2. +
  3. Enter the inputs to all the fields and click OK.
  4. +
+ + +

Building and Running SGX Code

+

This section describes the following topics about building and running SGX code:

+
    +
  • SGX build configurations
  • +
  • Running samples generated for enclaves
  • +
  + +

SGX Build Configurations

+

There are usually two types of builds that a regular non-SGX project defines:

+
    +
  • Debug
  • +
  • Release
  • +
+

SGX-enabled projects add to this picture support to build and test SGX-enabled application on non-SGX platforms (or emulator) using simulation libraries. This approach doubles the set of build types, creating four possible combinations. For these combinations, you need to use different sets of compilation and linking flags and link different libraries.

+

The non-debug hardware build is meant to give production code, so it requires the maximum attention when signed. The Two Steps Sign schema is required for production enclaves, which involves an external signing facility, not part of Intel SGX SDK. The other configurations are not meant for production but they have to be signed too. The simplest and more convenient Single Step schema is used for them.

+

Again for testing purpose, you might want to experiment with a non-production enclave built with release compilation and linking flags, on a real hardware SGX-enabled platform. That would be an enclave built exactly as a production enclave, except for the sign process which would be Single Step. To support the construction of such enclave, there is a hardware non-debug build configuration dubbed Prerelease.

+

So there are five SGX related configurations when SGX Nature is added to a project:

+

+ +

+

Intel(R) SGX Configurations

+

The following table resumes the existing SGX configurations and relate them with compilation/linking flags (debug/non-debug) and signing scheme (single vs. two steps):

+

Intel(R) SGX Configurations

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Configuration NameSimulation?Debug?Signing Schema
SGX Hardware DebugHardwareDebugSingle Step
SGX Hardware Pre-releaseHardwareNon-debugSingle Step
SGX Hardware ReleaseHardwareNon-debugTwo Step
SGX SimulationSimulationNon-debugSingle Step
SGX SimulationDebug SimulationDebugSingle step
+

Intel® Software Guard Extensions Eclipse Plug-in uses standard GNU* make tool to build the trusted and the untrusted code, using the generated file sgx/Makefile.

+

This fact does not impose any restriction on the build tool chosen for the hosting project. Intel® Software Guard Extensions Eclipse* Plug-in uses its own build configurations which do not interfere with the configurations that you might have in your project.

+

When SGX configurations are selected, by default only code under <root>/sgx directory get built.

+

You can customize SGX configurations as any other Eclipse build configurations from the project properties dialog. For example:

+
    +
  1. Right-click in Project Explorer Properties → C/C++ Build
  2. +
  3. Uncheck the Use default build command checkbox.
  4. +
+

Then you can customize and integrate SGX build process. You can use Makefile instead of sgx/Makefile in the example shown in the following figure:

+

+ +

+

Customization of SGX Build Command

+

The build process is done using standard Eclipse interface for build, by example from the main Project menu:

+

+ +

+

Project Menu

+ + +

Running Samples Generated for Enclaves

+

Intel(R) Software Guard Extensions Eclipse* Plugin provides an option to generate a sample application together with the enclave code when the enclave is created. After the project is build, the sample application is built also and ready to run. You can see the sample application named sample in the enclave directory in Project Explorer. You can run this sample as a local C/C++ application as shown in the following figure:

+

+ +

+

Sample Application

+

See the result of the execution in Eclipse console window as shown below:

+

+ +

+

The Result of Running Samples Generated for Enclaves

+ + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/plugin.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/plugin.xml new file mode 100644 index 0000000000..533d28bf13 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/plugin.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/src/com/intel/sgx/userguide/Activator.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/src/com/intel/sgx/userguide/Activator.java new file mode 100644 index 0000000000..f10dec9896 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/src/com/intel/sgx/userguide/Activator.java @@ -0,0 +1,73 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + +package com.intel.sgx.userguide; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "com.intel.sgx.userguide"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml new file mode 100644 index 0000000000..85c36da39e --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.classpath b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.classpath new file mode 100644 index 0000000000..6c009435ce --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.classpath @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.project b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.project new file mode 100644 index 0000000000..aec7e39589 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.project @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + com.intel.sgx + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.settings/org.eclipse.jdt.core.prefs b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..a698e59674 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/META-INF/MANIFEST.MF b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..f06f84d713 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/META-INF/MANIFEST.MF @@ -0,0 +1,26 @@ +License: Eclipse Public License Version 1.0 ("EPL") +bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: com.intel.sgx;singleton:=true +Bundle-Version: 1.0.1.qualifier +Bundle-Activator: com.intel.sgx.Activator +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.cdt.core;bundle-version="5.11.0", + org.eclipse.core.runtime;bundle-version="3.11.1", + org.eclipse.ui;bundle-version="3.107.0", + org.eclipse.cdt.managedbuilder.ui;bundle-version="8.2.2", + org.eclipse.cdt.managedbuilder.core;bundle-version="8.3.0", + org.eclipse.core.resources;bundle-version="3.10.1", + org.eclipse.cdt.ui;bundle-version="5.11.0", + org.eclipse.core.expressions;bundle-version="3.5.0", + org.eclipse.ui.ide;bundle-version="3.11.0" +Bundle-ActivationPolicy: lazy +Export-Package: com.intel.sgx, + com.intel.sgx.build, + com.intel.sgx.dialogs, + com.intel.sgx.discovery, + com.intel.sgx.handlers, + com.intel.sgx.natures, + com.intel.sgx.preferences, + com.intel.sgx.templates +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/OSGI-INF/l10n/bundle.properties b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000000..171c78c844 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,15 @@ +######################################################################### +# Copyright (c) 2016 Intel Corporation. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Eclipse Public License v1.0 # +# which accompanies this distribution, and is available at # +# http://www.eclipse.org/legal/epl-v10.html # +# # +# Contributors: # +# Intel Corporation - initial implementation and documentation # +######################################################################### + + +Bundle-Vendor = Intel Corporation +Bundle-Name = SGX(R) Linux Eclipse Plugin \ No newline at end of file diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/build.properties b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/build.properties new file mode 100644 index 0000000000..d055ac2fdc --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/build.properties @@ -0,0 +1,24 @@ +######################################################################### +# Copyright (c) 2016 Intel Corporation. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Eclipse Public License v1.0 # +# which accompanies this distribution, and is available at # +# http://www.eclipse.org/legal/epl-v10.html # +# # +# Contributors: # +# Intel Corporation - initial implementation and documentation # +######################################################################### + + +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + templates/,\ + discovery/,\ + build.properties,\ + OSGI-INF/,\ + OSGI-INF/l10n/bundle.properties +jre.compilation.profile = JavaSE-1.8 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.c b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.c new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.c @@ -0,0 +1,2 @@ + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.cpp b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.cpp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/discovery/test.cpp @@ -0,0 +1,2 @@ + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/plugin.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/plugin.xml new file mode 100644 index 0000000000..86a2ba5d05 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/plugin.xml @@ -0,0 +1,786 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An C project, with SGX Commands and Configurations + + + + + + An C++ project, with SGX Commands and Configurations + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Activator.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Activator.java new file mode 100644 index 0000000000..580330b423 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Activator.java @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + +package com.intel.sgx; + +import java.net.URL; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "com.intel.sgx";//$NON-NLS-1$ + + private static Activator plugin; + + public Activator() { + } + + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + public static Activator getDefault() { + return plugin; + } + + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public static void log(Exception e) { + plugin.getLog().log(newStatus(e)); + } + + public static IStatus newStatus(Exception e) { + return new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e); + } + + public static URL findFile(Path path) { + return FileLocator.find(plugin.getBundle(), path, null); + } + + public static Bundle getBundle(String id){ + for(Bundle bundle : plugin.getBundle().getBundleContext().getBundles()){ + if(bundle.getSymbolicName().equals(id)) + return bundle; + } + return null; + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/CConfigurationDataProvider2.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/CConfigurationDataProvider2.java new file mode 100644 index 0000000000..59cdc66e33 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/CConfigurationDataProvider2.java @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx; + +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; +import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +public class CConfigurationDataProvider2 extends CConfigurationDataProvider { + + public CConfigurationDataProvider2() { + } + + @Override + public CConfigurationData loadConfiguration(ICConfigurationDescription des, + IProgressMonitor monitor) throws CoreException { + return null; + } + + @Override + public CConfigurationData createConfiguration( + ICConfigurationDescription des, + ICConfigurationDescription baseDescription, + CConfigurationData baseData, boolean clone, IProgressMonitor monitor) + throws CoreException { + return null; + } + + @Override + public void removeConfiguration(ICConfigurationDescription des, + CConfigurationData data, IProgressMonitor monitor) { + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Messages.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Messages.java new file mode 100644 index 0000000000..d4133b2962 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/Messages.java @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "com.intel.sgx.messages";//$NON-NLS-1$ + + /* + * TODO - These Strings can be used all through the package to control what messages are displayed. + * Todo here is to identify any message that needs to be made configurable. + */ + public static String CreateNativeFolders_No_folders; + public static String CreateNativeFolders_Missing_project_name; + public static String CreateNativeFolders_Project_does_not_exist; + + static{ + //Bundle initialization. + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages(){ + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/SdkPathVariableProvider.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/SdkPathVariableProvider.java new file mode 100644 index 0000000000..43f13da5f9 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/SdkPathVariableProvider.java @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx; +import java.io.File; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.variableresolvers.PathVariableResolver; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.preference.IPreferenceStore; + +import com.intel.sgx.preferences.PreferenceConstants; +import com.intel.sgx.preferences.SGXPreferencePage; + +public class SdkPathVariableProvider extends PathVariableResolver { + + public SdkPathVariableProvider() { + super(); + } + + @Override + public String[] getVariableNames(String variable, IResource resource) { + String variableNames[] = {"SGX_SDK_DIR_PATH"}; + return (variableNames); + } + + @Override + public String getValue(String variable, IResource resource) { + if(variable.equals("SGX_SDK_DIR_PATH")) { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + String SDKPath = store.getString(PreferenceConstants.SDK_PATH); + IPath SDKCanonicalPath= new Path(SDKPath); + return(SDKCanonicalPath.append("Include").toOSString()); + } + return null; + } + + public static String getSGXSdkLocation() { + return Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH); + } + + public static boolean isSGXSdkLocationValid() { + String location = getSGXSdkLocation(); + if (location.length() == 0) + return false; + + return isValidSGXSdkLocation(location); + } + + public static boolean isValidSGXSdkLocation(String location) { + File dir = new File(location); + if (!dir.isDirectory()) + return false; + + return new PreferenceConstants.SGXSDK64Descriptor(dir).getSignerPath().canExecute() + || new PreferenceConstants.SGXSDK32Descriptor(dir).getSignerPath().canExecute(); + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/build/SGXSDKCommandLauncher.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/build/SGXSDKCommandLauncher.java new file mode 100644 index 0000000000..c0eb394532 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/build/SGXSDKCommandLauncher.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +/** + * This class follows the same solution provided in the NDK_PLUGIN for NDKCommandLauncher. + */ +package com.intel.sgx.build; + +import org.eclipse.cdt.core.CommandLauncher; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; + +import com.intel.sgx.SdkPathVariableProvider; +/** + * This launches the sgx-ndk-build. + */ +public class SGXSDKCommandLauncher extends CommandLauncher { + + @Override + public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory, + IProgressMonitor monitor) + throws CoreException { + + return super.execute(commandPath, args, env, changeToDirectory, monitor); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddEnclaveFileDialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddEnclaveFileDialog.java new file mode 100644 index 0000000000..e663a1c390 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddEnclaveFileDialog.java @@ -0,0 +1,126 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import javax.swing.JOptionPane; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import com.intel.sgx.handlers.AddEnclave; + +public class AddEnclaveFileDialog extends SGXDialogBase { + + private Text fileNameField; + private AddEnclave addHandler; + private boolean generateApp = true; + + public AddEnclaveFileDialog(Shell shell, AddEnclave addHandler) { + super(shell); + this.addHandler = addHandler; + this.shell = shell; + // setShellStyle(SWT.RESIZE | SWT.TITLE); + } + + public boolean generateApp() + { + return generateApp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + final Group container = new Group(composite, SWT.NONE); + container.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + + addLabel(container, "Enter the name of the Enclave. Make sure the name is unique within the hosting application."); + + final Label fileNameLabel = new Label(container, SWT.NONE); + fileNameLabel.setText("Enclave name:"); + fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false)); + + fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER); + GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL); + textGridData1.minimumWidth = 400; + textGridData1.grabExcessHorizontalSpace = true; + fileNameField.setLayoutData(textGridData1); + + Button generateUntrustedApp = new Button(container, SWT.CHECK); + generateUntrustedApp.setText("Generate sample untrusted application?"); + generateUntrustedApp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 3, 1)); + generateUntrustedApp.setSelection(true); + + generateUntrustedApp.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent event) { + Button btn = (Button) event.getSource(); + generateApp = btn.getSelection(); + } + }); + + container.layout(); + composite.layout(); + return composite; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Add New SGX Enclave Dialog"); + newShell.layout(); + } + + @Override + protected + void okPressed() { + addHandler.edlFilename = fileNameField.getText(); + if(!fileNameField.getText().isEmpty() + ){ + if(Character.isDigit(fileNameField.getText().charAt(0))) + { + JOptionPane.showMessageDialog(null, "Enclave names starting with digits are not allowed.", "Error", + JOptionPane.ERROR_MESSAGE); + } + else + super.okPressed(); + } + } + + @Override + protected Point getInitialSize(){ + return new Point(675,200); + } + + public String getFileName() { + return fileNameField.getText(); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddTrustedStaticLibFileDialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddTrustedStaticLibFileDialog.java new file mode 100644 index 0000000000..b353c716c8 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddTrustedStaticLibFileDialog.java @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import javax.swing.JOptionPane; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import com.intel.sgx.handlers.AddTrustedStaticLib; + +public class AddTrustedStaticLibFileDialog extends SGXDialogBase { + + private Text fileNameField; + private AddTrustedStaticLib addHandler; + private boolean generateApp = false; + + public AddTrustedStaticLibFileDialog(Shell shell, AddTrustedStaticLib addHandler) { + super(shell); + this.addHandler = addHandler; + this.shell = shell; + // setShellStyle(SWT.RESIZE | SWT.TITLE); + } + + public boolean generateApp() + { + return generateApp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + final Group container = new Group(composite, SWT.NONE); + container.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + + addLabel(container, "Enter the name of the Static Trusted Library."); + addLabel(container, "Make sure the name is unique within the hosting application."); + + final Label fileNameLabel = new Label(container, SWT.NONE); + fileNameLabel.setText("Static Trusted Library Name:"); + fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false)); + + fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER); + GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL); + textGridData1.minimumWidth = 400; + textGridData1.grabExcessHorizontalSpace = true; + fileNameField.setLayoutData(textGridData1); + + composite.layout(); + + return composite; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Add New SGX Static Trusted Library Dialog"); + } + + @Override + protected + void okPressed(){ + addHandler.edlFilename = fileNameField.getText(); + if(!fileNameField.getText().isEmpty() + ){ + if(Character.isDigit(fileNameField.getText().charAt(0))) + { + JOptionPane.showMessageDialog(null, "Enclave names starting with digits are not allowed.", "Error", + JOptionPane.ERROR_MESSAGE); + } + else + super.okPressed(); + } + } + + @Override + protected Point getInitialSize(){ + return new Point(675,200); + } + + public String getFileName() { + return fileNameField.getText(); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddUntrustedModuleDialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddUntrustedModuleDialog.java new file mode 100644 index 0000000000..15779d4651 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/AddUntrustedModuleDialog.java @@ -0,0 +1,138 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import java.io.File; + +import javax.swing.JOptionPane; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import com.intel.sgx.handlers.AddUntrustedModule; + +public class AddUntrustedModuleDialog extends Dialog { + + private Text fileNameField,makeFilePathField; + private Shell shell; + private AddUntrustedModule addHandler; + private boolean generateApp = false; + + public AddUntrustedModuleDialog(Shell shell, AddUntrustedModule addHandler) { + super(shell); + this.addHandler = addHandler; + this.shell = shell; + //setShellStyle(SWT.RESIZE | SWT.TITLE); + } + + public boolean generateApp() + { + return generateApp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + final Group container = new Group(composite, SWT.NONE); + container.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + + final Label messageLabel = new Label(container, SWT.NONE); + messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel.setText("Enter the path to the Enclave Descriptor file (*.edl) of the enclave to host."); + + + final Label fileNameLabel = new Label(container, SWT.NONE); + fileNameLabel.setText("Filename:"); + fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false)); + + + fileNameField = new Text(container,SWT.SINGLE | SWT.BORDER); + GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL); + textGridData1.minimumWidth = 400; + textGridData1.grabExcessHorizontalSpace = true; + fileNameField.setLayoutData(textGridData1); + + final Button browseButton = new Button(container, SWT.PUSH); + browseButton.setText("Browse"); + GridData buttonGridData1 = new GridData(GridData.END); + buttonGridData1.horizontalAlignment = SWT.RIGHT; + buttonGridData1.horizontalSpan = 1; + buttonGridData1.minimumWidth = 120; + browseButton.setLayoutData(buttonGridData1); + browseButton.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = null; + shell = new Shell(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + dialog.setFilterExtensions(new String [] {"*.edl"}); + dialog.setFilterPath(""); + result = dialog.open(); + fileNameField.setText(result); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + + return composite; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Add SGX Untrusted Module."); + } + + @Override + protected + void okPressed(){ + addHandler.edlFilename = fileNameField.getText(); + if(!fileNameField.getText().isEmpty()) + if((new File(fileNameField.getText())).isFile()) + super.okPressed(); + else + JOptionPane.showMessageDialog(null, "EDL file does not exist.", "Error", + JOptionPane.ERROR_MESSAGE); + } + + @Override + protected Point getInitialSize(){ + return new Point(675,200); + } + + public String getFileName() { + return fileNameField.getText(); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/EnclaveConfigDialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/EnclaveConfigDialog.java new file mode 100644 index 0000000000..20595f8095 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/EnclaveConfigDialog.java @@ -0,0 +1,257 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import org.eclipse.jface.preference.JFacePreferences; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import com.intel.sgx.handlers.EnclaveConfigHandler; + +public class EnclaveConfigDialog extends SGXDialogBase { + + @SuppressWarnings("unused") + private Shell shell; + private EnclaveConfigHandler enclaveConfig; + private Label statusLabel; + private Text prodID; + private Text isvSvn; + private Text threadStackSize; + private Text globalHeapSize; + private Text tcsNum; + private Combo tcsPolicy; + private Button disableDebug; + + public EnclaveConfigDialog(Shell parentshell,EnclaveConfigHandler enclaveConfigHandler) { + super(parentshell); + this.shell = parentshell; + this.enclaveConfig = enclaveConfigHandler; + setShellStyle(SWT.RESIZE | SWT.TITLE); + } + + @Override + protected Control createDialogArea(Composite parent) { + + Composite container = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(3,false); + container.setLayout(gridLayout); + + final Group groupLabel1 = new Group(container, SWT.None); + groupLabel1.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + groupLabel1.setLayoutData(innergrid1); + + Label warningLabel = new Label(groupLabel1,SWT.BEGINNING | SWT.WRAP); + warningLabel.setText("Note: Use this Menu to change the Enclave settings."); + + statusLabel = new Label(container,SWT.BEGINNING | SWT.WRAP); + GridData statusGrid = new GridData(GridData.FILL_HORIZONTAL); + statusGrid.horizontalSpan = 3; + statusLabel.setLayoutData(statusGrid); + statusLabel.setText(""); + statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR)); + + final Group groupLabel2 = new Group(container, SWT.None); + groupLabel2.setLayout(new GridLayout(3,false)); + groupLabel2.setText("Modify the Enclave Settings here..."); + GridData innergrid = new GridData(GridData.FILL_HORIZONTAL); + innergrid.horizontalSpan = 3; + groupLabel2.setLayoutData(innergrid); + + final Label messageLabel0 = new Label(groupLabel2, SWT.NONE); + messageLabel0.setText("Product ID:"); + messageLabel0.setLayoutData(new GridData(GridData.BEGINNING)); + + prodID = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER); + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + gridData.horizontalSpan = 2; + gridData.widthHint = 400; + prodID.setLayoutData(gridData); + prodID.setText(enclaveConfig.prodId); + prodID.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent modifyEvent) { + statusLabel.setText(""); + enclaveConfig.prodId = prodID.getText(); + } + }); + + final Label messageLabel1 = new Label(groupLabel2, SWT.NONE); + messageLabel1.setText("ISV SVN:"); + messageLabel1.setLayoutData(new GridData(GridData.BEGINNING)); + + isvSvn = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER); + isvSvn.setLayoutData(gridData); + isvSvn.setText(enclaveConfig.isvSvn); + isvSvn.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent modifyEvent) { + statusLabel.setText(""); + enclaveConfig.isvSvn = isvSvn.getText(); + } + }); + + final Label messageLabel2 = new Label(groupLabel2, SWT.NONE); + messageLabel2.setText("Thread Stack Size:"); + messageLabel2.setLayoutData(new GridData(GridData.BEGINNING)); + + threadStackSize = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER); + threadStackSize.setLayoutData(gridData); + threadStackSize.setText(enclaveConfig.threadStackSize); + threadStackSize.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent modifyEvent) { + enclaveConfig.threadStackSize = threadStackSize.getText(); + if(!(threadStackSize.getText().matches("0x[0-9a-fA-F]{1,}000"))) + { + statusLabel.setText("Error: The Thread Stack Size value must be Page Aligned."); + } + else + { + if(!(enclaveConfig.globalHeapSize.matches("0x[0-9a-fA-F]{1,}000"))) + statusLabel.setText("Error: The Global Heap Size value must be Page Aligned."); + else + statusLabel.setText(""); + } + } + }); + + final Label messageLabel3 = new Label(groupLabel2, SWT.NONE); + messageLabel3.setText("Global Heap Size:"); + messageLabel3.setLayoutData(new GridData(GridData.BEGINNING)); + + globalHeapSize = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER); + globalHeapSize.setLayoutData(gridData); + globalHeapSize.setText(enclaveConfig.globalHeapSize); + globalHeapSize.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent modifyEvent) { + enclaveConfig.globalHeapSize = globalHeapSize.getText(); + if(!(globalHeapSize.getText().matches("0x[0-9a-fA-F]{1,}000"))) + { + statusLabel.setText("Error: The Global Heap Size value must be Page Aligned."); + } + else + { + if(!(enclaveConfig.threadStackSize.matches("0x[0-9a-fA-F]{1,}000"))) + statusLabel.setText("Error: The Thread Stack Size value must be Page Aligned."); + else + statusLabel.setText(""); + + } + } + }); + + final Label messageLabel4 = new Label(groupLabel2, SWT.NONE); + messageLabel4.setText("TCS Number:"); + messageLabel4.setLayoutData(new GridData(GridData.BEGINNING)); + + tcsNum = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER); + tcsNum.setLayoutData(gridData); + tcsNum.setText(enclaveConfig.tcsNum); + tcsNum.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent modifyEvent) { + statusLabel.setText(""); + enclaveConfig.tcsNum = tcsNum.getText(); + } + }); + + final Label messageLabel5 = new Label(groupLabel2, SWT.NONE); + messageLabel5.setText("TCS Policy:"); + messageLabel5.setLayoutData(new GridData(GridData.BEGINNING)); + + final String[] items = {"Unbound","Bound"}; + tcsPolicy = new Combo(groupLabel2, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); + tcsPolicy.setItems(items); + String item = items[Integer.parseInt(enclaveConfig.tcsPolicy)]; + int index = tcsPolicy.indexOf(item); + tcsPolicy.select(index < 0 ? 0 : index); + tcsPolicy.setLayoutData(gridData); + tcsPolicy.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e){ + statusLabel.setText(""); + enclaveConfig.tcsPolicy = (tcsPolicy.getSelectionIndex() == 0 ? "0" : "1"); + } + }); + + + final Label messageLabel6 = new Label(groupLabel2, SWT.NONE); + messageLabel6.setText("Disable Debug:"); + messageLabel6.setLayoutData(new GridData(GridData.BEGINNING)); + + disableDebug = new Button(groupLabel2,SWT.CHECK); + GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL); + disableDebug.setLayoutData(gridData1); + disableDebug.setSelection(enclaveConfig.disableDebug.equals("1")?true:false); + disableDebug.addSelectionListener(new SelectionAdapter(){ + public void widgetSelected(SelectionEvent e){ + statusLabel.setText(""); + enclaveConfig.disableDebug = disableDebug.getSelection()?"1":"0"; + } + }); + + if(statusLabel.getText() != null){ + statusLabel.setVisible(true); + } + else{ + statusLabel.setVisible(false); + } + + return container; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Enclave Configuration Settings:"); + } + + @Override + protected Point getInitialSize(){ + return new Point(450,400); + } + + @Override + protected + void okPressed(){ + enclaveConfig.prodId = this.prodID.getText(); + enclaveConfig.isvSvn = this.isvSvn.getText(); + enclaveConfig.threadStackSize = this.threadStackSize.getText(); + enclaveConfig.globalHeapSize = this.globalHeapSize.getText(); + enclaveConfig.tcsNum = this.tcsNum.getText(); + enclaveConfig.tcsPolicy = this.tcsPolicy.getSelectionIndex() == 0 ? "0" : "1"; + enclaveConfig.disableDebug = disableDebug.getSelection()?"1":"0"; + + + if((statusLabel.getText() == "") && (enclaveConfig.globalHeapSize.matches("0x[0-9a-fA-F]{1,}000")) && (enclaveConfig.threadStackSize.matches("0x[0-9a-fA-F]{1,}000"))) + super.okPressed(); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/RemoveEnclaveFileDialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/RemoveEnclaveFileDialog.java new file mode 100644 index 0000000000..6db3d2e1c4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/RemoveEnclaveFileDialog.java @@ -0,0 +1,122 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +//import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import com.intel.sgx.handlers.RemoveEnclave; + +public class RemoveEnclaveFileDialog extends Dialog{ + + private Text fileNameField; + private Shell shell; + private RemoveEnclave removeHandler; + + public RemoveEnclaveFileDialog(Shell shell, RemoveEnclave removeHandler) { + super(shell); + this.removeHandler = removeHandler; + this.shell = shell; + setShellStyle(SWT.RESIZE | SWT.TITLE); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + final Group container = new Group(composite, SWT.None); + container.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + container.setText("Path to Enclave directory:"); + + final Label messageLabel = new Label(container, SWT.NONE); + messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel.setText("Enter the name of the Enclave Or Navigate to the Enclave folder to be removed from the host."); + + final Label fileNameLabel = new Label(container, SWT.NONE); + fileNameLabel.setLayoutData(new GridData(GridData.BEGINNING,GridData.CENTER, false, false)); + fileNameLabel.setText("Enclave Name:"); + + fileNameField = new Text(container, SWT.SINGLE | SWT.BORDER); + GridData textGridData1 = new GridData(GridData.FILL_HORIZONTAL); + textGridData1.minimumWidth = 400; + textGridData1.grabExcessHorizontalSpace = true; + fileNameField.setLayoutData(textGridData1); + + final Button browseButton = new Button(container, SWT.PUSH); + browseButton.setText("Browse"); + GridData buttonGridData1 = new GridData(GridData.END); + buttonGridData1.horizontalAlignment = SWT.RIGHT; + buttonGridData1.horizontalSpan = 1; + buttonGridData1.minimumWidth = 120; + browseButton.setLayoutData(buttonGridData1); + browseButton.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = fileNameField.getText(); + + DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN); + dialog.setMessage("Select the Enclave Directory to remove."); + dialog.setFilterPath(""); + result = dialog.open(); + fileNameField.setText(result); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + + return container; + } + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Remove an Imported Enclave"); + } + + @Override + protected void okPressed(){ + removeHandler.edlFilename = fileNameField.getText(); + if(!fileNameField.getText().isEmpty()) + super.okPressed(); + } + + @Override + protected Point getInitialSize(){ + return new Point(675,205); + } + + public String getFileName() { + return fileNameField.getText(); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/SGXDialogBase.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/SGXDialogBase.java new file mode 100644 index 0000000000..4b49a8bb31 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/SGXDialogBase.java @@ -0,0 +1,222 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import java.io.InputStream; +import java.util.Scanner; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog; + +import com.intel.sgx.Activator; + +public abstract class SGXDialogBase extends Dialog { + + protected Shell shell; + public Text configFileField; + public static FilteredResourcesSelectionDialog dialogForConfig(Shell shell) { + // final IContainer container = ResourcesPlugin.getWorkspace().getRoot(); + + final IContainer container = SGXDialogBase.getCurrentProject(); + + FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog( + shell, false, container, IResource.FILE) { + { + setInitialPattern("**"); + } + + @Override + protected IStatus validateItem(Object item) { + // return Status.OK_STATUS; + IFile f = (IFile) item; + if (f.getParent() instanceof IProject) { + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, + "The selected resource has to be part of the source folder"); + } + + + return super.validateItem(item); + } + + protected ItemsFilter createFilter() { + return new ResourceFilter(container, true, IResource.FILE) { + + @Override + public boolean matchItem(Object item) { + return isConfigFile(item); + } + + private boolean isConfigFile(Object item) { + if (!(item.toString().endsWith(".xml") && super + .matchItem(item))) { + return false; + } + try { + IFile iFile = (IFile) item; + return streamContainsString(iFile.getContents(), + ""); + } catch (Throwable e) { + return false; + } + } + + }; + + } + + public boolean streamContainsString(InputStream is, + String searchString) { + Scanner streamScanner = new Scanner(is); + if (streamScanner.findWithinHorizon(searchString, 0) != null) { + return true; + } else { + return false; + } + } + + }; + return d; + } + + + + protected SelectionListener configFileSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + + FilteredResourcesSelectionDialog d = dialogForConfig(shell); + d.setTitle("Select Config File"); + if (d.open() == Dialog.OK) { + IFile target = (IFile) d.getResult()[0]; + configFileField.setText(target.getLocation().toOSString()); + } + ; + } + + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + // TODO Auto-generated method stub + + } + + }; + + public SGXDialogBase(Shell parentShell) { + super(parentShell); + } + + public SGXDialogBase(IShellProvider parentShell) { + super(parentShell); + } + + protected Text addGroup(Composite composite, String title, String subtitle, + String label, String selectButtonLabel, SelectionListener selectionListener) { + final Group container = new Group(composite, SWT.None); + container.setLayout(new GridLayout(3, false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + container.setText(title); + + final Label messageLabel = new Label(container, SWT.NONE); + messageLabel.setLayoutData(new GridData(GridData.BEGINNING, + GridData.CENTER, false, false, 3, 1)); + messageLabel.setText(subtitle); + + final Label messageLabel1 = new Label(container, SWT.NONE); + messageLabel1.setText(label); + messageLabel1.setLayoutData(new GridData(GridData.BEGINNING)); + + Text directoryNameField = new Text(container, SWT.SINGLE | SWT.BORDER); + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + gridData.horizontalSpan = 1; + gridData.widthHint = 400; + directoryNameField.setLayoutData(gridData); + + final Button selectButton = new Button(container, SWT.PUSH); + selectButton.setText(selectButtonLabel); + GridData buttonGridData = new GridData(GridData.END); + buttonGridData.horizontalAlignment = SWT.RIGHT; + buttonGridData.horizontalSpan = 1; + buttonGridData.minimumWidth = 120; + selectButton.setLayoutData(buttonGridData); + selectButton.addSelectionListener(selectionListener); + return directoryNameField; + } + + + public IPath getCurrentProjectPath() { + IProject project = getCurrentProject(); + + IPath path = null; + if (project != null) { + path = project.getLocation(); + } + return path; + } + + static public IProject getCurrentProject() { + IProject project = null; + + + IWorkbenchWindow window = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow(); + if (window != null) { + IStructuredSelection selection = (IStructuredSelection) window + .getSelectionService().getSelection(); + Object firstElement = selection.getFirstElement(); + if (firstElement instanceof IAdaptable) { + project = (IProject) ((IAdaptable) firstElement) + .getAdapter(IProject.class); + } + } + return project; + } + + @Override + protected void configureShell(Shell newShell){ + super.configureShell(newShell); + } + + protected void addLabel(final Group container, String labelText) { + final Label messageLabel = new Label(container, SWT.NONE); + messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel.setText(labelText); + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignDialogBase.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignDialogBase.java new file mode 100644 index 0000000000..07d25c7321 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignDialogBase.java @@ -0,0 +1,174 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import java.io.File; +import java.util.Scanner; + +import javax.swing.JOptionPane; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public abstract class TwoStepSignDialogBase extends SGXDialogBase { + + public Text enclaveFileField; + public Text hashFileField; + public Text externalSignPublicKeyFileField; + public Text externalSignedHashFileField; + public Text outputSignedEnclaveFileField; + + public TwoStepSignDialogBase(Shell parentShell) { + super(parentShell); + setShellStyle(SWT.RESIZE | SWT.TITLE); + this.shell = TwoStepSignDialogBase.this.getParentShell(); + + } + + // for each field, a corresponding listener + protected SelectionListener enclaveFileSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = enclaveFileField.getText(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + + + + dialog.setFilterExtensions(new String[]{"*.so"} ); + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + + if (result != null && !result.isEmpty()) { + dialog.setFilterPath(new File(result).getParent()); + } else { + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + } + + result = dialog.open(); + + enclaveFileField.setText(result); + + hashFileField.setText(result + ".hex"); + + if (outputSignedEnclaveFileField != null){ + String outputSignedEnclavePath = result; + if(outputSignedEnclavePath.endsWith(".so")) + { + outputSignedEnclavePath = + outputSignedEnclavePath.substring(0,outputSignedEnclavePath.length() - ".so".length()); + outputSignedEnclaveFileField.setText(outputSignedEnclavePath+".signed.so"); + } + + } + + + + } + + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + } + }; + + protected SelectionListener hashFileSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = hashFileField.getText(); + + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + + if (result != null && !result.isEmpty()) { + dialog.setFilterPath(new File(result).getParent()); + } else { + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + } + + result = dialog.open(); + + hashFileField.setText(result); + } + + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + } + + }; + + protected SelectionListener publicKeyLocationSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = externalSignPublicKeyFileField.getText(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + dialog.setFilterExtensions(new String [] {"*.pem", "*"}); + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + result = dialog.open(); + externalSignPublicKeyFileField.setText(result); + } + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + + protected SelectionListener externalSignedHashFileSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = externalSignedHashFileField.getText(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + result = dialog.open(); + externalSignedHashFileField.setText(result); + } + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + + protected SelectionListener outputSignedEnclaveListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = outputSignedEnclaveFileField.getText(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + + + dialog.setFilterExtensions(new String[]{"*.so", } ); + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + + if (result != null && !result.isEmpty()) { + dialog.setFilterPath(new File(result).getParent()); + } else { + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + } + + result = dialog.open(); + + outputSignedEnclaveFileField.setText(result); + + } + + @Override + public void widgetDefaultSelected(SelectionEvent arg0) { + } + }; + + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + } + + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog1.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog1.java new file mode 100644 index 0000000000..fdba448164 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog1.java @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + +import com.intel.sgx.handlers.TwoStepSignHandlerBase; + +public class TwoStepSignStep1Dialog1 extends TwoStepSignDialogBase { + + final private TwoStepSignHandlerBase handler; + + public TwoStepSignStep1Dialog1(Shell parentShell, TwoStepSignHandlerBase handler) { + super(parentShell); + this.handler = handler; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1, false); + composite.setLayout(gridLayout); + + enclaveFileField = addGroup(composite, "Unsigned Enclave Path:", + "Select Enclave for which to generate the Hash.", + "Enclave Path:", "Select Enclave", enclaveFileSelectionListener); + + hashFileField = addGroup(composite, "Generate Hash:", + "Select Location to Output Hash File.", "Hash File Location:", + "Select File Path", hashFileSelectionListener); + + configFileField = addGroup(composite, "Configuration File:", + "Select Input Configuration XML File. ", + "Configuration File:", "Select Config", + configFileSelectionListener); + + composite.pack(true); + return composite; + } + + @Override + protected void okPressed() { + handler.enclaveFile = enclaveFileField.getText(); + handler.hashFile = hashFileField.getText(); + handler.configFile = configFileField.getText(); + + super.okPressed(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Two Step Enclave Sign - Generate Hash"); + } + + + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog2.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog2.java new file mode 100644 index 0000000000..4c2852f9f4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog2.java @@ -0,0 +1,89 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +public class TwoStepSignStep1Dialog2 extends TwoStepSignDialogBase { + + final private String hashFile; + + public TwoStepSignStep1Dialog2(Shell parentShell, String hashFile) { + super(parentShell); + this.hashFile = hashFile; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + addGroup1(composite); + addGroup3(composite); + + + return composite; + } + + private void addGroup1(Composite composite) { + final Group container = new Group(composite, SWT.None); + container.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + container.setText("Hash File:"); + + final Label messageLabel = new Label(container, SWT.NONE); + messageLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel.setText("Hash File Generated at Location:"); + + final Label messageLabel1 = new Label(container, SWT.NONE); + messageLabel1.setText(hashFile); + + messageLabel1.setLayoutData(new GridData(GridData.BEGINNING)); + } + + private void addGroup3(Composite composite) { + final Group container3 = new Group(composite, SWT.None); + container3.setLayout(new GridLayout(3,false)); + GridData innergrid3 = new GridData(GridData.FILL_HORIZONTAL); + innergrid3.horizontalSpan = 3; + container3.setLayoutData(innergrid3); + container3.setText("Generate Signed Enclave (Step-2):"); + + final Label messageLabel4 = new Label(container3, SWT.NONE); + messageLabel4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel4.setText("To Generate Signed Enclave Now: Click OK"); + + final Label messageLabel5 = new Label(container3, SWT.NONE); + messageLabel5.setLayoutData(new GridData(GridData.CENTER, GridData.END, false, false, 3, 1)); + messageLabel5.setText("To Generate Signed Enclave Later: Click Cancel"); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Two Step Enclave Sign - Generate Hash"); + } + + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog3.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog3.java new file mode 100644 index 0000000000..976f1c21b3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep1Dialog3.java @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +import com.intel.sgx.handlers.TwoStepSignHandlerBase; + +public class TwoStepSignStep1Dialog3 extends TwoStepSignDialogBase { + + final private TwoStepSignHandlerBase handler; + + public TwoStepSignStep1Dialog3(Shell parentShell, TwoStepSignHandlerBase handler) { + super(parentShell); + this.handler = handler; + } + + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1, false); + composite.setLayout(gridLayout); + + addInfoGroup(composite); + + externalSignPublicKeyFileField = addGroup(composite, "Public Key:", + "Select the Public Key file obtained from signing facility", + "Public Key:", "Select", publicKeyLocationSelectionListener); + + externalSignedHashFileField = addGroup(composite, "Signature:", + "Select the Signature file obtained from signing facility.", + "Signature:", + "Select", externalSignedHashFileSelectionListener); + + + outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:", + "Select where to save the output Signed Enclave.", + "Signed Enclave:", + "Select", outputSignedEnclaveListener); + + return composite; + } + + protected void addInfoGroup(Composite composite) { + final Group container = new Group(composite, SWT.None); + container.setLayout(new GridLayout(3,false)); + GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL); + innergrid1.horizontalSpan = 3; + container.setLayoutData(innergrid1); + container.setText("Hash and Enclave:"); + + + addInfoKeyValue(container, "Enclave File:", handler.enclaveFile); + addInfoKeyValue(container, "Config File:", handler.configFile); + addInfoKeyValue(container, "Hash File:", handler.hashFile); + } + + private void addInfoKeyValue(final Group container, String key, + String value) { + final Label messageLabel2 = new Label(container, SWT.NONE); + messageLabel2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel2.setText(key); + + final Label messageLabel3 = new Label(container, SWT.NONE); + messageLabel3.setText(value); + messageLabel3.setLayoutData(new GridData(GridData.BEGINNING)); + } + + @Override + protected void okPressed() { + handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText(); + handler.externallySignedHashFile = externalSignedHashFileField.getText(); + handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText(); + super.okPressed(); + } + + + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Two Step Enclave Sign - Generate Signed Enclave"); + } + + + + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep2Dialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep2Dialog.java new file mode 100644 index 0000000000..acd9e99627 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/TwoStepSignStep2Dialog.java @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + +import com.intel.sgx.handlers.TwoStepSignHandlerBase; +import com.intel.sgx.handlers.TwoStepSignStep2; + +public class TwoStepSignStep2Dialog extends TwoStepSignDialogBase{ + + final private TwoStepSignHandlerBase handler; + + + public TwoStepSignStep2Dialog(Shell parentShell, TwoStepSignHandlerBase handler) { + super(parentShell); + this.handler = handler; + } + + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + + + enclaveFileField= addGroup(composite, "Enclave:", + "Select the unsigned enclave file", + "Unsigned Enclave File:", "Select", enclaveFileSelectionListener); + + configFileField = addGroup(composite, "Configuration File:", + "Select Input Configuration XML File. ", + "Configuration File:", "Select Config", + configFileSelectionListener); + + hashFileField= addGroup(composite, "Hash:", + "Select the Hash file obtained from previous step", + "Hash File:", "Select", hashFileSelectionListener); + + externalSignPublicKeyFileField= addGroup(composite, "Public Key:", + "Select the Public Key file obtained from external signing facility", + "Public Key:", "Select", publicKeyLocationSelectionListener); + + externalSignedHashFileField = addGroup(composite, "Signature:", + "Select the Signature file obtained from signing facility.", + "Signature:", + "Select", externalSignedHashFileSelectionListener); + + outputSignedEnclaveFileField = addGroup(composite, "Signed Enclave:", + "Select where to save the output Signed Enclave.", + "Signed Enclave:", + "Select", outputSignedEnclaveListener); + + return composite; + } + + + @Override + protected void okPressed() { + handler.enclaveFile = enclaveFileField.getText(); + handler.hashFile = hashFileField.getText(); + handler.configFile = configFileField.getText(); + handler.externalSignPublicKeyFile = externalSignPublicKeyFileField.getText(); + handler.externallySignedHashFile = externalSignedHashFileField.getText(); + handler.outputSignedEnclaveFile = outputSignedEnclaveFileField.getText(); + + super.okPressed(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Two Step Enclave Sign - Generate Signed Enclave"); + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/UpdateSignKeyDialog.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/UpdateSignKeyDialog.java new file mode 100644 index 0000000000..502fb2dcfa --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/dialogs/UpdateSignKeyDialog.java @@ -0,0 +1,191 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.dialogs; + +import java.io.File; + +import javax.swing.JOptionPane; + +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import com.intel.sgx.handlers.UpdateSigningKey; + +public class UpdateSignKeyDialog extends SGXDialogBase { + + private Shell shell; + public Text sourceKeyFileField; + public Text destinationKeyFileField; + public static boolean regenerate = false; + + private final SelectionListener destinationKeyFileSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = destinationKeyFileField.getText(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + dialog.setFilterExtensions(new String [] {"*.pem", "*"}); + result = dialog.open(); + destinationKeyFileField.setText(result); + } + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + + private final SelectionListener sourceKeyFileSelectionListener = new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + String result = sourceKeyFileField.getText(); + FileDialog dialog = new FileDialog(shell, SWT.OPEN); + dialog.setFilterExtensions(new String [] {"*.pem", "*"}); + dialog.setFilterPath(getCurrentProjectPath().toOSString()); + result = dialog.open(); + sourceKeyFileField.setText(result); + } + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + final private UpdateSigningKey handler; + + public UpdateSignKeyDialog(Shell parentShell, UpdateSigningKey handler) { + super(parentShell); + this.shell = parentShell; + this.handler = handler; + setShellStyle(SWT.RESIZE | SWT.TITLE); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + final GridLayout gridLayout = new GridLayout(1,false); + composite.setLayout(gridLayout); + + destinationKeyFileField = addGroup(composite, "Enclave Signing Key:", + "Select the Signing Key to be Updated or Generated.", + "Enclave Signing Key:", "Select", destinationKeyFileSelectionListener); + + sourceKeyFileField = addGroup(composite, "Import:", + "To import your own Signing Key use the Import Signing Key option.", + "Import Signing Key:", "Import Key", sourceKeyFileSelectionListener); + + addGroup2(composite); + + return composite; + } + + protected void addGroup2(Composite composite) { + final Group container2 = new Group(composite, SWT.None); + container2.setLayout(new GridLayout(3,false)); + GridData innergrid2 = new GridData(GridData.FILL_HORIZONTAL); + innergrid2.horizontalSpan = 3; + container2.setLayoutData(innergrid2); + container2.setText("Generate:"); + + final Label messageLabel3 = new Label(container2, SWT.NONE); + messageLabel3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); + messageLabel3.setText("To Generate a new Signing Key use the Generate Signing Key option."); + + Label warningLabel2 = new Label(container2,SWT.FILL | SWT.WRAP); + warningLabel2.setText("Generate a new Signing Key:"); + warningLabel2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label dummy2 = new Label(container2,0); + dummy2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + final Button updateSigningKey = new Button(container2, SWT.PUSH); + updateSigningKey.setText("Generate Key"); + GridData buttonGridData2 = new GridData(GridData.END); + buttonGridData2.horizontalAlignment = SWT.RIGHT; + buttonGridData2.horizontalSpan = 1; + buttonGridData2.minimumWidth = 120; + updateSigningKey.setLayoutData(buttonGridData2); + updateSigningKey.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent event) { + if( !destinationKeyFileField.getText().isEmpty()) + { + regenerate = true; + UpdateSignKeyDialog.this.setReturnCode(InputDialog.OK); + okPressed(); + UpdateSignKeyDialog.this.close(); + } + else + JOptionPane.showMessageDialog(null, "Enclave Signing Key field is not provided.", "Error", + JOptionPane.ERROR_MESSAGE); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + } + + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Import or (Re)Generate Enclave Signing Key"); + } + + @Override + protected void okPressed() { + + handler.sourceKeyFile = sourceKeyFileField.getText(); + handler.destinationKeyFile = destinationKeyFileField.getText(); + if((!sourceKeyFileField.getText().isEmpty() && !destinationKeyFileField.getText().isEmpty() && + (new File(sourceKeyFileField.getText())).isFile()) + || regenerate == true ) + { + System.out.println("regenerate = " + regenerate); + super.okPressed(); + } + else + { + if(sourceKeyFileField.getText().isEmpty() && destinationKeyFileField.getText().isEmpty()) + JOptionPane.showMessageDialog(null, "Enclave Signing Key and Import Singing Key are not provided.", "Error", + JOptionPane.ERROR_MESSAGE); + else + { + if(sourceKeyFileField.getText().isEmpty()) + JOptionPane.showMessageDialog(null, "Import Singing Key is not provided.", "Error", + JOptionPane.ERROR_MESSAGE); + else + if(!(new File(sourceKeyFileField.getText())).isFile()) + JOptionPane.showMessageDialog(null, "Invalid Import Singing Key.", "Error", + JOptionPane.ERROR_MESSAGE); + + if(destinationKeyFileField.getText().isEmpty()) + JOptionPane.showMessageDialog(null, "Enclave Signing Key is not provided.", "Error", + JOptionPane.ERROR_MESSAGE); + } + } + + } + + + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveredPathInfo.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveredPathInfo.java new file mode 100644 index 0000000000..2c48b2fb39 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveredPathInfo.java @@ -0,0 +1,202 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.discovery; + +import java.util.List; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; + +import com.intel.sgx.Activator; +/* + * This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code. + */ +public class SGXSDKDiscoveredPathInfo implements IDiscoveredPathInfo { + + private final IProject mProject; + private long mLastUpdate = IFile.NULL_STAMP; + private IPath[] mIncludePaths; + private Map mSymbols; + private boolean mNeedReindexing = false; + private static final IPath LINUX_MK = new Path("sgx/Makefile"); + + //Keys for preferences + // public static final String LAST_UPDATE = "lastUpdate"; //$NON-NLS-1$ + + + public SGXSDKDiscoveredPathInfo(IProject project) { + this.mProject = project; + load(); + } + + @Override + public IProject getProject() { + return mProject; + } + + @Override + public IPath[] getIncludePaths() { + if (mNeedReindexing) { + CCorePlugin.getIndexManager().reindex(CoreModel.getDefault().create(mProject)); + mNeedReindexing = false; + } + return mIncludePaths; + } + + void setIncludePaths(List pathStrings) { + mIncludePaths = new IPath[pathStrings.size()]; + int i = 0; + for (String path : pathStrings) + mIncludePaths[i++] = new Path(path); + mNeedReindexing = true; + } + + @Override + public Map getSymbols() { + if (mSymbols == null) + mSymbols = new HashMap(); + return mSymbols; + } + + void setSymbols(Map symbols) { + this.mSymbols = symbols; + } + + @Override + public IDiscoveredScannerInfoSerializable getSerializable() { + return null; + } + + public void update(IProgressMonitor monitor) throws CoreException { + if (!needUpdating()) + return; + + new SGXSDKDiscoveryUpdater(this).runUpdate(monitor); + + if (mIncludePaths != null && mSymbols != null) { + recordUpdate(); + save(); + } + } + + private boolean needUpdating() { + + + if (mLastUpdate == IFile.NULL_STAMP) { + return true; + } + + return mProject.getFile(LINUX_MK).getLocalTimeStamp() > mLastUpdate; + } + + private void recordUpdate() { + mLastUpdate = mProject.getFile(LINUX_MK).getLocalTimeStamp(); + } + + public void delete() { + mLastUpdate = IFile.NULL_STAMP; + } + + private File getInfoFile() { + File stateLoc = Activator.getDefault().getStateLocation().toFile(); + return new File(stateLoc, mProject.getName() + ".pathInfo"); //$NON-NLS-1$ + } + + private void save() { + try { + File infoFile = getInfoFile(); + infoFile.getParentFile().mkdirs(); + PrintStream out = new PrintStream(infoFile); + + out.print("t,"); //$NON-NLS-1$ + out.print(mLastUpdate); + out.println(); + + for (IPath include : mIncludePaths) { + out.print("i,"); //$NON-NLS-1$ + out.print(include.toPortableString()); + out.println(); + } + + for (Entry symbol : mSymbols.entrySet()) { + out.print("d,"); //$NON-NLS-1$ + out.print(symbol.getKey()); + out.print(","); //$NON-NLS-1$ + out.print(symbol.getValue()); + out.println(); + } + + out.close(); + } catch (IOException e) { + Activator.log(e); + } + + } + + private void load() { + try { + File infoFile = getInfoFile(); + if (!infoFile.exists()) + return; + + long timestamp = IFile.NULL_STAMP; + List includes = new ArrayList(); + Map defines = new HashMap(); + + BufferedReader reader = new BufferedReader(new FileReader(infoFile)); + for (String line = reader.readLine(); line != null; line = reader.readLine()) { + switch (line.charAt(0)) { + case 't': + timestamp = Long.valueOf(line.substring(2)); + break; + case 'i': + includes.add(Path.fromPortableString(line.substring(2))); + break; + case 'd': + int n = line.indexOf(',', 2); + if (n == -1) + defines.put(line.substring(2), ""); //$NON-NLS-1$ + else + defines.put(line.substring(2, n), line.substring(n + 1)); + break; + } + } + reader.close(); + + mLastUpdate = timestamp; + mIncludePaths = includes.toArray(new IPath[includes.size()]); + mSymbols = defines; + } catch (IOException e) { + Activator.log(e); + } + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveryUpdater.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveryUpdater.java new file mode 100644 index 0000000000..4c10fccdcc --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKDiscoveryUpdater.java @@ -0,0 +1,310 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.discovery; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.managedbuilder.core.IBuilder; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; + +import com.intel.sgx.Activator; +import com.intel.sgx.build.SGXSDKCommandLauncher; + +/* + * This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code. + */ +public class SGXSDKDiscoveryUpdater { + private final SGXSDKDiscoveredPathInfo mPathInfo; + private final IProject mProject; + + private boolean mCPlusPlus = false; + private String mCommand; + private List mArguments = new ArrayList(); + + public SGXSDKDiscoveryUpdater(SGXSDKDiscoveredPathInfo pathInfo) { + mPathInfo = pathInfo; + mProject = pathInfo.getProject(); + } + + public void runUpdate(IProgressMonitor monitor) throws CoreException { + try { + // Run make -nB to get the list of commands + IPath commandPath = new Path("make"); //$NON-NLS-1$ + String[] args = {"-f", "sgx/Makefile", "-n", "-B" }; //$NON-NLS-1$ + String[] env = calcEnvironment(); + File projectDir = new File(mProject.getLocationURI()); + IPath changeToDirectory = new Path(projectDir.getAbsolutePath()); + Process proc = new SGXSDKCommandLauncher().execute(commandPath, args, env,changeToDirectory, monitor); + if (proc == null) { + return; + } + + BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream())); + String line = reader.readLine(); + while (line != null) { + checkBuildLine(line); + line = reader.readLine(); + } + + if (mCommand == null) { + return; + } + + // Run the unique commands with special gcc options to extract the + // symbols and paths + // -E -P -v -dD + mArguments.add("-E"); //$NON-NLS-1$ + mArguments.add("-P"); //$NON-NLS-1$ + mArguments.add("-v"); //$NON-NLS-1$ + mArguments.add("-dD"); //$NON-NLS-1$ + + URL url = Activator.findFile(new Path("discovery/" + (mCPlusPlus ? "test.cpp" : "test.c"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + File testFile = new File(FileLocator.toFileURL(url).toURI()); + String testFileName = testFile.getAbsolutePath().replace('\\', '/'); + mArguments.add(testFileName); + + args = mArguments.toArray(new String[mArguments.size()]); + proc = new SGXSDKCommandLauncher().execute(new Path(mCommand), args, env,changeToDirectory, monitor); + + final InputStream errStream = proc.getErrorStream(); + new Thread() { + @Override + public void run() { + checkIncludes(errStream); + }; + }.start(); + + checkDefines(proc.getInputStream()); + } catch (IOException e) { + throw new CoreException(Activator.newStatus(e)); + } catch (URISyntaxException e) { + throw new CoreException(Activator.newStatus(e)); + } + } + + private String[] calcEnvironment() throws CoreException { + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(mProject); + IBuilder builder = info.getDefaultConfiguration().getBuilder(); + HashMap envMap = new HashMap(); + if (builder.appendEnvironment()) { + ICConfigurationDescription cfgDes = ManagedBuildManager.getDescriptionForConfiguration(builder.getParent().getParent()); + IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager(); + IEnvironmentVariable[] vars = mngr.getVariables(cfgDes, true); + for (IEnvironmentVariable var : vars) { + envMap.put(var.getName(), var.getValue()); + } + } + // Add variables from build info + Map builderEnv = builder.getExpandedEnvironment(); + if (builderEnv != null) + envMap.putAll(builderEnv); + List strings = new ArrayList(envMap.size()); + for (Entry entry : envMap.entrySet()) { + StringBuffer buffer = new StringBuffer(entry.getKey()); + buffer.append('=').append(entry.getValue()); + strings.add(buffer.toString()); + } + return strings.toArray(new String[strings.size()]); + } + + private static class Line { + private final String line; + private int pos; + + public Line(String line) { + this.line = line; + } + + public Line(String line, int pos) { + this(line); + this.pos = pos; + } + + public String getToken() { + skipWhiteSpace(); + if (pos == line.length()) + return null; + + int start = pos; + boolean inQuote = false; + + while (true) { + char c = line.charAt(pos); + if (c == ' ') { + if (!inQuote) + return line.substring(start, pos); + } else if (c == '"') { + inQuote = !inQuote; + } + + if (++pos == line.length()) + return null; + } + + } + + private String getRemaining() { + if (pos == line.length()) + return null; + + skipWhiteSpace(); + String rc = line.substring(pos); + pos = line.length(); + return rc; + } + + private void skipWhiteSpace() { + while (true) { + if (pos == line.length()) + return; + char c = line.charAt(pos); + if (c == ' ') + pos++; + else + return; + } + } + } + + private void checkBuildLine(String text) { + Line line = new Line(text); + String cmd = line.getToken(); + if (cmd == null) { + return; + } else if (cmd.endsWith("g++")) { //$NON-NLS-1$ + if (mCommand == null || !mCPlusPlus) { + mCommand = cmd; + mCPlusPlus = true; + } + gatherOptions(line); + } else if (cmd.endsWith("gcc")) { //$NON-NLS-1$ + if (mCommand == null){ + mCommand = cmd; + } + gatherOptions(line); + } + + } + + private void gatherOptions(Line line) { + for (String option = line.getToken(); option != null; option = line.getToken()) { + if (option.startsWith("-")) { //$NON-NLS-1$ + // only look at options + if (option.equals("-I")) { //$NON-NLS-1$ + String dir = line.getToken(); + if (dir != null) + addArg(option + dir); + } else if (option.startsWith("-I")) { //$NON-NLS-1$ + addArg(option); + } else if (option.equals("-D")) { //$NON-NLS-1$ + String def = line.getToken(); + if (def != null) + addArg(option + def); + } else if (option.startsWith("-D")) { //$NON-NLS-1$ + addArg(option); + } else if (option.startsWith("-f")) { //$NON-NLS-1$ + addArg(option); + } else if (option.startsWith("-m")) { //$NON-NLS-1$ + addArg(option); + } else if (option.startsWith("--sysroot")) { //$NON-NLS-1$ + addArg(option); + } + } + } + } + + private void addArg(String arg) { + if (!mArguments.contains(arg)) + mArguments.add(arg); + } + + private void checkIncludes(InputStream in) { + try { + List includes = new ArrayList(); + boolean inIncludes1 = false; + boolean inIncludes2 = false; + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line = reader.readLine(); + while (line != null) { + if (!inIncludes1) { + if (line.equals("#include \"...\" search starts here:")) //$NON-NLS-1$ + inIncludes1 = true; + } else { + if (!inIncludes2) { + if (line.equals("#include <...> search starts here:")) //$NON-NLS-1$ + inIncludes2 = true; + else + includes.add(line.trim()); + } else { + if (line.equals("End of search list.")) { //$NON-NLS-1$ + mPathInfo.setIncludePaths(includes); + } else { + includes.add(line.trim()); + } + } + } + line = reader.readLine(); + } + } catch (IOException e) { + Activator.log(e); + } + } + + private void checkDefines(InputStream in) { + try { + Map defines = new HashMap(); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String line = reader.readLine(); + while (line != null) { + if (line.startsWith("#define")) { //$NON-NLS-1$ + Line l = new Line(line, 7); + String var = l.getToken(); + if (var == null) + continue; + String value = l.getRemaining(); + if (value == null) + value = ""; //$NON-NLS-1$ + defines.put(var, value); + } + line = reader.readLine(); + } + mPathInfo.setSymbols(defines); + } catch (IOException e) { + Activator.log(e); + } + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKScannerInfoCollector.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKScannerInfoCollector.java new file mode 100644 index 0000000000..fb21bff5cf --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/discovery/SGXSDKScannerInfoCollector.java @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.discovery; + +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; +import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3; +import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner; +import org.eclipse.cdt.make.core.scannerconfig.InfoContext; +import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; +import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +/* + * This code has been taken from the NDK plugin for Linux. If there is an update to this code there, then refactor this code. + */ +public class SGXSDKScannerInfoCollector implements IScannerInfoCollector3,IScannerInfoCollectorCleaner,IManagedScannerInfoCollector{ + + private SGXSDKDiscoveredPathInfo sgxPathInfo; + + @Override + public void setProject(IProject project) { + throw new Error("Not implemented"); + } + + @Override + public void updateScannerConfiguration(IProgressMonitor monitor) + throws CoreException { + sgxPathInfo.update(monitor); + } + + @Override + public IDiscoveredPathInfo createPathInfoObject() { + return sgxPathInfo; + } + + @Override + public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) { + throw new Error("Not implemented"); + } + + @SuppressWarnings("rawtypes") + @Override + public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { + throw new Error("Not implemented"); + } + + @Override + public Map getDefinedSymbols() { + throw new Error("Not implemented"); + } + + @Override + public List getIncludePaths() { + throw new Error("Not implemented"); + } + + @Override + public void deleteAllPaths(IResource resource) { + throw new Error("Not implemented"); + } + + @Override + public void deleteAllSymbols(IResource resource) { + throw new Error("Not implemented"); + } + + @Override + public void deletePath(IResource resource, String path) { + throw new Error("Not implemented"); + } + + @Override + public void deleteSymbol(IResource resource, String symbol) { + throw new Error("Not implemented"); + } + + @Override + public void deleteAll(IResource resource) { + sgxPathInfo.delete(); + } + + @Override + public void setInfoContext(InfoContext context) { + sgxPathInfo = new SGXSDKDiscoveredPathInfo(context.getProject()); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddEnclave.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddEnclave.java new file mode 100644 index 0000000000..e998de690b --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddEnclave.java @@ -0,0 +1,213 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Map; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +import com.intel.sgx.Activator; +import com.intel.sgx.dialogs.AddEnclaveFileDialog; +import com.intel.sgx.preferences.PreferenceConstants; + +public class AddEnclave extends ModuleCreationBaseHandler implements IHandler { + + public String edlFilename = ""; + public String linuxMakePath = ""; + @Override + public void addHandlerListener(IHandlerListener handlerListener) { + } + + @Override + public void dispose() { + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + String edlBasename,linuxPath,enclaveBasename; + IProject project = null; + + // Display display = Display.getCurrent(); + // Shell shell = new Shell(display); + Shell shell = null; + AddEnclaveFileDialog dialog = new AddEnclaveFileDialog(shell, this); + if (dialog.open() != InputDialog.OK) { + return null; + } + + if((edlFilename.isEmpty())){ + System.err.println("No Enclave selected to Import."); + return null; + } + + edlBasename = edlFilename; + ISelection selection = HandlerUtil.getCurrentSelection(event); + Object element = null; + if (selection instanceof IStructuredSelection) { + element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + project = ((IResource) element).getProject(); + } + } + if (!project.exists()) { + System.err.println("Error: Project not found"); + return null; + } + + for (IConfigurationElement i : Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.resources.projectNature")){ + } + + + + + IPath linuxMkRelPath = (Path.fromOSString(linuxMakePath)).makeRelativeTo(project.getLocation().append("sgx").append("enclave_"+edlBasename)); + + + if(linuxMkRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){ + linuxPath = linuxMkRelPath.removeLastSegments(3).toOSString(); + enclaveBasename = linuxMkRelPath.removeLastSegments(2).lastSegment().toString(); + } + + else{ + linuxPath = linuxMkRelPath.removeLastSegments(2).toOSString(); + enclaveBasename = linuxMkRelPath.removeLastSegments(1).lastSegment().toString(); + } + + IProgressMonitor monitor = new NullProgressMonitor(); + TemplateCore template = null; + if(isCPProject(project)) + if(dialog.generateApp()) + { + template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveC++WithSample"); + } + else + { + template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveC++Minimal"); + } + else + if(dialog.generateApp()) + { + template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveCWithSample"); + } + else + { + template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveCMinimal"); + } + + Map valueStore = template.getValueStore(); + valueStore.put("projectName", project.getName()); + valueStore.put("workspacePath", linuxPath); + valueStore.put("baseName", enclaveBasename); + valueStore.put("enclaveName",edlFilename); + valueStore.put("EnclaveName",capitalize(edlFilename)); + valueStore.put("ENCLAVENAME",edlFilename.toUpperCase()); + valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH)); + + IStatus[] statuses = template.executeTemplateProcesses(monitor, false); + for(IStatus e: statuses) + { + } + + ManagedBuildManager.saveBuildInfo(project, true); + try { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + Activator.log(e); + e.printStackTrace(); + } + + + return null; + } + + private String capitalize(final String line) { + return Character.toUpperCase(line.charAt(0)) + line.substring(1); + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isHandled() { + return true; + } + + @Override + public void removeHandlerListener(IHandlerListener handlerListener) { + } + + public void setFilename(String filename) { + edlFilename = filename; + } + + + + + public static void copyFile(File source, File dest) throws IOException { + byte[] bytes = new byte[4092]; + if (source != null && dest != null) { + if (source.isFile()) { + FileInputStream in = null; + FileOutputStream out = null; + try { + in = new FileInputStream(source); + out = new FileOutputStream(dest); + int len; + while ((len = in.read(bytes)) != -1) { + out.write(bytes, 0, len); + } + } catch (Exception e) { + Activator.log(e); + System.err.println("Error: " + e.toString()); + } finally { + try { + if (in != null) + in.close(); + } finally { + if (out != null) + out.close(); + } + } + } + } + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddSGXNature.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddSGXNature.java new file mode 100644 index 0000000000..569b608adb --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddSGXNature.java @@ -0,0 +1,163 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Map; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +//import org.eclipse.core.resources.IWorkspaceRunnable; +//import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +//import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.handlers.HandlerUtil; + +import com.intel.sgx.Activator; +import com.intel.sgx.natures.SGXNature; + +public class AddSGXNature implements IHandler { + + private IProject project; + + public AddSGXNature() { + project = null; + } + + @Override + public void addHandlerListener(IHandlerListener arg0) { + } + + @Override + public void dispose() { + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection selection = HandlerUtil.getCurrentSelection(event); + Object element = null; + if (selection instanceof IStructuredSelection) { + element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + project = ((IResource) element).getProject(); + } + } + if (!project.exists()) { + System.err.println("Error: Project not found"); + return null; + } else { + try { + TemplateCore template = TemplateEngine.getDefault().getTemplateById("AddSGXNature"); + + Map valueStore = template.getValueStore(); + valueStore.put("projectName",project.getName()); + valueStore.put("baseName",project.getName()); + + IProgressMonitor monitor = new NullProgressMonitor(); + template.executeTemplateProcesses(monitor, false); + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + try{ + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = SGXNature.NATURE_ID; + IStatus status = workspace.validateNatureSet(newNatures); + + if (status.getCode() == IStatus.OK) { + description.setNatureIds(newNatures); + project.setDescription(description, null); + } + + project.refreshLocal(IResource.DEPTH_ONE,null); + } catch(CoreException e){ + Activator.log(e); + throw new InvocationTargetException(e); + } + } catch(InvocationTargetException e){ + Activator.log(e); + e.printStackTrace(); + } + + try { + project.refreshLocal(IResource.DEPTH_INFINITE,null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + return null; + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isHandled() { + return true; + } + + @Override + public void removeHandlerListener(IHandlerListener arg0) { + } + + public static void copyFile(File source, File dest) throws IOException { + byte[] bytes = new byte[4092]; + if (source != null && dest != null) { + if (source.isFile()) { + FileInputStream in = null; + FileOutputStream out = null; + try { + in = new FileInputStream(source); + out = new FileOutputStream(dest); + int len; + while ((len = in.read(bytes)) != -1) { + out.write(bytes, 0, len); + } + } catch (Exception e) { + System.err.println("Error: " + e.toString()); + + } finally { + try { + if (in != null) + in.close(); + } finally { + if (out != null) + out.close(); + } + } + } + } + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddTrustedStaticLib.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddTrustedStaticLib.java new file mode 100644 index 0000000000..efeeeedd3a --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddTrustedStaticLib.java @@ -0,0 +1,193 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Map; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +import com.intel.sgx.Activator; +import com.intel.sgx.dialogs.AddTrustedStaticLibFileDialog; +import com.intel.sgx.preferences.PreferenceConstants; + +public class AddTrustedStaticLib extends ModuleCreationBaseHandler implements IHandler { + + public String edlFilename = ""; + public String linuxMakePath = ""; + + @Override + public void addHandlerListener(IHandlerListener handlerListener) { + } + + @Override + public void dispose() { + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + String edlBasename,linuxPath,enclaveBasename; + IProject project = null; + + // Display display = Display.getCurrent(); + // Shell shell = new Shell(display); + Shell shell = null; + AddTrustedStaticLibFileDialog dialog = new AddTrustedStaticLibFileDialog(shell, this); + if (dialog.open() != InputDialog.OK) { + return null; + } + + if((edlFilename.isEmpty() )){ + System.err.println("No Enclave selected to Import."); + return null; + } + + edlBasename = edlFilename; + ISelection selection = HandlerUtil.getCurrentSelection(event); + Object element = null; + if (selection instanceof IStructuredSelection) { + element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + project = ((IResource) element).getProject(); + } + } + if (!project.exists()) { + System.err.println("Error: Project not found"); + return null; + } + + for (IConfigurationElement i : Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.core.resources.projectNature")){ + } + + + + + IPath linuxMkRelPath = (Path.fromOSString(linuxMakePath)).makeRelativeTo(project.getLocation().append("sgx").append("enclave_"+edlBasename)); + + + if(linuxMkRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){ + linuxPath = linuxMkRelPath.removeLastSegments(3).toOSString(); + enclaveBasename = linuxMkRelPath.removeLastSegments(2).lastSegment().toString(); + } + + else{ + linuxPath = linuxMkRelPath.removeLastSegments(2).toOSString(); + enclaveBasename = linuxMkRelPath.removeLastSegments(1).lastSegment().toString(); + } + + IProgressMonitor monitor = new NullProgressMonitor(); + TemplateCore template = null; + if(isCPProject(project)) + template = TemplateEngine.getDefault().getTemplateById("SGXTrustedStaticLibraryC++Minimal"); + else + template = TemplateEngine.getDefault().getTemplateById("SGXTrustedStaticLibraryCMinimal"); + + Map valueStore = template.getValueStore(); + valueStore.put("projectName", project.getName()); + valueStore.put("workspacePath", linuxPath); + valueStore.put("baseName", enclaveBasename); + valueStore.put("enclaveName",edlFilename); + valueStore.put("EnclaveName",capitalize(edlFilename)); + valueStore.put("ENCLAVENAME",edlFilename.toUpperCase()); + valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH)); + + IStatus[] statuses = template.executeTemplateProcesses(monitor, false); + + + ManagedBuildManager.saveBuildInfo(project, true); + try { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + Activator.log(e); + e.printStackTrace(); + } + return null; + } + + private String capitalize(final String line) { + return Character.toUpperCase(line.charAt(0)) + line.substring(1); + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isHandled() { + return true; + } + + @Override + public void removeHandlerListener(IHandlerListener handlerListener) { + } + + public void setFilename(String filename) { + edlFilename = filename; + } + + public static void copyFile(File source, File dest) throws IOException { + byte[] bytes = new byte[4092]; + if (source != null && dest != null) { + if (source.isFile()) { + FileInputStream in = null; + FileOutputStream out = null; + try { + in = new FileInputStream(source); + out = new FileOutputStream(dest); + int len; + while ((len = in.read(bytes)) != -1) { + out.write(bytes, 0, len); + } + } catch (Exception e) { + Activator.log(e); + System.err.println("Error: " + e.toString()); + } finally { + try { + if (in != null) + in.close(); + } finally { + if (out != null) + out.close(); + } + } + } + } + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddUntrustedModule.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddUntrustedModule.java new file mode 100644 index 0000000000..4ebf8da34c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/AddUntrustedModule.java @@ -0,0 +1,231 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Map; + + + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; + +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +import com.intel.sgx.Activator; +import com.intel.sgx.dialogs.AddUntrustedModuleDialog; +import com.intel.sgx.preferences.PreferenceConstants; + +public class AddUntrustedModule extends ModuleCreationBaseHandler implements IHandler { + + public String edlFilename = ""; + public String libPath = ""; + private IPath edlCanonicalFilename; + private IPath libCanonicalPathname; + + @Override + public void addHandlerListener(IHandlerListener handlerListener) { + } + + @Override + public void dispose() { + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + String edlBasename,edlPath,linuxLibPath,modulePath,enclaveBasename; + IProject project = null; + + //Display display = Display.getCurrent(); + Shell shell = null; + + AddUntrustedModuleDialog dialog = new AddUntrustedModuleDialog(shell, this); + if (dialog.open() != InputDialog.OK) { + return null; + } + + if((edlFilename.isEmpty() && libPath.isEmpty())){ + System.err.println("No Enclave selected to Import."); + return null; + } + if( edlFilename.isEmpty() ){ + System.err.println("Edl File not selected."); + return null; + } + edlCanonicalFilename = Path.fromOSString(edlFilename); + if (!edlCanonicalFilename.getFileExtension().toLowerCase().equals("edl")) { + System.err.println("Error: EDL file extension = "+ edlCanonicalFilename.getFileExtension()); + return null; + } + edlBasename = edlCanonicalFilename.removeFileExtension().lastSegment(); + + + ISelection selection = HandlerUtil.getCurrentSelection(event); + Object element = null; + if (selection instanceof IStructuredSelection) { + element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + project = ((IResource) element).getProject(); + } + } + if (!project.exists()) { + System.err.println("Error: Project not found"); + return null; + } + + IPath targetRelPath = project.getProjectRelativePath().append("sgx").append("untrusted_" + edlBasename); + + try { + for (int i = 1; i <= targetRelPath.segmentCount(); i++) { + IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i)); + + if (!subfolder.exists()) { + subfolder.create(true, true, null); + } + } + } catch (CoreException e) { + System.err.println("Error: Error creating enclave directory."); + Activator.log(e); + e.printStackTrace(); + } + + IPath edlRelPath = (Path.fromOSString(edlFilename)).makeRelativeTo(project.getLocation().append("sgx")); + edlPath = edlRelPath.toOSString(); + IPath linuxLibRelPath = (Path.fromOSString(libPath)).makeRelativeTo(project.getLocation().append("sgx")); + + if(linuxLibRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("sgx")){ + linuxLibPath = linuxLibRelPath.removeLastSegments(3).toOSString(); + modulePath = linuxLibRelPath.removeFirstSegments(linuxLibRelPath.segmentCount()-3).removeLastSegments(1).toOSString(); + } + else if(linuxLibRelPath.removeLastSegments(1).lastSegment().toString().equalsIgnoreCase("src")){ + linuxLibPath = linuxLibRelPath.removeLastSegments(3).toOSString(); + modulePath = linuxLibRelPath.removeFirstSegments(linuxLibRelPath.segmentCount()-3).removeLastSegments(1).toOSString(); + } + else{ + linuxLibPath = linuxLibRelPath.removeLastSegments(2).toOSString(); + modulePath = linuxLibRelPath.removeFirstSegments(linuxLibRelPath.segmentCount()-2).removeLastSegments(1).toOSString(); + } + + IProgressMonitor monitor = new NullProgressMonitor(); + TemplateCore template = null; + if(isCPProject(project)) + template = TemplateEngine.getDefault().getTemplateById("SGXUntrustedModuleC++Minimal"); + else + template = TemplateEngine.getDefault().getTemplateById("SGXUntrustedModuleCMinimal"); + + + + Map valueStore = template.getValueStore(); + + + valueStore.put("projectName", project.getName()); + valueStore.put("sourcepath",linuxLibPath); + valueStore.put("edlPath", edlPath); + valueStore.put("baseName", edlBasename); + valueStore.put("workspacePath", linuxLibPath);//deprecate + valueStore.put("modPath", modulePath); + valueStore.put("ENCLAVENAME",edlBasename.toUpperCase()); + valueStore.put("libPath",libPath); + valueStore.put("SdkPathFromPlugin", Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH)); + + IStatus[] statuses = template.executeTemplateProcesses(monitor, false); + + try { + copyFile(new File(edlFilename), project.getLocation().append("sgx").append("untrusted_"+edlBasename).append(edlBasename+".edl").toFile()); + } catch (IOException e1) { + e1.printStackTrace(); + } + + + ManagedBuildManager.saveBuildInfo(project, true); + try { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + Activator.log(e); + e.printStackTrace(); + } + return null; + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isHandled() { + return true; + } + + @Override + public void removeHandlerListener(IHandlerListener handlerListener) { + } + + public void setFilename(String filename) { + edlFilename = filename; + } + + public static void copyFile(File source, File dest) throws IOException { + byte[] bytes = new byte[4092]; + if (source != null && dest != null) { + if (source.isFile()) { + FileInputStream in = null; + FileOutputStream out = null; + try { + in = new FileInputStream(source); + out = new FileOutputStream(dest); + int len; + while ((len = in.read(bytes)) != -1) { + out.write(bytes, 0, len); + } + } catch (Exception e) { + Activator.log(e); + System.err.println("Error: " + e.toString()); + } finally { + try { + if (in != null) + in.close(); + } finally { + if (out != null) + out.close(); + } + } + } + } + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/EnclaveConfigHandler.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/EnclaveConfigHandler.java new file mode 100644 index 0000000000..fffa912c4f --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/EnclaveConfigHandler.java @@ -0,0 +1,156 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.File; +import java.io.IOException; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import com.intel.sgx.Activator; +import com.intel.sgx.dialogs.EnclaveConfigDialog; +import com.intel.sgx.dialogs.SGXDialogBase; + +public class EnclaveConfigHandler extends SGXHandler { + + public String prodId; + public String isvSvn; + public String threadStackSize; + public String globalHeapSize; + public String tcsNum; + public String tcsPolicy; + public String disableDebug; + private IFile configPath; + + @Override + public void addHandlerListener(IHandlerListener arg0) { + } + + @Override + public void dispose() { + } + + @Override + public Object executeSGXStuff() throws CancelException, ErrorException { + + FilteredResourcesSelectionDialog d = SGXDialogBase + .dialogForConfig(shell); + d.setTitle("Select Config File"); + if (d.open() != Dialog.OK) { + cancel(); + } + + configPath = ((IFile) d.getResult()[0]); + + readConfig(configPath.getLocation()); + EnclaveConfigDialog dialog = new EnclaveConfigDialog(shell, this); + if (dialog.open() != InputDialog.OK) { + return null; + } + writeConfig(); + refreshProject(); + + return null; + } + + protected void writeConfig() { + IProgressMonitor monitor = new NullProgressMonitor(); + TemplateCore template = TemplateEngine.getDefault().getTemplateById("SGXEnclaveConfig"); + + Map valueStore = template.getValueStore(); + valueStore.put("projectName", project.getName()); + valueStore.put("configFile", configPath.getProjectRelativePath().toOSString()); + valueStore.put("ProdID", this.prodId); + valueStore.put("IsvSvn", this.isvSvn); + valueStore.put("ThreadStackSize", this.threadStackSize); + valueStore.put("GlobalHeapSize", this.globalHeapSize); + valueStore.put("TcsNumber", this.tcsNum); + valueStore.put("TcsPolicy", this.tcsPolicy); + valueStore.put("DisableDebug", this.disableDebug); + IStatus[] result = template.executeTemplateProcesses(monitor, true); + + for (IStatus status: result) { + } + } + + + + protected void readConfig(IPath configPath) throws ErrorException { + + try { + String xmlFile = configPath.toString(); + File configFile = new File(xmlFile); + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder; + dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(configFile); + doc.getDocumentElement().normalize(); + + NodeList nList = doc.getElementsByTagName("EnclaveConfiguration"); + Node nNode = nList.item(0); + + if (nNode.getNodeType() == Node.ELEMENT_NODE) { + Element e = (Element) nNode; + this.prodId = e.getElementsByTagName("ProdID").item(0) + .getTextContent(); + this.isvSvn = e.getElementsByTagName("ISVSVN").item(0) + .getTextContent(); + this.threadStackSize = e.getElementsByTagName("StackMaxSize") + .item(0).getTextContent(); + this.globalHeapSize = e.getElementsByTagName("HeapMaxSize") + .item(0).getTextContent(); + this.tcsNum = e.getElementsByTagName("TCSNum").item(0) + .getTextContent(); + this.tcsPolicy = e.getElementsByTagName("TCSPolicy").item(0) + .getTextContent(); + this.disableDebug = e.getElementsByTagName("DisableDebug") + .item(0).getTextContent(); + } + + } catch (ParserConfigurationException e) { + Activator.log(e); + e.printStackTrace(); + quitWithError("Could not parse '"+configPath.toOSString()+"'"); + } catch (SAXException e) { + Activator.log(e); + e.printStackTrace(); + quitWithError("Could not parse '"+configPath.toOSString()+"'"); + } catch (IOException e) { + Activator.log(e); + e.printStackTrace(); + quitWithError("Could not read'"+configPath.toOSString()+"'"); + } + + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/ModuleCreationBaseHandler.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/ModuleCreationBaseHandler.java new file mode 100644 index 0000000000..708208c6cb --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/ModuleCreationBaseHandler.java @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.runtime.CoreException; + +public class ModuleCreationBaseHandler { + public boolean isCPProject(IProject project) + { + boolean isCPProject = false; + IProjectDescription description; + try { + description = project.getDescription(); + String[] natures = description.getNatureIds(); + for(String nature: natures){ + if(nature.equals("org.eclipse.cdt.core.ccnature")) + isCPProject = true; + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return isCPProject; + + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/RemoveEnclave.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/RemoveEnclave.java new file mode 100644 index 0000000000..058e622996 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/RemoveEnclave.java @@ -0,0 +1,169 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +import com.intel.sgx.Activator; +import com.intel.sgx.dialogs.RemoveEnclaveFileDialog; + +public class RemoveEnclave implements IHandler { + + public String edlFilename = ""; + private IPath edlCanonicalFilename; + + @Override + public void addHandlerListener(IHandlerListener handlerListener) { + } + + @Override + public void dispose() { + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + String edlBasename; + IProject project = null; + + // Display display = Display.getCurrent(); + // Shell shell = new Shell(display); + + RemoveEnclaveFileDialog dialog = new RemoveEnclaveFileDialog(null, this); + + if (dialog.open() != InputDialog.OK) { + return null; + } + + edlCanonicalFilename = Path.fromOSString(edlFilename); + edlBasename = edlCanonicalFilename.lastSegment(); + + if(edlBasename.isEmpty()){ + return null; + } + + ISelection selection = HandlerUtil.getCurrentSelection(event); + Object element = null; + if(selection instanceof IStructuredSelection) { + element = ((IStructuredSelection)selection).getFirstElement(); + if (element instanceof IResource) { + project= ((IResource)element).getProject(); + } + } + if (!project.exists()) { + System.err.println("Error: Project not found"); + return null; + } + + IPath targetRelPath = project.getProjectRelativePath().append("sgx").append("enclave_" + edlBasename); + + try { + for (int i=1;i<=targetRelPath.segmentCount();i++) { + IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i)); + + if (subfolder.exists()){ + if(subfolder.getProjectRelativePath().toOSString().contains("enclave_"+edlBasename)){ + subfolder.delete(true, true, null); + break; + } + } + } + targetRelPath = project.getProjectRelativePath().append("sgx").append(edlBasename); + for (int i=1;i<=targetRelPath.segmentCount();i++) { + IFolder subfolder = project.getFolder(targetRelPath.uptoSegment(i)); + + if (subfolder.exists()){ + if(subfolder.getProjectRelativePath().toOSString().contains(edlBasename)){ + subfolder.delete(true, true, null); + break; + } + } + } + } catch (Exception e) { + Activator.log(e); + } + + try { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + Activator.log(e); + } catch (IllegalArgumentException e){ + Activator.log(e); + } + + return null; + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isHandled() { + return true; + } + + @Override + public void removeHandlerListener(IHandlerListener handlerListener) { + } + + public static void copyFile(File source, File dest) throws IOException { + byte[] bytes = new byte[4092]; + if (source != null && dest != null) { + if (source.isFile()) { + FileInputStream in = null; + FileOutputStream out = null; + try { + in = new FileInputStream(source); + out = new FileOutputStream(dest); + int len; + while ((len = in.read(bytes)) != -1) { + out.write(bytes, 0, len); + } + } catch (Exception e) { + System.err.println("Error: " + e.toString()); + Activator.log(e); + } finally { + try { + if (in != null) + in.close(); + } finally { + if (out != null) + out.close(); + } + } + } + } + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXHandler.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXHandler.java new file mode 100644 index 0000000000..bfd5bcb551 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXHandler.java @@ -0,0 +1,206 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +import javax.swing.JOptionPane; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Utility base class for all Handlers The derived classes must implement + * executeSgxStuff() instead of execute(). The user may call methods cancel(), + * quitWithError() & info() + * + * @author mlutescu + * + */ +public abstract class SGXHandler implements IHandler { + + public String projectPath = null; + protected IProject project; + protected Shell shell; + + /** + * Throwing this IS an error. Means that the process can't continue + * + * @author mlutescu + * + */ + static protected class ErrorException extends Exception { + + public ErrorException(String message) { + super(message); + } + + } + + /** + * Throwing this is not an error; just signals stop of execution because the + * user cancels + * + * @author mlutescu + * + */ + static protected class CancelException extends Exception { + + public CancelException() { + super(); + } + + } + + @Override + public final Object execute(ExecutionEvent event) throws ExecutionException { + try { + initializeShell(); + initializeProject(event); + return executeSGXStuff(); + } catch (ErrorException e) { + e.printStackTrace(); + } catch (CancelException e) { + // do nothing by design ; it's Ok to not handle this exception. + } + return null; + } + + protected abstract Object executeSGXStuff() throws ErrorException, + CancelException; + + public SGXHandler() { + super(); + } + + public static void copyFile(File source, File dest) throws ErrorException { + byte[] bytes = new byte[4092]; + if (source != null && dest != null) { + if (source.isFile()) { + FileInputStream in = null; + FileOutputStream out = null; + try { + in = new FileInputStream(source); + out = new FileOutputStream(dest); + int len; + while ((len = in.read(bytes)) != -1) { + out.write(bytes, 0, len); + } + } catch (IOException e) { + System.err.println("Error: " + e.toString()); + quitWithError("Could not copy from\n" + "'" + + source.getAbsolutePath() + "'\n" + "to\n" + "'" + + dest.getAbsolutePath()); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + } + } + } + + protected static void quitWithError(String message) throws ErrorException { + JOptionPane.showMessageDialog(null, message, "Two Step Enclave Sign", + JOptionPane.ERROR_MESSAGE); + throw new ErrorException(message); + } + + static protected void cancel() throws CancelException { + throw new CancelException(); + } + + protected void initializeProject(ExecutionEvent event) + throws ErrorException { + project = null; + ISelection selection = HandlerUtil.getCurrentSelection(event); + Object element = null; + if (selection instanceof IStructuredSelection) { + element = ((IStructuredSelection) selection).getFirstElement(); + if (element instanceof IResource) { + project = ((IResource) element).getProject(); + } + } + + if (!project.exists()) { + quitWithError("Project not found"); + } + + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isHandled() { + return true; + } + + @Override + public void removeHandlerListener(IHandlerListener arg0) { + } + + @Override + public void addHandlerListener(IHandlerListener arg0) { + } + + @Override + public void dispose() { + } + + protected void initializeShell() { + shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + } + + protected void refreshProject() throws ErrorException { + try { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e1) { + quitWithError(e1.getLocalizedMessage()); + } + } + + protected void info(String windowName, String message) { + JOptionPane.showMessageDialog(null, message,windowName, + JOptionPane.INFORMATION_MESSAGE); + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXSDKWizardHandler.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXSDKWizardHandler.java new file mode 100644 index 0000000000..b445c5ea8a --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/SGXSDKWizardHandler.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import org.eclipse.cdt.managedbuilder.core.IToolChain; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.ui.wizards.STDWizardHandler; + +public class SGXSDKWizardHandler extends STDWizardHandler { + + public SGXSDKWizardHandler() { + super(null, null); + } + + + @Override + public IToolChain[] getSelectedToolChains() { + IToolChain[] tcs = ManagedBuildManager.getRealToolChains(); + for (IToolChain tc : tcs) { + if (tc.getId().equals("com.intel.sgx.SGXtoolChain")) + return new IToolChain[] { + tc + }; + } + return super.getSelectedToolChains(); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignHandlerBase.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignHandlerBase.java new file mode 100644 index 0000000000..59ae2eb7a4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignHandlerBase.java @@ -0,0 +1,196 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; + +import com.intel.sgx.preferences.PreferenceConstants; + +public abstract class TwoStepSignHandlerBase extends SGXHandler { + + public String hashFile = null; + public String configFile = null; + public String enclaveFile = null; + public String externalSignPublicKeyFile = null; + public String externallySignedHashFile = null; + public String outputSignedEnclaveFile = null; + + protected File signtool; + + public TwoStepSignHandlerBase() { + super(); + } + + protected void executeGenData() throws ErrorException { + validateConfigFile(); + validateEnclaveFile(); + + refreshProject(); + executeSignTool(new String[] { "gendata", + "-enclave", enclaveFile, + "-config", configFile, + "-out", hashFile }); + refreshProject(); + + validateHashFile(); + + } + + protected void executeCatSig() throws ErrorException { + validateEnclaveFile(); + validateConfigFile(); + validateHashFile(); + + validateExternalSignPublicKeyFile(); + validateExternallySignedHashFile(); + + executeSignTool("catsig", + // enclave data: + "-enclave", enclaveFile, + "-config", configFile, + // previously generated: + "-unsigned", hashFile, + // externally generated + "-key", externalSignPublicKeyFile, + "-sig", externallySignedHashFile, + // output + "-out", outputSignedEnclaveFile + + ); + + refreshProject(); + + validateOutputSignedEnclaveFile(); + + info("Two Step Enclave Sign","Enclave signed successfully !"); + } + + void initializeSigntool() throws ErrorException { + signtool = PreferenceConstants.getSDKDescriptor().getSignerPath(); + if (!signtool.exists() || signtool.isDirectory()) { + quitWithError("Error generating hash! Sign Tool Not Found !\n Please make sure to have written in the box the value for SGX SDK Directory in Window->Preferences->SGX Preferences. \n Usually the path is in /opt/intel/sgxsdk/" ); + } + + } + + protected void validateEnclaveFile() throws ErrorException { + File enclave = new File(enclaveFile); + if (!enclave.exists() || enclave.isDirectory()) { + quitWithError("Error generating hash! Unsigned Enclave File Not Found! Try building the enclave first"); + } + } + + protected void validateConfigFile() throws ErrorException { + if (configFile == null || configFile.isEmpty()) { + quitWithError("Error Enclave Configuration File Not Found !"); + } + File config = new File(configFile); + if (!config.exists() || config.isDirectory()) { + quitWithError("Enclave Config File Not Found !"); + } + } + + protected void validateExternallySignedHashFile() throws ErrorException { + if (externallySignedHashFile == null || externallySignedHashFile.isEmpty()) { + quitWithError("Error signing enclave! Signature File Not Found !"); + } + + File signature = new File(externallySignedHashFile); + if (!signature.exists() || signature.isDirectory()) { + quitWithError("Error signing enclave! Signature File Not Found !"); + } + } + + protected void validateExternalSignPublicKeyFile() throws ErrorException { + if (externalSignPublicKeyFile == null || externalSignPublicKeyFile.isEmpty()) { + quitWithError("Public Key File Not Found !"); + } + + File publickkey = new File(externalSignPublicKeyFile); + if (!publickkey.exists() || publickkey.isDirectory()) { + quitWithError("Error signing enclave! Public Key File Not Found !"); + } + } + + private void validateOutputSignedEnclaveFile() throws ErrorException { + if(outputSignedEnclaveFile == null || outputSignedEnclaveFile.isEmpty()) + { + quitWithError("Output Signed File Not Found !"); + } + File outputSignedEnclave = new File(outputSignedEnclaveFile); + if(!outputSignedEnclave.exists() || outputSignedEnclave.isDirectory()) + { + quitWithError("Output Signed File Not Found !"); + } + + // TODO Auto-generated method stub + + } + + protected void validateHashFile() throws ErrorException { + if(hashFile == null || hashFile.isEmpty()) + { + quitWithError("Hash File Not Found !"); + } + File hash = new File(hashFile); + if(!hash.exists() || hash.isDirectory()) + { + quitWithError("Hash File Not Found !"); + } + } + + + protected void executeSignTool(String... args) throws ErrorException { + + Process q; + try { + + String[] allArgs = new String[args.length+1]; + allArgs[0] = signtool.getAbsolutePath(); + System.arraycopy(args, 0, allArgs, 1, args.length); + + for (String arg : args){ + } + String fullOutput = ""; + q = Runtime.getRuntime().exec(allArgs); + + BufferedReader stdInput = new BufferedReader(new InputStreamReader( + q.getInputStream())); + BufferedReader stdErr = new BufferedReader(new InputStreamReader( + q.getErrorStream())); + String s = null; + while ((s = stdInput.readLine()) != null) { + } + String[] out = new String[20]; + int i = 0; + while ((out[i] = stdErr.readLine()) != null) { + fullOutput += out[i]+"\n"; + i++; + } + String result = out[i - 1]; + + if (!result.equals("Succeed.")) { + // quitWithError("Error generating hash! " + out[i - 2]); + quitWithError("Error generating hash! " + fullOutput); + } + } catch (IOException e) { + quitWithError(e.getLocalizedMessage()); + } + + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep1.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep1.java new file mode 100644 index 0000000000..cb2f3649bd --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep1.java @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import org.eclipse.jface.dialogs.InputDialog; + +import com.intel.sgx.dialogs.SGXDialogBase; +import com.intel.sgx.dialogs.TwoStepSignStep1Dialog1; +import com.intel.sgx.dialogs.TwoStepSignStep1Dialog2; +import com.intel.sgx.dialogs.TwoStepSignStep1Dialog3; + +// Generate Hash +public class TwoStepSignStep1 extends TwoStepSignHandlerBase { + + public TwoStepSignStep1() { + } + + @Override + protected Object executeSGXStuff() throws ErrorException, CancelException { + + initializeSigntool(); + + showDialog1(); + showDialog2(); + showDialog3(); + return null; + } + + private void showDialog1() throws CancelException, ErrorException { + + TwoStepSignStep1Dialog1 dialog1 = new TwoStepSignStep1Dialog1(shell, this); + if (dialog1.open() != InputDialog.OK) { + cancel(); + } + + executeGenData(); + + } + + private void showDialog2() throws CancelException { + TwoStepSignStep1Dialog2 dialog2 = new TwoStepSignStep1Dialog2(shell, + hashFile); + + if (dialog2.open() != InputDialog.OK) { + cancel(); + } + } + + protected void showDialog3() throws CancelException, ErrorException { + SGXDialogBase dialog3 = new TwoStepSignStep1Dialog3(shell, this); + if (dialog3.open() != InputDialog.OK) { + cancel(); + } + + validateExternalSignPublicKeyFile(); + + validateExternallySignedHashFile(); + + executeCatSig(); + + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep2.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep2.java new file mode 100644 index 0000000000..f19738036c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/TwoStepSignStep2.java @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import org.eclipse.jface.dialogs.InputDialog; + +import com.intel.sgx.dialogs.TwoStepSignStep2Dialog; + +// Sign +public class TwoStepSignStep2 extends TwoStepSignHandlerBase { + + public TwoStepSignStep2() { + } + + @Override + protected Object executeSGXStuff() throws ErrorException, CancelException { + initializeSigntool(); + + TwoStepSignStep2Dialog dialog = new TwoStepSignStep2Dialog(shell, this); + if(dialog.open() != InputDialog.OK) { + cancel(); + } + + executeCatSig(); + return null; + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/UpdateSigningKey.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/UpdateSigningKey.java new file mode 100644 index 0000000000..68870ea3cf --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/UpdateSigningKey.java @@ -0,0 +1,101 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.handlers; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +//import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +//import java.security.KeyPair; +//import java.security.KeyPairGenerator; +//import java.security.NoSuchAlgorithmException; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +//import org.bouncycastle.openssl.PEMWriter; +import com.intel.sgx.Activator; +import com.intel.sgx.dialogs.UpdateSignKeyDialog; + +public class UpdateSigningKey extends SGXHandler { + + public String sourceKeyFile = null; + public String destinationKeyFile = null; + public String projectPath = null; + + @Override + protected Object executeSGXStuff() throws ErrorException, CancelException { + + UpdateSignKeyDialog dialog = new UpdateSignKeyDialog(shell, this); + int result = dialog.open(); + if (result != InputDialog.OK) { + cancel(); + } + + if(UpdateSignKeyDialog.regenerate == false) + { + IPath sourceFile = Path.fromOSString(sourceKeyFile); + IPath destFile = Path.fromOSString(destinationKeyFile); + copyFile(sourceFile.toFile(), destFile.toFile()); + refreshProject(); + info("Update SGX Enclave Signing Key","copied \n'" + sourceKeyFile + "' into \n'" + destFile + "'"); + } else { + UpdateSignKeyDialog.regenerate = false; + try { + Process q; + String opensslCmd = "openssl genrsa -out " + destinationKeyFile + + " -3 3072"; + q = Runtime.getRuntime().exec(opensslCmd); + BufferedReader stdInput = new BufferedReader( + new InputStreamReader(q.getInputStream())); + BufferedReader stdErr = new BufferedReader( + new InputStreamReader(q.getErrorStream())); + String s = null; + while ((s = stdInput.readLine()) != null) { + } + while ((s = stdErr.readLine()) != null) { + } + project.refreshLocal(IResource.DEPTH_INFINITE, null); + if (q.exitValue() == 0){ + info("Update SGX Enclave Signing Key","'"+destinationKeyFile+"'"+" was generated!"); + } else { + quitWithError("Could not generate '"+destinationKeyFile+"'!!!"); + } + } catch (IOException e) { + Activator.log(e); + e.printStackTrace(); + } catch (CoreException e) { + Activator.log(e); + e.printStackTrace(); + } + } + return null; + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/about.html b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/about.html new file mode 100644 index 0000000000..a3b9ace448 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/handlers/about.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + +About + + +

About This Content

+ +

June 22, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/messages.properties b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/messages.properties new file mode 100644 index 0000000000..c0011fadda --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/messages.properties @@ -0,0 +1,16 @@ +######################################################################### +# Copyright (c) 2016 Intel Corporation. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Eclipse Public License v1.0 # +# which accompanies this distribution, and is available at # +# http://www.eclipse.org/legal/epl-v10.html # +# # +# Contributors: # +# Intel Corporation - initial implementation and documentation # +######################################################################### + + +CreateNativeFolders_No_folders=No folders. +CreateNativeFolders_Missing_project_name=Missing project Name. +CreateNativeFolders_Project_does_not_exist=Project does not exist. diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXCCNature.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXCCNature.java new file mode 100644 index 0000000000..fde7f7d29c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXCCNature.java @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; + +public class SGXCCNature implements IProjectNature { + + private IProject project; + public static final String NATURE_ID = "com.intel.sgx.sgxccnature"; + + public SGXCCNature() { + } + + @Override + public void configure() throws CoreException { + } + + @Override + public void deconfigure() throws CoreException { + } + + @Override + public IProject getProject() { + return project; + } + + @Override + public void setProject(IProject project) { + this.project = project; + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXNature.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXNature.java new file mode 100644 index 0000000000..8db687e029 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXNature.java @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; + +public class SGXNature implements IProjectNature { + + private IProject project; + public static final String NATURE_ID = "com.intel.sgx.sgxnature"; + + public SGXNature() { + } + + @Override + public void configure() throws CoreException { + } + + @Override + public void deconfigure() throws CoreException { + } + + @Override + public IProject getProject() { + return project; + } + + @Override + public void setProject(IProject project) { + this.project = project; + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXStaticCCNature.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXStaticCCNature.java new file mode 100644 index 0000000000..0d642ee5c8 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/natures/SGXStaticCCNature.java @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.natures; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectNature; +import org.eclipse.core.runtime.CoreException; + +public class SGXStaticCCNature implements IProjectNature { + + private IProject project; + public static final String NATURE_ID = "com.intel.sgx.sgxstaticccnature"; + + public SGXStaticCCNature() { + } + + @Override + public void configure() throws CoreException { + } + + @Override + public void deconfigure() throws CoreException { + } + + @Override + public IProject getProject() { + return project; + } + + @Override + public void setProject(IProject project) { + this.project = project; + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/ISDKDescriptor.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/ISDKDescriptor.java new file mode 100644 index 0000000000..ec8b274912 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/ISDKDescriptor.java @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.preferences; + +import java.io.File; + + +public interface ISDKDescriptor { + + public abstract File getSdkDir(); + + public abstract File getToolsDir(); + + public abstract File getSignerPath(); + + public abstract File getEdger8rPath(); + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceConstants.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceConstants.java new file mode 100644 index 0000000000..5ce1abc9cc --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceConstants.java @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.preferences; + +import java.io.File; + +import org.eclipse.jface.preference.IPreferenceStore; + +import com.intel.sgx.Activator; + +/** + * Constant definitions for plug-in preferences + */ +public class PreferenceConstants { + + public static final String SDK_PATH = "SDKPathPreference"; + + public static ISDKDescriptor getSDKDescriptor() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + File sdkDir = new File(store.getString(PreferenceConstants.SDK_PATH)); + + if (System.getProperty("os.arch").contains("64")) { + return new SGXSDK64Descriptor(sdkDir); + } else { + return new SGXSDK32Descriptor(sdkDir); + } + } + + + static public class SGXSDK32Descriptor implements ISDKDescriptor { + private final File sdkDir; + private final File toolDir; + private final File signerPath; + private final File edger8rPath; + + public SGXSDK32Descriptor(File location){ + this.sdkDir = location; + this.toolDir = new File(location, "bin/x86"); + this.signerPath = new File(toolDir, "sgx_sign"); + this.edger8rPath = new File(toolDir, "sgx_edger8r"); + } + + @Override + public File getSdkDir() { + return sdkDir; + } + + @Override + public File getToolsDir() { + return toolDir; + } + + @Override + public File getSignerPath() { + return signerPath; + } + + @Override + public File getEdger8rPath() { + return edger8rPath; + } + + } + + + static public class SGXSDK64Descriptor implements ISDKDescriptor { + private final File sdkDir; + private final File toolDir; + private final File signerPath; + private final File edger8rPath; + + public SGXSDK64Descriptor(File sdkDir){ + this.sdkDir = sdkDir; + this.toolDir = new File(sdkDir, "bin/x64"); + this.signerPath = new File(toolDir, "sgx_sign"); + this.edger8rPath = new File(toolDir, "sgx_edger8r"); + } + + @Override + public File getSdkDir() { + return sdkDir; + } + + @Override + public File getToolsDir() { + return toolDir; + } + + @Override + public File getSignerPath() { + return signerPath; + } + + @Override + public File getEdger8rPath() { + return edger8rPath; + } + + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceInitializer.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceInitializer.java new file mode 100644 index 0000000000..b85d5e5299 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/PreferenceInitializer.java @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.preferences; + +import com.intel.sgx.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * Class used to initialize default preference values. + */ +public class PreferenceInitializer extends AbstractPreferenceInitializer { + + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(PreferenceConstants.SDK_PATH, ""); + Activator.getDefault().getPreferenceStore().setValue(PreferenceConstants.SDK_PATH, "/opt/intel/sgxsdk"); + Activator.getDefault().getPreferenceStore().setDefault(PreferenceConstants.SDK_PATH, "/opt/intel/sgxsdk"); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/SGXPreferencePage.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/SGXPreferencePage.java new file mode 100644 index 0000000000..bbf6608a71 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/preferences/SGXPreferencePage.java @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.preferences; + +import org.eclipse.jface.preference.DirectoryFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +import com.intel.sgx.Activator; +import com.intel.sgx.SdkPathVariableProvider; + +/** + * This class represents a preference page that + * is contributed to the Preferences dialog. By + * subclassing FieldEditorPreferencePage, we + * can use the field support built into JFace that allows + * us to create a page that is small and knows how to + * save, restore and apply itself. + *

+ * This page is used to modify preferences only. They + * are stored in the preference store that belongs to + * the main plug-in class. That way, preferences can + * be accessed directly via the preference store. + */ + +public class SGXPreferencePage + extends FieldEditorPreferencePage + implements IWorkbenchPreferencePage { + + private SGXSdkDirectoryFieldEditor sgxSdkDirectoryEditor; + + public SGXPreferencePage() { + super(GRID); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + setDescription("SGX Preferences"); + } + + /** + * Creates the field editors. Field editors are abstractions of + * the common GUI blocks needed to manipulate various types + * of preferences. Each field editor knows how to save and + * restore itself. + */ + + @Override + protected void createFieldEditors() { + sgxSdkDirectoryEditor = new SGXSdkDirectoryFieldEditor(PreferenceConstants.SDK_PATH, + "&SGX SDK Directory:", getFieldEditorParent()); + addField(sgxSdkDirectoryEditor); + } + + /* + * Validates whether the path entered in the SGX SDK Preferences points to the SGX SDK or not. + */ + private static class SGXSdkDirectoryFieldEditor extends DirectoryFieldEditor { + public SGXSdkDirectoryFieldEditor(String name, String labelText, Composite parent) { + super(name, labelText, parent); + setEmptyStringAllowed(true); + } + + @Override + protected boolean doCheckState() { + if (!super.doCheckState()) { + setErrorMessage("SGX Preferences: Not a Valid directory"); + return false; + } + + String dirname = getTextControl().getText().trim(); + if (!dirname.isEmpty() && !SdkPathVariableProvider.isValidSGXSdkLocation(dirname)) { + setErrorMessage("SGX SDK: Not a Valid SGX SDK directory"); + return false; + } + return true; + } + + @Override + public Text getTextControl(Composite parent) { + setValidateStrategy(VALIDATE_ON_KEY_STROKE); + return super.getTextControl(parent); + } + } + + @Override + public void init(IWorkbench workbench) { + } + + @Override + public void dispose() { + super.dispose(); + + if (sgxSdkDirectoryEditor != null) { + sgxSdkDirectoryEditor.dispose(); + sgxSdkDirectoryEditor = null; + } + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/CreateNativeFolders.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/CreateNativeFolders.java new file mode 100644 index 0000000000..d493e146fe --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/CreateNativeFolders.java @@ -0,0 +1,230 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.templates; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IPathEntry; +import org.eclipse.cdt.core.settings.model.CIncludePathEntry; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICFolderDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSetting; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.process.ProcessArgument; +import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; +import org.eclipse.cdt.core.templateengine.process.ProcessRunner; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.internal.core.Configuration; +import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; + +import com.intel.sgx.Activator; +import com.intel.sgx.Messages; +import com.intel.sgx.preferences.PreferenceConstants; + +@SuppressWarnings("restriction") +public class CreateNativeFolders extends ProcessRunner { + + @Override + public void process(TemplateCore template, ProcessArgument[] args, + String processId, IProgressMonitor monitor) + throws ProcessFailureException { + String projectName = null; + String[] sourceFolders = null; + String[] outputFolders = null; + + for (ProcessArgument arg : args) { + String argName = arg.getName(); + if (argName.equals("projectName")) { + projectName = arg.getSimpleValue(); + } else if (argName.equals("sourceFolders")) { + sourceFolders = arg.getSimpleArrayValue(); + } else if (argName.equals("outputFolders")) { + outputFolders = arg.getSimpleArrayValue(); + } + } + + if (projectName == null) + throw new ProcessFailureException( + Messages.CreateNativeFolders_Missing_project_name); + + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (!project.exists()) + throw new ProcessFailureException( + Messages.CreateNativeFolders_Project_does_not_exist); + + if (sourceFolders == null && outputFolders == null) + throw new ProcessFailureException( + Messages.CreateNativeFolders_No_folders); + + try { + ICProject cproject = CCorePlugin.getDefault().getCoreModel() + .create(project); + IPathEntry[] pathEntries = cproject.getRawPathEntries(); + List newEntries = new ArrayList( + pathEntries.length); + for (IPathEntry pathEntry : pathEntries) { + if (pathEntry.getEntryKind() != IPathEntry.CDT_SOURCE + && pathEntry.getEntryKind() != IPathEntry.CDT_OUTPUT) { + newEntries.add(pathEntry); + } + } + if (sourceFolders != null) + for (String sourceFolder : sourceFolders) { + IFolder folder = project.getFolder(new Path(sourceFolder)); + if (!folder.exists()) + folder.create(true, true, monitor); + newEntries.add(CoreModel.newSourceEntry(folder + .getFullPath())); + } + if (outputFolders != null) + for (String outputFolder : outputFolders) { + IFolder folder = project.getFolder(new Path(outputFolder)); + if (!folder.exists()) + folder.create(true, true, monitor); + newEntries.add(CoreModel.newOutputEntry(folder + .getFullPath())); + } + cproject.setRawPathEntries( + newEntries.toArray(new IPathEntry[newEntries.size()]), + monitor); + + // IConfiguration[] configs = managedProject.getConfigurations(); + // for(IConfiguration conf:configs){ + // managedProject.removeConfiguration(conf.getId()); + + // } + + IConfiguration conSimDebug = ManagedBuildManager + .getExtensionConfiguration("com.intel.sgx.configuration.Sim.Debug"); + IConfiguration conSimRelease = ManagedBuildManager + .getExtensionConfiguration("com.intel.sgx.configuration.Sim.Release"); + IConfiguration conHwDebug = ManagedBuildManager + .getExtensionConfiguration("com.intel.sgx.configuration.HW.Debug"); + IConfiguration conHwPrerelease = ManagedBuildManager + .getExtensionConfiguration("com.intel.sgx.configuration.HW.Prerelease"); + IConfiguration conHwRelease = ManagedBuildManager + .getExtensionConfiguration("com.intel.sgx.configuration.HW.Release"); + + addConfigurationToProject(project, conSimDebug); + addConfigurationToProject(project, conSimRelease); + addConfigurationToProject(project, conHwDebug); + addConfigurationToProject(project, conHwPrerelease); + addConfigurationToProject(project, conHwRelease); + + + changeProjectConfiguration(project, conSimDebug); + + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + throw new ProcessFailureException(e); + } + } + + void addConfigurationToProject(IProject project, IConfiguration config) { + createConfiguration(project, config); + addSGXIncludePathsToConfiguration(project, config); + } + + private void addSGXIncludePathsToConfiguration(IProject project, + IConfiguration config) { + ICProjectDescription projectDescription = CoreModel.getDefault() + .getProjectDescription(project, true); + ICConfigurationDescription configDecriptions[] = projectDescription + .getConfigurations(); + for (ICConfigurationDescription configDescription : configDecriptions) { + ICFolderDescription projectRoot = configDescription + .getRootFolderDescription(); + + ICLanguageSetting[] settings = projectRoot.getLanguageSettings(); + for (ICLanguageSetting setting : settings) { + + if (!"org.eclipse.cdt.core.gcc".equals(setting.getLanguageId()) && !"org.eclipse.cdt.core.g++".equals(setting.getLanguageId()) ) { + continue; + } + List includes = new ArrayList(); + + includes.add(new CIncludePathEntry( Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.SDK_PATH) + + "/include/", + ICSettingEntry.LOCAL)); + + setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes); + } + } + try { + CoreModel.getDefault().setProjectDescription(project, + projectDescription); + } catch (CoreException e) { + e.printStackTrace(); + } + + } + + private void createConfiguration(IProject project, + IConfiguration config) { + ManagedProject managedProject = (ManagedProject) ManagedBuildManager.getBuildInfo(project) + .getManagedProject();; + + + Configuration cloneConfig1 = (Configuration) config; + Configuration cfg1 = new Configuration(managedProject, cloneConfig1, + cloneConfig1.getId(), false, false); + String target = cfg1.getArtifactName(); + if (target == null || target.length() == 0) + cfg1.setArtifactName(managedProject.getDefaultArtifactName()); + + cfg1.exportArtifactInfo(); + + ManagedBuildManager.saveBuildInfo(project, true); + } + + private void changeProjectConfiguration(IProject project, + IConfiguration conSimDebug) { + ICProjectDescription prjd = CCorePlugin.getDefault() + .getProjectDescriptionManager().getProjectDescription(project); + ICConfigurationDescription[] configs = prjd.getConfigurations(); + if (configs != null && configs.length > 0) { + for (ICConfigurationDescription config : configs) { + if (config.getConfiguration().getId() + .equals(conSimDebug.getId())) { + config.setActive(); + try { + CoreModel.getDefault().setProjectDescription(project, + prjd); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + break; + } + } + } + + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetCCNature.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetCCNature.java new file mode 100644 index 0000000000..e85476b288 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetCCNature.java @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.templates; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.process.ProcessArgument; +import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; +import org.eclipse.cdt.core.templateengine.process.ProcessRunner; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; + +import com.intel.sgx.Activator; +import com.intel.sgx.natures.SGXNature; + +public class SetCCNature extends ProcessRunner { + + public SetCCNature() { + } + + @Override + public void process(TemplateCore template, ProcessArgument[] args, + String processId, IProgressMonitor monitor) + throws ProcessFailureException { + String projectName = null; + IProject project = null; + + for(ProcessArgument arg: args){ + String argName = arg.getName(); + if(argName.equals("projectName")){ + projectName = arg.getSimpleValue(); + } + } + + + project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + IWorkspace workspace = project.getWorkspace(); + IProjectDescription description; + try { + description = project.getDescription(); + + String[] natures = description.getNatureIds(); + String[] newNatures = new String[natures.length+1]; + System.arraycopy(natures,0,newNatures,0,natures.length); + newNatures[natures.length] = SGXNature.NATURE_ID; + IStatus status = workspace.validateNatureSet(newNatures); + + if(status.getCode() == IStatus.OK) + { + + description.setNatureIds(newNatures); + project.setDescription(description, null); + } + else { + System.err.println("Incorrect Project Nature. Please check Project Settings."); + } + } catch (CoreException e) { + Activator.log(e); + e.printStackTrace(); + } + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetStaticCCNature.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetStaticCCNature.java new file mode 100644 index 0000000000..449a575262 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/templates/SetStaticCCNature.java @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.templates; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.process.ProcessArgument; +import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; +import org.eclipse.cdt.core.templateengine.process.ProcessRunner; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; + +import com.intel.sgx.Activator; +import com.intel.sgx.natures.SGXStaticCCNature; + +public class SetStaticCCNature extends ProcessRunner { + + public SetStaticCCNature() { + } + + @Override + public void process(TemplateCore template, ProcessArgument[] args, + String processId, IProgressMonitor monitor) + throws ProcessFailureException { + + String projectName = null; + IProject project = null; + + for(ProcessArgument arg: args){ + String argName = arg.getName(); + if(argName.equals("projectName")){ + projectName = arg.getSimpleValue(); + } + } + + project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + IWorkspace workspace = project.getWorkspace(); + IProjectDescription description; + try { + description = project.getDescription(); + + String[] natures = description.getNatureIds(); + String[] newNatures = new String[natures.length+1]; + System.arraycopy(natures,0,newNatures,0,natures.length); + newNatures[natures.length] = SGXStaticCCNature.NATURE_ID; + IStatus status = workspace.validateNatureSet(newNatures); + + if(status.getCode() == IStatus.OK) + { + description.setNatureIds(newNatures); + project.setDescription(description, null); + } + else + System.err.println("Incorrect Project Nature. Please check Project Settings."); + } catch (CoreException e) { + Activator.log(e); + e.printStackTrace(); + } + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/testers/SGXPropertyTester.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/testers/SGXPropertyTester.java new file mode 100644 index 0000000000..1b876c79c6 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/testers/SGXPropertyTester.java @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.testers; + +import java.util.regex.Pattern; + +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.viewers.StructuredSelection; + +public class SGXPropertyTester extends PropertyTester { + + private static final Pattern isRelease = Pattern.compile(".*Release.*"); + private static final Pattern isHW = Pattern.compile(".*Hardware.*"); + private static final Pattern isPreRelease = Pattern.compile(".*Prerelease.*");; + + public SGXPropertyTester() { + super(); + + // TODO Auto-generated constructor stub + } + + @Override + public boolean test(Object receiver, String property, Object[] args, + Object expectedValue) { + + + + + + if (property.equals("twoStepsActive")) { + IProject project = getProjectOfSelectedItem(receiver); + IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); + return isHW(buildInfo) && isRelease(buildInfo) && !isPreRelease(buildInfo); + + } else if (property.equals("sgxNatureAdded")) { + IProject project = getProjectOfSelectedItem(receiver); + return true; + } else { + return false; + } + } + + private IProject getProjectOfSelectedItem(Object receiver) { + StructuredSelection selection = (StructuredSelection) receiver; + IResource resource = (IResource) selection.getFirstElement(); + IProject project = resource.getProject(); + return project; + } + + boolean isHW(IManagedBuildInfo buildInfo){ + return isHW.matcher(buildInfo.getConfigurationName()).matches(); + } + + + + boolean isRelease(IManagedBuildInfo buildInfo){ + return isRelease.matcher(buildInfo.getConfigurationName()).matches(); + } + + boolean isPreRelease(IManagedBuildInfo buildInfo){ + return isPreRelease.matcher(buildInfo.getConfigurationName()).matches(); + } + +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCCProjectWizard.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCCProjectWizard.java new file mode 100644 index 0000000000..be6ec1e51b --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCCProjectWizard.java @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.wizards; + +import java.net.URI; +import java.util.Map; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.cdt.ui.wizards.CCProjectWizard; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; + +import com.intel.sgx.natures.SGXNature; + +public class SGXCCProjectWizard extends CCProjectWizard { + + private IProject project; + + @Override + protected boolean setCreated() throws CoreException { + boolean result = super.setCreated(); + doIt(project, new NullProgressMonitor()); + return result; + } + + @Override + public boolean performFinish() { + + return super.performFinish(); + } + + @Override + public void setInitializationData(IConfigurationElement config, + String propertyName, Object data) throws CoreException { + // TODO Auto-generated method stub + super.setInitializationData(config, propertyName, data); + } + + @Override + public IProject createIProject(String name, URI location) + throws CoreException { + // TODO Auto-generated method stub + return super.createIProject(name, location); + + } + + @Override + public IProject createIProject(String name, URI location, + IProgressMonitor monitor) throws CoreException { + project = super.createIProject(name, location, monitor); + return project; + } + + @Override + public String[] getExtensions() { + // TODO Auto-generated method stub + return super.getExtensions(); + } + + public SGXCCProjectWizard() { + // TODO Auto-generated constructor stub + } + + @Override + public String[] getNatures() { + // TODO Auto-generated method stub + return super.getNatures(); + } + + @Override + protected IProject continueCreation(IProject prj) { + // TODO Auto-generated method stub + return super.continueCreation(prj); + } + + @Override + public String[] getContentTypeIDs() { + // TODO Auto-generated method stub + return super.getContentTypeIDs(); + } + + @Override + public IProject getProject(boolean defaults) { + // TODO Auto-generated method stub + return super.getProject(defaults); + } + + @Override + public String[] getLanguageIDs() { + // TODO Auto-generated method stub + return super.getLanguageIDs(); + } + + void doIt(IProject project, IProgressMonitor monitor) throws CoreException { + TemplateCore template = TemplateEngine.getDefault().getTemplateById( + "AddSGXNature"); + Map valueStore = template.getValueStore(); + valueStore.put("projectName", project.getName()); + valueStore.put("baseName", project.getName()); + template.executeTemplateProcesses(monitor, false); + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = SGXNature.NATURE_ID; + IStatus status = workspace.validateNatureSet(newNatures); + + if (status.getCode() == IStatus.OK) { + description.setNatureIds(newNatures); + project.setDescription(description, null); + } else { + System.err + .println("Incorrect Project Nature. Please check Project Settings.");// TODO + // throw + // an + // exception + // here. + System.err.println("Status is: " + status.getCode()); + } + + // project.refreshLocal(IResource.DEPTH_ONE,null); + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCProjectWizard.java b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCProjectWizard.java new file mode 100644 index 0000000000..14ec8f8284 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/src/com/intel/sgx/wizards/SGXCProjectWizard.java @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2016 Intel Corporation. // +// // +// All rights reserved. This program and the accompanying materials // +// are made available under the terms of the Eclipse Public License v1.0 // +// which accompanies this distribution, and is available at // +// http://www.eclipse.org/legal/epl-v10.html // +// // +// Contributors: // +// Intel Corporation - initial implementation and documentation // +/////////////////////////////////////////////////////////////////////////// + + +package com.intel.sgx.wizards; + +import java.net.URI; +import java.util.Map; + +import org.eclipse.cdt.core.templateengine.TemplateCore; +import org.eclipse.cdt.core.templateengine.TemplateEngine; +import org.eclipse.cdt.ui.wizards.CProjectWizard; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; + +import com.intel.sgx.natures.SGXNature; + +public class SGXCProjectWizard extends CProjectWizard { + + private IProject project; + + @Override + protected boolean setCreated() throws CoreException { + boolean result = super.setCreated(); + doIt(project, new NullProgressMonitor()); + return result; + } + + @Override + public boolean performFinish() { + + return super.performFinish(); + } + + @Override + public void setInitializationData(IConfigurationElement config, + String propertyName, Object data) throws CoreException { + // TODO Auto-generated method stub + super.setInitializationData(config, propertyName, data); + } + + @Override + public IProject createIProject(String name, URI location) + throws CoreException { + // TODO Auto-generated method stub + return super.createIProject(name, location); + + } + + @Override + public IProject createIProject(String name, URI location, + IProgressMonitor monitor) throws CoreException { + project = super.createIProject(name, location, monitor); + return project; + } + + @Override + public String[] getExtensions() { + // TODO Auto-generated method stub + return super.getExtensions(); + } + + public SGXCProjectWizard() { + // TODO Auto-generated constructor stub + } + + @Override + public String[] getNatures() { + // TODO Auto-generated method stub + return super.getNatures(); + } + + @Override + protected IProject continueCreation(IProject prj) { + // TODO Auto-generated method stub + return super.continueCreation(prj); + } + + @Override + public String[] getContentTypeIDs() { + // TODO Auto-generated method stub + return super.getContentTypeIDs(); + } + + @Override + public IProject getProject(boolean defaults) { + // TODO Auto-generated method stub + return super.getProject(defaults); + } + + @Override + public String[] getLanguageIDs() { + // TODO Auto-generated method stub + return super.getLanguageIDs(); + } + + void doIt(IProject project, IProgressMonitor monitor) throws CoreException { + TemplateCore template = TemplateEngine.getDefault().getTemplateById( + "AddSGXNature"); + Map valueStore = template.getValueStore(); + valueStore.put("projectName", project.getName()); + valueStore.put("baseName", project.getName()); + template.executeTemplateProcesses(monitor, false); + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IProjectDescription description = project.getDescription(); + String[] natures = description.getNatureIds(); + for (String nature : natures) { + } + + String[] newNatures = new String[natures.length + 1]; + System.arraycopy(natures, 0, newNatures, 0, natures.length); + newNatures[natures.length] = SGXNature.NATURE_ID; + IStatus status = workspace.validateNatureSet(newNatures); + + if (status.getCode() == IStatus.OK) { + description.setNatureIds(newNatures); + project.setDescription(description, null); + } else { + System.err + .println("Incorrect Project Nature. Please check Project Settings.");// TODO + // throw + // an + // exception + // here. + System.err.println("Status is: " + status.getCode()); + } + + } +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGX.gif b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGX.gif new file mode 100644 index 0000000000000000000000000000000000000000..21156bbf969fa165e8636adee1e16e5ba6e21a01 GIT binary patch literal 51766 zcmXVWcRU-;A9n~L#4cjB_EsTwRjE;X?^QEmR!g-MjXe@Y%vd#I#i+fhO^DjFC`xO# z)#_6H=IQTwp8MxsclUbTz3=^b-`(f#KKBgtR8-xIDcUK10{&lu0{{pB00#h&001&T z3ILFT1EdfDDI7qG1dt*FYybcoIKT!0u)zUrNB|o$00jV`-~bc?fWiS#BmjyGAOHXa zIDmiv5O4qj2|yqNmH~ieIA9q8SjGXCNq}YYzrF!vIDm`*kZ}Mq2|)f=0KfroH~;|$ z;NSq#zc#oO04@cGOCjJ=IJguEE=7jh0N^%oxD5hsgM-_U;5KA93IIpJ;V1+gg@dC= za1 zvmxV902~UALm_Y|91caop~yG_07ro12nZYjha-@11TtPBO`ER9F9!Fk^iy(&)9Gh06_xaNC475W00f(Bq=ya3PF;>k)%i@DKg0hK(c|8 zY!Df90^4tp~xfxfJA_k2nZ4ZMx!O2nxvJ{RiMIuX) z$u7y!0Dvoi^#7{$zkYSO2bNLt=3isQbY_6C{=hsf7j@IR3X+zSgx~o;<&A5yaqGq zgBfreh1J`;V*73;5Txtgb_T!KShAZHw`xIuJ*IBew}9$Ka2l`{g-KX=U+zn~lDa;& zlp7S@WEb_#a~(`=6Bld?heO|_0%SL+ZSx(g3@emeXL=qR^xmJRdq3uHhj&B=Cw)S9 zKakOV{am)ZU4Qk^rPpuPwb6E6es!+G=%xOHTD*RY-1{o_6prA}?Z^}|lbJuKj7$4m z9n*toyM|8@LySTNPka9UneUXZEb0tF?xdpb83lh_Uf7N}ZnrDB`RT~AoDH3NZO6&Pd&a!s9;OorK%6t^aa3S&Pdnc}-jOC+Yp{QUtTF^|e zYcKoI;K<~erM!LxIxAP{{_WUANk6^I0C8|~zJ#SdQfR?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iP;96FS2bu)KZ*wab&`#hRN_%oNKst{#U^Gg%|+>irqy{Teyo!iNU=KC ztWvL=U=-?5b45F%h7Y4IR4QN*cbD!w>{1>LOt|Q}*n^@jI$ZE27{`;lND_65N2S+N zy(cA;JX);xgBLGi`neW z&^?^><8YICQ)pz@y&>JMIMqnqN6IskE!n~ir`E9&&9|cxGk_@HJK%#-l_XV~)`{+D z9+kqbPfx7>?LE=7oP`1{JTQ=$-3YwlkRH;5H0>7lkV{@&jkmrfZiyl(6+Z(@XS5uK zaXFU}u@A2?uQ538dNlhkrtYL5!-bGQs{0pW#@NWlJY{r7l$@qX_@3N@C(Gp19ccAY zeqHMAk+p14RHc(j%xP5(Tjtt&v8R_O(P2O(27qyH+07wMXu9|aMoZ>busk+ON&IGI zybRePD=6rj1r29EDLRxmB{wVv3#SR#FG^LTR8!s&%c?RRd-Vi<}T&v*)w#FsHvZ z!GRz57t|YX4LK58Xmgk&(3>io+21Z^CMv|;yi5y(1wpqY(%T3G zOG48OLBor|J#T|bLYUo*P-MFJ#h{@?3>e0;x9L6bVg@&zp6jmDya`%~;b0g9hxk?F ztEz0fx`GzeN5nNQ@iljxApzca$gf(D7JD2p8WwrVcdCyxyxZibR(Z^II*j$2{2?;O z`CRMaSeqjx%Q*-7PJ1odpckF4+HpBTaB35DrZbjPPeZKx + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/trustedstatictemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/trustedstatictemplate.xml new file mode 100644 index 0000000000..7b8649b17c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/trustedstatictemplate.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/untrusted_module_template.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/untrusted_module_template.xml new file mode 100644 index 0000000000..537100987e --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/minimal/untrusted_module_template.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/with_sample/enclavetemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/with_sample/enclavetemplate.xml new file mode 100644 index 0000000000..7d9527dafb --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c++/with_sample/enclavetemplate.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/enclavetemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/enclavetemplate.xml new file mode 100644 index 0000000000..c32e20347a --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/enclavetemplate.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/trustedstatictemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/trustedstatictemplate.xml new file mode 100644 index 0000000000..6fc320cbba --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/trustedstatictemplate.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/untrusted_module_template.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/untrusted_module_template.xml new file mode 100644 index 0000000000..b8aec6e666 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/minimal/untrusted_module_template.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/with_sample/enclavetemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/with_sample/enclavetemplate.xml new file mode 100644 index 0000000000..66344d6636 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/c/with_sample/enclavetemplate.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/common/addnaturetemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/common/addnaturetemplate.xml new file mode 100644 index 0000000000..9cf5663e3c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/common/addnaturetemplate.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/configtemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/configtemplate.xml new file mode 100644 index 0000000000..7ce22c45e3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/configtemplate.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/ctemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/ctemplate.xml new file mode 100644 index 0000000000..ed5cbba697 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/ctemplate.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxstaticlibtemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxstaticlibtemplate.xml new file mode 100644 index 0000000000..8ad900de61 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxstaticlibtemplate.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxtemplate.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxtemplate.xml new file mode 100644 index 0000000000..a07ed1479c --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/cxxtemplate.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/template.properties b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/template.properties new file mode 100644 index 0000000000..9ef4fcdf31 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/SGXtemplates/template.properties @@ -0,0 +1,63 @@ +######################################################################### +# Copyright (c) 2016 Intel Corporation. # +# # +# All rights reserved. This program and the accompanying materials # +# are made available under the terms of the Eclipse Public License v1.0 # +# which accompanies this distribution, and is available at # +# http://www.eclipse.org/legal/epl-v10.html # +# # +# Contributors: # +# Intel Corporation - initial implementation and documentation # +######################################################################### + SGX.author=Intel + + #Add Nature template Values + SGX.naturetemplate.title.description=A Software Guard Extensions Project template. + SGX.naturetemplate.title.label=SGX Project + SGX.naturetemplate.title.id=AddSGXNature + + #Enclave Config template Values + SGX.enclaveconfig.template.title.description=A Software Guard Extensions Configuration template. + SGX.enclaveconfig.template.title.label=SGX Enclave Configuration + SGX.enclaveconfig.template.title.id=SGXEnclaveConfig + + #Untrusted Module template values + SGX.untrustedModule.template.title.description= A Software Guard Extensions Untrusted Module template. + SGX.untrustedModule.template.title.label=SGX Untrusted Module + + #Enclave template values + SGX.enclave.template.title.description= A Software Guard Extensions Project template. + SGX.enclave.template.title.label=SGX Project + SGX.enclave.template.title.id=SGXProject + + #C template Values + SGX.Ctemplate.title.description=A Software Guard Extensions C Enclave Project template. + SGX.Ctemplate.title.label=SGX C Enclave Project + SGX.Ctemplate.title.id=SGXCProject + SGX.Ctemplate.enclaveSettings.label=Enclave Settings + SGX.Ctemplate.enclaveSettings.description=Initial settings required for a new enclave. + + #C Static lib template Values + SGX.CStatictemplate.title.description=A Software Guard Extensions C Enclave Project template. + SGX.CStatictemplate.title.label=SGX C Enclave Library Project + SGX.CStatictemplate.title.id=SGXCEnclaveLibProject + SGX.CStatictemplate.enclaveSettings.label=Enclave Settings + SGX.CStatictemplate.enclaveSettings.description=Initial settings required for a new enclave Library. + SGX.CStatictemplate.requiresEdl.label=Requires EDL + SGX.CStatictemplate.requiresEdl.description=De-select this option to create an Non-SGX trusted static library without an Edl file. By default, the project creates an Enclave library with an Edl file. + + #CXX template Values + SGX.CXXtemplate.title.description=A Software Guard Extensions C++ Enclave Project template. + SGX.CXXtemplate.title.label=C/C++ Project with SGX Nature + SGX.CXXtemplate.title.id=SGXCPPProject + SGX.CXXtemplate.enclaveSettings.label=Enclave Settings + SGX.CXXtemplate.enclaveSettings.description=Initial settings required for a new enclave. + + #CXX Static lib template Values + SGX.CXXStatictemplate.title.description=A Software Guard Extensions C++ Enclave Library Project template. + SGX.CXXStatictemplate.title.label=SGX C++ Enclave Library Project + SGX.CXXStatictemplate.title.id=SGXCPPEnclaveLibProject + SGX.CXXStatictemplate.enclaveSettings.label=Enclave Settings + SGX.CXXStatictemplate.enclaveSettings.description=Initial settings required for a new enclave Library. + SGX.CXXStatictemplate.requiresEdl.label=Requires EDL + SGX.CXXStatictemplate.requiresEdl.description=De-select this option to create an Non-SGX trusted static library without an Edl file. By default, the project creates an Enclave library with an Edl file. diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/newmngc_app.gif b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/newmngc_app.gif new file mode 100644 index 0000000000000000000000000000000000000000..23b0284f84e58833456759f47018ba0bbb182844 GIT binary patch literal 612 zcmZ?wbhEHb6krfwc*el+^ueRBrp+5qzu0^3p-b5+xAN6)6{|ff*Z9`1_pMnM*syWe znfn?^(+a1ozy9!L#^#5)TOZ|bdsMOONy~v}6OO&O@%sCfm!IGN`v2+o|Er(>Kl=9X z@wb1ke*S;=>;K2!{~v$<_vHJ(mp}i%{q_IZkAJU!{eSoS|NGznKmYmv```Z;KmUFD z^Z(o5|G)nI|M~C#&SS^_{e9n5?$}#v*HPurT;|wZ?)dl1`Mw&vj!K8WpU-cdsJwNO z@~-J>vzx7^*4s>Ju=(?R@w`g0WsOqHnxvLCNv-RWU*Bi4zRz@7r}@G*i-m2Lvzx7d z-)){*BD|^JWOcXMgG=lF|NqZ0n1JF>7Dfh!00te9qd;-Oz<#hHpsBf~wXNN{g@uK+ zhn<6qk=a_mvx%QyfL~BZSVYv)O5e(=sk@hros-+e)YQVl)Fr@Ia@%%ES!ZW^CrAG+ zl8T3qC~7-+J81X@xJs(4^YQZV$XxKz(Qym#lhjhbtf$9wL03-BFTh<=P3^L(xcFNo z6&3dYk3%w-C7#R3Xu9=yFu8iN2`DUMlxY9Z%*Jc8;KzvtiOmg}JUTfyJ_I=PYZw~k h$aoel;ngs5nHE#Ye2PcHBwWhtWj!Nlho2CsdZiQ z>-$XB_n9v1G+)?ev9Qf@cC+>GyUjC8gg5n@tnM~@aB1ED|Nj{V4k-R)VPs$kW6%LP z0Td?;?3WwDnwnc$+u9vlSXfwl*g3cunH^0#n?yuJMa0Ax3Z8RFRzN8s;Xg-p^8sfi1I}f z6J8x{1sw%#?T|3v`@H&!ANkbO_!RYh!~EVUsjKtzDmY|(cyL5mJKzqZ!1YIrJbe67 z2LzH@PjE0^l&W#K$k=+EPqr;$r=ilZw#kM*c{4UB9%GRUE9mh!*wDz%Z<=}Q%Z0;U Ue9~4;uQo86Xap>1WMHrc0INa$RR910 literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename.config.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename.config.xml new file mode 100644 index 0000000000..6210afff28 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename.config.xml @@ -0,0 +1,9 @@ + + $(ProdID) + $(IsvSvn) + $(ThreadStackSize) + $(GlobalHeapSize) + $(TcsNumber) + $(TcsPolicy) + $(DisableDebug) + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename_private.pem b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename_private.pem new file mode 100644 index 0000000000..790839d391 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/resources/Basename_private.pem @@ -0,0 +1,39 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIG4wIBAAKCAYEA8DLzZJpN7sN5J1PtKZAqWFeW+0/pPJVWRKEB8lfqXGJ0YIjG +1o0g0/+60ktlm0vVdWSqepmpRpTB2ZZjxxc+JHfZGQnvmlGx6qQxSFS9u+S8mSzD +MknsquLVsi7rojq34dTwSckMg0KQ/sGmsV6EgsUnldhdcPOJ8+NaaqtmAmjHYIpK +jLo3pJz0e7NqKvzE2YhmZZjrIZBNFHxX/lrQ36lW6Obp8xj9Cq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GXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_t.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_t.mk new file mode 100644 index 0000000000..41aaf26fa4 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_t.mk @@ -0,0 +1,127 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif + +Crypto_Library_Name := sgx_tcrypto + +$(EnclaveName)_Cpp_Files := trusted/$(enclaveName).cpp +$(EnclaveName)_C_Files := +$(EnclaveName)_Include_Paths := -IInclude -Itrusted -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport + + +Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11 +Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $($(EnclaveName)_Include_Paths) -fno-builtin-printf -I. +$(EnclaveName)_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags) +$(EnclaveName)_Cpp_Flags := $(Common_C_Cpp_Flags) -std=c++11 -nostdinc++ -fno-builtin-printf -I. + +$(EnclaveName)_Cpp_Flags := $($(EnclaveName)_Cpp_Flags) -fno-builtin-printf + +$(EnclaveName)_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=trusted/$(enclaveName).lds + +$(EnclaveName)_Cpp_Objects := $($(EnclaveName)_Cpp_Files:.cpp=.o) +$(EnclaveName)_C_Objects := $($(EnclaveName)_C_Files:.c=.o) + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +ifeq ($(Build_Mode), HW_RELEASE) +all: $(enclaveName).so + @echo "Build enclave $(enclaveName).so [$(Build_Mode)|$(SGX_ARCH)] success!" + @echo + @echo "*********************************************************************************************************************************************************" + @echo "PLEASE NOTE: In this mode, please sign the $(enclaveName).so first using Two Step Sign mechanism before you run the app to launch and access the enclave." + @echo "*********************************************************************************************************************************************************" + @echo + + +else +all: $(enclaveName).signed.so +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/app + @echo "RUN => app [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + + +######## $(enclaveName) Objects ######## + +trusted/$(enclaveName)_t.c: $(SGX_EDGER8R) ./trusted/$(enclaveName).edl + @cd ./trusted && $(SGX_EDGER8R) --trusted ../trusted/$(enclaveName).edl --search-path ../trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +trusted/$(enclaveName)_t.o: ./trusted/$(enclaveName)_t.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +trusted/%.o: trusted/%.cpp + @$(CXX) $($(EnclaveName)_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +trusted/%.o: trusted/%.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(enclaveName).so: trusted/$(enclaveName)_t.o $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) + @$(CXX) $^ -o $@ $($(EnclaveName)_Link_Flags) + @echo "LINK => $@" + +$(enclaveName).signed.so: $(enclaveName).so + @$(SGX_ENCLAVE_SIGNER) sign -key trusted/$(enclaveName)_private.pem -enclave $(enclaveName).so -out $@ -config trusted/$(enclaveName).config.xml + @echo "SIGN => $@" +clean: + @rm -f $(enclaveName).* trusted/$(enclaveName)_t.* $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.mk new file mode 100644 index 0000000000..201963cb07 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.mk @@ -0,0 +1,129 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +# App_Cpp_Files := App/App.cpp $(wildcard App/Edger8rSyntax/*.cpp) $(wildcard App/TrustedLibrary/*.cpp) +App_Cpp_Files := $(UNTRUSTED_DIR)/sample.cpp # $(wildcard App/TrustedLibrary/*.cpp) +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 +App_Link_Flags := $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread + +ifneq ($(SGX_MODE), HW) + App_Link_Flags += -lsgx_uae_service_sim +else + App_Link_Flags += -lsgx_uae_service +endif + +App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) + + + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +ifeq ($(Build_Mode), HW_RELEASE) +all: sample + @echo "Build sample [$(Build_Mode)|$(SGX_ARCH)] success!" + @echo + @echo "*********************************************************************************************************************************************************" + @echo "PLEASE NOTE: In this mode, please sign the $(enclaveName).so first using Two Step Sign mechanism before you run the app to launch and access the enclave." + @echo "*********************************************************************************************************************************************************" + @echo + + +else +all: sample +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/sample + @echo "RUN => sample [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(enclaveName)_u.c: $(SGX_EDGER8R) trusted/$(enclaveName).edl + @cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../trusted/$(enclaveName).edl --search-path ../trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(enclaveName)_u.o: $(UNTRUSTED_DIR)/$(enclaveName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(UNTRUSTED_DIR)/%.o: $(UNTRUSTED_DIR)/%.cpp + @$(CXX) $(App_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +sample: $(UNTRUSTED_DIR)/$(enclaveName)_u.o $(App_Cpp_Objects) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + + +.PHONY: clean + +clean: + @rm -f sample $(App_Cpp_Objects) $(UNTRUSTED_DIR)/$(enclaveName)_u.* diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.without_app.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.without_app.mk new file mode 100644 index 0000000000..00aed4b876 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c++/sgx_u.without_app.mk @@ -0,0 +1,71 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 + +.PHONY: all run + +all: $(UNTRUSTED_DIR)/$(enclaveName)_u.o + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(enclaveName)_u.c: $(SGX_EDGER8R) trusted/$(enclaveName).edl + @mkdir -p $(UNTRUSTED_DIR) + @cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../trusted/$(enclaveName).edl --search-path ../trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(enclaveName)_u.o: $(UNTRUSTED_DIR)/$(enclaveName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +.PHONY: clean + +clean: + @rm -f $(UNTRUSTED_DIR)/$(enclaveName)_u.* diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_t.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_t.mk new file mode 100644 index 0000000000..3851c1de3b --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_t.mk @@ -0,0 +1,115 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif + +Crypto_Library_Name := sgx_tcrypto + +$(EnclaveName)_C_Files := trusted/$(enclaveName).c +$(EnclaveName)_Include_Paths := -IInclude -Itrusted -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport + +Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11 +Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $($(EnclaveName)_Include_Paths) -fno-builtin-printf -I. +$(EnclaveName)_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags) + +$(EnclaveName)_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=trusted/$(enclaveName).lds + +$(EnclaveName)_C_Objects := $($(EnclaveName)_C_Files:.c=.o) + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +ifeq ($(Build_Mode), HW_RELEASE) +all: $(enclaveName).so + @echo "Build enclave $(enclaveName).so [$(Build_Mode)|$(SGX_ARCH)] success!" + @echo + @echo "*********************************************************************************************************************************************************" + @echo "PLEASE NOTE: In this mode, please sign the $(enclaveName).so first using Two Step Sign mechanism before you run the app to launch and access the enclave." + @echo "*********************************************************************************************************************************************************" + @echo +else +all: $(enclaveName).signed.so +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/app + @echo "RUN => app [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + + +######## $(enclaveName) Objects ######## + +trusted/$(enclaveName)_t.c: $(SGX_EDGER8R) ./trusted/$(enclaveName).edl + @cd ./trusted && $(SGX_EDGER8R) --trusted ../trusted/$(enclaveName).edl --search-path ../trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +trusted/$(enclaveName)_t.o: ./trusted/$(enclaveName)_t.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +trusted/%.o: trusted/%.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(enclaveName).so: trusted/$(enclaveName)_t.o $($(EnclaveName)_C_Objects) + @$(CXX) $^ -o $@ $($(EnclaveName)_Link_Flags) + @echo "LINK => $@" + +$(enclaveName).signed.so: $(enclaveName).so + @$(SGX_ENCLAVE_SIGNER) sign -key trusted/$(enclaveName)_private.pem -enclave $(enclaveName).so -out $@ -config trusted/$(enclaveName).config.xml + @echo "SIGN => $@" +clean: + @rm -f $(enclaveName).* trusted/$(enclaveName)_t.* $($(EnclaveName)_C_Objects) diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.mk new file mode 100644 index 0000000000..70d293e363 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.mk @@ -0,0 +1,126 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +App_C_Files := $(UNTRUSTED_DIR)/sample.c +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Link_Flags := $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread + +ifneq ($(SGX_MODE), HW) + App_Link_Flags += -lsgx_uae_service_sim +else + App_Link_Flags += -lsgx_uae_service +endif + +App_C_Objects := $(App_C_Files:.c=.o) + + + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +ifeq ($(Build_Mode), HW_RELEASE) +all: sample + @echo "Build sample [$(Build_Mode)|$(SGX_ARCH)] success!" + @echo + @echo "*********************************************************************************************************************************************************" + @echo "PLEASE NOTE: In this mode, please sign the $(enclaveName).so first using Two Step Sign mechanism before you run the app to launch and access the enclave." + @echo "*********************************************************************************************************************************************************" + @echo + +else +all: sample +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/sample + @echo "RUN => sample [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(enclaveName)_u.c: $(SGX_EDGER8R) trusted/$(enclaveName).edl + @cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../trusted/$(enclaveName).edl --search-path ../trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(enclaveName)_u.o: $(UNTRUSTED_DIR)/$(enclaveName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(UNTRUSTED_DIR)/%.o: $(UNTRUSTED_DIR)/%.c + @$(CXX) $(App_C_Flags) -c $< -o $@ + @echo "CXX <= $<" + +sample: $(UNTRUSTED_DIR)/$(enclaveName)_u.o $(App_C_Objects) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + + +.PHONY: clean + +clean: + @rm -f sample $(App_C_Objects) $(UNTRUSTED_DIR)/$(enclaveName)_u.* diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.without_app.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.without_app.mk new file mode 100644 index 0000000000..f9eee94c69 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/c/sgx_u.without_app.mk @@ -0,0 +1,70 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + + +.PHONY: all run + +all: $(UNTRUSTED_DIR)/$(enclaveName)_u.o + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(enclaveName)_u.c: $(SGX_EDGER8R) trusted/$(enclaveName).edl + @mkdir -p $(UNTRUSTED_DIR) + @cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../trusted/$(enclaveName).edl --search-path ../trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(enclaveName)_u.o: $(UNTRUSTED_DIR)/$(enclaveName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +.PHONY: clean + +clean: + @rm -f $(UNTRUSTED_DIR)/$(enclaveName)_u.* diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/common/Makefile b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/common/Makefile new file mode 100644 index 0000000000..3defedc4c8 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/makefiles/common/Makefile @@ -0,0 +1,8 @@ +all: + $(MAKE) -f sgx_u.mk all + $(MAKE) -f sgx_t.mk all + +clean: + $(MAKE) -f sgx_u.mk clean + $(MAKE) -f sgx_t.mk clean + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml new file mode 100644 index 0000000000..a957526f95 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml @@ -0,0 +1,10 @@ + + + 0 + 0 + 0x40000 + 0x100000 + 10 + 1 + 0 + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.cpp b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.cpp new file mode 100644 index 0000000000..78f55c1553 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.cpp @@ -0,0 +1,26 @@ +#include +#include /* vsnprintf */ + +#include "$(enclaveName).h" +#include "$(enclaveName)_t.h" /* print_string */ + +/* + * printf: + * Invokes OCALL to display the enclave buffer to the terminal. + */ +void printf(const char *fmt, ...) +{ + char buf[BUFSIZ] = {'\0'}; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, BUFSIZ, fmt, ap); + va_end(ap); + ocall_$(enclaveName)_sample(buf); +} + +int ecall_$(enclaveName)_sample() +{ + printf("IN $(ENCLAVENAME)\n"); + return 0; +} + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.edl b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.edl new file mode 100644 index 0000000000..e97f447eb3 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.edl @@ -0,0 +1,18 @@ +/* $(enclaveName).edl - Top EDL file. */ + +enclave { + + /* + * ocall_$(enclaveName)_sample - invokes OCALL to display string buffer inside the enclave. + * [in]: copy the string buffer to App outside. + * [string]: specifies 'str' is a NULL terminated buffer. + */ + untrusted { + void ocall_$(enclaveName)_sample([in, string] const char *str); + }; + + + trusted { + public int ecall_$(enclaveName)_sample(); + }; +}; diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.h b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.h new file mode 100644 index 0000000000..2d29332f3f --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.h @@ -0,0 +1,17 @@ +#ifndef _$(ENCLAVENAME)_H_ +#define _$(ENCLAVENAME)_H_ + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +void printf(const char *fmt, ...); + +#if defined(__cplusplus) +} +#endif + +#endif /* !_$(ENCLAVENAME)_H_ */ diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.lds b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.lds new file mode 100644 index 0000000000..9019f79f5d --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.lds @@ -0,0 +1,9 @@ +$(enclaveName).so +{ + global: + g_global_data_sim; + g_global_data; + $(enclaveName)_entry; + local: + *; +}; diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.cpp b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.cpp new file mode 100644 index 0000000000..79700c42b7 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.cpp @@ -0,0 +1,7 @@ +#include "$(enclaveName)_t.h" /* print_string */ + +int ecall_$(enclaveName)_sample() +{ + return 0; +} + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.edl b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.edl new file mode 100644 index 0000000000..f332f81910 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_minimal.edl @@ -0,0 +1,10 @@ +/* $(enclaveName).edl - Top EDL file. */ + +enclave { + untrusted { + }; + + trusted { + public int ecall_$(enclaveName)_sample(); + }; +}; diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_private.pem b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_private.pem new file mode 100644 index 0000000000..529d07be35 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1_private.pem @@ -0,0 +1,39 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ +AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ +ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7j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JY2zT3WIpjwuk0ZzmRg5p0pG/svVQEH +NZmwRwlopysbR69B/n1nefJ84UO50fLh5s5Zr3gBRwbWNZyzhXk= +-----END RSA PRIVATE KEY----- diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.cpp b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.cpp new file mode 100644 index 0000000000..58b28a8509 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.cpp @@ -0,0 +1,247 @@ +#include +#include + +#include +#include +#include +#include + +# define MAX_PATH FILENAME_MAX + + +#include +#include "sample.h" + +#include "$(enclaveName)_u.h" + + + +/* Global EID shared by multiple threads */ +sgx_enclave_id_t global_eid = 0; + +typedef struct _sgx_errlist_t { + sgx_status_t err; + const char *msg; + const char *sug; /* Suggestion */ +} sgx_errlist_t; + +/* Error code returned by sgx_create_enclave */ +static sgx_errlist_t sgx_errlist[] = { + { + SGX_ERROR_UNEXPECTED, + "Unexpected error occurred.", + NULL + }, + { + SGX_ERROR_INVALID_PARAMETER, + "Invalid parameter.", + NULL + }, + { + SGX_ERROR_OUT_OF_MEMORY, + "Out of memory.", + NULL + }, + { + SGX_ERROR_ENCLAVE_LOST, + "Power transition occurred.", + "Please refer to the sample \"PowerTransition\" for details." + }, + { + SGX_ERROR_INVALID_ENCLAVE, + "Invalid enclave image.", + NULL + }, + { + SGX_ERROR_INVALID_ENCLAVE_ID, + "Invalid enclave identification.", + NULL + }, + { + SGX_ERROR_INVALID_SIGNATURE, + "Invalid enclave signature.", + NULL + }, + { + SGX_ERROR_OUT_OF_EPC, + "Out of EPC memory.", + NULL + }, + { + SGX_ERROR_NO_DEVICE, + "Invalid SGX device.", + "Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards." + }, + { + SGX_ERROR_MEMORY_MAP_CONFLICT, + "Memory map conflicted.", + NULL + }, + { + SGX_ERROR_INVALID_METADATA, + "Invalid enclave metadata.", + NULL + }, + { + SGX_ERROR_DEVICE_BUSY, + "SGX device was busy.", + NULL + }, + { + SGX_ERROR_INVALID_VERSION, + "Enclave version was invalid.", + NULL + }, + { + SGX_ERROR_INVALID_ATTRIBUTE, + "Enclave was not authorized.", + NULL + }, + { + SGX_ERROR_ENCLAVE_FILE_ACCESS, + "Can't open enclave file.", + NULL + }, +}; + +/* Check error conditions for loading enclave */ +void print_error_message(sgx_status_t ret) +{ + size_t idx = 0; + size_t ttl = sizeof sgx_errlist/sizeof sgx_errlist[0]; + + for (idx = 0; idx < ttl; idx++) { + if(ret == sgx_errlist[idx].err) { + if(NULL != sgx_errlist[idx].sug) + printf("Info: %s\n", sgx_errlist[idx].sug); + printf("Error: %s\n", sgx_errlist[idx].msg); + break; + } + } + + if (idx == ttl) + printf("Error: Unexpected error occurred.\n"); +} + +/* Initialize the enclave: + * Step 1: retrive the launch token saved by last transaction + * Step 2: call sgx_create_enclave to initialize an enclave instance + * Step 3: save the launch token if it is updated + */ +int initialize_enclave(void) +{ + char token_path[MAX_PATH] = {'\0'}; + sgx_launch_token_t token = {0}; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + int updated = 0; + /* Step 1: retrive the launch token saved by last transaction */ + + /* try to get the token saved in $HOME */ + const char *home_dir = getpwuid(getuid())->pw_dir; + if (home_dir != NULL && + (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) { + /* compose the token path */ + strncpy(token_path, home_dir, strlen(home_dir)); + strncat(token_path, "/", strlen("/")); + strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1); + } else { + /* if token path is too long or $HOME is NULL */ + strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)); + } + + FILE *fp = fopen(token_path, "rb"); + if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) { + printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path); + } + printf("token_path: %s\n", token_path); + if (fp != NULL) { + /* read the token from saved file */ + size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp); + if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) { + /* if token is invalid, clear the buffer */ + memset(&token, 0x0, sizeof(sgx_launch_token_t)); + printf("Warning: Invalid launch token read from \"%s\".\n", token_path); + } + } + + /* Step 2: call sgx_create_enclave to initialize an enclave instance */ + /* Debug Support: set 2nd parameter to 1 */ + + ret = sgx_create_enclave($(ENCLAVENAME)_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL); + + if (ret != SGX_SUCCESS) { + print_error_message(ret); + if (fp != NULL) fclose(fp); + + return -1; + } + + /* Step 3: save the launch token if it is updated */ + + if (updated == FALSE || fp == NULL) { + /* if the token is not updated, or file handler is invalid, do not perform saving */ + if (fp != NULL) fclose(fp); + return 0; + } + + /* reopen the file with write capablity */ + fp = freopen(token_path, "wb", fp); + if (fp == NULL) return 0; + size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp); + if (write_num != sizeof(sgx_launch_token_t)) + printf("Warning: Failed to save launch token to \"%s\".\n", token_path); + fclose(fp); + + return 0; +} + +/* OCall functions */ +void ocall_$(enclaveName)_sample(const char *str) +{ + /* Proxy/Bridge will check the length and null-terminate + * the input string to prevent buffer overflow. + */ + printf("%s", str); +} + + +/* Application entry */ +int SGX_CDECL main(int argc, char *argv[]) +{ + (void)(argc); + (void)(argv); + + /* Changing dir to where the executable is.*/ + char absolutePath [MAX_PATH]; + char *ptr = NULL; + + ptr = realpath(dirname(argv[0]),absolutePath); + + if( chdir(absolutePath) != 0) + abort(); + + /* Initialize the enclave */ + if(initialize_enclave() < 0){ + + return -1; + } + + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + int ecall_return = 0; + + ret = ecall_$(enclaveName)_sample(global_eid, &ecall_return); + if (ret != SGX_SUCCESS) + abort(); + + if (ecall_return == 0) { + printf("Application ran with success\n"); + } + else + { + printf("Application failed %d \n", ecall_return); + } + + sgx_destroy_enclave(global_eid); + + return ecall_return; +} diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.h b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.h new file mode 100644 index 0000000000..a0fb5e780e --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/untrusted/sample.h @@ -0,0 +1,34 @@ +#ifndef _APP_H_ +#define _APP_H_ + +#include +#include +#include +#include + +#include "sgx_error.h" /* sgx_status_t */ +#include "sgx_eid.h" /* sgx_enclave_id_t */ + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + + +# define TOKEN_FILENAME "enclave.token" +# define $(ENCLAVENAME)_FILENAME "$(enclaveName).signed.so" + +extern sgx_enclave_id_t global_eid; /* global enclave id */ + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* !_APP_H_ */ diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXNature/Makefile b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXNature/Makefile new file mode 100644 index 0000000000..5a67151653 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXNature/Makefile @@ -0,0 +1,17 @@ +ALL_UNTRUSTED_MK=$(shell find . -name '*sgx_u.mk') +ALL_TRUSTED_MK=$(shell find . -name '*sgx_t.mk') +ALL_STATIC_MK=$(shell find . -name '*sgx_t_static.mk') + + + +.PHONY: all clean run + + +all clean: + $(foreach U_MK, $(ALL_UNTRUSTED_MK), $(MAKE) -C $(shell dirname $(U_MK)) -f $(shell basename $(U_MK)) $@;) + $(foreach T_MK, $(ALL_TRUSTED_MK), $(MAKE) -C $(shell dirname $(T_MK)) -f $(shell basename $(T_MK)) $@;) + $(foreach U_MK, $(ALL_STATIC_MK), $(MAKE) -C $(shell dirname $(U_MK)) -f $(shell basename $(U_MK)) $@;) + +run: + $(foreach U_MK, $(ALL_UNTRUSTED_MK), $(MAKE) -C $(shell dirname $(U_MK)) -f $(shell basename $(U_MK)) $@;) + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk new file mode 100644 index 0000000000..6b9dce7acc --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk @@ -0,0 +1,105 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif + +Crypto_Library_Name := sgx_tcrypto + +$(EnclaveName)_Cpp_Files := static_trusted/$(enclaveName).cpp +$(EnclaveName)_C_Files := +$(EnclaveName)_Include_Paths := -IInclude -I$(EnclaveName) -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport + +Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11 +Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $($(EnclaveName)_Include_Paths) -fno-builtin-printf -I. +$(EnclaveName)_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags) +$(EnclaveName)_Cpp_Flags := $(Common_C_Cpp_Flags) -std=c++11 -nostdinc++ -fno-builtin-printf -I. + +$(EnclaveName)_Cpp_Flags := $($(EnclaveName)_Cpp_Flags) -fno-builtin-printf + +$(EnclaveName)_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=trusted/$(enclaveName).lds + + +$(EnclaveName)_Cpp_Objects := $($(EnclaveName)_Cpp_Files:.cpp=.o) +$(EnclaveName)_C_Objects := $($(EnclaveName)_C_Files:.c=.o) + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +all: $(enclaveName).sgx.static.lib.a + +######## $(enclaveName) Objects ######## + +static_trusted/$(enclaveName)_t.h: $(SGX_EDGER8R) ./static_trusted/$(enclaveName).edl + @cd ./static_trusted && $(SGX_EDGER8R) --header-only --trusted ../static_trusted/$(enclaveName).edl --search-path ../static_trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +static_trusted/$(enclaveName)_t.o: ./trusted/$(enclaveName)_t.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +static_trusted/%.o: static_trusted/%.cpp + @$(CXX) $($(EnclaveName)_Include_Paths) $($(EnclaveName)_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +static_trusted/%.o: static_trusted/%.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(enclaveName).sgx.static.lib.a: static_trusted/$(enclaveName)_t.h $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) + ar rcs $(enclaveName).sgx.static.lib.a $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) + @echo "LINK => $@" + +clean: + @rm -f $(enclaveName).* static_trusted/$(enclaveName)_t.* $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_u.without_app.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_u.without_app.mk new file mode 100644 index 0000000000..c0d0c6778a --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_u.without_app.mk @@ -0,0 +1,71 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 + +.PHONY: all run + +all: $(UNTRUSTED_DIR)/$(enclaveName)_u.o + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(enclaveName)_u.c: $(SGX_EDGER8R) static_trusted/$(enclaveName).edl + @mkdir -p $(UNTRUSTED_DIR) + @cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../static_trusted/$(enclaveName).edl --search-path ../static_trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(enclaveName)_u.o: $(UNTRUSTED_DIR)/$(enclaveName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +.PHONY: clean + +clean: + @rm -f $(UNTRUSTED_DIR)/$(enclaveName)_u.* diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk new file mode 100644 index 0000000000..e0bd716e18 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk @@ -0,0 +1,95 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif + +Crypto_Library_Name := sgx_tcrypto + +$(EnclaveName)_C_Files := static_trusted/$(enclaveName).c +$(EnclaveName)_Include_Paths := -IInclude -I$(EnclaveName) -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport + +Flags_Just_For_C := -Wno-implicit-function-declaration -std=c11 +Common_C_Cpp_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $($(EnclaveName)_Include_Paths) -fno-builtin-printf -I. +$(EnclaveName)_C_Flags := $(Flags_Just_For_C) $(Common_C_Cpp_Flags) + +$(EnclaveName)_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=trusted/$(enclaveName).lds + +$(EnclaveName)_C_Objects := $($(EnclaveName)_C_Files:.c=.o) + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +all: $(enclaveName).sgx.static.lib.a + +######## $(enclaveName) Objects ######## + +static_trusted/$(enclaveName)_t.h: $(SGX_EDGER8R) ./static_trusted/$(enclaveName).edl + @cd ./static_trusted && $(SGX_EDGER8R) --header-only --trusted ../static_trusted/$(enclaveName).edl --search-path ../static_trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +static_trusted/$(enclaveName)_t.o: ./trusted/$(enclaveName)_t.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +static_trusted/%.o: static_trusted/%.c + @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(enclaveName).sgx.static.lib.a: static_trusted/$(enclaveName)_t.h $($(EnclaveName)_C_Objects) + ar rcs $(enclaveName).sgx.static.lib.a $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) + @echo "LINK => $@" + +clean: + @rm -f $(enclaveName).* static_trusted/$(enclaveName)_t.* $($(EnclaveName)_C_Objects) diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_u.without_app.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_u.without_app.mk new file mode 100644 index 0000000000..e8a5508339 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_u.without_app.mk @@ -0,0 +1,70 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + + +.PHONY: all run + +all: $(UNTRUSTED_DIR)/$(enclaveName)_u.o + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(enclaveName)_u.c: $(SGX_EDGER8R) static_trusted/$(enclaveName).edl + @mkdir -p $(UNTRUSTED_DIR) + @cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../static_trusted/$(enclaveName).edl --search-path ../static_trusted --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(enclaveName)_u.o: $(UNTRUSTED_DIR)/$(enclaveName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +.PHONY: clean + +clean: + @rm -f $(UNTRUSTED_DIR)/$(enclaveName)_u.* diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile new file mode 100644 index 0000000000..3defedc4c8 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile @@ -0,0 +1,8 @@ +all: + $(MAKE) -f sgx_u.mk all + $(MAKE) -f sgx_t.mk all + +clean: + $(MAKE) -f sgx_u.mk clean + $(MAKE) -f sgx_t.mk clean + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile.without_app b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile.without_app new file mode 100644 index 0000000000..28aa5c8f1e --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/common/Makefile.without_app @@ -0,0 +1,8 @@ +all: + $(MAKE) -f sgx_u.mk all + $(MAKE) -f sgx_t_static.mk all + +clean: + $(MAKE) -f sgx_u.mk clean + $(MAKE) -f sgx_t.mk clean + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.cpp b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.cpp new file mode 100644 index 0000000000..79700c42b7 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.cpp @@ -0,0 +1,7 @@ +#include "$(enclaveName)_t.h" /* print_string */ + +int ecall_$(enclaveName)_sample() +{ + return 0; +} + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.edl b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.edl new file mode 100644 index 0000000000..7af749e545 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/static_trusted/Enclave2_minimal.edl @@ -0,0 +1,11 @@ +/* $(enclaveName).edl - Top EDL file. */ + +enclave { + + untrusted { + }; + + trusted { + public int ecall_$(enclaveName)_sample(); + }; +}; diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c++/sgx_u.without_app.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c++/sgx_u.without_app.mk new file mode 100644 index 0000000000..0db9ce0ab5 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c++/sgx_u.without_app.mk @@ -0,0 +1,75 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted +SGX_EDL_FILE := $(baseName).edl + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 + +.PHONY: all run + +all: $(UNTRUSTED_DIR)/$(baseName)_u.o $(UNTRUSTED_DIR)/$(baseName).o + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(baseName)_u.c: $(SGX_EDGER8R) $(SGX_EDL_FILE) + @mkdir -p $(UNTRUSTED_DIR) && cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted $(SGX_EDL_FILE) --search-path .. --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(baseName)_u.o: $(UNTRUSTED_DIR)/$(baseName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(UNTRUSTED_DIR)/$(baseName).o: $(UNTRUSTED_DIR)/$(baseName).cpp + @$(CC) $(App_Cpp_Flags) -c $< -o $@ + @echo "CC <= $<" + +.PHONY: clean + +clean: + @rm -f $(UNTRUSTED_DIR)/$(baseName)_u.* $(UNTRUSTED_DIR)/$(baseName).o diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c/sgx_u.without_app.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c/sgx_u.without_app.mk new file mode 100644 index 0000000000..cce0dfec11 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/c/sgx_u.without_app.mk @@ -0,0 +1,75 @@ +######## SGX SDK Settings ######## +SGX_SDK ?= $(SdkPathFromPlugin) +SGX_MODE ?= SIM +SGX_ARCH ?= x64 +UNTRUSTED_DIR=untrusted +SGX_EDL_FILE := $(baseName).edl + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 + +.PHONY: all run + +all: $(UNTRUSTED_DIR)/$(baseName)_u.o $(UNTRUSTED_DIR)/$(baseName).o + +######## App Objects ######## + +$(UNTRUSTED_DIR)/$(baseName)_u.c: $(SGX_EDGER8R) $(SGX_EDL_FILE) + @mkdir -p $(UNTRUSTED_DIR) && cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted $(SGX_EDL_FILE) --search-path .. --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(UNTRUSTED_DIR)/$(baseName)_u.o: $(UNTRUSTED_DIR)/$(baseName)_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(UNTRUSTED_DIR)/$(baseName).o: $(UNTRUSTED_DIR)/$(baseName).c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +.PHONY: clean + +clean: + @rm -f $(UNTRUSTED_DIR)/$(baseName)_u.* $(UNTRUSTED_DIR)/$(baseName).o diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/common/Makefile b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/common/Makefile new file mode 100644 index 0000000000..af0747ec6d --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/makefiles/common/Makefile @@ -0,0 +1,6 @@ +all: + $(MAKE) -f sgx_u.mk all + +clean: + $(MAKE) -f sgx_u.mk clean + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/untrusted/untrusted_module.cpp b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/untrusted/untrusted_module.cpp new file mode 100644 index 0000000000..f4d2acdc38 --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXUntrustedModule/untrusted/untrusted_module.cpp @@ -0,0 +1 @@ +#include "$(baseName)_u.h" diff --git a/Linux_SGXEclipsePlugin/build_directory/sites/site.xml b/Linux_SGXEclipsePlugin/build_directory/sites/site.xml new file mode 100644 index 0000000000..a0a475351b --- /dev/null +++ b/Linux_SGXEclipsePlugin/build_directory/sites/site.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + This website hosts an evaluation version of the Eclipse Plug-in developed for Secure Guard Extensions Application development for Linux platforms. + + + + + + diff --git a/Linux_SGXEclipsePlugin/clean.sh b/Linux_SGXEclipsePlugin/clean.sh new file mode 100755 index 0000000000..0b3edca3d7 --- /dev/null +++ b/Linux_SGXEclipsePlugin/clean.sh @@ -0,0 +1,20 @@ +# clean input directories to make sure there's nothing left from previous run + +rm -rfv ./build_directory/features/com.intel.sgx.build.driver +rm -fv build_directory/*.properties +rm -fv build_directory/*.xml +rm -fv build_directory/plugins/com.intel.sgx/build.xml +rm -fv build_directory/plugins/com.intel.sgx.userguide/build.xml +rm -rfv build_directory/plugins/com.intel.sgx/bin +rm -rfv build_directory/plugins/com.intel.sgx.userguide/bin +rm -rfv build_directory/plugins/com.intel.sgx.source_1.0.0.* +rm -rfv build_directory/features/com.intel.sgx.source +rm -fv build_directory/features/com.intel.sgx.feature/build.xml +rm -fv build_directory/features/com.intel.sgx.feature/*.zip +rm -rfv build_directory/nestedJars +rm -rfv build_directory/updatesite/sgx-eclipse-plugin +find . -name "*.zip" | xargs rm -rfv +find . -name "javaCompiler*" | xargs rm -rfv +find . -name "@*" | xargs rm -rfv +find build_directory -maxdepth 1 -mindepth 1 | grep -v "features" | grep -v "plugins" | grep -v "sites" | grep -v "updatesite" | xargs rm -frv + diff --git a/Linux_SGXEclipsePlugin/readme.txt b/Linux_SGXEclipsePlugin/readme.txt new file mode 100644 index 0000000000..53b7c6241a --- /dev/null +++ b/Linux_SGXEclipsePlugin/readme.txt @@ -0,0 +1,21 @@ +The eclipse plugin build from commandline requires the following variables to be set + +$ECLIPSE_HOME - Path to eclipse home. In order to build the plugin eclipse needs to be installed. +$RELEASE_ID - The release id for the plugin. + +The plugin has been tested with the following Eclipse ADT version + +Build: v22.3.0-887826 + +The following plugins are pre-requisites to be installed in Eclipse before trying to build the plugin. + +1. Eclipse IDE for C/C++ Developers 4.5.1.20150917-1200 (tested_version) +2. Eclipse PDE Plug-in Developer Resources 3.11.1.v20150904-0345 (tested_version) + + +If the sgx eclipse plugin is already installed to eclipse and to build and install a newer version, uninstall the old version and start eclipse with the -clean option. +Then try to build the new version of the plugin and install it in eclipse. + +http://wiki.eclipse.org/FAQ_How_do_I_remove_a_plug-in%3F + +Once the build script is run, the folder build_directory/updatesite/sgx-eclipse-plugin contains the update site. This is the path that needs to be provided to the eclipse while doing installation. diff --git a/Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy b/Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy new file mode 100644 index 0000000000..99c0aa1168 --- /dev/null +++ b/Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy @@ -0,0 +1,34 @@ +import groovy.xml.MarkupBuilder +import groovy.xml.StreamingMarkupBuilder + + +println "Hello, Script!!!" + + + +def fragments = new XmlParser(false, true).parseText("") + +def resultFile = new File('/home/mlutescu/0_WORK/SGXUserGuide/developer_guide_eclipse_plugin/Output/WebHelp/Content/test.html') + +if (resultFile.exists()) { + resultFile.delete() +} + +def fltoc = new File('/home/mlutescu/0_WORK/SGXUserGuide/developer_guide_eclipse_plugin/Project/TOCs/Master.fltoc') +def toc = (new XmlParser()).parse(fltoc) +def contentDir = new File(fltoc, '../../../').canonicalPath + +def PrintWriter pw = new PrintWriter(new FileWriter(resultFile)) + + +toc.TocEntry['**'].each { tocEntry -> + def htmlFile = new File(contentDir, "${tocEntry.'@Link'}") + + + println htmlFile.text +} + + + +println groovy.xml.XmlUtil.serialize( fragments) + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..8e9a40f00d --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include buildenv.mk +.PHONY: all psw sdk clean rebuild sdk_install_pkg psw_install_pkg + +all: sdk psw + +psw: sdk + $(MAKE) -C psw/ + +sdk: + $(MAKE) -C sdk/ + +# Generate SE SDK Install package +sdk_install_pkg: sdk + ./linux/installer/bin/build-installpkg.sh sdk + +psw_install_pkg: psw + ./linux/installer/bin/build-installpkg.sh psw + +clean: + @$(MAKE) -C sdk/ clean + @$(MAKE) -C psw/ clean + @$(RM) -r $(ROOT_DIR)/build + @$(RM) -r linux/installer/bin/sgx_linux*.bin + +rebuild: clean all diff --git a/SampleCode/LocalAttestation/.cproject b/SampleCode/LocalAttestation/.cproject new file mode 100644 index 0000000000..b9fabf3067 --- /dev/null +++ b/SampleCode/LocalAttestation/.cproject @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCode/LocalAttestation/.project b/SampleCode/LocalAttestation/.project new file mode 100644 index 0000000000..f1af7d8591 --- /dev/null +++ b/SampleCode/LocalAttestation/.project @@ -0,0 +1,28 @@ + + + SimpleEnclave + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + com.intel.sgx.sgxnature + + diff --git a/SampleCode/LocalAttestation/App/App.cpp b/SampleCode/LocalAttestation/App/App.cpp new file mode 100644 index 0000000000..151d954992 --- /dev/null +++ b/SampleCode/LocalAttestation/App/App.cpp @@ -0,0 +1,446 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// App.cpp : Defines the entry point for the console application. +#include +#include +#include "../Enclave1/Enclave1_u.h" +#include "../Enclave2/Enclave2_u.h" +#include "../Enclave3/Enclave3_u.h" +#include "sgx_eid.h" +#include "sgx_urts.h" + +#define UNUSED(val) (void)(val) +#define TCHAR char +#define _TCHAR char +#define _T(str) str +#define scanf_s scanf +#define _tmain main + +extern std::mapg_enclave_id_map; + + +sgx_enclave_id_t e1_enclave_id = 0; +sgx_enclave_id_t e2_enclave_id = 0; +sgx_enclave_id_t e3_enclave_id = 0; + +#define ENCLAVE1_PATH "libenclave1.so" +#define ENCLAVE2_PATH "libenclave2.so" +#define ENCLAVE3_PATH "libenclave3.so" + +void waitForKeyPress() +{ + uint8_t ch; + printf("\n\nHit a key....\n"); + scanf_s("%c", &ch); +} + +uint32_t load_enclaves() +{ + uint32_t enclave_temp_no; + int ret, launch_token_updated; + sgx_launch_token_t launch_token; + + enclave_temp_no = 0; + + ret = sgx_create_enclave(ENCLAVE1_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e1_enclave_id, NULL); + if (ret != SGX_SUCCESS) { + return ret; + } + + enclave_temp_no++; + g_enclave_id_map.insert(std::pair(e1_enclave_id, enclave_temp_no)); + + ret = sgx_create_enclave(ENCLAVE2_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e2_enclave_id, NULL); + if (ret != SGX_SUCCESS) { + return ret; + } + + enclave_temp_no++; + g_enclave_id_map.insert(std::pair(e2_enclave_id, enclave_temp_no)); + + ret = sgx_create_enclave(ENCLAVE3_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e3_enclave_id, NULL); + if (ret != SGX_SUCCESS) { + return ret; + } + + enclave_temp_no++; + g_enclave_id_map.insert(std::pair(e3_enclave_id, enclave_temp_no)); + + + + return SGX_SUCCESS; +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + uint32_t ret_status; + sgx_status_t status; + + UNUSED(argc); + UNUSED(argv); + + if(load_enclaves() != SGX_SUCCESS) + { + printf("\nLoad Enclave Failure"); + } + + printf("\nAvaliable Enclaves"); + printf("\nEnclave1 - EnclaveID %llx",e1_enclave_id); + printf("\nEnclave2 - EnclaveID %llx",e2_enclave_id); + printf("\nEnclave3 - EnclaveID %llx",e3_enclave_id); + + do + { + //Test Create session between Enclave1(Source) and Enclave2(Destination) + status = Enclave1_test_create_session(e1_enclave_id, &ret_status, e1_enclave_id, e2_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_create_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nSecure Channel Establishment between Source (E1) and Destination (E2) Enclaves successful !!!"); + } + else + { + printf("\nSession establishment and key exchange failure between Source (E1) and Destination (E2): Error code is %x", ret_status); + break; + } + } + + //Test Enclave to Enclave call between Enclave1(Source) and Enclave2(Destination) + status = Enclave1_test_enclave_to_enclave_call(e1_enclave_id, &ret_status, e1_enclave_id, e2_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_enclave_to_enclave_call Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nEnclave to Enclave Call between Source (E1) and Destination (E2) Enclaves successful !!!"); + } + else + { + printf("\n\nEnclave to Enclave Call failure between Source (E1) and Destination (E2): Error code is %x", ret_status); + break; + } + } + //Test message exchange between Enclave1(Source) and Enclave2(Destination) + status = Enclave1_test_message_exchange(e1_enclave_id, &ret_status, e1_enclave_id, e2_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_message_exchange Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nMessage Exchange between Source (E1) and Destination (E2) Enclaves successful !!!"); + } + else + { + printf("\n\nMessage Exchange failure between Source (E1) and Destination (E2): Error code is %x", ret_status); + break; + } + } + //Test Create session between Enclave1(Source) and Enclave3(Destination) + status = Enclave1_test_create_session(e1_enclave_id, &ret_status, e1_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_create_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nSecure Channel Establishment between Source (E1) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nSession establishment and key exchange failure between Source (E1) and Destination (E3): Error code is %x", ret_status); + break; + } + } + //Test Enclave to Enclave call between Enclave1(Source) and Enclave3(Destination) + status = Enclave1_test_enclave_to_enclave_call(e1_enclave_id, &ret_status, e1_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_enclave_to_enclave_call Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nEnclave to Enclave Call between Source (E1) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nEnclave to Enclave Call failure between Source (E1) and Destination (E3): Error code is %x", ret_status); + break; + } + } + //Test message exchange between Enclave1(Source) and Enclave3(Destination) + status = Enclave1_test_message_exchange(e1_enclave_id, &ret_status, e1_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_message_exchange Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nMessage Exchange between Source (E1) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nMessage Exchange failure between Source (E1) and Destination (E3): Error code is %x", ret_status); + break; + } + } + + //Test Create session between Enclave2(Source) and Enclave3(Destination) + status = Enclave2_test_create_session(e2_enclave_id, &ret_status, e2_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave2_test_create_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nSecure Channel Establishment between Source (E2) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nSession establishment and key exchange failure between Source (E2) and Destination (E3): Error code is %x", ret_status); + break; + } + } + //Test Enclave to Enclave call between Enclave2(Source) and Enclave3(Destination) + status = Enclave2_test_enclave_to_enclave_call(e2_enclave_id, &ret_status, e2_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave2_test_enclave_to_enclave_call Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nEnclave to Enclave Call between Source (E2) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nEnclave to Enclave Call failure between Source (E2) and Destination (E3): Error code is %x", ret_status); + break; + } + } + //Test message exchange between Enclave2(Source) and Enclave3(Destination) + status = Enclave2_test_message_exchange(e2_enclave_id, &ret_status, e2_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave2_test_message_exchange Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nMessage Exchange between Source (E2) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nMessage Exchange failure between Source (E2) and Destination (E3): Error code is %x", ret_status); + break; + } + } + + //Test Create session between Enclave3(Source) and Enclave1(Destination) + status = Enclave3_test_create_session(e3_enclave_id, &ret_status, e3_enclave_id, e1_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave3_test_create_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nSecure Channel Establishment between Source (E3) and Destination (E1) Enclaves successful !!!"); + } + else + { + printf("\n\nSession establishment and key exchange failure between Source (E3) and Destination (E1): Error code is %x", ret_status); + break; + } + } + //Test Enclave to Enclave call between Enclave3(Source) and Enclave1(Destination) + status = Enclave3_test_enclave_to_enclave_call(e3_enclave_id, &ret_status, e3_enclave_id, e1_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave3_test_enclave_to_enclave_call Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nEnclave to Enclave Call between Source (E3) and Destination (E1) Enclaves successful !!!"); + } + else + { + printf("\n\nEnclave to Enclave Call failure between Source (E3) and Destination (E1): Error code is %x", ret_status); + break; + } + } + //Test message exchange between Enclave3(Source) and Enclave1(Destination) + status = Enclave3_test_message_exchange(e3_enclave_id, &ret_status, e3_enclave_id, e1_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave3_test_message_exchange Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nMessage Exchange between Source (E3) and Destination (E1) Enclaves successful !!!"); + } + else + { + printf("\n\nMessage Exchange failure between Source (E3) and Destination (E1): Error code is %x", ret_status); + break; + } + } + + + //Test Closing Session between Enclave1(Source) and Enclave2(Destination) + status = Enclave1_test_close_session(e1_enclave_id, &ret_status, e1_enclave_id, e2_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_close_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nClose Session between Source (E1) and Destination (E2) Enclaves successful !!!"); + } + else + { + printf("\n\nClose session failure between Source (E1) and Destination (E2): Error code is %x", ret_status); + break; + } + } + //Test Closing Session between Enclave1(Source) and Enclave3(Destination) + status = Enclave1_test_close_session(e1_enclave_id, &ret_status, e1_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave1_test_close_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nClose Session between Source (E1) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nClose session failure between Source (E1) and Destination (E3): Error code is %x", ret_status); + break; + } + } + //Test Closing Session between Enclave2(Source) and Enclave3(Destination) + status = Enclave2_test_close_session(e2_enclave_id, &ret_status, e2_enclave_id, e3_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave2_test_close_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nClose Session between Source (E2) and Destination (E3) Enclaves successful !!!"); + } + else + { + printf("\n\nClose session failure between Source (E2) and Destination (E3): Error code is %x", ret_status); + break; + } + } + //Test Closing Session between Enclave3(Source) and Enclave1(Destination) + status = Enclave3_test_close_session(e3_enclave_id, &ret_status, e3_enclave_id, e1_enclave_id); + if (status!=SGX_SUCCESS) + { + printf("Enclave3_test_close_session Ecall failed: Error code is %x", status); + break; + } + else + { + if(ret_status==0) + { + printf("\n\nClose Session between Source (E3) and Destination (E1) Enclaves successful !!!"); + } + else + { + printf("\n\nClose session failure between Source (E3) and Destination (E1): Error code is %x", ret_status); + break; + } + } + +#pragma warning (push) +#pragma warning (disable : 4127) + }while(0); +#pragma warning (pop) + + sgx_destroy_enclave(e1_enclave_id); + sgx_destroy_enclave(e2_enclave_id); + sgx_destroy_enclave(e3_enclave_id); + + waitForKeyPress(); + + return 0; +} diff --git a/SampleCode/LocalAttestation/Enclave1/Enclave1.config.xml b/SampleCode/LocalAttestation/Enclave1/Enclave1.config.xml new file mode 100644 index 0000000000..436860dd50 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave1/Enclave1.config.xml @@ -0,0 +1,11 @@ + + 0 + 0 + 0x40000 + 0x100000 + 1 + 1 + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/LocalAttestation/Enclave1/Enclave1.cpp b/SampleCode/LocalAttestation/Enclave1/Enclave1.cpp new file mode 100644 index 0000000000..c662516d1d --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave1/Enclave1.cpp @@ -0,0 +1,373 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// Enclave1.cpp : Defines the exported functions for the .so application +#include "sgx_eid.h" +#include "Enclave1_t.h" +#include "EnclaveMessageExchange.h" +#include "error_codes.h" +#include "Utility_E1.h" +#include "sgx_thread.h" +#include "sgx_dh.h" +#include + +#define UNUSED(val) (void)(val) + +std::mapg_src_session_info_map; + +static uint32_t e1_foo1_wrapper(ms_in_msg_exchange_t *ms, size_t param_lenth, char** resp_buffer, size_t* resp_length); + +//Function pointer table containing the list of functions that the enclave exposes +const struct { + size_t num_funcs; + const void* table[1]; +} func_table = { + 1, + { + (const void*)e1_foo1_wrapper, + } +}; + +//Makes use of the sample code function to establish a secure channel with the destination enclave (Test Vector) +uint32_t test_create_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + dh_session_t dest_session_info; + + //Core reference code function for creating a session + ke_status = create_session(src_enclave_id, dest_enclave_id, &dest_session_info); + + //Insert the session information into the map under the corresponding destination enclave id + if(ke_status == SUCCESS) + { + g_src_session_info_map.insert(std::pair(dest_enclave_id, dest_session_info)); + } + memset(&dest_session_info, 0, sizeof(dh_session_t)); + return ke_status; +} + +//Makes use of the sample code function to do an enclave to enclave call (Test Vector) +uint32_t test_enclave_to_enclave_call(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + uint32_t var1,var2; + uint32_t target_fn_id, msg_type; + char* marshalled_inp_buff; + size_t marshalled_inp_buff_len; + char* out_buff; + size_t out_buff_len; + dh_session_t *dest_session_info; + size_t max_out_buff_size; + char* retval; + + var1 = 0x4; + var2 = 0x5; + target_fn_id = 0; + msg_type = ENCLAVE_TO_ENCLAVE_CALL; + max_out_buff_size = 50; + + //Marshals the input parameters for calling function foo1 in Enclave2 into a input buffer + ke_status = marshal_input_parameters_e2_foo1(target_fn_id, msg_type, var1, var2, &marshalled_inp_buff, &marshalled_inp_buff_len); + if(ke_status != SUCCESS) + { + return ke_status; + } + + //Search the map for the session information associated with the destination enclave id of Enclave2 passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = &it->second; + } + else + { + SAFE_FREE(marshalled_inp_buff); + return INVALID_SESSION; + } + + //Core Reference Code function + ke_status = send_request_receive_response(src_enclave_id, dest_enclave_id, dest_session_info, marshalled_inp_buff, + marshalled_inp_buff_len, max_out_buff_size, &out_buff, &out_buff_len); + + + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + //Un-marshal the return value and output parameters from foo1 of Enclave 2 + ke_status = unmarshal_retval_and_output_parameters_e2_foo1(out_buff, &retval); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + SAFE_FREE(retval); + return SUCCESS; +} + +//Makes use of the sample code function to do a generic secret message exchange (Test Vector) +uint32_t test_message_exchange(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + uint32_t target_fn_id, msg_type; + char* marshalled_inp_buff; + size_t marshalled_inp_buff_len; + char* out_buff; + size_t out_buff_len; + dh_session_t *dest_session_info; + size_t max_out_buff_size; + char* secret_response; + uint32_t secret_data; + + target_fn_id = 0; + msg_type = MESSAGE_EXCHANGE; + max_out_buff_size = 50; + secret_data = 0x12345678; //Secret Data here is shown only for purpose of demonstration. + + //Marshals the secret data into a buffer + ke_status = marshal_message_exchange_request(target_fn_id, msg_type, secret_data, &marshalled_inp_buff, &marshalled_inp_buff_len); + if(ke_status != SUCCESS) + { + return ke_status; + } + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = &it->second; + } + else + { + SAFE_FREE(marshalled_inp_buff); + return INVALID_SESSION; + } + + //Core Reference Code function + ke_status = send_request_receive_response(src_enclave_id, dest_enclave_id, dest_session_info, marshalled_inp_buff, + marshalled_inp_buff_len, max_out_buff_size, &out_buff, &out_buff_len); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + //Un-marshal the secret response data + ke_status = umarshal_message_exchange_response(out_buff, &secret_response); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + SAFE_FREE(secret_response); + return SUCCESS; +} + + +//Makes use of the sample code function to close a current session +uint32_t test_close_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + dh_session_t dest_session_info; + ATTESTATION_STATUS ke_status = SUCCESS; + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = it->second; + } + else + { + return NULL; + } + + //Core reference code function for closing a session + ke_status = close_session(src_enclave_id, dest_enclave_id); + + //Erase the session information associated with the destination enclave id + g_src_session_info_map.erase(dest_enclave_id); + return ke_status; +} + +//Function that is used to verify the trust of the other enclave +//Each enclave can have its own way verifying the peer enclave identity +extern "C" uint32_t verify_peer_enclave_trust(sgx_dh_session_enclave_identity_t* peer_enclave_identity) +{ + if(!peer_enclave_identity) + { + return INVALID_PARAMETER_ERROR; + } + if(peer_enclave_identity->isv_prod_id != 0 || !(peer_enclave_identity->attributes.flags & SGX_FLAGS_INITTED)) + // || peer_enclave_identity->attributes.xfrm !=3)// || peer_enclave_identity->mr_signer != xx //TODO: To be hardcoded with values to check + { + return ENCLAVE_TRUST_ERROR; + } + else + { + return SUCCESS; + } +} + + +//Dispatcher function that calls the approriate enclave function based on the function id +//Each enclave can have its own way of dispatching the calls from other enclave +extern "C" uint32_t enclave_to_enclave_call_dispatcher(char* decrypted_data, + size_t decrypted_data_length, + char** resp_buffer, + size_t* resp_length) +{ + ms_in_msg_exchange_t *ms; + uint32_t (*fn1)(ms_in_msg_exchange_t *ms, size_t, char**, size_t*); + if(!decrypted_data || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + ms = (ms_in_msg_exchange_t *)decrypted_data; + if(ms->target_fn_id >= func_table.num_funcs) + { + return INVALID_PARAMETER_ERROR; + } + fn1 = (uint32_t (*)(ms_in_msg_exchange_t*, size_t, char**, size_t*))func_table.table[ms->target_fn_id]; + return fn1(ms, decrypted_data_length, resp_buffer, resp_length); +} + +//Operates on the input secret and generates the output secret +uint32_t get_message_exchange_response(uint32_t inp_secret_data) +{ + uint32_t secret_response; + + //User should use more complex encryption method to protect their secret, below is just a simple example + secret_response = inp_secret_data & 0x11111111; + + return secret_response; + +} + +//Generates the response from the request message +extern "C" uint32_t message_exchange_response_generator(char* decrypted_data, + char** resp_buffer, + size_t* resp_length) +{ + ms_in_msg_exchange_t *ms; + uint32_t inp_secret_data; + uint32_t out_secret_data; + if(!decrypted_data || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + ms = (ms_in_msg_exchange_t *)decrypted_data; + + if(umarshal_message_exchange_request(&inp_secret_data,ms) != SUCCESS) + return ATTESTATION_ERROR; + + out_secret_data = get_message_exchange_response(inp_secret_data); + + if(marshal_message_exchange_response(resp_buffer, resp_length, out_secret_data) != SUCCESS) + return MALLOC_ERROR; + + return SUCCESS; + +} + + +static uint32_t e1_foo1(external_param_struct_t *p_struct_var) +{ + if(!p_struct_var) + { + return INVALID_PARAMETER_ERROR; + } + (p_struct_var->var1)++; + (p_struct_var->var2)++; + (p_struct_var->p_internal_struct->ivar1)++; + (p_struct_var->p_internal_struct->ivar2)++; + + return (p_struct_var->var1 + p_struct_var->var2 + p_struct_var->p_internal_struct->ivar1 + p_struct_var->p_internal_struct->ivar2); +} + +//Function which is executed on request from the source enclave +static uint32_t e1_foo1_wrapper(ms_in_msg_exchange_t *ms, + size_t param_lenth, + char** resp_buffer, + size_t* resp_length) +{ + UNUSED(param_lenth); + + uint32_t ret; + size_t len_data, len_ptr_data; + external_param_struct_t *p_struct_var; + internal_param_struct_t internal_struct_var; + + if(!ms || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + + p_struct_var = (external_param_struct_t*)malloc(sizeof(external_param_struct_t)); + if(!p_struct_var) + return MALLOC_ERROR; + + p_struct_var->p_internal_struct = &internal_struct_var; + + if(unmarshal_input_parameters_e1_foo1(p_struct_var, ms) != SUCCESS)//can use the stack + { + SAFE_FREE(p_struct_var); + return ATTESTATION_ERROR; + } + + ret = e1_foo1(p_struct_var); + + len_data = sizeof(external_param_struct_t) - sizeof(p_struct_var->p_internal_struct); + len_ptr_data = sizeof(internal_struct_var); + + if(marshal_retval_and_output_parameters_e1_foo1(resp_buffer, resp_length, ret, p_struct_var, len_data, len_ptr_data) != SUCCESS) + { + SAFE_FREE(p_struct_var); + return MALLOC_ERROR; + } + SAFE_FREE(p_struct_var); + return SUCCESS; +} + diff --git a/SampleCode/LocalAttestation/Enclave1/Enclave1.edl b/SampleCode/LocalAttestation/Enclave1/Enclave1.edl new file mode 100644 index 0000000000..378965cd11 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave1/Enclave1.edl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave { + include "sgx_eid.h" + from "../LocalAttestationCode/LocalAttestationCode.edl" import *; + from "sgx_tstdc.edl" import *; + trusted{ + public uint32_t test_create_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_enclave_to_enclave_call(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_message_exchange(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_close_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + }; + +}; diff --git a/SampleCode/LocalAttestation/Enclave1/Enclave1_private.pem b/SampleCode/LocalAttestation/Enclave1/Enclave1_private.pem new file mode 100644 index 0000000000..75d7f88cb9 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave1/Enclave1_private.pem @@ -0,0 +1,39 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIG4wIBAAKCAYEAuJh4w/KzndQhzEqwH6Ut/3BmOom5CN117KT1/cemEbDLPhn0 +c5yjAfe4NL1qtGqz0RTK9X9BBSi89b6BrsM9S6c2cUJaeYAPrAtJ+IuzN/5BAmmf +RXbPccETd7rHvDdQ9KBRjCipTx+H0D5nOB76S5PZPVrduwrCmSqVFmLNVWWfPYQx +YewbJ2QfEfioICZFYR0Jou38mJqDTl+CH0gLAuQ4n1kdpQ3VGymzt3oUiPzf5ImJ +oZh5HjarRRiWV+cyNyXYJTnx0dOtFQDgd8HhniagbRB0ZOIt6599JjMkWGkVP0Ni +U/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PuvpTQ8/4ZGMw7FCZe +bakhnwRbw36FlLwRG35wCF6nQO1XFBKRGto15ivfTyDvMpJBdtNpET5NwT/ifDF3 +OWS7t6TGhtcfnvBad5S1AgGoAq+q/huFiBGpDbxJ+1xh0lNL5Z8nVypvPWomNpde +rpLuwRPEIb+GBfQ9Hp5AjRXVsPjKnkHsnl2NAoHBAJMoZX1DJTklw/72Qhzd89Qg +OOgK5bv94FUBae8Afxixj7YmOdN/xbaQ8VHS/H29/tZgGumu9UeS1n1L+roLMVXJ +cQPy50dqxTCXavhsYIaKp48diqc8G8YlImFKxSmDWJYO1AuJpbzVgLklSlt2LoOw +gbJOQIxtc8HN48UOImfz6ij0M3cNHlsVy24GYdTLAiEKwStw9GWse8pjTDGCBtXx +E/WBI3C3wuf5VMtuqDtlgYoU3M9fNNXgGPQMlLQmTwKBwQCOuTdpZZW708AWLEAW +h/Ju1e8F0nYK9GZswfPxaYsszb2HwbGM5mhrEw4JPiBklJlg/IpBATmLl/R/DeCi +qWYQiCdixD7zxhZqAufXqa5jKAtnqaAFlG+AnjoNYbYR5s6ZcpTfa0ohttZPN5tg +1DPWKpb9dk97mH0lGIRZ5L+/Sub6YyNWq8VXH8dUElkFYRtefYankuvhjN1Dv2+P +cZ9+RsQkZOnJt0nWDS1r1QQD+Ci/FCsIuTkgpdxpgUhpk7MCgcEAkfkmaBDb7DG2 +Kc39R6ZZuPnV10w+WOpph7ugwcguG/E0wGq+jFWv6HFckCPeHT4BNtOk8Dem/kPp +teF51eAuFWEefj2tScvlSBBPcnla+WzMWXrlxVnajTt73w+oT2Ql//WhgREpsNfx +SvU80YPVu4GJfl+hhxBifLx+0FM20OESW93qFRc3p040bNrDY9JIZuly/y5zaiBa +mRZF9H8P+x3Lu5AJpdXQEOMZ/XJ/xkoWWjbTojkmgOmmZSMLd5Te +-----END RSA PRIVATE KEY----- diff --git a/SampleCode/LocalAttestation/Enclave1/Utility_E1.cpp b/SampleCode/LocalAttestation/Enclave1/Utility_E1.cpp new file mode 100644 index 0000000000..9c2247b716 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave1/Utility_E1.cpp @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sgx_eid.h" +#include "EnclaveMessageExchange.h" +#include "error_codes.h" +#include "Utility_E1.h" +#include "stdlib.h" +#include "string.h" + +uint32_t marshal_input_parameters_e2_foo1(uint32_t target_fn_id, uint32_t msg_type, uint32_t var1, uint32_t var2, char** marshalled_buff, size_t* marshalled_buff_len) +{ + ms_in_msg_exchange_t *ms; + size_t param_len, ms_len; + char *temp_buff; + + param_len = sizeof(var1)+sizeof(var2); + temp_buff = (char*)malloc(param_len); + if(!temp_buff) + return MALLOC_ERROR; + + memcpy(temp_buff,&var1,sizeof(var1)); + memcpy(temp_buff+sizeof(var1),&var2,sizeof(var2)); + ms_len = sizeof(ms_in_msg_exchange_t) + param_len; + ms = (ms_in_msg_exchange_t *)malloc(ms_len); + if(!ms) + { + SAFE_FREE(temp_buff); + return MALLOC_ERROR; + } + ms->msg_type = msg_type; + ms->target_fn_id = target_fn_id; + ms->inparam_buff_len = (uint32_t)param_len; + memcpy(&ms->inparam_buff, temp_buff, param_len); + *marshalled_buff = (char*)ms; + *marshalled_buff_len = ms_len; + SAFE_FREE(temp_buff); + return SUCCESS; +} + +uint32_t unmarshal_retval_and_output_parameters_e2_foo1(char* out_buff, char** retval) +{ + size_t retval_len; + ms_out_msg_exchange_t *ms; + if(!out_buff) + return INVALID_PARAMETER_ERROR; + ms = (ms_out_msg_exchange_t *)out_buff; + retval_len = ms->retval_len; + *retval = (char*)malloc(retval_len); + if(!*retval) + return MALLOC_ERROR; + + memcpy(*retval, ms->ret_outparam_buff, retval_len); + return SUCCESS; +} + +uint32_t unmarshal_input_parameters_e1_foo1(external_param_struct_t *pstruct, ms_in_msg_exchange_t* ms) +{ + char* buff; + size_t len; + if(!pstruct || !ms) + return INVALID_PARAMETER_ERROR; + + buff = ms->inparam_buff; + len = ms->inparam_buff_len; + if(len != (sizeof(pstruct->var1)+sizeof(pstruct->var2)+sizeof(pstruct->p_internal_struct->ivar1)+sizeof(pstruct->p_internal_struct->ivar2))) + return ATTESTATION_ERROR; + + memcpy(&pstruct->var1, buff, sizeof(pstruct->var1)); + memcpy(&pstruct->var2, buff + sizeof(pstruct->var1), sizeof(pstruct->var2)); + memcpy(&pstruct->p_internal_struct->ivar1, buff+(sizeof(pstruct->var1)+sizeof(pstruct->var2)), sizeof(pstruct->p_internal_struct->ivar1)); + memcpy(&pstruct->p_internal_struct->ivar2, buff+(sizeof(pstruct->var1)+sizeof(pstruct->var2)+sizeof(pstruct->p_internal_struct->ivar1)), sizeof(pstruct->p_internal_struct->ivar2)); + + return SUCCESS; +} + +uint32_t marshal_retval_and_output_parameters_e1_foo1(char** resp_buffer, size_t* resp_length, uint32_t retval, external_param_struct_t *p_struct_var, size_t len_data, size_t len_ptr_data) +{ + ms_out_msg_exchange_t *ms; + size_t param_len, ms_len, ret_param_len;; + char *temp_buff; + int* addr; + char* struct_data; + size_t retval_len; + + if(!resp_length || !p_struct_var) + return INVALID_PARAMETER_ERROR; + + retval_len = sizeof(retval); + struct_data = (char*)p_struct_var; + param_len = len_data + len_ptr_data; + ret_param_len = param_len + retval_len; + addr = *(int **)(struct_data + len_data); + temp_buff = (char*)malloc(ret_param_len); + if(!temp_buff) + return MALLOC_ERROR; + + memcpy(temp_buff, &retval, sizeof(retval)); + memcpy(temp_buff + sizeof(retval), struct_data, len_data); + memcpy(temp_buff + sizeof(retval) + len_data, addr, len_ptr_data); + ms_len = sizeof(ms_out_msg_exchange_t) + ret_param_len; + ms = (ms_out_msg_exchange_t *)malloc(ms_len); + if(!ms) + { + SAFE_FREE(temp_buff); + return MALLOC_ERROR; + } + ms->retval_len = (uint32_t)retval_len; + ms->ret_outparam_buff_len = (uint32_t)ret_param_len; + memcpy(&ms->ret_outparam_buff, temp_buff, ret_param_len); + *resp_buffer = (char*)ms; + *resp_length = ms_len; + + SAFE_FREE(temp_buff); + return SUCCESS; +} + +uint32_t marshal_message_exchange_request(uint32_t target_fn_id, uint32_t msg_type, uint32_t secret_data, char** marshalled_buff, size_t* marshalled_buff_len) +{ + ms_in_msg_exchange_t *ms; + size_t secret_data_len, ms_len; + if(!marshalled_buff_len) + return INVALID_PARAMETER_ERROR; + secret_data_len = sizeof(secret_data); + ms_len = sizeof(ms_in_msg_exchange_t) + secret_data_len; + ms = (ms_in_msg_exchange_t *)malloc(ms_len); + if(!ms) + return MALLOC_ERROR; + + ms->msg_type = msg_type; + ms->target_fn_id = target_fn_id; + ms->inparam_buff_len = (uint32_t)secret_data_len; + memcpy(&ms->inparam_buff, &secret_data, secret_data_len); + *marshalled_buff = (char*)ms; + *marshalled_buff_len = ms_len; + return SUCCESS; +} + +uint32_t umarshal_message_exchange_request(uint32_t* inp_secret_data, ms_in_msg_exchange_t* ms) +{ + char* buff; + size_t len; + if(!inp_secret_data || !ms) + return INVALID_PARAMETER_ERROR; + buff = ms->inparam_buff; + len = ms->inparam_buff_len; + if(len != sizeof(uint32_t)) + return ATTESTATION_ERROR; + + memcpy(inp_secret_data, buff, sizeof(uint32_t)); + + return SUCCESS; +} + +uint32_t marshal_message_exchange_response(char** resp_buffer, size_t* resp_length, uint32_t secret_response) +{ + ms_out_msg_exchange_t *ms; + size_t secret_response_len, ms_len; + size_t retval_len, ret_param_len; + if(!resp_length) + return INVALID_PARAMETER_ERROR; + secret_response_len = sizeof(secret_response); + retval_len = secret_response_len; + ret_param_len = secret_response_len; + ms_len = sizeof(ms_out_msg_exchange_t) + ret_param_len; + ms = (ms_out_msg_exchange_t *)malloc(ms_len); + if(!ms) + return MALLOC_ERROR; + + ms->retval_len = (uint32_t)retval_len; + ms->ret_outparam_buff_len = (uint32_t)ret_param_len; + memcpy(&ms->ret_outparam_buff, &secret_response, secret_response_len); + *resp_buffer = (char*)ms; + *resp_length = ms_len; + return SUCCESS; +} + +uint32_t umarshal_message_exchange_response(char* out_buff, char** secret_response) +{ + size_t retval_len; + ms_out_msg_exchange_t *ms; + if(!out_buff) + return INVALID_PARAMETER_ERROR; + ms = (ms_out_msg_exchange_t *)out_buff; + retval_len = ms->retval_len; + *secret_response = (char*)malloc(retval_len); + if(!*secret_response) + { + return MALLOC_ERROR; + } + memcpy(*secret_response, ms->ret_outparam_buff, retval_len); + return SUCCESS; +} + diff --git a/SampleCode/LocalAttestation/Enclave1/Utility_E1.h b/SampleCode/LocalAttestation/Enclave1/Utility_E1.h new file mode 100644 index 0000000000..7af49b6814 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave1/Utility_E1.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef UTILITY_E1_H__ +#define UTILITY_E1_H__ + +#include "stdint.h" + +typedef struct _internal_param_struct_t +{ + uint32_t ivar1; + uint32_t ivar2; +}internal_param_struct_t; + +typedef struct _external_param_struct_t +{ + uint32_t var1; + uint32_t var2; + internal_param_struct_t *p_internal_struct; +}external_param_struct_t; + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t marshal_input_parameters_e2_foo1(uint32_t target_fn_id, uint32_t msg_type, uint32_t var1, uint32_t var2, char** marshalled_buff, size_t* marshalled_buff_len); +uint32_t unmarshal_retval_and_output_parameters_e2_foo1(char* out_buff, char** retval); +uint32_t unmarshal_input_parameters_e1_foo1(external_param_struct_t *pstruct, ms_in_msg_exchange_t* ms); +uint32_t marshal_retval_and_output_parameters_e1_foo1(char** resp_buffer, size_t* resp_length, uint32_t retval, external_param_struct_t *p_struct_var, size_t len_data, size_t len_ptr_data); +uint32_t marshal_message_exchange_request(uint32_t target_fn_id, uint32_t msg_type, uint32_t secret_data, char** marshalled_buff, size_t* marshalled_buff_len); +uint32_t umarshal_message_exchange_request(uint32_t* inp_secret_data, ms_in_msg_exchange_t* ms); +uint32_t marshal_message_exchange_response(char** resp_buffer, size_t* resp_length, uint32_t secret_response); +uint32_t umarshal_message_exchange_response(char* out_buff, char** secret_response); +#ifdef __cplusplus + } +#endif +#endif diff --git a/SampleCode/LocalAttestation/Enclave2/Enclave2.config.xml b/SampleCode/LocalAttestation/Enclave2/Enclave2.config.xml new file mode 100644 index 0000000000..3317e37a37 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave2/Enclave2.config.xml @@ -0,0 +1,11 @@ + + 0 + 0 + 0x40000 + 0x100000 + 1 + 1 + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/LocalAttestation/Enclave2/Enclave2.cpp b/SampleCode/LocalAttestation/Enclave2/Enclave2.cpp new file mode 100644 index 0000000000..537957f68c --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave2/Enclave2.cpp @@ -0,0 +1,339 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// Enclave2.cpp : Defines the exported functions for the DLL application +#include "sgx_eid.h" +#include "Enclave2_t.h" +#include "EnclaveMessageExchange.h" +#include "error_codes.h" +#include "Utility_E2.h" +#include "sgx_thread.h" +#include "sgx_dh.h" +#include + +#define UNUSED(val) (void)(val) + +std::mapg_src_session_info_map; + +static uint32_t e2_foo1_wrapper(ms_in_msg_exchange_t *ms, size_t param_lenth, char** resp_buffer, size_t* resp_length); + +//Function pointer table containing the list of functions that the enclave exposes +const struct { + size_t num_funcs; + const void* table[1]; +} func_table = { + 1, + { + (const void*)e2_foo1_wrapper, + } +}; + +//Makes use of the sample code function to establish a secure channel with the destination enclave +uint32_t test_create_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + dh_session_t dest_session_info; + //Core reference code function for creating a session + ke_status = create_session(src_enclave_id, dest_enclave_id,&dest_session_info); + if(ke_status == SUCCESS) + { + //Insert the session information into the map under the corresponding destination enclave id + g_src_session_info_map.insert(std::pair(dest_enclave_id, dest_session_info)); + } + memset(&dest_session_info, 0, sizeof(dh_session_t)); + return ke_status; +} + +//Makes use of the sample code function to do an enclave to enclave call (Test Vector) +uint32_t test_enclave_to_enclave_call(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + param_struct_t *p_struct_var, struct_var; + uint32_t target_fn_id, msg_type; + char* marshalled_inp_buff; + size_t marshalled_inp_buff_len; + char* out_buff; + size_t out_buff_len; + dh_session_t *dest_session_info; + size_t max_out_buff_size; + char* retval; + + max_out_buff_size = 50; + target_fn_id = 0; + msg_type = ENCLAVE_TO_ENCLAVE_CALL; + + struct_var.var1 = 0x3; + struct_var.var2 = 0x4; + p_struct_var = &struct_var; + + //Marshals the input parameters for calling function foo1 in Enclave3 into a input buffer + ke_status = marshal_input_parameters_e3_foo1(target_fn_id, msg_type, p_struct_var, &marshalled_inp_buff, &marshalled_inp_buff_len); + if(ke_status != SUCCESS) + { + return ke_status; + } + + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = &it->second; + } + else + { + SAFE_FREE(marshalled_inp_buff); + return INVALID_SESSION; + } + + //Core Reference Code function + ke_status = send_request_receive_response(src_enclave_id, dest_enclave_id, dest_session_info, marshalled_inp_buff, + marshalled_inp_buff_len, max_out_buff_size, &out_buff, &out_buff_len); + + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + //Un-marshal the return value and output parameters from foo1 of Enclave3 + ke_status = unmarshal_retval_and_output_parameters_e3_foo1(out_buff, p_struct_var, &retval); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + SAFE_FREE(retval); + return SUCCESS; +} + +//Makes use of the sample code function to do a generic secret message exchange (Test Vector) +uint32_t test_message_exchange(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + uint32_t target_fn_id, msg_type; + char* marshalled_inp_buff; + size_t marshalled_inp_buff_len; + char* out_buff; + size_t out_buff_len; + dh_session_t *dest_session_info; + size_t max_out_buff_size; + char* secret_response; + uint32_t secret_data; + + target_fn_id = 0; + msg_type = MESSAGE_EXCHANGE; + max_out_buff_size = 50; + secret_data = 0x12345678; //Secret Data here is shown only for purpose of demonstration. + + //Marshals the secret data into a buffer + ke_status = marshal_message_exchange_request(target_fn_id, msg_type, secret_data, &marshalled_inp_buff, &marshalled_inp_buff_len); + if(ke_status != SUCCESS) + { + return ke_status; + } + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = &it->second; + } + else + { + SAFE_FREE(marshalled_inp_buff); + return INVALID_SESSION; + } + + //Core Reference Code function + ke_status = send_request_receive_response(src_enclave_id, dest_enclave_id, dest_session_info, marshalled_inp_buff, + marshalled_inp_buff_len, max_out_buff_size, &out_buff, &out_buff_len); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + //Un-marshal the secret response data + ke_status = umarshal_message_exchange_response(out_buff, &secret_response); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + SAFE_FREE(secret_response); + return SUCCESS; +} + + +//Makes use of the sample code function to close a current session +uint32_t test_close_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + dh_session_t dest_session_info; + ATTESTATION_STATUS ke_status = SUCCESS; + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = it->second; + } + else + { + return NULL; + } + //Core reference code function for closing a session + ke_status = close_session(src_enclave_id, dest_enclave_id); + + //Erase the session information associated with the destination enclave id + g_src_session_info_map.erase(dest_enclave_id); + return ke_status; +} + +//Function that is used to verify the trust of the other enclave +//Each enclave can have its own way verifying the peer enclave identity +extern "C" uint32_t verify_peer_enclave_trust(sgx_dh_session_enclave_identity_t* peer_enclave_identity) +{ + if(!peer_enclave_identity) + { + return INVALID_PARAMETER_ERROR; + } + if(peer_enclave_identity->isv_prod_id != 0 || !(peer_enclave_identity->attributes.flags & SGX_FLAGS_INITTED)) + // || peer_enclave_identity->attributes.xfrm !=3)// || peer_enclave_identity->mr_signer != xx //TODO: To be hardcoded with values to check + { + return ENCLAVE_TRUST_ERROR; + } + else + { + return SUCCESS; + } +} + +//Dispatch function that calls the approriate enclave function based on the function id +//Each enclave can have its own way of dispatching the calls from other enclave +extern "C" uint32_t enclave_to_enclave_call_dispatcher(char* decrypted_data, + size_t decrypted_data_length, + char** resp_buffer, + size_t* resp_length) +{ + ms_in_msg_exchange_t *ms; + uint32_t (*fn1)(ms_in_msg_exchange_t *ms, size_t, char**, size_t*); + if(!decrypted_data || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + ms = (ms_in_msg_exchange_t *)decrypted_data; + if(ms->target_fn_id >= func_table.num_funcs) + { + return INVALID_PARAMETER_ERROR; + } + fn1 = (uint32_t (*)(ms_in_msg_exchange_t*, size_t, char**, size_t*))func_table.table[ms->target_fn_id]; + return fn1(ms, decrypted_data_length, resp_buffer, resp_length); +} + +//Operates on the input secret and generates the output secret +uint32_t get_message_exchange_response(uint32_t inp_secret_data) +{ + uint32_t secret_response; + + //User should use more complex encryption method to protect their secret, below is just a simple example + secret_response = inp_secret_data & 0x11111111; + + return secret_response; + +} + +//Generates the response from the request message +extern "C" uint32_t message_exchange_response_generator(char* decrypted_data, + char** resp_buffer, + size_t* resp_length) +{ + ms_in_msg_exchange_t *ms; + uint32_t inp_secret_data; + uint32_t out_secret_data; + if(!decrypted_data || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + ms = (ms_in_msg_exchange_t *)decrypted_data; + + if(umarshal_message_exchange_request(&inp_secret_data,ms) != SUCCESS) + return ATTESTATION_ERROR; + + out_secret_data = get_message_exchange_response(inp_secret_data); + + if(marshal_message_exchange_response(resp_buffer, resp_length, out_secret_data) != SUCCESS) + return MALLOC_ERROR; + + return SUCCESS; + +} + +static uint32_t e2_foo1(uint32_t var1, uint32_t var2) +{ + return(var1 + var2); +} + +//Function which is executed on request from the source enclave +static uint32_t e2_foo1_wrapper(ms_in_msg_exchange_t *ms, + size_t param_lenth, + char** resp_buffer, + size_t* resp_length) +{ + UNUSED(param_lenth); + + uint32_t var1,var2,ret; + if(!ms || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + if(unmarshal_input_parameters_e2_foo1(&var1, &var2, ms) != SUCCESS) + return ATTESTATION_ERROR; + + ret = e2_foo1(var1, var2); + + if(marshal_retval_and_output_parameters_e2_foo1(resp_buffer, resp_length, ret) != SUCCESS ) + return MALLOC_ERROR; //can set resp buffer to null here + + return SUCCESS; +} diff --git a/SampleCode/LocalAttestation/Enclave2/Enclave2.edl b/SampleCode/LocalAttestation/Enclave2/Enclave2.edl new file mode 100644 index 0000000000..9ef5c33e4c --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave2/Enclave2.edl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +enclave { + include "sgx_eid.h" + from "../LocalAttestationCode/LocalAttestationCode.edl" import *; + from "sgx_tstdc.edl" import *; + trusted{ + public uint32_t test_create_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_enclave_to_enclave_call(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_message_exchange(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_close_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + }; +}; diff --git a/SampleCode/LocalAttestation/Enclave2/Enclave2_private.pem b/SampleCode/LocalAttestation/Enclave2/Enclave2_private.pem new file mode 100644 index 0000000000..529d07be35 --- /dev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ccYnF4u5ZGWt5lLewN/pVr7MjjykeaHqN +t+rfnQam2psA6fL4zS2zTmZPzR2tnY8Y1GBTi0Ko1OKd1HMCgcAb5cB/7/AQlhP9 +yQa04PLH9ygQkKKptZp7dy5WcWRx0K/hAHRoi2aw1wZqfm7VBNu2SLcs90kCCCxp +6C5sfJi6b8NpNbIPC+sc9wsFr7pGo9SFzQ78UlcWYK2Gu2FxlMjonhka5hvo4zvg +WxlpXKEkaFt3gLd92m/dMqBrHfafH7VwOJY2zT3WIpjwuk0ZzmRg5p0pG/svVQEH +NZmwRwlopysbR69B/n1nefJ84UO50fLh5s5Zr3gBRwbWNZyzhXk= +-----END RSA PRIVATE KEY----- diff --git a/SampleCode/LocalAttestation/Enclave2/Utility_E2.cpp b/SampleCode/LocalAttestation/Enclave2/Utility_E2.cpp new file mode 100644 index 0000000000..962c68f922 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave2/Utility_E2.cpp @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sgx_eid.h" +#include "EnclaveMessageExchange.h" +#include "error_codes.h" +#include "Utility_E2.h" +#include "stdlib.h" +#include "string.h" + +uint32_t marshal_input_parameters_e3_foo1(uint32_t target_fn_id, uint32_t msg_type, param_struct_t *p_struct_var, char** marshalled_buff, size_t* marshalled_buff_len) +{ + ms_in_msg_exchange_t *ms; + size_t param_len, ms_len; + char *temp_buff; + if(!p_struct_var || !marshalled_buff_len) + return INVALID_PARAMETER_ERROR; + param_len = sizeof(param_struct_t); + temp_buff = (char*)malloc(param_len); + if(!temp_buff) + return MALLOC_ERROR; + memcpy(temp_buff, p_struct_var, sizeof(param_struct_t)); //can be optimized + ms_len = sizeof(ms_in_msg_exchange_t) + param_len; + ms = (ms_in_msg_exchange_t *)malloc(ms_len); + if(!ms) + { + SAFE_FREE(temp_buff); + return MALLOC_ERROR; + } + ms->msg_type = msg_type; + ms->target_fn_id = target_fn_id; + ms->inparam_buff_len = (uint32_t)param_len; + memcpy(&ms->inparam_buff, temp_buff, param_len); + *marshalled_buff = (char*)ms; + *marshalled_buff_len = ms_len; + SAFE_FREE(temp_buff); + return SUCCESS; +} + +uint32_t unmarshal_retval_and_output_parameters_e3_foo1(char* out_buff, param_struct_t *p_struct_var, char** retval) +{ + size_t retval_len; + ms_out_msg_exchange_t *ms; + if(!out_buff) + return INVALID_PARAMETER_ERROR; + ms = (ms_out_msg_exchange_t *)out_buff; + retval_len = ms->retval_len; + *retval = (char*)malloc(retval_len); + if(!*retval) + { + return MALLOC_ERROR; + } + memcpy(*retval, ms->ret_outparam_buff, retval_len); + memcpy(&p_struct_var->var1, (ms->ret_outparam_buff) + retval_len, sizeof(p_struct_var->var1)); + memcpy(&p_struct_var->var2, (ms->ret_outparam_buff) + retval_len + sizeof(p_struct_var->var1), sizeof(p_struct_var->var2)); + return SUCCESS; +} + + +uint32_t unmarshal_input_parameters_e2_foo1(uint32_t* var1, uint32_t* var2, ms_in_msg_exchange_t* ms) +{ + char* buff; + size_t len; + if(!var1 || !var2 || !ms) + return INVALID_PARAMETER_ERROR; + + buff = ms->inparam_buff; + len = ms->inparam_buff_len; + + if(len != (sizeof(*var1) + sizeof(*var2))) + return ATTESTATION_ERROR; + + memcpy(var1, buff, sizeof(*var1)); + memcpy(var2, buff + sizeof(*var1), sizeof(*var2)); + + return SUCCESS; +} + +uint32_t marshal_retval_and_output_parameters_e2_foo1(char** resp_buffer, size_t* resp_length, uint32_t retval) +{ + ms_out_msg_exchange_t *ms; + size_t ret_param_len, ms_len; + char *temp_buff; + size_t retval_len; + if(!resp_length) + return INVALID_PARAMETER_ERROR; + retval_len = sizeof(retval); + ret_param_len = retval_len; //no out parameters + temp_buff = (char*)malloc(ret_param_len); + if(!temp_buff) + return MALLOC_ERROR; + + memcpy(temp_buff, &retval, sizeof(retval)); + ms_len = sizeof(ms_out_msg_exchange_t) + ret_param_len; + ms = (ms_out_msg_exchange_t *)malloc(ms_len); + if(!ms) + { + SAFE_FREE(temp_buff); + return MALLOC_ERROR; + } + ms->retval_len = (uint32_t)retval_len; + ms->ret_outparam_buff_len = (uint32_t)ret_param_len; + memcpy(&ms->ret_outparam_buff, temp_buff, ret_param_len); + *resp_buffer = (char*)ms; + *resp_length = ms_len; + SAFE_FREE(temp_buff); + return SUCCESS; +} + +uint32_t marshal_message_exchange_request(uint32_t target_fn_id, uint32_t msg_type, uint32_t secret_data, char** marshalled_buff, size_t* marshalled_buff_len) +{ + ms_in_msg_exchange_t *ms; + size_t secret_data_len, ms_len; + if(!marshalled_buff_len) + return INVALID_PARAMETER_ERROR; + secret_data_len = sizeof(secret_data); + ms_len = sizeof(ms_in_msg_exchange_t) + secret_data_len; + ms = (ms_in_msg_exchange_t *)malloc(ms_len); + if(!ms) + return MALLOC_ERROR; + + ms->msg_type = msg_type; + ms->target_fn_id = target_fn_id; + ms->inparam_buff_len = (uint32_t)secret_data_len; + memcpy(&ms->inparam_buff, &secret_data, secret_data_len); + *marshalled_buff = (char*)ms; + *marshalled_buff_len = ms_len; + return SUCCESS; +} + +uint32_t umarshal_message_exchange_request(uint32_t* inp_secret_data, ms_in_msg_exchange_t* ms) +{ + char* buff; + size_t len; + if(!inp_secret_data || !ms) + return INVALID_PARAMETER_ERROR; + buff = ms->inparam_buff; + len = ms->inparam_buff_len; + if(len != sizeof(uint32_t)) + return ATTESTATION_ERROR; + + memcpy(inp_secret_data, buff, sizeof(uint32_t)); + + return SUCCESS; +} + + +uint32_t marshal_message_exchange_response(char** resp_buffer, size_t* resp_length, uint32_t secret_response) +{ + ms_out_msg_exchange_t *ms; + size_t secret_response_len, ms_len; + size_t retval_len, ret_param_len; + if(!resp_length) + return INVALID_PARAMETER_ERROR; + secret_response_len = sizeof(secret_response); + retval_len = secret_response_len; + ret_param_len = secret_response_len; + ms_len = sizeof(ms_out_msg_exchange_t) + ret_param_len; + ms = (ms_out_msg_exchange_t *)malloc(ms_len); + if(!ms) + return MALLOC_ERROR; + ms->retval_len = (uint32_t)retval_len; + ms->ret_outparam_buff_len = (uint32_t)ret_param_len; + memcpy(&ms->ret_outparam_buff, &secret_response, secret_response_len); + *resp_buffer = (char*)ms; + *resp_length = ms_len; + return SUCCESS; +} + +uint32_t umarshal_message_exchange_response(char* out_buff, char** secret_response) +{ + size_t retval_len; + ms_out_msg_exchange_t *ms; + if(!out_buff) + return INVALID_PARAMETER_ERROR; + ms = (ms_out_msg_exchange_t *)out_buff; + retval_len = ms->retval_len; + *secret_response = (char*)malloc(retval_len); + if(!*secret_response) + { + return MALLOC_ERROR; + } + memcpy(*secret_response, ms->ret_outparam_buff, retval_len); + return SUCCESS; +} diff --git a/SampleCode/LocalAttestation/Enclave2/Utility_E2.h b/SampleCode/LocalAttestation/Enclave2/Utility_E2.h new file mode 100644 index 0000000000..17b88cdea2 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave2/Utility_E2.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef UTILITY_E2_H__ +#define UTILITY_E2_H__ +#include "stdint.h" + +typedef struct _param_struct_t +{ + uint32_t var1; + uint32_t var2; +}param_struct_t; + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t marshal_input_parameters_e3_foo1(uint32_t target_fn_id, uint32_t msg_type, param_struct_t *p_struct_var, char** marshalled_buff, size_t* marshalled_buff_len); +uint32_t unmarshal_retval_and_output_parameters_e3_foo1(char* out_buff, param_struct_t *p_struct_var, char** retval); +uint32_t unmarshal_input_parameters_e2_foo1(uint32_t* var1, uint32_t* var2, ms_in_msg_exchange_t* ms); +uint32_t marshal_retval_and_output_parameters_e2_foo1(char** resp_buffer, size_t* resp_length, uint32_t retval); +uint32_t marshal_message_exchange_request(uint32_t target_fn_id, uint32_t msg_type, uint32_t secret_data, char** marshalled_buff, size_t* marshalled_buff_len); +uint32_t umarshal_message_exchange_request(uint32_t* inp_secret_data, ms_in_msg_exchange_t* ms); +uint32_t marshal_message_exchange_response(char** resp_buffer, size_t* resp_length, uint32_t secret_response); +uint32_t umarshal_message_exchange_response(char* out_buff, char** secret_response); + +#ifdef __cplusplus + } +#endif +#endif + diff --git a/SampleCode/LocalAttestation/Enclave3/Enclave3.config.xml b/SampleCode/LocalAttestation/Enclave3/Enclave3.config.xml new file mode 100644 index 0000000000..436860dd50 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave3/Enclave3.config.xml @@ -0,0 +1,11 @@ + + 0 + 0 + 0x40000 + 0x100000 + 1 + 1 + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/LocalAttestation/Enclave3/Enclave3.cpp b/SampleCode/LocalAttestation/Enclave3/Enclave3.cpp new file mode 100644 index 0000000000..cc15bc4aa7 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave3/Enclave3.cpp @@ -0,0 +1,366 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// Enclave3.cpp : Defines the exported functions for the DLL application +#include "sgx_eid.h" +#include "Enclave3_t.h" +#include "EnclaveMessageExchange.h" +#include "error_codes.h" +#include "Utility_E3.h" +#include "sgx_thread.h" +#include "sgx_dh.h" +#include + +#define UNUSED(val) (void)(val) + +std::mapg_src_session_info_map; + +static uint32_t e3_foo1_wrapper(ms_in_msg_exchange_t *ms, size_t param_lenth, char** resp_buffer, size_t* resp_length); + +//Function pointer table containing the list of functions that the enclave exposes +const struct { + size_t num_funcs; + const void* table[1]; +} func_table = { + 1, + { + (const void*)e3_foo1_wrapper, + } +}; + +//Makes use of the sample code function to establish a secure channel with the destination enclave +uint32_t test_create_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + dh_session_t dest_session_info; + //Core reference code function for creating a session + ke_status = create_session(src_enclave_id, dest_enclave_id,&dest_session_info); + if(ke_status == SUCCESS) + { + //Insert the session information into the map under the corresponding destination enclave id + g_src_session_info_map.insert(std::pair(dest_enclave_id, dest_session_info)); + } + memset(&dest_session_info, 0, sizeof(dh_session_t)); + return ke_status; +} + +//Makes use of the sample code function to do an enclave to enclave call (Test Vector) +uint32_t test_enclave_to_enclave_call(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + external_param_struct_t *p_struct_var, struct_var; + internal_param_struct_t internal_struct_var; + uint32_t target_fn_id, msg_type; + char* marshalled_inp_buff; + size_t marshalled_inp_buff_len; + char* out_buff; + size_t out_buff_len; + dh_session_t *dest_session_info; + size_t max_out_buff_size; + char* retval; + + max_out_buff_size = 50; + msg_type = ENCLAVE_TO_ENCLAVE_CALL; + target_fn_id = 0; + internal_struct_var.ivar1 = 0x5; + internal_struct_var.ivar2 = 0x6; + struct_var.var1 = 0x3; + struct_var.var2 = 0x4; + struct_var.p_internal_struct = &internal_struct_var; + p_struct_var = &struct_var; + + size_t len_data = sizeof(struct_var) - sizeof(struct_var.p_internal_struct); + size_t len_ptr_data = sizeof(internal_struct_var); + + //Marshals the input parameters for calling function foo1 in Enclave1 into a input buffer + ke_status = marshal_input_parameters_e1_foo1(target_fn_id, msg_type, p_struct_var, len_data, + len_ptr_data, &marshalled_inp_buff, &marshalled_inp_buff_len); + + if(ke_status != SUCCESS) + { + return ke_status; + } + + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = &it->second; + } + else + { + SAFE_FREE(marshalled_inp_buff); + return INVALID_SESSION; + } + + //Core Reference Code function + ke_status = send_request_receive_response(src_enclave_id, dest_enclave_id, dest_session_info, + marshalled_inp_buff, marshalled_inp_buff_len, max_out_buff_size, &out_buff, &out_buff_len); + + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + ////Un-marshal the return value and output parameters from foo1 of Enclave1 + ke_status = unmarshal_retval_and_output_parameters_e1_foo1(out_buff, p_struct_var, &retval); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + SAFE_FREE(retval); + return SUCCESS; +} + +//Makes use of the sample code function to do a generic secret message exchange (Test Vector) +uint32_t test_message_exchange(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + ATTESTATION_STATUS ke_status = SUCCESS; + uint32_t target_fn_id, msg_type; + char* marshalled_inp_buff; + size_t marshalled_inp_buff_len; + char* out_buff; + size_t out_buff_len; + dh_session_t *dest_session_info; + size_t max_out_buff_size; + char* secret_response; + uint32_t secret_data; + + target_fn_id = 0; + msg_type = MESSAGE_EXCHANGE; + max_out_buff_size = 50; + secret_data = 0x12345678; //Secret Data here is shown only for purpose of demonstration. + + //Marshals the parameters into a buffer + ke_status = marshal_message_exchange_request(target_fn_id, msg_type, secret_data, &marshalled_inp_buff, &marshalled_inp_buff_len); + if(ke_status != SUCCESS) + { + return ke_status; + } + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = &it->second; + } + else + { + SAFE_FREE(marshalled_inp_buff); + return INVALID_SESSION; + } + + //Core Reference Code function + ke_status = send_request_receive_response(src_enclave_id, dest_enclave_id, dest_session_info, marshalled_inp_buff, + marshalled_inp_buff_len, max_out_buff_size, &out_buff, &out_buff_len); + + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + //Un-marshal the secret response data + ke_status = umarshal_message_exchange_response(out_buff, &secret_response); + if(ke_status != SUCCESS) + { + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + return ke_status; + } + + SAFE_FREE(marshalled_inp_buff); + SAFE_FREE(out_buff); + SAFE_FREE(secret_response); + return SUCCESS; +} + + +//Makes use of the sample code function to close a current session +uint32_t test_close_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + dh_session_t dest_session_info; + ATTESTATION_STATUS ke_status = SUCCESS; + //Search the map for the session information associated with the destination enclave id passed in + std::map::iterator it = g_src_session_info_map.find(dest_enclave_id); + if(it != g_src_session_info_map.end()) + { + dest_session_info = it->second; + } + else + { + return NULL; + } + //Core reference code function for closing a session + ke_status = close_session(src_enclave_id, dest_enclave_id); + + //Erase the session information associated with the destination enclave id + g_src_session_info_map.erase(dest_enclave_id); + return ke_status; +} + +//Function that is used to verify the trust of the other enclave +//Each enclave can have its own way verifying the peer enclave identity +extern "C" uint32_t verify_peer_enclave_trust(sgx_dh_session_enclave_identity_t* peer_enclave_identity) +{ + if(!peer_enclave_identity) + { + return INVALID_PARAMETER_ERROR; + } + if(peer_enclave_identity->isv_prod_id != 0 || !(peer_enclave_identity->attributes.flags & SGX_FLAGS_INITTED)) + // || peer_enclave_identity->attributes.xfrm !=3)// || peer_enclave_identity->mr_signer != xx //TODO: To be hardcoded with values to check + { + return ENCLAVE_TRUST_ERROR; + } + else + { + return SUCCESS; + } +} + + +//Dispatch function that calls the approriate enclave function based on the function id +//Each enclave can have its own way of dispatching the calls from other enclave +extern "C" uint32_t enclave_to_enclave_call_dispatcher(char* decrypted_data, + size_t decrypted_data_length, + char** resp_buffer, + size_t* resp_length) +{ + ms_in_msg_exchange_t *ms; + uint32_t (*fn1)(ms_in_msg_exchange_t *ms, size_t, char**, size_t*); + if(!decrypted_data || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + ms = (ms_in_msg_exchange_t *)decrypted_data; + if(ms->target_fn_id >= func_table.num_funcs) + { + return INVALID_PARAMETER_ERROR; + } + fn1 = (uint32_t (*)(ms_in_msg_exchange_t*, size_t, char**, size_t*))func_table.table[ms->target_fn_id]; + return fn1(ms, decrypted_data_length, resp_buffer, resp_length); +} + +//Operates on the input secret and generates the output secret +uint32_t get_message_exchange_response(uint32_t inp_secret_data) +{ + uint32_t secret_response; + + //User should use more complex encryption method to protect their secret, below is just a simple example + secret_response = inp_secret_data & 0x11111111; + + return secret_response; + +} +//Generates the response from the request message +extern "C" uint32_t message_exchange_response_generator(char* decrypted_data, + char** resp_buffer, + size_t* resp_length) +{ + ms_in_msg_exchange_t *ms; + uint32_t inp_secret_data; + uint32_t out_secret_data; + if(!decrypted_data || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + ms = (ms_in_msg_exchange_t *)decrypted_data; + + if(umarshal_message_exchange_request(&inp_secret_data,ms) != SUCCESS) + return ATTESTATION_ERROR; + + out_secret_data = get_message_exchange_response(inp_secret_data); + + if(marshal_message_exchange_response(resp_buffer, resp_length, out_secret_data) != SUCCESS) + return MALLOC_ERROR; + + return SUCCESS; + +} + + +static uint32_t e3_foo1(param_struct_t *p_struct_var) +{ + if(!p_struct_var) + { + return INVALID_PARAMETER_ERROR; + } + p_struct_var->var1++; + p_struct_var->var2++; + + return(p_struct_var->var1 * p_struct_var->var2); +} + +//Function which is executed on request from the source enclave +static uint32_t e3_foo1_wrapper(ms_in_msg_exchange_t *ms, + size_t param_lenth, + char** resp_buffer, + size_t* resp_length) +{ + UNUSED(param_lenth); + + uint32_t ret; + param_struct_t *p_struct_var; + if(!ms || !resp_length) + { + return INVALID_PARAMETER_ERROR; + } + p_struct_var = (param_struct_t*)malloc(sizeof(param_struct_t)); + if(!p_struct_var) + return MALLOC_ERROR; + + if(unmarshal_input_parameters_e3_foo1(p_struct_var, ms) != SUCCESS) + { + SAFE_FREE(p_struct_var); + return ATTESTATION_ERROR; + } + + ret = e3_foo1(p_struct_var); + + if(marshal_retval_and_output_parameters_e3_foo1(resp_buffer, resp_length, ret, p_struct_var) != SUCCESS) + { + SAFE_FREE(p_struct_var); + return MALLOC_ERROR; + } + SAFE_FREE(p_struct_var); + return SUCCESS; +} diff --git a/SampleCode/LocalAttestation/Enclave3/Enclave3.edl b/SampleCode/LocalAttestation/Enclave3/Enclave3.edl new file mode 100644 index 0000000000..7584ee7945 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave3/Enclave3.edl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave { + include "sgx_eid.h" + from "../LocalAttestationCode/LocalAttestationCode.edl" import *; + from "sgx_tstdc.edl" import *; + trusted{ + public uint32_t test_create_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_enclave_to_enclave_call(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_message_exchange(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + public uint32_t test_close_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + }; +}; diff --git a/SampleCode/LocalAttestation/Enclave3/Enclave3_private.pem b/SampleCode/LocalAttestation/Enclave3/Enclave3_private.pem new file mode 100644 index 0000000000..b8ace89eb3 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave3/Enclave3_private.pem @@ -0,0 +1,39 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIG4wIBAAKCAYEA0MvI9NpdP4GEqCvtlJQv00OybzTXzxBhPu/257VYt9cYw/ph +BN1WRyxBBcrZs15xmcvlb3xNmFGWs4w5oUgrFBNgi6g+CUOCsj0cM8xw7P/y3K0H +XaZUf+T3CXCp8NvlkZHzfdWAFA5lGGR9g6kmuk7SojE3h87Zm1KjPU/PvAe+BaMU +trlRr4gPNVnu19Vho60xwuswPxfl/pBFUIk7qWEUR3l2hiqWMeLgf3Ays/WSnkXA +uijwPt5g0hxsgIlyDrI3jKbf0zkFB56jvPwSykfU8aw4Gkbo5qSZxUAKnwH2L8Uf +yM6inBaaYtM79icRwsu45Yt6X0GAt7CSb/1TKBrnm5exmK1sug3YSQ/YuK1FYawU +vIaDD0YfzOndTNVBewA+Hr5xNPvqGJoRKHuGbyu2lI9jrKYpVxQWsmx38wnxF6kE +zX6N4m7KZiLeLpDdBVQtLuOzIdIE4wT3t/ckeqElxO/1Ut9bj765GcTTrYwMKHRw +ukWIH7ZtHtAjj0KzAgEDAoIBgQCLMoX4kZN/q63Fcp5jDXU3g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uXmhAfnQoORmknPYptz/Ef2HnSk +6zyo8vNKLewrb03s9Hbze8TdDKe98S7QUGj49rJY86fu5asiIz8WFJotHUZ1OWz+ +hpzpav2dwW7xhUk6zXCEdYqIL9PNX2r+3azfLa88Ke2+gxJ+WEkLGgYm8SHEXOON +HRYt+HIw9b1vv56uBhXwENAFwCO81L3Nnid2565CNTsCgcEAjZuZj9q5k/5VkR61 +gv0Of3gSGF7E6k1z0bRLyT4QnSrMgJVgBdG0lvbqeYkZIS4UKn7J+7fPX6m3ZY4I +D3MrdKU3sMlIaQL+9mj3NhEjpb/ksHHqLrlXE55eEYq14cklPXMhmr3WrHqkeYkF +gUQx4S8qUP9De9wob8liwJp10pdEOBBrHnWJB+Z52z/7Zp6dqP0dPgWPvsYheIyg +EK8hgG1xU6rBB7xEMbqLfpLNHB/BBAIA3xzl1EfJAodiBhJHAoHAeTS2znDHYayI +TvK86tBAPVORiBVTSdRUONdGF3dipo24hyeyrI5MtiOoMc3sKWXnSTkDQWa3WiPx +qStBmmO/SbGTuz7T6+oOwGeMiYzYBe87Ayn8Y0KYYshFikieJbGusHjUlIGmCVPy +UHrDMYGwFGUGBwW47gBsnZa+YPHtxWCPDe/U80et2Trx0RXJJQPmupAVMSiJWObI +9k5gRU+xDqkHanyD1gkGGwhFTUNX94EJEOdQEWw3hxLnVtePoke/ +-----END RSA PRIVATE KEY----- diff --git a/SampleCode/LocalAttestation/Enclave3/Utility_E3.cpp b/SampleCode/LocalAttestation/Enclave3/Utility_E3.cpp new file mode 100644 index 0000000000..97cf9b0ce6 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave3/Utility_E3.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sgx_eid.h" +#include "EnclaveMessageExchange.h" +#include "error_codes.h" +#include "Utility_E3.h" +#include "stdlib.h" +#include "string.h" + +uint32_t marshal_input_parameters_e1_foo1(uint32_t target_fn_id, uint32_t msg_type, external_param_struct_t *p_struct_var, size_t len_data, size_t len_ptr_data, char** marshalled_buff, size_t* marshalled_buff_len) +{ + ms_in_msg_exchange_t *ms; + size_t param_len, ms_len; + char *temp_buff; + int* addr; + char* struct_data; + if(!p_struct_var || !marshalled_buff_len) + return INVALID_PARAMETER_ERROR; + struct_data = (char*)p_struct_var; + temp_buff = (char*)malloc(len_data + len_ptr_data); + if(!temp_buff) + return MALLOC_ERROR; + memcpy(temp_buff, struct_data, len_data); + addr = *(int **)(struct_data + len_data); + memcpy(temp_buff + len_data, addr, len_ptr_data); //can be optimized + param_len = len_data + len_ptr_data; + ms_len = sizeof(ms_in_msg_exchange_t) + param_len; + ms = (ms_in_msg_exchange_t *)malloc(ms_len); + if(!ms) + { + SAFE_FREE(temp_buff); + return MALLOC_ERROR; + } + ms->msg_type = msg_type; + ms->target_fn_id = target_fn_id; + ms->inparam_buff_len = (uint32_t)param_len; + memcpy(&ms->inparam_buff, temp_buff, param_len); + *marshalled_buff = (char*)ms; + *marshalled_buff_len = ms_len; + + SAFE_FREE(temp_buff); + return SUCCESS; +} + +uint32_t marshal_retval_and_output_parameters_e3_foo1(char** resp_buffer, size_t* resp_length, uint32_t retval, param_struct_t *p_struct_var) +{ + ms_out_msg_exchange_t *ms; + size_t ret_param_len, ms_len; + char *temp_buff; + size_t retval_len; + if(!resp_length || !p_struct_var) + return INVALID_PARAMETER_ERROR; + retval_len = sizeof(retval); + ret_param_len = sizeof(retval) + sizeof(param_struct_t); + temp_buff = (char*)malloc(ret_param_len); + if(!temp_buff) + return MALLOC_ERROR; + memcpy(temp_buff, &retval, sizeof(retval)); + memcpy(temp_buff + sizeof(retval), p_struct_var, sizeof(param_struct_t)); + ms_len = sizeof(ms_out_msg_exchange_t) + ret_param_len; + ms = (ms_out_msg_exchange_t *)malloc(ms_len); + if(!ms) + { + SAFE_FREE(temp_buff); + return MALLOC_ERROR; + } + ms->retval_len = (uint32_t)retval_len; + ms->ret_outparam_buff_len = (uint32_t)ret_param_len; + memcpy(&ms->ret_outparam_buff, temp_buff, ret_param_len); + *resp_buffer = (char*)ms; + *resp_length = ms_len; + SAFE_FREE(temp_buff); + return SUCCESS; +} + +uint32_t unmarshal_input_parameters_e3_foo1(param_struct_t *pstruct, ms_in_msg_exchange_t* ms) +{ + char* buff; + size_t len; + if(!pstruct || !ms) + return INVALID_PARAMETER_ERROR; + buff = ms->inparam_buff; + len = ms->inparam_buff_len; + + if(len != (sizeof(pstruct->var1) + sizeof(pstruct->var2))) + return ATTESTATION_ERROR; + + memcpy(&pstruct->var1, buff, sizeof(pstruct->var1)); + memcpy(&pstruct->var2, buff + sizeof(pstruct->var1), sizeof(pstruct->var2)); + + return SUCCESS; +} + + +uint32_t unmarshal_retval_and_output_parameters_e1_foo1(char* out_buff, external_param_struct_t *p_struct_var, char** retval) +{ + size_t retval_len; + ms_out_msg_exchange_t *ms; + if(!out_buff || !p_struct_var) + return INVALID_PARAMETER_ERROR; + ms = (ms_out_msg_exchange_t *)out_buff; + retval_len = ms->retval_len; + *retval = (char*)malloc(retval_len); + if(!*retval) + { + return MALLOC_ERROR; + } + memcpy(*retval, ms->ret_outparam_buff, retval_len); + memcpy(&p_struct_var->var1, (ms->ret_outparam_buff) + retval_len, sizeof(p_struct_var->var1)); + memcpy(&p_struct_var->var2, (ms->ret_outparam_buff) + retval_len + sizeof(p_struct_var->var1), sizeof(p_struct_var->var2)); + memcpy(&p_struct_var->p_internal_struct->ivar1, (ms->ret_outparam_buff) + retval_len + sizeof(p_struct_var->var1)+ sizeof(p_struct_var->var2), sizeof(p_struct_var->p_internal_struct->ivar1)); + memcpy(&p_struct_var->p_internal_struct->ivar2, (ms->ret_outparam_buff) + retval_len + sizeof(p_struct_var->var1)+ sizeof(p_struct_var->var2) + sizeof(p_struct_var->p_internal_struct->ivar1), sizeof(p_struct_var->p_internal_struct->ivar2)); + return SUCCESS; +} + + +uint32_t marshal_message_exchange_request(uint32_t target_fn_id, uint32_t msg_type, uint32_t secret_data, char** marshalled_buff, size_t* marshalled_buff_len) +{ + ms_in_msg_exchange_t *ms; + size_t secret_data_len, ms_len; + if(!marshalled_buff_len) + return INVALID_PARAMETER_ERROR; + secret_data_len = sizeof(secret_data); + ms_len = sizeof(ms_in_msg_exchange_t) + secret_data_len; + ms = (ms_in_msg_exchange_t *)malloc(ms_len); + if(!ms) + return MALLOC_ERROR; + + ms->msg_type = msg_type; + ms->target_fn_id = target_fn_id; + ms->inparam_buff_len = (uint32_t)secret_data_len; + memcpy(&ms->inparam_buff, &secret_data, secret_data_len); + + *marshalled_buff = (char*)ms; + *marshalled_buff_len = ms_len; + return SUCCESS; +} + +uint32_t umarshal_message_exchange_request(uint32_t* inp_secret_data, ms_in_msg_exchange_t* ms) +{ + char* buff; + size_t len; + if(!inp_secret_data || !ms) + return INVALID_PARAMETER_ERROR; + buff = ms->inparam_buff; + len = ms->inparam_buff_len; + + if(len != sizeof(uint32_t)) + return ATTESTATION_ERROR; + + memcpy(inp_secret_data, buff, sizeof(uint32_t)); + + return SUCCESS; +} + +uint32_t marshal_message_exchange_response(char** resp_buffer, size_t* resp_length, uint32_t secret_response) +{ + ms_out_msg_exchange_t *ms; + size_t secret_response_len, ms_len; + size_t retval_len, ret_param_len; + if(!resp_length) + return INVALID_PARAMETER_ERROR; + secret_response_len = sizeof(secret_response); + retval_len = secret_response_len; + ret_param_len = secret_response_len; + ms_len = sizeof(ms_out_msg_exchange_t) + ret_param_len; + ms = (ms_out_msg_exchange_t *)malloc(ms_len); + if(!ms) + return MALLOC_ERROR; + ms->retval_len = (uint32_t)retval_len; + ms->ret_outparam_buff_len = (uint32_t)ret_param_len; + memcpy(&ms->ret_outparam_buff, &secret_response, secret_response_len); + *resp_buffer = (char*)ms; + *resp_length = ms_len; + return SUCCESS; +} + +uint32_t umarshal_message_exchange_response(char* out_buff, char** secret_response) +{ + size_t retval_len; + ms_out_msg_exchange_t *ms; + if(!out_buff) + return INVALID_PARAMETER_ERROR; + ms = (ms_out_msg_exchange_t *)out_buff; + retval_len = ms->retval_len; + *secret_response = (char*)malloc(retval_len); + if(!*secret_response) + { + return MALLOC_ERROR; + } + memcpy(*secret_response, ms->ret_outparam_buff, retval_len); + return SUCCESS; +} + diff --git a/SampleCode/LocalAttestation/Enclave3/Utility_E3.h b/SampleCode/LocalAttestation/Enclave3/Utility_E3.h new file mode 100644 index 0000000000..83ba2d6f65 --- /dev/null +++ b/SampleCode/LocalAttestation/Enclave3/Utility_E3.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef UTILITY_E3_H__ +#define UTILITY_E3_H__ + +#include "stdint.h" + + +typedef struct _internal_param_struct_t +{ + uint32_t ivar1; + uint32_t ivar2; +}internal_param_struct_t; + +typedef struct _external_param_struct_t +{ + uint32_t var1; + uint32_t var2; + internal_param_struct_t *p_internal_struct; +}external_param_struct_t; + +typedef struct _param_struct_t +{ + uint32_t var1; + uint32_t var2; +}param_struct_t; + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t marshal_input_parameters_e1_foo1(uint32_t target_fn_id, uint32_t msg_type, external_param_struct_t *p_struct_var, size_t len_data, size_t len_ptr_data, char** marshalled_buff, size_t* marshalled_buff_len); +uint32_t unmarshal_retval_and_output_parameters_e1_foo1(char* out_buff, external_param_struct_t *p_struct_var, char** retval); +uint32_t unmarshal_input_parameters_e3_foo1(param_struct_t *pstruct, ms_in_msg_exchange_t* ms); +uint32_t marshal_retval_and_output_parameters_e3_foo1(char** resp_buffer, size_t* resp_length, uint32_t retval, param_struct_t *p_struct_var); +uint32_t marshal_message_exchange_request(uint32_t target_fn_id, uint32_t msg_type, uint32_t secret_data, char** marshalled_buff, size_t* marshalled_buff_len); +uint32_t umarshal_message_exchange_request(uint32_t* inp_secret_data, ms_in_msg_exchange_t* ms); +uint32_t marshal_message_exchange_response(char** resp_buffer, size_t* resp_length, uint32_t secret_response); +uint32_t umarshal_message_exchange_response(char* out_buff, char** secret_response); + +#ifdef __cplusplus + } +#endif +#endif diff --git a/SampleCode/LocalAttestation/Include/dh_session_protocol.h b/SampleCode/LocalAttestation/Include/dh_session_protocol.h new file mode 100644 index 0000000000..bc92ee4d6c --- /dev/null +++ b/SampleCode/LocalAttestation/Include/dh_session_protocol.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _DH_SESSION_PROROCOL_H +#define _DH_SESSION_PROROCOL_H + +#include "sgx_ecp_types.h" +#include "sgx_key.h" +#include "sgx_report.h" +#include "sgx_attributes.h" + +#define NONCE_SIZE 16 +#define MAC_SIZE 16 + +#define MSG_BUF_LEN sizeof(ec_pub_t)*2 +#define MSG_HASH_SZ 32 + + +//Session information structure +typedef struct _la_dh_session_t +{ + uint32_t session_id; //Identifies the current session + uint32_t status; //Indicates session is in progress, active or closed + union + { + struct + { + sgx_dh_session_t dh_session; + }in_progress; + + struct + { + sgx_key_128bit_t AEK; //Session Key + uint32_t counter; //Used to store Message Sequence Number + }active; + }; +} dh_session_t; + + +#endif diff --git a/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.cpp b/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.cpp new file mode 100644 index 0000000000..a32e3e2197 --- /dev/null +++ b/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.cpp @@ -0,0 +1,721 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_trts.h" +#include "sgx_utils.h" +#include "EnclaveMessageExchange.h" +#include "sgx_eid.h" +#include "error_codes.h" +#include "sgx_ecp_types.h" +#include "sgx_thread.h" +#include +#include "dh_session_protocol.h" +#include "sgx_dh.h" +#include "sgx_tcrypto.h" +#include "LocalAttestationCode_t.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t enclave_to_enclave_call_dispatcher(char* decrypted_data, size_t decrypted_data_length, char** resp_buffer, size_t* resp_length); +uint32_t message_exchange_response_generator(char* decrypted_data, char** resp_buffer, size_t* resp_length); +uint32_t verify_peer_enclave_trust(sgx_dh_session_enclave_identity_t* peer_enclave_identity); + +#ifdef __cplusplus +} +#endif + +#define MAX_SESSION_COUNT 16 + +//number of open sessions +uint32_t g_session_count = 0; + +ATTESTATION_STATUS generate_session_id(uint32_t *session_id); +ATTESTATION_STATUS end_session(sgx_enclave_id_t src_enclave_id); + +//Array of open session ids +session_id_tracker_t *g_session_id_tracker[MAX_SESSION_COUNT]; + +//Map between the source enclave id and the session information associated with that particular session +std::mapg_dest_session_info_map; + +//Create a session with the destination enclave +ATTESTATION_STATUS create_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id, + dh_session_t *session_info) +{ + sgx_dh_msg1_t dh_msg1; //Diffie-Hellman Message 1 + sgx_key_128bit_t dh_aek; // Session Key + sgx_dh_msg2_t dh_msg2; //Diffie-Hellman Message 2 + sgx_dh_msg3_t dh_msg3; //Diffie-Hellman Message 3 + uint32_t session_id; + uint32_t retstatus; + sgx_status_t status = SGX_SUCCESS; + sgx_dh_session_t sgx_dh_session; + sgx_dh_session_enclave_identity_t responder_identity; + + if(!session_info) + { + return INVALID_PARAMETER_ERROR; + } + + memset(&dh_aek,0, sizeof(sgx_key_128bit_t)); + memset(&dh_msg1, 0, sizeof(sgx_dh_msg1_t)); + memset(&dh_msg2, 0, sizeof(sgx_dh_msg2_t)); + memset(&dh_msg3, 0, sizeof(sgx_dh_msg3_t)); + memset(session_info, 0, sizeof(dh_session_t)); + + //Intialize the session as a session initiator + status = sgx_dh_init_session(SGX_DH_SESSION_INITIATOR, &sgx_dh_session); + if(SGX_SUCCESS != status) + { + return status; + } + + //Ocall to request for a session with the destination enclave and obtain session id and Message 1 if successful + status = session_request_ocall(&retstatus, src_enclave_id, dest_enclave_id, &dh_msg1, &session_id); + if (status == SGX_SUCCESS) + { + if ((ATTESTATION_STATUS)retstatus != SUCCESS) + return ((ATTESTATION_STATUS)retstatus); + } + else + { + return ATTESTATION_SE_ERROR; + } + //Process the message 1 obtained from desination enclave and generate message 2 + status = sgx_dh_initiator_proc_msg1(&dh_msg1, &dh_msg2, &sgx_dh_session); + if(SGX_SUCCESS != status) + { + return status; + } + + //Send Message 2 to Destination Enclave and get Message 3 in return + status = exchange_report_ocall(&retstatus, src_enclave_id, dest_enclave_id, &dh_msg2, &dh_msg3, session_id); + if (status == SGX_SUCCESS) + { + if ((ATTESTATION_STATUS)retstatus != SUCCESS) + return ((ATTESTATION_STATUS)retstatus); + } + else + { + return ATTESTATION_SE_ERROR; + } + + //Process Message 3 obtained from the destination enclave + status = sgx_dh_initiator_proc_msg3(&dh_msg3, &sgx_dh_session, &dh_aek, &responder_identity); + if(SGX_SUCCESS != status) + { + return status; + } + + // Verify the identity of the destination enclave + if(verify_peer_enclave_trust(&responder_identity) != SUCCESS) + { + return INVALID_SESSION; + } + + memcpy(session_info->active.AEK, &dh_aek, sizeof(sgx_key_128bit_t)); + session_info->session_id = session_id; + session_info->active.counter = 0; + session_info->status = ACTIVE; + memset(&dh_aek,0, sizeof(sgx_key_128bit_t)); + return status; +} + +//Handle the request from Source Enclave for a session +ATTESTATION_STATUS session_request(sgx_enclave_id_t src_enclave_id, + sgx_dh_msg1_t *dh_msg1, + uint32_t *session_id ) +{ + dh_session_t session_info; + sgx_dh_session_t sgx_dh_session; + sgx_status_t status = SGX_SUCCESS; + + if(!session_id || !dh_msg1) + { + return INVALID_PARAMETER_ERROR; + } + //Intialize the session as a session responder + status = sgx_dh_init_session(SGX_DH_SESSION_RESPONDER, &sgx_dh_session); + if(SGX_SUCCESS != status) + { + return status; + } + + //get a new SessionID + if ((status = (sgx_status_t)generate_session_id(session_id)) != SUCCESS) + return status; //no more sessions available + + //Allocate memory for the session id tracker + g_session_id_tracker[*session_id] = (session_id_tracker_t *)malloc(sizeof(session_id_tracker_t)); + if(!g_session_id_tracker[*session_id]) + { + return MALLOC_ERROR; + } + + memset(g_session_id_tracker[*session_id], 0, sizeof(session_id_tracker_t)); + g_session_id_tracker[*session_id]->session_id = *session_id; + session_info.status = IN_PROGRESS; + + //Generate Message1 that will be returned to Source Enclave + status = sgx_dh_responder_gen_msg1((sgx_dh_msg1_t*)dh_msg1, &sgx_dh_session); + if(SGX_SUCCESS != status) + { + SAFE_FREE(g_session_id_tracker[*session_id]); + return status; + } + memcpy(&session_info.in_progress.dh_session, &sgx_dh_session, sizeof(sgx_dh_session_t)); + //Store the session information under the correspoding source enlave id key + g_dest_session_info_map.insert(std::pair(src_enclave_id, session_info)); + + return status; +} + +//Verify Message 2, generate Message3 and exchange Message 3 with Source Enclave +ATTESTATION_STATUS exchange_report(sgx_enclave_id_t src_enclave_id, + sgx_dh_msg2_t *dh_msg2, + sgx_dh_msg3_t *dh_msg3, + uint32_t session_id) +{ + + sgx_key_128bit_t dh_aek; // Session key + dh_session_t *session_info; + ATTESTATION_STATUS status = SUCCESS; + sgx_dh_session_t sgx_dh_session; + sgx_dh_session_enclave_identity_t initiator_identity; + + if(!dh_msg2 || !dh_msg3) + { + return INVALID_PARAMETER_ERROR; + } + + memset(&dh_aek,0, sizeof(sgx_key_128bit_t)); + do + { + //Retreive the session information for the corresponding source enclave id + std::map::iterator it = g_dest_session_info_map.find(src_enclave_id); + if(it != g_dest_session_info_map.end()) + { + session_info = &it->second; + } + else + { + status = INVALID_SESSION; + break; + } + + if(session_info->status != IN_PROGRESS) + { + status = INVALID_SESSION; + break; + } + + memcpy(&sgx_dh_session, &session_info->in_progress.dh_session, sizeof(sgx_dh_session_t)); + + dh_msg3->msg3_body.additional_prop_length = 0; + //Process message 2 from source enclave and obtain message 3 + sgx_status_t se_ret = sgx_dh_responder_proc_msg2(dh_msg2, + dh_msg3, + &sgx_dh_session, + &dh_aek, + &initiator_identity); + if(SGX_SUCCESS != se_ret) + { + status = se_ret; + break; + } + + //Verify source enclave's trust + if(verify_peer_enclave_trust(&initiator_identity) != SUCCESS) + { + return INVALID_SESSION; + } + + //save the session ID, status and initialize the session nonce + session_info->session_id = session_id; + session_info->status = ACTIVE; + session_info->active.counter = 0; + memcpy(session_info->active.AEK, &dh_aek, sizeof(sgx_key_128bit_t)); + memset(&dh_aek,0, sizeof(sgx_key_128bit_t)); + g_session_count++; + }while(0); + + if(status != SUCCESS) + { + end_session(src_enclave_id); + } + + return status; +} + +//Request for the response size, send the request message to the destination enclave and receive the response message back +ATTESTATION_STATUS send_request_receive_response(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id, + dh_session_t *session_info, + char *inp_buff, + size_t inp_buff_len, + size_t max_out_buff_size, + char **out_buff, + size_t* out_buff_len) +{ + const uint8_t* plaintext; + uint32_t plaintext_length; + sgx_status_t status; + uint32_t retstatus; + secure_message_t* req_message; + secure_message_t* resp_message; + uint8_t *decrypted_data; + uint32_t decrypted_data_length; + uint32_t plain_text_offset; + uint8_t l_tag[TAG_SIZE]; + size_t max_resp_message_length; + plaintext = (const uint8_t*)(" "); + plaintext_length = 0; + + if(!session_info || !inp_buff) + { + return INVALID_PARAMETER_ERROR; + } + //Check if the nonce for the session has not exceeded 2^32-2 if so end session and start a new session + if(session_info->active.counter == ((uint32_t) - 2)) + { + close_session(src_enclave_id, dest_enclave_id); + create_session(src_enclave_id, dest_enclave_id, session_info); + } + + //Allocate memory for the AES-GCM request message + req_message = (secure_message_t*)malloc(sizeof(secure_message_t)+ inp_buff_len); + if(!req_message) + { + return MALLOC_ERROR; + } + + memset(req_message,0,sizeof(secure_message_t)+ inp_buff_len); + const uint32_t data2encrypt_length = (uint32_t)inp_buff_len; + //Set the payload size to data to encrypt length + req_message->message_aes_gcm_data.payload_size = data2encrypt_length; + + //Use the session nonce as the payload IV + memcpy(req_message->message_aes_gcm_data.reserved,&session_info->active.counter,sizeof(session_info->active.counter)); + + //Set the session ID of the message to the current session id + req_message->session_id = session_info->session_id; + + //Prepare the request message with the encrypted payload + status = sgx_rijndael128GCM_encrypt(&session_info->active.AEK, (uint8_t*)inp_buff, data2encrypt_length, + reinterpret_cast(&(req_message->message_aes_gcm_data.payload)), + reinterpret_cast(&(req_message->message_aes_gcm_data.reserved)), + sizeof(req_message->message_aes_gcm_data.reserved), plaintext, plaintext_length, + &(req_message->message_aes_gcm_data.payload_tag)); + + if(SGX_SUCCESS != status) + { + SAFE_FREE(req_message); + return status; + } + + //Allocate memory for the response payload to be copied + *out_buff = (char*)malloc(max_out_buff_size); + if(!*out_buff) + { + SAFE_FREE(req_message); + return MALLOC_ERROR; + } + + memset(*out_buff, 0, max_out_buff_size); + + //Allocate memory for the response message + resp_message = (secure_message_t*)malloc(sizeof(secure_message_t)+ max_out_buff_size); + if(!resp_message) + { + SAFE_FREE(req_message); + return MALLOC_ERROR; + } + + memset(resp_message, 0, sizeof(secure_message_t)+ max_out_buff_size); + + //Ocall to send the request to the Destination Enclave and get the response message back + status = send_request_ocall(&retstatus, src_enclave_id, dest_enclave_id, req_message, + (sizeof(secure_message_t)+ inp_buff_len), max_out_buff_size, + resp_message, (sizeof(secure_message_t)+ max_out_buff_size)); + if (status == SGX_SUCCESS) + { + if ((ATTESTATION_STATUS)retstatus != SUCCESS) + { + SAFE_FREE(req_message); + SAFE_FREE(resp_message); + return ((ATTESTATION_STATUS)retstatus); + } + } + else + { + SAFE_FREE(req_message); + SAFE_FREE(resp_message); + return ATTESTATION_SE_ERROR; + } + + max_resp_message_length = sizeof(secure_message_t)+ max_out_buff_size; + + if(sizeof(resp_message) > max_resp_message_length) + { + SAFE_FREE(req_message); + SAFE_FREE(resp_message); + return INVALID_PARAMETER_ERROR; + } + + //Code to process the response message from the Destination Enclave + + decrypted_data_length = resp_message->message_aes_gcm_data.payload_size; + plain_text_offset = decrypted_data_length; + decrypted_data = (uint8_t*)malloc(decrypted_data_length); + if(!decrypted_data) + { + SAFE_FREE(req_message); + SAFE_FREE(resp_message); + return MALLOC_ERROR; + } + memset(&l_tag, 0, 16); + + memset(decrypted_data, 0, decrypted_data_length); + + //Decrypt the response message payload + status = sgx_rijndael128GCM_decrypt(&session_info->active.AEK, resp_message->message_aes_gcm_data.payload, + decrypted_data_length, decrypted_data, + reinterpret_cast(&(resp_message->message_aes_gcm_data.reserved)), + sizeof(resp_message->message_aes_gcm_data.reserved), &(resp_message->message_aes_gcm_data.payload[plain_text_offset]), plaintext_length, + &resp_message->message_aes_gcm_data.payload_tag); + + if(SGX_SUCCESS != status) + { + SAFE_FREE(req_message); + SAFE_FREE(decrypted_data); + SAFE_FREE(resp_message); + return status; + } + + // Verify if the nonce obtained in the response is equal to the session nonce + 1 (Prevents replay attacks) + if(*(resp_message->message_aes_gcm_data.reserved) != (session_info->active.counter + 1 )) + { + SAFE_FREE(req_message); + SAFE_FREE(resp_message); + SAFE_FREE(decrypted_data); + return INVALID_PARAMETER_ERROR; + } + + //Update the value of the session nonce in the source enclave + session_info->active.counter = session_info->active.counter + 1; + + memcpy(out_buff_len, &decrypted_data_length, sizeof(decrypted_data_length)); + memcpy(*out_buff, decrypted_data, decrypted_data_length); + + SAFE_FREE(decrypted_data); + SAFE_FREE(req_message); + SAFE_FREE(resp_message); + return SUCCESS; + + +} + +//Process the request from the Source enclave and send the response message back to the Source enclave +ATTESTATION_STATUS generate_response(sgx_enclave_id_t src_enclave_id, + secure_message_t* req_message, + size_t req_message_size, + size_t max_payload_size, + secure_message_t* resp_message, + size_t resp_message_size) +{ + const uint8_t* plaintext; + uint32_t plaintext_length; + uint8_t *decrypted_data; + uint32_t decrypted_data_length; + uint32_t plain_text_offset; + ms_in_msg_exchange_t * ms; + size_t resp_data_length; + size_t resp_message_calc_size; + char* resp_data; + uint8_t l_tag[TAG_SIZE]; + size_t header_size, expected_payload_size; + dh_session_t *session_info; + secure_message_t* temp_resp_message; + uint32_t ret; + sgx_status_t status; + + plaintext = (const uint8_t*)(" "); + plaintext_length = 0; + + if(!req_message || !resp_message) + { + return INVALID_PARAMETER_ERROR; + } + + //Get the session information from the map corresponding to the source enclave id + std::map::iterator it = g_dest_session_info_map.find(src_enclave_id); + if(it != g_dest_session_info_map.end()) + { + session_info = &it->second; + } + else + { + return INVALID_SESSION; + } + + if(session_info->status != ACTIVE) + { + return INVALID_SESSION; + } + + //Set the decrypted data length to the payload size obtained from the message + decrypted_data_length = req_message->message_aes_gcm_data.payload_size; + + header_size = sizeof(secure_message_t); + expected_payload_size = req_message_size - header_size; + + //Verify the size of the payload + if(expected_payload_size != decrypted_data_length) + return INVALID_PARAMETER_ERROR; + + memset(&l_tag, 0, 16); + plain_text_offset = decrypted_data_length; + decrypted_data = (uint8_t*)malloc(decrypted_data_length); + if(!decrypted_data) + { + return MALLOC_ERROR; + } + + memset(decrypted_data, 0, decrypted_data_length); + + //Decrypt the request message payload from source enclave + status = sgx_rijndael128GCM_decrypt(&session_info->active.AEK, req_message->message_aes_gcm_data.payload, + decrypted_data_length, decrypted_data, + reinterpret_cast(&(req_message->message_aes_gcm_data.reserved)), + sizeof(req_message->message_aes_gcm_data.reserved), &(req_message->message_aes_gcm_data.payload[plain_text_offset]), plaintext_length, + &req_message->message_aes_gcm_data.payload_tag); + + if(SGX_SUCCESS != status) + { + SAFE_FREE(decrypted_data); + return status; + } + + //Casting the decrypted data to the marshaling structure type to obtain type of request (generic message exchange/enclave to enclave call) + ms = (ms_in_msg_exchange_t *)decrypted_data; + + + // Verify if the nonce obtained in the request is equal to the session nonce + if((uint32_t)*(req_message->message_aes_gcm_data.reserved) != session_info->active.counter || *(req_message->message_aes_gcm_data.reserved) > ((2^32)-2)) + { + SAFE_FREE(decrypted_data); + return INVALID_PARAMETER_ERROR; + } + + if(ms->msg_type == MESSAGE_EXCHANGE) + { + //Call the generic secret response generator for message exchange + ret = message_exchange_response_generator((char*)decrypted_data, &resp_data, &resp_data_length); + if(ret !=0) + { + SAFE_FREE(decrypted_data); + SAFE_FREE(resp_data); + return INVALID_SESSION; + } + } + else if(ms->msg_type == ENCLAVE_TO_ENCLAVE_CALL) + { + //Call the destination enclave's dispatcher to call the appropriate function in the destination enclave + ret = enclave_to_enclave_call_dispatcher((char*)decrypted_data, decrypted_data_length, &resp_data, &resp_data_length); + if(ret !=0) + { + SAFE_FREE(decrypted_data); + SAFE_FREE(resp_data); + return INVALID_SESSION; + } + } + else + { + SAFE_FREE(decrypted_data); + return INVALID_REQUEST_TYPE_ERROR; + } + + + if(resp_data_length > max_payload_size) + { + SAFE_FREE(resp_data); + SAFE_FREE(decrypted_data); + return OUT_BUFFER_LENGTH_ERROR; + } + + resp_message_calc_size = sizeof(secure_message_t)+ resp_data_length; + + if(resp_message_calc_size > resp_message_size) + { + SAFE_FREE(resp_data); + SAFE_FREE(decrypted_data); + return OUT_BUFFER_LENGTH_ERROR; + } + + //Code to build the response back to the Source Enclave + temp_resp_message = (secure_message_t*)malloc(resp_message_calc_size); + if(!temp_resp_message) + { + SAFE_FREE(resp_data); + SAFE_FREE(decrypted_data); + return MALLOC_ERROR; + } + + memset(temp_resp_message,0,sizeof(secure_message_t)+ resp_data_length); + const uint32_t data2encrypt_length = (uint32_t)resp_data_length; + temp_resp_message->session_id = session_info->session_id; + temp_resp_message->message_aes_gcm_data.payload_size = data2encrypt_length; + + //Increment the Session Nonce (Replay Protection) + session_info->active.counter = session_info->active.counter + 1; + + //Set the response nonce as the session nonce + memcpy(&temp_resp_message->message_aes_gcm_data.reserved,&session_info->active.counter,sizeof(session_info->active.counter)); + + //Prepare the response message with the encrypted payload + status = sgx_rijndael128GCM_encrypt(&session_info->active.AEK, (uint8_t*)resp_data, data2encrypt_length, + reinterpret_cast(&(temp_resp_message->message_aes_gcm_data.payload)), + reinterpret_cast(&(temp_resp_message->message_aes_gcm_data.reserved)), + sizeof(temp_resp_message->message_aes_gcm_data.reserved), plaintext, plaintext_length, + &(temp_resp_message->message_aes_gcm_data.payload_tag)); + + if(SGX_SUCCESS != status) + { + SAFE_FREE(resp_data); + SAFE_FREE(decrypted_data); + SAFE_FREE(temp_resp_message); + return status; + } + + memset(resp_message, 0, sizeof(secure_message_t)+ resp_data_length); + memcpy(resp_message, temp_resp_message, sizeof(secure_message_t)+ resp_data_length); + + SAFE_FREE(decrypted_data); + SAFE_FREE(resp_data); + SAFE_FREE(temp_resp_message); + + return SUCCESS; +} + +//Close a current session +ATTESTATION_STATUS close_session(sgx_enclave_id_t src_enclave_id, + sgx_enclave_id_t dest_enclave_id) +{ + sgx_status_t status; + + uint32_t retstatus; + + //Ocall to ask the destination enclave to end the session + status = end_session_ocall(&retstatus, src_enclave_id, dest_enclave_id); + if (status == SGX_SUCCESS) + { + if ((ATTESTATION_STATUS)retstatus != SUCCESS) + return ((ATTESTATION_STATUS)retstatus); + } + else + { + return ATTESTATION_SE_ERROR; + } + return SUCCESS; +} + +//Respond to the request from the Source Enclave to close the session +ATTESTATION_STATUS end_session(sgx_enclave_id_t src_enclave_id) +{ + ATTESTATION_STATUS status = SUCCESS; + int i; + dh_session_t session_info; + uint32_t session_id; + + //Get the session information from the map corresponding to the source enclave id + std::map::iterator it = g_dest_session_info_map.find(src_enclave_id); + if(it != g_dest_session_info_map.end()) + { + session_info = it->second; + } + else + { + return INVALID_SESSION; + } + + session_id = session_info.session_id; + //Erase the session information for the current session + g_dest_session_info_map.erase(src_enclave_id); + + //Update the session id tracker + if (g_session_count > 0) + { + //check if session exists + for (i=1; i <= MAX_SESSION_COUNT; i++) + { + if(g_session_id_tracker[i-1] != NULL && g_session_id_tracker[i-1]->session_id == session_id) + { + memset(g_session_id_tracker[i-1], 0, sizeof(session_id_tracker_t)); + SAFE_FREE(g_session_id_tracker[i-1]); + g_session_count--; + break; + } + } + } + + return status; + +} + + +//Returns a new sessionID for the source destination session +ATTESTATION_STATUS generate_session_id(uint32_t *session_id) +{ + ATTESTATION_STATUS status = SUCCESS; + + if(!session_id) + { + return INVALID_PARAMETER_ERROR; + } + //if the session structure is untintialized, set that as the next session ID + for (int i = 0; i < MAX_SESSION_COUNT; i++) + { + if (g_session_id_tracker[i] == NULL) + { + *session_id = i; + return status; + } + } + + status = NO_AVAILABLE_SESSION_ERROR; + + return status; + +} diff --git a/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.h b/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.h new file mode 100644 index 0000000000..c16a24656e --- /dev/null +++ b/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "datatypes.h" +#include "sgx_eid.h" +#include "sgx_trts.h" +#include +#include "dh_session_protocol.h" + +#ifndef LOCALATTESTATION_H_ +#define LOCALATTESTATION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t SGXAPI create_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, dh_session_t *p_session_info); +uint32_t SGXAPI send_request_receive_response(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, dh_session_t *p_session_info, char *inp_buff, size_t inp_buff_len, size_t max_out_buff_size, char **out_buff, size_t* out_buff_len); +uint32_t SGXAPI close_session(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/LocalAttestation/LocalAttestationCode/LocalAttestationCode.edl b/SampleCode/LocalAttestation/LocalAttestationCode/LocalAttestationCode.edl new file mode 100644 index 0000000000..8e401ee843 --- /dev/null +++ b/SampleCode/LocalAttestation/LocalAttestationCode/LocalAttestationCode.edl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave { + include "sgx_eid.h" + include "datatypes.h" + include "../Include/dh_session_protocol.h" + trusted{ + public uint32_t session_request(sgx_enclave_id_t src_enclave_id, [out] sgx_dh_msg1_t *dh_msg1, [out] uint32_t *session_id); + public uint32_t exchange_report(sgx_enclave_id_t src_enclave_id, [in] sgx_dh_msg2_t *dh_msg2, [out] sgx_dh_msg3_t *dh_msg3, uint32_t session_id); + public uint32_t generate_response(sgx_enclave_id_t src_enclave_id, [in, size = req_message_size] secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, [out, size=resp_message_size] secure_message_t* resp_message, size_t resp_message_size ); + public uint32_t end_session(sgx_enclave_id_t src_enclave_id); + }; + + untrusted{ + uint32_t session_request_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, [out] sgx_dh_msg1_t *dh_msg1,[out] uint32_t *session_id); + uint32_t exchange_report_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, [in] sgx_dh_msg2_t *dh_msg2, [out] sgx_dh_msg3_t *dh_msg3, uint32_t session_id); + uint32_t send_request_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, [in, size = req_message_size] secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, [out, size=resp_message_size] secure_message_t* resp_message, size_t resp_message_size); + uint32_t end_session_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + }; +}; diff --git a/SampleCode/LocalAttestation/LocalAttestationCode/datatypes.h b/SampleCode/LocalAttestation/LocalAttestationCode/datatypes.h new file mode 100644 index 0000000000..1c198aa141 --- /dev/null +++ b/SampleCode/LocalAttestation/LocalAttestationCode/datatypes.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sgx_report.h" +#include "sgx_eid.h" +#include "sgx_ecp_types.h" +#include "sgx_dh.h" +#include "sgx_tseal.h" + +#ifndef DATATYPES_H_ +#define DATATYPES_H_ + +#define DH_KEY_SIZE 20 +#define NONCE_SIZE 16 +#define MAC_SIZE 16 +#define MAC_KEY_SIZE 16 +#define PADDING_SIZE 16 + +#define TAG_SIZE 16 +#define IV_SIZE 12 + +#define DERIVE_MAC_KEY 0x0 +#define DERIVE_SESSION_KEY 0x1 +#define DERIVE_VK1_KEY 0x3 +#define DERIVE_VK2_KEY 0x4 + +#define CLOSED 0x0 +#define IN_PROGRESS 0x1 +#define ACTIVE 0x2 + +#define MESSAGE_EXCHANGE 0x0 +#define ENCLAVE_TO_ENCLAVE_CALL 0x1 + +#define INVALID_ARGUMENT -2 ///< Invalid function argument +#define LOGIC_ERROR -3 ///< Functional logic error +#define FILE_NOT_FOUND -4 ///< File not found + +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} + +#define VMC_ATTRIBUTE_MASK 0xFFFFFFFFFFFFFFCB + +typedef uint8_t dh_nonce[NONCE_SIZE]; +typedef uint8_t cmac_128[MAC_SIZE]; + +#pragma pack(push, 1) + +//Format of the AES-GCM message being exchanged between the source and the destination enclaves +typedef struct _secure_message_t +{ + uint32_t session_id; //Session ID identifyting the session to which the message belongs + sgx_aes_gcm_data_t message_aes_gcm_data; +}secure_message_t; + +//Format of the input function parameter structure +typedef struct _ms_in_msg_exchange_t { + uint32_t msg_type; //Type of Call E2E or general message exchange + uint32_t target_fn_id; //Function Id to be called in Destination. Is valid only when msg_type=ENCLAVE_TO_ENCLAVE_CALL + uint32_t inparam_buff_len; //Length of the serialized input parameters + char inparam_buff[]; //Serialized input parameters +} ms_in_msg_exchange_t; + +//Format of the return value and output function parameter structure +typedef struct _ms_out_msg_exchange_t { + uint32_t retval_len; //Length of the return value + uint32_t ret_outparam_buff_len; //Length of the serialized return value and output parameters + char ret_outparam_buff[]; //Serialized return value and output parameters +} ms_out_msg_exchange_t; + +//Session Tracker to generate session ids +typedef struct _session_id_tracker_t +{ + uint32_t session_id; +}session_id_tracker_t; + +#pragma pack(pop) + +#endif diff --git a/SampleCode/LocalAttestation/LocalAttestationCode/error_codes.h b/SampleCode/LocalAttestation/LocalAttestationCode/error_codes.h new file mode 100644 index 0000000000..0bb2a25cf4 --- /dev/null +++ b/SampleCode/LocalAttestation/LocalAttestationCode/error_codes.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef ERROR_CODES_H_ +#define ERROR_CODES_H_ + +typedef uint32_t ATTESTATION_STATUS; + +#define SUCCESS 0x00 +#define INVALID_PARAMETER 0xE1 +#define VALID_SESSION 0xE2 +#define INVALID_SESSION 0xE3 +#define ATTESTATION_ERROR 0xE4 +#define ATTESTATION_SE_ERROR 0xE5 +#define IPP_ERROR 0xE6 +#define NO_AVAILABLE_SESSION_ERROR 0xE7 +#define MALLOC_ERROR 0xE8 +#define ERROR_TAG_MISMATCH 0xE9 +#define OUT_BUFFER_LENGTH_ERROR 0xEA +#define INVALID_REQUEST_TYPE_ERROR 0xEB +#define INVALID_PARAMETER_ERROR 0xEC +#define ENCLAVE_TRUST_ERROR 0xED +#define ENCRYPT_DECRYPT_ERROR 0xEE +#define DUPLICATE_SESSION 0xEF +#endif diff --git a/SampleCode/LocalAttestation/Makefile b/SampleCode/LocalAttestation/Makefile new file mode 100644 index 0000000000..eaacfc8ffe --- /dev/null +++ b/SampleCode/LocalAttestation/Makefile @@ -0,0 +1,297 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +######## SGX SDK Settings ######## + +SGX_SDK ?= /opt/intel/sgxsdk +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## Library Settings ######## + +Trust_Lib_Name := libLocalAttestation_Trusted.a +TrustLib_Cpp_Files := $(wildcard LocalAttestationCode/*.cpp) +TrustLib_Cpp_Objects := $(TrustLib_Cpp_Files:.cpp=.o) +TrustLib_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -I$(SGX_SDK)/include/epid -I./Include +TrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector -std=c++03 -nostdinc++ $(TrustLib_Include_Paths) + +UnTrustLib_Name := libLocalAttestation_unTrusted.a +UnTrustLib_Cpp_Files := $(wildcard Untrusted_LocalAttestation/*.cpp) +UnTrustLib_Cpp_Objects := $(UnTrustLib_Cpp_Files:.cpp=.o) +UnTrustLib_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/ippcp -I./Include -I./LocalAttestationCode +UnTrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes -std=c++11 $(UnTrustLib_Include_Paths) + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +App_Cpp_Files := $(wildcard App/*.cpp) +App_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/ippcp -I./Include -I./LocalAttestationCode + +App_Compile_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_Compile_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_Compile_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_Compile_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Link_Flags := $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -L. -lpthread -lLocalAttestation_unTrusted + +ifneq ($(SGX_MODE), HW) + App_Link_Flags += -lsgx_uae_service_sim +else + App_Link_Flags += -lsgx_uae_service +endif + +App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) +App_Name := app + +######## Enclave Settings ######## + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif +Crypto_Library_Name := sgx_tcrypto + +Enclave_Cpp_Files_1 := $(wildcard Enclave1/*.cpp) +Enclave_Cpp_Files_2 := $(wildcard Enclave2/*.cpp) +Enclave_Cpp_Files_3 := $(wildcard Enclave3/*.cpp) +Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -I./LocalAttestationCode -I./Include + +Enclave_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) +Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -L. -lLocalAttestation_Trusted -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 + +Enclave_Cpp_Objects_1 := $(Enclave_Cpp_Files_1:.cpp=.o) +Enclave_Cpp_Objects_2 := $(Enclave_Cpp_Files_2:.cpp=.o) +Enclave_Cpp_Objects_3 := $(Enclave_Cpp_Files_3:.cpp=.o) + +Enclave_Name_1 := libenclave1.so +Enclave_Name_2 := libenclave2.so +Enclave_Name_3 := libenclave3.so + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + +ifeq ($(Build_Mode), HW_RELEASE) +all: $(Trust_Lib_Name) $(UnTrustLib_Name) Enclave1.so Enclave2.so Enclave3.so $(App_Name) + @echo "The project has been built in release hardware mode." + @echo "Please sign the enclaves (Enclave1.so, Enclave2.so, Enclave3.so) first with your signing keys before you run the $(App_Name) to launch and access the enclave." + @echo "To sign the enclaves use the following commands:" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave Enclave1.so -out <$(Enclave_Name_1)> -config Enclave1/Enclave1.config.xml" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave Enclave2.so -out <$(Enclave_Name_2)> -config Enclave2/Enclave2.config.xml" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave Enclave3.so -out <$(Enclave_Name_3)> -config Enclave3/Enclave3.config.xml" + @echo "You can also sign the enclaves using an external signing tool. See User's Guide for more details." + @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." +else +all: $(Trust_Lib_Name) $(UnTrustLib_Name) $(Enclave_Name_1) $(Enclave_Name_2) $(Enclave_Name_3) $(App_Name) +endif + +######## Library Objects ######## + +LocalAttestationCode/LocalAttestationCode_t.c LocalAttestationCode/LocalAttestationCode_t.h : $(SGX_EDGER8R) LocalAttestationCode/LocalAttestationCode.edl + @cd LocalAttestationCode && $(SGX_EDGER8R) --trusted ../LocalAttestationCode/LocalAttestationCode.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +LocalAttestationCode/LocalAttestationCode_t.o: LocalAttestationCode/LocalAttestationCode_t.c + @$(CC) $(TrustLib_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +LocalAttestationCode/%.o: LocalAttestationCode/%.cpp LocalAttestationCode/LocalAttestationCode_t.h + @$(CXX) $(TrustLib_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(Trust_Lib_Name): LocalAttestationCode/LocalAttestationCode_t.o $(TrustLib_Cpp_Objects) + @$(AR) rcs $@ $^ + @echo "GEN => $@" + +Untrusted_LocalAttestation/%.o: Untrusted_LocalAttestation/%.cpp + @$(CXX) $(UnTrustLib_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +$(UnTrustLib_Name): $(UnTrustLib_Cpp_Objects) + @$(AR) rcs $@ $^ + @echo "GEN => $@" + +######## App Objects ######## +Enclave1/Enclave1_u.c Enclave1/Enclave1_u.h: $(SGX_EDGER8R) Enclave1/Enclave1.edl + @cd Enclave1 && $(SGX_EDGER8R) --use-prefix --untrusted ../Enclave1/Enclave1.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +App/Enclave1_u.o: Enclave1/Enclave1_u.c + @$(CC) $(App_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave2/Enclave2_u.c Enclave2/Enclave2_u.h: $(SGX_EDGER8R) Enclave2/Enclave2.edl + @cd Enclave2 && $(SGX_EDGER8R) --use-prefix --untrusted ../Enclave2/Enclave2.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +App/Enclave2_u.o: Enclave2/Enclave2_u.c + @$(CC) $(App_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave3/Enclave3_u.c Enclave3/Enclave3_u.h: $(SGX_EDGER8R) Enclave3/Enclave3.edl + @cd Enclave3 && $(SGX_EDGER8R) --use-prefix --untrusted ../Enclave3/Enclave3.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +App/Enclave3_u.o: Enclave3/Enclave3_u.c + @$(CC) $(App_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +App/%.o: App/%.cpp Enclave1/Enclave1_u.h Enclave2/Enclave2_u.h Enclave3/Enclave3_u.h + @$(CXX) $(App_Compile_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(App_Name): App/Enclave1_u.o App/Enclave2_u.o App/Enclave3_u.o $(App_Cpp_Objects) $(UnTrustLib_Name) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + + +######## Enclave Objects ######## + +Enclave1/Enclave1_t.c Enclave1/Enclave1_t.h: $(SGX_EDGER8R) Enclave1/Enclave1.edl + @cd Enclave1 && $(SGX_EDGER8R) --use-prefix --trusted ../Enclave1/Enclave1.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +Enclave1/Enclave1_t.o: Enclave1/Enclave1_t.c + @$(CC) $(Enclave_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave1/%.o: Enclave1/%.cpp Enclave1/Enclave1_t.h + @$(CXX) -std=c++03 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@ + @echo "CXX <= $<" + +Enclave1.so: Enclave1/Enclave1_t.o $(Enclave_Cpp_Objects_1) $(Trust_Lib_Name) + @$(CXX) Enclave1/Enclave1_t.o $(Enclave_Cpp_Objects_1) -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Enclave_Name_1): Enclave1.so + @$(SGX_ENCLAVE_SIGNER) sign -key Enclave1/Enclave1_private.pem -enclave Enclave1.so -out $@ -config Enclave1/Enclave1.config.xml + @echo "SIGN => $@" + +Enclave2/Enclave2_t.c: $(SGX_EDGER8R) Enclave2/Enclave2.edl + @cd Enclave2 && $(SGX_EDGER8R) --use-prefix --trusted ../Enclave2/Enclave2.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +Enclave2/Enclave2_t.o: Enclave2/Enclave2_t.c + @$(CC) $(Enclave_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave2/%.o: Enclave2/%.cpp + @$(CXX) -std=c++03 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@ + @echo "CXX <= $<" + +Enclave2.so: Enclave2/Enclave2_t.o $(Enclave_Cpp_Objects_2) $(Trust_Lib_Name) + @$(CXX) Enclave2/Enclave2_t.o $(Enclave_Cpp_Objects_2) -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Enclave_Name_2): Enclave2.so + @$(SGX_ENCLAVE_SIGNER) sign -key Enclave2/Enclave2_private.pem -enclave Enclave2.so -out $@ -config Enclave2/Enclave2.config.xml + @echo "SIGN => $@" + +Enclave3/Enclave3_t.c: $(SGX_EDGER8R) Enclave3/Enclave3.edl + @cd Enclave3 && $(SGX_EDGER8R) --use-prefix --trusted ../Enclave3/Enclave3.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +Enclave3/Enclave3_t.o: Enclave3/Enclave3_t.c + @$(CC) $(Enclave_Compile_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave3/%.o: Enclave3/%.cpp + @$(CXX) -std=c++03 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@ + @echo "CXX <= $<" + +Enclave3.so: Enclave3/Enclave3_t.o $(Enclave_Cpp_Objects_3) $(Trust_Lib_Name) + @$(CXX) Enclave3/Enclave3_t.o $(Enclave_Cpp_Objects_3) -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Enclave_Name_3): Enclave3.so + @$(SGX_ENCLAVE_SIGNER) sign -key Enclave3/Enclave3_private.pem -enclave Enclave3.so -out $@ -config Enclave3/Enclave3.config.xml + @echo "SIGN => $@" + +######## Clean ######## +.PHONY: clean + +clean: + @rm -rf $(App_Name) *.so *.a App/*.o Enclave1/*.o Enclave1/*_t.* Enclave1/*_u.* Enclave2/*.o Enclave2/*_t.* Enclave2/*_u.* Enclave3/*.o Enclave3/*_t.* Enclave3/*_u.* LocalAttestationCode/*.o Untrusted_LocalAttestation/*.o LocalAttestationCode/*_t.* diff --git a/SampleCode/LocalAttestation/README.txt b/SampleCode/LocalAttestation/README.txt new file mode 100644 index 0000000000..067bb498dc --- /dev/null +++ b/SampleCode/LocalAttestation/README.txt @@ -0,0 +1,27 @@ +--------------------------- +Purpose of LocalAttestation +--------------------------- +The project demonstrates: +- How to establish a protected channel +- Secret message exchange using enclave to enclave function calls + +------------------------------------ +How to Build/Execute the Sample Code +------------------------------------ +1. Install Intel(R) SGX SDK for Linux* OS +2. Build the project with the prepared Makefile: + a. Hardware Mode, Debug build: + $ make SGX_MODE=HW SGX_DEBUG=1 + b. Hardware Mode, Pre-release build: + $ make SGX_MODE=HW SGX_PRERELEASE=1 + c. Hardware Mode, Release build: + $ make SGX_MODE=HW + d. Simulation Mode, Debug build: + $ make SGX_DEBUG=1 + e. Simulation Mode, Pre-release build: + $ make SGX_PRERELEASE=1 + f. Simulation Mode, Release build: + $ make +3. Execute the binary directly: + $ ./app + diff --git a/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.cpp b/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.cpp new file mode 100644 index 0000000000..805c14abad --- /dev/null +++ b/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.cpp @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_eid.h" +#include "error_codes.h" +#include "datatypes.h" +#include "sgx_urts.h" +#include "UntrustedEnclaveMessageExchange.h" +#include "sgx_dh.h" +#include + +std::mapg_enclave_id_map; + +//Makes an sgx_ecall to the destination enclave to get session id and message1 +ATTESTATION_STATUS session_request_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, sgx_dh_msg1_t* dh_msg1, uint32_t* session_id) +{ + uint32_t status = 0; + sgx_status_t ret = SGX_SUCCESS; + uint32_t temp_enclave_no; + + std::map::iterator it = g_enclave_id_map.find(dest_enclave_id); + if(it != g_enclave_id_map.end()) + { + temp_enclave_no = it->second; + } + else + { + return INVALID_SESSION; + } + + switch(temp_enclave_no) + { + case 1: + ret = Enclave1_session_request(dest_enclave_id, &status, src_enclave_id, dh_msg1, session_id); + break; + case 2: + ret = Enclave2_session_request(dest_enclave_id, &status, src_enclave_id, dh_msg1, session_id); + break; + case 3: + ret = Enclave3_session_request(dest_enclave_id, &status, src_enclave_id, dh_msg1, session_id); + break; + } + if (ret == SGX_SUCCESS) + return (ATTESTATION_STATUS)status; + else + return INVALID_SESSION; + +} +//Makes an sgx_ecall to the destination enclave sends message2 from the source enclave and gets message 3 from the destination enclave +ATTESTATION_STATUS exchange_report_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *dh_msg3, uint32_t session_id) +{ + uint32_t status = 0; + sgx_status_t ret = SGX_SUCCESS; + uint32_t temp_enclave_no; + + std::map::iterator it = g_enclave_id_map.find(dest_enclave_id); + if(it != g_enclave_id_map.end()) + { + temp_enclave_no = it->second; + } + else + { + return INVALID_SESSION; + } + + switch(temp_enclave_no) + { + case 1: + ret = Enclave1_exchange_report(dest_enclave_id, &status, src_enclave_id, dh_msg2, dh_msg3, session_id); + break; + case 2: + ret = Enclave2_exchange_report(dest_enclave_id, &status, src_enclave_id, dh_msg2, dh_msg3, session_id); + break; + case 3: + ret = Enclave3_exchange_report(dest_enclave_id, &status, src_enclave_id, dh_msg2, dh_msg3, session_id); + break; + } + if (ret == SGX_SUCCESS) + return (ATTESTATION_STATUS)status; + else + return INVALID_SESSION; + +} + +//Make an sgx_ecall to the destination enclave function that generates the actual response +ATTESTATION_STATUS send_request_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id,secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size) +{ + uint32_t status = 0; + sgx_status_t ret = SGX_SUCCESS; + uint32_t temp_enclave_no; + + std::map::iterator it = g_enclave_id_map.find(dest_enclave_id); + if(it != g_enclave_id_map.end()) + { + temp_enclave_no = it->second; + } + else + { + return INVALID_SESSION; + } + + switch(temp_enclave_no) + { + case 1: + ret = Enclave1_generate_response(dest_enclave_id, &status, src_enclave_id, req_message, req_message_size, max_payload_size, resp_message, resp_message_size); + break; + case 2: + ret = Enclave2_generate_response(dest_enclave_id, &status, src_enclave_id, req_message, req_message_size, max_payload_size, resp_message, resp_message_size); + break; + case 3: + ret = Enclave3_generate_response(dest_enclave_id, &status, src_enclave_id, req_message, req_message_size, max_payload_size, resp_message, resp_message_size); + break; + } + if (ret == SGX_SUCCESS) + return (ATTESTATION_STATUS)status; + else + return INVALID_SESSION; + +} + +//Make an sgx_ecall to the destination enclave to close the session +ATTESTATION_STATUS end_session_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id) +{ + uint32_t status = 0; + sgx_status_t ret = SGX_SUCCESS; + uint32_t temp_enclave_no; + + std::map::iterator it = g_enclave_id_map.find(dest_enclave_id); + if(it != g_enclave_id_map.end()) + { + temp_enclave_no = it->second; + } + else + { + return INVALID_SESSION; + } + + switch(temp_enclave_no) + { + case 1: + ret = Enclave1_end_session(dest_enclave_id, &status, src_enclave_id); + break; + case 2: + ret = Enclave2_end_session(dest_enclave_id, &status, src_enclave_id); + break; + case 3: + ret = Enclave3_end_session(dest_enclave_id, &status, src_enclave_id); + break; + } + if (ret == SGX_SUCCESS) + return (ATTESTATION_STATUS)status; + else + return INVALID_SESSION; + +} diff --git a/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.h b/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.h new file mode 100644 index 0000000000..684b33cb3b --- /dev/null +++ b/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_eid.h" +#include "error_codes.h" +#include "datatypes.h" +#include "sgx_urts.h" +#include "dh_session_protocol.h" +#include "sgx_dh.h" +#include + + +#ifndef ULOCALATTESTATION_H_ +#define ULOCALATTESTATION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +sgx_status_t Enclave1_session_request(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, sgx_dh_msg1_t* dh_msg1, uint32_t* session_id); +sgx_status_t Enclave1_exchange_report(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, uint32_t session_id); +sgx_status_t Enclave1_generate_response(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size); +sgx_status_t Enclave1_end_session(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id); + +sgx_status_t Enclave2_session_request(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, sgx_dh_msg1_t* dh_msg1, uint32_t* session_id); +sgx_status_t Enclave2_exchange_report(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, uint32_t session_id); +sgx_status_t Enclave2_generate_response(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size); +sgx_status_t Enclave2_end_session(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id); + +sgx_status_t Enclave3_session_request(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, sgx_dh_msg1_t* dh_msg1, uint32_t* session_id); +sgx_status_t Enclave3_exchange_report(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, uint32_t session_id); +sgx_status_t Enclave3_generate_response(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id, secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size); +sgx_status_t Enclave3_end_session(sgx_enclave_id_t eid, uint32_t* retval, sgx_enclave_id_t src_enclave_id); + +uint32_t session_request_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, sgx_dh_msg1_t* dh_msg1, uint32_t* session_id); +uint32_t exchange_report_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, sgx_dh_msg2_t* dh_msg2, sgx_dh_msg3_t* dh_msg3, uint32_t session_id); +uint32_t send_request_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id, secure_message_t* req_message, size_t req_message_size, size_t max_payload_size, secure_message_t* resp_message, size_t resp_message_size); +uint32_t end_session_ocall(sgx_enclave_id_t src_enclave_id, sgx_enclave_id_t dest_enclave_id); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/PowerTransition/.cproject b/SampleCode/PowerTransition/.cproject new file mode 100644 index 0000000000..b9fabf3067 --- /dev/null +++ b/SampleCode/PowerTransition/.cproject @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCode/PowerTransition/.project b/SampleCode/PowerTransition/.project new file mode 100644 index 0000000000..f1af7d8591 --- /dev/null +++ b/SampleCode/PowerTransition/.project @@ -0,0 +1,28 @@ + + + SimpleEnclave + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + com.intel.sgx.sgxnature + + diff --git a/SampleCode/PowerTransition/App/App.cpp b/SampleCode/PowerTransition/App/App.cpp new file mode 100644 index 0000000000..6384116722 --- /dev/null +++ b/SampleCode/PowerTransition/App/App.cpp @@ -0,0 +1,319 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +// App.cpp : Define the entry point for the console application. +// + +#include +#include +#include +#include +#include + +#include "Enclave_u.h" +#include "sgx_urts.h" +#include "sgx_tseal.h" + +#include "rwlock.h" +#include "ErrorSupport.h" + +#define ENCLAVE_NAME "libenclave.signed.so" +#define TOKEN_NAME "Enclave.token" + +#define THREAD_NUM 3 + +// Global data +sgx_enclave_id_t global_eid = 0; +sgx_launch_token_t token = {0}; +rwlock_t lock_eid; +struct sealed_buf_t sealed_buf; + +using namespace std; + +// Ocall function +void print(const char *str) +{ + cout<()(std::this_thread::get_id()); + sgx_status_t ret = SGX_SUCCESS; + int retval = 0; + sgx_enclave_id_t current_eid = 0; + + // Enter the enclave to increase and seal the secret data for 100 times. + for(unsigned int i = 0; i< 50000; i++) + { + for( ; ; ) + { + // If power transition occurs, all the data inside the enclave will be lost when the system resumes. + // Therefore, if there are some secret data which need to be backed up for recover, + // users can choose to seal the secret data inside the enclave and back up the sealed data. + + // Enter the enclave to increase the secret data and back up the sealed data + rdlock(&lock_eid); + current_eid = global_eid; + rdunlock(&lock_eid); + ret = increase_and_seal_data(current_eid, &retval, thread_id, &sealed_buf); + + if(ret == SGX_ERROR_ENCLAVE_LOST) + { + // SGX_ERROR_ENCLAVE_LOST indicates the power transition occurs before the system resumes. + // Lock here is to make sure there is only one thread to load and initialize the enclave at the same time + wtlock(&lock_eid); + // The loading and initialization operations happen in current thread only if there is no other thread reloads and initializes the enclave before + if(current_eid == global_eid) + { + cout <<"power transition occured in increase_and_seal_data()." << endl; + // Use the backup sealed data to reload and initialize the enclave. + if((ret = load_and_initialize_enclave(¤t_eid, &sealed_buf)) != SGX_SUCCESS) + { + ret_error_support(ret); + wtunlock(&lock_eid); + return false; + } + else + { + // Update the global_eid after initializing the enclave successfully + global_eid = current_eid; + } + } + else + { + // The enclave has been reloaded by another thread. + // Update the current EID and do increase_and_seal_data() again. + current_eid = global_eid; + } + wtunlock(&lock_eid); + } + else + { + // No power transition occurs + break; + } + } + if(ret != SGX_SUCCESS) + { + ret_error_support(ret); + return false; + } + else if(retval != 0) + { + return false; + } + } + return true; +} + + +void thread_func() +{ + if(increase_and_seal_data_in_enclave() != true) + { + abort(); + } +} + +bool set_global_data() +{ + // Initialize the read/write lock. + init_rwlock(&lock_eid); + + // Get the saved launch token. + // If error occures, zero the token. + ifstream ifs(TOKEN_NAME, std::ios::binary | std::ios::in); + if(!ifs.good()) + { + memset(token, 0, sizeof(sgx_launch_token_t)); + } + else + { + ifs.read(reinterpret_cast(&token), sizeof(sgx_launch_token_t)); + if(ifs.fail()) + { + memset(&token, 0, sizeof(sgx_launch_token_t)); + } + } + + // Allocate memory to save the sealed data. + uint32_t sealed_len = sizeof(sgx_sealed_data_t) + sizeof(uint32_t); + for(int i = 0; i < BUF_NUM; i++) + { + sealed_buf.sealed_buf_ptr[i] = (uint8_t *)malloc(sealed_len); + if(sealed_buf.sealed_buf_ptr[i] == NULL) + { + cout << "Out of memory" << endl; + return false; + } + memset(sealed_buf.sealed_buf_ptr[i], 0, sealed_len); + } + sealed_buf.index = 0; // index indicates which buffer contains current sealed data and which contains the backup sealed data + + return true; +} + +void release_source() +{ + for(int i = 0; i < BUF_NUM; i++) + { + if(sealed_buf.sealed_buf_ptr[i] != NULL) + { + free(sealed_buf.sealed_buf_ptr[i]); + sealed_buf.sealed_buf_ptr[i] = NULL; + } + } + fini_rwlock(&lock_eid); + return; +} + +int main(int argc, char* argv[]) +{ + (void)argc, (void)argv; + + + // Initialize the global data + if(!set_global_data()) + { + release_source(); + cout << "Enter a character before exit ..." << endl; + getchar(); + return -1; + } + + // Load and initialize the signed enclave + // sealed_buf == NULL indicates it is the first time to initialize the enclave. + sgx_status_t ret = load_and_initialize_enclave(&global_eid , NULL); + if(ret != SGX_SUCCESS) + { + ret_error_support(ret); + release_source(); + cout << "Enter a character before exit ..." << endl; + getchar(); + return -1; + } + + cout << "****************************************************************" << endl; + cout << "Demonstrating Power transition needs your cooperation." << endl + << "Please take the following actions:" << endl + << " 1. Enter a character;" << endl + << " 2. Manually put the OS into a sleep or hibernate state;" << endl + << " 3. Resume the OS from that state;" << endl + << "Then you will see the application continues." << endl; + cout << "****************************************************************" << endl; + cout << "Now enter a character ..."; + getchar(); + + // Create multiple threads to calculate the sum + thread trd[THREAD_NUM]; + for (int i = 0; i< THREAD_NUM; i++) + { + trd[i] = thread(thread_func); + } + for (int i = 0; i < THREAD_NUM; i++) + { + trd[i].join(); + } + + // Release resources + release_source(); + + // Destroy the enclave + sgx_destroy_enclave(global_eid); + + cout << "Enter a character before exit ..." << endl; + getchar(); + return 0; +} + diff --git a/SampleCode/PowerTransition/App/ErrorSupport.cpp b/SampleCode/PowerTransition/App/ErrorSupport.cpp new file mode 100644 index 0000000000..9665fb6b31 --- /dev/null +++ b/SampleCode/PowerTransition/App/ErrorSupport.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include +#include "ErrorSupport.h" + + +typedef struct _sgx_errlist_t { + sgx_status_t err; + const char * msg; +} sgx_errlist_t; + +static sgx_errlist_t sgx_errlist[] = { + {SGX_ERROR_UNEXPECTED, "Unexpected error occurred."}, + {SGX_ERROR_INVALID_PARAMETER, "Invalid parameter."}, + {SGX_ERROR_OUT_OF_MEMORY, "Out of memory."}, + {SGX_ERROR_ENCLAVE_LOST, "Power transition occurred."}, + {SGX_ERROR_INVALID_ENCLAVE, "Invalid enclave image."}, + {SGX_ERROR_INVALID_ENCLAVE_ID, "Invalid enclave identification."}, + {SGX_ERROR_INVALID_SIGNATURE, "Invalid enclave signature."}, + {SGX_ERROR_OUT_OF_EPC, "Out of EPC memory."}, + {SGX_ERROR_NO_DEVICE, "Invalid SGX device."}, + {SGX_ERROR_MEMORY_MAP_CONFLICT, "Memory map conflicted."}, + {SGX_ERROR_INVALID_METADATA, "Invalid encalve metadata."}, + {SGX_ERROR_DEVICE_BUSY, "SGX device is busy."}, + {SGX_ERROR_INVALID_VERSION, "Enclave metadata version is invalid."}, + {SGX_ERROR_ENCLAVE_FILE_ACCESS, "Can't open enclave file."}, + + {SGX_ERROR_INVALID_FUNCTION, "Invalid function name."}, + {SGX_ERROR_OUT_OF_TCS, "Out of TCS."}, + {SGX_ERROR_ENCLAVE_CRASHED, "The enclave is crashed."}, + + {SGX_ERROR_MAC_MISMATCH, "Report varification error occurred."}, + {SGX_ERROR_INVALID_ATTRIBUTE, "The enclave is not authorized."}, + {SGX_ERROR_INVALID_CPUSVN, "Invalid CPUSVN."}, + {SGX_ERROR_INVALID_ISVSVN, "Invalid ISVSVN."}, + {SGX_ERROR_INVALID_KEYNAME, "The requested key name is invalid."}, + + {SGX_ERROR_SERVICE_UNAVAILABLE, "AESM service is not responsive."}, + {SGX_ERROR_SERVICE_TIMEOUT, "Request to AESM is time out."}, + {SGX_ERROR_SERVICE_INVALID_PRIVILEGE, "Error occurred while getting launch token."}, +}; + + +void ret_error_support(sgx_status_t ret) +{ + size_t idx = 0; + size_t ttl = sizeof sgx_errlist/sizeof sgx_errlist[0]; + + for (idx = 0; idx < ttl; idx++) { + if(ret == sgx_errlist[idx].err) { + std::cout << "Error: "<< sgx_errlist[idx].msg << std::endl; + break; + } + } + if (idx == ttl) + std::cout << "Error: Unexpected error occurred." < +void wtlock(prwlock_t lock) +{ + int ret = pthread_rwlock_wrlock(lock); + if(0 != ret) + abort(); +} + +void wtunlock(prwlock_t lock) +{ + int ret = pthread_rwlock_unlock(lock); + if(0 != ret) + abort(); +} + + +void rdlock(prwlock_t lock) +{ + int ret = pthread_rwlock_rdlock(lock); + if(0 != ret) + abort(); +} + +void rdunlock(prwlock_t lock) +{ + int ret = pthread_rwlock_unlock(lock); + if(0 != ret) + abort(); +} + +void init_rwlock(prwlock_t lock) +{ + //use the default attribute. + int ret = pthread_rwlock_init(lock, NULL); + if(0 != ret) + abort(); +} + +void fini_rwlock(prwlock_t lock) +{ + int ret = pthread_rwlock_destroy(lock); + if(0 != ret) + abort(); +} + + diff --git a/SampleCode/PowerTransition/App/rwlock.h b/SampleCode/PowerTransition/App/rwlock.h new file mode 100644 index 0000000000..19161f2845 --- /dev/null +++ b/SampleCode/PowerTransition/App/rwlock.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + +#ifndef _RWLOCK_H +#define _RWLOCK_H + +#include +typedef pthread_rwlock_t rwlock_t; +typedef pthread_rwlock_t* prwlock_t; + +#ifdef __cplusplus +extern "C" { +#endif + + void wtlock(prwlock_t lock); + void rdlock(prwlock_t lock); + void rdunlock(prwlock_t lock); + void wtunlock(prwlock_t lock); + void init_rwlock(prwlock_t lock); + void fini_rwlock(prwlock_t lock); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/PowerTransition/Common/types.h b/SampleCode/PowerTransition/Common/types.h new file mode 100644 index 0000000000..a4dc4eaa94 --- /dev/null +++ b/SampleCode/PowerTransition/Common/types.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _TYPES_H_ +#define _TYPES_H_ + +#define BUF_NUM 2 + +#define MOD2(x) ((x) % BUF_NUM) + +struct sealed_buf_t +{ + unsigned int index; + void * sealed_buf_ptr[BUF_NUM]; +}; + + +#endif diff --git a/SampleCode/PowerTransition/Enclave/Enclave.config.xml b/SampleCode/PowerTransition/Enclave/Enclave.config.xml new file mode 100644 index 0000000000..23f5748464 --- /dev/null +++ b/SampleCode/PowerTransition/Enclave/Enclave.config.xml @@ -0,0 +1,11 @@ + + 0 + 0 + 0x40000 + 0x100000 + 3 + 1 + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/PowerTransition/Enclave/Enclave.cpp b/SampleCode/PowerTransition/Enclave/Enclave.cpp new file mode 100644 index 0000000000..34b9ba0ac7 --- /dev/null +++ b/SampleCode/PowerTransition/Enclave/Enclave.cpp @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "string.h" +#include "stdlib.h" +#include "stdio.h" +#include "sgx_trts.h" +#include "sgx_thread.h" +#include "sgx_tseal.h" + +#include "Enclave_t.h" + +uint32_t g_secret; +sgx_thread_mutex_t g_mutex = SGX_THREAD_MUTEX_INITIALIZER; + +static inline void free_allocated_memory(void *pointer) +{ + if(pointer != NULL) + { + free(pointer); + pointer = NULL; + } +} + + +int initialize_enclave(struct sealed_buf_t *sealed_buf) +{ + // sealed_buf == NULL indicates it is the first time to initialize the enclave + if(sealed_buf == NULL) + { + sgx_thread_mutex_lock(&g_mutex); + g_secret = 0; + sgx_thread_mutex_unlock(&g_mutex); + return 0; + } + + // It is not the first time to initialize the enclave + // Reinitialize the enclave to recover the secret data from the input backup sealed data. + + uint32_t len = sizeof(sgx_sealed_data_t) + sizeof(uint32_t); + //Check the sealed_buf length and check the outside pointers deeply + if(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index)] == NULL || + sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index + 1)] == NULL || + !sgx_is_outside_enclave(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index)], len) || + !sgx_is_outside_enclave(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index + 1)], len)) + { + print("Incorrect input parameter(s).\n"); + return -1; + } + + // Retrieve the secret from current backup sealed data + uint32_t unsealed_data = 0; + uint32_t unsealed_data_length = sizeof(g_secret); + uint8_t *plain_text = NULL; + uint32_t plain_text_length = 0; + uint8_t *temp_sealed_buf = (uint8_t *)malloc(len); + if(temp_sealed_buf == NULL) + { + print("Out of memory.\n"); + return -1; + } + + sgx_thread_mutex_lock(&g_mutex); + memcpy(temp_sealed_buf, sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index)], len); + + // Unseal current sealed buf + sgx_status_t ret = sgx_unseal_data((sgx_sealed_data_t *)temp_sealed_buf, plain_text, &plain_text_length, (uint8_t *)&unsealed_data, &unsealed_data_length); + if(ret == SGX_SUCCESS) + { + g_secret = unsealed_data; + sgx_thread_mutex_unlock(&g_mutex); + free_allocated_memory(temp_sealed_buf); + return 0; + } + else + { + sgx_thread_mutex_unlock(&g_mutex); + print("Failed to reinitialize the enclave.\n"); + free_allocated_memory(temp_sealed_buf); + return -1; + } +} + +int increase_and_seal_data(size_t tid, struct sealed_buf_t* sealed_buf) +{ + uint32_t sealed_len = sizeof(sgx_sealed_data_t) + sizeof(g_secret); + // Check the sealed_buf length and check the outside pointers deeply + if(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index)] == NULL || + sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index + 1)] == NULL || + !sgx_is_outside_enclave(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index)], sealed_len) || + !sgx_is_outside_enclave(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index + 1)], sealed_len)) + { + print("Incorrect input parameter(s).\n"); + return -1; + } + + char string_buf[BUFSIZ] = {'\0'}; + uint32_t temp_secret = 0; + uint8_t *plain_text = NULL; + uint32_t plain_text_length = 0; + uint8_t *temp_sealed_buf = (uint8_t *)malloc(sealed_len); + if(temp_sealed_buf == NULL) + { + print("Out of memory.\n"); + return -1; + } + memset(temp_sealed_buf, 0, sealed_len); + + sgx_thread_mutex_lock(&g_mutex); + + // Increase and seal the secret data + temp_secret = ++g_secret; + sgx_status_t ret = sgx_seal_data(plain_text_length, plain_text, sizeof(g_secret), (uint8_t *)&g_secret, sealed_len, (sgx_sealed_data_t *)temp_sealed_buf); + if(ret != SGX_SUCCESS) + { + sgx_thread_mutex_unlock(&g_mutex); + print("Failed to seal data\n"); + free_allocated_memory(temp_sealed_buf); + return -1; + } + // Backup the sealed data to outside buffer + memcpy(sealed_buf->sealed_buf_ptr[MOD2(sealed_buf->index + 1)], temp_sealed_buf, sealed_len); + sealed_buf->index++; + + sgx_thread_mutex_unlock(&g_mutex); + free_allocated_memory(temp_sealed_buf); + + // Ocall to print the unsealed secret data outside. + // In theory, the secret data(s) SHOULD NOT be transferred outside the enclave as clear text(s). + // So please DO NOT print any secret outside. Here printing the secret data to outside is only for demo. + snprintf(string_buf, BUFSIZ, "Thread %#x>: %d\n", (unsigned int)tid, temp_secret); + print(string_buf); + return 0; +} diff --git a/SampleCode/PowerTransition/Enclave/Enclave.edl b/SampleCode/PowerTransition/Enclave/Enclave.edl new file mode 100644 index 0000000000..54aa25a740 --- /dev/null +++ b/SampleCode/PowerTransition/Enclave/Enclave.edl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +enclave { + + // Import the Ocalls for trusted mutex + from "sgx_tstdc.edl" import *; + include "types.h" + + trusted { + public int initialize_enclave([in]struct sealed_buf_t* sealed_buf); + public int increase_and_seal_data(size_t tid, [in, out]struct sealed_buf_t* sealed_buf); + }; + + untrusted { + void print([in, string] const char *string); + }; +}; diff --git a/SampleCode/PowerTransition/Enclave/Enclave.lds b/SampleCode/PowerTransition/Enclave/Enclave.lds new file mode 100644 index 0000000000..b1c6b6fd7e --- /dev/null +++ b/SampleCode/PowerTransition/Enclave/Enclave.lds @@ -0,0 +1,9 @@ +libenclave.so +{ + global: + g_global_data_sim; + g_global_data; + enclave_entry; + local: + *; +}; diff --git a/SampleCode/PowerTransition/Enclave/Enclave_private.pem b/SampleCode/PowerTransition/Enclave/Enclave_private.pem new file mode 100644 index 0000000000..529d07be35 --- /dev/null +++ b/SampleCode/PowerTransition/Enclave/Enclave_private.pem @@ -0,0 +1,39 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ +AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ +ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7jguwbCG1Pr +nEMdJ3Sew20vnje+RsngAzdPChoJpVsWi/K7cettX/tbnre1DL02GXc5qJoQYk7b +3zkmhz31TgFrd9VVtmUGyFXAysuSAb3EN+5VnHGr0xKkeg8utErea2FNtNIgua8H +ONfm9Eiyaav1SVKzPHlyqLtcdxH3I8Wg7yqMsaprZ1n5A1v/levxnL8+It02KseD +5HqV4rf/cImSlCt3lpRg8U5E1pyFQ2IVEC/XTDMiI3c+AR+w2jSRB3Bwn9zJtFlW +KHG3m1xGI4ck+Lci1JvWWLXQagQSPtZTsubxTQNx1gsgZhgv1JHVZMdbVlAbbRMC +1nSuJNl7KPAS/VfzAgEDAoIBgHRXxaynbVP5gkO0ug6Qw/E27wzIw4SmjsxG6Wpe +K7kfDeRskKxESdsA/xCrKkwGwhcx1iIg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DuWHGlaiLWnCbSz +Az2DHBQBBaku409zDQym3j1ugMRjzzSQWzJg0SIyBH3hTmnYcn3+Uqcp/lEBvGW6 +O+rsXFt3pukqJmIV8HzLGGaLm62BHUeZf3dyWm+i3p/hQAL7Xvu04QW70xuGqdr5 +afV7p5eaeQIJXyGQJ0eylV/90+qxjMKiB1XYg6WYvwKBwQCL/ddpgOdHJGN8uRom +e7Zq0Csi3hGheMKlKbN3vcxT5U7MdyHtTZZOJbTvxKNNUNYH/8uD+PqDGNneb29G +BfGzvI3EASyLIcGZF3OhKwZd0jUrWk2y7Vhob91jwp2+t73vdMbkKyI4mHOuXvGv +fg95si9oO7EBT+Oqvhccd2J+F1IVXncccYnF4u5ZGWt5lLewN/pVr7MjjykeaHqN +t+rfnQam2psA6fL4zS2zTmZPzR2tnY8Y1GBTi0Ko1OKd1HMCgcAb5cB/7/AQlhP9 +yQa04PLH9ygQkKKptZp7dy5WcWRx0K/hAHRoi2aw1wZqfm7VBNu2SLcs90kCCCxp +6C5sfJi6b8NpNbIPC+sc9wsFr7pGo9SFzQ78UlcWYK2Gu2FxlMjonhka5hvo4zvg +WxlpXKEkaFt3gLd92m/dMqBrHfafH7VwOJY2zT3WIpjwuk0ZzmRg5p0pG/svVQEH +NZmwRwlopysbR69B/n1nefJ84UO50fLh5s5Zr3gBRwbWNZyzhXk= +-----END RSA PRIVATE KEY----- diff --git a/SampleCode/PowerTransition/Makefile b/SampleCode/PowerTransition/Makefile new file mode 100644 index 0000000000..5c03d8aaa6 --- /dev/null +++ b/SampleCode/PowerTransition/Makefile @@ -0,0 +1,212 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +####### SGX SDK Settings ######## + +SGX_SDK ?= /opt/intel/sgxsdk +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +App_Cpp_Files := $(wildcard App/*.cpp) +App_Include_Paths := -I$(SGX_SDK)/include -I./Common + +App_Compile_CFlags := -fPIC -Wno-attributes $(App_Include_Paths) +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_Compile_CFlags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_Compile_CFlags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_Compile_CFlags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Compile_CXXFlags := -std=c++0x $(App_Compile_CFlags) +App_Link_Flags := -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread + +ifneq ($(SGX_MODE), HW) + App_Link_Flags += -lsgx_uae_service_sim +else + App_Link_Flags += -lsgx_uae_service +endif + +Gen_Untrusted_Source := App/Enclave_u.c +Gen_Untrusted_Object := App/Enclave_u.o + +App_Objects := $(Gen_Untrusted_Object) $(App_Cpp_Files:.cpp=.o) + +App_Name := app + + +######## Enclave Settings ######## + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif +Crypto_Library_Name := sgx_tcrypto + +Enclave_Cpp_Files := $(wildcard Enclave/*.cpp) + +Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -I./Common + +Enclave_Compile_CFlags := -nostdinc -ffreestanding -fvisibility=hidden -fpie \ + $(Enclave_Include_Paths) +Enclave_Compile_CXXFlags := -nostdinc++ -std=c++03 $(Enclave_Compile_CFlags) +Enclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,--version-script=Enclave/Enclave.lds -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic -Wl,--defsym,__ImageBase=0 + +Enclave_Cpp_Objects := $(Enclave_Cpp_Files:.cpp=.o) +Gen_Trusted_Source := Enclave/Enclave_t.c +Gen_Trusted_Object := Enclave/Enclave_t.o + +Enclave_Objects := $(Gen_Trusted_Object) $(Enclave_Cpp_Files:.cpp=.o) + +Enclave_Name := libenclave.so +Signed_Enclave_Name := libenclave.signed.so +Enclave_Config_File := Enclave/Enclave.config.xml + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + +ifeq ($(Build_Mode), HW_RELEASE) +all: $(App_Name) $(Enclave_Name) + @echo "The project has been built in release hardware mode." + @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." + @echo "To sign the enclave use the command:" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" + @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." + @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." +else +all: $(App_Name) $(Signed_Enclave_Name) + @echo "Build $(App_Name) [$(SGX_MODE)|$(SGX_ARCH)] Success!" + @echo "Please RUN the project with command:" + @echo " $(App_Name)" +endif + +######## App Objects ######## + +$(Gen_Untrusted_Source): $(SGX_EDGER8R) Enclave/Enclave.edl + @cd App && $(SGX_EDGER8R) --untrusted ../Enclave/Enclave.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +$(Gen_Untrusted_Object): $(Gen_Untrusted_Source) + @$(CC) $(SGX_COMMON_CFLAGS) $(App_Compile_CFlags) -c $< -o $@ + @echo "CC <= $<" + +App/%.o: App/%.cpp + @$(CXX) $(SGX_COMMON_CFLAGS) $(App_Compile_CXXFlags) -c $< -o $@ + @echo "CXX <= $<" + +$(App_Name): $(App_Objects) + @$(CXX) $(SGX_COMMON_CFLAGS) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + + +######## Enclave Objects ######## + +$(Gen_Trusted_Source): $(SGX_EDGER8R) Enclave/Enclave.edl + @cd Enclave && $(SGX_EDGER8R) --trusted Enclave.edl --search-path $(SGX_SDK)/include + @echo "GEN => $@" +$(Gen_Trusted_Object): $(Gen_Trusted_Source) + @$(CC) $(SGX_COMMON_CFLAGS) $(Enclave_Compile_CFlags) -c $< -o $@ + @echo "CC <= $<" + +Enclave/%.o: Enclave/%.cpp + @$(CXX) $(SGX_COMMON_CFLAGS) $(Enclave_Compile_CXXFlags) -c $< -o $@ + @echo "CXX <= $<" + +$(Enclave_Name): $(Enclave_Objects) + @$(CXX) $(SGX_COMMON_CFLAGS) $(Enclave_Objects) -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Signed_Enclave_Name): $(Enclave_Name) + @$(SGX_ENCLAVE_SIGNER) sign -key Enclave/Enclave_private.pem -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) + @echo "SIGN => $@" + + +######### clean up ######## +.PHONY: clean + + +clean: + @rm -f $(App_Name) $(App_Objects) $(Enclave_Name) $(Enclave_Objects) App/Enclave_u.* Enclave/Enclave_t.* $(Signed_Enclave_Name) diff --git a/SampleCode/PowerTransition/README.txt b/SampleCode/PowerTransition/README.txt new file mode 100644 index 0000000000..a6a23b930e --- /dev/null +++ b/SampleCode/PowerTransition/README.txt @@ -0,0 +1,26 @@ +-------------------------- +Purpose of PowerTransition +-------------------------- +The project demonstrates one method about power transition handling for Intel(R) +Software Guard Extensions projects development. + +------------------------------------ +How to Build/Execute the Sample Code +------------------------------------ +1. Install Intel(R) SGX SDK for Linux* OS +2. Build the project with the prepared Makefile: + a. Hardware Mode, Debug build: + $ make SGX_MODE=HW SGX_DEBUG=1 + b. Hardware Mode, Pre-release build: + $ make SGX_MODE=HW SGX_PRERELEASE=1 + c. Hardware Mode, Release build: + $ make SGX_MODE=HW + d. Simulation Mode, Debug build: + $ make SGX_DEBUG=1 + e. Simulation Mode, Pre-release build: + $ make SGX_PRERELEASE=1 + f. Simulation Mode, Release build: + $ make +3. Execute the binary directly: + $ ./app + diff --git a/SampleCode/RemoteAttestation/.cproject b/SampleCode/RemoteAttestation/.cproject new file mode 100644 index 0000000000..b9fabf3067 --- /dev/null +++ b/SampleCode/RemoteAttestation/.cproject @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCode/RemoteAttestation/.project b/SampleCode/RemoteAttestation/.project new file mode 100644 index 0000000000..f1af7d8591 --- /dev/null +++ b/SampleCode/RemoteAttestation/.project @@ -0,0 +1,28 @@ + + + SimpleEnclave + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + com.intel.sgx.sgxnature + + diff --git a/SampleCode/RemoteAttestation/Makefile b/SampleCode/RemoteAttestation/Makefile new file mode 100644 index 0000000000..7335b486c9 --- /dev/null +++ b/SampleCode/RemoteAttestation/Makefile @@ -0,0 +1,230 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +######## SGX SDK Settings ######## + +SGX_SDK ?= /opt/intel/sgxsdk +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +App_Cpp_Files := isv_app/isv_app.cpp +App_Include_Paths := -Iservice_provider -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 +App_Link_Flags := $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -L. -lsgx_ukey_exchange -lpthread -lservice_provider -Wl,-rpath=$(CURDIR)/sample_libcrypto -Wl,-rpath=$(CURDIR) + +ifneq ($(SGX_MODE), HW) + App_Link_Flags += -lsgx_uae_service_sim +else + App_Link_Flags += -lsgx_uae_service +endif + +App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) + +App_Name := app + +######## Service Provider Settings ######## + +ServiceProvider_Cpp_Files := service_provider/ecp.cpp service_provider/network_ra.cpp service_provider/service_provider.cpp service_provider/ias_ra.cpp +ServiceProvider_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -Isample_libcrypto + +ServiceProvider_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes -I$(SGX_SDK)/include -Isample_libcrypto +ServiceProvider_Cpp_Flags := $(ServiceProvider_C_Flags) -std=c++11 +ServiceProvider_Link_Flags := -shared $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -lsample_libcrypto -Lsample_libcrypto + +ServiceProvider_Cpp_Objects := $(ServiceProvider_Cpp_Files:.cpp=.o) + +######## Enclave Settings ######## + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif +Crypto_Library_Name := sgx_tcrypto + +Enclave_Cpp_Files := isv_enclave/isv_enclave.cpp +Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport + +Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) +Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++03 -nostdinc++ +Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -lsgx_tkey_exchange -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=isv_enclave/isv_enclave.lds + +Enclave_Cpp_Objects := $(Enclave_Cpp_Files:.cpp=.o) + +Enclave_Name := isv_enclave.so +Signed_Enclave_Name := isv_enclave.signed.so +Enclave_Config_File := isv_enclave/isv_enclave.config.xml + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +ifeq ($(Build_Mode), HW_RELEASE) +all: libservice_provider.so $(App_Name) $(Enclave_Name) + @echo "The project has been built in release hardware mode." + @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." + @echo "To sign the enclave use the command:" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" + @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." + @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." +else +all: libservice_provider.so $(App_Name) $(Signed_Enclave_Name) +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/$(App_Name) + @echo "RUN => $(App_Name) [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + +######## App Objects ######## + +isv_app/isv_enclave_u.c: $(SGX_EDGER8R) isv_enclave/isv_enclave.edl + @cd isv_app && $(SGX_EDGER8R) --untrusted ../isv_enclave/isv_enclave.edl --search-path ../isv_enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +isv_app/isv_enclave_u.o: isv_app/isv_enclave_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +isv_app/%.o: isv_app/%.cpp + @$(CXX) $(App_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(App_Name): isv_app/isv_enclave_u.o $(App_Cpp_Objects) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + +######## Service Provider Objects ######## + + +service_provider/%.o: service_provider/%.cpp + @$(CXX) $(ServiceProvider_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +libservice_provider.so: $(ServiceProvider_Cpp_Objects) + @$(CXX) $^ -o $@ $(ServiceProvider_Link_Flags) + @echo "LINK => $@" + +######## Enclave Objects ######## + +isv_enclave/isv_enclave_t.c: $(SGX_EDGER8R) isv_enclave/isv_enclave.edl + @cd isv_enclave && $(SGX_EDGER8R) --trusted ../isv_enclave/isv_enclave.edl --search-path ../isv_enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +isv_enclave/isv_enclave_t.o: isv_enclave/isv_enclave_t.c + @$(CC) $(Enclave_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +isv_enclave/%.o: isv_enclave/%.cpp + @$(CXX) $(Enclave_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(Enclave_Name): isv_enclave/isv_enclave_t.o $(Enclave_Cpp_Objects) + @$(CXX) $^ -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Signed_Enclave_Name): $(Enclave_Name) + @$(SGX_ENCLAVE_SIGNER) sign -key isv_enclave/isv_enclave_private.pem -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) + @echo "SIGN => $@" + +.PHONY: clean + +clean: + @rm -f $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) isv_app/isv_enclave_u.* $(Enclave_Cpp_Objects) isv_enclave/isv_enclave_t.* libservice_provider.* $(ServiceProvider_Cpp_Objects) diff --git a/SampleCode/RemoteAttestation/README.txt b/SampleCode/RemoteAttestation/README.txt new file mode 100644 index 0000000000..a940b9d1b9 --- /dev/null +++ b/SampleCode/RemoteAttestation/README.txt @@ -0,0 +1,27 @@ +---------------------------- +Purpose of RemoteAttestation +---------------------------- +The project demonstrates: +- How an application enclave can attest to a remote party +- How an application enclave and the remote party can establish a secure session + +------------------------------------ +How to Build/Execute the Sample Code +------------------------------------ +1. Install Intel(R) SGX SDK for Linux* OS +2. Build the project with the prepared Makefile: + a. Hardware Mode, Debug build: + $ make SGX_MODE=HW SGX_DEBUG=1 + b. Hardware Mode, Pre-release build: + $ make SGX_MODE=HW SGX_PRERELEASE=1 + c. Hardware Mode, Release build: + $ make SGX_MODE=HW + d. Simulation Mode, Debug build: + $ make SGX_DEBUG=1 + e. Simulation Mode, Pre-release build: + $ make SGX_PRERELEASE=1 + f. Simulation Mode, Release build: + $ make +3. Execute the binary directly: + $ ./app + diff --git a/SampleCode/RemoteAttestation/isv_app/isv_app.cpp b/SampleCode/RemoteAttestation/isv_app/isv_app.cpp new file mode 100644 index 0000000000..472e81902f --- /dev/null +++ b/SampleCode/RemoteAttestation/isv_app/isv_app.cpp @@ -0,0 +1,644 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include +#include +// Needed for definition of remote attestation messages. +#include "remote_attestation_result.h" + +#include "isv_enclave_u.h" + +// Needed to call untrusted key exchange library APIs, i.e. sgx_ra_proc_msg2. +#include "sgx_ukey_exchange.h" + +// Needed to get service provider's information, in your real project, you will +// need to talk to real server. +#include "network_ra.h" + +// Needed to create enclave and do ecall. +#include "sgx_urts.h" + +#include "service_provider.h" + +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr) = NULL;}} +#endif + +// In addition to generating and sending messages, this application +// can use pre-generated messages to verify the generation of +// messages and the information flow. +#include "sample_messages.h" + + +#define ENCLAVE_PATH "isv_enclave.signed.so" + +uint8_t* msg1_samples[] = { msg1_sample1, msg1_sample2 }; +uint8_t* msg2_samples[] = { msg2_sample1, msg2_sample2 }; +uint8_t* msg3_samples[MSG3_BODY_SIZE] = { msg3_sample1, msg3_sample2 }; +uint8_t* attestation_msg_samples[] = + { attestation_msg_sample1, attestation_msg_sample2}; + +// Some utility functions to output some of the data structures passed between +// the ISV app and the remote attestation service provider. +void PRINT_BYTE_ARRAY( + FILE *file, void *mem, uint32_t len) +{ + if(!mem || !len) + { + fprintf(file, "\n( null )\n"); + return; + } + uint8_t *array = (uint8_t *)mem; + fprintf(file, "%u bytes:\n{\n", len); + uint32_t i = 0; + for(i = 0; i < len - 1; i++) + { + fprintf(file, "0x%x, ", array[i]); + if(i % 8 == 7) fprintf(file, "\n"); + } + fprintf(file, "0x%x ", array[i]); + fprintf(file, "\n}\n"); +} + + +void PRINT_ATTESTATION_SERVICE_RESPONSE( + FILE *file, + ra_samp_response_header_t *response) +{ + if(!response) + { + fprintf(file, "\t\n( null )\n"); + return; + } + + fprintf(file, "RESPONSE TYPE: 0x%x\n", response->type); + fprintf(file, "RESPONSE STATUS: 0x%x 0x%x\n", response->status[0], + response->status[1]); + fprintf(file, "RESPONSE BODY SIZE: %u\n", response->size); + + if(response->type == TYPE_RA_MSG2) + { + sgx_ra_msg2_t* p_msg2_body = (sgx_ra_msg2_t*)(response->body); + + fprintf(file, "MSG2 gb - "); + PRINT_BYTE_ARRAY(file, &(p_msg2_body->g_b), sizeof(p_msg2_body->g_b)); + + fprintf(file, "MSG2 spid - "); + PRINT_BYTE_ARRAY(file, &(p_msg2_body->spid), sizeof(p_msg2_body->spid)); + + fprintf(file, "MSG2 sign_gb_ga - "); + PRINT_BYTE_ARRAY(file, &(p_msg2_body->sign_gb_ga), + sizeof(p_msg2_body->sign_gb_ga)); + + fprintf(file, "MSG2 mac - "); + PRINT_BYTE_ARRAY(file, &(p_msg2_body->mac), sizeof(p_msg2_body->mac)); + + fprintf(file, "MSG2 sig_rl - "); + PRINT_BYTE_ARRAY(file, &(p_msg2_body->sig_rl), + p_msg2_body->sig_rl_size); + } + else if(response->type == TYPE_RA_ATT_RESULT) + { + sample_ra_att_result_msg_t *p_att_result = + (sample_ra_att_result_msg_t *)(response->body); + fprintf(file, "ATTESTATION RESULT MSG platform_info_blob - "); + PRINT_BYTE_ARRAY(file, &(p_att_result->platform_info_blob), + sizeof(p_att_result->platform_info_blob)); + + fprintf(file, "ATTESTATION RESULT MSG mac - "); + PRINT_BYTE_ARRAY(file, &(p_att_result->mac), sizeof(p_att_result->mac)); + + fprintf(file, "ATTESTATION RESULT MSG secret.payload_tag - %u bytes\n", + p_att_result->secret.payload_size); + + fprintf(file, "ATTESTATION RESULT MSG secret.payload - "); + PRINT_BYTE_ARRAY(file, p_att_result->secret.payload, + p_att_result->secret.payload_size); + } + else + { + fprintf(file, "\nERROR in printing out the response. " + "Response of type not supported %d\n", response->type); + } +} + +// This sample code doesn't have any recovery/retry mechanisms for the remote +// attestation. Since the enclave can be lost due S3 transitions, apps +// susceptible to S3 transtions should have logic to restart attestation in +// these scenenarios. +#define _T(x) x +int main(int argc, char* argv[]) +{ + int ret = 0; + ra_samp_request_header_t *p_msg1_full = NULL; + ra_samp_response_header_t *p_msg2_full = NULL; + sgx_ra_msg3_t *p_msg3 = NULL; + ra_samp_response_header_t* p_att_result_msg_full = NULL; + sgx_enclave_id_t enclave_id = 0; + int enclave_lost_retry_time = 1; + int busy_retry_time = 2; + sgx_ra_context_t context = INT_MAX; + sgx_status_t status = SGX_SUCCESS; + ra_samp_request_header_t* p_msg3_full = NULL; + + int32_t verify_index = -1; + int32_t verification_samples = sizeof(msg1_samples)/sizeof(msg1_samples[0]); + + FILE* OUTPUT = stdout; + +#define VERIFICATION_INDEX_IS_VALID() (verify_index > 0 && \ + verify_index <= verification_samples) +#define GET_VERIFICATION_ARRAY_INDEX() (verify_index-1) + + if(argc > 1) + { + + verify_index = atoi(argv[1]); + + if( VERIFICATION_INDEX_IS_VALID()) + { + fprintf(OUTPUT, "\nVerifying precomputed attestation messages " + "using precomputed values# %d\n", verify_index); + } + else + { + fprintf(OUTPUT, "\nValid invocations are:\n"); + fprintf(OUTPUT, "\n\tisv_app\n"); + fprintf(OUTPUT, "\n\tisv_app \n"); + fprintf(OUTPUT, "\nValid indices are [1 - %d]\n", + verification_samples); + fprintf(OUTPUT, "\nUsing a verification index uses precomputed " + "messages to assist debugging the remote attestation " + "service provider.\n"); + return -1; + } + } + + // Remote attestaton will be initiated the ISV server challenges the ISV + // app or if the ISV app detects it doesn't have the credentials + // (shared secret) from a previous attestation required for secure + // communication with the server. + { + // ISV application creates the ISV enclave. + int launch_token_update = 0; + sgx_launch_token_t launch_token = {0}; + memset(&launch_token, 0, sizeof(sgx_launch_token_t)); + do + { + ret = sgx_create_enclave(_T(ENCLAVE_PATH), + SGX_DEBUG_FLAG, + &launch_token, + &launch_token_update, + &enclave_id, NULL); + if(SGX_SUCCESS != ret) + { + ret = -1; + fprintf(OUTPUT, "\nError, call sgx_create_enclave fail [%s].", + __FUNCTION__); + return ret; + } + fprintf(OUTPUT, "\nCall sgx_create_enclave success."); + + ret = enclave_init_ra(enclave_id, + &status, + false, + &context); + //Ideally, this check would be around the full attestation flow. + } while (SGX_ERROR_ENCLAVE_LOST == ret && enclave_lost_retry_time--); + + if(SGX_SUCCESS != ret || status) + { + ret = -1; + fprintf(OUTPUT, "\nError, call enclave_init_ra fail [%s].", + __FUNCTION__); + goto CLEANUP; + } + fprintf(OUTPUT, "\nCall enclave_init_ra success."); + + // isv application call uke sgx_ra_get_msg1 + p_msg1_full = (ra_samp_request_header_t*) + malloc(sizeof(ra_samp_request_header_t) + + sizeof(sgx_ra_msg1_t)); + if(NULL == p_msg1_full) + { + ret = -1; + goto CLEANUP; + } + p_msg1_full->type = TYPE_RA_MSG1; + p_msg1_full->size = sizeof(sgx_ra_msg1_t); + do + { + ret = sgx_ra_get_msg1(context, enclave_id, sgx_ra_get_ga, + (sgx_ra_msg1_t*)((uint8_t*)p_msg1_full + + sizeof(ra_samp_request_header_t))); + } while (SGX_ERROR_BUSY == ret && busy_retry_time--); + if(SGX_SUCCESS != ret) + { + ret = -1; + fprintf(OUTPUT, "\nError, call sgx_ra_get_msg1 fail [%s].", + __FUNCTION__); + goto CLEANUP; + } + else + { + fprintf(OUTPUT, "\nCall sgx_ra_get_msg1 success.\n"); + + fprintf(OUTPUT, "\nMSG1 body generated -\n"); + + PRINT_BYTE_ARRAY(OUTPUT, p_msg1_full->body, p_msg1_full->size); + + } + + if(VERIFICATION_INDEX_IS_VALID()) + { + + memcpy_s(p_msg1_full->body, p_msg1_full->size, + msg1_samples[GET_VERIFICATION_ARRAY_INDEX()], + p_msg1_full->size); + + fprintf(OUTPUT, "\nInstead of using the recently generated MSG1, " + "we will use the following precomputed MSG1 -\n"); + + PRINT_BYTE_ARRAY(OUTPUT, p_msg1_full->body, p_msg1_full->size); + } + + + // The ISV application sends msg1 to the SP to get msg2, + // msg2 needs to be freed when no longer needed. + // The ISV decides whether to use linkable or unlinkable signatures. + fprintf(OUTPUT, "\nSending msg1 to remote attestation service provider." + "Expecting msg2 back.\n"); + + + ret = ra_network_send_receive("http://SampleServiceProvider.intel.com/", + p_msg1_full, + &p_msg2_full); + + if(ret != 0 || !p_msg2_full) + { + fprintf(OUTPUT, "\nError, ra_network_send_receive for msg1 failed " + "[%s].", __FUNCTION__); + if(VERIFICATION_INDEX_IS_VALID()) + { + fprintf(OUTPUT, "\nBecause we are in verification mode we will " + "ignore this error.\n"); + fprintf(OUTPUT, "\nInstead, we will pretend we received the " + "following MSG2 - \n"); + + SAFE_FREE(p_msg2_full); + ra_samp_response_header_t* precomputed_msg2 = + (ra_samp_response_header_t*)msg2_samples[ + GET_VERIFICATION_ARRAY_INDEX()]; + const size_t msg2_full_size = sizeof(ra_samp_response_header_t) + + precomputed_msg2->size; + p_msg2_full = + (ra_samp_response_header_t*)malloc(msg2_full_size); + if(NULL == p_msg2_full) + { + ret = -1; + goto CLEANUP; + } + memcpy_s(p_msg2_full, msg2_full_size, precomputed_msg2, + msg2_full_size); + + PRINT_BYTE_ARRAY(OUTPUT, p_msg2_full, + sizeof(ra_samp_response_header_t) + + p_msg2_full->size); + } + else + { + goto CLEANUP; + } + } + else + { + // Successfully sent msg1 and received a msg2 back. + // Time now to check msg2. + if(TYPE_RA_MSG2 != p_msg2_full->type) + { + + fprintf(OUTPUT, "\nError, didn't get MSG2 in response to MSG1. " + "[%s].", __FUNCTION__); + + if(VERIFICATION_INDEX_IS_VALID()) + { + fprintf(OUTPUT, "\nBecause we are in verification mode we " + "will ignore this error."); + } + else + { + goto CLEANUP; + } + } + + fprintf(OUTPUT, "\nSent MSG1 to remote attestation service " + "provider. Received the following MSG2:\n"); + PRINT_BYTE_ARRAY(OUTPUT, p_msg2_full, + sizeof(ra_samp_response_header_t) + + p_msg2_full->size); + + fprintf(OUTPUT, "\nA more descriptive representation of MSG2:\n"); + PRINT_ATTESTATION_SERVICE_RESPONSE(OUTPUT, p_msg2_full); + + if( VERIFICATION_INDEX_IS_VALID() ) + { + // The response should match the precomputed MSG2: + ra_samp_response_header_t* precomputed_msg2 = + (ra_samp_response_header_t *) + msg2_samples[GET_VERIFICATION_ARRAY_INDEX()]; + if(memcmp( precomputed_msg2, p_msg2_full, + sizeof(ra_samp_response_header_t) + p_msg2_full->size)) + { + fprintf(OUTPUT, "\nVerification ERROR. Our precomputed " + "value for MSG2 does NOT match.\n"); + fprintf(OUTPUT, "\nPrecomputed value for MSG2:\n"); + PRINT_BYTE_ARRAY(OUTPUT, precomputed_msg2, + sizeof(ra_samp_response_header_t) + + precomputed_msg2->size); + fprintf(OUTPUT, "\nA more descriptive representation " + "of precomputed value for MSG2:\n"); + PRINT_ATTESTATION_SERVICE_RESPONSE(OUTPUT, + precomputed_msg2); + } + else + { + fprintf(OUTPUT, "\nVerification COMPLETE. Remote " + "attestation service provider generated a " + "matching MSG2.\n"); + } + } + + } + + sgx_ra_msg2_t* p_msg2_body = (sgx_ra_msg2_t*)((uint8_t*)p_msg2_full + + sizeof(ra_samp_response_header_t)); + + + uint32_t msg3_size = 0; + if( VERIFICATION_INDEX_IS_VALID()) + { + // We cannot generate a valid MSG3 using the precomputed messages + // we have been using. We will use the precomputed msg3 instead. + msg3_size = MSG3_BODY_SIZE; + p_msg3 = (sgx_ra_msg3_t*)malloc(msg3_size); + if(NULL == p_msg3) + { + ret = -1; + goto CLEANUP; + } + memcpy_s(p_msg3, msg3_size, + msg3_samples[GET_VERIFICATION_ARRAY_INDEX()], msg3_size); + fprintf(OUTPUT, "\nBecause MSG1 was a precomputed value, the MSG3 " + "we use will also be. PRECOMPUTED MSG3 - \n"); + } + else + { + busy_retry_time = 2; + // The ISV app now calls uKE sgx_ra_proc_msg2, + // The ISV app is responsible for freeing the returned p_msg3!! + do + { + ret = sgx_ra_proc_msg2(context, + enclave_id, + sgx_ra_proc_msg2_trusted, + sgx_ra_get_msg3_trusted, + p_msg2_body, + p_msg2_full->size, + &p_msg3, + &msg3_size); + } while (SGX_ERROR_BUSY == ret && busy_retry_time--); + if(!p_msg3) + { + fprintf(OUTPUT, "\nError, call sgx_ra_proc_msg2 fail. " + "p_msg3 = 0x%p [%s].", p_msg3, __FUNCTION__); + ret = -1; + goto CLEANUP; + } + if(SGX_SUCCESS != (sgx_status_t)ret) + { + fprintf(OUTPUT, "\nError, call sgx_ra_proc_msg2 fail. " + "ret = 0x%08x [%s].", ret, __FUNCTION__); + ret = -1; + goto CLEANUP; + } + else + { + fprintf(OUTPUT, "\nCall sgx_ra_proc_msg2 success.\n"); + fprintf(OUTPUT, "\nMSG3 - \n"); + } + } + + PRINT_BYTE_ARRAY(OUTPUT, p_msg3, msg3_size); + + p_msg3_full = (ra_samp_request_header_t*)malloc( + sizeof(ra_samp_request_header_t) + msg3_size); + if(NULL == p_msg3_full) + { + ret = -1; + goto CLEANUP; + } + p_msg3_full->type = TYPE_RA_MSG3; + p_msg3_full->size = msg3_size; + if(memcpy_s(p_msg3_full->body, msg3_size, p_msg3, msg3_size)) + { + fprintf(OUTPUT,"\nError: INTERNAL ERROR - memcpy failed in [%s].", + __FUNCTION__); + ret = -1; + goto CLEANUP; + } + + // The ISV application sends msg3 to the SP to get the attestation + // result message, attestation result message needs to be freed when + // no longer needed. The ISV service provider decides whether to use + // linkable or unlinkable signatures. The format of the attestation + // result is up to the service provider. This format is used for + // demonstration. Note that the attestation result message makes use + // of both the MK for the MAC and the SK for the secret. These keys are + // established from the SIGMA secure channel binding. + ret = ra_network_send_receive("http://SampleServiceProvider.intel.com/", + p_msg3_full, + &p_att_result_msg_full); + if(ret || !p_att_result_msg_full) + { + ret = -1; + fprintf(OUTPUT, "\nError, sending msg3 failed [%s].", __FUNCTION__); + goto CLEANUP; + } + + + sample_ra_att_result_msg_t * p_att_result_msg_body = + (sample_ra_att_result_msg_t *)((uint8_t*)p_att_result_msg_full + + sizeof(ra_samp_response_header_t)); + if(TYPE_RA_ATT_RESULT != p_att_result_msg_full->type) + { + ret = -1; + fprintf(OUTPUT, "\nError. Sent MSG3 successfully, but the message " + "received was NOT of type att_msg_result. Type = " + "%d. [%s].", p_att_result_msg_full->type, + __FUNCTION__); + goto CLEANUP; + } + else + { + fprintf(OUTPUT, "\nSent MSG3 successfully. Received an attestation " + "result message back\n."); + if( VERIFICATION_INDEX_IS_VALID() ) + { + if(memcmp(p_att_result_msg_full->body, + attestation_msg_samples[GET_VERIFICATION_ARRAY_INDEX()], + p_att_result_msg_full->size) ) + { + fprintf(OUTPUT, "\nSent MSG3 successfully. Received an " + "attestation result message back that did " + "NOT match the expected value.\n"); + fprintf(OUTPUT, "\nEXPECTED ATTESTATION RESULT -"); + PRINT_BYTE_ARRAY(OUTPUT, + attestation_msg_samples[GET_VERIFICATION_ARRAY_INDEX()], + p_att_result_msg_full->size); + } + } + } + + fprintf(OUTPUT, "\nATTESTATION RESULT RECEIVED - "); + PRINT_BYTE_ARRAY(OUTPUT, p_att_result_msg_full->body, + p_att_result_msg_full->size); + + + if( VERIFICATION_INDEX_IS_VALID() ) + { + fprintf(OUTPUT, "\nBecause we used precomputed values for the " + "messages, the attestation result message will " + "not pass further verification tests, so we will " + "skip them.\n"); + goto CLEANUP; + } + + // Check the MAC using MK on the attestation result message. + // The format of the attestation result message is ISV specific. + // This is a simple form for demonstration. In a real product, + // the ISV may want to communicate more information. + ret = verify_att_result_mac(enclave_id, + &status, + context, + (uint8_t*)&p_att_result_msg_body->platform_info_blob, + sizeof(ias_platform_info_blob_t), + (uint8_t*)&p_att_result_msg_body->mac, + sizeof(sgx_mac_t)); + if((SGX_SUCCESS != ret) || + (SGX_SUCCESS != status)) + { + ret = -1; + fprintf(OUTPUT, "\nError: INTEGRITY FAILED - attestation result " + "message MK based cmac failed in [%s].", + __FUNCTION__); + goto CLEANUP; + } + + bool attestation_passed = true; + // Check the attestation result for pass or fail. + // @TODO: Check the status. This is ISV defined. + if(0 != p_att_result_msg_full->status[0] + || 0 != p_att_result_msg_full->status[1]) + { + fprintf(OUTPUT, "\nError, attestation result message MK based cmac " + "failed in [%s].", __FUNCTION__); + attestation_passed = false; + } + + // the SGX blob analysis API. The ISV will take action based on the + // update_info. (upgrade PSW or uCode), the second param should be 1 if + // the attestation failed, otherwise should be 0. + // sgx_update_info_bit_t update_info; + // ret = sgx_report_attestation_status( + // &p_att_result_msg_body->platform_info_blob, + // attestation_passed ? 0 : 1, &update_info); + // Get the shared secret sent by the server using SK (if attestation + // passed) + if(attestation_passed) + { + ret = put_secret_data(enclave_id, + &status, + context, + p_att_result_msg_body->secret.payload, + p_att_result_msg_body->secret.payload_size, + p_att_result_msg_body->secret.payload_tag); + if((SGX_SUCCESS != ret) || (SGX_SUCCESS != status)) + { + fprintf(OUTPUT, "\nError, attestation result message secret " + "using SK based AESGCM failed in [%s]. ret = " + "0x%0x. status = 0x%0x", __FUNCTION__, ret, + status); + goto CLEANUP; + } + } + fprintf(OUTPUT, "\nSecret successfully received from server."); + fprintf(OUTPUT, "\nRemote attestation success!"); + } + +CLEANUP: + // Clean-up + // Need to close the RA key state. + if(INT_MAX != context) + { + int ret_save = ret; + ret = enclave_ra_close(enclave_id, &status, context); + if(SGX_SUCCESS != ret || status) + { + ret = -1; + fprintf(OUTPUT, "\nError, call enclave_ra_close fail [%s].", + __FUNCTION__); + } + else + { + // enclave_ra_close was successful, let's restore the value that + // led us to this point in the code. + ret = ret_save; + } + fprintf(OUTPUT, "\nCall enclave_ra_close success."); + } + + sgx_destroy_enclave(enclave_id); + + + ra_free_network_response_buffer(p_msg2_full); + ra_free_network_response_buffer(p_att_result_msg_full); + + // p_msg3 is malloc'd by the untrused KE library. App needs to free. + SAFE_FREE(p_msg3); + SAFE_FREE(p_msg3_full); + SAFE_FREE(p_msg1_full); + printf("\nEnter a character before exit ...\n"); + getchar(); + return ret; +} + diff --git a/SampleCode/RemoteAttestation/isv_app/sample_messages.h b/SampleCode/RemoteAttestation/isv_app/sample_messages.h new file mode 100644 index 0000000000..92281777fa --- /dev/null +++ b/SampleCode/RemoteAttestation/isv_app/sample_messages.h @@ -0,0 +1,537 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +//This file contains samples of messages sent between the sample ISV application +//and the sample service provider. It is intended to be used so that authors +//of other service providers can verify that the messages generated by their +//remote attestation service matches. + +#include + +uint8_t msg1_sample1[] = +{ + 0xe8, 0xcf, 0xf, 0x97, 0x8a, 0xf4, 0x24, 0x8a, + 0xf5, 0x5b, 0x56, 0xf0, 0xac, 0x7f, 0x78, 0x39, + 0x71, 0x10, 0xb8, 0xdc, 0x88, 0xd, 0x50, 0xf0, + 0x39, 0x85, 0x37, 0xfe, 0xad, 0x1f, 0xc7, 0x59, + 0xc7, 0x23, 0x81, 0xfd, 0x4a, 0x2, 0x48, 0xdf, + 0xd3, 0x74, 0xda, 0x45, 0x48, 0x62, 0xc8, 0xb6, + 0x73, 0x43, 0x26, 0x42, 0x8f, 0x1f, 0x89, 0x17, + 0xe7, 0xa9, 0x2a, 0xf5, 0x27, 0xb3, 0xcc, 0x4d, + 0x3, 0x1, 0x0, 0x0 +}; + +uint8_t msg1_sample2[] = +{ + 0xa8, 0x56, 0x72, 0xc1, 0x14, 0x41, 0xa, 0x2f, + 0xdc, 0xb0, 0xa8, 0xa1, 0x3a, 0x51, 0x40, 0xf9, + 0x12, 0x9f, 0x11, 0x86, 0xe9, 0x1a, 0xf1, 0x16, + 0xbc, 0xd4, 0x6, 0x2f, 0x47, 0x2c, 0xc3, 0x37, + 0x8e, 0x65, 0x7, 0x29, 0x85, 0xb0, 0x8, 0x61, + 0x6b, 0x6d, 0xc7, 0x22, 0x7d, 0x22, 0x61, 0x7f, + 0x40, 0x43, 0x40, 0x5a, 0x7a, 0xf4, 0x94, 0x0, + 0x60, 0x36, 0xf6, 0xa4, 0x22, 0x22, 0x41, 0x82, + 0x3, 0x1, 0x0, 0x0 +}; + +uint8_t msg2_sample1[] = +{ + 0x2, 0x0, 0x0, 0xa8, 0x0, 0x0, 0x0, 0x0, + 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, + 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, + 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, + 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, + 0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, + 0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, + 0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, + 0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, + 0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x1, 0x0, 0x1, 0x0, 0x6a, 0x83, 0xdc, 0x84, + 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, + 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, + 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, + 0x5a, 0xb9, 0x9e, 0x97, 0x6, 0x10, 0x58, 0x61, + 0xa5, 0xbf, 0x7d, 0x2e, 0xab, 0xcc, 0x1a, 0x3e, + 0x4f, 0x44, 0x15, 0xe7, 0x91, 0xca, 0x64, 0x2b, + 0x42, 0xb7, 0x53, 0xd9, 0x71, 0x37, 0xf1, 0x9b, + 0x31, 0xb5, 0xa5, 0x6b, 0xf8, 0xfa, 0x64, 0xfe, + 0x7a, 0x9e, 0xdc, 0xf4, 0xf0, 0x59, 0xbd, 0x78, + 0x27, 0xc2, 0x55, 0xb9, 0x0, 0x0, 0x0, 0x0 +}; + +uint8_t msg2_sample2[] = +{ + 0x2, 0x0, 0x0, 0xa8, 0x0, 0x0, 0x0, 0x0, + 0x6a, 0x83, 0xdc, 0x84, 0xd4, 0x4c, 0x8a, 0xbb, + 0x5e, 0x42, 0xaf, 0xee, 0x8d, 0xe9, 0xf4, 0x57, + 0x71, 0xfd, 0x73, 0x66, 0xd7, 0xfa, 0xad, 0xfa, + 0xf2, 0x17, 0x14, 0xdd, 0x5a, 0xb9, 0x9e, 0x97, + 0x79, 0xa7, 0x38, 0x72, 0xf2, 0xb8, 0xd6, 0xbe, + 0x18, 0x91, 0x7f, 0xf7, 0xb5, 0xd3, 0xe5, 0x64, + 0x9b, 0x12, 0x18, 0xaf, 0x39, 0x29, 0x6c, 0x24, + 0x19, 0x38, 0x29, 0xb, 0xc6, 0xac, 0xc, 0x62, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, + 0x58, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x1, 0x0, 0x1, 0x0, 0x6a, 0x83, 0xdc, 0x84, + 0xd4, 0x4c, 0x8a, 0xbb, 0x5e, 0x42, 0xaf, 0xee, + 0x8d, 0xe9, 0xf4, 0x57, 0x71, 0xfd, 0x73, 0x66, + 0xd7, 0xfa, 0xad, 0xfa, 0xf2, 0x17, 0x14, 0xdd, + 0x5a, 0xb9, 0x9e, 0x97, 0x75, 0x39, 0x23, 0x1b, + 0xc2, 0x5a, 0xd4, 0xfa, 0x41, 0xe9, 0xd4, 0x42, + 0x72, 0x8a, 0x75, 0x4b, 0x48, 0x5a, 0xfb, 0xc0, + 0x90, 0x42, 0xef, 0x9c, 0xed, 0xcb, 0xc1, 0x45, + 0x2d, 0xfe, 0x86, 0xbc, 0xee, 0x3, 0xa8, 0x97, + 0x68, 0xf0, 0xb4, 0xf, 0xa, 0x5b, 0x5f, 0xc1, + 0xe4, 0xf9, 0xa9, 0xa6, 0x0, 0x0, 0x0, 0x0 +}; + +#define MSG3_BODY_SIZE 1452 + +uint8_t msg3_sample1[MSG3_BODY_SIZE] = +{ + 0x57, 0x19, 0x8, 0xa1, 0x3b, 0xd0, 0x37, 0xa8, + 0x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0x6d, 0x2d, + 0xad +}; diff --git a/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.config.xml b/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.config.xml new file mode 100644 index 0000000000..0b95a3edb1 --- /dev/null +++ b/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.config.xml @@ -0,0 +1,11 @@ + + 0 + 0 + 0x40000 + 0x100000 + 1 + 1 + 0 + 0 + 0xFFFFFFFF + \ No newline at end of file diff --git a/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp b/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp new file mode 100644 index 0000000000..1d8182e3a0 --- /dev/null +++ b/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "isv_enclave_t.h" +#include "sgx_tkey_exchange.h" +#include "sgx_tcrypto.h" +#include "string.h" + +// This is the public EC key of the SP. The corresponding private EC key is +// used by the SP to sign data used in the remote attestation SIGMA protocol +// to sign channel binding data in MSG2. A successful verification of the +// signature confirms the identity of the SP to the ISV app in remote +// attestation secure channel binding. The public EC key should be hardcoded in +// the enclave or delivered in a trustworthy manner. The use of a spoofed public +// EC key in the remote attestation with secure channel binding session may lead +// to a security compromise. Every different SP the enlcave communicates to +// must have a unique SP public key. Delivery of the SP public key is +// determined by the ISV. The TKE SIGMA protocl expects an Elliptical Curve key +// based on NIST P-256 +static const sgx_ec256_public_t g_sp_pub_key = { + { + 0x72, 0x12, 0x8a, 0x7a, 0x17, 0x52, 0x6e, 0xbf, + 0x85, 0xd0, 0x3a, 0x62, 0x37, 0x30, 0xae, 0xad, + 0x3e, 0x3d, 0xaa, 0xee, 0x9c, 0x60, 0x73, 0x1d, + 0xb0, 0x5b, 0xe8, 0x62, 0x1c, 0x4b, 0xeb, 0x38 + }, + { + 0xd4, 0x81, 0x40, 0xd9, 0x50, 0xe2, 0x57, 0x7b, + 0x26, 0xee, 0xb7, 0x41, 0xe7, 0xc6, 0x14, 0xe2, + 0x24, 0xb7, 0xbd, 0xc9, 0x03, 0xf2, 0x9a, 0x28, + 0xa8, 0x3c, 0xc8, 0x10, 0x11, 0x14, 0x5e, 0x06 + } + +}; + +// Used to store the secret passed by the SP in the sample code. The +// size is forced to be 8 bytes. Expected value is +// 0x01,0x02,0x03,0x04,0x0x5,0x0x6,0x0x7 +uint8_t g_secret[8] = {0}; + + +// This ecall is a wrapper of sgx_ra_init to create the trusted +// KE exchange key context needed for the remote attestation +// SIGMA API's. Input pointers aren't checked since the trusted stubs +// copy them into EPC memory. +// +// @param b_pse Indicates whether the ISV app is using the +// platform services. +// @param p_context Pointer to the location where the returned +// key context is to be copied. +// +// @return Any error return from the create PSE session if b_pse +// is true. +// @return Any error returned from the trusted key exchange API +// for creating a key context. + +sgx_status_t enclave_init_ra( + int b_pse, + sgx_ra_context_t *p_context) +{ + // isv enclave call to trusted key exchange library. + sgx_status_t ret; + if(b_pse) + { + int busy_retry_times = 2; + do{ + ret = sgx_create_pse_session(); + }while (ret == SGX_ERROR_BUSY && busy_retry_times--); + if (ret != SGX_SUCCESS) + return ret; + } + ret = sgx_ra_init(&g_sp_pub_key, b_pse, p_context); + if(b_pse) + { + sgx_close_pse_session(); + return ret; + } + return ret; +} + + +// Closes the tKE key context used during the SIGMA key +// exchange. +// +// @param context The trusted KE library key context. +// +// @return Return value from the key context close API + +sgx_status_t SGXAPI enclave_ra_close( + sgx_ra_context_t context) +{ + sgx_status_t ret; + ret = sgx_ra_close(context); + return ret; +} + + +// Verify the mac sent in att_result_msg from the SP using the +// MK key. Input pointers aren't checked since the trusted stubs +// copy them into EPC memory. +// +// +// @param context The trusted KE library key context. +// @param p_message Pointer to the message used to produce MAC +// @param message_size Size in bytes of the message. +// @param p_mac Pointer to the MAC to compare to. +// @param mac_size Size in bytes of the MAC +// +// @return SGX_ERROR_INVALID_PARAMETER - MAC size is incorrect. +// @return Any error produced by tKE API to get SK key. +// @return Any error produced by the AESCMAC function. +// @return SGX_ERROR_MAC_MISMATCH - MAC compare fails. + +sgx_status_t verify_att_result_mac(sgx_ra_context_t context, + uint8_t* p_message, + size_t message_size, + uint8_t* p_mac, + size_t mac_size) +{ + sgx_status_t ret; + sgx_ec_key_128bit_t mk_key; + + if(mac_size != sizeof(sgx_mac_t)) + { + ret = SGX_ERROR_INVALID_PARAMETER; + return ret; + } + if(message_size > UINT32_MAX) + { + ret = SGX_ERROR_INVALID_PARAMETER; + return ret; + } + + do { + uint8_t mac[SGX_CMAC_MAC_SIZE] = {0}; + + ret = sgx_ra_get_keys(context, SGX_RA_KEY_MK, &mk_key); + if(SGX_SUCCESS != ret) + { + break; + } + ret = sgx_rijndael128_cmac_msg(&mk_key, + p_message, + (uint32_t)message_size, + &mac); + if(SGX_SUCCESS != ret) + { + break; + } + if(0 == consttime_memequal(p_mac, mac, sizeof(mac))) + { + ret = SGX_ERROR_MAC_MISMATCH; + break; + } + + } + while(0); + + return ret; +} + + +// Generate a secret information for the SP encrypted with SK. +// Input pointers aren't checked since the trusted stubs copy +// them into EPC memory. +// +// @param context The trusted KE library key context. +// @param p_secret Message containing the secret. +// @param secret_size Size in bytes of the secret message. +// @param p_gcm_mac The pointer the the AESGCM MAC for the +// message. +// +// @return SGX_ERROR_INVALID_PARAMETER - secret size if +// incorrect. +// @return Any error produced by tKE API to get SK key. +// @return Any error produced by the AESGCM function. +// @return SGX_ERROR_UNEXPECTED - the secret doesn't match the +// expected value. + +sgx_status_t put_secret_data( + sgx_ra_context_t context, + uint8_t *p_secret, + uint32_t secret_size, + uint8_t *p_gcm_mac) +{ + sgx_status_t ret = SGX_SUCCESS; + sgx_ec_key_128bit_t sk_key; + + do { + if(secret_size != 8) + { + ret = SGX_ERROR_INVALID_PARAMETER; + break; + } + + ret = sgx_ra_get_keys(context, SGX_RA_KEY_SK, &sk_key); + if(SGX_SUCCESS != ret) + { + break; + } + + uint8_t aes_gcm_iv[12] = {0}; + ret = sgx_rijndael128GCM_decrypt(&sk_key, + p_secret, + secret_size, + &g_secret[0], + &aes_gcm_iv[0], + 12, + NULL, + 0, + (const sgx_aes_gcm_128bit_tag_t *) + (p_gcm_mac)); + + uint32_t i; + bool secret_match = true; + for(i=0;i +#include +#include "ecp.h" + +#include "sample_libcrypto.h" + + +#define MAC_KEY_SIZE 16 + +errno_t memcpy_s( + void *dest, + size_t numberOfElements, + const void *src, + size_t count) +{ + if(numberOfElements +#include + +#include "remote_attestation_result.h" + +#ifndef SAMPLE_FEBITSIZE +#define SAMPLE_FEBITSIZE 256 +#endif + +#define SAMPLE_ECP_KEY_SIZE (SAMPLE_FEBITSIZE/8) + +typedef struct sample_ec_priv_t +{ + uint8_t r[SAMPLE_ECP_KEY_SIZE]; +} sample_ec_priv_t; + +typedef struct sample_ec_dh_shared_t +{ + uint8_t s[SAMPLE_ECP_KEY_SIZE]; +}sample_ec_dh_shared_t; + +typedef uint8_t sample_ec_key_128bit_t[16]; + +#define SAMPLE_EC_MAC_SIZE 16 + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif +errno_t memcpy_s(void *dest, size_t numberOfElements, const void *src, + size_t count); + + +typedef enum _sample_derive_key_type_t +{ + SAMPLE_DERIVE_KEY_SMK = 0, + SAMPLE_DERIVE_KEY_SK, + SAMPLE_DERIVE_KEY_MK, + SAMPLE_DERIVE_KEY_VK, +} sample_derive_key_type_t; + +bool derive_key( + const sample_ec_dh_shared_t *p_shared_key, + uint8_t key_id, + sample_ec_key_128bit_t *derived_key); + +bool verify_cmac128( + sample_ec_key_128bit_t mac_key, + const uint8_t *p_data_buf, + uint32_t buf_size, + const uint8_t *p_mac_buf); +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp b/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp new file mode 100644 index 0000000000..e39d1b1942 --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp @@ -0,0 +1,258 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "service_provider.h" +#include "sample_libcrypto.h" +#include "ecp.h" +#include +#include +#include +#include +#include +#include "ias_ra.h" + +// @TODO: This whole file is used as simulation of the interfaces to be +// delivered the IAS. Once the interface definitions are made available by the +// IAS, this file should be changed accordingly. + +#define UNUSED(expr) do { (void)(expr); } while (0) + +#if !defined(SWAP_ENDIAN_DW) + #define SWAP_ENDIAN_DW(dw) ((((dw) & 0x000000ff) << 24) \ + | (((dw) & 0x0000ff00) << 8) \ + | (((dw) & 0x00ff0000) >> 8) \ + | (((dw) & 0xff000000) >> 24)) +#endif +#if !defined(SWAP_ENDIAN_32B) + #define SWAP_ENDIAN_32B(ptr) \ +{\ + unsigned int temp = 0; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[0]); \ + ((unsigned int*)(ptr))[0] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[7]); \ + ((unsigned int*)(ptr))[7] = temp; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[1]); \ + ((unsigned int*)(ptr))[1] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[6]); \ + ((unsigned int*)(ptr))[6] = temp; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[2]); \ + ((unsigned int*)(ptr))[2] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[5]); \ + ((unsigned int*)(ptr))[5] = temp; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[3]); \ + ((unsigned int*)(ptr))[3] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[4]); \ + ((unsigned int*)(ptr))[4] = temp; \ +} +#endif + +// This is the ECDSA NIST P-256 private key used to sign platform_info_blob. +// This private +// key and the public key in SDK untrusted KElibrary should be a temporary key +// pair. For production parts the IAS will sign the platform_info_blob with the +// production private key and the SDK untrusted KE library will have the public +// key for verifcation. +// @TODO: This key will will not be available when the production backend +// is avaialbe. The remote attestation sample will need to change to use the +// real backend. This will likely be an RSA2048 type of key. +static const sample_ec256_private_t g_rk_priv_key = +{{ + 0x63,0x2c,0xd4,0x02,0x7a,0xdc,0x56,0xa5, + 0x59,0x6c,0x44,0x3e,0x43,0xca,0x4e,0x0b, + 0x58,0xcd,0x78,0xcb,0x3c,0x7e,0xd5,0xb9, + 0xf2,0x91,0x5b,0x39,0x0d,0xb3,0xb5,0xfb +}}; + +static sample_spid_t g_sim_spid = {"Service X"}; + + +// Simulates the IAS function for verifying the quote produce by +// the ISV enclave. It doesn't decrypt or verify the quote in +// the simulation. Just produces the attestaion verification +// report with the platform info blob. +// +// @param p_isv_quote Pointer to the quote generated by the ISV +// enclave. +// @param pse_manifest Pointer to the PSE manifest if used. +// @param p_attestation_verification_report Pointer the outputed +// verification report. +// +// @return int + +int ias_verify_attestation_evidence( + sample_quote_t *p_isv_quote, + uint8_t* pse_manifest, + ias_att_report_t* p_attestation_verification_report) +{ + int ret = 0; + sample_ecc_state_handle_t ecc_state = NULL; + + //unused parameters + UNUSED(pse_manifest); + + if((NULL == p_isv_quote) || + (NULL == p_attestation_verification_report)) + { + return -1; + } + //Decrypt the Quote signature and verify. + + p_attestation_verification_report->id = 0x12345678; + p_attestation_verification_report->status = IAS_QUOTE_OK; + p_attestation_verification_report->revocation_reason = + IAS_REVOC_REASON_NONE; + p_attestation_verification_report->info_blob.sample_epid_group_status = + 0 << IAS_EPID_GROUP_STATUS_REVOKED_BIT_POS + | 0 << IAS_EPID_GROUP_STATUS_REKEY_AVAILABLE_BIT_POS; + p_attestation_verification_report->info_blob.sample_tcb_evaluation_status = + 0 << IAS_TCB_EVAL_STATUS_CPUSVN_OUT_OF_DATE_BIT_POS + | 0 << IAS_TCB_EVAL_STATUS_ISVSVN_OUT_OF_DATE_BIT_POS; + p_attestation_verification_report->info_blob.pse_evaluation_status = + 0 << IAS_PSE_EVAL_STATUS_ISVSVN_OUT_OF_DATE_BIT_POS + | 0 << IAS_PSE_EVAL_STATUS_EPID_GROUP_REVOKED_BIT_POS + | 0 << IAS_PSE_EVAL_STATUS_PSDASVN_OUT_OF_DATE_BIT_POS + | 0 << IAS_PSE_EVAL_STATUS_SIGRL_OUT_OF_DATE_BIT_POS + | 0 << IAS_PSE_EVAL_STATUS_PRIVRL_OUT_OF_DATE_BIT_POS; + memset(p_attestation_verification_report-> + info_blob.latest_equivalent_tcb_psvn, 0, PSVN_SIZE); + memset(p_attestation_verification_report->info_blob.latest_pse_isvsvn, + 0, ISVSVN_SIZE); + memset(p_attestation_verification_report->info_blob.latest_psda_svn, + 0, PSDA_SVN_SIZE); + memset(p_attestation_verification_report->info_blob.performance_rekey_gid, + 0, GID_SIZE); + + // @TODO: Product signing algorithm still TBD. May be RSA2048 signing. + // Generate the Service providers ECCDH key pair. + do { + ret = sample_ecc256_open_context(&ecc_state); + if (SAMPLE_SUCCESS != ret) { + fprintf(stderr, "\nError, cannot get ECC cotext in [%s].", + __FUNCTION__); + ret = -1; + break; + } + // Sign + ret = sample_ecdsa_sign( + (uint8_t *)&p_attestation_verification_report-> + info_blob.sample_epid_group_status, + sizeof(ias_platform_info_blob_t) - sizeof(sample_ec_sign256_t), + (sample_ec256_private_t *)&g_rk_priv_key, + (sample_ec256_signature_t *)&p_attestation_verification_report-> + info_blob.signature, + ecc_state); + if (SAMPLE_SUCCESS != ret) { + fprintf(stderr, "\nError, sign ga_gb fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + SWAP_ENDIAN_32B(p_attestation_verification_report-> + info_blob.signature.x); + SWAP_ENDIAN_32B(p_attestation_verification_report-> + info_blob.signature.y); + + }while (0); + if (ecc_state) { + sample_ecc256_close_context(ecc_state); + } + p_attestation_verification_report->pse_status = IAS_PSE_OK; + + // For now, don't simulate the policy reports. + p_attestation_verification_report->policy_report_size = 0; + return(ret); +} + + +// Simulates retrieving the SIGRL for upon the SP request. Becaue the IAS +// backend is not ready right now, we will return NULL. +// +// @param gid Group ID for the EPID key. +// @param p_sig_rl_size Pointer to the output value of the full +// SIGRL size in bytes. (including the +// signature). +// @param p_sig_rl Pointer to the output of the SIGRL. +// +// @return int + +int ias_get_sigrl( + const sample_epid_group_id_t gid, + uint32_t *p_sig_rl_size, + uint8_t **p_sig_rl) +{ + int ret = 0; + + UNUSED(gid); + + do { + + if (NULL == p_sig_rl || NULL == p_sig_rl_size) { + ret = -1; + break; + } + *p_sig_rl_size = 0; + *p_sig_rl = NULL; + // we should try to get sig_rl from IAS, but right now we will just + // skip it until the IAS backend is ready. + break; + }while (0); + + return(ret); +} + + +// Used to simulate the enrollment function of the IAS. It only +// gives back the SPID right now. In production, the enrollment +// occurs out of context from an attestation attempt and only +// occurs once. +// +// +// @param sp_credentials +// @param p_spid +// @param p_authentication_token +// +// @return int + +int ias_enroll( + int sp_credentials, + sample_spid_t *p_spid, + int *p_authentication_token) +{ + UNUSED(sp_credentials); + UNUSED(p_authentication_token); + + if (NULL != p_spid) { + memcpy_s(p_spid, sizeof(sample_spid_t), &g_sim_spid, + sizeof(sample_spid_t)); + } else { + return(1); + } + return(0); +} + + diff --git a/SampleCode/RemoteAttestation/service_provider/ias_ra.h b/SampleCode/RemoteAttestation/service_provider/ias_ra.h new file mode 100644 index 0000000000..6230eb4e53 --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/ias_ra.h @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _IAS_RA_H +#define _IAS_RA_H + +#include "ecp.h" + +// These status should align with the definition in IAS API spec(rev 0.6) +typedef enum { + IAS_QUOTE_OK, + IAS_QUOTE_SIGNATURE_INVALID, + IAS_QUOTE_GROUP_REVOKED, + IAS_QUOTE_SIGNATURE_REVOKED, + IAS_QUOTE_KEY_REVOKED, + IAS_QUOTE_SIGRL_VERSION_MISMATCH, + IAS_QUOTE_GROUP_OUT_OF_DATE, +} ias_quote_status_t; + +// These status should align with the definition in IAS API spec(rev 0.6) +typedef enum { + IAS_PSE_OK, + IAS_PSE_DESC_TYPE_NOT_SUPPORTED, + IAS_PSE_ISVSVN_OUT_OF_DATE, + IAS_PSE_MISCSELECT_INVALID, + IAS_PSE_ATTRIBUTES_INVALID, + IAS_PSE_MRSIGNER_INVALID, + IAS_PS_HW_GID_REVOKED, + IAS_PS_HW_PRIVKEY_RLVER_MISMATCH, + IAS_PS_HW_SIG_RLVER_MISMATCH, + IAS_PS_HW_CA_ID_INVALID, + IAS_PS_HW_SEC_INFO_INVALID, + IAS_PS_HW_PSDA_SVN_OUT_OF_DATE, +} ias_pse_status_t; + +// Revocation Reasons from RFC5280 +typedef enum { + IAS_REVOC_REASON_NONE, + IAS_REVOC_REASON_KEY_COMPROMISE, + IAS_REVOC_REASON_CA_COMPROMISED, + IAS_REVOC_REASON_SUPERCEDED, + IAS_REVOC_REASON_CESSATION_OF_OPERATION, + IAS_REVOC_REASON_CERTIFICATE_HOLD, + IAS_REVOC_REASON_PRIVILEGE_WITHDRAWN, + IAS_REVOC_REASON_AA_COMPROMISE, +} ias_revoc_reason_t; + +// These status should align with the definition in IAS API spec(rev 0.6) +#define IAS_EPID_GROUP_STATUS_REVOKED_BIT_POS 0x00 +#define IAS_EPID_GROUP_STATUS_REKEY_AVAILABLE_BIT_POS 0x01 + +#define IAS_TCB_EVAL_STATUS_CPUSVN_OUT_OF_DATE_BIT_POS 0x00 +#define IAS_TCB_EVAL_STATUS_ISVSVN_OUT_OF_DATE_BIT_POS 0x01 + +#define IAS_PSE_EVAL_STATUS_ISVSVN_OUT_OF_DATE_BIT_POS 0x00 +#define IAS_PSE_EVAL_STATUS_EPID_GROUP_REVOKED_BIT_POS 0x01 +#define IAS_PSE_EVAL_STATUS_PSDASVN_OUT_OF_DATE_BIT_POS 0x02 +#define IAS_PSE_EVAL_STATUS_SIGRL_OUT_OF_DATE_BIT_POS 0x03 +#define IAS_PSE_EVAL_STATUS_PRIVRL_OUT_OF_DATE_BIT_POS 0x04 + +// These status should align with the definition in IAS API spec(rev 0.6) +#define ISVSVN_SIZE 2 +#define PSDA_SVN_SIZE 4 +#define GID_SIZE 4 +#define PSVN_SIZE 18 + +#define SAMPLE_HASH_SIZE 32 // SHA256 +#define SAMPLE_MAC_SIZE 16 // Message Authentication Code + // - 16 bytes + +#define SAMPLE_REPORT_DATA_SIZE 64 + +typedef uint8_t sample_measurement_t[SAMPLE_HASH_SIZE]; +typedef uint8_t sample_mac_t[SAMPLE_MAC_SIZE]; +typedef uint8_t sample_report_data_t[SAMPLE_REPORT_DATA_SIZE]; +typedef uint16_t sample_prod_id_t; + +#define SAMPLE_CPUSVN_SIZE 16 + +typedef uint8_t sample_cpu_svn_t[SAMPLE_CPUSVN_SIZE]; +typedef uint16_t sample_isv_svn_t; + +typedef struct sample_attributes_t +{ + uint64_t flags; + uint64_t xfrm; +} sample_attributes_t; + +typedef struct sample_report_body_t { + sample_cpu_svn_t cpu_svn; // ( 0) Security Version of the CPU + uint8_t reserved1[32]; // ( 16) + sample_attributes_t attributes; // ( 48) Any special Capabilities + // the Enclave possess + sample_measurement_t mr_enclave; // ( 64) The value of the enclave's + // ENCLAVE measurement + uint8_t reserved2[32]; // ( 96) + sample_measurement_t mr_signer; // (128) The value of the enclave's + // SIGNER measurement + uint8_t reserved3[32]; // (160) + sample_measurement_t mr_reserved1; // (192) + sample_measurement_t mr_reserved2; // (224) + sample_prod_id_t isv_prod_id; // (256) Product ID of the Enclave + sample_isv_svn_t isv_svn; // (258) Security Version of the + // Enclave + uint8_t reserved4[60]; // (260) + sample_report_data_t report_data; // (320) Data provided by the user +} sample_report_body_t; + +#pragma pack(push, 1) + + +// This is a context data structure used in SP side +// @TODO: Modify at production to use the values specified by the Production +// IAS API +typedef struct _ias_att_report_t +{ + uint32_t id; + ias_quote_status_t status; + uint32_t revocation_reason; + ias_platform_info_blob_t info_blob; + ias_pse_status_t pse_status; + uint32_t policy_report_size; + + uint8_t policy_report[];// IAS_Q: Why does it specify a + // list of reports? + + +} ias_att_report_t; + +typedef uint8_t sample_epid_group_id_t[4]; + +typedef struct sample_spid_t +{ + uint8_t id[16]; +} sample_spid_t; + +typedef struct sample_basename_t +{ + uint8_t name[32]; +} sample_basename_t; + + +typedef struct sample_quote_nonce_t +{ + uint8_t rand[16]; +} sample_quote_nonce_t; + +#define SAMPLE_QUOTE_UNLINKABLE_SIGNATURE 0 +#define SAMPLE_QUOTE_LINKABLE_SIGNATURE 1 + +typedef struct sample_quote_t { + uint16_t version; // 0 + uint16_t sign_type; // 2 + sample_epid_group_id_t epid_group_id; // 4 + sample_isv_svn_t qe_svn; // 8 + uint8_t reserved[6]; // 10 + sample_basename_t basename; // 16 + sample_report_body_t report_body; // 48 + uint32_t signature_len; // 432 + uint8_t signature[]; // 436 +} sample_quote_t; + +#pragma pack(pop) + +#ifdef __cplusplus +extern "C" { +#endif + +int ias_enroll(int sp_credentials, sample_spid_t* spid, + int* authentication_token); +int ias_get_sigrl(const sample_epid_group_id_t gid, uint32_t* p_sig_rl_size, + uint8_t** p_sig_rl); +int ias_verify_attestation_evidence(sample_quote_t* p_isv_quote, + uint8_t* pse_manifest, + ias_att_report_t* attestation_verification_report); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/RemoteAttestation/service_provider/network_ra.cpp b/SampleCode/RemoteAttestation/service_provider/network_ra.cpp new file mode 100644 index 0000000000..3db2be3973 --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/network_ra.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include +#include +#include +#include "network_ra.h" +#include "service_provider.h" + + +// Used to send requests to the service provider sample. It +// simulates network communication between the ISV app and the +// ISV service provider. This would be modified in a real +// product to use the proper IP communication. +// +// @param server_url String name of the server URL +// @param p_req Pointer to the message to be sent. +// @param p_resp Pointer to a pointer of the response message. + +// @return int + +int ra_network_send_receive(const char *server_url, + const ra_samp_request_header_t *p_req, + ra_samp_response_header_t **p_resp) +{ + int ret = 0; + ra_samp_response_header_t* p_resp_msg; + + if((NULL == server_url) || + (NULL == p_req) || + (NULL == p_resp)) + { + return -1; + } + + switch(p_req->type) + { + + case TYPE_RA_MSG1: + ret = sp_ra_proc_msg1_req((const sample_ra_msg1_t*)((uint8_t*)p_req + + sizeof(ra_samp_request_header_t)), + p_req->size, + &p_resp_msg); + if(0 != ret) + { + fprintf(stderr, "\nError, call sp_ra_proc_msg1_req fail [%s].", + __FUNCTION__); + } + else + { + *p_resp = p_resp_msg; + } + break; + + case TYPE_RA_MSG3: + ret =sp_ra_proc_msg3_req((const sample_ra_msg3_t*)((uint8_t*)p_req + + sizeof(ra_samp_request_header_t)), + p_req->size, + &p_resp_msg); + if(0 != ret) + { + fprintf(stderr, "\nError, call sp_ra_proc_msg3_req fail [%s].", + __FUNCTION__); + } + else + { + *p_resp = p_resp_msg; + } + break; + + default: + ret = -1; + fprintf(stderr, "\nError, unknown ra message type. Type = %d [%s].", + p_req->type, __FUNCTION__); + break; + } + + return ret; +} + +// Used to free the response messages. In the sample code, the +// response messages are allocated by the SP code. +// +// +// @param resp Pointer to the response buffer to be freed. + +void ra_free_network_response_buffer(ra_samp_response_header_t *resp) +{ + if(resp!=NULL) + { + free(resp); + } +} diff --git a/SampleCode/RemoteAttestation/service_provider/network_ra.h b/SampleCode/RemoteAttestation/service_provider/network_ra.h new file mode 100644 index 0000000000..bd7fdb7108 --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/network_ra.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _NETWORK_RA_H +#define _NETWORK_RA_H + + +// Enum for all possible message types between the ISV app and +// the ISV SP. Requests and responses in hte remote attestation +// sample. +typedef enum _ra_msg_type_t +{ + TYPE_RA_MSG1 = 1, + TYPE_RA_MSG2, + TYPE_RA_MSG3, + TYPE_RA_ATT_RESULT, +}ra_msg_type_t; + +// Enum for all possible message types between the SP and IAS. +// Network communication is not simulated in the remote +// attestation sample. Currently these aren't used. +typedef enum _ias_msg_type_t +{ + TYPE_IAS_ENROLL, + TYPE_IAS_GET_SIGRL, + TYPE_IAS_SIGRL, + TYPE_IAS_ATT_EVIDENCE, + TYPE_IAS_ATT_RESULT, +}ias_msg_type_t; + +#pragma pack(1) +typedef struct _ra_samp_request_header_t{ + uint8_t type; // set to one of ra_msg_type_t + uint32_t size; //size of request body, + uint8_t align[3]; + uint8_t body[]; +}ra_samp_request_header_t; + +typedef struct _ra_samp_response_header_t{ + uint8_t type; // set to one of ra_msg_type_t + uint8_t status[2]; + uint32_t size; //size of the response body + uint8_t align[1]; + uint8_t body[]; +}ra_samp_response_header_t; + +#pragma pack() + +#ifdef __cplusplus +extern "C" { +#endif + +int ra_network_send_receive(const char *server_url, + const ra_samp_request_header_t *req, + ra_samp_response_header_t **p_resp); +void ra_free_network_response_buffer(ra_samp_response_header_t *resp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h b/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h new file mode 100644 index 0000000000..5e6121cd11 --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _REMOTE_ATTESTATION_RESULT_H_ +#define _REMOTE_ATTESTATION_RESULT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define SAMPLE_MAC_SIZE 16 // Message Authentication Code + // - 16 bytes +typedef uint8_t sample_mac_t[SAMPLE_MAC_SIZE]; + +#ifndef SAMPLE_FEBITSIZE + #define SAMPLE_FEBITSIZE 256 +#endif + +#define SAMPLE_NISTP256_KEY_SIZE (SAMPLE_FEBITSIZE/ 8 /sizeof(uint32_t)) + +typedef struct sample_ec_sign256_t +{ + uint32_t x[SAMPLE_NISTP256_KEY_SIZE]; + uint32_t y[SAMPLE_NISTP256_KEY_SIZE]; +} sample_ec_sign256_t; + +#pragma pack(push,1) + +#define SAMPLE_SP_TAG_SIZE 16 + +typedef struct sp_aes_gcm_data_t { + uint32_t payload_size; // 0: Size of the payload which is + // encrypted + uint8_t reserved[12]; // 4: Reserved bits + uint8_t payload_tag[SAMPLE_SP_TAG_SIZE]; + // 16: AES-GMAC of the plain text, + // payload, and the sizes + uint8_t payload[]; // 32: Ciphertext of the payload + // followed by the plain text +} sp_aes_gcm_data_t; + + +#define ISVSVN_SIZE 2 +#define PSDA_SVN_SIZE 4 +#define GID_SIZE 4 +#define PSVN_SIZE 18 + +// @TODO: Modify at production to use the values specified by the Production +// IAS API +typedef struct ias_platform_info_blob_t +{ + uint8_t sample_epid_group_status; + uint16_t sample_tcb_evaluation_status; + uint16_t pse_evaluation_status; + uint8_t latest_equivalent_tcb_psvn[PSVN_SIZE]; + uint8_t latest_pse_isvsvn[ISVSVN_SIZE]; + uint8_t latest_psda_svn[PSDA_SVN_SIZE]; + uint8_t performance_rekey_gid[GID_SIZE]; + sample_ec_sign256_t signature; +} ias_platform_info_blob_t; + + +typedef struct sample_ra_att_result_msg_t { + ias_platform_info_blob_t platform_info_blob; + sample_mac_t mac; // mac_smk(attestation_status) + sp_aes_gcm_data_t secret; +} sample_ra_att_result_msg_t; + +#pragma pack(pop) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/RemoteAttestation/service_provider/service_provider.cpp b/SampleCode/RemoteAttestation/service_provider/service_provider.cpp new file mode 100644 index 0000000000..3736951d03 --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/service_provider.cpp @@ -0,0 +1,660 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "service_provider.h" + +#include "sample_libcrypto.h" + +#include "ecp.h" + +#include +#include +#include +#include +#include +#include "ias_ra.h" + +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr) = NULL;}} +#endif + +// This is the private EC key of SP, the corresponding public EC key is +// hard coded in isv_enclave. It is based on NIST P-256 curve. +static const sample_ec256_private_t g_sp_priv_key = { + { + 0x90, 0xe7, 0x6c, 0xbb, 0x2d, 0x52, 0xa1, 0xce, + 0x3b, 0x66, 0xde, 0x11, 0x43, 0x9c, 0x87, 0xec, + 0x1f, 0x86, 0x6a, 0x3b, 0x65, 0xb6, 0xae, 0xea, + 0xad, 0x57, 0x34, 0x53, 0xd1, 0x03, 0x8c, 0x01 + } +}; + +// This is the public EC key of SP, this key is hard coded in isv_enclave. +// It is based on NIST P-256 curve. Not used in the SP code. +static const sample_ec_pub_t g_sp_pub_key = { + { + 0x72, 0x12, 0x8a, 0x7a, 0x17, 0x52, 0x6e, 0xbf, + 0x85, 0xd0, 0x3a, 0x62, 0x37, 0x30, 0xae, 0xad, + 0x3e, 0x3d, 0xaa, 0xee, 0x9c, 0x60, 0x73, 0x1d, + 0xb0, 0x5b, 0xe8, 0x62, 0x1c, 0x4b, 0xeb, 0x38 + }, + { + 0xd4, 0x81, 0x40, 0xd9, 0x50, 0xe2, 0x57, 0x7b, + 0x26, 0xee, 0xb7, 0x41, 0xe7, 0xc6, 0x14, 0xe2, + 0x24, 0xb7, 0xbd, 0xc9, 0x03, 0xf2, 0x9a, 0x28, + 0xa8, 0x3c, 0xc8, 0x10, 0x11, 0x14, 0x5e, 0x06 + } +}; + +// This is a context data structure used on SP side +typedef struct _sp_db_item_t +{ + sample_ec_pub_t g_a; + sample_ec_pub_t g_b; + sample_ec_key_128bit_t vk_key;// Shared secret key for the REPORT_DATA + sample_ec_key_128bit_t mk_key;// Shared secret key for generating MAC's + sample_ec_key_128bit_t sk_key;// Shared secret key for encryption + sample_ec_key_128bit_t smk_key;// Used only for SIGMA protocol + sample_ec_priv_t b; + sample_ps_sec_prop_desc_t ps_sec_prop; +}sp_db_item_t; +static sp_db_item_t g_sp_db; + +static bool g_is_sp_registered = false; +static int g_sp_credentials = 0; +static int g_authentication_token = 0; + +uint8_t g_secret[8] = {0,1,2,3,4,5,6,7}; + +sample_spid_t g_spid; + +// Verify message 1 then generate and return message 2 to isv. +int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, + uint32_t msg1_size, + ra_samp_response_header_t **pp_msg2) +{ + int ret = 0; + ra_samp_response_header_t* p_msg2_full = NULL; + sample_ra_msg2_t *p_msg2 = NULL; + sample_ecc_state_handle_t ecc_state = NULL; + sample_status_t sample_ret = SAMPLE_SUCCESS; + bool derive_ret = false; + + if(!p_msg1 || + !pp_msg2 || + (msg1_size != sizeof(sample_ra_msg1_t))) + { + return -1; + } + + do + { + // Check to see if we have registered with the IAS yet? + if(!g_is_sp_registered) + { + do + { + // @IAS_Q: What are the sp credentials? + // @IAS_Q: What is in the authentication token + // In the product, the SP will establish a mutually + // authenticated SSL channel. The authentication token is + // based on this channel. + // @TODO: Convert this call to a 'network' send/receive + // once the IAS server is a vaialable. + ret = ias_enroll(g_sp_credentials, &g_spid, + &g_authentication_token); + if(0 != ret) + { + ret = SP_IAS_FAILED; + break; + } + + // IAS may support registering the Enclave Trust Policy. + // Just leave a place holder here + // @IAS_Q: What needs to be sent to the IAS with the policy + // that identifies the SP? + // ret = ias_register_enclave_policy(g_enclave_policy, + // g_authentication_token); + // if(0 != ret) + // { + // break; + // } + + g_is_sp_registered = true; + break; + } while(0); + } + + // Get the sig_rl from IAS using GID. + // GID is Base-16 encoded of EPID GID in little-endian format. + // @IAS_Q: Does the SP need to supply any authentication info to the + // IAS? SPID? + // In the product, the SP and IAS will use an established channel for + // communication. + uint8_t* sig_rl; + uint32_t sig_rl_size = 0; + + // @TODO: Convert this call to a 'network' send/receive + // once the IAS server is a vaialable. + ret = ias_get_sigrl(p_msg1->gid, &sig_rl_size, &sig_rl); + if(0 != ret) + { + fprintf(stderr, "\nError, ias_get_sigrl [%s].", __FUNCTION__); + ret = SP_IAS_FAILED; + break; + } + + // Need to save the client's public ECCDH key to local storage + if (memcpy_s(&g_sp_db.g_a, sizeof(g_sp_db.g_a), &p_msg1->g_a, + sizeof(p_msg1->g_a))) + { + fprintf(stderr, "\nError, cannot do memcpy in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // Generate the Service providers ECCDH key pair. + sample_ret = sample_ecc256_open_context(&ecc_state); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, cannot get ECC cotext in [%s].", + __FUNCTION__); + ret = -1; + break; + } + sample_ec256_public_t pub_key = {{0},{0}}; + sample_ec256_private_t priv_key = {{0}}; + sample_ret = sample_ecc256_create_key_pair(&priv_key, &pub_key, + ecc_state); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, cannot generate key pair in [%s].", + __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // Need to save the SP ECCDH key pair to local storage. + if(memcpy_s(&g_sp_db.b, sizeof(g_sp_db.b), &priv_key,sizeof(priv_key)) + || memcpy_s(&g_sp_db.g_b, sizeof(g_sp_db.g_b), + &pub_key,sizeof(pub_key))) + { + fprintf(stderr, "\nError, cannot do memcpy in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // Generate the client/SP shared secret + sample_ec_dh_shared_t dh_key = {{0}}; + sample_ret = sample_ecc256_compute_shared_dhkey(&priv_key, + (sample_ec256_public_t *)&p_msg1->g_a, + (sample_ec256_dh_shared_t *)&dh_key, + ecc_state); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, compute share key fail in [%s].", + __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // smk is only needed for msg2 generation. + derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_SMK, + &g_sp_db.smk_key); + if(derive_ret != true) + { + fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // The rest of the keys are the shared secrets for future communication. + derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_MK, + &g_sp_db.mk_key); + if(derive_ret != true) + { + fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_SK, + &g_sp_db.sk_key); + if(derive_ret != true) + { + fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_VK, + &g_sp_db.vk_key); + if(derive_ret != true) + { + fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + uint32_t msg2_size = sizeof(sample_ra_msg2_t) + sig_rl_size; + p_msg2_full = (ra_samp_response_header_t*)malloc(msg2_size + + sizeof(ra_samp_response_header_t)); + if(!p_msg2_full) + { + fprintf(stderr, "\nError, out of memory in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + memset(p_msg2_full, 0, msg2_size + sizeof(ra_samp_response_header_t)); + p_msg2_full->type = TYPE_RA_MSG2; + p_msg2_full->size = msg2_size; + // @TODO: Set the status properly based on real protocol communication. + p_msg2_full->status[0] = 0; + p_msg2_full->status[1] = 0; + p_msg2 = (sample_ra_msg2_t *)p_msg2_full->body; + + // Assemble MSG2 + if(memcpy_s(&p_msg2->g_b, sizeof(p_msg2->g_b), &g_sp_db.g_b, + sizeof(g_sp_db.g_b)) || + memcpy_s(&p_msg2->spid, sizeof(sample_spid_t), + &g_spid, sizeof(g_spid))) + { + fprintf(stderr,"\nError, memcpy failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // The service provider is responsible for selecting the proper EPID + // signature type and to understand the implications of the choice! + p_msg2->quote_type = SAMPLE_QUOTE_LINKABLE_SIGNATURE; + + + p_msg2->kdf_id = SAMPLE_AES_CMAC_KDF_ID; + + // Create gb_ga + sample_ec_pub_t gb_ga[2]; + if(memcpy_s(&gb_ga[0], sizeof(gb_ga[0]), &g_sp_db.g_b, + sizeof(g_sp_db.g_b)) + || memcpy_s(&gb_ga[1], sizeof(gb_ga[1]), &g_sp_db.g_a, + sizeof(g_sp_db.g_a))) + { + fprintf(stderr,"\nError, memcpy failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // Sign gb_ga + sample_ret = sample_ecdsa_sign((uint8_t *)&gb_ga, sizeof(gb_ga), + (sample_ec256_private_t *)&g_sp_priv_key, + (sample_ec256_signature_t *)&p_msg2->sign_gb_ga, + ecc_state); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, sign ga_gb fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // Generate the CMACsmk for gb||SPID||TYPE||KDF_ID||Sigsp(gb,ga) + uint8_t mac[SAMPLE_EC_MAC_SIZE] = {0}; + uint32_t cmac_size = offsetof(sample_ra_msg2_t, mac); + sample_ret = sample_rijndael128_cmac_msg(&g_sp_db.smk_key, + (uint8_t *)&p_msg2->g_b, cmac_size, &mac); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, cmac fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + if(memcpy_s(&p_msg2->mac, sizeof(p_msg2->mac), mac, sizeof(mac))) + { + fprintf(stderr,"\nError, memcpy failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + if(memcpy_s(&p_msg2->sig_rl[0], sig_rl_size, sig_rl, sig_rl_size)) + { + fprintf(stderr,"\nError, memcpy failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + p_msg2->sig_rl_size = sig_rl_size; + + }while(0); + + if(ret) + { + *pp_msg2 = NULL; + SAFE_FREE(p_msg2_full); + } + else + { + // Freed by the network simulator in ra_free_network_response_buffer + *pp_msg2 = p_msg2_full; + } + + if(ecc_state) + { + sample_ecc256_close_context(ecc_state); + } + + return ret; +} + +// Process remote attestation message 3 +int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, + uint32_t msg3_size, + ra_samp_response_header_t **pp_att_result_msg) +{ + int ret = 0; + sample_status_t sample_ret = SAMPLE_SUCCESS; + const uint8_t *p_msg3_cmaced = NULL; + sample_quote_t *p_quote = NULL; + sample_sha_state_handle_t sha_handle = NULL; + sample_report_data_t report_data = {0}; + sample_ra_att_result_msg_t *p_att_result_msg = NULL; + ra_samp_response_header_t* p_att_result_msg_full = NULL; + uint32_t i; + + if((!p_msg3) || + (msg3_size < sizeof(sample_ra_msg3_t)) || + (!pp_att_result_msg)) + { + return SP_INTERNAL_ERROR; + } + + do + { + // Compare g_a in message 3 with local g_a. + ret = memcmp(&g_sp_db.g_a, &p_msg3->g_a, sizeof(sample_ec_pub_t)); + if(ret) + { + fprintf(stderr, "\nError, g_a is not same [%s].", __FUNCTION__); + ret = SP_PROTOCOL_ERROR; + break; + } + //Make sure that msg3_size is bigger than sample_mac_t. + uint32_t mac_size = msg3_size - sizeof(sample_mac_t); + p_msg3_cmaced = reinterpret_cast(p_msg3); + p_msg3_cmaced += sizeof(sample_mac_t); + + // Verify the message mac using SMK + sample_cmac_128bit_tag_t mac = {0}; + sample_ret = sample_rijndael128_cmac_msg(&g_sp_db.smk_key, + p_msg3_cmaced, + mac_size, + &mac); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, cmac fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + // In real implementation, should use a time safe version of memcmp here, + // in order to avoid side channel attack. + ret = memcmp(&p_msg3->mac, mac, sizeof(mac)); + if(ret) + { + fprintf(stderr, "\nError, verify cmac fail [%s].", __FUNCTION__); + ret = SP_INTEGRITY_FAILED; + break; + } + + if(memcpy_s(&g_sp_db.ps_sec_prop, sizeof(g_sp_db.ps_sec_prop), + &p_msg3->ps_sec_prop, sizeof(p_msg3->ps_sec_prop))) + { + fprintf(stderr,"\nError, memcpy failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + p_quote = (sample_quote_t *)p_msg3->quote; + + // Verify the the report_data in the Quote matches the expected value. + // The first 32 bytes of report_data are SHA256 HASH of {ga|gb|vk}. + // The second 32 bytes of report_data are set to zero. + sample_ret = sample_sha256_init(&sha_handle); + if(sample_ret != SAMPLE_SUCCESS) + { + fprintf(stderr,"\nError, init hash failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + sample_ret = sample_sha256_update((uint8_t *)&(g_sp_db.g_a), + sizeof(g_sp_db.g_a), sha_handle); + if(sample_ret != SAMPLE_SUCCESS) + { + fprintf(stderr,"\nError, udpate hash failed in [%s].", + __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + sample_ret = sample_sha256_update((uint8_t *)&(g_sp_db.g_b), + sizeof(g_sp_db.g_b), sha_handle); + if(sample_ret != SAMPLE_SUCCESS) + { + fprintf(stderr,"\nError, udpate hash failed in [%s].", + __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + sample_ret = sample_sha256_update((uint8_t *)&(g_sp_db.vk_key), + sizeof(g_sp_db.vk_key), sha_handle); + if(sample_ret != SAMPLE_SUCCESS) + { + fprintf(stderr,"\nError, udpate hash failed in [%s].", + __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + sample_ret = sample_sha256_get_hash(sha_handle, + (sample_sha256_hash_t *)&report_data); + if(sample_ret != SAMPLE_SUCCESS) + { + fprintf(stderr,"\nError, Get hash failed in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + ret = memcmp((uint8_t *)&report_data, + (uint8_t *)&(p_quote->report_body.report_data), + sizeof(report_data)); + if(ret) + { + fprintf(stderr, "\nError, verify hash fail [%s].", __FUNCTION__); + ret = SP_INTEGRITY_FAILED; + break; + } + + // Verify Enclave policy (IAS may provide an API for this if we + // registered an Enclave policy) + + // Verify quote with IAS. + // @IAS_Q: What is the proper JSON format for attestation evidence? + ias_att_report_t attestation_report; + // @TODO: Convert this call to a 'network' send/receive + // once the IAS server is a vaialable. + ret = ias_verify_attestation_evidence(p_quote, NULL, + &attestation_report); + if(0 != ret) + { + ret = SP_IAS_FAILED; + break; + } + FILE* OUTPUT = stdout; + fprintf(OUTPUT, "\n\n\tAtestation Report:"); + fprintf(OUTPUT, "\n\tid: 0x%0x.", attestation_report.id); + fprintf(OUTPUT, "\n\tstatus: %d.", attestation_report.status); + fprintf(OUTPUT, "\n\trevocation_reason: %u.", + attestation_report.revocation_reason); + // attestation_report.info_blob; + fprintf(OUTPUT, "\n\tpse_status: %d.", attestation_report.pse_status); + // Check if Platform_Info_Blob is available. + // @TODO: Currenlty, the IAS spec says this will not be available if + // no info blob status flags are set. For now, assume it is always + // there until we have the full message format definition. + + // Respond the client with the results of the attestation. + uint32_t att_result_msg_size = sizeof(sample_ra_att_result_msg_t) + + attestation_report.policy_report_size; + p_att_result_msg_full = + (ra_samp_response_header_t*)malloc(att_result_msg_size + + sizeof(ra_samp_response_header_t) + sizeof(g_secret)); + if(!p_att_result_msg_full) + { + fprintf(stderr, "\nError, out of memory in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + memset(p_att_result_msg_full, 0, att_result_msg_size + + sizeof(ra_samp_response_header_t) + sizeof(g_secret)); + p_att_result_msg_full->type = TYPE_RA_ATT_RESULT; + p_att_result_msg_full->size = att_result_msg_size; + if(IAS_QUOTE_OK != attestation_report.status) + { + p_att_result_msg_full->status[0] = 0xFF; + } + if(IAS_PSE_OK != attestation_report.pse_status) + { + p_att_result_msg_full->status[1] = 0xFF; + } + + p_att_result_msg = + (sample_ra_att_result_msg_t *)p_att_result_msg_full->body; + + // @TODO: In the product, the HTTP response header itself will have + // an RK based signature that the service provider needs to check here. + + // The platform_info_blob signature will be verified by the client + // if needed. No need to have the Service Provider to check it. + + // @TODO: Verify the enlcave policy report if they are to be supported + // by IAS. Otherwise, the SP will need to check the ISV enclave report + // itself. + fprintf(OUTPUT, "\n\n\tEnclave Report:"); + fprintf(OUTPUT, "\n\tSignature Type: 0x%x", p_quote->sign_type); + fprintf(OUTPUT, "\n\tSignature Basename: "); + for(i=0; ibasename.name) && p_quote->basename.name[i]; + i++) + { + fprintf(OUTPUT, "%c", p_quote->basename.name[i]); + } +#ifdef __x86_64__ + fprintf(OUTPUT, "\n\tattributes.flags: 0x%0lx", + p_quote->report_body.attributes.flags); + fprintf(OUTPUT, "\n\tattributes.xfrm: 0x%0lx", + p_quote->report_body.attributes.xfrm); +#else + fprintf(OUTPUT, "\n\tattributes.flags: 0x%0llx", + p_quote->report_body.attributes.flags); + fprintf(OUTPUT, "\n\tattributes.xfrm: 0x%0llx", + p_quote->report_body.attributes.xfrm); +#endif + fprintf(OUTPUT, "\n\tmr_enclave: "); + for(i=0;ireport_body.mr_enclave[i]); + + //fprintf(stderr, "%02x",p_quote->report_body.mr_enclave.m[i]); + + } + fprintf(OUTPUT, "\n\tmr_signer: "); + for(i=0;ireport_body.mr_signer[i]); + + //fprintf(stderr, "%02x",p_quote->report_body.mr_signer.m[i]); + + } + fprintf(OUTPUT, "\n\tisv_prod_id: 0x%0x", + p_quote->report_body.isv_prod_id); + fprintf(OUTPUT, "\n\tisv_svn: 0x%0x",p_quote->report_body.isv_svn); + fprintf(OUTPUT, "\n"); + // @TODO do a real check here. + bool isv_policy_passed = true; + + // Assemble Attestation Result Message + // Note, this is a structure copy. We don't copy the policy reports + // right now. + p_att_result_msg->platform_info_blob = attestation_report.info_blob; + + // Generate mac based on the mk key. + mac_size = sizeof(ias_platform_info_blob_t); + sample_ret = sample_rijndael128_cmac_msg(&g_sp_db.mk_key, + (const uint8_t*)&p_att_result_msg->platform_info_blob, + mac_size, + &p_att_result_msg->mac); + if(SAMPLE_SUCCESS != sample_ret) + { + fprintf(stderr, "\nError, cmac fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // Generate shared secret and encrypt it with SK, if attestation passed. + uint8_t aes_gcm_iv[SAMPLE_SP_IV_SIZE] = {0}; + p_att_result_msg->secret.payload_size = 8; + if((IAS_QUOTE_OK == attestation_report.status) && + (IAS_PSE_OK == attestation_report.pse_status) && + (isv_policy_passed == true)) + { + ret = sample_rijndael128GCM_encrypt(&g_sp_db.sk_key, + &g_secret[0], + p_att_result_msg->secret.payload_size, + p_att_result_msg->secret.payload, + &aes_gcm_iv[0], + SAMPLE_SP_IV_SIZE, + NULL, + 0, + &p_att_result_msg->secret.payload_tag); + } + }while(0); + + if(ret) + { + *pp_att_result_msg = NULL; + SAFE_FREE(p_att_result_msg_full); + } + else + { + // Freed by the network simulator in ra_free_network_response_buffer + *pp_att_result_msg = p_att_result_msg_full; + } + return ret; +} + + + + diff --git a/SampleCode/RemoteAttestation/service_provider/service_provider.h b/SampleCode/RemoteAttestation/service_provider/service_provider.h new file mode 100644 index 0000000000..820e39072a --- /dev/null +++ b/SampleCode/RemoteAttestation/service_provider/service_provider.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SERVICE_PROVIDER_H +#define _SERVICE_PROVIDER_H + +#include "remote_attestation_result.h" +#include "ias_ra.h" +#include "network_ra.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SP_OK, + SP_INTEGRITY_FAILED, + SP_QUOTE_VERIFICATION_FAILED, + SP_IAS_FAILED, + SP_INTERNAL_ERROR, + SP_PROTOCOL_ERROR, +} sp_ra_msg_status_t; + +#pragma pack(push,1) + +#define SAMPLE_SP_TAG_SIZE 16 +#define SAMPLE_SP_IV_SIZE 12 + +typedef struct sample_ec_pub_t +{ + uint8_t gx[SAMPLE_ECP_KEY_SIZE]; + uint8_t gy[SAMPLE_ECP_KEY_SIZE]; +} sample_ec_pub_t; + +//fixed length to align with internal structure +typedef struct sample_ps_sec_prop_desc_t +{ + uint8_t sample_ps_sec_prop_desc[256]; +} sample_ps_sec_prop_desc_t; + +#pragma pack(pop) + +typedef uint32_t sample_ra_context_t; + +typedef uint8_t sample_key_128bit_t[16]; + +typedef sample_key_128bit_t sample_ra_key_128_t; + +typedef struct sample_ra_msg1_t +{ + sample_ec_pub_t g_a; // the Endian-ness of Ga is + // Little-Endian + sample_epid_group_id_t gid; // the Endian-ness of GID is + // Little-Endian +} sample_ra_msg1_t; + +//Key Derivation Function ID : 0x0001 AES-CMAC Entropy Extraction and Key Expansion +const uint16_t SAMPLE_AES_CMAC_KDF_ID = 0x0001; + +typedef struct sample_ra_msg2_t +{ + sample_ec_pub_t g_b; // the Endian-ness of Gb is + // Little-Endian + sample_spid_t spid; + uint16_t quote_type; /* unlinkable Quote(0) or linkable Quote(0) in little endian*/ + uint16_t kdf_id; /* key derivation function id in little endian. + 0x0001 for AES-CMAC Entropy Extraction and Key Derivation */ + sample_ec_sign256_t sign_gb_ga; // In little endian + sample_mac_t mac; // mac_smk(g_b||spid||quote_type|| + // sign_gb_ga) + uint32_t sig_rl_size; + uint8_t sig_rl[]; +} sample_ra_msg2_t; + +typedef struct sample_ra_msg3_t +{ + sample_mac_t mac; // mac_smk(g_a||ps_sec_prop||quote) + sample_ec_pub_t g_a; // the Endian-ness of Ga is + // Little-Endian + sample_ps_sec_prop_desc_t ps_sec_prop; + uint8_t quote[]; +} sample_ra_msg3_t; + + +int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, + uint32_t msg1_size, + ra_samp_response_header_t **pp_msg2); + +int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, + uint32_t msg3_size, + ra_samp_response_header_t **pp_att_result_msg); + +int sp_ra_free_msg2( + sample_ra_msg2_t *p_msg2); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/SampleCode/SampleEnclave/.cproject b/SampleCode/SampleEnclave/.cproject new file mode 100644 index 0000000000..b9fabf3067 --- /dev/null +++ b/SampleCode/SampleEnclave/.cproject @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleCode/SampleEnclave/.project b/SampleCode/SampleEnclave/.project new file mode 100644 index 0000000000..f1af7d8591 --- /dev/null +++ b/SampleCode/SampleEnclave/.project @@ -0,0 +1,28 @@ + + + SimpleEnclave + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.core.ccnature + com.intel.sgx.sgxnature + + diff --git a/SampleCode/SampleEnclave/App/App.cpp b/SampleCode/SampleEnclave/App/App.cpp new file mode 100644 index 0000000000..0538d2d8f3 --- /dev/null +++ b/SampleCode/SampleEnclave/App/App.cpp @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include + +# include +# include +# define MAX_PATH FILENAME_MAX + +#include "sgx_urts.h" +#include "App.h" +#include "Enclave_u.h" + +/* Global EID shared by multiple threads */ +sgx_enclave_id_t global_eid = 0; + +typedef struct _sgx_errlist_t { + sgx_status_t err; + const char *msg; + const char *sug; /* Suggestion */ +} sgx_errlist_t; + +/* Error code returned by sgx_create_enclave */ +static sgx_errlist_t sgx_errlist[] = { + { + SGX_ERROR_UNEXPECTED, + "Unexpected error occurred.", + NULL + }, + { + SGX_ERROR_INVALID_PARAMETER, + "Invalid parameter.", + NULL + }, + { + SGX_ERROR_OUT_OF_MEMORY, + "Out of memory.", + NULL + }, + { + SGX_ERROR_ENCLAVE_LOST, + "Power transition occurred.", + "Please refer to the sample \"PowerTransition\" for details." + }, + { + SGX_ERROR_INVALID_ENCLAVE, + "Invalid enclave image.", + NULL + }, + { + SGX_ERROR_INVALID_ENCLAVE_ID, + "Invalid enclave identification.", + NULL + }, + { + SGX_ERROR_INVALID_SIGNATURE, + "Invalid enclave signature.", + NULL + }, + { + SGX_ERROR_OUT_OF_EPC, + "Out of EPC memory.", + NULL + }, + { + SGX_ERROR_NO_DEVICE, + "Invalid SGX device.", + "Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards." + }, + { + SGX_ERROR_MEMORY_MAP_CONFLICT, + "Memory map conflicted.", + NULL + }, + { + SGX_ERROR_INVALID_METADATA, + "Invalid enclave metadata.", + NULL + }, + { + SGX_ERROR_DEVICE_BUSY, + "SGX device was busy.", + NULL + }, + { + SGX_ERROR_INVALID_VERSION, + "Enclave version was invalid.", + NULL + }, + { + SGX_ERROR_INVALID_ATTRIBUTE, + "Enclave was not authorized.", + NULL + }, + { + SGX_ERROR_ENCLAVE_FILE_ACCESS, + "Can't open enclave file.", + NULL + }, +}; + +/* Check error conditions for loading enclave */ +void print_error_message(sgx_status_t ret) +{ + size_t idx = 0; + size_t ttl = sizeof sgx_errlist/sizeof sgx_errlist[0]; + + for (idx = 0; idx < ttl; idx++) { + if(ret == sgx_errlist[idx].err) { + if(NULL != sgx_errlist[idx].sug) + printf("Info: %s\n", sgx_errlist[idx].sug); + printf("Error: %s\n", sgx_errlist[idx].msg); + break; + } + } + + if (idx == ttl) + printf("Error: Unexpected error occurred.\n"); +} + +/* Initialize the enclave: + * Step 1: try to retrieve the launch token saved by last transaction + * Step 2: call sgx_create_enclave to initialize an enclave instance + * Step 3: save the launch token if it is updated + */ +int initialize_enclave(void) +{ + char token_path[MAX_PATH] = {'\0'}; + sgx_launch_token_t token = {0}; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + int updated = 0; + + /* Step 1: try to retrieve the launch token saved by last transaction + * if there is no token, then create a new one. + */ + /* try to get the token saved in $HOME */ + const char *home_dir = getpwuid(getuid())->pw_dir; + + if (home_dir != NULL && + (strlen(home_dir)+strlen("/")+sizeof(TOKEN_FILENAME)+1) <= MAX_PATH) { + /* compose the token path */ + strncpy(token_path, home_dir, strlen(home_dir)); + strncat(token_path, "/", strlen("/")); + strncat(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)+1); + } else { + /* if token path is too long or $HOME is NULL */ + strncpy(token_path, TOKEN_FILENAME, sizeof(TOKEN_FILENAME)); + } + + FILE *fp = fopen(token_path, "rb"); + if (fp == NULL && (fp = fopen(token_path, "wb")) == NULL) { + printf("Warning: Failed to create/open the launch token file \"%s\".\n", token_path); + } + + if (fp != NULL) { + /* read the token from saved file */ + size_t read_num = fread(token, 1, sizeof(sgx_launch_token_t), fp); + if (read_num != 0 && read_num != sizeof(sgx_launch_token_t)) { + /* if token is invalid, clear the buffer */ + memset(&token, 0x0, sizeof(sgx_launch_token_t)); + printf("Warning: Invalid launch token read from \"%s\".\n", token_path); + } + } + /* Step 2: call sgx_create_enclave to initialize an enclave instance */ + /* Debug Support: set 2nd parameter to 1 */ + ret = sgx_create_enclave(ENCLAVE_FILENAME, SGX_DEBUG_FLAG, &token, &updated, &global_eid, NULL); + if (ret != SGX_SUCCESS) { + print_error_message(ret); + if (fp != NULL) fclose(fp); + return -1; + } + + /* Step 3: save the launch token if it is updated */ + if (updated == FALSE || fp == NULL) { + /* if the token is not updated, or file handler is invalid, do not perform saving */ + if (fp != NULL) fclose(fp); + return 0; + } + + /* reopen the file with write capablity */ + fp = freopen(token_path, "wb", fp); + if (fp == NULL) return 0; + size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp); + if (write_num != sizeof(sgx_launch_token_t)) + printf("Warning: Failed to save launch token to \"%s\".\n", token_path); + fclose(fp); + return 0; +} + +/* OCall functions */ +void ocall_print_string(const char *str) +{ + /* Proxy/Bridge will check the length and null-terminate + * the input string to prevent buffer overflow. + */ + printf("%s", str); +} + + +/* Application entry */ +int SGX_CDECL main(int argc, char *argv[]) +{ + (void)(argc); + (void)(argv); + + + /* Initialize the enclave */ + if(initialize_enclave() < 0){ + printf("Enter a character before exit ...\n"); + getchar(); + return -1; + } + + /* Utilize edger8r attributes */ + edger8r_array_attributes(); + edger8r_pointer_attributes(); + edger8r_type_attributes(); + edger8r_function_attributes(); + + /* Utilize trusted libraries */ + ecall_libc_functions(); + ecall_libcxx_functions(); + ecall_thread_functions(); + + /* Destroy the enclave */ + sgx_destroy_enclave(global_eid); + + printf("Info: SampleEnclave successfully returned.\n"); + + printf("Enter a character before exit ...\n"); + getchar(); + return 0; +} + diff --git a/SampleCode/SampleEnclave/App/App.h b/SampleCode/SampleEnclave/App/App.h new file mode 100644 index 0000000000..bc86ff850f --- /dev/null +++ b/SampleCode/SampleEnclave/App/App.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _APP_H_ +#define _APP_H_ + +#include +#include +#include +#include + +#include "sgx_error.h" /* sgx_status_t */ +#include "sgx_eid.h" /* sgx_enclave_id_t */ + +#ifndef TRUE +# define TRUE 1 +#endif + +#ifndef FALSE +# define FALSE 0 +#endif + +# define TOKEN_FILENAME "enclave.token" +# define ENCLAVE_FILENAME "enclave.signed.so" + +extern sgx_enclave_id_t global_eid; /* global enclave id */ + +#if defined(__cplusplus) +extern "C" { +#endif + +void edger8r_array_attributes(void); +void edger8r_type_attributes(void); +void edger8r_pointer_attributes(void); +void edger8r_function_attributes(void); + +void ecall_libc_functions(void); +void ecall_libcxx_functions(void); +void ecall_thread_functions(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* !_APP_H_ */ diff --git a/SampleCode/SampleEnclave/App/Edger8rSyntax/Arrays.cpp b/SampleCode/SampleEnclave/App/Edger8rSyntax/Arrays.cpp new file mode 100644 index 0000000000..01552eeffb --- /dev/null +++ b/SampleCode/SampleEnclave/App/Edger8rSyntax/Arrays.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "../App.h" +#include "Enclave_u.h" + +/* edger8r_array_attributes: + * Invokes ECALLs declared with array attributes. + */ +void edger8r_array_attributes(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + /* user_check */ + int arr1[4] = {0, 1, 2, 3}; + ret = ecall_array_user_check(global_eid, arr1); + if (ret != SGX_SUCCESS) + abort(); + + /* make sure arr1 is changed */ + for (int i = 0; i < 4; i++) + assert(arr1[i] == (3 - i)); + + /* in */ + int arr2[4] = {0, 1, 2, 3}; + ret = ecall_array_in(global_eid, arr2); + if (ret != SGX_SUCCESS) + abort(); + + /* arr2 is not changed */ + for (int i = 0; i < 4; i++) + assert(arr2[i] == i); + + /* out */ + int arr3[4] = {0, 1, 2, 3}; + ret = ecall_array_out(global_eid, arr3); + if (ret != SGX_SUCCESS) + abort(); + + /* arr3 is changed */ + for (int i = 0; i < 4; i++) + assert(arr3[i] == (3 - i)); + + /* in, out */ + int arr4[4] = {0, 1, 2, 3}; + ret = ecall_array_in_out(global_eid, arr4); + if (ret != SGX_SUCCESS) + abort(); + + /* arr4 is changed */ + for (int i = 0; i < 4; i++) + assert(arr4[i] == (3 - i)); + + /* isary */ + array_t arr5 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + ret = ecall_array_isary(global_eid, arr5); + if (ret != SGX_SUCCESS) + abort(); + + /* arr5 is changed */ + for (int i = 0; i < 10; i++) + assert(arr5[i] == (9 - i)); +} diff --git a/SampleCode/SampleEnclave/App/Edger8rSyntax/Functions.cpp b/SampleCode/SampleEnclave/App/Edger8rSyntax/Functions.cpp new file mode 100644 index 0000000000..acc2ad2737 --- /dev/null +++ b/SampleCode/SampleEnclave/App/Edger8rSyntax/Functions.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "../App.h" +#include "Enclave_u.h" + +/* No need to implement memccpy here! */ + +/* edger8r_function_attributes: + * Invokes ECALL declared with calling convention attributes. + * Invokes ECALL declared with [public]. + */ +void edger8r_function_attributes(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + ret = ecall_function_calling_convs(global_eid); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_function_public(global_eid); + if (ret != SGX_SUCCESS) + abort(); + + /* user shall not invoke private function here */ + int runned = 0; + ret = ecall_function_private(global_eid, &runned); + if (ret != SGX_ERROR_ECALL_NOT_ALLOWED || runned != 0) + abort(); +} + +/* ocall_function_allow: + * The OCALL invokes the [allow]ed ECALL 'edger8r_private'. + */ +void ocall_function_allow(void) +{ + int runned = 0; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + ret = ecall_function_private(global_eid, &runned); + if (ret != SGX_SUCCESS || runned != 1) + abort(); +} diff --git a/SampleCode/SampleEnclave/App/Edger8rSyntax/Pointers.cpp b/SampleCode/SampleEnclave/App/Edger8rSyntax/Pointers.cpp new file mode 100644 index 0000000000..2187a40dde --- /dev/null +++ b/SampleCode/SampleEnclave/App/Edger8rSyntax/Pointers.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "../App.h" +#include "Enclave_u.h" + +/* edger8r_pointer_attributes: + * Invokes the ECALLs declared with pointer attributes. + */ +void edger8r_pointer_attributes(void) +{ + int val = 0; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + char c[128] = {0}; + size_t len = 0; + memset(c, 0xe, 128); + ret = ecall_pointer_user_check(global_eid, &len, &c, 128); + if (ret != SGX_SUCCESS) + abort(); + assert(strcmp(c, "SGX_SUCCESS") == 0); + + + val = 0; + ret = ecall_pointer_in(global_eid, &val); + if (ret != SGX_SUCCESS) + abort(); + assert(val == 0); + + val = 0; + ret = ecall_pointer_out(global_eid, &val); + if (ret != SGX_SUCCESS) + abort(); + assert(val == 1234); + + val = 0; + ret = ecall_pointer_in_out(global_eid, &val); + if (ret != SGX_SUCCESS) + abort(); + assert(val == 1234); + + ret = ocall_pointer_attr(global_eid); + if (ret != SGX_SUCCESS) + abort(); + + char str1[] = "1234567890"; + ret = ecall_pointer_string(global_eid, str1); + if (ret != SGX_SUCCESS) + abort(); + assert(memcmp(str1, "0987654321", strlen(str1)) == 0); + + const char str2[] = "1234567890"; + ret = ecall_pointer_string_const(global_eid, str2); + if (ret != SGX_SUCCESS) + abort(); + assert(memcmp(str2, "1234567890", strlen(str2)) == 0); + + char str3[] = "1234567890"; + ret = ecall_pointer_size(global_eid, (void*)str3, strlen(str3)); + if (ret != SGX_SUCCESS) + abort(); + assert(memcmp(str3, "0987654321", strlen(str3)) == 0); + + char str4[] = "1234567890"; + ret = ecall_pointer_isptr_readonly(global_eid, (buffer_t)str4, strlen(str4)); + if (ret != SGX_SUCCESS) + abort(); + assert(memcmp(str4, "1234567890", strlen(str4)) == 0); + + int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + ret = ecall_pointer_count(global_eid, arr, 10); + if (ret != SGX_SUCCESS) + abort(); + + for (int i = 0; i < 10; i++) + assert(arr[i] == (9 - i)); + + memset(arr, 0x0, sizeof(arr)); + ret = ecall_pointer_sizefunc(global_eid, (char *)arr); + if (ret != SGX_SUCCESS) + abort(); + + for (int i = 0; i < 10; i++) + assert(arr[i] == i); + + return; +} + +/* ocall_pointer_user_check: + * The OCALL declared with [user_check]. + */ +void ocall_pointer_user_check(int* val) +{ + (void)val; + assert(val != NULL); +} + +/* ocall_pointer_in: + * The OCALL declared with [in]. + */ +void ocall_pointer_in(int* val) +{ + *val = 1234; +} + +/* ocall_pointer_out: + * The OCALL declared with [out]. + */ +void ocall_pointer_out(int* val) +{ + *val = 1234; +} + +/* ocall_pointer_in_out: + * The OCALL declared with [in, out]. + */ +void ocall_pointer_in_out(int* val) +{ + *val = 1234; +} diff --git a/SampleCode/SampleEnclave/App/Edger8rSyntax/Types.cpp b/SampleCode/SampleEnclave/App/Edger8rSyntax/Types.cpp new file mode 100644 index 0000000000..19702263dd --- /dev/null +++ b/SampleCode/SampleEnclave/App/Edger8rSyntax/Types.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "../App.h" +#include "Enclave_u.h" + +/* edger8r_type_attributes: + * Invokes ECALLs declared with basic types. + */ +void edger8r_type_attributes(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + ret = ecall_type_char(global_eid, (char)0x12); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_type_int(global_eid, (int)1234); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_type_float(global_eid, (float)1234.0); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_type_double(global_eid, (double)1234.5678); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_type_size_t(global_eid, (size_t)12345678); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_type_wchar_t(global_eid, (wchar_t)0x1234); + if (ret != SGX_SUCCESS) + abort(); + + struct struct_foo_t g = {1234, 5678}; + ret = ecall_type_struct(global_eid, g); + if (ret != SGX_SUCCESS) + abort(); + + union union_foo_t val = {0}; + ret = ecall_type_enum_union(global_eid, ENUM_FOO_0, &val); + if (ret != SGX_SUCCESS) + abort(); + assert(val.union_foo_0 == 2); +} diff --git a/SampleCode/SampleEnclave/App/TrustedLibrary/Libc.cpp b/SampleCode/SampleEnclave/App/TrustedLibrary/Libc.cpp new file mode 100644 index 0000000000..29f0074669 --- /dev/null +++ b/SampleCode/SampleEnclave/App/TrustedLibrary/Libc.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "../App.h" +#include "Enclave_u.h" + +/* ecall_libc_functions: + * Invokes standard C functions. + */ +void ecall_libc_functions(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + ret = ecall_malloc_free(global_eid); + if (ret != SGX_SUCCESS) + abort(); + + int cpuid[4] = {0x1, 0x0, 0x0, 0x0}; + ret = ecall_sgx_cpuid(global_eid, cpuid, 0x0); + if (ret != SGX_SUCCESS) + abort(); +} diff --git a/SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp b/SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp new file mode 100644 index 0000000000..f6d567b98f --- /dev/null +++ b/SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "../App.h" +#include "Enclave_u.h" + +/* ecall_libcxx_functions: + * Invokes standard C++ functions. + */ +void ecall_libcxx_functions(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + ret = ecall_exception(global_eid); + if (ret != SGX_SUCCESS) + abort(); + + ret = ecall_map(global_eid); + if (ret != SGX_SUCCESS) + abort(); +} diff --git a/SampleCode/SampleEnclave/App/TrustedLibrary/Thread.cpp b/SampleCode/SampleEnclave/App/TrustedLibrary/Thread.cpp new file mode 100644 index 0000000000..ca28fe5ed8 --- /dev/null +++ b/SampleCode/SampleEnclave/App/TrustedLibrary/Thread.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +using namespace std; + +#include "../App.h" +#include "Enclave_u.h" + +static size_t counter = 0; + +void increase_counter(void) +{ + size_t cnr = 0; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + ret = ecall_increase_counter(global_eid, &cnr); + if (cnr != 0) counter = cnr; + if (ret != SGX_SUCCESS) + abort(); +} + +void data_producer(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + ret = ecall_producer(global_eid); + if (ret != SGX_SUCCESS) + abort(); +} + +void data_consumer(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + ret = ecall_consumer(global_eid); + if (ret != SGX_SUCCESS) + abort(); +} + +/* ecall_thread_functions: + * Invokes thread functions including mutex, condition variable, etc. + */ +void ecall_thread_functions(void) +{ + thread adder1(increase_counter); + thread adder2(increase_counter); + thread adder3(increase_counter); + thread adder4(increase_counter); + + adder1.join(); + adder2.join(); + adder3.join(); + adder4.join(); + + assert(counter == 4*LOOPS_PER_THREAD); + + printf("Info: executing thread synchronization, please wait... \n"); + /* condition variable */ + thread consumer1(data_consumer); + thread producer0(data_producer); + thread consumer2(data_consumer); + thread consumer3(data_consumer); + thread consumer4(data_consumer); + + consumer1.join(); + consumer2.join(); + consumer3.join(); + consumer4.join(); + producer0.join(); +} diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.cpp b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.cpp new file mode 100644 index 0000000000..cd0718b5c0 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Test Array Attributes */ + +#include "sgx_trts.h" +#include "../Enclave.h" +#include "Enclave_t.h" + +/* ecall_array_user_check: + * [user_check] parameter does not perfrom copy operations. + */ +void ecall_array_user_check(int arr[4]) +{ + if (sgx_is_outside_enclave(arr, 4 * sizeof(int)) != 1) + abort(); + + for (int i = 0; i < 4; i++) { + assert(arr[i] == i); + arr[i] = 3 - i; + } +} + +/* ecall_array_in: + * arr[] is copied to trusted domain, but modified + * results will not be reflected to the untrusted side. + */ +void ecall_array_in(int arr[4]) +{ + for (int i = 0; i < 4; i++) { + assert(arr[i] == i); + arr[i] = (3 - i); + } +} + +/* ecall_array_out: + * arr[] is allocated inside the enclave, and it will be copied + * to the untrusted side + */ +void ecall_array_out(int arr[4]) +{ + for (int i = 0; i < 4; i++) { + /* arr is not copied from App */ + assert(arr[i] == 0); + arr[i] = (3 - i); + } +} + +/* ecall_array_in_out: + * arr[] will be allocated inside the enclave, content of arr[] will be copied either. + * After ECALL returns, the results will be copied to the outside. + */ +void ecall_array_in_out(int arr[4]) +{ + for (int i = 0; i < 4; i++) { + assert(arr[i] == i); + arr[i] = (3 - i); + } +} + +/* ecall_array_isary: + * [isary] tells Edger8r that user defined 'array_t' is an array type. + */ +void ecall_array_isary(array_t arr) +{ + if (sgx_is_outside_enclave(arr, sizeof(array_t)) != 1) + abort(); + + int n = sizeof(array_t)/sizeof(arr[0]); + for (int i = 0; i < n; i++) { + assert(arr[i] == i); + arr[i] = (n - 1 - i); + } +} diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.edl b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.edl new file mode 100644 index 0000000000..4d481fa197 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.edl @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Arrays.edl - Samples for array attributes. */ + +enclave { + + /* + * Only for fixed-size array (size is explicitly specified). + */ + + trusted { + + /* + * []: can be used to declare an array. + * [user_check]: + * pointer of the array won't be valified, and the buffer pointed by 'arr' + * is not copied into the enclave either. But enclave can modify the memory outside. + */ + + public void ecall_array_user_check([user_check] int arr[4]); + + /* + * [in]: + * buffer for the array will be allocated inside the enclave, + * content of the array will be copied into the new allocated memory inside. + * Any changes performed inside the enclave will not affect the array outside. + */ + + public void ecall_array_in([in] int arr[4]); + + /* + * [out]: + * buffer for the array will be allocated inside the enclave, + * but the content of the array won't be copied. After ECALL returns, + * the buffer inside the enclave will copied into outside array. + */ + + public void ecall_array_out([out] int arr[4]); + + /* + * [in, out]: + * buffer for the array will be allocated inside the enclave, + * the content of the array will be copied either. After ECALL returns, + * the buffer inside the enclave will by copied into outside array again. + */ + + public void ecall_array_in_out([in, out] int arr[4]); + + /* + * [isary]: + * tells Edger8r the user defined 'array_t' is an array type, 'arr' will be + * treated as a pointer, no memory copied either due to [user_check]. + * For OCALLs, 'arr' shall point to the memory outside the enclave. + */ + + public void ecall_array_isary([user_check, isary] array_t arr); + + }; + + untrusted { + + /* + * [user_check|in|out|in,out|isary] can also be used in OCALLs, refer to the "User Guide" for details. + */ + + }; + +}; diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.cpp b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.cpp new file mode 100644 index 0000000000..e29739a21e --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Test Calling Conventions */ + +#include +#include + +#include "../Enclave.h" +#include "Enclave_t.h" + +/* ecall_function_calling_convs: + * memccpy is defined in system C library. + */ +void ecall_function_calling_convs(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + char s1[] = "1234567890"; + char s2[] = "0987654321"; + + char buf[BUFSIZ] = {'\0'}; + memcpy(buf, s1, strlen(s1)); + + ret = memccpy(NULL, s1, s2, '\0', strlen(s1)); + + if (ret != SGX_SUCCESS) + abort(); + assert(memcmp(s1, s2, strlen(s1)) == 0); + + return; +} + +/* ecall_function_public: + * The public ECALL that invokes the OCALL 'ocall_function_allow'. + */ +void ecall_function_public(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + ret = ocall_function_allow(); + if (ret != SGX_SUCCESS) + abort(); + + return; +} + +/* ecall_function_private: + * The private ECALL that only can be invoked in the OCALL 'ocall_function_allow'. + */ +int ecall_function_private(void) +{ + return 1; +} + diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.edl b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.edl new file mode 100644 index 0000000000..ad9e1d995f --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.edl @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Functions.edl - Samples for function attributes. */ + +enclave { + + /* + * Following keywords/attributes are supported for untrusted functions: + * cdecl, stdcall, fastcall, dllimport (only for Windows). + * [public] is only supported for the trusted functions. + * Trusted function will be treated as [private] w/o the [public]. + */ + + trusted { + + public void ecall_function_calling_convs(void); + + /* + * [public]: + * public ECALL can be called directly in App. + */ + + public void ecall_function_public(void); + + /* + * [private]: + * private ECALL cannot be called directly in App. + */ + + int ecall_function_private(void); + + }; + + untrusted { + + /* + * [cdecl]: + * tells edger8r the calling convention of the OCALLs is 'cdecl'. + * [dllimport]: + * indicats the OCALL is provided in DLLs. + * + * Note: memccpy() is provided by MS system DLL, we don't need to implement it in App side. + */ + + [cdecl, dllimport] void *memccpy([in, out, size=len] void *dest, [in, size=len] const void *src, int val, size_t len); + + /* + * [allow]: + * OCALL 'ocall_function_allow' can invoke ECALL 'ecall_function_private' in App side. + * + * Note: No ECALL can be called in OCALL w/o [allow]. + */ + + void ocall_function_allow(void) allow(ecall_function_private); + + }; + +}; diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp new file mode 100644 index 0000000000..3ee37ab8f4 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp @@ -0,0 +1,217 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Test Pointer Auttributes */ + +#include +#include + +#include "sgx_trts.h" +#include "../Enclave.h" +#include "Enclave_t.h" + +/* checksum_internal: + * get simple checksum of input buffer and length + */ +int32_t checksum_internal(char *buf, size_t count) +{ + register int32_t sum = 0; + int16_t *ptr = (int16_t *)buf; + + /* Main summing loop */ + while(count > 1) { + sum = sum + *ptr++; + count = count - 2; + } + + /* Add left-over byte, if any */ + if (count > 0) + sum = sum + *((char *)ptr); + + return ~sum; +} + +/* ecall_pointer_user_check, ecall_pointer_in, ecall_pointer_out, ecall_pointer_in_out: + * The root ECALLs to test [in], [out], [user_check] attributes. + */ +size_t ecall_pointer_user_check(void *val, size_t sz) +{ + /* check if the buffer is allocated outside */ + if (sgx_is_outside_enclave(val, sz) != 1) + abort(); + + char tmp[100] = {0}; + size_t len = sz>100?100:sz; + + /* copy the memory into the enclave to make sure 'val' + * is not being changed in checksum_internal() */ + memcpy(tmp, val, len); + + int32_t sum = checksum_internal((char *)tmp, len); + printf("Checksum(0x%p, %zu) = 0x%x\n", + val, len, sum); + + /* modify outside memory directly */ + memcpy(val, "SGX_SUCCESS", len>12?12:len); + + return len; +} + +/* ecall_pointer_in: + * the buffer of val is copied to the enclave. + */ + +void ecall_pointer_in(int *val) +{ + if (sgx_is_within_enclave(val, sizeof(int)) != 1) + abort(); + *val = 1234; +} + +/* ecall_pointer_out: + * the buffer of val is copied to the untrusted side. + */ +void ecall_pointer_out(int *val) +{ + if (sgx_is_within_enclave(val, sizeof(int)) != 1) + abort(); + assert(*val == 0); + *val = 1234; +} + +/* ecall_pointer_in_out: + * the buffer of val is double-copied. + */ +void ecall_pointer_in_out(int *val) +{ + if (sgx_is_within_enclave(val, sizeof(int)) != 1) + abort(); + *val = 1234; +} + +/* ocall_pointer_attr: + * The root ECALL that test OCALL [in], [out], [user_check]. + */ +void ocall_pointer_attr(void) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + + int val = 0; + ret = ocall_pointer_user_check(&val); + if (ret != SGX_SUCCESS) + abort(); + + val = 0; + ret = ocall_pointer_in(&val); + if (ret != SGX_SUCCESS) + abort(); + assert(val == 0); + + val = 0; + ret = ocall_pointer_out(&val); + if (ret != SGX_SUCCESS) + abort(); + assert(val == 1234); + + val = 0; + ret = ocall_pointer_in_out(&val); + if (ret != SGX_SUCCESS) + abort(); + assert(val == 1234); + + return; +} + +/* ecall_pointer_string: + * [string] defines a string. + */ +void ecall_pointer_string(char *str) +{ + strncpy(str, "0987654321", strlen(str)); +} + +/* ecall_pointer_string_const: + * const [string] defines a string that cannot be modified. + */ +void ecall_pointer_string_const(const char *str) +{ + char* temp = new char[strlen(str)]; + strncpy(temp, str, strlen(str)); + delete []temp; +} + +/* ecall_pointer_size: + * 'len' needs to be specified to tell Edger8r the length of 'str'. + */ +void ecall_pointer_size(void *ptr, size_t len) +{ + strncpy((char*)ptr, "0987654321", len); +} + +/* ecall_pointer_count: + * 'cnt' needs to be specified to tell Edger8r the number of elements in 'arr'. + */ +void ecall_pointer_count(int *arr, int cnt) +{ + for (int i = (cnt - 1); i >= 0; i--) + arr[i] = (cnt - 1 - i); +} + +/* ecall_pointer_isptr_readonly: + * 'buf' is user defined type, shall be tagged with [isptr]. + * if it's not writable, [readonly] shall be specified. + */ +void ecall_pointer_isptr_readonly(buffer_t buf, size_t len) +{ + strncpy((char*)buf, "0987654321", len); +} + +/* get_buffer_len: + * get the length of input buffer 'buf'. + */ +size_t get_buffer_len(const char* buf) +{ + (void)buf; + return 10*sizeof(int); +} + +/* ecall_pointer_sizefunc: + * call get_buffer_len to determin the length of 'buf'. + */ +void ecall_pointer_sizefunc(char *buf) +{ + int *tmp = (int*)buf; + for (int i = 0; i < 10; i++) { + assert(tmp[i] == 0); + tmp[i] = i; + } +} diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.edl b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.edl new file mode 100644 index 0000000000..cbbc960f38 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.edl @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Pointers.edl - Samples for pointer attributes. */ + +enclave { + + /* + * Following keywords/attributes are supported for pointers in Edger8r: + * in, out, user_check, + * string, wstring, + * const, size, count, sizefunc, isptr, readonly + */ + + trusted { + + /* + * [user_check]: + * the pointer won't be validated, and the buffer pointed by + * 'val' is not copied into the enclave either. But Enclave + * can modify the memory pointed by 'val'. + */ + + public size_t ecall_pointer_user_check([user_check] void *val, size_t sz); + + /* + * [in]: + * buffer with the same size will be allocated inside the enclave, + * content pointed by 'val' will be copied into the new allocated + * memory inside. Any changes performed inside the enclave will not + * affect the buffer outside. + */ + + public void ecall_pointer_in([in] int *val); + + /* + * [out]: + * buffer with the same size will be allocated inside the enclave, + * but the content pointed by 'val' won't be copied. But after return, + * the buffer inside the enclave will copied into outside 'val'. + */ + + public void ecall_pointer_out([out] int *val); + + /* + * [in, out]: + * buffer with the same size will be allocated inside the enclave, + * the content pointed by 'val' will be copied either. After return, + * the buffer inside the enclave will by copied into outside 'val' again. + */ + + public void ecall_pointer_in_out([in, out] int *val); + + /* + * [string]: + * the attribute tells Edger8r 'str' is NULL terminated string, so strlen + * will be used to count the length of buffer pointed by 'str'. + */ + + public void ecall_pointer_string([in, out, string] char *str); + + /* + * [const]: + * the attribute tells Edger8r the buffer pointed by 'str' cannot be modified, + * so users cannot decorate 'str' with [out] attribute anymore. + */ + + public void ecall_pointer_string_const([in, string] const char *str); + + /* + * [size]: + * the attribute tells Edger8r the length of buffer in byte pointed by 'ptr' + * (shall be copied or not). + * Note: Users shall not specify [size] on [string] parameters. + */ + + public void ecall_pointer_size([in, out, size=len] void *ptr, size_t len); + + /* + * [count]: + * the attribute tells Edger8r the number of integers to be copied from 'arr'. + */ + + public void ecall_pointer_count([in, out, count=cnt] int *arr, int cnt); + + /* + * [isptr]: + * tells Edger8r the user defined type is a pointer; + * [readonly]: + * forbids the buffer allocated inside the enclave to be copied back to App + * (cannot use with [out]). + */ + + public void ecall_pointer_isptr_readonly([in, isptr, readonly, size=len] buffer_t buf, size_t len); + + /* + * [sizefunc]: + * call a function to decide the size/length of the parameter; + * Note: + * User need to define and implement `get_buf_len' as: + * size_t get_buf_len(const char* buf); + */ + + public void ecall_pointer_sizefunc([sizefunc = get_buffer_len, in, out] char *buf); + + }; + + /* + * Users can define multiple trusted/untrusted blocks, + * edger8r will merged them into one trusted/untrusted block. + */ + trusted { + /* + * Test pointer attributes in OCALLs + */ + + public void ocall_pointer_attr(void); + + }; + + untrusted { + + /* + * [user_check]: + * the pointer won't be valified, and the buffer pointed by 'val' is not + * copied to outside buffer either. Besides 'App' cannot modify the memory + * pointer by 'val'. + */ + + void ocall_pointer_user_check([user_check] int *val); + + /* + * [in]: + * buffer with the same size will be allocated in 'App' side, the content + * pointed by 'val' will be copied into the new allocated memory outside. + * Any changes performed by 'App' will not affect the buffer pointed by 'val'. + */ + + void ocall_pointer_in([in] int *val); + + /* + * [out]: + * buffer with the same size will be allocated in 'App' side, the content + * pointed by 'val' won't be copied. But after return, the buffer outside + * will be copied into the enclave. + */ + + void ocall_pointer_out([out] int *val); + + /* + * [in, out]: + * buffer with the same size will be allocated in 'App' side, the content + * pointed by 'val' will be copied either. After return, the buffer outside + * will copied into the enclave. + */ + + void ocall_pointer_in_out([in, out] int *val); + + }; + +}; diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.cpp b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.cpp new file mode 100644 index 0000000000..aba016a6d8 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Test Basic Types */ + +#include "sgx_trts.h" +#include "../Enclave.h" +#include "Enclave_t.h" +#include +#include + +/* used to eliminate `unused variable' warning */ +#define UNUSED(val) (void)(val) + +#define ULP 2 + +/* used to compare double variables in order to avoid compile warnings */ +bool almost_equal(double x, double y) +{ + /* the machine epsilon has to be scaled to the magnitude of the larger value + and multiplied by the desired precision in ULPs (units in the last place) */ + return std::abs(x-y) <= std::numeric_limits::epsilon() * std::abs(x+y) * ULP; +} + +/* used to compare double variables in order to avoid compile warnings */ +bool almost_equal(float x, float y) +{ + /* the machine epsilon has to be scaled to the magnitude of the larger value + and multiplied by the desired precision in ULPs (units in the last place) */ + return std::abs(x-y) <= std::numeric_limits::epsilon() * std::abs(x+y) * ULP; +} + +/* ecall_type_char: + * [char] value passed by App. + */ +void ecall_type_char(char val) +{ + assert(val == 0x12); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* ecall_type_int: + * [int] value passed by App. + */ +void ecall_type_int(int val) +{ + assert(val == 1234); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* ecall_type_float: + * [float] value passed by App. + */ +void ecall_type_float(float val) +{ + assert(almost_equal(val, (float)1234.0)); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* ecall_type_double: + * [double] value passed by App. + */ +void ecall_type_double(double val) +{ + assert(almost_equal(val, (double)1234.5678)); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* ecall_type_size_t: + * [size_t] value passed by App. + */ +void ecall_type_size_t(size_t val) +{ + assert(val == (size_t)12345678); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* ecall_type_wchar_t: + * [wchar_t] value passed by App. + */ +void ecall_type_wchar_t(wchar_t val) +{ + assert(val == (wchar_t)0x1234); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* ecall_type_struct: + * struct_foo_t is defined in EDL and can be used in ECALL. + */ +void ecall_type_struct(struct struct_foo_t val) +{ + assert(val.struct_foo_0 == 1234); + assert(val.struct_foo_1 == 5678); +#ifndef DEBUG + UNUSED(val); +#endif +} + +/* + * ecall_type_enum_union: + * enum_foo_t/union_foo_t is defined in EDL + * and can be used in ECALL. + */ +void ecall_type_enum_union(enum enum_foo_t val1, union union_foo_t *val2) +{ + if (sgx_is_outside_enclave(val2, sizeof(union union_foo_t)) != 1) + abort(); + val2->union_foo_0 = 1; + val2->union_foo_1 = 2; /* overwrite union_foo_0 */ + assert(val1 == ENUM_FOO_0); +#ifndef DEBUG + UNUSED(val1); +#endif +} diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.edl b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.edl new file mode 100644 index 0000000000..a23aed85ca --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.edl @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Types.edl - Samples for basic types. */ + +enclave { + + /* + * Following types can be supported in Edger8r: + * char, short, int, float, double, void, + * int8_t, int16_t, int32_t, int64_t, + * size_t, wchar_t, + * uint8_t, uint16_t, uint32_t, uint64_t, + * unsigned, struct, enum, union. + */ + + /* + * We will demo few types in ECALL functions, data + * types in OCALL functions can be handled either. + */ + + /* structure definition */ + struct struct_foo_t { + /* Basic types can be used in structure. */ + uint32_t struct_foo_0; + uint64_t struct_foo_1; + }; + + /* enum definition */ + enum enum_foo_t { + ENUM_FOO_0 = 0, + ENUM_FOO_1 = 1 + }; + + /* union definition */ + union union_foo_t { + uint32_t union_foo_0; + uint32_t union_foo_1; + uint64_t union_foo_3; + }; + + trusted { + + public void ecall_type_char(char val); + public void ecall_type_int(int val); + + public void ecall_type_float(float val); + public void ecall_type_double(double val); + + public void ecall_type_size_t(size_t val); + public void ecall_type_wchar_t(wchar_t val); + + public void ecall_type_struct(struct struct_foo_t val); + public void ecall_type_enum_union(enum enum_foo_t val1, [user_check] union union_foo_t *val2); + + /* for using user defined types, please refer to Pointers.edl, Arrays.edl. */ + }; + +}; diff --git a/SampleCode/SampleEnclave/Enclave/Enclave.config.xml b/SampleCode/SampleEnclave/Enclave/Enclave.config.xml new file mode 100644 index 0000000000..a94d12f001 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Enclave.config.xml @@ -0,0 +1,12 @@ + + + 0 + 0 + 0x40000 + 0x100000 + 10 + 1 + 0 + 0 + 0xFFFFFFFF + diff --git a/SampleCode/SampleEnclave/Enclave/Enclave.cpp b/SampleCode/SampleEnclave/Enclave/Enclave.cpp new file mode 100644 index 0000000000..94a3108c46 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Enclave.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include /* vsnprintf */ + +#include "Enclave.h" +#include "Enclave_t.h" /* print_string */ + +/* + * printf: + * Invokes OCALL to display the enclave buffer to the terminal. + */ +void printf(const char *fmt, ...) +{ + char buf[BUFSIZ] = {'\0'}; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, BUFSIZ, fmt, ap); + va_end(ap); + ocall_print_string(buf); +} diff --git a/SampleCode/SampleEnclave/Enclave/Enclave.edl b/SampleCode/SampleEnclave/Enclave/Enclave.edl new file mode 100644 index 0000000000..9e31bd2ce8 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Enclave.edl @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Enclave.edl - Top EDL file. */ + +enclave { + + include "user_types.h" /* buffer_t */ + + /* Import ECALL/OCALL from sub-directory EDLs. + * [from]: specifies the location of EDL file. + * [import]: specifies the functions to import, + * [*]: implies to import all functions. + */ + + from "Edger8rSyntax/Types.edl" import *; + from "Edger8rSyntax/Pointers.edl" import *; + from "Edger8rSyntax/Arrays.edl" import *; + from "Edger8rSyntax/Functions.edl" import *; + + from "TrustedLibrary/Libc.edl" import *; + from "TrustedLibrary/Libcxx.edl" import ecall_exception, ecall_map; + from "TrustedLibrary/Thread.edl" import *; + + /* + * ocall_print_string - invokes OCALL to display string buffer inside the enclave. + * [in]: copy the string buffer to App outside. + * [string]: specifies 'str' is a NULL terminated buffer. + */ + untrusted { + void ocall_print_string([in, string] const char *str); + }; + +}; diff --git a/SampleCode/SampleEnclave/Enclave/Enclave.h b/SampleCode/SampleEnclave/Enclave/Enclave.h new file mode 100644 index 0000000000..6e4c09ee2c --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Enclave.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ENCLAVE_H_ +#define _ENCLAVE_H_ + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +void printf(const char *fmt, ...); + +#if defined(__cplusplus) +} +#endif + +#endif /* !_ENCLAVE_H_ */ diff --git a/SampleCode/SampleEnclave/Enclave/Enclave.lds b/SampleCode/SampleEnclave/Enclave/Enclave.lds new file mode 100644 index 0000000000..e3d9d0ee0d --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Enclave.lds @@ -0,0 +1,9 @@ +enclave.so +{ + global: + g_global_data_sim; + g_global_data; + enclave_entry; + local: + *; +}; diff --git a/SampleCode/SampleEnclave/Enclave/Enclave_private.pem b/SampleCode/SampleEnclave/Enclave/Enclave_private.pem new file mode 100644 index 0000000000..529d07be35 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/Enclave_private.pem @@ -0,0 +1,39 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ +AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ +ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7jguwbCG1Pr +nEMdJ3Sew20vnje+RsngAzdPChoJpVsWi/K7cettX/tbnre1DL02GXc5qJoQYk7b +3zkmhz31TgFrd9VVtmUGyFXAysuSAb3EN+5VnHGr0xKkeg8utErea2FNtNIgua8H +ONfm9Eiyaav1SVKzPHly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SampleEnclave/Enclave/TrustedLibrary/Libc.cpp new file mode 100644 index 0000000000..b0e566ced1 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include + +#include "sgx_trts.h" +#include "../Enclave.h" +#include "Enclave_t.h" + +/* ecall_malloc_free: + * Uses malloc/free to allocate/free trusted memory. + */ +void ecall_malloc_free(void) +{ + void *ptr = malloc(100); + assert(ptr != NULL); + memset(ptr, 0x0, 100); + free(ptr); +} + +/* ecall_sgx_cpuid: + * Uses sgx_cpuid to get CPU features and types. + */ +void ecall_sgx_cpuid(int cpuinfo[4], int leaf) +{ + sgx_status_t ret = sgx_cpuid(cpuinfo, leaf); + if (ret != SGX_SUCCESS) + abort(); +} diff --git a/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.edl b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.edl new file mode 100644 index 0000000000..9efe3219d4 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.edl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Libc.edl - EDL sample for trusted C library. */ + +enclave { + + from "sgx_tstdc.edl" import sgx_oc_cpuidex; + + /* + * A subset of the C99 standard is supported as well as SGX customized functions: + * sgx_cpuid, etc. + */ + + trusted { + /* + * Utilize malloc/free in enclave. + */ + public void ecall_malloc_free(void); + + /* + * Utilize SGX version __cpuid() in enclave. + */ + public void ecall_sgx_cpuid([in, out] int cpuinfo[4], int leaf); + }; +}; diff --git a/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.cpp b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.cpp new file mode 100644 index 0000000000..6f76646466 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include + +#include "../Enclave.h" +#include "Enclave_t.h" + +/* + * ecall_exception: + * throw/catch C++ exception inside the enclave. + */ + +void ecall_exception(void) +{ + std::string foo = "foo"; + try { + throw std::runtime_error(foo); + } + catch (std::runtime_error const& e) { + assert( foo == e.what() ); + std::runtime_error clone(""); + clone = e; + assert(foo == clone.what() ); + } + catch (...) { + assert( false ); + } +} + +#include +#include + +using namespace std; + +/* + * ecall_map: + * Utilize STL in the enclave. + */ +void ecall_map(void) +{ + typedef map > map_t; + typedef map_t::value_type map_value; + map_t m; + + m.insert(map_value('a', 1)); + m.insert(map_value('b', 2)); + m.insert(map_value('c', 3)); + m.insert(map_value('d', 4)); + + assert(m['a'] == 1); + assert(m['b'] == 2); + assert(m['c'] == 3); + assert(m['d'] == 4); + + assert(m.find('e') == m.end()); + + return; +} diff --git a/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl new file mode 100644 index 0000000000..49a8b8d9d9 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Libcxx.edl - EDL sample for trusted C++ library. */ + +enclave { + + /* + * A subset of the C++03 standard is supported. + */ + + trusted { + /* + * Throw/catch exception inside the enclave. + */ + public void ecall_exception(void); + + /* + * Utilize inside the enclave. + */ + public void ecall_map(void); + }; +}; diff --git a/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.cpp b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.cpp new file mode 100644 index 0000000000..d360d716a6 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "../Enclave.h" +#include "Enclave_t.h" + +#include + +static size_t global_counter = 0; +static sgx_thread_mutex_t global_mutex = SGX_THREAD_MUTEX_INITIALIZER; + +#define BUFFER_SIZE 50 + +typedef struct { + int buf[BUFFER_SIZE]; + int occupied; + int nextin; + int nextout; + sgx_thread_mutex_t mutex; + sgx_thread_cond_t more; + sgx_thread_cond_t less; +} cond_buffer_t; + +static cond_buffer_t buffer = {{0, 0, 0, 0, 0, 0}, 0, 0, 0, + SGX_THREAD_MUTEX_INITIALIZER, SGX_THREAD_COND_INITIALIZER, SGX_THREAD_COND_INITIALIZER}; + +/* + * ecall_increase_counter: + * Utilize thread APIs inside the enclave. + */ +size_t ecall_increase_counter(void) +{ + size_t ret = 0; + for (int i = 0; i < LOOPS_PER_THREAD; i++) { + sgx_thread_mutex_lock(&global_mutex); + /* mutually exclusive adding */ + size_t tmp = global_counter; + global_counter = ++tmp; + if (4*LOOPS_PER_THREAD == global_counter) + ret = global_counter; + sgx_thread_mutex_unlock(&global_mutex); + } + return ret; +} + +void ecall_producer(void) +{ + for (int i = 0; i < 4*LOOPS_PER_THREAD; i++) { + cond_buffer_t *b = &buffer; + sgx_thread_mutex_lock(&b->mutex); + while (b->occupied >= BUFFER_SIZE) + sgx_thread_cond_wait(&b->less, &b->mutex); + b->buf[b->nextin] = b->nextin; + b->nextin++; + b->nextin %= BUFFER_SIZE; + b->occupied++; + sgx_thread_cond_signal(&b->more); + sgx_thread_mutex_unlock(&b->mutex); + } +} + +void ecall_consumer(void) +{ + for (int i = 0; i < LOOPS_PER_THREAD; i++) { + cond_buffer_t *b = &buffer; + sgx_thread_mutex_lock(&b->mutex); + while(b->occupied <= 0) + sgx_thread_cond_wait(&b->more, &b->mutex); + b->buf[b->nextout++] = 0; + b->nextout %= BUFFER_SIZE; + b->occupied--; + sgx_thread_cond_signal(&b->less); + sgx_thread_mutex_unlock(&b->mutex); + } +} diff --git a/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.edl b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.edl new file mode 100644 index 0000000000..77ce461de4 --- /dev/null +++ b/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.edl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Thread.edl - EDL sample for trusted thread library. */ + +enclave { + + from "sgx_tstdc.edl" import sgx_thread_wait_untrusted_event_ocall, sgx_thread_set_untrusted_event_ocall, sgx_thread_setwait_untrusted_events_ocall, sgx_thread_set_multiple_untrusted_events_ocall; + + trusted { + /* + * Use SGX mutex. + */ + public size_t ecall_increase_counter(); + + /* + * Use SGX condition variables. + */ + public void ecall_producer(); + public void ecall_consumer(); + + }; +}; diff --git a/SampleCode/SampleEnclave/Include/user_types.h b/SampleCode/SampleEnclave/Include/user_types.h new file mode 100644 index 0000000000..00a9bed83f --- /dev/null +++ b/SampleCode/SampleEnclave/Include/user_types.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* User defined types */ + + +#define LOOPS_PER_THREAD 500 + +typedef void *buffer_t; +typedef int array_t[10]; + diff --git a/SampleCode/SampleEnclave/Makefile b/SampleCode/SampleEnclave/Makefile new file mode 100644 index 0000000000..3885ed8b58 --- /dev/null +++ b/SampleCode/SampleEnclave/Makefile @@ -0,0 +1,209 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +######## SGX SDK Settings ######## + +SGX_SDK ?= /opt/intel/sgxsdk +SGX_MODE ?= SIM +SGX_ARCH ?= x64 + +ifeq ($(shell getconf LONG_BIT), 32) + SGX_ARCH := x86 +else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32) + SGX_ARCH := x86 +endif + +ifeq ($(SGX_ARCH), x86) + SGX_COMMON_CFLAGS := -m32 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r +else + SGX_COMMON_CFLAGS := -m64 + SGX_LIBRARY_PATH := $(SGX_SDK)/lib64 + SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign + SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r +endif + +ifeq ($(SGX_DEBUG), 1) +ifeq ($(SGX_PRERELEASE), 1) +$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!) +endif +endif + +ifeq ($(SGX_DEBUG), 1) + SGX_COMMON_CFLAGS += -O0 -g +else + SGX_COMMON_CFLAGS += -O2 +endif + +######## App Settings ######## + +ifneq ($(SGX_MODE), HW) + Urts_Library_Name := sgx_urts_sim +else + Urts_Library_Name := sgx_urts +endif + +App_Cpp_Files := App/App.cpp $(wildcard App/Edger8rSyntax/*.cpp) $(wildcard App/TrustedLibrary/*.cpp) +App_Include_Paths := -IInclude -IApp -I$(SGX_SDK)/include + +App_C_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) + +# Three configuration modes - Debug, prerelease, release +# Debug - Macro DEBUG enabled. +# Prerelease - Macro NDEBUG and EDEBUG enabled. +# Release - Macro NDEBUG enabled. +ifeq ($(SGX_DEBUG), 1) + App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG +else ifeq ($(SGX_PRERELEASE), 1) + App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG +else + App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG +endif + +App_Cpp_Flags := $(App_C_Flags) -std=c++11 +App_Link_Flags := $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread + +ifneq ($(SGX_MODE), HW) + App_Link_Flags += -lsgx_uae_service_sim +else + App_Link_Flags += -lsgx_uae_service +endif + +App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o) + +App_Name := app + +######## Enclave Settings ######## + +ifneq ($(SGX_MODE), HW) + Trts_Library_Name := sgx_trts_sim + Service_Library_Name := sgx_tservice_sim +else + Trts_Library_Name := sgx_trts + Service_Library_Name := sgx_tservice +endif +Crypto_Library_Name := sgx_tcrypto + +Enclave_Cpp_Files := Enclave/Enclave.cpp $(wildcard Enclave/Edger8rSyntax/*.cpp) $(wildcard Enclave/TrustedLibrary/*.cpp) +Enclave_Include_Paths := -IInclude -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport + +Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) +Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++03 -nostdinc++ +Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ + -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ + -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ + -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 \ + -Wl,--version-script=Enclave/Enclave.lds + +Enclave_Cpp_Objects := $(Enclave_Cpp_Files:.cpp=.o) + +Enclave_Name := enclave.so +Signed_Enclave_Name := enclave.signed.so +Enclave_Config_File := Enclave/Enclave.config.xml + +ifeq ($(SGX_MODE), HW) +ifneq ($(SGX_DEBUG), 1) +ifneq ($(SGX_PRERELEASE), 1) +Build_Mode = HW_RELEASE +endif +endif +endif + + +.PHONY: all run + +ifeq ($(Build_Mode), HW_RELEASE) +all: $(App_Name) $(Enclave_Name) + @echo "The project has been built in release hardware mode." + @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." + @echo "To sign the enclave use the command:" + @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" + @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." + @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." +else +all: $(App_Name) $(Signed_Enclave_Name) +endif + +run: all +ifneq ($(Build_Mode), HW_RELEASE) + @$(CURDIR)/$(App_Name) + @echo "RUN => $(App_Name) [$(SGX_MODE)|$(SGX_ARCH), OK]" +endif + +######## App Objects ######## + +App/Enclave_u.c: $(SGX_EDGER8R) Enclave/Enclave.edl + @cd App && $(SGX_EDGER8R) --untrusted ../Enclave/Enclave.edl --search-path ../Enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +App/Enclave_u.o: App/Enclave_u.c + @$(CC) $(App_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +App/%.o: App/%.cpp + @$(CXX) $(App_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(App_Name): App/Enclave_u.o $(App_Cpp_Objects) + @$(CXX) $^ -o $@ $(App_Link_Flags) + @echo "LINK => $@" + + +######## Enclave Objects ######## + +Enclave/Enclave_t.c: $(SGX_EDGER8R) Enclave/Enclave.edl + @cd Enclave && $(SGX_EDGER8R) --trusted ../Enclave/Enclave.edl --search-path ../Enclave --search-path $(SGX_SDK)/include + @echo "GEN => $@" + +Enclave/Enclave_t.o: Enclave/Enclave_t.c + @$(CC) $(Enclave_C_Flags) -c $< -o $@ + @echo "CC <= $<" + +Enclave/%.o: Enclave/%.cpp + @$(CXX) $(Enclave_Cpp_Flags) -c $< -o $@ + @echo "CXX <= $<" + +$(Enclave_Name): Enclave/Enclave_t.o $(Enclave_Cpp_Objects) + @$(CXX) $^ -o $@ $(Enclave_Link_Flags) + @echo "LINK => $@" + +$(Signed_Enclave_Name): $(Enclave_Name) + @$(SGX_ENCLAVE_SIGNER) sign -key Enclave/Enclave_private.pem -enclave $(Enclave_Name) -out $@ -config $(Enclave_Config_File) + @echo "SIGN => $@" + +.PHONY: clean + +clean: + @rm -f $(App_Name) $(Enclave_Name) $(Signed_Enclave_Name) $(App_Cpp_Objects) App/Enclave_u.* $(Enclave_Cpp_Objects) Enclave/Enclave_t.* diff --git a/SampleCode/SampleEnclave/README.txt b/SampleCode/SampleEnclave/README.txt new file mode 100644 index 0000000000..b07ef7fcfb --- /dev/null +++ b/SampleCode/SampleEnclave/README.txt @@ -0,0 +1,29 @@ +------------------------ +Purpose of SampleEnclave +------------------------ +The project demonstrates several fundamental usages of Intel(R) Software Guard +Extensions (SGX) SDK: +- Initializing and destroying an enclave +- Creating ECALLs or OCALLs +- Calling trusted libraries inside the enclave + +------------------------------------ +How to Build/Execute the Sample Code +------------------------------------ +1. Install Intel(R) SGX SDK for Linux* OS +2. Build the project with the prepared Makefile: + a. Hardware Mode, Debug build: + $ make SGX_MODE=HW SGX_DEBUG=1 + b. Hardware Mode, Pre-release build: + $ make SGX_MODE=HW SGX_PRERELEASE=1 + c. Hardware Mode, Release build: + $ make SGX_MODE=HW + d. Simulation Mode, Debug build: + $ make SGX_DEBUG=1 + e. Simulation Mode, Pre-release build: + $ make SGX_PRERELEASE=1 + f. Simulation Mode, Release build: + $ make +3. Execute the binary directly: + $ ./app + diff --git a/build-scripts/enclave.lds b/build-scripts/enclave.lds new file mode 100644 index 0000000000..975b185f3c --- /dev/null +++ b/build-scripts/enclave.lds @@ -0,0 +1,9 @@ +{ +global: + enclave_entry; + g_global_data_sim; + g_peak_heap_used; + g_global_data; +local: + *; +}; diff --git a/buildenv.mk b/buildenv.mk new file mode 100644 index 0000000000..6fdda27e47 --- /dev/null +++ b/buildenv.mk @@ -0,0 +1,153 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +# ----------------------------------------------------------------------------- +# Function : parent-dir +# Arguments: 1: path +# Returns : Parent dir or path of $1, with final separator removed. +# ----------------------------------------------------------------------------- +parent-dir = $(patsubst %/,%,$(dir $(1:%/=%))) + +# ----------------------------------------------------------------------------- +# Macro : my-dir +# Returns : the directory of the current Makefile +# Usage : $(my-dir) +# ----------------------------------------------------------------------------- +my-dir = $(realpath $(call parent-dir,$(lastword $(MAKEFILE_LIST)))) + + +ROOT_DIR := $(call my-dir) +COMMON_DIR := $(ROOT_DIR)/common +LINUX_EXTERNAL_DIR := $(ROOT_DIR)/external +LINUX_PSW_DIR := $(ROOT_DIR)/psw +LINUX_SDK_DIR := $(ROOT_DIR)/sdk +LINUX_UNITTESTS := $(ROOT_DIR)/unittests + + +CP := /bin/cp -f +MKDIR := mkdir -p + +# clean the content of 'INCLUDE' - this variable will be set by vcvars32.bat +# thus it will cause build error when this variable is used by our Makefile, +# when compiling the code under Cygwin tainted by MSVC environment settings. +INCLUDE := + +# this will return the path to the file that included the buildenv.mk file +CUR_DIR := $(realpath $(call parent-dir,$(lastword $(wordlist 2,$(words $(MAKEFILE_LIST)),x $(MAKEFILE_LIST))))) + +# turn on stack protector for SDK +COMMON_FLAGS += -fstack-protector + +ifdef DEBUG + COMMON_FLAGS += -ggdb -DDEBUG -UNDEBUG + COMMON_FLAGS += -DSE_DEBUG_LEVEL=SE_TRACE_DEBUG +else + COMMON_FLAGS += -O2 -UDEBUG -DNDEBUG +endif + +ifdef SE_SIM + COMMON_FLAGS += -DSE_SIM +endif + +# turn on compiler warnings as much as possible +COMMON_FLAGS += -Wall -Wextra -Winit-self -Wpointer-arith -Wreturn-type \ + -Waddress -Wsequence-point -Wformat-security \ + -Wmissing-include-dirs -Wfloat-equal -Wundef -Wshadow \ + -Wcast-align -Wconversion -Wredundant-decls + +# additional warnings flags for C +CFLAGS += -Wjump-misses-init -Wstrict-prototypes -Wunsuffixed-float-constants + +# additional warnings flags for C++ +CXXFLAGS += -Wnon-virtual-dtor + +# for static_assert() +CXXFLAGS += -std=c++0x + +.DEFAULT_GOAL := all +# this turns off the RCS / SCCS implicit rules of GNU Make +% : RCS/%,v +% : RCS/% +% : %,v +% : s.% +% : SCCS/s.% + +# If a rule fails, delete $@. +.DELETE_ON_ERROR: + +HOST_FILE_PROGRAM := file + +UNAME := $(shell uname -m) +ifneq (,$(findstring 86,$(UNAME))) + HOST_ARCH := x86 + ifneq (,$(shell $(HOST_FILE_PROGRAM) -L $(SHELL) | grep 'x86[_-]64')) + HOST_ARCH := x86_64 + endif +else + $(info Unknown host CPU arhitecture $(UNAME)) + $(error Aborting) +endif + +BUILD_DIR := $(ROOT_DIR)/build/linux + +ifeq "$(findstring __INTEL_COMPILER, $(shell $(CC) -E -dM -xc /dev/null))" "__INTEL_COMPILER" + ifeq ($(shell test -f /usr/bin/dpkg; echo $$?), 0) + ADDED_INC := -I /usr/include/$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH) + endif +endif + +ARCH := $(HOST_ARCH) +ifeq "$(findstring -m32, $(CXXFLAGS))" "-m32" + ARCH := x86 +endif + +ifeq ($(ARCH), x86) +COMMON_FLAGS += -DITT_ARCH_IA32 +else +COMMON_FLAGS += -DITT_ARCH_IA64 +endif + +CFLAGS += $(COMMON_FLAGS) +CXXFLAGS += $(COMMON_FLAGS) + +# Compiler and linker options for an Enclave +# +# We are using '--export-dynamic' so that `g_global_data_sim' etc. +# will be exported to dynamic symbol table. +# +# When `pie' is enabled, the linker (both BFD and Gold) under Ubuntu 14.04 +# will hide all symbols from dynamic symbol table even if they are marked +# as `global' in the LD version script. +ENCLAVE_CFLAGS = -ffreestanding -nostdinc -fvisibility=hidden -fpie +ENCLAVE_CXXFLAGS = $(ENCLAVE_CFLAGS) -nostdinc++ +ENCLAVE_LDFLAGS = -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ + -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ + -Wl,--defsym,__ImageBase=0 diff --git a/common/inc/internal/ae_ipp.h b/common/inc/internal/ae_ipp.h new file mode 100644 index 0000000000..3fad09cdff --- /dev/null +++ b/common/inc/internal/ae_ipp.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _AE_IPP_H +#define _AE_IPP_H + +#include "ippcore.h" +#include "ippcp.h" + +#endif diff --git a/common/inc/internal/arch.h b/common/inc/internal/arch.h new file mode 100644 index 0000000000..876e2aad50 --- /dev/null +++ b/common/inc/internal/arch.h @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_ARCH_H_ +#define _SE_ARCH_H_ + +#include "inst.h" +#include "se_types.h" +#include "sgx_attributes.h" +#include "sgx_key.h" +#include "sgx_report.h" +#include "sgx_tcrypto.h" + +#define SE_PAGE_SIZE 0x1000 +#define TCS_SIZE SE_PAGE_SIZE + +#pragma pack(push, 1) + +#if !defined(__cplusplus) || defined(__INTEL_COMPILER) || (defined(SE_GNU) && !defined(__GXX_EXPERIMENTAL_CXX0X__)) +#define _ASSERT_CONCAT(a, b) a##b +#define ASSERT_CONCAT(a, b) _ASSERT_CONCAT(a, b) +#define se_static_assert(e) typedef char ASSERT_CONCAT(assert_line, __LINE__)[(e)?1:-1] +#else +#define se_static_assert(e) static_assert(e,#e) +#endif + +se_static_assert(sizeof(sgx_key_request_t) == 512); +se_static_assert(sizeof(sgx_target_info_t) == 512); + +/*SECS data structure*/ +typedef struct _secs_t +{ + uint64_t size; /* ( 0) Size of the enclave in bytes */ + PADDED_POINTER(void, base); /* ( 8) Base address of enclave */ + uint32_t ssa_frame_size; /* ( 16) size of 1 SSA frame in pages */ + sgx_misc_select_t misc_select; /* ( 20) Which fields defined in SSA.MISC */ +#define SECS_RESERVED1_LENGTH 24 + uint8_t reserved1[SECS_RESERVED1_LENGTH]; /* ( 24) reserved */ + sgx_attributes_t attributes; /* ( 48) ATTRIBUTES Flags Field */ + sgx_measurement_t mr_enclave; /* ( 64) Integrity Reg 0 - Enclave measurement */ +#define SECS_RESERVED2_LENGTH 32 + uint8_t reserved2[SECS_RESERVED2_LENGTH]; /* ( 96) reserved */ + sgx_measurement_t mr_signer; /* (128) Integrity Reg 1 - Enclave signing key */ +#define SECS_RESERVED3_LENGTH 96 + uint8_t reserved3[SECS_RESERVED3_LENGTH]; /* (160) reserved */ + sgx_prod_id_t isv_prod_id; /* (256) product ID of enclave */ + sgx_isv_svn_t isv_svn; /* (258) Security Version of the Enclave */ +#define SECS_RESERVED4_LENGTH 3836 + uint8_t reserved4[SECS_RESERVED4_LENGTH];/* (260) reserved */ +} secs_t; + +/* +TCS +flags definitions +*/ +#define DBGOPTIN 1 /* used by debugger */ + +typedef struct _tcs_t +{ + uint64_t reserved0; /* (0) */ + uint64_t flags; /* (8)bit 0: DBGOPTION */ + uint64_t ossa; /* (16)State Save Area */ + uint32_t cssa; /* (24)Current SSA slot */ + uint32_t nssa; /* (28)Number of SSA slots */ + uint64_t oentry; /* (32)Offset in enclave to which control is transferred on EENTER if enclave INACTIVE state */ + uint64_t reserved1; /* (40) */ + uint64_t ofs_base; /* (48)When added to the base address of the enclave, produces the base address FS segment inside the enclave */ + uint64_t ogs_base; /* (56)When added to the base address of the enclave, produces the base address GS segment inside the enclave */ + uint32_t ofs_limit; /* (64)Size to become the new FS limit in 32-bit mode */ + uint32_t ogs_limit; /* (68)Size to become the new GS limit in 32-bit mode */ +#define TCS_RESERVED_LENGTH 4024 + uint8_t reserved[TCS_RESERVED_LENGTH]; /* (72) */ +}tcs_t; + +se_static_assert(sizeof(tcs_t) == SE_PAGE_SIZE); + +/**************************************************************************** + * Definitions for SSA + ****************************************************************************/ +typedef struct _exit_info_t +{ + uint32_t vector:8; /* Exception number of exceptions reported inside enclave */ + uint32_t exit_type:3; /* 3: Hardware exceptions, 6: Software exceptions */ + uint32_t reserved:20; + uint32_t valid:1; /* 0: unsupported exceptions, 1: Supported exceptions */ +} exit_info_t; + +#define SE_VECTOR_DE 0 +#define SE_VECTOR_DB 1 +#define SE_VECTOR_BP 3 +#define SE_VECTOR_BR 5 +#define SE_VECTOR_UD 6 +#define SE_VECTOR_MF 16 +#define SE_VECTOR_AC 17 +#define SE_VECTOR_XM 19 + +typedef struct _ssa_gpr_t +{ + REGISTER( ax); /* (0) */ + REGISTER( cx); /* (8) */ + REGISTER( dx); /* (16) */ + REGISTER( bx); /* (24) */ + REGISTER( sp); /* (32) */ + REGISTER( bp); /* (40) */ + REGISTER( si); /* (48) */ + REGISTER( di); /* (56) */ + uint64_t r8; /* (64) */ + uint64_t r9; /* (72) */ + uint64_t r10; /* (80) */ + uint64_t r11; /* (88) */ + uint64_t r12; /* (96) */ + uint64_t r13; /* (104) */ + uint64_t r14; /* (112) */ + uint64_t r15; /* (120) */ + REGISTER(flags); /* (128) */ + REGISTER( ip); /* (136) */ + REGISTER( sp_u); /* (144) untrusted stack pointer. saved by EENTER */ + REGISTER( bp_u); /* (152) untrusted frame pointer. saved by EENTER */ + exit_info_t exit_info; /* (160) contain information for exits */ + uint32_t reserved; /* (164) padding to multiple of 8 bytes */ + uint64_t fs; /* (168) FS register */ + uint64_t gs; /* (176) GS register */ +} ssa_gpr_t; + +typedef uint64_t si_flags_t; + +#define SI_FLAG_NONE 0x0 +#define SI_FLAG_R 0x1 /* Read Access */ +#define SI_FLAG_W 0x2 /* Write Access */ +#define SI_FLAG_X 0x4 /* Execute Access */ +#define SI_FLAG_PT_LOW_BIT 0x8 /* PT low bit */ +#define SI_FLAG_PT_MASK (0xFF< +#include + +namespace { + template + void delete_ptrs_from_container(T& vec) + { + typename T::iterator iter = vec.begin(); + typename T::iterator end = vec.end(); + typename T::iterator this_iter; + + while (iter != end) + { + this_iter = iter; + ++iter; + delete *this_iter; + } + } + + /* Each pair is well-formed (p.first <= p.second) */ + template + bool is_overlap(const std::pair& p1, + const std::pair& p2) + { + assert(p1.first <= p1.second); + assert(p2.first <= p2.second); + + return ((p1.first <= p2.second) && (p2.first <= p1.second)); + } +} + +#endif diff --git a/common/inc/internal/cpuid.h b/common/inc/internal/cpuid.h new file mode 100644 index 0000000000..b3ee8f5db9 --- /dev/null +++ b/common/inc/internal/cpuid.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _CPUID_H_ +#define _CPUID_H_ + +#include "linux/cpuid_gnu.h" + + +#endif /* _CPUID_H_ */ diff --git a/common/inc/internal/dh.h b/common/inc/internal/dh.h new file mode 100644 index 0000000000..76c347f588 --- /dev/null +++ b/common/inc/internal/dh.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _DH_H +#define _DH_H + +#include "utility.h" + +/*return true if encrypt message successfully */ +bool encrypt_msg(pse_message_t* pse_msg, uint8_t* data, sgx_key_128bit_t* authenticated_encryption_key); + +/*return true if decrypt message successfully */ +bool decrypt_msg(pse_message_t* pse_msg, uint8_t* data, sgx_key_128bit_t* authenticated_encryption_key); +#endif diff --git a/common/inc/internal/driver_api.h b/common/inc/internal/driver_api.h new file mode 100644 index 0000000000..c0e20232e7 --- /dev/null +++ b/common/inc/internal/driver_api.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _DRIVER_API_H_ +#define _DRIVER_API_H_ + +#include "arch.h" +#include "sgx_eid.h" + +/* +@enclave_id identify the unique enclave; +@start_addr is the linear address that driver allocate for app; +*/ +int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr); +/* +*@attr can be REMOVABLE +*/ +int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, size_t offset, const sec_info_t &secinfo, uint32_t attr); +int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, token_t *launch); +int destroy_enclave(sgx_enclave_id_t enclave_id); + +#endif diff --git a/common/inc/internal/ecp_interface.h b/common/inc/internal/ecp_interface.h new file mode 100644 index 0000000000..d3b7515cd5 --- /dev/null +++ b/common/inc/internal/ecp_interface.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ECP_INTERFACE_H +#define _ECP_INTERFACE_H + +#include "sgx_ecp_types.h" +#include "sgx_tcrypto.h" + +//Key Derivation Function ID : 0x0001 AES-CMAC Entropy Extraction and Key Expansion +const uint16_t AES_CMAC_KDF_ID = 0x0001; + +sgx_status_t derive_key( + const sgx_ec256_dh_shared_t* shared_key, + const char* label, + uint32_t label_length, + sgx_ec_key_128bit_t* derived_key); + +#ifndef INTERNAL_SGX_ERROR_CODE_CONVERTOR +#define INTERNAL_SGX_ERROR_CODE_CONVERTOR(x) if(x != SGX_ERROR_OUT_OF_MEMORY){x = SGX_ERROR_UNEXPECTED;} +#endif + +#endif + diff --git a/common/inc/internal/elf_util.h b/common/inc/internal/elf_util.h new file mode 100644 index 0000000000..408c42f642 --- /dev/null +++ b/common/inc/internal/elf_util.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _ELF_UTIL_H_ +#define _ELF_UTIL_H_ + +#include "elfheader/elf_common.h" +#include "elfheader/elfstructs.h" + +#ifndef __ELF_NATIVE_CLASS +# if defined(_M_X64) || defined(__x86_64) || defined(__amd64) +# include /* for UINT_MAX */ +# define __ELF_NATIVE_CLASS 64 +# else +# define __ELF_NATIVE_CLASS 32 +# endif +#endif + +#if __ELF_NATIVE_CLASS == 64 +# define Rel Rela + +# define RTS_DT_REL DT_RELA +# define RTS_DT_RELSZ DT_RELASZ +# define RTS_DT_RELENT DT_RELAENT +# else +# define RTS_DT_REL DT_REL +# define RTS_DT_RELSZ DT_RELSZ +# define RTS_DT_RELENT DT_RELENT +#endif + +/* We use this macro to refer to ELF types independent of the native wordsize. + `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ +#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type) + +/* We use this macro to refer to ELF macro constants. For example, + `ELFW(R_SYM)' is used in place of `ELF32_R_SYM' or `ELF64_R_SYM'. */ +#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) + +#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) +#define _ElfW_1(e,w,t) e##w##t + +/* GNU header uses `JUMP_SLOT' while `JMP_SLOT' in FreeBSD. */ +#define R_X86_64_JUMP_SLOT R_X86_64_JMP_SLOT + +#endif diff --git a/common/inc/internal/elfheader/README.txt b/common/inc/internal/elfheader/README.txt new file mode 100644 index 0000000000..654a5ecadd --- /dev/null +++ b/common/inc/internal/elfheader/README.txt @@ -0,0 +1,59 @@ +Note, the files `elf_common.h' and `elfstructs.h' are from FreeBSD. + git://github.com/freebsd/freebsd.git + +But with slight modifications shown below: + +diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h +index 8f02ef1..7601abb 100644 +--- a/sys/sys/elf_common.h ++++ b/sys/sys/elf_common.h +@@ -30,6 +30,9 @@ + #ifndef _SYS_ELF_COMMON_H_ + #define _SYS_ELF_COMMON_H_ 1 + ++typedef uint32_t u_int32_t; ++typedef uint32_t Elf_Symndx; ++ + /* + * ELF definitions that are independent of architecture or word size. + */ +@@ -117,9 +120,6 @@ typedef struct { + #define ELFOSABI_ARM 97 /* ARM */ + #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +-#define ELFOSABI_SYSV ELFOSABI_NONE /* symbol used in old spec */ +-#define ELFOSABI_MONTEREY ELFOSABI_AIX /* Monterey */ +- + /* e_ident */ + #define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ +@@ -242,7 +242,6 @@ typedef struct { + #define EM_486 6 /* Intel i486. */ + #define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ + #define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */ +-#define EM_ALPHA 0x9026 /* Alpha (written in the absence of an ABI) */ + + /* Special section indexes. */ + #define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */ +@@ -441,6 +440,8 @@ typedef struct { + #define DT_MOVETAB 0x6ffffefe /* move table */ + #define DT_SYMINFO 0x6ffffeff /* syminfo table */ + #define DT_ADDRRNGHI 0x6ffffeff ++#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ ++#define DT_ADDRNUM 11 + + #define DT_VERSYM 0x6ffffff0 /* Address of versym section. */ + #define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */ +@@ -505,12 +506,9 @@ typedef struct { + #define STT_FILE 4 /* Source file. */ + #define STT_COMMON 5 /* Uninitialized common block. */ + #define STT_TLS 6 /* TLS object. */ +-#define STT_NUM 7 + #define STT_LOOS 10 /* Reserved range for operating system */ + #define STT_GNU_IFUNC 10 + #define STT_HIOS 12 /* specific semantics. */ +-#define STT_LOPROC 13 /* reserved range for processor */ +-#define STT_HIPROC 15 /* specific semantics. */ + + /* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ + #define STV_DEFAULT 0x0 /* Default visibility (see binding). */ diff --git a/common/inc/internal/elfheader/elf_common.h b/common/inc/internal/elfheader/elf_common.h new file mode 100644 index 0000000000..7601abb189 --- /dev/null +++ b/common/inc/internal/elfheader/elf_common.h @@ -0,0 +1,975 @@ +/*- + * Copyright (c) 2000, 2001, 2008, 2011, David E. O'Brien + * Copyright (c) 1998 John D. Polstra. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_ELF_COMMON_H_ +#define _SYS_ELF_COMMON_H_ 1 + +typedef uint32_t u_int32_t; +typedef uint32_t Elf_Symndx; + +/* + * ELF definitions that are independent of architecture or word size. + */ + +/* + * Note header. The ".note" section contains an array of notes. Each + * begins with this header, aligned to a word boundary. Immediately + * following the note header is n_namesz bytes of name, padded to the + * next word boundary. Then comes n_descsz bytes of descriptor, again + * padded to a word boundary. The values of n_namesz and n_descsz do + * not include the padding. + */ + +typedef struct { + u_int32_t n_namesz; /* Length of name. */ + u_int32_t n_descsz; /* Length of descriptor. */ + u_int32_t n_type; /* Type of this note. */ +} Elf_Note; + +/* + * The header for GNU-style hash sections. + */ + +typedef struct { + u_int32_t gh_nbuckets; /* Number of hash buckets. */ + u_int32_t gh_symndx; /* First visible symbol in .dynsym. */ + u_int32_t gh_maskwords; /* #maskwords used in bloom filter. */ + u_int32_t gh_shift2; /* Bloom filter shift count. */ +} Elf_GNU_Hash_Header; + +/* Indexes into the e_ident array. Keep synced with + http://www.sco.com/developers/gabi/latest/ch4.eheader.html */ +#define EI_MAG0 0 /* Magic number, byte 0. */ +#define EI_MAG1 1 /* Magic number, byte 1. */ +#define EI_MAG2 2 /* Magic number, byte 2. */ +#define EI_MAG3 3 /* Magic number, byte 3. */ +#define EI_CLASS 4 /* Class of machine. */ +#define EI_DATA 5 /* Data format. */ +#define EI_VERSION 6 /* ELF format version. */ +#define EI_OSABI 7 /* Operating system / ABI identification */ +#define EI_ABIVERSION 8 /* ABI version */ +#define OLD_EI_BRAND 8 /* Start of architecture identification. */ +#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */ +#define EI_NIDENT 16 /* Size of e_ident array. */ + +/* Values for the magic number bytes. */ +#define ELFMAG0 0x7f +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" /* magic string */ +#define SELFMAG 4 /* magic string size */ + +/* Values for e_ident[EI_VERSION] and e_version. */ +#define EV_NONE 0 +#define EV_CURRENT 1 + +/* Values for e_ident[EI_CLASS]. */ +#define ELFCLASSNONE 0 /* Unknown class. */ +#define ELFCLASS32 1 /* 32-bit architecture. */ +#define ELFCLASS64 2 /* 64-bit architecture. */ + +/* Values for e_ident[EI_DATA]. */ +#define ELFDATANONE 0 /* Unknown data format. */ +#define ELFDATA2LSB 1 /* 2's complement little-endian. */ +#define ELFDATA2MSB 2 /* 2's complement big-endian. */ + +/* Values for e_ident[EI_OSABI]. */ +#define ELFOSABI_NONE 0 /* UNIX System V ABI */ +#define ELFOSABI_HPUX 1 /* HP-UX operating system */ +#define ELFOSABI_NETBSD 2 /* NetBSD */ +#define ELFOSABI_LINUX 3 /* GNU/Linux */ +#define ELFOSABI_HURD 4 /* GNU/Hurd */ +#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ +#define ELFOSABI_SOLARIS 6 /* Solaris */ +#define ELFOSABI_AIX 7 /* AIX */ +#define ELFOSABI_IRIX 8 /* IRIX */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD */ +#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD */ +#define ELFOSABI_OPENVMS 13 /* Open VMS */ +#define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ +#define ELFOSABI_AROS 15 /* Amiga Research OS */ +#define ELFOSABI_ARM 97 /* ARM */ +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +/* e_ident */ +#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ + (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ + (ehdr).e_ident[EI_MAG3] == ELFMAG3) + +/* Values for e_type. */ +#define ET_NONE 0 /* Unknown type. */ +#define ET_REL 1 /* Relocatable. */ +#define ET_EXEC 2 /* Executable. */ +#define ET_DYN 3 /* Shared object. */ +#define ET_CORE 4 /* Core file. */ +#define ET_LOOS 0xfe00 /* First operating system specific. */ +#define ET_HIOS 0xfeff /* Last operating system-specific. */ +#define ET_LOPROC 0xff00 /* First processor-specific. */ +#define ET_HIPROC 0xffff /* Last processor-specific. */ + +/* Values for e_machine. */ +#define EM_NONE 0 /* Unknown machine. */ +#define EM_M32 1 /* AT&T WE32100. */ +#define EM_SPARC 2 /* Sun SPARC. */ +#define EM_386 3 /* Intel i386. */ +#define EM_68K 4 /* Motorola 68000. */ +#define EM_88K 5 /* Motorola 88000. */ +#define EM_860 7 /* Intel i860. */ +#define EM_MIPS 8 /* MIPS R3000 Big-Endian only. */ +#define EM_S370 9 /* IBM System/370. */ +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 Little-Endian. */ +#define EM_PARISC 15 /* HP PA-RISC. */ +#define EM_VPP500 17 /* Fujitsu VPP500. */ +#define EM_SPARC32PLUS 18 /* SPARC v8plus. */ +#define EM_960 19 /* Intel 80960. */ +#define EM_PPC 20 /* PowerPC 32-bit. */ +#define EM_PPC64 21 /* PowerPC 64-bit. */ +#define EM_S390 22 /* IBM System/390. */ +#define EM_V800 36 /* NEC V800. */ +#define EM_FR20 37 /* Fujitsu FR20. */ +#define EM_RH32 38 /* TRW RH-32. */ +#define EM_RCE 39 /* Motorola RCE. */ +#define EM_ARM 40 /* ARM. */ +#define EM_SH 42 /* Hitachi SH. */ +#define EM_SPARCV9 43 /* SPARC v9 64-bit. */ +#define EM_TRICORE 44 /* Siemens TriCore embedded processor. */ +#define EM_ARC 45 /* Argonaut RISC Core. */ +#define EM_H8_300 46 /* Hitachi H8/300. */ +#define EM_H8_300H 47 /* Hitachi H8/300H. */ +#define EM_H8S 48 /* Hitachi H8S. */ +#define EM_H8_500 49 /* Hitachi H8/500. */ +#define EM_IA_64 50 /* Intel IA-64 Processor. */ +#define EM_MIPS_X 51 /* Stanford MIPS-X. */ +#define EM_COLDFIRE 52 /* Motorola ColdFire. */ +#define EM_68HC12 53 /* Motorola M68HC12. */ +#define EM_MMA 54 /* Fujitsu MMA. */ +#define EM_PCP 55 /* Siemens PCP. */ +#define EM_NCPU 56 /* Sony nCPU. */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor. */ +#define EM_STARCORE 58 /* Motorola Star*Core processor. */ +#define EM_ME16 59 /* Toyota ME16 processor. */ +#define EM_ST100 60 /* STMicroelectronics ST100 processor. */ +#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ processor. */ +#define EM_X86_64 62 /* Advanced Micro Devices x86-64 */ +#define EM_AMD64 EM_X86_64 /* Advanced Micro Devices x86-64 (compat) */ +#define EM_PDSP 63 /* Sony DSP Processor. */ +#define EM_FX66 66 /* Siemens FX66 microcontroller. */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 + microcontroller. */ +#define EM_ST7 68 /* STmicroelectronics ST7 8-bit + microcontroller. */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller. */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller. */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller. */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller. */ +#define EM_SVX 73 /* Silicon Graphics SVx. */ +#define EM_ST19 74 /* STMicroelectronics ST19 8-bit mc. */ +#define EM_VAX 75 /* Digital VAX. */ +#define EM_CRIS 76 /* Axis Communications 32-bit embedded + processor. */ +#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded + processor. */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor. */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor. */ +#define EM_MMIX 80 /* Donald Knuth's educational 64-bit proc. */ +#define EM_HUANY 81 /* Harvard University machine-independent + object files. */ +#define EM_PRISM 82 /* SiTera Prism. */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller. */ +#define EM_FR30 84 /* Fujitsu FR30. */ +#define EM_D10V 85 /* Mitsubishi D10V. */ +#define EM_D30V 86 /* Mitsubishi D30V. */ +#define EM_V850 87 /* NEC v850. */ +#define EM_M32R 88 /* Mitsubishi M32R. */ +#define EM_MN10300 89 /* Matsushita MN10300. */ +#define EM_MN10200 90 /* Matsushita MN10200. */ +#define EM_PJ 91 /* picoJava. */ +#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor. */ +#define EM_ARC_A5 93 /* ARC Cores Tangent-A5. */ +#define EM_XTENSA 94 /* Tensilica Xtensa Architecture. */ +#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor. */ +#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose + Processor. */ +#define EM_NS32K 97 /* National Semiconductor 32000 series. */ +#define EM_TPC 98 /* Tenor Network TPC processor. */ +#define EM_SNP1K 99 /* Trebia SNP 1000 processor. */ +#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller. */ +#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family. */ +#define EM_MAX 102 /* MAX Processor. */ +#define EM_CR 103 /* National Semiconductor CompactRISC + microprocessor. */ +#define EM_F2MC16 104 /* Fujitsu F2MC16. */ +#define EM_MSP430 105 /* Texas Instruments embedded microcontroller + msp430. */ +#define EM_BLACKFIN 106 /* Analog Devices Blackfin (DSP) processor. */ +#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processors. */ +#define EM_SEP 108 /* Sharp embedded microprocessor. */ +#define EM_ARCA 109 /* Arca RISC Microprocessor. */ +#define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd. + and MPRC of Peking University */ + +/* Non-standard or deprecated. */ +#define EM_486 6 /* Intel i486. */ +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ +#define EM_ALPHA_STD 41 /* Digital Alpha (standard value). */ + +/* Special section indexes. */ +#define SHN_UNDEF 0 /* Undefined, missing, irrelevant. */ +#define SHN_LORESERVE 0xff00 /* First of reserved range. */ +#define SHN_LOPROC 0xff00 /* First processor-specific. */ +#define SHN_HIPROC 0xff1f /* Last processor-specific. */ +#define SHN_LOOS 0xff20 /* First operating system-specific. */ +#define SHN_HIOS 0xff3f /* Last operating system-specific. */ +#define SHN_ABS 0xfff1 /* Absolute values. */ +#define SHN_COMMON 0xfff2 /* Common data. */ +#define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere. */ +#define SHN_HIRESERVE 0xffff /* Last of reserved range. */ + +/* sh_type */ +#define SHT_NULL 0 /* inactive */ +#define SHT_PROGBITS 1 /* program defined information */ +#define SHT_SYMTAB 2 /* symbol table section */ +#define SHT_STRTAB 3 /* string table section */ +#define SHT_RELA 4 /* relocation section with addends */ +#define SHT_HASH 5 /* symbol hash table section */ +#define SHT_DYNAMIC 6 /* dynamic section */ +#define SHT_NOTE 7 /* note section */ +#define SHT_NOBITS 8 /* no space section */ +#define SHT_REL 9 /* relocation section - no addends */ +#define SHT_SHLIB 10 /* reserved - purpose unknown */ +#define SHT_DYNSYM 11 /* dynamic symbol table section */ +#define SHT_INIT_ARRAY 14 /* Initialization function pointers. */ +#define SHT_FINI_ARRAY 15 /* Termination function pointers. */ +#define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs. */ +#define SHT_GROUP 17 /* Section group. */ +#define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX). */ +#define SHT_LOOS 0x60000000 /* First of OS specific semantics */ +#define SHT_LOSUNW 0x6ffffff4 +#define SHT_SUNW_dof 0x6ffffff4 +#define SHT_SUNW_cap 0x6ffffff5 +#define SHT_SUNW_SIGNATURE 0x6ffffff6 +#define SHT_GNU_HASH 0x6ffffff6 +#define SHT_SUNW_ANNOTATE 0x6ffffff7 +#define SHT_SUNW_DEBUGSTR 0x6ffffff8 +#define SHT_SUNW_DEBUG 0x6ffffff9 +#define SHT_SUNW_move 0x6ffffffa +#define SHT_SUNW_COMDAT 0x6ffffffb +#define SHT_SUNW_syminfo 0x6ffffffc +#define SHT_SUNW_verdef 0x6ffffffd +#define SHT_GNU_verdef 0x6ffffffd /* Symbol versions provided */ +#define SHT_SUNW_verneed 0x6ffffffe +#define SHT_GNU_verneed 0x6ffffffe /* Symbol versions required */ +#define SHT_SUNW_versym 0x6fffffff +#define SHT_GNU_versym 0x6fffffff /* Symbol version table */ +#define SHT_HISUNW 0x6fffffff +#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */ +#define SHT_LOPROC 0x70000000 /* reserved range for processor */ +#define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ +#define SHT_MIPS_REGINFO 0x70000006 +#define SHT_MIPS_OPTIONS 0x7000000d +#define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */ +#define SHT_HIPROC 0x7fffffff /* specific section header types */ +#define SHT_LOUSER 0x80000000 /* reserved range for application */ +#define SHT_HIUSER 0xffffffff /* specific indexes */ + +/* Flags for sh_flags. */ +#define SHF_WRITE 0x1 /* Section contains writable data. */ +#define SHF_ALLOC 0x2 /* Section occupies memory. */ +#define SHF_EXECINSTR 0x4 /* Section contains instructions. */ +#define SHF_MERGE 0x10 /* Section may be merged. */ +#define SHF_STRINGS 0x20 /* Section contains strings. */ +#define SHF_INFO_LINK 0x40 /* sh_info holds section index. */ +#define SHF_LINK_ORDER 0x80 /* Special ordering requirements. */ +#define SHF_OS_NONCONFORMING 0x100 /* OS-specific processing required. */ +#define SHF_GROUP 0x200 /* Member of section group. */ +#define SHF_TLS 0x400 /* Section contains TLS data. */ +#define SHF_MASKOS 0x0ff00000 /* OS-specific semantics. */ +#define SHF_MASKPROC 0xf0000000 /* Processor-specific semantics. */ + +/* Values for p_type. */ +#define PT_NULL 0 /* Unused entry. */ +#define PT_LOAD 1 /* Loadable segment. */ +#define PT_DYNAMIC 2 /* Dynamic linking information segment. */ +#define PT_INTERP 3 /* Pathname of interpreter. */ +#define PT_NOTE 4 /* Auxiliary information. */ +#define PT_SHLIB 5 /* Reserved (not used). */ +#define PT_PHDR 6 /* Location of program header itself. */ +#define PT_TLS 7 /* Thread local storage segment */ +#define PT_LOOS 0x60000000 /* First OS-specific. */ +#define PT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK 0x6474e551 +#define PT_GNU_RELRO 0x6474e552 +#define PT_LOSUNW 0x6ffffffa +#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ +#define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ +#define PT_SUNWDTRACE 0x6ffffffc /* private */ +#define PT_SUNWCAP 0x6ffffffd /* hard/soft capabilities segment */ +#define PT_HISUNW 0x6fffffff +#define PT_HIOS 0x6fffffff /* Last OS-specific. */ +#define PT_LOPROC 0x70000000 /* First processor-specific type. */ +#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */ + +/* Values for p_flags. */ +#define PF_X 0x1 /* Executable. */ +#define PF_W 0x2 /* Writable. */ +#define PF_R 0x4 /* Readable. */ +#define PF_MASKOS 0x0ff00000 /* Operating system-specific. */ +#define PF_MASKPROC 0xf0000000 /* Processor-specific. */ + +/* Extended program header index. */ +#define PN_XNUM 0xffff + +/* Values for d_tag. */ +#define DT_NULL 0 /* Terminating entry. */ +#define DT_NEEDED 1 /* String table offset of a needed shared + library. */ +#define DT_PLTRELSZ 2 /* Total size in bytes of PLT relocations. */ +#define DT_PLTGOT 3 /* Processor-dependent address. */ +#define DT_HASH 4 /* Address of symbol hash table. */ +#define DT_STRTAB 5 /* Address of string table. */ +#define DT_SYMTAB 6 /* Address of symbol table. */ +#define DT_RELA 7 /* Address of ElfNN_Rela relocations. */ +#define DT_RELASZ 8 /* Total size of ElfNN_Rela relocations. */ +#define DT_RELAENT 9 /* Size of each ElfNN_Rela relocation entry. */ +#define DT_STRSZ 10 /* Size of string table. */ +#define DT_SYMENT 11 /* Size of each symbol table entry. */ +#define DT_INIT 12 /* Address of initialization function. */ +#define DT_FINI 13 /* Address of finalization function. */ +#define DT_SONAME 14 /* String table offset of shared object + name. */ +#define DT_RPATH 15 /* String table offset of library path. [sup] */ +#define DT_SYMBOLIC 16 /* Indicates "symbolic" linking. [sup] */ +#define DT_REL 17 /* Address of ElfNN_Rel relocations. */ +#define DT_RELSZ 18 /* Total size of ElfNN_Rel relocations. */ +#define DT_RELENT 19 /* Size of each ElfNN_Rel relocation. */ +#define DT_PLTREL 20 /* Type of relocation used for PLT. */ +#define DT_DEBUG 21 /* Reserved (not used). */ +#define DT_TEXTREL 22 /* Indicates there may be relocations in + non-writable segments. [sup] */ +#define DT_JMPREL 23 /* Address of PLT relocations. */ +#define DT_BIND_NOW 24 /* [sup] */ +#define DT_INIT_ARRAY 25 /* Address of the array of pointers to + initialization functions */ +#define DT_FINI_ARRAY 26 /* Address of the array of pointers to + termination functions */ +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of the array of + initialization functions. */ +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of the array of + termination functions. */ +#define DT_RUNPATH 29 /* String table offset of a null-terminated + library search path string. */ +#define DT_FLAGS 30 /* Object specific flag values. */ +#define DT_ENCODING 32 /* Values greater than or equal to DT_ENCODING + and less than DT_LOOS follow the rules for + the interpretation of the d_un union + as follows: even == 'd_ptr', odd == 'd_val' + or none */ +#define DT_PREINIT_ARRAY 32 /* Address of the array of pointers to + pre-initialization functions. */ +#define DT_PREINIT_ARRAYSZ 33 /* Size in bytes of the array of + pre-initialization functions. */ +#define DT_MAXPOSTAGS 34 /* number of positive tags */ +#define DT_LOOS 0x6000000d /* First OS-specific */ +#define DT_SUNW_AUXILIARY 0x6000000d /* symbol auxiliary name */ +#define DT_SUNW_RTLDINF 0x6000000e /* ld.so.1 info (private) */ +#define DT_SUNW_FILTER 0x6000000f /* symbol filter name */ +#define DT_SUNW_CAP 0x60000010 /* hardware/software */ +#define DT_HIOS 0x6ffff000 /* Last OS-specific */ + +/* + * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the + * Dyn.d_un.d_val field of the Elf*_Dyn structure. + */ +#define DT_VALRNGLO 0x6ffffd00 +#define DT_CHECKSUM 0x6ffffdf8 /* elf checksum */ +#define DT_PLTPADSZ 0x6ffffdf9 /* pltpadding size */ +#define DT_MOVEENT 0x6ffffdfa /* move table entry size */ +#define DT_MOVESZ 0x6ffffdfb /* move table size */ +#define DT_FEATURE_1 0x6ffffdfc /* feature holder */ +#define DT_POSFLAG_1 0x6ffffdfd /* flags for DT_* entries, effecting */ + /* the following DT_* entry. */ + /* See DF_P1_* definitions */ +#define DT_SYMINSZ 0x6ffffdfe /* syminfo table size (in bytes) */ +#define DT_SYMINENT 0x6ffffdff /* syminfo entry size (in bytes) */ +#define DT_VALRNGHI 0x6ffffdff + +/* + * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the + * Dyn.d_un.d_ptr field of the Elf*_Dyn structure. + * + * If any adjustment is made to the ELF object after it has been + * built, these entries will need to be adjusted. + */ +#define DT_ADDRRNGLO 0x6ffffe00 +#define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table */ +#define DT_CONFIG 0x6ffffefa /* configuration information */ +#define DT_DEPAUDIT 0x6ffffefb /* dependency auditing */ +#define DT_AUDIT 0x6ffffefc /* object auditing */ +#define DT_PLTPAD 0x6ffffefd /* pltpadding (sparcv9) */ +#define DT_MOVETAB 0x6ffffefe /* move table */ +#define DT_SYMINFO 0x6ffffeff /* syminfo table */ +#define DT_ADDRRNGHI 0x6ffffeff +#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */ +#define DT_ADDRNUM 11 + +#define DT_VERSYM 0x6ffffff0 /* Address of versym section. */ +#define DT_RELACOUNT 0x6ffffff9 /* number of RELATIVE relocations */ +#define DT_RELCOUNT 0x6ffffffa /* number of RELATIVE relocations */ +#define DT_FLAGS_1 0x6ffffffb /* state flags - see DF_1_* defs */ +#define DT_VERDEF 0x6ffffffc /* Address of verdef section. */ +#define DT_VERDEFNUM 0x6ffffffd /* Number of elems in verdef section */ +#define DT_VERNEED 0x6ffffffe /* Address of verneed section. */ +#define DT_VERNEEDNUM 0x6fffffff /* Number of elems in verneed section */ + +#define DT_LOPROC 0x70000000 /* First processor-specific type. */ +#define DT_DEPRECATED_SPARC_REGISTER 0x7000001 +#define DT_AUXILIARY 0x7ffffffd /* shared library auxiliary name */ +#define DT_USED 0x7ffffffe /* ignored - same as needed */ +#define DT_FILTER 0x7fffffff /* shared library filter name */ +#define DT_HIPROC 0x7fffffff /* Last processor-specific type. */ + +/* Values for DT_FLAGS */ +#define DF_ORIGIN 0x0001 /* Indicates that the object being loaded may + make reference to the $ORIGIN substitution + string */ +#define DF_SYMBOLIC 0x0002 /* Indicates "symbolic" linking. */ +#define DF_TEXTREL 0x0004 /* Indicates there may be relocations in + non-writable segments. */ +#define DF_BIND_NOW 0x0008 /* Indicates that the dynamic linker should + process all relocations for the object + containing this entry before transferring + control to the program. */ +#define DF_STATIC_TLS 0x0010 /* Indicates that the shared object or + executable contains code using a static + thread-local storage scheme. */ + +/* Values for DT_FLAGS_1 */ +#define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */ +#define DF_1_GLOBAL 0x00000002 /* Set the RTLD_GLOBAL for object */ +#define DF_1_NODELETE 0x00000008 /* Set the RTLD_NODELETE for object */ +#define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filtees */ +#define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ +#define DF_1_ORIGIN 0x00000080 /* Process $ORIGIN */ +#define DF_1_NODEFLIB 0x00000800 /* Do not search default paths */ + +/* Values for n_type. Used in core files. */ +#define NT_PRSTATUS 1 /* Process status. */ +#define NT_FPREGSET 2 /* Floating point registers. */ +#define NT_PRPSINFO 3 /* Process state info. */ +#define NT_THRMISC 7 /* Thread miscellaneous info. */ + +/* Symbol Binding - ELFNN_ST_BIND - st_info */ +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* like global - lower precedence */ +#define STB_LOOS 10 /* Reserved range for operating system */ +#define STB_HIOS 12 /* specific semantics. */ +#define STB_LOPROC 13 /* reserved range for processor */ +#define STB_HIPROC 15 /* specific semantics. */ + +/* Symbol type - ELFNN_ST_TYPE - st_info */ +#define STT_NOTYPE 0 /* Unspecified type. */ +#define STT_OBJECT 1 /* Data object. */ +#define STT_FUNC 2 /* Function. */ +#define STT_SECTION 3 /* Section. */ +#define STT_FILE 4 /* Source file. */ +#define STT_COMMON 5 /* Uninitialized common block. */ +#define STT_TLS 6 /* TLS object. */ +#define STT_LOOS 10 /* Reserved range for operating system */ +#define STT_GNU_IFUNC 10 +#define STT_HIOS 12 /* specific semantics. */ + +/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ +#define STV_DEFAULT 0x0 /* Default visibility (see binding). */ +#define STV_INTERNAL 0x1 /* Special meaning in relocatable objects. */ +#define STV_HIDDEN 0x2 /* Not visible. */ +#define STV_PROTECTED 0x3 /* Visible but not preemptible. */ +#define STV_EXPORTED 0x4 +#define STV_SINGLETON 0x5 +#define STV_ELIMINATE 0x6 + +/* Special symbol table indexes. */ +#define STN_UNDEF 0 /* Undefined symbol index. */ + +/* Symbol versioning flags. */ +#define VER_DEF_CURRENT 1 +#define VER_DEF_IDX(x) VER_NDX(x) + +#define VER_FLG_BASE 0x01 +#define VER_FLG_WEAK 0x02 + +#define VER_NEED_CURRENT 1 +#define VER_NEED_WEAK (1u << 15) +#define VER_NEED_HIDDEN VER_NDX_HIDDEN +#define VER_NEED_IDX(x) VER_NDX(x) + +#define VER_NDX_LOCAL 0 +#define VER_NDX_GLOBAL 1 +#define VER_NDX_GIVEN 2 + +#define VER_NDX_HIDDEN (1u << 15) +#define VER_NDX(x) ((x) & ~(1u << 15)) + +#define CA_SUNW_NULL 0 +#define CA_SUNW_HW_1 1 /* first hardware capabilities entry */ +#define CA_SUNW_SF_1 2 /* first software capabilities entry */ + +/* + * Syminfo flag values + */ +#define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association */ + /* to object containing defn. */ +#define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */ +#define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */ +#define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be */ + /* lazily-loaded */ +#define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to */ + /* object containing defn. */ +#define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference */ + /* directly bind to this symbol */ +#define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */ +#define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */ + +/* + * Syminfo.si_boundto values. + */ +#define SYMINFO_BT_SELF 0xffff /* symbol bound to self */ +#define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */ +#define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */ +#define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */ +#define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */ + +/* + * Syminfo version values. + */ +#define SYMINFO_NONE 0 /* Syminfo version */ +#define SYMINFO_CURRENT 1 +#define SYMINFO_NUM 2 + +/* + * Relocation types. + * + * All machine architectures are defined here to allow tools on one to + * handle others. + */ + +#define R_386_NONE 0 /* No relocation. */ +#define R_386_32 1 /* Add symbol value. */ +#define R_386_PC32 2 /* Add PC-relative symbol value. */ +#define R_386_GOT32 3 /* Add PC-relative GOT offset. */ +#define R_386_PLT32 4 /* Add PC-relative PLT offset. */ +#define R_386_COPY 5 /* Copy data from shared object. */ +#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ +#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */ +#define R_386_RELATIVE 8 /* Add load address of shared object. */ +#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ +#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ +#define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */ +#define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */ +#define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */ +#define R_386_TLS_LE 17 /* Negative offset relative to static TLS */ +#define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */ +#define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */ +#define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */ +#define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */ +#define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */ +#define R_386_TLS_GD_POP 27 /* popl instruction for Sun ABI GD sequence */ +#define R_386_TLS_LDM_32 28 /* 32 bit offset to GOT (index,zero) pair */ +#define R_386_TLS_LDM_PUSH 29 /* pushl instruction for Sun ABI LD sequence */ +#define R_386_TLS_LDM_CALL 30 /* call instruction for Sun ABI LD sequence */ +#define R_386_TLS_LDM_POP 31 /* popl instruction for Sun ABI LD sequence */ +#define R_386_TLS_LDO_32 32 /* 32 bit offset from start of TLS block */ +#define R_386_TLS_IE_32 33 /* 32 bit offset to GOT static TLS offset entry */ +#define R_386_TLS_LE_32 34 /* 32 bit offset within static TLS block */ +#define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ +#define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ +#define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ +#define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */ + +#define R_ARM_NONE 0 /* No relocation. */ +#define R_ARM_PC24 1 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC13 4 +#define R_ARM_ABS16 5 +#define R_ARM_ABS12 6 +#define R_ARM_THM_ABS5 7 +#define R_ARM_ABS8 8 +#define R_ARM_SBREL32 9 +#define R_ARM_THM_PC22 10 +#define R_ARM_THM_PC8 11 +#define R_ARM_AMP_VCALL9 12 +#define R_ARM_SWI24 13 +#define R_ARM_THM_SWI8 14 +#define R_ARM_XPC25 15 +#define R_ARM_THM_XPC22 16 +/* TLS relocations */ +#define R_ARM_TLS_DTPMOD32 17 /* ID of module containing symbol */ +#define R_ARM_TLS_DTPOFF32 18 /* Offset in TLS block */ +#define R_ARM_TLS_TPOFF32 19 /* Offset in static TLS block */ +#define R_ARM_COPY 20 /* Copy data from shared object. */ +#define R_ARM_GLOB_DAT 21 /* Set GOT entry to data address. */ +#define R_ARM_JUMP_SLOT 22 /* Set GOT entry to code address. */ +#define R_ARM_RELATIVE 23 /* Add load address of shared object. */ +#define R_ARM_GOTOFF 24 /* Add GOT-relative symbol address. */ +#define R_ARM_GOTPC 25 /* Add PC-relative GOT table address. */ +#define R_ARM_GOT32 26 /* Add PC-relative GOT offset. */ +#define R_ARM_PLT32 27 /* Add PC-relative PLT offset. */ +#define R_ARM_GNU_VTENTRY 100 +#define R_ARM_GNU_VTINHERIT 101 +#define R_ARM_RSBREL32 250 +#define R_ARM_THM_RPC22 251 +#define R_ARM_RREL32 252 +#define R_ARM_RABS32 253 +#define R_ARM_RPC24 254 +#define R_ARM_RBASE 255 + +/* Name Value Field Calculation */ +#define R_IA_64_NONE 0 /* None */ +#define R_IA_64_IMM14 0x21 /* immediate14 S + A */ +#define R_IA_64_IMM22 0x22 /* immediate22 S + A */ +#define R_IA_64_IMM64 0x23 /* immediate64 S + A */ +#define R_IA_64_DIR32MSB 0x24 /* word32 MSB S + A */ +#define R_IA_64_DIR32LSB 0x25 /* word32 LSB S + A */ +#define R_IA_64_DIR64MSB 0x26 /* word64 MSB S + A */ +#define R_IA_64_DIR64LSB 0x27 /* word64 LSB S + A */ +#define R_IA_64_GPREL22 0x2a /* immediate22 @gprel(S + A) */ +#define R_IA_64_GPREL64I 0x2b /* immediate64 @gprel(S + A) */ +#define R_IA_64_GPREL32MSB 0x2c /* word32 MSB @gprel(S + A) */ +#define R_IA_64_GPREL32LSB 0x2d /* word32 LSB @gprel(S + A) */ +#define R_IA_64_GPREL64MSB 0x2e /* word64 MSB @gprel(S + A) */ +#define R_IA_64_GPREL64LSB 0x2f /* word64 LSB @gprel(S + A) */ +#define R_IA_64_LTOFF22 0x32 /* immediate22 @ltoff(S + A) */ +#define R_IA_64_LTOFF64I 0x33 /* immediate64 @ltoff(S + A) */ +#define R_IA_64_PLTOFF22 0x3a /* immediate22 @pltoff(S + A) */ +#define R_IA_64_PLTOFF64I 0x3b /* immediate64 @pltoff(S + A) */ +#define R_IA_64_PLTOFF64MSB 0x3e /* word64 MSB @pltoff(S + A) */ +#define R_IA_64_PLTOFF64LSB 0x3f /* word64 LSB @pltoff(S + A) */ +#define R_IA_64_FPTR64I 0x43 /* immediate64 @fptr(S + A) */ +#define R_IA_64_FPTR32MSB 0x44 /* word32 MSB @fptr(S + A) */ +#define R_IA_64_FPTR32LSB 0x45 /* word32 LSB @fptr(S + A) */ +#define R_IA_64_FPTR64MSB 0x46 /* word64 MSB @fptr(S + A) */ +#define R_IA_64_FPTR64LSB 0x47 /* word64 LSB @fptr(S + A) */ +#define R_IA_64_PCREL60B 0x48 /* immediate60 form1 S + A - P */ +#define R_IA_64_PCREL21B 0x49 /* immediate21 form1 S + A - P */ +#define R_IA_64_PCREL21M 0x4a /* immediate21 form2 S + A - P */ +#define R_IA_64_PCREL21F 0x4b /* immediate21 form3 S + A - P */ +#define R_IA_64_PCREL32MSB 0x4c /* word32 MSB S + A - P */ +#define R_IA_64_PCREL32LSB 0x4d /* word32 LSB S + A - P */ +#define R_IA_64_PCREL64MSB 0x4e /* word64 MSB S + A - P */ +#define R_IA_64_PCREL64LSB 0x4f /* word64 LSB S + A - P */ +#define R_IA_64_LTOFF_FPTR22 0x52 /* immediate22 @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR64I 0x53 /* immediate64 @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR32MSB 0x54 /* word32 MSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR32LSB 0x55 /* word32 LSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR64MSB 0x56 /* word64 MSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_LTOFF_FPTR64LSB 0x57 /* word64 LSB @ltoff(@fptr(S + A)) */ +#define R_IA_64_SEGREL32MSB 0x5c /* word32 MSB @segrel(S + A) */ +#define R_IA_64_SEGREL32LSB 0x5d /* word32 LSB @segrel(S + A) */ +#define R_IA_64_SEGREL64MSB 0x5e /* word64 MSB @segrel(S + A) */ +#define R_IA_64_SEGREL64LSB 0x5f /* word64 LSB @segrel(S + A) */ +#define R_IA_64_SECREL32MSB 0x64 /* word32 MSB @secrel(S + A) */ +#define R_IA_64_SECREL32LSB 0x65 /* word32 LSB @secrel(S + A) */ +#define R_IA_64_SECREL64MSB 0x66 /* word64 MSB @secrel(S + A) */ +#define R_IA_64_SECREL64LSB 0x67 /* word64 LSB @secrel(S + A) */ +#define R_IA_64_REL32MSB 0x6c /* word32 MSB BD + A */ +#define R_IA_64_REL32LSB 0x6d /* word32 LSB BD + A */ +#define R_IA_64_REL64MSB 0x6e /* word64 MSB BD + A */ +#define R_IA_64_REL64LSB 0x6f /* word64 LSB BD + A */ +#define R_IA_64_LTV32MSB 0x74 /* word32 MSB S + A */ +#define R_IA_64_LTV32LSB 0x75 /* word32 LSB S + A */ +#define R_IA_64_LTV64MSB 0x76 /* word64 MSB S + A */ +#define R_IA_64_LTV64LSB 0x77 /* word64 LSB S + A */ +#define R_IA_64_PCREL21BI 0x79 /* immediate21 form1 S + A - P */ +#define R_IA_64_PCREL22 0x7a /* immediate22 S + A - P */ +#define R_IA_64_PCREL64I 0x7b /* immediate64 S + A - P */ +#define R_IA_64_IPLTMSB 0x80 /* function descriptor MSB special */ +#define R_IA_64_IPLTLSB 0x81 /* function descriptor LSB speciaal */ +#define R_IA_64_SUB 0x85 /* immediate64 A - S */ +#define R_IA_64_LTOFF22X 0x86 /* immediate22 special */ +#define R_IA_64_LDXMOV 0x87 /* immediate22 special */ +#define R_IA_64_TPREL14 0x91 /* imm14 @tprel(S + A) */ +#define R_IA_64_TPREL22 0x92 /* imm22 @tprel(S + A) */ +#define R_IA_64_TPREL64I 0x93 /* imm64 @tprel(S + A) */ +#define R_IA_64_TPREL64MSB 0x96 /* word64 MSB @tprel(S + A) */ +#define R_IA_64_TPREL64LSB 0x97 /* word64 LSB @tprel(S + A) */ +#define R_IA_64_LTOFF_TPREL22 0x9a /* imm22 @ltoff(@tprel(S+A)) */ +#define R_IA_64_DTPMOD64MSB 0xa6 /* word64 MSB @dtpmod(S + A) */ +#define R_IA_64_DTPMOD64LSB 0xa7 /* word64 LSB @dtpmod(S + A) */ +#define R_IA_64_LTOFF_DTPMOD22 0xaa /* imm22 @ltoff(@dtpmod(S+A)) */ +#define R_IA_64_DTPREL14 0xb1 /* imm14 @dtprel(S + A) */ +#define R_IA_64_DTPREL22 0xb2 /* imm22 @dtprel(S + A) */ +#define R_IA_64_DTPREL64I 0xb3 /* imm64 @dtprel(S + A) */ +#define R_IA_64_DTPREL32MSB 0xb4 /* word32 MSB @dtprel(S + A) */ +#define R_IA_64_DTPREL32LSB 0xb5 /* word32 LSB @dtprel(S + A) */ +#define R_IA_64_DTPREL64MSB 0xb6 /* word64 MSB @dtprel(S + A) */ +#define R_IA_64_DTPREL64LSB 0xb7 /* word64 LSB @dtprel(S + A) */ +#define R_IA_64_LTOFF_DTPREL22 0xba /* imm22 @ltoff(@dtprel(S+A)) */ + +#define R_MIPS_NONE 0 /* No reloc */ +#define R_MIPS_16 1 /* Direct 16 bit */ +#define R_MIPS_32 2 /* Direct 32 bit */ +#define R_MIPS_REL32 3 /* PC relative 32 bit */ +#define R_MIPS_26 4 /* Direct 26 bit shifted */ +#define R_MIPS_HI16 5 /* High 16 bit */ +#define R_MIPS_LO16 6 /* Low 16 bit */ +#define R_MIPS_GPREL16 7 /* GP relative 16 bit */ +#define R_MIPS_LITERAL 8 /* 16 bit literal entry */ +#define R_MIPS_GOT16 9 /* 16 bit GOT entry */ +#define R_MIPS_PC16 10 /* PC relative 16 bit */ +#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */ +#define R_MIPS_GPREL32 12 /* GP relative 32 bit */ +#define R_MIPS_GOTHI16 21 /* GOT HI 16 bit */ +#define R_MIPS_GOTLO16 22 /* GOT LO 16 bit */ +#define R_MIPS_CALLHI16 30 /* upper 16 bit GOT entry for function */ +#define R_MIPS_CALLLO16 31 /* lower 16 bit GOT entry for function */ + +#define R_PPC_NONE 0 /* No relocation. */ +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 + +/* + * 64-bit relocations + */ +#define R_PPC64_ADDR64 38 +#define R_PPC64_ADDR16_HIGHER 39 +#define R_PPC64_ADDR16_HIGHERA 40 +#define R_PPC64_ADDR16_HIGHEST 41 +#define R_PPC64_ADDR16_HIGHESTA 42 +#define R_PPC64_UADDR64 43 +#define R_PPC64_REL64 44 +#define R_PPC64_PLT64 45 +#define R_PPC64_PLTREL64 46 +#define R_PPC64_TOC16 47 +#define R_PPC64_TOC16_LO 48 +#define R_PPC64_TOC16_HI 49 +#define R_PPC64_TOC16_HA 50 +#define R_PPC64_TOC 51 +#define R_PPC64_DTPMOD64 68 +#define R_PPC64_TPREL64 73 +#define R_PPC64_DTPREL64 78 + +/* + * TLS relocations + */ +#define R_PPC_TLS 67 +#define R_PPC_DTPMOD32 68 +#define R_PPC_TPREL16 69 +#define R_PPC_TPREL16_LO 70 +#define R_PPC_TPREL16_HI 71 +#define R_PPC_TPREL16_HA 72 +#define R_PPC_TPREL32 73 +#define R_PPC_DTPREL16 74 +#define R_PPC_DTPREL16_LO 75 +#define R_PPC_DTPREL16_HI 76 +#define R_PPC_DTPREL16_HA 77 +#define R_PPC_DTPREL32 78 +#define R_PPC_GOT_TLSGD16 79 +#define R_PPC_GOT_TLSGD16_LO 80 +#define R_PPC_GOT_TLSGD16_HI 81 +#define R_PPC_GOT_TLSGD16_HA 82 +#define R_PPC_GOT_TLSLD16 83 +#define R_PPC_GOT_TLSLD16_LO 84 +#define R_PPC_GOT_TLSLD16_HI 85 +#define R_PPC_GOT_TLSLD16_HA 86 +#define R_PPC_GOT_TPREL16 87 +#define R_PPC_GOT_TPREL16_LO 88 +#define R_PPC_GOT_TPREL16_HI 89 +#define R_PPC_GOT_TPREL16_HA 90 + +/* + * The remaining relocs are from the Embedded ELF ABI, and are not in the + * SVR4 ELF ABI. + */ + +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 + +#define R_SPARC_NONE 0 +#define R_SPARC_8 1 +#define R_SPARC_16 2 +#define R_SPARC_32 3 +#define R_SPARC_DISP8 4 +#define R_SPARC_DISP16 5 +#define R_SPARC_DISP32 6 +#define R_SPARC_WDISP30 7 +#define R_SPARC_WDISP22 8 +#define R_SPARC_HI22 9 +#define R_SPARC_22 10 +#define R_SPARC_13 11 +#define R_SPARC_LO10 12 +#define R_SPARC_GOT10 13 +#define R_SPARC_GOT13 14 +#define R_SPARC_GOT22 15 +#define R_SPARC_PC10 16 +#define R_SPARC_PC22 17 +#define R_SPARC_WPLT30 18 +#define R_SPARC_COPY 19 +#define R_SPARC_GLOB_DAT 20 +#define R_SPARC_JMP_SLOT 21 +#define R_SPARC_RELATIVE 22 +#define R_SPARC_UA32 23 +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_TLS_GD_HI22 56 +#define R_SPARC_TLS_GD_LO10 57 +#define R_SPARC_TLS_GD_ADD 58 +#define R_SPARC_TLS_GD_CALL 59 +#define R_SPARC_TLS_LDM_HI22 60 +#define R_SPARC_TLS_LDM_LO10 61 +#define R_SPARC_TLS_LDM_ADD 62 +#define R_SPARC_TLS_LDM_CALL 63 +#define R_SPARC_TLS_LDO_HIX22 64 +#define R_SPARC_TLS_LDO_LOX10 65 +#define R_SPARC_TLS_LDO_ADD 66 +#define R_SPARC_TLS_IE_HI22 67 +#define R_SPARC_TLS_IE_LO10 68 +#define R_SPARC_TLS_IE_LD 69 +#define R_SPARC_TLS_IE_LDX 70 +#define R_SPARC_TLS_IE_ADD 71 +#define R_SPARC_TLS_LE_HIX22 72 +#define R_SPARC_TLS_LE_LOX10 73 +#define R_SPARC_TLS_DTPMOD32 74 +#define R_SPARC_TLS_DTPMOD64 75 +#define R_SPARC_TLS_DTPOFF32 76 +#define R_SPARC_TLS_DTPOFF64 77 +#define R_SPARC_TLS_TPOFF32 78 +#define R_SPARC_TLS_TPOFF64 79 + +#define R_X86_64_NONE 0 /* No relocation. */ +#define R_X86_64_64 1 /* Add 64 bit symbol value. */ +#define R_X86_64_PC32 2 /* PC-relative 32 bit signed sym value. */ +#define R_X86_64_GOT32 3 /* PC-relative 32 bit GOT offset. */ +#define R_X86_64_PLT32 4 /* PC-relative 32 bit PLT offset. */ +#define R_X86_64_COPY 5 /* Copy data from shared object. */ +#define R_X86_64_GLOB_DAT 6 /* Set GOT entry to data address. */ +#define R_X86_64_JMP_SLOT 7 /* Set GOT entry to code address. */ +#define R_X86_64_RELATIVE 8 /* Add load address of shared object. */ +#define R_X86_64_GOTPCREL 9 /* Add 32 bit signed pcrel offset to GOT. */ +#define R_X86_64_32 10 /* Add 32 bit zero extended symbol value */ +#define R_X86_64_32S 11 /* Add 32 bit sign extended symbol value */ +#define R_X86_64_16 12 /* Add 16 bit zero extended symbol value */ +#define R_X86_64_PC16 13 /* Add 16 bit signed extended pc relative symbol value */ +#define R_X86_64_8 14 /* Add 8 bit zero extended symbol value */ +#define R_X86_64_PC8 15 /* Add 8 bit signed extended pc relative symbol value */ +#define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */ +#define R_X86_64_DTPOFF64 17 /* Offset in TLS block */ +#define R_X86_64_TPOFF64 18 /* Offset in static TLS block */ +#define R_X86_64_TLSGD 19 /* PC relative offset to GD GOT entry */ +#define R_X86_64_TLSLD 20 /* PC relative offset to LD GOT entry */ +#define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ +#define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ +#define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ +#define R_X86_64_IRELATIVE 37 + + +#endif /* !_SYS_ELF_COMMON_H_ */ diff --git a/common/inc/internal/elfheader/elfstructs.h b/common/inc/internal/elfheader/elfstructs.h new file mode 100644 index 0000000000..77362f3b9e --- /dev/null +++ b/common/inc/internal/elfheader/elfstructs.h @@ -0,0 +1,527 @@ +#ifndef __XEN_PUBLIC_ELFSTRUCTS_H__ +#define __XEN_PUBLIC_ELFSTRUCTS_H__ 1 +/* + * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +typedef uint8_t Elf_Byte; + +typedef uint32_t Elf32_Addr; /* Unsigned program address */ +typedef uint32_t Elf32_Off; /* Unsigned file offset */ +typedef int32_t Elf32_Sword; /* Signed large integer */ +typedef uint32_t Elf32_Word; /* Unsigned large integer */ +typedef uint16_t Elf32_Half; /* Unsigned medium integer */ + +typedef uint64_t Elf64_Addr; +typedef uint64_t Elf64_Off; +typedef int32_t Elf64_Shalf; + +typedef int32_t Elf64_Sword; +typedef uint32_t Elf64_Word; + +typedef int64_t Elf64_Sxword; +typedef uint64_t Elf64_Xword; + +typedef uint32_t Elf64_Half; +typedef uint16_t Elf64_Quarter; + +/* + * e_ident[] identification indexes + * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html + */ +#define EI_MAG0 0 /* file ID */ +#define EI_MAG1 1 /* file ID */ +#define EI_MAG2 2 /* file ID */ +#define EI_MAG3 3 /* file ID */ +#define EI_CLASS 4 /* file class */ +#define EI_DATA 5 /* data encoding */ +#define EI_VERSION 6 /* ELF header version */ +#define EI_OSABI 7 /* OS/ABI ID */ +#define EI_ABIVERSION 8 /* ABI version */ +#define EI_PAD 9 /* start of pad bytes */ +#define EI_NIDENT 16 /* Size of e_ident[] */ + +/* e_ident[] magic number */ +#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ +#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ +#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ +#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ +#define ELFMAG "\177ELF" /* magic */ +#define SELFMAG 4 /* size of magic */ + +/* e_ident[] file class */ +#define ELFCLASSNONE 0 /* invalid */ +#define ELFCLASS32 1 /* 32-bit objs */ +#define ELFCLASS64 2 /* 64-bit objs */ +#define ELFCLASSNUM 3 /* number of classes */ + +/* e_ident[] data encoding */ +#define ELFDATANONE 0 /* invalid */ +#define ELFDATA2LSB 1 /* Little-Endian */ +#define ELFDATA2MSB 2 /* Big-Endian */ +#define ELFDATANUM 3 /* number of data encode defines */ + +/* e_ident[] Operating System/ABI */ +#define ELFOSABI_SYSV 0 /* UNIX System V ABI */ +#define ELFOSABI_HPUX 1 /* HP-UX operating system */ +#define ELFOSABI_NETBSD 2 /* NetBSD */ +#define ELFOSABI_LINUX 3 /* GNU/Linux */ +#define ELFOSABI_HURD 4 /* GNU/Hurd */ +#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ +#define ELFOSABI_SOLARIS 6 /* Solaris */ +#define ELFOSABI_MONTEREY 7 /* Monterey */ +#define ELFOSABI_IRIX 8 /* IRIX */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD */ +#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD */ +#define ELFOSABI_ARM 97 /* ARM */ +#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ + +/* e_ident */ +#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ + (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ + (ehdr).e_ident[EI_MAG3] == ELFMAG3) + +/* ELF Header */ +typedef struct elfhdr { + unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ + Elf32_Half e_type; /* object file type */ + Elf32_Half e_machine; /* machine */ + Elf32_Word e_version; /* object file version */ + Elf32_Addr e_entry; /* virtual entry point */ + Elf32_Off e_phoff; /* program header table offset */ + Elf32_Off e_shoff; /* section header table offset */ + Elf32_Word e_flags; /* processor-specific flags */ + Elf32_Half e_ehsize; /* ELF header size */ + Elf32_Half e_phentsize; /* program header entry size */ + Elf32_Half e_phnum; /* number of program header entries */ + Elf32_Half e_shentsize; /* section header entry size */ + Elf32_Half e_shnum; /* number of section header entries */ + Elf32_Half e_shstrndx; /* section header table's "section + header string table" entry offset */ +} Elf32_Ehdr; + +typedef struct { + unsigned char e_ident[EI_NIDENT]; /* Id bytes */ + Elf64_Quarter e_type; /* file type */ + Elf64_Quarter e_machine; /* machine type */ + Elf64_Half e_version; /* version number */ + Elf64_Addr e_entry; /* entry point */ + Elf64_Off e_phoff; /* Program hdr offset */ + Elf64_Off e_shoff; /* Section hdr offset */ + Elf64_Half e_flags; /* Processor flags */ + Elf64_Quarter e_ehsize; /* sizeof ehdr */ + Elf64_Quarter e_phentsize; /* Program header entry size */ + Elf64_Quarter e_phnum; /* Number of program headers */ + Elf64_Quarter e_shentsize; /* Section header entry size */ + Elf64_Quarter e_shnum; /* Number of section headers */ + Elf64_Quarter e_shstrndx; /* String table index */ +} Elf64_Ehdr; + +/* e_type */ +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* relocatable file */ +#define ET_EXEC 2 /* executable file */ +#define ET_DYN 3 /* shared object file */ +#define ET_CORE 4 /* core file */ +#define ET_NUM 5 /* number of types */ +#define ET_LOPROC 0xff00 /* reserved range for processor */ +#define ET_HIPROC 0xffff /* specific e_type */ + +/* e_machine */ +#define EM_NONE 0 /* No Machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola 68000 */ +#define EM_88K 5 /* Motorola 88000 */ +#define EM_486 6 /* Intel 80486 - unused? */ +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ +/* + * Don't know if EM_MIPS_RS4_BE, + * EM_SPARC64, EM_PARISC, + * or EM_PPC are ABI compliant + */ +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ +#define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */ +#define EM_PARISC 15 /* HPPA */ +#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC 64-bit */ +#define EM_ARM 40 /* Advanced RISC Machines ARM */ +#define EM_ALPHA 41 /* DEC ALPHA */ +#define EM_SPARCV9 43 /* SPARC version 9 */ +#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_X86_64 62 /* AMD x86-64 architecture */ +#define EM_VAX 75 /* DEC VAX */ + +/* Version */ +#define EV_NONE 0 /* Invalid */ +#define EV_CURRENT 1 /* Current */ +#define EV_NUM 2 /* number of versions */ + +/* Section Header */ +typedef struct { + Elf32_Word sh_name; /* name - index into section header + string table section */ + Elf32_Word sh_type; /* type */ + Elf32_Word sh_flags; /* flags */ + Elf32_Addr sh_addr; /* address */ + Elf32_Off sh_offset; /* file offset */ + Elf32_Word sh_size; /* section size */ + Elf32_Word sh_link; /* section header table index link */ + Elf32_Word sh_info; /* extra information */ + Elf32_Word sh_addralign; /* address alignment */ + Elf32_Word sh_entsize; /* section entry size */ +} Elf32_Shdr; + +typedef struct { + Elf64_Half sh_name; /* section name */ + Elf64_Half sh_type; /* section type */ + Elf64_Xword sh_flags; /* section flags */ + Elf64_Addr sh_addr; /* virtual address */ + Elf64_Off sh_offset; /* file offset */ + Elf64_Xword sh_size; /* section size */ + Elf64_Half sh_link; /* link to another */ + Elf64_Half sh_info; /* misc info */ + Elf64_Xword sh_addralign; /* memory alignment */ + Elf64_Xword sh_entsize; /* table entry size */ +} Elf64_Shdr; + +/* Special Section Indexes */ +#define SHN_UNDEF 0 /* undefined */ +#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ +#define SHN_LOPROC 0xff00 /* reserved range for processor */ +#define SHN_HIPROC 0xff1f /* specific section indexes */ +#define SHN_ABS 0xfff1 /* absolute value */ +#define SHN_COMMON 0xfff2 /* common symbol */ +#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ + +/* sh_type */ +#define SHT_NULL 0 /* inactive */ +#define SHT_PROGBITS 1 /* program defined information */ +#define SHT_SYMTAB 2 /* symbol table section */ +#define SHT_STRTAB 3 /* string table section */ +#define SHT_RELA 4 /* relocation section with addends*/ +#define SHT_HASH 5 /* symbol hash table section */ +#define SHT_DYNAMIC 6 /* dynamic section */ +#define SHT_NOTE 7 /* note section */ +#define SHT_NOBITS 8 /* no space section */ +#define SHT_REL 9 /* relation section without addends */ +#define SHT_SHLIB 10 /* reserved - purpose unknown */ +#define SHT_DYNSYM 11 /* dynamic symbol table section */ +#define SHT_NUM 12 /* number of section types */ +#define SHT_LOPROC 0x70000000 /* reserved range for processor */ +#define SHT_HIPROC 0x7fffffff /* specific section header types */ +#define SHT_LOUSER 0x80000000 /* reserved range for application */ +#define SHT_HIUSER 0xffffffff /* specific indexes */ + +/* Section names */ +#define ELF_BSS ".bss" /* uninitialized data */ +#define ELF_DATA ".data" /* initialized data */ +#define ELF_DEBUG ".debug" /* debug */ +#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ +#define ELF_DYNSTR ".dynstr" /* dynamic string table */ +#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ +#define ELF_FINI ".fini" /* termination code */ +#define ELF_GOT ".got" /* global offset table */ +#define ELF_HASH ".hash" /* symbol hash table */ +#define ELF_INIT ".init" /* initialization code */ +#define ELF_REL_DATA ".rel.data" /* relocation data */ +#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ +#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ +#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ +#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ +#define ELF_REL_TEXT ".rel.text" /* relocation code */ +#define ELF_RODATA ".rodata" /* read-only data */ +#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ +#define ELF_STRTAB ".strtab" /* string table */ +#define ELF_SYMTAB ".symtab" /* symbol table */ +#define ELF_TEXT ".text" /* code */ + + +/* Section Attribute Flags - sh_flags */ +#define SHF_WRITE 0x1 /* Writable */ +#define SHF_ALLOC 0x2 /* occupies memory */ +#define SHF_EXECINSTR 0x4 /* executable */ +#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ + /* specific section attributes */ + +/* Symbol Table Entry */ +typedef struct elf32_sym { + Elf32_Word st_name; /* name - index into string table */ + Elf32_Addr st_value; /* symbol value */ + Elf32_Word st_size; /* symbol size */ + unsigned char st_info; /* type and binding */ + unsigned char st_other; /* 0 - no defined meaning */ + Elf32_Half st_shndx; /* section header index */ +} Elf32_Sym; + +typedef struct { + Elf64_Half st_name; /* Symbol name index in str table */ + Elf_Byte st_info; /* type / binding attrs */ + Elf_Byte st_other; /* unused */ + Elf64_Quarter st_shndx; /* section index of symbol */ + Elf64_Xword st_value; /* value of symbol */ + Elf64_Xword st_size; /* size of symbol */ +} Elf64_Sym; + +/* Symbol table index */ +#define STN_UNDEF 0 /* undefined */ + +/* Extract symbol info - st_info */ +#define ELF32_ST_BIND(x) ((x) >> 4) +#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) + +#define ELF64_ST_BIND(x) ((x) >> 4) +#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) + +/* Symbol Binding - ELF32_ST_BIND - st_info */ +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* like global - lower precedence */ +#define STB_NUM 3 /* number of symbol bindings */ +#define STB_LOPROC 13 /* reserved range for processor */ +#define STB_HIPROC 15 /* specific symbol bindings */ + +/* Symbol type - ELF32_ST_TYPE - st_info */ +#define STT_NOTYPE 0 /* not specified */ +#define STT_OBJECT 1 /* data object */ +#define STT_FUNC 2 /* function */ +#define STT_SECTION 3 /* section */ +#define STT_FILE 4 /* file */ +#define STT_NUM 5 /* number of symbol types */ +#define STT_LOPROC 13 /* reserved range for processor */ +#define STT_HIPROC 15 /* specific symbol types */ + +/* Relocation entry with implicit addend */ +typedef struct { + Elf32_Addr r_offset; /* offset of relocation */ + Elf32_Word r_info; /* symbol table index and type */ +} Elf32_Rel; + +/* Relocation entry with explicit addend */ +typedef struct { + Elf32_Addr r_offset; /* offset of relocation */ + Elf32_Word r_info; /* symbol table index and type */ + Elf32_Sword r_addend; +} Elf32_Rela; + +/* Extract relocation info - r_info */ +#define ELF32_R_SYM(i) ((i) >> 8) +#define ELF32_R_TYPE(i) ((unsigned char) (i)) +#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) + +typedef struct { + Elf64_Xword r_offset; /* where to do it */ + Elf64_Xword r_info; /* index & type of relocation */ +} Elf64_Rel; + +typedef struct { + Elf64_Xword r_offset; /* where to do it */ + Elf64_Xword r_info; /* index & type of relocation */ + Elf64_Sxword r_addend; /* adjustment value */ +} Elf64_Rela; + +#define ELF64_R_SYM(info) ((info) >> 32) +#define ELF64_R_TYPE(info) ((info) & 0xFFFFFFFF) +#define ELF64_R_INFO(s,t) (((s) << 32) + (u_int32_t)(t)) + +/* Program Header */ +typedef struct { + Elf32_Word p_type; /* segment type */ + Elf32_Off p_offset; /* segment offset */ + Elf32_Addr p_vaddr; /* virtual address of segment */ + Elf32_Addr p_paddr; /* physical address - ignored? */ + Elf32_Word p_filesz; /* number of bytes in file for seg. */ + Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ + Elf32_Word p_flags; /* flags */ + Elf32_Word p_align; /* memory alignment */ +} Elf32_Phdr; + +typedef struct { + Elf64_Half p_type; /* entry type */ + Elf64_Half p_flags; /* flags */ + Elf64_Off p_offset; /* offset */ + Elf64_Addr p_vaddr; /* virtual address */ + Elf64_Addr p_paddr; /* physical address */ + Elf64_Xword p_filesz; /* file size */ + Elf64_Xword p_memsz; /* memory size */ + Elf64_Xword p_align; /* memory & file alignment */ +} Elf64_Phdr; + +/* Segment types - p_type */ +#define PT_NULL 0 /* unused */ +#define PT_LOAD 1 /* loadable segment */ +#define PT_DYNAMIC 2 /* dynamic linking section */ +#define PT_INTERP 3 /* the RTLD */ +#define PT_NOTE 4 /* auxiliary information */ +#define PT_SHLIB 5 /* reserved - purpose undefined */ +#define PT_PHDR 6 /* program header */ +#define PT_NUM 7 /* Number of segment types */ +#define PT_LOPROC 0x70000000 /* reserved range for processor */ +#define PT_HIPROC 0x7fffffff /* specific segment types */ + +/* Segment flags - p_flags */ +#define PF_X 0x1 /* Executable */ +#define PF_W 0x2 /* Writable */ +#define PF_R 0x4 /* Readable */ +#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ + /* specific segment flags */ + +/* Dynamic structure */ +typedef struct { + Elf32_Sword d_tag; /* controls meaning of d_val */ + union { + Elf32_Word d_val; /* Multiple meanings - see d_tag */ + Elf32_Addr d_ptr; /* program virtual address */ + } d_un; +} Elf32_Dyn; + +typedef struct { + Elf64_Xword d_tag; /* controls meaning of d_val */ + union { + Elf64_Addr d_ptr; + Elf64_Xword d_val; + } d_un; +} Elf64_Dyn; + +/* Dynamic Array Tags - d_tag */ +#define DT_NULL 0 /* marks end of _DYNAMIC array */ +#define DT_NEEDED 1 /* string table offset of needed lib */ +#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ +#define DT_PLTGOT 3 /* address PLT/GOT */ +#define DT_HASH 4 /* address of symbol hash table */ +#define DT_STRTAB 5 /* address of string table */ +#define DT_SYMTAB 6 /* address of symbol table */ +#define DT_RELA 7 /* address of relocation table */ +#define DT_RELASZ 8 /* size of relocation table */ +#define DT_RELAENT 9 /* size of relocation entry */ +#define DT_STRSZ 10 /* size of string table */ +#define DT_SYMENT 11 /* size of symbol table entry */ +#define DT_INIT 12 /* address of initialization func. */ +#define DT_FINI 13 /* address of termination function */ +#define DT_SONAME 14 /* string table offset of shared obj */ +#define DT_RPATH 15 /* string table offset of library + search path */ +#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ +#define DT_REL 17 /* address of rel. tbl. w addends */ +#define DT_RELSZ 18 /* size of DT_REL relocation table */ +#define DT_RELENT 19 /* size of DT_REL relocation entry */ +#define DT_PLTREL 20 /* PLT referenced relocation entry */ +#define DT_DEBUG 21 /* bugger */ +#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ +#define DT_JMPREL 23 /* add. of PLT's relocation entries */ +#define DT_BIND_NOW 24 /* Bind now regardless of env setting */ +#define DT_NUM 25 /* Number used. */ +#define DT_LOPROC 0x70000000 /* reserved range for processor */ +#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ + +/* Standard ELF hashing function */ +unsigned int elf_hash(const unsigned char *name); + +/* + * Note Definitions + */ +typedef struct { + Elf32_Word namesz; + Elf32_Word descsz; + Elf32_Word type; +} Elf32_Note; + +typedef struct { + Elf64_Half namesz; + Elf64_Half descsz; + Elf64_Half type; +} Elf64_Note; + + +#if defined(ELFSIZE) +#define CONCAT(x,y) __CONCAT(x,y) +#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x))) +#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) +#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) +#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) +#endif + +#if defined(ELFSIZE) && (ELFSIZE == 32) +#define Elf_Ehdr Elf32_Ehdr +#define Elf_Phdr Elf32_Phdr +#define Elf_Shdr Elf32_Shdr +#define Elf_Sym Elf32_Sym +#define Elf_Rel Elf32_Rel +#define Elf_RelA Elf32_Rela +#define Elf_Dyn Elf32_Dyn +#define Elf_Word Elf32_Word +#define Elf_Sword Elf32_Sword +#define Elf_Addr Elf32_Addr +#define Elf_Off Elf32_Off +#define Elf_Nhdr Elf32_Nhdr +#define Elf_Note Elf32_Note + +#define ELF_R_SYM ELF32_R_SYM +#define ELF_R_TYPE ELF32_R_TYPE +#define ELF_R_INFO ELF32_R_INFO +#define ELFCLASS ELFCLASS32 + +#define ELF_ST_BIND ELF32_ST_BIND +#define ELF_ST_TYPE ELF32_ST_TYPE +#define ELF_ST_INFO ELF32_ST_INFO + +#define AuxInfo Aux32Info +#elif defined(ELFSIZE) && (ELFSIZE == 64) +#define Elf_Ehdr Elf64_Ehdr +#define Elf_Phdr Elf64_Phdr +#define Elf_Shdr Elf64_Shdr +#define Elf_Sym Elf64_Sym +#define Elf_Rel Elf64_Rel +#define Elf_RelA Elf64_Rela +#define Elf_Dyn Elf64_Dyn +#define Elf_Word Elf64_Word +#define Elf_Sword Elf64_Sword +#define Elf_Addr Elf64_Addr +#define Elf_Off Elf64_Off +#define Elf_Nhdr Elf64_Nhdr +#define Elf_Note Elf64_Note + +#define ELF_R_SYM ELF64_R_SYM +#define ELF_R_TYPE ELF64_R_TYPE +#define ELF_R_INFO ELF64_R_INFO +#define ELFCLASS ELFCLASS64 + +#define ELF_ST_BIND ELF64_ST_BIND +#define ELF_ST_TYPE ELF64_ST_TYPE +#define ELF_ST_INFO ELF64_ST_INFO + +#define AuxInfo Aux64Info +#endif + +#endif /* __XEN_PUBLIC_ELFSTRUCTS_H__ */ diff --git a/common/inc/internal/enclave_creator.h b/common/inc/internal/enclave_creator.h new file mode 100644 index 0000000000..67d41a7ae2 --- /dev/null +++ b/common/inc/internal/enclave_creator.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * File: enclave_creator.h + * Description: this header file defines the interface used by Enclave loader to create the Enclave + * + * The hardware, simulation and signing mode shall inherit from this class and + * implement all the virtual functions + */ + +#ifndef _ENCLAVE_CREATOR_H +#define _ENCLAVE_CREATOR_H + +#include "arch.h" +#include "sgx_eid.h" +#include "metadata.h" +#include "sgx_error.h" +#include "util.h" +#include "launch_checker.h" +#include "uncopyable.h" +#include +#include "file.h" + +// this is the interface to both hardware, simulation and signing mode +class EnclaveCreator : private Uncopyable +{ +public: + /* + @quote the EPC reserved; + @enclave_id identify the unique enclave; + @start_addr is the linear address allocated for Enclave; + */ + virtual int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae = false) = 0; + /* + *@attr can be REMOVABLE + */ + virtual int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr) = 0; + virtual int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file = NULL) = 0; + virtual int destroy_enclave(sgx_enclave_id_t enclave_id) = 0; + virtual int initialize(sgx_enclave_id_t enclave_id) = 0; + virtual bool use_se_hw() const = 0; + + virtual int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag) = 0; + virtual bool get_plat_cap(sgx_misc_attribute_t *se_attr) = 0; +#ifdef SE_1P5_VERTICAL + virtual uint32_t handle_page_fault(uint64_t pf_address) { UNUSED(pf_address); return (uint32_t)SGX_ERROR_UNEXPECTED; } +#endif + // destructor + virtual ~EnclaveCreator() {}; +}; + +EnclaveCreator* get_enclave_creator(void); + +extern EnclaveCreator* g_enclave_creator; + +#endif diff --git a/common/inc/internal/global_data.h b/common/inc/internal/global_data.h new file mode 100644 index 0000000000..be1e97eec8 --- /dev/null +++ b/common/inc/internal/global_data.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: global_data.h + * Description: + * The file defines the structure global_data_t. + */ + +#ifndef _TRTS_GLOBAL_DATA_H_ +#define _TRTS_GLOBAL_DATA_H_ + +#include "se_types.h" +#include "thread_data.h" + +typedef struct _global_data_t +{ + sys_word_t enclave_size; + sys_word_t heap_offset; + sys_word_t heap_size; + uint32_t thread_policy; + uint32_t reserved; + thread_data_t td_template; +} global_data_t; + +#define ENCLAVE_INIT_NOT_STARTED 0 +#define ENCLAVE_INIT_IN_PROGRESS 1 +#define ENCLAVE_INIT_DONE 2 +#define ENCLAVE_CRASHED 3 + +#ifdef __cplusplus +extern "C" { +#endif +extern SE_DECLSPEC_EXPORT global_data_t const volatile g_global_data; +extern uint32_t g_enclave_state; +extern uint8_t __ImageBase; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/common/inc/internal/global_init.h b/common/inc/internal/global_init.h new file mode 100644 index 0000000000..d7a36530cb --- /dev/null +++ b/common/inc/internal/global_init.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GLOBAL_INIT_H +#define GLOBAL_INIT_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +void init_global_object(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/inst.h b/common/inc/internal/inst.h new file mode 100644 index 0000000000..cd09c5a939 --- /dev/null +++ b/common/inc/internal/inst.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_ARCH_H_ +# error "never include inst.h directly; use arch.h instead." +#endif + + +#ifndef _SE_INST_H_ +#define _SE_INST_H_ + +#define ENCLU 0xd7010f + +typedef enum { + SE_EREPORT = 0x0, + SE_EGETKEY, + SE_EENTER, + SE_ERESUME, + SE_EEXIT, + SE_LAST_RING3, + + SE_ECREATE = 0x0, + SE_EADD, + SE_EINIT, + SE_EREMOVE, + SE_EDBGRD, + SE_EDBGWR, + SE_EEXTEND, + SE_LAST_RING0 +} se_opcode_t; + +#endif diff --git a/common/inc/internal/ipp_wrapper.h b/common/inc/internal/ipp_wrapper.h new file mode 100644 index 0000000000..242a041c3b --- /dev/null +++ b/common/inc/internal/ipp_wrapper.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _IPP_WRAPPER_H +#define _IPP_WRAPPER_H + +#include "ippcp.h" + +#ifndef SAFE_FREE_MM +#define SAFE_FREE_MM(ptr) {\ + if(ptr != NULL) \ + { \ + free(ptr); \ + ptr = NULL; \ + }} +#endif + +#ifndef ERROR_BREAK +#define ERROR_BREAK(x) if(x != ippStsNoErr){break;} +#endif +#ifndef NULL_BREAK +#define NULL_BREAK(x) if(!x){break;} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +IppStatus newBN(const Ipp32u *data, int size_in_bytes, IppsBigNumState **p_new_BN); + +IppStatus create_rsa_priv1_key(int n_byte_size, int d_byte_size, const Ipp32u *n, const Ipp32u *d, IppsRSAPrivateKeyState **new_pri_key1); + +IppStatus create_rsa_priv2_key(int p_byte_size, const Ipp32u *p, const Ipp32u *q, + const Ipp32u *dmp1, const Ipp32u *dmq1, const Ipp32u *iqmp, + IppsRSAPrivateKeyState **new_pri_key2); + +IppStatus create_rsa_pub_key(int n_byte_size, int e_byte_size, const Ipp32u *n, const Ipp32u *e, IppsRSAPublicKeyState **new_pub_key); + +IppStatus create_validate_rsa_key_pair(int n_byte_size, int e_byte_size, const Ipp32u *n, const Ipp32u *d, const Ipp32u *e, const Ipp32u *p, const Ipp32u *q, + const Ipp32u *dmp1, const Ipp32u *dmq1, const Ipp32u *iqmp, + IppsRSAPrivateKeyState **new_pri_key, IppsRSAPublicKeyState **new_pub_key, int *validate_result); + +IppStatus get_pub_key(const IppsRSAPublicKeyState *pub_key, int *e_byte_size, Ipp32u *e, int *n_byte_size, Ipp32u *n); + +void secure_free_BN(IppsBigNumState *pBN, int size_in_bytes); + +void secure_free_rsa_pri1_key(int n_byte_size, int d_byte_size, IppsRSAPrivateKeyState *pri_key1); + +void secure_free_rsa_pri2_key(int p_byte_size, IppsRSAPrivateKeyState *pri_key2); + +void secure_free_rsa_pub_key(int n_byte_size, int e_byte_size, IppsRSAPublicKeyState *pub_key); + + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/common/inc/internal/linux/cpuid_gnu.h b/common/inc/internal/linux/cpuid_gnu.h new file mode 100644 index 0000000000..5fd907162f --- /dev/null +++ b/common/inc/internal/linux/cpuid_gnu.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _CPUID_GNU_H_ +#define _CPUID_GNU_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is a PIC-compliant version of CPUID */ +static inline void cpuid(int *eax, int *ebx, int *ecx, int *edx) +{ +#if defined(__x86_64__) + asm("cpuid" + : "=a" (*eax), + "=b" (*ebx), + "=c" (*ecx), + "=d" (*edx) + : "0" (*eax), "2" (*ecx)); + +#else + /*on 32bit, ebx can NOT be used as PIC code*/ + asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" + : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx) + : "0" (*eax), "2" (*ecx)); +#endif +} + +static inline void __cpuid(int a[4], int b) +{ + a[0] = b; + a[2] = 0; + cpuid(&a[0], &a[1], &a[2], &a[3]); +} + +static inline void __cpuidex(int a[4], int b, int c) +{ + a[0] = b; + a[2] = c; + cpuid(&a[0], &a[1], &a[2], &a[3]); +} + +#ifdef __cplusplus +} +#endif + +#endif /*_CPUID_GNU_H_*/ diff --git a/common/inc/internal/linux/linux-regs.h b/common/inc/internal/linux/linux-regs.h new file mode 100644 index 0000000000..1ebed38720 --- /dev/null +++ b/common/inc/internal/linux/linux-regs.h @@ -0,0 +1,272 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * This header wraps the register names for x86/x64. + */ + +#ifndef LINUX_REGS_H__ +#define LINUX_REGS_H__ + +#if defined(__i386) || defined(__i386__) +# define LINUX32 1 +# define SE_WORDSIZE 4 + +/* Generic argument picker for `naked' functions */ +# define naked_arg0 4(%esp) +# define naked_arg1 8(%esp) +# define naked_arg2 12(%esp) +# define naked_arg3 16(%esp) + +# define xax eax +# define xbx ebx +# define xcx ecx +# define xdx edx + +# define xsi esi +# define xdi edi +# define xbp ebp +# define xsp esp +#elif defined(__x86_64) || defined(__x86_64__) +# define LINUX64 1 +# define SE_WORDSIZE 8 + +/* For x86_64, the first six parameters are passed by + * rdi, rsi, rdx, rcx, r8, r9. + */ +# define naked_arg0 %rdi +# define naked_arg1 %rsi +# define naked_arg2 %rdx +# define naked_arg3 %rcx + +# define xax rax +# define xbx rbx +# define xcx rcx +# define xdx rdx + +# define xsi rsi +# define xdi rdi +# define xbp rbp +# define xsp rsp +#else +# error unknown platform! +#endif + +/* SE instructions - needs to be sync-up with inst70.h */ +#define SE_EREPORT 0 +#define SE_EGETKEY 1 +#define SE_EENTER 2 +#define SE_EEXIT 4 + +#define SE_ECREATE 0 +#define SE_EADD 1 +#define SE_EINIT 2 +#define SE_EREMOVE 3 + +/* + * Macros for GNU assembly + */ +.macro ENCLU +#ifdef SE_SIM + cmp $SE_EEXIT, %xax + jne 1f + + /* if leaf is EEXIT, xbp and xsp need to be passed by xdx and xcx */ + mov %xbp, %xdx + mov %xsp, %xcx +1: + push %xdi + push %xsi + push %xdx + push %xcx + push %xbx + push %xax + +# ifdef LINUX64 + pop %rdi + pop %rsi + pop %rdx + pop %rcx + pop %r8 + pop %r9 +# endif + +.type _SE3,@function +.protected _SE3 + call _SE3 + +# ifdef LINUX32 + add $(SE_WORDSIZE * 6), %esp +# endif + +#else /* SE_SIM */ +.byte 0x0f, 0x01, 0xd7 /* 0xf3 */ +#endif /* !SE_SIM */ +.endm + +/* declare a function with default visibility */ +.macro DECLARE_GLOBAL_FUNC name + .globl \name + .type \name, @function +\name: +.endm + +/* declare a function with visibility='hidden' */ +.macro DECLARE_LOCAL_FUNC name + .globl \name + .hidden \name + .type \name, @function +\name: +.endm + +.macro NAKED_PROLOG + push %xbp + mov %xsp, %xbp + sub $(7 * SE_WORDSIZE), %xsp +.endm + +.macro NAKED_EPILOG + mov %xbp, %xsp + pop %xbp +.endm + +/* `paramN' (N = 1,2,3,4) should be registers. */ +.macro SET_PARAMS param1:req, param2, param3, param4 +#if defined(LINUX32) + +.ifnb \param4 + mov \param4, 3*SE_WORDSIZE(%esp) +.endif + +.ifnb \param3 + mov \param3, 2*SE_WORDSIZE(%esp) +.endif + +.ifnb \param2 + mov \param2, 1*SE_WORDSIZE(%esp) +.endif + + mov \param1, 0*SE_WORDSIZE(%esp) + +#else /* LINUX32 */ + +.ifnb \param4 +.ifnc \param4, %rcx + mov \param4, %rcx +.endif +.endif + +.ifnb \param3 +.ifnc \param3, %rdx + mov \param3, %rdx +.endif +.endif + +.ifnb \param2 +.ifnc \param2, %rsi + mov \param2, %rsi +.endif +.endif + +.ifnc \param1, %rdi + mov \param1, %rdi +.endif + +#endif /* LINUX64 */ +.endm + +/*******************************************************************/ + +.macro SE_PROLOG + .cfi_startproc + +#ifdef LINUX32 + pushl %ebp + movl %esp, %ebp +#endif + + push %xbx + push %xcx + push %xdx + +#if defined LINUX64 + movq %rdi, %rbx + movq %rsi, %rcx + /* rdx remains the same, rdi/rsi is not used by _SE0 + */ +#elif defined LINUX32 + movl 2*SE_WORDSIZE(%ebp), %ebx + movl 3*SE_WORDSIZE(%ebp), %ecx + movl 4*SE_WORDSIZE(%ebp), %edx +#endif + +.endm + +/*******************************************************************/ + +.macro SE_EPILOG + pop %xdx + pop %xcx + pop %xbx + +#ifdef LINUX32 + movl %ebp, %esp + popl %ebp +#endif + + ret + .cfi_endproc +.endm + +/*******************************************************************/ + +/* load the address of `symbol' to the register `reg' in PIC way. */ +.macro lea_pic symbol, reg +#ifdef LINUX64 + lea \symbol(%rip), \reg +#else +/* The real code on x86 would look like this (get `bar' from `foo'): + * + * 00000198 : + * 198: c3 ret + * + * 00000199 : + * 199: e8 00 00 00 00 call 19e + * 19e: 58 pop %eax + * 19f: 8d 40 fa lea -0x6(%eax),%eax + */ + call . + 0x5 /* No label here to avoid interfering w/ calling code */ + pop \reg + lea (\symbol - . + 1)(\reg), \reg +#endif +.endm + +#endif /* LINUX_REGS_H__ */ diff --git a/common/inc/internal/linux/xsave_gnu.h b/common/inc/internal/linux/xsave_gnu.h new file mode 100644 index 0000000000..960398faaf --- /dev/null +++ b/common/inc/internal/linux/xsave_gnu.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _XSAVE_GNU_H_ +#define _XSAVE_GNU_H_ + +#include "se_types.h" + +#ifdef __x86_64__ +# define ASM_FXSAVE "rex64/fxsave" +# define ASM_FXRSTR "rex64/fxrstor" +# define ASM_XSAVE "rex64/xsave" +# define ASM_XRSTR ".byte 0x48,0x0f,0xae,0x2f" +#else +# define ASM_FXSAVE "fxsave" +# define ASM_FXRSTR "fxrstor" +# define ASM_XSAVE "xsave" +# define ASM_XRSTR ".byte 0x0f,0xae,0x2f" +#endif + +static inline void do_fwait(void) +{ + asm volatile("fwait"); +} + +static inline void do_fxsave(void *buffer) +{ + asm volatile(ASM_FXSAVE" (%0)" : : "r"(buffer) : "memory"); +} + +static inline void do_fxrstor(const void *buffer) +{ + asm volatile(ASM_FXRSTR" (%0)" : : "r"(buffer)); +} + +static inline void do_xsave(void *buffer) +{ + asm volatile(ASM_XSAVE + : + : "D" (buffer), "a" (-1), "d" (-1) + : "memory"); +} + +static inline void _do_xrstor(const void *buffer, uint64_t mask) +{ + uint32_t lmask = (uint32_t)mask; + uint32_t hmask = (uint32_t)(mask >> 32); + + asm volatile(ASM_XRSTR + : + : "D" (buffer), "a" (lmask), "d" (hmask)); +} + +static inline void do_xrstor(const void *buffer) +{ + _do_xrstor(buffer, 0xffffffffffffffffULL); +} + +static inline void do_vzeroupper() +{ + asm volatile("vzeroupper"); +} + +#endif diff --git a/common/inc/internal/metadata.h b/common/inc/internal/metadata.h new file mode 100644 index 0000000000..031af632e2 --- /dev/null +++ b/common/inc/internal/metadata.h @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _METADATA_H_ +#define _METADATA_H_ +#include "arch.h" +#include "se_macro.h" + +#pragma pack(1) + + /* version of metadata */ +#define MAJOR_VERSION 1 /* MAJOR_VERSION should not larger than 0ffffffff */ +#define MINOR_VERSION 3 /* MINOR_VERSION should not larger than 0ffffffff */ + +#define META_DATA_MAKE_VERSION(major, minor) (((uint64_t)major)<<32 | minor) + +#define METADATA_MAGIC 0x86A80294635D0E4CULL +#define METADATA_SIZE 0x1000 +/* TCS Policy bit masks */ +#define TCS_POLICY_BIND 0x00000000 /* If set, the TCS is bound to the application thread */ +#define TCS_POLICY_UNBIND 0x00000001 + +#define MAX_SAVE_BUF_SIZE 2632 + +#define TCS_NUM_MIN 1 +#define SSA_NUM_MIN 2 +#define SSA_FRAME_SIZE_MIN 1 +#define SSA_FRAME_SIZE_MAX 2 +#define STACK_SIZE_MIN 0x1000 +#define HEAP_SIZE_MIN 0 +#define DEFAULT_MISC_SELECT 0 +#define DEFAULT_MISC_MASK 0xFFFFFFFF + +typedef struct _data_directory_t +{ + uint32_t offset; + uint32_t size; +} data_directory_t; + +typedef enum +{ + DIR_PATCH, + DIR_LAYOUT, + DIR_NUM, +} dir_index_t; + +#define GROUP_FLAG (1<<12) +#define GROUP_ID(x) (GROUP_FLAG | x) +#define IS_GROUP_ID(x) !!((x) & GROUP_FLAG) +#define LAYOUT_ID_HEAP 1 +#define LAYOUT_ID_TCS 2 +#define LAYOUT_ID_TD 3 +#define LAYOUT_ID_SSA 4 +#define LAYOUT_ID_STACK 5 +#define LAYOUT_ID_THREAD_GROUP GROUP_ID(6) +#define LAYOUT_ID_GUARD 7 + +/* +** layout table example +** entry0 - entry1 - entry2 - group3 (entry_count=2, load_times=3) ... +** the load sequence should be: +** entry0 - entry1 - entry2 - entry1 - entry2 - entry1 - entry2 - entry1 - entry2 ... +** -------------- -------------- -------------- +** group3 1st time group3 2nd time group3 3rd time +*/ +typedef struct _layout_entry_t +{ + uint16_t id; /* unique ID to identify the purpose for this entry */ + uint16_t attributes; /* EADD/EEXTEND/EREMOVE... */ + uint32_t page_count; /* map size in page. Biggest chunk = 2^32 pages = 2^44 bytes. */ + uint64_t rva; /* map offset, relative to encalve base */ + uint32_t content_size; /* if content_offset = 0, content_size is the initial data to fill the whole page. */ + uint32_t content_offset; /* offset to the initial content, relative to metadata */ + si_flags_t si_flags; /* security info, R/W/X, SECS/TCS/REG/VA */ +} layout_entry_t; + +typedef struct _layout_group_t +{ + uint16_t id; /* unique ID to identify the purpose for this entry */ + uint16_t entry_count; /* reversely count entry_count entries for the group loading. */ + uint32_t load_times; /* the repeated times of loading */ + uint64_t load_step; /* the group size. the entry load rva should be adjusted with the load_step */ + /* rva = entry.rva + group.load_step * load_times */ + uint32_t reserved[4]; +} layout_group_t; + +typedef union _layout_t +{ + layout_entry_t entry; + layout_group_t group; +} layout_t; + +typedef struct _patch_entry_t +{ + uint64_t dst; /* relative to enclave file base */ + uint32_t src; /* relative to metadata base */ + uint32_t size; /* patched size */ + uint32_t reserved[4]; +} patch_entry_t; + +typedef struct _metadata_t +{ + uint64_t magic_num; /* The magic number identifying the file as a signed enclave image */ + uint64_t version; /* The metadata version */ + uint32_t size; /* The size of this structure */ + uint32_t tcs_policy; /* TCS management policy */ + uint32_t ssa_frame_size; /* The size of SSA frame in page */ + uint32_t max_save_buffer_size; /* Max buffer size is 2632 */ + uint32_t desired_misc_select; + uint32_t reserved; + uint64_t enclave_size; /* enclave virtual size */ + sgx_attributes_t attributes; /* XFeatureMask to be set in SECS. */ + enclave_css_t enclave_css; /* The enclave signature */ + data_directory_t dirs[DIR_NUM]; + uint8_t data[2208]; +}metadata_t; + +se_static_assert(sizeof(metadata_t) == METADATA_SIZE); + +#pragma pack() + +#endif diff --git a/common/inc/internal/oal/uae_oal_api.h b/common/inc/internal/oal/uae_oal_api.h new file mode 100644 index 0000000000..2666fd662b --- /dev/null +++ b/common/inc/internal/oal/uae_oal_api.h @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _UAE_OAL_H +#define _UAE_OAL_H + +#include "sgx_quote.h" +#include "sgx_error.h" +#include "sgx_urts.h" +#include +#include + +typedef enum{ + UAE_OAL_SUCCESS = 0, + UAE_OAL_ERROR_UNEXPECTED , + UAE_OAL_ERROR_AESM_UNAVAILABLE , + UAE_OAL_ERROR_TIMEOUT , +} uae_oal_status_t; + +/*OAL methods from here forward */ + +extern "C" +{ + +uae_oal_status_t SGXAPI oal_get_launch_token( + const enclave_css_t* signature, + const sgx_attributes_t* attribute, + sgx_launch_token_t* launch_token, + uint32_t timeout_usec, + aesm_error_t *result); + + +uae_oal_status_t SGXAPI oal_init_quote( + sgx_target_info_t *p_target_info, + sgx_epid_group_id_t *p_gid, + uint32_t timeout_usec, + aesm_error_t *result); + + +uae_oal_status_t SGXAPI oal_get_quote( + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sig_rl, + uint32_t sig_rl_size, + sgx_report_t *p_qe_report, + sgx_quote_t *p_quote, + uint32_t quote_size, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t SGXAPI oal_get_ps_cap( + uint64_t* p_ps_cap, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t SGXAPI oal_report_attestation_status( + const sgx_platform_info_t* p_platform_info, + int attestation_status, + sgx_update_info_bit_t* p_update_info, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t oal_create_session( + uint32_t *session_id, + uint8_t *se_dh_msg1, + uint32_t dh_msg1_size, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t oal_exchange_report( + uint32_t session_id, + const uint8_t *se_dh_msg2, + uint32_t dh_msg2_size, + uint8_t *se_dh_msg3, + uint32_t dh_msg3_size, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t oal_close_session( + uint32_t session_id, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t oal_invoke_service( + const uint8_t *pse_message_req, + uint32_t pse_message_req_size, + uint8_t *pse_message_resp, + uint32_t pse_message_resp_size, + uint32_t timeout_usec, + aesm_error_t *response); + +sgx_status_t oal_map_status(uae_oal_status_t status); +sgx_status_t oal_map_result(aesm_error_t result); + +} /* end of extern "C" */ +#endif diff --git a/common/inc/internal/routine.h b/common/inc/internal/routine.h new file mode 100644 index 0000000000..c753b2e2bf --- /dev/null +++ b/common/inc/internal/routine.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ROUTINE_H_ +#define _ROUTINE_H_ +#include "sgx_eid.h" +#include "sgx_error.h" +#include "sgx_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _ocall_table_t +{ + uint32_t count; + void *ocall[]; +} sgx_ocall_table_t; + +sgx_status_t SGXAPI sgx_ecall(const sgx_enclave_id_t enclave_id, const int proc, const void *ocall_table, void *ms); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/common/inc/internal/rts.h b/common/inc/internal/rts.h new file mode 100644 index 0000000000..61a7711501 --- /dev/null +++ b/common/inc/internal/rts.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _RTS_H_ +#define _RTS_H_ + +#include "se_types.h" +#include "rts_cmd.h" + +typedef struct _ocall_context_t +{ + uintptr_t shadow0; + uintptr_t shadow1; + uintptr_t shadow2; + uintptr_t shadow3; + uintptr_t ocall_flag; + uintptr_t ocall_index; + uintptr_t pre_last_sp; + uintptr_t r15; + uintptr_t r14; + uintptr_t r13; + uintptr_t r12; + uintptr_t xbp; + uintptr_t xdi; + uintptr_t xsi; + uintptr_t xbx; + uintptr_t reserved[3]; + uintptr_t ocall_depth; + uintptr_t ocall_ret; +} ocall_context_t; + +typedef enum +{ + SDK_VERSION_1_5, + SDK_VERSION_2_0 +} sdk_version_t; + +typedef struct _cpu_feature_sdk_version +{ + uint64_t cpu_features; + sdk_version_t version; +}cpu_sdk_info_t; + +#define OCALL_FLAG 0x4F434944 + +#endif diff --git a/common/inc/internal/rts_cmd.h b/common/inc/internal/rts_cmd.h new file mode 100644 index 0000000000..671c2c90d1 --- /dev/null +++ b/common/inc/internal/rts_cmd.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* ECALL command */ +#define ECMD_ECALL 0 +#define ECMD_INIT_ENCLAVE -1 +#define ECMD_ORET -2 +#define ECMD_EXCEPT -3 + +/* OCALL command */ +#define OCMD_ERET -1 + diff --git a/common/inc/internal/se_atomic.h b/common/inc/internal/se_atomic.h new file mode 100644 index 0000000000..f4de235e8d --- /dev/null +++ b/common/inc/internal/se_atomic.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_ATOMIC_H_ +#define _SE_ATOMIC_H_ + + +inline uint32_t se_atomic_inc(volatile uint32_t *mem) +{ + int ret; + + __asm__ __volatile__ ("lock; xaddl %0, %1" + : "=r" (ret), "=m" (*mem) + : "0" (1), "m" (*mem) + ); + + return ret + 1; +} + +inline uint32_t se_atomic_dec(uint32_t volatile *mem) +{ + int ret; + + __asm__ __volatile__ ("lock; xaddl %0, %1" + : "=r" (ret), "=m" (*mem) + : "0" (-1), "m" (*mem) + ); + + return ret - 1; +} + +#endif diff --git a/common/inc/internal/se_cdefs.h b/common/inc/internal/se_cdefs.h new file mode 100644 index 0000000000..12be808120 --- /dev/null +++ b/common/inc/internal/se_cdefs.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SE_CDEFS_H_ +#define _SE_CDEFS_H_ + + +#define SGX_WEAK __attribute__((weak)) + +# if (__GNUC__ >= 3) +# define likely(x) __builtin_expect ((x), 1) +# define unlikely(x) __builtin_expect ((x), 0) +# else +# define likely(x) (x) +# define unlikely(x) (x) +# endif + +#ifndef SE_DECLSPEC_EXPORT +#define SE_DECLSPEC_EXPORT __attribute__((visibility("default"))) +#endif + +#ifndef SE_DECLSPEC_IMPORT +#define SE_DECLSPEC_IMPORT +#endif + +#ifndef SE_DECLSPEC_ALIGN +#define SE_DECLSPEC_ALIGN(x) __attribute__((aligned(x))) +#endif + +#ifndef SE_DECLSPEC_THREAD +#define SE_DECLSPEC_THREAD /*__thread*/ +#endif + +/* disable __try, __except on linux */ +#ifndef __try +#define __try try +#endif + +#ifndef __except +#define __except(x) catch(...) +#endif + + +#ifndef SE_DRIVER + +# define SE_GNU +# if defined(__x86_64__) +# define SE_64 +# define SE_GNU64 +# else +# define SE_32 +# define SE_GNU32 +# endif + +#endif + + #define INITIALIZER(f) \ + static void f(void) __attribute__((constructor)); + +#ifdef __cplusplus +#define MY_EXTERN extern "C" +#else +#define MY_EXTERN extern +#endif + +#define SGX_ACCESS_VERSION(libname, num) \ + MY_EXTERN const char *sgx_##libname##_version; \ + const char * __attribute__((destructor)) libname##_access_version_dummy##num() \ + { \ + return sgx_##libname##_version; \ + } + + +#endif diff --git a/common/inc/internal/se_cpu_feature.h b/common/inc/internal/se_cpu_feature.h new file mode 100644 index 0000000000..8b3edbfa66 --- /dev/null +++ b/common/inc/internal/se_cpu_feature.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SE_CPU_FEATURE_H_ +#define _SE_CPU_FEATURE_H_ + +#include +#include "se_cpu_feature_defs.h" + + +#ifdef __cplusplus +extern "C" uint64_t g_cpu_feature_indicator; +#else +extern uint64_t g_cpu_feature_indicator; +#endif + +#define TEST_CPU_HAS_RDRAND (g_cpu_feature_indicator & CPU_FEATURE_RDRND) + + +#endif diff --git a/common/inc/internal/se_cpu_feature_defs.h b/common/inc/internal/se_cpu_feature_defs.h new file mode 100644 index 0000000000..20983b96d7 --- /dev/null +++ b/common/inc/internal/se_cpu_feature_defs.h @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_CPU_FEATURE_DEFS_H_ +#define _SE_CPU_FEATURE_DEFS_H_ + +/* + * Different extended model + model values for Silverthorn. + */ +#define CPU_ATOM1 0x1c +#define CPU_ATOM2 0x26 +#define CPU_ATOM3 0x27 + +/* + * The processor family is an 8-bit value obtained by adding the + * Extended Family field of the processor signature returned by + * CPUID Function 1 with the Family field. + * F = (CPUID(1).EAX[27:20] >> 20) + (CPUID(1).EAX[11:8] >> 8) + */ +#define CPU_FAMILY(x) (((((x) >> 20) & 0xffU) | (((x) >> 8) & 0xfU)) & 0xffU) + +/* The processor model is an 8-bit value obtained by shifting left 4 + * the Extended Model field of the processor signature returned by + * CPUID Function 1 then adding the Model field. + * M = (CPUID(1).EAX[19:16] >> 12) + (CPUID(1).EAX[7:4] >> 4) + */ +#define CPU_MODEL(x) ((((x) >> 12) & 0xf0U) | (((x) >> 4) & 0xfU)) +#define CPU_STEPPING(x) (((x) >> 0) & 0xf) + +#define CPU_HAS_MMX(x) (((x) & (1 << 23)) != 0) +#define CPU_HAS_FXSAVE(x) (((x) & (1 << 24)) != 0) +#define CPU_HAS_SSE(x) (((x) & (1 << 25)) != 0) +#define CPU_HAS_SSE2(x) (((x) & (1 << 26)) != 0) +#define CPU_HAS_PNI(x) (((x) & (1 << 0)) != 0) +#define CPU_HAS_MNI(x) (((x) & (1 << 9)) != 0) +#define CPU_HAS_SNI(x) (((x) & (1 << 19)) != 0) +#define CPU_HAS_MOVBE(x) (((x) & (1 << 22)) != 0) +#define CPU_HAS_SSE4_2(x) (((x) & (1 << 20)) != 0) +#define CPU_HAS_POPCNT(x) (((x) & (1 << 23)) != 0) +#define CPU_HAS_PCLMULQDQ(x) (((x) & (1 << 1)) != 0) +#define CPU_HAS_AES(x) (((x) & (1 << 25)) != 0) +#define CPU_HAS_XSAVE(x) (((x) & (1 << 27)) != 0) +#define CPU_HAS_AVX(x) (((x) & (1 << 28)) != 0) +#define XFEATURE_ENABLED_AVX(x) \ + (((x) & 0x06) == 0x06) +#define CPU_HAS_F16C(x) (((x) & (1 << 29)) != 0) +#define CPU_HAS_RDRAND(x) (((x) & (1 << 30)) != 0) +#define CPU_HAS_IVB(x) (CPU_HAS_F16C(x) && CPU_HAS_RDRAND(x)) +#define CPU_HAS_IVB_NORDRAND(x) (CPU_HAS_F16C(x)) +#define CPU_HAS_AVX2(x) (((x) & (1 << 5)) != 0) +#define CPU_HAS_HLE(x) (((x) & (1 << 4)) != 0) +#define CPU_HAS_RTM(x) (((x) & (1 << 11)) != 0) +#define CPU_HAS_ADCOX(x) (((x) & (1 << 19)) != 0) +#define CPU_HAS_RDSEED(x) (((x) & (1 << 18)) != 0) +#define CPU_HAS_BMI(x) (((x) & (1 << 3)) != 0 && \ + ((x) & (1 << 8)) != 0) +#define CPU_HAS_LZCNT(x) (((x) & (1 << 5)) != 0) +#define CPU_HAS_PREFETCHW(x) (((x) & (1 << 8)) != 0) +#define CPU_HAS_FMA(x) (((x) & (1 << 12)) != 0) +#define CPU_HAS_HSW(cpuid7_ebx, ecpuid1_ecx, cpuid1_ecx) \ + (CPU_HAS_AVX2(cpuid7_ebx) && CPU_HAS_BMI(cpuid7_ebx) && \ + CPU_HAS_LZCNT(ecpuid1_ecx) && CPU_HAS_FMA(cpuid1_ecx) && \ + CPU_HAS_HLE(cpuid7_ebx) && CPU_HAS_RTM(cpuid7_ebx)) + +#define CPU_HAS_FPU(x) (((x) & (1 << 0)) != 0) +#define CPU_HAS_CMOV(x) (((x) & (1 << 15)) != 0) + +#define CPU_HAS_SSE3(x) (((x) & (1 << 0)) != 0) +#define CPU_HAS_SSSE3(x) (((x) & (1 << 9)) != 0) + +#define CPU_HAS_SSE4_1(x) (((x) & (1 << 19)) != 0) + +#define CPU_HAS_LRBNI(x) (((x) & (1 << 1)) != 0) +#define CPU_HAS_LRB2(x) (((x) & (1 << 4)) != 0) + + +#define CPU_GENU_VAL ('G' << 0 | 'e' << 8 | 'n' << 16 | 'u' << 24) +#define CPU_INEI_VAL ('i' << 0 | 'n' << 8 | 'e' << 16 | 'I' << 24) +#define CPU_NTEL_VAL ('n' << 0 | 't' << 8 | 'e' << 16 | 'l' << 24) + +/* + * These values must be in sync with dev/proton/globals/glob_cpu_info.c + * c_legacy_cpu_set_xxx constants. + */ +#define CPU_GENERIC 0x1 +#define CPU_PENTIUM 0x2 +#define CPU_PENTIUM_PRO 0x4 +#define CPU_PENTIUM_MMX 0x8 +#define CPU_PENTIUM_II 0x10 +#define CPU_PENTIUM_II_FXSV 0x20 +#define CPU_PENTIUM_III 0x40 +#define CPU_PENTIUM_III_SSE 0x80 +#define CPU_PENTIUM_4 0x100 +#define CPU_PENTIUM_4_SSE2 0x200 +#define CPU_BNI 0x400 +#define CPU_PENTIUM_4_PNI 0x800 +#define CPU_MNI 0x1000 +#define CPU_SNI 0x2000 +#define CPU_BNL 0x4000 +#define CPU_NHM 0x8000 +#define CPU_WSM 0x10000 +#define CPU_SNB 0x20000 +#define CPU_IVB 0x40000 +#define CPU_HSW 0x400000 + +#define CPU_PENTIUM_FAMILY 5 +#define CPU_PPRO_FAMILY 6 +#define CPU_WMT_FAMILY 15 + +/* + * The processor is a generic IA32 CPU + */ +#define CPU_FEATURE_GENERIC_IA32 0x00000001ULL + +/* + * Floating point unit is on-chip. + */ +#define CPU_FEATURE_FPU 0x00000002ULL + +/* + * Conditional mov instructions are supported. + */ +#define CPU_FEATURE_CMOV 0x00000004ULL + +/* + * The processor supports the MMX technology instruction set extensions + * to Intel Architecture. + */ +#define CPU_FEATURE_MMX 0x00000008ULL + +/* + * The FXSAVE and FXRSTOR instructions are supported for fast + * save and restore of the floating point context. + */ +#define CPU_FEATURE_FXSAVE 0x00000010ULL + +/* + * Indicates the processor supports the Streaming SIMD Extensions Instructions. + */ +#define CPU_FEATURE_SSE 0x00000020ULL + +/* + * Indicates the processor supports the Streaming SIMD + * Extensions 2 Instructions. + */ +#define CPU_FEATURE_SSE2 0x00000040ULL + +/* + * Indicates the processor supports the Streaming SIMD + * Extensions 3 Instructions. (PNI) + */ +#define CPU_FEATURE_SSE3 0x00000080ULL + +/* + * The processor supports the Supplemental Streaming SIMD Extensions 3 + * instructions. (MNI) + */ +#define CPU_FEATURE_SSSE3 0x00000100ULL + +/* + * The processor supports the Streaming SIMD Extensions 4.1 instructions.(SNI) + */ +#define CPU_FEATURE_SSE4_1 0x00000200ULL + +/* + * The processor supports the Streaming SIMD Extensions 4.1 instructions. + * (NNI + STTNI) + */ +#define CPU_FEATURE_SSE4_2 0x00000400ULL + + +/* + * The processor supports POPCNT instruction. + */ +#define CPU_FEATURE_POPCNT 0x00000800ULL + +/* + * The processor supports MOVBE instruction. + */ +#define CPU_FEATURE_MOVBE 0x00001000ULL + +/* + * The processor supports PCLMULQDQ instruction. + */ +#define CPU_FEATURE_PCLMULQDQ 0x00002000ULL + +/* + * The processor supports instruction extension for encryption. + */ +#define CPU_FEATURE_AES 0x00004000ULL + +/* + * The processor supports 16-bit floating-point conversions instructions. + */ +#define CPU_FEATURE_F16C 0x00008000ULL + +/* + * The processor supports AVX instruction extension. + */ +#define CPU_FEATURE_AVX 0x00010000ULL + +/* + * The processor supports RDRND (read random value) instruction. + */ +#define CPU_FEATURE_RDRND 0x00020000ULL + +/* + * The processor supports FMA instructions. + */ +#define CPU_FEATURE_FMA 0x00040000ULL + +/* + * The processor supports two groups of advanced bit manipulation extensions. - Haswell introduced, AVX2 related + */ +#define CPU_FEATURE_BMI 0x00080000ULL + +/* + * The processor supports LZCNT instruction (counts the number of leading zero + * bits). - Haswell introduced + */ +#define CPU_FEATURE_LZCNT 0x00100000ULL + +/* + * The processor supports HLE extension (hardware lock elision). - Haswell introduced + */ +#define CPU_FEATURE_HLE 0x00200000ULL + +/* + * The processor supports RTM extension (restricted transactional memory) - Haswell AVX2 related. + */ +#define CPU_FEATURE_RTM 0x00400000ULL + +/* + * The processor supports AVX2 instruction extension. + */ +#define CPU_FEATURE_AVX2 0x00800000ULL + +/* + * The processor supports AVX512 instruction extension. + */ +#define CPU_FEATURE_AVX512 0x01000000ULL + +/* + * The processor supports the PREFETCHW instruction. + */ +#define CPU_FEATURE_PREFETCHW 0x02000000ULL + +/* + * The processor supports RDSEED instruction. + */ +#define CPU_FEATURE_RDSEED 0x04000000ULL + +/* + * The processor supports ADCX and ADOX instructions. + */ +#define CPU_FEATURE_ADCOX 0x08000000ULL + +/* + * The processor is a full inorder (Silverthorne) processor + */ +#define CPU_FEATURE_FULL_INORDER 0x10000000ULL + +/* Reserved feature bits which includes the unset bit CPU_FEATURE_AVX512 */ +#define RESERVED_CPU_FEATURE_BIT ((~(0x20000000ULL - 1)) | 0x01000000ULL) + +#endif diff --git a/common/inc/internal/se_debugger_lib.h b/common/inc/internal/se_debugger_lib.h new file mode 100644 index 0000000000..97e4e36546 --- /dev/null +++ b/common/inc/internal/se_debugger_lib.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SEDEBUGGERLIB_H_ +#define _SEDEBUGGERLIB_H_ + +#include "arch.h" +#include "se_types.h" +#include "se_macro.h" +#include + +#define URTS_EXCEPTION_PRECREATEENCLAVE 0xa1a01ec0 +#define URTS_EXCEPTION_POSTINITENCLAVE 0xa1a01ec1 +#define URTS_EXCEPTION_PREREMOVEENCLAVE 0xa1a01ec3 +#define URTS_EXCEPTION_PREEENTER 0xa1a01ec7 + +#define FIRST_CHANCE_EXCEPTION 1 +#define SECOND_CHANCE_EXCEPTION 0 + +#define DBWIN_BUFFER 0xa1a01ec5 +#define CXX_EXCEPTION 0xe06d7363 + +#define SE_UNICODE 1 +#define SE_ANSI 0 +#define DEBUGGER_ENABLED 1 + +#define DEBUG_INFO_STRUCT_VERSION 0x83d0ce23 + +const size_t BUF_SIZE = sizeof(void*); + +typedef struct _debug_tcs_info_t +{ + struct _debug_tcs_info_t* next_tcs_info; + void* TCS_address; + uintptr_t ocall_frame; /* ocall_frame_t** */ + unsigned long thread_id; +}debug_tcs_info_t; + + +#define DEBUG_INFO_MAX_PARAMETERS 10 +typedef struct _debug_info_t +{ + uintptr_t param_array[DEBUG_INFO_MAX_PARAMETERS]; +}debug_info_t; + +//enclave_type bit map +#define ET_SIM_SHIFT 0 /*bits[0]=0 hw, bits[0]=1 sim*/ +#define ET_DEBUG_SHIFT 1 /*bits[1]=0 product enclave, bits[1]=1 debug enclave*/ +#define ET_SIM (1 << ET_SIM_SHIFT) +#define ET_DEBUG (1 << ET_DEBUG_SHIFT) + +typedef struct _debug_enclave_info_t +{ + PADDED_POINTER(struct _debug_enclave_info_t, next_enclave_info); + PADDED_POINTER(void, start_addr); + PADDED_POINTER(debug_tcs_info_t, tcs_list); + uint32_t enclave_type; + uint32_t file_name_size; + PADDED_POINTER(void, lpFileName); + PADDED_POINTER(void, g_peak_heap_used_addr); + PADDED_POINTER(void, dyn_sec); + sgx_misc_select_t misc_select; + /* The following members are optional or unused */ + uint32_t struct_version; + uint32_t unicode; +}debug_enclave_info_t; +typedef struct _ocall_frame_t +{ + uintptr_t pre_last_frame; + uintptr_t index; + uintptr_t xbp; + uintptr_t ret; +}ocall_frame_t; + +static inline void destory_debug_info(debug_enclave_info_t *debug_info) +{ + if(debug_info->lpFileName) + { + free(debug_info->lpFileName); + debug_info->lpFileName = NULL; + } + + /*tcs_list is just a pointer, the instance is maintained in CTrustThread, so don't free it.*/ + debug_info->tcs_list = NULL; +} +#endif /*_SEDEBUGGERLIB_H_*/ + diff --git a/common/inc/internal/se_enclave_type.h b/common/inc/internal/se_enclave_type.h new file mode 100644 index 0000000000..bd450e3918 --- /dev/null +++ b/common/inc/internal/se_enclave_type.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_ENCLAVE_TYPE_H_ +#define _SE_ENCLAVE_TYPE_H_ + +typedef enum +{ + enclave_type_general = 0, + enclave_type_architecture, +} enclave_type_t; + +#endif diff --git a/common/inc/internal/se_error_internal.h b/common/inc/internal/se_error_internal.h new file mode 100644 index 0000000000..b98aed81d7 --- /dev/null +++ b/common/inc/internal/se_error_internal.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_ERROR_INTERNAL_H_ +#define _SE_ERROR_INTERNAL_H_ + +#include "sgx_error.h" + +/* +bit[31:30] - main module id + 00 - external error + 11---internal error +bit[29:16] - reserved +bit[15:12] - sub-module id +bit[11:0] - specific error +*/ + +#define MAIN_MOD_SHIFT 30 +#define SUB_MOD_SHIFT 12 + +#define INTERNAL_ERROR 3 +#define EXTERNAL_ERROR 0 + +#define SE_INTERNAL_ERROR(x) (0xC0000000|(x)) + +typedef enum _se_status_internal_t +{ + SE_ERROR_SUCCESS = 0, /*same value as SGX_SUCCESS*/ + /*error code for driver return to uRTS*/ + SE_ERROR_DRIVER_UNEXPECTED = SE_INTERNAL_ERROR(0X2001), + SE_ERROR_DRIVER_INVALID_ID = SE_INTERNAL_ERROR(0X2002), + SE_ERROR_DRIVER_INVALID_PARAMETER = SE_INTERNAL_ERROR(0X2003), + SE_ERROR_DRIVER_INVALID_REQUEST = SE_INTERNAL_ERROR(0X2004), + SE_ERROR_DRIVER_OUTOF_MEMORY_R0 = SE_INTERNAL_ERROR(0X2005), + SE_ERROR_DRIVER_OUTOF_MEMORY_R3 = SE_INTERNAL_ERROR(0X2006), + SE_ERROR_DRIVER_OUTOF_EPC = SE_INTERNAL_ERROR(0X2007), + SE_ERROR_DRIVER_HW_CAPABILITY = SE_INTERNAL_ERROR(0X2008), + SE_ERROR_DRIVER_MEMORY_MAP_CONFLICT = SE_INTERNAL_ERROR(0X2009), + SE_ERROR_DRIVER_POWER = SE_INTERNAL_ERROR(0X200a), + SE_ERROR_DRIVER_INVALID_PRIVILEGE = SE_INTERNAL_ERROR(0X200b), + SE_ERROR_DRIVER_INVALID_ISVSVNLE = SE_INTERNAL_ERROR(0X200c), + + SE_ERROR_DRIVER_INVALID_SIG_STRUCT = SE_INTERNAL_ERROR(0X2100), + SE_ERROR_DRIVER_INVALID_ATTRIBUTE = SE_INTERNAL_ERROR(0X2101), + SE_ERROR_DRIVER_INVALID_MEASUREMENT = SE_INTERNAL_ERROR(0X2102), + SE_ERROR_DRIVER_INVALID_SIGNATURE = SE_INTERNAL_ERROR(0X2103), + SE_ERROR_DRIVER_INVALID_LAUNCH_TOKEN= SE_INTERNAL_ERROR(0X2104), + SE_ERROR_DRIVER_INVALID_CPUSVN = SE_INTERNAL_ERROR(0X2105), + SE_ERROR_DRIVER_UNMASKED_EVENT = SE_INTERNAL_ERROR(0X2106), + + SE_ERROR_INVALID_LAUNCH_TOKEN = SE_INTERNAL_ERROR(0x2200), /* the license is invalid*/ + SE_ERROR_INVALID_MEASUREMENT = SE_INTERNAL_ERROR(0x2201), /* The measurement of the enclave is invalid. May caused by signature or launch token*/ + SE_ERROR_READ_LOCK_FAIL = SE_INTERNAL_ERROR(0x2202), + SE_ERROR_INVALID_ISVSVNLE = SE_INTERNAL_ERROR(0X2203), + + /*error code for untrusted event of SE mutex*/ + SE_ERROR_MUTEX_GET_EVENT = SE_INTERNAL_ERROR(0x3001), + SE_ERROR_MUTEX_WAIT_EVENT = SE_INTERNAL_ERROR(0x3002), + SE_ERROR_MUTEX_WAKE_EVENT = SE_INTERNAL_ERROR(0x3003), +} se_status_internal_t; + +#endif diff --git a/common/inc/internal/se_event.h b/common/inc/internal/se_event.h new file mode 100644 index 0000000000..3672fd3246 --- /dev/null +++ b/common/inc/internal/se_event.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_EVENT_H_ +#define _SE_EVENT_H_ + +# include +# include +# include +typedef void * se_handle_t; + +#include "sgx_defs.h" + +#define SE_MUTEX_SUCCESS 0x0 +#define SE_MUTEX_INVALID 0x1 +#define SE_MUTEX_ERROR_WAKE 0x2 +#define SE_MUTEX_ERROR_WAIT 0x3 + +#ifdef __cplusplus +extern "C" { +#endif + +se_handle_t SGXAPI se_event_init(void); +void SGXAPI se_event_destroy(se_handle_t); + +int SGXAPI se_event_wait(se_handle_t); +int SGXAPI se_event_wake(se_handle_t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/se_lock.hpp b/common/inc/internal/se_lock.hpp new file mode 100644 index 0000000000..68aedf2cf5 --- /dev/null +++ b/common/inc/internal/se_lock.hpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* This file implement lock guard */ + +#ifndef SE_LOCK_HPP +#define SE_LOCK_HPP + +#include "util.h" +#include "se_thread.h" +#include "uncopyable.h" + +class Mutex: private Uncopyable +{ +public: + Mutex(){se_mutex_init(&m_mutex);} + ~Mutex(){se_mutex_destroy(&m_mutex);} + void lock(){se_mutex_lock(&m_mutex);} + void unlock(){se_mutex_unlock(&m_mutex);} +private: + se_mutex_t m_mutex; +}; + +class LockGuard: private Uncopyable +{ +public: + LockGuard(Mutex* mutex):m_mutex(mutex){m_mutex->lock();} + ~LockGuard(){m_mutex->unlock();} +private: + Mutex* m_mutex; +}; + +#endif diff --git a/common/inc/internal/se_macro.h b/common/inc/internal/se_macro.h new file mode 100644 index 0000000000..4b465ac71b --- /dev/null +++ b/common/inc/internal/se_macro.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + #ifndef SE_MACRO_H_ + #define SE_MACRO_H_ + +#ifndef SGX_HYPERV_ECO +#define SGX_HYPERV_ECO +#endif + + #endif \ No newline at end of file diff --git a/common/inc/internal/se_map.h b/common/inc/internal/se_map.h new file mode 100644 index 0000000000..2b1889a838 --- /dev/null +++ b/common/inc/internal/se_map.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_MAP_H_ +#define _SE_MAP_H_ + +#include +#include +#include +#include + +#include "se_types.h" + +#include +#include +#include +#include +typedef int se_file_handle_t; + +typedef struct { + uint8_t* base_addr; /* pointer to the mapped area */ + size_t length; /* the length of the mapping */ +} map_handle_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Map a file to memory and get its size. */ +map_handle_t* map_file(se_file_handle_t fd, uint32_t *size); + +/* Unmap a mapped file. */ +void unmap_file(map_handle_t* mh); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/se_memcpy.h b/common/inc/internal/se_memcpy.h new file mode 100644 index 0000000000..f7cd259993 --- /dev/null +++ b/common/inc/internal/se_memcpy.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_MEMCPY_H_ +#define _SE_MEMCPY_H_ + +#include + + +/* memcpy_s always return 0 under Linux */ + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +static inline errno_t memcpy_s(void *dest, size_t numberOfElements, const void *src, size_t count) +{ + if(numberOfElements +#include +#include +#include + +#ifndef MEM_COMMIT +#define MEM_COMMIT 0x1000 +#endif + +#ifndef MEM_RESERVE +#define MEM_RESERVE 0x2000 +#endif + +#ifdef MEM_RELEASE +#warning "MEM_RELEASE define conflict" +#else +#define MEM_RELEASE 0x8000 +#endif + +#ifdef MEM_DECOMMIT +#warning "MEM_DECOMMIT define conflict" +#else +#define MEM_DECOMMIT 0x4000 +#endif + +#include "se_types.h" +#include "arch.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +Reserves or commits a region of pages in the virtual address space of the calling process. +Memory allocated by this function is automatically initialized to zero, unless MEM_RESET is specified. +@address: the starting address of the region to allocate. +@size: size of region in bytes. +@type: Only MEM_COMMIT accepted. + MEM_COMMIT - Allocates memory charges for the specified reserved memory pages. + Actual physical pages are not allocated until the virtual addresses are actually accessed. + The function initializes the memory to zero. +@return value: If the function succeeds, the return value is the base address of the allocated region of pages. + If the function fails, the return value is NULL. +*/ +void* se_virtual_alloc(void* address, size_t size, uint32_t type); +/* +Releases, decommits, or releases and decommits a region of pages within the virtual address space of the calling process. +@address:A pointer to the base address of the region of pages to be freed. If the dwFreeType parameter is MEM_RELEASE, + this parameter must be the base address returned by the se_virtual_alloc function when the region of pages is reserved. +@size: The size of the region of memory to be freed, in bytes. +@type: Only MEM_RELEASE accepted + MEM_RELEASE - releases the specified region of pages. After this operation, the pages are in the free state. +@return value:If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. +*/ +int se_virtual_free(void* address, size_t size, uint32_t type); +/* +Locks the specified region of the process's virtual address space into physical memory, ensuring that subsequent access to the region will not incur a page fault. +@address: A pointer to the base address of the region of pages to be locked. + The region of affected pages includes all pages that contain one or more bytes in the range from the address parameter to (address+size). +@size: The size of the region to be locked, in bytes. +@return value: If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. +*/ +int se_virtual_lock(void* address, size_t size); +/* +Changes the protection on a region of committed pages in the virtual address space of the calling process. +@address: A pointer an address that describes the starting page of the region of pages whose access protection attributes are to be changed. +@size: The size of the region whose access protection attributes are to be changed, in bytes. +@prot: The memory protection option. The option can be SI_FLAG_R, SI_FLAG_W, SI_FLAG_X. +@return value: If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. +*/ + +#define SGX_PROT_NONE PROT_NONE + +int se_virtual_protect(void* address, size_t size, uint32_t prot); + + +#include +#include +#include +#include +typedef pid_t se_proc_t; + +/* +@return value: on success, return TRUE else return FALSE +*/ +se_proc_t get_self_proc(void); +/* +** If the function succeeds, the return value is nonzero. +** If the function fails, the return value is zero. +*/ +int put_self_proc(se_proc_t proc); +int se_read_process_mem(se_proc_t proc, void* base_addr, void* buffer, size_t size, size_t* read_nr); +int se_write_process_mem(se_proc_t proc, void* base_addr, void* buffer, size_t size, size_t* write_ndr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/se_page_attr.h b/common/inc/internal/se_page_attr.h new file mode 100644 index 0000000000..9bafac8af5 --- /dev/null +++ b/common/inc/internal/se_page_attr.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_PAGE_ATTR_H_ +#define _SE_PAGE_ATTR_H_ + +typedef enum +{ + DoEADD = 0, + DoEEXTEND, +} ATTRIBUTE_BITS_t; + +typedef enum +{ + ADD_PAGE_ONLY = 1< + +typedef pthread_rwlock_t se_rwlock_t; +typedef pthread_rwlock_t* se_prwlock_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void se_wtlock(se_prwlock_t); +void se_wtunlock(se_prwlock_t); +int se_try_rdlock(se_prwlock_t); +void se_rdlock(se_prwlock_t lock); +void se_rdunlock(se_prwlock_t); +void se_init_rwlock(se_prwlock_t lock); +void se_fini_rwlock(se_prwlock_t lock); + +#ifdef __cplusplus +} +#endif + +#endif /* _RWLOCK_H_ */ diff --git a/common/inc/internal/se_stdio.h b/common/inc/internal/se_stdio.h new file mode 100644 index 0000000000..9f5dc3adab --- /dev/null +++ b/common/inc/internal/se_stdio.h @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef SE_STDIO_H +#define SE_STDIO_H + +#include +#include +#include "se_memcpy.h" +#include +#include +#include +#include +#include + +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif + +static inline int se_delete_file(const char *path_name) +{ + return unlink(path_name); +} + +#define se_delete_tfile se_delete_file + +static inline int sprintf_s(char *dst_buf, size_t size_in_bytes, const char *format, ...) +{ + va_list argptr; + int cnt; + va_start(argptr, format); + cnt = vsnprintf(dst_buf, size_in_bytes, format, argptr); + va_end(argptr); + return cnt; +} + +static inline int _snprintf_s(char *dst_buf, size_t size_in_bytes, size_t max_count, const char *format, ...) +{ + (void) size_in_bytes; + va_list argptr; + int cnt; + va_start(argptr, format); + cnt = vsnprintf(dst_buf, max_count, format, argptr); + va_end(argptr); + return cnt; +} + +static inline errno_t fopen_s(FILE **f, const char *filename, const char *mode) +{ + errno_t err = 0; + *f = fopen(filename, mode); + if(*f==NULL){ + err = -1; + } + return err; +} + +static inline int se_copy_file(const char *dst_name, const char *src_name) +{ + int dest = -1; + int source = -1; + ssize_t nr_read; + struct stat stat_buf; + +#ifndef BUF_SIZE +#define BUF_SIZE 4096 +#endif + char buf[BUF_SIZE]; + + /* open the input file */ + source = open(src_name, O_RDONLY); + if(source < 0) + goto error; + + /* get size and permissions of the prebuild DB file */ + if (fstat(source, &stat_buf) != 0) + goto error; + + dest = open(dst_name, O_WRONLY|O_CREAT|O_TRUNC, stat_buf.st_mode); + if(dest < 0) + goto error; + + while ((nr_read = read(source, buf, BUF_SIZE)) > 0) + { + if (write(dest, buf, nr_read) != nr_read) + goto error; + } +#undef BUF_SIZE + + close(dest); + close(source); + return 0; + +error: + if(dest>=0)close(dest); + if(source>=0)close(source); + return -1; +} + +#ifdef __cplusplus +template +int sprintf_s(char (&dst)[_Size], const char *format, ...) +{ + va_list argptr; + int cnt; + va_start(argptr, format); + cnt = vsprintf(dst, format, argptr); + va_end(argptr); + return cnt; +} + +template +int _snprintf_s(char (&dst)[_Size], size_t max_count, const char *format, ...) +{ + va_list argptr; + int cnt; + va_start(argptr, format); + cnt = vsnprintf(dst, max_count, format, argptr); + va_end(argptr); + return cnt; +} + +#endif + +#endif diff --git a/common/inc/internal/se_string.h b/common/inc/internal/se_string.h new file mode 100644 index 0000000000..e5185617df --- /dev/null +++ b/common/inc/internal/se_string.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_STRING_H_ +#define _SE_STRING_H_ + +#include "se_memcpy.h" +#include + + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +static inline errno_t strcat_s(char *dst, size_t max_size, const char *src) +{ + if(strlen(dst)+strlen(src)+1>max_size)return -1; + strcat(dst, src); + return 0; +} + +static inline errno_t strcpy_s(char *dst, size_t max_size, const char *src) +{ + if(strnlen(src, max_size)+1>max_size)return -1; + strcpy(dst, src); + return 0; +} + +#define _strnicmp strncasecmp +static inline errno_t strncat_s(char *dst, size_t max_size, const char *src, size_t max_count) +{ + size_t len = strnlen(src,max_count); + len+=strnlen(dst, max_size)+1; + if(len>max_size)return -1; + strncat(dst, src, max_count); + return 0; +} + +#define _strdup strdup +#define strnlen_s strnlen + + + +#endif diff --git a/common/inc/internal/se_thread.h b/common/inc/internal/se_thread.h new file mode 100644 index 0000000000..d6432b80b1 --- /dev/null +++ b/common/inc/internal/se_thread.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SE_THREAD_H_ +#define _SE_THREAD_H_ + + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */ +#endif +#include +#include +#include +#include +typedef pthread_mutex_t se_mutex_t; +typedef pid_t se_thread_id_t; +typedef pthread_key_t se_tls_index_t; + +#ifdef __cplusplus +extern "C" { +#endif +/* +@mutex: A pointer to the critical section object. +@return value: If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. +*/ +void se_mutex_init(se_mutex_t* mutex); +int se_mutex_lock(se_mutex_t* mutex); +int se_mutex_unlock(se_mutex_t* mutex); +int se_mutex_destroy(se_mutex_t* mutex); + +unsigned int se_get_threadid(void); + +/* tls functions */ +int se_tls_alloc(se_tls_index_t *tls_index); +int se_tls_free(se_tls_index_t tls_index); +void * se_tls_get_value(se_tls_index_t tls_index); +int se_tls_set_value(se_tls_index_t tls_index, void *tls_value); + +/* se_thread_handle_t se_create_thread(size_t stack_size, thread_start_routine_t start_routine, void *param, se_thread_t* thread); */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/se_time.h b/common/inc/internal/se_time.h new file mode 100644 index 0000000000..d1492021ea --- /dev/null +++ b/common/inc/internal/se_time.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_TIME_H_ +#define _SE_TIME_H_ + +#include "se_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* +*@milli_seconds: the time range for sleep. It is milliseconds. +*/ +void se_sleep(uint32_t milli_seconds); +uint64_t se_get_tick_count_freq(void); +uint64_t se_get_tick_count(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/se_trace.h b/common/inc/internal/se_trace.h new file mode 100644 index 0000000000..68967939d7 --- /dev/null +++ b/common/inc/internal/se_trace.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + *This file wrapper some trace output. +*/ + +#ifndef _SE_DEBUG_H_ +#define _SE_DEBUG_H_ + +#include +#include + +typedef enum +{ + SE_TRACE_ERROR, + SE_TRACE_WARNING, + SE_TRACE_NOTICE, + SE_TRACE_DEBUG +} se_trace_t; + +#ifndef SE_DEBUG_LEVEL +/* Each module need define their own SE_DEBUG_LEVEL */ +#define SE_DEBUG_LEVEL SE_TRACE_ERROR +#endif + +#ifdef __cplusplus +extern "C" { +#endif +int se_trace_internal(int debug_level, const char *fmt, ...); + +#ifdef __cplusplus +} +#endif + +/* For libraries, we usually define DISABLE_TRACE to disable any trace. */ +/* For apps, we usually enable trace. */ +#ifdef DISABLE_TRACE +#define SE_TRACE(...) +#define se_trace(...) +#else /* DISABLE_TRACE */ +#define se_trace(debug_level, fmt, ...) \ + do { \ + if(debug_level <= SE_DEBUG_LEVEL) \ + se_trace_internal(debug_level, fmt, ##__VA_ARGS__); \ + }while(0) + +/* For compatibility, SE_TRACE/se_trace is used in old code. */ +/* New code should use SE_TRACE_DEBUG, SE_TRACE_NOTICE, SE_TRACE_WARNING, SE_TRACE_ERROR */ +#define SE_TRACE(debug_level, fmt, ...) \ + se_trace(debug_level, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__) +#endif/* DISABLE_TRACE */ + +/* SE_TRACE_DEBUG and SE_TRACE_NOTICE print the debug information plus message. */ +#define SE_TRACE_DEBUG(fmt, ...) se_trace(SE_TRACE_DEBUG, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__) +#define SE_TRACE_NOTICE(fmt, ...) se_trace(SE_TRACE_NOTICE, "[%s %s:%d] " fmt, __FUNCTION__, __FILE__, __LINE__, ##__VA_ARGS__) +/* SE_TRACE_WARNING and SE_TRACE_ERROR only print message. */ +#define SE_TRACE_WARNING(fmt, ...) se_trace(SE_TRACE_WARNING, fmt, ##__VA_ARGS__) +#define SE_TRACE_ERROR(fmt, ...) se_trace(SE_TRACE_ERROR, fmt, ##__VA_ARGS__) + +#endif diff --git a/common/inc/internal/se_types.h b/common/inc/internal/se_types.h new file mode 100644 index 0000000000..c3b29e047a --- /dev/null +++ b/common/inc/internal/se_types.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * This file is to define some types that is platform independent. +*/ + +#ifndef _SE_TYPE_H_ +#define _SE_TYPE_H_ +#include "se_cdefs.h" + +#ifdef SE_DRIVER + +typedef INT8 int8_t; +typedef UINT8 uint8_t; +typedef INT16 int16_t; +typedef UINT16 uint16_t; +typedef INT32 int32_t; +typedef UINT32 uint32_t; +typedef INT64 int64_t; +typedef UINT64 uint64_t; + +#else + +#include +#include + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#endif + +#if defined(SE_64) + +#define PADDED_POINTER(t, p) t* p +#define PADDED_DWORD(d) uint64_t d +#define PADDED_LONG(l) int64_t l +#define REG(name) r##name +#ifdef SE_SIM_EXCEPTION +#define REG_ALIAS(name) R##name +#endif +#define REGISTER(name) uint64_t REG(name) + +#else /* !defined(SE_64) */ + +#define PADDED_POINTER(t, p) t* p; void* ___##p##_pad_to64_bit +#define PADDED_DWORD(d) uint32_t d; uint32_t ___##d##_pad_to64_bit +#define PADDED_LONG(l) int32_t l; int32_t ___##l##_pad_to64_bit + +#define REG(name) e##name + +#ifdef SE_SIM_EXCEPTION +#define REG_ALIAS(name) E##name +#endif + +#define REGISTER(name) uint32_t REG(name); uint32_t ___##e##name##_pad_to64_bit + +#endif /* !defined(SE_64) */ + +#endif diff --git a/common/inc/internal/se_vendor.h b/common/inc/internal/se_vendor.h new file mode 100644 index 0000000000..ce2f1674bc --- /dev/null +++ b/common/inc/internal/se_vendor.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_VENDOR_H_ +#define _SE_VENDOR_H_ + +#define INTEL_VENDOR_ID 0x8086 +#define AE_PRODUCT_ID 0x1 + +#endif diff --git a/common/inc/internal/se_version.h b/common/inc/internal/se_version.h new file mode 100644 index 0000000000..b7bf1bb4a0 --- /dev/null +++ b/common/inc/internal/se_version.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#define STRFILEVER "1.5.80.33399" + diff --git a/common/inc/internal/se_wrapper.h b/common/inc/internal/se_wrapper.h new file mode 100644 index 0000000000..0edf25d8be --- /dev/null +++ b/common/inc/internal/se_wrapper.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + *This file wrapper all the head file that is platform dependent. +*/ +#ifndef _SE_WRAPPER_H_ +#define _SE_WRAPPER_H_ + +#include "se_cdefs.h" +#include "se_types.h" +#include "se_thread.h" +#include "se_trace.h" +#include "se_time.h" +#include "se_event.h" +#include "se_rwlock.h" +#include "se_atomic.h" +#include "se_memcpy.h" +#include "se_string.h" +#include "se_stdio.h" + +#endif diff --git a/common/inc/internal/sgx_memset_s.h b/common/inc/internal/sgx_memset_s.h new file mode 100644 index 0000000000..64956b384a --- /dev/null +++ b/common/inc/internal/sgx_memset_s.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SE_MEMSET_S_H +#define _SE_MEMSET_S_H +#include +#ifdef __cplusplus +extern "C" +#endif +int memset_s(void *s, size_t smax, int c, size_t n); + +#endif diff --git a/common/inc/internal/sgx_profile.h b/common/inc/internal/sgx_profile.h new file mode 100644 index 0000000000..3c83d1a396 --- /dev/null +++ b/common/inc/internal/sgx_profile.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* +Some notes for using the profiling macros + +1. Define _PROFILE_ before including "sgx_profile.h" will enable the profiling, + also need to include sgx_profile.cpp in the compiling process +2. When use it in multi-threaded application, please don't trigger profiling in multiple threads at the same time. + The implementation is not thread-safe now, to avoid additional latency introduced by locks +3. PROFILE_OUTPUT macro should only be used once before application exits +4. PROFILE_START and PROFILE_END should be paired, otherwise PROFILE_OUTPUT will abort the program when detects the mismatch + +A simple example to use PROFILE macro + +#define _PROFILE_ +#include "sgx_profile.h" + +... +PROFILE_INIT(); +... + +PROFILE_START("func1"); +func1(); +PROFILE_END("func1"); + +... + +PROFILE_START("func2"); +func2(); +PROFILE_END("func2"); + +... + +PROFILE_OUTPUT("C:\\work\\output.csv"); +... +*/ + + +#ifndef _SGX_PROFILE_H_ +#define _SGX_PROFILE_H_ + + +#if defined(_PROFILE_) +#define PRO_START 0 +#define PRO_END 1 + +#if defined(__cplusplus) +extern "C" +{ +#endif + +void profile_init(); +void profile_start(const char* str); /* 'str' must be global string. Do not use string in stack. */ +void profile_end(const char * str); +void profile_output(const char* filename); + +#if defined(__cplusplus) +} +#endif + +#define PROFILE_INIT() profile_init() +#define PROFILE_START(x) profile_start(x) +#define PROFILE_END(x) profile_end(x) +#define PROFILE_OUTPUT(x) profile_output(x) + +#else +#define PROFILE_INIT() +#define PROFILE_START(x) +#define PROFILE_END(x) +#define PROFILE_OUTPUT(x) +#endif + + +#endif diff --git a/common/inc/internal/sgx_read_rand.h b/common/inc/internal/sgx_read_rand.h new file mode 100644 index 0000000000..05d79861f3 --- /dev/null +++ b/common/inc/internal/sgx_read_rand.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __SGX_READ_RAND_H__ +#define __SGX_READ_RAND_H__ +#include "sgx.h" +#include "sgx_defs.h" +#ifdef __cplusplus +extern "C" +#endif +sgx_status_t SGXAPI sgx_read_rand(unsigned char *buf, size_t size); +#endif diff --git a/common/inc/internal/sgx_tcrypto_internal.h b/common/inc/internal/sgx_tcrypto_internal.h new file mode 100644 index 0000000000..666b36125a --- /dev/null +++ b/common/inc/internal/sgx_tcrypto_internal.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_TCRYPTO_INTERNAL_H_ +#define _SGX_TCRYPTO_INTERNAL_H_ + +#include "sgx_tcrypto.h" + +typedef struct _sgx_ec256_dh_shared512_t +{ + uint8_t x[SGX_ECP256_KEY_SIZE]; + uint8_t y[SGX_ECP256_KEY_SIZE]; +} sgx_ec256_dh_shared512_t; + +#ifdef __cplusplus +extern "C" { +#endif + + /* Computes 512-bit DH shared key based on private B key (local) and remote public Ga Key + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system + * sgx_ec256_private_t *p_private_b - Pointer to the local private key + * sgx_ec256_public_t *p_public_ga - Pointer to the remote public key + * Output: sgx_ec256_dh_shared512_t *p_shared_key - Pointer to the 512-bit shared DH key + */ + sgx_status_t SGXAPI sgx_ecc256_compute_shared_dhkey512(sgx_ec256_private_t *p_private_b, + sgx_ec256_public_t *p_public_ga, + sgx_ec256_dh_shared512_t *p_shared_key, + sgx_ecc_state_handle_t ecc_handle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/tae_service_internal.h b/common/inc/internal/tae_service_internal.h new file mode 100644 index 0000000000..948402c2bd --- /dev/null +++ b/common/inc/internal/tae_service_internal.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _TAE_SERVICE_INTERNAL_H_ +#define _TAE_SERVICE_INTERNAL_H_ + +#include +#include "sgx.h" +#include "arch.h" +#include "sgx_tae_service.h" +#include "pse_types.h" + +#pragma pack(push, 1) + +typedef struct _se_ps_sec_prop_desc_internal +{ + uint32_t desc_type; /* Type of this descriptor. Must be 0 */ + sgx_prod_id_t pse_prod_id; /* REPORT(PSE).ProdID */ + sgx_isv_svn_t pse_isvsvn; /* REPORT(PSE).ISVSVN */ + uint32_t pse_miscselect; /* REPORT(PSE).MISC_SELECT */ + uint32_t reserved1; /* For DESC_TYPE=0, MBZ */ + sgx_attributes_t pse_attributes; /* REPORT(PSE).ATTRIBUTES */ + sgx_measurement_t pse_mr_signer; /* REPORT(PSE).MRSIGNER */ + uint32_t reserved2[16]; + /*the following will be provided by PSE from CSE_SEC_PROP */ + cse_sec_prop_t cse_sec_prop; +} se_ps_sec_prop_desc_internal_t; + +se_static_assert(sizeof(se_ps_sec_prop_desc_internal_t) == sizeof(sgx_ps_sec_prop_desc_t)); + +#pragma pack(pop) + +#endif diff --git a/common/inc/internal/thread_data.h b/common/inc/internal/thread_data.h new file mode 100644 index 0000000000..da2bfe7abc --- /dev/null +++ b/common/inc/internal/thread_data.h @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _THREAD_DATA_H_ +#define _THREAD_DATA_H_ + +#include "se_types.h" +#include "se_cdefs.h" + +#ifdef TD_SUPPORT_MULTI_PLATFORM +/* To enable the SignTool to sign both 32/64-bit Enclave for ELF, + * we need to make the struct `thread_data_t' have a consistent + * definition for 32/64-bit compiler. + * + * We achieve it by forcing the compiler to check pre-defined macros + * `RTS_SYSTEM_WORDSIZE' + * + * |--------------------------+-------| + * | RTS_SYSTEM_WORDSIZE = 32 | ELF32 | + * |--------------------------+-------| + * | RTS_SYSTEM_WORDSIZE = 64 | ELF64 | + * + */ +# ifndef RTS_SYSTEM_WORDSIZE +# error RTS_SYSTEM_WORDSIZE should be pre-defined. +# endif + +/* Avoid to use `uintptr_t' in the struct `thread_data_t' and its members. */ +# if RTS_SYSTEM_WORDSIZE == 32 +typedef uint32_t sys_word_t; +# elif RTS_SYSTEM_WORDSIZE == 64 +typedef uint64_t sys_word_t; +# else +# error Invalid value for 'RTS_SYSTEM_WORDSIZE'. +# endif + +#else + +/* For uRTS, there is no need to define the macro 'TD_SUPPORT_MULTI_PLATFORM' */ +typedef size_t sys_word_t; + +/* SE_32 and SE_64 are defined in "se_cdefs.h" */ +# ifdef SE_32 +# define RTS_SYSTEM_WORDSIZE 32 +# elif defined(SE_64) +# define RTS_SYSTEM_WORDSIZE 64 +# else +# error Unknown system word size. +# endif + +#endif /* ! TD_SUPPORT_MULTI_PLATFORM */ + +/* The data structure currently is naturally aligned regardless of the value of + * RTS_SYSTEM_WORDSIZE. + * + * However, we need to take care when modifying the data structure in future. + */ + +typedef struct _thread_data_t +{ + sys_word_t self_addr; + sys_word_t last_sp; /* set by urts, relative to TCS */ + sys_word_t stack_base_addr; /* set by urts, relative to TCS */ + sys_word_t stack_limit_addr; /* set by urts, relative to TCS */ + sys_word_t first_ssa_gpr; /* set by urts, relative to TCS */ + sys_word_t stack_guard; /* GCC expects start_guard at 0x14 on x86 and 0x28 on x64 */ + + sys_word_t reserved; + sys_word_t ssa_frame_size; /* set by urts, in pages (se_ptrace.c needs to know its offset). */ + sys_word_t last_error; /* init to be 0. Used by trts. */ + +#ifdef TD_SUPPORT_MULTI_PLATFORM + sys_word_t m_next; /* next TD used by trusted thread library (of type "struct _thread_data *") */ +#else + struct _thread_data_t *m_next; +#endif + sys_word_t tls_addr; /* points to TLS pages */ + sys_word_t tls_array; /* points to TD.tls_addr relative to TCS */ +#ifdef TD_SUPPORT_MULTI_PLATFORM + sys_word_t exception_flag; /* mark how many exceptions are being handled */ +#else + intptr_t exception_flag; +#endif + sys_word_t cxx_thread_info[6]; +} thread_data_t; + +#ifdef __cplusplus +extern "C" { +#endif + +thread_data_t *get_thread_data(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/trts_inst.h b/common/inc/internal/trts_inst.h new file mode 100644 index 0000000000..09ed8ae9f5 --- /dev/null +++ b/common/inc/internal/trts_inst.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _TRTS_INST_H_ +#define _TRTS_INST_H_ + +#include "sgx.h" + +/* Attention: + * if the following alignment requirement changes, go to selib to + * review the memory allocation of sgx_create_report and sgx_get_key. + */ +#define TARGET_INFO_ALIGN_SIZE 512 +#define REPORT_DATA_ALIGN_SIZE 128 +#define REPORT_ALIGN_SIZE 512 +#define KEY_REQUEST_ALIGN_SIZE 512 +#define KEY_ALIGN_SIZE 16 + +#define BIT_ERROR(x) (1 << (x)) + +typedef enum _egetkey_status_t +{ + EGETKEY_SUCCESS = 0, + EGETKEY_INVALID_ATTRIBUTE = BIT_ERROR(1), + EGETKEY_INVALID_CPUSVN = BIT_ERROR(5), + EGETKEY_INVALID_ISVSVN = BIT_ERROR(6), + EGETKEY_INVALID_KEYNAME = BIT_ERROR(8), +} egetkey_status_t; + +#ifdef __cplusplus +extern "C" { +#endif + +void do_ereport(const sgx_target_info_t *target_info, const sgx_report_data_t *report_data, sgx_report_t *report); +int do_egetkey(const sgx_key_request_t *key_request, sgx_key_128bit_t *key); +uint32_t do_rdrand(uint32_t *rand); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/uae_service_internal.h b/common/inc/internal/uae_service_internal.h new file mode 100644 index 0000000000..75428cadef --- /dev/null +++ b/common/inc/internal/uae_service_internal.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _UAE_SERVICE_INTERNAL_H_ +#define _UAE_SERVICE_INTERNAL_H_ + +#include +#include "arch.h" +#include "sgx_urts.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * Function to get launch token of a enclave + * + * @param signature[in] Signature of enclave to be launched. + * @param attribute[in] Attribute of enclave to be launched. + * @param launch_token[out] Vontains launch token. + * @return if a launch token is generated,return SGX_SCCUESS, otherwise return general error code SGX_ERROR_SERVICE_UNAVAILABLE + * SGX_ERROR_SERVICE_TIMEOUT, or SGX_ERROR_SERVICE_INVALID_PRIVILEGE, SGX_ERROR_INVALID_PARAMETER + * to indicate special error condition. + */ +sgx_status_t SGXAPI get_launch_token(const enclave_css_t* signature, const sgx_attributes_t* attribute, sgx_launch_token_t* launch_token); + +/* Return SGX_SUCCESS on success */ +sgx_status_t create_session_ocall(uint32_t* sid, uint8_t* dh_msg1, uint32_t dh_msg1_size, uint32_t timeout); + +/* Return SGX_SUCCESS on success */ +sgx_status_t exchange_report_ocall(uint32_t sid, const uint8_t* dh_msg2, uint32_t dh_msg2_size, uint8_t* dh_msg3, uint32_t dh_msg3_size, uint32_t timeout); + +/* Return SGX_SUCCESS on success */ +sgx_status_t close_session_ocall(uint32_t sid, uint32_t timeout); + +/* Return SGX_SUCCESS on success */ +sgx_status_t invoke_service_ocall( + const uint8_t* pse_message_req, uint32_t pse_message_req_size, + uint8_t* pse_message_resp, uint32_t pse_message_resp_size, + uint32_t timeout + ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/internal/uncopyable.h b/common/inc/internal/uncopyable.h new file mode 100644 index 0000000000..b271953f79 --- /dev/null +++ b/common/inc/internal/uncopyable.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _UNCOPYABLE_H_ +#define _UNCOPYABLE_H_ + +/* Similiar to boost::noncopyable */ +class Uncopyable { +protected: + Uncopyable() {} + ~Uncopyable() {} + +private: + /* Disable copying */ + Uncopyable(const Uncopyable&); + Uncopyable& operator=(const Uncopyable&); +}; + +#endif diff --git a/common/inc/internal/util.h b/common/inc/internal/util.h new file mode 100644 index 0000000000..d26b2d9d10 --- /dev/null +++ b/common/inc/internal/util.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include "arch.h" +#include + +#ifdef __cplusplus +#define GET_PTR(t, p, offset) reinterpret_cast( reinterpret_cast(p) + static_cast(offset) ) +#define PTR_DIFF(p1, p2) ((reinterpret_cast(p1) - reinterpret_cast(p2))) +#else +#define GET_PTR(t, p, offset) (t*)( (size_t)(p) + (size_t)(offset) ) +#define PTR_DIFF(p1, p2) ((size_t)(p1) - (size_t)(p2)) +#endif + +#define DIFF(p1, p2) (assert((size_t)(p1) >= (size_t)(p2)), ((size_t)(p1) - (size_t)(p2))) +#define DIFF64(p1, p2) (assert((uint64_t)(p1) >= (uint64_t)(p2)), ((uint64_t)(p1) - (uint64_t)(p2))) + +#define SE_PAGE_SHIFT 12 +#define SE_BULK_PAGE_FRAME_SHIFT 4 +#define SE_BULK_PAGE_FRAME_SIZE (1 << SE_BULK_PAGE_FRAME_SHIFT) +#define SE_BULK_PAGE_FRAME_MASK (SE_BULK_PAGE_FRAME_SIZE-1) +#define SE_BULK_PAGE_SHIFT (SE_PAGE_SHIFT + SE_BULK_PAGE_FRAME_SHIFT) +#define SE_BULK_PAGE_SIZE (1 << SE_BULK_PAGE_SHIFT) +#define SE_GUARD_PAGE_SHIFT SE_PAGE_SHIFT +#define SE_GUARD_PAGE_SIZE SE_PAGE_SIZE + +#define ROUND_TO(x, align) (((x) + ((align)-1)) & ~((align)-1)) +#define ROUND_TO_PAGE(x) ROUND_TO(x, SE_PAGE_SIZE) +#define TRIM_TO_PAGE(x) ((x) & ~(SE_PAGE_SIZE-1)) +#ifdef __cplusplus +#define PAGE_ALIGN(t, x) reinterpret_cast((reinterpret_cast(x)+(SE_PAGE_SIZE-1)) & (~(SE_PAGE_SIZE-1))) +#else +#define PAGE_ALIGN(t, x) (t*)( ((size_t)(x)+(SE_PAGE_SIZE-1)) & (~(SE_PAGE_SIZE-1)) ) +#endif + +#define IS_PAGE_ALIGNED(x) (!((size_t)(x)&(SE_PAGE_SIZE-1))) + +#define MIN(x, y) (((x)>(y))?(y):(x)) +#define MAX(x, y) (((x)>(y))?(x):(y)) +#define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) + +/* used to eliminate `unused variable' warning */ +#define UNUSED(val) (void)(val) + +#include +#define container_of(ptr, type, member) (type *)( (char *)(ptr) - offsetof(type,member) ) + +#endif diff --git a/common/inc/internal/xsave.h b/common/inc/internal/xsave.h new file mode 100644 index 0000000000..431d453542 --- /dev/null +++ b/common/inc/internal/xsave.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _XSAVE_H_ +#define _XSAVE_H_ + +#include "se_types.h" + + +#define XSAVE_ALIGN_SIZE 64 +#define FXSAVE_ALIGN_SIZE 16 +#define FXSAVE_SIZE 528 +/* 512 + 16, the alignment is handled in internal functions */ + +#define CLEAN_XFEATURE_REGS save_and_clean_xfeature_regs(NULL); + +#ifdef __cplusplus +extern "C" { +#endif + +#include "linux/xsave_gnu.h" + +/* implemented in urts_xsave.cpp/trts_xsave.cpp */ +void save_and_clean_xfeature_regs(uint8_t *buffer); +void restore_xfeature_regs(const uint8_t *buffer); + +/* trts_xsave.cpp */ +uint64_t get_xfeature_state(); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx.h b/common/inc/sgx.h new file mode 100644 index 0000000000..7695c65d04 --- /dev/null +++ b/common/inc/sgx.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_H_ +#define _SGX_H_ + +#include "sgx_error.h" +#include "sgx_attributes.h" +#include "sgx_key.h" +#include "sgx_report.h" + +#endif diff --git a/common/inc/sgx_attributes.h b/common/inc/sgx_attributes.h new file mode 100644 index 0000000000..398621e5b0 --- /dev/null +++ b/common/inc/sgx_attributes.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_ATTRIBUTES_H_ +#define _SGX_ATTRIBUTES_H_ + +#include + +/* Enclave Flags Bit Masks */ +#define SGX_FLAGS_INITTED 0x0000000000000001ULL /* If set, then the enclave is initialized */ +#define SGX_FLAGS_DEBUG 0x0000000000000002ULL /* If set, then the enclave is debug */ +#define SGX_FLAGS_MODE64BIT 0x0000000000000004ULL /* If set, then the enclave is 64 bit */ +#define SGX_FLAGS_PROVISION_KEY 0x0000000000000010ULL /* If set, then the enclave has access to provision key */ +#define SGX_FLAGS_LICENSE_KEY 0x0000000000000020ULL /* If set, then the enclave has access to License key */ +#define SGX_FLAGS_RESERVED (~(SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG | SGX_FLAGS_MODE64BIT | SGX_FLAGS_PROVISION_KEY | SGX_FLAGS_LICENSE_KEY)) + +/* XSAVE Feature Request Mask */ +#define SGX_XFRM_LEGACY 0x0000000000000003ULL /* Legacy XFRM */ +#define SGX_XFRM_AVX 0x0000000000000006ULL /* AVX */ +#define SGX_XFRM_AVX512 0x00000000000000E6ULL /* AVX-512 - not supported */ +#define SGX_XFRM_MPX 0x0000000000000018ULL /* MPX - not supported */ + +#define SGX_XFRM_RESERVED (~(SGX_XFRM_LEGACY | SGX_XFRM_AVX)) + +typedef struct _attributes_t +{ + uint64_t flags; + uint64_t xfrm; +} sgx_attributes_t; + +/* define MISCSELECT - all bits are currently reserved */ +typedef uint32_t sgx_misc_select_t; + +typedef struct _sgx_misc_attribute_t { + sgx_attributes_t secs_attr; + sgx_misc_select_t misc_select; +} sgx_misc_attribute_t; + +#endif/* _SGX_ATTRIBUTES_H_ */ diff --git a/common/inc/sgx_cpuid.h b/common/inc/sgx_cpuid.h new file mode 100644 index 0000000000..2d4221280b --- /dev/null +++ b/common/inc/sgx_cpuid.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * File: sgx_cpuid.h + * Description: + * Enquire CPU capabilities via OCALLs. + */ + +#ifndef _SGX_CPUID_H_ +#define _SGX_CPUID_H_ + +#include "sgx_defs.h" +#include "sgx_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +sgx_status_t SGXAPI sgx_cpuid(int cpuinfo[4], int leaf); +sgx_status_t SGXAPI sgx_cpuidex(int cpuinfo[4], int leaf, int subleaf); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_defs.h b/common/inc/sgx_defs.h new file mode 100644 index 0000000000..4b0a658283 --- /dev/null +++ b/common/inc/sgx_defs.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_DEFS_H_ +#define _SGX_DEFS_H_ + +/* The following macros are for GCC only */ + +# define SGXAPI + +# ifdef linux +# undef linux +# endif +# define SGX_CXX_NATIVE_HEADER(header) + +# define SGX_CDECL +# define SGX_STDCALL +# define SGX_FASTCALL + +# define SGX_DLLIMPORT +# define SGX_UBRIDGE(attr, fname, args...) attr fname args + + +#define SGX_NOCONVENTION /* Empty. No calling convention specified. */ + +#endif /* !_SGX_DEFS_H_ */ diff --git a/common/inc/sgx_dh.h b/common/inc/sgx_dh.h new file mode 100644 index 0000000000..9860271a0b --- /dev/null +++ b/common/inc/sgx_dh.h @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SGX_DH_H_ +#define _SGX_DH_H_ + +#include "sgx.h" +#include "sgx_defs.h" +#include "sgx_ecp_types.h" + +#pragma pack(push, 1) + +#define SGX_DH_MAC_SIZE 16 + +#define SGX_DH_SESSION_DATA_SIZE 200 + +typedef struct _sgx_dh_msg1_t +{ + sgx_ec256_public_t g_a; /* the Endian-ness of Ga is Little-Endian */ + sgx_target_info_t target; +} sgx_dh_msg1_t; + +typedef struct _sgx_dh_msg2_t +{ + sgx_ec256_public_t g_b; /* the Endian-ness of Gb is Little-Endian */ + sgx_report_t report; + uint8_t cmac[SGX_DH_MAC_SIZE]; +} sgx_dh_msg2_t; + +typedef struct _sgx_dh_msg3_body_t +{ + sgx_report_t report; + uint32_t additional_prop_length; + uint8_t additional_prop[0]; +} sgx_dh_msg3_body_t; + + +typedef struct _sgx_dh_msg3_t +{ + uint8_t cmac[SGX_DH_MAC_SIZE]; + sgx_dh_msg3_body_t msg3_body; +} sgx_dh_msg3_t; + +typedef struct _sgx_dh_session_enclave_identity_t +{ + sgx_cpu_svn_t cpu_svn; + sgx_misc_select_t misc_select; + uint8_t reserved_1[28]; + sgx_attributes_t attributes; + sgx_measurement_t mr_enclave; + uint8_t reserved_2[32]; + sgx_measurement_t mr_signer; + uint8_t reserved_3[96]; + sgx_prod_id_t isv_prod_id; + sgx_isv_svn_t isv_svn; +} sgx_dh_session_enclave_identity_t; + +typedef enum _sgx_dh_session_role_t +{ + SGX_DH_SESSION_INITIATOR, + SGX_DH_SESSION_RESPONDER +} sgx_dh_session_role_t; + +typedef struct _sgx_dh_session_t +{ + uint8_t sgx_dh_session[SGX_DH_SESSION_DATA_SIZE]; +} sgx_dh_session_t; +#pragma pack(pop) +#ifdef __cplusplus +extern "C" { +#endif + +/* The order of calling SGX DH Library APIs is restricted as below */ +/* As session initiator : Step.1 sgx_dh_init_session --> Step.2 sgx_dh_initiator_proc_msg1 --> Step.3 sgx_dh_initiator_proc_msg3 */ +/* As session responder : Step.1 sgx_dh_init_session --> Step.2 sgx_dh_responder_gen_msg1 --> Step.3 sgx_dh_responder_proc_msg2*/ +/* Any out of order calling will cause session establishment failure. */ + +/*Function name: sgx_dh_init_session +** parameter description +**@ [input] role: caller's role in dh session establishment +**@ [output] session: point to dh session structure that is used during establishment, the buffer must be in enclave address space +*/ +sgx_status_t SGXAPI sgx_dh_init_session(sgx_dh_session_role_t role, + sgx_dh_session_t* session); +/*Function name: sgx_dh_responder_gen_msg1 +** parameter description +**@ [output] msg1: point to dh message 1 buffer, and the buffer must be in enclave address space +**@ [input/output] dh_session: point to dh session structure that is used during establishment, and the buffer must be in enclave address space +*/ +sgx_status_t SGXAPI sgx_dh_responder_gen_msg1(sgx_dh_msg1_t* msg1, + sgx_dh_session_t* dh_session); +/*Function name: sgx_dh_initiator_proc_msg1 +** parameter description +**@ [input] msg1: point to dh message 1 buffer generated by session responder, and the buffer must be in enclave address space +**@ [output] msg2: point to dh message 2 buffer, and the buffer must be in enclave address space +**@ [input/output] dh_session: point to dh session structure that is used during establishment, and the buffer must be in enclave address space +*/ +sgx_status_t SGXAPI sgx_dh_initiator_proc_msg1(const sgx_dh_msg1_t* msg1, + sgx_dh_msg2_t* msg2, + sgx_dh_session_t* dh_session); +/*Function name: sgx_dh_responder_proc_msg2 +** parameter description +**@ [input] msg2: point to dh message 2 buffer generated by session initiator, and the buffer must be in enclave address space +**@ [output] msg3: point to dh message 3 buffer generated by session responder in this function, and the buffer must be in enclave address space +**@ [input/output] dh_session: point to dh session structure that is used during establishment, and the buffer must be in enclave address space +**@ [output] aek: AEK derived from shared key. the buffer must be in enclave address space. +**@ [output] initiator_identity: identity information of initiator including isv svn, isv product id, sgx attributes, mr signer, and mr enclave. the buffer must be in enclave address space. +*/ +sgx_status_t SGXAPI sgx_dh_responder_proc_msg2(const sgx_dh_msg2_t* msg2, + sgx_dh_msg3_t* msg3, + sgx_dh_session_t* dh_session, + sgx_key_128bit_t* aek, + sgx_dh_session_enclave_identity_t* initiator_identity); +/*Function name: sgx_dh_initiator_proc_msg3 +** parameter description +**@ [input] msg3: point to dh message 3 buffer generated by session responder, and the buffer must be in enclave address space +**@ [input/output] dh_session: point to dh session structure that is used during establishment, and the buffer must be in enclave address space +**@ [output] aek: AEK derived from shared key. the buffer must be in enclave address space. +**@ [output] responder_identity: identity information of responder including isv svn, isv product id, sgx attributes, mr signer, and mr enclave. the buffer must be in enclave address space. +*/ +sgx_status_t SGXAPI sgx_dh_initiator_proc_msg3(const sgx_dh_msg3_t* msg3, + sgx_dh_session_t* dh_session, + sgx_key_128bit_t* aek, + sgx_dh_session_enclave_identity_t* responder_identity); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/common/inc/sgx_ecp_types.h b/common/inc/sgx_ecp_types.h new file mode 100644 index 0000000000..ef935d103b --- /dev/null +++ b/common/inc/sgx_ecp_types.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SGX_ECP_TYPES_H_ +#define _SGX_ECP_TYPES_H_ + +#include + +#pragma pack(push, 1) + +#include "sgx_tcrypto.h" + +#ifndef SGX_FEBITSIZE +#define SGX_FEBITSIZE 256 +#endif + +typedef struct _ecc_param_t +{ + uint32_t eccP[SGX_NISTP_ECP256_KEY_SIZE]; /* EC prime field */ + uint32_t eccA[SGX_NISTP_ECP256_KEY_SIZE]; /* EC curve coefficient A */ + uint32_t eccB[SGX_NISTP_ECP256_KEY_SIZE]; /* EC curve coefficient B */ + uint32_t eccG[2][SGX_NISTP_ECP256_KEY_SIZE]; /* ECC base point */ + uint32_t eccR[SGX_NISTP_ECP256_KEY_SIZE]; /* ECC base point order */ +} sgx_ecc_param_t; + +typedef uint8_t sgx_ec_key_128bit_t[SGX_CMAC_KEY_SIZE]; + +#pragma pack(pop) + +#endif diff --git a/common/inc/sgx_edger8r.h b/common/inc/sgx_edger8r.h new file mode 100644 index 0000000000..f3da7873df --- /dev/null +++ b/common/inc/sgx_edger8r.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/* + * Here contains functions intended to be used by `sgx_edger8r' only. + * + * ------------------------------------- + * Be warned: use them at your own risk. + * ------------------------------------- + * + */ + +#ifndef _SGX_EDGER8R_H_ +#define _SGX_EDGER8R_H_ + +#include "sgx_defs.h" +#include "sgx_error.h" +#include "sgx_eid.h" +#include /* for size_t */ + +/* The `sgx_edger8r' tool will generate C interfaces. */ +#ifdef __cplusplus +# define SGX_EXTERNC extern "C" +#else +# define SGX_EXTERNC +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* sgx_ocalloc() + * Parameters: + * size - bytes to allocate on the outside stack + * Return Value: + * the pointer to the allocated space on the outside stack + * NULL - fail to allocate +*/ +void* SGXAPI sgx_ocalloc(size_t size); + +/* sgx_ocfree() + * Parameters: + * N/A + * Return Value: + * N/A +*/ +void SGXAPI sgx_ocfree(void); + +/* sgx_ecall() + * Parameters: + * eid - the enclave id + * index - the index of the trusted function + * ocall_table - the address of the OCALL table + * ms - the pointer to the marshaling struct + * Return Value: + * SGX_SUCCESS on success +*/ +sgx_status_t SGXAPI sgx_ecall(const sgx_enclave_id_t eid, + const int index, + const void* ocall_table, + void* ms); + +/* sgx_ocall() + * Parameters: + * index - the index of the untrusted function + * ms - the pointer to the marshaling struct + * Return Value: + * SGX_SUCCESS on success +*/ +sgx_status_t SGXAPI sgx_ocall(const unsigned int index, + void* ms); + +#ifdef __cplusplus +} +#endif + +#endif /* !_SGX_EDGER8R_H_ */ diff --git a/common/inc/sgx_eid.h b/common/inc/sgx_eid.h new file mode 100644 index 0000000000..ea2dfc6e28 --- /dev/null +++ b/common/inc/sgx_eid.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_EID_H_ +#define _SGX_EID_H_ + +#include + +typedef uint64_t sgx_enclave_id_t; + +#endif diff --git a/common/inc/sgx_error.h b/common/inc/sgx_error.h new file mode 100644 index 0000000000..d093fd8a1e --- /dev/null +++ b/common/inc/sgx_error.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_ERROR_H_ +#define _SGX_ERROR_H_ + +#define SGX_MK_ERROR(x) (0x00000000|(x)) + +typedef enum _status_t +{ + SGX_SUCCESS = SGX_MK_ERROR(0x0000), + + SGX_ERROR_UNEXPECTED = SGX_MK_ERROR(0x0001), /* Unexpected error */ + SGX_ERROR_INVALID_PARAMETER = SGX_MK_ERROR(0x0002), /* The parameter is incorrect */ + SGX_ERROR_OUT_OF_MEMORY = SGX_MK_ERROR(0x0003), /* Not enough memory is available to complete this operation */ + SGX_ERROR_ENCLAVE_LOST = SGX_MK_ERROR(0x0004), /* Enclave lost after power transition or used in child process created by linux:fork() */ + SGX_ERROR_INVALID_STATE = SGX_MK_ERROR(0x0005), /* SGX API is invoked in incorrect order or state */ + + SGX_ERROR_INVALID_FUNCTION = SGX_MK_ERROR(0x1001), /* The ecall/ocall index is invalid */ + SGX_ERROR_OUT_OF_TCS = SGX_MK_ERROR(0x1003), /* The enclave is out of TCS */ + SGX_ERROR_ENCLAVE_CRASHED = SGX_MK_ERROR(0x1006), /* The enclave is crashed */ + SGX_ERROR_ECALL_NOT_ALLOWED = SGX_MK_ERROR(0x1007), /* The ECALL is not allowed at this time, e.g. ecall is blocked by the dynamic entry table, or nested ecall is not allowed during initialization */ + SGX_ERROR_OCALL_NOT_ALLOWED = SGX_MK_ERROR(0x1008), /* The OCALL is not allowed at this time, e.g. ocall is not allowed during exception handling */ + SGX_ERROR_STACK_OVERRUN = SGX_MK_ERROR(0x1009), /* The enclave is running out of stack */ + + SGX_ERROR_UNDEFINED_SYMBOL = SGX_MK_ERROR(0x2000), /* The enclave image has undefined symbol. */ + SGX_ERROR_INVALID_ENCLAVE = SGX_MK_ERROR(0x2001), /* The enclave image is not correct. */ + SGX_ERROR_INVALID_ENCLAVE_ID = SGX_MK_ERROR(0x2002), /* The enclave id is invalid */ + SGX_ERROR_INVALID_SIGNATURE = SGX_MK_ERROR(0x2003), /* The signature is invalid */ + SGX_ERROR_NDEBUG_ENCLAVE = SGX_MK_ERROR(0x2004), /* The enclave is signed as product enclave, and can not be created as debuggable enclave. */ + SGX_ERROR_OUT_OF_EPC = SGX_MK_ERROR(0x2005), /* Not enough EPC is available to load the enclave */ + SGX_ERROR_NO_DEVICE = SGX_MK_ERROR(0x2006), /* Can't open SGX device */ + SGX_ERROR_MEMORY_MAP_CONFLICT= SGX_MK_ERROR(0x2007), /* Page mapping failed in driver */ + SGX_ERROR_INVALID_METADATA = SGX_MK_ERROR(0x2009), /* The metadata is incorrect. */ + SGX_ERROR_DEVICE_BUSY = SGX_MK_ERROR(0x200c), /* Device is busy, mostly EINIT failed. */ + SGX_ERROR_INVALID_VERSION = SGX_MK_ERROR(0x200d), /* Metadata version is inconsistent between uRTS and sgx_sign or uRTS is incompatible with current platform. */ + SGX_ERROR_MODE_INCOMPATIBLE = SGX_MK_ERROR(0x200e), /* The target enclave 32/64 bit mode or sim/hw mode is incompatible with the mode of current uRTS. */ + SGX_ERROR_ENCLAVE_FILE_ACCESS = SGX_MK_ERROR(0x200f), /* Can't open enclave file. */ + SGX_ERROR_INVALID_MISC = SGX_MK_ERROR(0x2010), /* The MiscSelct/MiscMask settings are not correct.*/ + + SGX_ERROR_MAC_MISMATCH = SGX_MK_ERROR(0x3001), /* Indicates verification error for reports, sealed datas, etc */ + SGX_ERROR_INVALID_ATTRIBUTE = SGX_MK_ERROR(0x3002), /* The enclave is not authorized */ + SGX_ERROR_INVALID_CPUSVN = SGX_MK_ERROR(0x3003), /* The cpu svn is beyond platform's cpu svn value */ + SGX_ERROR_INVALID_ISVSVN = SGX_MK_ERROR(0x3004), /* The isv svn is greater than the enclave's isv svn */ + SGX_ERROR_INVALID_KEYNAME = SGX_MK_ERROR(0x3005), /* The key name is an unsupported value */ + + SGX_ERROR_SERVICE_UNAVAILABLE = SGX_MK_ERROR(0x4001), /* Indicates aesm didn't response or the requested service is not supported */ + SGX_ERROR_SERVICE_TIMEOUT = SGX_MK_ERROR(0x4002), /* The request to aesm time out */ + SGX_ERROR_AE_INVALID_EPIDBLOB = SGX_MK_ERROR(0x4003), /* Indicates epid blob verification error */ + SGX_ERROR_SERVICE_INVALID_PRIVILEGE = SGX_MK_ERROR(0x4004), /* Enclave has no privilege to get launch token */ + SGX_ERROR_EPID_MEMBER_REVOKED = SGX_MK_ERROR(0x4005), /* The EPID group membership is revoked. */ + SGX_ERROR_UPDATE_NEEDED = SGX_MK_ERROR(0x4006), /* SGX needs to be updated */ + SGX_ERROR_NETWORK_FAILURE = SGX_MK_ERROR(0x4007), /* Network connecting or proxy setting issue is encountered */ + SGX_ERROR_AE_SESSION_INVALID = SGX_MK_ERROR(0x4008), /* Session is invalid or ended by server */ + SGX_ERROR_BUSY = SGX_MK_ERROR(0x400a), /* The requested service is temporarily not availabe */ + SGX_ERROR_MC_NOT_FOUND = SGX_MK_ERROR(0x400c), /* The Monotonic Counter doesn't exist or has been invalided */ + SGX_ERROR_MC_NO_ACCESS_RIGHT = SGX_MK_ERROR(0x400d), /* Caller doesn't have the access right to specified VMC */ + SGX_ERROR_MC_USED_UP = SGX_MK_ERROR(0x400e), /* Monotonic counters are used out */ + SGX_ERROR_MC_OVER_QUOTA = SGX_MK_ERROR(0x400f), /* Monotonic counters exceeds quota limitation */ + SGX_ERROR_KDF_MISMATCH = SGX_MK_ERROR(0x4011), /* Key derivation function doesn't match during key exchange */ + +} sgx_status_t; + +#endif diff --git a/common/inc/sgx_intrin.h b/common/inc/sgx_intrin.h new file mode 100644 index 0000000000..237a1cd6f1 --- /dev/null +++ b/common/inc/sgx_intrin.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SGX_INTRIN_H_ +#define _SGX_INTRIN_H_ + +#if defined(__STDC__) || defined(__cplusplus) +# define __STRING(x) #x +#else +# define __STRING(x) "x" +#endif + +#define _DEPR_MESSAGE(func) __STRING(func)" is deprecated in enclave." + +/* Deprecated GCC Built-ins */ + +# include + +/*#pragma GCC diagnostic error "-Wdeprecated-declarations" */ +#define _SGX_DEPRECATED(__ret_type, __func_name, ...) \ + __attribute__((deprecated(_DEPR_MESSAGE(__func_name)))) \ + __ret_type __func_name(__VA_ARGS__) + +_SGX_DEPRECATED(void, _writefsbase_u32, unsigned int); +_SGX_DEPRECATED(void, _writefsbase_u64, unsigned long long); +_SGX_DEPRECATED(void, _writegsbase_u32, unsigned int); +_SGX_DEPRECATED(void, _writegsbase_u64, unsigned long long); + +_SGX_DEPRECATED(unsigned long long, __rdpmc, int); +_SGX_DEPRECATED(unsigned long long, __rdtsc, void); +_SGX_DEPRECATED(unsigned long long, __rdtscp, unsigned int *); + + +#endif /* _SGX_INTRIN_H_ */ diff --git a/common/inc/sgx_key.h b/common/inc/sgx_key.h new file mode 100644 index 0000000000..7e040fb64c --- /dev/null +++ b/common/inc/sgx_key.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + +/* + * This file is to define Enclave's keys +*/ + +#ifndef _SGX_KEY_H_ +#define _SGX_KEY_H_ + +#include +#include "sgx_attributes.h" + +/* Key Name */ +#define SGX_KEYSELECT_LICENSE 0x0000 +#define SGX_KEYSELECT_PROVISION 0x0001 +#define SGX_KEYSELECT_PROVISION_SEAL 0x0002 +#define SGX_KEYSELECT_REPORT 0x0003 +#define SGX_KEYSELECT_SEAL 0x0004 + +/* Key Policy */ +#define SGX_KEYPOLICY_MRENCLAVE 0x0001 /* Derive key using the enclave's ENCLAVE measurement register */ +#define SGX_KEYPOLICY_MRSIGNER 0x0002 /* Derive key using the enclave's SINGER measurement register */ + +#define SGX_KEYID_SIZE 32 +#define SGX_CPUSVN_SIZE 16 + +typedef uint8_t sgx_key_128bit_t[16]; +typedef uint16_t sgx_isv_svn_t; + +typedef struct _sgx_cpu_svn_t +{ + uint8_t svn[SGX_CPUSVN_SIZE]; +} sgx_cpu_svn_t; + +typedef struct _sgx_key_id_t +{ + uint8_t id[SGX_KEYID_SIZE]; +} sgx_key_id_t; + +#define SGX_KEY_REQUEST_RESERVED2_BYTES 436 + +typedef struct _key_request_t +{ + uint16_t key_name; /* Identifies the key required */ + uint16_t key_policy; /* Identifies which inputs should be used in the key derivation */ + sgx_isv_svn_t isv_svn; /* Security Version of the Enclave */ + uint16_t reserved1; /* Must be 0 */ + sgx_cpu_svn_t cpu_svn; /* Security Version of the CPU */ + sgx_attributes_t attribute_mask; /* Mask which ATTRIBUTES Seal keys should be bound to */ + sgx_key_id_t key_id; /* Value for key wear-out protection */ + sgx_misc_select_t misc_mask; /* Mask what MISCSELECT Seal keys bound to */ + uint8_t reserved2[SGX_KEY_REQUEST_RESERVED2_BYTES]; /* Struct size is 512 bytes */ +} sgx_key_request_t; + + +#endif diff --git a/common/inc/sgx_key_exchange.h b/common/inc/sgx_key_exchange.h new file mode 100644 index 0000000000..570945f013 --- /dev/null +++ b/common/inc/sgx_key_exchange.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_KEY_EXCHANGE_H_ +#define _SGX_KEY_EXCHANGE_H_ + +#include +#include "sgx_quote.h" +#include "sgx_ecp_types.h" +#include "sgx_tae_service.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint32_t sgx_ra_context_t; + +typedef sgx_key_128bit_t sgx_ra_key_128_t; + +typedef enum _ra_key_type_t +{ + SGX_RA_KEY_SK = 1, + SGX_RA_KEY_MK, + SGX_RA_KEY_VK, +} sgx_ra_key_type_t; + +typedef struct _ra_msg1_t +{ + sgx_ec256_public_t g_a; /* the Endian-ness of Ga is Little-Endian */ + sgx_epid_group_id_t gid; /* the Endian-ness of GID is Little-Endian */ +} sgx_ra_msg1_t; + + +typedef struct _ra_msg2_t +{ + sgx_ec256_public_t g_b; /* the Endian-ness of Gb is Little-Endian */ + sgx_spid_t spid; + uint16_t quote_type; /* unlinkable Quote(0) or linkable Quote(1) in little endian*/ + uint16_t kdf_id; /* key derivation function id in little endian. */ + sgx_ec256_signature_t sign_gb_ga; /* In little endian */ + sgx_mac_t mac; /* mac_smk(g_b||spid||quote_type||kdf_id||sign_gb_ga) */ + uint32_t sig_rl_size; + uint8_t sig_rl[]; +} sgx_ra_msg2_t; + +typedef struct _ra_msg3_t +{ + sgx_mac_t mac; /* mac_smk(g_a||ps_sec_prop||quote) */ + sgx_ec256_public_t g_a; /* the Endian-ness of Ga is Little-Endian */ + sgx_ps_sec_prop_desc_t ps_sec_prop; + uint8_t quote[]; +} sgx_ra_msg3_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_quote.h b/common/inc/sgx_quote.h new file mode 100644 index 0000000000..06a6ae6c60 --- /dev/null +++ b/common/inc/sgx_quote.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + /** + * File: sgx_quote.h + * Description: Definition for quote structure. + * + * Quote structure and all relative structure will be defined in this file. + */ + +#ifndef _SGX_QUOTE_H_ +#define _SGX_QUOTE_H_ + +#include "sgx_report.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(push, 1) +typedef uint8_t sgx_epid_group_id_t[4]; + +typedef struct _spid_t +{ + uint8_t id[16]; +} sgx_spid_t; + +typedef struct _basename_t +{ + uint8_t name[32]; +} sgx_basename_t; + + +typedef struct _quote_nonce +{ + uint8_t rand[16]; +} sgx_quote_nonce_t; + +typedef enum +{ + SGX_UNLINKABLE_SIGNATURE, + SGX_LINKABLE_SIGNATURE +} sgx_quote_sign_type_t; + +typedef struct _quote_t +{ + uint16_t version; /* 0 */ + uint16_t sign_type; /* 2 */ + sgx_epid_group_id_t epid_group_id; /* 4 */ + sgx_isv_svn_t qe_svn; /* 8 */ + uint8_t reserved[6]; /* 10 */ + sgx_basename_t basename; /* 16 */ + sgx_report_body_t report_body; /* 48 */ + uint32_t signature_len; /* 432 */ + uint8_t signature[]; /* 436 */ +} sgx_quote_t; + +#define SGX_PLATFORM_INFO_SIZE 101 +typedef struct _platform_info +{ + uint8_t platform_info[SGX_PLATFORM_INFO_SIZE]; +} sgx_platform_info_t; + +typedef struct _update_info_bit +{ + int ucodeUpdate; + int csmeFwUpdate; + int pswUpdate; +} sgx_update_info_bit_t; + +#pragma pack(pop) + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/common/inc/sgx_report.h b/common/inc/sgx_report.h new file mode 100644 index 0000000000..8d26087397 --- /dev/null +++ b/common/inc/sgx_report.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/* + * This file is to define Enclave's Report +*/ + +#ifndef _SGX_REPORT_H_ +#define _SGX_REPORT_H_ + +#include "sgx_attributes.h" +#include "sgx_key.h" + +#define SGX_HASH_SIZE 32 /* SHA256 */ +#define SGX_MAC_SIZE 16 /* Message Authentication Code - 16 bytes */ + +#define SGX_REPORT_DATA_SIZE 64 + +typedef struct _sgx_measurement_t +{ + uint8_t m[SGX_HASH_SIZE]; +} sgx_measurement_t; + +typedef uint8_t sgx_mac_t[SGX_MAC_SIZE]; + +typedef struct _sgx_report_data_t +{ + uint8_t d[SGX_REPORT_DATA_SIZE]; +} sgx_report_data_t; + +typedef uint16_t sgx_prod_id_t; + +#define SGX_TARGET_INFO_RESERVED1_BYTES 4 +#define SGX_TARGET_INFO_RESERVED2_BYTES 456 + +typedef struct _targe_info_t +{ + sgx_measurement_t mr_enclave; /* ( 0) The MRENCLAVE of the target enclave */ + sgx_attributes_t attributes; /* ( 32) The ATTRIBUTES field of the target enclave */ + uint8_t reserved1[SGX_TARGET_INFO_RESERVED1_BYTES]; /* ( 48) Reserved */ + sgx_misc_select_t misc_select; /* ( 52) The MISCSELECT of the target enclave */ + uint8_t reserved2[SGX_TARGET_INFO_RESERVED2_BYTES]; /* ( 56) Struct size is 512 bytes */ +} sgx_target_info_t; + +typedef struct _report_body_t +{ + sgx_cpu_svn_t cpu_svn; /* ( 0) Security Version of the CPU */ + sgx_misc_select_t misc_select; /* ( 16) Which fields defined in SSA.MISC */ + uint8_t reserved1[28]; /* ( 20) */ + sgx_attributes_t attributes; /* ( 48) Any special Capabilities the Enclave possess */ + sgx_measurement_t mr_enclave; /* ( 64) The value of the enclave's ENCLAVE measurement */ + uint8_t reserved2[32]; /* ( 96) */ + sgx_measurement_t mr_signer; /* (128) The value of the enclave's SIGNER measurement */ + uint8_t reserved3[96]; /* (160) */ + sgx_prod_id_t isv_prod_id; /* (256) Product ID of the Enclave */ + sgx_isv_svn_t isv_svn; /* (258) Security Version of the Enclave */ + uint8_t reserved4[60]; /* (260) */ + sgx_report_data_t report_data; /* (320) Data provided by the user */ +} sgx_report_body_t; + +typedef struct _report_t /* 432 bytes */ +{ + sgx_report_body_t body; + sgx_key_id_t key_id; /* (384) KeyID used for diversifying the key tree */ + sgx_mac_t mac; /* (416) The Message Authentication Code over this structure. */ +} sgx_report_t; + +#endif diff --git a/common/inc/sgx_sha256_128.h b/common/inc/sgx_sha256_128.h new file mode 100644 index 0000000000..52602d0ec2 --- /dev/null +++ b/common/inc/sgx_sha256_128.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SHA256_128_H +#define _SHA256_128_H + +#include "stdlib.h" +#include "sgx_utils.h" +#include "sgx_tcrypto.h" +#include "math.h" +#include "string.h" + +#define SGX_SHA256_128_HASH_SIZE 16 +typedef uint8_t sgx_sha256_128_hash_t[SGX_SHA256_128_HASH_SIZE]; + +sgx_status_t SGXAPI sgx_sha256_128_msg(const uint8_t *p_src, uint32_t src_len, sgx_sha256_128_hash_t *p_hash); + +#endif diff --git a/common/inc/sgx_spinlock.h b/common/inc/sgx_spinlock.h new file mode 100644 index 0000000000..77d8084856 --- /dev/null +++ b/common/inc/sgx_spinlock.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + + +#ifndef _SGX_SPINLOCK_H_ +#define _SGX_SPINLOCK_H_ + +#include "sgx_defs.h" +#include + +typedef volatile uint32_t sgx_spinlock_t; + +#define SGX_SPINLOCK_INITIALIZER 0 + +#if defined(__cplusplus) +extern "C" { +#endif + +uint32_t SGXAPI sgx_spin_lock(sgx_spinlock_t *lock); +uint32_t SGXAPI sgx_spin_unlock(sgx_spinlock_t *lock); + +#if defined(__cplusplus) +} +#endif + +#endif /* !_SGX_SPINLOCK_H_ */ diff --git a/common/inc/sgx_tae_service.edl b/common/inc/sgx_tae_service.edl new file mode 100644 index 0000000000..9b19a8026b --- /dev/null +++ b/common/inc/sgx_tae_service.edl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave{ + from "sgx_tstdc.edl" import *; + untrusted { + sgx_status_t create_session_ocall([out] uint32_t* sid, + [size = dh_msg1_size, out] uint8_t* dh_msg1, + uint32_t dh_msg1_size, + uint32_t timeout); + + sgx_status_t exchange_report_ocall(uint32_t sid, + [size = dh_msg2_size, in] uint8_t* dh_msg2, uint32_t dh_msg2_size, + [size = dh_msg3_size, out] uint8_t* dh_msg3, uint32_t dh_msg3_size, + uint32_t timeout); + + sgx_status_t close_session_ocall(uint32_t sid, uint32_t timeout); + + sgx_status_t invoke_service_ocall([size = pse_message_req_size, in] uint8_t* pse_message_req, + uint32_t pse_message_req_size, + [size = pse_message_resp_size, out] uint8_t* pse_message_resp, uint32_t pse_message_resp_size, + uint32_t timeout); + }; +}; diff --git a/common/inc/sgx_tae_service.h b/common/inc/sgx_tae_service.h new file mode 100644 index 0000000000..687f230607 --- /dev/null +++ b/common/inc/sgx_tae_service.h @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_TAE_SERVICE_H_ +#define _SGX_TAE_SERVICE_H_ + +/** +* File: +* sgx_tae_service.h +*Description: +* header for trusted AE support library. +* ADD from path/sgx_tae_service.edl import *; to your edl file +* to use sgx_tae_service.lib +*/ + +#include "sgx.h" +#include "sgx_defs.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(push, 1) + +typedef uint64_t sgx_time_t; + +typedef uint8_t sgx_time_source_nonce_t[32]; + +#define SGX_MC_UUID_COUNTER_ID_SIZE 3 +#define SGX_MC_UUID_NONCE_SIZE 13 +typedef struct _mc_uuid { + uint8_t counter_id[SGX_MC_UUID_COUNTER_ID_SIZE]; + uint8_t nonce[SGX_MC_UUID_NONCE_SIZE]; +} sgx_mc_uuid_t; + +/* fixed length to align with internal structure */ +typedef struct _ps_sec_prop_desc +{ + uint8_t sgx_ps_sec_prop_desc[256]; +} sgx_ps_sec_prop_desc_t; + +#pragma pack(pop) + +/* create a session, call it before using Platform Service */ +sgx_status_t SGXAPI sgx_create_pse_session(void); + +/* close a created session, call it after finishing using Platform Service */ +sgx_status_t SGXAPI sgx_close_pse_session(void); + +/* get a data structure describing the Security Property of the Platform Service */ +sgx_status_t SGXAPI sgx_get_ps_sec_prop(sgx_ps_sec_prop_desc_t* security_property); + +/* provides the trusted platform current time */ +sgx_status_t SGXAPI sgx_get_trusted_time( + sgx_time_t* current_time, + sgx_time_source_nonce_t* time_source_nonce + ); + +/* monotonic counter policy */ +#define SGX_MC_POLICY_SIGNER 0x1 +#define SGX_MC_POLICY_ENCLAVE 0x2 +/* create a monotonic counter using given policy(SIGNER 0x1 or ENCLAVE 0x2) and attribute_mask */ +sgx_status_t SGXAPI sgx_create_monotonic_counter_ex( + uint16_t owner_policy, + const sgx_attributes_t* owner_attribute_mask, + sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ); + +/* create a monotonic counter using default policy SIGNER and default attribute_mask */ +sgx_status_t SGXAPI sgx_create_monotonic_counter( + sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ); + +/* destroy a specified monotonic counter */ +sgx_status_t SGXAPI sgx_destroy_monotonic_counter(const sgx_mc_uuid_t* counter_uuid); + +/* increment a specified monotonic counter by 1 */ +sgx_status_t SGXAPI sgx_increment_monotonic_counter( + const sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ); + +/* read a specified monotonic counter */ +sgx_status_t SGXAPI sgx_read_monotonic_counter( + const sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_tcrypto.h b/common/inc/sgx_tcrypto.h new file mode 100644 index 0000000000..8ecf0b32d0 --- /dev/null +++ b/common/inc/sgx_tcrypto.h @@ -0,0 +1,588 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** +* File: sgx_tcrypto.h +* Description: +* Interface for generic crypto library APIs required in SDK implementation. +*/ + +#ifndef _SGX_TCRYPTO_H_ +#define _SGX_TCRYPTO_H_ + +#include "sgx.h" +#include "sgx_defs.h" + +#define SGX_SHA256_HASH_SIZE 32 +#define SGX_ECP256_KEY_SIZE 32 +#define SGX_NISTP_ECP256_KEY_SIZE (SGX_ECP256_KEY_SIZE/sizeof(uint32_t)) +#define SGX_AESGCM_IV_SIZE 12 +#define SGX_AESGCM_KEY_SIZE 16 +#define SGX_AESGCM_MAC_SIZE 16 +#define SGX_CMAC_KEY_SIZE 16 +#define SGX_CMAC_MAC_SIZE 16 +#define SGX_AESCTR_KEY_SIZE 16 + +typedef struct _sgx_ec256_dh_shared_t +{ + uint8_t s[SGX_ECP256_KEY_SIZE]; +} sgx_ec256_dh_shared_t; + +typedef struct _sgx_ec256_private_t +{ + uint8_t r[SGX_ECP256_KEY_SIZE]; +} sgx_ec256_private_t; + +typedef struct _sgx_ec256_public_t +{ + uint8_t gx[SGX_ECP256_KEY_SIZE]; + uint8_t gy[SGX_ECP256_KEY_SIZE]; +} sgx_ec256_public_t; + +typedef struct _sgx_ec256_signature_t +{ + uint32_t x[SGX_NISTP_ECP256_KEY_SIZE]; + uint32_t y[SGX_NISTP_ECP256_KEY_SIZE]; +} sgx_ec256_signature_t; + +typedef void* sgx_sha_state_handle_t; +typedef void* sgx_cmac_state_handle_t; +typedef void* sgx_ecc_state_handle_t; + +typedef uint8_t sgx_sha256_hash_t[SGX_SHA256_HASH_SIZE]; + +typedef uint8_t sgx_aes_gcm_128bit_key_t[SGX_AESGCM_KEY_SIZE]; +typedef uint8_t sgx_aes_gcm_128bit_tag_t[SGX_AESGCM_MAC_SIZE]; +typedef uint8_t sgx_cmac_128bit_key_t[SGX_CMAC_KEY_SIZE]; +typedef uint8_t sgx_cmac_128bit_tag_t[SGX_CMAC_MAC_SIZE]; +typedef uint8_t sgx_aes_ctr_128bit_key_t[SGX_AESCTR_KEY_SIZE]; + +typedef enum { + SGX_EC_VALID, /* validation pass successfully */ + + SGX_EC_COMPOSITE_BASE, /* field based on composite */ + SGX_EC_COMPLICATED_BASE, /* number of non-zero terms in the polynomial (> PRIME_ARR_MAX) */ + SGX_EC_IS_ZERO_DISCRIMINANT,/* zero discriminant */ + SGX_EC_COMPOSITE_ORDER, /* composite order of base point */ + SGX_EC_INVALID_ORDER, /* invalid base point order */ + SGX_EC_IS_WEAK_MOV, /* weak Meneze-Okamoto-Vanstone reduction attack */ + SGX_EC_IS_WEAK_SSA, /* weak Semaev-Smart,Satoh-Araki reduction attack */ + SGX_EC_IS_SUPER_SINGULAR, /* supersingular curve */ + + SGX_EC_INVALID_PRIVATE_KEY, /* !(0 < Private < order) */ + SGX_EC_INVALID_PUBLIC_KEY, /* (order*PublicKey != Infinity) */ + SGX_EC_INVALID_KEY_PAIR, /* (Private*BasePoint != PublicKey) */ + + SGX_EC_POINT_OUT_OF_GROUP, /* out of group (order*P != Infinity) */ + SGX_EC_POINT_IS_AT_INFINITY,/* point (P=(Px,Py)) at Infinity */ + SGX_EC_POINT_IS_NOT_VALID, /* point (P=(Px,Py)) out-of EC */ + + SGX_EC_POINT_IS_EQUAL, /* compared points are equal */ + SGX_EC_POINT_IS_NOT_EQUAL, /* compared points are different */ + + SGX_EC_INVALID_SIGNATURE /* invalid signature */ +} sgx_generic_ecresult_t; + + +#ifdef __cplusplus +extern "C" { +#endif + + /** SHA Hashing functions - NOTE: ONLY 256-bit is supported. + * + * NOTE: Use sgx_sha256_msg if the src pointer contains the complete msg to perform hash (Option 1) + * Else use the Init, Update, Update, ..., Final procedure (Option 2) + * Option 1: If the complete dataset is available for hashing, sgx_sha256_msg + * is a single API call for generating the 256bit hash for the given dataset. + * Return: If source pointer or hash pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If hash function fails then SGX_ERROR_UNEXPECTED is returned. + * Option 2: If the hash is to be performed over multiple data sets, then use: + * A. sgx_sha256_init - to create the context - context memory is allocated by this function. + * Return: If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. + * If context creation fails then SGX_ERROR_UNEXPECTED is returned. + * B. sgx_sha256_update - updates hash based on input source data + * This function should be called for each chunk of data to be + * included in the hash including the 1st and final chunks. + * Return: If source pointer or context pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If hash function fails then SGX_ERROR_UNEXPECTED is returned. + * C. sgx_sha256_get_hash - function obtains the hash value + * Return: If hash pointer or context pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If the function fails then SGX_ERROR_UNEXPECTED is returned. + * D. sgx_sha256_close - SHOULD BE CALLED to FREE context memory + * Upon completing the process of computing a hash over a set of data + * or sets of data, this function is used to free the context. + * Return: If context pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: uint8_t *p_src - Pointer to the input stream to be hashed + * uint32_t src_len - Length of the input stream to be hashed + * Output: sgx_sha256_hash_t *p_hash - Resultant hash from operation + */ + sgx_status_t SGXAPI sgx_sha256_msg(const uint8_t *p_src, uint32_t src_len, sgx_sha256_hash_t *p_hash); + + /** Allocates and initializes sha256 state + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Output: sgx_sha_state_handle_t *p_sha_handle - Pointer to the handle of the SHA256 state + */ + sgx_status_t SGXAPI sgx_sha256_init(sgx_sha_state_handle_t* p_sha_handle); + + /** Updates sha256 has calculation based on the input message + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Input: sgx_sha_state_handle_t sha_handle - Handle to the SHA256 state + * uint8_t *p_src - Pointer to the input stream to be hashed + * uint32_t src_len - Length of the input stream to be hashed + */ + sgx_status_t SGXAPI sgx_sha256_update(const uint8_t *p_src, uint32_t src_len, sgx_sha_state_handle_t sha_handle); + + /** Returns Hash calculation + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Input: sgx_sha_state_handle_t sha_handle - Handle to the SHA256 state + * Output: sgx_sha256_hash_t *p_hash - Resultant hash from operation + */ + sgx_status_t SGXAPI sgx_sha256_get_hash(sgx_sha_state_handle_t sha_handle, sgx_sha256_hash_t *p_hash); + + /** Cleans up SHA state + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Input: sgx_sha_state_handle_t sha_handle - Handle to the SHA256 state + */ + sgx_status_t SGXAPI sgx_sha256_close(sgx_sha_state_handle_t sha_handle); + + /**Rijndael AES-GCM - Only 128-bit key AES-GCM Encryption/Decryption is supported + * + * The Galois/Counter Mode (GCM) is a mode of operation of the AES algorithm. + * GCM [NIST SP 800-38D] uses a variation of the Counter mode of operation for encryption. + * GCM assures authenticity of the confidential data (of up to about 64 GB per invocation) + * using a universal hash function defined over a binary finite field (the Galois field). + * + * GCM can also provide authentication assurance for additional data + * (of practically unlimited length per invocation) that is not encrypted. + * GCM provides stronger authentication assurance than a (non-cryptographic) checksum or + * error detecting code. In particular, GCM can detect both accidental modifications of + * the data and intentional, unauthorized modifications. + * + * sgx_rijndael128GCM_encrypt: + * Return: If key, source, destination, MAC, or IV pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If AAD size is > 0 and the AAD pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If the Source Length is < 1, SGX_ERROR_INVALID_PARAMETER is returned. + * IV Length must = 12 (bytes) or SGX_ERROR_INVALID_PARAMETER is returned. + * If out of enclave memory then SGX_ERROR_OUT_OF_MEMORY is returned. + * If the encryption process fails then SGX_ERROR_UNEXPECTED is returned. + * + * sgx_rijndael128GCM_decrypt: + * Return: If key, source, destination, MAC, or IV pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If AAD size is > 0 and the AAD pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If the Source Length is < 1, SGX_ERROR_INVALID_PARAMETER is returned. + * IV Length must = 12 (bytes) or SGX_ERROR_INVALID_PARAMETER is returned. + * If the decryption process fails then SGX_ERROR_UNEXPECTED is returned. + * If the input MAC does not match the calculated MAC, SGX_ERROR_MAC_MISMATCH is returned. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_aes_gcm_128bit_key_t *p_key - Pointer to the key used in encryption/decryption operation + * Size MUST BE 128-bits + * uint8_t *p_src - Pointer to the input stream to be encrypted/decrypted + * uint32_t src_len - Length of the input stream to be encrypted/decrypted + * uint8_t *p_iv - Pointer to the initialization vector + * uint32_t iv_len - Length of the initialization vector - MUST BE 12 (bytes) + * NIST AES-GCM recommended IV size = 96 bits + * uint8_t *p_aad - Pointer to the input stream of additional authentication data + * uint32_t aad_len - Length of the additional authentication data stream + * sgx_aes_gcm_128bit_tag_t *p_in_mac - Pointer to the expected MAC in decryption process + * Output: uint8_t *p_dst - Pointer to the cipher text for encryption or clear text for decryption. Size of buffer should be >= src_len. + * sgx_aes_gcm_128bit_tag_t *p_out_mac - Pointer to the MAC generated from encryption process + * NOTE: Wrapper is responsible for confirming decryption tag matches encryption tag + */ + sgx_status_t SGXAPI sgx_rijndael128GCM_encrypt(const sgx_aes_gcm_128bit_key_t *p_key, + const uint8_t *p_src, + uint32_t src_len, + uint8_t *p_dst, + const uint8_t *p_iv, + uint32_t iv_len, + const uint8_t *p_aad, + uint32_t aad_len, + sgx_aes_gcm_128bit_tag_t *p_out_mac); + sgx_status_t SGXAPI sgx_rijndael128GCM_decrypt(const sgx_aes_gcm_128bit_key_t *p_key, + const uint8_t *p_src, + uint32_t src_len, + uint8_t *p_dst, + const uint8_t *p_iv, + uint32_t iv_len, + const uint8_t *p_aad, + uint32_t aad_len, + const sgx_aes_gcm_128bit_tag_t *p_in_mac); + + /** Message Authentication Rijndael 128 CMAC - Only 128-bit key size is supported. + * NOTE: Use sgx_rijndael128_cmac_msg if the src ptr contains the complete msg to perform hash (Option 1) + * Else use the Init, Update, Update, ..., Final, Close procedure (Option 2) + * Option 1: If the complete dataset is available for hashing, sgx_rijndael128_cmac_msg + * is a single API call for generating the 128-bit hash for the given dataset. + * Return: If source, key, or MAC pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. + * If hash function fails then SGX_ERROR_UNEXPECTED is returned. + * Option 2: If the hash is to be performed over multiple data sets, then use: + * A. sgx_cmac128_init - to create the context - context memory is allocated by this function. + * Return: If key pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. + * If context creation fails then SGX_ERROR_UNEXPECTED is returned. + * B. sgx_cmac128_update - updates hash based on input source data + * This function should be called for each chunk of data to be + * included in the hash including the 1st and final chunks. + * Return: If source pointer or context pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If hash function fails then SGX_ERROR_UNEXPECTED is returned. + * C. sgx_cmac128_final - function obtains the hash value + * Upon completing the process of computing a hash over a set of data or sets of data, + * this function populates the hash value. + * Return: If hash pointer or context pointer are NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * If the function fails then SGX_ERROR_UNEXPECTED is returned. + * D. sgx_cmac128_close - SHOULD BE CALLED to clean up the CMAC state + * Upon populating the hash value over a set of data or sets of data, + * this function is used to free the CMAC state. + * Return: If CMAC state pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_cmac_128bit_key_t *p_key - Pointer to the key used in encryption/decryption operation + * uint8_t *p_src - Pointer to the input stream to be MAC’d + * uint32_t src_len - Length of the input stream to be MAC’d + * Output: sgx_cmac_gcm_128bit_tag_t *p_mac - Pointer to the resultant MAC + */ + sgx_status_t SGXAPI sgx_rijndael128_cmac_msg(const sgx_cmac_128bit_key_t *p_key, + const uint8_t *p_src, + uint32_t src_len, + sgx_cmac_128bit_tag_t *p_mac); + /** Allocates and initializes CMAC state. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_cmac_128bit_key_t *p_key - Pointer to the key used in encryption/decryption operation + * Output: sgx_cmac_state_handle_t *p_cmac_handle - Pointer to the handle of the CMAC state + */ + sgx_status_t SGXAPI sgx_cmac128_init(const sgx_cmac_128bit_key_t *p_key, sgx_cmac_state_handle_t* p_cmac_handle); + + /** Updates CMAC has calculation based on the input message. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Input: sgx_cmac_state_handle_t cmac_handle - Handle to the CMAC state + * uint8_t *p_src - Pointer to the input stream to be hashed + * uint32_t src_len - Length of the input stream to be hashed + */ + sgx_status_t SGXAPI sgx_cmac128_update(const uint8_t *p_src, uint32_t src_len, sgx_cmac_state_handle_t cmac_handle); + + /** Returns Hash calculation and clean up CMAC state. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Input: sgx_cmac_state_handle_t cmac_handle - Handle to the CMAC state + * Output: sgx_cmac_128bit_tag_t *p_hash - Resultant hash from operation + */ + sgx_status_t SGXAPI sgx_cmac128_final(sgx_cmac_state_handle_t cmac_handle, sgx_cmac_128bit_tag_t *p_hash); + + /** Clean up the CMAC state + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Input: sgx_cmac_state_handle_t cmac_handle - Handle to the CMAC state + */ + sgx_status_t SGXAPI sgx_cmac128_close(sgx_cmac_state_handle_t cmac_handle); + + + /** AES-CTR 128-bit - Only 128-bit key size is supported. + * + * These functions encrypt/decrypt the input data stream of a variable length according + * to the CTR mode as specified in [NIST SP 800-38A]. The counter can be thought of as + * an IV which increments on successive encryption or decrytion calls. For a given + * dataset or data stream the incremented counter block should be used on successive + * calls of the encryption/decryption process for that given stream. However for + * new or different datasets/streams, the same counter should not be reused, instead + * intialize the counter for the new data set. + * + * sgx_aes_ctr_encrypt + * Return: If source, key, counter, or destination pointer is NULL, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. + * If the encryption process fails then SGX_ERROR_UNEXPECTED is returned. + * sgx_aes_ctr_decrypt + * Return: If source, key, counter, or destination pointer is NULL, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. + * If the decryption process fails then SGX_ERROR_UNEXPECTED is returned. + * + * Parameters: + * Return: + * sgx_status_t - SGX_SUCCESS or failure as defined + * in sgx_error.h + * Inputs: + * sgx_aes_128bit_key_t *p_key - Pointer to the key used in + * encryption/decryption operation + * uint8_t *p_src - Pointer to the input stream to be + * encrypted/decrypted + * uint32_t src_len - Length of the input stream to be + * encrypted/decrypted + * uint8_t *p_ctr - Pointer to the counter block + * uint32_t ctr_inc_bits - Number of bits in counter to be + * incremented + * Output: + * uint8_t *p_dst - Pointer to the cipher text. + * Size of buffer should be >= src_len. + */ + sgx_status_t SGXAPI sgx_aes_ctr_encrypt( + const sgx_aes_ctr_128bit_key_t *p_key, + const uint8_t *p_src, + const uint32_t src_len, + uint8_t *p_ctr, + const uint32_t ctr_inc_bits, + uint8_t *p_dst); + sgx_status_t SGXAPI sgx_aes_ctr_decrypt( + const sgx_aes_ctr_128bit_key_t *p_key, + const uint8_t *p_src, + const uint32_t src_len, + uint8_t *p_ctr, + const uint32_t ctr_inc_bits, + uint8_t *p_dst); + + + /** + * Elliptic Curve Cryptography based on GF(p), 256 bit. + * + * Elliptic curve cryptosystems (ECCs) implement a different way of creating public keys. + * Because elliptic curve calculation is based on the addition of the rational points in + * the (x,y) plane and it is difficult to solve a discrete logarithm from these points, + * a higher level of security is achieved through the cryptographic schemes that use the + * elliptic curves. The cryptographic systems that encrypt messages by using the properties + * of elliptic curves are hard to attack due to the extreme complexity of deciphering the + * private key. + * + * Use of elliptic curves allows for shorter public key length and encourage cryptographers + * to create cryptosystems with the same or higher encryption strength as the RSA or DSA + * cryptosystems. Because of the relatively short key length, ECCs do encryption and decryption + * faster on the hardware that requires less computation processing volumes. For example, with + * a key length of 150-350 bits, ECCs provide the same encryption strength as the cryptosystems + * who have to use 600 -1400 bits. + * + * ECCP stands for Elliptic Curve Cryptography Prime and these functions include operations + * over a prime finite field GF(p). + * + */ + /** Allocates and initializes ecc context. + * The function initializes the context of the elliptic curve cryptosystem over the + * prime finite field GF(p). This function allocates and initializes the ecc context. + * Return: If out of enclave memory, SGX_ERROR_OUT_OF_MEMORY is returned. + * If context creation fails then SGX_ERROR_UNEXPECTED is returned. + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Output: sgx_ecc_state_handle_t *p_ecc_handle - Pointer to the handle of the ECC crypto system + */ + sgx_status_t SGXAPI sgx_ecc256_open_context(sgx_ecc_state_handle_t* p_ecc_handle); + + /** Cleans up ecc context. + * Return: If context pointer is NULL, SGX_ERROR_INVALID_PARAMETER is returned. + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Output: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system + */ + sgx_status_t SGXAPI sgx_ecc256_close_context(sgx_ecc_state_handle_t ecc_handle); + + /** Populates private/public key pair. + * NOTE: Caller code allocates memory for Private & Public key pointers to be populated + * + * The function generates a private key p_private and computes a public key p_public of the + * elliptic cryptosystem over a finite field GF(p). + * + * The private key p_private is a number that lies in the range of [1, n-1] where n is + * the order of the elliptic curve base point. + * + * The public key p_public is an elliptic curve point such that p_public = p_private ?G, + * where G is the base point of the elliptic curve. + * + * The context of the point p_public as an elliptic curve point must be created by using + * the function sgx_ecc256_open_context. + * + * Return: If context, public key, or private key pointer is NULL, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If the key creation process fails then SGX_ERROR_UNEXPECTED is returned. + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system + * Outputs: sgx_ec256_private_t *p_private - Pointer to the private key - LITTLE ENDIAN + * sgx_ec256_public_t *p_public - Pointer to the public key - LITTLE ENDIAN + */ + sgx_status_t SGXAPI sgx_ecc256_create_key_pair(sgx_ec256_private_t *p_private, + sgx_ec256_public_t *p_public, + sgx_ecc_state_handle_t ecc_handle); + + /** Checks whether the input point is a valid point on the given elliptic curve. + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h + * Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system + * sgx_ec256_public_t *p_point - Pointer to perform validity check on - LITTLE ENDIAN + * Output: int *p_valid - Return 0 if the point is an invalid point on ECC curve + */ + sgx_status_t SGXAPI sgx_ecc256_check_point(const sgx_ec256_public_t *p_point, + const sgx_ecc_state_handle_t ecc_handle, + int *p_valid); + + /** Computes DH shared key based on own (local) private key and remote public Ga Key. + * NOTE: Caller code allocates memory for Shared key pointer to be populated + * + * The function computes a secret number bnShare, which is a secret key shared between + * two participants of the cryptosystem. + * + * In cryptography, metasyntactic names such as Alice as Bob are normally used as examples + * and in discussions and stand for participant A and participant B. + * + * Both participants (Alice and Bob) use the cryptosystem for receiving a common secret point + * on the elliptic curve called a secret key. To receive a secret key, participants apply the + * Diffie-Hellman key-agreement scheme involving public key exchange. The value of the secret + * key entirely depends on participants. + * + * According to the scheme, Alice and Bob perform the following operations: + * 1. Alice calculates her own public key pubKeyA by using her private key + * privKeyA: pubKeyA = privKeyA ?G, where G is the base point of the elliptic curve. + * 2. Alice passes the public key to Bob. + * 3. Bob calculates his own public key pubKeyB by using his private key + * privKeyB: pubKeyB = privKeyB ?G, where G is a base point of the elliptic curve. + * 4. Bob passes the public key to Alice. + * 5. Alice gets Bob's public key and calculates the secret point shareA. When calculating, + * she uses her own private key and Bob's public key and applies the following formula: + * shareA = privKeyA ?pubKeyB = privKeyA ?privKeyB ?G. + * 6. Bob gets Alice's public key and calculates the secret point shareB. When calculating, + * he uses his own private key and Alice's public key and applies the following formula: + * shareB = privKeyB ?pubKeyA = privKeyB ?privKeyA ?G. + * + * Because the following equation is true privKeyA ?privKeyB ?G = privKeyB ?privKeyA ?G, + * the result of both calculations is the same, that is, the equation shareA = shareB is true. + * The secret point serves as a secret key. + * + * Shared secret bnShare is an x-coordinate of the secret point on the elliptic curve. The elliptic + * curve domain parameters must be hitherto defined by the function: sgx_ecc256_open_context. + * + * Return: If context, public key, private key, or shared key pointer is NULL, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If the remote public key is not a valid point on the elliptic curve, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If the key creation process fails then SGX_ERROR_UNEXPECTED is returned. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system + * sgx_ec256_private_t *p_private_b - Pointer to the local private key - LITTLE ENDIAN + * sgx_ec256_public_t *p_public_ga - Pointer to the remote public key - LITTLE ENDIAN + * Output: sgx_ec256_dh_shared_t *p_shared_key - Pointer to the shared DH key - LITTLE ENDIAN + */ + sgx_status_t SGXAPI sgx_ecc256_compute_shared_dhkey(sgx_ec256_private_t *p_private_b, + sgx_ec256_public_t *p_public_ga, + sgx_ec256_dh_shared_t *p_shared_key, + sgx_ecc_state_handle_t ecc_handle); + + /** Computes signature for data based on private key. + * + * A message digest is a fixed size number derived from the original message with + * an applied hash function over the binary code of the message. (SHA256 in this case) + * The signer's private key and the message digest are used to create a signature. + * + * A digital signature over a message consists of a pair of large numbers, 256-bits each, + * which the given function computes. + * + * The scheme used for computing a digital signature is of the ECDSA scheme, + * an elliptic curve of the DSA scheme. + * + * The keys can be generated and set up by the function: sgx_ecc256_create_key_pair. + * + * The elliptic curve domain parameters must be created by function: + * sgx_ecc256_open_context + * + * Return: If context, private key, signature or data pointer is NULL, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If the signature creation process fails then SGX_ERROR_UNEXPECTED is returned. + * + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system + * sgx_ec256_private_t *p_private - Pointer to the private key - LITTLE ENDIAN + * uint8_t *p_data - Pointer to the data to be signed + * uint32_t data_size - Size of the data to be signed + * Output: ec256_signature_t *p_signature - Pointer to the signature - LITTLE ENDIAN + */ + sgx_status_t SGXAPI sgx_ecdsa_sign(const uint8_t *p_data, + uint32_t data_size, + sgx_ec256_private_t *p_private, + sgx_ec256_signature_t *p_signature, + sgx_ecc_state_handle_t ecc_handle); + + /** Verifies the signature for the given data based on the public key. + * + * A digital signature over a message consists of a pair of large numbers, 256-bits each, + * which could be created by function: sgx_ecdsa_sign. The scheme used for computing a + * digital signature is of the ECDSA scheme, an elliptic curve of the DSA scheme. + * + * The typical result of the digital signature verification is one of the two values: + * SGX_Generic_ECValid - Digital signature is valid + * SGX_Generic_ECInvalidSignature - Digital signature is not valid + * + * The elliptic curve domain parameters must be created by function: + * sgx_ecc256_open_context + * + * Return: If context, public key, signature, result or data pointer is NULL, + * SGX_ERROR_INVALID_PARAMETER is returned. + * If the verification process fails then SGX_ERROR_UNEXPECTED is returned. + * Parameters: + * Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system + * sgx_ec256_public_t *p_public - Pointer to the public key + * uint8_t *p_data - Pointer to the data to be signed + * uint32_t data_size - Size of the data to be signed + * sgx_ec256_signature_t *p_signature - Pointer to the signature + * Output: uint8_t *p_result - Pointer to the result of verification check + */ + sgx_status_t SGXAPI sgx_ecdsa_verify(const uint8_t *p_data, + uint32_t data_size, + const sgx_ec256_public_t *p_public, + sgx_ec256_signature_t *p_signature, + uint8_t *p_result, + sgx_ecc_state_handle_t ecc_handle); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_thread.h b/common/inc/sgx_thread.h new file mode 100644 index 0000000000..88af98372e --- /dev/null +++ b/common/inc/sgx_thread.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_THREAD_H_ +#define _SGX_THREAD_H_ + +#include +#include +#include "sgx_defs.h" + +typedef uintptr_t sgx_thread_t; + +typedef struct sgx_thread_queue +{ + sgx_thread_t m_first; /* first element */ + sgx_thread_t m_last; /* last element */ +} sgx_thread_queue_t; + +/* Mutex */ +typedef struct sgx_thread_mutex +{ + size_t m_refcount; + uint32_t m_control; + volatile uint32_t m_lock; /* use sgx_spinlock_t */ + sgx_thread_t m_owner; + sgx_thread_queue_t m_queue; +} sgx_thread_mutex_t; + +#define SGX_THREAD_T_NULL ((sgx_thread_t)(NULL)) + +#define SGX_THREAD_MUTEX_NONRECURSIVE 0x01 +#define SGX_THREAD_MUTEX_RECURSIVE 0x02 +#define SGX_THREAD_NONRECURSIVE_MUTEX_INITIALIZER \ + {0, SGX_THREAD_MUTEX_NONRECURSIVE, 0, SGX_THREAD_T_NULL, {SGX_THREAD_T_NULL, SGX_THREAD_T_NULL}} +#define SGX_THREAD_RECURSIVE_MUTEX_INITIALIZER \ + {0, SGX_THREAD_MUTEX_RECURSIVE, 0, SGX_THREAD_T_NULL, {SGX_THREAD_T_NULL, SGX_THREAD_T_NULL}} +#define SGX_THREAD_MUTEX_INITIALIZER \ + SGX_THREAD_NONRECURSIVE_MUTEX_INITIALIZER + +typedef struct sgx_thread_mutex_attr +{ + unsigned char m_dummy; /* for C syntax check */ +} sgx_thread_mutexattr_t; + +/* Condition Variable */ +typedef struct sgx_thread_cond +{ + volatile uint32_t m_lock; /* use sgx_spinlock_t */ + sgx_thread_queue_t m_queue; +} sgx_thread_cond_t; + +#define SGX_THREAD_COND_INITIALIZER {0, {SGX_THREAD_T_NULL, SGX_THREAD_T_NULL}} + +typedef struct sgx_thread_cond_attr +{ + unsigned char m_dummy; /* for C syntax check */ +} sgx_thread_condattr_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/* Mutex */ +int SGXAPI sgx_thread_mutex_init(sgx_thread_mutex_t *mutex, const sgx_thread_mutexattr_t *unused); +int SGXAPI sgx_thread_mutex_destroy(sgx_thread_mutex_t *mutex); + +int SGXAPI sgx_thread_mutex_lock(sgx_thread_mutex_t *mutex); +int SGXAPI sgx_thread_mutex_trylock(sgx_thread_mutex_t *mutex); +int SGXAPI sgx_thread_mutex_unlock(sgx_thread_mutex_t *mutex); + +/* Condition Variable */ +int SGXAPI sgx_thread_cond_init(sgx_thread_cond_t *cond, const sgx_thread_condattr_t *unused); +int SGXAPI sgx_thread_cond_destroy(sgx_thread_cond_t *cond); + +int SGXAPI sgx_thread_cond_wait(sgx_thread_cond_t *cond, sgx_thread_mutex_t *mutex); +int SGXAPI sgx_thread_cond_signal(sgx_thread_cond_t *cond); +int SGXAPI sgx_thread_cond_broadcast(sgx_thread_cond_t *cond); + +sgx_thread_t SGXAPI sgx_thread_self(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _SGX_THREAD_H_ */ diff --git a/common/inc/sgx_tkey_exchange.edl b/common/inc/sgx_tkey_exchange.edl new file mode 100644 index 0000000000..179418d0ce --- /dev/null +++ b/common/inc/sgx_tkey_exchange.edl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave { + from "sgx_tae_service.edl" import *; + trusted { + public sgx_status_t sgx_ra_get_ga(sgx_ra_context_t context, + [out] sgx_ec256_public_t *g_a); + + public sgx_status_t sgx_ra_proc_msg2_trusted(sgx_ra_context_t context, + [in]const sgx_ra_msg2_t *p_msg2, /*copy msg2 except quote into enclave */ + [in] const sgx_target_info_t *p_qe_target, + [out] sgx_report_t *p_report, + [out] sgx_quote_nonce_t *p_nonce); + + public sgx_status_t sgx_ra_get_msg3_trusted(sgx_ra_context_t context, + uint32_t quote_size, + [in]sgx_report_t* qe_report, + [user_check]sgx_ra_msg3_t *p_msg3, + uint32_t msg3_size); + }; +}; diff --git a/common/inc/sgx_tkey_exchange.h b/common/inc/sgx_tkey_exchange.h new file mode 100644 index 0000000000..f2fb9d0f75 --- /dev/null +++ b/common/inc/sgx_tkey_exchange.h @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_TKEY_EXCHANGE_H_ +#define _SGX_TKEY_EXCHANGE_H_ + +#include "sgx.h" +#include "sgx_defs.h" +#include "sgx_key_exchange.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The sgx_ra_init function creates a context for the remote attestation and + * key exchange process. + * + * @param p_pub_key The EC public key of the service provider based on the NIST + * P-256 elliptic curve. + * @param b_pse If true, platform service information is needed in message + * 3. The caller should make sure a PSE session has been + * established using sgx_create_pse_session before attempting + * to establish a remote attestation and key exchange session + * involving platform service information. + * @param p_context The output context for the subsequent remote attestation + * and key exchange process, to be used in sgx_ra_get_msg1 and + * sgx_ra_proc_msg2. + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Indicates an error that + * the input parameters are + * invalid. + * SGX_ERROR_KDF_MISMATCH Indicates key derivation + * function doesn't match. + * SGX_ERROR_OUT_OF_MEMORY There is not enough + * memory available to + * complete this operation. + * SGX_ERROR_AE_SESSION_INVALID Session is invalid or + * ended by server. + * SGX_ERROR_UNEXPECTED Indicates an unexpected + * error occurs. + */ +sgx_status_t SGXAPI sgx_ra_init( + const sgx_ec256_public_t *p_pub_key, + int b_pse, + sgx_ra_context_t *p_context); + +/* + * The sgx_ra_get_keys function is used to get the negotiated keys of a remote + * attestation and key exchange session. This function should only be called + * after the service provider accepts the remote attestation and key exchange + * protocol message 3 produced by sgx_ra_proc_msg2. + * + * @param context Context returned by sgx_ra_init. + * @param type The specifier of keys, can be SGX_RA_KEY_MK, SGX_RA_KEY_SK + * and SGX_RA_VK. + * @param p_key The key returned. + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Indicates an error that + * the input parameters are + * invalid. + * SGX_ERROR_INVALID_STATE Indicates this function + * is called out of order. + */ +sgx_status_t SGXAPI sgx_ra_get_keys( + sgx_ra_context_t context, + sgx_ra_key_type_t type, + sgx_ra_key_128_t *p_key); + +/* + * Call the sgx_ra_close function to release the remote attestation and key + * exchange context after the process is done and the context isn't needed + * anymore. + * + * @param context Context returned by sgx_ra_init. + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Indicates an error that + * the input parameters are + * invalid. + */ +sgx_status_t SGXAPI sgx_ra_close( + sgx_ra_context_t context); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_trts.h b/common/inc/sgx_trts.h new file mode 100644 index 0000000000..1a669f78d2 --- /dev/null +++ b/common/inc/sgx_trts.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_TRTS_H_ +#define _SGX_TRTS_H_ + +#include "sgx_error.h" +#include "stddef.h" +#include "sgx_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* sgx_is_within_enclave() + * Parameters: + * addr - the start address of the buffer + * size - the size of the buffer + * Return Value: + * 1 - the buffer is strictly within the enclave + * 0 - the whole buffer or part of the buffer is not within the enclave, + * or the buffer is wrap around +*/ +int SGXAPI sgx_is_within_enclave(const void *addr, size_t size); + +/* sgx_is_outside_enclave() + * Parameters: + * addr - the start address of the buffer + * size - the size of the buffer + * Return Value: + * 1 - the buffer is strictly outside the enclave + * 0 - the whole buffer or part of the buffer is not outside the enclave, + * or the buffer is wrap around +*/ +int SGXAPI sgx_is_outside_enclave(const void *addr, size_t size); + + +/* sgx_read_rand() + * Parameters: + * rand - the buffer to receive the random number + * length_in_bytes - the number of bytes to read the random number + * Return Value: + * SGX_SUCCESS - success + * SGX_ERROR_INVALID_PARAMETER - the parameter is invalid + * SGX_ERROR_UNEXPECTED - HW failure of RDRAND instruction +*/ +sgx_status_t SGXAPI sgx_read_rand(unsigned char *rand, size_t length_in_bytes); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_trts_exception.h b/common/inc/sgx_trts_exception.h new file mode 100644 index 0000000000..41280aff4d --- /dev/null +++ b/common/inc/sgx_trts_exception.h @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * File: sgx_trts_exception.h + * Description: + * Header file for custom exception handling support. + */ + +#ifndef _SGX_TRTS_EXCEPTION_H_ +#define _SGX_TRTS_EXCEPTION_H_ + +#include +#include +#include "sgx_defs.h" + +#define EXCEPTION_CONTINUE_SEARCH 0 +#define EXCEPTION_CONTINUE_EXECUTION -1 + +typedef enum _sgx_exception_vector_t +{ + SGX_EXCEPTION_VECTOR_DE = 0, /* DIV and DIV instructions */ + SGX_EXCEPTION_VECTOR_DB = 1, /* For Intel use only */ + SGX_EXCEPTION_VECTOR_BP = 3, /* INT 3 instruction */ + SGX_EXCEPTION_VECTOR_BR = 5, /* BOUND instruction */ + SGX_EXCEPTION_VECTOR_UD = 6, /* UD2 instruction or reserved opcode */ + SGX_EXCEPTION_VECTOR_MF = 16, /* x87 FPU floating-point or WAIT/FWAIT instruction */ + SGX_EXCEPTION_VECTOR_AC = 17, /* Any data reference in memory */ + SGX_EXCEPTION_VECTOR_XM = 19, /* SSE/SSE2/SSE3 floating-point instruction */ +} sgx_exception_vector_t; + +typedef enum _sgx_exception_type_t +{ + SGX_EXCEPTION_HARDWARE = 3, + SGX_EXCEPTION_SOFTWARE = 6, +} sgx_exception_type_t; + +#if defined (_M_X64) || defined (__x86_64__) +typedef struct _cpu_context_t +{ + uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t rbx; + uint64_t rsp; + uint64_t rbp; + uint64_t rsi; + uint64_t rdi; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rflags; + uint64_t rip; +} sgx_cpu_context_t; +#else +typedef struct _cpu_context_t +{ + uint32_t eax; + uint32_t ecx; + uint32_t edx; + uint32_t ebx; + uint32_t esp; + uint32_t ebp; + uint32_t esi; + uint32_t edi; + uint32_t eflags; + uint32_t eip; +} sgx_cpu_context_t; +#endif + +typedef struct _exception_info_t +{ + sgx_cpu_context_t cpu_context; + sgx_exception_vector_t exception_vector; + sgx_exception_type_t exception_type; +} sgx_exception_info_t; + +typedef int (*sgx_exception_handler_t)(sgx_exception_info_t *info); + +#ifdef __cplusplus +extern "C" { +#endif + +/* sgx_register_exception_handler() + * register a custom exception handler + * Parameter + * is_first_handler - the order in which the handler should be called. + * If the parameter is nonzero, the handler is the first handler to be called. + * If the parameter is zero, the handler is the last handler to be called. + * exception_handler - a pointer to the handler to be called. + * Return Value + * handler - success + * NULL - fail +*/ +void * SGXAPI sgx_register_exception_handler(int is_first_handler, sgx_exception_handler_t exception_handler); + +/* sgx_unregister_exception_handler() + * unregister a custom exception handler. + * Parameter + * handler - a handler to the custom excepetion handler previously + * registered using the sgx_register_exception_handler function. + * Return Value + * none zero - success + * 0 - fail +*/ +int SGXAPI sgx_unregister_exception_handler(void *handler); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_tseal.h b/common/inc/sgx_tseal.h new file mode 100644 index 0000000000..fa93227800 --- /dev/null +++ b/common/inc/sgx_tseal.h @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SGX_TSEAL_H_ +#define _SGX_TSEAL_H_ + +#include +#include +#include "sgx_key.h" +#include "sgx_error.h" +#include "sgx_defs.h" +#include "sgx_attributes.h" +#include "sgx_tcrypto.h" + +#define SGX_SEAL_TAG_SIZE SGX_AESGCM_MAC_SIZE +#define SGX_SEAL_IV_SIZE 12 + +typedef struct _aes_gcm_data_t +{ + uint32_t payload_size; /* 0: Size of the payload which includes both the encrypted data and the optional additional MAC text */ + uint8_t reserved[12]; /* 4: Reserved bits */ + uint8_t payload_tag[SGX_SEAL_TAG_SIZE]; /* 16: AES-GMAC of the plain text, payload, and the sizes */ + uint8_t payload[]; /* 32: The payload data which includes the encrypted data followed by the optional additional MAC text */ +} sgx_aes_gcm_data_t; + +typedef struct _sealed_data_t +{ + sgx_key_request_t key_request; /* 00: The key request used to obtain the sealing key */ + uint32_t plain_text_offset; /* 64: Offset within aes_data.playload to the start of the optional additional MAC text */ + uint8_t reserved[12]; /* 68: Reserved bits */ + sgx_aes_gcm_data_t aes_data; /* 80: Data structure holding the AES/GCM related data */ +} sgx_sealed_data_t; + +#ifdef __cplusplus +extern "C" { +#endif + /* sgx_calc_sealed_data_size + * Purpose: This function is used to determine how much memory to allocate for sgx_sealed_data_t structure. + * + * Paramters: + * add_mac_txt_size - [IN] Length of the optional additional data stream in bytes + * txt_encrypt_size - [IN] Length of the data stream to be encrypted in bytes + * + * Return Value: + * uint32_t - The minimum number of bytes that need to be allocated for the sgx_sealed_data_t structure + * If the function fails, the return value is UINT32_MAX + */ + uint32_t sgx_calc_sealed_data_size(const uint32_t add_mac_txt_size, const uint32_t txt_encrypt_size); + + /* sgx_get_add_mac_txt_len + * Purpose: This function is used to determine how much memory to allocate for the additional_MAC_text buffer + * + * Parameter: + * p_sealed_data - [IN] Pointer to the sgx_sealed_data_t structure which was populated by the sgx_seal_data function + * + * Return Value: + * uint32_t - The number of bytes in the optional additional MAC buffer + */ + uint32_t sgx_get_add_mac_txt_len(const sgx_sealed_data_t* p_sealed_data); + + /* sgx_get_encrypt_txt_len + * + * Parameter: + * p_sealed_data - [IN] Pointer to the sgx_sealed_data_t structure which was populated by the sgx_seal_data function + * + * Return Value: + * uint32_t - The number of bytes in the encrypted data buffer + * If the function fails, the return value is UINT32_MAX + */ + uint32_t sgx_get_encrypt_txt_len(const sgx_sealed_data_t* p_sealed_data); + + + /* sgx_seal_data + * Purpose: This algorithm is used to AES-GCM encrypt the input data. Specifically, + * two input data sets can be provided, one is the text to encrypt (p_text2encrypt) + * the second being optional additional text that should not be encrypted but will + * be part of the GCM MAC calculation. + * The sgx_sealed_data_t structure should be allocated prior to the API call and + * should include buffer storage for the MAC text and encrypted text. + * The sgx_sealed_data_t structure contains the data required to unseal the data on + * the same system it was sealed. + * + * Parameters: + * additional_MACtext_length - [IN] length of the plaintext data stream in bytes + * The additional data is optional and thus the length + * can be zero if no data is provided + * p_additional_MACtext - [IN] pointer to the plaintext data stream to be GCM protected + * The additional data is optional. You may pass a NULL pointer + * but additional_MACtext_length must be zero in that case + * text2encrypt_length - [IN] length of the data stream to encrypt in bytes + * p_text2encrypt - [IN] pointer to data stream to encrypt + * sealed_data_size - [IN] Size of the sealed data buffer passed in + * p_sealed_data - [OUT] pointer to the sealed data structure containing protected data + * + * Return Value: + * sgx_status_t - SGX Error code + */ + sgx_status_t SGXAPI sgx_seal_data(const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, + const uint32_t text2encrypt_length, + const uint8_t *p_text2encrypt, + const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data); + + /* sgx_seal_data_ex + * Purpose: Expert version of sgx_seal_data which is used if the key_policy/attribute_mask/misc_mask + * need to be modified from the default values. + * + * Parameters: + * key_policy - [IN] Specifies the measurement to use in key derivation + * attribute_mask - [IN] Identifies which platform/enclave attributes to use in key derivation + * misc_mask - [IN] The mask for MISC_SELECT + * additional_MACtext_length - [IN] length of the plaintext data stream in bytes + * The additional data is optional and thus the length + * can be zero if no data is provided + * p_additional_MACtext - [IN] pointer to the plaintext data stream to be GCM protected + * The additional data is optional. You may pass a NULL pointer + * but additional_MACtext_length must be zero in that case + * text2encrypt_length - [IN] length of the data stream to encrypt in bytes + * p_text2encrypt - [IN] pointer to data stream to encrypt + * sealed_data_size - [IN] Size of the sealed data buffer passed in + * p_sealed_data - [OUT] pointer to the sealed data structure containing protected data + * + * Return Value: + * sgx_status_t - SGX Error code + */ + sgx_status_t SGXAPI sgx_seal_data_ex(const uint16_t key_policy, + const sgx_attributes_t attribute_mask, + const sgx_misc_select_t misc_mask, + const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, + const uint32_t text2encrypt_length, + const uint8_t *p_text2encrypt, + const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data); + + /* sgx_unseal_data + * Purpose: Unseal the sealed data structure passed in and populate the MAC text and decrypted text + * buffers with the appropriate data from the sealed data structure. + * + * Parameters: + * p_sealed_data - [IN] pointer to the sealed data structure containing protected data + * p_additional_MACtext - [OUT] pointer to the plaintext data stream which was GCM protected + * The additiona data is optional. You may pass a NULL pointer but + * p_additional_MACtext_length must be zero in that case + * p_additional_MACtext_length - [IN/OUT] pointer to length of the plaintext data stream in bytes + * If there is not additional data, this parameter should be zero. + * p_decrypted_text - [OUT] pointer to decrypted data stream + * p_decrypted_text_length - [IN/OUT] pointer to length of the decrypted data stream to encrypt in bytes + * + * Return Value: + * sgx_status_t - SGX Error code + */ + sgx_status_t SGXAPI sgx_unseal_data(const sgx_sealed_data_t *p_sealed_data, + uint8_t *p_additional_MACtext, + uint32_t *p_additional_MACtext_length, + uint8_t *p_decrypted_text, + uint32_t *p_decrypted_text_length); + + /* sgx_mac_aadata + * Purpose: Use AES-GCM algorithm to generate a sealed data structure with integrity protection. + * Specifically, the input data set is ONLY the plaintext data stream, or + * additional authenticated data(AAD), no encrypt data. + * The sgx_sealed_data_t structure should be allocated prior to the API call and + * should include buffer storage for the plaintext data. + * The sgx_sealed_data_t structure contains the data required to unseal the data on + * the same system it was sealed. + * + * Parameters: + * additional_MACtext_length - [IN] length of the plaintext data stream in bytes + * p_additional_MACtext - [IN] pointer to the plaintext data stream to be GCM protected + * sealed_data_size - [IN] Size of the sealed data buffer passed in + * p_sealed_data - [OUT] pointer to the sealed data structure containing protected data + * + * Return Value: + * sgx_status_t - SGX Error code + */ + sgx_status_t sgx_mac_aadata(const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, + const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data); + + /* sgx_mac_aadata_ex + * Purpose: Expert version of sgx_mac_aadata which is used if the key_policy/attribute_mask/misc_mask + * need to be modified from the default values. + * + * Parameters: + * key_policy - [IN] Specifies the measurement to use in key derivation + * attribute_mask - [IN] Identifies which platform/enclave attributes to use in key derivation + * misc_mask - [IN] The mask for MISC_SELECT + * additional_MACtext_length - [IN] length of the plaintext data stream in bytes + * p_additional_MACtext - [IN] pointer to the plaintext data stream to be GCM protected + * sealed_data_size - [IN] Size of the sealed data buffer passed in + * p_sealed_data - [OUT] pointer to the sealed data structure containing protected data + * + * Return Value: + * sgx_status_t - SGX Error code + */ + sgx_status_t sgx_mac_aadata_ex(const uint16_t key_policy, + const sgx_attributes_t attribute_mask, + const sgx_misc_select_t misc_mask, + const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, + const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data); + + /* sgx_unmac_aadata + * Purpose: Unseal the sealed data structure passed in and populate the plaintext data stream + * with the appropriate data from the sealed data structure. + * + * Parameters: + * p_sealed_data - [IN] pointer to the sealed data structure containing protected data + * p_additional_MACtext - [OUT] pointer to the plaintext data stream which was GCM protected + * p_additional_MACtext_length - [IN/OUT] pointer to length of the plaintext data stream in bytes + * + * Return Value: + * sgx_status_t - SGX Error code + */ + sgx_status_t sgx_unmac_aadata(const sgx_sealed_data_t *p_sealed_data, + uint8_t *p_additional_MACtext, + uint32_t *p_additional_MACtext_length); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_tstdc.edl b/common/inc/sgx_tstdc.edl new file mode 100644 index 0000000000..e92e2218c3 --- /dev/null +++ b/common/inc/sgx_tstdc.edl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave { + untrusted { + [cdecl] void sgx_oc_cpuidex([in, out] int cpuinfo[4], int leaf, int subleaf); + + /* Go outside and wait on my untrusted event */ + [cdecl] int sgx_thread_wait_untrusted_event_ocall([user_check] const void *self); + + /* Wake a thread waiting on its untrusted event */ + [cdecl] int sgx_thread_set_untrusted_event_ocall([user_check] const void *waiter); + + /* Wake a thread waiting on its untrusted event, and wait on my untrusted event */ + [cdecl] int sgx_thread_setwait_untrusted_events_ocall([user_check] const void *waiter, [user_check] const void *self); + + /* Wake multiple threads waiting on their untrusted events */ + [cdecl] int sgx_thread_set_multiple_untrusted_events_ocall([in, count = total] const void **waiters, size_t total); + }; +}; diff --git a/common/inc/sgx_uae_service.h b/common/inc/sgx_uae_service.h new file mode 100644 index 0000000000..5380c59a57 --- /dev/null +++ b/common/inc/sgx_uae_service.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_UAE_SERVICE_H_ +#define _SGX_UAE_SERVICE_H_ + +#include + +#include "sgx_quote.h" +#include "sgx_error.h" +#include "sgx_urts.h" + +#define PS_CAP_TRUSTED_TIME 0x1 +#define PS_CAP_MONOTONIC_COUNTER 0x2 + +/** + * Platform service capabilities + * ps_cap0 + * Bit 0 : Trusted Time + * Bit 1 : Monotonic Counter + * Bit 2-31 : Reserved + * ps_cap1 + * Bit 0-31 : Reserved + */ +typedef struct _sgx_ps_cap_t +{ + uint32_t ps_cap0; + uint32_t ps_cap1; +} sgx_ps_cap_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Function used to initialize the process of quoting. + * + * @param p_target_info[out] Target info of quoting enclave. + * @param p_gid[out] ID of platform's current EPID group. + * @return If outputs are generated, return SGX_SCCUESS, otherwise return general error code + * or SGX_ERROR_AE_INVALID_EPIDBLOB to indicate special error condition. + */ +sgx_status_t SGXAPI sgx_init_quote( + sgx_target_info_t *p_target_info, + sgx_epid_group_id_t *p_gid); + + +/* + * Function used to get quote size. + * + * @param p_sig_rl[in] OPTIONAL Signature Revocation List. + * @param p_quote_size[out] Quote size, in bytes. + * @return If quote size is calculated,return SGX_SCCUESS, otherwise return + * SGX_ERROR_INVALID_PARAMETER to indicate special error condition. + */ +sgx_status_t SGXAPI sgx_get_quote_size( + const uint8_t *p_sig_rl, + uint32_t* p_quote_size); + +/* + * Function used to get quote. + * + * @param p_report[in] Report of enclave for which quote is being calculated. + * @param quote_type[in] Linkable or unlinkable quote. + * @param p_spid[in] Pointer of SPID. + * @param p_nonce[in] OPTIONAL nonce. + * @param p_sig_rl[in] OPTIONAL list of signature made fore EPID. + * @param sig_rl_size[in] The size of p_sig_rl, in bytes. + * @param p_qe_report[out] OPTIONAL The QE report. + * @param p_quote[out] The quote buffer, can not be NULL. + * @param quote_size[in] Quote buffer size, in bytes. + * @return If quote is generated,return SGX_SCCUESS, + * error code or SGX_ERROR_AE_INVALID_EPIDBLOB, + * SGX_ERROR_INVALID_PARAMETER to indicate special error condition. + * SGX_ERROR_EPID_MEMBER_REVOKED to indicate the EPID group membership has been revoked. + */ +sgx_status_t SGXAPI sgx_get_quote( + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sig_rl, + uint32_t sig_rl_size, + sgx_report_t *p_qe_report, + sgx_quote_t *p_quote, + uint32_t quote_size); + +/** + * Get the platform service capabilities + * + * @param sgx_ps_cap Platform capabilities reported by AESM. + * @return if OK, return SGX_SUCCESS + */ +sgx_status_t SGXAPI sgx_get_ps_cap(sgx_ps_cap_t* p_sgx_ps_cap); + +#define SGX_IS_TRUSTED_TIME_AVAILABLE(cap) ((((uint32_t)PS_CAP_TRUSTED_TIME)&((cap).ps_cap0))!=0) +#define SGX_IS_MONOTONIC_COUNTER_AVAILABLE(cap) ((((uint32_t)PS_CAP_MONOTONIC_COUNTER)&((cap).ps_cap0))!=0) + +/* + * Function used to report the status of the attestation. + * + * @param p_platform_info[in] platform information received from Intel Attestation Server. + * @param attestation_status[in] Value representing status during attestation. 0 if attestation succeeds. + * @param p_update_info[out] update information of the SGX platform. + * @return If OK, return SGX_SUCCESS. If update is needed, return SGX_ERROR_UPDATE_NEEDED and update_info contains update information. + */ + +sgx_status_t SGXAPI sgx_report_attestation_status( + const sgx_platform_info_t* p_platform_info, + int attestation_status, + sgx_update_info_bit_t* p_update_info); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_ukey_exchange.h b/common/inc/sgx_ukey_exchange.h new file mode 100644 index 0000000000..0f1e79f506 --- /dev/null +++ b/common/inc/sgx_ukey_exchange.h @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SGX_UKEY_EXCHANGE_H_ +#define _SGX_UKEY_EXCHANGE_H_ + +#include "sgx_eid.h" +#include "sgx_defs.h" +#include "sgx_key_exchange.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef sgx_status_t (* sgx_ecall_get_ga_trusted_t)( + sgx_enclave_id_t eid, + sgx_status_t* retval, + sgx_ra_context_t context, + sgx_ec256_public_t *g_a); + +typedef sgx_status_t (* sgx_ecall_proc_msg2_trusted_t)( + sgx_enclave_id_t eid, + sgx_status_t* retval, + sgx_ra_context_t context, + const sgx_ra_msg2_t *p_msg2, + const sgx_target_info_t *p_qe_target, + sgx_report_t *p_report, + sgx_quote_nonce_t* nonce); + +typedef sgx_status_t (* sgx_ecall_get_msg3_trusted_t)( + sgx_enclave_id_t eid, + sgx_status_t* retval, + sgx_ra_context_t context, + uint32_t quote_size, + sgx_report_t* qe_report, + sgx_ra_msg3_t *p_msg3, + uint32_t msg3_size); + +/* + * sgx_ra_get_msg1 is used to get the remote attestation and key exchange + * protocol message 1 to send to a service provider. The application enclave + * should use sgx_ra_init function to create the remote attestation and key + * exchange process context and return to the untrusted code, before the + * untrusted code can invoke this function. + * + * @param context Context returned by the sgx_ra_init function inside the + * application enclave. + * @param eid ID of the application enclave which is going to be + * attested. + * @param p_get_ga Function pointer of the ECALL proxy sgx_ra_get_ga + * generated by sgx_edger8r. The application enclave should + * link with sgx_tkey_exchange library and import + * sgx_tkey_exchange.edl in the enclave's EDL file to + * expose the ECALL proxy for sgx_ra_get_ga. + * @param p_msg1 Message 1 used by the remote attestation and key + * exchange protocol. + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Invalid input parameters + * detected. + * SGX_ERROR_AE_INVALID_EPIDBLOB The EPID blob is + * corrupted. + * SGX_ERROR_INVALID_STATE SGX API is invoked in + * incorrect order or + * state. + * SGX_ERROR_EPID_MEMBER_REVOKED The EPID group + * membership revoked. + * SGX_ERROR_BUSY The requested service is + * temporarily not + * available. + * SGX_ERROR_UPDATE_NEEDED SGX needs to be updated. + * SGX_ERROR_SERVICE_UNAVAILABLE The AE service did not + * respond. + * SGX_ERROR_SERVICE_TIMEOUT A request to the AE + * service timed out. + * SGX_ERROR_NETWORK_FAILURE Network connecting or + * proxy setting issue was + * encountered. + * SGX_ERROR_OUT_OF_MEMORY There is not enough + * memory available to + * complete this operation. + * SGX_ERROR_UNEXPECTED Indicates an unexpected + * error occurs. + * And other possible return code from sgx_ecall. + */ +sgx_status_t SGXAPI sgx_ra_get_msg1( + sgx_ra_context_t context, + sgx_enclave_id_t eid, + sgx_ecall_get_ga_trusted_t p_get_ga, + sgx_ra_msg1_t *p_msg1); + +/* + * sgx_ra_get_msg2 is used to process the remote attestation and key exchange + * protocol message 2 from the service provider and generate message 3 to send + * to the service provider. If the service provider accepts message 3, + * negotiated session keys between the application enclave and the service + * provider are ready for use. The application enclave can use sgx_ra_get_keys + * function to retrieve the negotiated keys and use sgx_ra_close function to + * release the context of the remote attestation and key exchange process. + * + * @param context Context returned by the sgx_ra_init function inside the + * application enclave. + * @param eid ID of the application enclave which is going to be + * attested. + * @param p_proc_msg2 Function pointer of the ECALL proxy sgx_ra_proc_msg2_trusted + * generated by sgx_edger8r. The application enclave should + * link with sgx_tkey_exchange library and import the + * sgx_tkey_exchange.edl in the application enclave's EDL + * file to expose the ECALL proxy for sgx_ra_get_msg2. + * @param p_get_msg3 Function pointer of the ECALL proxy sgx_ra_get_msg3_trusted + * generated by sgx_edger8r. The application enclave should + * link with sgx_tkey_exchange library and import the + * sgx_tkey_exchange.edl in the application enclave's EDL + * file to expose the ECALL proxy for sgx_ra_get_msg3. + * @param p_msg2 sgx_ra_msg2_t message 2 from the service provider + * received by application. + * @param msg2_size The length of msg2 (in bytes). + * @param pp_msg3 sgx_ra_msg3_t message 3 to be sent to the service + * provider. The message buffer is allocated by the + * sgx_ukey_exchange library. The caller should free the + * buffer after use. + * @param p_msg3_size The length of msg3 (in bytes). + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Invalid input parameters + * detected. + * SGX_ERROR_AE_INVALID_EPIDBLOB The EPID blob is + * corrupted. + * SGX_ERROR_INVALID_STATE SGX API is invoked in + * incorrect order or + * state. + * SGX_ERROR_EPID_MEMBER_REVOKED The EPID group + * membership revoked. + * SGX_ERROR_INVALID_SIGNATURE The signature is invalid. + * SGX_ERROR_MAC_MISMATCH Indicates verification + * error for reports, sealed + * data, etc. + * SGX_ERROR_KDF_MISMATCH Indicates key derivation + * function doesn't match. + * SGX_ERROR_BUSY The requested service is + * temporarily not + * available. + * SGX_ERROR_UPDATE_NEEDED SGX needs to be updated. + * SGX_ERROR_SERVICE_UNAVAILABLE The AE service did not + * respond. + * SGX_ERROR_SERVICE_TIMEOUT A request to the AE + * service timed out. + * SGX_ERROR_NETWORK_FAILURE Network connecting or + * proxy setting issue was + * encountered. + * SGX_ERROR_OUT_OF_MEMORY There is not enough + * memory available to + * complete this operation. + * SGX_ERROR_UNEXPECTED Indicates an unexpected + * error occurs. + * And other possible return code from sgx_ecall. + */ +sgx_status_t SGXAPI sgx_ra_proc_msg2( + sgx_ra_context_t context, + sgx_enclave_id_t eid, + sgx_ecall_proc_msg2_trusted_t p_proc_msg2, + sgx_ecall_get_msg3_trusted_t p_get_msg3, + const sgx_ra_msg2_t *p_msg2, + uint32_t msg2_size, + sgx_ra_msg3_t **pp_msg3, + uint32_t *p_msg3_size); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/sgx_urts.h b/common/inc/sgx_urts.h new file mode 100644 index 0000000000..c1bfa65183 --- /dev/null +++ b/common/inc/sgx_urts.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _SGX_URTS_H_ +#define _SGX_URTS_H_ + +#include "sgx_attributes.h" +#include "sgx_error.h" +#include "sgx_eid.h" +#include "sgx_defs.h" +#include "sgx_key.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint8_t sgx_launch_token_t[1024]; + +/* Convenient macro to be passed to sgx_create_enclave(). */ +#if !defined(NDEBUG) || defined(EDEBUG) +#define SGX_DEBUG_FLAG ((int)1) +#else +#define SGX_DEBUG_FLAG ((int)0) +#endif + +sgx_status_t SGXAPI sgx_create_enclave(const char *file_name, const int debug, sgx_launch_token_t *launch_token, int *launch_token_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr); + +sgx_status_t SGXAPI sgx_destroy_enclave(const sgx_enclave_id_t enclave_id); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/common/inc/sgx_utils.h b/common/inc/sgx_utils.h new file mode 100644 index 0000000000..0d8420b753 --- /dev/null +++ b/common/inc/sgx_utils.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +/** + * File: sgx_utils.h + * Description: + * Trusted library for SGX instructions + */ + +#ifndef _SGX_UTILS_H_ +#define _SGX_UTILS_H_ + +#include "sgx.h" +#include "sgx_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*sgx_create_report + * Purpose: Create a cryptographic report of the enclave using the input information if any. + * + * Parameters: + * target_info - [IN] pointer to the information of the target enclave. + * report_data - [IN] pointer to a set of data used for communication between the enclaves. + * report - [OUT] pointer to the cryptographic report of the enclave + * + * Return value: + * sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h. +*/ +sgx_status_t SGXAPI sgx_create_report(const sgx_target_info_t *target_info, const sgx_report_data_t *report_data, sgx_report_t *report); + +/* sgx_verify_report + * Purpose: Software verification for the input report + * + * Paramters: + * report - [IN] ponter to the cryptographic report to be verified. + * + * Return value: + * sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h. +*/ +sgx_status_t SGXAPI sgx_verify_report(const sgx_report_t *report); + +/*sgx_get_key + * Purpose: Generate a 128-bit secret key with the input information. + * + * Parameters: + * key_request - [IN] pointer to the sgx_key_request_t object used for selecting the appropriate key. + * key - [OUT] Pointer to the buffer that receives the cryptographic key output. + * + * Return value: + * sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h. +*/ +sgx_status_t SGXAPI sgx_get_key(const sgx_key_request_t *key_request, sgx_key_128bit_t *key); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/common/inc/stdc++/exception b/common/inc/stdc++/exception new file mode 100644 index 0000000000..0389bfd199 --- /dev/null +++ b/common/inc/stdc++/exception @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _EXCEPTION_ +#define _EXCEPTION_ + +#include +#include SGX_CXX_NATIVE_HEADER(exception) + +#endif /* _EXCEPTION_ */ diff --git a/common/inc/stdc++/linux/exception b/common/inc/stdc++/linux/exception new file mode 100644 index 0000000000..afcb0feac1 --- /dev/null +++ b/common/inc/stdc++/linux/exception @@ -0,0 +1,77 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_EXCEPTION_ +#define _LINUX_EXCEPTION_ + + +namespace std +{ + class exception + { + public: + exception() throw(); + exception(const exception&) throw(); + exception& operator=(const exception&) throw(); + virtual ~exception(); + virtual const char* what() const throw(); + }; + + /** + * Bad allocation exception. Thrown by ::operator new() if it fails. + */ + class bad_alloc: public exception + { + public: + bad_alloc() throw(); + bad_alloc(const bad_alloc&) throw(); + bad_alloc& operator=(const bad_alloc&) throw(); + ~bad_alloc(); + virtual const char* what() const throw(); + }; + + class bad_exception : public exception + { + public: + bad_exception() throw(); + virtual ~bad_exception() throw(); + virtual const char* what() const throw(); + }; + + bool uncaught_exception() throw(); + + typedef void (*unexpected_handler)(); + unexpected_handler set_unexpected(unexpected_handler) throw(); + void unexpected(); + + typedef void (*terminate_handler)(); + terminate_handler set_terminate(terminate_handler) throw(); + void terminate(); + +} // namespace std + + +#endif /* _LINUX_EXCEPTION_ */ diff --git a/common/inc/stdc++/linux/typeinfo b/common/inc/stdc++/linux/typeinfo new file mode 100644 index 0000000000..a32df180f6 --- /dev/null +++ b/common/inc/stdc++/linux/typeinfo @@ -0,0 +1,138 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUX_TYPEINFO_ +#define _LINUX_TYPEINFO_ + +#include +#include "exception" + +namespace __cxxabiv1 +{ + struct __class_type_info; +} +namespace std +{ + /** + * Standard type info class. The layout of this class is specified by the + * ABI. The layout of the vtable is not, but is intended to be + * compatible with the GNU ABI. + * + * Unlike the GNU version, the vtable layout is considered semi-private. + */ + class type_info + { + public: + /** + * Virtual destructor. This class must have one virtual function to + * ensure that it has a vtable. + */ + virtual ~type_info(); + bool operator==(const type_info &) const; + bool operator!=(const type_info &) const; + bool before(const type_info &) const; + const char* name() const; + type_info(); + private: + type_info(const type_info& rhs); + type_info& operator= (const type_info& rhs); + const char *__type_name; + /* + * The following functions are in this order to match the + * vtable layout of libsupc++. This allows libcxxrt to be used + * with libraries that depend on this. + * + * These functions are in the public headers for libstdc++, so + * we have to assume that someone will probably call them and + * expect them to work. Their names must also match the names used in + * libsupc++, so that code linking against this library can subclass + * type_info and correctly fill in the values in the vtables. + */ + public: + /** + * Returns true if this is some pointer type, false otherwise. + */ + virtual bool __is_pointer_p() const { return false; } + /** + * Returns true if this is some function type, false otherwise. + */ + virtual bool __is_function_p() const { return false; } + /** + * Catch function. Allows external libraries to implement + * their own basic types. This is used, for example, in the + * GNUstep Objective-C runtime to allow Objective-C types to be + * caught in G++ catch blocks. + * + * The outer parameter indicates the number of outer pointers + * in the high bits. The low bit indicates whether the + * pointers are const qualified. + */ + virtual bool __do_catch(const type_info *thrown_type, + void **thrown_object, + unsigned outer) const; + /** + * Performs an upcast. This is used in exception handling to + * cast from subclasses to superclasses. If the upcast is + * possible, it returns true and adjusts the pointer. If the + * upcast is not possible, it returns false and does not adjust + * the pointer. + */ + virtual bool __do_upcast( + const __cxxabiv1::__class_type_info *target, + void **thrown_object) const + { + (void)target, (void)thrown_object; + return false; + } + }; + + /** + * Bad cast exception. Thrown by the __cxa_bad_cast() helper function. + */ + class bad_cast: public exception { + public: + bad_cast() throw(); + bad_cast(const bad_cast&) throw(); + bad_cast& operator=(const bad_cast&) throw(); + virtual ~bad_cast(); + virtual const char* what() const throw(); + }; + + /** + * Bad typeidexception. Thrown by the __cxa_bad_typeid() helper function. + */ + class bad_typeid: public exception + { + public: + bad_typeid() throw(); + bad_typeid(const bad_typeid &__rhs) throw(); + virtual ~bad_typeid(); + bad_typeid& operator=(const bad_typeid &__rhs) throw(); + virtual const char* what() const throw(); + }; +} + +#endif /* _LINUX_TYPEINFO_ */ diff --git a/common/inc/stdc++/new b/common/inc/stdc++/new new file mode 100644 index 0000000000..fbf11fb67d --- /dev/null +++ b/common/inc/stdc++/new @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NEW_ +#define _NEW_ + +#include +#include +#include + + +namespace std +{ + typedef void (*new_handler)(); // The type of the function called when allocation fails. + + struct nothrow_t {}; // placement new tag type to suppress exceptions + const nothrow_t nothrow = {}; // constant for placement new tag + + /* + * The function to call when allocation fails. By default, there is no + * handler and a bad allocation exception is thrown if an allocation fails. + */ + new_handler set_new_handler(new_handler handler) throw(); +}; + +void* SGXAPI operator new (size_t) throw (std::bad_alloc); +void* SGXAPI operator new[] (size_t) throw (std::bad_alloc); + +void* SGXAPI operator new (size_t, const std::nothrow_t&) throw(); +void* SGXAPI operator new (size_t, void*) throw(); +void* SGXAPI operator new[] (size_t, const std::nothrow_t&) throw(); +void* SGXAPI operator new[] (size_t, void*) throw(); + +void SGXAPI operator delete (void*) throw (); +void SGXAPI operator delete (void*, const std::nothrow_t&) throw(); +void SGXAPI operator delete (void*, void*) throw(); +void SGXAPI operator delete[] (void*) throw (); +void SGXAPI operator delete[] (void*, const std::nothrow_t&) throw(); +void SGXAPI operator delete[] (void*, void*) throw(); + +#endif /* _NEW_ */ diff --git a/common/inc/stdc++/typeinfo b/common/inc/stdc++/typeinfo new file mode 100644 index 0000000000..fa9c05e737 --- /dev/null +++ b/common/inc/stdc++/typeinfo @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _TYPEINFO_ +#define _TYPEINFO_ + +#include +#include SGX_CXX_NATIVE_HEADER(typeinfo) + +#endif /* _TYPEINFO_ */ diff --git a/common/inc/tlibc/assert.h b/common/inc/tlibc/assert.h new file mode 100644 index 0000000000..82489e80c0 --- /dev/null +++ b/common/inc/tlibc/assert.h @@ -0,0 +1,63 @@ +/* $OpenBSD: assert.h,v 1.12 2006/01/31 10:53:51 hshoexer Exp $ */ +/* $NetBSD: assert.h,v 1.6 1994/10/26 00:55:44 cgd Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)assert.h 8.2 (Berkeley) 1/21/94 + */ + +/* + * Unlike other ANSI header files, may usefully be included + * multiple times, with and without NDEBUG defined. + */ + +#include + +#undef assert + +#ifdef NDEBUG +# define assert(e) ((void)0) +#else +# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, __func__, #e)) +#endif + +#ifndef _ASSERT_H_DECLS +#define _ASSERT_H_DECLS +__BEGIN_DECLS + +void _TLIBC_CDECL_ __assert(const char *, int, const char *, const char *); + +__END_DECLS +#endif /* Not _ASSERT_H_DECLS */ + diff --git a/common/inc/tlibc/complex.h b/common/inc/tlibc/complex.h new file mode 100644 index 0000000000..7d92d63e87 --- /dev/null +++ b/common/inc/tlibc/complex.h @@ -0,0 +1,134 @@ +/* $OpenBSD: complex.h,v 1.3 2010/07/24 22:17:03 guenther Exp $ */ +/* + * Copyright (c) 2008 Martynas Venckus + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _COMPLEX_H_ +#define _COMPLEX_H_ + +#include + +/* + * C99 + */ +#ifdef __GNUC__ +#if __STDC_VERSION__ < 199901 +#define _Complex __complex__ +#endif +#define _Complex_I 1.0fi +#elif defined(lint) +#define _Complex_I 1.0fi +#endif + +#define complex _Complex + +/* XXX switch to _Imaginary_I */ +#undef I +#define I _Complex_I + +__BEGIN_DECLS +/* + * Double versions of C99 functions + */ +double complex cacos(double complex); +double complex casin(double complex); +double complex catan(double complex); +double complex ccos(double complex); +double complex csin(double complex); +double complex ctan(double complex); +double complex cacosh(double complex); +double complex casinh(double complex); +double complex catanh(double complex); +double complex ccosh(double complex); +double complex csinh(double complex); +double complex ctanh(double complex); +double complex cexp(double complex); +double complex clog(double complex); +double cabs(double complex); +double complex cpow(double complex, double complex); +double complex csqrt(double complex); +double carg(double complex); +double cimag(double complex); +double complex conj(double complex); +double complex cproj(double complex); +double creal(double complex); +/* + * C99 reserved + */ +double complex clog10(double complex); + +/* + * Float versions of C99 functions + */ +float complex cacosf(float complex); +float complex casinf(float complex); +float complex catanf(float complex); +float complex ccosf(float complex); +float complex csinf(float complex); +float complex ctanf(float complex); +float complex cacoshf(float complex); +float complex casinhf(float complex); +float complex catanhf(float complex); +float complex ccoshf(float complex); +float complex csinhf(float complex); +float complex ctanhf(float complex); +float complex cexpf(float complex); +float complex clogf(float complex); +float cabsf(float complex); +float complex cpowf(float complex, float complex); +float complex csqrtf(float complex); +float cargf(float complex); +float cimagf(float complex); +float complex conjf(float complex); +float complex cprojf(float complex); +float crealf(float complex); +/* + * C99 reserved + */ +float complex clog10f(float complex); + +/* + * Long double versions of C99 functions + */ +long double complex cacosl(long double complex); +long double complex casinl(long double complex); +long double complex catanl(long double complex); +long double complex ccosl(long double complex); +long double complex csinl(long double complex); +long double complex ctanl(long double complex); +long double complex cacoshl(long double complex); +long double complex casinhl(long double complex); +long double complex catanhl(long double complex); +long double complex ccoshl(long double complex); +long double complex csinhl(long double complex); +long double complex ctanhl(long double complex); +long double complex cexpl(long double complex); +long double complex clogl(long double complex); +long double cabsl(long double complex); +long double complex cpowl(long double complex, long double complex); +long double complex csqrtl(long double complex); +long double cargl(long double complex); +long double cimagl(long double complex); +long double complex conjl(long double complex); +long double complex cprojl(long double complex); +long double creall(long double complex); +/* + * C99 reserved + */ +long double complex clog10l(long double complex); + +__END_DECLS + +#endif /* !_COMPLEX_H_ */ diff --git a/common/inc/tlibc/ctype.h b/common/inc/tlibc/ctype.h new file mode 100644 index 0000000000..1408447059 --- /dev/null +++ b/common/inc/tlibc/ctype.h @@ -0,0 +1,64 @@ +/* $OpenBSD: ctype.h,v 1.22 2010/10/01 20:10:24 guenther Exp $ */ +/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ctype.h 5.3 (Berkeley) 4/3/91 + */ + +#ifndef _CTYPE_H_ +#define _CTYPE_H_ + +#include + +__BEGIN_DECLS + +int _TLIBC_CDECL_ isalnum(int); +int _TLIBC_CDECL_ isalpha(int); +int _TLIBC_CDECL_ iscntrl(int); +int _TLIBC_CDECL_ isdigit(int); +int _TLIBC_CDECL_ isgraph(int); +int _TLIBC_CDECL_ islower(int); +int _TLIBC_CDECL_ isprint(int); +int _TLIBC_CDECL_ ispunct(int); +int _TLIBC_CDECL_ isspace(int); +int _TLIBC_CDECL_ isupper(int); +int _TLIBC_CDECL_ isxdigit(int); +int _TLIBC_CDECL_ tolower(int); +int _TLIBC_CDECL_ toupper(int); +int _TLIBC_CDECL_ isblank(int); + +__END_DECLS + +#endif /* _CTYPE_H_ */ diff --git a/common/inc/tlibc/endian.h b/common/inc/tlibc/endian.h new file mode 100644 index 0000000000..fcd74c9a14 --- /dev/null +++ b/common/inc/tlibc/endian.h @@ -0,0 +1,33 @@ +/* $OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $ */ + +/*- + * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +#include + +#endif /* _ENDIAN_H_ */ + diff --git a/common/inc/tlibc/errno.h b/common/inc/tlibc/errno.h new file mode 100644 index 0000000000..0924d5ac4b --- /dev/null +++ b/common/inc/tlibc/errno.h @@ -0,0 +1,187 @@ +/* $OpenBSD: errno.h,v 1.1 2005/12/28 16:33:56 millert Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)errno.h 8.5 (Berkeley) 1/21/94 + */ + +#ifndef _ERRNO_H_ +#define _ERRNO_H_ + +#include + +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define ERANGE 34 +#define EDEADLK 35 +#define ENAMETOOLONG 36 +#define ENOLCK 37 +#define ENOSYS 38 +#define ENOTEMPTY 39 +#define ELOOP 40 +#define EWOULDBLOCK EAGAIN +#define ENOMSG 42 +#define EIDRM 43 +#define ECHRNG 44 +#define EL2NSYNC 45 +#define EL3HLT 46 +#define EL3RST 47 +#define ELNRNG 48 +#define EUNATCH 49 +#define ENOCSI 50 +#define EL2HLT 51 +#define EBADE 52 +#define EBADR 53 +#define EXFULL 54 +#define ENOANO 55 +#define EBADRQC 56 +#define EBADSLT 57 +#define EDEADLOCK EDEADLK +#define EBFONT 59 +#define ENOSTR 60 +#define ENODATA 61 +#define ETIME 62 +#define ENOSR 63 +#define ENONET 64 +#define ENOPKG 65 +#define EREMOTE 66 +#define ENOLINK 67 +#define EADV 68 +#define ESRMNT 69 +#define ECOMM 70 +#define EPROTO 71 +#define EMULTIHOP 72 +#define EDOTDOT 73 +#define EBADMSG 74 +#define EOVERFLOW 75 +#define ENOTUNIQ 76 +#define EBADFD 77 +#define EREMCHG 78 +#define ELIBACC 79 +#define ELIBBAD 80 +#define ELIBSCN 81 +#define ELIBMAX 82 +#define ELIBEXEC 83 +#define EILSEQ 84 +#define ERESTART 85 +#define ESTRPIPE 86 +#define EUSERS 87 +#define ENOTSOCK 88 +#define EDESTADDRREQ 89 +#define EMSGSIZE 90 +#define EPROTOTYPE 91 +#define ENOPROTOOPT 92 +#define EPROTONOSUPPORT 93 +#define ESOCKTNOSUPPORT 94 +#define EOPNOTSUPP 95 +#define EPFNOSUPPORT 96 +#define EAFNOSUPPORT 97 +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 +#define ENETRESET 102 +#define ECONNABORTED 103 +#define ECONNRESET 104 +#define ENOBUFS 105 +#define EISCONN 106 +#define ENOTCONN 107 +#define ESHUTDOWN 108 +#define ETOOMANYREFS 109 +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 +#define ESTALE 116 +#define EUCLEAN 117 +#define ENOTNAM 118 +#define ENAVAIL 119 +#define EISNAM 120 +#define EREMOTEIO 121 +#define EDQUOT 122 +#define ENOMEDIUM 123 +#define EMEDIUMTYPE 124 +#define ECANCELED 125 +#define ENOKEY 126 +#define EKEYEXPIRED 127 +#define EKEYREVOKED 128 +#define EKEYREJECTED 129 +#define EOWNERDEAD 130 +#define ENOTRECOVERABLE 131 +#define ERFKILL 132 +#define EHWPOISON 133 +#define ENOTSUP EOPNOTSUPP + +__BEGIN_DECLS + +#ifndef errno +int * _TLIBC_CDECL_ __errno(void); +#define errno (*__errno()) +#endif /* errno */ +__END_DECLS + +#endif /* _ERRNO_H_ */ diff --git a/common/inc/tlibc/float.h b/common/inc/tlibc/float.h new file mode 100644 index 0000000000..99ae58de83 --- /dev/null +++ b/common/inc/tlibc/float.h @@ -0,0 +1,84 @@ +/* $OpenBSD: float.h,v 1.3 2008/07/21 20:50:54 martynas Exp $ */ +/* $NetBSD: float.h,v 1.8 1995/06/20 20:45:37 jtc Exp $ */ + +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)float.h 7.1 (Berkeley) 5/8/90 + */ + +#ifndef _FLOAT_H_ +#define _FLOAT_H_ + +#include + +#define FLT_RADIX 2 /* b */ + +// The rounding direction can be specified by fesetround() in +#define FLT_ROUNDS 1 /* addition rounding: near */ +#define DECIMAL_DIG 21 /* max precision in decimal digits */ + +// NOTE: FLT_EVAL_METHOD is -1 under FREEBSD x86. +#ifdef __i386__ +#define FLT_EVAL_METHOD 2 /* long double */ +#else +#define FLT_EVAL_METHOD 0 /* no promotions */ +#endif + +#define DBL_MANT_DIG 53 +#define DBL_EPSILON 2.2204460492503131E-16 +#define DBL_DIG 15 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN 2.2250738585072014E-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_EXP 1024 +#define DBL_MAX_10_EXP 308 + +#define FLT_MANT_DIG 24 /* p */ +#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ +#define FLT_MIN_EXP (-125) /* emin */ +#define FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */ +#define FLT_MAX_EXP 128 /* emax */ +#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ + +#define DBL_MAX 1.7976931348623157E+308 +#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ +#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ +#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ + +#define LDBL_MANT_DIG 64 +#define LDBL_EPSILON 1.08420217248550443401e-19L +#define LDBL_DIG 18 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.36210314311209350626e-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP 16384 +#define LDBL_MAX 1.18973149535723176502e+4932L +#define LDBL_MAX_10_EXP 4932 + +#endif /* _FLOAT_H_ */ diff --git a/common/inc/tlibc/inttypes.h b/common/inc/tlibc/inttypes.h new file mode 100644 index 0000000000..c4fbcafc32 --- /dev/null +++ b/common/inc/tlibc/inttypes.h @@ -0,0 +1,330 @@ +/* $OpenBSD: inttypes.h,v 1.10 2009/01/13 18:13:51 kettenis Exp $ */ + +/* + * Copyright (c) 1997, 2005 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _INTTYPES_H_ +#define _INTTYPES_H_ + +#include + +/* + * 7.8.1 Macros for format specifiers + * + * Each of the following object-like macros expands to a string + * literal containing a conversion specifier, possibly modified by + * a prefix such as hh, h, l, or ll, suitable for use within the + * format argument of a formatted input/output function when + * converting the corresponding integer type. These macro names + * have the general form of PRI (character string literals for the + * fprintf family) or SCN (character string literals for the fscanf + * family), followed by the conversion specifier, followed by a + * name corresponding to a similar typedef name. For example, + * PRIdFAST32 can be used in a format string to print the value of + * an integer of type int_fast32_t. + */ + +/* fprintf macros for signed integers */ +#define PRId8 "d" /* int8_t */ +#define PRId16 "d" /* int16_t */ +#define PRId32 "d" /* int32_t */ +#ifdef __x86_64__ +#define PRId64 "ld" /* int64_t */ +#else +#define PRId64 "lld" /* int64_t */ +#endif + +#define PRIdLEAST8 "d" /* int_least8_t */ +#define PRIdLEAST16 "d" /* int_least16_t */ +#define PRIdLEAST32 "d" /* int_least32_t */ +#ifdef __x86_64__ +#define PRIdLEAST64 "ld" /* int_least64_t */ +#else +#define PRIdLEAST64 "lld" /* int_least64_t */ +#endif + +#define PRIdFAST8 "d" /* int_fast8_t */ +#ifdef __x86_64__ +#define PRIdFAST16 "ld" /* int_fast16_t */ +#define PRIdFAST32 "ld" /* int_fast32_t */ +#define PRIdFAST64 "ld" /* int_fast64_t */ +#else +#define PRIdFAST16 "d" /* int_fast16_t */ +#define PRIdFAST32 "d" /* int_fast32_t */ +#define PRIdFAST64 "lld" /* int_fast64_t */ +#endif + +#ifdef __x86_64__ +#define PRIdMAX "ld" /* intmax_t */ +#else +#if defined(__i386__) +#define PRIdMAX "lld" /* intmax_t */ +#else +#define PRIdMAX "jd" /* intmax_t */ +#endif +#endif + +#ifdef __i386__ +#define PRIdPTR "d" /* intptr_t */ +#else +#define PRIdPTR "ld" /* intptr_t */ +#endif + +#define PRIi8 "i" /* int8_t */ +#define PRIi16 "i" /* int16_t */ +#define PRIi32 "i" /* int32_t */ +#ifdef __x86_64__ +#define PRIi64 "li" /* int64_t */ +#else +#define PRIi64 "lli" /* int64_t */ +#endif + +#define PRIiLEAST8 "i" /* int_least8_t */ +#define PRIiLEAST16 "i" /* int_least16_t */ +#define PRIiLEAST32 "i" /* int_least32_t */ +#ifdef __x86_64__ +#define PRIiLEAST64 "li" /* int_least64_t */ +#else +#define PRIiLEAST64 "lli" /* int_least64_t */ +#endif + +#define PRIiFAST8 "i" /* int_fast8_t */ +#ifdef __x86_64__ +#define PRIiFAST16 "li" /* int_fast16_t */ +#define PRIiFAST32 "li" /* int_fast32_t */ +#define PRIiFAST64 "li" /* int_fast64_t */ +#else +#define PRIiFAST16 "i" /* int_fast16_t */ +#define PRIiFAST32 "i" /* int_fast32_t */ +#define PRIiFAST64 "lli" /* int_fast64_t */ +#endif + +#ifdef __x86_64__ +#define PRIiMAX "li" /* intmax_t */ +#else +#if defined(__i386__) +#define PRIiMAX "lli" /* intmax_t */ +#else +#define PRIiMAX "ji" /* intmax_t */ +#endif +#endif + +#ifdef __i386__ +#define PRIiPTR "i" /* intptr_t */ +#else +#define PRIiPTR "li" /* intptr_t */ +#endif + +/* fprintf macros for unsigned integers */ +#define PRIo8 "o" /* int8_t */ +#define PRIo16 "o" /* int16_t */ +#define PRIo32 "o" /* int32_t */ +#ifdef __x86_64__ +#define PRIo64 "lo" /* int64_t */ +#else +#define PRIo64 "llo" /* int64_t */ +#endif + +#define PRIoLEAST8 "o" /* int_least8_t */ +#define PRIoLEAST16 "o" /* int_least16_t */ +#define PRIoLEAST32 "o" /* int_least32_t */ +#ifdef __x86_64__ +#define PRIoLEAST64 "lo" /* int_least64_t */ +#else +#define PRIoLEAST64 "llo" /* int_least64_t */ +#endif + +#define PRIoFAST8 "o" /* int_fast8_t */ +#ifdef __x86_64__ +#define PRIoFAST16 "lo" /* int_fast16_t */ +#define PRIoFAST32 "lo" /* int_fast32_t */ +#define PRIoFAST64 "lo" /* int_fast64_t */ +#else +#define PRIoFAST16 "o" /* int_fast16_t */ +#define PRIoFAST32 "o" /* int_fast32_t */ +#define PRIoFAST64 "llo" /* int_fast64_t */ +#endif + +#ifdef __x86_64__ +#define PRIoMAX "lo" /* intmax_t */ +#else +#if defined(__i386__) +#define PRIoMAX "llo" /* intmax_t */ +#else +#define PRIoMAX "jo" /* intmax_t */ +#endif +#endif + +#ifdef __i386__ +#define PRIoPTR "o" /* intptr_t */ +#else +#define PRIoPTR "lo" /* intptr_t */ +#endif + +#define PRIu8 "u" /* uint8_t */ +#define PRIu16 "u" /* uint16_t */ +#define PRIu32 "u" /* uint32_t */ + +#ifdef __x86_64__ +#define PRIu64 "lu" /* uint64_t */ +#else +#define PRIu64 "llu" /* uint64_t */ +#endif + +#define PRIuLEAST8 "u" /* uint_least8_t */ +#define PRIuLEAST16 "u" /* uint_least16_t */ +#define PRIuLEAST32 "u" /* uint_least32_t */ + +#ifdef __x86_64__ +#define PRIuLEAST64 "lu" /* uint_least64_t */ +#else +#define PRIuLEAST64 "llu" /* uint_least64_t */ +#endif + +#define PRIuFAST8 "u" /* uint_fast8_t */ + +#ifdef __x86_64__ +#define PRIuFAST16 "lu" /* uint_fast16_t */ +#define PRIuFAST32 "lu" /* uint_fast32_t */ +#define PRIuFAST64 "lu" /* uint_fast64_t */ +#else +#define PRIuFAST16 "u" /* uint_fast16_t */ +#define PRIuFAST32 "u" /* uint_fast32_t */ +#define PRIuFAST64 "llu" /* uint_fast64_t */ +#endif + +#ifdef __x86_64__ +#define PRIuMAX "lu" /* uintmax_t */ +#else +#if defined(__i386__) +#define PRIuMAX "llu" /* uintmax_t */ +#else +#define PRIuMAX "ju" /* uintmax_t */ +#endif +#endif + +#ifdef __i386__ +#define PRIuPTR "u" /* uintptr_t */ +#else +#define PRIuPTR "lu" /* uintptr_t */ +#endif + +#define PRIx8 "x" /* uint8_t */ +#define PRIx16 "x" /* uint16_t */ +#define PRIx32 "x" /* uint32_t */ +#ifdef __x86_64__ +#define PRIx64 "lx" /* uint64_t */ +#else +#define PRIx64 "llx" /* uint64_t */ +#endif + +#define PRIxLEAST8 "x" /* uint_least8_t */ +#define PRIxLEAST16 "x" /* uint_least16_t */ +#define PRIxLEAST32 "x" /* uint_least32_t */ +#ifdef __x86_64__ +#define PRIxLEAST64 "lx" /* uint_least64_t */ +#else +#define PRIxLEAST64 "llx" /* uint_least64_t */ +#endif + +#define PRIxFAST8 "x" /* uint_fast8_t */ +#ifdef __x86_64__ +#define PRIxFAST16 "lx" /* uint_fast16_t */ +#define PRIxFAST32 "lx" /* uint_fast32_t */ +#define PRIxFAST64 "lx" /* uint_fast64_t */ +#else +#define PRIxFAST16 "x" /* uint_fast16_t */ +#define PRIxFAST32 "x" /* uint_fast32_t */ +#define PRIxFAST64 "llx" /* uint_fast64_t */ +#endif + +#ifdef __x86_64__ +#define PRIxMAX "lx" /* uintmax_t */ +#else +#if defined(__i386__) +#define PRIxMAX "llx" /* uintmax_t */ +#else +#define PRIxMAX "jx" /* uintmax_t */ +#endif +#endif + +#ifdef __i386__ +#define PRIxPTR "x" /* uintptr_t */ +#else +#define PRIxPTR "lx" /* uintptr_t */ +#endif + +#define PRIX8 "X" /* uint8_t */ +#define PRIX16 "X" /* uint16_t */ +#define PRIX32 "X" /* uint32_t */ + +#ifdef __x86_64__ +#define PRIX64 "lX" /* uint64_t */ +#else +#define PRIX64 "llX" /* uint64_t */ +#endif + +#define PRIXLEAST8 "X" /* uint_least8_t */ +#define PRIXLEAST16 "X" /* uint_least16_t */ +#define PRIXLEAST32 "X" /* uint_least32_t */ +#ifdef __x86_64__ +#define PRIXLEAST64 "lX" /* uint_least64_t */ +#else +#define PRIXLEAST64 "llX" /* uint_least64_t */ +#endif + +#define PRIXFAST8 "X" /* uint_fast8_t */ +#ifdef __x86_64__ +#define PRIXFAST16 "lX" /* uint_fast16_t */ +#define PRIXFAST32 "lX" /* uint_fast32_t */ +#define PRIXFAST64 "lX" /* uint_fast64_t */ +#else +#define PRIXFAST16 "X" /* uint_fast16_t */ +#define PRIXFAST32 "X" /* uint_fast32_t */ +#define PRIXFAST64 "llX" /* uint_fast64_t */ +#endif + +#ifdef __x86_64__ +#define PRIXMAX "lX" /* uintmax_t */ +#else +#if defined(__i386__) +#define PRIXMAX "llX" /* uintmax_t */ +#else +#define PRIXMAX "jX" /* uintmax_t */ +#endif +#endif + +#ifdef __i386__ +#define PRIXPTR "X" /* uintptr_t */ +#else +#define PRIXPTR "lX" /* uintptr_t */ +#endif + +typedef struct { + intmax_t quot; /* quotient */ + intmax_t rem; /* remainder */ +} imaxdiv_t; + +__BEGIN_DECLS + +intmax_t _TLIBC_CDECL_ imaxabs(intmax_t); +imaxdiv_t _TLIBC_CDECL_ imaxdiv(intmax_t, intmax_t); +intmax_t _TLIBC_CDECL_ strtoimax(const char *, char **, int); +uintmax_t _TLIBC_CDECL_ strtoumax(const char *, char **, int); + +__END_DECLS + +#endif /* _INTTYPES_H_ */ diff --git a/common/inc/tlibc/iso646.h b/common/inc/tlibc/iso646.h new file mode 100644 index 0000000000..d711cace6d --- /dev/null +++ b/common/inc/tlibc/iso646.h @@ -0,0 +1,26 @@ +/* $OpenBSD: iso646.h,v 1.3 2001/10/11 00:05:21 espie Exp $ */ +/* $NetBSD: iso646.h,v 1.1 1995/02/17 09:08:10 jtc Exp $ */ + +/* + * Written by J.T. Conklin 02/16/95. + * Public domain. + */ + +#ifndef _ISO646_H_ +#define _ISO646_H_ + +#ifndef __cplusplus +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= +#endif + +#endif /* !_ISO646_H_ */ diff --git a/common/inc/tlibc/limits.h b/common/inc/tlibc/limits.h new file mode 100644 index 0000000000..fab59c9b8e --- /dev/null +++ b/common/inc/tlibc/limits.h @@ -0,0 +1,41 @@ +/* $OpenBSD: limits.h,v 1.15 2008/02/10 09:59:54 kettenis Exp $ */ +/* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */ + +/* + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 5.9 (Berkeley) 4/3/91 + */ + + +#ifndef _LIMITS_H_ +#define _LIMITS_H_ + +#include + +#endif /* !_LIMITS_H_ */ diff --git a/common/inc/tlibc/math.h b/common/inc/tlibc/math.h new file mode 100644 index 0000000000..104ac7f156 --- /dev/null +++ b/common/inc/tlibc/math.h @@ -0,0 +1,430 @@ +/* $OpenBSD: math.h,v 1.27 2010/12/14 11:16:15 martynas Exp $ */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * from: @(#)fdlibm.h 5.1 93/09/24 + */ + +#ifndef _MATH_H_ +#define _MATH_H_ + +#include +#include +#include + +#include + +typedef __float_t float_t; +typedef __double_t double_t; + +#define FP_NAN 0x00 +#define FP_INFINITE 0x01 +#define FP_ZERO 0x02 +#define FP_SUBNORMAL 0x03 +#define FP_NORMAL 0x04 + +#define FP_ILOGB0 (-INT_MAX - 1) +#define FP_ILOGBNAN (-INT_MAX - 1) + +#define fpclassify(x) \ + ((sizeof (x) == sizeof (float)) ? \ + __fpclassifyf(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __fpclassify(x) \ + : __fpclassifyl(x)) +#define isfinite(x) \ + ((sizeof (x) == sizeof (float)) ? \ + __isfinitef(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __isfinite(x) \ + : __isfinitel(x)) +#define isnormal(x) \ + ((sizeof (x) == sizeof (float)) ? \ + __isnormalf(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __isnormal(x) \ + : __isnormall(x)) +#define signbit(x) \ + ((sizeof (x) == sizeof (float)) ? \ + __signbitf(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __signbit(x) \ + : __signbitl(x)) +#define isinf(x) \ + ((sizeof (x) == sizeof (float)) ? \ + __isinff(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __isinf(x) \ + : __isinfl(x)) +#define isnan(x) \ + ((sizeof (x) == sizeof (float)) ? \ + __isnanf(x) \ + : (sizeof (x) == sizeof (double)) ? \ + __isnan(x) \ + : __isnanl(x)) + +#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y)) +#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y)) +#define isless(x, y) (!isunordered((x), (y)) && (x) < (y)) +#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y)) +#define islessgreater(x, y) (!isunordered((x), (y)) && ((x) > (y) || (y) > (x))) +#define isunordered(x, y) (isnan(x) || isnan(y)) + +__BEGIN_DECLS + +extern char __infinity[]; +#define HUGE_VAL (*(double *)(void *)__infinity) +#define HUGE_VALF ((float)HUGE_VAL) +#define HUGE_VALL ((long double)HUGE_VAL) +#define INFINITY HUGE_VALF +extern char __nan[]; +#define NAN (*(float *)(void *)__nan) + +/* + * ANSI/POSIX + */ +double _TLIBC_CDECL_ acos(double); +double _TLIBC_CDECL_ asin(double); +double _TLIBC_CDECL_ atan(double); +double _TLIBC_CDECL_ atan2(double, double); +double _TLIBC_CDECL_ cos(double); +double _TLIBC_CDECL_ sin(double); +double _TLIBC_CDECL_ tan(double); + +double _TLIBC_CDECL_ cosh(double); +double _TLIBC_CDECL_ sinh(double); +double _TLIBC_CDECL_ tanh(double); + +double _TLIBC_CDECL_ exp(double); +double _TLIBC_CDECL_ frexp(double, int *); +double _TLIBC_CDECL_ ldexp(double, int); +double _TLIBC_CDECL_ log(double); +double _TLIBC_CDECL_ log10(double); +double _TLIBC_CDECL_ modf(double, double *); + +double _TLIBC_CDECL_ pow(double, double); +double _TLIBC_CDECL_ sqrt(double); + +double _TLIBC_CDECL_ ceil(double); +double _TLIBC_CDECL_ fabs(double); +double _TLIBC_CDECL_ floor(double); +double _TLIBC_CDECL_ fmod(double, double); + +/* + * C99 + */ +double _TLIBC_CDECL_ acosh(double); +double _TLIBC_CDECL_ asinh(double); +double _TLIBC_CDECL_ atanh(double); + +double _TLIBC_CDECL_ exp2(double); +double _TLIBC_CDECL_ expm1(double); +int _TLIBC_CDECL_ ilogb(double); +double _TLIBC_CDECL_ log1p(double); +double _TLIBC_CDECL_ log2(double); +double _TLIBC_CDECL_ logb(double); +double _TLIBC_CDECL_ scalbn(double, int); +double _TLIBC_CDECL_ scalbln(double, long int); + +double _TLIBC_CDECL_ cbrt(double); +double _TLIBC_CDECL_ hypot(double, double); + +double _TLIBC_CDECL_ erf(double); +double _TLIBC_CDECL_ erfc(double); +double _TLIBC_CDECL_ lgamma(double); +double _TLIBC_CDECL_ tgamma(double); + +double _TLIBC_CDECL_ nearbyint(double); +double _TLIBC_CDECL_ rint(double); +long int _TLIBC_CDECL_ lrint(double); +long long int _TLIBC_CDECL_ llrint(double); +double _TLIBC_CDECL_ round(double); +long int _TLIBC_CDECL_ lround(double); +long long int _TLIBC_CDECL_ llround(double); +double _TLIBC_CDECL_ trunc(double); + +double _TLIBC_CDECL_ remainder(double, double); +double _TLIBC_CDECL_ remquo(double, double, int *); + +double _TLIBC_CDECL_ copysign(double, double); +double _TLIBC_CDECL_ nan(const char *); +double _TLIBC_CDECL_ nextafter(double, double); + +double _TLIBC_CDECL_ fdim(double, double); +double _TLIBC_CDECL_ fmax(double, double); +double _TLIBC_CDECL_ fmin(double, double); + +double _TLIBC_CDECL_ fma(double, double, double); + +/* + * Float versions of C99 functions + */ + +float _TLIBC_CDECL_ acosf(float); +float _TLIBC_CDECL_ asinf(float); +float _TLIBC_CDECL_ atanf(float); +float _TLIBC_CDECL_ atan2f(float, float); +float _TLIBC_CDECL_ cosf(float); +float _TLIBC_CDECL_ sinf(float); +float _TLIBC_CDECL_ tanf(float); + +float _TLIBC_CDECL_ acoshf(float); +float _TLIBC_CDECL_ asinhf(float); +float _TLIBC_CDECL_ atanhf(float); +float _TLIBC_CDECL_ coshf(float); +float _TLIBC_CDECL_ sinhf(float); +float _TLIBC_CDECL_ tanhf(float); + +float _TLIBC_CDECL_ expf(float); +float _TLIBC_CDECL_ exp2f(float); +float _TLIBC_CDECL_ expm1f(float); +float _TLIBC_CDECL_ frexpf(float, int *); +int _TLIBC_CDECL_ ilogbf(float); +float _TLIBC_CDECL_ ldexpf(float, int); +float _TLIBC_CDECL_ logf(float); +float _TLIBC_CDECL_ log10f(float); +float _TLIBC_CDECL_ log1pf(float); +float _TLIBC_CDECL_ log2f(float); +float _TLIBC_CDECL_ logbf(float); +float _TLIBC_CDECL_ modff(float, float *); +float _TLIBC_CDECL_ scalbnf(float, int); +float _TLIBC_CDECL_ scalblnf(float, long int); + +float _TLIBC_CDECL_ cbrtf(float); +float _TLIBC_CDECL_ fabsf(float); +float _TLIBC_CDECL_ hypotf(float, float); +float _TLIBC_CDECL_ powf(float, float); +float _TLIBC_CDECL_ sqrtf(float); + +float _TLIBC_CDECL_ erff(float); +float _TLIBC_CDECL_ erfcf(float); +float _TLIBC_CDECL_ lgammaf(float); +float _TLIBC_CDECL_ tgammaf(float); + +float _TLIBC_CDECL_ ceilf(float); +float _TLIBC_CDECL_ floorf(float); +float _TLIBC_CDECL_ nearbyintf(float); + +float _TLIBC_CDECL_ rintf(float); +long int _TLIBC_CDECL_ lrintf(float); +long long int _TLIBC_CDECL_ llrintf(float); +float _TLIBC_CDECL_ roundf(float); +long int _TLIBC_CDECL_ lroundf(float); +long long int _TLIBC_CDECL_ llroundf(float); +float _TLIBC_CDECL_ truncf(float); + +float _TLIBC_CDECL_ fmodf(float, float); +float _TLIBC_CDECL_ remainderf(float, float); +float _TLIBC_CDECL_ remquof(float, float, int *); + +float _TLIBC_CDECL_ copysignf(float, float); +float _TLIBC_CDECL_ nanf(const char *); +float _TLIBC_CDECL_ nextafterf(float, float); + +float _TLIBC_CDECL_ fdimf(float, float); +float _TLIBC_CDECL_ fmaxf(float, float); +float _TLIBC_CDECL_ fminf(float, float); + +float _TLIBC_CDECL_ fmaf(float, float, float); + +/* + * Long double versions of C99 functions + */ + +/* Macros defining long double functions to be their double counterparts + * (long double is synonymous with double in this implementation). + */ + +long double _TLIBC_CDECL_ acosl(long double); +long double _TLIBC_CDECL_ asinl(long double); +long double _TLIBC_CDECL_ atanl(long double); +long double _TLIBC_CDECL_ atan2l(long double, long double); +long double _TLIBC_CDECL_ cosl(long double); +long double _TLIBC_CDECL_ sinl(long double); +long double _TLIBC_CDECL_ tanl(long double); + +long double _TLIBC_CDECL_ acoshl(long double); +long double _TLIBC_CDECL_ asinhl(long double); +long double _TLIBC_CDECL_ atanhl(long double); +long double _TLIBC_CDECL_ coshl(long double); +long double _TLIBC_CDECL_ sinhl(long double); +long double _TLIBC_CDECL_ tanhl(long double); + +long double _TLIBC_CDECL_ expl(long double); +long double _TLIBC_CDECL_ exp2l(long double); +long double _TLIBC_CDECL_ expm1l(long double); +long double _TLIBC_CDECL_ frexpl(long double, int *); +int _TLIBC_CDECL_ ilogbl(long double); +long double _TLIBC_CDECL_ ldexpl(long double, int); +long double _TLIBC_CDECL_ logl(long double); +long double _TLIBC_CDECL_ log10l(long double); +long double _TLIBC_CDECL_ log1pl(long double); +long double _TLIBC_CDECL_ log2l(long double); +long double _TLIBC_CDECL_ logbl(long double); +long double _TLIBC_CDECL_ modfl(long double, long double *); +long double _TLIBC_CDECL_ scalbnl(long double, int); +long double _TLIBC_CDECL_ scalblnl(long double, long int); + +long double _TLIBC_CDECL_ cbrtl(long double); +long double _TLIBC_CDECL_ fabsl(long double); +long double _TLIBC_CDECL_ hypotl(long double, long double); +long double _TLIBC_CDECL_ powl(long double, long double); +long double _TLIBC_CDECL_ sqrtl(long double); + +long double _TLIBC_CDECL_ erfl(long double); +long double _TLIBC_CDECL_ erfcl(long double); +long double _TLIBC_CDECL_ lgammal(long double); +long double _TLIBC_CDECL_ tgammal(long double); + +long double _TLIBC_CDECL_ ceill(long double); +long double _TLIBC_CDECL_ floorl(long double); +long double _TLIBC_CDECL_ nearbyintl(long double); +long double _TLIBC_CDECL_ rintl(long double); +long int _TLIBC_CDECL_ lrintl(long double); +long long int _TLIBC_CDECL_ llrintl(long double); +long double _TLIBC_CDECL_ roundl(long double); +long int _TLIBC_CDECL_ lroundl(long double); +long long int _TLIBC_CDECL_ llroundl(long double); +long double _TLIBC_CDECL_ truncl(long double); + +long double _TLIBC_CDECL_ fmodl(long double, long double); +long double _TLIBC_CDECL_ remainderl(long double, long double); +long double _TLIBC_CDECL_ remquol(long double, long double, int *); + +long double _TLIBC_CDECL_ copysignl(long double, long double); +long double _TLIBC_CDECL_ nanl(const char *); +long double _TLIBC_CDECL_ nextafterl(long double, long double); + +long double _TLIBC_CDECL_ fdiml(long double, long double); +long double _TLIBC_CDECL_ fmaxl(long double, long double); +long double _TLIBC_CDECL_ fminl(long double, long double); +long double _TLIBC_CDECL_ fmal(long double, long double, long double); + +/* nexttoward(): +* The implementation in Intel math library is incompatible with MSVC. +* Because sizeof(long double) is 8bytes with MSVC, +* but the expected long double size is 10bytes. +* And by default, MSVC doesn't provide nexttoward(). +* So we only provide Linux version here. +*/ +double _TLIBC_CDECL_ nexttoward(double, long double); +float _TLIBC_CDECL_ nexttowardf(float, long double); + +long double _TLIBC_CDECL_ nexttowardl(long double, long double); + +/* + * Library implementation + */ +int _TLIBC_CDECL_ __fpclassify(double); +int _TLIBC_CDECL_ __fpclassifyf(float); +int _TLIBC_CDECL_ __isfinite(double); +int _TLIBC_CDECL_ __isfinitef(float); +int _TLIBC_CDECL_ __isinf(double); +int _TLIBC_CDECL_ __isinff(float); +int _TLIBC_CDECL_ __isnan(double); +int _TLIBC_CDECL_ __isnanf(float); +int _TLIBC_CDECL_ __isnormal(double); +int _TLIBC_CDECL_ __isnormalf(float); +int _TLIBC_CDECL_ __signbit(double); +int _TLIBC_CDECL_ __signbitf(float); + +int _TLIBC_CDECL_ __fpclassifyl(long double); +int _TLIBC_CDECL_ __isfinitel(long double); +int _TLIBC_CDECL_ __isinfl(long double); +int _TLIBC_CDECL_ __isnanl(long double); +int _TLIBC_CDECL_ __isnormall(long double); +int _TLIBC_CDECL_ __signbitl(long double); + +/* + * Non-C99 functions. + */ +double _TLIBC_CDECL_ drem(double, double); +double _TLIBC_CDECL_ exp10(double); +double _TLIBC_CDECL_ gamma(double); +double _TLIBC_CDECL_ gamma_r(double, int *); +double _TLIBC_CDECL_ j0(double); +double _TLIBC_CDECL_ j1(double); +double _TLIBC_CDECL_ jn(int, double); +double _TLIBC_CDECL_ lgamma_r(double, int *); +double _TLIBC_CDECL_ pow10(double); +double _TLIBC_CDECL_ scalb(double, double); +/* C99 Macro signbit.*/ +double _TLIBC_CDECL_ significand(double); +void _TLIBC_CDECL_ sincos(double, double *, double *); +double _TLIBC_CDECL_ y0(double); +double _TLIBC_CDECL_ y1(double); +double _TLIBC_CDECL_ yn(int, double); +/* C99 Macro isinf.*/ +/* C99 Macro isnan.*/ +int _TLIBC_CDECL_ finite(double); + +float _TLIBC_CDECL_ dremf(float, float); +float _TLIBC_CDECL_ exp10f(float); +float _TLIBC_CDECL_ gammaf(float); +float _TLIBC_CDECL_ gammaf_r(float, int *); +float _TLIBC_CDECL_ j0f(float); +float _TLIBC_CDECL_ j1f(float); +float _TLIBC_CDECL_ jnf(int, float); +float _TLIBC_CDECL_ lgammaf_r(float, int *); +float _TLIBC_CDECL_ pow10f(float); +float _TLIBC_CDECL_ scalbf(float, float); +int _TLIBC_CDECL_ signbitf(float); +float _TLIBC_CDECL_ significandf(float); +void _TLIBC_CDECL_ sincosf(float, float *, float *); +float _TLIBC_CDECL_ y0f(float); +float _TLIBC_CDECL_ y1f(float); +float _TLIBC_CDECL_ ynf(int, float); +int _TLIBC_CDECL_ finitef(float); +int _TLIBC_CDECL_ isinff(float); +int _TLIBC_CDECL_ isnanf(float); + +long double _TLIBC_CDECL_ dreml(long double, long double); +long double _TLIBC_CDECL_ exp10l(long double); +long double _TLIBC_CDECL_ gammal(long double); +long double _TLIBC_CDECL_ gammal_r(long double, int *); +long double _TLIBC_CDECL_ j0l(long double); +long double _TLIBC_CDECL_ j1l(long double); +long double _TLIBC_CDECL_ jnl(int, long double); +long double _TLIBC_CDECL_ lgammal_r(long double, int *); +long double _TLIBC_CDECL_ pow10l(long double); +long double _TLIBC_CDECL_ scalbl(long double, long double); +int _TLIBC_CDECL_ signbitl(long double); +long double _TLIBC_CDECL_ significandl(long double); +void _TLIBC_CDECL_ sincosl(long double, long double *, long double *); +long double _TLIBC_CDECL_ y1l(long double); +long double _TLIBC_CDECL_ y0l(long double); +long double _TLIBC_CDECL_ ynl(int, long double); +int _TLIBC_CDECL_ finitel(long double); +int _TLIBC_CDECL_ isinfl(long double); +int _TLIBC_CDECL_ isnanl(long double); + +/* + * TODO: From Intel Decimal Floating-Point Math Library + * signbitd32/signbitd64/signbitd128, finited32/finited64/finited128 + * isinfd32/isinfd64/isinfd128, isnand32/isnand64/isnand128 + */ +#if defined(__cplusplus) +/* Clang does not support decimal floating point types. + * + * c.f.: + * http://clang.llvm.org/docs/UsersManual.html#gcc-extensions-not-implemented-yet + */ +#if !defined(__clang__) +typedef float _Decimal32 __attribute__((mode(SD))); +typedef float _Decimal64 __attribute__((mode(DD))); +typedef float _Decimal128 __attribute__((mode(TD))); +#endif +#endif + +__END_DECLS + +#endif /* !_MATH_H_ */ diff --git a/common/inc/tlibc/stdarg.h b/common/inc/tlibc/stdarg.h new file mode 100644 index 0000000000..ed73e246a6 --- /dev/null +++ b/common/inc/tlibc/stdarg.h @@ -0,0 +1,48 @@ +/* $OpenBSD: stdarg.h,v 1.14 2010/12/30 05:01:36 tedu Exp $ */ +/* $NetBSD: stdarg.h,v 1.12 1995/12/25 23:15:31 mycroft Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _STDARG_H_ +#define _STDARG_H_ + +#include +#include + +typedef __va_list va_list; + +#define va_start(ap, last) __builtin_va_start((ap), last) +#define va_end __builtin_va_end +#define va_arg __builtin_va_arg +#define va_copy(dst, src) __builtin_va_copy((dst),(src)) + +#endif /* !_STDARG_H_ */ diff --git a/common/inc/tlibc/stdbool.h b/common/inc/tlibc/stdbool.h new file mode 100644 index 0000000000..bd1837ec46 --- /dev/null +++ b/common/inc/tlibc/stdbool.h @@ -0,0 +1,44 @@ +/* $OpenBSD: stdbool.h,v 1.5 2010/07/24 22:17:03 guenther Exp $ */ + +/* + * Written by Marc Espie, September 25, 1999 + * Public domain. + */ + +#ifndef _STDBOOL_H_ +#define _STDBOOL_H_ + +#ifndef __cplusplus + +#ifndef __GNUC__ +/* Support for _C99: type _Bool is already built-in. */ +/* `_Bool' type must promote to `int' or `unsigned int'. */ +typedef enum { + false = 0, + true = 1 +} _Bool; + +/* And those constants must also be available as macros. */ +# define false false +# define true true +#else /* __GNUC__ */ +# define false 0 +# define true 1 +#endif + +/* User visible type `bool' is provided as a macro which may be redefined */ +#define bool _Bool + +#else /* __cplusplus */ + +# define _Bool bool +# define bool bool +# define false false +# define true true + +#endif + +/* Inform that everything is fine */ +#define __bool_true_false_are_defined 1 + +#endif /* _STDBOOL_H_ */ diff --git a/common/inc/tlibc/stddef.h b/common/inc/tlibc/stddef.h new file mode 100644 index 0000000000..84509c5025 --- /dev/null +++ b/common/inc/tlibc/stddef.h @@ -0,0 +1,70 @@ +/* $OpenBSD: stddef.h,v 1.10 2009/09/22 21:40:02 jsg Exp $ */ +/* $NetBSD: stddef.h,v 1.4 1994/10/26 00:56:26 cgd Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stddef.h 5.5 (Berkeley) 4/3/91 + */ + +#ifndef _STDDEF_H_ +#define _STDDEF_H_ + +#include +#include + +#ifndef _PTRDIFF_T_DEFINED_ +#define _PTRDIFF_T_DEFINED_ +typedef __ptrdiff_t ptrdiff_t; +#endif + +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef __size_t size_t; +#endif + +#if !defined(_WCHAR_T_DEFINED_) && !defined(__cplusplus) +#define _WCHAR_T_DEFINED_ +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) + +#endif /* _STDDEF_H_ */ + diff --git a/common/inc/tlibc/stdint.h b/common/inc/tlibc/stdint.h new file mode 100644 index 0000000000..d283ae9214 --- /dev/null +++ b/common/inc/tlibc/stdint.h @@ -0,0 +1,24 @@ +/* $OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $ */ + +/* + * Copyright (c) 1997, 2005 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _STDINT_H_ +#define _STDINT_H_ + +#include + +#endif /* _STDINT_H_ */ diff --git a/common/inc/tlibc/stdio.h b/common/inc/tlibc/stdio.h new file mode 100644 index 0000000000..0175a3ace3 --- /dev/null +++ b/common/inc/tlibc/stdio.h @@ -0,0 +1,95 @@ +/* $OpenBSD: stdio.h,v 1.38 2009/11/09 00:18:27 kurt Exp $ */ +/* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdio.h 5.17 (Berkeley) 6/3/91 + */ + +#ifndef _STDIO_H_ +#define _STDIO_H_ + +#include +#include + +#include + +#ifndef _SIZE_T_DEFINED_ +typedef __size_t size_t; +#define _SIZE_T_DEFINED_ +#endif + +#ifndef NULL +# ifdef __cplusplus +# define NULL 0 +# else +# define NULL ((void *)0) +# endif +#endif + +# define BUFSIZ 8192 + +#define EOF (-1) + +__BEGIN_DECLS + +int _TLIBC_CDECL_ snprintf(char *, size_t, const char *, ...) _GCC_PRINTF_FORMAT_(3, 4); +int _TLIBC_CDECL_ vsnprintf(char *, size_t, const char *, __va_list) _GCC_PRINTF_FORMAT_(3, 0); + +/* + * Deprecated definitions. + */ +#if 0 /* No FILE */ +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, fprintf, FILE *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, putc, int, FILE *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, fputc, int, FILE *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, fputs, const char *, FILE *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, fscanf, FILE *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(size_t _TLIBC_CDECL_, fwrite, const void *, size_t, size_t, FILE *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, printf, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, putchar, int); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, puts, const char *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, scanf, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, sprintf, char *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, sscanf, const char *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, vfprintf, FILE *, const char *, __va_list); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, vfscanf, FILE *, const char *, __va_list); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, vprintf, const char *, __va_list); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, vscanf, const char *, __va_list); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, vsprintf, char *, const char *, __va_list); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, vsscanf, const char *, const char *, __va_list); +#endif + +__END_DECLS + + +#endif /* !_STDIO_H_ */ diff --git a/common/inc/tlibc/stdlib.h b/common/inc/tlibc/stdlib.h new file mode 100644 index 0000000000..8a851db09b --- /dev/null +++ b/common/inc/tlibc/stdlib.h @@ -0,0 +1,159 @@ +/* $OpenBSD: stdlib.h,v 1.47 2010/05/18 22:24:55 tedu Exp $ */ +/* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ + +/*- +* Copyright (c) 1990 The Regents of the University of California. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. Neither the name of the University nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +* @(#)stdlib.h 5.13 (Berkeley) 6/4/91 +*/ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#include +#include + +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef __size_t size_t; +#endif + +#ifdef _TLIBC_WIN_ +#if !defined(_WCHAR_T_DEFINED) && !defined (_NATIVE_WCHAR_T_DEFINED) +#define _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +#endif +#else +#if !defined(_WCHAR_T_DEFINED_) && !defined(__cplusplus) +#define _WCHAR_T_DEFINED_ +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; +#endif +#endif + +#ifndef _DIV_T_DEFINED +typedef struct { + int quot; /* quotient */ + int rem; /* remainder */ +} div_t; + +typedef struct { + long quot; /* quotient */ + long rem; /* remainder */ +} ldiv_t; + +typedef struct { + long long quot; /* quotient */ + long long rem; /* remainder */ +} lldiv_t; +#define _DIV_T_DEFINED +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define RAND_MAX 0x7fffffff +#define MB_CUR_MAX 1 + +__BEGIN_DECLS + +_TLIBC_NORETURN_ void _TLIBC_CDECL_ abort(void); +int _TLIBC_CDECL_ abs(int); +double _TLIBC_CDECL_ atof(const char *); +int _TLIBC_CDECL_ atoi(const char *); +long _TLIBC_CDECL_ atol(const char *); +void * _TLIBC_CDECL_ bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); +void * _TLIBC_CDECL_ calloc(size_t, size_t); +div_t _TLIBC_CDECL_ div(int, int); +void _TLIBC_CDECL_ free(void *); +long _TLIBC_CDECL_ labs(long); +ldiv_t _TLIBC_CDECL_ ldiv(long, long); +void * _TLIBC_CDECL_ malloc(size_t); +void * _TLIBC_CDECL_ memalign(size_t, size_t); +void _TLIBC_CDECL_ qsort(void *, size_t, size_t, int (*)(const void *, const void *)); +void * _TLIBC_CDECL_ realloc(void *, size_t); +double _TLIBC_CDECL_ strtod(const char *, char **); +long _TLIBC_CDECL_ strtol(const char *, char **, int); +float _TLIBC_CDECL_ strtof(const char *, char **); + +long long + _TLIBC_CDECL_ atoll(const char *); +long long + _TLIBC_CDECL_ llabs(long long); +lldiv_t + _TLIBC_CDECL_ lldiv(long long, long long); +long long + _TLIBC_CDECL_ strtoll(const char *, char **, int); +unsigned long + _TLIBC_CDECL_ strtoul(const char *, char **, int); +long double + _TLIBC_CDECL_ strtold(const char *, char **); +unsigned long long + _TLIBC_CDECL_ strtoull(const char *, char **, int); + +int _TLIBC_CDECL_ mblen(const char *, size_t); +size_t _TLIBC_CDECL_ mbstowcs(wchar_t *, const char *, size_t); +int _TLIBC_CDECL_ wctomb(char *, wchar_t); +int _TLIBC_CDECL_ mbtowc(wchar_t *, const char *, size_t); +size_t _TLIBC_CDECL_ wcstombs(char *, const wchar_t *, size_t); + + +/* + * Deprecated C99. + */ +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, atexit, void (_TLIBC_CDECL_ *)(void)); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, rand, void); +_TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, srand, unsigned); +_TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, exit, int); +_TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, _Exit, int); +_TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, getenv, const char *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, system, const char *); + +/* + * Non-C99 Functions. + */ +void * _TLIBC_CDECL_ alloca(size_t); + +/* + * Deprecated Non-C99. + */ +//_TLIBC_DEPRECATED_FUNCTION_(void _TLIBC_CDECL_, _exit, int); + +__END_DECLS + +#endif /* !_STDLIB_H_ */ diff --git a/common/inc/tlibc/string.h b/common/inc/tlibc/string.h new file mode 100644 index 0000000000..c8e458f477 --- /dev/null +++ b/common/inc/tlibc/string.h @@ -0,0 +1,125 @@ +/* $OpenBSD: string.h,v 1.20 2010/09/24 13:33:00 matthew Exp $ */ +/* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)string.h 5.10 (Berkeley) 3/9/91 + */ + +#ifndef _STRING_H_ +#define _STRING_H_ + +#include +#include + +#ifndef _SIZE_T_DEFINED_ +typedef __size_t size_t; +#define _SIZE_T_DEFINED_ +#endif + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +__BEGIN_DECLS + +void * _TLIBC_CDECL_ memchr(const void *, int, size_t); +int _TLIBC_CDECL_ memcmp(const void *, const void *, size_t); +void * _TLIBC_CDECL_ memcpy(void *, const void *, size_t); +void * _TLIBC_CDECL_ memmove(void *, const void *, size_t); +void * _TLIBC_CDECL_ memset(void *, int, size_t); +char * _TLIBC_CDECL_ strchr(const char *, int); +int _TLIBC_CDECL_ strcmp(const char *, const char *); +int _TLIBC_CDECL_ strcoll(const char *, const char *); +size_t _TLIBC_CDECL_ strcspn(const char *, const char *); +char * _TLIBC_CDECL_ strerror(int); +size_t _TLIBC_CDECL_ strlen(const char *); +char * _TLIBC_CDECL_ strncat(char *, const char *, size_t); +int _TLIBC_CDECL_ strncmp(const char *, const char *, size_t); +char * _TLIBC_CDECL_ strncpy(char *, const char *, size_t); +char * _TLIBC_CDECL_ strpbrk(const char *, const char *); +char * _TLIBC_CDECL_ strrchr(const char *, int); +size_t _TLIBC_CDECL_ strspn(const char *, const char *); +char * _TLIBC_CDECL_ strstr(const char *, const char *); +char * _TLIBC_CDECL_ strtok(char *, const char *); +size_t _TLIBC_CDECL_ strxfrm(char *, const char *, size_t); +size_t _TLIBC_CDECL_ strlcpy(char *, const char *, size_t); +errno_t _TLIBC_CDECL_ memset_s(void *s, size_t smax, int c, size_t n); + +/* + * Deprecated C99. + */ +_TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strcat, char *, const char *); +_TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strcpy, char *, const char *); + +/* + * Common used non-C99 functions. + */ +char * _TLIBC_CDECL_ strndup(const char *, size_t); +size_t _TLIBC_CDECL_ strnlen(const char *, size_t); +int _TLIBC_CDECL_ consttime_memequal(const void *b1, const void *b2, size_t len); + +/* + * Non-C99 + */ +int _TLIBC_CDECL_ bcmp(const void *, const void *, size_t); +void _TLIBC_CDECL_ bcopy(const void *, void *, size_t); +void _TLIBC_CDECL_ bzero(void *, size_t); +char * _TLIBC_CDECL_ index(const char *, int); +void * _TLIBC_CDECL_ mempcpy(void *, const void *, size_t); +char * _TLIBC_CDECL_ rindex(const char *, int); +char * _TLIBC_CDECL_ stpncpy(char *dest, const char *src, size_t n); +int _TLIBC_CDECL_ strcasecmp(const char *, const char *); +int _TLIBC_CDECL_ strncasecmp(const char *, const char *, size_t); + +int _TLIBC_CDECL_ ffs(int); +int _TLIBC_CDECL_ ffsl(long int); +int _TLIBC_CDECL_ ffsll(long long int); + +char * _TLIBC_CDECL_ strtok_r(char *, const char *, char **); +int _TLIBC_CDECL_ strerror_r(int, char *, size_t); + +/* + * Deprecated Non-C99. + */ +_TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, strdup, const char *); +_TLIBC_DEPRECATED_FUNCTION_(char * _TLIBC_CDECL_, stpcpy, char *dest, const char *src); + +__END_DECLS + +#endif /* _STRING_H_ */ diff --git a/common/inc/tlibc/sys/_types.h b/common/inc/tlibc/sys/_types.h new file mode 100644 index 0000000000..b1b315c7ed --- /dev/null +++ b/common/inc/tlibc/sys/_types.h @@ -0,0 +1,133 @@ +/* $OpenBSD: _types.h,v 1.2 2008/03/16 19:42:57 otto Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.3 (Berkeley) 1/5/94 + */ + +#ifndef _SYS__TYPES_H_ +#define _SYS__TYPES_H_ + +#include +/* 7.18.1.1 Exact-width integer types */ +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +typedef long long __int64_t; +typedef unsigned long long __uint64_t; + +/* 7.18.1.2 Minimum-width integer types */ +typedef __int8_t __int_least8_t; +typedef __uint8_t __uint_least8_t; +typedef __int16_t __int_least16_t; +typedef __uint16_t __uint_least16_t; +typedef __int32_t __int_least32_t; +typedef __uint32_t __uint_least32_t; +typedef __int64_t __int_least64_t; +typedef __uint64_t __uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types */ +typedef __int8_t __int_fast8_t; +typedef __uint8_t __uint_fast8_t; +#ifdef __x86_64__ +/* Linux x86_64, from stdint.h */ +typedef long int __int_fast16_t; +typedef unsigned long int __uint_fast16_t; +typedef long int __int_fast32_t; +typedef unsigned long int __uint_fast32_t; +typedef long int __int_fast64_t; +typedef unsigned long int __uint_fast64_t; +#else +/* Android x86, and Linux x86 */ +typedef __int32_t __int_fast16_t; +typedef __uint32_t __uint_fast16_t; +typedef __int32_t __int_fast32_t; +typedef __uint32_t __uint_fast32_t; +typedef __int64_t __int_fast64_t; +typedef __uint64_t __uint_fast64_t; +#endif + +typedef long __off_t; + +/* 7.18.1.4 Integer types capable of holding object pointers */ +#ifdef __i386__ +typedef __int32_t __intptr_t; +typedef __uint32_t __uintptr_t; +typedef __int32_t __ptrdiff_t; +/* Standard system types */ +typedef __uint32_t __size_t; +typedef __int32_t __ssize_t; +typedef long double __double_t; +typedef long double __float_t; +#else +typedef __int64_t __intptr_t; +typedef __uint64_t __uintptr_t; +typedef __int64_t __ptrdiff_t; + +/* Standard system types */ +typedef unsigned long __size_t; +typedef long __ssize_t; +typedef double __double_t; +typedef float __float_t; + +#endif /* !__i386__ */ + +typedef long __clock_t; + +typedef long __time_t; +typedef __builtin_va_list __va_list; +typedef int __wint_t; +/* wctype_t and wctrans_t are defined in wchar.h */ +typedef unsigned long int __wctype_t; +typedef int * __wctrans_t; + +/* + * mbstate_t is an opaque object to keep conversion state, during multibyte + * stream conversions. The content must not be referenced by user programs. + */ +/* For Linux, __mbstate_t is defined in wchar.h */ +typedef struct { + int __c; + union { + __wint_t __wc; + char __wcb[4]; + } __v; +} __mbstate_t; + +/* 7.18.1.5 Greatest-width integer types */ +typedef __int64_t __intmax_t; +typedef __uint64_t __uintmax_t; + +#endif /* !_SYS__TYPES_H_ */ + + + diff --git a/common/inc/tlibc/sys/cdefs.h b/common/inc/tlibc/sys/cdefs.h new file mode 100644 index 0000000000..398a12bbc7 --- /dev/null +++ b/common/inc/tlibc/sys/cdefs.h @@ -0,0 +1,132 @@ +/* $OpenBSD: cdefs.h,v 1.34 2012/08/14 20:11:37 matthew Exp $ */ +/* $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $ */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Berkeley Software Design, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_CDEFS_H_ +#define _SYS_CDEFS_H_ + +/* Declaration field in C/C++ headers */ +#if defined(__cplusplus) +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + +#if defined(__STDC__) || defined(__cplusplus) +# define __CONCAT(x,y) x ## y +# define __STRING(x) #x +#else +# define __CONCAT(x,y) x/**/y +# define __STRING(x) "x" +#endif +/* + * Macro to test if we're using a specific version of gcc or later. + */ +#if defined __GNUC__ && defined __GNUC_MINOR_ +# define __GNUC_PREREQ__(ma, mi) \ + ((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))) +#else +# define __GNUC_PREREQ__(ma, mi) 0 +#endif + +/* Calling Convention: cdecl */ +#define _TLIBC_CDECL_ + +/* Thread Directive */ +#define _TLIBC_THREAD_ /* __thread */ + +/* Deprecated Warnings */ +#define _TLIBC_DEPRECATED_MSG(x) __STRING(x)" is deprecated in tlibc." +#define _TLIBC_DEPRECATED_(x) __attribute__((deprecated(_TLIBC_DEPRECATED_MSG(x)))) + +#ifndef _TLIBC_WARN_DEPRECATED_FUNCTIONS_ +# define _TLIBC_DEPRECATED_FUNCTION_(__ret, __func, ...) +#else +# define _TLIBC_DEPRECATED_FUNCTION_(__ret, __func, ...) \ + _TLIBC_DEPRECATED_(__func) \ + __ret __func(__VA_ARGS__) +#endif + +/* Static analysis for printf format strings. + * _MSC_PRINTF_FORMAT_: MSVC SAL annotation for specifying format strings. + * _GCC_PRINTF_FORMAT_(x, y): GCC declaring attribute for checking format strings. + * x - index of the format string. In C++ non-static method, index 1 is reseved for 'this'. + * y - index of first variadic agrument in '...'. + */ +#define _GCC_PRINTF_FORMAT_(x, y) __attribute__((__format__ (printf, x, y))) + +/* Attribute - noreturn */ +#define _TLIBC_NORETURN_ __attribute__ ((__noreturn__)) + +/* + * GNU C version 2.96 adds explicit branch prediction so that + * the CPU back-end can hint the processor and also so that + * code blocks can be reordered such that the predicted path + * sees a more linear flow, thus improving cache behavior, etc. + * + * The following two macros provide us with a way to utilize this + * compiler feature. Use __predict_true() if you expect the expression + * to evaluate to true, and __predict_false() if you expect the + * expression to evaluate to false. + * + * A few notes about usage: + * + * * Generally, __predict_false() error condition checks (unless + * you have some _strong_ reason to do otherwise, in which case + * document it), and/or __predict_true() `no-error' condition + * checks, assuming you want to optimize for the no-error case. + * + * * Other than that, if you don't know the likelihood of a test + * succeeding from empirical or other `hard' evidence, don't + * make predictions. + * + * * These are meant to be used in places that are run `a lot'. + * It is wasteful to make predictions in code that is run + * seldomly (e.g. at subsystem initialization time) as the + * basic block reordering that this affects can often generate + * larger code. + */ +#if defined(__GNUC__) && __GNUC_PREREQ__(2, 96) +#define __predict_true(exp) __builtin_expect(((exp) != 0), 1) +#define __predict_false(exp) __builtin_expect(((exp) != 0), 0) +#else +#define __predict_true(exp) ((exp) != 0) +#define __predict_false(exp) ((exp) != 0) +#endif + +#endif /* !_SYS_CDEFS_H_ */ diff --git a/common/inc/tlibc/sys/endian.h b/common/inc/tlibc/sys/endian.h new file mode 100644 index 0000000000..29edd81c5c --- /dev/null +++ b/common/inc/tlibc/sys/endian.h @@ -0,0 +1,54 @@ +/* $OpenBSD: endian.h,v 1.18 2006/03/27 07:09:24 otto Exp $ */ + +/*- + * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Generic definitions for little- and big-endian systems. Other endianesses + * has to be dealt with in the specific machine/endian.h file for that port. + * + * This file is meant to be included from a little- or big-endian port's + * machine/endian.h after setting _BYTE_ORDER to either 1234 for little endian + * or 4321 for big.. + */ + +#ifndef _SYS_ENDIAN_H_ +#define _SYS_ENDIAN_H_ + +#define _LITTLE_ENDIAN 1234 +#define _BIG_ENDIAN 4321 +#define _PDP_ENDIAN 3412 +#define _BYTE_ORDER _LITTLE_ENDIAN + +#define LITTLE_ENDIAN _LITTLE_ENDIAN +#define BIG_ENDIAN _BIG_ENDIAN +#define PDP_ENDIAN _PDP_ENDIAN +#define BYTE_ORDER _BYTE_ORDER + +#define __BYTE_ORDER _BYTE_ORDER +#define __BIG_ENDIAN _BIG_ENDIAN +#define __LITTLE_ENDIAN _LITTLE_ENDIAN + +#endif /* _SYS_ENDIAN_H_ */ + diff --git a/common/inc/tlibc/sys/ieee.h b/common/inc/tlibc/sys/ieee.h new file mode 100644 index 0000000000..8370cd8295 --- /dev/null +++ b/common/inc/tlibc/sys/ieee.h @@ -0,0 +1,145 @@ +/* $OpenBSD: ieee.h,v 1.2 2008/09/07 20:36:06 martynas Exp $ */ +/* $NetBSD: ieee.h,v 1.1 1996/09/30 16:34:25 ws Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ieee.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * ieee.h defines the machine-dependent layout of the machine's IEEE + * floating point. It does *not* define (yet?) any of the rounding + * mode bits, exceptions, and so forth. + */ + +/* + * Define the number of bits in each fraction and exponent. + * + * k k+1 + * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented + * + * (-exp_bias+1) + * as fractions that look like 0.fffff x 2 . This means that + * + * -126 + * the number 0.10000 x 2 , for instance, is the same as the normalized + * + * -127 -128 + * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero + * + * -129 + * in the fraction; to represent 2 , we need two, and so on. This + * + * (-exp_bias-fracbits+1) + * implies that the smallest denormalized number is 2 + * + * for whichever format we are talking about: for single precision, for + * + * -126 -149 + * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and + * + * -149 == -127 - 23 + 1. + */ + +#include + +#define SNG_EXPBITS 8 +#define SNG_FRACBITS 23 + +#define DBL_EXPBITS 11 +#define DBL_FRACHBITS 20 +#define DBL_FRACLBITS 32 +#define DBL_FRACBITS 52 + +#define EXT_EXPBITS 15 +#define EXT_FRACHBITS 32 +#define EXT_FRACLBITS 32 +#define EXT_FRACBITS 64 + +#define EXT_TO_ARRAY32(p, a) do { \ + (a)[0] = (uint32_t)(p)->ext_fracl; \ + (a)[1] = (uint32_t)(p)->ext_frach; \ +} while(0) + +struct ieee_single { + u_int sng_frac:23; + u_int sng_exp:8; + u_int sng_sign:1; +}; + +struct ieee_double { + u_int dbl_fracl; + u_int dbl_frach:20; + u_int dbl_exp:11; + u_int dbl_sign:1; +}; + +struct ieee_ext { + u_int ext_fracl; + u_int ext_frach; + u_int ext_exp:15; + u_int ext_sign:1; + u_int ext_padl:16; + u_int ext_padh; +}; + +/* + * Floats whose exponent is in [1..INFNAN) (of whatever type) are + * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. + * Floats whose exponent is zero are either zero (iff all fraction + * bits are zero) or subnormal values. + * + * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its + * high fraction; if the bit is set, it is a `quiet NaN'. + */ +#define SNG_EXP_INFNAN 255 +#define DBL_EXP_INFNAN 2047 +#define EXT_EXP_INFNAN 32767 + +#if 0 +#define SNG_QUIETNAN (1 << 22) +#define DBL_QUIETNAN (1 << 19) +#define EXT_QUIETNAN (1 << 15) +#endif + +/* + * Exponent biases. + */ +#define SNG_EXP_BIAS 127 +#define DBL_EXP_BIAS 1023 +#define EXT_EXP_BIAS 16383 diff --git a/common/inc/tlibc/sys/limits.h b/common/inc/tlibc/sys/limits.h new file mode 100644 index 0000000000..3d1f9673ad --- /dev/null +++ b/common/inc/tlibc/sys/limits.h @@ -0,0 +1,77 @@ +/* $OpenBSD: limits.h,v 1.8 2009/11/27 19:54:35 guenther Exp $ */ +/* + * Copyright (c) 2002 Marc Espie. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD + * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SYS_LIMITS_H_ +#define _SYS_LIMITS_H_ + +#include + +/* Common definitions for limits.h. */ + +#define CHAR_BIT 8 /* number of bits in a char */ + +#define SCHAR_MAX 0x7f /* max value for a signed char */ +#define SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ + +#define UCHAR_MAX 0xff /* max value for an unsigned char */ +#ifdef __CHAR_UNSIGNED__ +# define CHAR_MIN 0 /* min value for a char */ +# define CHAR_MAX 0xff /* max value for a char */ +#else +# define CHAR_MAX 0x7f +# define CHAR_MIN (-0x7f-1) +#endif + +#define MB_LEN_MAX 1 /* Allow UTF-8 (RFC 3629) */ + +#define USHRT_MAX 0xffff /* max value for an unsigned short */ +#define SHRT_MAX 0x7fff /* max value for a short */ +#define SHRT_MIN (-0x7fff-1) /* min value for a short */ + +#define UINT_MAX 0xffffffffU /* max value for an unsigned int */ +#define INT_MAX 0x7fffffff /* max value for an int */ +#define INT_MIN (-0x7fffffff-1) /* min value for an int */ + +#ifdef __x86_64__ +# define ULONG_MAX 0xffffffffffffffffUL /* max value for unsigned long */ +# define LONG_MAX 0x7fffffffffffffffL /* max value for a signed long */ +# define LONG_MIN (-0x7fffffffffffffffL-1) /* min value for a signed long */ +#else +# define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ +# define LONG_MAX 0x7fffffffL /* max value for a long */ +# define LONG_MIN (-0x7fffffffL-1) /* min value for a long */ +#endif + +#define ULLONG_MAX 0xffffffffffffffffULL /* max value for unsigned long long */ +#define LLONG_MAX 0x7fffffffffffffffLL /* max value for a signed long long */ +#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min value for a signed long long */ + +#ifdef __x86_64__ +# define LONG_BIT 64 +#else +# define LONG_BIT 32 +#endif + +#endif /* !_SYS_LIMITS_H_ */ diff --git a/common/inc/tlibc/sys/stdint.h b/common/inc/tlibc/sys/stdint.h new file mode 100644 index 0000000000..b76cc52ed8 --- /dev/null +++ b/common/inc/tlibc/sys/stdint.h @@ -0,0 +1,253 @@ +/* $OpenBSD: stdint.h,v 1.4 2006/12/10 22:17:55 deraadt Exp $ */ + +/* + * Copyright (c) 1997, 2005 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _SYS_STDINT_H_ +#define _SYS_STDINT_H_ + +#include +#include + +/* 7.18.1.1 Exact-width integer types (also in sys/types.h) */ +#ifndef _INT8_T_DEFINED_ +#define _INT8_T_DEFINED_ +typedef __int8_t int8_t; +#endif + +#ifndef _UINT8_T_DEFINED_ +#define _UINT8_T_DEFINED_ +typedef __uint8_t uint8_t; +#endif + +#ifndef _INT16_T_DEFINED_ +#define _INT16_T_DEFINED_ +typedef __int16_t int16_t; +#endif + +#ifndef _UINT16_T_DEFINED_ +#define _UINT16_T_DEFINED_ +typedef __uint16_t uint16_t; +#endif + +#ifndef _INT32_T_DEFINED_ +#define _INT32_T_DEFINED_ +typedef __int32_t int32_t; +#endif + +#ifndef _UINT32_T_DEFINED_ +#define _UINT32_T_DEFINED_ +typedef __uint32_t uint32_t; +#endif + +#ifndef _INT64_T_DEFINED_ +#define _INT64_T_DEFINED_ +typedef __int64_t int64_t; +#endif + +#ifndef _UINT64_T_DEFINED_ +#define _UINT64_T_DEFINED_ +typedef __uint64_t uint64_t; +#endif + +/* 7.18.1.2 Minimum-width integer types */ +typedef __int_least8_t int_least8_t; +typedef __uint_least8_t uint_least8_t; +typedef __int_least16_t int_least16_t; +typedef __uint_least16_t uint_least16_t; +typedef __int_least32_t int_least32_t; +typedef __uint_least32_t uint_least32_t; +typedef __int_least64_t int_least64_t; +typedef __uint_least64_t uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types */ +typedef __int_fast8_t int_fast8_t; +typedef __uint_fast8_t uint_fast8_t; +typedef __int_fast16_t int_fast16_t; +typedef __uint_fast16_t uint_fast16_t; +typedef __int_fast32_t int_fast32_t; +typedef __uint_fast32_t uint_fast32_t; +typedef __int_fast64_t int_fast64_t; +typedef __uint_fast64_t uint_fast64_t; + +/* 7.18.1.4 Integer types capable of holding object pointers */ +#ifndef _INTPTR_T_DEFINED_ +#define _INTPTR_T_DEFINED_ +typedef __intptr_t intptr_t; +#endif + +#ifndef _UINTPTR_T_DEFINED_ +#define _UINTPTR_T_DEFINED_ +typedef __uintptr_t uintptr_t; +#endif + +/* 7.18.1.5 Greatest-width integer types */ +typedef __intmax_t intmax_t; +typedef __uintmax_t uintmax_t; + +//#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) +/* + * 7.18.2 Limits of specified-width integer types. + * + * The following object-like macros specify the minimum and maximum limits + * of integer types corresponding to the typedef names defined above. + */ + +/* 7.18.2.1 Limits of exact-width integer types */ +#define INT8_MIN (-0x7f - 1) +#define INT16_MIN (-0x7fff - 1) +#define INT32_MIN (-0x7fffffff - 1) +#define INT64_MIN (-0x7fffffffffffffffLL - 1) + +#define INT8_MAX 0x7f +#define INT16_MAX 0x7fff +#define INT32_MAX 0x7fffffff +#define INT64_MAX 0x7fffffffffffffffLL + +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xffffffffU +#define UINT64_MAX 0xffffffffffffffffULL + +/* 7.18.2.2 Limits of minimum-width integer types */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* 7.18.2.3 Limits of fastest minimum-width integer types */ +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#ifdef __x86_64__ +#define INT_FAST16_MAX INT64_MAX +#define INT_FAST32_MAX INT64_MAX +#else +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX +#endif +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#ifdef __x86_64__ +#define UINT_FAST16_MAX UINT64_MAX +#define UINT_FAST32_MAX UINT64_MAX +#else +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX +#endif +#define UINT_FAST64_MAX UINT64_MAX + +/* 7.18.2.4 Limits of integer types capable of holding object pointers */ +#ifdef __x86_64__ +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif + +/* 7.18.2.5 Limits of greatest-width integer types */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* + * 7.18.3 Limits of other integer types. + * + * The following object-like macros specify the minimum and maximum limits + * of integer types corresponding to types specified in other standard + * header files. + */ + +/* Limits of ptrdiff_t */ +#define PTRDIFF_MIN INTPTR_MIN +#define PTRDIFF_MAX INTPTR_MAX + +/* Limits of size_t (also in limits.h) */ +#ifndef SIZE_MAX +#define SIZE_MAX UINTPTR_MAX +#endif + +/* Limits of wchar_t */ +#ifdef _TLIBC_WIN_ +# define WCHAR_MIN 0x0000 +# define WCHAR_MAX 0xffff +#else +# ifdef __WCHAR_MAX__ +# define WCHAR_MAX __WCHAR_MAX__ +# else +# define WCHAR_MAX (2147483647) +# endif +# ifdef __WCHAR_MIN__ +# define WCHAR_MIN __WCHAR_MIN__ +# elif L'\0' - 1 > 0 +# define WCHAR_MIN L'\0' +# else +# define WCHAR_MIN (-WCHAR_MAX - 1) +# endif +#endif + +/* Limits of wint_t */ +# define WINT_MIN (0u) +# define WINT_MAX (4294967295u) + +//#endif /* __cplusplus || __STDC_LIMIT_MACROS */ + +//#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) +/* + * 7.18.4 Macros for integer constants. + * + * The following function-like macros expand to integer constants + * suitable for initializing objects that have integer types corresponding + * to types defined in . The argument in any instance of + * these macros shall be a decimal, octal, or hexadecimal constant with + * a value that does not exceed the limits for the corresponding type. + */ + +/* 7.18.4.1 Macros for minimum-width integer constants. */ +#define INT8_C(_c) (_c) +#define INT16_C(_c) (_c) +#define INT32_C(_c) (_c) +#define INT64_C(_c) __CONCAT(_c, LL) + +#define UINT8_C(_c) (_c) +#define UINT16_C(_c) (_c) +#define UINT32_C(_c) __CONCAT(_c, U) +#define UINT64_C(_c) __CONCAT(_c, ULL) + +/* 7.18.4.2 Macros for greatest-width integer constants. */ +#define INTMAX_C(_c) __CONCAT(_c, LL) +#define UINTMAX_C(_c) __CONCAT(_c, ULL) + +//#endif /* __cplusplus || __STDC_CONSTANT_MACROS */ + +#endif /* _SYS_STDINT_H_ */ diff --git a/common/inc/tlibc/sys/types.h b/common/inc/tlibc/sys/types.h new file mode 100644 index 0000000000..474f3e93d9 --- /dev/null +++ b/common/inc/tlibc/sys/types.h @@ -0,0 +1,128 @@ +/* $OpenBSD: types.h,v 1.31 2008/03/16 19:42:57 otto Exp $ */ +/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */ + +/*- + * Copyright (c) 1982, 1986, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.4 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_TYPES_H_ +#define _SYS_TYPES_H_ + +#include +#include + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; + +typedef unsigned char unchar; /* Sys V compatibility */ +typedef unsigned short ushort; /* Sys V compatibility */ +typedef unsigned int uint; /* Sys V compatibility */ +typedef unsigned long ulong; /* Sys V compatibility */ + +#ifndef _INT8_T_DEFINED_ +#define _INT8_T_DEFINED_ +typedef __int8_t int8_t; +#endif + +#ifndef _UINT8_T_DEFINED_ +#define _UINT8_T_DEFINED_ +typedef __uint8_t uint8_t; +#endif + +#ifndef _INT16_T_DEFINED_ +#define _INT16_T_DEFINED_ +typedef __int16_t int16_t; +#endif + +#ifndef _UINT16_T_DEFINED_ +#define _UINT16_T_DEFINED_ +typedef __uint16_t uint16_t; +#endif + +#ifndef _INT32_T_DEFINED_ +#define _INT32_T_DEFINED_ +typedef __int32_t int32_t; +#endif + +#ifndef _UINT32_T_DEFINED_ +#define _UINT32_T_DEFINED_ +typedef __uint32_t uint32_t; +#endif + +#ifndef _INT64_T_DEFINED_ +#define _INT64_T_DEFINED_ +typedef __int64_t int64_t; +#endif + +#ifndef _UINT64_T_DEFINED_ +#define _UINT64_T_DEFINED_ +typedef __uint64_t uint64_t; +#endif + +#ifndef _INTPTR_T_DEFINED_ +#define _INTPTR_T_DEFINED_ +typedef __intptr_t intptr_t; +#endif + +#ifndef _UINTPTR_T_DEFINED_ +#define _UINTPTR_T_DEFINED_ +typedef __uintptr_t uintptr_t; +#endif + +/* BSD-style unsigned bits types */ +typedef __uint8_t u_int8_t; +typedef __uint16_t u_int16_t; +typedef __uint32_t u_int32_t; +typedef __uint64_t u_int64_t; + + +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef __size_t size_t; +#endif + +#ifndef _SSIZE_T_DEFINED_ +#define _SSIZE_T_DEFINED_ +typedef __ssize_t ssize_t; +#endif + +#ifndef _OFF_T_DEFINED_ +#define _OFF_T_DEFINED_ +typedef __off_t off_t; +#endif + +#endif /* !_SYS_TYPES_H_ */ diff --git a/common/inc/tlibc/time.h b/common/inc/tlibc/time.h new file mode 100644 index 0000000000..3880d3e9ac --- /dev/null +++ b/common/inc/tlibc/time.h @@ -0,0 +1,104 @@ +/* $OpenBSD: time.h,v 1.18 2006/01/06 18:53:04 millert Exp $ */ +/* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)time.h 5.12 (Berkeley) 3/9/91 + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#include +#include + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if !defined (_CLOCK_T_DEFINED_) && !defined (_CLOCK_T_DEFINED) +#define _CLOCK_T_DEFINED_ +#define _CLOCK_T_DEFINED +typedef __clock_t clock_t; +#endif + +#if !defined (_TIME_T_DEFINED_) && !defined (_TIME_T_DEFINED) +#define _TIME_T_DEFINED_ +#define _TIME_T_DEFINED +typedef __time_t time_t; +#endif + +#if !defined (_SIZE_T_DEFINED_) && !defined (_SIZE_T_DEFINED) +#define _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED +typedef __size_t size_t; +#endif + +#if !defined (_TM_DEFINED) +#define _TM_DEFINED +struct tm { + int tm_sec; /* seconds after the minute [0-60] */ + int tm_min; /* minutes after the hour [0-59] */ + int tm_hour; /* hours since midnight [0-23] */ + int tm_mday; /* day of the month [1-31] */ + int tm_mon; /* months since January [0-11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday [0-6] */ + int tm_yday; /* days since January 1 [0-365] */ + int tm_isdst; /* Daylight Saving Time flag */ + /* FIXME: naming issue exists on Fedora/Ubuntu */ + long tm_gmtoff; /* offset from UTC in seconds */ + char *tm_zone; /* timezone abbreviation */ +}; +#endif + +__BEGIN_DECLS + +double _TLIBC_CDECL_ difftime(time_t, time_t); +char * _TLIBC_CDECL_ asctime(const struct tm *); +size_t _TLIBC_CDECL_ strftime(char *, size_t, const char *, const struct tm *); + +/* + * Non-C99 + */ +char * _TLIBC_CDECL_ asctime_r(const struct tm *, char *); + +__END_DECLS + +#endif /* !_TIME_H_ */ diff --git a/common/inc/tlibc/unistd.h b/common/inc/tlibc/unistd.h new file mode 100644 index 0000000000..2958a6ccc6 --- /dev/null +++ b/common/inc/tlibc/unistd.h @@ -0,0 +1,59 @@ +/* $OpenBSD: unistd.h,v 1.62 2008/06/25 14:58:54 millert Exp $ */ +/* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ + +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include +#include + +__BEGIN_DECLS + +void * _TLIBC_CDECL_ sbrk(intptr_t); + +/* + * Deprecated Non-C99. + */ +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, execl, const char *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, execlp, const char *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, execle, const char *, const char *, ...); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, execv, const char *, char * const *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, execve, const char *, char * const *, char * const *); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, execvp, const char *, char * const *); + +//_TLIBC_DEPRECATED_FUNCTION_(pid_t _TLIBC_CDECL_, fork, void); /* no pid_t */ + +__END_DECLS + +#endif /* !_UNISTD_H_ */ diff --git a/common/inc/tlibc/wchar.h b/common/inc/tlibc/wchar.h new file mode 100644 index 0000000000..4ca0b39f40 --- /dev/null +++ b/common/inc/tlibc/wchar.h @@ -0,0 +1,139 @@ +/* $OpenBSD: wchar.h,v 1.11 2010/07/24 09:58:39 guenther Exp $ */ +/* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/*- + * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _WCHAR_H_ +#define _WCHAR_H_ + +#include +#include +#include /* WCHAR_MAX/WCHAR_MIN */ + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#if !defined(_WCHAR_T_DEFINED_) && !defined(__cplusplus) +#define _WCHAR_T_DEFINED_ +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +typedef __WCHAR_TYPE__ wchar_t; +#endif + +#ifndef _MBSTATE_T_DEFINED_ +#define _MBSTATE_T_DEFINED_ +typedef __mbstate_t mbstate_t; +#endif + +#ifndef _WINT_T_DEFINED_ +#define _WINT_T_DEFINED_ +typedef __wint_t wint_t; +#endif + +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef __size_t size_t; +#endif + +#ifndef WEOF +#define WEOF ((wint_t)-1) +#endif + +__BEGIN_DECLS + +wint_t _TLIBC_CDECL_ btowc(int); +int _TLIBC_CDECL_ wctob(wint_t); +size_t _TLIBC_CDECL_ mbrlen(const char *, size_t, mbstate_t *); +size_t _TLIBC_CDECL_ mbrtowc(wchar_t *, const char *, size_t, mbstate_t *); +int _TLIBC_CDECL_ mbsinit(const mbstate_t *); +size_t _TLIBC_CDECL_ mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *); +size_t _TLIBC_CDECL_ wcrtomb(char *, wchar_t, mbstate_t *); +wchar_t * _TLIBC_CDECL_ wcschr(const wchar_t *, wchar_t); +int _TLIBC_CDECL_ wcscmp(const wchar_t *, const wchar_t *); +int _TLIBC_CDECL_ wcscoll(const wchar_t *, const wchar_t *); +size_t _TLIBC_CDECL_ wcscspn(const wchar_t *, const wchar_t *); +size_t _TLIBC_CDECL_ wcslen(const wchar_t *); +wchar_t * _TLIBC_CDECL_ wcsncat(wchar_t *, const wchar_t *, size_t); +int _TLIBC_CDECL_ wcsncmp(const wchar_t *, const wchar_t *, size_t); +wchar_t * _TLIBC_CDECL_ wcsncpy(wchar_t *, const wchar_t *, size_t); +wchar_t * _TLIBC_CDECL_ wcspbrk(const wchar_t *, const wchar_t *); +wchar_t * _TLIBC_CDECL_ wcsrchr(const wchar_t *, wchar_t); +size_t _TLIBC_CDECL_ wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *); +size_t _TLIBC_CDECL_ wcsspn(const wchar_t *, const wchar_t *); +wchar_t * _TLIBC_CDECL_ wcsstr(const wchar_t *, const wchar_t *); +wchar_t * _TLIBC_CDECL_ wcstok(wchar_t *, const wchar_t *, wchar_t **); +size_t _TLIBC_CDECL_ wcsxfrm(wchar_t *, const wchar_t *, size_t); +wchar_t * _TLIBC_CDECL_ wmemchr(const wchar_t *, wchar_t, size_t); +int _TLIBC_CDECL_ wmemcmp(const wchar_t *, const wchar_t *, size_t); +wchar_t * _TLIBC_CDECL_ wmemcpy(wchar_t *, const wchar_t *, size_t); +wchar_t * _TLIBC_CDECL_ wmemmove(wchar_t *, const wchar_t *, size_t); +wchar_t * _TLIBC_CDECL_ wmemset(wchar_t *, wchar_t, size_t); + +int _TLIBC_CDECL_ swprintf(wchar_t *, size_t, const wchar_t *, ...); +int _TLIBC_CDECL_ vswprintf(wchar_t *, size_t, const wchar_t *, __va_list); + +/* leagcy version of wcsstr */ +wchar_t * _TLIBC_CDECL_ wcswcs(const wchar_t *, const wchar_t *); + +__END_DECLS + +#endif /* !_WCHAR_H_ */ diff --git a/common/inc/tlibc/wctype.h b/common/inc/tlibc/wctype.h new file mode 100644 index 0000000000..25466f15d1 --- /dev/null +++ b/common/inc/tlibc/wctype.h @@ -0,0 +1,83 @@ +/* $OpenBSD: wctype.h,v 1.5 2006/01/06 18:53:04 millert Exp $ */ +/* $NetBSD: wctype.h,v 1.5 2003/03/02 22:18:11 tshiozak Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp + */ + +#ifndef _WCTYPE_H_ +#define _WCTYPE_H_ + +#include +#include + +#ifndef _WINT_T_DEFINED_ +#define _WINT_T_DEFINED_ +typedef __wint_t wint_t; +#endif + +#ifndef _WCTRANS_T_DEFINED_ +#define _WCTRANS_T_DEFINED_ +typedef __wctrans_t wctrans_t; +#endif + +#ifndef _WCTYPE_T_DEFINED_ +#define _WCTYPE_T_DEFINED_ +typedef __wctype_t wctype_t; +#endif + +#ifndef WEOF +#define WEOF ((wint_t)-1) +#endif + +__BEGIN_DECLS + +/* + * Deprecated definitions. + */ +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswalnum, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswalpha, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswblank, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswcntrl, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswdigit, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswgraph, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswlower, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswprint, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswpunct, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswspace, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswupper, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswxdigit, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(int _TLIBC_CDECL_, iswctype, wint_t, wctype_t); +_TLIBC_DEPRECATED_FUNCTION_(wint_t _TLIBC_CDECL_, towctrans, wint_t, wctrans_t); +_TLIBC_DEPRECATED_FUNCTION_(wint_t _TLIBC_CDECL_, towlower, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(wint_t _TLIBC_CDECL_, towupper, wint_t); +_TLIBC_DEPRECATED_FUNCTION_(wctrans_t _TLIBC_CDECL_, wctrans, const char *); +_TLIBC_DEPRECATED_FUNCTION_(wctype_t _TLIBC_CDECL_, wctype, const char *); + +__END_DECLS + +#endif /* _WCTYPE_H_ */ diff --git a/common/se_wrapper/Makefile b/common/se_wrapper/Makefile new file mode 100644 index 0000000000..0cf6f20ebd --- /dev/null +++ b/common/se_wrapper/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CFLAGS += -Werror -D_GNU_SOURCE -fPIC +CFLAGS += $(ADDED_INC) + +CPPFLAGS := -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal + +OBJS := se_memory.o \ + se_thread.o \ + se_trace.o \ + se_event.o \ + se_rwlock.o \ + se_time.o \ + se_map.o + +LIBWRAPPER := libwrapper.a + +.PHONY: clean all +all: $(LIBWRAPPER) + +$(LIBWRAPPER): $(OBJS) + $(AR) rcs $@ $^ + +$(OBJS): %.o: $(COMMON_DIR)/src/%.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(LIBWRAPPER) $(OBJS) diff --git a/common/src/dh.cpp b/common/src/dh.cpp new file mode 100644 index 0000000000..6b01601b9f --- /dev/null +++ b/common/src/dh.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** +* File: +* dh.cpp +*Description: +* Encrypt and decrypt messages over DH session +*/ +#include "dh.h" +#include "sgx_tcrypto.h" + +bool encrypt_msg(pse_message_t* pse_msg, uint8_t* data, sgx_key_128bit_t* authenticated_encryption_key) +{ + /* get random IV */ + if(sgx_read_rand(pse_msg->payload_iv, PAYLOAD_IV_SIZE) != SGX_SUCCESS) + { + return false; + } + + return (SGX_SUCCESS == sgx_rijndael128GCM_encrypt( + authenticated_encryption_key, + data, + pse_msg->payload_size, + reinterpret_cast(&(pse_msg->payload)), + reinterpret_cast(&(pse_msg->payload_iv)), + 12, + NULL, + 0, + &pse_msg->payload_tag + )); +} + +bool decrypt_msg(pse_message_t* pse_msg, uint8_t* data, sgx_key_128bit_t* authenticated_encryption_key) +{ + return(SGX_SUCCESS == sgx_rijndael128GCM_decrypt( + authenticated_encryption_key, + pse_msg->payload, + pse_msg->payload_size, + data, + reinterpret_cast(&(pse_msg->payload_iv)), + 12, + NULL, + 0, + &pse_msg->payload_tag + )); +} + diff --git a/common/src/ecp.cpp b/common/src/ecp.cpp new file mode 100644 index 0000000000..ea632f9443 --- /dev/null +++ b/common/src/ecp.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_ecp_types.h" +#include "ecp_interface.h" +#include "stdlib.h" +#include "string.h" + +#ifndef ERROR_BREAK +#define ERROR_BREAK(x) if(x != ippStsNoErr){break;} +#endif +#ifndef NULL_BREAK +#define NULL_BREAK(x) if(!x){break;} +#endif +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} +#endif + +#define MAC_KEY_SIZE 16 + +#define EC_DERIVATION_BUFFER_SIZE(label_length) ((label_length) +4) + +sgx_status_t derive_key( + const sgx_ec256_dh_shared_t* shared_key, + const char* label, + uint32_t label_length, + sgx_ec_key_128bit_t* derived_key) +{ + sgx_status_t se_ret = SGX_SUCCESS; + uint8_t cmac_key[MAC_KEY_SIZE]; + sgx_ec_key_128bit_t key_derive_key; + if (!shared_key || !derived_key || !label) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + /*check integer overflow */ + if (label_length > EC_DERIVATION_BUFFER_SIZE(label_length)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + memset(cmac_key, 0, MAC_KEY_SIZE); + se_ret = sgx_rijndael128_cmac_msg((sgx_cmac_128bit_key_t *)cmac_key, + (uint8_t*)shared_key, + sizeof(sgx_ec256_dh_shared_t), + (sgx_cmac_128bit_tag_t *)&key_derive_key); + if (SGX_SUCCESS != se_ret) + { + memset_s(&key_derive_key, sizeof(key_derive_key), 0, sizeof(key_derive_key)); + INTERNAL_SGX_ERROR_CODE_CONVERTOR(se_ret); + return se_ret; + } + /* derivation_buffer = counter(0x01) || label || 0x00 || output_key_len(0x0080) */ + uint32_t derivation_buffer_length = EC_DERIVATION_BUFFER_SIZE(label_length); + uint8_t *p_derivation_buffer = (uint8_t *)malloc(derivation_buffer_length); + if (p_derivation_buffer == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(p_derivation_buffer, 0, derivation_buffer_length); + + /*counter = 0x01 */ + p_derivation_buffer[0] = 0x01; + /*label*/ + memcpy(&p_derivation_buffer[1], label, label_length); + /*output_key_len=0x0080*/ + uint16_t *key_len = (uint16_t *)&p_derivation_buffer[derivation_buffer_length - 2]; + *key_len = 0x0080; + + se_ret = sgx_rijndael128_cmac_msg((sgx_cmac_128bit_key_t *)&key_derive_key, + p_derivation_buffer, + derivation_buffer_length, + (sgx_cmac_128bit_tag_t *)derived_key); + memset_s(&key_derive_key, sizeof(key_derive_key), 0, sizeof(key_derive_key)); + free(p_derivation_buffer); + if(SGX_SUCCESS != se_ret) + { + INTERNAL_SGX_ERROR_CODE_CONVERTOR(se_ret); + } + return se_ret; +} diff --git a/common/src/ipp_bn.cpp b/common/src/ipp_bn.cpp new file mode 100644 index 0000000000..03b7cb6826 --- /dev/null +++ b/common/src/ipp_bn.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** +* File: +* ipp_bn.cpp +*Description: +* Wrappers for Big number generation and free functions +* +*/ + + + +#include "ipp_wrapper.h" + +#include +#include + +#ifndef _TLIBC_CDECL_ +extern "C" int memset_s(void *s, size_t smax, int c, size_t n); +#endif + +extern "C" IppStatus + newBN(const Ipp32u *data, int size_in_bytes, IppsBigNumState **p_new_BN) +{ + IppsBigNumState *pBN=0; + int bn_size = 0; + + if(p_new_BN == NULL || size_in_bytes <= 0 || size_in_bytes % sizeof(Ipp32u)) + return ippStsBadArgErr; + + /* Get the size of the IppsBigNumState context in bytes */ + IppStatus error_code = ippsBigNumGetSize(size_in_bytes/(int)sizeof(Ipp32u), &bn_size); + if(error_code != ippStsNoErr) + { + *p_new_BN = 0; + return error_code; + } + pBN = (IppsBigNumState *) malloc(bn_size); + if(!pBN) + { + error_code = ippStsMemAllocErr; + *p_new_BN = 0; + return error_code; + } + /* Initializes context and partitions allocated buffer */ + error_code = ippsBigNumInit(size_in_bytes/(int)sizeof(Ipp32u), pBN); + if(error_code != ippStsNoErr) + { + SAFE_FREE_MM(pBN); + *p_new_BN = 0; + return error_code; + } + if(data) + { + error_code = ippsSet_BN(IppsBigNumPOS, size_in_bytes/(int)sizeof(Ipp32u), data, pBN); + if(error_code != ippStsNoErr) + { + SAFE_FREE_MM(pBN); + *p_new_BN = 0; + return error_code; + } + } + *p_new_BN = pBN; + return error_code; + +} + + +extern "C" void secure_free_BN(IppsBigNumState *pBN, int size_in_bytes) +{ + if(pBN == NULL || size_in_bytes <= 0 || size_in_bytes % sizeof(Ipp32u)) + { + if(pBN) + { + free(pBN); + } + return; + } + + int bn_size = 0; + + /* Get the size of the IppsBigNumState context in bytes + * Since we have checked the size_in_bytes before and the &bn_size is not NULL, + * ippsBigNumGetSize never returns failure + */ + if(ippsBigNumGetSize(size_in_bytes/(int)sizeof(Ipp32u), &bn_size) != ippStsNoErr) + { + free(pBN); + return; + } + /* Clear the buffer before free. */ + memset_s(pBN, bn_size, 0, bn_size); + free(pBN); + return; +} diff --git a/common/src/ipp_rsa_key.cpp b/common/src/ipp_rsa_key.cpp new file mode 100644 index 0000000000..e1ccd5513e --- /dev/null +++ b/common/src/ipp_rsa_key.cpp @@ -0,0 +1,351 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** +* File: +* ipp_rsa_key.cpp +*Description: +* Wrapper for rsa key operation functions (public key generation and free excluded) +* +*/ + +#include "ipp_wrapper.h" +#include "util.h" + +#include +#include +#include +#include + +extern "C" int memset_s(void *s, size_t smax, int c, size_t n); + +static IppStatus newPRNG(IppsPRNGState **pRandGen) +{ + if(pRandGen == NULL) + return ippStsBadArgErr; + int ctxSize = 0; + IppStatus error_code = ippsPRNGGetSize(&ctxSize); + if(error_code != ippStsNoErr) + return error_code; + IppsPRNGState* pCtx = (IppsPRNGState *) malloc(ctxSize); + if(pCtx == NULL) + return ippStsMemAllocErr; + + error_code = ippsPRNGInit(160, pCtx); + if(error_code != ippStsNoErr) + { + free(pCtx); + return error_code; + } + + *pRandGen = pCtx; + return error_code; +} + +static IppStatus newPrimeGen(int nMaxBits, IppsPrimeState ** pPrimeG) +{ + if(pPrimeG == NULL || nMaxBits <= 0 ) + return ippStsBadArgErr; + int ctxSize = 0; + IppStatus error_code = ippsPrimeGetSize(nMaxBits, &ctxSize); + if(error_code != ippStsNoErr) + return error_code; + IppsPrimeState* pCtx = (IppsPrimeState *) malloc(ctxSize); + if(pCtx == NULL) + return ippStsMemAllocErr; + + error_code = ippsPrimeInit(nMaxBits, pCtx); + if(error_code != ippStsNoErr) + { + free(pCtx); + return error_code; + } + + *pPrimeG = pCtx; + return error_code; +} + + +extern "C" IppStatus create_rsa_priv2_key(int p_byte_size, const Ipp32u *p, const Ipp32u *q, + const Ipp32u *dmp1, const Ipp32u *dmq1, const Ipp32u *iqmp, + IppsRSAPrivateKeyState **new_pri_key2) +{ + IppsRSAPrivateKeyState *p_rsa2 = NULL; + IppsBigNumState *p_p = NULL, *p_q = NULL, *p_dmp1 = NULL, *p_dmq1 = NULL, *p_iqmp = NULL; + int rsa2_size = 0; + + if(p_byte_size <= 0 || p == NULL || q == NULL || dmp1 == NULL || dmq1 == NULL || iqmp == NULL || new_pri_key2 == NULL) + { + return ippStsBadArgErr; + } + + IppStatus error_code = ippStsNoErr; + do{ + error_code = newBN(p, p_byte_size, &p_p); + ERROR_BREAK(error_code); + error_code = newBN(q, p_byte_size, &p_q); + ERROR_BREAK(error_code); + error_code = newBN(dmp1, p_byte_size, &p_dmp1); + ERROR_BREAK(error_code); + error_code = newBN(dmq1, p_byte_size, &p_dmq1); + ERROR_BREAK(error_code); + error_code = newBN(iqmp, p_byte_size, &p_iqmp); + ERROR_BREAK(error_code); + error_code = ippsRSA_GetSizePrivateKeyType2(p_byte_size * 8, p_byte_size * 8, &rsa2_size); + ERROR_BREAK(error_code); + p_rsa2 = (IppsRSAPrivateKeyState *)malloc(rsa2_size); + NULL_BREAK(p_rsa2); + + error_code = ippsRSA_InitPrivateKeyType2(p_byte_size * 8, p_byte_size * 8, p_rsa2, rsa2_size); + ERROR_BREAK(error_code); + error_code = ippsRSA_SetPrivateKeyType2(p_p, p_q, p_dmp1, p_dmq1, p_iqmp, p_rsa2); + ERROR_BREAK(error_code); + }while(0); + + secure_free_BN(p_p, p_byte_size); + secure_free_BN(p_q, p_byte_size); + secure_free_BN(p_dmp1, p_byte_size); + secure_free_BN(p_dmq1, p_byte_size); + secure_free_BN(p_iqmp, p_byte_size); + + if(error_code != ippStsNoErr || p_rsa2 == NULL) + { + if(error_code == ippStsNoErr ) + error_code = ippStsMemAllocErr; + + /* Clear sensitive data before free */ + secure_free_rsa_pri2_key(p_byte_size, p_rsa2); + return error_code; + } + + *new_pri_key2 = p_rsa2; + return error_code; +} + +extern "C" IppStatus create_rsa_priv1_key(int n_byte_size, int d_byte_size, const Ipp32u *n, const Ipp32u *d, IppsRSAPrivateKeyState **new_pri_key1) +{ + IppsRSAPrivateKeyState *p_rsa1 = NULL; + IppsBigNumState *p_n = NULL, *p_d = NULL; + int rsa1_size = 0; + if(n_byte_size <= 0 || d_byte_size <= 0 || n == NULL || d == NULL || new_pri_key1 == NULL) + { + return ippStsBadArgErr; + } + IppStatus error_code = ippStsNoErr; + do{ + error_code = newBN(n, n_byte_size, &p_n); + ERROR_BREAK(error_code); + error_code = newBN(d, d_byte_size, &p_d); + ERROR_BREAK(error_code); + + error_code = ippsRSA_GetSizePrivateKeyType1(n_byte_size * 8, d_byte_size * 8, &rsa1_size); + ERROR_BREAK(error_code); + p_rsa1 = (IppsRSAPrivateKeyState *)malloc(rsa1_size); + NULL_BREAK(p_rsa1); + error_code = ippsRSA_InitPrivateKeyType1(n_byte_size * 8, d_byte_size * 8, p_rsa1, rsa1_size); + ERROR_BREAK(error_code); + error_code = ippsRSA_SetPrivateKeyType1(p_n, p_d, p_rsa1); + ERROR_BREAK(error_code); + }while(0); + secure_free_BN(p_n, n_byte_size); + secure_free_BN(p_d, d_byte_size); + if(error_code != ippStsNoErr || p_rsa1 == NULL) + { + if(error_code == ippStsNoErr ) + error_code = ippStsMemAllocErr; + + /* Clear sensitive data before free */ + secure_free_rsa_pri1_key(n_byte_size, d_byte_size, p_rsa1); + return error_code; + } + + *new_pri_key1 = p_rsa1; + return error_code; +} + + +extern "C" IppStatus create_validate_rsa_key_pair(int n_byte_size, int e_byte_size, const Ipp32u *n, const Ipp32u *d, const Ipp32u *e, const Ipp32u *p, const Ipp32u *q, + const Ipp32u *dmp1, const Ipp32u *dmq1, const Ipp32u *iqmp, + IppsRSAPrivateKeyState **new_pri_key, IppsRSAPublicKeyState **new_pub_key, int *validate_result) +{ + if(n_byte_size <= 0 || e_byte_size <= 0 || n == NULL || d == NULL || e == NULL || + p == NULL || q == NULL || dmp1 == NULL || dmq1 == NULL || iqmp == NULL || new_pri_key == NULL || + new_pub_key == NULL || validate_result == NULL) + { + return ippStsBadArgErr; + } + IppsRSAPrivateKeyState *p_pri_key1 = NULL, *p_pri_key2 = NULL; + IppsRSAPublicKeyState *p_pub_key = NULL; + IppStatus error_code = ippStsNoErr; + IppsPRNGState *p_rand = NULL; + IppsPrimeState *p_prime = NULL; + Ipp8u * scratch_buffer = NULL; + int result = IPP_IS_VALID; + int max_size = 0, pri1_size = 0, pri2_size = 0, pub_size = 0; + + do + { + /* Generate the pri_key1, pri_key2 and pub_key */ + error_code = create_rsa_priv1_key(n_byte_size, n_byte_size, n, d, &p_pri_key1); + ERROR_BREAK(error_code); + error_code = create_rsa_priv2_key(n_byte_size/2, p, q, dmp1, dmq1, iqmp, &p_pri_key2); + ERROR_BREAK(error_code); + error_code = create_rsa_pub_key(n_byte_size, e_byte_size, n, e, &p_pub_key); + ERROR_BREAK(error_code); + + /* Generate random state and prime state */ + error_code = newPRNG(&p_rand); + ERROR_BREAK(error_code); + error_code = newPrimeGen(n_byte_size * 8 / 2, &p_prime); + ERROR_BREAK(error_code); + + /* Allocate scratch buffer */ + error_code = ippsRSA_GetBufferSizePrivateKey(&pri1_size, p_pri_key1); + ERROR_BREAK(error_code); + error_code = ippsRSA_GetBufferSizePrivateKey(&pri2_size, p_pri_key2); + ERROR_BREAK(error_code); + max_size = MAX(pri1_size, pri2_size); + error_code = ippsRSA_GetBufferSizePublicKey(&pub_size, p_pub_key); + ERROR_BREAK(error_code); + max_size = MAX(max_size, pub_size); + scratch_buffer = (Ipp8u *)malloc(max_size); + NULL_BREAK(scratch_buffer); + memset(scratch_buffer, 0, max_size); + + /* Validate keys */ + error_code = ippsRSA_ValidateKeys(&result, p_pub_key, p_pri_key2, p_pri_key1, scratch_buffer, 10, p_prime, ippsPRNGen, p_rand); + ERROR_BREAK(error_code); + }while(0); + SAFE_FREE_MM(p_rand); + SAFE_FREE_MM(p_prime); + secure_free_rsa_pri2_key(n_byte_size/2, p_pri_key2); + + if(error_code != ippStsNoErr || scratch_buffer == NULL) + { + if(error_code == ippStsNoErr) + error_code = ippStsMemAllocErr; + + SAFE_FREE_MM(scratch_buffer); + secure_free_rsa_pri1_key(n_byte_size, n_byte_size, p_pri_key1); + secure_free_rsa_pub_key(n_byte_size, e_byte_size, p_pub_key); + return error_code; + } + SAFE_FREE_MM(scratch_buffer); + *new_pri_key = p_pri_key1; + *new_pub_key = p_pub_key; + *validate_result = result; + return error_code; +} + +extern "C" IppStatus get_pub_key(const IppsRSAPublicKeyState *pub_key, int *e_byte_size, Ipp32u *e, int *n_byte_size, Ipp32u *n) +{ + IppStatus error_code = ippStsNoErr; + IppsBigNumState *p_n=NULL, *p_e=NULL; + + if(!pub_key || !e_byte_size || !e || !n_byte_size || !n) + { + return ippStsBadArgErr; + } + do + { + error_code = newBN(NULL, SE_KEY_SIZE, &p_n); + ERROR_BREAK(error_code); + error_code = newBN(NULL, sizeof(Ipp32u), &p_e); + ERROR_BREAK(error_code); + + error_code = ippsRSA_GetPublicKey(p_n, p_e, pub_key); + ERROR_BREAK(error_code); + + IppsBigNumSGN sgn = IppsBigNumPOS; + Ipp32u *pdata = NULL; + int length_in_bit = 0; + + + error_code = ippsRef_BN(&sgn, &length_in_bit, &pdata, p_n); + ERROR_BREAK(error_code); + *n_byte_size = ROUND_TO(length_in_bit, 8)/8; + memset(n, 0, *n_byte_size); + memcpy(n, pdata, ROUND_TO(length_in_bit, 8)/8); + + error_code = ippsRef_BN(&sgn, &length_in_bit, &pdata, p_e); + ERROR_BREAK(error_code); + *e_byte_size = ROUND_TO(length_in_bit, 8)/8; + memset(e, 0, *e_byte_size); + memcpy(e, pdata, ROUND_TO(length_in_bit, 8)/8); + } while(0); + + secure_free_BN(p_n, SE_KEY_SIZE); + secure_free_BN(p_e, sizeof(Ipp32u)); + return error_code; +} + +extern "C" void secure_free_rsa_pri1_key(int n_byte_size, int d_byte_size, IppsRSAPrivateKeyState *pri_key1) +{ + if(n_byte_size <= 0 || d_byte_size <= 0 || pri_key1 == NULL) + { + if(pri_key1) + free(pri_key1); + return; + } + + int rsa1_size = 0; + if(ippsRSA_GetSizePrivateKeyType1(n_byte_size * 8, d_byte_size * 8, &rsa1_size) != ippStsNoErr) + { + free(pri_key1); + return; + } + /* Clear the buffer before free. */ + memset_s(pri_key1, rsa1_size, 0, rsa1_size); + free(pri_key1); + return; +} + +extern "C" void secure_free_rsa_pri2_key(int p_byte_size, IppsRSAPrivateKeyState *pri_key2) +{ + if(p_byte_size <= 0 || pri_key2 == NULL) + { + if(pri_key2) + free(pri_key2); + return; + } + + int rsa2_size = 0; + if(ippsRSA_GetSizePrivateKeyType2(p_byte_size * 8, p_byte_size * 8, &rsa2_size) != ippStsNoErr) + { + free(pri_key2); + return; + } + /* Clear the buffer before free. */ + memset_s(pri_key2, rsa2_size, 0, rsa2_size); + free(pri_key2); + return; +} diff --git a/common/src/ipp_rsa_pub_key.cpp b/common/src/ipp_rsa_pub_key.cpp new file mode 100644 index 0000000000..dfc3fc3488 --- /dev/null +++ b/common/src/ipp_rsa_pub_key.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** +* File: +* ipp_rsa_pub_key.cpp +*Description: +* Wrapper for rsa public key generation and free +* +*/ + +#include "ipp_wrapper.h" + +#include +#include + +#ifndef _TLIBC_CDECL_ +extern "C" int memset_s(void *s, size_t smax, int c, size_t n); +#endif + +extern "C" IppStatus create_rsa_pub_key(int n_byte_size, int e_byte_size, const Ipp32u *n, const Ipp32u *e, IppsRSAPublicKeyState **new_pub_key) +{ + IppsRSAPublicKeyState *p_pub_key = NULL; + IppsBigNumState *p_n = NULL, *p_e = NULL; + int rsa_size = 0; + if(n_byte_size <= 0 || e_byte_size <= 0 || n == NULL || e == NULL || new_pub_key == NULL) + { + return ippStsBadArgErr; + } + + IppStatus error_code = ippStsNoErr; + do{ + error_code = newBN(n, n_byte_size, &p_n); + ERROR_BREAK(error_code); + error_code = newBN(e, e_byte_size, &p_e); + ERROR_BREAK(error_code); + + error_code = ippsRSA_GetSizePublicKey(n_byte_size * 8, e_byte_size * 8, &rsa_size); + ERROR_BREAK(error_code); + p_pub_key = (IppsRSAPublicKeyState *)malloc(rsa_size); + NULL_BREAK(p_pub_key); + error_code = ippsRSA_InitPublicKey(n_byte_size * 8, e_byte_size * 8, p_pub_key, rsa_size); + ERROR_BREAK(error_code); + error_code = ippsRSA_SetPublicKey(p_n, p_e, p_pub_key); + ERROR_BREAK(error_code); + }while(0); + secure_free_BN(p_n, n_byte_size); + secure_free_BN(p_e, e_byte_size); + if(error_code != ippStsNoErr || p_pub_key == NULL) + { + if(error_code == ippStsNoErr ) + error_code = ippStsMemAllocErr; + + secure_free_rsa_pub_key(n_byte_size, e_byte_size, p_pub_key); + return error_code; + } + + *new_pub_key = p_pub_key; + return error_code; + +} + +extern "C" void secure_free_rsa_pub_key(int n_byte_size, int e_byte_size, IppsRSAPublicKeyState *pub_key) +{ + if(n_byte_size <= 0 || e_byte_size <= 0 || pub_key == NULL) + { + if(pub_key) + free(pub_key); + return; + } + int rsa_size = 0; + if(ippsRSA_GetSizePublicKey(n_byte_size * 8, e_byte_size * 8, &rsa_size) != ippStsNoErr) + { + free(pub_key); + return; + } + /* Clear the buffer before free. */ + memset_s(pub_key, rsa_size, 0, rsa_size); + free(pub_key); + return; +} diff --git a/common/src/se_event.c b/common/src/se_event.c new file mode 100644 index 0000000000..132e48b204 --- /dev/null +++ b/common/src/se_event.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_event.h" + +#include + +se_handle_t se_event_init(void) +{ + return calloc(1, sizeof(int)); +} + +void se_event_destroy(se_handle_t se_event) +{ + if (se_event != NULL) + free(se_event); +} + +int se_event_wait(se_handle_t se_event) +{ + if (se_event == NULL) + return SE_MUTEX_INVALID; + + if (__sync_fetch_and_add((int*)se_event, -1) == 0) + syscall(__NR_futex, se_event, FUTEX_WAIT, -1, NULL, NULL, 0); + + return SE_MUTEX_SUCCESS; +} + +int se_event_wake(se_handle_t se_event) +{ + if (se_event == NULL) + return SE_MUTEX_INVALID; + + if (__sync_fetch_and_add((int*)se_event, 1) != 0) + syscall(__NR_futex, se_event, FUTEX_WAKE, 1, NULL, NULL, 0); + + return SE_MUTEX_SUCCESS; +} diff --git a/common/src/se_map.c b/common/src/se_map.c new file mode 100644 index 0000000000..687d035012 --- /dev/null +++ b/common/src/se_map.c @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "se_map.h" +#include "se_trace.h" +#include + +map_handle_t* map_file(se_file_handle_t fd, uint32_t *size) +{ + struct stat st; + memset(&st, 0, sizeof(st)); + if (-1 == fstat(fd, &st)) + return NULL; + + map_handle_t* mh = (map_handle_t *)calloc(1, sizeof(map_handle_t)); + if (mh == NULL) + return NULL; + + mh->base_addr = (uint8_t *)mmap(NULL, (size_t)st.st_size, + PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); + if(MAP_FAILED == mh->base_addr) + { + free(mh); + SE_TRACE(SE_TRACE_WARNING, "Couldn't map view of file, error code %x\n", errno); + return NULL; + } + + mh->length = (size_t)st.st_size; + if (size) *size = (uint32_t)st.st_size; + return mh; +} + +void unmap_file(map_handle_t* mh) +{ + munmap(mh->base_addr, mh->length); + free(mh); +} + + diff --git a/common/src/se_memory.c b/common/src/se_memory.c new file mode 100644 index 0000000000..d860b6bc34 --- /dev/null +++ b/common/src/se_memory.c @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "se_memory.h" +#include "se_trace.h" +#include "util.h" + +void* se_virtual_alloc(void* address, size_t size, uint32_t type) +{ + UNUSED(type); + void* pRet = mmap(address, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if(MAP_FAILED == pRet) + return NULL; + return pRet; +} + +int se_virtual_free(void* address, size_t size, uint32_t type) +{ + UNUSED(type); + + return !(munmap(address, size)); + +} + +int se_virtual_lock(void* address, size_t size) +{ + return !mlock(address, size); +} + +static unsigned int get_prot(uint64_t flags) +{ + if ((flags & SI_FLAG_PT_MASK) == SI_FLAG_TCS) + return PROT_READ|PROT_WRITE|PROT_EXEC; + + switch (flags & (SI_FLAG_R | SI_FLAG_W | SI_FLAG_X)) + { + case SI_FLAG_X: return PROT_EXEC; break; + case SI_FLAG_R | SI_FLAG_X: return PROT_READ|PROT_EXEC; break; + case SI_FLAG_R | SI_FLAG_W | SI_FLAG_X: return PROT_READ|PROT_WRITE|PROT_EXEC; break; + case SI_FLAG_R: return PROT_READ; break; + case SI_FLAG_R | SI_FLAG_W: return PROT_READ|PROT_WRITE; break; + /* This covers no access, W and WX */ + default: return PROT_NONE; break; + } + +} +int se_virtual_protect(void* address, size_t size, uint32_t prot) +{ + return !mprotect(address, size, (int)get_prot(prot)); +} + +se_proc_t get_self_proc() +{ + return getpid(); +} + +int put_self_proc(se_proc_t proc) +{ + UNUSED(proc); + return 1; +} + +int se_read_process_mem(se_proc_t proc, void* base_addr, void* buffer, size_t size, size_t* read_nr) +{ + char filename[64]; + int fd = -1; + int ret = FALSE; + ssize_t len = 0; + off64_t offset = (off64_t)(size_t) base_addr; + + snprintf (filename, 64, "/proc/%d/mem", (int)proc); + fd = open(filename, O_RDONLY | O_LARGEFILE); + if(fd == -1) + return FALSE; + + if(lseek64(fd, offset, SEEK_SET) == -1) + { + goto out; + } + if((len = read(fd, buffer, size)) < 0) + { + goto out; + } + else if(read_nr) + *read_nr = (size_t)len; /* len is a non-negative number */ + + ret = TRUE; + +out: + close (fd); + return ret; +} + +int se_write_process_mem(se_proc_t proc, void* base_addr, void* buffer, size_t size, size_t* write_nr) +{ + char filename[64]; + int fd = -1; + int ret = FALSE; + ssize_t len = 0; + off64_t offset = (off64_t)(size_t)base_addr; + + snprintf (filename, 64, "/proc/%d/mem", (int)proc); + fd = open(filename, O_RDWR | O_LARGEFILE); + if(fd == -1) + return FALSE; + + if(lseek64(fd, offset, SEEK_SET) == -1) + { + goto out; + } + if((len = write(fd, buffer, size)) < 0) + { + goto out; + } + else if(write_nr) + *write_nr = (size_t)len; /* len is a non-negative number */ + + ret = TRUE; +out: + close (fd); + return ret; +} + diff --git a/common/src/se_rwlock.c b/common/src/se_rwlock.c new file mode 100644 index 0000000000..9164a123f7 --- /dev/null +++ b/common/src/se_rwlock.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_rwlock.h" +#include "internal/util.h" + + +#include +void se_wtlock(se_prwlock_t lock) +{ + int ret = pthread_rwlock_wrlock(lock); + if(0 != ret) + abort(); +} + +void se_wtunlock(se_prwlock_t lock) +{ + int ret = pthread_rwlock_unlock(lock); + if(0 != ret) + abort(); +} + +int se_try_rdlock(se_prwlock_t lock) +{ + return (0 == pthread_rwlock_tryrdlock(lock)); +} + +void se_rdlock(se_prwlock_t lock) +{ + int ret = pthread_rwlock_rdlock(lock); + if(0 != ret) + abort(); +} + +void se_rdunlock(se_prwlock_t lock) +{ + int ret = pthread_rwlock_unlock(lock); + if(0 != ret) + abort(); +} + +void se_init_rwlock(se_prwlock_t lock) +{ + /* use the default attribute. */ + int ret = pthread_rwlock_init(lock, NULL); + if(0 != ret) + abort(); +} + +void se_fini_rwlock(se_prwlock_t lock) +{ + int ret = pthread_rwlock_destroy(lock); + if(0 != ret) + abort(); +} + diff --git a/common/src/se_thread.c b/common/src/se_thread.c new file mode 100644 index 0000000000..b188a049d1 --- /dev/null +++ b/common/src/se_thread.c @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "se_thread.h" +#include "se_types.h" + +void se_mutex_init(se_mutex_t* mutex) +{ +#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + se_mutex_t tmp = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) + se_mutex_t tmp = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; +#else +#error no pre-defined RECURSIVE_MUTEX found. +#endif + + /* C doesn't allow `*mutex = PTHREAD_..._INITIALIZER'.*/ + memcpy(mutex, &tmp, sizeof(tmp)); +} + +int se_mutex_lock(se_mutex_t* mutex) { return (0 == pthread_mutex_lock(mutex)); } +int se_mutex_unlock(se_mutex_t* mutex) { return (0 == pthread_mutex_unlock(mutex)); } +int se_mutex_destroy(se_mutex_t* mutex) { return (0 == pthread_mutex_destroy(mutex));} + +unsigned int se_get_threadid(void) { return (unsigned)syscall(__NR_gettid);} +/* tls functions */ +int se_tls_alloc(se_tls_index_t *tls_index) { return !pthread_key_create(tls_index, NULL); } +int se_tls_free(se_tls_index_t tls_index) { return !pthread_key_delete(tls_index); } +void * se_tls_get_value(se_tls_index_t tls_index) { return pthread_getspecific(tls_index); } +int se_tls_set_value(se_tls_index_t tls_index, void *tls_value) { return !pthread_setspecific(tls_index, tls_value); } +/* +se_thread_handle_t se_create_thread(size_t stack_size, thread_start_routine_t start_routine, void *param, se_thread_t *thread) +{ + pthread_attr_t attr, *attr_ptr = NULL; + int ret; + + if(stack_size > 0) + { + ret = pthread_attr_init(&attr); + if(ret) + return NULL; + ret = pthread_attr_setstacksize(&attr, stack_size); + if(ret) + return NULL; + attr_ptr = &attr; + } + else + { + attr_ptr = NULL; + } + ret = pthread_create(thread, attr_ptr, start_routine, param); + if(ret) + return NULL; + if(attr_ptr) + pthread_attr_destroy(&attr); + + return thread; + +} +*/ diff --git a/common/src/se_time.c b/common/src/se_time.c new file mode 100644 index 0000000000..20bc84fc38 --- /dev/null +++ b/common/src/se_time.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_time.h" + + +#include +#include +void se_sleep(uint32_t milli_seconds) +{ + usleep(milli_seconds * 1000); +} + +uint64_t se_get_tick_count_freq(void) +{ + return 1000000000ULL; +} + +uint64_t se_get_tick_count(void) +{ + struct timespec tm; + if (clock_gettime(CLOCK_MONOTONIC, &tm) != 0) + return 0; + return ((uint64_t)tm.tv_sec * 1000000000ULL) + ((uint64_t)tm.tv_nsec ); +} diff --git a/common/src/se_trace.c b/common/src/se_trace.c new file mode 100644 index 0000000000..ff81de827d --- /dev/null +++ b/common/src/se_trace.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_trace.h" +#include +int se_trace_internal(int debug_level, const char *fmt, ...) +{ + va_list args; + int ret = 0; + + va_start(args, fmt); + if(SE_TRACE_NOTICE == debug_level) + ret = vfprintf(stdout, fmt, args); + else + ret = vfprintf(stderr, fmt, args); + va_end(args); + + return ret; +} diff --git a/common/src/sgx_memset_s.cpp b/common/src/sgx_memset_s.cpp new file mode 100644 index 0000000000..816c1504e5 --- /dev/null +++ b/common/src/sgx_memset_s.cpp @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alan Barrett + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * ISO/IEC 9899:2011 section K.3.7.4.1 The memset_s function + */ + +#include "sgx_memset_s.h" +#include +#include +#include +/* + * __memset_vp is a volatile pointer to a function. + * It is initialised to point to memset, and should never be changed. + */ +static void * (* const volatile __memset_vp)(void *, int, size_t) + = (memset); + +#ifdef memset_s +#undef memset_s /* in case it was defined as a macro */ +#endif + +#ifdef __cplusplus +extern "C" +#endif +int memset_s(void *s, size_t smax, int c, size_t n) +{ + int err = 0; + + if (s == NULL) { + err = EINVAL; + goto out; + } + + if (n > smax) { + err = EOVERFLOW; + n = smax; + } + + /* Calling through a volatile pointer should never be optimised away. */ + (*__memset_vp)(s, c, n); + + out: + if (err == 0) + return 0; + else { + errno = err; + /* XXX call runtime-constraint handler */ + return err; + } +} + diff --git a/common/src/sgx_profile.cpp b/common/src/sgx_profile.cpp new file mode 100644 index 0000000000..17244cd008 --- /dev/null +++ b/common/src/sgx_profile.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifdef _PROFILE_ + +#include +#include +#include +#include "sgx_profile.h" +#include "se_time.h" +#include +using namespace std; + +typedef struct _profile_item_t{ + const char *str; /* tag */ + int flag; /* 0: start, 1: end */ + long long time; /* current time */ +} profile_item_t; + +static vector profile_items; +static int alloc_size; +static int used_size; +const int MALLOC_SIZE = 1000; +static long long freq = {0}; + +#define MALLOC_TAG "PROFILE_MALLOC_CONSUMED_TIME" + +extern "C" void profile_init() +{ + freq = se_get_tick_count_freq(); + profile_items.resize(MALLOC_SIZE); + alloc_size = MALLOC_SIZE; + used_size = 0; +} + +static void profile_add_info(const char *str, int flag) +{ + long long cur_time = se_get_tick_count(); + if(used_size==alloc_size){ + alloc_size+=MALLOC_SIZE; + profile_items.resize(alloc_size); + profile_items[used_size].flag = PRO_START; + profile_items[used_size].str = MALLOC_TAG; + profile_items[used_size].time = cur_time; + cur_time = se_get_tick_count(); + used_size++; + profile_items[used_size].flag = PRO_END; + profile_items[used_size].str = MALLOC_TAG; + profile_items[used_size].time = cur_time; + used_size++; + } + profile_items[used_size].flag = flag; + profile_items[used_size].str = str; + profile_items[used_size].time = cur_time; + used_size++; +} + +extern "C" void profile_start(const char* str) +{ + profile_add_info(str, PRO_START); +} + +extern "C" void profile_end(const char * str) +{ + profile_add_info(str, PRO_END); +} + +#include +std::string get_prof_fun_name(const char *s) +{ + std::string input(s); + size_t end = input.find("("); + size_t begin = input.substr(0,end).rfind(" ")+1; + end = end - begin; + return input.substr(begin,end); +} + +extern "C" void profile_output(const char* filename) +{ + int i,j; + + ofstream fs; + fs.open(filename); /* do not overwritten previous value */ + + fs << "freq: " << freq <str << endl; */ + return; + } + } + } + + if(j == used_size) + { + /* cout << "Error: not find end for " << it->str << endl; */ + return; + } + + fs << get_prof_fun_name(profile_items[i].str) << "," << profile_items[i].time << "," << profile_items[j].time << endl; + } + profile_items.clear(); + used_size=0; + alloc_size=0; + fs.close(); + +} +#endif diff --git a/common/src/sgx_read_rand.cpp b/common/src/sgx_read_rand.cpp new file mode 100644 index 0000000000..410ea6979c --- /dev/null +++ b/common/src/sgx_read_rand.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* Please add external/rdrand into INCLUDE path and correpondent library to project */ + +#include +#include +#include +#include "sgx.h" +#include "sgx_defs.h" +#include "se_wrapper.h" +#include "rdrand.h" +#include "cpuid.h" +#include +#ifndef UINT32_MAX +#define UINT32_MAX 0xFFFFFFFFU +#endif + +static int g_is_rdrand_supported=-1; + +#define RDRAND_MASK 0x40000000 + +static int rdrand_cpuid() +{ + int info[4] = {-1, -1, -1, -1}; + + /* Are we on an Intel processor? */ + + __cpuid(info, 0); + + if (memcmp(&info[1], "Genu", 4) != 0 || + memcmp(&info[3], "ineI", 4) != 0 || + memcmp(&info[2], "ntel", 4) != 0 ) { + return 0; + } + + /* Do we have RDRAND? */ + + __cpuid(info, /*feature bits*/1); + + int ecx = info[2]; + if ((ecx & RDRAND_MASK) == RDRAND_MASK) + return 1; + else + return 0; +} + + +extern "C" sgx_status_t SGXAPI sgx_read_rand(uint8_t *buf, size_t size) +{ + if(buf == NULL || size == 0 || size> UINT32_MAX ){ + return SGX_ERROR_INVALID_PARAMETER; + } + if(g_is_rdrand_supported==-1){ + g_is_rdrand_supported = rdrand_cpuid(); + } + if(!g_is_rdrand_supported){ + uint32_t i; + for(i=0;i<(uint32_t)size;++i){ + buf[i]=(uint8_t)rand(); + } + }else{ + int rd_ret =rdrand_get_bytes((uint32_t)size, buf); + if(rd_ret != RDRAND_SUCCESS){ + rd_ret = rdrand_get_bytes((uint32_t)size, buf); + if(rd_ret != RDRAND_SUCCESS){ + return SGX_ERROR_UNEXPECTED; + } + } + } + return SGX_SUCCESS; +} diff --git a/common/src/sgx_sha256_128.cpp b/common/src/sgx_sha256_128.cpp new file mode 100644 index 0000000000..a12618b7d1 --- /dev/null +++ b/common/src/sgx_sha256_128.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_sha256_128.h" + +/* +** SHA256-128 implementation: +** out-length := x ¨C number of bits to output +** prefix := SHA-256(out-length) +** digest := SHA-256(prefix || m) +** output := truncate(digest, out-length) ? always return first out-length bits +*/ +sgx_status_t SGXAPI sgx_sha256_128_msg(const uint8_t *p_src, uint32_t src_len, sgx_sha256_128_hash_t *p_hash) +{ + uint32_t outlength = 128; /*number of bits to output */ + uint32_t sha256_128_digest_length; + sgx_status_t ret; + sgx_sha256_hash_t digest = {0}; + uint8_t* digest_buffer = NULL; + + /* check potential overflow and NULL pointer */ + if( (UINT32_MAX-src_len) < sizeof(sgx_sha256_hash_t) || !p_hash || !p_src) + return SGX_ERROR_INVALID_PARAMETER; + + sha256_128_digest_length = (uint32_t)sizeof(sgx_sha256_hash_t)+ src_len; + + digest_buffer = (uint8_t*)malloc(sha256_128_digest_length); + if(!digest_buffer) + return SGX_ERROR_OUT_OF_MEMORY; + memset(digest_buffer, 0, sha256_128_digest_length); + + /* get prefix := SHA-256(out-length) */ + ret = sgx_sha256_msg((const uint8_t*)&outlength, sizeof(uint32_t), (sgx_sha256_hash_t*)digest_buffer); + if(SGX_SUCCESS != ret) + goto clean_up; + + /* get digest := SHA-256(prefix || m) */ + memcpy(digest_buffer+sizeof(sgx_sha256_hash_t), p_src, src_len); /* copy m to digest_buffer */ + ret = sgx_sha256_msg((const uint8_t*)digest_buffer, sha256_128_digest_length, &digest); + if(SGX_SUCCESS != ret) + goto clean_up; + + /* output truncated hash + return the first 128 bits */ + memcpy(p_hash, &digest, sizeof(sgx_sha256_128_hash_t)); + +clean_up: + if(digest_buffer) + free(digest_buffer); + + return ret; +} diff --git a/download_prebuilt.sh b/download_prebuilt.sh new file mode 100755 index 0000000000..84533dd102 --- /dev/null +++ b/download_prebuilt.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +top_dir=`dirname $0` +out_dir=$top_dir/psw/ae/data/prebuilt +server_url=https://01.org/sites/default/files/downloads/intelr-software-guard-extensions-linux-os/sgxprebuilt-1.5.80.27216.tar +wget $server_url -P $out_dir +if [ $? -ne 0 ]; then + echo "Fail to download file $server_url" + exit -1 +fi +pushd $out_dir;tar -xf sgxprebuilt-1.5.80.27216.tar;rm -rf sgxprebuilt-1.5.80.27216.tar;popd diff --git a/external/crypto_px/Makefile b/external/crypto_px/Makefile new file mode 100644 index 0000000000..5c70a24ef6 --- /dev/null +++ b/external/crypto_px/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CFLAGS += $(ENCLAVE_CFLAGS) -D_PX +ifeq ($(ARCH), x86_64) + CFLAGS += -D_ARCH_EM64T +else + CFLAGS += -D_ARCH_IA32 +endif + +INC := -I./include \ + -I./sources/include \ + -I./sources/ippcp/src + +SRCS := $(wildcard ./sources/ippcp/src/*.c) +OBJS := $(SRCS:.c=.o) + +libcrypto_px.a: $(OBJS) + ar crv $@ $^ + +%.o :%.c + $(CC) -c $(INC) $(CFLAGS) $< -o $@ + +.PHONY: all +all: libcrypto_px.a + +.PHONY: clean +clean: + @$(RM) $(OBJS) libcrypto_px.a + +.PHONY: rebuild +rebuild: clean all diff --git a/external/crypto_px/include/ippbase.h b/external/crypto_px/include/ippbase.h new file mode 100755 index 0000000000..fdcd79e2c6 --- /dev/null +++ b/external/crypto_px/include/ippbase.h @@ -0,0 +1,195 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPBASE_H__ +#define __IPPBASE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define __STDCALL __stdcall + #define __CDECL __cdecl + #define __INT64 __int64 + #define __UINT64 unsigned __int64 +#else + #define __STDCALL + #define __CDECL + #define __INT64 long long + #define __UINT64 unsigned long long +#endif + +#define IPP_PI ( 3.14159265358979323846 ) /* ANSI C does not support M_PI */ +#define IPP_2PI ( 6.28318530717958647692 ) /* 2*pi */ +#define IPP_PI2 ( 1.57079632679489661923 ) /* pi/2 */ +#define IPP_PI4 ( 0.78539816339744830961 ) /* pi/4 */ +#define IPP_PI180 ( 0.01745329251994329577 ) /* pi/180 */ +#define IPP_RPI ( 0.31830988618379067154 ) /* 1/pi */ +#define IPP_SQRT2 ( 1.41421356237309504880 ) /* sqrt(2) */ +#define IPP_SQRT3 ( 1.73205080756887729353 ) /* sqrt(3) */ +#define IPP_LN2 ( 0.69314718055994530942 ) /* ln(2) */ +#define IPP_LN3 ( 1.09861228866810969139 ) /* ln(3) */ +#define IPP_E ( 2.71828182845904523536 ) /* e */ +#define IPP_RE ( 0.36787944117144232159 ) /* 1/e */ +#define IPP_EPS23 ( 1.19209289e-07f ) +#define IPP_EPS52 ( 2.2204460492503131e-016 ) + +#define IPP_MAX_8U ( 0xFF ) +#define IPP_MAX_16U ( 0xFFFF ) +#define IPP_MAX_32U ( 0xFFFFFFFF ) +#define IPP_MIN_8U ( 0 ) +#define IPP_MIN_16U ( 0 ) +#define IPP_MIN_32U ( 0 ) +#define IPP_MIN_8S (-128 ) +#define IPP_MAX_8S ( 127 ) +#define IPP_MIN_16S (-32768 ) +#define IPP_MAX_16S ( 32767 ) +#define IPP_MIN_32S (-2147483647 - 1 ) +#define IPP_MAX_32S ( 2147483647 ) +#define IPP_MIN_64U ( 0 ) + +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define IPP_MAX_64S ( 9223372036854775807i64 ) + #define IPP_MIN_64S (-9223372036854775807i64 - 1 ) + #define IPP_MAX_64U ( 0xffffffffffffffffL ) /* 18446744073709551615 */ +#else + #define IPP_MAX_64S ( 9223372036854775807LL ) + #define IPP_MIN_64S (-9223372036854775807LL - 1 ) + #define IPP_MAX_64U ( 0xffffffffffffffffLL ) /* 18446744073709551615 */ +#endif + +#define IPP_MINABS_32F ( 1.175494351e-38f ) +#define IPP_MAXABS_32F ( 3.402823466e+38f ) +#define IPP_EPS_32F ( 1.192092890e-07f ) +#define IPP_MINABS_64F ( 2.2250738585072014e-308 ) +#define IPP_MAXABS_64F ( 1.7976931348623158e+308 ) +#define IPP_EPS_64F ( 2.2204460492503131e-016 ) + +#define IPP_MAX( a, b ) ( ((a) > (b)) ? (a) : (b) ) +#define IPP_MIN( a, b ) ( ((a) < (b)) ? (a) : (b) ) + +#define IPP_ABS( a ) ( ((a) < 0) ? (-(a)) : (a) ) + +typedef struct { + int major; /* e.g. 1 */ + int minor; /* e.g. 2 */ + int majorBuild; /* e.g. 3 */ + int build; /* e.g. 10, always >= majorBuild */ + char targetCpu[4]; /* corresponding to Intel(R) processor */ + const char* Name; /* e.g. "ippsw7" */ + const char* Version; /* e.g. "v1.2 Beta" */ + const char* BuildDate; /* e.g. "Jul 20 99" */ +} IppLibraryVersion; + +typedef unsigned char Ipp8u; +typedef unsigned short Ipp16u; +typedef unsigned int Ipp32u; +typedef signed char Ipp8s; +typedef signed short Ipp16s; +typedef signed int Ipp32s; +typedef float Ipp32f; +typedef __INT64 Ipp64s; +typedef __UINT64 Ipp64u; +typedef double Ipp64f; +typedef Ipp16s Ipp16f; + +typedef struct { + Ipp8s re; + Ipp8s im; +} Ipp8sc; + +typedef struct { + Ipp16s re; + Ipp16s im; +} Ipp16sc; + +typedef struct { + Ipp16u re; + Ipp16u im; +} Ipp16uc; + +typedef struct { + Ipp32s re; + Ipp32s im; +} Ipp32sc; + +typedef struct { + Ipp32f re; + Ipp32f im; +} Ipp32fc; + +typedef struct { + Ipp64s re; + Ipp64s im; +} Ipp64sc; + +typedef struct { + Ipp64f re; + Ipp64f im; +} Ipp64fc; + +typedef enum { + ippUndef = -1, + ipp1u = 0, + ipp8u = 1, + ipp8uc = 2, + ipp8s = 3, + ipp8sc = 4, + ipp16u = 5, + ipp16uc = 6, + ipp16s = 7, + ipp16sc = 8, + ipp32u = 9, + ipp32uc = 10, + ipp32s = 11, + ipp32sc = 12, + ipp32f = 13, + ipp32fc = 14, + ipp64u = 15, + ipp64uc = 16, + ipp64s = 17, + ipp64sc = 18, + ipp64f = 19, + ipp64fc = 20 +} IppDataType; + +typedef enum { + ippFalse = 0, + ippTrue = 1 +} IppBool; + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPBASE_H__ */ + diff --git a/external/crypto_px/include/ippcore.h b/external/crypto_px/include/ippcore.h new file mode 100755 index 0000000000..e4bc012bc6 --- /dev/null +++ b/external/crypto_px/include/ippcore.h @@ -0,0 +1,395 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined( __IPPCORE_H__ ) || defined( _OWN_BLDPCS ) +#define __IPPCORE_H__ + +#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall) + #define _IPP_STDCALL_CDECL + #undef __stdcall +#endif + +#ifndef __IPPDEFS_H__ + #include "ippdefs.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !defined( _IPP_NO_DEFAULT_LIB ) + #if defined( _IPP_SEQUENTIAL_DYNAMIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcore" ) + #elif defined( _IPP_SEQUENTIAL_STATIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcoremt" ) + #elif defined( _IPP_PARALLEL_DYNAMIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcore" ) + #elif defined( _IPP_PARALLEL_STATIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcoremt" ) + #endif +#endif + +/* ///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// Functions declarations +//////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// */ + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippGetLibVersion +// Purpose: getting of the library version +// Returns: the structure of information about version +// of ippcore library +// Parameters: +// +// Notes: not necessary to release the returned structure +*/ +IPPAPI( const IppLibraryVersion*, ippGetLibVersion, (void) ) + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippGetStatusString +// Purpose: convert the library status code to a readable string +// Parameters: +// StsCode IPP status code +// Returns: pointer to string describing the library status code +// +// Notes: don't free the pointer +*/ +IPPAPI( const char*, ippGetStatusString, ( IppStatus StsCode ) ) + + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippGetCpuClocks +// Purpose: reading of time stamp counter (TSC) register value +// Returns: TSC value +// +// Note: An hardware exception is possible if TSC reading is not supported by +/ the current chipset +*/ + +IPPAPI( Ipp64u, ippGetCpuClocks, (void) ) + + +/* /////////////////////////////////////////////////////////////////////////// +// Names: ippSetFlushToZero, +// ippSetDenormAreZero. +// +// Purpose: ippSetFlushToZero enables or disables the flush-to-zero mode, +// ippSetDenormAreZero enables or disables the denormals-are-zeros +// mode. +// +// Arguments: +// value - !0 or 0 - set or clear the corresponding bit of MXCSR +// pUMask - pointer to user store current underflow exception mask +// ( may be NULL if don't want to store ) +// +// Return: +// ippStsNoErr - Ok +// ippStsCpuNotSupportedErr - the mode is not supported +*/ + +IPPAPI( IppStatus, ippSetFlushToZero, ( int value, unsigned int* pUMask )) +IPPAPI( IppStatus, ippSetDenormAreZeros, ( int value )) + + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippAlignPtr +// Purpose: pointer aligning +// Returns: aligned pointer +// +// Parameter: +// ptr - pointer +// alignBytes - number of bytes to align +// +*/ +IPPAPI( void*, ippAlignPtr, ( void * ptr, int alignBytes ) ) + +/* ///////////////////////////////////////////////////////////////////////////// +// Functions to allocate and free memory +///////////////////////////////////////////////////////////////////////////// */ +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippMalloc +// Purpose: 64-byte aligned memory allocation +// Parameter: +// len number of bytes +// Returns: pointer to allocated memory +// +// Notes: the memory allocated by ippMalloc has to be free by ippFree +// function only. +*/ + +IPPAPI( void*, ippMalloc, (int length) ) + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippFree +// Purpose: free memory allocated by the ippMalloc function +// Parameter: +// ptr pointer to the memory allocated by the ippMalloc function +// +// Notes: use the function to free memory allocated by ippMalloc +*/ +IPPAPI( void, ippFree, (void* ptr) ) + + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippInit +// Purpose: Automatic switching to best for current cpu library code using. +// Returns: +// ippStsNoErr +// +// Parameter: nothing +// +// Notes: At the moment of this function execution no any other IPP function +// has to be working +*/ +IPPAPI( IppStatus, ippInit, ( void )) + + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippGetCpuFreqMhz +// +// Purpose: the function estimates cpu frequency and returns +// its value in MHz as a integer +// +// Return: +// ippStsNoErr Ok +// ippStsNullPtrErr null pointer to the freq value +// ippStsSizeErr wrong num of tries, internal var +// Arguments: +// pMhz pointer to the integer to write +// cpu freq value estimated +// +// Notes: no exact value is guaranteed, the value could +// vary with cpu workloading +*/ + +IPPAPI(IppStatus, ippGetCpuFreqMhz, ( int* pMhz ) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippSetNumThreads +// +// Purpose: +// +// Return: +// ippStsNoErr Ok +// ippStsNoOperation For static library internal threading is not supported +// ippStsSizeErr Desired number of threads less or equal zero +// +// Arguments: +// numThr Desired number of threads +*/ +IPPAPI( IppStatus, ippSetNumThreads, ( int numThr ) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippGetNumThreads +// +// Purpose: +// +// Return: +// ippStsNoErr Ok +// ippStsNullPtrErr Pointer to numThr is Null +// ippStsNoOperation For static library internal threading is not supported +// and return value is always == 1 +// +// Arguments: +// pNumThr Pointer to memory location where to store current numThr +*/ +IPPAPI( IppStatus, ippGetNumThreads, (int* pNumThr) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippGetMaxCacheSizeB +// +// Purpose: Detects maximal from the sizes of L2 or L3 in bytes +// +// Return: +// ippStsNullPtrErr The result's pointer is NULL. +// ippStsNotSupportedCpu The cpu is not supported. +// ippStsUnknownCacheSize The cpu is supported, but the size of the cache is unknown. +// ippStsNoErr Ok +// +// Arguments: +// pSizeByte Pointer to the result +// +// Note: +// 1). Intel(R) processors are supported only. +// 2). Intel(R) Itanium(R) processors and platforms with Intel XScale(R) technology are unsupported +// 3). For unsupported processors the result is "0", +// and the return status is "ippStsNotSupportedCpu". +// 4). For supported processors the result is "0", +// and the return status is "ippStsUnknownCacheSize". +// if sizes of the cache is unknown. +// +*/ +IPPAPI( IppStatus, ippGetMaxCacheSizeB, ( int* pSizeByte ) ) + +/* +// Name: ippGetCpuFeatures +// Purpose: Detects CPU features. +// Parameters: +// pFeaturesMask Pointer to the features mask. +// Nonzero value of bit means the corresponding feature is supported. +// Features mask values are defined in the ippdefs.h +// [ 0] - MMX ( ippCPUID_MMX ) +// [ 1] - SSE ( ippCPUID_SSE ) +// [ 2] - SSE2 ( ippCPUID_SSE2 ) +// [ 3] - SSE3 ( ippCPUID_SSE3 ) +// [ 4] - SSSE3 ( ippCPUID_SSSE3 ) +// [ 5] - MOVBE ( ippCPUID_MOVBE ) +// [ 6] - SSE41 ( ippCPUID_SSE41 ) +// [ 7] - SSE42 ( ippCPUID_SSE42 ) +// [ 8] - AVX ( ippCPUID_AVX ) +// [ 9] - ENABLEDBYOS( ippAVX_ENABLEDBYOS ) +// [10] - AES ( ippCPUID_AES ) +// [11] - PCLMULQDQ ( ippCPUID_CLMUL ) +// [12] - ABR ( ippCPUID_ABR ) +// [13] - RDRAND ( ippCPUID_RDRAND ) +// [14] - F16C ( ippCPUID_F16C ) +// [15] - AVX2 ( ippCPUID_AVX2 ) +// [16] - ADOX/ADCX ( ippCPUID_ADCOX ) ADCX and ADOX instructions +// [17] - RDSEED ( ippCPUID_RDSEED ) The RDSEED instruction +// [18] - PREFETCHW ( ippCPUID_PREFETCHW ) The PREFETCHW instruction +// [19] - SHA ( ippCPUID_SHA ) Intel (R) SHA Extensions +// [20:63] - Reserved +// +// pCpuidInfoRegs Pointer to the 4-element vector. +// Result of CPUID.1 are stored in this vector. +// [0] - register EAX +// [1] - register EBX +// [2] - register ECX +// [3] - register EDX +// If pointer pCpuidInfoRegs is set to NULL, registers are not stored. +// +// Returns: +// ippStsNullPtrErr The pointer to the features mask (pFeaturesMask) is NULL. +// ippStsNotSupportedCpu CPU is not supported. +// ippStsNoErr Ok +// +// Note: Only IA-32 and Intel(R) 64 are supported +*/ +IPPAPI( IppStatus, ippGetCpuFeatures, ( Ipp64u* pFeaturesMask, + Ipp32u pCpuidInfoRegs[4] ) ) + +/* +// Name: ippGetEnabledCpuFeatures +// Purpose: Detects enabled features for loaded libraries +// Returns: Features mask +// Features mask values are defined in the ippdefs.h +// [ 0] - ippCPUID_MMX +// [ 1] - ippCPUID_SSE +// [ 2] - ippCPUID_SSE2 +// [ 3] - ippCPUID_SSE3 +// [ 4] - ippCPUID_SSSE3 +// [ 5] - ippCPUID_MOVBE +// [ 6] - ippCPUID_SSE41 +// [ 7] - ippCPUID_SSE42 +// [ 8] - ippCPUID_AVX +// [ 9] - ippAVX_ENABLEDBYOS +// [10] - ippCPUID_AES +// [11] - ippCPUID_CLMUL +// [12] - ippCPUID_ABR +// [13] - ippCPUID_RDRAND +// [14] - ippCPUID_F16C +// [15] - ippCPUID_AVX2 +// [16] - ippCPUID_ADCOX +// [17] - ippCPUID_RDSEED +// [18] - ippCPUID_PREFETCHW +// [19] - ippCPUID_SHA +// [20:63] - Reserved +// +*/ +IPPAPI( Ipp64u, ippGetEnabledCpuFeatures, ( void ) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippSetCpuFeatures +// +// Purpose: Changes the set of enabled/disabled CPU features. +// This function sets the processor-specific code of the Intel IPP +// library according to the processor features specified in cpuFeatures. +// +// Return: +// ippStsNoErr No errors. +// Warnings: +// ippStsFeatureNotSupported Current CPU doesn't support at least 1 of the +// desired features; +// ippStsUnknownFeature At least one of the desired features is unknown; +// ippStsFeaturesCombination Wrong combination of features; +// ippStsCpuMismatch Indicates that the specified processor features +// are not valid. Previously set code is used. +// +// Arguments: +// cpuFeatures Desired features to support by the library +// (see ippdefs.h for ippCPUID_XX definition) +// +// NOTE: this function can re-initializes dispatcher and after the +// call another library (letter) may work +// CAUTION: At the moment of this function excecution no any other IPP +// function has to be working +// +// The next pre-defined sets of features can be used: +// 32-bit code: +// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE ) +// #define W7_FM ( PX_FM | ippCPUID_SSE2 ) +// #define V8_FM ( W7_FM | ippCPUID_SSE3 | ippCPUID_SSSE3 ) +// #define S8_FM ( V8_FM | ippCPUID_MOVBE ) +// #define P8_FM ( V8_FM | ippCPUID_SSE41 | ippCPUID_SSE42 | ippCPUID_AES | ippCPUID_CLMUL | ippCPUID_SHA ) +// #define G9_FM ( P8_FM | ippCPUID_AVX | ippAVX_ENABLEDBYOS | ippCPUID_RDRAND | ippCPUID_F16C ) +// #define H9_FM ( G9_FM | ippCPUID_AVX2 | ippCPUID_MOVBE | ippCPUID_ADCOX | ippCPUID_RDSEED | ippCPUID_PREFETCHW ) +// +// 64-bit code: +// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE | ippCPUID_SSE2 ) +// #define M7_FM ( PX_FM | ippCPUID_SSE3 ) +// #define N8_FM ( S8_FM ) +// #define U8_FM ( V8_FM ) +// #define Y8_FM ( P8_FM ) +// #define E9_FM ( G9_FM ) +// #define L9_FM ( H9_FM ) +// +*/ + +IPPAPI( IppStatus, ippSetCpuFeatures,( Ipp64u cpuFeatures )) + +#if defined (_IPP_STDCALL_CDECL) + #undef _IPP_STDCALL_CDECL + #define __stdcall __cdecl +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPCORE_H__ */ diff --git a/external/crypto_px/include/ippcp.h b/external/crypto_px/include/ippcp.h new file mode 100755 index 0000000000..07d92d52b5 --- /dev/null +++ b/external/crypto_px/include/ippcp.h @@ -0,0 +1,327 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined( __IPPCP_H__ ) || defined( _OWN_BLDPCS ) +#define __IPPCP_H__ + + +#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall) + #define _IPP_STDCALL_CDECL + #undef __stdcall +#endif + + +#ifndef __IPPDEFS_H__ + #include "ippdefs.h" +#endif + +#ifndef __IPPCPDEFS_H__ + #include "ippcpdefs.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippcpGetLibVersion +// Purpose: getting of the library version +// Returns: the structure of information about version of ippCP library +// Parameters: +// +// Notes: not necessary to release the returned structure +*/ +IPPAPI( const IppLibraryVersion*, ippcpGetLibVersion, (void) ) + + +/* +// AES +*/ +IPPAPI(IppStatus, ippsAESGetSize,(int *pSize)) +IPPAPI(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) + +/* AES-CTR */ +IPPAPI(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) + +/* AES-GCM */ +IPPAPI(IppStatus, ippsAES_GCMGetSize,(int * pSize)) +IPPAPI(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) + +IPPAPI(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, + IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, + IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, + const Ipp8u* pAAD, int aadLen, + IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) + +/* AES-CMAC */ +IPPAPI(IppStatus, ippsAES_CMACGetSize,(int* pSize)) +IPPAPI(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) + +IPPAPI(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) + +/* +// hash +*/ +IPPAPI(IppStatus, ippsHashGetSize,(int* pSize)) +IPPAPI(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx)) +IPPAPI(IppStatus, ippsHashGetTag,(Ipp8u* pMD, int tagLen, const IppsHashState* pCtx)) +IPPAPI(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx)) +IPPAPI(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsHMAC_GetSize,(int* pSize)) +IPPAPI(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +IPPAPI(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +IPPAPI(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +IPPAPI(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pKey, int keyLen, + Ipp8u* pMD, int mdLen, + IppHashAlgId hashAlg)) + +/* +// Big Number Integer Arithmetic +*/ +IPPAPI(IppStatus, ippsBigNumGetSize,(int length, int* pSize)) +IPPAPI(IppStatus, ippsBigNumInit,(int length, IppsBigNumState* pBN)) + +IPPAPI(IppStatus, ippsSet_BN,(IppsBigNumSGN sgn, + int length, const Ipp32u* pData, + IppsBigNumState* pBN)) +IPPAPI(IppStatus, ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, + const IppsBigNumState* pBN)) + +IPPAPI(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) +IPPAPI(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) +IPPAPI(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) +IPPAPI(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) + +IPPAPI(IppStatus, ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) +IPPAPI(IppStatus, ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) + +/* +// Montgomery Operations +*/ +IPPAPI(IppStatus, ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) +IPPAPI(IppStatus, ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) +IPPAPI(IppStatus, ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) +IPPAPI(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) + +/* +// PRNG +*/ +IPPAPI(IppStatus, ippsPRNGGetSize,(int* pSize)) +IPPAPI(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) + +/* +// Prime Number Generation +*/ +IPPAPI(IppStatus, ippsPrimeGetSize,(int nMaxBits, int* pSize)) +IPPAPI(IppStatus, ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) + + +/* +// RSA +*/ +IPPAPI(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, + IppsRSAPublicKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPublicExp, + IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, + IppsBigNumState* pPublicExp, + const IppsRSAPublicKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPrivateExp, + IppsRSAPrivateKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, + const IppsBigNumState* pFactorQ, + const IppsBigNumState* pCrtExpP, + const IppsBigNumState* pCrtExpQ, + const IppsBigNumState* pInverseQ, + IppsRSAPrivateKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, + IppsBigNumState* pCtxt, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, + IppsBigNumState* pPtxt, + const IppsRSAPrivateKeyState* pKey, + Ipp8u* pScratchBuffer)) + +IPPAPI(IppStatus, ippsRSA_ValidateKeys,(int* pResult, + const IppsRSAPublicKeyState* pPublicKey, + const IppsRSAPrivateKeyState* pPrivateKeyType2, + const IppsRSAPrivateKeyState* pPrivateKeyType1, + Ipp8u* pScratchBuffer, + int nTrials, + IppsPrimeState* pPrimeGen, + IppBitSupplier rndFunc, void* pRndParam)) + +/* encryption scheme: RSAES-OAEP */ +IPPAPI(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +IPPAPI(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pBuffer)) + +/* signature scheme : RSA-SSA-PKCS1-v1_5 */ +IPPAPI(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + Ipp8u* pSign, + const IppsRSAPrivateKeyState* pPrvKey, + const IppsRSAPublicKeyState* pPubKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) + + +IPPAPI(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pSign, int* pIsValid, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) + + +/* +// EC Cryptography +*/ +IPPAPI(IppStatus, ippsECCPGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, ippsECCPInit,(int feBitSize, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSet,(const IppsBigNumState* pPrime, + const IppsBigNumState* pA, const IppsBigNumState* pB, + const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, + int cofactor, + IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSetStd,(IppECCType flag, IppsECCPState* pECC)) + + +IPPAPI(IppStatus, ippsECCPPointGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) + +IPPAPI(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, + IppsECCPPointState* pPoint, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, + const IppsECCPPointState* pPoint, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP, + IppECResult* pResult, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, + IppECResult* pResult, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPNegativePoint,(const IppsECCPPointState* pP, + IppsECCPPointState* pR, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, + IppsECCPPointState* pR, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, + IppsECCPPointState* pR, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, + IppsECCPState* pECC, + IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, ippsECCPPublicKey,(const IppsBigNumState* pPrivate, + IppsECCPPointState* pPublic, + IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, + IppBool regular, + IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, + const IppsECCPPointState* pPublicB, + IppsBigNumState* pShare, + IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pPrivate, + IppsBigNumState* pSignX, IppsBigNumState* pSignY, + IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, + IppECResult* pResult, + IppsECCPState* pECC)) + +#ifdef __cplusplus +} +#endif + +#if defined (_IPP_STDCALL_CDECL) + #undef _IPP_STDCALL_CDECL + #define __stdcall __cdecl +#endif + +#endif /* __IPPCP_H__ */ diff --git a/external/crypto_px/include/ippcpdefs.h b/external/crypto_px/include/ippcpdefs.h new file mode 100755 index 0000000000..c86ee0f3ed --- /dev/null +++ b/external/crypto_px/include/ippcpdefs.h @@ -0,0 +1,211 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPCPDEFS_H__ +#define __IPPCPDEFS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +// AES +*/ +#define IPP_AES_BLOCK_BITSIZE (128) /* cipher blocksizes (bits) */ + +typedef enum { /* cipher keysizes (bits) */ + ippRijndaelKey128 = 128, IppsRijndaelKey128 = 128, /* 128-bit key */ + ippRijndaelKey192 = 192, IppsRijndaelKey192 = 192, /* 192-bit key */ + ippRijndaelKey256 = 256, IppsRijndaelKey256 = 256 /* 256-bit key */ +} IppsRijndaelKeyLength; + +typedef struct _cpRijndael128 IppsAESSpec; +typedef struct _cpAES_GCM IppsAES_GCMState; +typedef struct _cpAES_CMAC IppsAES_CMACState; + + +/* +// hash +*/ +typedef enum { + ippHashAlg_Unknown, + ippHashAlg_SHA1, + ippHashAlg_SHA256, + ippHashAlg_SHA224, + ippHashAlg_SHA512, + ippHashAlg_SHA384, + ippHashAlg_MD5, + ippHashAlg_SHA512_224, + ippHashAlg_SHA512_256, + ippHashAlg_MaxNo +} IppHashAlgId; + +#define IPP_ALG_HASH_UNKNOWN (ippHashAlg_Unknown) /* unknown */ +#define IPP_ALG_HASH_SHA1 (ippHashAlg_SHA1) /* SHA1 */ +#define IPP_ALG_HASH_SHA256 (ippHashAlg_SHA256) /* SHA256 */ +#define IPP_ALG_HASH_SHA224 (ippHashAlg_SHA224) /* SHA224 or SHA256/224 */ +#define IPP_ALG_HASH_SHA512 (ippHashAlg_SHA512) /* SHA512 */ +#define IPP_ALG_HASH_SHA384 (ippHashAlg_SHA384) /* SHA384 or SHA512/384 */ +#define IPP_ALG_HASH_MD5 (ippHashAlg_MD5) /* MD5 */ +#define IPP_ALG_HASH_SHA512_224 (ippHashAlg_SHA512_224) /* SHA512/224 */ +#define IPP_ALG_HASH_SHA512_256 (ippHashAlg_SHA512_256) /* SHA512/256 */ +#define IPP_ALG_HASH_LIMIT (ippHashAlg_MaxNo) /* hash alg limiter*/ + +#define IPP_SHA1_DIGEST_BITSIZE 160 /* digest size (bits) */ +#define IPP_SHA256_DIGEST_BITSIZE 256 +#define IPP_SHA224_DIGEST_BITSIZE 224 +#define IPP_SHA384_DIGEST_BITSIZE 384 +#define IPP_SHA512_DIGEST_BITSIZE 512 +#define IPP_MD5_DIGEST_BITSIZE 128 +#define IPP_SHA512_224_DIGEST_BITSIZE 224 +#define IPP_SHA512_256_DIGEST_BITSIZE 256 + +typedef struct _cpHashCtx IppsHashState; +typedef struct _cpHMAC IppsHMACState; + + +/* +// Big Number Integer Arithmetic +*/ +#define BN_MAXBITSIZE (16*1024) /* bn max size (bits) */ + +/* operation results */ +#define IPP_IS_EQ (0) +#define IPP_IS_GT (1) +#define IPP_IS_LT (2) +#define IPP_IS_NE (3) +#define IPP_IS_NA (4) + +#define IPP_IS_PRIME (5) +#define IPP_IS_COMPOSITE (6) + +#define IPP_IS_VALID (7) +#define IPP_IS_INVALID (8) +#define IPP_IS_INCOMPLETE (9) +#define IPP_IS_ATINFINITY (10) + +#define IS_ZERO IPP_IS_EQ +#define GREATER_THAN_ZERO IPP_IS_GT +#define LESS_THAN_ZERO IPP_IS_LT +#define IS_PRIME IPP_IS_PRIME +#define IS_COMPOSITE IPP_IS_COMPOSITE +#define IS_VALID_KEY IPP_IS_VALID +#define IS_INVALID_KEY IPP_IS_INVALID +#define IS_INCOMPLETED_KEY IPP_IS_INCOMPLETE + +typedef enum { + ippBigNumNEG = 0, IppsBigNumNEG = 0, + ippBigNumPOS = 1, IppsBigNumPOS = 1 +} IppsBigNumSGN; + +typedef enum { + ippBinaryMethod = 0, IppsBinaryMethod = 0, + ippSlidingWindows = 1, IppsSlidingWindows = 1 +} IppsExpMethod; + +typedef struct _cpBigNum IppsBigNumState; +typedef struct _cpMontgomery IppsMontState; +typedef struct _cpPRNG IppsPRNGState; +typedef struct _cpPrime IppsPrimeState; + +/* External Bit Supplier */ +typedef IppStatus (__STDCALL *IppBitSupplier)(Ipp32u* pRand, int nBits, void* pEbsParams); + + +/* +// RSA +*/ +#define MIN_RSA_SIZE (8) +#define MAX_RSA_SIZE (4096) + +typedef struct _cpRSA IppsRSAState; +typedef struct _cpRSA_public_key IppsRSAPublicKeyState; +typedef struct _cpRSA_private_key IppsRSAPrivateKeyState; + + +/* +// EC Cryptography +*/ +#define EC_GFP_MAXBITSIZE (1024) + +typedef struct _cpECCP IppsECCPState; +typedef struct _cpECCPPoint IppsECCPPointState; + +/* operation result */ +typedef enum { + ippECValid, /* validation pass successfully */ + + ippECCompositeBase, /* field based on composite */ + ippECComplicatedBase, /* number of non-zero terms in the polynomial (> PRIME_ARR_MAX) */ + ippECIsZeroDiscriminant,/* zero discriminant */ + ippECCompositeOrder, /* composite order of base point */ + ippECInvalidOrder, /* invalid base point order */ + ippECIsWeakMOV, /* weak Meneze-Okamoto-Vanstone reduction attack */ + ippECIsWeakSSSA, /* weak Semaev-Smart,Satoh-Araki reduction attack */ + ippECIsSupersingular, /* supersingular curve */ + + ippECInvalidPrivateKey, /* !(0 < Private < order) */ + ippECInvalidPublicKey, /* (order*PublicKey != Infinity) */ + ippECInvalidKeyPair, /* (Private*BasePoint != PublicKey) */ + + ippECPointOutOfGroup, /* out of group (order*P != Infinity) */ + ippECPointIsAtInfinite, /* point (P=(Px,Py)) at Infinity */ + ippECPointIsNotValid, /* point (P=(Px,Py)) out-of EC */ + + ippECPointIsEqual, /* compared points are equal */ + ippECPointIsNotEqual, /* compared points are different */ + + ippECInvalidSignature /* invalid signature */ +} IppECResult; + +typedef enum { + ippECarbitrary =0x00000, IppECCArbitrary = 0x00000, /* arbitrary ECC */ + + ippECPstd = 0x10000, IppECCPStd = 0x10000, /* random (recommended) EC over FG(p): */ + ippECPstd112r1 = ippECPstd, IppECCPStd112r1 = IppECCPStd, /* secp112r1 curve */ + ippECPstd112r2 = ippECPstd+1, IppECCPStd112r2 = IppECCPStd+1, /* secp112r2 curve */ + ippECPstd128r1 = ippECPstd+2, IppECCPStd128r1 = IppECCPStd+2, /* secp128r1 curve */ + ippECPstd128r2 = ippECPstd+3, IppECCPStd128r2 = IppECCPStd+3, /* secp128r2 curve */ + ippECPstd160r1 = ippECPstd+4, IppECCPStd160r1 = IppECCPStd+4, /* secp160r1 curve */ + ippECPstd160r2 = ippECPstd+5, IppECCPStd160r2 = IppECCPStd+5, /* secp160r2 curve */ + ippECPstd192r1 = ippECPstd+6, IppECCPStd192r1 = IppECCPStd+6, /* secp192r1 curve */ + ippECPstd224r1 = ippECPstd+7, IppECCPStd224r1 = IppECCPStd+7, /* secp224r1 curve */ + ippECPstd256r1 = ippECPstd+8, IppECCPStd256r1 = IppECCPStd+8, /* secp256r1 curve */ + ippECPstd384r1 = ippECPstd+9, IppECCPStd384r1 = IppECCPStd+9, /* secp384r1 curve */ + ippECPstd521r1 = ippECPstd+10, IppECCPStd521r1 = IppECCPStd+10, /* secp521r1 curve */ +} IppsECType, IppECCType; + + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPCPDEFS_H__ */ diff --git a/external/crypto_px/include/ippdefs.h b/external/crypto_px/include/ippdefs.h new file mode 100755 index 0000000000..4250bf24d4 --- /dev/null +++ b/external/crypto_px/include/ippdefs.h @@ -0,0 +1,129 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPDEFS_H__ +#define __IPPDEFS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined (_WIN64) +#define _INTEL_PLATFORM "intel64/" +#elif defined (_WIN32) +#define _INTEL_PLATFORM "ia32/" +#endif + +#if !defined( IPPAPI ) + + #if defined( IPP_W32DLL ) && (defined( _WIN32 ) || defined( _WIN64 )) + #if defined( _MSC_VER ) || defined( __ICL ) + #define IPPAPI( type,name,arg ) \ + __declspec(dllimport) type __STDCALL name arg; + #else + #define IPPAPI( type,name,arg ) type __STDCALL name arg; + #endif + #else + #define IPPAPI( type,name,arg ) type __STDCALL name arg; + #endif + +#endif + +#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) && !defined( _PCS ) && !defined( _PCS_GENSTUBS ) + #if( __INTEL_COMPILER >= 1100 ) /* icl 11.0 supports additional comment */ + #if( _MSC_VER >= 1400 ) + #define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment )) + #else + #pragma message ("your icl version supports additional comment for deprecated functions but it can't be displayed") + #pragma message ("because internal _MSC_VER macro variable setting requires compatibility with MSVC7.1") + #pragma message ("use -Qvc8 switch for icl command line to see these additional comments") + #define IPP_DEPRECATED( comment ) __declspec( deprecated ) + #endif + #elif( _MSC_FULL_VER >= 140050727 )&&( !defined( __INTEL_COMPILER )) /* VS2005 supports additional comment */ + #define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment )) + #elif( _MSC_VER <= 1200 )&&( !defined( __INTEL_COMPILER )) /* VS 6 doesn't support deprecation */ + #define IPP_DEPRECATED( comment ) + #else + #define IPP_DEPRECATED( comment ) __declspec( deprecated ) + #endif +#elif (defined(__ICC) || defined(__ECC) || defined( __GNUC__ )) && !defined( _PCS ) && !defined( _PCS_GENSTUBS ) + #if defined( __GNUC__ ) + #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5 + #define IPP_DEPRECATED( message ) __attribute__(( deprecated( message ))) + #else + #define IPP_DEPRECATED( message ) __attribute__(( deprecated )) + #endif + #else + #define IPP_DEPRECATED( comment ) __attribute__(( deprecated )) + #endif +#else + #define IPP_DEPRECATED( comment ) +#endif + +#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) + #if !defined( _IPP_NO_DEFAULT_LIB ) + #if (( defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ + (!defined( _IPP_PARALLEL_DYNAMIC ) && defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ + (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ + (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && defined( _IPP_SEQUENTIAL_STATIC ))) + #elif (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) + #define _IPP_NO_DEFAULT_LIB + #else + #error Illegal combination of _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC, only one definition can be defined + #endif + #endif +#else + #define _IPP_NO_DEFAULT_LIB + #if (defined( _IPP_PARALLEL_DYNAMIC ) || defined( _IPP_PARALLEL_STATIC ) || defined(_IPP_SEQUENTIAL_DYNAMIC) || defined(_IPP_SEQUENTIAL_STATIC)) + #pragma message ("defines _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC do not have any effect in current configuration") + #endif +#endif + +#if !defined( _IPP_NO_DEFAULT_LIB ) + #if defined( _IPP_PARALLEL_STATIC ) + #pragma comment( lib, "libircmt" ) + #pragma comment( lib, "libmmt" ) + #pragma comment( lib, "svml_dispmt" ) + #pragma comment( lib, "libiomp5md" ) + #endif +#endif + +#include "ippbase.h" +#include "ipptypes.h" + +extern const IppiRect ippRectInfinite; + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPDEFS_H__ */ diff --git a/external/crypto_px/include/ipptypes.h b/external/crypto_px/include/ipptypes.h new file mode 100755 index 0000000000..684a8e9dbe --- /dev/null +++ b/external/crypto_px/include/ipptypes.h @@ -0,0 +1,1104 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPTYPES_H__ +#define __IPPTYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/*****************************************************************************/ +/* Below are ippCore domain specific definitions */ +/*****************************************************************************/ +#if !defined( _OWN_BLDPCS ) + +#define ippCPUID_MMX 0x00000001 /* Intel Architecture MMX technology supported */ +#define ippCPUID_SSE 0x00000002 /* Streaming SIMD Extensions */ +#define ippCPUID_SSE2 0x00000004 /* Streaming SIMD Extensions 2 */ +#define ippCPUID_SSE3 0x00000008 /* Streaming SIMD Extensions 3 */ +#define ippCPUID_SSSE3 0x00000010 /* Supplemental Streaming SIMD Extensions 3 */ +#define ippCPUID_MOVBE 0x00000020 /* The processor supports MOVBE instruction */ +#define ippCPUID_SSE41 0x00000040 /* Streaming SIMD Extensions 4.1 */ +#define ippCPUID_SSE42 0x00000080 /* Streaming SIMD Extensions 4.2 */ +#define ippCPUID_AVX 0x00000100 /* Advanced Vector Extensions instruction set */ +#define ippAVX_ENABLEDBYOS 0x00000200 /* The operating system supports AVX */ +#define ippCPUID_AES 0x00000400 /* AES instruction */ +#define ippCPUID_CLMUL 0x00000800 /* PCLMULQDQ instruction */ +#define ippCPUID_ABR 0x00001000 /* Reserved */ +#define ippCPUID_RDRAND 0x00002000 /* Read Random Number instructions */ +#define ippCPUID_F16C 0x00004000 /* Float16 instructions */ +#define ippCPUID_AVX2 0x00008000 /* Advanced Vector Extensions 2 instruction set */ +#define ippCPUID_ADCOX 0x00010000 /* ADCX and ADOX instructions */ +#define ippCPUID_RDSEED 0x00020000 /* The RDSEED instruction */ +#define ippCPUID_PREFETCHW 0x00040000 /* The PREFETCHW instruction */ +#define ippCPUID_SHA 0x00080000 /* Intel (R) SHA Extensions */ +#define ippCPUID_AVX512F 0x00100000 /* AVX-512 Foundation instructions */ +#define ippCPUID_AVX512CD 0x00200000 /* AVX-512 Conflict Detection instructions */ +#define ippCPUID_AVX512ER 0x00400000 /* AVX-512 Exponential & Reciprocal instructions*/ +#define ippCPUID_AVX512PF 0x00800000 /* AVX-512 Prefetch instructions */ +#define ippCPUID_AVX512BW 0x01000000 /* AVX-512 Byte & Word instructions */ +#define ippCPUID_AVX512DQ 0x02000000 /* AVX-512 DWord & QWord instructions */ +#define ippCPUID_AVX512VL 0x04000000 /* AVX-512 Vector Length extensions */ +#define ippCPUID_KNC 0x80000000 /* Intel(R) Xeon Phi(TM) Coprocessor */ +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define ippCPUID_NOCHECK 0x8000000000000000L /* Force ippSetCpuFeatures to set CPU features without check */ +#else + #define ippCPUID_NOCHECK 0x8000000000000000LL +#endif + +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define ippCPUID_GETINFO_A 0x616f666e69746567L /* Force ipp_GetCpuFeatures to work as cpuid instruction */ +#else + #define ippCPUID_GETINFO_A 0x616f666e69746567LL +#endif + +#define IPP_COUNT_OF( obj ) (sizeof(obj)/sizeof(obj[0])) + +/*****************************************************************************/ +/* Below are ippSP domain specific definitions */ +/*****************************************************************************/ +typedef enum { + ippRndZero, + ippRndNear, + ippRndFinancial, + ippRndHintAccurate=0x10 +} IppRoundMode; + + +typedef enum { + ippAlgHintNone, + ippAlgHintFast, + ippAlgHintAccurate +} IppHintAlgorithm; + +typedef enum { + ippCmpLess, + ippCmpLessEq, + ippCmpEq, + ippCmpGreaterEq, + ippCmpGreater +} IppCmpOp; + +typedef enum { + ippAlgAuto = 0x00000000, + ippAlgDirect = 0x00000001, + ippAlgFFT = 0x00000002, + ippAlgMask = 0x000000FF +} IppAlgType; + +typedef enum { + ippsNormNone = 0x00000000, /* default */ + ippsNormA = 0x00000100, /* biased normalization */ + ippsNormB = 0x00000200, /* unbiased normalization */ + ippsNormMask = 0x0000FF00 +} IppsNormOp; + +typedef enum { + ippNormInf = 0x00000001, + ippNormL1 = 0x00000002, + ippNormL2 = 0x00000004 +} IppNormType; + +enum { + IPP_FFT_DIV_FWD_BY_N = 1, + IPP_FFT_DIV_INV_BY_N = 2, + IPP_FFT_DIV_BY_SQRTN = 4, + IPP_FFT_NODIV_BY_ANY = 8 +}; + +enum { + IPP_DIV_FWD_BY_N = 1, + IPP_DIV_INV_BY_N = 2, + IPP_DIV_BY_SQRTN = 4, + IPP_NODIV_BY_ANY = 8 +}; + +typedef struct { + Ipp32f rho; + Ipp32f theta; +} IppPointPolar; + +typedef enum {ippWinBartlett,ippWinBlackman,ippWinHamming,ippWinHann,ippWinRect} IppWinType; + +typedef enum { ippButterworth, ippChebyshev1 } IppsIIRFilterType; + +typedef enum { ippZCR=0, ippZCXor, ippZCC } IppsZCType; + +#if !defined( _OWN_BLDPCS ) + +typedef struct { + int left; + int right; +} IppsROI; + +typedef struct RandUniState_8u IppsRandUniState_8u; +typedef struct RandUniState_16s IppsRandUniState_16s; +typedef struct RandUniState_32f IppsRandUniState_32f; +typedef struct RandUniState_64f IppsRandUniState_64f; + +typedef struct RandGaussState_8u IppsRandGaussState_8u; +typedef struct RandGaussState_16s IppsRandGaussState_16s; +typedef struct RandGaussState_32f IppsRandGaussState_32f; +typedef struct RandGaussState_64f IppsRandGaussState_64f; + +typedef struct FFTSpec_C_32fc IppsFFTSpec_C_32fc; +typedef struct FFTSpec_C_32f IppsFFTSpec_C_32f; +typedef struct FFTSpec_R_32f IppsFFTSpec_R_32f; + +typedef struct FFTSpec_C_64fc IppsFFTSpec_C_64fc; +typedef struct FFTSpec_C_64f IppsFFTSpec_C_64f; +typedef struct FFTSpec_R_64f IppsFFTSpec_R_64f; + +typedef struct DFTSpec_C_32fc IppsDFTSpec_C_32fc; +typedef struct DFTSpec_C_32f IppsDFTSpec_C_32f; +typedef struct DFTSpec_R_32f IppsDFTSpec_R_32f; + +typedef struct DFTSpec_C_64fc IppsDFTSpec_C_64fc; +typedef struct DFTSpec_C_64f IppsDFTSpec_C_64f; +typedef struct DFTSpec_R_64f IppsDFTSpec_R_64f; + +typedef struct DCTFwdSpec_32f IppsDCTFwdSpec_32f; +typedef struct DCTInvSpec_32f IppsDCTInvSpec_32f; + +typedef struct DCTFwdSpec_64f IppsDCTFwdSpec_64f; +typedef struct DCTInvSpec_64f IppsDCTInvSpec_64f; + +typedef struct sWTFwdState_32f IppsWTFwdState_32f; +typedef struct sWTFwdState_8u32f IppsWTFwdState_8u32f; +typedef struct sWTFwdState_16s32f IppsWTFwdState_16s32f; +typedef struct sWTFwdState_16u32f IppsWTFwdState_16u32f; +typedef struct sWTInvState_32f IppsWTInvState_32f; +typedef struct sWTInvState_32f8u IppsWTInvState_32f8u; +typedef struct sWTInvState_32f16s IppsWTInvState_32f16s; +typedef struct sWTInvState_32f16u IppsWTInvState_32f16u; + +typedef struct IIRState_32f IppsIIRState_32f; +typedef struct IIRState_32fc IppsIIRState_32fc; +typedef struct IIRState32f_16s IppsIIRState32f_16s; +typedef struct IIRState32fc_16sc IppsIIRState32fc_16sc; +typedef struct IIRState_64f IppsIIRState_64f; +typedef struct IIRState_64fc IppsIIRState_64fc; +typedef struct IIRState64f_32f IppsIIRState64f_32f; +typedef struct IIRState64fc_32fc IppsIIRState64fc_32fc; +typedef struct IIRState64f_32s IppsIIRState64f_32s; +typedef struct IIRState64fc_32sc IppsIIRState64fc_32sc; +typedef struct IIRState64f_16s IppsIIRState64f_16s; +typedef struct IIRState64fc_16sc IppsIIRState64fc_16sc; + +typedef struct FIRSpec_32f IppsFIRSpec_32f; +typedef struct FIRSpec_64f IppsFIRSpec_64f; +typedef struct FIRSpec_32fc IppsFIRSpec_32fc; +typedef struct FIRSpec_64fc IppsFIRSpec_64fc; + +typedef struct FIRLMSState_32f IppsFIRLMSState_32f; +typedef struct FIRLMSState32f_16s IppsFIRLMSState32f_16s; + +typedef struct HilbertSpec IppsHilbertSpec; + +typedef struct FIRSparseState_32f IppsFIRSparseState_32f; +typedef struct IIRSparseState_32f IppsIIRSparseState_32f; + +typedef struct ResamplingPolyphase_16s IppsResamplingPolyphase_16s; +typedef struct ResamplingPolyphaseFixed_16s IppsResamplingPolyphaseFixed_16s; +typedef struct ResamplingPolyphase_32f IppsResamplingPolyphase_32f; +typedef struct ResamplingPolyphaseFixed_32f IppsResamplingPolyphaseFixed_32f; + +#endif /* _OWN_BLDPCS */ + +/*****************************************************************************/ +/* Below are ippIP domain specific definitions */ +/*****************************************************************************/ +#define IPP_TEMPORAL_COPY 0x0 +#define IPP_NONTEMPORAL_STORE 0x01 +#define IPP_NONTEMPORAL_LOAD 0x02 + +typedef int IppEnum; + +#define IPP_DEG_TO_RAD( deg ) ( (deg)/180.0 * IPP_PI ) + +typedef enum { + ippiNormNone = 0x00000000, /* default */ + ippiNorm = 0x00000100, /* normalized form */ + ippiNormCoefficient = 0x00000200, /* correlation coefficient in the range [-1.0 ... 1.0] */ + ippiNormMask = 0x0000FF00 +} IppiNormOp; + +typedef enum { + ippiROIFull = 0x00000000, + ippiROIValid = 0x00010000, + ippiROISame = 0x00020000, + ippiROIMask = 0x00FF0000 +} IppiROIShape; + +typedef enum { + ippC0 = 0, + ippC1 = 1, + ippC2 = 2, + ippC3 = 3, + ippC4 = 4, + ippP2 = 5, + ippP3 = 6, + ippP4 = 7, + ippAC1 = 8, + ippAC4 = 9, + ippA0C4 = 10, + ippAP4 = 11 +} IppChannels; + +typedef enum _IppiBorderType { + ippBorderConst = 0, + ippBorderRepl = 1, + ippBorderWrap = 2, + ippBorderMirror = 3, /* left border: 012... -> 21012... */ + ippBorderMirrorR = 4, /* left border: 012... -> 210012... */ + ippBorderInMem = 6, + ippBorderTransp = 7, + ippBorderInMemTop = 0x0010, + ippBorderInMemBottom = 0x0020, + ippBorderInMemLeft = 0x0040, + ippBorderInMemRight = 0x0080 +} IppiBorderType; + +typedef enum { + ippAxsHorizontal, + ippAxsVertical, + ippAxsBoth, + ippAxs45, + ippAxs135 +} IppiAxis; + +typedef struct { + int x; + int y; + int width; + int height; +} IppiRect; + +typedef struct { + int x; + int y; +} IppiPoint; + +typedef struct { + int width; + int height; +} IppiSize; + +typedef struct { + Ipp32f x; + Ipp32f y; +} IppiPoint_32f; + +typedef enum _IppiMaskSize { + ippMskSize1x3 = 13, + ippMskSize1x5 = 15, + ippMskSize3x1 = 31, + ippMskSize3x3 = 33, + ippMskSize5x1 = 51, + ippMskSize5x5 = 55 +} IppiMaskSize; + +enum { + IPPI_INTER_NN = 1, + IPPI_INTER_LINEAR = 2, + IPPI_INTER_CUBIC = 4, + IPPI_INTER_CUBIC2P_BSPLINE, /* two-parameter cubic filter (B=1, C=0) */ + IPPI_INTER_CUBIC2P_CATMULLROM, /* two-parameter cubic filter (B=0, C=1/2) */ + IPPI_INTER_CUBIC2P_B05C03, /* two-parameter cubic filter (B=1/2, C=3/10) */ + IPPI_INTER_SUPER = 8, + IPPI_INTER_LANCZOS = 16, + IPPI_ANTIALIASING = (1 << 29), + IPPI_SUBPIXEL_EDGE = (1 << 30), + IPPI_SMOOTH_EDGE = (1 << 31) +}; + +typedef enum { + ippNearest = IPPI_INTER_NN, + ippLinear = IPPI_INTER_LINEAR, + ippCubic = IPPI_INTER_CUBIC2P_CATMULLROM, + ippLanczos = IPPI_INTER_LANCZOS, + ippHahn = 0, + ippSuper = IPPI_INTER_SUPER +} IppiInterpolationType; + +typedef enum { + ippPolyphase_1_2, + ippPolyphase_3_5, + ippPolyphase_2_3, + ippPolyphase_7_10, + ippPolyphase_3_4 +} IppiFraction; + +enum { + IPP_FASTN_ORIENTATION = 0x0001, + IPP_FASTN_NMS = 0x0002, + IPP_FASTN_CIRCLE = 0X0004, + IPP_FASTN_SCORE_MODE0 = 0X0020 +}; + +#if !defined( _OWN_BLDPCS ) + +typedef enum { + ippAlphaOver, + ippAlphaIn, + ippAlphaOut, + ippAlphaATop, + ippAlphaXor, + ippAlphaPlus, + ippAlphaOverPremul, + ippAlphaInPremul, + ippAlphaOutPremul, + ippAlphaATopPremul, + ippAlphaXorPremul, + ippAlphaPlusPremul +} IppiAlphaType; + +typedef struct DeconvFFTState_32f_C1R IppiDeconvFFTState_32f_C1R; +typedef struct DeconvFFTState_32f_C3R IppiDeconvFFTState_32f_C3R; +typedef struct DeconvLR_32f_C1R IppiDeconvLR_32f_C1R; +typedef struct DeconvLR_32f_C3R IppiDeconvLR_32f_C3R; + +typedef enum { + ippiFilterBilateralGauss = 100, + ippiFilterBilateralGaussFast = 101 +} IppiFilterBilateralType; + +typedef struct FilterBilateralSpec IppiFilterBilateralSpec; + +typedef enum { + ippDistNormL1 = 0x00000002 +} IppiDistanceMethodType; + +typedef enum { + ippResizeFilterHann, + ippResizeFilterLanczos +} IppiResizeFilterType; + +typedef struct ResizeFilterState IppiResizeFilterState; + +typedef struct { + Ipp32u borderLeft; + Ipp32u borderTop; + Ipp32u borderRight; + Ipp32u borderBottom; +} IppiBorderSize; + +typedef enum { + ippWarpForward, + ippWarpBackward, +} IppiWarpDirection; + +typedef enum { + ippWarpAffine, + ippWarpPerspective, + ippWarpBilinear, +} IppiWarpTransformType; + + +typedef struct ResizeSpec_32f IppiResizeSpec_32f; +typedef struct ResizeYUV422Spec IppiResizeYUV422Spec; +typedef struct ResizeYUV420Spec IppiResizeYUV420Spec; + +typedef struct ResizeSpec_64f IppiResizeSpec_64f; + +typedef struct IppiWarpSpec IppiWarpSpec; + +typedef struct FilterBorderSpec IppiFilterBorderSpec; + +typedef struct ThresholdAdaptiveSpec IppiThresholdAdaptiveSpec; + +typedef struct HistogramSpec IppiHistogramSpec; + +typedef struct { + int cvCompatible; /* openCV compatible output format */ + int cellSize; /* squre cell size (pixels) */ + int blockSize; /* square block size (pixels) */ + int blockStride; /* block displacement (the same for x- and y- directions) */ + int nbins; /* required number of bins */ + Ipp32f sigma; /* gaussian factor of HOG block weights */ + Ipp32f l2thresh; /* normalization factor */ + IppiSize winSize; /* detection window size (pixels) */ +} IppiHOGConfig; + +typedef struct FFT2DSpec_C_32fc IppiFFTSpec_C_32fc; +typedef struct FFT2DSpec_R_32f IppiFFTSpec_R_32f; + +typedef struct DFT2DSpec_C_32fc IppiDFTSpec_C_32fc; +typedef struct DFT2DSpec_R_32f IppiDFTSpec_R_32f; + +typedef struct DCT2DFwdSpec_32f IppiDCTFwdSpec_32f; +typedef struct DCT2DInvSpec_32f IppiDCTInvSpec_32f; + +typedef struct iWTFwdSpec_32f_C1R IppiWTFwdSpec_32f_C1R; +typedef struct iWTInvSpec_32f_C1R IppiWTInvSpec_32f_C1R; +typedef struct iWTFwdSpec_32f_C3R IppiWTFwdSpec_32f_C3R; +typedef struct iWTInvSpec_32f_C3R IppiWTInvSpec_32f_C3R; + +typedef struct MomentState64f IppiMomentState_64f; +typedef Ipp64f IppiHuMoment_64f[7]; + +typedef struct LUT_Spec IppiLUT_Spec; + +#define IPP_HOG_MAX_CELL (16) /* max size of CELL */ +#define IPP_HOG_MAX_BLOCK (64) /* max size of BLOCK */ +#define IPP_HOG_MAX_BINS (16) /* max number of BINS */ + +typedef struct _ipHOG IppiHOGSpec; + +#endif /* _OWN_BLDPCS */ + + + /**** Below are 3D Image (Volume) Processing specific definitions ****/ + +typedef struct { + int width; + int height; + int depth; +} IpprVolume; + +typedef struct { + int x; + int y; + int z; + int width; + int height; + int depth; +} IpprCuboid; + +typedef struct { + int x; + int y; + int z; +} IpprPoint; + +/*****************************************************************************/ +/* Below are ippCV domain specific definitions */ +/*****************************************************************************/ + +typedef enum _IppiDifferentialKernel +{ + ippFilterSobelVert, + ippFilterSobelHoriz, + ippFilterSobel, + ippFilterScharrVert, + ippFilterScharrHoriz, + ippFilterScharr, + ippFilterCentralDiffVert, + ippFilterCentralDiffHoriz, + ippFilterCentralDiff, +}IppiDifferentialKernel; + +#if !defined( _OWN_BLDPCS ) + +typedef enum _IppiKernelType { + ippKernelSobel = 0, + ippKernelScharr = 1, + ippKernelSobelNeg = 2 +} IppiKernelType; + +typedef enum _IppiNorm { + ippiNormInf = 0, + ippiNormL1 = 1, + ippiNormL2 = 2, + ippiNormFM = 3 +} IppiNorm; + +typedef struct ipcvMorphState IppiMorphState; +typedef struct ipcvMorphAdvState IppiMorphAdvState; +typedef struct ipcvMorphGrayState_8u IppiMorphGrayState_8u; +typedef struct ipcvMorphGrayState_32f IppiMorphGrayState_32f; + +typedef struct ipcvConvState IppiConvState; + +typedef struct _IppiConnectedComp { + Ipp64f area; /* area of the segmented component */ + Ipp64f value[3];/* gray scale value of the segmented component */ + IppiRect rect; /* bounding rectangle of the segmented component */ +} IppiConnectedComp; + +typedef struct PyramidState IppiPyramidState; + +typedef IppiPyramidState IppiPyramidDownState_8u_C1R; +typedef IppiPyramidState IppiPyramidDownState_16u_C1R; +typedef IppiPyramidState IppiPyramidDownState_32f_C1R; +typedef IppiPyramidState IppiPyramidDownState_8u_C3R; +typedef IppiPyramidState IppiPyramidDownState_16u_C3R; +typedef IppiPyramidState IppiPyramidDownState_32f_C3R; +typedef IppiPyramidState IppiPyramidUpState_8u_C1R; +typedef IppiPyramidState IppiPyramidUpState_16u_C1R; +typedef IppiPyramidState IppiPyramidUpState_32f_C1R; +typedef IppiPyramidState IppiPyramidUpState_8u_C3R; +typedef IppiPyramidState IppiPyramidUpState_16u_C3R; +typedef IppiPyramidState IppiPyramidUpState_32f_C3R; + + +typedef struct _IppiPyramid { + Ipp8u **pImage; + IppiSize *pRoi; + Ipp64f *pRate; + int *pStep; + Ipp8u *pState; + int level; +} IppiPyramid; + +typedef struct OptFlowPyrLK IppiOptFlowPyrLK; + +typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_8u_C1R; +typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_16u_C1R; +typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_32f_C1R; + +typedef struct ipcvHaarClassifier_32f IppiHaarClassifier_32f; +typedef struct ipcvHaarClassifier_32s IppiHaarClassifier_32s; + +typedef struct ipcvFGHistogramState_8u_C1R IppFGHistogramState_8u_C1R; +typedef struct ipcvFGHistogramState_8u_C3R IppFGHistogramState_8u_C3R; + +typedef struct ipcvFGGaussianState_8u_C1R IppFGGaussianState_8u_C1R; +typedef struct ipcvFGGaussianState_8u_C3R IppFGGaussianState_8u_C3R; + +typedef enum _IppiInpaintFlag { + IPP_INPAINT_TELEA = 0, + IPP_INPAINT_NS = 1 +} IppiInpaintFlag; + +typedef struct ippcvFilterGaussianSpec IppFilterGaussianSpec; + +typedef struct ipcvInpaintState_8u IppiInpaintState_8u_C1R; +typedef struct ipcvInpaintState_8u IppiInpaintState_8u_C3R; + +typedef struct HoughProbSpec IppiHoughProbSpec; + +typedef struct FastNSpec IppiFastNSpec; + +typedef struct _IppiCornerFastN { + int x; + int y; + int cornerType; + int orientation; + float angle; + float score; +} IppiCornerFastN; + +typedef struct FGMMState_8u_C3R IppFGMMState_8u_C3R; + +typedef struct +{ + unsigned int numFrames; + unsigned int maxNGauss; + Ipp32f varInit; + Ipp32f varMin; + Ipp32f varMax; + Ipp32f varWBRatio; + Ipp32f bckgThr; + Ipp32f varNGRatio; + Ipp32f reduction; + Ipp8u shadowValue; + char shadowFlag; + Ipp32f shadowRatio; +} IppFGMModel; + +#endif /* _OWN_BLDPCS */ + +#define IPP_SEGMENT_QUEUE 0x01 +#define IPP_SEGMENT_DISTANCE 0x02 +#define IPP_SEGMENT_BORDER_4 0x40 +#define IPP_SEGMENT_BORDER_8 0x80 + +#define IPP_TRUNC(a,b) ((a)&~((b)-1)) +#define IPP_APPEND(a,b) (((a)+(b)-1)&~((b)-1)) + +/*****************************************************************************/ +/* Below are ippCC domain specific definitions */ +/*****************************************************************************/ +enum { + IPP_UPPER = 1, + IPP_LEFT = 2, + IPP_CENTER = 4, + IPP_RIGHT = 8, + IPP_LOWER = 16, + IPP_UPPER_LEFT = 32, + IPP_UPPER_RIGHT = 64, + IPP_LOWER_LEFT = 128, + IPP_LOWER_RIGHT = 256 +}; + +#if !defined( _OWN_BLDPCS ) + +typedef enum { + ippDitherNone, + ippDitherFS, + ippDitherJJN, + ippDitherStucki, + ippDitherBayer +} IppiDitherType; + +#endif /* _OWN_BLDPCS */ + +/*****************************************************************************/ +/* Below are ippCH domain specific definitions */ +/*****************************************************************************/ + +#if !defined( _OWN_BLDPCS ) + +typedef struct { + void *pFind; + int lenFind; +} IppRegExpFind; + +typedef struct RegExpState IppRegExpState; + +typedef enum { + ippFmtASCII = 0, + ippFmtUTF8 +} IppRegExpFormat; + +typedef struct RegExpReplaceState IppRegExpReplaceState; + +#endif /* _OWN_BLDPCS */ + +/*****************************************************************************/ +/* Below are ippDC domain specific definitions */ +/*****************************************************************************/ + +#if !defined ( _OWN_BLDPCS ) + +typedef struct MTFState_8u IppMTFState_8u; + +typedef enum { + ippBWTItohTanakaLimSort, + ippBWTItohTanakaUnlimSort, + ippBWTSuffixSort, + ippBWTAutoSort +} IppBWTSortAlgorithmHint; + +typedef struct LZSSState_8u IppLZSSState_8u; + +typedef struct LZ77State_8u IppLZ77State_8u; +typedef enum{ + IppLZ77FastCompr, + IppLZ77AverageCompr, + IppLZ77BestCompr +} IppLZ77ComprLevel; +typedef enum{ + IppLZ77NoChcksm, + IppLZ77Adler32, + IppLZ77CRC32 +} IppLZ77Chcksm; +typedef enum { + IppLZ77NoFlush, + IppLZ77SyncFlush, + IppLZ77FullFlush, + IppLZ77FinishFlush +} IppLZ77Flush; +typedef struct IppLZ77Pairs_16u { + Ipp16u length; + Ipp16u offset; +} IppLZ77Pair; +typedef enum { + IppLZ77StatusInit, + IppLZ77StatusLZ77Process, + IppLZ77StatusHuffProcess, + IppLZ77StatusFinal +} IppLZ77DeflateStatus; +typedef enum { + IppLZ77UseFixed, + IppLZ77UseDynamic, + IppLZ77UseStored +} IppLZ77HuffMode; +typedef enum { + IppLZ77InflateStatusInit, + IppLZ77InflateStatusHuffProcess, + IppLZ77InflateStatusLZ77Process, + IppLZ77InflateStatusFinal +} IppLZ77InflateStatus; + +typedef struct IppInflateState { + const Ipp8u* pWindow; /* pointer to the sliding window + (the dictionary for the LZ77 algorithm) */ + unsigned int winSize; /* size of the sliding window */ + unsigned int tableType; /* type of Huffman code tables + (for example, 0 - tables for Fixed Huffman codes) */ + unsigned int tableBufferSize; /* (ENOUGH = 2048) * (sizeof(code) = 4) - + sizeof(IppInflateState) */ +} IppInflateState; + +typedef enum { /* this type is used as a translator of the inflate_mode type from zlib */ + ippTYPE, + ippLEN, + ippLENEXT +} IppInflateMode; + +typedef struct { + Ipp16u freq; + Ipp16u code; +} IppDeflateFreqTable; + +typedef struct { + Ipp16u code; + Ipp16u len; +} IppDeflateHuffCode; + +typedef struct RLEState_BZ2 IppRLEState_BZ2; + +typedef struct EncodeHuffState_BZ2 IppEncodeHuffState_BZ2; + +typedef struct DecodeHuffState_BZ2 IppDecodeHuffState_BZ2; + +typedef enum { + IppLZO1XST, /* Single-threaded, generic LZO-compatible*/ + IppLZO1XMT /* Multi-threaded */ +} IppLZOMethod ; + +typedef struct LZOState_8u IppLZOState_8u; + +#endif /* _OWN_BLDPCS */ + +/* ///////////////////////////////////////////////////////////////////////////// +// The following enumerator defines a status of IPP operations +// negative value means error +*/ +typedef enum { + /* errors */ + ippStsNotSupportedModeErr = -9999,/* The requested mode is currently not supported. */ + ippStsCpuNotSupportedErr = -9998,/* The target CPU is not supported. */ + ippStsInplaceModeNotSupportedErr = -9997,/* The inplace operation is currently not supported. */ + + ippStsIIRIIRLengthErr = -234, /* Vector length for IIRIIR function is less than 3*(IIR order) */ + ippStsWarpTransformTypeErr = -233, /* The warp transform type is illegal */ + ippStsExceededSizeErr = -232, /* Requested size exceeded the maximum supported ROI size */ + ippStsWarpDirectionErr = -231, /* The warp transform direction is illegal */ + + ippStsFilterTypeErr = -230, /* The filter type is incorrect or not supported */ + + ippStsNormErr = -229, /* The norm is incorrect or not supported */ + + ippStsAlgTypeErr = -228, /* Algorithm type is not supported. */ + ippStsMisalignedOffsetErr = -227, /* The offset is not aligned with an element. */ + + ippStsQuadraticNonResidueErr = -226, /* SQRT operation on quadratic non-residue value. */ + + ippStsBorderErr = -225, /* Illegal value for border type.*/ + + ippStsDitherTypeErr = -224, /* Dithering type is not supported. */ + ippStsH264BufferFullErr = -223, /* Buffer for the output bitstream is full. */ + ippStsWrongAffinitySettingErr= -222, /* An affinity setting does not correspond to the affinity setting that was set by f.ippSetAffinity(). */ + ippStsLoadDynErr = -221, /* Error when loading the dynamic library. */ + + ippStsPointAtInfinity = -220, /* Point at infinity is detected. */ + + ippStsUnknownStatusCodeErr = -216, /* Unknown status code. */ + + ippStsOFBSizeErr = -215, /* Incorrect value for crypto OFB block size. */ + ippStsLzoBrokenStreamErr = -214, /* LZO safe decompression function cannot decode LZO stream. */ + + ippStsRoundModeNotSupportedErr = -213, /* Rounding mode is not supported. */ + ippStsDecimateFractionErr = -212, /* Fraction in Decimate is not supported. */ + ippStsWeightErr = -211, /* Incorrect value for weight. */ + + ippStsQualityIndexErr = -210, /* Cannot calculate the quality index for an image filled with a constant. */ + ippStsIIRPassbandRippleErr = -209, /* Ripple in passband for Chebyshev1 design is less than zero, equal to zero, or greater than 29. */ + ippStsFilterFrequencyErr = -208, /* Cutoff frequency of filter is less than zero, equal to zero, or greater than 0.5. */ + ippStsFIRGenOrderErr = -207, /* Order of the FIR filter for design is less than 1. */ + ippStsIIRGenOrderErr = -206, /* Order of the IIR filter for design is less than 1, or greater than 12. */ + + ippStsConvergeErr = -205, /* The algorithm does not converge. */ + ippStsSizeMatchMatrixErr = -204, /* The sizes of the source matrices are unsuitable. */ + ippStsCountMatrixErr = -203, /* Count value is less than, or equal to zero. */ + ippStsRoiShiftMatrixErr = -202, /* RoiShift value is negative or not divisible by the size of the data type. */ + + ippStsResizeNoOperationErr = -201, /* One of the output image dimensions is less than 1 pixel. */ + ippStsSrcDataErr = -200, /* The source buffer contains unsupported data. */ + ippStsMaxLenHuffCodeErr = -199, /* Huff: Max length of Huffman code is more than the expected one. */ + ippStsCodeLenTableErr = -198, /* Huff: Invalid codeLenTable. */ + ippStsFreqTableErr = -197, /* Huff: Invalid freqTable. */ + + ippStsIncompleteContextErr = -196, /* Crypto: set up of context is not complete. */ + + ippStsSingularErr = -195, /* Matrix is singular. */ + ippStsSparseErr = -194, /* Positions of taps are not in ascending order, or are negative, or repetitive. */ + ippStsBitOffsetErr = -193, /* Incorrect bit offset value. */ + ippStsQPErr = -192, /* Incorrect quantization parameter value. */ + ippStsVLCErr = -191, /* Illegal VLC or FLC is detected during stream decoding. */ + ippStsRegExpOptionsErr = -190, /* RegExp: Options for the pattern are incorrect. */ + ippStsRegExpErr = -189, /* RegExp: The structure pRegExpState contains incorrect data. */ + ippStsRegExpMatchLimitErr = -188, /* RegExp: The match limit is exhausted. */ + ippStsRegExpQuantifierErr = -187, /* RegExp: Incorrect quantifier. */ + ippStsRegExpGroupingErr = -186, /* RegExp: Incorrect grouping. */ + ippStsRegExpBackRefErr = -185, /* RegExp: Incorrect back reference. */ + ippStsRegExpChClassErr = -184, /* RegExp: Incorrect character class. */ + ippStsRegExpMetaChErr = -183, /* RegExp: Incorrect metacharacter. */ + ippStsStrideMatrixErr = -182, /* Stride value is not positive or not divisible by the size of the data type. */ + ippStsCTRSizeErr = -181, /* Incorrect value for crypto CTR block size. */ + ippStsJPEG2KCodeBlockIsNotAttached =-180, /* Codeblock parameters are not attached to the state structure. */ + ippStsNotPosDefErr = -179, /* Matrix is not positive definite. */ + + ippStsEphemeralKeyErr = -178, /* ECC: Invalid ephemeral key. */ + ippStsMessageErr = -177, /* ECC: Invalid message digest. */ + ippStsShareKeyErr = -176, /* ECC: Invalid share key. */ + ippStsIvalidPublicKey = -175, /* ECC: Invalid public key. */ + ippStsIvalidPrivateKey = -174, /* ECC: Invalid private key. */ + ippStsOutOfECErr = -173, /* ECC: Point out of EC. */ + ippStsECCInvalidFlagErr = -172, /* ECC: Invalid Flag. */ + + ippStsMP3FrameHeaderErr = -171, /* Error in fields of the IppMP3FrameHeader structure. */ + ippStsMP3SideInfoErr = -170, /* Error in fields of the IppMP3SideInfo structure. */ + + ippStsBlockStepErr = -169, /* Step for Block is less than 8. */ + ippStsMBStepErr = -168, /* Step for MB is less than 16. */ + + ippStsAacPrgNumErr = -167, /* AAC: Invalid number of elements for one program. */ + ippStsAacSectCbErr = -166, /* AAC: Invalid section codebook. */ + ippStsAacSfValErr = -164, /* AAC: Invalid scalefactor value. */ + ippStsAacCoefValErr = -163, /* AAC: Invalid quantized coefficient value. */ + ippStsAacMaxSfbErr = -162, /* AAC: Invalid coefficient index. */ + ippStsAacPredSfbErr = -161, /* AAC: Invalid predicted coefficient index. */ + ippStsAacPlsDataErr = -160, /* AAC: Invalid pulse data attributes. */ + ippStsAacGainCtrErr = -159, /* AAC: Gain control is not supported. */ + ippStsAacSectErr = -158, /* AAC: Invalid number of sections. */ + ippStsAacTnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters. */ + ippStsAacTnsLenErr = -156, /* AAC: Invalid length of TNS region. */ + ippStsAacTnsOrderErr = -155, /* AAC: Invalid order of TNS filter. */ + ippStsAacTnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients. */ + ippStsAacTnsCoefErr = -153, /* AAC: Invalid coefficients of TNS filter. */ + ippStsAacTnsDirectErr = -152, /* AAC: Invalid direction TNS filter. */ + ippStsAacTnsProfileErr = -151, /* AAC: Invalid TNS profile. */ + ippStsAacErr = -150, /* AAC: Internal error. */ + ippStsAacBitOffsetErr = -149, /* AAC: Invalid current bit offset in bitstream. */ + ippStsAacAdtsSyncWordErr = -148, /* AAC: Invalid ADTS syncword. */ + ippStsAacSmplRateIdxErr = -147, /* AAC: Invalid sample rate index. */ + ippStsAacWinLenErr = -146, /* AAC: Invalid window length (not short or long). */ + ippStsAacWinGrpErr = -145, /* AAC: Invalid number of groups for current window length. */ + ippStsAacWinSeqErr = -144, /* AAC: Invalid window sequence range. */ + ippStsAacComWinErr = -143, /* AAC: Invalid common window flag. */ + ippStsAacStereoMaskErr = -142, /* AAC: Invalid stereo mask. */ + ippStsAacChanErr = -141, /* AAC: Invalid channel number. */ + ippStsAacMonoStereoErr = -140, /* AAC: Invalid mono-stereo flag. */ + ippStsAacStereoLayerErr = -139, /* AAC: Invalid this Stereo Layer flag. */ + ippStsAacMonoLayerErr = -138, /* AAC: Invalid this Mono Layer flag. */ + ippStsAacScalableErr = -137, /* AAC: Invalid scalable object flag. */ + ippStsAacObjTypeErr = -136, /* AAC: Invalid audio object type. */ + ippStsAacWinShapeErr = -135, /* AAC: Invalid window shape. */ + ippStsAacPcmModeErr = -134, /* AAC: Invalid PCM output interleaving indicator. */ + ippStsVLCUsrTblHeaderErr = -133, /* VLC: Invalid header inside table. */ + ippStsVLCUsrTblUnsupportedFmtErr = -132, /* VLC: Table format is not supported. */ + ippStsVLCUsrTblEscAlgTypeErr = -131, /* VLC: Ecs-algorithm is not supported. */ + ippStsVLCUsrTblEscCodeLengthErr = -130, /* VLC: Esc-code length inside table header is incorrect. */ + ippStsVLCUsrTblCodeLengthErr = -129, /* VLC: Code length inside table is incorrect. */ + ippStsVLCInternalTblErr = -128, /* VLC: Invalid internal table. */ + ippStsVLCInputDataErr = -127, /* VLC: Invalid input data. */ + ippStsVLCAACEscCodeLengthErr = -126, /* VLC: Invalid AAC-Esc code length. */ + ippStsNoiseRangeErr = -125, /* Noise value for Wiener Filter is out of range. */ + ippStsUnderRunErr = -124, /* Error in data under run. */ + ippStsPaddingErr = -123, /* Detected padding error indicates the possible data corruption. */ + ippStsCFBSizeErr = -122, /* Incorrect value for crypto CFB block size. */ + ippStsPaddingSchemeErr = -121, /* Invalid padding scheme. */ + ippStsInvalidCryptoKeyErr = -120, /* A compromised key causes suspansion of the requested cryptographic operation. */ + ippStsLengthErr = -119, /* Incorrect value for string length. */ + ippStsBadModulusErr = -118, /* Bad modulus caused a failure in module inversion. */ + ippStsLPCCalcErr = -117, /* Cannot evaluate linear prediction. */ + ippStsRCCalcErr = -116, /* Cannot compute reflection coefficients. */ + ippStsIncorrectLSPErr = -115, /* Incorrect values for Linear Spectral Pair. */ + ippStsNoRootFoundErr = -114, /* No roots are found for equation. */ + ippStsJPEG2KBadPassNumber = -113, /* Pass number exceeds allowed boundaries [0,nOfPasses-1]. */ + ippStsJPEG2KDamagedCodeBlock= -112, /* Codeblock for decoding contains damaged data. */ + ippStsH263CBPYCodeErr = -111, /* Illegal Huffman code is detected through CBPY stream processing. */ + ippStsH263MCBPCInterCodeErr = -110, /* Illegal Huffman code is detected through MCBPC Inter stream processing. */ + ippStsH263MCBPCIntraCodeErr = -109, /* Illegal Huffman code is detected through MCBPC Intra stream processing. */ + ippStsNotEvenStepErr = -108, /* Step value is not pixel multiple. */ + ippStsHistoNofLevelsErr = -107, /* Number of levels for histogram is less than 2. */ + ippStsLUTNofLevelsErr = -106, /* Number of levels for LUT is less than 2. */ + ippStsMP4BitOffsetErr = -105, /* Incorrect bit offset value. */ + ippStsMP4QPErr = -104, /* Incorrect quantization parameter. */ + ippStsMP4BlockIdxErr = -103, /* Incorrect block index. */ + ippStsMP4BlockTypeErr = -102, /* Incorrect block type. */ + ippStsMP4MVCodeErr = -101, /* Illegal Huffman code is detected during MV stream processing. */ + ippStsMP4VLCCodeErr = -100, /* Illegal Huffman code is detected during VLC stream processing. */ + ippStsMP4DCCodeErr = -99, /* Illegal code is detected during DC stream processing. */ + ippStsMP4FcodeErr = -98, /* Incorrect fcode value. */ + ippStsMP4AlignErr = -97, /* Incorrect buffer alignment . */ + ippStsMP4TempDiffErr = -96, /* Incorrect temporal difference. */ + ippStsMP4BlockSizeErr = -95, /* Incorrect size of a block or macroblock. */ + ippStsMP4ZeroBABErr = -94, /* All BAB values are equal to zero. */ + ippStsMP4PredDirErr = -93, /* Incorrect prediction direction. */ + ippStsMP4BitsPerPixelErr = -92, /* Incorrect number of bits per pixel. */ + ippStsMP4VideoCompModeErr = -91, /* Incorrect video component mode. */ + ippStsMP4LinearModeErr = -90, /* Incorrect DC linear mode. */ + ippStsH263PredModeErr = -83, /* Incorrect Prediction Mode value. */ + ippStsH263BlockStepErr = -82, /* The step value is less than 8. */ + ippStsH263MBStepErr = -81, /* The step value is less than 16. */ + ippStsH263FrameWidthErr = -80, /* The frame width is less than 8. */ + ippStsH263FrameHeightErr = -79, /* The frame height is less than, or equal to zero. */ + ippStsH263ExpandPelsErr = -78, /* Expand pixels number is less than 8. */ + ippStsH263PlaneStepErr = -77, /* Step value is less than the plane width. */ + ippStsH263QuantErr = -76, /* Quantizer value is less than, or equal to zero, or greater than 31. */ + ippStsH263MVCodeErr = -75, /* Illegal Huffman code is detected during MV stream processing. */ + ippStsH263VLCCodeErr = -74, /* Illegal Huffman code is detected during VLC stream processing. */ + ippStsH263DCCodeErr = -73, /* Illegal code is detected during DC stream processing. */ + ippStsH263ZigzagLenErr = -72, /* Zigzag compact length is more than 64. */ + ippStsFBankFreqErr = -71, /* Incorrect value for the filter bank frequency parameter. */ + ippStsFBankFlagErr = -70, /* Incorrect value for the filter bank parameter. */ + ippStsFBankErr = -69, /* Filter bank is not correctly initialized. */ + ippStsNegOccErr = -67, /* Occupation count is negative. */ + ippStsCdbkFlagErr = -66, /* Incorrect value for the codebook flag parameter. */ + ippStsSVDCnvgErr = -65, /* SVD algorithm does not converge. */ + ippStsJPEGHuffTableErr = -64, /* JPEG Huffman table is destroyed. */ + ippStsJPEGDCTRangeErr = -63, /* JPEG DCT coefficient is out of range. */ + ippStsJPEGOutOfBufErr = -62, /* Attempt to access out of the buffer limits. */ + ippStsDrawTextErr = -61, /* System error in the draw text operation. */ + ippStsChannelOrderErr = -60, /* Incorrect order of the destination channels. */ + ippStsZeroMaskValuesErr = -59, /* All values of the mask are equal to zero. */ + ippStsQuadErr = -58, /* The quadrangle is nonconvex or degenerates into triangle, line, or point */ + ippStsRectErr = -57, /* Size of the rectangle region is less than, or equal to 1. */ + ippStsCoeffErr = -56, /* Incorrect values for transformation coefficients. */ + ippStsNoiseValErr = -55, /* Incorrect value for noise amplitude for dithering. */ + ippStsDitherLevelsErr = -54, /* Number of dithering levels is out of range. */ + ippStsNumChannelsErr = -53, /* Number of channels is incorrect, or not supported. */ + ippStsCOIErr = -52, /* COI is out of range. */ + ippStsDivisorErr = -51, /* Divisor is equal to zero, function is aborted. */ + ippStsAlphaTypeErr = -50, /* Illegal type of image compositing operation. */ + ippStsGammaRangeErr = -49, /* Gamma range bounds is less than, or equal to zero. */ + ippStsGrayCoefSumErr = -48, /* Sum of the conversion coefficients must be less than, or equal to 1. */ + ippStsChannelErr = -47, /* Illegal channel number. */ + ippStsToneMagnErr = -46, /* Tone magnitude is less than, or equal to zero. */ + ippStsToneFreqErr = -45, /* Tone frequency is negative, or greater than, or equal to 0.5. */ + ippStsTonePhaseErr = -44, /* Tone phase is negative, or greater than, or equal to 2*PI. */ + ippStsTrnglMagnErr = -43, /* Triangle magnitude is less than, or equal to zero. */ + ippStsTrnglFreqErr = -42, /* Triangle frequency is negative, or greater than, or equal to 0.5. */ + ippStsTrnglPhaseErr = -41, /* Triangle phase is negative, or greater than, or equal to 2*PI. */ + ippStsTrnglAsymErr = -40, /* Triangle asymmetry is less than -PI, or greater than, or equal to PI. */ + ippStsHugeWinErr = -39, /* Kaiser window is too big. */ + ippStsJaehneErr = -38, /* Magnitude value is negative. */ + ippStsStrideErr = -37, /* Stride value is less than the length of the row. */ + ippStsEpsValErr = -36, /* Negative epsilon value. */ + ippStsWtOffsetErr = -35, /* Invalid offset value for wavelet filter. */ + ippStsAnchorErr = -34, /* Anchor point is outside the mask. */ + ippStsMaskSizeErr = -33, /* Invalid mask size. */ + ippStsShiftErr = -32, /* Shift value is less than zero. */ + ippStsSampleFactorErr = -31, /* Sampling factor is less than, or equal to zero. */ + ippStsSamplePhaseErr = -30, /* Phase value is out of range: 0 <= phase < factor. */ + ippStsFIRMRFactorErr = -29, /* MR FIR sampling factor is less than, or equal to zero. */ + ippStsFIRMRPhaseErr = -28, /* MR FIR sampling phase is negative, or greater than, or equal to the sampling factor. */ + ippStsRelFreqErr = -27, /* Relative frequency value is out of range. */ + ippStsFIRLenErr = -26, /* Length of a FIR filter is less than, or equal to zero. */ + ippStsIIROrderErr = -25, /* Order of an IIR filter is not valid. */ + ippStsDlyLineIndexErr = -24, /* Invalid value for the delay line sample index. */ + ippStsResizeFactorErr = -23, /* Resize factor(s) is less than, or equal to zero. */ + ippStsInterpolationErr = -22, /* Invalid interpolation mode. */ + ippStsMirrorFlipErr = -21, /* Invalid flip mode. */ + ippStsMoment00ZeroErr = -20, /* Moment value M(0,0) is too small to continue calculations. */ + ippStsThreshNegLevelErr = -19, /* Negative value of the level in the threshold operation. */ + ippStsThresholdErr = -18, /* Invalid threshold bounds. */ + ippStsContextMatchErr = -17, /* Context parameter does not match the operation. */ + ippStsFftFlagErr = -16, /* Invalid value for the FFT flag parameter. */ + ippStsFftOrderErr = -15, /* Invalid value for the FFT order parameter. */ + ippStsStepErr = -14, /* Step value is not valid. */ + ippStsScaleRangeErr = -13, /* Scale bounds are out of range. */ + ippStsDataTypeErr = -12, /* Data type is incorrect or not supported. */ + ippStsOutOfRangeErr = -11, /* Argument is out of range, or point is outside the image. */ + ippStsDivByZeroErr = -10, /* An attempt to divide by zero. */ + ippStsMemAllocErr = -9, /* Memory allocated for the operation is not enough.*/ + ippStsNullPtrErr = -8, /* Null pointer error. */ + ippStsRangeErr = -7, /* Incorrect values for bounds: the lower bound is greater than the upper bound. */ + ippStsSizeErr = -6, /* Incorrect value for data size. */ + ippStsBadArgErr = -5, /* Incorrect arg/param of the function. */ + ippStsNoMemErr = -4, /* Not enough memory for the operation. */ + ippStsSAReservedErr3 = -3, /* Unknown/unspecified error, -3. */ + ippStsErr = -2, /* Unknown/unspecified error, -2. */ + ippStsSAReservedErr1 = -1, /* Unknown/unspecified error, -1. */ + + /* no errors */ + ippStsNoErr = 0, /* No errors. */ + + /* warnings */ + ippStsNoOperation = 1, /* No operation has been executed. */ + ippStsMisalignedBuf = 2, /* Misaligned pointer in operation in which it must be aligned. */ + ippStsSqrtNegArg = 3, /* Negative value(s) for the argument in the Sqrt function. */ + ippStsInvZero = 4, /* INF result. Zero value was met by InvThresh with zero level. */ + ippStsEvenMedianMaskSize= 5, /* Even size of the Median Filter mask was replaced with the odd one. */ + ippStsDivByZero = 6, /* Zero value(s) for the divisor in the Div function. */ + ippStsLnZeroArg = 7, /* Zero value(s) for the argument in the Ln function. */ + ippStsLnNegArg = 8, /* Negative value(s) for the argument in the Ln function. */ + ippStsNanArg = 9, /* Argument value is not a number. */ + ippStsJPEGMarker = 10, /* JPEG marker in the bitstream. */ + ippStsResFloor = 11, /* All result values are floored. */ + ippStsOverflow = 12, /* Overflow in the operation. */ + ippStsLSFLow = 13, /* Quantized LP synthesis filter stability check is applied at the low boundary of [0,pi]. */ + ippStsLSFHigh = 14, /* Quantized LP synthesis filter stability check is applied at the high boundary of [0,pi]. */ + ippStsLSFLowAndHigh = 15, /* Quantized LP synthesis filter stability check is applied at both boundaries of [0,pi]. */ + ippStsZeroOcc = 16, /* Zero occupation count. */ + ippStsUnderflow = 17, /* Underflow in the operation. */ + ippStsSingularity = 18, /* Singularity in the operation. */ + ippStsDomain = 19, /* Argument is out of the function domain. */ + ippStsNonIntelCpu = 20, /* The target CPU is not Genuine Intel. */ + ippStsCpuMismatch = 21, /* Cannot set the library for the given CPU. */ + ippStsNoIppFunctionFound = 22, /* Application does not contain Intel IPP function calls. */ + ippStsDllNotFoundBestUsed = 23, /* Dispatcher cannot find the newest version of the Intel IPP dll. */ + ippStsNoOperationInDll = 24, /* The function does nothing in the dynamic version of the library. */ + ippStsInsufficientEntropy= 25, /* Generation of the prime/key failed due to insufficient entropy in the random seed and stimulus bit string. */ + ippStsOvermuchStrings = 26, /* Number of destination strings is more than expected. */ + ippStsOverlongString = 27, /* Length of one of the destination strings is more than expected. */ + ippStsAffineQuadChanged = 28, /* 4th vertex of destination quad is not equal to customer's one. */ + ippStsWrongIntersectROI = 29, /* ROI has no intersection with the source or destination ROI. No operation. */ + ippStsWrongIntersectQuad = 30, /* Quadrangle has no intersection with the source or destination ROI. No operation. */ + ippStsSmallerCodebook = 31, /* Size of created codebook is less than the cdbkSize argument. */ + ippStsSrcSizeLessExpected = 32, /* DC: Size of the source buffer is less than the expected one. */ + ippStsDstSizeLessExpected = 33, /* DC: Size of the destination buffer is less than the expected one. */ + ippStsStreamEnd = 34, /* DC: The end of stream processed. */ + ippStsDoubleSize = 35, /* Width or height of image is odd. */ + ippStsNotSupportedCpu = 36, /* The CPU is not supported. */ + ippStsUnknownCacheSize = 37, /* The CPU is supported, but the size of the cache is unknown. */ + ippStsSymKernelExpected = 38, /* The Kernel is not symmetric. */ + ippStsEvenMedianWeight = 39, /* Even weight of the Weighted Median Filter is replaced with the odd one. */ + ippStsWrongIntersectVOI = 40, /* VOI has no intersection with the source or destination volume. No operation. */ + ippStsI18nMsgCatalogInvalid=41, /* Message Catalog is invalid, English message returned. */ + ippStsI18nGetMessageFail = 42, /* Failed to fetch a localized message, English message returned. For more information use errno on Linux* OS and GetLastError on Windows* OS. */ + ippStsWaterfall = 43, /* Cannot load required library, waterfall is used. */ + ippStsPrevLibraryUsed = 44, /* Cannot load required library, previous dynamic library is used. */ + ippStsLLADisabled = 45, /* OpenMP* Low Level Affinity is disabled. */ + ippStsNoAntialiasing = 46, /* The mode does not support antialiasing. */ + ippStsRepetitiveSrcData = 47, /* DC: The source data is too repetitive. */ + ippStsSizeWrn = 48, /* The size does not allow to perform full operation. */ + ippStsFeatureNotSupported = 49, /* Current CPU doesn't support at least 1 of the desired features. */ + ippStsUnknownFeature = 50, /* At least one of the desired features is unknown. */ + ippStsFeaturesCombination = 51, /* Wrong combination of features. */ + ippStsAccurateModeNotSupported = 52 /* Accurate mode is not supported. */ +} IppStatus; + +#define ippStsOk ippStsNoErr + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPTYPES_H__ */ diff --git a/external/crypto_px/include/ippversion.h b/external/crypto_px/include/ippversion.h new file mode 100755 index 0000000000..66dcd6b216 --- /dev/null +++ b/external/crypto_px/include/ippversion.h @@ -0,0 +1,41 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined( __IPPVERSION_H__ ) +#define __IPPVERSION_H__ + +#define IPP_VERSION_MAJOR 9 +#define IPP_VERSION_MINOR 0 +#define IPP_VERSION_UPDATE 2 + +#define IPP_VERSION_STR "9.0.2" + +#endif /* __IPPVERSION_H__ */ diff --git a/external/crypto_px/sources/include/cpudef.h b/external/crypto_px/sources/include/cpudef.h new file mode 100644 index 0000000000..2bdd6eff07 --- /dev/null +++ b/external/crypto_px/sources/include/cpudef.h @@ -0,0 +1,264 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __CPUDEF_H__ +#define __CPUDEF_H__ + +#include "ippcore.h" + +#if defined( __cplusplus ) +extern "C" { +#endif + +#undef __CDECL +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define __CDECL __cdecl +#else + #define __CDECL +#endif + + +/* Intel CPU informator */ + +typedef struct { + int family; + int stepping; + int model; + int type; + int feature; + int tlb; + int cache; + int mmx; + int freq; + int ssx; + int wni; + int htt; + int pni; + int em64t; + int mni; + int phcores; + int sse41; + int sse42; + int ext_family; + int ext_model; + int movbe_instr; + int avx; + int xsavexgetbv; +} ippIntelCpuId; + +int __CDECL ownGetMaskFeatures( Ipp64u* pFeaturesMask ); +int __CDECL ownGetFeature( Ipp64u MaskOfFeature ); +int __CDECL ipp_is_avx_extension( void ); + +__INT64 __CDECL ipp_get_pentium_counter (void); +int __CDECL ipp_is_mmx_extension (void); +int __CDECL ipp_is_ssx_extension (void); +int __CDECL ipp_is_wni_extension (void); +int __CDECL ipp_is_htt_extension( void ); +int __CDECL ipp_is_pni_extension( void ); +int __CDECL ipp_is_mni_extension( void ); +int __CDECL ipp_is_sse41_extension( void ); +int __CDECL ipp_is_sse42_extension( void ); +int __CDECL ipp_is_movbe( void ); +int __CDECL ipp_get_cores_on_die( void ); +int __CDECL ipp_is_em64t_extension( void ); +int __CDECL ipp_has_cpuid ( void ); +int __CDECL ipp_has_rdtsc( void ); + +void __CDECL ipp_get_pentium_ident ( ippIntelCpuId* cpuid ); +int __CDECL ipp_is_GenuineIntel ( void ); +int __CDECL ipp_max_cpuid_input( void ); +int __CDECL ipp_get_cpuid( int regs[4], int valEAX, int valECX ); +void __CDECL ipp_get_cache_line_size( int* szCacheLine ); + +int __CDECL ipp_isnan( double x ); +int __CDECL ipp_finite( double x ); +int __CDECL ipp_isnan_32f( float x ); +int __CDECL ipp_finite_32f( float x ); +#define ipp_isfinite ipp_finite + +unsigned int __CDECL ipp_control87 ( unsigned int newcw, unsigned int mask ); +unsigned int __CDECL ipp_status87 ( void ); +unsigned int __CDECL ipp_clear87 ( void ); + +unsigned int __CDECL ipp_clear_ssx (void); +/* topology/affinity */ + +/* here are definitions of the CW bits exactly as x87 and ssx have */ + +#define IPP_FPU_MASK_RC 0x0c00 +#define IPP_FPU_MASK_PC 0x0300 +#define IPP_FPU_MASK_RCPC 0x0f00 + +#define IPP_FPU_RC_NEAR 0x0000 +#define IPP_FPU_RC_DOWN 0x0400 +#define IPP_FPU_RC_UP 0x0800 +#define IPP_FPU_RC_ZERO 0x0c00 + +#define IPP_FPU_PC_24 0x0000 +#define IPP_FPU_PC_53 0x0200 +#define IPP_FPU_PC_64 0x0300 + + +unsigned int __CDECL ipp_set_rcpc_fpu( unsigned int newrcpc, unsigned int mask); +void __CDECL ipp_set_cw_fpu( unsigned int cw ); + +#define IPP_SSX_RC_NEAR 0x0000 +#define IPP_SSX_RC_DOWN 0x2000 +#define IPP_SSX_RC_UP 0x4000 +#define IPP_SSX_RC_ZERO 0x6000 +#define IPP_SSX_MASK_RC 0x6000 + + +unsigned int __CDECL ipp_set_rc_ssx( unsigned int newrc ); +void __CDECL ipp_set_cw_ssx( unsigned int cw ); + +/* ================= FPU section ===================== */ + +/* Control bits - disable exceptions */ +#define FPU_EXC_MSK 0x003f /* Exception Masks Mask */ +#define FPU_MSK_INVALID 0x0001 /* invalid operation */ +#define FPU_MSK_DENORMAL 0x0002 /* denormalized operand */ +#define FPU_MSK_ZERODIV 0x0004 /* zero divide */ +#define FPU_MSK_OVERFLOW 0x0008 /* overflow */ +#define FPU_MSK_UNDERFLOW 0x0010 /* underflow */ +#define FPU_MSK_INEXACT 0x0020 /* inexact (precision) */ + +/* Status bits - exceptions */ +#define FPU_EXC_FLG 0x003f /* Exception Flags Mask */ +#define FPU_FLG_INVALID 0x0001 /* invalid operation */ +#define FPU_FLG_DENORMAL 0x0002 /* denormalized operand */ +#define FPU_FLG_ZERODIV 0x0004 /* zero divide */ +#define FPU_FLG_OVERFLOW 0x0008 /* overflow */ +#define FPU_FLG_UNDERFLOW 0x0010 /* underflow */ +#define FPU_FLG_INEXACT 0x0020 /* inexact (precision) */ + +/* Control bits - rounding control */ +#define FPU_RND 0x0c00 /* Rounding Control Mask */ +#define FPU_RND_NEAR 0x0000 /* near */ +#define FPU_RND_DOWN 0x0400 /* down */ +#define FPU_RND_UP 0x0800 /* up */ +#define FPU_RND_CHOP 0x0c00 /* chop */ + +/* Control bits - precision control */ +#define FPU_PRC 0x0300 /* Precision Control Mask */ +#define FPU_PRC_64 0x0300 /* 64 bits */ +#define FPU_PRC_53 0x0200 /* 53 bits */ +#define FPU_PRC_24 0x0000 /* 24 bits */ + +/* Control bits - all masks */ +#define FPU_ALL 0x0f3f /* all masks */ + +/* ============= definition for control/status world ============== */ + +#define FPU_SET_EXC_MASK(mask) ps_set_cw_fpu(mask,FPU_EXC_MSK) +#define FPU_GET_EXC_MASK() (ps_set_cw_fpu(0,0) & FPU_EXC_MSK) + +#define FPU_GET_EXC_FLAG() (ps_get_sw_fpu() & FPU_EXC_FLG) + +#define FPU_SET_RND_MODE(mode) ps_set_cw_fpu(mode,FPU_RND) +#define FPU_GET_RND_MODE() (ps_set_cw_fpu(0,0) & FPU_RND) + +#define FPU_SET_PRC_MODE(mode) ps_set_cw_fpu(mode,FPU_PRC) +#define FPU_GET_PRC_MODE() (ps_set_cw_fpu(0,0) & FPU_PRC) + +unsigned int __CDECL ps_set_cw_fpu( unsigned int newcw, unsigned int msk); +unsigned int __CDECL ps_get_cw_fpu(void); +unsigned int __CDECL ps_get_sw_fpu(void); +unsigned int __CDECL ps_clear_fpu(void); + +/* ======================= SSX section ============================ */ + +/* Control bits - disable exceptions */ +#define SSX_EXC_MSK 0x1f80 /* Disabling exception mask */ +#define SSX_MSK_INEXACT 0x1000 /* precision (inexact) */ +#define SSX_MSK_UNDERFLOW 0x0800 /* underflow */ +#define SSX_MSK_OVERFLOW 0x0400 /* overflow */ +#define SSX_MSK_ZERODIV 0x0200 /* divide by zero */ +#define SSX_MSK_DENORMAL 0x0100 /* denormalized */ +#define SSX_MSK_INVALID 0x0080 /* invalid operation */ + +/* Status bits - exceptions */ +#define SSX_EXC_FLG 0x003f /* Exception flags mask */ +#define SSX_FLG_INEXACT 0x0020 /* precision (inexact) */ +#define SSX_FLG_UNDERFLOW 0x0010 /* underflow */ +#define SSX_FLG_OVERFLOW 0x0008 /* overflow */ +#define SSX_FLG_ZERODIV 0x0004 /* divide by zero */ +#define SSX_FLG_DENORMAL 0x0002 /* denormalized */ +#define SSX_FLG_INVALID 0x0001 /* invalid operation */ + +/* Control bits - rounding control */ +#define SSX_RND 0x6000 /* Rounding control mask */ +#define SSX_RND_NEAR 0x0000 /* near */ +#define SSX_RND_DOWN 0x2000 /* down */ +#define SSX_RND_UP 0x4000 /* up */ +#define SSX_RND_CHOP 0x6000 /* chop */ + +/* Control bits - flush to zero mode */ +#define SSX_FZ 0x8000 /* Flush to zero mask */ +#define SSX_FZ_ENABLE 0x8000 /* flush to zero */ +#define SSX_FZ_DISABLE 0x0000 /* not flush to zero */ + +/* Control bits - denormals are zero mode */ +#define SSX_DAZ 0x0040 /* denorm. are zero mask */ +#define SSX_DAZ_ENABLE 0x0040 /* denorm. are zero */ +#define SSX_DAZ_DISABLE 0x0000 /* denorm. are not zero */ + +#define SSX_ALL 0xffbf /* All masks */ + +/* ==================== definition for SSX register =============== */ + +#define SSX_SET_EXC_MASK(mask) ps_set_ssx(mask,SSX_EXC_MSK) +#define SSX_GET_EXC_MASK() (ps_get_ssx() & SSX_EXC_MSK) + +#define SSX_SET_EXC_FLAG(flag) ps_set_ssx(flag,SSX_EXC_FLG) +#define SSX_GET_EXC_FLAG() (ps_get_ssx() & SSX_EXC_FLG) + +#define SSX_SET_RND_MODE(mode) ps_set_ssx(mode,SSX_RND) +#define SSX_GET_RND_MODE() (ps_get_ssx() & SSX_RND) + +#define SSX_SET_FZ_MODE(mode) ps_set_ssx(mode,SSX_FZ) +#define SSX_GET_FZ_MODE() (ps_get_ssx() & SSX_FZ) + +#define SSX_SET_DAZ_MODE(mode) ps_set_ssx(mode,SSX_DAZ) +#define SSX_GET_DAZ_MODE() (ps_get_ssx() & SSX_DAZ) + +unsigned int __CDECL ps_set_ssx(unsigned int newssx, unsigned int msk); +unsigned int __CDECL ps_get_ssx(void); +unsigned int __CDECL ipp_tst_daz_ssx(void); + +#if defined( __cplusplus ) +} +#endif + +#endif /* __CPUDEF_H__ */ + +/* ////////////////////////// End of file "cpudef.h" //////////////////////// */ diff --git a/external/crypto_px/sources/include/ippver.gen b/external/crypto_px/sources/include/ippver.gen new file mode 100644 index 0000000000..51c4a2d51d --- /dev/null +++ b/external/crypto_px/sources/include/ippver.gen @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_IPP_DYNAMIC) || defined(_CORE) +#include "owndefs.h" + +#ifndef _IPP_VERSION +#define _IPP_VERSION "" +#endif + +#define GET_LIB_NAME01(pref) pref ## GetLibVersion + +#define GET_LIB_NAME(pref) GET_LIB_NAME01(pref) + +#define LIBVERNAME s_libVer + +#define SLIBVERNAME LIBVERNAME +#include "ippverstr.gen" + +#include "cpudef.h" + +extern int ippJumpIndexForMergedDLL; + +IPPFUN( const IppLibraryVersion*, GET_LIB_NAME(LIB_PREFIX), (void) ) +{ + return &LIBVERNAME; +} +#endif diff --git a/external/crypto_px/sources/include/ippver.h b/external/crypto_px/sources/include/ippver.h new file mode 100644 index 0000000000..f72232a335 --- /dev/null +++ b/external/crypto_px/sources/include/ippver.h @@ -0,0 +1,46 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "ippversion.h" +#ifndef BASE_VERSION +#define BASE_VERSION() IPP_VERSION_MAJOR,IPP_VERSION_MINOR,IPP_VERSION_UPDATE +#endif + +#ifndef STR_VERSION + #ifdef IPP_REVISION + #define STR_VERSION() IPP_VERSION_STR " (r" STR( IPP_REVISION ) ")" + #else + #define STR_VERSION() IPP_VERSION_STR " (-)" + #endif +#endif + + +/* ////////////////////////////// End of file /////////////////////////////// */ diff --git a/external/crypto_px/sources/include/ippverstr.gen b/external/crypto_px/sources/include/ippverstr.gen new file mode 100644 index 0000000000..edbcad3309 --- /dev/null +++ b/external/crypto_px/sources/include/ippverstr.gen @@ -0,0 +1,120 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifdef _IPP_OMP_STATIC +#define LIB_THREADS " threaded" +#define CORE_THREADS " (threaded)" +#else +#define LIB_THREADS "" +#define CORE_THREADS "" +#endif + +#define GET_LIBRARY_NAME( cpu, is ) #cpu, IPP_LIB_SHORTNAME() " " is " (" #cpu LIB_THREADS ")" + +static const IppLibraryVersion SLIBVERNAME = { + +/* major, minor, update (ex-majorBuild) */ + BASE_VERSION(), + +#if defined IPP_REVISION + IPP_REVISION, +#else + -1, +#endif /* IPP_REVISION */ + +#if defined( _CORE ) + /*GET_LIBRARY_NAME( core )*/ + "core", + "ippCore" CORE_THREADS + +#elif ( _IPP_ARCH == _IPP_ARCH_IA32 ) || ( _IPP_ARCH == _IPP_ARCH_LP32 ) + #if ( _IPP == _IPP_M5 ) + GET_LIBRARY_NAME( m5, "586" ) + #elif ( _IPP == _IPP_H9 ) + GET_LIBRARY_NAME( h9, "AVX2" ) + #elif ( _IPP == _IPP_G9 ) + GET_LIBRARY_NAME( g9, "AVX" ) + #elif ( _IPP == _IPP_P8 ) + GET_LIBRARY_NAME( p8, "SSE4.2" ) + #elif ( _IPPLP32 == _IPPLP32_S8 ) + GET_LIBRARY_NAME( s8, "Atom" ) + #elif ( _IPP == _IPP_V8 ) + GET_LIBRARY_NAME( v8, "SSSE3" ) + #elif ( _IPP == _IPP_W7 ) + GET_LIBRARY_NAME( w7, "SSE2" ) + #else + GET_LIBRARY_NAME( px, "PX" ) + #endif + +#elif ( _IPP_ARCH == _IPP_ARCH_EM64T ) || ( _IPP_ARCH == _IPP_ARCH_LP64 ) + #if ( _IPP32E == _IPP32E_K0 ) + GET_LIBRARY_NAME( k0, "AVX-512F/CD/BW/DQ/VL" ) + #elif ( _IPP32E == _IPP32E_N0 ) + GET_LIBRARY_NAME( n0, "AVX-512F/CD/ER/PF" ) + #elif ( _IPP32E == _IPP32E_E9 ) + GET_LIBRARY_NAME( e9, "AVX" ) + #elif ( _IPP32E == _IPP32E_L9 ) + GET_LIBRARY_NAME( l9, "AVX2" ) + #elif ( _IPP32E == _IPP32E_Y8 ) + GET_LIBRARY_NAME( y8, "SSE4.2" ) + #elif ( _IPPLP64 == _IPPLP64_N8 ) + GET_LIBRARY_NAME( n8, "Atom" ) + #elif ( _IPP32E == _IPP32E_U8 ) + GET_LIBRARY_NAME( u8, "SSSE3" ) + #elif ( _IPP32E == _IPP32E_M7 ) + GET_LIBRARY_NAME( m7, "SSE3" ) + #else + GET_LIBRARY_NAME( mx, "PX" ) + #endif + +#elif ( _IPP_ARCH == _IPP_ARCH_LRB2 ) + #if ( _IPPLRB == _IPPLRB_BX ) + GET_LIBRARY_NAME( bx, "PX" ) + #elif ( _IPPLRB == _IPPLRB_B2 ) + GET_LIBRARY_NAME( b2, "KNC" ) + #endif + +#else + #error ARCH not supported + +#endif + +#if defined( TICKTOCK ) + "+" +#endif + +/* release Version (by Manager) */ + ,STR_VERSION() + +/* BuildDate (by QA person) */ + ,__DATE__ + +}; diff --git a/external/crypto_px/sources/include/owndefs.h b/external/crypto_px/sources/include/owndefs.h new file mode 100644 index 0000000000..9757893d4e --- /dev/null +++ b/external/crypto_px/sources/include/owndefs.h @@ -0,0 +1,944 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __OWNDEFS_H__ +#define __OWNDEFS_H__ + +#if defined( _VXWORKS ) + #include + #undef NONE +#endif + +#include "ippdefs.h" + +#if defined(__INTEL_COMPILER) || defined(_MSC_VER) + #define __INLINE static __inline +#elif defined( __GNUC__ ) + #define __INLINE static __inline__ +#else + #define __INLINE static +#endif + +#if defined(__INTEL_COMPILER) + #define __RESTRICT restrict +#elif !defined( __RESTRICT ) + #define __RESTRICT +#endif + +#if defined( IPP_W32DLL ) + #if defined( _MSC_VER ) || defined( __INTEL_COMPILER ) + #define IPPFUN(type,name,arg) __declspec(dllexport) type __STDCALL name arg + #else + #define IPPFUN(type,name,arg) extern type __STDCALL name arg + #endif +#else + #define IPPFUN(type,name,arg) extern type __STDCALL name arg +#endif + + +/* structure represeting 128 bit unsigned integer type */ + +typedef struct{ + Ipp64u low; + Ipp64u high; +}Ipp128u; + +#define _IPP_PX 0 /* pure C-code ia32 */ +#define _IPP_M5 1 /* Quark (Pentium) - x86+x87 ia32 */ +#define _IPP_M6 2 /* Pentium MMX - MMX ia32 */ +#define _IPP_A6 4 /* Pentium III - SSE ia32 */ +#define _IPP_W7 8 /* Pentium 4 - SSE2 ia32 */ +#define _IPP_T7 16 /* Pentium with x64 support (Nocona) - SSE3 ia32 */ +#define _IPP_V8 32 /* Merom - SSSE3 ia32 */ +#define _IPP_P8 64 /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */ +#define _IPP_G9 128 /* SandyBridge (GSSE) - AVX ia32 */ +#define _IPP_H9 256 /* Haswell (AVX2) ia32 */ +#define _IPP_I0 512 /* KNL (AVX-512) ia32 */ +#define _IPP_S0 1024 /* SkyLake Xeon (AVX-512) ia32 */ + +#define _IPPXSC_PX 0 +#define _IPPXSC_S1 1 +#define _IPPXSC_S2 2 +#define _IPPXSC_C2 4 + +#define _IPPLRB_PX 0 +#define _IPPLRB_B1 1 +#define _IPPLRB_B2 2 + +#define _IPP64_PX _IPP_PX +#define _IPP64_I7 64 + +#define _IPP32E_PX _IPP_PX /* pure C-code x64 */ +#define _IPP32E_M7 32 /* Pentium with x64 support (Nocona) - SSE3 x64 */ +#define _IPP32E_U8 64 /* Merom - SSSE3 x64 */ +#define _IPP32E_Y8 128 /* Penryn - SSE4.1 + tick for SSE4.2 x64 */ +#define _IPP32E_E9 256 /* SandyBridge (GSSE) - AVX x64 */ +#define _IPP32E_L9 512 /* Haswell (AVX2) x64 */ +#define _IPP32E_N0 1024 /* KNL (AVX-512) x64 */ +#define _IPP32E_K0 2048 /* SkyLake Xeon (AVX-512) x64 */ + +#define _IPPLP32_PX _IPP_PX +#define _IPPLP32_S8 1 /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */ + +#define _IPPLP64_PX _IPP_PX +#define _IPPLP64_N8 1 /* old Atom (SSSE3+movbe) (Silverthorne) x64 */ + +#if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300) + #define __ALIGN8 __declspec (align(8)) + #define __ALIGN16 __declspec (align(16)) +#if !defined( OSX32 ) + #define __ALIGN32 __declspec (align(32)) +#else + #define __ALIGN32 __declspec (align(16)) +#endif + #define __ALIGN64 __declspec (align(64)) +#elif defined (__GNUC__) + #define __ALIGN8 __attribute((aligned(8))) + #define __ALIGN16 __attribute((aligned(16))) + #define __ALIGN32 __attribute((aligned(32))) + #define __ALIGN64 __attribute((aligned(64))) +#else + #define __ALIGN8 + #define __ALIGN16 + #define __ALIGN32 + #define __ALIGN64 +#endif + +#if defined ( _M5 ) /* Quark (Pentium) - x86+x87 ia32 */ + #define _IPP _IPP_M5 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined ( _M6 ) /* Pentium MMX - MMX ia32 */ + #define _IPP _IPP_M6 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _A6 ) /* Pentium III - SSE ia32 */ + #define _IPP _IPP_A6 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _W7 ) /* Pentium 4 - SSE2 ia32 */ + #define _IPP _IPP_W7 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _T7 ) /* Pentium with x64 support (Nocona) - SSE3 ia32 */ + #define _IPP _IPP_T7 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _V8 ) /* Merom - SSSE3 ia32 */ + #define _IPP _IPP_V8 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _P8 ) /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */ + #define _IPP _IPP_P8 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _G9 ) /* SandyBridge (GSSE) - AVX ia32 */ + #define _IPP _IPP_G9 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _H9 ) /* Haswell (AVX2) ia32 */ + #define _IPP _IPP_H9 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _M7 ) /* Pentium with x64 support (Nocona) - SSE3 x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_M7 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _U8 ) /* Merom - SSSE3 x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_U8 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _Y8 ) /* Penryn - SSE4.1 + tick for SSE4.2 x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_Y8 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _E9 ) /* SandyBridge (GSSE) - AVX x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_E9 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _L9 ) /* Haswell (AVX2) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_L9 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _N0 ) /* KNL (AVX-512) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_N0 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _K0 ) /* SkyLake Xeon (AVX-512) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_K0 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _B2 ) /* KNC (MIC) */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_B2 + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _S8 ) /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */ + #define _IPP _IPP_V8 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_S8 + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _N8 ) /* old Atom (SSSE3+movbe) (Silverthorne) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_U8 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_N8 + +#else + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#endif + + +#define _IPP_ARCH_IA32 1 +#define _IPP_ARCH_IA64 2 +#define _IPP_ARCH_EM64T 4 +#define _IPP_ARCH_XSC 8 +#define _IPP_ARCH_LRB 16 +#define _IPP_ARCH_LP32 32 +#define _IPP_ARCH_LP64 64 +#define _IPP_ARCH_LRB2 128 + +#if defined ( _ARCH_IA32 ) + #define _IPP_ARCH _IPP_ARCH_IA32 + +#elif defined( _ARCH_EM64T ) + #define _IPP_ARCH _IPP_ARCH_EM64T + +#elif defined( _ARCH_LRB2 ) + #define _IPP_ARCH _IPP_ARCH_LRB2 + +#elif defined( _ARCH_LP32 ) + #define _IPP_ARCH _IPP_ARCH_LP32 + +#elif defined( _ARCH_LP64 ) + #define _IPP_ARCH _IPP_ARCH_LP64 + +#else + #if defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) + #define _IPP_ARCH _IPP_ARCH_EM64T + + #else + #define _IPP_ARCH _IPP_ARCH_IA32 + + #endif +#endif + +#if ((_IPP_ARCH == _IPP_ARCH_IA32) || (_IPP_ARCH == _IPP_ARCH_LP32)) +__INLINE +Ipp32s IPP_INT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp32s Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} + +__INLINE +Ipp32u IPP_UINT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp32u Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} +#elif ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LRB2) || (_IPP_ARCH == _IPP_ARCH_LP64)) +__INLINE +Ipp64s IPP_INT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp64s Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} + +__INLINE +Ipp64u IPP_UINT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp64u Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} +#else + #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) + #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) +#endif + +#define IPP_ALIGN_TYPE(type, align) ((align)/sizeof(type)-1) +#define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) +#define IPP_ALIGNED_PTR(ptr, align) (void*)( (unsigned char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) + +#define IPP_ALIGNED_SIZE(size, align) (((size)+(align)-1)&~((align)-1)) + +#define IPP_MALLOC_ALIGNED_BYTES 64 +#define IPP_MALLOC_ALIGNED_8BYTES 8 +#define IPP_MALLOC_ALIGNED_16BYTES 16 +#define IPP_MALLOC_ALIGNED_32BYTES 32 + +#define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ + char arrname##AlignedArrBuff[sizeof(arrtype)*(arrlength)+IPP_ALIGN_TYPE(char, align)];\ + arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) + +#if defined( __cplusplus ) +extern "C" { +#endif + +/* ///////////////////////////////////////////////////////////////////////////// + + IPP Context Identification + + /////////////////////////////////////////////////////////////////////////// */ + +#define IPP_CONTEXT( a, b, c, d) \ + (int)(((unsigned)(a) << 24) | ((unsigned)(b) << 16) | \ + ((unsigned)(c) << 8) | (unsigned)(d)) + +typedef enum { + idCtxUnknown = 0, + idCtxFFT_C_16sc, + idCtxFFT_C_16s, + idCtxFFT_R_16s, + idCtxFFT_C_32fc, + idCtxFFT_C_32f, + idCtxFFT_R_32f, + idCtxFFT_C_64fc, + idCtxFFT_C_64f, + idCtxFFT_R_64f, + idCtxDFT_C_16sc, + idCtxDFT_C_16s, + idCtxDFT_R_16s, + idCtxDFT_C_32fc, + idCtxDFT_C_32f, + idCtxDFT_R_32f, + idCtxDFT_C_64fc, + idCtxDFT_C_64f, + idCtxDFT_R_64f, + idCtxDCTFwd_16s, + idCtxDCTInv_16s, + idCtxDCTFwd_32f, + idCtxDCTInv_32f, + idCtxDCTFwd_64f, + idCtxDCTInv_64f, + idCtxFFT2D_C_32fc, + idCtxFFT2D_R_32f, + idCtxDFT2D_C_32fc, + idCtxDFT2D_R_32f, + idCtxFFT2D_R_32s, + idCtxDFT2D_R_32s, + idCtxDCT2DFwd_32f, + idCtxDCT2DInv_32f, + idCtxMoment64f, + idCtxMoment64s, + idCtxRandUni_8u, + idCtxRandUni_16s, + idCtxRandUni_32f, + idCtxRandUni_64f, + idCtxRandGauss_8u, + idCtxRandGauss_16s, + idCtxRandGauss_32f, + idCtxRandGauss_64f, + idCtxWTFwd_32f, + idCtxWTFwd_8u32f, + idCtxWTFwd_8s32f, + idCtxWTFwd_16u32f, + idCtxWTFwd_16s32f, + idCtxWTFwd2D_32f_C1R, + idCtxWTInv2D_32f_C1R, + idCtxWTFwd2D_32f_C3R, + idCtxWTInv2D_32f_C3R, + idCtxWTInv_32f, + idCtxWTInv_32f8u, + idCtxWTInv_32f8s, + idCtxWTInv_32f16u, + idCtxWTInv_32f16s, + idCtxMDCTFwd_32f, + idCtxMDCTInv_32f, + idCtxMDCTFwd_16s, + idCtxFIRBlock_32f, + idCtxFDP_32f, + idCtxRLMS_32f = IPP_CONTEXT( 'L', 'M', 'S', '1'), + idCtxRLMS32f_16s = IPP_CONTEXT( 'L', 'M', 'S', 0 ), + idCtxIIRAR_32f = IPP_CONTEXT( 'I', 'I', '0', '1'), + idCtxIIRBQ_32f = IPP_CONTEXT( 'I', 'I', '0', '2'), + idCtxIIRAR_32fc = IPP_CONTEXT( 'I', 'I', '0', '3'), + idCtxIIRBQ_32fc = IPP_CONTEXT( 'I', 'I', '0', '4'), + idCtxIIRAR32f_16s = IPP_CONTEXT( 'I', 'I', '0', '5'), + idCtxIIRBQ32f_16s = IPP_CONTEXT( 'I', 'I', '0', '6'), + idCtxIIRAR32fc_16sc = IPP_CONTEXT( 'I', 'I', '0', '7'), + idCtxIIRBQ32fc_16sc = IPP_CONTEXT( 'I', 'I', '0', '8'), + idCtxIIRAR32s_16s = IPP_CONTEXT( 'I', 'I', '0', '9'), + idCtxIIRBQ32s_16s = IPP_CONTEXT( 'I', 'I', '1', '0'), + idCtxIIRAR32sc_16sc = IPP_CONTEXT( 'I', 'I', '1', '1'), + idCtxIIRBQ32sc_16sc = IPP_CONTEXT( 'I', 'I', '1', '2'), + idCtxIIRAR_64f = IPP_CONTEXT( 'I', 'I', '1', '3'), + idCtxIIRBQ_64f = IPP_CONTEXT( 'I', 'I', '1', '4'), + idCtxIIRAR_64fc = IPP_CONTEXT( 'I', 'I', '1', '5'), + idCtxIIRBQ_64fc = IPP_CONTEXT( 'I', 'I', '1', '6'), + idCtxIIRAR64f_32f = IPP_CONTEXT( 'I', 'I', '1', '7'), + idCtxIIRBQ64f_32f = IPP_CONTEXT( 'I', 'I', '1', '8'), + idCtxIIRAR64fc_32fc = IPP_CONTEXT( 'I', 'I', '1', '9'), + idCtxIIRBQ64fc_32fc = IPP_CONTEXT( 'I', 'I', '2', '0'), + idCtxIIRAR64f_32s = IPP_CONTEXT( 'I', 'I', '2', '1'), + idCtxIIRBQ64f_32s = IPP_CONTEXT( 'I', 'I', '2', '2'), + idCtxIIRAR64fc_32sc = IPP_CONTEXT( 'I', 'I', '2', '3'), + idCtxIIRBQ64fc_32sc = IPP_CONTEXT( 'I', 'I', '2', '4'), + idCtxIIRAR64f_16s = IPP_CONTEXT( 'I', 'I', '2', '5'), + idCtxIIRBQ64f_16s = IPP_CONTEXT( 'I', 'I', '2', '6'), + idCtxIIRAR64fc_16sc = IPP_CONTEXT( 'I', 'I', '2', '7'), + idCtxIIRBQ64fc_16sc = IPP_CONTEXT( 'I', 'I', '2', '8'), + idCtxIIRBQDF1_32f = IPP_CONTEXT( 'I', 'I', '2', '9'), + idCtxIIRBQDF164f_32s= IPP_CONTEXT( 'I', 'I', '3', '0'), + idCtxFIRSR_32f = IPP_CONTEXT( 'F', 'I', '0', '1'), + idCtxFIRSR_32fc = IPP_CONTEXT( 'F', 'I', '0', '2'), + idCtxFIRMR_32f = IPP_CONTEXT( 'F', 'I', '0', '3'), + idCtxFIRMR_32fc = IPP_CONTEXT( 'F', 'I', '0', '4'), + idCtxFIRSR32f_16s = IPP_CONTEXT( 'F', 'I', '0', '5'), + idCtxFIRSR32fc_16sc = IPP_CONTEXT( 'F', 'I', '0', '6'), + idCtxFIRMR32f_16s = IPP_CONTEXT( 'F', 'I', '0', '7'), + idCtxFIRMR32fc_16sc = IPP_CONTEXT( 'F', 'I', '0', '8'), + idCtxFIRSR32s_16s = IPP_CONTEXT( 'F', 'I', '0', '9'), + idCtxFIRSR32sc_16sc = IPP_CONTEXT( 'F', 'I', '1', '0'), + idCtxFIRMR32s_16s = IPP_CONTEXT( 'F', 'I', '1', '1'), + idCtxFIRMR32sc_16sc = IPP_CONTEXT( 'F', 'I', '1', '2'), + idCtxFIRSR_64f = IPP_CONTEXT( 'F', 'I', '1', '3'), + idCtxFIRSR_64fc = IPP_CONTEXT( 'F', 'I', '1', '4'), + idCtxFIRMR_64f = IPP_CONTEXT( 'F', 'I', '1', '5'), + idCtxFIRMR_64fc = IPP_CONTEXT( 'F', 'I', '1', '6'), + idCtxFIRSR64f_32f = IPP_CONTEXT( 'F', 'I', '1', '7'), + idCtxFIRSR64fc_32fc = IPP_CONTEXT( 'F', 'I', '1', '8'), + idCtxFIRMR64f_32f = IPP_CONTEXT( 'F', 'I', '1', '9'), + idCtxFIRMR64fc_32fc = IPP_CONTEXT( 'F', 'I', '2', '0'), + idCtxFIRSR64f_32s = IPP_CONTEXT( 'F', 'I', '2', '1'), + idCtxFIRSR64fc_32sc = IPP_CONTEXT( 'F', 'I', '2', '2'), + idCtxFIRMR64f_32s = IPP_CONTEXT( 'F', 'I', '2', '3'), + idCtxFIRMR64fc_32sc = IPP_CONTEXT( 'F', 'I', '2', '4'), + idCtxFIRSR64f_16s = IPP_CONTEXT( 'F', 'I', '2', '5'), + idCtxFIRSR64fc_16sc = IPP_CONTEXT( 'F', 'I', '2', '6'), + idCtxFIRMR64f_16s = IPP_CONTEXT( 'F', 'I', '2', '7'), + idCtxFIRMR64fc_16sc = IPP_CONTEXT( 'F', 'I', '2', '8'), + idCtxFIRSR_16s = IPP_CONTEXT( 'F', 'I', '2', '9'), + idCtxFIRMR_16s = IPP_CONTEXT( 'F', 'I', '3', '0'), + idCtxFIRSRStream_16s= IPP_CONTEXT( 'F', 'I', '3', '1'), + idCtxFIRMRStream_16s= IPP_CONTEXT( 'F', 'I', '3', '2'), + idCtxFIRSRStream_32f= IPP_CONTEXT( 'F', 'I', '3', '3'), + idCtxFIRMRStream_32f= IPP_CONTEXT( 'F', 'I', '3', '4'), + idCtxRLMS32s_16s = IPP_CONTEXT( 'L', 'M', 'S', 'R'), + idCtxCLMS32s_16s = IPP_CONTEXT( 'L', 'M', 'S', 'C'), + idCtxEncode_JPEG2K, + idCtxDES = IPP_CONTEXT( ' ', 'D', 'E', 'S'), + idCtxBlowfish = IPP_CONTEXT( ' ', ' ', 'B', 'F'), + idCtxRijndael = IPP_CONTEXT( ' ', 'R', 'I', 'J'), + idCtxSMS4 = IPP_CONTEXT( 'S', 'M', 'S', '4'), + idCtxTwofish = IPP_CONTEXT( ' ', ' ', 'T', 'F'), + idCtxARCFOUR = IPP_CONTEXT( ' ', 'R', 'C', '4'), + idCtxRC564 = IPP_CONTEXT( 'R', 'C', '5', '1'), + idCtxRC5128 = IPP_CONTEXT( 'R', 'C', '5', '2'), + idCtxSHA1 = IPP_CONTEXT( 'S', 'H', 'S', '1'), + idCtxSHA224 = IPP_CONTEXT( 'S', 'H', 'S', '3'), + idCtxSHA256 = IPP_CONTEXT( 'S', 'H', 'S', '2'), + idCtxSHA384 = IPP_CONTEXT( 'S', 'H', 'S', '4'), + idCtxSHA512 = IPP_CONTEXT( 'S', 'H', 'S', '5'), + idCtxMD5 = IPP_CONTEXT( ' ', 'M', 'D', '5'), + idCtxHMAC = IPP_CONTEXT( 'H', 'M', 'A', 'C'), + idCtxDAA = IPP_CONTEXT( ' ', 'D', 'A', 'A'), + idCtxBigNum = IPP_CONTEXT( 'B', 'I', 'G', 'N'), + idCtxMontgomery = IPP_CONTEXT( 'M', 'O', 'N', 'T'), + idCtxPrimeNumber = IPP_CONTEXT( 'P', 'R', 'I', 'M'), + idCtxPRNG = IPP_CONTEXT( 'P', 'R', 'N', 'G'), + idCtxRSA = IPP_CONTEXT( ' ', 'R', 'S', 'A'), + idCtxRSA_PubKey = IPP_CONTEXT( 'R', 'S', 'A', '0'), + idCtxRSA_PrvKey1 = IPP_CONTEXT( 'R', 'S', 'A', '1'), + idCtxRSA_PrvKey2 = IPP_CONTEXT( 'R', 'S', 'A', '2'), + idCtxDSA = IPP_CONTEXT( ' ', 'D', 'S', 'A'), + idCtxECCP = IPP_CONTEXT( ' ', 'E', 'C', 'P'), + idCtxECCB = IPP_CONTEXT( ' ', 'E', 'C', 'B'), + idCtxECCPPoint = IPP_CONTEXT( 'P', 'E', 'C', 'P'), + idCtxECCBPoint = IPP_CONTEXT( 'P', 'E', 'C', 'B'), + idCtxDH = IPP_CONTEXT( ' ', ' ', 'D', 'H'), + idCtxDLP = IPP_CONTEXT( ' ', 'D', 'L', 'P'), + idCtxCMAC = IPP_CONTEXT( 'C', 'M', 'A', 'C'), + idCtxRFFT2_8u, + idCtxHilbert_32f32fc, + idCtxHilbert_16s32fc, + idCtxHilbert_16s16sc, + idCtxTone_16s, + idCtxTriangle_16s, + idCtxDFTOutOrd_C_32fc, + idCtxDFTOutOrd_C_64fc, + idCtxFFT_C_32sc, + idCtxFFT_C_32s, + idCtxFFT_R_32s, + idCtxFFT_R_16s32s, + idCtxDecodeProgr_JPEG2K, + idCtxWarp_MPEG4, + idCtxQuantInvIntra_MPEG4, + idCtxQuantInvInter_MPEG4, + idCtxQuantIntra_MPEG4, + idCtxQuantInter_MPEG4, + idCtxAnalysisFilter_SBR_C_32f32fc, + idCtxAnalysisFilter_SBR_C_32f, + idCtxAnalysisFilter_SBR_R_32f, + idCtxSynthesisFilter_SBR_C_32fc32f, + idCtxSynthesisFilter_SBR_C_32f, + idCtxSynthesisFilter_SBR_R_32f, + idCtxSynthesisDownFilter_SBR_C_32fc32f, + idCtxSynthesisDownFilter_SBR_C_32f, + idCtxSynthesisDownFilter_SBR_R_32f, + idCtxVLCEncode, + idCtxVLCDecode, + idCtxAnalysisFilter_SBR_C_32s32sc, + idCtxAnalysisFilter_SBR_R_32s, + idCtxSynthesisFilter_SBR_C_32sc32s, + idCtxSynthesisFilter_SBR_R_32s, + idCtxSynthesisDownFilter_SBR_C_32sc32s, + idCtxSynthesisDownFilter_SBR_R_32s, + idCtxSynthesisFilter_PQMF_MP3_32f, + idCtxAnalysisFilter_PQMF_MP3_32f, + idCtxResampleRow, + idCtxAnalysisFilter_SBR_Enc_C_32f32fc, + idCtxSynthesisFilter_DTS_32f, + idCtxFilterBilateralGauss_8u, + idCtxFilterBilateralGaussFast_8u, + idCtxBGF, + idCtxPolyGF, + idCtxRSenc, + idCtxRSdec, + idCtxSnow3g = IPP_CONTEXT( 'S', 'n', 'o', 'w'), + idCtxSnow3gF8, + idCtxSnow3gF9, + idCtxKasumi = IPP_CONTEXT( 'K', 'a', 's', 'u'), + idCtxKasumiF8, + idCtxKasumiF9, + idCtxResizeHannFilter_8u, + idCtxResizeLanczosFilter_8u, + idCtxAESXCBC, + idCtxAESCCM, + idCtxAESGCM, + idCtxMsgCatalog, + idCtxGFP, + idCtxGFPE, + idCtxGFPX, + idCtxGFPXE, + idCtxGFPXQX, + idCtxGFPXQXE, + idCtxGFPEC, + idCtxGFPPoint, + idCtxGFPXEC, + idCtxGFPXECPoint, + idCtxPairing, + idCtxResize_32f, + idCtxResizeYUV420, + idCtxResizeYUV422, + idCtxResize_64f, + idCtxFilterBilateralBorder, + idCtxThresholdAdaptiveGauss, + idCtxHOG, + idCtxFastN, + idCtxHash, + idCtxSM3 +} IppCtxId; + + + + +/* ///////////////////////////////////////////////////////////////////////////// + Helpers + /////////////////////////////////////////////////////////////////////////// */ + +#define IPP_NOERROR_RET() return ippStsNoErr +#define IPP_ERROR_RET( ErrCode ) return (ErrCode) + +#ifdef _IPP_DEBUG + + #define IPP_BADARG_RET( expr, ErrCode )\ + {if (expr) { IPP_ERROR_RET( ErrCode ); }} + +#else + + #define IPP_BADARG_RET( expr, ErrCode ) + +#endif + + + #define IPP_BAD_SIZE_RET( n )\ + IPP_BADARG_RET( (n)<=0, ippStsSizeErr ) + + #define IPP_BAD_STEP_RET( n )\ + IPP_BADARG_RET( (n)<=0, ippStsStepErr ) + + #define IPP_BAD_PTR1_RET( ptr )\ + IPP_BADARG_RET( NULL==(ptr), ippStsNullPtrErr ) + + #define IPP_BAD_PTR2_RET( ptr1, ptr2 )\ + {IPP_BAD_PTR1_RET( ptr1 ); IPP_BAD_PTR1_RET( ptr2 )} + + #define IPP_BAD_PTR3_RET( ptr1, ptr2, ptr3 )\ + {IPP_BAD_PTR2_RET( ptr1, ptr2 ); IPP_BAD_PTR1_RET( ptr3 )} + + #define IPP_BAD_PTR4_RET( ptr1, ptr2, ptr3, ptr4 )\ + {IPP_BAD_PTR2_RET( ptr1, ptr2 ); IPP_BAD_PTR2_RET( ptr3, ptr4 )} + + #define IPP_BAD_ISIZE_RET(roi) \ + IPP_BADARG_RET( ((roi).width<=0 || (roi).height<=0), ippStsSizeErr) + +/* ////////////////////////////////////////////////////////////////////////// */ +/* internal messages */ + +#define MSG_LOAD_DLL_ERR (-9700) /* Error at loading of %s library */ +#define MSG_NO_DLL (-9701) /* No DLLs were found in the Waterfall procedure */ +#define MSG_NO_SHARED (-9702) /* No shared libraries were found in the Waterfall procedure */ + +/* ////////////////////////////////////////////////////////////////////////// */ + + +typedef union { /* double precision */ + Ipp64s hex; + Ipp64f fp; +} IppFP_64f; + +typedef union { /* single precision */ + Ipp32s hex; + Ipp32f fp; +} IppFP_32f; + + +extern const IppFP_32f ippConstantOfNAN_32f; +extern const IppFP_64f ippConstantOfNAN_64f; + +extern const IppFP_32f ippConstantOfINF_32f; +extern const IppFP_64f ippConstantOfINF_64f; +extern const IppFP_32f ippConstantOfINF_NEG_32f; +extern const IppFP_64f ippConstantOfINF_NEG_64f; + +#define NAN_32F (ippConstantOfNAN_32f.fp) +#define NAN_64F (ippConstantOfNAN_64f.fp) +#define INF_32F (ippConstantOfINF_32f.fp) +#define INF_64F (ippConstantOfINF_64f.fp) +#define INF_NEG_32F (ippConstantOfINF_NEG_32f.fp) +#define INF_NEG_64F (ippConstantOfINF_NEG_64f.fp) + +/* ////////////////////////////////////////////////////////////////////////// */ + +typedef enum { + ippunreg=-1, + ippac = 0, + ippcc = 1, + ippch = 2, + ippcp = 3, + ippcv = 4, + ippdc = 5, + ippdi = 6, + ippgen = 7, + ippi = 8, + ippj = 9, + ippm = 10, + ippr = 11, + ipps = 12, + ippsc = 13, + ippsr = 14, + ippvc = 15, + ippvm = 16, + ippmsdk = 17, + ippcpepid = 18, + ippe = 19, + ipprs = 20, + ippsq = 21, + ippnomore +} IppDomain; + +int __CDECL ownGetNumThreads( void ); +int __CDECL ownGetFeature( Ipp64u MaskOfFeature ); /* the main function of tick-tock dispatcher */ + +#ifdef _IPP_DYNAMIC +typedef IppStatus (__STDCALL *DYN_RELOAD)( int ); +void __CDECL ownRegisterLib( IppDomain, DYN_RELOAD ); +void __CDECL ownUnregisterLib( IppDomain ); +#endif + +/* the number of threads available for any ipp function that uses OMP; */ +/* at the ippxx.dll loading time is equal to the number of logical processors, */ +/* and can be changed ONLY externally by library user to any desired number */ +/* by means of ippSetNumThreads() function */ +#define IPP_GET_NUM_THREADS() ( ownGetNumThreads() ) +#define IPP_OMP_NUM_THREADS() num_threads( IPP_GET_NUM_THREADS() ) +#define IPP_OMP_LIMIT_MAX_NUM_THREADS(n) num_threads( IPP_MIN(IPP_GET_NUM_THREADS(),(n))) + + +/* ////////////////////////////////////////////////////////////////////////// */ + +/* Define NULL pointer value */ +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define UNREFERENCED_PARAMETER(p) (p)=(p) + +#if defined( _IPP_MARK_LIBRARY ) +static char G[] = {73, 80, 80, 71, 101, 110, 117, 105, 110, 101, 243, 193, 210, 207, 215}; +#endif + + +#define STR2(x) #x +#define STR(x) STR2(x) +#define MESSAGE( desc )\ + message(__FILE__ "(" STR(__LINE__) "):" #desc) + +/* +// endian definition +*/ +#define IPP_LITTLE_ENDIAN (0) +#define IPP_BIG_ENDIAN (1) + +#if defined( _IPP_LE ) + #define IPP_ENDIAN IPP_LITTLE_ENDIAN + +#elif defined( _IPP_BE ) + #define IPP_ENDIAN IPP_BIG_ENDIAN + +#else + #if defined( __ARMEB__ ) + #define IPP_ENDIAN IPP_BIG_ENDIAN + + #else + #define IPP_ENDIAN IPP_LITTLE_ENDIAN + + #endif +#endif + + +/* ////////////////////////////////////////////////////////////////////////// */ + +/* intrinsics */ +#if (_IPP >= _IPP_A6) || (_IPP32E >= _IPP32E_M7) + #if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300) + #if (_IPP == _IPP_A6) + #include "xmmintrin.h" + #elif (_IPP == _IPP_W7) + #if defined(__INTEL_COMPILER) + #include "emmintrin.h" + #else + #undef _W7 + #include "emmintrin.h" + #define _W7 + #endif + #define _mm_loadu _mm_loadu_si128 + #elif (_IPP == _IPP_T7) || (_IPP32E == _IPP32E_M7) + #if defined(__INTEL_COMPILER) + #include "pmmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif + #elif (_IPP == _IPP_V8) || (_IPP32E == _IPP32E_U8) + #if defined(__INTEL_COMPILER) + #include "tmmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif + #elif (_IPP == _IPP_P8) || (_IPP32E == _IPP32E_Y8) + #if defined(__INTEL_COMPILER) + #include "smmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif + #elif (_IPP >= _IPP_G9) || (_IPP32E >= _IPP32E_E9) + #if defined(__INTEL_COMPILER) + #include "immintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 160021003) + #include "immintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #endif + #endif + #endif +#elif (_IPPLP32 >= _IPPLP32_S8) || (_IPPLP64 >= _IPPLP64_N8) + #if defined(__INTEL_COMPILER) + #include "tmmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif +#elif (_IPPLRB >= _IPPLRB_B2) + #if defined(__INTEL_COMPILER) || defined(_REF_LIB) + #include "immintrin.h" + #endif +#endif + +// **** intrinsics for bit casting **** +#if defined(__INTEL_COMPILER) +extern unsigned int __intel_castf32_u32(float val); +extern float __intel_castu32_f32(unsigned int val); +extern unsigned __int64 __intel_castf64_u64(double val); +extern double __intel_castu64_f64(unsigned __int64 val); + #define __CAST_32f32u(val) __intel_castf32_u32((Ipp32f)val) + #define __CAST_32u32f(val) __intel_castu32_f32((Ipp32u)val) + #define __CAST_64f64u(val) __intel_castf64_u64((Ipp64f)val) + #define __CAST_64u64f(val) __intel_castu64_f64((Ipp64u)val) +#else + #define __CAST_32f32u(val) ( *((Ipp32u*)&val) ) + #define __CAST_32u32f(val) ( *((Ipp32f*)&val) ) + #define __CAST_64f64u(val) ( *((Ipp64u*)&val) ) + #define __CAST_64u64f(val) ( *((Ipp64f*)&val) ) +#endif + + +// short names for vector registers casting +#define _pd2ps _mm_castpd_ps +#define _ps2pd _mm_castps_pd +#define _pd2pi _mm_castpd_si128 +#define _pi2pd _mm_castsi128_pd +#define _ps2pi _mm_castps_si128 +#define _pi2ps _mm_castsi128_ps + +#define _ypd2ypi _mm256_castpd_si256 +#define _ypi2ypd _mm256_castsi256_pd +#define _yps2ypi _mm256_castps_si256 +#define _ypi2yps _mm256_castsi256_ps +#define _ypd2yps _mm256_castpd_ps +#define _yps2ypd _mm256_castps_pd + +#define _yps2ps _mm256_castps256_ps128 +#define _ypi2pi _mm256_castsi256_si128 +#define _ypd2pd _mm256_castpd256_pd128 +#define _ps2yps _mm256_castps128_ps256 +#define _pi2ypi _mm256_castsi128_si256 +#define _pd2ypd _mm256_castpd128_pd256 + + +#if defined(__INTEL_COMPILER) +#define __IVDEP ivdep +#else +#define __IVDEP message("message :: 'ivdep' is not defined") +#endif +//usage: #pragma __IVDEP + +/* ////////////////////////////////////////////////////////////////////////// + _IPP_DATA shoul be defined only: + - if compile not merged library + - only for 1 CPU for merged library to avoid data duplication +*/ +#if defined( _MERGED_BLD ) && ( defined(_G9) || defined(_E9) ) /* compile data only for g9 and e9 CPU */ + #define _IPP_DATA 1 +#elif !defined( _MERGED_BLD ) /* compile data if it isn't merged library */ + #define _IPP_DATA 1 +#endif + + +#if defined( __cplusplus ) +} +#endif + +#endif /* __OWNDEFS_H__ */ + diff --git a/external/crypto_px/sources/ippcp/src/owncp.h b/external/crypto_px/sources/ippcp/src/owncp.h new file mode 100644 index 0000000000..ec0e3b7d83 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/owncp.h @@ -0,0 +1,149 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __OWNCP_H__ +#define __OWNCP_H__ + +#ifndef __OWNDEFS_H__ + #include "owndefs.h" +#endif + +#ifndef __IPPCP_H__ + #include "ippcp.h" +#endif + +#pragma warning( disable : 4324) + +/* ippCP length */ +typedef int cpSize; + +/* +// common macros & definitions +*/ + +/* size of cache line (bytes) */ +#define CACHE_LINE_SIZE (64) +#define LOG_CACHE_LINE_SIZE (6) + +/* swap data & pointers */ +#define SWAP_PTR(ATYPE, pX,pY) { ATYPE* aPtr=(pX); (pX)=(pY); (pY)=aPtr; } +#define SWAP(x,y) {(x)^=(y); (y)^=(x); (x)^=(y);} + +/* alignment value */ +#define ALIGN_VAL ((int)sizeof(void*)) + +/* bitsize */ +#define BYTESIZE (8) +#define BITSIZE(x) ((int)(sizeof(x)*BYTESIZE)) + +/* bit length -> byte/word length conversion */ +#define BITS2WORD8_SIZE(x) (((x)+ 7)>>3) +#define BITS2WORD16_SIZE(x) (((x)+15)>>4) +#define BITS2WORD32_SIZE(x) (((x)+31)>>5) +#define BITS2WORD64_SIZE(x) (((x)+63)>>6) + +/* WORD and DWORD manipulators */ +#define LODWORD(x) ((Ipp32u)(x)) +#define HIDWORD(x) ((Ipp32u)(((Ipp64u)(x) >>32) & 0xFFFFFFFF)) + +#define MAKEHWORD(bLo,bHi) ((Ipp16u)(((Ipp8u)(bLo)) | ((Ipp16u)((Ipp8u)(bHi))) << 8)) +#define MAKEWORD(hLo,hHi) ((Ipp32u)(((Ipp16u)(hLo)) | ((Ipp32u)((Ipp16u)(hHi))) << 16)) +#define MAKEDWORD(wLo,wHi) ((Ipp64u)(((Ipp32u)(wLo)) | ((Ipp64u)((Ipp32u)(wHi))) << 32)) + +/* extract byte */ +#define EBYTE(w,n) ((Ipp8u)((w) >> (8 * (n)))) + +/* hexString <-> Ipp32u conversion */ +#define HSTRING_TO_U32(ptrByte) \ + (((ptrByte)[0]) <<24) \ + +(((ptrByte)[1]) <<16) \ + +(((ptrByte)[2]) <<8) \ + +((ptrByte)[3]) +#define U32_TO_HSTRING(ptrByte, x) \ + (ptrByte)[0] = (Ipp8u)((x)>>24); \ + (ptrByte)[1] = (Ipp8u)((x)>>16); \ + (ptrByte)[2] = (Ipp8u)((x)>>8); \ + (ptrByte)[3] = (Ipp8u)(x) + +/* 32- and 64-bit masks for MSB of nbits-sequence */ +#define MAKEMASK32(nbits) (0xFFFFFFFF >>((32 - ((nbits)&0x1F)) &0x1F)) +#define MAKEMASK64(nbits) (0xFFFFFFFFFFFFFFFF >>((64 - ((nbits)&0x3F)) &0x3F)) + +/* Logical Shifts (right and left) of WORD */ +#define LSR32(x,nBits) ((x)>>(nBits)) +#define LSL32(x,nBits) ((x)<<(nBits)) + +/* Rorate (right and left) of WORD */ +#if defined(_MSC_VER) +# include +# define ROR32(x, nBits) _lrotr((x),(nBits)) +# define ROL32(x, nBits) _lrotl((x),(nBits)) +#else +# define ROR32(x, nBits) (LSR32((x),(nBits)) | LSL32((x),32-(nBits))) +# define ROL32(x, nBits) ROR32((x),(32-(nBits))) +#endif + +/* Logical Shifts (right and left) of DWORD */ +#define LSR64(x,nBits) ((x)>>(nBits)) +#define LSL64(x,nBits) ((x)<<(nBits)) + +/* Rorate (right and left) of DWORD */ +#define ROR64(x, nBits) (LSR64((x),(nBits)) | LSL64((x),64-(nBits))) +#define ROL64(x, nBits) ROR64((x),(64-(nBits))) + +/* change endian */ +#if defined(_MSC_VER) +# define ENDIANNESS(x) _byteswap_ulong((x)) +# define ENDIANNESS32(x) ENDIANNESS((x)) +# define ENDIANNESS64(x) _byteswap_uint64((x)) +#else +# define ENDIANNESS(x) ((ROR32((x), 24) & 0x00ff00ff) | (ROR32((x), 8) & 0xff00ff00)) +# define ENDIANNESS32(x) ENDIANNESS((x)) +# define ENDIANNESS64(x) MAKEDWORD(ENDIANNESS(HIDWORD((x))), ENDIANNESS(LODWORD((x)))) +#endif + +#define IPP_MAKE_MULTIPLE_OF_8(x) ((x) = ((x)+7)&(~7)) +#define IPP_MAKE_MULTIPLE_OF_16(x) ((x) = ((x)+15)&(~15)) + +/* 64-bit constant */ +#if !defined(__GNUC__) + #define CONST_64(x) (x) /*(x##i64)*/ +#else + #define CONST_64(x) (x##LL) +#endif + +/* copy under mask */ +#define MASKED_COPY_BNU(dst, mask, src1, src2, len) { \ + cpSize i; \ + for(i=0; i<(len); i++) (dst)[i] = ((mask) & (src1)[i]) | (~(mask) & (src2)[i]); \ +} + +#endif /* __OWNCP_H__ */ diff --git a/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c b/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c new file mode 100644 index 0000000000..8c4d24bc5e --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c @@ -0,0 +1,396 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpcmac.h" +#include "pcpaesm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/*F* +// Name: ippsAES_CMACGetSize +// +// Purpose: Returns size of AES-CMAC context (in bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSzie == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to the AES-CMAC size of context +// +*F*/ +static int cpSizeofCtx_AESCMAC(void) +{ + return sizeof(IppsAES_CMACState) + AESCMAC_ALIGNMENT-1; +} + +IPPFUN(IppStatus, ippsAES_CMACGetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = cpSizeofCtx_AESCMAC(); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_CMACInit +// +// Purpose: Init AES-CMAC context. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// ippStsMemAllocErr size of buffer is not match fro operation +// ippStsLengthErr keyLen != 16 +// keyLen != 24 +// keyLen != 32 +// ippStsNoErr no errors +// +// Parameters: +// pKey pointer to the secret key +// keyLen length of secret key +// pCtx pointer to the CMAC context +// ctxSize available size (in bytes) of buffer above +// +*F*/ +static +void init(IppsAES_CMACState* pCtx) +{ + /* buffer is empty */ + CMAC_INDX(pCtx) = 0; + /* zeros MAC */ + PaddBlock(0, CMAC_MAC(pCtx), MBS_RIJ128); +} + +static +void LogicalLeftSift16(const Ipp8u* pSrc, Ipp8u* pDst) +{ + Ipp32u carry = 0; + int n; + for(n=0; n<16; n++) { + Ipp32u x = pSrc[16-1-n] + pSrc[16-1-n] + carry; + pDst[16-1-n] = (Ipp8u)x; + carry = (x>>8) & 0xFF; + } +} + +IPPFUN(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pCtx, int ctxSize)) +{ + /* test pCtx pointer */ + IPP_BAD_PTR1_RET(pCtx); + + /* test available size of context buffer */ + IPP_BADARG_RET(ctxSize>7)) & 0x87); /* ^ Rb changed for constant time execution */ + + /* precompute k2 subkey */ + msb = (CMAC_K1(pCtx))[0]; + LogicalLeftSift16(CMAC_K1(pCtx),CMAC_K2(pCtx)); + (CMAC_K2(pCtx))[MBS_RIJ128-1] ^= (Ipp8u)((0-(msb>>7)) & 0x87); /* ^ Rb changed for constant time execution */ + } + + return sts; + } +} + + +/*F* +// Name: ippsAES_CMACUpdate +// +// Purpose: Updates intermadiate digest based on input stream. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pCtx == NULL +// ippStsContextMatchErr !VALID_AESCMAC_ID() +// ippStsLengthErr len <0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the input stream +// len input stream length +// pCtx pointer to the CMAC context +// +*F*/ +static +void AES_CMAC_processing(Ipp8u* pDigest, const Ipp8u* pSrc, int processedLen, const IppsAESSpec* pAES) +{ + /* setup encoder method */ + RijnCipher encoder = RIJ_ENCODER(pAES); + + while(processedLen) { + ((Ipp32u*)pDigest)[0] ^= ((Ipp32u*)pSrc)[0]; + ((Ipp32u*)pDigest)[1] ^= ((Ipp32u*)pSrc)[1]; + ((Ipp32u*)pDigest)[2] ^= ((Ipp32u*)pSrc)[2]; + ((Ipp32u*)pDigest)[3] ^= ((Ipp32u*)pSrc)[3]; + + encoder(pDigest, pDigest, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + pSrc += MBS_RIJ128; + processedLen -= MBS_RIJ128; + } +} + +IPPFUN(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx)) +{ + int processedLen; + + /* test context pointer */ + IPP_BAD_PTR1_RET(pCtx); + /* use aligned context */ + pCtx = (IppsAES_CMACState*)( IPP_ALIGNED_PTR(pCtx, AESCMAC_ALIGNMENT) ); + + /* test ID */ + IPP_BADARG_RET(!VALID_AESCMAC_ID(pCtx), ippStsContextMatchErr); + /* test input message and it's length */ + IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr); + /* test source pointer */ + IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); + + if(!len) + return ippStsNoErr; + + { + /* + // test internal buffer filling + */ + if(CMAC_INDX(pCtx)) { + /* copy from input stream to the internal buffer as match as possible */ + processedLen = IPP_MIN(len, (MBS_RIJ128 - CMAC_INDX(pCtx))); + CopyBlock(pSrc, CMAC_BUFF(pCtx)+CMAC_INDX(pCtx), processedLen); + + /* internal buffer filling */ + CMAC_INDX(pCtx) += processedLen; + + /* update message pointer and length */ + pSrc += processedLen; + len -= processedLen; + + if(!len) + return ippStsNoErr; + + /* update CMAC if buffer full but not the last */ + if(MBS_RIJ128==CMAC_INDX(pCtx) ) { + const IppsAESSpec* pAES = &CMAC_CIPHER(pCtx); + /* setup encoder method */ + RijnCipher encoder = RIJ_ENCODER(pAES); + XorBlock16(CMAC_BUFF(pCtx), CMAC_MAC(pCtx), CMAC_MAC(pCtx)); + + encoder(CMAC_MAC(pCtx), CMAC_MAC(pCtx), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + CMAC_INDX(pCtx) = 0; + } + } + + /* + // main part + */ + processedLen = len & ~(MBS_RIJ128-1); + if(!(len & (MBS_RIJ128-1))) + processedLen -= MBS_RIJ128; + if(processedLen) { + const IppsAESSpec* pAES = &CMAC_CIPHER(pCtx); + + AES_CMAC_processing(CMAC_MAC(pCtx), pSrc, processedLen, pAES); + + /* update message pointer and length */ + pSrc += processedLen; + len -= processedLen; + } + + /* + // remaind + */ + if(len) { + CopyBlock(pSrc, (Ipp8u*)(&CMAC_BUFF(pCtx)), len); + /* update internal buffer filling */ + CMAC_INDX(pCtx) += len; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_CMACFinal +// +// Purpose: Stop message digesting and return MD. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pCtx == NULL +// ippStsContextMatchErr !VALID_AESCMAC_ID() +// ippStsLengthErr MBS_RIJ128 < mdLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pMD pointer to the output message digest +// mdLen requested length of the message digest +// pCtx pointer to the CMAC context +// +*F*/ +IPPFUN(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pCtx)) +{ + /* test context pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + /* use aligned context */ + pCtx = (IppsAES_CMACState*)( IPP_ALIGNED_PTR(pCtx, AESCMAC_ALIGNMENT) ); + + IPP_BADARG_RET(!VALID_AESCMAC_ID(pCtx), ippStsContextMatchErr); + /* test DAC pointer */ + IPP_BAD_PTR1_RET(pMD); + IPP_BADARG_RET((mdLen<1)||(MBS_RIJ128idCtx) +#define AESGCM_STATE(stt) ((stt)->state) + +#define AESGCM_IV_LEN(stt) ((stt)->ivLen) +#define AESGCM_AAD_LEN(stt) ((stt)->aadLen) +#define AESGCM_TXT_LEN(stt) ((stt)->txtLen) + +#define AESGCM_BUFLEN(stt) ((stt)->bufLen) +#define AESGCM_COUNTER(stt) ((stt)->counter) +#define AESGCM_ECOUNTER0(stt) ((stt)->ecounter0) +#define AESGCM_ECOUNTER(stt) ((stt)->ecounter) +#define AESGCM_GHASH(stt) ((stt)->ghash) + +#define AESGCM_HASH(stt) ((stt)->hashFun) +#define AESGCM_AUTH(stt) ((stt)->authFun) +#define AESGCM_ENC(stt) ((stt)->encFun) +#define AESGCM_DEC(stt) ((stt)->decFun) + +#define AESGCM_CIPHER(stt) (IppsAESSpec*)(&((stt)->cipher)) + +#define AESGCM_HKEY(stt) ((stt)->multiplier) +#define AESGCM_CPWR(stt) ((stt)->multiplier) +#define AES_GCM_MTBL(stt) ((stt)->multiplier) + +#define AESGCM_VALID_ID(stt) (AESGCM_ID((stt))==idCtxAESGCM) + + +__INLINE void IncrementCounter32(Ipp8u* pCtr) +{ + int i; + for(i=BLOCK_SIZE-1; i>=CTR_POS && 0==(Ipp8u)(++pCtr[i]); i--) ; +} + + +void AesGcmPrecompute_table2K(Ipp8u* pPrecomputeData, const Ipp8u* pHKey); +void AesGcmMulGcm_table2K(Ipp8u* pGhash, const Ipp8u* pHkey, const void* pParam); +void AesGcmAuth_table2K(Ipp8u* pGhash, const Ipp8u* pSrc, int len, const Ipp8u* pHkey, const void* pParam); +void wrpAesGcmEnc_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); +void wrpAesGcmDec_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); + +extern const Ipp16u AesGcmConst_table[256]; /* precomputed reduction table */ + +#endif /* _CP_AESAUTH_GCM_H*/ diff --git a/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c b/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c new file mode 100644 index 0000000000..c48b66f302 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c @@ -0,0 +1,731 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcpaesauthgcm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/*F* +// Name: ippsAES_GCMGetSize +// +// Purpose: Returns size of AES_GCM state (in bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSize == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to size of context +// +*F*/ +static int cpSizeofCtx_AESGCM(void) +{ + int precomp_size; + + precomp_size = PRECOMP_DATA_SIZE_FAST2K; + + /* decrease precomp_size as soon as BLOCK_SIZE bytes already reserved in context */ + precomp_size -= BLOCK_SIZE; + + return sizeof(IppsAES_GCMState) + +precomp_size + +AESGCM_ALIGNMENT-1; +} + +IPPFUN(IppStatus, ippsAES_GCMGetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = cpSizeofCtx_AESGCM(); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_GCMReset +// +// Purpose: Resets AES_GCM context. +// +// Returns: Reason: +// ippStsNullPtrErr pState== NULL +// ippStsContextMatchErr pState points on invalid context +// ippStsNoErr no errors +// +// Parameters: +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test context validity */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + /* reset GCM */ + AESGCM_STATE(pState) = GcmInit; + AESGCM_IV_LEN(pState) = CONST_64(0); + AESGCM_AAD_LEN(pState) = CONST_64(0); + AESGCM_TXT_LEN(pState) = CONST_64(0); + + AESGCM_BUFLEN(pState) = 0; + PaddBlock(0, AESGCM_COUNTER(pState), BLOCK_SIZE); + PaddBlock(0, AESGCM_ECOUNTER(pState), BLOCK_SIZE); + PaddBlock(0, AESGCM_ECOUNTER0(pState), BLOCK_SIZE); + PaddBlock(0, AESGCM_GHASH(pState), BLOCK_SIZE); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_GCMInit +// +// Purpose: Init AES_GCM context for future usage. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// ippStsMemAllocErr size of buffer is not match fro operation +// ippStsLengthErr keyLen != 16 && +// != 24 && +// != 32 +// ippStsNoErr no errors +// +// Parameters: +// pKey pointer to the secret key +// keyLen length of secret key +// pState pointer to the AES-GCM context +// ctxSize available size (in bytes) of buffer above +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) +{ + /* test pCtx pointer */ + IPP_BAD_PTR1_RET(pState); + + /* test available size of context buffer */ + IPP_BADARG_RET(ctxSize0 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr ivLen <0 +// ippStsBadArgErr illegal sequence call +// ippStsNoErr no errors +// +// Parameters: +// pIV pointer to the IV +// ivLen length of IV (it could be 0) +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + + /* test IV pointer and length */ + IPP_BADARG_RET(ivLen && !pIV, ippStsNullPtrErr); + IPP_BADARG_RET(ivLen<0, ippStsLengthErr); + + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test context validity */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + IPP_BADARG_RET(!(GcmInit==AESGCM_STATE(pState) || GcmIVprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + /* switch IVprocessing on */ + AESGCM_STATE(pState) = GcmIVprocessing; + + /* test if buffer is not empty */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(ivLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + XorBlock(pIV, AESGCM_COUNTER(pState)+AESGCM_BUFLEN(pState), AESGCM_COUNTER(pState)+AESGCM_BUFLEN(pState), locLen); + AESGCM_BUFLEN(pState) += locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + MulGcm_ ghashFunc = AESGCM_HASH(pState); + ghashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + } + + AESGCM_IV_LEN(pState) += locLen; + pIV += locLen; + ivLen -= locLen; + } + + /* process main part of IV */ + { + int lenBlks = ivLen & (-BLOCK_SIZE); + if(lenBlks) { + Auth_ authFunc = AESGCM_AUTH(pState); + + authFunc(AESGCM_COUNTER(pState), pIV, lenBlks, AESGCM_HKEY(pState), AesGcmConst_table); + + AESGCM_IV_LEN(pState) += lenBlks; + pIV += lenBlks; + ivLen -= lenBlks; + } + } + + /* copy the rest of IV into the buffer */ + if(ivLen) { + XorBlock(pIV, AESGCM_COUNTER(pState), AESGCM_COUNTER(pState), ivLen); + AESGCM_IV_LEN(pState) += ivLen; + AESGCM_BUFLEN(pState) += ivLen; + } + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_GCMProcessAAD +// +// Purpose: AAD processing. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// pAAD == NULL, aadLen>0 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr aadLen <0 +// ippStsBadArgErr illegal sequence call +// ippStsNoErr no errors +// +// Parameters: +// pAAD pointer to the AAD +// aadlen length of AAD (it could be 0) +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test if context is valid */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + /* test AAD pointer and length */ + IPP_BADARG_RET(aadLen && !pAAD, ippStsNullPtrErr); + IPP_BADARG_RET(aadLen<0, ippStsLengthErr); + + IPP_BADARG_RET(!(GcmIVprocessing==AESGCM_STATE(pState) || GcmAADprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + { + /* get method */ + MulGcm_ hashFunc = AESGCM_HASH(pState); + + if( GcmIVprocessing==AESGCM_STATE(pState) ) { + IPP_BADARG_RET(0==AESGCM_IV_LEN(pState), ippStsBadArgErr); + + /* complete IV processing */ + if(CTR_POS==AESGCM_IV_LEN(pState)) { + /* apply special format if IV length is 12 bytes */ + AESGCM_COUNTER(pState)[12] = 0; + AESGCM_COUNTER(pState)[13] = 0; + AESGCM_COUNTER(pState)[14] = 0; + AESGCM_COUNTER(pState)[15] = 1; + } + else { + /* process the rest of IV */ + if(AESGCM_BUFLEN(pState)) + hashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); + + /* add IV bit length */ + { + Ipp64u ivBitLen = AESGCM_IV_LEN(pState)*BYTESIZE; + Ipp8u tmp[BLOCK_SIZE]; + PaddBlock(0, tmp, BLOCK_SIZE-8); + U32_TO_HSTRING(tmp+8, HIDWORD(ivBitLen)); + U32_TO_HSTRING(tmp+12, LODWORD(ivBitLen)); + XorBlock16(tmp, AESGCM_COUNTER(pState), AESGCM_COUNTER(pState)); + hashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); + } + } + + /* prepare initial counter */ + { + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER0(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + + /* switch mode and init counters */ + AESGCM_STATE(pState) = GcmAADprocessing; + AESGCM_AAD_LEN(pState) = CONST_64(0); + AESGCM_BUFLEN(pState) = 0; + } + + /* + // AAD processing + */ + + /* test if buffer is not empty */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(aadLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + XorBlock(pAAD, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); + AESGCM_BUFLEN(pState) += locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + } + + AESGCM_AAD_LEN(pState) += locLen; + pAAD += locLen; + aadLen -= locLen; + } + + /* process main part of AAD */ + { + int lenBlks = aadLen & (-BLOCK_SIZE); + if(lenBlks) { + Auth_ authFunc = AESGCM_AUTH(pState); + + authFunc(AESGCM_GHASH(pState), pAAD, lenBlks, AESGCM_HKEY(pState), AesGcmConst_table); + + AESGCM_AAD_LEN(pState) += lenBlks; + pAAD += lenBlks; + aadLen -= lenBlks; + } + } + + /* copy the rest of AAD into the buffer */ + if(aadLen) { + XorBlock(pAAD, AESGCM_GHASH(pState), AESGCM_GHASH(pState), aadLen); + AESGCM_AAD_LEN(pState) += aadLen; + AESGCM_BUFLEN(pState) = aadLen; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_GCMStart +// +// Purpose: Start the process of encryption or decryption and authentication tag generation. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// pIV == NULL, ivLen>0 +// pAAD == NULL, aadLen>0 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr ivLen < 0 +// aadLen < 0 +// ippStsNoErr no errors +// +// Parameters: +// pIV pointer to the IV (nonce) +// ivLen length of the IV in bytes +// pAAD pointer to the Addition Authenticated Data (header) +// aadLen length of the AAD in bytes +// pState pointer to the AES-GCM state +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, + const Ipp8u* pAAD, int aadLen, + IppsAES_GCMState* pState)) +{ + IppStatus sts = ippsAES_GCMReset(pState); + if(ippStsNoErr==sts) + sts = ippsAES_GCMProcessIV(pIV, ivLen, pState); + if(ippStsNoErr==sts) + sts = ippsAES_GCMProcessAAD(pAAD, aadLen, pState); + return sts; +} + + +/*F* +// Name: ippsAES_GCMEncrypt +// +// Purpose: Encrypts a data buffer in the GCM mode. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pDst == NULL +// pState == NULL +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr txtLen<0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc Pointer to plaintext. +// pDst Pointer to ciphertext. +// len Length of the plaintext and ciphertext in bytes +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int txtLen, + IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test state ID */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + /* test context validity */ + IPP_BADARG_RET(!(GcmAADprocessing==AESGCM_STATE(pState) || GcmTXTprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + /* test text pointers and length */ + IPP_BAD_PTR2_RET(pSrc, pDst); + IPP_BADARG_RET(txtLen<0, ippStsLengthErr); + + + { + /* get method */ + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + MulGcm_ hashFunc = AESGCM_HASH(pState); + + if( GcmAADprocessing==AESGCM_STATE(pState) ) { + /* complete AAD processing */ + if(AESGCM_BUFLEN(pState)) + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + /* switch mode and init counters */ + AESGCM_STATE(pState) = GcmTXTprocessing; + AESGCM_TXT_LEN(pState) = CONST_64(0); + AESGCM_BUFLEN(pState) = 0; + } + + /* + // process text (encrypt and authenticate) + */ + /* process partial block */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(txtLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + /* ctr encryption */ + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, locLen); + /* authentication */ + XorBlock(pDst, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); + + AESGCM_BUFLEN(pState) += locLen; + AESGCM_TXT_LEN(pState) += locLen; + pSrc += locLen; + pDst += locLen; + txtLen -= locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + /* hash buffer */ + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + } + + /* process the main part of text */ + { + int lenBlks = txtLen & (-BLOCK_SIZE); + if(lenBlks) { + Encrypt_ encFunc = AESGCM_ENC(pState); + + encFunc(pDst, pSrc, lenBlks, pState); + + AESGCM_TXT_LEN(pState) += lenBlks; + pSrc += lenBlks; + pDst += lenBlks; + txtLen -= lenBlks; + } + } + + /* process the rest of text */ + if(txtLen) { + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, txtLen); + XorBlock(pDst, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), txtLen); + + AESGCM_BUFLEN(pState) += txtLen; + AESGCM_TXT_LEN(pState) += txtLen; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_GCMDecrypt +// +// Purpose: Decrypts a data buffer in the GCM mode. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pDst == NULL +// pState == NULL +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr txtLen<0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc Pointer to ciphertext. +// pDst Pointer to plaintext. +// len Length of the plaintext and ciphertext in bytes +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int txtLen, IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test state ID */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + /* test context validity */ + IPP_BADARG_RET(!(GcmAADprocessing==AESGCM_STATE(pState) || GcmTXTprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + /* test text pointers and length */ + IPP_BAD_PTR2_RET(pSrc, pDst); + IPP_BADARG_RET(txtLen<0, ippStsLengthErr); + + + { + /* get method */ + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + MulGcm_ hashFunc = AESGCM_HASH(pState); + + if( GcmAADprocessing==AESGCM_STATE(pState) ) { + /* complete AAD processing */ + if(AESGCM_BUFLEN(pState)) + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + /* switch mode and init counters */ + AESGCM_BUFLEN(pState) = 0; + AESGCM_TXT_LEN(pState) = CONST_64(0); + AESGCM_STATE(pState) = GcmTXTprocessing; + } + + /* + // process text (authenticate and decrypt ) + */ + /* process partial block */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(txtLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + /* authentication */ + XorBlock(pSrc, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); + /* ctr decryption */ + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, locLen); + + AESGCM_BUFLEN(pState) += locLen; + AESGCM_TXT_LEN(pState) += locLen; + pSrc += locLen; + pDst += locLen; + txtLen -= locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + /* hash buffer */ + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + } + + /* process the main part of text */ + { + int lenBlks = txtLen & (-BLOCK_SIZE); + if(lenBlks) { + Decrypt_ decFunc = AESGCM_DEC(pState); + + decFunc(pDst, pSrc, lenBlks, pState); + + AESGCM_TXT_LEN(pState) += lenBlks; + pSrc += lenBlks; + pDst += lenBlks; + txtLen -= lenBlks; + } + } + + /* process the rest of text */ + if(txtLen) { + /* ctr encryption */ + XorBlock(pSrc, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), txtLen); + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, txtLen); + + AESGCM_BUFLEN(pState) += txtLen; + AESGCM_TXT_LEN(pState) += txtLen; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_GCMGetTag +// +// Purpose: Generates authentication tag in the GCM mode. +// +// Returns: Reason: +// ippStsNullPtrErr pDstTag == NULL +// pState == NULL +// ippStsLengthErr tagLen<=0 || tagLen>16 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsNoErr no errors +// +// Parameters: +// pDstTag pointer to the authentication tag. +// tagLen length of the authentication tag *pDstTag in bytes +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_GCMState* pState)) +{ + /* test State pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test state ID */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + /* test tag pointer and length */ + IPP_BAD_PTR1_RET(pTag); + IPP_BADARG_RET(tagLen<=0 || tagLen>BLOCK_SIZE, ippStsLengthErr); + + + { + /* get method */ + MulGcm_ hashFunc = AESGCM_HASH(pState); + + __ALIGN16 Ipp8u tmpHash[BLOCK_SIZE]; + Ipp8u tmpCntr[BLOCK_SIZE]; + + /* local copy of AAD and text counters (in bits) */ + Ipp64u aadBitLen = AESGCM_AAD_LEN(pState)*BYTESIZE; + Ipp64u txtBitLen = AESGCM_TXT_LEN(pState)*BYTESIZE; + + /* do local copy of ghash */ + CopyBlock16(AESGCM_GHASH(pState), tmpHash); + + /* complete text processing */ + if(AESGCM_BUFLEN(pState)) { + hashFunc(tmpHash, AESGCM_HKEY(pState), AesGcmConst_table); + } + + /* process lengths of AAD and text */ + U32_TO_HSTRING(tmpCntr, HIDWORD(aadBitLen)); + U32_TO_HSTRING(tmpCntr+4, LODWORD(aadBitLen)); + U32_TO_HSTRING(tmpCntr+8, HIDWORD(txtBitLen)); + U32_TO_HSTRING(tmpCntr+12,LODWORD(txtBitLen)); + + XorBlock16(tmpHash, tmpCntr, tmpHash); + hashFunc(tmpHash, AESGCM_HKEY(pState), AesGcmConst_table); + + /* add encrypted initial counter */ + XorBlock16(tmpHash, AESGCM_ECOUNTER0(pState), tmpHash); + + /* return tag of required lenth */ + CopyBlock(tmpHash, pTag, tagLen); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c b/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c new file mode 100644 index 0000000000..7675de46ea --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c @@ -0,0 +1,52 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +const Ipp16u AesGcmConst_table[256] = { +0x0000, 0xc201, 0x8403, 0x4602, 0x0807, 0xca06, 0x8c04, 0x4e05, 0x100e, 0xd20f, 0x940d, 0x560c, 0x1809, 0xda08, 0x9c0a, 0x5e0b, +0x201c, 0xe21d, 0xa41f, 0x661e, 0x281b, 0xea1a, 0xac18, 0x6e19, 0x3012, 0xf213, 0xb411, 0x7610, 0x3815, 0xfa14, 0xbc16, 0x7e17, +0x4038, 0x8239, 0xc43b, 0x063a, 0x483f, 0x8a3e, 0xcc3c, 0x0e3d, 0x5036, 0x9237, 0xd435, 0x1634, 0x5831, 0x9a30, 0xdc32, 0x1e33, +0x6024, 0xa225, 0xe427, 0x2626, 0x6823, 0xaa22, 0xec20, 0x2e21, 0x702a, 0xb22b, 0xf429, 0x3628, 0x782d, 0xba2c, 0xfc2e, 0x3e2f, +0x8070, 0x4271, 0x0473, 0xc672, 0x8877, 0x4a76, 0x0c74, 0xce75, 0x907e, 0x527f, 0x147d, 0xd67c, 0x9879, 0x5a78, 0x1c7a, 0xde7b, +0xa06c, 0x626d, 0x246f, 0xe66e, 0xa86b, 0x6a6a, 0x2c68, 0xee69, 0xb062, 0x7263, 0x3461, 0xf660, 0xb865, 0x7a64, 0x3c66, 0xfe67, +0xc048, 0x0249, 0x444b, 0x864a, 0xc84f, 0x0a4e, 0x4c4c, 0x8e4d, 0xd046, 0x1247, 0x5445, 0x9644, 0xd841, 0x1a40, 0x5c42, 0x9e43, +0xe054, 0x2255, 0x6457, 0xa656, 0xe853, 0x2a52, 0x6c50, 0xae51, 0xf05a, 0x325b, 0x7459, 0xb658, 0xf85d, 0x3a5c, 0x7c5e, 0xbe5f, +0x00e1, 0xc2e0, 0x84e2, 0x46e3, 0x08e6, 0xcae7, 0x8ce5, 0x4ee4, 0x10ef, 0xd2ee, 0x94ec, 0x56ed, 0x18e8, 0xdae9, 0x9ceb, 0x5eea, +0x20fd, 0xe2fc, 0xa4fe, 0x66ff, 0x28fa, 0xeafb, 0xacf9, 0x6ef8, 0x30f3, 0xf2f2, 0xb4f0, 0x76f1, 0x38f4, 0xfaf5, 0xbcf7, 0x7ef6, +0x40d9, 0x82d8, 0xc4da, 0x06db, 0x48de, 0x8adf, 0xccdd, 0x0edc, 0x50d7, 0x92d6, 0xd4d4, 0x16d5, 0x58d0, 0x9ad1, 0xdcd3, 0x1ed2, +0x60c5, 0xa2c4, 0xe4c6, 0x26c7, 0x68c2, 0xaac3, 0xecc1, 0x2ec0, 0x70cb, 0xb2ca, 0xf4c8, 0x36c9, 0x78cc, 0xbacd, 0xfccf, 0x3ece, +0x8091, 0x4290, 0x0492, 0xc693, 0x8896, 0x4a97, 0x0c95, 0xce94, 0x909f, 0x529e, 0x149c, 0xd69d, 0x9898, 0x5a99, 0x1c9b, 0xde9a, +0xa08d, 0x628c, 0x248e, 0xe68f, 0xa88a, 0x6a8b, 0x2c89, 0xee88, 0xb083, 0x7282, 0x3480, 0xf681, 0xb884, 0x7a85, 0x3c87, 0xfe86, +0xc0a9, 0x02a8, 0x44aa, 0x86ab, 0xc8ae, 0x0aaf, 0x4cad, 0x8eac, 0xd0a7, 0x12a6, 0x54a4, 0x96a5, 0xd8a0, 0x1aa1, 0x5ca3, 0x9ea2, +0xe0b5, 0x22b4, 0x64b6, 0xa6b7, 0xe8b2, 0x2ab3, 0x6cb1, 0xaeb0, 0xf0bb, 0x32ba, 0x74b8, 0xb6b9, 0xf8bc, 0x3abd, 0x7cbf, 0xbebe +}; diff --git a/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c b/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c new file mode 100644 index 0000000000..b2d9d32322 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c @@ -0,0 +1,229 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcpaesauthgcm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + + +/* +// AES-GCM precomputations. +*/ +static void RightShiftBlock16(Ipp8u* pBlock) +{ + Ipp8u v0 = 0; + int i; + for(i=0; i<16; i++) { + Ipp8u v1 = pBlock[i]; + Ipp8u tmp = (Ipp8u)( (v1>>1) | (v0<<7) ); + pBlock[i] = tmp; + v0 = v1; + } +} +void AesGcmPrecompute_table2K(Ipp8u* pPrecomputeData, const Ipp8u* pHKey) +{ + Ipp8u t[BLOCK_SIZE]; + int n; + + CopyBlock16(pHKey, t); + + for(n=0; n<128-24; n++) { + /* get msb */ + int hBit = t[15]&1; + + int k = n%32; + if(k<4) { + CopyBlock16(t, pPrecomputeData +1024 +(n/32)*256 +(Ipp32u)(1<<(7-k))); + } + else if(k<8) { + CopyBlock16(t, pPrecomputeData +(n/32)*256 +(Ipp32u)(1<<(11-k))); + } + + /* shift */ + RightShiftBlock16(t); + /* xor if msb=1 */ + if(hBit) + t[0] ^= 0xe1; + } + + for(n=0; n<4; n++) { + int m, k; + XorBlock16(pPrecomputeData +n*256, pPrecomputeData +n*256, pPrecomputeData +n*256); + XorBlock16(pPrecomputeData +1024 +n*256, pPrecomputeData +1024 +n*256, pPrecomputeData +1024 +n*256); + for(m=2; m<=8; m*=2) + for(k=1; k=BLOCK_SIZE) { + /* add src */ + XorBlock16(pSrc, pHash, pHash); + /* hash it */ + AesGcmMulGcm_table2K(pHash, pHKey, AesGcmConst_table); + + pSrc += BLOCK_SIZE; + len -= BLOCK_SIZE; + } +} + + +/* +// encrypts and authenticates n*BLOCK_SIZE bytes +*/ +void wrpAesGcmEnc_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pState) +{ + Ipp8u* pHashedData = pDst; + int hashedDataLen = len; + + Ipp8u* pCounter = AESGCM_COUNTER(pState); + Ipp8u* pECounter = AESGCM_ECOUNTER(pState); + + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + + while(len>=BLOCK_SIZE) { + /* encrypt whole AES block */ + XorBlock16(pSrc, pECounter, pDst); + + pSrc += BLOCK_SIZE; + pDst += BLOCK_SIZE; + len -= BLOCK_SIZE; + + /* increment counter block */ + IncrementCounter32(pCounter); + /* and encrypt counter */ + encoder(pCounter, pECounter, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + + AesGcmAuth_table2K(AESGCM_GHASH(pState), pHashedData, hashedDataLen, AESGCM_HKEY(pState), AesGcmConst_table); +} + + +/* +// authenticates and decrypts n*BLOCK_SIZE bytes +*/ +void wrpAesGcmDec_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pState) +{ + AesGcmAuth_table2K(AESGCM_GHASH(pState), pSrc, len, AESGCM_HKEY(pState), AesGcmConst_table); + + { + Ipp8u* pCounter = AESGCM_COUNTER(pState); + Ipp8u* pECounter = AESGCM_ECOUNTER(pState); + + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + + while(len>=BLOCK_SIZE) { + /* encrypt whole AES block */ + XorBlock16(pSrc, pECounter, pDst); + + pSrc += BLOCK_SIZE; + pDst += BLOCK_SIZE; + len -= BLOCK_SIZE; + + /* increment counter block */ + IncrementCounter32(pCounter); + /* and encrypt counter */ + encoder(pCounter, pECounter, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpaesm.h b/external/crypto_px/sources/ippcp/src/pcpaesm.h new file mode 100644 index 0000000000..dacfe258ea --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesm.h @@ -0,0 +1,50 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_AES_H) +#define _PCP_AES_H + +#include "pcprij.h" + +/* alignment of AES context */ +#define AES_ALIGNMENT (RIJ_ALIGNMENT) + +/* valid AES context ID */ +#define VALID_AES_ID(ctx) (RIJ_ID((ctx))==idCtxRijndael) + +/* size of AES context */ +__INLINE int cpSizeofCtx_AES(void) +{ + return sizeof(IppsAESSpec) + +(AES_ALIGNMENT-1); +} + +#endif /* _PCP_AES_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c b/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c new file mode 100644 index 0000000000..1a7f65487d --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c @@ -0,0 +1,150 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#include "owncp.h" +#include "pcpaesm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/* +// AES-CRT processing. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// pSrc == NULL +// pDst == NULL +// pCtrValue ==NULL +// ippStsContextMatchErr !VALID_AES_ID() +// ippStsLengthErr len <1 +// ippStsCTRSizeErr 128 < ctrNumBitSize < 1 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the source data buffer +// pDst pointer to the target data buffer +// dataLen input/output buffer length (in bytes) +// pCtx pointer to rge AES context +// pCtrValue pointer to the counter block +// ctrNumBitSize counter block size (bits) +// +// Note: +// counter will updated on return +// +*/ +static +IppStatus cpProcessAES_ctr(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize) +{ + /* test context */ + IPP_BAD_PTR1_RET(pCtx); + /* use aligned AES context */ + pCtx = (IppsAESSpec*)( IPP_ALIGNED_PTR(pCtx, AES_ALIGNMENT) ); + /* test the context ID */ + IPP_BADARG_RET(!VALID_AES_ID(pCtx), ippStsContextMatchErr); + + /* test source, target and counter block pointers */ + IPP_BAD_PTR3_RET(pSrc, pDst, pCtrValue); + /* test stream length */ + IPP_BADARG_RET((dataLen<1), ippStsLengthErr); + + /* test counter block size */ + IPP_BADARG_RET(((MBS_RIJ128*8)= MBS_RIJ128) { + /* encrypt counter block */ + encoder((Ipp8u*)counter, (Ipp8u*)output, RIJ_NR(pCtx), RIJ_EKEYS(pCtx), RijEncSbox); + + /* compute ciphertext block */ + if( !(IPP_UINT_PTR(pSrc) & 0x3) && !(IPP_UINT_PTR(pDst) & 0x3)) { + ((Ipp32u*)pDst)[0] = output[0]^((Ipp32u*)pSrc)[0]; + ((Ipp32u*)pDst)[1] = output[1]^((Ipp32u*)pSrc)[1]; + ((Ipp32u*)pDst)[2] = output[2]^((Ipp32u*)pSrc)[2]; + ((Ipp32u*)pDst)[3] = output[3]^((Ipp32u*)pSrc)[3]; + } + else + XorBlock16(pSrc, output, pDst); + /* encrement counter block */ + StdIncrement((Ipp8u*)counter,MBS_RIJ128*8, ctrNumBitSize); + + pSrc += MBS_RIJ128; + pDst += MBS_RIJ128; + dataLen -= MBS_RIJ128; + } + /* + // encrypt last data block + */ + if(dataLen) { + /* encrypt counter block */ + encoder((Ipp8u*)counter, (Ipp8u*)output, RIJ_NR(pCtx), RIJ_EKEYS(pCtx), RijEncSbox); + + /* compute ciphertext block */ + XorBlock(pSrc, output, pDst,dataLen); + /* encrement counter block */ + StdIncrement((Ipp8u*)counter,MBS_RIJ128*8, ctrNumBitSize); + } + + /* update counter */ + CopyBlock16(counter, pCtrValue); + + return ippStsNoErr; + } +} + +IPPFUN(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) +{ + return cpProcessAES_ctr(pSrc, pDst, dataLen, pCtx, pCtrValue, ctrNumBitSize); +} + +IPPFUN(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) +{ + return cpProcessAES_ctr(pSrc, pDst, dataLen, pCtx, pCtrValue, ctrNumBitSize); +} diff --git a/external/crypto_px/sources/ippcp/src/pcpaesminitca.c b/external/crypto_px/sources/ippcp/src/pcpaesminitca.c new file mode 100644 index 0000000000..ce273cdeec --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpaesminitca.c @@ -0,0 +1,173 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpaesm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/*F* +// Name: ippsAESGetSize +// +// Purpose: Returns size of AES context (in bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSzie == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to AES size of context(in bytes) +// +*F*/ +IPPFUN(IppStatus, ippsAESGetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = cpSizeofCtx_AES(); + + return ippStsNoErr; +} + +/* number of rounds (use [NK] for access) */ +static int rij128nRounds[3] = {NR128_128, NR128_192, NR128_256}; + +/* +// number of keys (estimation only!) (use [NK] for access) +// +// accurate number of keys necassary for encrypt/decrypt are: +// nKeys = NB * (NR+1) +// where NB - data block size (32-bit words) +// NR - number of rounds (depend on NB and keyLen) +// +// but the estimation +// estnKeys = (NK*n) >= nKeys +// or +// estnKeys = ( (NB*(NR+1) + (NK-1)) / NK) * NK +// where NK - key length (words) +// NB - data block size (word) +// NR - number of rounds (depend on NB and keyLen) +// nKeys - accurate numner of keys +// is more convinient when calculates key extension +*/ +static int rij128nKeys[3] = {44, 54, 64 }; + +/* +// helper for nRounds[] and estnKeys[] access +// note: x is length in 32-bits words +*/ +__INLINE int rij_index(int x) +{ return (x-NB(128))>>1; } + +/*F* +// Name: ippsAESInit +// +// Purpose: Init AES context for future usage +// and setup secret key. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// ippStsMemAllocErr size of buffer is not match fro operation +// ippStsLengthErr keyLen != 16 +// keyLen != 24 +// keyLen != 32 +// +// Parameters: +// pKey secret key +// keyLen length of the secret key (in bytes) +// pCtx pointer to buffer initialized as AES context +// ctxSize available size (in bytes) of buffer above +// +// Note: +// if pKey==NULL, then AES initialized by zero value key +// +*F*/ +IPPFUN(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, + IppsAESSpec* pCtxRaw, int rawCtxSize)) +{ + /* test context pointer */ + IPP_BAD_PTR1_RET(pCtxRaw); + + /* make sure in legal keyLen */ + IPP_BADARG_RET(keyLen!=16 && keyLen!=24 && keyLen!=32, ippStsLengthErr); + + { + /* use aligned Rijndael context */ + IppsAESSpec* pCtx = (IppsAESSpec*)( IPP_ALIGNED_PTR(pCtxRaw, AES_ALIGNMENT) ); + + /* test available size of context buffer */ + if(((Ipp8u*)pCtx+sizeof(IppsAESSpec)) > ((Ipp8u*)pCtxRaw+rawCtxSize)) + IPP_ERROR_RET(ippStsMemAllocErr); + + else { + int keyWords = NK(keyLen*BITSIZE(Ipp8u)); + int nExpKeys = rij128nKeys [ rij_index(keyWords) ]; + int nRounds = rij128nRounds[ rij_index(keyWords) ]; + + Ipp8u zeroKey[32] = {0}; + const Ipp8u* pActualKey = pKey? pKey : zeroKey; + + /* clear context */ + PaddBlock(0, pCtx, sizeof(IppsAESSpec)); + + /* init spec */ + RIJ_ID(pCtx) = idCtxRijndael; + RIJ_NB(pCtx) = NB(128); + RIJ_NK(pCtx) = keyWords; + RIJ_NR(pCtx) = nRounds; + RIJ_SAFE_INIT(pCtx) = 1; + + /* set key expansion */ + ExpandRijndaelKey(pActualKey, keyWords, NB(128), nRounds, nExpKeys, + RIJ_EKEYS(pCtx), + RIJ_DKEYS(pCtx)); + { + int nr; + Ipp8u* pEnc_key = (Ipp8u*)(RIJ_EKEYS(pCtx)); + /* update key material: transpose inplace */ + for(nr=0; nr<(1+nRounds); nr++, pEnc_key+=16) { + SWAP(pEnc_key[ 1], pEnc_key[ 4]); + SWAP(pEnc_key[ 2], pEnc_key[ 8]); + SWAP(pEnc_key[ 3], pEnc_key[12]); + SWAP(pEnc_key[ 6], pEnc_key[ 9]); + SWAP(pEnc_key[ 7], pEnc_key[13]); + SWAP(pEnc_key[11], pEnc_key[14]); + } + } + RIJ_ENCODER(pCtx) = Safe2Encrypt_RIJ128; /* safe encoder (compact Sbox)) */ + RIJ_DECODER(pCtx) = Safe2Decrypt_RIJ128; /* safe decoder (compact Sbox)) */ + + return ippStsNoErr; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbn.h b/external/crypto_px/sources/ippcp/src/pcpbn.h new file mode 100644 index 0000000000..a6fd9a0b14 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbn.h @@ -0,0 +1,210 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BN_H) +#define _CP_BN_H + +#include "pcpbnuimpl.h" +#include "pcpbnuarith.h" +#include "pcpbnumisc.h" +#include "pcpbnu32arith.h" +#include "pcpbnu32misc.h" + +/* +// Big Number context +*/ +struct _cpBigNum +{ + IppCtxId idCtx; /* BigNum ctx id */ + IppsBigNumSGN sgn; /* sign */ + cpSize size; /* BigNum size (BNU_CHUNK_T) */ + cpSize room; /* BigNum max size (BNU_CHUNK_T) */ + BNU_CHUNK_T* number; /* BigNum value */ + BNU_CHUNK_T* buffer; /* temporary buffer */ +}; + +/* BN accessory macros */ +#define BN_ID(pBN) ((pBN)->idCtx) +#define BN_SIGN(pBN) ((pBN)->sgn) +#define BN_POSITIVE(pBN) (BN_SIGN(pBN)==ippBigNumPOS) +#define BN_NEGATIVE(pBN) (BN_SIGN(pBN)==ippBigNumNEG) +#define BN_NUMBER(pBN) ((pBN)->number) +#define BN_BUFFER(pBN) ((pBN)->buffer) +#define BN_ROOM(pBN) ((pBN)->room) +#define BN_SIZE(pBN) ((pBN)->size) +#define BN_SIZE32(pBN) ((pBN)->size*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))) +//#define BN_SIZE32(pBN) (BITS2WORD32_SIZE( BITSIZE_BNU(BN_NUMBER((pBN)),BN_SIZE((pBN))))) + +#define BN_VALID_ID(pBN) (BN_ID((pBN))==idCtxBigNum) + +#define INVERSE_SIGN(s) (((s)==ippBigNumPOS)? ippBigNumNEG : ippBigNumPOS) + +#define BN_ALIGNMENT ((int)sizeof(void*)) + + +/* pack-unpack context */ +void cpPackBigNumCtx(const IppsBigNumState* pBN, Ipp8u* pBuffer); +void cpUnpackBigNumCtx(const Ipp8u* pBuffer, IppsBigNumState* pBN); + +/* copy BN */ +__INLINE IppsBigNumState* cpBN_copy(IppsBigNumState* pDst, const IppsBigNumState* pSrc) +{ + BN_SIGN(pDst) = BN_SIGN(pSrc); + BN_SIZE(pDst) = BN_SIZE(pSrc); + ZEXPAND_COPY_BNU(BN_NUMBER(pDst), BN_ROOM(pDst), BN_NUMBER(pSrc), BN_SIZE(pSrc)); + return pDst; +} +/* set BN to zero */ +__INLINE IppsBigNumState* cpBN_zero(IppsBigNumState* pBN) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + ZEXPAND_BNU(BN_NUMBER(pBN),0, (int)BN_ROOM(pBN)); + return pBN; +} +/* fixup BN */ +__INLINE IppsBigNumState* cpBN_fix(IppsBigNumState* pBN) +{ + cpSize len = BN_SIZE(pBN); + FIX_BNU(BN_NUMBER(pBN), len); + BN_SIZE(pBN) = len; + return pBN; +} +/* set BN to chunk */ +__INLINE IppsBigNumState* cpBN_chunk(IppsBigNumState* pBN, BNU_CHUNK_T a) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + ZEXPAND_BNU(BN_NUMBER(pBN),0, (int)BN_ROOM(pBN)); + BN_NUMBER(pBN)[0] = a; + return pBN; +} +/* set BN to 2^m */ +__INLINE IppsBigNumState* cpBN_power2(IppsBigNumState* pBN, int power) +{ + cpSize size = BITS_BNU_CHUNK(power+1); + if(BN_ROOM(pBN) >= size) { + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = size; + ZEXPAND_BNU(BN_NUMBER(pBN),0, BN_ROOM(pBN)); + SET_BIT(BN_NUMBER(pBN), power); + return pBN; + } + else return NULL; +} + +/* bitsize of BN */ +__INLINE int cpBN_bitsize(const IppsBigNumState* pA) +{ + int bitsize = BITSIZE_BNU(BN_NUMBER(pA), BN_SIZE(pA)); + return bitsize; +} + +/* returns -1/0/+1 depemding on A~B comparison */ +__INLINE int cpBN_cmp(const IppsBigNumState* pA, const IppsBigNumState* pB) +{ + IppsBigNumSGN signA = BN_SIGN(pA); + IppsBigNumSGN signB = BN_SIGN(pB); + + if(signA==signB) { + int result = cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pB), BN_SIZE(pB)); + return (ippBigNumPOS==signA)? result : -result; + } + return (ippBigNumPOS==signA)? 1 : -1; +} + +/* returns -1/0/+1 depemding on A comparison 00 */ +__INLINE int cpBN_tst(const IppsBigNumState* pA) +{ + if(1==BN_SIZE(pA) && 0==BN_NUMBER(pA)[0]) + return 0; + else + return BN_POSITIVE(pA)? 1 : -1; +} + + +// some addtition functions +__INLINE int IsZero_BN(const IppsBigNumState* pA) +{ + return ( BN_SIZE(pA)==1 ) && ( BN_NUMBER(pA)[0]==0 ); +} +__INLINE int IsOdd_BN(const IppsBigNumState* pA) +{ + return BN_NUMBER(pA)[0] & 1; +} + +__INLINE IppsBigNumState* BN_Word(IppsBigNumState* pBN, BNU_CHUNK_T w) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + ZEXPAND_BNU(BN_NUMBER(pBN),0, BN_ROOM(pBN)); + BN_NUMBER(pBN)[0] = w; + return pBN; +} +__INLINE IppsBigNumState* BN_Set(const BNU_CHUNK_T* pData, cpSize len, IppsBigNumState* pBN) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = len; + ZEXPAND_COPY_BNU(BN_NUMBER(pBN), BN_ROOM(pBN), pData, len); + return pBN; +} +__INLINE IppsBigNumState* BN_Make(BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer, cpSize len, IppsBigNumState* pBN) +{ + BN_ID(pBN) = idCtxBigNum; + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + BN_ROOM(pBN) = len; + BN_NUMBER(pBN) = pData; + BN_BUFFER(pBN) = pBuffer; + return pBN; +} + + + +/* +// fixed single chunk BN +*/ +typedef struct _ippcpBigNumChunk { + IppsBigNumState bn; + BNU_CHUNK_T value; + BNU_CHUNK_T temporary; +} IppsBigNumStateChunk; + +/* reference to BN(1) and BN(2) */ +IppsBigNumState* cpBN_OneRef(void); +IppsBigNumState* cpBN_TwoRef(void); +IppsBigNumState* cpBN_ThreeRef(void); + +#define BN_ONE_REF() cpBN_OneRef() +#define BN_TWO_REF() cpBN_TwoRef() +#define BN_THREE_REF() cpBN_ThreeRef() + +#endif /* _CP_BN_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnca.c b/external/crypto_px/sources/ippcp/src/pcpbnca.c new file mode 100644 index 0000000000..c2a276796b --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnca.c @@ -0,0 +1,1058 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcptool.h" + +/* BN(1) and reference */ +static IppsBigNumStateChunk cpChunk_BN1 = { + { + idCtxBigNum, + ippBigNumPOS, + 1,1, + &cpChunk_BN1.value,&cpChunk_BN1.temporary + }, + 1,0 +}; +IppsBigNumState* cpBN_OneRef(void) +{ return &cpChunk_BN1.bn; }; + +/* BN(2) and reference */ +static IppsBigNumStateChunk cpChunk_BN2 = { + { + idCtxBigNum, + ippBigNumPOS, + 1,1, + &cpChunk_BN2.value,&cpChunk_BN2.temporary + }, + 2,0 +}; +IppsBigNumState* cpBN_TwoRef(void) +{ return &cpChunk_BN2.bn; }; + +/* BN(3) and reference */ +static IppsBigNumStateChunk cpChunk_BN3 = { + { + idCtxBigNum, + ippBigNumPOS, + 1,1, + &cpChunk_BN3.value,&cpChunk_BN3.temporary + }, + 3,0 +}; +IppsBigNumState* cpBN_ThreeRef(void) +{ return &cpChunk_BN3.bn; }; + + + +/*F* +// Name: ippsBigNumGetSize +// +// Purpose: Returns size of BigNum ctx (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pCtxSize == NULL +// ippStsLengthErr len32 < 1 +// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// pCtxSize pointer BigNum ctx size +// +*F*/ +IPPFUN(IppStatus, ippsBigNumGetSize, (cpSize len32, cpSize *pCtxSize)) +{ + IPP_BAD_PTR1_RET(pCtxSize); + IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + + { + /* convert length to the number of BNU_CHUNK_T */ + cpSize len = INTERNAL_BNU_LENGTH(len32); + + /* reserve one BNU_CHUNK_T more for cpDiv_BNU, + mul, mont exp operations */ + len++; + + *pCtxSize = sizeof(IppsBigNumState) + + len*sizeof(BNU_CHUNK_T) + + len*sizeof(BNU_CHUNK_T) + + BN_ALIGNMENT-1; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsBigNumInit +// +// Purpose: Init BigNum spec for future usage. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// ippStsLengthErr len32<1 +// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// len32 max BN length (32-bits segments) +// pBN BigNum ctx +// +*F*/ +IPPFUN(IppStatus, ippsBigNumInit, (cpSize len32, IppsBigNumState* pBN)) +{ + IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + IPP_BAD_PTR1_RET(pBN); + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + + { + Ipp8u* ptr = (Ipp8u*)pBN; + + /* convert length to the number of BNU_CHUNK_T */ + cpSize len = INTERNAL_BNU_LENGTH(len32); + + BN_ID(pBN) = idCtxUnknown; + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; /* initial valie is zero */ + BN_ROOM(pBN) = len; /* close to what has been passed by user */ + + /* reserve one BNU_CHUNK_T more for cpDiv_BNU, + mul, mont exp operations */ + len++; + + /* allocate buffers */ + BN_NUMBER(pBN) = (BNU_CHUNK_T*)(ptr += sizeof(IppsBigNumState)); + BN_BUFFER(pBN) = (BNU_CHUNK_T*)(ptr += len*sizeof(BNU_CHUNK_T)); /* use expanded length here */ + + /* set BN value and buffer to zero */ + ZEXPAND_BNU(BN_NUMBER(pBN), 0, len); + ZEXPAND_BNU(BN_BUFFER(pBN), 0, len); + + BN_ID(pBN) = idCtxBigNum; + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsCmpZero_BN +// +// Purpose: Test BigNum value. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// pResult == NULL +// ippStsContextMatchErr BN_VALID_ID() +// ippStsNoErr no errors +// +// Parameters: +// pBN BigNum ctx +// pResult result of comparison +// +*F*/ +IPPFUN(IppStatus, ippsCmpZero_BN, (const IppsBigNumState* pBN, Ipp32u* pResult)) +{ + IPP_BAD_PTR2_RET(pBN, pResult); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + if(BN_SIZE(pBN)==1 && BN_NUMBER(pBN)[0]==0) + *pResult = IS_ZERO; + else if (BN_SIGN(pBN)==ippBigNumPOS) + *pResult = GREATER_THAN_ZERO; + else if (BN_SIGN(pBN)==ippBigNumNEG) + *pResult = LESS_THAN_ZERO; + + return ippStsNoErr; +} + + +/*F* +// Name: ippsCmp_BN +// +// Purpose: Compare two BigNums. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pResult == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// ippStsNoErr no errors +// +// Parameters: +// pA BigNum ctx +// pB BigNum ctx +// pResult result of comparison +// +*F*/ +IPPFUN(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u *pResult)) +{ + IPP_BAD_PTR3_RET(pA, pB, pResult); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + + { + int res; + if(BN_SIGN(pA)==BN_SIGN(pB)) { + res = cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pB), BN_SIZE(pB)); + if(ippBigNumNEG==BN_SIGN(pA)) + res = -res; + } + else + res = (ippBigNumPOS==BN_SIGN(pA))? 1 :-1; + + *pResult = (1==res)? IPP_IS_GT : (-1==res)? IPP_IS_LT : IPP_IS_EQ; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsSet_BN +// +// Purpose: Set BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// pData == NULL +// ippStsContextMatchErr BN_VALID_ID(pBN) +// ippStsLengthErr len32 < 1 +// ippStsOutOfRangeErr len32 > BN_ROOM() +// ippStsNoErr no errors +// +// Parameters: +// sgn sign +// len32 data size (in Ipp32u chunks) +// pData source data pointer +// pBn BigNum ctx +// +*F*/ +IPPFUN(IppStatus, ippsSet_BN, (IppsBigNumSGN sgn, cpSize len32, const Ipp32u* pData, + IppsBigNumState* pBN)) +{ + IPP_BAD_PTR2_RET(pData, pBN); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + IPP_BADARG_RET(len32<1, ippStsLengthErr); + + /* compute real size */ + FIX_BNU(pData, len32); + + { + cpSize len = INTERNAL_BNU_LENGTH(len32); + IPP_BADARG_RET(len > BN_ROOM(pBN), ippStsOutOfRangeErr); + + ZEXPAND_COPY_BNU((Ipp32u*)BN_NUMBER(pBN), BN_ROOM(pBN)*(int)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), pData, len32); + + BN_SIZE(pBN) = len; + + if(len32==1 && pData[0] == 0) + sgn = ippBigNumPOS; /* consider zero value as positive */ + BN_SIGN(pBN) = sgn; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRef_BN +// +// Purpose: Get BigNum info. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// ippStsContextMatchErr BN_VALID_ID(pBN) +// ippStsNoErr no errors +// +// Parameters: +// pSgn pointer to the sign +// pBitSize pointer to the data size (in bits) +// ppData pointer to the data buffer +// pBN BigNum ctx +// +*F*/ +IPPFUN(IppStatus, ippsRef_BN, (IppsBigNumSGN* pSgn, cpSize* pBitSize, Ipp32u** const ppData, + const IppsBigNumState *pBN)) +{ + IPP_BAD_PTR1_RET(pBN); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + if(pSgn) + *pSgn = BN_SIGN(pBN); + if(pBitSize) { + cpSize bitLen = BITSIZE_BNU(BN_NUMBER(pBN), BN_SIZE(pBN)); + *pBitSize = bitLen? bitLen : 1; + } + + if(ppData) + *ppData = (Ipp32u*)BN_NUMBER(pBN); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAdd_BN +// +// Purpose: Add BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pR resultant BigNum +// +*F*/ +IPPFUN(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +{ + IPP_BAD_PTR3_RET(pA, pB, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + { + cpSize nsA = BN_SIZE(pA); + cpSize nsB = BN_SIZE(pB); + cpSize nsR = BN_ROOM(pR); + IPP_BADARG_RET(nsR < IPP_MAX(nsA, nsB), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + + IppsBigNumSGN sgnA = BN_SIGN(pA); + IppsBigNumSGN sgnB = BN_SIGN(pB); + BNU_CHUNK_T* pDataA = BN_NUMBER(pA); + BNU_CHUNK_T* pDataB = BN_NUMBER(pB); + + BNU_CHUNK_T carry; + + if(sgnA==sgnB) { + if(nsA < nsB) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpAdd_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + carry = cpInc_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + if(carry) { + if(nsR>nsA) + pDataR[nsA++] = carry; + else + IPP_ERROR_RET(ippStsOutOfRangeErr); + } + BN_SIGN(pR) = sgnA; + } + + else { + int cmpRes = cpCmp_BNU(pDataA, nsA, pDataB, nsB); + + if(0==cmpRes) { + pDataR[0] = 0; + BN_SIZE(pR) = 1; + BN_SIGN(pR) = ippBigNumPOS; + return ippStsNoErr; + } + + if(0>cmpRes) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpSub_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + cpDec_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + + BN_SIGN(pR) = cmpRes>0? sgnA : INVERSE_SIGN(sgnA); + } + + FIX_BNU(pDataR, nsA); + BN_SIZE(pR) = nsA; + + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsSub_BN +// +// Purpose: Subtcrac BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pR resultant BigNum +// +*F*/ +IPPFUN(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +{ + IPP_BAD_PTR3_RET(pA, pB, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + { + cpSize nsA = BN_SIZE(pA); + cpSize nsB = BN_SIZE(pB); + cpSize nsR = BN_ROOM(pR); + IPP_BADARG_RET(nsR < IPP_MAX(nsA, nsB), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + + IppsBigNumSGN sgnA = BN_SIGN(pA); + IppsBigNumSGN sgnB = BN_SIGN(pB); + BNU_CHUNK_T* pDataA = BN_NUMBER(pA); + BNU_CHUNK_T* pDataB = BN_NUMBER(pB); + + BNU_CHUNK_T carry; + + if(sgnA!=sgnB) { + if(nsA < nsB) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpAdd_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + carry = cpInc_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + if(carry) { + if(nsR > nsA) + pDataR[nsA++] = carry; + else + IPP_ERROR_RET(ippStsOutOfRangeErr); + } + BN_SIGN(pR) = sgnA; + } + + else { + int cmpRes= cpCmp_BNU(pDataA, nsA, pDataB, nsB); + + if(0==cmpRes) { + ZEXPAND_BNU(pDataR,0, nsR); + BN_SIZE(pR) = 1; + BN_SIGN(pR) = ippBigNumPOS; + return ippStsNoErr; + } + + if(0>cmpRes) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpSub_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + cpDec_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + + BN_SIGN(pR) = cmpRes>0? sgnA : INVERSE_SIGN(sgnA); + } + + FIX_BNU(pDataR, nsA); + BN_SIZE(pR) = nsA; + + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsMul_BN +// +// Purpose: Multiply BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pR resultant BigNum +// +*F*/ +IPPFUN(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +{ + IPP_BAD_PTR3_RET(pA, pB, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + { + BNU_CHUNK_T* pDataA = BN_NUMBER(pA); + BNU_CHUNK_T* pDataB = BN_NUMBER(pB); + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + + cpSize nsA = BN_SIZE(pA); + cpSize nsB = BN_SIZE(pB); + cpSize nsR = BN_ROOM(pR); + + cpSize bitSizeA = BITSIZE_BNU(pDataA, nsA); + cpSize bitSizeB = BITSIZE_BNU(pDataB, nsB); + + /* test if multiplicant/multiplier is zero */ + if(!bitSizeA || !bitSizeB) { + BN_SIZE(pR) = 1; + BN_SIGN(pR) = IppsBigNumPOS; + pDataR[0] = 0; + return ippStsNoErr; + } + + /* test if even low estimation of product A*B exceeded */ + IPP_BADARG_RET(nsR*BNU_CHUNK_BITS < (bitSizeA+bitSizeB-1), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* aData = pDataA; + BNU_CHUNK_T* bData = pDataB; + + if(pA == pR) { + aData = BN_BUFFER(pR); + COPY_BNU(aData, pDataA, nsA); + } + if((pB == pR) && (pA != pB)) { + bData = BN_BUFFER(pR); + COPY_BNU(bData, pDataB, nsB); + } + + /* clear result */ + ZEXPAND_BNU(pDataR, 0, nsR+1); + + cpMul_BNU_school(pDataR, aData, nsA, bData, nsB); + + nsR = (bitSizeA + bitSizeB + BNU_CHUNK_BITS - 1) /BNU_CHUNK_BITS; + FIX_BNU(pDataR, nsR); + IPP_BADARG_RET(nsR>BN_ROOM(pR), ippStsOutOfRangeErr); + + BN_SIZE(pR) = nsR; + BN_SIGN(pR) = (BN_SIGN(pA)==BN_SIGN(pB)? ippBigNumPOS : ippBigNumNEG); + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsDiv_BN +// +// Purpose: Divide BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pQ == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pQ) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pQ and/or pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pQ quotient BigNum +// pR reminder BigNum +// +// A = Q*B + R, 0 <= val(R) < val(B), sgn(A)==sgn(R) +// +*F*/ +IPPFUN(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +{ + IPP_BAD_PTR4_RET(pA, pB, pQ, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pQ), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + IPP_BADARG_RET(BN_SIZE(pB)== 1 && BN_NUMBER(pB)[0]==0, ippStsDivByZeroErr); + + IPP_BADARG_RET(BN_ROOM(pR)cmpRes) + SWAP_PTR(IppsBigNumState, x, y); + if(0==cmpRes) { + COPY_BNU(BN_NUMBER(g), BN_NUMBER(x), BN_SIZE(x)); + BN_SIGN(g) = ippBigNumPOS; + BN_SIZE(g) = BN_SIZE(x); + return ippStsNoErr; + } + if(BN_SIZE(x)==1) { + BNU_CHUNK_T gcd = cpGcd_BNU(BN_NUMBER(x)[0], BN_NUMBER(y)[0]); + BN_NUMBER(g)[0] = gcd; + BN_SIZE(g) = 1; + return ippStsNoErr; + } + } + + { + Ipp32u* xBuffer = (Ipp32u*)BN_BUFFER(x); + Ipp32u* yBuffer = (Ipp32u*)BN_BUFFER(y); + Ipp32u* gBuffer = (Ipp32u*)BN_BUFFER(g); + Ipp32u* xData = (Ipp32u*)BN_NUMBER(x); + Ipp32u* yData = (Ipp32u*)BN_NUMBER(y); + Ipp32u* gData = (Ipp32u*)BN_NUMBER(g); + cpSize nsXmax = BN_ROOM(x)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsYmax = BN_ROOM(y)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsGmax = BN_ROOM(g)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsX = BN_SIZE(x)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsY = BN_SIZE(y)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + + Ipp32u* T; + Ipp32u* u; + + FIX_BNU(xData, nsX); + FIX_BNU(yData, nsY); + + /* init buffers */ + ZEXPAND_COPY_BNU(xBuffer, nsX, xData, nsXmax); + ZEXPAND_COPY_BNU(yBuffer, nsY, yData, nsYmax); + + T = gBuffer; + u = gData; + ZEXPAND_BNU(T, 0, nsGmax); + ZEXPAND_BNU(u, 0, nsGmax); + + while(nsX > (cpSize)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))) { + /* xx and yy is the high-order digits of x and y (yy could be 0) */ + + Ipp64u xx = (Ipp64u)(xBuffer[nsX-1]); + Ipp64u yy = (nsY < nsX)? 0 : (Ipp64u)(yBuffer[nsY-1]); + + Ipp64s AA = 1; + Ipp64s BB = 0; + Ipp64s CC = 0; + Ipp64s DD = 1; + Ipp64s t; + + while((yy+CC)!=0 && (yy+DD)!=0) { + Ipp64u q = ( xx + AA ) / ( yy + CC ); + Ipp64u q1 = ( xx + BB ) / ( yy + DD ); + if(q!=q1) + break; + t = AA - q*CC; + AA = CC; + CC = t; + t = BB - q*DD; + BB = DD; + DD = t; + t = xx - q*yy; + xx = yy; + yy = t; + } + + if(BB == 0) { + /* T = x mod y */ + cpSize nsT = cpMod_BNU32(xBuffer, nsX, yBuffer, nsY); + ZEXPAND_BNU(T, 0, nsGmax); + COPY_BNU(T, xBuffer, nsT); + /* a = b; b = T; */ + ZEXPAND_BNU(xBuffer, 0, nsXmax); + COPY_BNU(xBuffer, yBuffer, nsY); + ZEXPAND_BNU(yBuffer, 0, nsYmax); + COPY_BNU(yBuffer, T, nsY); + } + + else { + Ipp32u carry; + /* + // T = AA*x + BB*y; + // u = CC*x + DD*y; + // b = u; a = T; + */ + if((AA <= 0)&&(BB>=0)) { + Ipp32u a1 = (Ipp32u)(-AA); + carry = cpMulDgt_BNU32(T, yBuffer, nsY, (Ipp32u)BB); + carry = cpMulDgt_BNU32(u, xBuffer, nsY, a1); + /* T = BB*y - AA*x; */ + carry = cpSub_BNU32(T, T, u, nsY); + } + else { + if((AA >= 0)&&(BB<=0)) { + Ipp32u b1 = (Ipp32u)(-BB); + carry = cpMulDgt_BNU32(T, xBuffer, nsY, (Ipp32u)AA); + carry = cpMulDgt_BNU32(u, yBuffer, nsY, b1); + /* T = AA*x - BB*y; */ + carry = cpSub_BNU32(T, T, u, nsY); + } + else { + /*AA*BB>=0 */ + carry = cpMulDgt_BNU32(T, xBuffer, nsY, (Ipp32u)AA); + carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)BB); + /* T = AA*x + BB*y; */ + carry = cpAdd_BNU32(T, T, u, nsY); + } + } + + /* Now T is reserved. We use only u for intermediate results. */ + if((CC <= 0)&&(DD>=0)){ + Ipp32u c1 = (Ipp32u)(-CC); + /* u = x*CC; x = u; */ + carry = cpMulDgt_BNU32(u, xBuffer, nsY, c1); + COPY_BNU(xBuffer, u, nsY); + /* u = y*DD; */ + carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)DD); + /* u = DD*y - CC*x; */ + carry = cpSub_BNU32(u, u, xBuffer, nsY); + } + else { + if((CC >= 0)&&(DD<=0)){ + Ipp32u d1 = (Ipp32u)(-DD); + /* u = y*DD; y = u */ + carry = cpMulDgt_BNU32(u, yBuffer, nsY, d1); + COPY_BNU(yBuffer, u, nsY); + /* u = CC*x; */ + carry = cpMulDgt_BNU32(u, xBuffer, nsY, (Ipp32u)CC); + /* u = CC*x - DD*y; */ + carry = cpSub_BNU32(u, u, yBuffer, nsY); + } + else { + /*CC*DD>=0 */ + /* y = y*DD */ + carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)DD); + COPY_BNU(yBuffer, u, nsY); + /* u = x*CC */ + carry = cpMulDgt_BNU32(u, xBuffer, nsY, (Ipp32u)CC); + /* u = x*CC + y*DD */ + carry = cpAdd_BNU32(u, u, yBuffer, nsY); + } + } + + /* y = u; x = T; */ + COPY_BNU(yBuffer, u, nsY); + COPY_BNU(xBuffer, T, nsY); + } + + FIX_BNU(xBuffer, nsX); + FIX_BNU(yBuffer, nsY); + + if (nsY > nsX) { + SWAP_PTR(IppsBigNumState, x, y); + SWAP(nsX, nsY); + } + + if (nsY==1 && yBuffer[nsY-1]==0) { + /* End evaluation */ + ZEXPAND_BNU(gData, 0, nsGmax); + COPY_BNU(gData, xBuffer, nsX); + BN_SIZE(g) = INTERNAL_BNU_LENGTH(nsX); + BN_SIGN(g) = ippBigNumPOS; + return ippStsNoErr; + } + } + + BN_NUMBER(g)[0] = cpGcd_BNU(((BNU_CHUNK_T*)xBuffer)[0], ((BNU_CHUNK_T*)yBuffer)[0]); + BN_SIZE(g) = 1; + BN_SIGN(g) = ippBigNumPOS; + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsModInv_BN +// +// Purpose: Multiplicative Inversion BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pM == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pM) +// BN_VALID_ID(pR) +// ippStsBadArgErr A<=0 +// ippStsBadModulusErr M<=0 +// ippStsScaleRangeErr A>=M +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// ippStsBadModulusErr inversion not found +// +// Parameters: +// pA source (value) BigNum +// pM source (modulus) BigNum +// pR reminder BigNum +// +*F*/ +IPPFUN(IppStatus, ippsModInv_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR) ) +{ + IPP_BAD_PTR3_RET(pA, pM, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pM = (IppsBigNumState*)( IPP_ALIGNED_PTR(pM, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pM), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + IPP_BADARG_RET(BN_ROOM(pR) < BN_SIZE(pM), ippStsOutOfRangeErr); + IPP_BADARG_RET(BN_NEGATIVE(pA) || (BN_SIZE(pA)==1 && BN_NUMBER(pA)[0]==0), ippStsBadArgErr); + IPP_BADARG_RET(BN_NEGATIVE(pM) || (BN_SIZE(pM)==1 && BN_NUMBER(pM)[0]==0), ippStsBadModulusErr); + IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pM), BN_SIZE(pM)) >= 0, ippStsScaleRangeErr); + + { + cpSize nsR = cpModInv_BNU(BN_NUMBER(pR), + BN_NUMBER(pA), BN_SIZE(pA), + BN_NUMBER(pM), BN_SIZE(pM), + BN_BUFFER(pR), BN_BUFFER(pA), BN_BUFFER(pM)); + if(nsR) { + BN_SIGN(pR) = ippBigNumPOS; + BN_SIZE(pR) = nsR; + return ippStsNoErr; + } + else + return ippStsBadModulusErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnresource.h b/external/crypto_px/sources/ippcp/src/pcpbnresource.h new file mode 100644 index 0000000000..a77f6880c5 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnresource.h @@ -0,0 +1,51 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_BNRESOURCE_H) +#define _PCP_BNRESOURCE_H + + +typedef struct { + void* pNext; + IppsBigNumState* pBN; +} BigNumNode; + + +/* size (byte) of BN resource */ +int cpBigNumListGetSize(int feBitSize, int nodes); + +/* init BN resource */ +void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList); + +/* get BN from resource */ +IppsBigNumState* cpBigNumListGet(BigNumNode** pList); + +#endif /* _PCP_BNRESOURCE_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c b/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c new file mode 100644 index 0000000000..1c89c67a5f --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c @@ -0,0 +1,93 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbnresource.h" +#include "pcpbn.h" + +/* +// Size of BigNum List Buffer +*/ +int cpBigNumListGetSize(int feBitSize, int nodes) +{ + /* size of buffer per single big number */ + int bnSize; + ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize); + + /* size of buffer for whole list */ + return (ALIGN_VAL-1) + (sizeof(BigNumNode) + bnSize) * nodes; +} + +/* +// Init list +// +// Note: buffer for BN list must have appropriate alignment +*/ +void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList) +{ + int itemSize; + /* length of Big Num */ + int bnLen = BITS2WORD32_SIZE(feBitSize); + /* size of buffer per single big number */ + ippsBigNumGetSize(bnLen, &itemSize); + /* size of list item */ + itemSize += sizeof(BigNumNode); + + { + int n; + /* init all nodes */ + BigNumNode* pNode = (BigNumNode*)( (Ipp8u*)pList + (nodes-1)*itemSize ); + BigNumNode* pNext = NULL; + for(n=0; npNext = pNext; + pNode->pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(tbnPtr, ALIGN_VAL) ); + ippsBigNumInit(bnLen, pNode->pBN); + pNext = pNode; + pNode = (BigNumNode*)( (Ipp8u*)pNode - itemSize); + } + } +} + +/* +// Get BigNum reference +*/ +IppsBigNumState* cpBigNumListGet(BigNumNode** ppList) +{ + if(*ppList) { + IppsBigNumState* ret = (*ppList)->pBN; + *ppList = (BigNumNode*)((*ppList)->pNext); + return ret; + } + else + return NULL; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnsetca.c b/external/crypto_px/sources/ippcp/src/pcpbnsetca.c new file mode 100644 index 0000000000..4d92c39032 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnsetca.c @@ -0,0 +1,119 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" + + +/*F* +// Name: ippsSetOctString_BN +// +// Purpose: Convert octet string into the BN value. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pOctStr +// NULL == pBN +// +// ippStsLengthErr 0>strLen +// +// ippStsSizeErr BN_ROOM() is enough for keep actual strLen +// +// ippStsNoErr no errors +// +// Parameters: +// pOctStr pointer to the source octet string +// strLen octet string length +// pBN pointer to the target BN +// +*F*/ +IPPFUN(IppStatus, ippsSetOctString_BN,(const Ipp8u* pOctStr, cpSize strLen, + IppsBigNumState* pBN)) +{ + IPP_BAD_PTR2_RET(pOctStr, pBN); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + IPP_BADARG_RET((0>strLen), ippStsLengthErr); + + /* remove leading zeros */ + while(strLen && (0==pOctStr[0])) { + strLen--; + pOctStr++; + } + + /* test BN size */ + IPP_BADARG_RET((int)(sizeof(BNU_CHUNK_T)*BN_ROOM(pBN))strLen), ippStsLengthErr); + + return cpToOctStr_BNU(pOctStr,strLen, BN_NUMBER(pBN),BN_SIZE(pBN))? ippStsNoErr : ippStsLengthErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c new file mode 100644 index 0000000000..cf04011d47 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c @@ -0,0 +1,234 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnumisc.h" +#include "pcpbnu32misc.h" +#include "pcpbnu32arith.h" + + +/* +// BNU32 addition +*/ +Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, cpSize ns) +{ + Ipp32u carry = 0; + cpSize i; + for(i=0; i>(32-1); + } + return borrow; +} + +/* +// BNU32 mul_by_digit +*/ +Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, Ipp32u val) +{ + Ipp32u carry = 0; + cpSize i; + for(i=0; i0; nsA--) { + Ipp64u r = (Ipp64u)*pR - (Ipp64u)(*pA++) * val - carry; + *pR++ = LODWORD(r); + carry = 0-HIDWORD(r); + } + return carry; +} + +/* +// BNU32 division +*/ +int cpDiv_BNU32(Ipp32u* pQ, cpSize* sizeQ, + Ipp32u* pX, cpSize sizeX, + Ipp32u* pY, cpSize sizeY) +{ + FIX_BNU(pY,sizeY); + FIX_BNU(pX,sizeX); + + /* special case */ + if(sizeX < sizeY) { + + if(pQ) { + pQ[0] = 0; + *sizeQ = 1; + } + + return sizeX; + } + + /* special case */ + if(1 == sizeY) { + int i; + Ipp32u r = 0; + for(i=(int)sizeX-1; i>=0; i--) { + Ipp64u tmp = MAKEDWORD(pX[i],r); + Ipp32u q = LODWORD(tmp / pY[0]); + r = LODWORD(tmp - q*pY[0]); + if(pQ) pQ[i] = q; + } + + pX[0] = r; + + if(pQ) { + FIX_BNU(pQ,sizeX); + *sizeQ = sizeX; + } + + return 1; + } + + + /* common case */ + { + cpSize qs = sizeX-sizeY+1; + + cpSize nlz = cpNLZ_BNU32(pY[sizeY-1]); + + /* normalization */ + pX[sizeX] = 0; + if(nlz) { + cpSize ni; + + pX[sizeX] = pX[sizeX-1] >> (32-nlz); + for(ni=sizeX-1; ni>0; ni--) + pX[ni] = (pX[ni]<>(32-nlz)); + pX[0] <<= nlz; + + for(ni=sizeY-1; ni>0; ni--) + pY[ni] = (pY[ni]<>(32-nlz)); + pY[0] <<= nlz; + } + + /* + // division + */ + { + Ipp32u yHi = pY[sizeY-1]; + + int i; + for(i=(int)qs-1; i>=0; i--) { + Ipp32u extend; + + /* estimate digit of quotient */ + Ipp64u tmp = MAKEDWORD(pX[i+sizeY-1], pX[i+sizeY]); + Ipp64u q = tmp / yHi; + Ipp64u r = tmp - q*yHi; + + /* tune estimation above */ + for(; HIDWORD(q) || (Ipp64u)q*pY[sizeY-2] > MAKEDWORD(pX[i+sizeY-2],r); ) { + q -= 1; + r += yHi; + if( HIDWORD(r) ) + break; + } + + /* multiply and subtract */ + extend = cpSubMulDgt_BNU32(pX+i, pY, sizeY, (Ipp32u)q); + extend = (pX[i+sizeY] -= extend); + + if(extend) { /* subtracted too much */ + q -= 1; + extend = cpAdd_BNU32(pX+i, pY, pX+i, sizeY); + pX[i+sizeY] += extend; + } + + /* store quotation digit */ + if(pQ) pQ[i] = LODWORD(q); + } + } + + /* de-normalization */ + if(nlz) { + cpSize ni; + for(ni=0; ni>nlz) | (pX[ni+1]<<(32-nlz)); + for(ni=0; ni>nlz) | (pY[ni+1]<<(32-nlz)); + pY[sizeY-1] >>= nlz; + } + + FIX_BNU(pX,sizeX); + + if(pQ) { + FIX_BNU(pQ,qs); + *sizeQ = qs; + } + + return sizeX; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h new file mode 100644 index 0000000000..c72b77e18c --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h @@ -0,0 +1,46 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BNU32_ARITH_H) +#define _CP_BNU32_ARITH_H + +Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns); +Ipp32u cpSub_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns); +Ipp32u cpInc_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val); +Ipp32u cpDec_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val); + +Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int ns, Ipp32u val); +Ipp32u cpSubMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int nsA, Ipp32u val); + +int cpDiv_BNU32(Ipp32u* pQ, int* nsQ, Ipp32u* pX, int nsX, Ipp32u* pY, int nsY); +#define cpMod_BNU32(pX,sizeX, pM,sizeM) cpDiv_BNU32(NULL,NULL, (pX),(sizeX), (pM),(sizeM)) + +#endif /* _CP_BNU32_ARITH_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c new file mode 100644 index 0000000000..e9a2dd7313 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnuimpl.h" +#include "pcpbnumisc.h" +#include "pcpbnu32misc.h" + + +/* +// number of leading zeros +*/ +cpSize cpNLZ_BNU32(Ipp32u x) +{ + cpSize nlz = BITSIZE(Ipp32u); + if(x) { + nlz = 0; + if( 0==(x & 0xFFFF0000) ) { nlz +=16; x<<=16; } + if( 0==(x & 0xFF000000) ) { nlz += 8; x<<= 8; } + if( 0==(x & 0xF0000000) ) { nlz += 4; x<<= 4; } + if( 0==(x & 0xC0000000) ) { nlz += 2; x<<= 2; } + if( 0==(x & 0x80000000) ) { nlz++; } + } + return nlz; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h new file mode 100644 index 0000000000..a25c9f0d5a --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BNU32_MISC_H) +#define _CP_BNU32_MISC_H + + +/* bit operations */ +#define BITSIZE_BNU32(p,ns) ((ns)*BNU_CHUNK_32BIT-cpNLZ_BNU32((p)[(ns)-1])) + +/* number of leading/trailing zeros */ +cpSize cpNLZ_BNU32(Ipp32u x); + +/* most significant BNU bit */ +__INLINE int cpMSBit_BNU32(const Ipp32u* pA, cpSize nsA) +{ + FIX_BNU(pA, nsA); + return nsA*BITSIZE(Ipp32u) - cpNLZ_BNU32(pA[nsA-1]) -1; +} + +#endif /* _CP_BNU32_MISC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnuarith.c b/external/crypto_px/sources/ippcp/src/pcpbnuarith.c new file mode 100644 index 0000000000..c1a21e9065 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnuarith.c @@ -0,0 +1,301 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnuarith.h" +#include "pcpbnumisc.h" + + +/* Function cpAdd_BNU - addition of 2 BigNumbers */ +BNU_CHUNK_T cpAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, cpSize ns) +{ + BNU_CHUNK_T carry = 0; + cpSize i; + for(i=0; i b){ + gcd = a; + t = b; + } else { + t = a; + gcd = b; + } + + while (t != 0) { + r = gcd % t; + gcd = t; + t = r; + } + return gcd; +} + + +/* +// cpMAC_BNU +// +// Multiply with ACcumulation +// Computes r <- r + a * b, returns real size of the r in the size_r variable +// Returns 0 if there are no enought buffer size to write to r[MAX(size_r + 1, size_a + size_b) - 1] +// Returns 1 if no error +// +// Note: +// DO NOT run in inplace mode +// The minimum buffer size for the r must be (size_a + size_b - 1) +// the maximum buffer size for the r is MAX(size_r + 1, size_a + size_b) +*/ +static int cpMac_BNU(BNU_CHUNK_T* pR, cpSize nsR, + const BNU_CHUNK_T* pA, cpSize nsA, + const BNU_CHUNK_T* pB, cpSize nsB) +{ + /* cleanup the rest of destination buffer */ + ZEXPAND_BNU(pR, nsR, nsA+nsB-1); + + { + BNU_CHUNK_T expansion = 0; + cpSize i; + for(i=0; i> (BNU_CHUNK_BITS/2)) + +/* (carry,R) = A+B */ +#define ADD_AB(CARRY,R, A,B) \ +do { \ + BNU_CHUNK_T __s = (A) + (B); \ + (CARRY) = __s < (A); \ + (R) = __s; \ +} while(0) + +/* (carry,R) = A+B+C */ +#define ADD_ABC(CARRY,R, A,B,C) \ +do { \ + BNU_CHUNK_T __s = (A) + (B); \ + BNU_CHUNK_T __t1= __s < (A); \ + BNU_CHUNK_T __r = __s + (C); \ + BNU_CHUNK_T __t2 = __r < __s; \ + (CARRY) = __t1 + __t2; \ + (R) = __r; \ +} while(0) + +/* (borrow,R) = A-B */ +#define SUB_AB(BORROW,R, A,B) \ +do { \ + (BORROW) = (A)<(B); \ + (R) = (A)-(B); \ +} while(0) + +/* (borrow,R) = A-B-C */ +#define SUB_ABC(BORROW,R, A,B,C) \ +do { \ + BNU_CHUNK_T __s = (A) -( B); \ + BNU_CHUNK_T __t1= __s > (A); \ + BNU_CHUNK_T __r = __s - (C); \ + BNU_CHUNK_T __t2 = __r > __s; \ + (BORROW) = __t1 + __t2; \ + (R) = __r; \ +} while(0) + +/* (RH,RL) = A*B */ +#define MUL_AB(RH, RL, A, B) \ + do { \ + BNU_CHUNK_T __aL = LO_CHUNK((A)); \ + BNU_CHUNK_T __aH = HI_CHUNK((A)); \ + BNU_CHUNK_T __bL = LO_CHUNK((B)); \ + BNU_CHUNK_T __bH = HI_CHUNK((B)); \ + \ + BNU_CHUNK_T __x0 = (BNU_CHUNK_T) __aL * __bL; \ + BNU_CHUNK_T __x1 = (BNU_CHUNK_T) __aL * __bH; \ + BNU_CHUNK_T __x2 = (BNU_CHUNK_T) __aH * __bL; \ + BNU_CHUNK_T __x3 = (BNU_CHUNK_T) __aH * __bH; \ + \ + __x1 += HI_CHUNK(__x0); \ + __x1 += __x2; \ + if(__x1 < __x2) \ + __x3 += BNU_CHUNK_2H; \ + \ + (RH) = __x3 + HI_CHUNK(__x1); \ + (RL) = (__x1 << BNU_CHUNK_BITS/2) + LO_CHUNK(__x0); \ + } while (0) + +#endif /* _CP_BNU_IMPL_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnumisc.c b/external/crypto_px/sources/ippcp/src/pcpbnumisc.c new file mode 100644 index 0000000000..3e7eec89ff --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnumisc.c @@ -0,0 +1,208 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnumisc.h" + + +/* +// number of leading zeros +*/ +cpSize cpNLZ_BNU(BNU_CHUNK_T x) +{ + cpSize nlz = BNU_CHUNK_BITS; + if(x) { + nlz = 0; + #if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT) + if( 0==(x & 0xFFFFFFFF00000000) ) { nlz +=32; x<<=32; } + if( 0==(x & 0xFFFF000000000000) ) { nlz +=16; x<<=16; } + if( 0==(x & 0xFF00000000000000) ) { nlz += 8; x<<= 8; } + if( 0==(x & 0xF000000000000000) ) { nlz += 4; x<<= 4; } + if( 0==(x & 0xC000000000000000) ) { nlz += 2; x<<= 2; } + if( 0==(x & 0x8000000000000000) ) { nlz++; } + #else + if( 0==(x & 0xFFFF0000) ) { nlz +=16; x<<=16; } + if( 0==(x & 0xFF000000) ) { nlz += 8; x<<= 8; } + if( 0==(x & 0xF0000000) ) { nlz += 4; x<<= 4; } + if( 0==(x & 0xC0000000) ) { nlz += 2; x<<= 2; } + if( 0==(x & 0x80000000) ) { nlz++; } + #endif + } + return nlz; +} + +/* +// number of trailing zeros +*/ +cpSize cpNTZ_BNU(BNU_CHUNK_T x) +{ + cpSize ntz = BNU_CHUNK_BITS; + if(x) { + ntz = 0; + #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) + if( 0==(x & 0x00000000FFFFFFFF) ) { ntz+=32; x>>=32; } + if( 0==(x & 0x000000000000FFFF) ) { ntz+=16; x>>=16; } + if( 0==(x & 0x00000000000000FF) ) { ntz+= 8; x>>= 8; } + if( 0==(x & 0x000000000000000F) ) { ntz+= 4; x>>= 4; } + if( 0==(x & 0x0000000000000003) ) { ntz+= 2; x>>= 2; } + if( 0==(x & 0x0000000000000001) ) { ntz++; } + #else + if( 0==(x & 0x0000FFFF) ) { ntz+=16; x>>=16; } + if( 0==(x & 0x000000FF) ) { ntz+= 8; x>>= 8; } + if( 0==(x & 0x0000000F) ) { ntz+= 4; x>>= 4; } + if( 0==(x & 0x00000003) ) { ntz+= 2; x>>= 2; } + if( 0==(x & 0x00000001) ) { ntz++; } + #endif + } + return ntz; +} + + +/* +// Logical shift right (including inplace) +// +// Returns new length +// +*/ +cpSize cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits) +{ + cpSize nw = nBits/BNU_CHUNK_BITS; + cpSize n; + + pA += nw; + nsA -= nw; + + nBits %= BNU_CHUNK_BITS; + if(nBits) { + BNU_CHUNK_T hi; + BNU_CHUNK_T lo = pA[0]; + + for(n=0; n<(nsA-1); n++) { + hi = pA[n+1]; + pR[n] = (lo>>nBits) | (hi<<(BNU_CHUNK_BITS-nBits)); + lo = hi; + } + pR[nsA-1] = (lo>>nBits); + } + else { + for(n=0; n=(int)sizeof(BNU_CHUNK_T); nsA++,strLen-=(int)(sizeof(BNU_CHUNK_T))) { + /* pack sizeof(BNU_CHUNK_T) bytes into single BNU_CHUNK_T value*/ + *pA++ = + #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) + +( (BNU_CHUNK_T)pStr[strLen-8]<<(8*7) ) + +( (BNU_CHUNK_T)pStr[strLen-7]<<(8*6) ) + +( (BNU_CHUNK_T)pStr[strLen-6]<<(8*5) ) + +( (BNU_CHUNK_T)pStr[strLen-5]<<(8*4) ) + #endif + +( (BNU_CHUNK_T)pStr[strLen-4]<<(8*3) ) + +( (BNU_CHUNK_T)pStr[strLen-3]<<(8*2) ) + +( (BNU_CHUNK_T)pStr[strLen-2]<<(8*1) ) + + (BNU_CHUNK_T)pStr[strLen-1]; + } + + /* convert the beginning of the string */ + if(strLen) { + BNU_CHUNK_T x = 0; + for(x=0; strLen>0; strLen--) { + BNU_CHUNK_T d = *pStr++; + x = (x<<8) + d; + } + *pA++ = x; + nsA++; + } + + return nsA; +} + +/* +// Convert BNU into HexString representation +// +// Returns length of the string or 0 if no success +*/ +cpSize cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA) +{ + FIX_BNU(pA, nsA); + { + cpSize bnuBitSize = BITSIZE_BNU(pA, nsA); + if(bnuBitSize <= strLen*BYTESIZE) { + int cnvLen = 0; + BNU_CHUNK_T x = pA[nsA-1]; + + ZEXPAND_BNU(pStr, 0, strLen); + pStr += strLen - BITS2WORD8_SIZE(bnuBitSize); + + if(x) { + //int nb; + cpSize nb; + for(nb=cpNLZ_BNU(x)/BYTESIZE; nb<(cpSize)(sizeof(BNU_CHUNK_T)); cnvLen++, nb++) + *pStr++ = EBYTE(x, sizeof(BNU_CHUNK_T)-1-nb); + + for(--nsA; nsA>0; cnvLen+=sizeof(BNU_CHUNK_T), nsA--) { + x = pA[nsA-1]; + #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) + *pStr++ = EBYTE(x,7); + *pStr++ = EBYTE(x,6); + *pStr++ = EBYTE(x,5); + *pStr++ = EBYTE(x,4); + #endif + *pStr++ = EBYTE(x,3); + *pStr++ = EBYTE(x,2); + *pStr++ = EBYTE(x,1); + *pStr++ = EBYTE(x,0); + } + } + return strLen; + } + else + return 0; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnumisc.h b/external/crypto_px/sources/ippcp/src/pcpbnumisc.h new file mode 100644 index 0000000000..8a27bea7a8 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpbnumisc.h @@ -0,0 +1,149 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_BNUMISC_H) +#define _PCP_BNUMISC_H + +#include "pcpbnuimpl.h" + + +/* bit operations */ +#define BITSIZE_BNU(p,ns) ((ns)*BNU_CHUNK_BITS-cpNLZ_BNU((p)[(ns)-1])) +#define BIT_BNU(bnu, ns,nbit) ((((nbit)>>BNU_CHUNK_LOG2) < (ns))? ((((bnu))[(nbit)>>BNU_CHUNK_LOG2] >>((nbit)&(BNU_CHUNK_BITS))) &1) : 0) +#define TST_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) & ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) +#define SET_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) |= ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) +#define CLR_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) &=~((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) + +/* convert bitsize nbits into the number of BNU_CHUNK_T */ +#define BITS_BNU_CHUNK(nbits) (((nbits)+BNU_CHUNK_BITS-1)/BNU_CHUNK_BITS) + +/* mask for top BNU_CHUNK_T */ +#define MASK_BNU_CHUNK(nbits) ((BNU_CHUNK_T)(-1) >>((BNU_CHUNK_BITS- ((nbits)&(BNU_CHUNK_BITS-1))) &(BNU_CHUNK_BITS-1))) + +/* copy BNU content */ +#define COPY_BNU(dst, src, len) \ +{ \ + cpSize __idx; \ + for(__idx=0; __idx<(len); __idx++) (dst)[__idx] = (src)[__idx]; \ +} + +/* expand by zeros */ +#define ZEXPAND_BNU(srcdst,srcLen, dstLen) \ +{ \ + cpSize __idx; \ + for(__idx=(srcLen); __idx<(dstLen); __idx++) (srcdst)[__idx] = 0; \ +} + +/* copy and expand by zeros */ +#define ZEXPAND_COPY_BNU(dst,dstLen, src,srcLen) \ +{ \ + cpSize __idx; \ + for(__idx=0; __idx<(srcLen); __idx++) (dst)[__idx] = (src)[__idx]; \ + for(; __idx<(dstLen); __idx++) (dst)[__idx] = 0; \ +} + +/* fix actual length */ +#define FIX_BNU(src,srcLen) \ + for(; ((srcLen)>1) && (0==(src)[(srcLen)-1]); (srcLen)--) + + +/* copy and set */ +__INLINE void cpCpy_BNU(BNU_CHUNK_T* pDst, const BNU_CHUNK_T* pSrc, cpSize ns) +{ COPY_BNU(pDst, pSrc, ns); } + +__INLINE void cpSet_BNU(BNU_CHUNK_T* pDst, cpSize ns, BNU_CHUNK_T val) +{ + ZEXPAND_BNU(pDst, 0, ns); + pDst[0] = val; +} + +/* fix up */ +__INLINE int cpFix_BNU(const BNU_CHUNK_T* pA, int nsA) +{ + FIX_BNU(pA, nsA); + return nsA; +} + +/* comparison +// +// returns +// negative, if A < B +// 0, if A = B +// positive, if A > B +*/ +__INLINE int cpCmp_BNU(const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB) +{ + if(nsA!=nsB) + return nsA>nsB? 1 : -1; + else { + for(; nsA>0; nsA--) { + if(pA[nsA-1] > pB[nsA-1]) + return 1; + else if(pA[nsA-1] < pB[nsA-1]) + return -1; + } + return 0; + } +} +__INLINE int cpEqu_BNU_CHUNK(const BNU_CHUNK_T* pA, cpSize nsA, BNU_CHUNK_T b) +{ + return (pA[0]==b && 1==cpFix_BNU(pA, nsA)); +} + +/* +// test +// +// returns +// 0, if A = 0 +// >0, if A > 0 +// <0, looks like impossible (or error) case +*/ +__INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA) +{ + for(; (nsA>0) && (0==pA[nsA-1]); nsA--) ; + return nsA; +} + +/* number of leading/trailing zeros */ +cpSize cpNLZ_BNU(BNU_CHUNK_T x); +cpSize cpNTZ_BNU(BNU_CHUNK_T x); + +/* logical shift left/right */ +int cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits); + +/* least and most significant BNU bit */ +int cpMSBit_BNU(const BNU_CHUNK_T* pA, cpSize nsA); + +/* BNU <-> hex-string conversion */ +int cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA); +int cpFromOctStr_BNU(BNU_CHUNK_T* pA, const Ipp8u* pStr, cpSize strLen); + +#endif /* _PCP_BNUMISC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpcmac.h b/external/crypto_px/sources/ippcp/src/pcpcmac.h new file mode 100644 index 0000000000..cfeb9bf107 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpcmac.h @@ -0,0 +1,70 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_CMAC_H) +#define _PCP_CMAC_H + +#include "pcprij.h" + + +/* +// Rijndael128 based CMAC context +*/ +struct _cpAES_CMAC { + IppCtxId idCtx; /* CMAC identifier */ + int index; /* internal buffer entry (free) */ + int dummy[2]; /* align-16 */ + Ipp8u k1[MBS_RIJ128]; /* k1 subkey */ + Ipp8u k2[MBS_RIJ128]; /* k2 subkey */ + Ipp8u mBuffer[MBS_RIJ128];/* buffer */ + Ipp8u mMAC[MBS_RIJ128]; /* intermediate digest */ + __ALIGN16 /* aligned AES context */ + IppsAESSpec mCipherCtx; +}; + +/* alignment */ +#define AESCMAC_ALIGNMENT (RIJ_ALIGNMENT) + +/* +// Useful macros +*/ +#define CMAC_ID(stt) ((stt)->idCtx) +#define CMAC_INDX(stt) ((stt)->index) +#define CMAC_K1(stt) ((stt)->k1) +#define CMAC_K2(stt) ((stt)->k2) +#define CMAC_BUFF(stt) ((stt)->mBuffer) +#define CMAC_MAC(stt) ((stt)->mMAC) +#define CMAC_CIPHER(stt) ((stt)->mCipherCtx) + +/* valid context ID */ +#define VALID_AESCMAC_ID(ctx) (CMAC_ID((ctx))==idCtxCMAC) + +#endif /* _PCP_CMAC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpeccp.h b/external/crypto_px/sources/ippcp/src/pcpeccp.h new file mode 100644 index 0000000000..c5bf622be5 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccp.h @@ -0,0 +1,230 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_ECCP_H) +#define _PCP_ECCP_H + +#include "pcpbnresource.h" +#include "pcppma.h" +#include "pcpeccppoint.h" +#include "pcpeccpsscm.h" + + +typedef struct eccp_method_st ECCP_METHOD; + +/* +// ECC over prime GF(p) Context +*/ +struct _cpECCP { + IppCtxId idCtx; /* prime EC identifier */ + + IppsBigNumState* pPrime; /* specify finite field GF(p) */ + IppsBigNumState* pA; /* scecify A & B of EC equation: */ + IppsBigNumState* pB; /* y^2 = x^3 + A*x + B (mod)p */ + + IppsBigNumState* pGX; /* Base Point (X coordinate) */ + IppsBigNumState* pGY; /* Base Point (Y coordinate) */ + IppsBigNumState* pR; /* order (r) of Base Point */ + /* fields above mainly for ippsECCPSet()/ippsECCPGet() */ + + Ipp32u eccStandard;/* generic/standard ecc */ + + ECCP_METHOD* pMethod; + + int gfeBitSize; /* size (bits) of field element */ + int ordBitSize; /* size (bits) of BP order */ + + int a_3; /* ==1 if A==-3 or A==P-3 */ + IppsBigNumState* pAenc; /* internal formatted pA value */ + IppsBigNumState* pBenc; /* internal formatted pB value */ + IppsMontState* pMontP; /* montromery engine (modulo p) */ + + IppsECCPPointState* pGenc; /* internal formatted Base Point */ + IppsBigNumState* pCofactor; /* cofactor = #E/base_point_order*/ + IppsMontState* pMontR; /* montromery engine (modulo r) */ + + IppsBigNumState* pPrivate; /* private key */ + IppsECCPPointState* pPublic; /* public key (affine) */ + IppsBigNumState* pPrivateE; /* ephemeral private key */ + IppsECCPPointState* pPublicE; /* ephemeral public key (affine) */ + + IppsPrimeState* pPrimary; /* prime engine */ + + Ipp8u* pSscmBuffer;/* pointer to sscm buffer */ + + BigNumNode* pBnList; /* list of big numbers */ +}; + +/* some useful constants */ +#define BNLISTSIZE (32) /* list size (probably less) */ + +/* +// Contetx Access Macros +*/ +#define ECP_ID(ctx) ((ctx)->idCtx) + +#define ECP_PRIME(ctx) ((ctx)->pPrime) +#define ECP_A(ctx) ((ctx)->pA) +#define ECP_B(ctx) ((ctx)->pB) + +#define ECP_GX(ctx) ((ctx)->pGX) +#define ECP_GY(ctx) ((ctx)->pGY) +#define ECP_ORDER(ctx) ((ctx)->pR) + +#define ECP_TYPE(ctx) ((ctx)->eccStandard) + +#define ECP_METHOD(ctx) ((ctx)->pMethod) + +#define ECP_GFEBITS(ctx) ((ctx)->gfeBitSize) +#define ECP_ORDBITS(ctx) ((ctx)->ordBitSize) + +#define ECP_AMI3(ctx) ((ctx)->a_3) +#define ECP_AENC(ctx) ((ctx)->pAenc) +#define ECP_BENC(ctx) ((ctx)->pBenc) +#define ECP_PMONT(ctx) ((ctx)->pMontP) + +#define ECP_GENC(ctx) ((ctx)->pGenc) +#define ECP_COFACTOR(ctx) ((ctx)->pCofactor) +#define ECP_RMONT(ctx) ((ctx)->pMontR) + +#define ECP_PRIVATE(ctx) ((ctx)->pPrivate) +#define ECP_PUBLIC(ctx) ((ctx)->pPublic) +#define ECP_PRIVATE_E(ctx) ((ctx)->pPrivateE) +#define ECP_PUBLIC_E(ctx) ((ctx)->pPublicE) + +#define ECP_PRIMARY(ctx) ((ctx)->pPrimary) +#define ECP_SCCMBUFF(ctx) ((ctx)->pSscmBuffer) +#define ECP_BNCTX(ctx) ((ctx)->pBnList) + +#define ECP_VALID_ID(ctx) (ECP_ID((ctx))==idCtxECCP) + +/* +// Recommended (Standard) Domain Parameters +*/ +extern const Ipp32u secp112r1_p[]; // (2^128 -3)/76439 +extern const Ipp32u secp112r1_a[]; +extern const Ipp32u secp112r1_b[]; +extern const Ipp32u secp112r1_gx[]; +extern const Ipp32u secp112r1_gy[]; +extern const Ipp32u secp112r1_r[]; +extern Ipp32u secp112r1_h; + +extern const Ipp32u secp112r2_p[]; // (2^128 -3)/76439 +extern const Ipp32u secp112r2_a[]; +extern const Ipp32u secp112r2_b[]; +extern const Ipp32u secp112r2_gx[]; +extern const Ipp32u secp112r2_gy[]; +extern const Ipp32u secp112r2_r[]; +extern Ipp32u secp112r2_h; + +extern const Ipp32u secp128r1_p[]; // 2^128 -2^97 -1 +extern const Ipp32u secp128r1_a[]; +extern const Ipp32u secp128r1_b[]; +extern const Ipp32u secp128r1_gx[]; +extern const Ipp32u secp128r1_gy[]; +extern const Ipp32u secp128r1_r[]; +extern Ipp32u secp128r1_h; + +extern const Ipp32u* secp128_mx[]; + +extern const Ipp32u secp128r2_p[]; // 2^128 -2^97 -1 +extern const Ipp32u secp128r2_a[]; +extern const Ipp32u secp128r2_b[]; +extern const Ipp32u secp128r2_gx[]; +extern const Ipp32u secp128r2_gy[]; +extern const Ipp32u secp128r2_r[]; +extern Ipp32u secp128r2_h; + +extern const Ipp32u secp160r1_p[]; // 2^160 -2^31 -1 +extern const Ipp32u secp160r1_a[]; +extern const Ipp32u secp160r1_b[]; +extern const Ipp32u secp160r1_gx[]; +extern const Ipp32u secp160r1_gy[]; +extern const Ipp32u secp160r1_r[]; +extern Ipp32u secp160r1_h; + +extern const Ipp32u secp160r2_p[]; // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1 +extern const Ipp32u secp160r2_a[]; +extern const Ipp32u secp160r2_b[]; +extern const Ipp32u secp160r2_gx[]; +extern const Ipp32u secp160r2_gy[]; +extern const Ipp32u secp160r2_r[]; +extern Ipp32u secp160r2_h; + +extern const Ipp32u secp192r1_p[]; // 2^192 -2^64 -1 +extern const Ipp32u secp192r1_a[]; +extern const Ipp32u secp192r1_b[]; +extern const Ipp32u secp192r1_gx[]; +extern const Ipp32u secp192r1_gy[]; +extern const Ipp32u secp192r1_r[]; +extern Ipp32u secp192r1_h; + +extern const Ipp32u secp224r1_p[]; // 2^224 -2^96 +1 +extern const Ipp32u secp224r1_a[]; +extern const Ipp32u secp224r1_b[]; +extern const Ipp32u secp224r1_gx[]; +extern const Ipp32u secp224r1_gy[]; +extern const Ipp32u secp224r1_r[]; +extern Ipp32u secp224r1_h; + +extern const Ipp32u secp256r1_p[]; // 2^256 -2^224 +2^192 +2^96 -1 +extern const Ipp32u secp256r1_a[]; +extern const Ipp32u secp256r1_b[]; +extern const Ipp32u secp256r1_gx[]; +extern const Ipp32u secp256r1_gy[]; +extern const Ipp32u secp256r1_r[]; +extern Ipp32u secp256r1_h; + +extern const Ipp32u secp384r1_p[]; // 2^384 -2^128 -2^96 +2^32 -1 +extern const Ipp32u secp384r1_a[]; +extern const Ipp32u secp384r1_b[]; +extern const Ipp32u secp384r1_gx[]; +extern const Ipp32u secp384r1_gy[]; +extern const Ipp32u secp384r1_r[]; +extern Ipp32u secp384r1_h; + +extern const Ipp32u secp521r1_p[]; // 2^521 -1 +extern const Ipp32u secp521r1_a[]; +extern const Ipp32u secp521r1_b[]; +extern const Ipp32u secp521r1_gx[]; +extern const Ipp32u secp521r1_gy[]; +extern const Ipp32u secp521r1_r[]; +extern Ipp32u secp521r1_h; + +/* half of some std modulus */ +extern const Ipp32u h_secp128r1_p[]; +extern const Ipp32u h_secp192r1_p[]; +extern const Ipp32u h_secp224r1_p[]; +extern const Ipp32u h_secp256r1_p[]; +extern const Ipp32u h_secp384r1_p[]; +extern const Ipp32u h_secp521r1_p[]; + +#endif /* _PCP_ECCP_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c b/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c new file mode 100644 index 0000000000..f5b9f5b060 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c @@ -0,0 +1,370 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpbnresource.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" +#include "pcppma.h" + + +/*F* +// Name: ippsECCPSet +// +// Purpose: Set EC Domain Parameters. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pPrime +// NULL == pA +// NULL == pB +// NULL == pGX +// NULL == pGY +// NULL == pOrder +// NULL == pECC +// +// ippStsContextMatchErr illegal pPrime->idCtx +// illegal pA->idCtx +// illegal pB->idCtx +// illegal pGX->idCtx +// illegal pGY->idCtx +// illegal pOrder->idCtx +// illegal pECC->idCtx +// +// ippStsRangeErr not enough room for: +// pPrime +// pA, pB, +// pGX,pGY +// pOrder +// +// ippStsRangeErr 0>= cofactor +// +// ippStsNoErr no errors +// +// Parameters: +// pPrime pointer to the prime (specify FG(p)) +// pA pointer to the A coefficient of EC equation +// pB pointer to the B coefficient of EC equation +// pGX,pGY pointer to the Base Point (x and y coordinates) of EC +// pOrder pointer to the Base Point order +// cofactor cofactor value +// pECC pointer to the ECC context +// +*F*/ +static +void ECCPSetDP(IppECCType flag, + int primeSize, const Ipp32u* pPrime, + int aSize, const Ipp32u* pA, + int bSize, const Ipp32u* pB, + int gxSize, const Ipp32u* pGx, + int gySize, const Ipp32u* pGy, + int orderSize, const Ipp32u* pOrder, + Ipp32u cofactor, + IppsECCPState* pECC) +{ + ECP_TYPE(pECC) = flag; + + /* reset size (bits) of field element */ + ECP_GFEBITS(pECC) = cpMSBit_BNU32(pPrime, primeSize) +1; + /* reset size (bits) of Base Point order */ + ECP_ORDBITS(pECC) = cpMSBit_BNU32(pOrder, orderSize) +1; + + /* set up prime */ + ippsSet_BN(ippBigNumPOS, primeSize, pPrime, ECP_PRIME(pECC)); + /* set up A */ + ippsSet_BN(ippBigNumPOS, aSize, pA, ECP_A(pECC)); + /* test A */ + BN_Word(ECP_B(pECC), 3); + PMA_add(ECP_B(pECC), ECP_A(pECC), ECP_B(pECC), ECP_PRIME(pECC)); + ECP_AMI3(pECC) = IsZero_BN(ECP_B(pECC)); + /* set up B */ + ippsSet_BN(ippBigNumPOS, bSize, pB, ECP_B(pECC)); + + /* set up affine coordinates of Base Point and order */ + ippsSet_BN(ippBigNumPOS, gxSize, pGx, ECP_GX(pECC)); + ippsSet_BN(ippBigNumPOS, gySize, pGy, ECP_GY(pECC)); + ippsSet_BN(ippBigNumPOS, orderSize, pOrder, ECP_ORDER(pECC)); + + /* set up cofactor */ + //ippsSet_BN(ippBigNumPOS, 1, &((Ipp32u)cofactor), ECP_COFACTOR(pECC)); + ippsSet_BN(ippBigNumPOS, 1, &cofactor, ECP_COFACTOR(pECC)); + + /* montgomery engine (prime) */ + if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_PRIME(pECC)), BN_SIZE32(ECP_PRIME(pECC)), ECP_PMONT(pECC)) ) { + /* modulo reduction and montgomery form of A and B */ + PMA_mod(ECP_AENC(pECC), ECP_A(pECC), ECP_PRIME(pECC)); + PMA_enc(ECP_AENC(pECC), ECP_AENC(pECC), ECP_PMONT(pECC)); + PMA_mod(ECP_BENC(pECC), ECP_B(pECC), ECP_PRIME(pECC)); + PMA_enc(ECP_BENC(pECC), ECP_BENC(pECC), ECP_PMONT(pECC)); + /* projective coordinates and montgomery form of of Base Point */ + if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(ECP_GX(pECC), ECP_GY(pECC))) || + (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(ECP_GX(pECC), ECP_GY(pECC))) ) + ECCP_SetPointToInfinity(ECP_GENC(pECC)); + else { + ECP_METHOD(pECC)->SetPointProjective(ECP_GX(pECC), ECP_GY(pECC), BN_ONE_REF(), ECP_GENC(pECC), pECC); + } + } + + /* montgomery engine (order) */ + if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_ORDER(pECC)), BN_SIZE32(ECP_ORDER(pECC)), ECP_RMONT(pECC)) ) + PMA_enc(ECP_COFACTOR(pECC), ECP_COFACTOR(pECC), ECP_RMONT(pECC)); + + /* set zero private keys */ + BN_Word(ECP_PRIVATE(pECC), 0); + BN_Word(ECP_PRIVATE_E(pECC), 0); + + /* set infinity public keys */ + ECCP_SetPointToInfinity(ECP_PUBLIC(pECC)); + ECCP_SetPointToInfinity(ECP_PUBLIC_E(pECC)); +} + + +IPPFUN(IppStatus, ippsECCPSet, (const IppsBigNumState* pPrime, + const IppsBigNumState* pA, const IppsBigNumState* pB, + const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, + int cofactor, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test pPrime */ + IPP_BAD_PTR1_RET(pPrime); + pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr); + IPP_BADARG_RET((cpBN_bitsize(pPrime)>ECP_GFEBITS(pECC)), ippStsRangeErr); + + /* test pA and pB */ + IPP_BAD_PTR2_RET(pA,pB); + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, ALIGN_VAL) ); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + IPP_BADARG_RET((cpBN_bitsize(pA)>ECP_GFEBITS(pECC)), ippStsRangeErr); + IPP_BADARG_RET((cpBN_bitsize(pB)>ECP_GFEBITS(pECC)), ippStsRangeErr); + + /* test pG and pGorder pointers */ + IPP_BAD_PTR3_RET(pGX,pGY, pOrder); + pGX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pGX, ALIGN_VAL) ); + pGY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pGY, ALIGN_VAL) ); + pOrder = (IppsBigNumState*)( IPP_ALIGNED_PTR(pOrder, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pGX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pGY), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr); + IPP_BADARG_RET((cpBN_bitsize(pGX)>ECP_GFEBITS(pECC)), ippStsRangeErr); + IPP_BADARG_RET((cpBN_bitsize(pGY)>ECP_GFEBITS(pECC)), ippStsRangeErr); + IPP_BADARG_RET((cpBN_bitsize(pOrder)>ECP_ORDBITS(pECC)), ippStsRangeErr); + + /* test cofactor */ + IPP_BADARG_RET(!(0idCtx +// +// ippStsECCInvalidFlagErr invalid flag +// +// ippStsNoErr no errors +// +// Parameters: +// flag specify standard ECC parameter(s) to be setup +// pECC pointer to the ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetStd, (IppECCType flag, IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); + + switch(flag) { + case IppECCPStd112r1: + ECCPSetDP(IppECCPStd112r1, + BITS2WORD32_SIZE(112), secp112r1_p, + BITS2WORD32_SIZE(112), secp112r1_a, + BITS2WORD32_SIZE(112), secp112r1_b, + BITS2WORD32_SIZE(112), secp112r1_gx, + BITS2WORD32_SIZE(112), secp112r1_gy, + BITS2WORD32_SIZE(112), secp112r1_r, + secp112r1_h, pECC); + break; + + case IppECCPStd112r2: + ECCPSetDP(IppECCPStd112r2, + BITS2WORD32_SIZE(112), secp112r2_p, + BITS2WORD32_SIZE(112), secp112r2_a, + BITS2WORD32_SIZE(112), secp112r2_b, + BITS2WORD32_SIZE(112), secp112r2_gx, + BITS2WORD32_SIZE(112), secp112r2_gy, + BITS2WORD32_SIZE(112), secp112r2_r, + secp112r2_h, pECC); + break; + + case IppECCPStd128r1: + ECCPSetDP(IppECCPStd128r1, + BITS2WORD32_SIZE(128), secp128r1_p, + BITS2WORD32_SIZE(128), secp128r1_a, + BITS2WORD32_SIZE(128), secp128r1_b, + BITS2WORD32_SIZE(128), secp128r1_gx, + BITS2WORD32_SIZE(128), secp128r1_gy, + BITS2WORD32_SIZE(128), secp128r1_r, + secp128r1_h, pECC); + break; + + case IppECCPStd128r2: + ECCPSetDP(IppECCPStd128r2, + BITS2WORD32_SIZE(128), secp128r2_p, + BITS2WORD32_SIZE(128), secp128r2_a, + BITS2WORD32_SIZE(128), secp128r2_b, + BITS2WORD32_SIZE(128), secp128r2_gx, + BITS2WORD32_SIZE(128), secp128r2_gy, + BITS2WORD32_SIZE(128), secp128r2_r, + secp128r2_h, pECC); + break; + + case IppECCPStd160r1: + ECCPSetDP(IppECCPStd160r1, + BITS2WORD32_SIZE(160), secp160r1_p, + BITS2WORD32_SIZE(160), secp160r1_a, + BITS2WORD32_SIZE(160), secp160r1_b, + BITS2WORD32_SIZE(160), secp160r1_gx, + BITS2WORD32_SIZE(160), secp160r1_gy, + BITS2WORD32_SIZE(161), secp160r1_r, + secp160r1_h, pECC); + break; + + case IppECCPStd160r2: + ECCPSetDP(IppECCPStd160r2, + BITS2WORD32_SIZE(160), secp160r2_p, + BITS2WORD32_SIZE(160), secp160r2_a, + BITS2WORD32_SIZE(160), secp160r2_b, + BITS2WORD32_SIZE(160), secp160r2_gx, + BITS2WORD32_SIZE(160), secp160r2_gy, + BITS2WORD32_SIZE(161), secp160r2_r, + secp160r2_h, pECC); + break; + + case IppECCPStd192r1: + ECCPSetDP(IppECCPStd192r1, + BITS2WORD32_SIZE(192), secp192r1_p, + BITS2WORD32_SIZE(192), secp192r1_a, + BITS2WORD32_SIZE(192), secp192r1_b, + BITS2WORD32_SIZE(192), secp192r1_gx, + BITS2WORD32_SIZE(192), secp192r1_gy, + BITS2WORD32_SIZE(192), secp192r1_r, + secp192r1_h, pECC); + break; + + case IppECCPStd224r1: + ECCPSetDP(IppECCPStd224r1, + BITS2WORD32_SIZE(224), secp224r1_p, + BITS2WORD32_SIZE(224), secp224r1_a, + BITS2WORD32_SIZE(224), secp224r1_b, + BITS2WORD32_SIZE(224), secp224r1_gx, + BITS2WORD32_SIZE(224), secp224r1_gy, + BITS2WORD32_SIZE(224), secp224r1_r, + secp224r1_h, pECC); + break; + + case IppECCPStd256r1: + ECCPSetDP(IppECCPStd256r1, + BITS2WORD32_SIZE(256), secp256r1_p, + BITS2WORD32_SIZE(256), secp256r1_a, + BITS2WORD32_SIZE(256), secp256r1_b, + BITS2WORD32_SIZE(256), secp256r1_gx, + BITS2WORD32_SIZE(256), secp256r1_gy, + BITS2WORD32_SIZE(256), secp256r1_r, + secp256r1_h, pECC); + break; + + case IppECCPStd384r1: + ECCPSetDP(IppECCPStd384r1, + BITS2WORD32_SIZE(384), secp384r1_p, + BITS2WORD32_SIZE(384), secp384r1_a, + BITS2WORD32_SIZE(384), secp384r1_b, + BITS2WORD32_SIZE(384), secp384r1_gx, + BITS2WORD32_SIZE(384), secp384r1_gy, + BITS2WORD32_SIZE(384), secp384r1_r, + secp384r1_h, pECC); + break; + + case IppECCPStd521r1: + ECCPSetDP(IppECCPStd521r1, + BITS2WORD32_SIZE(521), secp521r1_p, + BITS2WORD32_SIZE(521), secp521r1_a, + BITS2WORD32_SIZE(521), secp521r1_b, + BITS2WORD32_SIZE(521), secp521r1_gx, + BITS2WORD32_SIZE(521), secp521r1_gy, + BITS2WORD32_SIZE(521), secp521r1_r, + secp521r1_h, pECC); + break; + + default: + return ippStsECCInvalidFlagErr; + } + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c b/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c new file mode 100644 index 0000000000..aab1fd4f29 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c @@ -0,0 +1,107 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPGenKeyPair +// +// Purpose: Generate (private,public) Key Pair +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivate +// NULL == pPublic +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivate->idCtx +// illegal pPublic->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivate pointer to the resultant private key +// pPublic pointer to the resultant public key +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPGenKeyPair, (IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, + IppsECCPState* pECC, + IppBitSupplier rndFunc, void* pRndParam)) +{ + IPP_BAD_PTR2_RET(pECC, rndFunc); + + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test private/public keys */ + IPP_BAD_PTR2_RET(pPrivate,pPublic); + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + IPP_BADARG_RET((BN_ROOM(pPrivate)*BITSIZE(BNU_CHUNK_T)MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c b/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c new file mode 100644 index 0000000000..ef7be299ea --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c @@ -0,0 +1,305 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpbnresource.h" +#include "pcpeccpmethod.h" +#include "pcpeccpsscm.h" +#include "pcptool.h" + + +/*F* +// Name: ippsECCPGetSize +// +// Purpose: Returns size of ECC context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsSizeErr 2>feBitSize +// +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pSize pointer to the size of internal ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPGetSize, (int feBitSize, int *pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr); + + { + int bn1Size; + int bn2Size; + int pointSize; + int mont1Size; + int mont2Size; + int primeSize; + int listSize; + + /* size of field element */ + int gfeSize = BITS2WORD32_SIZE(feBitSize); + /* size of order */ + int ordSize = BITS2WORD32_SIZE(feBitSize+1); + + /* size of sscm buffer */ + int w = cpECCP_OptimalWinSize(feBitSize+1); + int nPrecomputed = 1<feBitSize +// +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pECC pointer to the ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPInit, (int feBitSize, IppsECCPState* pECC)) +{ + /* test pECC pointer */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr); + + /* clear context */ + PaddBlock(0, pECC, sizeof(IppsECCPState)); + + /* context ID */ + ECP_ID(pECC) = idCtxECCP; + + /* generic EC */ + ECP_TYPE(pECC) = IppECCArbitrary; + + /* size of field element & BP order */ + ECP_GFEBITS(pECC) = feBitSize; + ECP_ORDBITS(pECC) = feBitSize+1; + + /* + // init other context fields + */ + { + int bn1Size; + int bn2Size; + int pointSize; + int mont1Size; + int mont2Size; + int primeSize; + + /* size of field element */ + int gfeSize = BITS2WORD32_SIZE(feBitSize); + /* size of order */ + int ordSize = BITS2WORD32_SIZE(feBitSize+1); + + /* size of sscm buffer */ + int w = cpECCP_OptimalWinSize(feBitSize+1); + int nPrecomputed = 1< pP==pQ (maybe both pP and pQ are at Infinity) +// returns 1 => pP!=pQ +// +// Note +// In general we check: +// P_X*Q_Z^2 ~ Q_X*P_Z^2 +// P_Y*Q_Z^3 ~ Q_Y*P_Z^3 +*/ +int ECCP_ComparePoint(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* P or/and Q at Infinity */ + if( ECCP_IsPointAtInfinity(pP) ) + return ECCP_IsPointAtInfinity(pQ)? 0:1; + if( ECCP_IsPointAtInfinity(pQ) ) + return ECCP_IsPointAtInfinity(pP)? 0:1; + + /* (P_Z==1) && (Q_Z==1) */ + if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) ) + return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1; + + { + IppsMontState* pMont = ECP_PMONT(pECC); + + IppsBigNumState* pPtmp = cpBigNumListGet(&pList); + IppsBigNumState* pQtmp = cpBigNumListGet(&pList); + IppsBigNumState* pPZ = cpBigNumListGet(&pList); + IppsBigNumState* pQZ = cpBigNumListGet(&pList); + + /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */ + if( !ECP_POINT_AFFINE(pQ) ) { + PMA_sqre(pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_X*Q_Z^2 */ + PMA_mule(pPtmp, ECP_POINT_X(pP), pQZ, pMont); + } + else { + PMA_set(pPtmp, ECP_POINT_X(pP)); + } + if( !ECP_POINT_AFFINE(pP) ) { + PMA_sqre(pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_X*P_Z^2 */ + PMA_mule(pQtmp, ECP_POINT_X(pQ), pPZ, pMont); + } + else { + PMA_set(pQtmp, ECP_POINT_X(pQ)); + } + if ( cpBN_cmp(pPtmp, pQtmp) ) + return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */ + + /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */ + if( !ECP_POINT_AFFINE(pQ) ) { + PMA_mule(pQZ, pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_Y*Q_Z^3 */ + PMA_mule(pPtmp, ECP_POINT_Y(pP), pQZ, pMont); + } + else { + PMA_set(pPtmp, ECP_POINT_Y(pP)); + } + if( !ECP_POINT_AFFINE(pP) ) { + PMA_mule(pPZ, pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_Y*P_Z^3 */ + PMA_mule(pQtmp, ECP_POINT_Y(pQ), pPZ, pMont); + } + else { + PMA_set(pQtmp, ECP_POINT_Y(pQ)); + } + return cpBN_cmp(pPtmp, pQtmp)? 1:0; + } +} + +/* +// ECCP_NegPoint +// +// Negative point +*/ +void ECCP_NegPoint(const IppsECCPPointState* pP, + IppsECCPPointState* pR, + const IppsECCPState* pECC) +{ + /* test point at Infinity */ + if( ECCP_IsPointAtInfinity(pP) ) + ECCP_SetPointToInfinity(pR); + + else { + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + if( pP!=pR ) { + PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP)); + PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP)); + } + PMA_sub(ECP_POINT_Y(pR), pModulo, ECP_POINT_Y(pP), pModulo); + ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP); + } +} + +/* +// ECCP_DblPoint +// +// Double point +*/ +void ECCP_DblPoint(const IppsECCPPointState* pP, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* P at infinity */ + if( ECCP_IsPointAtInfinity(pP) ) + ECCP_SetPointToInfinity(pR); + + else { + IppsMontState* pMont = ECP_PMONT(pECC); + + IppsBigNumState* bnV = cpBigNumListGet(&pList); + IppsBigNumState* bnU = cpBigNumListGet(&pList); + IppsBigNumState* bnM = cpBigNumListGet(&pList); + IppsBigNumState* bnS = cpBigNumListGet(&pList); + IppsBigNumState* bnT = cpBigNumListGet(&pList); + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + /* M = 3*X^2 + A*Z^4 */ + if( ECP_POINT_AFFINE(pP) ) { + PMA_sqre(bnU, ECP_POINT_X(pP), pMont); + PMA_add(bnM, bnU, bnU, pModulo); + PMA_add(bnM, bnM, bnU, pModulo); + PMA_add(bnM, bnM, ECP_AENC(pECC), pModulo); + } + else if( ECP_AMI3(pECC) ) { + PMA_sqre(bnU, ECP_POINT_Z(pP), pMont); + PMA_add(bnS, ECP_POINT_X(pP), bnU, pModulo); + PMA_sub(bnT, ECP_POINT_X(pP), bnU, pModulo); + PMA_mule(bnM, bnS, bnT, pMont); + PMA_add(bnU, bnM, bnM, pModulo); + PMA_add(bnM, bnU, bnM, pModulo); + } + else { + PMA_sqre(bnU, ECP_POINT_X(pP), pMont); + PMA_add(bnM, bnU, bnU, pModulo); + PMA_add(bnM, bnM, bnU, pModulo); + PMA_sqre(bnU, ECP_POINT_Z(pP), pMont); + PMA_sqre(bnU, bnU, pMont); + PMA_mule(bnU, bnU, ECP_AENC(pECC), pMont); + PMA_add(bnM, bnM, bnU, pModulo); + } + + PMA_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP), pModulo); + + /* R_Z = 2*Y*Z */ + if( ECP_POINT_AFFINE(pP) ) { + PMA_set(ECP_POINT_Z(pR), bnV); + } + else { + PMA_mule(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP), pMont); + } + + /* S = 4*X*Y^2 */ + PMA_sqre(bnT, bnV, pMont); + PMA_mule(bnS, bnT, ECP_POINT_X(pP), pMont); + + /* R_X = M^2 - 2*S */ + PMA_sqre(bnU, bnM, pMont); + PMA_sub(bnU, bnU, bnS, pModulo); + PMA_sub(ECP_POINT_X(pR), bnU, bnS, pModulo); + + /* T = 8*Y^4 */ + PMA_mule(bnV, bnV, ECP_POINT_Y(pP), pMont); + PMA_mule(bnT, bnT, bnV, pMont); + + /* R_Y = M*(S - R_X) - T */ + PMA_sub(bnS, bnS, ECP_POINT_X(pR), pModulo); + PMA_mule(bnS, bnS, bnM, pMont); + PMA_sub(ECP_POINT_Y(pR), bnS, bnT, pModulo); + + ECP_POINT_AFFINE(pR) = 0; + } +} + +/* +// ECCP_AddPoint +// +// Add points +*/ +void ECCP_AddPoint(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* prevent operation with point at Infinity */ + if( ECCP_IsPointAtInfinity(pP) ) { + ECCP_CopyPoint(pQ, pR); + return; + } + if( ECCP_IsPointAtInfinity(pQ) ) { + ECCP_CopyPoint(pP, pR); + return; + } + + /* + // addition + */ + { + IppsMontState* pMont = ECP_PMONT(pECC); + + IppsBigNumState* bnU0 = cpBigNumListGet(&pList); + IppsBigNumState* bnS0 = cpBigNumListGet(&pList); + IppsBigNumState* bnU1 = cpBigNumListGet(&pList); + IppsBigNumState* bnS1 = cpBigNumListGet(&pList); + IppsBigNumState* bnW = cpBigNumListGet(&pList); + IppsBigNumState* bnR = cpBigNumListGet(&pList); + IppsBigNumState *bnT = bnU0; + IppsBigNumState *bnM = bnS0; + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + /* U0 = P_X * Q_Z^2 */ + /* S0 = P_Y * Q_Z^3 */ + if( ECP_POINT_AFFINE(pQ) ) { + PMA_set(bnU0, ECP_POINT_X(pP)); + PMA_set(bnS0, ECP_POINT_Y(pP)); + } + else { + PMA_sqre(bnW, ECP_POINT_Z(pQ), pMont); + PMA_mule(bnU0,ECP_POINT_X(pP), bnW, pMont); + PMA_mule(bnW, ECP_POINT_Z(pQ), bnW, pMont); + PMA_mule(bnS0,ECP_POINT_Y(pP), bnW, pMont); + } + + /* U1 = Q_X * P_Z^2 */ + /* S1 = Q_Y * P_Z^3 */ + if( ECP_POINT_AFFINE(pP) ) { + PMA_set(bnU1, ECP_POINT_X(pQ)); + PMA_set(bnS1, ECP_POINT_Y(pQ)); + } + else { + PMA_sqre(bnW, ECP_POINT_Z(pP), pMont); + PMA_mule(bnU1,ECP_POINT_X(pQ), bnW, pMont); + PMA_mule(bnW, ECP_POINT_Z(pP), bnW, pMont); + PMA_mule(bnS1,ECP_POINT_Y(pQ), bnW, pMont); + } + + /* W = U0-U1 */ + /* R = S0-S1 */ + PMA_sub(bnW, bnU0, bnU1, pModulo); + PMA_sub(bnR, bnS0, bnS1, pModulo); + + if( IsZero_BN(bnW) ) { + if( IsZero_BN(bnR) ) { + ECCP_DblPoint(pP, pR, pECC, pList); + return; + } + else { + ECCP_SetPointToInfinity(pR); + return; + } + } + + /* T = U0+U1 */ + /* M = S0+S1 */ + PMA_add(bnT, bnU0, bnU1, pModulo); + PMA_add(bnM, bnS0, bnS1, pModulo); + + /* R_Z = P_Z * Q_Z * W */ + if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) { + PMA_set(ECP_POINT_Z(pR), bnW); + } + else { + if( ECP_POINT_AFFINE(pQ) ) { + PMA_set(bnU1, ECP_POINT_Z(pP)); + } + else if( ECP_POINT_AFFINE(pP) ) { + PMA_set(bnU1, ECP_POINT_Z(pQ)); + } + else { + PMA_mule(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ), pMont); + } + PMA_mule(ECP_POINT_Z(pR), bnU1, bnW, pMont); + } + + PMA_sqre(bnU1, bnW, pMont); /* U1 = W^2 */ + PMA_mule(bnS1, bnT, bnU1, pMont); /* S1 = T * W^2 */ + + /* R_X = R^2 - T * W^2 */ + PMA_sqre(ECP_POINT_X(pR), bnR, pMont); + PMA_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1, pModulo); + + /* V = T * W^2 - 2 * R_X (S1) */ + PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo); + PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo); + + /* R_Y = (V * R - M * W^3) /2 */ + PMA_mule(ECP_POINT_Y(pR), bnS1, bnR, pMont); + PMA_mule(bnU1, bnU1, bnW, pMont); + PMA_mule(bnU1, bnU1, bnM, pMont); + PMA_sub(bnU1, ECP_POINT_Y(pR), bnU1, pModulo); + PMA_div2(ECP_POINT_Y(pR), bnU1, pModulo); + + ECP_POINT_AFFINE(pR) = 0; + } +} + +/* +// ECCP_MulPoint +// +// Multiply point by scalar +*/ +void ECCP_MulPoint(const IppsECCPPointState* pP, + const IppsBigNumState* bnN, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* test zero scalar or input point at Infinity */ + if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) { + ECCP_SetPointToInfinity(pR); + return; + } + + /* + // scalar multiplication + */ + else { + Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC); + + BNU_CHUNK_T* pN = BN_NUMBER(bnN); + cpSize nsN = BN_SIZE(bnN); + /* scalar bitsize */ + int scalarBitSize = BITSIZE_BNU(pN, nsN); + /* optimal size of window */ + int w = cpECCP_OptimalWinSize(scalarBitSize); + /* number of table entries */ + int nPrecomputed = 1<>shift) & dmask; + + /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */ + cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed); + ECP_POINT_AFFINE(pR) = 0; + + /* initialize temporary T (ECP_PROJECTIVE) */ + ECP_POINT_AFFINE(&T) = 0; + + for(wPosition-=w; wPosition>=0; wPosition-=w) { + /* w times doubling */ + int k; + for(k=0; k>shift) & dmask; + + /* extract value from the pre-computed table */ + cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed); + + /* and add it */ + ECCP_AddPoint(pR, &T, pR, pECC, pList); + } + } + } +} + + +void ECCP_MulBasePoint(const IppsBigNumState* pK, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + ECCP_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList); +} + +/* +// ECCP_ProdPoint +// +// Point product +*/ +void ECCP_ProdPoint(const IppsECCPPointState* pP, + const IppsBigNumState* bnPscalar, + const IppsECCPPointState* pQ, + const IppsBigNumState* bnQscalar, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + IppsECCPPointState T; + IppsECCPPointState U; + + ECP_POINT_X(&T) = cpBigNumListGet(&pList); + ECP_POINT_Y(&T) = cpBigNumListGet(&pList); + ECP_POINT_Z(&T) = cpBigNumListGet(&pList); + + ECP_POINT_X(&U) = cpBigNumListGet(&pList); + ECP_POINT_Y(&U) = cpBigNumListGet(&pList); + ECP_POINT_Z(&U) = cpBigNumListGet(&pList); + + ECCP_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList); + ECCP_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList); + ECCP_AddPoint(&T, &U, pR, pECC, pList); +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppoint.h b/external/crypto_px/sources/ippcp/src/pcpeccppoint.h new file mode 100644 index 0000000000..62c2cadc84 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccppoint.h @@ -0,0 +1,60 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_ECCPPOINT_H) +#define _PCP_ECCPPOINT_H + +#include "pcpeccp.h" + + +/* +// EC Point context +*/ +struct _cpECCPPoint { + IppCtxId idCtx; /* EC Point identifier */ + + IppsBigNumState* pX; /* projective X */ + IppsBigNumState* pY; /* Y */ + IppsBigNumState* pZ; /* Z coordinates */ + int affine; /* impotrant case Z=1 */ +}; + +/* +// Contetx Access Macros +*/ +#define ECP_POINT_ID(ctx) ((ctx)->idCtx) +#define ECP_POINT_X(ctx) ((ctx)->pX) +#define ECP_POINT_Y(ctx) ((ctx)->pY) +#define ECP_POINT_Z(ctx) ((ctx)->pZ) +#define ECP_POINT_AFFINE(ctx) ((ctx)->affine) +#define ECP_POINT_VALID_ID(ctx) (ECP_POINT_ID((ctx))==idCtxECCPPoint) + +#endif /* _PCP_ECCPPOINT_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppointca.c b/external/crypto_px/sources/ippcp/src/pcpeccppointca.c new file mode 100644 index 0000000000..edd94e5452 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccppointca.c @@ -0,0 +1,128 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" + + +/*F* +// Name: ippsECCPPointGetSize +// +// Purpose: Returns size of EC Point context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSzie +// ippStsSizeErr 2>feBitSize +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pSize pointer to the size of EC Point context +// +*F*/ +IPPFUN(IppStatus, ippsECCPPointGetSize, (int feBitSize, int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize), ippStsSizeErr); + + { + int bnSize; + ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize); + *pSize = sizeof(IppsECCPPointState) + + bnSize /* X coodinate */ + + bnSize /* Y coodinate */ + + bnSize /* Z coodinate */ + +(ALIGN_VAL-1); + } + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPPointInit +// +// Purpose: Init EC Point context. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pPoint +// ippStsSizeErr 2>feBitSize +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pECC pointer to ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPPointInit, (int feBitSize, IppsECCPPointState* pPoint)) +{ + /* test pEC pointer */ + IPP_BAD_PTR1_RET(pPoint); + + /* use aligned context */ + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize), ippStsSizeErr); + + /* context ID */ + ECP_POINT_ID(pPoint) = idCtxECCPPoint; + + /* meaning: point was not set */ + ECP_POINT_AFFINE(pPoint) =-1; + + /* + // init other context fields + */ + { + Ipp8u* ptr = (Ipp8u*)pPoint; + int bnLen = BITS2WORD32_SIZE(feBitSize); + int bnSize; + ippsBigNumGetSize(bnLen, &bnSize); + + /* allocate coordinate buffers */ + ptr += sizeof(IppsECCPPointState); + ECP_POINT_X(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); + ptr += bnSize; + ECP_POINT_Y(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); + ptr += bnSize; + ECP_POINT_Z(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); + + /* init coordinate buffers */ + ippsBigNumInit(bnLen, ECP_POINT_X(pPoint)); + ippsBigNumInit(bnLen, ECP_POINT_Y(pPoint)); + ippsBigNumInit(bnLen, ECP_POINT_Z(pPoint)); + } + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c b/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c new file mode 100644 index 0000000000..26c0fc71bf --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c @@ -0,0 +1,476 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSetPoint +// +// Purpose: Converts regular affine coordinates EC point (pX,pY) +// into internal presentation - montgomery projective. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPoint +// NULL == pX +// NULL == pY +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pX->idCtx +// illegal pY->idCtx +// illegal pPoint->idCtx +// +// ippStsOutOfECErr point out-of EC +// +// ippStsNoErr no errors +// +// Parameters: +// pX pointer to the regular affine coordinate X +// pY pointer to the regular affine coordinate Y +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// +// Note: +// if B==0 and (x,y)=(0,y) then point at Infinity will be set up +// if B!=0 and (x,y)=(0,0) then point at Infinity will be set up +// else point with requested coordinates (x,y) wil be set up +// There are no check validation inside! +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, + const IppsBigNumState* pY, + IppsECCPPointState* pPoint, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test pX and pY */ + IPP_BAD_PTR2_RET(pX,pY); + pX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pX, ALIGN_VAL) ); + pY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr); + + /* test pPoint */ + IPP_BAD_PTR1_RET(pPoint); + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); + + /* set affine coordinates at Infinity */ + if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(pX,pY)) || + (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(pX,pY)) ) + ECCP_SetPointToInfinity(pPoint); + /* set point */ + else { + ECP_METHOD(pECC)->SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC); + } + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPSetPointAtInfinity +// +// Purpose: Set point at Infinity +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPoint +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPoint->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test pPoint */ + IPP_BAD_PTR1_RET(pPoint); + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); + + ECCP_SetPointToInfinity(pPoint); + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPGetPoint +// +// Purpose: Converts internal presentation EC point - montgomery projective +// into regular affine coordinates EC point (pX,pY) +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPoint +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPoint->idCtx +// NULL != pX, illegal pX->idCtx +// NULL != pY, illegal pY->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pX pointer to the regular affine coordinate X +// pY pointer to the regular affine coordinate Y +// pLength pointer to the length of coordinates +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, + IppsBigNumState* pY, + const IppsECCPPointState* pPoint, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test source point */ + IPP_BAD_PTR1_RET(pPoint); + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); + + /* test pX and pY */ + if(pX) { + pX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pX, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr); + } + if(pY) { + pY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr); + } + + if( ECCP_IsPointAtInfinity(pPoint) ) { + if( IsZero_BN(ECP_BENC(pECC)) ) + ECCP_SetPointToAffineInfinity1(pX, pY); + else + ECCP_SetPointToAffineInfinity0(pX, pY); + } + else + ECP_METHOD(pECC)->GetPointAffine(pX, pY, pPoint, pECC, ECP_BNCTX(pECC)); + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPCheckPoint +// +// Purpose: Check EC point: +// - is point lie on EC +// - is point at infinity +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pResult +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// pResult pointer to the result: +// ippECValid +// ippECPointIsNotValid +// ippECPointIsAtInfinite +// +*F*/ +IPPFUN(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP, + IppECResult* pResult, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test point */ + IPP_BAD_PTR1_RET(pP); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + + /* test pResult */ + IPP_BAD_PTR1_RET(pResult); + + if( ECCP_IsPointAtInfinity(pP) ) + *pResult = ippECPointIsAtInfinite; + else if( ECP_METHOD(pECC)->IsPointOnCurve(pP, pECC, ECP_BNCTX(pECC)) ) + *pResult = ippECValid; + else + *pResult = ippECPointIsNotValid; + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPComparePoint +// +// Purpose: Compare two EC points +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pQ +// NULL == pResult +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pQ->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the EC Point context +// pQ pointer to the EC Point context +// pECC pointer to the ECCP context +// pResult pointer to the result: +// ippECPointIsEqual +// ippECPointIsNotEqual +// +*F*/ +IPPFUN(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + IppECResult* pResult, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR2_RET(pP,pQ); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr); + + /* test pResult */ + IPP_BAD_PTR1_RET(pResult); + + *pResult = ECP_METHOD(pECC)->ComparePoint(pP, pQ, pECC, ECP_BNCTX(pECC))? ippECPointIsNotEqual : ippECPointIsEqual; + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPNegativePoint +// +// Purpose: Perforn EC point operation: R = -P +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pR +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pR->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the source EC Point context +// pR pointer to the resultant EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPNegativePoint, (const IppsECCPPointState* pP, + IppsECCPPointState* pR, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR2_RET(pP,pR); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); + + ECP_METHOD(pECC)->NegPoint(pP, pR, pECC); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPAddPoint +// +// Purpose: Perforn EC point operation: R = P+Q +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pQ +// NULL == pR +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pQ->idCtx +// illegal pR->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the source EC Point context +// pQ pointer to the source EC Point context +// pR pointer to the resultant EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + IppsECCPPointState* pR, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR3_RET(pP,pQ,pR); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) ); + pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); + + if(pP==pQ) + ECP_METHOD(pECC)->DblPoint(pP, pR, pECC, ECP_BNCTX(pECC)); + else + ECP_METHOD(pECC)->AddPoint(pP, pQ, pR, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPMulPointScalar +// +// Purpose: Perforn EC point operation: R = k*P +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pK +// NULL == pR +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pK->idCtx +// illegal pR->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the source EC Point context +// pK pointer to the source BigNum multiplier context +// pR pointer to the resultant EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, + const IppsBigNumState* pK, + IppsECCPPointState* pR, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR2_RET(pP,pR); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); + + /* test scalar */ + IPP_BAD_PTR1_RET(pK); + pK = (IppsBigNumState*)( IPP_ALIGNED_PTR(pK, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pK), ippStsContextMatchErr); + + ECP_METHOD(pECC)->MulPoint(pP, pK, pR, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c b/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c new file mode 100644 index 0000000000..d4a4408c98 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c @@ -0,0 +1,89 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPPublicKey +// +// Purpose: Calculate Public Key +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivate +// NULL == pPublic +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivate->idCtx +// illegal pPublic->idCtx +// +// ippStsIvalidPrivateKey !(0 < pPrivate < order) +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivate pointer to the private key +// pPublic pointer to the resultant public key +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPPublicKey, (const IppsBigNumState* pPrivate, + IppsECCPPointState* pPublic, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test public key */ + IPP_BAD_PTR1_RET(pPublic); + pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr); + + /* test private keys */ + IPP_BAD_PTR1_RET(pPrivate); + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + IPP_BADARG_RET(!((0cpBN_cmp(pPrivate, ECP_ORDER(pECC))) ), ippStsIvalidPrivateKey); + + /* calculates public key */ + ECP_METHOD(pECC)->MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c b/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c new file mode 100644 index 0000000000..05d3c10233 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c @@ -0,0 +1,116 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSharedSecretDH +// +// Purpose: Shared Secret Value Derivation +// (Diffie-Hellman version). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivateA +// NULL == pPublicB +// NULL == pShare +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivateA->idCtx +// illegal pPublicB->idCtx +// illegal pShare->idCtx +// +// ippStsRangeErr not enough room for share key +// +// ippStsShareKeyErr (infinity) => z +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivateA pointer to own private key +// pPublicB pointer to alien public key +// pShare pointer to the shareds secret value +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, + const IppsECCPPointState* pPublicB, + IppsBigNumState* pShare, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test private (own) key */ + IPP_BAD_PTR1_RET(pPrivateA); + pPrivateA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivateA, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivateA), ippStsContextMatchErr); + + /* test public (other party) key */ + IPP_BAD_PTR1_RET(pPublicB); + pPublicB = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublicB, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublicB), ippStsContextMatchErr); + + /* test share secret value */ + IPP_BAD_PTR1_RET(pShare); + pShare = (IppsBigNumState*)( IPP_ALIGNED_PTR(pShare, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pShare), ippStsContextMatchErr); + IPP_BADARG_RET((BN_ROOM(pShare)*BITSIZE(BNU_CHUNK_T)MulPoint(pPublicB, pPrivateA, &Tmp, pECC, pList); + + /* test: Tmp ~ point at Infinity */ + if( ECCP_IsPointAtInfinity(&Tmp) ) + return ippStsShareKeyErr; + else { + ECP_METHOD(pECC)->GetPointAffine(pShare, NULL, &Tmp, pECC, pList); + return ippStsNoErr; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c b/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c new file mode 100644 index 0000000000..bb3463cfc1 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c @@ -0,0 +1,105 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSetKeyPair +// +// Purpose: Generate (private,public) Key Pair +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivate +// NULL == pPublic +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivate->idCtx +// illegal pPublic->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivate pointer to the private key +// pPublic pointer to the public key +// regular flag regular/ephemeral keys +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetKeyPair, (const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, + IppBool regular, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + { + IppsBigNumState* targetPrivate; + IppsECCPPointState* targetPublic; + + if( regular ) { + targetPrivate = ECP_PRIVATE(pECC); + targetPublic = ECP_PUBLIC(pECC); + } + else { + targetPrivate = ECP_PRIVATE_E(pECC); + targetPublic = ECP_PUBLIC_E(pECC); + } + + /* set up private key request */ + if( pPrivate ) { + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + ippsSet_BN(ippBigNumPOS, BN_SIZE32(pPrivate), (Ipp32u*)BN_NUMBER(pPrivate), targetPrivate); + } + + /* set up public key request */ + if( pPublic ) { + pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr); + + ECP_METHOD(pECC)->GetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), pPublic, pECC, ECP_BNCTX(pECC)); + ECP_METHOD(pECC)->SetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), targetPublic, pECC); + } + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c b/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c new file mode 100644 index 0000000000..ca9a9dbe9d --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c @@ -0,0 +1,149 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSignDSA +// +// Purpose: Signing of message representative. +// (DSA version). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pMsgDigest +// NULL == pPrivate +// NULL == pSignX +// NULL == pSignY +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pMsgDigest->idCtx +// illegal pPrivate->idCtx +// illegal pSignX->idCtx +// illegal pSignY->idCtx +// +// ippStsMessageErr MsgDigest >= order +// +// ippStsRangeErr not enough room for: +// signX +// signY +// +// ippStsEphemeralKeyErr (0==signX) || (0==signY) +// +// ippStsNoErr no errors +// +// Parameters: +// pMsgDigest pointer to the message representative to be signed +// pPrivate pointer to the regular private key +// pSignX,pSignY pointer to the signature +// pECC pointer to the ECCP context +// +// Note: +// - ephemeral key pair extracted from pECC and +// must be generated and before ippsECCPDSASign() usage +// - ephemeral key pair destroy before exit +// +*F*/ +IPPFUN(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pPrivate, + IppsBigNumState* pSignX, IppsBigNumState* pSignY, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test private key*/ + IPP_BAD_PTR1_RET(pPrivate); + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + + /* test message representative */ + IPP_BAD_PTR1_RET(pMsgDigest); + pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr); + IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr); + + /* test signature */ + IPP_BAD_PTR2_RET(pSignX,pSignY); + pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) ); + pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr); + IPP_BADARG_RET((BN_ROOM(pSignX)*BITSIZE(BNU_CHUNK_T)GetPointAffine(pTmp, NULL, ECP_PUBLIC_E(pECC), pECC, pList); + + /* + // compute + // signX = eph_pub_x (mod order) + */ + PMA_mod(pSignX, pTmp, pOrder); + if( !IsZero_BN(pSignX) ) { + + IppsBigNumState* pEncMsg = cpBigNumListGet(&pList); + IppsBigNumState* pEncSignX = cpBigNumListGet(&pList); + PMA_enc(pEncMsg, (IppsBigNumState*)pMsgDigest, rMont); + PMA_enc(pEncSignX, pSignX, rMont); + + /* + // compute + // signY = (1/eph_private)*(pMsgDigest + private*signX) (mod order) + */ + PMA_inv(pSignY, ECP_PRIVATE_E(pECC), pOrder); + PMA_enc(ECP_PRIVATE_E(pECC), pPrivate, rMont); + PMA_mule(pTmp, ECP_PRIVATE_E(pECC), pEncSignX, rMont); + PMA_add(pTmp, pTmp, pEncMsg, pOrder); + PMA_mule(pSignY, pSignY, pTmp, rMont); + if( !IsZero_BN(pSignY) ) + return ippStsNoErr; + } + + return ippStsEphemeralKeyErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c b/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c new file mode 100644 index 0000000000..c2b08f3fd7 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c @@ -0,0 +1,161 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpeccppoint.h" + + +#define LOG2_CACHE_LINE_SIZE (LOG_CACHE_LINE_SIZE) + +static int div_upper(int a, int d) +{ return (a+d-1)/d; } + +static int getNumOperations(int bitsize, int w) +{ + int n_overhead = (1<=n_opt) break; + w_opt = w_trial; + n_opt = n_trial; + } + return w_opt; +#undef LIMIT +} + +int cpECCP_ConvertRepresentation(BNU_CHUNK_T* pInput, int inpBits, int w) +{ + Ipp32u* pR = (Ipp32u*)pInput; + Ipp16u* pR16 = (Ipp16u*)pInput; + + int outBits = 0; + Ipp32u base = (BNU_CHUNK_T)1<>digitShift) &digitMask; + + Ipp32u delta = (base-digit) & ~digitMask; + delta <<= digitShift; + cpDec_BNU32((Ipp32u*)(pR16+chunkIdx), (Ipp32u*)(pR16+chunkIdx), (2*nsR-chunkIdx+1)/2, delta); + + inpBits = BITSIZE_BNU32(pR, nsR); + outBits += w; + } + + return outBits; +} + +/* +// cpsScramblePut/cpsScrambleGet +// stores to/retrieves from pScrambleEntry position +// pre-computed data if fixed window method is used +*/ +void cpECCP_ScramblePut(Ipp8u* pScrambleEntry, int proposity, + const IppsECCPPointState* pPoint, cpSize coordLen) +{ + int i; + Ipp8u* pCoord; + + BNU_CHUNK_T* pX = BN_NUMBER(ECP_POINT_X(pPoint)); + BNU_CHUNK_T* pY = BN_NUMBER(ECP_POINT_Y(pPoint)); + BNU_CHUNK_T* pZ = BN_NUMBER(ECP_POINT_Z(pPoint)); + int coordSize = coordLen*sizeof(BNU_CHUNK_T); + + ZEXPAND_BNU(pX, BN_SIZE(ECP_POINT_X(pPoint)), coordLen); + ZEXPAND_BNU(pY, BN_SIZE(ECP_POINT_Y(pPoint)), coordLen); + ZEXPAND_BNU(pZ, BN_SIZE(ECP_POINT_Z(pPoint)), coordLen); + + pCoord = (Ipp8u*)pX; + for(i=0; iidCtx +// illegal pMsgDigest->idCtx +// illegal pSignX->idCtx +// illegal pSignY->idCtx +// +// ippStsMessageErr MsgDigest >= order +// +// ippStsNoErr no errors +// +// Parameters: +// pMsgDigest pointer to the message representative to be signed +// pSignX,pSignY pointer to the signature +// pResult pointer to the result: ippECValid/ippECInvalidSignature +// pECC pointer to the ECCP context +// +// Note: +// - signer's key must be set up in ECCP context +// before ippsECCPVerifyDSA() usage +// +*F*/ +IPPFUN(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, + IppECResult* pResult, + IppsECCPState* pECC)) +{ + IppsMontState* rMont; + + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test message representative */ + IPP_BAD_PTR1_RET(pMsgDigest); + pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr); + rMont = ECP_RMONT(pECC); + IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr); + + /* test result */ + IPP_BAD_PTR1_RET(pResult); + + /* test signature */ + IPP_BAD_PTR2_RET(pSignX,pSignY); + pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) ); + pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr); + + /* test signature value */ + if( (0>cpBN_tst(pSignX)) || (0>cpBN_tst(pSignY)) || + (0<=cpBN_cmp(pSignX, ECP_ORDER(pECC))) || + (0<=cpBN_cmp(pSignY, ECP_ORDER(pECC))) ) { + *pResult = ippECInvalidSignature; + return ippStsNoErr; + } + + /* validate signature */ + else { + IppsECCPPointState P1; + + BigNumNode* pList = ECP_BNCTX(pECC); + IppsBigNumState* pH1 = cpBigNumListGet(&pList); + IppsBigNumState* pH2 = cpBigNumListGet(&pList); + IppsBigNumState* pOrder = cpBigNumListGet(&pList); + BN_Set(MNT_MODULUS(rMont), MNT_SIZE(rMont), pOrder); + + ECP_POINT_X(&P1) = cpBigNumListGet(&pList); + ECP_POINT_Y(&P1) = cpBigNumListGet(&pList); + ECP_POINT_Z(&P1) = cpBigNumListGet(&pList); + + PMA_inv(pH1, (IppsBigNumState*)pSignY, pOrder);/* h = 1/signY (mod order) */ + PMA_enc(pH1, pH1, rMont); + PMA_mule(pH2, (IppsBigNumState*)pSignX, pH1, rMont); /* h2 = pSignX * h (mod order) */ + PMA_mule(pH1, (IppsBigNumState*)pMsgDigest, pH1, rMont); /* h1 = pMsgDigest * h (mod order) */ + + /* compute h1*BasePoint + h2*publicKey */ + ECP_METHOD(pECC)->ProdPoint(ECP_GENC(pECC), pH1, + ECP_PUBLIC(pECC), pH2, + &P1, pECC, pList); + + if( ECCP_IsPointAtInfinity(&P1) ) { + *pResult = ippECInvalidSignature; + return ippStsNoErr; + } + /* extract X component */ + ECP_METHOD(pECC)->GetPointAffine(pH1, NULL, &P1, pECC, pList); + /* compare with signX */ + PMA_mod(pH1, pH1, pOrder); + *pResult = (0==cpBN_cmp(pH1, pSignX))? ippECValid : ippECInvalidSignature; + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphash.h b/external/crypto_px/sources/ippcp/src/pcphash.h new file mode 100644 index 0000000000..1dccb86b36 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphash.h @@ -0,0 +1,159 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_HASH_H) +#define _PCP_HASH_H + + +/* messge block size */ +#define MBS_SHA1 (64) /* SHA1 message block size (bytes) */ +#define MBS_SHA256 (64) /* SHA256 and SHA224 */ +#define MBS_SHA224 (64) /* SHA224 */ +#define MBS_SHA512 (128) /* SHA512 and SHA384 */ +#define MBS_SHA384 (128) /* SHA384 */ +#define MBS_MD5 (64) /* MD5 */ +#define MBS_HASH_MAX (MBS_SHA512) /* max message block size (bytes) */ +#define MAX_HASH_SIZE (IPP_SHA512_DIGEST_BITSIZE/8) /* hash of the max len (bytes) */ + +/* +// Useful macros +*/ +#define SHS_ID(stt) ((stt)->idCtx) +#define SHS_INDX(stt) ((stt)->index) +#define SHS_LENL(stt) ((stt)->msgLenLo) +#define SHS_LENH(stt) ((stt)->msgLenHi) +#define SHS_BUFF(stt) ((stt)->msgBuffer) +#define SHS_HASH(stt) ((stt)->msgHash) + +/* initial hash values */ +extern const Ipp32u SHA1_IV[]; +extern const Ipp32u SHA256_IV[]; +extern const Ipp32u SHA224_IV[]; +extern const Ipp64u SHA512_IV[]; +extern const Ipp64u SHA384_IV[]; +extern const Ipp32u MD5_IV[]; +extern const Ipp64u SHA512_224_IV[]; +extern const Ipp64u SHA512_256_IV[]; + +/* hash alg additive constants */ +extern __ALIGN16 const Ipp32u SHA1_cnt[]; +extern __ALIGN16 const Ipp32u SHA256_cnt[]; +extern __ALIGN16 const Ipp64u SHA512_cnt[]; +extern __ALIGN16 const Ipp32u MD5_cnt[]; + + +/* hash alg attributes */ +typedef struct _cpHashAttr { + int ivSize; /* attr: length (bytes) of initial value cpHashIV */ + int hashSize; /* attr: length (bytes) of hash */ + int msgBlkSize; /* attr: length (bytes) of message block */ + int msgLenRepSize; /* attr: length (bytes) in representation of processed message length */ + Ipp64u msgLenMax[2]; /* attr: max message length (bytes) (low high) */ +} cpHashAttr; + + +/* hash value */ +typedef Ipp64u cpHash[IPP_SHA512_DIGEST_BITSIZE/BITSIZE(Ipp64u)]; /* hash value */ + +/* hash update function */ +typedef void (*cpHashProc)(void* pHash, const Ipp8u* pMsg, int msgLen, const void* pParam); + + + +/* hash context */ +struct _cpHashCtx { + IppCtxId idCtx; /* hash identifier */ + IppHashAlgId algID; /* hash algorithm ID */ + Ipp64u msgLenLo; /* length (bytes) of processed message: */ + Ipp64u msgLenHi; /* low and high parts */ + cpHashProc hashProc; /* hash update function */ + const void* pParam; /* optional hashProc's parameter */ + cpHash hashVal; /* intermadiate has value */ + int buffOffset; /* current buffer position */ + Ipp8u msgBuffer[MBS_HASH_MAX]; /* buffer */ +}; + +/* accessors */ +#define HASH_CTX_ID(stt) ((stt)->idCtx) +#define HASH_ALG_ID(stt) ((stt)->algID) +#define HASH_LENLO(stt) ((stt)->msgLenLo) +#define HASH_LENHI(stt) ((stt)->msgLenHi) +#define HASH_FUNC(stt) ((stt)->hashProc) +#define HASH_FUNC_PAR(stt) ((stt)->pParam) +#define HASH_VALUE(stt) ((stt)->hashVal) +#define HAHS_BUFFIDX(stt) ((stt)->buffOffset) +#define HASH_BUFF(stt) ((stt)->msgBuffer) +#define HASH_VALID_ID(pCtx) (HASH_CTX_ID((pCtx))==idCtxHash) + + +/* hash alg opt argument */ +extern const void* cpHashProcFuncOpt[]; + +/* enabled hash alg */ +extern const IppHashAlgId cpEnabledHashAlgID[]; + +/* hash alg IV (init value) */ +extern const Ipp8u* cpHashIV[]; + +/* hash alg attribute DB */ +extern const cpHashAttr cpHashAlgAttr[]; + +/* IV size helper */ +__INLINE int cpHashIvSize(IppHashAlgId algID) +{ return cpHashAlgAttr[algID].ivSize; } + +/* hash size helper */ +__INLINE int cpHashSize(IppHashAlgId algID) +{ return cpHashAlgAttr[algID].hashSize; } + +/* message block size helper */ +__INLINE int cpHashMBS(IppHashAlgId algID) +{ return cpHashAlgAttr[algID].msgBlkSize; } + +/* maps algID into enabled IppHashAlgId value */ +__INLINE IppHashAlgId cpValidHashAlg(IppHashAlgId algID) +{ + /* maps algID into the valid range */ + algID = (((int)ippHashAlg_Unknown < (int)algID) && ((int)algID < (int)ippHashAlg_MaxNo))? algID : ippHashAlg_Unknown; + return cpEnabledHashAlgID[algID]; +} + + +/* processing functions */ +void UpdateSHA1 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); +void UpdateSHA256(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); +void UpdateSHA512(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); +void UpdateMD5 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); + +/* general methods */ +int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID); + +#endif /* _PCP_HASH_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcphashca.c b/external/crypto_px/sources/ippcp/src/pcphashca.c new file mode 100644 index 0000000000..f80272c04b --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphashca.c @@ -0,0 +1,513 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/*F* +// Name: ippsHashGetSize +// +// Purpose: Returns size (bytes) of IppsHashState state. +// +// Returns: Reason: +// ippStsNullPtrErr pSize == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to state size +// +*F*/ +IPPFUN(IppStatus, ippsHashGetSize,(int* pSize)) +{ + /* test pointers */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = sizeof(IppsHashState); + return ippStsNoErr; +} + + +/*F* +// Name: ippsHashInit +// +// Purpose: Init Hash state. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pCtx pointer to the Hash state +// algID hash alg ID +// +*F*/ +int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID) +{ + int hashIvSize = cpHashIvSize(algID); + const Ipp8u* iv = cpHashIV[algID]; + + HASH_LENLO(pCtx) = CONST_64(0); + HASH_LENHI(pCtx) = CONST_64(0); + HAHS_BUFFIDX(pCtx) = 0; + CopyBlock(iv, HASH_VALUE(pCtx), hashIvSize); + + return hashIvSize; +} + +/* +// hash alg default processing functions and opt argument +*/ +static cpHashProc cpHashProcFunc[] = { + (cpHashProc)NULL, + UpdateSHA1, + UpdateSHA256, + UpdateSHA256, + UpdateSHA512, + UpdateSHA512, + UpdateMD5, + UpdateSHA512, + UpdateSHA512, +}; + +int cpInitHash(IppsHashState* pCtx, IppHashAlgId algID) +{ + /* setup default processing function */ + HASH_FUNC(pCtx) = cpHashProcFunc[algID]; + + /* setup optional agr of processing function */ + HASH_FUNC_PAR(pCtx) = cpHashProcFuncOpt[algID]; + + return cpReInitHash(pCtx, algID); +} + +IPPFUN(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId algID)) +{ + /* get algorithm id */ + algID = cpValidHashAlg(algID); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr); + + /* test ctx pointer */ + IPP_BAD_PTR1_RET(pCtx); + /* test hash alg */ + + /* set ctx ID */ + HASH_CTX_ID(pCtx) = idCtxHash; + HASH_ALG_ID(pCtx) = algID; + + /* init context */ + cpInitHash(pCtx, algID); + return ippStsNoErr; +} + + +/*F* +// Name: ippsHashUpdate +// +// Purpose: Updates intermediate hash value based on input stream. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// ippStsNullPtrErr pSrc==0 but len!=0 +// ippStsContextMatchErr pCtx->idCtx != idCtxHash +// ippStsLengthErr len <0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the input stream +// len input stream length +// pCtx pointer to the Hash context +// +*F*/ +__INLINE int IsExceedMsgLen(Ipp64u maxLo, Ipp64u maxHi, Ipp64u lenLo, Ipp64u lenHi) +{ + int isExceed = lenLo > maxLo; + isExceed = (lenHi+isExceed) > maxHi; + return isExceed; +} + +IPPFUN(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + /* test the context */ + IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); + /* test input length */ + IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr); + /* test source pointer */ + IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); + + /* handle non empty input */ + if(len) { + const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)]; + + /* test if size of message is being processed not exceeded yet */ + Ipp64u lenLo = HASH_LENLO(pCtx); + Ipp64u lenHi = HASH_LENHI(pCtx); + lenLo += len; + if(lenLo < HASH_LENLO(pCtx)) lenHi++; + if(IsExceedMsgLen(pAttr->msgLenMax[0],pAttr->msgLenMax[1], lenLo,lenHi)) + IPP_ERROR_RET(ippStsLengthErr); + + else { + cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */ + const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */ + int mbs = pAttr->msgBlkSize; /* data block size */ + + /* + // processing + */ + { + int procLen; + + /* test if internal buffer is not empty */ + int n = HAHS_BUFFIDX(pCtx); + if(n) { + procLen = IPP_MIN(len, (mbs-n)); + CopyBlock(pSrc, HASH_BUFF(pCtx)+n, procLen); + HAHS_BUFFIDX(pCtx) = n += procLen; + + /* block processing */ + if(mbs==n) { + hashFunc(HASH_VALUE(pCtx), HASH_BUFF(pCtx), mbs, pParam); + HAHS_BUFFIDX(pCtx) = 0; + } + + /* update message pointer and length */ + pSrc += procLen; + len -= procLen; + } + + /* main processing part */ + procLen = len & ~(mbs-1); + if(procLen) { + hashFunc(HASH_VALUE(pCtx), pSrc, procLen, pParam); + pSrc += procLen; + len -= procLen; + } + + /* rest of input message */ + if(len) { + CopyBlock(pSrc, HASH_BUFF(pCtx), len); + HAHS_BUFFIDX(pCtx) += len; + } + } + + /* update length of processed message */ + HASH_LENLO(pCtx) = lenLo; + HASH_LENHI(pCtx) = lenHi; + + return ippStsNoErr; + } + } + + return ippStsNoErr; +} + + +static void cpComputeDigest(Ipp8u* pHashTag, int hashTagLen, const IppsHashState* pCtx) +{ + /* hash alg and parameters */ + cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */ + const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */ + + /* attributes */ + const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)]; + int mbs = pAttr->msgBlkSize; /* data block size */ + int ivSize = pAttr->ivSize; /* size of hash's IV */ + int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */ + + /* number of bytes in context buffer */ + int n = HAHS_BUFFIDX(pCtx); + /* buffer and it actual length */ + Ipp8u buffer[MBS_HASH_MAX*2]; + int bufferLen = n < (mbs-msgLenRepSize)? mbs : mbs*2; + + /* copy current hash value */ + cpHash hash; + CopyBlock(HASH_VALUE(pCtx), hash, ivSize); + + /* copy of state's buffer */ + CopyBlock(HASH_BUFF(pCtx), buffer, bufferLen); + /* end of message bit */ + buffer[n++] = 0x80; + /* padd buffer */ + PaddBlock(0, buffer+n, bufferLen-n-msgLenRepSize); + + /* message length representation in bits (remember about big endian) */ + { + /* convert processed message length bytes ->bits */ + Ipp64u lo = HASH_LENLO(pCtx); + Ipp64u hi = HASH_LENHI(pCtx); + hi = LSL64(hi,3) | LSR64(lo,63-3); + lo = LSL64(lo,3); + + if(msgLenRepSize>(int)(sizeof(Ipp64u))) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + ((Ipp64u*)(buffer+bufferLen))[-2] = hi; + #else + ((Ipp64u*)(buffer+bufferLen))[-2] = ENDIANNESS64(hi); + #endif + } + + /* recall about MD5 specific */ + if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + ((Ipp64u*)(buffer+bufferLen))[-1] = lo; + #else + ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo); + #endif + } + else { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo); + #else + ((Ipp64u*)(buffer+bufferLen))[-1] = lo; + #endif + } + } + + /* copmplete hash computation */ + hashFunc(hash, buffer, bufferLen, pParam); + + /* store digest into the user buffer (remember digest in big endian) */ + if(msgLenRepSize>(int)(sizeof(Ipp64u))) { + /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */ + hash[0] = ENDIANNESS64(hash[0]); + hash[1] = ENDIANNESS64(hash[1]); + hash[2] = ENDIANNESS64(hash[2]); + hash[3] = ENDIANNESS64(hash[3]); + hash[4] = ENDIANNESS64(hash[4]); + hash[5] = ENDIANNESS64(hash[5]); + hash[6] = ENDIANNESS64(hash[6]); + hash[7] = ENDIANNESS64(hash[7]); + } + else if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) { + ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]); + ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]); + ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]); + ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]); + ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]); + if(ippHashAlg_SHA1!=HASH_ALG_ID(pCtx)) { + ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]); + ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]); + ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]); + } + } + CopyBlock(hash, pHashTag, hashTagLen); +} + + +/*F* +// Name: ippsHashGetTag +// +// Purpose: Compute digest based on current state. +// Note, that futher digest update is possible +// +// Returns: Reason: +// ippStsNullPtrErr pTag == NULL +// pCtx == NULL +// ippStsContextMatchErr pCtx->idCtx != idCtxHash +// ippStsLengthErr hashSize < tagLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pTag address of the output digest +// tagLen length of digest +// pCtx pointer to the SHS state +// +*F*/ +IPPFUN(IppStatus, ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR2_RET(pTag, pCtx); + /* test the context */ + IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); + + { + /* size of hash */ + int hashSize = cpHashAlgAttr[HASH_ALG_ID(pCtx)].hashSize; + if(tagLen<1||hashSizeidCtx != idCtxHash +// ippStsNoErr no errors +// +// Parameters: +// pMD address of the output digest +// pCtx pointer to the SHS state +// +*F*/ +IPPFUN(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR2_RET(pMD, pCtx); + /* test the context */ + IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); + + { + IppHashAlgId algID = HASH_ALG_ID(pCtx); + int hashSize = cpHashAlgAttr[algID].hashSize; + + cpComputeDigest(pMD, hashSize, pCtx); + cpReInitHash(pCtx, algID); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsHashMessage +// +// Purpose: Hash of the whole message. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pMsg == NULL but msgLen!=0 +// ippStsLengthErr msgLen <0 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pMsg pointer to the input message +// msgLen input message length +// pMD address of the output digest +// algID hash alg ID +// +*F*/ +IPPFUN(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD, IppHashAlgId algID)) +{ + /* get algorithm id */ + algID = cpValidHashAlg(algID); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr); + + /* test digest pointer */ + IPP_BAD_PTR1_RET(pMD); + /* test message length */ + IPP_BADARG_RET((msgLen<0), ippStsLengthErr); + /* test message pointer */ + IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr); + + { + /* processing function and parameter */ + cpHashProc hashFunc = cpHashProcFunc[algID]; + const void* pParam = cpHashProcFuncOpt[algID]; + + /* attributes */ + const cpHashAttr* pAttr = &cpHashAlgAttr[algID]; + int mbs = pAttr->msgBlkSize; /* data block size */ + int ivSize = pAttr->ivSize; /* size of hash's IV */ + int hashSize = pAttr->hashSize; /* hash size */ + int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */ + + /* message bitlength representation */ + Ipp64u msgLenBits = (Ipp64u)msgLen*8; + /* length of main message part */ + int msgLenBlks = msgLen & (-mbs); + /* rest of message length */ + int msgLenRest = msgLen - msgLenBlks; + + /* end of message buffer */ + Ipp8u buffer[MBS_HASH_MAX*2]; + int bufferLen = (msgLenRest < (mbs-msgLenRepSize))? mbs : mbs*2; + + /* init hash */ + cpHash hash; + const Ipp8u* iv = cpHashIV[algID]; + CopyBlock(iv, hash, ivSize); + + /*construct last messge block(s) */ + #define MSG_LEN_REP (sizeof(Ipp64u)) + + /* copy end of message */ + CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest); + /* end of message bit */ + buffer[msgLenRest++] = 0x80; + /* padd buffer */ + PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MSG_LEN_REP); + /* copy message bitlength representation */ + if(ippHashAlg_MD5!=algID) + msgLenBits = ENDIANNESS64(msgLenBits); + ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits; + + #undef MSG_LEN_REP + + /* message processing */ + if(msgLenBlks) + hashFunc(hash, pMsg, msgLenBlks, pParam); + hashFunc(hash, buffer, bufferLen, pParam); + + /* store digest into the user buffer (remember digest in big endian) */ + if(msgLenRepSize > (int)(sizeof(Ipp64u))) { + /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */ + hash[0] = ENDIANNESS64(hash[0]); + hash[1] = ENDIANNESS64(hash[1]); + hash[2] = ENDIANNESS64(hash[2]); + hash[3] = ENDIANNESS64(hash[3]); + hash[4] = ENDIANNESS64(hash[4]); + hash[5] = ENDIANNESS64(hash[5]); + hash[6] = ENDIANNESS64(hash[6]); + hash[7] = ENDIANNESS64(hash[7]); + } + else if(ippHashAlg_MD5!=algID) { + /* ippHashAlg_SHA1, ippHashAlg_SHA224, ippHashAlg_SHA256 and ippHashAlg_SM3 */ + ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]); + ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]); + ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]); + ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]); + ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]); + ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]); + ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]); + ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]); + } + CopyBlock(hash, pMD, hashSize); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphashcnt.c b/external/crypto_px/sources/ippcp/src/pcphashcnt.c new file mode 100644 index 0000000000..9a54892bbf --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphashcnt.c @@ -0,0 +1,216 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" + +/* +// enabled hash alg IDs +*/ +const IppHashAlgId cpEnabledHashAlgID[] = { + IPP_ALG_HASH_UNKNOWN, + IPP_ALG_HASH_SHA1, + IPP_ALG_HASH_SHA256, + IPP_ALG_HASH_SHA224, + IPP_ALG_HASH_SHA512, + IPP_ALG_HASH_SHA384, + IPP_ALG_HASH_MD5, + IPP_ALG_HASH_SHA512_224, + IPP_ALG_HASH_SHA512_256 +}; +//////////////////////////////////////////////////////////// + +/* +// hash init values +*/ +const Ipp32u UnknownHash_IV[] = { + 0}; + +const Ipp32u SHA1_IV[] = { + 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0}; + +const Ipp32u SHA256_IV[] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19}; + +const Ipp32u SHA224_IV[] = { + 0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939, + 0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4}; + +const Ipp64u SHA512_IV[] = { + CONST_64(0x6A09E667F3BCC908), CONST_64(0xBB67AE8584CAA73B), + CONST_64(0x3C6EF372FE94F82B), CONST_64(0xA54FF53A5F1D36F1), + CONST_64(0x510E527FADE682D1), CONST_64(0x9B05688C2B3E6C1F), + CONST_64(0x1F83D9ABFB41BD6B), CONST_64(0x5BE0CD19137E2179)}; + +const Ipp64u SHA384_IV[] = { + CONST_64(0xCBBB9D5DC1059ED8), CONST_64(0x629A292A367CD507), + CONST_64(0x9159015A3070DD17), CONST_64(0x152FECD8F70E5939), + CONST_64(0x67332667FFC00B31), CONST_64(0x8EB44A8768581511), + CONST_64(0xDB0C2E0D64F98FA7), CONST_64(0x47B5481DBEFA4FA4)}; + +const Ipp32u MD5_IV[] = { + 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476}; + +const Ipp64u SHA512_224_IV[] = { + CONST_64(0x8C3D37C819544DA2), CONST_64(0x73E1996689DCD4D6), + CONST_64(0x1DFAB7AE32FF9C82), CONST_64(0x679DD514582F9FCF), + CONST_64(0x0F6D2B697BD44DA8), CONST_64(0x77E36F7304C48942), + CONST_64(0x3F9D85A86A1D36C8), CONST_64(0x1112E6AD91D692A1)}; + +const Ipp64u SHA512_256_IV[] = { + CONST_64(0x22312194FC2BF72C), CONST_64(0x9F555FA3C84C64C2), + CONST_64(0x2393B86B6F53B151), CONST_64(0x963877195940EABD), + CONST_64(0x96283EE2A88EFFE3), CONST_64(0xBE5E1E2553863992), + CONST_64(0x2B0199FC2C85B8AA), CONST_64(0x0EB72DDC81C52CA2)}; + +const Ipp8u* cpHashIV[] = { + (Ipp8u*)UnknownHash_IV, + (Ipp8u*)SHA1_IV, + (Ipp8u*)SHA256_IV, + (Ipp8u*)SHA224_IV, + (Ipp8u*)SHA512_IV, + (Ipp8u*)SHA384_IV, + (Ipp8u*)MD5_IV, + (Ipp8u*)SHA512_224_IV, + (Ipp8u*)SHA512_256_IV, +}; + +//////////////////////////////////////////////////////////// + +/* +// additive constatns +*/ +__ALIGN16 const Ipp32u SHA1_cnt[] = { + 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 +}; + +__ALIGN16 const Ipp32u SHA256_cnt[] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +__ALIGN16 const Ipp64u SHA512_cnt[] = { + CONST_64(0x428A2F98D728AE22), CONST_64(0x7137449123EF65CD), CONST_64(0xB5C0FBCFEC4D3B2F), CONST_64(0xE9B5DBA58189DBBC), + CONST_64(0x3956C25BF348B538), CONST_64(0x59F111F1B605D019), CONST_64(0x923F82A4AF194F9B), CONST_64(0xAB1C5ED5DA6D8118), + CONST_64(0xD807AA98A3030242), CONST_64(0x12835B0145706FBE), CONST_64(0x243185BE4EE4B28C), CONST_64(0x550C7DC3D5FFB4E2), + CONST_64(0x72BE5D74F27B896F), CONST_64(0x80DEB1FE3B1696B1), CONST_64(0x9BDC06A725C71235), CONST_64(0xC19BF174CF692694), + CONST_64(0xE49B69C19EF14AD2), CONST_64(0xEFBE4786384F25E3), CONST_64(0x0FC19DC68B8CD5B5), CONST_64(0x240CA1CC77AC9C65), + CONST_64(0x2DE92C6F592B0275), CONST_64(0x4A7484AA6EA6E483), CONST_64(0x5CB0A9DCBD41FBD4), CONST_64(0x76F988DA831153B5), + CONST_64(0x983E5152EE66DFAB), CONST_64(0xA831C66D2DB43210), CONST_64(0xB00327C898FB213F), CONST_64(0xBF597FC7BEEF0EE4), + CONST_64(0xC6E00BF33DA88FC2), CONST_64(0xD5A79147930AA725), CONST_64(0x06CA6351E003826F), CONST_64(0x142929670A0E6E70), + CONST_64(0x27B70A8546D22FFC), CONST_64(0x2E1B21385C26C926), CONST_64(0x4D2C6DFC5AC42AED), CONST_64(0x53380D139D95B3DF), + CONST_64(0x650A73548BAF63DE), CONST_64(0x766A0ABB3C77B2A8), CONST_64(0x81C2C92E47EDAEE6), CONST_64(0x92722C851482353B), + CONST_64(0xA2BFE8A14CF10364), CONST_64(0xA81A664BBC423001), CONST_64(0xC24B8B70D0F89791), CONST_64(0xC76C51A30654BE30), + CONST_64(0xD192E819D6EF5218), CONST_64(0xD69906245565A910), CONST_64(0xF40E35855771202A), CONST_64(0x106AA07032BBD1B8), + CONST_64(0x19A4C116B8D2D0C8), CONST_64(0x1E376C085141AB53), CONST_64(0x2748774CDF8EEB99), CONST_64(0x34B0BCB5E19B48A8), + CONST_64(0x391C0CB3C5C95A63), CONST_64(0x4ED8AA4AE3418ACB), CONST_64(0x5B9CCA4F7763E373), CONST_64(0x682E6FF3D6B2B8A3), + CONST_64(0x748F82EE5DEFB2FC), CONST_64(0x78A5636F43172F60), CONST_64(0x84C87814A1F0AB72), CONST_64(0x8CC702081A6439EC), + CONST_64(0x90BEFFFA23631E28), CONST_64(0xA4506CEBDE82BDE9), CONST_64(0xBEF9A3F7B2C67915), CONST_64(0xC67178F2E372532B), + CONST_64(0xCA273ECEEA26619C), CONST_64(0xD186B8C721C0C207), CONST_64(0xEADA7DD6CDE0EB1E), CONST_64(0xF57D4F7FEE6ED178), + CONST_64(0x06F067AA72176FBA), CONST_64(0x0A637DC5A2C898A6), CONST_64(0x113F9804BEF90DAE), CONST_64(0x1B710B35131C471B), + CONST_64(0x28DB77F523047D84), CONST_64(0x32CAAB7B40C72493), CONST_64(0x3C9EBE0A15C9BEBC), CONST_64(0x431D67C49C100D4C), + CONST_64(0x4CC5D4BECB3E42B6), CONST_64(0x597F299CFC657E2A), CONST_64(0x5FCB6FAB3AD6FAEC), CONST_64(0x6C44198C4A475817) +}; + +__ALIGN16 const Ipp32u MD5_cnt[] = { + 0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, + 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, + 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, + 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, + + 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, + 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, + 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, + 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, + + 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, + 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, + 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, + 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, + + 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, + 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, + 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, + 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391 +}; + +/* +// hash alg default processing opt argument +*/ +const void* cpHashProcFuncOpt[] = { + NULL, + SHA1_cnt, + SHA256_cnt, + SHA256_cnt, + SHA512_cnt, + SHA512_cnt, + MD5_cnt, + SHA512_cnt, + SHA512_cnt, +}; +//////////////////////////////////////////////////////////// + +/* hash alg attributes */ +const cpHashAttr cpHashAlgAttr[] = { + {0, 0, 0, 0, {CONST_64(0),CONST_64(0)}}, /* unknown */ + + {IPP_SHA1_DIGEST_BITSIZE/8, IPP_SHA1_DIGEST_BITSIZE/8, MBS_SHA1, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA256_DIGEST_BITSIZE/8,IPP_SHA256_DIGEST_BITSIZE/8, MBS_SHA256, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA256_DIGEST_BITSIZE/8,IPP_SHA224_DIGEST_BITSIZE/8, MBS_SHA224, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA384_DIGEST_BITSIZE/8, MBS_SHA384, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, + + {IPP_MD5_DIGEST_BITSIZE/8,IPP_MD5_DIGEST_BITSIZE/8, MBS_MD5, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_224_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_256_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}} +}; diff --git a/external/crypto_px/sources/ippcp/src/pcphashmd5px.c b/external/crypto_px/sources/ippcp/src/pcphashmd5px.c new file mode 100644 index 0000000000..f42f95bde6 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphashmd5px.c @@ -0,0 +1,197 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + +#pragma message("IPP_ALG_HASH_MD5 enabled") + + +/* +// Magic functions defined in RFC 1321 +// +*/ +#define F(X,Y,Z) ((Z) ^ ((X) & ((Y) ^ (Z)))) /* sightly optimized form of (((X) & (Y)) | ((~(X) & (Z)))*/ +#define G(X,Y,Z) F((Z),(X),(Y)) /* replace the original (((X) & (Z)) | ((Y) & ~(Z))) */ +#define H(X,Y,Z) ((X) ^ (Y) ^ (Z)) +#define I(X,Y,Z) ((Y) ^ ((X) | ~(Z))) + +/* +// MD5 step +*/ +#define MD5_STEP(MAGIC, A,B,C,D, data, constant, nrot) \ + (A = B +ROL32((A +MAGIC(B,C,D) +data +constant), nrot)) + +/* +// MD5 left rotations (number of bits) +// depends on round type +*/ +#define F1 7 +#define F2 12 +#define F3 17 +#define F4 22 + +#define G1 5 +#define G2 9 +#define G3 14 +#define G4 20 + +#define H1 4 +#define H2 11 +#define H3 16 +#define H4 23 + +#define I1 6 +#define I2 10 +#define I3 15 +#define I4 21 + +/*F* +// Name: UpdateMD5 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +void UpdateMD5(void* uinHash, const Ipp8u* mblk, int mlen, const void* uniParam) +{ + Ipp32u* digest = (Ipp32u*)uinHash; + Ipp32u* MD5_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_MD5; mblk += MBS_MD5, mlen -= MBS_MD5) { + + /* allocate data */ + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + Ipp32u data[MBS_MD5/sizeof(Ipp32u)]; + #else + /* or just word alias */ + Ipp32u* data = (Ipp32u*)mblk; + #endif + + /* init variables */ + Ipp32u a = digest[0]; + Ipp32u b = digest[1]; + Ipp32u c = digest[2]; + Ipp32u d = digest[3]; + + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + int t; + for(t=0; t<16; t++) { + data[t] = ENDIANNESS(((Ipp32u*)mblk)[t]); + } + #endif + + /* rounds type F */ + MD5_STEP(F, a,b,c,d, data[ 0], MD5_cnt_loc[ 0], F1); + MD5_STEP(F, d,a,b,c, data[ 1], MD5_cnt_loc[ 1], F2); + MD5_STEP(F, c,d,a,b, data[ 2], MD5_cnt_loc[ 2], F3); + MD5_STEP(F, b,c,d,a, data[ 3], MD5_cnt_loc[ 3], F4); + MD5_STEP(F, a,b,c,d, data[ 4], MD5_cnt_loc[ 4], F1); + MD5_STEP(F, d,a,b,c, data[ 5], MD5_cnt_loc[ 5], F2); + MD5_STEP(F, c,d,a,b, data[ 6], MD5_cnt_loc[ 6], F3); + MD5_STEP(F, b,c,d,a, data[ 7], MD5_cnt_loc[ 7], F4); + MD5_STEP(F, a,b,c,d, data[ 8], MD5_cnt_loc[ 8], F1); + MD5_STEP(F, d,a,b,c, data[ 9], MD5_cnt_loc[ 9], F2); + MD5_STEP(F, c,d,a,b, data[10], MD5_cnt_loc[10], F3); + MD5_STEP(F, b,c,d,a, data[11], MD5_cnt_loc[11], F4); + MD5_STEP(F, a,b,c,d, data[12], MD5_cnt_loc[12], F1); + MD5_STEP(F, d,a,b,c, data[13], MD5_cnt_loc[13], F2); + MD5_STEP(F, c,d,a,b, data[14], MD5_cnt_loc[14], F3); + MD5_STEP(F, b,c,d,a, data[15], MD5_cnt_loc[15], F4); + + /* rounds type G */ + MD5_STEP(G, a,b,c,d, data[ 1], MD5_cnt_loc[16], G1); + MD5_STEP(G, d,a,b,c, data[ 6], MD5_cnt_loc[17], G2); + MD5_STEP(G, c,d,a,b, data[11], MD5_cnt_loc[18], G3); + MD5_STEP(G, b,c,d,a, data[ 0], MD5_cnt_loc[19], G4); + MD5_STEP(G, a,b,c,d, data[ 5], MD5_cnt_loc[20], G1); + MD5_STEP(G, d,a,b,c, data[10], MD5_cnt_loc[21], G2); + MD5_STEP(G, c,d,a,b, data[15], MD5_cnt_loc[22], G3); + MD5_STEP(G, b,c,d,a, data[ 4], MD5_cnt_loc[23], G4); + MD5_STEP(G, a,b,c,d, data[ 9], MD5_cnt_loc[24], G1); + MD5_STEP(G, d,a,b,c, data[14], MD5_cnt_loc[25], G2); + MD5_STEP(G, c,d,a,b, data[ 3], MD5_cnt_loc[26], G3); + MD5_STEP(G, b,c,d,a, data[ 8], MD5_cnt_loc[27], G4); + MD5_STEP(G, a,b,c,d, data[13], MD5_cnt_loc[28], G1); + MD5_STEP(G, d,a,b,c, data[ 2], MD5_cnt_loc[29], G2); + MD5_STEP(G, c,d,a,b, data[ 7], MD5_cnt_loc[30], G3); + MD5_STEP(G, b,c,d,a, data[12], MD5_cnt_loc[31], G4); + + /* rounds type H */ + MD5_STEP(H, a,b,c,d, data[ 5], MD5_cnt_loc[32], H1); + MD5_STEP(H, d,a,b,c, data[ 8], MD5_cnt_loc[33], H2); + MD5_STEP(H, c,d,a,b, data[11], MD5_cnt_loc[34], H3); + MD5_STEP(H, b,c,d,a, data[14], MD5_cnt_loc[35], H4); + MD5_STEP(H, a,b,c,d, data[ 1], MD5_cnt_loc[36], H1); + MD5_STEP(H, d,a,b,c, data[ 4], MD5_cnt_loc[37], H2); + MD5_STEP(H, c,d,a,b, data[ 7], MD5_cnt_loc[38], H3); + MD5_STEP(H, b,c,d,a, data[10], MD5_cnt_loc[39], H4); + MD5_STEP(H, a,b,c,d, data[13], MD5_cnt_loc[40], H1); + MD5_STEP(H, d,a,b,c, data[ 0], MD5_cnt_loc[41], H2); + MD5_STEP(H, c,d,a,b, data[ 3], MD5_cnt_loc[42], H3); + MD5_STEP(H, b,c,d,a, data[ 6], MD5_cnt_loc[43], H4); + MD5_STEP(H, a,b,c,d, data[ 9], MD5_cnt_loc[44], H1); + MD5_STEP(H, d,a,b,c, data[12], MD5_cnt_loc[45], H2); + MD5_STEP(H, c,d,a,b, data[15], MD5_cnt_loc[46], H3); + MD5_STEP(H, b,c,d,a, data[ 2], MD5_cnt_loc[47], H4); + + /* rounds type I */ + MD5_STEP(I, a,b,c,d, data[ 0], MD5_cnt_loc[48], I1); + MD5_STEP(I, d,a,b,c, data[ 7], MD5_cnt_loc[49], I2); + MD5_STEP(I, c,d,a,b, data[14], MD5_cnt_loc[50], I3); + MD5_STEP(I, b,c,d,a, data[ 5], MD5_cnt_loc[51], I4); + MD5_STEP(I, a,b,c,d, data[12], MD5_cnt_loc[52], I1); + MD5_STEP(I, d,a,b,c, data[ 3], MD5_cnt_loc[53], I2); + MD5_STEP(I, c,d,a,b, data[10], MD5_cnt_loc[54], I3); + MD5_STEP(I, b,c,d,a, data[ 1], MD5_cnt_loc[55], I4); + MD5_STEP(I, a,b,c,d, data[ 8], MD5_cnt_loc[56], I1); + MD5_STEP(I, d,a,b,c, data[15], MD5_cnt_loc[57], I2); + MD5_STEP(I, c,d,a,b, data[ 6], MD5_cnt_loc[58], I3); + MD5_STEP(I, b,c,d,a, data[13], MD5_cnt_loc[59], I4); + MD5_STEP(I, a,b,c,d, data[ 4], MD5_cnt_loc[60], I1); + MD5_STEP(I, d,a,b,c, data[11], MD5_cnt_loc[61], I2); + MD5_STEP(I, c,d,a,b, data[ 2], MD5_cnt_loc[62], I3); + MD5_STEP(I, b,c,d,a, data[ 9], MD5_cnt_loc[63], I4); + + /* update digest */ + digest[0] += a; + digest[1] += b; + digest[2] += c; + digest[3] += d; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphashsha1px.c b/external/crypto_px/sources/ippcp/src/pcphashsha1px.c new file mode 100644 index 0000000000..cb3b7a155f --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphashsha1px.c @@ -0,0 +1,174 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/* +// Magic functions defined in FIPS 180-1 +// +*/ +#define MAGIC_F0(B,C,D) (((B) & (C)) | ((~(B)) & (D))) +#define MAGIC_F1(B,C,D) ((B) ^ (C) ^ (D)) +#define MAGIC_F2(B,C,D) (((B) & (C)) | ((B) & (D)) | ((C) & (D))) +#define MAGIC_F3(B,C,D) ((B) ^ (C) ^ (D)) + +#define SHA1_STEP(A,B,C,D,E, MAGIC_FUN, W,K) \ + (E)+= ROL32((A),5) + MAGIC_FUN((B),(C),(D)) + (W) + (K); \ + (B) = ROL32((B),30) + +#define COMPACT_SHA1_STEP(A,B,C,D,E, MAGIC_FUN, W,K, t) { \ + Ipp32u _T = ROL32((A),5) + MAGIC_FUN((t)/20, (B),(C),(D)) + (E) + (W)[(t)] + (K)[(t)/20]; \ + (E) = (D); \ + (D) = (C); \ + (C) = ROL32((B),30); \ + (B) = (A); \ + (A) = _T; \ +} + +#if defined(_ALG_SHA1_COMPACT_) +__INLINE Ipp32u MagicFun(int s, Ipp32u b, Ipp32u c, Ipp32u d) +{ + switch(s) { + case 0: return MAGIC_F0(b,c,d); + case 2: return MAGIC_F2(b,c,d); + default:return MAGIC_F1(b,c,d); + } +} +#endif + + +/*F* +// Name: UpdateSHA1 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +#if defined(_ALG_SHA1_COMPACT_) +#pragma message("SHA1 compact") +#endif + +void UpdateSHA1(void* uinHash, const Ipp8u* mblk, int mlen, const void *uniParam) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp32u* digest = (Ipp32u*)uinHash; + Ipp32u* SHA1_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_SHA1; data += MBS_SHA1/sizeof(Ipp32u), mlen -= MBS_SHA1) { + int t; + + /* + // expand message block + */ + Ipp32u W[80]; + /* initialize the first 16 words in the array W (remember about endian) */ + for(t=0; t<16; t++) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + W[t] = data[t]; + #else + W[t] = ENDIANNESS(data[t]); + #endif + } + /* schedule another 80-16 words in the array W */ + for(; t<80; t++) { + W[t] = ROL32(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1); + } + + /* + // update hash + */ + { + /* init A, B, C, D, E by the the input hash */ + Ipp32u A = digest[0]; + Ipp32u B = digest[1]; + Ipp32u C = digest[2]; + Ipp32u D = digest[3]; + Ipp32u E = digest[4]; + + #if defined(_ALG_SHA1_COMPACT_) + /* steps 0-79 */ + for(t=0; t<80; t++) + COMPACT_SHA1_STEP(A,B,C,D,E, MagicFun, W, SHA1_cnt_loc, t); + + #else + /* perform 0-19 steps */ + for(t=0; t<20; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F0, W[t ],SHA1_cnt_loc[0]); + SHA1_STEP(E,A,B,C,D, MAGIC_F0, W[t+1],SHA1_cnt_loc[0]); + SHA1_STEP(D,E,A,B,C, MAGIC_F0, W[t+2],SHA1_cnt_loc[0]); + SHA1_STEP(C,D,E,A,B, MAGIC_F0, W[t+3],SHA1_cnt_loc[0]); + SHA1_STEP(B,C,D,E,A, MAGIC_F0, W[t+4],SHA1_cnt_loc[0]); + } + /* perform 20-39 steps */ + for(; t<40; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F1, W[t ],SHA1_cnt_loc[1]); + SHA1_STEP(E,A,B,C,D, MAGIC_F1, W[t+1],SHA1_cnt_loc[1]); + SHA1_STEP(D,E,A,B,C, MAGIC_F1, W[t+2],SHA1_cnt_loc[1]); + SHA1_STEP(C,D,E,A,B, MAGIC_F1, W[t+3],SHA1_cnt_loc[1]); + SHA1_STEP(B,C,D,E,A, MAGIC_F1, W[t+4],SHA1_cnt_loc[1]); + } + /* perform 40-59 steps */ + for(; t<60; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F2, W[t ],SHA1_cnt_loc[2]); + SHA1_STEP(E,A,B,C,D, MAGIC_F2, W[t+1],SHA1_cnt_loc[2]); + SHA1_STEP(D,E,A,B,C, MAGIC_F2, W[t+2],SHA1_cnt_loc[2]); + SHA1_STEP(C,D,E,A,B, MAGIC_F2, W[t+3],SHA1_cnt_loc[2]); + SHA1_STEP(B,C,D,E,A, MAGIC_F2, W[t+4],SHA1_cnt_loc[2]); + } + /* perform 60-79 steps */ + for(; t<80; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F3, W[t ],SHA1_cnt_loc[3]); + SHA1_STEP(E,A,B,C,D, MAGIC_F3, W[t+1],SHA1_cnt_loc[3]); + SHA1_STEP(D,E,A,B,C, MAGIC_F3, W[t+2],SHA1_cnt_loc[3]); + SHA1_STEP(C,D,E,A,B, MAGIC_F3, W[t+3],SHA1_cnt_loc[3]); + SHA1_STEP(B,C,D,E,A, MAGIC_F3, W[t+4],SHA1_cnt_loc[3]); + } + #endif + + /* update digest */ + digest[0] += A; + digest[1] += B; + digest[2] += C; + digest[3] += D; + digest[4] += E; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphashsha256px.c b/external/crypto_px/sources/ippcp/src/pcphashsha256px.c new file mode 100644 index 0000000000..0eb0628518 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphashsha256px.c @@ -0,0 +1,199 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/* +// SHA256 Specific Macros (reference proposal 256-384-512) +*/ +#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#define SUM0(x) (ROR32((x), 2) ^ ROR32((x),13) ^ ROR32((x),22)) +#define SUM1(x) (ROR32((x), 6) ^ ROR32((x),11) ^ ROR32((x),25)) + +#define SIG0(x) (ROR32((x), 7) ^ ROR32((x),18) ^ LSR32((x), 3)) +#define SIG1(x) (ROR32((x),17) ^ ROR32((x),19) ^ LSR32((x),10)) + +#define SHA256_UPDATE(i) \ + wdat[i & 15] += SIG1(wdat[(i+14)&15]) + wdat[(i+9)&15] + SIG0(wdat[(i+1)&15]) + +#define SHA256_STEP(i,j) \ + v[(7 - i) & 7] += (j ? SHA256_UPDATE(i) : wdat[i&15]) \ + + SHA256_cnt_loc[i + j] \ + + SUM1(v[(4-i)&7]) \ + + CH(v[(4-i)&7], v[(5-i)&7], v[(6-i)&7]); \ + v[(3-i)&7] += v[(7-i)&7]; \ + v[(7-i)&7] += SUM0(v[(0-i)&7]) + MAJ(v[(0-i)&7], v[(1-i)&7], v[(2-i)&7]) + +#define COMPACT_SHA256_STEP(A,B,C,D,E,F,G,H, W,K, r) { \ + Ipp32u _T1 = (H) + SUM1((E)) + CH((E),(F),(G)) + (W)[(r)] + (K)[(r)]; \ + Ipp32u _T2 = SUM0((A)) + MAJ((A),(B),(C)); \ + (H) = (G); \ + (G) = (F); \ + (F) = (E); \ + (E) = (D)+_T1; \ + (D) = (C); \ + (C) = (B); \ + (B) = (A); \ + (A) = _T1+_T2; \ +} + +/*F* +// Name: UpdateSHA256 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +#if defined(_ALG_SHA256_COMPACT_) +#pragma message("SHA256 compact") + +void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp32u* digest = (Ipp32u*)uniHash; + Ipp32u* SHA256_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_SHA256; data += MBS_SHA256/sizeof(Ipp32u), mlen -= MBS_SHA256) { + int t; + + /* + // expand message block + */ + Ipp32u W[64]; + /* initialize the first 16 words in the array W (remember about endian) */ + for(t=0; t<16; t++) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + W[t] = data[t]; + #else + W[t] = ENDIANNESS( data[t] ); + #endif + } + for(; t<64; t++) + W[t] = SIG1(W[t-2]) + W[t-7] + SIG0(W[t-15]) + W[t-16]; + + /* + // update hash + */ + { + /* init A, B, C, D, E, F, G, H by the input hash */ + Ipp32u A = digest[0]; + Ipp32u B = digest[1]; + Ipp32u C = digest[2]; + Ipp32u D = digest[3]; + Ipp32u E = digest[4]; + Ipp32u F = digest[5]; + Ipp32u G = digest[6]; + Ipp32u H = digest[7]; + + for(t=0; t<64; t++) + COMPACT_SHA256_STEP(A,B,C,D,E,F,G,H, W,SHA256_cnt_loc, t); + + /* update hash*/ + digest[0] += A; + digest[1] += B; + digest[2] += C; + digest[3] += D; + digest[4] += E; + digest[5] += F; + digest[6] += G; + digest[7] += H; + } + } +} + +#else +void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp32u* digest = (Ipp32u*)uniHash; + Ipp32u* SHA256_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_SHA256; data += MBS_SHA256/sizeof(Ipp32u), mlen -= MBS_SHA256) { + Ipp32u wdat[16]; + int j; + + /* copy digest */ + Ipp32u v[8]; + CopyBlock(digest, v, IPP_SHA256_DIGEST_BITSIZE/BYTESIZE); + + /* initialize the first 16 words in the array W (remember about endian) */ + for(j=0; j<16; j++) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + wdat[j] = data[j]; + #else + wdat[j] = ENDIANNESS( data[j] ); + #endif + } + + for(j=0; j<64; j+=16) { + SHA256_STEP( 0, j); + SHA256_STEP( 1, j); + SHA256_STEP( 2, j); + SHA256_STEP( 3, j); + SHA256_STEP( 4, j); + SHA256_STEP( 5, j); + SHA256_STEP( 6, j); + SHA256_STEP( 7, j); + SHA256_STEP( 8, j); + SHA256_STEP( 9, j); + SHA256_STEP(10, j); + SHA256_STEP(11, j); + SHA256_STEP(12, j); + SHA256_STEP(13, j); + SHA256_STEP(14, j); + SHA256_STEP(15, j); + } + + /* update digest */ + digest[0] += v[0]; + digest[1] += v[1]; + digest[2] += v[2]; + digest[3] += v[3]; + digest[4] += v[4]; + digest[5] += v[5]; + digest[6] += v[6]; + digest[7] += v[7]; + } +} +#endif diff --git a/external/crypto_px/sources/ippcp/src/pcphashsha512px.c b/external/crypto_px/sources/ippcp/src/pcphashsha512px.c new file mode 100644 index 0000000000..5dd09b8fca --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphashsha512px.c @@ -0,0 +1,207 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/* +// SHA512 Specific Macros (reference proposal 256-384-512) +// +// Note: All operations act on DWORDs (64-bits) +*/ +#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#define SUM0(x) (ROR64((x),28) ^ ROR64((x),34) ^ ROR64((x),39)) +#define SUM1(x) (ROR64((x),14) ^ ROR64((x),18) ^ ROR64((x),41)) + +#define SIG0(x) (ROR64((x), 1) ^ ROR64((x), 8) ^ LSR64((x), 7)) +#define SIG1(x) (ROR64((x),19) ^ ROR64((x),61) ^ LSR64((x), 6)) + +#define SHA512_UPDATE(i) \ + wdat[i&15] += SIG1(wdat[(i+14)&15]) + wdat[(i+9)&15] + SIG0(wdat[(i+1)&15]) + +#define SHA512_STEP(i,j) \ + v[(7-i)&7] += (j ? SHA512_UPDATE(i) : wdat[i&15]) \ + + SHA512_cnt_loc[i+j] \ + + SUM1(v[(4-i)&7]) \ + + CH(v[(4-i)&7], v[(5-i)&7], v[(6-i)&7]); \ + v[(3-i)&7] += v[(7-i)&7]; \ + v[(7-i)&7] += SUM0(v[(0-i)&7]) + MAJ(v[(0-i)&7], v[(1-i)&7], v[(2-i)&7]) + +#define COMPACT_SHA512_STEP(A,B,C,D,E,F,G,H, W,K, r) { \ + Ipp64u _T1 = (H) + SUM1((E)) + CH((E),(F),(G)) + (W)[(r)] + (K)[(r)]; \ + Ipp64u _T2 = SUM0((A)) + MAJ((A),(B),(C)); \ + (H) = (G); \ + (G) = (F); \ + (F) = (E); \ + (E) = (D)+_T1; \ + (D) = (C); \ + (C) = (B); \ + (B) = (A); \ + (A) = _T1+_T2; \ +} + +/*F* +// Name: UpdateSHA512 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +#if defined(_ALG_SHA512_COMPACT_) +#pragma message("SHA512 compact") + +void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp64u* digest = (Ipp64u*)uniHash; + Ipp64u* SHA512_cnt_loc = (Ipp64u*)uniPraram; + + + for(; mlen>=MBS_SHA512; data += MBS_SHA512/sizeof(Ipp32u), mlen -= MBS_SHA512) { + int t; + Ipp64u W[80]; + + /* + // expand message block + */ + /* initialize the first 16 words in the array W (remember about endian) */ + for(t=0; t<16; t++) { + Ipp32u hiX = data[2*t]; + Ipp32u loX = data[2*t+1]; + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + W[t] = MAKEDWORD(loX, hiX); + #else + W[t] = MAKEDWORD( ENDIANNESS(loX), ENDIANNESS(hiX) ); + #endif + } + for(; t<80; t++) + W[t] = SIG1(W[t-2]) + W[t-7] + SIG0(W[t-15]) + W[t-16]; + + /* + // update hash + */ + { + /* init A, B, C, D, E, F, G, H by the input hash */ + Ipp64u A = digest[0]; + Ipp64u B = digest[1]; + Ipp64u C = digest[2]; + Ipp64u D = digest[3]; + Ipp64u E = digest[4]; + Ipp64u F = digest[5]; + Ipp64u G = digest[6]; + Ipp64u H = digest[7]; + + for(t=0; t<80; t++) + COMPACT_SHA512_STEP(A,B,C,D,E,F,G,H, W,SHA512_cnt_loc, t); + + /* update hash*/ + digest[0] += A; + digest[1] += B; + digest[2] += C; + digest[3] += D; + digest[4] += E; + digest[5] += F; + digest[6] += G; + digest[7] += H; + } + } +} + +#else +void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp64u* digest = (Ipp64u*)uniHash; + Ipp64u* SHA512_cnt_loc = (Ipp64u*)uniPraram; + + for(; mlen>=MBS_SHA512; data += MBS_SHA512/sizeof(Ipp32u), mlen -= MBS_SHA512) { + Ipp64u wdat[16]; + int j; + + Ipp64u v[8]; + + /* initialize the first 16 words in the array W (remember about endian) */ + for(j=0; j<16; j++) { + Ipp32u hiX = data[2*j]; + Ipp32u loX = data[2*j+1]; + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + wdat[j] = MAKEDWORD(loX, hiX); + #else + wdat[j] = MAKEDWORD( ENDIANNESS(loX), ENDIANNESS(hiX) ); + #endif + } + + /* copy digest */ + CopyBlock(digest, v, IPP_SHA512_DIGEST_BITSIZE/BYTESIZE); + + for(j=0; j<80; j+=16) { + SHA512_STEP( 0, j); + SHA512_STEP( 1, j); + SHA512_STEP( 2, j); + SHA512_STEP( 3, j); + SHA512_STEP( 4, j); + SHA512_STEP( 5, j); + SHA512_STEP( 6, j); + SHA512_STEP( 7, j); + SHA512_STEP( 8, j); + SHA512_STEP( 9, j); + SHA512_STEP(10, j); + SHA512_STEP(11, j); + SHA512_STEP(12, j); + SHA512_STEP(13, j); + SHA512_STEP(14, j); + SHA512_STEP(15, j); + } + + /* update digest */ + digest[0] += v[0]; + digest[1] += v[1]; + digest[2] += v[2]; + digest[3] += v[3]; + digest[4] += v[4]; + digest[5] += v[5]; + digest[6] += v[6]; + digest[7] += v[7]; + } +} +#endif diff --git a/external/crypto_px/sources/ippcp/src/pcphmac.h b/external/crypto_px/sources/ippcp/src/pcphmac.h new file mode 100644 index 0000000000..5e55334339 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphmac.h @@ -0,0 +1,55 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_HMAC_H) +#define _PCP_HMAC_H + +#include "pcphash.h" + +/* +// HMAC context +*/ +struct _cpHMAC { + IppCtxId idCtx; /* HMAC identifier */ + Ipp8u ipadKey[MBS_HASH_MAX]; /* inner padding key */ + Ipp8u opadKey[MBS_HASH_MAX]; /* outer padding key */ + IppsHashState hashCtx; /* hash context */ +}; + +/* accessors */ +#define HMAC_CTX_ID(stt) ((stt)->idCtx) +#define HASH_CTX(stt) ((stt)->hashCtx) +#define HMAC_VALID_ID(stt) (HMAC_CTX_ID((stt))==idCtxHMAC) + +#define IPAD (0x36) /* inner padding value */ +#define OPAD (0x5C) /* outer padding value */ + +#endif /* _PCP_HMAC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcphmacca.c b/external/crypto_px/sources/ippcp/src/pcphmacca.c new file mode 100644 index 0000000000..2c45b38291 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcphmacca.c @@ -0,0 +1,332 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphmac.h" +#include "pcptool.h" + +/*F* +// Name: ippsHMAC_GetSize +// +// Purpose: Returns size of HMAC state (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSzie == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to the HMAC state size +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_GetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = sizeof(IppsHMACState); + return ippStsNoErr; +} + +/*F* +// Name: ippsHMAC_Init +// +// Purpose: Init HMAC state. +// +// Returns: Reason: +// ippStsNullPtrErr pKey == NULL +// pState == NULL +// ippStsLengthErr keyLen <0 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pKey pointer to the secret key +// keyLen length (bytes) of the secret key +// pState pointer to the HMAC state +// hashAlg hash alg ID +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) +{ + //int mbs; + + /* get algorithm id */ + hashAlg = cpValidHashAlg(hashAlg); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + //mbs = cpHashMBS(hashAlg); + + /* test pState pointer */ + IPP_BAD_PTR1_RET(pCtx); + + /* test key pointer and key length */ + IPP_BAD_PTR1_RET(pKey); + IPP_BADARG_RET(0>keyLen, ippStsLengthErr); + + /* set state ID */ + HMAC_CTX_ID(pCtx) = idCtxHMAC; + + /* init hash context */ + ippsHashInit(&HASH_CTX(pCtx), hashAlg); + + { + int n; + + /* hash specific */ + IppsHashState* pHashCtx = &HASH_CTX(pCtx); + int mbs = cpHashMBS(hashAlg); + int hashSize = cpHashSize(hashAlg); + + /* copyMask = keyLen>mbs? 0xFF : 0x00 */ + int copyMask = (mbs-keyLen) >>(BITSIZE(int)-1); + + /* actualKeyLen = keyLen>mbs? hashSize:keyLen */ + int actualKeyLen = (hashSize & copyMask) | (keyLen & ~copyMask); + + /* compute hash(key, keyLen) just in case */ + ippsHashUpdate(pKey, keyLen, pHashCtx); + ippsHashFinal(HASH_BUFF(pHashCtx), pHashCtx); + + /* copy either key or hash(key) into ipad- and opad- buffers */ + MASKED_COPY_BNU(pCtx->ipadKey, (Ipp8u)copyMask, HASH_BUFF(pHashCtx), pKey, actualKeyLen); + MASKED_COPY_BNU(pCtx->opadKey, (Ipp8u)copyMask, HASH_BUFF(pHashCtx), pKey, actualKeyLen); + + /* XOR-ing key */ + for(n=0; nipadKey[n] ^= (Ipp8u)IPAD; + pCtx->opadKey[n] ^= (Ipp8u)OPAD; + } + for(; nipadKey[n] = (Ipp8u)IPAD; + pCtx->opadKey[n] = (Ipp8u)OPAD; + } + + /* ipad key processing */ + ippsHashUpdate(pCtx->ipadKey, mbs, pHashCtx); + + return ippStsNoErr; + } +} + +/*F* +// Name: ippsHMAC_Update +// +// Purpose: Updates intermadiate MAC based on input stream. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pState == NULL +// ippStsContextMatchErr pState->idCtx != idCtxHMAC +// ippStsLengthErr len <0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the input stream +// len input stream length +// pState pointer to the HMAC state +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +{ + /* test state pointers */ + IPP_BAD_PTR1_RET(pCtx); + + /* test state ID */ + IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); + /* test input length */ + IPP_BADARG_RET((len<0), ippStsLengthErr); + /* test source pointer */ + IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); + + if(len) + return ippsHashUpdate(pSrc, len, &HASH_CTX(pCtx)); + else + return ippStsNoErr; +} + +/*F* +// Name: ippsHMAC_Final +// +// Purpose: Stop message digesting and return digest. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pState == NULL +// ippStsContextMatchErr pState->idCtx != idCtxHMAC +// ippStsLengthErr sizeof(DigestMD5) < mdLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pMD address of the output digest +// pState pointer to the HMAC state +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); + + /* test MD pointer and length */ + IPP_BAD_PTR1_RET(pMD); + IPP_BADARG_RET(mdLen<=0, ippStsLengthErr); + + { + /* hash specific */ + IppsHashState* pHashCtx = &HASH_CTX(pCtx); + int mbs = cpHashMBS(HASH_ALG_ID(pHashCtx)); + int hashSize = cpHashSize(HASH_ALG_ID(pHashCtx)); + if(mdLen>hashSize) + IPP_ERROR_RET(ippStsLengthErr); + + /* + // finalize hmac + */ + { + /* finalize 1-st step */ + Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/8]; + IppStatus sts = ippsHashFinal(md, pHashCtx); + + if(ippStsNoErr==sts) { + /* perform outer hash */ + ippsHashUpdate(pCtx->opadKey, mbs, pHashCtx); + ippsHashUpdate(md, hashSize, pHashCtx); + + /* complete HMAC */ + ippsHashFinal(md, pHashCtx); + CopyBlock(md, pMD, IPP_MIN(hashSize, mdLen)); + + /* ready to the next HMAC computation */ + ippsHashUpdate(pCtx->ipadKey, mbs, pHashCtx); + } + + return sts; + } + } +} + +/*F* +// Name: ippsHMAC_GetTag +// +// Purpose: Compute digest with further digesting ability. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pState == NULL +// ippStsContextMatchErr pState->idCtx != idCtxHMAC +// ippStsLengthErr size_of_digest < mdLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pMD address of the output digest +// mdLen length of the digest +// pState pointer to the HMAC state +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); + + /* test MD pointer */ + IPP_BAD_PTR1_RET(pMD); + + { + IppsHMACState tmpCtx; + CopyBlock(pCtx, &tmpCtx, sizeof(IppsHMACState)); + return ippsHMAC_Final(pMD, mdLen, &tmpCtx); + } +} + +/*F* +// Name: ippsHMAC_Message +// +// Purpose: MAC of the whole message. +// +// Returns: Reason: +// ippStsNullPtrErr pMsg == NULL +// pKey == NULL +// pMD == NULL +// ippStsLengthErr msgLen <0 +// keyLen <0 +// size_of_digest < mdLen <1 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pMsg pointer to the input message +// msgLen input message length +// pKey pointer to the secret key +// keyLen secret key length +// pMD pointer to message digest +// mdLen MD length +// hashAlg hash alg ID +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pKey, int keyLen, + Ipp8u* pMD, int mdLen, + IppHashAlgId hashAlg)) +{ + /* get algorithm id */ + hashAlg = cpValidHashAlg(hashAlg); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* test secret key pointer and length */ + IPP_BAD_PTR1_RET(pKey); + IPP_BADARG_RET((keyLen<0), ippStsLengthErr); + + /* test input message pointer and length */ + IPP_BADARG_RET((msgLen<0), ippStsLengthErr); + IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr); + + /* test MD pointer and length */ + IPP_BAD_PTR1_RET(pMD); + IPP_BADARG_RET(0>=mdLen || mdLen>cpHashSize(hashAlg), ippStsLengthErr); + + { + IppsHMACState ctx; + IppStatus sts = ippsHMAC_Init(pKey, keyLen, &ctx, hashAlg); + if(ippStsNoErr!=sts) goto exit; + + sts = ippsHashUpdate(pMsg,msgLen, &HASH_CTX(&ctx)); + if(ippStsNoErr!=sts) goto exit; + + sts = ippsHMAC_Final(pMD, mdLen, &ctx); + + exit: + PurgeBlock(&ctx, sizeof(IppsHMACState)); + return sts; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c b/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c new file mode 100644 index 0000000000..f7708ed648 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c @@ -0,0 +1,116 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpmontgomery.h" + + +/* +// Binary method of Exponentiation +*/ +cpSize cpMontExpBin_BNU(BNU_CHUNK_T* dataY, + const BNU_CHUNK_T* dataX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, + IppsMontState* pMont) +{ + cpSize nsM = MNT_SIZE(pMont); + + /* + // test for special cases: + // x^0 = 1 + // 0^e = 0 + */ + if( cpEqu_BNU_CHUNK(dataE, nsE, 0) ) { + COPY_BNU(dataY, MNT_1(pMont), nsM); + } + else if( cpEqu_BNU_CHUNK(dataX, nsX, 0) ) { + ZEXPAND_BNU(dataY, 0, nsM); + } + + /* general case */ + else { + BNU_CHUNK_T* dataM = MNT_MODULUS(pMont); + BNU_CHUNK_T m0 = MNT_HELPER(pMont); + + /* Montgomery engine buffers */ + BNU_CHUNK_T* pKBuffer = MNT_KBUFFER(pMont); + BNU_CHUNK_T* pProduct = MNT_PRODUCT(pMont); + + BNU_CHUNK_T* dataT = MNT_TBUFFER(pMont); + + /* execute most significant part pE */ + BNU_CHUNK_T eValue = dataE[nsE-1]; + int n = cpNLZ_BNU(eValue)+1; + + /* expand base and init result */ + ZEXPAND_COPY_BNU(dataT, nsM, dataX, nsX); + COPY_BNU(dataY, dataT, nsM); + + eValue <<= n; + for(; n0; nsE--) { + eValue = dataE[nsE-1]; + + for(n=0; nidCtx) +#define MNT_ROOM(eng) ((eng)->maxLen) +#define MNT_SIZE(eng) ((eng)->modLen) +#define MNT_HELPER(eng) ((eng)->m0) +#define MNT_MODULUS(eng) ((eng)->pModulus) +#define MNT_1(eng) ((eng)->pIdentity) +#define MNT_IDENT_R(eng) (MNT_1((eng))) +#define MNT_SQUARE_R(eng) ((eng)->pSquare) +#define MNT_CUBE_R(eng) ((eng)->pCube) +#define MNT_TBUFFER(eng) ((eng)->pTBuffer) +#define MNT_SBUFFER(eng) ((eng)->pSBuffer) +#define MNT_PRODUCT(eng) ((eng)->pProduct) +#define MNT_KBUFFER(eng) ((eng)->pKBuffer) + +#define MNT_VALID_ID(eng) (MNT_ID((eng))==idCtxMontgomery) + +/* default methos */ +#define EXPONENT_METHOD (ippBinaryMethod) + +/* alignment */ +#define MONT_ALIGNMENT ((int)(sizeof(void*))) + + +/* +// Pacp/unpack Montgomery context +*/ +void cpPackMontCtx(const IppsMontState* pCtx, Ipp8u* pBuffer); +void cpUnpackMontCtx(const Ipp8u* pBuffer, IppsMontState* pCtx); + + +/* +// Montgomery reduction, multiplication and squaring +*/ +void cpMontRedAdc_BNU(BNU_CHUNK_T* pR, + BNU_CHUNK_T* pProduct, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0); + +__INLINE void cpMontRed_BNU(BNU_CHUNK_T* pR, + BNU_CHUNK_T* pProduct, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0) +{ + cpMontRedAdc_BNU(pR, pProduct, pModulus, nsM, m0); +} + +__INLINE void cpMontMul_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pY, cpSize nsY, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0, + BNU_CHUNK_T* pProduct, BNU_CHUNK_T* pKBuffer) +{ + cpMul_BNU(pProduct, pX,nsX, pY,nsY, pKBuffer); + ZEXPAND_BNU(pProduct,nsX+nsY, 2*nsM); + cpMontRed_BNU(pR, pProduct, pModulus, nsM, m0); +} + +__INLINE void cpMontSqr_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0, + BNU_CHUNK_T* pProduct, BNU_CHUNK_T* pKBuffer) +{ + cpSqr_BNU(pProduct, pX,nsX, pKBuffer); + ZEXPAND_BNU(pProduct, 2*nsX, 2*nsM); + cpMontRed_BNU(pR, pProduct, pModulus, nsM, m0); +} + +/* +// Montgomery encoding/decoding +*/ +__INLINE cpSize cpMontEnc_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXreg, cpSize nsX, + IppsMontState* pMont) +{ + cpSize nsM = MNT_SIZE(pMont); + cpMontMul_BNU(pR, + pXreg, nsX, MNT_SQUARE_R(pMont), nsM, + MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), + MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); + + FIX_BNU(pR, nsM); + return nsM; +} + +__INLINE cpSize cpMontDec_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXmont, cpSize nsX, + IppsMontState* pMont) +{ + cpSize nsM = MNT_SIZE(pMont); + ZEXPAND_COPY_BNU(MNT_PRODUCT(pMont), 2*nsM, pXmont, nsX); + + cpMontRed_BNU(pR, MNT_PRODUCT(pMont), MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); + + FIX_BNU(pR, nsM); + return nsM; +} + +__INLINE void cpMontEnc_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + IppsMontState* pMont) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + cpMontMul_BNU(pR, + BN_NUMBER(pXbn), BN_SIZE(pXbn), + MNT_SQUARE_R(pMont), nsM, + MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), + MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + +__INLINE void cpMontDec_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + IppsMontState* pMont) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + ZEXPAND_COPY_BNU(MNT_PRODUCT(pMont), 2*nsM, BN_NUMBER(pXbn), BN_SIZE(pXbn)); + + cpMontRed_BNU(pR, MNT_PRODUCT(pMont), MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + +/* +// Montgomery exponentiation (binary) +*/ +cpSize cpMontExpBin_BNU(BNU_CHUNK_T* pY, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pE, cpSize nsE, + IppsMontState* pMont); + +#endif /* _CP_MONTGOMETRY_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c b/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c new file mode 100644 index 0000000000..f82147cfb2 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c @@ -0,0 +1,296 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpmontgomery.h" +#include "pcptool.h" + +/*F* +// Name: ippsMontGetSize +// +// Purpose: Specifies size of buffer in bytes. +// +// Returns: Reason: +// ippStsNullPtrErr pCtxSize==NULL +// ippStsLengthErr maxLen32 < 1 +// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// method selected exponential method (unused parameter) +// maxLen32 max modulus length (in Ipp32u chunks) +// pCtxSize size of context +// +// Notes: Function always use method=ippBinaryMethod, +// so this parameter is ignored +*F*/ +IPPFUN(IppStatus, ippsMontGetSize, (IppsExpMethod method, cpSize maxLen32, cpSize* pCtxSize)) +{ + IPP_BAD_PTR1_RET(pCtxSize); + IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + + UNREFERENCED_PARAMETER(method); + + { + /* convert modulus length to the number of BNU_CHUNK_T */ + cpSize modSize = INTERNAL_BNU_LENGTH(maxLen32); + + *pCtxSize= sizeof(IppsMontState) + + modSize*sizeof(BNU_CHUNK_T) /* modulus */ + + modSize*sizeof(BNU_CHUNK_T) /* identity */ + + modSize*sizeof(BNU_CHUNK_T) /* square R */ + + modSize*sizeof(BNU_CHUNK_T) /* cube R */ + + modSize*sizeof(BNU_CHUNK_T) /* internal buffer */ + + modSize*sizeof(BNU_CHUNK_T) /* internal sscm buffer */ + + modSize*sizeof(BNU_CHUNK_T)*2 /* internal product */ + + MONT_ALIGNMENT-1; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsMontInit +// +// Purpose: Initializes the symbolic data structure and partitions the +// specified buffer space. +// +// Returns: Reason: +// ippStsNullPtrErr pMont==NULL +// ippStsLengthErr maxLen32 < 1 +// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// method selected exponential method (unused parameter) +// maxLen32 max modulus length (in Ipp32u chunks) +// pMont pointer to Montgomery context +*F*/ +IPPFUN(IppStatus, ippsMontInit,(IppsExpMethod method, int maxLen32, IppsMontState* pMont)) +{ + IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + + IPP_BAD_PTR1_RET(pMont); + pMont = (IppsMontState*)( IPP_ALIGNED_PTR(pMont, MONT_ALIGNMENT) ); + + UNREFERENCED_PARAMETER(method); + + MNT_ID(pMont) = idCtxUnknown; + MNT_ROOM(pMont) = INTERNAL_BNU_LENGTH(maxLen32); + MNT_SIZE(pMont) = 0; + MNT_HELPER(pMont) = 0; + + { + Ipp8u* ptr = (Ipp8u*)pMont; + + /* convert modulus length to the number of BNU_CHUNK_T */ + cpSize modSize = MNT_ROOM(pMont); + + /* assign internal buffers */ + MNT_MODULUS(pMont) = (BNU_CHUNK_T*)( ptr += sizeof(IppsMontState) ); + + MNT_1(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_SQUARE_R(pMont)= (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_CUBE_R(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + + MNT_TBUFFER(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_SBUFFER(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_PRODUCT(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_KBUFFER(pMont) = (BNU_CHUNK_T*)NULL; + + /* init internal buffers */ + ZEXPAND_BNU(MNT_MODULUS(pMont), 0, modSize); + ZEXPAND_BNU(MNT_1(pMont), 0, modSize); + ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, modSize); + ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, modSize); + + MNT_ID(pMont) = idCtxMontgomery; + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsMontSet +// +// Purpose: Setup modulus value +// +// Returns: Reason: +// ippStsNullPtrErr pMont==NULL +// pModulus==NULL +// ippStsContextMatchErr !MNT_VALID_ID() +// ippStsLengthErr len32<1 +// ippStsNoErr no errors +// +// Parameters: +// pModulus pointer to the modulus buffer +// len32 length of the modulus (in Ipp32u chunks). +// pMont pointer to the context +*F*/ +static BNU_CHUNK_T cpMontHelper(BNU_CHUNK_T m0) +{ + BNU_CHUNK_T y = 1; + BNU_CHUNK_T x = 2; + BNU_CHUNK_T mask = 2*x-1; + + int i; + for(i=2; i<=BNU_CHUNK_BITS; i++, x<<=1) { + BNU_CHUNK_T rH, rL; + MUL_AB(rH, rL, m0, y); + if( x < (rL & mask) ) /* x < ((m0*y) mod (2*x)) */ + y+=x; + mask += mask + 1; + } + return 0-y; +} + +IPPFUN(IppStatus, ippsMontSet,(const Ipp32u* pModulus, cpSize len32, IppsMontState* pMont)) +{ + IPP_BAD_PTR2_RET(pModulus, pMont); + pMont = (IppsMontState*)(IPP_ALIGNED_PTR((pMont), MONT_ALIGNMENT)); + IPP_BADARG_RET(!MNT_VALID_ID(pMont), ippStsContextMatchErr); + + IPP_BADARG_RET(len32<1, ippStsLengthErr); + + /* modulus is not an odd number */ + IPP_BADARG_RET((pModulus[0] & 1) == 0, ippStsBadModulusErr); + IPP_BADARG_RET(MNT_ROOM(pMont)<(int)(INTERNAL_BNU_LENGTH(len32)), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T m0; + cpSize len; + + /* fix input modulus */ + FIX_BNU(pModulus, len32); + + /* store modulus */ + ZEXPAND_BNU(MNT_MODULUS(pMont), 0, MNT_ROOM(pMont)); + COPY_BNU((Ipp32u*)(MNT_MODULUS(pMont)), pModulus, len32); + /* store modulus length */ + len = INTERNAL_BNU_LENGTH(len32); + MNT_SIZE(pMont) = len; + + /* pre-compute helper m0, m0*m = -1 mod R */ + m0 = cpMontHelper(MNT_MODULUS(pMont)[0]); + MNT_HELPER(pMont) = m0; + + /* setup identity */ + ZEXPAND_BNU(MNT_1(pMont), 0, len); + MNT_1(pMont)[len] = 1; + cpMod_BNU(MNT_1(pMont), len+1, MNT_MODULUS(pMont), len); + + /* setup square */ + ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, len); + COPY_BNU(MNT_SQUARE_R(pMont)+len, MNT_1(pMont), len); + cpMod_BNU(MNT_SQUARE_R(pMont), 2*len, MNT_MODULUS(pMont), len); + + /* setup cube */ + ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, len); + COPY_BNU(MNT_CUBE_R(pMont)+len, MNT_SQUARE_R(pMont), len); + cpMod_BNU(MNT_CUBE_R(pMont), 2*len, MNT_MODULUS(pMont), len); + + /* clear buffers */ + ZEXPAND_BNU(MNT_TBUFFER(pMont), 0, len); + ZEXPAND_BNU(MNT_SBUFFER(pMont), 0, len); + ZEXPAND_BNU(MNT_PRODUCT(pMont), 0, 2*len); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsMontMul +// +// Purpose: Computes Montgomery modular multiplication for positive big +// number integers of Montgomery form. The following pseudocode +// represents this function: +// r <- ( a * b * R^(-1) ) mod m +// +// Returns: Reason: +// ippStsNoErr Returns no error. +// ippStsNullPtrErr Returns an error when pointers are null. +// ippStsBadArgErr Returns an error when a or b is a negative integer. +// ippStsScaleRangeErr Returns an error when a or b is more than m. +// ippStsOutOfRangeErr Returns an error when IppsBigNumState *r is larger than +// IppsMontState *m. +// ippStsContextMatchErr Returns an error when the context parameter does +// not match the operation. +// +// Parameters: +// a Multiplicand within the range [0, m - 1]. +// b Multiplier within the range [0, m - 1]. +// m Modulus. +// r Montgomery multiplication result. +// +// Notes: The size of IppsBigNumState *r should not be less than the data +// length of the modulus m. +*F*/ +IPPFUN(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* pMont, IppsBigNumState* pR)) +{ + IPP_BAD_PTR4_RET(pA, pB, pMont, pR); + + pMont = (IppsMontState*)(IPP_ALIGNED_PTR((pMont), MONT_ALIGNMENT)); + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + + IPP_BADARG_RET(!MNT_VALID_ID(pMont), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + IPP_BADARG_RET(BN_NEGATIVE(pA) || BN_NEGATIVE(pB), ippStsBadArgErr); + IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), MNT_MODULUS(pMont), MNT_SIZE(pMont)) >= 0, ippStsScaleRangeErr); + IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pB), BN_SIZE(pB), MNT_MODULUS(pMont), MNT_SIZE(pMont)) >= 0, ippStsScaleRangeErr); + IPP_BADARG_RET(BN_ROOM(pR) < MNT_SIZE(pMont), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + cpSize nsM = MNT_SIZE(pMont); + + cpMontMul_BNU(pDataR, + BN_NUMBER(pA), BN_SIZE(pA), + BN_NUMBER(pB), BN_SIZE(pB), + MNT_MODULUS(pMont), nsM, + MNT_HELPER(pMont), + MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); + + FIX_BNU(pDataR, nsM); + BN_SIZE(pR) = nsM; + BN_SIGN(pR) = ippBigNumPOS; + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpmontred.c b/external/crypto_px/sources/ippcp/src/pcpmontred.c new file mode 100644 index 0000000000..b43dce71f9 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpmontred.c @@ -0,0 +1,64 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnuarith.h" + + +void cpMontRedAdc_BNU(BNU_CHUNK_T* pR, + BNU_CHUNK_T* pProduct, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0) +{ + BNU_CHUNK_T carry; + BNU_CHUNK_T extension; + + cpSize n; + for(n=0, carry = 0; n<(nsM-1); n++) { + BNU_CHUNK_T u = pProduct[n]*m0; + BNU_CHUNK_T t = pProduct[nsM +n +1] + carry; + + extension = cpAddMulDgt_BNU(pProduct+n, pModulus, nsM, u); + ADD_AB(carry, pProduct[nsM+n], pProduct[nsM+n], extension); + t += carry; + + carry = tmaxbitSizeN) +#define RSA_PUB_KEY_MAXSIZE_E(x) ((x)->maxbitSizeE) +#define RSA_PUB_KEY_ID(x) ((x)->id) +#define RSA_PUB_KEY_BITSIZE_N(x) ((x)->bitSizeN) +#define RSA_PUB_KEY_BITSIZE_E(x) ((x)->bitSizeE) +#define RSA_PUB_KEY_E(x) ((x)->pDataE) +#define RSA_PUB_KEY_NMONT(x) ((x)->pMontN) +#define RSA_PUB_KEY_VALID_ID(x) (RSA_PUB_KEY_ID((x))==idCtxRSA_PubKey) +#define RSA_PUB_KEY_IS_SET(x) (RSA_PUB_KEY_BITSIZE_N((x))>0) + +/* alignment */ +#define RSA_PUBLIC_KEY_ALIGNMENT ((int)(sizeof(void*))) + +struct _cpRSA_private_key { + IppCtxId id; /* key ID */ + int maxbitSizeN; + int maxbitSizeD; + int bitSizeN; /* RSA modulus bitsize */ + int bitSizeD; /* RSA private exp bitsize */ + int bitSizeP; /* RSA p-factor bitsize */ + int bitSizeQ; /* RSA q-factor bitsize */ + + BNU_CHUNK_T* pDataD; /* private exp */ + BNU_CHUNK_T* pDataDp; /* dp private exp */ + BNU_CHUNK_T* pDataDq; /* dq private exp */ + BNU_CHUNK_T* pDataQinv; /* qinv coeff */ + + IppsMontState* pMontP; /* montgomery engine (P) */ + IppsMontState* pMontQ; /* montgomery engine (Q) */ + IppsMontState* pMontN; /* montgomery engine (N) */ +}; + +/* access */ +#define RSA_PRV_KEY_MAXSIZE_N(x) ((x)->maxbitSizeN) +#define RSA_PRV_KEY_MAXSIZE_D(x) ((x)->maxbitSizeD) +#define RSA_PRV_KEY_ID(x) ((x)->id) +#define RSA_PRV_KEY_BITSIZE_N(x) ((x)->bitSizeN) +#define RSA_PRV_KEY_BITSIZE_D(x) ((x)->bitSizeD) +#define RSA_PRV_KEY_BITSIZE_P(x) ((x)->bitSizeP) +#define RSA_PRV_KEY_BITSIZE_Q(x) ((x)->bitSizeQ) +#define RSA_PRV_KEY_D(x) ((x)->pDataD) +#define RSA_PRV_KEY_DP(x) ((x)->pDataDp) +#define RSA_PRV_KEY_DQ(x) ((x)->pDataDq) +#define RSA_PRV_KEY_INVQ(x) ((x)->pDataQinv) +#define RSA_PRV_KEY_PMONT(x) ((x)->pMontP) +#define RSA_PRV_KEY_QMONT(x) ((x)->pMontQ) +#define RSA_PRV_KEY_NMONT(x) ((x)->pMontN) +#define RSA_PRV_KEY1_VALID_ID(x) (RSA_PRV_KEY_ID((x))==idCtxRSA_PrvKey1) +#define RSA_PRV_KEY2_VALID_ID(x) (RSA_PRV_KEY_ID((x))==idCtxRSA_PrvKey2) +#define RSA_PRV_KEY_VALID_ID(x) (RSA_PRV_KEY1_VALID_ID((x)) || RSA_PRV_KEY2_VALID_ID((x))) +#define RSA_PRV_KEY_IS_SET(x) (RSA_PRV_KEY_BITSIZE_N((x))>0) + +/* alignment */ +#define RSA_PRIVATE_KEY_ALIGNMENT ((int)(sizeof(void*))) + +/* pubic and private key operations */ +void gsRSApub_cipher(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPublicKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); +void gsRSAprv_cipher(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPrivateKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); +void gsRSAprv_cipher_crt(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPrivateKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); + +#endif /* _CP_NG_RSA_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c b/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c new file mode 100644 index 0000000000..ccf2a855a6 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c @@ -0,0 +1,437 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + + +/*F* +// Name: ippsRSA_GetBufferSizePublicKey +// +// Purpose: Returns size of temporary buffer (in bytes) for public key operation +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pBufferSize +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// +// ippStsIncompleteContextErr no ippsRSA_SetPublicKey() call +// +// ippStsNoErr no error +// +// Parameters: +// pBufferSize pointer to size of temporary buffer +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pBufferSize); + + { + cpSize expBitSize = RSA_PUB_KEY_BITSIZE_E(pKey); + cpSize w = gsMontExp_WinSize(expBitSize); + cpSize precompLen = (1==w)? 0 : (1<1) + // temporary product (2) + */ + cpSize bufferLen = ((nsM+1)*2)*2 + +precompLen*nsM + +nsM + +nsM*2; + + *pBufferSize = bufferLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + (CACHE_LINE_SIZE-1); + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRSA_GetBufferSizePublicKey +// +// Purpose: Returns size of temporary buffer (in bytes) for public key operation +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pBufferSize +// +// ippStsContextMatchErr !RSA_PRV_KEY_VALID_ID() +// +// ippStsIncompleteContextErr (type1) private key is not set up +// +// ippStsNoErr no error +// +// Parameters: +// pBufferSize pointer to size of temporary buffer +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(RSA_PRV_KEY1_VALID_ID(pKey) && !RSA_PRV_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pBufferSize); + + { + cpSize bufferLen; + if(RSA_PRV_KEY1_VALID_ID(pKey)) { + cpSize expBitSize = RSA_PRV_KEY_BITSIZE_D(pKey); + cpSize w = gsMontExp_WinSize(expBitSize); + cpSize precompLen = (1==w)? 0 : (1<1) + // temporary product (2) + */ + bufferLen = ((nsN+1)*2)*2 + +gsPrecompResourcelen(precompLen,nsN) //+precompLen*nsN + +nsN + +nsN + +nsN*2; + } + else { + cpSize expBitSize = IPP_MAX(RSA_PRV_KEY_BITSIZE_P(pKey), RSA_PRV_KEY_BITSIZE_Q(pKey)); + cpSize w = gsMontExp_WinSize(expBitSize); + cpSize precompLen = (1==w)? 0 : (1<1) + // recoure to keep "masked" multipler (x|1) (1), (w=1) + // or resource to keep zero-extended power e (1), (w>1) + // temporary product (2) + */ + bufferLen = ((nsP*2+1)*2)*2 + +gsPrecompResourcelen(precompLen, nsP) //+precompLen*nsP + +nsP + +nsP + +nsP*2; + bufferLen = IPP_MAX( IPP_MAX(validationBufferLen,generationBufferLen), bufferLen ); + } + *pBufferSize = bufferLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + (CACHE_LINE_SIZE-1); + return ippStsNoErr; + } +} + + + +void gsRSApub_cipher(IppsBigNumState* pY, + const IppsBigNumState* pX, + const IppsRSAPublicKeyState* pKey, + BNU_CHUNK_T* pScratchBuffer) +{ + IppsMontState* pMontN = RSA_PUB_KEY_NMONT(pKey); + gsMontEnc_BN(pY, pX, pMontN, pScratchBuffer); + + { + /* optimal size of window */ + BNU_CHUNK_T* pExp = RSA_PUB_KEY_E(pKey); + cpSize nsExp = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_E(pKey)); + cpSize w = gsMontExp_WinSize(RSA_PUB_KEY_BITSIZE_E(pKey)); + + if(1==w) + gsMontExpBin_BN(pY, pY, pExp, nsExp, pMontN, pScratchBuffer); + else + gsMontExpWin_BN(pY, pY, pExp, nsExp, w, pMontN, pScratchBuffer); + } + + gsMontDec_BN(pY, pY, pMontN, pScratchBuffer); +} + + +/*F* +// Name: ippsRSA_Encrypt +// +// Purpose: Performs RSA Encryprion +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pPtxt +// NULL == pCtxt +// NULL == pBuffer +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// !BN_VALID_ID(pPtxt) +// !BN_VALID_ID(pCtxt) +// +// ippStsIncompleteContextErr public key is not setup +// +// ippStsOutOfRangeErr pPtxt >= modulus +// pPtxt <0 +// +// ippStsSizeErr BN_ROOM(pCtxt) is not enough +// +// ippStsNoErr no error +// +// Parameters: +// pPtxt pointer to the plaintext +// pCtxt pointer to the ciphertext +// pKey pointer to the key context +// pScratchBuffer pointer to the temporary buffer +*F*/ +IPPFUN(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, + IppsBigNumState* pCtxt, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pScratchBuffer)) +{ + IPP_BAD_PTR2_RET(pKey, pScratchBuffer); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pPtxt); + pPtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_NEGATIVE(pPtxt), ippStsOutOfRangeErr); + IPP_BADARG_RET(0 <= cpCmp_BNU(BN_NUMBER(pPtxt), BN_SIZE(pPtxt), + MNT_MODULUS(RSA_PUB_KEY_NMONT(pKey)), MNT_SIZE(RSA_PUB_KEY_NMONT(pKey))), ippStsOutOfRangeErr); + + IPP_BAD_PTR1_RET(pCtxt); + pCtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_ROOM(pCtxt) < BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_N(pKey)), ippStsSizeErr); + + gsRSApub_cipher(pCtxt, + pPtxt, + pKey, + (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); + return ippStsNoErr; +} + + + +void gsRSAprv_cipher(IppsBigNumState* pY, + const IppsBigNumState* pX, + const IppsRSAPrivateKeyState* pKey, + BNU_CHUNK_T* pScratchBuffer) +{ + IppsMontState* pMontN = RSA_PRV_KEY_NMONT(pKey); + gsMontEnc_BN(pY, pX, pMontN, pScratchBuffer); + + { + /* optimal size of window */ + BNU_CHUNK_T* pExp = RSA_PRV_KEY_D(pKey); + cpSize nsExp = BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_D(pKey)); + cpSize w = gsMontExp_WinSize(RSA_PRV_KEY_BITSIZE_D(pKey)); + + if(1==w) + gsMontExpBin_BN_sscm(pY, pY, pExp, nsExp, pMontN, pScratchBuffer); + else + gsMontExpWin_BN_sscm(pY, pY, pExp, nsExp, w, pMontN, pScratchBuffer); + } + + gsMontDec_BN(pY, pY, pMontN, pScratchBuffer); +} + +void gsRSAprv_cipher_crt(IppsBigNumState* pY, + const IppsBigNumState* pX, + const IppsRSAPrivateKeyState* pKey, + BNU_CHUNK_T* pScratchBuffer) +{ + /* P- and Q- montgometry engines */ + IppsMontState* pMontP = RSA_PRV_KEY_PMONT(pKey); + IppsMontState* pMontQ = RSA_PRV_KEY_QMONT(pKey); + cpSize nsP = MNT_SIZE(pMontP); + cpSize nsQ = MNT_SIZE(pMontQ); + + const BNU_CHUNK_T* dataX = BN_NUMBER(pX); + cpSize nsX = BN_SIZE(pX); + BNU_CHUNK_T* dataXp = BN_NUMBER(pY); + BNU_CHUNK_T* dataXq = BN_BUFFER(pY); + + cpSize bitSizeDP = BITSIZE_BNU(RSA_PRV_KEY_DP(pKey), nsP); + cpSize bitSizeDQ = BITSIZE_BNU(RSA_PRV_KEY_DQ(pKey), nsQ); + cpSize w; + BNU_CHUNK_T cf; + + /* compute xq = x^dQ mod Q */ + COPY_BNU(dataXq, dataX, nsX); + cpMod_BNU(dataXq, nsX, MNT_MODULUS(pMontQ), nsQ); + gsMontEnc_BNU(dataXq, dataXq, nsQ, pMontQ, pScratchBuffer); + w = gsMontExp_WinSize(bitSizeDQ); + + if(1==w) + gsMontExpBin_BNU_sscm(dataXq, + dataXq, nsQ, + RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(bitSizeDQ), + pMontQ, pScratchBuffer); + else + gsMontExpWin_BNU_sscm(dataXq, + dataXq, nsQ, + RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(bitSizeDQ), w, + pMontQ, pScratchBuffer); + + gsMontDec_BNU(dataXq, dataXq, nsQ, pMontQ, pScratchBuffer); + + /* compute xp = x^dP mod P */ + COPY_BNU(dataXp, dataX, nsX); + cpMod_BNU(dataXp, nsX, MNT_MODULUS(pMontP), nsP); + gsMontEnc_BNU(dataXp, dataXp, nsP, pMontP, pScratchBuffer); + w = gsMontExp_WinSize(bitSizeDP); + + if(1==w) + gsMontExpBin_BNU_sscm(dataXp, + dataXp, nsP, + RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(bitSizeDP), + pMontP, pScratchBuffer); + else + gsMontExpWin_BNU_sscm(dataXp, + dataXp, nsP, + RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(bitSizeDP), w, + pMontP, pScratchBuffer); + + gsMontDec_BNU(dataXp, dataXp, nsP, pMontP, pScratchBuffer); + + /* xp -= xq */ + cf = cpSub_BNU(dataXp, dataXp, dataXq, nsQ); + if(nsP-nsQ) + cf = cpDec_BNU(dataXp+nsQ, dataXp+nsQ, (nsP-nsQ), cf); + if(cf) + cpAdd_BNU(dataXp, dataXp, MNT_MODULUS(pMontP), nsP); + + /* xp = xp*qInv mod P */ + cpMontMul_BNU(dataXp, + dataXp, nsP, + RSA_PRV_KEY_INVQ(pKey), nsP, + MNT_MODULUS(pMontP), nsP, MNT_HELPER(pMontP), + pScratchBuffer, NULL); + + /* Y = xq + xp*Q */ + cpMul_BNU_school(pScratchBuffer, + dataXp, nsP, + MNT_MODULUS(pMontQ), nsQ); + cf = cpAdd_BNU(BN_NUMBER(pY), pScratchBuffer, dataXq, nsQ); + cpInc_BNU(BN_NUMBER(pY)+nsQ, pScratchBuffer+nsQ, nsP, cf); + + nsX = nsP+nsQ; + FIX_BNU(BN_NUMBER(pY), nsX); + BN_SIZE(pY) = nsX; + BN_SIGN(pY) = ippBigNumPOS; +} + +/*F* +// Name: ippsRSA_Decrypt +// +// Purpose: Performs RSA Decryprion +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pCtxt +// NULL == pPtxt +// NULL == pBuffer +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// !BN_VALID_ID(pCtxt) +// !BN_VALID_ID(pPtxt) +// +// ippStsIncompleteContextErr private key is not set up +// +// ippStsOutOfRangeErr pCtxt >= modulus +// pCtxt <0 +// +// ippStsSizeErr BN_ROOM(pPtxt) is not enough +// +// ippStsNoErr no error +// +// Parameters: +// pCtxt pointer to the ciphertext +// pPtxt pointer to the plaintext +// pKey pointer to the key context +// pScratchBuffer pointer to the temporary buffer +*F*/ +IPPFUN(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, + IppsBigNumState* pPtxt, + const IppsRSAPrivateKeyState* pKey, + Ipp8u* pScratchBuffer)) +{ + IPP_BAD_PTR2_RET(pKey, pScratchBuffer); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pCtxt); + pCtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_NEGATIVE(pCtxt), ippStsOutOfRangeErr); + IPP_BADARG_RET(0 <= cpCmp_BNU(BN_NUMBER(pCtxt), BN_SIZE(pCtxt), + MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)), MNT_SIZE(RSA_PRV_KEY_NMONT(pKey))), ippStsOutOfRangeErr); + + IPP_BAD_PTR1_RET(pPtxt); + pPtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_ROOM(pPtxt) < BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_N(pKey)), ippStsSizeErr); + + if(RSA_PRV_KEY1_VALID_ID(pKey)) + gsRSAprv_cipher(pPtxt, + pCtxt, + pKey, + (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); + else + gsRSAprv_cipher_crt(pPtxt, + pCtxt, + pKey, + (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c b/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c new file mode 100644 index 0000000000..22b8917f67 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c @@ -0,0 +1,176 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcptool.h" +#include "pcpngrsa.h" +#include "pcphash.h" + + +/*F* +// Name: ippsRSAEncrypt_OAEP +// +// Purpose: Performs RSAES-OAEP encryprion scheme +// +// Returns: Reason: +// ippStsNotSupportedModeErr unknown hashAlg +// +// ippStsNullPtrErr NULL == pKey +// NULL == pSrc +// NULL == pDst +// NULL == pLabel +// NULL == pSeed +// NULL == pBuffer +// +// ippStsLengthErr srcLen <0 +// labLen <0 +// srcLen > RSAsize -2*hashLen -2 +// RSAsize < 2*hashLen +2 +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// +// ippStsIncompleteContextErr public key is not set up +// +// ippStsNoErr no error +// +// Parameters: +// pSrc pointer to the plaintext +// srcLen plaintext length (bytes) +// pLabel (optional) pointer to the label associated with plaintext +// labLen label length (bytes) +// pSeed seed string of hashLen size +// pDst pointer to the ciphertext (length of pdst is not less then size of RSA modulus) +// pKey pointer to the RSA public key context +// hashAlg hash alg ID +// pBuffer pointer to scratch buffer +*F*/ +IPPFUN(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +{ + int hashLen; + + /* test hash algorith ID */ + hashAlg = cpValidHashAlg(hashAlg); + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* test data pointer */ + IPP_BAD_PTR3_RET(pSrc,pDst, pSeed); + + IPP_BADARG_RET(!pLabel && labLen, ippStsNullPtrErr); + + /* test public key context */ + IPP_BAD_PTR2_RET(pKey, pBuffer); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + /* test length */ + IPP_BADARG_RET(srcLen<0||labLen<0, ippStsLengthErr); + + hashLen = cpHashSize(hashAlg); + /* test compatibility of RSA and hash length */ + IPP_BADARG_RET(BITS2WORD8_SIZE(RSA_PRV_KEY_BITSIZE_N(pKey)) < (2*hashLen +2), ippStsLengthErr); + /* test compatibility of msg length and other (RSA and hash) lengths */ + IPP_BADARG_RET(BITS2WORD8_SIZE(RSA_PRV_KEY_BITSIZE_N(pKey))-(2*hashLen +2) < srcLen, ippStsLengthErr); + + { + /* size of RSA modulus in bytes and chunks */ + int k = BITS2WORD8_SIZE(RSA_PUB_KEY_BITSIZE_N(pKey)); + cpSize nsN = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_N(pKey)); + + /* + // EME-OAEP encoding + */ + { + Ipp8u seedMask[BITS2WORD8_SIZE(IPP_SHA512_DIGEST_BITSIZE)]; + + Ipp8u* pMaskedSeed = pDst+1; + Ipp8u* pMaskedDB = pDst +hashLen +1; + + pDst[0] = 0; + + /* maskedDB = MGF(seed, k-1-hashLen)*/ + ippsMGF(pSeed, hashLen, pMaskedDB, k-1-hashLen, hashAlg); + + /* seedMask = HASH(pLab) */ + ippsHashMessage(pLabel, labLen, seedMask, hashAlg); + + /* maskedDB ^= concat(HASH(pLab),PS,0x01,pSc) */ + XorBlock(pMaskedDB, seedMask, pMaskedDB, hashLen); + pMaskedDB[k-srcLen-hashLen-2] ^= 0x01; + XorBlock(pMaskedDB+k-srcLen-hashLen-2+1, pSrc, pMaskedDB+k-srcLen-hashLen-2+1, srcLen); + + /* seedMask = MGF(maskedDB, hashLen) */ + ippsMGF(pMaskedDB, k-1-hashLen, seedMask, hashLen, hashAlg); + /* maskedSeed = seed ^ seedMask */ + XorBlock(pSeed, seedMask, pMaskedSeed, hashLen); + } + + /* RSA encryption */ + { + /* align buffer */ + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); + + /* temporary BN */ + __ALIGN8 IppsBigNumState tmpBN; + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &tmpBN); + + /* updtae buffer pointer */ + pScratchBuffer += (nsN+1)*2; + + ippsSetOctString_BN(pDst, k, &tmpBN); + + gsRSApub_cipher(&tmpBN, &tmpBN, pKey, pScratchBuffer); + + ippsGetOctString_BN(pDst, k, &tmpBN); + } + + return ippStsNoErr; + } +} + + +IPPFUN(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pBuffer)) +{ return ippsRSAEncrypt_OAEP(pSrc,srcLen, pLabel,labLen, pSeed, + pDst, pKey, + IPP_ALG_HASH_SHA256, + pBuffer); } diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c b/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c new file mode 100644 index 0000000000..e942bed1a5 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c @@ -0,0 +1,323 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpprimeg.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + +/*F* +// Name: ippsRSA_ValidateKeys +// +// Purpose: Validate RSA keys +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pPublicKey +// NULL == pPrivateKeyType2 +// NULL == pPrivateKeyType1 +// NULL == pBuffer +// NULL == pPrimeGen +// NULL == rndFunc +// NULL == pResult +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID(pPublicKey) +// !RSA_PRV_KEY2_VALID_ID(pPrivateKeyType2) +// !RSA_PRV_KEY1_VALID_ID(pPrivateKeyType1) +// !PRIME_VALID_ID(pPrimeGen) +// +// ippStsIncompleteContextErr public and.or private key is not set up +// +// ippStsSizeErr PRIME_MAXBITSIZE(pPrimeGen) < factorPbitSize +// +// ippStsBadArgErr nTrials < 1 +// +// ippStsNoErr no error +// +// Parameters: +// pResult pointer to the validation result +// pPublicKey pointer to the public key context +// pPrivateKeyType2 pointer to the private key type2 context +// pPrivateKeyType1 (optional) pointer to the private key type1 context +// pBuffer pointer to the temporary buffer +// nTrials parameter of Miller-Rabin Test +// pPrimeGen pointer to the Prime generator context +// rndFunc external PRNG +// pRndParam pointer to the external PRNG parameters +*F*/ +/* +// make sure D*E = 1 mod(phi(P,Q)) +// where phi(P,Q) = (P-1)*(Q-1) +*/ +static +int isValidPriv1_classic(const BNU_CHUNK_T* pN, int nsN, + const BNU_CHUNK_T* pE, int nsE, + const BNU_CHUNK_T* pD, int nsD, + const BNU_CHUNK_T* pFactorP, int nsP, + const BNU_CHUNK_T* pFactorQ, int nsQ, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* pPhi = pBuffer; + BNU_CHUNK_T* pProduct = pPhi + nsN; + BNU_CHUNK_T c = cpSub_BNU(pPhi, pN, pFactorP, nsP); + int prodLen; + if(nsN>1) cpDec_BNU(pPhi+nsP, pN+nsP, nsQ, c); + c = cpSub_BNU(pPhi,pPhi, pFactorQ, nsQ); + if(nsN>1) cpDec_BNU(pPhi+nsQ, pPhi+nsQ, nsP, c); + cpInc_BNU(pPhi, pPhi, nsP+nsQ, 1); + + cpMul_BNU_school(pProduct, pE, nsE, pD, nsD); + prodLen = cpMod_BNU(pProduct, nsE+nsD, pPhi, nsN); + + return 1==cpEqu_BNU_CHUNK(pProduct, prodLen, 1)? IPP_IS_VALID : IPP_IS_INVALID; +} + +/* +// make sure D*E = 1 mod(lcm(P-1,Q-1)) +// where lcm(P-1,Q-1) = (P-1)*(Q-1)/gcd(P-1,Q-1) +*/ +static +int isValidPriv1_rsa(const BNU_CHUNK_T* pN, int nsN, + const BNU_CHUNK_T* pE, int nsE, + const BNU_CHUNK_T* pD, int nsD, + BNU_CHUNK_T* pFactorP, int nsP, + BNU_CHUNK_T* pFactorQ, int nsQ, + BNU_CHUNK_T* pBuffer) +{ + __ALIGN8 IppsBigNumState tmpBN1; + __ALIGN8 IppsBigNumState tmpBN2; + __ALIGN8 IppsBigNumState tmpBN3; + + BNU_CHUNK_T* pProduct = pBuffer; + BNU_CHUNK_T* pGcd = pProduct+(nsN+1); + BNU_CHUNK_T* pLcm; + int nsLcm; + int prodLen; + pBuffer = pGcd + (nsP+1)*2; + + /* P = P-1 and Q = Q-1 */ + pFactorP[0]--; + pFactorQ[0]--; + + /* compute product (P-1)*(Q-1) = P*Q -P -Q +1 = N -(P-1) -(Q-1) -1 */ + { + BNU_CHUNK_T c = cpSub_BNU(pProduct, pN, pFactorP, nsP); + if(nsN>1) cpDec_BNU(pProduct+nsP, pN+nsP, nsQ, c); + c = cpSub_BNU(pProduct, pProduct, pFactorQ, nsQ); + if(nsN>1) cpDec_BNU(pProduct+nsQ, pProduct+nsQ, nsP, c); + cpDec_BNU(pProduct, pProduct, nsN, 1); + } + + /* compute gcd(p-1, q-1) */ + BN_Make(pGcd, pGcd+nsP+1, nsP, &tmpBN1); /* BN(gcd) */ + BN_SIZE(&tmpBN1) = nsP; + BN_Make(pFactorP, pBuffer, nsP, &tmpBN2); /* BN(P-1) */ + BN_SIZE(&tmpBN2) = nsP; + BN_Make(pFactorQ, pBuffer+nsP+1, nsQ, &tmpBN3); /* BN(Q-1) */ + BN_SIZE(&tmpBN3) = nsQ; + ippsGcd_BN(&tmpBN2, &tmpBN3, &tmpBN1); + + /* compute lcm(p-1, q-1) = (p-1)(q-1)/gcd(p-1, q-1) */ + pLcm = pBuffer; + cpDiv_BNU(pLcm, &nsLcm, pProduct, nsN, pGcd, BN_SIZE(&tmpBN1)); + + /* test E*D = 1 mod lcm */ + cpMul_BNU_school(pProduct, pE, nsE, pD, nsD); + prodLen = cpMod_BNU(pProduct, nsE+nsD, pLcm, nsLcm); + + /* restore P and Q */ + pFactorP[0]++; + pFactorQ[0]++; + + return 1==cpEqu_BNU_CHUNK(pProduct, prodLen, 1)? IPP_IS_VALID : IPP_IS_INVALID; +} + +IPPFUN(IppStatus, ippsRSA_ValidateKeys,(int* pResult, + const IppsRSAPublicKeyState* pPublicKey, + const IppsRSAPrivateKeyState* pPrivateKeyType2, + const IppsRSAPrivateKeyState* pPrivateKeyType1, /*optional */ + Ipp8u* pBuffer, + int nTrials, + IppsPrimeState* pPrimeGen, + IppBitSupplier rndFunc, void* pRndParam)) +{ + IPP_BAD_PTR1_RET(pPublicKey); + pPublicKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pPublicKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pPublicKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pPublicKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pPrivateKeyType2); + pPrivateKeyType2 = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrivateKeyType2, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY2_VALID_ID(pPrivateKeyType2), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrivateKeyType2), ippStsIncompleteContextErr); + + if(pPrivateKeyType1) { /* pPrivateKeyType1 is optional */ + pPrivateKeyType1 = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrivateKeyType1, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY1_VALID_ID(pPrivateKeyType1), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrivateKeyType1), ippStsIncompleteContextErr); + } + + IPP_BAD_PTR1_RET(pPrimeGen); + pPrimeGen = (IppsPrimeState*)( IPP_ALIGNED_PTR(pPrimeGen, PRIME_ALIGNMENT) ); + IPP_BADARG_RET(!PRIME_VALID_ID(pPrimeGen), ippStsContextMatchErr); + IPP_BADARG_RET(PRIME_MAXBITSIZE(pPrimeGen) < RSA_PRV_KEY_BITSIZE_P(pPrivateKeyType2), ippStsSizeErr); + + IPP_BAD_PTR3_RET(pResult, pBuffer, rndFunc); + + /* test security parameter parameter */ + IPP_BADARG_RET((1>nTrials), ippStsBadArgErr); + + { + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T))); + + /* E key component */ + BNU_CHUNK_T* pExpE = RSA_PUB_KEY_E(pPublicKey); + cpSize nsE = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_E(pPublicKey)); + /* P, dP, invQ key components */ + BNU_CHUNK_T* pFactorP= MNT_MODULUS(RSA_PRV_KEY_PMONT(pPrivateKeyType2)); + BNU_CHUNK_T* pExpDp = RSA_PRV_KEY_DP(pPrivateKeyType2); + BNU_CHUNK_T* pInvQ = RSA_PRV_KEY_INVQ(pPrivateKeyType2); + cpSize nsP = MNT_SIZE(RSA_PRV_KEY_PMONT(pPrivateKeyType2)); + /* Q, dQ key components */ + BNU_CHUNK_T* pFactorQ= MNT_MODULUS(RSA_PRV_KEY_QMONT(pPrivateKeyType2)); + BNU_CHUNK_T* pExpDq = RSA_PRV_KEY_DQ(pPrivateKeyType2); + cpSize nsQ = MNT_SIZE(RSA_PRV_KEY_QMONT(pPrivateKeyType2)); + + /*const*/ BNU_CHUNK_T* pN0 = MNT_MODULUS(RSA_PUB_KEY_NMONT(pPublicKey)); + cpSize nsN = MNT_SIZE(RSA_PUB_KEY_NMONT(pPublicKey)); + + *pResult = IPP_IS_VALID; + + /* make sure P is prime */ + if(!cpPrimeTest(pFactorP, nsP, nTrials, pPrimeGen, rndFunc, pRndParam)) { + *pResult = IPP_IS_COMPOSITE; + return ippStsNoErr; + } + + /* make sure Q is prime */ + if(!cpPrimeTest(pFactorQ, nsQ, nTrials, pPrimeGen, rndFunc, pRndParam)) { + *pResult = IPP_IS_COMPOSITE; + return ippStsNoErr; + } + + /* make sure PubKey(N)==PrivKeytype2(N) and PubKey(N)==PrivKeytype1(N) */ + if(cpCmp_BNU(pN0, nsN, + MNT_MODULUS(RSA_PRV_KEY_NMONT(pPrivateKeyType2)), MNT_SIZE(RSA_PRV_KEY_NMONT(pPrivateKeyType2)))) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + if(pPrivateKeyType1) { + if(cpCmp_BNU(pN0, nsN, + MNT_MODULUS(RSA_PRV_KEY_NMONT(pPrivateKeyType1)), MNT_SIZE(RSA_PRV_KEY_NMONT(pPrivateKeyType1)))) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + } + + /* make sure 3 <= E < N */ + if(1==nsE && pExpE[0]<3) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + if(0 <= cpCmp_BNU(pExpE, nsE, pN0, nsN)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + + { + BNU_CHUNK_T* pFactor1 = pScratchBuffer; + BNU_CHUNK_T* pInv = pFactor1 +nsP+1; + BNU_CHUNK_T* pBufInv = pInv +nsP+1; + BNU_CHUNK_T* pBufE = pBufInv +nsP+1; + BNU_CHUNK_T* pBufFact = pBufE +nsP+1; + BNU_CHUNK_T* pProduct = pBufInv; + + /* make sure E*dP = 1 mod (P-1) */ + cpDec_BNU(pFactor1, pFactorP, nsP, 1); + cpMul_BNU_school(pProduct, pExpDp, nsP, pExpE, nsE); + cpMod_BNU(pProduct, nsP+nsE, pFactor1, nsP); + if(!cpEqu_BNU_CHUNK(pProduct, nsP, 1)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + /* make sure 1==GCD(E,P-1) => exist Inv(E,P-1) */ + if(!cpModInv_BNU(pInv, pExpE, nsE, pFactor1, nsP, pBufInv, pBufE, pBufFact)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + + /* make sure E*dQ = 1 mod (Q-1) */ + cpDec_BNU(pFactor1, pFactorQ, nsQ, 1); + cpMul_BNU_school(pProduct, pExpDq, nsQ, pExpE, nsE); + cpMod_BNU(pProduct, nsQ+nsE, pFactor1, nsQ); + if(!cpEqu_BNU_CHUNK(pProduct, nsQ, 1)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + /* make sure 1==GCD(E,Q-1) => exist Inv(E,Q-1) */ + if(!cpModInv_BNU(pInv, pExpE, nsE, pFactor1, nsQ, pBufInv, pBufE, pBufFact)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + } + + /* make sure Q*Qinv = 1 mod P */ + cpMontMul_BNU(pScratchBuffer, + pFactorQ, nsQ, + pInvQ, nsP, + pFactorP, nsP, MNT_HELPER(RSA_PRV_KEY_PMONT(pPrivateKeyType2)), + pScratchBuffer+nsP, NULL); + if(!cpEqu_BNU_CHUNK(pScratchBuffer, nsP, 1)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + + /* test priva exponent (optiobal) */ + if(pPrivateKeyType1) { + const BNU_CHUNK_T* pExpD = RSA_PRV_KEY_D(pPrivateKeyType1); + cpSize nsD = nsN; + + int resilt1 = isValidPriv1_classic(pN0,nsN, pExpE,nsE, pExpD,nsD, + pFactorP,nsP, pFactorQ,nsQ, + (BNU_CHUNK_T*)pScratchBuffer); + int resilt2 = isValidPriv1_rsa(pN0,nsN, pExpE,nsE, pExpD,nsD, + pFactorP,nsP, pFactorQ,nsQ, + (BNU_CHUNK_T*)pScratchBuffer); + if(IPP_IS_VALID!=resilt1 && IPP_IS_VALID!=resilt2) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + } + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c b/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c new file mode 100644 index 0000000000..f038522c4d --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c @@ -0,0 +1,496 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + +/*F* +// Name: ippsRSA_GetSizePrivateKeyType1 +// +// Purpose: Returns context size (bytes) of RSA private key (type1) context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= privateExpBitSize +// privateExpBitSize > rsaModulusBitSize +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// privateExpBitSize bitsize of private exponent (bitsize of D) +// pSize pointer to the size of RSA key context (bytes) +*F*/ +static int cpSizeof_RSA_privateKey1(int rsaModulusBitSize, int privateExpBitSize) +{ + int prvExpLen = BITS_BNU_CHUNK(privateExpBitSize); + int modulusLen32 = BITS2WORD32_SIZE(rsaModulusBitSize); + int montNsize; + gsMontGetSize(ippBinaryMethod, modulusLen32, &montNsize); + + return sizeof(IppsRSAPrivateKeyState) + + prvExpLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + montNsize + + (RSA_PRIVATE_KEY_ALIGNMENT-1); +} + +IPPFUN(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +{ + IPP_BAD_PTR1_RET(pKeySize); + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0 rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= privateExpBitSize +// privateExpBitSize > rsaModulusBitSize +// +// ippStsMemAllocErr keyCtxSize is not enough for operation +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// privateExpBitSize bitsize of private exponent (bitsize of D) +// pKey pointer to the key context +// keyCtxSize size of memmory accosizted with key comtext +*F*/ +IPPFUN(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0= pModulus +// 0 >= pPrivateExp +// +// ippStsSizeErr bitsize(pModulus) exceeds requested value +// bitsize(pPrivateExp) exceeds requested value +// +// ippStsNoErr no error +// +// Parameters: +// pModulus pointer to modulus (N) +// pPrivateExp pointer to public exponent (D) +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPrivateExp, + IppsRSAPrivateKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY1_VALID_ID(pKey), ippStsContextMatchErr); + + IPP_BAD_PTR1_RET(pModulus); + pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pModulus)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pModulus), BN_SIZE(pModulus)) > RSA_PRV_KEY_MAXSIZE_N(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pPrivateExp); + pPrivateExp = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivateExp, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivateExp), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pPrivateExp)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPrivateExp), BN_SIZE(pPrivateExp)) > RSA_PRV_KEY_MAXSIZE_D(pKey), ippStsSizeErr); + + { + /* store D */ + ZEXPAND_COPY_BNU(RSA_PRV_KEY_D(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_MAXSIZE_D(pKey)), BN_NUMBER(pPrivateExp), BN_SIZE(pPrivateExp)); + + /* setup montgomery engine */ + gsMontSet((Ipp32u*)BN_NUMBER(pModulus), BN_SIZE32(pModulus), RSA_PRV_KEY_NMONT(pKey)); + + RSA_PRV_KEY_BITSIZE_N(pKey) = cpBN_bitsize(pModulus); + RSA_PRV_KEY_BITSIZE_D(pKey) = cpBN_bitsize(pPrivateExp); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRSA_GetSizePrivateKeyType2 +// +// Purpose: Returns context size (bytes) of RSA private key (type2) context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > (factorPbitSize+factorQbitSize) +// MAX_RSA_SIZE < (factorPbitSize+factorQbitSize) +// +// ippStsBadArgErr 0 >= factorPbitSize +// 0 >= factorQbitSize +// factorQbitSize > factorPbitSize +// +// ippStsNoErr no error +// +// Parameters: +// factorPbitSize bitsize of RSA modulus (bitsize of P) +// factorPbitSize bitsize of private exponent (bitsize of Q) +// pSize pointer to the size of RSA key context (bytes) +*F*/ +static int cpSizeof_RSA_privateKey2(int factorPbitSize, int factorQbitSize) +{ + int factorPlen = BITS_BNU_CHUNK(factorPbitSize); + int factorQlen = BITS_BNU_CHUNK(factorQbitSize); + int factorPlen32 = BITS2WORD32_SIZE(factorPbitSize); + int factorQlen32 = BITS2WORD32_SIZE(factorQbitSize); + int rsaModulusLen32 = BITS2WORD32_SIZE(factorPbitSize+factorQbitSize); + int montPsize; + int montQsize; + int montNsize; + gsMontGetSize(ippBinaryMethod, factorPlen32, &montPsize); + gsMontGetSize(ippBinaryMethod, factorQlen32, &montQsize); + gsMontGetSize(ippBinaryMethod, rsaModulusLen32, &montNsize); + + return sizeof(IppsRSAPrivateKeyState) + + factorPlen*sizeof(BNU_CHUNK_T) /* dp slot */ + + factorQlen*sizeof(BNU_CHUNK_T) /* dq slot */ + + factorPlen*sizeof(BNU_CHUNK_T) /* qinv slot */ + + sizeof(BNU_CHUNK_T)-1 + + montPsize + + montQsize + + montNsize + + (RSA_PRIVATE_KEY_ALIGNMENT-1); +} + +IPPFUN(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +{ + IPP_BAD_PTR1_RET(pKeySize); + IPP_BADARG_RET((factorPbitSize<=0) || (factorQbitSize<=0), ippStsBadArgErr); + IPP_BADARG_RET((factorPbitSize < factorQbitSize), ippStsBadArgErr); + IPP_BADARG_RET((MIN_RSA_SIZE>(factorPbitSize+factorQbitSize) || (factorPbitSize+factorQbitSize)>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + + *pKeySize = cpSizeof_RSA_privateKey2(factorPbitSize, factorQbitSize); + return ippStsNoErr; +} + + +/*F* +// Name: ippsRSA_InitPrivateKeyType2 +// +// Purpose: Init RSA private key context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > (factorPbitSize+factorQbitSize) +// MAX_RSA_SIZE < (factorPbitSize+factorQbitSize) +// +// ippStsBadArgErr 0 >= factorPbitSize +// 0 >= factorQbitSize +// factorQbitSize > factorPbitSize +// +// ippStsMemAllocErr keyCtxSize is not enough for operation +// +// ippStsNoErr no error +// +// Parameters: +// factorPbitSize bitsize of RSA modulus (bitsize of P) +// factorQbitSize bitsize of private exponent (bitsize of Q) +// pKey pointer to the key context +// keyCtxSize size of memmory accosizted with key comtext +*F*/ +IPPFUN(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +{ + IPP_BAD_PTR1_RET(pKey); + IPP_BADARG_RET((factorPbitSize<=0) || (factorQbitSize<=0), ippStsBadArgErr); + IPP_BADARG_RET((factorPbitSize < factorQbitSize), ippStsBadArgErr); + IPP_BADARG_RET((MIN_RSA_SIZE>(factorPbitSize+factorQbitSize) || (factorPbitSize+factorQbitSize)>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + + /* test available size of context buffer */ + IPP_BADARG_RET(keyCtxSize= pFactorP, 0 >= pFactorQ +// 0 >= pCrtExpP, 0 >= pCrtExpQ +// 0 >= pInverseQ +// +// ippStsSizeErr bitsize(pFactorP) exceeds requested value +// bitsize(pFactorQ) exceeds requested value +// bitsize(pCrtExpP) > bitsize(pFactorP) +// bitsize(pCrtExpQ) > bitsize(pFactorQ) +// bitsize(pInverseQ) > bitsize(pFactorP) +// +// ippStsNoErr no error +// +// Parameters: +// pFactorP, pFactorQ pointer to the RSA modulus (N) prime factors +// pCrtExpP, pCrtExpQ pointer to CTR's exponent +// pInverseQ 1/Q mod P +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, + const IppsBigNumState* pFactorQ, + const IppsBigNumState* pCrtExpP, + const IppsBigNumState* pCrtExpQ, + const IppsBigNumState* pInverseQ, + IppsRSAPrivateKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY2_VALID_ID(pKey), ippStsContextMatchErr); + + IPP_BAD_PTR1_RET(pFactorP); + pFactorP = (IppsBigNumState*)( IPP_ALIGNED_PTR(pFactorP, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pFactorP), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pFactorP)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pFactorP), BN_SIZE(pFactorP)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pFactorQ); + pFactorQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pFactorQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pFactorQ), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pFactorQ)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pFactorQ), BN_SIZE(pFactorQ)) > RSA_PRV_KEY_BITSIZE_Q(pKey), ippStsSizeErr); + + /* let P>Q */ + IPP_BADARG_RET(0>=cpBN_cmp(pFactorP,pFactorQ), ippStsBadArgErr); + + IPP_BAD_PTR1_RET(pCrtExpP); + pCrtExpP = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCrtExpP, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCrtExpP), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pCrtExpP)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pCrtExpP), BN_SIZE(pCrtExpP)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pCrtExpQ); + pCrtExpQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCrtExpQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCrtExpQ), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pCrtExpQ)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pCrtExpQ), BN_SIZE(pCrtExpQ)) > RSA_PRV_KEY_BITSIZE_Q(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pInverseQ); + pInverseQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pInverseQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pInverseQ), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pInverseQ)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pInverseQ), BN_SIZE(pInverseQ)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); + + /* set bitsize(N) = 0, so the key contex is not ready */ + RSA_PRV_KEY_BITSIZE_N(pKey) = 0; + RSA_PRV_KEY_BITSIZE_D(pKey) = 0; + + /* setup montgomery engine P */ + gsMontSet((Ipp32u*)BN_NUMBER(pFactorP), BN_SIZE32(pFactorP), RSA_PRV_KEY_PMONT(pKey)); + /* setup montgomery engine Q */ + gsMontSet((Ipp32u*)BN_NUMBER(pFactorQ), BN_SIZE32(pFactorQ), RSA_PRV_KEY_QMONT(pKey)); + + /* actual size of key components */ + RSA_PRV_KEY_BITSIZE_P(pKey) = cpBN_bitsize(pFactorP); + RSA_PRV_KEY_BITSIZE_Q(pKey) = cpBN_bitsize(pFactorQ); + + /* store CTR's exp dp */ + ZEXPAND_COPY_BNU(RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_P(pKey)), BN_NUMBER(pCrtExpP), BN_SIZE(pCrtExpP)); + /* store CTR's exp dq */ + ZEXPAND_COPY_BNU(RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_Q(pKey)), BN_NUMBER(pCrtExpQ), BN_SIZE(pCrtExpQ)); + /* store mont encoded CTR's coeff qinv */ + { + IppsMontState* pMontP = RSA_PRV_KEY_PMONT(pKey); + BNU_CHUNK_T* pTmpProduct = MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)); + cpMontMul_BNU(RSA_PRV_KEY_INVQ(pKey), + BN_NUMBER(pInverseQ), BN_SIZE(pInverseQ), + MNT_SQUARE_R(pMontP), MNT_SIZE(pMontP), + MNT_MODULUS(pMontP), MNT_SIZE(pMontP), MNT_HELPER(pMontP), + pTmpProduct, NULL); + } + + /* setup montgomery engine N = P*Q */ + { + BNU_CHUNK_T* pN = MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)); + cpSize nsN = BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_P(pKey) + RSA_PRV_KEY_BITSIZE_Q(pKey)); + + cpMul_BNU_school(pN, + BN_NUMBER(pFactorP), BN_SIZE(pFactorP), + BN_NUMBER(pFactorQ), BN_SIZE(pFactorQ)); + + gsMontSet((Ipp32u*)MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)), BITS2WORD32_SIZE(RSA_PRV_KEY_BITSIZE_P(pKey)+RSA_PRV_KEY_BITSIZE_Q(pKey)), RSA_PRV_KEY_NMONT(pKey)); + + FIX_BNU(pN, nsN); + RSA_PRV_KEY_BITSIZE_N(pKey) = BITSIZE_BNU(pN, nsN); + } + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c b/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c new file mode 100644 index 0000000000..48ca2be853 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c @@ -0,0 +1,272 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + + +/*F* +// Name: ippsRSA_GetSizePublicKey +// +// Purpose: Returns context size (bytes) of RSA public key context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= publicExpBitSize +// publicExpBitSize > rsaModulusBitSize +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// publicExpBitSize bitsize of public exponent (bitsize of E) +// pSize pointer to the size of RSA key context (bytes) +*F*/ +static int cpSizeof_RSA_publicKey(int rsaModulusBitSize, int publicExpBitSize) +{ + int pubExpLen = BITS_BNU_CHUNK(publicExpBitSize); + int modulusLen32 = BITS2WORD32_SIZE(rsaModulusBitSize); + int montNsize; + gsMontGetSize(ippBinaryMethod, modulusLen32, &montNsize); + + return sizeof(IppsRSAPublicKeyState) + + pubExpLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + montNsize + + (RSA_PUBLIC_KEY_ALIGNMENT-1); +} + +IPPFUN(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int publicExpBitSize, int* pKeySize)) +{ + IPP_BAD_PTR1_RET(pKeySize); + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0 rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= publicExpBitSize +// publicExpBitSize > rsaModulusBitSize +// +// ippStsMemAllocErr keyCtxSize is not enough for operation +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// publicExpBitSize bitsize of public exponent (bitsize of E) +// pKey pointer to the key context +// keyCtxSize size of memmory accosizted with key comtext +*F*/ +IPPFUN(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, + IppsRSAPublicKeyState* pKey, int keyCtxSize)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0= pModulus +// 0 >= pPublicExp +// +// ippStsSizeErr bitsize(pModulus) exceeds requested value +// bitsize(pPublicExp) exceeds requested value +// +// ippStsNoErr no error +// +// Parameters: +// pModulus pointer to modulus (N) +// pPublicExp pointer to public exponent (E) +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPublicExp, + IppsRSAPublicKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + + IPP_BAD_PTR1_RET(pModulus); + pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pModulus)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pModulus), BN_SIZE(pModulus)) > RSA_PUB_KEY_MAXSIZE_N(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pPublicExp); + pPublicExp = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPublicExp, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPublicExp), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pPublicExp)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPublicExp), BN_SIZE(pPublicExp)) > RSA_PUB_KEY_MAXSIZE_E(pKey), ippStsSizeErr); + + { + RSA_PUB_KEY_BITSIZE_N(pKey) = 0; + RSA_PUB_KEY_BITSIZE_E(pKey) = 0; + + /* store E */ + ZEXPAND_COPY_BNU(RSA_PUB_KEY_E(pKey), BITS_BNU_CHUNK(RSA_PUB_KEY_MAXSIZE_E(pKey)), BN_NUMBER(pPublicExp), BN_SIZE(pPublicExp)); + + /* setup montgomery engine */ + gsMontSet((Ipp32u*)BN_NUMBER(pModulus), BN_SIZE32(pModulus), RSA_PUB_KEY_NMONT(pKey)); + + RSA_PUB_KEY_BITSIZE_N(pKey) = cpBN_bitsize(pModulus); + RSA_PUB_KEY_BITSIZE_E(pKey) = cpBN_bitsize(pPublicExp); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRSA_GetPublicKey +// +// Purpose: Extract key component from the key context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// !BN_VALID_ID(pModulus) +// !BN_VALID_ID(pExp) +// +// ippStsIncompleteContextErr public key is not set up +// +// ippStsSizeErr BN_ROOM(pModulus), BN_ROOM(pExp) is not enough +// +// ippStsNoErr no error +// +// Parameters: +// pModulus (optional) pointer to the modulus (N) +// pExp (optional) pointer to the public exponent (E) +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, + IppsBigNumState* pExp, + const IppsRSAPublicKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + + if(pModulus) { + pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + IPP_BADARG_RET(BN_ROOM(pModulus)0; nsE--) { + eValue = dataE[nsE-1]; + + for(n=0; n=0; j--) { + mask_pattern = (BNU_CHUNK_T)(back_step-1); + + /* safeBuffer = (Y[] and mask_pattern) or (X[] and ~mask_pattern) */ + for(i=0; i>j) & 0x1) & (back_step^1); + j += back_step; + } + + /* execute rest bits of E */ + for(--nsE; nsE>0; nsE--) { + eValue = dataE[nsE-1]; + + for(j=BNU_CHUNK_BITS-1; j>=0; j--) { + mask_pattern = (BNU_CHUNK_T)(back_step-1); + + /* safeBuffer = (Y[] and mask_pattern) or (X[] and ~mask_pattern) */ + for(i=0; i>j) & 0x1) & (back_step^1); + j += back_step; + } + } + } + + return nsM; +} + + +/* +// "fast" fixed-size window montgomery exponentiation +// +// scratch buffer structure: +// precomutation resource[(1<>shift) &mask; + + /* initialize result */ + COPY_BNU(dataY, pResource+windowVal*nsM, nsM); + + for(eBit-=wBitSize; eBit>=0; eBit-=wBitSize) { + /* do square window times */ + for(n=0,windowVal=0; n>shift) &mask; + + if(windowVal) { + /* extract precomputed value and muptiply */ + cpMul_BNU(pProduct, dataY, nsM, pResource+windowVal*nsM, nsM, pBufferMulK); + cpMontRed_BNU(dataY, pProduct, dataM, nsM, m0); + } + } + } + } + + return nsM; +} + + +/* +// "safe" fixed-size window montgomery exponentiation +// +// scratch buffer structure: +// precomutation resource[(1<>shift) &mask; + + /* initialize result */ + cpScrambleGet((Ipp32u*)dataY, nsM*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), ((Ipp8u*)pResource)+windowVal*chunkSize, chunkSize); + + for(eBit-=bitsizeEwin; eBit>=0; eBit-=bitsizeEwin) { + /* do square window times */ + for(n=0,windowVal=0; n>shift) &mask; + + /* exptact precomputed value and muptiply */ + cpScrambleGet((Ipp32u*)dataT, nsM*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), ((Ipp8u*)pResource)+windowVal*chunkSize, chunkSize); + + cpMul_BNU(pProduct, dataY, nsM, dataT, nsM, pBufferMulK); + cpMontRed_BNU(dataY, pProduct, dataM, nsM, m0); + } + } + } + + return nsM; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h b/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h new file mode 100644 index 0000000000..beb996aed4 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h @@ -0,0 +1,229 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_NG_RSA_MONT_STUFF_H) +#define _CP_NG_RSA_MONT_STUFF_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + +/* +// Montgomery engine preparation (GetSize/init/Set) +*/ +void gsMontGetSize(IppsExpMethod method, int length, int* pSize); +void gsMontInit(IppsExpMethod method, int length, IppsMontState* pCtx); +void gsMontSet(const Ipp32u* pModulo, int size, IppsMontState* pCtx); + + +/* +// optimal size of fixed window exponentiation +*/ +__INLINE cpSize gsMontExp_WinSize(cpSize bitsize) +{ + return + bitsize> 4096? 6 : /* 4096- .. . */ + bitsize> 2666? 5 : /* 2666 - 4095 */ + bitsize> 717? 4 : /* 717 - 2665 */ + bitsize> 178? 3 : /* 178 - 716 */ + bitsize> 41? 2 : 1; /* 41 - 177 */ +} + +/* +// Montgomery encoding/decoding +*/ +__INLINE cpSize gsMontEnc_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXreg, cpSize nsX, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + cpSize nsM = MNT_SIZE(pMont); + BNU_CHUNK_T* pProduct = pBuffer; + BNU_CHUNK_T* pBufferKmul = NULL; + + cpMontMul_BNU(pR, + pXreg, nsX, MNT_SQUARE_R(pMont), nsM, + MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), + pProduct, pBufferKmul); + return nsM; +} + +__INLINE cpSize gsMontDec_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXmont, cpSize nsX, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + cpSize nsM = MNT_SIZE(pMont); + ZEXPAND_COPY_BNU(pBuffer, 2*nsM, pXmont, nsX); + + cpMontRed_BNU(pR, pBuffer, MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); + return nsM; +} + +__INLINE void gsMontEnc_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + + gsMontEnc_BNU(pR, BN_NUMBER(pXbn), BN_SIZE(pXbn), pMont, pBuffer); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + +__INLINE void gsMontDec_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + + gsMontDec_BNU(pR, BN_NUMBER(pXbn), BN_SIZE(pXbn), pMont, pBuffer); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + + +/* +// binary montgomery exponentiation ("fast" version) +*/ +cpSize gsMontExpBin_BNU(BNU_CHUNK_T* dataY, + const BNU_CHUNK_T* dataX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpBin_BN(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpBin_BNU(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +/* +// fixed-size window montgomery exponentiation ("fast" version) +*/ +cpSize gsMontExpWin_BNU(BNU_CHUNK_T* pY, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieW, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpWin_BN(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieW, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpWin_BNU(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, bitsieW, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +/* +// binary montgomery exponentiation ("safe" version) +*/ +__INLINE cpSize gsPrecompResourcelen(int n, cpSize nsM) +{ + cpSize nsR = sizeof(BNU_CHUNK_T)*nsM*n + (CACHE_LINE_SIZE-1); + nsR /=CACHE_LINE_SIZE; /* num of cashe lines */ + nsR *= (CACHE_LINE_SIZE/sizeof(BNU_CHUNK_T)); + return nsR; +} + +cpSize gsMontExpBin_BNU_sscm(BNU_CHUNK_T* pY, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpBin_BN_sscm(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpBin_BNU_sscm(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +/* +// fixed-size window montgomery exponentiation ("safe" version) +*/ +cpSize gsMontExpWin_BNU_sscm(BNU_CHUNK_T* dataY, + const BNU_CHUNK_T* dataX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieEwin, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpWin_BN_sscm(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieEwin, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpWin_BNU_sscm(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, bitsieEwin, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +#endif /* _CP_NG_RSA_MONT_STUFF_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c b/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c new file mode 100644 index 0000000000..86df1f3a12 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c @@ -0,0 +1,278 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcpngrsa.h" +#include "pcphash.h" +#include "pcptool.h" + +static int EMSA_PKCSv15(const Ipp8u* msgDg, int lenMsgDg, + const Ipp8u* fixPS, int lenFixPS, + Ipp8u* pEM, int lenEM) +{ + /* + // encoded message format: + // EM = 00 || 01 || PS=(FF..FF) || 00 || T + // T = fixPS || msgDg + // len(PS) >= 8 + */ + int tLen = lenFixPS + lenMsgDg; + + if(lenEM >= tLen+11) { + int psLen = lenEM - 3 - tLen; + + PaddBlock(0xFF, pEM, lenEM); + pEM[0] = 0x00; + pEM[1] = 0x01; + pEM[2+psLen] = 0x00; + CopyBlock(fixPS, pEM+3+psLen, lenFixPS); + CopyBlock(msgDg, pEM+3+psLen+lenFixPS, lenMsgDg); + return 1; + } + else + return 0; /* encoded message length too long */ +} + +/* +// The DER encoding T of the DigestInfo value is equal to the following (see PKCS-1v2-2): +*/ +static const Ipp8u SHA1_fixPS[] = "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14"; +static const Ipp8u SHA224_fixPS[] = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c"; +static const Ipp8u SHA256_fixPS[] = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20"; +static const Ipp8u SHA384_fixPS[] = "\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30"; +static const Ipp8u SHA512_fixPS[] = "\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40"; +static const Ipp8u MD5_fixPS[] = "\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10"; +static const Ipp8u SHA512_224_fixPS[] = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x05\x05\x00\x04\x1c"; +static const Ipp8u SHA512_256_fixPS[] = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x06\x05\x00\x04\x20"; + +typedef struct { + const Ipp8u* pSalt; + int saltLen; +} SaltInfo; + +static SaltInfo pksc15_salt[] = { + {NULL, 0}, + {SHA1_fixPS, sizeof(SHA1_fixPS)-1}, + {SHA256_fixPS, sizeof(SHA256_fixPS)-1}, + {SHA224_fixPS, sizeof(SHA224_fixPS)-1}, + {SHA512_fixPS, sizeof(SHA512_fixPS)-1}, + {SHA384_fixPS, sizeof(SHA384_fixPS)-1}, + { MD5_fixPS, sizeof(MD5_fixPS)-1}, + {NULL, 0}, + {SHA512_224_fixPS, sizeof(SHA512_224_fixPS)-1}, + {SHA512_256_fixPS, sizeof(SHA512_256_fixPS)-1}, +}; +/* //////////////////////////////////////////////////////////////////////////////////////////////// */ + +static int GenerateSing(const Ipp8u* pMsg, int msgLen, /* message representation */ + const Ipp8u* pSalt, int saltLen, /* fied string */ + Ipp8u* pSign, + const IppsRSAPrivateKeyState* pPrvKey, + const IppsRSAPublicKeyState* pPubKey, + Ipp8u* pBuffer) +{ + /* size of RSA modulus in bytes and chunks */ + cpSize rsaBits = RSA_PRV_KEY_BITSIZE_N(pPrvKey); + cpSize k = BITS2WORD8_SIZE(rsaBits); + cpSize nsN = BITS_BNU_CHUNK(rsaBits); + + /* EMSA-PKCS-v1_5 encoding */ + int result = EMSA_PKCSv15(pMsg,msgLen, pSalt,saltLen, pSign, k); + + if(result) { + /* align buffer */ + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); + + /* temporary BNs */ + __ALIGN8 IppsBigNumState bnC; + __ALIGN8 IppsBigNumState bnP; + + /* make BNs */ + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnC); + pScratchBuffer += (nsN+1)*2; + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnP); + pScratchBuffer += (nsN+1)*2; + + /* + // private-key operation + */ + ippsSetOctString_BN(pSign, k, &bnC); + + if(RSA_PRV_KEY1_VALID_ID(pPrvKey)) + gsRSAprv_cipher(&bnP, &bnC, pPrvKey, pScratchBuffer); + else + gsRSAprv_cipher_crt(&bnP, &bnC, pPrvKey, pScratchBuffer); + + ippsGetOctString_BN(pSign, k, &bnP); + + /* check the result before send it out (fault attack mitigatioin) */ + if(pPubKey) { + gsRSApub_cipher(&bnP, &bnP, pPubKey, pScratchBuffer); + + /* check signature before send it out (fault attack mitigatioin) */ + if(0!=cpBN_cmp(&bnP, &bnC)) { + PaddBlock(0, pSign, k); + result = 0; + } + } + } + + return result; +} + +IPPFUN(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + Ipp8u* pSign, + const IppsRSAPrivateKeyState* pPrvKey, + const IppsRSAPublicKeyState* pPubKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +{ + /* test private key context */ + IPP_BAD_PTR2_RET(pPrvKey, pBuffer); + pPrvKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrvKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pPrvKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrvKey), ippStsIncompleteContextErr); + + /* test hash algorith ID */ + hashAlg = cpValidHashAlg(hashAlg); + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* use aligned public key context if defined */ + if(pPubKey) { + pPubKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pPubKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pPubKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pPubKey), ippStsIncompleteContextErr); + } + + /* test data pointer */ + IPP_BAD_PTR2_RET(pMsg, pSign); + /* test length */ + IPP_BADARG_RET(msgLen<0, ippStsLengthErr); + + { + Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE]; + int mdLen = cpHashSize(hashAlg); + ippsHashMessage(pMsg, msgLen, md, hashAlg); + + { + const Ipp8u* pSalt = pksc15_salt[hashAlg].pSalt; + int saltLen = pksc15_salt[hashAlg].saltLen; + + int sts = GenerateSing(md, mdLen, + pSalt, saltLen, + pSign, + pPrvKey, pPubKey, pBuffer); + + return (1==sts)? ippStsNoErr : ippStsSizeErr; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +static int VerifySing(const Ipp8u* pMsg, int msgLen, /* message representation */ + const Ipp8u* pSalt, int saltLen, /* fied string */ + const Ipp8u* pSign, + int* pIsValid, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pBuffer) +{ + /* size of RSA modulus in bytes and chunks */ + cpSize rsaBits = RSA_PUB_KEY_BITSIZE_N(pKey); + cpSize k = BITS2WORD8_SIZE(rsaBits); + cpSize nsN = BITS_BNU_CHUNK(rsaBits); + + /* align buffer */ + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); + + /* temporary BNs */ + __ALIGN8 IppsBigNumState bnC; + __ALIGN8 IppsBigNumState bnP; + + /* make BNs */ + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnC); + pScratchBuffer += (nsN+1)*2; + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnP); + pScratchBuffer += (nsN+1)*2; + + /* + // public-key operation + */ + ippsSetOctString_BN(pSign, k, &bnP); + gsRSApub_cipher(&bnC, &bnP, pKey, pScratchBuffer); + + /* convert EM into the string */ + ippsGetOctString_BN((Ipp8u*)(BN_BUFFER(&bnC)), k, &bnC); + + /* EMSA-PKCS-v1_5 encoding */ + if( EMSA_PKCSv15(pMsg,msgLen, pSalt,saltLen, (Ipp8u*)(BN_NUMBER(&bnC)), k) ) { + *pIsValid = 1==EquBlock((Ipp8u*)(BN_BUFFER(&bnC)), (Ipp8u*)(BN_NUMBER(&bnC)), k); + return 1; + } + else + return 0; +} + +IPPFUN(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pSign, int* pIsValid, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +{ + /* test public key context */ + IPP_BAD_PTR2_RET(pKey, pBuffer); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + /* test hash algorith ID */ + hashAlg = cpValidHashAlg(hashAlg); + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* test data pointer */ + IPP_BAD_PTR3_RET(pMsg, pSign, pIsValid); + /* test length */ + IPP_BADARG_RET(msgLen<0, ippStsLengthErr); + + *pIsValid = 0; + { + Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE]; + int mdLen = cpHashSize(hashAlg); + ippsHashMessage(pMsg, msgLen, md, hashAlg); + + return VerifySing(md, mdLen, + pksc15_salt[hashAlg].pSalt, pksc15_salt[hashAlg].saltLen, + pSign, pIsValid, + pKey, pBuffer)? ippStsNoErr : ippStsSizeErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcppma.h b/external/crypto_px/sources/ippcp/src/pcppma.h new file mode 100644 index 0000000000..b9d1e1ca82 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcppma.h @@ -0,0 +1,83 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_PMA_H) +#define _PCP_PMA_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + + +/* +// Prime Modulo Arithmetic +*/ +#define PMA_set(r,a) \ + BN_SIGN((r)) = BN_SIGN((a)); \ + BN_SIZE((r)) = BN_SIZE((a)); \ + ZEXPAND_COPY_BNU(BN_NUMBER((r)),BN_ROOM((r)), BN_NUMBER((a)),BN_SIZE((a))) \ + +#define PMA_mod(r,a,modulo) \ + ippsMod_BN((a),(modulo),(r)) + +#define PMA_inv(r,a,modulo) \ + ippsModInv_BN((a),(modulo),(r)) + +#define PMA_div2(r,a,modulo) { \ + if( IsOdd_BN((a)) ) { \ + ippsAdd_BN((a), (modulo), (a)); \ + } \ + BN_SIZE((r)) = cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), (int)BN_SIZE((a)), 1); \ + cpBN_fix((r)); \ +} + +#define PMA_add(r,a,b,modulo) \ + ippsAdd_BN((a),(b),(r)); \ + if( cpCmp_BNU(BN_NUMBER((r)),BN_SIZE((r)),BN_NUMBER((modulo)),BN_SIZE(modulo)) >= 0 ) \ + ippsSub_BN((r),(modulo),(r)) + +#define PMA_sub(r,a,b,modulo) \ + ippsSub_BN((a),(b),(r)); \ + if( BN_NEGATIVE((r)) ) \ + ippsAdd_BN((r),(modulo),(r)) + +#define PMA_enc(r,a,mont) \ + cpMontEnc_BN((r), (a), (mont)) + +#define PMA_dec(r,a,mont) \ + cpMontDec_BN((r), (a), (mont)) + +#define PMA_sqre(r,a,mont) \ + ippsMontMul((a),(a), (mont),(r)) + +#define PMA_mule(r,a,b,mont) \ + ippsMontMul((a),(b), (mont),(r)) + +#endif /* _PCP_PMA_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpprimeg.h b/external/crypto_px/sources/ippcp/src/pcpprimeg.h new file mode 100644 index 0000000000..e61d4dee44 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpprimeg.h @@ -0,0 +1,78 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_PRIME_H) +#define _CP_PRIME_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + + +/* +// Prime context +*/ +struct _cpPrime { + IppCtxId idCtx; /* Prime context identifier */ + cpSize maxBitSize; /* max bit length */ + BNU_CHUNK_T* pPrime; /* prime value */ + BNU_CHUNK_T* pT1; /* temporary BNU */ + BNU_CHUNK_T* pT2; /* temporary BNU */ + BNU_CHUNK_T* pT3; /* temporary BNU */ + IppsMontState* pMont; /* montgomery engine */ +}; + +/* alignment */ +#define PRIME_ALIGNMENT ((int)sizeof(void*)) + +/* Prime accessory macros */ +#define PRIME_ID(ctx) ((ctx)->idCtx) +#define PRIME_MAXBITSIZE(ctx) ((ctx)->maxBitSize) +#define PRIME_NUMBER(ctx) ((ctx)->pPrime) +#define PRIME_TEMP1(ctx) ((ctx)->pT1) +#define PRIME_TEMP2(ctx) ((ctx)->pT2) +#define PRIME_TEMP3(ctx) ((ctx)->pT3) +#define PRIME_MONT(ctx) ((ctx)->pMont) + +#define PRIME_VALID_ID(ctx) (PRIME_ID((ctx))==idCtxPrimeNumber) + +/* easy prime test */ +int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize ns); + +/* prime test */ +int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen, + cpSize nTrials, + IppsPrimeState* pCtx, + IppBitSupplier rndFunc, void* pRndParam); + +void cpPackPrimeCtx(const IppsPrimeState* pCtx, Ipp8u* pBuffer); +void cpUnpackPrimeCtx(const Ipp8u* pBuffer, IppsPrimeState* pCtx); + +#endif /* _CP_PRIME_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpprimegenca.c b/external/crypto_px/sources/ippcp/src/pcpprimegenca.c new file mode 100644 index 0000000000..bfa6ea5518 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpprimegenca.c @@ -0,0 +1,472 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpprimeg.h" +#include "pcptool.h" + + +/*F* +// Name: ippsPrimeTest +// +// Purpose: Tests the set BN for being a probable prime. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pCtx +// NULL == pResult +// NULL == rndFunc +// ippStsContextMatchErr illegal pCtx->idCtx +// ippStsOutOfRangeErr zero value under the test +// ippStsBadArgErr 1 > nTrials +// ippStsNoErr no error +// +// Parameters: +// nTrials parameter for the Miller-Rabin probable primality test +// pResult pointer to the test result (IS_COMPOSITE / IS_PRIME) +// pCtx pointer to the context +// rndFunc external PRNG +// pRndParam pointer to the external PRNG parameters +*F*/ + +/* minimal prime test */ +static Ipp32u PrimeList[] = { + 2, 3, 5, 7, 11, 13, 17, 19, + 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, + 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, + 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, 257, 263, + 269, 271, 277, 281, 283, 293, 307, 311, + 313, 317, 331, 337, 347, 349, 353, 359, + 367, 373, 379, 383, 389, 397, 401, 409, + 419, 421, 431, 433, 439, 443, 449, 457, + 461, 463, 467, 479, 487, 491, 499, 503, + 509, 521, 523, 541, 547, 557, 563, 569, + 571, 577, 587, 593, 599, 601, 607, 613, + 617, 619, 631, 641, 643, 647, 653, 659, + 661, 673, 677, 683, 691, 701, 709, 719, + 727, 733, 739, 743, 751, 757, 761, 769, + 773, 787, 797, 809, 811, 821, 823, 827, + 829, 839, 853, 857, 859, 863, 877, 881, + 883, 887, 907, 911, 919, 929, 937, 941, + 947, 953, 967, 971, 977, 983, 991, 997, + 1009,1013,1019,1021,1031,1033,1039,1049, + 1051,1061,1063,1069,1087,1091,1093,1097, + 1103,1109,1117,1123,1129,1151,1153,1163, + 1171,1181,1187,1193,1201,1213,1217,1223, + 1229,1231,1237,1249,1259,1277,1279,1283, + 1289,1291,1297,1301,1303,1307,1319,1321, + 1327,1361,1367,1373,1381,1399,1409,1423, + 1427,1429,1433,1439,1447,1451,1453,1459, + 1471,1481,1483,1487,1489,1493,1499,1511, + 1523,1531,1543,1549,1553,1559,1567,1571, + 1579,1583,1597,1601,1607,1609,1613,1619, + 1621,1627,1637,1657,1663,1667,1669,1693, + 1697,1699,1709,1721,1723,1733,1741,1747, + 1753,1759,1777,1783,1787,1789,1801,1811, + 1823,1831,1847,1861,1867,1871,1873,1877, + 1879,1889,1901,1907,1913,1931,1933,1949, + 1951,1973,1979,1987,1993,1997,1999,2003, + 2011,2017,2027,2029,2039,2053,2063,2069, + 2081,2083,2087,2089,2099,2111,2113,2129, + 2131,2137,2141,2143,2153,2161,2179,2203, + 2207,2213,2221,2237,2239,2243,2251,2267, + 2269,2273,2281,2287,2293,2297,2309,2311, + 2333,2339,2341,2347,2351,2357,2371,2377, + 2381,2383,2389,2393,2399,2411,2417,2423, + 2437,2441,2447,2459,2467,2473,2477,2503, + 2521,2531,2539,2543,2549,2551,2557,2579, + 2591,2593,2609,2617,2621,2633,2647,2657, + 2659,2663,2671,2677,2683,2687,2689,2693, + 2699,2707,2711,2713,2719,2729,2731,2741, + 2749,2753,2767,2777,2789,2791,2797,2801, + 2803,2819,2833,2837,2843,2851,2857,2861, + 2879,2887,2897,2903,2909,2917,2927,2939, + 2953,2957,2963,2969,2971,2999,3001,3011, + 3019,3023,3037,3041,3049,3061,3067,3079, + 3083,3089,3109,3119,3121,3137,3163,3167, + 3169,3181,3187,3191,3203,3209,3217,3221, + 3229,3251,3253,3257,3259,3271,3299,3301, + 3307,3313,3319,3323,3329,3331,3343,3347, + 3359,3361,3371,3373,3389,3391,3407,3413, + 3433,3449,3457,3461,3463,3467,3469,3491, + 3499,3511,3517,3527,3529,3533,3539,3541, + 3547,3557,3559,3571,3581,3583,3593,3607, + 3613,3617,3623,3631,3637,3643,3659,3671, + 3673,3677,3691,3697,3701,3709,3719,3727, + 3733,3739,3761,3767,3769,3779,3793,3797, + 3803,3821,3823,3833,3847,3851,3853,3863, + 3877,3881,3889,3907,3911,3917,3919,3923, + 3929,3931,3943,3947,3967,3989,4001,4003, + 4007,4013,4019,4021,4027,4049,4051,4057, + 4073,4079,4091,4093,4099,4111,4127,4129, + 4133,4139,4153,4157,4159,4177,4201,4211, + 4217,4219,4229,4231,4241,4243,4253,4259, + 4261,4271,4273,4283,4289,4297,4327,4337, + 4339,4349,4357,4363,4373,4391,4397,4409, + 4421,4423,4441,4447,4451,4457,4463,4481, + 4483,4493,4507,4513,4517,4519,4523,4547, + 4549,4561,4567,4583,4591,4597,4603,4621, + 4637,4639,4643,4649,4651,4657,4663,4673, + 4679,4691,4703,4721,4723,4729,4733,4751, + 4759,4783,4787,4789,4793,4799,4801,4813, + 4817,4831,4861,4871,4877,4889,4903,4909, + 4919,4931,4933,4937,4943,4951,4957,4967, + 4969,4973,4987,4993,4999,5003,5009,5011, + 5021,5023,5039,5051,5059,5077,5081,5087, + 5099,5101,5107,5113,5119,5147,5153,5167, + 5171,5179,5189,5197,5209,5227,5231,5233, + 5237,5261,5273,5279,5281,5297,5303,5309, + 5323,5333,5347,5351,5381,5387,5393,5399, + 5407,5413,5417,5419,5431,5437,5441,5443, + 5449,5471,5477,5479,5483,5501,5503,5507, + 5519,5521,5527,5531,5557,5563,5569,5573, + 5581,5591,5623,5639,5641,5647,5651,5653, + 5657,5659,5669,5683,5689,5693,5701,5711, + 5717,5737,5741,5743,5749,5779,5783,5791, + 5801,5807,5813,5821,5827,5839,5843,5849, + 5851,5857,5861,5867,5869,5879,5881,5897, + 5903,5923,5927,5939,5953,5981,5987,6007, + 6011,6029,6037,6043,6047,6053,6067,6073, + 6079,6089,6091,6101,6113,6121,6131,6133, + 6143,6151,6163,6173,6197,6199,6203,6211, + 6217,6221,6229,6247,6257,6263,6269,6271, + 6277,6287,6299,6301,6311,6317,6323,6329, + 6337,6343,6353,6359,6361,6367,6373,6379, + 6389,6397,6421,6427,6449,6451,6469,6473, + 6481,6491,6521,6529,6547,6551,6553,6563, + 6569,6571,6577,6581,6599,6607,6619,6637, + 6653,6659,6661,6673,6679,6689,6691,6701, + 6703,6709,6719,6733,6737,6761,6763,6779, + 6781,6791,6793,6803,6823,6827,6829,6833, + 6841,6857,6863,6869,6871,6883,6899,6907, + 6911,6917,6947,6949,6959,6961,6967,6971, + 6977,6983,6991,6997,7001,7013,7019,7027, + 7039,7043,7057,7069,7079,7103,7109,7121, + 7127,7129,7151,7159,7177,7187,7193,7207, + 7211,7213,7219,7229,7237,7243,7247,7253, + 7283,7297,7307,7309,7321,7331,7333,7349, + 7351,7369,7393,7411,7417,7433,7451,7457, + 7459,7477,7481,7487,7489,7499,7507,7517, + 7523,7529,7537,7541,7547,7549,7559,7561, + 7573,7577,7583,7589,7591,7603,7607,7621, + 7639,7643,7649,7669,7673,7681,7687,7691, + 7699,7703,7717,7723,7727,7741,7753,7757, + 7759,7789,7793,7817,7823,7829,7841,7853, + 7867,7873,7877,7879,7883,7901,7907,7919, + 7927,7933,7937,7949,7951,7963,7993,8009, + 8011,8017,8039,8053,8059,8069,8081,8087, + 8089,8093,8101,8111,8117,8123,8147,8161, + 8167,8171,8179,8191,8209,8219,8221,8231, + 8233,8237,8243,8263,8269,8273,8287,8291, + 8293,8297,8311,8317,8329,8353,8363,8369, + 8377,8387,8389,8419,8423,8429,8431,8443, + 8447,8461,8467,8501,8513,8521,8527,8537, + 8539,8543,8563,8573,8581,8597,8599,8609, + 8623,8627,8629,8641,8647,8663,8669,8677, + 8681,8689,8693,8699,8707,8713,8719,8731, + 8737,8741,8747,8753,8761,8779,8783,8803, + 8807,8819,8821,8831,8837,8839,8849,8861, + 8863,8867,8887,8893,8923,8929,8933,8941, + 8951,8963,8969,8971,8999,9001,9007,9011, + 9013,9029,9041,9043,9049,9059,9067,9091, + 9103,9109,9127,9133,9137,9151,9157,9161, + 9173,9181,9187,9199,9203,9209,9221,9227, + 9239,9241,9257,9277,9281,9283,9293,9311, + 9319,9323,9337,9341,9343,9349,9371,9377, + 9391,9397,9403,9413,9419,9421,9431,9433, + 9437,9439,9461,9463,9467,9473,9479,9491, + 9497,9511,9521,9533,9539,9547,9551,9587, + 9601,9613,9619,9623,9629,9631,9643,9649, + 9661,9677,9679,9689,9697,9719,9721,9733, + 9739,9743,9749,9767,9769,9781,9787,9791, + 9803,9811,9817,9829,9833,9839,9851,9857, + 9859,9871,9883,9887,9901,9907,9923,9929, + 9931,9941,9949,9967,9973,10007,10009,10037, + 10039,10061,10067,10069,10079,10091,10093,10099, + 10103,10111,10133,10139,10141,10151,10159,10163, + 10169,10177,10181,10193,10211,10223,10243,10247, + 10253,10259,10267,10271,10273,10289,10301,10303, + 10313,10321,10331,10333,10337,10343,10357,10369, + 10391,10399,10427,10429,10433,10453,10457,10459, + 10463,10477,10487,10499,10501,10513,10529,10531, + 10559,10567,10589,10597,10601,10607,10613,10627, + 10631,10639,10651,10657,10663,10667,10687,10691, + 10709,10711,10723,10729,10733,10739,10753,10771, + 10781,10789,10799,10831,10837,10847,10853,10859, + 10861,10867,10883,10889,10891,10903,10909,10937, + 10939,10949,10957,10973,10979,10987,10993,11003, + 11027,11047,11057,11059,11069,11071,11083,11087, + 11093,11113,11117,11119,11131,11149,11159,11161, + 11171,11173,11177,11197,11213,11239,11243,11251, + 11257,11261,11273,11279,11287,11299,11311,11317, + 11321,11329,11351,11353,11369,11383,11393,11399, + 11411,11423,11437,11443,11447,11467,11471,11483, + 11489,11491,11497,11503,11519,11527,11549,11551, + 11579,11587,11593,11597,11617,11621,11633,11657, + 11677,11681,11689,11699,11701,11717,11719,11731, + 11743,11777,11779,11783,11789,11801,11807,11813, + 11821,11827,11831,11833,11839,11863,11867,11887, + 11897,11903,11909,11923,11927,11933,11939,11941, + 11953,11959,11969,11971,11981,11987,12007,12011, + 12037,12041,12043,12049,12071,12073,12097,12101, + 12107,12109,12113,12119,12143,12149,12157,12161, + 12163,12197,12203,12211,12227,12239,12241,12251, + 12253,12263,12269,12277,12281,12289,12301,12323, + 12329,12343,12347,12373,12377,12379,12391,12401, + 12409,12413,12421,12433,12437,12451,12457,12473, + 12479,12487,12491,12497,12503,12511,12517,12527, + 12539,12541,12547,12553,12569,12577,12583,12589, + 12601,12611,12613,12619,12637,12641,12647,12653, + 12659,12671,12689,12697,12703,12713,12721,12739, + 12743,12757,12763,12781,12791,12799,12809,12821, + 12823,12829,12841,12853,12889,12893,12899,12907, + 12911,12917,12919,12923,12941,12953,12959,12967, + 12973,12979,12983,13001,13003,13007,13009,13033, + 13037,13043,13049,13063,13093,13099,13103,13109, + 13121,13127,13147,13151,13159,13163,13171,13177, + 13183,13187,13217,13219,13229,13241,13249,13259, + 13267,13291,13297,13309,13313,13327,13331,13337, + 13339,13367,13381,13397,13399,13411,13417,13421, + 13441,13451,13457,13463,13469,13477,13487,13499, + 13513,13523,13537,13553,13567,13577,13591,13597, + 13613,13619,13627,13633,13649,13669,13679,13681, + 13687,13691,13693,13697,13709,13711,13721,13723, + 13729,13751,13757,13759,13763,13781,13789,13799, + 13807,13829,13831,13841,13859,13873,13877,13879, + 13883,13901,13903,13907,13913,13921,13931,13933, + 13963,13967,13997,13999,14009,14011,14029,14033, + 14051,14057,14071,14081,14083,14087,14107,14143, + 14149,14153,14159,14173,14177,14197,14207,14221, + 14243,14249,14251,14281,14293,14303,14321,14323, + 14327,14341,14347,14369,14387,14389,14401,14407, + 14411,14419,14423,14431,14437,14447,14449,14461, + 14479,14489,14503,14519,14533,14537,14543,14549, + 14551,14557,14561,14563,14591,14593,14621,14627, + 14629,14633,14639,14653,14657,14669,14683,14699, + 14713,14717,14723,14731,14737,14741,14747,14753, + 14759,14767,14771,14779,14783,14797,14813,14821, + 14827,14831,14843,14851,14867,14869,14879,14887, + 14891,14897,14923,14929,14939,14947,14951,14957, + 14969,14983,15013,15017,15031,15053,15061,15073, + 15077,15083,15091,15101,15107,15121,15131,15137, + 15139,15149,15161,15173,15187,15193,15199,15217, + 15227,15233,15241,15259,15263,15269,15271,15277, + 15287,15289,15299,15307,15313,15319,15329,15331, + 15349,15359,15361,15373,15377,15383,15391,15401, + 15413,15427,15439,15443,15451,15461,15467,15473, + 15493,15497,15511,15527,15541,15551,15559,15569, + 15581,15583,15601,15607,15619,15629,15641,15643, + 15647,15649,15661,15667,15671,15679,15683,15727, + 15731,15733,15737,15739,15749,15761,15767,15773, + 15787,15791,15797,15803,15809,15817,15823,15859, + 15877,15881,15887,15889,15901,15907,15913,15919, + 15923,15937,15959,15971,15973,15991,16001,16007, + 16033,16057,16061,16063,16067,16069,16073,16087, + 16091,16097,16103,16111,16127,16139,16141,16183, + 16187,16189,16193,16217,16223,16229,16231,16249, + 16253,16267,16273,16301,16319,16333,16339,16349, + 16361,16363,16369,16381,16411,16417,16421,16427, + 16433,16447,16451,16453,16477,16481,16487,16493, + 16519,16529,16547,16553,16561,16567,16573,16603, + 16607,16619,16631,16633,16649,16651,16657,16661, + 16673,16691,16693,16699,16703,16729,16741,16747, + 16759,16763,16787,16811,16823,16829,16831,16843, + 16871,16879,16883,16889,16901,16903,16921,16927, + 16931,16937,16943,16963,16979,16981,16987,16993, + 17011,17021,17027,17029,17033,17041,17047,17053, + 17077,17093,17099,17107,17117,17123,17137,17159, + 17167,17183,17189,17191,17203,17207,17209,17231, + 17239,17257,17291,17293,17299,17317,17321,17327, + 17333,17341,17351,17359,17377,17383,17387,17389, + 17393,17401,17417,17419,17431,17443,17449,17467, + 17471,17477,17483,17489,17491,17497,17509,17519, + 17539,17551,17569,17573,17579,17581,17597,17599, + 17609,17623,17627,17657,17659,17669,17681,17683, + 17707,17713,17729,17737,17747,17749,17761,17783, + 17789,17791,17807,17827,17837,17839,17851,17863 +}; + +static +Ipp32u cpMod32(const Ipp32u* pX, cpSize sizeX, Ipp32u divider) +{ + cpSize n; + Ipp32u r; + for(n=sizeX, r=0; n>0; n--) { + Ipp64u tmp = MAKEDWORD(pX[n-1],r); + r = (Ipp32u)(tmp%divider); + } + return r; +} + +int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize len32) +{ + cpSize i; + + FIX_BNU(pPrime, len32); + + /* take a look in the list */ + if(1==len32) { + for(i=0; i<(cpSize)(sizeof(PrimeList)/sizeof(Ipp32u)); i++) { + if(pPrime[0]==PrimeList[i]) + return 1; + } + } + + /* test if value under the test is divisible by first prime numbers 2,3,5, ... */ + for(i=0; i<(cpSize)(sizeof(PrimeList)/sizeof(Ipp32u)); i++) { + if(0 == cpMod32(pPrime, len32, PrimeList[i])) + return 0; + } + + return 1; +} + +/* Rabin-Miller test */ +static +int RabinMiller(int a, + BNU_CHUNK_T* pZ, + BNU_CHUNK_T* pR, cpSize nsR, + BNU_CHUNK_T* pM, cpSize nsM, + IppsMontState* pMont) +{ + /* modulus and it length and other parameters */ + const BNU_CHUNK_T* pModulus = MNT_MODULUS(pMont); + cpSize modLen = MNT_SIZE(pMont); + BNU_CHUNK_T m0 = MNT_HELPER(pMont); + BNU_CHUNK_T* pProduct = MNT_PRODUCT(pMont); + BNU_CHUNK_T* pKBuffer = MNT_KBUFFER(pMont); + + /* compute z = r^m mod prime */ + nsR = cpMontEnc_BNU(pR, pR, nsR, pMont); + cpMontExpBin_BNU(pZ, pR, nsR, pM, nsM, pMont); + + /* if z==1 => probably prime */ + if(0==cpCmp_BNU(pZ, modLen, MNT_1(pMont), modLen)) + return 1; + + /* if z==prime-1 => probably prime */ + cpSub_BNU(MNT_PRODUCT(pMont), pModulus, MNT_1(pMont), modLen); + if(0==cpCmp_BNU(pZ, modLen, MNT_PRODUCT(pMont), modLen)) + return 1; + + while(--a) { + + /* z = z^2 mod w */ + cpMontSqr_BNU(pZ, pZ, modLen, pModulus, modLen, m0, pProduct, pKBuffer); + + /* if z==1 => definitely composite */ + if(0==cpCmp_BNU(pZ, modLen, MNT_1(pMont), modLen)) + return 1; + + /* if z==w-1 => probably prime */ + cpSub_BNU(MNT_PRODUCT(pMont), pModulus, MNT_1(pMont), modLen); + if(0==cpCmp_BNU(pZ, modLen, MNT_PRODUCT(pMont), modLen)) + return 1; + } + + /* if we are here, then we deal with composize */ + return 0; +} + +int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen, + cpSize nTrials, + IppsPrimeState* pCtx, + IppBitSupplier rndFunc, void* pRndParam) +{ + FIX_BNU(pPrime, primeLen); + + /* 0 is composite number */ + if( primeLen==1 && pPrime[0]==0) + return 0; + + /* 2 is prime number */ + else if( primeLen==1 && pPrime[0]==2) + return 1; + + /* + // test number + */ + else { + cpSize primeBitsize = BITSIZE_BNU(pPrime, primeLen); + cpSize primeLen32 = BITS2WORD32_SIZE(primeBitsize); + + /* apply easy prime test */ + if( 0==cpMimimalPrimeTest((Ipp32u*)pPrime, primeLen32) ) + return 0; + + /* continue test */ + else { + cpSize n, a; + + IppsMontState* pMont = PRIME_MONT(pCtx); + BNU_CHUNK_T* pMdata = PRIME_TEMP1(pCtx); + BNU_CHUNK_T* pRdata = PRIME_TEMP2(pCtx); + BNU_CHUNK_T* pZdata = PRIME_TEMP3(pCtx); + cpSize lenM, lenR; + + /* set up Montgomery engine (and save value being under the test) */ + ippsMontSet((Ipp32u*)pPrime, primeLen32, pMont); + + /* express w = m*2^a + 1 */ + cpDec_BNU(pMdata, pPrime, primeLen, 1); + for(n=0,a=0; n=1 */ + if(!cpTst_BNU(pRdata, lenR)) + pRdata[0] |= 1; + FIX_BNU(pRdata, lenR); + + /* Rabin-Miller test */ + if(0==RabinMiller(a, pZdata, pRdata,lenR, pMdata,lenM, pMont)) + return 0; + } + + return 1; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c b/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c new file mode 100644 index 0000000000..e3eeefe141 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c @@ -0,0 +1,124 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpprimeg.h" +#include "pcptool.h" + + +/*F* +// Name: ippsPrimeGetSize +// +// Purpose: Returns size of Prime Number Generator context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// ippStsLengthErr 1 > maxBits +// ippStsNoErr no error +// +// Parameters: +// maxBits max length of a prime number +// pSize pointer to the size of internal context +*F*/ +IPPFUN(IppStatus, ippsPrimeGetSize, (cpSize maxBits, cpSize* pSize)) +{ + IPP_BAD_PTR1_RET(pSize); + IPP_BADARG_RET(maxBits<1, ippStsLengthErr); + + { + cpSize len = BITS_BNU_CHUNK(maxBits); + cpSize len32 = BITS2WORD32_SIZE(maxBits); + cpSize montSize; + ippsMontGetSize(ippBinaryMethod, len32, &montSize); + + *pSize = sizeof(IppsPrimeState) + +len*sizeof(BNU_CHUNK_T) + +len*sizeof(BNU_CHUNK_T) + +len*sizeof(BNU_CHUNK_T) + +len*sizeof(BNU_CHUNK_T) + +montSize + +PRIME_ALIGNMENT-1; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsPrimeInit +// +// Purpose: Initializes Prime Number Generator context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pCtx +// ippStsLengthErr 1 > maxBits +// ippStsNoErr no error +// +// Parameters: +// maxBits max length of a prime number +// pCtx pointer to the context to be initialized +*F*/ +IPPFUN(IppStatus, ippsPrimeInit, (cpSize maxBits, IppsPrimeState* pCtx)) +{ + IPP_BAD_PTR1_RET(pCtx); + IPP_BADARG_RET(maxBits<1, ippStsLengthErr); + + /* use aligned PRNG context */ + pCtx = (IppsPrimeState*)( IPP_ALIGNED_PTR(pCtx, PRIME_ALIGNMENT) ); + + { + Ipp8u* ptr = (Ipp8u*)pCtx; + + cpSize len = BITS_BNU_CHUNK(maxBits); + cpSize len32 = BITS2WORD32_SIZE(maxBits); + + PRIME_ID(pCtx) = idCtxPrimeNumber; + PRIME_MAXBITSIZE(pCtx) = maxBits; + + ptr += sizeof(IppsPrimeState); + PRIME_NUMBER(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_TEMP1(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_TEMP2(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_TEMP3(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_MONT(pCtx) = (IppsMontState*)( IPP_ALIGNED_PTR((ptr), MONT_ALIGNMENT) ); + ippsMontInit(ippBinaryMethod, len32, PRIME_MONT(pCtx)); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpprng.h b/external/crypto_px/sources/ippcp/src/pcpprng.h new file mode 100644 index 0000000000..3c4829fe5e --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpprng.h @@ -0,0 +1,65 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_PRNG_H) +#define _CP_PRNG_H + +/* +// Pseudo-random generation context +*/ + +#define MAX_XKEY_SIZE 512 +#define DEFAULT_XKEY_SIZE 512 /* must be >=160 || <=512 */ + +struct _cpPRNG { + IppCtxId idCtx; /* PRNG identifier */ + cpSize seedBits; /* secret seed-key bitsize */ + BNU_CHUNK_T Q[BITS_BNU_CHUNK(160)]; /* modulus */ + BNU_CHUNK_T T[BITS_BNU_CHUNK(160)]; /* parameter of SHA_G() funct */ + BNU_CHUNK_T xAug[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; /* optional entropy augment */ + BNU_CHUNK_T xKey[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; /* secret seed-key */ +}; + +/* alignment */ +#define PRNG_ALIGNMENT ((int)(sizeof(void*))) + +#define RAND_ID(ctx) ((ctx)->idCtx) +#define RAND_SEEDBITS(ctx) ((ctx)->seedBits) +#define RAND_Q(ctx) ((ctx)->Q) +#define RAND_T(ctx) ((ctx)->T) +#define RAND_XAUGMENT(ctx) ((ctx)->xAug) +#define RAND_XKEY(ctx) ((ctx)->xKey) + +#define RAND_VALID_ID(ctx) (RAND_ID((ctx))==idCtxPRNG) + +int cpPRNGen(Ipp32u* pBuffer, cpSize bitLen, IppsPRNGState* pCtx); + +#endif /* _CP_PRNG_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpprngenca.c b/external/crypto_px/sources/ippcp/src/pcpprngenca.c new file mode 100644 index 0000000000..f25b6e6b31 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpprngenca.c @@ -0,0 +1,178 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#include "owncp.h" +#include "pcpbn.h" +#include "pcphash.h" +#include "pcpprng.h" +#include "pcptool.h" + +/* +// G() function based on SHA1 +// +// Parameters: +// T 160 bit parameter +// pHexStr input hex string +// hexStrLen size of hex string (Ipp8u segnments) +// xBNU 160 bit BNU result +// +// Note 1: +// must to be hexStrLen <= 64 (512 bits) +*/ +static +void SHA1_G(Ipp32u* xBNU, const Ipp32u* T, Ipp8u* pHexStr, int hexStrLen) +{ + /* select processing function */ + cpHashProc updateFunc = UpdateSHA1; + + /* pad HexString zeros */ + PaddBlock(0, pHexStr+hexStrLen, BITS2WORD8_SIZE(MAX_XKEY_SIZE)-hexStrLen); + + /* reset initial HASH value */ + xBNU[0] = T[0]; + xBNU[1] = T[1]; + xBNU[2] = T[2]; + xBNU[3] = T[3]; + xBNU[4] = T[4]; + + /* SHA1 */ + //UpdateSHA1(xBNU, pHexStr, BITS2WORD8_SIZE(MAX_XKEY_SIZE), SHA1_cnt); + updateFunc(xBNU, pHexStr, BITS2WORD8_SIZE(MAX_XKEY_SIZE), SHA1_cnt); + + /* swap back */ + SWAP(xBNU[0],xBNU[4]); + SWAP(xBNU[1],xBNU[3]); +} + +/* +// Returns bitsize of the bitstring has beed added +*/ +int cpPRNGen(Ipp32u* pRand, cpSize nBits, IppsPRNGState* pRnd) +{ + BNU_CHUNK_T Xj [BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; + BNU_CHUNK_T XVAL[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; + + Ipp8u TXVAL[BITS2WORD8_SIZE(MAX_XKEY_SIZE)]; + + /* XKEY length in BNU_CHUNK_T */ + cpSize xKeyLen = BITS_BNU_CHUNK(RAND_SEEDBITS(pRnd)); + /* XKEY length in bytes */ + cpSize xKeySize= BITS2WORD8_SIZE(RAND_SEEDBITS(pRnd)); + /* XKEY word's mask */ + BNU_CHUNK_T xKeyMsk = MASK_BNU_CHUNK(RAND_SEEDBITS(pRnd)); + + /* number of Ipp32u chunks to be generated */ + cpSize genlen = BITS2WORD32_SIZE(nBits); + + ZEXPAND_BNU(Xj, 0, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); + ZEXPAND_BNU(XVAL, 0, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); + + while(genlen) { + cpSize len; + + /* Step 1: XVAL=(Xkey+Xseed) mod 2^b */ + BNU_CHUNK_T carry = cpAdd_BNU(XVAL, RAND_XKEY(pRnd), RAND_XAUGMENT(pRnd), xKeyLen); + XVAL[xKeyLen-1] &= xKeyMsk; + + /* Step 2: xj=G(t, XVAL) mod Q */ + cpToOctStr_BNU(TXVAL, xKeySize, XVAL, xKeyLen); + SHA1_G((Ipp32u*)Xj, (Ipp32u*)RAND_T(pRnd), TXVAL, xKeySize); + + { + cpSize sizeXj = BITS_BNU_CHUNK(160); + if(0 <= cpCmp_BNU(Xj, BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE), RAND_Q(pRnd),BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE)) ) + sizeXj = cpMod_BNU(Xj, BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE), RAND_Q(pRnd), BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE)); + FIX_BNU(Xj, sizeXj); + ZEXPAND_BNU(Xj, sizeXj, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); + } + + /* Step 3: Xkey=(1+Xkey+Xj) mod 2^b */ + cpInc_BNU(RAND_XKEY(pRnd), RAND_XKEY(pRnd), xKeyLen, 1); + carry = cpAdd_BNU(RAND_XKEY(pRnd), RAND_XKEY(pRnd), Xj, xKeyLen); + RAND_XKEY(pRnd)[xKeyLen-1] &= xKeyMsk; + + /* fill out result */ + len = genlenidCtx +// +// ippStsLengthErr 1 > nBits +// +// ippStsNoErr no error +// +// Parameters: +// pBuffer pointer to the buffer +// nBits number of bits be requested +// pRndCtx pointer to the context +*F*/ +IPPFUN(IppStatus, ippsPRNGen,(Ipp32u* pBuffer, cpSize nBits, void* pRnd)) +{ + IppsPRNGState* pRndCtx = (IppsPRNGState*)pRnd; + + /* test PRNG context */ + IPP_BAD_PTR2_RET(pBuffer, pRnd); + + pRndCtx = (IppsPRNGState*)( IPP_ALIGNED_PTR(pRndCtx, PRNG_ALIGNMENT) ); + IPP_BADARG_RET(!RAND_VALID_ID(pRndCtx), ippStsContextMatchErr); + + /* test sizes */ + IPP_BADARG_RET(nBits< 1, ippStsLengthErr); + + { + cpSize rndSize = BITS2WORD32_SIZE(nBits); + Ipp32u rndMask = MAKEMASK32(nBits); + + cpPRNGen(pBuffer, nBits, pRndCtx); + pBuffer[rndSize-1] &= rndMask; + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpprnginitca.c b/external/crypto_px/sources/ippcp/src/pcpprnginitca.c new file mode 100644 index 0000000000..06c8f2b283 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpprnginitca.c @@ -0,0 +1,113 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#include "owncp.h" +#include "pcpbn.h" +#include "pcpprng.h" +#include "pcphash.h" +#include "pcptool.h" + + +/*F* +// Name: ippsPRNGGetSize +// +// Purpose: Returns size of PRNG context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNoErr no error +// +// Parameters: +// pSize pointer to the size of internal context +*F*/ +IPPFUN(IppStatus, ippsPRNGGetSize, (int* pSize)) +{ + IPP_BAD_PTR1_RET(pSize); + + *pSize = sizeof(IppsPRNGState) + +PRNG_ALIGNMENT-1; + return ippStsNoErr; +} + + +/*F* +// Name: ippsPRNGInit +// +// Purpose: Initializes PRNG context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pRnd +// +// ippStsLengthErr seedBits < 1 +// seedBits < MAX_XKEY_SIZE +// seedBits%8 !=0 +// +// ippStsNoErr no error +// +// Parameters: +// seedBits seed bitsize +// pRnd pointer to the context to be initialized +*F*/ +IPPFUN(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pRnd)) +{ + /* test PRNG context */ + IPP_BAD_PTR1_RET(pRnd); + pRnd = (IppsPRNGState*)( IPP_ALIGNED_PTR(pRnd, PRNG_ALIGNMENT) ); + + /* test sizes */ + IPP_BADARG_RET((1>seedBits) || (seedBits>MAX_XKEY_SIZE) ||(seedBits&7), ippStsLengthErr); + + { + int hashIvSize = cpHashIvSize(ippHashAlg_SHA1); + const Ipp8u* iv = cpHashIV[ippHashAlg_SHA1]; + + /* cleanup context */ + ZEXPAND_BNU((Ipp8u*)pRnd, 0, (cpSize)(sizeof(IppsPRNGState))); + + RAND_ID(pRnd) = idCtxPRNG; + RAND_SEEDBITS(pRnd) = seedBits; + + /* default Q parameter */ + ((Ipp32u*)RAND_Q(pRnd))[0] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[1] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[2] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[3] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[4] = 0xFFFFFFFF; + + /* default T parameter */ + CopyBlock(iv, RAND_T(pRnd), hashIvSize); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcprij.h b/external/crypto_px/sources/ippcp/src/pcprij.h new file mode 100644 index 0000000000..6b55123a77 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcprij.h @@ -0,0 +1,141 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_RIJ_H) +#define _PCP_RIJ_H + + +/* +// The GF(256) modular polynomial and elements +*/ +#define WPOLY 0x011B +#define BPOLY 0x1B + +/* +// Make WORD using 4 arbitrary bytes +*/ +#define BYTES_TO_WORD(b0,b1,b2,b3) ( ( ((Ipp32u)((Ipp8u)(b3))) <<24 ) \ + |( ((Ipp32u)((Ipp8u)(b2))) <<16 ) \ + |( ((Ipp32u)((Ipp8u)(b1))) << 8 ) \ + |( ((Ipp32u)((Ipp8u)(b0))) ) ) +/* +// Make WORD setting byte in specified position +*/ +#define BYTE0_TO_WORD(b) BYTES_TO_WORD((b), 0, 0, 0) +#define BYTE1_TO_WORD(b) BYTES_TO_WORD( 0, (b), 0, 0) +#define BYTE2_TO_WORD(b) BYTES_TO_WORD( 0, 0, (b), 0) +#define BYTE3_TO_WORD(b) BYTES_TO_WORD( 0, 0, 0, (b)) + +/* +// Extract byte from specified position n. +// Sure, n=0,1,2 or 3 only +*/ +#define EBYTE(w,n) ((Ipp8u)((w) >> (8 * (n)))) + + +/* +// Rijndael's spec +*/ +typedef void (*RijnCipher)(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); + +struct _cpRijndael128 { + IppCtxId idCtx; /* Rijndael spec identifier */ + int nk; /* security key length (words) */ + int nb; /* data block size (words) */ + int nr; /* number of rounds */ + RijnCipher encoder; /* encoder/decoder */ + RijnCipher decoder; /* entry point */ + Ipp32u* pEncTbl; /* expanded S-boxes for */ + Ipp32u* pDecTbl; /* encryption and decryption */ + Ipp32u enc_keys[64]; /* array of keys for encryprion */ + Ipp32u dec_keys[64]; /* array of keys for decryprion */ + Ipp32u aesNI; /* AES instruction available */ + Ipp32u safeInit; /* SafeInit performed */ +}; + +/* alignment */ +#define RIJ_ALIGNMENT (16) + +#define MBS_RIJ128 (128/8) /* message block size (bytes) */ +#define MBS_RIJ192 (192/8) +#define MBS_RIJ256 (256/8) + +#define SR (4) /* number of rows in STATE data */ + +#define NB(msgBlks) ((msgBlks)/32) /* message block size (words) */ + /* 4-word for 128-bits data block */ + /* 6-word for 192-bits data block */ + /* 8-word for 256-bits data block */ + +#define NK(keybits) ((keybits)/32) /* key length (words): */ +#define NK128 NK(ippRijndaelKey128)/* 4-word for 128-bits security key */ +#define NK192 NK(ippRijndaelKey192)/* 6-word for 192-bits security key */ +#define NK256 NK(ippRijndaelKey256)/* 8-word for 256-bits security key */ + +#define NR128_128 (10) /* number of rounds data: 128 bits key: 128 bits are used */ +#define NR128_192 (12) /* number of rounds data: 128 bits key: 192 bits are used */ +#define NR128_256 (14) /* number of rounds data: 128 bits key: 256 bits are used */ +#define NR192_128 (12) /* number of rounds data: 192 bits key: 128 bits are used */ +#define NR192_192 (12) /* number of rounds data: 192 bits key: 192 bits are used */ +#define NR192_256 (14) /* number of rounds data: 192 bits key: 256 bits are used */ +#define NR256_128 (14) /* number of rounds data: 256 bits key: 128 bits are used */ +#define NR256_192 (14) /* number of rounds data: 256 bits key: 192 bits are used */ +#define NR256_256 (14) /* number of rounds data: 256 bits key: 256 bits are used */ + +/* +// Useful macros +*/ +#define RIJ_ID(ctx) ((ctx)->idCtx) +#define RIJ_NB(ctx) ((ctx)->nb) +#define RIJ_NK(ctx) ((ctx)->nk) +#define RIJ_NR(ctx) ((ctx)->nr) +#define RIJ_ENCODER(ctx) ((ctx)->encoder) +#define RIJ_DECODER(ctx) ((ctx)->decoder) +#define RIJ_ENC_SBOX(ctx) ((ctx)->pEncTbl) +#define RIJ_DEC_SBOX(ctx) ((ctx)->pDecTbl) +#define RIJ_EKEYS(ctx) (Ipp8u*)((ctx)->enc_keys) +#define RIJ_DKEYS(ctx) (Ipp8u*)((ctx)->dec_keys) +#define RIJ_AESNI(ctx) ((ctx)->aesNI) +#define RIJ_SAFE_INIT(ctx) ((ctx)->safeInit) + +#define RIJ_ID_TEST(ctx) (RIJ_ID((ctx))==idCtxRijndael) + +/* +// Internal functions +*/ + +void Safe2Encrypt_RIJ128(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); +void Safe2Decrypt_RIJ128(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); + +void ExpandRijndaelKey(const Ipp8u* pKey, int NK, int NB, int NR, int nKeys, + Ipp8u* pEncKeys, Ipp8u* pDecKeys); + +#endif /* _PCP_RIJ_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcprij128safe2.h b/external/crypto_px/sources/ippcp/src/pcprij128safe2.h new file mode 100644 index 0000000000..94a79f13d7 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcprij128safe2.h @@ -0,0 +1,79 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_RIJ_SAFE2_H) +#define _PCP_RIJ_SAFE2_H + +// transpose 4x4 Ipp8u matrix +#define TRANSPOSE(out, inp) \ + (out)[ 0] = (inp)[ 0]; \ + (out)[ 4] = (inp)[ 1]; \ + (out)[ 8] = (inp)[ 2]; \ + (out)[12] = (inp)[ 3]; \ + \ + (out)[ 1] = (inp)[ 4]; \ + (out)[ 5] = (inp)[ 5]; \ + (out)[ 9] = (inp)[ 6]; \ + (out)[13] = (inp)[ 7]; \ + \ + (out)[ 2] = (inp)[ 8]; \ + (out)[ 6] = (inp)[ 9]; \ + (out)[10] = (inp)[10]; \ + (out)[14] = (inp)[11]; \ + \ + (out)[ 3] = (inp)[12]; \ + (out)[ 7] = (inp)[13]; \ + (out)[11] = (inp)[14]; \ + (out)[15] = (inp)[15] + +__INLINE void XorRoundKey(Ipp32u* state, const Ipp32u* RoundKey) +{ + state[0] ^= RoundKey[0]; + state[1] ^= RoundKey[1]; + state[2] ^= RoundKey[2]; + state[3] ^= RoundKey[3]; +} + +// xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b} +__INLINE Ipp32u mask4(Ipp32u x) +{ + x &= 0x80808080; + return (Ipp32u)((x<<1) - (x>>7)); +} + +__INLINE Ipp32u xtime4(Ipp32u x) +{ + Ipp32u t = (x+x) &0xFEFEFEFE; + t ^= mask4(x) & 0x1B1B1B1B; + return t; +} + +#endif /* _PCP_RIJ_SAFE2_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c b/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c new file mode 100644 index 0000000000..16b1f54133 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c @@ -0,0 +1,133 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcprij128safe2.h" +#include "pcprijtables.h" + + +__INLINE Ipp8u getInvSboxValue(Ipp32u x) +{ + Ipp32u t[sizeof(RijDecSbox)/CACHE_LINE_SIZE]; + const Ipp8u* SboxEntry = RijDecSbox +x%CACHE_LINE_SIZE; + Ipp32u i; + for(i=0; i0;round--) { + invShiftRows(state); + invSubBytes((Ipp8u*)state); + XorRoundKey(state,(Ipp32u*)(RoundKey+round*16)); + invMixColumns(state); + } + + // last round + invShiftRows(state); + invSubBytes((Ipp8u*)state); + XorRoundKey(state,(Ipp32u*)(RoundKey+0*16)); + + // copy from the state to output + TRANSPOSE(out, (Ipp8u*)state); +} diff --git a/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c b/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c new file mode 100644 index 0000000000..8295b1b001 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c @@ -0,0 +1,125 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcprij128safe2.h" +#include "pcprijtables.h" + + +__INLINE Ipp8u getSboxValue(Ipp32u x) +{ + Ipp32u t[sizeof(RijEncSbox)/CACHE_LINE_SIZE]; + const Ipp8u* SboxEntry = RijEncSbox +x%CACHE_LINE_SIZE; + Ipp32u i; + for(i=0; i>7) & 1) * WPOLY)) +#define gf_m4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) +#define gf_m8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ + ^ (((x>>5) & 4) * WPOLY)) +#define gf_m1(x) ((x)) +#define gf_m3(x) (gf_m2(x) ^ x) +#define gf_m9(x) (gf_m8(x) ^ x) +#define gf_mB(x) (gf_m8(x) ^ gf_m2(x) ^ x) +#define gf_mD(x) (gf_m8(x) ^ gf_m4(x) ^ x) +#define gf_mE(x) (gf_m8(x) ^ gf_m4(x) ^ gf_m2(x)) + +/* +// The following particular transformations +// are used for create Encryption Tables +*/ +#define fwd_t0(x) BYTES_TO_WORD(gf_m2(x), gf_m1(x), gf_m1(x), gf_m3(x)) +#define fwd_t1(x) BYTES_TO_WORD(gf_m3(x), gf_m2(x), gf_m1(x), gf_m1(x)) +#define fwd_t2(x) BYTES_TO_WORD(gf_m1(x), gf_m3(x), gf_m2(x), gf_m1(x)) +#define fwd_t3(x) BYTES_TO_WORD(gf_m1(x), gf_m1(x), gf_m3(x), gf_m2(x)) + +/* +// The following particular transformations +// are used for create Decryption Tables +*/ +#define inv_t0(x) BYTES_TO_WORD(gf_mE(x), gf_m9(x), gf_mD(x), gf_mB(x)) +#define inv_t1(x) BYTES_TO_WORD(gf_mB(x), gf_mE(x), gf_m9(x), gf_mD(x)) +#define inv_t2(x) BYTES_TO_WORD(gf_mD(x), gf_mB(x), gf_mE(x), gf_m9(x)) +#define inv_t3(x) BYTES_TO_WORD(gf_m9(x), gf_mD(x), gf_mB(x), gf_mE(x)) + +#define exp_b3(x) BYTES_TO_WORD(0, 0, 0, (x)) +#define exp_b2(x) BYTES_TO_WORD(0, 0, (x),0) +#define exp_b1(x) BYTES_TO_WORD(0, (x),0, 0) +#define exp_b0(x) BYTES_TO_WORD((x),0, 0, 0) + +/* +// The following particular transformations +// are used for create pure Encryption/Decryption Sboxes +*/ +#define none_t(x) (x) + + +/* +// Just sequence of byte, beginning 0x00 upto 0xff +// (be parametrized by any transformation 't') +*/ +#define LINE(t) \ + t(0x00), t(0x01), t(0x02), t(0x03), t(0x04), t(0x05), t(0x06), t(0x07),\ + t(0x08), t(0x09), t(0x0a), t(0x0b), t(0x0c), t(0x0d), t(0x0e), t(0x0f),\ + t(0x10), t(0x11), t(0x12), t(0x13), t(0x14), t(0x15), t(0x16), t(0x17),\ + t(0x18), t(0x19), t(0x1a), t(0x1b), t(0x1c), t(0x1d), t(0x1e), t(0x1f),\ + t(0x20), t(0x21), t(0x22), t(0x23), t(0x24), t(0x25), t(0x26), t(0x27),\ + t(0x28), t(0x29), t(0x2a), t(0x2b), t(0x2c), t(0x2d), t(0x2e), t(0x2f),\ + t(0x30), t(0x31), t(0x32), t(0x33), t(0x34), t(0x35), t(0x36), t(0x37),\ + t(0x38), t(0x39), t(0x3a), t(0x3b), t(0x3c), t(0x3d), t(0x3e), t(0x3f),\ + t(0x40), t(0x41), t(0x42), t(0x43), t(0x44), t(0x45), t(0x46), t(0x47),\ + t(0x48), t(0x49), t(0x4a), t(0x4b), t(0x4c), t(0x4d), t(0x4e), t(0x4f),\ + t(0x50), t(0x51), t(0x52), t(0x53), t(0x54), t(0x55), t(0x56), t(0x57),\ + t(0x58), t(0x59), t(0x5a), t(0x5b), t(0x5c), t(0x5d), t(0x5e), t(0x5f),\ + t(0x60), t(0x61), t(0x62), t(0x63), t(0x64), t(0x65), t(0x66), t(0x67),\ + t(0x68), t(0x69), t(0x6a), t(0x6b), t(0x6c), t(0x6d), t(0x6e), t(0x6f),\ + t(0x70), t(0x71), t(0x72), t(0x73), t(0x74), t(0x75), t(0x76), t(0x77),\ + t(0x78), t(0x79), t(0x7a), t(0x7b), t(0x7c), t(0x7d), t(0x7e), t(0x7f),\ + t(0x80), t(0x81), t(0x82), t(0x83), t(0x84), t(0x85), t(0x86), t(0x87),\ + t(0x88), t(0x89), t(0x8a), t(0x8b), t(0x8c), t(0x8d), t(0x8e), t(0x8f),\ + t(0x90), t(0x91), t(0x92), t(0x93), t(0x94), t(0x95), t(0x96), t(0x97),\ + t(0x98), t(0x99), t(0x9a), t(0x9b), t(0x9c), t(0x9d), t(0x9e), t(0x9f),\ + t(0xa0), t(0xa1), t(0xa2), t(0xa3), t(0xa4), t(0xa5), t(0xa6), t(0xa7),\ + t(0xa8), t(0xa9), t(0xaa), t(0xab), t(0xac), t(0xad), t(0xae), t(0xaf),\ + t(0xb0), t(0xb1), t(0xb2), t(0xb3), t(0xb4), t(0xb5), t(0xb6), t(0xb7),\ + t(0xb8), t(0xb9), t(0xba), t(0xbb), t(0xbc), t(0xbd), t(0xbe), t(0xbf),\ + t(0xc0), t(0xc1), t(0xc2), t(0xc3), t(0xc4), t(0xc5), t(0xc6), t(0xc7),\ + t(0xc8), t(0xc9), t(0xca), t(0xcb), t(0xcc), t(0xcd), t(0xce), t(0xcf),\ + t(0xd0), t(0xd1), t(0xd2), t(0xd3), t(0xd4), t(0xd5), t(0xd6), t(0xd7),\ + t(0xd8), t(0xd9), t(0xda), t(0xdb), t(0xdc), t(0xdd), t(0xde), t(0xdf),\ + t(0xe0), t(0xe1), t(0xe2), t(0xe3), t(0xe4), t(0xe5), t(0xe6), t(0xe7),\ + t(0xe8), t(0xe9), t(0xea), t(0xeb), t(0xec), t(0xed), t(0xee), t(0xef),\ + t(0xf0), t(0xf1), t(0xf2), t(0xf3), t(0xf4), t(0xf5), t(0xf6), t(0xf7),\ + t(0xf8), t(0xf9), t(0xfa), t(0xfb), t(0xfc), t(0xfd), t(0xfe), t(0xff) + +/* +// Encrypt/Decrypt S-box data +// (be parametrized by any transformation 't') +*/ +#define ENC_SBOX(t) \ + t(0x63), t(0x7c), t(0x77), t(0x7b), t(0xf2), t(0x6b), t(0x6f), t(0xc5),\ + t(0x30), t(0x01), t(0x67), t(0x2b), t(0xfe), t(0xd7), t(0xab), t(0x76),\ + t(0xca), t(0x82), t(0xc9), t(0x7d), t(0xfa), t(0x59), t(0x47), t(0xf0),\ + t(0xad), t(0xd4), t(0xa2), t(0xaf), t(0x9c), t(0xa4), t(0x72), t(0xc0),\ + t(0xb7), t(0xfd), t(0x93), t(0x26), t(0x36), t(0x3f), t(0xf7), t(0xcc),\ + t(0x34), t(0xa5), t(0xe5), t(0xf1), t(0x71), t(0xd8), t(0x31), t(0x15),\ + t(0x04), t(0xc7), t(0x23), t(0xc3), t(0x18), t(0x96), t(0x05), t(0x9a),\ + t(0x07), t(0x12), t(0x80), t(0xe2), t(0xeb), t(0x27), t(0xb2), t(0x75),\ + t(0x09), t(0x83), t(0x2c), t(0x1a), t(0x1b), t(0x6e), t(0x5a), t(0xa0),\ + t(0x52), t(0x3b), t(0xd6), t(0xb3), t(0x29), t(0xe3), t(0x2f), t(0x84),\ + t(0x53), t(0xd1), t(0x00), t(0xed), t(0x20), t(0xfc), t(0xb1), t(0x5b),\ + t(0x6a), t(0xcb), t(0xbe), t(0x39), t(0x4a), t(0x4c), t(0x58), t(0xcf),\ + t(0xd0), t(0xef), t(0xaa), t(0xfb), t(0x43), t(0x4d), t(0x33), t(0x85),\ + t(0x45), t(0xf9), t(0x02), t(0x7f), t(0x50), t(0x3c), t(0x9f), t(0xa8),\ + t(0x51), t(0xa3), t(0x40), t(0x8f), t(0x92), t(0x9d), t(0x38), t(0xf5),\ + t(0xbc), t(0xb6), t(0xda), t(0x21), t(0x10), t(0xff), t(0xf3), t(0xd2),\ + t(0xcd), t(0x0c), t(0x13), t(0xec), t(0x5f), t(0x97), t(0x44), t(0x17),\ + t(0xc4), t(0xa7), t(0x7e), t(0x3d), t(0x64), t(0x5d), t(0x19), t(0x73),\ + t(0x60), t(0x81), t(0x4f), t(0xdc), t(0x22), t(0x2a), t(0x90), t(0x88),\ + t(0x46), t(0xee), t(0xb8), t(0x14), t(0xde), t(0x5e), t(0x0b), t(0xdb),\ + t(0xe0), t(0x32), t(0x3a), t(0x0a), t(0x49), t(0x06), t(0x24), t(0x5c),\ + t(0xc2), t(0xd3), t(0xac), t(0x62), t(0x91), t(0x95), t(0xe4), t(0x79),\ + t(0xe7), t(0xc8), t(0x37), t(0x6d), t(0x8d), t(0xd5), t(0x4e), t(0xa9),\ + t(0x6c), t(0x56), t(0xf4), t(0xea), t(0x65), t(0x7a), t(0xae), t(0x08),\ + t(0xba), t(0x78), t(0x25), t(0x2e), t(0x1c), t(0xa6), t(0xb4), t(0xc6),\ + t(0xe8), t(0xdd), t(0x74), t(0x1f), t(0x4b), t(0xbd), t(0x8b), t(0x8a),\ + t(0x70), t(0x3e), t(0xb5), t(0x66), t(0x48), t(0x03), t(0xf6), t(0x0e),\ + t(0x61), t(0x35), t(0x57), t(0xb9), t(0x86), t(0xc1), t(0x1d), t(0x9e),\ + t(0xe1), t(0xf8), t(0x98), t(0x11), t(0x69), t(0xd9), t(0x8e), t(0x94),\ + t(0x9b), t(0x1e), t(0x87), t(0xe9), t(0xce), t(0x55), t(0x28), t(0xdf),\ + t(0x8c), t(0xa1), t(0x89), t(0x0d), t(0xbf), t(0xe6), t(0x42), t(0x68),\ + t(0x41), t(0x99), t(0x2d), t(0x0f), t(0xb0), t(0x54), t(0xbb), t(0x16) + +#define DEC_SBOX(t) \ + t(0x52), t(0x09), t(0x6a), t(0xd5), t(0x30), t(0x36), t(0xa5), t(0x38),\ + t(0xbf), t(0x40), t(0xa3), t(0x9e), t(0x81), t(0xf3), t(0xd7), t(0xfb),\ + t(0x7c), t(0xe3), t(0x39), t(0x82), t(0x9b), t(0x2f), t(0xff), t(0x87),\ + t(0x34), t(0x8e), t(0x43), t(0x44), t(0xc4), t(0xde), t(0xe9), t(0xcb),\ + t(0x54), t(0x7b), t(0x94), t(0x32), t(0xa6), t(0xc2), t(0x23), t(0x3d),\ + t(0xee), t(0x4c), t(0x95), t(0x0b), t(0x42), t(0xfa), t(0xc3), t(0x4e),\ + t(0x08), t(0x2e), t(0xa1), t(0x66), t(0x28), t(0xd9), t(0x24), t(0xb2),\ + t(0x76), t(0x5b), t(0xa2), t(0x49), t(0x6d), t(0x8b), t(0xd1), t(0x25),\ + t(0x72), t(0xf8), t(0xf6), t(0x64), t(0x86), t(0x68), t(0x98), t(0x16),\ + t(0xd4), t(0xa4), t(0x5c), t(0xcc), t(0x5d), t(0x65), t(0xb6), t(0x92),\ + t(0x6c), t(0x70), t(0x48), t(0x50), t(0xfd), t(0xed), t(0xb9), t(0xda),\ + t(0x5e), t(0x15), t(0x46), t(0x57), t(0xa7), t(0x8d), t(0x9d), t(0x84),\ + t(0x90), t(0xd8), t(0xab), t(0x00), t(0x8c), t(0xbc), t(0xd3), t(0x0a),\ + t(0xf7), t(0xe4), t(0x58), t(0x05), t(0xb8), t(0xb3), t(0x45), t(0x06),\ + t(0xd0), t(0x2c), t(0x1e), t(0x8f), t(0xca), t(0x3f), t(0x0f), t(0x02),\ + t(0xc1), t(0xaf), t(0xbd), t(0x03), t(0x01), t(0x13), t(0x8a), t(0x6b),\ + t(0x3a), t(0x91), t(0x11), t(0x41), t(0x4f), t(0x67), t(0xdc), t(0xea),\ + t(0x97), t(0xf2), t(0xcf), t(0xce), t(0xf0), t(0xb4), t(0xe6), t(0x73),\ + t(0x96), t(0xac), t(0x74), t(0x22), t(0xe7), t(0xad), t(0x35), t(0x85),\ + t(0xe2), t(0xf9), t(0x37), t(0xe8), t(0x1c), t(0x75), t(0xdf), t(0x6e),\ + t(0x47), t(0xf1), t(0x1a), t(0x71), t(0x1d), t(0x29), t(0xc5), t(0x89),\ + t(0x6f), t(0xb7), t(0x62), t(0x0e), t(0xaa), t(0x18), t(0xbe), t(0x1b),\ + t(0xfc), t(0x56), t(0x3e), t(0x4b), t(0xc6), t(0xd2), t(0x79), t(0x20),\ + t(0x9a), t(0xdb), t(0xc0), t(0xfe), t(0x78), t(0xcd), t(0x5a), t(0xf4),\ + t(0x1f), t(0xdd), t(0xa8), t(0x33), t(0x88), t(0x07), t(0xc7), t(0x31),\ + t(0xb1), t(0x12), t(0x10), t(0x59), t(0x27), t(0x80), t(0xec), t(0x5f),\ + t(0x60), t(0x51), t(0x7f), t(0xa9), t(0x19), t(0xb5), t(0x4a), t(0x0d),\ + t(0x2d), t(0xe5), t(0x7a), t(0x9f), t(0x93), t(0xc9), t(0x9c), t(0xef),\ + t(0xa0), t(0xe0), t(0x3b), t(0x4d), t(0xae), t(0x2a), t(0xf5), t(0xb0),\ + t(0xc8), t(0xeb), t(0xbb), t(0x3c), t(0x83), t(0x53), t(0x99), t(0x61),\ + t(0x17), t(0x2b), t(0x04), t(0x7e), t(0xba), t(0x77), t(0xd6), t(0x26),\ + t(0xe1), t(0x69), t(0x14), t(0x63), t(0x55), t(0x21), t(0x0c), t(0x7d), + +/* +// Internal cipher tables +*/ +extern const __ALIGN64 Ipp8u RijEncSbox[256]; /* pure encryption S-box */ +extern const __ALIGN64 Ipp8u RijDecSbox[256]; /* pure decryption S-box */ + +#endif /* _PCP_RIJTBLES_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpscramble.h b/external/crypto_px/sources/ippcp/src/pcpscramble.h new file mode 100644 index 0000000000..c26f96bd10 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpscramble.h @@ -0,0 +1,170 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PC_SCRAMBLE_H) +#define _PC_SCRAMBLE_H + +/* +// cpsScramblePut/cpsScrambleGet +// stores to/retrieves from pScrambleEntry position +// pre-computed data if fixed window method is used +*/ +__INLINE void cpScramblePut(Ipp8u* pArray, cpSize colummSize, + const Ipp32u* pData, cpSize dataSize) +{ + int i; + switch(colummSize) { + case 1: + dataSize *= sizeof(Ipp32u); + for(i=0; i=2; dataSize-=2, pArray+=CACHE_LINE_SIZE, pData+=2) { + ((Ipp32u*)pArray)[0] = pData[0]; + ((Ipp32u*)pArray)[1] = pData[1]; + } + if(dataSize) + ((Ipp32u*)pArray)[0] = pData[0]; + break; + case 16: + for(; dataSize>=4; dataSize-=4, pArray+=CACHE_LINE_SIZE, pData+=4) { + ((Ipp32u*)pArray)[0] = pData[0]; + ((Ipp32u*)pArray)[1] = pData[1]; + ((Ipp32u*)pArray)[2] = pData[2]; + ((Ipp32u*)pArray)[3] = pData[3]; + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + ((Ipp32u*)pArray)[0] = pData[0]; + break; + case 32: + for(; dataSize>=8; dataSize-=8, pArray+=CACHE_LINE_SIZE, pData+=8) { + ((Ipp32u*)pArray)[0] = pData[0]; + ((Ipp32u*)pArray)[1] = pData[1]; + ((Ipp32u*)pArray)[2] = pData[2]; + ((Ipp32u*)pArray)[3] = pData[3]; + ((Ipp32u*)pArray)[4] = pData[4]; + ((Ipp32u*)pArray)[5] = pData[5]; + ((Ipp32u*)pArray)[6] = pData[6]; + ((Ipp32u*)pArray)[7] = pData[7]; + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + ((Ipp32u*)pArray)[0] = pData[0]; + break; + default: + break; + } +} + + +/* +// Retrieve data from pArray +*/ +#define u8_to_u32(b0,b1,b2,b3, x) \ + ((x) = (b0), \ + (x)|=((b1)<<8), \ + (x)|=((b2)<<16), \ + (x)|=((b3)<<24)) +#define u16_to_u32(w0,w1, x) \ + ((x) = (w0), \ + (x)|=((w1)<<16)) +#define u32_to_u64(dw0,dw1, x) \ + ((x) = (Ipp64u)(dw0), \ + (x)|= (((Ipp64u)(dw1))<<32)) + +__INLINE void cpScrambleGet(Ipp32u* pData, cpSize dataSize, + const Ipp8u* pArray, cpSize colummSize) +{ + int i; + switch(colummSize) { + case 1: + for(i=0; i=2; dataSize-=2, pArray+=CACHE_LINE_SIZE, pData+=2) { + pData[0] = ((Ipp32u*)pArray)[0]; + pData[1] = ((Ipp32u*)pArray)[1]; + } + if(dataSize) + pData[0] = ((Ipp32u*)pArray)[0]; + break; + case 16: + for(; dataSize>=4; dataSize-=4, pArray+=CACHE_LINE_SIZE, pData+=4) { + pData[0] = ((Ipp32u*)pArray)[0]; + pData[1] = ((Ipp32u*)pArray)[1]; + pData[2] = ((Ipp32u*)pArray)[2]; + pData[3] = ((Ipp32u*)pArray)[3]; + + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + pData[0] = ((Ipp32u*)pArray)[0]; + break; + case 32: + for(; dataSize>=8; dataSize-=8, pArray+=CACHE_LINE_SIZE, pData+=8) { + pData[0] = ((Ipp32u*)pArray)[0]; + pData[1] = ((Ipp32u*)pArray)[1]; + pData[2] = ((Ipp32u*)pArray)[2]; + pData[3] = ((Ipp32u*)pArray)[3]; + pData[4] = ((Ipp32u*)pArray)[4]; + pData[5] = ((Ipp32u*)pArray)[5]; + pData[6] = ((Ipp32u*)pArray)[6]; + pData[7] = ((Ipp32u*)pArray)[7]; + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + pData[0] = ((Ipp32u*)pArray)[0]; + break; + default: + break; + } +} + +#endif /* _PC_SCRAMBLE_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c b/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c new file mode 100644 index 0000000000..1fef36aef0 --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c @@ -0,0 +1,109 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/*F* +// Name: ippsMGF_SHA1 +// ippsMGF_SHA224 +// ippsMGF_SHA256 +// ippsMGF_SHA384 +// ippsMGF_SHA512 +// ippsMGF_MD5 +// +// Purpose: Mask Generation Functios. +// +// Returns: Reason: +// ippStsNullPtrErr pMask == NULL +// ippStsLengthErr seedLen <0 +// maskLen <0 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pSeed pointer to the input stream +// seedLen input stream length (bytes) +// pMaske pointer to the ouput mask +// maskLen desired length of mask (bytes) +// +*F*/ +IPPFUN(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) +{ + /* get algorithm id */ + hashAlg = cpValidHashAlg(hashAlg); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + IPP_BAD_PTR1_RET(pMask); + IPP_BADARG_RET((seedLen<0)||(maskLen<0), ippStsLengthErr); + + { + /* hash specific */ + int hashSize = cpHashSize(hashAlg); + + int i, outLen; + + IppsHashState hashCtx; + ippsHashInit(&hashCtx, hashAlg); + + if(!pSeed) + seedLen = 0; + + for(i=0,outLen=0; outLen>24) & 0xFF); + cnt[1] = (Ipp8u)((i>>16) & 0xFF); + cnt[2] = (Ipp8u)((i>>8) & 0xFF); + cnt[3] = (Ipp8u)(i & 0xFF); + + cpReInitHash(&hashCtx, hashAlg); + ippsHashUpdate(pSeed, seedLen, &hashCtx); + ippsHashUpdate(cnt, 4, &hashCtx); + + if((outLen + hashSize) <= maskLen) { + ippsHashFinal(pMask+outLen, &hashCtx); + outLen += hashSize; + } + else { + Ipp8u md[BITS2WORD8_SIZE(IPP_SHA512_DIGEST_BITSIZE)]; + ippsHashFinal(md, &hashCtx); + CopyBlock(md, pMask+outLen, maskLen-outLen); + outLen = maskLen; + } + } + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcptool.h b/external/crypto_px/sources/ippcp/src/pcptool.h new file mode 100644 index 0000000000..f4549263cd --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcptool.h @@ -0,0 +1,177 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PC_TOOL_H) +#define _CP_TOOL_H + +/* copy data block */ +__INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes) +{ + const Ipp8u* s = (Ipp8u*)pSrc; + Ipp8u* d = (Ipp8u*)pDst; + cpSize k; + for(k=0; k> (blkSize-numSize)%8 ); + + /* save crytical byte */ + Ipp8u save = (Ipp8u)( pCounter[maskPosition] & ~mask ); + + int len = BITS2WORD8_SIZE(blkSize); + Ipp32u carry = 1; + for(; (len>maskPosition) && carry; len--) { + Ipp32u x = pCounter[len-1] + carry; + pCounter[len-1] = (Ipp8u)x; + carry = (x>>8) & 0xFF; + } + + /* update crytical byte */ + pCounter[maskPosition] &= mask; + pCounter[maskPosition] |= save; +} + +#endif /* _CP_TOOL_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpver.c b/external/crypto_px/sources/ippcp/src/pcpver.c new file mode 100644 index 0000000000..694c6292ad --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpver.c @@ -0,0 +1,41 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#ifndef __OWNCP_H__ + #include "owncp.h" +#endif + +#include "pcpname.h" +#include "pcpver.h" + +#include "ippver.gen" diff --git a/external/crypto_px/sources/ippcp/src/pcpver.h b/external/crypto_px/sources/ippcp/src/pcpver.h new file mode 100644 index 0000000000..6e6e90fc7e --- /dev/null +++ b/external/crypto_px/sources/ippcp/src/pcpver.h @@ -0,0 +1,36 @@ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "ippver.h" +#define BUILD() 1043 +#define VERSION() BASE_VERSION(),BUILD() + +/* ////////////////////////// End of file "pcpver.h" ///////////////////////// */ diff --git a/external/epid/inc/epid_types.h b/external/epid/inc/epid_types.h new file mode 100644 index 0000000000..eb4b9d873f --- /dev/null +++ b/external/epid/inc/epid_types.h @@ -0,0 +1,305 @@ +/*############################################################################ + # Copyright 2016 Intel Corporation + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + ############################################################################*/ +#ifndef EPID_COMMON_TYPES_H_ +#define EPID_COMMON_TYPES_H_ + +#include // for CHAR_BIT + +/*! + * \file + * \brief SDK data types. + * \defgroup EpidTypes types + * \ingroup EpidCommon + * @{ + */ + +/// Recognized hash algorithms +typedef enum { + /// SHA-256 + kSha256 = 0, + /// SHA-384 + kSha384 = 1, + /// SHA-512 + kSha512 = 2, + /// SHA-512/256 + kSha512_256 = 3, + /// Reserved for SHA3/256 + kSha3_256 = 4, + /// Reserved for SHA3/384 + kSha3_384 = 5, + /// Reserved for SHA3/512 + kSha3_512 = 6, +} HashAlg; + +#pragma pack(1) +/// 8 bit octet string +typedef struct OctStr8 { + unsigned char data[8 / CHAR_BIT]; ///< 8 bit data +} OctStr8; +/// 32 bit octet string +typedef struct OctStr32 { + unsigned char data[32 / CHAR_BIT]; ///< 32 bit data +} OctStr32; +/// 64 bit octet string +typedef struct OctStr64 { + unsigned char data[64 / CHAR_BIT]; ///< 64 bit data +} OctStr64; +/// 128 bit octet string +typedef struct OctStr128 { + unsigned char data[128 / CHAR_BIT]; ///< 128 bit data +} OctStr128; +/// 256 bit octet string +typedef struct OctStr256 { + unsigned char data[256 / CHAR_BIT]; ///< 256 bit data +} OctStr256; + +/// Serialized BigNum +typedef struct BigNumStr { + OctStr256 data; ///< 256 bit octet string +} BigNumStr; +/// a number in [0, p-1] +typedef struct FpElemStr { + OctStr256 data; ///< 256 bit octet string +} FpElemStr; +/// a number in [0, q-1] +typedef struct FqElemStr { + OctStr256 data; ///< 256 bit octet string +} FqElemStr; + +/// Serialized G1 element +typedef struct G1ElemStr { + FqElemStr x; ///< an integer between [0, q-1] + FqElemStr y; ///< an integer between [0, q-1] +} G1ElemStr; + +/// Serialized G2 element +typedef struct G2ElemStr { + FqElemStr x[2]; ///< an integer between [0, q-1] + FqElemStr y[2]; ///< an integer between [0, q-1] +} G2ElemStr; + +/// Serialized GT element +typedef struct GtElemStr { + FqElemStr x[12]; ///< an integer between [0, q-1] +} GtElemStr; + +typedef FpElemStr PElemStr; +typedef OctStr32 RLver_t; +typedef OctStr32 RLCount; + +/// Intel(R) EPID 2.0 Parameters. +/*! + * INTEL(R) EPID 2.0 parameters: (p, q, b, t, neg, beta, xi0, xi1, + * g1, g2) + */ +typedef struct Epid2Params { + BigNumStr p; ///< a prime + BigNumStr q; ///< a prime + FqElemStr b; ///< an integer between [0, q-1] + OctStr64 t; ///< an integer + OctStr8 neg; ///< a boolean + FqElemStr beta; ///< an integer between [0, q-1] + FqElemStr xi[2]; ///< array of integers between [0, q-1] + G1ElemStr g1; ///< a generator (an element) of G1 + G2ElemStr g2; ///< a generator (an element) of G2 +} EPID2Params; + +/// group ID +typedef OctStr32 GroupID; + +/// Intel(R) EPID 2.0 group public key +/*! + * Group public key: (gid, h1, h2, w) + */ +typedef struct GroupPubKey { + GroupID gid; ///< group ID + G1ElemStr h1; ///< an element in G1 + G1ElemStr h2; ///< an element in G1 + G2ElemStr w; ///< an element in G2 +} GroupPubKey; + +/// Intel(R) EPID 2.0 issuing private key +/*! + * Issuing private key: (gid, gamma) + */ +typedef struct IPrivKey { + GroupID gid; ///< group ID + FpElemStr gamma; ///< an integer between [0, p-1] +} IPrivKey; + +/// Intel(R) EPID 2.0 private key +/*! + * Private key: (gid, A, x, f) + */ +typedef struct PrivKey { + GroupID gid; ///< group ID + G1ElemStr A; ///< an element in G1 + FpElemStr x; ///< an integer between [0, p-1] + FpElemStr f; ///< an integer between [0, p-1] +} PrivKey; + +/// 256 bit seed derived from fuse key +typedef OctStr256 Seed; + +/// Compressed private key +/*! + * Compressed Private key: (gid, A.x, seed) + */ +typedef struct CompressedPrivKey { + GroupID gid; ///< group ID + FqElemStr ax; ///< an integer between [0, p-1] + Seed seed; ///< 256 bit rekey seed +} CompressedPrivKey; + +/// Membership credential +/*! + * Membership credential: (gid, A, x) + */ +typedef struct MembershipCredential { + GroupID gid; ///< group ID + G1ElemStr A; ///< an element in G1 + FpElemStr x; ///< an integer between [0, p-1] +} MembershipCredential; + +/// 256 bit nonce chosen by issuer +typedef OctStr256 IssuerNonce; + +/// Join request +/*! + * Join request: (F, c, s) + */ +typedef struct JoinRequest { + G1ElemStr F; ///< an element in G1 + FpElemStr c; ///< an integer between [0, p-1] + FpElemStr s; ///< an integer between [0, p-1] +} JoinRequest; + +//////////////////////// + +/// Intel(R) EPID 2.0 basic signature. +/*! + * Basic signature: (B, K, T, c, sx, sf, sa, sb) + */ +typedef struct BasicSignature { + G1ElemStr B; ///< an element in G1 + G1ElemStr K; ///< an element in G1 + G1ElemStr T; ///< an element in G1 + FpElemStr c; ///< an integer between [0, p-1] + FpElemStr sx; ///< an integer between [0, p-1] + FpElemStr sf; ///< an integer between [0, p-1] + FpElemStr sa; ///< an integer between [0, p-1] + FpElemStr sb; ///< an integer between [0, p-1] +} BasicSignature; + +/// +/*! + * \brief + * non-revoked Proof. + * + * Non-revoked Proof: (T, c, smu, snu) + */ +typedef struct NrProof { + G1ElemStr T; ///< an element in G1 + FpElemStr c; ///< an integer between [0, p-1] + FpElemStr smu; ///< an integer between [0, p-1] + FpElemStr snu; ///< an integer between [0, p-1] +} NRProof; + +/// Intel(R) EPID 2.0 Signature +/*! + * Signature: (sigma0, RLver, n2, sigma[0], ..., sigma[n2-1]) + */ +typedef struct EpidSignature { + BasicSignature sigma0; ///< basic signature + OctStr32 rl_ver; ///< revocation list version number + OctStr32 n2; ///< number of entries in SigRL + NRProof sigma[1]; ///< array of non-revoked proofs (flexible array) +} EPIDSignature; + +/// private-key based revocation list. +/*! + * Private-key based revocation list PrivRL: (gid, RLver, n1, f[0], + * ..., f[n1-1]) + */ +typedef struct PrivRl { + GroupID gid; ///< group ID + OctStr32 version; ///< revocation list version number + OctStr32 n1; ///< number of entries in PrivRL + FpElemStr f[1]; ///< integers between [1, p-1] (flexible array) +} PrivRl; + +/// entry in SigRL (B,K) +typedef struct SigRlEntry { + G1ElemStr b; ///< an element of G1 + G1ElemStr k; ///< an element of G1 +} SigRLEntry; + +/// signature based revocation list +/*! + * Signature based revocation list SigRL: (gid, RLver, n2, B[0], + * K[0], ..., B[n2-1], K[n2-1]) + */ +typedef struct SigRl { + GroupID gid; ///< group ID + OctStr32 RLver; ///< revocation list version number + OctStr32 n2; ///< number of entries in SigRL + SigRLEntry BK[1]; ///< revoked Bs and Ks (flexible array) +} SigRL; + +/// group revocation list +/*! + * Group revocation list GroupRL: (RLver, n3, gid[0], ..., + * gid[n3-1]) + */ +typedef struct GroupRl { + OctStr32 version; ///< revocation list version number + OctStr32 n3; ///< number of entries in GroupRL + GroupID gid[1]; ///< revoked group IDs (flexible array) +} GroupRl; + +/*! verifier revocation list + * Verifier revocation list VerifierRL: (gid, B, RLver, n4, K[0], + * ..., K[n4-1]) + */ +typedef struct VerifierRl { + GroupID gid; ///< group ID + G1ElemStr B; ///< an element in G1 + OctStr32 version; ///< revocation list version number + OctStr32 n4; ///< number of entries in VerifierRL + G1ElemStr K[1]; ///< elements in G1 (flexible array) +} VerifierRl; + +/// element to store seed values for later rekey +typedef G1ElemStr ReKeySeed; + +/// Serialized Fq2 element +typedef struct Fq2ElemStr { + FqElemStr a[2]; ///< polynomial coefficient +} Fq2ElemStr; + +/// Serialized Fq2^3 element +typedef struct Fq6ElemStr { + Fq2ElemStr a[3]; ///< polynomial coefficient +} Fq6ElemStr; + +/// Serialized Fq2^3^2 element +typedef struct Fq12ElemStr { + Fq6ElemStr a[2]; ///< polynomial coefficient +} Fq12ElemStr; +#pragma pack() + +/*! @} */ +#endif // EPID_COMMON_TYPES_H_ diff --git a/external/rdrand/rdrand.h b/external/rdrand/rdrand.h new file mode 100644 index 0000000000..ee25cf5986 --- /dev/null +++ b/external/rdrand/rdrand.h @@ -0,0 +1,156 @@ +/* Copyright © 2012, Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +- Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. */ + +/*! \file rdrand.h + * \brief Public header for rdrand API. + * + * This is the public header for the rdrand API. It exposes the three public + * APIs, which access the rdrand instruction for various data sizes. + */ + +#ifndef RDRAND_H +#define RDRAND_H + +#include + +/*! \def RDRAND_SUCCESS + * The rdrand call was successful, the hardware was ready, and a random + * number was returned. + */ +#define RDRAND_SUCCESS 1 + +/*! \def RDRAND_NOT_READY + * The rdrand call was unsuccessful, the hardware was not ready, and a + * random number was not returned. + */ +#define RDRAND_NOT_READY -1 + +/*! \def RDRAND_SUPPORTED + * The rdrand instruction is supported by the host hardware. + */ +#define RDRAND_SUPPORTED -2 + +/*! \def RDRAND_UNSUPPORTED + * The rdrand instruction is unsupported by the host hardware. + */ +#define RDRAND_UNSUPPORTED -3 + +/*! \def RDRAND_SUPPORT_UNKNOWN + * Whether or not the hardware supports the rdrand instruction is unknown + */ +#define RDRAND_SUPPORT_UNKNOWN -4 + +#ifdef __cplusplus +extern "C" { +#endif +/*! \brief Calls rdrand for a 16-bit result. + * + * This function calls rdrand requesting a 16-bit result. By default, it will + * perform only a single call to rdrand, returning success or failure. On + * success, the data is written to memory pointed to by x. If the int retry is + * true (non-zero), the function will enter a loop with count=10 until rdrand succeeds, at + * which point it write the random data and return success, or fails This + * function also ensures that rdrand is supported by the cpu or fails + * gracefully. + * + * \param x pointer to memory to store the random result + * \param retry int to determine whether or not to loop until rdrand succeeds + * or until 10 failed attempts + * + * \return whether or not the call was successful, or supported at all + */ +int rdrand_16(uint16_t* x, int retry); + +/*! \brief Calls rdrand for a 32-byte result. + * + * This function calls rdrand requesting a 32-bit result. By default, it will + * perform only a single call to rdrand, returning success or failure. On + * success, the data is written to memory pointed to by x. If the int retry is + * true (non-zero), the function will enter a loop with count=10 until rdrand succeeds, at + * which point it write the random data and return success, or fails This + * function also ensures that rdrand is supported by the cpu or fails + * gracefully. + * + * \param x pointer to memory to store the random result + * \param retry int to determine whether or not to loop until rdrand succeeds + * or until 10 failed attempts + * + * \return whether or not the call was successful, or supported at all + */ +int rdrand_32(uint32_t* x, int retry); + +/*! \brief Calls rdrand for a 64-byte result. + * + * This function calls rdrand requesting a 64-byte result. By default, it will + * perform only a single call to rdrand, returning success or failure. On + * success, the data is written to memory pointed to by x. If the int retry is + * true (non-zero), the function will enter a loop with count=10 until rdrand succeeds, at + * which point it write the random data and return success, or fails This + * function also ensures that rdrand is supported by the cpu or fails + * gracefully. + * + * \param x pointer to memory to store the random result + * \param retry int to determine whether or not to loop until rdrand succeeds + * or until 10 failed attempts + * + * \return whether or not the call was successful, or supported at all + */ +int rdrand_64(uint64_t* x, int retry); + +/*! \brief Calls rdrand to obtain multiple 64-byte results. + * + * This function calls rdrand requesting multiple 64-byte results. On + * success, the data is written to memory pointed to by x. This function + * calls rdrand_64 and if any of those invocations fail, this function + * fails. It returns the same values as rdrand_64. + */ +int rdrand_get_n_64(unsigned int n, uint64_t* x); + +/*! \brief Calls rdrand to obtain multiple 32-byte results. + * + * This function calls rdrand requesting multiple 32-byte results. On + * success, the data is written to memory pointed to by x. This function + * calls rdrand_32 and if any of those invocations fail, this function + * fails. It returns the same values as rdrand_32. + */ +int rdrand_get_n_32(unsigned int n, uint32_t* x); + +/*! \brief Calls rdrand to fill a buffer of arbitrary size with random bytes. + * + * This function calls rdrand requesting multiple 64- or 32-bit results to + * fill a buffer of arbitrary size. + * + * \param n size of the buffer to fill with random bytes + * \param buffer pointer to memory to store the random result + * + * \return whether or not the call was successful, or supported at all + */ + +int rdrand_get_bytes(unsigned int n, unsigned char *buffer); +#ifdef __cplusplus +}; +#endif + +#endif // RDRAND_H diff --git a/external/rdrand/src/Makefile.in b/external/rdrand/src/Makefile.in new file mode 100644 index 0000000000..5a4ec8c421 --- /dev/null +++ b/external/rdrand/src/Makefile.in @@ -0,0 +1,29 @@ +PACKAGE_NAME=@PACKAGE_NAME@ +PACKAGE_VERSION=@PACKAGE_VERSION@ +CC=@CC@ +CFLAGS=@CFLAGS@ -O2 +AR=ar + +TEST_OBJ=main.o + +%.o: %.c + $(CC) $(CFLAGS) -c $< + +all: bin lib + +bin: test + +lib: librdrand.a + +librdrand.a: rdrand.o + $(AR) rcs $@ $? + +test: $(TEST_OBJ) librdrand.a + $(CC) $(CFLAGS) -o $@ $(TEST_OBJ) -L. -lrdrand + +clean: + rm -f *.o librdrand.a test + +distclean: clean + rm -f Makefile config.guess config.status config.log config.h + diff --git a/external/rdrand/src/README b/external/rdrand/src/README new file mode 100644 index 0000000000..2535036019 --- /dev/null +++ b/external/rdrand/src/README @@ -0,0 +1,26 @@ +Rdrand Library +---------------------------- +Welcome to the Rdrand Library. This is a simple library aimed at +bringing suport for the rdrdand instruction feature of Intel processors +starting with the Intel(r) microarchitecture code name Ivy Bridge, (also known +as 3rd Generation Intel Core(tm) processor) to users with toolchains that do +not support this new feature. For more information on the rdrand instruction, +please visit http://software.intel.com/en-us/articles/download-the-latest-bull-mountain-software-implementation-guide/ +The new rdrand instruction is innovative hardware approach to high-quality, +high-performance entropy and random number generation. Because the many of +compiler toolchains do not support this new instruction, this library was +created to facilitate easy access to it. The idea is simple: link to a +built static library and enjoy the new feature! Or, if you wish the full +source code is provided. + +Documentation is stored in doc/--Point your browser to doc/html/index.html to get +started. Included in the documentation is more information about the +rdrand instruction, build instructions, and information on supported +toolchains. + +There is also a demonstration project using Microsoft* Visual Studio* project +file named "Test" that demonstrate linking to the generated library. + +Copyright(C) 2012 Intel Corporation. All rights reserved. + +*Other names and brands may be claimed as the property of others \ No newline at end of file diff --git a/external/rdrand/src/config.h.in b/external/rdrand/src/config.h.in new file mode 100644 index 0000000000..1908799d2f --- /dev/null +++ b/external/rdrand/src/config.h.in @@ -0,0 +1,53 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if using gcc and it supports RDRAND */ +#undef HAVE_RDRAND_IN_GCC + diff --git a/external/rdrand/src/configure b/external/rdrand/src/configure new file mode 100755 index 0000000000..241321dfd5 --- /dev/null +++ b/external/rdrand/src/configure @@ -0,0 +1,4284 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for librdrand 1.1. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and Intel Software +$0: Network about your system, including any error possibly +$0: output before this message. Then install a modern +$0: shell, or manually run the script under such a shell if +$0: you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='librdrand' +PACKAGE_TARNAME='librdrand' +PACKAGE_VERSION='1.1' +PACKAGE_STRING='librdrand 1.1' +PACKAGE_BUGREPORT='Intel Software Network' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures librdrand 1.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/librdrand] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of librdrand 1.1:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +librdrand configure 1.1 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------- ## +## Report this to Intel Software Network ## +## ------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by librdrand $as_me 1.1, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in icc gcc + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in icc gcc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test "x$CC" = "xgcc" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if gcc knows the rdrand instruction" >&5 +$as_echo_n "checking if gcc knows the rdrand instruction... " >&6; } + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + asm("rdrand %eax;"); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "#define HAVE_RDRAND_IN_GCC 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in inttypes.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_inttypes_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H 1 +_ACEOF + +fi + +done + + +ac_config_files="$ac_config_files Makefile" + + +ac_config_headers="$ac_config_headers config.h" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by librdrand $as_me 1.1, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +librdrand config.status 1.1 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + diff --git a/external/rdrand/src/configure.ac b/external/rdrand/src/configure.ac new file mode 100644 index 0000000000..162c4ddf4b --- /dev/null +++ b/external/rdrand/src/configure.ac @@ -0,0 +1,21 @@ +AC_INIT([librdrand], [1.1], [Intel Software Network]) + +AC_PROG_CC([icc gcc]) + +if test "x$CC" = "xgcc" +then + AC_MSG_CHECKING([if gcc knows the rdrand instruction]) + AC_TRY_COMPILE([], [ + asm("rdrand %eax;"); + ], AC_DEFINE([HAVE_RDRAND_IN_GCC]) AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])) +fi + +AC_CHECK_HEADERS([inttypes.h]) + +AC_CONFIG_FILES([Makefile]) + +AC_CONFIG_HEADERS([config.h]) + +AC_OUTPUT + + diff --git a/external/rdrand/src/main.c b/external/rdrand/src/main.c new file mode 100644 index 0000000000..02bd704f41 --- /dev/null +++ b/external/rdrand/src/main.c @@ -0,0 +1,95 @@ +/* Copyright © 2012, Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +- Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. */ + +#include +#include + +#include "rdrand.h" + +#define BUFFSIZE 1275 + +int main() +{ + int r; + uint16_t u16; + uint32_t u32; + uint64_t u64; + uint32_t array32[10]; + uint64_t array64[10]; + unsigned char buffer[BUFFSIZE]; + + r = rdrand_16(&u16, 10); + if (r != RDRAND_SUCCESS ) printf("rdrand instruction failed with code %d\n", r); + + r = rdrand_32(&u32, 10); + if (r != RDRAND_SUCCESS ) printf("rdrand instruction failed with code %d\n", r); + + r = rdrand_64(&u64, 10); + if (r != RDRAND_SUCCESS ) printf("rdrand instruction failed with code %d\n", r); + + printf("uint16: %u\n", u16); + printf("uint32: %u\n", u32); + printf("uint64: %llu\n", (unsigned long long) u64); + + r = rdrand_get_n_32(10, array32); + if ( r == RDRAND_SUCCESS ) { + int i; + printf("\n10 uint32's:\n"); + for (i= 0; i< 10; ++i) { + printf("%u\n", array32[i]); + } + } else printf("rdrand instruction failed with code %d\n", r); + + r = rdrand_get_n_64(10, array64); + if ( r == RDRAND_SUCCESS ) { + int i; + printf("\n10 uint64's:\n"); + for (i= 0; i< 10; ++i) { + printf("%llu\n", (unsigned long long) array64[i]); + } + } else printf("rdrand instruction failed with code %d\n", r); + + memset(buffer, 0, BUFFSIZE); + r = rdrand_get_bytes(BUFFSIZE, buffer); + if ( r == RDRAND_SUCCESS ) { + int i, j; + printf("\nBuffer of %ld bytes:\n", (long) BUFFSIZE); + + j= 0; + for (i= 0; i< BUFFSIZE; ++i) + { + printf("%02x ", buffer[i]); + + ++j; + + if ( j == 16 ) { + j= 0; + printf("\n"); + } else if ( j == 8 ) printf(" "); + + } + printf("\n"); + } else printf("rdrand instruction failed with code %d\n", r); +} diff --git a/external/rdrand/src/rdrand.c b/external/rdrand/src/rdrand.c new file mode 100644 index 0000000000..789b4f06cb --- /dev/null +++ b/external/rdrand/src/rdrand.c @@ -0,0 +1,385 @@ +/* Copyright © 2012, Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +- Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. */ + +#include "rdrand.h" + +#ifdef __INTEL_COMPILER +# include +#endif + +#include +#include + +/*! \def RDRAND_MASK +* The bit mask used to examine the ecx register returned by cpuid. The + * 30th bit is set. + */ +#define RDRAND_MASK 0x40000000 + +#define RETRY_LIMIT 10 + +#if defined(_WIN64)||defined(_LP64) +# define _IS64BIT +#endif + +#ifdef _IS64BIT +typedef uint64_t _wordlen_t; +#else +typedef uint32_t _wordlen_t; +#endif + +/* Mimic the Intel compiler's intrinsics as best we can if we are using gcc */ + +#ifdef __GNUC__ + +# define __cpuid(x,y) asm volatile("cpuid":"=a"(x[0]),"=b"(x[1]),"=c"(x[2]),"=d"(x[3]):"a"(y)) + +/* RDRAND isn't a supported instruction until gcc 4.6 */ + +# ifdef HAVE_RDRAND_IN_GCC + +# define _rdrand_step(x) ({ unsigned char err; asm volatile("rdrand %0; setc %1":"=r"(*x), "=qm"(err)); err; }) + +# define _rdrand16_step(x) _rdrand_step(x) +# define _rdrand32_step(x) _rdrand_step(x) + +# else + + /* Our version of gcc is too old, so we need to use byte code */ + +# define _rdrand16_step(x) ({ unsigned char err; asm volatile(".byte 0x66; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1":"=a"(*x), "=qm"(err)); err; }) +# define _rdrand32_step(x) ({ unsigned char err; asm volatile(".byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1":"=a"(*x), "=qm"(err)); err; }) + +# endif + +#ifdef _IS64BIT + +# ifdef HAVE_RDRAND_IN_GCC +# define _rdrand64_step(x) _rdrand_step(x) +# else + + /* Our version of gcc is too old, so we need to use byte code */ + +# define _rdrand64_step(x) ({ unsigned char err; asm volatile(".byte 0x48; .byte 0x0f; .byte 0xc7; .byte 0xf0; setc %1":"=a"(*x), "=qm"(err)); err; }) + +# endif + +#else + +/* + * The Intel compiler intrinsic for generating a 64-bit rand on a 32-bit + * system maps to two 32-bit RDRAND instructions. Because of the way + * the way the DRNG is implemented you can do this up to a 128-bit value + * (for crypto purposes) before you no longer have multiplicative + * prediction resistance. + * + * Note that this isn't very efficient. If you need 64-bit values + * you should really be on a 64-bit system. + */ + +int _rdrand64_step (uint64_t *x); + +int _rdrand64_step (uint64_t *x) +{ + uint32_t xlow, xhigh; + int rv; + + if ( (rv= _rdrand32_step(&xlow)) != RDRAND_SUCCESS ) return rv; + if ( (rv= _rdrand32_step(&xhigh)) != RDRAND_SUCCESS ) return rv; + + *x= (uint64_t) xlow | ((uint64_t)xhigh<<32); + + return RDRAND_SUCCESS; +} + +# endif + +#endif + +/*! \brief Queries cpuid to see if rdrand is supported + * + * rdrand support in a CPU is determined by examining the 30th bit of the ecx + * register after calling cpuid. + * + * \return bool of whether or not rdrand is supported + */ + +int RdRand_cpuid() +{ + int info[4] = {-1, -1, -1, -1}; + + /* Are we on an Intel processor? */ + + __cpuid(info, 0); + + if ( memcmp((void *) &info[1], (void *) "Genu", 4) != 0 || + memcmp((void *) &info[3], (void *) "ineI", 4) != 0 || + memcmp((void *) &info[2], (void *) "ntel", 4) != 0 ) { + + return 0; + } + + /* Do we have RDRAND? */ + + __cpuid(info, /*feature bits*/1); + + int ecx = info[2]; + if ((ecx & RDRAND_MASK) == RDRAND_MASK) + return 1; + else + return 0; +} + +/*! \brief Determines whether or not rdrand is supported by the CPU + * + * This function simply serves as a cache of the result provided by cpuid, + * since calling cpuid is so expensive. The result is stored in a static + * variable to save from calling cpuid on each invocation of rdrand. + * + * \return bool/int of whether or not rdrand is supported + */ + +int RdRand_isSupported() +{ + static int supported = RDRAND_SUPPORT_UNKNOWN; + + if (supported == RDRAND_SUPPORT_UNKNOWN) + { + if (RdRand_cpuid()) + supported = RDRAND_SUPPORTED; + else + supported = RDRAND_UNSUPPORTED; + } + + return (supported == RDRAND_SUPPORTED) ? 1 : 0; +} + +int rdrand_16(uint16_t* x, int retry) +{ + if (RdRand_isSupported()) + { + if (retry) + { + int i; + + for (i = 0; i < RETRY_LIMIT; i++) + { + if (_rdrand16_step(x)) + return RDRAND_SUCCESS; + } + + return RDRAND_NOT_READY; + } + else + { + if (_rdrand16_step(x)) + return RDRAND_SUCCESS; + else + return RDRAND_NOT_READY; + } + } + else + { + return RDRAND_UNSUPPORTED; + } +} + +int rdrand_32(uint32_t* x, int retry) +{ + if (RdRand_isSupported()) + { + if (retry) + { + int i; + + for (i= 0; i < RETRY_LIMIT; i++) + { + if (_rdrand32_step(x)) + return RDRAND_SUCCESS; + } + + return RDRAND_NOT_READY; + } + else + { + if (_rdrand32_step(x)) + return RDRAND_SUCCESS; + else + return RDRAND_NOT_READY; + } + } + else + { + return RDRAND_UNSUPPORTED; + } +} + +int rdrand_64(uint64_t* x, int retry) +{ + if (RdRand_isSupported()) + { + if (retry) + { + int i; + + for (i= 0; i < RETRY_LIMIT; i++) + { + if (_rdrand64_step(x)) + return RDRAND_SUCCESS; + } + + return RDRAND_NOT_READY; + } + else + { + if (_rdrand64_step(x)) + return RDRAND_SUCCESS; + else + return RDRAND_NOT_READY; + } + } + else + { + return RDRAND_UNSUPPORTED; + } +} + +int rdrand_get_n_64(unsigned int n, uint64_t *dest) +{ + int success; + int count; + unsigned int i; + + for (i=0; i 0) + { +#ifdef _IS64BIT + if ( (success= rdrand_64((uint64_t *) &temprand, 1)) != RDRAND_SUCCESS) return success; +#else + if ( (success= rdrand_32((uint32_t *) &temprand, 1)) != RDRAND_SUCCESS) return success; +#endif + } + + /* populate the starting misaligned block */ + for (i = 0; i> 8; + } + + /* populate the central aligned block. Fail out if retry fails */ + +#ifdef _IS64BIT + if ( (success= rdrand_get_n_64(length, (uint64_t *)(blockstart))) != RDRAND_SUCCESS) return success; +#else + if ( (success= rdrand_get_n_32(length, (uint32_t *)(blockstart))) != RDRAND_SUCCESS) return success; +#endif + /* populate the final misaligned block */ + if (residual > 0) + { +#ifdef _IS64BIT + if ((success= rdrand_64((uint64_t *)&temprand, 1)) != RDRAND_SUCCESS) return success; +#else + if ((success= rdrand_32((uint32_t *)&temprand, 1)) != RDRAND_SUCCESS) return success; +#endif + + for (i = 0; i> 8; + } + } + + return RDRAND_SUCCESS; +} + + diff --git a/external/rdrand/src/rdrand.h b/external/rdrand/src/rdrand.h new file mode 100644 index 0000000000..2c6f9be8cd --- /dev/null +++ b/external/rdrand/src/rdrand.h @@ -0,0 +1,169 @@ +/* Copyright © 2012, Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +- Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. */ + +/*! \file rdrand.h + * \brief Public header for rdrand API. + * + * This is the public header for the rdrand API. It exposes the three public + * APIs, which access the rdrand instruction for various data sizes. + */ + +#ifndef RDRAND_H +#define RDRAND_H + +#include "config.h" + +#if HAVE_INTTYPES_H +#include +#endif + +#ifdef _MSC_VER + /* MSVC specific */ + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +#endif + +/*! \def RDRAND_SUCCESS + * The rdrand call was successful, the hardware was ready, and a random + * number was returned. + */ +#define RDRAND_SUCCESS 1 + +/*! \def RDRAND_NOT_READY + * The rdrand call was unsuccessful, the hardware was not ready, and a + * random number was not returned. + */ +#define RDRAND_NOT_READY -1 + +/*! \def RDRAND_SUPPORTED + * The rdrand instruction is supported by the host hardware. + */ +#define RDRAND_SUPPORTED -2 + +/*! \def RDRAND_UNSUPPORTED + * The rdrand instruction is unsupported by the host hardware. + */ +#define RDRAND_UNSUPPORTED -3 + +/*! \def RDRAND_SUPPORT_UNKNOWN + * Whether or not the hardware supports the rdrand instruction is unknown + */ +#define RDRAND_SUPPORT_UNKNOWN -4 + +/*! \brief Calls rdrand for a 16-bit result. + * + * This function calls rdrand requesting a 16-bit result. By default, it will + * perform only a single call to rdrand, returning success or failure. On + * success, the data is written to memory pointed to by x. If the int retry is + * true (non-zero), the function will enter a loop with count=10 until rdrand succeeds, at + * which point it write the random data and return success, or fails This + * function also ensures that rdrand is supported by the cpu or fails + * gracefully. + * + * \param x pointer to memory to store the random result + * \param retry int to determine whether or not to loop until rdrand succeeds + * or until 10 failed attempts + * + * \return whether or not the call was successful, or supported at all + */ +int rdrand_16(uint16_t* x, int retry); + +/*! \brief Calls rdrand for a 32-byte result. + * + * This function calls rdrand requesting a 32-bit result. By default, it will + * perform only a single call to rdrand, returning success or failure. On + * success, the data is written to memory pointed to by x. If the int retry is + * true (non-zero), the function will enter a loop with count=10 until rdrand succeeds, at + * which point it write the random data and return success, or fails This + * function also ensures that rdrand is supported by the cpu or fails + * gracefully. + * + * \param x pointer to memory to store the random result + * \param retry int to determine whether or not to loop until rdrand succeeds + * or until 10 failed attempts + * + * \return whether or not the call was successful, or supported at all + */ +int rdrand_32(uint32_t* x, int retry); + +/*! \brief Calls rdrand for a 64-byte result. + * + * This function calls rdrand requesting a 64-byte result. By default, it will + * perform only a single call to rdrand, returning success or failure. On + * success, the data is written to memory pointed to by x. If the int retry is + * true (non-zero), the function will enter a loop with count=10 until rdrand succeeds, at + * which point it write the random data and return success, or fails This + * function also ensures that rdrand is supported by the cpu or fails + * gracefully. + * + * Calling rdrand_64 on a 32-bit system is inefficient as it makes two calls + * to rdrand_32 to produce a single 64-bit value, using a shift to populate + * the high bits. The physical construction of the DRNG allows you to do this + * up to a 128-bit value while retaining multiplicative prediction resistance + * (i.e., don't do this to generate numbers larger than 128 bits). + * + * \param x pointer to memory to store the random result + * \param retry int to determine whether or not to loop until rdrand succeeds + * or until 10 failed attempts + * + * \return whether or not the call was successful, or supported at all + */ +int rdrand_64(uint64_t* x, int retry); + +/*! \brief Calls rdrand to obtain multiple 64-byte results. + * + * This function calls rdrand requesting multiple 64-byte results. On + * success, the data is written to memory pointed to by x. This function + * calls rdrand_64 and if any of those invocations fail, this function + * fails. It returns the same values as rdrand_64. + * + * This function is inefficient on 32-bit systems. + */ +int rdrand_get_n_64(unsigned int n, uint64_t* x); + +/*! \brief Calls rdrand to obtain multiple 32-byte results. + * + * This function calls rdrand requesting multiple 32-byte results. On + * success, the data is written to memory pointed to by x. This function + * calls rdrand_32 and if any of those invocations fail, this function + * fails. It returns the same values as rdrand_32. + */ +int rdrand_get_n_32(unsigned int n, uint32_t* x); + +/*! \brief Calls rdrand to fill a buffer of arbitrary size with random bytes. + * + * This function calls rdrand requesting multiple 64- or 32-bit results to + * fill a buffer of arbitrary size. + * + * \param n size of the buffer to fill with random bytes + * \param buffer pointer to memory to store the random result + * + * \return whether or not the call was successful, or supported at all + */ + +int rdrand_get_bytes(unsigned int n, unsigned char *buffer); + +#endif // RDRAND_H diff --git a/external/sgx_libm/ia32/acos_wmt.S b/external/sgx_libm/ia32/acos_wmt.S new file mode 100644 index 0000000000..d3163b7aca --- /dev/null +++ b/external/sgx_libm/ia32/acos_wmt.S @@ -0,0 +1,1927 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acos_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin acos + .text + .align 16,0x90 + .globl acos +acos: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 6048(%ebx), %xmm4 + movsd 6080(%ebx), %xmm3 + xorpd %xmm5, %xmm5 + movsd 6064(%ebx), %xmm2 + movapd %xmm0, %xmm1 + movsd %xmm0, 8(%esp) + psrlq $44, %xmm0 + movd %xmm0, %edx + movapd %xmm1, %xmm7 + movl $8192, %ecx + pinsrw $2, %ecx, %xmm5 + movapd %xmm1, %xmm0 + movl $524287, %eax + andl %edx, %eax + subl $260864, %eax + cmpl $955, %eax + jae .L_2TAG_PACKET_0.0.3 + mulsd %xmm1, %xmm1 + andl $65535, %edx + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + andpd %xmm7, %xmm2 + andl $-4, %edx + subl $64256, %edx + movsd 3840(%ebx,%edx,2), %xmm1 + orpd %xmm5, %xmm2 + movapd (%ebx,%edx,4), %xmm4 + movapd %xmm7, %xmm6 + addsd %xmm2, %xmm7 + subsd %xmm2, %xmm0 + mulsd %xmm0, %xmm7 + mulsd %xmm1, %xmm6 + mulsd %xmm2, %xmm3 + movapd %xmm6, %xmm1 + addsd %xmm3, %xmm6 + divsd %xmm6, %xmm7 + movsd 5976(%ebx), %xmm0 + movsd 5960(%ebx), %xmm5 + subsd %xmm3, %xmm1 + psrlq $63, %xmm2 + movapd %xmm1, %xmm3 + psllq $63, %xmm2 + mulsd %xmm1, %xmm1 + pshufd $68, %xmm2, %xmm2 + movsd 5968(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm0 + xorpd %xmm2, %xmm4 + mulsd %xmm3, %xmm5 + subpd 5888(%ebx), %xmm4 + mulsd %xmm1, %xmm3 + addsd %xmm6, %xmm0 + mulsd %xmm3, %xmm0 + subsd %xmm4, %xmm5 + pshufd $238, %xmm4, %xmm4 + addsd %xmm5, %xmm0 + subsd %xmm7, %xmm0 + subsd %xmm4, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + subl $955, %eax + cmpl $65, %eax + jae .L_2TAG_PACKET_2.0.3 + psrlq $38, %xmm7 + psllq $38, %xmm7 + pmovmskb %xmm0, %eax + andnpd %xmm0, %xmm4 + subsd %xmm7, %xmm1 + movapd %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + addsd %xmm6, %xmm0 + orpd %xmm4, %xmm5 + subsd %xmm7, %xmm3 + mulsd %xmm1, %xmm0 + movapd %xmm3, %xmm4 + subsd %xmm0, %xmm3 + sqrtsd %xmm3, %xmm3 + andl $128, %eax + shrl $7, %eax + negl %eax + movapd %xmm3, %xmm7 + andpd %xmm3, %xmm2 + psllq $2, %xmm3 + pextrw $3, %xmm3, %edx + orpd %xmm5, %xmm2 + movd %eax, %xmm3 + pshufd $0, %xmm3, %xmm3 + subl $65216, %edx + addl %edx, %edx + mulsd 3840(%ebx,%edx,4), %xmm7 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + subsd %xmm7, %xmm6 + andpd 5904(%ebx), %xmm3 + addsd %xmm1, %xmm6 + subsd %xmm2, %xmm4 + addsd %xmm7, %xmm7 + movsd 5960(%ebx), %xmm5 + subsd %xmm0, %xmm4 + addsd %xmm6, %xmm7 + movsd 5976(%ebx), %xmm0 + divsd %xmm7, %xmm4 + movsd 5968(%ebx), %xmm2 + addpd (%ebx,%edx,8), %xmm3 + movapd %xmm6, %xmm1 + mulsd %xmm6, %xmm6 + mulsd %xmm6, %xmm0 + mulsd %xmm6, %xmm1 + mulsd %xmm1, %xmm5 + mulsd %xmm6, %xmm1 + addsd %xmm2, %xmm0 + pxor %xmm6, %xmm6 + mulsd %xmm1, %xmm0 + addsd %xmm3, %xmm5 + addsd %xmm5, %xmm0 + andl $32768, %eax + pinsrw $3, %eax, %xmm6 + movapd %xmm4, %xmm5 + pshufd $238, %xmm3, %xmm3 + addsd %xmm3, %xmm4 + subsd %xmm4, %xmm3 + addsd %xmm3, %xmm5 + addsd %xmm5, %xmm0 + addsd %xmm4, %xmm0 + xorpd %xmm6, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + addl $15291, %eax + cmpl $14336, %eax + jae .L_2TAG_PACKET_3.0.3 + unpcklpd %xmm0, %xmm0 + movapd 5984(%ebx), %xmm6 + unpcklpd %xmm0, %xmm1 + movapd 6000(%ebx), %xmm2 + movapd 6016(%ebx), %xmm4 + mulpd %xmm0, %xmm0 + movapd 5888(%ebx), %xmm5 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm6 + mulpd %xmm0, %xmm0 + movapd %xmm1, %xmm3 + mulsd %xmm1, %xmm1 + addpd %xmm2, %xmm6 + mulpd %xmm0, %xmm4 + mulsd %xmm3, %xmm1 + addpd %xmm4, %xmm6 + pshufd $238, %xmm5, %xmm0 + mulpd %xmm6, %xmm1 + pshufd $238, %xmm5, %xmm6 + subsd %xmm7, %xmm0 + pshufd $238, %xmm1, %xmm2 + subsd %xmm1, %xmm5 + subsd %xmm0, %xmm6 + subsd %xmm2, %xmm5 + subsd %xmm6, %xmm7 + subsd %xmm7, %xmm5 + addsd %xmm5, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + subl $15356, %eax + cmpl $4, %eax + jae .L_2TAG_PACKET_4.0.3 + xorpd %xmm6, %xmm6 + andpd 6048(%ebx), %xmm7 + movsd 6096(%ebx), %xmm4 + movapd 5984(%ebx), %xmm1 + mulsd %xmm4, %xmm7 + movapd 6000(%ebx), %xmm2 + subsd %xmm7, %xmm4 + movapd 6016(%ebx), %xmm3 + pshufd $68, %xmm4, %xmm7 + sqrtsd %xmm4, %xmm4 + mulpd %xmm7, %xmm1 + pshufd $68, %xmm7, %xmm5 + pextrw $3, %xmm0, %eax + mulpd %xmm7, %xmm7 + addpd %xmm1, %xmm2 + movsd 5936(%ebx), %xmm1 + mulpd %xmm7, %xmm3 + cmpsd $1, %xmm6, %xmm0 + mulsd %xmm5, %xmm7 + addpd %xmm3, %xmm2 + pshufd $68, %xmm0, %xmm0 + mulsd %xmm7, %xmm2 + andpd 5904(%ebx), %xmm0 + mulpd %xmm5, %xmm2 + andpd %xmm4, %xmm1 + pshufd $68, %xmm4, %xmm3 + subsd %xmm1, %xmm4 + addsd %xmm3, %xmm3 + mulsd %xmm1, %xmm1 + subsd %xmm4, %xmm3 + subsd %xmm1, %xmm5 + mulsd %xmm3, %xmm4 + pshufd $238, %xmm3, %xmm3 + subsd %xmm4, %xmm5 + divsd %xmm3, %xmm5 + addpd %xmm3, %xmm3 + mulpd %xmm3, %xmm2 + pshufd $238, %xmm2, %xmm4 + addsd %xmm0, %xmm2 + andl $32768, %eax + pinsrw $3, %eax, %xmm6 + pshufd $238, %xmm0, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm5, %xmm2 + addsd %xmm3, %xmm2 + addsd %xmm2, %xmm0 + xorpd %xmm6, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_4.0.3: + addl $261884, %eax + cmpl $261888, %eax + jb .L_2TAG_PACKET_5.0.3 + movd %xmm7, %ecx + psrlq $32, %xmm7 + movd %xmm7, %edx + andl $2147483647, %edx + movl $1072693248, %eax + subl %edx, %eax + orl %ecx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_6.0.3 + movq 8(%esp), %xmm2 + movd %xmm2, %edx + psrlq $32, %xmm2 + movd %xmm2, %ecx + andl $2147483647, %ecx + subl $1, %edx + sbbl $2146435072, %ecx + cmpl $0, %ecx + jge .L_2TAG_PACKET_7.0.3 + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %edx + pinsrw $3, %edx, %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $58, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + pextrw $1, %xmm7, %edx + shrl $15, %edx + negl %edx + movd %edx, %xmm7 + pshufd $0, %xmm7, %xmm7 + movsd 5920(%ebx), %xmm2 + movsd 5928(%ebx), %xmm0 + andpd %xmm7, %xmm2 + andpd %xmm7, %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_5.0.3: + movsd 5888(%ebx), %xmm2 + movsd 5896(%ebx), %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_7.0.3: + xorpd %xmm6, %xmm6 + addsd %xmm6, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_1.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type acos,@function + .size acos,.-acos + .data +# -- End acos + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 3822952792 + .long 1021639372 + .long 182792448 + .long 1068507836 + .long 2264213271 + .long 1019558908 + .long 649052928 + .long 1068524253 + .long 1797139609 + .long 1022295143 + .long 1243095296 + .long 1068540671 + .long 1415938756 + .long 1021439537 + .long 2033294592 + .long 1068557090 + .long 2356809978 + .long 1021777916 + .long 3088063744 + .long 1068573510 + .long 2669055318 + .long 1022124482 + .long 180888576 + .long 1068589932 + .long 3566445325 + .long 1021358712 + .long 1970196992 + .long 1068606354 + .long 896980323 + .long 1021319659 + .long 4229555456 + .long 1068622777 + .long 436049712 + .long 1021319758 + .long 2732572160 + .long 1068639202 + .long 583123209 + .long 1020797960 + .long 1842831872 + .long 1068655628 + .long 1370449804 + .long 1021429270 + .long 1628994560 + .long 1068672055 + .long 2411391464 + .long 1021057980 + .long 2159763712 + .long 1068688483 + .long 1208692749 + .long 1021943903 + .long 3503886336 + .long 1068704912 + .long 538793309 + .long 1019744063 + .long 1435187200 + .long 1068721343 + .long 4085087612 + .long 1020608419 + .long 317469952 + .long 1068737775 + .long 144386942 + .long 1021440732 + .long 219617280 + .long 1068754208 + .long 2940088361 + .long 1019981122 + .long 1210558208 + .long 1068770642 + .long 2176850347 + .long 1018373705 + .long 3359268352 + .long 1068787077 + .long 2395611454 + .long 1021889042 + .long 2439803648 + .long 1068803514 + .long 1650705253 + .long 1020227966 + .long 2816203520 + .long 1068819952 + .long 3702166386 + .long 1019379914 + .long 262620672 + .long 1068836392 + .long 1855649370 + .long 1020453124 + .long 3438159616 + .long 1068852832 + .long 923063860 + .long 1019273834 + .long 3822105856 + .long 1068869274 + .long 4289947947 + .long 1019434249 + .long 1483729920 + .long 1068885718 + .long 787455814 + .long 1020738379 + .long 787321088 + .long 1068902163 + .long 3321653337 + .long 1021842569 + .long 1802253312 + .long 1068918609 + .long 2653633526 + .long 1021821525 + .long 302985984 + .long 1068935057 + .long 161272028 + .long 1021655149 + .long 653966080 + .long 1068951506 + .long 2566098667 + .long 1020066219 + .long 2924727296 + .long 1068967956 + .long 3646493722 + .long 1014292285 + .long 2889890304 + .long 1068984408 + .long 1081009196 + .long 1022189620 + .long 619098112 + .long 1069000862 + .long 4011643355 + .long 1021773297 + .long 477017600 + .long 1069017317 + .long 4030305534 + .long 1021292252 + .long 2533403904 + .long 1069033773 + .long 2645187591 + .long 1019527099 + .long 2563102208 + .long 1069050231 + .long 3857293792 + .long 1022311697 + .long 635982336 + .long 1069066691 + .long 3625936637 + .long 1017511744 + .long 1116940800 + .long 1069083152 + .long 3653872993 + .long 1022016631 + .long 4075964160 + .long 1069099614 + .long 2468900271 + .long 1021769532 + .long 993165568 + .long 1069116079 + .long 1358104224 + .long 1021199776 + .long 528586752 + .long 1069132545 + .long 2200950332 + .long 1022024872 + .long 2752395776 + .long 1069149012 + .long 3197072454 + .long 1017751319 + .long 3439855616 + .long 1069165481 + .long 1651081806 + .long 1020809338 + .long 2661257728 + .long 1069181952 + .long 539032752 + .long 1021728805 + .long 486957312 + .long 1069198425 + .long 3136045149 + .long 1016888671 + .long 1282340352 + .long 1069214899 + .long 2593963259 + .long 1018956103 + .long 822921728 + .long 1069231375 + .long 2146032737 + .long 1022306465 + .long 3474216192 + .long 1069247852 + .long 3976811625 + .long 1021350207 + .long 716902656 + .long 1069264332 + .long 718267222 + .long 1018624727 + .long 1211594496 + .long 1069280813 + .long 1485641389 + .long 1018447451 + .long 734070272 + .long 1069297296 + .long 354455128 + .long 1021341291 + .long 3650110720 + .long 1069313780 + .long 682185947 + .long 1021651853 + .long 1440663040 + .long 1069330267 + .long 3558574550 + .long 1021615110 + .long 2766612224 + .long 1069346755 + .long 874607978 + .long 1017746872 + .long 3404011008 + .long 1069363245 + .long 4154988502 + .long 1021439906 + .long 3423949056 + .long 1069379737 + .long 2263202309 + .long 1021479615 + .long 2897587712 + .long 1069396231 + .long 2562065031 + .long 1022090363 + .long 1896159232 + .long 1069412727 + .long 3836237663 + .long 1019867288 + .long 490968576 + .long 1069429225 + .long 3322056743 + .long 1006752762 + .long 3048360192 + .long 1069445724 + .long 1152314833 + .long 1013122252 + .long 1049850624 + .long 1069462226 + .long 3601590727 + .long 1022214610 + .long 3156899584 + .long 1069478729 + .long 1855169970 + .long 1019487271 + .long 851173376 + .long 1069495235 + .long 312649594 + .long 1020868604 + .long 2794281728 + .long 1069511742 + .long 1093490181 + .long 1020777577 + .long 468042496 + .long 1069528252 + .long 1152540679 + .long 1021403732 + .long 2534219264 + .long 1069544763 + .long 2292126035 + .long 1021872430 + .long 1376146432 + .long 1069558527 + .long 3293753641 + .long 1020500454 + .long 4175442432 + .long 1069575044 + .long 3626347564 + .long 1021610969 + .long 3523113472 + .long 1069591566 + .long 339956500 + .long 1021119039 + .long 4003350528 + .long 1069608092 + .long 3429333082 + .long 1022813542 + .long 1611067392 + .long 1069624623 + .long 2298017544 + .long 1021977587 + .long 931782144 + .long 1069641158 + .long 2164684743 + .long 1021250988 + .long 2256725504 + .long 1069657697 + .long 1138762335 + .long 1021443776 + .long 1582853120 + .long 1069674241 + .long 1084010382 + .long 1022994693 + .long 3497758720 + .long 1069690789 + .long 406366244 + .long 1022713586 + .long 3999816960 + .long 1069707342 + .long 1488723042 + .long 1023381290 + .long 3383096064 + .long 1069723900 + .long 2541558953 + .long 1019137887 + .long 1942403584 + .long 1069740463 + .long 1879620343 + .long 1022653642 + .long 4268263680 + .long 1069757030 + .long 3039077047 + .long 1022252545 + .long 2067062272 + .long 1069773603 + .long 4190670677 + .long 1020725863 + .long 4225828096 + .long 1069790180 + .long 1998567321 + .long 1022014385 + .long 2452507136 + .long 1069806763 + .long 1511628873 + .long 1021900300 + .long 1340746240 + .long 1069823351 + .long 788367341 + .long 1022726208 + .long 1190035456 + .long 1069839944 + .long 3856337230 + .long 1021834118 + .long 2300688384 + .long 1069856542 + .long 3211396579 + .long 1022621365 + .long 678886400 + .long 1069873146 + .long 4001011887 + .long 1022042646 + .long 921594112 + .long 1069889755 + .long 557811968 + .long 1023065533 + .long 3331668992 + .long 1069906369 + .long 1877060679 + .long 1022419742 + .long 3917875200 + .long 1069922989 + .long 1181055171 + .long 1022752712 + .long 2984829696 + .long 1069939615 + .long 4294526932 + .long 1021499988 + .long 838049024 + .long 1069956247 + .long 3658081878 + .long 1022957952 + .long 2078928384 + .long 1069972884 + .long 820353701 + .long 1019391107 + .long 2719854336 + .long 1069989527 + .long 1644022489 + .long 1023378240 + .long 3069117696 + .long 1070006176 + .long 2771393702 + .long 1019319954 + .long 3435962368 + .long 1070022831 + .long 3876394145 + .long 1023024433 + .long 4130595328 + .long 1070039492 + .long 1630447748 + .long 1021465882 + .long 1169236224 + .long 1070056160 + .long 2828355997 + .long 1020458120 + .long 3453997312 + .long 1070072833 + .long 164091641 + .long 1020388279 + .long 2708127744 + .long 1070089513 + .long 3036550223 + .long 1023328684 + .long 3540797696 + .long 1070106199 + .long 3710949463 + .long 1022568805 + .long 1972276736 + .long 1070122892 + .long 3885277950 + .long 1019761674 + .long 2613815552 + .long 1070139591 + .long 2764165077 + .long 1022921023 + .long 1487791616 + .long 1070156297 + .long 1330644769 + .long 1023162679 + .long 3207593472 + .long 1070173009 + .long 3911007221 + .long 1022993496 + .long 3797764608 + .long 1070189728 + .long 979712598 + .long 1022554580 + .long 3578920448 + .long 1070206454 + .long 2825738223 + .long 1020223708 + .long 2872795648 + .long 1070223187 + .long 392451124 + .long 1022666279 + .long 2002258432 + .long 1070239927 + .long 3730407632 + .long 1023148291 + .long 1291326464 + .long 1070256674 + .long 3723802980 + .long 1022514089 + .long 1065180928 + .long 1070273428 + .long 2635617463 + .long 1022654470 + .long 1650181632 + .long 1070290189 + .long 2061982883 + .long 1022853411 + .long 3373882880 + .long 1070306957 + .long 319732785 + .long 1022017175 + .long 2270081280 + .long 1070323733 + .long 2237757411 + .long 1023064087 + .long 2963732736 + .long 1070340516 + .long 468839165 + .long 1023293774 + .long 1491099904 + .long 1070357307 + .long 1502657946 + .long 1021533479 + .long 2479636480 + .long 1070374105 + .long 482913562 + .long 1021986286 + .long 1968133632 + .long 1070390911 + .long 3281474337 + .long 1022646400 + .long 291639040 + .long 1070407725 + .long 2453320259 + .long 1022812423 + .long 2081472512 + .long 1070424546 + .long 2939989570 + .long 1023091888 + .long 3380340480 + .long 1070441375 + .long 2850707499 + .long 1021921109 + .long 232287488 + .long 1070458213 + .long 3674625342 + .long 1020725130 + .long 1567614208 + .long 1070475058 + .long 9347334 + .long 1022024009 + .long 3433091072 + .long 1070491911 + .long 282524999 + .long 1021433523 + .long 1876877312 + .long 1070508773 + .long 3470449440 + .long 1019309721 + .long 1538472192 + .long 1070525643 + .long 2089486825 + .long 1019698916 + .long 2763830784 + .long 1070542521 + .long 443498115 + .long 1020505194 + .long 1605381632 + .long 1070559408 + .long 3018871601 + .long 1022869913 + .long 2706946048 + .long 1070576303 + .long 3936260892 + .long 1023175875 + .long 2123887360 + .long 1070593207 + .long 2994220655 + .long 1022825948 + .long 104015104 + .long 1070603108 + .long 335054493 + .long 1023441853 + .long 2904568832 + .long 1070615800 + .long 1451215633 + .long 1023853857 + .long 3456197120 + .long 1070632739 + .long 436334733 + .long 1024026432 + .long 252452352 + .long 1070649697 + .long 34596167 + .long 1024031396 + .long 3328018432 + .long 1070666672 + .long 2644547073 + .long 1024296758 + .long 1255829248 + .long 1070683667 + .long 552832586 + .long 1023763122 + .long 4097058560 + .long 1070700680 + .long 1955640623 + .long 1021394654 + .long 451770112 + .long 1070717714 + .long 3428903777 + .long 1022941142 + .long 408920832 + .long 1070734767 + .long 165503263 + .long 1023894958 + .long 1186960640 + .long 1070751840 + .long 435826450 + .long 1024026134 + .long 19078656 + .long 1070768934 + .long 1834169749 + .long 1022899284 + .long 2743490304 + .long 1070786048 + .long 494581074 + .long 1018818479 + .long 2328961024 + .long 1070803184 + .long 2987908834 + .long 1022581110 + .long 350011392 + .long 1070820342 + .long 240771184 + .long 1024143083 + .long 2692326912 + .long 1070837521 + .long 666056837 + .long 1022394776 + .long 2373274368 + .long 1070854723 + .long 2484337770 + .long 1024228156 + .long 1017131520 + .long 1070871948 + .long 3285648279 + .long 1024025789 + .long 265558272 + .long 1070889196 + .long 392241896 + .long 1024252809 + .long 1778008064 + .long 1070906467 + .long 1536107943 + .long 1023949300 + .long 2937184768 + .long 1070923762 + .long 3541062251 + .long 1019448646 + .long 1144442880 + .long 1070941082 + .long 3691683781 + .long 1022123948 + .long 2410165504 + .long 1070958426 + .long 1804181960 + .long 1023945221 + .long 4174350848 + .long 1070975795 + .long 2016094861 + .long 1021716585 + .long 3897012480 + .long 1070993190 + .long 175294410 + .long 1023703404 + .long 3353623040 + .long 1071010611 + .long 167973242 + .long 1023240839 + .long 45671168 + .long 1071028059 + .long 2166856113 + .long 1021565413 + .long 86063872 + .long 1071045533 + .long 2676254727 + .long 1023985299 + .long 1019772672 + .long 1071063034 + .long 989043593 + .long 1021549587 + .long 414297344 + .long 1071080563 + .long 3960972046 + .long 1024307251 + .long 155173120 + .long 1071098120 + .long 1830919291 + .long 1021592251 + .long 2151562240 + .long 1071115705 + .long 405408666 + .long 1023423128 + .long 4041854720 + .long 1071133319 + .long 2043497827 + .long 1024411503 + .long 3489224192 + .long 1071150963 + .long 3072215864 + .long 1022698635 + .long 2477196288 + .long 1071168637 + .long 1812195139 + .long 1022689192 + .long 3015298816 + .long 1071186341 + .long 764841969 + .long 1021027331 + .long 2844731136 + .long 1071204076 + .long 2878117321 + .long 1019116513 + .long 4028950528 + .long 1071221842 + .long 698911452 + .long 1023265602 + .long 69441536 + .long 1071239641 + .long 3253467847 + .long 1020795075 + .long 1676209920 + .long 1071257471 + .long 4272431167 + .long 1022873982 + .long 2408752384 + .long 1071275334 + .long 648519100 + .long 1024385717 + .long 151623680 + .long 1071293231 + .long 345257017 + .long 1019561408 + .long 1410154240 + .long 1071311161 + .long 197863993 + .long 1023224207 + .long 4131351552 + .long 1071329125 + .long 2620801789 + .long 1024411169 + .long 1999664384 + .long 1071347125 + .long 3952692616 + .long 1024168086 + .long 1617668864 + .long 1071365160 + .long 3019889809 + .long 1021907692 + .long 1032074240 + .long 1071383231 + .long 59469899 + .long 1023656194 + .long 2619492096 + .long 1071401338 + .long 1417526820 + .long 1021457783 + .long 202429440 + .long 1071419483 + .long 2927667935 + .long 1019175447 + .long 525044224 + .long 1071437665 + .long 38166811 + .long 1023981879 + .long 1779258880 + .long 1071455885 + .long 481252500 + .long 1023310234 + .long 2195673600 + .long 1071474144 + .long 3962395981 + .long 1021339088 + .long 44573696 + .long 1071492443 + .long 3936281395 + .long 1023014829 + .long 2226905344 + .long 1071510781 + .long 1515320476 + .long 1024320623 + .long 2800512512 + .long 1071529160 + .long 1225403697 + .long 1021081846 + .long 161113600 + .long 1071547581 + .long 3064809733 + .long 1024173917 + .long 1338410240 + .long 1071566043 + .long 2027604973 + .long 1024362526 + .long 522433280 + .long 1071584548 + .long 2055171723 + .long 1023858825 + .long 539595776 + .long 1071603096 + .long 3868820135 + .long 1022936424 + .long 4264017664 + .long 1071621687 + .long 3228065145 + .long 1023479578 + .long 1733924096 + .long 1071640324 + .long 3511934475 + .long 1022496355 + .long 108880384 + .long 1071651839 + .long 615880967 + .long 1023519706 + .long 3517856512 + .long 1071661202 + .long 3113108559 + .long 1025190289 + .long 4043153152 + .long 1071670589 + .long 1571836218 + .long 1023106116 + .long 3251299072 + .long 1071680000 + .long 3444076102 + .long 1022187841 + .long 2736921600 + .long 1071689435 + .long 272771483 + .long 1025095280 + .long 3897698560 + .long 1071703633 + .long 2075390188 + .long 1022489022 + .long 3209485056 + .long 1071722652 + .long 1438094065 + .long 1021844944 + .long 3781432064 + .long 1071741774 + .long 1675017145 + .long 1024143828 + .long 2684184064 + .long 1071761003 + .long 2259963753 + .long 1024731393 + .long 1840489728 + .long 1071780342 + .long 3372883597 + .long 1023431408 + .long 3764087808 + .long 1071799794 + .long 3307523102 + .long 1024485788 + .long 3006232320 + .long 1071819364 + .long 3088971966 + .long 1025213251 + .long 3374881280 + .long 1071839055 + .long 834437749 + .long 1025236452 + .long 797284864 + .long 1071858872 + .long 3122663941 + .long 1025320473 + .long 545765120 + .long 1071878818 + .long 826539625 + .long 1022450955 + .long 107562240 + .long 1071898898 + .long 339584600 + .long 1022481255 + .long 2123649024 + .long 1071919116 + .long 3912959833 + .long 1024321009 + .long 1562385664 + .long 1071939478 + .long 2846067230 + .long 1023343981 + .long 2963085824 + .long 1071959988 + .long 954548627 + .long 1021475211 + .long 3325550592 + .long 1071980652 + .long 3459651155 + .long 1025305573 + .long 775752448 + .long 1072001476 + .long 3582746667 + .long 1023859460 + .long 3238590720 + .long 1072022464 + .long 634636162 + .long 1024472353 + .long 2758801920 + .long 1072043624 + .long 3078216319 + .long 1025304516 + .long 1370319104 + .long 1072064962 + .long 2570569078 + .long 1025099442 + .long 2615805184 + .long 1072086484 + .long 3729933412 + .long 1024605112 + .long 3077336576 + .long 1072108198 + .long 1948916066 + .long 1024781603 + .long 1099528192 + .long 1072130112 + .long 3139143157 + .long 1023729360 + .long 1231903232 + .long 1072152233 + .long 1349513477 + .long 1024737515 + .long 1507504128 + .long 1072174570 + .long 3484516322 + .long 1024000959 + .long 2214659840 + .long 1072197132 + .long 2563820917 + .long 1025225535 + .long 1804739840 + .long 1072219929 + .long 760038746 + .long 1024482855 + .long 1413746688 + .long 1072242971 + .long 3401734714 + .long 1025129838 + .long 821409536 + .long 1072266269 + .long 3729772551 + .long 1025484796 + .long 3031825664 + .long 1072289834 + .long 122256749 + .long 1024752594 + .long 1710784256 + .long 1072313680 + .long 1518205483 + .long 1024724809 + .long 3025265152 + .long 1072337819 + .long 409951989 + .long 1022835555 + .long 287769088 + .long 1072362267 + .long 800355594 + .long 1022484850 + .long 198179840 + .long 1072387038 + .long 3502926213 + .long 1024209373 + .long 1909130496 + .long 1072412149 + .long 3064694319 + .long 1025380823 + .long 1941732096 + .long 1072437619 + .long 4112930390 + .long 1024294679 + .long 3492010496 + .long 1072463467 + .long 2684918107 + .long 1023220233 + .long 81959680 + .long 1072489716 + .long 220021366 + .long 1020635131 + .long 2297837056 + .long 1072516387 + .long 4027683826 + .long 1021041185 + .long 270404096 + .long 1072543508 + .long 2012766065 + .long 1021780753 + .long 3667376896 + .long 1072571105 + .long 2727981522 + .long 1023009874 + .long 330400256 + .long 1072599212 + .long 2940017003 + .long 1025393439 + .long 1119293952 + .long 1072627861 + .long 1608550416 + .long 1022675612 + .long 3536155904 + .long 1072657091 + .long 349665778 + .long 1025156751 + .long 3078046720 + .long 1072686946 + .long 2016159996 + .long 1022193169 + .long 455228416 + .long 1072705361 + .long 1908539328 + .long 1026126332 + .long 1871505664 + .long 1072720988 + .long 2784700894 + .long 1025922277 + .long 1630994432 + .long 1072737010 + .long 361107678 + .long 1022887244 + .long 2084558336 + .long 1072753462 + .long 2642784509 + .long 1072689083 + .long 1514442531 + .long 1072688953 + .long 333108933 + .long 1072688821 + .long 3392112024 + .long 1072688686 + .long 2099852862 + .long 1072688550 + .long 749609004 + .long 1072688412 + .long 3634632596 + .long 1072688271 + .long 2163248461 + .long 1072688129 + .long 628657846 + .long 1072687985 + .long 3324036511 + .long 1072687838 + .long 1657632815 + .long 1072687690 + .long 4217538760 + .long 1072687539 + .long 2411951597 + .long 1072687387 + .long 533944872 + .long 1072687233 + .long 2876566508 + .long 1072687076 + .long 847936891 + .long 1072686918 + .long 3036019913 + .long 1072686757 + .long 848884575 + .long 1072686595 + .long 2874443326 + .long 1072686430 + .long 520713666 + .long 1072686264 + .long 2375556481 + .long 1072686095 + .long 4141904948 + .long 1072685924 + .long 1522666382 + .long 1072685752 + .long 3105624104 + .long 1072685577 + .long 298666327 + .long 1072685401 + .long 1689524500 + .long 1072685222 + .long 2981002200 + .long 1072685041 + .long 4170844284 + .long 1072684858 + .long 961802263 + .long 1072684674 + .long 1941503454 + .long 1072684487 + .long 2812647170 + .long 1072684298 + .long 3572873869 + .long 1072684107 + .long 4219797823 + .long 1072683914 + .long 456039788 + .long 1072683720 + .long 869096151 + .long 1072683523 + .long 1161535119 + .long 1072683324 + .long 1330865866 + .long 1072683123 + .long 1374571204 + .long 1072682920 + .long 1290107538 + .long 1072682715 + .long 1074904836 + .long 1072682508 + .long 726366587 + .long 1072682299 + .long 241869763 + .long 1072682088 + .long 3913732079 + .long 1072681874 + .long 3149342765 + .long 1072681659 + .long 2240966306 + .long 1072681442 + .long 1185873216 + .long 1072681223 + .long 4276274591 + .long 1072681001 + .long 2919452883 + .long 1072680778 + .long 1407565635 + .long 1072680553 + .long 4032743551 + .long 1072680325 + .long 2202188565 + .long 1072680096 + .long 207977577 + .long 1072679865 + .long 2342160518 + .long 1072679631 + .long 11858423 + .long 1072679396 + .long 1804034453 + .long 1072679158 + .long 3420722787 + .long 1072678918 + .long 563930456 + .long 1072678677 + .long 1820539192 + .long 1072678433 + .long 2892501606 + .long 1072678187 + .long 3776710320 + .long 1072677939 + .long 175063337 + .long 1072677690 + .long 674333171 + .long 1072677438 + .long 976363026 + .long 1072677184 + .long 1077935934 + .long 1072676928 + .long 1921075490 + .long 1072676540 + .long 881493302 + .long 1072676016 + .long 3275752439 + .long 1072675483 + .long 486855588 + .long 1072674943 + .long 1077229111 + .long 1072674394 + .long 723950308 + .long 1072673837 + .long 3693582199 + .long 1072673271 + .long 1367335316 + .long 1072672698 + .long 2305837020 + .long 1072672116 + .long 2184358641 + .long 1072671526 + .long 972682840 + .long 1072670928 + .long 2935101762 + .long 1072670321 + .long 3745513263 + .long 1072669706 + .long 3372320886 + .long 1072669083 + .long 1783464620 + .long 1072668452 + .long 3241386215 + .long 1072667812 + .long 3418125284 + .long 1072667164 + .long 2280219148 + .long 1072666508 + .long 4088700758 + .long 1072665843 + .long 219227400 + .long 1072665171 + .long 3521816918 + .long 1072664489 + .long 1076205279 + .long 1072663800 + .long 1436484616 + .long 1072663102 + .long 271362610 + .long 1072662396 + .long 1838996688 + .long 1072661681 + .long 1807122518 + .long 1072660958 + .long 137953542 + .long 1072660227 + .long 1088178584 + .long 1072659487 + .long 324057537 + .long 1072658739 + .long 2101288076 + .long 1072657982 + .long 2085133974 + .long 1072657217 + .long 235324451 + .long 1072656444 + .long 806051592 + .long 1072655662 + .long 3756033140 + .long 1072654871 + .long 453542543 + .long 1072654073 + .long 3741177327 + .long 1072653265 + .long 691216109 + .long 1072652450 + .long 4145223372 + .long 1072651625 + .long 1174439091 + .long 1072650793 + .long 324416139 + .long 1072649952 + .long 1550246310 + .long 1072649102 + .long 511524674 + .long 1072648244 + .long 1457248482 + .long 1072647377 + .long 45944955 + .long 1072646502 + .long 525537397 + .long 1072645618 + .long 2848440188 + .long 1072644725 + .long 2671555633 + .long 1072643824 + .long 4241172637 + .long 1072642914 + .long 3213094278 + .long 1072641996 + .long 3832503688 + .long 1072641069 + .long 1754091534 + .long 1072640134 + .long 1221921804 + .long 1072639190 + .long 2184526489 + .long 1072638237 + .long 294902089 + .long 1072637276 + .long 4090375270 + .long 1072636305 + .long 632860906 + .long 1072635327 + .long 2753498702 + .long 1072634339 + .long 1808009252 + .long 1072633343 + .long 2036428672 + .long 1072632338 + .long 3383235626 + .long 1072631324 + .long 1497347484 + .long 1072630302 + .long 617018317 + .long 1072629271 + .long 684933058 + .long 1072628231 + .long 1643170798 + .long 1072627182 + .long 3011066360 + .long 1072625592 + .long 957158713 + .long 1072623442 + .long 1390907941 + .long 1072621256 + .long 3819155270 + .long 1072619034 + .long 3443571196 + .long 1072616777 + .long 4045412458 + .long 1072614484 + .long 805503923 + .long 1072612156 + .long 1778922015 + .long 1072609791 + .long 2125033665 + .long 1072607390 + .long 1287203863 + .long 1072604953 + .long 2992629568 + .long 1072602479 + .long 2367267127 + .long 1072599969 + .long 3115526047 + .long 1072597422 + .long 340219539 + .long 1072594839 + .long 2017215719 + .long 1072592218 + .long 3225443424 + .long 1072589560 + .long 3326565673 + .long 1072586865 + .long 1669811211 + .long 1072584133 + .long 1886735022 + .long 1072581363 + .long 3301071171 + .long 1072578555 + .long 928514283 + .long 1072575710 + .long 2656364059 + .long 1072572826 + .long 3473490507 + .long 1072569904 + .long 2649965606 + .long 1072566944 + .long 3736819052 + .long 1072563945 + .long 1680885175 + .long 1072560908 + .long 4413771 + .long 1072557832 + .long 2214869753 + .long 1072554716 + .long 3214725184 + .long 1072551561 + .long 2186079903 + .long 1072548367 + .long 2590372131 + .long 1072545133 + .long 3578146079 + .long 1072541859 + .long 4283712755 + .long 1072538545 + .long 3824834510 + .long 1072535191 + .long 1302400298 + .long 1072531797 + .long 95058636 + .long 1072528362 + .long 3563906063 + .long 1072524885 + .long 2167230730 + .long 1072521368 + .long 3524918334 + .long 1072517809 + .long 2353304918 + .long 1072514209 + .long 1939625839 + .long 1072510567 + .long 1256714581 + .long 1072506883 + .long 3552525848 + .long 1072503156 + .long 3464809522 + .long 1072499387 + .long 4200542593 + .long 1072495575 + .long 355609124 + .long 1072491721 + .long 3684139099 + .long 1072487822 + .long 148355918 + .long 1072483881 + .long 1457689242 + .long 1072479895 + .long 2118591596 + .long 1072475865 + .long 908848089 + .long 1072471791 + .long 877032689 + .long 1072467672 + .long 752012304 + .long 1072463508 + .long 3532301749 + .long 1072459298 + .long 3600563221 + .long 1072455043 + .long 3902857084 + .long 1072450742 + .long 3063101036 + .long 1072446395 + .long 3972344374 + .long 1072442001 + .long 903183549 + .long 1072437561 + .long 983892938 + .long 1072433073 + .long 2722858568 + .long 1072428537 + .long 302790515 + .long 1072423954 + .long 759811057 + .long 1072419322 + .long 2507809922 + .long 1072414641 + .long 2388408813 + .long 1072407528 + .long 2084492942 + .long 1072397870 + .long 2435703301 + .long 1072388010 + .long 1935433360 + .long 1072377945 + .long 2742047290 + .long 1072367671 + .long 2053284205 + .long 1072357185 + .long 657783367 + .long 1072346483 + .long 2893664841 + .long 1072335560 + .long 3718906405 + .long 1072324413 + .long 1547896303 + .long 1072313038 + .long 2494058440 + .long 1072301429 + .long 3133238742 + .long 1072289582 + .long 3327000086 + .long 1072277492 + .long 1860667274 + .long 1072265154 + .long 665340747 + .long 1072252562 + .long 443347841 + .long 1072239710 + .long 581282618 + .long 1072226592 + .long 3349780465 + .long 1072213201 + .long 914217606 + .long 1072199532 + .long 989797661 + .long 1072185576 + .long 945436416 + .long 1072171326 + .long 549291300 + .long 1072156774 + .long 1814636389 + .long 1072141911 + .long 239092858 + .long 1072126729 + .long 1794680724 + .long 1072111217 + .long 1241534678 + .long 1072095366 + .long 3366566214 + .long 1072079164 + .long 1244090828 + .long 1072062601 + .long 1708448120 + .long 1072045663 + .long 3544260650 + .long 1072028337 + .long 1402741403 + .long 1072010610 + .long 2551936888 + .long 1071992465 + .long 617669739 + .long 1071973887 + .long 794002186 + .long 1071954857 + .long 2021237693 + .long 1071935356 + .long 540450384 + .long 1071915364 + .long 1920555537 + .long 1071894857 + .long 2879585206 + .long 1071873811 + .long 3000237455 + .long 1071852199 + .long 3352974346 + .long 1071829991 + .long 569629937 + .long 1071807155 + .long 2077237208 + .long 1071783653 + .long 2284891805 + .long 1071759446 + .long 1226651784 + .long 1071734489 + .long 1102047405 + .long 1071708731 + .long 2009896384 + .long 1071682115 + .long 927419082 + .long 1071654577 + .long 85010366 + .long 1071607413 + .long 696431025 + .long 1071548180 + .long 2611410541 + .long 1071486585 + .long 2612593658 + .long 1071422396 + .long 3548155306 + .long 1071355336 + .long 3887997484 + .long 1071285073 + .long 244854763 + .long 1071211202 + .long 4214445648 + .long 1071133216 + .long 2303966727 + .long 1071050478 + .long 3991040013 + .long 1070962152 + .long 3126952278 + .long 1070867118 + .long 1817448378 + .long 1070763804 + .long 1793814864 + .long 1070649884 + .long 3507224072 + .long 1070447193 + .long 4027609105 + .long 1070148772 + .long 577507993 + .long 1069779414 + .long 2310232419 + .long 1068931829 + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 3164710438 + .long 1413754136 + .long 3221823995 + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 1074340347 + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .long 0 + .long 0 + .long 1431655765 + .long 3217380693 + .long 858993459 + .long 3216192307 + .long 3067833783 + .long 3215383405 + .long 780903145 + .long 1066854586 + .long 858993459 + .long 1068708659 + .long 3340530119 + .long 1067392113 + .long 1431655765 + .long 1069897045 + .long 1321528399 + .long 1066517740 + .long 3067833783 + .long 1067899757 + .long 2021159460 + .long 1065855096 + .long 2576980378 + .long 1066178969 + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 4294950912 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,6112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/acosf_wmt.S b/external/sgx_libm/ia32/acosf_wmt.S new file mode 100644 index 0000000000..b2e8659e00 --- /dev/null +++ b/external/sgx_libm/ia32/acosf_wmt.S @@ -0,0 +1,551 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acosf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin acosf + .text + .align 16,0x90 + .globl acosf +acosf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %eax + cvtps2pd %xmm0, %xmm1 + movsd 1040(%ebx), %xmm3 + movl $2147483647, %ecx + andl %eax, %ecx + subl $1015021568, %ecx + cmpl $49283072, %ecx + jae .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + movl $8388608, %edx + mulsd %xmm1, %xmm1 + cvtps2pd %xmm0, %xmm2 + shrl $23, %ecx + addl $1, %ecx + shrl %cl, %edx + subsd %xmm1, %xmm3 + orl %edx, %eax + negl %edx + andl %edx, %eax + movd %eax, %xmm4 + sqrtsd %xmm3, %xmm3 + addl %edx, %edx + andl $16777215, %edx + andl %edx, %eax + negl %ecx + addl $24, %ecx + orl $8388608, %eax + shrl %cl, %eax + addl %eax, %eax + movsd (%ebx,%eax,8), %xmm5 + psrlq $31, %xmm0 + movsd 8(%ebx,%eax,8), %xmm1 + psllq $63, %xmm0 + cvtps2pd %xmm4, %xmm4 + mulsd %xmm5, %xmm2 + orpd %xmm1, %xmm0 + movsd 1056(%ebx), %xmm5 + movsd 1072(%ebx), %xmm1 + mulsd %xmm3, %xmm4 + movsd 1088(%ebx), %xmm3 + subsd %xmm4, %xmm2 + pshufd $68, %xmm2, %xmm4 + mulsd %xmm2, %xmm2 + subsd 1024(%ebx), %xmm0 + mulsd %xmm4, %xmm5 + mulsd %xmm4, %xmm1 + mulsd %xmm4, %xmm3 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + subsd %xmm3, %xmm5 + addsd %xmm1, %xmm4 + mulsd %xmm5, %xmm2 + addsd %xmm4, %xmm0 + subsd %xmm0, %xmm2 + movsd %xmm2, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + jge .L_2TAG_PACKET_3.0.3 + addl $1015021568, %ecx + cmpl $964689920, %ecx + jb .L_2TAG_PACKET_4.0.3 + movsd 1072(%ebx), %xmm2 + movapd %xmm1, %xmm0 + movsd 1024(%ebx), %xmm3 + mulsd %xmm1, %xmm1 + mulsd %xmm1, %xmm2 + mulsd %xmm0, %xmm2 + subsd %xmm0, %xmm3 + subsd %xmm2, %xmm3 + cvtsd2ss %xmm3, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + movsd 1024(%ebx), %xmm2 + subsd %xmm1, %xmm2 + cvtsd2ss %xmm2, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + movl %eax, %edx + addl %edx, %edx + cmpl $2130706432, %edx + jb .L_2TAG_PACKET_5.0.3 + jne .L_2TAG_PACKET_6.0.3 + shrl $31, %eax + movsd 1136(%ebx,%eax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_5.0.3: + cmpl $0, %eax + jl .L_2TAG_PACKET_1.0.3 + xorpd %xmm2, %xmm2 + movl $16352, %eax + pinsrw $3, %eax, %xmm2 + subsd %xmm1, %xmm3 + mulsd %xmm2, %xmm3 + sqrtsd %xmm3, %xmm3 + movsd 1120(%ebx), %xmm4 + movsd 1056(%ebx), %xmm5 + movsd 1072(%ebx), %xmm0 + movsd 1088(%ebx), %xmm1 + pshufd $68, %xmm3, %xmm2 + mulsd %xmm3, %xmm3 + addpd %xmm2, %xmm2 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm1 + mulsd %xmm3, %xmm2 + mulsd %xmm3, %xmm3 + subsd %xmm5, %xmm4 + addsd %xmm0, %xmm1 + mulsd %xmm3, %xmm4 + addsd %xmm1, %xmm4 + mulsd %xmm2, %xmm4 + pshufd $238, %xmm2, %xmm2 + addsd %xmm4, %xmm2 + cvtpd2ps %xmm2, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + cmpl $-16777216, %edx + ja .L_2TAG_PACKET_7.0.3 + xorps %xmm0, %xmm0 + movl $2139095040, %edx + movd %edx, %xmm1 + mulss %xmm1, %xmm0 + movss %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $62, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_7.0.3: + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_2.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type acosf,@function + .size acosf,.-acosf + .data +# -- End acosf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4290772864 + .long 1072693183 + .long 2864569868 + .long 1065353226 + .long 3955135328 + .long 1072692671 + .long 152932388 + .long 1066926224 + .long 1671525387 + .long 1072691647 + .long 2415589551 + .long 1067712845 + .long 2799290704 + .long 1072690109 + .long 3864800403 + .long 1068237715 + .long 2477707161 + .long 1072688057 + .long 725093587 + .long 1068630990 + .long 2787892653 + .long 1072685489 + .long 2536557765 + .long 1068893940 + .long 4138691444 + .long 1072682403 + .long 62552236 + .long 1069157247 + .long 941089134 + .long 1072678798 + .long 165833141 + .long 1069420976 + .long 3045724825 + .long 1072674669 + .long 2611259588 + .long 1069616357 + .long 1338788729 + .long 1072670015 + .long 2616012614 + .long 1069748746 + .long 2049955026 + .long 1072664831 + .long 11397492 + .long 1069881450 + .long 922854000 + .long 1072659114 + .long 2157235516 + .long 1070014503 + .long 326738075 + .long 1072652859 + .long 2788743992 + .long 1070147943 + .long 589211462 + .long 1072646061 + .long 3920198733 + .long 1070281807 + .long 4203970809 + .long 1072638714 + .long 3416546056 + .long 1070416134 + .long 2847908959 + .long 1072630814 + .long 4071425947 + .long 1070550963 + .long 3041144817 + .long 1072622353 + .long 623140044 + .long 1070641216 + .long 254499552 + .long 1072613325 + .long 307519074 + .long 1070709195 + .long 247322296 + .long 1072603721 + .long 2945179265 + .long 1070777488 + .long 1734768715 + .long 1072593533 + .long 3301227932 + .long 1070846119 + .long 512284341 + .long 1072582753 + .long 148694291 + .long 1070915112 + .long 2150320922 + .long 1072571370 + .long 959165711 + .long 1070984490 + .long 307214965 + .long 1072559375 + .long 862254873 + .long 1071054280 + .long 2261822985 + .long 1072546755 + .long 303820077 + .long 1071124509 + .long 2878424532 + .long 1072533499 + .long 1279667396 + .long 1071195205 + .long 1489389340 + .long 1072519594 + .long 3626865975 + .long 1071266398 + .long 1561634021 + .long 1072505025 + .long 1381197995 + .long 1071338121 + .long 1731593006 + .long 1072489777 + .long 685577004 + .long 1071410406 + .long 3972360633 + .long 1072473833 + .long 3426639945 + .long 1071483288 + .long 231016948 + .long 1072457177 + .long 3858097791 + .long 1071556806 + .long 1951983052 + .long 1072439787 + .long 2522397359 + .long 1071631000 + .long 806900869 + .long 1072421644 + .long 1565390008 + .long 1071675292 + .long 2352519275 + .long 1072402724 + .long 2655228975 + .long 1071713130 + .long 3752547712 + .long 1072383003 + .long 3066292715 + .long 1071751375 + .long 1444584515 + .long 1072362455 + .long 933027783 + .long 1071790054 + .long 2960036461 + .long 1072341049 + .long 3589869088 + .long 1071829194 + .long 4214933698 + .long 1072318754 + .long 2973206241 + .long 1071868828 + .long 957213757 + .long 1072295536 + .long 2756129430 + .long 1071908989 + .long 4263431727 + .long 1072271354 + .long 2767348050 + .long 1071949714 + .long 4197201246 + .long 1072246168 + .long 874994578 + .long 1071991044 + .long 1821133236 + .long 1072219931 + .long 3810301671 + .long 1072033022 + .long 2102004657 + .long 1072192590 + .long 4064603671 + .long 1072075699 + .long 1957725919 + .long 1072164088 + .long 276553332 + .long 1072119130 + .long 3365782140 + .long 1072134360 + .long 1120469626 + .long 1072163374 + .long 4096932877 + .long 1072103334 + .long 4291572900 + .long 1072208500 + .long 177757517 + .long 1072070929 + .long 2376322938 + .long 1072254587 + .long 4029755771 + .long 1072037049 + .long 3060434712 + .long 1072301721 + .long 497611374 + .long 1072001591 + .long 4010165530 + .long 1072350003 + .long 3306304935 + .long 1071964429 + .long 388249839 + .long 1072399550 + .long 539435036 + .long 1071925423 + .long 165779504 + .long 1072450495 + .long 2497352827 + .long 1071884403 + .long 1343287957 + .long 1072502997 + .long 884164153 + .long 1071841172 + .long 1828157318 + .long 1072557245 + .long 3653025069 + .long 1071795489 + .long 2128712154 + .long 1072613466 + .long 3056817116 + .long 1071747064 + .long 1489283833 + .long 1072671938 + .long 1840990109 + .long 1071695534 + .long 2059782629 + .long 1072713127 + .long 3931971716 + .long 1071636206 + .long 1027831985 + .long 1072745180 + .long 3187721039 + .long 1071517691 + .long 3329524973 + .long 1072779038 + .long 3649449467 + .long 1071389244 + .long 2110923290 + .long 1072815090 + .long 4055205277 + .long 1071248617 + .long 2992048670 + .long 1072853879 + .long 2715653706 + .long 1071092488 + .long 419466969 + .long 1072896214 + .long 2030806678 + .long 1070915559 + .long 1069790871 + .long 1072943387 + .long 2084655462 + .long 1070708358 + .long 3811755941 + .long 1072997722 + .long 3549768261 + .long 1070304457 + .long 884757291 + .long 1073064302 + .long 4261330719 + .long 1069543419 + .long 3631318613 + .long 1073160613 + .long 1413754136 + .long 1073291771 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 3067833783 + .long 3215383405 + .long 0 + .long 0 + .long 1431655765 + .long 1069897045 + .long 0 + .long 0 + .long 858993459 + .long 1068708659 + .long 0 + .long 0 + .long 1 + .long 1072693248 + .long 0 + .long 0 + .long 3340530119 + .long 1067392113 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1413754136 + .long 1074340347 + .type static_const_table,@object + .size static_const_table,1152 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/acosh_wmt.S b/external/sgx_libm/ia32/acosh_wmt.S new file mode 100644 index 0000000000..36112ecb6e --- /dev/null +++ b/external/sgx_libm/ia32/acosh_wmt.S @@ -0,0 +1,1922 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acosh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin acosh + .text + .align 16,0x90 + .globl acosh +acosh: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movl 116(%esp), %eax + subl $1072693248, %eax + je .L_2TAG_PACKET_0.0.3 + cmpl $1073741824, %eax + jae .L_2TAG_PACKET_1.0.3 + cmpl $6144, %eax + jl .L_2TAG_PACKET_2.0.3 + cmpl $29360128, %eax + jge .L_2TAG_PACKET_3.0.3 + cmpl $2293760, %eax + jl .L_2TAG_PACKET_4.0.3 + movq 112(%ebx), %xmm1 + movapd %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + addsd 112(%ebx), %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm2, %xmm0 + paddw 288(%ebx), %xmm2 + divsd %xmm0, %xmm1 + movapd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_4.0.3: + movapd %xmm0, %xmm1 + movapd %xmm0, %xmm3 + pand 208(%ebx), %xmm0 + movapd %xmm0, %xmm2 + subsd %xmm0, %xmm1 + addsd %xmm0, %xmm3 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm3 + subsd 128(%ebx), %xmm0 + movapd %xmm3, %xmm4 + addsd %xmm0, %xmm3 + sqrtsd %xmm3, %xmm3 + movapd %xmm3, %xmm5 + pand 208(%ebx), %xmm3 + subsd %xmm3, %xmm5 + movapd %xmm3, %xmm6 + movapd %xmm3, %xmm7 + addsd %xmm3, %xmm2 + mulsd %xmm3, %xmm3 + mulsd %xmm5, %xmm6 + addsd %xmm5, %xmm7 + subsd %xmm3, %xmm0 + subsd %xmm6, %xmm0 + addsd %xmm0, %xmm4 + movapd %xmm2, %xmm0 + divsd %xmm7, %xmm4 + addsd %xmm5, %xmm4 + mulsd 96(%ebx), %xmm4 + addsd %xmm4, %xmm1 +.L_2TAG_PACKET_5.0.3: + movq 240(%ebx), %xmm3 + addsd %xmm1, %xmm0 + movapd %xmm0, %xmm5 + psrlq $41, %xmm5 + pextrw $0, %xmm5, %ecx + pand 208(%ebx), %xmm0 + subsd %xmm0, %xmm2 + addsd %xmm2, %xmm1 + pshufd $68, %xmm0, %xmm4 + pand 192(%ebx), %xmm0 + pand 224(%ebx), %xmm4 + psubd %xmm4, %xmm3 + psubw 128(%ebx), %xmm4 + psrlq $52, %xmm4 + por 128(%ebx), %xmm0 + por 160(%ebx), %xmm4 + mulsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_3.0.3: + shrl $20, %eax + addl $1, %eax + movd %eax, %xmm4 + unpcklpd %xmm4, %xmm4 + movl 116(%esp), %ecx + por 160(%ebx), %xmm4 + pand 192(%ebx), %xmm0 + por 128(%ebx), %xmm0 + movapd %xmm0, %xmm1 + pand 208(%ebx), %xmm0 + subsd %xmm0, %xmm1 + shrl $9, %ecx +.L_2TAG_PACKET_6.0.3: + subpd 160(%ebx), %xmm4 + movq 80(%ebx), %xmm2 + andl $2040, %ecx + mulpd 256(%ebx), %xmm4 + mulsd 4400(%ebx,%ecx), %xmm0 + mulsd 4400(%ebx,%ecx), %xmm1 + subsd 128(%ebx), %xmm0 + movapd %xmm0, %xmm5 + addsd %xmm1, %xmm0 + movapd %xmm0, %xmm3 + unpcklpd %xmm0, %xmm0 + addpd 304(%ebx,%ecx,2), %xmm4 + movhlps %xmm4, %xmm6 + mulpd %xmm0, %xmm0 + mulsd %xmm0, %xmm2 + addpd 64(%ebx), %xmm2 + mulpd %xmm0, %xmm2 + addpd 48(%ebx), %xmm2 + mulpd %xmm0, %xmm2 + movhlps %xmm2, %xmm0 + mulsd %xmm3, %xmm0 + addsd %xmm2, %xmm0 + addsd %xmm1, %xmm0 + addsd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + addsd %xmm5, %xmm0 + movsd %xmm0, 24(%esp) + fldl 24(%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_2.0.3: + subsd 128(%ebx), %xmm0 + movapd %xmm0, %xmm1 + mulsd 144(%ebx), %xmm0 + movapd %xmm0, %xmm2 + movq 32(%ebx), %xmm7 + mulsd %xmm1, %xmm7 + addsd 24(%ebx), %xmm7 + mulsd %xmm1, %xmm7 + addsd 16(%ebx), %xmm7 + mulsd %xmm1, %xmm7 + addsd 8(%ebx), %xmm7 + mulsd %xmm1, %xmm7 + addsd (%ebx), %xmm7 + mulsd %xmm1, %xmm7 + movapd %xmm7, %xmm1 + sqrtsd %xmm0, %xmm0 + movapd %xmm0, %xmm3 + movapd %xmm0, %xmm4 + pand 208(%ebx), %xmm0 + subsd %xmm0, %xmm3 + movapd %xmm0, %xmm5 + movapd %xmm0, %xmm6 + mulsd %xmm0, %xmm0 + subsd %xmm0, %xmm2 + movapd %xmm7, %xmm0 + mulsd %xmm3, %xmm5 + subsd %xmm5, %xmm2 + divsd %xmm4, %xmm2 + addsd %xmm3, %xmm2 + mulsd 96(%ebx), %xmm2 + pand 208(%ebx), %xmm7 + subsd %xmm7, %xmm1 + mulsd %xmm6, %xmm7 + mulsd %xmm6, %xmm1 + mulsd %xmm2, %xmm0 + addsd %xmm1, %xmm0 + addsd %xmm2, %xmm0 + addsd %xmm7, %xmm0 + addsd %xmm6, %xmm0 + movsd %xmm0, 24(%esp) + fldl 24(%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_0.0.3: + movl 112(%esp), %ecx + testl %ecx, %ecx + jne .L_2TAG_PACKET_2.0.3 + fldz + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_1.0.3: + addl $1072693248, %eax + movl $2147483647, %ecx + andl %eax, %ecx + cmpl $2146435072, %ecx + jge .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_9.0.3: + xorpd %xmm1, %xmm1 + mulsd 224(%ebx), %xmm1 + movsd %xmm1, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $136, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_8.0.3: + cmpl $-1048576, %eax + je .L_2TAG_PACKET_10.0.3 + jmp .L_2TAG_PACKET_11.0.3 +.L_2TAG_PACKET_10.0.3: + movl 112(%esp), %eax + testl %eax, %eax + je .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_11.0.3: + addsd %xmm0, %xmm0 + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_7.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type acosh,@function + .size acosh,.-acosh + .data +# -- End acosh + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1431655760 + .long 3216332117 + .long 858954823 + .long 1066611507 + .long 2956777430 + .long 3212237677 + .long 4158004615 + .long 1063197775 + .long 2173429939 + .long 3209085130 + .long 0 + .long 0 + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 0 + .long 3220176896 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 1073741824 + .long 0 + .long 1073741824 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 0 + .long 4294967295 + .long 0 + .long 4294967295 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 2145386496 + .long 0 + .long 2145386496 + .long 897137782 + .long 1038760431 + .long 4276092928 + .long 1072049730 + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 1048576 + .long 0 + .long 0 + .long 662290844 + .long 1040545122 + .long 0 + .long 1063257089 + .long 1410206301 + .long 1039423595 + .long 0 + .long 1064833554 + .long 1576129908 + .long 1044327686 + .long 0 + .long 1065621801 + .long 3771466512 + .long 1043372267 + .long 0 + .long 1066152307 + .long 2250061482 + .long 1041942323 + .long 0 + .long 1066510009 + .long 241025648 + .long 1043818160 + .long 0 + .long 1066777242 + .long 3481293707 + .long 1039994007 + .long 0 + .long 1067045544 + .long 17391197 + .long 1042467788 + .long 0 + .long 1067281191 + .long 1429304634 + .long 1045705663 + .long 0 + .long 1067500943 + .long 2258946786 + .long 1045312243 + .long 0 + .long 1067619660 + .long 725099158 + .long 1043780790 + .long 0 + .long 1067755853 + .long 1795694751 + .long 1046370967 + .long 0 + .long 1067875476 + .long 218276363 + .long 1045874206 + .long 0 + .long 1067995528 + .long 3918058606 + .long 1045941877 + .long 0 + .long 1068133258 + .long 2029669416 + .long 1040964778 + .long 0 + .long 1068254238 + .long 111041497 + .long 1042505837 + .long 0 + .long 1068375655 + .long 9214008 + .long 1042394003 + .long 0 + .long 1068497513 + .long 3222421290 + .long 1046711220 + .long 0 + .long 1068559379 + .long 1120482910 + .long 1046024006 + .long 0 + .long 1068620754 + .long 3817590987 + .long 1046519755 + .long 0 + .long 1068682354 + .long 3431328350 + .long 1046805053 + .long 0 + .long 1068744181 + .long 3088376696 + .long 1046390788 + .long 0 + .long 1068806237 + .long 3229576382 + .long 1046428373 + .long 0 + .long 1068859611 + .long 1328753044 + .long 1046554315 + .long 0 + .long 1068922096 + .long 1186666727 + .long 1044788651 + .long 0 + .long 1068984815 + .long 603190068 + .long 1044621365 + .long 0 + .long 1069047769 + .long 1647019864 + .long 1045911122 + .long 0 + .long 1069101918 + .long 4200935885 + .long 1044407410 + .long 0 + .long 1069165314 + .long 3581720604 + .long 1046840144 + .long 0 + .long 1069219844 + .long 2217841072 + .long 1046325234 + .long 0 + .long 1069283688 + .long 1963222525 + .long 1047002562 + .long 0 + .long 1069338605 + .long 2828272122 + .long 1046012177 + .long 0 + .long 1069393703 + .long 3730942205 + .long 1046476867 + .long 0 + .long 1069458213 + .long 3166604115 + .long 1047518079 + .long 0 + .long 1069513705 + .long 2095461845 + .long 1046790089 + .long 0 + .long 1069558451 + .long 322388698 + .long 1046865736 + .long 0 + .long 1069586382 + .long 2407253617 + .long 1047545084 + .long 0 + .long 1069619086 + .long 3437791416 + .long 1047490483 + .long 0 + .long 1069647220 + .long 2693469775 + .long 1045625134 + .long 0 + .long 1069675449 + .long 1454696571 + .long 1045327327 + .long 0 + .long 1069703773 + .long 1940756848 + .long 1043926274 + .long 0 + .long 1069732193 + .long 2244096130 + .long 1047717922 + .long 0 + .long 1069760709 + .long 2856509870 + .long 1047123452 + .long 0 + .long 1069789323 + .long 116200689 + .long 1043361536 + .long 0 + .long 1069813243 + .long 4018367049 + .long 1048385867 + .long 0 + .long 1069842036 + .long 3162755613 + .long 1048496333 + .long 0 + .long 1069870929 + .long 2730655796 + .long 1048315252 + .long 0 + .long 1069899922 + .long 892380602 + .long 1046868829 + .long 0 + .long 1069929016 + .long 3139480334 + .long 1046190510 + .long 0 + .long 1069953338 + .long 1886171545 + .long 1048270714 + .long 0 + .long 1069982617 + .long 2203106387 + .long 1048291228 + .long 0 + .long 1070007095 + .long 659271154 + .long 1044549473 + .long 0 + .long 1070036564 + .long 377790372 + .long 1045759361 + .long 0 + .long 1070066136 + .long 1269824164 + .long 1047357396 + .long 0 + .long 1070090859 + .long 1643831617 + .long 1048231604 + .long 0 + .long 1070115655 + .long 57265969 + .long 1047663307 + .long 0 + .long 1070145508 + .long 2640032722 + .long 1046479978 + .long 0 + .long 1070170467 + .long 2420992102 + .long 1043079769 + .long 0 + .long 1070200516 + .long 2711573521 + .long 1045731911 + .long 0 + .long 1070225639 + .long 1973048145 + .long 1048077010 + .long 0 + .long 1070250837 + .long 4093691059 + .long 1046627963 + .long 0 + .long 1070276112 + .long 4182783767 + .long 1047690348 + .long 0 + .long 1070306542 + .long 2883525439 + .long 1048055018 + .long 0 + .long 1070331985 + .long 3917130655 + .long 1046818760 + .long 0 + .long 1070357506 + .long 2320146059 + .long 1048132455 + .long 0 + .long 1070383104 + .long 3464331364 + .long 1047738634 + .long 0 + .long 1070408781 + .long 674627443 + .long 1046468986 + .long 0 + .long 1070434537 + .long 2152289494 + .long 1046214007 + .long 0 + .long 1070460372 + .long 37897452 + .long 1048575202 + .long 0 + .long 1070486286 + .long 1899477568 + .long 1044793529 + .long 0 + .long 1070512282 + .long 2077140689 + .long 1048534003 + .long 0 + .long 1070538357 + .long 448558287 + .long 1045911230 + .long 0 + .long 1070564515 + .long 3867352000 + .long 1046082819 + .long 0 + .long 1070590754 + .long 2206537816 + .long 1049157739 + .long 0 + .long 1070606585 + .long 1799603998 + .long 1049369388 + .long 0 + .long 1070619787 + .long 4075457018 + .long 1048703324 + .long 0 + .long 1070630379 + .long 572844178 + .long 1049388451 + .long 0 + .long 1070643656 + .long 540240475 + .long 1048063456 + .long 0 + .long 1070656976 + .long 2413664112 + .long 1047739393 + .long 0 + .long 1070670338 + .long 2592177285 + .long 1048727389 + .long 0 + .long 1070681058 + .long 1541931453 + .long 1048698417 + .long 0 + .long 1070694497 + .long 3345398163 + .long 1049085432 + .long 0 + .long 1070707979 + .long 2241984547 + .long 1049164260 + .long 0 + .long 1070718796 + .long 890223989 + .long 1048265646 + .long 0 + .long 1070732357 + .long 1226890683 + .long 1048781783 + .long 0 + .long 1070743237 + .long 1600520378 + .long 1048834273 + .long 0 + .long 1070756877 + .long 1081324478 + .long 1048934847 + .long 0 + .long 1070767821 + .long 1928471339 + .long 1042640487 + .long 0 + .long 1070781542 + .long 982084959 + .long 1048971733 + .long 0 + .long 1070792550 + .long 2380239162 + .long 1047711062 + .long 0 + .long 1070806352 + .long 3609542249 + .long 1048031507 + .long 0 + .long 1070817426 + .long 3466499103 + .long 1049126511 + .long 0 + .long 1070828529 + .long 1626165976 + .long 1048431820 + .long 0 + .long 1070842450 + .long 261635432 + .long 1048113242 + .long 0 + .long 1070853620 + .long 1670437810 + .long 1046604532 + .long 0 + .long 1070864820 + .long 3910575981 + .long 1049365107 + .long 0 + .long 1070876049 + .long 727294688 + .long 1048407484 + .long 0 + .long 1070890129 + .long 3260008354 + .long 1047549258 + .long 0 + .long 1070901427 + .long 872084085 + .long 1048711456 + .long 0 + .long 1070912755 + .long 754632403 + .long 1048687679 + .long 0 + .long 1070924114 + .long 1033413261 + .long 1048105461 + .long 0 + .long 1070935504 + .long 1155773876 + .long 1047412165 + .long 0 + .long 1070946925 + .long 746670859 + .long 1046841493 + .long 0 + .long 1070961245 + .long 1820254373 + .long 1048237327 + .long 0 + .long 1070972736 + .long 3605217861 + .long 1047440922 + .long 0 + .long 1070984259 + .long 2212317823 + .long 1049212421 + .long 0 + .long 1070995813 + .long 2826670683 + .long 1047678316 + .long 0 + .long 1071007400 + .long 3532575187 + .long 1049339451 + .long 0 + .long 1071019018 + .long 413443603 + .long 1049028939 + .long 0 + .long 1071030669 + .long 2964472999 + .long 1043732931 + .long 0 + .long 1071042353 + .long 389771102 + .long 1049430622 + .long 0 + .long 1071051136 + .long 1005132876 + .long 1048342053 + .long 0 + .long 1071062877 + .long 2877512173 + .long 1049492173 + .long 0 + .long 1071074650 + .long 1874411204 + .long 1048724858 + .long 0 + .long 1071086457 + .long 1011596427 + .long 1048646627 + .long 0 + .long 1071098297 + .long 838498113 + .long 1043068341 + .long 0 + .long 1071110171 + .long 409945993 + .long 1047118137 + .long 0 + .long 1071122078 + .long 2035722984 + .long 1049263601 + .long 0 + .long 1071131030 + .long 4272650650 + .long 1048435570 + .long 0 + .long 1071142997 + .long 867757828 + .long 1047923871 + .long 0 + .long 1071154998 + .long 433900304 + .long 1048766295 + .long 0 + .long 1071164021 + .long 2626749065 + .long 1049334020 + .long 0 + .long 1071176082 + .long 2721103389 + .long 1049448370 + .long 0 + .long 1071188178 + .long 3401674810 + .long 1049424769 + .long 0 + .long 1071197273 + .long 3030733799 + .long 1047804815 + .long 0 + .long 1071209431 + .long 1532130487 + .long 1045537774 + .long 0 + .long 1071221624 + .long 225486125 + .long 1049520040 + .long 0 + .long 1071230791 + .long 1326263423 + .long 1044918825 + .long 0 + .long 1071243047 + .long 3029302589 + .long 1049469599 + .long 0 + .long 1071252261 + .long 3326443421 + .long 1042360275 + .long 0 + .long 1071264580 + .long 3770244744 + .long 1048027184 + .long 0 + .long 1071273842 + .long 2568976454 + .long 1045847505 + .long 0 + .long 1071286224 + .long 628040571 + .long 1048248574 + .long 0 + .long 1071295534 + .long 2688775955 + .long 1048311770 + .long 0 + .long 1071307980 + .long 3357093336 + .long 1047484659 + .long 0 + .long 1071317339 + .long 2753529189 + .long 1047343532 + .long 0 + .long 1071329850 + .long 625560417 + .long 1043404964 + .long 0 + .long 1071339258 + .long 2456374941 + .long 1048890167 + .long 0 + .long 1071351834 + .long 748255530 + .long 1049487286 + .long 0 + .long 1071361291 + .long 2246865993 + .long 1048768259 + .long 0 + .long 1071370770 + .long 205672663 + .long 1047230532 + .long 0 + .long 1071383442 + .long 4242870741 + .long 1046367538 + .long 0 + .long 1071392971 + .long 2016709797 + .long 1049037028 + .long 0 + .long 1071402521 + .long 2569308411 + .long 1049159850 + .long 0 + .long 1071415289 + .long 3242472523 + .long 1048132214 + .long 0 + .long 1071424891 + .long 1602055934 + .long 1044691415 + .long 0 + .long 1071434515 + .long 1307177952 + .long 1049244134 + .long 0 + .long 1071444160 + .long 2152237414 + .long 1048407400 + .long 0 + .long 1071457056 + .long 2598207309 + .long 1047639998 + .long 0 + .long 1071466754 + .long 3115077937 + .long 1048719780 + .long 0 + .long 1071476474 + .long 1272724396 + .long 1048321721 + .long 0 + .long 1071486217 + .long 2860867658 + .long 1049612888 + .long 0 + .long 1071495982 + .long 1467300368 + .long 1047143154 + .long 0 + .long 1071509039 + .long 3449085837 + .long 1046095654 + .long 0 + .long 1071518858 + .long 2146871948 + .long 1044681726 + .long 0 + .long 1071528700 + .long 3066750144 + .long 1046492840 + .long 0 + .long 1071538565 + .long 1416401583 + .long 1048453263 + .long 0 + .long 1071548453 + .long 2249840317 + .long 1046959692 + .long 0 + .long 1071558365 + .long 4172904720 + .long 1048039642 + .long 0 + .long 1071568300 + .long 1549017192 + .long 1046702261 + .long 0 + .long 1071578259 + .long 3220736011 + .long 1048855214 + .long 0 + .long 1071588241 + .long 630967006 + .long 1049477219 + .long 0 + .long 1071598247 + .long 3624057028 + .long 1046733189 + .long 0 + .long 1071608278 + .long 3730794064 + .long 1048259820 + .long 0 + .long 1071618332 + .long 570378657 + .long 1049316661 + .long 0 + .long 1071628410 + .long 2814556357 + .long 1048696327 + .long 0 + .long 1071638513 + .long 194866917 + .long 1048899904 + .long 0 + .long 1071646656 + .long 3497355923 + .long 1047579730 + .long 0 + .long 1071651732 + .long 984418162 + .long 1048576793 + .long 0 + .long 1071656820 + .long 1973276684 + .long 1050136256 + .long 0 + .long 1071661920 + .long 3329497336 + .long 1049987327 + .long 0 + .long 1071667033 + .long 1374214759 + .long 1047073231 + .long 0 + .long 1071672159 + .long 2689110139 + .long 1044696853 + .long 0 + .long 1071675583 + .long 3281519615 + .long 1049239454 + .long 0 + .long 1071680729 + .long 106060705 + .long 1049441252 + .long 0 + .long 1071685888 + .long 994445709 + .long 1048383906 + .long 0 + .long 1071691060 + .long 968365306 + .long 1050219142 + .long 0 + .long 1071696244 + .long 1127183666 + .long 1048063436 + .long 0 + .long 1071701442 + .long 1176023037 + .long 1048767474 + .long 0 + .long 1071704914 + .long 494386159 + .long 1048610025 + .long 0 + .long 1071710133 + .long 3484359724 + .long 1048499390 + .long 0 + .long 1071715365 + .long 3217980016 + .long 1048823654 + .long 0 + .long 1071720610 + .long 422622404 + .long 1048883138 + .long 0 + .long 1071724114 + .long 1262752531 + .long 1048980778 + .long 0 + .long 1071729381 + .long 3412819100 + .long 1049899918 + .long 0 + .long 1071734661 + .long 4248496658 + .long 1048338572 + .long 0 + .long 1071738189 + .long 644483909 + .long 1050165690 + .long 0 + .long 1071743491 + .long 3881343467 + .long 1050118499 + .long 0 + .long 1071748807 + .long 2653622880 + .long 1048337361 + .long 0 + .long 1071752359 + .long 2812002981 + .long 1050155308 + .long 0 + .long 1071757697 + .long 224311686 + .long 1050482530 + .long 0 + .long 1071763049 + .long 679701015 + .long 1049869325 + .long 0 + .long 1071766625 + .long 3027506890 + .long 1049908641 + .long 0 + .long 1071772000 + .long 3751375892 + .long 1049481244 + .long 0 + .long 1071777389 + .long 1920294497 + .long 1050102004 + .long 0 + .long 1071780989 + .long 1483524208 + .long 1050119127 + .long 0 + .long 1071786401 + .long 97441208 + .long 1049658186 + .long 0 + .long 1071790017 + .long 3008178484 + .long 1050468097 + .long 0 + .long 1071795452 + .long 3633428993 + .long 1048933205 + .long 0 + .long 1071799084 + .long 272261604 + .long 1048795103 + .long 0 + .long 1071804543 + .long 1886467610 + .long 1049658772 + .long 0 + .long 1071810016 + .long 3703763111 + .long 1048691245 + .long 0 + .long 1071813673 + .long 3272554440 + .long 1049215679 + .long 0 + .long 1071819170 + .long 1615609844 + .long 1047938702 + .long 0 + .long 1071822843 + .long 2101526408 + .long 1049159037 + .long 0 + .long 1071826522 + .long 3501340145 + .long 1048964151 + .long 0 + .long 1071832053 + .long 3398848880 + .long 1050181422 + .long 0 + .long 1071835748 + .long 3113670222 + .long 1047639078 + .long 0 + .long 1071841304 + .long 3113807767 + .long 1050490134 + .long 0 + .long 1071845015 + .long 2638078905 + .long 1050508198 + .long 0 + .long 1071850595 + .long 3402790998 + .long 1048094059 + .long 0 + .long 1071854324 + .long 2677940860 + .long 1046276297 + .long 0 + .long 1071859929 + .long 2914178933 + .long 1050613895 + .long 0 + .long 1071863673 + .long 1395015268 + .long 1049805645 + .long 0 + .long 1071867425 + .long 3443880395 + .long 1049880454 + .long 0 + .long 1071873065 + .long 3880277067 + .long 1046944118 + .long 0 + .long 1071876834 + .long 4190954257 + .long 1048963456 + .long 0 + .long 1071880609 + .long 975315090 + .long 1050660599 + .long 0 + .long 1071886284 + .long 3981445309 + .long 1048841548 + .long 0 + .long 1071890077 + .long 340978156 + .long 1049630357 + .long 0 + .long 1071893876 + .long 3056282856 + .long 1048349819 + .long 0 + .long 1071899588 + .long 3637866925 + .long 1050038234 + .long 0 + .long 1071903404 + .long 1233925752 + .long 1047565029 + .long 0 + .long 1071907228 + .long 3365276628 + .long 1049120293 + .long 0 + .long 1071912976 + .long 1364708917 + .long 1048863613 + .long 0 + .long 1071916817 + .long 2949393003 + .long 1048806573 + .long 0 + .long 1071920665 + .long 2588933741 + .long 1049057850 + .long 0 + .long 1071924520 + .long 1317344960 + .long 1048679202 + .long 0 + .long 1071930316 + .long 4264843208 + .long 1047591051 + .long 0 + .long 1071934189 + .long 1772398646 + .long 1047786577 + .long 0 + .long 1071938069 + .long 855212881 + .long 1049083903 + .long 0 + .long 1071941956 + .long 111728933 + .long 1050121939 + .long 0 + .long 1071947800 + .long 2934994658 + .long 1046035147 + .long 0 + .long 1071951706 + .long 3504420384 + .long 1049933751 + .long 0 + .long 1071955618 + .long 2295312686 + .long 1049747989 + .long 0 + .long 1071959538 + .long 185383186 + .long 1050276648 + .long 0 + .long 1071963465 + .long 2699459344 + .long 1049336105 + .long 0 + .long 1071967400 + .long 3020028019 + .long 1048472693 + .long 0 + .long 1071973316 + .long 365843238 + .long 1049205247 + .long 0 + .long 1071977269 + .long 1597522098 + .long 1045226127 + .long 0 + .long 1071981230 + .long 731482298 + .long 1047741244 + .long 0 + .long 1071985198 + .long 19057756 + .long 1050243827 + .long 0 + .long 1071989173 + .long 2890838867 + .long 1050654615 + .long 0 + .long 1071993156 + .long 2027053605 + .long 1050184234 + .long 0 + .long 1071997147 + .long 858789886 + .long 1047748038 + .long 0 + .long 1072001146 + .long 4288580762 + .long 1046326129 + .long 0 + .long 1072007158 + .long 3861103191 + .long 1049816977 + .long 0 + .long 1072011175 + .long 1902054808 + .long 1050330775 + .long 0 + .long 1072015200 + .long 568089353 + .long 1050301118 + .long 0 + .long 1072019233 + .long 3743438430 + .long 1049790563 + .long 0 + .long 1072023274 + .long 2063211846 + .long 1047622979 + .long 0 + .long 1072027323 + .long 1911797542 + .long 1049675962 + .long 0 + .long 1072031379 + .long 3660869822 + .long 1050198853 + .long 0 + .long 1072035443 + .long 616847508 + .long 1050494731 + .long 0 + .long 1072039515 + .long 225141268 + .long 1050627992 + .long 0 + .long 1072043595 + .long 3898487111 + .long 1050663410 + .long 0 + .long 1072047683 + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type static_const_table,@object + .size static_const_table,6448 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/acoshf_wmt.S b/external/sgx_libm/ia32/acoshf_wmt.S new file mode 100644 index 0000000000..b2bf2ceab0 --- /dev/null +++ b/external/sgx_libm/ia32/acoshf_wmt.S @@ -0,0 +1,1292 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acoshf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin acoshf + .text + .align 16,0x90 + .globl acoshf +acoshf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movl 112(%esp), %eax + subl $1065353217, %eax + cmpl $1073741823, %eax + jae .L_2TAG_PACKET_0.0.3 + subl $4194303, %eax + js .L_2TAG_PACKET_1.0.3 + cmpl $130023424, %eax + ja .L_2TAG_PACKET_2.0.3 + movss 112(%esp), %xmm0 + cvtps2pd %xmm0, %xmm0 + movapd %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + subsd 96(%ebx), %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + pshufd $85, %xmm0, %xmm1 + movd %xmm1, %eax + movl %eax, %ecx + shrl $20, %eax + shrl $9, %ecx + subl $1023, %eax + cvtsi2sdl %eax, %xmm2 + andpd 112(%ebx), %xmm0 + orpd 96(%ebx), %xmm0 + andl $2040, %ecx + movq 72(%ebx), %xmm1 + mulsd 2176(%ebx,%ecx), %xmm0 + subsd 96(%ebx), %xmm0 + mulsd 80(%ebx), %xmm2 + mulsd %xmm0, %xmm1 + addsd 64(%ebx), %xmm1 + mulsd %xmm0, %xmm1 + addsd 128(%ebx,%ecx), %xmm2 + mulsd %xmm0, %xmm1 + addsd %xmm1, %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, 24(%esp) + fldl 24(%esp) + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_2.0.3: + movss 112(%esp), %xmm0 + cvtss2sd %xmm0, %xmm0 + addl $1069547520, %eax + movl %eax, %ecx + shrl $23, %eax + subl $126, %eax + shrl $12, %ecx + cvtsi2sdl %eax, %xmm2 + andpd 112(%ebx), %xmm0 + orpd 96(%ebx), %xmm0 + andl $2040, %ecx + movq 72(%ebx), %xmm1 + mulsd 2176(%ebx,%ecx), %xmm0 + subsd 96(%ebx), %xmm0 + mulsd 80(%ebx), %xmm2 + mulsd %xmm0, %xmm1 + addsd 64(%ebx), %xmm1 + mulsd %xmm0, %xmm1 + addsd 128(%ebx,%ecx), %xmm2 + mulsd %xmm0, %xmm1 + addsd %xmm1, %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, 24(%esp) + fldl 24(%esp) + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_1.0.3: + movss 112(%esp), %xmm0 + cvtps2pd %xmm0, %xmm0 + movdqa 48(%ebx), %xmm3 + subsd 96(%ebx), %xmm0 + movdqa %xmm0, %xmm2 + movdqa %xmm0, %xmm1 + addsd %xmm0, %xmm0 + sqrtsd %xmm0, %xmm0 + mulsd %xmm2, %xmm2 + pshufd $68, %xmm1, %xmm1 + pshufd $68, %xmm2, %xmm2 + mulpd %xmm2, %xmm3 + addpd 32(%ebx), %xmm3 + mulpd %xmm2, %xmm3 + addpd 16(%ebx), %xmm3 + mulpd %xmm2, %xmm3 + addpd (%ebx), %xmm3 + mulpd %xmm1, %xmm3 + pshufd $238, %xmm3, %xmm2 + mulsd %xmm3, %xmm1 + addsd %xmm2, %xmm1 + mulsd %xmm0, %xmm1 + addsd %xmm1, %xmm0 + movsd %xmm0, 24(%esp) + fldl 24(%esp) + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_0.0.3: + incl %eax + movl 112(%esp), %edx + je .L_2TAG_PACKET_4.0.3 + andl $2147483647, %edx + cmpl $2139095040, %edx + ja .L_2TAG_PACKET_5.0.3 + cmpl $1073741824, %eax + je .L_2TAG_PACKET_5.0.3 + pcmpeqd %xmm1, %xmm1 + pslld $23, %xmm1 + subss %xmm1, %xmm1 + movss %xmm1, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $137, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_4.0.3: + fldz + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_5.0.3: + flds 112(%esp) + fadd %st(0), %st +.L_2TAG_PACKET_3.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type acoshf,@function + .size acoshf,.-acoshf + .data +# -- End acoshf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 305580873 + .long 1066611507 + .long 1429119421 + .long 3216332117 + .long 2886529429 + .long 1063197348 + .long 3670928078 + .long 3212237666 + .long 2610913564 + .long 1060186234 + .long 1100460448 + .long 3209089799 + .long 3532580246 + .long 1056164631 + .long 3531562621 + .long 3205972992 + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .long 4277811695 + .long 1072049730 + .long 4277811695 + .long 1072049730 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 1440057502 + .long 1063257089 + .long 341338964 + .long 1064833554 + .long 4184355568 + .long 1065621801 + .long 2227658503 + .long 1066152307 + .long 449262470 + .long 1066510009 + .long 1570422842 + .long 1066777242 + .long 121841140 + .long 1067045544 + .long 630691842 + .long 1067281191 + .long 2711485097 + .long 1067500943 + .long 2026622491 + .long 1067619660 + .long 766078039 + .long 1067755853 + .long 4074027864 + .long 1067875476 + .long 3056660584 + .long 1067995528 + .long 3195252556 + .long 1068133258 + .long 116861598 + .long 1068254238 + .long 325086471 + .long 1068375655 + .long 296456961 + .long 1068497513 + .long 2623383041 + .long 1068559379 + .long 1681725707 + .long 1068620754 + .long 2231263004 + .long 1068682354 + .long 2815553124 + .long 1068744181 + .long 2057310944 + .long 1068806237 + .long 2095798018 + .long 1068859611 + .long 2302040698 + .long 1068922096 + .long 745232013 + .long 1068984815 + .long 659581512 + .long 1069047769 + .long 1566132617 + .long 1069101918 + .long 550036981 + .long 1069165314 + .long 2887419564 + .long 1069219844 + .long 1990183441 + .long 1069283688 + .long 3220050856 + .long 1069338605 + .long 1669613218 + .long 1069393703 + .long 2145455994 + .long 1069458213 + .long 4275830246 + .long 1069513705 + .long 1392453108 + .long 1069558451 + .long 1469915213 + .long 1069586382 + .long 2183652476 + .long 1069619086 + .long 2109656884 + .long 1069647220 + .long 636640577 + .long 1069675449 + .long 510517079 + .long 1069703773 + .long 210141498 + .long 1069732193 + .long 2537624622 + .long 1069760709 + .long 1733817001 + .long 1069789323 + .long 137854980 + .long 1069813243 + .long 3905576828 + .long 1069842036 + .long 4131810788 + .long 1069870929 + .long 3760956694 + .long 1069899922 + .long 1473082581 + .long 1069929016 + .long 926113142 + .long 1069953338 + .long 3669742467 + .long 1069982617 + .long 3711755290 + .long 1070007095 + .long 311386407 + .long 1070036564 + .long 705364525 + .long 1070066136 + .long 1973375279 + .long 1070090859 + .long 3589645072 + .long 1070115655 + .long 2425772059 + .long 1070145508 + .long 1074899574 + .long 1070170467 + .long 118003300 + .long 1070200516 + .long 691310403 + .long 1070225639 + .long 3273036717 + .long 1070250837 + .long 1226436560 + .long 1070276112 + .long 2481153995 + .long 1070306542 + .long 3227997535 + .long 1070331985 + .long 1421812646 + .long 1070357506 + .long 3386588242 + .long 1070383104 + .long 2580043380 + .long 1070408781 + .long 1068692560 + .long 1070434537 + .long 938143489 + .long 1070460372 + .long 4293333010 + .long 1070486286 + .long 373864817 + .long 1070512282 + .long 4208958430 + .long 1070538357 + .long 783121462 + .long 1070564515 + .long 870975437 + .long 1070590754 + .long 3338886172 + .long 1070606585 + .long 3772343130 + .long 1070619787 + .long 2408245143 + .long 1070630379 + .long 3811383569 + .long 1070643656 + .long 1622638721 + .long 1070656976 + .long 1290798655 + .long 1070670338 + .long 2457529556 + .long 1070681058 + .long 2398194399 + .long 1070694497 + .long 3190801979 + .long 1070707979 + .long 3352241197 + .long 1070718796 + .long 1829681364 + .long 1070732357 + .long 2568927817 + .long 1070743237 + .long 2676427515 + .long 1070756877 + .long 2882402820 + .long 1070767821 + .long 44944622 + .long 1070781542 + .long 2957945300 + .long 1070792550 + .long 1261787704 + .long 1070806352 + .long 1589923677 + .long 1070817426 + .long 3274931829 + .long 1070828529 + .long 1999843716 + .long 1070842450 + .long 1673619518 + .long 1070853620 + .long 601221319 + .long 1070864820 + .long 3763576649 + .long 1070876049 + .long 1974923437 + .long 1070890129 + .long 1096100617 + .long 1070901427 + .long 2424897952 + .long 1070912755 + .long 2376202600 + .long 1070924114 + .long 1665651958 + .long 1070935504 + .long 1014729354 + .long 1070946925 + .long 722545241 + .long 1070961245 + .long 1800682930 + .long 1070972736 + .long 1029453230 + .long 1070984259 + .long 3450874911 + .long 1070995813 + .long 1228255906 + .long 1071007400 + .long 3711032981 + .long 1071019018 + .long 3075102917 + .long 1071030669 + .long 92696812 + .long 1071042353 + .long 3897749690 + .long 1071051136 + .long 1907922160 + .long 1071062877 + .long 4023807324 + .long 1071074650 + .long 2452345726 + .long 1071086457 + .long 2292128226 + .long 1071098297 + .long 58635942 + .long 1071110171 + .long 864186929 + .long 1071122078 + .long 3555691467 + .long 1071131030 + .long 2003684347 + .long 1071142997 + .long 1479703759 + .long 1071154998 + .long 2537208015 + .long 1071164021 + .long 3699909861 + .long 1071176082 + .long 3934098706 + .long 1071188178 + .long 3885764182 + .long 1071197273 + .long 1357790931 + .long 1071209431 + .long 295956059 + .long 1071221624 + .long 4080877676 + .long 1071230791 + .long 202970280 + .long 1071243047 + .long 3977575845 + .long 1071252261 + .long 35977849 + .long 1071264580 + .long 1585496963 + .long 1071273842 + .long 375247257 + .long 1071286224 + .long 1812199574 + .long 1071295534 + .long 1876912769 + .long 1071307980 + .long 1051846544 + .long 1071317339 + .long 979589448 + .long 1071329850 + .long 71706889 + .long 1071339258 + .long 2790898835 + .long 1071351834 + .long 4013797733 + .long 1071361291 + .long 2541231151 + .long 1071370770 + .long 921733145 + .long 1071383442 + .long 508375805 + .long 1071392971 + .long 3091669954 + .long 1071402521 + .long 3343209673 + .long 1071415289 + .long 1693047557 + .long 1071424891 + .long 173861808 + .long 1071434515 + .long 3515822703 + .long 1071444160 + .long 1974837761 + .long 1071457056 + .long 1189018219 + .long 1071466754 + .long 2441946573 + .long 1071476474 + .long 1887102255 + .long 1071486217 + .long 4271031636 + .long 1071495982 + .long 876995759 + .long 1071509039 + .long 438773454 + .long 1071518858 + .long 172621632 + .long 1071528700 + .long 544035182 + .long 1071538565 + .long 2021801298 + .long 1071548453 + .long 783063308 + .long 1071558365 + .long 1598254051 + .long 1071568300 + .long 651258553 + .long 1071578259 + .long 2719315456 + .long 1071588241 + .long 3993180461 + .long 1071598247 + .long 667093936 + .long 1071608278 + .long 1823716217 + .long 1071618332 + .long 3664357648 + .long 1071628410 + .long 2393914686 + .long 1071638513 + .long 1405419566 + .long 1071646656 + .long 563652001 + .long 1071651732 + .long 1074554091 + .long 1071656820 + .long 3195405229 + .long 1071661920 + .long 2890399284 + .long 1071667033 + .long 420597586 + .long 1071672159 + .long 87278952 + .long 1071675583 + .long 1753119502 + .long 1071680729 + .long 1959759897 + .long 1071685888 + .long 975389815 + .long 1071691060 + .long 3365155278 + .long 1071696244 + .long 811309190 + .long 1071701442 + .long 1269811480 + .long 1071704914 + .long 1108583542 + .long 1071710133 + .long 1034517919 + .long 1071715365 + .long 1327340287 + .long 1071720610 + .long 1388251237 + .long 1071724114 + .long 1488234797 + .long 1071729381 + .long 2711385691 + .long 1071734661 + .long 952179194 + .long 1071738189 + .long 3255685427 + .long 1071743491 + .long 3159039803 + .long 1071748807 + .long 951558972 + .long 1071752359 + .long 3234424125 + .long 1071757697 + .long 3904573547 + .long 1071763049 + .long 2648729924 + .long 1071766625 + .long 2729250212 + .long 1071772000 + .long 2000712574 + .long 1071777389 + .long 3125257108 + .long 1071780989 + .long 3160324803 + .long 1071786401 + .long 2216316974 + .long 1071790017 + .long 3875016090 + .long 1071795452 + .long 1439520610 + .long 1071799084 + .long 1298103361 + .long 1071804543 + .long 2217517956 + .long 1071810016 + .long 1191753587 + .long 1071813673 + .long 1728773900 + .long 1071819170 + .long 747445441 + .long 1071822843 + .long 1670772213 + .long 1071826522 + .long 1471209283 + .long 1071832053 + .long 3287905877 + .long 1071835748 + .long 594038131 + .long 1071841304 + .long 3920147917 + .long 1071845015 + .long 3957142762 + .long 1071850595 + .long 826988438 + .long 1071854324 + .long 242509008 + .long 1071859929 + .long 4173610350 + .long 1071863673 + .long 2518313625 + .long 1071867425 + .long 2671523434 + .long 1071873065 + .long 387544807 + .long 1071876834 + .long 1470497767 + .long 1071880609 + .long 4269259217 + .long 1071886284 + .long 1345663925 + .long 1071890077 + .long 2159323299 + .long 1071893876 + .long 957937516 + .long 1071899588 + .long 2994656967 + .long 1071903404 + .long 556124819 + .long 1071907228 + .long 1631098658 + .long 1071912976 + .long 1368257861 + .long 1071916817 + .long 1309849279 + .long 1071920665 + .long 1567156841 + .long 1071924520 + .long 1179420986 + .long 1071930316 + .long 569448444 + .long 1071934189 + .long 669557459 + .long 1071938069 + .long 1593834700 + .long 1071941956 + .long 3166083125 + .long 1071947800 + .long 211641815 + .long 1071951706 + .long 2780675719 + .long 1071955618 + .long 2400234567 + .long 1071959538 + .long 3482927192 + .long 1071963465 + .long 1852089988 + .long 1071967400 + .long 1020849000 + .long 1071973316 + .long 1718090839 + .long 1071977269 + .long 121152472 + .long 1071981230 + .long 646346839 + .long 1071985198 + .long 3415709705 + .long 1071989173 + .long 4257004898 + .long 1071993156 + .long 3293664199 + .long 1071997147 + .long 649825382 + .long 1072001146 + .long 248887552 + .long 1072007158 + .long 2541522737 + .long 1072011175 + .long 3593780107 + .long 1072015200 + .long 3533041935 + .long 1072019233 + .long 2487426809 + .long 1072023274 + .long 585795318 + .long 1072027323 + .long 2252723088 + .long 1072031379 + .long 3323604690 + .long 1072035443 + .long 3929561382 + .long 1072039515 + .long 4202479723 + .long 1072043595 + .long 4275017539 + .long 1072047683 + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type static_const_table,@object + .size static_const_table,4224 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/acoshl.S b/external/sgx_libm/ia32/acoshl.S new file mode 100644 index 0000000000..205ab9b444 --- /dev/null +++ b/external/sgx_libm/ia32/acoshl.S @@ -0,0 +1,883 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acoshl.c" + .text +..TXTST0: +# -- Begin acoshl + .text + .align 16,0x90 + .globl acoshl +acoshl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + movl %eax, %ebx + movzbl 17(%ebp), %esi + andl $32767, %ebx + shrl $7, %esi + shll $15, %esi + movl 12(%ebp), %edi + orl %ebx, %esi + movl %edi, %edx + shll $16, %esi + shrl $16, %edx + orl %edx, %esi + addl $-1073709056, %esi + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $1073741824, %esi + jae ..B1.44 +..B1.4: + cmpl $8192, %esi + jae ..B1.21 +..B1.5: + cmpl $64, %esi + jae ..B1.14 +..B1.6: + cmpl $16383, %ebx + je ..B1.39 +..B1.7: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.8: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movl $1, %eax +..B1.11: + fldt 8(%ebp) + testl %eax, %eax + fldl _TWO_52H@GOTOFF(%ecx) + fld %st(0) + fxch %st(2) + faddl 8+_ones@GOTOFF(%ecx) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(0) + fmul %st(1), %st + fld %st(1) + fsub %st(4), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 60+_Q1@GOTOFF(%ecx) + fmul %st(2), %st + fldt 36+_Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_Q1@GOTOFF(%ecx) + fmul %st(3), %st + fldt 24+_Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt _Q1@GOTOFF(%ecx) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st, %st(2) + fld %st(2) + fxch %st(1) + fmulp %st, %st(5) + fadd %st(4), %st + fsqrt + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(6) + fld %st(4) + fmul %st(1), %st + fsubrp %st, %st(6) + fxch %st(3) + faddp %st, %st(5) + fdivrp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(2) + fadd %st(1), %st + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.13 +..B1.12: + fldcw 14(%esp) +..B1.13: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.42 +..B1.15: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.16: + fldcw 12(%esp) +..B1.17: + movl $1, %eax +..B1.18: + fldt 8(%ebp) + testl %eax, %eax + fldl _TWO_52H@GOTOFF(%ecx) + fldt 132+_Q@GOTOFF(%ecx) + fxch %st(2) + faddl 8+_ones@GOTOFF(%ecx) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fld %st(1) + fsub %st(3), %st + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fxch %st(4) + fstpt 16(%esp) + fldt 16(%esp) + fmul %st(0), %st + fadd %st, %st(4) + fxch %st(3) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 156+_Q@GOTOFF(%ecx) + fmul %st(5), %st + faddp %st, %st(6) + fxch %st(4) + fmul %st, %st(5) + fldt 108+_Q@GOTOFF(%ecx) + faddp %st, %st(6) + fmul %st, %st(5) + fldt 84+_Q@GOTOFF(%ecx) + faddp %st, %st(6) + fmul %st, %st(5) + fldt 60+_Q@GOTOFF(%ecx) + faddp %st, %st(6) + fmul %st, %st(5) + fldt 36+_Q@GOTOFF(%ecx) + faddp %st, %st(6) + fmul %st, %st(5) + fldt 12+_Q@GOTOFF(%ecx) + faddp %st, %st(6) + fmul %st, %st(5) + fldt 144+_Q@GOTOFF(%ecx) + fmul %st(1), %st + fldt 120+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt _Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fldt 180+_Q@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fmulp %st, %st(1) + fldt 168+_Q@GOTOFF(%ecx) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(4) + fldt 16(%esp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldl _TWO_52H@GOTOFF(%ecx) + fld %st(0) + fadd %st(3), %st + fsub %st(1), %st + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st, %st(4) + fld %st(4) + fxch %st(1) + fmulp %st, %st(3) + fadd %st(2), %st + fsqrt + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fsubrp %st, %st(3) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(1), %st + fsubrp %st, %st(4) + fxch %st(5) + faddp %st, %st(3) + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fld %st(0) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(4) + fadd %st(3), %st + fmulp %st, %st(4) + fld %st(1) + fmul %st(3), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fmul %st(2), %st + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.20 +..B1.19: + fldcw 14(%esp) +..B1.20: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.21: + movzwl 14(%esp), %esi + movl %esi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.43 +..B1.22: + orl $-64768, %esi + movw %si, 12(%esp) +..B1.23: + fldcw 12(%esp) +..B1.24: + movzwl 16(%ebp), %eax + movl %eax, %ebx + movl $1, %edx + andl $32767, %ebx +..B1.25: + cmpl $16417, %ebx + jge ..B1.34 +..B1.26: + fldt 8(%ebp) + cmpl $16388, %ebx + jge ..B1.28 +..B1.27: + fldl _TWO_52H@GOTOFF(%ecx) + lea 8+_ones@GOTOFF(%ecx), %eax + fld %st(0) + fld %st(2) + fadd %st(2), %st + fsub %st(2), %st + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + faddl (%eax) + fld %st(0) + fadd %st(2), %st + fsqrt + fadd %st, %st(4) + fxch %st(5) + fsubrp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(1) + fld %st(3) + fxch %st(4) + fsubr %st, %st(5) + fxch %st(4) + fmul %st(5), %st + fsubrp %st, %st(1) + faddp %st, %st(1) + fld %st(2) + fadd %st(4), %st + fdivrp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(1) + fstpt 16(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl -8(%eax) + jmp ..B1.33 +..B1.28: + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + lea _ones@GOTOFF(%ecx), %eax + fmul %st(1), %st + fld %st(0) + fldl _TWO_32H@GOTOFF(%ecx) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fsubr %st(1), %st + fldl (%eax) + addl $8, %eax + cmpl $16394, %ebx + fldl (%eax) + jge ..B1.30 +..B1.29: + fstp %st(3) + fld %st(3) + fadd %st(3), %st + fld %st(4) + fadd %st(2), %st + fmulp %st, %st(1) + fsqrt + faddp %st, %st(4) + fxch %st(3) + fdivrp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + jmp ..B1.33 +..B1.30: + fstp %st(4) + cmpl $16401, %ebx + jge ..B1.32 +..B1.31: + fld %st(3) + fdiv %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fdivrp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.33 +..B1.32: + fxch %st(2) + fdivrp %st, %st(3) + faddp %st, %st(2) +..B1.33: + fldt 16(%esp) + fld %st(0) + fadd %st(3), %st + fstpt 8(%ebp) + movzwl 16(%ebp), %ebx + andl $32767, %ebx + movl %ebx, %esi + addl $-16383, %ebx + negl %esi + fxch %st(1) + fstpt (%esp) + addl $-2, %esi + movzwl 8(%esp), %edi + andl $32767, %esi + andl $-32768, %edi + orl %esi, %edi + movw %di, 8(%esp) + fldt (%esp) + fmul %st, %st(1) + fxch %st(1) + fstpt 16(%esp) + fmulp %st, %st(1) + jmp ..B1.35 +..B1.34: + fldl _TWO_52H@GOTOFF(%ecx) + andl $-32768, %eax + orl $-49153, %eax + addl $-16382, %ebx + movw %ax, 16(%ebp) + lea 8+_ones@GOTOFF(%ecx), %eax + fldt 8(%ebp) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(1) +..B1.35: + fldt 16(%esp) + fldt 60+_P@GOTOFF(%ecx) + fldt 36+_P@GOTOFF(%ecx) + fldt 12+_P@GOTOFF(%ecx) + movl 12(%ebp), %esi + shrl $23, %esi + andl $255, %esi + movl %ebx, (%esp) + fildl (%esp) + flds __libm_rcp_table_256@GOTOFF(%ecx,%esi,4) + fmul %st, %st(5) + fmulp %st, %st(6) + fxch %st(4) + faddl (%eax) + fld %st(0) + shll $4, %esi + fadd %st(6), %st + fld %st(0) + testl %edx, %edx + fmul %st(1), %st + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fstpt 8(%ebp) + fldt 48+_P@GOTOFF(%ecx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmul %st(2), %st + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + fmulp %st, %st(3) + faddl 8+__libm_logl_table_256@GOTOFF(%ecx,%esi) + faddp %st, %st(3) + fxch %st(1) + faddl __libm_logl_table_256@GOTOFF(%esi,%ecx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.37 +..B1.36: + fldcw 14(%esp) +..B1.37: + fldt 16(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + xorl %eax, %eax + jmp ..B1.11 +..B1.39: + cmpl $-2147483648, %edi + jne ..B1.7 +..B1.40: + cmpl $0, 8(%ebp) + jne ..B1.7 +..B1.41: + fldl _zeros@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.42: + xorl %eax, %eax + jmp ..B1.18 +..B1.43: + xorl %edx, %edx + jmp ..B1.25 +..B1.44: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.57 +..B1.45: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.46: + fldcw 12(%esp) +..B1.47: + movzwl 16(%ebp), %ebx + movl $1, %edx + andl $32767, %ebx +..B1.48: + cmpl $32767, %ebx + jne ..B1.53 +..B1.49: + cmpl $-2147483648, 12(%ebp) + jne ..B1.52 +..B1.50: + cmpl $0, 8(%ebp) + jne ..B1.52 +..B1.51: + movzbl 17(%ebp), %eax + testl $128, %eax + jne ..B1.53 +..B1.52: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.54 +..B1.53: + fldl _infs@GOTOFF(%ecx) + fmull _zeros@GOTOFF(%ecx) + fstpt (%esp) +..B1.54: + testl %edx, %edx + je ..B1.56 +..B1.55: + fldcw 14(%esp) +..B1.56: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.57: + xorl %edx, %edx + jmp ..B1.48 + .align 16,0x90 + .type acoshl,@function + .size acoshl,.-acoshl + .data +# -- End acoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49147 + .word 0 + .word 37372 + .word 39321 + .word 39321 + .word 39321 + .word 16377 + .word 0 + .word 18586 + .word 55971 + .word 28086 + .word 46811 + .word 49143 + .word 0 + .word 15813 + .word 59837 + .word 36396 + .word 63715 + .word 16373 + .word 0 + .word 53727 + .word 45078 + .word 40330 + .word 46917 + .word 49140 + .word 0 + .word 48396 + .word 8155 + .word 33124 + .word 36271 + .word 16371 + .word 0 + .type _Q1,@object + .size _Q1,72 + .align 2 +_Q: + .word 48098 + .word 43690 + .word 43690 + .word 43690 + .word 16366 + .word 0 + .word 20923 + .word 52462 + .word 52428 + .word 52428 + .word 49132 + .word 0 + .word 38527 + .word 56172 + .word 28086 + .word 46811 + .word 49143 + .word 0 + .word 47050 + .word 58060 + .word 36408 + .word 63715 + .word 16373 + .word 0 + .word 28121 + .word 12720 + .word 53620 + .word 46917 + .word 49140 + .word 0 + .word 5738 + .word 23392 + .word 25199 + .word 36391 + .word 16371 + .word 0 + .word 9822 + .word 24561 + .word 52037 + .word 58572 + .word 49137 + .word 0 + .word 32045 + .word 31633 + .word 41878 + .word 48451 + .word 16368 + .word 0 + .word 16262 + .word 24754 + .word 13643 + .word 40941 + .word 49135 + .word 0 + .word 36557 + .word 45689 + .word 21168 + .word 35169 + .word 16366 + .word 0 + .word 29793 + .word 40103 + .word 23573 + .word 60969 + .word 49132 + .word 0 + .word 51189 + .word 17117 + .word 14297 + .word 51855 + .word 16363 + .word 0 + .word 6461 + .word 12463 + .word 55551 + .word 38957 + .word 49130 + .word 0 + .word 34939 + .word 19802 + .word 20012 + .word 37205 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43696 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16377 + .word 0 + .type _Q,@object + .size _Q,192 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .type _P,@object + .size _P,72 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/acosl.S b/external/sgx_libm/ia32/acosl.S new file mode 100644 index 0000000000..d13c14dad3 --- /dev/null +++ b/external/sgx_libm/ia32/acosl.S @@ -0,0 +1,1211 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acosl.c" + .text +..TXTST0: +# -- Begin acosl + .text + .align 16,0x90 + .globl acosl +acosl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $88, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %edx + movzwl 16(%ebp), %eax + andl $128, %edx + andl $32767, %eax + shrl $7, %edx + movzwl 14(%esp), %ecx + cmpl $16383, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jge ..B1.60 +..B1.4: + cmpl $16382, %eax + jge ..B1.47 +..B1.5: + cmpl $16376, %eax + jge ..B1.37 +..B1.6: + cmpl $16371, %eax + jge ..B1.30 +..B1.7: + cmpl $16365, %eax + jge ..B1.23 +..B1.8: + cmpl $16308, %eax + jge ..B1.16 +..B1.9: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.78 +..B1.10: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.11: + fldcw 12(%esp) +..B1.12: + movl $1, %eax +..B1.13: + fldt 12+_pi_02@GOTOFF(%ebx) + testl %eax, %eax + fldt _pi_02@GOTOFF(%ebx) + fldt 8(%ebp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.15 +..B1.14: + fldcw 14(%esp) +..B1.15: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.79 +..B1.17: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.18: + fldcw 12(%esp) +..B1.19: + movl $1, %eax +..B1.20: + fldt 8(%ebp) + testl %eax, %eax + fldt _P4@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fldt 12+_pi_02@GOTOFF(%ebx) + fsubp %st, %st(1) + fldt _pi_02@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.22 +..B1.21: + fldcw 14(%esp) +..B1.22: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.80 +..B1.24: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.25: + fldcw 12(%esp) +..B1.26: + movl $1, %eax +..B1.27: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_P3@GOTOFF(%ebx) + fmul %st(1), %st + fldt _P3@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fldt 12+_pi_02@GOTOFF(%ebx) + fsubp %st, %st(1) + fldt _pi_02@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.29 +..B1.28: + fldcw 14(%esp) +..B1.29: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.30: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.81 +..B1.31: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.32: + fldcw 12(%esp) +..B1.33: + movl $1, %eax +..B1.34: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fld %st(2) + fld %st(3) + fldl _TWO_32H@GOTOFF(%ebx) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fsub %st(1), %st + fldt 36+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_P2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_P2@GOTOFF(%ebx) + fmulp %st, %st(4) + fldt _P2@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(4) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 12+_pi_02@GOTOFF(%ebx) + fsubp %st, %st(1) + fldt _pi_02@GOTOFF(%ebx) + fsubp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.36 +..B1.35: + fldcw 14(%esp) +..B1.36: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.37: + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.82 +..B1.38: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.39: + fldcw 12(%esp) +..B1.40: + movzwl 16(%ebp), %eax + movl $1, %edx + andl $32767, %eax +..B1.41: + fldt 8(%ebp) + cmpl $16381, %eax + fld %st(0) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fldl _TWO_52H@GOTOFF(%ebx) + fmul %st, %st(2) + fstpt 32(%esp) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fld %st(1) + fsub %st(3), %st + fmul %st, %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fld %st(3) + fmul %st(4), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fld %st(2) + fmul %st(2), %st + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fld %st(1) + fmul %st(2), %st + fadd %st, %st(1) + fxch %st(3) + fstpt 16(%esp) + jge ..B1.43 +..B1.42: + fstp %st(2) + fldt 132+_P1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_P1@GOTOFF(%ebx) + fldt 120+_P1@GOTOFF(%ebx) + fmul %st(4), %st + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt _P1@GOTOFF(%ebx) + faddp %st, %st(3) + fldt 48(%esp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 16(%esp) + fldt 144+_P1@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + fxch %st(1) + jmp ..B1.44 +..B1.43: + fldt 204+_P@GOTOFF(%ebx) + fmul %st(1), %st + fldt 180+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 156+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 132+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 192+_P@GOTOFF(%ebx) + fmul %st(2), %st + fldt 168+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 144+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 120+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _P@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 48(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 64(%esp) + fldt 16(%esp) + fldt 228+_P@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(4) + fldt 216+_P@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fld %st(3) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 32(%esp) + fmul %st(3), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) +..B1.44: + fldt (%esp) + testl %edx, %edx + fmulp %st, %st(1) + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + faddp %st, %st(2) + fmul %st(2), %st + faddp %st, %st(2) + fldt _pi_02@GOTOFF(%ebx) + fld %st(0) + fsubr %st(3), %st + fchs + fsub %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt 12+_pi_02@GOTOFF(%ebx) + fsubp %st, %st(2) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.46 +..B1.45: + fldcw 14(%esp) +..B1.46: + fldt 16(%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.47: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.83 +..B1.48: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.49: + fldcw 12(%esp) +..B1.50: + movl $1, %ecx +..B1.51: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx,%edx,8) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fldl _TWO_32H@GOTOFF(%ebx) + fldl _TWO_52H@GOTOFF(%ebx) + fstpt 16(%esp) + fldt 16(%esp) + fxch %st(3) + fsubrl _ones@GOTOFF(%ebx) + fmul %st(2), %st + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fxch %st(1) + fsub %st(2), %st + fadd %st, %st(1) + fxch %st(1) + fsqrt + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fsubr %st, %st(3) + fld %st(5) + fxch %st(2) + fsub %st(6), %st + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fld %st(4) + fadd %st(1), %st + fdivrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(2) + fadd %st(2), %st + fld %st(0) + fmul %st(3), %st + fld %st(4) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fstpt 48(%esp) + fldt 48(%esp) + fld %st(1) + fmul %st(4), %st + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fstpt (%esp) + fld %st(2) + fmul %st(3), %st + fadd %st, %st(1) + fxch %st(2) + fstpt 64(%esp) + fldt 64(%esp) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jbe ..B1.53 +..B1.52: + fstp %st(1) + fldt 132+_P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_P1@GOTOFF(%ebx) + fldt 120+_P1@GOTOFF(%ebx) + fmul %st(3), %st + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _P1@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 48(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%esp) + fldt 144+_P1@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(2) + fxch %st(1) + jmp ..B1.54 +..B1.53: + fldt 204+_P@GOTOFF(%ebx) + fmul %st(1), %st + fldt 180+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 156+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 132+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 192+_P@GOTOFF(%ebx) + fmul %st(2), %st + fldt 168+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 144+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 120+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _P@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 48(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 32(%esp) + fldt (%esp) + fldt 228+_P@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fldt 216+_P@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fldt 16(%esp) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) +..B1.54: + fldt 64(%esp) + testl %edx, %edx + fmulp %st, %st(2) + fld %st(2) + fmul %st(1), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + je ..B1.56 +..B1.55: + fstp %st(1) + fstp %st(2) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fmul %st, %st(2) + fmulp %st, %st(1) + fldt _pi_00@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fldt 12+_pi_00@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.57 +..B1.56: + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fxch %st(1) + fsub %st, %st(4) + fxch %st(4) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt (%esp) +..B1.57: + testl %ecx, %ecx + je ..B1.59 +..B1.58: + fldcw 14(%esp) +..B1.59: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.60: + movl %ecx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.84 +..B1.61: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.62: + fldcw 12(%esp) +..B1.63: + movzwl 16(%ebp), %eax + movl $1, %ecx + andl $32767, %eax +..B1.64: + cmpl $32767, %eax + jne ..B1.68 +..B1.65: + cmpl $-2147483648, 12(%ebp) + jne ..B1.67 +..B1.66: + cmpl $0, 8(%ebp) + je ..B1.74 +..B1.67: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt (%esp) + jmp ..B1.75 +..B1.68: + cmpl $16383, %eax + jne ..B1.74 +..B1.69: + cmpl $-2147483648, 12(%ebp) + jne ..B1.74 +..B1.70: + cmpl $0, 8(%ebp) + jne ..B1.74 +..B1.71: + testl %edx, %edx + je ..B1.73 +..B1.72: + fldt _pi_0l@GOTOFF(%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fsubrp %st, %st(1) + fstpt (%esp) + jmp ..B1.75 +..B1.73: + fldl _zeros@GOTOFF(%ebx) + fstpt (%esp) + jmp ..B1.75 +..B1.74: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt (%esp) +..B1.75: + testl %ecx, %ecx + je ..B1.77 +..B1.76: + fldcw 14(%esp) +..B1.77: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + xorl %eax, %eax + jmp ..B1.13 +..B1.79: + xorl %eax, %eax + jmp ..B1.20 +..B1.80: + xorl %eax, %eax + jmp ..B1.27 +..B1.81: + xorl %eax, %eax + jmp ..B1.34 +..B1.82: + xorl %edx, %edx + jmp ..B1.41 +..B1.83: + xorl %ecx, %ecx + jmp ..B1.51 +..B1.84: + xorl %ecx, %ecx + jmp ..B1.64 + .align 16,0x90 + .type acosl,@function + .size acosl,.-acosl + .data +# -- End acosl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_pi_02: + .word 0 + .word 0 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 35374 + .word 4889 + .word 2259 + .word 34211 + .word 16349 + .word 0 + .type _pi_02,@object + .size _pi_02,24 + .align 2 +_P4: + .word 43691 + .word 44938 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _P4,@object + .size _P4,12 + .align 2 +_P3: + .word 36763 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 40704 + .word 58046 + .word 39460 + .word 39321 + .word 16379 + .word 0 + .type _P3,@object + .size _P3,24 + .align 2 +_P2: + .word 43688 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 20771 + .word 39331 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 23807 + .word 53798 + .word 28073 + .word 46811 + .word 16378 + .word 0 + .word 35198 + .word 7516 + .word 54204 + .word 63722 + .word 16377 + .word 0 + .type _P2,@object + .size _P2,48 + .align 2 +_P1: + .word 43589 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 39364 + .word 39321 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 17602 + .word 56173 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 47501 + .word 58414 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 27078 + .word 6583 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 39781 + .word 21053 + .word 25224 + .word 36391 + .word 16377 + .word 0 + .word 46568 + .word 6235 + .word 50749 + .word 58572 + .word 16376 + .word 0 + .word 41318 + .word 51558 + .word 37628 + .word 48452 + .word 16376 + .word 0 + .word 55026 + .word 7893 + .word 43866 + .word 40925 + .word 16376 + .word 0 + .word 43387 + .word 19951 + .word 2911 + .word 35445 + .word 16376 + .word 0 + .word 32572 + .word 59281 + .word 11243 + .word 56666 + .word 16375 + .word 0 + .word 49800 + .word 50337 + .word 42707 + .word 39184 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .type _P1,@object + .size _P1,156 + .align 2 +_P: + .word 42691 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 4317 + .word 52400 + .word 52428 + .word 52428 + .word 49134 + .word 0 + .word 26206 + .word 56172 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 36130 + .word 58514 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 21592 + .word 8113 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 3093 + .word 49950 + .word 25215 + .word 36391 + .word 16377 + .word 0 + .word 21499 + .word 24428 + .word 51889 + .word 58572 + .word 16376 + .word 0 + .word 54828 + .word 41264 + .word 61120 + .word 48451 + .word 16376 + .word 0 + .word 10243 + .word 1489 + .word 39717 + .word 40940 + .word 16376 + .word 0 + .word 51433 + .word 46039 + .word 63564 + .word 35220 + .word 16376 + .word 0 + .word 60402 + .word 39286 + .word 25675 + .word 60826 + .word 16375 + .word 0 + .word 34219 + .word 36833 + .word 44839 + .word 57547 + .word 16375 + .word 0 + .word 13013 + .word 26091 + .word 19721 + .word 60832 + .word 16374 + .word 0 + .word 22353 + .word 41544 + .word 55443 + .word 55735 + .word 16376 + .word 0 + .word 14948 + .word 7038 + .word 38091 + .word 38339 + .word 49145 + .word 0 + .word 61727 + .word 61480 + .word 15906 + .word 51927 + .word 16378 + .word 0 + .word 13386 + .word 23084 + .word 64443 + .word 55906 + .word 49146 + .word 0 + .word 17499 + .word 23573 + .word 43947 + .word 42761 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16379 + .word 0 + .type _P,@object + .size _P,240 + .align 2 +_pi_00: + .word 0 + .word 0 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 35374 + .word 4889 + .word 2259 + .word 34211 + .word 16350 + .word 0 + .type _pi_00,@object + .size _pi_00,24 + .align 2 +_pi_0l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49152 + .word 0 + .type _pi_0l,@object + .size _pi_0l,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/asin_wmt.S b/external/sgx_libm/ia32/asin_wmt.S new file mode 100644 index 0000000000..f15bcefa0d --- /dev/null +++ b/external/sgx_libm/ia32/asin_wmt.S @@ -0,0 +1,2008 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asin_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin asin + .text + .align 16,0x90 + .globl asin +asin: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + stmxcsr 16(%esp) + movl 16(%esp), %edx + andl $-24577, %edx + cmpl %edx, 16(%esp) + jne .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + movsd 5984(%ebx), %xmm4 + movsd 6016(%ebx), %xmm3 + xorpd %xmm5, %xmm5 + movsd 6000(%ebx), %xmm2 + movl $8192, %ecx + pinsrw $2, %ecx, %xmm5 + movapd %xmm0, %xmm1 + movsd %xmm0, 8(%esp) + psrlq $44, %xmm0 + movd %xmm0, %edx + movapd %xmm1, %xmm7 + movl $8192, %ecx + pinsrw $2, %ecx, %xmm5 + movapd %xmm1, %xmm0 + movl $524287, %eax + andl %edx, %eax + subl $260864, %eax + cmpl $955, %eax + jae .L_2TAG_PACKET_2.0.3 + mulsd %xmm1, %xmm1 + andl $65535, %edx + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + andpd %xmm7, %xmm2 + andl $-4, %edx + subl $64256, %edx + movsd 3936(%ebx,%edx,2), %xmm1 + orpd %xmm5, %xmm2 + movapd 96(%ebx,%edx,4), %xmm4 + movapd %xmm7, %xmm6 + addsd %xmm2, %xmm7 + subsd %xmm2, %xmm0 + mulsd %xmm7, %xmm0 + mulsd %xmm1, %xmm6 + mulsd %xmm2, %xmm3 + movapd %xmm6, %xmm1 + addsd %xmm3, %xmm6 + divsd %xmm6, %xmm0 + movsd 80(%ebx), %xmm7 + movsd 64(%ebx), %xmm5 + subsd %xmm3, %xmm1 + andpd 6064(%ebx), %xmm2 + movapd %xmm1, %xmm3 + mulsd %xmm1, %xmm1 + movsd 72(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm7 + mulsd %xmm3, %xmm5 + xorpd %xmm2, %xmm4 + mulsd %xmm1, %xmm3 + addsd %xmm7, %xmm6 + mulsd %xmm3, %xmm6 + addsd %xmm4, %xmm5 + pshufd $238, %xmm4, %xmm4 + addsd %xmm5, %xmm6 + orpd %xmm2, %xmm4 + addsd %xmm6, %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_3.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_3.0.3: + addsd %xmm4, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_2.0.3: + subl $955, %eax + cmpl $67, %eax + jae .L_2TAG_PACKET_5.0.3 + mulsd %xmm1, %xmm1 + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + movl %edx, %eax + andpd 5984(%ebx), %xmm0 + andpd 6048(%ebx), %xmm7 + movapd %xmm0, %xmm1 + movsd 6016(%ebx), %xmm4 + movapd %xmm7, %xmm6 + subsd %xmm7, %xmm1 + mulsd %xmm7, %xmm7 + addsd %xmm6, %xmm0 + subsd %xmm7, %xmm4 + mulsd %xmm1, %xmm0 + movapd %xmm3, %xmm7 + andpd %xmm3, %xmm2 + psllq $2, %xmm3 + pextrw $3, %xmm3, %edx + orpd %xmm5, %xmm2 + subl $65216, %edx + addl %edx, %edx + mulsd 3936(%ebx,%edx,4), %xmm7 + mulsd %xmm2, %xmm6 + movapd 6080(%ebx), %xmm3 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + subsd %xmm7, %xmm6 + addsd %xmm1, %xmm6 + subsd %xmm2, %xmm4 + addsd %xmm7, %xmm7 + movsd 64(%ebx), %xmm5 + subsd %xmm0, %xmm4 + addsd %xmm6, %xmm7 + movsd 80(%ebx), %xmm0 + divsd %xmm7, %xmm4 + movsd 72(%ebx), %xmm2 + subpd 96(%ebx,%edx,8), %xmm3 + movapd %xmm6, %xmm1 + mulsd %xmm6, %xmm6 + andl $524288, %eax + shrl $4, %eax + mulsd %xmm6, %xmm0 + mulsd %xmm6, %xmm1 + mulsd %xmm1, %xmm5 + mulsd %xmm6, %xmm1 + addsd %xmm2, %xmm0 + pxor %xmm6, %xmm6 + mulsd %xmm1, %xmm0 + addsd %xmm3, %xmm5 + pinsrw $3, %eax, %xmm6 + addsd %xmm5, %xmm0 + movapd %xmm4, %xmm5 + pshufd $238, %xmm3, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm3 + subsd %xmm3, %xmm5 + subsd %xmm5, %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_6.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_6.0.3: + xorpd %xmm6, %xmm0 + xorpd %xmm6, %xmm4 + subsd %xmm4, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + addl $15291, %eax + cmpl $14336, %eax + jae .L_2TAG_PACKET_7.0.3 + unpcklpd %xmm7, %xmm7 + movapd (%ebx), %xmm1 + movapd %xmm7, %xmm6 + movapd 16(%ebx), %xmm2 + movapd 32(%ebx), %xmm4 + mulpd %xmm7, %xmm7 + mulpd %xmm7, %xmm6 + mulpd %xmm7, %xmm1 + mulpd %xmm7, %xmm7 + movapd %xmm6, %xmm3 + mulsd %xmm6, %xmm6 + addpd %xmm2, %xmm1 + mulpd %xmm7, %xmm4 + mulsd %xmm3, %xmm6 + addpd %xmm4, %xmm1 + mulpd %xmm6, %xmm1 + pshufd $238, %xmm1, %xmm2 + addsd %xmm2, %xmm1 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_8.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_8.0.3: + addsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_7.0.3: + subl $15358, %eax + cmpl $2, %eax + jae .L_2TAG_PACKET_9.0.3 + mulsd %xmm1, %xmm1 + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + movl %edx, %eax + andpd 6032(%ebx), %xmm7 + pshufd $68, %xmm3, %xmm5 + andpd 6032(%ebx), %xmm3 + movapd %xmm7, %xmm1 + movsd 6016(%ebx), %xmm4 + movapd %xmm7, %xmm6 + subsd %xmm7, %xmm0 + mulsd %xmm7, %xmm7 + addsd %xmm1, %xmm1 + mulsd %xmm0, %xmm1 + subsd %xmm7, %xmm4 + movapd %xmm3, %xmm6 + mulsd %xmm3, %xmm3 + mulsd %xmm0, %xmm0 + subsd %xmm1, %xmm4 + subsd %xmm5, %xmm6 + addsd %xmm5, %xmm5 + subsd %xmm3, %xmm4 + movapd (%ebx), %xmm2 + pshufd $238, %xmm5, %xmm3 + subsd %xmm0, %xmm4 + addsd %xmm6, %xmm5 + pshufd $238, %xmm3, %xmm7 + addsd %xmm3, %xmm3 + mulsd %xmm6, %xmm5 + addsd %xmm5, %xmm4 + pshufd $238, %xmm7, %xmm6 + divsd %xmm3, %xmm4 + movapd 48(%ebx), %xmm1 + movapd 16(%ebx), %xmm5 + movapd 32(%ebx), %xmm0 + mulpd %xmm7, %xmm7 + movapd %xmm6, %xmm3 + mulpd %xmm7, %xmm2 + mulpd %xmm7, %xmm6 + shrl $4, %eax + andl $32768, %eax + mulsd %xmm7, %xmm1 + mulpd %xmm7, %xmm7 + addpd %xmm2, %xmm5 + movapd %xmm6, %xmm2 + mulsd %xmm6, %xmm6 + mulpd %xmm0, %xmm7 + movapd 6080(%ebx), %xmm0 + mulsd %xmm6, %xmm2 + addpd %xmm5, %xmm7 + pshufd $238, %xmm1, %xmm5 + mulsd %xmm2, %xmm6 + mulpd %xmm2, %xmm7 + addsd %xmm5, %xmm1 + xorpd %xmm5, %xmm5 + pshufd $238, %xmm7, %xmm2 + mulsd %xmm6, %xmm1 + pshufd $238, %xmm0, %xmm6 + addsd %xmm2, %xmm7 + movapd %xmm3, %xmm2 + pinsrw $3, %eax, %xmm5 + subsd %xmm6, %xmm3 + addsd %xmm1, %xmm0 + addsd %xmm3, %xmm6 + addsd %xmm4, %xmm7 + subsd %xmm6, %xmm2 + subsd %xmm7, %xmm0 + subsd %xmm2, %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_10.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_10.0.3: + xorpd %xmm5, %xmm0 + xorpd %xmm5, %xmm3 + subsd %xmm3, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_9.0.3: + addl $261886, %eax + cmpl $261888, %eax + jb .L_2TAG_PACKET_11.0.3 + movd %xmm0, %ecx + psrlq $32, %xmm0 + movd %xmm0, %edx + andl $2147483647, %edx + movl $1072693248, %eax + subl %edx, %eax + orl %ecx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_12.0.3 + movq 8(%esp), %xmm2 + movd %xmm2, %edx + psrlq $32, %xmm2 + movd %xmm2, %ecx + andl $2147483647, %ecx + subl $1, %edx + sbbl $2146435072, %ecx + cmpl $0, %ecx + jge .L_2TAG_PACKET_11.0.3 + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %edx + pinsrw $3, %edx, %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $61, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_13.0.3 +.L_2TAG_PACKET_12.0.3: + movsd 5984(%ebx), %xmm1 + movsd 6080(%ebx), %xmm2 + movsd 6088(%ebx), %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_14.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_14.0.3: + andnpd %xmm7, %xmm1 + orpd %xmm1, %xmm0 + orpd %xmm1, %xmm2 + addsd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_0.0.3: + movl 16(%esp), %edx + andl $-24577, %edx + movl %edx, 24(%esp) + ldmxcsr 24(%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_11.0.3: + movsd 8(%esp), %xmm0 + xorpd %xmm6, %xmm6 + movapd %xmm0, %xmm7 + pextrw $3, %xmm0, %edx + andl $32752, %edx + subl $16, %edx + cmpl $32736, %edx + jb .L_2TAG_PACKET_15.0.3 + addsd %xmm0, %xmm6 + orpd %xmm6, %xmm0 + mulsd %xmm0, %xmm7 +.L_2TAG_PACKET_15.0.3: + movsd %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_13.0.3: + movl 16(%esp), %edx + andl $-24577, %edx + cmpl 16(%esp), %edx + je .L_2TAG_PACKET_4.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %edx + andl $24576, %edx + orl %edx, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_4.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type asin,@function + .size asin,.-asin + .data +# -- End asin + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 780903145 + .long 1066854586 + .long 858993459 + .long 1068708659 + .long 3340530119 + .long 1067392113 + .long 1431655765 + .long 1069897045 + .long 1321528399 + .long 1066517740 + .long 3067833783 + .long 1067899757 + .long 2021159460 + .long 1065855096 + .long 2576980378 + .long 1066178969 + .long 1431655765 + .long 1069897045 + .long 858993459 + .long 1068708659 + .long 3067833783 + .long 1067899757 + .long 0 + .long 0 + .long 3822952792 + .long 1021639372 + .long 182792448 + .long 1068507836 + .long 2264213271 + .long 1019558908 + .long 649052928 + .long 1068524253 + .long 1797139609 + .long 1022295143 + .long 1243095296 + .long 1068540671 + .long 1415938756 + .long 1021439537 + .long 2033294592 + .long 1068557090 + .long 2356809978 + .long 1021777916 + .long 3088063744 + .long 1068573510 + .long 2669055318 + .long 1022124482 + .long 180888576 + .long 1068589932 + .long 3566445325 + .long 1021358712 + .long 1970196992 + .long 1068606354 + .long 896980323 + .long 1021319659 + .long 4229555456 + .long 1068622777 + .long 436049712 + .long 1021319758 + .long 2732572160 + .long 1068639202 + .long 583123209 + .long 1020797960 + .long 1842831872 + .long 1068655628 + .long 1370449804 + .long 1021429270 + .long 1628994560 + .long 1068672055 + .long 2411391464 + .long 1021057980 + .long 2159763712 + .long 1068688483 + .long 1208692749 + .long 1021943903 + .long 3503886336 + .long 1068704912 + .long 538793309 + .long 1019744063 + .long 1435187200 + .long 1068721343 + .long 4085087612 + .long 1020608419 + .long 317469952 + .long 1068737775 + .long 144386942 + .long 1021440732 + .long 219617280 + .long 1068754208 + .long 2940088361 + .long 1019981122 + .long 1210558208 + .long 1068770642 + .long 2176850347 + .long 1018373705 + .long 3359268352 + .long 1068787077 + .long 2395611454 + .long 1021889042 + .long 2439803648 + .long 1068803514 + .long 1650705253 + .long 1020227966 + .long 2816203520 + .long 1068819952 + .long 3702166386 + .long 1019379914 + .long 262620672 + .long 1068836392 + .long 1855649370 + .long 1020453124 + .long 3438159616 + .long 1068852832 + .long 923063860 + .long 1019273834 + .long 3822105856 + .long 1068869274 + .long 4289947947 + .long 1019434249 + .long 1483729920 + .long 1068885718 + .long 787455814 + .long 1020738379 + .long 787321088 + .long 1068902163 + .long 3321653337 + .long 1021842569 + .long 1802253312 + .long 1068918609 + .long 2653633526 + .long 1021821525 + .long 302985984 + .long 1068935057 + .long 161272028 + .long 1021655149 + .long 653966080 + .long 1068951506 + .long 2566098667 + .long 1020066219 + .long 2924727296 + .long 1068967956 + .long 3646493722 + .long 1014292285 + .long 2889890304 + .long 1068984408 + .long 1081009196 + .long 1022189620 + .long 619098112 + .long 1069000862 + .long 4011643355 + .long 1021773297 + .long 477017600 + .long 1069017317 + .long 4030305534 + .long 1021292252 + .long 2533403904 + .long 1069033773 + .long 2645187591 + .long 1019527099 + .long 2563102208 + .long 1069050231 + .long 3857293792 + .long 1022311697 + .long 635982336 + .long 1069066691 + .long 3625936637 + .long 1017511744 + .long 1116940800 + .long 1069083152 + .long 3653872993 + .long 1022016631 + .long 4075964160 + .long 1069099614 + .long 2468900271 + .long 1021769532 + .long 993165568 + .long 1069116079 + .long 1358104224 + .long 1021199776 + .long 528586752 + .long 1069132545 + .long 2200950332 + .long 1022024872 + .long 2752395776 + .long 1069149012 + .long 3197072454 + .long 1017751319 + .long 3439855616 + .long 1069165481 + .long 1651081806 + .long 1020809338 + .long 2661257728 + .long 1069181952 + .long 539032752 + .long 1021728805 + .long 486957312 + .long 1069198425 + .long 3136045149 + .long 1016888671 + .long 1282340352 + .long 1069214899 + .long 2593963259 + .long 1018956103 + .long 822921728 + .long 1069231375 + .long 2146032737 + .long 1022306465 + .long 3474216192 + .long 1069247852 + .long 3976811625 + .long 1021350207 + .long 716902656 + .long 1069264332 + .long 718267222 + .long 1018624727 + .long 1211594496 + .long 1069280813 + .long 1485641389 + .long 1018447451 + .long 734070272 + .long 1069297296 + .long 354455128 + .long 1021341291 + .long 3650110720 + .long 1069313780 + .long 682185947 + .long 1021651853 + .long 1440663040 + .long 1069330267 + .long 3558574550 + .long 1021615110 + .long 2766612224 + .long 1069346755 + .long 874607978 + .long 1017746872 + .long 3404011008 + .long 1069363245 + .long 4154988502 + .long 1021439906 + .long 3423949056 + .long 1069379737 + .long 2263202309 + .long 1021479615 + .long 2897587712 + .long 1069396231 + .long 2562065031 + .long 1022090363 + .long 1896159232 + .long 1069412727 + .long 3836237663 + .long 1019867288 + .long 490968576 + .long 1069429225 + .long 3322056743 + .long 1006752762 + .long 3048360192 + .long 1069445724 + .long 1152314833 + .long 1013122252 + .long 1049850624 + .long 1069462226 + .long 3601590727 + .long 1022214610 + .long 3156899584 + .long 1069478729 + .long 1855169970 + .long 1019487271 + .long 851173376 + .long 1069495235 + .long 312649594 + .long 1020868604 + .long 2794281728 + .long 1069511742 + .long 1093490181 + .long 1020777577 + .long 468042496 + .long 1069528252 + .long 1152540679 + .long 1021403732 + .long 2534219264 + .long 1069544763 + .long 2292126035 + .long 1021872430 + .long 1376146432 + .long 1069558527 + .long 3293753641 + .long 1020500454 + .long 4175442432 + .long 1069575044 + .long 3626347564 + .long 1021610969 + .long 3523113472 + .long 1069591566 + .long 339956500 + .long 1021119039 + .long 4003350528 + .long 1069608092 + .long 3429333082 + .long 1022813542 + .long 1611067392 + .long 1069624623 + .long 2298017544 + .long 1021977587 + .long 931782144 + .long 1069641158 + .long 2164684743 + .long 1021250988 + .long 2256725504 + .long 1069657697 + .long 1138762335 + .long 1021443776 + .long 1582853120 + .long 1069674241 + .long 1084010382 + .long 1022994693 + .long 3497758720 + .long 1069690789 + .long 406366244 + .long 1022713586 + .long 3999816960 + .long 1069707342 + .long 1488723042 + .long 1023381290 + .long 3383096064 + .long 1069723900 + .long 2541558953 + .long 1019137887 + .long 1942403584 + .long 1069740463 + .long 1879620343 + .long 1022653642 + .long 4268263680 + .long 1069757030 + .long 3039077047 + .long 1022252545 + .long 2067062272 + .long 1069773603 + .long 4190670677 + .long 1020725863 + .long 4225828096 + .long 1069790180 + .long 1998567321 + .long 1022014385 + .long 2452507136 + .long 1069806763 + .long 1511628873 + .long 1021900300 + .long 1340746240 + .long 1069823351 + .long 788367341 + .long 1022726208 + .long 1190035456 + .long 1069839944 + .long 3856337230 + .long 1021834118 + .long 2300688384 + .long 1069856542 + .long 3211396579 + .long 1022621365 + .long 678886400 + .long 1069873146 + .long 4001011887 + .long 1022042646 + .long 921594112 + .long 1069889755 + .long 557811968 + .long 1023065533 + .long 3331668992 + .long 1069906369 + .long 1877060679 + .long 1022419742 + .long 3917875200 + .long 1069922989 + .long 1181055171 + .long 1022752712 + .long 2984829696 + .long 1069939615 + .long 4294526932 + .long 1021499988 + .long 838049024 + .long 1069956247 + .long 3658081878 + .long 1022957952 + .long 2078928384 + .long 1069972884 + .long 820353701 + .long 1019391107 + .long 2719854336 + .long 1069989527 + .long 1644022489 + .long 1023378240 + .long 3069117696 + .long 1070006176 + .long 2771393702 + .long 1019319954 + .long 3435962368 + .long 1070022831 + .long 3876394145 + .long 1023024433 + .long 4130595328 + .long 1070039492 + .long 1630447748 + .long 1021465882 + .long 1169236224 + .long 1070056160 + .long 2828355997 + .long 1020458120 + .long 3453997312 + .long 1070072833 + .long 164091641 + .long 1020388279 + .long 2708127744 + .long 1070089513 + .long 3036550223 + .long 1023328684 + .long 3540797696 + .long 1070106199 + .long 3710949463 + .long 1022568805 + .long 1972276736 + .long 1070122892 + .long 3885277950 + .long 1019761674 + .long 2613815552 + .long 1070139591 + .long 2764165077 + .long 1022921023 + .long 1487791616 + .long 1070156297 + .long 1330644769 + .long 1023162679 + .long 3207593472 + .long 1070173009 + .long 3911007221 + .long 1022993496 + .long 3797764608 + .long 1070189728 + .long 979712598 + .long 1022554580 + .long 3578920448 + .long 1070206454 + .long 2825738223 + .long 1020223708 + .long 2872795648 + .long 1070223187 + .long 392451124 + .long 1022666279 + .long 2002258432 + .long 1070239927 + .long 3730407632 + .long 1023148291 + .long 1291326464 + .long 1070256674 + .long 3723802980 + .long 1022514089 + .long 1065180928 + .long 1070273428 + .long 2635617463 + .long 1022654470 + .long 1650181632 + .long 1070290189 + .long 2061982883 + .long 1022853411 + .long 3373882880 + .long 1070306957 + .long 319732785 + .long 1022017175 + .long 2270081280 + .long 1070323733 + .long 2237757411 + .long 1023064087 + .long 2963732736 + .long 1070340516 + .long 468839165 + .long 1023293774 + .long 1491099904 + .long 1070357307 + .long 1502657946 + .long 1021533479 + .long 2479636480 + .long 1070374105 + .long 482913562 + .long 1021986286 + .long 1968133632 + .long 1070390911 + .long 3281474337 + .long 1022646400 + .long 291639040 + .long 1070407725 + .long 2453320259 + .long 1022812423 + .long 2081472512 + .long 1070424546 + .long 2939989570 + .long 1023091888 + .long 3380340480 + .long 1070441375 + .long 2850707499 + .long 1021921109 + .long 232287488 + .long 1070458213 + .long 3674625342 + .long 1020725130 + .long 1567614208 + .long 1070475058 + .long 9347334 + .long 1022024009 + .long 3433091072 + .long 1070491911 + .long 282524999 + .long 1021433523 + .long 1876877312 + .long 1070508773 + .long 3470449440 + .long 1019309721 + .long 1538472192 + .long 1070525643 + .long 2089486825 + .long 1019698916 + .long 2763830784 + .long 1070542521 + .long 443498115 + .long 1020505194 + .long 1605381632 + .long 1070559408 + .long 3018871601 + .long 1022869913 + .long 2706946048 + .long 1070576303 + .long 3936260892 + .long 1023175875 + .long 2123887360 + .long 1070593207 + .long 2994220655 + .long 1022825948 + .long 104015104 + .long 1070603108 + .long 335054493 + .long 1023441853 + .long 2904568832 + .long 1070615800 + .long 1451215633 + .long 1023853857 + .long 3456197120 + .long 1070632739 + .long 436334733 + .long 1024026432 + .long 252452352 + .long 1070649697 + .long 34596167 + .long 1024031396 + .long 3328018432 + .long 1070666672 + .long 2644547073 + .long 1024296758 + .long 1255829248 + .long 1070683667 + .long 552832586 + .long 1023763122 + .long 4097058560 + .long 1070700680 + .long 1955640623 + .long 1021394654 + .long 451770112 + .long 1070717714 + .long 3428903777 + .long 1022941142 + .long 408920832 + .long 1070734767 + .long 165503263 + .long 1023894958 + .long 1186960640 + .long 1070751840 + .long 435826450 + .long 1024026134 + .long 19078656 + .long 1070768934 + .long 1834169749 + .long 1022899284 + .long 2743490304 + .long 1070786048 + .long 494581074 + .long 1018818479 + .long 2328961024 + .long 1070803184 + .long 2987908834 + .long 1022581110 + .long 350011392 + .long 1070820342 + .long 240771184 + .long 1024143083 + .long 2692326912 + .long 1070837521 + .long 666056837 + .long 1022394776 + .long 2373274368 + .long 1070854723 + .long 2484337770 + .long 1024228156 + .long 1017131520 + .long 1070871948 + .long 3285648279 + .long 1024025789 + .long 265558272 + .long 1070889196 + .long 392241896 + .long 1024252809 + .long 1778008064 + .long 1070906467 + .long 1536107943 + .long 1023949300 + .long 2937184768 + .long 1070923762 + .long 3541062251 + .long 1019448646 + .long 1144442880 + .long 1070941082 + .long 3691683781 + .long 1022123948 + .long 2410165504 + .long 1070958426 + .long 1804181960 + .long 1023945221 + .long 4174350848 + .long 1070975795 + .long 2016094861 + .long 1021716585 + .long 3897012480 + .long 1070993190 + .long 175294410 + .long 1023703404 + .long 3353623040 + .long 1071010611 + .long 167973242 + .long 1023240839 + .long 45671168 + .long 1071028059 + .long 2166856113 + .long 1021565413 + .long 86063872 + .long 1071045533 + .long 2676254727 + .long 1023985299 + .long 1019772672 + .long 1071063034 + .long 989043593 + .long 1021549587 + .long 414297344 + .long 1071080563 + .long 3960972046 + .long 1024307251 + .long 155173120 + .long 1071098120 + .long 1830919291 + .long 1021592251 + .long 2151562240 + .long 1071115705 + .long 405408666 + .long 1023423128 + .long 4041854720 + .long 1071133319 + .long 2043497827 + .long 1024411503 + .long 3489224192 + .long 1071150963 + .long 3072215864 + .long 1022698635 + .long 2477196288 + .long 1071168637 + .long 1812195139 + .long 1022689192 + .long 3015298816 + .long 1071186341 + .long 764841969 + .long 1021027331 + .long 2844731136 + .long 1071204076 + .long 2878117321 + .long 1019116513 + .long 4028950528 + .long 1071221842 + .long 698911452 + .long 1023265602 + .long 69441536 + .long 1071239641 + .long 3253467847 + .long 1020795075 + .long 1676209920 + .long 1071257471 + .long 4272431167 + .long 1022873982 + .long 2408752384 + .long 1071275334 + .long 648519100 + .long 1024385717 + .long 151623680 + .long 1071293231 + .long 345257017 + .long 1019561408 + .long 1410154240 + .long 1071311161 + .long 197863993 + .long 1023224207 + .long 4131351552 + .long 1071329125 + .long 2620801789 + .long 1024411169 + .long 1999664384 + .long 1071347125 + .long 3952692616 + .long 1024168086 + .long 1617668864 + .long 1071365160 + .long 3019889809 + .long 1021907692 + .long 1032074240 + .long 1071383231 + .long 59469899 + .long 1023656194 + .long 2619492096 + .long 1071401338 + .long 1417526820 + .long 1021457783 + .long 202429440 + .long 1071419483 + .long 2927667935 + .long 1019175447 + .long 525044224 + .long 1071437665 + .long 38166811 + .long 1023981879 + .long 1779258880 + .long 1071455885 + .long 481252500 + .long 1023310234 + .long 2195673600 + .long 1071474144 + .long 3962395981 + .long 1021339088 + .long 44573696 + .long 1071492443 + .long 3936281395 + .long 1023014829 + .long 2226905344 + .long 1071510781 + .long 1515320476 + .long 1024320623 + .long 2800512512 + .long 1071529160 + .long 1225403697 + .long 1021081846 + .long 161113600 + .long 1071547581 + .long 3064809733 + .long 1024173917 + .long 1338410240 + .long 1071566043 + .long 2027604973 + .long 1024362526 + .long 522433280 + .long 1071584548 + .long 2055171723 + .long 1023858825 + .long 539595776 + .long 1071603096 + .long 3868820135 + .long 1022936424 + .long 4264017664 + .long 1071621687 + .long 3228065145 + .long 1023479578 + .long 1733924096 + .long 1071640324 + .long 3511934475 + .long 1022496355 + .long 108880384 + .long 1071651839 + .long 615880967 + .long 1023519706 + .long 3517856512 + .long 1071661202 + .long 3113108559 + .long 1025190289 + .long 4043153152 + .long 1071670589 + .long 1571836218 + .long 1023106116 + .long 3251299072 + .long 1071680000 + .long 3444076102 + .long 1022187841 + .long 2736921600 + .long 1071689435 + .long 272771483 + .long 1025095280 + .long 3897698560 + .long 1071703633 + .long 2075390188 + .long 1022489022 + .long 3209485056 + .long 1071722652 + .long 1438094065 + .long 1021844944 + .long 3781432064 + .long 1071741774 + .long 1675017145 + .long 1024143828 + .long 2684184064 + .long 1071761003 + .long 2259963753 + .long 1024731393 + .long 1840489728 + .long 1071780342 + .long 3372883597 + .long 1023431408 + .long 3764087808 + .long 1071799794 + .long 3307523102 + .long 1024485788 + .long 3006232320 + .long 1071819364 + .long 3088971966 + .long 1025213251 + .long 3374881280 + .long 1071839055 + .long 834437749 + .long 1025236452 + .long 797284864 + .long 1071858872 + .long 3122663941 + .long 1025320473 + .long 545765120 + .long 1071878818 + .long 826539625 + .long 1022450955 + .long 107562240 + .long 1071898898 + .long 339584600 + .long 1022481255 + .long 2123649024 + .long 1071919116 + .long 3912959833 + .long 1024321009 + .long 1562385664 + .long 1071939478 + .long 2846067230 + .long 1023343981 + .long 2963085824 + .long 1071959988 + .long 954548627 + .long 1021475211 + .long 3325550592 + .long 1071980652 + .long 3459651155 + .long 1025305573 + .long 775752448 + .long 1072001476 + .long 3582746667 + .long 1023859460 + .long 3238590720 + .long 1072022464 + .long 634636162 + .long 1024472353 + .long 2758801920 + .long 1072043624 + .long 3078216319 + .long 1025304516 + .long 1370319104 + .long 1072064962 + .long 2570569078 + .long 1025099442 + .long 2615805184 + .long 1072086484 + .long 3729933412 + .long 1024605112 + .long 3077336576 + .long 1072108198 + .long 1948916066 + .long 1024781603 + .long 1099528192 + .long 1072130112 + .long 3139143157 + .long 1023729360 + .long 1231903232 + .long 1072152233 + .long 1349513477 + .long 1024737515 + .long 1507504128 + .long 1072174570 + .long 3484516322 + .long 1024000959 + .long 2214659840 + .long 1072197132 + .long 2563820917 + .long 1025225535 + .long 1804739840 + .long 1072219929 + .long 760038746 + .long 1024482855 + .long 1413746688 + .long 1072242971 + .long 3401734714 + .long 1025129838 + .long 821409536 + .long 1072266269 + .long 3729772551 + .long 1025484796 + .long 3031825664 + .long 1072289834 + .long 122256749 + .long 1024752594 + .long 1710784256 + .long 1072313680 + .long 1518205483 + .long 1024724809 + .long 3025265152 + .long 1072337819 + .long 409951989 + .long 1022835555 + .long 287769088 + .long 1072362267 + .long 800355594 + .long 1022484850 + .long 198179840 + .long 1072387038 + .long 3502926213 + .long 1024209373 + .long 1909130496 + .long 1072412149 + .long 3064694319 + .long 1025380823 + .long 1941732096 + .long 1072437619 + .long 4112930390 + .long 1024294679 + .long 3492010496 + .long 1072463467 + .long 2684918107 + .long 1023220233 + .long 81959680 + .long 1072489716 + .long 220021366 + .long 1020635131 + .long 2297837056 + .long 1072516387 + .long 4027683826 + .long 1021041185 + .long 270404096 + .long 1072543508 + .long 2012766065 + .long 1021780753 + .long 3667376896 + .long 1072571105 + .long 2727981522 + .long 1023009874 + .long 330400256 + .long 1072599212 + .long 2940017003 + .long 1025393439 + .long 1119293952 + .long 1072627861 + .long 1608550416 + .long 1022675612 + .long 3536155904 + .long 1072657091 + .long 349665778 + .long 1025156751 + .long 3078046720 + .long 1072686946 + .long 2016159996 + .long 1022193169 + .long 455228416 + .long 1072705361 + .long 1908539328 + .long 1026126332 + .long 1871505664 + .long 1072720988 + .long 2784700894 + .long 1025922277 + .long 1630994432 + .long 1072737010 + .long 361107678 + .long 1022887244 + .long 2084558336 + .long 1072753462 + .long 2642784509 + .long 1072689083 + .long 1514442531 + .long 1072688953 + .long 333108933 + .long 1072688821 + .long 3392112024 + .long 1072688686 + .long 2099852862 + .long 1072688550 + .long 749609004 + .long 1072688412 + .long 3634632596 + .long 1072688271 + .long 2163248461 + .long 1072688129 + .long 628657846 + .long 1072687985 + .long 3324036511 + .long 1072687838 + .long 1657632815 + .long 1072687690 + .long 4217538760 + .long 1072687539 + .long 2411951597 + .long 1072687387 + .long 533944872 + .long 1072687233 + .long 2876566508 + .long 1072687076 + .long 847936891 + .long 1072686918 + .long 3036019913 + .long 1072686757 + .long 848884575 + .long 1072686595 + .long 2874443326 + .long 1072686430 + .long 520713666 + .long 1072686264 + .long 2375556481 + .long 1072686095 + .long 4141904948 + .long 1072685924 + .long 1522666382 + .long 1072685752 + .long 3105624104 + .long 1072685577 + .long 298666327 + .long 1072685401 + .long 1689524500 + .long 1072685222 + .long 2981002200 + .long 1072685041 + .long 4170844284 + .long 1072684858 + .long 961802263 + .long 1072684674 + .long 1941503454 + .long 1072684487 + .long 2812647170 + .long 1072684298 + .long 3572873869 + .long 1072684107 + .long 4219797823 + .long 1072683914 + .long 456039788 + .long 1072683720 + .long 869096151 + .long 1072683523 + .long 1161535119 + .long 1072683324 + .long 1330865866 + .long 1072683123 + .long 1374571204 + .long 1072682920 + .long 1290107538 + .long 1072682715 + .long 1074904836 + .long 1072682508 + .long 726366587 + .long 1072682299 + .long 241869763 + .long 1072682088 + .long 3913732079 + .long 1072681874 + .long 3149342765 + .long 1072681659 + .long 2240966306 + .long 1072681442 + .long 1185873216 + .long 1072681223 + .long 4276274591 + .long 1072681001 + .long 2919452883 + .long 1072680778 + .long 1407565635 + .long 1072680553 + .long 4032743551 + .long 1072680325 + .long 2202188565 + .long 1072680096 + .long 207977577 + .long 1072679865 + .long 2342160518 + .long 1072679631 + .long 11858423 + .long 1072679396 + .long 1804034453 + .long 1072679158 + .long 3420722787 + .long 1072678918 + .long 563930456 + .long 1072678677 + .long 1820539192 + .long 1072678433 + .long 2892501606 + .long 1072678187 + .long 3776710320 + .long 1072677939 + .long 175063337 + .long 1072677690 + .long 674333171 + .long 1072677438 + .long 976363026 + .long 1072677184 + .long 1077935934 + .long 1072676928 + .long 1921075490 + .long 1072676540 + .long 881493302 + .long 1072676016 + .long 3275752439 + .long 1072675483 + .long 486855588 + .long 1072674943 + .long 1077229111 + .long 1072674394 + .long 723950308 + .long 1072673837 + .long 3693582199 + .long 1072673271 + .long 1367335316 + .long 1072672698 + .long 2305837020 + .long 1072672116 + .long 2184358641 + .long 1072671526 + .long 972682840 + .long 1072670928 + .long 2935101762 + .long 1072670321 + .long 3745513263 + .long 1072669706 + .long 3372320886 + .long 1072669083 + .long 1783464620 + .long 1072668452 + .long 3241386215 + .long 1072667812 + .long 3418125284 + .long 1072667164 + .long 2280219148 + .long 1072666508 + .long 4088700758 + .long 1072665843 + .long 219227400 + .long 1072665171 + .long 3521816918 + .long 1072664489 + .long 1076205279 + .long 1072663800 + .long 1436484616 + .long 1072663102 + .long 271362610 + .long 1072662396 + .long 1838996688 + .long 1072661681 + .long 1807122518 + .long 1072660958 + .long 137953542 + .long 1072660227 + .long 1088178584 + .long 1072659487 + .long 324057537 + .long 1072658739 + .long 2101288076 + .long 1072657982 + .long 2085133974 + .long 1072657217 + .long 235324451 + .long 1072656444 + .long 806051592 + .long 1072655662 + .long 3756033140 + .long 1072654871 + .long 453542543 + .long 1072654073 + .long 3741177327 + .long 1072653265 + .long 691216109 + .long 1072652450 + .long 4145223372 + .long 1072651625 + .long 1174439091 + .long 1072650793 + .long 324416139 + .long 1072649952 + .long 1550246310 + .long 1072649102 + .long 511524674 + .long 1072648244 + .long 1457248482 + .long 1072647377 + .long 45944955 + .long 1072646502 + .long 525537397 + .long 1072645618 + .long 2848440188 + .long 1072644725 + .long 2671555633 + .long 1072643824 + .long 4241172637 + .long 1072642914 + .long 3213094278 + .long 1072641996 + .long 3832503688 + .long 1072641069 + .long 1754091534 + .long 1072640134 + .long 1221921804 + .long 1072639190 + .long 2184526489 + .long 1072638237 + .long 294902089 + .long 1072637276 + .long 4090375270 + .long 1072636305 + .long 632860906 + .long 1072635327 + .long 2753498702 + .long 1072634339 + .long 1808009252 + .long 1072633343 + .long 2036428672 + .long 1072632338 + .long 3383235626 + .long 1072631324 + .long 1497347484 + .long 1072630302 + .long 617018317 + .long 1072629271 + .long 684933058 + .long 1072628231 + .long 1643170798 + .long 1072627182 + .long 3011066360 + .long 1072625592 + .long 957158713 + .long 1072623442 + .long 1390907941 + .long 1072621256 + .long 3819155270 + .long 1072619034 + .long 3443571196 + .long 1072616777 + .long 4045412458 + .long 1072614484 + .long 805503923 + .long 1072612156 + .long 1778922015 + .long 1072609791 + .long 2125033665 + .long 1072607390 + .long 1287203863 + .long 1072604953 + .long 2992629568 + .long 1072602479 + .long 2367267127 + .long 1072599969 + .long 3115526047 + .long 1072597422 + .long 340219539 + .long 1072594839 + .long 2017215719 + .long 1072592218 + .long 3225443424 + .long 1072589560 + .long 3326565673 + .long 1072586865 + .long 1669811211 + .long 1072584133 + .long 1886735022 + .long 1072581363 + .long 3301071171 + .long 1072578555 + .long 928514283 + .long 1072575710 + .long 2656364059 + .long 1072572826 + .long 3473490507 + .long 1072569904 + .long 2649965606 + .long 1072566944 + .long 3736819052 + .long 1072563945 + .long 1680885175 + .long 1072560908 + .long 4413771 + .long 1072557832 + .long 2214869753 + .long 1072554716 + .long 3214725184 + .long 1072551561 + .long 2186079903 + .long 1072548367 + .long 2590372131 + .long 1072545133 + .long 3578146079 + .long 1072541859 + .long 4283712755 + .long 1072538545 + .long 3824834510 + .long 1072535191 + .long 1302400298 + .long 1072531797 + .long 95058636 + .long 1072528362 + .long 3563906063 + .long 1072524885 + .long 2167230730 + .long 1072521368 + .long 3524918334 + .long 1072517809 + .long 2353304918 + .long 1072514209 + .long 1939625839 + .long 1072510567 + .long 1256714581 + .long 1072506883 + .long 3552525848 + .long 1072503156 + .long 3464809522 + .long 1072499387 + .long 4200542593 + .long 1072495575 + .long 355609124 + .long 1072491721 + .long 3684139099 + .long 1072487822 + .long 148355918 + .long 1072483881 + .long 1457689242 + .long 1072479895 + .long 2118591596 + .long 1072475865 + .long 908848089 + .long 1072471791 + .long 877032689 + .long 1072467672 + .long 752012304 + .long 1072463508 + .long 3532301749 + .long 1072459298 + .long 3600563221 + .long 1072455043 + .long 3902857084 + .long 1072450742 + .long 3063101036 + .long 1072446395 + .long 3972344374 + .long 1072442001 + .long 903183549 + .long 1072437561 + .long 983892938 + .long 1072433073 + .long 2722858568 + .long 1072428537 + .long 302790515 + .long 1072423954 + .long 759811057 + .long 1072419322 + .long 2507809922 + .long 1072414641 + .long 2388408813 + .long 1072407528 + .long 2084492942 + .long 1072397870 + .long 2435703301 + .long 1072388010 + .long 1935433360 + .long 1072377945 + .long 2742047290 + .long 1072367671 + .long 2053284205 + .long 1072357185 + .long 657783367 + .long 1072346483 + .long 2893664841 + .long 1072335560 + .long 3718906405 + .long 1072324413 + .long 1547896303 + .long 1072313038 + .long 2494058440 + .long 1072301429 + .long 3133238742 + .long 1072289582 + .long 3327000086 + .long 1072277492 + .long 1860667274 + .long 1072265154 + .long 665340747 + .long 1072252562 + .long 443347841 + .long 1072239710 + .long 581282618 + .long 1072226592 + .long 3349780465 + .long 1072213201 + .long 914217606 + .long 1072199532 + .long 989797661 + .long 1072185576 + .long 945436416 + .long 1072171326 + .long 549291300 + .long 1072156774 + .long 1814636389 + .long 1072141911 + .long 239092858 + .long 1072126729 + .long 1794680724 + .long 1072111217 + .long 1241534678 + .long 1072095366 + .long 3366566214 + .long 1072079164 + .long 1244090828 + .long 1072062601 + .long 1708448120 + .long 1072045663 + .long 3544260650 + .long 1072028337 + .long 1402741403 + .long 1072010610 + .long 2551936888 + .long 1071992465 + .long 617669739 + .long 1071973887 + .long 794002186 + .long 1071954857 + .long 2021237693 + .long 1071935356 + .long 540450384 + .long 1071915364 + .long 1920555537 + .long 1071894857 + .long 2879585206 + .long 1071873811 + .long 3000237455 + .long 1071852199 + .long 3352974346 + .long 1071829991 + .long 569629937 + .long 1071807155 + .long 2077237208 + .long 1071783653 + .long 2284891805 + .long 1071759446 + .long 1226651784 + .long 1071734489 + .long 1102047405 + .long 1071708731 + .long 2009896384 + .long 1071682115 + .long 927419082 + .long 1071654577 + .long 85010366 + .long 1071607413 + .long 696431025 + .long 1071548180 + .long 2611410541 + .long 1071486585 + .long 2612593658 + .long 1071422396 + .long 3548155306 + .long 1071355336 + .long 3887997484 + .long 1071285073 + .long 244854763 + .long 1071211202 + .long 4214445648 + .long 1071133216 + .long 2303966727 + .long 1071050478 + .long 3991040013 + .long 1070962152 + .long 3126952278 + .long 1070867118 + .long 1817448378 + .long 1070763804 + .long 1793814864 + .long 1070649884 + .long 3507224072 + .long 1070447193 + .long 4027609105 + .long 1070148772 + .long 577507993 + .long 1069779414 + .long 2310232419 + .long 1068931829 + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 4294950912 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .long 0 + .long 2147483584 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1073291771 + .type static_const_table,@object + .size static_const_table,6096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/asinf_wmt.S b/external/sgx_libm/ia32/asinf_wmt.S new file mode 100644 index 0000000000..40bb17db58 --- /dev/null +++ b/external/sgx_libm/ia32/asinf_wmt.S @@ -0,0 +1,514 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin asinf + .text + .align 16,0x90 + .globl asinf +asinf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + cvtps2pd %xmm0, %xmm1 + movd %xmm0, %eax + movsd 1040(%ebx), %xmm3 + movl $2139095040, %ecx + movl $8388608, %edx + andl %eax, %ecx + subl $1015021568, %ecx + cmpl $50331648, %ecx + jae .L_2TAG_PACKET_0.0.3 + mulsd %xmm1, %xmm1 + cvtps2pd %xmm0, %xmm2 + shrl $23, %ecx + addl $1, %ecx + shrl %cl, %edx + subsd %xmm1, %xmm3 + orl %edx, %eax + negl %edx + andl %edx, %eax + movd %eax, %xmm4 + sqrtsd %xmm3, %xmm3 + addl %edx, %edx + andl $16777215, %edx + andl %edx, %eax + negl %ecx + addl $24, %ecx + orl $8388608, %eax + shrl %cl, %eax + addl %eax, %eax + movsd (%ebx,%eax,8), %xmm5 + psrlq $31, %xmm0 + movsd 8(%ebx,%eax,8), %xmm1 + psllq $63, %xmm0 + cvtps2pd %xmm4, %xmm4 + mulsd %xmm5, %xmm2 + orpd %xmm1, %xmm0 + movsd 1056(%ebx), %xmm5 + movsd 1072(%ebx), %xmm1 + mulsd %xmm3, %xmm4 + movsd 1088(%ebx), %xmm3 + subsd %xmm4, %xmm2 + pshufd $68, %xmm2, %xmm4 + mulsd %xmm2, %xmm2 + mulsd %xmm4, %xmm5 + mulsd %xmm4, %xmm1 + mulsd %xmm4, %xmm3 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + addsd %xmm5, %xmm3 + addsd %xmm1, %xmm4 + mulsd %xmm3, %xmm2 + addsd %xmm4, %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + jge .L_2TAG_PACKET_2.0.3 + addl $1015021568, %ecx + cmpl $964689920, %ecx + jb .L_2TAG_PACKET_3.0.3 + movsd 1072(%ebx), %xmm2 + movapd %xmm1, %xmm0 + movsd 1088(%ebx), %xmm3 + mulsd %xmm1, %xmm1 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm1 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + mulsd %xmm3, %xmm1 + addsd %xmm2, %xmm0 + addsd %xmm0, %xmm1 + cvtpd2ps %xmm1, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movsd 1104(%ebx), %xmm5 + mulsd %xmm5, %xmm1 + cvtpd2ps %xmm1, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + addl %eax, %eax + cmpl $2130706432, %eax + jne .L_2TAG_PACKET_4.0.3 + movapd 1024(%ebx), %xmm0 + psrlq $63, %xmm1 + psllq $63, %xmm1 + orpd %xmm1, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $-16777216, %eax + ja .L_2TAG_PACKET_5.0.3 + xorps %xmm0, %xmm0 + movl $2139095040, %edx + movd %edx, %xmm1 + mulss %xmm1, %xmm0 + movss %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $62, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_5.0.3: + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_1.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type asinf,@function + .size asinf,.-asinf + .data +# -- End asinf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4290772864 + .long 1072693183 + .long 2864569868 + .long 1065353226 + .long 3955135328 + .long 1072692671 + .long 152932388 + .long 1066926224 + .long 1671525387 + .long 1072691647 + .long 2415589551 + .long 1067712845 + .long 2799290704 + .long 1072690109 + .long 3864800403 + .long 1068237715 + .long 2477707161 + .long 1072688057 + .long 725093587 + .long 1068630990 + .long 2787892653 + .long 1072685489 + .long 2536557765 + .long 1068893940 + .long 4138691444 + .long 1072682403 + .long 62552236 + .long 1069157247 + .long 941089134 + .long 1072678798 + .long 165833141 + .long 1069420976 + .long 3045724825 + .long 1072674669 + .long 2611259588 + .long 1069616357 + .long 1338788729 + .long 1072670015 + .long 2616012614 + .long 1069748746 + .long 2049955026 + .long 1072664831 + .long 11397492 + .long 1069881450 + .long 922854000 + .long 1072659114 + .long 2157235516 + .long 1070014503 + .long 326738075 + .long 1072652859 + .long 2788743992 + .long 1070147943 + .long 589211462 + .long 1072646061 + .long 3920198733 + .long 1070281807 + .long 4203970809 + .long 1072638714 + .long 3416546056 + .long 1070416134 + .long 2847908959 + .long 1072630814 + .long 4071425947 + .long 1070550963 + .long 3041144817 + .long 1072622353 + .long 623140044 + .long 1070641216 + .long 254499552 + .long 1072613325 + .long 307519074 + .long 1070709195 + .long 247322296 + .long 1072603721 + .long 2945179265 + .long 1070777488 + .long 1734768715 + .long 1072593533 + .long 3301227932 + .long 1070846119 + .long 512284341 + .long 1072582753 + .long 148694291 + .long 1070915112 + .long 2150320922 + .long 1072571370 + .long 959165711 + .long 1070984490 + .long 307214965 + .long 1072559375 + .long 862254873 + .long 1071054280 + .long 2261822985 + .long 1072546755 + .long 303820077 + .long 1071124509 + .long 2878424532 + .long 1072533499 + .long 1279667396 + .long 1071195205 + .long 1489389340 + .long 1072519594 + .long 3626865975 + .long 1071266398 + .long 1561634021 + .long 1072505025 + .long 1381197995 + .long 1071338121 + .long 1731593006 + .long 1072489777 + .long 685577004 + .long 1071410406 + .long 3972360633 + .long 1072473833 + .long 3426639945 + .long 1071483288 + .long 231016948 + .long 1072457177 + .long 3858097791 + .long 1071556806 + .long 1951983052 + .long 1072439787 + .long 2522397359 + .long 1071631000 + .long 806900869 + .long 1072421644 + .long 1565390008 + .long 1071675292 + .long 2352519275 + .long 1072402724 + .long 2655228975 + .long 1071713130 + .long 3752547712 + .long 1072383003 + .long 3066292715 + .long 1071751375 + .long 1444584515 + .long 1072362455 + .long 933027783 + .long 1071790054 + .long 2960036461 + .long 1072341049 + .long 3589869088 + .long 1071829194 + .long 4214933698 + .long 1072318754 + .long 2973206241 + .long 1071868828 + .long 957213757 + .long 1072295536 + .long 2756129430 + .long 1071908989 + .long 4263431727 + .long 1072271354 + .long 2767348050 + .long 1071949714 + .long 4197201246 + .long 1072246168 + .long 874994578 + .long 1071991044 + .long 1821133236 + .long 1072219931 + .long 3810301671 + .long 1072033022 + .long 2102004657 + .long 1072192590 + .long 4064603671 + .long 1072075699 + .long 1957725919 + .long 1072164088 + .long 276553332 + .long 1072119130 + .long 3365782140 + .long 1072134360 + .long 1120469626 + .long 1072163374 + .long 4096932877 + .long 1072103334 + .long 4291572900 + .long 1072208500 + .long 177757517 + .long 1072070929 + .long 2376322938 + .long 1072254587 + .long 4029755771 + .long 1072037049 + .long 3060434712 + .long 1072301721 + .long 497611374 + .long 1072001591 + .long 4010165530 + .long 1072350003 + .long 3306304935 + .long 1071964429 + .long 388249839 + .long 1072399550 + .long 539435036 + .long 1071925423 + .long 165779504 + .long 1072450495 + .long 2497352827 + .long 1071884403 + .long 1343287957 + .long 1072502997 + .long 884164153 + .long 1071841172 + .long 1828157318 + .long 1072557245 + .long 3653025069 + .long 1071795489 + .long 2128712154 + .long 1072613466 + .long 3056817116 + .long 1071747064 + .long 1489283833 + .long 1072671938 + .long 1840990109 + .long 1071695534 + .long 2059782629 + .long 1072713127 + .long 3931971716 + .long 1071636206 + .long 1027831985 + .long 1072745180 + .long 3187721039 + .long 1071517691 + .long 3329524973 + .long 1072779038 + .long 3649449467 + .long 1071389244 + .long 2110923290 + .long 1072815090 + .long 4055205277 + .long 1071248617 + .long 2992048670 + .long 1072853879 + .long 2715653706 + .long 1071092488 + .long 419466969 + .long 1072896214 + .long 2030806678 + .long 1070915559 + .long 1069790871 + .long 1072943387 + .long 2084655462 + .long 1070708358 + .long 3811755941 + .long 1072997722 + .long 3549768261 + .long 1070304457 + .long 884757291 + .long 1073064302 + .long 4261330719 + .long 1069543419 + .long 3631318613 + .long 1073160613 + .long 1413754136 + .long 1073291771 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 3067833783 + .long 1067899757 + .long 0 + .long 0 + .long 1431655765 + .long 1069897045 + .long 0 + .long 0 + .long 858993459 + .long 1068708659 + .long 0 + .long 0 + .long 1 + .long 1072693248 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,1120 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/asinh_wmt.S b/external/sgx_libm/ia32/asinh_wmt.S new file mode 100644 index 0000000000..0a8baf7567 --- /dev/null +++ b/external/sgx_libm/ia32/asinh_wmt.S @@ -0,0 +1,1860 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin asinh + .text + .align 16,0x90 + .globl asinh +asinh: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm5 + movsd %xmm0, 8(%esp) + pand 240(%ebx), %xmm0 + pextrw $3, %xmm0, %eax + cmpl $32752, %eax + jge .L_2TAG_PACKET_0.0.2 + cmpl $16304, %eax + jle .L_2TAG_PACKET_1.0.2 + pand 144(%ebx), %xmm5 + movq %xmm5, (%esp) + cmpl $16403, %eax + jle .L_2TAG_PACKET_2.0.2 + cmpl $16816, %eax + jge .L_2TAG_PACKET_3.0.2 + movq 112(%ebx), %xmm1 + movapd %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + addsd 112(%ebx), %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm2, %xmm0 + paddw 256(%ebx), %xmm2 + divsd %xmm0, %xmm1 + movapd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_2.0.2: + movapd %xmm0, %xmm1 + movapd %xmm0, %xmm3 + pand 176(%ebx), %xmm0 + movapd %xmm0, %xmm2 + subsd %xmm0, %xmm1 + addsd %xmm0, %xmm3 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm3 + addsd 112(%ebx), %xmm0 + movapd %xmm3, %xmm4 + addsd %xmm0, %xmm3 + sqrtsd %xmm3, %xmm3 + movapd %xmm3, %xmm5 + pand 176(%ebx), %xmm3 + subsd %xmm3, %xmm5 + movapd %xmm3, %xmm6 + movapd %xmm3, %xmm7 + addsd %xmm3, %xmm2 + mulsd %xmm3, %xmm3 + mulsd %xmm5, %xmm6 + addsd %xmm5, %xmm7 + subsd %xmm3, %xmm0 + subsd %xmm6, %xmm0 + addsd %xmm0, %xmm4 + movapd %xmm2, %xmm0 + divsd %xmm7, %xmm4 + addsd %xmm5, %xmm4 + mulsd 96(%ebx), %xmm4 + addsd %xmm4, %xmm1 +.L_2TAG_PACKET_4.0.2: + movq 208(%ebx), %xmm3 + addsd %xmm1, %xmm0 + movapd %xmm0, %xmm5 + psrlq $41, %xmm5 + pextrw $0, %xmm5, %ecx + pand 176(%ebx), %xmm0 + subsd %xmm0, %xmm2 + addsd %xmm2, %xmm1 + pshufd $68, %xmm0, %xmm4 + pand 160(%ebx), %xmm0 + pand 192(%ebx), %xmm4 + psubd %xmm4, %xmm3 + psubw 112(%ebx), %xmm4 + psrlq $52, %xmm4 + por 112(%ebx), %xmm0 + por 128(%ebx), %xmm4 + mulsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_3.0.2: + shrl $4, %eax + subl $1022, %eax + movd %eax, %xmm4 + unpcklpd %xmm4, %xmm4 + movl 12(%esp), %ecx + por 128(%ebx), %xmm4 + pand 160(%ebx), %xmm0 + por 112(%ebx), %xmm0 + movapd %xmm0, %xmm1 + pand 176(%ebx), %xmm0 + subsd %xmm0, %xmm1 + shrl $9, %ecx +.L_2TAG_PACKET_5.0.2: + subpd 128(%ebx), %xmm4 + movq 80(%ebx), %xmm2 + andl $2040, %ecx + mulpd 224(%ebx), %xmm4 + mulsd 4384(%ebx,%ecx), %xmm0 + mulsd 4384(%ebx,%ecx), %xmm1 + subsd 112(%ebx), %xmm0 + movapd %xmm0, %xmm5 + addsd %xmm1, %xmm0 + movapd %xmm0, %xmm3 + unpcklpd %xmm0, %xmm0 + addpd 288(%ebx,%ecx,2), %xmm4 + movhlps %xmm4, %xmm6 + mulpd %xmm0, %xmm0 + mulsd %xmm0, %xmm2 + addpd 64(%ebx), %xmm2 + mulpd %xmm0, %xmm2 + addpd 48(%ebx), %xmm2 + mulpd %xmm0, %xmm2 + movhlps %xmm2, %xmm0 + mulsd %xmm3, %xmm0 + addsd %xmm2, %xmm0 + addsd %xmm1, %xmm0 + movsd (%esp), %xmm1 + addsd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + addsd %xmm5, %xmm0 + por %xmm1, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_1.0.2: + cmpl $15456, %eax + jle .L_2TAG_PACKET_7.0.2 + fldl 8(%esp) + fldl 8(%esp) + fmul %st(0), %st + fldl 32(%ebx) + fmul %st(1), %st + faddl 24(%ebx) + fmul %st(1), %st + faddl 16(%ebx) + fmul %st(1), %st + faddl 8(%ebx) + fmul %st(1), %st + faddl (%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_7.0.2: + andl $32752, %eax + je .L_2TAG_PACKET_8.0.2 + pextrw $3, %xmm5, %ecx + shrl $15, %ecx + fldl 8(%esp) + fldl 272(%ebx,%ecx,8) + fmul %st(0), %st + fsubrp %st, %st(1) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_8.0.2: + fldl 8(%esp) + fld %st(0) + fmul %st(1), %st + fstpl (%esp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_0.0.2: + addsd %xmm5, %xmm5 + movq %xmm5, (%esp) + fldl (%esp) +.L_2TAG_PACKET_6.0.2: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type asinh,@function + .size asinh,.-asinh + .data +# -- End asinh + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1431655746 + .long 3217380693 + .long 858875226 + .long 1068708659 + .long 2809361764 + .long 3215383405 + .long 1241898124 + .long 1067392054 + .long 966918340 + .long 3214324669 + .long 0 + .long 0 + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 0 + .long 4294967295 + .long 0 + .long 4294967295 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 2145386496 + .long 0 + .long 2145386496 + .long 897137782 + .long 1038760431 + .long 4276092928 + .long 1072049730 + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 1048576 + .long 0 + .long 0 + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .long 662290844 + .long 1040545122 + .long 0 + .long 1063257089 + .long 1410206301 + .long 1039423595 + .long 0 + .long 1064833554 + .long 1576129908 + .long 1044327686 + .long 0 + .long 1065621801 + .long 3771466512 + .long 1043372267 + .long 0 + .long 1066152307 + .long 2250061482 + .long 1041942323 + .long 0 + .long 1066510009 + .long 241025648 + .long 1043818160 + .long 0 + .long 1066777242 + .long 3481293707 + .long 1039994007 + .long 0 + .long 1067045544 + .long 17391197 + .long 1042467788 + .long 0 + .long 1067281191 + .long 1429304634 + .long 1045705663 + .long 0 + .long 1067500943 + .long 2258946786 + .long 1045312243 + .long 0 + .long 1067619660 + .long 725099158 + .long 1043780790 + .long 0 + .long 1067755853 + .long 1795694751 + .long 1046370967 + .long 0 + .long 1067875476 + .long 218276363 + .long 1045874206 + .long 0 + .long 1067995528 + .long 3918058606 + .long 1045941877 + .long 0 + .long 1068133258 + .long 2029669416 + .long 1040964778 + .long 0 + .long 1068254238 + .long 111041497 + .long 1042505837 + .long 0 + .long 1068375655 + .long 9214008 + .long 1042394003 + .long 0 + .long 1068497513 + .long 3222421290 + .long 1046711220 + .long 0 + .long 1068559379 + .long 1120482910 + .long 1046024006 + .long 0 + .long 1068620754 + .long 3817590987 + .long 1046519755 + .long 0 + .long 1068682354 + .long 3431328350 + .long 1046805053 + .long 0 + .long 1068744181 + .long 3088376696 + .long 1046390788 + .long 0 + .long 1068806237 + .long 3229576382 + .long 1046428373 + .long 0 + .long 1068859611 + .long 1328753044 + .long 1046554315 + .long 0 + .long 1068922096 + .long 1186666727 + .long 1044788651 + .long 0 + .long 1068984815 + .long 603190068 + .long 1044621365 + .long 0 + .long 1069047769 + .long 1647019864 + .long 1045911122 + .long 0 + .long 1069101918 + .long 4200935885 + .long 1044407410 + .long 0 + .long 1069165314 + .long 3581720604 + .long 1046840144 + .long 0 + .long 1069219844 + .long 2217841072 + .long 1046325234 + .long 0 + .long 1069283688 + .long 1963222525 + .long 1047002562 + .long 0 + .long 1069338605 + .long 2828272122 + .long 1046012177 + .long 0 + .long 1069393703 + .long 3730942205 + .long 1046476867 + .long 0 + .long 1069458213 + .long 3166604115 + .long 1047518079 + .long 0 + .long 1069513705 + .long 2095461845 + .long 1046790089 + .long 0 + .long 1069558451 + .long 322388698 + .long 1046865736 + .long 0 + .long 1069586382 + .long 2407253617 + .long 1047545084 + .long 0 + .long 1069619086 + .long 3437791416 + .long 1047490483 + .long 0 + .long 1069647220 + .long 2693469775 + .long 1045625134 + .long 0 + .long 1069675449 + .long 1454696571 + .long 1045327327 + .long 0 + .long 1069703773 + .long 1940756848 + .long 1043926274 + .long 0 + .long 1069732193 + .long 2244096130 + .long 1047717922 + .long 0 + .long 1069760709 + .long 2856509870 + .long 1047123452 + .long 0 + .long 1069789323 + .long 116200689 + .long 1043361536 + .long 0 + .long 1069813243 + .long 4018367049 + .long 1048385867 + .long 0 + .long 1069842036 + .long 3162755613 + .long 1048496333 + .long 0 + .long 1069870929 + .long 2730655796 + .long 1048315252 + .long 0 + .long 1069899922 + .long 892380602 + .long 1046868829 + .long 0 + .long 1069929016 + .long 3139480334 + .long 1046190510 + .long 0 + .long 1069953338 + .long 1886171545 + .long 1048270714 + .long 0 + .long 1069982617 + .long 2203106387 + .long 1048291228 + .long 0 + .long 1070007095 + .long 659271154 + .long 1044549473 + .long 0 + .long 1070036564 + .long 377790372 + .long 1045759361 + .long 0 + .long 1070066136 + .long 1269824164 + .long 1047357396 + .long 0 + .long 1070090859 + .long 1643831617 + .long 1048231604 + .long 0 + .long 1070115655 + .long 57265969 + .long 1047663307 + .long 0 + .long 1070145508 + .long 2640032722 + .long 1046479978 + .long 0 + .long 1070170467 + .long 2420992102 + .long 1043079769 + .long 0 + .long 1070200516 + .long 2711573521 + .long 1045731911 + .long 0 + .long 1070225639 + .long 1973048145 + .long 1048077010 + .long 0 + .long 1070250837 + .long 4093691059 + .long 1046627963 + .long 0 + .long 1070276112 + .long 4182783767 + .long 1047690348 + .long 0 + .long 1070306542 + .long 2883525439 + .long 1048055018 + .long 0 + .long 1070331985 + .long 3917130655 + .long 1046818760 + .long 0 + .long 1070357506 + .long 2320146059 + .long 1048132455 + .long 0 + .long 1070383104 + .long 3464331364 + .long 1047738634 + .long 0 + .long 1070408781 + .long 674627443 + .long 1046468986 + .long 0 + .long 1070434537 + .long 2152289494 + .long 1046214007 + .long 0 + .long 1070460372 + .long 37897452 + .long 1048575202 + .long 0 + .long 1070486286 + .long 1899477568 + .long 1044793529 + .long 0 + .long 1070512282 + .long 2077140689 + .long 1048534003 + .long 0 + .long 1070538357 + .long 448558287 + .long 1045911230 + .long 0 + .long 1070564515 + .long 3867352000 + .long 1046082819 + .long 0 + .long 1070590754 + .long 2206537816 + .long 1049157739 + .long 0 + .long 1070606585 + .long 1799603998 + .long 1049369388 + .long 0 + .long 1070619787 + .long 4075457018 + .long 1048703324 + .long 0 + .long 1070630379 + .long 572844178 + .long 1049388451 + .long 0 + .long 1070643656 + .long 540240475 + .long 1048063456 + .long 0 + .long 1070656976 + .long 2413664112 + .long 1047739393 + .long 0 + .long 1070670338 + .long 2592177285 + .long 1048727389 + .long 0 + .long 1070681058 + .long 1541931453 + .long 1048698417 + .long 0 + .long 1070694497 + .long 3345398163 + .long 1049085432 + .long 0 + .long 1070707979 + .long 2241984547 + .long 1049164260 + .long 0 + .long 1070718796 + .long 890223989 + .long 1048265646 + .long 0 + .long 1070732357 + .long 1226890683 + .long 1048781783 + .long 0 + .long 1070743237 + .long 1600520378 + .long 1048834273 + .long 0 + .long 1070756877 + .long 1081324478 + .long 1048934847 + .long 0 + .long 1070767821 + .long 1928471339 + .long 1042640487 + .long 0 + .long 1070781542 + .long 982084959 + .long 1048971733 + .long 0 + .long 1070792550 + .long 2380239162 + .long 1047711062 + .long 0 + .long 1070806352 + .long 3609542249 + .long 1048031507 + .long 0 + .long 1070817426 + .long 3466499103 + .long 1049126511 + .long 0 + .long 1070828529 + .long 1626165976 + .long 1048431820 + .long 0 + .long 1070842450 + .long 261635432 + .long 1048113242 + .long 0 + .long 1070853620 + .long 1670437810 + .long 1046604532 + .long 0 + .long 1070864820 + .long 3910575981 + .long 1049365107 + .long 0 + .long 1070876049 + .long 727294688 + .long 1048407484 + .long 0 + .long 1070890129 + .long 3260008354 + .long 1047549258 + .long 0 + .long 1070901427 + .long 872084085 + .long 1048711456 + .long 0 + .long 1070912755 + .long 754632403 + .long 1048687679 + .long 0 + .long 1070924114 + .long 1033413261 + .long 1048105461 + .long 0 + .long 1070935504 + .long 1155773876 + .long 1047412165 + .long 0 + .long 1070946925 + .long 746670859 + .long 1046841493 + .long 0 + .long 1070961245 + .long 1820254373 + .long 1048237327 + .long 0 + .long 1070972736 + .long 3605217861 + .long 1047440922 + .long 0 + .long 1070984259 + .long 2212317823 + .long 1049212421 + .long 0 + .long 1070995813 + .long 2826670683 + .long 1047678316 + .long 0 + .long 1071007400 + .long 3532575187 + .long 1049339451 + .long 0 + .long 1071019018 + .long 413443603 + .long 1049028939 + .long 0 + .long 1071030669 + .long 2964472999 + .long 1043732931 + .long 0 + .long 1071042353 + .long 389771102 + .long 1049430622 + .long 0 + .long 1071051136 + .long 1005132876 + .long 1048342053 + .long 0 + .long 1071062877 + .long 2877512173 + .long 1049492173 + .long 0 + .long 1071074650 + .long 1874411204 + .long 1048724858 + .long 0 + .long 1071086457 + .long 1011596427 + .long 1048646627 + .long 0 + .long 1071098297 + .long 838498113 + .long 1043068341 + .long 0 + .long 1071110171 + .long 409945993 + .long 1047118137 + .long 0 + .long 1071122078 + .long 2035722984 + .long 1049263601 + .long 0 + .long 1071131030 + .long 4272650650 + .long 1048435570 + .long 0 + .long 1071142997 + .long 867757828 + .long 1047923871 + .long 0 + .long 1071154998 + .long 433900304 + .long 1048766295 + .long 0 + .long 1071164021 + .long 2626749065 + .long 1049334020 + .long 0 + .long 1071176082 + .long 2721103389 + .long 1049448370 + .long 0 + .long 1071188178 + .long 3401674810 + .long 1049424769 + .long 0 + .long 1071197273 + .long 3030733799 + .long 1047804815 + .long 0 + .long 1071209431 + .long 1532130487 + .long 1045537774 + .long 0 + .long 1071221624 + .long 225486125 + .long 1049520040 + .long 0 + .long 1071230791 + .long 1326263423 + .long 1044918825 + .long 0 + .long 1071243047 + .long 3029302589 + .long 1049469599 + .long 0 + .long 1071252261 + .long 3326443421 + .long 1042360275 + .long 0 + .long 1071264580 + .long 3770244744 + .long 1048027184 + .long 0 + .long 1071273842 + .long 2568976454 + .long 1045847505 + .long 0 + .long 1071286224 + .long 628040571 + .long 1048248574 + .long 0 + .long 1071295534 + .long 2688775955 + .long 1048311770 + .long 0 + .long 1071307980 + .long 3357093336 + .long 1047484659 + .long 0 + .long 1071317339 + .long 2753529189 + .long 1047343532 + .long 0 + .long 1071329850 + .long 625560417 + .long 1043404964 + .long 0 + .long 1071339258 + .long 2456374941 + .long 1048890167 + .long 0 + .long 1071351834 + .long 748255530 + .long 1049487286 + .long 0 + .long 1071361291 + .long 2246865993 + .long 1048768259 + .long 0 + .long 1071370770 + .long 205672663 + .long 1047230532 + .long 0 + .long 1071383442 + .long 4242870741 + .long 1046367538 + .long 0 + .long 1071392971 + .long 2016709797 + .long 1049037028 + .long 0 + .long 1071402521 + .long 2569308411 + .long 1049159850 + .long 0 + .long 1071415289 + .long 3242472523 + .long 1048132214 + .long 0 + .long 1071424891 + .long 1602055934 + .long 1044691415 + .long 0 + .long 1071434515 + .long 1307177952 + .long 1049244134 + .long 0 + .long 1071444160 + .long 2152237414 + .long 1048407400 + .long 0 + .long 1071457056 + .long 2598207309 + .long 1047639998 + .long 0 + .long 1071466754 + .long 3115077937 + .long 1048719780 + .long 0 + .long 1071476474 + .long 1272724396 + .long 1048321721 + .long 0 + .long 1071486217 + .long 2860867658 + .long 1049612888 + .long 0 + .long 1071495982 + .long 1467300368 + .long 1047143154 + .long 0 + .long 1071509039 + .long 3449085837 + .long 1046095654 + .long 0 + .long 1071518858 + .long 2146871948 + .long 1044681726 + .long 0 + .long 1071528700 + .long 3066750144 + .long 1046492840 + .long 0 + .long 1071538565 + .long 1416401583 + .long 1048453263 + .long 0 + .long 1071548453 + .long 2249840317 + .long 1046959692 + .long 0 + .long 1071558365 + .long 4172904720 + .long 1048039642 + .long 0 + .long 1071568300 + .long 1549017192 + .long 1046702261 + .long 0 + .long 1071578259 + .long 3220736011 + .long 1048855214 + .long 0 + .long 1071588241 + .long 630967006 + .long 1049477219 + .long 0 + .long 1071598247 + .long 3624057028 + .long 1046733189 + .long 0 + .long 1071608278 + .long 3730794064 + .long 1048259820 + .long 0 + .long 1071618332 + .long 570378657 + .long 1049316661 + .long 0 + .long 1071628410 + .long 2814556357 + .long 1048696327 + .long 0 + .long 1071638513 + .long 194866917 + .long 1048899904 + .long 0 + .long 1071646656 + .long 3497355923 + .long 1047579730 + .long 0 + .long 1071651732 + .long 984418162 + .long 1048576793 + .long 0 + .long 1071656820 + .long 1973276684 + .long 1050136256 + .long 0 + .long 1071661920 + .long 3329497336 + .long 1049987327 + .long 0 + .long 1071667033 + .long 1374214759 + .long 1047073231 + .long 0 + .long 1071672159 + .long 2689110139 + .long 1044696853 + .long 0 + .long 1071675583 + .long 3281519615 + .long 1049239454 + .long 0 + .long 1071680729 + .long 106060705 + .long 1049441252 + .long 0 + .long 1071685888 + .long 994445709 + .long 1048383906 + .long 0 + .long 1071691060 + .long 968365306 + .long 1050219142 + .long 0 + .long 1071696244 + .long 1127183666 + .long 1048063436 + .long 0 + .long 1071701442 + .long 1176023037 + .long 1048767474 + .long 0 + .long 1071704914 + .long 494386159 + .long 1048610025 + .long 0 + .long 1071710133 + .long 3484359724 + .long 1048499390 + .long 0 + .long 1071715365 + .long 3217980016 + .long 1048823654 + .long 0 + .long 1071720610 + .long 422622404 + .long 1048883138 + .long 0 + .long 1071724114 + .long 1262752531 + .long 1048980778 + .long 0 + .long 1071729381 + .long 3412819100 + .long 1049899918 + .long 0 + .long 1071734661 + .long 4248496658 + .long 1048338572 + .long 0 + .long 1071738189 + .long 644483909 + .long 1050165690 + .long 0 + .long 1071743491 + .long 3881343467 + .long 1050118499 + .long 0 + .long 1071748807 + .long 2653622880 + .long 1048337361 + .long 0 + .long 1071752359 + .long 2812002981 + .long 1050155308 + .long 0 + .long 1071757697 + .long 224311686 + .long 1050482530 + .long 0 + .long 1071763049 + .long 679701015 + .long 1049869325 + .long 0 + .long 1071766625 + .long 3027506890 + .long 1049908641 + .long 0 + .long 1071772000 + .long 3751375892 + .long 1049481244 + .long 0 + .long 1071777389 + .long 1920294497 + .long 1050102004 + .long 0 + .long 1071780989 + .long 1483524208 + .long 1050119127 + .long 0 + .long 1071786401 + .long 97441208 + .long 1049658186 + .long 0 + .long 1071790017 + .long 3008178484 + .long 1050468097 + .long 0 + .long 1071795452 + .long 3633428993 + .long 1048933205 + .long 0 + .long 1071799084 + .long 272261604 + .long 1048795103 + .long 0 + .long 1071804543 + .long 1886467610 + .long 1049658772 + .long 0 + .long 1071810016 + .long 3703763111 + .long 1048691245 + .long 0 + .long 1071813673 + .long 3272554440 + .long 1049215679 + .long 0 + .long 1071819170 + .long 1615609844 + .long 1047938702 + .long 0 + .long 1071822843 + .long 2101526408 + .long 1049159037 + .long 0 + .long 1071826522 + .long 3501340145 + .long 1048964151 + .long 0 + .long 1071832053 + .long 3398848880 + .long 1050181422 + .long 0 + .long 1071835748 + .long 3113670222 + .long 1047639078 + .long 0 + .long 1071841304 + .long 3113807767 + .long 1050490134 + .long 0 + .long 1071845015 + .long 2638078905 + .long 1050508198 + .long 0 + .long 1071850595 + .long 3402790998 + .long 1048094059 + .long 0 + .long 1071854324 + .long 2677940860 + .long 1046276297 + .long 0 + .long 1071859929 + .long 2914178933 + .long 1050613895 + .long 0 + .long 1071863673 + .long 1395015268 + .long 1049805645 + .long 0 + .long 1071867425 + .long 3443880395 + .long 1049880454 + .long 0 + .long 1071873065 + .long 3880277067 + .long 1046944118 + .long 0 + .long 1071876834 + .long 4190954257 + .long 1048963456 + .long 0 + .long 1071880609 + .long 975315090 + .long 1050660599 + .long 0 + .long 1071886284 + .long 3981445309 + .long 1048841548 + .long 0 + .long 1071890077 + .long 340978156 + .long 1049630357 + .long 0 + .long 1071893876 + .long 3056282856 + .long 1048349819 + .long 0 + .long 1071899588 + .long 3637866925 + .long 1050038234 + .long 0 + .long 1071903404 + .long 1233925752 + .long 1047565029 + .long 0 + .long 1071907228 + .long 3365276628 + .long 1049120293 + .long 0 + .long 1071912976 + .long 1364708917 + .long 1048863613 + .long 0 + .long 1071916817 + .long 2949393003 + .long 1048806573 + .long 0 + .long 1071920665 + .long 2588933741 + .long 1049057850 + .long 0 + .long 1071924520 + .long 1317344960 + .long 1048679202 + .long 0 + .long 1071930316 + .long 4264843208 + .long 1047591051 + .long 0 + .long 1071934189 + .long 1772398646 + .long 1047786577 + .long 0 + .long 1071938069 + .long 855212881 + .long 1049083903 + .long 0 + .long 1071941956 + .long 111728933 + .long 1050121939 + .long 0 + .long 1071947800 + .long 2934994658 + .long 1046035147 + .long 0 + .long 1071951706 + .long 3504420384 + .long 1049933751 + .long 0 + .long 1071955618 + .long 2295312686 + .long 1049747989 + .long 0 + .long 1071959538 + .long 185383186 + .long 1050276648 + .long 0 + .long 1071963465 + .long 2699459344 + .long 1049336105 + .long 0 + .long 1071967400 + .long 3020028019 + .long 1048472693 + .long 0 + .long 1071973316 + .long 365843238 + .long 1049205247 + .long 0 + .long 1071977269 + .long 1597522098 + .long 1045226127 + .long 0 + .long 1071981230 + .long 731482298 + .long 1047741244 + .long 0 + .long 1071985198 + .long 19057756 + .long 1050243827 + .long 0 + .long 1071989173 + .long 2890838867 + .long 1050654615 + .long 0 + .long 1071993156 + .long 2027053605 + .long 1050184234 + .long 0 + .long 1071997147 + .long 858789886 + .long 1047748038 + .long 0 + .long 1072001146 + .long 4288580762 + .long 1046326129 + .long 0 + .long 1072007158 + .long 3861103191 + .long 1049816977 + .long 0 + .long 1072011175 + .long 1902054808 + .long 1050330775 + .long 0 + .long 1072015200 + .long 568089353 + .long 1050301118 + .long 0 + .long 1072019233 + .long 3743438430 + .long 1049790563 + .long 0 + .long 1072023274 + .long 2063211846 + .long 1047622979 + .long 0 + .long 1072027323 + .long 1911797542 + .long 1049675962 + .long 0 + .long 1072031379 + .long 3660869822 + .long 1050198853 + .long 0 + .long 1072035443 + .long 616847508 + .long 1050494731 + .long 0 + .long 1072039515 + .long 225141268 + .long 1050627992 + .long 0 + .long 1072043595 + .long 3898487111 + .long 1050663410 + .long 0 + .long 1072047683 + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type static_const_table,@object + .size static_const_table,6432 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/asinhf_wmt.S b/external/sgx_libm/ia32/asinhf_wmt.S new file mode 100644 index 0000000000..a754208a16 --- /dev/null +++ b/external/sgx_libm/ia32/asinhf_wmt.S @@ -0,0 +1,1256 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinhf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin asinhf + .text + .align 16,0x90 + .globl asinhf +asinhf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %eax + movl %eax, %ecx + movss %xmm0, 8(%esp) + andl $2147483647, %eax + cmpl $2139095040, %eax + jge .L_2TAG_PACKET_0.0.2 + cmpl $1056964608, %eax + jle .L_2TAG_PACKET_1.0.2 + cvtps2pd %xmm0, %xmm0 + movapd %xmm0, %xmm3 + andpd 128(%ebx), %xmm0 + andpd 112(%ebx), %xmm3 + cmpl $1199570944, %eax + jge .L_2TAG_PACKET_2.0.2 + movapd %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + addsd 96(%ebx), %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + pshufd $85, %xmm0, %xmm1 + movd %xmm1, %eax + movl %eax, %ecx + shrl $20, %eax + shrl $9, %ecx + subl $1023, %eax + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + movl %eax, %ecx + shrl $23, %eax + subl $126, %eax + shrl $12, %ecx +.L_2TAG_PACKET_3.0.2: + cvtsi2sdl %eax, %xmm2 + andpd 144(%ebx), %xmm0 + orpd 96(%ebx), %xmm0 + andl $2040, %ecx + movq 72(%ebx), %xmm1 + mulsd 2224(%ebx,%ecx), %xmm0 + subsd 96(%ebx), %xmm0 + mulsd 80(%ebx), %xmm2 + mulsd %xmm0, %xmm1 + addsd 64(%ebx), %xmm1 + mulsd %xmm0, %xmm1 + addsd 176(%ebx,%ecx), %xmm2 + mulsd %xmm0, %xmm1 + addsd %xmm1, %xmm0 + addsd %xmm2, %xmm0 + orpd %xmm3, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_1.0.2: + cmpl $838860800, %eax + jle .L_2TAG_PACKET_5.0.2 + cvtps2pd %xmm0, %xmm0 + movapd 48(%ebx), %xmm3 + movapd %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + movapd %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm2 + unpcklpd %xmm0, %xmm0 + mulpd %xmm0, %xmm3 + addpd 32(%ebx), %xmm3 + mulpd %xmm0, %xmm3 + addpd 16(%ebx), %xmm3 + mulpd %xmm0, %xmm3 + addpd (%ebx), %xmm3 + mulpd %xmm2, %xmm3 + pshufd $238, %xmm3, %xmm0 + addsd %xmm3, %xmm0 + mulsd %xmm1, %xmm0 + addsd %xmm1, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_5.0.2: + andl $2139095040, %eax + je .L_2TAG_PACKET_6.0.2 + shrl $31, %ecx + flds 8(%esp) + fsubl 160(%ebx,%ecx,8) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_6.0.2: + flds 8(%esp) + fld %st(0) + fmul %st(1), %st + fstps (%esp) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_0.0.2: + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_4.0.2: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type asinhf,@function + .size asinhf,.-asinhf + .data +# -- End asinhf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1429119421 + .long 3217380693 + .long 305580873 + .long 1068708659 + .long 3670928078 + .long 3215383394 + .long 2886529429 + .long 1067391652 + .long 1100460448 + .long 3214332679 + .long 2610913564 + .long 1066477690 + .long 3531562621 + .long 3213313024 + .long 3532580246 + .long 1064553239 + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .long 4277811695 + .long 1072049730 + .long 4277811695 + .long 1072049730 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 0 + .long 862978048 + .long 0 + .long 3010461696 + .long 1440057502 + .long 1063257089 + .long 341338964 + .long 1064833554 + .long 4184355568 + .long 1065621801 + .long 2227658503 + .long 1066152307 + .long 449262470 + .long 1066510009 + .long 1570422842 + .long 1066777242 + .long 121841140 + .long 1067045544 + .long 630691842 + .long 1067281191 + .long 2711485097 + .long 1067500943 + .long 2026622491 + .long 1067619660 + .long 766078039 + .long 1067755853 + .long 4074027864 + .long 1067875476 + .long 3056660584 + .long 1067995528 + .long 3195252556 + .long 1068133258 + .long 116861598 + .long 1068254238 + .long 325086471 + .long 1068375655 + .long 296456961 + .long 1068497513 + .long 2623383041 + .long 1068559379 + .long 1681725707 + .long 1068620754 + .long 2231263004 + .long 1068682354 + .long 2815553124 + .long 1068744181 + .long 2057310944 + .long 1068806237 + .long 2095798018 + .long 1068859611 + .long 2302040698 + .long 1068922096 + .long 745232013 + .long 1068984815 + .long 659581512 + .long 1069047769 + .long 1566132617 + .long 1069101918 + .long 550036981 + .long 1069165314 + .long 2887419564 + .long 1069219844 + .long 1990183441 + .long 1069283688 + .long 3220050856 + .long 1069338605 + .long 1669613218 + .long 1069393703 + .long 2145455994 + .long 1069458213 + .long 4275830246 + .long 1069513705 + .long 1392453108 + .long 1069558451 + .long 1469915213 + .long 1069586382 + .long 2183652476 + .long 1069619086 + .long 2109656884 + .long 1069647220 + .long 636640577 + .long 1069675449 + .long 510517079 + .long 1069703773 + .long 210141498 + .long 1069732193 + .long 2537624622 + .long 1069760709 + .long 1733817001 + .long 1069789323 + .long 137854980 + .long 1069813243 + .long 3905576828 + .long 1069842036 + .long 4131810788 + .long 1069870929 + .long 3760956694 + .long 1069899922 + .long 1473082581 + .long 1069929016 + .long 926113142 + .long 1069953338 + .long 3669742467 + .long 1069982617 + .long 3711755290 + .long 1070007095 + .long 311386407 + .long 1070036564 + .long 705364525 + .long 1070066136 + .long 1973375279 + .long 1070090859 + .long 3589645072 + .long 1070115655 + .long 2425772059 + .long 1070145508 + .long 1074899574 + .long 1070170467 + .long 118003300 + .long 1070200516 + .long 691310403 + .long 1070225639 + .long 3273036717 + .long 1070250837 + .long 1226436560 + .long 1070276112 + .long 2481153995 + .long 1070306542 + .long 3227997535 + .long 1070331985 + .long 1421812646 + .long 1070357506 + .long 3386588242 + .long 1070383104 + .long 2580043380 + .long 1070408781 + .long 1068692560 + .long 1070434537 + .long 938143489 + .long 1070460372 + .long 4293333010 + .long 1070486286 + .long 373864817 + .long 1070512282 + .long 4208958430 + .long 1070538357 + .long 783121462 + .long 1070564515 + .long 870975437 + .long 1070590754 + .long 3338886172 + .long 1070606585 + .long 3772343130 + .long 1070619787 + .long 2408245143 + .long 1070630379 + .long 3811383569 + .long 1070643656 + .long 1622638721 + .long 1070656976 + .long 1290798655 + .long 1070670338 + .long 2457529556 + .long 1070681058 + .long 2398194399 + .long 1070694497 + .long 3190801979 + .long 1070707979 + .long 3352241197 + .long 1070718796 + .long 1829681364 + .long 1070732357 + .long 2568927817 + .long 1070743237 + .long 2676427515 + .long 1070756877 + .long 2882402820 + .long 1070767821 + .long 44944622 + .long 1070781542 + .long 2957945300 + .long 1070792550 + .long 1261787704 + .long 1070806352 + .long 1589923677 + .long 1070817426 + .long 3274931829 + .long 1070828529 + .long 1999843716 + .long 1070842450 + .long 1673619518 + .long 1070853620 + .long 601221319 + .long 1070864820 + .long 3763576649 + .long 1070876049 + .long 1974923437 + .long 1070890129 + .long 1096100617 + .long 1070901427 + .long 2424897952 + .long 1070912755 + .long 2376202600 + .long 1070924114 + .long 1665651958 + .long 1070935504 + .long 1014729354 + .long 1070946925 + .long 722545241 + .long 1070961245 + .long 1800682930 + .long 1070972736 + .long 1029453230 + .long 1070984259 + .long 3450874911 + .long 1070995813 + .long 1228255906 + .long 1071007400 + .long 3711032981 + .long 1071019018 + .long 3075102917 + .long 1071030669 + .long 92696812 + .long 1071042353 + .long 3897749690 + .long 1071051136 + .long 1907922160 + .long 1071062877 + .long 4023807324 + .long 1071074650 + .long 2452345726 + .long 1071086457 + .long 2292128226 + .long 1071098297 + .long 58635942 + .long 1071110171 + .long 864186929 + .long 1071122078 + .long 3555691467 + .long 1071131030 + .long 2003684347 + .long 1071142997 + .long 1479703759 + .long 1071154998 + .long 2537208015 + .long 1071164021 + .long 3699909861 + .long 1071176082 + .long 3934098706 + .long 1071188178 + .long 3885764182 + .long 1071197273 + .long 1357790931 + .long 1071209431 + .long 295956059 + .long 1071221624 + .long 4080877676 + .long 1071230791 + .long 202970280 + .long 1071243047 + .long 3977575845 + .long 1071252261 + .long 35977849 + .long 1071264580 + .long 1585496963 + .long 1071273842 + .long 375247257 + .long 1071286224 + .long 1812199574 + .long 1071295534 + .long 1876912769 + .long 1071307980 + .long 1051846544 + .long 1071317339 + .long 979589448 + .long 1071329850 + .long 71706889 + .long 1071339258 + .long 2790898835 + .long 1071351834 + .long 4013797733 + .long 1071361291 + .long 2541231151 + .long 1071370770 + .long 921733145 + .long 1071383442 + .long 508375805 + .long 1071392971 + .long 3091669954 + .long 1071402521 + .long 3343209673 + .long 1071415289 + .long 1693047557 + .long 1071424891 + .long 173861808 + .long 1071434515 + .long 3515822703 + .long 1071444160 + .long 1974837761 + .long 1071457056 + .long 1189018219 + .long 1071466754 + .long 2441946573 + .long 1071476474 + .long 1887102255 + .long 1071486217 + .long 4271031636 + .long 1071495982 + .long 876995759 + .long 1071509039 + .long 438773454 + .long 1071518858 + .long 172621632 + .long 1071528700 + .long 544035182 + .long 1071538565 + .long 2021801298 + .long 1071548453 + .long 783063308 + .long 1071558365 + .long 1598254051 + .long 1071568300 + .long 651258553 + .long 1071578259 + .long 2719315456 + .long 1071588241 + .long 3993180461 + .long 1071598247 + .long 667093936 + .long 1071608278 + .long 1823716217 + .long 1071618332 + .long 3664357648 + .long 1071628410 + .long 2393914686 + .long 1071638513 + .long 1405419566 + .long 1071646656 + .long 563652001 + .long 1071651732 + .long 1074554091 + .long 1071656820 + .long 3195405229 + .long 1071661920 + .long 2890399284 + .long 1071667033 + .long 420597586 + .long 1071672159 + .long 87278952 + .long 1071675583 + .long 1753119502 + .long 1071680729 + .long 1959759897 + .long 1071685888 + .long 975389815 + .long 1071691060 + .long 3365155278 + .long 1071696244 + .long 811309190 + .long 1071701442 + .long 1269811480 + .long 1071704914 + .long 1108583542 + .long 1071710133 + .long 1034517919 + .long 1071715365 + .long 1327340287 + .long 1071720610 + .long 1388251237 + .long 1071724114 + .long 1488234797 + .long 1071729381 + .long 2711385691 + .long 1071734661 + .long 952179194 + .long 1071738189 + .long 3255685427 + .long 1071743491 + .long 3159039803 + .long 1071748807 + .long 951558972 + .long 1071752359 + .long 3234424125 + .long 1071757697 + .long 3904573547 + .long 1071763049 + .long 2648729924 + .long 1071766625 + .long 2729250212 + .long 1071772000 + .long 2000712574 + .long 1071777389 + .long 3125257108 + .long 1071780989 + .long 3160324803 + .long 1071786401 + .long 2216316974 + .long 1071790017 + .long 3875016090 + .long 1071795452 + .long 1439520610 + .long 1071799084 + .long 1298103361 + .long 1071804543 + .long 2217517956 + .long 1071810016 + .long 1191753587 + .long 1071813673 + .long 1728773900 + .long 1071819170 + .long 747445441 + .long 1071822843 + .long 1670772213 + .long 1071826522 + .long 1471209283 + .long 1071832053 + .long 3287905877 + .long 1071835748 + .long 594038131 + .long 1071841304 + .long 3920147917 + .long 1071845015 + .long 3957142762 + .long 1071850595 + .long 826988438 + .long 1071854324 + .long 242509008 + .long 1071859929 + .long 4173610350 + .long 1071863673 + .long 2518313625 + .long 1071867425 + .long 2671523434 + .long 1071873065 + .long 387544807 + .long 1071876834 + .long 1470497767 + .long 1071880609 + .long 4269259217 + .long 1071886284 + .long 1345663925 + .long 1071890077 + .long 2159323299 + .long 1071893876 + .long 957937516 + .long 1071899588 + .long 2994656967 + .long 1071903404 + .long 556124819 + .long 1071907228 + .long 1631098658 + .long 1071912976 + .long 1368257861 + .long 1071916817 + .long 1309849279 + .long 1071920665 + .long 1567156841 + .long 1071924520 + .long 1179420986 + .long 1071930316 + .long 569448444 + .long 1071934189 + .long 669557459 + .long 1071938069 + .long 1593834700 + .long 1071941956 + .long 3166083125 + .long 1071947800 + .long 211641815 + .long 1071951706 + .long 2780675719 + .long 1071955618 + .long 2400234567 + .long 1071959538 + .long 3482927192 + .long 1071963465 + .long 1852089988 + .long 1071967400 + .long 1020849000 + .long 1071973316 + .long 1718090839 + .long 1071977269 + .long 121152472 + .long 1071981230 + .long 646346839 + .long 1071985198 + .long 3415709705 + .long 1071989173 + .long 4257004898 + .long 1071993156 + .long 3293664199 + .long 1071997147 + .long 649825382 + .long 1072001146 + .long 248887552 + .long 1072007158 + .long 2541522737 + .long 1072011175 + .long 3593780107 + .long 1072015200 + .long 3533041935 + .long 1072019233 + .long 2487426809 + .long 1072023274 + .long 585795318 + .long 1072027323 + .long 2252723088 + .long 1072031379 + .long 3323604690 + .long 1072035443 + .long 3929561382 + .long 1072039515 + .long 4202479723 + .long 1072043595 + .long 4275017539 + .long 1072047683 + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type static_const_table,@object + .size static_const_table,4272 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/asinhl.S b/external/sgx_libm/ia32/asinhl.S new file mode 100644 index 0000000000..4842b34a58 --- /dev/null +++ b/external/sgx_libm/ia32/asinhl.S @@ -0,0 +1,1003 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinhl.c" + .text +..TXTST0: +# -- Begin asinhl + .text + .align 16,0x90 + .globl asinhl +asinhl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $56, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %ebx + andl $32767, %ebx + movzwl 14(%esp), %eax + cmpl $32767, %ebx + je ..B1.73 +..B1.4: + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $16382, %ebx + jge ..B1.46 +..B1.5: + cmpl $16376, %ebx + jge ..B1.39 +..B1.6: + cmpl $16371, %ebx + jge ..B1.32 +..B1.7: + cmpl $16365, %ebx + jge ..B1.25 +..B1.8: + cmpl $16308, %ebx + jge ..B1.18 +..B1.9: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.67 +..B1.10: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.11: + fldcw 12(%esp) +..B1.12: + movzwl 16(%ebp), %ebx + movl $1, %eax + andl $32767, %ebx +..B1.13: + testl %ebx, %ebx + jle ..B1.63 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ecx) + fmul %st(1), %st + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ecx) + fstpt (%esp) +..B1.15: + testl %eax, %eax + je ..B1.17 +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt (%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.68 +..B1.19: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.20: + fldcw 12(%esp) +..B1.21: + movl $1, %eax +..B1.22: + fldt 8(%ebp) + testl %eax, %eax + fldt _Q3@GOTOFF(%ecx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.24 +..B1.23: + fldcw 14(%esp) +..B1.24: + fldt (%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.69 +..B1.26: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.27: + fldcw 12(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_Q2@GOTOFF(%ecx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.31 +..B1.30: + fldcw 14(%esp) +..B1.31: + fldt (%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.70 +..B1.33: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.34: + fldcw 12(%esp) +..B1.35: + movl $1, %eax +..B1.36: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%ecx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%ecx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.38 +..B1.37: + fldcw 14(%esp) +..B1.38: + fldt (%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.71 +..B1.40: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.41: + fldcw 12(%esp) +..B1.42: + movl $1, %eax +..B1.43: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fld %st(1) + fldl _TWO_53H@GOTOFF(%ecx) + fmul %st(3), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fmul %st(0), %st + fstpt 32(%esp) + fldt 32(%esp) + fadd %st, %st(2) + fld %st(2) + fmul %st(2), %st + fxch %st(4) + fstpt 16(%esp) + fld %st(1) + fmul %st(1), %st + faddp %st, %st(4) + fld %st(3) + fxch %st(1) + fmul %st(0), %st + fadd %st, %st(1) + fldt 228+_Q@GOTOFF(%ecx) + fmul %st(2), %st + fldt 204+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 180+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 156+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 132+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 108+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 216+_Q@GOTOFF(%ecx) + fmul %st(3), %st + fldt 192+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 168+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 144+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 120+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt _Q@GOTOFF(%ecx) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt 252+_Q@GOTOFF(%ecx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmulp %st, %st(3) + fldt 240+_Q@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 32(%esp) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 16(%esp) + fld %st(0) + fldl _TWO_48H@GOTOFF(%ecx) + fld %st(0) + fadd %st(5), %st + fsubp %st, %st(1) + fmul %st, %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fldt 8(%ebp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt (%esp) + fmul %st, %st(2) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.45 +..B1.44: + fldcw 14(%esp) +..B1.45: + fldt (%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.72 +..B1.47: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.48: + fldcw 12(%esp) +..B1.49: + movl $1, %edx +..B1.50: + fldt 8(%ebp) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl ones@GOTOFF(%ecx,%eax,8) + fmul %st, %st(1) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + movzwl 16(%ebp), %ebx + movl %ebx, %eax + andl $32767, %eax + cmpl $16421, %eax + jge ..B1.59 +..B1.51: + cmpl $16388, %eax + jge ..B1.53 +..B1.52: + fldl _TWO_52H@GOTOFF(%ecx) + fld %st(0) + fld %st(2) + fadd %st(2), %st + fsub %st(2), %st + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsqrt + fadd %st, %st(4) + fxch %st(5) + fsubrp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(1) + fld %st(3) + fxch %st(4) + fsubr %st, %st(5) + fxch %st(4) + fmul %st(5), %st + fsubrp %st, %st(1) + faddp %st, %st(1) + fld %st(2) + fadd %st(4), %st + fdivrp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(1) + fstpt 16(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fxch %st(1) + jmp ..B1.58 +..B1.53: + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + cmpl $16394, %eax + fmul %st(1), %st + fld %st(0) + fldl _TWO_32H@GOTOFF(%ecx) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fsubr %st(1), %st + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + jge ..B1.55 +..B1.54: + fstp %st(2) + fld %st(2) + fmul %st(3), %st + fadd %st(2), %st + fsqrt + faddp %st, %st(3) + fxch %st(1) + fdiv %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + jmp ..B1.58 +..B1.55: + fstp %st(3) + cmpl $16401, %eax + jge ..B1.57 +..B1.56: + fld %st(2) + fdiv %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fdivr %st(2), %st + faddp %st, %st(1) + jmp ..B1.58 +..B1.57: + fxch %st(1) + fdivr %st(2), %st + faddp %st, %st(1) +..B1.58: + fldt 16(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 8(%ebp) + movzwl 16(%ebp), %eax + andl $32767, %eax + movl %eax, %ebx + addl $-16383, %eax + negl %ebx + fxch %st(2) + fstpt (%esp) + addl $-2, %ebx + movzwl 8(%esp), %esi + andl $32767, %ebx + andl $-32768, %esi + orl %ebx, %esi + movw %si, 8(%esp) + fldt (%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 16(%esp) + fmulp %st, %st(1) + jmp ..B1.60 +..B1.59: + fstp %st(0) + fldl _TWO_52H@GOTOFF(%ecx) + andl $-32768, %ebx + orl $-49153, %ebx + addl $-16382, %eax + movw %bx, 16(%ebp) + fldt 8(%ebp) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(1) +..B1.60: + fldt 16(%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + fldt 60+_P@GOTOFF(%ecx) + movl 12(%ebp), %ebx + shrl $23, %ebx + movzbl %bl, %ebx + movl %eax, (%esp) + flds __libm_rcp_table_256@GOTOFF(%ecx,%ebx,4) + fmul %st, %st(3) + shll $4, %ebx + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + testl %edx, %edx + fxch %st(4) + fmulp %st, %st(2) + fxch %st(1) + fadd %st, %st(3) + fld %st(3) + fmul %st(4), %st + fmul %st, %st(2) + fxch %st(4) + fstpt 8(%ebp) + fldt 8(%ebp) + fildl (%esp) + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fmulp %st, %st(1) + fldt 48+_P@GOTOFF(%ecx) + fmul %st(5), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fldt .L_2il0floatpacket.4@GOTOFF(%ecx) + fmul %st(1), %st + fldt .L_2il0floatpacket.5@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl 8+__libm_logl_table_256@GOTOFF(%ecx,%ebx) + faddp %st, %st(3) + faddl __libm_logl_table_256@GOTOFF(%ebx,%ecx) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%esp) + je ..B1.62 +..B1.61: + fldcw 14(%esp) +..B1.62: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.63: + cmpl $0, 12(%ebp) + jne ..B1.65 +..B1.64: + cmpl $0, 8(%ebp) + je ..B1.66 +..B1.65: + fldt 8(%ebp) + fldt _small_value_80@GOTOFF(%ecx) + movzbl 17(%ebp), %ebx + andl $128, %ebx + shrl $7, %ebx + lea (,%ebx,8), %edx + lea (%edx,%ebx,4), %esi + fldt _small_value_80@GOTOFF(%ecx,%esi) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.66: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.15 +..B1.67: + xorl %eax, %eax + jmp ..B1.13 +..B1.68: + xorl %eax, %eax + jmp ..B1.22 +..B1.69: + xorl %eax, %eax + jmp ..B1.29 +..B1.70: + xorl %eax, %eax + jmp ..B1.36 +..B1.71: + xorl %eax, %eax + jmp ..B1.43 +..B1.72: + xorl %edx, %edx + jmp ..B1.50 +..B1.73: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.79 +..B1.74: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.75: + fldcw 12(%esp) +..B1.76: + fldt 8(%ebp) + fstpt (%esp) +..B1.77: + fldcw 14(%esp) +..B1.78: + fldt (%esp) + addl $56, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.79: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.78 + .align 16,0x90 + .type asinhl,@function + .size asinhl,.-asinhl + .data +# -- End asinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_Q3: + .word 6991 + .word 42216 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 33268 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 9764 + .word 39322 + .word 39161 + .word 39321 + .word 16379 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 43682 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 14144 + .word 39303 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 10686 + .word 40209 + .word 28068 + .word 46811 + .word 49146 + .word 0 + .word 6376 + .word 25459 + .word 13370 + .word 63707 + .word 16377 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 42228 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 4505 + .word 52442 + .word 52428 + .word 52428 + .word 49134 + .word 0 + .word 31967 + .word 56173 + .word 28086 + .word 46811 + .word 49146 + .word 0 + .word 26124 + .word 58234 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 22137 + .word 23222 + .word 53620 + .word 46917 + .word 49145 + .word 0 + .word 45395 + .word 61656 + .word 25205 + .word 36391 + .word 16377 + .word 0 + .word 28077 + .word 15147 + .word 52421 + .word 58572 + .word 49144 + .word 0 + .word 19650 + .word 2873 + .word 50009 + .word 48451 + .word 16376 + .word 0 + .word 47538 + .word 64725 + .word 9133 + .word 40943 + .word 49144 + .word 0 + .word 42460 + .word 64288 + .word 29314 + .word 35191 + .word 16376 + .word 0 + .word 54924 + .word 18085 + .word 19628 + .word 61339 + .word 49143 + .word 0 + .word 8359 + .word 63244 + .word 48955 + .word 54066 + .word 16375 + .word 0 + .word 13301 + .word 22367 + .word 28967 + .word 48066 + .word 49143 + .word 0 + .word 47487 + .word 41074 + .word 54143 + .word 42870 + .word 16375 + .word 0 + .word 18176 + .word 28317 + .word 25378 + .word 37849 + .word 49143 + .word 0 + .word 2947 + .word 59345 + .word 39582 + .word 64148 + .word 16374 + .word 0 + .word 7071 + .word 46945 + .word 60101 + .word 49232 + .word 49142 + .word 0 + .word 33184 + .word 23492 + .word 18153 + .word 62298 + .word 16373 + .word 0 + .word 44779 + .word 60944 + .word 30881 + .word 55868 + .word 49140 + .word 0 + .word 22870 + .word 51718 + .word 28591 + .word 51709 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16379 + .word 0 + .type _Q,@object + .size _Q,264 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .type _P,@object + .size _P,72 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/asinl.S b/external/sgx_libm/ia32/asinl.S new file mode 100644 index 0000000000..99ef476461 --- /dev/null +++ b/external/sgx_libm/ia32/asinl.S @@ -0,0 +1,1176 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinl.c" + .text +..TXTST0: +# -- Begin asinl + .text + .align 16,0x90 + .globl asinl +asinl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $88, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %edx + movzwl 16(%ebp), %eax + andl $128, %edx + andl $32767, %eax + shrl $7, %edx + movzwl 14(%esp), %ebx + cmpl $16383, %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + jge ..B1.59 +..B1.4: + cmpl $16382, %eax + jge ..B1.49 +..B1.5: + cmpl $16376, %eax + jge ..B1.39 +..B1.6: + cmpl $16371, %eax + jge ..B1.32 +..B1.7: + cmpl $16365, %eax + jge ..B1.25 +..B1.8: + cmpl $16308, %eax + jge ..B1.18 +..B1.9: + movl %ebx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.79 +..B1.10: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.11: + fldcw 12(%esp) +..B1.12: + movzwl 16(%ebp), %eax + movl $1, %ebx + andl $32767, %eax +..B1.13: + testl %eax, %eax + jle ..B1.75 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ecx) + fmul %st(1), %st + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ecx) + fstpt (%esp) +..B1.15: + testl %ebx, %ebx + je ..B1.17 +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.80 +..B1.19: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.20: + fldcw 12(%esp) +..B1.21: + movl $1, %eax +..B1.22: + fldt 8(%ebp) + testl %eax, %eax + fldt _P4@GOTOFF(%ecx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.24 +..B1.23: + fldcw 14(%esp) +..B1.24: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.81 +..B1.26: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.27: + fldcw 12(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_P3@GOTOFF(%ecx) + fmul %st(1), %st + fldt _P3@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.31 +..B1.30: + fldcw 14(%esp) +..B1.31: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.82 +..B1.33: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.34: + fldcw 12(%esp) +..B1.35: + movl $1, %eax +..B1.36: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_P2@GOTOFF(%ecx) + fmul %st(1), %st + fldt 12+_P2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P2@GOTOFF(%ecx) + fmulp %st, %st(2) + fldt _P2@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.38 +..B1.37: + fldcw 14(%esp) +..B1.38: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %ebx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.83 +..B1.40: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.41: + fldcw 12(%esp) +..B1.42: + movzwl 16(%ebp), %eax + movl $1, %edx + andl $32767, %eax +..B1.43: + fldt 8(%ebp) + cmpl $16381, %eax + fld %st(0) + fldl _TWO_52H@GOTOFF(%ecx) + fmul %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubp %st, %st(2) + fld %st(1) + fxch %st(1) + fstpt 16(%esp) + fld %st(1) + fsubr %st(3), %st + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fxch %st(2) + fstpt 64(%esp) + fldt 64(%esp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fstpt 48(%esp) + fldt 48(%esp) + fld %st(1) + fmul %st(4), %st + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 32(%esp) + fldt 32(%esp) + fld %st(2) + fmul %st(3), %st + fld %st(0) + faddp %st, %st(2) + jge ..B1.45 +..B1.44: + fstp %st(0) + fldt 132+_P1@GOTOFF(%ecx) + fmul %st(1), %st + fldt 108+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_P1@GOTOFF(%ecx) + fldt 120+_P1@GOTOFF(%ecx) + fmul %st(3), %st + fldt 96+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _P1@GOTOFF(%ecx) + faddp %st, %st(2) + fldt 48(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%esp) + fldt 144+_P1@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + jmp ..B1.46 +..B1.45: + fldt 204+_P@GOTOFF(%ecx) + fmul %st(2), %st + fldt 180+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 156+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 132+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 108+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 192+_P@GOTOFF(%ecx) + fmul %st(3), %st + fldt 168+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 144+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 120+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(3) + fldt 48(%esp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 32(%esp) + fldt (%esp) + fldt 228+_P@GOTOFF(%ecx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldt 216+_P@GOTOFF(%ecx) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fld %st(1) + fxch %st(5) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 16(%esp) + fmul %st(1), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fsub %st(3), %st + faddp %st, %st(1) +..B1.46: + fldt 64(%esp) + fld %st(2) + fmul %st(4), %st + testl %edx, %edx + fxch %st(5) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 64(%esp) + je ..B1.48 +..B1.47: + fldcw 14(%esp) +..B1.48: + fldt 64(%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.49: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.84 +..B1.50: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.51: + fldcw 12(%esp) +..B1.52: + movl $1, %ebx +..B1.53: + fldl _ones@GOTOFF(%ecx,%edx,8) + fstl 80(%esp) + fldt 8(%ebp) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fldl _TWO_32H@GOTOFF(%ecx) + fldl _TWO_52H@GOTOFF(%ecx) + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(3) + fsubrl _ones@GOTOFF(%ecx) + fmul %st(2), %st + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fxch %st(1) + fsub %st(2), %st + fadd %st, %st(1) + fxch %st(1) + fsqrt + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fsubr %st, %st(3) + fld %st(5) + fxch %st(2) + fsub %st(6), %st + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fld %st(4) + fadd %st(1), %st + fdivrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(1) + fld %st(3) + fadd %st(3), %st + fmul %st, %st(1) + fld %st(4) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fld %st(2) + fadd %st(1), %st + fstpt 64(%esp) + fldt 64(%esp) + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fld %st(2) + fmul %st(3), %st + fld %st(0) + faddp %st, %st(2) + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fcompp + fnstsw %ax + sahf + jbe ..B1.55 +..B1.54: + fstp %st(1) + fldt 132+_P1@GOTOFF(%ecx) + fmul %st(1), %st + fldt 108+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_P1@GOTOFF(%ecx) + fldt 120+_P1@GOTOFF(%ecx) + fmul %st(3), %st + fldt 96+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _P1@GOTOFF(%ecx) + faddp %st, %st(2) + fldt 64(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 16(%esp) + fldt 144+_P1@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(2) + fxch %st(1) + jmp ..B1.56 +..B1.55: + fldt 204+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 180+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 156+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 132+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 192+_P@GOTOFF(%ecx) + fmul %st(2), %st + fldt 168+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 144+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 120+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(2) + fldt 64(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 48(%esp) + fldt 16(%esp) + fldt 228+_P@GOTOFF(%ecx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fldt 216+_P@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fldt 32(%esp) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) +..B1.56: + fldt (%esp) + testl %ebx, %ebx + fmulp %st, %st(2) + fld %st(2) + fmul %st(1), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st(2), %st + faddp %st, %st(2) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmul %st, %st(1) + fmulp %st, %st(2) + fldt _pi_02@GOTOFF(%ecx) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fldt 12+_pi_02@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fmull 80(%esp) + fstpt 16(%esp) + je ..B1.58 +..B1.57: + fldcw 14(%esp) +..B1.58: + fldt 16(%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.59: + movl %ebx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.85 +..B1.60: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.61: + fldcw 12(%esp) +..B1.62: + movzwl 16(%ebp), %eax + movl $1, %ebx + andl $32767, %eax +..B1.63: + cmpl $32767, %eax + jne ..B1.67 +..B1.64: + cmpl $-2147483648, 12(%ebp) + jne ..B1.66 +..B1.65: + cmpl $0, 8(%ebp) + je ..B1.71 +..B1.66: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.72 +..B1.67: + cmpl $16383, %eax + jne ..B1.71 +..B1.68: + cmpl $-2147483648, 12(%ebp) + jne ..B1.71 +..B1.69: + cmpl $0, 8(%ebp) + jne ..B1.71 +..B1.70: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %edx + fldt _pi_2l@GOTOFF(%edx,%ecx) + fldt _small_value_80@GOTOFF(%edx,%ecx) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.72 +..B1.71: + fldl _infs@GOTOFF(%ecx) + fmull _zeros@GOTOFF(%ecx) + fstpt (%esp) +..B1.72: + testl %ebx, %ebx + je ..B1.74 +..B1.73: + fldcw 14(%esp) +..B1.74: + fldt (%esp) + addl $88, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.75: + cmpl $0, 12(%ebp) + jne ..B1.77 +..B1.76: + cmpl $0, 8(%ebp) + je ..B1.78 +..B1.77: + fldt 8(%ebp) + lea (,%edx,8), %eax + fldt _small_value_80@GOTOFF(%ecx) + lea (%eax,%edx,4), %edx + fldt _small_value_80@GOTOFF(%ecx,%edx) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.78: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.15 +..B1.79: + xorl %ebx, %ebx + jmp ..B1.13 +..B1.80: + xorl %eax, %eax + jmp ..B1.22 +..B1.81: + xorl %eax, %eax + jmp ..B1.29 +..B1.82: + xorl %eax, %eax + jmp ..B1.36 +..B1.83: + xorl %edx, %edx + jmp ..B1.43 +..B1.84: + xorl %ebx, %ebx + jmp ..B1.53 +..B1.85: + xorl %ebx, %ebx + jmp ..B1.63 + .align 16,0x90 + .type asinl,@function + .size asinl,.-asinl + .data +# -- End asinl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_P4: + .word 43691 + .word 44938 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _P4,@object + .size _P4,12 + .align 2 +_P3: + .word 36763 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 40704 + .word 58046 + .word 39460 + .word 39321 + .word 16379 + .word 0 + .type _P3,@object + .size _P3,24 + .align 2 +_P2: + .word 43688 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 20771 + .word 39331 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 23807 + .word 53798 + .word 28073 + .word 46811 + .word 16378 + .word 0 + .word 35198 + .word 7516 + .word 54204 + .word 63722 + .word 16377 + .word 0 + .type _P2,@object + .size _P2,48 + .align 2 +_P1: + .word 43589 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 39364 + .word 39321 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 17602 + .word 56173 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 47501 + .word 58414 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 27078 + .word 6583 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 39781 + .word 21053 + .word 25224 + .word 36391 + .word 16377 + .word 0 + .word 46568 + .word 6235 + .word 50749 + .word 58572 + .word 16376 + .word 0 + .word 41318 + .word 51558 + .word 37628 + .word 48452 + .word 16376 + .word 0 + .word 55026 + .word 7893 + .word 43866 + .word 40925 + .word 16376 + .word 0 + .word 43387 + .word 19951 + .word 2911 + .word 35445 + .word 16376 + .word 0 + .word 32572 + .word 59281 + .word 11243 + .word 56666 + .word 16375 + .word 0 + .word 49800 + .word 50337 + .word 42707 + .word 39184 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .type _P1,@object + .size _P1,156 + .align 2 +_P: + .word 42691 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 4317 + .word 52400 + .word 52428 + .word 52428 + .word 49134 + .word 0 + .word 26206 + .word 56172 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 36130 + .word 58514 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 21592 + .word 8113 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 3093 + .word 49950 + .word 25215 + .word 36391 + .word 16377 + .word 0 + .word 21499 + .word 24428 + .word 51889 + .word 58572 + .word 16376 + .word 0 + .word 54828 + .word 41264 + .word 61120 + .word 48451 + .word 16376 + .word 0 + .word 10243 + .word 1489 + .word 39717 + .word 40940 + .word 16376 + .word 0 + .word 51433 + .word 46039 + .word 63564 + .word 35220 + .word 16376 + .word 0 + .word 60402 + .word 39286 + .word 25675 + .word 60826 + .word 16375 + .word 0 + .word 34219 + .word 36833 + .word 44839 + .word 57547 + .word 16375 + .word 0 + .word 13013 + .word 26091 + .word 19721 + .word 60832 + .word 16374 + .word 0 + .word 22353 + .word 41544 + .word 55443 + .word 55735 + .word 16376 + .word 0 + .word 14948 + .word 7038 + .word 38091 + .word 38339 + .word 49145 + .word 0 + .word 61727 + .word 61480 + .word 15906 + .word 51927 + .word 16378 + .word 0 + .word 13386 + .word 23084 + .word 64443 + .word 55906 + .word 49146 + .word 0 + .word 17499 + .word 23573 + .word 43947 + .word 42761 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16379 + .word 0 + .type _P,@object + .size _P,240 + .align 2 +_pi_02: + .word 0 + .word 0 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 35374 + .word 4889 + .word 2259 + .word 34211 + .word 16349 + .word 0 + .type _pi_02,@object + .size _pi_02,24 + .align 2 +_pi_2l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .type _pi_2l,@object + .size _pi_2l,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atan2_wmt.S b/external/sgx_libm/ia32/atan2_wmt.S new file mode 100644 index 0000000000..31a1c073cb --- /dev/null +++ b/external/sgx_libm/ia32/atan2_wmt.S @@ -0,0 +1,1219 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin atan2 + .text + .align 16,0x90 + .globl atan2 +atan2: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 136(%esp), %xmm1 + movsd 128(%esp), %xmm0 + pextrw $3, %xmm0, %eax + movq %xmm0, 8(%esp) + andl $32752, %eax + movq %xmm1, 16(%esp) + subl $14448, %eax + cmpl $3840, %eax + ja .L_2TAG_PACKET_0.0.3 + pextrw $3, %xmm1, %eax + andl $32752, %eax + subl $14448, %eax + cmpl $3840, %eax + ja .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + unpcklpd %xmm1, %xmm0 + xorpd %xmm5, %xmm5 + xorpd %xmm3, %xmm3 + movl $2048, %eax + pinsrw $3, %eax, %xmm5 + paddw %xmm1, %xmm5 + psrlq $29, %xmm5 + rcpss %xmm5, %xmm3 + xorpd %xmm4, %xmm4 + movl $14336, %ecx + pinsrw $3, %ecx, %xmm4 + psllq $29, %xmm3 + paddw %xmm4, %xmm3 + mulsd %xmm0, %xmm3 + xorpd %xmm2, %xmm2 + xorpd %xmm6, %xmm6 + xorpd %xmm7, %xmm7 + movl $32768, %eax + pinsrw $2, %eax, %xmm6 + movl $32767, %ecx + pinsrw $3, %ecx, %xmm7 + paddd %xmm6, %xmm3 + andpd %xmm7, %xmm3 + movapd %xmm3, %xmm5 + pextrw $3, %xmm3, %eax + movl $16448, %ecx + pinsrw $3, %ecx, %xmm2 + minsd %xmm2, %xmm3 + movmskpd %xmm0, %edx + psllq $1, %xmm0 + psrlq $1, %xmm0 + cmpsd $2, %xmm2, %xmm5 + psllq $1, %xmm1 + psrlq $1, %xmm1 + movapd %xmm1, %xmm6 + movapd %xmm1, %xmm7 + movapd %xmm0, %xmm2 + movl $0, %ecx + pinsrw $0, %ecx, %xmm6 + subsd %xmm6, %xmm7 + movapd %xmm0, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm7 + andpd %xmm5, %xmm0 + subsd %xmm6, %xmm0 + andpd %xmm5, %xmm1 + addsd %xmm1, %xmm4 + subsd %xmm7, %xmm0 + andl $32752, %eax + subl $16286, %eax + cmpl $1121, %eax + ja .L_2TAG_PACKET_3.0.3 + divsd %xmm4, %xmm0 + pextrw $3, %xmm3, %ecx + movsd 2944(%ebx), %xmm2 + movsd 2960(%ebx), %xmm3 + pextrw $0, %xmm5, %eax + addl %edx, %edx + movapd 2688(%ebx,%edx,8), %xmm6 + movapd 2752(%ebx,%edx,8), %xmm1 + subl $16286, %ecx + notl %eax + andl $1, %eax + addl %eax, %ecx + addl %ecx, %ecx + movapd (%ebx,%ecx,8), %xmm5 + xorpd %xmm1, %xmm5 + addpd %xmm6, %xmm5 + movapd %xmm5, %xmm6 + unpckhpd %xmm5, %xmm5 + xorpd %xmm0, %xmm1 + movapd %xmm1, %xmm4 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm2 + addsd %xmm0, %xmm3 + addsd %xmm6, %xmm1 + subsd %xmm1, %xmm6 + addsd %xmm4, %xmm6 + addsd 2952(%ebx), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm4 + addsd %xmm5, %xmm6 + mulsd %xmm4, %xmm2 + addsd 2968(%ebx), %xmm3 + mulsd %xmm3, %xmm2 + addsd %xmm6, %xmm2 + addsd %xmm2, %xmm1 + movsd %xmm1, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_3.0.3: + addl $942, %eax + cmpl $942, %eax + ja .L_2TAG_PACKET_5.0.3 + xorpd %xmm4, %xmm4 + movl $16368, %ecx + pinsrw $3, %ecx, %xmm4 + divsd %xmm1, %xmm4 + addl %edx, %edx + movapd 2752(%ebx,%edx,8), %xmm6 + unpcklpd %xmm3, %xmm3 + xorpd %xmm6, %xmm0 + xorpd %xmm6, %xmm2 + xorpd %xmm6, %xmm3 + movapd 2816(%ebx,%edx,8), %xmm7 + movsd 2944(%ebx), %xmm1 + movsd 2960(%ebx), %xmm5 + andpd 2880(%ebx,%edx,8), %xmm3 + mulsd %xmm4, %xmm2 + mulsd %xmm4, %xmm0 + movapd %xmm2, %xmm6 + mulsd %xmm2, %xmm2 + mulsd %xmm2, %xmm1 + addsd %xmm2, %xmm5 + mulsd %xmm2, %xmm6 + addsd 2952(%ebx), %xmm1 + mulsd %xmm2, %xmm5 + addsd %xmm0, %xmm7 + addpd %xmm3, %xmm7 + mulsd %xmm6, %xmm1 + addsd 2968(%ebx), %xmm5 + mulsd %xmm1, %xmm5 + addsd %xmm7, %xmm5 + unpckhpd %xmm7, %xmm7 + addsd %xmm7, %xmm5 + movsd %xmm5, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + movsd 16(%esp), %xmm1 + movsd 8(%esp), %xmm0 + pextrw $3, %xmm1, %eax + andl $32752, %eax + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl %eax, %ecx + jg .L_2TAG_PACKET_6.0.3 + pextrw $3, %xmm1, %ecx + cmpl $32767, %ecx + jg .L_2TAG_PACKET_7.0.3 + divsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_7.0.3: + andpd 2672(%ebx), %xmm0 + movsd 2640(%ebx), %xmm2 + xorpd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_6.0.3: + andpd 2672(%ebx), %xmm0 + movsd 2624(%ebx), %xmm2 + xorpd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_0.0.3: +.L_2TAG_PACKET_1.0.3: + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + pextrw $3, %xmm1, %eax + andl $32752, %eax + cmpl $32752, %ecx + je .L_2TAG_PACKET_8.0.3 + cmpl $32752, %eax + je .L_2TAG_PACKET_9.0.3 + movsd 2992(%ebx), %xmm3 + movl $1024, %edx + movsd 2976(%ebx), %xmm4 + xorpd %xmm6, %xmm6 + movsd 3008(%ebx), %xmm7 + cmpl $0, %ecx + je .L_2TAG_PACKET_10.0.3 +.L_2TAG_PACKET_11.0.3: + cmpl $0, %eax + je .L_2TAG_PACKET_12.0.3 +.L_2TAG_PACKET_13.0.3: + addl %ecx, %edx + subl %eax, %edx + cmpl $2048, %edx + ja .L_2TAG_PACKET_5.0.3 + addl $15344, %edx + pinsrw $3, %edx, %xmm6 + andpd %xmm4, %xmm0 + andpd %xmm4, %xmm1 + orpd %xmm6, %xmm0 + orpd %xmm7, %xmm1 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_10.0.3: + subl $880, %edx + mulsd %xmm3, %xmm0 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $0, %ecx + je .L_2TAG_PACKET_14.0.3 + jmp .L_2TAG_PACKET_11.0.3 +.L_2TAG_PACKET_12.0.3: + addl $880, %edx + mulsd %xmm3, %xmm1 + pextrw $3, %xmm1, %eax + andl $32752, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_15.0.3 + jmp .L_2TAG_PACKET_13.0.3 +.L_2TAG_PACKET_8.0.3: + movd %xmm0, %edx + movapd %xmm0, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + andl $1048575, %ecx + orl %edx, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_16.0.3 + psrlq $63, %xmm0 + psllq $63, %xmm0 + cmpl $32752, %eax + jae .L_2TAG_PACKET_17.0.3 + movapd 2624(%ebx), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 +.L_2TAG_PACKET_18.0.3: + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_16.0.3: + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_17.0.3: + movd %xmm1, %eax + movapd %xmm1, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + movl $-2147483648, %edx + andl %ecx, %edx + andl $1048575, %ecx + orl %eax, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_19.0.3 + cmpl $0, %edx + jne .L_2TAG_PACKET_20.0.3 + movapd 2656(%ebx), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_19.0.3: + movapd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_20.0.3: + movapd 2656(%ebx), %xmm5 + movapd 2624(%ebx), %xmm6 + addpd %xmm6, %xmm5 + pshufd $238, %xmm5, %xmm6 + addpd %xmm6, %xmm5 + orpd %xmm5, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_9.0.3: + movd %xmm1, %eax + movapd %xmm1, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + movl $-2147483648, %edx + andl %ecx, %edx + andl $1048575, %ecx + orl %eax, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_19.0.3 + psrlq $63, %xmm0 + psllq $63, %xmm0 + cmpl $0, %edx + jne .L_2TAG_PACKET_21.0.3 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_21.0.3: + movapd 2640(%ebx), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_14.0.3: + pextrw $3, %xmm1, %edx + andl $32768, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_22.0.3 + movapd 2640(%ebx), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + comisd %xmm0, %xmm1 + orpd %xmm5, %xmm0 + jne .L_2TAG_PACKET_23.0.3 +.L_2TAG_PACKET_24.0.3: + movsd %xmm0, (%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $37, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_23.0.3: + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_22.0.3: + comisd %xmm0, %xmm1 + jne .L_2TAG_PACKET_23.0.3 + je .L_2TAG_PACKET_24.0.3 +.L_2TAG_PACKET_15.0.3: + movapd 2624(%ebx), %xmm5 + psrlq $63, %xmm0 + psllq $63, %xmm0 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_4.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type atan2,@function + .size atan2,.-atan2 + .data +# -- End atan2 + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 3390881280 + .long 1067318733 + .long 1411116779 + .long 1018950063 + .long 2985987840 + .long 1067384211 + .long 2088903695 + .long 1018086027 + .long 3148445184 + .long 1067449685 + .long 2044163806 + .long 1017271335 + .long 3667629184 + .long 1067515494 + .long 2353092775 + .long 1019967309 + .long 1546568832 + .long 1067580954 + .long 611991315 + .long 1017602584 + .long 3815996800 + .long 1067646404 + .long 466038598 + .long 1019686426 + .long 4050241920 + .long 1067711845 + .long 3265026328 + .long 1019626952 + .long 120454912 + .long 1067777277 + .long 1542207696 + .long 1020155608 + .long 2784639744 + .long 1067842697 + .long 3883834623 + .long 1018602870 + .long 1328010624 + .long 1067908107 + .long 1791097456 + .long 1019053126 + .long 2217794048 + .long 1067973505 + .long 551619938 + .long 1018494194 + .long 3333520000 + .long 1068038891 + .long 2390331823 + .long 1019033022 + .long 2557052032 + .long 1068104265 + .long 2423976108 + .long 1019728674 + .long 2067649536 + .long 1068169626 + .long 3757397745 + .long 1018672362 + .long 4047094784 + .long 1068234973 + .long 481613184 + .long 1019275104 + .long 2089853184 + .long 1068300307 + .long 1733914374 + .long 1020124677 + .long 2678003840 + .long 1068365626 + .long 1373600282 + .long 1013935474 + .long 3706496128 + .long 1068430930 + .long 1000610902 + .long 1019673285 + .long 3073179008 + .long 1068496219 + .long 1497143008 + .long 1019900342 + .long 2803716736 + .long 1068562846 + .long 1476677416 + .long 1019444094 + .long 3204984128 + .long 1068628077 + .long 1192335905 + .long 1018748628 + .long 831146624 + .long 1068693273 + .long 2733586224 + .long 1018823295 + .long 243029376 + .long 1068758431 + .long 950106081 + .long 1019046675 + .long 1735561920 + .long 1068823549 + .long 3546440856 + .long 1020104712 + .long 1339217792 + .long 1068888626 + .long 3028812387 + .long 1019818321 + .long 3706342144 + .long 1068953659 + .long 3814564029 + .long 1017763871 + .long 637726976 + .long 1069018648 + .long 3584007699 + .long 1017976868 + .long 1148779264 + .long 1069083589 + .long 2282532133 + .long 1019483954 + .long 1406131392 + .long 1069148481 + .long 1547359113 + .long 1019786342 + .long 1908875904 + .long 1069213322 + .long 1315508410 + .long 1020009473 + .long 3194947520 + .long 1069278110 + .long 3845393201 + .long 1015803761 + .long 1547487744 + .long 1069342844 + .long 3863107865 + .long 1019810104 + .long 1881061952 + .long 1069407521 + .long 4288343548 + .long 1019687581 + .long 563086336 + .long 1069472140 + .long 2582230241 + .long 1020099350 + .long 2594975552 + .long 1069536698 + .long 2306443764 + .long 1019667244 + .long 3438545024 + .long 1069606573 + .long 957455549 + .long 1015587735 + .long 4211357472 + .long 1069670906 + .long 2611778754 + .long 1017877214 + .long 3002835424 + .long 1069735101 + .long 235580458 + .long 1020211685 + .long 3905315424 + .long 1069799150 + .long 3630647617 + .long 1018736849 + .long 2849656576 + .long 1069863047 + .long 2412165062 + .long 1019693004 + .long 507429472 + .long 1069926785 + .long 1397750723 + .long 1018412717 + .long 2307470272 + .long 1069990356 + .long 1796470904 + .long 1019796181 + .long 1271814912 + .long 1070053755 + .long 189761565 + .long 1016149115 + .long 3800538144 + .long 1070116974 + .long 2524871582 + .long 1018263353 + .long 3916203552 + .long 1070180008 + .long 127848658 + .long 1017672664 + .long 457192032 + .long 1070242851 + .long 4020400938 + .long 1019823010 + .long 1385324704 + .long 1070305495 + .long 564511179 + .long 1016079094 + .long 2322869856 + .long 1070367935 + .long 2347103319 + .long 1018927760 + .long 3743438624 + .long 1070430165 + .long 877973862 + .long 1019638162 + .long 2392255552 + .long 1070492180 + .long 2432782267 + .long 1018872629 + .long 4180443328 + .long 1070553973 + .long 3102990015 + .long 1020093101 + .long 2547540832 + .long 1070636485 + .long 3877738253 + .long 1017300424 + .long 2735468912 + .long 1070697461 + .long 2446470256 + .long 1019235378 + .long 542633792 + .long 1070757943 + .long 583606328 + .long 1018624131 + .long 923265984 + .long 1070817911 + .long 1793926708 + .long 1019714161 + .long 918728448 + .long 1070877348 + .long 3726463586 + .long 1019433296 + .long 2572275008 + .long 1070936237 + .long 1845354238 + .long 1019459238 + .long 50974688 + .long 1070994564 + .long 983808064 + .long 1016685418 + .long 1105518320 + .long 1071052313 + .long 2357496692 + .long 1015139882 + .long 1264825328 + .long 1071109472 + .long 2244129354 + .long 1019046344 + .long 961157920 + .long 1071166029 + .long 3124185339 + .long 1018541776 + .long 1162701584 + .long 1071221973 + .long 1279780948 + .long 1019268918 + .long 3284935664 + .long 1071277294 + .long 2670033472 + .long 1019833744 + .long 497441888 + .long 1071331985 + .long 1032737410 + .long 1019795212 + .long 3377383904 + .long 1071386036 + .long 2356897182 + .long 1020205553 + .long 1126962000 + .long 1071439443 + .long 3723724586 + .long 1015212418 + .long 90291008 + .long 1071492199 + .long 4178672431 + .long 1020186971 + .long 190059536 + .long 1071595741 + .long 1763589807 + .long 1019162163 + .long 2497392840 + .long 1071670654 + .long 3036997041 + .long 1020204325 + .long 2616971944 + .long 1071719773 + .long 300151069 + .long 1017041957 + .long 2883518128 + .long 1071767563 + .long 2203981414 + .long 1019190108 + .long 1496354352 + .long 1071814030 + .long 332287966 + .long 1016846435 + .long 483276728 + .long 1071859184 + .long 653845024 + .long 1018830914 + .long 3097401072 + .long 1071903039 + .long 1514746408 + .long 1019278972 + .long 2737217248 + .long 1071945615 + .long 1358845067 + .long 1017268275 + .long 2072577560 + .long 1071986933 + .long 3041024735 + .long 1019929672 + .long 2266405656 + .long 1072027017 + .long 1271261130 + .long 1012925070 + .long 958652544 + .long 1072065894 + .long 2158017058 + .long 1019955372 + .long 3312993840 + .long 1072103591 + .long 765809169 + .long 1019114443 + .long 3177001304 + .long 1072140139 + .long 144180084 + .long 1019822186 + .long 3071642184 + .long 1072175568 + .long 4004602424 + .long 1019420740 + .long 4283953648 + .long 1072209909 + .long 1511950430 + .long 1020176966 + .long 1413754136 + .long 1072243195 + .long 856972295 + .long 1015129638 + .long 4073202944 + .long 1072306725 + .long 4068194804 + .long 1019714860 + .long 946117760 + .long 1072366415 + .long 694980733 + .long 1020150135 + .long 3980632032 + .long 1072422512 + .long 1313251280 + .long 1019948709 + .long 1468297112 + .long 1072475260 + .long 330111143 + .long 1019809198 + .long 3478063816 + .long 1072524887 + .long 2930067044 + .long 1017784081 + .long 1153979856 + .long 1072571613 + .long 2225786102 + .long 1017634481 + .long 2089828808 + .long 1072615641 + .long 474621367 + .long 1017043414 + .long 3531732632 + .long 1072657163 + .long 2276396220 + .long 1018757240 + .long 775214612 + .long 1072694803 + .long 3209744818 + .long 1019963015 + .long 662307284 + .long 1072713319 + .long 1381696763 + .long 1019763781 + .long 1192776652 + .long 1072730830 + .long 3017932994 + .long 1015179769 + .long 744202396 + .long 1072747407 + .long 2073854034 + .long 1019512292 + .long 8337908 + .long 1072763115 + .long 16004448 + .long 1019599514 + .long 3589868768 + .long 1072778013 + .long 1374369804 + .long 1018019237 + .long 121647320 + .long 1072792159 + .long 128481634 + .long 1018115438 + .long 2464923204 + .long 1072805601 + .long 1787331214 + .long 1016798022 + .long 4093304372 + .long 1072830562 + .long 3306868969 + .long 1019384078 + .long 1436891684 + .long 1072853231 + .long 676347266 + .long 1017302183 + .long 1104571840 + .long 1072873890 + .long 2870400285 + .long 1019938149 + .long 2037009832 + .long 1072892781 + .long 2956702105 + .long 1016472908 + .long 3139037960 + .long 1072910111 + .long 916057147 + .long 1018364335 + .long 1826698064 + .long 1072926058 + .long 2171961098 + .long 1019669816 + .long 1353941060 + .long 1072940774 + .long 1722928782 + .long 1019926215 + .long 1803191644 + .long 1072954391 + .long 1547878639 + .long 1020259262 + .long 1092591296 + .long 1072967024 + .long 3070107923 + .long 1018320401 + .long 2205372832 + .long 1072978772 + .long 787328196 + .long 1014621351 + .long 1291577100 + .long 1072989723 + .long 2964757301 + .long 1020242528 + .long 4234512804 + .long 1072999952 + .long 3136030038 + .long 1017522144 + .long 3248069132 + .long 1073009528 + .long 1506192355 + .long 1018050472 + .long 3932628500 + .long 1073018509 + .long 1045823554 + .long 1019946655 + .long 4195697848 + .long 1073026948 + .long 233443322 + .long 1018917447 + .long 2501811452 + .long 1073034892 + .long 901427976 + .long 1017333852 + .long 866379428 + .long 1073049455 + .long 2437443742 + .long 1019678792 + .long 1376865888 + .long 1073062480 + .long 3365790232 + .long 1014547152 + .long 3290094268 + .long 1073074195 + .long 3898947415 + .long 1018683566 + .long 354764884 + .long 1073084787 + .long 3854322404 + .long 1019662058 + .long 3332975496 + .long 1073094406 + .long 3171701655 + .long 1017830922 + .long 1141460088 + .long 1073103181 + .long 3946082701 + .long 1020032019 + .long 745761284 + .long 1073111216 + .long 1347210591 + .long 1019106121 + .long 1673304508 + .long 1073118600 + .long 1760606642 + .long 1017324577 + .long 983388240 + .long 1073125409 + .long 3740651204 + .long 1019514104 + .long 3895509100 + .long 1073131706 + .long 2409629983 + .long 1020069322 + .long 2128523668 + .long 1073137548 + .long 3045605368 + .long 1018579174 + .long 2075485692 + .long 1073142981 + .long 3720571789 + .long 1017557436 + .long 121855976 + .long 1073148047 + .long 2391744767 + .long 1020160645 + .long 4181733780 + .long 1073152780 + .long 995028816 + .long 1019681295 + .long 2887813280 + .long 1073157214 + .long 218733247 + .long 1020003509 + .long 2862180896 + .long 1073161375 + .long 2043806490 + .long 1018602288 + .long 3909375184 + .long 1073168973 + .long 1559903412 + .long 1020103444 + .long 3533966292 + .long 1073175738 + .long 734884149 + .long 1018462962 + .long 3815044608 + .long 1073181799 + .long 3630523428 + .long 1017250093 + .long 739639376 + .long 1073187261 + .long 4167476661 + .long 1020008277 + .long 1068309648 + .long 1073192207 + .long 2110061437 + .long 1019295858 + .long 2350566352 + .long 1073196707 + .long 582596516 + .long 1018568821 + .long 2529520024 + .long 1073200819 + .long 745552787 + .long 1019053165 + .long 1841667508 + .long 1073204591 + .long 3982568700 + .long 1016503327 + .long 2242261080 + .long 1073208063 + .long 3433582258 + .long 1016196763 + .long 715134328 + .long 1073211270 + .long 355901358 + .long 1020087916 + .long 2700735876 + .long 1073214240 + .long 3640957736 + .long 1019780205 + .long 141607580 + .long 1073217000 + .long 2488245051 + .long 1020262395 + .long 287934404 + .long 1073219570 + .long 2392691085 + .long 1019883292 + .long 2363373988 + .long 1073221969 + .long 4194561737 + .long 1019237447 + .long 3829340424 + .long 1073224214 + .long 429455526 + .long 1019490975 + .long 1988805928 + .long 1073226320 + .long 3029848706 + .long 1018104889 + .long 1647572320 + .long 1073230161 + .long 10289938 + .long 1017394880 + .long 3988000624 + .long 1073233576 + .long 1957559169 + .long 1019434816 + .long 4263843944 + .long 1073236633 + .long 204710264 + .long 1019908761 + .long 663197724 + .long 1073239386 + .long 1921757578 + .long 1019778948 + .long 3560800700 + .long 1073241876 + .long 3994348896 + .long 1019230192 + .long 2441785656 + .long 1073244141 + .long 871468611 + .long 1014800505 + .long 3277400272 + .long 1073246209 + .long 4092218139 + .long 1020040842 + .long 3951990120 + .long 1073248105 + .long 4276546478 + .long 1019763677 + .long 2737338540 + .long 1073249850 + .long 252776012 + .long 1018794951 + .long 1511361316 + .long 1073251461 + .long 3119653999 + .long 1018514803 + .long 3969162516 + .long 1073252952 + .long 1037069016 + .long 1016792900 + .long 413985240 + .long 1073254338 + .long 4110171432 + .long 1020001345 + .long 3681283576 + .long 1073255627 + .long 1463092818 + .long 1020260354 + .long 3146455488 + .long 1073256831 + .long 1031209123 + .long 1016554799 + .long 95214512 + .long 1073257958 + .long 1373808632 + .long 1019493031 + .long 4250240828 + .long 1073259013 + .long 3891047882 + .long 1020108730 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 1072243195 + .long 856972295 + .long 1015129638 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 3221823995 + .long 856972295 + .long 3164710438 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 3164710438 + .long 1413754136 + .long 3221823995 + .long 0 + .long 0 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 2006262985 + .long 1069310863 + .long 2358449471 + .long 3217342131 + .long 3845454352 + .long 1069952297 + .long 2829679149 + .long 1073771565 + .long 4294967295 + .long 2148532223 + .long 0 + .long 0 + .long 0 + .long 1130364928 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,3024 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atan2dl.S b/external/sgx_libm/ia32/atan2dl.S new file mode 100644 index 0000000000..b468d4da20 --- /dev/null +++ b/external/sgx_libm/ia32/atan2dl.S @@ -0,0 +1,1431 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2dl.c" + .text +..TXTST0: +# -- Begin atand2l + .text + .align 16,0x90 + .globl atand2l +atand2l: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $60, %esp + fldt 8(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpt (%esp) + fldt 20(%ebp) + fstpt 12(%esp) + call atan2dl@PLT +..B1.2: + addl $60, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type atand2l,@function + .size atand2l,.-atand2l + .data +# -- End atand2l + .text +# -- Begin atan2dl + .text + .align 16,0x90 + .globl atan2dl +atan2dl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp +..B2.2: + fnstcw 62(%esp) +..B2.3: + movzbl 29(%ebp), %ecx + movzbl 17(%ebp), %esi + andl $128, %ecx + movzwl 16(%ebp), %edi + andl $128, %esi + andl $32767, %edi + movzwl 28(%ebp), %ebx + shrl $7, %ecx + andl $32767, %ebx + shrl $7, %esi + call ..L4 +..L4: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%edx), %edx + cmpl $32767, %edi + je ..B2.114 +..B2.4: + cmpl $32767, %ebx + je ..B2.95 +..B2.5: + testl %edi, %edi + jne ..B2.8 +..B2.6: + cmpl $0, 12(%ebp) + jne ..B2.8 +..B2.7: + cmpl $0, 8(%ebp) + je ..B2.13 +..B2.8: + testl %ebx, %ebx + jne ..B2.29 +..B2.9: + cmpl $0, 24(%ebp) + jne ..B2.29 +..B2.10: + cmpl $0, 20(%ebp) + jne ..B2.29 +..B2.11: + testl %edi, %edi + jne ..B2.25 +..B2.12: + cmpl $0, 12(%ebp) + je ..B2.122 + jmp ..B2.23 +..B2.13: + jne ..B2.23 +..B2.14: + testl %ebx, %ebx + jne ..B2.19 +..B2.15: + cmpl $0, 24(%ebp) + jne ..B2.18 +..B2.16: + cmpl $0, 20(%ebp) + je ..B2.89 +..B2.17: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 40(%esp) + jmp ..B2.19 +..B2.18: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 40(%esp) +..B2.19: + testl %ecx, %ecx + je ..B2.21 +..B2.20: + fldl c180@GOTOFF(%edx,%esi,8) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.21: + fldl _zeros@GOTOFF(%edx,%esi,8) +..B2.22: + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.23: + testl %ebx, %ebx + jne ..B2.29 +..B2.24: + cmpl $0, 24(%ebp) + jne ..B2.29 +..B2.25: + cmpl $0, 20(%ebp) + jne ..B2.29 +..B2.26: + testl %edi, %edi + jne ..B2.28 +..B2.27: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 40(%esp) +..B2.28: + fldl c90@GOTOFF(%edx,%esi,8) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.29: + cmpl %edi, %ebx + jne ..B2.35 +..B2.30: + movl 24(%ebp), %eax + cmpl 12(%ebp), %eax + jne ..B2.35 +..B2.31: + movl 20(%ebp), %eax + cmpl 8(%ebp), %eax + jne ..B2.35 +..B2.32: + orl %edi, %ebx + jne ..B2.34 +..B2.33: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 40(%esp) +..B2.34: + lea (%esi,%ecx,2), %eax + fldl exact@GOTOFF(%edx,%eax,8) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.35: + movzwl 62(%esp), %eax + movl %eax, (%esp) + andl $3840, %eax + cmpl $768, %eax + je ..B2.94 +..B2.36: + movl (%esp), %eax + andl $-3841, %eax + orl $-64768, %eax + movw %ax, 60(%esp) +..B2.37: + fldcw 60(%esp) +..B2.38: + movl $1, 36(%esp) +..B2.39: + cmpl $8191, %ebx + jg ..B2.43 +..B2.40: + cmpl $8191, %edi + jg ..B2.42 +..B2.41: + fldt _TWO_8192@GOTOFF(%edx) + fldt 20(%ebp) + fmul %st(1), %st + fstpt 20(%ebp) + fldt 20(%ebp) + fldt 8(%ebp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + movzwl 28(%ebp), %ebx + movzwl 16(%ebp), %edi + andl $32767, %ebx + andl $32767, %edi + jmp ..B2.44 +..B2.42: + fldt 20(%ebp) + fldt 8(%ebp) + jmp ..B2.47 +..B2.43: + fldt 20(%ebp) + fldt 8(%ebp) +..B2.44: + cmpl $24575, %ebx + jl ..B2.47 +..B2.45: + cmpl $24575, %edi + jl ..B2.47 +..B2.46: + fldt 12+_TWO_8192@GOTOFF(%edx) + fmul %st, %st(2) + fxch %st(2) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + movzwl 28(%ebp), %ebx + movzwl 16(%ebp), %edi + andl $32767, %ebx + andl $32767, %edi +..B2.47: + fxch %st(1) + fmull _ones@GOTOFF(%edx,%ecx,8) + fld %st(1) + fldl _ones@GOTOFF(%edx,%esi,8) + fmul %st, %st(1) + fxch %st(2) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.75 +..B2.48: + lea 12(%edi), %eax + cmpl %eax, %ebx + jle ..B2.71 +..B2.49: + lea 75(%edi), %eax + cmpl %eax, %ebx + jle ..B2.68 +..B2.50: + fstp %st(0) + fstp %st(0) + fstp %st(0) + testl %ecx, %ecx + je ..B2.52 +..B2.51: + fstp %st(0) + lea (,%esi,8), %eax + lea (%eax,%esi,4), %ecx + fldt _small_value_80@GOTOFF(%edx,%ecx) + fsubrl c180@GOTOFF(%edx,%esi,8) + fstpt 48(%esp) + jmp ..B2.86 +..B2.52: + testl %edi, %edi + jle ..B2.93 +..B2.53: + fstp %st(0) + xorl %eax, %eax +..B2.54: + fldl _TWO_32H@GOTOFF(%edx) + shll $15, %ecx + fld %st(0) + orl $-49153, %ecx + movw %cx, 28(%ebp) + fldt 20(%ebp) + fld %st(0) + fmul %st(3), %st + fld %st(1) + shll $15, %esi + fsubr %st(1), %st + movzwl 16(%ebp), %edi + orl $-49153, %esi + movw %si, 16(%ebp) + andl $32767, %edi + subl %edi, %ebx + fsubrp %st, %st(1) + fld %st(1) + cmpl $16382, %ebx + fsub %st(1), %st + fxch %st(2) + fstpt 24(%esp) + fldt 24(%esp) + fldl _ones@GOTOFF(%edx) + fld %st(0) + fdivp %st, %st(2) + fxch %st(1) + fmul %st, %st(4) + fld %st(4) + fsub %st(1), %st + fsubrp %st, %st(5) + fld %st(4) + fsubr %st(1), %st + fld %st(3) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fxch %st(3) + fmul %st(5), %st + fsubr %st(2), %st + fsubp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(2) + fldl _C180byPi@GOTOFF(%edx) + fmul %st, %st(4) + fmulp %st, %st(2) + fldl 8+_C180byPi@GOTOFF(%edx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 8(%ebp) + fld %st(0) + fmul %st(5), %st + fld %st(1) + fsubr %st(1), %st + fsubrp %st, %st(1) + fxch %st(4) + fmul %st, %st(5) + fld %st(5) + fsub %st(1), %st + fsubrp %st, %st(6) + fsub %st(5), %st + faddp %st, %st(2) + fmul %st, %st(1) + fld %st(0) + fsub %st(4), %st + fmul %st(5), %st + faddp %st, %st(2) + fld %st(1) + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + fadd %st, %st(4) + fld %st(4) + fxch %st(1) + fsub %st(5), %st + faddp %st, %st(2) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmul %st(5), %st + fsubr %st, %st(1) + fxch %st(1) + fchs + fsubrp %st, %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fsubrp %st, %st(4) + fxch %st(3) + fstpt 12(%esp) + fldt 12(%esp) + faddp %st, %st(3) + jl ..B2.58 +..B2.55: + fldt _small@GOTOFF(%edx) + addl $-16318, %ebx + fmul %st, %st(3) + cmpl $16382, %ebx + fldt 48(%esp) + fmul %st(1), %st + fstpt 48(%esp) + jl ..B2.57 +..B2.56: + fldt 48(%esp) + addl $-16318, %ebx + fmul %st(1), %st + fstpt 48(%esp) + fldt 48(%esp) + fstpt (%esp) + fmulp %st, %st(3) + jmp ..B2.59 +..B2.57: + fstp %st(0) + fldt 48(%esp) + fstpt (%esp) + jmp ..B2.59 +..B2.58: + fldt 48(%esp) + fstpt (%esp) +..B2.59: + movl %ebx, %ecx + negl %ecx + addl $16383, %ecx + fstpt 12(%esp) + testl %eax, %eax + movw %cx, 20(%esp) + je ..B2.61 +..B2.60: + fldt 12(%esp) + fmull 8+_two64@GOTOFF(%edx) + fstpt 12(%esp) + fldt 12(%esp) + jmp ..B2.62 +..B2.61: + fldt 12(%esp) +..B2.62: + movzwl 8(%esp), %ecx + andl $32767, %ecx + subl %eax, %ecx + subl %ebx, %ecx + cmpl $-9, %ecx + jl ..B2.65 +..B2.63: + testl %ecx, %ecx + jg ..B2.65 +..B2.64: + fldt 48(%esp) + fmul %st(1), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B2.66 +..B2.65: + fldt 48(%esp) + faddp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B2.66: + fldl _zeros@GOTOFF(%edx) + fldt 48(%esp) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.123 + je ..B2.67 +..B2.123: + fstp %st(0) + fstp %st(0) + jmp ..B2.86 +..B2.67: + fldt 24(%esp) + fdivrp %st, %st(2) + fmulp %st, %st(1) + fstpt 48(%esp) + jmp ..B2.86 +..B2.68: + fstp %st(3) + testl %ecx, %ecx + je ..B2.70 +..B2.69: + fldl _TWO_32H@GOTOFF(%edx) + fxch %st(3) + fdivrp %st, %st(1) + fmul %st, %st(2) + fld %st(2) + fadd %st(1), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(3) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _C180byPi@GOTOFF(%edx) + fmul %st, %st(6) + fmulp %st, %st(3) + fldl 8+_C180byPi@GOTOFF(%edx) + fmul %st(2), %st + faddp %st, %st(3) + fldt 36+_P@GOTOFF(%edx) + fmul %st(4), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(5) + fldt _P@GOTOFF(%edx) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fsubrl 8200+__libm_atandl_table_128@GOTOFF(%edx) + faddl 8192+__libm_atandl_table_128@GOTOFF(%edx) + fmulp %st, %st(1) + fstpt 48(%esp) + jmp ..B2.86 +..B2.70: + fldt 36+_P@GOTOFF(%edx) + fld %st(1) + fdiv %st(4), %st + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(3) + fxch %st(5) + fstpl 24(%esp) + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(5) + fldt _P@GOTOFF(%edx) + faddp %st, %st(5) + fxch %st(2) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fld %st(1) + fld %st(1) + fld %st(3) + fld %st(3) + fldl _TWO_32H@GOTOFF(%edx) + fmul %st, %st(4) + fxch %st(2) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fsubr %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(3) + fsub %st(3), %st + fld %st(2) + fxch %st(5) + fmull 8+_C180byPi@GOTOFF(%edx) + fldl _C180byPi@GOTOFF(%edx) + fmul %st, %st(5) + fxch %st(5) + fmul %st, %st(6) + fxch %st(5) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(5) + fadd %st(2), %st + fld %st(4) + fadd %st(6), %st + fsubp %st, %st(6) + fxch %st(4) + fsub %st(5), %st + faddp %st, %st(1) + fxch %st(3) + fdivrl _ones@GOTOFF(%edx) + fmul %st, %st(2) + fld %st(2) + fadd %st(1), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fld %st(2) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(2) + fxch %st(2) + fmul %st(3), %st + fldt (%esp) + fxch %st(1) + faddl 8+_ones@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(6) + fxch %st(5) + fsubrp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fxch %st(3) + fadd %st(4), %st + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmull 24(%esp) + fstpt 48(%esp) + jmp ..B2.86 +..B2.71: + fstp %st(3) + fldl _TWO_63H@GOTOFF(%edx) + fld %st(1) + fxch %st(3) + fstpl 24(%esp) + fld %st(3) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(3), %st + fdiv %st(5), %st + fadd %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(2) + fld %st(4) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(3) + fld %st(3) + fldl _TWO_48H@GOTOFF(%edx) + fmul %st, %st(6) + movl 12(%esp), %eax + fxch %st(1) + fadd %st(6), %st + shll $4, %eax + fsubp %st, %st(6) + testl %ecx, %ecx + fxch %st(4) + fsub %st(5), %st + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(6) + fxch %st(2) + fadd %st(6), %st + fld %st(5) + fmul %st(4), %st + fadd %st(3), %st + fxch %st(4) + fmul %st, %st(7) + fxch %st(7) + fsubrp %st, %st(2) + fld %st(3) + fadd %st(1), %st + fxch %st(3) + fmulp %st, %st(7) + fxch %st(6) + fsubrp %st, %st(5) + fld %st(2) + fxch %st(2) + fdivrl _ones@GOTOFF(%edx) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(5) + fld %st(4) + fsubr %st(1), %st + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(3) + fxch %st(3) + fmul %st(4), %st + faddl 8+_ones@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + fsubrp %st, %st(1) + fld %st(1) + fmul %st(4), %st + fxch %st(3) + fadd %st, %st(4) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fld %st(2) + fxch %st(4) + fmulp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fadd %st(2), %st + fmul %st, %st(4) + fld %st(3) + fmul %st(3), %st + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(1) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(4) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _C180byPi@GOTOFF(%edx) + fmul %st, %st(3) + fmulp %st, %st(4) + fldl 8+_C180byPi@GOTOFF(%edx) + fmul %st(5), %st + faddp %st, %st(4) + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(3) + fldt _P@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldl 24(%esp) + je ..B2.73 +..B2.72: + negl %eax + fld %st(2) + fldl 8192+__libm_atandl_table_128@GOTOFF(%edx,%eax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fldl 8200+__libm_atandl_table_128@GOTOFF(%edx,%eax) + fsubp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B2.74 +..B2.73: + fldl __libm_atandl_table_128@GOTOFF(%eax,%edx) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fxch %st(2) + faddl 8+__libm_atandl_table_128@GOTOFF(%eax,%edx) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 48(%esp) +..B2.74: + fldt 48(%esp) + fmulp %st, %st(1) + fstpt 48(%esp) + jmp ..B2.86 +..B2.75: + fstp %st(3) + lea 12(%ebx), %eax + cmpl %eax, %edi + jle ..B2.82 +..B2.76: + addl $75, %ebx + cmpl %ebx, %edi + jle ..B2.78 +..B2.77: + fstp %st(2) + fstp %st(1) + fstp %st(0) + lea (,%esi,8), %eax + lea (%eax,%esi,4), %ecx + fldt _small_value_80@GOTOFF(%edx,%ecx) + fsubrl c90@GOTOFF(%edx,%esi,8) + fstpt 48(%esp) + jmp ..B2.86 +..B2.78: + fldl _TWO_32H@GOTOFF(%edx) + testl %ecx, %ecx + fxch %st(1) + fdivrp %st, %st(3) + fmul %st(2), %st + fld %st(0) + fadd %st(3), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(1) + fld %st(0) + fsubr %st(3), %st + fld %st(3) + fmul %st(4), %st + fld %st(0) + fmul %st(1), %st + fxch %st(5) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _C180byPi@GOTOFF(%edx) + fmul %st, %st(4) + fmulp %st, %st(3) + fldl 8+_C180byPi@GOTOFF(%edx) + fmul %st(2), %st + faddp %st, %st(3) + fldt 36+_P@GOTOFF(%edx) + fmul %st(6), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(6), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(7) + fldt _P@GOTOFF(%edx) + faddp %st, %st(7) + fxch %st(1) + fmulp %st, %st(6) + faddp %st, %st(5) + fmulp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fldl 4096+__libm_atandl_table_128@GOTOFF(%edx) + fstpt 48(%esp) + fldl 4104+__libm_atandl_table_128@GOTOFF(%edx) + je ..B2.80 +..B2.79: + fldt 48(%esp) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B2.81 +..B2.80: + fldt 48(%esp) + fxch %st(3) + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B2.81: + fldt 48(%esp) + fmulp %st, %st(1) + fstpt 48(%esp) + jmp ..B2.86 +..B2.82: + fldl _TWO_63H@GOTOFF(%edx) + fld %st(3) + fxch %st(3) + fstpl 24(%esp) + fld %st(1) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(5), %st + fdiv %st(3), %st + fadd %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(2) + fld %st(4) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(3) + fld %st(3) + fldl _TWO_48H@GOTOFF(%edx) + fmul %st, %st(6) + movl 12(%esp), %eax + fxch %st(2) + fadd %st(6), %st + shll $4, %eax + fsubp %st, %st(6) + fld %st(5) + testl %ecx, %ecx + fmul %st(4), %st + fxch %st(6) + fsubr %st, %st(7) + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fld %st(6) + fmul %st(4), %st + fadd %st(5), %st + fxch %st(4) + fmul %st, %st(5) + fxch %st(5) + fsubrp %st, %st(7) + fmul %st, %st(4) + fxch %st(4) + fsubrp %st, %st(1) + fxch %st(3) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fld %st(4) + fxch %st(1) + fdivrl _ones@GOTOFF(%edx) + fmul %st, %st(2) + fld %st(2) + fadd %st(1), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddl 8+_ones@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fld %st(2) + fmul %st(4), %st + fxch %st(2) + fadd %st, %st(4) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fld %st(1) + fxch %st(4) + fmulp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fadd %st(3), %st + fmul %st, %st(4) + fld %st(2) + fmul %st(4), %st + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(1) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(4) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _C180byPi@GOTOFF(%edx) + fmul %st, %st(4) + fmulp %st, %st(3) + fldl 8+_C180byPi@GOTOFF(%edx) + fmul %st(5), %st + faddp %st, %st(3) + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(3) + fldt _P@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fldl 24(%esp) + je ..B2.84 +..B2.83: + fldl 4096+__libm_atandl_table_128@GOTOFF(%edx,%eax) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(3) + faddl 4104+__libm_atandl_table_128@GOTOFF(%edx,%eax) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B2.85 +..B2.84: + negl %eax + fld %st(1) + fldl 4096+__libm_atandl_table_128@GOTOFF(%edx,%eax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(3) + fldl 4104+__libm_atandl_table_128@GOTOFF(%edx,%eax) + fsubp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 48(%esp) +..B2.85: + fldt 48(%esp) + fmulp %st, %st(1) + fstpt 48(%esp) +..B2.86: + cmpl $0, 36(%esp) + je ..B2.88 +..B2.87: + fldcw 62(%esp) +..B2.88: + fldt 48(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.89: + testl %ecx, %ecx + je ..B2.91 +..B2.90: + fldl c180@GOTOFF(%edx,%esi,8) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.91: + fldl _zeros@GOTOFF(%edx,%esi,8) +..B2.92: + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.93: + fmull _two64@GOTOFF(%edx) + movl $64, %eax + fstpt 8(%ebp) + jmp ..B2.54 +..B2.94: + movl $0, 36(%esp) + jmp ..B2.39 +..B2.95: + cmpl $-2147483648, 24(%ebp) + jne ..B2.109 +..B2.96: + cmpl $0, 20(%ebp) + jne ..B2.109 +..B2.97: + testl %edi, %edi + jne ..B2.104 +..B2.98: + cmpl $0, 12(%ebp) + jne ..B2.100 +..B2.99: + cmpl $0, 8(%ebp) + je ..B2.103 +..B2.100: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 40(%esp) +..B2.101: + cmpl $32767, %ebx + je ..B2.104 +..B2.102: + fldl c90@GOTOFF(%edx,%esi,8) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.103: + shll $3, %esi + jmp ..B2.105 +..B2.104: + shll $3, %esi + cmpl $32767, %edi + je ..B2.110 +..B2.105: + testl %ecx, %ecx + je ..B2.107 +..B2.106: + fldl c180@GOTOFF(%esi,%edx) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.107: + fldl _zeros@GOTOFF(%esi,%edx) +..B2.108: + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.109: + fldt 20(%ebp) + fldt 8(%ebp) + fmulp %st, %st(1) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.110: + testl %ecx, %ecx + je ..B2.112 +..B2.111: + fldl c135@GOTOFF(%edx,%esi) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.112: + fldl c45@GOTOFF(%edx,%esi) +..B2.113: + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.114: + cmpl $-2147483648, 12(%ebp) + jne ..B2.109 +..B2.115: + cmpl $0, 8(%ebp) + jne ..B2.109 +..B2.116: + cmpl $32767, %ebx + je ..B2.95 +..B2.117: + testl %ebx, %ebx + jne ..B2.101 +..B2.118: + cmpl $0, 24(%ebp) + jne ..B2.100 +..B2.119: + cmpl $0, 20(%ebp) + jne ..B2.100 + jmp ..B2.102 +..B2.122: + cmpl $0, 8(%ebp) + je ..B2.14 + jmp ..B2.23 + .align 16,0x90 + .type atan2dl,@function + .size atan2dl,.-atan2dl + .data +# -- End atan2dl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x80,0x13,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_TWO_8192: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _TWO_8192,@object + .size _TWO_8192,24 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .space 8, 0x00 # pad + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_C180byPi: + .long 442499072 + .long 1078765020 + .long 3272251219 + .long 1042157501 + .type _C180byPi,@object + .size _C180byPi,16 + .align 16 +_small: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 65 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32769 + .word 0 + .type _small,@object + .size _small,24 + .space 8, 0x00 # pad + .align 16 +_two64: + .long 0 + .long 1139802112 + .long 0 + .long 1005584384 + .type _two64,@object + .size _two64,16 + .align 16 +_P: + .word 54228 + .word 26975 + .word 60215 + .word 39113 + .word 49155 + .word 0 + .word 30637 + .word 6142 + .word 46044 + .word 46936 + .word 16386 + .word 0 + .word 47408 + .word 26349 + .word 14153 + .word 33526 + .word 49154 + .word 0 + .word 53934 + .word 32714 + .word 35699 + .word 52145 + .word 16385 + .word 0 + .type _P,@object + .size _P,48 + .align 16 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .space 8, 0x00 # pad + .align 16 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 8 +c180: + .long 0x00000000,0x40668000 + .long 0x00000000,0xc0668000 + .type c180,@object + .size c180,16 + .align 8 +c90: + .long 0x00000000,0x40568000 + .long 0x00000000,0xc0568000 + .type c90,@object + .size c90,16 + .align 8 +exact: + .long 0x00000000,0x40468000 + .long 0x00000000,0xc0468000 + .long 0x00000000,0x4060e000 + .long 0x00000000,0xc060e000 + .type exact,@object + .size exact,32 + .align 8 +c135: + .long 0x00000000,0x4060e000 + .long 0x00000000,0xc060e000 + .type c135,@object + .size c135,16 + .align 8 +c45: + .long 0x00000000,0x40468000 + .long 0x00000000,0xc0468000 + .type c45,@object + .size c45,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .data + .hidden __libm_atandl_table_128 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atan2f_wmt.S b/external/sgx_libm/ia32/atan2f_wmt.S new file mode 100644 index 0000000000..ea10669117 --- /dev/null +++ b/external/sgx_libm/ia32/atan2f_wmt.S @@ -0,0 +1,791 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2f_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin atan2f + .text + .align 16,0x90 + .globl atan2f +atan2f: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + movl 112(%esp), %edx + movl 116(%esp), %ecx + movss %xmm0, 8(%esp) + movss %xmm1, 12(%esp) + movl %edx, %eax + andl $2147483647, %edx + subl $528482304, %edx + cmpl $1073741824, %edx + jae .L_2TAG_PACKET_0.0.3 + movl %ecx, %edx + andl $-2147483648, %ecx + andl $2147483647, %edx + subl $528482304, %edx + cmpl $1073741824, %edx + jae .L_2TAG_PACKET_1.0.3 + divss %xmm1, %xmm0 + movss 8(%esp), %xmm5 +.L_2TAG_PACKET_2.0.3: + movl $-262144, %edx + movd %edx, %xmm3 + movss %xmm1, %xmm6 + movl $262144, %edx + movd %edx, %xmm4 + movss %xmm1, %xmm2 + shrl $31, %eax + shrl $30, %ecx + orl %eax, %ecx + andps %xmm3, %xmm6 + subss %xmm6, %xmm1 + andps %xmm0, %xmm3 + movd %xmm0, %edx + orps %xmm4, %xmm3 + mulss %xmm3, %xmm6 + mulss %xmm3, %xmm1 + movl %edx, %eax + andl $2146959360, %edx + subl $1023410176, %edx + cmpl $83361792, %edx + ja .L_2TAG_PACKET_3.0.3 + mulss %xmm5, %xmm3 + subss %xmm6, %xmm5 + addss %xmm3, %xmm2 + subss %xmm1, %xmm5 + divss %xmm2, %xmm5 + shrl $16, %edx + addl $8, %edx + andl $-2147483648, %eax + movd %eax, %xmm0 + movss (%ebx,%edx), %xmm1 + movss 4(%ebx,%edx), %xmm3 + movl $-1096111855, %eax + movd %eax, %xmm4 + movss 1440(%ebx,%ecx,8), %xmm6 + xorps %xmm0, %xmm1 + xorps %xmm0, %xmm3 + movss %xmm1, %xmm7 + addss 1444(%ebx,%ecx,8), %xmm1 + addss %xmm6, %xmm3 + movss 1444(%ebx,%ecx,8), %xmm6 + movss %xmm5, %xmm2 + mulss %xmm5, %xmm5 + movss %xmm1, %xmm0 + subss %xmm1, %xmm6 + mulss %xmm2, %xmm4 + addss %xmm2, %xmm1 + addss %xmm7, %xmm6 + subss %xmm1, %xmm0 + mulss %xmm4, %xmm5 + addss %xmm6, %xmm3 + addss %xmm2, %xmm0 + addss %xmm3, %xmm5 + addss %xmm5, %xmm0 + addss %xmm1, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_3.0.3: + addl $75497472, %edx + cmpl $158859264, %edx + ja .L_2TAG_PACKET_5.0.3 + movss 8(%esp), %xmm0 + movss 12(%esp), %xmm1 + cvtps2pd %xmm0, %xmm0 + cvtps2pd %xmm1, %xmm1 + divsd %xmm1, %xmm0 + movsd 1360(%ebx), %xmm7 + movsd 1368(%ebx), %xmm2 + movss 1440(%ebx,%ecx,8), %xmm3 + movss 1444(%ebx,%ecx,8), %xmm4 + cvtps2pd %xmm3, %xmm3 + cvtps2pd %xmm4, %xmm4 + addsd %xmm4, %xmm3 + mulsd %xmm0, %xmm7 + movapd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + addsd %xmm3, %xmm1 + mulsd %xmm7, %xmm0 + addsd %xmm2, %xmm0 + addsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + addl $947912704, %edx + cmpl $1106771968, %edx + jae .L_2TAG_PACKET_6.0.3 + movss 1440(%ebx,%ecx,8), %xmm2 + movss 1444(%ebx,%ecx,8), %xmm1 + addss %xmm2, %xmm0 + addss %xmm1, %xmm0 +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_6.0.3: + cmpl $1602224128, %edx + jae .L_2TAG_PACKET_8.0.3 + movss 8(%esp), %xmm0 + movss 12(%esp), %xmm1 + movl $-2147483648, %edx + movd %edx, %xmm7 + xorps %xmm7, %xmm0 + cvtps2pd %xmm0, %xmm5 + cvtps2pd %xmm1, %xmm0 + divsd %xmm5, %xmm0 + movsd 1376(%ebx), %xmm2 + andl $1, %ecx + movsd 1344(%ebx,%ecx,8), %xmm3 + mulsd %xmm0, %xmm2 + movapd %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + addsd %xmm3, %xmm1 + mulsd %xmm2, %xmm0 + addsd %xmm1, %xmm0 + cvtsd2ss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_8.0.3: + movss 1408(%ebx), %xmm0 + movss 1412(%ebx), %xmm1 + shll $31, %ecx + movd %ecx, %xmm3 + addss %xmm1, %xmm0 + xorps %xmm3, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_0.0.3: + addl $528482304, %edx + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_9.0.3 + cmpl $0, %edx + je .L_2TAG_PACKET_10.0.3 + movl %ecx, %edx + andl $-2147483648, %ecx + andl $2147483647, %edx + subl $528482304, %edx +.L_2TAG_PACKET_1.0.3: + addl $528482304, %edx + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_11.0.3 + cmpl $0, %edx + je .L_2TAG_PACKET_12.0.3 + cvtss2sd %xmm0, %xmm0 + cvtss2sd %xmm1, %xmm3 + divsd %xmm3, %xmm0 + movss 8(%esp), %xmm5 + pextrw $3, %xmm0, %edx + andl $32767, %edx + subl $15344, %edx + cmpl $2048, %edx + jae .L_2TAG_PACKET_13.0.3 + movd %xmm1, %edx + cvtsd2ss %xmm0, %xmm0 + andl $2147483647, %edx + cmpl $276824064, %edx + jb .L_2TAG_PACKET_14.0.3 + cmpl $1602224128, %edx + ja .L_2TAG_PACKET_15.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_15.0.3: + movl $796917760, %edx + movd %edx, %xmm4 + mulss %xmm4, %xmm1 + mulss %xmm4, %xmm5 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_14.0.3: + movl $1333788672, %edx + movd %edx, %xmm4 + mulss %xmm4, %xmm1 + mulss %xmm4, %xmm5 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_13.0.3: + shrl $31, %eax + shrl $30, %ecx + orl %eax, %ecx + addl $15344, %edx + cmpl $17392, %edx + jae .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_16.0.3: + cmpl $2, %ecx + jb .L_2TAG_PACKET_17.0.3 + movss 1440(%ebx,%ecx,8), %xmm2 + movss 1444(%ebx,%ecx,8), %xmm0 + addss %xmm2, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_17.0.3: + movsd 1392(%ebx), %xmm1 + mulsd %xmm1, %xmm0 + cvtsd2ss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_9.0.3: + ja .L_2TAG_PACKET_18.0.3 + movl %ecx, %edx + andl $-2147483648, %ecx + andl $2147483647, %edx + cmpl $2139095040, %edx + je .L_2TAG_PACKET_19.0.3 + ja .L_2TAG_PACKET_20.0.3 + movss 1408(%ebx), %xmm0 + movss 1412(%ebx), %xmm1 + andl $-2147483648, %eax + movd %eax, %xmm3 + addss %xmm1, %xmm0 + xorps %xmm3, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_19.0.3: + movss 1408(%ebx), %xmm0 + movss 1412(%ebx), %xmm1 + movl $1056964608, %edx + sarl $31, %ecx + andl $12582912, %ecx + addl %ecx, %edx + movd %edx, %xmm2 + addss %xmm1, %xmm0 + mulss %xmm2, %xmm0 + andl $-2147483648, %eax + movd %eax, %xmm3 + xorps %xmm3, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_18.0.3: + addss %xmm1, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_10.0.3: + movl %ecx, %edx + andl $-2147483648, %ecx + andl $2147483647, %edx + cmpl $2139095040, %edx + ja .L_2TAG_PACKET_20.0.3 + cmpl $0, %edx + je .L_2TAG_PACKET_21.0.3 + cmpl $0, %ecx + jne .L_2TAG_PACKET_22.0.3 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_23.0.3: +.L_2TAG_PACKET_22.0.3: + movss 1456(%ebx), %xmm0 + movss 1460(%ebx), %xmm1 + andl $-2147483648, %eax + movd %eax, %xmm3 + addss %xmm1, %xmm0 + xorps %xmm3, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_24.0.3: + movss 1456(%ebx), %xmm0 + movss 1460(%ebx), %xmm1 + andl $-2147483648, %eax + movd %eax, %xmm3 + addss %xmm1, %xmm0 + xorps %xmm3, %xmm0 + jmp .L_2TAG_PACKET_25.0.3 +.L_2TAG_PACKET_21.0.3: + cmpl $0, %ecx + jne .L_2TAG_PACKET_24.0.3 +.L_2TAG_PACKET_25.0.3: + movss %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 116(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $38, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_20.0.3: + movss %xmm1, %xmm0 + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_11.0.3: + ja .L_2TAG_PACKET_20.0.3 + cmpl $0, %ecx + jne .L_2TAG_PACKET_23.0.3 + andl $-2147483648, %eax + movd %eax, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_12.0.3: + movss 1408(%ebx), %xmm0 + movss 1412(%ebx), %xmm1 + andl $-2147483648, %eax + movd %eax, %xmm3 + addss %xmm1, %xmm0 + xorps %xmm3, %xmm0 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_4.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type atan2f,@function + .size atan2f,.-atan2f + .data +# -- End atan2f + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 1023669327 + .long 803928991 + .long 1024193038 + .long 2966692170 + .long 1024716678 + .long 811692700 + .long 1025240245 + .long 792964392 + .long 1025763734 + .long 802148141 + .long 1026287141 + .long 819324013 + .long 1026810463 + .long 790037051 + .long 1027333695 + .long 759154391 + .long 1027856833 + .long 817525057 + .long 1028379874 + .long 808527090 + .long 1028902813 + .long 821626264 + .long 1029425647 + .long 817580405 + .long 1029948372 + .long 2952445505 + .long 1030470983 + .long 801005003 + .long 1030993477 + .long 800387983 + .long 1031515850 + .long 2942256123 + .long 1032048979 + .long 2968250322 + .long 1032570964 + .long 822790803 + .long 1033092672 + .long 826289861 + .long 1033614088 + .long 2976224418 + .long 1034135194 + .long 824490938 + .long 1034655977 + .long 822527213 + .long 1035176421 + .long 784232806 + .long 1035696510 + .long 822531604 + .long 1036216230 + .long 2967672936 + .long 1036735564 + .long 826515440 + .long 1037254499 + .long 2944102134 + .long 1037773019 + .long 2977774463 + .long 1038291108 + .long 795957866 + .long 1038808753 + .long 2972700386 + .long 1039325938 + .long 2975253635 + .long 1039842648 + .long 807079588 + .long 1040402092 + .long 822355304 + .long 1040917290 + .long 805504040 + .long 1041431409 + .long 2978896586 + .long 1041944391 + .long 836680090 + .long 1042456182 + .long 826352980 + .long 1042966726 + .long 2973619487 + .long 1043475968 + .long 2937629464 + .long 1043983855 + .long 831159584 + .long 1044490335 + .long 820394738 + .long 1044995356 + .long 2965290852 + .long 1045498867 + .long 772017454 + .long 1046000819 + .long 2978687103 + .long 1046501162 + .long 836200518 + .long 1046999850 + .long 836883769 + .long 1047496836 + .long 826905524 + .long 1047992074 + .long 824423170 + .long 1048653779 + .long 2993658277 + .long 1049143506 + .long 2988293347 + .long 1049629355 + .long 838635411 + .long 1050111172 + .long 2981083232 + .long 1050588809 + .long 840069395 + .long 1051062131 + .long 2985487843 + .long 1051531009 + .long 2987007755 + .long 1051995325 + .long 2954909954 + .long 1052454971 + .long 2992105648 + .long 1052909846 + .long 2984512837 + .long 1053359860 + .long 2974535271 + .long 1053804931 + .long 834850816 + .long 1054244987 + .long 2990399399 + .long 1054679962 + .long 2986843574 + .long 1055109800 + .long 841668384 + .long 1055534454 + .long 840878179 + .long 1056161628 + .long 2959648204 + .long 1056972004 + .long 2999182783 + .long 1057370275 + .long 2987693957 + .long 1057757908 + .long 848029633 + .long 1058134927 + .long 833824667 + .long 1058501396 + .long 838916473 + .long 1058857417 + .long 2982869562 + .long 1059203123 + .long 2987447445 + .long 1059538675 + .long 2986943103 + .long 1059864257 + .long 2962018373 + .long 1060180073 + .long 3001690183 + .long 1060486341 + .long 3000978470 + .long 1060783292 + .long 855353569 + .long 1061071169 + .long 847903241 + .long 1061350219 + .long 2995336148 + .long 1061620693 + .long 848940038 + .long 1062010885 + .long 848518105 + .long 1062503512 + .long 2989792343 + .long 1062966414 + .long 2998000194 + .long 1063401558 + .long 2966602495 + .long 1063810833 + .long 841421013 + .long 1064196033 + .long 853285487 + .long 1064558850 + .long 831341538 + .long 1064900868 + .long 2999260393 + .long 1065223564 + .long 3001104089 + .long 1065440763 + .long 856880849 + .long 1065584798 + .long 852830020 + .long 1065721082 + .long 862757435 + .long 1065850159 + .long 2998927867 + .long 1065972528 + .long 2998512290 + .long 1066088651 + .long 2998663603 + .long 1066198953 + .long 2996780932 + .long 1066354340 + .long 3007554211 + .long 1066544552 + .long 2996943326 + .long 1066717600 + .long 3000009859 + .long 1066875577 + .long 856175525 + .long 1067020272 + .long 836800017 + .long 1067153216 + .long 3008748444 + .long 1067275724 + .long 851983949 + .long 1067388933 + .long 862585050 + .long 1067493827 + .long 3009301766 + .long 1067591258 + .long 2988483069 + .long 1067681973 + .long 3005223458 + .long 1067766623 + .long 839061141 + .long 1067845782 + .long 2995523700 + .long 1067919954 + .long 2995663457 + .long 1067989585 + .long 858133164 + .long 1068055072 + .long 829335339 + .long 1068146290 + .long 856294518 + .long 1068256389 + .long 3003850806 + .long 1068355146 + .long 856998103 + .long 1068444206 + .long 2999569255 + .long 1068524912 + .long 3011255227 + .long 1068598373 + .long 841513866 + .long 1068665514 + .long 841710807 + .long 1068727109 + .long 2949159239 + .long 1068783812 + .long 2995542644 + .long 1068836179 + .long 3007665083 + .long 1068884685 + .long 3006087365 + .long 1068929739 + .long 2996180184 + .long 1068971695 + .long 3006313179 + .long 1069010859 + .long 849476222 + .long 1069047500 + .long 860722755 + .long 1069081853 + .long 859062603 + .long 1069129538 + .long 2979745798 + .long 1069186846 + .long 842801502 + .long 1069238035 + .long 3010794384 + .long 1069284031 + .long 3010162926 + .long 1069325584 + .long 3005589807 + .long 1069363306 + .long 853875835 + .long 1069397703 + .long 851842476 + .long 1069429195 + .long 3001807968 + .long 1069458133 + .long 859424355 + .long 1069484817 + .long 3004202910 + .long 1069509498 + .long 843503196 + .long 1069532394 + .long 856475636 + .long 1069553692 + .long 2995114457 + .long 1069573552 + .long 860725119 + .long 1069592116 + .long 859745384 + .long 1069609507 + .long 3009201804 + .long 1069633623 + .long 855498560 + .long 1069662574 + .long 858167444 + .long 1069688405 + .long 853306415 + .long 1069711594 + .long 846705105 + .long 1069732526 + .long 858976312 + .long 1069751516 + .long 2999172562 + .long 1069768821 + .long 2999539371 + .long 1069784656 + .long 2998679696 + .long 1069799200 + .long 861304267 + .long 1069812606 + .long 843012447 + .long 1069825002 + .long 3010989671 + .long 1069836497 + .long 3005173143 + .long 1069847186 + .long 853102954 + .long 1069857152 + .long 2993551140 + .long 1069866465 + .long 3000116992 + .long 1069875187 + .long 827148142 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2147418112 + .long 0 + .long 0 + .long 0 + .long 32768 + .long 0 + .long 0 + .long 1413754136 + .long 1073291771 + .long 1413754136 + .long 3220775419 + .long 2576980378 + .long 1070176665 + .long 1431655765 + .long 3218429269 + .long 1431655765 + .long 3218429269 + .long 0 + .long 0 + .long 4194304 + .long 1072693248 + .long 0 + .long 0 + .long 1070141402 + .long 866263400 + .long 1078530010 + .long 874652008 + .long 1061752794 + .long 857874792 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 874652008 + .long 1078530010 + .long 3022135656 + .long 3226013658 + .type static_const_table,@object + .size static_const_table,1472 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atan2l.S b/external/sgx_libm/ia32/atan2l.S new file mode 100644 index 0000000000..795987a9ca --- /dev/null +++ b/external/sgx_libm/ia32/atan2l.S @@ -0,0 +1,1195 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2l.c" + .text +..TXTST0: +# -- Begin atan2l + .text + .align 16,0x90 + .globl atan2l +atan2l: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp +..B1.2: + fnstcw 30(%esp) +..B1.3: + movzbl 29(%ebp), %edi + movzbl 17(%ebp), %ebx + andl $128, %edi + movzwl 16(%ebp), %ecx + andl $128, %ebx + andl $32767, %ecx + movzwl 28(%ebp), %esi + shrl $7, %edi + andl $32767, %esi + shrl $7, %ebx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $32767, %ecx + je ..B1.90 +..B1.4: + cmpl $32767, %esi + je ..B1.90 +..B1.5: + testl %ecx, %ecx + jne ..B1.8 +..B1.6: + cmpl $0, 12(%ebp) + jne ..B1.8 +..B1.7: + cmpl $0, 8(%ebp) + je ..B1.11 +..B1.8: + testl %esi, %esi + jne ..B1.32 +..B1.9: + cmpl $0, 24(%ebp) + jne ..B1.32 +..B1.10: + cmpl $0, 20(%ebp) + jne ..B1.32 +..B1.11: + movzwl 30(%esp), %eax + movl %eax, 12(%esp) + andl $768, %eax + cmpl $768, %eax + je ..B1.88 +..B1.12: + movl 12(%esp), %eax + orl $-64768, %eax + movw %ax, 28(%esp) +..B1.13: + fldcw 28(%esp) +..B1.14: + movl $1, %eax +..B1.15: + testl %ecx, %ecx + jne ..B1.28 +..B1.16: + cmpl $0, 12(%ebp) + jne ..B1.27 +..B1.17: + cmpl $0, 8(%ebp) + jne ..B1.26 +..B1.18: + testl %esi, %esi + jne ..B1.23 +..B1.19: + cmpl $0, 24(%ebp) + jne ..B1.22 +..B1.20: + cmpl $0, 20(%ebp) + je ..B1.85 +..B1.21: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 56(%esp) + jmp ..B1.23 +..B1.22: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 56(%esp) +..B1.23: + testl %edi, %edi + je ..B1.25 +..B1.24: + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ebx + fldt _pi_00l@GOTOFF(%ebx,%edx) + fldt _small_value_80@GOTOFF(%ebx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.29 +..B1.25: + fldl _zeros@GOTOFF(%edx,%ebx,8) + fstpt 64(%esp) + jmp ..B1.29 +..B1.26: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 56(%esp) + jmp ..B1.28 +..B1.27: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 56(%esp) +..B1.28: + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ebx + fldt _pi_02l@GOTOFF(%ebx,%edx) + fldt _small_value_80@GOTOFF(%ebx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) +..B1.29: + testl %eax, %eax + je ..B1.31 +..B1.30: + fldcw 30(%esp) +..B1.31: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movzwl 30(%esp), %eax + movl %eax, 12(%esp) + andl $768, %eax + cmpl $768, %eax + je ..B1.89 +..B1.33: + movl 12(%esp), %eax + orl $-64768, %eax + movw %ax, 28(%esp) +..B1.34: + fldcw 28(%esp) +..B1.35: + movl $1, 12(%esp) +..B1.36: + cmpl $8191, %esi + jg ..B1.40 +..B1.37: + cmpl $8191, %ecx + jg ..B1.39 +..B1.38: + fldt _TWO_8192@GOTOFF(%edx) + fldt 20(%ebp) + fmul %st(1), %st + fstpt 20(%ebp) + fldt 20(%ebp) + fldt 8(%ebp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + movzwl 28(%ebp), %esi + movzwl 16(%ebp), %ecx + andl $32767, %esi + andl $32767, %ecx + jmp ..B1.41 +..B1.39: + fldt 20(%ebp) + fldt 8(%ebp) + jmp ..B1.44 +..B1.40: + fldt 20(%ebp) + fldt 8(%ebp) +..B1.41: + cmpl $24575, %esi + jl ..B1.44 +..B1.42: + cmpl $24575, %ecx + jl ..B1.44 +..B1.43: + fldt 12+_TWO_8192@GOTOFF(%edx) + fmul %st, %st(2) + fxch %st(2) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + movzwl 28(%ebp), %esi + movzwl 16(%ebp), %ecx + andl $32767, %esi + andl $32767, %ecx +..B1.44: + fldl _ones@GOTOFF(%edx,%ebx,8) + fld %st(2) + fld %st(2) + fmul %st(2), %st + fxch %st(1) + fmull _ones@GOTOFF(%edx,%edi,8) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.68 +..B1.45: + lea 12(%ecx), %eax + cmpl %eax, %esi + jle ..B1.62 +..B1.46: + addl $75, %ecx + cmpl %ecx, %esi + jle ..B1.55 +..B1.47: + fstp %st(1) + fstp %st(0) + fstp %st(0) + testl %edi, %edi + je ..B1.49 +..B1.48: + fstp %st(1) + fstp %st(0) + lea (,%ebx,8), %eax + lea (%eax,%ebx,4), %ecx + fldt _pi_00l@GOTOFF(%ecx,%edx) + fldt _small_value_80@GOTOFF(%ecx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.52 +..B1.49: + fdivp %st, %st(1) + fstpt 64(%esp) + movzwl 72(%esp), %eax + testl $32767, %eax + jne ..B1.51 +..B1.50: + fldt _small_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.52 +..B1.51: + fldt _small_value_80@GOTOFF(%edx) + faddl _ones@GOTOFF(%edx) + fstpt (%esp) +..B1.52: + cmpl $0, 12(%esp) + je ..B1.54 +..B1.53: + fldcw 30(%esp) +..B1.54: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.55: + fstp %st(4) + fstp %st(2) + testl %edi, %edi + je ..B1.59 +..B1.56: + fldt 36+_P@GOTOFF(%edx) + fxch %st(3) + fdivrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(3) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 12+_P@GOTOFF(%edx) + cmpl $0, 12(%esp) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(1) + fldt _P@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + faddp %st, %st(2) + fxch %st(1) + fsubrl 8200+__libm_atanl_table_128@GOTOFF(%edx) + faddl 8192+__libm_atanl_table_128@GOTOFF(%edx) + fmulp %st, %st(1) + fstpt 64(%esp) + je ..B1.58 +..B1.57: + fldcw 30(%esp) +..B1.58: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.59: + fldt 36+_P@GOTOFF(%edx) + fld %st(2) + fdiv %st(4), %st + fld %st(0) + fmul %st(1), %st + fxch %st(3) + fstpl 48(%esp) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(2) + fldt 12+_P@GOTOFF(%edx) + cmpl $0, 12(%esp) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(1) + fld %st(4) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 32(%esp) + fld %st(2) + fld %st(3) + fld %st(3) + fldl _TWO_32H@GOTOFF(%edx) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(5) + fld %st(5) + fadd %st(1), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(3) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fsubr %st, %st(4) + fld %st(3) + fxch %st(2) + fdivrl _ones@GOTOFF(%edx) + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fstpt 16(%esp) + fldt 16(%esp) + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(3) + fxch %st(3) + fmul %st, %st(4) + fld %st(5) + fmul %st(1), %st + fxch %st(2) + fadd %st, %st(6) + fmulp %st, %st(1) + fxch %st(4) + faddl 8+_ones@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + fsubrp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 32(%esp) + faddp %st, %st(2) + faddp %st, %st(1) + fmull 48(%esp) + fstpt 64(%esp) + je ..B1.61 +..B1.60: + fldt 16(%esp) + fstpt 32(%esp) +..B1.123: + fldcw 30(%esp) +..B1.61: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.62: + fstp %st(4) + fstp %st(2) + fldl _TWO_63H@GOTOFF(%edx) + fld %st(2) + fxch %st(2) + fstpl 48(%esp) + fld %st(2) + fld %st(4) + fld %st(5) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(6), %st + fdiv %st(7), %st + fadd %st(4), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(4) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(4) + fldl _TWO_48H@GOTOFF(%edx) + fmul %st, %st(3) + movl 32(%esp), %eax + fxch %st(3) + fadd %st, %st(5) + shll $4, %eax + fsubrp %st, %st(5) + fld %st(4) + testl %edi, %edi + fmul %st(4), %st + fxch %st(5) + fsubr %st, %st(6) + fxch %st(2) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(6) + fld %st(5) + fmul %st(4), %st + fadd %st(7), %st + fxch %st(4) + fmul %st, %st(7) + fxch %st(7) + fsubrp %st, %st(6) + fmul %st, %st(6) + fxch %st(6) + fsubrp %st, %st(1) + fxch %st(5) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fdivrl _ones@GOTOFF(%edx) + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt 16(%esp) + fldt 16(%esp) + fsubp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(4) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(4) + fld %st(0) + fmul %st(6), %st + fxch %st(6) + fadd %st(7), %st + fxch %st(7) + fmulp %st, %st(1) + fxch %st(4) + faddl 8+_ones@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 20(%ebp) + fldt 20(%ebp) + fld %st(1) + fmul %st(3), %st + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(3) + fldt _P@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl 48(%esp) + je ..B1.64 +..B1.63: + negl %eax + fld %st(2) + fldl 8192+__libm_atanl_table_128@GOTOFF(%edx,%eax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fldl 8200+__libm_atanl_table_128@GOTOFF(%edx,%eax) + fsubp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B1.65 +..B1.64: + fldl __libm_atanl_table_128@GOTOFF(%eax,%edx) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fldl 8+__libm_atanl_table_128@GOTOFF(%eax,%edx) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) +..B1.65: + fstpt 64(%esp) + cmpl $0, 12(%esp) + je ..B1.67 +..B1.66: + fldt 16(%esp) + fstpt 32(%esp) +..B1.124: + fldcw 30(%esp) +..B1.67: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.68: + fstp %st(4) + fstp %st(2) + lea 12(%esi), %eax + cmpl %eax, %ecx + jle ..B1.79 +..B1.69: + addl $75, %esi + cmpl %esi, %ecx + jle ..B1.73 +..B1.70: + fstp %st(1) + fstp %st(1) + fstp %st(0) + cmpl $0, 12(%esp) + lea (,%ebx,8), %eax + lea (%eax,%ebx,4), %ecx + fldt _pi_02l@GOTOFF(%ecx,%edx) + fldt _small_value_80@GOTOFF(%ecx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + je ..B1.72 +..B1.71: + fldcw 30(%esp) +..B1.72: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.73: + fldt 12+_P@GOTOFF(%edx) + testl %edi, %edi + fxch %st(2) + fdivrp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fld %st(0) + fmul %st(1), %st + fxch %st(4) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_P@GOTOFF(%edx) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(5) + fldt _P@GOTOFF(%edx) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(2) + fldl 4096+__libm_atanl_table_128@GOTOFF(%edx) + fldl 4104+__libm_atanl_table_128@GOTOFF(%edx) + je ..B1.75 +..B1.74: + faddp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B1.76 +..B1.75: + fsubp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) +..B1.76: + fstpt 64(%esp) + cmpl $0, 12(%esp) + je ..B1.78 +..B1.77: + fldcw 30(%esp) +..B1.78: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.79: + fldl _TWO_63H@GOTOFF(%edx) + fld %st(3) + fxch %st(2) + fstpl 48(%esp) + fld %st(2) + fld %st(3) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(6), %st + fdiv %st(5), %st + fadd %st(3), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(3) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(3) + fld %st(5) + fldl _TWO_48H@GOTOFF(%edx) + fmul %st, %st(5) + movl 32(%esp), %eax + fxch %st(1) + fadd %st(5), %st + shll $4, %eax + fsubp %st, %st(5) + testl %edi, %edi + fxch %st(4) + fsubr %st, %st(6) + fld %st(6) + fmul %st(4), %st + fxch %st(3) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(5) + fxch %st(2) + fadd %st(5), %st + fld %st(1) + fmul %st(4), %st + fadd %st(3), %st + fxch %st(4) + fmul %st, %st(6) + fxch %st(6) + fsubrp %st, %st(7) + fxch %st(2) + fmulp %st, %st(5) + fsubp %st, %st(4) + fld %st(1) + fadd %st(1), %st + fdivrl _ones@GOTOFF(%edx) + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fstpt 16(%esp) + fldt 16(%esp) + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fld %st(3) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + fmul %st(4), %st + fld %st(4) + fmul %st(7), %st + fxch %st(6) + fadd %st, %st(7) + fmulp %st, %st(5) + faddl 8+_ones@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 20(%ebp) + fldt 20(%ebp) + fld %st(1) + fmul %st(3), %st + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(3) + fldt _P@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl 48(%esp) + je ..B1.81 +..B1.80: + fldl 4096+__libm_atanl_table_128@GOTOFF(%edx,%eax) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fldl 4104+__libm_atanl_table_128@GOTOFF(%edx,%eax) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B1.82 +..B1.81: + negl %eax + fld %st(2) + fldl 4096+__libm_atanl_table_128@GOTOFF(%edx,%eax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fldl 4104+__libm_atanl_table_128@GOTOFF(%edx,%eax) + fsubp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) +..B1.82: + fstpt 64(%esp) + cmpl $0, 12(%esp) + je ..B1.84 +..B1.83: + fldt 16(%esp) + fstpt 32(%esp) +..B1.125: + fldcw 30(%esp) +..B1.84: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.85: + testl %edi, %edi + je ..B1.87 +..B1.86: + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ebx + fldt _pi_00l@GOTOFF(%ebx,%edx) + fldt _small_value_80@GOTOFF(%ebx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.29 +..B1.87: + fldl _zeros@GOTOFF(%edx,%ebx,8) + fstpt 64(%esp) + jmp ..B1.29 +..B1.88: + xorl %eax, %eax + jmp ..B1.15 +..B1.89: + movl $0, 12(%esp) + jmp ..B1.36 +..B1.90: + movzwl 30(%esp), %eax + movl %eax, 12(%esp) + andl $768, %eax + cmpl $768, %eax + je ..B1.120 +..B1.91: + movl 12(%esp), %eax + orl $-64768, %eax + movw %ax, 28(%esp) +..B1.92: + fldcw 28(%esp) +..B1.93: + movl $1, %eax +..B1.94: + cmpl $32767, %ecx + je ..B1.118 +..B1.95: + cmpl $32767, %esi + je ..B1.115 +..B1.96: + testl %ecx, %ecx + jne ..B1.99 +..B1.97: + cmpl $0, 12(%ebp) + jne ..B1.102 +..B1.98: + cmpl $0, 8(%ebp) + jne ..B1.102 +..B1.99: + testl %esi, %esi + jne ..B1.103 +..B1.100: + cmpl $0, 24(%ebp) + jne ..B1.102 +..B1.101: + cmpl $0, 20(%ebp) + je ..B1.104 +..B1.102: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 56(%esp) +..B1.103: + cmpl $32767, %esi + je ..B1.108 +..B1.104: + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ebx + fldt _pi_02l@GOTOFF(%ebx,%edx) + fldt _small_value_80@GOTOFF(%ebx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) +..B1.105: + testl %eax, %eax + je ..B1.107 +..B1.106: + fldcw 30(%esp) +..B1.107: + fldt 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.108: + cmpl $32767, %ecx + je ..B1.112 +..B1.109: + testl %edi, %edi + je ..B1.111 +..B1.110: + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ebx + fldt _pi_00l@GOTOFF(%ebx,%edx) + fldt _small_value_80@GOTOFF(%ebx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.105 +..B1.111: + fldl _zeros@GOTOFF(%edx,%ebx,8) + fstpt 64(%esp) + jmp ..B1.105 +..B1.112: + testl %edi, %edi + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ecx + je ..B1.114 +..B1.113: + fldt _pi_34l@GOTOFF(%ecx,%edx) + fldt _small_value_80@GOTOFF(%ecx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.105 +..B1.114: + fldt _pi_04l@GOTOFF(%ecx,%edx) + fldt _small_value_80@GOTOFF(%ecx,%edx) + fsubrp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.105 +..B1.115: + cmpl $-2147483648, 24(%ebp) + jne ..B1.117 +..B1.116: + cmpl $0, 20(%ebp) + je ..B1.96 +..B1.117: + fldt 20(%ebp) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.105 +..B1.118: + cmpl $-2147483648, 12(%ebp) + jne ..B1.117 +..B1.119: + cmpl $0, 8(%ebp) + jne ..B1.117 + jmp ..B1.95 +..B1.120: + xorl %eax, %eax + jmp ..B1.94 + .align 16,0x90 + .type atan2l,@function + .size atan2l,.-atan2l + .data +# -- End atan2l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 2 +_pi_00l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49152 + .word 0 + .type _pi_00l,@object + .size _pi_00l,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_pi_02l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .type _pi_02l,@object + .size _pi_02l,24 + .align 2 +_TWO_8192: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _TWO_8192,@object + .size _TWO_8192,24 + .align 2 +_P: + .word 43664 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 43235 + .word 52379 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 59507 + .word 38278 + .word 9340 + .word 37449 + .word 49148 + .word 0 + .word 9132 + .word 55602 + .word 8665 + .word 58245 + .word 16379 + .word 0 + .type _P,@object + .size _P,48 + .align 2 +_pi_34l: + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 16384 + .word 0 + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 49152 + .word 0 + .type _pi_34l,@object + .size _pi_34l,24 + .align 2 +_pi_04l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16382 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49150 + .word 0 + .type _pi_04l,@object + .size _pi_04l,24 + .data + .hidden __libm_atanl_table_128 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atan_wmt.S b/external/sgx_libm/ia32/atan_wmt.S new file mode 100644 index 0000000000..8d01ca578e --- /dev/null +++ b/external/sgx_libm/ia32/atan_wmt.S @@ -0,0 +1,922 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin atan + .text + .align 16,0x90 + .globl atan +atan: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 2640(%ebx), %xmm3 + movsd 2624(%ebx), %xmm5 + movsd 2656(%ebx), %xmm4 + movsd %xmm0, 8(%esp) + pextrw $3, %xmm0, %edx + andpd %xmm0, %xmm3 + pshufd $68, %xmm0, %xmm1 + orpd %xmm4, %xmm3 + movl %edx, %eax + andl $32767, %edx + subl $16288, %edx + cmpl $159, %edx + ja .L_2TAG_PACKET_0.0.2 + mulsd %xmm3, %xmm1 + subsd %xmm3, %xmm0 + addsd %xmm5, %xmm1 + divsd %xmm1, %xmm0 + addl $1, %edx + movsd 2672(%ebx), %xmm2 + movsd 2688(%ebx), %xmm4 + andl $32768, %eax + xorpd %xmm7, %xmm7 + pinsrw $3, %eax, %xmm7 + addl %edx, %edx + movsd (%ebx,%edx,8), %xmm6 + movsd 8(%ebx,%edx,8), %xmm5 + xorpd %xmm7, %xmm5 + xorpd %xmm7, %xmm6 + movsd 2680(%ebx), %xmm7 + pshufd $68, %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + pshufd $68, %xmm1, %xmm3 + addsd %xmm6, %xmm1 + mulsd %xmm0, %xmm2 + addsd %xmm0, %xmm4 + subsd %xmm1, %xmm6 + mulsd %xmm0, %xmm4 + addsd %xmm7, %xmm2 + mulsd %xmm3, %xmm0 + addsd %xmm3, %xmm6 + mulsd %xmm2, %xmm0 + addsd 2696(%ebx), %xmm4 + addsd %xmm5, %xmm6 + mulsd %xmm4, %xmm0 + addsd %xmm6, %xmm0 + addsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + addl $944, %edx + cmpl $1103, %edx + ja .L_2TAG_PACKET_2.0.2 + movsd 2672(%ebx), %xmm4 + movsd 2688(%ebx), %xmm7 + movsd 8(%esp), %xmm0 + mulsd %xmm1, %xmm1 + movsd 2680(%ebx), %xmm2 + movsd 2696(%ebx), %xmm5 + mulsd %xmm1, %xmm4 + addsd %xmm1, %xmm7 + movapd %xmm1, %xmm6 + mulsd %xmm0, %xmm1 + addsd %xmm4, %xmm2 + mulsd %xmm6, %xmm7 + mulsd %xmm1, %xmm2 + addsd %xmm5, %xmm7 + mulsd %xmm7, %xmm2 + addsd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + addl $15344, %edx + cmpl $16368, %edx + ja .L_2TAG_PACKET_3.0.2 + movsd 8(%esp), %xmm0 + movsd 8(%esp), %xmm1 + cmpl $16, %edx + jae .L_2TAG_PACKET_4.0.2 + mulsd %xmm0, %xmm1 +.L_2TAG_PACKET_4.0.2: + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_3.0.2: + cmpl $17392, %edx + jae .L_2TAG_PACKET_5.0.2 + xorpd %xmm1, %xmm1 + movl $49136, %ecx + pinsrw $3, %ecx, %xmm1 + divsd %xmm0, %xmm1 + movsd 2672(%ebx), %xmm2 + movsd 2688(%ebx), %xmm4 + andl $32768, %eax + xorpd %xmm7, %xmm7 + pinsrw $3, %eax, %xmm7 + addl %edx, %edx + movsd 2592(%ebx), %xmm6 + movsd 2600(%ebx), %xmm5 + xorpd %xmm7, %xmm5 + xorpd %xmm7, %xmm6 + movsd 2680(%ebx), %xmm7 + pshufd $68, %xmm1, %xmm0 + mulsd %xmm1, %xmm1 + pshufd $68, %xmm0, %xmm3 + addsd %xmm6, %xmm0 + mulsd %xmm1, %xmm2 + addsd %xmm1, %xmm4 + subsd %xmm0, %xmm6 + mulsd %xmm1, %xmm4 + addsd %xmm7, %xmm2 + mulsd %xmm3, %xmm1 + addsd %xmm3, %xmm6 + mulsd %xmm2, %xmm1 + addsd 2696(%ebx), %xmm4 + addsd %xmm5, %xmm6 + mulsd %xmm4, %xmm1 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_5.0.2: + movsd 8(%esp), %xmm4 + movsd 2608(%ebx), %xmm0 + movsd 2592(%ebx), %xmm2 + movsd 2600(%ebx), %xmm3 + movd %xmm1, %eax + psrlq $32, %xmm1 + movd %xmm1, %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + jae .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_7.0.2: + andnpd %xmm4, %xmm0 + orpd %xmm0, %xmm2 + orpd %xmm3, %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_6.0.2: + subl $2146435072, %edx + orl %edx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_7.0.2 + movapd %xmm4, %xmm0 + addsd %xmm0, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_1.0.2: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type atan,@function + .size atan,.-atan + .data +# -- End atan + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 3819695742 + .long 1067482761 + .long 2398680355 + .long 3155462074 + .long 2998791009 + .long 1067548225 + .long 3868465248 + .long 3157182472 + .long 3339424991 + .long 1067613680 + .long 3296670360 + .long 1010752543 + .long 2710002256 + .long 1067679126 + .long 3403896007 + .long 1010910768 + .long 3275701428 + .long 1067744562 + .long 119959933 + .long 1011482843 + .long 2908636881 + .long 1067809988 + .long 2464489612 + .long 1011545526 + .long 3777889398 + .long 1067875403 + .long 3262682165 + .long 1009703919 + .long 3759667419 + .long 1067940807 + .long 1838130851 + .long 3157373556 + .long 732369940 + .long 1068006200 + .long 1203428313 + .long 1010055371 + .long 1166616461 + .long 1068071580 + .long 2901274051 + .long 3158549977 + .long 2945472892 + .long 1068136947 + .long 3726120658 + .long 1009762715 + .long 3954480976 + .long 1068202301 + .long 1289173457 + .long 1009429861 + .long 2081752829 + .long 1068267642 + .long 1836909874 + .long 1006212095 + .long 3807999788 + .long 1068332968 + .long 2172459940 + .long 3156162078 + .long 2731789884 + .long 1068398280 + .long 3450718392 + .long 3159216547 + .long 1044477961 + .long 1068463577 + .long 2230553229 + .long 1011424339 + .long 1486930287 + .long 1068530218 + .long 2861547474 + .long 1012041376 + .long 2293016881 + .long 1068595466 + .long 136843272 + .long 1012684797 + .long 201518157 + .long 1068660680 + .long 63231984 + .long 1012427198 + .long 4054234584 + .long 1068725856 + .long 3927006960 + .long 1011878955 + .long 1246477213 + .long 1068790995 + .long 1494265652 + .long 3155219350 + .long 678186699 + .long 1068856093 + .long 1264361424 + .long 3159256693 + .long 2690594995 + .long 1068921148 + .long 3906996379 + .long 1009288267 + .long 3362611517 + .long 1068986159 + .long 1650970041 + .long 3158331771 + .long 3102162111 + .long 1069051124 + .long 365917035 + .long 3160264153 + .long 2352611067 + .long 1069116041 + .long 4008970190 + .long 3159478182 + .long 1594134794 + .long 1069180908 + .long 466690178 + .long 1012526501 + .long 1345079306 + .long 1069245723 + .long 2268273568 + .long 3160164092 + .long 2163300970 + .long 1069310484 + .long 2750834800 + .long 3158113482 + .long 352522716 + .long 1069375190 + .long 1750411372 + .long 1011790845 + .long 848541647 + .long 1069439838 + .long 2164207573 + .long 1011698350 + .long 40647312 + .long 1069504427 + .long 2949165434 + .long 3159107267 + .long 2216766270 + .long 1069574357 + .long 2197920765 + .long 3161055954 + .long 1090914384 + .long 1069638757 + .long 2330454674 + .long 1013365998 + .long 387601244 + .long 1069703022 + .long 3185681168 + .long 1013434071 + .long 3991640484 + .long 1069767144 + .long 1313211590 + .long 3161087959 + .long 3322489502 + .long 1069831118 + .long 3013977995 + .long 1013053011 + .long 3121698570 + .long 1069894936 + .long 4069015667 + .long 1013023362 + .long 4289964660 + .long 1069958591 + .long 1736191156 + .long 3158266731 + .long 3903312386 + .long 1070022077 + .long 1833592413 + .long 3159731471 + .long 3818449864 + .long 1070085387 + .long 851036429 + .long 3159730451 + .long 2097480306 + .long 1070148515 + .long 3506390884 + .long 3160462302 + .long 1611694502 + .long 1070211454 + .long 2785735540 + .long 3160465144 + .long 1464694796 + .long 1070274198 + .long 4229277299 + .long 3159907000 + .long 1299612775 + .long 1070336741 + .long 4116653788 + .long 3160427739 + .long 1310544789 + .long 1070399077 + .long 1064430331 + .long 1013218202 + .long 2253168030 + .long 1070461200 + .long 1405044609 + .long 3157623179 + .long 1159567373 + .long 1070523105 + .long 2353445521 + .long 3159992176 + .long 1359373750 + .long 1070605818 + .long 1748171336 + .long 3161879263 + .long 908341706 + .long 1070667034 + .long 3372710815 + .long 3161775245 + .long 1743027350 + .long 1070727765 + .long 687089934 + .long 3160507171 + .long 2055355646 + .long 1070787992 + .long 2392855242 + .long 1013682469 + .long 690426164 + .long 1070847697 + .long 1103926666 + .long 1014052810 + .long 1483247847 + .long 1070906862 + .long 2082645847 + .long 3161345479 + .long 392040270 + .long 1070965472 + .long 2407720023 + .long 1014053754 + .long 2673846014 + .long 1071023511 + .long 1293605532 + .long 3158464385 + .long 1384215810 + .long 1071080967 + .long 2446095872 + .long 3159216407 + .long 3101660631 + .long 1071137826 + .long 698040758 + .long 1014855328 + .long 2094057058 + .long 1071194078 + .long 2282048339 + .long 1014040385 + .long 1712750594 + .long 1071249712 + .long 1204372378 + .long 3162276464 + .long 1411515787 + .long 1071304719 + .long 949080808 + .long 1015006403 + .long 931538085 + .long 1071359091 + .long 3027127039 + .long 1014307233 + .long 179139065 + .long 1071412821 + .long 4285547492 + .long 3161934731 + .long 3387721259 + .long 1071465902 + .long 373225773 + .long 1013486625 + .long 2132236852 + .long 1071544299 + .long 3250533429 + .long 1014031677 + .long 1942070284 + .long 1071645596 + .long 1237964179 + .long 3163239113 + .long 1532707802 + .long 1071695380 + .long 330645583 + .long 1012495610 + .long 2294184979 + .long 1071743834 + .long 3959472897 + .long 1015833116 + .long 3805060714 + .long 1071790961 + .long 2671256142 + .long 1013727772 + .long 2215037898 + .long 1071836770 + .long 2683359117 + .long 1015831902 + .long 483661594 + .long 1071881273 + .long 836288326 + .long 3162648643 + .long 1534679894 + .long 1071924486 + .long 373258696 + .long 3162470096 + .long 1538714628 + .long 1071966430 + .long 3199433068 + .long 1015325501 + .long 527642555 + .long 1072007128 + .long 3636832592 + .long 3161843145 + .long 291339150 + .long 1072046605 + .long 890169537 + .long 3160586117 + .long 2450210201 + .long 1072084888 + .long 1636353294 + .long 3163193400 + .long 2411367951 + .long 1072122007 + .long 374899873 + .long 1011331750 + .long 681549971 + .long 1072157992 + .long 506411689 + .long 1015373954 + .long 1466745541 + .long 1072192873 + .long 2143860931 + .long 1013364334 + .long 2845622366 + .long 1072226682 + .long 2869178209 + .long 3162423682 + .long 2838871438 + .long 1072275456 + .long 3742223599 + .long 1014338577 + .long 4200275274 + .long 1072337034 + .long 1566539915 + .long 3161839550 + .long 3034733530 + .long 1072394897 + .long 652621408 + .long 3162261964 + .long 3207412993 + .long 1072449290 + .long 3206124665 + .long 1014408733 + .long 624461478 + .long 1072500450 + .long 932437485 + .long 1015204343 + .long 767665908 + .long 1072548600 + .long 1037911952 + .long 3163527627 + .long 1110773639 + .long 1072593952 + .long 2371517912 + .long 3160465741 + .long 1940828530 + .long 1072636704 + .long 2731408428 + .long 3162895795 + .long 1911329388 + .long 1072677041 + .long 1773089615 + .long 3159569267 + .long 1764715788 + .long 1072704191 + .long 691346949 + .long 3164069946 + .long 3332979233 + .long 1072722195 + .long 3550733983 + .long 1014770628 + .long 1321870254 + .long 1072739231 + .long 1415315820 + .long 1016224052 + .long 3657429030 + .long 1072755365 + .long 3910539033 + .long 1015966402 + .long 4197624557 + .long 1072770661 + .long 2333399254 + .long 3164546480 + .long 1512059493 + .long 1072785177 + .long 2701510318 + .long 1016178092 + .long 453379037 + .long 1072798965 + .long 4046344253 + .long 3162814364 + .long 1942345162 + .long 1072818388 + .long 621134147 + .long 1016335195 + .long 4210176273 + .long 1072842164 + .long 2701013387 + .long 3164326619 + .long 4185644010 + .long 1072863795 + .long 4163699341 + .long 1016203112 + .long 679688788 + .long 1072883543 + .long 4147276762 + .long 1014066750 + .long 29432865 + .long 1072901630 + .long 970415797 + .long 1016902063 + .long 4070721092 + .long 1072918247 + .long 2539004411 + .long 3163736096 + .long 2252468843 + .long 1072933561 + .long 3424082887 + .long 3163407177 + .long 2929724825 + .long 1072947712 + .long 3661482235 + .long 3163846989 + .long 1377513368 + .long 1072960824 + .long 3987926680 + .long 1013647908 + .long 1031632908 + .long 1072973003 + .long 3672217151 + .long 1016614619 + .long 2516508130 + .long 1072984342 + .long 545855020 + .long 3162728930 + .long 3792452178 + .long 1072994923 + .long 3420119467 + .long 1016471430 + .long 3147791459 + .long 1073004818 + .long 1342204979 + .long 1013937254 + .long 999189752 + .long 1073014090 + .long 1006335472 + .long 3162850919 + .long 711011011 + .long 1073022794 + .long 4633488 + .long 3162966895 + .long 15640363 + .long 1073030980 + .long 1686389560 + .long 3164376226 + .long 1218463589 + .long 1073042382 + .long 1526837110 + .long 3163533985 + .long 2538470555 + .long 1073056144 + .long 2273304406 + .long 3163784996 + .long 1229720947 + .long 1073068489 + .long 2971628206 + .long 3162356540 + .long 3115427016 + .long 1073079621 + .long 4215132957 + .long 3164282762 + .long 4030612557 + .long 1073089709 + .long 1913251691 + .long 3163671292 + .long 2728521257 + .long 1073098892 + .long 2861089500 + .long 1015454459 + .long 1118696283 + .long 1073107285 + .long 1628948053 + .long 1016179658 + .long 2682711255 + .long 1073114984 + .long 2906306266 + .long 1014142643 + .long 2073898081 + .long 1073122072 + .long 1322740454 + .long 3164497217 + .long 1403700297 + .long 1073128618 + .long 416137895 + .long 3162781466 + .long 2502685617 + .long 1073134681 + .long 3242008732 + .long 1014593495 + .long 1531926851 + .long 1073140313 + .long 1362708094 + .long 1016517604 + .long 3572814411 + .long 1073145557 + .long 3709790527 + .long 1012646874 + .long 1695536111 + .long 1073150453 + .long 3980346340 + .long 1016705136 + .long 2363057203 + .long 1073155033 + .long 2551194792 + .long 1012569695 + .long 2873365682 + .long 1073159327 + .long 3181154748 + .long 1017041450 + .long 1053384691 + .long 1073165288 + .long 3074536879 + .long 1016965660 + .long 3270542712 + .long 1073172451 + .long 2535319415 + .long 3163051778 + .long 1353631484 + .long 1073178850 + .long 1173833755 + .long 1015534537 + .long 3511218460 + .long 1073184599 + .long 1243608109 + .long 3161592122 + .long 4121259284 + .long 1073189793 + .long 398584912 + .long 3163829923 + .long 1193862106 + .long 1073194509 + .long 1873745539 + .long 3163802819 + .long 3861949790 + .long 1073198808 + .long 3841261147 + .long 1015587248 + .long 1486904578 + .long 1073202745 + .long 1634726776 + .long 3163847886 + .long 2879153715 + .long 1073206362 + .long 200456242 + .long 3164138657 + .long 385353253 + .long 1073209698 + .long 1186355517 + .long 1014887155 + .long 1125865839 + .long 1073212783 + .long 203561262 + .long 3161244927 + .long 1221361475 + .long 1073215645 + .long 3382476563 + .long 1014936138 + .long 2077323573 + .long 1073218307 + .long 1005121005 + .long 3164430752 + .long 215611373 + .long 1073220790 + .long 353198764 + .long 3164485137 + .long 2347419265 + .long 1073223110 + .long 1103143360 + .long 1016542137 + .long 1379112765 + .long 1073225284 + .long 381583533 + .long 3162870833 + .long 3891198463 + .long 1073228298 + .long 1771275754 + .long 1014654681 + .long 3395914051 + .long 1073231917 + .long 2350900914 + .long 3164013978 + .long 2799919478 + .long 1073235146 + .long 2893950164 + .long 3163260901 + .long 1138673476 + .long 1073238045 + .long 2622204785 + .long 3164174388 + .long 3408855940 + .long 1073240661 + .long 2800881650 + .long 1016008624 + .long 2044858738 + .long 1073243035 + .long 604544785 + .long 1017022901 + .long 2578795176 + .long 1073245198 + .long 2557332925 + .long 1016135165 + .long 4196285314 + .long 1073247177 + .long 2032365307 + .long 1016194735 + .long 224877747 + .long 1073248996 + .long 497926916 + .long 1016947111 + .long 3271386490 + .long 1073250671 + .long 2689994846 + .long 1016631513 + .long 813635989 + .long 1073252221 + .long 747035277 + .long 3164530136 + .long 369829519 + .long 1073253658 + .long 2182033858 + .long 3163190340 + .long 1187679052 + .long 1073254994 + .long 673954443 + .long 1016149821 + .long 4232586098 + .long 1073256239 + .long 497775200 + .long 3162179015 + .long 426690558 + .long 1073257404 + .long 3063343247 + .long 1016865578 + .long 1624065902 + .long 1073258494 + .long 1354224996 + .long 3163503778 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 4294901760 + .long 0 + .long 0 + .long 0 + .long 32768 + .long 0 + .long 0 + .long 2006262985 + .long 1069310863 + .long 2358449471 + .long 3217342131 + .long 3845454352 + .long 1069952297 + .long 2829679149 + .long 1073771565 + .type static_const_table,@object + .size static_const_table,2704 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atandl_table.S b/external/sgx_libm/ia32/atandl_table.S new file mode 100644 index 0000000000..d80f401005 --- /dev/null +++ b/external/sgx_libm/ia32/atandl_table.S @@ -0,0 +1,2100 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atandl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_atandl_table_128 + .globl __libm_atandl_table_128 +__libm_atandl_table_128: + .long 0 + .long 0 + .long 0 + .long 0 + .long 3896508416 + .long 1071424949 + .long 2497855885 + .long 1035107781 + .long 1447034880 + .long 1072473411 + .long 1733066939 + .long 3185173141 + .long 1421869056 + .long 1073052515 + .long 1368774744 + .long 1038726731 + .long 1314914304 + .long 1073521529 + .long 3636885973 + .long 3186244272 + .long 1199570944 + .long 1073866069 + .long 2275810035 + .long 3185989885 + .long 476053504 + .long 1074100319 + .long 3721769433 + .long 3184582046 + .long 3514826752 + .long 1074334397 + .long 1919096566 + .long 3184722268 + .long 845152256 + .long 1074568277 + .long 2005889037 + .long 1036405998 + .long 2545942528 + .long 1074796164 + .long 4215566178 + .long 1040782263 + .long 4057989120 + .long 1074912862 + .long 2215314489 + .long 1040552811 + .long 3430940672 + .long 1075029419 + .long 314220031 + .long 3187779646 + .long 1717567488 + .long 1075145821 + .long 2152308088 + .long 1040271717 + .long 455081984 + .long 1075262054 + .long 1186928436 + .long 1040902706 + .long 1694498816 + .long 1075378104 + .long 4227739998 + .long 1040491905 + .long 3747610624 + .long 1075493958 + .long 535382953 + .long 1040666985 + .long 1226833920 + .long 1075609604 + .long 1790336138 + .long 1040185867 + .long 2260729856 + .long 1075725027 + .long 3899937368 + .long 3188375434 + .long 3525312512 + .long 1075839595 + .long 4053544535 + .long 3185741100 + .long 3957325824 + .long 1075897065 + .long 4030890856 + .long 1040553080 + .long 3248488448 + .long 1075954405 + .long 1333464106 + .long 3189137055 + .long 452984832 + .long 1076011609 + .long 3448918206 + .long 3189528508 + .long 3615490048 + .long 1076068669 + .long 608092114 + .long 1041523725 + .long 4020240384 + .long 1076125581 + .long 1336102440 + .long 3188870826 + .long 1960837120 + .long 1076182339 + .long 2391933274 + .long 3189275321 + .long 2470445056 + .long 1076238936 + .long 4283795024 + .long 1041937846 + .long 2451570688 + .long 1076295367 + .long 4217000778 + .long 1039765656 + .long 3560964096 + .long 1076351626 + .long 3936906987 + .long 3182578922 + .long 3640655872 + .long 1076407708 + .long 1439536878 + .long 1040659594 + .long 1023410176 + .long 1076463608 + .long 2552585681 + .long 3189615238 + .long 3122659328 + .long 1076519319 + .long 31715936 + .long 1042073699 + .long 689963008 + .long 1076574838 + .long 3139108801 + .long 1040611849 + .long 2164260864 + .long 1076630158 + .long 1139819401 + .long 3187965768 + .long 3623878656 + .long 1076685275 + .long 3513262155 + .long 1039670426 + .long 1679818752 + .long 1076740185 + .long 728891110 + .long 1041952788 + .long 2069889024 + .long 1076794882 + .long 3614319306 + .long 1039599785 + .long 2480930816 + .long 1076849362 + .long 1879438446 + .long 3188546042 + .long 2720006144 + .long 1076895586 + .long 4246516390 + .long 1042916956 + .long 574619648 + .long 1076922603 + .long 3568262924 + .long 1040145602 + .long 3061841920 + .long 1076949504 + .long 290418758 + .long 3187677511 + .long 1539309568 + .long 1076976289 + .long 635731916 + .long 1042641148 + .long 532676608 + .long 1077002955 + .long 4225033962 + .long 3189573420 + .long 545259520 + .long 1077029500 + .long 2007583995 + .long 1042491810 + .long 2369781760 + .long 1077055922 + .long 2061076001 + .long 3190167169 + .long 2774532096 + .long 1077082220 + .long 2608380742 + .long 1042446121 + .long 3112173568 + .long 1077108392 + .long 2901961231 + .long 1042075808 + .long 715128832 + .long 1077134437 + .long 3828632392 + .long 3189418038 + .long 1782579200 + .long 1077160352 + .long 519110621 + .long 1041924126 + .long 4206886912 + .long 1077186136 + .long 2078221814 + .long 1039357043 + .long 1858076672 + .long 1077211789 + .long 2404314454 + .long 3190701797 + .long 1763704832 + .long 1077237308 + .long 1129624783 + .long 3189333294 + .long 2638217216 + .long 1077262692 + .long 1872508293 + .long 3187027668 + .long 3464495104 + .long 1077287940 + .long 2518581518 + .long 1039154339 + .long 3493855232 + .long 1077313051 + .long 2874645533 + .long 3188678970 + .long 2241855488 + .long 1077338024 + .long 182480744 + .long 3187988055 + .long 3783262208 + .long 1077362857 + .long 41710967 + .long 3189176765 + .long 3860856832 + .long 1077387550 + .long 3921914980 + .long 1040188295 + .long 2770337792 + .long 1077412102 + .long 2195237132 + .long 1043018421 + .long 1061158912 + .long 1077436512 + .long 1866130671 + .long 1042885968 + .long 3825205248 + .long 1077460778 + .long 2099274145 + .long 1043277518 + .long 3519021056 + .long 1077484901 + .long 2434136291 + .long 3190760305 + .long 1423966208 + .long 1077508880 + .long 786043090 + .long 3189674834 + .long 3361734656 + .long 1077532713 + .long 1735814367 + .long 1041228653 + .long 2501902336 + .long 1077556401 + .long 2532076405 + .long 1041674477 + .long 832569344 + .long 1077579943 + .long 1067893357 + .long 1041790735 + .long 568328192 + .long 1077603338 + .long 42353869 + .long 1040967961 + .long 4143972352 + .long 1077626585 + .long 3035382168 + .long 1043228732 + .long 1329594368 + .long 1077649686 + .long 2622169537 + .long 1042608561 + .long 3579838464 + .long 1077672638 + .long 3279279360 + .long 1039969098 + .long 1082130432 + .long 1077695443 + .long 152088799 + .long 1042154031 + .long 1409286144 + .long 1077718099 + .long 1577179566 + .long 1043010748 + .long 3743416320 + .long 1077740606 + .long 164745699 + .long 3187116092 + .long 3162505216 + .long 1077762965 + .long 3525309094 + .long 3189988831 + .long 3525312512 + .long 1077785175 + .long 790013831 + .long 3189219565 + .long 287309824 + .long 1077807237 + .long 3014793090 + .long 3190791112 + .long 1965031424 + .long 1077829149 + .long 2967000185 + .long 3189805146 + .long 73400320 + .long 1077850913 + .long 923692587 + .long 1033248306 + .long 3477078016 + .long 1077872527 + .long 797568562 + .long 1037083943 + .long 4024434688 + .long 1077893993 + .long 1829946853 + .long 1043203029 + .long 2319450112 + .long 1077915311 + .long 1559006781 + .long 3189221910 + .long 1704984576 + .long 1077936304 + .long 2364400925 + .long 3186972503 + .long 4104126464 + .long 1077946814 + .long 2278278095 + .long 3191749589 + .long 2438987776 + .long 1077957251 + .long 3465285131 + .long 1042435970 + .long 1606418432 + .long 1077967614 + .long 1692530062 + .long 1043648146 + .long 2273312768 + .long 1077977903 + .long 4155795398 + .long 1043918312 + .long 878706688 + .long 1077988119 + .long 1476207680 + .long 1043900034 + .long 2516582400 + .long 1077998261 + .long 2925970384 + .long 1039575776 + .long 3751804928 + .long 1078008330 + .long 2856171667 + .long 3191395954 + .long 1207959552 + .long 1078018327 + .long 2148760563 + .long 1039453383 + .long 161480704 + .long 1078028251 + .long 3632513556 + .long 3191302868 + .long 1642070016 + .long 1078038102 + .long 3240138768 + .long 1043718443 + .long 2447376384 + .long 1078047881 + .long 3100705142 + .long 3191740341 + .long 3709861888 + .long 1078057588 + .long 1674862667 + .long 1041748151 + .long 2325741568 + .long 1078067224 + .long 4255018693 + .long 1044226144 + .long 3827302400 + .long 1078076788 + .long 4142119676 + .long 3191232448 + .long 899678208 + .long 1078086282 + .long 700553623 + .long 1043581423 + .long 3462397952 + .long 1078095704 + .long 1067893357 + .long 3190322959 + .long 4286578688 + .long 1078105056 + .long 3385731218 + .long 1043691060 + .long 486539264 + .long 1078114339 + .long 2289432889 + .long 1035999008 + .long 2092957696 + .long 1078123551 + .long 653388941 + .long 3186809946 + .long 1996488704 + .long 1078132694 + .long 3139143286 + .long 3191209215 + .long 1709178880 + .long 1078141768 + .long 643854101 + .long 3190510369 + .long 2778726400 + .long 1078150773 + .long 2948057503 + .long 3191040876 + .long 2485125120 + .long 1078159710 + .long 172509481 + .long 1044304413 + .long 2438987776 + .long 1078168579 + .long 1352848207 + .long 1043175137 + .long 4271898624 + .long 1078177380 + .long 2864918449 + .long 1043427968 + .long 1054867456 + .long 1078186115 + .long 1735520057 + .long 1044098886 + .long 3063939072 + .long 1078194782 + .long 2894826982 + .long 1043616305 + .long 3418357760 + .long 1078203383 + .long 442938097 + .long 3191392387 + .long 3844079616 + .long 1078211918 + .long 4004776912 + .long 1043962348 + .long 1801453568 + .long 1078220388 + .long 2102624066 + .long 1044353828 + .long 3355443200 + .long 1078228792 + .long 1225643377 + .long 3190452555 + .long 1700790272 + .long 1078237132 + .long 2531804346 + .long 3191195152 + .long 2936012800 + .long 1078245407 + .long 928991542 + .long 1043548181 + .long 293601280 + .long 1078253619 + .long 3229203938 + .long 1042779359 + .long 4194304000 + .long 1078261766 + .long 1071139240 + .long 1044201053 + .long 3600809984 + .long 1078269851 + .long 3018208080 + .long 1043941200 + .long 371195904 + .long 1078277874 + .long 2039162957 + .long 3189903110 + .long 666894336 + .long 1078285834 + .long 1431034507 + .long 3190628953 + .long 2071986176 + .long 1078293732 + .long 3412027605 + .long 3191381190 + .long 2176843776 + .long 1078301569 + .long 183216755 + .long 3188772215 + .long 2877292544 + .long 1078309345 + .long 3207515339 + .long 3189828782 + .long 1778384896 + .long 1078317061 + .long 847503884 + .long 3191075565 + .long 784334848 + .long 1078324717 + .long 2952309205 + .long 1043794080 + .long 1809842176 + .long 1078332313 + .long 467544888 + .long 1042040199 + .long 2472542208 + .long 1078339850 + .long 3311174937 + .long 1039371295 + .long 396361728 + .long 1078347329 + .long 676857836 + .long 3191368341 + .long 1795162112 + .long 1078354749 + .long 2052116880 + .long 3191818486 + .long 0 + .long 1078362112 + .long 0 + .long 0 + .long 2499805184 + .long 1078369474 + .long 2052116880 + .long 1044334838 + .long 3898605568 + .long 1078376894 + .long 676857836 + .long 1043884693 + .long 1822425088 + .long 1078384373 + .long 3311174937 + .long 3186854943 + .long 2485125120 + .long 1078391910 + .long 467544888 + .long 3189523847 + .long 3510632448 + .long 1078399506 + .long 2952309205 + .long 3191277728 + .long 2516582400 + .long 1078407162 + .long 847503884 + .long 1043591917 + .long 1417674752 + .long 1078414878 + .long 3207515339 + .long 1042345134 + .long 2118123520 + .long 1078422654 + .long 183216755 + .long 1041288567 + .long 2222981120 + .long 1078430491 + .long 3412027605 + .long 1043897542 + .long 3628072960 + .long 1078438389 + .long 1431034507 + .long 1043145305 + .long 3923771392 + .long 1078446349 + .long 2039162957 + .long 1042419462 + .long 694157312 + .long 1078454372 + .long 3018208080 + .long 3191424848 + .long 100663296 + .long 1078462457 + .long 1071139240 + .long 3191684701 + .long 4001366016 + .long 1078470604 + .long 3229203938 + .long 3190263007 + .long 1358954496 + .long 1078478816 + .long 928991542 + .long 3191031829 + .long 2594177024 + .long 1078487091 + .long 2531804346 + .long 1043711504 + .long 939524096 + .long 1078495431 + .long 1225643377 + .long 1042968907 + .long 2493513728 + .long 1078503835 + .long 2102624066 + .long 3191837476 + .long 450887680 + .long 1078512305 + .long 4004776912 + .long 3191445996 + .long 876609536 + .long 1078520840 + .long 442938097 + .long 1043908739 + .long 1231028224 + .long 1078529441 + .long 2894826982 + .long 3191099953 + .long 3240099840 + .long 1078538108 + .long 1735520057 + .long 3191582534 + .long 23068672 + .long 1078546843 + .long 2864918449 + .long 3190911616 + .long 1855979520 + .long 1078555644 + .long 1352848207 + .long 3190658785 + .long 1809842176 + .long 1078564513 + .long 172509481 + .long 3191788061 + .long 1516240896 + .long 1078573450 + .long 2948057503 + .long 1043557228 + .long 2585788416 + .long 1078582455 + .long 643854101 + .long 1043026721 + .long 2298478592 + .long 1078591529 + .long 3139143286 + .long 1043725567 + .long 2202009600 + .long 1078600672 + .long 653388941 + .long 1039326298 + .long 3808428032 + .long 1078609884 + .long 2289432889 + .long 3183482656 + .long 8388608 + .long 1078619167 + .long 3385731218 + .long 3191174708 + .long 832569344 + .long 1078628519 + .long 1067893357 + .long 1042839311 + .long 3395289088 + .long 1078637941 + .long 700553623 + .long 3191065071 + .long 467664896 + .long 1078647435 + .long 4142119676 + .long 1043748800 + .long 1969225728 + .long 1078656999 + .long 4255018693 + .long 3191709792 + .long 585105408 + .long 1078666635 + .long 1674862667 + .long 3189231799 + .long 1847590912 + .long 1078676342 + .long 3100705142 + .long 1044256693 + .long 2652897280 + .long 1078686121 + .long 3240138768 + .long 3191202091 + .long 4133486592 + .long 1078695972 + .long 3632513556 + .long 1043819220 + .long 3087007744 + .long 1078705896 + .long 2148760563 + .long 3186937031 + .long 543162368 + .long 1078715893 + .long 2856171667 + .long 1043912306 + .long 1778384896 + .long 1078725962 + .long 2925970384 + .long 3187059424 + .long 3416260608 + .long 1078736104 + .long 1476207680 + .long 3191383682 + .long 2021654528 + .long 1078746320 + .long 4155795398 + .long 3191401960 + .long 2688548864 + .long 1078756609 + .long 1692530062 + .long 3191131794 + .long 1855979520 + .long 1078766972 + .long 3465285131 + .long 3189919618 + .long 190840832 + .long 1078777409 + .long 2278278095 + .long 1044265941 + .long 2589982720 + .long 1078787919 + .long 2364400925 + .long 1039488855 + .long 987758592 + .long 1078798504 + .long 1559006781 + .long 1041738262 + .long 134217728 + .long 1078809163 + .long 1232510221 + .long 1043398165 + .long 408944640 + .long 1078819896 + .long 797568562 + .long 3184567591 + .long 2109734912 + .long 1078830703 + .long 1936866404 + .long 1044380280 + .long 1166016512 + .long 1078841585 + .long 2811467203 + .long 3191322578 + .long 2004877312 + .long 1078852541 + .long 2787570751 + .long 3190829595 + .long 385875968 + .long 1078863572 + .long 3023722014 + .long 3191478212 + .long 566231040 + .long 1078874677 + .long 3525309094 + .long 1042505183 + .long 2424307712 + .long 1078885856 + .long 1063445218 + .long 3191768956 + .long 1442840576 + .long 1078897110 + .long 1577179566 + .long 3190494396 + .long 1606418432 + .long 1078908438 + .long 152088799 + .long 3189637679 + .long 2503999488 + .long 1078919840 + .long 1405657776 + .long 1044264267 + .long 3630170112 + .long 1078931316 + .long 2622169537 + .long 3190092209 + .long 75497472 + .long 1078942867 + .long 3035382168 + .long 3190712380 + .long 4009754624 + .long 1078954490 + .long 3752802150 + .long 1044153052 + .long 1730150400 + .long 1078966188 + .long 806768485 + .long 1043980860 + .long 895483904 + .long 1078977959 + .long 2588206371 + .long 1044009924 + .long 2380267520 + .long 1078987253 + .long 1393635940 + .long 1044120466 + .long 3938451456 + .long 1078993211 + .long 1171997210 + .long 1044632170 + .long 2342518784 + .long 1078999206 + .long 2612691399 + .long 3192403747 + .long 1191182336 + .long 1079005237 + .long 2099274145 + .long 3190761166 + .long 4028628992 + .long 1079011303 + .long 3828434628 + .long 1045017771 + .long 1455423488 + .long 1079017406 + .long 1622551107 + .long 3192310957 + .long 1182793728 + .long 1079023544 + .long 2124167878 + .long 3191930936 + .long 2275409920 + .long 1079029717 + .long 41710967 + .long 1041693117 + .long 3735027712 + .long 1079035925 + .long 514060819 + .long 3191694645 + .long 201326592 + .long 1079042169 + .long 1430947390 + .long 3192785388 + .long 3428843520 + .long 1079048446 + .long 2518581518 + .long 3186637987 + .long 3636461568 + .long 1079054758 + .long 1552096852 + .long 3192868489 + .long 3854565376 + .long 1079061104 + .long 1865077452 + .long 3191449780 + .long 2757754880 + .long 1079067484 + .long 2620146859 + .long 3192418374 + .long 3242196992 + .long 1079073897 + .long 1679886032 + .long 1045390684 + .long 3848273920 + .long 1079080343 + .long 1008852996 + .long 1045213180 + .long 3042967552 + .long 1079086822 + .long 1190325550 + .long 3191428594 + .long 3516923904 + .long 1079093333 + .long 2901961231 + .long 3189559456 + .long 3600809984 + .long 1079099876 + .long 843293277 + .long 1043776619 + .long 1556086784 + .long 1079106451 + .long 2705956472 + .long 3192552031 + .long 4158652416 + .long 1079113056 + .long 2007583995 + .long 3189975458 + .long 941621248 + .long 1079119693 + .long 1619354403 + .long 3192676122 + .long 2835349504 + .long 1079126359 + .long 4136034317 + .long 1045078976 + .long 3529506816 + .long 1079133055 + .long 290418758 + .long 1040193863 + .long 929038336 + .long 1079139781 + .long 3915023624 + .long 1045366041 + .long 1468006400 + .long 1079146535 + .long 1061629098 + .long 3192285591 + .long 2910846976 + .long 1079153317 + .long 1308671630 + .long 1043573567 + .long 2963275776 + .long 1079160127 + .long 1320907030 + .long 3192436805 + .long 3548381184 + .long 1079166964 + .long 182222777 + .long 3191258117 + .long 2231369728 + .long 1079173828 + .long 3513262155 + .long 3187154074 + .long 803209216 + .long 1079180718 + .long 1139819401 + .long 1040482120 + .long 987758592 + .long 1079187633 + .long 929259512 + .long 3191000897 + .long 146800640 + .long 1079194573 + .long 3229154456 + .long 3191288344 + .long 4167041024 + .long 1079201536 + .long 2552585681 + .long 1042131590 + .long 1692401664 + .long 1079208524 + .long 1439536878 + .long 3188143242 + .long 2776629248 + .long 1079215534 + .long 353720209 + .long 3191860659 + .long 230686720 + .long 1079222567 + .long 2411046197 + .long 3190921481 + .long 3986685952 + .long 1079229620 + .long 3756699850 + .long 3192084150 + .long 2438987776 + .long 1079236695 + .long 1671725142 + .long 1043734190 + .long 1107296256 + .long 1079243790 + .long 1240754629 + .long 1045055957 + .long 1157627904 + .long 1079250904 + .long 1534601222 + .long 1045263230 + .long 3701473280 + .long 1079258036 + .long 3448918206 + .long 1042044860 + .long 1203765248 + .long 1079265187 + .long 3924779397 + .long 1045089235 + .long 3263168512 + .long 1079272354 + .long 3287244582 + .long 1042979553 + .long 2243952640 + .long 1079279538 + .long 820395291 + .long 3190740781 + .long 3349151744 + .long 1079286737 + .long 1366866651 + .long 3192280071 + .long 3143630848 + .long 1079293951 + .long 2762624284 + .long 1045102639 + .long 2449473536 + .long 1079301179 + .long 1845586757 + .long 1044548329 + .long 2040528896 + .long 1079308420 + .long 3762298090 + .long 1045345703 + .long 2654994432 + .long 1079315673 + .long 3683913357 + .long 1045057884 + .long 698351616 + .long 1079322938 + .long 2953393071 + .long 3191482668 + .long 1128267776 + .long 1079330213 + .long 1034464320 + .long 3191720696 + .long 283115520 + .long 1079337498 + .long 1039826403 + .long 1041577546 + .long 3061841920 + .long 1079344791 + .long 19850279 + .long 1042922258 + .long 1449132032 + .long 1079352093 + .long 294154384 + .long 1045031347 + .long 293601280 + .long 1079359402 + .long 1192966610 + .long 3192379901 + .long 119537664 + .long 1079366717 + .long 152130161 + .long 3190257939 + .long 1438646272 + .long 1079374037 + .long 3963433176 + .long 1043378887 + .long 448790528 + .long 1079381362 + .long 2261136335 + .long 1044042197 + .long 1923088384 + .long 1079388690 + .long 3535382687 + .long 1045010726 + .long 2036334592 + .long 1079396021 + .long 3576784639 + .long 3192441914 + .long 1243611136 + .long 1079403354 + .long 3804918049 + .long 3191900478 + .long 0 + .long 1079410688 + .long 0 + .long 0 + .long 3051356160 + .long 1079418021 + .long 3804918049 + .long 1044416830 + .long 2258632704 + .long 1079425354 + .long 3576784639 + .long 1044958266 + .long 2371878912 + .long 1079432685 + .long 3535382687 + .long 3192494374 + .long 3846176768 + .long 1079440013 + .long 2261136335 + .long 3191525845 + .long 2856321024 + .long 1079447338 + .long 3963433176 + .long 3190862535 + .long 4175429632 + .long 1079454658 + .long 152130161 + .long 1042774291 + .long 4001366016 + .long 1079461973 + .long 1192966610 + .long 1044896253 + .long 2845835264 + .long 1079469282 + .long 294154384 + .long 3192514995 + .long 1233125376 + .long 1079476584 + .long 19850279 + .long 3190405906 + .long 4011851776 + .long 1079483877 + .long 1039826403 + .long 3189061194 + .long 3166699520 + .long 1079491162 + .long 1034464320 + .long 1044237048 + .long 3596615680 + .long 1079498437 + .long 2953393071 + .long 1043999020 + .long 1639972864 + .long 1079505702 + .long 3683913357 + .long 3192541532 + .long 2254438400 + .long 1079512955 + .long 3762298090 + .long 3192829351 + .long 1845493760 + .long 1079520196 + .long 1845586757 + .long 3192031977 + .long 1151336448 + .long 1079527424 + .long 2762624284 + .long 3192586287 + .long 945815552 + .long 1079534638 + .long 1366866651 + .long 1044796423 + .long 2051014656 + .long 1079541837 + .long 820395291 + .long 1043257133 + .long 1031798784 + .long 1079549021 + .long 3287244582 + .long 3190463201 + .long 3091202048 + .long 1079556188 + .long 3924779397 + .long 3192572883 + .long 593494016 + .long 1079563339 + .long 3448918206 + .long 3189528508 + .long 3137339392 + .long 1079570471 + .long 1534601222 + .long 3192746878 + .long 3187671040 + .long 1079577585 + .long 1240754629 + .long 3192539605 + .long 1855979520 + .long 1079584680 + .long 1671725142 + .long 3191217838 + .long 308281344 + .long 1079591755 + .long 3756699850 + .long 1044600502 + .long 4064280576 + .long 1079598808 + .long 2411046197 + .long 1043437833 + .long 1518338048 + .long 1079605841 + .long 353720209 + .long 1044377011 + .long 2602565632 + .long 1079612851 + .long 1439536878 + .long 1040659594 + .long 127926272 + .long 1079619839 + .long 2552585681 + .long 3189615238 + .long 4148166656 + .long 1079626802 + .long 3229154456 + .long 1043804696 + .long 3307208704 + .long 1079633742 + .long 929259512 + .long 1043517249 + .long 3491758080 + .long 1079640657 + .long 1139819401 + .long 3187965768 + .long 2063597568 + .long 1079647547 + .long 3513262155 + .long 1039670426 + .long 746586112 + .long 1079654411 + .long 182222777 + .long 1043774469 + .long 1331691520 + .long 1079661248 + .long 1320907030 + .long 1044953157 + .long 1384120320 + .long 1079668058 + .long 1308671630 + .long 3191057215 + .long 2826960896 + .long 1079674840 + .long 1061629098 + .long 1044801943 + .long 3365928960 + .long 1079681594 + .long 3915023624 + .long 3192849689 + .long 765460480 + .long 1079688320 + .long 290418758 + .long 3187677511 + .long 1459617792 + .long 1079695016 + .long 4136034317 + .long 3192562624 + .long 3353346048 + .long 1079701682 + .long 1619354403 + .long 1045192474 + .long 136314880 + .long 1079708319 + .long 2007583995 + .long 1042491810 + .long 2738880512 + .long 1079714924 + .long 2705956472 + .long 1045068383 + .long 694157312 + .long 1079721499 + .long 843293277 + .long 3191260267 + .long 778043392 + .long 1079728042 + .long 2901961231 + .long 1042075808 + .long 1251999744 + .long 1079734553 + .long 1190325550 + .long 1043944946 + .long 446693376 + .long 1079741032 + .long 1008852996 + .long 3192696828 + .long 1052770304 + .long 1079747478 + .long 1679886032 + .long 3192874332 + .long 1537212416 + .long 1079753891 + .long 2620146859 + .long 1044934726 + .long 440401920 + .long 1079760271 + .long 1865077452 + .long 1043966132 + .long 658505728 + .long 1079766617 + .long 1552096852 + .long 1045384841 + .long 866123776 + .long 1079772929 + .long 2518581518 + .long 1039154339 + .long 4093640704 + .long 1079779206 + .long 1430947390 + .long 1045301740 + .long 559939584 + .long 1079785450 + .long 514060819 + .long 1044210997 + .long 2019557376 + .long 1079791658 + .long 41710967 + .long 3189176765 + .long 3112173568 + .long 1079797831 + .long 2124167878 + .long 1044447288 + .long 2839543808 + .long 1079803969 + .long 1622551107 + .long 1044827309 + .long 266338304 + .long 1079810072 + .long 3828434628 + .long 3192501419 + .long 3103784960 + .long 1079816138 + .long 2099274145 + .long 1043277518 + .long 1952448512 + .long 1079822169 + .long 2612691399 + .long 1044920099 + .long 356515840 + .long 1079828164 + .long 1171997210 + .long 3192115818 + .long 1914699776 + .long 1079834122 + .long 1393635940 + .long 3191604114 + .long 1698693120 + .long 1079840044 + .long 3000864111 + .long 1044567581 + .long 3428843520 + .long 1079845929 + .long 3891583054 + .long 1044582113 + .long 2290089984 + .long 1079851778 + .long 3752802150 + .long 3191636700 + .long 2109734912 + .long 1079857590 + .long 3035382168 + .long 1043228732 + .long 2480930816 + .long 1079863365 + .long 2565683088 + .long 3192570771 + .long 3042967552 + .long 1079869103 + .long 1405657776 + .long 3191747915 + .long 3491758080 + .long 1079874804 + .long 152088799 + .long 1042154031 + .long 3573547008 + .long 1079880468 + .long 1577179566 + .long 1043010748 + .long 3082813440 + .long 1079886095 + .long 1063445218 + .long 1044285308 + .long 1864368128 + .long 1079891685 + .long 3525309094 + .long 3189988831 + .long 4102029312 + .long 1079897237 + .long 3023722014 + .long 1043994564 + .long 1145044992 + .long 1079902753 + .long 2787570751 + .long 1043345947 + .long 1564475392 + .long 1079908231 + .long 2811467203 + .long 1043838930 + .long 1092616192 + .long 1079913672 + .long 1936866404 + .long 3191863928 + .long 4091543552 + .long 1079919075 + .long 2980113444 + .long 3192905397 + .long 2080374784 + .long 1079924442 + .long 1232510221 + .long 3190881813 + .long 3800039424 + .long 1079929771 + .long 878865976 + .long 1045236413 + .long 851443712 + .long 1079935064 + .long 1134072023 + .long 1045386565 + .long 2051014656 + .long 1079940319 + .long 1008344600 + .long 1044439573 + .long 3368026112 + .long 1079945537 + .long 1281162365 + .long 3192613919 + .long 803209216 + .long 1079950719 + .long 1692530062 + .long 1043648146 + .long 3284140032 + .long 1079955863 + .long 4155795398 + .long 1043918312 + .long 2587885568 + .long 1079960971 + .long 3556863456 + .long 3192106174 + .long 3405774848 + .long 1079966042 + .long 2925970384 + .long 1039575776 + .long 1874853888 + .long 1079971077 + .long 2866881462 + .long 1044616390 + .long 2751463424 + .long 1079976075 + .long 2148760563 + .long 1039453383 + .long 2227175424 + .long 1079981037 + .long 2478710518 + .long 1044662933 + .long 822083584 + .long 1079985963 + .long 527414264 + .long 3192196970 + .long 3370123264 + .long 1079990852 + .long 597131077 + .long 1044444197 + .long 1855979520 + .long 1079995706 + .long 327513079 + .long 3192718825 + .long 1163919360 + .long 1080000524 + .long 2167457950 + .long 3191943119 + .long 1912602624 + .long 1080005306 + .long 2223907458 + .long 1044698143 + .long 450887680 + .long 1080010053 + .long 1797206836 + .long 3192265480 + .long 1730150400 + .long 1080014764 + .long 806768485 + .long 1045029436 + .long 2143289344 + .long 1080019440 + .long 3385731218 + .long 1043691060 + .long 2390753280 + .long 1080024081 + .long 2289432889 + .long 1035999008 + .long 3193962496 + .long 1080028687 + .long 653388941 + .long 3186809946 + .long 998244352 + .long 1080033259 + .long 3139143286 + .long 3191209215 + .long 427819008 + .long 1080035538 + .long 617352675 + .long 3193137764 + .long 1767899136 + .long 1080037789 + .long 2820938545 + .long 1044793929 + .long 2768240640 + .long 1080040023 + .long 1116869194 + .long 1045935239 + .long 3831496704 + .long 1080042240 + .long 2883013420 + .long 3192429127 + .long 1067450368 + .long 1080044441 + .long 716229612 + .long 1045716128 + .long 3485466624 + .long 1080046624 + .long 3427207267 + .long 3192006748 + .long 2912944128 + .long 1080048791 + .long 1797448570 + .long 1045763212 + .long 4074766336 + .long 1080050941 + .long 963007300 + .long 1046072799 + .long 3107979264 + .long 1080053075 + .long 1001194228 + .long 1045849723 + .long 450887680 + .long 1080055193 + .long 3243655263 + .long 3191879277 + .long 838860800 + .long 1080057294 + .long 1225643377 + .long 3190452555 + .long 425721856 + .long 1080059379 + .long 632951086 + .long 3193270660 + .long 3955228672 + .long 1080061447 + .long 928991542 + .long 1043548181 + .long 3294625792 + .long 1080063500 + .long 3229203938 + .long 1042779359 + .long 3196059648 + .long 1080065537 + .long 1071139240 + .long 1044201053 + .long 4120903680 + .long 1080067558 + .long 754552020 + .long 1045844436 + .long 2239758336 + .long 1080069564 + .long 1637692909 + .long 1045134398 + .long 2313158656 + .long 1080071554 + .long 3579217071 + .long 1046240180 + .long 517996544 + .long 1080073529 + .long 3412027605 + .long 3191381190 + .long 1616904192 + .long 1080075488 + .long 2404468057 + .long 1046410024 + .long 1793064960 + .long 1080077432 + .long 3207515339 + .long 3189828782 + .long 1518338048 + .long 1080079361 + .long 847503884 + .long 3191075565 + .long 1270874112 + .long 1080081275 + .long 3556889995 + .long 3193585111 + .long 1526726656 + .long 1080083174 + .long 478427801 + .long 3192682319 + .long 2766143488 + .long 1080085058 + .long 30743511 + .long 3192873887 + .long 1172307968 + .long 1080086928 + .long 1809054730 + .long 1044630197 + .long 1522532352 + .long 1080088783 + .long 2052116880 + .long 3191818486 + .long 0 + .long 1080090624 + .long 0 + .long 0 + .long 2772434944 + .long 1080092464 + .long 2052116880 + .long 1044334838 + .long 3122659328 + .long 1080094319 + .long 1809054730 + .long 3192113845 + .long 1528823808 + .long 1080096189 + .long 30743511 + .long 1045390239 + .long 2768240640 + .long 1080098073 + .long 478427801 + .long 1045198671 + .long 3024093184 + .long 1080099972 + .long 3556889995 + .long 1046101463 + .long 2776629248 + .long 1080101886 + .long 847503884 + .long 1043591917 + .long 2501902336 + .long 1080103815 + .long 3207515339 + .long 1042345134 + .long 2678063104 + .long 1080105759 + .long 2404468057 + .long 3193893672 + .long 3776970752 + .long 1080107718 + .long 3412027605 + .long 1043897542 + .long 1981808640 + .long 1080109693 + .long 3579217071 + .long 3193723828 + .long 2055208960 + .long 1080111683 + .long 1637692909 + .long 3192618046 + .long 174063616 + .long 1080113689 + .long 754552020 + .long 3193328084 + .long 1098907648 + .long 1080115710 + .long 1071139240 + .long 3191684701 + .long 1000341504 + .long 1080117747 + .long 3229203938 + .long 3190263007 + .long 339738624 + .long 1080119800 + .long 928991542 + .long 3191031829 + .long 3869245440 + .long 1080121868 + .long 632951086 + .long 1045787012 + .long 3456106496 + .long 1080123953 + .long 1225643377 + .long 1042968907 + .long 3844079616 + .long 1080126054 + .long 3243655263 + .long 1044395629 + .long 1186988032 + .long 1080128172 + .long 1001194228 + .long 3193333371 + .long 220200960 + .long 1080130306 + .long 963007300 + .long 3193556447 + .long 1382023168 + .long 1080132456 + .long 1797448570 + .long 3193246860 + .long 809500672 + .long 1080134623 + .long 3427207267 + .long 1044523100 + .long 3227516928 + .long 1080136806 + .long 716229612 + .long 3193199776 + .long 463470592 + .long 1080139007 + .long 2883013420 + .long 1044945479 + .long 1526726656 + .long 1080141224 + .long 1116869194 + .long 3193418887 + .long 2527068160 + .long 1080143458 + .long 2820938545 + .long 3192277577 + .long 3867148288 + .long 1080145709 + .long 617352675 + .long 1045654116 + .long 1648361472 + .long 1080147978 + .long 3139143286 + .long 1043725567 + .long 551550976 + .long 1080150264 + .long 2539927630 + .long 3193943182 + .long 952107008 + .long 1080152567 + .long 2289432889 + .long 3183482656 + .long 3223322624 + .long 1080154887 + .long 3385731218 + .long 3191174708 + .long 3428843520 + .long 1080157225 + .long 3891583054 + .long 1045630689 + .long 1923088384 + .long 1080159581 + .long 3396363878 + .long 3193238139 + .long 3338665984 + .long 1080161954 + .long 2223907458 + .long 3192181791 + .long 3714056192 + .long 1080164345 + .long 1063754673 + .long 3193399320 + .long 3368026112 + .long 1080166754 + .long 1983727109 + .long 3193011467 + .long 2608857088 + .long 1080169181 + .long 1848918109 + .long 1045923309 + .long 1736441856 + .long 1080171626 + .long 527414264 + .long 1044713322 + .long 1033895936 + .long 1080174089 + .long 2478710518 + .long 3192146581 + .long 771751936 + .long 1080176570 + .long 2148760563 + .long 3186937031 + .long 1210056704 + .long 1080179069 + .long 2866881462 + .long 3192100038 + .long 2592079872 + .long 1080181586 + .long 2925970384 + .long 3187059424 + .long 853540864 + .long 1080184122 + .long 3556863456 + .long 1044622526 + .long 505413632 + .long 1080186676 + .long 4155795398 + .long 3191401960 + .long 1744830464 + .long 1080189248 + .long 1724351133 + .long 1046137947 + .long 463470592 + .long 1080191839 + .long 1281162365 + .long 1045130271 + .long 1121976320 + .long 1080194448 + .long 1008344600 + .long 3191923221 + .long 3869245440 + .long 1080197075 + .long 1134072023 + .long 3192870213 + .long 247463936 + .long 1080199722 + .long 878865976 + .long 3192720061 + .long 3254779904 + .long 1080202386 + .long 1232510221 + .long 1043398165 + .long 102760448 + .long 1080205070 + .long 657426926 + .long 3192918181 + .long 3749707776 + .long 1080207771 + .long 3810750695 + .long 3193438561 + .long 1365245952 + .long 1080210492 + .long 2811467203 + .long 3191322578 + .long 1574961152 + .long 1080213231 + .long 2787570751 + .long 3190829595 + .long 96468992 + .long 1080215989 + .long 3023722014 + .long 3191478212 + .long 1216348160 + .long 1080218765 + .long 96207275 + .long 3193803844 + .long 606076928 + .long 1080221560 + .long 1063445218 + .long 3191768956 + .long 2508193792 + .long 1080224373 + .long 1577179566 + .long 3190494396 + .long 2548039680 + .long 1080227205 + .long 258929906 + .long 1046355933 + .long 627048448 + .long 1080230056 + .long 722327380 + .long 3193467565 + .long 908066816 + .long 1080232925 + .long 864642104 + .long 3193085494 + .long 3240099840 + .long 1080235812 + .long 3035382168 + .long 3190712380 + .long 3149922304 + .long 1080238718 + .long 3752802150 + .long 1044153052 + .long 432013312 + .long 1080241643 + .long 201692121 + .long 1045854351 + .long 3445620736 + .long 1080244585 + .long 3000864111 + .long 3192051229 + .long 3338665984 + .long 1080247546 + .long 1799074663 + .long 3193503515 + .long 4116709376 + .long 1080250525 + .long 1171997210 + .long 1044632170 + .long 1170210816 + .long 1080253523 + .long 841137948 + .long 1045685358 + .long 2743074816 + .long 1080256538 + .long 2099274145 + .long 3190761166 + .long 4162846720 + .long 1080259571 + .long 233266334 + .long 3193120170 + .long 727711744 + .long 1080262623 + .long 1622551107 + .long 3192310957 + .long 591396864 + .long 1080265692 + .long 2124167878 + .long 3191930936 + .long 3286237184 + .long 1080268778 + .long 802699433 + .long 3193868388 + .long 4013948928 + .long 1080271882 + .long 3092710267 + .long 1045997234 + .long 2248146944 + .long 1080275004 + .long 1430947390 + .long 3192785388 + .long 1713373184 + .long 1080278143 + .long 1906804220 + .long 1046462221 + .long 1818230784 + .long 1080281299 + .long 1552096852 + .long 3192868489 + .long 1927282688 + .long 1080284472 + .long 1865077452 + .long 3191449780 + .long 1377828864 + .long 1080287662 + .long 2984893867 + .long 1045678044 + .long 3768582144 + .long 1080290868 + .long 1679886032 + .long 1045390684 + .long 4072669184 + .long 1080294091 + .long 3790540798 + .long 3193022465 + .long 1520435200 + .long 1080297331 + .long 1849902261 + .long 1046063747 + .long 3904897024 + .long 1080300586 + .long 4113594719 + .long 1046360821 + .long 1801453568 + .long 1080303858 + .long 862918505 + .long 3193589477 + .long 2925527040 + .long 1080307145 + .long 2705956472 + .long 3192552031 + .long 2078277632 + .long 1080310448 + .long 2970277473 + .long 1046321867 + .long 2617245696 + .long 1080313766 + .long 3485290095 + .long 1045549170 + .long 3565158400 + .long 1080317099 + .long 4136034317 + .long 1045078976 + .long 3913285632 + .long 1080320447 + .long 3346367614 + .long 3193929525 + .long 2613051392 + .long 1080323810 + .long 189971836 + .long 3192946035 + .long 2881486848 + .long 1080327187 + .long 1061629098 + .long 3192285591 + .long 3602907136 + .long 1080330578 + .long 1308671630 + .long 1043573567 + .long 3628072960 + .long 1080333983 + .long 1487030133 + .long 1045668829 + .long 1774190592 + .long 1080337402 + .long 182222777 + .long 3191258117 + .long 1115684864 + .long 1080340834 + .long 3513262155 + .long 3187154074 + .long 402653184 + .long 1080344279 + .long 3185606116 + .long 3193920517 + .long 2640314368 + .long 1080347736 + .long 2988910594 + .long 1046170671 + .long 2220883968 + .long 1080351206 + .long 3229154456 + .long 3191288344 + .long 2084569088 + .long 1080354688 + .long 2524817955 + .long 3193840983 + .long 845152256 + .long 1080358182 + .long 2907804489 + .long 1046431323 + .long 1388314624 + .long 1080361687 + .long 353720209 + .long 3191860659 + .long 2262827008 + .long 1080365203 + .long 2411046197 + .long 3190921481 + .long 1992294400 + .long 1080368730 + .long 2416617371 + .long 1045845156 + .long 3368026112 + .long 1080372267 + .long 1729552362 + .long 3193600084 + .long 553648128 + .long 1080375815 + .long 1240754629 + .long 1045055957 + .long 578813952 + .long 1080379372 + .long 1534601222 + .long 1045263230 + .long 1851785216 + .long 1080382938 + .long 858184436 + .long 3193846404 + .long 2749366272 + .long 1080386513 + .long 3924779397 + .long 1045089235 + .long 1631584256 + .long 1080390097 + .long 3287244582 + .long 1042979553 + .long 1121976320 + .long 1080393689 + .long 820395291 + .long 3190740781 + .long 3821010944 + .long 1080397288 + .long 1464050323 + .long 1045747196 + .long 3720347648 + .long 1080400895 + .long 766171506 + .long 3193077736 + .long 3372220416 + .long 1080404509 + .long 1845586757 + .long 1044548329 + .long 1021313024 + .long 1080408130 + .long 266334603 + .long 3192956204 + .long 3474980864 + .long 1080411756 + .long 3683913357 + .long 1045057884 + .long 348127232 + .long 1080415389 + .long 3556619028 + .long 1046050228 + .long 2711617536 + .long 1080419026 + .long 1034464320 + .long 3191720696 + .long 142606336 + .long 1080422669 + .long 1545623586 + .long 3193875611 + .long 3678404608 + .long 1080426315 + .long 19850279 + .long 1042922258 + .long 2873098240 + .long 1080429966 + .long 2000406456 + .long 3193113382 + .long 146800640 + .long 1080433621 + .long 1192966610 + .long 3192379901 + .long 2206203904 + .long 1080437278 + .long 2665338290 + .long 1046286557 + .long 2866806784 + .long 1080440938 + .long 3963433176 + .long 1043378887 + .long 224395264 + .long 1080444601 + .long 2261136335 + .long 1044042197 + .long 962592768 + .long 1080448265 + .long 2527275953 + .long 3193123692 + .long 3164602368 + .long 1080451930 + .long 2506574977 + .long 1045666274 + .long 620756992 + .long 1080455597 + .long 2392508272 + .long 1045936992 + .long 0 + .long 1080459264 + .long 0 + .long 0 + .type __libm_atandl_table_128,@object + .size __libm_atandl_table_128,8208 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atanf_wmt.S b/external/sgx_libm/ia32/atanf_wmt.S new file mode 100644 index 0000000000..02e10ea064 --- /dev/null +++ b/external/sgx_libm/ia32/atanf_wmt.S @@ -0,0 +1,596 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin atanf + .text + .align 16,0x90 + .globl atanf +atanf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl $-524288, %eax + movd %eax, %xmm3 + movss 1376(%ebx), %xmm5 + movl $262144, %ecx + movd %ecx, %xmm4 + movl 112(%esp), %edx + andps %xmm0, %xmm3 + movss %xmm0, %xmm1 + orps %xmm4, %xmm3 + movl %edx, %eax + andl $2146959360, %edx + subl $1023410176, %edx + cmpl $83361792, %edx + ja .L_2TAG_PACKET_0.0.2 + mulss %xmm3, %xmm1 + subss %xmm3, %xmm0 + addss %xmm5, %xmm1 + divss %xmm1, %xmm0 + shrl $16, %edx + addl $8, %edx + movl $-1096111855, %ecx + movd %ecx, %xmm4 + movss (%ebx,%edx), %xmm2 + movss 4(%ebx,%edx), %xmm3 + andl $-2147483648, %eax + movd %eax, %xmm5 + xorps %xmm5, %xmm2 + xorps %xmm5, %xmm3 + movss %xmm2, %xmm5 + movss %xmm0, %xmm1 + mulss %xmm0, %xmm0 + mulss %xmm1, %xmm4 + addss %xmm1, %xmm2 + subss %xmm2, %xmm5 + mulss %xmm4, %xmm0 + addss %xmm5, %xmm1 + addss %xmm3, %xmm0 + addss %xmm1, %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + addl $75497472, %edx + cmpl $158859264, %edx + ja .L_2TAG_PACKET_2.0.2 + movss 1360(%ebx), %xmm2 + movss 1364(%ebx), %xmm4 + mulss %xmm1, %xmm1 + mulss %xmm0, %xmm4 + mulss %xmm0, %xmm2 + movss %xmm1, %xmm5 + mulss %xmm1, %xmm1 + mulss %xmm5, %xmm4 + mulss %xmm2, %xmm1 + addss %xmm4, %xmm1 + addss %xmm1, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + addl $947912704, %edx + cmpl $1106771968, %edx + jae .L_2TAG_PACKET_3.0.2 + movl $1065353217, %eax + movd %xmm0, %ecx + cmpl $8388608, %edx + cmovb %ecx, %eax + movd %eax, %xmm1 + mulss %xmm1, %xmm1 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_3.0.2: + cmpl $1602224128, %edx + jae .L_2TAG_PACKET_4.0.2 + movl $-1082130432, %ecx + movd %ecx, %xmm1 + divss %xmm0, %xmm1 + cmpl $1182793728, %edx + jae .L_2TAG_PACKET_5.0.2 + movl $-1096111855, %ecx + movd %ecx, %xmm4 + movss 1344(%ebx), %xmm2 + movss 1348(%ebx), %xmm3 + andl $-2147483648, %eax + movd %eax, %xmm5 + xorps %xmm5, %xmm2 + xorps %xmm5, %xmm3 + movss %xmm2, %xmm5 + movss %xmm1, %xmm0 + mulss %xmm1, %xmm1 + mulss %xmm0, %xmm4 + addss %xmm0, %xmm2 + subss %xmm2, %xmm5 + mulss %xmm4, %xmm1 + addss %xmm5, %xmm0 + addss %xmm3, %xmm1 + addss %xmm1, %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_5.0.2: + movss 1344(%ebx), %xmm0 + movss 1348(%ebx), %xmm3 + andl $-2147483648, %eax + movd %eax, %xmm5 + xorps %xmm5, %xmm0 + xorps %xmm5, %xmm3 + movss %xmm0, %xmm5 + addss %xmm1, %xmm0 + subss %xmm0, %xmm5 + addss %xmm5, %xmm1 + addss %xmm1, %xmm3 + addss %xmm3, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + movss 1344(%ebx), %xmm2 + movss 1348(%ebx), %xmm3 + cmpl $2139029504, %edx + ja .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_7.0.2: + andl $-2147483648, %eax + movd %eax, %xmm0 + orps %xmm0, %xmm2 + orps %xmm3, %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_6.0.2: + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + je .L_2TAG_PACKET_7.0.2 + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_1.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type atanf,@function + .size atanf,.-atanf + .data +# -- End atanf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 1023669327 + .long 803928991 + .long 1024193038 + .long 2966692170 + .long 1024716678 + .long 811692700 + .long 1025240245 + .long 792964392 + .long 1025763734 + .long 802148141 + .long 1026287141 + .long 819324013 + .long 1026810463 + .long 790037051 + .long 1027333695 + .long 759154391 + .long 1027856833 + .long 817525057 + .long 1028379874 + .long 808527090 + .long 1028902813 + .long 821626264 + .long 1029425647 + .long 817580405 + .long 1029948372 + .long 2952445505 + .long 1030470983 + .long 801005003 + .long 1030993477 + .long 800387983 + .long 1031515850 + .long 2942256123 + .long 1032048979 + .long 2968250322 + .long 1032570964 + .long 822790803 + .long 1033092672 + .long 826289861 + .long 1033614088 + .long 2976224418 + .long 1034135194 + .long 824490938 + .long 1034655977 + .long 822527213 + .long 1035176421 + .long 784232806 + .long 1035696510 + .long 822531604 + .long 1036216230 + .long 2967672936 + .long 1036735564 + .long 826515440 + .long 1037254499 + .long 2944102134 + .long 1037773019 + .long 2977774463 + .long 1038291108 + .long 795957866 + .long 1038808753 + .long 2972700386 + .long 1039325938 + .long 2975253635 + .long 1039842648 + .long 807079588 + .long 1040402092 + .long 822355304 + .long 1040917290 + .long 805504040 + .long 1041431409 + .long 2978896586 + .long 1041944391 + .long 836680090 + .long 1042456182 + .long 826352980 + .long 1042966726 + .long 2973619487 + .long 1043475968 + .long 2937629464 + .long 1043983855 + .long 831159584 + .long 1044490335 + .long 820394738 + .long 1044995356 + .long 2965290852 + .long 1045498867 + .long 772017454 + .long 1046000819 + .long 2978687103 + .long 1046501162 + .long 836200518 + .long 1046999850 + .long 836883769 + .long 1047496836 + .long 826905524 + .long 1047992074 + .long 824423170 + .long 1048653779 + .long 2993658277 + .long 1049143506 + .long 2988293347 + .long 1049629355 + .long 838635411 + .long 1050111172 + .long 2981083232 + .long 1050588809 + .long 840069395 + .long 1051062131 + .long 2985487843 + .long 1051531009 + .long 2987007755 + .long 1051995325 + .long 2954909954 + .long 1052454971 + .long 2992105648 + .long 1052909846 + .long 2984512837 + .long 1053359860 + .long 2974535271 + .long 1053804931 + .long 834850816 + .long 1054244987 + .long 2990399399 + .long 1054679962 + .long 2986843574 + .long 1055109800 + .long 841668384 + .long 1055534454 + .long 840878179 + .long 1056161628 + .long 2959648204 + .long 1056972004 + .long 2999182783 + .long 1057370275 + .long 2987693957 + .long 1057757908 + .long 848029633 + .long 1058134927 + .long 833824667 + .long 1058501396 + .long 838916473 + .long 1058857417 + .long 2982869562 + .long 1059203123 + .long 2987447445 + .long 1059538675 + .long 2986943103 + .long 1059864257 + .long 2962018373 + .long 1060180073 + .long 3001690183 + .long 1060486341 + .long 3000978470 + .long 1060783292 + .long 855353569 + .long 1061071169 + .long 847903241 + .long 1061350219 + .long 2995336148 + .long 1061620693 + .long 848940038 + .long 1062010885 + .long 848518105 + .long 1062503512 + .long 2989792343 + .long 1062966414 + .long 2998000194 + .long 1063401558 + .long 2966602495 + .long 1063810833 + .long 841421013 + .long 1064196033 + .long 853285487 + .long 1064558850 + .long 831341538 + .long 1064900868 + .long 2999260393 + .long 1065223564 + .long 3001104089 + .long 1065440763 + .long 856880849 + .long 1065584798 + .long 852830020 + .long 1065721082 + .long 862757435 + .long 1065850159 + .long 2998927867 + .long 1065972528 + .long 2998512290 + .long 1066088651 + .long 2998663603 + .long 1066198953 + .long 2996780932 + .long 1066354340 + .long 3007554211 + .long 1066544552 + .long 2996943326 + .long 1066717600 + .long 3000009859 + .long 1066875577 + .long 856175525 + .long 1067020272 + .long 836800017 + .long 1067153216 + .long 3008748444 + .long 1067275724 + .long 851983949 + .long 1067388933 + .long 862585050 + .long 1067493827 + .long 3009301766 + .long 1067591258 + .long 2988483069 + .long 1067681973 + .long 3005223458 + .long 1067766623 + .long 839061141 + .long 1067845782 + .long 2995523700 + .long 1067919954 + .long 2995663457 + .long 1067989585 + .long 858133164 + .long 1068055072 + .long 829335339 + .long 1068146290 + .long 856294518 + .long 1068256389 + .long 3003850806 + .long 1068355146 + .long 856998103 + .long 1068444206 + .long 2999569255 + .long 1068524912 + .long 3011255227 + .long 1068598373 + .long 841513866 + .long 1068665514 + .long 841710807 + .long 1068727109 + .long 2949159239 + .long 1068783812 + .long 2995542644 + .long 1068836179 + .long 3007665083 + .long 1068884685 + .long 3006087365 + .long 1068929739 + .long 2996180184 + .long 1068971695 + .long 3006313179 + .long 1069010859 + .long 849476222 + .long 1069047500 + .long 860722755 + .long 1069081853 + .long 859062603 + .long 1069129538 + .long 2979745798 + .long 1069186846 + .long 842801502 + .long 1069238035 + .long 3010794384 + .long 1069284031 + .long 3010162926 + .long 1069325584 + .long 3005589807 + .long 1069363306 + .long 853875835 + .long 1069397703 + .long 851842476 + .long 1069429195 + .long 3001807968 + .long 1069458133 + .long 859424355 + .long 1069484817 + .long 3004202910 + .long 1069509498 + .long 843503196 + .long 1069532394 + .long 856475636 + .long 1069553692 + .long 2995114457 + .long 1069573552 + .long 860725119 + .long 1069592116 + .long 859745384 + .long 1069609507 + .long 3009201804 + .long 1069633623 + .long 855498560 + .long 1069662574 + .long 858167444 + .long 1069688405 + .long 853306415 + .long 1069711594 + .long 846705105 + .long 1069732526 + .long 858976312 + .long 1069751516 + .long 2999172562 + .long 1069768821 + .long 2999539371 + .long 1069784656 + .long 2998679696 + .long 1069799200 + .long 861304267 + .long 1069812606 + .long 843012447 + .long 1069825002 + .long 3010989671 + .long 1069836497 + .long 3005173143 + .long 1069847186 + .long 853102954 + .long 1069857152 + .long 2993551140 + .long 1069866465 + .long 3000116992 + .long 1069875187 + .long 827148142 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 32768 + .long 0 + .long 0 + .long 1431655765 + .long 3218429269 + .long 0 + .long 0 + .long 1070141402 + .long 866263400 + .long 0 + .long 0 + .long 1045220557 + .long 3198855851 + .long 0 + .long 0 + .long 1065353216 + .long 0 + .long 0 + .long 0 + .long 3198855441 + .long 0 + .long 0 + .long 0 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 2146959360 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,1440 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atanh_wmt.S b/external/sgx_libm/ia32/atanh_wmt.S new file mode 100644 index 0000000000..3c618294c5 --- /dev/null +++ b/external/sgx_libm/ia32/atanh_wmt.S @@ -0,0 +1,1380 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin atanh + .text + .align 16,0x90 + .globl atanh +atanh: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movl 116(%esp), %eax + movl %eax, %ecx + movq %xmm0, 8(%esp) + movl %eax, %edx + andl $2147483647, %eax + cmpl $1072693248, %eax + jge .L_2TAG_PACKET_0.0.3 + cmpl $1068498944, %eax + jl .L_2TAG_PACKET_1.0.3 + movsd 96(%ebx), %xmm2 + movsd 112(%ebx), %xmm4 + movsd 112(%ebx), %xmm3 + movsd 144(%ebx), %xmm6 + andpd %xmm2, %xmm0 + movq %xmm0, %xmm1 + movq %xmm0, %xmm7 + subsd %xmm4, %xmm0 + addsd %xmm4, %xmm1 + divsd %xmm0, %xmm4 + movq %xmm0, %xmm5 + movq %xmm1, %xmm2 + andpd 128(%ebx), %xmm5 + addsd %xmm0, %xmm3 + addsd %xmm2, %xmm6 + subsd %xmm5, %xmm0 + subsd %xmm7, %xmm3 + subsd %xmm7, %xmm6 + mulsd %xmm4, %xmm1 + andpd 128(%ebx), %xmm1 + mulsd %xmm1, %xmm5 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm0 + subsd %xmm5, %xmm2 + subsd %xmm3, %xmm6 + cvtsd2ss %xmm1, %xmm7 + subsd %xmm0, %xmm2 + rcpss %xmm7, %xmm7 + subsd %xmm6, %xmm2 + mulsd %xmm4, %xmm2 + cvtss2sd %xmm7, %xmm3 + paddd 160(%ebx), %xmm3 + andpd 176(%ebx), %xmm3 + mulsd %xmm3, %xmm1 + subsd 192(%ebx), %xmm1 + mulsd %xmm3, %xmm2 + psrlq $40, %xmm3 + movq %xmm1, %xmm4 + addsd %xmm2, %xmm1 + movd %xmm3, %eax + movl $4080, %ecx + andl %eax, %ecx + andl $8384512, %eax + cvtsi2sdl %eax, %xmm3 + movapd 272(%ebx,%ecx), %xmm5 + pshufd $68, %xmm3, %xmm3 + mulpd 208(%ebx), %xmm3 + subpd %xmm3, %xmm5 + pshufd $68, %xmm1, %xmm6 + movapd 224(%ebx), %xmm0 + mulpd %xmm6, %xmm0 + mulsd %xmm1, %xmm1 + addpd 240(%ebx), %xmm0 + pshufd $238, %xmm5, %xmm3 + addsd %xmm2, %xmm5 + movq %xmm3, %xmm7 + addsd %xmm4, %xmm3 + subsd %xmm3, %xmm7 + pshufd $238, %xmm0, %xmm2 + mulsd %xmm1, %xmm0 + addsd %xmm2, %xmm0 + andl $-2147483648, %edx + mulsd %xmm1, %xmm0 + addsd %xmm7, %xmm4 + subsd %xmm6, %xmm0 + addsd %xmm4, %xmm5 + mulsd %xmm6, %xmm0 + movd %edx, %xmm2 + psllq $32, %xmm2 + addsd %xmm5, %xmm0 + addsd %xmm3, %xmm0 + orpd %xmm2, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + cmpl $1003487232, %eax + jl .L_2TAG_PACKET_3.0.3 + movapd 32(%ebx), %xmm1 + movapd %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + movapd %xmm0, %xmm3 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm3 + mulpd %xmm0, %xmm1 + addpd 16(%ebx), %xmm1 + mulpd %xmm0, %xmm1 + addpd (%ebx), %xmm1 + mulpd %xmm3, %xmm1 + movhlps %xmm1, %xmm0 + addsd %xmm1, %xmm0 + mulsd %xmm2, %xmm0 + addsd %xmm2, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + andl $2146435072, %eax + je .L_2TAG_PACKET_4.0.3 + fldl 8(%esp) + fld1 + fld %st(1) + faddp + fmulp + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + fldl 8(%esp) + fld %st(0) + fmul %st(1), %st + fstpl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movl 8(%esp), %ecx + jne .L_2TAG_PACKET_5.0.3 + testl %ecx, %ecx + je .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_5.0.3: + cmpl $2146435072, %eax + jg .L_2TAG_PACKET_7.0.3 + je .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_9.0.3: + xorpd %xmm0, %xmm0 + mulsd 256(%ebx), %xmm0 + movsd %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $131, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + xorpd %xmm1, %xmm1 + divsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $132, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_8.0.3: + testl %ecx, %ecx + je .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_7.0.3: + addsd %xmm0, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_2.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type atanh,@function + .size atanh,.-atanh + .data +# -- End atanh + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1431655765 + .long 1070945621 + .long 2576980801 + .long 1070176665 + .long 2453616913 + .long 1069697316 + .long 1427436931 + .long 1069314503 + .long 2129349532 + .long 1068975486 + .long 1629438381 + .long 1068756329 + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .long 0 + .long 0 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 4026531840 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 3220176896 + .long 0 + .long 4293918976 + .long 0 + .long 4293918976 + .long 0 + .long 4294963200 + .long 0 + .long 4294963200 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 3164486458 + .long 1017968538 + .long 4277796864 + .long 1058418242 + .long 2640218915 + .long 3222623584 + .long 4294812536 + .long 3221225471 + .long 1158309786 + .long 1074370979 + .long 1431613876 + .long 1073042773 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 3961250687 + .long 1024388927 + .long 3715808466 + .long 1081484075 + .long 2810985123 + .long 3168028234 + .long 3782743078 + .long 1081484067 + .long 2030471786 + .long 1021588483 + .long 3982853962 + .long 1081484059 + .long 724716906 + .long 1026766458 + .long 20143440 + .long 1081484052 + .long 481208597 + .long 1024261464 + .long 483527638 + .long 1081484044 + .long 769498347 + .long 1026449044 + .long 1077032516 + .long 1081484036 + .long 662383902 + .long 3174188397 + .long 1799662888 + .long 1081484028 + .long 4195513590 + .long 3173820974 + .long 2650434932 + .long 1081484020 + .long 216019017 + .long 3171160333 + .long 3628376034 + .long 1081484012 + .long 3037216435 + .long 3174203912 + .long 437557316 + .long 1081484005 + .long 2242287414 + .long 3173446660 + .long 1666962648 + .long 1081483997 + .long 488659010 + .long 3174389563 + .long 3020684720 + .long 1081483989 + .long 2411277324 + .long 3174261033 + .long 202826760 + .long 1081483982 + .long 1552614370 + .long 3174374647 + .long 1802404272 + .long 1081483974 + .long 1761159654 + .long 1025358045 + .long 3523541100 + .long 1081483966 + .long 1227029918 + .long 1022400056 + .long 1070371174 + .long 1081483959 + .long 1017266216 + .long 1025927327 + .long 3031940236 + .long 1081483951 + .long 541289881 + .long 3173823840 + .long 817434636 + .long 1081483944 + .long 827704132 + .long 1025095119 + .long 3015919542 + .long 1081483936 + .long 12934210 + .long 3172513362 + .long 1036600450 + .long 1081483929 + .long 1022949985 + .long 3172215173 + .long 3468561396 + .long 1081483921 + .long 217728403 + .long 1020883592 + .long 1721026464 + .long 1081483914 + .long 1773946939 + .long 1027063347 + .long 88130720 + .long 1081483907 + .long 3351615536 + .long 3172077507 + .long 2864018200 + .long 1081483899 + .long 4106838151 + .long 3174156261 + .long 1457939880 + .long 1081483892 + .long 2465439606 + .long 3172344168 + .long 164057338 + .long 1081483885 + .long 657024829 + .long 1026968941 + .long 3276540740 + .long 1081483877 + .long 239284496 + .long 1025773300 + .long 2204666832 + .long 1081483870 + .long 563503993 + .long 3172683562 + .long 1242622588 + .long 1081483863 + .long 610254749 + .long 3174232732 + .long 389635916 + .long 1081483856 + .long 1002592152 + .long 1020145289 + .long 3939910132 + .long 1081483848 + .long 3079709802 + .long 1025793649 + .long 3302754668 + .long 1081483841 + .long 4156588929 + .long 3174405388 + .long 2772388732 + .long 1081483834 + .long 2177005711 + .long 3173706385 + .long 2348072008 + .long 1081483827 + .long 430264461 + .long 3174137709 + .long 2029071860 + .long 1081483820 + .long 3379887614 + .long 1025826683 + .long 1814663212 + .long 1081483813 + .long 1712456239 + .long 1026917505 + .long 1704128456 + .long 1081483806 + .long 3085449310 + .long 1022564341 + .long 1696757342 + .long 1081483799 + .long 1141334958 + .long 3171815944 + .long 1791846876 + .long 1081483792 + .long 1462201563 + .long 1025647829 + .long 1988701228 + .long 1081483785 + .long 140047506 + .long 3174122852 + .long 2286631636 + .long 1081483778 + .long 2759845912 + .long 1024469925 + .long 2684956298 + .long 1081483771 + .long 804042514 + .long 1026845100 + .long 3183000296 + .long 1081483764 + .long 3646267136 + .long 3171049236 + .long 3780095494 + .long 1081483757 + .long 2796072414 + .long 1025179136 + .long 180613146 + .long 1081483751 + .long 2935558853 + .long 1026289947 + .long 973833004 + .long 1081483744 + .long 3867040372 + .long 3174062522 + .long 1864139448 + .long 1081483737 + .long 3192294445 + .long 1024114853 + .long 2850890576 + .long 1081483730 + .long 2309059177 + .long 1026558495 + .long 3933450840 + .long 1081483723 + .long 3300904614 + .long 3173180909 + .long 816223656 + .long 1081483717 + .long 2836209699 + .long 1026670938 + .long 2088520500 + .long 1081483710 + .long 3053174336 + .long 3174287073 + .long 3454757072 + .long 1081483703 + .long 875601420 + .long 1025878424 + .long 619355076 + .long 1081483697 + .long 4096202184 + .long 1026024994 + .long 2171644060 + .long 1081483690 + .long 2316702776 + .long 3172256416 + .long 3816057542 + .long 1081483683 + .long 3057023477 + .long 3173172612 + .long 1257034828 + .long 1081483677 + .long 2024148590 + .long 1026183907 + .long 3083922828 + .long 1081483670 + .long 3658022801 + .long 3174540653 + .long 706204916 + .long 1081483664 + .long 965620747 + .long 3174139185 + .long 2713239208 + .long 1081483657 + .long 3558523119 + .long 3173414325 + .long 514520144 + .long 1081483651 + .long 2031819201 + .long 1024415865 + .long 2699416774 + .long 1081483644 + .long 2356933624 + .long 3174155910 + .long 677434328 + .long 1081483638 + .long 62190434 + .long 1027016638 + .long 3037952504 + .long 1081483631 + .long 3933781504 + .long 1025915529 + .long 1190487056 + .long 1081483625 + .long 2941696762 + .long 1025734775 + .long 3724428072 + .long 1081483618 + .long 2414317168 + .long 3170887182 + .long 2049301558 + .long 1081483612 + .long 2475288969 + .long 3174544243 + .long 459540440 + .long 1081483606 + .long 2871120870 + .long 3173072625 + .long 3249582612 + .long 1081483599 + .long 3658024676 + .long 3173912579 + .long 1828968996 + .long 1081483593 + .long 3145428063 + .long 1025702909 + .long 492147244 + .long 1081483587 + .long 3377090674 + .long 1025855275 + .long 3533569804 + .long 1081483580 + .long 441975505 + .long 3174521119 + .long 2362791964 + .long 1081483574 + .long 2700361953 + .long 1024904554 + .long 1274275566 + .long 1081483568 + .long 384688735 + .long 1024271063 + .long 267519784 + .long 1081483562 + .long 3294550047 + .long 1024123281 + .long 3636995640 + .long 1081483555 + .long 1629023504 + .long 3173808292 + .long 2792276776 + .long 1081483549 + .long 2896290296 + .long 1023457608 + .long 2027843168 + .long 1081483543 + .long 4214876422 + .long 3173347505 + .long 1343211900 + .long 1081483537 + .long 2089044909 + .long 1026320237 + .long 737904392 + .long 1081483531 + .long 1248769281 + .long 1026719018 + .long 211446364 + .long 1081483525 + .long 3287536014 + .long 1027064288 + .long 4058335068 + .long 1081483518 + .long 139482549 + .long 3171419957 + .long 3688170062 + .long 1081483512 + .long 2409197073 + .long 3174045711 + .long 3395456928 + .long 1081483506 + .long 469604718 + .long 3170908568 + .long 3179738046 + .long 1081483500 + .long 252575166 + .long 3173898937 + .long 3040559844 + .long 1081483494 + .long 659008259 + .long 3173067756 + .long 2977472740 + .long 1081483488 + .long 2489152120 + .long 1026987818 + .long 2990031104 + .long 1081483482 + .long 1288476519 + .long 3174460243 + .long 3077793216 + .long 1081483476 + .long 1544468634 + .long 3174466384 + .long 3240321200 + .long 1081483470 + .long 1563709080 + .long 1022000721 + .long 3477181002 + .long 1081483464 + .long 2370511724 + .long 3174484932 + .long 3787942340 + .long 1081483458 + .long 1487230717 + .long 3173625849 + .long 4172178648 + .long 1081483452 + .long 2208332257 + .long 3172980377 + .long 334499754 + .long 1081483447 + .long 3734805764 + .long 3173286476 + .long 864421012 + .long 1081483441 + .long 3848175750 + .long 1026823789 + .long 1466559484 + .long 1081483435 + .long 3339650886 + .long 1026799228 + .long 2140503092 + .long 1081483429 + .long 2587112486 + .long 1025074103 + .long 2885843270 + .long 1081483423 + .long 4237329462 + .long 1026571343 + .long 3702174928 + .long 1081483417 + .long 928919292 + .long 3173697437 + .long 294129124 + .long 1081483412 + .long 3350657575 + .long 3169758933 + .long 1251242194 + .long 1081483406 + .long 703498847 + .long 3173578839 + .long 2278151956 + .long 1081483400 + .long 1741773245 + .long 3169646323 + .long 3374466840 + .long 1081483394 + .long 938088363 + .long 3174103745 + .long 244831272 + .long 1081483389 + .long 1870507923 + .long 1024486077 + .long 1478794808 + .long 1081483383 + .long 3798424972 + .long 1026574662 + .long 2781008336 + .long 1081483377 + .long 1376042227 + .long 3171831111 + .long 4151093216 + .long 1081483371 + .long 516241188 + .long 1026864009 + .long 1293706648 + .long 1081483366 + .long 1238744632 + .long 3164368610 + .long 2798410838 + .long 1081483360 + .long 534941416 + .long 3172335234 + .long 74901872 + .long 1081483355 + .long 4279792400 + .long 3172103338 + .long 1712748064 + .long 1081483349 + .long 1565180338 + .long 1018613718 + .long 3416618846 + .long 1081483343 + .long 3951527485 + .long 3168909417 + .long 891186624 + .long 1081483338 + .long 3344344018 + .long 1024361841 + .long 2726028632 + .long 1081483332 + .long 1292300217 + .long 3174285210 + .long 330855832 + .long 1081483327 + .long 3519999099 + .long 1026857199 + .long 2295251240 + .long 1081483321 + .long 4255457731 + .long 1024555694 + .long 28931548 + .long 1081483316 + .long 1490990106 + .long 1024547962 + .long 2121485436 + .long 1081483310 + .long 3260941522 + .long 3172283917 + .long 4277602488 + .long 1081483304 + .long 246767963 + .long 1026252459 + .long 2201975040 + .long 1081483299 + .long 128194825 + .long 1026112424 + .long 189232752 + .long 1081483294 + .long 363902483 + .long 3169513578 + .long 2534007978 + .long 1081483288 + .long 3008515840 + .long 3172261022 + .long 646033852 + .long 1081483283 + .long 352511539 + .long 3170570563 + .long 3114915334 + .long 1081483277 + .long 1843039765 + .long 1026777816 + .long 1350390812 + .long 1081483272 + .long 946690324 + .long 3173265177 + .long 3942070448 + .long 1081483266 + .long 3545145670 + .long 1022546257 + .long 2299697768 + .long 1081483261 + .long 1496129287 + .long 1023820421 + .long 717920726 + .long 1081483256 + .long 3170447711 + .long 1026758832 + .long 3491389776 + .long 1081483250 + .long 3744391389 + .long 3173610490 + .long 2029855968 + .long 1081483245 + .long 394239962 + .long 3173947840 + .long 627974684 + .long 1081483240 + .long 4224315822 + .long 3174184559 + .long 3580403740 + .long 1081483234 + .long 2728751382 + .long 3174034570 + .long 2296901464 + .long 1081483229 + .long 1826853394 + .long 1026771661 + .long 1072130448 + .long 1081483224 + .long 976251207 + .long 1023454847 + .long 4200755644 + .long 1081483218 + .long 3540660088 + .long 3173642356 + .long 3092542436 + .long 1081483213 + .long 642222050 + .long 3174357226 + .long 2042160404 + .long 1081483208 + .long 4271938163 + .long 1024746297 + .long 1049314112 + .long 1081483203 + .long 2763050982 + .long 3171347092 + .long 113710388 + .long 1081483198 + .long 3792557536 + .long 1023308621 + .long 3530025584 + .long 1081483192 + .long 311855242 + .long 1025741510 + .long 2708036380 + .long 1081483187 + .long 246870760 + .long 3174242823 + .long 1942423536 + .long 1081483182 + .long 3741324184 + .long 1024230514 + .long 1232902676 + .long 1081483177 + .long 738314997 + .long 1025672705 + .long 579191580 + .long 1081483172 + .long 2156805174 + .long 1024422082 + .long 4275977444 + .long 1081483166 + .long 1311555958 + .long 3174065520 + .long 3733047680 + .long 1081483161 + .long 3764263691 + .long 3174151698 + .long 3245093668 + .long 1081483156 + .long 3869296466 + .long 3171928183 + .long 2811841556 + .long 1081483151 + .long 690806523 + .long 1025267317 + .long 2433019534 + .long 1081483146 + .long 2145634608 + .long 1026057800 + .long 2108357812 + .long 1081483141 + .long 3978517915 + .long 1027003985 + .long 1837588600 + .long 1081483136 + .long 1798363739 + .long 1024820509 + .long 1620446092 + .long 1081483131 + .long 1050593265 + .long 3173881020 + .long 1456666440 + .long 1081483126 + .long 992424745 + .long 3172306519 + .long 1345987738 + .long 1081483121 + .long 3429191021 + .long 3172872803 + .long 1288150008 + .long 1081483116 + .long 80339595 + .long 1025975133 + .long 1282895172 + .long 1081483111 + .long 1099626523 + .long 3173274851 + .long 1329967044 + .long 1081483106 + .long 37527030 + .long 1026870817 + .long 1429111296 + .long 1081483101 + .long 4119125584 + .long 3165241791 + .long 1580075462 + .long 1081483096 + .long 2270013714 + .long 1025817458 + .long 1782608896 + .long 1081483091 + .long 3203429680 + .long 1025496563 + .long 2036462774 + .long 1081483086 + .long 1148983882 + .long 1026950273 + .long 2341390064 + .long 1081483081 + .long 4068830577 + .long 1025284407 + .long 2697145518 + .long 1081483076 + .long 1923810050 + .long 1026721061 + .long 3103485644 + .long 1081483071 + .long 3762557359 + .long 1025074748 + .long 3560168702 + .long 1081483066 + .long 253913897 + .long 3171090011 + .long 4066954676 + .long 1081483061 + .long 1497751894 + .long 3172734642 + .long 328637968 + .long 1081483057 + .long 3363029157 + .long 3172289292 + .long 934916564 + .long 1081483052 + .long 3896109434 + .long 1024906782 + .long 1590588242 + .long 1081483047 + .long 570002366 + .long 3166515828 + .long 2295419742 + .long 1081483042 + .long 1386275374 + .long 1027010807 + .long 3049179448 + .long 1081483037 + .long 352253063 + .long 1025583264 + .long 3851637384 + .long 1081483032 + .long 606289825 + .long 1026218875 + .long 407597888 + .long 1081483028 + .long 2091542702 + .long 1025209018 + .long 1306768794 + .long 1081483023 + .long 1253650337 + .long 1026509039 + .long 2253957632 + .long 1081483018 + .long 4231155942 + .long 1026471430 + .long 3248940804 + .long 1081483013 + .long 3016566426 + .long 1026594534 + .long 4291496268 + .long 1081483008 + .long 2473443710 + .long 3172512713 + .long 1086436232 + .long 1081483004 + .long 3621506366 + .long 1025637579 + .long 2223476316 + .long 1081482999 + .long 1546124245 + .long 3173819367 + .long 3407431776 + .long 1081482994 + .long 906095450 + .long 3170941588 + .long 343119360 + .long 1081482990 + .long 610131836 + .long 3173841951 + .long 1620259200 + .long 1081482985 + .long 989279629 + .long 3174040346 + .long 2943671008 + .long 1081482980 + .long 3822867778 + .long 1024701039 + .long 18175958 + .long 1081482976 + .long 1622666714 + .long 3174118882 + .long 1433498564 + .long 1081482971 + .long 2171198509 + .long 1026059907 + .long 2894462876 + .long 1081482966 + .long 348671320 + .long 1025985459 + .long 105894376 + .long 1081482962 + .long 3585216657 + .long 3171231928 + .long 1657521836 + .long 1081482957 + .long 3446444124 + .long 1025447652 + .long 3254173534 + .long 1081482952 + .long 1463686921 + .long 3170751639 + .long 600679136 + .long 1081482948 + .long 3946680458 + .long 3172628318 + .long 2286771562 + .long 1081482943 + .long 2898292254 + .long 3173607956 + .long 4017283204 + .long 1081482938 + .long 378425754 + .long 1024364086 + .long 1497047798 + .long 1081482934 + .long 2208076810 + .long 1021550089 + .long 3315802306 + .long 1081482929 + .long 518466868 + .long 3170182275 + .long 883415824 + .long 1081482925 + .long 2262926030 + .long 3173232842 + .long 2789627944 + .long 1081482920 + .long 1857642286 + .long 3174551967 + .long 444310372 + .long 1081482916 + .long 312835987 + .long 1025199986 + .long 2437205282 + .long 1081482911 + .long 1932061261 + .long 3169727498 + .long 178186948 + .long 1081482907 + .long 2992653487 + .long 1024639967 + .long 2257000084 + .long 1081482902 + .long 2345620679 + .long 1020767444 + .long 83521478 + .long 1081482898 + .long 1865371320 + .long 3168909500 + .long 2247498342 + .long 1081482893 + .long 3458599018 + .long 1024937135 + .long 158809936 + .long 1081482889 + .long 2726616459 + .long 1023093864 + .long 2407205926 + .long 1081482884 + .long 3206755402 + .long 1022531411 + .long 402568002 + .long 1081482880 + .long 3974974073 + .long 3174453501 + .long 2734648240 + .long 1081482875 + .long 3634353085 + .long 3173855629 + .long 813330716 + .long 1081482871 + .long 1275754339 + .long 3172404325 + .long 3228369874 + .long 1081482866 + .long 2459942624 + .long 1026394723 + .long 1389652140 + .long 1081482862 + .long 3894317897 + .long 1022143780 + .long 3886934286 + .long 1081482857 + .long 2409656812 + .long 3174419085 + .long 2130105044 + .long 1081482853 + .long 399990141 + .long 3174164192 + .long 413956172 + .long 1081482849 + .long 1897372421 + .long 3171133891 + .long 3033280560 + .long 1081482844 + .long 2252287291 + .long 3171644317 + .long 1397970330 + .long 1081482840 + .long 1092600795 + .long 3174474273 + .long 4097787896 + .long 1081482835 + .long 636054898 + .long 1024727874 + .long 2542627584 + .long 1081482831 + .long 893978442 + .long 3170953397 + .long 1027286708 + .long 1081482827 + .long 1310200238 + .long 3172082428 + .long 3846563656 + .long 1081482822 + .long 1929717761 + .long 3174303818 + .long 2410356004 + .long 1081482818 + .long 2079265613 + .long 3173603756 + .long 1013464276 + .long 1081482814 + .long 138096117 + .long 3172000995 + .long 3950690054 + .long 1081482809 + .long 3014271250 + .long 1025494367 + .long 2631934076 + .long 1081482805 + .long 1516771853 + .long 1025097570 + .long 1352000006 + .long 1081482801 + .long 205057013 + .long 1025200619 + .long 110725238 + .long 1081482797 + .long 4146523933 + .long 3174010180 + .long 3202915484 + .long 1081482792 + .long 1438530950 + .long 3172691622 + .long 2038475574 + .long 1081482788 + .long 3556059382 + .long 1022109351 + .long 912213234 + .long 1081482784 + .long 3429560596 + .long 3174416385 + .long 4118937184 + .long 1081482779 + .long 21605584 + .long 3173029554 + .long 3068555236 + .long 1081482775 + .long 812212829 + .long 3174509580 + .long 2055878076 + .long 1081482771 + .long 3822203782 + .long 3172686714 + .long 1080750056 + .long 1081482767 + .long 2015620057 + .long 1020790313 + .long 143016496 + .long 1081482763 + .long 497128390 + .long 3173548042 + .long 3537490964 + .long 1081482758 + .long 2709103148 + .long 3174501920 + .long 2674086084 + .long 1081482754 + .long 567743127 + .long 3172450622 + .long 1847617306 + .long 1081482750 + .long 2788161622 + .long 3174369501 + .long 1057933720 + .long 1081482746 + .long 3612383344 + .long 3174048564 + .long 304885332 + .long 1081482742 + .long 2310781260 + .long 3173370133 + .long 3883290364 + .long 1081482737 + .long 2417832061 + .long 1025537953 + .long 3203066056 + .long 1081482733 + .long 2228257300 + .long 1023509958 + .long 2559032440 + .long 1081482729 + .long 3413175845 + .long 1026737228 + .long 1951043140 + .long 1081482725 + .long 1019314226 + .long 1026188380 + .long 1378952672 + .long 1081482721 + .long 1939366236 + .long 3173263748 + .long 842616428 + .long 1081482717 + .long 2826522465 + .long 1026654019 + .long 341890668 + .long 1081482713 + .long 510868637 + .long 3173428756 + .long 4171599824 + .long 1081482708 + .long 2348490647 + .long 1026914531 + .long 3741667284 + .long 1081482704 + .long 1992702016 + .long 3171098997 + .long 3346919190 + .long 1081482700 + .long 1915735778 + .long 3171038930 + .long 2987215220 + .long 1081482696 + .long 708866615 + .long 1023303854 + .long 2662415896 + .long 1081482692 + .long 1533252285 + .long 1025288173 + .long 2372382570 + .long 1081482688 + .long 3419174070 + .long 3173768463 + .long 2116977420 + .long 1081482684 + .long 2278659151 + .long 1025060560 + .long 1896063436 + .long 1081482680 + .long 2525715938 + .long 3169189535 + .long 1709504428 + .long 1081482676 + .long 1253833294 + .long 1025773641 + .long 1557165004 + .long 1081482672 + .long 3815681768 + .long 3168831918 + .long 1438910576 + .long 1081482668 + .long 3615821994 + .long 1021226882 + .long 1354607344 + .long 1081482664 + .long 3031132768 + .long 1026704265 + .long 1304122296 + .long 1081482660 + .long 997386977 + .long 3171874671 + .long 1287323204 + .long 1081482656 + .type static_const_table,@object + .size static_const_table,4384 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atanhf_wmt.S b/external/sgx_libm/ia32/atanhf_wmt.S new file mode 100644 index 0000000000..9a19241900 --- /dev/null +++ b/external/sgx_libm/ia32/atanhf_wmt.S @@ -0,0 +1,1328 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanhf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin atanhf + .text + .align 16,0x90 + .globl atanhf +atanhf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 52(%esp) + call static_func + movl %eax, %ebx + movss 128(%esp), %xmm0 + movl 128(%esp), %eax + movss %xmm0, 16(%esp) + andl $2147483647, %eax + cmpl $1065353216, %eax + jge .L_2TAG_PACKET_0.0.3 + cmpl $1056964608, %eax + jl .L_2TAG_PACKET_1.0.3 + pshufd $0, %xmm0, %xmm0 + cvtps2pd %xmm0, %xmm0 + xorpd 176(%ebx), %xmm0 + addpd 112(%ebx), %xmm0 + movapd %xmm0, %xmm1 + psrlq $41, %xmm0 + pextrw $0, %xmm0, %eax + pextrw $4, %xmm0, %ecx + psrlq $11, %xmm0 + movhlps %xmm0, %xmm2 + andl $2040, %eax + andl $2040, %ecx + movq 192(%ebx,%ecx), %xmm3 + subsd 192(%ebx,%eax), %xmm3 + movq 2240(%ebx,%eax), %xmm4 + movhpd 2240(%ebx,%ecx), %xmm4 + psubd %xmm0, %xmm2 + movd %xmm2, %eax + movapd 80(%ebx), %xmm5 + cvtsi2sdl %eax, %xmm2 + mulsd 96(%ebx), %xmm2 + andpd 128(%ebx), %xmm1 + orpd 112(%ebx), %xmm1 + mulpd %xmm4, %xmm1 + subpd 112(%ebx), %xmm1 + mulpd %xmm1, %xmm5 + addpd 64(%ebx), %xmm5 + mulpd %xmm1, %xmm5 + mulpd %xmm1, %xmm5 + addpd %xmm5, %xmm1 + movhlps %xmm1, %xmm0 + addsd %xmm3, %xmm2 + subsd %xmm1, %xmm0 + addsd %xmm2, %xmm0 + psubw 160(%ebx), %xmm0 + movq %xmm0, (%esp) + movhpd %xmm0, 8(%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + cmpl $838860800, %eax + jl .L_2TAG_PACKET_3.0.3 + flds 16(%esp) + flds 16(%esp) + fxch + fmul %st(0), %st + fldl 56(%ebx) + fld %st(1) + fxch %st(2) + fmul %st(0), %st + fldl 48(%ebx) + fxch + fmul %st, %st(2) + fmul %st, %st(1) + fxch %st(2) + faddl 40(%ebx) + fxch + faddl 32(%ebx) + fxch + fmul %st(2), %st + fxch + fmul %st(2), %st + fxch + faddl 24(%ebx) + fxch + faddl 16(%ebx) + fxch + fmul %st(2), %st + fxch + fmul %st(2), %st + fxch + faddl 8(%ebx) + fxch + faddl (%ebx) + fxch + fmulp %st, %st(2) + fmulp %st, %st(2) + faddp + fmul %st(1), %st + faddp + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + andl $2139095040, %eax + je .L_2TAG_PACKET_4.0.3 + flds 16(%esp) + fld1 + fadd %st(1), %st + fstps (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + flds 16(%esp) + fld %st(0) + fmul %st(1), %st + fstps (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + je .L_2TAG_PACKET_5.0.3 + cmpl $2139095040, %eax + jg .L_2TAG_PACKET_6.0.3 + xorps %xmm0, %xmm0 + mulss 144(%ebx), %xmm0 + movss %xmm0, (%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $133, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_5.0.3: + xorps %xmm1, %xmm1 + divss %xmm1, %xmm0 + movss %xmm0, (%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $134, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_2.0.3: + movl 52(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type atanhf,@function + .size atanhf,.-atanhf + .data +# -- End atanhf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1370222587 + .long 1070945621 + .long 2417412325 + .long 1070176668 + .long 2969394279 + .long 1069697198 + .long 1510013680 + .long 1069319176 + .long 1692635884 + .long 1068924049 + .long 3693828232 + .long 1069068511 + .long 4025937356 + .long 3211315437 + .long 476477515 + .long 1070012413 + .long 3879088107 + .long 3219128321 + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .long 1754324240 + .long 1070945626 + .long 4277811695 + .long 1072049730 + .long 4277811695 + .long 1072049730 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .long 0 + .long 1048576 + .long 0 + .long 1048576 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 1440057502 + .long 1063257089 + .long 341338964 + .long 1064833554 + .long 4184355568 + .long 1065621801 + .long 2227658503 + .long 1066152307 + .long 449262470 + .long 1066510009 + .long 1570422842 + .long 1066777242 + .long 121841140 + .long 1067045544 + .long 630691842 + .long 1067281191 + .long 2711485097 + .long 1067500943 + .long 2026622491 + .long 1067619660 + .long 766078039 + .long 1067755853 + .long 4074027864 + .long 1067875476 + .long 3056660584 + .long 1067995528 + .long 3195252556 + .long 1068133258 + .long 116861598 + .long 1068254238 + .long 325086471 + .long 1068375655 + .long 296456961 + .long 1068497513 + .long 2623383041 + .long 1068559379 + .long 1681725707 + .long 1068620754 + .long 2231263004 + .long 1068682354 + .long 2815553124 + .long 1068744181 + .long 2057310944 + .long 1068806237 + .long 2095798018 + .long 1068859611 + .long 2302040698 + .long 1068922096 + .long 745232013 + .long 1068984815 + .long 659581512 + .long 1069047769 + .long 1566132617 + .long 1069101918 + .long 550036981 + .long 1069165314 + .long 2887419564 + .long 1069219844 + .long 1990183441 + .long 1069283688 + .long 3220050856 + .long 1069338605 + .long 1669613218 + .long 1069393703 + .long 2145455994 + .long 1069458213 + .long 4275830246 + .long 1069513705 + .long 1392453108 + .long 1069558451 + .long 1469915213 + .long 1069586382 + .long 2183652476 + .long 1069619086 + .long 2109656884 + .long 1069647220 + .long 636640577 + .long 1069675449 + .long 510517079 + .long 1069703773 + .long 210141498 + .long 1069732193 + .long 2537624622 + .long 1069760709 + .long 1733817001 + .long 1069789323 + .long 137854980 + .long 1069813243 + .long 3905576828 + .long 1069842036 + .long 4131810788 + .long 1069870929 + .long 3760956694 + .long 1069899922 + .long 1473082581 + .long 1069929016 + .long 926113142 + .long 1069953338 + .long 3669742467 + .long 1069982617 + .long 3711755290 + .long 1070007095 + .long 311386407 + .long 1070036564 + .long 705364525 + .long 1070066136 + .long 1973375279 + .long 1070090859 + .long 3589645072 + .long 1070115655 + .long 2425772059 + .long 1070145508 + .long 1074899574 + .long 1070170467 + .long 118003300 + .long 1070200516 + .long 691310403 + .long 1070225639 + .long 3273036717 + .long 1070250837 + .long 1226436560 + .long 1070276112 + .long 2481153995 + .long 1070306542 + .long 3227997535 + .long 1070331985 + .long 1421812646 + .long 1070357506 + .long 3386588242 + .long 1070383104 + .long 2580043380 + .long 1070408781 + .long 1068692560 + .long 1070434537 + .long 938143489 + .long 1070460372 + .long 4293333010 + .long 1070486286 + .long 373864817 + .long 1070512282 + .long 4208958430 + .long 1070538357 + .long 783121462 + .long 1070564515 + .long 870975437 + .long 1070590754 + .long 3338886172 + .long 1070606585 + .long 3772343130 + .long 1070619787 + .long 2408245143 + .long 1070630379 + .long 3811383569 + .long 1070643656 + .long 1622638721 + .long 1070656976 + .long 1290798655 + .long 1070670338 + .long 2457529556 + .long 1070681058 + .long 2398194399 + .long 1070694497 + .long 3190801979 + .long 1070707979 + .long 3352241197 + .long 1070718796 + .long 1829681364 + .long 1070732357 + .long 2568927817 + .long 1070743237 + .long 2676427515 + .long 1070756877 + .long 2882402820 + .long 1070767821 + .long 44944622 + .long 1070781542 + .long 2957945300 + .long 1070792550 + .long 1261787704 + .long 1070806352 + .long 1589923677 + .long 1070817426 + .long 3274931829 + .long 1070828529 + .long 1999843716 + .long 1070842450 + .long 1673619518 + .long 1070853620 + .long 601221319 + .long 1070864820 + .long 3763576649 + .long 1070876049 + .long 1974923437 + .long 1070890129 + .long 1096100617 + .long 1070901427 + .long 2424897952 + .long 1070912755 + .long 2376202600 + .long 1070924114 + .long 1665651958 + .long 1070935504 + .long 1014729354 + .long 1070946925 + .long 722545241 + .long 1070961245 + .long 1800682930 + .long 1070972736 + .long 1029453230 + .long 1070984259 + .long 3450874911 + .long 1070995813 + .long 1228255906 + .long 1071007400 + .long 3711032981 + .long 1071019018 + .long 3075102917 + .long 1071030669 + .long 92696812 + .long 1071042353 + .long 3897749690 + .long 1071051136 + .long 1907922160 + .long 1071062877 + .long 4023807324 + .long 1071074650 + .long 2452345726 + .long 1071086457 + .long 2292128226 + .long 1071098297 + .long 58635942 + .long 1071110171 + .long 864186929 + .long 1071122078 + .long 3555691467 + .long 1071131030 + .long 2003684347 + .long 1071142997 + .long 1479703759 + .long 1071154998 + .long 2537208015 + .long 1071164021 + .long 3699909861 + .long 1071176082 + .long 3934098706 + .long 1071188178 + .long 3885764182 + .long 1071197273 + .long 1357790931 + .long 1071209431 + .long 295956059 + .long 1071221624 + .long 4080877676 + .long 1071230791 + .long 202970280 + .long 1071243047 + .long 3977575845 + .long 1071252261 + .long 35977849 + .long 1071264580 + .long 1585496963 + .long 1071273842 + .long 375247257 + .long 1071286224 + .long 1812199574 + .long 1071295534 + .long 1876912769 + .long 1071307980 + .long 1051846544 + .long 1071317339 + .long 979589448 + .long 1071329850 + .long 71706889 + .long 1071339258 + .long 2790898835 + .long 1071351834 + .long 4013797733 + .long 1071361291 + .long 2541231151 + .long 1071370770 + .long 921733145 + .long 1071383442 + .long 508375805 + .long 1071392971 + .long 3091669954 + .long 1071402521 + .long 3343209673 + .long 1071415289 + .long 1693047557 + .long 1071424891 + .long 173861808 + .long 1071434515 + .long 3515822703 + .long 1071444160 + .long 1974837761 + .long 1071457056 + .long 1189018219 + .long 1071466754 + .long 2441946573 + .long 1071476474 + .long 1887102255 + .long 1071486217 + .long 4271031636 + .long 1071495982 + .long 876995759 + .long 1071509039 + .long 438773454 + .long 1071518858 + .long 172621632 + .long 1071528700 + .long 544035182 + .long 1071538565 + .long 2021801298 + .long 1071548453 + .long 783063308 + .long 1071558365 + .long 1598254051 + .long 1071568300 + .long 651258553 + .long 1071578259 + .long 2719315456 + .long 1071588241 + .long 3993180461 + .long 1071598247 + .long 667093936 + .long 1071608278 + .long 1823716217 + .long 1071618332 + .long 3664357648 + .long 1071628410 + .long 2393914686 + .long 1071638513 + .long 1405419566 + .long 1071646656 + .long 563652001 + .long 1071651732 + .long 1074554091 + .long 1071656820 + .long 3195405229 + .long 1071661920 + .long 2890399284 + .long 1071667033 + .long 420597586 + .long 1071672159 + .long 87278952 + .long 1071675583 + .long 1753119502 + .long 1071680729 + .long 1959759897 + .long 1071685888 + .long 975389815 + .long 1071691060 + .long 3365155278 + .long 1071696244 + .long 811309190 + .long 1071701442 + .long 1269811480 + .long 1071704914 + .long 1108583542 + .long 1071710133 + .long 1034517919 + .long 1071715365 + .long 1327340287 + .long 1071720610 + .long 1388251237 + .long 1071724114 + .long 1488234797 + .long 1071729381 + .long 2711385691 + .long 1071734661 + .long 952179194 + .long 1071738189 + .long 3255685427 + .long 1071743491 + .long 3159039803 + .long 1071748807 + .long 951558972 + .long 1071752359 + .long 3234424125 + .long 1071757697 + .long 3904573547 + .long 1071763049 + .long 2648729924 + .long 1071766625 + .long 2729250212 + .long 1071772000 + .long 2000712574 + .long 1071777389 + .long 3125257108 + .long 1071780989 + .long 3160324803 + .long 1071786401 + .long 2216316974 + .long 1071790017 + .long 3875016090 + .long 1071795452 + .long 1439520610 + .long 1071799084 + .long 1298103361 + .long 1071804543 + .long 2217517956 + .long 1071810016 + .long 1191753587 + .long 1071813673 + .long 1728773900 + .long 1071819170 + .long 747445441 + .long 1071822843 + .long 1670772213 + .long 1071826522 + .long 1471209283 + .long 1071832053 + .long 3287905877 + .long 1071835748 + .long 594038131 + .long 1071841304 + .long 3920147917 + .long 1071845015 + .long 3957142762 + .long 1071850595 + .long 826988438 + .long 1071854324 + .long 242509008 + .long 1071859929 + .long 4173610350 + .long 1071863673 + .long 2518313625 + .long 1071867425 + .long 2671523434 + .long 1071873065 + .long 387544807 + .long 1071876834 + .long 1470497767 + .long 1071880609 + .long 4269259217 + .long 1071886284 + .long 1345663925 + .long 1071890077 + .long 2159323299 + .long 1071893876 + .long 957937516 + .long 1071899588 + .long 2994656967 + .long 1071903404 + .long 556124819 + .long 1071907228 + .long 1631098658 + .long 1071912976 + .long 1368257861 + .long 1071916817 + .long 1309849279 + .long 1071920665 + .long 1567156841 + .long 1071924520 + .long 1179420986 + .long 1071930316 + .long 569448444 + .long 1071934189 + .long 669557459 + .long 1071938069 + .long 1593834700 + .long 1071941956 + .long 3166083125 + .long 1071947800 + .long 211641815 + .long 1071951706 + .long 2780675719 + .long 1071955618 + .long 2400234567 + .long 1071959538 + .long 3482927192 + .long 1071963465 + .long 1852089988 + .long 1071967400 + .long 1020849000 + .long 1071973316 + .long 1718090839 + .long 1071977269 + .long 121152472 + .long 1071981230 + .long 646346839 + .long 1071985198 + .long 3415709705 + .long 1071989173 + .long 4257004898 + .long 1071993156 + .long 3293664199 + .long 1071997147 + .long 649825382 + .long 1072001146 + .long 248887552 + .long 1072007158 + .long 2541522737 + .long 1072011175 + .long 3593780107 + .long 1072015200 + .long 3533041935 + .long 1072019233 + .long 2487426809 + .long 1072023274 + .long 585795318 + .long 1072027323 + .long 2252723088 + .long 1072031379 + .long 3323604690 + .long 1072035443 + .long 3929561382 + .long 1072039515 + .long 4202479723 + .long 1072043595 + .long 4275017539 + .long 1072047683 + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type static_const_table,@object + .size static_const_table,4288 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atanhl.S b/external/sgx_libm/ia32/atanhl.S new file mode 100644 index 0000000000..cd538f8a50 --- /dev/null +++ b/external/sgx_libm/ia32/atanhl.S @@ -0,0 +1,905 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanhl.c" + .text +..TXTST0: +# -- Begin atanhl + .text + .align 16,0x90 + .globl atanhl +atanhl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + movzwl 14(%esp), %edx + cmpl $16383, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jge ..B1.53 +..B1.4: + cmpl $16381, %eax + jge ..B1.46 +..B1.5: + cmpl $16376, %eax + jge ..B1.39 +..B1.6: + cmpl $16371, %eax + jge ..B1.32 +..B1.7: + cmpl $16365, %eax + jge ..B1.25 +..B1.8: + cmpl $16308, %eax + jge ..B1.18 +..B1.9: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.68 +..B1.10: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.11: + fldcw 12(%esp) +..B1.12: + movzwl 16(%ebp), %eax + movl $1, %esi + andl $32767, %eax +..B1.13: + testl %eax, %eax + jle ..B1.64 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ebx) + fstpt (%esp) +..B1.15: + testl %esi, %esi + je ..B1.17 +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt (%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.69 +..B1.19: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.20: + fldcw 12(%esp) +..B1.21: + movl $1, %eax +..B1.22: + fldt 8(%ebp) + testl %eax, %eax + fldt _Q3@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.24 +..B1.23: + fldcw 14(%esp) +..B1.24: + fldt (%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.70 +..B1.26: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.27: + fldcw 12(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_Q2@GOTOFF(%ebx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.31 +..B1.30: + fldcw 14(%esp) +..B1.31: + fldt (%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.71 +..B1.33: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.34: + fldcw 12(%esp) +..B1.35: + movl $1, %eax +..B1.36: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%ebx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.38 +..B1.37: + fldcw 14(%esp) +..B1.38: + fldt (%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.72 +..B1.40: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.41: + fldcw 12(%esp) +..B1.42: + movl $1, %eax +..B1.43: + fldt 8(%ebp) + testl %eax, %eax + fldl _TWO_52H@GOTOFF(%ebx) + fmul %st(1), %st + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fstpt 16(%esp) + fldt 16(%esp) + fld %st(1) + fmul %st(1), %st + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fmul %st, %st(2) + fld %st(1) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fldt 132+_Q@GOTOFF(%ebx) + fmul %st(1), %st + fldt 108+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 120+_Q@GOTOFF(%ebx) + fmul %st(2), %st + fldt 96+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_Q@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _Q@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 156+_Q@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(2) + fldt 144+_Q@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 32(%esp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fldt 16(%esp) + fld %st(0) + fldl _TWO_48H@GOTOFF(%ebx) + fadd %st, %st(3) + fsubrp %st, %st(3) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fldt 8(%ebp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(2) + fldt (%esp) + fmul %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.45 +..B1.44: + fldcw 14(%esp) +..B1.45: + fldt (%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.73 +..B1.47: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.48: + fldcw 12(%esp) +..B1.49: + movl $1, %ecx +..B1.50: + fldt 8(%ebp) + fldl _ones@GOTOFF(%ebx) + movzbl 17(%ebp), %edx + fld %st(0) + andl $128, %edx + fld %st(1) + shrl $7, %edx + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fldl _TWO_48H@GOTOFF(%ebx) + movzwl 8(%esp), %edi + fxch %st(4) + fmull _ones@GOTOFF(%ebx,%edx,8) + andl $-32768, %edi + fsubr %st, %st(2) + fld %st(2) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fsubr %st(2), %st + fsub %st(1), %st + fld %st(3) + fadd %st(1), %st + fxch %st(2) + fadd %st, %st(5) + fld %st(5) + fmul %st(7), %st + fadd %st, %st(6) + fsubrp %st, %st(6) + fxch %st(5) + fstpt 16(%esp) + fldt 16(%esp) + fsubr %st(3), %st + faddp %st, %st(5) + fld %st(1) + fdivr %st(3), %st + fmul %st, %st(6) + fld %st(0) + fadd %st(7), %st + fsubp %st, %st(7) + fxch %st(1) + fmul %st(6), %st + fld %st(1) + fsub %st(7), %st + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(4) + fmul %st(6), %st + fsubrp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fldt 16(%esp) + fadd %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 8(%ebp) + fldt 60+_P@GOTOFF(%ebx) + fldt 36+_P@GOTOFF(%ebx) + fldt 12+_P@GOTOFF(%ebx) + movzwl 16(%ebp), %eax + andl $32767, %eax + movl %eax, %esi + addl $-16383, %eax + negl %esi + addl $-2, %esi + andl $32767, %esi + orl %esi, %edi + movw %di, 8(%esp) + fldt (%esp) + movl 12(%ebp), %esi + shrl $23, %esi + fmul %st, %st(4) + fmulp %st, %st(5) + andl $255, %esi + movl %eax, 32(%esp) + fildl 32(%esp) + fxch %st(4) + fmuls __libm_rcp_table_256@GOTOFF(%ebx,%esi,4) + fxch %st(5) + fmuls __libm_rcp_table_256@GOTOFF(%ebx,%esi,4) + fxch %st(5) + faddl 8+_ones@GOTOFF(%ebx) + fld %st(0) + shll $4, %esi + fadd %st(6), %st + fld %st(0) + testl %ecx, %ecx + fmul %st(1), %st + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fstpt 8(%ebp) + fldt 48+_P@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _P@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fmul %st(2), %st + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(3) + faddl 8+__libm_logl_table_256@GOTOFF(%ebx,%esi) + faddp %st, %st(3) + fxch %st(1) + faddl __libm_logl_table_256@GOTOFF(%esi,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fmull halfs@GOTOFF(%ebx,%edx,8) + fstpt 16(%esp) + je ..B1.52 +..B1.51: + fldcw 14(%esp) +..B1.52: + fldt 16(%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.53: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.79 +..B1.54: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.55: + fldcw 12(%esp) +..B1.56: + movzwl 16(%ebp), %eax + movl $1, %edx + andl $32767, %eax +..B1.57: + cmpl $32767, %eax + jl ..B1.74 +..B1.58: + cmpl $-2147483648, 12(%ebp) + jne ..B1.60 +..B1.59: + cmpl $0, 8(%ebp) + je ..B1.74 +..B1.60: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt (%esp) +..B1.61: + testl %edx, %edx + je ..B1.63 +..B1.62: + fldcw 14(%esp) +..B1.63: + fldt (%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.64: + cmpl $0, 12(%ebp) + jne ..B1.66 +..B1.65: + cmpl $0, 8(%ebp) + je ..B1.67 +..B1.66: + fldt 8(%ebp) + fldt _small_value_80@GOTOFF(%ebx) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.67: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.15 +..B1.68: + xorl %esi, %esi + jmp ..B1.13 +..B1.69: + xorl %eax, %eax + jmp ..B1.22 +..B1.70: + xorl %eax, %eax + jmp ..B1.29 +..B1.71: + xorl %eax, %eax + jmp ..B1.36 +..B1.72: + xorl %eax, %eax + jmp ..B1.43 +..B1.73: + xorl %ecx, %ecx + jmp ..B1.50 +..B1.74: + cmpl $16383, %eax + jne ..B1.78 +..B1.75: + cmpl $-2147483648, 12(%ebp) + jne ..B1.78 +..B1.76: + cmpl $0, 8(%ebp) + jne ..B1.78 +..B1.77: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _ones@GOTOFF(%ebx,%eax,8) + fdivl _zeros@GOTOFF(%ebx) + fstpt (%esp) + jmp ..B1.61 +..B1.78: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt (%esp) + jmp ..B1.61 +..B1.79: + xorl %edx, %edx + jmp ..B1.57 + .align 16,0x90 + .type atanhl,@function + .size atanhl,.-atanhl + .data +# -- End atanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 8 +halfs: + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbfe00000 + .type halfs,@object + .size halfs,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q3: + .word 43691 + .word 45330 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 33124 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58478 + .word 29023 + .word 52648 + .word 52428 + .word 16380 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 43686 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 5258 + .word 52447 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 10439 + .word 34405 + .word 9349 + .word 37449 + .word 16380 + .word 0 + .word 25253 + .word 49895 + .word 32943 + .word 58261 + .word 16379 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 43101 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 4657 + .word 52441 + .word 52428 + .word 52428 + .word 16368 + .word 0 + .word 42633 + .word 18723 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 11223 + .word 36719 + .word 14563 + .word 58254 + .word 16379 + .word 0 + .word 64465 + .word 27664 + .word 35746 + .word 47662 + .word 16379 + .word 0 + .word 6969 + .word 8211 + .word 55486 + .word 40329 + .word 16379 + .word 0 + .word 15522 + .word 40807 + .word 33480 + .word 34952 + .word 16379 + .word 0 + .word 44124 + .word 7207 + .word 21918 + .word 61682 + .word 16378 + .word 0 + .word 13236 + .word 62073 + .word 35694 + .word 55158 + .word 16378 + .word 0 + .word 859 + .word 55468 + .word 55479 + .word 50356 + .word 16378 + .word 0 + .word 19186 + .word 33607 + .word 822 + .word 41715 + .word 16378 + .word 0 + .word 51623 + .word 9477 + .word 49456 + .word 61855 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52416 + .word 16380 + .word 0 + .type _Q,@object + .size _Q,168 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .type _P,@object + .size _P,72 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atanl.S b/external/sgx_libm/ia32/atanl.S new file mode 100644 index 0000000000..71ffec484f --- /dev/null +++ b/external/sgx_libm/ia32/atanl.S @@ -0,0 +1,732 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanl.c" + .text +..TXTST0: +# -- Begin atanl + .text + .align 16,0x90 + .globl atanl +atanl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $72, %esp +..B1.2: + fnstcw 38(%esp) +..B1.3: + movzbl 17(%ebp), %ecx + movzwl 16(%ebp), %eax + andl $128, %ecx + andl $32767, %eax + shrl $7, %ecx + movzwl 38(%esp), %ebx + cmpl $16394, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + jge ..B1.48 +..B1.4: + cmpl $16376, %eax + jge ..B1.38 +..B1.5: + cmpl $16371, %eax + jge ..B1.31 +..B1.6: + cmpl $16365, %eax + jge ..B1.24 +..B1.7: + cmpl $16308, %eax + jge ..B1.17 +..B1.8: + movl %ebx, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.68 +..B1.9: + orl $-64768, %ebx + movw %bx, 36(%esp) +..B1.10: + fldcw 36(%esp) +..B1.11: + movzwl 16(%ebp), %eax + movl $1, %ebx + andl $32767, %eax +..B1.12: + testl %eax, %eax + jle ..B1.64 +..B1.13: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%edx) + fmul %st(1), %st + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%edx) + fstpt (%esp) +..B1.14: + testl %ebx, %ebx + je ..B1.16 +..B1.15: + fldcw 38(%esp) +..B1.16: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.69 +..B1.18: + orl $-64768, %ebx + movw %bx, 36(%esp) +..B1.19: + fldcw 36(%esp) +..B1.20: + movl $1, %eax +..B1.21: + fldt 8(%ebp) + testl %eax, %eax + fldt _P2@GOTOFF(%edx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.23 +..B1.22: + fldcw 38(%esp) +..B1.23: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.24: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.70 +..B1.25: + orl $-64768, %ebx + movw %bx, 36(%esp) +..B1.26: + fldcw 36(%esp) +..B1.27: + movl $1, %eax +..B1.28: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%edx) + fmul %st(1), %st + fldt _P1@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.30 +..B1.29: + fldcw 38(%esp) +..B1.30: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.71 +..B1.32: + orl $-64768, %ebx + movw %bx, 36(%esp) +..B1.33: + fldcw 36(%esp) +..B1.34: + movl $1, %eax +..B1.35: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(2) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.37 +..B1.36: + fldcw 38(%esp) +..B1.37: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.72 +..B1.39: + orl $-64768, %ebx + movw %bx, 36(%esp) +..B1.40: + fldcw 36(%esp) +..B1.41: + movl $1, %ebx +..B1.42: + fldl ones@GOTOFF(%edx,%ecx,8) + fstl 56(%esp) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%edx) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + movzwl 16(%ebp), %eax + andl $32767, %eax + cmpl $16383, %eax + jge ..B1.44 +..B1.43: + fldl _TWO_48H@GOTOFF(%edx) + fld %st(3) + fmul %st(1), %st + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(1) + fxch %st(2) + fmul %st(4), %st + fadd %st(3), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubp %st, %st(3) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(3) + fld %st(3) + movl 12(%esp), %eax + fsub %st(3), %st + fld %st(0) + fxch %st(3) + fsubr %st, %st(5) + fxch %st(4) + fmul %st, %st(5) + fmulp %st, %st(4) + fld %st(1) + fmul %st(1), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fsub %st(2), %st + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fadd %st, %st(4) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fstpt (%esp) + fxch %st(3) + fxch %st(4) + fxch %st(1) + fxch %st(2) + jmp ..B1.45 +..B1.44: + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fld %st(3) + fdivr %st(1), %st + fmulp %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fld %st(3) + movl 12(%esp), %eax + fxch %st(3) + fsubrp %st, %st(1) + fld %st(3) + negl %eax + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + addl $256, %eax + fmulp %st, %st(2) + fldl _TWO_48H@GOTOFF(%edx) + fmul %st, %st(1) + fxch %st(1) + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fmul %st(2), %st + fxch %st(4) + fsubr %st, %st(5) + fld %st(5) + fmul %st(3), %st + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fstpt (%esp) + fldt (%esp) + faddp %st, %st(6) + fld %st(1) + fadd %st(4), %st + fmul %st, %st(3) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(5) + fldl _TWO_48H@GOTOFF(%edx) +..B1.45: + fld %st(1) + shll $4, %eax + fadd %st(6), %st + fdivrp %st, %st(4) + testl %ebx, %ebx + fmul %st(3), %st + fld %st(0) + fadd %st(4), %st + fsubp %st, %st(1) + fld %st(0) + fsubr %st(4), %st + fld %st(2) + fmul %st(2), %st + fxch %st(5) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fxch %st(1) + fstpt 40(%esp) + fldt (%esp) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fldt 40(%esp) + fmulp %st, %st(2) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_P@GOTOFF(%edx) + fmul %st(3), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_P@GOTOFF(%edx) + fmulp %st, %st(4) + fldt _P@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fldl __libm_atanl_table_128@GOTOFF(%edx,%eax) + fld %st(0) + fadd %st(2), %st + fldl _TWO_32H@GOTOFF(%edx) + fmul %st(1), %st + fadd %st, %st(1) + fsubr %st(1), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + faddl 8+__libm_atanl_table_128@GOTOFF(%edx,%eax) + faddp %st, %st(1) + faddp %st, %st(1) + fmull 56(%esp) + fstpt 24(%esp) + je ..B1.80 +..B1.46: + fstpt 12(%esp) +..B1.79: + fldcw 38(%esp) + jmp ..B1.47 +..B1.80: + fstp %st(0) +..B1.47: + fldt 24(%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.48: + movl %ebx, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.76 +..B1.49: + orl $-64768, %ebx + movw %bx, 36(%esp) +..B1.50: + fldcw 36(%esp) +..B1.51: + movzwl 16(%ebp), %eax + movl $1, %ebx + andl $32767, %eax +..B1.52: + cmpl $32767, %eax + je ..B1.73 +..B1.53: + cmpl $16448, %eax + jge ..B1.60 +..B1.54: + fldt 8(%ebp) + xorl %eax, %eax + testl %ecx, %ecx + sete %al + fdivrl ones@GOTOFF(%edx,%eax,8) + fstpt 8(%ebp) + fldt 8(%ebp) + movzwl 16(%ebp), %eax + andl $32767, %eax + fstpt (%esp) + cmpl $16398, %eax + jge ..B1.56 +..B1.55: + fldt (%esp) + fld %st(0) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%edx) + fmul %st(1), %st + fldt _P1@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.59 +..B1.56: + cmpl $16408, %eax + jge ..B1.59 +..B1.57: + fldt _P2@GOTOFF(%edx) + fldt (%esp) + fmul %st, %st(1) + fmul %st, %st(1) + fmul %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) +..B1.59: + fldt .L_2il0floatpacket.4@GOTOFF(%edx) + fldt (%esp) + faddp %st, %st(1) + fldt .L_2il0floatpacket.5@GOTOFF(%edx) + faddp %st, %st(1) + fmull ones@GOTOFF(%edx,%ecx,8) + fstpt (%esp) + jmp ..B1.61 +..B1.60: + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %ecx + fldt _pi_2l@GOTOFF(%ecx,%edx) + fldt _small_value_80@GOTOFF(%ecx,%edx) + fsubrp %st, %st(1) + fstpt (%esp) +..B1.61: + testl %ebx, %ebx + je ..B1.63 +..B1.62: + fldcw 38(%esp) +..B1.63: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.64: + cmpl $0, 12(%ebp) + jne ..B1.66 +..B1.65: + cmpl $0, 8(%ebp) + je ..B1.67 +..B1.66: + fldt _small_value_80@GOTOFF(%edx) + lea (,%ecx,8), %eax + fldt 8(%ebp) + lea (%eax,%ecx,4), %ecx + fldt _small_value_80@GOTOFF(%edx,%ecx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fsubrp %st, %st(1) + fstpt (%esp) + jmp ..B1.14 +..B1.67: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.14 +..B1.68: + xorl %ebx, %ebx + jmp ..B1.12 +..B1.69: + xorl %eax, %eax + jmp ..B1.21 +..B1.70: + xorl %eax, %eax + jmp ..B1.28 +..B1.71: + xorl %eax, %eax + jmp ..B1.35 +..B1.72: + xorl %ebx, %ebx + jmp ..B1.42 +..B1.73: + cmpl $-2147483648, 12(%ebp) + jne ..B1.75 +..B1.74: + cmpl $0, 8(%ebp) + je ..B1.53 +..B1.75: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.61 +..B1.76: + xorl %ebx, %ebx + jmp ..B1.52 + .align 16,0x90 + .type atanl,@function + .size atanl,.-atanl + .data +# -- End atanl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x88,0x19,0x13,0xd3,0x08,0xa3,0x85,0xdd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0xa2,0xda,0x0f,0xc9,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_P2: + .word 43691 + .word 41642 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .type _P2,@object + .size _P2,12 + .align 2 +_P1: + .word 23723 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 22830 + .word 33705 + .word 52154 + .word 52428 + .word 16380 + .word 0 + .type _P1,@object + .size _P1,24 + .align 2 +_P: + .word 43664 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 43235 + .word 52379 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 59507 + .word 38278 + .word 9340 + .word 37449 + .word 49148 + .word 0 + .word 9132 + .word 55602 + .word 8665 + .word 58245 + .word 16379 + .word 0 + .type _P,@object + .size _P,48 + .align 2 +_pi_2l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .type _pi_2l,@object + .size _pi_2l,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_atanl_table_128 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/atanl_table.S b/external/sgx_libm/ia32/atanl_table.S new file mode 100644 index 0000000000..63a3d207c1 --- /dev/null +++ b/external/sgx_libm/ia32/atanl_table.S @@ -0,0 +1,1074 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_atanl_table_128 + .globl __libm_atanl_table_128 +__libm_atanl_table_128: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x55c00000,0x3f7fffd5 + .long 0x4bfcee57,0xbd5115a3 + .long 0x5bc00000,0x3f8fff55 + .long 0x220c39d5,0xbd623595 + .long 0x18800000,0x3f97fee0 + .long 0x286313f8,0xbdaad1e5 + .long 0xbb800000,0x3f9ffd55 + .long 0x542779d7,0x3da4bb12 + .long 0xf1600000,0x3fa3fd65 + .long 0x2e4614e3,0x3d9393b2 + .long 0x84400000,0x3fa7fb81 + .long 0x0c377c7c,0xbd9e4bac + .long 0xf1400000,0x3fabf8dd + .long 0x89fe34b3,0xbd88eef1 + .long 0xb7400000,0x3faff55b + .long 0x39269b0e,0xbda30216 + .long 0xbf000000,0x3fb1f86d + .long 0xbda88e23,0x3da05ab1 + .long 0x0e800000,0x3fb3f59f + .long 0xa7663af4,0xbd8d5314 + .long 0x4fc00000,0x3fb5f232 + .long 0x62a36910,0x3db2d7b2 + .long 0x26000000,0x3fb7ee18 + .long 0x6093567e,0x3d878874 + .long 0x53c00000,0x3fb9e941 + .long 0xd19970eb,0x3dafb9e2 + .long 0xbe400000,0x3fbbe39e + .long 0xbef71e53,0x3dc783e1 + .long 0x70400000,0x3fbddd21 + .long 0xcd620065,0xbdc0a2c8 + .long 0x9ac00000,0x3fbfd5ba + .long 0x39a6ed0d,0xbdb3d092 + .long 0xcce00000,0x3fc0e6ad + .long 0x8a397391,0x3dc40881 + .long 0xfb000000,0x3fc1e1fa + .long 0x92de9bad,0x3da0dc9b + .long 0xb3000000,0x3fc2dcbd + .long 0x386bc7d5,0xbda17803 + .long 0xe8c00000,0x3fc3d6ee + .long 0x61a3b0cf,0x3da989b1 + .long 0xa9c00000,0x3fc4d087 + .long 0x47cc8fc7,0x3dca4f17 + .long 0x1e400000,0x3fc5c981 + .long 0x0a956580,0xbd83d962 + .long 0x89800000,0x3fc6c1d4 + .long 0xb5aad628,0x3db267b1 + .long 0x4c000000,0x3fc7b97b + .long 0xecb84f4b,0xbdd8d27e + .long 0xe2800000,0x3fc8b06e + .long 0xee732cfd,0x3dae70a2 + .long 0xe9400000,0x3fc9a6a8 + .long 0x0e7b00f4,0x3dd64313 + .long 0x1b400000,0x3fca9c23 + .long 0xd177d13a,0x3d593ca1 + .long 0x52c00000,0x3fcb90d7 + .long 0xfdd09de6,0xbdd6cfae + .long 0x8a800000,0x3fcc84bf + .long 0x656f741a,0xbdb7a324 + .long 0xdf400000,0x3fcd77d5 + .long 0x8e6dcbab,0xbdcfa8c9 + .long 0x8e800000,0x3fce6a14 + .long 0x619ac881,0x3dc6ec4d + .long 0xf9400000,0x3fcf5b75 + .long 0x9d52470c,0xbdc37f22 + .long 0x51200000,0x3fd025fa + .long 0x59cb7da1,0xbdd99a4a + .long 0x97c00000,0x3fd09dc5 + .long 0x58b91ce4,0x3dd86362 + .long 0x36200000,0x3fd1151a + .long 0xb2372370,0x3db0c726 + .long 0xa3200000,0x3fd18bf5 + .long 0xd9e6b717,0xbdd40e87 + .long 0x67e00000,0x3fd20255 + .long 0x73e6e6b8,0x3db1f257 + .long 0x20400000,0x3fd27837 + .long 0xbe20c8b2,0x3dd7ef45 + .long 0x7a800000,0x3fd2ed98 + .long 0xb91258ea,0x3da1e7f1 + .long 0x37000000,0x3fd36277 + .long 0x34e2d5da,0x3dbfaf2f + .long 0x29400000,0x3fd3d6d1 + .long 0xbb20d6f9,0xbdd8eecb + .long 0x36c00000,0x3fd44aa4 + .long 0x45437875,0x3da5784d + .long 0x58600000,0x3fd4bdee + .long 0x86c8e20f,0x3dc121cd + .long 0x99400000,0x3fd530ad + .long 0xdb5336ff,0x3dd1cd49 + .long 0x17400000,0x3fd5a2e0 + .long 0x44edea3e,0x3dde0f4e + .long 0x03000000,0x3fd61484 + .long 0x2c6d4754,0x3dc39fc3 + .long 0x9f400000,0x3fd68597 + .long 0xf6d43f59,0x3ddfa6fd + .long 0x41c00000,0x3fd6f619 + .long 0x4738aa32,0x3de26f78 + .long 0x52800000,0x3fd76607 + .long 0x11774372,0x3d97501f + .long 0x4b400000,0x3fd7d560 + .long 0xad3910b8,0x3de1d9fb + .long 0xb9000000,0x3fd84422 + .long 0x4512bfad,0xbde03514 + .long 0x39400000,0x3fd8b24d + .long 0xdb685d1c,0x3dc4364a + .long 0x7cc00000,0x3fd91fde + .long 0x441d0620,0x3dd0c662 + .long 0x45400000,0x3fd98cd5 + .long 0xcf364c48,0x3dcad630 + .long 0x66000000,0x3fd9f930 + .long 0x8df63ee1,0x3dd68001 + .long 0xc3c00000,0x3fda64ee + .long 0x6d909f25,0x3dc847f9 + .long 0x54400000,0x3fdad00f + .long 0x80ecf31e,0xbdddfa74 + .long 0x1dc00000,0x3fdb3a91 + .long 0x9479e139,0xbdd9a393 + .long 0x37800000,0x3fdba473 + .long 0x519a1b47,0x3db89295 + .long 0xc9400000,0x3fdc0db4 + .long 0x19f18c7b,0x3dcd93df + .long 0x0ac00000,0x3fdc7655 + .long 0x5d2e2ffe,0xbdd28e07 + .long 0x43000000,0x3fdcde53 + .long 0x4ba60b78,0x3de609a8 + .long 0xca000000,0x3fdd45ae + .long 0xced7bdd4,0xbdd379d4 + .long 0x05800000,0x3fddac67 + .long 0x97520377,0xbdde44b0 + .long 0x6b000000,0x3fde127b + .long 0xb53d9e72,0x3dbd12bf + .long 0x7f400000,0x3fde77eb + .long 0xde35847d,0xbde452e5 + .long 0xd4400000,0x3fdedcb6 + .long 0xf25d8cc2,0xbd7ef2c7 + .long 0x0b800000,0x3fdf40dd + .long 0x1a3992dc,0xbde5f5f4 + .long 0xd3400000,0x3fdfa45d + .long 0xb94ac7b8,0xbdeeb6d3 + .long 0x73e00000,0x3fe0039c + .long 0x6ccb2527,0xbdee5bf4 + .long 0x09400000,0x3fe034b7 + .long 0xce0c98e5,0xbdeafb77 + .long 0x94e00000,0x3fe0657e + .long 0xeada4afb,0xbdc33cc0 + .long 0x08600000,0x3fe095f3 + .long 0xdbc9bebd,0x3daa58fd + .long 0x5b600000,0x3fe0c614 + .long 0xcd160bd9,0xbdc2f097 + .long 0x8b600000,0x3fe0f5e2 + .long 0x004c46c6,0x3dcf8a54 + .long 0x9be00000,0x3fe1255d + .long 0xf6a1288f,0x3debd2a8 + .long 0x96400000,0x3fe15485 + .long 0xa5d3e2a4,0xbdd1372c + .long 0x88c00000,0x3fe1835a + .long 0xe778c500,0xbda83ec8 + .long 0x87800000,0x3fe1b1dc + .long 0xede17375,0x3de04284 + .long 0xabe00000,0x3fe1e00b + .long 0xc946f944,0xbda014c0 + .long 0x13e00000,0x3fe20de8 + .long 0x43714561,0x3dd04763 + .long 0xe2c00000,0x3fe23b71 + .long 0x3884393e,0x3dd93cd4 + .long 0x40800000,0x3fe268a9 + .long 0xf1765bb0,0xbde69259 + .long 0x59400000,0x3fe2958e + .long 0x4279cec3,0xbddee39e + .long 0x5e000000,0x3fe2c221 + .long 0xd68fde4c,0x3db2232f + .long 0x84000000,0x3fe2ee62 + .long 0xc5d5e9ff,0x3dcb2f29 + .long 0x04a00000,0x3fe31a52 + .long 0xafcd51e1,0xbde78b41 + .long 0x1ce00000,0x3fe345f0 + .long 0xbbf7bb21,0xbde1c844 + .long 0x0e000000,0x3fe3713d + .long 0x14f789e0,0xbdd275f8 + .long 0x1ce00000,0x3fe39c39 + .long 0x9182198f,0xbdd7d1cc + .long 0x91c00000,0x3fe3c6e4 + .long 0x1ebaf6b0,0x3dce3712 + .long 0xb8a00000,0x3fe3f13f + .long 0x260e96db,0xbda690bc + .long 0xe0800000,0x3fe41b4a + .long 0xec29f5ad,0xbde015be + .long 0x5b800000,0x3fe44506 + .long 0xfbb680b2,0xbdca92a8 + .long 0x7f000000,0x3fe46e72 + .long 0x39b9b1b8,0xbdab8ea1 + .long 0xa3200000,0x3fe4978f + .long 0x920cd440,0x3dca7b84 + .long 0x22e00000,0x3fe4c05e + .long 0x02b07c28,0xbda6b1b7 + .long 0x5ba00000,0x3fe4e8de + .long 0x528cf6fb,0x3de6ec04 + .long 0xadc00000,0x3fe51110 + .long 0x91ee6b42,0x3dc7b604 + .long 0x7b800000,0x3fe538f5 + .long 0x72245aa1,0x3dd20c3d + .long 0x29c00000,0x3fe5608d + .long 0x9939cf0e,0x3dcc30d1 + .long 0x1f800000,0x3fe587d8 + .long 0x57972763,0xbdd9a08a + .long 0xc5800000,0x3fe5aed6 + .long 0x5cc4bdc5,0x3de09517 + .long 0x87000000,0x3fe5d589 + .long 0x10028e4c,0x3de69b18 + .long 0xd0c00000,0x3fe5fbf0 + .long 0xf2598180,0x3de5cc49 + .long 0x11400000,0x3fe6220d + .long 0xed487acb,0x3ded7b8d + .long 0xb8c00000,0x3fe647de + .long 0xf84d7eff,0x3df105c7 + .long 0x39400000,0x3fe66d66 + .long 0x2dd4dfd8,0xbdec1f79 + .long 0x05400000,0x3fe692a4 + .long 0x7652e56a,0x3de6fb6a + .long 0x92000000,0x3fe6b798 + .long 0x2bfe3cf4,0x3dd67b31 + .long 0x55000000,0x3fe6dc44 + .long 0xf203bce5,0x3de553ae + .long 0xc5800000,0x3fe700a7 + .long 0xc61a692d,0xbdcee730 + .long 0x5b400000,0x3fe724c3 + .long 0x1948b32e,0x3ddf5cf6 + .long 0x8f800000,0x3fe74897 + .long 0x82f654c3,0x3dfd4707 + .long 0xdcc00000,0x3fe76c24 + .long 0x1952551b,0x3dcb1b01 + .long 0xbd400000,0x3fe78f6b + .long 0x501a8226,0x3ded315e + .long 0xad400000,0x3fe7b26c + .long 0x73a037cc,0xbde1af02 + .long 0x28c00000,0x3fe7d528 + .long 0x553efbc4,0xbdf02fb6 + .long 0xacc00000,0x3fe7f79e + .long 0x02a357f1,0xbdca1d9e + .long 0xb7400000,0x3fe819d0 + .long 0x9bf7622a,0xbdf53ad9 + .long 0xc6000000,0x3fe83bbe + .long 0xf677c77e,0xbdf908ee + .long 0x57800000,0x3fe85d69 + .long 0xe9499180,0xbde33d3a + .long 0xeb000000,0x3fe87ed0 + .long 0xef50a527,0xbdf1d2ea + .long 0xff800000,0x3fe89ff5 + .long 0x2ab734bc,0xbdf40704 + .long 0x14400000,0x3fe8c0d9 + .long 0x6fa901db,0x3decf49d + .long 0xa9800000,0x3fe8e17a + .long 0xc27cfaaa,0x3decc05d + .long 0x3ec00000,0x3fe901db + .long 0xad0ccbcb,0x3df778c3 + .long 0x54400000,0x3fe921fb + .long 0x1a626331,0x3dc0b461 + .long 0x69800000,0x3fe9421b + .long 0x33179a03,0x3de968a9 + .long 0xff000000,0x3fe9627b + .long 0x354bc911,0xbde4662d + .long 0x94400000,0x3fe9831d + .long 0xe277d043,0xbde49a6c + .long 0xa9000000,0x3fe9a400 + .long 0x714fcd89,0x3df8341c + .long 0xbdc00000,0x3fe9c525 + .long 0x942d841a,0xbde3fff9 + .long 0x51000000,0x3fe9e68d + .long 0x767ac319,0x3deb976b + .long 0xe2c00000,0x3fea0837 + .long 0x177cfdb1,0xbdc64fc6 + .long 0xf1800000,0x3fea2a25 + .long 0x75c01427,0xbdda6038 + .long 0xfbc00000,0x3fea4c57 + .long 0x1bb40f2a,0x3dddc330 + .long 0x80000000,0x3fea6ece + .long 0xc850d6e0,0xbde74662 + .long 0xfb400000,0x3fea9189 + .long 0x00d16965,0x3dea0933 + .long 0xeb000000,0x3feab48a + .long 0x1e8b57b9,0x3df59469 + .long 0xcbc00000,0x3fead7d1 + .long 0x6dc9c51f,0x3da93704 + .long 0x18c00000,0x3feafb5f + .long 0x0e891026,0x3ddb9843 + .long 0x4d400000,0x3feb1f33 + .long 0xfdcc9ff9,0xbdcd5129 + .long 0xe3400000,0x3feb434e + .long 0xa0a41a0e,0xbdf7f601 + .long 0x53800000,0x3feb67b2 + .long 0xc9a51699,0xbdd9f2fc + .long 0x16800000,0x3feb8c5e + .long 0x466f670a,0xbdb71b40 + .long 0xa3400000,0x3febb152 + .long 0xd24367a3,0xbddd4273 + .long 0x6f800000,0x3febd690 + .long 0x44f9ee90,0xbdeb8656 + .long 0xef800000,0x3febfc17 + .long 0x4e4b19cd,0x3df32750 + .long 0x97400000,0x3fec21e9 + .long 0x60174932,0xbde5215d + .long 0xd7c00000,0x3fec4805 + .long 0xca509fcf,0xbddae432 + .long 0x21800000,0x3fec6e6d + .long 0x05a2b966,0xbddc81cf + .long 0xe2c00000,0x3fec951f + .long 0x983639ea,0x3dfbe28c + .long 0x89000000,0x3fecbc1e + .long 0xb8fcc54a,0x3de52a75 + .long 0x7ec00000,0x3fece369 + .long 0x6e2bdd53,0x3da4dfc2 + .long 0x2d000000,0x3fed0b01 + .long 0x7c1f76fe,0xbd957dc5 + .long 0xfac00000,0x3fed32e5 + .long 0x45acb642,0x3db3657b + .long 0x4cc00000,0x3fed5b18 + .long 0x3aa43a9e,0x3de16e2c + .long 0x85c00000,0x3fed8398 + .long 0x02a3c6a5,0xbde63ab4 + .long 0x05800000,0x3fedac67 + .long 0x97520377,0xbdee44b0 + .long 0x29800000,0x3fedd584 + .long 0x41999968,0x3dd42635 + .long 0x4d000000,0x3fedfef0 + .long 0x983da38a,0x3dddfdb5 + .long 0xc8400000,0x3fee28ab + .long 0x43526c5d,0xbdf3c808 + .long 0xf0000000,0x3fee52b6 + .long 0xb06de4fa,0xbde63cc3 + .long 0x16c00000,0x3fee7d12 + .long 0xb04e7d93,0x3d998d80 + .long 0x8b800000,0x3feea7bd + .long 0x6af91f30,0x3dfa218b + .long 0x9a800000,0x3feed2b9 + .long 0x97acf689,0x3de1952c + .long 0x8bc00000,0x3feefe06 + .long 0xdb5c4d1a,0xbdc7762a + .long 0xa4000000,0x3fef29a4 + .long 0x017c85fc,0xbd6a8dc3 + .long 0x24800000,0x3fef5594 + .long 0xbbbb718e,0x3da8e661 + .long 0x4a800000,0x3fef81d5 + .long 0x497cd73d,0x3dc8572a + .long 0x4f400000,0x3fefae68 + .long 0xae6e18fa,0x3de7cbff + .long 0x68000000,0x3fefdb4d + .long 0x7ea78d48,0x3deeec8a + .long 0x62e00000,0x3ff00442 + .long 0x3c43ac1a,0xbdc110e6 + .long 0x4a400000,0x3ff01b07 + .long 0x75bc4774,0x3df01b3f + .long 0x7e400000,0x3ff031f5 + .long 0x4ce2d096,0x3df4adbe + .long 0x10800000,0x3ff0490d + .long 0x82c10772,0xbdcfa151 + .long 0x0fe00000,0x3ff0604e + .long 0x37517bd1,0x3dd3bc3a + .long 0x89200000,0x3ff077b8 + .long 0xe01b22eb,0x3de0f5c6 + .long 0x86600000,0x3ff08f4c + .long 0x34b7fb7b,0xbdf9bc3c + .long 0x0e800000,0x3ff0a70a + .long 0xc68f0ff4,0x3df03bcd + .long 0x26800000,0x3ff0bef1 + .long 0x403b5a47,0x3df68b2b + .long 0xd0000000,0x3ff0d701 + .long 0x57ba4ad6,0x3df35a50 + .long 0x09e00000,0x3ff0ef3c + .long 0x38183ba9,0xbde2d69f + .long 0xcfc00000,0x3ff1079f + .long 0xa4c23582,0xbdecaa57 + .long 0x1a600000,0x3ff1202d + .long 0xe7f15aff,0x3dcad893 + .long 0xdf800000,0x3ff138e3 + .long 0x19efe544,0x3dcc4411 + .long 0x11600000,0x3ff151c4 + .long 0xa76ac475,0x3dee5024 + .long 0x9f200000,0x3ff16acd + .long 0x0e8af659,0x3df44c0b + .long 0x74800000,0x3ff18400 + .long 0xa4ca4f57,0xbdba974c + .long 0x79800000,0x3ff19d5c + .long 0x5a25f72a,0x3dc2df62 + .long 0x92e00000,0x3ff1b6e1 + .long 0xd8da3354,0x3de77c88 + .long 0xa1c00000,0x3ff1d08f + .long 0xf49d1082,0x3de2171a + .long 0x83800000,0x3ff1ea66 + .long 0x7ce9b3be,0xbddb5eef + .long 0x11800000,0x3ff20466 + .long 0x1de424cc,0x3df8d09a + .long 0x22000000,0x3ff21e8e + .long 0x394b3186,0xbdef0ac7 + .long 0x86600000,0x3ff238de + .long 0x8bf7b8bf,0x3dc51f77 + .long 0x0cc00000,0x3ff25357 + .long 0x2bb7111b,0x3dfa95fd + .long 0x7f400000,0x3ff26df7 + .long 0x64b0a9b1,0xbdd1512a + .long 0xa3400000,0x3ff288bf + .long 0x18e684e8,0x3df12419 + .long 0x3ac00000,0x3ff2a3af + .long 0xce4f6ebe,0xbdb72e81 + .long 0x03000000,0x3ff2bec6 + .long 0xa69c6179,0xbdee5b5b + .long 0xb5000000,0x3ff2da03 + .long 0x6b22ae89,0x3deff6ff + .long 0x06000000,0x3ff2f568 + .long 0x29a8e5ae,0xbdecb362 + .long 0xa6000000,0x3ff310f2 + .long 0xd243f145,0x3de88f44 + .long 0x41600000,0x3ff32ca3 + .long 0xdff820e0,0x3de68034 + .long 0x7fa00000,0x3ff34879 + .long 0x5295ddf4,0x3dce7ebe + .long 0x03c00000,0x3ff36475 + .long 0x45f88767,0x3de5eab8 + .long 0x6c600000,0x3ff38095 + .long 0x91c711ec,0x3de886b1 + .long 0x53800000,0x3ff39cda + .long 0x10aefe1c,0x3dbb91fe + .long 0x4e800000,0x3ff3b943 + .long 0x4aa2e1c3,0xbdf356bb + .long 0xee000000,0x3ff3d5cf + .long 0x303c34f3,0xbdf0463a + .long 0xbe200000,0x3ff3f27f + .long 0x2b7ef915,0x3de411bd + .long 0x46a00000,0x3ff40f52 + .long 0x472305ef,0xbde8fd54 + .long 0x09e00000,0x3ff42c47 + .long 0x3560ce8b,0x3dfa68cb + .long 0x86a00000,0x3ff4495d + .long 0xacb59491,0xbdfdcdda + .long 0x35a00000,0x3ff46695 + .long 0xc6803028,0x3dcceec5 + .long 0x8c200000,0x3ff483ed + .long 0xae20cd3f,0x3dec628d + .long 0xfa600000,0x3ff4a165 + .long 0x30a5d59f,0xbdf4f20d + .long 0xeb800000,0x3ff4befd + .long 0xd1246921,0x3db30ba3 + .long 0xc6c00000,0x3ff4dcb4 + .long 0x922b65ab,0xbdd37d68 + .long 0xee400000,0x3ff4fa89 + .long 0x60d4a327,0x3dec287f + .long 0xc0000000,0x3ff5187c + .long 0xe85bc1a4,0x3dc49d56 + .long 0x95200000,0x3ff5368c + .long 0x5bd1e523,0xbdb63036 + .long 0xc2600000,0x3ff554b8 + .long 0x9a653fbc,0x3df14f8e + .long 0x98800000,0x3ff57300 + .long 0x8799adbe,0xbdffddce + .long 0x62c00000,0x3ff59163 + .long 0x4677c807,0x3e0ad3a5 + .long 0x6a000000,0x3ff5afe0 + .long 0xf3e67f75,0xbdec3df7 + .long 0xf0c00000,0x3ff5ce76 + .long 0x1e243ad8,0x3dfc26c9 + .long 0x37000000,0x3ff5ed26 + .long 0x82f9d88f,0x3df69c53 + .long 0x78000000,0x3ff60bed + .long 0xa1b60137,0xbde98cd9 + .long 0xeac00000,0x3ff62acb + .long 0x038d593e,0x3de4c370 + .long 0xc3400000,0x3ff649c0 + .long 0x6a610a4b,0xbe067cb1 + .long 0x30800000,0x3ff668cb + .long 0xaa91e345,0xbdcd59a7 + .long 0x5f000000,0x3ff687ea + .long 0xbb3e0da7,0x3de1c66a + .long 0x77400000,0x3ff6a71d + .long 0x447484ba,0xbdf49f35 + .long 0x9e000000,0x3ff6c663 + .long 0x9fa408f5,0xbdfb4727 + .long 0xf5000000,0x3ff6e5bb + .long 0x95fe5c11,0xbdfc59cc + .long 0x9a800000,0x3ff70525 + .long 0x0aa8b52d,0x3e02d604 + .long 0xaac00000,0x3ff7249f + .long 0x4ae67c31,0xbe034aef + .long 0x3d400000,0x3ff74429 + .long 0x0226c6c8,0x3dc20b8b + .long 0x68800000,0x3ff763c1 + .long 0xf8a3257f,0xbe0161b1 + .long 0x3f000000,0x3ff78367 + .long 0xc02f3514,0x3ddcbd24 + .long 0xd2000000,0x3ff7a319 + .long 0xa2288de1,0xbdfc01f8 + .long 0x2f400000,0x3ff7c2d8 + .long 0x81b988ed,0x3ddbfe74 + .long 0x63800000,0x3ff7e2a1 + .long 0xc80c4d5f,0xbe01cc20 + .long 0x78400000,0x3ff80274 + .long 0xb8ab545b,0x3df3aa42 + .long 0x76800000,0x3ff82250 + .long 0xf0c39b49,0x3de58a51 + .long 0x64c00000,0x3ff84234 + .long 0x594dab29,0xbdd68427 + .long 0x48000000,0x3ff8621f + .long 0x7b64bb5f,0x3e015323 + .long 0x24c00000,0x3ff88210 + .long 0x0881fe1d,0xbddc84da + .long 0xfd400000,0x3ff8a205 + .long 0xb3f75cfe,0x3df5873f + .long 0xd4000000,0x3ff8c1ff + .long 0x90244e94,0xbdfcfc58 + .long 0xa9800000,0x3ff8e1fc + .long 0x22533dd2,0x3de96c66 + .long 0x7ec00000,0x3ff901fb + .long 0xd7b5cc04,0x3e0738ae + .long 0x54400000,0x3ff921fb + .long 0x1a626331,0x3dd0b461 + .long 0x29800000,0x3ff941fb + .long 0xddc59991,0x3df9e8d2 + .long 0xff000000,0x3ff961f9 + .long 0x0fe1b542,0xbdd1700a + .long 0xd4c00000,0x3ff981f6 + .long 0xe2aa7fd3,0xbdfaa976 + .long 0xab400000,0x3ff9a1f0 + .long 0x4d8c56ca,0xbdea5a1e + .long 0x83c00000,0x3ff9c1e6 + .long 0x1ea36240,0x3deef6ce + .long 0x60800000,0x3ff9e1d7 + .long 0x69984526,0xbdfa4c16 + .long 0x43c00000,0x3ffa01c2 + .long 0xc70938c6,0x3debf674 + .long 0x32000000,0x3ffa21a6 + .long 0x5984e061,0xbdc357c3 + .long 0x30400000,0x3ffa4182 + .long 0x56f44585,0xbde6a024 + .long 0x45000000,0x3ffa6155 + .long 0x0ea4e62b,0x3e05f939 + .long 0x79400000,0x3ffa811e + .long 0xcc2cf5d5,0x3db5a936 + .long 0xd6c00000,0x3ffaa0dc + .long 0xd0a64087,0xbdfba3d6 + .long 0x69800000,0x3ffac08f + .long 0xd256453b,0x3db2ae75 + .long 0x40000000,0x3ffae035 + .long 0x3f3bbe4b,0x3e058eca + .long 0x6b400000,0x3ffaffcd + .long 0xb3b162ff,0x3dd862fc + .long 0xfe000000,0x3ffb1f56 + .long 0xdd01d604,0xbdf10ff0 + .long 0x0e000000,0x3ffb3ed1 + .long 0x882038c2,0xbdfd51d7 + .long 0xb3c00000,0x3ffb5e3a + .long 0xdcd07256,0xbdfb4c02 + .long 0x0ac00000,0x3ffb7d93 + .long 0xd32ac572,0xbdfc5ea7 + .long 0x31400000,0x3ffb9cd9 + .long 0xd1a5b653,0x3dfcf965 + .long 0x49800000,0x3ffbbc0c + .long 0x0dbaa75b,0xbda1209a + .long 0x78000000,0x3ffbdb2b + .long 0x0506dc03,0x3de80acb + .long 0xe5800000,0x3ffbfa35 + .long 0x3c1973a2,0xbde558d9 + .long 0xbdc00000,0x3ffc192a + .long 0xa4abd834,0xbdc03c3b + .long 0x30c00000,0x3ffc3809 + .long 0x50f9e6e6,0xbe056fb1 + .long 0x71800000,0x3ffc56d0 + .long 0xeb914ded,0xbdec8445 + .long 0xb7c00000,0x3ffc757f + .long 0x90f3093f,0xbdf3cc98 + .long 0x3e800000,0x3ffc9416 + .long 0x87247153,0x3df6792c + .long 0x45800000,0x3ffcb293 + .long 0x0041a18b,0x3df2b2e6 + .long 0x10000000,0x3ffcd0f6 + .long 0x8a656fab,0x3e041bff + .long 0xe6000000,0x3ffcef3d + .long 0xf2cbf1dc,0x3df70aa1 + .long 0x13400000,0x3ffd0d6a + .long 0xf97727f5,0x3e04de99 + .long 0xe8800000,0x3ffd2b79 + .long 0xc096e590,0x3dd71a16 + .long 0xba400000,0x3ffd496c + .long 0x8ce47feb,0xbdd6e83c + .long 0xe2000000,0x3ffd6741 + .long 0xa721fa7e,0xbe09633a + .long 0xbd000000,0x3ffd84f8 + .long 0x407bac1a,0x3ddca5d9 + .long 0xae400000,0x3ffda290 + .long 0x1147c641,0xbdc59e12 + .long 0x1c400000,0x3ffdc009 + .long 0xb620caf9,0x3dfa28e9 + .long 0x73000000,0x3ffddd61 + .long 0x2b9ed46c,0xbdfb43a8 + .long 0x22400000,0x3ffdfa99 + .long 0x630c9ceb,0xbe0cebfa + .long 0x9e800000,0x3ffe17af + .long 0xafa0c61c,0x3debe2ca + .long 0x61c00000,0x3ffe34a4 + .long 0x58615a48,0x3e0a6c6d + .long 0xea400000,0x3ffe5176 + .long 0xf771b50e,0x3dfe5151 + .long 0xba800000,0x3ffe6e26 + .long 0xbd6d668c,0x3df8a06a + .long 0x5a000000,0x3ffe8ab3 + .long 0xd7d4135c,0x3dfbb0eb + .long 0x55000000,0x3ffea71c + .long 0xb09906dc,0x3dda8442 + .long 0x3c000000,0x3ffec361 + .long 0xc44da8a3,0x3dfc16d7 + .long 0xa4c00000,0x3ffedf81 + .long 0xae5890d5,0xbdc4d95c + .long 0x29000000,0x3ffefb7d + .long 0x3d218a26,0xbdfb75a7 + .long 0x67400000,0x3fff1753 + .long 0xf1656f6c,0xbe0172f4 + .long 0x02800000,0x3fff3304 + .long 0xdf863851,0xbdcf6b8e + .long 0xa2800000,0x3fff4e8e + .long 0xa205a470,0x3df6b3e1 + .long 0xf3800000,0x3fff69f2 + .long 0xa18096af,0xbdde853c + .long 0xa5800000,0x3fff8530 + .long 0x607f6255,0x3df787de + .long 0x6dc00000,0x3fffa047 + .long 0x542c5109,0x3de39a31 + .long 0x05400000,0x3fffbb37 + .long 0x176aa69e,0xbde193d1 + .long 0x29400000,0x3fffd5ff + .long 0x4cbab80a,0x3de95cf6 + .long 0x9bc00000,0x3ffff09f + .long 0x9e85df82,0xbdf23bcc + .long 0x11200000,0x4000058c + .long 0x644dc57f,0xbdfa49be + .long 0x43400000,0x400012b4 + .long 0x29d6ca5c,0x3df7df94 + .long 0x4b800000,0x40001fc8 + .long 0x90b2f333,0xbdf07669 + .long 0x12800000,0x40002cc8 + .long 0xd8d73d10,0x3dee63d8 + .long 0x83600000,0x400039b3 + .long 0xa3aad512,0xbda62b9d + .long 0x8ac00000,0x4000468a + .long 0x20c417ef,0x3dfc9bec + .long 0x17800000,0x4000534d + .long 0x07b1cace,0x3dd7f911 + .long 0x1a000000,0x40005ffb + .long 0xaefbad1c,0x3de4074a + .long 0x84a00000,0x40006c94 + .long 0x7ea63b40,0x3df40e25 + .long 0x4b800000,0x40007919 + .long 0x397bcf5e,0x3df9321e + .long 0x64800000,0x40008589 + .long 0xa7ccd3c1,0x3dd346b9 + .long 0xc7200000,0x400091e4 + .long 0xefccf9c7,0xbdfb00e1 + .long 0x6c800000,0x40009e2b + .long 0xd036d9d3,0xbe04a851 + .long 0x4f600000,0x4000aa5d + .long 0xad856126,0xbdec74ff + .long 0x6c400000,0x4000b67a + .long 0x9512327c,0xbde6003f + .long 0xc1000000,0x4000c282 + .long 0x6614515e,0xbdec61f5 + .long 0x4d000000,0x4000ce76 + .long 0xe577796c,0xbddf8674 + .long 0x11200000,0x4000da55 + .long 0x0f49689f,0x3dc0b366 + .long 0x0fa00000,0x4000e61f + .long 0x1d23a023,0x3dffdf4d + .long 0x4c600000,0x4000f1d4 + .long 0x00a32d5c,0xbdfc94de + .long 0xcc000000,0x4000fd74 + .long 0x7b12a50e,0x3de89cb5 + .long 0x95200000,0x40010900 + .long 0x7f633dfc,0xbde8a71b + .long 0xaf200000,0x40011477 + .long 0xa22c576e,0xbddf043b + .long 0x22e00000,0x40011fda + .long 0xab4658e4,0xbdf583b2 + .long 0xfa400000,0x40012b27 + .long 0xc88a542e,0xbddc7052 + .long 0x40600000,0x40013661 + .long 0xb5fa251c,0x3dfc7430 + .long 0x01a00000,0x40014186 + .long 0x10065ac4,0x3dd53d2d + .long 0x4b200000,0x40014c96 + .long 0xfd4d5831,0x3dde4bf5 + .long 0x2b400000,0x40015792 + .long 0xdd63dfb7,0x3de0ceee + .long 0xb1400000,0x40016279 + .long 0xf44e5d9e,0x3e05a47a + .long 0xeda00000,0x40016d4c + .long 0xa9526aef,0xbd9c196f + .long 0xf1600000,0x4001780b + .long 0xddc7ed97,0xbdf1c75a + .long 0xce800000,0x400182b6 + .long 0x4537fbd1,0x3e03f9fd + .long 0x98600000,0x40018d4d + .long 0xcd4bedf5,0xbe0643b6 + .long 0x62400000,0x400197d0 + .long 0x7be31051,0xbdceee39 + .long 0x41000000,0x4001a23f + .long 0xe43916c2,0x3dab5864 + .long 0x49e00000,0x4001ac9a + .long 0xe65659f4,0x3dca8519 + .long 0x92e00000,0x4001b6e1 + .long 0xd8da3354,0x3df77c88 + .long 0x32e00000,0x4001c115 + .long 0xe2f9d62a,0xbde910ea + .long 0x41200000,0x4001cb35 + .long 0xc81075db,0xbe002e72 + .long 0xd5a00000,0x4001d541 + .long 0x272999cb,0xbdf8dc27 + .long 0x09000000,0x4001df3b + .long 0x46435ee9,0x3de1604f + .long 0xf4a00000,0x4001e920 + .long 0x86402d52,0xbdf84ccd + .long 0xb2000000,0x4001f2f3 + .long 0x7a698864,0xbdc1d852 + .long 0x5b800000,0x4001fcb3 + .long 0xe9f5ef5e,0x3de8ef47 + .long 0x0be00000,0x40020660 + .long 0x9d33bfe4,0x3deef548 + .long 0xde400000,0x40020ff9 + .long 0x9fe2acc6,0x3e07899e + .long 0xee800000,0x40021980 + .long 0x8586539c,0xbdea2a41 + .long 0x58600000,0x400222f5 + .long 0x8233d068,0xbde59a3f + .long 0x38600000,0x40022c57 + .long 0xafae28e0,0x3df61d5b + .long 0xab600000,0x400235a6 + .long 0xc0e105c1,0x3e07d566 + .long 0xcea00000,0x40023ee3 + .long 0x23305012,0x3de397c9 + .long 0xbf600000,0x4002480e + .long 0x7f34ee7e,0x3dedaddf + .long 0x9b800000,0x40025127 + .long 0x7552e9aa,0x3d940c8b + .long 0x80e00000,0x40025a2e + .long 0xe67562cc,0x3e06022a + .long 0x8e200000,0x40026323 + .long 0x36711271,0xbdfe8be0 + .long 0xe1400000,0x40026c06 + .long 0x34e171b8,0x3e03c83c + .long 0x99800000,0x400274d8 + .long 0x22b44c41,0xbdea7471 + .long 0xd5600000,0x40027d98 + .long 0x0cc87ce6,0x3dfb5597 + .long 0xb4400000,0x40028647 + .long 0xf1599d09,0x3df3fd61 + .long 0x55400000,0x40028ee5 + .long 0x432216e7,0x3e0074b2 + .long 0xd7e00000,0x40029771 + .long 0x55426d45,0x3dede47d + .long 0x5b800000,0x40029fed + .long 0xa81068a7,0x3e059214 + .long 0x00000000,0x4002a858 + .long 0xb830bfcf,0xbdd5c614 + .long 0xe4c00000,0x4002b0b1 + .long 0xaba3f9d3,0x3e092d16 + .long 0x2a000000,0x4002b8fb + .long 0xc83d37e0,0xbdefb3d7 + .long 0xef200000,0x4002c133 + .long 0x7f368cdd,0x3e0953b3 + .long 0x54800000,0x4002c95c + .long 0x27d71621,0x3df28d47 + .long 0x79e00000,0x4002d174 + .long 0x316a6da4,0xbdd16890 + .long 0x7f400000,0x4002d97c + .long 0x961b1ace,0xbdf9bc5b + .long 0x84800000,0x4002e184 + .long 0xe02465ce,0x3df0e16c + .long 0xa9e00000,0x4002e99c + .long 0x50352ef1,0xbdd817f9 + .long 0x0f400000,0x4002f1c5 + .long 0x1551a7ab,0xbe03100f + .long 0xd4800000,0x4002f9fd + .long 0xa40bccd6,0xbe01cf65 + .long 0x19800000,0x40030247 + .long 0x7c81d6bf,0x3dfa2d1b + .long 0xfe600000,0x40030aa0 + .long 0x01d5fa59,0x3df1f8ce + .long 0xa2c00000,0x4003130b + .long 0xc1d47c8b,0x3e00b18f + .long 0x26800000,0x40031b87 + .long 0xb6bb61ec,0xbdc357ae + .long 0xa9200000,0x40032413 + .long 0xb27a6369,0xbdf4621b + .long 0x4a200000,0x40032cb1 + .long 0x763f4a8f,0xbdddd864 + .long 0x29000000,0x40033560 + .long 0x71fd6503,0xbded9c9c + .long 0x64e00000,0x40033e20 + .long 0x6523f086,0x3df9c181 + .long 0x1d200000,0x400346f2 + .long 0x95f9190b,0xbdfb092f + .long 0x70600000,0x40034fd5 + .long 0xf5c5232a,0xbdf4ecd6 + .long 0x7d800000,0x400358ca + .long 0xf920fb33,0xbdff7d0c + .long 0x62e00000,0x400361d1 + .long 0x4be8fd7d,0x3de86e2d + .long 0x3f000000,0x40036aea + .long 0x5e8566d0,0xbdc27d37 + .long 0x2fc00000,0x40037415 + .long 0x118d12de,0x3dc5db22 + .long 0x53000000,0x40037d52 + .long 0x56fc208e,0xbe0191c2 + .long 0xc5e00000,0x400386a1 + .long 0x920dd0c2,0x3e0b34f6 + .long 0xa6200000,0x40039003 + .long 0xb58e26b3,0xbe0455cb + .long 0x10000000,0x40039978 + .long 0x34b985e6,0xbe0331cb + .long 0x20200000,0x4003a2ff + .long 0x35fdc794,0xbe0145fa + .long 0xf2800000,0x4003ac98 + .long 0xd680ac6a,0xbdc79adb + .long 0xa2e00000,0x4003b645 + .long 0x9da56c1b,0x3d6f49bd + .long 0x4c600000,0x4003c005 + .long 0x462df6e3,0x3ded84a6 + .long 0x09e00000,0x4003c9d8 + .long 0xa5f60849,0xbdfb2be9 + .long 0xf5600000,0x4003d3bd + .long 0x8540d783,0x3dceb909 + .long 0x28c00000,0x4003ddb7 + .long 0xfd79b218,0x3e02b1b7 + .long 0xbd400000,0x4003e7c3 + .long 0x31f55b0e,0x3e067217 + .long 0xcb800000,0x4003f1e3 + .long 0x4546b57a,0x3df90fbe + .long 0x6b600000,0x4003fc17 + .long 0xfd77cb88,0x3e0a855f + .long 0xb4800000,0x4004065e + .long 0x2dfdfe4d,0x3de26d4b + .long 0xbd600000,0x400410b9 + .long 0x5950035e,0x3de7590b + .long 0x9c200000,0x40041b28 + .long 0x03462c6f,0x3df06510 + .long 0x66200000,0x400425ab + .long 0x467966c2,0xbddbc526 + .long 0x2fe00000,0x40043042 + .long 0xb6a62d3d,0xbdfb6cb1 + .long 0x0d200000,0x40043aed + .long 0x27372402,0xbe00d8ae + .long 0x10c00000,0x400445ac + .long 0x24de2821,0x3de9ef5d + .long 0x4d200000,0x4004507f + .long 0x14d2f0d7,0xbdfec1ad + .long 0xd3200000,0x40045b66 + .long 0x945f6a25,0x3dd07f45 + .long 0xb3400000,0x40046662 + .long 0x51d9d163,0x3dd3d12d + .long 0xfcc00000,0x40047172 + .long 0x3f20ced0,0x3ddcdff6 + .long 0xbe000000,0x40047c97 + .long 0xc460b56d,0xbdefd9cf + .long 0x04200000,0x400487d1 + .long 0x85ec5f71,0x3df3a35d + .long 0xdba00000,0x4004931e + .long 0x80efdcb7,0xbdfdf504 + .long 0x4f400000,0x40049e81 + .long 0xbc54e040,0x3df44857 + .long 0x69400000,0x4004a9f8 + .long 0x937b6963,0x3df8dad6 + .long 0x32600000,0x4004b584 + .long 0x203bef0d,0x3d8c770b + .long 0xb2000000,0x4004c124 + .long 0x6a367be0,0x3e048e13 + .long 0xeec00000,0x4004ccd9 + .long 0x4959d5be,0xbdf35804 + .long 0xed400000,0x4004d8a3 + .long 0x23c13aa2,0x3de4e1b8 + .long 0xb1600000,0x4004e482 + .long 0x0d27a8c0,0x3df468e6 + .long 0x3d600000,0x4004f076 + .long 0x86d3f314,0x3dfab843 + .long 0x92200000,0x4004fc7e + .long 0x9e52e3a3,0x3df78768 + .long 0xaf200000,0x4005089b + .long 0xaab9c284,0xbe029f1b + .long 0x92000000,0x400514cd + .long 0x179103ea,0xbde45027 + .long 0x37400000,0x40052114 + .long 0x61cb6216,0x3e03c415 + .long 0x99e00000,0x40052d6f + .long 0xa75a55d3,0x3dded669 + .long 0xb2e00000,0x400539df + .long 0xcb6409f3,0xbde955aa + .long 0x79c00000,0x40054664 + .long 0xab71c36a,0xbdde1b72 + .long 0xe4600000,0x400552fd + .long 0xe25f9eb7,0x3dc41d1b + .long 0xe6c00000,0x40055fab + .long 0x247755ec,0x3e11a241 + .long 0x73800000,0x40056c6e + .long 0x5982d93b,0x3e07f5ae + .long 0x7b000000,0x40057945 + .long 0x81ce421b,0x3dea714b + .long 0xec000000,0x40058630 + .long 0xe6287509,0xbe10aaa8 + .long 0xb3000000,0x40059330 + .long 0xcdc1a134,0xbe018126 + .long 0xbb000000,0x4005a044 + .long 0x54f98005,0x3e0a53da + .long 0xed800000,0x4005ad6c + .long 0x31fa1c07,0xbe164bbe + .long 0x30800000,0x4005baa9 + .long 0x724fa9e7,0x3dfec315 + .long 0x69c00000,0x4005c7f9 + .long 0x49c8cff7,0xbd839929 + .long 0x7c000000,0x4005d55d + .long 0xa8203893,0xbe1aabb3 + .long 0x47800000,0x4005e2d5 + .long 0x4d9d0f03,0x3dc5d181 + .long 0xab800000,0x4005f060 + .long 0x39a53408,0x3e0a7fb5 + .long 0x84c00000,0x4005fdff + .long 0x01eb07f8,0xbe05ebb4 + .long 0xad400000,0x40060bb1 + .long 0x338ef683,0xbe128b26 + .long 0xfd400000,0x40061976 + .long 0xa822b748,0xbe07c5a2 + .long 0x4ac00000,0x4006274f + .long 0x5b4a549e,0x3e07b699 + .long 0x6a000000,0x4006353a + .long 0xef14ab75,0xbdf8030f + .long 0x2c000000,0x40064338 + .long 0xd329b8ff,0x3dee44e8 + .long 0x60800000,0x40065148 + .long 0xbc20f78f,0xbe13e3e3 + .long 0xd3c00000,0x40065f6a + .long 0x09e8e22c,0x3e11798e + .long 0x51400000,0x40066d9f + .long 0x7dfadb85,0x3e086b2e + .long 0xa1000000,0x40067be5 + .long 0x0b2e31ec,0x3e09f36f + .long 0x89400000,0x40068a3d + .long 0x23a7eaa9,0xbdf1ca09 + .long 0xcd800000,0x400698a6 + .long 0xee7c7516,0xbe0428c8 + .long 0x2f000000,0x4006a721 + .long 0xbdfcb3ab,0x3e0f4af1 + .long 0x6d400000,0x4006b5ac + .long 0x6678c10f,0x3e1197cf + .long 0x45000000,0x4006c448 + .long 0x0097612f,0xbdf8350f + .long 0x70400000,0x4006d2f4 + .long 0xc4ae0128,0xbdeb4341 + .long 0xa7400000,0x4006e1b0 + .long 0x2be5865a,0x3dee7616 + .long 0xa0000000,0x4006f07c + .long 0xbe2a9051,0xbe0d5116 + .long 0x0d800000,0x4006ff58 + .long 0xbe4813cb,0xbda6483b + .long 0xa1400000,0x40070e42 + .long 0xf702ea60,0x3df24157 + .long 0x0a000000,0x40071d3c + .long 0xc8e90440,0x3e11b030 + .long 0xf4800000,0x40072c43 + .long 0x3836de9f,0x3e18b285 + .long 0x0b400000,0x40073b5a + .long 0x707eec44,0x3e0abe53 + .long 0xf6400000,0x40074a7d + .long 0xdf7f7587,0x3e0227a4 + .long 0x5b800000,0x400759af + .long 0x69c4146d,0x3e0cea31 + .long 0xdf000000,0x400768ed + .long 0x2652ac89,0x3e0b070e + .long 0x22800000,0x40077839 + .long 0xb25e69d2,0x3e0029f0 + .long 0xc5800000,0x40078790 + .long 0xf2649c57,0x3e16b25a + .long 0x66400000,0x400796f4 + .long 0x229099f4,0xbe122655 + .long 0x9f800000,0x4007a663 + .long 0x90be8ad7,0x3ded1da0 + .long 0x0b800000,0x4007b5de + .long 0x5c75a10e,0x3e15cced + .long 0x42400000,0x4007c563 + .long 0xd4519719,0x3e102078 + .long 0xd9800000,0x4007d4f2 + .long 0x690de7e8,0x3e134413 + .long 0x65c00000,0x4007e48c + .long 0xfddbebee,0xbdf0721c + .long 0x79000000,0x4007f42f + .long 0x537a47ec,0x3e0472f8 + .long 0xa4800000,0x400803db + .long 0xd84d1e5e,0x3e03e9a5 + .long 0x77800000,0x40081390 + .long 0xa415fcda,0xbdf626df + .long 0x7f800000,0x4008234d + .long 0x279a2fcb,0xbe013463 + .long 0x48c00000,0x40083312 + .long 0x9b75c695,0x3dd9ba26 + .long 0x5e400000,0x400842de + .long 0x2aa926e7,0x3e00b4da + .long 0x49c00000,0x400852b1 + .long 0x44adccf7,0xbe0a51cf + .long 0x93400000,0x4008628a + .long 0x16e3fd45,0xbe15f538 + .long 0xc1c00000,0x40087269 + .long 0xce0df60f,0x3de6596a + .long 0x5c000000,0x4008824e + .long 0x5260007c,0xbe17daca + .long 0xe6400000,0x40089237 + .long 0xff43ed28,0x3df7d75a + .long 0xe5800000,0x4008a225 + .long 0x6082ccc7,0xbe0886df + .long 0xdc800000,0x4008b217 + .long 0xfbad1fdf,0xbdb73f18 + .long 0x4e400000,0x4008c20d + .long 0xc29df075,0xbdf92ca0 + .long 0xbc800000,0x4008d205 + .long 0xdc3f35d7,0xbdc7a0f1 + .long 0xa8c00000,0x4008e200 + .long 0xfa8ff5ca,0x3df9b457 + .long 0x94400000,0x4008f1fd + .long 0x1262ed72,0xbe1633d0 + .long 0xff000000,0x400901fb + .long 0x541ee425,0xbe078e5a + .long 0x69800000,0x400911fb + .long 0xfb02186a,0x3e094f3a + .long 0x54400000,0x400921fb + .long 0x1a626331,0x3de0b461 + .type __libm_atanl_table_128,@object + .size __libm_atanl_table_128,8208 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cabs.S b/external/sgx_libm/ia32/cabs.S new file mode 100644 index 0000000000..b66ec717a8 --- /dev/null +++ b/external/sgx_libm/ia32/cabs.S @@ -0,0 +1,76 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cabs.c" + .text +..TXTST0: +# -- Begin cabs + .text + .align 16,0x90 + .globl cabs +cabs: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $60, %esp + fldl 16(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpl (%esp) + fldl 8(%ebp) + fstpl 8(%esp) + call hypot@PLT +..B1.4: + addl $60, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type cabs,@function + .size cabs,.-cabs + .data +# -- End cabs + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cabsf.S b/external/sgx_libm/ia32/cabsf.S new file mode 100644 index 0000000000..382d1d02c4 --- /dev/null +++ b/external/sgx_libm/ia32/cabsf.S @@ -0,0 +1,71 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cabsf.c" + .text +..TXTST0: +# -- Begin cabsf + .text + .align 16,0x90 + .globl cabsf +cabsf: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $24, %esp + flds 36(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpl (%esp) + flds 32(%esp) + fstpl 8(%esp) + call hypot@PLT +..B1.4: + addl $24, %esp + popl %ebx + ret + .align 16,0x90 + .type cabsf,@function + .size cabsf,.-cabsf + .data +# -- End cabsf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cabsl.S b/external/sgx_libm/ia32/cabsl.S new file mode 100644 index 0000000000..300d337946 --- /dev/null +++ b/external/sgx_libm/ia32/cabsl.S @@ -0,0 +1,76 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cabsl.c" + .text +..TXTST0: +# -- Begin cabsl + .text + .align 16,0x90 + .globl cabsl +cabsl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $60, %esp + fldt 20(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpt (%esp) + fldt 8(%ebp) + fstpt 12(%esp) + call hypotl@PLT +..B1.4: + addl $60, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type cabsl,@function + .size cabsl,.-cabsl + .data +# -- End cabsl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cacos.S b/external/sgx_libm/ia32/cacos.S new file mode 100644 index 0000000000..96bcfa3631 --- /dev/null +++ b/external/sgx_libm/ia32/cacos.S @@ -0,0 +1,779 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacos.c" + .text +..TXTST0: +# -- Begin cacos + .text + .align 16,0x90 + .globl cacos +cacos: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 192(%esp) + fstl 176(%esp) + fstpl 184(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 18(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %ecx + jge ..B1.38 +..B1.4: + testl %ecx, %ecx + jle ..B1.64 +..B1.5: + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B1.38 +..B1.6: + testl %edx, %edx + jle ..B1.62 +..B1.7: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.61 +..B1.8: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movl $1, %edi +..B1.11: + fldl 12(%ebp) + fstl 160(%esp) + fabs + fldl 20(%ebp) + fstl 168(%esp) + fabs + fld %st(0) + fmul %st(1), %st + fstpt 120(%esp) + fldt 120(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fld %st(0) + fsubr %st(4), %st + fld %st(0) + fmul %st(1), %st + fadd %st(3), %st + fsqrt + fstpt 88(%esp) + fldt 88(%esp) + fld %st(2) + fadd %st(6), %st + fld %st(0) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(4) + fsqrt + fstpt 104(%esp) + fldt 104(%esp) + fxch %st(1) + fucom %st(2) + fnstsw %ax + faddp %st, %st(1) + fxch %st(1) + fstpt 136(%esp) + sahf + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st, %st(1) + jp ..B1.12 + je ..B1.13 +..B1.12: + fldt 88(%esp) + fldt 136(%esp) + fsubrp %st, %st(1) + fstpt 72(%esp) + jmp ..B1.14 +..B1.13: + fxch %st(4) + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(4) +..B1.14: + fldt _Bcross@GOTOFF(%ebx) + fmul %st(2), %st + fcomp %st(6) + fnstsw %ax + sahf + jbe ..B1.16 +..B1.15: + fstp %st(4) + fld %st(4) + addl $-16, %esp + fdiv %st(1), %st + fstpt (%esp) + fxch %st(4) + fstpl 80(%esp) + fxch %st(1) + fstpt 16(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + call acosl@PLT +..B1.104: + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + fldl 80(%esp) + addl $16, %esp + jmp ..B1.19 +..B1.16: + fxch %st(2) + fcom %st(5) + fnstsw %ax + sahf + jb ..B1.18 +..B1.17: + fstp %st(4) + addl $-32, %esp + fld %st(2) + fld %st(1) + fadd %st(6), %st + fmul %st(3), %st + fldt 136(%esp) + faddp %st, %st(2) + fldt 152(%esp) + fdivp %st, %st(2) + fldt 104(%esp) + faddp %st, %st(2) + fmulp %st, %st(1) + fsqrt + fstpt (%esp) + fxch %st(4) + fstpt 12(%esp) + fldt 12(%esp) + fstpl 96(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + fstpt 80(%esp) + call atan2l@PLT + jmp ..B1.106 +..B1.18: + fxch %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(3) + fstpt (%esp) + fldt (%esp) + addl $-32, %esp + fxch %st(3) + fadd %st(5), %st + fldt 136(%esp) + faddp %st, %st(4) + fdiv %st, %st(3) + fldt 168(%esp) + fldt 120(%esp) + faddp %st, %st(1) + fdivrp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fsqrt + fmulp %st, %st(3) + fxch %st(2) + fstpt (%esp) + fxch %st(2) + fstpt 12(%esp) + fldt 12(%esp) + fstpl 96(%esp) + fxch %st(1) + fstpt 48(%esp) + fstpt 64(%esp) + fldt 32(%esp) + fstpt 32(%esp) + fldt 80(%esp) + fstpt 80(%esp) + call atan2l@PLT +..B1.106: + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldl 96(%esp) + addl $32, %esp +..B1.19: + fldt _Across@GOTOFF(%ebx) + fcomp %st(5) + fnstsw %ax + sahf + jb ..B1.24 +..B1.20: + fldt 104(%esp) + faddp %st, %st(2) + fcomp %st(3) + fnstsw %ax + fldt 120(%esp) + fdivp %st, %st(1) + sahf + jae ..B1.22 + jp ..B1.22 +..B1.21: + fldt 72(%esp) + fldt 120(%esp) + fdivp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + jmp ..B1.23 +..B1.22: + fldt 88(%esp) + fldt 136(%esp) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.23: + addl $-16, %esp + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%esp) + fstpt 16(%esp) + call log1pl@PLT + jmp ..B1.108 +..B1.24: + fstp %st(1) + fstp %st(1) + fstp %st(0) + fld %st(1) + addl $-16, %esp + fmul %st(2), %st + fsubp %st, %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%esp) + fstpt 16(%esp) + call logl@PLT +..B1.108: + fldt 16(%esp) + addl $16, %esp +..B1.25: + fldl _DBL_PZERO@GOTOFF(%ebx) + fcoml 160(%esp) + fnstsw %ax + sahf + jbe ..B1.27 +..B1.26: + fldt _LDBL_PPI@GOTOFF(%ebx) + fsubp %st, %st(2) +..B1.27: + fldl 168(%esp) + fcompp + fnstsw %ax + sahf + jbe ..B1.29 +..B1.28: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fmulp %st, %st(2) +..B1.29: + fstpl 176(%esp) + movzwl 182(%esp), %edx + testl $32752, %edx + fstpl 184(%esp) + jne ..B1.32 +..B1.30: + testl $1048575, 180(%esp) + jne ..B1.35 +..B1.31: + cmpl $0, 176(%esp) + jne ..B1.35 +..B1.32: + movzwl 190(%esp), %edx + testl $32752, %edx + jne ..B1.36 +..B1.33: + testl $1048575, 188(%esp) + jne ..B1.35 +..B1.34: + cmpl $0, 184(%esp) + je ..B1.36 +..B1.35: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 152(%esp) +..B1.36: + testl %edi, %edi + je ..B1.59 +..B1.37: + fldcw 14(%esp) + jmp ..B1.59 +..B1.38: + testl %ecx, %ecx + jne ..B1.42 +..B1.39: + testl $1048575, 16(%ebp) + jne ..B1.42 +..B1.40: + cmpl $0, 12(%ebp) + jne ..B1.42 +..B1.41: + fldl _DBL_PPIBY2@GOTOFF(%ebx) + fstl 176(%esp) + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddp %st, %st(1) + fstpl 152(%esp) + addl $-16, %esp + fldl 20(%ebp) + fstpl (%esp) + call asinh@PLT +..B1.109: + addl $16, %esp + fchs + fstpl 184(%esp) + jmp ..B1.59 +..B1.42: + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + je ..B1.98 +..B1.115: + cmpl $2047, %ecx +..B1.43: + je ..B1.88 +..B1.44: + cmpl $2047, %edx + je ..B1.85 +..B1.45: + testl %edx, %edx + jne ..B1.54 +..B1.46: + testl $1048575, 24(%ebp) + jne ..B1.54 +..B1.47: + cmpl $0, 20(%ebp) + jne ..B1.54 +..B1.48: + cmpl $1023, %ecx + jl ..B1.52 +..B1.49: + fldl 12(%ebp) + addl $-16, %esp + fabs + fstpl (%esp) + call acosh@PLT +..B1.110: + addl $16, %esp + movzbl 19(%ebp), %edx + testl $128, %edx + fstpl 184(%esp) + je ..B1.51 +..B1.50: + fldl _DBL_PPI@GOTOFF(%ebx) + fstl 176(%esp) + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddp %st, %st(1) + fstpl 152(%esp) + jmp ..B1.53 +..B1.51: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 176(%esp) + jmp ..B1.53 +..B1.52: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 184(%esp) + addl $-16, %esp + fldl 12(%ebp) + fstpl (%esp) + call acos@PLT +..B1.111: + addl $16, %esp + fstpl 176(%esp) +..B1.53: + movzbl 27(%ebp), %edi + shrl $7, %edi + notl %edi + movzbl 191(%esp), %edx + shll $7, %edi + andl $127, %edx + orl %edi, %edx + movb %dl, 191(%esp) + jmp ..B1.59 +..B1.54: + cmpl $2047, %ecx + je ..B1.67 +..B1.55: + jge ..B1.57 +..B1.56: + fldl _DBL_PPIBY2@GOTOFF(%ebx) + fstl 176(%esp) + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddp %st, %st(1) + fstpl 152(%esp) + fldl _DBL_PZERO@GOTOFF(%ebx) + faddl 12(%ebp) + fstpl 152(%esp) + jmp ..B1.58 +..B1.57: + fldl 12(%ebp) + faddl _DBL_PZERO@GOTOFF(%ebx) + fstpl 176(%esp) +..B1.58: + fldl 20(%ebp) + fchs + fstpl 184(%esp) +..B1.59: + movl 176(%esp), %edx + movl %edx, (%esi) + movl 180(%esp), %ecx + movl 184(%esp), %edi + movl 188(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 192(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.66 +..B1.60: + movl %esi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.61: + xorl %edi, %edi + jmp ..B1.11 +..B1.62: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.63: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.38 +..B1.64: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.65: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.38 +..B1.66: + call __stack_chk_fail@PLT +..B1.67: + testl $1048575, 16(%ebp) + jne ..B1.113 +..B1.68: + cmpl $0, 12(%ebp) + jne ..B1.113 +..B1.69: + fldl 12(%ebp) + cmpl $2047, %edx + fmul %st(0), %st + fstpl 184(%esp) + jge ..B1.76 +..B1.70: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.72 +..B1.71: + fldl _DBL_PPI@GOTOFF(%ebx) + fstl 176(%esp) + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddp %st, %st(1) + fstpl 152(%esp) + fldl _DBL_PZERO@GOTOFF(%ebx) + jmp ..B1.73 +..B1.72: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstl 176(%esp) +..B1.73: + movzbl 27(%ebp), %edx + testl $128, %edx + jne ..B1.75 +..B1.74: + movzbl 191(%esp), %edi + movl %edi, %edx + shrl $7, %edi + andl $127, %edx + notl %edi + shll $7, %edi + orl %edi, %edx + movb %dl, 191(%esp) +..B1.75: + faddl 20(%ebp) + fstpl 152(%esp) + jmp ..B1.59 +..B1.76: + testl $1048575, 24(%ebp) + jne ..B1.84 +..B1.77: + cmpl $0, 20(%ebp) + jne ..B1.84 +..B1.78: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.80 +..B1.79: + fldl _DBL_P3PIBY4@GOTOFF(%ebx) + jmp ..B1.81 +..B1.80: + fldl _DBL_PPIBY4@GOTOFF(%ebx) +..B1.81: + movzbl 27(%ebp), %edx + testl $128, %edx + fstl 176(%esp) + jne ..B1.83 +..B1.82: + movzbl 191(%esp), %edi + movl %edi, %edx + shrl $7, %edi + andl $127, %edx + notl %edi + shll $7, %edi + orl %edi, %edx + movb %dl, 191(%esp) +..B1.83: + faddl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fstpl 152(%esp) + jmp ..B1.59 +..B1.84: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 176(%esp) + jmp ..B1.59 +..B1.85: + testl $1048575, 24(%ebp) + jne ..B1.87 +..B1.86: + cmpl $0, 20(%ebp) + je ..B1.54 +..B1.87: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 176(%esp) + fldl 12(%ebp) + fmul %st(0), %st + fstpl 184(%esp) + jmp ..B1.59 +..B1.88: + testl $1048575, 16(%ebp) + jne ..B1.90 +..B1.89: + cmpl $0, 12(%ebp) + je ..B1.92 +..B1.90: + cmpl $2047, %edx + jge ..B1.92 +..B1.91: + fldl 12(%ebp) + fmul %st(0), %st + fstl 176(%esp) + fstpl 184(%esp) + jmp ..B1.59 +..B1.92: + testl $1048575, 16(%ebp) + jne ..B1.94 +..B1.93: + cmpl $0, 12(%ebp) + je ..B1.44 +..B1.94: + cmpl $2047, %edx + jne ..B1.45 +..B1.95: + testl $1048575, 24(%ebp) + jne ..B1.97 +..B1.96: + cmpl $0, 20(%ebp) + je ..B1.85 +..B1.97: + fldl 12(%ebp) + fmul %st(0), %st + fstpl 176(%esp) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 184(%esp) + jmp ..B1.59 +..B1.98: + testl $1048575, 24(%ebp) + jne ..B1.100 +..B1.99: + cmpl $0, 20(%ebp) + je ..B1.112 +..B1.100: + cmpl $2047, %ecx + jge ..B1.43 +..B1.101: + fldl 20(%ebp) + fmul %st(0), %st + fstl 176(%esp) + fstpl 184(%esp) + jmp ..B1.59 +..B1.112: + cmpl $2047, %ecx + je ..B1.88 + jmp ..B1.44 +..B1.113: + cmpl $2047, %ecx + jl ..B1.56 + jmp ..B1.57 + .align 16,0x90 + .type cacos,@function + .size cacos,.-cacos + .data +# -- End cacos + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +_Bcross: + .word -2936 + .word -10277 + .word 29569 + .word -23482 + .word 16382 + .word 0 + .type _Bcross,@object + .size _Bcross,12 + .space 4, 0x00 # pad + .align 16 +_Across: + .word 0 + .word 0 + .word 0 + .word -16384 + .word 16383 + .word 0 + .type _Across,@object + .size _Across,12 + .space 4, 0x00 # pad + .align 16 +_DBL_PZERO: + .long 0 + .long 0 + .type _DBL_PZERO,@object + .size _DBL_PZERO,8 + .space 8, 0x00 # pad + .align 16 +_LDBL_PPI: + .word -15819 + .word 8552 + .word -9566 + .word -14065 + .word 16384 + .word 0 + .type _LDBL_PPI,@object + .size _LDBL_PPI,12 + .space 4, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY2: + .long 1413754136 + .long 1073291771 + .type _DBL_PPIBY2,@object + .size _DBL_PPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPI: + .long 1413754136 + .long 1074340347 + .type _DBL_PPI,@object + .size _DBL_PPI,8 + .space 8, 0x00 # pad + .align 16 +_DBL_P3PIBY4: + .long 2134057426 + .long 1073928572 + .type _DBL_P3PIBY4,@object + .size _DBL_P3PIBY4,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY4: + .long 1413754136 + .long 1072243195 + .type _DBL_PPIBY4,@object + .size _DBL_PPIBY4,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cacosf.S b/external/sgx_libm/ia32/cacosf.S new file mode 100644 index 0000000000..2e7bef3937 --- /dev/null +++ b/external/sgx_libm/ia32/cacosf.S @@ -0,0 +1,638 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacosf.c" + .text +..TXTST0: +# -- Begin cacosf + .text + .align 16,0x90 + .globl cacosf +cacosf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %ebx + subl $124, %esp + fldz + movzwl 10(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %edx + fsts 104(%esp) + fsts 108(%esp) + jge ..B1.28 +..B1.2: + testl %edx, %edx + jle ..B1.50 +..B1.3: + movzwl 14(%ebp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $255, %eax + jge ..B1.91 +..B1.4: + testl %eax, %eax + jle ..B1.49 +..B1.5: + flds 8(%ebp) + fsts 96(%esp) + fld1 + fsts 92(%esp) + fxch %st(1) + fabs + fld %st(0) + fsub %st(2), %st + fld %st(0) + fmul %st(1), %st + fld %st(2) + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(2) + fstl 72(%esp) + flds 12(%ebp) + fsts 100(%esp) + fabs + fld %st(0) + fmul %st(1), %st + fstl 56(%esp) + fadd %st, %st(3) + fxch %st(3) + fsqrt + fstl 64(%esp) + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + fsqrt + fstl 48(%esp) + fxch %st(1) + fucomp %st(2) + fnstsw %ax + faddp %st, %st(1) + fldl .L_2il0floatpacket.6@GOTOFF(%ebx) + sahf + fmul %st, %st(1) + jp ..B1.6 + je ..B1.7 +..B1.6: + fldl 64(%esp) + fsubl 72(%esp) + fstpl 40(%esp) + jmp ..B1.8 +..B1.7: + fxch %st(2) + fstl 40(%esp) + fxch %st(2) +..B1.8: + fldl _Bcross@GOTOFF(%ebx) + fmul %st(2), %st + fcomp %st(4) + fnstsw %ax + sahf + jbe ..B1.10 +..B1.9: + fstp %st(2) + fld %st(2) + fdiv %st(1), %st + fstpl (%esp) + fxch %st(2) + fstps 80(%esp) + fxch %st(2) + fstpl 16(%esp) + fxch %st(1) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + call acos@PLT + jmp ..B1.85 +..B1.10: + flds 92(%esp) + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.12 +..B1.11: + fstp %st(2) + fld %st(3) + fld %st(1) + fadd %st(4), %st + fmul %st(3), %st + fxch %st(1) + faddl 48(%esp) + fdivrl 56(%esp) + faddl 40(%esp) + fmulp %st, %st(1) + fsqrt + fxch %st(3) + fstl 8(%esp) + fxch %st(3) + fstpl (%esp) + fxch %st(2) + fstps 80(%esp) + fxch %st(2) + fstpl 16(%esp) + fxch %st(1) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + call atan2@PLT + jmp ..B1.85 +..B1.12: + fldl 72(%esp) + fld %st(2) + fadd %st(5), %st + fxch %st(6) + fstl 16(%esp) + fxch %st(1) + faddl 64(%esp) + fxch %st(1) + faddl 48(%esp) + fdivr %st(6), %st + fxch %st(1) + fdivrp %st, %st(6) + faddp %st, %st(5) + fmul %st, %st(4) + fxch %st(4) + fsqrt + fmulp %st, %st(2) + fxch %st(2) + fstl 8(%esp) + fxch %st(1) + fstpl (%esp) + fstps 80(%esp) + fxch %st(1) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + fldl 16(%esp) + fstpl 16(%esp) + call atan2@PLT +..B1.85: + flds 84(%esp) + fldl 32(%esp) + fldl 24(%esp) + fldl 16(%esp) + flds 80(%esp) +..B1.13: + fldl _Across@GOTOFF(%ebx) + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.18 +..B1.14: + flds 92(%esp) + fcompp + fnstsw %ax + faddl 48(%esp) + fdivrl 56(%esp) + sahf + jbe ..B1.16 +..B1.15: + fldl 56(%esp) + fdivl 40(%esp) + faddp %st, %st(1) + fmulp %st, %st(1) + jmp ..B1.17 +..B1.16: + fldl 72(%esp) + faddl 64(%esp) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.17: + fxch %st(1) + fadds 92(%esp) + fmul %st(1), %st + fsqrt + faddp %st, %st(1) + fstpl (%esp) + fxch %st(1) + fstpl 16(%esp) + fstps 84(%esp) + call log1p@PLT + jmp ..B1.87 +..B1.18: + fstp %st(1) + fstp %st(1) + fstp %st(0) + fld %st(0) + fmul %st(1), %st + fsubs 92(%esp) + fsqrt + faddp %st, %st(1) + fstpl (%esp) + fxch %st(1) + fstpl 16(%esp) + fstps 84(%esp) + call log@PLT +..B1.87: + flds 84(%esp) + fldl 16(%esp) +..B1.19: + fxch %st(1) + fcoms 96(%esp) + fnstsw %ax + sahf + jbe ..B1.21 +..B1.20: + fxch %st(1) + fsubrl _DBL_PPI@GOTOFF(%ebx) + fxch %st(1) +..B1.21: + flds 100(%esp) + fcompp + fnstsw %ax + sahf + jbe ..B1.23 +..B1.22: + fxch %st(1) + fchs + fxch %st(1) +..B1.23: + fstps 104(%esp) + movzwl 106(%esp), %eax + testl $32640, %eax + fstps 108(%esp) + jne ..B1.25 +..B1.24: + testl $8388607, 104(%esp) + jne ..B1.27 +..B1.25: + movzwl 110(%esp), %eax + testl $32640, %eax + jne ..B1.48 +..B1.26: + testl $8388607, 108(%esp) + je ..B1.48 +..B1.27: + flds .L_2il0floatpacket.11@GOTOFF(%ebx) + fmul %st(0), %st + fstps 88(%esp) + jmp ..B1.48 +..B1.28: + je ..B1.79 +..B1.29: + testl %edx, %edx + jne ..B1.32 +..B1.30: + testl $8388607, 8(%ebp) + jne ..B1.32 +..B1.31: + fstp %st(0) + movl $1070141403, %eax + movl %eax, 104(%esp) + movl %eax, 88(%esp) + addl $4, %esp + pushl 12(%ebp) + call asinhf@PLT +..B1.88: + fchs + fstps 108(%esp) + jmp ..B1.48 +..B1.32: + movzwl 14(%ebp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $255, %eax + je ..B1.76 +..B1.33: + cmpl $255, %edx + je ..B1.69 +..B1.34: + cmpl $255, %eax + je ..B1.95 +..B1.35: + testl %eax, %eax + jne ..B1.43 +..B1.36: + testl $8388607, 12(%ebp) + jne ..B1.43 +..B1.37: + cmpl $127, %edx + jl ..B1.41 +..B1.38: + flds 8(%ebp) + fabs + fstps (%esp) + fstps 84(%esp) + call acoshf@PLT +..B1.89: + flds 84(%esp) + movzbl 11(%ebp), %eax + testl $128, %eax + fxch %st(1) + fstps 108(%esp) + je ..B1.40 +..B1.39: + fstp %st(0) + movl $1078530011, %eax + movl %eax, 104(%esp) + movl %eax, 88(%esp) + jmp ..B1.42 +..B1.40: + fstps 104(%esp) + jmp ..B1.42 +..B1.41: + movl 8(%ebp), %eax + fstps 108(%esp) + movl %eax, (%esp) + call acosf@PLT +..B1.90: + fstps 104(%esp) +..B1.42: + movzbl 15(%ebp), %eax + shrl $7, %eax + notl %eax + movzbl 111(%esp), %edx + shll $7, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 111(%esp) + jmp ..B1.48 +..B1.43: + cmpl $255, %edx + je ..B1.51 +..B1.44: + fstp %st(0) + cmpl $255, %edx + jge ..B1.46 +..B1.45: + movl 8(%ebp), %edx + movl $1070141403, %eax + movl %eax, 88(%esp) + movl %eax, 104(%esp) + movl %edx, 88(%esp) + jmp ..B1.47 +..B1.46: + movl 8(%ebp), %eax + movl %eax, 104(%esp) +..B1.47: + flds 12(%ebp) + fchs + fstps 108(%esp) +..B1.48: + movl 104(%esp), %eax + movl 108(%esp), %edx + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.49: + testl $8388607, 12(%ebp) + jne ..B1.5 + jmp ..B1.91 +..B1.50: + testl $8388607, 8(%ebp) + jne ..B1.3 + jmp ..B1.91 +..B1.51: + testl $8388607, 8(%ebp) + jne ..B1.44 +..B1.52: + flds 8(%ebp) + cmpl $255, %eax + fmul %st(0), %st + fstps 108(%esp) + jge ..B1.59 +..B1.53: + movzbl 11(%ebp), %eax + testl $128, %eax + je ..B1.55 +..B1.54: + fstp %st(0) + movl $1078530011, %eax + movl %eax, 104(%esp) + movl %eax, 88(%esp) + jmp ..B1.56 +..B1.55: + fstps 104(%esp) +..B1.56: + movzbl 15(%ebp), %eax + testl $128, %eax + jne ..B1.58 +..B1.57: + movzbl 111(%esp), %eax + movl %eax, %edx + shrl $7, %eax + andl $127, %edx + notl %eax + shll $7, %eax + orl %eax, %edx + movb %dl, 111(%esp) +..B1.58: + movl 12(%ebp), %eax + movl %eax, 88(%esp) + jmp ..B1.48 +..B1.59: + fstp %st(0) + testl $8388607, 12(%ebp) + jne ..B1.66 +..B1.60: + movzbl 11(%ebp), %eax + testl $128, %eax + je ..B1.62 +..B1.61: + flds .L_2il0floatpacket.9@GOTOFF(%ebx) + jmp ..B1.63 +..B1.62: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) +..B1.63: + movzbl 15(%ebp), %eax + testl $128, %eax + fsts 104(%esp) + jne ..B1.65 +..B1.64: + movzbl 111(%esp), %eax + movl %eax, %edx + shrl $7, %eax + andl $127, %edx + notl %eax + shll $7, %eax + orl %eax, %edx + movb %dl, 111(%esp) +..B1.65: + fadds .L_2il0floatpacket.11@GOTOFF(%ebx) + fstps 88(%esp) + jmp ..B1.48 +..B1.66: + flds 12(%ebp) + fmul %st(0), %st + fstps 104(%esp) + jmp ..B1.48 +..B1.95: + testl $8388607, 12(%ebp) +..B1.67: + je ..B1.43 +..B1.68: + fstp %st(0) + flds 12(%ebp) + fmul %st(0), %st + fstps 104(%esp) + flds 8(%ebp) + fmul %st(0), %st + fstps 108(%esp) + jmp ..B1.48 +..B1.69: + testl $8388607, 8(%ebp) + je ..B1.72 +..B1.70: + cmpl $255, %eax + jge ..B1.94 +..B1.71: + fstp %st(0) + flds 8(%ebp) + fmul %st(0), %st + fsts 104(%esp) + fstps 108(%esp) + jmp ..B1.48 +..B1.72: + je ..B1.34 +..B1.73: + cmpl $255, %eax + jne ..B1.35 +..B1.74: + testl $8388607, 12(%ebp) + je ..B1.67 +..B1.75: + fstp %st(0) + flds 8(%ebp) + fmul %st(0), %st + fstps 104(%esp) + flds 12(%ebp) + fmul %st(0), %st + fstps 108(%esp) + jmp ..B1.48 +..B1.76: + testl $8388607, 12(%ebp) + je ..B1.33 +..B1.77: + cmpl $255, %edx + jge ..B1.33 +..B1.78: + fstp %st(0) + flds 12(%ebp) + fmul %st(0), %st + fsts 104(%esp) + fstps 108(%esp) + jmp ..B1.48 +..B1.79: + testl $8388607, 8(%ebp) + je ..B1.32 +..B1.80: + flds 8(%ebp) + fadd %st(0), %st + fstps 8(%ebp) + movzwl 10(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + jmp ..B1.29 +..B1.91: + cmpl $255, %edx + je ..B1.79 + jmp ..B1.29 +..B1.94: + testl $8388607, 8(%ebp) + jne ..B1.73 + jmp ..B1.34 + .align 16,0x90 + .type cacosf,@function + .size cacosf,.-cacosf + .data +# -- End cacosf + .section .rodata, "a" + .align 16 + .align 16 +_Bcross: + .long 1882913663 + .long 1071941838 + .type _Bcross,@object + .size _Bcross,8 + .space 8, 0x00 # pad + .align 16 +_Across: + .long 0 + .long 1073217536 + .type _Across,@object + .size _Across,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPI: + .long 1413754136 + .long 1074340347 + .type _DBL_PPI,@object + .size _DBL_PPI,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 4 +.L_2il0floatpacket.7: + .long 0x3fc90fdb + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,4 + .align 4 +.L_2il0floatpacket.8: + .long 0x40490fdb + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +.L_2il0floatpacket.9: + .long 0x4016cbe4 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,4 + .align 4 +.L_2il0floatpacket.10: + .long 0x3f490fdb + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +.L_2il0floatpacket.11: + .long 0x00800000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cacosh.S b/external/sgx_libm/ia32/cacosh.S new file mode 100644 index 0000000000..6b85720176 --- /dev/null +++ b/external/sgx_libm/ia32/cacosh.S @@ -0,0 +1,789 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacosh.c" + .text +..TXTST0: +# -- Begin cacosh + .text + .align 16,0x90 + .globl cacosh +cacosh: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 184(%esp) + fstl 168(%esp) + fstpl 176(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 18(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %ecx + jge ..B1.36 +..B1.4: + testl %ecx, %ecx + jle ..B1.71 +..B1.5: + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B1.37 +..B1.6: + testl %edx, %edx + jle ..B1.69 +..B1.7: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.68 +..B1.8: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movl $1, %edi +..B1.11: + fldl 12(%ebp) + fstl 152(%esp) + fabs + fldl 20(%ebp) + fabs + fld %st(0) + fmul %st(1), %st + fstpt 120(%esp) + fldt 120(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fld %st(0) + fsubr %st(4), %st + fld %st(0) + fmul %st(1), %st + fadd %st(3), %st + fsqrt + fstpt 88(%esp) + fldt 88(%esp) + fld %st(2) + fadd %st(6), %st + fld %st(0) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(4) + fsqrt + fstpt 104(%esp) + fldt 104(%esp) + fxch %st(1) + fucom %st(2) + fnstsw %ax + faddp %st, %st(1) + fxch %st(1) + fstpt 136(%esp) + sahf + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st, %st(1) + jp ..B1.12 + je ..B1.13 +..B1.12: + fldt 88(%esp) + fldt 136(%esp) + fsubrp %st, %st(1) + fstpt 72(%esp) + jmp ..B1.14 +..B1.13: + fxch %st(4) + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(4) +..B1.14: + fldt _Bcross@GOTOFF(%ebx) + fmul %st(2), %st + fcomp %st(6) + fnstsw %ax + sahf + jbe ..B1.16 +..B1.15: + fstp %st(4) + fld %st(4) + addl $-16, %esp + fdiv %st(1), %st + fstpt (%esp) + fxch %st(4) + fstpl 80(%esp) + fxch %st(1) + fstpt 16(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + call acosl@PLT +..B1.109: + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + fldl 80(%esp) + addl $16, %esp + jmp ..B1.19 +..B1.16: + fxch %st(2) + fcom %st(5) + fnstsw %ax + sahf + jb ..B1.18 +..B1.17: + fstp %st(4) + addl $-32, %esp + fld %st(2) + fld %st(1) + fadd %st(6), %st + fmul %st(3), %st + fldt 136(%esp) + faddp %st, %st(2) + fldt 152(%esp) + fdivp %st, %st(2) + fldt 104(%esp) + faddp %st, %st(2) + fmulp %st, %st(1) + fsqrt + fstpt (%esp) + fxch %st(4) + fstpt 12(%esp) + fldt 12(%esp) + fstpl 96(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + fstpt 80(%esp) + call atan2l@PLT + jmp ..B1.111 +..B1.18: + fxch %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(3) + fstpt (%esp) + fldt (%esp) + addl $-32, %esp + fxch %st(3) + fadd %st(5), %st + fldt 136(%esp) + faddp %st, %st(4) + fdiv %st, %st(3) + fldt 168(%esp) + fldt 120(%esp) + faddp %st, %st(1) + fdivrp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fsqrt + fmulp %st, %st(3) + fxch %st(2) + fstpt (%esp) + fxch %st(2) + fstpt 12(%esp) + fldt 12(%esp) + fstpl 96(%esp) + fxch %st(1) + fstpt 48(%esp) + fstpt 64(%esp) + fldt 32(%esp) + fstpt 32(%esp) + fldt 80(%esp) + fstpt 80(%esp) + call atan2l@PLT +..B1.111: + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldl 96(%esp) + addl $32, %esp +..B1.19: + fldl _DBL_PZERO@GOTOFF(%ebx) + fcompl 152(%esp) + fnstsw %ax + sahf + jbe ..B1.21 +..B1.20: + fldt _LDBL_PPI@GOTOFF(%ebx) + fsubp %st, %st(6) +..B1.21: + fldt _Across@GOTOFF(%ebx) + movzbl 27(%ebp), %ecx + fcomp %st(5) + fnstsw %ax + fxch %st(5) + fstpl 176(%esp) + andl $-128, %ecx + movzbl 183(%esp), %edx + andl $127, %edx + orl %ecx, %edx + movb %dl, 183(%esp) + sahf + jb ..B1.26 +..B1.22: + fldt 104(%esp) + faddp %st, %st(1) + fxch %st(4) + fcomp %st(2) + fnstsw %ax + fldt 120(%esp) + fdivp %st, %st(4) + sahf + jae ..B1.24 + jp ..B1.24 +..B1.23: + fldt 72(%esp) + fldt 120(%esp) + fdivp %st, %st(1) + faddp %st, %st(4) + fmulp %st, %st(3) + jmp ..B1.25 +..B1.24: + fldt 88(%esp) + fldt 136(%esp) + faddp %st, %st(1) + faddp %st, %st(4) + fmulp %st, %st(3) +..B1.25: + addl $-16, %esp + faddp %st, %st(1) + fmul %st(1), %st + fsqrt + faddp %st, %st(1) + fstpt (%esp) + call log1pl@PLT + jmp ..B1.113 +..B1.26: + fstp %st(0) + fstp %st(0) + fstp %st(2) + fld %st(0) + addl $-16, %esp + fmul %st(1), %st + fsubp %st, %st(2) + fxch %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%esp) + call logl@PLT +..B1.113: + addl $16, %esp + fstpl 168(%esp) +..B1.27: + movzwl 174(%esp), %edx + testl $32752, %edx + jne ..B1.30 +..B1.28: + testl $1048575, 172(%esp) + jne ..B1.33 +..B1.29: + cmpl $0, 168(%esp) + jne ..B1.33 +..B1.30: + movzwl 182(%esp), %edx + testl $32752, %edx + jne ..B1.34 +..B1.31: + testl $1048575, 180(%esp) + jne ..B1.33 +..B1.32: + cmpl $0, 176(%esp) + je ..B1.34 +..B1.33: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 160(%esp) +..B1.34: + testl %edi, %edi + je ..B1.66 +..B1.35: + fldcw 14(%esp) + jmp ..B1.66 +..B1.36: + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %edx +..B1.37: + testl %edx, %edx + jne ..B1.49 +..B1.38: + testl $1048575, 24(%ebp) + jne ..B1.49 +..B1.39: + cmpl $0, 20(%ebp) + jne ..B1.49 +..B1.40: + cmpl $2047, %ecx + jl ..B1.43 +..B1.41: + testl $1048575, 16(%ebp) + jne ..B1.49 +..B1.42: + cmpl $0, 12(%ebp) + jne ..B1.49 +..B1.43: + cmpl $1023, %ecx + jl ..B1.47 +..B1.44: + fldl 12(%ebp) + addl $-16, %esp + fabs + fstpl (%esp) + call acosh@PLT +..B1.114: + addl $16, %esp + movzbl 19(%ebp), %edx + testl $128, %edx + fstpl 168(%esp) + je ..B1.46 +..B1.45: + fldl _DBL_PPI@GOTOFF(%ebx) + fstl 176(%esp) + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddp %st, %st(1) + fstpl 160(%esp) + jmp ..B1.48 +..B1.46: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 176(%esp) + jmp ..B1.48 +..B1.47: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 168(%esp) + addl $-16, %esp + fldl 12(%ebp) + fstpl (%esp) + call acos@PLT +..B1.115: + addl $16, %esp + fstpl 176(%esp) +..B1.48: + movzbl 183(%esp), %edx + movzbl 27(%ebp), %edi + andl $127, %edx + andl $-128, %edi + orl %edi, %edx + movb %dl, 183(%esp) + jmp ..B1.66 +..B1.49: + testl %ecx, %ecx + jne ..B1.56 +..B1.50: + testl $1048575, 16(%ebp) + jne ..B1.57 +..B1.51: + cmpl $0, 12(%ebp) + jne ..B1.57 +..B1.52: + cmpl $2047, %edx + jl ..B1.55 +..B1.53: + testl $1048575, 24(%ebp) + jne ..B1.57 +..B1.54: + cmpl $0, 20(%ebp) + jne ..B1.57 +..B1.55: + fldl 20(%ebp) + fstl (%esp) + addl $-16, %esp + fabs + fstpl (%esp) + call asinh@PLT +..B1.117: + fldl 12(%ebp) + addl $16, %esp + fxch %st(1) + fstpl 168(%esp) + addl $-16, %esp + fstpl 8(%esp) + fldl 16(%esp) + fstpl (%esp) + call atan2@PLT +..B1.116: + addl $16, %esp + fstpl 176(%esp) + jmp ..B1.66 +..B1.56: + cmpl $2047, %ecx + je ..B1.97 +..B1.57: + cmpl $2047, %edx + je ..B1.93 +..B1.121: + cmpl $2047, %ecx +..B1.58: + je ..B1.75 +..B1.59: + jge ..B1.64 +..B1.60: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.62 +..B1.61: + fldl _DBL_NPIBY2@GOTOFF(%ebx) + jmp ..B1.63 +..B1.62: + fldl _DBL_PPIBY2@GOTOFF(%ebx) +..B1.63: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fadd %st(1), %st + fstpl 160(%esp) + fstpl 176(%esp) + fldl _DBL_PZERO@GOTOFF(%ebx) + faddl 12(%ebp) + fstpl 160(%esp) + jmp ..B1.65 +..B1.64: + fldl 12(%ebp) + faddl _DBL_PZERO@GOTOFF(%ebx) + fstpl 176(%esp) +..B1.65: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 168(%esp) +..B1.66: + movl 168(%esp), %edx + movl %edx, (%esi) + movl 172(%esp), %ecx + movl 176(%esp), %edi + movl 180(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 184(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.74 +..B1.67: + movl %esi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.68: + xorl %edi, %edi + jmp ..B1.11 +..B1.69: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.70: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.37 +..B1.71: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.72: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.36 +..B1.74: + call __stack_chk_fail@PLT +..B1.75: + testl $1048575, 16(%ebp) + jne ..B1.119 +..B1.76: + cmpl $0, 12(%ebp) + jne ..B1.119 +..B1.77: + fldl 12(%ebp) + cmpl $2047, %edx + fmul %st(0), %st + fstpl 168(%esp) + jge ..B1.84 +..B1.78: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.80 +..B1.79: + fldl _DBL_PPI@GOTOFF(%ebx) + fstl 176(%esp) + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddp %st, %st(1) + fstpl 160(%esp) + fldl _DBL_PZERO@GOTOFF(%ebx) + jmp ..B1.81 +..B1.80: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstl 176(%esp) +..B1.81: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.83 +..B1.82: + movzbl 183(%esp), %edi + movl %edi, %edx + shrl $7, %edi + andl $127, %edx + notl %edi + shll $7, %edi + orl %edi, %edx + movb %dl, 183(%esp) +..B1.83: + faddl 20(%ebp) + fstpl 160(%esp) + jmp ..B1.66 +..B1.84: + testl $1048575, 24(%ebp) + jne ..B1.92 +..B1.85: + cmpl $0, 20(%ebp) + jne ..B1.92 +..B1.86: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.88 +..B1.87: + fldl _DBL_P3PIBY4@GOTOFF(%ebx) + jmp ..B1.89 +..B1.88: + fldl _DBL_PPIBY4@GOTOFF(%ebx) +..B1.89: + movzbl 27(%ebp), %edx + testl $128, %edx + fstpl 176(%esp) + je ..B1.91 +..B1.90: + movzbl 183(%esp), %edi + movl %edi, %edx + shrl $7, %edi + andl $127, %edx + notl %edi + shll $7, %edi + orl %edi, %edx + movb %dl, 183(%esp) +..B1.91: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + faddl 176(%esp) + fstpl 160(%esp) + jmp ..B1.66 +..B1.92: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 176(%esp) + jmp ..B1.66 +..B1.93: + testl $1048575, 24(%ebp) + jne ..B1.95 +..B1.94: + cmpl $0, 20(%ebp) + je ..B1.118 +..B1.95: + cmpl $2047, %ecx + jge ..B1.58 +..B1.96: + fldl 20(%ebp) + fmul %st(0), %st + fstl 168(%esp) + fstpl 176(%esp) + jmp ..B1.66 +..B1.97: + testl $1048575, 16(%ebp) + jne ..B1.99 +..B1.98: + cmpl $0, 12(%ebp) + je ..B1.100 +..B1.99: + cmpl $2047, %edx + je ..B1.104 +..B1.100: + testl $1048575, 16(%ebp) + jne ..B1.102 +..B1.101: + cmpl $0, 12(%ebp) + je ..B1.57 +..B1.102: + cmpl $2047, %edx + jge ..B1.57 +..B1.103: + fldl 12(%ebp) + fmul %st(0), %st + fstl 168(%esp) + fstpl 176(%esp) + jmp ..B1.66 +..B1.104: + testl $1048575, 24(%ebp) + jne ..B1.106 +..B1.105: + cmpl $0, 20(%ebp) + je ..B1.100 +..B1.106: + fldl 12(%ebp) + fmul %st(0), %st + fstpl 168(%esp) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 176(%esp) + jmp ..B1.66 +..B1.118: + cmpl $2047, %ecx + je ..B1.75 + jmp ..B1.59 +..B1.119: + cmpl $2047, %ecx + jl ..B1.60 + jmp ..B1.64 + .align 16,0x90 + .type cacosh,@function + .size cacosh,.-cacosh + .data +# -- End cacosh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +_Bcross: + .word -2936 + .word -10277 + .word 29569 + .word -23482 + .word 16382 + .word 0 + .type _Bcross,@object + .size _Bcross,12 + .space 4, 0x00 # pad + .align 16 +_DBL_PZERO: + .long 0 + .long 0 + .type _DBL_PZERO,@object + .size _DBL_PZERO,8 + .space 8, 0x00 # pad + .align 16 +_LDBL_PPI: + .word -15819 + .word 8552 + .word -9566 + .word -14065 + .word 16384 + .word 0 + .type _LDBL_PPI,@object + .size _LDBL_PPI,12 + .space 4, 0x00 # pad + .align 16 +_Across: + .word 0 + .word 0 + .word 0 + .word -16384 + .word 16383 + .word 0 + .type _Across,@object + .size _Across,12 + .space 4, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPI: + .long 1413754136 + .long 1074340347 + .type _DBL_PPI,@object + .size _DBL_PPI,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NPIBY2: + .long 1413754136 + .long -1074191877 + .type _DBL_NPIBY2,@object + .size _DBL_NPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY2: + .long 1413754136 + .long 1073291771 + .type _DBL_PPIBY2,@object + .size _DBL_PPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_P3PIBY4: + .long 2134057426 + .long 1073928572 + .type _DBL_P3PIBY4,@object + .size _DBL_P3PIBY4,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY4: + .long 1413754136 + .long 1072243195 + .type _DBL_PPIBY4,@object + .size _DBL_PPIBY4,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cacoshf.S b/external/sgx_libm/ia32/cacoshf.S new file mode 100644 index 0000000000..06b07b0f47 --- /dev/null +++ b/external/sgx_libm/ia32/cacoshf.S @@ -0,0 +1,639 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacoshf.c" + .text +..TXTST0: +# -- Begin cacoshf + .text + .align 16,0x90 + .globl cacoshf +cacoshf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %ebx + subl $108, %esp + fldz + movzwl 10(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %edx + fsts 100(%esp) + fsts 104(%esp) + jge ..B1.26 +..B1.2: + testl %edx, %edx + jle ..B1.55 +..B1.3: + movzwl 14(%ebp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $255, %eax + jge ..B1.27 +..B1.4: + testl %eax, %eax + jle ..B1.54 +..B1.5: + flds 8(%ebp) + fsts 92(%esp) + fld1 + fsts 88(%esp) + fxch %st(1) + fabs + fld %st(0) + fsub %st(2), %st + fld %st(0) + fmul %st(1), %st + fld %st(2) + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(2) + fstl 72(%esp) + flds 12(%ebp) + fabs + fld %st(0) + fmul %st(1), %st + fstl 56(%esp) + fadd %st, %st(3) + fxch %st(3) + fsqrt + fstl 64(%esp) + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + fsqrt + fstl 48(%esp) + fxch %st(1) + fucomp %st(2) + fnstsw %ax + faddp %st, %st(1) + fldl .L_2il0floatpacket.6@GOTOFF(%ebx) + sahf + fmul %st, %st(1) + jp ..B1.6 + je ..B1.7 +..B1.6: + fldl 64(%esp) + fsubl 72(%esp) + fstpl 40(%esp) + jmp ..B1.8 +..B1.7: + fxch %st(2) + fstl 40(%esp) + fxch %st(2) +..B1.8: + fldl _Bcross@GOTOFF(%ebx) + fmul %st(2), %st + fcomp %st(4) + fnstsw %ax + sahf + jbe ..B1.10 +..B1.9: + fstp %st(2) + fld %st(2) + fdiv %st(1), %st + fstpl (%esp) + fxch %st(2) + fstps 80(%esp) + fxch %st(2) + fstpl 16(%esp) + fxch %st(1) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + call acos@PLT + jmp ..B1.89 +..B1.10: + flds 88(%esp) + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.12 +..B1.11: + fstp %st(2) + fld %st(3) + fld %st(1) + fadd %st(4), %st + fmul %st(3), %st + fxch %st(1) + faddl 48(%esp) + fdivrl 56(%esp) + faddl 40(%esp) + fmulp %st, %st(1) + fsqrt + fxch %st(3) + fstl 8(%esp) + fxch %st(3) + fstpl (%esp) + fxch %st(2) + fstps 80(%esp) + fxch %st(2) + fstpl 16(%esp) + fxch %st(1) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + call atan2@PLT + jmp ..B1.89 +..B1.12: + fldl 72(%esp) + fld %st(2) + fadd %st(5), %st + fxch %st(6) + fstl 16(%esp) + fxch %st(1) + faddl 64(%esp) + fxch %st(1) + faddl 48(%esp) + fdivr %st(6), %st + fxch %st(1) + fdivrp %st, %st(6) + faddp %st, %st(5) + fmul %st, %st(4) + fxch %st(4) + fsqrt + fmulp %st, %st(2) + fxch %st(2) + fstl 8(%esp) + fxch %st(1) + fstpl (%esp) + fstps 80(%esp) + fxch %st(1) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + fldl 16(%esp) + fstpl 16(%esp) + call atan2@PLT +..B1.89: + flds 84(%esp) + fldl 32(%esp) + fldl 24(%esp) + fldl 16(%esp) + flds 80(%esp) +..B1.13: + fxch %st(4) + fcomps 92(%esp) + fnstsw %ax + sahf + jbe ..B1.15 +..B1.14: + fxch %st(4) + fsubrl _DBL_PPI@GOTOFF(%ebx) + fxch %st(4) +..B1.15: + fxch %st(4) + fstps 104(%esp) + fldl _Across@GOTOFF(%ebx) + movzbl 107(%esp), %ecx + fcomp %st(2) + fnstsw %ax + movzbl 15(%ebp), %edx + andl $127, %ecx + andl $-128, %edx + orl %edx, %ecx + movb %cl, 107(%esp) + sahf + jb ..B1.20 +..B1.16: + flds 88(%esp) + fcomp %st(3) + fnstsw %ax + fxch %st(2) + fstp %st(0) + fxch %st(2) + faddl 48(%esp) + fdivrl 56(%esp) + sahf + jbe ..B1.18 +..B1.17: + fldl 56(%esp) + fdivl 40(%esp) + faddp %st, %st(1) + fmulp %st, %st(1) + jmp ..B1.19 +..B1.18: + fldl 72(%esp) + faddl 64(%esp) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.19: + fxch %st(1) + fadds 88(%esp) + fmul %st(1), %st + fsqrt + faddp %st, %st(1) + fstpl (%esp) + call log1p@PLT + jmp ..B1.91 +..B1.20: + fstp %st(3) + fstp %st(2) + fstp %st(0) + fld %st(0) + fmul %st(1), %st + fsubs 88(%esp) + fsqrt + faddp %st, %st(1) + fstpl (%esp) + call log@PLT +..B1.91: + fstps 100(%esp) +..B1.21: + movzwl 102(%esp), %eax + testl $32640, %eax + jne ..B1.23 +..B1.22: + testl $8388607, 100(%esp) + jne ..B1.25 +..B1.23: + movzwl 106(%esp), %eax + testl $32640, %eax + jne ..B1.53 +..B1.24: + testl $8388607, 104(%esp) + je ..B1.53 +..B1.25: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) + fmul %st(0), %st + fstps 96(%esp) + jmp ..B1.53 +..B1.26: + movzwl 14(%ebp), %eax + andl $32640, %eax + shrl $7, %eax +..B1.27: + cmpl $255, %edx + je ..B1.83 +..B1.28: + testl %eax, %eax + jne ..B1.38 +..B1.29: + testl $8388607, 12(%ebp) + jne ..B1.38 +..B1.30: + cmpl $255, %edx + jl ..B1.32 +..B1.31: + testl $8388607, 8(%ebp) + jne ..B1.38 +..B1.32: + cmpl $127, %edx + jl ..B1.36 +..B1.33: + flds 8(%ebp) + fabs + fstps (%esp) + fstps 84(%esp) + call acoshf@PLT +..B1.92: + flds 84(%esp) + movzbl 11(%ebp), %eax + testl $128, %eax + fxch %st(1) + fstps 100(%esp) + je ..B1.35 +..B1.34: + fstp %st(0) + movl $1078530011, %eax + movl %eax, 104(%esp) + movl %eax, 96(%esp) + jmp ..B1.37 +..B1.35: + fstps 104(%esp) + jmp ..B1.37 +..B1.36: + movl 8(%ebp), %eax + fstps 100(%esp) + movl %eax, (%esp) + call acosf@PLT +..B1.93: + fstps 104(%esp) +..B1.37: + movzbl 107(%esp), %edx + movzbl 15(%ebp), %eax + andl $127, %edx + andl $-128, %eax + orl %eax, %edx + movb %dl, 107(%esp) + jmp ..B1.53 +..B1.38: + testl %edx, %edx + jne ..B1.43 +..B1.39: + testl $8388607, 8(%ebp) + jne ..B1.44 +..B1.40: + cmpl $255, %eax + jl ..B1.42 +..B1.41: + testl $8388607, 12(%ebp) + jne ..B1.44 +..B1.42: + fstp %st(0) + flds 12(%ebp) + fsts 16(%esp) + fabs + fstps (%esp) + call asinhf@PLT +..B1.95: + movl 8(%ebp), %eax + movl %eax, 4(%esp) + flds 16(%esp) + fstps (%esp) + fstps 100(%esp) + call atan2f@PLT +..B1.94: + fstps 104(%esp) + jmp ..B1.53 +..B1.43: + cmpl $255, %edx + je ..B1.76 +..B1.44: + cmpl $255, %eax + je ..B1.73 +..B1.45: + cmpl $255, %edx + je ..B1.57 +..B1.46: + fstp %st(0) + cmpl $255, %edx + jge ..B1.51 +..B1.47: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.49 +..B1.48: + flds .L_2il0floatpacket.8@GOTOFF(%ebx) + jmp ..B1.50 +..B1.49: + flds .L_2il0floatpacket.9@GOTOFF(%ebx) +..B1.50: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) + movl 8(%ebp), %eax + fadd %st(1), %st + fstps 96(%esp) + fstps 104(%esp) + movl %eax, 96(%esp) + jmp ..B1.52 +..B1.51: + movl 8(%ebp), %eax + movl %eax, 104(%esp) +..B1.52: + flds 12(%ebp) + fmul %st(0), %st + fstps 100(%esp) +..B1.53: + movl 100(%esp), %eax + movl 104(%esp), %edx + addl $108, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.54: + testl $8388607, 12(%ebp) + jne ..B1.5 + jmp ..B1.27 +..B1.55: + testl $8388607, 8(%ebp) + jne ..B1.3 + jmp ..B1.26 +..B1.57: + testl $8388607, 8(%ebp) + jne ..B1.46 +..B1.58: + flds 8(%ebp) + cmpl $255, %eax + fmul %st(0), %st + fstps 100(%esp) + jge ..B1.65 +..B1.59: + movzbl 11(%ebp), %eax + testl $128, %eax + je ..B1.61 +..B1.60: + fstp %st(0) + movl $1078530011, %eax + movl %eax, 104(%esp) + movl %eax, 96(%esp) + jmp ..B1.62 +..B1.61: + fstps 104(%esp) +..B1.62: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.64 +..B1.63: + movzbl 107(%esp), %eax + movl %eax, %edx + shrl $7, %eax + andl $127, %edx + notl %eax + shll $7, %eax + orl %eax, %edx + movb %dl, 107(%esp) +..B1.64: + movl 12(%ebp), %eax + movl %eax, 96(%esp) + jmp ..B1.53 +..B1.65: + fstp %st(0) + testl $8388607, 12(%ebp) + jne ..B1.72 +..B1.66: + movzbl 11(%ebp), %eax + testl $128, %eax + je ..B1.68 +..B1.67: + movl $1075235812, %edx + jmp ..B1.69 +..B1.68: + movl $1061752795, %edx +..B1.69: + movzbl 15(%ebp), %eax + testl $128, %eax + movl %edx, 104(%esp) + je ..B1.71 +..B1.70: + shrl $24, %edx + orl $-128, %edx + movb %dl, 107(%esp) +..B1.71: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) + fadds 104(%esp) + fstps 96(%esp) + jmp ..B1.53 +..B1.72: + flds 12(%ebp) + fmul %st(0), %st + fstps 104(%esp) + jmp ..B1.53 +..B1.73: + testl $8388607, 12(%ebp) + je ..B1.45 +..B1.74: + cmpl $255, %edx + jge ..B1.45 +..B1.75: + fstp %st(0) + flds 12(%ebp) + fmul %st(0), %st + fsts 100(%esp) + fstps 104(%esp) + jmp ..B1.53 +..B1.76: + testl $8388607, 8(%ebp) + je ..B1.78 +..B1.77: + cmpl $255, %eax + je ..B1.81 +..B1.97: + testl $8388607, 8(%ebp) +..B1.78: + je ..B1.44 +..B1.79: + cmpl $255, %eax + jge ..B1.44 +..B1.80: + fstp %st(0) + flds 8(%ebp) + fmul %st(0), %st + fsts 100(%esp) + fstps 104(%esp) + jmp ..B1.53 +..B1.81: + testl $8388607, 12(%ebp) + je ..B1.96 +..B1.82: + fstp %st(0) + flds 8(%ebp) + fmul %st(0), %st + fstps 100(%esp) + flds 12(%ebp) + fmul %st(0), %st + fstps 104(%esp) + jmp ..B1.53 +..B1.83: + testl $8388607, 8(%ebp) + je ..B1.28 +..B1.84: + flds 8(%ebp) + fadd %st(0), %st + fstps 8(%ebp) + movzwl 10(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + jmp ..B1.28 +..B1.96: + testl $8388607, 8(%ebp) + jne ..B1.79 + jmp ..B1.44 + .align 16,0x90 + .type cacoshf,@function + .size cacoshf,.-cacoshf + .data +# -- End cacoshf + .section .rodata, "a" + .align 16 + .align 16 +_Bcross: + .long 1882913663 + .long 1071941838 + .type _Bcross,@object + .size _Bcross,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPI: + .long 1413754136 + .long 1074340347 + .type _DBL_PPI,@object + .size _DBL_PPI,8 + .space 8, 0x00 # pad + .align 16 +_Across: + .long 0 + .long 1073217536 + .type _Across,@object + .size _Across,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 4 +.L_2il0floatpacket.7: + .long 0x40490fdb + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,4 + .align 4 +.L_2il0floatpacket.8: + .long 0xbfc90fdb + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +.L_2il0floatpacket.9: + .long 0x3fc90fdb + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,4 + .align 4 +.L_2il0floatpacket.10: + .long 0x00800000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +.L_2il0floatpacket.11: + .long 0x4016cbe4 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,4 + .align 4 +.L_2il0floatpacket.12: + .long 0x3f490fdb + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cacoshl.S b/external/sgx_libm/ia32/cacoshl.S new file mode 100644 index 0000000000..d293f81ceb --- /dev/null +++ b/external/sgx_libm/ia32/cacoshl.S @@ -0,0 +1,459 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacoshl.c" + .text +..TXTST0: +# -- Begin cacoshl + .text + .align 16,0x90 + .globl cacoshl +cacoshl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl 8(%ebp), %eax + movl %eax, 12(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 268(%esp) + fstpt (%esp) + fldt (%esp) + fstpt 244(%esp) + fldt 244(%esp) + fstpt 256(%esp) +..B1.2: + fnstcw 18(%esp) +..B1.3: + movzwl 18(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.67 +..B1.4: + orl $-64768, %edx + movw %dx, 16(%esp) +..B1.5: + fldcw 16(%esp) +..B1.6: + movl $1, %esi +..B1.7: + movzwl 20(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.16 +..B1.8: + testl %eax, %eax + jle ..B1.46 +..B1.9: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.16 +..B1.10: + testl %edx, %edx + jle ..B1.44 +..B1.11: + addl $-48, %esp + lea 12(%ebp), %eax + lea 24(%ebp), %edx + lea 264(%esp), %ecx + lea 236(%esp), %edi + movl %eax, (%esp) + lea 208(%esp), %eax + movl %edx, 4(%esp) + lea 180(%esp), %edx + movl %ecx, 8(%esp) + lea 152(%esp), %ecx + movl %edi, 12(%esp) + lea 68(%esp), %edi + movl %eax, 16(%esp) + lea 96(%esp), %eax + movl %edx, 20(%esp) + lea 124(%esp), %edx + movl %ecx, 24(%esp) + movl %edx, 28(%esp) + movl %eax, 32(%esp) + movl %edi, 36(%esp) + call __libm_carctrigprepare_k80 +..B1.70: + lea 96(%esp), %eax + lea 124(%esp), %edx +..B1.12: + lea 12(%ebp), %ecx + movl %ecx, (%esp) + lea 24(%ebp), %ecx + movl %ecx, 4(%esp) + lea 264(%esp), %ecx + movl %ecx, 8(%esp) + lea 236(%esp), %ecx + movl %ecx, 12(%esp) + lea 208(%esp), %ecx + movl %ecx, 16(%esp) + lea 180(%esp), %ecx + movl %ecx, 20(%esp) + lea 152(%esp), %ecx + movl %ecx, 24(%esp) + movl %edx, 28(%esp) + movl %eax, 32(%esp) + movl %edi, 36(%esp) + call __libm_recacoshl_k80 +..B1.71: + lea 96(%esp), %eax + lea 124(%esp), %edx + addl $48, %esp +..B1.13: + fstpt 244(%esp) + addl $-48, %esp + lea 12(%ebp), %ecx + movl %ecx, (%esp) + lea 24(%ebp), %ecx + movl %ecx, 4(%esp) + lea 264(%esp), %ecx + movl %ecx, 8(%esp) + lea 236(%esp), %ecx + movl %ecx, 12(%esp) + lea 208(%esp), %ecx + movl %ecx, 16(%esp) + lea 180(%esp), %ecx + movl %ecx, 20(%esp) + lea 152(%esp), %ecx + movl %ecx, 24(%esp) + movl %edx, 28(%esp) + movl %eax, 32(%esp) + movl %edi, 36(%esp) + call __libm_recacosl_k80 +..B1.72: + addl $48, %esp +..B1.14: + movzbl 33(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl ones@GOTOFF(%ebx,%eax,8) + fmulp %st, %st(1) + fstpt 256(%esp) + jmp ..B1.40 +..B1.16: + movl 28(%ebp), %ecx +..B1.17: + testl %ecx, %ecx + jne ..B1.27 +..B1.81: + cmpl $0, 24(%ebp) +..B1.18: + jne ..B1.27 +..B1.19: + cmpl $32767, %eax + jl ..B1.22 +..B1.20: + movl 16(%ebp), %edi + cmpl $-2147483648, %edi + jne ..B1.28 +..B1.21: + cmpl $0, 12(%ebp) + jne ..B1.34 +..B1.22: + cmpl $16383, %eax + jl ..B1.24 +..B1.23: + fldt 12(%ebp) + movzbl 21(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl ones@GOTOFF(%ebx,%eax,8) + fstl (%esp) + addl $-16, %esp + fmulp %st, %st(1) + fstpt (%esp) + call acoshl@PLT +..B1.74: + addl $16, %esp + fstpt 244(%esp) + addl $-16, %esp + fldl 16(%esp) + fstpt (%esp) + call acosl@PLT + jmp ..B1.75 +..B1.24: + fldt (%esp) + fstpt 244(%esp) + addl $-16, %esp + fldt 12(%ebp) + fstpt (%esp) + call acosl@PLT +..B1.75: + addl $16, %esp + lea 256(%esp), %edx +..B1.25: + movzbl 33(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmull ones@GOTOFF(%ebx,%eax,8) + fstpt (%edx) + jmp ..B1.40 +..B1.27: + movl 16(%ebp), %edi +..B1.28: + testl %edi, %edi + jne ..B1.34 +..B1.29: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $0, 12(%ebp) + jne ..B1.35 +..B1.30: + cmpl $32767, %edx + jl ..B1.33 +..B1.31: + cmpl $-2147483648, %ecx + jne ..B1.35 +..B1.32: + cmpl $0, 24(%ebp) + jne ..B1.35 +..B1.33: + fldt 24(%ebp) + movzbl 33(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fstpt (%esp) + fldt (%esp) + addl $-16, %esp + fldl ones@GOTOFF(%ebx,%eax,8) + fmulp %st, %st(1) + fstpt (%esp) + call asinhl@PLT +..B1.77: + fldt 12(%ebp) + addl $16, %esp + fxch %st(1) + fstpt 244(%esp) + addl $-32, %esp + fldt 32(%esp) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT + jmp ..B1.78 +..B1.34: + movzwl 32(%ebp), %edx + andl $32767, %edx +..B1.35: + cmpl $32767, %eax + je ..B1.57 +..B1.36: + cmpl $32767, %edx + je ..B1.53 +..B1.80: + cmpl $32767, %eax +..B1.37: + je ..B1.50 +..B1.38: + fldt 24(%ebp) + fld %st(0) + fmul %st(1), %st + fstpt 244(%esp) + fldt 12(%ebp) + fxch %st(1) +..B1.39: + addl $-32, %esp + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT +..B1.78: + addl $32, %esp + fstpt 256(%esp) +..B1.40: + testl %esi, %esi + je ..B1.42 +..B1.41: + fldcw 18(%esp) +..B1.42: + movl 12(%esp), %eax + movl 244(%esp), %edx + movl 248(%esp), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 252(%esp), %esi + movl 256(%esp), %edi + movl 260(%esp), %edx + movl 264(%esp), %ecx + movl %esi, 8(%eax) + movl %edi, 12(%eax) + movl %edx, 16(%eax) + movl %ecx, 20(%eax) + movl 268(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.49 +..B1.43: + movl 12(%esp), %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.44: + movl 28(%ebp), %ecx + testl %ecx, %ecx + jne ..B1.11 +..B1.45: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.18 +..B1.46: + cmpl $0, 16(%ebp) + jne ..B1.9 +..B1.47: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.16 +..B1.49: + call __stack_chk_fail@PLT +..B1.50: + cmpl $-2147483648, %edi + jne ..B1.38 +..B1.51: + cmpl $0, 12(%ebp) + jne ..B1.38 +..B1.52: + fldt 12(%ebp) + fld %st(0) + fmul %st(1), %st + fstpt 244(%esp) + fldt 24(%ebp) + jmp ..B1.39 +..B1.53: + cmpl $-2147483648, %ecx + jne ..B1.55 +..B1.54: + cmpl $0, 24(%ebp) + je ..B1.79 +..B1.55: + cmpl $32767, %eax + jge ..B1.37 +..B1.56: + fldt 24(%ebp) + fmul %st(0), %st + fstpt 244(%esp) + fldt 244(%esp) + fstpt 256(%esp) + jmp ..B1.40 +..B1.57: + cmpl $-2147483648, %edi + jne ..B1.59 +..B1.58: + cmpl $0, 12(%ebp) + je ..B1.61 +..B1.59: + cmpl $32767, %edx + je ..B1.64 +..B1.60: + cmpl $-2147483648, %edi + jne ..B1.62 +..B1.82: + cmpl $0, 12(%ebp) +..B1.61: + je ..B1.36 +..B1.62: + cmpl $32767, %edx + jge ..B1.36 +..B1.63: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 244(%esp) + fldt 244(%esp) + fstpt 256(%esp) + jmp ..B1.40 +..B1.64: + cmpl $-2147483648, %ecx + jne ..B1.66 +..B1.65: + cmpl $0, 24(%ebp) + je ..B1.60 +..B1.66: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 244(%esp) + fldt 24(%ebp) + fmul %st(0), %st + fstpt 256(%esp) + jmp ..B1.40 +..B1.67: + xorl %esi, %esi + jmp ..B1.7 +..B1.79: + cmpl $32767, %eax + je ..B1.50 + jmp ..B1.38 + .align 16,0x90 + .type cacoshl,@function + .size cacoshl,.-cacoshl + .data +# -- End cacoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .hidden __libm_recacosl_k80 + .hidden __libm_recacoshl_k80 + .hidden __libm_carctrigprepare_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cacosl.S b/external/sgx_libm/ia32/cacosl.S new file mode 100644 index 0000000000..7797c091c0 --- /dev/null +++ b/external/sgx_libm/ia32/cacosl.S @@ -0,0 +1,455 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacosl.c" + .text +..TXTST0: +# -- Begin cacosl + .text + .align 16,0x90 + .globl cacosl +cacosl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 272(%esp) + fstpt 8(%esp) + fldt 8(%esp) + fstpt 248(%esp) + fldt 248(%esp) + fstpt 260(%esp) +..B1.2: + fnstcw 22(%esp) +..B1.3: + movzwl 22(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.62 +..B1.4: + orl $-64768, %ecx + movw %cx, 20(%esp) +..B1.5: + fldcw 20(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.16 +..B1.8: + testl %ecx, %ecx + jle ..B1.41 +..B1.9: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.16 +..B1.10: + testl %edx, %edx + jle ..B1.38 +..B1.11: + addl $-48, %esp + lea 12(%ebp), %edx + lea 24(%ebp), %ecx + movl %edx, (%esp) + lea 268(%esp), %edx + movl %ecx, 4(%esp) + lea 100(%esp), %ecx + movl %edx, 8(%esp) + lea 240(%esp), %edx + movl %edx, 12(%esp) + lea 212(%esp), %edx + movl %edx, 16(%esp) + lea 184(%esp), %edx + movl %edx, 20(%esp) + lea 156(%esp), %edx + movl %edx, 24(%esp) + lea 128(%esp), %edx + movl %edx, 28(%esp) + lea 72(%esp), %edx + movl %ecx, 32(%esp) + movl %edx, 36(%esp) + call __libm_carctrigprepare_k80 +..B1.65: + lea 72(%esp), %edx + lea 100(%esp), %ecx +..B1.12: + lea 12(%ebp), %eax + movl %eax, (%esp) + lea 24(%ebp), %eax + movl %eax, 4(%esp) + lea 268(%esp), %eax + movl %eax, 8(%esp) + lea 240(%esp), %eax + movl %eax, 12(%esp) + lea 212(%esp), %eax + movl %eax, 16(%esp) + lea 184(%esp), %eax + movl %eax, 20(%esp) + lea 156(%esp), %eax + movl %eax, 24(%esp) + lea 128(%esp), %eax + movl %eax, 28(%esp) + movl %ecx, 32(%esp) + movl %edx, 36(%esp) + call __libm_recacosl_k80 +..B1.66: + lea 72(%esp), %edx + lea 100(%esp), %ecx + addl $48, %esp +..B1.13: + fstpt 248(%esp) + addl $-48, %esp + lea 12(%ebp), %eax + movl %eax, (%esp) + lea 24(%ebp), %eax + movl %eax, 4(%esp) + lea 268(%esp), %eax + movl %eax, 8(%esp) + lea 240(%esp), %eax + movl %eax, 12(%esp) + lea 212(%esp), %eax + movl %eax, 16(%esp) + lea 184(%esp), %eax + movl %eax, 20(%esp) + lea 156(%esp), %eax + movl %eax, 24(%esp) + lea 128(%esp), %eax + movl %eax, 28(%esp) + movl %ecx, 32(%esp) + movl %edx, 36(%esp) + call __libm_recacoshl_k80 +..B1.67: + addl $48, %esp +..B1.14: + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + xorl $1, %edx + fldl ones@GOTOFF(%ebx,%edx,8) + fmulp %st, %st(1) + fstpt 260(%esp) + jmp ..B1.34 +..B1.16: + movl 16(%ebp), %eax +..B1.17: + testl %eax, %eax + jne ..B1.20 +..B1.77: + cmpl $0, 12(%ebp) +..B1.18: + jne ..B1.20 +..B1.19: + addl $-16, %esp + fldt 24(%esp) + fstpt (%esp) + call acosl@PLT +..B1.69: + fldt 24(%ebp) + addl $16, %esp + fxch %st(1) + fstpt 248(%esp) + addl $-16, %esp + fstpt (%esp) + call asinhl@PLT +..B1.68: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpt 260(%esp) + jmp ..B1.34 +..B1.20: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.58 +..B1.75: + cmpl $32767, %ecx +..B1.21: + je ..B1.47 +..B1.22: + movl 28(%ebp), %eax +..B1.23: + cmpl $32767, %edx + je ..B1.44 +..B1.24: + testl %eax, %eax + jne ..B1.30 +..B1.25: + cmpl $0, 24(%ebp) + jne ..B1.30 +..B1.26: + fldt 12(%ebp) + cmpl $16383, %ecx + jl ..B1.28 +..B1.27: + movzbl 21(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl ones@GOTOFF(%ebx,%edx,8) + fstl (%esp) + addl $-16, %esp + fmulp %st, %st(1) + fstpt (%esp) + call acoshl@PLT +..B1.71: + fstpt 24(%esp) + fldl 16(%esp) + fstpt (%esp) + call acosl@PLT + jmp ..B1.72 +..B1.28: + addl $-16, %esp + fstpt (%esp) + call acosl@PLT +..B1.72: + addl $16, %esp + fstpt 248(%esp) +..B1.29: + fldt 8(%esp) + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + xorl $1, %edx + fmull ones@GOTOFF(%ebx,%edx,8) + fstpt 260(%esp) + jmp ..B1.34 +..B1.30: + fldt 24(%ebp) + cmpl $32767, %edx + fldt 12(%ebp) + je ..B1.32 +..B1.31: + fld %st(0) + fmul %st(1), %st + jmp ..B1.33 +..B1.32: + fld %st(1) + fmul %st(2), %st +..B1.33: + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + movl %edx, (%esp) + xorl $1, %edx + fmull ones@GOTOFF(%ebx,%edx,8) + fstpt 260(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT +..B1.73: + addl $32, %esp + movl (%esp), %edx + fmull ones@GOTOFF(%ebx,%edx,8) + fstpt 248(%esp) +..B1.34: + testl %edi, %edi + je ..B1.36 +..B1.35: + fldcw 22(%esp) +..B1.36: + movl 248(%esp), %edx + movl %edx, (%esi) + movl 260(%esp), %edx + movl %edx, 12(%esi) + movl 264(%esp), %edx + movl %edx, 16(%esi) + movl 252(%esp), %ecx + movl 256(%esp), %edi + movl 268(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 272(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.43 +..B1.37: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.38: + cmpl $0, 28(%ebp) + jne ..B1.11 +..B1.39: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.16 +..B1.41: + movl 16(%ebp), %eax + testl %eax, %eax + jne ..B1.9 +..B1.42: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.18 +..B1.43: + call __stack_chk_fail@PLT +..B1.44: + cmpl $-2147483648, %eax + jne ..B1.46 +..B1.78: + cmpl $0, 24(%ebp) +..B1.45: + je ..B1.30 +..B1.46: + fldt 24(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 12(%ebp) + fmul %st(0), %st + fstpt 260(%esp) + jmp ..B1.34 +..B1.47: + cmpl $-2147483648, %eax + jne ..B1.49 +..B1.48: + cmpl $0, 12(%ebp) + je ..B1.52 +..B1.49: + cmpl $32767, %edx + jge ..B1.51 +..B1.50: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 248(%esp) + fstpt 260(%esp) + jmp ..B1.34 +..B1.51: + cmpl $-2147483648, %eax + jne ..B1.53 +..B1.76: + cmpl $0, 12(%ebp) +..B1.52: + je ..B1.22 +..B1.53: + movl 28(%ebp), %eax + cmpl $32767, %edx + jne ..B1.24 +..B1.55: + cmpl $-2147483648, %eax + jne ..B1.57 +..B1.56: + cmpl $0, 24(%ebp) + je ..B1.45 +..B1.57: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 24(%ebp) + fmul %st(0), %st + fstpt 260(%esp) + jmp ..B1.34 +..B1.58: + cmpl $-2147483648, 28(%ebp) + jne ..B1.60 +..B1.59: + cmpl $0, 24(%ebp) + je ..B1.74 +..B1.60: + cmpl $32767, %ecx + jge ..B1.21 +..B1.61: + fldt 24(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 248(%esp) + fstpt 260(%esp) + jmp ..B1.34 +..B1.62: + xorl %edi, %edi + jmp ..B1.7 +..B1.74: + cmpl $32767, %ecx + je ..B1.47 + jmp ..B1.22 + .align 16,0x90 + .type cacosl,@function + .size cacosl,.-cacosl + .data +# -- End cacosl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .hidden __libm_recacosl_k80 + .hidden __libm_recacoshl_k80 + .hidden __libm_carctrigprepare_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/carg.S b/external/sgx_libm/ia32/carg.S new file mode 100644 index 0000000000..72a7d2fea1 --- /dev/null +++ b/external/sgx_libm/ia32/carg.S @@ -0,0 +1,94 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "carg.c" + .text +..TXTST0: +# -- Begin carg + .text + .align 16,0x90 + .globl carg +carg: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %ebx + subl $28, %esp + movzwl 14(%ebp), %eax + andl $32752, %eax + cmpl $32752, %eax + je ..B1.4 +..B1.2: + fldl 8(%ebp) +..B1.3: + fldl 16(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fxch %st(1) + fstpl 8(%esp) + fstpl (%esp) + call atan2@PLT +..B1.10: + addl $28, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.4: + testl $1048575, 12(%ebp) + jne ..B1.6 +..B1.5: + cmpl $0, 8(%ebp) + je ..B1.2 +..B1.6: + fldl 8(%ebp) + fmul %st(0), %st + fstl 8(%ebp) + jmp ..B1.3 + .align 16,0x90 + .type carg,@function + .size carg,.-carg + .data +# -- End carg + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cargf.S b/external/sgx_libm/ia32/cargf.S new file mode 100644 index 0000000000..4ab98a5de0 --- /dev/null +++ b/external/sgx_libm/ia32/cargf.S @@ -0,0 +1,71 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cargf.c" + .text +..TXTST0: +# -- Begin cargf + .text + .align 16,0x90 + .globl cargf +cargf: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $24, %esp + flds 36(%esp) + flds 32(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpl 8(%esp) + fstpl (%esp) + call atan2@PLT +..B1.4: + addl $24, %esp + popl %ebx + ret + .align 16,0x90 + .type cargf,@function + .size cargf,.-cargf + .data +# -- End cargf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cargl.S b/external/sgx_libm/ia32/cargl.S new file mode 100644 index 0000000000..3a7cfd7852 --- /dev/null +++ b/external/sgx_libm/ia32/cargl.S @@ -0,0 +1,76 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cargl.c" + .text +..TXTST0: +# -- Begin cargl + .text + .align 16,0x90 + .globl cargl +cargl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $60, %esp + fldt 20(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpt (%esp) + fldt 8(%ebp) + fstpt 12(%esp) + call atan2l@PLT +..B1.4: + addl $60, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type cargl,@function + .size cargl,.-cargl + .data +# -- End cargl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/casin.S b/external/sgx_libm/ia32/casin.S new file mode 100644 index 0000000000..182c1ccc76 --- /dev/null +++ b/external/sgx_libm/ia32/casin.S @@ -0,0 +1,237 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casin.c" + .text +..TXTST0: +# -- Begin casin + .text + .align 16,0x90 + .globl casin +casin: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $72, %esp + fldz + fldl 20(%ebp) + fldl 12(%ebp) + movzwl 26(%ebp), %ecx + andl $32752, %ecx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 64(%esp) + cmpl $32752, %ecx + fstpl 56(%esp) + fxch %st(1) + fstl 16(%esp) + fstl 24(%esp) + fstl 32(%esp) + fstpl 40(%esp) + fstpl 48(%esp) + jl ..B1.4 +..B1.2: + testl $1048575, 24(%ebp) + jne ..B1.5 +..B1.3: + cmpl $0, 20(%ebp) + jne ..B1.5 +..B1.4: + movzbl 27(%ebp), %edx + notl %edx + movzbl 55(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 55(%esp) +..B1.5: + addl $-32, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea 32(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl 48(%ecx), %ecx + movl %ecx, (%edx) + movl 84(%esp), %ecx + movl %ecx, 4(%edx) + movl 88(%esp), %ecx + movl %ecx, 8(%edx) + movl 92(%esp), %ecx + movl %ecx, 12(%edx) + call casinh@PLT +..B1.14: + addl $28, %esp + fldl (%esp) + movzwl 6(%esp), %edx + andl $32752, %edx + fstl 16(%esp) + cmpl $32752, %edx + fstpl 40(%esp) + fldl 8(%esp) + fstl 24(%esp) + fstpl 32(%esp) + jl ..B1.8 +..B1.6: + testl $1048575, 20(%esp) + jne ..B1.9 +..B1.7: + cmpl $0, 16(%esp) + jne ..B1.9 +..B1.8: + movzbl 23(%esp), %edx + notl %edx + movzbl 47(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 47(%esp) +..B1.9: + movl 32(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 8(%esi) + movl 36(%esp), %ecx + movl 44(%esp), %edx + movl %ecx, 4(%esi) + movl %edx, 12(%esi) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.11 +..B1.10: + movl %esi, %eax + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.11: + call __stack_chk_fail@PLT + .align 16,0x90 + .type casin,@function + .size casin,.-casin + .data +# -- End casin + .text +# -- Begin casinf + .text + .align 16,0x90 + .globl casinf +casinf: +# parameter 1: 48 + %esp +..B2.1: +..L3: + + pushl %ebx + subl $40, %esp + xorl %eax, %eax + movl %eax, 16(%esp) + movl %eax, 20(%esp) + movl %eax, 24(%esp) + movl %eax, 28(%esp) + movzwl 54(%esp), %eax + andl $32640, %eax + movl 52(%esp), %edx + cmpl $32640, %eax + movl 48(%esp), %ecx + movl %edx, 32(%esp) + movl %ecx, 36(%esp) + jl ..B2.3 +..B2.2: + testl $8388607, 52(%esp) + jne ..B2.4 +..B2.3: + movzbl 55(%esp), %eax + notl %eax + movzbl 35(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 35(%esp) +..B2.4: + addl $8, %esp + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + pushl 28(%esp) + pushl 28(%esp) + call casinhf@PLT +..B2.10: + movl %eax, 16(%esp) + movl %eax, 28(%esp) + shrl $16, %eax + andl $32640, %eax + cmpl $32640, %eax + movl %edx, 20(%esp) + movl %edx, 24(%esp) + jl ..B2.6 +..B2.5: + testl $8388607, 16(%esp) + jne ..B2.7 +..B2.6: + movzbl 19(%esp), %eax + notl %eax + movzbl 31(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 31(%esp) +..B2.7: + movl 24(%esp), %eax + movl 28(%esp), %edx + addl $40, %esp + popl %ebx + ret + .align 16,0x90 + .type casinf,@function + .size casinf,.-casinf + .data +# -- End casinf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/casinh.S b/external/sgx_libm/ia32/casinh.S new file mode 100644 index 0000000000..a923b4424a --- /dev/null +++ b/external/sgx_libm/ia32/casinh.S @@ -0,0 +1,783 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinh.c" + .text +..TXTST0: +# -- Begin casinh + .text + .align 16,0x90 + .globl casinh +casinh: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 192(%esp) + fstl 176(%esp) + fstpl 184(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 18(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %ecx + jge ..B1.38 +..B1.4: + testl %ecx, %ecx + jle ..B1.73 +..B1.5: + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B1.39 +..B1.6: + testl %edx, %edx + jle ..B1.71 +..B1.7: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.70 +..B1.8: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movl $1, %edi +..B1.11: + fldl 20(%ebp) + fstl 160(%esp) + fabs + fldl 12(%ebp) + fstl 152(%esp) + fabs + fld %st(0) + fmul %st(1), %st + fstpt 104(%esp) + fldt 104(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fld %st(0) + fsubr %st(4), %st + fld %st(0) + fmul %st(1), %st + fadd %st(3), %st + fsqrt + fstpt 88(%esp) + fldt 88(%esp) + fld %st(2) + fadd %st(6), %st + fld %st(0) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(4) + fsqrt + fstpt 120(%esp) + fldt 120(%esp) + fxch %st(1) + fucom %st(2) + fnstsw %ax + faddp %st, %st(1) + fxch %st(1) + fstpt 136(%esp) + sahf + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st, %st(1) + jp ..B1.12 + je ..B1.13 +..B1.12: + fldt 88(%esp) + fldt 136(%esp) + fsubrp %st, %st(1) + fstpt 72(%esp) + jmp ..B1.14 +..B1.13: + fxch %st(4) + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(4) +..B1.14: + fldt _Bcross@GOTOFF(%ebx) + fmul %st(2), %st + fcomp %st(6) + fnstsw %ax + sahf + jb ..B1.16 +..B1.15: + fstp %st(4) + fld %st(4) + addl $-16, %esp + fdiv %st(1), %st + fstpt (%esp) + fxch %st(4) + fstpl 80(%esp) + fxch %st(1) + fstpt 16(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + call asinl@PLT +..B1.107: + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + fldl 80(%esp) + addl $16, %esp + fxch %st(5) + fstpl 184(%esp) + jmp ..B1.19 +..B1.16: + fxch %st(2) + fcom %st(5) + fnstsw %ax + sahf + jb ..B1.18 +..B1.17: + fstp %st(4) + addl $-32, %esp + fld %st(2) + fld %st(1) + fadd %st(6), %st + fmul %st(3), %st + fxch %st(6) + fstpt (%esp) + fldt (%esp) + fldt 152(%esp) + faddp %st, %st(2) + fldt 136(%esp) + fdivp %st, %st(2) + fldt 104(%esp) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(6) + fxch %st(5) + fsqrt + fstpt 12(%esp) + fxch %st(4) + fstpl 96(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + fstpt 80(%esp) + call atan2l@PLT + jmp ..B1.109 +..B1.18: + fxch %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(3) + fstpt (%esp) + fldt (%esp) + addl $-32, %esp + fxch %st(3) + fadd %st(5), %st + fxch %st(5) + fstpt (%esp) + fldt (%esp) + fldt 152(%esp) + faddp %st, %st(4) + fxch %st(3) + fdivr %st(5), %st + fldt 168(%esp) + fldt 120(%esp) + faddp %st, %st(1) + fdivrp %st, %st(6) + faddp %st, %st(5) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + fsqrt + fmulp %st, %st(3) + fxch %st(2) + fstpt 12(%esp) + fstpl 96(%esp) + fxch %st(1) + fstpt 48(%esp) + fstpt 64(%esp) + fldt 32(%esp) + fstpt 32(%esp) + fldt 80(%esp) + fstpt 80(%esp) + call atan2l@PLT +..B1.109: + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldl 96(%esp) + addl $32, %esp + fxch %st(5) + fstpl 184(%esp) +..B1.19: + fldt _Across@GOTOFF(%ebx) + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.24 +..B1.20: + fldt 120(%esp) + faddp %st, %st(1) + fxch %st(4) + fcomp %st(2) + fnstsw %ax + fldt 104(%esp) + fdivp %st, %st(4) + sahf + jae ..B1.22 + jp ..B1.22 +..B1.21: + fldt 72(%esp) + fldt 104(%esp) + fdivp %st, %st(1) + faddp %st, %st(4) + fmulp %st, %st(3) + jmp ..B1.23 +..B1.22: + fldt 88(%esp) + fldt 136(%esp) + faddp %st, %st(1) + faddp %st, %st(4) + fmulp %st, %st(3) +..B1.23: + addl $-16, %esp + faddp %st, %st(1) + fmul %st(1), %st + fsqrt + faddp %st, %st(1) + fstpt (%esp) + call log1pl@PLT + jmp ..B1.111 +..B1.24: + fstp %st(0) + fstp %st(0) + fstp %st(2) + fld %st(0) + addl $-16, %esp + fmul %st(1), %st + fsubp %st, %st(2) + fxch %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%esp) + call logl@PLT +..B1.111: + addl $16, %esp + fstpl 176(%esp) +..B1.25: + fldl _DBL_PZERO@GOTOFF(%ebx) + fcoml 160(%esp) + fnstsw %ax + sahf + jbe ..B1.27 +..B1.26: + movzbl 191(%esp), %ecx + movl %ecx, %edx + shrl $7, %ecx + andl $127, %edx + notl %ecx + shll $7, %ecx + orl %ecx, %edx + movb %dl, 191(%esp) +..B1.27: + fcompl 152(%esp) + fnstsw %ax + sahf + jbe ..B1.29 +..B1.28: + movzbl 183(%esp), %ecx + movl %ecx, %edx + shrl $7, %ecx + andl $127, %edx + notl %ecx + shll $7, %ecx + orl %ecx, %edx + movb %dl, 183(%esp) +..B1.29: + movzwl 182(%esp), %edx + testl $32752, %edx + jne ..B1.32 +..B1.30: + testl $1048575, 180(%esp) + jne ..B1.35 +..B1.31: + cmpl $0, 176(%esp) + jne ..B1.35 +..B1.32: + movzwl 190(%esp), %edx + testl $32752, %edx + jne ..B1.36 +..B1.33: + testl $1048575, 188(%esp) + jne ..B1.35 +..B1.34: + cmpl $0, 184(%esp) + je ..B1.36 +..B1.35: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 168(%esp) +..B1.36: + testl %edi, %edi + je ..B1.68 +..B1.37: + fldcw 14(%esp) + jmp ..B1.68 +..B1.38: + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %edx +..B1.39: + testl %edx, %edx + jne ..B1.43 +..B1.40: + testl $1048575, 24(%ebp) + jne ..B1.43 +..B1.41: + cmpl $0, 20(%ebp) + jne ..B1.43 +..B1.42: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call asinh@PLT +..B1.112: + fldl 20(%ebp) + addl $16, %esp + fstpl 184(%esp) + fstpl 176(%esp) + jmp ..B1.68 +..B1.43: + testl %ecx, %ecx + jne ..B1.56 +..B1.44: + testl $1048575, 16(%ebp) + jne ..B1.57 +..B1.45: + cmpl $0, 12(%ebp) + jne ..B1.57 +..B1.46: + cmpl $2047, %edx + jl ..B1.49 +..B1.47: + testl $1048575, 24(%ebp) + jne ..B1.57 +..B1.48: + cmpl $0, 20(%ebp) + jne ..B1.57 +..B1.49: + cmpl $1023, %edx + jl ..B1.54 +..B1.50: + fldl 20(%ebp) + movzbl 27(%ebp), %edx + andl $128, %edx + shrl $7, %edx + movl %edx, (%esp) + addl $-16, %esp + fmull ones@GOTOFF(%ebx,%edx,8) + fstpl (%esp) + call acosh@PLT +..B1.113: + addl $16, %esp + fstpl 176(%esp) + cmpl $0, (%esp) + je ..B1.52 +..B1.51: + fldl _DBL_NPIBY2@GOTOFF(%ebx) + jmp ..B1.53 +..B1.52: + fldl _DBL_PPIBY2@GOTOFF(%ebx) +..B1.53: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fadd %st(1), %st + fstpl 168(%esp) + fstpl 184(%esp) + fldl 176(%esp) + jmp ..B1.55 +..B1.54: + fldl _DBL_PZERO@GOTOFF(%ebx) + addl $-16, %esp + fldl 20(%ebp) + fstpl (%esp) + fstpl 16(%esp) + call asin@PLT +..B1.114: + fldl 16(%esp) + addl $16, %esp + fxch %st(1) + fstpl 184(%esp) +..B1.55: + movzbl 19(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fmull ones@GOTOFF(%ebx,%edx,8) + fstpl 176(%esp) + jmp ..B1.68 +..B1.56: + cmpl $2047, %ecx + je ..B1.95 +..B1.57: + cmpl $2047, %edx + je ..B1.91 +..B1.118: + cmpl $2047, %ecx +..B1.58: + je ..B1.77 +..B1.59: + jge ..B1.67 +..B1.60: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.62 +..B1.61: + fldl _DBL_NPIBY2@GOTOFF(%ebx) + jmp ..B1.63 +..B1.62: + fldl _DBL_PPIBY2@GOTOFF(%ebx) +..B1.63: + movzbl 19(%ebp), %edx + testl $128, %edx + fstl 184(%esp) + je ..B1.65 +..B1.64: + fldl _DBL_NINF@GOTOFF(%ebx) + jmp ..B1.66 +..B1.65: + fldl _DBL_PINF@GOTOFF(%ebx) +..B1.66: + fstpl 176(%esp) + fldl _DBL_PZERO@GOTOFF(%ebx) + fxch %st(1) + faddl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fstpl 168(%esp) + faddl 12(%ebp) + fstpl 168(%esp) + jmp ..B1.68 +..B1.67: + fldl 20(%ebp) + fstpl 176(%esp) + fldl 12(%ebp) + fmul %st(0), %st + fstpl 184(%esp) +..B1.68: + movl 176(%esp), %edx + movl %edx, (%esi) + movl 180(%esp), %ecx + movl 184(%esp), %edi + movl 188(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 192(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.76 +..B1.69: + movl %esi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.70: + xorl %edi, %edi + jmp ..B1.11 +..B1.71: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.72: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.39 +..B1.73: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.74: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.38 +..B1.76: + call __stack_chk_fail@PLT +..B1.77: + testl $1048575, 16(%ebp) + jne ..B1.116 +..B1.78: + cmpl $0, 12(%ebp) + jne ..B1.116 +..B1.79: + fldl 12(%ebp) + cmpl $2047, %edx + fstpl 176(%esp) + jge ..B1.84 +..B1.80: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.82 +..B1.81: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 184(%esp) + fldl _DBL_PZERO@GOTOFF(%ebx) + jmp ..B1.83 +..B1.82: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstl 184(%esp) +..B1.83: + faddl 20(%ebp) + fstpl 168(%esp) + jmp ..B1.68 +..B1.84: + testl $1048575, 24(%ebp) + jne ..B1.90 +..B1.85: + cmpl $0, 20(%ebp) + jne ..B1.90 +..B1.86: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.88 +..B1.87: + fldl _DBL_NPIBY4@GOTOFF(%ebx) + jmp ..B1.89 +..B1.88: + fldl _DBL_PPIBY4@GOTOFF(%ebx) +..B1.89: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fadd %st(1), %st + fstpl 168(%esp) + fstpl 184(%esp) + jmp ..B1.68 +..B1.90: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 184(%esp) + jmp ..B1.68 +..B1.91: + testl $1048575, 24(%ebp) + jne ..B1.93 +..B1.92: + cmpl $0, 20(%ebp) + je ..B1.115 +..B1.93: + cmpl $2047, %ecx + jge ..B1.58 +..B1.94: + fldl 20(%ebp) + fmul %st(0), %st + fstl 176(%esp) + fstpl 184(%esp) + jmp ..B1.68 +..B1.95: + testl $1048575, 16(%ebp) + jne ..B1.97 +..B1.96: + cmpl $0, 12(%ebp) + je ..B1.98 +..B1.97: + cmpl $2047, %edx + je ..B1.102 +..B1.98: + testl $1048575, 16(%ebp) + jne ..B1.100 +..B1.99: + cmpl $0, 12(%ebp) + je ..B1.57 +..B1.100: + cmpl $2047, %edx + jge ..B1.57 +..B1.101: + fldl 12(%ebp) + fmul %st(0), %st + fstl 176(%esp) + fstpl 184(%esp) + jmp ..B1.68 +..B1.102: + testl $1048575, 24(%ebp) + jne ..B1.104 +..B1.103: + cmpl $0, 20(%ebp) + je ..B1.98 +..B1.104: + fldl 12(%ebp) + fmul %st(0), %st + fstpl 176(%esp) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 184(%esp) + jmp ..B1.68 +..B1.115: + cmpl $2047, %ecx + je ..B1.77 + jmp ..B1.59 +..B1.116: + cmpl $2047, %ecx + jl ..B1.60 + jmp ..B1.67 + .align 16,0x90 + .type casinh,@function + .size casinh,.-casinh + .data +# -- End casinh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +_Bcross: + .word 26214 + .word 26214 + .word 26214 + .word -6554 + .word 16382 + .word 0 + .type _Bcross,@object + .size _Bcross,12 + .space 4, 0x00 # pad + .align 16 +_Across: + .word 0 + .word 0 + .word 0 + .word -16384 + .word 16383 + .word 0 + .type _Across,@object + .size _Across,12 + .space 4, 0x00 # pad + .align 16 +_DBL_PZERO: + .long 0 + .long 0 + .type _DBL_PZERO,@object + .size _DBL_PZERO,8 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 16 +_DBL_NPIBY2: + .long 1413754136 + .long -1074191877 + .type _DBL_NPIBY2,@object + .size _DBL_NPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY2: + .long 1413754136 + .long 1073291771 + .type _DBL_PPIBY2,@object + .size _DBL_PPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NINF: + .long 0 + .long -1048576 + .type _DBL_NINF,@object + .size _DBL_NINF,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PINF: + .long 0 + .long 2146435072 + .type _DBL_PINF,@object + .size _DBL_PINF,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NZERO: + .long 0 + .long -2147483648 + .type _DBL_NZERO,@object + .size _DBL_NZERO,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NPIBY4: + .long 1413754136 + .long -1075240453 + .type _DBL_NPIBY4,@object + .size _DBL_NPIBY4,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY4: + .long 1413754136 + .long 1072243195 + .type _DBL_PPIBY4,@object + .size _DBL_PPIBY4,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/casinhf.S b/external/sgx_libm/ia32/casinhf.S new file mode 100644 index 0000000000..de937f356e --- /dev/null +++ b/external/sgx_libm/ia32/casinhf.S @@ -0,0 +1,630 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinhf.c" + .text +..TXTST0: +# -- Begin casinhf + .text + .align 16,0x90 + .globl casinhf +casinhf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $120, %esp + fldz + movzwl 10(%ebp), %eax + andl $32640, %eax + shrl $7, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %eax + fsts 104(%esp) + fsts 108(%esp) + jge ..B1.28 +..B1.2: + testl %eax, %eax + jle ..B1.57 +..B1.3: + movzwl 14(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + cmpl $255, %edx + jge ..B1.29 +..B1.4: + testl %edx, %edx + jle ..B1.56 +..B1.5: + flds 12(%ebp) + fsts 100(%esp) + fld1 + fsts 92(%esp) + fxch %st(1) + fabs + fld %st(0) + fsub %st(2), %st + fld %st(0) + fmul %st(1), %st + fld %st(2) + faddp %st, %st(4) + fxch %st(3) + fstl 48(%esp) + fmul %st(0), %st + fxch %st(1) + fstl 72(%esp) + flds 8(%ebp) + fsts 96(%esp) + fabs + fld %st(0) + fmul %st(1), %st + fstl 56(%esp) + fadd %st, %st(5) + fxch %st(5) + fsqrt + fstl 64(%esp) + fxch %st(5) + faddp %st, %st(3) + fxch %st(2) + fsqrt + fld %st(0) + fadd %st(5), %st + fxch %st(5) + fucomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + fldl .L_2il0floatpacket.6@GOTOFF(%ebx) + fmul %st, %st(4) + sahf + jp ..B1.6 + je ..B1.7 +..B1.6: + fldl 64(%esp) + fsubl 72(%esp) + fstpl 40(%esp) + jmp ..B1.8 +..B1.7: + fxch %st(2) + fstl 40(%esp) + fxch %st(2) +..B1.8: + fldl _Bcross@GOTOFF(%ebx) + fmul %st(5), %st + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.10 +..B1.9: + fstp %st(2) + fld %st(2) + fdiv %st(4), %st + fstpl (%esp) + fxch %st(2) + fstps 80(%esp) + fxch %st(1) + fstpl 16(%esp) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + call asin@PLT + jmp ..B1.85 +..B1.10: + flds 92(%esp) + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.12 +..B1.11: + fstp %st(2) + fldl 48(%esp) + fadd %st(1), %st + fld %st(4) + fadd %st(4), %st + fmul %st(3), %st + fxch %st(1) + fdivrl 56(%esp) + faddl 40(%esp) + fmulp %st, %st(1) + fsqrt + fstpl 8(%esp) + fxch %st(2) + fstl (%esp) + fstps 80(%esp) + fxch %st(1) + fstpl 16(%esp) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + call atan2@PLT + jmp ..B1.85 +..B1.12: + fldl 48(%esp) + fadd %st(2), %st + fxch %st(2) + fstpl 16(%esp) + fld %st(4) + fadd %st(4), %st + fdiv %st, %st(2) + fldl 72(%esp) + faddl 64(%esp) + fdivrp %st, %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + fmulp %st, %st(2) + fxch %st(1) + fstpl 8(%esp) + fxch %st(1) + fstl (%esp) + fstps 80(%esp) + fstpl 24(%esp) + fstpl 32(%esp) + fstps 84(%esp) + fldl 16(%esp) + fstpl 16(%esp) + call atan2@PLT +..B1.85: + flds 84(%esp) + fxch %st(1) + fstps 108(%esp) + fldl 32(%esp) + fldl 24(%esp) + fldl 16(%esp) + flds 80(%esp) +..B1.13: + fldl _Across@GOTOFF(%ebx) + fcomp %st(4) + fnstsw %ax + sahf + jb ..B1.18 +..B1.14: + flds 92(%esp) + fcompp + fnstsw %ax + faddl 48(%esp) + fdivrl 56(%esp) + sahf + jbe ..B1.16 +..B1.15: + fldl 56(%esp) + fdivl 40(%esp) + faddp %st, %st(1) + fmulp %st, %st(1) + jmp ..B1.17 +..B1.16: + fldl 72(%esp) + faddl 64(%esp) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.17: + fxch %st(1) + fadds 92(%esp) + fmul %st(1), %st + fsqrt + faddp %st, %st(1) + fstpl (%esp) + fstps 84(%esp) + call log1p@PLT + jmp ..B1.87 +..B1.18: + fstp %st(1) + fstp %st(1) + fstp %st(0) + fld %st(0) + fmul %st(1), %st + fsubs 92(%esp) + fsqrt + faddp %st, %st(1) + fstpl (%esp) + fstps 84(%esp) + call log@PLT +..B1.87: + flds 84(%esp) + fxch %st(1) + fstps 104(%esp) +..B1.19: + fcoms 100(%esp) + fnstsw %ax + sahf + jbe ..B1.21 +..B1.20: + movzbl 111(%esp), %edi + movl %edi, %eax + shrl $7, %edi + andl $127, %eax + notl %edi + shll $7, %edi + orl %edi, %eax + movb %al, 111(%esp) +..B1.21: + fcomps 96(%esp) + fnstsw %ax + sahf + jbe ..B1.23 +..B1.22: + movzbl 107(%esp), %edi + movl %edi, %eax + shrl $7, %edi + andl $127, %eax + notl %edi + shll $7, %edi + orl %edi, %eax + movb %al, 107(%esp) +..B1.23: + movzwl 106(%esp), %eax + testl $32640, %eax + jne ..B1.25 +..B1.24: + testl $8388607, 104(%esp) + jne ..B1.27 +..B1.25: + movzwl 110(%esp), %eax + testl $32640, %eax + jne ..B1.55 +..B1.26: + testl $8388607, 108(%esp) + je ..B1.55 +..B1.27: + flds .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st(0), %st + fstps 88(%esp) + jmp ..B1.55 +..B1.28: + movzwl 14(%ebp), %edx + andl $32640, %edx + shrl $7, %edx +..B1.29: + testl %edx, %edx + jne ..B1.32 +..B1.30: + testl $8388607, 12(%ebp) + jne ..B1.32 +..B1.31: + fstp %st(0) + addl $4, %esp + pushl 8(%ebp) + call asinhf@PLT +..B1.88: + movl 12(%ebp), %eax + fstps 104(%esp) + movl %eax, 108(%esp) + jmp ..B1.55 +..B1.32: + testl %eax, %eax + jne ..B1.43 +..B1.33: + testl $8388607, 8(%ebp) + jne ..B1.44 +..B1.34: + cmpl $255, %edx + jl ..B1.36 +..B1.35: + testl $8388607, 12(%ebp) + jne ..B1.44 +..B1.36: + cmpl $127, %edx + jl ..B1.41 +..B1.37: + fstp %st(0) + flds 12(%ebp) + movzbl 15(%ebp), %edi + andl $128, %edi + shrl $7, %edi + fmuls ones@GOTOFF(%ebx,%edi,4) + fstps (%esp) + call acoshf@PLT +..B1.89: + fstps 104(%esp) + testl %edi, %edi + je ..B1.39 +..B1.38: + flds .L_2il0floatpacket.7@GOTOFF(%ebx) + jmp ..B1.40 +..B1.39: + flds .L_2il0floatpacket.8@GOTOFF(%ebx) +..B1.40: + flds .L_2il0floatpacket.9@GOTOFF(%ebx) + fadd %st(1), %st + fstps 88(%esp) + fstps 108(%esp) + flds 104(%esp) + jmp ..B1.42 +..B1.41: + movl 12(%ebp), %eax + movl %eax, (%esp) + fstps 84(%esp) + call asinf@PLT +..B1.90: + flds 84(%esp) + fxch %st(1) + fstps 108(%esp) +..B1.42: + movzbl 11(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmuls ones@GOTOFF(%ebx,%eax,4) + fstps 104(%esp) + jmp ..B1.55 +..B1.43: + cmpl $255, %eax + je ..B1.74 +..B1.44: + cmpl $255, %edx + je ..B1.71 +..B1.93: + cmpl $255, %eax +..B1.45: + je ..B1.59 +..B1.96: + fstp %st(0) +..B1.46: + jge ..B1.54 +..B1.47: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.49 +..B1.48: + flds .L_2il0floatpacket.7@GOTOFF(%ebx) + jmp ..B1.50 +..B1.49: + flds .L_2il0floatpacket.8@GOTOFF(%ebx) +..B1.50: + movzbl 11(%ebp), %eax + testl $128, %eax + fsts 108(%esp) + je ..B1.52 +..B1.51: + movl $-8388608, %eax + jmp ..B1.53 +..B1.52: + movl $2139095040, %eax +..B1.53: + movl %eax, 104(%esp) + movl 8(%ebp), %eax + fadds .L_2il0floatpacket.9@GOTOFF(%ebx) + fstps 88(%esp) + movl %eax, 88(%esp) + jmp ..B1.55 +..B1.54: + flds 8(%ebp) + fmul %st(0), %st + movl 12(%ebp), %eax + movl %eax, 104(%esp) + fstps 108(%esp) +..B1.55: + movl 104(%esp), %eax + movl 108(%esp), %edx + addl $120, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.56: + testl $8388607, 12(%ebp) + jne ..B1.5 + jmp ..B1.29 +..B1.57: + testl $8388607, 8(%ebp) + jne ..B1.3 + jmp ..B1.28 +..B1.59: + testl $8388607, 8(%ebp) + jne ..B1.92 +..B1.60: + movl 8(%ebp), %eax + cmpl $255, %edx + movl %eax, 104(%esp) + jge ..B1.65 +..B1.61: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.64 +..B1.62: + fstp %st(0) + flds .L_2il0floatpacket.10@GOTOFF(%ebx) +..B1.64: + movl 12(%ebp), %eax + fstps 108(%esp) + movl %eax, 88(%esp) + jmp ..B1.55 +..B1.65: + fstp %st(0) + testl $8388607, 12(%ebp) + jne ..B1.70 +..B1.66: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.68 +..B1.67: + flds .L_2il0floatpacket.11@GOTOFF(%ebx) + jmp ..B1.69 +..B1.68: + flds .L_2il0floatpacket.12@GOTOFF(%ebx) +..B1.69: + flds .L_2il0floatpacket.9@GOTOFF(%ebx) + fadd %st(1), %st + fstps 88(%esp) + fstps 108(%esp) + jmp ..B1.55 +..B1.70: + flds 12(%ebp) + fmul %st(0), %st + fstps 108(%esp) + jmp ..B1.55 +..B1.71: + testl $8388607, 12(%ebp) + je ..B1.91 +..B1.72: + cmpl $255, %eax + jge ..B1.45 +..B1.73: + fstp %st(0) + flds 12(%ebp) + fmul %st(0), %st + fsts 104(%esp) + fstps 108(%esp) + jmp ..B1.55 +..B1.74: + testl $8388607, 8(%ebp) + je ..B1.76 +..B1.75: + cmpl $255, %edx + je ..B1.79 +..B1.95: + testl $8388607, 8(%ebp) +..B1.76: + je ..B1.44 +..B1.77: + cmpl $255, %edx + jge ..B1.44 +..B1.78: + fstp %st(0) + flds 8(%ebp) + fmul %st(0), %st + fsts 104(%esp) + fstps 108(%esp) + jmp ..B1.55 +..B1.79: + testl $8388607, 12(%ebp) + je ..B1.94 +..B1.80: + fstp %st(0) + flds 8(%ebp) + fmul %st(0), %st + fstps 104(%esp) + flds 12(%ebp) + fmul %st(0), %st + fstps 108(%esp) + jmp ..B1.55 +..B1.91: + cmpl $255, %eax + je ..B1.59 + jmp ..B1.96 +..B1.92: + fstp %st(0) + cmpl $255, %eax + jl ..B1.47 + jmp ..B1.54 +..B1.94: + testl $8388607, 8(%ebp) + jne ..B1.77 + jmp ..B1.44 + .align 16,0x90 + .type casinhf,@function + .size casinhf,.-casinhf + .data +# -- End casinhf + .section .rodata, "a" + .align 16 + .align 16 +_Bcross: + .long -858993459 + .long 1072483532 + .type _Bcross,@object + .size _Bcross,8 + .space 8, 0x00 # pad + .align 16 +_Across: + .long 0 + .long 1073217536 + .type _Across,@object + .size _Across,8 + .space 8, 0x00 # pad + .align 16 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 4 +.L_2il0floatpacket.7: + .long 0xbfc90fdb + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,4 + .align 4 +.L_2il0floatpacket.8: + .long 0x3fc90fdb + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +.L_2il0floatpacket.9: + .long 0x00800000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,4 + .align 4 +.L_2il0floatpacket.10: + .long 0x80000000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +.L_2il0floatpacket.11: + .long 0xbf490fdb + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,4 + .align 4 +.L_2il0floatpacket.12: + .long 0x3f490fdb + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +.L_2il0floatpacket.13: + .long 0xff800000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,4 + .align 4 +.L_2il0floatpacket.14: + .long 0x7f800000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/casinhl.S b/external/sgx_libm/ia32/casinhl.S new file mode 100644 index 0000000000..31dd4fbe27 --- /dev/null +++ b/external/sgx_libm/ia32/casinhl.S @@ -0,0 +1,441 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinhl.c" + .text +..TXTST0: +# -- Begin casinhl + .text + .align 16,0x90 + .globl casinhl +casinhl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 272(%esp) + fstpt 8(%esp) + fldt 8(%esp) + fstpt 248(%esp) + fldt 248(%esp) + fstpt 260(%esp) +..B1.2: + fnstcw 22(%esp) +..B1.3: + movzwl 22(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.62 +..B1.4: + orl $-64768, %ecx + movw %cx, 20(%esp) +..B1.5: + fldcw 20(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.16 +..B1.8: + testl %ecx, %ecx + jle ..B1.41 +..B1.9: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.16 +..B1.10: + testl %edx, %edx + jle ..B1.39 +..B1.11: + addl $-48, %esp + lea 24(%ebp), %edx + lea 12(%ebp), %ecx + movl %edx, (%esp) + lea 268(%esp), %edx + movl %ecx, 4(%esp) + movl %edx, 8(%esp) + lea 240(%esp), %edx + movl %edx, 12(%esp) + lea 212(%esp), %edx + movl %edx, 16(%esp) + lea 184(%esp), %edx + movl %edx, 20(%esp) + lea 156(%esp), %edx + movl %edx, 24(%esp) + lea 128(%esp), %edx + movl %edx, 28(%esp) + lea 100(%esp), %edx + movl %edx, 32(%esp) + lea 72(%esp), %edx + movl %edx, 36(%esp) + call __libm_carctrigprepare_k80 +..B1.65: + lea 72(%esp), %edx + lea 12(%ebp), %ecx +..B1.12: + lea 24(%ebp), %eax + movl %eax, (%esp) + lea 268(%esp), %eax + movl %ecx, 4(%esp) + movl %eax, 8(%esp) + lea 240(%esp), %eax + movl %eax, 12(%esp) + lea 212(%esp), %eax + movl %eax, 16(%esp) + lea 184(%esp), %eax + movl %eax, 20(%esp) + lea 156(%esp), %eax + movl %eax, 24(%esp) + lea 128(%esp), %eax + movl %eax, 28(%esp) + lea 100(%esp), %eax + movl %eax, 32(%esp) + movl %edx, 36(%esp) + call __libm_recacoshl_k80 +..B1.66: + lea 72(%esp), %edx + addl $48, %esp + lea 12(%ebp), %ecx +..B1.13: + movzbl 9(%ecx), %eax + andl $128, %eax + shrl $7, %eax + fldl ones@GOTOFF(%ebx,%eax,8) + lea 24(%ebp), %eax + fmulp %st, %st(1) + fstpt 248(%esp) + addl $-48, %esp + movl %eax, (%esp) + movl %ecx, 4(%esp) + lea 268(%esp), %ecx + movl %ecx, 8(%esp) + lea 240(%esp), %ecx + movl %ecx, 12(%esp) + lea 212(%esp), %ecx + movl %ecx, 16(%esp) + lea 184(%esp), %ecx + movl %ecx, 20(%esp) + lea 156(%esp), %ecx + movl %ecx, 24(%esp) + lea 128(%esp), %ecx + movl %ecx, 28(%esp) + lea 100(%esp), %ecx + movl %ecx, 32(%esp) + movl %edx, 36(%esp) + call __libm_recasinl_k80 +..B1.67: + addl $48, %esp +..B1.14: + fstpt 260(%esp) + jmp ..B1.35 +..B1.16: + movl 28(%ebp), %edx +..B1.17: + testl %edx, %edx + jne ..B1.20 +..B1.75: + cmpl $0, 24(%ebp) +..B1.18: + jne ..B1.20 +..B1.19: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call asinhl@PLT +..B1.68: + fldt 24(%ebp) + addl $16, %esp + fstpt 260(%esp) + fstpt 248(%esp) + jmp ..B1.35 +..B1.20: + movl 16(%ebp), %eax + testl %eax, %eax + movl %eax, (%esp) + jne ..B1.29 +..B1.21: + movzwl 32(%ebp), %eax + andl $32767, %eax + cmpl $0, 12(%ebp) + jne ..B1.30 +..B1.22: + cmpl $32767, %eax + jl ..B1.25 +..B1.23: + cmpl $-2147483648, %edx + jne ..B1.30 +..B1.24: + cmpl $0, 24(%ebp) + jne ..B1.30 +..B1.25: + fldt 24(%ebp) + cmpl $16383, %eax + jl ..B1.27 +..B1.26: + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl ones@GOTOFF(%ebx,%edx,8) + fstl (%esp) + addl $-16, %esp + fmulp %st, %st(1) + fstpt (%esp) + call acoshl@PLT +..B1.70: + fstpt 24(%esp) + fldl 16(%esp) + fstpt (%esp) + call asinl@PLT + jmp ..B1.71 +..B1.27: + addl $-16, %esp + fstpt (%esp) + call asinl@PLT +..B1.71: + addl $16, %esp + fstpt 260(%esp) +..B1.28: + fldt 8(%esp) + movzbl 21(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fmull ones@GOTOFF(%ebx,%edx,8) + fstpt 248(%esp) + jmp ..B1.35 +..B1.29: + movzwl 32(%ebp), %eax + andl $32767, %eax +..B1.30: + cmpl $32767, %ecx + je ..B1.52 +..B1.31: + cmpl $32767, %eax + je ..B1.48 +..B1.74: + cmpl $32767, %ecx +..B1.32: + je ..B1.45 +..B1.33: + fldt 24(%ebp) + fld %st(0) + fmul %st(1), %st + fldt 12(%ebp) + fxch %st(2) +..B1.34: + movzbl 21(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl ones@GOTOFF(%ebx,%edx,8) + fmul %st, %st(2) + fxch %st(2) + fstpt 248(%esp) + addl $-32, %esp + fxch %st(2) + fmulp %st, %st(1) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT +..B1.72: + addl $32, %esp + fstpt 260(%esp) +..B1.35: + testl %edi, %edi + je ..B1.37 +..B1.36: + fldcw 22(%esp) +..B1.37: + movl 248(%esp), %edx + movl %edx, (%esi) + movl 260(%esp), %edx + movl %edx, 12(%esi) + movl 264(%esp), %edx + movl %edx, 16(%esi) + movl 252(%esp), %ecx + movl 256(%esp), %edi + movl 268(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 272(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.44 +..B1.38: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.39: + movl 28(%ebp), %edx + testl %edx, %edx + jne ..B1.11 +..B1.40: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.18 +..B1.41: + cmpl $0, 16(%ebp) + jne ..B1.9 +..B1.42: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.16 +..B1.44: + call __stack_chk_fail@PLT +..B1.45: + cmpl $-2147483648, (%esp) + jne ..B1.33 +..B1.46: + cmpl $0, 12(%ebp) + jne ..B1.33 +..B1.47: + fldt 12(%ebp) + fld %st(0) + fmul %st(1), %st + fldt 24(%ebp) + jmp ..B1.34 +..B1.48: + cmpl $-2147483648, %edx + jne ..B1.50 +..B1.49: + cmpl $0, 24(%ebp) + je ..B1.73 +..B1.50: + cmpl $32767, %ecx + jge ..B1.32 +..B1.51: + fldt 24(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 248(%esp) + fstpt 260(%esp) + jmp ..B1.35 +..B1.52: + cmpl $-2147483648, (%esp) + jne ..B1.54 +..B1.53: + cmpl $0, 12(%ebp) + je ..B1.56 +..B1.54: + cmpl $32767, %eax + je ..B1.59 +..B1.55: + cmpl $-2147483648, (%esp) + jne ..B1.57 +..B1.76: + cmpl $0, 12(%ebp) +..B1.56: + je ..B1.31 +..B1.57: + cmpl $32767, %eax + jge ..B1.31 +..B1.58: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 248(%esp) + fstpt 260(%esp) + jmp ..B1.35 +..B1.59: + cmpl $-2147483648, %edx + jne ..B1.61 +..B1.60: + cmpl $0, 24(%ebp) + je ..B1.55 +..B1.61: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 248(%esp) + fldt 24(%ebp) + fmul %st(0), %st + fstpt 260(%esp) + jmp ..B1.35 +..B1.62: + xorl %edi, %edi + jmp ..B1.7 +..B1.73: + cmpl $32767, %ecx + je ..B1.45 + jmp ..B1.33 + .align 16,0x90 + .type casinhl,@function + .size casinhl,.-casinhl + .data +# -- End casinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .hidden __libm_recasinl_k80 + .hidden __libm_recacoshl_k80 + .hidden __libm_carctrigprepare_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/casinl.S b/external/sgx_libm/ia32/casinl.S new file mode 100644 index 0000000000..efe03286b1 --- /dev/null +++ b/external/sgx_libm/ia32/casinl.S @@ -0,0 +1,210 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinl.c" + .text +..TXTST0: +# -- Begin casinl + .text + .align 16,0x90 + .globl casinl +casinl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 100(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 40(%esp) + fldt 40(%esp) + fstpt 52(%esp) + fldt 52(%esp) + fstpt 64(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.4: + orl $-64768, %ecx + movw %cx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %edi +..B1.7: + fldt 24(%ebp) + movzwl 32(%ebp), %edx + andl $32767, %edx + fstpt 52(%esp) + cmpl $32767, %edx + fldt 12(%ebp) + fstpt 64(%esp) + jl ..B1.10 +..B1.8: + cmpl $-2147483648, 28(%ebp) + jne ..B1.11 +..B1.9: + cmpl $0, 24(%ebp) + jne ..B1.11 +..B1.10: + movzbl 33(%ebp), %ecx + notl %ecx + movzbl 61(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 61(%esp) +..B1.11: + addl $-32, %esp + lea 108(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl -24(%ecx), %ecx + movl %ecx, (%edx) + movl 88(%esp), %ecx + movl %ecx, 4(%edx) + movl 92(%esp), %ecx + movl %ecx, 8(%edx) + movl 96(%esp), %ecx + movl %ecx, 12(%edx) + movl 100(%esp), %ecx + movl %ecx, 16(%edx) + movl 104(%esp), %ecx + movl %ecx, 20(%edx) + call casinhl@PLT +..B1.23: + addl $28, %esp + fldt 76(%esp) + movzwl 84(%esp), %edx + andl $32767, %edx + fstpt 4(%esp) + fldt 4(%esp) + cmpl $32767, %edx + fstpt 40(%esp) + fldt 88(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + jl ..B1.14 +..B1.12: + cmpl $-2147483648, 8(%esp) + jne ..B1.15 +..B1.13: + cmpl $0, 4(%esp) + jne ..B1.15 +..B1.14: + movzbl 13(%esp), %ecx + notl %ecx + movzbl 49(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 49(%esp) +..B1.15: + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 2(%esp) +..B1.17: + movl 28(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 12(%esi) + movl 44(%esp), %edx + movl %edx, 16(%esi) + movl 32(%esp), %ecx + movl 36(%esp), %edi + movl 48(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 100(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.19 +..B1.18: + movl %esi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.19: + call __stack_chk_fail@PLT +..B1.20: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type casinl,@function + .size casinl,.-casinl + .data +# -- End casinl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/catan.S b/external/sgx_libm/ia32/catan.S new file mode 100644 index 0000000000..6439e8be43 --- /dev/null +++ b/external/sgx_libm/ia32/catan.S @@ -0,0 +1,237 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catan.c" + .text +..TXTST0: +# -- Begin catan + .text + .align 16,0x90 + .globl catan +catan: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $72, %esp + fldz + fldl 20(%ebp) + fldl 12(%ebp) + movzwl 26(%ebp), %ecx + andl $32752, %ecx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 64(%esp) + cmpl $32752, %ecx + fstpl 56(%esp) + fxch %st(1) + fstl 16(%esp) + fstl 24(%esp) + fstl 32(%esp) + fstpl 40(%esp) + fstpl 48(%esp) + jl ..B1.4 +..B1.2: + testl $1048575, 24(%ebp) + jne ..B1.5 +..B1.3: + cmpl $0, 20(%ebp) + jne ..B1.5 +..B1.4: + movzbl 27(%ebp), %edx + notl %edx + movzbl 55(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 55(%esp) +..B1.5: + addl $-32, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea 32(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl 48(%ecx), %ecx + movl %ecx, (%edx) + movl 84(%esp), %ecx + movl %ecx, 4(%edx) + movl 88(%esp), %ecx + movl %ecx, 8(%edx) + movl 92(%esp), %ecx + movl %ecx, 12(%edx) + call catanh@PLT +..B1.14: + addl $28, %esp + fldl (%esp) + movzwl 6(%esp), %edx + andl $32752, %edx + fstl 16(%esp) + cmpl $32752, %edx + fstpl 40(%esp) + fldl 8(%esp) + fstl 24(%esp) + fstpl 32(%esp) + jl ..B1.8 +..B1.6: + testl $1048575, 20(%esp) + jne ..B1.9 +..B1.7: + cmpl $0, 16(%esp) + jne ..B1.9 +..B1.8: + movzbl 23(%esp), %edx + notl %edx + movzbl 47(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 47(%esp) +..B1.9: + movl 32(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 8(%esi) + movl 36(%esp), %ecx + movl 44(%esp), %edx + movl %ecx, 4(%esi) + movl %edx, 12(%esi) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.11 +..B1.10: + movl %esi, %eax + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.11: + call __stack_chk_fail@PLT + .align 16,0x90 + .type catan,@function + .size catan,.-catan + .data +# -- End catan + .text +# -- Begin catanf + .text + .align 16,0x90 + .globl catanf +catanf: +# parameter 1: 48 + %esp +..B2.1: +..L3: + + pushl %ebx + subl $40, %esp + xorl %eax, %eax + movl %eax, 16(%esp) + movl %eax, 20(%esp) + movl %eax, 24(%esp) + movl %eax, 28(%esp) + movzwl 54(%esp), %eax + andl $32640, %eax + movl 52(%esp), %edx + cmpl $32640, %eax + movl 48(%esp), %ecx + movl %edx, 32(%esp) + movl %ecx, 36(%esp) + jl ..B2.3 +..B2.2: + testl $8388607, 52(%esp) + jne ..B2.4 +..B2.3: + movzbl 55(%esp), %eax + notl %eax + movzbl 35(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 35(%esp) +..B2.4: + addl $8, %esp + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + pushl 28(%esp) + pushl 28(%esp) + call catanhf@PLT +..B2.10: + movl %eax, 16(%esp) + movl %eax, 28(%esp) + shrl $16, %eax + andl $32640, %eax + cmpl $32640, %eax + movl %edx, 20(%esp) + movl %edx, 24(%esp) + jl ..B2.6 +..B2.5: + testl $8388607, 16(%esp) + jne ..B2.7 +..B2.6: + movzbl 19(%esp), %eax + notl %eax + movzbl 31(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 31(%esp) +..B2.7: + movl 24(%esp), %eax + movl 28(%esp), %edx + addl $40, %esp + popl %ebx + ret + .align 16,0x90 + .type catanf,@function + .size catanf,.-catanf + .data +# -- End catanf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/catanh.S b/external/sgx_libm/ia32/catanh.S new file mode 100644 index 0000000000..41181a538b --- /dev/null +++ b/external/sgx_libm/ia32/catanh.S @@ -0,0 +1,727 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanh.c" + .text +..TXTST0: +# -- Begin catanh + .text + .align 16,0x90 + .globl catanh +catanh: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 192(%esp) + fstl 176(%esp) + fstpl 184(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 18(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %edx + jge ..B1.19 +..B1.4: + testl %edx, %edx + jle ..B1.74 +..B1.5: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + jge ..B1.20 +..B1.6: + testl %ecx, %ecx + jle ..B1.72 +..B1.7: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.71 +..B1.8: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movl $1, %edi +..B1.11: + fldl 12(%ebp) + fstl 160(%esp) + fmul %st(0), %st + fstpt 80(%esp) + fldt 80(%esp) + fldl 20(%ebp) + fld %st(0) + fmul %st(1), %st + fstpt 144(%esp) + fldt 144(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fstpt 128(%esp) + fldt 128(%esp) + fsubp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 28(%esp) + fldt 28(%esp) + fabs + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fstpt 96(%esp) + fldt 96(%esp) + fcompp + fnstsw %ax + sahf + jbe ..B1.13 +..B1.12: + fldl 160(%esp) + fldt 128(%esp) + faddp %st, %st(1) + fstpt 112(%esp) + fldt 112(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fxch %st(1) + fstpt 12(%esp) + fstpt 48(%esp) + call atan2l@PLT +..B1.106: + fldt 48(%esp) + addl $32, %esp + fchs + fxch %st(1) + fstpt 40(%esp) + fldt 128(%esp) + fsubl 160(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + fldt 12(%esp) + fstpt 32(%esp) + call atan2l@PLT +..B1.105: + fldt 32(%esp) + addl $32, %esp + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fstpt 16(%esp) + fldt 16(%esp) + fxch %st(2) + fstpt 52(%esp) + fldt 40(%esp) + fldt 52(%esp) + fsubrp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpl 184(%esp) + jmp ..B1.14 +..B1.13: + fldt 28(%esp) + addl $-32, %esp + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT +..B1.107: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + addl $32, %esp + fstpt 16(%esp) + fldt 16(%esp) + fmulp %st, %st(1) + fstpl 184(%esp) + fldl 160(%esp) + fld %st(0) + fldt 128(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpt 112(%esp) + fsubp %st, %st(1) +..B1.14: + fldt 112(%esp) + fstpt 40(%esp) + fchs + fldt 40(%esp) + fldt 40(%esp) + fmulp %st, %st(1) + fldt 144(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpt 64(%esp) + fxch %st(1) + fstpt 52(%esp) + fldt 52(%esp) + fldt 52(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 28(%esp) + fldt 64(%esp) + fldt 28(%esp) + fsubrp %st, %st(1) + fabs + fldt 28(%esp) + fldt 96(%esp) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B1.16 + jp ..B1.16 +..B1.15: + fldt 64(%esp) + fldt 28(%esp) + addl $-16, %esp + fdivrp %st, %st(1) + fstpt (%esp) + call logl@PLT +..B1.108: + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpl 176(%esp) + jmp ..B1.17 +..B1.16: + fldt 80(%esp) + fldt 144(%esp) + faddp %st, %st(1) + fldt 128(%esp) + faddp %st, %st(1) + fstpt 28(%esp) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmull 160(%esp) + fstpt 64(%esp) + fldt 64(%esp) + fldt 28(%esp) + addl $-16, %esp + fdivrp %st, %st(1) + fstpt (%esp) + call atanhl@PLT +..B1.109: + addl $16, %esp + fldt 16(%esp) + fmulp %st, %st(1) + fstpl 176(%esp) +..B1.17: + testl %edi, %edi + je ..B1.62 +..B1.18: + fldcw 14(%esp) + jmp ..B1.62 +..B1.19: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx +..B1.20: + cmpl $2047, %edx + je ..B1.90 +..B1.21: + cmpl $2047, %ecx + je ..B1.83 +..B1.22: + cmpl $2047, %ecx + jge ..B1.54 +..B1.23: + testl %edx, %edx + jle ..B1.80 +..B1.24: + cmpl $1023, %edx + jge ..B1.28 +..B1.25: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call atanh@PLT +..B1.110: + addl $16, %esp + movzbl 27(%ebp), %edx + testl $128, %edx + fstpl 176(%esp) + je ..B1.27 +..B1.26: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 184(%esp) + jmp ..B1.62 +..B1.27: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 184(%esp) + jmp ..B1.62 +..B1.28: + je ..B1.78 +..B1.29: + cmpl $2047, %edx + jge ..B1.43 +..B1.30: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.77 +..B1.31: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.32: + fldcw 12(%esp) +..B1.33: + movl $1, %edx +..B1.34: + fldl 12(%ebp) + fld %st(0) + fld %st(1) + fmul %st(2), %st + fldl 20(%ebp) + fmul %st(0), %st + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fld %st(0) + fsub %st(5), %st + fchs + fxch %st(1) + fadd %st, %st(4) + fxch %st(4) + fstpt 40(%esp) + fldt 40(%esp) + fldt 40(%esp) + fmulp %st, %st(1) + fadd %st(2), %st + fstpt 64(%esp) + fstpt 52(%esp) + fldt 52(%esp) + fldt 52(%esp) + fmulp %st, %st(1) + fadd %st(1), %st + fstpt 28(%esp) + fldt 64(%esp) + fldt 28(%esp) + fsubrp %st, %st(1) + fabs + fldt 28(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B1.36 + jp ..B1.36 +..B1.35: + fstp %st(2) + fstp %st(1) + fstp %st(0) + fstp %st(0) + fldt 64(%esp) + fldt 28(%esp) + addl $-16, %esp + fdivrp %st, %st(1) + fstpt (%esp) + movl %edx, 16(%esp) + call logl@PLT +..B1.111: + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + fmulp %st, %st(1) + movl 16(%esp), %edx + addl $16, %esp + fstpl 176(%esp) + jmp ..B1.37 +..B1.36: + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 28(%esp) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fldt 28(%esp) + addl $-16, %esp + fdivrp %st, %st(1) + fstpt (%esp) + movl %edx, 16(%esp) + call atanhl@PLT +..B1.112: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fmulp %st, %st(1) + movl 16(%esp), %edx + addl $16, %esp + fstpl 176(%esp) +..B1.37: + testl %edx, %edx + je ..B1.39 +..B1.38: + fldcw 14(%esp) +..B1.39: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.41 +..B1.40: + fldl _DBL_NPIBY2@GOTOFF(%ebx) + jmp ..B1.42 +..B1.41: + fldl _DBL_PPIBY2@GOTOFF(%ebx) +..B1.42: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstl 184(%esp) + faddp %st, %st(1) + fstpl 168(%esp) + jmp ..B1.62 +..B1.43: + testl %ecx, %ecx + jne ..B1.47 +..B1.44: + testl $1048575, 24(%ebp) + jne ..B1.46 +..B1.45: + cmpl $0, 20(%ebp) + je ..B1.47 +..B1.46: + fldl .L_2il0floatpacket.12@GOTOFF(%ebx) + faddl 20(%ebp) + fstpl 168(%esp) +..B1.47: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.49 +..B1.48: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 176(%esp) + jmp ..B1.50 +..B1.49: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 176(%esp) +..B1.50: + movzbl 27(%ebp), %edx + testl $128, %edx + je ..B1.52 +..B1.51: + fldl _DBL_NPIBY2@GOTOFF(%ebx) + jmp ..B1.53 +..B1.52: + fldl _DBL_PPIBY2@GOTOFF(%ebx) +..B1.53: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstl 184(%esp) + faddp %st, %st(1) + fstpl 168(%esp) + jmp ..B1.62 +..B1.54: + testl %edx, %edx + jne ..B1.58 +..B1.55: + testl $1048575, 16(%ebp) + jne ..B1.57 +..B1.56: + cmpl $0, 12(%ebp) + je ..B1.58 +..B1.57: + fldl .L_2il0floatpacket.12@GOTOFF(%ebx) + faddl 12(%ebp) + fstpl 168(%esp) +..B1.58: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.60 +..B1.59: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 176(%esp) + jmp ..B1.61 +..B1.60: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 176(%esp) +..B1.61: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call atan@PLT +..B1.113: + addl $16, %esp + fstpl 184(%esp) +..B1.62: + movzwl 182(%esp), %edx + testl $32752, %edx + jne ..B1.65 +..B1.63: + testl $1048575, 180(%esp) + jne ..B1.68 +..B1.64: + cmpl $0, 176(%esp) + jne ..B1.68 +..B1.65: + movzwl 190(%esp), %edx + testl $32752, %edx + jne ..B1.69 +..B1.66: + testl $1048575, 188(%esp) + jne ..B1.68 +..B1.67: + cmpl $0, 184(%esp) + je ..B1.69 +..B1.68: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 168(%esp) +..B1.69: + movl 176(%esp), %edx + movl %edx, (%esi) + movl 180(%esp), %ecx + movl 184(%esp), %edi + movl 188(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 192(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.82 +..B1.70: + movl %esi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.71: + xorl %edi, %edi + jmp ..B1.11 +..B1.72: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.73: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.20 +..B1.74: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.75: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.19 +..B1.77: + xorl %edx, %edx + jmp ..B1.34 +..B1.78: + testl $1048575, 16(%ebp) + jne ..B1.29 +..B1.79: + cmpl $0, 12(%ebp) + je ..B1.25 + jmp ..B1.29 +..B1.80: + testl $1048575, 16(%ebp) + jne ..B1.24 +..B1.81: + cmpl $0, 12(%ebp) + jne ..B1.24 + jmp ..B1.54 +..B1.82: + call __stack_chk_fail@PLT +..B1.83: + testl $1048575, 24(%ebp) + jne ..B1.85 +..B1.84: + cmpl $0, 20(%ebp) + je ..B1.22 +..B1.85: + cmpl $2047, %edx + jge ..B1.22 +..B1.86: + testl %edx, %edx + jle ..B1.88 +..B1.87: + fldl 20(%ebp) + fmul %st(0), %st + fstl 176(%esp) + fstpl 184(%esp) + jmp ..B1.62 +..B1.88: + testl $1048575, 16(%ebp) + jne ..B1.87 +..B1.89: + cmpl $0, 12(%ebp) + jne ..B1.87 + jmp ..B1.22 +..B1.90: + testl $1048575, 16(%ebp) + jne ..B1.92 +..B1.91: + cmpl $0, 12(%ebp) + je ..B1.21 +..B1.92: + fldl 12(%ebp) + cmpl $2047, %ecx + fmul %st(0), %st + jge ..B1.94 +..B1.93: + fstl 12(%ebp) + fmul %st(0), %st + fstl 176(%esp) + fstpl 184(%esp) + jmp ..B1.62 +..B1.94: + testl $1048575, 24(%ebp) + jne ..B1.101 +..B1.95: + cmpl $0, 20(%ebp) + jne ..B1.101 +..B1.96: + fmul %st(0), %st + fstpl 12(%ebp) + fldl _DBL_PZERO@GOTOFF(%ebx) + movzbl 27(%ebp), %edx + testl $128, %edx + fstpl 176(%esp) + je ..B1.98 +..B1.97: + fldl _DBL_NPIBY2@GOTOFF(%ebx) + jmp ..B1.99 +..B1.98: + fldl _DBL_PPIBY2@GOTOFF(%ebx) +..B1.99: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstl 184(%esp) + faddp %st, %st(1) + fstpl 168(%esp) + jmp ..B1.62 +..B1.101: + fstl 12(%ebp) +..B1.102: + fmul %st(0), %st + fstpl 176(%esp) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 184(%esp) + jmp ..B1.62 + .align 16,0x90 + .type catanh,@function + .size catanh,.-catanh + .data +# -- End catanh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0xc0,0xf5,0x28,0x5c,0x8f,0xc2,0xf5,0xf9,0x3f,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,12 + .space 4, 0x00 # pad + .align 16 +_DBL_NZERO: + .long 0 + .long -2147483648 + .type _DBL_NZERO,@object + .size _DBL_NZERO,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PZERO: + .long 0 + .long 0 + .type _DBL_PZERO,@object + .size _DBL_PZERO,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NPIBY2: + .long 1413754136 + .long -1074191877 + .type _DBL_NPIBY2,@object + .size _DBL_NPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PPIBY2: + .long 1413754136 + .long 1073291771 + .type _DBL_PPIBY2,@object + .size _DBL_PPIBY2,8 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/catanhf.S b/external/sgx_libm/ia32/catanhf.S new file mode 100644 index 0000000000..7766d9302a --- /dev/null +++ b/external/sgx_libm/ia32/catanhf.S @@ -0,0 +1,557 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanhf.c" + .text +..TXTST0: +# -- Begin catanhf + .text + .align 16,0x90 + .globl catanhf +catanhf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $120, %esp + xorl %edi, %edi + movzwl 10(%ebp), %eax + andl $32640, %eax + shrl $7, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %eax + movl %edi, 108(%esp) + movl %edi, 112(%esp) + jge ..B1.11 +..B1.2: + testl %eax, %eax + jle ..B1.53 +..B1.3: + movzwl 14(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + cmpl $255, %edx + jge ..B1.12 +..B1.4: + testl %edx, %edx + jle ..B1.52 +..B1.5: + flds 8(%ebp) + fsts 100(%esp) + fld1 + fsts 96(%esp) + fxch %st(1) + fmul %st(0), %st + fstl 32(%esp) + fsubrp %st, %st(1) + flds 12(%ebp) + fld %st(0) + fmul %st(1), %st + fstl 72(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpl 40(%esp) + fldl 40(%esp) + fabs + fldl .L_2il0floatpacket.6@GOTOFF(%ebx) + fstl 80(%esp) + fcompp + fnstsw %ax + sahf + jbe ..B1.7 +..B1.6: + flds 100(%esp) + fadds 96(%esp) + fstl 88(%esp) + fstpl 8(%esp) + fstl (%esp) + fstpl 16(%esp) + call atan2@PLT +..B1.74: + fldl 16(%esp) + fchs + fxch %st(1) + fstpl 48(%esp) + flds 96(%esp) + fsubs 100(%esp) + fstl 8(%esp) + fxch %st(1) + fstpl (%esp) + fstpl 24(%esp) + call atan2@PLT +..B1.73: + fldl 24(%esp) + fxch %st(1) + fstpl 56(%esp) + fldl 48(%esp) + fldl 56(%esp) + fsubrp %st, %st(1) + fldl .L_2il0floatpacket.7@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + fstps 112(%esp) + fxch %st(1) + jmp ..B1.8 +..B1.7: + fldl 40(%esp) + fstpl 8(%esp) + fldl .L_2il0floatpacket.8@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpl (%esp) + call atan2@PLT +..B1.75: + fldl .L_2il0floatpacket.7@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + fstps 112(%esp) + flds 100(%esp) + fld %st(0) + flds 96(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 88(%esp) + fsubp %st, %st(1) +..B1.8: + fldl 88(%esp) + fstpl 48(%esp) + fchs + fldl 48(%esp) + fldl 48(%esp) + fmulp %st, %st(1) + fldl 72(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 64(%esp) + fxch %st(1) + fstpl 56(%esp) + fldl 56(%esp) + fldl 56(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpl 40(%esp) + fldl 64(%esp) + fldl 40(%esp) + fsubrp %st, %st(1) + fabs + fldl 40(%esp) + fmull 80(%esp) + fcompp + fnstsw %ax + sahf + jae ..B1.10 + jp ..B1.10 +..B1.9: + fstp %st(0) + fldl 64(%esp) + fldl 40(%esp) + fdivrp %st, %st(1) + fstpl (%esp) + call log@PLT +..B1.76: + fmull .L_2il0floatpacket.9@GOTOFF(%ebx) + fstps 108(%esp) + jmp ..B1.46 +..B1.10: + fldl 72(%esp) + fldl .L_2il0floatpacket.8@GOTOFF(%ebx) + fmuls 100(%esp) + fxch %st(1) + faddl 32(%esp) + fadds 96(%esp) + fstpl 40(%esp) + fstpl 64(%esp) + fldl 64(%esp) + fldl 40(%esp) + fdivrp %st, %st(1) + fstpl (%esp) + fstpl 16(%esp) + call atanh@PLT +..B1.77: + fldl 16(%esp) + fmulp %st, %st(1) + fstps 108(%esp) + jmp ..B1.46 +..B1.11: + movzwl 14(%ebp), %edx + andl $32640, %edx + shrl $7, %edx +..B1.12: + cmpl $255, %eax + je ..B1.62 +..B1.13: + cmpl $255, %edx + je ..B1.57 +..B1.14: + cmpl $255, %edx + jge ..B1.39 +..B1.15: + testl %eax, %eax + jle ..B1.56 +..B1.16: + cmpl $127, %eax + jge ..B1.20 +..B1.17: + addl $4, %esp + pushl 8(%ebp) + call atanhf@PLT +..B1.78: + movzbl 15(%ebp), %eax + testl $128, %eax + fstps 108(%esp) + je ..B1.19 +..B1.18: + movl $-2147483648, 112(%esp) + jmp ..B1.46 +..B1.19: + movl %edi, 112(%esp) + jmp ..B1.46 +..B1.20: + je ..B1.55 +..B1.21: + cmpl $255, %eax + jge ..B1.29 +..B1.22: + flds 8(%ebp) + fld %st(0) + fld %st(1) + fld1 + fadd %st, %st(2) + fxch %st(2) + fstpl 48(%esp) + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fsubr %st(2), %st + fchs + flds 12(%ebp) + fmul %st(0), %st + fldl 48(%esp) + fldl 48(%esp) + fmulp %st, %st(1) + fadd %st(1), %st + fstpl 64(%esp) + fxch %st(1) + fstpl 56(%esp) + fldl 56(%esp) + fldl 56(%esp) + fmulp %st, %st(1) + fadd %st(1), %st + fstpl 40(%esp) + fldl 64(%esp) + fldl 40(%esp) + fsubrp %st, %st(1) + fabs + fldl 40(%esp) + fmull .L_2il0floatpacket.6@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jae ..B1.24 + jp ..B1.24 +..B1.23: + fstp %st(2) + fstp %st(1) + fstp %st(0) + fstp %st(0) + fldl 64(%esp) + fldl 40(%esp) + fdivrp %st, %st(1) + fstpl (%esp) + call log@PLT +..B1.79: + fmull .L_2il0floatpacket.9@GOTOFF(%ebx) + fstps 108(%esp) + jmp ..B1.25 +..B1.24: + faddp %st, %st(1) + faddp %st, %st(1) + fstpl 40(%esp) + fldl .L_2il0floatpacket.8@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpl 64(%esp) + fldl 64(%esp) + fldl 40(%esp) + fdivrp %st, %st(1) + fstpl (%esp) + call atanh@PLT +..B1.80: + fmull .L_2il0floatpacket.7@GOTOFF(%ebx) + fstps 108(%esp) +..B1.25: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.27 +..B1.26: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) + jmp ..B1.28 +..B1.27: + flds .L_2il0floatpacket.11@GOTOFF(%ebx) +..B1.28: + flds .L_2il0floatpacket.14@GOTOFF(%ebx) + fxch %st(1) + fsts 112(%esp) + faddp %st, %st(1) + fstps 104(%esp) + jmp ..B1.46 +..B1.29: + testl %edx, %edx + jne ..B1.32 +..B1.30: + testl $8388607, 12(%ebp) + je ..B1.32 +..B1.31: + flds .L_2il0floatpacket.12@GOTOFF(%ebx) + fadds 12(%ebp) + fstps 104(%esp) +..B1.32: + movzbl 11(%ebp), %eax + testl $128, %eax + je ..B1.34 +..B1.33: + movl $-2147483648, 108(%esp) + jmp ..B1.35 +..B1.34: + movl %edi, 108(%esp) +..B1.35: + movzbl 15(%ebp), %eax + testl $128, %eax + je ..B1.37 +..B1.36: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) + jmp ..B1.38 +..B1.37: + flds .L_2il0floatpacket.11@GOTOFF(%ebx) +..B1.38: + flds .L_2il0floatpacket.14@GOTOFF(%ebx) + fxch %st(1) + fsts 112(%esp) + faddp %st, %st(1) + fstps 104(%esp) + jmp ..B1.46 +..B1.39: + testl %eax, %eax + jne ..B1.42 +..B1.40: + testl $8388607, 8(%ebp) + je ..B1.42 +..B1.41: + flds .L_2il0floatpacket.12@GOTOFF(%ebx) + fadds 8(%ebp) + fstps 104(%esp) +..B1.42: + movzbl 11(%ebp), %eax + testl $128, %eax + je ..B1.44 +..B1.43: + movl $-2147483648, 108(%esp) + jmp ..B1.45 +..B1.44: + movl %edi, 108(%esp) +..B1.45: + movl 12(%ebp), %eax + movl %eax, (%esp) + call atanf@PLT +..B1.81: + fstps 112(%esp) +..B1.46: + movzwl 110(%esp), %eax + testl $32640, %eax + jne ..B1.48 +..B1.47: + testl $8388607, 108(%esp) + jne ..B1.50 +..B1.48: + movzwl 114(%esp), %eax + testl $32640, %eax + jne ..B1.51 +..B1.49: + testl $8388607, 112(%esp) + je ..B1.51 +..B1.50: + flds .L_2il0floatpacket.14@GOTOFF(%ebx) + fmul %st(0), %st + fstps 104(%esp) +..B1.51: + movl 108(%esp), %eax + movl 112(%esp), %edx + addl $120, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.52: + testl $8388607, 12(%ebp) + jne ..B1.5 + jmp ..B1.12 +..B1.53: + testl $8388607, 8(%ebp) + jne ..B1.3 + jmp ..B1.11 +..B1.55: + testl $8388607, 8(%ebp) + je ..B1.17 + jmp ..B1.21 +..B1.56: + testl $8388607, 8(%ebp) + jne ..B1.16 + jmp ..B1.39 +..B1.57: + testl $8388607, 12(%ebp) + je ..B1.14 +..B1.58: + cmpl $255, %eax + jge ..B1.14 +..B1.59: + testl %eax, %eax + jle ..B1.61 +..B1.60: + flds 12(%ebp) + fmul %st(0), %st + fsts 108(%esp) + fstps 112(%esp) + jmp ..B1.46 +..B1.61: + testl $8388607, 8(%ebp) + jne ..B1.60 + jmp ..B1.14 +..B1.62: + testl $8388607, 8(%ebp) + je ..B1.13 +..B1.63: + flds 8(%ebp) + cmpl $255, %edx + fmul %st(0), %st + jge ..B1.65 +..B1.64: + fsts 8(%ebp) + fmul %st(0), %st + fsts 108(%esp) + fstps 112(%esp) + jmp ..B1.46 +..B1.65: + testl $8388607, 12(%ebp) + jne ..B1.70 +..B1.66: + fmul %st(0), %st + movzbl 15(%ebp), %eax + testl $128, %eax + fstps 8(%ebp) + movl %edi, 108(%esp) + je ..B1.68 +..B1.67: + flds .L_2il0floatpacket.10@GOTOFF(%ebx) + jmp ..B1.69 +..B1.68: + flds .L_2il0floatpacket.11@GOTOFF(%ebx) +..B1.69: + flds .L_2il0floatpacket.14@GOTOFF(%ebx) + fxch %st(1) + fsts 112(%esp) + faddp %st, %st(1) + fstps 104(%esp) + jmp ..B1.46 +..B1.70: + fsts 8(%ebp) + fmul %st(0), %st + fstps 108(%esp) + flds 12(%ebp) + fmul %st(0), %st + fstps 112(%esp) + jmp ..B1.46 + .align 16,0x90 + .type catanhf,@function + .size catanhf,.-catanhf + .data +# -- End catanhf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.6: + .long 0xe0000000,0x3f9eb851 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3fd00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 4 +.L_2il0floatpacket.10: + .long 0xbfc90fdb + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +.L_2il0floatpacket.11: + .long 0x3fc90fdb + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,4 + .align 4 +.L_2il0floatpacket.12: + .long 0x3f000000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +.L_2il0floatpacket.13: + .long 0x80000000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,4 + .align 4 +.L_2il0floatpacket.14: + .long 0x00800000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/catanhl.S b/external/sgx_libm/ia32/catanhl.S new file mode 100644 index 0000000000..af73cb76de --- /dev/null +++ b/external/sgx_libm/ia32/catanhl.S @@ -0,0 +1,2875 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanhl.c" + .text +..TXTST0: +# -- Begin catanhl + .text + .align 16,0x90 + .globl catanhl +catanhl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.17@GOTOFF(%ebx) + movl %edx, 28(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.54 +..B1.4: + orl $-64768, %ecx + movw %cx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.14 +..B1.8: + testl %ecx, %ecx + jle ..B1.34 +..B1.9: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.15 +..B1.10: + testl %edx, %edx + jle ..B1.32 +..B1.11: + fldt 12(%ebp) + addl $-32, %esp + fstpt (%esp) + fldt 24(%ebp) + fstpt 12(%esp) + call recatanhl +..B1.57: + addl $32, %esp +..B1.12: + fldt 24(%ebp) + fxch %st(1) + fstpt 4(%esp) + addl $-32, %esp + fldt 12(%ebp) + fstpt (%esp) + fstpt 12(%esp) + call imcatanhl +..B1.58: + addl $32, %esp +..B1.13: + fstpt 16(%esp) + jmp ..B1.28 +..B1.14: + movzwl 32(%ebp), %edx + andl $32767, %edx +..B1.15: + cmpl $32767, %ecx + je ..B1.46 +..B1.16: + cmpl $32767, %edx + je ..B1.40 +..B1.17: + cmpl $32767, %edx + jge ..B1.27 +..B1.18: + movl 16(%ebp), %edx + testl %edx, %edx + jne ..B1.20 +..B1.19: + cmpl $0, 12(%ebp) + je ..B1.27 +..B1.20: + cmpl $16383, %ecx + jge ..B1.22 +..B1.21: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call atanhl@PLT +..B1.59: + fldt 48+_CONSTANTS@GOTOFF(%ebx) + addl $16, %esp + movzbl 33(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + fxch %st(1) + fstpt 4(%esp) + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fmulp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.28 +..B1.22: + je ..B1.37 +..B1.23: + cmpl $32767, %ecx + jl ..B1.25 +..B1.24: + fldt 48+_CONSTANTS@GOTOFF(%ebx) + movzbl 21(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + movzbl 33(%ebp), %ecx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + andl $128, %ecx + fmulp %st, %st(1) + shrl $7, %ecx + fstpt 4(%esp) + addl $-16, %esp + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fstpt (%esp) + call asinl@PLT + jmp ..B1.63 +..B1.25: + fldt 12(%ebp) + addl $-32, %esp + fstpt (%esp) + fldt 24(%ebp) + fstpt 12(%esp) + call recatanhl +..B1.61: + addl $32, %esp +..B1.26: + movzbl 33(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + fstpt 4(%esp) + addl $-16, %esp + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fstpt (%esp) + call asinl@PLT + jmp ..B1.63 +..B1.27: + fldt 48+_CONSTANTS@GOTOFF(%ebx) + fldt 24(%ebp) + movzbl 21(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 4(%esp) + addl $-16, %esp + fstpt (%esp) + call atanl@PLT +..B1.63: + addl $16, %esp + fstpt 16(%esp) +..B1.28: + testl %edi, %edi + je ..B1.30 +..B1.29: + fldcw 2(%esp) +..B1.30: + movl 4(%esp), %edx + movl %edx, (%esi) + movl 16(%esp), %edx + movl %edx, 12(%esi) + movl 20(%esp), %edx + movl %edx, 16(%esi) + movl 8(%esp), %ecx + movl 12(%esp), %edi + movl 24(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 28(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.39 +..B1.31: + movl %esi, %eax + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.32: + cmpl $0, 28(%ebp) + jne ..B1.11 +..B1.33: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.15 +..B1.34: + cmpl $0, 16(%ebp) + jne ..B1.9 +..B1.35: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.14 +..B1.37: + cmpl $-2147483648, %edx + jne ..B1.23 +..B1.38: + cmpl $0, 12(%ebp) + je ..B1.21 + jmp ..B1.23 +..B1.39: + call __stack_chk_fail@PLT +..B1.40: + cmpl $-2147483648, 28(%ebp) + jne ..B1.42 +..B1.41: + cmpl $0, 24(%ebp) + je ..B1.17 +..B1.42: + cmpl $32767, %ecx + jge ..B1.17 +..B1.43: + cmpl $0, 16(%ebp) + jne ..B1.45 +..B1.44: + cmpl $0, 12(%ebp) + je ..B1.17 +..B1.45: + fldt 24(%ebp) + fmul %st(0), %st + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + jmp ..B1.28 +..B1.46: + cmpl $-2147483648, 16(%ebp) + jne ..B1.48 +..B1.47: + cmpl $0, 12(%ebp) + je ..B1.16 +..B1.48: + cmpl $32767, %edx + jge ..B1.50 +..B1.49: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + jmp ..B1.28 +..B1.50: + cmpl $-2147483648, 28(%ebp) + jne ..B1.53 +..B1.51: + cmpl $0, 24(%ebp) + jne ..B1.53 +..B1.52: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 12(%ebp) + fldt 48+_CONSTANTS@GOTOFF(%ebx) + fstpt 4(%esp) + addl $-16, %esp + fldt 24(%ebp) + fstpt (%esp) + call atanl@PLT + jmp ..B1.63 +..B1.53: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 4(%esp) + fldt 24(%ebp) + fmul %st(0), %st + fstpt 16(%esp) + jmp ..B1.28 +..B1.54: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type catanhl,@function + .size catanhl,.-catanhl + .data +# -- End catanhl + .text +# -- Begin recatanhl + .text + .align 16,0x90 +recatanhl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $436, %esp + fldt 8(%ebp) + call ..L4 +..L4: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%edx), %edx + movl %edx, 76(%esp) + movl %gs:20, %eax + fldt 48+_CONSTANTS@GOTOFF(%edx) + xorl %esp, %eax + movl %eax, 388(%esp) + movl $0, 160(%esp) + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fstpt 136(%esp) + fstpt 148(%esp) + addl $4, %esp + lea 132(%esp), %ecx + pushl %ecx + call __libm_normalizel_k80 +..B2.2: + fldt 20(%ebp) + movl $0, 188(%esp) + fstpt 164(%esp) + fldt 32(%esp) + fstpt 176(%esp) + addl $4, %esp + lea 160(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.3: + fldt 32(%esp) + xorl %esi, %esi + movl 76(%esp), %eax + movzwl 144(%esp), %ecx + movl %ecx, %ebx + andl $32767, %ebx + movl %esi, 216(%esp) + cmpl $8383, %ebx + fstpt 204(%esp) + fldt _CONSTANTS@GOTOFF(%eax) + fstpt 192(%esp) + jl ..B2.7 +..B2.4: + cmpl $24383, %ebx + jg ..B2.7 +..B2.5: + movzwl 200(%esp), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B2.7 +..B2.6: + cmpl $24383, %edx + jle ..B2.10 +..B2.7: + addl $4, %esp + lea 132(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.8: + addl $4, %esp + lea 188(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.9: + movzwl 144(%esp), %ecx + movl %ecx, %ebx + movzwl 200(%esp), %edx + andl $32767, %ebx + movl 216(%esp), %esi + movl %edx, 44(%esp) + andl $32767, %edx +..B2.10: + movl 160(%esp), %eax + movl %eax, 48(%esp) + lea (%ebx,%eax), %edi + movl %edi, 32(%esp) + lea -134(%esi,%edx), %eax + cmpl %eax, %edi + jle ..B2.27 +..B2.11: + movl 140(%esp), %eax + lea 134(%esi,%edx), %edi + cmpl 32(%esp), %edi + jle ..B2.28 +..B2.12: + testl %eax, %eax + jne ..B2.14 +..B2.13: + cmpl $0, 136(%esp) + je ..B2.29 +..B2.14: + cmpl $0, 196(%esp) + jne ..B2.16 +..B2.15: + cmpl $0, 192(%esp) + je ..B2.28 +..B2.16: + cmpl 48(%esp), %esi + je ..B2.18 +..B2.17: + fldt 136(%esp) + fldt 148(%esp) + movl 48(%esp), %eax + subl %esi, %eax + andb $127, 41(%esp) + addl $16383, %eax + movzwl 40(%esp), %edx + andl $32767, %eax + andl $-32768, %edx + orl %eax, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %esi, 160(%esp) + fxch %st(2) + fstpt 136(%esp) + fldt 136(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 148(%esp) + fldt 148(%esp) + movzwl 144(%esp), %ecx + jmp ..B2.19 +..B2.18: + fldt 136(%esp) + fldt 148(%esp) +..B2.19: + fldt 192(%esp) + andl $32767, %ecx + movl 44(%esp), %eax + fld %st(2) + andl $32767, %eax + fadd %st(1), %st + movl %esi, 244(%esp) + cmpl %eax, %ecx + jg ..B2.24 +..B2.20: + jne ..B2.25 +..B2.21: + movl 140(%esp), %eax + movl 196(%esp), %edx + cmpl %edx, %eax + ja ..B2.24 +..B2.22: + jne ..B2.25 +..B2.23: + movl 136(%esp), %eax + cmpl 192(%esp), %eax + jbe ..B2.25 +..B2.24: + fldt 204(%esp) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + jmp ..B2.26 +..B2.25: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 204(%esp) + faddp %st, %st(2) +..B2.26: + fld %st(1) + fadd %st(1), %st + fstpt 220(%esp) + fldt 220(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 232(%esp) + jmp ..B2.33 +..B2.27: + movl 140(%esp), %eax +..B2.28: + testl %eax, %eax + jne ..B2.30 +..B2.162: + cmpl $0, 136(%esp) +..B2.29: + je ..B2.31 +..B2.30: + lea -16517(%esi,%edx), %ecx + movl 48(%esp), %edx + lea -16383(%edx,%ebx), %ebx + cmpl %ebx, %ecx + jl ..B2.32 +..B2.31: + movl 192(%esp), %eax + movl %eax, 220(%esp) + movl 196(%esp), %edx + movl 200(%esp), %ecx + movl 204(%esp), %ebx + movl 208(%esp), %esi + movl 212(%esp), %edi + movl 216(%esp), %eax + movl %edx, 224(%esp) + movl %ecx, 228(%esp) + movl %ebx, 232(%esp) + movl %esi, 236(%esp) + movl %edi, 240(%esp) + movl %eax, 244(%esp) + jmp ..B2.33 +..B2.32: + movl %eax, 224(%esp) + movl 136(%esp), %edx + movl 144(%esp), %eax + movl 148(%esp), %ecx + movl 152(%esp), %ebx + movl 156(%esp), %esi + movl 48(%esp), %edi + movl %edx, 220(%esp) + movl %eax, 228(%esp) + movl %ecx, 232(%esp) + movl %ebx, 236(%esp) + movl %esi, 240(%esp) + movl %edi, 244(%esp) +..B2.33: + movzwl 228(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.35 +..B2.34: + cmpl $24383, %eax + jle ..B2.37 +..B2.35: + addl $4, %esp + lea 216(%esp), %ebx + pushl %ebx + call __libm_normalizel_k80 +..B2.36: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B2.37: + fldt 220(%esp) + movl 76(%esp), %edx + fld %st(0) + fld %st(1) + fld %st(2) + fldt 232(%esp) + fmulp %st, %st(4) + movl 244(%esp), %eax + fxch %st(3) + fadd %st(0), %st + fldt 60+_CONSTANTS@GOTOFF(%edx) + addl %eax, %eax + fmul %st, %st(3) + movl %eax, 272(%esp) + fxch %st(2) + fsub %st(3), %st + movzwl 172(%esp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(4) + fmul %st(4), %st + cmpl $8383, %eax + fadd %st(0), %st + fxch %st(2) + fstpt 48(%esp) + fxch %st(3) + fmul %st(0), %st + fld %st(1) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 248(%esp) + fldt 248(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 260(%esp) + jl ..B2.39 +..B2.38: + cmpl $24383, %eax + jle ..B2.41 +..B2.39: + addl $4, %esp + lea 160(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.40: + addl $4, %esp + lea 160(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.41: + fldt 164(%esp) + fld %st(0) + fld %st(1) + fldt 48(%esp) + fldt 176(%esp) + fmul %st(4), %st + movzwl 256(%esp), %ecx + movl %ecx, %ebx + andl $32767, %ebx + fadd %st(0), %st + fxch %st(4) + fmulp %st, %st(1) + movl 188(%esp), %esi + fsubr %st, %st(2) + addl %esi, %esi + faddp %st, %st(2) + fld %st(1) + cmpl $8383, %ebx + fmul %st(2), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(2) + movl %esi, 300(%esp) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(1) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 276(%esp) + fldt 276(%esp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 288(%esp) + fstpt 64(%esp) + jl ..B2.45 +..B2.42: + cmpl $24383, %ebx + jg ..B2.45 +..B2.43: + movzwl 284(%esp), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B2.45 +..B2.44: + cmpl $24383, %edx + jle ..B2.48 +..B2.45: + addl $4, %esp + lea 244(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.46: + addl $4, %esp + lea 272(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.47: + movzwl 256(%esp), %ecx + movl %ecx, %ebx + movzwl 284(%esp), %edx + andl $32767, %ebx + movl 300(%esp), %esi + movl %edx, 44(%esp) + andl $32767, %edx +..B2.48: + movl 272(%esp), %eax + movl %eax, 80(%esp) + lea (%ebx,%eax), %edi + movl %edi, 60(%esp) + lea -134(%esi,%edx), %eax + cmpl %eax, %edi + jle ..B2.65 +..B2.49: + movl 252(%esp), %eax + lea 134(%esi,%edx), %edi + cmpl 60(%esp), %edi + jle ..B2.66 +..B2.50: + testl %eax, %eax + jne ..B2.52 +..B2.51: + cmpl $0, 248(%esp) + je ..B2.67 +..B2.52: + cmpl $0, 280(%esp) + jne ..B2.54 +..B2.53: + cmpl $0, 276(%esp) + je ..B2.66 +..B2.54: + cmpl 80(%esp), %esi + je ..B2.56 +..B2.55: + fldt 64(%esp) + movl 80(%esp), %eax + fstpt 32(%esp) + subl %esi, %eax + fldt 248(%esp) + addl $16383, %eax + fldt 260(%esp) + andl $32767, %eax + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %esi, 272(%esp) + fxch %st(2) + fstpt 248(%esp) + fldt 248(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 260(%esp) + fldt 260(%esp) + fxch %st(1) + fstpt 64(%esp) + movzwl 256(%esp), %ecx + jmp ..B2.57 +..B2.56: + fldt 248(%esp) + fstpt 64(%esp) + fldt 260(%esp) +..B2.57: + fldt 276(%esp) + andl $32767, %ecx + fldt 64(%esp) + movl 44(%esp), %eax + andl $32767, %eax + fadd %st(1), %st + movl %esi, 328(%esp) + cmpl %eax, %ecx + jg ..B2.62 +..B2.58: + jne ..B2.63 +..B2.59: + movl 252(%esp), %eax + movl 280(%esp), %edx + cmpl %edx, %eax + ja ..B2.62 +..B2.60: + jne ..B2.63 +..B2.61: + movl 248(%esp), %eax + cmpl 276(%esp), %eax + jbe ..B2.63 +..B2.62: + fldt 64(%esp) + fsub %st(1), %st + faddp %st, %st(2) + fldt 288(%esp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 64(%esp) + jmp ..B2.64 +..B2.63: + fldt 64(%esp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 288(%esp) + faddp %st, %st(1) + fstpt 64(%esp) +..B2.64: + fldt 64(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 304(%esp) + fldt 304(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 316(%esp) + jmp ..B2.71 +..B2.65: + movl 252(%esp), %eax +..B2.66: + testl %eax, %eax + jne ..B2.68 +..B2.164: + cmpl $0, 248(%esp) +..B2.67: + je ..B2.69 +..B2.68: + lea -16517(%esi,%edx), %ecx + movl 80(%esp), %edx + lea -16383(%edx,%ebx), %ebx + cmpl %ebx, %ecx + jl ..B2.70 +..B2.69: + movl 276(%esp), %eax + movl %eax, 304(%esp) + movl 280(%esp), %edx + movl 284(%esp), %ecx + movl 288(%esp), %ebx + movl 292(%esp), %esi + movl 296(%esp), %edi + movl 300(%esp), %eax + movl %edx, 308(%esp) + movl %ecx, 312(%esp) + movl %ebx, 316(%esp) + movl %esi, 320(%esp) + movl %edi, 324(%esp) + movl %eax, 328(%esp) + jmp ..B2.71 +..B2.70: + movl %eax, 308(%esp) + movl 248(%esp), %edx + movl 256(%esp), %eax + movl 260(%esp), %ecx + movl 264(%esp), %ebx + movl 268(%esp), %esi + movl 80(%esp), %edi + movl %edx, 304(%esp) + movl %eax, 312(%esp) + movl %ecx, 316(%esp) + movl %ebx, 320(%esp) + movl %esi, 324(%esp) + movl %edi, 328(%esp) +..B2.71: + movzwl 144(%esp), %ebx + movl %ebx, %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B2.75 +..B2.72: + cmpl $24383, %esi + jg ..B2.75 +..B2.73: + movzwl 200(%esp), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B2.75 +..B2.74: + cmpl $24383, %ecx + jle ..B2.78 +..B2.75: + addl $4, %esp + lea 132(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.76: + addl $4, %esp + lea 188(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.77: + movzwl 144(%esp), %ebx + movl %ebx, %esi + movzwl 200(%esp), %ecx + andl $32767, %esi + movl %ecx, 44(%esp) + andl $32767, %ecx +..B2.78: + movl 160(%esp), %eax + movl 216(%esp), %edx + movl %eax, 80(%esp) + lea (%esi,%eax), %edi + movl %edi, 60(%esp) + lea -134(%edx,%ecx), %eax + cmpl %eax, %edi + jle ..B2.95 +..B2.79: + movl 140(%esp), %eax + lea 134(%edx,%ecx), %edi + cmpl 60(%esp), %edi + jle ..B2.96 +..B2.80: + testl %eax, %eax + jne ..B2.82 +..B2.81: + cmpl $0, 136(%esp) + je ..B2.97 +..B2.82: + cmpl $0, 196(%esp) + jne ..B2.84 +..B2.83: + cmpl $0, 192(%esp) + je ..B2.96 +..B2.84: + cmpl 80(%esp), %edx + je ..B2.86 +..B2.85: + fldt 64(%esp) + movl 80(%esp), %eax + fstpt 32(%esp) + subl %edx, %eax + fldt 136(%esp) + addl $16383, %eax + fldt 148(%esp) + andl $32767, %eax + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 160(%esp) + fxch %st(2) + fstpt 136(%esp) + fldt 136(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 148(%esp) + fldt 148(%esp) + movzwl 144(%esp), %ebx + jmp ..B2.87 +..B2.86: + fldt 136(%esp) + fldt 148(%esp) +..B2.87: + fldt 192(%esp) + andl $32767, %ebx + movl 44(%esp), %eax + fld %st(2) + andl $32767, %eax + fsub %st(1), %st + movl %edx, 244(%esp) + cmpl %eax, %ebx + jg ..B2.92 +..B2.88: + jne ..B2.93 +..B2.89: + movl 140(%esp), %eax + movl 196(%esp), %edx + cmpl %edx, %eax + ja ..B2.92 +..B2.90: + jne ..B2.93 +..B2.91: + movl 136(%esp), %eax + cmpl 192(%esp), %eax + jbe ..B2.93 +..B2.92: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 204(%esp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B2.94 +..B2.93: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 204(%esp) + fsubrp %st, %st(2) +..B2.94: + fld %st(1) + fadd %st(1), %st + fstpt 220(%esp) + fldt 220(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 232(%esp) + jmp ..B2.101 +..B2.95: + movl 140(%esp), %eax +..B2.96: + testl %eax, %eax + jne ..B2.98 +..B2.161: + cmpl $0, 136(%esp) +..B2.97: + je ..B2.99 +..B2.98: + lea -16517(%edx,%ecx), %ebx + movl 80(%esp), %ecx + lea -16383(%ecx,%esi), %esi + cmpl %esi, %ebx + jl ..B2.100 +..B2.99: + fldt 192(%esp) + fchs + movl %edx, 244(%esp) + fstpt 220(%esp) + fldt 204(%esp) + fchs + fstpt 232(%esp) + jmp ..B2.101 +..B2.100: + movl %eax, 224(%esp) + movl 136(%esp), %edx + movl 144(%esp), %eax + movl 148(%esp), %ecx + movl 152(%esp), %ebx + movl 156(%esp), %esi + movl 80(%esp), %edi + movl %edx, 220(%esp) + movl %eax, 228(%esp) + movl %ecx, 232(%esp) + movl %ebx, 236(%esp) + movl %esi, 240(%esp) + movl %edi, 244(%esp) +..B2.101: + movzwl 228(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.103 +..B2.102: + cmpl $24383, %eax + jle ..B2.105 +..B2.103: + addl $4, %esp + lea 216(%esp), %ebx + pushl %ebx + call __libm_normalizel_k80 +..B2.104: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B2.105: + fldt 220(%esp) + fld %st(0) + fld %st(1) + fldt 48(%esp) + fldt 232(%esp) + fxch %st(1) + fmul %st(4), %st + movl 244(%esp), %ebx + fsubr %st, %st(3) + addl %ebx, %ebx + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(3) + movl %ebx, 272(%esp) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(1) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 248(%esp) + fldt 248(%esp) + fsubrp %st, %st(2) + movzwl 256(%esp), %ecx + fadd %st, %st(1) + movl %ecx, 84(%esp) + andl $32767, %ecx + fxch %st(1) + fstpt 260(%esp) + cmpl $8383, %ecx + fstpt 64(%esp) + jl ..B2.109 +..B2.106: + cmpl $24383, %ecx + jg ..B2.109 +..B2.107: + movzwl 284(%esp), %eax + movl %eax, 60(%esp) + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.109 +..B2.108: + cmpl $24383, %eax + jle ..B2.112 +..B2.109: + addl $4, %esp + lea 244(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.110: + addl $4, %esp + lea 272(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.111: + movzwl 256(%esp), %ecx + movzwl 284(%esp), %eax + movl 272(%esp), %ebx + movl %ecx, 84(%esp) + andl $32767, %ecx + movl %eax, 60(%esp) + andl $32767, %eax +..B2.112: + movl 300(%esp), %edx + lea (%ebx,%ecx), %esi + movl %esi, 80(%esp) + lea -134(%edx,%eax), %edi + cmpl %edi, %esi + jle ..B2.129 +..B2.113: + movl 252(%esp), %esi + lea 134(%edx,%eax), %edi + movl %esi, 44(%esp) + cmpl 80(%esp), %edi + jle ..B2.130 +..B2.114: + cmpl $0, 44(%esp) + jne ..B2.116 +..B2.115: + cmpl $0, 248(%esp) + je ..B2.131 +..B2.116: + cmpl $0, 280(%esp) + jne ..B2.118 +..B2.117: + cmpl $0, 276(%esp) + je ..B2.130 +..B2.118: + cmpl %edx, %ebx + je ..B2.120 +..B2.119: + fldt 64(%esp) + subl %edx, %ebx + fstpt 32(%esp) + addl $16383, %ebx + fldt 248(%esp) + andl $32767, %ebx + fldt 260(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %ebx, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 272(%esp) + fxch %st(2) + fstpt 248(%esp) + fldt 248(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 260(%esp) + fldt 260(%esp) + movzwl 256(%esp), %ecx + movl %ecx, 84(%esp) + jmp ..B2.121 +..B2.120: + fldt 248(%esp) + fldt 260(%esp) +..B2.121: + fldt 276(%esp) + fld %st(2) + movl 84(%esp), %eax + fadd %st(1), %st + movl 60(%esp), %ecx + andl $32767, %eax + andl $32767, %ecx + movl %edx, 356(%esp) + cmpl %ecx, %eax + jg ..B2.126 +..B2.122: + jne ..B2.127 +..B2.123: + movl 252(%esp), %eax + movl 280(%esp), %ecx + cmpl %ecx, %eax + ja ..B2.126 +..B2.124: + jne ..B2.127 +..B2.125: + movl 248(%esp), %eax + cmpl 276(%esp), %eax + jbe ..B2.127 +..B2.126: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 288(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.128 +..B2.127: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 288(%esp) + faddp %st, %st(1) +..B2.128: + fld %st(0) + fadd %st(2), %st + fstpt 332(%esp) + fldt 332(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 344(%esp) + jmp ..B2.135 +..B2.129: + movl 252(%esp), %esi + movl %esi, 44(%esp) +..B2.130: + cmpl $0, 44(%esp) + jne ..B2.132 +..B2.163: + cmpl $0, 248(%esp) +..B2.131: + je ..B2.133 +..B2.132: + lea -16517(%edx,%eax), %eax + lea -16383(%ebx,%ecx), %ecx + cmpl %ecx, %eax + jl ..B2.134 +..B2.133: + movl 276(%esp), %eax + movl %eax, 332(%esp) + movl 280(%esp), %ecx + movl 284(%esp), %ebx + movl 288(%esp), %esi + movl 292(%esp), %edi + movl 296(%esp), %eax + movl %ecx, 336(%esp) + movl %ebx, 340(%esp) + movl %esi, 344(%esp) + movl %edi, 348(%esp) + movl %eax, 352(%esp) + movl %edx, 356(%esp) + jmp ..B2.135 +..B2.134: + movl %esi, %edx + movl %edx, 336(%esp) + movl 248(%esp), %eax + movl 256(%esp), %ecx + movl 260(%esp), %ebx + movl 264(%esp), %esi + movl 268(%esp), %edi + movl 272(%esp), %edx + movl %eax, 332(%esp) + movl %ecx, 340(%esp) + movl %ebx, 344(%esp) + movl %esi, 348(%esp) + movl %edi, 352(%esp) + movl %edx, 356(%esp) +..B2.135: + movzwl 312(%esp), %esi + movzwl 340(%esp), %eax + andl $32767, %esi + andl $32767, %eax + movl 328(%esp), %edi + lea (%edi,%esi), %ebx + lea (%edx,%eax), %ecx + subl %ecx, %ebx + cmpl $-1, %ebx + jge ..B2.145 +..B2.136: + cmpl $8383, %esi + jl ..B2.140 +..B2.137: + cmpl $24383, %esi + jg ..B2.140 +..B2.138: + cmpl $8383, %eax + jl ..B2.140 +..B2.139: + cmpl $24383, %eax + jle ..B2.143 +..B2.140: + addl $4, %esp + lea 300(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.141: + addl $4, %esp + lea 328(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.142: + movl 328(%esp), %edi + movl 356(%esp), %edx +..B2.143: + fldt 332(%esp) + subl %edx, %edi + fld %st(0) + fld %st(1) + fldt 304(%esp) + fld %st(0) + fdiv %st(4), %st + fldt 48(%esp) + fld %st(0) + fmul %st(2), %st + fld %st(0) + movl %edi, 104(%esp) + fsubr %st(3), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(3), %st + fxch %st(2) + fmul %st(7), %st + fsubr %st, %st(6) + faddp %st, %st(6) + fxch %st(4) + fsub %st(5), %st + fld %st(4) + fmul %st(6), %st + fxch %st(2) + fmul %st, %st(6) + fxch %st(1) + fmul %st, %st(5) + fxch %st(6) + faddp %st, %st(5) + fld %st(4) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fsubp %st, %st(1) + fldt 316(%esp) + faddp %st, %st(1) + fldt 344(%esp) + fmul %st(2), %st + fsubrp %st, %st(1) + fdivp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 80(%esp) + fldt 80(%esp) + fsubrp %st, %st(1) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + faddp %st, %st(1) + fstpt 92(%esp) + addl $8, %esp + lea 72(%esp), %eax + lea 352(%esp), %edx + pushl %eax + pushl %edx + call __libm_log_k80 + jmp ..B2.153 +..B2.145: + movzwl 144(%esp), %ecx + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B2.149 +..B2.146: + cmpl $24383, %ecx + jg ..B2.149 +..B2.147: + cmpl $8383, %eax + jl ..B2.149 +..B2.148: + cmpl $24383, %eax + jle ..B2.152 +..B2.149: + addl $4, %esp + lea 132(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.150: + addl $4, %esp + lea 328(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.151: + movl 356(%esp), %edx +..B2.152: + fldt 136(%esp) + fld %st(0) + fldt 332(%esp) + fdivr %st, %st(1) + fld %st(0) + fld %st(1) + fldt 48(%esp) + fld %st(0) + fmul %st(5), %st + fld %st(0) + movl 160(%esp), %eax + fsubr %st(6), %st + subl %edx, %eax + faddp %st, %st(1) + fld %st(0) + addl $2, %eax + movl %eax, 132(%esp) + fsubr %st(6), %st + fxch %st(2) + fmul %st(5), %st + fsubr %st, %st(4) + faddp %st, %st(4) + fxch %st(2) + fsub %st(3), %st + fld %st(2) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fldt 148(%esp) + faddp %st, %st(3) + fldt 344(%esp) + fmul %st(2), %st + fsubrp %st, %st(3) + fdivrp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 108(%esp) + fldt 108(%esp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 120(%esp) + fstpt 32(%esp) + addl $8, %esp + lea 100(%esp), %edx + lea 352(%esp), %ecx + pushl %edx + pushl %ecx + call __libm_log1p_k80 +..B2.153: + movl 384(%esp), %eax + addl $-2, %eax + movl %eax, 384(%esp) +..B2.154: + fldt 360(%esp) + fstpt (%esp) + fldt 372(%esp) + fstpt 12(%esp) + movl %eax, 24(%esp) + call __libm_scalbl_k80 +..B2.155: + movl 388(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.157 +..B2.156: + addl $436, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.157: + fstp %st(0) + movl 76(%esp), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type recatanhl,@function + .size recatanhl,.-recatanhl + .data +# -- End recatanhl + .text +# -- Begin imcatanhl + .text + .align 16,0x90 +imcatanhl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B3.1: +..L5: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $436, %esp + fldt 8(%ebp) + movzbl 17(%ebp), %esi + andl $128, %esi + call ..L6 +..L6: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L6](%eax), %eax + shrl $7, %esi + movl %eax, 88(%esp) + fldt 48+_CONSTANTS@GOTOFF(%eax) + movl %gs:20, %edx + xorl %esp, %edx + lea (,%esi,8), %ebx + movl %edx, 428(%esp) + lea (%ebx,%esi,4), %edi + fldt _CONSTANTS@GOTOFF(%eax,%edi) + movzbl 29(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fmulp %st, %st(2) + movl $0, 256(%esp) + lea (,%edx,8), %ecx + fxch %st(1) + fstpt 232(%esp) + lea (%ecx,%edx,4), %ecx + fstpt 32(%esp) + fldt 32(%esp) + fstpt 244(%esp) + fldt 24+_CONSTANTS@GOTOFF(%eax,%ecx) + fstpt 48(%esp) + addl $4, %esp + lea 228(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.2: + fldt 20(%ebp) + fldt 32(%esp) + movzbl 29(%ebp), %edx + andl $128, %edx + shrl $7, %edx + movl 88(%esp), %ecx + movl $0, 284(%esp) + fstpt 272(%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ebx + fldt _CONSTANTS@GOTOFF(%ecx,%ebx) + fmulp %st, %st(1) + fstpt 260(%esp) + addl $4, %esp + lea 256(%esp), %esi + pushl %esi + call __libm_normalizel_k80 +..B3.3: + fldt 32(%esp) + movl 88(%esp), %eax + movl $0, 312(%esp) + fstpt 300(%esp) + fldt _CONSTANTS@GOTOFF(%eax) + movzwl 240(%esp), %eax + andl $32767, %eax + fstpt 288(%esp) + cmpl $8383, %eax + jl ..B3.5 +..B3.4: + cmpl $24383, %eax + jle ..B3.7 +..B3.5: + addl $4, %esp + lea 228(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.6: + addl $4, %esp + lea 228(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.7: + fldt 232(%esp) + movl 88(%esp), %edx + fld %st(0) + fld %st(1) + fld %st(2) + fld %st(3) + fldt 60+_CONSTANTS@GOTOFF(%edx) + fmul %st, %st(4) + movl 256(%esp), %eax + fxch %st(3) + fsubr %st(4), %st + fld %st(0) + addl %eax, %eax + fchs + movl %eax, 340(%esp) + fadd %st(5), %st + fld %st(0) + fxch %st(2) + fsubrp %st, %st(6) + fxch %st(1) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsub %st(5), %st + fmul %st, %st(2) + fxch %st(3) + fmul %st, %st(5) + movzwl 268(%esp), %eax + fxch %st(5) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(2) + fxch %st(2) + fstpt 32(%esp) + fld %st(1) + andl $32767, %eax + fadd %st(3), %st + cmpl $8383, %eax + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 244(%esp) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 316(%esp) + fldt 316(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 328(%esp) + jl ..B3.9 +..B3.8: + cmpl $24383, %eax + jle ..B3.11 +..B3.9: + addl $4, %esp + lea 256(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.10: + addl $4, %esp + lea 256(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.11: + fldt 260(%esp) + fld %st(0) + fld %st(1) + fldt 32(%esp) + fmul %st(3), %st + movzwl 296(%esp), %ebx + movl %ebx, %esi + andl $32767, %esi + fsubr %st, %st(2) + movl 284(%esp), %eax + faddp %st, %st(2) + fld %st(1) + addl %eax, %eax + fmul %st(2), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(2) + cmpl $8383, %esi + movl %eax, 368(%esp) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fldt 272(%esp) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 344(%esp) + fldt 344(%esp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 356(%esp) + fstpt 64(%esp) + jl ..B3.15 +..B3.12: + cmpl $24383, %esi + jg ..B3.15 +..B3.13: + movzwl 324(%esp), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B3.15 +..B3.14: + cmpl $24383, %ecx + jle ..B3.18 +..B3.15: + addl $4, %esp + lea 284(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.16: + addl $4, %esp + lea 312(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.17: + movzwl 296(%esp), %ebx + movl %ebx, %esi + movzwl 324(%esp), %ecx + andl $32767, %esi + movl %ecx, 44(%esp) + andl $32767, %ecx +..B3.18: + movl 312(%esp), %eax + movl 340(%esp), %edx + movl %eax, 60(%esp) + lea (%esi,%eax), %edi + movl %edi, 32(%esp) + lea -134(%edx,%ecx), %eax + cmpl %eax, %edi + jle ..B3.35 +..B3.19: + movl 292(%esp), %eax + lea 134(%edx,%ecx), %edi + cmpl 32(%esp), %edi + jle ..B3.36 +..B3.20: + testl %eax, %eax + jne ..B3.22 +..B3.21: + cmpl $0, 288(%esp) + je ..B3.37 +..B3.22: + cmpl $0, 320(%esp) + jne ..B3.24 +..B3.23: + cmpl $0, 316(%esp) + je ..B3.36 +..B3.24: + cmpl 60(%esp), %edx + je ..B3.26 +..B3.25: + fldt 64(%esp) + movl 60(%esp), %eax + fstpt 32(%esp) + subl %edx, %eax + fldt 288(%esp) + addl $16383, %eax + fldt 300(%esp) + andl $32767, %eax + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 312(%esp) + fxch %st(2) + fstpt 288(%esp) + fldt 288(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 300(%esp) + fldt 300(%esp) + fxch %st(1) + fstpt 64(%esp) + movzwl 296(%esp), %ebx + jmp ..B3.27 +..B3.26: + fldt 288(%esp) + fstpt 64(%esp) + fldt 300(%esp) +..B3.27: + fldt 316(%esp) + andl $32767, %ebx + fldt 64(%esp) + movl 44(%esp), %eax + andl $32767, %eax + fsub %st(1), %st + movl %edx, 396(%esp) + cmpl %eax, %ebx + jg ..B3.32 +..B3.28: + jne ..B3.33 +..B3.29: + movl 292(%esp), %eax + movl 320(%esp), %edx + cmpl %edx, %eax + ja ..B3.32 +..B3.30: + jne ..B3.33 +..B3.31: + movl 288(%esp), %eax + cmpl 316(%esp), %eax + jbe ..B3.33 +..B3.32: + fldt 64(%esp) + fsub %st(1), %st + fsubp %st, %st(2) + fldt 328(%esp) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 64(%esp) + jmp ..B3.34 +..B3.33: + fldt 64(%esp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fldt 328(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) +..B3.34: + fldt 64(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 372(%esp) + fldt 372(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 384(%esp) + jmp ..B3.41 +..B3.35: + movl 292(%esp), %eax +..B3.36: + testl %eax, %eax + jne ..B3.38 +..B3.179: + cmpl $0, 288(%esp) +..B3.37: + je ..B3.39 +..B3.38: + lea -16517(%edx,%ecx), %ebx + movl 60(%esp), %ecx + lea -16383(%ecx,%esi), %esi + cmpl %esi, %ebx + jl ..B3.40 +..B3.39: + fldt 316(%esp) + fchs + movl %edx, 396(%esp) + fstpt 372(%esp) + fldt 328(%esp) + fchs + fstpt 384(%esp) + jmp ..B3.41 +..B3.40: + movl %eax, 376(%esp) + movl 288(%esp), %edx + movl 296(%esp), %eax + movl 300(%esp), %ecx + movl 304(%esp), %ebx + movl 308(%esp), %esi + movl 60(%esp), %edi + movl %edx, 372(%esp) + movl %eax, 380(%esp) + movl %ecx, 384(%esp) + movl %ebx, 388(%esp) + movl %esi, 392(%esp) + movl %edi, 396(%esp) +..B3.41: + movzwl 380(%esp), %ebx + movl %ebx, %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B3.45 +..B3.42: + cmpl $24383, %esi + jg ..B3.45 +..B3.43: + movzwl 352(%esp), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B3.45 +..B3.44: + cmpl $24383, %ecx + jle ..B3.48 +..B3.45: + addl $4, %esp + lea 368(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.46: + addl $4, %esp + lea 340(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.47: + movzwl 380(%esp), %ebx + movl %ebx, %esi + movzwl 352(%esp), %ecx + andl $32767, %esi + movl %ecx, 44(%esp) + andl $32767, %ecx +..B3.48: + movl 368(%esp), %edx + movl 396(%esp), %eax + movl %eax, 76(%esp) + lea (%esi,%eax), %edi + movl %edi, 60(%esp) + lea -134(%edx,%ecx), %eax + cmpl %eax, %edi + jle ..B3.65 +..B3.49: + movl 376(%esp), %eax + lea 134(%edx,%ecx), %edi + cmpl 60(%esp), %edi + jle ..B3.66 +..B3.50: + testl %eax, %eax + jne ..B3.52 +..B3.51: + cmpl $0, 372(%esp) + je ..B3.67 +..B3.52: + cmpl $0, 348(%esp) + jne ..B3.54 +..B3.53: + cmpl $0, 344(%esp) + je ..B3.66 +..B3.54: + cmpl 76(%esp), %edx + je ..B3.56 +..B3.55: + fldt 64(%esp) + movl 76(%esp), %eax + fstpt 32(%esp) + subl %edx, %eax + fldt 372(%esp) + addl $16383, %eax + fldt 384(%esp) + andl $32767, %eax + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 396(%esp) + fxch %st(2) + fstpt 372(%esp) + fldt 372(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 384(%esp) + fldt 384(%esp) + fstpt 64(%esp) + movzwl 380(%esp), %ebx + jmp ..B3.57 +..B3.56: + fldt 372(%esp) + fldt 384(%esp) + fstpt 64(%esp) +..B3.57: + fldt 344(%esp) + andl $32767, %ebx + movl 44(%esp), %eax + fld %st(1) + andl $32767, %eax + fsub %st(1), %st + movl %edx, 424(%esp) + cmpl %eax, %ebx + jg ..B3.62 +..B3.58: + jne ..B3.63 +..B3.59: + movl 376(%esp), %eax + movl 348(%esp), %ecx + cmpl %ecx, %eax + ja ..B3.62 +..B3.60: + jne ..B3.63 +..B3.61: + movl 372(%esp), %eax + cmpl 344(%esp), %eax + jbe ..B3.63 +..B3.62: + fldt 64(%esp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt 356(%esp) + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) + jmp ..B3.64 +..B3.63: + fldt 356(%esp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fldt 64(%esp) + faddp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) +..B3.64: + fldt 64(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 400(%esp) + fldt 400(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 412(%esp) + jmp ..B3.71 +..B3.65: + movl 376(%esp), %eax +..B3.66: + testl %eax, %eax + jne ..B3.68 +..B3.180: + cmpl $0, 372(%esp) +..B3.67: + je ..B3.69 +..B3.68: + lea -16517(%edx,%ecx), %ebx + movl 76(%esp), %ecx + lea -16383(%ecx,%esi), %esi + cmpl %esi, %ebx + jl ..B3.70 +..B3.69: + fldt 344(%esp) + fchs + movl %edx, 424(%esp) + fstpt 400(%esp) + fldt 356(%esp) + fchs + fstpt 412(%esp) + jmp ..B3.71 +..B3.70: + movl 372(%esp), %edx + movl %edx, 400(%esp) + movl %eax, 404(%esp) + movl 380(%esp), %eax + movl 384(%esp), %ecx + movl 388(%esp), %ebx + movl 392(%esp), %esi + movl 76(%esp), %edx + movl %eax, 408(%esp) + movl %ecx, 412(%esp) + movl %ebx, 416(%esp) + movl %esi, 420(%esp) + movl %edx, 424(%esp) +..B3.71: + movzwl 408(%esp), %eax + andl $32767, %eax + lea -16383(%edx,%eax), %edx + cmpl $-6, %edx + jge ..B3.164 +..B3.72: + movzwl 296(%esp), %esi + movl %esi, 84(%esp) + andl $32767, %esi + cmpl $8383, %esi + jl ..B3.76 +..B3.73: + cmpl $24383, %esi + jg ..B3.76 +..B3.74: + movzwl 240(%esp), %eax + movl %eax, 60(%esp) + andl $32767, %eax + movl %eax, 76(%esp) + cmpl $8383, %eax + jl ..B3.76 +..B3.75: + cmpl $24383, 76(%esp) + jle ..B3.79 +..B3.76: + addl $4, %esp + lea 284(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.77: + addl $4, %esp + lea 228(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.78: + movzwl 240(%esp), %eax + movzwl 296(%esp), %esi + movl %eax, 60(%esp) + andl $32767, %eax + movl %eax, 76(%esp) + movl %esi, 84(%esp) + andl $32767, %esi +..B3.79: + movl 256(%esp), %ecx + movl 312(%esp), %edx + lea (%eax,%ecx), %ebx + lea -134(%ecx,%eax), %edi + movl %edi, 80(%esp) + lea (%esi,%edx), %eax + cmpl %eax, %edi + jge ..B3.96 +..B3.80: + movl 292(%esp), %edi + movl %edi, 44(%esp) + movl 76(%esp), %edi + lea 134(%ecx,%edi), %edi + cmpl %edi, %eax + jge ..B3.97 +..B3.81: + cmpl $0, 44(%esp) + jne ..B3.83 +..B3.82: + cmpl $0, 288(%esp) + je ..B3.98 +..B3.83: + cmpl $0, 236(%esp) + jne ..B3.85 +..B3.84: + cmpl $0, 232(%esp) + je ..B3.97 +..B3.85: + cmpl %ecx, %edx + je ..B3.87 +..B3.86: + fldt 64(%esp) + subl %ecx, %edx + fstpt 32(%esp) + addl $16383, %edx + fldt 288(%esp) + andl $32767, %edx + fldt 300(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %edx, %eax + movl %ecx, %edx + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 288(%esp) + fldt 288(%esp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 296(%esp), %esi + movl %esi, 84(%esp) + andl $32767, %esi + movl %ecx, 312(%esp) + movl %esi, %eax + fstpt 300(%esp) + fldt 300(%esp) + jmp ..B3.88 +..B3.87: + fldt 288(%esp) + fldt 300(%esp) + movl 84(%esp), %eax + andl $32767, %eax +..B3.88: + fldt 232(%esp) + fld %st(2) + movl 60(%esp), %edi + fadd %st(1), %st + andl $32767, %edi + movl %ecx, 116(%esp) + cmpl %edi, %eax + jg ..B3.93 +..B3.89: + jne ..B3.94 +..B3.90: + movl 292(%esp), %eax + movl 236(%esp), %edi + cmpl %edi, %eax + ja ..B3.93 +..B3.91: + jne ..B3.94 +..B3.92: + movl 288(%esp), %eax + cmpl 232(%esp), %eax + jbe ..B3.94 +..B3.93: + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 244(%esp) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 64(%esp) + jmp ..B3.95 +..B3.94: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 244(%esp) + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) +..B3.95: + fldt 64(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 92(%esp) + fldt 92(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 104(%esp) + jmp ..B3.102 +..B3.96: + movl 292(%esp), %eax + movl %eax, 44(%esp) +..B3.97: + cmpl $0, 44(%esp) + jne ..B3.99 +..B3.178: + cmpl $0, 288(%esp) +..B3.98: + je ..B3.100 +..B3.99: + movl 76(%esp), %eax + lea -16517(%ecx,%eax), %edi + lea -16383(%edx,%esi), %eax + cmpl %eax, %edi + jl ..B3.101 +..B3.100: + movl 232(%esp), %eax + movl 236(%esp), %edi + movl %eax, 92(%esp) + movl %edi, 96(%esp) + movl 240(%esp), %eax + movl 244(%esp), %edi + movl %eax, 100(%esp) + movl %edi, 104(%esp) + movl 248(%esp), %eax + movl 252(%esp), %edi + movl %eax, 108(%esp) + movl %edi, 112(%esp) + movl %ecx, 116(%esp) + jmp ..B3.102 +..B3.101: + movl 288(%esp), %eax + movl 44(%esp), %edi + movl %eax, 92(%esp) + movl %edi, 96(%esp) + movl 296(%esp), %eax + movl 300(%esp), %edi + movl %eax, 100(%esp) + movl %edi, 104(%esp) + movl 304(%esp), %eax + movl 308(%esp), %edi + movl %eax, 108(%esp) + movl %edi, 112(%esp) + movl %edx, 116(%esp) +..B3.102: + cmpl $8383, %esi + jl ..B3.106 +..B3.103: + cmpl $24383, %esi + jg ..B3.106 +..B3.104: + cmpl $8383, 76(%esp) + jl ..B3.106 +..B3.105: + cmpl $24383, 76(%esp) + jle ..B3.109 +..B3.106: + addl $4, %esp + lea 284(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.107: + addl $4, %esp + lea 228(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.108: + movzwl 240(%esp), %eax + movl %eax, 60(%esp) + andl $32767, %eax + movl 256(%esp), %ecx + movl 312(%esp), %edx + lea -134(%ecx,%eax), %esi + movl %esi, 80(%esp) + movzwl 296(%esp), %esi + lea (%ecx,%eax), %ebx + movl %esi, 84(%esp) + andl $32767, %esi +..B3.109: + lea (%edx,%esi), %eax + movl %eax, 44(%esp) + cmpl 80(%esp), %eax + jle ..B3.126 +..B3.110: + movl 292(%esp), %eax + lea 134(%ebx), %edi + cmpl 44(%esp), %edi + jle ..B3.127 +..B3.111: + testl %eax, %eax + jne ..B3.113 +..B3.112: + cmpl $0, 288(%esp) + je ..B3.128 +..B3.113: + cmpl $0, 236(%esp) + jne ..B3.115 +..B3.114: + cmpl $0, 232(%esp) + je ..B3.127 +..B3.115: + cmpl %ecx, %edx + je ..B3.117 +..B3.116: + fldt 64(%esp) + subl %ecx, %edx + fstpt 32(%esp) + addl $16383, %edx + fldt 288(%esp) + andl $32767, %edx + fldt 300(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %edx, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %ecx, 312(%esp) + fxch %st(2) + fstpt 288(%esp) + fldt 288(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 300(%esp) + fldt 300(%esp) + movzwl 296(%esp), %edx + fxch %st(1) + fstpt 64(%esp) + movl %edx, 84(%esp) + jmp ..B3.118 +..B3.117: + fldt 288(%esp) + fstpt 64(%esp) + fldt 300(%esp) +..B3.118: + fldt 232(%esp) + fldt 64(%esp) + movl 84(%esp), %eax + movl 60(%esp), %edx + andl $32767, %eax + andl $32767, %edx + fsub %st(1), %st + movl %ecx, 144(%esp) + cmpl %edx, %eax + jg ..B3.123 +..B3.119: + jne ..B3.124 +..B3.120: + movl 292(%esp), %eax + movl 236(%esp), %edx + cmpl %edx, %eax + ja ..B3.123 +..B3.121: + jne ..B3.124 +..B3.122: + movl 288(%esp), %eax + cmpl 232(%esp), %eax + jbe ..B3.124 +..B3.123: + fldt 64(%esp) + fsub %st(1), %st + fsubp %st, %st(2) + fldt 244(%esp) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 64(%esp) + jmp ..B3.125 +..B3.124: + fldt 64(%esp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fldt 244(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) +..B3.125: + fldt 64(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 120(%esp) + fldt 120(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 132(%esp) + jmp ..B3.132 +..B3.126: + movl 292(%esp), %eax +..B3.127: + testl %eax, %eax + jne ..B3.129 +..B3.177: + cmpl $0, 288(%esp) +..B3.128: + je ..B3.130 +..B3.129: + addl $-16517, %ebx + lea -16383(%edx,%esi), %edx + cmpl %edx, %ebx + jl ..B3.131 +..B3.130: + fldt 232(%esp) + fchs + movl %ecx, 144(%esp) + fstpt 120(%esp) + fldt 244(%esp) + fchs + fstpt 132(%esp) + jmp ..B3.132 +..B3.131: + movl %eax, 124(%esp) + movl 288(%esp), %edx + movl 296(%esp), %eax + movl 300(%esp), %ecx + movl 304(%esp), %ebx + movl 308(%esp), %esi + movl 312(%esp), %edi + movl %edx, 120(%esp) + movl %eax, 128(%esp) + movl %ecx, 132(%esp) + movl %ebx, 136(%esp) + movl %esi, 140(%esp) + movl %edi, 144(%esp) +..B3.132: + addl $12, %esp + lea 80(%esp), %eax + lea 136(%esp), %ecx + pushl %eax + lea 252(%esp), %edx + pushl %edx + pushl %ecx + call __libm_atan2l_k80 +..B3.133: + addl $12, %esp + lea 108(%esp), %eax + lea 164(%esp), %ecx + pushl %eax + lea 252(%esp), %edx + pushl %edx + pushl %ecx + call __libm_atan2l_k80 +..B3.134: + movzwl 156(%esp), %ebx + movl %ebx, %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B3.138 +..B3.135: + cmpl $24383, %esi + jg ..B3.138 +..B3.136: + movzwl 184(%esp), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B3.138 +..B3.137: + cmpl $24383, %ecx + jle ..B3.141 +..B3.138: + addl $4, %esp + lea 144(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.139: + addl $4, %esp + lea 172(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B3.140: + movzwl 156(%esp), %ebx + movl %ebx, %esi + movzwl 184(%esp), %ecx + andl $32767, %esi + movl %ecx, 44(%esp) + andl $32767, %ecx +..B3.141: + movl 200(%esp), %edx + movl 172(%esp), %eax + movl %eax, 76(%esp) + lea (%esi,%eax), %edi + movl %edi, 60(%esp) + lea -134(%edx,%ecx), %eax + cmpl %eax, %edi + jle ..B3.158 +..B3.142: + movl 152(%esp), %eax + lea 134(%edx,%ecx), %edi + cmpl 60(%esp), %edi + jle ..B3.159 +..B3.143: + testl %eax, %eax + jne ..B3.145 +..B3.144: + cmpl $0, 148(%esp) + je ..B3.160 +..B3.145: + cmpl $0, 180(%esp) + jne ..B3.147 +..B3.146: + cmpl $0, 176(%esp) + je ..B3.159 +..B3.147: + cmpl 76(%esp), %edx + je ..B3.149 +..B3.148: + fldt 64(%esp) + movl 76(%esp), %eax + fstpt 32(%esp) + subl %edx, %eax + fldt 148(%esp) + addl $16383, %eax + fldt 160(%esp) + andl $32767, %eax + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 172(%esp) + fxch %st(2) + fstpt 148(%esp) + fldt 148(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 160(%esp) + fldt 160(%esp) + movzwl 156(%esp), %ebx + jmp ..B3.150 +..B3.149: + fldt 148(%esp) + fldt 160(%esp) +..B3.150: + fldt 176(%esp) + andl $32767, %ebx + movl 44(%esp), %eax + fld %st(2) + andl $32767, %eax + fadd %st(1), %st + movl %edx, 228(%esp) + cmpl %eax, %ebx + jg ..B3.155 +..B3.151: + jne ..B3.156 +..B3.152: + movl 152(%esp), %eax + movl 180(%esp), %ecx + cmpl %ecx, %eax + ja ..B3.155 +..B3.153: + jne ..B3.156 +..B3.154: + movl 148(%esp), %eax + cmpl 176(%esp), %eax + jbe ..B3.156 +..B3.155: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 188(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B3.157 +..B3.156: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 188(%esp) + faddp %st, %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B3.157: + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + jmp ..B3.167 +..B3.158: + movl 152(%esp), %eax +..B3.159: + testl %eax, %eax + jne ..B3.161 +..B3.181: + cmpl $0, 148(%esp) +..B3.160: + je ..B3.162 +..B3.161: + lea -16517(%edx,%ecx), %ebx + movl 76(%esp), %ecx + lea -16383(%ecx,%esi), %esi + cmpl %esi, %ebx + jl ..B3.163 +..B3.162: + movl 176(%esp), %eax + movl %eax, 204(%esp) + movl 180(%esp), %ecx + movl 184(%esp), %ebx + movl 188(%esp), %esi + movl 192(%esp), %edi + movl 196(%esp), %eax + movl %ecx, 208(%esp) + movl %ebx, 212(%esp) + fldt 204(%esp) + movl %esi, 216(%esp) + movl %edi, 220(%esp) + movl %eax, 224(%esp) + fldt 216(%esp) + movl %edx, 228(%esp) + jmp ..B3.167 +..B3.163: + movl 148(%esp), %edx + movl %eax, 208(%esp) + movl 156(%esp), %eax + movl 160(%esp), %ecx + movl 164(%esp), %ebx + movl 168(%esp), %esi + movl %edx, 204(%esp) + movl %eax, 212(%esp) + fldt 204(%esp) + movl 76(%esp), %edx + movl %ecx, 216(%esp) + movl %ebx, 220(%esp) + movl %esi, 224(%esp) + fldt 216(%esp) + movl %edx, 228(%esp) + jmp ..B3.167 +..B3.164: + je ..B3.171 +..B3.165: + incl 284(%esp) + addl $12, %esp + lea 388(%esp), %eax + lea 192(%esp), %ecx + pushl %eax + lea 252(%esp), %edx + pushl %edx + pushl %ecx + call __libm_atan2l_k80 +..B3.166: + fldt 204(%esp) + fldt 216(%esp) + movl 228(%esp), %edx +..B3.167: + fldt 48(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fxch %st(1) + fstpt 204(%esp) + fstpt 216(%esp) + movl %edx, 24(%esp) + call __libm_scalbl_k80 +..B3.168: + movl 428(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B3.170 +..B3.169: + addl $436, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B3.170: + fstp %st(0) + movl 88(%esp), %ebx + call __stack_chk_fail@PLT +..B3.171: + movl 88(%esp), %edx + movl 376(%esp), %eax + cmpl 76+_CONSTANTS@GOTOFF(%edx), %eax + jb ..B3.72 +..B3.172: + jne ..B3.165 +..B3.173: + movl 372(%esp), %eax + cmpl 72+_CONSTANTS@GOTOFF(%edx), %eax + jb ..B3.72 + jmp ..B3.165 + .align 16,0x90 + .type imcatanhl,@function + .size imcatanhl,.-imcatanhl + .data +# -- End imcatanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.17: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 32768 + .word 16415 + .word 0 + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,84 + .data + .hidden __libm_normalizel_k80 + .hidden __libm_log_k80 + .hidden __libm_log1p_k80 + .hidden __libm_atan2l_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/catanl.S b/external/sgx_libm/ia32/catanl.S new file mode 100644 index 0000000000..3263ee5461 --- /dev/null +++ b/external/sgx_libm/ia32/catanl.S @@ -0,0 +1,210 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanl.c" + .text +..TXTST0: +# -- Begin catanl + .text + .align 16,0x90 + .globl catanl +catanl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 100(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 40(%esp) + fldt 40(%esp) + fstpt 52(%esp) + fldt 52(%esp) + fstpt 64(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.4: + orl $-64768, %ecx + movw %cx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %edi +..B1.7: + fldt 24(%ebp) + movzwl 32(%ebp), %edx + andl $32767, %edx + fstpt 52(%esp) + cmpl $32767, %edx + fldt 12(%ebp) + fstpt 64(%esp) + jl ..B1.10 +..B1.8: + cmpl $-2147483648, 28(%ebp) + jne ..B1.11 +..B1.9: + cmpl $0, 24(%ebp) + jne ..B1.11 +..B1.10: + movzbl 33(%ebp), %ecx + notl %ecx + movzbl 61(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 61(%esp) +..B1.11: + addl $-32, %esp + lea 108(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl -24(%ecx), %ecx + movl %ecx, (%edx) + movl 88(%esp), %ecx + movl %ecx, 4(%edx) + movl 92(%esp), %ecx + movl %ecx, 8(%edx) + movl 96(%esp), %ecx + movl %ecx, 12(%edx) + movl 100(%esp), %ecx + movl %ecx, 16(%edx) + movl 104(%esp), %ecx + movl %ecx, 20(%edx) + call catanhl@PLT +..B1.23: + addl $28, %esp + fldt 76(%esp) + movzwl 84(%esp), %edx + andl $32767, %edx + fstpt 4(%esp) + fldt 4(%esp) + cmpl $32767, %edx + fstpt 40(%esp) + fldt 88(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + jl ..B1.14 +..B1.12: + cmpl $-2147483648, 8(%esp) + jne ..B1.15 +..B1.13: + cmpl $0, 4(%esp) + jne ..B1.15 +..B1.14: + movzbl 13(%esp), %ecx + notl %ecx + movzbl 49(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 49(%esp) +..B1.15: + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 2(%esp) +..B1.17: + movl 28(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 12(%esi) + movl 44(%esp), %edx + movl %edx, 16(%esi) + movl 32(%esp), %ecx + movl 36(%esp), %edi + movl 48(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 100(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.19 +..B1.18: + movl %esi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.19: + call __stack_chk_fail@PLT +..B1.20: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type catanl,@function + .size catanl,.-catanl + .data +# -- End catanl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cbrt_wmt.S b/external/sgx_libm/ia32/cbrt_wmt.S new file mode 100644 index 0000000000..5afefab75a --- /dev/null +++ b/external/sgx_libm/ia32/cbrt_wmt.S @@ -0,0 +1,735 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrt_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin cbrt + .text + .align 16,0x90 + .globl cbrt +cbrt: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %esi, 52(%esp) + call static_func + movl %eax, %esi + movsd 128(%esp), %xmm0 + movapd %xmm0, %xmm7 + movsd %xmm0, 8(%esp) + movl $524032, %edx + movsd 64(%esi), %xmm5 + movsd 80(%esi), %xmm3 + psrlq $44, %xmm7 + pextrw $0, %xmm7, %ecx + movd %xmm7, %eax + movsd 96(%esi), %xmm1 + movsd 112(%esi), %xmm2 + movl %ebx, 16(%esp) + andl $248, %ecx + movsd 128(%ecx,%esi), %xmm4 + movl %eax, %ebx + andl %eax, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_0.0.2 + cmpl $524032, %edx + je .L_2TAG_PACKET_1.0.2 + shrl $8, %edx + shrl $8, %ebx + andpd %xmm0, %xmm2 + andpd %xmm5, %xmm0 + orpd %xmm2, %xmm3 + orpd %xmm0, %xmm1 + movapd (%esi), %xmm5 + movl $5462, %eax + movapd 16(%esi), %xmm6 + mull %edx + movl %ebx, %edx + andl $2047, %ebx + shrl $14, %eax + andl $2048, %edx + subl %eax, %ebx + subl %eax, %ebx + subl %eax, %ebx + shll $8, %ebx + addl $682, %eax + orl %edx, %eax + movd %eax, %xmm7 + addl %ebx, %ecx + psllq $52, %xmm7 +.L_2TAG_PACKET_2.0.2: + movapd 32(%esi), %xmm2 + movapd 48(%esi), %xmm0 + subsd %xmm3, %xmm1 + movq %xmm7, %xmm3 + mulsd 384(%ecx,%esi), %xmm7 + mulsd %xmm4, %xmm1 + mulsd 1152(%ecx,%esi), %xmm3 + movapd %xmm1, %xmm4 + unpcklpd %xmm1, %xmm1 + mulpd %xmm1, %xmm5 + mulpd %xmm1, %xmm6 + mulpd %xmm1, %xmm1 + addpd %xmm5, %xmm2 + addpd %xmm6, %xmm0 + mulpd %xmm1, %xmm2 + mulpd %xmm1, %xmm1 + mulsd %xmm7, %xmm4 + addpd %xmm2, %xmm0 + movl 16(%esp), %ebx + mulsd %xmm0, %xmm1 + unpckhpd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm3, %xmm0 + addsd %xmm7, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + mulsd 1984(%esi), %xmm0 + movq %xmm0, %xmm7 + movl $524032, %edx + psrlq $44, %xmm7 + pextrw $0, %xmm7, %ecx + movd %xmm7, %eax + andl $248, %ecx + movsd 128(%ecx,%esi), %xmm4 + movl %eax, %ebx + andl %eax, %edx + shrl $8, %edx + shrl $8, %ebx + cmpl $0, %edx + je .L_2TAG_PACKET_4.0.2 + andpd %xmm0, %xmm2 + andpd %xmm5, %xmm0 + orpd %xmm2, %xmm3 + orpd %xmm0, %xmm1 + movapd (%esi), %xmm5 + movl $5462, %eax + movapd 16(%esi), %xmm6 + mull %edx + movl %ebx, %edx + andl $2047, %ebx + shrl $14, %eax + andl $2048, %edx + subl %eax, %ebx + subl %eax, %ebx + subl %eax, %ebx + shll $8, %ebx + addl $661, %eax + orl %edx, %eax + movd %eax, %xmm7 + addl %ebx, %ecx + psllq $52, %xmm7 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_4.0.2: + cmpl $0, %ebx + jne .L_2TAG_PACKET_5.0.2 + movl 16(%esp), %ebx + fldl 1952(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_5.0.2: + movl 16(%esp), %ebx + fldl 1968(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_1.0.2: + movl 16(%esp), %ebx + movl 132(%esp), %eax + movl 128(%esp), %edx + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $2146435072, %ecx + ja .L_2TAG_PACKET_6.0.2 + cmpl $0, %edx + jne .L_2TAG_PACKET_6.0.2 + cmpl $2146435072, %eax + jne .L_2TAG_PACKET_7.0.2 + fldl 1920(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_7.0.2: + fldl 1936(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_6.0.2: + movsd 8(%esp), %xmm0 + addsd %xmm0, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_3.0.2: + movl 52(%esp), %esi + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type cbrt,@function + .size cbrt,.-cbrt + .data +# -- End cbrt + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1553778919 + .long 3213899486 + .long 3534952507 + .long 3215266280 + .long 1646371399 + .long 3214412045 + .long 477218588 + .long 3216798151 + .long 3582521621 + .long 1066628362 + .long 1007461464 + .long 1068473053 + .long 889629714 + .long 1067378449 + .long 1431655765 + .long 1070945621 + .long 4294967295 + .long 1048575 + .long 0 + .long 0 + .long 0 + .long 3220193280 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 1032192 + .long 0 + .long 0 + .long 528611360 + .long 3220144632 + .long 2884679527 + .long 3220082993 + .long 1991868891 + .long 3220024928 + .long 2298714891 + .long 3219970134 + .long 58835168 + .long 3219918343 + .long 3035110223 + .long 3219869313 + .long 1617585086 + .long 3219822831 + .long 2500867033 + .long 3219778702 + .long 4241943008 + .long 3219736752 + .long 258732970 + .long 3219696825 + .long 404232216 + .long 3219658776 + .long 2172167368 + .long 3219622476 + .long 1544257904 + .long 3219587808 + .long 377579543 + .long 3219554664 + .long 1616385542 + .long 3219522945 + .long 813783277 + .long 3219492562 + .long 3940743189 + .long 3219463431 + .long 2689777499 + .long 3219435478 + .long 1700977147 + .long 3219408632 + .long 3169102082 + .long 3219382828 + .long 327235604 + .long 3219358008 + .long 1244336319 + .long 3219334115 + .long 1300311200 + .long 3219311099 + .long 3095471925 + .long 3219288912 + .long 2166487928 + .long 3219267511 + .long 2913108253 + .long 3219246854 + .long 293672978 + .long 3219226904 + .long 288737297 + .long 3219207624 + .long 1810275472 + .long 3219188981 + .long 174592167 + .long 3219170945 + .long 3539053052 + .long 3219153485 + .long 2164392968 + .long 3219136576 + .long 572345495 + .long 1072698681 + .long 1998204467 + .long 1072709382 + .long 3861501553 + .long 1072719872 + .long 2268192434 + .long 1072730162 + .long 2981979308 + .long 1072740260 + .long 270859143 + .long 1072750176 + .long 2958651392 + .long 1072759916 + .long 313113243 + .long 1072769490 + .long 919449400 + .long 1072778903 + .long 2809328903 + .long 1072788162 + .long 2222981587 + .long 1072797274 + .long 2352530781 + .long 1072806244 + .long 594152517 + .long 1072815078 + .long 1555767199 + .long 1072823780 + .long 4282421314 + .long 1072832355 + .long 2355578597 + .long 1072840809 + .long 1162590619 + .long 1072849145 + .long 797864051 + .long 1072857367 + .long 431273680 + .long 1072865479 + .long 2669831148 + .long 1072873484 + .long 733477752 + .long 1072881387 + .long 4280220604 + .long 1072889189 + .long 801961634 + .long 1072896896 + .long 2915370760 + .long 1072904508 + .long 1159613482 + .long 1072912030 + .long 2689944798 + .long 1072919463 + .long 1248687822 + .long 1072926811 + .long 2967951030 + .long 1072934075 + .long 630170432 + .long 1072941259 + .long 3760898254 + .long 1072948363 + .long 0 + .long 1072955392 + .long 2370273294 + .long 1072962345 + .long 1261754802 + .long 1072972640 + .long 546334065 + .long 1072986123 + .long 1054893830 + .long 1072999340 + .long 1571187597 + .long 1073012304 + .long 1107975175 + .long 1073025027 + .long 3606909377 + .long 1073037519 + .long 1113616747 + .long 1073049792 + .long 4154744632 + .long 1073061853 + .long 3358931423 + .long 1073073713 + .long 4060702372 + .long 1073085379 + .long 747576176 + .long 1073096860 + .long 3023138255 + .long 1073108161 + .long 1419988548 + .long 1073119291 + .long 1914185305 + .long 1073130255 + .long 294389948 + .long 1073141060 + .long 3761802570 + .long 1073151710 + .long 978281566 + .long 1073162213 + .long 823148820 + .long 1073172572 + .long 2420954441 + .long 1073182792 + .long 3815449908 + .long 1073192878 + .long 2046058587 + .long 1073202835 + .long 1807524753 + .long 1073212666 + .long 2628681401 + .long 1073222375 + .long 3225667357 + .long 1073231966 + .long 1555307421 + .long 1073241443 + .long 3454043099 + .long 1073250808 + .long 1208137896 + .long 1073260066 + .long 3659916772 + .long 1073269218 + .long 1886261264 + .long 1073278269 + .long 3593647839 + .long 1073287220 + .long 3086012205 + .long 1073296075 + .long 2769796922 + .long 1073304836 + .long 888716057 + .long 1073317807 + .long 2201465623 + .long 1073334794 + .long 164369365 + .long 1073351447 + .long 3462666733 + .long 1073367780 + .long 2773905457 + .long 1073383810 + .long 1342879088 + .long 1073399550 + .long 2543933975 + .long 1073415012 + .long 1684477781 + .long 1073430209 + .long 3532178543 + .long 1073445151 + .long 1147747300 + .long 1073459850 + .long 1928031793 + .long 1073474314 + .long 2079717015 + .long 1073488553 + .long 4016765315 + .long 1073502575 + .long 3670431139 + .long 1073516389 + .long 3549227225 + .long 1073530002 + .long 11637607 + .long 1073543422 + .long 588220169 + .long 1073556654 + .long 2635407503 + .long 1073569705 + .long 2042029317 + .long 1073582582 + .long 1925128962 + .long 1073595290 + .long 4136375664 + .long 1073607834 + .long 759964600 + .long 1073620221 + .long 4257606771 + .long 1073632453 + .long 297278907 + .long 1073644538 + .long 3655053093 + .long 1073656477 + .long 2442253172 + .long 1073668277 + .long 1111876799 + .long 1073679941 + .long 3330973139 + .long 1073691472 + .long 3438879452 + .long 1073702875 + .long 3671565478 + .long 1073714153 + .long 1317849547 + .long 1073725310 + .long 1642364115 + .long 1073736348 + .long 4050900474 + .long 1014427190 + .long 1157977860 + .long 1016444461 + .long 1374568199 + .long 1017271387 + .long 2809163288 + .long 1016882676 + .long 3742377377 + .long 1013168191 + .long 3101606597 + .long 1017541672 + .long 65224358 + .long 1017217597 + .long 2691591250 + .long 1017266643 + .long 4020758549 + .long 1017689313 + .long 1316310992 + .long 1018030788 + .long 1031537856 + .long 1014090882 + .long 3261395239 + .long 1016413641 + .long 886424999 + .long 1016313335 + .long 3114776834 + .long 1014195875 + .long 1681120620 + .long 1017825416 + .long 1329600273 + .long 1016625740 + .long 465474623 + .long 1017097119 + .long 4251633980 + .long 1017169077 + .long 1986990133 + .long 1017710645 + .long 752958613 + .long 1017159641 + .long 2216216792 + .long 1018020163 + .long 4282860129 + .long 1015924861 + .long 1557627859 + .long 1016039538 + .long 3889219754 + .long 1018086237 + .long 3684996408 + .long 1017353275 + .long 723532103 + .long 1017717141 + .long 2951149676 + .long 1012528470 + .long 831890937 + .long 1017830553 + .long 1031212645 + .long 1017387331 + .long 2741737450 + .long 1017604974 + .long 2863311531 + .long 1003776682 + .long 4276736099 + .long 1013153088 + .long 4111778382 + .long 1015673686 + .long 1728065769 + .long 1016413986 + .long 2708718031 + .long 1018078833 + .long 1069335005 + .long 1015291224 + .long 700037144 + .long 1016482032 + .long 2904566452 + .long 1017226861 + .long 4074156649 + .long 1017622651 + .long 25019565 + .long 1015245366 + .long 3601952608 + .long 1015771755 + .long 3267129373 + .long 1017904664 + .long 503203103 + .long 1014921629 + .long 2122011730 + .long 1018027866 + .long 3927295461 + .long 1014189456 + .long 2790625147 + .long 1016024251 + .long 1330460186 + .long 1016940346 + .long 4033568463 + .long 1015538390 + .long 3695818227 + .long 1017509621 + .long 257573361 + .long 1017208868 + .long 3227697852 + .long 1017337964 + .long 234118548 + .long 1017169577 + .long 4009025803 + .long 1017278524 + .long 1948343394 + .long 1017749310 + .long 678398162 + .long 1018144239 + .long 3083864863 + .long 1016669086 + .long 2415453452 + .long 1017890370 + .long 175467344 + .long 1017330033 + .long 3197359580 + .long 1010339928 + .long 2071276951 + .long 1015941358 + .long 268372543 + .long 1016737773 + .long 938132959 + .long 1017389108 + .long 1816750559 + .long 1017337448 + .long 4119203749 + .long 1017152174 + .long 2578653878 + .long 1013108497 + .long 2470331096 + .long 1014678606 + .long 123855735 + .long 1016553320 + .long 1265650889 + .long 1014782687 + .long 3414398172 + .long 1017182638 + .long 1040773369 + .long 1016158401 + .long 3483628886 + .long 1016886550 + .long 4140499405 + .long 1016191425 + .long 3893477850 + .long 1016964495 + .long 3935319771 + .long 1009634717 + .long 2978982660 + .long 1015027112 + .long 2452709923 + .long 1017990229 + .long 3190365712 + .long 1015835149 + .long 4237588139 + .long 1015832925 + .long 2610678389 + .long 1017962711 + .long 2127316774 + .long 1017405770 + .long 824267502 + .long 1017959463 + .long 2165924042 + .long 1017912225 + .long 2774007076 + .long 1013257418 + .long 4123916326 + .long 1017582284 + .long 1976417958 + .long 1016959909 + .long 4092806412 + .long 1017711279 + .long 119251817 + .long 1015363631 + .long 3475418768 + .long 1017675415 + .long 1972580503 + .long 1015470684 + .long 815541017 + .long 1017517969 + .long 2429917451 + .long 1017397776 + .long 4062888482 + .long 1016749897 + .long 68284153 + .long 1017925678 + .long 2207779246 + .long 1016320298 + .long 1183466520 + .long 1017408657 + .long 143326427 + .long 1017060403 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 4293918720 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 1138753536 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,2000 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cbrtf_wmt.S b/external/sgx_libm/ia32/cbrtf_wmt.S new file mode 100644 index 0000000000..b04fe14b04 --- /dev/null +++ b/external/sgx_libm/ia32/cbrtf_wmt.S @@ -0,0 +1,504 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrtf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin cbrtf + .text + .align 16,0x90 + .globl cbrtf +cbrtf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %esi, 44(%esp) + call static_func + movl %eax, %esi + movss 112(%esp), %xmm0 + movss %xmm0, 4(%esp) + movl %ebx, 8(%esp) + movl $8388607, %edx + movd %edx, %xmm5 + movl $-1081999360, %ebx + movd %ebx, %xmm3 + movl $-1082130432, %ebx + movd %ebx, %xmm1 + movl $8257536, %edx + movd %edx, %xmm2 + pextrw $1, %xmm0, %ecx + movl %ecx, %eax + andl $124, %ecx + movss 16(%ecx,%esi), %xmm4 + shrl $7, %eax + movl $255, %edx + andl %eax, %edx + movl %eax, %ebx + cmpl $0, %edx + je .L_2TAG_PACKET_0.0.2 + cmpl $255, %edx + je .L_2TAG_PACKET_1.0.2 + andps %xmm0, %xmm2 + andps %xmm5, %xmm0 + orps %xmm2, %xmm3 + orps %xmm0, %xmm1 + movss (%esi), %xmm5 + movss 4(%esi), %xmm6 + movl %edx, %eax + addl %eax, %eax + addl %eax, %eax + addl %edx, %eax + movl %eax, %edx + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %edx + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %edx, %eax + movl %ebx, %edx + andl $255, %ebx + subl $1, %ebx + shrl $12, %eax + andl $256, %edx + subl %eax, %ebx + subl %eax, %ebx + subl %eax, %ebx + shll $7, %ebx + addl $85, %eax + orl %edx, %eax + movd %eax, %xmm7 + addl %ebx, %ecx + psllq $23, %xmm7 +.L_2TAG_PACKET_2.0.2: + movss 8(%esi), %xmm2 + movss 12(%esi), %xmm0 + subss %xmm3, %xmm1 + movaps %xmm7, %xmm3 + mulss 144(%ecx,%esi), %xmm7 + mulss %xmm4, %xmm1 + mulss 528(%ecx,%esi), %xmm3 + movss %xmm1, %xmm4 + mulss %xmm1, %xmm5 + mulss %xmm1, %xmm6 + mulss %xmm1, %xmm1 + addss %xmm5, %xmm2 + addss %xmm6, %xmm0 + mulss %xmm1, %xmm2 + mulss %xmm7, %xmm4 + addss %xmm2, %xmm0 + movl 8(%esp), %ebx + mulss %xmm4, %xmm0 + addss %xmm3, %xmm0 + addss %xmm7, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + movq %xmm0, %xmm7 + movd %xmm0, %eax + movl %eax, %ebx + shll $9, %eax + movl $23, %ecx + shrl $23, %ebx +.L_2TAG_PACKET_4.0.2: + cmpl $-2147483648, %eax + jae .L_2TAG_PACKET_5.0.2 + shll $1, %eax + addl $1, %edx + loop .L_2TAG_PACKET_4.0.2 + cmpl $0, %eax + je .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_5.0.2: + movl %edx, %ecx + incl %ecx + movd %ecx, %xmm7 + orl %edx, %ebx + psllq %xmm7, %xmm0 + shrl $24, %eax + andl $124, %eax + movsd 16(%esi,%eax), %xmm4 + movl %eax, %ecx + andps %xmm0, %xmm2 + andps %xmm5, %xmm0 + orps %xmm2, %xmm3 + orps %xmm0, %xmm1 + movss (%esi), %xmm5 + movl $1366, %eax + movss 4(%esi), %xmm6 + mull %edx + movl %ebx, %edx + andl $255, %ebx + addl $1, %ebx + shrl $12, %eax + andl $256, %edx + subl %eax, %ebx + subl %eax, %ebx + subl %eax, %ebx + cmpl $0, %ebx + je .L_2TAG_PACKET_7.0.2 + incl %eax + subl $3, %ebx + negl %ebx +.L_2TAG_PACKET_7.0.2: + shll $7, %ebx + addl %ebx, %ecx + movl $85, %ebx + subl %eax, %ebx + orl %edx, %ebx + movd %ebx, %xmm7 + psllq $23, %xmm7 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_6.0.2: + cmpl $0, %ebx + jne .L_2TAG_PACKET_8.0.2 + movl 8(%esp), %ebx + fldl 944(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_8.0.2: + movl 8(%esp), %ebx + fldl 960(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_1.0.2: + movl 8(%esp), %ebx + movl 4(%esp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $2139095040, %ecx + ja .L_2TAG_PACKET_9.0.2 + cmpl $2139095040, %eax + jne .L_2TAG_PACKET_10.0.2 + fldl 912(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_10.0.2: + fldl 928(%esi) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_9.0.2: + movss 4(%esp), %xmm0 + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_3.0.2: + movl 44(%esp), %esi + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type cbrtf,@function + .size cbrtf,.-cbrtf + .data +# -- End cbrtf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 3173551943 + .long 3185806905 + .long 1031591658 + .long 1051372203 + .long 3212578753 + .long 3212085645 + .long 3211621124 + .long 3211182772 + .long 3210768440 + .long 3210376206 + .long 3210004347 + .long 3209651317 + .long 3209315720 + .long 3208996296 + .long 3208691905 + .long 3208401508 + .long 3208124163 + .long 3207859009 + .long 3207605259 + .long 3207362194 + .long 3207129151 + .long 3206905525 + .long 3206690755 + .long 3206484326 + .long 3206285761 + .long 3206094618 + .long 3205910490 + .long 3205732998 + .long 3205561788 + .long 3205396533 + .long 3205236929 + .long 3205082689 + .long 3204933547 + .long 3204789256 + .long 3204649583 + .long 3204514308 + .long 1065396681 + .long 1065482291 + .long 1065566215 + .long 1065648532 + .long 1065729317 + .long 1065808640 + .long 1065886565 + .long 1065963152 + .long 1066038457 + .long 1066112533 + .long 1066185428 + .long 1066257188 + .long 1066327857 + .long 1066397474 + .long 1066466079 + .long 1066533708 + .long 1066600394 + .long 1066666169 + .long 1066731064 + .long 1066795108 + .long 1066858329 + .long 1066920751 + .long 1066982401 + .long 1067043301 + .long 1067103474 + .long 1067162941 + .long 1067221722 + .long 1067279837 + .long 1067337305 + .long 1067394143 + .long 1067450368 + .long 1067505996 + .long 1067588354 + .long 1067696217 + .long 1067801953 + .long 1067905666 + .long 1068007450 + .long 1068107390 + .long 1068205570 + .long 1068302063 + .long 1068396942 + .long 1068490271 + .long 1068582113 + .long 1068672525 + .long 1068761562 + .long 1068849275 + .long 1068935712 + .long 1069020919 + .long 1069104937 + .long 1069187809 + .long 1069269572 + .long 1069350263 + .long 1069429915 + .long 1069508563 + .long 1069586236 + .long 1069662966 + .long 1069738778 + .long 1069813702 + .long 1069887762 + .long 1069960982 + .long 1070033387 + .long 1070104998 + .long 1070175837 + .long 1070245925 + .long 1070349689 + .long 1070485588 + .long 1070618808 + .long 1070749478 + .long 1070877717 + .long 1071003634 + .long 1071127332 + .long 1071248907 + .long 1071368446 + .long 1071486034 + .long 1071601747 + .long 1071715659 + .long 1071827839 + .long 1071938350 + .long 1072047254 + .long 1072154608 + .long 1072260465 + .long 1072364876 + .long 1072467891 + .long 1072569555 + .long 1072669911 + .long 1072769001 + .long 1072866863 + .long 1072963536 + .long 1073059054 + .long 1073153452 + .long 1073246762 + .long 1073339014 + .long 1073430238 + .long 1073520462 + .long 1073609714 + .long 1073698019 + .long 839340838 + .long 867750258 + .long 851786446 + .long 853949398 + .long 864938789 + .long 864102364 + .long 864209792 + .long 865422805 + .long 867593594 + .long 854482593 + .long 848298042 + .long 860064854 + .long 844792593 + .long 870701309 + .long 872023170 + .long 860255342 + .long 849966899 + .long 863561479 + .long 869115319 + .long 871961375 + .long 859537336 + .long 871954398 + .long 863817578 + .long 861687921 + .long 849594757 + .long 816486846 + .long 858183533 + .long 864500406 + .long 850523240 + .long 808125243 + .long 514020693 + .long 861173761 + .long 859000219 + .long 823158129 + .long 871826232 + .long 871183196 + .long 839030530 + .long 867690638 + .long 840440923 + .long 868033274 + .long 855856030 + .long 865094453 + .long 860418487 + .long 866225006 + .long 866458226 + .long 865124659 + .long 864837702 + .long 811742505 + .long 869432099 + .long 864584201 + .long 864183978 + .long 844810573 + .long 869245699 + .long 859556409 + .long 870675446 + .long 814190139 + .long 870686941 + .long 861800510 + .long 855649163 + .long 869347119 + .long 864252033 + .long 867276215 + .long 868189817 + .long 849541095 + .long 866633177 + .long 843967686 + .long 857522493 + .long 862339487 + .long 850054662 + .long 864048556 + .long 868027089 + .long 848093931 + .long 865355299 + .long 848111485 + .long 865557362 + .long 870297525 + .long 863416216 + .long 869675693 + .long 865888071 + .long 825332584 + .long 843309506 + .long 870885636 + .long 869119784 + .long 865466648 + .long 867459244 + .long 861192764 + .long 871247716 + .long 864927982 + .long 869195129 + .long 864849564 + .long 840005936 + .long 852579258 + .long 860852782 + .long 869711141 + .long 862506141 + .long 837959274 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 4293918720 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,976 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cbrtl.S b/external/sgx_libm/ia32/cbrtl.S new file mode 100644 index 0000000000..71fe91a6ac --- /dev/null +++ b/external/sgx_libm/ia32/cbrtl.S @@ -0,0 +1,374 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrtl.c" + .text +..TXTST0: +# -- Begin cbrtl + .text + .align 16,0x90 + .globl cbrtl +cbrtl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 30(%esp) +..B1.3: + movzwl 16(%ebp), %esi + movl %esi, %ebx + andl $32767, %ebx + movzwl 30(%esp), %ecx + cmpl $32767, %ebx + je ..B1.23 +..B1.4: + movl %ecx, %edx + movzbl 17(%ebp), %eax + andl $768, %edx + andl $128, %eax + shrl $7, %eax + cmpl $768, %edx + je ..B1.22 +..B1.5: + orl $-64768, %ecx + movw %cx, 28(%esp) +..B1.6: + fldcw 28(%esp) +..B1.7: + movzwl 16(%ebp), %esi + movl %esi, %ebx + movl $1, %edi + andl $32767, %ebx +..B1.8: + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + testl %ebx, %ebx + jne ..B1.15 +..B1.9: + cmpl $0, 12(%ebp) + jne ..B1.14 +..B1.10: + cmpl $0, 8(%ebp) + jne ..B1.14 +..B1.11: + fldl _zeros@GOTOFF(%ecx,%eax,8) + testl %edi, %edi + fstpl (%esp) + je ..B1.13 +..B1.12: + fldcw 30(%esp) +..B1.13: + fldl (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + fldt 8(%ebp) + movl $-25, %edx + fmull _TWO_75@GOTOFF(%ecx) + fstpt 8(%ebp) + movzwl 16(%ebp), %esi + movl %esi, %ebx + andl $32767, %ebx + jmp ..B1.16 +..B1.15: + xorl %edx, %edx +..B1.16: + fldl ones@GOTOFF(%ecx,%eax,8) + andl $-32768, %esi + imull $21845, %ebx, %eax + orl $-49153, %esi + fstpt (%esp) + fldt (%esp) + fldl _TWO_32H@GOTOFF(%ecx) + fld %st(0) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + movw %si, 16(%ebp) + addl $21845, %eax + fldt 8(%ebp) + fmulp %st, %st(4) + shrl $16, %eax + fxch %st(1) + fadd %st(3), %st + movl %edi, 12(%esp) + lea (%eax,%eax), %edi + subl %edi, %ebx + lea 10922(%edx,%eax), %edx + movl 12(%ebp), %edi + fsubp %st, %st(2) + shrl $23, %edi + fxch %st(1) + fsubr %st, %st(2) + fldt 72+_P@GOTOFF(%ecx) + fldt 48+_P@GOTOFF(%ecx) + andl $255, %edi + movzwl 8(%esp), %esi + andl $-32768, %esi + orl %edx, %esi + flds __libm_rcp_table_256@GOTOFF(%ecx,%edi,4) + fld %st(0) + fmulp %st, %st(4) + shll $4, %edi + fxch %st(3) + fsub %st(4), %st + fxch %st(3) + fmulp %st, %st(5) + movw %si, 8(%esp) + subl %eax, %ebx + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fmul %st(3), %st + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fmul %st(1), %st + fldt 60+_P@GOTOFF(%ecx) + fmul %st(4), %st + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt _P@GOTOFF(%ecx) + fmulp %st, %st(1) + faddp %st, %st(2) + fadd %st(1), %st + fstpt 16(%esp) + fldl 8+__libm_cbrtl_table_256@GOTOFF(%ecx,%edi) + fldl __libm_cbrtl_table_256@GOTOFF(%ecx,%edi) + fldt (%esp) + movl 12(%esp), %edi + jne ..B1.18 +..B1.17: + fldt 16(%esp) + fmulp %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.19 +..B1.18: + fxch %st(2) + fmull -8+_SH@GOTOFF(%ecx,%ebx,8) + fldl 24+_SH@GOTOFF(%ecx,%ebx,8) + fmul %st(2), %st + faddp %st, %st(1) + fxch %st(1) + fmull 8+_SH@GOTOFF(%ecx,%ebx,8) + fmul %st, %st(3) + fldt 16(%esp) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 16(%esp) +..B1.19: + testl %edi, %edi + je ..B1.21 +..B1.20: + fldcw 30(%esp) +..B1.21: + fldt 16(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.22: + xorl %edi, %edi + jmp ..B1.8 +..B1.23: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.24: + orl $-64768, %ecx + movw %cx, 28(%esp) +..B1.25: + fldcw 28(%esp) +..B1.26: + fldt 8(%ebp) + fstpt (%esp) +..B1.27: + fldcw 30(%esp) +..B1.28: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.28 + .align 16,0x90 + .type cbrtl,@function + .size cbrtl,.-cbrtl + .data +# -- End cbrtl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +_SH: + .long 0xf98d728b,0x3ff428a2 + .long 0xa53d6e3d,0x3ff965fe + .long 0xf8000000,0x3ff428a2 + .long 0xa4000000,0x3ff965fe + .long 0xae223ddb,0x3e38d728 + .long 0xc82b059a,0x3e33d6e3 + .type _SH,@object + .size _SH,48 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_P: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58320 + .word 36408 + .word 14563 + .word 58254 + .word 49147 + .word 0 + .word 50474 + .word 25890 + .word 59872 + .word 64726 + .word 16378 + .word 0 + .word 45217 + .word 37017 + .word 18069 + .word 43151 + .word 49146 + .word 0 + .word 45059 + .word 7616 + .word 35240 + .word 63288 + .word 16377 + .word 0 + .word 54522 + .word 17175 + .word 48475 + .word 49224 + .word 49145 + .word 0 + .word 568 + .word 55426 + .word 44619 + .word 39848 + .word 16377 + .word 0 + .type _P,@object + .size _P,84 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_cbrtl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cbrtl_table.S b/external/sgx_libm/ia32/cbrtl_table.S new file mode 100644 index 0000000000..336596680a --- /dev/null +++ b/external/sgx_libm/ia32/cbrtl_table.S @@ -0,0 +1,560 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrtl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_cbrtl_table_256 + .globl __libm_cbrtl_table_256 +__libm_cbrtl_table_256: + .long 0x8e000000,0x3ff002ab + .long 0x20d8688c,0x3e2230dd + .long 0x08000000,0x3ff00808 + .long 0xeff25f12,0x3e3610f3 + .long 0xba000000,0x3ff00d6b + .long 0x3efe3543,0xbe0b4bfa + .long 0xb2000000,0x3ff012d6 + .long 0x2c9e7759,0xbe32d173 + .long 0x4e000000,0x3ff0179a + .long 0x013f2daf,0x3e1eca95 + .long 0x1a000000,0x3ff01d13 + .long 0x1a1a641f,0xbe35afd8 + .long 0x5a000000,0x3ff02293 + .long 0xa40f870c,0x3e3acf85 + .long 0xc6000000,0x3ff02769 + .long 0x8b30b2ed,0xbe1bd4a4 + .long 0x3c000000,0x3ff02cf8 + .long 0xc2b35d57,0xbe10fe10 + .long 0x2e000000,0x3ff031db + .long 0x9aefd6bc,0x3e1dc088 + .long 0x1a000000,0x3ff03778 + .long 0x26cf8b86,0xbe3983d8 + .long 0xcc000000,0x3ff03c67 + .long 0xa0938ea4,0x3e33f7ce + .long 0x8a000000,0x3ff0415d + .long 0x1f4527e6,0x3e1271e1 + .long 0x1e000000,0x3ff04710 + .long 0xe014332a,0x3e2e39c2 + .long 0xf4000000,0x3ff04c12 + .long 0x4801f107,0x3e28aa39 + .long 0xfc000000,0x3ff0511b + .long 0x5e2d9f07,0x3dbd36bd + .long 0x42000000,0x3ff0562b + .long 0xc47ab24f,0x3df8a6e2 + .long 0xd4000000,0x3ff05b40 + .long 0x24da1d13,0x3e249ec6 + .long 0xc2000000,0x3ff0605c + .long 0x31b189b7,0xbe227295 + .long 0x16000000,0x3ff0657f + .long 0x7872e1cd,0x3e17f761 + .long 0xe2000000,0x3ff06aa7 + .long 0xc4a6c979,0xbe18ff8e + .long 0x32000000,0x3ff06fd7 + .long 0x37586fc9,0xbe22bc1f + .long 0x1e000000,0x3ff0744e + .long 0xda6466ae,0x3e213213 + .long 0xb0000000,0x3ff07989 + .long 0xd1b04779,0xbe181829 + .long 0xf0000000,0x3ff07ecb + .long 0x52cf55c8,0xbe2d5de3 + .long 0xea000000,0x3ff08414 + .long 0xa790ab31,0x3e3e5ef6 + .long 0x0a000000,0x3ff088a2 + .long 0x7bee6b1f,0xbe33c01d + .long 0xb2000000,0x3ff08df7 + .long 0xed26e53e,0x3e0b930b + .long 0xc4000000,0x3ff0928f + .long 0x35afee34,0xbe2f72c3 + .long 0x4e000000,0x3ff097f2 + .long 0x1166e9a4,0x3e256094 + .long 0x82000000,0x3ff09c95 + .long 0x5ae9d19c,0xbe01eed4 + .long 0xe8000000,0x3ff0a13d + .long 0x82f9b502,0x3e22e1bc + .long 0xac000000,0x3ff0a6b3 + .long 0xdecb71aa,0xbe13744b + .long 0x7c000000,0x3ff0ab67 + .long 0x79520489,0xbe34918f + .long 0x9e000000,0x3ff0b020 + .long 0xf330a139,0x3df882be + .long 0x20000000,0x3ff0b4df + .long 0xc3236255,0x3e1c8694 + .long 0xe6000000,0x3ff0ba6e + .long 0x119c7384,0xbdd954af + .long 0x30000000,0x3ff0bf39 + .long 0x17946a4f,0x3e17e600 + .long 0xfc000000,0x3ff0c408 + .long 0xa96efefe,0x3dfcfd4a + .long 0x54000000,0x3ff0c8de + .long 0xc29018c1,0x3e137bfa + .long 0x44000000,0x3ff0cdb9 + .long 0x6b55ea13,0x3e075409 + .long 0xd8000000,0x3ff0d299 + .long 0x17222364,0xbe2c80ba + .long 0x1a000000,0x3ff0d780 + .long 0xf030bcdb,0xbe36c2d9 + .long 0xae000000,0x3ff0db99 + .long 0x583eb4fd,0x3e23f39e + .long 0x7a000000,0x3ff0e08a + .long 0x1bc25b4a,0xbe2ee94c + .long 0x14000000,0x3ff0e581 + .long 0x2f4f4e2c,0xbe2785bf + .long 0x88000000,0x3ff0ea7d + .long 0xd8bcbdfc,0x3e3525a2 + .long 0xe6000000,0x3ff0ef7f + .long 0xed67b448,0x3e359433 + .long 0x16000000,0x3ff0f3b1 + .long 0xc931fbd5,0x3e2bf870 + .long 0x6a000000,0x3ff0f8be + .long 0xe78cbbad,0xbe32480c + .long 0xca000000,0x3ff0fcf8 + .long 0x795e6dd9,0x3e1f7d67 + .long 0x3a000000,0x3ff10211 + .long 0xfbf1714f,0x3e239cff + .long 0xce000000,0x3ff1072f + .long 0x55d6f69a,0xbe272643 + .long 0xac000000,0x3ff10b78 + .long 0xfdfa2d3b,0xbe286878 + .long 0xdc000000,0x3ff10fc5 + .long 0xd49627b5,0x3e1c95db + .long 0x0c000000,0x3ff114f5 + .long 0xf6a23fbe,0xbe2e06fe + .long 0xda000000,0x3ff1194b + .long 0x8f075abc,0x3e34ceb2 + .long 0xac000000,0x3ff11e86 + .long 0x90dc17c3,0x3e066bd5 + .long 0x40000000,0x3ff122e7 + .long 0xc04b5d49,0x3e359eb9 + .long 0x54000000,0x3ff1274c + .long 0xaf65cf99,0x3df316d4 + .long 0xec000000,0x3ff12bb5 + .long 0x7163f782,0x3e1b91b5 + .long 0x74000000,0x3ff13107 + .long 0xb1d8a38e,0xbe171e82 + .long 0x1c000000,0x3ff1357b + .long 0x142a679f,0xbe1645ad + .long 0x64000000,0x3ff139f3 + .long 0x03011ac3,0xbe119734 + .long 0x54000000,0x3ff13e70 + .long 0xceefd26a,0x3e12c753 + .long 0xf6000000,0x3ff142f1 + .long 0x1ae3077b,0xbdff336e + .long 0x50000000,0x3ff14778 + .long 0xa313efdd,0x3e3167c3 + .long 0x6e000000,0x3ff14c03 + .long 0xe0d315a6,0x3e23d347 + .long 0x56000000,0x3ff15093 + .long 0x8ec79515,0x3e34284e + .long 0x14000000,0x3ff15528 + .long 0x6ca0e852,0xbdfd2648 + .long 0xae000000,0x3ff159c1 + .long 0x33a7b5b1,0xbe21074d + .long 0x2c000000,0x3ff15e60 + .long 0x6aaf8c8a,0x3e311566 + .long 0x9c000000,0x3ff16303 + .long 0xdfa56cef,0xbe04190c + .long 0x02000000,0x3ff167ac + .long 0x96f8f747,0x3e30bf5f + .long 0x6c000000,0x3ff16c59 + .long 0x67e1e977,0x3dddd97d + .long 0xfc000000,0x3ff1701a + .long 0xf643cd8e,0xbe32877d + .long 0x80000000,0x3ff174d1 + .long 0x618d0ab4,0xbe318a71 + .long 0x1e000000,0x3ff1798d + .long 0xe66a5be3,0x3e373f3e + .long 0xe6000000,0x3ff17e4d + .long 0xca1da90a,0x3e0c534f + .long 0x0e000000,0x3ff1821f + .long 0xe06a8431,0xbe0ec5e5 + .long 0x32000000,0x3ff186e9 + .long 0xbb5373b7,0x3e06cc6a + .long 0x98000000,0x3ff18bb8 + .long 0x80c817c3,0x3e23ddc1 + .long 0x88000000,0x3ff18f95 + .long 0x70817aed,0xbe25cef4 + .long 0x7e000000,0x3ff1946e + .long 0x71612988,0x3e0b7bf2 + .long 0x22000000,0x3ff19853 + .long 0xdad7b32a,0xbe3008d5 + .long 0xc8000000,0x3ff19d35 + .long 0x558f59ee,0x3e3d2925 + .long 0x3c000000,0x3ff1a122 + .long 0x97916e24,0xbe112012 + .long 0xba000000,0x3ff1a60e + .long 0xf6235d3b,0xbe361be1 + .long 0x14000000,0x3ff1aa03 + .long 0xefaa3b2e,0x3e33a9bc + .long 0x8a000000,0x3ff1aef9 + .long 0x95d61bf1,0xbe3045d7 + .long 0xec000000,0x3ff1b2f5 + .long 0xe5b6bd1c,0x3e1a939c + .long 0xea000000,0x3ff1b6f5 + .long 0x00756ed3,0x3e118b3c + .long 0x02000000,0x3ff1bbfb + .long 0x34057364,0xbe20e5cf + .long 0x30000000,0x3ff1c003 + .long 0x701907b3,0xbe0e1837 + .long 0x0c000000,0x3ff1c40f + .long 0x7c6221b9,0xbe282207 + .long 0x9a000000,0x3ff1c81e + .long 0x71d8c073,0xbe09f360 + .long 0x4a000000,0x3ff1cd37 + .long 0x436616b2,0xbe3261a0 + .long 0x40000000,0x3ff1d14f + .long 0xc7c5e4df,0x3df7af5c + .long 0xfe000000,0x3ff1d56a + .long 0x5ae36062,0xbdfc61a1 + .long 0x88000000,0x3ff1d98a + .long 0xed667c98,0x3e167fd8 + .long 0xe6000000,0x3ff1ddad + .long 0xa010e825,0xbe16ada9 + .long 0x1c000000,0x3ff1e1d5 + .long 0x012f4beb,0xbdbb777c + .long 0x92000000,0x3ff1e70b + .long 0xe05d5c18,0x3e275a5a + .long 0x88000000,0x3ff1eb3b + .long 0x87963143,0x3e1f6ec9 + .long 0x6c000000,0x3ff1ef6f + .long 0xc77f5502,0xbdf400a5 + .long 0x44000000,0x3ff1f3a7 + .long 0x83209a84,0xbe2057a6 + .long 0x14000000,0x3ff1f7e3 + .long 0xcdb4bd2e,0x3e3b8696 + .long 0xea000000,0x3ff1fc22 + .long 0x7dac9b38,0xbe29872a + .long 0xc4000000,0x3ff20066 + .long 0x7e34701c,0x3e22a9a1 + .long 0xae000000,0x3ff204ae + .long 0xae177d59,0x3e2257cd + .long 0x4c000000,0x3ff207e7 + .long 0x6fe6d0dd,0xbe119fb7 + .long 0x60000000,0x3ff20c36 + .long 0x22ab7e20,0xbe18a6a1 + .long 0x94000000,0x3ff21089 + .long 0xca9c3288,0x3e2c8440 + .long 0xf2000000,0x3ff214e0 + .long 0x8575ebf1,0x3e200f9a + .long 0x80000000,0x3ff2193c + .long 0x219c164a,0xbe2140a7 + .long 0x44000000,0x3ff21d9c + .long 0x2238e180,0xbe326ebd + .long 0x44000000,0x3ff22200 + .long 0x0f5fa626,0xbe084ae9 + .long 0x10000000,0x3ff2254e + .long 0x20e924cc,0x3e34737d + .long 0x90000000,0x3ff229b9 + .long 0x7241c459,0xbe233bae + .long 0x60000000,0x3ff22e29 + .long 0xecaa31e6,0xbe2cc059 + .long 0x14000000,0x3ff23180 + .long 0x7a5a0dea,0x3e2bcde5 + .long 0x84000000,0x3ff235f7 + .long 0x52b90575,0x3e333da0 + .long 0x5a000000,0x3ff23a73 + .long 0x1b60c92e,0x3e3a7d2b + .long 0x24000000,0x3ff23dd3 + .long 0xb235ec84,0x3df512e9 + .long 0xc0000000,0x3ff24256 + .long 0x1f3855f6,0xbe1a9d64 + .long 0xd6000000,0x3ff246de + .long 0xfe758c34,0x3e12b491 + .long 0xde000000,0x3ff24a47 + .long 0x607a2edb,0xbe320de4 + .long 0xde000000,0x3ff24ed7 + .long 0xbc58ecd4,0x3dd8f375 + .long 0xde000000,0x3ff25246 + .long 0xda99c7ed,0xbe1ee42e + .long 0xe2000000,0x3ff256de + .long 0x88f4f655,0xbe220405 + .long 0xec000000,0x3ff25a53 + .long 0xc2b1fe7f,0x3e0eec7d + .long 0x0c000000,0x3ff25ef4 + .long 0xb6841168,0xbe1523a2 + .long 0x34000000,0x3ff2626f + .long 0x7056af50,0x3e200ef9 + .long 0x8a000000,0x3ff26717 + .long 0x8197860c,0xbe3643a3 + .long 0xe2000000,0x3ff26a98 + .long 0x52183874,0x3e204b1a + .long 0x84000000,0x3ff26f49 + .long 0x89899f96,0x3e2ce41f + .long 0x22000000,0x3ff272d1 + .long 0x2eba11d7,0x3e33edcf + .long 0x2e000000,0x3ff2778a + .long 0x9b69a0ac,0xbdd15cbf + .long 0x26000000,0x3ff27b18 + .long 0x4c9cfc18,0xbe384c83 + .long 0xd8000000,0x3ff27ea8 + .long 0x00ebd8b6,0x3e32abcc + .long 0x16000000,0x3ff2836e + .long 0xf0c27bf5,0xbe334f0d + .long 0x3e000000,0x3ff28705 + .long 0x2c84c19b,0x3e19ba08 + .long 0x34000000,0x3ff28a9f + .long 0x765ba98f,0xbe351348 + .long 0xd6000000,0x3ff28f70 + .long 0x0bb50259,0x3e25fd61 + .long 0x5c000000,0x3ff29311 + .long 0x1f0ba391,0x3e36468e + .long 0xbc000000,0x3ff296b4 + .long 0x5eb0d555,0xbe1b4b50 + .long 0xf4000000,0x3ff29a5a + .long 0x1684aafd,0x3e322e1b + .long 0x10000000,0x3ff29f3d + .long 0x7f3902f7,0xbe1143a0 + .long 0x04000000,0x3ff2a2ea + .long 0x9d87f711,0xbe296bf0 + .long 0xe0000000,0x3ff2a699 + .long 0xd317cd41,0xbe267680 + .long 0xa8000000,0x3ff2aa4c + .long 0x895632cb,0x3de71246 + .long 0x60000000,0x3ff2ae02 + .long 0x70ae3e69,0x3e383f37 + .long 0x48000000,0x3ff2b2f9 + .long 0x183dd905,0x3e019525 + .long 0xee000000,0x3ff2b6b5 + .long 0xb11ed34f,0xbde2956c + .long 0x92000000,0x3ff2ba75 + .long 0xebcee2d4,0x3e139d57 + .long 0x3a000000,0x3ff2be38 + .long 0x25efe1d2,0xbe24080b + .long 0xe8000000,0x3ff2c1fd + .long 0xca843d11,0xbe22f3d1 + .long 0xa0000000,0x3ff2c5c6 + .long 0x27157d0b,0x3e25d6d0 + .long 0x6a000000,0x3ff2c992 + .long 0x47c03cbd,0xbe1f901f + .long 0x46000000,0x3ff2cd61 + .long 0xc7d41505,0x3e0c9c6b + .long 0x3a000000,0x3ff2d133 + .long 0x4c9cbf49,0x3e335b1a + .long 0x4e000000,0x3ff2d508 + .long 0xf0d67754,0xbe31f5cc + .long 0x80000000,0x3ff2d8e0 + .long 0x08d6ec2a,0xbe14dddd + .long 0xd8000000,0x3ff2dcbb + .long 0xd1a31600,0x3df4f684 + .long 0x5a000000,0x3ff2e09a + .long 0xe7cb28ec,0x3e23d67d + .long 0x0c000000,0x3ff2e47c + .long 0x64fad19f,0xbe0416e4 + .long 0xf0000000,0x3ff2e860 + .long 0xc1845328,0x3e15f191 + .long 0x0e000000,0x3ff2ec49 + .long 0x0e8212a2,0xbe3407e4 + .long 0x66000000,0x3ff2f034 + .long 0xa6af14fb,0xbe119cdf + .long 0x00000000,0x3ff2f423 + .long 0xdd2ff4b2,0xbdd785b8 + .long 0xe0000000,0x3ff2f814 + .long 0x3c8bc168,0x3e0f9d26 + .long 0x0c000000,0x3ff2fc0a + .long 0x7f285f7f,0xbe25e721 + .long 0x54000000,0x3ff2feaf + .long 0xe4707431,0xbde3d3dc + .long 0x06000000,0x3ff302aa + .long 0x54e59df9,0x3e1b2c8a + .long 0x12000000,0x3ff306a8 + .long 0x5bf8bf35,0xbe35f560 + .long 0x78000000,0x3ff30aa9 + .long 0x1bf7ce44,0xbe201d62 + .long 0x40000000,0x3ff30eae + .long 0x268d3880,0xbda201ac + .long 0x6e000000,0x3ff312b6 + .long 0x78463451,0x3e323ba0 + .long 0x74000000,0x3ff31568 + .long 0x431ff6b5,0x3e27f197 + .long 0x5c000000,0x3ff31976 + .long 0x1d86063e,0xbe3cd285 + .long 0xb4000000,0x3ff31d87 + .long 0xde58cb2b,0xbe038490 + .long 0x86000000,0x3ff3219c + .long 0x0d0ecee4,0x3e2b6d7a + .long 0x04000000,0x3ff32457 + .long 0x67a045ac,0x3e081609 + .long 0xae000000,0x3ff32871 + .long 0x218aae81,0xbe2e422a + .long 0xde000000,0x3ff32c8f + .long 0x77d29102,0xbe27b381 + .long 0xa0000000,0x3ff32f50 + .long 0x1b3eff6b,0x3e21691f + .long 0xbe000000,0x3ff33374 + .long 0xd026a2c6,0x3e04f8ad + .long 0x72000000,0x3ff3379c + .long 0x4d48535f,0xbe22ae68 + .long 0x94000000,0x3ff33a63 + .long 0x1f2825ca,0x3df10fe6 + .long 0x4c000000,0x3ff33e91 + .long 0x0279faec,0x3e2a71d3 + .long 0xaa000000,0x3ff342c2 + .long 0x78d2f376,0xbe04bba3 + .long 0x46000000,0x3ff34590 + .long 0x998a41e9,0xbe03e672 + .long 0xc0000000,0x3ff349c7 + .long 0x36ef8407,0x3e3019b2 + .long 0xee000000,0x3ff34e02 + .long 0x645bac29,0x3e35fca4 + .long 0x20000000,0x3ff350d7 + .long 0x07bfe20f,0xbe25ac45 + .long 0x86000000,0x3ff35518 + .long 0x5aa1ebf5,0xbe2e6547 + .long 0xe0000000,0x3ff357f0 + .long 0xee89ceb5,0xbe287b40 + .long 0x8c000000,0x3ff35c38 + .long 0xa4e8d2ef,0x3e17e02f + .long 0x1c000000,0x3ff35f15 + .long 0xd982cb35,0xbe1b64a3 + .long 0x22000000,0x3ff36363 + .long 0x51a0e2b8,0xbe398839 + .long 0xfc000000,0x3ff367b4 + .long 0x5db6b242,0xbe243ecf + .long 0x5c000000,0x3ff36a98 + .long 0x04aa635d,0x3e2322a4 + .long 0xaa000000,0x3ff36ef0 + .long 0xdffe6c15,0xbe09399e + .long 0x5e000000,0x3ff371d8 + .long 0x25a11d1c,0xbe330e55 + .long 0xce000000,0x3ff374c1 + .long 0x3129afdf,0xbe268d7b + .long 0x3e000000,0x3ff37923 + .long 0xb97189dc,0xbe26657a + .long 0x10000000,0x3ff37c11 + .long 0xea29a16b,0xbe1fb083 + .long 0x1c000000,0x3ff38079 + .long 0x95fa7d47,0xbe340007 + .long 0x5a000000,0x3ff3836b + .long 0x5dc9ac54,0x3e10d40e + .long 0x12000000,0x3ff387da + .long 0x5012ad99,0x3e10b74e + .long 0xca000000,0x3ff38ad0 + .long 0xf7bd2128,0x3e2b0108 + .long 0x40000000,0x3ff38f46 + .long 0x9cc0ea9d,0x3e35e485 + .long 0x7e000000,0x3ff39241 + .long 0x770980a5,0x3e2ea300 + .long 0x90000000,0x3ff3953e + .long 0xd4c7a782,0xbe344ce9 + .long 0x96000000,0x3ff399bd + .long 0x940f9584,0xbe33e2fe + .long 0x3a000000,0x3ff39cbf + .long 0x24087e1a,0x3e2194f5 + .long 0xba000000,0x3ff39fc2 + .long 0x89c83cca,0xbe231d00 + .long 0x72000000,0x3ff3a44b + .long 0x3f2ced31,0x3e307ed8 + .long 0x98000000,0x3ff3a753 + .long 0x3dad14f7,0x3e34644c + .long 0xa0000000,0x3ff3aa5d + .long 0x44bf6650,0xbe198a0f + .long 0x32000000,0x3ff3aef0 + .long 0x83ce161a,0xbe13523e + .long 0xf2000000,0x3ff3b1fe + .long 0x3e4fb0ba,0xbe2b016e + .long 0x98000000,0x3ff3b50f + .long 0x5a266eb9,0xbe00c90d + .long 0x28000000,0x3ff3b9ac + .long 0x5d6435a9,0x3df6946b + .long 0x9a000000,0x3ff3bcc1 + .long 0xb51ea777,0x3deb71b8 + .long 0xfa000000,0x3ff3bfd8 + .long 0xddbd1e72,0x3e23310e + .long 0x4c000000,0x3ff3c2f2 + .long 0x3b61a362,0xbe036033 + .long 0xee000000,0x3ff3c79b + .long 0xfc551ad6,0xbe125411 + .long 0x22000000,0x3ff3caba + .long 0xf4f97f1b,0x3df6c6c6 + .long 0x4e000000,0x3ff3cdda + .long 0x34b9c5a5,0x3e265154 + .long 0x76000000,0x3ff3d0fc + .long 0x63686af4,0xbe11e3d1 + .long 0x6a000000,0x3ff3d5b3 + .long 0x41549461,0x3e22cde8 + .long 0x8e000000,0x3ff3d8da + .long 0x77ad6645,0xbe270a08 + .long 0xb2000000,0x3ff3dc03 + .long 0x15410840,0x3e008be3 + .long 0xdc000000,0x3ff3df2e + .long 0xcbeff11b,0xbe23e35d + .long 0x0c000000,0x3ff3e25c + .long 0x4f6d956b,0xbe26e298 + .long 0x44000000,0x3ff3e58b + .long 0xccfac644,0x3dfe9b4c + .long 0xee000000,0x3ff3ea55 + .long 0x67939d69,0x3e31da2e + .long 0x48000000,0x3ff3ed8a + .long 0x801a7764,0x3e1351ce + .long 0xb4000000,0x3ff3f0c0 + .long 0x501a20c7,0xbe3857a0 + .long 0x30000000,0x3ff3f3f9 + .long 0x57940f51,0xbdd234a1 + .long 0xc4000000,0x3ff3f733 + .long 0x3f2233b4,0xbe2ac2d6 + .long 0x6e000000,0x3ff3fa70 + .long 0xedca8a34,0x3e18e528 + .long 0x34000000,0x3ff3fdaf + .long 0x08b5b935,0x3de3efe5 + .long 0x16000000,0x3ff400f0 + .long 0x3ba01202,0x3e204ec9 + .long 0x64000000,0x3ff405d5 + .long 0x619a3fdd,0x3e3888e9 + .long 0x9c000000,0x3ff4091b + .long 0x5d7bbc67,0xbe35c660 + .long 0xf4000000,0x3ff40c63 + .long 0x371a5b37,0x3e312962 + .long 0x78000000,0x3ff40fae + .long 0xfd4427e8,0xbe266865 + .long 0x24000000,0x3ff412fb + .long 0xe4fe1e06,0xbe095508 + .long 0xfe000000,0x3ff41649 + .long 0x7f425eed,0xbe2d87f6 + .long 0x04000000,0x3ff4199b + .long 0xed161ccb,0x3e3a37a5 + .long 0x40000000,0x3ff41cee + .long 0xf32e9c13,0x3dd0ac84 + .long 0xb0000000,0x3ff42043 + .long 0x6f5637aa,0xbe33e54f + .long 0x56000000,0x3ff4239b + .long 0xb5063313,0xbe393f2e + .long 0x34000000,0x3ff426f5 + .long 0xbfa6486b,0xbe1a1603 + .type __libm_cbrtl_table_256,@object + .size __libm_cbrtl_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ccos.S b/external/sgx_libm/ia32/ccos.S new file mode 100644 index 0000000000..c17b68ec18 --- /dev/null +++ b/external/sgx_libm/ia32/ccos.S @@ -0,0 +1,181 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccos.c" + .text +..TXTST0: +# -- Begin ccos + .text + .align 16,0x90 + .globl ccos +ccos: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + fldl 12(%ebp) + fldl 20(%ebp) + movzwl 26(%ebp), %ecx + andl $32752, %ecx + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 32(%esp) + cmpl $32752, %ecx + fstpl 16(%esp) + fstpl 24(%esp) + jl ..B1.4 +..B1.2: + testl $1048575, 24(%ebp) + jne ..B1.5 +..B1.3: + cmpl $0, 20(%ebp) + jne ..B1.5 +..B1.4: + movzbl 27(%ebp), %esi + notl %esi + movzbl 23(%esp), %edx + andl $128, %esi + andl $127, %edx + orl %esi, %edx + movb %dl, 23(%esp) +..B1.5: + addl $-32, %esp + movl 48(%esp), %ecx + lea 32(%esp), %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %esi, (%esp) + lea 4(%esp), %edx + movl %ecx, (%edx) + movl 20(%esi), %ecx + movl %ecx, 4(%edx) + movl 24(%esi), %ecx + movl %ecx, 8(%edx) + movl 28(%esi), %ecx + movl %ecx, 12(%edx) + call ccosh@PLT +..B1.10: + movl (%esi), %edx + addl $28, %esp + movl %edx, (%edi) + movl 4(%esi), %ecx + movl 8(%esi), %edx + movl 12(%esi), %esi + movl %ecx, 4(%edi) + movl %edx, 8(%edi) + movl %esi, 12(%edi) + movl 32(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.7 +..B1.6: + movl %edi, %eax + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.7: + call __stack_chk_fail@PLT + .align 16,0x90 + .type ccos,@function + .size ccos,.-ccos + .data +# -- End ccos + .text +# -- Begin ccosf + .text + .align 16,0x90 + .globl ccosf +ccosf: +# parameter 1: 32 + %esp +..B2.1: +..L3: + + pushl %ebx + subl $24, %esp + movzwl 38(%esp), %ecx + andl $32640, %ecx + movl 32(%esp), %eax + cmpl $32640, %ecx + movl 36(%esp), %edx + movl %eax, 20(%esp) + movl %edx, 16(%esp) + jl ..B2.3 +..B2.2: + testl $8388607, 36(%esp) + jne ..B2.4 +..B2.3: + movzbl 39(%esp), %eax + notl %eax + movzbl 19(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 19(%esp) +..B2.4: + addl $8, %esp + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + pushl 12(%esp) + pushl 12(%esp) + call ccoshf@PLT +..B2.7: + addl $24, %esp + popl %ebx + ret + .align 16,0x90 + .type ccosf,@function + .size ccosf,.-ccosf + .data +# -- End ccosf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ccosh.S b/external/sgx_libm/ia32/ccosh.S new file mode 100644 index 0000000000..258c30ebed --- /dev/null +++ b/external/sgx_libm/ia32/ccosh.S @@ -0,0 +1,468 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccosh.c" + .text +..TXTST0: +# -- Begin ccosh + .text + .align 16,0x90 + .globl ccosh +ccosh: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 88(%esp) + fstl 72(%esp) + fstpl 80(%esp) +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 18(%ebp), %esi + andl $32752, %esi + shrl $4, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %esi + jge ..B1.19 +..B1.4: + testl %esi, %esi + jle ..B1.55 +..B1.5: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + jge ..B1.20 +..B1.6: + testl %ecx, %ecx + jle ..B1.53 +..B1.7: + cmpl $1034, %esi + jl ..B1.11 +..B1.8: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fldl 20(%ebp) + fstl (%esp) + addl $-16, %esp + fstpl (%esp) + fstpl 24(%esp) + movl %ecx, 32(%esp) + call cos@PLT +..B1.69: + fldl 24(%esp) + fmul %st, %st(1) + fldl 12(%ebp) + movl 32(%esp), %ecx + addl $16, %esp + fmulp %st, %st(1) + testl %ecx, %ecx + fxch %st(1) + fstpl 72(%esp) + jle ..B1.10 +..B1.9: + addl $-16, %esp + fldl 16(%esp) + fstpl (%esp) + fstpl 24(%esp) + call sin@PLT +..B1.70: + fldl 24(%esp) + addl $16, %esp + fmulp %st, %st(1) + fstpl 80(%esp) + jmp ..B1.46 +..B1.10: + fmull (%esp) + fstpl 80(%esp) + jmp ..B1.46 +..B1.11: + movzwl 62(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.52 +..B1.12: + orl $-64768, %ecx + movw %cx, 60(%esp) +..B1.13: + fldcw 60(%esp) +..B1.14: + movl $1, 56(%esp) +..B1.15: + fldl 12(%ebp) + fstpl 48(%esp) + addl $-32, %esp + fldl 20(%ebp) + lea 32(%esp), %edx + lea 44(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + call sincosl@PLT +..B1.16: + fldl 80(%esp) + lea 56(%esp), %edx + lea 68(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + call sinhcoshl@PLT +..B1.72: + addl $32, %esp +..B1.17: + fldt 12(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fstpl 72(%esp) + fldt (%esp) + fldt 24(%esp) + fmulp %st, %st(1) + fstpl 80(%esp) + cmpl $0, 56(%esp) + je ..B1.46 +..B1.18: + fldcw 62(%esp) + jmp ..B1.46 +..B1.19: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx +..B1.20: + testl %ecx, %ecx + jne ..B1.27 +..B1.21: + testl $1048575, 24(%ebp) + jne ..B1.27 +..B1.22: + cmpl $0, 20(%ebp) + jne ..B1.27 +..B1.23: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call cosh@PLT +..B1.73: + fldl 20(%ebp) + addl $16, %esp + fstpl 80(%esp) + cmpl $2047, %esi + fstpl 72(%esp) + jl ..B1.26 +..B1.24: + testl $1048575, 16(%ebp) + jne ..B1.46 +..B1.25: + cmpl $0, 12(%ebp) + jne ..B1.46 +..B1.26: + movzbl 87(%esp), %esi + movl %esi, %edx + movzbl 19(%ebp), %ecx + andl $127, %edx + shrl $7, %esi + shrl $7, %ecx + xorl %ecx, %esi + shll $7, %esi + orl %esi, %edx + movb %dl, 87(%esp) + jmp ..B1.46 +..B1.27: + cmpl $2047, %ecx + jge ..B1.41 +..B1.28: + movl 16(%ebp), %edx + andl $1048575, %edx + testl %esi, %esi + jne ..B1.35 +..B1.29: + testl %edx, %edx + jne ..B1.40 +..B1.30: + cmpl $0, 12(%ebp) + jne ..B1.36 +..B1.31: + fldl 20(%ebp) + fstl 8(%esp) + addl $-16, %esp + fstpl (%esp) + movl %ecx, 32(%esp) + call cos@PLT +..B1.74: + fldl 12(%ebp) + movl 32(%esp), %ecx + addl $16, %esp + fxch %st(1) + fstpl 72(%esp) + testl %ecx, %ecx + jle ..B1.33 +..B1.32: + addl $-16, %esp + fldl 24(%esp) + fstpl (%esp) + fstpl 16(%esp) + call sin@PLT +..B1.75: + fldl 16(%esp) + addl $16, %esp + fmulp %st, %st(1) + jmp ..B1.34 +..B1.33: + fmull 8(%esp) +..B1.34: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstpl 80(%esp) + fsubl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fstpl 64(%esp) + jmp ..B1.46 +..B1.35: + testl %edx, %edx + jne ..B1.40 +..B1.81: + cmpl $0, 12(%ebp) +..B1.36: + jne ..B1.40 +..B1.37: + fldl 12(%ebp) + cmpl $1023, %ecx + fstl 24(%esp) + fmul %st(0), %st + fstpl 16(%esp) + jge ..B1.39 +..B1.38: + fldl 16(%esp) + fstpl 72(%esp) + fldl 24(%esp) + fmull 20(%ebp) + fstpl 80(%esp) + jmp ..B1.46 +..B1.39: + fldl 20(%ebp) + fstl 8(%esp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.77: + addl $16, %esp + fstpl (%esp) + addl $-16, %esp + fldl 24(%esp) + fstpl (%esp) + call cos@PLT +..B1.76: + addl $16, %esp + fldl 16(%esp) + fmulp %st, %st(1) + fstpl 72(%esp) + fldl 24(%esp) + fmull (%esp) + fstpl 80(%esp) + jmp ..B1.46 +..B1.40: + fldl 12(%ebp) + fmul %st(0), %st + fstl 72(%esp) + fstpl 80(%esp) + jmp ..B1.46 +..B1.41: + cmpl $2047, %esi + jge ..B1.43 +..B1.42: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call cos@PLT + jmp ..B1.79 +..B1.43: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call cosh@PLT +..B1.79: + addl $16, %esp + fstpl 72(%esp) +..B1.44: + testl %esi, %esi + jle ..B1.59 +..B1.45: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.80: + addl $16, %esp + fstpl 80(%esp) +..B1.46: + movzwl 86(%esp), %edx + testl $32752, %edx + jne ..B1.50 +..B1.47: + testl $1048575, 84(%esp) + jne ..B1.49 +..B1.48: + cmpl $0, 80(%esp) + je ..B1.50 +..B1.49: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 64(%esp) +..B1.50: + movl 72(%esp), %edx + movl %edx, (%edi) + movl 76(%esp), %ecx + movl 80(%esp), %esi + movl 84(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 88(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.58 +..B1.51: + movl %edi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.52: + movl $0, 56(%esp) + jmp ..B1.15 +..B1.53: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.54: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.20 +..B1.55: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.56: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.19 +..B1.58: + call __stack_chk_fail@PLT +..B1.59: + testl $1048575, 16(%ebp) + jne ..B1.45 +..B1.60: + cmpl $0, 12(%ebp) + jne ..B1.45 +..B1.61: + testl $1048575, 24(%ebp) + jne ..B1.66 +..B1.62: + cmpl $0, 20(%ebp) + jne ..B1.66 +..B1.63: + movzbl 19(%ebp), %ecx + movzbl 27(%ebp), %edx + andl $128, %ecx + andl $128, %edx + shrl $7, %ecx + shrl $7, %edx + cmpl %ecx, %edx + je ..B1.65 +..B1.64: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 80(%esp) + jmp ..B1.46 +..B1.65: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 80(%esp) + jmp ..B1.46 +..B1.66: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 80(%esp) + jmp ..B1.46 + .align 16,0x90 + .type ccosh,@function + .size ccosh,.-ccosh + .data +# -- End ccosh + .section .rodata, "a" + .align 16 + .align 16 +_DBL_MAX_NORMAL: + .long -1 + .long 2146435071 + .type _DBL_MAX_NORMAL,@object + .size _DBL_MAX_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NZERO: + .long 0 + .long -2147483648 + .type _DBL_NZERO,@object + .size _DBL_NZERO,8 + .space 8, 0x00 # pad + .align 16 +_DBL_PZERO: + .long 0 + .long 0 + .type _DBL_PZERO,@object + .size _DBL_PZERO,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ccoshf.S b/external/sgx_libm/ia32/ccoshf.S new file mode 100644 index 0000000000..fdc1d3bfc2 --- /dev/null +++ b/external/sgx_libm/ia32/ccoshf.S @@ -0,0 +1,410 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccoshf.c" + .text +..TXTST0: +# -- Begin ccoshf + .text + .align 16,0x90 + .globl ccoshf +ccoshf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + xorl %eax, %eax + movl %eax, 48(%esp) + movl %eax, 52(%esp) +..B1.2: + fnstcw 38(%esp) +..B1.3: + movzwl 10(%ebp), %esi + andl $32640, %esi + shrl $7, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %esi + jge ..B1.18 +..B1.4: + testl %esi, %esi + jle ..B1.47 +..B1.5: + movzwl 14(%ebp), %edi + andl $32640, %edi + shrl $7, %edi + cmpl $255, %edi + jge ..B1.19 +..B1.6: + testl %edi, %edi + jle ..B1.46 +..B1.7: + cmpl $138, %esi + jl ..B1.11 +..B1.8: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + flds 12(%ebp) + fsts 8(%esp) + addl $-16, %esp + fstps (%esp) + fstpl 16(%esp) + call cosf@PLT +..B1.57: + fldl 16(%esp) + addl $16, %esp + fmul %st, %st(1) + testl %edi, %edi + fxch %st(1) + fstps 48(%esp) + flds 8(%ebp) + fmulp %st, %st(1) + jle ..B1.10 +..B1.9: + addl $-16, %esp + flds 24(%esp) + fstps (%esp) + fstpl 16(%esp) + call sinf@PLT +..B1.58: + fldl 16(%esp) + addl $16, %esp + fmulp %st, %st(1) + fstps 52(%esp) + jmp ..B1.41 +..B1.10: + fmuls 8(%esp) + fstps 52(%esp) + jmp ..B1.41 +..B1.11: + movzwl 38(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.12: + orl $-64768, %edx + movw %dx, 36(%esp) +..B1.13: + fldcw 36(%esp) +..B1.14: + movl $1, %esi +..B1.15: + flds 8(%ebp) + fstps 32(%esp) + flds 12(%ebp) + fsts 24(%esp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.61: + addl $16, %esp + fstpl 16(%esp) + addl $-16, %esp + flds 40(%esp) + fstpl (%esp) + call cos@PLT +..B1.60: + addl $16, %esp + fstpl 24(%esp) + addl $-16, %esp + flds 48(%esp) + lea 16(%esp), %eax + lea 24(%esp), %edx + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + call sinhcosh@PLT +..B1.59: + addl $16, %esp +..B1.16: + fldl 24(%esp) + testl %esi, %esi + fmull 8(%esp) + fstps 48(%esp) + fldl 16(%esp) + fmull (%esp) + fstps 52(%esp) + je ..B1.41 +..B1.17: + fldcw 38(%esp) + jmp ..B1.41 +..B1.18: + movzwl 14(%ebp), %edi + andl $32640, %edi + shrl $7, %edi +..B1.19: + testl %edi, %edi + jne ..B1.24 +..B1.20: + testl $8388607, 12(%ebp) + jne ..B1.24 +..B1.21: + addl $-16, %esp + movl 8(%ebp), %eax + movl %eax, (%esp) + call coshf@PLT +..B1.62: + movl 12(%ebp), %eax + addl $16, %esp + fstps 48(%esp) + cmpl $255, %esi + movl %eax, 52(%esp) + jl ..B1.23 +..B1.22: + testl $8388607, 8(%ebp) + jne ..B1.41 +..B1.23: + movzbl 55(%esp), %edi + movl %edi, %eax + movzbl 11(%ebp), %esi + andl $127, %eax + shrl $7, %edi + shrl $7, %esi + xorl %esi, %edi + shll $7, %edi + orl %edi, %eax + movb %al, 55(%esp) + jmp ..B1.41 +..B1.24: + cmpl $255, %edi + jge ..B1.36 +..B1.25: + movl 8(%ebp), %eax + andl $8388607, %eax + testl %esi, %esi + jne ..B1.70 +..B1.26: + testl %eax, %eax + jne ..B1.31 +..B1.27: + flds 12(%ebp) + fsts 4(%esp) + addl $-16, %esp + fstps (%esp) + call cosf@PLT +..B1.63: + flds 8(%ebp) + addl $16, %esp + fxch %st(1) + fstps 48(%esp) + testl %edi, %edi + jle ..B1.29 +..B1.28: + addl $-16, %esp + flds 20(%esp) + fstps (%esp) + fstps 16(%esp) + call sinf@PLT +..B1.64: + flds 16(%esp) + addl $16, %esp + fmulp %st, %st(1) + jmp ..B1.30 +..B1.29: + fmuls 4(%esp) +..B1.30: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstps 52(%esp) + fsubl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fstpl 40(%esp) + jmp ..B1.41 +..B1.70: + testl %eax, %eax +..B1.31: + flds 8(%ebp) + jne ..B1.35 +..B1.32: + fld %st(0) + cmpl $127, %edi + fmul %st(1), %st + fstps 8(%esp) + jge ..B1.34 +..B1.33: + flds 8(%esp) + fstps 48(%esp) + fmuls 12(%ebp) + fstps 52(%esp) + jmp ..B1.41 +..B1.34: + addl $-16, %esp + movl 12(%ebp), %esi + movl %esi, (%esp) + fstps 20(%esp) + call sinf@PLT +..B1.66: + flds 20(%esp) + addl $16, %esp + fxch %st(1) + fstps (%esp) + addl $-16, %esp + movl %esi, (%esp) + fstps 20(%esp) + call cosf@PLT +..B1.65: + flds 20(%esp) + addl $16, %esp + flds 8(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstps 48(%esp) + fmuls (%esp) + fstps 52(%esp) + jmp ..B1.41 +..B1.35: + fmul %st(0), %st + fsts 48(%esp) + fstps 52(%esp) + jmp ..B1.41 +..B1.36: + cmpl $255, %esi + jge ..B1.38 +..B1.37: + addl $-16, %esp + movl 12(%ebp), %eax + movl %eax, (%esp) + call cosf@PLT + jmp ..B1.68 +..B1.38: + addl $-16, %esp + movl 8(%ebp), %eax + movl %eax, (%esp) + call coshf@PLT +..B1.68: + addl $16, %esp + fstps 48(%esp) +..B1.39: + testl %esi, %esi + jle ..B1.49 +..B1.40: + addl $-16, %esp + movl 12(%ebp), %eax + movl %eax, (%esp) + call sinf@PLT +..B1.69: + addl $16, %esp + fstps 52(%esp) +..B1.41: + movzwl 54(%esp), %eax + testl $32640, %eax + jne ..B1.44 +..B1.42: + testl $8388607, 52(%esp) + je ..B1.44 +..B1.43: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 40(%esp) +..B1.44: + movl 48(%esp), %eax + movl 52(%esp), %edx + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + xorl %esi, %esi + jmp ..B1.15 +..B1.46: + testl $8388607, 12(%ebp) + jne ..B1.7 + jmp ..B1.19 +..B1.47: + testl $8388607, 8(%ebp) + jne ..B1.5 + jmp ..B1.18 +..B1.49: + testl $8388607, 8(%ebp) + jne ..B1.40 +..B1.50: + testl $8388607, 12(%ebp) + jne ..B1.53 +..B1.51: + movzbl 11(%ebp), %edx + movzbl 15(%ebp), %eax + andl $128, %edx + andl $128, %eax + shrl $7, %edx + shrl $7, %eax + cmpl %edx, %eax + je ..B1.53 +..B1.52: + movl $-2147483648, 52(%esp) + jmp ..B1.41 +..B1.53: + movl $0, 52(%esp) + jmp ..B1.41 + .align 16,0x90 + .type ccoshf,@function + .size ccoshf,.-ccoshf + .data +# -- End ccoshf + .section .rodata, "a" + .align 16 + .align 16 +_DBL_MAX_NORMAL: + .long -1 + .long 2146435071 + .type _DBL_MAX_NORMAL,@object + .size _DBL_MAX_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .align 4 +.L_2il0floatpacket.6: + .long 0x80000000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ccoshl.S b/external/sgx_libm/ia32/ccoshl.S new file mode 100644 index 0000000000..208111211c --- /dev/null +++ b/external/sgx_libm/ia32/ccoshl.S @@ -0,0 +1,698 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccoshl.c" + .text +..TXTST0: +# -- Begin ccoshl + .text + .align 16,0x90 + .globl ccoshl +ccoshl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 244(%esp) + fstpt 112(%esp) + fldt 112(%esp) + fstpt 220(%esp) + fldt 220(%esp) + fstpt 232(%esp) +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 62(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.65 +..B1.4: + orl $-64768, %ecx + movw %cx, 60(%esp) +..B1.5: + fldcw 60(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.33 +..B1.8: + testl %ecx, %ecx + jle ..B1.60 +..B1.9: + movzwl 32(%ebp), %edx + andl $32767, %edx + movl %edx, 12(%esp) + cmpl $32767, %edx + jge ..B1.33 +..B1.10: + cmpl $0, 12(%esp) + jle ..B1.58 +..B1.11: + cmpl $16398, %ecx + jl ..B1.19 +..B1.12: + fldt _CONSTANTS@GOTOFF(%ebx) + fmul %st(0), %st + fldt 24(%ebp) + fstpt (%esp) + fldt (%esp) + addl $-16, %esp + fstpt (%esp) + fstpt 32(%esp) + call cosl@PLT +..B1.68: + fldt 32(%esp) + addl $16, %esp + fmul %st, %st(1) + fxch %st(1) + fstpt 220(%esp) + fldt 12(%ebp) + fmulp %st, %st(1) + cmpl $0, 12(%esp) + jle ..B1.14 +..B1.13: + addl $-16, %esp + fldt 16(%esp) + fstpt (%esp) + fstpt 32(%esp) + call sinl@PLT +..B1.69: + fldt 32(%esp) + addl $16, %esp + fmulp %st, %st(1) + jmp ..B1.15 +..B1.14: + fldt (%esp) + fmulp %st, %st(1) +..B1.15: + fstpt 232(%esp) + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 62(%esp) +..B1.17: + movl 220(%esp), %edx + movl %edx, (%esi) + movl 232(%esp), %edx + movl %edx, 12(%esi) + movl 236(%esp), %edx + movl %edx, 16(%esi) + movl 224(%esp), %ecx + movl 228(%esp), %edi + movl 240(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 244(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.57 +..B1.18: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.19: + fldt 12(%ebp) + addl $-16, %esp + lea 164(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + call __libm_coshl_k80 +..B1.70: + addl $16, %esp +..B1.20: + fldt 36+_CONSTANTS@GOTOFF(%ebx) + movzwl 20(%ebp), %ecx + fadd %st, %st(1) + fxch %st(1) + fstpt (%esp) + andl $32767, %ecx + fldt 148(%esp) + cmpl $16183, %ecx + fld %st(0) + fldt 160(%esp) + movl (%esp), %edx + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsub %st, %st(3) + movl %edx, 28(%esp) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fsub %st, %st(3) + fsubp %st, %st(3) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(3) + faddp %st, %st(2) + jge ..B1.22 +..B1.21: + fstp %st(2) + fldt 12(%ebp) + lea 184(%esp), %eax + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt -12(%eax) + fldt -72(%eax) + movzwl -4(%eax), %ecx + movl %ecx, %edx + andl $32767, %edx + andl $-32768, %ecx + addl $-16639, %edx + orl $-49153, %ecx + fstpt (%eax) + movl %edx, 44(%esp) + movw %cx, -4(%eax) + jmp ..B1.24 +..B1.22: + fldt 12(%ebp) + addl $-16, %esp + lea 188(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + fxch %st(2) + fstpt 16(%esp) + fstpt -124(%edx) + fstpt 48(%esp) + call __libm_sinhl_k80 +..B1.71: + fldt 48(%esp) + fldt 64(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.23: + faddp %st, %st(3) + fxch %st(2) + fstpt (%esp) + lea 184(%esp), %eax + movl (%esp), %edx + movl %edx, 44(%esp) + fxch %st(1) +..B1.24: + fldt 172(%esp) + fld %st(0) + fld %st(3) + fldt (%eax) + fadd %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsubr %st(1), %st + fsubrp %st, %st(1) + fstpt 64(%esp) + fldt 64(%esp) + addl $-16, %esp + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 24(%ebp) + fstpt (%esp) + lea 212(%esp), %edx + movl %edx, 12(%esp) + fxch %st(1) + fstpt 64(%esp) + fstpt -100(%edx) + fstpt 48(%esp) + call __libm_cosl_k80 +..B1.72: + fldt 48(%esp) + fxch %st(1) + fstpt 96(%esp) + fldt 112(%esp) + fldt 64(%esp) + addl $16, %esp +..B1.25: + fldt 196(%esp) + fld %st(0) + fldt 208(%esp) + movzwl 32(%ebp), %edx + fadd %st, %st(1) + fld %st(1) + andl $32767, %edx + cmpl $16183, %edx + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(5) + fmul %st(3), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 80(%esp) + fmul %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%esp) + fldt 12+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(1) + jge ..B1.27 +..B1.26: + fldt 24(%ebp) + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 124(%esp) + fldt 112(%esp) + movzwl 132(%esp), %ecx + movl %ecx, %edx + andl $-32768, %ecx + andl $32767, %edx + orl $-49153, %ecx + addl $-16639, %edx + movw %cx, 132(%esp) + fstpt 136(%esp) + fldt 124(%esp) + movl %edx, 12(%esp) + jmp ..B1.29 +..B1.27: + fldt 24(%ebp) + addl $-16, %esp + lea 140(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + fxch %st(1) + fstpt -76(%edx) + fstpt 16(%esp) + fstpt -28(%edx) + fstpt -92(%edx) + call __libm_sinl_k80 +..B1.73: + fldt 48(%esp) + fldt 112(%esp) + fldt 16(%esp) + fldt 64(%esp) + addl $16, %esp +..B1.28: + fldt 124(%esp) + fmul %st(5), %st + fstpt 124(%esp) + fldt 124(%esp) + fldt 136(%esp) + fmulp %st, %st(6) + fxch %st(5) + fstpt 112(%esp) + fldt 112(%esp) + fstpt 136(%esp) + movl $0, 12(%esp) + fxch %st(2) + fxch %st(3) + fxch %st(4) +..B1.29: + fldt 112(%esp) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(6) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fsubr %st(6), %st + fsubrp %st, %st(6) + fxch %st(1) + fsub %st(5), %st + faddp %st, %st(1) + fstpt (%esp) + fld %st(1) + fldt 16(%esp) + fld %st(0) + fmul %st(3), %st + fxch %st(4) + fmulp %st, %st(3) + fldt 80(%esp) + addl $-32, %esp + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl 60(%esp), %edx + movl %edx, 24(%esp) + fstpt 128(%esp) + fstpt 64(%esp) + call __libm_scalbl_k80 +..B1.74: + fldt 64(%esp) + fldt 128(%esp) + addl $32, %esp +..B1.30: + fldt 64(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(2) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(4) + fstpt 220(%esp) + fldt (%esp) + addl $-32, %esp + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl 76(%esp), %edx + addl 44(%esp), %edx + movl %edx, 24(%esp) + call __libm_scalbl_k80 +..B1.75: + addl $32, %esp +..B1.31: + fstpt 232(%esp) + jmp ..B1.53 +..B1.33: + movl 28(%ebp), %edx +..B1.34: + testl %edx, %edx + jne ..B1.40 +..B1.85: + cmpl $0, 24(%ebp) +..B1.35: + jne ..B1.40 +..B1.36: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + movl %ecx, 16(%esp) + call coshl@PLT +..B1.76: + fldt 24(%ebp) + movl 16(%esp), %ecx + addl $16, %esp + fstpt 232(%esp) + cmpl $32767, %ecx + fstpt 220(%esp) + jl ..B1.39 +..B1.37: + cmpl $-2147483648, 16(%ebp) + jne ..B1.53 +..B1.38: + cmpl $0, 12(%ebp) + jne ..B1.53 +..B1.39: + movzbl 241(%esp), %eax + movl %eax, %edx + movzbl 21(%ebp), %ecx + andl $127, %edx + shrl $7, %eax + shrl $7, %ecx + xorl %ecx, %eax + shll $7, %eax + orl %eax, %edx + movb %dl, 241(%esp) + jmp ..B1.53 +..B1.40: + movzwl 32(%ebp), %eax + andl $32767, %eax + movl %eax, 12(%esp) + cmpl $32767, %eax + jge ..B1.43 +..B1.41: + fldt 12(%ebp) + fstpt 32(%esp) + fldt 32(%esp) + addl $-16, %esp + fstpt (%esp) + call coshl@PLT +..B1.78: + fstpt 16(%esp) + addl $16, %esp + fldt 24(%ebp) + fstpt 16(%esp) + fldt 16(%esp) + addl $-16, %esp + fstpt (%esp) + call cosl@PLT +..B1.77: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpt 220(%esp) + cmpl $0, 12(%esp) + jle ..B1.63 +..B1.42: + addl $-16, %esp + fldt 48(%esp) + fstpt (%esp) + call sinhl@PLT +..B1.80: + fstpt 16(%esp) + fldt 32(%esp) + fstpt (%esp) + call sinl@PLT +..B1.79: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpt 232(%esp) + jmp ..B1.53 +..B1.43: + cmpl $32767, %ecx + jge ..B1.45 +..B1.44: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + movl %edx, 16(%esp) + call cosl@PLT + jmp ..B1.82 +..B1.45: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + movl %edx, 16(%esp) + call coshl@PLT +..B1.82: + movl 16(%esp), %edx + addl $16, %esp + fstpt 220(%esp) +..B1.46: + cmpl $0, 16(%ebp) + jne ..B1.48 +..B1.47: + cmpl $0, 12(%ebp) + je ..B1.49 +..B1.48: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + call sinl@PLT +..B1.83: + addl $16, %esp + fstpt 232(%esp) + jmp ..B1.53 +..B1.49: + cmpl $-2147483648, %edx + jne ..B1.52 +..B1.50: + cmpl $0, 24(%ebp) + jne ..B1.52 +..B1.51: + movzbl 21(%ebp), %ecx + fldz + movzbl 33(%ebp), %edx + andl $128, %ecx + andl $128, %edx + shrl $7, %ecx + shrl $7, %edx + xorl %edx, %ecx + fmull ones@GOTOFF(%ebx,%ecx,8) + fstpt 232(%esp) + jmp ..B1.53 +..B1.52: + fldt 112(%esp) + fstpt 232(%esp) +..B1.53: + testl %edi, %edi + je ..B1.55 +..B1.54: + fldcw 62(%esp) +..B1.55: + movl 220(%esp), %edx + movl %edx, (%esi) + movl 232(%esp), %edx + movl %edx, 12(%esi) + movl 236(%esp), %edx + movl %edx, 16(%esi) + movl 224(%esp), %ecx + movl 228(%esp), %edi + movl 240(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 244(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.57 +..B1.56: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.57: + call __stack_chk_fail@PLT +..B1.58: + movl 28(%ebp), %edx + testl %edx, %edx + jne ..B1.11 +..B1.59: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.35 +..B1.60: + cmpl $0, 16(%ebp) + jne ..B1.9 +..B1.61: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.33 +..B1.63: + addl $-16, %esp + fldt 48(%esp) + fstpt (%esp) + call sinhl@PLT +..B1.84: + addl $16, %esp + fldt 16(%esp) + fmulp %st, %st(1) + fstpt 232(%esp) + jmp ..B1.53 +..B1.65: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type ccoshl,@function + .size ccoshl,.-ccoshl + .data +# -- End ccoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,48 + .align 16 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .hidden __libm_sinl_k80 + .hidden __libm_cosl_k80 + .hidden __libm_sinhl_k80 + .hidden __libm_coshl_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ccosl.S b/external/sgx_libm/ia32/ccosl.S new file mode 100644 index 0000000000..fbbf3f444e --- /dev/null +++ b/external/sgx_libm/ia32/ccosl.S @@ -0,0 +1,183 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccosl.c" + .text +..TXTST0: +# -- Begin ccosl + .text + .align 16,0x90 + .globl ccosl +ccosl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + movl %edx, 76(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 40(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.16 +..B1.4: + orl $-64768, %ecx + movw %cx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %edi +..B1.7: + fldt 12(%ebp) + movzwl 32(%ebp), %edx + andl $32767, %edx + fstpt 40(%esp) + cmpl $32767, %edx + fldt 24(%ebp) + fstpt 28(%esp) + jl ..B1.10 +..B1.8: + cmpl $-2147483648, 28(%ebp) + jne ..B1.11 +..B1.9: + cmpl $0, 24(%ebp) + jne ..B1.11 +..B1.10: + movzbl 33(%ebp), %ecx + notl %ecx + movzbl 37(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 37(%esp) +..B1.11: + addl $-32, %esp + lea 84(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl -24(%ecx), %ecx + movl %ecx, (%edx) + movl 64(%esp), %ecx + movl %ecx, 4(%edx) + movl 68(%esp), %ecx + movl %ecx, 8(%edx) + movl 72(%esp), %ecx + movl %ecx, 12(%edx) + movl 76(%esp), %ecx + movl %ecx, 16(%edx) + movl 80(%esp), %ecx + movl %ecx, 20(%edx) + call ccoshl@PLT +..B1.19: + addl $28, %esp + fldt 52(%esp) + testl %edi, %edi + fstpt 4(%esp) + fldt 64(%esp) + fstpt 16(%esp) + je ..B1.13 +..B1.12: + fldcw 2(%esp) +..B1.13: + movl 4(%esp), %edx + movl %edx, (%esi) + movl 16(%esp), %edx + movl %edx, 12(%esi) + movl 20(%esp), %edx + movl %edx, 16(%esi) + movl 8(%esp), %ecx + movl 12(%esp), %edi + movl 24(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 76(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.15 +..B1.14: + movl %esi, %eax + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.15: + call __stack_chk_fail@PLT +..B1.16: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type ccosl,@function + .size ccosl,.-ccosl + .data +# -- End ccosl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ceil_wmt.S b/external/sgx_libm/ia32/ceil_wmt.S new file mode 100644 index 0000000000..98442a5cc8 --- /dev/null +++ b/external/sgx_libm/ia32/ceil_wmt.S @@ -0,0 +1,164 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ceil_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin ceil + .text + .align 16,0x90 + .globl ceil +ceil: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + call static_func + movl %eax, %edx + movsd 112(%esp), %xmm0 + pextrw $3, %xmm0, %eax + movl $32752, %ecx + andl %eax, %ecx + cmpl $17184, %ecx + ja .L_2TAG_PACKET_0.0.2 + je .L_2TAG_PACKET_1.0.2 + cmpl $16368, %ecx + jl .L_2TAG_PACKET_2.0.2 + movq (%edx), %xmm1 + addsd %xmm0, %xmm1 + subsd (%edx), %xmm1 + cmpnlesd %xmm1, %xmm0 + movd %xmm0, %eax + movsd %xmm1, 24(%esp) + fldl 24(%esp) + fadds 20(%edx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + pxor %xmm1, %xmm1 + cmpnltsd %xmm0, %xmm1 + movd %xmm1, %ecx + shrl $15, %eax + subl %eax, %ecx + flds 40(%edx,%ecx,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_1.0.2: + pextrw $0, %xmm0, %eax + andl $1, %eax + fldl 112(%esp) + fadds 48(%edx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + cmpl $32752, %ecx + fldl 112(%esp) + jae .L_2TAG_PACKET_4.0.2 + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + fldz + faddp +.L_2TAG_PACKET_3.0.2: + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type ceil,@function + .size ceil,.-ceil + .data +# -- End ceil + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 1065353216 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 1065353216 + .long 0 + .long 0 + .long 1056964608 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .type static_const_table,@object + .size static_const_table,128 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ceilf_gen.S b/external/sgx_libm/ia32/ceilf_gen.S new file mode 100644 index 0000000000..73bdfbe79c --- /dev/null +++ b/external/sgx_libm/ia32/ceilf_gen.S @@ -0,0 +1,140 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ceilf_gen.c" + .text +..TXTST0: +# -- Begin ceilf + .text + .align 16,0x90 + .globl ceilf +ceilf: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movzwl 18(%esp), %edx + andl $32640, %edx + shrl $7, %edx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $149, %edx + jge ..B1.11 +..B1.2: + cmpl $127, %edx + jl ..B1.7 +..B1.3: + flds .L_2il0floatpacket.0@GOTOFF(%eax) + flds 16(%esp) + fld %st(0) + fadd %st(2), %st + fstps (%esp) + flds (%esp) + fsubp %st, %st(2) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.6 +..B1.4: + fld1 + faddp %st, %st(1) +..B1.6: + addl $12, %esp + ret +..B1.7: + testl %edx, %edx + jne ..B1.10 +..B1.8: + testl $8388607, 16(%esp) + jne ..B1.10 +..B1.9: + flds 16(%esp) + addl $12, %esp + ret +..B1.10: + movzbl 19(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + movl 16(%esp), %edx + movl %edx, (%esp) + flds _pone_nzero@GOTOFF(%eax,%ecx,4) + addl $12, %esp + ret +..B1.11: + cmpl $150, %edx + jge ..B1.16 +..B1.12: + flds 16(%esp) + testb $1, 16(%esp) + je ..B1.15 +..B1.13: + fadds .L_2il0floatpacket.1@GOTOFF(%eax) +..B1.15: + addl $12, %esp + ret +..B1.16: + flds 16(%esp) + addl $12, %esp + ret + .align 16,0x90 + .type ceilf,@function + .size ceilf,.-ceilf + .data +# -- End ceilf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4b400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x3f000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_pone_nzero: + .long 1065353216 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ceill.S b/external/sgx_libm/ia32/ceill.S new file mode 100644 index 0000000000..312cf5ecf6 --- /dev/null +++ b/external/sgx_libm/ia32/ceill.S @@ -0,0 +1,247 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ceill.c" + .text +..TXTST0: +# -- Begin ceill + .text + .align 16,0x90 + .globl ceill +ceill: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $16445, %eax + jge ..B1.21 +..B1.4: + cmpl $16383, %eax + jl ..B1.15 +..B1.5: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.6: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %ecx +..B1.9: + fldt 8(%ebp) + fld %st(0) + fldl _TWO_63H@GOTOFF(%edx) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt (%esp) + fldt (%esp) + fcompp + fnstsw %ax + sahf + jae ..B1.12 + jp ..B1.12 +..B1.10: + fldt (%esp) + faddl _ones@GOTOFF(%edx) + fstpt (%esp) +..B1.12: + testl %ecx, %ecx + je ..B1.14 +..B1.13: + fldcw 14(%esp) +..B1.14: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.15: + testl %eax, %eax + jne ..B1.20 +..B1.16: + cmpl $0, 12(%ebp) + jne ..B1.19 +..B1.17: + cmpl $0, 8(%ebp) + jne ..B1.19 +..B1.18: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.19: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 16(%esp) +..B1.20: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _pone_nzero@GOTOFF(%edx,%eax,8) + movl %ebp, %esp + popl %ebp + ret +..B1.21: + cmpl $16446, %eax + jge ..B1.30 +..B1.22: + testb $1, 8(%ebp) + je ..B1.29 +..B1.23: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.24: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.25: + fldcw 12(%esp) +..B1.26: + fldt 8(%ebp) + faddl _halfs@GOTOFF(%edx) + fstpt (%esp) +..B1.27: + fldcw 14(%esp) +..B1.28: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.29: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.30: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.31: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.32: + fldcw 12(%esp) +..B1.33: + fldt 8(%ebp) + fmull _ones@GOTOFF(%edx) + fstpt (%esp) +..B1.34: + fldcw 14(%esp) +..B1.35: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.36: + xorl %ecx, %ecx + jmp ..B1.9 +..B1.37: + fldt 8(%ebp) + faddl _halfs@GOTOFF(%edx) + fstpt (%esp) + jmp ..B1.28 +..B1.38: + fldt 8(%ebp) + fmull _ones@GOTOFF(%edx) + fstpt (%esp) + jmp ..B1.35 + .align 16,0x90 + .type ceill,@function + .size ceill,.-ceill + .data +# -- End ceill + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_pone_nzero: + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,16 + .align 4 +_halfs: + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type _halfs,@object + .size _halfs,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cexp_gen.S b/external/sgx_libm/ia32/cexp_gen.S new file mode 100644 index 0000000000..34e0d3f9ce --- /dev/null +++ b/external/sgx_libm/ia32/cexp_gen.S @@ -0,0 +1,739 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cexp_gen.c" + .text +..TXTST0: +# -- Begin __libm_internal_cexp + .text + .align 16,0x90 + .hidden __libm_internal_cexp + .globl __libm_internal_cexp +__libm_internal_cexp: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 72(%esp) + fsts (%esp) + fstl 56(%esp) + fstpl 64(%esp) +..B1.2: + fnstcw 42(%esp) +..B1.3: + movzwl 18(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %edx + jge ..B1.18 +..B1.4: + testl %edx, %edx + jle ..B1.46 +..B1.5: + movzwl 26(%ebp), %edi + andl $32752, %edi + shrl $4, %edi + cmpl $2047, %edi + jge ..B1.19 +..B1.6: + testl %edi, %edi + jle ..B1.44 +..B1.7: + cmpl $1034, %edx + jl ..B1.11 +..B1.8: + fldl 20(%ebp) + movzbl 19(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + fstl 16(%esp) + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + fldt _BIG_SMALL@GOTOFF(%ebx,%edx) + fmul %st(0), %st + fstpt (%esp) + addl $-16, %esp + fstpt (%esp) + call cosl@PLT +..B1.56: + addl $16, %esp + fldt (%esp) + testl %edi, %edi + fmulp %st, %st(1) + fstpl 56(%esp) + jle ..B1.10 +..B1.9: + addl $-16, %esp + fldl 32(%esp) + fstpt (%esp) + call sinl@PLT +..B1.57: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpl 64(%esp) + jmp ..B1.34 +..B1.10: + fldl 16(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 64(%esp) + jmp ..B1.34 +..B1.11: + movzwl 42(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.43 +..B1.12: + orl $-64768, %ecx + movw %cx, 40(%esp) +..B1.13: + fldcw 40(%esp) +..B1.14: + movl $1, 36(%esp) +..B1.15: + fldl 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B1.59: + fldl 20(%ebp) + addl $-16, %esp + lea 32(%esp), %edx + lea 44(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + fstpt 24(%edx) + call sincosl@PLT +..B1.58: + fldt 56(%esp) + addl $32, %esp +..B1.16: + fldt 12(%esp) + fmul %st(1), %st + fstpl 56(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 64(%esp) + cmpl $0, 36(%esp) + je ..B1.34 +..B1.17: + fldcw 42(%esp) + jmp ..B1.34 +..B1.18: + movzwl 26(%ebp), %edi + andl $32752, %edi + shrl $4, %edi +..B1.19: + testl %edi, %edi + jne ..B1.23 +..B1.20: + testl $1048575, 24(%ebp) + jne ..B1.23 +..B1.21: + cmpl $0, 20(%ebp) + jne ..B1.23 +..B1.22: + fldl 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B1.60: + fldl 20(%ebp) + addl $16, %esp + fstpl 64(%esp) + fstpl 56(%esp) + jmp ..B1.34 +..B1.23: + cmpl $2047, %edi + jge ..B1.26 +..B1.24: + fldl 12(%ebp) + addl $-16, %esp + fstpt (%esp) + movl %edx, 28(%esp) + call expl@PLT +..B1.62: + fstpt 16(%esp) + fldl 20(%ebp) + movl 28(%esp), %edx + addl $16, %esp + fstl 16(%esp) + addl $-16, %esp + fstpt (%esp) + movl %edx, 28(%esp) + call cosl@PLT +..B1.61: + movl 28(%esp), %edx + addl $16, %esp + testl %edi, %edi + fldt (%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + jle ..B1.49 +..B1.25: + addl $-16, %esp + fldl 32(%esp) + fstpt (%esp) + call sinl@PLT +..B1.63: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpl 64(%esp) + jmp ..B1.34 +..B1.26: + cmpl $2047, %edx + jge ..B1.28 +..B1.27: + fldl 20(%ebp) + addl $-16, %esp + fstpt (%esp) + call sinl@PLT +..B1.64: + addl $16, %esp + fstl 56(%esp) + fstpl 64(%esp) + jmp ..B1.34 +..B1.28: + testl $1048575, 16(%ebp) + jne ..B1.30 +..B1.29: + cmpl $0, 12(%ebp) + je ..B1.31 +..B1.30: + fldl 12(%ebp) + fmul %st(0), %st + fstl 56(%esp) + fldl 20(%ebp) + fmulp %st, %st(1) + fstpl 64(%esp) + jmp ..B1.34 +..B1.31: + movzbl 19(%ebp), %edx + testl $128, %edx + je ..B1.33 +..B1.32: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 20(%ebp) + flds (%esp) + fstl 56(%esp) + fstpl 64(%esp) + jmp ..B1.34 +..B1.33: + fldl 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B1.66: + fldl 20(%ebp) + addl $16, %esp + fxch %st(1) + fstpl 56(%esp) + addl $-16, %esp + fstpt (%esp) + call sinl@PLT +..B1.65: + addl $16, %esp + fstpl 64(%esp) +..B1.34: + movzwl 62(%esp), %edx + testl $32752, %edx + jne ..B1.37 +..B1.35: + testl $1048575, 60(%esp) + jne ..B1.40 +..B1.36: + cmpl $0, 56(%esp) + jne ..B1.40 +..B1.37: + movzwl 70(%esp), %edx + testl $32752, %edx + jne ..B1.41 +..B1.38: + testl $1048575, 68(%esp) + jne ..B1.40 +..B1.39: + cmpl $0, 64(%esp) + je ..B1.41 +..B1.40: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 48(%esp) +..B1.41: + movl 56(%esp), %edx + movl %edx, (%esi) + movl 60(%esp), %ecx + movl 64(%esp), %edi + movl 68(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 72(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.53 +..B1.42: + movl %esi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.43: + movl $0, 36(%esp) + jmp ..B1.15 +..B1.44: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.45: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.19 +..B1.46: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.47: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.18 +..B1.49: + testl %edx, %edx + jne ..B1.52 +..B1.50: + testl $1048575, 16(%ebp) + jne ..B1.52 +..B1.51: + cmpl $0, 12(%ebp) + je ..B1.25 +..B1.52: + fldl 16(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 64(%esp) + jmp ..B1.34 +..B1.53: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __libm_internal_cexp,@function + .size __libm_internal_cexp,.-__libm_internal_cexp + .data +# -- End __libm_internal_cexp + .text +# -- Begin cexp + .text + .align 16,0x90 + .globl cexp +cexp: +# parameter 1: 12 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + fldz + fldl 12(%ebp) + fldl 20(%ebp) + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 80(%esp) + fstpl 72(%esp) + fstpl 64(%esp) + fsts (%esp) + fstl 48(%esp) + fstpl 56(%esp) +..B2.2: + fnstcw 38(%esp) +..B2.3: + movzwl 70(%esp), %esi + andl $32752, %esi + shrl $4, %esi + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + cmpl $2047, %esi + jge ..B2.18 +..B2.4: + testl %esi, %esi + jle ..B2.46 +..B2.5: + movzwl 78(%esp), %edi + andl $32752, %edi + shrl $4, %edi + cmpl $2047, %edi + jge ..B2.19 +..B2.6: + testl %edi, %edi + jle ..B2.44 +..B2.7: + cmpl $1034, %esi + jl ..B2.11 +..B2.8: + fldl 72(%esp) + movzbl 71(%esp), %edx + andl $128, %edx + shrl $7, %edx + fstl 16(%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _BIG_SMALL@GOTOFF(%ebx,%ecx) + fmul %st(0), %st + fstpt (%esp) + addl $-16, %esp + fstpt (%esp) + call cosl@PLT +..B2.56: + addl $16, %esp + fldt (%esp) + testl %edi, %edi + fmulp %st, %st(1) + fstpl 48(%esp) + jle ..B2.10 +..B2.9: + addl $-16, %esp + fldl 32(%esp) + fstpt (%esp) + call sinl@PLT +..B2.57: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + jmp ..B2.34 +..B2.10: + fldl 16(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + jmp ..B2.34 +..B2.11: + movzwl 38(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.43 +..B2.12: + orl $-64768, %edx + movw %dx, 36(%esp) +..B2.13: + fldcw 36(%esp) +..B2.14: + movl $1, %esi +..B2.15: + addl $-16, %esp + fldl 80(%esp) + fstpt (%esp) + call expl@PLT +..B2.59: + addl $-16, %esp + fldl 104(%esp) + lea 32(%esp), %eax + lea 44(%esp), %edx + fstpt (%esp) + movl %eax, 12(%esp) + movl %edx, 16(%esp) + fstpt 24(%eax) + call sincosl@PLT +..B2.58: + fldt 56(%esp) + addl $32, %esp +..B2.16: + fldt 12(%esp) + testl %esi, %esi + fmul %st(1), %st + fstpl 48(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + je ..B2.34 +..B2.17: + fldcw 38(%esp) + jmp ..B2.34 +..B2.18: + movzwl 78(%esp), %edi + andl $32752, %edi + shrl $4, %edi +..B2.19: + testl %edi, %edi + jne ..B2.23 +..B2.20: + testl $1048575, 76(%esp) + jne ..B2.23 +..B2.21: + cmpl $0, 72(%esp) + jne ..B2.23 +..B2.22: + addl $-16, %esp + fldl 80(%esp) + fstpt (%esp) + call expl@PLT +..B2.60: + addl $16, %esp + fldl 72(%esp) + fstpl 56(%esp) + fstpl 48(%esp) + jmp ..B2.34 +..B2.23: + cmpl $2047, %edi + jge ..B2.26 +..B2.24: + fldl 64(%esp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B2.62: + fstpt 16(%esp) + addl $16, %esp + fldl 72(%esp) + fstl 16(%esp) + addl $-16, %esp + fstpt (%esp) + call cosl@PLT +..B2.61: + addl $16, %esp + fldt (%esp) + testl %edi, %edi + fmulp %st, %st(1) + fstpl 48(%esp) + jle ..B2.49 +..B2.25: + addl $-16, %esp + fldl 32(%esp) + fstpt (%esp) + call sinl@PLT +..B2.63: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + jmp ..B2.34 +..B2.26: + cmpl $2047, %esi + jge ..B2.28 +..B2.27: + addl $-16, %esp + fldl 88(%esp) + fstpt (%esp) + call sinl@PLT +..B2.64: + addl $16, %esp + fstl 48(%esp) + fstpl 56(%esp) + jmp ..B2.34 +..B2.28: + testl $1048575, 68(%esp) + jne ..B2.30 +..B2.29: + cmpl $0, 64(%esp) + je ..B2.31 +..B2.30: + fldl 64(%esp) + fmul %st(0), %st + fstl 48(%esp) + fldl 72(%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + jmp ..B2.34 +..B2.31: + movzbl 71(%esp), %eax + testl $128, %eax + je ..B2.33 +..B2.32: + fldl 72(%esp) + fmul %st(0), %st + fstpl 72(%esp) + flds (%esp) + fstl 48(%esp) + fstpl 56(%esp) + jmp ..B2.34 +..B2.33: + addl $-16, %esp + fldl 80(%esp) + fstpt (%esp) + call expl@PLT +..B2.66: + addl $16, %esp + fstpl 48(%esp) + addl $-16, %esp + fldl 88(%esp) + fstpt (%esp) + call sinl@PLT +..B2.65: + addl $16, %esp + fstpl 56(%esp) +..B2.34: + movzwl 54(%esp), %eax + testl $32752, %eax + jne ..B2.37 +..B2.35: + testl $1048575, 52(%esp) + jne ..B2.40 +..B2.36: + cmpl $0, 48(%esp) + jne ..B2.40 +..B2.37: + movzwl 62(%esp), %eax + testl $32752, %eax + jne ..B2.41 +..B2.38: + testl $1048575, 60(%esp) + jne ..B2.40 +..B2.39: + cmpl $0, 56(%esp) + je ..B2.41 +..B2.40: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 40(%esp) +..B2.41: + fldl 48(%esp) + movl 8(%ebp), %eax + movl 52(%esp), %ecx + movl 48(%esp), %edx + movl 60(%esp), %edi + movl 56(%esp), %esi + fstp %st(0) + fldl 56(%esp) + fstp %st(0) + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl %esi, 8(%eax) + movl %edi, 12(%eax) + movl 80(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.53 +..B2.42: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B2.43: + xorl %esi, %esi + jmp ..B2.15 +..B2.44: + testl $1048575, 76(%esp) + jne ..B2.7 +..B2.45: + cmpl $0, 72(%esp) + jne ..B2.7 + jmp ..B2.19 +..B2.46: + testl $1048575, 68(%esp) + jne ..B2.5 +..B2.47: + cmpl $0, 64(%esp) + jne ..B2.5 + jmp ..B2.18 +..B2.49: + testl %esi, %esi + jne ..B2.52 +..B2.50: + testl $1048575, 68(%esp) + jne ..B2.52 +..B2.51: + cmpl $0, 64(%esp) + je ..B2.25 +..B2.52: + fldl 16(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 56(%esp) + jmp ..B2.34 +..B2.53: + call __stack_chk_fail@PLT + .align 16,0x90 + .type cexp,@function + .size cexp,.-cexp + .data +# -- End cexp + .section .rodata, "a" + .align 16 + .align 16 +_BIG_SMALL: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _BIG_SMALL,@object + .size _BIG_SMALL,24 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cexpf_gen.S b/external/sgx_libm/ia32/cexpf_gen.S new file mode 100644 index 0000000000..59cec37b81 --- /dev/null +++ b/external/sgx_libm/ia32/cexpf_gen.S @@ -0,0 +1,223 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cexpf_gen.c" + .text +..TXTST0: +# -- Begin __libm_internal_cexpf + .text + .align 16,0x90 + .hidden __libm_internal_cexpf + .globl __libm_internal_cexpf +__libm_internal_cexpf: +# parameter 1: 64 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $56, %esp + xorl %ecx, %ecx + flds 64(%esp) + flds 68(%esp) + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 44(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpl 36(%esp) + movl %ecx, 4(%esp) + movl %ecx, 8(%esp) + fstpl 28(%esp) + addl $-32, %esp + movl 60(%esp), %edx + lea 44(%esp), %eax + movl 20(%eax), %ecx + movl %eax, (%esp) + lea 4(%esp), %eax + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 68(%esp), %edx + movl 72(%esp), %ecx + movl %edx, 8(%eax) + movl %ecx, 12(%eax) + call cexp@PLT +..B1.11: + addl $28, %esp + fldl 12(%esp) + fsts 4(%esp) + fldl 20(%esp) + movzwl 6(%esp), %eax + testl $32640, %eax + fsts 8(%esp) + jne ..B1.3 +..B1.2: + testl $8388607, 4(%esp) + jne ..B1.5 +..B1.3: + movzwl 10(%esp), %eax + testl $32640, %eax + jne ..B1.6 +..B1.4: + testl $8388607, 8(%esp) + je ..B1.6 +..B1.5: + fstp %st(0) + fstp %st(0) + flds .L_2il0floatpacket.4@GOTOFF(%ebx) + fmul %st(0), %st + fstps (%esp) + flds 4(%esp) + flds 8(%esp) +..B1.6: + fxch %st(1) + fstps 4(%esp) + fstps 8(%esp) + movl 44(%esp), %ecx + xorl %esp, %ecx + movl 4(%esp), %eax + movl 8(%esp), %edx + cmpl %gs:20, %ecx + jne ..B1.8 +..B1.7: + addl $56, %esp + popl %ebx + ret +..B1.8: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __libm_internal_cexpf,@function + .size __libm_internal_cexpf,.-__libm_internal_cexpf + .data +# -- End __libm_internal_cexpf + .text +# -- Begin cexpf + .text + .align 16,0x90 + .globl cexpf +cexpf: +# parameter 1: 64 + %esp +..B2.1: +..L3: + + pushl %ebx + subl $56, %esp + xorl %ecx, %ecx + flds 64(%esp) + flds 68(%esp) + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 44(%esp) + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + fstpl 36(%esp) + movl %ecx, 4(%esp) + movl %ecx, 8(%esp) + fstpl 28(%esp) + addl $-32, %esp + movl 60(%esp), %edx + lea 44(%esp), %eax + movl 20(%eax), %ecx + movl %eax, (%esp) + lea 4(%esp), %eax + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 68(%esp), %edx + movl 72(%esp), %ecx + movl %edx, 8(%eax) + movl %ecx, 12(%eax) + call cexp@PLT +..B2.11: + addl $28, %esp + fldl 12(%esp) + fsts 4(%esp) + fldl 20(%esp) + movzwl 6(%esp), %eax + testl $32640, %eax + fsts 8(%esp) + jne ..B2.3 +..B2.2: + testl $8388607, 4(%esp) + jne ..B2.5 +..B2.3: + movzwl 10(%esp), %eax + testl $32640, %eax + jne ..B2.6 +..B2.4: + testl $8388607, 8(%esp) + je ..B2.6 +..B2.5: + fstp %st(0) + fstp %st(0) + flds .L_2il0floatpacket.4@GOTOFF(%ebx) + fmul %st(0), %st + fstps (%esp) + flds 4(%esp) + flds 8(%esp) +..B2.6: + fxch %st(1) + fstps 4(%esp) + fstps 8(%esp) + movl 44(%esp), %ecx + xorl %esp, %ecx + movl 4(%esp), %eax + movl 8(%esp), %edx + cmpl %gs:20, %ecx + jne ..B2.8 +..B2.7: + addl $56, %esp + popl %ebx + ret +..B2.8: + call __stack_chk_fail@PLT + .align 16,0x90 + .type cexpf,@function + .size cexpf,.-cexpf + .data +# -- End cexpf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.4: + .long 0x00800000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cexpl.S b/external/sgx_libm/ia32/cexpl.S new file mode 100644 index 0000000000..41bcd10d22 --- /dev/null +++ b/external/sgx_libm/ia32/cexpl.S @@ -0,0 +1,611 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cexpl.c" + .text +..TXTST0: +# -- Begin cexpl + .text + .align 16,0x90 + .globl cexpl +cexpl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + movl %edx, 228(%esp) + fstpt 96(%esp) + fldt 96(%esp) + fstpt 204(%esp) + fldt 204(%esp) + fstpt 216(%esp) +..B1.2: + fnstcw 46(%esp) +..B1.3: + movzwl 46(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.61 +..B1.4: + orl $-64768, %ecx + movw %cx, 44(%esp) +..B1.5: + fldcw 44(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.31 +..B1.8: + testl %edx, %edx + jle ..B1.54 +..B1.9: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.31 +..B1.10: + testl %ecx, %ecx + jle ..B1.52 +..B1.11: + fldt 12(%ebp) + lea 180(%esp), %ecx + fstpt (%ecx) + fldt -84(%ecx) + fstpt 12(%ecx) + addl $-16, %esp + lea 172(%esp), %edx + movl %edx, (%esp) + movl %ecx, 4(%esp) + call __libm_expl_k80 +..B1.64: + fstpt 96(%esp) + addl $16, %esp +..B1.12: + movzwl 164(%esp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.51 +..B1.13: + testl %edx, %edx + je ..B1.22 +..B1.14: + fldt 36+_CONSTANTS@GOTOFF(%ebx) + fldt 80(%esp) + faddp %st, %st(1) + fstpt (%esp) + fldt 156(%esp) + fld %st(0) + fldt 168(%esp) + movl (%esp), %edx + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsub %st, %st(3) + movl %edx, 28(%esp) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fmul %st, %st(2) + fld %st(2) + fsub %st(4), %st + fsubrp %st, %st(3) + fxch %st(2) + fstpt 32(%esp) + fldt 32(%esp) + addl $-16, %esp + fsubrp %st, %st(3) + faddp %st, %st(2) + fldt 24(%ebp) + fstpt (%esp) + lea 148(%esp), %ecx + movl %ecx, 12(%esp) + fstpt -84(%ecx) + fstpt -68(%ecx) + call __libm_cosl_k80 +..B1.65: + fldt 80(%esp) + fldt 64(%esp) + addl $16, %esp +..B1.15: + fldt 132(%esp) + fld %st(0) + fldt 144(%esp) + movzwl 32(%ebp), %edx + fadd %st, %st(1) + andl $32767, %edx + fxch %st(1) + fsub %st, %st(2) + cmpl $16183, %edx + fxch %st(2) + fsubrp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fld %st(0) + fsub %st(3), %st + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st(4), %st + fxch %st(1) + fmulp %st, %st(4) + fldt 12+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(1) + jge ..B1.17 +..B1.16: + fldt 24(%ebp) + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 108(%esp) + fldt 96(%esp) + movzwl 116(%esp), %ecx + movl %ecx, %edx + andl $-32768, %ecx + andl $32767, %edx + orl $-49153, %ecx + addl $-16639, %edx + movw %cx, 116(%esp) + fstpt 120(%esp) + fldt 108(%esp) + movl %edx, 12(%esp) + jmp ..B1.19 +..B1.17: + fldt 24(%ebp) + addl $-16, %esp + lea 124(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + fxch %st(3) + fstpt 16(%esp) + fxch %st(2) + fstpt -92(%edx) + fxch %st(1) + fstpt -60(%edx) + fstpt -44(%edx) + call __libm_sinl_k80 +..B1.66: + fldt 80(%esp) + fldt 64(%esp) + fldt 32(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.18: + fldt 108(%esp) + fmul %st(5), %st + fstpt 108(%esp) + fldt 108(%esp) + fldt 120(%esp) + fmulp %st, %st(6) + fxch %st(5) + fstpt 96(%esp) + fldt 96(%esp) + fstpt 120(%esp) + movl $0, 12(%esp) + fxch %st(4) +..B1.19: + fldt 96(%esp) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(4) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(3) + fsub %st(2), %st + fsubrp %st, %st(4) + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(5), %st + fldt 32(%esp) + addl $-32, %esp + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + fstpt (%esp) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fstpt 12(%esp) + movl 60(%esp), %edx + movl %edx, 24(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt 80(%esp) + fstpt 96(%esp) + call __libm_scalbl_k80 +..B1.67: + fldt 96(%esp) + fldt 80(%esp) + fldt 32(%esp) + addl $32, %esp +..B1.20: + fxch %st(3) + fstpt 204(%esp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(2) + fldt 32(%esp) + addl $-32, %esp + fld %st(0) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%esp) + movl 60(%esp), %edx + addl 44(%esp), %edx + movl %edx, 24(%esp) + call __libm_scalbl_k80 +..B1.68: + addl $32, %esp +..B1.21: + fstpt 216(%esp) + jmp ..B1.46 +..B1.22: + fldt 12+_CONSTANTS@GOTOFF(%ebx) + fmul %st(0), %st + fstpt 16(%esp) +..B1.23: + fldt 16(%esp) + fstpt 156(%esp) + fldt 24(%ebp) + fstpt (%esp) + fldt (%esp) + addl $-16, %esp + fstpt (%esp) + call cosl@PLT +..B1.69: + addl $16, %esp + fldt 16(%esp) + fmulp %st, %st(1) + movzwl 32(%ebp), %edx + testl $32767, %edx + fstpt 204(%esp) + jle ..B1.25 +..B1.24: + addl $-16, %esp + fldt 16(%esp) + fstpt (%esp) + call sinl@PLT +..B1.70: + addl $16, %esp + fldt 16(%esp) + fmulp %st, %st(1) + fstpt 216(%esp) + jmp ..B1.26 +..B1.25: + fldt (%esp) + fldt 16(%esp) + fmulp %st, %st(1) + fstpt 216(%esp) +..B1.26: + testl %edi, %edi + je ..B1.28 +..B1.27: + fldt 80(%esp) + fstpt (%esp) +..B1.71: + fldcw 46(%esp) +..B1.28: + movl 204(%esp), %edx + movl %edx, (%esi) + movl 216(%esp), %edx + movl %edx, 12(%esi) + movl 220(%esp), %edx + movl %edx, 16(%esi) + movl 208(%esp), %ecx + movl 212(%esp), %edi + movl 224(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 228(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.50 +..B1.29: + movl %esi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.31: + movl 28(%ebp), %ecx +..B1.32: + testl %ecx, %ecx + jne ..B1.35 +..B1.79: + cmpl $0, 24(%ebp) +..B1.33: + jne ..B1.35 +..B1.34: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B1.72: + fldt 24(%ebp) + addl $16, %esp + fstpt 216(%esp) + fstpt 204(%esp) + jmp ..B1.46 +..B1.35: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + movl %ecx, 12(%esp) + cmpl $32767, %ecx + jge ..B1.38 +..B1.36: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B1.74: + fldt 24(%ebp) + fxch %st(1) + fstpt 16(%esp) + fstpt (%esp) + fldt (%esp) + fstpt 32(%esp) + call cosl@PLT +..B1.73: + fldt 32(%esp) + addl $16, %esp + fldt (%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 204(%esp) + cmpl $0, 12(%esp) + jle ..B1.57 +..B1.37: + addl $-16, %esp + fstpt (%esp) + call sinl@PLT +..B1.75: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpt 216(%esp) + jmp ..B1.46 +..B1.38: + cmpl $32767, %edx + jge ..B1.40 +..B1.39: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + call sinl@PLT +..B1.76: + addl $16, %esp + fstpt 204(%esp) + fldt 204(%esp) + fstpt 216(%esp) + jmp ..B1.46 +..B1.40: + cmpl $-2147483648, 16(%ebp) + jne ..B1.42 +..B1.41: + cmpl $0, 12(%ebp) + je ..B1.43 +..B1.42: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 204(%esp) + fldt 204(%esp) + fldt 24(%ebp) + fmulp %st, %st(1) + fstpt 216(%esp) + jmp ..B1.46 +..B1.43: + movzbl 21(%ebp), %edx + testl $128, %edx + je ..B1.45 +..B1.44: + fldt 24(%ebp) + fmul %st(0), %st + fstpt 24(%ebp) + fldt 96(%esp) + fstpt 204(%esp) + fldt 204(%esp) + fstpt 216(%esp) + jmp ..B1.46 +..B1.45: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call expl@PLT +..B1.78: + fldt 24(%ebp) + addl $16, %esp + fxch %st(1) + fstpt 204(%esp) + addl $-16, %esp + fstpt (%esp) + call sinl@PLT +..B1.77: + addl $16, %esp + fstpt 216(%esp) +..B1.46: + testl %edi, %edi + je ..B1.48 +..B1.47: + fldcw 46(%esp) +..B1.48: + movl 204(%esp), %edx + movl %edx, (%esi) + movl 216(%esp), %edx + movl %edx, 12(%esi) + movl 220(%esp), %edx + movl %edx, 16(%esi) + movl 208(%esp), %ecx + movl 212(%esp), %edi + movl 224(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 228(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.50 +..B1.49: + movl %esi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.50: + call __stack_chk_fail@PLT +..B1.51: + fldt _CONSTANTS@GOTOFF(%ebx) + fmul %st(0), %st + fstpt 16(%esp) + jmp ..B1.23 +..B1.52: + cmpl $0, 28(%ebp) + jne ..B1.11 +..B1.53: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.33 +..B1.54: + cmpl $0, 16(%ebp) + jne ..B1.9 +..B1.55: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.31 +..B1.57: + cmpl $0, 16(%ebp) + jne ..B1.59 +..B1.58: + cmpl $0, 12(%ebp) + je ..B1.37 +..B1.59: + fldt (%esp) + fmulp %st, %st(1) + fstpt 216(%esp) + jmp ..B1.46 +..B1.61: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type cexpl,@function + .size cexpl,.-cexpl + .data +# -- End cexpl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,48 + .data + .hidden __libm_cosl_k80 + .hidden __libm_sinl_k80 + .hidden __libm_expl_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cimag.S b/external/sgx_libm/ia32/cimag.S new file mode 100644 index 0000000000..6472dcce03 --- /dev/null +++ b/external/sgx_libm/ia32/cimag.S @@ -0,0 +1,58 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cimag.c" + .text +..TXTST0: +# -- Begin cimag + .text + .align 16,0x90 + .globl cimag +cimag: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + fldl 12(%esp) + ret + .align 16,0x90 + .type cimag,@function + .size cimag,.-cimag + .data +# -- End cimag + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cimagf.S b/external/sgx_libm/ia32/cimagf.S new file mode 100644 index 0000000000..9ab930d96a --- /dev/null +++ b/external/sgx_libm/ia32/cimagf.S @@ -0,0 +1,58 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cimagf.c" + .text +..TXTST0: +# -- Begin cimagf + .text + .align 16,0x90 + .globl cimagf +cimagf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + flds 8(%esp) + ret + .align 16,0x90 + .type cimagf,@function + .size cimagf,.-cimagf + .data +# -- End cimagf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cimagl.S b/external/sgx_libm/ia32/cimagl.S new file mode 100644 index 0000000000..aeb0c31d74 --- /dev/null +++ b/external/sgx_libm/ia32/cimagl.S @@ -0,0 +1,58 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cimagl.c" + .text +..TXTST0: +# -- Begin cimagl + .text + .align 16,0x90 + .globl cimagl +cimagl: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + fldt 16(%esp) + ret + .align 16,0x90 + .type cimagl,@function + .size cimagl,.-cimagl + .data +# -- End cimagl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/clog10.S b/external/sgx_libm/ia32/clog10.S new file mode 100644 index 0000000000..3832ba4422 --- /dev/null +++ b/external/sgx_libm/ia32/clog10.S @@ -0,0 +1,716 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clog10.c" + .text +..TXTST0: +# -- Begin clog10f + .text + .align 16,0x90 + .globl clog10f +clog10f: +# parameter 1: 64 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $56, %esp + flds 64(%esp) + flds 68(%esp) + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 40(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpl 32(%esp) + fstpl 24(%esp) + addl $-32, %esp + movl 56(%esp), %edx + lea 40(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %eax + movl 20(%ecx), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 64(%esp), %edx + movl 68(%esp), %ecx + movl %edx, 8(%eax) + movl %ecx, 12(%eax) + call clog10@PLT +..B1.7: + addl $28, %esp +..B1.2: + fldl 8(%esp) + fstps (%esp) + fldl 16(%esp) + fstps 4(%esp) + movl 40(%esp), %ecx + xorl %esp, %ecx + movl (%esp), %eax + movl 4(%esp), %edx + cmpl %gs:20, %ecx + jne ..B1.4 +..B1.3: + addl $56, %esp + popl %ebx + ret +..B1.4: + call __stack_chk_fail@PLT + .align 16,0x90 + .type clog10f,@function + .size clog10f,.-clog10f + .data +# -- End clog10f + .text +# -- Begin clog10 + .text + .align 16,0x90 + .globl clog10 +clog10: +# parameter 1: 12 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 176(%esp) + fstl 160(%esp) + fstpl 168(%esp) +..B2.2: + fnstcw 150(%esp) +..B2.3: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnan +..B2.67: + addl $16, %esp +..B2.4: + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + testl %eax, %eax + jne ..B2.15 +..B2.5: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnan +..B2.68: + addl $16, %esp +..B2.6: + testl %eax, %eax + jne ..B2.15 +..B2.7: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isinf +..B2.69: + addl $16, %esp +..B2.8: + testl %eax, %eax + jne ..B2.15 +..B2.9: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isinf +..B2.70: + addl $16, %esp +..B2.10: + testl %eax, %eax + jne ..B2.15 +..B2.11: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_iszero +..B2.71: + addl $16, %esp +..B2.12: + testl %eax, %eax + je ..B2.45 +..B2.13: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_iszero +..B2.72: + addl $16, %esp +..B2.14: + testl %eax, %eax + je ..B2.45 +..B2.15: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnan +..B2.73: + addl $16, %esp +..B2.16: + testl %eax, %eax + je ..B2.21 +..B2.17: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isinf +..B2.74: + addl $16, %esp +..B2.18: + testl %eax, %eax + je ..B2.20 +..B2.19: + fldl 20(%ebp) + fmul %st(0), %st + fstpl 160(%esp) + fldl 12(%ebp) + fmul %st(0), %st + fstpl 168(%esp) + jmp ..B2.60 +..B2.20: + fldl 12(%ebp) + fmull 20(%ebp) + fstl 160(%esp) + fstpl 168(%esp) + jmp ..B2.60 +..B2.21: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnan +..B2.75: + addl $16, %esp +..B2.22: + testl %eax, %eax + je ..B2.28 +..B2.23: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isinf +..B2.76: + addl $16, %esp +..B2.24: + testl %eax, %eax + je ..B2.26 +..B2.25: + fldl 12(%ebp) + fmul %st(0), %st + fstpl 160(%esp) + fldl 20(%ebp) + fmul %st(0), %st + jmp ..B2.27 +..B2.26: + fldl 20(%ebp) + fmul %st(0), %st + fstl 160(%esp) +..B2.27: + fstpl 168(%esp) + jmp ..B2.60 +..B2.28: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isinf +..B2.77: + addl $16, %esp +..B2.29: + testl %eax, %eax + je ..B2.35 +..B2.30: + fldl 12(%ebp) + fld1 + fsts 12(%esp) + addl $-16, %esp + fstpl (%esp) + fstl 8(%esp) + fstpl 16(%esp) + call copysign@PLT +..B2.78: + fldl 16(%esp) + fmul %st, %st(1) + addl $16, %esp + fldl 20(%ebp) + fld %st(0) + fmul %st(1), %st + faddp %st, %st(3) + fxch %st(2) + fstpl 160(%esp) + fldt CLOG10RECA@GOTOFF(%ebx) + fldl NEGINFA@GOTOFF(%ebx) + fucomp %st(2) + fnstsw %ax + sahf + jp ..B2.31 + je ..B2.62 +..B2.31: + fldl POSINFA@GOTOFF(%ebx) + fucomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jne ..B2.34 + jp ..B2.34 +..B2.33: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(1) +..B2.34: + addl $-16, %esp + flds 28(%esp) + fstpl (%esp) + fxch %st(1) + fstpl 8(%esp) + fstpt 16(%esp) + call copysign@PLT +..B2.79: + fldt 16(%esp) + addl $16, %esp + fmulp %st, %st(1) + fstpl 168(%esp) + jmp ..B2.60 +..B2.35: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isinf +..B2.80: + addl $16, %esp +..B2.36: + testl %eax, %eax + je ..B2.41 +..B2.37: + fldl 12(%ebp) + fldl POSINFA@GOTOFF(%ebx) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.38 + je ..B2.39 +..B2.38: + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fldt CLOG10RECA@GOTOFF(%ebx) + fmulp %st, %st(1) + jmp ..B2.40 +..B2.39: + fldl ZEROA@GOTOFF(%ebx) +..B2.40: + fldl 20(%ebp) + fxch %st(2) + fmul %st(0), %st + fadd %st(2), %st + fstpl 160(%esp) + fstl 168(%esp) + addl $-16, %esp + fstpl (%esp) + fstpl 8(%esp) + call copysign@PLT +..B2.81: + addl $16, %esp + fstpl 168(%esp) + jmp ..B2.60 +..B2.41: + fldl .L_2il0floatpacket.2@GOTOFF(%ebx) + fdivl ZEROA@GOTOFF(%ebx) + fstpl 160(%esp) + addl $-16, %esp + fldl 12(%ebp) + fstpl (%esp) + call __libm_internal_isnegzero +..B2.82: + addl $16, %esp +..B2.42: + testl %eax, %eax + je ..B2.44 +..B2.43: + fldl 20(%ebp) + addl $-16, %esp + fld1 + fstpl (%esp) + fstpl 8(%esp) + call copysign@PLT +..B2.83: + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fldt CLOG10RECA@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fmulp %st, %st(1) + fstpl 168(%esp) + jmp ..B2.60 +..B2.44: + fldl 20(%ebp) + fstpl 168(%esp) + jmp ..B2.60 +..B2.45: + movzwl 150(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B2.64 +..B2.46: + orl $-64768, %ecx + movw %cx, 148(%esp) +..B2.47: + fldcw 148(%esp) +..B2.48: + movl $1, %edi +..B2.49: + fldl 12(%ebp) + fld %st(0) + fabs + fldl 20(%ebp) + fld %st(0) + fabs + fcom %st(2) + fnstsw %ax + sahf + jae ..B2.51 + jp ..B2.51 +..B2.50: + fld %st(2) + jmp ..B2.52 +..B2.51: + fld %st(0) +..B2.52: + fxch %st(1) + fcom %st(3) + fnstsw %ax + sahf + jbe ..B2.54 +..B2.53: + fstp %st(0) + jmp ..B2.55 +..B2.54: + fstp %st(3) +..B2.55: + fld %st(0) + fmul %st(1), %st + fld %st(0) + fld %st(4) + fmul %st(5), %st + fadd %st, %st(1) + fld1 + fsubr %st(2), %st + fabs + fcompl .L_2il0floatpacket.4@GOTOFF(%ebx) + fnstsw %ax + sahf + jbe ..B2.57 +..B2.56: + fstp %st(5) + fstp %st(2) + fstp %st(3) + fstp %st(2) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fstpl 16(%esp) + fstpl 168(%esp) + call logl@PLT +..B2.84: + fldl 168(%esp) + fldl 16(%esp) + addl $16, %esp + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(3) + jmp ..B2.58 +..B2.57: + fstp %st(4) + fstp %st(5) + fstp %st(4) + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + fld %st(1) + fmulp %st, %st(1) + fxch %st(4) + fstpt 16(%esp) + fxch %st(3) + fstpt 28(%esp) + fxch %st(1) + fstpt (%esp) + fldt 28(%esp) + fldt 28(%esp) + fsub %st(3), %st + fsubrp %st, %st(1) + fstpt 40(%esp) + fldt 40(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 52(%esp) + fldt 40(%esp) + fldt 40(%esp) + fmulp %st, %st(1) + fldt 16(%esp) + fsubrp %st, %st(1) + fldt 52(%esp) + fldt 40(%esp) + fldt 52(%esp) + fldt 52(%esp) + fmulp %st, %st(1) + fldt (%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fstpt 64(%esp) + fxch %st(2) + fstpt 76(%esp) + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + fmul %st(2), %st + fstpt 28(%esp) + fldt 28(%esp) + fldt 28(%esp) + fsub %st(3), %st + fsubrp %st, %st(1) + fstpt 88(%esp) + fldt 88(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 100(%esp) + fldt 88(%esp) + fldt 88(%esp) + fmulp %st, %st(1) + fldt 76(%esp) + fsubrp %st, %st(1) + fldt 100(%esp) + fmulp %st, %st(2) + fldt 88(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 100(%esp) + fldt 100(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 112(%esp) + fldt 16(%esp) + fldt 76(%esp) + faddp %st, %st(1) + fstpt 124(%esp) + fldt 124(%esp) + fldt 16(%esp) + fsubrp %st, %st(1) + fstpt 136(%esp) + fldt 16(%esp) + fldt 124(%esp) + fldt 136(%esp) + fsubrp %st, %st(1) + fsubrp %st, %st(1) + fldt 76(%esp) + fldt 136(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 136(%esp) + fldt 124(%esp) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fsubrp %st, %st(1) + fstpt 124(%esp) + fldt 124(%esp) + fldt 136(%esp) + fldt 64(%esp) + faddp %st, %st(1) + fldt 112(%esp) + addl $-16, %esp + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + call log1pl@PLT +..B2.85: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fldl 12(%ebp) + fldl 20(%ebp) +..B2.58: + fldt INVLN10A@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + fstpl 160(%esp) + fxch %st(2) + fstpt (%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT +..B2.86: + addl $32, %esp + fldt (%esp) + testl %edi, %edi + fmulp %st, %st(1) + fstpl 168(%esp) + je ..B2.60 +..B2.59: + fldcw 150(%esp) +..B2.60: + movl 160(%esp), %edx + movl %edx, (%esi) + movl 164(%esp), %ecx + movl 168(%esp), %edi + movl 172(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 176(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.63 +..B2.61: + movl %esi, %eax + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B2.62: + fstp %st(1) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fmulp %st, %st(1) + jmp ..B2.34 +..B2.63: + call __stack_chk_fail@PLT +..B2.64: + xorl %edi, %edi + jmp ..B2.49 + .align 16,0x90 + .type clog10,@function + .size clog10,.-clog10 + .data +# -- End clog10 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +CLOG10RECA: + .long 2547844487 + .long 2929975909 + .long 16382 + .long 0 + .type CLOG10RECA,@object + .size CLOG10RECA,16 + .align 16 +NEGINFA: + .long 0 + .long 4293918720 + .type NEGINFA,@object + .size NEGINFA,8 + .space 8, 0x00 # pad + .align 16 +POSINFA: + .long 0 + .long 2146435072 + .type POSINFA,@object + .size POSINFA,8 + .space 8, 0x00 # pad + .align 16 +ZEROA: + .long 0 + .long 0 + .type ZEROA,@object + .size ZEROA,8 + .space 8, 0x00 # pad + .align 16 +INVLN10A: + .long 925397397 + .long 3730561193 + .long 16381 + .long 0 + .type INVLN10A,@object + .size INVLN10A,16 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xeb851eb8,0x3f9eb851 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .data + .hidden __libm_internal_isnegzero + .hidden __libm_internal_iszero + .hidden __libm_internal_isnan + .hidden __libm_internal_isinf + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/clog10l.S b/external/sgx_libm/ia32/clog10l.S new file mode 100644 index 0000000000..089f09f5b8 --- /dev/null +++ b/external/sgx_libm/ia32/clog10l.S @@ -0,0 +1,975 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clog10l.c" + .text +..TXTST0: +# -- Begin clog10l + .text + .align 16,0x90 + .globl clog10l +clog10l: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 224(%esp) + fstpt 80(%esp) + fldt 80(%esp) + fstpt 200(%esp) + fldt 200(%esp) + fstpt 212(%esp) +..B1.2: + fnstcw 46(%esp) +..B1.3: + movzwl 46(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.77 +..B1.4: + orl $-64768, %ecx + movw %cx, 44(%esp) +..B1.5: + fldcw 44(%esp) +..B1.6: + movl $1, %esi +..B1.7: + movzwl 20(%ebp), %ecx + andl $32767, %ecx + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %ecx + jge ..B1.46 +..B1.8: + cmpl $32767, %edx + jge ..B1.85 +..B1.9: + testl %ecx, %ecx + jne ..B1.15 +..B1.10: + cmpl $0, 16(%ebp) + jne ..B1.15 +..B1.11: + cmpl $0, 12(%ebp) + jne ..B1.15 +..B1.12: + testl %edx, %edx + jne ..B1.15 +..B1.13: + cmpl $0, 28(%ebp) + jne ..B1.15 +..B1.14: + cmpl $0, 24(%ebp) + je ..B1.45 +..B1.15: + fldt 12(%ebp) + fld %st(0) + fabs + fstpt 16(%esp) + fldt 16(%esp) + fldt 24(%ebp) + fld %st(0) + fabs + fstpt (%esp) + fldt (%esp) + movzwl 24(%esp), %ecx + movzwl 8(%esp), %edx + andl $32767, %ecx + andl $32767, %edx + cmpl %edx, %ecx + jl ..B1.20 +..B1.16: + jne ..B1.21 +..B1.17: + movl 20(%esp), %edx + movl 4(%esp), %eax + cmpl %eax, %edx + jb ..B1.20 +..B1.18: + jne ..B1.21 +..B1.19: + movl 16(%esp), %edx + cmpl (%esp), %edx + jae ..B1.21 +..B1.20: + fstpt 16(%esp) + fldt 16(%esp) + movzwl 24(%esp), %ecx + fxch %st(2) + fstpt (%esp) + fldt (%esp) + andl $32767, %ecx +..B1.21: + cmpl $16382, %ecx + jg ..B1.26 +..B1.22: + jne ..B1.42 +..B1.23: + movl 20(%esp), %edx + cmpl 16+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.26 +..B1.24: + jne ..B1.42 +..B1.25: + movl 12+_CONSTANTS@GOTOFF(%ebx), %edx + cmpl 16(%esp), %edx + ja ..B1.42 +..B1.26: + cmpl $16383, %ecx + jl ..B1.31 +..B1.27: + jne ..B1.42 +..B1.28: + movl 20(%esp), %edx + cmpl 28+_CONSTANTS@GOTOFF(%ebx), %edx + jb ..B1.31 +..B1.29: + jne ..B1.42 +..B1.30: + movl 16(%esp), %edx + cmpl 24+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.42 +..B1.31: + movzwl 8(%esp), %edx + andl $32767, %edx + cmpl $8256, %edx + jg ..B1.36 +..B1.32: + jne ..B1.37 +..B1.33: + movl 4(%esp), %eax + cmpl 40+_CONSTANTS@GOTOFF(%ebx), %eax + ja ..B1.36 +..B1.34: + jne ..B1.37 +..B1.35: + movl (%esp), %eax + cmpl 36+_CONSTANTS@GOTOFF(%ebx), %eax + jbe ..B1.37 +..B1.36: + fldt _CONSTANTS@GOTOFF(%ebx) + fld %st(3) + fmul %st(4), %st + fld %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fsubr %st, %st(1) + fxch %st(1) + fabs + fcomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jae ..B1.86 + jp ..B1.86 + jmp ..B1.38 +..B1.37: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fld %st(3) + fmul %st(4), %st + fsub %st(1), %st + fabs + fldt _CONSTANTS@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jbe ..B1.86 +..B1.38: + fstp %st(2) + cmpl $16183, %edx + jl ..B1.40 +..B1.39: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fld %st(3) + fmul %st(1), %st + lea _CONSTANTS@GOTOFF(%ebx), %eax + fxch %st(5) + fstpt (%esp) + fld %st(3) + fsubr %st(5), %st + fsubrp %st, %st(5) + fld %st(4) + lea 72(%eax), %edx + fmul %st(5), %st + fld %st(2) + fmulp %st, %st(2) + fxch %st(4) + fsub %st(5), %st + fld %st(2) + addl $84, %eax + movl %edx, 12(%esp) + fsubr %st(2), %st + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + fmul %st(4), %st + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(4) + fmul %st(0), %st + fstpt 48(%esp) + fld %st(5) + fadd %st(3), %st + fsub %st, %st(6) + fxch %st(6) + fsubrp %st, %st(3) + fmulp %st, %st(6) + fmul %st, %st(5) + fxch %st(3) + fsubrp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fld %st(0) + fsub %st(5), %st + fsubr %st, %st(2) + fld %st(1) + fsubp %st, %st(1) + fsubrp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(5), %st + fld %st(0) + faddp %st, %st(3) + fld %st(2) + fxch %st(4) + fmul %st(0), %st + fstpt 16(%esp) + fldt 16(%esp) + faddp %st, %st(4) + fxch %st(3) + fstpt 64(%esp) + fldt 64(%esp) + fldt 48(%esp) + faddp %st, %st(1) + fldt 12+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + fldt _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fmulp %st, %st(1) + fld %st(4) + fsub %st(6), %st + fsubr %st, %st(7) + fsubr %st(5), %st + fsubrp %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fld %st(1) + fsub %st(3), %st + fldt 32(%esp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(3), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fld %st(3) + fldt 64(%esp) + fld %st(0) + fsub %st(3), %st + fldt 16(%esp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(4) + fsub %st(2), %st + fldt 48(%esp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(6), %st + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt (%edx) + fld %st(0) + fmul %st(3), %st + fldt (%eax) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 200(%esp) + fldt (%esp) + fxch %st(1) + jmp ..B1.49 +..B1.40: + cmpl $16383, %ecx + je ..B1.55 +..B1.41: + fstp %st(0) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fld %st(2) + fmul %st(1), %st + fld %st(3) + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fmul %st(1), %st + lea 72(%eax), %edx + addl $84, %eax + fsubp %st, %st(3) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(3), %st + fld %st(0) + fld %st(3) + fxch %st(5) + fmul %st(0), %st + movl %edx, 12(%esp) + fadd %st, %st(1) + fxch %st(1) + fadd %st, %st(5) + fxch %st(4) + fsubr %st(5), %st + fxch %st(2) + fsubr %st(4), %st + fsubrp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fmul %st(3), %st + fldt 12+_Q1@GOTOFF(%ebx) + fmul %st(4), %st + fldt _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fmul %st(3), %st + fld %st(3) + fsubr %st(1), %st + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt (%edx) + fld %st(0) + fmul %st(3), %st + fldt (%eax) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 200(%esp) + jmp ..B1.49 +..B1.42: + fstp %st(0) + fstp %st(1) + addl $-32, %esp + lea 80(%esp), %edx + movl %edx, (%esp) + fxch %st(1) + fstpt 4(%esp) + fstpt 16(%esp) + call __libm_hypot2l_k80 +..B1.80: + addl $32, %esp +..B1.43: + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmul %st, %st(1) + fstpt 32(%esp) + fldt 120+_CONSTANTS@GOTOFF(%ebx) + fmul %st(1), %st + fstpt 16(%esp) + fldt 132+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) + addl $-32, %esp + fldt 80(%esp) + lea 124(%esp), %edx + fstpt (%esp) + fldt -32(%edx) + fstpt 12(%esp) + movl %edx, 24(%esp) + call __libm_logl_k80 +..B1.81: + addl $32, %esp +..B1.44: + fldt 32(%esp) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fmulp %st, %st(1) + lea 72(%eax), %edx + fldt 92(%esp) + addl $84, %eax + movl %edx, 12(%esp) + fmul %st(1), %st + fldt 104(%esp) + fmulp %st, %st(2) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fld %st(0) + fmul %st(2), %st + fld %st(0) + fsub %st(3), %st + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fldt (%edx) + fld %st(0) + fmul %st(4), %st + fldt (%eax) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fmulp %st, %st(6) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt 16(%esp) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt (%esp) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 200(%esp) + fldt 12(%ebp) + fxch %st(1) + jmp ..B1.49 +..B1.45: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fldz + fdivrl .L_2il0floatpacket.12@GOTOFF(%ebx) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fstpt 200(%esp) + lea 72(%eax), %edx + fldt 12(%ebp) + addl $84, %eax + movl %edx, 12(%esp) + fxch %st(1) + jmp ..B1.49 +..B1.46: + je ..B1.70 +..B1.47: + cmpl $32767, %edx + je ..B1.63 +..B1.48: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fldt 48(%eax) + lea 72(%eax), %edx + fmul %st(0), %st + addl $84, %eax + fstpt 200(%esp) + fldt 12(%ebp) + movl %edx, 12(%esp) + fxch %st(1) +..B1.49: + fldt 80(%esp) + xorl %edx, %edx + movl %edx, 140(%esp) + fstpt 128(%esp) + fldt 128(%esp) + fxch %st(2) + fstpt 116(%esp) + movl %edx, 168(%esp) + fxch %st(1) + fstpt 156(%esp) + fldt 24(%ebp) + fstpt 144(%esp) + addl $-16, %esp + lea 188(%esp), %ecx + lea 160(%esp), %edx + movl %ecx, (%esp) + lea 132(%esp), %ecx + movl %edx, 4(%esp) + movl %ecx, 8(%esp) + movl %eax, -116(%edx) + fstpt -128(%edx) + call __libm_atan2l_k80 +..B1.82: + fldt 32(%esp) + movl 44(%esp), %eax + addl $16, %esp +..B1.50: + fldt 172(%esp) + fmul %st, %st(1) + fld %st(0) + movl 12(%esp), %edx + fsubr %st(2), %st + movl 196(%esp), %ecx + fsubrp %st, %st(2) + fsub %st(1), %st + fldt 184(%esp) + addl $-32, %esp + faddp %st, %st(1) + fldt (%edx) + fld %st(0) + fmul %st(3), %st + fstpt (%esp) + fldt (%eax) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 12(%esp) + movl %ecx, 24(%esp) + call __libm_scalbl_k80 +..B1.83: + addl $32, %esp +..B1.51: + fstpt 212(%esp) + testl %esi, %esi + je ..B1.53 +..B1.52: + fldcw 46(%esp) +..B1.53: + movl 200(%esp), %edx + movl %edx, (%edi) + movl 212(%esp), %edx + movl %edx, 12(%edi) + movl 216(%esp), %edx + movl %edx, 16(%edi) + movl 204(%esp), %ecx + movl 208(%esp), %esi + movl 220(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 20(%edi) + movl 224(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.62 +..B1.54: + movl %edi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.55: + cmpl $-2147483648, 20(%esp) + jne ..B1.41 +..B1.56: + cmpl $0, 16(%esp) + jne ..B1.41 +..B1.57: + fstp %st(2) + fstp %st(0) + cmpl $0, 4(%esp) + jne ..B1.60 +..B1.58: + cmpl $0, (%esp) + jne ..B1.60 +..B1.59: + fstp %st(0) + fldt 80(%esp) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fstpt 200(%esp) + lea 72(%eax), %edx + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + addl $84, %eax + movl %edx, 12(%esp) + jmp ..B1.49 +..B1.60: + fstp %st(1) + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fldt 108(%eax) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + movzwl 8(%esp), %ecx + movl %ecx, %edx + andl $-32768, %ecx + fld %st(0) + orl $-49153, %ecx + fld %st(1) + movw %cx, 8(%esp) + lea 72(%eax), %ecx + fldt (%esp) + addl $84, %eax + fmul %st, %st(2) + fld %st(0) + movl %ecx, 12(%esp) + addl $-32, %esp + andl $32767, %edx + fsubr %st(3), %st + fsubrp %st, %st(3) + fld %st(2) + lea -33167(%edx,%edx), %edx + fmul %st(3), %st + fmul %st, %st(2) + fld %st(2) + fsub %st(1), %st + fsubrp %st, %st(3) + fsub %st(2), %st + fxch %st(1) + fsub %st(3), %st + fmul %st, %st(3) + fxch %st(5) + fmulp %st, %st(3) + fld %st(4) + fmulp %st, %st(5) + fxch %st(2) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldt (%ecx) + fld %st(0) + fmul %st(4), %st + fstpt (%esp) + fldt (%eax) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + movl %edx, 24(%esp) + movl %eax, 60(%esp) + fstpt 48(%esp) + call __libm_scalbl_k80 +..B1.84: + fldt 48(%esp) + movl 60(%esp), %eax + addl $32, %esp +..B1.61: + fxch %st(1) + fstpt 200(%esp) + fldt 12(%ebp) + fxch %st(1) + jmp ..B1.49 +..B1.62: + call __stack_chk_fail@PLT +..B1.63: + cmpl $-2147483648, 28(%ebp) + jne ..B1.65 +..B1.64: + cmpl $0, 24(%ebp) + je ..B1.48 +..B1.65: + cmpl $32767, %ecx + je ..B1.67 +..B1.66: + fldt 24(%ebp) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fmul %st(0), %st + lea 72(%eax), %edx + fstpt 200(%esp) + addl $84, %eax + fldt 12(%ebp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + movl %edx, 12(%esp) + jmp ..B1.49 +..B1.67: + cmpl $-2147483648, 16(%ebp) + jne ..B1.66 +..B1.68: + cmpl $0, 12(%ebp) + jne ..B1.66 +..B1.69: + fldt 12(%ebp) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fld %st(0) + lea 72(%eax), %edx + fmul %st(1), %st + addl $84, %eax + fstpt 200(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + movl %edx, 12(%esp) + jmp ..B1.49 +..B1.70: + cmpl $-2147483648, 16(%ebp) + jne ..B1.72 +..B1.71: + cmpl $0, 12(%ebp) + je ..B1.47 +..B1.72: + cmpl $32767, %edx + je ..B1.74 +..B1.73: + fldt 12(%ebp) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fldt 24(%ebp) + lea 72(%eax), %edx + fmul %st(1), %st + addl $84, %eax + fstpt 200(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + movl %edx, 12(%esp) + jmp ..B1.49 +..B1.74: + cmpl $-2147483648, 28(%ebp) + jne ..B1.73 +..B1.75: + cmpl $0, 24(%ebp) + jne ..B1.73 +..B1.76: + fldt 24(%ebp) + lea _CONSTANTS@GOTOFF(%ebx), %eax + fmul %st(0), %st + lea 72(%eax), %edx + fstpt 200(%esp) + addl $84, %eax + fldt 12(%ebp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + movl %edx, 12(%esp) + jmp ..B1.49 +..B1.77: + xorl %esi, %esi + jmp ..B1.7 +..B1.85: + cmpl $32767, %ecx + je ..B1.70 + jmp ..B1.47 +..B1.86: + fstp %st(0) + jmp ..B1.42 + .align 16,0x90 + .type clog10l,@function + .size clog10l,.-clog10l + .data +# -- End clog10l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16358 + .word 0 + .word 37342 + .word 47265 + .word 62214 + .word 46340 + .word 16382 + .word 0 + .word 64512 + .word 65535 + .word 31 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8256 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 55465 + .word 56923 + .word 16381 + .word 0 + .word 43711 + .word 54638 + .word 50772 + .word 56481 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16583 + .word 0 + .word 0 + .word 0 + .word 39557 + .word 39456 + .word 16381 + .word 0 + .word 51839 + .word 3796 + .word 3310 + .word 34305 + .word 49112 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,144 + .align 16 +_Q1: + .word 3134 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 49331 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .type _Q1,@object + .size _Q1,24 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .data + .hidden __libm_logl_k80 + .hidden __libm_hypot2l_k80 + .hidden __libm_scalbl_k80 + .hidden __libm_atan2l_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/clog_gen.S b/external/sgx_libm/ia32/clog_gen.S new file mode 100644 index 0000000000..82d47aa12f --- /dev/null +++ b/external/sgx_libm/ia32/clog_gen.S @@ -0,0 +1,756 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clog_gen.c" + .text +..TXTST0: +# -- Begin __libm_internal_clog + .text + .align 16,0x90 + .hidden __libm_internal_clog + .globl __libm_internal_clog +__libm_internal_clog: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 168(%esp) + fstl 152(%esp) + fstpl 160(%esp) +..B1.2: + fnstcw 134(%esp) +..B1.3: + movzwl 18(%ebp), %ecx + andl $32752, %ecx + movzwl 26(%ebp), %edx + andl $32752, %edx + shrl $4, %ecx + shrl $4, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %ecx + jge ..B1.21 +..B1.4: + cmpl $2047, %edx + jge ..B1.48 +..B1.5: + movzwl 134(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.26 +..B1.6: + orl $-64768, %ecx + movw %cx, 132(%esp) +..B1.7: + fldcw 132(%esp) +..B1.8: + movl $1, %edi +..B1.9: + fldl 12(%ebp) + fabs + fldl 20(%ebp) + fabs + fcom %st(1) + fnstsw %ax + sahf + jae ..B1.11 + jp ..B1.11 +..B1.10: + fld %st(1) + jmp ..B1.12 +..B1.11: + fld %st(0) +..B1.12: + fxch %st(1) + fcom %st(2) + fnstsw %ax + sahf + jbe ..B1.14 +..B1.13: + fstp %st(0) + jmp ..B1.15 +..B1.14: + fstp %st(2) +..B1.15: + fld %st(0) + fmul %st(1), %st + fld %st(0) + fld %st(3) + fmul %st(4), %st + fadd %st, %st(1) + fld1 + fsubr %st(2), %st + fabs + fcompl .L_2il0floatpacket.6@GOTOFF(%ebx) + fnstsw %ax + sahf + jbe ..B1.17 +..B1.16: + fstp %st(3) + fstp %st(2) + fstp %st(2) + fstp %st(1) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B1.44: + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpl 152(%esp) + jmp ..B1.18 +..B1.17: + fstp %st(1) + fxch %st(3) + fstpt 136(%esp) + fstpt (%esp) + fld %st(0) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fldt 12(%esp) + fsub %st(2), %st + fsubrp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fsubrp %st, %st(1) + fstpt 36(%esp) + fldt 24(%esp) + fldt 24(%esp) + fmulp %st, %st(1) + fldt (%esp) + fsubrp %st, %st(1) + fldt 36(%esp) + fldt 24(%esp) + fldt 36(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fldt 136(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fstpt 48(%esp) + fxch %st(2) + fstpt 60(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fmul %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fldt 12(%esp) + fsub %st(3), %st + fsubrp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 84(%esp) + fldt 72(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fldt 60(%esp) + fsubrp %st, %st(1) + fldt 84(%esp) + fmulp %st, %st(2) + fldt 72(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 84(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 96(%esp) + fldt (%esp) + fldt 60(%esp) + faddp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + fldt (%esp) + fsubrp %st, %st(1) + fstpt 120(%esp) + fldt (%esp) + fldt 108(%esp) + fldt 120(%esp) + fsubrp %st, %st(1) + fsubrp %st, %st(1) + fldt 60(%esp) + fldt 120(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 120(%esp) + fldt 108(%esp) + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fsubrp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + fldt 120(%esp) + fldt 48(%esp) + faddp %st, %st(1) + fldt 96(%esp) + addl $-16, %esp + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + call log1pl@PLT +..B1.45: + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpl 152(%esp) +..B1.18: + testl %edi, %edi + je ..B1.20 +..B1.19: + fldcw 134(%esp) +..B1.20: + fldl 20(%ebp) + addl $-16, %esp + fldl 12(%ebp) + fstpl 8(%esp) + fstpl (%esp) + call atan2@PLT + jmp ..B1.47 +..B1.21: + je ..B1.35 +..B1.22: + cmpl $2047, %edx + je ..B1.28 +..B1.23: + fldl _DBL_PINF@GOTOFF(%ebx) + fstpl 152(%esp) + addl $-16, %esp + fldl 20(%ebp) + fldl 12(%ebp) + fstpl 8(%esp) + fstpl (%esp) + call atan2@PLT +..B1.47: + addl $16, %esp + fstpl 160(%esp) +..B1.24: + movl 152(%esp), %edx + movl %edx, (%esi) + movl 156(%esp), %ecx + movl 160(%esp), %edi + movl 164(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 168(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.27 +..B1.25: + movl %esi, %eax + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.26: + xorl %edi, %edi + jmp ..B1.9 +..B1.27: + call __stack_chk_fail@PLT +..B1.28: + testl $1048575, 24(%ebp) + jne ..B1.30 +..B1.29: + cmpl $0, 20(%ebp) + je ..B1.23 +..B1.30: + fldl 20(%ebp) + cmpl $2047, %ecx + fmul %st(0), %st + fstl 160(%esp) + je ..B1.32 +..B1.31: + fstpl 152(%esp) + jmp ..B1.24 +..B1.32: + testl $1048575, 16(%ebp) + jne ..B1.31 +..B1.33: + cmpl $0, 12(%ebp) + jne ..B1.31 +..B1.34: + fstp %st(0) + fldl 12(%ebp) + fmul %st(0), %st + fstpl 152(%esp) + jmp ..B1.24 +..B1.35: + testl $1048575, 16(%ebp) + jne ..B1.37 +..B1.36: + cmpl $0, 12(%ebp) + je ..B1.22 +..B1.37: + fldl 12(%ebp) + cmpl $2047, %edx + fld %st(0) + fmul %st(1), %st + fstpl 160(%esp) + je ..B1.39 +..B1.38: + fldl 20(%ebp) + fmulp %st, %st(1) + fstpl 152(%esp) + jmp ..B1.24 +..B1.39: + testl $1048575, 24(%ebp) + jne ..B1.38 +..B1.40: + cmpl $0, 20(%ebp) + jne ..B1.38 +..B1.41: + fstp %st(0) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 152(%esp) + jmp ..B1.24 +..B1.48: + cmpl $2047, %ecx + je ..B1.35 + jmp ..B1.22 + .align 16,0x90 + .type __libm_internal_clog,@function + .size __libm_internal_clog,.-__libm_internal_clog + .data +# -- End __libm_internal_clog + .text +# -- Begin clog + .text + .align 16,0x90 + .globl clog +clog: +# parameter 1: 12 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + fldl 12(%ebp) + fldl 20(%ebp) + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 184(%esp) + fstpl 176(%esp) + fstpl 168(%esp) + fstl 152(%esp) + fstpl 160(%esp) +..B2.2: + fnstcw 134(%esp) +..B2.3: + movzwl 174(%esp), %edx + andl $32752, %edx + movzwl 182(%esp), %eax + andl $32752, %eax + shrl $4, %edx + shrl $4, %eax + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + cmpl $2047, %edx + jge ..B2.21 +..B2.4: + cmpl $2047, %eax + jge ..B2.48 +..B2.5: + movzwl 134(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.26 +..B2.6: + orl $-64768, %edx + movw %dx, 132(%esp) +..B2.7: + fldcw 132(%esp) +..B2.8: + movl $1, %esi +..B2.9: + fldl 168(%esp) + fabs + fldl 176(%esp) + fabs + fcom %st(1) + fnstsw %ax + sahf + jae ..B2.11 + jp ..B2.11 +..B2.10: + fld %st(1) + jmp ..B2.12 +..B2.11: + fld %st(0) +..B2.12: + fxch %st(1) + fcom %st(2) + fnstsw %ax + sahf + jbe ..B2.14 +..B2.13: + fstp %st(0) + jmp ..B2.15 +..B2.14: + fstp %st(2) +..B2.15: + fld %st(0) + fmul %st(1), %st + fld %st(0) + fld %st(3) + fmul %st(4), %st + fadd %st, %st(1) + fld1 + fsubr %st(2), %st + fabs + fcompl .L_2il0floatpacket.6@GOTOFF(%ebx) + fnstsw %ax + sahf + jbe ..B2.17 +..B2.16: + fstp %st(3) + fstp %st(2) + fstp %st(2) + fstp %st(1) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.44: + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpl 152(%esp) + jmp ..B2.18 +..B2.17: + fstp %st(1) + fxch %st(3) + fstpt 136(%esp) + fstpt (%esp) + fld %st(0) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fldt 12(%esp) + fsub %st(2), %st + fsubrp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fsubrp %st, %st(1) + fstpt 36(%esp) + fldt 24(%esp) + fldt 24(%esp) + fmulp %st, %st(1) + fldt (%esp) + fsubrp %st, %st(1) + fldt 36(%esp) + fldt 24(%esp) + fldt 36(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fldt 136(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fstpt 48(%esp) + fxch %st(2) + fstpt 60(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fmul %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fldt 12(%esp) + fsub %st(3), %st + fsubrp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 84(%esp) + fldt 72(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fldt 60(%esp) + fsubrp %st, %st(1) + fldt 84(%esp) + fmulp %st, %st(2) + fldt 72(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 84(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 96(%esp) + fldt (%esp) + fldt 60(%esp) + faddp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + fldt (%esp) + fsubrp %st, %st(1) + fstpt 120(%esp) + fldt (%esp) + fldt 108(%esp) + fldt 120(%esp) + fsubrp %st, %st(1) + fsubrp %st, %st(1) + fldt 60(%esp) + fldt 120(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 120(%esp) + fldt 108(%esp) + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fsubrp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + fldt 120(%esp) + fldt 48(%esp) + faddp %st, %st(1) + fldt 96(%esp) + addl $-16, %esp + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + call log1pl@PLT +..B2.45: + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpl 152(%esp) +..B2.18: + testl %esi, %esi + je ..B2.20 +..B2.19: + fldcw 134(%esp) +..B2.20: + fldl 176(%esp) + fldl 168(%esp) + addl $-16, %esp + fstpl 8(%esp) + fstpl (%esp) + call atan2@PLT + jmp ..B2.47 +..B2.21: + je ..B2.35 +..B2.22: + cmpl $2047, %eax + je ..B2.28 +..B2.23: + fldl _DBL_PINF@GOTOFF(%ebx) + fstpl 152(%esp) + fldl 176(%esp) + fldl 168(%esp) + addl $-16, %esp + fstpl 8(%esp) + fstpl (%esp) + call atan2@PLT +..B2.47: + addl $16, %esp + fstpl 160(%esp) +..B2.24: + fldl 152(%esp) + movl 8(%ebp), %eax + movl 156(%esp), %ecx + movl 152(%esp), %edx + movl 164(%esp), %edi + movl 160(%esp), %esi + fstp %st(0) + fldl 160(%esp) + fstp %st(0) + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl %esi, 8(%eax) + movl %edi, 12(%eax) + movl 184(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.27 +..B2.25: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B2.26: + xorl %esi, %esi + jmp ..B2.9 +..B2.27: + call __stack_chk_fail@PLT +..B2.28: + testl $1048575, 180(%esp) + jne ..B2.30 +..B2.29: + cmpl $0, 176(%esp) + je ..B2.23 +..B2.30: + fldl 176(%esp) + cmpl $2047, %edx + fmul %st(0), %st + fstl 160(%esp) + je ..B2.32 +..B2.31: + fstpl 152(%esp) + jmp ..B2.24 +..B2.32: + testl $1048575, 172(%esp) + jne ..B2.31 +..B2.33: + cmpl $0, 168(%esp) + jne ..B2.31 +..B2.34: + fstp %st(0) + fldl 168(%esp) + fmul %st(0), %st + fstpl 152(%esp) + jmp ..B2.24 +..B2.35: + testl $1048575, 172(%esp) + jne ..B2.37 +..B2.36: + cmpl $0, 168(%esp) + je ..B2.22 +..B2.37: + fldl 168(%esp) + cmpl $2047, %eax + fld %st(0) + fmul %st(1), %st + fstpl 160(%esp) + je ..B2.39 +..B2.38: + fldl 176(%esp) + fmulp %st, %st(1) + fstpl 152(%esp) + jmp ..B2.24 +..B2.39: + testl $1048575, 180(%esp) + jne ..B2.38 +..B2.40: + cmpl $0, 176(%esp) + jne ..B2.38 +..B2.41: + fstp %st(0) + fldl 176(%esp) + fmul %st(0), %st + fstpl 152(%esp) + jmp ..B2.24 +..B2.48: + cmpl $2047, %edx + je ..B2.35 + jmp ..B2.22 + .align 16,0x90 + .type clog,@function + .size clog,.-clog + .data +# -- End clog + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +_DBL_PINF: + .long 0 + .long 2146435072 + .type _DBL_PINF,@object + .size _DBL_PINF,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xeb851eb8,0x3f9eb851 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/clogf_wmt.S b/external/sgx_libm/ia32/clogf_wmt.S new file mode 100644 index 0000000000..91bc907cf1 --- /dev/null +++ b/external/sgx_libm/ia32/clogf_wmt.S @@ -0,0 +1,2539 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clogf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin clogf + .text + .align 16,0x90 + .globl clogf +clogf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $136, %esp + movl %esi, 80(%esp) + call static_func + movl %eax, %esi + movss 144(%esp), %xmm0 + movss 148(%esp), %xmm1 + movss %xmm0, (%esp) + movss %xmm1, 4(%esp) + movl %ebx, 8(%esp) + movaps %xmm0, %xmm2 + cvtss2sd %xmm1, %xmm0 + cvtss2sd %xmm2, %xmm1 + movsd %xmm0, 40(%esp) + movsd %xmm1, 32(%esp) + andpd 3248(%esi), %xmm0 + andpd 3248(%esi), %xmm1 + movl 4(%esp), %edx + movl (%esp), %ecx + movl $-2147483648, %eax + andl %edx, %eax + andl $2139095040, %edx + subl $8388608, %edx + cmpl $2130706432, %edx + jae .L_2TAG_PACKET_0.0.2 + movl %ecx, %edx + andl $-2147483648, %ecx + andl $2139095040, %edx + subl $8388608, %edx + cmpl $2130706432, %edx + jae .L_2TAG_PACKET_1.0.2 + movapd %xmm0, %xmm3 + divsd %xmm1, %xmm0 + movq 3232(%esi), %xmm2 + mulsd %xmm1, %xmm1 + mulsd %xmm3, %xmm3 + addsd %xmm3, %xmm1 + movq %xmm1, 16(%esp) + pand %xmm1, %xmm2 + pextrw $3, %xmm1, %edx + subsd 4800(%esi), %xmm1 + pand 3248(%esi), %xmm1 + cmpltsd 2048(%esi), %xmm1 + movmskpd %xmm1, %ebx + por 4800(%esi), %xmm2 + testl $1, %ebx + jne .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_3.0.2: + xorl %ecx, %eax + movl 20(%esp), %ebx + sarl $4, %edx + andl $1044480, %ebx + movsd 4816(%esi), %xmm3 + xorpd %xmm4, %xmm4 + subl $1023, %edx + xorpd %xmm7, %xmm7 + sarl $31, %ecx + movl %edx, 12(%esp) + movd %ecx, %xmm6 + pshufd $0, %xmm6, %xmm6 + andpd 4848(%esi), %xmm6 + andpd %xmm0, %xmm3 + pextrw $3, %xmm0, %edx + shrl $9, %ebx + movsd %xmm0, %xmm1 + subl $16288, %edx + cmpl $1119, %edx + ja .L_2TAG_PACKET_4.0.2 + movl $16464, %ecx + pinsrw $3, %ecx, %xmm4 + shrl $16, %eax + orpd 4832(%esi), %xmm3 + movsd %xmm4, %xmm7 + mulsd (%esi,%ebx), %xmm2 + cmpsd $6, %xmm3, %xmm4 + movsd 4800(%esi), %xmm5 + minsd %xmm7, %xmm3 + andpd %xmm4, %xmm0 + mulsd %xmm3, %xmm1 + andpd %xmm4, %xmm5 + subsd %xmm3, %xmm0 + subsd 4800(%esi), %xmm2 + addsd %xmm5, %xmm1 + movq 3296(%esi), %xmm5 + divsd %xmm1, %xmm0 + cvtsi2sdl 12(%esp), %xmm1 + movl $176, %ecx + cmpl $176, %edx + cmova %ecx, %edx + addl $1, %edx + movsd 4880(%esi), %xmm4 + pinsrw $3, %eax, %xmm7 + addsd 3376(%esi,%edx,8), %xmm6 + xorpd %xmm7, %xmm6 + mulsd %xmm2, %xmm5 + addsd 3288(%esi), %xmm5 + mulsd %xmm2, %xmm5 + addsd 3280(%esi), %xmm5 + mulsd %xmm2, %xmm5 + xorpd %xmm0, %xmm7 + mulsd 3264(%esi), %xmm1 + mulsd %xmm0, %xmm0 + mulsd %xmm7, %xmm4 + addsd %xmm6, %xmm7 + mulsd %xmm4, %xmm0 + addsd 4976(%esi,%ebx), %xmm1 + addsd %xmm7, %xmm0 + addsd %xmm1, %xmm5 + mulsd 2064(%esi), %xmm5 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm5, %xmm5 + movd %xmm0, %edx + movd %xmm5, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_4.0.2: + addl $944, %edx + cmpl $2063, %edx + ja .L_2TAG_PACKET_6.0.2 + movq 4864(%esi), %xmm3 + shrl $16, %eax + movsd 4872(%esi), %xmm4 + mulsd (%esi,%ebx), %xmm2 + pinsrw $3, %eax, %xmm7 + mulsd %xmm1, %xmm1 + subsd 4800(%esi), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm3 + movsd %xmm1, %xmm5 + mulsd %xmm1, %xmm1 + addsd %xmm6, %xmm0 + cvtsi2sdl 12(%esp), %xmm6 + mulsd %xmm5, %xmm4 + mulsd %xmm3, %xmm1 + movq 3296(%esi), %xmm3 + mulsd %xmm2, %xmm3 + addsd 3288(%esi), %xmm3 + mulsd %xmm2, %xmm3 + mulsd 3264(%esi), %xmm6 + addsd 3280(%esi), %xmm3 + addsd 4976(%esi,%ebx), %xmm6 + mulsd %xmm2, %xmm3 + addsd %xmm4, %xmm1 + addsd %xmm6, %xmm3 + addsd %xmm1, %xmm0 + xorpd %xmm7, %xmm0 + mulsd 2064(%esi), %xmm3 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_6.0.2: + addl $15344, %edx + cmpl $17392, %edx + mulsd (%esi,%ebx), %xmm2 + subsd 4800(%esi), %xmm2 + jae .L_2TAG_PACKET_7.0.2 + shrl $16, %eax + pinsrw $3, %eax, %xmm7 + addsd %xmm6, %xmm0 + cvtsi2sdl 12(%esp), %xmm6 + movq 3296(%esi), %xmm3 + mulsd %xmm2, %xmm3 + pextrw $3, %xmm0, %edx + addsd 3288(%esi), %xmm3 + xorpd %xmm7, %xmm0 + andl $32752, %edx + mulsd %xmm2, %xmm3 + mulsd 3264(%esi), %xmm6 + addsd 3280(%esi), %xmm3 + movl $1065353217, %eax + movl $8388608, %ecx + addsd 4976(%esi,%ebx), %xmm6 + mulsd %xmm2, %xmm3 + cmpl $14352, %edx + cmovb %ecx, %eax + movd %eax, %xmm1 + addsd %xmm6, %xmm3 + mulss %xmm1, %xmm1 + mulsd 2064(%esi), %xmm3 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_7.0.2: + movss 4944(%esi), %xmm4 + movss 4948(%esi), %xmm1 + cvtsi2sdl 12(%esp), %xmm6 + shrl $16, %eax + andl $32768, %ecx + movq 3296(%esi), %xmm3 + mulsd %xmm2, %xmm3 + addsd 3288(%esi), %xmm3 + xorl %ecx, %eax + mulsd %xmm2, %xmm3 + xorps %xmm0, %xmm0 + mulsd 3264(%esi), %xmm6 + addsd 3280(%esi), %xmm3 + pinsrw $1, %eax, %xmm0 + addsd 4976(%esi,%ebx), %xmm6 + mulsd %xmm2, %xmm3 + orps %xmm0, %xmm4 + addsd %xmm6, %xmm3 + orps %xmm1, %xmm0 + mulsd 2064(%esi), %xmm3 + cvtsd2ss %xmm3, %xmm3 + addss %xmm4, %xmm0 + movd %xmm0, %edx + movd %xmm3, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_2.0.2: + movsd 32(%esp), %xmm5 + mulsd %xmm5, %xmm5 + movq 16(%esp), %xmm1 + movq 16(%esp), %xmm6 + movq 16(%esp), %xmm2 + subsd %xmm5, %xmm1 + subsd %xmm1, %xmm6 + subsd %xmm1, %xmm3 + subsd %xmm6, %xmm5 + addsd %xmm3, %xmm5 + xorl %ecx, %eax + movsd 4816(%esi), %xmm3 + xorpd %xmm4, %xmm4 + xorpd %xmm7, %xmm7 + sarl $31, %ecx + movd %ecx, %xmm6 + pshufd $0, %xmm6, %xmm6 + andpd 4848(%esi), %xmm6 + subsd 4800(%esi), %xmm2 + andpd %xmm0, %xmm3 + pextrw $3, %xmm0, %edx + movsd %xmm0, %xmm1 + addsd %xmm5, %xmm2 + subl $16288, %edx + cmpl $1119, %edx + ja .L_2TAG_PACKET_8.0.2 + movl $16464, %ecx + pinsrw $3, %ecx, %xmm4 + shrl $16, %eax + orpd 4832(%esi), %xmm3 + movsd %xmm4, %xmm7 + cmpsd $6, %xmm3, %xmm4 + movsd 4800(%esi), %xmm5 + minsd %xmm7, %xmm3 + andpd %xmm4, %xmm0 + mulsd %xmm3, %xmm1 + andpd %xmm4, %xmm5 + subsd %xmm3, %xmm0 + movq 3344(%esi), %xmm3 + addsd %xmm5, %xmm1 + divsd %xmm1, %xmm0 + mulsd %xmm2, %xmm3 + movl $176, %ecx + cmpl $176, %edx + cmova %ecx, %edx + addl $1, %edx + movsd 4880(%esi), %xmm4 + addsd 3336(%esi), %xmm3 + pinsrw $3, %eax, %xmm7 + addsd 3376(%esi,%edx,8), %xmm6 + mulsd %xmm2, %xmm3 + xorpd %xmm7, %xmm6 + addsd 3328(%esi), %xmm3 + xorpd %xmm0, %xmm7 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm0 + addsd 3320(%esi), %xmm3 + mulsd %xmm7, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm6, %xmm7 + addsd 3312(%esi), %xmm3 + mulsd %xmm4, %xmm0 + mulsd %xmm2, %xmm3 + addsd %xmm7, %xmm0 + cvtsd2ss %xmm3, %xmm3 + cvtpd2ps %xmm0, %xmm0 + movd %xmm3, %eax + movd %xmm0, %edx + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_8.0.2: + addl $944, %edx + cmpl $2063, %edx + ja .L_2TAG_PACKET_9.0.2 + movq 4864(%esi), %xmm3 + shrl $16, %eax + movsd 4872(%esi), %xmm4 + pinsrw $3, %eax, %xmm7 + mulsd %xmm1, %xmm1 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm3 + movsd %xmm1, %xmm5 + mulsd %xmm1, %xmm1 + addsd %xmm6, %xmm0 + movq 3344(%esi), %xmm6 + mulsd %xmm2, %xmm6 + addsd 3336(%esi), %xmm6 + mulsd %xmm5, %xmm4 + mulsd %xmm2, %xmm6 + addsd 3328(%esi), %xmm6 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm6 + addsd 3320(%esi), %xmm6 + addsd %xmm4, %xmm1 + mulsd %xmm2, %xmm6 + addsd %xmm1, %xmm0 + addsd 3312(%esi), %xmm6 + xorpd %xmm7, %xmm0 + mulsd %xmm2, %xmm6 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm6, %xmm6 + movd %xmm0, %edx + movd %xmm6, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_9.0.2: + addl $15344, %edx + cmpl $17392, %edx + jae .L_2TAG_PACKET_10.0.2 + movq 3344(%esi), %xmm3 + mulsd %xmm2, %xmm3 + shrl $16, %eax + addsd 3336(%esi), %xmm3 + pinsrw $3, %eax, %xmm7 + mulsd %xmm2, %xmm3 + addsd %xmm6, %xmm0 + addsd 3328(%esi), %xmm3 + pextrw $3, %xmm0, %edx + mulsd %xmm2, %xmm3 + xorpd %xmm7, %xmm0 + addsd 3320(%esi), %xmm3 + andl $32752, %edx + movl $1065353217, %eax + movl 8(%esp), %ecx + movl $8388608, %ecx + mulsd %xmm2, %xmm3 + cmpl $14352, %edx + cmovb %ecx, %eax + movd %eax, %xmm1 + addsd 3312(%esi), %xmm3 + mulss %xmm1, %xmm1 + mulsd %xmm2, %xmm3 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_10.0.2: + movss 4944(%esi), %xmm4 + movq 3344(%esi), %xmm3 + mulsd %xmm2, %xmm3 + movss 4948(%esi), %xmm1 + addsd 3336(%esi), %xmm3 + shrl $16, %eax + mulsd %xmm2, %xmm3 + andl $32768, %ecx + addsd 3328(%esi), %xmm3 + xorl %ecx, %eax + mulsd %xmm2, %xmm3 + xorps %xmm0, %xmm0 + addsd 3320(%esi), %xmm3 + pinsrw $1, %eax, %xmm0 + mulsd %xmm2, %xmm3 + orps %xmm0, %xmm4 + addsd 3312(%esi), %xmm3 + orps %xmm1, %xmm0 + mulsd %xmm2, %xmm3 + addss %xmm4, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_0.0.2: + andl $-2147483648, %ecx +.L_2TAG_PACKET_1.0.2: + movl 4(%esp), %edx + andl $2147483647, %edx + je .L_2TAG_PACKET_11.0.2 + andl $2139095040, %edx + jne .L_2TAG_PACKET_11.0.2 + movss 4(%esp), %xmm0 + orps 4896(%esi), %xmm0 + cvtss2sd %xmm0, %xmm0 + movsd 4928(%esi), %xmm2 + andpd %xmm0, %xmm2 + orpd 4912(%esi), %xmm2 + subsd %xmm2, %xmm0 + movsd %xmm0, 40(%esp) +.L_2TAG_PACKET_11.0.2: + movl (%esp), %edx + andl $2147483647, %edx + je .L_2TAG_PACKET_12.0.2 + andl $2139095040, %edx + jne .L_2TAG_PACKET_12.0.2 + movss (%esp), %xmm1 + orps 4896(%esi), %xmm1 + cvtss2sd %xmm1, %xmm1 + movsd 4928(%esi), %xmm2 + andpd %xmm1, %xmm2 + orpd 4912(%esi), %xmm2 + subsd %xmm2, %xmm1 + movsd %xmm1, 32(%esp) +.L_2TAG_PACKET_12.0.2: + movsd 40(%esp), %xmm0 + movsd 32(%esp), %xmm1 + pextrw $3, %xmm0, %edx + andl $32752, %edx + subl $16, %edx + cmpl $32736, %edx + jae .L_2TAG_PACKET_13.0.2 + pextrw $3, %xmm1, %edx + andl $32752, %edx + subl $16, %edx + cmpl $32736, %edx + jae .L_2TAG_PACKET_14.0.2 + movq %xmm0, %xmm3 + divsd %xmm1, %xmm0 + movq 3232(%esi), %xmm2 + mulsd %xmm1, %xmm1 + mulsd %xmm3, %xmm3 + addsd %xmm3, %xmm1 + movq %xmm1, 16(%esp) + pand %xmm1, %xmm2 + pextrw $3, %xmm1, %edx + subsd 4800(%esi), %xmm1 + pand 3248(%esi), %xmm1 + cmpltsd 2048(%esi), %xmm1 + movmskpd %xmm1, %ebx + por 4800(%esi), %xmm2 + testl $1, %ebx + movl 8(%esp), %ebx + psllq $1, %xmm0 + psrlq $1, %xmm0 + jne .L_2TAG_PACKET_2.0.2 + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_13.0.2: + addl $16, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_15.0.2 + movsd %xmm0, %xmm2 + psllq $12, %xmm2 + xorpd %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + je .L_2TAG_PACKET_16.0.2 + movss 4(%esp), %xmm0 + movl (%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + mulss %xmm0, %xmm0 + jg .L_2TAG_PACKET_17.0.2 + je .L_2TAG_PACKET_18.0.2 + movd %xmm0, %edx + movd %xmm0, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_18.0.2: + movd %xmm0, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_17.0.2: + movss (%esp), %xmm1 + mulss %xmm0, %xmm0 + mulss %xmm1, %xmm1 + movd %xmm0, %edx + movd %xmm1, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_15.0.2: + pextrw $3, %xmm1, %edx + andl $32752, %edx + cmpl $32752, %edx + jne .L_2TAG_PACKET_19.0.2 + movsd %xmm1, %xmm2 + psllq $12, %xmm2 + xorpd %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + jne .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_19.0.2: + cmpl $0, %ecx + jne .L_2TAG_PACKET_21.0.2 + movl %eax, %edx + movl (%esp), %eax + cmpl $0, %eax + je .L_2TAG_PACKET_22.0.2 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_23.0.2 + movl (%esp), %eax + movl %edx, 28(%esp) + andl $2147483647, %eax + movl %eax, 24(%esp) + jmp .L_2TAG_PACKET_24.0.2 +.L_2TAG_PACKET_21.0.2: + movss 4952(%esi), %xmm2 + movss 4956(%esi), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl (%esp), %eax + cmpl $-2147483648, %eax + je .L_2TAG_PACKET_22.0.2 + cmpl $-8388608, %eax + je .L_2TAG_PACKET_23.0.2 + movl (%esp), %eax + movl %edx, 28(%esp) + andl $2147483647, %eax + movl %eax, 24(%esp) + jmp .L_2TAG_PACKET_24.0.2 +.L_2TAG_PACKET_22.0.2: + pxor %xmm1, %xmm1 + movss 3216(%esi), %xmm0 + divss %xmm1, %xmm0 + movl $-8388608, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_23.0.2: + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_16.0.2: + pextrw $3, %xmm1, %edx + andl $32752, %edx + cmpl $32752, %edx + je .L_2TAG_PACKET_25.0.2 + movss 4944(%esi), %xmm2 + movss 4948(%esi), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_25.0.2: + movsd %xmm1, %xmm2 + psllq $12, %xmm2 + xorpd %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + jne .L_2TAG_PACKET_26.0.2 + cmpl $0, %ecx + je .L_2TAG_PACKET_27.0.2 + movss 4944(%esi), %xmm2 + movss 4948(%esi), %xmm3 + movss 4960(%esi), %xmm4 + movss 4964(%esi), %xmm5 + addss %xmm3, %xmm2 + addss %xmm5, %xmm4 + addss %xmm4, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_27.0.2: + movss 4960(%esi), %xmm4 + movss 4964(%esi), %xmm5 + addss %xmm5, %xmm4 + movd %xmm4, %edx + orl %eax, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_14.0.2: + addl $16, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_28.0.2 + movsd %xmm1, %xmm2 + psllq $12, %xmm2 + xorps %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + jne .L_2TAG_PACKET_20.0.2 + cmpl $0, %ecx + jne .L_2TAG_PACKET_29.0.2 + movl %eax, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_29.0.2: + movss 4952(%esi), %xmm2 + movss 4956(%esi), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_28.0.2: + movss 4944(%esi), %xmm2 + movss 4948(%esi), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl 4(%esp), %eax + movl %edx, 28(%esp) + andl $2147483647, %eax + movl %eax, 24(%esp) + jmp .L_2TAG_PACKET_24.0.2 +.L_2TAG_PACKET_20.0.2: + addsd %xmm1, %xmm1 + cvtpd2ps %xmm1, %xmm0 + movd %xmm0, %edx + movl %edx, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_26.0.2: + addsd %xmm1, %xmm1 + cvtpd2ps %xmm1, %xmm0 + movd %xmm0, %edx + movl $2139095040, %eax + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_24.0.2: + movss 24(%esp), %xmm0 + movsd 3168(%esi), %xmm1 + movsd 3184(%esi), %xmm3 + pextrw $1, %xmm0, %eax + movaps %xmm0, %xmm4 + psllq $29, %xmm0 + andpd %xmm0, %xmm1 + orpd %xmm3, %xmm1 + movsd 2080(%esi), %xmm5 + movsd 2088(%esi), %xmm6 + movsd 2096(%esi), %xmm2 + movl %eax, %edx + movl $32639, %ecx + subl %edx, %ecx + subl $128, %edx + orl %ecx, %edx + cmpl $32768, %edx + jae .L_2TAG_PACKET_30.0.2 + movl $16191, %ecx +.L_2TAG_PACKET_31.0.2: + movd %ecx, %xmm0 + movsd 2640(%esi), %xmm3 + andl $127, %eax + addl $1, %eax + andl $254, %eax + addl %eax, %eax + addl %eax, %eax + movsd 2640(%esi,%eax), %xmm7 + psrlq $16, %xmm4 + psubd %xmm0, %xmm4 + psrad $7, %xmm4 + cvtdq2pd %xmm4, %xmm4 + movsd 2112(%esi,%eax), %xmm0 + mulsd %xmm7, %xmm1 + subsd %xmm3, %xmm1 + movsd %xmm1, %xmm7 + mulsd %xmm1, %xmm5 + movsd %xmm1, %xmm3 + mulsd %xmm1, %xmm1 + addsd %xmm6, %xmm5 + mulsd 3264(%esi), %xmm4 + mulsd %xmm1, %xmm7 + mulsd %xmm1, %xmm2 + addsd %xmm3, %xmm2 + mulsd %xmm5, %xmm7 + addsd %xmm4, %xmm0 + addsd %xmm7, %xmm2 + addsd %xmm2, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + movl 28(%esp), %edx + movl 8(%esp), %ebx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_30.0.2: + movl 24(%esp), %edx + mulss 3200(%esi), %xmm4 + movsd 3168(%esi), %xmm1 + pextrw $1, %xmm4, %eax + cvtps2pd %xmm4, %xmm0 + andpd %xmm0, %xmm1 + orpd %xmm3, %xmm1 + movl $24383, %ecx + jmp .L_2TAG_PACKET_31.0.2 +.L_2TAG_PACKET_5.0.2: + movl 80(%esp), %esi + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type clogf,@function + .size clogf,.-clogf + .data +# -- End clogf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .long 3951369912 + .long 1067366481 + .long 3951369912 + .long 3214850129 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 0 + .long 3218079744 + .long 1431655765 + .long 1070945621 + .long 0 + .long 3219128320 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2969299638 + .long 1066385576 + .long 242759278 + .long 1067418267 + .long 4130528649 + .long 1067938904 + .long 3222363743 + .long 1068436016 + .long 2518406343 + .long 1068712407 + .long 2330290349 + .long 1068953810 + .long 977983493 + .long 1069191789 + .long 1848308976 + .long 1069426439 + .long 2094042057 + .long 1069602686 + .long 4162844547 + .long 1069716818 + .long 1825274911 + .long 1069829419 + .long 1890030541 + .long 1069940528 + .long 34658761 + .long 1070050185 + .long 2633258952 + .long 1070158426 + .long 1317059912 + .long 1070265289 + .long 3348798148 + .long 1070370807 + .long 1848308976 + .long 1070475015 + .long 1834892534 + .long 1070577944 + .long 3799224489 + .long 1070637860 + .long 2880153273 + .long 1070688092 + .long 4224678190 + .long 1070737729 + .long 3135315492 + .long 1070786786 + .long 1432962655 + .long 1070835276 + .long 3256639515 + .long 1070883211 + .long 2267936667 + .long 1070930605 + .long 3210218142 + .long 1070977469 + .long 513480033 + .long 1071023816 + .long 4139503392 + .long 1071069655 + .long 998420681 + .long 1071115000 + .long 2260812359 + .long 1071159859 + .long 471930696 + .long 1071204244 + .long 288677044 + .long 3218237794 + .long 1666870396 + .long 3218194329 + .long 2183652263 + .long 3218151310 + .long 1615681869 + .long 3218108728 + .long 1823715893 + .long 3218053404 + .long 4293333700 + .long 3217969934 + .long 4066729029 + .long 3217887287 + .long 943445964 + .long 3217805447 + .long 1015733272 + .long 3217724397 + .long 3707174790 + .long 3217644122 + .long 1699848676 + .long 3217564609 + .long 2339728692 + .long 3217485842 + .long 1800683248 + .long 3217407808 + .long 2201203741 + .long 3217330493 + .long 2954203727 + .long 3217253884 + .long 709476838 + .long 3217177969 + .long 2183652973 + .long 3217102734 + .long 970708496 + .long 3217025169 + .long 1669614391 + .long 3216877351 + .long 2376949106 + .long 3216730824 + .long 1566133827 + .long 3216585566 + .long 183157569 + .long 3216441555 + .long 1562411141 + .long 3216298769 + .long 2756121236 + .long 3216157188 + .long 3047046473 + .long 3216016792 + .long 3453858674 + .long 3215772531 + .long 346008798 + .long 3215496362 + .long 3559775130 + .long 3215222446 + .long 2313636156 + .long 3214950749 + .long 684243850 + .long 3214428453 + .long 1486053291 + .long 3213893718 + .long 1971906393 + .long 3212840981 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 528611360 + .long 1072660984 + .long 4034666248 + .long 1072629697 + .long 2884679527 + .long 1072599345 + .long 505290270 + .long 1072569886 + .long 1991868891 + .long 1072541280 + .long 490853405 + .long 1072513492 + .long 2298714891 + .long 1072486486 + .long 477218588 + .long 1072460231 + .long 58835168 + .long 1072434695 + .long 348240592 + .long 1072409849 + .long 3035110223 + .long 1072385665 + .long 3164712744 + .long 1072362118 + .long 1617585086 + .long 1072339183 + .long 440509466 + .long 1072316836 + .long 2500867033 + .long 1072295054 + .long 2576980378 + .long 1072273817 + .long 4241943008 + .long 1072253104 + .long 2409371898 + .long 1072232897 + .long 258732970 + .long 1072213177 + .long 409044504 + .long 1072193926 + .long 404232216 + .long 1072175128 + .long 1098712564 + .long 1072156767 + .long 2172167368 + .long 1072138828 + .long 1952257862 + .long 1072121297 + .long 1544257904 + .long 1072104160 + .long 381774871 + .long 1072087404 + .long 377579543 + .long 1072071016 + .long 1493901668 + .long 1072054984 + .long 1616385542 + .long 1072039297 + .long 731058263 + .long 1072023944 + .long 813783277 + .long 1072008914 + .long 1431655765 + .long 1071994197 + .long 3940743189 + .long 1071979783 + .long 2804876601 + .long 1071965664 + .long 2689777499 + .long 1071951830 + .long 1202590843 + .long 1071938273 + .long 1700977147 + .long 1071924984 + .long 336860180 + .long 1071911956 + .long 3169102082 + .long 1071899180 + .long 330382100 + .long 1071886651 + .long 327235604 + .long 1071874360 + .long 4213930177 + .long 1071862300 + .long 1244336319 + .long 1071850467 + .long 3181457256 + .long 1071838852 + .long 1300311200 + .long 1071827451 + .long 702812830 + .long 1071816257 + .long 3095471925 + .long 1071805264 + .long 2454267026 + .long 1071794468 + .long 2166487928 + .long 1071783863 + .long 2109808496 + .long 1071773444 + .long 2913108253 + .long 1071763206 + .long 1629125526 + .long 1071753145 + .long 293672978 + .long 1071743256 + .long 1601513229 + .long 1071733534 + .long 288737297 + .long 1071723976 + .long 286331153 + .long 1071714577 + .long 1810275472 + .long 1071705333 + .long 1337776699 + .long 1071696241 + .long 174592167 + .long 1071687297 + .long 138547332 + .long 1071678497 + .long 3539053052 + .long 1071669837 + .long 272696336 + .long 1071661316 + .long 2164392968 + .long 1071652928 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 1602224128 + .long 1602224128 + .long 0 + .long 0 + .long 1065353216 + .long 1065353216 + .long 0 + .long 0 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4277811695 + .long 1072049730 + .long 4277811695 + .long 1072049730 + .long 0 + .long 1072693248 + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .long 0 + .long 0 + .long 12982 + .long 1071644672 + .long 3503368358 + .long 3218079743 + .long 300625100 + .long 1069897045 + .long 3513684914 + .long 3217031970 + .long 1735899863 + .long 1069129695 + .long 0 + .long 0 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3819695742 + .long 1067482761 + .long 2998791009 + .long 1067548225 + .long 3339424991 + .long 1067613680 + .long 2710002256 + .long 1067679126 + .long 3275701428 + .long 1067744562 + .long 2908636881 + .long 1067809988 + .long 3777889398 + .long 1067875403 + .long 3759667419 + .long 1067940807 + .long 732369940 + .long 1068006200 + .long 1166616461 + .long 1068071580 + .long 2945472892 + .long 1068136947 + .long 3954480976 + .long 1068202301 + .long 2081752829 + .long 1068267642 + .long 3807999788 + .long 1068332968 + .long 2731789884 + .long 1068398280 + .long 1044477961 + .long 1068463577 + .long 1486930287 + .long 1068530218 + .long 2293016881 + .long 1068595466 + .long 201518157 + .long 1068660680 + .long 4054234584 + .long 1068725856 + .long 1246477213 + .long 1068790995 + .long 678186699 + .long 1068856093 + .long 2690594995 + .long 1068921148 + .long 3362611517 + .long 1068986159 + .long 3102162111 + .long 1069051124 + .long 2352611067 + .long 1069116041 + .long 1594134794 + .long 1069180908 + .long 1345079306 + .long 1069245723 + .long 2163300970 + .long 1069310484 + .long 352522716 + .long 1069375190 + .long 848541647 + .long 1069439838 + .long 40647312 + .long 1069504427 + .long 2216766270 + .long 1069574357 + .long 1090914384 + .long 1069638757 + .long 387601244 + .long 1069703022 + .long 3991640484 + .long 1069767144 + .long 3322489502 + .long 1069831118 + .long 3121698570 + .long 1069894936 + .long 4289964660 + .long 1069958591 + .long 3903312386 + .long 1070022077 + .long 3818449864 + .long 1070085387 + .long 2097480306 + .long 1070148515 + .long 1611694502 + .long 1070211454 + .long 1464694796 + .long 1070274198 + .long 1299612775 + .long 1070336741 + .long 1310544789 + .long 1070399077 + .long 2253168030 + .long 1070461200 + .long 1159567373 + .long 1070523105 + .long 1359373750 + .long 1070605818 + .long 908341706 + .long 1070667034 + .long 1743027350 + .long 1070727765 + .long 2055355646 + .long 1070787992 + .long 690426164 + .long 1070847697 + .long 1483247847 + .long 1070906862 + .long 392040270 + .long 1070965472 + .long 2673846014 + .long 1071023511 + .long 1384215810 + .long 1071080967 + .long 3101660631 + .long 1071137826 + .long 2094057058 + .long 1071194078 + .long 1712750594 + .long 1071249712 + .long 1411515787 + .long 1071304719 + .long 931538085 + .long 1071359091 + .long 179139065 + .long 1071412821 + .long 3387721259 + .long 1071465902 + .long 2132236852 + .long 1071544299 + .long 1942070284 + .long 1071645596 + .long 1532707802 + .long 1071695380 + .long 2294184979 + .long 1071743834 + .long 3805060714 + .long 1071790961 + .long 2215037898 + .long 1071836770 + .long 483661594 + .long 1071881273 + .long 1534679894 + .long 1071924486 + .long 1538714628 + .long 1071966430 + .long 527642555 + .long 1072007128 + .long 291339150 + .long 1072046605 + .long 2450210201 + .long 1072084888 + .long 2411367951 + .long 1072122007 + .long 681549971 + .long 1072157992 + .long 1466745541 + .long 1072192873 + .long 2845622366 + .long 1072226682 + .long 2838871438 + .long 1072275456 + .long 4200275274 + .long 1072337034 + .long 3034733530 + .long 1072394897 + .long 3207412993 + .long 1072449290 + .long 624461478 + .long 1072500450 + .long 767665908 + .long 1072548600 + .long 1110773639 + .long 1072593952 + .long 1940828530 + .long 1072636704 + .long 1911329388 + .long 1072677041 + .long 1764715788 + .long 1072704191 + .long 3332979233 + .long 1072722195 + .long 1321870254 + .long 1072739231 + .long 3657429030 + .long 1072755365 + .long 4197624557 + .long 1072770661 + .long 1512059493 + .long 1072785177 + .long 453379037 + .long 1072798965 + .long 1942345162 + .long 1072818388 + .long 4210176273 + .long 1072842164 + .long 4185644010 + .long 1072863795 + .long 679688788 + .long 1072883543 + .long 29432865 + .long 1072901630 + .long 4070721092 + .long 1072918247 + .long 2252468843 + .long 1072933561 + .long 2929724825 + .long 1072947712 + .long 1377513368 + .long 1072960824 + .long 1031632908 + .long 1072973003 + .long 2516508130 + .long 1072984342 + .long 3792452178 + .long 1072994923 + .long 3147791459 + .long 1073004818 + .long 999189752 + .long 1073014090 + .long 711011011 + .long 1073022794 + .long 15640363 + .long 1073030980 + .long 1218463589 + .long 1073042382 + .long 2538470555 + .long 1073056144 + .long 1229720947 + .long 1073068489 + .long 3115427016 + .long 1073079621 + .long 4030612557 + .long 1073089709 + .long 2728521257 + .long 1073098892 + .long 1118696283 + .long 1073107285 + .long 2682711255 + .long 1073114984 + .long 2073898081 + .long 1073122072 + .long 1403700297 + .long 1073128618 + .long 2502685617 + .long 1073134681 + .long 1531926851 + .long 1073140313 + .long 3572814411 + .long 1073145557 + .long 1695536111 + .long 1073150453 + .long 2363057203 + .long 1073155033 + .long 2873365682 + .long 1073159327 + .long 1053384691 + .long 1073165288 + .long 3270542712 + .long 1073172451 + .long 1353631484 + .long 1073178850 + .long 3511218460 + .long 1073184599 + .long 4121259284 + .long 1073189793 + .long 1193862106 + .long 1073194509 + .long 3861949790 + .long 1073198808 + .long 1486904578 + .long 1073202745 + .long 2879153715 + .long 1073206362 + .long 385353253 + .long 1073209698 + .long 1125865839 + .long 1073212783 + .long 1221361475 + .long 1073215645 + .long 2077323573 + .long 1073218307 + .long 215611373 + .long 1073220790 + .long 2347419265 + .long 1073223110 + .long 1379112765 + .long 1073225284 + .long 3891198463 + .long 1073228298 + .long 3395914051 + .long 1073231917 + .long 2799919478 + .long 1073235146 + .long 1138673476 + .long 1073238045 + .long 3408855940 + .long 1073240661 + .long 2044858738 + .long 1073243035 + .long 2578795176 + .long 1073245198 + .long 4196285314 + .long 1073247177 + .long 224877747 + .long 1073248996 + .long 3271386490 + .long 1073250671 + .long 813635989 + .long 1073252221 + .long 369829519 + .long 1073253658 + .long 1187679052 + .long 1073254994 + .long 4232586098 + .long 1073256239 + .long 426690558 + .long 1073257404 + .long 1624065902 + .long 1073258494 + .long 84029729 + .long 1073260006 + .long 700437654 + .long 1073261820 + .long 1437260555 + .long 1073263438 + .long 2813372195 + .long 1073264890 + .long 1607849324 + .long 1073266201 + .long 1011572952 + .long 1073267390 + .long 2039290225 + .long 1073268473 + .long 2435855138 + .long 1073269464 + .long 3389310384 + .long 1073270374 + .long 2790682322 + .long 1073271213 + .long 960266323 + .long 1073271989 + .long 1766929455 + .long 1073272708 + .long 627058932 + .long 1073273377 + .long 2388650377 + .long 1073274000 + .long 422252385 + .long 1073274583 + .long 2848853896 + .long 1073275128 + .long 1413754136 + .long 1073291771 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 2147418112 + .long 0 + .long 2147418112 + .long 0 + .long 32768 + .long 0 + .long 32768 + .long 1413754136 + .long 3221823995 + .long 0 + .long 0 + .long 2576980378 + .long 1070176665 + .long 1431655765 + .long 3218429269 + .long 1431655765 + .long 3218429269 + .long 1431655765 + .long 3218429269 + .long 8388608 + .long 0 + .long 0 + .long 0 + .long 0 + .long 940572672 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 1070141402 + .long 866263400 + .long 1078530010 + .long 874652008 + .long 1061752794 + .long 857874792 + .long 0 + .long 0 + .long 1440057502 + .long 1063257089 + .long 341338964 + .long 1064833554 + .long 4184355568 + .long 1065621801 + .long 2227658503 + .long 1066152307 + .long 449262470 + .long 1066510009 + .long 1570422842 + .long 1066777242 + .long 121841140 + .long 1067045544 + .long 630691842 + .long 1067281191 + .long 2711485097 + .long 1067500943 + .long 2026622491 + .long 1067619660 + .long 766078039 + .long 1067755853 + .long 4074027864 + .long 1067875476 + .long 3056660584 + .long 1067995528 + .long 3195252556 + .long 1068133258 + .long 116861598 + .long 1068254238 + .long 325086471 + .long 1068375655 + .long 296456961 + .long 1068497513 + .long 2623383041 + .long 1068559379 + .long 1681725707 + .long 1068620754 + .long 2231263004 + .long 1068682354 + .long 2815553124 + .long 1068744181 + .long 2057310944 + .long 1068806237 + .long 2095798018 + .long 1068859611 + .long 2302040698 + .long 1068922096 + .long 745232013 + .long 1068984815 + .long 659581512 + .long 1069047769 + .long 1566132617 + .long 1069101918 + .long 550036981 + .long 1069165314 + .long 2887419564 + .long 1069219844 + .long 1990183441 + .long 1069283688 + .long 3220050856 + .long 1069338605 + .long 1669613218 + .long 1069393703 + .long 2145455994 + .long 1069458213 + .long 4275830246 + .long 1069513705 + .long 1392453108 + .long 1069558451 + .long 1469915213 + .long 1069586382 + .long 2183652476 + .long 1069619086 + .long 2109656884 + .long 1069647220 + .long 636640577 + .long 1069675449 + .long 510517079 + .long 1069703773 + .long 210141498 + .long 1069732193 + .long 2537624622 + .long 1069760709 + .long 1733817001 + .long 1069789323 + .long 137854980 + .long 1069813243 + .long 3905576828 + .long 1069842036 + .long 4131810788 + .long 1069870929 + .long 3760956694 + .long 1069899922 + .long 1473082581 + .long 1069929016 + .long 926113142 + .long 1069953338 + .long 3669742467 + .long 1069982617 + .long 3711755290 + .long 1070007095 + .long 311386407 + .long 1070036564 + .long 705364525 + .long 1070066136 + .long 1973375279 + .long 1070090859 + .long 3589645072 + .long 1070115655 + .long 2425772059 + .long 1070145508 + .long 1074899574 + .long 1070170467 + .long 118003300 + .long 1070200516 + .long 691310403 + .long 1070225639 + .long 3273036717 + .long 1070250837 + .long 1226436560 + .long 1070276112 + .long 2481153995 + .long 1070306542 + .long 3227997535 + .long 1070331985 + .long 1421812646 + .long 1070357506 + .long 3386588242 + .long 1070383104 + .long 2580043380 + .long 1070408781 + .long 1068692560 + .long 1070434537 + .long 938143489 + .long 1070460372 + .long 4293333010 + .long 1070486286 + .long 373864817 + .long 1070512282 + .long 4208958430 + .long 1070538357 + .long 783121462 + .long 1070564515 + .long 870975437 + .long 1070590754 + .long 3338886172 + .long 1070606585 + .long 3772343130 + .long 1070619787 + .long 2408245143 + .long 1070630379 + .long 3811383569 + .long 1070643656 + .long 1622638721 + .long 1070656976 + .long 1290798655 + .long 1070670338 + .long 2457529556 + .long 1070681058 + .long 2398194399 + .long 1070694497 + .long 3190801979 + .long 1070707979 + .long 3352241197 + .long 1070718796 + .long 1829681364 + .long 1070732357 + .long 2568927817 + .long 1070743237 + .long 2676427515 + .long 1070756877 + .long 2882402820 + .long 1070767821 + .long 44944622 + .long 1070781542 + .long 2957945300 + .long 1070792550 + .long 1261787704 + .long 1070806352 + .long 1589923677 + .long 1070817426 + .long 3274931829 + .long 1070828529 + .long 1999843716 + .long 1070842450 + .long 1673619518 + .long 1070853620 + .long 601221319 + .long 1070864820 + .long 3763576649 + .long 1070876049 + .long 1974923437 + .long 1070890129 + .long 1096100617 + .long 1070901427 + .long 2424897952 + .long 1070912755 + .long 2376202600 + .long 1070924114 + .long 1665651958 + .long 1070935504 + .long 1014729354 + .long 1070946925 + .long 722545241 + .long 1070961245 + .long 1800682930 + .long 1070972736 + .long 1029453230 + .long 1070984259 + .long 3450874911 + .long 1070995813 + .long 1228255906 + .long 1071007400 + .long 3711032981 + .long 1071019018 + .long 3075102917 + .long 1071030669 + .long 92696812 + .long 1071042353 + .long 3897749690 + .long 1071051136 + .long 1907922160 + .long 1071062877 + .long 4023807324 + .long 1071074650 + .long 2452345726 + .long 1071086457 + .long 2292128226 + .long 1071098297 + .long 58635942 + .long 1071110171 + .long 864186929 + .long 1071122078 + .long 3555691467 + .long 1071131030 + .long 2003684347 + .long 1071142997 + .long 1479703759 + .long 1071154998 + .long 2537208015 + .long 1071164021 + .long 3699909861 + .long 1071176082 + .long 3934098706 + .long 1071188178 + .long 3885764182 + .long 1071197273 + .long 1357790931 + .long 1071209431 + .long 295956059 + .long 1071221624 + .long 4080877676 + .long 1071230791 + .long 202970280 + .long 1071243047 + .long 3977575845 + .long 1071252261 + .long 35977849 + .long 1071264580 + .long 1585496963 + .long 1071273842 + .long 375247257 + .long 1071286224 + .long 1812199574 + .long 1071295534 + .long 1876912769 + .long 1071307980 + .long 1051846544 + .long 1071317339 + .long 979589448 + .long 1071329850 + .long 71706889 + .long 1071339258 + .long 2790898835 + .long 1071351834 + .long 4013797733 + .long 1071361291 + .long 2541231151 + .long 1071370770 + .long 921733145 + .long 1071383442 + .long 508375805 + .long 1071392971 + .long 3091669954 + .long 1071402521 + .long 3343209673 + .long 1071415289 + .long 1693047557 + .long 1071424891 + .long 173861808 + .long 1071434515 + .long 3515822703 + .long 1071444160 + .long 1974837761 + .long 1071457056 + .long 1189018219 + .long 1071466754 + .long 2441946573 + .long 1071476474 + .long 1887102255 + .long 1071486217 + .long 4271031636 + .long 1071495982 + .long 876995759 + .long 1071509039 + .long 438773454 + .long 1071518858 + .long 172621632 + .long 1071528700 + .long 544035182 + .long 1071538565 + .long 2021801298 + .long 1071548453 + .long 783063308 + .long 1071558365 + .long 1598254051 + .long 1071568300 + .long 651258553 + .long 1071578259 + .long 2719315456 + .long 1071588241 + .long 3993180461 + .long 1071598247 + .long 667093936 + .long 1071608278 + .long 1823716217 + .long 1071618332 + .long 3664357648 + .long 1071628410 + .long 2393914686 + .long 1071638513 + .long 1405419566 + .long 1071646656 + .long 563652001 + .long 1071651732 + .long 1074554091 + .long 1071656820 + .long 3195405229 + .long 1071661920 + .long 2890399284 + .long 1071667033 + .long 420597586 + .long 1071672159 + .long 87278952 + .long 1071675583 + .long 1753119502 + .long 1071680729 + .long 1959759897 + .long 1071685888 + .long 975389815 + .long 1071691060 + .long 3365155278 + .long 1071696244 + .long 811309190 + .long 1071701442 + .long 1269811480 + .long 1071704914 + .long 1108583542 + .long 1071710133 + .long 1034517919 + .long 1071715365 + .long 1327340287 + .long 1071720610 + .long 1388251237 + .long 1071724114 + .long 1488234797 + .long 1071729381 + .long 2711385691 + .long 1071734661 + .long 952179194 + .long 1071738189 + .long 3255685427 + .long 1071743491 + .long 3159039803 + .long 1071748807 + .long 951558972 + .long 1071752359 + .long 3234424125 + .long 1071757697 + .long 3904573547 + .long 1071763049 + .long 2648729924 + .long 1071766625 + .long 2729250212 + .long 1071772000 + .long 2000712574 + .long 1071777389 + .long 3125257108 + .long 1071780989 + .long 3160324803 + .long 1071786401 + .long 2216316974 + .long 1071790017 + .long 3875016090 + .long 1071795452 + .long 1439520610 + .long 1071799084 + .long 1298103361 + .long 1071804543 + .long 2217517956 + .long 1071810016 + .long 1191753587 + .long 1071813673 + .long 1728773900 + .long 1071819170 + .long 747445441 + .long 1071822843 + .long 1670772213 + .long 1071826522 + .long 1471209283 + .long 1071832053 + .long 3287905877 + .long 1071835748 + .long 594038131 + .long 1071841304 + .long 3920147917 + .long 1071845015 + .long 3957142762 + .long 1071850595 + .long 826988438 + .long 1071854324 + .long 242509008 + .long 1071859929 + .long 4173610350 + .long 1071863673 + .long 2518313625 + .long 1071867425 + .long 2671523434 + .long 1071873065 + .long 387544807 + .long 1071876834 + .long 1470497767 + .long 1071880609 + .long 4269259217 + .long 1071886284 + .long 1345663925 + .long 1071890077 + .long 2159323299 + .long 1071893876 + .long 957937516 + .long 1071899588 + .long 2994656967 + .long 1071903404 + .long 556124819 + .long 1071907228 + .long 1631098658 + .long 1071912976 + .long 1368257861 + .long 1071916817 + .long 1309849279 + .long 1071920665 + .long 1567156841 + .long 1071924520 + .long 1179420986 + .long 1071930316 + .long 569448444 + .long 1071934189 + .long 669557459 + .long 1071938069 + .long 1593834700 + .long 1071941956 + .long 3166083125 + .long 1071947800 + .long 211641815 + .long 1071951706 + .long 2780675719 + .long 1071955618 + .long 2400234567 + .long 1071959538 + .long 3482927192 + .long 1071963465 + .long 1852089988 + .long 1071967400 + .long 1020849000 + .long 1071973316 + .long 1718090839 + .long 1071977269 + .long 121152472 + .long 1071981230 + .long 646346839 + .long 1071985198 + .long 3415709705 + .long 1071989173 + .long 4257004898 + .long 1071993156 + .long 3293664199 + .long 1071997147 + .long 649825382 + .long 1072001146 + .long 248887552 + .long 1072007158 + .long 2541522737 + .long 1072011175 + .long 3593780107 + .long 1072015200 + .long 3533041935 + .long 1072019233 + .long 2487426809 + .long 1072023274 + .long 585795318 + .long 1072027323 + .long 2252723088 + .long 1072031379 + .long 3323604690 + .long 1072035443 + .long 3929561382 + .long 1072039515 + .long 4202479723 + .long 1072043595 + .long 4275017539 + .long 1072047683 + .type static_const_table,@object + .size static_const_table,7024 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/clogl.S b/external/sgx_libm/ia32/clogl.S new file mode 100644 index 0000000000..995d8729e9 --- /dev/null +++ b/external/sgx_libm/ia32/clogl.S @@ -0,0 +1,751 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clogl.c" + .text +..TXTST0: +# -- Begin clogl + .text + .align 16,0x90 + .globl clogl +clogl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + movl %edx, 124(%esp) + fstpt 100(%esp) + fldt 100(%esp) + fstpt 112(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.78 +..B1.4: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.5: + fldcw 12(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %ecx + andl $32767, %ecx + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $32767, %ecx + jge ..B1.47 +..B1.8: + cmpl $32767, %edx + jge ..B1.89 +..B1.9: + testl %ecx, %ecx + jne ..B1.15 +..B1.10: + cmpl $0, 16(%ebp) + jne ..B1.15 +..B1.11: + cmpl $0, 12(%ebp) + jne ..B1.15 +..B1.12: + testl %edx, %edx + jne ..B1.15 +..B1.13: + cmpl $0, 28(%ebp) + jne ..B1.15 +..B1.14: + cmpl $0, 24(%ebp) + je ..B1.46 +..B1.15: + fldt 12(%ebp) + fld %st(0) + fabs + fstpt (%esp) + fldt (%esp) + fldt 24(%ebp) + fld %st(0) + fabs + fstpt 16(%esp) + fldt 16(%esp) + movzwl 8(%esp), %ecx + movzwl 24(%esp), %edx + andl $32767, %ecx + andl $32767, %edx + cmpl %edx, %ecx + jl ..B1.20 +..B1.16: + jne ..B1.21 +..B1.17: + movl 4(%esp), %edx + movl 20(%esp), %eax + cmpl %eax, %edx + jb ..B1.20 +..B1.18: + jne ..B1.21 +..B1.19: + movl (%esp), %edx + cmpl 16(%esp), %edx + jae ..B1.21 +..B1.20: + fstpt (%esp) + fldt (%esp) + movzwl 8(%esp), %ecx + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + andl $32767, %ecx +..B1.21: + cmpl $16382, %ecx + jg ..B1.26 +..B1.22: + jne ..B1.43 +..B1.23: + movl 4(%esp), %edx + cmpl 16+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.26 +..B1.24: + jne ..B1.43 +..B1.25: + movl 12+_CONSTANTS@GOTOFF(%ebx), %edx + cmpl (%esp), %edx + ja ..B1.43 +..B1.26: + cmpl $16383, %ecx + jl ..B1.31 +..B1.27: + jne ..B1.43 +..B1.28: + movl 4(%esp), %edx + cmpl 28+_CONSTANTS@GOTOFF(%ebx), %edx + jb ..B1.31 +..B1.29: + jne ..B1.43 +..B1.30: + movl (%esp), %edx + cmpl 24+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.43 +..B1.31: + movzwl 24(%esp), %edx + andl $32767, %edx + cmpl $8256, %edx + jg ..B1.36 +..B1.32: + jne ..B1.37 +..B1.33: + movl 20(%esp), %eax + cmpl 64+_CONSTANTS@GOTOFF(%ebx), %eax + ja ..B1.36 +..B1.34: + jne ..B1.37 +..B1.35: + movl 16(%esp), %eax + cmpl 60+_CONSTANTS@GOTOFF(%ebx), %eax + jbe ..B1.37 +..B1.36: + fldt _CONSTANTS@GOTOFF(%ebx) + fld %st(3) + fmul %st(4), %st + fld %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + fsubr %st, %st(1) + fxch %st(1) + fabs + fxch %st(2) + fcomp %st(2) + fnstsw %ax + sahf + fxch %st(1) + ja ..B1.38 + jmp ..B1.90 +..B1.37: + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + fld %st(3) + fmul %st(4), %st + fsub %st(1), %st + fabs + fldt _CONSTANTS@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.90 +..B1.38: + cmpl $16183, %edx + jl ..B1.40 +..B1.39: + fstp %st(0) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fld %st(4) + fxch %st(4) + fstpt (%esp) + fxch %st(5) + fstpt 16(%esp) + fld %st(3) + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + fsub %st, %st(4) + fsubp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fld %st(3) + fxch %st(5) + fsubr %st, %st(6) + fxch %st(2) + fmul %st(4), %st + fsub %st, %st(5) + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fxch %st(4) + fsub %st(5), %st + fxch %st(5) + fmul %st(7), %st + fmul %st(5), %st + fstpt 56(%esp) + fldt 56(%esp) + fxch %st(5) + fmul %st(0), %st + fstpt 72(%esp) + fld %st(0) + fadd %st(4), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(6) + fmulp %st, %st(1) + fmul %st(4), %st + fxch %st(1) + fsubrp %st, %st(5) + fld %st(4) + fadd %st(2), %st + fld %st(0) + fsub %st(6), %st + fsubr %st, %st(3) + fld %st(1) + fsubp %st, %st(1) + fsubrp %st, %st(6) + fxch %st(5) + faddp %st, %st(2) + fld %st(4) + fadd %st(1), %st + fld %st(0) + faddp %st, %st(4) + fld %st(3) + fxch %st(5) + fmul %st(0), %st + fstpt 40(%esp) + fldt 40(%esp) + faddp %st, %st(5) + fxch %st(4) + fstpt 88(%esp) + fldt 88(%esp) + fldt 72(%esp) + faddp %st, %st(1) + fldt 12+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + fldt _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fmulp %st, %st(1) + fld %st(5) + fsub %st(7), %st + fsubr %st, %st(3) + fsubr %st(6), %st + fsubrp %st, %st(7) + fxch %st(6) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fsub %st(4), %st + fldt 56(%esp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(5) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldt 88(%esp) + fld %st(0) + fsub %st(3), %st + fldt 40(%esp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fsub %st(2), %st + fldt 72(%esp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 100(%esp) + addl $-32, %esp + fldt 32(%esp) + fstpt (%esp) + fldt 48(%esp) + fstpt 12(%esp) + call atan2l@PLT + jmp ..B1.87 +..B1.40: + cmpl $16383, %ecx + je ..B1.54 +..B1.41: + fstp %st(2) + fxch %st(1) + fstpt 28(%esp) +..B1.42: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fmul %st(3), %st + fld %st(3) + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fsubp %st, %st(2) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(3), %st + fld %st(0) + fxch %st(4) + fmul %st(0), %st + fadd %st, %st(4) + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(1) + fld %st(1) + fadd %st(4), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + faddp %st, %st(3) + fld %st(0) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fldt _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 100(%esp) + addl $-32, %esp + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT + jmp ..B1.87 +..B1.43: + fstp %st(2) + fstp %st(1) + addl $-32, %esp + lea 72(%esp), %edx + movl %edx, (%esp) + fxch %st(1) + fstpt 4(%esp) + fstpt 16(%esp) + call __libm_hypot2l_k80 +..B1.83: + addl $32, %esp +..B1.44: + fldt 36+_CONSTANTS@GOTOFF(%ebx) + fmul %st(1), %st + fstpt 16(%esp) + fldt 48+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) + addl $-32, %esp + fldt 72(%esp) + lea 96(%esp), %edx + fstpt (%esp) + fldt -12(%edx) + fstpt 12(%esp) + movl %edx, 24(%esp) + call __libm_logl_k80 +..B1.84: + addl $32, %esp +..B1.45: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmulp %st, %st(1) + fldt 64(%esp) + fmul %st(1), %st + fldt 76(%esp) + fmulp %st, %st(2) + fldt 16(%esp) + fld %st(0) + fadd %st(2), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt (%esp) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 100(%esp) + addl $-32, %esp + fldt 24(%ebp) + fstpt (%esp) + fldt 12(%ebp) + fstpt 12(%esp) + call atan2l@PLT + jmp ..B1.87 +..B1.46: + fldt 24(%ebp) + fldz + fldt 12(%ebp) + fxch %st(1) + fdivrl .L_2il0floatpacket.8@GOTOFF(%ebx) + fstpt 100(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT + jmp ..B1.87 +..B1.47: + je ..B1.71 +..B1.48: + cmpl $32767, %edx + je ..B1.64 +..B1.49: + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fmul %st(0), %st + fstpt 100(%esp) + addl $-32, %esp + fldt 24(%ebp) + fstpt (%esp) + fldt 12(%ebp) + fstpt 12(%esp) + call atan2l@PLT +..B1.87: + addl $32, %esp + fstpt 112(%esp) +..B1.50: + testl %edi, %edi + je ..B1.52 +..B1.51: + fldcw 14(%esp) +..B1.52: + movl 100(%esp), %edx + movl %edx, (%esi) + movl 112(%esp), %edx + movl %edx, 12(%esi) + movl 116(%esp), %edx + movl %edx, 16(%esi) + movl 104(%esp), %ecx + movl 108(%esp), %edi + movl 120(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 124(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.63 +..B1.53: + movl %esi, %eax + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.54: + cmpl $-2147483648, 4(%esp) + jne ..B1.41 +..B1.56: + cmpl $0, (%esp) + jne ..B1.41 +..B1.58: + fstp %st(0) + fstp %st(0) + fstp %st(2) + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + fstpt 28(%esp) + fldt 28(%esp) + movzwl 36(%esp), %edx + testl $32767, %edx + jne ..B1.62 +..B1.59: + cmpl $0, 32(%esp) + jne ..B1.61 +..B1.60: + cmpl $0, 28(%esp) + je ..B1.62 +..B1.61: + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fmul %st(0), %st + faddp %st, %st(1) + fstpt 28(%esp) + fldt 28(%esp) +..B1.62: + fstpt 100(%esp) + addl $-32, %esp + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT + jmp ..B1.87 +..B1.63: + call __stack_chk_fail@PLT +..B1.64: + cmpl $-2147483648, 28(%ebp) + jne ..B1.66 +..B1.65: + cmpl $0, 24(%ebp) + je ..B1.49 +..B1.66: + fldt 24(%ebp) + cmpl $32767, %ecx + fmul %st(0), %st + fstpt 112(%esp) + fldt 112(%esp) + je ..B1.68 +..B1.67: + fstpt 100(%esp) + jmp ..B1.50 +..B1.68: + cmpl $-2147483648, 16(%ebp) + jne ..B1.67 +..B1.69: + cmpl $0, 12(%ebp) + jne ..B1.67 +..B1.70: + fstp %st(0) + fldt 12(%ebp) + fmul %st(0), %st + fstpt 100(%esp) + jmp ..B1.50 +..B1.71: + cmpl $-2147483648, 16(%ebp) + jne ..B1.73 +..B1.72: + cmpl $0, 12(%ebp) + je ..B1.48 +..B1.73: + fldt 12(%ebp) + cmpl $32767, %edx + fld %st(0) + fmul %st(1), %st + fstpt 112(%esp) + je ..B1.75 +..B1.74: + fldt 24(%ebp) + fmulp %st, %st(1) + fstpt 100(%esp) + jmp ..B1.50 +..B1.75: + cmpl $-2147483648, 28(%ebp) + jne ..B1.74 +..B1.76: + cmpl $0, 24(%ebp) + jne ..B1.74 +..B1.77: + fstp %st(0) + fldt 24(%ebp) + fmul %st(0), %st + fstpt 100(%esp) + jmp ..B1.50 +..B1.78: + xorl %edi, %edi + jmp ..B1.7 +..B1.89: + cmpl $32767, %ecx + je ..B1.71 + jmp ..B1.48 +..B1.90: + fstp %st(0) + fstp %st(0) + jmp ..B1.43 + .align 16,0x90 + .type clogl,@function + .size clogl,.-clogl + .data +# -- End clogl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16358 + .word 0 + .word 37342 + .word 47265 + .word 62214 + .word 46340 + .word 16382 + .word 0 + .word 64512 + .word 65535 + .word 31 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 53710 + .word 6135 + .word 45426 + .word 16381 + .word 0 + .word 505 + .word 55756 + .word 58609 + .word 48341 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8256 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,96 + .align 16 +_Q1: + .word 3134 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 49331 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .type _Q1,@object + .size _Q1,24 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .data + .hidden __libm_logl_k80 + .hidden __libm_hypot2l_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/complex_real.S b/external/sgx_libm/ia32/complex_real.S new file mode 100644 index 0000000000..8bcc1ddca2 --- /dev/null +++ b/external/sgx_libm/ia32/complex_real.S @@ -0,0 +1,291 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "complex_real.c" + .text +..TXTST0: +# -- Begin __libm_internal_isinf + .text + .align 16,0x90 + .hidden __libm_internal_isinf + .globl __libm_internal_isinf +__libm_internal_isinf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + jne ..B1.4 +..B1.2: + cmpl $0, 4(%esp) + jne ..B1.4 +..B1.3: + movl $1, %eax + ret +..B1.4: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_isinf,@function + .size __libm_internal_isinf,.-__libm_internal_isinf + .data +# -- End __libm_internal_isinf + .text +# -- Begin __libm_internal_ispinf + .text + .align 16,0x90 + .hidden __libm_internal_ispinf + .globl __libm_internal_ispinf +__libm_internal_ispinf: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + cmpl $2146435072, 8(%esp) + jne ..B2.4 +..B2.2: + cmpl $0, 4(%esp) + jne ..B2.4 +..B2.3: + movl $1, %eax + ret +..B2.4: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_ispinf,@function + .size __libm_internal_ispinf,.-__libm_internal_ispinf + .data +# -- End __libm_internal_ispinf + .text +# -- Begin __libm_internal_isninf + .text + .align 16,0x90 + .hidden __libm_internal_isninf + .globl __libm_internal_isninf +__libm_internal_isninf: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + cmpl $-1048576, 8(%esp) + jne ..B3.4 +..B3.2: + cmpl $0, 4(%esp) + jne ..B3.4 +..B3.3: + movl $1, %eax + ret +..B3.4: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_isninf,@function + .size __libm_internal_isninf,.-__libm_internal_isninf + .data +# -- End __libm_internal_isninf + .text +# -- Begin __libm_internal_isnan + .text + .align 16,0x90 + .hidden __libm_internal_isnan + .globl __libm_internal_isnan +__libm_internal_isnan: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + movl 8(%esp), %edx + movl %edx, %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + jne ..B4.5 +..B4.2: + testl $1048575, %edx + jne ..B4.4 +..B4.3: + cmpl $0, 4(%esp) + je ..B4.5 +..B4.4: + movl $1, %eax + ret +..B4.5: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_isnan,@function + .size __libm_internal_isnan,.-__libm_internal_isnan + .data +# -- End __libm_internal_isnan + .text +# -- Begin __libm_internal_isposzero + .text + .align 16,0x90 + .hidden __libm_internal_isposzero + .globl __libm_internal_isposzero +__libm_internal_isposzero: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + cmpl $0, 8(%esp) + jne ..B5.4 +..B5.2: + cmpl $0, 4(%esp) + jne ..B5.4 +..B5.3: + movl $1, %eax + ret +..B5.4: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_isposzero,@function + .size __libm_internal_isposzero,.-__libm_internal_isposzero + .data +# -- End __libm_internal_isposzero + .text +# -- Begin __libm_internal_iszero + .text + .align 16,0x90 + .hidden __libm_internal_iszero + .globl __libm_internal_iszero +__libm_internal_iszero: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + testl $2147483647, 8(%esp) + jne ..B6.4 +..B6.2: + cmpl $0, 4(%esp) + jne ..B6.4 +..B6.3: + movl $1, %eax + ret +..B6.4: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_iszero,@function + .size __libm_internal_iszero,.-__libm_internal_iszero + .data +# -- End __libm_internal_iszero + .text +# -- Begin __libm_internal_isnegzero + .text + .align 16,0x90 + .hidden __libm_internal_isnegzero + .globl __libm_internal_isnegzero +__libm_internal_isnegzero: +# parameter 1: 4 + %esp +..B7.1: +..L7: + + cmpl $-2147483648, 8(%esp) + jne ..B7.4 +..B7.2: + cmpl $0, 4(%esp) + jne ..B7.4 +..B7.3: + movl $1, %eax + ret +..B7.4: + xorl %eax, %eax + ret + .align 16,0x90 + .type __libm_internal_isnegzero,@function + .size __libm_internal_isnegzero,.-__libm_internal_isnegzero + .data +# -- End __libm_internal_isnegzero + .text +# -- Begin __libm_internal_isnzfinite + .text + .align 16,0x90 + .hidden __libm_internal_isnzfinite + .globl __libm_internal_isnzfinite +__libm_internal_isnzfinite: +# parameter 1: 4 + %esp +..B8.1: +..L8: + + movl 8(%esp), %edx + movl %edx, %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + jae ..B8.3 +..B8.2: + andl $2147483647, %edx + orl 4(%esp), %edx + jne ..B8.4 +..B8.3: + xorl %eax, %eax + ret +..B8.4: + movl $1, %eax + ret + .align 16,0x90 + .type __libm_internal_isnzfinite,@function + .size __libm_internal_isnzfinite,.-__libm_internal_isnzfinite + .data +# -- End __libm_internal_isnzfinite + .text +# -- Begin __libm_internal_isfinite + .text + .align 16,0x90 + .hidden __libm_internal_isfinite + .globl __libm_internal_isfinite +__libm_internal_isfinite: +# parameter 1: 4 + %esp +..B9.1: +..L9: + + movl 8(%esp), %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __libm_internal_isfinite,@function + .size __libm_internal_isfinite,.-__libm_internal_isfinite + .data +# -- End __libm_internal_isfinite + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/conj.S b/external/sgx_libm/ia32/conj.S new file mode 100644 index 0000000000..0ecb94916a --- /dev/null +++ b/external/sgx_libm/ia32/conj.S @@ -0,0 +1,91 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "conj.c" + .text +..TXTST0: +# -- Begin conj + .text + .align 16,0x90 + .globl conj +conj: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp + fldl 12(%ebp) + fldl 20(%ebp) + movl 8(%ebp), %eax + fchs + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 16(%esp) + movl 16(%ebp), %edx + movl 12(%ebp), %ecx + fstpl 8(%esp) + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%esp), %ecx + movl 12(%esp), %edx + fstpl (%esp) + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + movl 16(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.3 +..B1.2: + movl %ebp, %esp + popl %ebp + ret $4 +..B1.3: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type conj,@function + .size conj,.-conj + .data +# -- End conj + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/conjf.S b/external/sgx_libm/ia32/conjf.S new file mode 100644 index 0000000000..69b5023b59 --- /dev/null +++ b/external/sgx_libm/ia32/conjf.S @@ -0,0 +1,65 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "conjf.c" + .text +..TXTST0: +# -- Begin conjf + .text + .align 16,0x90 + .globl conjf +conjf: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + flds 20(%esp) + fchs + fstps 4(%esp) + movl 16(%esp), %eax + movl 4(%esp), %edx + movl %eax, (%esp) + addl $12, %esp + ret + .align 16,0x90 + .type conjf,@function + .size conjf,.-conjf + .data +# -- End conjf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/conjl.S b/external/sgx_libm/ia32/conjl.S new file mode 100644 index 0000000000..795764f468 --- /dev/null +++ b/external/sgx_libm/ia32/conjl.S @@ -0,0 +1,98 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "conjl.c" + .text +..TXTST0: +# -- Begin conjl + .text + .align 16,0x90 + .globl conjl +conjl: +# parameter 1: 36 + %esp +..B1.1: +..L1: + + subl $28, %esp + fldt 36(%esp) + fldt 48(%esp) + movl 32(%esp), %eax + fchs + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 24(%esp) + movl 40(%esp), %edx + movl 36(%esp), %ecx + fstpt 12(%esp) + fstpt (%esp) + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%esp), %ecx + movl 12(%esp), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + movl 16(%esp), %ecx + movl 20(%esp), %edx + movl %ecx, 16(%eax) + movl %edx, 20(%eax) + movl 24(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.3 +..B1.2: + addl $28, %esp + ret $4 +..B1.3: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type conjl,@function + .size conjl,.-conjl + .data +# -- End conjl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/copysign_wmt.S b/external/sgx_libm/ia32/copysign_wmt.S new file mode 100644 index 0000000000..ecd9d241b4 --- /dev/null +++ b/external/sgx_libm/ia32/copysign_wmt.S @@ -0,0 +1,108 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "copysign_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin copysign + .text + .align 16,0x90 + .globl copysign +copysign: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 120(%esp), %xmm1 + xorpd %xmm3, %xmm3 + addsd %xmm1, %xmm3 + movq (%ebx), %xmm2 + pand %xmm2, %xmm0 + pandn %xmm1, %xmm2 + por %xmm2, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type copysign,@function + .size copysign,.-copysign + .data +# -- End copysign + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/copysignf_wmt.S b/external/sgx_libm/ia32/copysignf_wmt.S new file mode 100644 index 0000000000..dd79812725 --- /dev/null +++ b/external/sgx_libm/ia32/copysignf_wmt.S @@ -0,0 +1,118 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "copysignf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin copysignf + .text + .align 16,0x90 + .globl copysignf +copysignf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 36(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + movl 112(%esp), %eax + movl 116(%esp), %ecx + ucomiss %xmm0, %xmm0 + jp .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + ucomiss %xmm1, %xmm1 + andl $2147483647, %eax + andl $-2147483648, %ecx + orl %ecx, %eax + movl %eax, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + xorps %xmm2, %xmm2 + addss %xmm2, %xmm0 + movd %xmm0, %eax + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + movl 36(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type copysignf,@function + .size copysignf,.-copysignf + .data +# -- End copysignf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/copysignl.S b/external/sgx_libm/ia32/copysignl.S new file mode 100644 index 0000000000..ef77a51b39 --- /dev/null +++ b/external/sgx_libm/ia32/copysignl.S @@ -0,0 +1,119 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "copysignl.c" + .text +..TXTST0: +# -- Begin copysignl + .text + .align 16,0x90 + .globl copysignl +copysignl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $48, %esp + fldt 8(%ebp) + fstpt 24(%esp) +..B1.2: + fnstcw 38(%esp) +..B1.3: + movzwl 38(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.10 +..B1.4: + orl $-64768, %edx + movw %dx, 36(%esp) +..B1.5: + fldcw 36(%esp) +..B1.6: + movl $1, %eax +..B1.7: + fldt 20(%ebp) + fldt 24(%esp) + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + movzbl 29(%ebp), %ecx + andl $-128, %ecx + fldl _ones@GOTOFF(%edx) + fmul %st, %st(1) + fxch %st(1) + fstpt 12(%esp) + fmulp %st, %st(1) + movzbl 21(%esp), %edx + andl $127, %edx + orl %ecx, %edx + fstpt (%esp) + testl %eax, %eax + movb %dl, 21(%esp) + je ..B1.9 +..B1.8: + fldcw 38(%esp) +..B1.9: + fldt 12(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.10: + xorl %eax, %eax + jmp ..B1.7 + .align 16,0x90 + .type copysignl,@function + .size copysignl,.-copysignl + .data +# -- End copysignl + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cos_wmt.S b/external/sgx_libm/ia32/cos_wmt.S new file mode 100644 index 0000000000..2b50954709 --- /dev/null +++ b/external/sgx_libm/ia32/cos_wmt.S @@ -0,0 +1,765 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cos_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin cos + .text + .align 16,0x90 + .globl cos +cos: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 56(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + pextrw $3, %xmm0, %eax + andl $32767, %eax + subl $12336, %eax + cmpl $4293, %eax + ja .L_2TAG_PACKET_0.0.2 + movsd 2160(%ebx), %xmm1 + mulsd %xmm0, %xmm1 + movapd 2240(%ebx), %xmm5 + movsd 2224(%ebx), %xmm4 + andpd %xmm0, %xmm4 + orps %xmm4, %xmm5 + movsd 2128(%ebx), %xmm3 + movapd 2112(%ebx), %xmm2 + addpd %xmm5, %xmm1 + cvttsd2si %xmm1, %edx + cvtsi2sdl %edx, %xmm1 + mulsd %xmm1, %xmm3 + unpcklpd %xmm1, %xmm1 + addl $1865232, %edx + movapd %xmm0, %xmm4 + andl $63, %edx + movapd 2096(%ebx), %xmm5 + lea (%ebx), %eax + shll $5, %edx + addl %edx, %eax + mulpd %xmm1, %xmm2 + subsd %xmm3, %xmm0 + mulsd 2144(%ebx), %xmm1 + subsd %xmm3, %xmm4 + movsd 8(%eax), %xmm7 + unpcklpd %xmm0, %xmm0 + movapd %xmm4, %xmm3 + subsd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + movapd 2064(%ebx), %xmm6 + mulsd %xmm4, %xmm7 + subsd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subsd %xmm2, %xmm3 + movapd (%eax), %xmm2 + subsd %xmm3, %xmm1 + movsd 24(%eax), %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm7 + mulsd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulsd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm0 + addpd 2080(%ebx), %xmm5 + mulsd (%eax), %xmm4 + addpd 2048(%ebx), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addsd 8(%eax), %xmm3 + mulpd %xmm7, %xmm1 + movapd %xmm4, %xmm7 + addsd %xmm3, %xmm4 + addpd %xmm5, %xmm6 + movsd 8(%eax), %xmm5 + subsd %xmm3, %xmm5 + subsd %xmm4, %xmm3 + addsd 16(%eax), %xmm1 + mulpd %xmm2, %xmm6 + addsd %xmm0, %xmm5 + addsd %xmm7, %xmm3 + addsd %xmm5, %xmm1 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + unpckhpd %xmm6, %xmm6 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm4 + movsd %xmm4, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + jg .L_2TAG_PACKET_2.0.2 + pextrw $3, %xmm0, %eax + andl $32767, %eax + pinsrw $3, %eax, %xmm0 + movsd 2192(%ebx), %xmm1 + subsd %xmm0, %xmm1 + movsd %xmm1, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + movl 132(%esp), %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + je .L_2TAG_PACKET_3.0.2 + subl $32, %esp + movsd %xmm0, (%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $1, %eax + movl %eax, 12(%esp) + call __libm_sincos_huge + addl $32, %esp + fldl 8(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_3.0.2: + fldl 128(%esp) + fmull 2208(%ebx) +.L_2TAG_PACKET_1.0.2: + movl 56(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type cos,@function + .size cos,.-cos + .data +# -- End cos + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 1072693248 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1071644672 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 1071644672 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1070596096 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 1070596096 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1069547520 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 3217031168 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 3218079744 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 3218079744 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 3219128320 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 3220176896 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3219128320 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 3219128320 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3218079744 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 3218079744 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 1069547520 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 1070596096 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 1070596096 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 1071644672 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 1072693248 + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .long 1413480448 + .long 1069097467 + .long 0 + .long 0 + .long 771977331 + .long 996350346 + .long 0 + .long 0 + .long 1841940611 + .long 1076125488 + .long 0 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .type static_const_table,@object + .size static_const_table,2256 + .data + .hidden __libm_sincos_huge + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cosdl.S b/external/sgx_libm/ia32/cosdl.S new file mode 100644 index 0000000000..384287a1c8 --- /dev/null +++ b/external/sgx_libm/ia32/cosdl.S @@ -0,0 +1,689 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosdl.c" + .text +..TXTST0: +# -- Begin cosdl + .text + .align 16,0x90 + .globl cosdl +cosdl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp +..B1.2: + fnstcw 30(%esp) +..B1.3: + movzwl 30(%esp), %edx + movl %edx, %eax + andl $3840, %eax + cmpl $768, %eax + je ..B1.38 +..B1.4: + andl $-3841, %edx + orl $-64768, %edx + movw %dx, 28(%esp) +..B1.5: + fldcw 28(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 16(%ebp), %esi + andl $32767, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $16446, %esi + jge ..B1.19 +..B1.8: + cmpl $16318, %esi + jge ..B1.12 +..B1.9: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fldt 8(%ebp) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + testl %edi, %edi + fmuls ones@GOTOFF(%ebx,%eax,4) + fsubrp %st, %st(1) + fstpt (%esp) + je ..B1.11 +..B1.10: + fldcw 30(%esp) +..B1.11: + fldt (%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.12: + fldt 8(%ebp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fldt _Rcp90@GOTOFF(%ebx) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fxch %st(4) + fmuls ones@GOTOFF(%ebx,%edx,4) + fmul %st, %st(2) + fxch %st(2) + fadd %st(3), %st + fstpt 92(%esp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 92(%esp) + movl 92(%esp), %edx + fsubp %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + incl %edx + movl %edx, %ecx + fsubrp %st, %st(1) + andl $2, %ecx + fucom %st(1) + fnstsw %ax + fxch %st(1) + fstp %st(0) + shrl $1, %ecx + sahf + jp ..B1.13 + je ..B1.31 +..B1.13: + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + testb $1, %dl + fmul %st(1), %st + fld %st(1) + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(2) + fsub %st(2), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(3) + fld %st(1) + fld %st(4) + fldl _TWO_53H@GOTOFF(%ebx) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fld %st(5) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fstpt 80(%esp) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + flds ones@GOTOFF(%ebx,%ecx,4) + fstps 12(%esp) + je ..B1.15 +..B1.14: + fstp %st(6) + fstp %st(2) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(1) + fld %st(2) + fmul %st(5), %st + fxch %st(4) + fstpt (%esp) + fldt (%esp) + fld %st(3) + fmul %st(7), %st + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(5) + fld %st(1) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(1) + faddp %st, %st(3) + fldt 84+_cosdl_poly_coeff@GOTOFF(%ebx) + fmul %st(5), %st + fldt 60+_cosdl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 36+_cosdl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_cosdl_poly_coeff@GOTOFF(%ebx) + fmul %st(6), %st + fldt 48+_cosdl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(6), %st + fldt 24+_cosdl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl 24+_cosdl_mp_poly_coeff@GOTOFF(%ebx) + fmulp %st, %st(5) + faddp %st, %st(4) + fldl 8+_cosdl_mp_poly_coeff@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 16+_cosdl_mp_poly_coeff@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldl _cosdl_mp_poly_coeff@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%esp) + fmulp %st, %st(2) + fld %st(1) + fldt 16(%esp) + fmulp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + flds 12(%esp) + fld %st(0) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fld %st(0) + fadd %st(4), %st + fmul %st, %st(2) + fsubrp %st, %st(1) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.16 +..B1.15: + fld %st(6) + fmul %st(2), %st + fstpt 32(%esp) + fld %st(4) + fmul %st(4), %st + fmul %st, %st(3) + fxch %st(6) + fmul %st(7), %st + fxch %st(2) + fstpt 16(%esp) + fxch %st(3) + fstpt (%esp) + fldt 80(%esp) + fmul %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(4) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 96+_sindl_poly_coeff@GOTOFF(%ebx) + fmul %st(1), %st + fldt 72+_sindl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_sindl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_sindl_poly_coeff@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 60+_sindl_poly_coeff@GOTOFF(%ebx) + fldt 36+_sindl_poly_coeff@GOTOFF(%ebx) + fldt 16(%esp) + fmulp %st, %st(3) + fldt 84+_sindl_poly_coeff@GOTOFF(%ebx) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 32(%esp) + fmul %st, %st(1) + fldl 24+_sindl_mp_poly_coeff@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl 8+_sindl_mp_poly_coeff@GOTOFF(%ebx) + fmulp %st, %st(4) + faddp %st, %st(3) + fldl 16+_sindl_mp_poly_coeff@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldl _sindl_mp_poly_coeff@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%esp) + fmulp %st, %st(2) + fld %st(1) + fldt 48(%esp) + fmulp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + flds 12(%esp) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 64(%esp) +..B1.16: + testl %edi, %edi + je ..B1.18 +..B1.17: + fldcw 30(%esp) +..B1.18: + fldt 64(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + cmpl $32767, %esi + je ..B1.37 +..B1.20: + lea -16446(%esi), %ecx + cmpl $14, %ecx + jle ..B1.22 +..B1.21: + addl $-16449, %esi + movl $715827883, %eax + imull %esi + movl %esi, %ecx + sarl $1, %edx + sarl $31, %ecx + subl %ecx, %edx + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %eax + subl %eax, %esi + lea 3(%esi), %ecx +..B1.22: + movl %edi, (%esp) + movl $381774871, %eax + movl 12(%ebp), %edi + movl %edi, %esi + shll $8, %esi + andl $-16777216, %edi + movl %esi, %edx + shrl $3, %edx + mull %edx + shrl $2, %edx + imull $-360, %edx, %eax + movl %edi, %edx + shrl $19, %edi + addl %eax, %esi + movl $381774871, %eax + shrl $16, %edx + movl %edx, 4(%esp) + mull %edi + shrl $2, %edx + imull $-360, %edx, %edi + movl 4(%esp), %eax + addl %edi, %eax + movl 8(%ebp), %edi + movl %edi, %edx + shrl $3, %edx + addl %eax, %esi + movl $381774871, %eax + mull %edx + shrl $2, %edx + imull $-360, %edx, %eax + addl %eax, %edi + movl $-1240768329, %eax + addl %edi, %esi + shll %cl, %esi + imull %esi + addl %esi, %edx + movl %esi, %ecx + sarl $8, %edx + sarl $31, %ecx + subl %ecx, %edx + imull $-360, %edx, %eax + addl %eax, %esi + movl (%esp), %edi + cmpl $180, %esi + jl ..B1.24 +..B1.23: + addl $-180, %esi + movl $3, %eax + jmp ..B1.25 +..B1.24: + movl $1, %eax +..B1.25: + cmpl $90, %esi + jl ..B1.27 +..B1.26: + incl %eax + addl $-90, %esi +..B1.27: + movl %eax, %edx + andl $1, %eax + shll $4, %eax + andl $2, %edx + shll $5, %esi + addl %esi, %eax + shrl $1, %edx + fldl __libm_sindl_cosdl_table@GOTOFF(%eax,%ebx) + faddl 8+__libm_sindl_cosdl_table@GOTOFF(%ebx,%eax) + fmuls ones@GOTOFF(%ebx,%edx,4) + fstpt (%esp) +..B1.28: + testl %edi, %edi + je ..B1.30 +..B1.29: + fldcw 30(%esp) +..B1.30: + fldt (%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + fstp %st(0) + testb $1, %dl + je ..B1.33 +..B1.32: + flds ones@GOTOFF(%ebx,%ecx,4) + fstps (%esp) + jmp ..B1.34 +..B1.33: + fldz + fstps (%esp) +..B1.34: + testl %edi, %edi + je ..B1.36 +..B1.35: + fldcw 30(%esp) +..B1.36: + flds (%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.37: + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.28 +..B1.38: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type cosdl,@function + .size cosdl,.-cosdl + .data +# -- End cosdl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3e,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x05,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +_cosdl_poly_coeff: + .word 52350 + .word 41213 + .word 3800 + .word 40885 + .word 49138 + .word 0 + .word 28613 + .word 7908 + .word 35668 + .word 34008 + .word 16355 + .word 0 + .word 19927 + .word 58728 + .word 49885 + .word 45261 + .word 49106 + .word 0 + .word 32884 + .word 22035 + .word 23267 + .word 64541 + .word 16320 + .word 0 + .word 36401 + .word 51897 + .word 8309 + .word 57265 + .word 49070 + .word 0 + .word 34286 + .word 2728 + .word 41564 + .word 34642 + .word 16284 + .word 0 + .word 63248 + .word 18030 + .word 35596 + .word 60796 + .word 49032 + .word 0 + .word 52149 + .word 21294 + .word 63985 + .word 40123 + .word 16245 + .word 0 + .type _cosdl_poly_coeff,@object + .size _cosdl_poly_coeff,96 + .align 16 +_cosdl_mp_poly_coeff: + .long 3675529145 + .long 3206805153 + .long 2134983071 + .long 3151100167 + .long 1787026573 + .long 1043372817 + .long 205083639 + .long 988746860 + .type _cosdl_mp_poly_coeff,@object + .size _cosdl_mp_poly_coeff,32 + .align 16 +_sindl_poly_coeff: + .word 51374 + .word 38121 + .word 13586 + .word 36602 + .word 16377 + .word 0 + .word 50116 + .word 41339 + .word 4204 + .word 60892 + .word 49130 + .word 0 + .word 33704 + .word 2155 + .word 42839 + .word 60780 + .word 16346 + .word 0 + .word 21250 + .word 19076 + .word 27901 + .word 57780 + .word 49097 + .word 0 + .word 9076 + .word 49244 + .word 613 + .word 64083 + .word 16311 + .word 0 + .word 40572 + .word 30418 + .word 36251 + .word 46520 + .word 49061 + .word 0 + .word 3227 + .word 25505 + .word 5540 + .word 47626 + .word 16274 + .word 0 + .word 60933 + .word 3300 + .word 57416 + .word 36218 + .word 49023 + .word 0 + .word 45811 + .word 42646 + .word 37125 + .word 42185 + .word 16235 + .word 0 + .type _sindl_poly_coeff,@object + .size _sindl_poly_coeff,108 + .space 4, 0x00 # pad + .align 16 +_sindl_mp_poly_coeff: + .long 2723323193 + .long 1066524486 + .long 2863989530 + .long 1008058840 + .long 227815288 + .long 3199056770 + .long 3752327299 + .long 3142458725 + .type _sindl_mp_poly_coeff,@object + .size _sindl_mp_poly_coeff,32 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_Rcp90: + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 16376 + .word 0 + .type _Rcp90,@object + .size _Rcp90,12 + .data + .hidden __libm_sindl_cosdl_table + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cosf_wmt.S b/external/sgx_libm/ia32/cosf_wmt.S new file mode 100644 index 0000000000..871b6636b2 --- /dev/null +++ b/external/sgx_libm/ia32/cosf_wmt.S @@ -0,0 +1,590 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin cosf + .text + .align 16,0x90 + .globl cosf +cosf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 36(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %ecx + subl $16, %esp + stmxcsr 4(%esp) + movl 4(%esp), %eax + andl $-24577, %eax + cmpl %eax, 4(%esp) + jne .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + movapd %xmm0, %xmm1 + cvtps2pd %xmm1, %xmm1 + movsd 1296(%ebx), %xmm2 + movl $2147483647, %eax + movl $1241513983, %edx + andl %ecx, %eax + subl %eax, %edx + subl $964689920, %eax + orl %eax, %edx + jl .L_2TAG_PACKET_2.0.2 + movsd 1312(%ebx), %xmm4 + mulsd %xmm1, %xmm2 + movsd 1328(%ebx), %xmm3 + movapd %xmm2, %xmm5 + addsd %xmm4, %xmm2 + movd %xmm2, %ecx + subsd %xmm4, %xmm2 + mulsd %xmm3, %xmm1 +.L_2TAG_PACKET_3.0.2: + movl $384, %eax + movsd 1344(%ebx), %xmm4 + subsd %xmm2, %xmm5 + addl %ecx, %ecx + movl %ecx, %edx + shll $24, %ecx + sarl $31, %ecx + andl %edx, %eax + addl %ecx, %edx + xorl %ecx, %edx + addsd %xmm5, %xmm1 + andl $254, %edx + movsd (%ebx,%edx,8), %xmm3 + movsd 1352(%ebx), %xmm0 + pshufd $68, %xmm1, %xmm2 + mulsd %xmm1, %xmm1 + movsd 8(%ebx,%edx,8), %xmm5 + movl %eax, %ecx + andl $256, %ecx + shll $23, %ecx + mulsd %xmm2, %xmm3 + movd %ecx, %xmm2 + subsd %xmm1, %xmm0 + addl $128, %eax + andl $256, %eax + shll $23, %eax + subsd %xmm1, %xmm4 + psllq $32, %xmm2 + movd %eax, %xmm1 + xorpd %xmm2, %xmm4 + mulsd %xmm5, %xmm0 + mulsd %xmm4, %xmm3 + psllq $32, %xmm1 + xorpd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_4.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_4.0.2: + cvtpd2ps %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_2.0.2: + andl $2147483647, %ecx + cmpl $1040187392, %ecx + ja .L_2TAG_PACKET_6.0.2 + movl $1065353216, %eax + movd %eax, %xmm0 + cmpl $0, %ecx + je .L_2TAG_PACKET_7.0.2 + movl $805306368, %eax + movd %eax, %xmm1 + subss %xmm1, %xmm0 +.L_2TAG_PACKET_7.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_8.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_8.0.2: + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_0.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + movl %eax, 8(%esp) + ldmxcsr 8(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_6.0.2: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_9.0.2 + shrl $23, %ecx + subl $142, %ecx + andl $65528, %ecx + movsd 1040(%ebx,%ecx,2), %xmm3 + movsd 1048(%ebx,%ecx,2), %xmm5 + movsd 1360(%ebx), %xmm2 + xorpd %xmm4, %xmm4 + movl $17208, %eax + pinsrw $3, %eax, %xmm4 + andpd %xmm3, %xmm2 + psllq $40, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + movapd %xmm2, %xmm0 + addsd %xmm3, %xmm2 + movapd %xmm2, %xmm5 + subsd %xmm2, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm0, %xmm3 + movd %xmm2, %ecx + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_9.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_10.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_10.0.2: + subss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_5.0.2: + addl $16, %esp + movl 36(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type cosf,@function + .size cosf,.-cosf + .data +# -- End cosf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 3384690142 + .long 1060355388 + .long 918535681 + .long 3195026356 + .long 735532773 + .long 1060354999 + .long 3431923622 + .long 3196074611 + .long 2385983684 + .long 1060353830 + .long 3670374716 + .long 3196605580 + .long 2769466396 + .long 1060351883 + .long 3087185898 + .long 3197121906 + .long 2627920248 + .long 1060349159 + .long 624330694 + .long 3197386271 + .long 418831766 + .long 1060345660 + .long 1991825541 + .long 3197649836 + .long 900924147 + .long 1060341387 + .long 3917367244 + .long 3197912443 + .long 2243801771 + .long 1060336343 + .long 2803392399 + .long 3198165367 + .long 316258674 + .long 1060330532 + .long 2429158325 + .long 3198295476 + .long 1563320407 + .long 1060323956 + .long 1382541649 + .long 3198424870 + .long 1522351063 + .long 1060316620 + .long 4207787592 + .long 3198553470 + .long 1992674941 + .long 1060308528 + .long 321119318 + .long 3198681201 + .long 2434209605 + .long 1060299685 + .long 2865853451 + .long 3198807983 + .long 4249822861 + .long 1060290096 + .long 1666812989 + .long 3198933742 + .long 2181617495 + .long 1060279768 + .long 2082609563 + .long 3199058401 + .long 1475857720 + .long 1060268706 + .long 3726787968 + .long 3199181885 + .long 687004205 + .long 1060256917 + .long 2478530408 + .long 3199254748 + .long 250409509 + .long 1060244408 + .long 3681356269 + .long 3199315204 + .long 2463945945 + .long 1060231186 + .long 1535093810 + .long 3199374963 + .long 2878576948 + .long 1060217260 + .long 350661592 + .long 3199433988 + .long 3162654741 + .long 1060202638 + .long 2042383238 + .long 3199492243 + .long 2490283769 + .long 1060187329 + .long 1925003623 + .long 3199549694 + .long 1813501338 + .long 1060171342 + .long 1689375324 + .long 3199606306 + .long 3838419993 + .long 1060154686 + .long 902054988 + .long 3199662045 + .long 115411415 + .long 1060137373 + .long 1388494065 + .long 3199716877 + .long 1077921708 + .long 1060119411 + .long 3024934267 + .long 3199770769 + .long 3311502568 + .long 1060091288 + .long 3823857331 + .long 3199823689 + .long 1148832537 + .long 1060052839 + .long 17970311 + .long 3199875606 + .long 652328457 + .long 1060013161 + .long 3322544997 + .long 3199926486 + .long 1395127179 + .long 1059972278 + .long 2361617751 + .long 3199976301 + .long 1772140623 + .long 1059930215 + .long 1401987205 + .long 3200025020 + .long 3231311734 + .long 1059886997 + .long 3250975870 + .long 3200072613 + .long 1618129506 + .long 1059842651 + .long 742418353 + .long 3200119053 + .long 4288148241 + .long 1059797202 + .long 2580634211 + .long 3200164310 + .long 4268074870 + .long 1059750679 + .long 3348027550 + .long 3200208358 + .long 1659779181 + .long 1059703110 + .long 755484892 + .long 3200251171 + .long 3567792879 + .long 1059654522 + .long 2993330 + .long 3200273337 + .long 2550341159 + .long 1059604946 + .long 488211833 + .long 3200293469 + .long 2313428161 + .long 1059554411 + .long 3436142021 + .long 3200312945 + .long 453708735 + .long 1059502948 + .long 1407782048 + .long 3200331755 + .long 1264637048 + .long 1059450587 + .long 1575056534 + .long 3200349886 + .long 2771364651 + .long 1059397360 + .long 4275292648 + .long 3200367327 + .long 944109265 + .long 1059343300 + .long 3039475318 + .long 3200384069 + .long 2500108843 + .long 1059288438 + .long 1799297257 + .long 3200400101 + .long 3344537919 + .long 1059232808 + .long 2028347177 + .long 3200415413 + .long 1369913724 + .long 1059176444 + .long 2767093429 + .long 3200429996 + .long 664370609 + .long 1059119379 + .long 646746141 + .long 3200443842 + .long 1372808103 + .long 1059061535 + .long 2796885356 + .long 3200456941 + .long 941816458 + .long 1058944809 + .long 1097233945 + .long 3200469287 + .long 1373383079 + .long 1058826890 + .long 2262842797 + .long 3200480871 + .long 2796081240 + .long 1058707849 + .long 2093526290 + .long 3200491687 + .long 3945677176 + .long 1058587758 + .long 2671784286 + .long 3200501728 + .long 1979618421 + .long 1058466690 + .long 3789723003 + .long 3200510988 + .long 879820317 + .long 1058344717 + .long 2964703016 + .long 3200519462 + .long 2674059679 + .long 1058221912 + .long 4043704933 + .long 3200527144 + .long 2950925715 + .long 1058098350 + .long 36665700 + .long 3200534031 + .long 2811721921 + .long 1057935027 + .long 3193221610 + .long 3200540116 + .long 3297207428 + .long 1057685321 + .long 2063766514 + .long 3200545398 + .long 544295963 + .long 1057434550 + .long 163641427 + .long 3200549873 + .long 3381119115 + .long 1057182863 + .long 3096463640 + .long 3200553537 + .long 3054827835 + .long 1056896220 + .long 1381230637 + .long 3200556390 + .long 3419039295 + .long 1056390099 + .long 522802171 + .long 3200558429 + .long 1693671239 + .long 1055850091 + .long 3836476539 + .long 3200559652 + .long 1466910230 + .long 1054802127 + .long 3861233235 + .long 3200560060 + .long 0 + .long 0 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1916669064 + .long 1072155675 + .long 660066805 + .long 1024797180 + .long 3829231700 + .long 1062745828 + .long 2884172442 + .long 1017445907 + .long 540874025 + .long 1055617650 + .long 4198409884 + .long 1011844330 + .long 2839315448 + .long 1046639136 + .long 4204424928 + .long 1000582120 + .long 1329339431 + .long 1038229673 + .long 1295478839 + .long 993391741 + .long 658191860 + .long 1024797180 + .long 3691886121 + .long 979325773 + .long 1966800710 + .long 1020436418 + .long 1882642597 + .long 977095991 + .long 2100977488 + .long 1012908661 + .long 1840335565 + .long 967470816 + .long 4198093645 + .long 1000582120 + .long 3307942521 + .long 957055414 + .long 2839123165 + .long 996851343 + .long 1387472776 + .long 952638316 + .long 2788761024 + .long 988712873 + .long 3005712498 + .long 944467026 + .long 3694676832 + .long 979325773 + .long 1326507024 + .long 934847846 + .long 221775557 + .long 970149340 + .long 1133527550 + .long 924162364 + .long 4286578688 + .long 1072693247 + .long 0 + .long 0 + .long 1845493760 + .long 1078222640 + .long 0 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 2908765579 + .long 3193641918 + .long 0 + .long 0 + .long 2308576600 + .long 1086551075 + .long 1646446368 + .long 1084878895 + .long 4278190080 + .long 4294967295 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,1376 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cosh_wmt.S b/external/sgx_libm/ia32/cosh_wmt.S new file mode 100644 index 0000000000..49ce3ddac9 --- /dev/null +++ b/external/sgx_libm/ia32/cosh_wmt.S @@ -0,0 +1,1351 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin cosh + .text + .align 16,0x90 + .globl cosh +cosh: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 4240(%ebx), %xmm3 + xorpd %xmm4, %xmm4 + movsd 4192(%ebx), %xmm1 + movsd 4200(%ebx), %xmm2 + movl $32768, %eax + pinsrw $3, %eax, %xmm4 + movsd 4096(%ebx), %xmm6 + pextrw $3, %xmm0, %ecx + andpd %xmm0, %xmm3 + andnpd %xmm0, %xmm4 + pshufd $68, %xmm4, %xmm5 + andl $32767, %ecx + subl $16320, %ecx + cmpl $200, %ecx + jae .L_2TAG_PACKET_0.0.3 + subsd %xmm3, %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm2 + cvtsd2si %xmm3, %eax + movapd %xmm3, %xmm7 + addsd %xmm6, %xmm3 + mulsd %xmm4, %xmm1 + xorpd %xmm5, %xmm5 + subsd %xmm6, %xmm3 + movapd 4112(%ebx), %xmm4 + addsd %xmm1, %xmm2 + movapd 4128(%ebx), %xmm6 + subsd %xmm3, %xmm7 + movl $32704, %edx + pinsrw $3, %edx, %xmm5 + movapd 4144(%ebx), %xmm1 + addsd %xmm7, %xmm2 + movl $127, %edx + andl %eax, %edx + addl %edx, %edx + shrl $3, %eax + andl $65520, %eax + addl $16352, %eax + xorpd %xmm0, %xmm0 + cmpl $184, %ecx + jae .L_2TAG_PACKET_1.0.3 + pshufd $68, %xmm5, %xmm5 + pinsrw $3, %eax, %xmm0 + pshufd $68, %xmm0, %xmm0 + psubw %xmm0, %xmm5 + mulpd (%ebx,%edx,8), %xmm0 + mulpd 2048(%ebx,%edx,8), %xmm5 + pshufd $68, %xmm2, %xmm3 + movapd 4160(%ebx), %xmm7 + pshufd $68, %xmm2, %xmm2 + mulpd %xmm3, %xmm3 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm6 + mulpd 4176(%ebx), %xmm2 + mulpd %xmm3, %xmm1 + mulpd %xmm3, %xmm7 + mulpd %xmm3, %xmm4 + mulpd %xmm3, %xmm1 + addpd %xmm7, %xmm6 + movapd %xmm0, %xmm7 + addpd %xmm1, %xmm4 + shufpd $0, %xmm5, %xmm7 + addpd %xmm5, %xmm0 + mulpd %xmm7, %xmm2 + addpd %xmm6, %xmm4 + subsd %xmm0, %xmm7 + mulpd %xmm2, %xmm4 + pshufd $238, %xmm0, %xmm6 + addsd %xmm5, %xmm7 + addpd %xmm2, %xmm4 + addsd %xmm6, %xmm7 + pshufd $238, %xmm4, %xmm2 + addsd %xmm7, %xmm2 + addsd %xmm4, %xmm2 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + addl $16320, %ecx + cmpl $16320, %ecx + ja .L_2TAG_PACKET_3.0.3 + cmpl $15952, %ecx + jae .L_2TAG_PACKET_4.0.3 + addsd %xmm2, %xmm6 + movsd 4248(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + subl $16352, %eax + movl %eax, %ecx + andl $32752, %eax + shrl $1, %eax + andl $65520, %eax + subl %eax, %ecx + addl $16352, %eax + pinsrw $3, %eax, %xmm0 + pshufd $68, %xmm0, %xmm0 + mulpd (%ebx,%edx,8), %xmm0 + pshufd $68, %xmm2, %xmm3 + movsd 4160(%ebx), %xmm7 + mulsd %xmm3, %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm6 + mulsd 4176(%ebx), %xmm2 + mulsd %xmm3, %xmm1 + mulsd %xmm3, %xmm7 + mulsd %xmm3, %xmm4 + addl $16368, %ecx + pinsrw $3, %ecx, %xmm5 + mulsd %xmm3, %xmm1 + addsd %xmm7, %xmm6 + addsd %xmm1, %xmm4 + mulsd %xmm0, %xmm2 + addsd %xmm6, %xmm4 + mulsd %xmm2, %xmm4 + pshufd $238, %xmm0, %xmm6 + addsd %xmm6, %xmm4 + addsd %xmm4, %xmm2 + addsd %xmm2, %xmm0 + mulsd %xmm5, %xmm0 + pextrw $3, %xmm0, %eax + andl $32752, %eax + movl $64, %edx + cmpl $32752, %eax + je .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + movapd 4208(%ebx), %xmm1 + mulpd %xmm5, %xmm5 + movapd 4224(%ebx), %xmm2 + xorpd %xmm3, %xmm3 + movapd %xmm5, %xmm0 + mulpd %xmm5, %xmm1 + movsd 4248(%ebx), %xmm6 + mulpd %xmm5, %xmm5 + movl $16352, %eax + pinsrw $3, %eax, %xmm3 + addpd %xmm2, %xmm1 + mulpd %xmm5, %xmm1 + pshufd $238, %xmm1, %xmm2 + mulsd %xmm1, %xmm5 + mulsd %xmm3, %xmm0 + addsd %xmm5, %xmm2 + addsd %xmm2, %xmm0 + addsd %xmm6, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $32752, %ecx + jae .L_2TAG_PACKET_6.0.3 + xorpd %xmm0, %xmm0 + movl $32736, %eax + pinsrw $3, %eax, %xmm0 + mulsd %xmm0, %xmm0 + movl $64, %edx +.L_2TAG_PACKET_5.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_6.0.3: + mulsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_7.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type cosh,@function + .size cosh,.-cosh + .data +# -- End cosh + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 2851812149 + .long 1072698941 + .long 2595802551 + .long 1016815913 + .long 1048019041 + .long 1072704666 + .long 1398474845 + .long 3161559171 + .long 3899555717 + .long 1072710421 + .long 427280750 + .long 3163595548 + .long 3541402996 + .long 1072716208 + .long 2759177317 + .long 1015903202 + .long 702412510 + .long 1072722027 + .long 3803266087 + .long 3163328991 + .long 410360776 + .long 1072727877 + .long 1269990655 + .long 1013024446 + .long 3402036099 + .long 1072733758 + .long 405889334 + .long 1016154232 + .long 1828292879 + .long 1072739672 + .long 1255956747 + .long 1016636974 + .long 728909815 + .long 1072745618 + .long 383930225 + .long 1016078044 + .long 852742562 + .long 1072751596 + .long 667253586 + .long 1010842135 + .long 2952712987 + .long 1072757606 + .long 3293494651 + .long 3161168877 + .long 3490863953 + .long 1072763649 + .long 960797498 + .long 3163997456 + .long 3228316108 + .long 1072769725 + .long 3010241991 + .long 3159471380 + .long 2930322912 + .long 1072775834 + .long 2599499422 + .long 3163762623 + .long 3366293073 + .long 1072781976 + .long 3119426314 + .long 1015169130 + .long 1014845819 + .long 1072788152 + .long 3117910646 + .long 3162607681 + .long 948735466 + .long 1072794361 + .long 3516338028 + .long 3163623459 + .long 3949972341 + .long 1072800603 + .long 2068408548 + .long 1015962444 + .long 2214878420 + .long 1072806880 + .long 892270087 + .long 3164164998 + .long 828946858 + .long 1072813191 + .long 10642492 + .long 1016988014 + .long 586995997 + .long 1072819536 + .long 41662348 + .long 3163676568 + .long 2288159958 + .long 1072825915 + .long 2169144469 + .long 1015924597 + .long 2440944790 + .long 1072832329 + .long 2492769774 + .long 1015196030 + .long 1853186616 + .long 1072838778 + .long 3066496371 + .long 1016705150 + .long 1337108031 + .long 1072845262 + .long 3203724452 + .long 1015726421 + .long 1709341917 + .long 1072851781 + .long 2571168217 + .long 1015201075 + .long 3790955393 + .long 1072858335 + .long 2352942462 + .long 3164228666 + .long 4112506593 + .long 1072864925 + .long 2947355221 + .long 1015419624 + .long 3504003472 + .long 1072871551 + .long 3594001060 + .long 3158379228 + .long 2799960843 + .long 1072878213 + .long 1423655381 + .long 1016070727 + .long 2839424854 + .long 1072884911 + .long 1171596163 + .long 1014090255 + .long 171030293 + .long 1072891646 + .long 3526460132 + .long 1015477354 + .long 4232894513 + .long 1072898416 + .long 2383938684 + .long 1015717095 + .long 2992903935 + .long 1072905224 + .long 2218154406 + .long 1016276769 + .long 1603444721 + .long 1072912069 + .long 1548633640 + .long 3163249902 + .long 926591435 + .long 1072918951 + .long 3208833762 + .long 3163962090 + .long 1829099622 + .long 1072925870 + .long 1016661181 + .long 3164509581 + .long 887463927 + .long 1072932827 + .long 3596744163 + .long 3161842742 + .long 3272845541 + .long 1072939821 + .long 928852419 + .long 3164536824 + .long 1276261410 + .long 1072946854 + .long 300981948 + .long 1015732745 + .long 78413852 + .long 1072953925 + .long 4183226867 + .long 3164065827 + .long 569847338 + .long 1072961034 + .long 472945272 + .long 3160339305 + .long 3645941911 + .long 1072968181 + .long 3814685081 + .long 3162621917 + .long 1617004845 + .long 1072975368 + .long 82804944 + .long 1011391354 + .long 3978100823 + .long 1072982593 + .long 3513027190 + .long 1016894539 + .long 3049340112 + .long 1072989858 + .long 3062915824 + .long 1014219171 + .long 4040676318 + .long 1072997162 + .long 4090609238 + .long 1016712034 + .long 3577096743 + .long 1073004506 + .long 2951496418 + .long 1014842263 + .long 2583551245 + .long 1073011890 + .long 3161094195 + .long 1016655067 + .long 1990012071 + .long 1073019314 + .long 3529070563 + .long 3163861769 + .long 2731501122 + .long 1073026778 + .long 1774031855 + .long 3163518597 + .long 1453150082 + .long 1073034283 + .long 498154669 + .long 3162536638 + .long 3395129871 + .long 1073041828 + .long 4025345435 + .long 3163383964 + .long 917841882 + .long 1073049415 + .long 18715565 + .long 1016707884 + .long 3566716925 + .long 1073057042 + .long 1536826856 + .long 1015191009 + .long 3712504873 + .long 1073064711 + .long 88491949 + .long 1016476236 + .long 2321106615 + .long 1073072422 + .long 2171176610 + .long 1010584347 + .long 363667784 + .long 1073080175 + .long 813753950 + .long 1016833785 + .long 3111574537 + .long 1073087969 + .long 2606161479 + .long 3163808322 + .long 2956612997 + .long 1073095806 + .long 2118169751 + .long 3163784129 + .long 885834528 + .long 1073103686 + .long 1973258547 + .long 3163310140 + .long 2186617381 + .long 1073111608 + .long 2270764084 + .long 3164321289 + .long 3561793907 + .long 1073119573 + .long 1157054053 + .long 1012938926 + .long 1719614413 + .long 1073127582 + .long 330458198 + .long 3164331316 + .long 1963711167 + .long 1073135634 + .long 1744767757 + .long 3161622870 + .long 1013258799 + .long 1073143730 + .long 1748797611 + .long 3161177658 + .long 4182873220 + .long 1073151869 + .long 629542646 + .long 3163044879 + .long 3907805044 + .long 1073160053 + .long 2257091225 + .long 3162598983 + .long 1218806132 + .long 1073168282 + .long 1818613052 + .long 3163597017 + .long 1447192521 + .long 1073176555 + .long 1462857171 + .long 3163563097 + .long 1339972927 + .long 1073184873 + .long 167908909 + .long 1016620728 + .long 1944781191 + .long 1073193236 + .long 3993278767 + .long 3162772855 + .long 19972402 + .long 1073201645 + .long 3507899862 + .long 1017057868 + .long 919555682 + .long 1073210099 + .long 3121969534 + .long 1013996802 + .long 1413356050 + .long 1073218599 + .long 1651349291 + .long 3163716742 + .long 2571947539 + .long 1073227145 + .long 3558159064 + .long 3164425245 + .long 1176749997 + .long 1073235738 + .long 2738998779 + .long 3163084420 + .long 2604962541 + .long 1073244377 + .long 2614425274 + .long 3164587768 + .long 3649726105 + .long 1073253063 + .long 4085036346 + .long 1016698050 + .long 1110089947 + .long 1073261797 + .long 1451641639 + .long 1016523249 + .long 380978316 + .long 1073270578 + .long 854188970 + .long 3161511262 + .long 2568320822 + .long 1073279406 + .long 2732824428 + .long 1015401491 + .long 194117574 + .long 1073288283 + .long 777528612 + .long 3164460665 + .long 2966275557 + .long 1073297207 + .long 2176155324 + .long 3160891335 + .long 3418903055 + .long 1073306180 + .long 2527457337 + .long 3161869180 + .long 2682146384 + .long 1073315202 + .long 2082178513 + .long 3164411995 + .long 1892288442 + .long 1073324273 + .long 2446255666 + .long 3163648957 + .long 2191782032 + .long 1073333393 + .long 2960257726 + .long 1014791238 + .long 434316067 + .long 1073342563 + .long 2028358766 + .long 1014506698 + .long 2069751141 + .long 1073351782 + .long 1562170675 + .long 3163773257 + .long 3964284211 + .long 1073361051 + .long 2111583915 + .long 1016475740 + .long 2990417245 + .long 1073370371 + .long 3683467745 + .long 3164417902 + .long 321958744 + .long 1073379742 + .long 3401933767 + .long 1016843134 + .long 1434058175 + .long 1073389163 + .long 251133233 + .long 1016134345 + .long 3218338682 + .long 1073398635 + .long 3404164304 + .long 3163525684 + .long 2572866477 + .long 1073408159 + .long 878562433 + .long 1016570317 + .long 697153126 + .long 1073417735 + .long 1283515429 + .long 3164331765 + .long 3092190715 + .long 1073427362 + .long 814012168 + .long 3160571998 + .long 2380618042 + .long 1073437042 + .long 3149557219 + .long 3164369375 + .long 4076559943 + .long 1073446774 + .long 2119478331 + .long 3161806927 + .long 815859274 + .long 1073456560 + .long 240396590 + .long 3164536019 + .long 2420883922 + .long 1073466398 + .long 2049810052 + .long 1015168464 + .long 1540824585 + .long 1073476290 + .long 1064017011 + .long 3164536266 + .long 3716502172 + .long 1073486235 + .long 2303740125 + .long 1015091301 + .long 1610600570 + .long 1073496235 + .long 3766732298 + .long 1016808759 + .long 777507147 + .long 1073506289 + .long 4282924205 + .long 1016236109 + .long 2483480501 + .long 1073516397 + .long 1216371780 + .long 1014082748 + .long 3706687593 + .long 1073526560 + .long 3521726940 + .long 1014301643 + .long 1432208378 + .long 1073536779 + .long 1401068914 + .long 3163412539 + .long 1242007932 + .long 1073547053 + .long 1132034716 + .long 3164388407 + .long 135105010 + .long 1073557383 + .long 1906148728 + .long 3164424315 + .long 3707479175 + .long 1073567768 + .long 3613079303 + .long 1015213314 + .long 382305176 + .long 1073578211 + .long 2347622376 + .long 3163627201 + .long 64696965 + .long 1073588710 + .long 1768797490 + .long 1016865536 + .long 4076975200 + .long 1073599265 + .long 2029000899 + .long 1016257111 + .long 863738719 + .long 1073609879 + .long 1326992220 + .long 3163661773 + .long 351641897 + .long 1073620550 + .long 2172261526 + .long 3164059175 + .long 3884662774 + .long 1073631278 + .long 2158611599 + .long 1015258761 + .long 4224142467 + .long 1073642065 + .long 3389820386 + .long 1016255778 + .long 2728693978 + .long 1073652911 + .long 396109971 + .long 3164511267 + .long 764307441 + .long 1073663816 + .long 3021057420 + .long 3164378099 + .long 3999357479 + .long 1073674779 + .long 2258941616 + .long 1016973300 + .long 929806999 + .long 1073685803 + .long 3205336643 + .long 1016308133 + .long 1533953344 + .long 1073696886 + .long 769171851 + .long 1016714209 + .long 2912730644 + .long 1073708029 + .long 3490067722 + .long 3164453650 + .long 2174652632 + .long 1073719233 + .long 4087714590 + .long 1015498835 + .long 730821105 + .long 1073730498 + .long 2523232743 + .long 1013115764 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 730821105 + .long 1072681922 + .long 2523232743 + .long 1012067188 + .long 2174652632 + .long 1072670657 + .long 4087714590 + .long 1014450259 + .long 2912730644 + .long 1072659453 + .long 3490067722 + .long 3163405074 + .long 1533953344 + .long 1072648310 + .long 769171851 + .long 1015665633 + .long 929806999 + .long 1072637227 + .long 3205336643 + .long 1015259557 + .long 3999357479 + .long 1072626203 + .long 2258941616 + .long 1015924724 + .long 764307441 + .long 1072615240 + .long 3021057420 + .long 3163329523 + .long 2728693978 + .long 1072604335 + .long 396109971 + .long 3163462691 + .long 4224142467 + .long 1072593489 + .long 3389820386 + .long 1015207202 + .long 3884662774 + .long 1072582702 + .long 2158611599 + .long 1014210185 + .long 351641897 + .long 1072571974 + .long 2172261526 + .long 3163010599 + .long 863738719 + .long 1072561303 + .long 1326992220 + .long 3162613197 + .long 4076975200 + .long 1072550689 + .long 2029000899 + .long 1015208535 + .long 64696965 + .long 1072540134 + .long 1768797490 + .long 1015816960 + .long 382305176 + .long 1072529635 + .long 2347622376 + .long 3162578625 + .long 3707479175 + .long 1072519192 + .long 3613079303 + .long 1014164738 + .long 135105010 + .long 1072508807 + .long 1906148728 + .long 3163375739 + .long 1242007932 + .long 1072498477 + .long 1132034716 + .long 3163339831 + .long 1432208378 + .long 1072488203 + .long 1401068914 + .long 3162363963 + .long 3706687593 + .long 1072477984 + .long 3521726940 + .long 1013253067 + .long 2483480501 + .long 1072467821 + .long 1216371780 + .long 1013034172 + .long 777507147 + .long 1072457713 + .long 4282924205 + .long 1015187533 + .long 1610600570 + .long 1072447659 + .long 3766732298 + .long 1015760183 + .long 3716502172 + .long 1072437659 + .long 2303740125 + .long 1014042725 + .long 1540824585 + .long 1072427714 + .long 1064017011 + .long 3163487690 + .long 2420883922 + .long 1072417822 + .long 2049810052 + .long 1014119888 + .long 815859274 + .long 1072407984 + .long 240396590 + .long 3163487443 + .long 4076559943 + .long 1072398198 + .long 2119478331 + .long 3160758351 + .long 2380618042 + .long 1072388466 + .long 3149557219 + .long 3163320799 + .long 3092190715 + .long 1072378786 + .long 814012168 + .long 3159523422 + .long 697153126 + .long 1072369159 + .long 1283515429 + .long 3163283189 + .long 2572866477 + .long 1072359583 + .long 878562433 + .long 1015521741 + .long 3218338682 + .long 1072350059 + .long 3404164304 + .long 3162477108 + .long 1434058175 + .long 1072340587 + .long 251133233 + .long 1015085769 + .long 321958744 + .long 1072331166 + .long 3401933767 + .long 1015794558 + .long 2990417245 + .long 1072321795 + .long 3683467745 + .long 3163369326 + .long 3964284211 + .long 1072312475 + .long 2111583915 + .long 1015427164 + .long 2069751141 + .long 1072303206 + .long 1562170675 + .long 3162724681 + .long 434316067 + .long 1072293987 + .long 2028358766 + .long 1013458122 + .long 2191782032 + .long 1072284817 + .long 2960257726 + .long 1013742662 + .long 1892288442 + .long 1072275697 + .long 2446255666 + .long 3162600381 + .long 2682146384 + .long 1072266626 + .long 2082178513 + .long 3163363419 + .long 3418903055 + .long 1072257604 + .long 2527457337 + .long 3160820604 + .long 2966275557 + .long 1072248631 + .long 2176155324 + .long 3159842759 + .long 194117574 + .long 1072239707 + .long 777528612 + .long 3163412089 + .long 2568320822 + .long 1072230830 + .long 2732824428 + .long 1014352915 + .long 380978316 + .long 1072222002 + .long 854188970 + .long 3160462686 + .long 1110089947 + .long 1072213221 + .long 1451641639 + .long 1015474673 + .long 3649726105 + .long 1072204487 + .long 4085036346 + .long 1015649474 + .long 2604962541 + .long 1072195801 + .long 2614425274 + .long 3163539192 + .long 1176749997 + .long 1072187162 + .long 2738998779 + .long 3162035844 + .long 2571947539 + .long 1072178569 + .long 3558159064 + .long 3163376669 + .long 1413356050 + .long 1072170023 + .long 1651349291 + .long 3162668166 + .long 919555682 + .long 1072161523 + .long 3121969534 + .long 1012948226 + .long 19972402 + .long 1072153069 + .long 3507899862 + .long 1016009292 + .long 1944781191 + .long 1072144660 + .long 3993278767 + .long 3161724279 + .long 1339972927 + .long 1072136297 + .long 167908909 + .long 1015572152 + .long 1447192521 + .long 1072127979 + .long 1462857171 + .long 3162514521 + .long 1218806132 + .long 1072119706 + .long 1818613052 + .long 3162548441 + .long 3907805044 + .long 1072111477 + .long 2257091225 + .long 3161550407 + .long 4182873220 + .long 1072103293 + .long 629542646 + .long 3161996303 + .long 1013258799 + .long 1072095154 + .long 1748797611 + .long 3160129082 + .long 1963711167 + .long 1072087058 + .long 1744767757 + .long 3160574294 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 3561793907 + .long 1072070997 + .long 1157054053 + .long 1011890350 + .long 2186617381 + .long 1072063032 + .long 2270764084 + .long 3163272713 + .long 885834528 + .long 1072055110 + .long 1973258547 + .long 3162261564 + .long 2956612997 + .long 1072047230 + .long 2118169751 + .long 3162735553 + .long 3111574537 + .long 1072039393 + .long 2606161479 + .long 3162759746 + .long 363667784 + .long 1072031599 + .long 813753950 + .long 1015785209 + .long 2321106615 + .long 1072023846 + .long 2171176610 + .long 1009535771 + .long 3712504873 + .long 1072016135 + .long 88491949 + .long 1015427660 + .long 3566716925 + .long 1072008466 + .long 1536826856 + .long 1014142433 + .long 917841882 + .long 1072000839 + .long 18715565 + .long 1015659308 + .long 3395129871 + .long 1071993252 + .long 4025345435 + .long 3162335388 + .long 1453150082 + .long 1071985707 + .long 498154669 + .long 3161488062 + .long 2731501122 + .long 1071978202 + .long 1774031855 + .long 3162470021 + .long 1990012071 + .long 1071970738 + .long 3529070563 + .long 3162813193 + .long 2583551245 + .long 1071963314 + .long 3161094195 + .long 1015606491 + .long 3577096743 + .long 1071955930 + .long 2951496418 + .long 1013793687 + .long 4040676318 + .long 1071948586 + .long 4090609238 + .long 1015663458 + .long 3049340112 + .long 1071941282 + .long 3062915824 + .long 1013170595 + .long 3978100823 + .long 1071934017 + .long 3513027190 + .long 1015845963 + .long 1617004845 + .long 1071926792 + .long 82804944 + .long 1010342778 + .long 3645941911 + .long 1071919605 + .long 3814685081 + .long 3161573341 + .long 569847338 + .long 1071912458 + .long 472945272 + .long 3159290729 + .long 78413852 + .long 1071905349 + .long 4183226867 + .long 3163017251 + .long 1276261410 + .long 1071898278 + .long 300981948 + .long 1014684169 + .long 3272845541 + .long 1071891245 + .long 928852419 + .long 3163488248 + .long 887463927 + .long 1071884251 + .long 3596744163 + .long 3160794166 + .long 1829099622 + .long 1071877294 + .long 1016661181 + .long 3163461005 + .long 926591435 + .long 1071870375 + .long 3208833762 + .long 3162913514 + .long 1603444721 + .long 1071863493 + .long 1548633640 + .long 3162201326 + .long 2992903935 + .long 1071856648 + .long 2218154406 + .long 1015228193 + .long 4232894513 + .long 1071849840 + .long 2383938684 + .long 1014668519 + .long 171030293 + .long 1071843070 + .long 3526460132 + .long 1014428778 + .long 2839424854 + .long 1071836335 + .long 1171596163 + .long 1013041679 + .long 2799960843 + .long 1071829637 + .long 1423655381 + .long 1015022151 + .long 3504003472 + .long 1071822975 + .long 3594001060 + .long 3157330652 + .long 4112506593 + .long 1071816349 + .long 2947355221 + .long 1014371048 + .long 3790955393 + .long 1071809759 + .long 2352942462 + .long 3163180090 + .long 1709341917 + .long 1071803205 + .long 2571168217 + .long 1014152499 + .long 1337108031 + .long 1071796686 + .long 3203724452 + .long 1014677845 + .long 1853186616 + .long 1071790202 + .long 3066496371 + .long 1015656574 + .long 2440944790 + .long 1071783753 + .long 2492769774 + .long 1014147454 + .long 2288159958 + .long 1071777339 + .long 2169144469 + .long 1014876021 + .long 586995997 + .long 1071770960 + .long 41662348 + .long 3162627992 + .long 828946858 + .long 1071764615 + .long 10642492 + .long 1015939438 + .long 2214878420 + .long 1071758304 + .long 892270087 + .long 3163116422 + .long 3949972341 + .long 1071752027 + .long 2068408548 + .long 1014913868 + .long 948735466 + .long 1071745785 + .long 3516338028 + .long 3162574883 + .long 1014845819 + .long 1071739576 + .long 3117910646 + .long 3161559105 + .long 3366293073 + .long 1071733400 + .long 3119426314 + .long 1014120554 + .long 2930322912 + .long 1071727258 + .long 2599499422 + .long 3162714047 + .long 3228316108 + .long 1071721149 + .long 3010241991 + .long 3158422804 + .long 3490863953 + .long 1071715073 + .long 960797498 + .long 3162948880 + .long 2952712987 + .long 1071709030 + .long 3293494651 + .long 3160120301 + .long 852742562 + .long 1071703020 + .long 667253586 + .long 1009793559 + .long 728909815 + .long 1071697042 + .long 383930225 + .long 1015029468 + .long 1828292879 + .long 1071691096 + .long 1255956747 + .long 1015588398 + .long 3402036099 + .long 1071685182 + .long 405889334 + .long 1015105656 + .long 410360776 + .long 1071679301 + .long 1269990655 + .long 1011975870 + .long 702412510 + .long 1071673451 + .long 3803266087 + .long 3162280415 + .long 3541402996 + .long 1071667632 + .long 2759177317 + .long 1014854626 + .long 3899555717 + .long 1071661845 + .long 427280750 + .long 3162546972 + .long 1048019041 + .long 1071656090 + .long 1398474845 + .long 3160510595 + .long 2851812149 + .long 1071650365 + .long 2595802551 + .long 1015767337 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 3607404736 + .long 1044146952 + .long 3607404736 + .long 3191630600 + .long 4277811695 + .long 1063661122 + .long 4277811695 + .long 3211144770 + .long 2140175755 + .long 1033864261 + .long 2140175755 + .long 1033864261 + .long 4289495988 + .long 1054113747 + .long 4289495988 + .long 1054113747 + .long 4277811695 + .long 1064709698 + .long 4277811695 + .long 3212193346 + .long 1610612736 + .long 1080497479 + .long 4166901572 + .long 1053077003 + .long 3078135644 + .long 1049787983 + .long 381774870 + .long 1062650220 + .long 436314137 + .long 1056571808 + .long 1431655765 + .long 1067799893 + .long 4160749568 + .long 2147483647 + .long 0 + .long 1072693248 + .type static_const_table,@object + .size static_const_table,4256 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/coshf_wmt.S b/external/sgx_libm/ia32/coshf_wmt.S new file mode 100644 index 0000000000..59ce011471 --- /dev/null +++ b/external/sgx_libm/ia32/coshf_wmt.S @@ -0,0 +1,405 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "coshf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin coshf + .text + .align 16,0x90 + .globl coshf +coshf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movsd 608(%ebx), %xmm3 + movsd 512(%ebx), %xmm6 + movss %xmm0, 8(%esp) + movd %xmm0, %ecx + psllq $33, %xmm0 + psrlq $4, %xmm0 + movapd 528(%ebx), %xmm4 + andl $2147418112, %ecx + subl $1040187392, %ecx + cmpl $79691776, %ecx + jae .L_2TAG_PACKET_0.0.3 + mulsd %xmm0, %xmm3 + movapd %xmm3, %xmm2 + addsd %xmm6, %xmm3 + xorpd %xmm0, %xmm0 + movd %xmm3, %eax + subsd %xmm6, %xmm3 + movapd 544(%ebx), %xmm1 + xorpd %xmm5, %xmm5 + subsd %xmm3, %xmm2 + movl $31, %edx + andl %eax, %edx + shrl $1, %eax + addl %edx, %edx + andl $65520, %eax + addl $16352, %eax + cmpl $71303168, %ecx + jae .L_2TAG_PACKET_1.0.3 + pinsrw $3, %eax, %xmm0 + movl $32704, %ecx + subl %eax, %ecx + movapd 560(%ebx), %xmm3 + movapd (%ebx,%edx,8), %xmm7 + pinsrw $3, %ecx, %xmm5 + pshufd $68, %xmm2, %xmm2 + shufpd $0, %xmm5, %xmm0 + movapd 576(%ebx), %xmm6 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm1 + mulpd %xmm2, %xmm3 + mulpd %xmm7, %xmm0 + mulpd %xmm2, %xmm4 + addpd %xmm1, %xmm6 + mulpd %xmm0, %xmm3 + addpd %xmm6, %xmm4 + mulpd %xmm3, %xmm4 + addpd %xmm4, %xmm0 + pshufd $78, %xmm0, %xmm4 + addpd %xmm4, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + addl $1040187392, %ecx + cmpl $1040187392, %ecx + ja .L_2TAG_PACKET_3.0.3 + cmpl $956301312, %ecx + jae .L_2TAG_PACKET_4.0.3 + movss 592(%ebx), %xmm3 + mulss %xmm3, %xmm3 + fld1 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + pinsrw $3, %eax, %xmm0 + movsd 560(%ebx), %xmm3 + pshufd $68, %xmm2, %xmm2 + mulsd (%ebx,%edx,8), %xmm0 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm1, %xmm4 + mulsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 + mulsd %xmm0, %xmm4 + addsd %xmm4, %xmm0 + cvtsd2ss %xmm0, %xmm0 + pextrw $1, %xmm0, %eax + andl $32640, %eax + movl $65, %edx + cmpl $32640, %eax + je .L_2TAG_PACKET_5.0.3 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + movss 592(%ebx), %xmm7 + movss 8(%esp), %xmm1 + mulss %xmm1, %xmm1 + movss 596(%ebx), %xmm2 + movl $1056964608, %eax + movd %eax, %xmm3 + movss %xmm1, %xmm0 + mulss %xmm1, %xmm7 + movl $1065353216, %edx + movd %edx, %xmm6 + mulss %xmm1, %xmm1 + addss %xmm2, %xmm7 + mulps %xmm1, %xmm7 + mulss %xmm3, %xmm0 + addss %xmm7, %xmm0 + addss %xmm6, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_6.0.3 + xorps %xmm0, %xmm0 + movl $32512, %eax + pinsrw $1, %eax, %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_5.0.3: + movss %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $65, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + movss 8(%esp), %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_2.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type coshf,@function + .size coshf,.-coshf + .data +# -- End coshf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 3541402996 + .long 1072716208 + .long 1533953344 + .long 1072648310 + .long 1828292879 + .long 1072739672 + .long 2728693978 + .long 1072604335 + .long 3490863953 + .long 1072763649 + .long 863738719 + .long 1072561303 + .long 1014845819 + .long 1072788152 + .long 3707479175 + .long 1072519192 + .long 828946858 + .long 1072813191 + .long 3706687593 + .long 1072477984 + .long 1853186616 + .long 1072838778 + .long 3716502172 + .long 1072437659 + .long 4112506593 + .long 1072864925 + .long 4076559943 + .long 1072398198 + .long 171030293 + .long 1072891646 + .long 2572866477 + .long 1072359583 + .long 926591435 + .long 1072918951 + .long 2990417245 + .long 1072321795 + .long 1276261410 + .long 1072946854 + .long 2191782032 + .long 1072284817 + .long 1617004845 + .long 1072975368 + .long 2966275557 + .long 1072248631 + .long 3577096743 + .long 1073004506 + .long 1110089947 + .long 1072213221 + .long 1453150082 + .long 1073034283 + .long 2571947539 + .long 1072178569 + .long 3712504873 + .long 1073064711 + .long 1944781191 + .long 1072144660 + .long 2956612997 + .long 1073095806 + .long 3907805044 + .long 1072111477 + .long 1719614413 + .long 1073127582 + .long 1719614413 + .long 1072079006 + .long 3907805044 + .long 1073160053 + .long 2956612997 + .long 1072047230 + .long 1944781191 + .long 1073193236 + .long 3712504873 + .long 1072016135 + .long 2571947539 + .long 1073227145 + .long 1453150082 + .long 1071985707 + .long 1110089947 + .long 1073261797 + .long 3577096743 + .long 1071955930 + .long 2966275557 + .long 1073297207 + .long 1617004845 + .long 1071926792 + .long 2191782032 + .long 1073333393 + .long 1276261410 + .long 1071898278 + .long 2990417245 + .long 1073370371 + .long 926591435 + .long 1071870375 + .long 2572866477 + .long 1073408159 + .long 171030293 + .long 1071843070 + .long 4076559943 + .long 1073446774 + .long 4112506593 + .long 1071816349 + .long 3716502172 + .long 1073486235 + .long 1853186616 + .long 1071790202 + .long 3706687593 + .long 1073526560 + .long 828946858 + .long 1071764615 + .long 3707479175 + .long 1073567768 + .long 1014845819 + .long 1071739576 + .long 863738719 + .long 1073609879 + .long 3490863953 + .long 1071715073 + .long 2728693978 + .long 1073652911 + .long 1828292879 + .long 1071691096 + .long 1533953344 + .long 1073696886 + .long 3541402996 + .long 1071667632 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 4289495988 + .long 1058308051 + .long 4289495988 + .long 1058308051 + .long 4277811695 + .long 1065758274 + .long 4277811695 + .long 3213241922 + .long 4277811695 + .long 1066806850 + .long 4277811695 + .long 3214290498 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 985008993 + .long 1026206379 + .long 0 + .long 0 + .long 1697350398 + .long 2017924423 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,640 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/coshl.S b/external/sgx_libm/ia32/coshl.S new file mode 100644 index 0000000000..5b0301b800 --- /dev/null +++ b/external/sgx_libm/ia32/coshl.S @@ -0,0 +1,942 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "coshl.c" + .text +..TXTST0: +# -- Begin coshl + .text + .align 16,0x90 + .globl coshl +coshl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $72, %esp +..B1.2: + fnstcw 58(%esp) +..B1.3: + movzwl 16(%ebp), %ebx + andl $32767, %ebx + movl 12(%ebp), %ecx + movl %ebx, %esi + movl %ecx, %edx + shll $16, %esi + shrl $16, %edx + movzbl 17(%ebp), %eax + orl %edx, %esi + andl $128, %eax + shrl $7, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $1073992020, %esi + jae ..B1.50 +..B1.4: + movzwl 58(%esp), %ecx + cmpl $16382, %ebx + jge ..B1.43 +..B1.5: + cmpl $16378, %ebx + jge ..B1.36 +..B1.6: + cmpl $16372, %ebx + jge ..B1.29 +..B1.7: + cmpl $16365, %ebx + jge ..B1.22 +..B1.8: + cmpl $16308, %ebx + jge ..B1.16 +..B1.9: + movl %ecx, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.69 +..B1.10: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.11: + fldcw 56(%esp) +..B1.12: + movzbl 17(%ebp), %eax + movl $1, %ecx + andl $128, %eax + shrl $7, %eax +..B1.13: + fldt 8(%ebp) + testl %ecx, %ecx + fmull ones@GOTOFF(%edx,%eax,8) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.15 +..B1.14: + fldcw 58(%esp) +..B1.15: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.70 +..B1.17: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.18: + fldcw 56(%esp) +..B1.19: + fldt 8(%ebp) + fldt _Q3@GOTOFF(%edx) + fmul %st(1), %st + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) +..B1.20: + fldcw 58(%esp) +..B1.21: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.22: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.71 +..B1.23: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.24: + fldcw 56(%esp) +..B1.25: + movl $1, %eax +..B1.26: + fldt 8(%ebp) + testl %eax, %eax + fmul %st(0), %st + fldt 12+_Q2@GOTOFF(%edx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.28 +..B1.27: + fldcw 58(%esp) +..B1.28: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.72 +..B1.30: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.31: + fldcw 56(%esp) +..B1.32: + movl $1, %eax +..B1.33: + fldt 8(%ebp) + testl %eax, %eax + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%edx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%edx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.35 +..B1.34: + fldcw 58(%esp) +..B1.35: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.36: + movl %ecx, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.73 +..B1.37: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.38: + fldcw 56(%esp) +..B1.39: + movzbl 17(%ebp), %eax + movl $1, %ecx + andl $128, %eax + shrl $7, %eax +..B1.40: + fldl _TWO_48H@GOTOFF(%edx) + testl %ecx, %ecx + fld %st(0) + fldt 8(%ebp) + fmull ones@GOTOFF(%edx,%eax,8) + fstpt 8(%ebp) + fldt 8(%ebp) + fadd %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(2) + fmul %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt 84+_Q@GOTOFF(%edx) + fmul %st(1), %st + fldt 72+_Q@GOTOFF(%edx) + fmul %st(2), %st + fldt 60+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(4) + fmul %st(4), %st + fxch %st(6) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(5) + fxch %st(3) + fmul %st(0), %st + fldt 12+_Q@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fldt 108+_Q@GOTOFF(%edx) + fld %st(0) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fmul %st, %st(1) + fldt 96+_Q@GOTOFF(%edx) + fld %st(0) + fmul %st(5), %st + fxch %st(3) + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(2) + fmul %st, %st(3) + fld %st(3) + fxch %st(3) + fmulp %st, %st(1) + fadd %st, %st(2) + fldl _TWO_48H@GOTOFF(%edx) + fadd %st, %st(3) + fsubr %st(3), %st + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + je ..B1.83 +..B1.41: + fstpt 44(%esp) +..B1.82: + fldcw 58(%esp) + jmp ..B1.42 +..B1.83: + fstp %st(0) +..B1.42: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + movl %ecx, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.74 +..B1.44: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.45: + fldcw 56(%esp) +..B1.46: + movzbl 17(%ebp), %eax + movl $1, %ecx + andl $128, %eax + shrl $7, %eax +..B1.47: + fldt 8(%ebp) + fmull ones@GOTOFF(%edx,%eax,8) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%edx) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(2), %st + fadd %st(1), %st + fstpt 44(%esp) + fldt 44(%esp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmul %st(1), %st + movl 44(%esp), %eax + fsubrp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(2) + movsbl %al, %esi + fsub %st(1), %st + fldl _TWO_32P@GOTOFF(%edx) + subl %esi, %eax + fmul %st(1), %st + fxch %st(1) + fmull _TWO_32@GOTOFF(%edx) + shll $4, %esi + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + shrl $8, %eax + fxch %st(2) + fsubrp %st, %st(3) + movl %eax, %ebx + negl %eax + shll $23, %ebx + fadd %st(2), %st + fld %st(0) + addl $1056964608, %ebx + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + shll $23, %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + addl $1056964608, %eax + fldt 12+_P@GOTOFF(%edx) + movl %ebx, 12(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + movl %eax, 28(%esp) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fldt _P@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + fadd %st, %st(1) + fsubp %st, %st(3) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%esi) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%esi) + negl %esi + fstpt 16(%esp) + fldt 16(%esp) + testl %ecx, %ecx + fadd %st(1), %st + fmulp %st, %st(2) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%esi) + fld %st(0) + fmul %st(4), %st + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%esi) + fld %st(0) + fadd %st(3), %st + fmulp %st, %st(7) + fxch %st(1) + fsubrp %st, %st(6) + fxch %st(5) + fstpt 32(%esp) + fldt 16(%esp) + fld %st(0) + fmul %st(5), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + fmul %st(4), %st + fld %st(4) + fsub %st(1), %st + fsubr %st, %st(5) + fxch %st(1) + fsubrp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fldt 32(%esp) + faddp %st, %st(3) + flds 12(%esp) + fmul %st, %st(2) + fmulp %st, %st(1) + flds 28(%esp) + fmul %st, %st(4) + fld %st(4) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.49 +..B1.48: + fldcw 58(%esp) +..B1.49: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.50: + cmpl $16396, %ebx + jge ..B1.58 +..B1.51: + movzwl 58(%esp), %ebx + movl %ebx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.75 +..B1.52: + orl $-64768, %ebx + movw %bx, 56(%esp) +..B1.53: + fldcw 56(%esp) +..B1.54: + movzbl 17(%ebp), %eax + movl $1, %ecx + andl $128, %eax + shrl $7, %eax +..B1.55: + fldt 8(%ebp) + fmull ones@GOTOFF(%edx,%eax,8) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fstpt (%esp) + fldl _TWO_63H@GOTOFF(%edx) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(2), %st + movzwl 8+.L_2il0floatpacket.3@GOTOFF(%edx), %ebx + fadd %st(1), %st + fstpt 44(%esp) + fldt 44(%esp) + andl $-32768, %ebx + movl 44(%esp), %eax + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmul %st(1), %st + movsbl %al, %esi + fsubrp %st, %st(2) + fld %st(1) + subl %esi, %eax + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(2) + shll $4, %esi + fsub %st(1), %st + fldl _TWO_32@GOTOFF(%edx) + fldl _TWO_32P@GOTOFF(%edx) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + shrl $8, %eax + fxch %st(2) + fsubrp %st, %st(1) + fld %st(0) + addl $16350, %eax + andl $32767, %eax + fxch %st(1) + fsubr %st, %st(4) + orl %eax, %ebx + fxch %st(3) + fsubrp %st, %st(4) + movw %bx, 8(%esp) + testl %ecx, %ecx + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(5) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%esi) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%esi) + fld %st(0) + fmul %st(5), %st + fxch %st(4) + fadd %st, %st(5) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldt (%esp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.57 +..B1.56: + fldcw 58(%esp) +..B1.57: + fldt 16(%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.58: + je ..B1.77 +..B1.59: + movzwl 58(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.76 +..B1.60: + orl $-64768, %ecx + movw %cx, 56(%esp) +..B1.61: + fldcw 56(%esp) +..B1.62: + movzwl 16(%ebp), %ebx + movl $1, %ecx + andl $32767, %ebx +..B1.63: + cmpl $32767, %ebx + jne ..B1.65 +..B1.64: + fldt 8(%ebp) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmull ones@GOTOFF(%edx,%eax,8) + fstpt (%esp) + jmp ..B1.66 +..B1.65: + fldt _large_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt (%esp) +..B1.66: + testl %ecx, %ecx + je ..B1.68 +..B1.67: + fldcw 58(%esp) +..B1.68: + fldt (%esp) + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.69: + xorl %ecx, %ecx + jmp ..B1.13 +..B1.70: + fldt 8(%ebp) + fldt _Q3@GOTOFF(%edx) + fmul %st(1), %st + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.21 +..B1.71: + xorl %eax, %eax + jmp ..B1.26 +..B1.72: + xorl %eax, %eax + jmp ..B1.33 +..B1.73: + xorl %ecx, %ecx + jmp ..B1.40 +..B1.74: + xorl %ecx, %ecx + jmp ..B1.47 +..B1.75: + xorl %ecx, %ecx + jmp ..B1.55 +..B1.76: + xorl %ecx, %ecx + jmp ..B1.63 +..B1.77: + cmpl $-1317741120, %ecx + jb ..B1.51 +..B1.78: + jne ..B1.59 +..B1.79: + cmpl $833536233, 8(%ebp) + jbe ..B1.51 + jmp ..B1.59 + .align 16,0x90 + .type coshl,@function + .size coshl,.-coshl + .data +# -- End coshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 2 +_Q3: + .word 21845 + .word 213 + .word 0 + .word 32768 + .word 16382 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 62430 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 22894 + .word 21845 + .word 43733 + .word 43690 + .word 16378 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 65531 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 7054 + .word 43693 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 25016 + .word 58228 + .word 24755 + .word 46603 + .word 16373 + .word 0 + .word 57397 + .word 35800 + .word 53031 + .word 53262 + .word 16367 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 18360 + .word 43637 + .word 28980 + .word 40373 + .word 49076 + .word 0 + .word 16302 + .word 43691 + .word 43690 + .word 43690 + .word 16362 + .word 0 + .word 46125 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 29965 + .word 3335 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 54950 + .word 46751 + .word 32187 + .word 37874 + .word 16361 + .word 0 + .word 30733 + .word 25775 + .word 51110 + .word 36726 + .word 16354 + .word 0 + .word 49850 + .word 450 + .word 9929 + .word 51659 + .word 16346 + .word 0 + .word 2776 + .word 45191 + .word 37201 + .word 55334 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16378 + .word 0 + .type _Q,@object + .size _Q,120 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cosl.S b/external/sgx_libm/ia32/cosl.S new file mode 100644 index 0000000000..2db539db3c --- /dev/null +++ b/external/sgx_libm/ia32/cosl.S @@ -0,0 +1,1022 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosl.c" + .text +..TXTST0: +# -- Begin cosl + .text + .align 16,0x90 + .globl cosl +cosl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 136(%esp) +..B1.2: + fnstcw 46(%esp) +..B1.3: + movzwl 16(%ebp), %edx + andl $32767, %edx + movzwl 46(%esp), %eax + cmpl $16378, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jge ..B1.47 +..B1.4: + cmpl $16372, %edx + jge ..B1.39 +..B1.5: + cmpl $16364, %edx + jge ..B1.31 +..B1.6: + cmpl $16308, %edx + jge ..B1.23 +..B1.7: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.77 +..B1.8: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.9: + fldcw 44(%esp) +..B1.10: + movzwl 16(%ebp), %edx + movl $1, %eax + andl $32767, %edx +..B1.11: + testl %edx, %edx + jne ..B1.17 +..B1.12: + cmpl $0, 12(%ebp) + jne ..B1.14 +..B1.13: + cmpl $0, 8(%ebp) + je ..B1.18 +..B1.91: + cmpl $0, 12(%ebp) +..B1.14: + jne ..B1.16 +..B1.15: + cmpl $0, 8(%ebp) + je ..B1.17 +..B1.16: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl (%esp) +..B1.17: + fldt _small_value_80@GOTOFF(%ebx) + fsubrl _ones@GOTOFF(%ebx) + fstpt 8(%esp) + jmp ..B1.19 +..B1.18: + fldl _ones@GOTOFF(%ebx) + fstpt 8(%esp) +..B1.19: + testl %eax, %eax + je ..B1.21 +..B1.20: + fldcw 46(%esp) +..B1.21: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.76 +..B1.22: + fldt 8(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.79 +..B1.24: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.25: + fldcw 44(%esp) +..B1.26: + movl $1, %eax +..B1.27: + fldt 8(%ebp) + testl %eax, %eax + fldt _CP3@GOTOFF(%ebx) + fmul %st(1), %st + fmulp %st, %st(1) + faddl _ones@GOTOFF(%ebx) + fstpt 8(%esp) + je ..B1.29 +..B1.28: + fldcw 46(%esp) +..B1.29: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.76 +..B1.30: + fldt 8(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.81 +..B1.32: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.33: + fldcw 44(%esp) +..B1.34: + movl $1, %eax +..B1.35: + fldt 8(%ebp) + testl %eax, %eax + fmul %st(0), %st + fldt 12+_CP2@GOTOFF(%ebx) + fmul %st(1), %st + fldt _CP2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddl _ones@GOTOFF(%ebx) + fstpt 8(%esp) + je ..B1.37 +..B1.36: + fldcw 46(%esp) +..B1.37: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.76 +..B1.38: + fldt 8(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.83 +..B1.40: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.41: + fldcw 44(%esp) +..B1.42: + movl $1, %eax +..B1.43: + fldt 8(%ebp) + testl %eax, %eax + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_CP1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_CP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_CP1@GOTOFF(%ebx) + fmulp %st, %st(2) + fldt _CP1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddl _ones@GOTOFF(%ebx) + fstpt 8(%esp) + je ..B1.45 +..B1.44: + fldcw 46(%esp) +..B1.45: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.76 +..B1.46: + fldt 8(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.47: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.86 +..B1.48: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.49: + fldcw 44(%esp) +..B1.50: + movzwl 16(%ebp), %edx + movl $1, %esi + andl $32767, %edx +..B1.51: + cmpl $16413, %edx + jge ..B1.58 +..B1.52: + fldt 8(%ebp) + fldl _Pi4Inv@GOTOFF(%ebx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fxch %st(1) + fmull _ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(1) + fxch %st(1) + fstpt 20(%esp) + movzwl 28(%esp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.54 +..B1.53: + fldl _TWO_52H@GOTOFF(%ebx) + xorl %eax, %eax + fmul %st(1), %st + fld %st(1) + movl $1, %ecx + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(1) + fsub %st(1), %st + fxch %st(2) + fxch %st(1) + fxch %st(2) + jmp ..B1.69 +..B1.54: + fldl _TWO_32H@GOTOFF(%ebx) + negl %ecx + addl $30, %ecx + movl 24(%esp), %eax + shrl %cl, %eax + lea 1(%eax), %ecx + movl %ecx, %edi + andl $-2, %edi + movl %edi, 8(%esp) + cmpl $16400, %edx + fildl 8(%esp) + jge ..B1.56 +..B1.55: + fldl _Pi04x3@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x3@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x3@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + jmp ..B1.57 +..B1.56: + fldl _Pi04x5@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x5@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 24+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 32+_Pi04x5@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) +..B1.57: + fldl _TWO_52H@GOTOFF(%ebx) + addl $3, %eax + fmul %st(1), %st + fld %st(1) + shrl $2, %eax + fadd %st(1), %st + andl $1, %eax + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fxch %st(1) + fxch %st(2) + jmp ..B1.69 +..B1.58: + cmpl $32767, %edx + jne ..B1.67 +..B1.59: + cmpl $-2147483648, 12(%ebp) + jne ..B1.62 +..B1.60: + cmpl $0, 8(%ebp) + jne ..B1.62 +..B1.61: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt 8(%esp) + jmp ..B1.63 +..B1.62: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt 8(%esp) +..B1.63: + testl %esi, %esi + je ..B1.65 +..B1.64: + fldcw 46(%esp) +..B1.65: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.76 +..B1.66: + fldt 8(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.67: + fldt 8(%ebp) + addl $-32, %esp + movzbl 17(%ebp), %eax + lea 152(%esp), %edx + andl $128, %eax + shrl $7, %eax + fmull _ones@GOTOFF(%ebx,%eax,8) + fstpt (%esp) + movl $0, 12(%esp) + movl %edx, 16(%esp) + call __libm_reduce_pi04l +..B1.89: + movl %eax, %ecx + addl $32, %esp +..B1.68: + fldl 120(%esp) + lea 3(%ecx), %eax + fldl _TWO_52H@GOTOFF(%ebx) + incl %ecx + fmul %st(1), %st + fld %st(0) + shrl $2, %eax + fadd %st(2), %st + andl $1, %eax + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddl 128(%esp) + fadd %st, %st(1) +..B1.69: + fldl _TWO_53H@GOTOFF(%ebx) + testb $2, %cl + fstpt 48(%esp) + fld %st(2) + fmul %st(1), %st + fld %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 80(%esp) + fldt 80(%esp) + fld %st(3) + fmul %st(4), %st + fld %st(0) + fadd %st(2), %st + fstpt 32(%esp) + fldt 32(%esp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fld %st(1) + fmul %st(2), %st + fld %st(0) + faddp %st, %st(2) + fldl _ones@GOTOFF(%ebx,%eax,8) + fstpl 112(%esp) + je ..B1.71 +..B1.70: + fldt 96+_SP@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(6) + fstpt 8(%esp) + fldt 84+_SP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 72+_SP@GOTOFF(%ebx) + faddp %st, %st(7) + fxch %st(2) + fmul %st, %st(6) + fldt 60+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(7) + fmul %st, %st(6) + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(7) + fmul %st, %st(6) + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(6) + fldt 32(%esp) + fmulp %st, %st(6) + fxch %st(1) + faddp %st, %st(5) + fldt 64(%esp) + fldt 80(%esp) + fldt 120+_SP@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(7) + fxch %st(1) + fmulp %st, %st(2) + fldt 108+_SP@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(5) + fxch %st(1) + fadd %st(4), %st + fld %st(2) + fldt 48(%esp) + fmul %st(2), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 8(%esp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fadd %st, %st(1) + fldl 112(%esp) + fmul %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) + jmp ..B1.72 +..B1.71: + fstp %st(3) + fstp %st(3) + fstp %st(3) + fldt 96+_CP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 84+_CP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 72+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 32(%esp) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 64(%esp) + fldt 80(%esp) + fldt 120+_CP@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldt 108+_CP@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fldt 48(%esp) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fldl 112(%esp) + fldl _ones@GOTOFF(%ebx) + fadd %st, %st(2) + fsub %st(2), %st + faddp %st, %st(3) + fxch %st(2) + fadd %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) +..B1.72: + testl %esi, %esi + je ..B1.92 +..B1.73: + fstpt 20(%esp) +..B1.90: + fldcw 46(%esp) + jmp ..B1.74 +..B1.92: + fstp %st(0) +..B1.74: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.76 +..B1.75: + fldt 96(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.76: + call __stack_chk_fail@PLT +..B1.77: + xorl %eax, %eax + jmp ..B1.11 +..B1.79: + xorl %eax, %eax + jmp ..B1.27 +..B1.81: + xorl %eax, %eax + jmp ..B1.35 +..B1.83: + xorl %eax, %eax + jmp ..B1.43 +..B1.86: + xorl %esi, %esi + jmp ..B1.51 + .align 16,0x90 + .type cosl,@function + .size cosl,.-cosl + .data +# -- End cosl + .section .rodata, "a" + .align 16 + .align 16 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_CP3: + .word 0 + .word 65450 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .type _CP3,@object + .size _CP3,12 + .space 4, 0x00 # pad + .align 16 +_CP2: + .word 63855 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 18238 + .word 17476 + .word 43656 + .word 43690 + .word 16378 + .word 0 + .type _CP2,@object + .size _CP2,24 + .space 8, 0x00 # pad + .align 16 +_CP1: + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 47533 + .word 43689 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 14131 + .word 49466 + .word 24756 + .word 46603 + .word 49141 + .word 0 + .word 37142 + .word 18013 + .word 35855 + .word 53259 + .word 16367 + .word 0 + .type _CP1,@object + .size _CP1,48 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .space 8, 0x00 # pad + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_Pi04x3: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _Pi04x3,@object + .size _Pi04x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi04x5: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _Pi04x5,@object + .size _Pi04x5,40 + .space 8, 0x00 # pad + .align 16 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .space 8, 0x00 # pad + .align 16 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .type _SP,@object + .size _SP,132 + .space 12, 0x00 # pad + .align 16 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .type _CP,@object + .size _CP,132 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cpow.S b/external/sgx_libm/ia32/cpow.S new file mode 100644 index 0000000000..541a0cb524 --- /dev/null +++ b/external/sgx_libm/ia32/cpow.S @@ -0,0 +1,898 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cpow.c" + .text +..TXTST0: +# -- Begin cpowf + .text + .align 16,0x90 + .globl cpowf +cpowf: +# parameter 1: 80 + %esp +# parameter 2: 88 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $72, %esp + flds 80(%esp) + flds 84(%esp) + flds 88(%esp) + flds 92(%esp) + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 56(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpl 48(%esp) + fxch %st(2) + fstpl 24(%esp) + fstpl 32(%esp) + fstpl 40(%esp) + addl $-48, %esp + movl 72(%esp), %ecx + lea 56(%esp), %eax + movl %eax, (%esp) + lea 4(%esp), %edx + movl 20(%eax), %eax + movl %ecx, (%edx) + movl %eax, 4(%edx) + movl 80(%esp), %ecx + movl 84(%esp), %eax + movl %ecx, 8(%edx) + movl %eax, 12(%edx) + lea 20(%esp), %eax + movl 88(%esp), %edx + movl %edx, (%eax) + movl 92(%esp), %edx + movl %edx, 4(%eax) + movl 96(%esp), %ecx + movl 100(%esp), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call cpow@PLT +..B1.7: + addl $44, %esp +..B1.2: + fldl 8(%esp) + fstps (%esp) + fldl 16(%esp) + fstps 4(%esp) + movl 56(%esp), %ecx + xorl %esp, %ecx + movl (%esp), %eax + movl 4(%esp), %edx + cmpl %gs:20, %ecx + jne ..B1.4 +..B1.3: + addl $72, %esp + popl %ebx + ret +..B1.4: + call __stack_chk_fail@PLT + .align 16,0x90 + .type cpowf,@function + .size cpowf,.-cpowf + .data +# -- End cpowf + .text +# -- Begin cpow + .text + .align 16,0x90 + .globl cpow +cpow: +# parameter 1: 12 + %ebp +# parameter 2: 28 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 224(%esp) + fstl 208(%esp) + fstpl 216(%esp) +..B2.2: + fnstcw 206(%esp) +..B2.3: + movzwl 206(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B2.38 +..B2.4: + orl $-64768, %ecx + movw %cx, 204(%esp) +..B2.5: + fldcw 204(%esp) +..B2.6: + movl $1, %esi +..B2.7: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnzfinite +..B2.41: + addl $16, %esp +..B2.8: + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + testl %eax, %eax + jne ..B2.31 +..B2.9: + fldl 20(%ebp) + fldl ZEROA@GOTOFF(%ebx) + fucom %st(1) + fnstsw %ax + sahf + jp ..B2.10 + je ..B2.27 +..B2.10: + fldl 28(%ebp) + fucom %st(1) + fnstsw %ax + sahf + jp ..B2.11 + je ..B2.25 +..B2.11: + fxch %st(2) + fucom %st(1) + fnstsw %ax + sahf + jp ..B2.12 + je ..B2.20 +..B2.12: + fstp %st(2) + fldl 36(%ebp) + fucompp + fnstsw %ax + sahf + jp ..B2.13 + je ..B2.19 +..B2.13: + fldl 12(%ebp) + fstpt 36(%esp) + fstpt 48(%esp) + fldt 36(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fldt 48(%esp) + fldt 48(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.49: + addl $16, %esp + fstpt 120(%esp) + fldt 48(%esp) + fldt 36(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2dl@PLT +..B2.48: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + addl $32, %esp + fstpt (%esp) + fldt (%esp) + fxch %st(1) + fstpt 60(%esp) + fldt 120(%esp) + addl $-16, %esp + fldl 28(%ebp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%esp) + call expl@PLT +..B2.47: + fldt _LD_PI_DIV_180@GOTOFF(%ebx) + addl $16, %esp + fxch %st(1) + fstpt 156(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 36(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + call expl@PLT +..B2.46: + fldl 36(%ebp) + addl $16, %esp + fxch %st(1) + fstpt 168(%esp) + fldt 156(%esp) + fldt 168(%esp) + fdivrp %st, %st(1) + fstpt 72(%esp) + fldt 120(%esp) + addl $-16, %esp + fldt 16(%esp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%esp) + call cosl@PLT +..B2.45: + addl $16, %esp + fstpt 132(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call cosdl@PLT +..B2.44: + addl $16, %esp + fstpt 84(%esp) + fldt 120(%esp) + addl $-16, %esp + fldt 16(%esp) + fmull 36(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + call sinl@PLT +..B2.43: + addl $16, %esp + fstpt 144(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call sindl@PLT +..B2.42: + addl $16, %esp + fstpt 96(%esp) + fldt 132(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fldt 144(%esp) + fldt 96(%esp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt 180(%esp) + fldt 144(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fldt 96(%esp) + fldt 132(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 192(%esp) + fldt 180(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 208(%esp) + fldt 192(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 216(%esp) +..B2.14: + testl %esi, %esi + je ..B2.16 +..B2.15: + fldcw 206(%esp) +..B2.16: + movl 208(%esp), %edx + movl %edx, (%edi) + movl 212(%esp), %ecx + movl 216(%esp), %esi + movl 220(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 224(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.18 +..B2.17: + movl %edi, %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B2.18: + call __stack_chk_fail@PLT +..B2.19: + fldl 12(%ebp) + fstpt 36(%esp) + fstpt 48(%esp) + fldt 36(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fldt 48(%esp) + fldt 48(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + addl $-32, %esp + fstpt (%esp) + fldl .L_2il0floatpacket.0@GOTOFF(%ebx) + fmull 28(%ebp) + fstpt 12(%esp) + call powl@PLT +..B2.53: + addl $32, %esp + fstpt 72(%esp) + fldt 48(%esp) + fldt 36(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2dl@PLT +..B2.52: + addl $32, %esp + fstpt 60(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call cosdl@PLT +..B2.51: + addl $16, %esp + fstpt 132(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call sindl@PLT +..B2.50: + addl $16, %esp + fstpt 144(%esp) + fldt 72(%esp) + fldt 132(%esp) + fmulp %st, %st(1) + fstpl 208(%esp) + fldt 72(%esp) + fldt 144(%esp) + fmulp %st, %st(1) + fstpl 216(%esp) + jmp ..B2.14 +..B2.20: + fldl 12(%ebp) + fcom %st(2) + fnstsw %ax + sahf + jbe ..B2.22 +..B2.21: + fstp %st(1) + fstp %st(1) + addl $-32, %esp + fstpt (%esp) + fstpt 12(%esp) + call powl@PLT +..B2.57: + fldl 12(%ebp) + addl $32, %esp + fxch %st(1) + fstpt 72(%esp) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.56: + addl $16, %esp + fstpt 24(%esp) + fldt 24(%esp) + addl $-16, %esp + fmull 36(%ebp) + fstpt (%esp) + call cosl@PLT +..B2.55: + addl $16, %esp + fstpt 132(%esp) + fldt 24(%esp) + addl $-16, %esp + fmull 36(%ebp) + fstpt (%esp) + call sinl@PLT +..B2.54: + addl $16, %esp + fstpt 144(%esp) + fldt 132(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 208(%esp) + fldt 144(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 216(%esp) + jmp ..B2.14 +..B2.22: + fstp %st(3) + fxch %st(1) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B2.24 +..B2.23: + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fchs + fstpt 12(%esp) + fstpt 48(%esp) + fldt 12(%esp) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.65: + addl $16, %esp + fstpt 120(%esp) + fldt 48(%esp) + fldt 36(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2dl@PLT +..B2.64: + addl $32, %esp + fstpt 60(%esp) + fldt 120(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call expl@PLT +..B2.63: + fldt _LD_PI_DIV_180@GOTOFF(%ebx) + addl $16, %esp + fxch %st(1) + fstpt 156(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 36(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + call expl@PLT +..B2.62: + addl $16, %esp + fstpt 168(%esp) + fldt 156(%esp) + fldt 168(%esp) + fdivrp %st, %st(1) + fstpt 72(%esp) + fldt 120(%esp) + addl $-16, %esp + fmull 36(%ebp) + fstpt (%esp) + call cosl@PLT +..B2.61: + addl $16, %esp + fstpt 132(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call cosdl@PLT +..B2.60: + addl $16, %esp + fstpt 84(%esp) + fldt 120(%esp) + addl $-16, %esp + fmull 36(%ebp) + fstpt (%esp) + call sinl@PLT +..B2.59: + addl $16, %esp + fstpt 144(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call sindl@PLT +..B2.58: + addl $16, %esp + fstpt 96(%esp) + fldt 132(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fldt 144(%esp) + fldt 96(%esp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt 180(%esp) + fldt 144(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fldt 96(%esp) + fldt 132(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 192(%esp) + fldt 180(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 208(%esp) + fldt 192(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 216(%esp) + jmp ..B2.14 +..B2.24: + fxch %st(1) + fstpl 208(%esp) + fstpl 216(%esp) + jmp ..B2.14 +..B2.25: + fldl 36(%ebp) + fucomp %st(2) + fnstsw %ax + sahf + jne ..B2.11 + jp ..B2.11 +..B2.26: + fstp %st(0) + fstp %st(0) + fldl 12(%ebp) + fstpt 36(%esp) + fstpt 48(%esp) + fldt 36(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fldt 48(%esp) + fldt 48(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.69: + addl $16, %esp + fstpt 120(%esp) + fldt 48(%esp) + fldt 36(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2l@PLT +..B2.68: + addl $32, %esp + fstpt 60(%esp) + fldt 120(%esp) + fldt 60(%esp) + addl $-16, %esp + faddp %st, %st(1) + fstpt (%esp) + call sinl@PLT +..B2.67: + fldl ZEROA@GOTOFF(%ebx) + fld1 + addl $16, %esp + fstpl 208(%esp) + addl $-16, %esp + fstpl (%esp) + fstpl 8(%esp) + call copysign@PLT +..B2.66: + addl $16, %esp + fstpl 216(%esp) + jmp ..B2.14 +..B2.27: + fldl 36(%ebp) + fucomp %st(1) + fnstsw %ax + sahf + jne ..B2.10 + jp ..B2.10 +..B2.28: + fldl 12(%ebp) + fxch %st(1) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.30 +..B2.29: + fstpt 36(%esp) + fldt 36(%esp) + fchs + fstpt 12(%esp) + fstpt 48(%esp) + fldt 48(%esp) + fldt 36(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2dl@PLT +..B2.73: + fldl 28(%ebp) + addl $32, %esp + fxch %st(1) + fstpt 60(%esp) + fldt 12(%esp) + addl $-32, %esp + fstpt (%esp) + fstpt 12(%esp) + call powl@PLT +..B2.72: + addl $32, %esp + fstpt 72(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call cosdl@PLT +..B2.71: + addl $16, %esp + fstpt 84(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call sindl@PLT +..B2.70: + addl $16, %esp + fstpt 96(%esp) + fldt 72(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fstpl 208(%esp) + fldt 72(%esp) + fldt 96(%esp) + fmulp %st, %st(1) + fstpl 216(%esp) + jmp ..B2.14 +..B2.30: + fldl 28(%ebp) + addl $-16, %esp + fstpl 8(%esp) + fstpl (%esp) + fstpl 16(%esp) + call pow@PLT +..B2.74: + fldl 16(%esp) + addl $16, %esp + fstpl 216(%esp) + fstpl 208(%esp) + jmp ..B2.14 +..B2.31: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnzfinite +..B2.75: + addl $16, %esp +..B2.32: + testl %eax, %eax + je ..B2.9 +..B2.33: + fldl 28(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnzfinite +..B2.76: + addl $16, %esp +..B2.34: + testl %eax, %eax + je ..B2.9 +..B2.35: + fldl 36(%ebp) + addl $-16, %esp + fstpl (%esp) + call __libm_internal_isnzfinite +..B2.77: + addl $16, %esp +..B2.36: + testl %eax, %eax + je ..B2.9 +..B2.37: + fldl 12(%ebp) + fstpt 36(%esp) + fldl 20(%ebp) + fstpt 48(%esp) + fldt 36(%esp) + fldt 36(%esp) + fmulp %st, %st(1) + fldt 48(%esp) + fldt 48(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 108(%esp) + fldt 108(%esp) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.85: + addl $16, %esp + fstpt 120(%esp) + fldt 48(%esp) + fldt 36(%esp) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + call atan2dl@PLT +..B2.84: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + addl $32, %esp + fstpt (%esp) + fldt (%esp) + fxch %st(1) + fstpt 60(%esp) + fldt 120(%esp) + addl $-16, %esp + fldl 28(%ebp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%esp) + call expl@PLT +..B2.83: + fldt _LD_PI_DIV_180@GOTOFF(%ebx) + addl $16, %esp + fxch %st(1) + fstpt 156(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 36(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + call expl@PLT +..B2.82: + fldl 36(%ebp) + addl $16, %esp + fxch %st(1) + fstpt 168(%esp) + fldt 156(%esp) + fldt 168(%esp) + fdivrp %st, %st(1) + fstpt 72(%esp) + fldt 120(%esp) + addl $-16, %esp + fldt 16(%esp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%esp) + call cosl@PLT +..B2.81: + addl $16, %esp + fstpt 132(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call cosdl@PLT +..B2.80: + addl $16, %esp + fstpt 84(%esp) + fldt 120(%esp) + addl $-16, %esp + fldt 16(%esp) + fmull 36(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + call sinl@PLT +..B2.79: + addl $16, %esp + fstpt 144(%esp) + fldt 60(%esp) + addl $-16, %esp + fmull 28(%ebp) + fstpt (%esp) + call sindl@PLT +..B2.78: + addl $16, %esp + fstpt 96(%esp) + fldt 132(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fldt 144(%esp) + fldt 96(%esp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt 180(%esp) + fldt 144(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + fldt 96(%esp) + fldt 132(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 192(%esp) + fldt 180(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 208(%esp) + fldt 192(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + fstpl 216(%esp) + jmp ..B2.14 +..B2.38: + xorl %esi, %esi + jmp ..B2.7 + .align 16,0x90 + .type cpow,@function + .size cpow,.-cpow + .data +# -- End cpow + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +ZEROA: + .long 0 + .long 0 + .type ZEROA,@object + .size ZEROA,8 + .space 8, 0x00 # pad + .align 16 +_LD_PI_DIV_180: + .word 51374 + .word 38121 + .word 13586 + .word 36602 + .word 16377 + .word 0 + .type _LD_PI_DIV_180,@object + .size _LD_PI_DIV_180,12 + .space 4, 0x00 # pad + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .hidden __libm_internal_isnzfinite + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cpowl.S b/external/sgx_libm/ia32/cpowl.S new file mode 100644 index 0000000000..232f82c9a2 --- /dev/null +++ b/external/sgx_libm/ia32/cpowl.S @@ -0,0 +1,190 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cpowl.c" + .text +..TXTST0: +# -- Begin cpowl + .text + .align 16,0x90 + .globl cpowl +cpowl: +# parameter 1: 12 + %ebp +# parameter 2: 36 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $104, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %eax + xorl %esp, %eax + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + movl %eax, 100(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.4: + orl $-64768, %edx + movw %dx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %esi +..B1.7: + addl $-32, %esp + movl 12(%ebp), %ecx + lea 60(%esp), %edx + movl %edx, (%esp) + lea 4(%esp), %eax + movl 16(%ebp), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 20(%ebp), %ecx + movl 24(%ebp), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + movl 28(%ebp), %ecx + movl 32(%ebp), %edx + movl %ecx, 16(%eax) + movl %edx, 20(%eax) + call clogl@PLT +..B1.16: + fldt 36(%ebp) + addl $28, %esp + fld %st(0) + fldt 48(%ebp) + fld %st(0) + fldt 28(%esp) + fmul %st, %st(3) + fmulp %st, %st(2) + fldt 40(%esp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(2) + fstpt 76(%esp) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 88(%esp) + addl $-32, %esp + movl 108(%esp), %ecx + lea 84(%esp), %edx + movl %edx, (%esp) + lea 4(%esp), %eax + movl 28(%edx), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 116(%esp), %ecx + movl 120(%esp), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + movl 124(%esp), %ecx + movl 128(%esp), %edx + movl %ecx, 16(%eax) + movl %edx, 20(%eax) + call cexpl@PLT +..B1.15: + addl $28, %esp + fldt 52(%esp) + testl %esi, %esi + fstpt 4(%esp) + fldt 64(%esp) + fstpt 16(%esp) + je ..B1.9 +..B1.8: + fldcw 2(%esp) +..B1.9: + movl 8(%ebp), %eax + movl 4(%esp), %edx + movl 8(%esp), %ecx + movl 12(%esp), %esi + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl %esi, 8(%eax) + movl 16(%esp), %edx + movl 20(%esp), %ecx + movl 24(%esp), %esi + movl %edx, 12(%eax) + movl %ecx, 16(%eax) + movl %esi, 20(%eax) + movl 100(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.11 +..B1.10: + addl $104, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.11: + call __stack_chk_fail@PLT +..B1.12: + xorl %esi, %esi + jmp ..B1.7 + .align 16,0x90 + .type cpowl,@function + .size cpowl,.-cpowl + .data +# -- End cpowl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cproj.S b/external/sgx_libm/ia32/cproj.S new file mode 100644 index 0000000000..1cff21c17e --- /dev/null +++ b/external/sgx_libm/ia32/cproj.S @@ -0,0 +1,164 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cproj.c" + .text +..TXTST0: +# -- Begin cproj + .text + .align 16,0x90 + .globl cproj +cproj: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp + fldz + movl %gs:20, %ecx + movl 8(%ebp), %eax + xorl %esp, %ecx + movl %ecx, 16(%esp) + movzwl 18(%ebp), %ecx + andl $32752, %ecx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $32752, %ecx + je ..B1.15 +..B1.2: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + cmpl $32752, %ecx + je ..B1.6 +..B1.3: + fstp %st(0) + movl 12(%ebp), %ecx + movl %ecx, (%eax) + movl 16(%ebp), %ecx + movl %ecx, 4(%eax) + movl 20(%ebp), %ecx + movl %ecx, 8(%eax) + movl 24(%ebp), %ecx + movl %ecx, 12(%eax) + movl 16(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.5 +..B1.4: + movl %ebp, %esp + popl %ebp + ret $4 +..B1.5: + movl %edx, %ebx + call __stack_chk_fail@PLT +..B1.6: + testl $1048575, 24(%ebp) + jne ..B1.3 +..B1.7: + cmpl $0, 20(%ebp) + jne ..B1.3 +..B1.8: + fstl 8(%esp) + fstpl (%esp) +..B1.9: + fldl DBL_PINFA@GOTOFF(%edx) + movzbl 27(%ebp), %ecx + testl $128, %ecx + fstpl (%esp) + je ..B1.11 +..B1.10: + fldl DBL_NZEROA@GOTOFF(%edx) + fstpl 8(%esp) + jmp ..B1.12 +..B1.11: + fldl DBL_PZEROA@GOTOFF(%edx) + fstpl 8(%esp) +..B1.12: + movl (%esp), %ecx + movl %ecx, (%eax) + movl 4(%esp), %ecx + movl %ecx, 4(%eax) + movl 8(%esp), %ecx + movl %ecx, 8(%eax) + movl 12(%esp), %ecx + movl %ecx, 12(%eax) + movl 16(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.5 + jmp ..B1.4 +..B1.15: + testl $1048575, 16(%ebp) + jne ..B1.2 +..B1.16: + cmpl $0, 12(%ebp) + je ..B1.8 + jmp ..B1.2 + .align 16,0x90 + .type cproj,@function + .size cproj,.-cproj + .data +# -- End cproj + .section .rodata, "a" + .align 16 + .align 16 +DBL_PINFA: + .long 0 + .long 2146435072 + .type DBL_PINFA,@object + .size DBL_PINFA,8 + .space 8, 0x00 # pad + .align 16 +DBL_NZEROA: + .long 0 + .long 2147483648 + .type DBL_NZEROA,@object + .size DBL_NZEROA,8 + .space 8, 0x00 # pad + .align 16 +DBL_PZEROA: + .long 0 + .long 0 + .type DBL_PZEROA,@object + .size DBL_PZEROA,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cprojf.S b/external/sgx_libm/ia32/cprojf.S new file mode 100644 index 0000000000..7ad2437823 --- /dev/null +++ b/external/sgx_libm/ia32/cprojf.S @@ -0,0 +1,110 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cprojf.c" + .text +..TXTST0: +# -- Begin cprojf + .text + .align 16,0x90 + .globl cprojf +cprojf: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movzwl 18(%esp), %eax + andl $32640, %eax + cmpl $32640, %eax + je ..B1.10 +..B1.2: + movzwl 22(%esp), %eax + andl $32640, %eax + cmpl $32640, %eax + je ..B1.4 +..B1.3: + movl 16(%esp), %eax + movl 20(%esp), %edx + addl $12, %esp + ret +..B1.4: + testl $8388607, 20(%esp) + jne ..B1.3 +..B1.5: + xorl %eax, %eax + movl %eax, 4(%esp) + movl %eax, (%esp) +..B1.6: + movzbl 23(%esp), %eax + testl $128, %eax + movl $2139095040, (%esp) + je ..B1.8 +..B1.7: + movl $-2147483648, 4(%esp) + jmp ..B1.9 +..B1.8: + xorl %eax, %eax + movl %eax, 4(%esp) +..B1.9: + movl (%esp), %eax + movl 4(%esp), %edx + addl $12, %esp + ret +..B1.10: + testl $8388607, 16(%esp) + je ..B1.5 + jmp ..B1.2 + .align 16,0x90 + .type cprojf,@function + .size cprojf,.-cprojf + .data +# -- End cprojf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.5: + .long 0x7f800000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,4 + .align 4 +.L_2il0floatpacket.6: + .long 0x80000000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/cprojl.S b/external/sgx_libm/ia32/cprojl.S new file mode 100644 index 0000000000..f04c70da83 --- /dev/null +++ b/external/sgx_libm/ia32/cprojl.S @@ -0,0 +1,155 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cprojl.c" + .text +..TXTST0: +# -- Begin cprojl + .text + .align 16,0x90 + .globl cprojl +cprojl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %ebx + subl $28, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movzwl 20(%ebp), %ecx + andl $32767, %ecx + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + movl %gs:20, %edx + movl 8(%ebp), %eax + xorl %esp, %edx + movl %edx, 24(%esp) + cmpl $32767, %ecx + movzbl 9+.L_2il0floatpacket.7@GOTOFF(%ebx), %edx + je ..B1.11 +..B1.2: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.7 +..B1.3: + fstp %st(0) + fldt 12(%ebp) + fstpt (%esp) + fldt 24(%ebp) + fstpt 12(%esp) +..B1.4: + movl (%esp), %edx + movl 4(%esp), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 8(%esp), %edx + movl 12(%esp), %ecx + movl %edx, 8(%eax) + movl %ecx, 12(%eax) + movl 16(%esp), %edx + movl 20(%esp), %ecx + movl %edx, 16(%eax) + movl %ecx, 20(%eax) + movl 24(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.6 +..B1.5: + addl $28, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret $4 +..B1.6: + call __stack_chk_fail@PLT +..B1.7: + cmpl $-2147483648, 28(%ebp) + jne ..B1.3 +..B1.8: + cmpl $0, 24(%ebp) + jne ..B1.3 +..B1.9: + fstpt 12(%esp) + fldt 12(%esp) + fstpt (%esp) + fldt (%esp) +..B1.10: + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + andl $127, %edx + movzwl 8+.L_2il0floatpacket.8@GOTOFF(%ebx), %ecx + fstpt (%esp) + orl $-32769, %ecx + movw %cx, 8(%esp) + movzbl 33(%ebp), %ecx + andl $-128, %ecx + fstpt 12(%esp) + orl %ecx, %edx + movb %dl, 21(%esp) + jmp ..B1.4 +..B1.11: + cmpl $-2147483648, 16(%ebp) + jne ..B1.2 +..B1.12: + cmpl $0, 12(%ebp) + je ..B1.9 + jmp ..B1.2 + .align 16,0x90 + .type cprojl,@function + .size cprojl,.-cprojl + .data +# -- End cprojl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/creal.S b/external/sgx_libm/ia32/creal.S new file mode 100644 index 0000000000..4cea6579ee --- /dev/null +++ b/external/sgx_libm/ia32/creal.S @@ -0,0 +1,58 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "creal.c" + .text +..TXTST0: +# -- Begin creal + .text + .align 16,0x90 + .globl creal +creal: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + fldl 4(%esp) + ret + .align 16,0x90 + .type creal,@function + .size creal,.-creal + .data +# -- End creal + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/crealf.S b/external/sgx_libm/ia32/crealf.S new file mode 100644 index 0000000000..263d39c9ac --- /dev/null +++ b/external/sgx_libm/ia32/crealf.S @@ -0,0 +1,58 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "crealf.c" + .text +..TXTST0: +# -- Begin crealf + .text + .align 16,0x90 + .globl crealf +crealf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + flds 4(%esp) + ret + .align 16,0x90 + .type crealf,@function + .size crealf,.-crealf + .data +# -- End crealf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/creall.S b/external/sgx_libm/ia32/creall.S new file mode 100644 index 0000000000..a9c3e1b82f --- /dev/null +++ b/external/sgx_libm/ia32/creall.S @@ -0,0 +1,58 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "creall.c" + .text +..TXTST0: +# -- Begin creall + .text + .align 16,0x90 + .globl creall +creall: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + fldt 4(%esp) + ret + .align 16,0x90 + .type creall,@function + .size creall,.-creall + .data +# -- End creall + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csin.S b/external/sgx_libm/ia32/csin.S new file mode 100644 index 0000000000..2d9cb57967 --- /dev/null +++ b/external/sgx_libm/ia32/csin.S @@ -0,0 +1,237 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csin.c" + .text +..TXTST0: +# -- Begin csin + .text + .align 16,0x90 + .globl csin +csin: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $72, %esp + fldz + fldl 20(%ebp) + fldl 12(%ebp) + movzwl 26(%ebp), %ecx + andl $32752, %ecx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 64(%esp) + cmpl $32752, %ecx + fstpl 56(%esp) + fxch %st(1) + fstl 16(%esp) + fstl 24(%esp) + fstl 32(%esp) + fstpl 40(%esp) + fstpl 48(%esp) + jl ..B1.4 +..B1.2: + testl $1048575, 24(%ebp) + jne ..B1.5 +..B1.3: + cmpl $0, 20(%ebp) + jne ..B1.5 +..B1.4: + movzbl 27(%ebp), %edx + notl %edx + movzbl 55(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 55(%esp) +..B1.5: + addl $-32, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea 32(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl 48(%ecx), %ecx + movl %ecx, (%edx) + movl 84(%esp), %ecx + movl %ecx, 4(%edx) + movl 88(%esp), %ecx + movl %ecx, 8(%edx) + movl 92(%esp), %ecx + movl %ecx, 12(%edx) + call csinh@PLT +..B1.14: + addl $28, %esp + fldl (%esp) + movzwl 6(%esp), %edx + andl $32752, %edx + fstl 16(%esp) + cmpl $32752, %edx + fstpl 40(%esp) + fldl 8(%esp) + fstl 24(%esp) + fstpl 32(%esp) + jl ..B1.8 +..B1.6: + testl $1048575, 20(%esp) + jne ..B1.9 +..B1.7: + cmpl $0, 16(%esp) + jne ..B1.9 +..B1.8: + movzbl 23(%esp), %edx + notl %edx + movzbl 47(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 47(%esp) +..B1.9: + movl 32(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 8(%esi) + movl 36(%esp), %ecx + movl 44(%esp), %edx + movl %ecx, 4(%esi) + movl %edx, 12(%esi) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.11 +..B1.10: + movl %esi, %eax + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.11: + call __stack_chk_fail@PLT + .align 16,0x90 + .type csin,@function + .size csin,.-csin + .data +# -- End csin + .text +# -- Begin csinf + .text + .align 16,0x90 + .globl csinf +csinf: +# parameter 1: 48 + %esp +..B2.1: +..L3: + + pushl %ebx + subl $40, %esp + xorl %eax, %eax + movl %eax, 16(%esp) + movl %eax, 20(%esp) + movl %eax, 24(%esp) + movl %eax, 28(%esp) + movzwl 54(%esp), %eax + andl $32640, %eax + movl 52(%esp), %edx + cmpl $32640, %eax + movl 48(%esp), %ecx + movl %edx, 32(%esp) + movl %ecx, 36(%esp) + jl ..B2.3 +..B2.2: + testl $8388607, 52(%esp) + jne ..B2.4 +..B2.3: + movzbl 55(%esp), %eax + notl %eax + movzbl 35(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 35(%esp) +..B2.4: + addl $8, %esp + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + pushl 28(%esp) + pushl 28(%esp) + call csinhf@PLT +..B2.10: + movl %eax, 16(%esp) + movl %eax, 28(%esp) + shrl $16, %eax + andl $32640, %eax + cmpl $32640, %eax + movl %edx, 20(%esp) + movl %edx, 24(%esp) + jl ..B2.6 +..B2.5: + testl $8388607, 16(%esp) + jne ..B2.7 +..B2.6: + movzbl 19(%esp), %eax + notl %eax + movzbl 31(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 31(%esp) +..B2.7: + movl 24(%esp), %eax + movl 28(%esp), %edx + addl $40, %esp + popl %ebx + ret + .align 16,0x90 + .type csinf,@function + .size csinf,.-csinf + .data +# -- End csinf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csinh.S b/external/sgx_libm/ia32/csinh.S new file mode 100644 index 0000000000..ff2ae257ef --- /dev/null +++ b/external/sgx_libm/ia32/csinh.S @@ -0,0 +1,408 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinh.c" + .text +..TXTST0: +# -- Begin csinh + .text + .align 16,0x90 + .globl csinh +csinh: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 88(%esp) + fstl 72(%esp) + fstpl 80(%esp) +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 18(%ebp), %esi + andl $32752, %esi + shrl $4, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %esi + jge ..B1.19 +..B1.4: + testl %esi, %esi + jle ..B1.56 +..B1.5: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + jge ..B1.20 +..B1.6: + testl %ecx, %ecx + jle ..B1.54 +..B1.7: + cmpl $1034, %esi + jl ..B1.11 +..B1.8: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 8(%esp) + fldl 20(%ebp) + fstl (%esp) + addl $-16, %esp + fstpl (%esp) + movl %ecx, 32(%esp) + call cos@PLT +..B1.62: + movl 32(%esp), %ecx + addl $16, %esp + testl %ecx, %ecx + fmull 8(%esp) + fmull 12(%ebp) + fstpl 72(%esp) + jle ..B1.10 +..B1.9: + addl $-16, %esp + fldl 16(%esp) + fstpl (%esp) + call sin@PLT +..B1.63: + addl $16, %esp + fldl 8(%esp) + fmulp %st, %st(1) + fstpl 80(%esp) + jmp ..B1.44 +..B1.10: + fldl 8(%esp) + fmull (%esp) + fstpl 80(%esp) + jmp ..B1.44 +..B1.11: + movzwl 62(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.53 +..B1.12: + orl $-64768, %ecx + movw %cx, 60(%esp) +..B1.13: + fldcw 60(%esp) +..B1.14: + movl $1, 56(%esp) +..B1.15: + fldl 12(%ebp) + fstpl 48(%esp) + addl $-32, %esp + fldl 20(%ebp) + lea 32(%esp), %edx + lea 44(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + call sincosl@PLT +..B1.16: + fldl 80(%esp) + lea 56(%esp), %edx + lea 68(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + call sinhcoshl@PLT +..B1.65: + addl $32, %esp +..B1.17: + fldt 24(%esp) + fldt 12(%esp) + fmulp %st, %st(1) + fstpl 72(%esp) + fldt 36(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpl 80(%esp) + cmpl $0, 56(%esp) + je ..B1.44 +..B1.18: + fldcw 62(%esp) + jmp ..B1.44 +..B1.19: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx +..B1.20: + testl %ecx, %ecx + jne ..B1.24 +..B1.21: + testl $1048575, 24(%ebp) + jne ..B1.24 +..B1.22: + cmpl $0, 20(%ebp) + jne ..B1.24 +..B1.23: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call sinh@PLT +..B1.66: + fldl 20(%ebp) + addl $16, %esp + fstpl 80(%esp) + fstpl 72(%esp) + jmp ..B1.44 +..B1.24: + cmpl $2047, %ecx + jge ..B1.38 +..B1.25: + movl 16(%ebp), %edx + andl $1048575, %edx + testl %esi, %esi + jne ..B1.32 +..B1.26: + testl %edx, %edx + jne ..B1.37 +..B1.27: + cmpl $0, 12(%ebp) + jne ..B1.33 +..B1.28: + fldl 20(%ebp) + addl $-16, %esp + fstl (%esp) + fstpl 16(%esp) + movl %ecx, 32(%esp) + call cos@PLT +..B1.67: + fldl 16(%esp) + fxch %st(1) + fmull 12(%ebp) + movl 32(%esp), %ecx + addl $16, %esp + fstpl 72(%esp) + testl %ecx, %ecx + jle ..B1.31 +..B1.29: + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.68: + addl $16, %esp +..B1.31: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstpl 80(%esp) + fsubl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fstpl 64(%esp) + jmp ..B1.44 +..B1.32: + testl %edx, %edx + jne ..B1.37 +..B1.73: + cmpl $0, 12(%ebp) +..B1.33: + jne ..B1.37 +..B1.34: + fldl 12(%ebp) + cmpl $1023, %ecx + fstl 16(%esp) + fmul %st(0), %st + fstpl 24(%esp) + jge ..B1.36 +..B1.35: + fldl 16(%esp) + fstpl 72(%esp) + fldl 24(%esp) + fmull 20(%ebp) + fstpl 80(%esp) + jmp ..B1.44 +..B1.36: + fldl 20(%ebp) + fstl 8(%esp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.70: + addl $16, %esp + fstpl (%esp) + addl $-16, %esp + fldl 24(%esp) + fstpl (%esp) + call cos@PLT +..B1.69: + addl $16, %esp + fldl 16(%esp) + fmulp %st, %st(1) + fstpl 72(%esp) + fldl 24(%esp) + fmull (%esp) + fstpl 80(%esp) + jmp ..B1.44 +..B1.37: + fldl 12(%ebp) + fmul %st(0), %st + fstl 72(%esp) + fstpl 80(%esp) + jmp ..B1.44 +..B1.38: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.71: + addl $16, %esp + fstl 80(%esp) + cmpl $2047, %esi + je ..B1.42 +..B1.39: + testl %esi, %esi + jne ..B1.43 +..B1.40: + testl $1048575, 16(%ebp) + jne ..B1.43 +..B1.41: + cmpl $0, 12(%ebp) + jne ..B1.43 +..B1.42: + fstp %st(0) + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call sinh@PLT +..B1.72: + addl $16, %esp + fstpl 72(%esp) + jmp ..B1.44 +..B1.43: + fldl 12(%ebp) + fmulp %st, %st(1) + fstpl 72(%esp) +..B1.44: + movzwl 78(%esp), %edx + testl $32752, %edx + jne ..B1.47 +..B1.45: + testl $1048575, 76(%esp) + jne ..B1.50 +..B1.46: + cmpl $0, 72(%esp) + jne ..B1.50 +..B1.47: + movzwl 86(%esp), %edx + testl $32752, %edx + jne ..B1.51 +..B1.48: + testl $1048575, 84(%esp) + jne ..B1.50 +..B1.49: + cmpl $0, 80(%esp) + je ..B1.51 +..B1.50: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 64(%esp) +..B1.51: + movl 72(%esp), %edx + movl %edx, (%edi) + movl 76(%esp), %ecx + movl 80(%esp), %esi + movl 84(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 88(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.59 +..B1.52: + movl %edi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.53: + movl $0, 56(%esp) + jmp ..B1.15 +..B1.54: + testl $1048575, 24(%ebp) + jne ..B1.7 +..B1.55: + cmpl $0, 20(%ebp) + jne ..B1.7 + jmp ..B1.20 +..B1.56: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.57: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.19 +..B1.59: + call __stack_chk_fail@PLT + .align 16,0x90 + .type csinh,@function + .size csinh,.-csinh + .data +# -- End csinh + .section .rodata, "a" + .align 16 + .align 16 +_DBL_MAX_NORMAL: + .long -1 + .long 2146435071 + .type _DBL_MAX_NORMAL,@object + .size _DBL_MAX_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csinhf.S b/external/sgx_libm/ia32/csinhf.S new file mode 100644 index 0000000000..e646fcc0d2 --- /dev/null +++ b/external/sgx_libm/ia32/csinhf.S @@ -0,0 +1,368 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinhf.c" + .text +..TXTST0: +# -- Begin csinhf + .text + .align 16,0x90 + .globl csinhf +csinhf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + xorl %ecx, %ecx + movl %ecx, 48(%esp) + movl %ecx, 52(%esp) +..B1.2: + fnstcw 38(%esp) +..B1.3: + movzwl 10(%ebp), %esi + andl $32640, %esi + shrl $7, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %esi + jge ..B1.18 +..B1.4: + testl %esi, %esi + jle ..B1.47 +..B1.5: + movzwl 14(%ebp), %edi + andl $32640, %edi + shrl $7, %edi + cmpl $255, %edi + jge ..B1.19 +..B1.6: + testl %edi, %edi + jle ..B1.46 +..B1.7: + cmpl $138, %esi + jl ..B1.11 +..B1.8: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl (%esp) + flds 12(%ebp) + fsts 8(%esp) + addl $-16, %esp + fstps (%esp) + call cosf@PLT +..B1.51: + addl $16, %esp + fmull (%esp) + testl %edi, %edi + fmuls 8(%ebp) + fstps 48(%esp) + jle ..B1.10 +..B1.9: + addl $-16, %esp + flds 24(%esp) + fstps (%esp) + call sinf@PLT +..B1.52: + addl $16, %esp + fldl (%esp) + fmulp %st, %st(1) + fstps 52(%esp) + jmp ..B1.39 +..B1.10: + fldl (%esp) + fmuls 8(%esp) + fstps 52(%esp) + jmp ..B1.39 +..B1.11: + movzwl 38(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.12: + orl $-64768, %edx + movw %dx, 36(%esp) +..B1.13: + fldcw 36(%esp) +..B1.14: + movl $1, %esi +..B1.15: + flds 8(%ebp) + fstps 32(%esp) + flds 12(%ebp) + fsts 24(%esp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.55: + addl $16, %esp + fstpl 16(%esp) + addl $-16, %esp + flds 40(%esp) + fstpl (%esp) + call cos@PLT +..B1.54: + addl $16, %esp + fstpl 24(%esp) + addl $-16, %esp + flds 48(%esp) + lea 16(%esp), %eax + lea 24(%esp), %edx + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + call sinhcosh@PLT +..B1.53: + addl $16, %esp +..B1.16: + fldl (%esp) + testl %esi, %esi + fmull 24(%esp) + fstps 48(%esp) + fldl 8(%esp) + fmull 16(%esp) + fstps 52(%esp) + je ..B1.39 +..B1.17: + fldcw 38(%esp) + jmp ..B1.39 +..B1.18: + movzwl 14(%ebp), %edi + andl $32640, %edi + shrl $7, %edi +..B1.19: + testl %edi, %edi + jne ..B1.22 +..B1.20: + testl $8388607, 12(%ebp) + jne ..B1.22 +..B1.21: + addl $-16, %esp + movl 8(%ebp), %eax + movl %eax, (%esp) + call sinhf@PLT +..B1.56: + movl 12(%ebp), %eax + addl $16, %esp + fstps 48(%esp) + movl %eax, 52(%esp) + jmp ..B1.39 +..B1.22: + cmpl $255, %edi + jge ..B1.34 +..B1.23: + movl 8(%ebp), %eax + andl $8388607, %eax + testl %esi, %esi + jne ..B1.63 +..B1.24: + testl %eax, %eax + jne ..B1.29 +..B1.25: + flds 12(%ebp) + addl $-16, %esp + fsts (%esp) + fstps 16(%esp) + call cosf@PLT +..B1.57: + flds 16(%esp) + addl $16, %esp + fxch %st(1) + fmuls 8(%ebp) + testl %edi, %edi + fstps 48(%esp) + jle ..B1.28 +..B1.26: + addl $-16, %esp + fstps (%esp) + call sinf@PLT +..B1.58: + addl $16, %esp +..B1.28: + fldl _DBL_MAX_NORMAL@GOTOFF(%ebx) + fxch %st(1) + fstps 52(%esp) + fsubl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fstpl 40(%esp) + jmp ..B1.39 +..B1.63: + testl %eax, %eax +..B1.29: + flds 8(%ebp) + jne ..B1.33 +..B1.30: + fld %st(0) + cmpl $127, %edi + fmul %st(1), %st + fstps 8(%esp) + jge ..B1.32 +..B1.31: + flds 8(%esp) + fxch %st(1) + fstps 48(%esp) + fmuls 12(%ebp) + fstps 52(%esp) + jmp ..B1.39 +..B1.32: + addl $-16, %esp + movl 12(%ebp), %esi + movl %esi, (%esp) + fstps 20(%esp) + call sinf@PLT +..B1.60: + flds 20(%esp) + addl $16, %esp + fxch %st(1) + fstps (%esp) + addl $-16, %esp + movl %esi, (%esp) + fstps 20(%esp) + call cosf@PLT +..B1.59: + flds 20(%esp) + addl $16, %esp + fmulp %st, %st(1) + fstps 48(%esp) + flds 8(%esp) + fmuls (%esp) + fstps 52(%esp) + jmp ..B1.39 +..B1.33: + fmul %st(0), %st + fsts 48(%esp) + fstps 52(%esp) + jmp ..B1.39 +..B1.34: + addl $-16, %esp + movl 12(%ebp), %eax + movl %eax, (%esp) + call sinf@PLT +..B1.61: + addl $16, %esp + fsts 52(%esp) + cmpl $255, %esi + je ..B1.37 +..B1.35: + testl %esi, %esi + jne ..B1.38 +..B1.36: + testl $8388607, 8(%ebp) + jne ..B1.38 +..B1.37: + fstp %st(0) + addl $-16, %esp + movl 8(%ebp), %eax + movl %eax, (%esp) + call sinhf@PLT +..B1.62: + addl $16, %esp + fstps 48(%esp) + jmp ..B1.39 +..B1.38: + flds 8(%ebp) + fmulp %st, %st(1) + fstps 48(%esp) +..B1.39: + movzwl 50(%esp), %eax + testl $32640, %eax + jne ..B1.41 +..B1.40: + testl $8388607, 48(%esp) + jne ..B1.43 +..B1.41: + movzwl 54(%esp), %eax + testl $32640, %eax + jne ..B1.44 +..B1.42: + testl $8388607, 52(%esp) + je ..B1.44 +..B1.43: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 40(%esp) +..B1.44: + movl 48(%esp), %eax + movl 52(%esp), %edx + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + movl %ecx, %esi + jmp ..B1.15 +..B1.46: + testl $8388607, 12(%ebp) + jne ..B1.7 + jmp ..B1.19 +..B1.47: + testl $8388607, 8(%ebp) + jne ..B1.5 + jmp ..B1.18 + .align 16,0x90 + .type csinhf,@function + .size csinhf,.-csinhf + .data +# -- End csinhf + .section .rodata, "a" + .align 16 + .align 16 +_DBL_MAX_NORMAL: + .long -1 + .long 2146435071 + .type _DBL_MAX_NORMAL,@object + .size _DBL_MAX_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csinhl.S b/external/sgx_libm/ia32/csinhl.S new file mode 100644 index 0000000000..9a215bb5b3 --- /dev/null +++ b/external/sgx_libm/ia32/csinhl.S @@ -0,0 +1,655 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinhl.c" + .text +..TXTST0: +# -- Begin csinhl + .text + .align 16,0x90 + .globl csinhl +csinhl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + movl %edx, 244(%esp) + fstpt 112(%esp) + fldt 112(%esp) + fstpt 220(%esp) + fldt 220(%esp) + fstpt 232(%esp) +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 62(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.59 +..B1.4: + orl $-64768, %ecx + movw %cx, 60(%esp) +..B1.5: + fldcw 60(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.33 +..B1.8: + testl %edx, %edx + jle ..B1.52 +..B1.9: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.33 +..B1.10: + testl %ecx, %ecx + jle ..B1.50 +..B1.11: + cmpl $16398, %edx + jl ..B1.19 +..B1.12: + fldt _CONSTANTS@GOTOFF(%ebx) + fmul %st(0), %st + fldt 12(%ebp) + fmul %st(1), %st + fstpt (%esp) + fldt 24(%ebp) + fstpt 16(%esp) + fldt 16(%esp) + addl $-16, %esp + fstpt (%esp) + fstpt 48(%esp) + movl %ecx, 28(%esp) + call cosl@PLT +..B1.62: + fldt 48(%esp) + movl 28(%esp), %ecx + addl $16, %esp + fldt (%esp) + testl %ecx, %ecx + fmulp %st, %st(2) + fxch %st(1) + fstpt 220(%esp) + jle ..B1.14 +..B1.13: + addl $-16, %esp + fldt 32(%esp) + fstpt (%esp) + fstpt 48(%esp) + call sinl@PLT +..B1.63: + fldt 48(%esp) + addl $16, %esp + fmulp %st, %st(1) + jmp ..B1.15 +..B1.14: + fldt 16(%esp) + fmulp %st, %st(1) +..B1.15: + fstpt 232(%esp) + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 62(%esp) +..B1.17: + movl 220(%esp), %edx + movl %edx, (%esi) + movl 232(%esp), %edx + movl %edx, 12(%esi) + movl 236(%esp), %edx + movl %edx, 16(%esi) + movl 224(%esp), %ecx + movl 228(%esp), %edi + movl 240(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 244(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.49 +..B1.18: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.19: + fldt 12(%ebp) + addl $-16, %esp + lea 164(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + call __libm_coshl_k80 +..B1.64: + addl $16, %esp +..B1.20: + fldt 36+_CONSTANTS@GOTOFF(%ebx) + movzwl 20(%ebp), %ecx + fadd %st, %st(1) + fxch %st(1) + fstpt (%esp) + andl $32767, %ecx + fldt 148(%esp) + cmpl $16183, %ecx + fld %st(0) + fldt 160(%esp) + movl (%esp), %edx + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsub %st, %st(3) + movl %edx, 28(%esp) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fsub %st, %st(3) + fsubp %st, %st(3) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(3) + faddp %st, %st(2) + jge ..B1.22 +..B1.21: + fstp %st(2) + fldt 12(%ebp) + lea 184(%esp), %eax + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt -12(%eax) + fldt -72(%eax) + movzwl -4(%eax), %ecx + movl %ecx, %edx + andl $32767, %edx + andl $-32768, %ecx + addl $-16639, %edx + orl $-49153, %ecx + fstpt (%eax) + movl %edx, 44(%esp) + movw %cx, -4(%eax) + jmp ..B1.24 +..B1.22: + fldt 12(%ebp) + addl $-16, %esp + lea 188(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + fxch %st(2) + fstpt 16(%esp) + fstpt 48(%esp) + fstpt -124(%edx) + call __libm_sinhl_k80 +..B1.65: + fldt 64(%esp) + fldt 48(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.23: + faddp %st, %st(3) + fxch %st(2) + fstpt (%esp) + lea 184(%esp), %eax + movl (%esp), %edx + movl %edx, 44(%esp) + fxch %st(1) +..B1.24: + fldt 172(%esp) + fld %st(0) + fld %st(3) + fldt (%eax) + fadd %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsubr %st(1), %st + fsubrp %st, %st(1) + fstpt 64(%esp) + fldt 64(%esp) + addl $-16, %esp + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 24(%ebp) + fstpt (%esp) + lea 212(%esp), %edx + movl %edx, 12(%esp) + fstpt -100(%edx) + fstpt 48(%esp) + fstpt 64(%esp) + call __libm_cosl_k80 +..B1.66: + fldt 64(%esp) + fxch %st(1) + fstpt 96(%esp) + fldt 48(%esp) + fldt 112(%esp) + addl $16, %esp +..B1.25: + fldt 196(%esp) + fld %st(0) + fldt 208(%esp) + movzwl 32(%ebp), %edx + fadd %st, %st(1) + fld %st(1) + andl $32767, %edx + cmpl $16183, %edx + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(5) + fmul %st(3), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 80(%esp) + fmul %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%esp) + fldt 12+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(1) + jge ..B1.27 +..B1.26: + fldt 24(%ebp) + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 124(%esp) + fldt 112(%esp) + movzwl 132(%esp), %ecx + movl %ecx, %edx + andl $-32768, %ecx + andl $32767, %edx + orl $-49153, %ecx + addl $-16639, %edx + movw %cx, 132(%esp) + fstpt 136(%esp) + fldt 124(%esp) + movl %edx, 12(%esp) + jmp ..B1.29 +..B1.27: + fldt 24(%ebp) + addl $-16, %esp + lea 140(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + fxch %st(1) + fstpt -28(%edx) + fstpt 16(%esp) + fstpt -92(%edx) + fstpt -76(%edx) + call __libm_sinl_k80 +..B1.67: + fldt 64(%esp) + fldt 48(%esp) + fldt 16(%esp) + fldt 112(%esp) + addl $16, %esp +..B1.28: + fldt 124(%esp) + fmul %st(5), %st + fstpt 124(%esp) + fldt 124(%esp) + fldt 136(%esp) + fmulp %st, %st(6) + fxch %st(5) + fstpt 112(%esp) + fldt 112(%esp) + fstpt 136(%esp) + movl $0, 12(%esp) + fxch %st(2) + fxch %st(3) + fxch %st(4) +..B1.29: + fldt 112(%esp) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(6) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fsubr %st(6), %st + fsubrp %st, %st(6) + fxch %st(1) + fsub %st(5), %st + faddp %st, %st(1) + fstpt (%esp) + fld %st(1) + fldt 64(%esp) + fld %st(0) + fmul %st(3), %st + fxch %st(4) + fmulp %st, %st(3) + fldt 80(%esp) + addl $-32, %esp + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl 76(%esp), %edx + movl %edx, 24(%esp) + fstpt 64(%esp) + fstpt 80(%esp) + call __libm_scalbl_k80 +..B1.68: + fldt 80(%esp) + fldt 64(%esp) + addl $32, %esp +..B1.30: + fldt 16(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(2) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(4) + fstpt 220(%esp) + fldt (%esp) + addl $-32, %esp + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl 60(%esp), %edx + addl 44(%esp), %edx + movl %edx, 24(%esp) + call __libm_scalbl_k80 +..B1.69: + addl $32, %esp +..B1.31: + fstpt 232(%esp) + jmp ..B1.45 +..B1.33: + movl 28(%ebp), %ecx +..B1.34: + testl %ecx, %ecx + jne ..B1.37 +..B1.78: + cmpl $0, 24(%ebp) +..B1.35: + jne ..B1.37 +..B1.36: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call sinhl@PLT +..B1.70: + fldt 24(%ebp) + addl $16, %esp + fstpt 232(%esp) + fstpt 220(%esp) + jmp ..B1.45 +..B1.37: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + movl %ecx, 12(%esp) + cmpl $32767, %ecx + jge ..B1.40 +..B1.38: + fldt 12(%ebp) + fstpt 32(%esp) + fldt 32(%esp) + addl $-16, %esp + fstpt (%esp) + call sinhl@PLT +..B1.72: + fstpt 16(%esp) + addl $16, %esp + fldt 24(%ebp) + fstpt 16(%esp) + fldt 16(%esp) + addl $-16, %esp + fstpt (%esp) + call cosl@PLT +..B1.71: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpt 220(%esp) + cmpl $0, 12(%esp) + jle ..B1.55 +..B1.39: + addl $-16, %esp + fldt 48(%esp) + fstpt (%esp) + call coshl@PLT +..B1.74: + fstpt 16(%esp) + fldt 32(%esp) + fstpt (%esp) + call sinl@PLT +..B1.73: + addl $16, %esp + fldt (%esp) + fmulp %st, %st(1) + fstpt 232(%esp) + jmp ..B1.45 +..B1.40: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + movl %edx, 16(%esp) + call sinl@PLT +..B1.75: + movl 16(%esp), %edx + addl $16, %esp + fstpt 232(%esp) + fldt 232(%esp) + cmpl $32767, %edx + je ..B1.43 +..B1.41: + cmpl $0, 16(%ebp) + jne ..B1.44 +..B1.42: + cmpl $0, 12(%ebp) + jne ..B1.44 +..B1.43: + fstp %st(0) + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call sinhl@PLT +..B1.76: + addl $16, %esp + fstpt 220(%esp) + jmp ..B1.45 +..B1.44: + fldt 12(%ebp) + fmulp %st, %st(1) + fstpt 220(%esp) +..B1.45: + testl %edi, %edi + je ..B1.47 +..B1.46: + fldcw 62(%esp) +..B1.47: + movl 220(%esp), %edx + movl %edx, (%esi) + movl 232(%esp), %edx + movl %edx, 12(%esi) + movl 236(%esp), %edx + movl %edx, 16(%esi) + movl 224(%esp), %ecx + movl 228(%esp), %edi + movl 240(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 244(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.49 +..B1.48: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.49: + call __stack_chk_fail@PLT +..B1.50: + cmpl $0, 28(%ebp) + jne ..B1.11 +..B1.51: + cmpl $0, 24(%ebp) + jne ..B1.11 + jmp ..B1.35 +..B1.52: + cmpl $0, 16(%ebp) + jne ..B1.9 +..B1.53: + cmpl $0, 12(%ebp) + jne ..B1.9 + jmp ..B1.33 +..B1.55: + cmpl $0, 16(%ebp) + jne ..B1.57 +..B1.56: + cmpl $0, 12(%ebp) + je ..B1.39 +..B1.57: + addl $-16, %esp + fldt 48(%esp) + fstpt (%esp) + call coshl@PLT +..B1.77: + addl $16, %esp + fldt 16(%esp) + fmulp %st, %st(1) + fstpt 232(%esp) + jmp ..B1.45 +..B1.59: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type csinhl,@function + .size csinhl,.-csinhl + .data +# -- End csinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,48 + .data + .hidden __libm_sinl_k80 + .hidden __libm_cosl_k80 + .hidden __libm_sinhl_k80 + .hidden __libm_coshl_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csinl.S b/external/sgx_libm/ia32/csinl.S new file mode 100644 index 0000000000..5b9c99558e --- /dev/null +++ b/external/sgx_libm/ia32/csinl.S @@ -0,0 +1,210 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinl.c" + .text +..TXTST0: +# -- Begin csinl + .text + .align 16,0x90 + .globl csinl +csinl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 100(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 40(%esp) + fldt 40(%esp) + fstpt 52(%esp) + fldt 52(%esp) + fstpt 64(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.4: + orl $-64768, %ecx + movw %cx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %edi +..B1.7: + fldt 24(%ebp) + movzwl 32(%ebp), %edx + andl $32767, %edx + fstpt 52(%esp) + cmpl $32767, %edx + fldt 12(%ebp) + fstpt 64(%esp) + jl ..B1.10 +..B1.8: + cmpl $-2147483648, 28(%ebp) + jne ..B1.11 +..B1.9: + cmpl $0, 24(%ebp) + jne ..B1.11 +..B1.10: + movzbl 33(%ebp), %ecx + notl %ecx + movzbl 61(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 61(%esp) +..B1.11: + addl $-32, %esp + lea 108(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl -24(%ecx), %ecx + movl %ecx, (%edx) + movl 88(%esp), %ecx + movl %ecx, 4(%edx) + movl 92(%esp), %ecx + movl %ecx, 8(%edx) + movl 96(%esp), %ecx + movl %ecx, 12(%edx) + movl 100(%esp), %ecx + movl %ecx, 16(%edx) + movl 104(%esp), %ecx + movl %ecx, 20(%edx) + call csinhl@PLT +..B1.23: + addl $28, %esp + fldt 76(%esp) + movzwl 84(%esp), %edx + andl $32767, %edx + fstpt 4(%esp) + fldt 4(%esp) + cmpl $32767, %edx + fstpt 40(%esp) + fldt 88(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + jl ..B1.14 +..B1.12: + cmpl $-2147483648, 8(%esp) + jne ..B1.15 +..B1.13: + cmpl $0, 4(%esp) + jne ..B1.15 +..B1.14: + movzbl 13(%esp), %ecx + notl %ecx + movzbl 49(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 49(%esp) +..B1.15: + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 2(%esp) +..B1.17: + movl 28(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 12(%esi) + movl 44(%esp), %edx + movl %edx, 16(%esi) + movl 32(%esp), %ecx + movl 36(%esp), %edi + movl 48(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 100(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.19 +..B1.18: + movl %esi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.19: + call __stack_chk_fail@PLT +..B1.20: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type csinl,@function + .size csinl,.-csinl + .data +# -- End csinl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csqrt_wmt.S b/external/sgx_libm/ia32/csqrt_wmt.S new file mode 100644 index 0000000000..fff8343914 --- /dev/null +++ b/external/sgx_libm/ia32/csqrt_wmt.S @@ -0,0 +1,763 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csqrt_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin csqrt + .text + .align 16,0x90 + .globl csqrt +csqrt: +# parameter 1: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $184, %esp + movl %esi, 128(%esp) + call static_func + movl %eax, %esi + movl 192(%esp), %edx + movsd 196(%esp), %xmm0 + movsd 204(%esp), %xmm1 + movl %edx, (%esp) + movsd %xmm0, 16(%esp) + movsd %xmm1, 24(%esp) + lea 16(%esp), %ecx + movq (%esi), %xmm2 + movl %edx, (%esp) + movl %ebx, 40(%esp) + movl %ecx, 44(%esp) + movq (%esi), %xmm3 + movq 32(%esi), %xmm7 + pand %xmm0, %xmm2 + pand %xmm1, %xmm3 + pand 16(%esi), %xmm0 + pand 16(%esi), %xmm1 + movq %xmm2, %xmm4 + movq %xmm3, %xmm5 + movl 4(%ecx), %eax + movl 12(%ecx), %ebx + andl $2147483647, %eax + andl $2147483647, %ebx + subl $591396864, %eax + movq %xmm0, 64(%esp) + subl $591396864, %ebx + cmpl $1017118720, %eax + movq %xmm1, 72(%esp) + jae .L_2TAG_PACKET_0.0.2 + cmpl $1017118720, %ebx + jae .L_2TAG_PACKET_0.0.2 + addl $591396864, %eax + addl $591396864, %ebx + movl %eax, %edx + subl %ebx, %edx + cmpl $60817408, %edx + jg .L_2TAG_PACKET_1.0.2 + cmpl $-60817408, %edx + movl (%esp), %edx + jl .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_3.0.2: + subsd %xmm2, %xmm0 + subsd %xmm3, %xmm1 + mulsd %xmm2, %xmm2 + mulsd %xmm3, %xmm3 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm5 + movq %xmm2, %xmm6 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + movq %xmm7, 80(%esp) + movq %xmm2, %xmm7 + addsd %xmm3, %xmm2 + addsd %xmm4, %xmm0 + subsd %xmm2, %xmm7 + addsd %xmm5, %xmm1 + movq %xmm2, 56(%esp) + addsd %xmm7, %xmm2 + addsd %xmm7, %xmm3 + movq 56(%esp), %xmm7 + addsd %xmm4, %xmm0 + subsd %xmm2, %xmm6 + addsd %xmm5, %xmm1 + movq 56(%esp), %xmm5 + movq %xmm0, %xmm2 + movq %xmm0, %xmm4 + addsd %xmm3, %xmm6 + addsd %xmm1, %xmm0 + subsd %xmm0, %xmm2 + movq %xmm0, %xmm3 + addsd %xmm2, %xmm0 + addsd %xmm2, %xmm1 + pshufd $221, %xmm7, %xmm2 + subsd %xmm0, %xmm4 + movq 48(%esi), %xmm0 + addsd %xmm4, %xmm1 + pand %xmm7, %xmm0 + addsd %xmm3, %xmm7 + addsd %xmm6, %xmm1 + subsd %xmm7, %xmm5 + subsd %xmm0, %xmm7 + movq %xmm0, %xmm4 + addsd %xmm5, %xmm3 + movq %xmm0, %xmm5 + addsd %xmm7, %xmm1 + movq %xmm0, %xmm7 + psrlq $29, %xmm0 + addsd %xmm3, %xmm1 + pand 64(%esi), %xmm0 + movq 160(%esi), %xmm3 + pxor 80(%esi), %xmm0 + addsd %xmm1, %xmm4 + paddd 96(%esi), %xmm0 + psubd 112(%esi), %xmm2 + rsqrtss %xmm0, %xmm0 + pand 128(%esi), %xmm2 + psrld $3, %xmm0 + psrld $1, %xmm2 + paddd 144(%esi), %xmm0 + psubd %xmm2, %xmm0 + psllq $32, %xmm0 + movq %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm7 + mulsd %xmm1, %xmm0 + subsd 32(%esi), %xmm7 + addsd %xmm0, %xmm7 + movq 176(%esi), %xmm0 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm0 + addsd 192(%esi), %xmm3 + addsd 208(%esi), %xmm0 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm0 + addsd 224(%esi), %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm0, %xmm3 + movq 64(%esp), %xmm0 + mulsd %xmm2, %xmm3 + mulsd %xmm4, %xmm3 + movq 64(%esp), %xmm4 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + movq %xmm5, %xmm2 + addsd 64(%esp), %xmm5 + movq 48(%esi), %xmm7 + addsd %xmm3, %xmm1 + subsd %xmm5, %xmm4 + movq %xmm5, %xmm3 + addsd %xmm4, %xmm5 + addsd %xmm2, %xmm4 + subsd %xmm5, %xmm0 + addsd %xmm0, %xmm4 + movq 240(%esi), %xmm0 + addsd %xmm1, %xmm4 + movq %xmm3, %xmm1 + movq %xmm3, %xmm2 + addsd %xmm4, %xmm3 + subsd %xmm3, %xmm1 + mulsd %xmm3, %xmm0 + pand %xmm0, %xmm7 + addsd %xmm1, %xmm3 + addsd %xmm4, %xmm1 + movq %xmm7, %xmm4 + subsd %xmm2, %xmm3 + movq %xmm7, %xmm5 + pshufd $221, %xmm0, %xmm2 + subsd %xmm7, %xmm0 + subsd %xmm3, %xmm1 + mulsd 240(%esi), %xmm1 + addsd %xmm0, %xmm1 + movq %xmm7, %xmm0 + psrlq $29, %xmm7 + movq 160(%esi), %xmm3 + pand 64(%esi), %xmm7 + psubd 112(%esi), %xmm2 + pxor 80(%esi), %xmm7 + addsd %xmm1, %xmm4 + paddd 96(%esi), %xmm7 + rsqrtss %xmm7, %xmm7 + psrld $3, %xmm7 + pand 128(%esi), %xmm2 + psrld $1, %xmm2 + paddd 144(%esi), %xmm7 + psubd %xmm2, %xmm7 + psllq $32, %xmm7 + movq %xmm7, %xmm2 + mulsd %xmm7, %xmm7 + mulsd %xmm7, %xmm0 + mulsd %xmm1, %xmm7 + subsd 32(%esi), %xmm0 + addsd %xmm7, %xmm0 + movq 176(%esi), %xmm7 + movq %xmm0, %xmm6 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm7 + addsd 192(%esi), %xmm3 + addsd 208(%esi), %xmm7 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm7 + addsd 224(%esi), %xmm3 + mulsd %xmm6, %xmm3 + movq 72(%esp), %xmm6 + addsd %xmm7, %xmm3 + mulsd 240(%esi), %xmm6 + mulsd %xmm2, %xmm3 + mulsd %xmm3, %xmm4 + pxor %xmm7, %xmm7 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + cmpnlesd (%ecx), %xmm7 + addsd %xmm4, %xmm1 + movq 48(%esi), %xmm4 + pand %xmm6, %xmm4 + subsd %xmm4, %xmm6 + addsd %xmm5, %xmm1 + movq %xmm2, %xmm5 + mulsd %xmm4, %xmm2 + mulsd %xmm3, %xmm4 + movq %xmm1, %xmm0 + pand %xmm7, %xmm0 + mulsd %xmm6, %xmm3 + mulsd %xmm5, %xmm6 + movq 8(%ecx), %xmm5 + addsd %xmm4, %xmm3 + addsd %xmm3, %xmm6 + addsd %xmm6, %xmm2 + movq %xmm7, %xmm6 + pandn %xmm2, %xmm6 + pand %xmm7, %xmm2 + pandn %xmm1, %xmm7 + pand 256(%esi), %xmm5 + por %xmm6, %xmm0 + por %xmm7, %xmm2 + por %xmm5, %xmm0 + mulsd 80(%esp), %xmm2 + mulsd 80(%esp), %xmm0 + movsd %xmm2, (%edx) + movsd %xmm0, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_0.0.2: + addl $591396864, %eax + addl $591396864, %ebx + cmpl $2146435072, %eax + jge .L_2TAG_PACKET_5.0.2 + cmpl $2146435072, %ebx + jge .L_2TAG_PACKET_6.0.2 + movl (%ecx), %edx + orl %eax, %edx + movl 8(%ecx), %edx + je .L_2TAG_PACKET_7.0.2 + orl %ebx, %edx + je .L_2TAG_PACKET_8.0.2 + movl %eax, %edx + subl %ebx, %edx + cmpl $60817408, %edx + jg .L_2TAG_PACKET_1.0.2 + cmpl $-60817408, %edx + jl .L_2TAG_PACKET_2.0.2 + cmpl $1072693248, %eax + jl .L_2TAG_PACKET_9.0.2 + mulsd 272(%esi), %xmm0 + mulsd 272(%esi), %xmm1 + movq 288(%esi), %xmm7 + movq 48(%esi), %xmm2 + movq 48(%esi), %xmm3 + pand %xmm0, %xmm2 + pand %xmm1, %xmm3 + movq %xmm2, %xmm4 + movl (%esp), %edx + movq %xmm3, %xmm5 + movq %xmm0, 64(%esp) + movq %xmm1, 72(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_9.0.2: + mulsd 304(%esi), %xmm0 + mulsd 304(%esi), %xmm1 + movq 320(%esi), %xmm7 + movq 48(%esi), %xmm2 + movq 48(%esi), %xmm3 + pand %xmm0, %xmm2 + pand %xmm1, %xmm3 + movq %xmm2, %xmm4 + movl (%esp), %edx + movq %xmm3, %xmm5 + movq %xmm0, 64(%esp) + movq %xmm1, 72(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: +.L_2TAG_PACKET_7.0.2: + cmpl $2097152, %ebx + movl (%esp), %edx + jl .L_2TAG_PACKET_10.0.2 + mulsd 240(%esi), %xmm1 + sqrtsd %xmm1, %xmm1 + movsd 8(%ecx), %xmm2 + pand 256(%esi), %xmm2 + movsd %xmm1, (%edx) + por %xmm2, %xmm1 + movsd %xmm1, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_10.0.2: + mulsd 336(%esi), %xmm1 + sqrtsd %xmm1, %xmm1 + movsd 8(%ecx), %xmm2 + pand 256(%esi), %xmm2 + mulsd 352(%esi), %xmm1 + movsd %xmm1, (%edx) + por %xmm2, %xmm1 + movsd %xmm1, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_8.0.2: + sqrtsd %xmm0, %xmm0 + movl 4(%ecx), %eax + cmpl $0, %eax + movl (%esp), %edx + jl .L_2TAG_PACKET_11.0.2 + movsd 8(%ecx), %xmm2 + pand 256(%esi), %xmm2 + movsd %xmm2, 8(%edx) + movsd %xmm0, (%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_11.0.2: + pxor %xmm3, %xmm3 + movsd %xmm3, (%edx) + movsd 8(%ecx), %xmm2 + pand 256(%esi), %xmm2 + por %xmm0, %xmm2 + movsd %xmm2, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_1.0.2: + cmpl $57671680, %ebx + movsd %xmm0, %xmm4 + subsd %xmm2, %xmm0 + movq %xmm2, %xmm5 + movq %xmm2, %xmm7 + pshufd $221, %xmm2, %xmm1 + jl .L_2TAG_PACKET_12.0.2 + mulsd 416(%esi), %xmm2 + mulsd 416(%esi), %xmm0 + mulsd 416(%esi), %xmm4 + movsd %xmm2, %xmm5 + movsd %xmm2, %xmm7 + pshufd $221, %xmm2, %xmm1 + shrl $21, %eax + shrl $20, %ebx + psrlq $29, %xmm2 + pand 64(%esi), %xmm2 + pxor 80(%esi), %xmm2 + paddd 96(%esi), %xmm2 + rsqrtss %xmm2, %xmm2 + subl $511, %eax + subl $1023, %ebx + psubd 112(%esi), %xmm1 + psrld $3, %xmm2 + pand 128(%esi), %xmm1 + psrld $1, %xmm1 + paddd 144(%esi), %xmm2 + psubd %xmm1, %xmm2 + subl %eax, %ebx + psllq $32, %xmm2 + movq %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + mulsd %xmm2, %xmm7 + mulsd %xmm0, %xmm2 + subsd 32(%esi), %xmm7 + cmpl $-1020, %ebx + addsd %xmm2, %xmm7 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + movq 160(%esi), %xmm3 + movq 176(%esi), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 192(%esi), %xmm3 + addsd 208(%esi), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 224(%esi), %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm2, %xmm3 + mulsd %xmm1, %xmm3 + mulsd %xmm3, %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm4, %xmm0 + mulsd 448(%esi), %xmm5 + mulsd 448(%esi), %xmm0 + mulsd 432(%esi), %xmm1 + mulsd 432(%esi), %xmm3 + jl .L_2TAG_PACKET_13.0.2 + movsd 72(%esp), %xmm2 + addsd %xmm5, %xmm0 + mulsd 240(%esi), %xmm1 + mulsd 240(%esi), %xmm3 + movq 48(%esi), %xmm4 + pand %xmm2, %xmm4 + subsd %xmm4, %xmm2 + movq %xmm1, %xmm5 + mulsd %xmm4, %xmm1 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + mulsd %xmm5, %xmm2 + addsd %xmm4, %xmm3 + addsd %xmm3, %xmm2 + addsd %xmm2, %xmm1 +.L_2TAG_PACKET_14.0.2: + movsd 8(%ecx), %xmm3 + pand 256(%esi), %xmm3 + movl 4(%ecx), %eax + cmpl $0, %eax + movl (%esp), %edx + jl .L_2TAG_PACKET_15.0.2 + por %xmm3, %xmm1 + movsd %xmm0, (%edx) + movsd %xmm1, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_15.0.2: + por %xmm3, %xmm0 + movsd %xmm1, (%edx) + movsd %xmm0, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_12.0.2: + psrlq $29, %xmm2 + pand 64(%esi), %xmm2 + pxor 80(%esi), %xmm2 + paddd 96(%esi), %xmm2 + rsqrtss %xmm2, %xmm2 + psubd 112(%esi), %xmm1 + psrld $3, %xmm2 + pand 128(%esi), %xmm1 + psrld $1, %xmm1 + paddd 144(%esi), %xmm2 + psubd %xmm1, %xmm2 + psllq $32, %xmm2 + movq %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + mulsd %xmm2, %xmm7 + mulsd %xmm0, %xmm2 + subsd 32(%esi), %xmm7 + addsd %xmm2, %xmm7 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + movq 160(%esi), %xmm3 + movq 176(%esi), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 192(%esi), %xmm3 + addsd 208(%esi), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 224(%esi), %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm2, %xmm3 + mulsd %xmm1, %xmm3 + mulsd %xmm3, %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm4, %xmm0 +.L_2TAG_PACKET_13.0.2: + addsd %xmm5, %xmm0 + movq 72(%esp), %xmm2 + mulsd 368(%esi), %xmm2 + mulsd 336(%esi), %xmm2 + movq 48(%esi), %xmm4 + pand %xmm2, %xmm4 + subsd %xmm4, %xmm2 + movq %xmm1, %xmm5 + mulsd %xmm4, %xmm1 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + mulsd %xmm5, %xmm2 + addsd %xmm4, %xmm3 + addsd %xmm3, %xmm2 + movq %xmm1, %xmm3 + addsd %xmm2, %xmm1 + pextrw $3, %xmm1, %eax + mulsd 384(%esi), %xmm1 + mulsd 400(%esi), %xmm1 + cmpl $19216, %eax + jge .L_2TAG_PACKET_14.0.2 + movq 384(%esi), %xmm5 + mulsd %xmm5, %xmm5 + cmpl $19056, %eax + jle .L_2TAG_PACKET_14.0.2 + movq 48(%esi), %xmm1 + pand %xmm3, %xmm1 + subsd %xmm1, %xmm3 + addsd %xmm3, %xmm2 + mulsd 384(%esi), %xmm1 + mulsd 384(%esi), %xmm2 + mulsd 400(%esi), %xmm1 + mulsd 400(%esi), %xmm2 + addsd %xmm2, %xmm1 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_6.0.2: +.L_2TAG_PACKET_16.0.2: + movq 32(%esi), %xmm0 + addsd 8(%ecx), %xmm0 + movsd %xmm0, 8(%edx) + mulsd %xmm0, %xmm0 + movsd %xmm0, (%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_5.0.2: + movsd (%ecx), %xmm1 + mulsd %xmm1, %xmm1 + cmpl $2146435072, %ebx + jl .L_2TAG_PACKET_17.0.2 + movl 8(%ecx), %ebx + jg .L_2TAG_PACKET_18.0.2 + andl %ebx, %ebx + jne .L_2TAG_PACKET_18.0.2 + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_18.0.2: + movq 32(%esi), %xmm0 + addsd 8(%ecx), %xmm0 + cmpl $2146435072, %eax + movl (%ecx), %ebx + jg .L_2TAG_PACKET_19.0.2 + andl %ebx, %ebx + movl 4(%ecx), %ebx + jne .L_2TAG_PACKET_19.0.2 + cmpl $2146435072, %ebx + je .L_2TAG_PACKET_20.0.2 + mulsd %xmm1, %xmm1 + movsd %xmm0, (%edx) + movsd %xmm1, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_19.0.2: +.L_2TAG_PACKET_20.0.2: + movsd %xmm1, (%edx) + movsd %xmm0, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_17.0.2: + cmpl $2146435072, %eax + movl (%ecx), %eax + jg .L_2TAG_PACKET_21.0.2 + andl %eax, %eax + jne .L_2TAG_PACKET_21.0.2 + pxor %xmm2, %xmm2 + movl 4(%ecx), %eax + movq 8(%ecx), %xmm3 + testl $-2147483648, %eax + pand 256(%esi), %xmm3 + jne .L_2TAG_PACKET_22.0.2 + por %xmm3, %xmm2 + movsd %xmm1, (%edx) + movsd %xmm2, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_22.0.2: + por %xmm3, %xmm1 + movsd %xmm2, (%edx) + movsd %xmm1, 8(%edx) + movl 40(%esp), %ebx + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_21.0.2: + movsd %xmm1, (%edx) + movsd %xmm1, 8(%edx) + movl 40(%esp), %ebx +.L_2TAG_PACKET_4.0.2: + movl 128(%esp), %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B2.3: + .align 16,0x90 + .type csqrt,@function + .size csqrt,.-csqrt + .data +# -- End csqrt + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4160749568 + .long 2147483647 + .long 4160749568 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .long 16777215 + .long 16777215 + .long 16777215 + .long 16777215 + .long 8388608 + .long 8388608 + .long 8388608 + .long 8388608 + .long 1065353216 + .long 1065353216 + .long 1065353216 + .long 1065353216 + .long 1048576 + .long 1048576 + .long 1048576 + .long 1048576 + .long 4292870144 + .long 4292870144 + .long 4292870144 + .long 4292870144 + .long 1475346432 + .long 1475346432 + .long 1475346432 + .long 1475346432 + .long 0 + .long 3218046976 + .long 0 + .long 3218046976 + .long 0 + .long 1070694400 + .long 0 + .long 1070694400 + .long 0 + .long 3218341888 + .long 0 + .long 3218341888 + .long 0 + .long 1071120384 + .long 0 + .long 1071120384 + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 533725184 + .long 0 + .long 533725184 + .long 0 + .long 1342177280 + .long 0 + .long 1342177280 + .long 0 + .long 1722810368 + .long 0 + .long 1722810368 + .long 0 + .long 747634688 + .long 0 + .long 747634688 + .long 0 + .long 1281359872 + .long 0 + .long 1281359872 + .long 0 + .long 967835648 + .long 0 + .long 967835648 + .long 0 + .long 2121269248 + .long 0 + .long 2121269248 + .long 0 + .long 24117248 + .long 0 + .long 24117248 + .long 0 + .long 862978048 + .long 0 + .long 862978048 + .long 0 + .long 1062207488 + .long 0 + .long 1062207488 + .long 0 + .long 1067450368 + .long 0 + .long 1067450368 + .long 0 + .long 1077936128 + .long 0 + .long 1077936128 + .type static_const_table,@object + .size static_const_table,464 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csqrtf_wmt.S b/external/sgx_libm/ia32/csqrtf_wmt.S new file mode 100644 index 0000000000..e551616238 --- /dev/null +++ b/external/sgx_libm/ia32/csqrtf_wmt.S @@ -0,0 +1,351 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csqrtf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin csqrtf + .text + .align 16,0x90 + .globl csqrtf +csqrtf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $216, %esp + movl %ebx, 160(%esp) + call static_func + movl %eax, %ebx + movss 224(%esp), %xmm0 + movss 228(%esp), %xmm1 + movss %xmm0, (%esp) + movss %xmm1, 4(%esp) + movl (%esp), %eax + movl 4(%esp), %ecx + unpcklps %xmm1, %xmm0 + movl %ecx, %edx + andl $2139095040, %eax + andl $2139095040, %ecx + subl $8388608, %eax + subl $8388608, %ecx + andl $2139095040, %eax + andl $2139095040, %ecx + subl $2130706432, %eax + subl $2130706432, %ecx + testl %ecx, %eax + jns .L_2TAG_PACKET_0.0.2 + cvtps2pd %xmm0, %xmm0 + pxor %xmm4, %xmm4 + movl $16, %eax + movapd %xmm0, %xmm1 + unpckhpd %xmm1, %xmm1 + movapd %xmm0, %xmm7 + mulsd %xmm0, %xmm0 + movapd %xmm7, %xmm6 + mulsd %xmm1, %xmm1 + pinsrw $3, %eax, %xmm4 + addsd %xmm1, %xmm0 + andpd (%ebx), %xmm7 + sqrtsd %xmm0, %xmm0 + addsd %xmm7, %xmm0 + psubd %xmm4, %xmm0 + movsd %xmm0, %xmm7 + movdqa %xmm0, %xmm1 + pand 16(%ebx), %xmm0 + movdqa %xmm1, %xmm2 + paddd 32(%ebx), %xmm0 + psrld $1, %xmm1 + psrlq $29, %xmm0 + pand 48(%ebx), %xmm1 + rsqrtss %xmm0, %xmm0 + psubd 64(%ebx), %xmm1 + psllq $29, %xmm0 + movapd 80(%ebx), %xmm3 + psubd %xmm1, %xmm0 + movapd 96(%ebx), %xmm1 + mulsd %xmm0, %xmm2 + movapd 48(%ebx), %xmm4 + mulsd %xmm0, %xmm2 + subsd %xmm4, %xmm2 + mulsd %xmm2, %xmm3 + addsd %xmm1, %xmm3 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm3 + addsd %xmm3, %xmm0 + mulpd 112(%ebx), %xmm7 + unpcklpd %xmm0, %xmm0 +.L_2TAG_PACKET_1.0.2: + pextrw $3, %xmm6, %eax + mulpd %xmm7, %xmm0 + andl $-2147483648, %edx + cvtpd2ps %xmm0, %xmm1 + testl $32768, %eax + pshufd $17, %xmm1, %xmm2 + je .L_2TAG_PACKET_2.0.2 + movd %xmm1, %ecx + movd %xmm2, %eax + orl %ecx, %edx + testl $2139095040, %eax + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + movd %xmm2, %ecx + movd %xmm1, %eax + orl %ecx, %edx + testl $2139095040, %ecx +.L_2TAG_PACKET_3.0.2: + je .L_2TAG_PACKET_4.0.2 + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_4.0.2: + testl $2147483647, 4(%esp) + jne .L_2TAG_PACKET_6.0.2 + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_6.0.2: + movhpd %xmm0, 112(%esp) + testl $2139095040, %eax + fldl 112(%esp) + fstps 112(%esp) + je .L_2TAG_PACKET_7.0.2 + andl $-2147483648, %edx + orl 112(%esp), %edx + jmp .L_2TAG_PACKET_8.0.2 +.L_2TAG_PACKET_7.0.2: + movl 112(%esp), %eax +.L_2TAG_PACKET_8.0.2: + movl $8388608, 116(%esp) + flds 112(%esp) + fmul %st(0), %st + fstps 112(%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_0.0.2: + movdqa %xmm0, %xmm2 + movdqa 128(%ebx), %xmm4 + pshufd $80, %xmm0, %xmm0 + pxor %xmm5, %xmm5 + movdqa %xmm2, %xmm3 + pand 144(%ebx), %xmm0 + pshufd $115, %xmm2, %xmm2 + pcmpeqd %xmm4, %xmm0 + movdqa %xmm2, %xmm6 + movmskps %xmm0, %eax + pand %xmm2, %xmm4 + testl %eax, %eax + jne .L_2TAG_PACKET_9.0.2 + pxor %xmm0, %xmm0 +.L_2TAG_PACKET_10.0.2: + pand (%ebx), %xmm2 + pcmpeqd %xmm5, %xmm4 + movdqa %xmm4, %xmm3 + pand 160(%ebx), %xmm4 + psrlq $3, %xmm2 + pand 176(%ebx), %xmm3 + por %xmm4, %xmm2 + paddd 192(%ebx), %xmm3 + subpd %xmm4, %xmm2 + paddd %xmm3, %xmm2 + pandn %xmm2, %xmm0 + pxor %xmm4, %xmm4 + movl $16, %eax + movapd %xmm0, %xmm1 + unpckhpd %xmm1, %xmm1 + movapd %xmm0, %xmm7 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + pinsrw $3, %eax, %xmm4 + addsd %xmm1, %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm7, %xmm0 + psubd %xmm4, %xmm0 + movsd %xmm0, %xmm7 + sqrtsd %xmm0, %xmm1 + movapd 48(%ebx), %xmm0 + divsd %xmm1, %xmm0 + mulpd 112(%ebx), %xmm7 + unpcklpd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_9.0.2: + cmpl $5, %eax + je .L_2TAG_PACKET_11.0.2 + testl $10, %eax + jne .L_2TAG_PACKET_12.0.2 + pshufd $160, %xmm0, %xmm0 + jmp .L_2TAG_PACKET_10.0.2 +.L_2TAG_PACKET_11.0.2: + xorl %eax, %eax + andl $-2147483648, %edx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_12.0.2: + movl %edx, %ecx + andl $2147483647, %ecx + movd %xmm3, %eax + cmpl $2139095040, %ecx + je .L_2TAG_PACKET_13.0.2 + ja .L_2TAG_PACKET_14.0.2 + andl $-2147483648, %edx + cmpl $-8388608, %eax + je .L_2TAG_PACKET_15.0.2 + cmpl $2139095040, %eax + jne .L_2TAG_PACKET_16.0.2 + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_15.0.2: + xorl %eax, %eax + orl $2139095040, %edx + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_14.0.2: + cmpl $2139095040, %eax + je .L_2TAG_PACKET_17.0.2 + cmpl $-8388608, %eax + je .L_2TAG_PACKET_18.0.2 +.L_2TAG_PACKET_16.0.2: + mulss %xmm3, %xmm1 + flds (%esp) + flds 4(%esp) + movd %xmm1, %eax + movl %eax, %edx + jmp .L_2TAG_PACKET_19.0.2 +.L_2TAG_PACKET_17.0.2: + flds 4(%esp) + flds 4(%esp) + orl $4194304, %edx + jmp .L_2TAG_PACKET_19.0.2 +.L_2TAG_PACKET_18.0.2: + flds 4(%esp) + flds 4(%esp) + movl %edx, %eax + movl $2139095040, %edx + orl $4194304, %eax + jmp .L_2TAG_PACKET_19.0.2 +.L_2TAG_PACKET_13.0.2: + flds (%esp) + fld1 + movl $2139095040, %eax +.L_2TAG_PACKET_19.0.2: + fmulp + fstp %st(0) +.L_2TAG_PACKET_5.0.2: + movl 160(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type csqrtf,@function + .size csqrtf,.-csqrtf + .data +# -- End csqrtf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2097151 + .long 4294967295 + .long 2097151 + .long 0 + .long 132120576 + .long 0 + .long 132120576 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 1475346432 + .long 0 + .long 1475346432 + .long 2148429837 + .long 1071120401 + .long 2148429837 + .long 1071120401 + .long 195330 + .long 3219128325 + .long 195330 + .long 3219128325 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 0 + .long 2139095040 + .long 0 + .long 2139095040 + .long 2147483647 + .long 2139095040 + .long 2147483647 + .long 2139095040 + .long 0 + .long 133169152 + .long 0 + .long 133169152 + .long 0 + .long 4162846720 + .long 0 + .long 4162846720 + .long 0 + .long 939524096 + .long 0 + .long 939524096 + .type static_const_table,@object + .size static_const_table,208 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/csqrtl.S b/external/sgx_libm/ia32/csqrtl.S new file mode 100644 index 0000000000..becf7f5166 --- /dev/null +++ b/external/sgx_libm/ia32/csqrtl.S @@ -0,0 +1,739 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csqrtl.c" + .text +..TXTST0: +# -- Begin csqrtl + .text + .align 16,0x90 + .globl csqrtl +csqrtl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl 8(%ebp), %eax + movl %eax, 44(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 196(%esp) + fstpt 172(%esp) + fldt 172(%esp) + fstpt 184(%esp) +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 62(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.69 +..B1.4: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.5: + fldcw 60(%esp) +..B1.6: + movl $1, %esi +..B1.7: + movzwl 20(%ebp), %ecx + movl %ecx, %edi + andl $32767, %edi + cmpl $32767, %edi + jge ..B1.30 +..B1.8: + cmpl $0, 16(%ebp) + jne ..B1.10 +..B1.9: + cmpl $0, 12(%ebp) + je ..B1.30 +..B1.10: + movzwl 32(%ebp), %eax + movl %eax, %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.48 +..B1.11: + cmpl $0, 28(%ebp) + jne ..B1.13 +..B1.12: + cmpl $0, 24(%ebp) + je ..B1.32 +..B1.13: + fldt 12(%ebp) + testl %edi, %edi + jle ..B1.56 +..B1.14: + andl $-32768, %ecx + addl $-16383, %edi + fstpt 148(%esp) + fldt 148(%esp) + orl $-49153, %ecx + movw %cx, 156(%esp) +..B1.15: + fldt 24(%ebp) + testl %edx, %edx + movb $63, 157(%esp) + jle ..B1.55 +..B1.16: + andl $-32768, %eax + addl $-16383, %edx + fstpt 76(%esp) + fldt 76(%esp) + orl $-49153, %eax + movw %ax, 84(%esp) +..B1.17: + fldt 72+_CONSTANTS@GOTOFF(%ebx) + movb $63, 85(%esp) + fstpt 88(%esp) + fldt 88(%esp) + addl $-32, %esp + lea 132(%esp), %eax + movl %eax, (%esp) + fxch %st(2) + fstpt 4(%esp) + fstpt 16(%esp) + fstpt 32(%esp) + movl %edx, -72(%eax) + call __libm_hypot2l_k80 +..B1.72: + fldt 32(%esp) + movl 60(%esp), %edx + addl $32, %esp +..B1.18: + fldt 132+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt 100(%esp) + fld %st(0) + fsqrt + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fstpt 32(%esp) + fldt 32(%esp) + fmul %st(1), %st + fld %st(0) + movl (%esp), %eax + fsubr %st(2), %st + sarl $1, %eax + faddp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fldt 112(%esp) + faddp %st, %st(2) + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(1) + fdivr %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 124(%esp) + fldt 124(%esp) + fsubr %st, %st(1) + movzwl 132(%esp), %ecx + fxch %st(1) + faddp %st, %st(2) + andl $32767, %ecx + movl %ecx, 12(%esp) + fxch %st(1) + fstpt 136(%esp) + fldt 136(%esp) + lea -16464(%ecx,%eax), %ecx + cmpl %ecx, %edi + jle ..B1.22 +..B1.19: + movl 12(%esp), %ecx + lea -16302(%ecx,%eax), %ecx + cmpl %ecx, %edi + jge ..B1.21 +..B1.20: + fstp %st(2) + subl %eax, %edi + fld %st(0) + addl $16383, %edi + fld %st(1) + movzwl 156(%esp), %ecx + andl $32767, %edi + andl $-32768, %ecx + orl %edi, %ecx + movl %eax, %edi + movw %cx, 156(%esp) + fldt 148(%esp) + fadd %st, %st(2) + fld %st(2) + fxch %st(2) + fsubr %st(3), %st + fsubr %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fsubp %st, %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + jmp ..B1.23 +..B1.21: + fstp %st(0) + fstp %st(0) + fldt 148(%esp) + jmp ..B1.23 +..B1.22: + fstp %st(2) + movl %eax, %edi +..B1.23: + fldt 32(%esp) + lea 1(%edi), %ecx + andl $1, %ecx + subl %ecx, %edi + decl %edi + sarl $1, %edi + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %eax + fldt 48+_CONSTANTS@GOTOFF(%eax,%ebx) + fmul %st, %st(2) + fld %st(2) + fsqrt + fmul %st, %st(2) + fld %st(2) + fsubr %st(1), %st + faddp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fxch %st(2) + fmulp %st, %st(5) + fld %st(2) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 16(%esp) + fmulp %st, %st(2) + fxch %st(1) + fdiv %st(2), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%esp) + fldt 48(%esp) + addl $-32, %esp + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + fldt 12(%esp) + movl %edi, 24(%esp) + fstpt 96(%esp) + movl %edx, 60(%esp) + call __libm_scalbl_k80 +..B1.73: + fldt 96(%esp) + movl 60(%esp), %edx + fxch %st(1) + fstpt 32(%esp) + addl $32, %esp +..B1.24: + fldt 76(%esp) + subl %edi, %edx + fldt 48(%esp) + fld %st(0) + fdivr %st(2), %st + fmul %st, %st(3) + fld %st(1) + fldt 32(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + fsubr %st(4), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(4), %st + fxch %st(2) + fmul %st(5), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fld %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + fsubrp %st, %st(3) + fldt 88(%esp) + faddp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fldt 48(%esp) + fdivrp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 16(%esp) + fmul %st, %st(2) + fmulp %st, %st(1) + addl $-32, %esp + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %edx, 24(%esp) + call __libm_scalbl_k80 +..B1.74: + addl $32, %esp +..B1.25: + movzbl 21(%ebp), %eax + testl $128, %eax + jne ..B1.27 +..B1.26: + fldt (%esp) + lea 184(%esp), %edi + fstpt -12(%edi) + jmp ..B1.28 +..B1.27: + fldt (%esp) + lea 184(%esp), %edi + fxch %st(1) + fstpt -12(%edi) +..B1.28: + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _CONSTANTS@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt (%edi) + jmp ..B1.51 +..B1.30: + movzwl 32(%ebp), %edx + andl $32767, %edx +..B1.31: + cmpl $32767, %edx + jge ..B1.48 +..B1.32: + movl 16(%ebp), %eax + testl %eax, %eax + jne ..B1.40 +..B1.33: + cmpl $0, 12(%ebp) + jne ..B1.40 +..B1.34: + cmpl $0, 28(%ebp) + jne ..B1.36 +..B1.35: + cmpl $0, 24(%ebp) + je ..B1.40 +..B1.36: + fldt 24(%ebp) + movzbl 33(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + cmpl $2, %edx + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %eax + fldt _CONSTANTS@GOTOFF(%eax,%ebx) + jl ..B1.38 +..B1.37: + fldt 24+_CONSTANTS@GOTOFF(%ebx,%eax) + fmulp %st, %st(2) + fxch %st(1) + fsqrt + jmp ..B1.39 +..B1.38: + fldt 108+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + fldt 156+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.39: + fstpt 172(%esp) + fldt 172(%esp) + fmulp %st, %st(1) + fstpt 184(%esp) + jmp ..B1.51 +..B1.40: + cmpl $32767, %edi + jl ..B1.43 +..B1.41: + cmpl $-2147483648, %eax + jne ..B1.47 +..B1.42: + cmpl $0, 12(%ebp) + jne ..B1.47 +..B1.43: + fldt 12(%ebp) + fldt 72+_CONSTANTS@GOTOFF(%ebx) + movzbl 21(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + testl %ecx, %ecx + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 148(%esp) + fldt 148(%esp) + fsqrt + jne ..B1.45 +..B1.44: + fstpt 172(%esp) + lea 184(%esp), %edi + jmp ..B1.46 +..B1.45: + fxch %st(1) + fstpt 172(%esp) + lea 184(%esp), %edi +..B1.46: + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _CONSTANTS@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt (%edi) + jmp ..B1.51 +..B1.47: + fldt 12(%ebp) + fmul %st(0), %st + fstpt 172(%esp) + fldt 172(%esp) + fstpt 184(%esp) + jmp ..B1.51 +..B1.48: + je ..B1.63 +..B1.49: + cmpl $32767, %edi + je ..B1.58 +..B1.50: + fldt 12(%ebp) + fld %st(0) + fldt 24(%ebp) + fmul %st, %st(1) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt 172(%esp) + fmulp %st, %st(1) + fstpt 184(%esp) +..B1.51: + testl %esi, %esi + je ..B1.53 +..B1.52: + fldcw 62(%esp) +..B1.53: + movl 44(%esp), %eax + movl 172(%esp), %edx + movl 176(%esp), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 180(%esp), %esi + movl 184(%esp), %edi + movl 188(%esp), %edx + movl 192(%esp), %ecx + movl %esi, 8(%eax) + movl %edi, 12(%eax) + movl %edx, 16(%eax) + movl %ecx, 20(%eax) + movl 196(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.57 +..B1.54: + movl 44(%esp), %eax + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.55: + fldt 120+_CONSTANTS@GOTOFF(%ebx) + fmul %st(1), %st + fstpt 76(%esp) + movzwl 84(%esp), %eax + movl %eax, %edx + andl $-32768, %eax + andl $32767, %edx + orl $-49153, %eax + addl $-16639, %edx + movw %ax, 84(%esp) + jmp ..B1.17 +..B1.56: + fldt 120+_CONSTANTS@GOTOFF(%ebx) + fmul %st(1), %st + fstpt 148(%esp) + movzwl 156(%esp), %ecx + movl %ecx, %edi + andl $-32768, %ecx + andl $32767, %edi + orl $-49153, %ecx + addl $-16639, %edi + movw %cx, 156(%esp) + jmp ..B1.15 +..B1.57: + call __stack_chk_fail@PLT +..B1.58: + cmpl $-2147483648, 16(%ebp) + jne ..B1.50 +..B1.59: + cmpl $0, 12(%ebp) + jne ..B1.50 +..B1.60: + fldt 12(%ebp) + movzbl 21(%ebp), %eax + testl $128, %eax + fmul %st(0), %st + fldt 24(%ebp) + fmul %st(0), %st + jne ..B1.62 +..B1.61: + fxch %st(1) + fstpt 172(%esp) + fstpt 184(%esp) + jmp ..B1.51 +..B1.62: + fstpt 172(%esp) + fstpt 184(%esp) + jmp ..B1.51 +..B1.63: + cmpl $-2147483648, 28(%ebp) + jne ..B1.49 +..B1.64: + cmpl $0, 24(%ebp) + jne ..B1.49 +..B1.65: + fldt 24(%ebp) + movzbl 33(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fmul %st(0), %st + cmpl $32767, %edi + fstpt 172(%esp) + fldt 172(%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _CONSTANTS@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 184(%esp) + jne ..B1.51 +..B1.66: + cmpl $-2147483648, 16(%ebp) + jne ..B1.68 +..B1.67: + cmpl $0, 12(%ebp) + je ..B1.51 +..B1.68: + fldt 12(%ebp) + fldt _CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 12(%ebp) + jmp ..B1.51 +..B1.69: + xorl %esi, %esi + jmp ..B1.7 + .align 16,0x90 + .type csqrtl,@function + .size csqrtl,.-csqrtl + .data +# -- End csqrtl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 32768 + .word 16415 + .word 0 + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16127 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,168 + .data + .hidden __libm_hypot2l_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ctan.S b/external/sgx_libm/ia32/ctan.S new file mode 100644 index 0000000000..15a3451d26 --- /dev/null +++ b/external/sgx_libm/ia32/ctan.S @@ -0,0 +1,237 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctan.c" + .text +..TXTST0: +# -- Begin ctan + .text + .align 16,0x90 + .globl ctan +ctan: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $72, %esp + fldz + fldl 20(%ebp) + fldl 12(%ebp) + movzwl 26(%ebp), %ecx + andl $32752, %ecx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 64(%esp) + cmpl $32752, %ecx + fstpl 56(%esp) + fxch %st(1) + fstl 16(%esp) + fstl 24(%esp) + fstl 32(%esp) + fstpl 40(%esp) + fstpl 48(%esp) + jl ..B1.4 +..B1.2: + testl $1048575, 24(%ebp) + jne ..B1.5 +..B1.3: + cmpl $0, 20(%ebp) + jne ..B1.5 +..B1.4: + movzbl 27(%ebp), %edx + notl %edx + movzbl 55(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 55(%esp) +..B1.5: + addl $-32, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea 32(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl 48(%ecx), %ecx + movl %ecx, (%edx) + movl 84(%esp), %ecx + movl %ecx, 4(%edx) + movl 88(%esp), %ecx + movl %ecx, 8(%edx) + movl 92(%esp), %ecx + movl %ecx, 12(%edx) + call ctanh@PLT +..B1.14: + addl $28, %esp + fldl (%esp) + movzwl 6(%esp), %edx + andl $32752, %edx + fstl 16(%esp) + cmpl $32752, %edx + fstpl 40(%esp) + fldl 8(%esp) + fstl 24(%esp) + fstpl 32(%esp) + jl ..B1.8 +..B1.6: + testl $1048575, 20(%esp) + jne ..B1.9 +..B1.7: + cmpl $0, 16(%esp) + jne ..B1.9 +..B1.8: + movzbl 23(%esp), %edx + notl %edx + movzbl 47(%esp), %ecx + andl $128, %edx + andl $127, %ecx + orl %edx, %ecx + movb %cl, 47(%esp) +..B1.9: + movl 32(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 8(%esi) + movl 36(%esp), %ecx + movl 44(%esp), %edx + movl %ecx, 4(%esi) + movl %edx, 12(%esi) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.11 +..B1.10: + movl %esi, %eax + addl $72, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.11: + call __stack_chk_fail@PLT + .align 16,0x90 + .type ctan,@function + .size ctan,.-ctan + .data +# -- End ctan + .text +# -- Begin ctanf + .text + .align 16,0x90 + .globl ctanf +ctanf: +# parameter 1: 48 + %esp +..B2.1: +..L3: + + pushl %ebx + subl $40, %esp + xorl %eax, %eax + movl %eax, 16(%esp) + movl %eax, 20(%esp) + movl %eax, 24(%esp) + movl %eax, 28(%esp) + movzwl 54(%esp), %eax + andl $32640, %eax + movl 52(%esp), %edx + cmpl $32640, %eax + movl 48(%esp), %ecx + movl %edx, 32(%esp) + movl %ecx, 36(%esp) + jl ..B2.3 +..B2.2: + testl $8388607, 52(%esp) + jne ..B2.4 +..B2.3: + movzbl 55(%esp), %eax + notl %eax + movzbl 35(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 35(%esp) +..B2.4: + addl $8, %esp + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + pushl 28(%esp) + pushl 28(%esp) + call ctanhf@PLT +..B2.10: + movl %eax, 16(%esp) + movl %eax, 28(%esp) + shrl $16, %eax + andl $32640, %eax + cmpl $32640, %eax + movl %edx, 20(%esp) + movl %edx, 24(%esp) + jl ..B2.6 +..B2.5: + testl $8388607, 16(%esp) + jne ..B2.7 +..B2.6: + movzbl 19(%esp), %eax + notl %eax + movzbl 31(%esp), %edx + andl $128, %eax + andl $127, %edx + orl %eax, %edx + movb %dl, 31(%esp) +..B2.7: + movl 24(%esp), %eax + movl 28(%esp), %edx + addl $40, %esp + popl %ebx + ret + .align 16,0x90 + .type ctanf,@function + .size ctanf,.-ctanf + .data +# -- End ctanf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ctanh.S b/external/sgx_libm/ia32/ctanh.S new file mode 100644 index 0000000000..6f34afcfcb --- /dev/null +++ b/external/sgx_libm/ia32/ctanh.S @@ -0,0 +1,565 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanh.c" + .text +..TXTST0: +# -- Begin ctanh + .text + .align 16,0x90 + .globl ctanh +ctanh: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + fldz + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + movl %edx, 80(%esp) + fstl 64(%esp) + fstpl 72(%esp) +..B1.2: + fnstcw 50(%esp) +..B1.3: + movzwl 18(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %edx + jge ..B1.31 +..B1.4: + testl %edx, %edx + jle ..B1.54 +..B1.5: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + jge ..B1.32 +..B1.6: + cmpl $1032, %edx + jl ..B1.23 +..B1.7: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + movzbl 19(%ebp), %edx + andl $128, %edx + shrl $7, %edx + testl %ecx, %ecx + fldl ones@GOTOFF(%ebx,%edx,8) + fsub %st(1), %st + fstpl 64(%esp) + jne ..B1.15 +..B1.8: + testl $1048575, 24(%ebp) + jne ..B1.13 +..B1.9: + cmpl $0, 20(%ebp) + jne ..B1.13 +..B1.10: + fstp %st(0) + movzbl 27(%ebp), %edx + testl $128, %edx + jne ..B1.12 +..B1.11: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.12: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.13: + fldl 20(%ebp) + jmp ..B1.16 +..B1.15: + fldl 20(%ebp) + jne ..B1.19 +..B1.16: + movzbl 27(%ebp), %edx + testl $128, %edx + fadd %st(0), %st + fstpl 56(%esp) + jne ..B1.18 +..B1.17: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.22 +..B1.18: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.22 +..B1.19: + addl $-16, %esp + fstl (%esp) + fstpl 24(%esp) + fstpl 40(%esp) + call sin@PLT +..B1.104: + fldl 40(%esp) + fldl 24(%esp) + addl $16, %esp + fxch %st(2) + fstpl (%esp) + addl $-16, %esp + fxch %st(1) + fstpl (%esp) + fstpl 40(%esp) + call cos@PLT +..B1.103: + fldl 40(%esp) + addl $16, %esp + fldl (%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpl 16(%esp) + movzbl 23(%esp), %edx + testl $128, %edx + jne ..B1.21 +..B1.20: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.22 +..B1.21: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) +..B1.22: + fmul %st(0), %st + fstpl 56(%esp) + jmp ..B1.44 +..B1.23: + movzwl 50(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.53 +..B1.24: + orl $-64768, %ecx + movw %cx, 48(%esp) +..B1.25: + fldcw 48(%esp) +..B1.26: + movl $1, %edi +..B1.27: + fldl 12(%ebp) + addl $-32, %esp + lea 32(%esp), %edx + lea 44(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + call sinhcoshl@PLT +..B1.28: + fldl 20(%ebp) + lea 56(%esp), %edx + lea 68(%esp), %ecx + fstpt (%esp) + movl %edx, 12(%esp) + movl %ecx, 16(%esp) + call sincosl@PLT +..B1.106: + addl $32, %esp +..B1.29: + fldt (%esp) + testl %edi, %edi + fld %st(0) + fmul %st(1), %st + fldt 36(%esp) + fld %st(0) + fmul %st(1), %st + faddp %st, %st(2) + fldt 12(%esp) + fmulp %st, %st(3) + fxch %st(1) + fdivr %st, %st(2) + fxch %st(2) + fstpl 64(%esp) + fldt 24(%esp) + fmulp %st, %st(1) + fdivp %st, %st(1) + fstpl 72(%esp) + je ..B1.44 +..B1.30: + fldcw 50(%esp) + jmp ..B1.44 +..B1.31: + movzwl 26(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx +..B1.32: + cmpl $2047, %edx + je ..B1.62 +..B1.33: + cmpl $2047, %ecx + je ..B1.58 +..B1.34: + testl %edx, %edx + jne ..B1.43 +..B1.35: + testl $1048575, 16(%ebp) + jne ..B1.43 +..B1.36: + cmpl $0, 12(%ebp) + jne ..B1.43 +..B1.37: + testl %ecx, %ecx + jne ..B1.41 +..B1.38: + testl $1048575, 24(%ebp) + jne ..B1.41 +..B1.39: + cmpl $0, 20(%ebp) + jne ..B1.41 +..B1.40: + fldl 12(%ebp) + fstpl 64(%esp) + fldl 20(%ebp) + fstpl 72(%esp) + jmp ..B1.44 +..B1.41: + cmpl $2047, %ecx + jge ..B1.44 +..B1.42: + fldl 12(%ebp) + fstpl 64(%esp) + addl $-16, %esp + fldl 20(%ebp) + fstpl (%esp) + call tan@PLT +..B1.107: + addl $16, %esp + fstpl 72(%esp) + jmp ..B1.44 +..B1.43: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call tanh@PLT +..B1.108: + fldl 20(%ebp) + addl $16, %esp + fstpl 72(%esp) + fstpl 64(%esp) +..B1.44: + movzwl 70(%esp), %edx + testl $32752, %edx + jne ..B1.47 +..B1.45: + testl $1048575, 68(%esp) + jne ..B1.50 +..B1.46: + cmpl $0, 64(%esp) + jne ..B1.50 +..B1.47: + movzwl 78(%esp), %edx + testl $32752, %edx + jne ..B1.51 +..B1.48: + testl $1048575, 76(%esp) + jne ..B1.50 +..B1.49: + cmpl $0, 72(%esp) + je ..B1.51 +..B1.50: + fldl _DBL_MIN_NORMAL@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 56(%esp) +..B1.51: + movl 64(%esp), %edx + movl %edx, (%esi) + movl 68(%esp), %ecx + movl 72(%esp), %edi + movl 76(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 12(%esi) + movl 80(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.57 +..B1.52: + movl %esi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.53: + xorl %edi, %edi + jmp ..B1.27 +..B1.54: + testl $1048575, 16(%ebp) + jne ..B1.5 +..B1.55: + cmpl $0, 12(%ebp) + jne ..B1.5 + jmp ..B1.31 +..B1.57: + call __stack_chk_fail@PLT +..B1.58: + testl $1048575, 24(%ebp) + jne ..B1.61 +..B1.59: + cmpl $0, 20(%ebp) + jne ..B1.61 +..B1.60: + fldl 20(%ebp) + addl $-16, %esp + fstpl (%esp) + call tan@PLT +..B1.109: + addl $16, %esp + fstl 64(%esp) + fstpl 72(%esp) + jmp ..B1.44 +..B1.61: + fldl 20(%ebp) + fmul %st(0), %st + fstl 64(%esp) + fstpl 72(%esp) + jmp ..B1.44 +..B1.62: + testl $1048575, 16(%ebp) + jne ..B1.80 +..B1.63: + cmpl $0, 12(%ebp) + jne ..B1.112 +..B1.64: + movzbl 19(%ebp), %edx + andl $128, %edx + shrl $7, %edx + testl %ecx, %ecx + fldl ones@GOTOFF(%ebx,%edx,8) + fstpl 64(%esp) + jne ..B1.70 +..B1.65: + testl $1048575, 24(%ebp) + jne ..B1.71 +..B1.66: + cmpl $0, 20(%ebp) + jne ..B1.71 +..B1.67: + movzbl 27(%ebp), %edx + testl $128, %edx + jne ..B1.69 +..B1.68: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.69: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.70: + cmpl $2047, %ecx + je ..B1.92 +..B1.71: + cmpl $1023, %ecx + jge ..B1.77 +..B1.72: + testl %ecx, %ecx + jne ..B1.74 +..B1.73: + fldl 20(%ebp) + fadd %st(0), %st + fstpl 56(%esp) +..B1.74: + movzbl 27(%ebp), %edx + testl $128, %edx + jne ..B1.76 +..B1.75: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.76: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.77: + fldl 20(%ebp) + fstl 8(%esp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.111: + addl $16, %esp + fstpl (%esp) + addl $-16, %esp + fldl 24(%esp) + fstpl (%esp) + call cos@PLT +..B1.110: + addl $16, %esp + fldl (%esp) + fmulp %st, %st(1) + fstpl 16(%esp) + movzbl 23(%esp), %edx + testl $128, %edx + jne ..B1.79 +..B1.78: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.79: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.80: + jne ..B1.82 +..B1.81: + cmpl $0, 12(%ebp) + je ..B1.33 +..B1.82: + fldl 12(%ebp) + testl %ecx, %ecx + fmul %st(0), %st + fstl 64(%esp) + jne ..B1.90 +..B1.83: + testl $1048575, 24(%ebp) + jne ..B1.91 +..B1.84: + cmpl $0, 20(%ebp) + jne ..B1.91 +..B1.85: + fstp %st(0) + movzbl 27(%ebp), %edx + testl $128, %edx + jne ..B1.87 +..B1.86: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.87: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.90: + cmpl $2047, %ecx + je ..B1.98 +..B1.91: + fstpl 72(%esp) + jmp ..B1.44 +..B1.92: + testl $1048575, 24(%ebp) + jne ..B1.97 +..B1.93: + cmpl $0, 20(%ebp) + jne ..B1.97 +..B1.94: + movzbl 27(%ebp), %edx + testl $128, %edx + jne ..B1.96 +..B1.95: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.96: + fldl _DBL_NZERO@GOTOFF(%ebx) + fstpl 72(%esp) + jmp ..B1.44 +..B1.97: + fldl _DBL_PZERO@GOTOFF(%ebx) + fstpl 72(%esp) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 56(%esp) + jmp ..B1.44 +..B1.98: + testl $1048575, 24(%ebp) + jne ..B1.100 +..B1.99: + cmpl $0, 20(%ebp) + je ..B1.91 +..B1.100: + fstp %st(0) + fldl 20(%ebp) + fmul %st(0), %st + fstpl 72(%esp) + jmp ..B1.44 +..B1.112: + testl $1048575, 16(%ebp) + jne ..B1.82 + jmp ..B1.81 + .align 16,0x90 + .type ctanh,@function + .size ctanh,.-ctanh + .data +# -- End ctanh + .section .rodata, "a" + .align 16 + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .space 8, 0x00 # pad + .align 16 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 16 +_DBL_PZERO: + .long 0 + .long 0 + .type _DBL_PZERO,@object + .size _DBL_PZERO,8 + .space 8, 0x00 # pad + .align 16 +_DBL_NZERO: + .long 0 + .long -2147483648 + .type _DBL_NZERO,@object + .size _DBL_NZERO,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ctanhf.S b/external/sgx_libm/ia32/ctanhf.S new file mode 100644 index 0000000000..e859a5cccd --- /dev/null +++ b/external/sgx_libm/ia32/ctanhf.S @@ -0,0 +1,470 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanhf.c" + .text +..TXTST0: +# -- Begin ctanhf + .text + .align 16,0x90 + .globl ctanhf +ctanhf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + fldz + fsts 16(%esp) + fsts 36(%esp) + fstps 40(%esp) +..B1.2: + fnstcw 30(%esp) +..B1.3: + movzwl 10(%ebp), %eax + andl $32640, %eax + shrl $7, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %eax + jge ..B1.28 +..B1.4: + testl %eax, %eax + jle ..B1.46 +..B1.5: + movzwl 14(%ebp), %ecx + andl $32640, %ecx + shrl $7, %ecx + cmpl $255, %ecx + jge ..B1.29 +..B1.6: + cmpl $133, %eax + jl ..B1.21 +..B1.7: + flds .L_2il0floatpacket.6@GOTOFF(%ebx) + movzbl 11(%ebp), %eax + andl $128, %eax + shrl $7, %eax + testl %ecx, %ecx + flds ones@GOTOFF(%ebx,%eax,4) + fsub %st(1), %st + fstps 36(%esp) + jne ..B1.13 +..B1.8: + testl $8388607, 12(%ebp) + jne ..B1.12 +..B1.9: + fstp %st(0) + movzbl 15(%ebp), %eax + testl $128, %eax + jne ..B1.11 +..B1.10: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.11: + movl $-2147483648, 40(%esp) + jmp ..B1.39 +..B1.12: + flds 12(%ebp) + jmp ..B1.14 +..B1.13: + flds 12(%ebp) + jne ..B1.17 +..B1.14: + movzbl 15(%ebp), %eax + testl $128, %eax + fadd %st(0), %st + fstps 32(%esp) + jne ..B1.19 +..B1.15: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.20 +..B1.17: + addl $-16, %esp + fsts (%esp) + fstps 24(%esp) + fstps 28(%esp) + call sinf@PLT +..B1.86: + flds 28(%esp) + flds 24(%esp) + addl $16, %esp + fxch %st(2) + fstps (%esp) + addl $-16, %esp + fxch %st(1) + fstps (%esp) + fstps 28(%esp) + call cosf@PLT +..B1.85: + flds 28(%esp) + addl $16, %esp + flds (%esp) + fmulp %st, %st(2) + fxch %st(1) + fstps 4(%esp) + movzbl 7(%esp), %eax + testl $128, %eax + jne ..B1.19 +..B1.18: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.20 +..B1.19: + movl $-2147483648, 40(%esp) +..B1.20: + fmul %st(0), %st + fstps 32(%esp) + jmp ..B1.39 +..B1.21: + movzwl 30(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.22: + orl $-64768, %edx + movw %dx, 28(%esp) +..B1.23: + fldcw 28(%esp) +..B1.24: + movl $1, %esi +..B1.25: + flds 8(%ebp) + addl $-16, %esp + lea 16(%esp), %eax + lea 24(%esp), %edx + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + call sinhcosh@PLT +..B1.87: + addl $16, %esp +..B1.26: + flds 12(%ebp) + fsts 24(%esp) + addl $-16, %esp + fstpl (%esp) + call sin@PLT +..B1.89: + addl $16, %esp + fstpl 16(%esp) + addl $-16, %esp + flds 40(%esp) + fstpl (%esp) + call cos@PLT +..B1.88: + addl $16, %esp + fld %st(0) + testl %esi, %esi + fmul %st(1), %st + fxch %st(1) + fmull 16(%esp) + fldl (%esp) + fld %st(0) + fmul %st(1), %st + faddp %st, %st(3) + fxch %st(1) + fdiv %st(2), %st + fstps 40(%esp) + fmull 8(%esp) + fdivp %st, %st(1) + fstps 36(%esp) + je ..B1.39 +..B1.27: + fldcw 30(%esp) + jmp ..B1.39 +..B1.28: + movzwl 14(%ebp), %ecx + andl $32640, %ecx + shrl $7, %ecx +..B1.29: + cmpl $255, %eax + je ..B1.51 +..B1.30: + cmpl $255, %ecx + je ..B1.48 +..B1.31: + testl %eax, %eax + jne ..B1.38 +..B1.32: + testl $8388607, 8(%ebp) + jne ..B1.38 +..B1.33: + testl %ecx, %ecx + jne ..B1.36 +..B1.34: + testl $8388607, 12(%ebp) + jne ..B1.36 +..B1.35: + movl 8(%ebp), %eax + movl 12(%ebp), %edx + movl %eax, 36(%esp) + movl %edx, 40(%esp) + jmp ..B1.39 +..B1.36: + cmpl $255, %ecx + jge ..B1.39 +..B1.37: + movl 8(%ebp), %eax + movl %eax, 36(%esp) + addl $-16, %esp + movl 12(%ebp), %edx + movl %edx, (%esp) + call tanf@PLT +..B1.90: + addl $16, %esp + fstps 40(%esp) + jmp ..B1.39 +..B1.38: + addl $-16, %esp + movl 8(%ebp), %eax + movl %eax, (%esp) + call tanhf@PLT +..B1.91: + movl 12(%ebp), %eax + addl $16, %esp + fstps 36(%esp) + movl %eax, 40(%esp) +..B1.39: + movzwl 38(%esp), %eax + testl $32640, %eax + jne ..B1.41 +..B1.40: + testl $8388607, 36(%esp) + jne ..B1.43 +..B1.41: + movzwl 42(%esp), %eax + testl $32640, %eax + jne ..B1.44 +..B1.42: + testl $8388607, 40(%esp) + je ..B1.44 +..B1.43: + flds .L_2il0floatpacket.6@GOTOFF(%ebx) + fmul %st(0), %st + fstps 32(%esp) +..B1.44: + movl 36(%esp), %eax + movl 40(%esp), %edx + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + xorl %esi, %esi + jmp ..B1.25 +..B1.46: + testl $8388607, 8(%ebp) + jne ..B1.5 + jmp ..B1.28 +..B1.48: + testl $8388607, 12(%ebp) + jne ..B1.50 +..B1.49: + addl $-16, %esp + movl 12(%ebp), %eax + movl %eax, (%esp) + call tanf@PLT +..B1.92: + addl $16, %esp + fsts 36(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.50: + flds 12(%ebp) + fmul %st(0), %st + fsts 36(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.51: + testl $8388607, 8(%ebp) + jne ..B1.67 +..B1.52: + movzbl 11(%ebp), %eax + andl $128, %eax + shrl $7, %eax + testl %ecx, %ecx + movl ones@GOTOFF(%ebx,%eax,4), %edx + movl %edx, 36(%esp) + jne ..B1.57 +..B1.53: + testl $8388607, 12(%ebp) + jne ..B1.58 +..B1.54: + movzbl 15(%ebp), %eax + testl $128, %eax + jne ..B1.11 +..B1.55: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.57: + cmpl $255, %ecx + je ..B1.76 +..B1.58: + cmpl $127, %ecx + jge ..B1.64 +..B1.59: + testl %ecx, %ecx + jne ..B1.61 +..B1.60: + flds 12(%ebp) + fadd %st(0), %st + fstps 32(%esp) +..B1.61: + movzbl 15(%ebp), %eax + testl $128, %eax + jne ..B1.11 +..B1.62: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.64: + addl $-16, %esp + movl 12(%ebp), %esi + movl %esi, (%esp) + call sinf@PLT +..B1.94: + addl $16, %esp + fstps (%esp) + addl $-16, %esp + movl %esi, (%esp) + call cosf@PLT +..B1.93: + addl $16, %esp + flds (%esp) + fmulp %st, %st(1) + fstps 4(%esp) + movzbl 7(%esp), %eax + testl $128, %eax + jne ..B1.11 +..B1.65: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.67: + je ..B1.30 +..B1.68: + flds 8(%ebp) + testl %ecx, %ecx + fmul %st(0), %st + fsts 36(%esp) + jne ..B1.74 +..B1.69: + testl $8388607, 12(%ebp) + jne ..B1.75 +..B1.70: + fstp %st(0) + movzbl 15(%ebp), %eax + testl $128, %eax + jne ..B1.11 +..B1.71: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.74: + cmpl $255, %ecx + je ..B1.81 +..B1.75: + fstps 40(%esp) + jmp ..B1.39 +..B1.76: + testl $8388607, 12(%ebp) + jne ..B1.80 +..B1.77: + movzbl 15(%ebp), %eax + testl $128, %eax + jne ..B1.11 +..B1.78: + flds 16(%esp) + fstps 40(%esp) + jmp ..B1.39 +..B1.80: + flds 16(%esp) + fstps 40(%esp) + flds 12(%ebp) + fmul %st(0), %st + fstps 32(%esp) + jmp ..B1.39 +..B1.81: + testl $8388607, 12(%ebp) + je ..B1.75 +..B1.82: + fstp %st(0) + flds 12(%ebp) + fmul %st(0), %st + fstps 40(%esp) + jmp ..B1.39 + .align 16,0x90 + .type ctanhf,@function + .size ctanhf,.-ctanhf + .data +# -- End ctanhf + .section .rodata, "a" + .align 16 + .align 16 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +.L_2il0floatpacket.6: + .long 0x00800000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,4 + .align 4 +.L_2il0floatpacket.7: + .long 0x80000000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ctanhl.S b/external/sgx_libm/ia32/ctanhl.S new file mode 100644 index 0000000000..3d8f2c4a0e --- /dev/null +++ b/external/sgx_libm/ia32/ctanhl.S @@ -0,0 +1,975 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanhl.c" + .text +..TXTST0: +# -- Begin ctanhl + .text + .align 16,0x90 + .globl ctanhl +ctanhl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 304(%esp) + fstpt 280(%esp) + fldt 280(%esp) + fstpt 292(%esp) +..B1.2: + fnstcw 94(%esp) +..B1.3: + movzwl 94(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.81 +..B1.4: + orl $-64768, %ecx + movw %cx, 92(%esp) +..B1.5: + fldcw 92(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzwl 20(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.50 +..B1.8: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.50 +..B1.9: + cmpl $0, 16(%ebp) + jne ..B1.11 +..B1.10: + cmpl $0, 12(%ebp) + je ..B1.50 +..B1.11: + cmpl $16396, %edx + jl ..B1.22 +..B1.12: + fldt 24+_CONSTANTS@GOTOFF(%ebx) + movzbl 21(%ebp), %eax + andl $128, %eax + shrl $7, %eax + cmpl $0, 28(%ebp) + lea (,%eax,8), %edx + lea (%edx,%eax,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fsub %st(1), %st + fstpt 280(%esp) + jne ..B1.14 +..B1.13: + cmpl $0, 24(%ebp) + je ..B1.15 +..B1.14: + fmul %st(0), %st + fstpt 292(%esp) + jmp ..B1.16 +..B1.15: + fstp %st(0) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fstpt 292(%esp) +..B1.16: + testl %ecx, %ecx + jle ..B1.74 +..B1.17: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanl@PLT +..B1.84: + addl $16, %esp + fstpt 172(%esp) + movzbl 301(%esp), %edx + movzbl 181(%esp), %ecx + andl $127, %edx + andl $-128, %ecx + orl %ecx, %edx +..B1.18: + movb %dl, 301(%esp) + testl %edi, %edi + je ..B1.20 +..B1.19: + fldcw 94(%esp) +..B1.20: + movl 280(%esp), %edx + movl %edx, (%esi) + movl 292(%esp), %edx + movl %edx, 12(%esi) + movl 296(%esp), %edx + movl %edx, 16(%esi) + movl 284(%esp), %ecx + movl 288(%esp), %edi + movl 300(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 304(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.73 +..B1.21: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.22: + fldt 12(%ebp) + addl $-16, %esp + lea 224(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + call __libm_coshl_k80 +..B1.85: + addl $16, %esp +..B1.23: + fldt 48+_CONSTANTS@GOTOFF(%ebx) + fstpt 64(%esp) + fldt 64(%esp) + faddp %st, %st(1) + fstpt (%esp) + fldt 208(%esp) + fld %st(0) + fldt 220(%esp) + movzwl 20(%ebp), %ecx + fadd %st, %st(1) + andl $32767, %ecx + fxch %st(1) + fsub %st, %st(2) + movl (%esp), %edx + cmpl $16183, %ecx + movl %edx, 76(%esp) + fxch %st(2) + fsubrp %st, %st(1) + fstpt 40(%esp) + jge ..B1.25 +..B1.24: + fldt 12(%ebp) + lea 196(%esp), %eax + fldt 36+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt -12(%eax) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + movzwl -4(%eax), %ecx + movl %ecx, %edx + andl $32767, %edx + andl $-32768, %ecx + addl $-16639, %edx + orl $-49153, %ecx + fstpt (%eax) + movl %edx, 52(%esp) + movw %cx, -4(%eax) + jmp ..B1.27 +..B1.25: + fldt 12(%ebp) + addl $-16, %esp + lea 200(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + fstpt 32(%esp) + call __libm_sinhl_k80 +..B1.86: + fldt 32(%esp) + addl $16, %esp +..B1.26: + fldt 64(%esp) + lea 196(%esp), %eax + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + movl (%esp), %edx + movl %edx, 52(%esp) +..B1.27: + fldt 184(%esp) + fld %st(0) + fldt (%eax) + fadd %st, %st(1) + fxch %st(1) + fstpt 28(%esp) + fldt 28(%esp) + addl $-16, %esp + fsubp %st, %st(2) + fsubp %st, %st(1) + fldt 24(%ebp) + fstpt (%esp) + lea 248(%esp), %edx + movl %edx, 12(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt -104(%edx) + call __libm_cosl_k80 +..B1.87: + fldt 144(%esp) + fldt 32(%esp) + addl $16, %esp +..B1.28: + fldt 232(%esp) + fld %st(0) + fldt 244(%esp) + movl 52(%esp), %ecx + fadd %st, %st(1) + movzwl 36(%esp), %edx + fxch %st(1) + fsub %st, %st(2) + andl $32767, %edx + fxch %st(2) + fsubrp %st, %st(1) + fxch %st(1) + fmul %st(4), %st + fxch %st(1) + fmulp %st, %st(4) + addl %ecx, 76(%esp) + addl %ecx, %edx + fxch %st(3) + fstpt (%esp) + fldt (%esp) + fld %st(1) + fldt 24+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(5) + fxch %st(4) + fstpt 144(%esp) + fldt 144(%esp) + fstpt 16(%esp) + fldt 28(%esp) + fld %st(0) + fld %st(1) + fxch %st(2) + fstpt 96(%esp) + fldt 96(%esp) + fldt 96+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + movzwl 24(%esp), %ecx + fxch %st(2) + fsub %st, %st(3) + andl $32767, %ecx + fsubp %st, %st(3) + fsub %st(2), %st + fadd %st(5), %st + fld %st(4) + fmul %st(2), %st + fsub %st, %st(7) + fsubp %st, %st(7) + fxch %st(4) + fsub %st(6), %st + fxch %st(1) + fstpt 80(%esp) + fld %st(1) + lea 64(%ecx), %eax + fmul %st(6), %st + cmpl %eax, %edx + fldt 40(%esp) + faddp %st, %st(2) + fld %st(1) + fmul %st(5), %st + fxch %st(7) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(6) + fmulp %st, %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fstpt 112(%esp) + fldt 112(%esp) + fsubp %st, %st(2) + fxch %st(1) + fsubrp %st, %st(3) + fldt 144(%esp) + jge ..B1.33 +..B1.29: + addl $-64, %ecx + cmpl %ecx, %edx + jle ..B1.100 +..B1.30: + movl 52(%esp), %edx + fstpt 28(%esp) + fstpt 40(%esp) + lea (%edx,%edx), %ecx + movl %ecx, 12(%esp) + movzwl 36(%esp), %ecx + movl %ecx, %eax + subl %edx, %ecx + andl $-32768, %eax + andl $32767, %ecx + orl %ecx, %eax + movzwl 8(%esp), %ecx + andl $32767, %ecx + subl %edx, %ecx + movw %ax, 36(%esp) + testl %ecx, %ecx + jle ..B1.32 +..B1.31: + fldt 28(%esp) + movzwl 48(%esp), %edx + movl %edx, %ecx + subl 52(%esp), %edx + andl $-32768, %ecx + andl $32767, %edx + orl %edx, %ecx + movw %cx, 48(%esp) + fxch %st(1) + jmp ..B1.36 +..B1.32: + fldt 28(%esp) + fxch %st(1) + jmp ..B1.36 +..B1.33: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 40(%esp) + fldt 40(%esp) + jl ..B1.35 +..B1.34: + fstp %st(2) + fstp %st(0) + movl 52(%esp), %edx + lea (%edx,%edx), %ecx + movl %ecx, 12(%esp) + fxch %st(1) + jmp ..B1.36 +..B1.35: + fstp %st(3) + fstpt 96(%esp) + movl $0, 12(%esp) +..B1.36: + addl $-32, %esp + lea 288(%esp), %edx + movl %edx, (%esp) + fldt 128(%esp) + fstpt 4(%esp) + fxch %st(1) + fstpt 16(%esp) + fstpt -128(%edx) + fstpt -112(%edx) + call __libm_hypot2l_k80 +..B1.88: + fldt 176(%esp) + fldt 160(%esp) + addl $32, %esp +..B1.37: + fldt 64(%esp) + movzwl 8+_CONSTANTS@GOTOFF(%ebx), %edx + movl %edx, %eax + andl $-32768, %eax + faddp %st, %st(3) + fxch %st(2) + fstpt 52(%esp) + fldt _CONSTANTS@GOTOFF(%ebx) + movl 52(%esp), %ecx + addl %edx, %ecx + andl $32767, %ecx + fstpt 172(%esp) + orl %ecx, %eax + fldt 256(%esp) + fldt 268(%esp) + fldt 96(%esp) + fldt 28(%esp) + fldt 84+_CONSTANTS@GOTOFF(%ebx) + movw %ax, 180(%esp) + fmul %st, %st(2) + fxch %st(6) + fmulp %st, %st(2) + fmulp %st, %st(5) + fldt 172(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpt 144(%esp) + fldt 144(%esp) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fstpt 256(%esp) + fldt 256(%esp) + fldt 40(%esp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fstpt 268(%esp) + fldt 268(%esp) + fldt 112(%esp) + fld %st(0) + fdiv %st(4), %st + fstpt 160(%esp) + fldt 160(%esp) + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fld %st(0) + fmul %st(2), %st + fld %st(0) + fsubr %st(3), %st + faddp %st, %st(1) + fld %st(0) + fsubrp %st, %st(3) + fxch %st(1) + fstpt 128(%esp) + fldt 128(%esp) + fmul %st(6), %st + fld %st(6) + fsub %st(1), %st + faddp %st, %st(1) + fld %st(0) + fsubrp %st, %st(7) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fmul %st(7), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fxch %st(4) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 160(%esp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(0) + fldt 144(%esp) + addl $-32, %esp + fdivrp %st, %st(3) + fadd %st(2), %st + fstpt (%esp) + fldt (%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 12(%esp) + movl 108(%esp), %edx + subl 44(%esp), %edx + movl %edx, 24(%esp) + call __libm_scalbl_k80 +..B1.89: + addl $32, %esp +..B1.38: + fstpt 280(%esp) + cmpl $0, 28(%ebp) + jne ..B1.44 +..B1.39: + cmpl $0, 24(%ebp) + jne ..B1.44 +..B1.40: + fldt 24(%ebp) + testl %edi, %edi + fstpt 292(%esp) + je ..B1.42 +..B1.41: + fldcw 94(%esp) +..B1.42: + movl 280(%esp), %edx + movl %edx, (%esi) + movl 292(%esp), %edx + movl %edx, 12(%esi) + movl 296(%esp), %edx + movl %edx, 16(%esi) + movl 284(%esp), %ecx + movl 288(%esp), %edi + movl 300(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 304(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.73 +..B1.43: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.44: + movzwl 32(%ebp), %edx + andl $32767, %edx + cmpl $16183, %edx + jge ..B1.46 +..B1.45: + fldt 24(%ebp) + fldt 36+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 52(%esp) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + movzwl 60(%esp), %edx + movl %edx, %ecx + andl $-32768, %edx + andl $32767, %ecx + orl $-49153, %edx + addl $-16639, %ecx + movw %dx, 60(%esp) + fstpt 64(%esp) + fldt 64(%esp) + fldt 52(%esp) + fxch %st(1) + jmp ..B1.48 +..B1.46: + fldt 24(%ebp) + addl $-16, %esp + lea 68(%esp), %edx + fstpt (%esp) + movl %edx, 12(%esp) + call __libm_sinl_k80 +..B1.90: + addl $16, %esp +..B1.47: + fldt 52(%esp) + xorl %ecx, %ecx + fmul %st(1), %st + fstpt 52(%esp) + fldt 52(%esp) + fldt 64(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) +..B1.48: + fldt 80(%esp) + fld %st(0) + fld %st(3) + fadd %st(3), %st + fmul %st, %st(1) + fsub %st, %st(4) + fxch %st(4) + fsubrp %st, %st(3) + fld %st(3) + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fldt 16(%esp) + fmul %st, %st(2) + fld %st(0) + fsubr %st(3), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fxch %st(1) + fsub %st(2), %st + fxch %st(2) + fstpt 28(%esp) + fldt 28(%esp) + fldt (%esp) + faddp %st, %st(3) + fld %st(2) + fmul %st(5), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + fstpt 40(%esp) + fldt 256(%esp) + fld %st(0) + fdivr %st(2), %st + fld %st(1) + fldt 128(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + fsubr %st(4), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(4), %st + fxch %st(2) + fmul %st(5), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fld %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt 268(%esp) + fmul %st(3), %st + fsubrp %st, %st(2) + fldt 256(%esp) + fdivrp %st, %st(2) + addl $-32, %esp + fadd %st(1), %st + fstpt (%esp) + fldt (%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%esp) + subl 44(%esp), %ecx + movl %ecx, 24(%esp) + call __libm_scalbl_k80 +..B1.91: + addl $32, %esp +..B1.49: + fstpt 292(%esp) + jmp ..B1.69 +..B1.50: + movl 28(%ebp), %eax + testl %eax, %eax + jne ..B1.53 +..B1.51: + cmpl $0, 24(%ebp) + jne ..B1.53 +..B1.52: + movl 16(%ebp), %ecx + jmp ..B1.55 +..B1.53: + movzwl 32(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + jge ..B1.60 +..B1.54: + movl 16(%ebp), %ecx + cmpl $32767, %edx + je ..B1.77 +..B1.55: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + movl %ecx, 16(%esp) + call tanhl@PLT +..B1.92: + movl 16(%esp), %ecx + addl $16, %esp + fstpt 280(%esp) + testl %ecx, %ecx + jne ..B1.57 +..B1.56: + cmpl $0, 12(%ebp) + je ..B1.59 +..B1.57: + movzwl 32(%ebp), %edx + testl $32767, %edx + jle ..B1.76 +..B1.58: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanl@PLT +..B1.93: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + addl $16, %esp + fmulp %st, %st(1) + fstpt 292(%esp) + jmp ..B1.69 +..B1.59: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanl@PLT +..B1.94: + addl $16, %esp + fstpt 292(%esp) + jmp ..B1.69 +..B1.60: + cmpl $32767, %edx + jge ..B1.62 +..B1.61: + fldt 24(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanl@PLT +..B1.95: + addl $16, %esp + fstpt 280(%esp) + fldt 280(%esp) + fstpt 292(%esp) + jmp ..B1.69 +..B1.62: + cmpl $-2147483648, 16(%ebp) + jne ..B1.64 +..B1.63: + cmpl $0, 12(%ebp) + je ..B1.65 +..B1.64: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanhl@PLT +..B1.96: + fldt 24(%ebp) + addl $16, %esp + fmul %st(1), %st + fstpt 292(%esp) + fstpt 280(%esp) + jmp ..B1.69 +..B1.65: + cmpl $-2147483648, %eax + jne ..B1.67 +..B1.66: + cmpl $0, 24(%ebp) + je ..B1.68 +..B1.67: + fldt 24(%ebp) + addl $-16, %esp + fmul %st(0), %st + fstpt 24(%ebp) + fldt 12(%ebp) + fstpt (%esp) + call tanhl@PLT +..B1.97: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + addl $16, %esp + fstpt 292(%esp) + fstpt 280(%esp) + jmp ..B1.69 +..B1.68: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanhl@PLT +..B1.98: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + addl $16, %esp + movzbl 33(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + fxch %st(1) + fstpt 280(%esp) + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + fldt _CONSTANTS@GOTOFF(%ebx,%edx) + fmulp %st, %st(1) + fstpt 292(%esp) +..B1.69: + testl %edi, %edi + je ..B1.71 +..B1.70: + fldcw 94(%esp) +..B1.71: + movl 280(%esp), %edx + movl %edx, (%esi) + movl 292(%esp), %edx + movl %edx, 12(%esi) + movl 296(%esp), %edx + movl %edx, 16(%esi) + movl 284(%esp), %ecx + movl 288(%esp), %edi + movl 300(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 304(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.73 +..B1.72: + movl %esi, %eax + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.73: + call __stack_chk_fail@PLT +..B1.74: + movzbl 301(%esp), %edx + movzbl 33(%ebp), %ecx + andl $127, %edx + andl $-128, %ecx + orl %ecx, %edx + jmp ..B1.18 +..B1.76: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fldt 24(%ebp) + fmulp %st, %st(1) + fstpt 292(%esp) + jmp ..B1.69 +..B1.77: + cmpl $-2147483648, %ecx + jne ..B1.60 +..B1.78: + cmpl $0, 12(%ebp) + jne ..B1.60 +..B1.79: + fldt 12(%ebp) + addl $-16, %esp + fstpt (%esp) + call tanhl@PLT +..B1.99: + addl $16, %esp + fstpt 280(%esp) + jmp ..B1.57 +..B1.81: + xorl %edi, %edi + jmp ..B1.7 +..B1.100: + cmpl %eax, %edx + jmp ..B1.33 + .align 16,0x90 + .type ctanhl,@function + .size ctanhl,.-ctanhl + .data +# -- End ctanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 32768 + .word 16415 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 0 + .word 16384 + .word 0 + .word 32768 + .word 16416 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,108 + .data + .hidden __libm_sinl_k80 + .hidden __libm_cosl_k80 + .hidden __libm_sinhl_k80 + .hidden __libm_coshl_k80 + .hidden __libm_hypot2l_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ctanl.S b/external/sgx_libm/ia32/ctanl.S new file mode 100644 index 0000000000..0d6e6e8894 --- /dev/null +++ b/external/sgx_libm/ia32/ctanl.S @@ -0,0 +1,210 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanl.c" + .text +..TXTST0: +# -- Begin ctanl + .text + .align 16,0x90 + .globl ctanl +ctanl: +# parameter 1: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + movl 8(%ebp), %esi + xorl %esp, %edx + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + movl %edx, 100(%esp) + fstpt 4(%esp) + fldt 4(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + fldt 28(%esp) + fstpt 40(%esp) + fldt 40(%esp) + fstpt 52(%esp) + fldt 52(%esp) + fstpt 64(%esp) +..B1.2: + fnstcw 2(%esp) +..B1.3: + movzwl 2(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.4: + orl $-64768, %ecx + movw %cx, (%esp) +..B1.5: + fldcw (%esp) +..B1.6: + movl $1, %edi +..B1.7: + fldt 24(%ebp) + movzwl 32(%ebp), %edx + andl $32767, %edx + fstpt 52(%esp) + cmpl $32767, %edx + fldt 12(%ebp) + fstpt 64(%esp) + jl ..B1.10 +..B1.8: + cmpl $-2147483648, 28(%ebp) + jne ..B1.11 +..B1.9: + cmpl $0, 24(%ebp) + jne ..B1.11 +..B1.10: + movzbl 33(%ebp), %ecx + notl %ecx + movzbl 61(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 61(%esp) +..B1.11: + addl $-32, %esp + lea 108(%esp), %ecx + movl %ecx, (%esp) + lea 4(%esp), %edx + movl -24(%ecx), %ecx + movl %ecx, (%edx) + movl 88(%esp), %ecx + movl %ecx, 4(%edx) + movl 92(%esp), %ecx + movl %ecx, 8(%edx) + movl 96(%esp), %ecx + movl %ecx, 12(%edx) + movl 100(%esp), %ecx + movl %ecx, 16(%edx) + movl 104(%esp), %ecx + movl %ecx, 20(%edx) + call ctanhl@PLT +..B1.23: + addl $28, %esp + fldt 76(%esp) + movzwl 84(%esp), %edx + andl $32767, %edx + fstpt 4(%esp) + fldt 4(%esp) + cmpl $32767, %edx + fstpt 40(%esp) + fldt 88(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 28(%esp) + jl ..B1.14 +..B1.12: + cmpl $-2147483648, 8(%esp) + jne ..B1.15 +..B1.13: + cmpl $0, 4(%esp) + jne ..B1.15 +..B1.14: + movzbl 13(%esp), %ecx + notl %ecx + movzbl 49(%esp), %edx + andl $128, %ecx + andl $127, %edx + orl %ecx, %edx + movb %dl, 49(%esp) +..B1.15: + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 2(%esp) +..B1.17: + movl 28(%esp), %edx + movl %edx, (%esi) + movl 40(%esp), %edx + movl %edx, 12(%esi) + movl 44(%esp), %edx + movl %edx, 16(%esi) + movl 32(%esp), %ecx + movl 36(%esp), %edi + movl 48(%esp), %edx + movl %ecx, 4(%esi) + movl %edi, 8(%esi) + movl %edx, 20(%esi) + movl 100(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.19 +..B1.18: + movl %esi, %eax + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B1.19: + call __stack_chk_fail@PLT +..B1.20: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type ctanl,@function + .size ctanl,.-ctanl + .data +# -- End ctanl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/dpml_ux_bessel.S b/external/sgx_libm/ia32/dpml_ux_bessel.S new file mode 100644 index 0000000000..1f582af9a9 --- /dev/null +++ b/external/sgx_libm/ia32/dpml_ux_bessel.S @@ -0,0 +1,7116 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_bessel.c" + .text +..TXTST0: +# -- Begin __dpml_ux_bessel__ + .text + .align 16,0x90 +__dpml_ux_bessel__: +# parameter 1: %eax +# parameter 2: 196 + %esp +# parameter 3: 204 + %esp +# parameter 4: %edx +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $172, %esp + movl %eax, %ebp + movl %edx, 44(%esp) + movl $2, %edx + movl %gs:20, %ecx + movl 196(%esp), %esi + xorl %esp, %ecx + subl %edx, %esi + movl %ecx, 168(%esp) + movl $0, %ecx + movl 200(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + sbbl %ecx, %edi + jge ..B1.28 +..B1.2: + movl 204(%esp), %edi + movl 196(%esp), %esi + movl 12(%ebp), %ecx + movl %ecx, 40(%esp) + movl 4(%ebp), %ecx + lea (%esi,%edi), %esi + movl 8(%ebp), %edx + lea (%esi,%esi,2), %esi + cmpl $5, %ecx + jle ..B1.20 +..B1.72: + lea __bessel_x_table@GOTOFF(%ebx), %edi +..B1.3: + xorl %ecx, %ecx + lea 144(%esp), %edx + addl $20, %esp + pushl %edx + pushl %ecx + pushl $2 + pushl %ebp + pushl %ecx + call __dpml_divide__ +..B1.4: + movl 196(%esp), %edx + orl 200(%esp), %edx + jne ..B1.6 +..B1.5: + movl $10, 32(%esp) + lea 18168(%edi), %ecx + addl $18504, %edi + jmp ..B1.7 +..B1.6: + movl $9, 32(%esp) + lea 18872(%edi), %ecx + addl $19208, %edi +..B1.7: + addl $28, %esp + lea 20(%esp), %edx + pushl %edx + pushl $268435456 + pushl $68 + pushl $0 + pushl $9 + pushl %ecx + lea 140(%esp), %ecx + pushl %ecx + call __dpml_evaluate_rational__ +..B1.8: + xorl %ecx, %ecx + lea 72(%esp), %edx + addl $28, %esp + pushl %edx + pushl %ecx + pushl $70 + pushl %ecx + pushl 20(%esp) + pushl %edi + lea 140(%esp), %esi + pushl %esi + call __dpml_evaluate_rational__ +..B1.9: + movl 200(%esp), %edi + movl 196(%esp), %esi + lea (%edi,%edi), %ecx + lea (%esi,%esi), %edx + shrl $31, %esi + orl %ecx, %esi + movl $1, %ecx + xorl %eax, %eax + subl %edx, %ecx + movl $0, %edx + lea 96(%esp), %edi + sbbl %esi, %eax + subl 204(%esp), %ecx + sbbl 208(%esp), %eax + addl $24, %esp + pushl %edi + pushl %edx + pushl $3 + pushl %eax + pushl %ecx + pushl %ebp + call __dpml_ux_sincos +..B1.10: + addl $12, %esp + lea 36(%esp), %edx + pushl %edx + lea 88(%esp), %eax + pushl %eax + pushl %edx + call __dpml_multiply__ +..B1.11: + addl $12, %esp + lea 60(%esp), %edx + lea 108(%esp), %eax + pushl %edx + pushl %eax + pushl %edx + call __dpml_multiply__ +..B1.12: + movl 196(%esp), %eax + orl 200(%esp), %eax + je ..B1.14 +..B1.13: + xorl %eax, %eax + jmp ..B1.15 +..B1.14: + movl $1, %eax +..B1.15: + addl $20, %esp + lea 28(%esp), %edx + pushl %edx + pushl $0 + pushl %eax + lea 64(%esp), %eax + pushl %eax + pushl %edx + call __dpml_addsub__ +..B1.16: + lea 72(%esp), %ecx + pushl %ecx + pushl $0 + pushl $1 + lea 156(%esp), %ebp + pushl %ebp + call __dpml_ux_sqrt_evaluation__ +..B1.17: + addl $28, %esp + pushl 32(%esp) + lea 64(%esp), %eax + pushl %eax + lea 44(%esp), %edx + pushl %edx + call __dpml_multiply__ +..B1.18: + movl 168(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.31 +..B1.19: + addl $172, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.20: + je ..B1.63 +..B1.21: + movl 19552+__bessel_x_table@GOTOFF(%ebx,%esi,8), %esi + testl %ecx, %ecx + lea __bessel_x_table@GOTOFF(%ebx,%esi), %edi + jl ..B1.33 +..B1.22: + negl %ecx + addl $5, %ecx + cmpl $31, %ecx + jbe ..B1.24 +..B1.23: + movl 40(%esp), %edx + movl $0, 32(%esp) + shrl %cl, %edx +..B1.25: + movl 32(%esp), %ecx + jmp ..B1.26 +..B1.24: + movl 40(%esp), %esi + shrdl %cl, %esi, %edx + shrl %cl, %esi + movl %esi, 32(%esp) + jmp ..B1.25 +..B1.27: + movl 12(%edi), %esi + andl $1023, %esi + addl %esi, %edi +..B1.26: + movl %edx, %eax + movl %ecx, %esi + subl (%edi), %eax + sbbl 4(%edi), %esi + jb ..B1.33 +..B1.68: + orl %esi, %eax + je ..B1.33 + jmp ..B1.27 +..B1.28: + movl 196(%esp), %ecx + movl %ebp, %eax + movl 200(%esp), %esi + movl 204(%esp), %edi + movl 208(%esp), %edx + movl %ecx, 4(%esp) + movl %esi, 8(%esp) + movl %edi, 12(%esp) + movl %edx, 16(%esp) + movl 44(%esp), %edx + call __dpml_ux_large_order_bessel__ +..B1.29: + movl 168(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.31 +..B1.30: + addl $172, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.31: + call __stack_chk_fail@PLT +..B1.33: + movl 12(%edi), %edx + xorl %ecx, %ecx + movl 8(%edi), %esi + movl %edx, 40(%esp) + movl %esi, %edx + andl $8388608, %edx + orl %ecx, %edx + jne ..B1.35 +..B1.34: + movl %ebp, 36(%esp) + jmp ..B1.38 +..B1.35: + movl 16(%edi), %edx + lea 48(%esp), %ecx + movl 20(%edi), %eax + movl %edx, 32(%ecx) + movl %eax, 36(%ecx) + movl 24(%edi), %edx + movl 28(%edi), %eax + movl %edx, 40(%ecx) + xorl %edx, %edx + movl %eax, 44(%ecx) + movl %edx, 24(%ecx) + movl 40(%edi), %eax + andl $7, %eax + movl %eax, -16(%ecx) + movl %eax, 28(%ecx) + lea 72(%esp), %eax + addl $20, %esp + pushl %ecx + pushl %edx + pushl $1 + pushl %eax + pushl %ebp + call __dpml_addsub__ +..B1.36: + movl 32(%edi), %edx + movl 36(%edi), %ecx + movl %edx, 80(%esp) + movl %ecx, 84(%esp) + movl 40(%edi), %edx + movl 44(%edi), %ecx + movl %edx, 88(%esp) + movl 32(%esp), %edx + addl $-128, %edx + movl %ecx, 92(%esp) + movl %edx, 76(%esp) + addl $20, %esp + lea 28(%esp), %ecx + pushl %ecx + pushl $0 + pushl $1 + lea 64(%esp), %edx + pushl %edx + pushl %ecx + call __dpml_addsub__ +..B1.37: + lea 48(%esp), %edx + movl %edx, -12(%edx) +..B1.38: + movl %esi, %edx + movl %esi, %eax + shrl $14, %edx + andl $16777216, %eax + xorl %ecx, %ecx + addl $48, %edi + andl $127, %edx + orl %ecx, %eax + je ..B1.43 +..B1.39: + addl $-48, %esp + movl 84(%esp), %ecx + movl %ecx, (%esp) + movl %edx, 4(%esp) + movl %esi, %edx + shrl $7, %edx + andl $127, %edx + movl $0, 8(%esp) + cmpl $31, %edx + movl %edi, 12(%esp) + movl %edx, 80(%esp) + jbe ..B1.41 +..B1.40: + movl $1, %edx + xorl %edi, %edi + movl 80(%esp), %ecx + shll %cl, %edx + jmp ..B1.42 +..B1.41: + xorl %edx, %edx + movl $1, %edi + movl 80(%esp), %ecx + shldl %cl, %edi, %edx + shll %cl, %edi +..B1.42: + addl $-1, %edi + adcl $-1, %edx + movl %edi, 16(%esp) + movl %edx, 20(%esp) + movl %esi, %edx + andl $127, %edx + movl %edx, 24(%esp) + movl $0, 28(%esp) + movl 92(%esp), %ecx + movl %ecx, 32(%esp) + call __dpml_evaluate_packed_poly__@PLT +..B1.71: + addl $48, %esp + jmp ..B1.44 +..B1.43: + addl $28, %esp + pushl 16(%esp) + pushl 16(%esp) + pushl %esi + pushl $0 + pushl %edx + pushl %edi + pushl 32(%esp) + call __dpml_evaluate_rational__ +..B1.44: + movl %esi, %ecx + xorl %edx, %edx + shrl $11, %ecx + andl $3, %ecx + orl %ecx, %edx + je ..B1.46 +..B1.45: + addl $20, %esp + xorl %edi, %edi + addl $-1, %ecx + movl 24(%esp), %edx + pushl %edx + adcl $-1, %edi + pushl %edi + pushl %ecx + lea 24(%edx), %ecx + pushl %ecx + pushl %edx + call __dpml_addsub__ +..B1.46: + movl %esi, %ecx + xorl %edx, %edx + andl $4194304, %ecx + orl %edx, %ecx + je ..B1.48 +..B1.47: + addl $12, %esp + movl 32(%esp), %edx + pushl %edx + pushl %edx + pushl 32(%esp) + call __dpml_multiply__ +..B1.48: + movl %esi, %ecx + xorl %edx, %edx + andl $8192, %ecx + orl %edx, %ecx + je ..B1.50 +..B1.49: + movl 44(%esp), %edx + xorl $-2147483648, (%edx) +..B1.50: + andl $2097152, %esi + xorl %edx, %edx + orl %edx, %esi + je ..B1.58 +..B1.51: + cmpl 36(%esp), %ebp + jne ..B1.53 +..B1.52: + movl 40(%esp), %edx + sarl $26, %edx + subl %edx, 4(%ebp) +..B1.53: + movl $1, %edx + negl %edx + addl 196(%esp), %edx + orl 200(%esp), %edx + je ..B1.61 +..B1.54: + addl $12, %esp + lea 19664+__bessel_x_table@GOTOFF(%ebx), %ecx + lea 36(%esp), %esi + pushl %esi + pushl %ecx + pushl %ebp + call __dpml_ux_log__ +..B1.55: + movl 196(%esp), %ecx + xorl %edx, %edx + movl 200(%esp), %edi + movl %ebp, %eax + movl %ecx, 4(%esp) + movl %edi, 8(%esp) + movl %edx, 12(%esp) + movl %edx, 16(%esp) + lea 72(%esp), %edx + call __dpml_ux_bessel__ +..B1.56: + addl $12, %esp + pushl %esi + pushl %esi + lea 68(%esp), %eax + pushl %eax + call __dpml_multiply__ +..B1.57: + addl $20, %esp + movl 24(%esp), %eax + pushl %eax + pushl $0 + pushl $1 + pushl %eax + pushl %esi + call __dpml_addsub__ +..B1.58: + movl 168(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.31 + jmp ..B1.19 +..B1.61: + addl $20, %esp + lea 19640+__bessel_x_table@GOTOFF(%ebx), %ecx + lea 52(%esp), %edx + pushl %edx + pushl $0 + pushl $2 + pushl %ebp + pushl %ecx + call __dpml_divide__ +..B1.62: + addl $20, %esp + xorl %edx, %edx + movl 24(%esp), %esi + pushl %esi + pushl %edx + pushl %edx + lea 64(%esp), %ecx + pushl %ecx + pushl %esi + call __dpml_addsub__ + jmp ..B1.54 +..B1.63: + movl %edx, %eax + lea __bessel_x_table@GOTOFF(%ebx), %edi + subl 19544+__bessel_x_table@GOTOFF(%ebx,%esi,8), %eax + movl %eax, 36(%esp) + movl 40(%esp), %eax + sbbl 19548+__bessel_x_table@GOTOFF(%ebx,%esi,8), %eax + movl %eax, 32(%esp) + jb ..B1.64 +..B1.69: + movl 36(%esp), %eax + orl 32(%esp), %eax + jne ..B1.3 +..B1.64: + movl 19552+__bessel_x_table@GOTOFF(%ebx,%esi,8), %esi + addl %esi, %edi + jmp ..B1.22 + .align 16,0x90 + .type __dpml_ux_bessel__,@function + .size __dpml_ux_bessel__,.-__dpml_ux_bessel__ + .data +# -- End __dpml_ux_bessel__ + .text +# -- Begin __dpml_ux_large_order_bessel__ + .text + .align 16,0x90 +__dpml_ux_large_order_bessel__: +# parameter 1: %eax +# parameter 2: 12 + %ebp +# parameter 3: 20 + %ebp +# parameter 4: %edx +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $292, %esp + xorl %ebx, %ebx + movl %edx, 76(%esp) + lea 240(%esp), %edx + movl %gs:20, %ecx + movl %eax, %esi + xorl %esp, %ecx + movl %ecx, 48(%edx) + addl $20, %esp + pushl %edx + pushl %ebx + pushl $2 + pushl %esi + pushl %ebx + call __dpml_divide__ +..B2.2: + movl 12(%ebp), %ebx + lea 168(%esp), %eax + movl 16(%ebp), %edi + lea 192(%esp), %edx + movl %eax, -108(%eax) + lea 216(%esp), %ecx + movl %edx, -52(%eax) + movl %ecx, -76(%eax) + movl %ebx, 8(%eax) + movl %edi, 12(%eax) + addl $12, %esp + pushl $0 + pushl $2 + pushl %eax + call __dpml_ffs_and_shift__ +..B2.3: + movl $64, %ecx + xorl %edi, %edi + subl %eax, %ecx + movl 4(%esi), %eax + sbbl %edx, %edi + cltd + movl %edx, %ebx + movl %ecx, %edx + movl %eax, 64(%esp) + subl %eax, %edx + movl 12(%ebp), %eax + movl %eax, 120(%esp) + movl 16(%ebp), %eax + movl %esi, 32(%esp) + movl %edi, %esi + movl %eax, 124(%esp) + sbbl %ebx, %esi + fildll 120(%esp) + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + fstpl 128(%esp) + fldl 128(%esp) + movl %edx, 120(%esp) + fldt .L_2il0floatpacket.96@GOTOFF(%ebx) + movl %esi, 124(%esp) + movl %edx, 44(%esp) + movl $1, %edx + subl %ecx, %edx + movl %esi, 40(%esp) + movl $0, %esi + sbbl %edi, %esi + fstpt 104(%esp) + fldt 104(%esp) + fildll 120(%esp) + movl %ecx, 120(%esp) + movl %edi, 124(%esp) + movl $2, %edi + fstpl 128(%esp) + negl %edi + fldl 128(%esp) + fildll 120(%esp) + fstpl 128(%esp) + fldt .L_2il0floatpacket.97@GOTOFF(%ebx) + movl %edx, 120(%esp) + fsubrp %st, %st(1) + fmulp %st, %st(2) + fldl 128(%esp) + fldt .L_2il0floatpacket.98@GOTOFF(%ebx) + movl %esi, 124(%esp) + fsubrp %st, %st(1) + fmulp %st, %st(1) + addl 20(%ebp), %edi + fsubrp %st, %st(1) + fstpl 128(%esp) + fldl 128(%esp) + fildll 120(%esp) + fstpl 128(%esp) + fldl 128(%esp) + movl 32(%esp), %esi + fsub %st(1), %st + fstpl 128(%esp) + fldl 128(%esp) + orl 24(%ebp), %edi + je ..B2.62 +..B2.4: + fstp %st(1) + fldt .L_2il0floatpacket.100@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jbe ..B2.8 +..B2.5: + movl $-65536, %ecx + xorl %eax, %eax +..B2.6: + movl 76(%esp), %edx + movl %eax, (%edx) + xorl %eax, %eax + movl %ecx, 4(%edx) + movl %eax, 8(%edx) + movl $-2147483648, 12(%edx) + movl %eax, 16(%edx) + movl %eax, 20(%edx) + movl 288(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B2.41 +..B2.7: + addl $292, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.8: + negl %ecx + movl 8(%esi), %edx + addl $64, %ecx + movl %edx, 48(%esp) + cmpl $31, %ecx + movl 12(%esi), %edx + jbe ..B2.10 +..B2.9: + movl %edx, %edi + shrl %cl, %edi + movl $0, 36(%esp) + movl %edi, 32(%esp) + jmp ..B2.11 +..B2.10: + movl 48(%esp), %edi + shrdl %cl, %edx, %edi + movl %edi, 32(%esp) + movl %edx, %edi + shrl %cl, %edi + movl %edi, 36(%esp) +..B2.11: + xorl %ecx, %ecx + movl 40(%esp), %edi + subl %ecx, %edi + jl ..B2.47 +..B2.66: + orl 44(%esp), %edi + je ..B2.47 +..B2.12: + movl %edx, %ecx + movl 48(%esp), %eax + shll $31, %ecx + shrl $1, %eax + shrl $1, %edx + orl %eax, %ecx + movl %ecx, 120(%esp) + movl %edx, 124(%esp) + fildll 120(%esp) + movl 12(%ebp), %edx + movl 16(%ebp), %esi + movl %edx, 120(%esp) + movl %esi, 124(%esp) + fstps 44(%esp) + fildll 120(%esp) + fstps 120(%esp) + flds 120(%esp) + fstpt 32(%esp) + fldt 32(%esp) + fstps (%esp) + call log2f@PLT +..B2.13: + fldt .L_2il0floatpacket.101@GOTOFF(%ebx) + fmul %st(1), %st + fldt .L_2il0floatpacket.102@GOTOFF(%ebx) + faddp %st, %st(1) + fstps 120(%esp) + fldt .L_2il0floatpacket.103@GOTOFF(%ebx) + fldt 32(%esp) + faddp %st, %st(1) + flds 44(%esp) + fxch %st(1) + fadds 120(%esp) + fstps 120(%esp) + flds 120(%esp) + fstpt 80(%esp) + fstps (%esp) + fstpt 48(%esp) + call log2f@PLT +..B2.71: + fldt 48(%esp) +..B2.14: + fldt .L_2il0floatpacket.104@GOTOFF(%ebx) + fldt .L_2il0floatpacket.105@GOTOFF(%ebx) + fldt 104(%esp) + fldt 32(%esp) + movl 64(%esp), %eax + fadd %st(1), %st + addl $-64, %eax + movl %eax, 120(%esp) + fildl 120(%esp) + fstps 120(%esp) + fldt 80(%esp) + fxch %st(6) + fadds 120(%esp) + faddp %st, %st(4) + fxch %st(3) + fstps 120(%esp) + flds 120(%esp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fsts 44(%esp) + fsubp %st, %st(3) + fxch %st(2) + fstpl 128(%esp) + fldl 128(%esp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstps 120(%esp) + flds 120(%esp) + fstpt 48(%esp) + fstps (%esp) + call log2f@PLT +..B2.15: + fldt .L_2il0floatpacket.106@GOTOFF(%ebx) + fstpt 64(%esp) + fldt 64(%esp) + fld %st(1) + fmulp %st, %st(1) + fxch %st(1) + fsubs 44(%esp) + fstpl 128(%esp) + fldt 48(%esp) + faddp %st, %st(1) + fldl 128(%esp) + fdivrp %st, %st(1) + fstps 120(%esp) + fldt 80(%esp) + fldt 104(%esp) + fxch %st(1) + fadds 120(%esp) + fstpl 128(%esp) + fldl 128(%esp) + fmulp %st, %st(1) + fstps 120(%esp) + flds 120(%esp) + fstpt 32(%esp) + fldt 32(%esp) + fstps (%esp) + call log2f@PLT +..B2.16: + fldt 64(%esp) + fldt 48(%esp) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fldt 32(%esp) + fxch %st(2) + fsubs 44(%esp) + fstpl 128(%esp) + fldl 128(%esp) + fdivrp %st, %st(1) + fstps 120(%esp) + fldt 104(%esp) + fxch %st(1) + fadds 120(%esp) + fstpl 128(%esp) + fldl 128(%esp) + fmulp %st, %st(1) + fstps 120(%esp) + flds 120(%esp) + fstpt 80(%esp) + fldt 80(%esp) + fstps (%esp) + call log2f@PLT +..B2.17: + fldt 64(%esp) + movl $-2147483648, %ecx + fmul %st(1), %st + fxch %st(1) + fsubs 44(%esp) + fstpl 128(%esp) + fldt 48(%esp) + movl 16(%ebp), %edx + faddp %st, %st(1) + fldl 128(%esp) + fdivrp %st, %st(1) + fstps 120(%esp) + fldt 80(%esp) + fldt 104(%esp) + fldt .L_2il0floatpacket.107@GOTOFF(%ebx) + flds .L_2il0floatpacket.108@GOTOFF(%ebx) + fxch %st(3) + fadds 120(%esp) + fstpl 128(%esp) + fldl 128(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstps 120(%esp) + flds 120(%esp) + faddp %st, %st(1) + fcom %st(1) + fnstsw %ax + fsub %st, %st(1) + sahf + jae ..L5 + fst %st(1) +..L5: + fstp %st(0) + jae ..L6 + movl $0, %ecx +..L6: + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 96(%esp) + fldcw 32(%esp) + movl 12(%ebp), %eax + addl $1, %eax + movl 96(%esp), %esi + adcl $0, %edx + addl 100(%esp), %ecx + movl %esi, 140(%esp) + subl %eax, %esi + movl %ecx, %edi + movl %edx, 136(%esp) + sbbl %edx, %edi + jb ..B2.19 +..B2.67: + orl %edi, %esi + je ..B2.19 +..B2.18: + movl %ecx, 136(%esp) + jmp ..B2.20 +..B2.19: + movl %eax, 140(%esp) +..B2.20: + movl 140(%esp), %edx + xorl %eax, %eax + andl $1, %edx + movl %eax, 168(%esp) + orl %eax, %edx + movl $-262144, 172(%esp) + movl %eax, 176(%esp) + movl %eax, 180(%esp) + movl %eax, 184(%esp) + movl %eax, 188(%esp) + movl %eax, 192(%esp) + movl $1, 196(%esp) + movl %eax, 200(%esp) + movl $-2147483648, 204(%esp) + movl %eax, 208(%esp) + movl %eax, 212(%esp) + movl %eax, 144(%esp) + je ..B2.22 +..B2.21: + movl $-262144, 148(%esp) + movl %eax, 152(%esp) + movl %eax, 156(%esp) + movl %eax, 160(%esp) + movl %eax, 164(%esp) + jmp ..B2.23 +..B2.22: + movl $1, 148(%esp) + movl %eax, 152(%esp) + movl $-2147483648, 156(%esp) + movl %eax, 160(%esp) + movl %eax, 164(%esp) +..B2.23: + movl 136(%esp), %esi + movl 140(%esp), %ecx + movl %ecx, %eax + shrl $31, %eax + lea (%esi,%esi), %edi + orl %edi, %eax + addl %ecx, %ecx + movl %ecx, 272(%esp) + movl %eax, 276(%esp) + addl $12, %esp + lea 252(%esp), %edx + pushl $0 + pushl $2 + pushl %edx + call __dpml_ffs_and_shift__ +..B2.24: + movl 268(%esp), %ecx + addl $-2, %ecx + cmpl $31, %ecx + jbe ..B2.26 +..B2.25: + movl $-2147483648, %eax + xorl %edx, %edx + shrl %cl, %eax + jmp ..B2.27 +..B2.26: + xorl %eax, %eax + movl $-2147483648, %edx + shrdl %cl, %edx, %eax + shrl %cl, %edx +..B2.27: + movl %ebx, 44(%esp) + movl %edx, 32(%esp) + movl %eax, 36(%esp) + movl 92(%esp), %ebx + movl 60(%esp), %esi +..B2.28: + addl $12, %esp + pushl %ebx + lea 256(%esp), %eax + pushl %eax + lea 236(%esp), %edx + pushl %edx + call __dpml_multiply__ +..B2.29: + addl $12, %esp + pushl %ebx + pushl %ebx + pushl 112(%esp) + call __dpml_multiply__ +..B2.30: + addl $12, %esp + xorl %ecx, %ecx + pushl %ecx + pushl %ecx + pushl %ebx + call __dpml_ffs_and_shift__ +..B2.31: + addl $12, %esp + xorl %ecx, %ecx + pushl %ecx + pushl %ecx + pushl %esi + call __dpml_ffs_and_shift__ +..B2.32: + addl $20, %esp + pushl %ebx + pushl $0 + pushl $1 + pushl %esi + pushl %ebx + call __dpml_addsub__ +..B2.33: + movl 140(%esp), %eax + addl $-1, %eax + movl 136(%esp), %edx + adcl $-1, %edx + movl %eax, 140(%esp) + orl %edx, %eax + movl %edx, 136(%esp) + je ..B2.42 +..B2.34: + movl 140(%esp), %edx + movl 136(%esp), %eax + subl 12(%ebp), %edx + subl 16(%ebp), %eax + orl %eax, %edx + jne ..B2.36 +..B2.35: + movl 76(%esp), %eax + movl (%ebx), %edx + movl 4(%ebx), %ecx + movl 8(%ebx), %edi + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl %edi, 8(%eax) + movl 12(%ebx), %edx + movl 16(%ebx), %ecx + movl 20(%ebx), %edi + movl %edx, 12(%eax) + movl %ecx, 16(%eax) + movl %edi, 20(%eax) +..B2.36: + movl 140(%esp), %edx + xorl %eax, %eax + andl $1, %edx + orl %eax, %edx + jne ..B2.38 +..B2.37: + addl $20, %esp + lea 124(%esp), %edx + pushl %edx + pushl %eax + pushl %eax + pushl %ebx + pushl %edx + call __dpml_addsub__ +..B2.38: + movl %esi, %eax + movl $-2147483648, %ecx + movl 116(%esp), %esi + movl %ebx, 116(%esp) + movl %eax, %ebx + movl 272(%esp), %eax + subl 36(%esp), %eax + movl 276(%esp), %edx + sbbl 32(%esp), %edx + movl %edx, %edi + subl %ecx, %edi + jae ..B2.40 +..B2.39: + addl %eax, %eax + movl 36(%esp), %ecx + adcl %edx, %edx + addl %ecx, %ecx + movl 32(%esp), %edi + adcl %edi, %edi + decl 268(%esp) + movl %ecx, 36(%esp) + movl %edi, 32(%esp) +..B2.40: + movl %eax, 272(%esp) + movl %edx, 276(%esp) + jmp ..B2.28 +..B2.41: + call __stack_chk_fail@PLT +..B2.42: + movl %ebx, 92(%esp) + lea 144(%esp), %esi + movl -100(%esi), %ebx + xorl %eax, %eax + incl 4(%esi) + addl $20, %esp + pushl %esi + pushl %eax + pushl %eax + pushl %esi + pushl 88(%esp) + call __dpml_addsub__ +..B2.43: + addl $20, %esp + movl 56(%esp), %eax + pushl %eax + pushl $0 + pushl $2 + pushl %esi + pushl %eax + call __dpml_divide__ +..B2.44: + movl 288(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.41 + jmp ..B2.7 +..B2.47: + movl 44(%esp), %ecx + orl 40(%esp), %ecx + jne ..B2.49 +..B2.48: + movl 32(%esp), %ecx + subl 12(%ebp), %ecx + movl 36(%esp), %edi + sbbl 16(%ebp), %edi + jb ..B2.12 +..B2.49: + movl 20(%ebp), %edi + xorl %ecx, %ecx + movl 24(%ebp), %edx + movl %esi, %eax + movl %ecx, 4(%esp) + movl %ecx, 8(%esp) + movl %edi, 12(%esp) + movl %edx, 16(%esp) + lea 168(%esp), %edx + call __dpml_ux_bessel__ +..B2.50: + movl 20(%ebp), %ecx + movl %esi, %eax + movl 24(%ebp), %edi + movl $1, 4(%esp) + movl $0, 8(%esp) + movl %ecx, 12(%esp) + movl %edi, 16(%esp) + movl 116(%esp), %edx + call __dpml_ux_bessel__ +..B2.51: + movl 12(%ebp), %esi + xorl %edx, %edx + addl $-1, %esi + movl 16(%ebp), %eax + adcl $-1, %eax + movl $-2147483648, %ecx + movl %ebx, 44(%esp) + movl %edx, 264(%esp) + movl $2, 268(%esp) + movl %edx, 272(%esp) + movl $-2147483648, 276(%esp) + movl %edx, 280(%esp) + movl %edx, 284(%esp) + movl %ecx, 36(%esp) + movl %eax, 40(%esp) + movl %edx, 32(%esp) + movl 92(%esp), %ebx +..B2.52: + addl $12, %esp + pushl %ebx + lea 256(%esp), %eax + pushl %eax + lea 236(%esp), %edx + pushl %edx + call __dpml_multiply__ +..B2.53: + addl $12, %esp + pushl %ebx + pushl %ebx + pushl 112(%esp) + call __dpml_multiply__ +..B2.54: + addl $20, %esp + pushl %ebx + pushl $0 + pushl $1 + pushl 52(%esp) + pushl %ebx + call __dpml_addsub__ +..B2.55: + addl $-1, %esi + movl 40(%esp), %eax + adcl $-1, %eax + xorl %edx, %edx + movl %eax, 40(%esp) + subl %edx, %eax + jl ..B2.76 +..B2.68: + orl %esi, %eax + je ..B2.76 +..B2.56: + movl 60(%esp), %ecx + movl 116(%esp), %edx + movl 32(%esp), %eax + movl %ebx, 116(%esp) + movl %ecx, %ebx + movl 272(%esp), %ecx + addl %eax, %ecx + movl %edx, 60(%esp) + movl %ecx, %edi + movl 276(%esp), %edx + adcl 36(%esp), %edx + subl %eax, %edi + movl %edx, %eax + sbbl 36(%esp), %eax + jae ..B2.58 +..B2.57: + movl %edx, %edi + shll $31, %edi + shrl $1, %ecx + orl %edi, %ecx + movl 36(%esp), %edi + movl %edi, %eax + shrl $1, %edi + movl %edi, 36(%esp) + movl 32(%esp), %edi + shll $31, %eax + shrl $1, %edi + shrl $1, %edx + orl %eax, %edi + incl 268(%esp) + addl $-2147483648, %edx + movl %edi, 32(%esp) +..B2.58: + movl %ecx, 272(%esp) + movl %edx, 276(%esp) + jmp ..B2.52 +..B2.76: + movl %ebx, 92(%esp) + movl 44(%esp), %ebx +..B2.59: + movl 92(%esp), %eax + movl 76(%esp), %edx + movl (%eax), %ecx + movl 4(%eax), %esi + movl %ecx, (%edx) + movl %esi, 4(%edx) + movl 8(%eax), %edi + movl 12(%eax), %ecx + movl 16(%eax), %esi + movl 20(%eax), %eax + movl %edi, 8(%edx) + movl %ecx, 12(%edx) + movl %esi, 16(%edx) + movl %eax, 20(%edx) + movl 288(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.41 + jmp ..B2.7 +..B2.62: + fstp %st(0) + fldt .L_2il0floatpacket.99@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jae ..B2.49 + jp ..B2.49 +..B2.63: + movl $65536, %ecx + movl $-2147483648, %eax + jmp ..B2.6 + .align 16,0x90 + .type __dpml_ux_large_order_bessel__,@function + .size __dpml_ux_large_order_bessel__,.-__dpml_ux_large_order_bessel__ + .data +# -- End __dpml_ux_large_order_bessel__ + .text +# -- Begin __j0q + .text + .align 16,0x90 + .globl __j0q +__j0q: +# parameter 1: 24 + %ebp +..B3.1: +..L7: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + xorl %esi, %esi + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 160(%esp) + call ..L8 +..L8: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L8](%ebx), %ebx + movl $1, 40(%esp) + movl %esi, 44(%esp) + movl %esi, 32(%esp) + lea __bessel_x_table@GOTOFF(%ebx), %ecx + movl %esi, 36(%esp) + addl $24, %esp + lea 8(%esp), %eax + lea 84(%esp), %edx + pushl %eax + lea 124(%esp), %eax + pushl %eax + pushl %ecx + pushl %edx + pushl %esi + lea 24(%ebp), %ecx + pushl %ecx + call __dpml_unpack_x_or_y__ +..B3.2: + subl %esi, %edx + jl ..B3.6 +..B3.4: + movl %esi, 4(%esp) + lea 60(%esp), %edx + movl %esi, 8(%esp) + lea 108(%esp), %eax + movl %esi, 12(%esp) + movl %esi, (%eax) + movl %esi, 16(%esp) + call __dpml_ux_bessel__ +..B3.5: + addl $28, %esp + lea 4(%esp), %edx + pushl %edx + pushl %esi + pushl %esi + pushl %esi + pushl %esi + lea 136(%esp), %ecx + pushl %ecx + lea 56(%esp), %esi + pushl %esi + call __dpml_pack__ +..B3.6: + movl 144(%esp), %edx + movl %edx, (%edi) + movl 148(%esp), %ecx + movl 152(%esp), %esi + movl 156(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 160(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B3.8 +..B3.7: + movl %edi, %eax + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B3.8: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __j0q,@function + .size __j0q,.-__j0q + .data +# -- End __j0q + .text +# -- Begin __j1q + .text + .align 16,0x90 + .globl __j1q +__j1q: +# parameter 1: 24 + %ebp +..B4.1: +..L9: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + xorl %ecx, %ecx + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 160(%esp) + call ..L10 +..L10: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L10](%ebx), %ebx + movl $1, 40(%esp) + movl %ecx, 44(%esp) + movl %ecx, 32(%esp) + lea 8+__bessel_x_table@GOTOFF(%ebx), %esi + movl %ecx, 36(%esp) + addl $24, %esp + lea 8(%esp), %eax + lea 84(%esp), %edx + pushl %eax + lea 124(%esp), %eax + pushl %eax + pushl %esi + pushl %edx + pushl %ecx + movl 36(%ebp), %esi + lea 24(%ebp), %ecx + pushl %ecx + andl $-2147483648, %esi + call __dpml_unpack_x_or_y__ +..B4.16: + movl %edx, %ecx +..B4.2: + xorl %edx, %edx + subl %edx, %ecx + jge ..B4.6 +..B4.3: + movl 156(%esp), %ecx + movl %ecx, %edx + movl $2147418112, %eax + andl $2147418112, %edx + subl %eax, %edx + xorl %eax, %eax + orl %edx, %eax + movl 152(%esp), %edx + je ..B4.5 +..B4.4: + orl %esi, %ecx +..B4.5: + movl %edx, 152(%esp) + movl %ecx, 156(%esp) + jmp ..B4.11 +..B4.6: + movl $1, 4(%esp) + lea 60(%esp), %edx + xorl %ecx, %ecx + lea 108(%esp), %eax + movl %ecx, 8(%esp) + movl %ecx, 12(%esp) + movl %ecx, (%eax) + movl %ecx, 16(%esp) + call __dpml_ux_bessel__ +..B4.7: + xorl %esi, 60(%esp) + je ..B4.9 +..B4.8: + movl $8, %ecx + jmp ..B4.10 +..B4.9: + xorl %ecx, %ecx +..B4.10: + movl $513, %esi + addl $28, %esp + shrl %cl, %esi + lea 4(%esp), %edx + andl $255, %esi + pushl %edx + pushl 4+__bessel_error_codes@GOTOFF(%ebx) + pushl __bessel_error_codes@GOTOFF(%ebx) + pushl 4+__bessel_error_codes@GOTOFF(%ebx,%esi,8) + pushl __bessel_error_codes@GOTOFF(%ebx,%esi,8) + lea 136(%esp), %edx + pushl %edx + lea 56(%esp), %edx + pushl %edx + call __dpml_pack__ +..B4.11: + movl 144(%esp), %edx + movl %edx, (%edi) + movl 148(%esp), %ecx + movl 152(%esp), %esi + movl 156(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 160(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B4.13 +..B4.12: + movl %edi, %eax + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B4.13: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __j1q,@function + .size __j1q,.-__j1q + .data +# -- End __j1q + .text +# -- Begin __jnq + .text + .align 16,0x90 + .globl __jnq +__jnq: +# parameter 1: 12 + %ebp +# parameter 2: 24 + %ebp +..B5.1: +..L11: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + movl 8(%ebp), %esi + movl %esi, 64(%esp) + movl 12(%ebp), %esi + movl %esi, %eax + cltd + movl %gs:20, %ecx + movl %edx, %ebx + xorl %esp, %ecx + movl %ecx, 160(%esp) + xorl %ecx, %ecx + movl 36(%ebp), %edi + subl %ecx, %edx + movl $1, 40(%esp) + movl %ecx, 44(%esp) + movl %ecx, 32(%esp) + movl %ecx, 36(%esp) + jge ..B5.3 +..B5.2: + movl %esi, %edx + xorl %esi, %esi + xorl $-2147483648, %edi + subl %edx, %esi + movl %ebx, %edx + movl %ecx, %ebx + sbbl %edx, %ebx +..B5.3: + movl %esi, %ecx + xorl %edx, %edx + andl $1, %ecx + orl %edx, %ecx + jne ..B5.6 +..B5.5: + xorl %edi, %edi +..B5.6: + movl $2, %ecx + movl %esi, %edx + andl $-2147483648, %edi + movl %ebx, %eax + subl %ecx, %edx + movl $0, %ecx + sbbl %ecx, %eax + jl ..B5.8 +..B5.24: + orl %eax, %edx + je ..B5.8 +..B5.7: + movl $2, %edx + jmp ..B5.9 +..B5.8: + movl %esi, %edx +..B5.9: + call ..L12 +..L12: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L12](%ecx), %ecx + addl $24, %esp + movl %ecx, 36(%esp) + lea 8(%esp), %eax + lea __bessel_x_table@GOTOFF(%ecx,%edx,8), %edx + lea 92(%esp), %ecx + pushl %eax + lea 124(%esp), %eax + pushl %eax + pushl %edx + pushl %ecx + pushl $0 + lea 24(%ebp), %edx + pushl %edx + call __dpml_unpack_x_or_y__ +..B5.25: + movl %edx, %ecx +..B5.10: + xorl %edx, %edx + subl %edx, %ecx + jge ..B5.14 +..B5.11: + movl 156(%esp), %edx + movl %edx, %eax + movl $2147418112, %ebx + andl $2147418112, %eax + subl %ebx, %eax + xorl %esi, %esi + movl 152(%esp), %ecx + orl %eax, %esi + je ..B5.13 +..B5.12: + orl %edi, %edx +..B5.13: + movl %ecx, 152(%esp) + movl %edx, 156(%esp) + jmp ..B5.19 +..B5.14: + movl %esi, 4(%esp) + lea 68(%esp), %edx + movl %ebx, 8(%esp) + lea 116(%esp), %eax + xorl %ecx, %ecx + movl %ecx, 12(%esp) + movl %ecx, (%eax) + movl %ecx, 16(%esp) + call __dpml_ux_bessel__ +..B5.15: + xorl %edi, 68(%esp) + je ..B5.17 +..B5.16: + movl $8, %ecx + jmp ..B5.18 +..B5.17: + xorl %ecx, %ecx +..B5.18: + addl $28, %esp + movl $1027, %edx + shrl %cl, %edx + lea 4(%esp), %eax + pushl %eax + movl 28(%eax), %ebx + movzbl %dl, %edx + pushl 4+__bessel_error_codes@GOTOFF(%ebx) + pushl __bessel_error_codes@GOTOFF(%ebx) + pushl 4+__bessel_error_codes@GOTOFF(%ebx,%edx,8) + pushl __bessel_error_codes@GOTOFF(%ebx,%edx,8) + lea 136(%esp), %esi + pushl %esi + lea 64(%esp), %edi + pushl %edi + call __dpml_pack__ +..B5.19: + movl 64(%esp), %esi + movl 144(%esp), %eax + movl 148(%esp), %edx + movl 152(%esp), %ecx + movl 156(%esp), %ebx + movl %eax, (%esi) + movl %edx, 4(%esi) + movl %ecx, 8(%esi) + movl %ebx, 12(%esi) + movl 160(%esp), %edi + xorl %esp, %edi + cmpl %gs:20, %edi + jne ..B5.21 +..B5.20: + movl %esi, %eax + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B5.21: + movl 60(%esp), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type __jnq,@function + .size __jnq,.-__jnq + .data +# -- End __jnq + .text +# -- Begin __y0q + .text + .align 16,0x90 + .globl __y0q +__y0q: +# parameter 1: 24 + %ebp +..B6.1: +..L13: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + xorl %esi, %esi + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 160(%esp) + call ..L14 +..L14: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L14](%ebx), %ebx + movl $1, 40(%esp) + movl %esi, 44(%esp) + movl %esi, 32(%esp) + lea 40+__bessel_x_table@GOTOFF(%ebx), %ecx + movl %esi, 36(%esp) + addl $24, %esp + lea 8(%esp), %eax + lea 84(%esp), %edx + pushl %eax + lea 124(%esp), %eax + pushl %eax + pushl %ecx + pushl %edx + pushl %esi + lea 24(%ebp), %ecx + pushl %ecx + call __dpml_unpack_x_or_y__ +..B6.2: + subl %esi, %edx + jl ..B6.6 +..B6.4: + movl %esi, 4(%esp) + lea 60(%esp), %edx + movl %esi, 8(%esp) + lea 108(%esp), %eax + movl $2, 12(%esp) + movl %esi, (%eax) + movl %esi, 16(%esp) + call __dpml_ux_bessel__ +..B6.5: + addl $28, %esp + lea 4(%esp), %edx + pushl %edx + pushl %esi + pushl %esi + pushl %esi + pushl %esi + lea 136(%esp), %ecx + pushl %ecx + lea 56(%esp), %esi + pushl %esi + call __dpml_pack__ +..B6.6: + movl 144(%esp), %edx + movl %edx, (%edi) + movl 148(%esp), %ecx + movl 152(%esp), %esi + movl 156(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 160(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B6.8 +..B6.7: + movl %edi, %eax + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B6.8: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __y0q,@function + .size __y0q,.-__y0q + .data +# -- End __y0q + .text +# -- Begin __y1q + .text + .align 16,0x90 + .globl __y1q +__y1q: +# parameter 1: 24 + %ebp +..B7.1: +..L15: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + xorl %ecx, %ecx + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 160(%esp) + call ..L16 +..L16: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L16](%ebx), %ebx + movl $1, 40(%esp) + movl %ecx, 44(%esp) + movl %ecx, 32(%esp) + lea 48+__bessel_x_table@GOTOFF(%ebx), %esi + movl %ecx, 36(%esp) + addl $24, %esp + lea 8(%esp), %eax + lea 84(%esp), %edx + pushl %eax + lea 124(%esp), %eax + pushl %eax + pushl %esi + pushl %edx + pushl %ecx + movl 36(%ebp), %esi + lea 24(%ebp), %ecx + pushl %ecx + andl $-2147483648, %esi + call __dpml_unpack_x_or_y__ +..B7.16: + movl %edx, %ecx +..B7.2: + xorl %edx, %edx + subl %edx, %ecx + jge ..B7.6 +..B7.3: + movl 156(%esp), %ecx + movl %ecx, %edx + movl $2147418112, %eax + andl $2147418112, %edx + subl %eax, %edx + xorl %eax, %eax + orl %edx, %eax + movl 152(%esp), %edx + je ..B7.5 +..B7.4: + orl %esi, %ecx +..B7.5: + movl %edx, 152(%esp) + movl %ecx, 156(%esp) + jmp ..B7.11 +..B7.6: + movl $1, 4(%esp) + lea 60(%esp), %edx + xorl %ecx, %ecx + lea 108(%esp), %eax + movl %ecx, 8(%esp) + movl $2, 12(%esp) + movl %ecx, (%eax) + movl %ecx, 16(%esp) + call __dpml_ux_bessel__ +..B7.7: + xorl %esi, 60(%esp) + je ..B7.9 +..B7.8: + movl $24, %ecx + jmp ..B7.10 +..B7.9: + movl $16, %ecx +..B7.10: + movl $83886080, %esi + addl $28, %esp + shrl %cl, %esi + lea 4(%esp), %edx + andl $255, %esi + pushl %edx + pushl 4+__bessel_error_codes@GOTOFF(%ebx,%esi,8) + pushl __bessel_error_codes@GOTOFF(%ebx,%esi,8) + pushl 4+__bessel_error_codes@GOTOFF(%ebx) + pushl __bessel_error_codes@GOTOFF(%ebx) + lea 136(%esp), %edx + pushl %edx + lea 56(%esp), %edx + pushl %edx + call __dpml_pack__ +..B7.11: + movl 144(%esp), %edx + movl %edx, (%edi) + movl 148(%esp), %ecx + movl 152(%esp), %esi + movl 156(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 160(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B7.13 +..B7.12: + movl %edi, %eax + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B7.13: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __y1q,@function + .size __y1q,.-__y1q + .data +# -- End __y1q + .text +# -- Begin __ynq + .text + .align 16,0x90 + .globl __ynq +__ynq: +# parameter 1: 12 + %ebp +# parameter 2: 24 + %ebp +..B8.1: +..L17: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + movl 8(%ebp), %esi + movl %esi, 64(%esp) + movl 12(%ebp), %esi + movl %esi, %eax + cltd + movl %gs:20, %ecx + movl %edx, %ebx + xorl %esp, %ecx + movl %ecx, 160(%esp) + xorl %ecx, %ecx + movl 36(%ebp), %edi + subl %ecx, %edx + movl $1, 40(%esp) + movl %ecx, 44(%esp) + movl %ecx, 32(%esp) + movl %ecx, 36(%esp) + jge ..B8.3 +..B8.2: + movl %esi, %edx + xorl %esi, %esi + xorl $-2147483648, %edi + subl %edx, %esi + movl %ebx, %edx + movl %ecx, %ebx + sbbl %edx, %ebx +..B8.3: + movl %esi, %ecx + xorl %edx, %edx + andl $1, %ecx + orl %edx, %ecx + jne ..B8.6 +..B8.5: + xorl %edi, %edi +..B8.6: + movl $2, %ecx + movl %esi, %edx + andl $-2147483648, %edi + movl %ebx, %eax + subl %ecx, %edx + movl $0, %ecx + sbbl %ecx, %eax + jl ..B8.8 +..B8.24: + orl %eax, %edx + je ..B8.8 +..B8.7: + movl $2, %edx + jmp ..B8.9 +..B8.8: + movl %esi, %edx +..B8.9: + call ..L18 +..L18: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L18](%ecx), %ecx + addl $24, %esp + movl %ecx, 36(%esp) + lea 8(%esp), %eax + lea 40+__bessel_x_table@GOTOFF(%ecx,%edx,8), %edx + lea 92(%esp), %ecx + pushl %eax + lea 124(%esp), %eax + pushl %eax + pushl %edx + pushl %ecx + pushl $0 + lea 24(%ebp), %edx + pushl %edx + call __dpml_unpack_x_or_y__ +..B8.25: + movl %edx, %ecx +..B8.10: + xorl %edx, %edx + subl %edx, %ecx + jge ..B8.14 +..B8.11: + movl 156(%esp), %edx + movl %edx, %eax + movl $2147418112, %ebx + andl $2147418112, %eax + subl %ebx, %eax + xorl %esi, %esi + movl 152(%esp), %ecx + orl %eax, %esi + je ..B8.13 +..B8.12: + orl %edi, %edx +..B8.13: + movl %ecx, 152(%esp) + movl %edx, 156(%esp) + jmp ..B8.19 +..B8.14: + movl %esi, 4(%esp) + lea 68(%esp), %edx + movl %ebx, 8(%esp) + lea 116(%esp), %eax + movl $2, 12(%esp) + xorl %ecx, %ecx + movl %ecx, (%eax) + movl %ecx, 16(%esp) + call __dpml_ux_bessel__ +..B8.15: + xorl %edi, 68(%esp) + je ..B8.17 +..B8.16: + movl $24, %ecx + jmp ..B8.18 +..B8.17: + movl $16, %ecx +..B8.18: + addl $28, %esp + movl $117833728, %edx + shrl %cl, %edx + lea 4(%esp), %eax + pushl %eax + movzbl %dl, %edx + movl 28(%eax), %ebx + pushl 4+__bessel_error_codes@GOTOFF(%ebx,%edx,8) + pushl __bessel_error_codes@GOTOFF(%ebx,%edx,8) + pushl 4+__bessel_error_codes@GOTOFF(%ebx) + pushl __bessel_error_codes@GOTOFF(%ebx) + lea 136(%esp), %esi + pushl %esi + lea 64(%esp), %edi + pushl %edi + call __dpml_pack__ +..B8.19: + movl 64(%esp), %esi + movl 144(%esp), %eax + movl 148(%esp), %edx + movl 152(%esp), %ecx + movl 156(%esp), %ebx + movl %eax, (%esi) + movl %edx, 4(%esi) + movl %ecx, 8(%esi) + movl %ebx, 12(%esi) + movl 160(%esp), %edi + xorl %esp, %edi + cmpl %gs:20, %edi + jne ..B8.21 +..B8.20: + movl %esi, %eax + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B8.21: + movl 60(%esp), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type __ynq,@function + .size __ynq,.-__ynq + .data +# -- End __ynq + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.96: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.96,@object + .size .L_2il0floatpacket.96,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.97: + .byte 0x00,0xf0,0x25,0x8d,0xd1,0x3a,0xaa,0xb8,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.97,@object + .size .L_2il0floatpacket.97,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.98: + .byte 0x00,0xe0,0x96,0x4f,0xd2,0x1c,0xb2,0xe9,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.98,@object + .size .L_2il0floatpacket.98,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.99: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0d,0x40,0x00,0x00 + .type .L_2il0floatpacket.99,@object + .size .L_2il0floatpacket.99,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.100: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0xdc,0x80,0x0d,0xc0,0x00,0x00 + .type .L_2il0floatpacket.100,@object + .size .L_2il0floatpacket.100,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.101: + .byte 0x00,0x00,0x00,0x00,0x00,0xe2,0x95,0x8f,0x02,0x40,0x00,0x00 + .type .L_2il0floatpacket.101,@object + .size .L_2il0floatpacket.101,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.102: + .byte 0x00,0x00,0x00,0x00,0x00,0x91,0xdd,0xa3,0x03,0x40,0x00,0x00 + .type .L_2il0floatpacket.102,@object + .size .L_2il0floatpacket.102,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.103: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.103,@object + .size .L_2il0floatpacket.103,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.104: + .byte 0x00,0x00,0x00,0x00,0x00,0x3b,0xaa,0xb8,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.104,@object + .size .L_2il0floatpacket.104,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.105: + .byte 0x00,0x00,0x00,0x00,0x00,0xa9,0xe2,0xe6,0x05,0x40,0x00,0x00 + .type .L_2il0floatpacket.105,@object + .size .L_2il0floatpacket.105,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.106: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x01,0x40,0x00,0x00 + .type .L_2il0floatpacket.106,@object + .size .L_2il0floatpacket.106,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.107: + .byte 0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.107,@object + .size .L_2il0floatpacket.107,12 + .space 4, 0x00 # pad + .align 8 +__bessel_error_codes: + .long 0x00000000,0x00000000 + .long 0x00000081,0x00000000 + .long 0x00000082,0x00000000 + .long 0x00000083,0x00000000 + .long 0x00000084,0x00000000 + .long 0x0000008c,0x00000000 + .long 0x00000090,0x00000000 + .long 0x0000008f,0x00000000 + .type __bessel_error_codes,@object + .size __bessel_error_codes,64 + .align 4 +__bessel_x_table: + .long 4527112 + .long 882002208 + .long 4527112 + .long 609222656 + .long 4527112 + .long 340787200 + .long 0 + .long 0 + .long 2 + .long 0 + .long 2162758664 + .long 1056696334 + .long 15799304 + .long 796782607 + .long 2163807240 + .long 536868879 + .long 0 + .long 0 + .long 136 + .long 0 + .long 137 + .long 0 + .long 138 + .long 0 + .long 139 + .long 0 + .long 141 + .long 0 + .long 142 + .long 0 + .long 2943289511 + .long 514282869 + .long 12841452 + .long 4160750144 + .long 3101294049 + .long 2582161780 + .long 1312087176 + .long 1489306811 + .long 19644348 + .long 45583118 + .long 2057404378 + .long 3169098683 + .long 3035415578 + .long 893843444 + .long 337 + .long 0 + .long 1783633315 + .long 1777532950 + .long 15440 + .long 0 + .long 1098024042 + .long 3019602458 + .long 814258 + .long 0 + .long 225592541 + .long 3983311110 + .long 37212291 + .long 0 + .long 2852953733 + .long 2839658485 + .long 1458597808 + .long 0 + .long 4135355606 + .long 2153351721 + .long 1172250754 + .long 11 + .long 1418543880 + .long 1134849789 + .long 691229967 + .long 312 + .long 221999422 + .long 2942275987 + .long 892175906 + .long 7082 + .long 183528404 + .long 1091137495 + .long 33669418 + .long 128779 + .long 2062842702 + .long 3593466159 + .long 2350547321 + .long 1825862 + .long 3242024385 + .long 1732973365 + .long 1193716022 + .long 19485117 + .long 1037993584 + .long 3230003709 + .long 1091314384 + .long 149320065 + .long 865418991 + .long 2685299556 + .long 265703573 + .long 769292094 + .long 699915261 + .long 300027119 + .long 1754654657 + .long 2412548808 + .long 1339780591 + .long 830077839 + .long 3026944889 + .long 3889644321 + .long 4103150545 + .long 428322165 + .long 2828272473 + .long 2229721522 + .long 2 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 367384380 + .long 4326353 + .long 2148 + .long 0 + .long 3463681883 + .long 689773508 + .long 115915 + .long 0 + .long 1865635225 + .long 1707083401 + .long 5659280 + .long 0 + .long 57566505 + .long 2904667094 + .long 238211523 + .long 0 + .long 2506436672 + .long 4038967033 + .long 4242689712 + .long 1 + .long 900230770 + .long 2061385255 + .long 3485051853 + .long 59 + .long 3028033191 + .long 3312441247 + .long 2225862006 + .long 1485 + .long 2615755381 + .long 2826778077 + .long 1673380806 + .long 29835 + .long 355106258 + .long 2404984212 + .long 1016211595 + .long 472327 + .long 1503440334 + .long 2187913929 + .long 749248049 + .long 5704462 + .long 3147631426 + .long 2675016444 + .long 3447985920 + .long 50328354 + .long 3866449770 + .long 2131485908 + .long 579515915 + .long 305317757 + .long 1140039843 + .long 2720631446 + .long 456203296 + .long 1162742504 + .long 3233022265 + .long 2052397230 + .long 3523447208 + .long 2379802096 + .long 4168515076 + .long 4109278998 + .long 173166154 + .long 1854372776 + .long 2 + .long 0 + .long 1759813577 + .long 941616103 + .long 12816876 + .long 4227858976 + .long 1634871482 + .long 2963569369 + .long 683137648 + .long 2191944453 + .long 1580116130 + .long 3956925442 + .long 2076563715 + .long 714524096 + .long 1425042529 + .long 556010 + .long 0 + .long 0 + .long 2705967279 + .long 111702325 + .long 0 + .long 0 + .long 3713308765 + .long 3252247564 + .long 4 + .long 0 + .long 2100681787 + .long 1255672466 + .long 747 + .long 0 + .long 3619987580 + .long 2926178414 + .long 99420 + .long 0 + .long 2512861058 + .long 4217543322 + .long 11034432 + .long 0 + .long 2336326559 + .long 4282922616 + .long 1003296232 + .long 0 + .long 961767164 + .long 880412311 + .long 74952366 + .long 17 + .long 651638352 + .long 3978983768 + .long 3866178891 + .long 965 + .long 1596163871 + .long 1924711161 + .long 2529806704 + .long 41195 + .long 4143448985 + .long 965000726 + .long 2579935101 + .long 1257069 + .long 3252814079 + .long 2428688082 + .long 440599394 + .long 25575240 + .long 2037391762 + .long 3718324471 + .long 2593618161 + .long 310260222 + .long 3513168611 + .long 3970741434 + .long 128123702 + .long 1820672813 + .long 3402733470 + .long 3892867495 + .long 1270945360 + .long 2922852432 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1986947947 + .long 53265381 + .long 0 + .long 0 + .long 3270284272 + .long 1932314788 + .long 2 + .long 0 + .long 4084347788 + .long 3083682757 + .long 409 + .long 0 + .long 2552809164 + .long 4060325593 + .long 58254 + .long 0 + .long 3829133869 + .long 1310009699 + .long 6940915 + .long 0 + .long 3083277873 + .long 3078742755 + .long 680947971 + .long 0 + .long 3385783917 + .long 3611832980 + .long 2295622592 + .long 12 + .long 3171596108 + .long 2891115348 + .long 838843771 + .long 777 + .long 3771422218 + .long 1148182025 + .long 434950258 + .long 36482 + .long 393135174 + .long 80483983 + .long 3817092537 + .long 1235511 + .long 594123027 + .long 65162621 + .long 1218473398 + .long 28145623 + .long 3536617861 + .long 375824456 + .long 425129817 + .long 385237492 + .long 633237591 + .long 649365651 + .long 313906709 + .long 2545942344 + .long 873029334 + .long 423671385 + .long 1111949612 + .long 4235958077 + .long 4294967293 + .long 0 + .long 4159743234 + .long 1365459778 + .long 12825068 + .long 4227858976 + .long 1727418030 + .long 2322967398 + .long 1034782148 + .long 1761143608 + .long 748103118 + .long 681764742 + .long 1945985884 + .long 1037518188 + .long 2731139269 + .long 559058 + .long 0 + .long 0 + .long 3638286185 + .long 115784543 + .long 0 + .long 0 + .long 484918398 + .long 4013875548 + .long 4 + .long 0 + .long 868380236 + .long 106340102 + .long 775 + .long 0 + .long 3771022282 + .long 1666157217 + .long 103048 + .long 0 + .long 470645992 + .long 2100027425 + .long 11422638 + .long 0 + .long 1279250702 + .long 1788924811 + .long 1036227271 + .long 0 + .long 3067063928 + .long 3886781995 + .long 2181909072 + .long 17 + .long 103786080 + .long 119465851 + .long 1602069376 + .long 987 + .long 314091048 + .long 4120514941 + .long 1703984391 + .long 41665 + .long 3153492716 + .long 1769936992 + .long 3277791366 + .long 1248908 + .long 2480865882 + .long 357555572 + .long 1426486202 + .long 24641724 + .long 925215435 + .long 3875415602 + .long 2242310174 + .long 283170307 + .long 1206749920 + .long 1745236754 + .long 421850802 + .long 1512988987 + .long 554528472 + .long 4124376878 + .long 999726568 + .long 2331757501 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 844883384 + .long 48877615 + .long 0 + .long 0 + .long 613626429 + .long 1016694622 + .long 2 + .long 0 + .long 733791182 + .long 4037492605 + .long 370 + .long 0 + .long 2511602797 + .long 962949943 + .long 52209 + .long 0 + .long 2469661725 + .long 4226370589 + .long 6143972 + .long 0 + .long 2060721069 + .long 3581658067 + .long 593539814 + .long 0 + .long 2839602819 + .long 4222464368 + .long 3064291281 + .long 10 + .long 592311022 + .long 275206449 + .long 2221002398 + .long 647 + .long 3453980290 + .long 1100410175 + .long 2256369516 + .long 29367 + .long 965726650 + .long 341239821 + .long 1020304938 + .long 947922 + .long 2152956293 + .long 1358966229 + .long 796742083 + .long 20128900 + .long 2203770174 + .long 4010517667 + .long 1001215390 + .long 247246889 + .long 118635824 + .long 336180557 + .long 907042493 + .long 1379503488 + .long 1731363265 + .long 2376282645 + .long 3253758107 + .long 2155609720 + .long 4294967293 + .long 0 + .long 1133938837 + .long 1788275660 + .long 12816876 + .long 4227858976 + .long 328577348 + .long 3165265924 + .long 1527252342 + .long 1339392541 + .long 2394531985 + .long 243403399 + .long 1651082908 + .long 3768234999 + .long 1764410062 + .long 1127868 + .long 0 + .long 0 + .long 380965293 + .long 236501030 + .long 0 + .long 0 + .long 4057780011 + .long 296466121 + .long 10 + .long 0 + .long 1915520970 + .long 2413700929 + .long 1578 + .long 0 + .long 2515416277 + .long 1400529095 + .long 209346 + .long 0 + .long 1507502659 + .long 119133009 + .long 23121417 + .long 0 + .long 822245729 + .long 2123535665 + .long 2086838594 + .long 0 + .long 2761614169 + .long 2187408238 + .long 28089432 + .long 35 + .long 552668793 + .long 2572470762 + .long 825632309 + .long 1954 + .long 1089676525 + .long 4007660420 + .long 2284740089 + .long 81273 + .long 3790860620 + .long 4250011568 + .long 3911718864 + .long 2386138 + .long 1569325755 + .long 1413720016 + .long 751491568 + .long 45731817 + .long 955105128 + .long 1250521740 + .long 2097840313 + .long 506337017 + .long 1624392615 + .long 4258574603 + .long 3379569620 + .long 2624122564 + .long 4107144163 + .long 2368467334 + .long 1634973330 + .long 3993629493 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 818934838 + .long 89458952 + .long 0 + .long 0 + .long 1917175450 + .long 275918876 + .long 4 + .long 0 + .long 745599157 + .long 3172395316 + .long 667 + .long 0 + .long 2952822384 + .long 492051402 + .long 92937 + .long 0 + .long 2206545778 + .long 108664272 + .long 10789849 + .long 0 + .long 3593487476 + .long 2223761325 + .long 1025213015 + .long 0 + .long 4186460497 + .long 2115107000 + .long 546575231 + .long 18 + .long 4222869425 + .long 1697786641 + .long 1644425336 + .long 1067 + .long 2279245768 + .long 3297743944 + .long 144043411 + .long 46814 + .long 528690514 + .long 2305832912 + .long 3885610801 + .long 1446642 + .long 3948180674 + .long 1400240622 + .long 2848238597 + .long 29038477 + .long 365799999 + .long 3493109055 + .long 720503959 + .long 333431672 + .long 4157886487 + .long 4286999543 + .long 464978815 + .long 1767352013 + .long 3339500879 + .long 5789261 + .long 740497786 + .long 2709489262 + .long 4294967292 + .long 0 + .long 675685466 + .long 2210650544 + .long 12825068 + .long 4227858976 + .long 2475592912 + .long 4007987703 + .long 795233231 + .long 3544111414 + .long 3119445785 + .long 4019086602 + .long 1815298636 + .long 3651400695 + .long 250417896 + .long 1132895 + .long 0 + .long 0 + .long 1599660003 + .long 238893558 + .long 0 + .long 0 + .long 4178878964 + .long 640014589 + .long 10 + .long 0 + .long 3652653430 + .long 1664916825 + .long 1586 + .long 0 + .long 506609104 + .long 279824532 + .long 209578 + .long 0 + .long 3394823516 + .long 2710891899 + .long 23032181 + .long 0 + .long 1068742364 + .long 3396859346 + .long 2065409978 + .long 0 + .long 1532264156 + .long 1783373111 + .long 1537162281 + .long 34 + .long 3404313527 + .long 645034109 + .long 1238696626 + .long 1897 + .long 2815751506 + .long 1216048877 + .long 2381163022 + .long 77819 + .long 681356606 + .long 1742374831 + .long 1470157118 + .long 2245756 + .long 3583839604 + .long 3430133311 + .long 3428750273 + .long 42198880 + .long 2624104293 + .long 3836925937 + .long 2616934709 + .long 458497922 + .long 4091889117 + .long 2154475757 + .long 1334377092 + .long 2344404304 + .long 3811467832 + .long 4225344580 + .long 3014131639 + .long 3548440700 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2101683395 + .long 163038220 + .long 0 + .long 0 + .long 1150331703 + .long 1497034637 + .long 7 + .long 0 + .long 1295008257 + .long 2962522183 + .long 1195 + .long 0 + .long 193789761 + .long 1257830278 + .long 164530 + .long 0 + .long 3810960890 + .long 1878269909 + .long 18845080 + .long 0 + .long 2863024615 + .long 258783337 + .long 1761897164 + .long 0 + .long 2435461135 + .long 4254653612 + .long 2378780257 + .long 30 + .long 3635296493 + .long 4161741958 + .long 2074908190 + .long 1757 + .long 3250897880 + .long 2210089015 + .long 2132559608 + .long 74948 + .long 2166588251 + .long 3427170173 + .long 756319997 + .long 2241223 + .long 107629526 + .long 2814783011 + .long 580266263 + .long 43402774 + .long 2488417593 + .long 4037868436 + .long 2684236844 + .long 482393505 + .long 1636043988 + .long 2549915956 + .long 1055410979 + .long 2500896928 + .long 2063349270 + .long 3231350804 + .long 4156853657 + .long 3802515847 + .long 4294967291 + .long 0 + .long 191176124 + .long 2632795962 + .long 12816876 + .long 4227858976 + .long 1355787731 + .long 2425457148 + .long 539364904 + .long 1079897623 + .long 897043330 + .long 2066037045 + .long 1494461853 + .long 2159441332 + .long 2366379069 + .long 1131867 + .long 0 + .long 0 + .long 161545432 + .long 239220328 + .long 0 + .long 0 + .long 762722372 + .long 576200370 + .long 10 + .long 0 + .long 3468035492 + .long 1642011913 + .long 1578 + .long 0 + .long 4253764606 + .long 2733292311 + .long 207600 + .long 0 + .long 2811470101 + .long 3269311219 + .long 22691285 + .long 0 + .long 1825255966 + .long 1189284970 + .long 2021353589 + .long 0 + .long 717526141 + .long 2244953537 + .long 1522450794 + .long 33 + .long 693565287 + .long 2333767130 + .long 715945548 + .long 1824 + .long 2985180089 + .long 935432992 + .long 3298648348 + .long 73985 + .long 1392357808 + .long 2627674694 + .long 3107871798 + .long 2108973 + .long 3903806984 + .long 3473675411 + .long 4215247699 + .long 39146099 + .long 2236383345 + .long 2775867013 + .long 1051360344 + .long 420899965 + .long 715332657 + .long 3204539120 + .long 3177676604 + .long 2136936117 + .long 1567224951 + .long 2092241552 + .long 1304170706 + .long 3225156278 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3855812151 + .long 148081926 + .long 0 + .long 0 + .long 1028065361 + .long 2668697612 + .long 6 + .long 0 + .long 728439685 + .long 892227407 + .long 1067 + .long 0 + .long 615906957 + .long 1950415562 + .long 145255 + .long 0 + .long 3284206690 + .long 4202823521 + .long 16428718 + .long 0 + .long 1576659798 + .long 3860187404 + .long 1513740564 + .long 0 + .long 1223428711 + .long 1000755308 + .long 3492805977 + .long 25 + .long 1363712775 + .long 563079876 + .long 2891886022 + .long 1456 + .long 1912616499 + .long 4019273916 + .long 1170042322 + .long 60815 + .long 2578791056 + .long 3763338518 + .long 4013988507 + .long 1778302 + .long 596369036 + .long 4167829437 + .long 495223280 + .long 33706721 + .long 3069656582 + .long 1025646758 + .long 2029385299 + .long 368055588 + .long 4229256156 + .long 252497843 + .long 655863054 + .long 1886199584 + .long 3468886839 + .long 4222796798 + .long 2935312587 + .long 2855531945 + .long 4294967291 + .long 0 + .long 2797952740 + .long 3054806814 + .long 12825068 + .long 4227858976 + .long 2679935261 + .long 2846977675 + .long 1518593598 + .long 771365947 + .long 2901840529 + .long 102047653 + .long 404923885 + .long 709259131 + .long 475240934 + .long 1125214 + .long 0 + .long 0 + .long 1836195777 + .long 237921320 + .long 0 + .long 0 + .long 620715017 + .long 203920416 + .long 10 + .long 0 + .long 2730396855 + .long 4074598327 + .long 1558 + .long 0 + .long 149951721 + .long 1542475780 + .long 204126 + .long 0 + .long 895086698 + .long 26046181 + .long 22194201 + .long 0 + .long 1052098554 + .long 3499556639 + .long 1964976743 + .long 0 + .long 3912081837 + .long 3256319751 + .long 845978380 + .long 32 + .long 2103533506 + .long 1288917748 + .long 344362072 + .long 1747 + .long 586607141 + .long 2789855780 + .long 789521480 + .long 70264 + .long 1029756229 + .long 2597195099 + .long 1036923741 + .long 1985929 + .long 570319344 + .long 1441637551 + .long 3714173380 + .long 36574571 + .long 1955754200 + .long 3807195269 + .long 90410504 + .long 390763661 + .long 2874958444 + .long 3633243115 + .long 2931863300 + .long 1975635819 + .long 32243731 + .long 2591757144 + .long 3895319176 + .long 2976685396 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3502958424 + .long 134252990 + .long 0 + .long 0 + .long 2150545646 + .long 4111632521 + .long 5 + .long 0 + .long 2999463670 + .long 3120574364 + .long 951 + .long 0 + .long 681502082 + .long 4195687681 + .long 128253 + .long 0 + .long 442998991 + .long 979480158 + .long 14344565 + .long 0 + .long 151969242 + .long 4070078334 + .long 1305331397 + .long 0 + .long 1826390155 + .long 1249420678 + .long 4104872299 + .long 21 + .long 1355768955 + .long 3758834208 + .long 3412700795 + .long 1220 + .long 1644384830 + .long 2135273975 + .long 2887874099 + .long 50190 + .long 1150050798 + .long 2243957583 + .long 2798432622 + .long 1445747 + .long 3460890697 + .long 2393108922 + .long 2317365582 + .long 27037249 + .long 135336093 + .long 93459488 + .long 4047224670 + .long 292116325 + .long 2632066877 + .long 2478679361 + .long 3592211274 + .long 1486901023 + .long 4259160346 + .long 2383522946 + .long 1229950112 + .long 2245322564 + .long 4294967291 + .long 0 + .long 4131724546 + .long 247119503 + .long 229390 + .long 4227858728 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1920268374 + .long 676671 + .long 0 + .long 0 + .long 2648589321 + .long 145893005 + .long 0 + .long 0 + .long 86363579 + .long 792199897 + .long 6 + .long 0 + .long 3569661012 + .long 3338031321 + .long 964 + .long 0 + .long 3537357668 + .long 2546852361 + .long 127350 + .long 0 + .long 1674639321 + .long 989707703 + .long 14008565 + .long 0 + .long 633069455 + .long 3178427980 + .long 1260770870 + .long 0 + .long 2929308222 + .long 1214878390 + .long 581189477 + .long 21 + .long 3037977477 + .long 3608983388 + .long 2481839655 + .long 1183 + .long 1571270935 + .long 1253493999 + .long 1158050441 + .long 49710 + .long 2588063047 + .long 3245086386 + .long 381774870 + .long 1491308 + .long 2638540175 + .long 477218587 + .long 3340530119 + .long 29826161 + .long 1326835123 + .long 1431655765 + .long 1431655765 + .long 357913941 + .long 4293747565 + .long 4294967295 + .long 4294967295 + .long 2147483647 + .long 4294964933 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 105434711 + .long 715574136 + .long 12825068 + .long 4227858976 + .long 2071479615 + .long 4114262957 + .long 3040350773 + .long 3578447305 + .long 1647168078 + .long 978698920 + .long 1144287138 + .long 3827795094 + .long 3787403973 + .long 562609 + .long 0 + .long 0 + .long 1649578671 + .long 117913179 + .long 0 + .long 0 + .long 3082368152 + .long 40122077 + .long 5 + .long 0 + .long 602895375 + .long 3952322020 + .long 783 + .long 0 + .long 3838465116 + .long 2181233212 + .long 103846 + .long 0 + .long 851468155 + .long 4001763569 + .long 11469451 + .long 0 + .long 3659498813 + .long 523695164 + .long 1037041443 + .long 0 + .long 2978199351 + .long 773277203 + .long 2051066178 + .long 17 + .long 4092624060 + .long 3930860161 + .long 3294762475 + .long 984 + .long 1105652893 + .long 1066438988 + .long 3642064414 + .long 41652 + .long 2196971596 + .long 2146191353 + .long 3442355222 + .long 1259557 + .long 3918894073 + .long 188553237 + .long 818155667 + .long 25403502 + .long 852571760 + .long 3121326526 + .long 2509267963 + .long 306918409 + .long 2896427178 + .long 2552665716 + .long 2229539464 + .long 1835168886 + .long 1453277625 + .long 518768794 + .long 1711011538 + .long 3459676865 + .long 0 + .long 0 + .long 2062472710 + .long 69166 + .long 0 + .long 0 + .long 673615662 + .long 23833985 + .long 0 + .long 0 + .long 630248642 + .long 363685088 + .long 1 + .long 0 + .long 288759411 + .long 2697305718 + .long 181 + .long 0 + .long 2130785052 + .long 823708847 + .long 25870 + .long 0 + .long 1430316470 + .long 3023974030 + .long 3089586 + .long 0 + .long 3827036731 + .long 3302510044 + .long 304068797 + .long 0 + .long 3738696708 + .long 3274114857 + .long 2670490624 + .long 5 + .long 287265850 + .long 4109473262 + .long 3360573366 + .long 350 + .long 38249035 + .long 2812769293 + .long 2052670485 + .long 16622 + .long 3926290357 + .long 206759826 + .long 2443135158 + .long 571444 + .long 1809246839 + .long 3759763742 + .long 1694050886 + .long 13356266 + .long 1847069514 + .long 3357213528 + .long 2594247192 + .long 192045418 + .long 1427481913 + .long 3504276391 + .long 3430325004 + .long 1423790384 + .long 900295939 + .long 3843660490 + .long 2372410664 + .long 3611630842 + .long 4294967294 + .long 0 + .long 774013863 + .long 1145724988 + .long 12816876 + .long 4227858976 + .long 2744287014 + .long 3766464413 + .long 1053213460 + .long 3969062622 + .long 1083456455 + .long 3049621789 + .long 3365086587 + .long 561540346 + .long 2996396832 + .long 575091 + .long 0 + .long 0 + .long 42660608 + .long 117761546 + .long 0 + .long 0 + .long 3056183536 + .long 25400137 + .long 5 + .long 0 + .long 3539354956 + .long 964064098 + .long 784 + .long 0 + .long 1133846550 + .long 3354628177 + .long 103987 + .long 0 + .long 837408368 + .long 1875825334 + .long 11493772 + .long 0 + .long 4020356818 + .long 15105701 + .long 1039623118 + .long 0 + .long 2432213228 + .long 4116600081 + .long 2213395342 + .long 17 + .long 346536517 + .long 2329406249 + .long 1562759336 + .long 985 + .long 1904777685 + .long 777730941 + .long 3468653957 + .long 41521 + .long 2565172885 + .long 3392131685 + .long 216627896 + .long 1245806 + .long 777484384 + .long 1373172746 + .long 529073424 + .long 24734325 + .long 1189796029 + .long 1140288371 + .long 1770133260 + .long 289389693 + .long 2194668596 + .long 3631308278 + .long 3147219318 + .long 1613893367 + .long 344927104 + .long 1168140252 + .long 980702046 + .long 2577974684 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1881749350 + .long 46062706 + .long 0 + .long 0 + .long 2009952654 + .long 475434148 + .long 2 + .long 0 + .long 3595153284 + .long 3894518978 + .long 350 + .long 0 + .long 1401741016 + .long 800557075 + .long 49546 + .long 0 + .long 1250374609 + .long 1417939249 + .long 5854570 + .long 0 + .long 3066837935 + .long 3745800702 + .long 568662855 + .long 0 + .long 4187727968 + .long 1730013373 + .long 1461665574 + .long 10 + .long 3341641980 + .long 2588791038 + .long 1829968615 + .long 631 + .long 888818201 + .long 3523374130 + .long 852659386 + .long 29067 + .long 3905449900 + .long 720793762 + .long 1836357526 + .long 959598 + .long 711023215 + .long 2187868163 + .long 363719992 + .long 21124528 + .long 3782390642 + .long 1386816912 + .long 3690959132 + .long 275994811 + .long 3562870039 + .long 2887822114 + .long 2407074109 + .long 1720896075 + .long 723327461 + .long 1298307143 + .long 454424891 + .long 2939711024 + .long 4294967293 + .long 0 + .long 4220957082 + .long 1571153381 + .long 12825068 + .long 4227858976 + .long 4024519172 + .long 2730919557 + .long 1456036120 + .long 3256132268 + .long 2931624203 + .long 1339507405 + .long 1357793012 + .long 1094045067 + .long 1129712150 + .long 1138961 + .long 0 + .long 0 + .long 2372829177 + .long 237557530 + .long 0 + .long 0 + .long 534122416 + .long 423932365 + .long 10 + .long 0 + .long 4247263216 + .long 4283734547 + .long 1580 + .long 0 + .long 2387955306 + .long 607897802 + .long 209396 + .long 0 + .long 2812500241 + .long 994269493 + .long 23101510 + .long 0 + .long 3000333735 + .long 388858992 + .long 2083539857 + .long 0 + .long 1161363350 + .long 3153424268 + .long 4076649817 + .long 34 + .long 1819801357 + .long 1812729011 + .long 330148996 + .long 1953 + .long 3163500019 + .long 3864465446 + .long 4064814974 + .long 81467 + .long 3858761013 + .long 3692736596 + .long 1902533809 + .long 2406436 + .long 3293643408 + .long 375345917 + .long 2826147377 + .long 46631566 + .long 4164807482 + .long 4162856869 + .long 2610851470 + .long 525451848 + .long 2048614181 + .long 1569367797 + .long 3543942876 + .long 2777034414 + .long 3312093651 + .long 708453697 + .long 1978042629 + .long 4289897122 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2071065822 + .long 86614531 + .long 0 + .long 0 + .long 2391713785 + .long 4060239028 + .long 3 + .long 0 + .long 4029056008 + .long 1846783416 + .long 650 + .long 0 + .long 161647879 + .long 3413412248 + .long 90917 + .long 0 + .long 436274283 + .long 2466277660 + .long 10613189 + .long 0 + .long 671943584 + .long 553150431 + .long 1015563947 + .long 0 + .long 1753238306 + .long 1517906611 + .long 532738342 + .long 18 + .long 618689867 + .long 596492050 + .long 2460930076 + .long 1080 + .long 414131426 + .long 1367052230 + .long 3308909536 + .long 48209 + .long 4126473295 + .long 3381931776 + .long 1805298000 + .long 1525871 + .long 636148702 + .long 2186154781 + .long 2942928489 + .long 31683165 + .long 999999630 + .long 4126401816 + .long 259460410 + .long 380946890 + .long 231980038 + .long 363549591 + .long 883055596 + .long 2118559672 + .long 3622330114 + .long 1609129610 + .long 63100786 + .long 3373399958 + .long 4294967292 + .long 0 + .long 1588683414 + .long 1994957096 + .long 12816876 + .long 4227858976 + .long 2267877675 + .long 3576551320 + .long 1765045200 + .long 3464483214 + .long 1351689592 + .long 3801296041 + .long 352384788 + .long 331703635 + .long 605298272 + .long 1136492 + .long 0 + .long 0 + .long 2681104739 + .long 238950871 + .long 0 + .long 0 + .long 3149807504 + .long 621710226 + .long 10 + .long 0 + .long 2595166296 + .long 121246070 + .long 1585 + .long 0 + .long 2215012362 + .long 2482367452 + .long 209363 + .long 0 + .long 470943915 + .long 668008525 + .long 23014074 + .long 0 + .long 3763658407 + .long 3343124614 + .long 2065508072 + .long 0 + .long 249623666 + .long 2390602642 + .long 1795904366 + .long 34 + .long 1346725057 + .long 2927659279 + .long 1029310809 + .long 1906 + .long 3831989490 + .long 3024162362 + .long 457912312 + .long 78555 + .long 1623643704 + .long 979247650 + .long 4029398248 + .long 2282874 + .long 2791098952 + .long 2391841680 + .long 2696257895 + .long 43306505 + .long 262637107 + .long 3763159487 + .long 2938992385 + .long 475778611 + .long 3299175406 + .long 3677201670 + .long 2349553020 + .long 2458659840 + .long 206020084 + .long 2363120772 + .long 2638136209 + .long 3751386051 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3034634732 + .long 80259059 + .long 0 + .long 0 + .long 2987375659 + .long 2703374687 + .long 3 + .long 0 + .long 1215607278 + .long 4163686255 + .long 592 + .long 0 + .long 781938720 + .long 2086477677 + .long 82005 + .long 0 + .long 3556471813 + .long 3031971904 + .long 9451560 + .long 0 + .long 2005655437 + .long 2494233436 + .long 890598760 + .long 0 + .long 1167836918 + .long 114850616 + .long 2568442225 + .long 15 + .long 2351511177 + .long 1547877599 + .long 2724662709 + .long 908 + .long 1583056039 + .long 1830443712 + .long 1719394286 + .long 39382 + .long 1124627201 + .long 674092017 + .long 1868383046 + .long 1202161 + .long 4262245498 + .long 1815295967 + .long 3756878985 + .long 23872494 + .long 1013133814 + .long 1390137141 + .long 1845508344 + .long 272711216 + .long 2632746813 + .long 493954138 + .long 4257964097 + .long 1450886530 + .long 1659393003 + .long 4235627183 + .long 3605632322 + .long 2252460395 + .long 4294967292 + .long 0 + .long 1932081087 + .long 2418003218 + .long 12825068 + .long 4227858976 + .long 675685466 + .long 2210650544 + .long 2635457388 + .long 3001216681 + .long 2383987892 + .long 1958452314 + .long 200318573 + .long 1670080688 + .long 1772035109 + .long 1132935 + .long 0 + .long 0 + .long 2224132738 + .long 239067824 + .long 0 + .long 0 + .long 2504702558 + .long 548466910 + .long 10 + .long 0 + .long 120798343 + .long 3554901277 + .long 1577 + .long 0 + .long 2434954499 + .long 1660365081 + .long 207659 + .long 0 + .long 2744534538 + .long 1767005024 + .long 22722744 + .long 0 + .long 1354085614 + .long 573653951 + .long 2027648348 + .long 0 + .long 2302238895 + .long 940817979 + .long 2333007942 + .long 33 + .long 4044378246 + .long 2424318367 + .long 54614345 + .long 1841 + .long 3277428544 + .long 937510890 + .long 2353849014 + .long 75024 + .long 4005612974 + .long 1580435742 + .long 1601652905 + .long 2151432 + .long 3782038889 + .long 2892349902 + .long 3709353570 + .long 40211969 + .long 2209533886 + .long 1632935844 + .long 1972351296 + .long 435469920 + .long 2489865929 + .long 3249608891 + .long 2176055770 + .long 2225282526 + .long 4163770951 + .long 1426482641 + .long 75146285 + .long 3375249381 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2220915002 + .long 147504303 + .long 0 + .long 0 + .long 3383683424 + .long 2662024159 + .long 6 + .long 0 + .long 4203741875 + .long 3065385408 + .long 1071 + .long 0 + .long 94574798 + .long 3694012699 + .long 146649 + .long 0 + .long 548197575 + .long 3705365680 + .long 16693691 + .long 0 + .long 2971661595 + .long 3995690294 + .long 1550219778 + .long 0 + .long 3364157924 + .long 536970539 + .long 2951498969 + .long 26 + .long 3606982515 + .long 2998613798 + .long 1572386296 + .long 1523 + .long 54159713 + .long 2382254602 + .long 1960159626 + .long 64476 + .long 164299812 + .long 2501105432 + .long 2657580848 + .long 1915496 + .long 4191466314 + .long 1475491836 + .long 409725690 + .long 36942237 + .long 2000214888 + .long 3808326374 + .long 4191271566 + .long 410491162 + .long 3021924263 + .long 3759042010 + .long 567945948 + .long 2137524835 + .long 2922089864 + .long 3203830329 + .long 752382353 + .long 3278805360 + .long 4294967291 + .long 0 + .long 223335381 + .long 2840633637 + .long 12816876 + .long 4227858976 + .long 191176124 + .long 2632795962 + .long 792829484 + .long 4194095148 + .long 1561179743 + .long 586327156 + .long 2807878837 + .long 3545818423 + .long 1415596998 + .long 1125924 + .long 0 + .long 0 + .long 2335397241 + .long 237899312 + .long 0 + .long 0 + .long 898966976 + .long 220219689 + .long 10 + .long 0 + .long 3140042207 + .long 3171383055 + .long 1560 + .long 0 + .long 2021920923 + .long 1061467961 + .long 204590 + .long 0 + .long 1780915469 + .long 3394528573 + .long 22279398 + .long 0 + .long 2938289575 + .long 3726010345 + .long 1976658045 + .long 0 + .long 1742882295 + .long 3191343047 + .long 2047550512 + .long 32 + .long 3647296052 + .long 2253947992 + .long 1300129447 + .long 1768 + .long 2864334604 + .long 1571083743 + .long 2473956825 + .long 71411 + .long 902177211 + .long 1309134586 + .long 1494319522 + .long 2027873 + .long 1978202312 + .long 2898857432 + .long 1838265108 + .long 37534288 + .long 440015974 + .long 4230775195 + .long 1255344562 + .long 402981746 + .long 1205443830 + .long 4140044432 + .long 3282462476 + .long 2046231097 + .long 2809323527 + .long 1074462473 + .long 1051546203 + .long 3093465233 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1994591040 + .long 134874738 + .long 0 + .long 0 + .long 1154796671 + .long 33466848 + .long 6 + .long 0 + .long 944609558 + .long 611410016 + .long 964 + .long 0 + .long 3394269576 + .long 3253723903 + .long 130617 + .long 0 + .long 1604599336 + .long 2571734283 + .long 14700043 + .long 0 + .long 2720136884 + .long 1760790051 + .long 1347449133 + .long 0 + .long 3340661604 + .long 3195040324 + .long 3680379603 + .long 22 + .long 3451695816 + .long 2081337828 + .long 1427065647 + .long 1283 + .long 2755833528 + .long 3578899323 + .long 1127406403 + .long 53342 + .long 2103438216 + .long 2925829331 + .long 133275521 + .long 1554875 + .long 3003940918 + .long 1302060887 + .long 2008749614 + .long 29436400 + .long 4279932662 + .long 1473928468 + .long 533396292 + .long 321840330 + .long 3248261436 + .long 2035472962 + .long 372258839 + .long 1655927148 + .long 3127294521 + .long 3128066919 + .long 2865156314 + .long 2523236171 + .long 4294967291 + .long 0 + .long 1890690921 + .long 3263011055 + .long 12825068 + .long 4227858976 + .long 2797952740 + .long 3054806814 + .long 1894667006 + .long 214237447 + .long 1296756846 + .long 4060330468 + .long 1098085821 + .long 3604642180 + .long 1726893371 + .long 1115219 + .long 0 + .long 0 + .long 494710856 + .long 235638241 + .long 0 + .long 0 + .long 1193585816 + .long 3981686648 + .long 9 + .long 0 + .long 143797405 + .long 762868814 + .long 1536 + .long 0 + .long 898881458 + .long 2220674218 + .long 200569 + .long 0 + .long 271788931 + .long 1836576498 + .long 21741122 + .long 0 + .long 3732597210 + .long 2567748600 + .long 1918751890 + .long 0 + .long 3683010637 + .long 2674911154 + .long 1453366689 + .long 31 + .long 3314792629 + .long 3590832641 + .long 792084225 + .long 1695 + .long 710884882 + .long 1421882797 + .long 453673326 + .long 67984 + .long 4289998525 + .long 1545801705 + .long 2082770245 + .long 1917055 + .long 1427259630 + .long 3087470940 + .long 1747456958 + .long 35251400 + .long 2597591904 + .long 3049486553 + .long 2056710479 + .long 376393410 + .long 2213091204 + .long 2641098163 + .long 3971809407 + .long 1903717223 + .long 3244722564 + .long 177715146 + .long 3090222263 + .long 2872209565 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 4193727727 + .long 246007177 + .long 0 + .long 0 + .long 768822418 + .long 3782320021 + .long 10 + .long 0 + .long 2196079823 + .long 201893182 + .long 1732 + .long 0 + .long 1661061158 + .long 4260475543 + .long 232537 + .long 0 + .long 3959757821 + .long 1648015928 + .long 25908825 + .long 0 + .long 2136418328 + .long 2790862444 + .long 2348699355 + .long 0 + .long 14984150 + .long 3359899422 + .long 1557173094 + .long 39 + .long 2579163115 + .long 4209094591 + .long 2975956643 + .long 2181 + .long 809874233 + .long 1287653529 + .long 1784169535 + .long 89477 + .long 836980350 + .long 209256478 + .long 3015626027 + .long 2573945 + .long 2016221741 + .long 1745099515 + .long 1018088912 + .long 48139690 + .long 3329474215 + .long 1010710723 + .long 642962579 + .long 521003091 + .long 801578433 + .long 3224757113 + .long 3341503980 + .long 2660978634 + .long 2199935228 + .long 4052003304 + .long 2221814426 + .long 4038241008 + .long 4294967290 + .long 0 + .long 3178730751 + .long 116147812 + .long 14854636 + .long 416 + .long 416371481 + .long 2823641499 + .long 2506915568 + .long 4124207639 + .long 950494682 + .long 256731865 + .long 619428904 + .long 3037288495 + .long 4208811624 + .long 884105690 + .long 0 + .long 0 + .long 3410106176 + .long 4245208708 + .long 126 + .long 0 + .long 3116091236 + .long 3070791485 + .long 44137 + .long 0 + .long 1379902983 + .long 2256834745 + .long 12232777 + .long 0 + .long 2097914520 + .long 545273602 + .long 2619411277 + .long 0 + .long 215423817 + .long 3507318412 + .long 256238311 + .long 97 + .long 3668117219 + .long 4022295396 + .long 2420542464 + .long 10890 + .long 3822143167 + .long 3930114069 + .long 1325150521 + .long 798528 + .long 3699121161 + .long 791807715 + .long 67391017 + .long 33958538 + .long 3257898816 + .long 678025854 + .long 1894699409 + .long 674718922 + .long 1201340557 + .long 2594901103 + .long 3933905415 + .long 3704843775 + .long 4294967294 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 982743186 + .long 1840382683 + .long 8 + .long 0 + .long 2770471380 + .long 1232287742 + .long 3186 + .long 0 + .long 2689925901 + .long 4291161637 + .long 993651 + .long 0 + .long 1865452386 + .long 278667130 + .long 243198017 + .long 0 + .long 941914362 + .long 1579381843 + .long 2208801237 + .long 10 + .long 4030005343 + .long 1439537596 + .long 2913266490 + .long 1415 + .long 897709932 + .long 2611261457 + .long 3831192043 + .long 129715 + .long 2599986828 + .long 562288571 + .long 873738186 + .long 7347842 + .long 1676792497 + .long 2643238970 + .long 1059645264 + .long 218261805 + .long 3968061936 + .long 1814410518 + .long 4215318874 + .long 2360677848 + .long 4294967294 + .long 0 + .long 1965065697 + .long 125333813 + .long 29671681 + .long 368 + .long 2696892906 + .long 3837883846 + .long 4163818448 + .long 2636579655 + .long 352076257 + .long 2995873374 + .long 2356022824 + .long 2864685933 + .long 507647155 + .long 87534215 + .long 364999993 + .long 2297262027 + .long 3804603314 + .long 421232362 + .long 623004025 + .long 2436698064 + .long 857209363 + .long 4104727312 + .long 1300779075 + .long 2300222395 + .long 3549420260 + .long 815695431 + .long 3490474032 + .long 2175015012 + .long 273829883 + .long 837019448 + .long 1150859439 + .long 4129001094 + .long 166114890 + .long 262582295 + .long 2200440235 + .long 3934411649 + .long 4260765987 + .long 1496016656 + .long 613554758 + .long 3765455772 + .long 1537995402 + .long 3112915065 + .long 3831973801 + .long 3621881222 + .long 371259347 + .long 563988192 + .long 2577068580 + .long 3504039397 + .long 3892719810 + .long 2774136061 + .long 761863973 + .long 3413069278 + .long 932429307 + .long 3533847854 + .long 670352073 + .long 3351189942 + .long 332608650 + .long 3102655069 + .long 2958547113 + .long 3322177573 + .long 146996155 + .long 3411645617 + .long 2215850181 + .long 3332037184 + .long 590982538 + .long 2197714658 + .long 1764878165 + .long 3390200984 + .long 952267699 + .long 417090737 + .long 3487943763 + .long 3519763458 + .long 1338819266 + .long 2605877443 + .long 347561299 + .long 3761505334 + .long 3379093939 + .long 2405540353 + .long 1506019226 + .long 3884741458 + .long 2785505456 + .long 3086386584 + .long 2046080941 + .long 3789068741 + .long 1518238185 + .long 1088338119 + .long 1804079185 + .long 4226925859 + .long 2303172266 + .long 2741263628 + .long 633622237 + .long 3777083586 + .long 3757196004 + .long 294895316 + .long 27640459 + .long 432 + .long 2828420652 + .long 3361833042 + .long 1412248364 + .long 2211183849 + .long 0 + .long 3547577142 + .long 1 + .long 0 + .long 2851890648 + .long 450899591 + .long 287024625 + .long 4159553752 + .long 3788600515 + .long 2561792324 + .long 3962766183 + .long 3512577319 + .long 2861699545 + .long 2196522185 + .long 1554209519 + .long 4198958626 + .long 3194489346 + .long 2786967510 + .long 3304318871 + .long 3344542374 + .long 4105608152 + .long 867728568 + .long 2708443992 + .long 3505223656 + .long 1032912387 + .long 3711167273 + .long 1214238009 + .long 2611213035 + .long 3368625691 + .long 5584441 + .long 2611408711 + .long 2384597091 + .long 1152098306 + .long 3591611965 + .long 2962228819 + .long 3281323244 + .long 3071980506 + .long 3920864562 + .long 3855393805 + .long 2582452787 + .long 3343479107 + .long 1168797990 + .long 3053975971 + .long 3222544278 + .long 3909139483 + .long 1083468961 + .long 2101774947 + .long 2160722632 + .long 2110801092 + .long 4019214560 + .long 1350065479 + .long 2376260138 + .long 42240602 + .long 3769900699 + .long 2854857645 + .long 2686999005 + .long 4198697477 + .long 4081736268 + .long 2846299562 + .long 2478988733 + .long 427675101 + .long 2445602520 + .long 4233423029 + .long 2355264427 + .long 1558515652 + .long 2279564152 + .long 62666641 + .long 3298296210 + .long 1417642332 + .long 61859471 + .long 2115062510 + .long 2696409612 + .long 326492679 + .long 2534854374 + .long 1679925266 + .long 2160906787 + .long 3251033635 + .long 2671487866 + .long 2862247032 + .long 3574405396 + .long 3009660033 + .long 339349497 + .long 3007548001 + .long 2840034127 + .long 2252903388 + .long 1330394071 + .long 2157393054 + .long 2200692478 + .long 621144332 + .long 3987984878 + .long 1728372573 + .long 3841939891 + .long 2649374871 + .long 2008708732 + .long 1354882191 + .long 2904204888 + .long 3398077461 + .long 3906455313 + .long 2501808239 + .long 2340852904 + .long 257973487 + .long 728759453 + .long 30163463 + .long 848 + .long 3266633231 + .long 4249524844 + .long 2065907802 + .long 2501410748 + .long 2077120351 + .long 1559182036 + .long 2148606178 + .long 4119882265 + .long 315045067 + .long 14812806 + .long 1274331647 + .long 3156365682 + .long 238086315 + .long 2517423111 + .long 2041601736 + .long 2711078025 + .long 3652406632 + .long 753691269 + .long 2734041400 + .long 3820625006 + .long 2380832782 + .long 158270193 + .long 2340065183 + .long 2273321385 + .long 393890025 + .long 2894667190 + .long 1573700686 + .long 4092887025 + .long 464562897 + .long 303515614 + .long 3848216904 + .long 3328255744 + .long 1036006886 + .long 2121885428 + .long 3704818897 + .long 3211297370 + .long 1325824312 + .long 3493125121 + .long 3338748802 + .long 3232443331 + .long 3112594497 + .long 3307298736 + .long 2809691794 + .long 3731360010 + .long 3573632495 + .long 2312925567 + .long 629450595 + .long 3622381915 + .long 989010185 + .long 3398558103 + .long 4153621291 + .long 3607201927 + .long 2629100272 + .long 1953994464 + .long 1943384301 + .long 2759420002 + .long 2305022315 + .long 2391039855 + .long 612094863 + .long 3951603967 + .long 1340433416 + .long 3334026995 + .long 1491763737 + .long 4186248678 + .long 4198464715 + .long 87224683 + .long 4220145159 + .long 3881216024 + .long 2007772778 + .long 1722917095 + .long 2388984076 + .long 3799859053 + .long 732951595 + .long 3919415462 + .long 528829945 + .long 3610037081 + .long 3992395594 + .long 4037851002 + .long 1844118200 + .long 3714769074 + .long 3432638667 + .long 3108186388 + .long 746542694 + .long 3818486016 + .long 557823754 + .long 2427510280 + .long 3516120961 + .long 3892142094 + .long 1703329579 + .long 996501429 + .long 4081661750 + .long 3974028169 + .long 480847786 + .long 3006112619 + .long 1403431905 + .long 4065364793 + .long 1900483787 + .long 2649330773 + .long 651669812 + .long 4162988739 + .long 1619173352 + .long 1864819711 + .long 1131374484 + .long 4267744761 + .long 1834860043 + .long 2423625113 + .long 288099716 + .long 2190363742 + .long 2708503338 + .long 4126097102 + .long 3654529011 + .long 2251412339 + .long 3753107947 + .long 3496449780 + .long 2610603179 + .long 2317533940 + .long 3862344650 + .long 1030964414 + .long 451338797 + .long 2389337002 + .long 2524196363 + .long 569491811 + .long 2946926522 + .long 2467527406 + .long 196512138 + .long 497579000 + .long 2195809742 + .long 2552928386 + .long 1662952651 + .long 780129586 + .long 2880189481 + .long 2646511583 + .long 1545658730 + .long 789982365 + .long 191310475 + .long 2749424166 + .long 1470909419 + .long 1234100077 + .long 2044585165 + .long 2862876216 + .long 928663178 + .long 2102054363 + .long 3690288476 + .long 2988326180 + .long 2216922123 + .long 2305139484 + .long 4174545259 + .long 3130608048 + .long 1755153610 + .long 918723953 + .long 2738745609 + .long 3294047809 + .long 721728203 + .long 1773737866 + .long 4101484425 + .long 3433511350 + .long 1857351114 + .long 2879235855 + .long 1363799643 + .long 3536910801 + .long 4061718601 + .long 908917583 + .long 3005712244 + .long 4215915540 + .long 243897838 + .long 7660553 + .long 2731769662 + .long 2727825412 + .long 1695068807 + .long 2615038300 + .long 234665196 + .long 3149409338 + .long 2025012071 + .long 1264893574 + .long 1155162898 + .long 2643506208 + .long 3781832745 + .long 2126832235 + .long 1395780981 + .long 2754722035 + .long 4274723882 + .long 199777100 + .long 1853759306 + .long 3583381494 + .long 3072425958 + .long 993425135 + .long 3004341385 + .long 3435215656 + .long 3198694093 + .long 620059688 + .long 2085750463 + .long 2400804391 + .long 1026440073 + .long 2116228661 + .long 3422860059 + .long 3767238370 + .long 376557070 + .long 669608662 + .long 2826299222 + .long 4021726431 + .long 97861608 + .long 623049618 + .long 457143492 + .long 3494791496 + .long 647336461 + .long 20390326 + .long 156262610 + .long 3457815221 + .long 2242302115 + .long 1153736377 + .long 29917573 + .long 608 + .long 956831540 + .long 3804294695 + .long 1233656524 + .long 1169011973 + .long 3512247603 + .long 731707668 + .long 3804813427 + .long 3532496868 + .long 3861713254 + .long 3920998321 + .long 3249242362 + .long 2983748142 + .long 4254521127 + .long 3419828215 + .long 3612752470 + .long 3427243214 + .long 1865130836 + .long 1528519591 + .long 3104638828 + .long 2778394947 + .long 2428343797 + .long 2183879732 + .long 1050296790 + .long 3773933110 + .long 3652345540 + .long 2906583603 + .long 1426288469 + .long 3900013225 + .long 3885984869 + .long 2566242072 + .long 2597085889 + .long 3387828672 + .long 3402407620 + .long 2004411987 + .long 1378225957 + .long 3062031935 + .long 3648787989 + .long 92338370 + .long 4236899602 + .long 2817389734 + .long 1952242004 + .long 2304097414 + .long 127945474 + .long 2582972800 + .long 4281889637 + .long 2697225196 + .long 2199799063 + .long 2368525439 + .long 2882311446 + .long 2124741744 + .long 2454581530 + .long 2175676414 + .long 1363442533 + .long 235950345 + .long 3278607019 + .long 3991475143 + .long 2338347060 + .long 892652237 + .long 3886541672 + .long 3654822706 + .long 2206999749 + .long 359442761 + .long 1344250324 + .long 3448127457 + .long 2316542980 + .long 3829127353 + .long 220674587 + .long 3338303659 + .long 280815351 + .long 3269930602 + .long 4246425196 + .long 2475208849 + .long 3336161088 + .long 2206265573 + .long 1212344344 + .long 2473891454 + .long 491190659 + .long 2156317952 + .long 2981239741 + .long 2515194909 + .long 3609278228 + .long 1234146757 + .long 1026744012 + .long 2624029530 + .long 2704274272 + .long 1975162568 + .long 3276945619 + .long 2578639571 + .long 1034382165 + .long 2590969465 + .long 713762072 + .long 2201806508 + .long 4228198051 + .long 3980119693 + .long 4056525840 + .long 3097891989 + .long 2284336932 + .long 1932639591 + .long 1092540108 + .long 4171705026 + .long 1025654624 + .long 2806138305 + .long 3009647326 + .long 4248184906 + .long 1890367717 + .long 2289438980 + .long 2899757860 + .long 2719293081 + .long 2021534083 + .long 143536689 + .long 3592569555 + .long 2232683115 + .long 1092535430 + .long 1236892532 + .long 4153044331 + .long 2589276857 + .long 3416977538 + .long 1252322112 + .long 2546684106 + .long 3041465242 + .long 1082461383 + .long 209063033 + .long 689512483 + .long 3233542783 + .long 2486702483 + .long 195380297 + .long 3370408231 + .long 2473507057 + .long 2649928714 + .long 3477888857 + .long 4011137876 + .long 2392519727 + .long 735960098 + .long 892635115 + .long 2839435691 + .long 3648562506 + .long 4276128797 + .long 1399354710 + .long 1604489874 + .long 3300188966 + .long 3618086195 + .long 2363035047 + .long 3798645379 + .long 2910302351 + .long 2872403096 + .long 1995870309 + .long 1272108261 + .long 2577818883 + .long 1355290640 + .long 1576944867 + .long 29835783 + .long 528 + .long 602586217 + .long 2744039853 + .long 1836018387 + .long 1812008391 + .long 2257334696 + .long 1529386301 + .long 1071982020 + .long 1483132946 + .long 4031485769 + .long 2132222880 + .long 3196630878 + .long 2436179952 + .long 499786504 + .long 1744292863 + .long 2290711216 + .long 2504292584 + .long 1896329063 + .long 3237324739 + .long 2330780121 + .long 3744707929 + .long 1734827082 + .long 3296507779 + .long 823995655 + .long 3906271181 + .long 1416288288 + .long 2226659999 + .long 3321781362 + .long 3715853563 + .long 2544842791 + .long 504837419 + .long 2958966103 + .long 2231720942 + .long 750175301 + .long 4084077163 + .long 2549224941 + .long 3250807824 + .long 1369606438 + .long 3223323496 + .long 2083589876 + .long 3384767572 + .long 4248382916 + .long 4144081438 + .long 3229998485 + .long 3165770641 + .long 3223334087 + .long 2485373121 + .long 3818931504 + .long 3388848075 + .long 1252536709 + .long 1652370242 + .long 2624409840 + .long 2964694704 + .long 823791654 + .long 1167018965 + .long 2939238153 + .long 2953436515 + .long 884228550 + .long 292276865 + .long 734484637 + .long 2205305082 + .long 1913113287 + .long 3765099297 + .long 3745471985 + .long 4167966771 + .long 2931697765 + .long 3673300473 + .long 2182221826 + .long 2649024091 + .long 1975627272 + .long 3727134676 + .long 3712743943 + .long 2356773214 + .long 1995177638 + .long 1132588444 + .long 1959425557 + .long 2466886350 + .long 1844669961 + .long 3530525712 + .long 760398624 + .long 4132176514 + .long 1979460773 + .long 796554174 + .long 3170959411 + .long 3438043671 + .long 1989653354 + .long 84033345 + .long 407935807 + .long 2705661215 + .long 1743925380 + .long 3102969454 + .long 3987162576 + .long 3388329870 + .long 1765097355 + .long 2209606903 + .long 1187505799 + .long 2507493218 + .long 161532103 + .long 2079767141 + .long 2713931831 + .long 2181209439 + .long 3726577836 + .long 2678974047 + .long 4042300458 + .long 3044993725 + .long 569618662 + .long 2942019385 + .long 2267421895 + .long 3217189858 + .long 2072134893 + .long 690975306 + .long 3699981379 + .long 4279355559 + .long 3941553639 + .long 955448001 + .long 4102577460 + .long 2173892384 + .long 1871059570 + .long 2340022155 + .long 2864020166 + .long 2805153080 + .long 3271562790 + .long 928990650 + .long 4206766333 + .long 3357221519 + .long 685259147 + .long 3780305127 + .long 2513405378 + .long 4289834595 + .long 2048010913 + .long 1999500835 + .long 12816876 + .long 4227858976 + .long 255479044 + .long 3586592293 + .long 3058876998 + .long 264515361 + .long 3124897887 + .long 2490659405 + .long 1648870444 + .long 499533912 + .long 41235212 + .long 1135645 + .long 0 + .long 0 + .long 1870875844 + .long 237807939 + .long 0 + .long 0 + .long 1220251845 + .long 534075739 + .long 10 + .long 0 + .long 1566916386 + .long 2806728368 + .long 1584 + .long 0 + .long 359612094 + .long 1988210364 + .long 209791 + .long 0 + .long 4018390684 + .long 3143652161 + .long 23114812 + .long 0 + .long 1385310342 + .long 3191552623 + .long 2079730388 + .long 0 + .long 391712962 + .long 3496232483 + .long 3188676879 + .long 34 + .long 712670475 + .long 2384468018 + .long 3612170541 + .long 1928 + .long 2944407817 + .long 162857838 + .long 3871824152 + .long 79642 + .long 1897150183 + .long 2209645725 + .long 1648691441 + .long 2316814 + .long 4189666301 + .long 2103634775 + .long 2832836870 + .long 43914735 + .long 100148761 + .long 3544145710 + .long 882453749 + .long 480946030 + .long 743895637 + .long 1440146064 + .long 1167801510 + .long 2472892869 + .long 2527288726 + .long 3429197137 + .long 3389012105 + .long 3751366970 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3328931461 + .long 85211143 + .long 0 + .long 0 + .long 1806098240 + .long 3730920547 + .long 3 + .long 0 + .long 1452363271 + .long 241457122 + .long 632 + .long 0 + .long 2408523024 + .long 2523801313 + .long 87488 + .long 0 + .long 2245774023 + .long 1447128763 + .long 10087333 + .long 0 + .long 741575833 + .long 1516712297 + .long 950654827 + .long 0 + .long 188657751 + .long 2834063720 + .long 2756671478 + .long 16 + .long 1878890455 + .long 1600190830 + .long 298103694 + .long 968 + .long 2704961479 + .long 3096990934 + .long 62735862 + .long 41831 + .long 4224033960 + .long 872206772 + .long 3368762420 + .long 1269793 + .long 1493275548 + .long 4226875193 + .long 156115358 + .long 24976936 + .long 3675413693 + .long 3939858976 + .long 1188049005 + .long 281407884 + .long 4246420658 + .long 2584806369 + .long 1500891563 + .long 1472264476 + .long 3550606718 + .long 2355970614 + .long 848338822 + .long 2246143015 + .long 4294967292 + .long 0 + .long 4176598204 + .long 2421744458 + .long 12825068 + .long 4227858976 + .long 26255947 + .long 2214716320 + .long 3008850950 + .long 1148166722 + .long 3688411584 + .long 3263035913 + .long 28940749 + .long 823708345 + .long 2778463383 + .long 1133123 + .long 0 + .long 0 + .long 3375994644 + .long 239287696 + .long 0 + .long 0 + .long 1307882943 + .long 652616536 + .long 10 + .long 0 + .long 1617272991 + .long 332362201 + .long 1584 + .long 0 + .long 1120342694 + .long 786793736 + .long 208818 + .long 0 + .long 1754116211 + .long 4140995168 + .long 22886713 + .long 0 + .long 1065416575 + .long 2365212708 + .long 2045489262 + .long 0 + .long 4094841 + .long 1336050951 + .long 3805124179 + .long 33 + .long 2857461896 + .long 1181810454 + .long 3505581240 + .long 1861 + .long 317401726 + .long 1588400515 + .long 2236524720 + .long 75909 + .long 1498310037 + .long 3569634182 + .long 656796315 + .long 2175950 + .long 1147851401 + .long 3112077225 + .long 3624068591 + .long 40608505 + .long 3302439284 + .long 1412013598 + .long 1600554036 + .long 438608161 + .long 1138396370 + .long 2245711018 + .long 3467973442 + .long 2233633025 + .long 867533488 + .long 947112014 + .long 1198607031 + .long 3375241932 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1112979214 + .long 155431282 + .long 0 + .long 0 + .long 751906521 + .long 4198567473 + .long 6 + .long 0 + .long 1613582890 + .long 3858662071 + .long 1129 + .long 0 + .long 750469660 + .long 730914801 + .long 154615 + .long 0 + .long 3704035494 + .long 424802513 + .long 17595297 + .long 0 + .long 3547752153 + .long 653012047 + .long 1632696395 + .long 0 + .long 3895749118 + .long 1312132433 + .long 283540480 + .long 28 + .long 69337464 + .long 2039495909 + .long 480366968 + .long 1598 + .long 3999973752 + .long 512131576 + .long 3264765906 + .long 67376 + .long 1470627556 + .long 3527817596 + .long 506357093 + .long 1990112 + .long 1150644769 + .long 1706533685 + .long 1646793404 + .long 38078290 + .long 2272838918 + .long 315551185 + .long 931114118 + .long 418976801 + .long 799519248 + .long 833405850 + .long 3700723307 + .long 2157812839 + .long 1885423178 + .long 2894024424 + .long 986247108 + .long 3272778907 + .long 4294967291 + .long 0 + .long 205941362 + .long 2843814473 + .long 12816876 + .long 4227858976 + .long 4284396776 + .long 2636211962 + .long 2729248679 + .long 228940808 + .long 2721630221 + .long 4033427380 + .long 3518215373 + .long 3318265016 + .long 1583232401 + .long 1129188 + .long 0 + .long 0 + .long 2240090200 + .long 238747566 + .long 0 + .long 0 + .long 2182354368 + .long 422793662 + .long 10 + .long 0 + .long 2344384525 + .long 3611967473 + .long 1569 + .long 0 + .long 2363261376 + .long 55742926 + .long 206011 + .long 0 + .long 2169713945 + .long 2081106389 + .long 22457193 + .long 0 + .long 808249952 + .long 3928968053 + .long 1994189663 + .long 0 + .long 2498399120 + .long 610170797 + .long 3374767919 + .long 32 + .long 2499128949 + .long 806866088 + .long 2667994898 + .long 1785 + .long 1293127093 + .long 1533235693 + .long 3364558966 + .long 72094 + .long 3484449920 + .long 4142457389 + .long 393414345 + .long 2045553 + .long 1815566734 + .long 3205349654 + .long 1699048752 + .long 37804868 + .long 885836718 + .long 797019709 + .long 3601921623 + .long 405043970 + .long 1414187968 + .long 4238799387 + .long 2244838147 + .long 2051616278 + .long 2091776204 + .long 3735546130 + .long 1436809887 + .long 3093461814 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 194035164 + .long 141017056 + .long 0 + .long 0 + .long 3307569967 + .long 1206991859 + .long 6 + .long 0 + .long 3663448937 + .long 3391377880 + .long 1007 + .long 0 + .long 4126701083 + .long 2994857527 + .long 136467 + .long 0 + .long 1667733955 + .long 4058943102 + .long 15345719 + .long 0 + .long 2611265876 + .long 3831769830 + .long 1404776386 + .long 0 + .long 209321266 + .long 573187068 + .long 3359330694 + .long 23 + .long 1677262110 + .long 637572110 + .long 2122511782 + .long 1331 + .long 3496561941 + .long 3652813901 + .long 3559168047 + .long 55128 + .long 1750715127 + .long 4228815409 + .long 1050316 + .long 1598795 + .long 1840387030 + .long 2463042611 + .long 3094434052 + .long 30079053 + .long 2629602118 + .long 2049759618 + .long 945167723 + .long 326505049 + .long 3298129216 + .long 3410065465 + .long 1686243051 + .long 1666911635 + .long 3383305094 + .long 1693255217 + .long 2403972032 + .long 2519963779 + .long 4294967291 + .long 0 + .long 3238416553 + .long 3265778049 + .long 12825068 + .long 4227858976 + .long 3177200532 + .long 3057752043 + .long 1963397648 + .long 3926923754 + .long 1015831100 + .long 3054277238 + .long 214260357 + .long 3388682645 + .long 329260597 + .long 1120080 + .long 0 + .long 0 + .long 1129382972 + .long 236791308 + .long 0 + .long 0 + .long 200550114 + .long 4225205647 + .long 9 + .long 0 + .long 3987740840 + .long 662463985 + .long 1546 + .long 0 + .long 3625695977 + .long 942803776 + .long 202014 + .long 0 + .long 4082097994 + .long 2934588234 + .long 21910543 + .long 0 + .long 2081364333 + .long 826431917 + .long 1934499234 + .long 0 + .long 1761358361 + .long 1915853684 + .long 2581201468 + .long 31 + .long 1458338458 + .long 480335293 + .long 641318311 + .long 1709 + .long 2934587087 + .long 1935466844 + .long 4209158963 + .long 68508 + .long 2290297886 + .long 2520183995 + .long 2347470795 + .long 1930078 + .long 1214972608 + .long 3678131539 + .long 56536087 + .long 35444212 + .long 1624218450 + .long 2947499939 + .long 75007111 + .long 377830189 + .long 794554122 + .long 1484978356 + .long 1550658172 + .long 1907426674 + .long 1950966402 + .long 3741059307 + .long 468440577 + .long 2872207806 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2513119405 + .long 255601926 + .long 0 + .long 0 + .long 1340053149 + .long 1293535308 + .long 11 + .long 0 + .long 2520596056 + .long 243966073 + .long 1798 + .long 0 + .long 1240269441 + .long 1692289976 + .long 241208 + .long 0 + .long 486505533 + .long 4176826391 + .long 26843964 + .long 0 + .long 1085031321 + .long 2229862700 + .long 2429583838 + .long 0 + .long 3607912919 + .long 1284443184 + .long 2708483256 + .long 40 + .long 4286170020 + .long 2109173108 + .long 2872722597 + .long 2245 + .long 3765965368 + .long 2873757161 + .long 2280026745 + .long 91776 + .long 975034122 + .long 907445528 + .long 4183785771 + .long 2628820 + .long 2401876752 + .long 1790794470 + .long 4120636181 + .long 48923208 + .long 3456079977 + .long 3312351896 + .long 2533182876 + .long 526592659 + .long 300202939 + .long 3214183676 + .long 2700781633 + .long 2674019932 + .long 3409370037 + .long 142796896 + .long 590138558 + .long 4034348900 + .long 4294967290 + .long 0 + .long 2441521498 + .long 242594037 + .long 2326542 + .long 4227858728 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 292802143 + .long 2930268 + .long 0 + .long 0 + .long 535415153 + .long 618901269 + .long 0 + .long 0 + .long 1086559041 + .long 2797303288 + .long 25 + .long 0 + .long 4140762130 + .long 803311064 + .long 3903 + .long 0 + .long 3260682281 + .long 805348165 + .long 501094 + .long 0 + .long 946699523 + .long 2655018074 + .long 53417808 + .long 0 + .long 3184188054 + .long 357148693 + .long 343191017 + .long 1 + .long 2991785955 + .long 1885266767 + .long 2475080337 + .long 74 + .long 3202232014 + .long 1390745085 + .long 1906741299 + .long 3974 + .long 2460394114 + .long 145617371 + .long 1237048646 + .long 157131 + .long 2499420999 + .long 890518540 + .long 2984098479 + .long 4365826 + .long 4044160094 + .long 3502963765 + .long 4084883256 + .long 78771967 + .long 1855836510 + .long 1773383726 + .long 696038818 + .long 812348145 + .long 1371130586 + .long 4224739114 + .long 2913286396 + .long 3734813411 + .long 3022964429 + .long 4251306649 + .long 3856945722 + .long 3368235169 + .long 4294967295 + .long 0 + .long 3259021111 + .long 321006842 + .long 29835651 + .long 528 + .long 4287764257 + .long 2359162534 + .long 538435925 + .long 1893177075 + .long 2620595140 + .long 1125567552 + .long 2991073306 + .long 2159239491 + .long 623213113 + .long 2440954329 + .long 3454983919 + .long 2690441248 + .long 1981777827 + .long 3070641374 + .long 600396448 + .long 3989904562 + .long 503111015 + .long 2398913263 + .long 3729609173 + .long 2560895207 + .long 4264522276 + .long 1827510236 + .long 1453587439 + .long 2856034995 + .long 3530335573 + .long 2910390539 + .long 3830755809 + .long 3395214488 + .long 581887236 + .long 170861812 + .long 3783767784 + .long 3801720292 + .long 3874334995 + .long 3776894534 + .long 3941576344 + .long 4151651145 + .long 672178724 + .long 1876155966 + .long 2300153670 + .long 2280168405 + .long 2930820789 + .long 310363638 + .long 2337608734 + .long 2504022121 + .long 679615860 + .long 1866145491 + .long 925134179 + .long 2749395452 + .long 4164495461 + .long 1691717726 + .long 3504269286 + .long 3018609133 + .long 4091749652 + .long 2913918638 + .long 75440378 + .long 3313861766 + .long 2260863989 + .long 1783565696 + .long 3478989690 + .long 3637556251 + .long 386210930 + .long 165743778 + .long 2898550894 + .long 3992273458 + .long 138300613 + .long 2474605972 + .long 1444508693 + .long 2190379430 + .long 3716173044 + .long 211495398 + .long 2076026756 + .long 2402948622 + .long 884026613 + .long 3273453185 + .long 2774793032 + .long 2635331838 + .long 862601524 + .long 3461868441 + .long 1569319307 + .long 2889017487 + .long 2379289701 + .long 4014175908 + .long 4105967090 + .long 3165345439 + .long 4280005796 + .long 3658970897 + .long 1734788832 + .long 3465258574 + .long 1142155173 + .long 2128929843 + .long 1454912392 + .long 3791483352 + .long 1572825138 + .long 4100167805 + .long 2209491991 + .long 4149468636 + .long 1302034421 + .long 2240019943 + .long 2903825538 + .long 2241250238 + .long 1470684676 + .long 2909933371 + .long 1614391894 + .long 2346034557 + .long 3663942245 + .long 150553254 + .long 581996432 + .long 2853498413 + .long 2851485478 + .long 1062112106 + .long 2360862824 + .long 4080591848 + .long 3037166561 + .long 3942859811 + .long 2491765597 + .long 2637624859 + .long 3670749589 + .long 1175994297 + .long 2568760650 + .long 2257943156 + .long 4233645441 + .long 2769385451 + .long 3183971100 + .long 4072128784 + .long 1432427446 + .long 3380851706 + .long 2013943478 + .long 2236760609 + .long 4221662466 + .long 494326959 + .long 27640328 + .long 432 + .long 4152930537 + .long 3261335210 + .long 1647304022 + .long 2421513631 + .long 0 + .long 2182303040 + .long 2 + .long 0 + .long 2440707372 + .long 2648025301 + .long 1920343642 + .long 4033309261 + .long 228472035 + .long 951557190 + .long 1587559315 + .long 2974493459 + .long 2596925677 + .long 961292909 + .long 2340517507 + .long 4069972126 + .long 3800775586 + .long 2435894136 + .long 1723862257 + .long 2750240234 + .long 1983413582 + .long 438211295 + .long 1298530652 + .long 3389699362 + .long 2457352961 + .long 2834143237 + .long 3251433817 + .long 4162244914 + .long 2624345295 + .long 2198133979 + .long 1723202388 + .long 2299670239 + .long 3808420354 + .long 1821904843 + .long 3390094422 + .long 2531701946 + .long 1851152974 + .long 2701629785 + .long 1724191120 + .long 2482272915 + .long 648872229 + .long 865545185 + .long 2559674717 + .long 2406027884 + .long 910915727 + .long 2144582723 + .long 1642929274 + .long 4137212570 + .long 2336042754 + .long 239465408 + .long 3865561517 + .long 3439416156 + .long 2422534192 + .long 3569472253 + .long 2978472155 + .long 2559905612 + .long 2875291331 + .long 4046158321 + .long 3949085588 + .long 3503570860 + .long 2128927569 + .long 1225899162 + .long 2147335523 + .long 2230618794 + .long 2283389284 + .long 1333752198 + .long 1465231956 + .long 2336128911 + .long 2753251442 + .long 2966939997 + .long 2922138241 + .long 2536578790 + .long 2666112773 + .long 3385813147 + .long 623901210 + .long 3462131994 + .long 668414005 + .long 3701008851 + .long 3126176950 + .long 3345113301 + .long 358440900 + .long 3717742396 + .long 3947881290 + .long 3263003015 + .long 2610140914 + .long 3090322344 + .long 447998310 + .long 4170300383 + .long 397141160 + .long 2942373728 + .long 3824192808 + .long 2641349034 + .long 2658982609 + .long 4233303079 + .long 2524818000 + .long 3312990274 + .long 228893295 + .long 2515147602 + .long 3476745001 + .long 2698739548 + .long 2970265182 + .long 931672352 + .long 30032391 + .long 720 + .long 1031893951 + .long 2915037812 + .long 3514686481 + .long 3480585297 + .long 183393903 + .long 2624056858 + .long 28546027 + .long 1683875686 + .long 92539635 + .long 470440642 + .long 3104544566 + .long 2542111380 + .long 2423082850 + .long 4223302981 + .long 1880783390 + .long 3172707188 + .long 2733291596 + .long 4028584963 + .long 3133521808 + .long 2155982074 + .long 1545518760 + .long 2360167907 + .long 1514977624 + .long 3361750727 + .long 1775829359 + .long 1268098089 + .long 293245362 + .long 2922889930 + .long 4260567272 + .long 2130738070 + .long 78442230 + .long 3811451694 + .long 3185114409 + .long 1528069252 + .long 1469017227 + .long 3009687218 + .long 817620842 + .long 541098266 + .long 3429120157 + .long 3247469802 + .long 1386496969 + .long 2684347079 + .long 284179228 + .long 4184596161 + .long 3638765322 + .long 371021313 + .long 2606681771 + .long 2672602875 + .long 1153440841 + .long 681666828 + .long 2588485140 + .long 3667250000 + .long 2323000426 + .long 796579017 + .long 4170606170 + .long 2503045697 + .long 3134166249 + .long 3700272898 + .long 3134839549 + .long 3388945252 + .long 703661802 + .long 1462722757 + .long 1341451622 + .long 2296227379 + .long 443948971 + .long 1838486354 + .long 1829780795 + .long 3113397699 + .long 3423557800 + .long 3677683794 + .long 2988390605 + .long 4220311422 + .long 2364782699 + .long 377168398 + .long 988912816 + .long 2859792771 + .long 2272449576 + .long 2425114493 + .long 3394168911 + .long 3875037301 + .long 2614813611 + .long 1136311064 + .long 3219605340 + .long 2624778863 + .long 2109052744 + .long 2469309985 + .long 1975730813 + .long 3554907757 + .long 1295201579 + .long 391105893 + .long 1554957189 + .long 2406549547 + .long 576394664 + .long 1543244524 + .long 1882413337 + .long 3257006239 + .long 1017054059 + .long 1977139902 + .long 2097363325 + .long 2203699043 + .long 1908366122 + .long 67963273 + .long 641406479 + .long 2982177629 + .long 3746196521 + .long 1016392834 + .long 2077695946 + .long 4016838075 + .long 2069372298 + .long 3280381472 + .long 2122130600 + .long 2685921991 + .long 1883255817 + .long 3264982359 + .long 4098768927 + .long 3758603957 + .long 3506210954 + .long 1836307129 + .long 2822017765 + .long 2764063917 + .long 2012804049 + .long 1836928984 + .long 1054120456 + .long 2619585574 + .long 1055724672 + .long 2194227394 + .long 2447214543 + .long 2687690031 + .long 1327427687 + .long 1655178620 + .long 3028234167 + .long 3556180690 + .long 2927424394 + .long 229520228 + .long 65594667 + .long 3227047264 + .long 1689555076 + .long 4247943379 + .long 172770419 + .long 3675678736 + .long 657796043 + .long 288113065 + .long 2256116365 + .long 2460956283 + .long 2381283399 + .long 3352776929 + .long 3687288864 + .long 3224422563 + .long 672976042 + .long 857803139 + .long 2956970725 + .long 3269238901 + .long 2326138918 + .long 3946484787 + .long 3349422960 + .long 2579382025 + .long 3310332749 + .long 822582390 + .long 2446752418 + .long 2381540812 + .long 4287345289 + .long 449373617 + .long 1629474989 + .long 2287047921 + .long 3156879118 + .long 2932312680 + .long 4059116599 + .long 3501115759 + .long 2653478600 + .long 1047527497 + .long 2387670671 + .long 2153577515 + .long 4278907533 + .long 1522300626 + .long 2248985742 + .long 2923309751 + .long 2050095503 + .long 1358740372 + .long 29884806 + .long 576 + .long 189636935 + .long 2307472755 + .long 73850715 + .long 2629855449 + .long 3883672823 + .long 618265067 + .long 3875053116 + .long 3917969758 + .long 1449807750 + .long 2492768441 + .long 781111022 + .long 3190435238 + .long 1482976409 + .long 3746699123 + .long 673296220 + .long 2543135664 + .long 1097012132 + .long 2731166546 + .long 2691838079 + .long 3591085575 + .long 4108503415 + .long 2072634685 + .long 3936623385 + .long 2185856579 + .long 1923690262 + .long 3646023575 + .long 4216469600 + .long 2465929342 + .long 431460727 + .long 596938224 + .long 2153081083 + .long 2604407262 + .long 2280668022 + .long 3134357508 + .long 2589033740 + .long 2773504679 + .long 2807242375 + .long 2817121462 + .long 2773778968 + .long 2997091783 + .long 1733040470 + .long 818736373 + .long 2513276750 + .long 3273702286 + .long 3677662487 + .long 322072717 + .long 1865747051 + .long 3233516951 + .long 2915555540 + .long 937584400 + .long 659945040 + .long 2820584615 + .long 2133192181 + .long 2691571362 + .long 4196086611 + .long 2727659532 + .long 896759672 + .long 1769906504 + .long 3035342266 + .long 2750209132 + .long 1576632880 + .long 1478621509 + .long 1238707153 + .long 3507491969 + .long 126298229 + .long 3524093915 + .long 2681332129 + .long 2656870434 + .long 2282193125 + .long 2123250942 + .long 2537777848 + .long 2313555892 + .long 2236573588 + .long 3014805274 + .long 1599407648 + .long 4251279069 + .long 1359728578 + .long 2438133930 + .long 1558056398 + .long 2562927734 + .long 3023480919 + .long 1448378982 + .long 1701562892 + .long 2340149056 + .long 1506041285 + .long 779806113 + .long 4234929211 + .long 2470659521 + .long 3801687606 + .long 3749889093 + .long 4112153792 + .long 4129315601 + .long 3087235106 + .long 3558690450 + .long 4001893244 + .long 3474539130 + .long 508945001 + .long 2957303106 + .long 3788800591 + .long 2700334225 + .long 1697795651 + .long 4047812965 + .long 4036703836 + .long 3519182687 + .long 4240516712 + .long 1475971627 + .long 1575184661 + .long 2515949915 + .long 1673437412 + .long 2377231640 + .long 3395057130 + .long 2344040799 + .long 1065264411 + .long 1317525997 + .long 664446688 + .long 3082671496 + .long 1521403251 + .long 50174553 + .long 2566979079 + .long 3666263822 + .long 3888565980 + .long 425393181 + .long 383974 + .long 2211658859 + .long 3190477332 + .long 1452652764 + .long 881590408 + .long 2658571543 + .long 2768922591 + .long 607349007 + .long 1340513656 + .long 2982866930 + .long 2042743989 + .long 2907958666 + .long 2030930082 + .long 2170145182 + .long 1493033626 + .long 3329402172 + .long 1968890141 + .long 2331822590 + .long 2408886146 + .long 1783184274 + .long 12825068 + .long 4227858976 + .long 2710581281 + .long 3153889734 + .long 3238022506 + .long 4176533952 + .long 1531340198 + .long 4025201404 + .long 2485789300 + .long 650490227 + .long 2321085797 + .long 625172 + .long 0 + .long 0 + .long 1069281709 + .long 251624587 + .long 0 + .long 0 + .long 4197074614 + .long 91585281 + .long 10 + .long 0 + .long 2135656897 + .long 267376913 + .long 1588 + .long 0 + .long 3403656332 + .long 967418652 + .long 209472 + .long 0 + .long 463318414 + .long 1993660658 + .long 23089564 + .long 0 + .long 1930917064 + .long 2053446879 + .long 2077215423 + .long 0 + .long 657157488 + .long 2477268698 + .long 3166180846 + .long 34 + .long 1532275274 + .long 3903843069 + .long 3017665745 + .long 1932 + .long 3296114418 + .long 3153699036 + .long 1621212020 + .long 80134 + .long 1258014930 + .long 2176092298 + .long 1175504463 + .long 2347208 + .long 1382073311 + .long 570037013 + .long 1129603108 + .long 44970025 + .long 2202866424 + .long 1579426883 + .long 3017508354 + .long 499448209 + .long 4088025423 + .long 891205158 + .long 1193661411 + .long 2604580528 + .long 2532457727 + .long 3946349630 + .long 1951385266 + .long 3993662730 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2589520468 + .long 104644116 + .long 0 + .long 0 + .long 3884787564 + .long 2761065855 + .long 3 + .long 0 + .long 3187602994 + .long 4135562377 + .long 626 + .long 0 + .long 1724989792 + .long 1713856870 + .long 86304 + .long 0 + .long 2484708115 + .long 4089533751 + .long 10036248 + .long 0 + .long 275209371 + .long 2697520380 + .long 952228456 + .long 0 + .long 3236472558 + .long 1226316501 + .long 3598685087 + .long 16 + .long 3284813591 + .long 1063192554 + .long 3944393543 + .long 991 + .long 1278466978 + .long 2628971736 + .long 1168074903 + .long 43599 + .long 848711725 + .long 2087159795 + .long 759297680 + .long 1353656 + .long 1425592604 + .long 1129358307 + .long 2754552431 + .long 27432831 + .long 3204498819 + .long 300826889 + .long 3605445756 + .long 320203780 + .long 1698536723 + .long 3065896691 + .long 309908814 + .long 1734061231 + .long 3912468499 + .long 396401915 + .long 3674073704 + .long 2719285114 + .long 4294967292 + .long 0 + .long 3981914375 + .long 2206547233 + .long 12816876 + .long 4227858976 + .long 4096021827 + .long 3999001670 + .long 1063371522 + .long 3989528078 + .long 874562813 + .long 2447814409 + .long 1858302676 + .long 4162682718 + .long 1605953959 + .long 1135435 + .long 0 + .long 0 + .long 2549031326 + .long 239160205 + .long 0 + .long 0 + .long 454697744 + .long 620180210 + .long 10 + .long 0 + .long 2436299213 + .long 3355768607 + .long 1582 + .long 0 + .long 351390256 + .long 799610387 + .long 208707 + .long 0 + .long 25800287 + .long 698915934 + .long 22891066 + .long 0 + .long 4130988338 + .long 676217935 + .long 2048657779 + .long 0 + .long 2657270905 + .long 3829767903 + .long 59128891 + .long 34 + .long 1037582638 + .long 2935003680 + .long 713523288 + .long 1875 + .long 901580945 + .long 1268517119 + .long 2358220346 + .long 76826 + .long 1912766477 + .long 222206216 + .long 632792841 + .long 2216812 + .long 4065471431 + .long 1410808044 + .long 2022595908 + .long 41710361 + .long 438075994 + .long 598703158 + .long 1085011105 + .long 454516776 + .long 604410846 + .long 4058435110 + .long 2236814241 + .long 2333657313 + .long 2448294355 + .long 2704068860 + .long 1114425723 + .long 3548452336 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3769919769 + .long 153956907 + .long 0 + .long 0 + .long 646070119 + .long 4028818701 + .long 6 + .long 0 + .long 2588679469 + .long 1052177761 + .long 1128 + .long 0 + .long 2209274989 + .long 523514771 + .long 155204 + .long 0 + .long 2126396778 + .long 3565792859 + .long 17775584 + .long 0 + .long 2013180833 + .long 1908602229 + .long 1662519428 + .long 0 + .long 3793993839 + .long 1441646378 + .long 3693455390 + .long 28 + .long 3379423244 + .long 3965194379 + .long 1988414356 + .long 1663 + .long 1712981619 + .long 805217952 + .long 1789525478 + .long 71195 + .long 1327601011 + .long 2853644807 + .long 2041759317 + .long 2141557 + .long 944030315 + .long 2463564559 + .long 1071870408 + .long 41839542 + .long 3377497270 + .long 1387686562 + .long 1015294515 + .long 470457582 + .long 3802633795 + .long 4019363939 + .long 1055805497 + .long 2472026772 + .long 1903142729 + .long 1756051618 + .long 411357926 + .long 3811072860 + .long 4294967291 + .long 0 + .long 2342180209 + .long 2629357739 + .long 12825068 + .long 4227858976 + .long 4176598204 + .long 2421744458 + .long 608412369 + .long 593975024 + .long 2402997778 + .long 853372562 + .long 4106233885 + .long 999432807 + .long 1956711771 + .long 1129902 + .long 0 + .long 0 + .long 3668311682 + .long 238634701 + .long 0 + .long 0 + .long 1969498866 + .long 413457374 + .long 10 + .long 0 + .long 2816017558 + .long 1616523229 + .long 1570 + .long 0 + .long 3757647515 + .long 3035182130 + .long 206269 + .long 0 + .long 2187487164 + .long 1784472528 + .long 22516356 + .long 0 + .long 559031239 + .long 1740008181 + .long 2003371129 + .long 0 + .long 661394403 + .long 1757559962 + .long 108872688 + .long 33 + .long 2108184885 + .long 2675738113 + .long 243072689 + .long 1805 + .long 1896660970 + .long 944386947 + .long 1395829566 + .long 73206 + .long 2645692570 + .long 1073605584 + .long 391090218 + .long 2088195 + .long 3576186609 + .long 249080280 + .long 1318613440 + .long 38820429 + .long 1698387538 + .long 1714182690 + .long 2486672428 + .long 418377280 + .long 786186663 + .long 550325920 + .long 34733209 + .long 2130294753 + .long 123703415 + .long 1830333669 + .long 555170427 + .long 3225161241 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 372615672 + .long 141112893 + .long 0 + .long 0 + .long 3315900643 + .long 1327290262 + .long 6 + .long 0 + .long 3811139837 + .long 3724885846 + .long 1016 + .long 0 + .long 989130504 + .long 3252199933 + .long 138436 + .long 0 + .long 1221640456 + .long 1442402103 + .long 15666709 + .long 0 + .long 4152936768 + .long 1813348380 + .long 1445091735 + .long 0 + .long 4193896088 + .long 3387134533 + .long 2948009907 + .long 24 + .long 2262704738 + .long 1989650954 + .long 3803792063 + .long 1396 + .long 2783464578 + .long 434957745 + .long 1316597970 + .long 58551 + .long 1368551733 + .long 528983851 + .long 2424303193 + .long 1721511 + .long 2488297655 + .long 3464245304 + .long 3652031881 + .long 32861225 + .long 3506409524 + .long 3965838759 + .long 4041530878 + .long 361842100 + .long 1191665382 + .long 3299555859 + .long 1239122770 + .long 1871471448 + .long 3889602930 + .long 4175372373 + .long 3489971328 + .long 2859914059 + .long 4294967291 + .long 0 + .long 4097644266 + .long 3051847358 + .long 12816876 + .long 4227858976 + .long 205941362 + .long 2843814473 + .long 1373054629 + .long 908624394 + .long 572230967 + .long 3772158671 + .long 2295107357 + .long 875890232 + .long 1676909203 + .long 1121011 + .long 0 + .long 0 + .long 3140758008 + .long 236890113 + .long 0 + .long 0 + .long 78883718 + .long 4270561461 + .long 9 + .long 0 + .long 653004353 + .long 1003106748 + .long 1549 + .long 0 + .long 1997655276 + .long 2810156938 + .long 202673 + .long 0 + .long 816790074 + .long 126500350 + .long 22018895 + .long 0 + .long 483718758 + .long 1693602023 + .long 1948244742 + .long 0 + .long 1719888843 + .long 3024114415 + .long 3912173698 + .long 31 + .long 857585795 + .long 2024050081 + .long 2152155389 + .long 1731 + .long 2161391665 + .long 4153338473 + .long 3453597175 + .long 69665 + .long 690916841 + .long 3408680089 + .long 1481878010 + .long 1970802 + .long 4244781337 + .long 1956485181 + .long 3004849658 + .long 36347304 + .long 3508046261 + .long 2375922782 + .long 3796433011 + .long 389053187 + .long 1871421647 + .long 319248902 + .long 2844007792 + .long 1971197416 + .long 814256252 + .long 534724998 + .long 4096580698 + .long 2976687819 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1862921762 + .long 128829141 + .long 0 + .long 0 + .long 2226943868 + .long 3083060057 + .long 5 + .long 0 + .long 3790004556 + .long 3473372331 + .long 913 + .long 0 + .long 1912405170 + .long 4207391429 + .long 123223 + .long 0 + .long 2818206388 + .long 546560525 + .long 13795947 + .long 0 + .long 926024359 + .long 466562391 + .long 1257280106 + .long 0 + .long 3443963035 + .long 4102181261 + .long 824629355 + .long 21 + .long 1095781235 + .long 2590304783 + .long 3003378070 + .long 1181 + .long 3706684271 + .long 2607807817 + .long 1026954074 + .long 48765 + .long 2542600140 + .long 2410120938 + .long 1491060906 + .long 1411271 + .long 1675138874 + .long 3651173547 + .long 1198416212 + .long 26539599 + .long 842200953 + .long 401492709 + .long 2211503215 + .long 288538794 + .long 1943642431 + .long 940486719 + .long 4288006473 + .long 1478519853 + .long 2666730960 + .long 3798148012 + .long 941219805 + .long 2247821888 + .long 4294967291 + .long 0 + .long 3590128009 + .long 612654688 + .long 716769122 + .long 2 + .long 1828204245 + .long 1775926740 + .long 862431319 + .long 1672 + .long 437955120 + .long 677313132 + .long 3681074436 + .long 185717 + .long 2884200252 + .long 2090641138 + .long 3992138721 + .long 6428191 + .long 3221531446 + .long 2371910721 + .long 4237081542 + .long 91796659 + .long 3709028830 + .long 1986863955 + .long 2283696654 + .long 618613015 + .long 1322699753 + .long 485003501 + .long 4170891366 + .long 2092077992 + .long 1956040154 + .long 1117518145 + .long 962574367 + .long 3571830532 + .long 3307700780 + .long 4011234461 + .long 1774218710 + .long 2881343143 + .long 391584861 + .long 529954976 + .long 2825691418 + .long 856722023 + .long 0 + .long 0 + .long 3298396499 + .long 2495110602 + .long 2303999958 + .long 1 + .long 2542348583 + .long 3627482097 + .long 3224340298 + .long 1074 + .long 967783320 + .long 1406672934 + .long 4087851085 + .long 117404 + .long 4177416572 + .long 3106181469 + .long 261241013 + .long 4043478 + .long 202539330 + .long 3294545774 + .long 2496277142 + .long 57629426 + .long 720582238 + .long 1814713548 + .long 3091376339 + .long 388014697 + .long 146526450 + .long 4271301162 + .long 2338306966 + .long 1311627297 + .long 2070656804 + .long 1921999658 + .long 2258254113 + .long 2238807899 + .long 242296837 + .long 3253310178 + .long 207686852 + .long 1805761504 + .long 0 + .long 0 + .long 0 + .long 536870912 + .long 3 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3266800725 + .long 2413762801 + .long 3330613244 + .long 98 + .long 1201359419 + .long 2714872150 + .long 3208385380 + .long 20210 + .long 1956238602 + .long 4223228119 + .long 2784422263 + .long 1028397 + .long 3439473030 + .long 2410851869 + .long 3292470576 + .long 20253447 + .long 1686397776 + .long 592553810 + .long 969547707 + .long 185741930 + .long 3468583933 + .long 1250725515 + .long 2117116206 + .long 869064170 + .long 3909100790 + .long 1843251452 + .long 3871208694 + .long 2155104570 + .long 4148130288 + .long 2464912491 + .long 1300300682 + .long 2809133898 + .long 4014582188 + .long 344247779 + .long 2796123058 + .long 1784697576 + .long 195792426 + .long 264977488 + .long 3560329357 + .long 428361011 + .long 4294967290 + .long 0 + .long 258978617 + .long 1401350217 + .long 414758348 + .long 0 + .long 3858563520 + .long 693344438 + .long 929988021 + .long 164 + .long 3412169140 + .long 2002911005 + .long 1900957617 + .long 27838 + .long 201299732 + .long 2653786175 + .long 836100553 + .long 1342443 + .long 112595646 + .long 24843945 + .long 2773043450 + .long 25894040 + .long 839565763 + .long 2401088019 + .long 1862800896 + .long 235227666 + .long 241900887 + .long 2111181527 + .long 559246656 + .long 1095314964 + .long 1679323588 + .long 170716610 + .long 3844392689 + .long 2709031418 + .long 2888224069 + .long 91827283 + .long 2484028115 + .long 3525834755 + .long 3046356865 + .long 465368430 + .long 2789327597 + .long 2238015503 + .long 0 + .long 0 + .long 0 + .long 536870912 + .long 3 + .long 0 + .long 1629800756 + .long 211083125 + .long 74954925 + .long 0 + .long 1545370875 + .long 1864504884 + .long 4276848488 + .long 99 + .long 535444102 + .long 452832597 + .long 341934841 + .long 25395 + .long 995111971 + .long 3604718273 + .long 313159131 + .long 1483348 + .long 467529526 + .long 927033629 + .long 3631579950 + .long 30995691 + .long 2550211567 + .long 3003753623 + .long 1495846756 + .long 281435025 + .long 1095077789 + .long 2892497672 + .long 2221613791 + .long 1215372727 + .long 1191801615 + .long 1667552124 + .long 2428434537 + .long 2551716115 + .long 1201465291 + .long 1874197394 + .long 578557072 + .long 2461680298 + .long 391584923 + .long 529954976 + .long 2825691418 + .long 856722023 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 677405811 + .long 113109491 + .long 129649144 + .long 114 + .long 3825428504 + .long 3691782001 + .long 3484121609 + .long 31057 + .long 2790365057 + .long 1503600960 + .long 2128362517 + .long 1842108 + .long 1815120706 + .long 3864377339 + .long 1520525307 + .long 38689413 + .long 2352056310 + .long 3376817110 + .long 3997253088 + .long 352036787 + .long 1198120374 + .long 2050750776 + .long 3970142361 + .long 1521787235 + .long 3363842978 + .long 1133863107 + .long 832963017 + .long 3196692150 + .long 3821983599 + .long 1263968260 + .long 873004851 + .long 3084767199 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 2 + .long 0 + .long 2651322308 + .long 3386393833 + .long 2831116449 + .long 5 + .long 4289850283 + .long 2368640529 + .long 3021143330 + .long 3284 + .long 1866387201 + .long 153493322 + .long 2018528397 + .long 295326 + .long 712913332 + .long 628654228 + .long 3881360594 + .long 8668773 + .long 2507640802 + .long 239249479 + .long 2566710297 + .long 108181087 + .long 2758175823 + .long 567857163 + .long 2134567225 + .long 650389544 + .long 3640757112 + .long 2804269303 + .long 645858985 + .long 1991928169 + .long 804414238 + .long 2280600022 + .long 3914463340 + .long 3114948090 + .long 1937917503 + .long 2252804771 + .long 1940556944 + .long 2322010631 + .long 293688586 + .long 2544949880 + .long 3193010387 + .long 642541517 + .long 4294967291 + .long 0 + .long 453133727 + .long 877370797 + .long 1558279443 + .long 6 + .long 2547899573 + .long 3360184680 + .long 1178296802 + .long 2954 + .long 1755214995 + .long 2061159704 + .long 3531983056 + .long 253712 + .long 543505238 + .long 128612626 + .long 629116815 + .long 7334610 + .long 100838038 + .long 3022980312 + .long 2298747174 + .long 90954203 + .long 3014766307 + .long 96539771 + .long 3590315363 + .long 545180116 + .long 2964798914 + .long 2705356255 + .long 3013291713 + .long 1667101568 + .long 3407956254 + .long 2146783552 + .long 2206958848 + .long 2604739160 + .long 1922050233 + .long 3165283613 + .long 2563978608 + .long 1940712607 + .long 0 + .long 0 + .long 0 + .long 536870912 + .long 3 + .long 0 + .long 2797952740 + .long 3054806814 + .long 120 + .long 0 + .long 18168 + .long 0 + .long 1890690921 + .long 3263011055 + .long 3960 + .long 0 + .long 18872 + .long 0 + .long 3238416553 + .long 3265778049 + .long 8064 + .long 0 + .long 18168 + .long 0 + .long 4097644266 + .long 3051847358 + .long 13440 + .long 0 + .long 18872 + .long 0 + .long 0 + .long 0 + .long 1313084713 + .long 2734261102 + .long 4113882560 + .long 4230436817 + .long 0 + .long 4294967295 + .long 4105493977 + .long 3790490747 + .long 2885543867 + .long 1813033052 + .long 0 + .long 0 + .type __bessel_x_table,@object + .size __bessel_x_table,19696 + .align 4 +.L_2il0floatpacket.108: + .long 0x5f000000 + .type .L_2il0floatpacket.108,@object + .size .L_2il0floatpacket.108,4 + .data + .hidden __dpml_ux_sqrt_evaluation__ + .hidden __dpml_multiply__ + .hidden __dpml_divide__ + .hidden __dpml_ux_log__ + .hidden __dpml_ux_sincos + .hidden __dpml_ffs_and_shift__ + .hidden __dpml_addsub__ + .hidden __dpml_evaluate_rational__ + .hidden __dpml_pack__ + .hidden __dpml_unpack_x_or_y__ + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/dpml_ux_log.S b/external/sgx_libm/ia32/dpml_ux_log.S new file mode 100644 index 0000000000..d199fe4588 --- /dev/null +++ b/external/sgx_libm/ia32/dpml_ux_log.S @@ -0,0 +1,365 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_log.c" + .text +..TXTST0: +# -- Begin __dpml_ux_log_poly__ + .text + .align 16,0x90 + .hidden __dpml_ux_log_poly__ + .globl __dpml_ux_log_poly__ +__dpml_ux_log_poly__: +# parameter 1: 48 + %esp +# parameter 2: 52 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + subl $36, %esp + xorl %eax, %eax + movl 52(%esp), %edi + addl $28, %esp + pushl %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + pushl %eax + pushl $6 + pushl %eax + pushl $17 + lea 128+__log_x_table@GOTOFF(%ebx), %edx + pushl %edx + pushl 44(%esp) + call __dpml_evaluate_rational__ +..B1.2: + addl $12, %esp + lea 472+__log_x_table@GOTOFF(%ebx), %eax + pushl %edi + pushl %eax + pushl %edi + call __dpml_multiply__ +..B1.3: + addl $36, %esp + popl %ebx + popl %edi + ret + .align 16,0x90 + .type __dpml_ux_log_poly__,@function + .size __dpml_ux_log_poly__,.-__dpml_ux_log_poly__ + .data +# -- End __dpml_ux_log_poly__ + .text +# -- Begin __dpml_ux_log__ + .text + .align 16,0x90 + .hidden __dpml_ux_log__ + .globl __dpml_ux_log__ +__dpml_ux_log__: +# parameter 1: 112 + %esp +# parameter 2: 116 + %esp +# parameter 3: 120 + %esp +..B2.1: +..L3: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $92, %esp + movl 112(%esp), %ecx + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + movl 8(%ecx), %esi + movl %gs:20, %eax + xorl %esp, %eax + subl 112+__log_x_table@GOTOFF(%ebx), %esi + movl 12(%ecx), %ebp + movl 4(%ecx), %edx + movl %edx, %edi + movl %eax, 80(%esp) + sbbl 116+__log_x_table@GOTOFF(%ebx), %ebp + jb ..B2.2 +..B2.19: + orl %ebp, %esi + jne ..B2.3 +..B2.2: + lea -1(%edx), %edi +..B2.3: + addl $20, %esp + lea 424+__log_x_table@GOTOFF(%ebx), %ebp + subl %edi, %edx + lea 12(%esp), %esi + pushl %esi + pushl $0 + pushl $6 + pushl %ebp + pushl %ecx + movl %edx, 4(%ecx) + call __dpml_addsub__ +..B2.4: + movl 112(%esp), %ecx + movl 120(%esp), %ebp + addl $20, %esp + addl %edi, 4(%ecx) + lea 36(%esp), %edx + pushl %ebp + pushl $0 + pushl $2 + pushl %esi + pushl %edx + call __dpml_divide__ +..B2.5: + addl $28, %esp + xorl %edx, %edx + pushl %esi + pushl %edx + pushl $6 + pushl %edx + pushl $17 + lea 128+__log_x_table@GOTOFF(%ebx), %ecx + pushl %ecx + pushl %ebp + call __dpml_evaluate_rational__ +..B2.6: + addl $12, %esp + movl %edi, %eax + pushl $0 + pushl $1 + cltd + pushl %ebp + movl %edi, 8(%ebp) + movl %edx, 12(%ebp) + call __dpml_ffs_and_shift__ +..B2.7: + addl $20, %esp + pushl %ebp + pushl $0 + pushl $8 + pushl %esi + pushl %ebp + call __dpml_addsub__ +..B2.8: + movl 116(%esp), %esi + testl %esi, %esi + je ..B2.10 +..B2.9: + addl $12, %esp + pushl %ebp + pushl %esi + pushl %ebp + call __dpml_multiply__ +..B2.10: + cmpl $-262144, 60(%esp) + je ..B2.15 +..B2.11: + movl $1, %eax +..B2.12: + movl 80(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.14 +..B2.13: + xorl %edx, %edx + addl $92, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B2.14: + call __stack_chk_fail@PLT +..B2.15: + testl %esi, %esi + jne ..B2.11 +..B2.16: + xorl %eax, %eax + jmp ..B2.12 + .align 16,0x90 + .type __dpml_ux_log__,@function + .size __dpml_ux_log__,.-__dpml_ux_log__ + .data +# -- End __dpml_ux_log__ + .section .rodata, "a" + .align 4 + .align 4 +__log_x_table: + .long 1088750600 + .long 519758862 + .long 58 + .long 0 + .long 59 + .long 0 + .long 60 + .long 0 + .long 1088750600 + .long 519758862 + .long 61 + .long 0 + .long 62 + .long 0 + .long 63 + .long 0 + .long 1088750600 + .long 519758862 + .long 64 + .long 0 + .long 65 + .long 0 + .long 66 + .long 0 + .long 15008776 + .long 336609536 + .long 58 + .long 0 + .long 4192101508 + .long 3037000499 + .long 4243534402 + .long 1518500249 + .long 1261892956 + .long 1305769775 + .long 706307789 + .long 114052365 + .long 2125978754 + .long 1401519948 + .long 2628436525 + .long 90640697 + .long 1075745124 + .long 4046945230 + .long 850547722 + .long 100185346 + .long 3858047057 + .long 2069326047 + .long 3415016796 + .long 106820841 + .long 196219186 + .long 3461778520 + .long 1283971156 + .long 114747264 + .long 133398994 + .long 3894487089 + .long 1548005786 + .long 123926548 + .long 4002430868 + .long 3905024888 + .long 1104860464 + .long 134702783 + .long 1396868873 + .long 2152947579 + .long 2102985887 + .long 147531619 + .long 361329122 + .long 2531697111 + .long 2794113080 + .long 163061263 + .long 2117398987 + .long 2352680084 + .long 3122626672 + .long 182244941 + .long 299366278 + .long 2801833386 + .long 1248329477 + .long 206544267 + .long 99864504 + .long 1693623838 + .long 1770762254 + .long 238320308 + .long 959885721 + .long 1462617677 + .long 2483170600 + .long 281651273 + .long 2353710846 + .long 1786830293 + .long 2080549112 + .long 344240445 + .long 2781107612 + .long 1683788319 + .long 2061424959 + .long 442594858 + .long 2924123738 + .long 1498310185 + .long 3744988402 + .long 619632801 + .long 2019498699 + .long 1065527877 + .long 1946680041 + .long 1032721336 + .long 1763524233 + .long 3196583632 + .long 1545072827 + .long 3098164009 + .long 2 + .long 0 + .long 0 + .long 1 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3520035243 + .long 2977044471 + .long 66254511 + .long 3387143064 + .long 0 + .long 4294967295 + .long 4224710552 + .long 2585827972 + .long 192713080 + .long 2408143276 + .long 0 + .long 0 + .type __log_x_table,@object + .size __log_x_table,528 + .data + .hidden __dpml_multiply__ + .hidden __dpml_divide__ + .hidden __dpml_ffs_and_shift__ + .hidden __dpml_addsub__ + .hidden __dpml_evaluate_rational__ + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/dpml_ux_ops.S b/external/sgx_libm/ia32/dpml_ux_ops.S new file mode 100644 index 0000000000..6a06e77f6f --- /dev/null +++ b/external/sgx_libm/ia32/dpml_ux_ops.S @@ -0,0 +1,3653 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_ops.c" + .text +..TXTST0: +# -- Begin __dpml_ffs_and_shift__ + .text + .align 16,0x90 + .hidden __dpml_ffs_and_shift__ + .globl __dpml_ffs_and_shift__ +__dpml_ffs_and_shift__: +# parameter 1: 64 + %esp +# parameter 2: 68 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $44, %esp + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + movl %eax, 28(%esp) + movl 64(%esp), %ecx + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 40(%esp) + movl 72(%esp), %eax + movl 68(%esp), %edx + movl 8(%ecx), %ebp + orl %eax, %edx + movl 12(%ecx), %ebx + jne ..B1.4 +..B1.2: + movl 64(%esp), %eax + xorl %ecx, %ecx + movl %ebx, %esi + subl %ecx, %esi + movl 4(%eax), %edx + movl %edx, 20(%esp) + jl ..B1.13 +..B1.3: + movl 64(%esp), %eax + movl 16(%eax), %esi + movl 20(%eax), %edx + jmp ..B1.9 +..B1.4: + movl $1, %edx + movl 68(%esp), %ecx + subl %edx, %ecx + orl %eax, %ecx + jne ..B1.7 +..B1.5: + xorl %eax, %eax + movl %ebx, %edx + subl %eax, %edx + jl ..B1.16 + jmp ..B1.8 +..B1.7: + xorl %eax, %eax +..B1.8: + movl 64(%esp), %edx + xorl %esi, %esi + movl $64, 20(%esp) + movl %ebp, 8(%edx) + movl %ebx, 12(%edx) + movl %esi, 16(%edx) + movl %esi, 20(%edx) + movl %eax, (%edx) + xorl %edx, %edx +..B1.9: + xorl %ecx, %ecx + movl $2, %edi + xorl %eax, %eax + movl %eax, 24(%esp) + movl %ebx, (%esp) + movl %ebp, 4(%esp) + movl %eax, %ebx + jmp ..B1.10 +..B1.12: + xorl %esi, %esi + xorl %edx, %edx +..B1.10: + movl 4(%esp), %ebp + orl (%esp), %ebp + jne ..B1.20 +..B1.11: + addl $64, %eax + movl %edx, (%esp) + adcl $0, %ebx + addl $-1, %edi + movl %edi, %edx + adcl $-1, %ecx + movl %esi, 4(%esp) + orl %ecx, %edx + jne ..B1.12 + jmp ..B1.17 +..B1.13: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.15 +..B1.14: + xorl %eax, %eax + xorl %edx, %edx + addl $44, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.15: + movl 28(%esp), %ebx + call __stack_chk_fail@PLT +..B1.16: + xorl %edx, %edx + movl %ebp, %eax + xorl %ebp, %ebp + movl %ebx, %ecx + xorl %ebx, %ebx + subl %eax, %ebp + sbbl %ecx, %ebx + movl $-2147483648, %eax + jmp ..B1.8 +..B1.17: + movl 64(%esp), %edx + movl %ebx, 24(%esp) + movl $-262144, 4(%edx) + movl 40(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.15 +..B1.18: + movl %ebx, %edx + addl $44, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.20: + movl %ebx, 24(%esp) + xorl %ecx, %ecx + movl (%esp), %ebx + movl %ebx, %edi + movl 4(%esp), %ebp + subl %ecx, %edi + jl ..B1.36 +..B1.21: + movl %ebx, %ecx + xorl %edi, %edi + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %edi + je ..B1.23 +..B1.22: + movl $21932, %edi + shrl %cl, %edi + andl $3, %edi + incl %edi + movl %edi, 16(%esp) + movl $0, 12(%esp) + jmp ..B1.26 +..B1.23: + movl %ebp, %edi + movl %ebx, %ecx + andl $-256, %edi + orl %edi, %ecx + jne ..B1.25 +..B1.24: + movl %ebp, %edi +..B1.25: + movl %edi, (%esp) + movl %ebx, %edi + movl %ebx, 4(%esp) + fildll (%esp) + shrl $31, %edi + movl 28(%esp), %ecx + movl %edx, 8(%esp) + faddl .L_2il0floatpacket.1@GOTOFF(%ecx,%edi,8) + movl $1086, %edi + fstpl 32(%esp) + movl 36(%esp), %edx + movl %edx, %ecx + sarl $20, %ecx + sarl $31, %edx + subl %ecx, %edi + movl $0, %ecx + sbbl %edx, %ecx + movl 8(%esp), %edx + movl %edi, 16(%esp) + movl %ecx, 12(%esp) +..B1.26: + cmpl $31, 16(%esp) + jbe ..B1.28 +..B1.27: + movl %ebp, %ebx + movl %edi, %ecx + movl $0, 4(%esp) + shll %cl, %ebx + jmp ..B1.29 +..B1.28: + movl %edi, %ecx + shldl %cl, %ebp, %ebx + shll %cl, %ebp + movl %ebp, 4(%esp) +..B1.29: + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B1.31 +..B1.30: + movl %edx, %ebp + movl $0, (%esp) + shrl %cl, %ebp + jmp ..B1.32 +..B1.31: + movl %edx, %edi + movl %esi, %ebp + shrl %cl, %edi + shrdl %cl, %edx, %ebp + movl %edi, (%esp) +..B1.32: + orl 4(%esp), %ebp + orl (%esp), %ebx + movl %esi, 8(%esp) + cmpl $31, 16(%esp) + jbe ..B1.34 +..B1.33: + movl 16(%esp), %ecx + xorl %esi, %esi + movl 8(%esp), %edx + shll %cl, %edx + jmp ..B1.35 +..B1.34: + movl 16(%esp), %ecx + shldl %cl, %esi, %edx + shll %cl, %esi +..B1.35: + addl 16(%esp), %eax + movl 24(%esp), %ecx + adcl 12(%esp), %ecx + movl %ecx, 24(%esp) +..B1.36: + movl 64(%esp), %ecx + movl %edx, 20(%ecx) + movl 20(%esp), %edx + subl %eax, %edx + movl %ebp, 8(%ecx) + movl %ebx, 12(%ecx) + movl %esi, 16(%ecx) + movl %edx, 4(%ecx) + movl 40(%esp), %ebx + xorl %esp, %ebx + cmpl %gs:20, %ebx + jne ..B1.15 +..B1.37: + movl 24(%esp), %edx + addl $44, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_ffs_and_shift__,@function + .size __dpml_ffs_and_shift__,.-__dpml_ffs_and_shift__ + .data +# -- End __dpml_ffs_and_shift__ + .text +# -- Begin __dpml_unpack2__ + .text + .align 16,0x90 + .hidden __dpml_unpack2__ + .globl __dpml_unpack2__ +__dpml_unpack2__: +# parameter 1: 64 + %esp +# parameter 2: 68 + %esp +# parameter 3: 72 + %esp +# parameter 4: 76 + %esp +# parameter 5: 80 + %esp +# parameter 6: 84 + %esp +# parameter 7: 88 + %esp +..B2.1: +..L3: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $44, %esp + movl 80(%esp), %ebx + movl 84(%esp), %eax + movl 88(%esp), %edx + movl %ebx, 12(%esp) + movl %eax, 16(%esp) + movl %edx, 20(%esp) + xorl %edx, %edx + movl 64(%esp), %eax + movl 72(%esp), %ecx + call __dpml_unpack_x_or_y__..0 +..B2.13: + movl %eax, %esi + movl %edx, %ebp +..B2.2: + xorl %ecx, %ecx + movl %ebp, %edi + subl %ecx, %edi + jl ..B2.9 +..B2.3: + cmpl $0, 68(%esp) + je ..B2.9 +..B2.4: + addl $-32, %esp + lea (,%esi,4), %ecx + movl 8(%ebx), %edi + cmpl $31, %ecx + movl 12(%ebx), %eax + jbe ..B2.6 +..B2.5: + sarl %cl, %eax + jmp ..B2.7 +..B2.6: + movl %eax, %edx + movl %edi, %eax + shrdl %cl, %edx, %eax +..B2.7: + andl $15, %eax + movl 116(%esp), %edi + movl 120(%esp), %ecx + movl 100(%esp), %edx + lea (%ebx,%eax,8), %ebx + movl %ebx, 12(%esp) + movl %edi, 16(%esp) + movl %ecx, 20(%esp) + movl 96(%esp), %eax + movl 108(%esp), %ecx + call __dpml_unpack_x_or_y__. +..B2.8: + movl %esi, %ecx + shrl $28, %ecx + shll $4, %esi + shll $4, %ebp + orl %eax, %esi + orl %ebp, %ecx + movl %esi, %eax + orl %ecx, %edx + addl $76, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B2.9: + movl %esi, %eax + movl %ebp, %edx + addl $44, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_unpack2__,@function + .size __dpml_unpack2__,.-__dpml_unpack2__ + .data +# -- End __dpml_unpack2__ + .text +# -- Begin __dpml_unpack_x_or_y__..0 + .text + .align 16,0x90 +__dpml_unpack_x_or_y__..0: +# parameter 1: %eax +# parameter 2: %edx +# parameter 3: %ecx +# parameter 4: 156 + %esp +# parameter 5: 160 + %esp +# parameter 6: 164 + %esp +..B3.1: +..L4: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $124, %esp + call ..L5 +..L5: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L5](%edx), %edx + movl %edx, 52(%esp) + movl 12(%eax), %edx + movl %ecx, 64(%esp) + movl %edx, %edi + movl %eax, 56(%esp) + andl $-2147483648, %edi + movl %gs:20, %ebp + xorl %esp, %ebp + movl %ebp, 116(%esp) + movl 164(%esp), %ebx + movl %edi, (%ecx) + movl %edx, %ecx + shrl $16, %ecx + andl $32767, %ecx + movl 8(%eax), %esi + movl %eax, 20(%ebx) + movl %edx, %ebx + movl %ecx, 60(%esp) + movl 4(%eax), %edi + lea -16382(%ecx), %ebp + movl %ebp, 16(%esp) + movl %esi, %ebp + shrl $17, %ebp + shll $15, %esi + shll $15, %ebx + movl (%eax), %ecx + movl %edi, %eax + shrl $17, %eax + orl %ebx, %ebp + movl %esi, %ebx + orl $-2147483648, %ebp + addl %esi, %ebx + movl %ebp, 20(%esp) + adcl %ebp, %ebp + orl %eax, %esi + movl %ecx, %eax + orl %edi, %ebp + shll $15, %eax + orl %ecx, %ebx + movl %esi, 76(%esp) + movl %ecx, %esi + movl %eax, 72(%esp) + movl %edi, %eax + shrl $17, %esi + lea -65536(%edx), %edi + shll $15, %eax + xorl %ecx, %ecx + orl %eax, %esi + lea 65536(%edx), %eax + movl %esi, 68(%esp) + movl %edx, %esi + xorl %edi, %eax + shrl $31, %esi + movl %edi, 24(%esp) + subl %ecx, %eax + movl 76(%esp), %edi + jl ..B3.39 +..B3.2: + movl 64(%esp), %eax + movl 72(%esp), %edx + movl 68(%esp), %ebx + movl %edi, 8(%eax) + movl 20(%esp), %edi + movl 16(%esp), %ebp + movl %edx, 16(%eax) + movl $4, %edx + movl %ebx, 20(%eax) + movl %edi, 12(%eax) + movl %ebp, 4(%eax) +..B3.3: + movl 164(%esp), %eax + addl %edx, %esi + movl $1, %edx + movl %esi, %ecx + movl %edx, 32(%esp) + movl (%eax), %ebp + movl %ebp, %edi + shll %cl, %edx + shll $10, %ebp + movl 4(%eax), %ebx + orl %edx, %ebp + shrl $22, %edi + shll $10, %ebx + movl %edx, 36(%esp) + xorl %edx, %edx + orl %ebx, %edi + movl %ebp, (%eax) + orl %esi, %edx + movl %edi, 4(%eax) + jne ..B3.5 +..B3.4: + movl $2139095040, 48(%esp) + flds 48(%esp) + flds 48(%esp) + fsubrp %st, %st(1) + fstps 48(%esp) +..B3.5: + movl $6, %eax + mull %esi + movl 156(%esp), %ebx + cmpl $31, %eax + movl (%ebx), %edi + movl 4(%ebx), %ebx + jbe ..B3.7 +..B3.6: + movl %eax, %ecx + movl %ebx, %edi + sarl %cl, %edi + jmp ..B3.8 +..B3.7: + movl %eax, %ecx + shrdl %cl, %ebx, %edi +..B3.8: + movl %edi, %ecx + xorl %edx, %edx + shrl $3, %edi + xorl %eax, %eax + andl $7, %edi + andl $7, %ecx + shrl $28, %ebx + orl %edi, %eax + je ..B3.32 +..B3.9: + movl 36(%esp), %ebp + movl %edx, %eax + andl $240, %ebp + movl %ebp, 24(%esp) + subl %edx, %eax + jl ..B3.10 +..B3.72: + orl %ecx, %eax + jne ..B3.14 +..B3.10: + movl %ecx, %ebx + orl %edx, %ebx + jne ..B3.12 +..B3.11: + movl 56(%esp), %ebx + movl %ebx, 20(%esp) + jmp ..B3.13 +..B3.12: + movl $0, 20(%esp) +..B3.13: + movl %ebp, %ebx + movl %ebx, 16(%esp) + jmp ..B3.15 +..B3.14: + addl %ecx, %ebx + movl 156(%esp), %edx + movl 52(%esp), %ebp + movl -8(%edx,%ebx,8), %ecx + movl -4(%edx,%ebx,8), %edx + movl 32(%esp), %ebx + shll %cl, %ebx + andl $240, %ebx + movl %ebx, 16(%esp) + movl %ecx, %ebx + shll $4, %ebx + addl __x_constants__@GOT(%ebp), %ebx + movl %ebx, 20(%esp) +..B3.15: + movl $7, %ebp + xorl %ebx, %ebx + negl %ebp + addl %edi, %ebp + orl %ebx, %ebp + je ..B3.36 +..B3.16: + movl 164(%esp), %ebx + movl 8(%ebx), %ebp + orl 12(%ebx), %ebp + je ..B3.19 +..B3.17: + movl 16(%esp), %ebp + xorl %ebx, %ebx + orl 24(%esp), %ebp + orl %ebx, %ebp + je ..B3.19 +..B3.18: + movl $1182793727, 44(%esp) + flds 44(%esp) + flds 44(%esp) + fmulp %st, %st(1) + fstps 44(%esp) +..B3.19: + movl 20(%esp), %ebx + movl 32(%esp), %eax + negl %eax + movl 8(%ebx), %ebp + addl %edi, %eax + movl %ebp, 16(%esp) + movl 12(%ebx), %ebp + xorl %ebx, %ebx + orl %ebx, %eax + je ..B3.35 +..B3.20: + movl $3, %eax + negl %eax + addl %edi, %eax + orl %ebx, %eax + je ..B3.25 +..B3.21: + movl $4, %eax + negl %eax + addl %edi, %eax + orl %ebx, %eax + jne ..B3.23 +..B3.22: + andl $2147483647, %ebp + jmp ..B3.26 +..B3.23: + movl $5, %ebx + subl %ebx, %edi + xorl %ebx, %ebx + orl %ebx, %edi + jne ..B3.26 +..B3.24: + movl 56(%esp), %ebx + andl $2147483647, %ebp + movl 12(%ebx), %edi + andl $-2147483648, %edi + orl %edi, %ebp + jmp ..B3.26 +..B3.25: + xorl $-2147483648, %ebp +..B3.26: + movl 160(%esp), %ebx + movl 16(%esp), %edi + testl $192, 36(%esp) + movl %ebp, 12(%ebx) + movl 20(%esp), %ebp + movl %edi, 8(%ebx) + movl (%ebp), %edi + movl 4(%ebp), %ebp + movl %edi, (%ebx) + movl %ebp, 4(%ebx) + je ..B3.30 +..B3.27: + xorl %ebx, %ebx + subl %ebx, %edx + jl ..B3.28 +..B3.73: + orl %edx, %ecx + jne ..B3.30 +..B3.28: + movl 164(%esp), %edx + movl 8(%edx), %ebx + orl 12(%edx), %ebx + je ..B3.30 +..B3.29: + movl 52(%esp), %edx + movl $8388608, 40(%esp) + flds 40(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%edx) + fmulp %st, %st(1) + fstps 40(%esp) +..B3.30: + movl 116(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B3.34 +..B3.31: + movl %esi, %eax + movl $-2147483648, %edx + addl $124, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B3.32: + movl 116(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B3.34 +..B3.33: + movl %esi, %eax + xorl %edx, %edx + addl $124, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B3.34: + movl 52(%esp), %ebx + call __stack_chk_fail@PLT +..B3.35: + orl $32768, %ebp + jmp ..B3.26 +..B3.36: + movl 160(%esp), %edi + andl $-2013265921, %ecx + orl $268435456, %ecx + movl %ecx, 56(%esp) + movl (%edi), %ebx + movl 4(%edi), %ebp + movl %ebx, 84(%esp) + movl %ebp, 88(%esp) + movl 8(%edi), %ebx + movl 12(%edi), %ebp + movl %ebx, 92(%esp) + movl %ebp, 96(%esp) + movl %edx, 60(%esp) + addl $4, %esp + lea 52(%esp), %edx + pushl %edx + call __dpml_exception +..B3.37: + movl 160(%esp), %ecx + movl (%eax), %edx + movl 4(%eax), %ebx + movl %edx, (%ecx) + movl %ebx, 4(%ecx) + movl 8(%eax), %ebp + movl 12(%eax), %edi + movl %ebp, 8(%ecx) + movl %edi, 12(%ecx) + jmp ..B3.30 +..B3.39: + movl 24(%esp), %ecx + xorl %eax, %eax + xorl %edx, %ecx + subl %eax, %ecx + jl ..B3.43 +..B3.40: + movl 64(%esp), %eax + orl %ebp, %ebx + movl 72(%esp), %ecx + movl %edi, 8(%eax) + movl 20(%esp), %edi + movl %ecx, 16(%eax) + movl %edi, 12(%eax) + movl 68(%esp), %ecx + movl 16(%esp), %edi + movl %ecx, 20(%eax) + movl %edi, 4(%eax) + jne ..B3.42 +..B3.41: + movl $2, %edx + jmp ..B3.3 +..B3.42: + shrl $15, %edx + movl %edx, %esi + xorl %edx, %edx + andl $1, %esi + jmp ..B3.3 +..B3.43: + orl %ebp, %ebx + jne ..B3.45 +..B3.44: + movl 64(%esp), %eax + movl 72(%esp), %edx + movl 68(%esp), %ebx + movl %edi, 8(%eax) + movl 20(%esp), %edi + movl 16(%esp), %ebp + movl %edx, 16(%eax) + movl $8, %edx + movl %ebx, 20(%eax) + movl %edi, 12(%eax) + movl %ebp, 4(%eax) + jmp ..B3.3 +..B3.45: + movl 20(%esp), %ebx + xorl %edx, %edx + addl $-2147483648, %ebx + movl %ebx, %eax + addl $-16381, 60(%esp) + movl %ebx, 20(%esp) + subl %edx, %eax + movl %edi, 36(%esp) + jl ..B3.69 +..B3.46: + movl 72(%esp), %edx + xorl %ecx, %ecx + movl %edx, 24(%esp) + movl $2, %eax + movl %edi, 76(%esp) + xorl %ebp, %ebp + movl 68(%esp), %edx + movl 24(%esp), %edi + movl %ecx, 32(%esp) + movl %esi, 16(%esp) + jmp ..B3.47 +..B3.49: + xorl %edi, %edi + xorl %edx, %edx +..B3.47: + movl 36(%esp), %esi + orl %ebx, %esi + jne ..B3.52 +..B3.48: + addl $64, 32(%esp) + movl %edx, %ebx + movl %edi, 36(%esp) + adcl $0, %ebp + addl $-1, %eax + movl %eax, %edx + adcl $-1, %ecx + orl %ecx, %edx + jne ..B3.49 +..B3.50: + movl 64(%esp), %ebp + movl 76(%esp), %edi + movl 72(%esp), %edx + movl %edi, 8(%ebp) + movl 68(%esp), %ebx + movl 20(%esp), %edi + movl 16(%esp), %esi + movl %edx, 16(%ebp) + movl %ebx, 20(%ebp) + movl %edi, 12(%ebp) + movl $-262144, 4(%ebp) +..B3.51: + movl $2048, 28(%esp) + movl $6, %edx + flds 28(%esp) + flds 28(%esp) + faddp %st, %st(1) + fstps 28(%esp) + jmp ..B3.3 +..B3.52: + movl %edi, 24(%esp) + movl %ebx, %edi + xorl %ebp, %ebp + movl 16(%esp), %esi + subl %ebp, %edi + jl ..B3.68 +..B3.53: + movl %ebx, %ecx + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %ebp + je ..B3.55 +..B3.54: + movl $21932, %eax + shrl %cl, %eax + andl $3, %eax + incl %eax + jmp ..B3.58 +..B3.55: + movl 36(%esp), %edi + movl %ebx, %ebp + andl $-256, %edi + orl %edi, %ebp + jne ..B3.57 +..B3.56: + movl 36(%esp), %edi +..B3.57: + movl %edi, 16(%esp) + movl %ebx, %edi + movl %ebx, 20(%esp) + fildll 16(%esp) + shrl $31, %edi + movl 52(%esp), %ebp + faddl .L_2il0floatpacket.1@GOTOFF(%ebp,%edi,8) + fstpl 68(%esp) + movl 72(%esp), %eax + sarl $20, %eax + negl %eax + addl $1086, %eax +..B3.58: + cmpl $31, %eax + jbe ..B3.60 +..B3.59: + movl %eax, %ecx + xorl %edi, %edi + movl 36(%esp), %ebx + shll %cl, %ebx + jmp ..B3.61 +..B3.60: + movl %eax, %ecx + movl 36(%esp), %edi + shldl %cl, %edi, %ebx + shll %cl, %edi +..B3.61: + movl %eax, %ecx + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B3.63 +..B3.62: + movl %edx, %ebp + shrl %cl, %ebp + movl $0, 16(%esp) + movl %ebp, 36(%esp) + jmp ..B3.64 +..B3.63: + movl 24(%esp), %ebp + shrdl %cl, %edx, %ebp + movl %ebp, 36(%esp) + movl %edx, %ebp + shrl %cl, %ebp + movl %ebp, 16(%esp) +..B3.64: + orl %edi, 36(%esp) + orl 16(%esp), %ebx + movl 24(%esp), %ebp + cmpl $31, %eax + jbe ..B3.66 +..B3.65: + movl %eax, %ecx + movl %ebp, %edx + movl $0, 24(%esp) + shll %cl, %edx + jmp ..B3.67 +..B3.66: + movl %eax, %ecx + shldl %cl, %ebp, %edx + shll %cl, %ebp + movl %ebp, 24(%esp) +..B3.67: + addl %eax, 32(%esp) +..B3.68: + movl 64(%esp), %edi + movl 36(%esp), %ebp + movl %edx, 20(%edi) + movl 60(%esp), %edx + movl %ebx, 12(%edi) + movl 24(%esp), %ebx + subl 32(%esp), %edx + movl %ebp, 8(%edi) + movl %ebx, 16(%edi) + movl %edx, 4(%edi) + jmp ..B3.51 +..B3.69: + movl 64(%esp), %eax + movl 72(%esp), %edx + movl 68(%esp), %ebx + movl %edi, 8(%eax) + movl 20(%esp), %edi + movl 60(%esp), %ebp + movl %edx, 16(%eax) + movl %ebx, 20(%eax) + movl %edi, 12(%eax) + movl %ebp, 4(%eax) + jmp ..B3.51 + .align 16,0x90 + .type __dpml_unpack_x_or_y__..0,@function + .size __dpml_unpack_x_or_y__..0,.-__dpml_unpack_x_or_y__..0 + .data +# -- End __dpml_unpack_x_or_y__..0 + .text +# -- Begin __dpml_unpack_x_or_y__ + .text + .align 16,0x90 + .hidden __dpml_unpack_x_or_y__ + .globl __dpml_unpack_x_or_y__ +__dpml_unpack_x_or_y__: +# parameter 1: %eax +# parameter 2: %edx +# parameter 3: %ecx +# parameter 4: 172 + %esp +# parameter 5: 176 + %esp +# parameter 6: 180 + %esp +..B4.1: +..L6: + + movl 4(%esp), %eax + movl 8(%esp), %edx + movl 12(%esp), %ecx + .hidden __dpml_unpack_x_or_y__. + .globl __dpml_unpack_x_or_y__. +__dpml_unpack_x_or_y__.: + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $140, %esp + xorl %edi, %edi + testl %edx, %edx + movl %eax, 68(%esp) + movl %edi, %eax + movl %ecx, 88(%esp) + setne %al + movl %edx, 60(%esp) + movl %gs:20, %ebp + xorl %esp, %ebp + movl %ebp, 128(%esp) + orl %eax, %edi + movl %eax, 56(%esp) + je ..B4.3 +..B4.2: + movl %edx, %eax + jmp ..B4.4 +..B4.3: + movl 68(%esp), %eax +..B4.4: + movl 180(%esp), %edx + movl 56(%esp), %ebx + movl 8(%eax), %esi + movl %eax, 20(%edx,%ebx,4) + movl 12(%eax), %edx + movl %edx, %edi + movl %edx, %ebp + shrl $16, %edi + andl $-2147483648, %ebp + movl %ecx, %ebx + andl $32767, %edi + movl %edx, %ecx + shll $15, %ecx + movl %ebp, (%ebx) + movl %esi, %ebx + shrl $17, %ebx + lea -16382(%edi), %ebp + movl %edi, 72(%esp) + orl %ecx, %ebx + movl (%eax), %edi + orl $-2147483648, %ebx + movl 4(%eax), %eax + movl %eax, %ecx + shll $15, %esi + movl %ebp, 24(%esp) + movl %esi, %ebp + shrl $17, %ecx + addl %esi, %ebp + movl %ebx, 20(%esp) + adcl %ebx, %ebx + orl %ecx, %esi + movl %esi, 84(%esp) + movl %edi, %esi + shll $15, %esi + movl %edi, %ecx + movl %esi, 80(%esp) + movl %eax, %esi + shrl $17, %ecx + orl %edi, %ebp + shll $15, %esi + orl %eax, %ebx + orl %esi, %ecx + lea -65536(%edx), %edi + movl %edx, %esi + lea 65536(%edx), %eax + movl %edi, 16(%esp) + xorl %edi, %eax + xorl %edi, %edi + shrl $31, %esi + movl %ecx, 76(%esp) + subl %edi, %eax + call ..L7 +..L7: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L7](%edi), %edi + movl %edi, 64(%esp) + movl 20(%esp), %edi + jl ..B4.42 +..B4.5: + movl 88(%esp), %eax + movl 80(%esp), %edx + movl %ecx, %ebx + movl %edi, 12(%eax) + movl 84(%esp), %ebp + movl 24(%esp), %edi + movl %edx, 16(%eax) + movl $4, %edx + movl %ebx, 20(%eax) + movl %ebp, 8(%eax) + movl %edi, 4(%eax) +..B4.6: + movl 180(%esp), %eax + addl %edx, %esi + movl $1, %edx + movl %esi, %ecx + movl %edx, 28(%esp) + movl (%eax), %ebp + movl %ebp, %edi + shll %cl, %edx + shll $10, %ebp + movl 4(%eax), %ebx + orl %edx, %ebp + shrl $22, %edi + shll $10, %ebx + movl %edx, 36(%esp) + xorl %edx, %edx + orl %ebx, %edi + movl %ebp, (%eax) + orl %esi, %edx + movl %edi, 4(%eax) + jne ..B4.8 +..B4.7: + movl $2139095040, 52(%esp) + flds 52(%esp) + flds 52(%esp) + fsubrp %st, %st(1) + fstps 52(%esp) +..B4.8: + movl $6, %eax + mull %esi + movl 172(%esp), %ebx + cmpl $31, %eax + movl (%ebx), %edx + movl 4(%ebx), %ebp + jbe ..B4.10 +..B4.9: + movl %eax, %ecx + movl %ebp, %edx + sarl %cl, %edx + jmp ..B4.11 +..B4.10: + movl %eax, %ecx + shrdl %cl, %ebp, %edx +..B4.11: + movl %edx, %ecx + xorl %ebx, %ebx + shrl $3, %edx + xorl %edi, %edi + andl $7, %edx + andl $7, %ecx + shrl $28, %ebp + orl %edx, %edi + je ..B4.35 +..B4.12: + movl %ecx, %edi + movl 36(%esp), %eax + andl $240, %eax + subl 56(%esp), %edi + movl %eax, 16(%esp) + movl %edi, 24(%esp) + movl %ebx, %edi + sbbl %ebx, %edi + movl %edi, 20(%esp) + jl ..B4.13 +..B4.75: + movl 24(%esp), %eax + orl 20(%esp), %eax + jne ..B4.17 +..B4.13: + movl %ecx, %ebp + orl %ebx, %ebp + jne ..B4.16 +..B4.14: + movl 68(%esp), %ebp + movl %ebp, 60(%esp) +..B4.16: + movl 16(%esp), %ebp + jmp ..B4.18 +..B4.17: + addl %ecx, %ebp + movl 172(%esp), %ebx + movl 64(%esp), %eax + movl -8(%ebx,%ebp,8), %ecx + movl %ecx, %edi + shll $4, %edi + movl -4(%ebx,%ebp,8), %ebx + movl 28(%esp), %ebp + shll %cl, %ebp + addl __x_constants__@GOT(%eax), %edi + andl $240, %ebp + movl %edi, 60(%esp) +..B4.18: + movl $7, %edi + xorl %eax, %eax + negl %edi + addl %edx, %edi + orl %eax, %edi + je ..B4.39 +..B4.19: + movl 180(%esp), %eax + movl 8(%eax), %edi + orl 12(%eax), %edi + je ..B4.22 +..B4.20: + orl 16(%esp), %ebp + xorl %eax, %eax + orl %eax, %ebp + je ..B4.22 +..B4.21: + movl $1182793727, 48(%esp) + flds 48(%esp) + flds 48(%esp) + fmulp %st, %st(1) + fstps 48(%esp) +..B4.22: + movl 60(%esp), %eax + xorl %edi, %edi + movl 8(%eax), %ebp + movl %ebp, 16(%esp) + movl 12(%eax), %ebp + movl 28(%esp), %eax + negl %eax + addl %edx, %eax + orl %edi, %eax + je ..B4.38 +..B4.23: + movl $3, %edi + xorl %eax, %eax + negl %edi + addl %edx, %edi + orl %eax, %edi + je ..B4.28 +..B4.24: + movl $4, %edi + negl %edi + addl %edx, %edi + orl %eax, %edi + jne ..B4.26 +..B4.25: + andl $2147483647, %ebp + jmp ..B4.29 +..B4.26: + movl $5, %eax + xorl %edi, %edi + subl %eax, %edx + orl %edi, %edx + jne ..B4.29 +..B4.27: + movl 68(%esp), %edx + andl $2147483647, %ebp + movl 12(%edx), %edx + andl $-2147483648, %edx + orl %edx, %ebp + jmp ..B4.29 +..B4.28: + xorl $-2147483648, %ebp +..B4.29: + movl 176(%esp), %edx + movl 16(%esp), %eax + testl $192, 36(%esp) + movl %ebp, 12(%edx) + movl 60(%esp), %ebp + movl %eax, 8(%edx) + movl (%ebp), %edi + movl 4(%ebp), %ebp + movl %edi, (%edx) + movl %ebp, 4(%edx) + je ..B4.33 +..B4.30: + xorl %edx, %edx + subl 56(%esp), %ecx + sbbl %edx, %ebx + jl ..B4.31 +..B4.76: + orl %ebx, %ecx + jne ..B4.33 +..B4.31: + movl 180(%esp), %edx + movl 8(%edx), %ebx + orl 12(%edx), %ebx + je ..B4.33 +..B4.32: + movl 64(%esp), %edx + movl $8388608, 44(%esp) + flds 44(%esp) + fldt .L_2il0floatpacket.8@GOTOFF(%edx) + fmulp %st, %st(1) + fstps 44(%esp) +..B4.33: + movl 128(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B4.37 +..B4.34: + movl %esi, %eax + movl $-2147483648, %edx + addl $140, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B4.35: + movl 128(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B4.37 +..B4.36: + movl %esi, %eax + xorl %edx, %edx + addl $140, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B4.37: + movl 64(%esp), %ebx + call __stack_chk_fail@PLT +..B4.38: + orl $32768, %ebp + jmp ..B4.29 +..B4.39: + movl 176(%esp), %eax + andl $-2013265921, %ecx + orl $268435456, %ecx + movl %ecx, 68(%esp) + movl (%eax), %edx + movl 4(%eax), %ebp + movl %edx, 96(%esp) + movl %ebp, 100(%esp) + movl 8(%eax), %edx + movl 12(%eax), %ebp + movl %edx, 104(%esp) + movl %ebp, 108(%esp) + movl %ebx, 72(%esp) + addl $4, %esp + lea 64(%esp), %ebx + pushl %ebx + call __dpml_exception +..B4.40: + movl 176(%esp), %ecx + movl (%eax), %edx + movl 4(%eax), %ebx + movl %edx, (%ecx) + movl %ebx, 4(%ecx) + movl 8(%eax), %ebp + movl 12(%eax), %edi + movl %ebp, 8(%ecx) + movl %edi, 12(%ecx) + jmp ..B4.33 +..B4.42: + movl 16(%esp), %ecx + xorl %eax, %eax + xorl %edx, %ecx + subl %eax, %ecx + jl ..B4.46 +..B4.43: + movl 88(%esp), %eax + orl %ebx, %ebp + movl 80(%esp), %ecx + movl %ecx, 16(%eax) + movl 76(%esp), %ecx + movl %ecx, 20(%eax) + movl %edi, 12(%eax) + movl 84(%esp), %ecx + movl 24(%esp), %edi + movl %ecx, 8(%eax) + movl %edi, 4(%eax) + jne ..B4.45 +..B4.44: + movl $2, %edx + jmp ..B4.6 +..B4.45: + shrl $15, %edx + movl %edx, %esi + xorl %edx, %edx + andl $1, %esi + jmp ..B4.6 +..B4.46: + orl %ebx, %ebp + jne ..B4.48 +..B4.47: + movl 88(%esp), %eax + movl 80(%esp), %edx + movl 76(%esp), %ebx + movl %edi, 12(%eax) + movl 84(%esp), %ebp + movl 24(%esp), %edi + movl %edx, 16(%eax) + movl $8, %edx + movl %ebx, 20(%eax) + movl %ebp, 8(%eax) + movl %edi, 4(%eax) + jmp ..B4.6 +..B4.48: + addl $-2147483648, %edi + movl %edi, %ebp + addl $-16381, 72(%esp) + movl 84(%esp), %edx + subl %eax, %ebp + movl %edi, 40(%esp) + jl ..B4.72 +..B4.49: + movl 80(%esp), %ebp + movl 76(%esp), %ebx + movl %ebp, 28(%esp) + movl $2, %ebp + movl %ebx, 24(%esp) + xorl %ebx, %ebx + movl %edi, 20(%esp) + movl %esi, 16(%esp) + movl %eax, 36(%esp) + movl 28(%esp), %esi + movl 24(%esp), %edi + jmp ..B4.50 +..B4.52: + xorl %esi, %esi + xorl %edi, %edi +..B4.50: + movl %edx, %ecx + orl 40(%esp), %ecx + jne ..B4.55 +..B4.51: + addl $64, 36(%esp) + movl %esi, %edx + movl %edi, 40(%esp) + adcl $0, %ebx + addl $-1, %ebp + movl %ebp, %ecx + adcl $-1, %eax + orl %eax, %ecx + jne ..B4.52 +..B4.53: + movl 88(%esp), %eax + movl 20(%esp), %edi + movl 80(%esp), %edx + movl 76(%esp), %ebx + movl 84(%esp), %ebp + movl 16(%esp), %esi + movl %edx, 16(%eax) + movl %ebx, 20(%eax) + movl %ebp, 8(%eax) + movl %edi, 12(%eax) + movl $-262144, 4(%eax) +..B4.54: + movl $2048, 32(%esp) + movl $6, %edx + flds 32(%esp) + flds 32(%esp) + faddp %st, %st(1) + fstps 32(%esp) + jmp ..B4.6 +..B4.55: + xorl %ebx, %ebx + movl 40(%esp), %ebp + movl %esi, 28(%esp) + subl %ebx, %ebp + movl %edi, 24(%esp) + movl 16(%esp), %esi + jl ..B4.71 +..B4.56: + movl 40(%esp), %ecx + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %ebx + je ..B4.58 +..B4.57: + movl $21932, %ebp + shrl %cl, %ebp + andl $3, %ebp + incl %ebp + jmp ..B4.61 +..B4.58: + movl %edx, %ebp + andl $-256, %ebp + movl 40(%esp), %ebx + orl %ebp, %ebx + jne ..B4.60 +..B4.59: + movl %edx, %ebp +..B4.60: + movl 40(%esp), %ebx + movl %ebp, 16(%esp) + movl %ebx, 20(%esp) + fildll 16(%esp) + shrl $31, %ebx + movl 64(%esp), %ebp + faddl .L_2il0floatpacket.1@GOTOFF(%ebp,%ebx,8) + fstpl 76(%esp) + movl 80(%esp), %ebp + sarl $20, %ebp + negl %ebp + addl $1086, %ebp +..B4.61: + cmpl $31, %ebp + jbe ..B4.63 +..B4.62: + movl %ebp, %ecx + xorl %ebx, %ebx + shll %cl, %edx + movl %edx, 40(%esp) + jmp ..B4.64 +..B4.63: + movl %ebp, %ecx + movl 40(%esp), %ebx + shldl %cl, %edx, %ebx + movl %ebx, 40(%esp) + movl %edx, %ebx + shll %cl, %ebx +..B4.64: + movl %ebp, %ecx + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B4.66 +..B4.65: + movl %edi, %edx + xorl %edi, %edi + shrl %cl, %edx + jmp ..B4.67 +..B4.66: + movl 28(%esp), %edx + shrdl %cl, %edi, %edx + shrl %cl, %edi +..B4.67: + orl %edi, 40(%esp) + orl %ebx, %edx + movl 28(%esp), %ebx + cmpl $31, %ebp + jbe ..B4.69 +..B4.68: + movl %ebp, %ecx + shll %cl, %ebx + movl $0, 28(%esp) + movl %ebx, 24(%esp) + jmp ..B4.70 +..B4.69: + movl %ebp, %ecx + movl 24(%esp), %edi + shldl %cl, %ebx, %edi + shll %cl, %ebx + movl %edi, 24(%esp) + movl %ebx, 28(%esp) +..B4.70: + addl %ebp, 36(%esp) +..B4.71: + movl 88(%esp), %eax + movl 72(%esp), %edi + movl 28(%esp), %ebx + movl %edx, 8(%eax) + movl 40(%esp), %edx + movl 24(%esp), %ebp + subl 36(%esp), %edi + movl %edx, 12(%eax) + movl %ebx, 16(%eax) + movl %ebp, 20(%eax) + movl %edi, 4(%eax) + jmp ..B4.54 +..B4.72: + movl 88(%esp), %eax + movl 80(%esp), %edx + movl 76(%esp), %ebx + movl %edi, 12(%eax) + movl 84(%esp), %ebp + movl 72(%esp), %edi + movl %edx, 16(%eax) + movl %ebx, 20(%eax) + movl %ebp, 8(%eax) + movl %edi, 4(%eax) + jmp ..B4.54 + .align 16,0x90 + .type __dpml_unpack_x_or_y__,@function + .size __dpml_unpack_x_or_y__,.-__dpml_unpack_x_or_y__ + .data +# -- End __dpml_unpack_x_or_y__ + .text +# -- Begin __dpml_pack__ + .text + .align 16,0x90 + .hidden __dpml_pack__ + .globl __dpml_pack__ +__dpml_pack__: +# parameter 1: 160 + %esp +# parameter 2: 164 + %esp +# parameter 3: 168 + %esp +# parameter 4: 176 + %esp +# parameter 5: 184 + %esp +..B5.1: +..L8: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $140, %esp + movl 160(%esp), %edx + call ..L9 +..L9: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L9](%ecx), %ecx + movl %ecx, 48(%esp) + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 136(%esp) + movl 12(%edx), %esi + movl %esi, %edi + movl 8(%edx), %ecx + movl %ecx, %ebp + movl 4(%edx), %eax + xorl %edx, %edx + movl %esi, %ebx + subl %edx, %edi + jl ..B5.7 +..B5.2: + movl 160(%esp), %edi + movl $2, 32(%esp) + movl %ebx, 68(%esp) + movl 16(%edi), %edx + movl %edx, 56(%esp) + movl 20(%edi), %edx + xorl %edi, %edi + movl %edi, 52(%esp) + movl %esi, 44(%esp) + movl %ecx, 36(%esp) + movl %eax, 60(%esp) + movl %ebp, 64(%esp) + movl 56(%esp), %esi + movl %edi, %ebx + movl 52(%esp), %eax + movl 32(%esp), %ecx + jmp ..B5.3 +..B5.5: + xorl %esi, %esi + xorl %edx, %edx +..B5.3: + movl 64(%esp), %ebp + orl 68(%esp), %ebp + jne ..B5.47 +..B5.4: + addl $64, %eax + movl %edx, 68(%esp) + adcl $0, %ebx + addl $-1, %ecx + movl %ecx, %edx + adcl $-1, %edi + movl %esi, 64(%esp) + orl %edi, %edx + jne ..B5.5 +..B5.6: + movl 160(%esp), %eax + movl 44(%esp), %esi + movl 36(%esp), %ecx + movl $-262144, 4(%eax) + movl $-262144, %eax +..B5.7: + cmpl $-262144, %eax + je ..B5.44 +..B5.8: + movl $-16381, %ebx + movl $-1, %ebp + cltd + subl %eax, %ebx + sbbl %edx, %ebp + xorl %edi, %edi + movl %ebp, %edx + subl %edi, %edx + jl ..B5.16 +..B5.66: + orl %ebx, %edx + je ..B5.16 +..B5.9: + movl 160(%esp), %edx + addl %ebx, %eax + movl %eax, 116(%esp) + lea 112(%esp), %eax + movl %edx, %ecx + movl (%edx), %esi + movl %edi, 8(%esp) + movl %edi, 8(%eax) + movl $-2147483648, 12(%eax) + movl %edi, 16(%eax) + movl %edi, 20(%eax) + movl %esi, (%eax) + movl %edi, 12(%esp) + call __dpml_addsub__..0 +..B5.10: + movl $113, %eax + movl %ebx, %ecx + subl %eax, %ecx + movl %ebp, %eax + sbbl %edi, %eax + jl ..B5.15 +..B5.67: + orl %eax, %ecx + je ..B5.15 +..B5.11: + movl $245763, %eax + negl %eax + addl %ebx, %eax + orl %ebp, %eax + je ..B5.39 +..B5.12: + movl $49155, %edx + movl $-16383, %eax + subl %edx, %ebx + sbbl %edi, %ebp + jl ..B5.14 +..B5.68: + orl %ebp, %ebx + je ..B5.14 +..B5.13: + movl 160(%esp), %edx + decl %eax + movl 8(%edx), %ecx + movl 12(%edx), %esi + jmp ..B5.16 +..B5.14: + movl 160(%esp), %edx + movl 8(%edx), %ecx + movl 12(%edx), %esi + jmp ..B5.16 +..B5.15: + movl 160(%esp), %edx + movl $-16382, %eax + movl 8(%edx), %ecx + movl 12(%edx), %esi +..B5.16: + movl 160(%esp), %ebx + movl $16384, %edx + movl 16(%ebx), %edi + addl $16384, %edi + movl %edi, %ebp + movl 20(%ebx), %ebx + adcl $0, %ebx + subl %edx, %ebp + movl $0, %edx + movl %ebx, %ebp + sbbl %edx, %ebp + jae ..B5.18 +..B5.17: + movl $1, %ebp + jmp ..B5.19 +..B5.18: + xorl %ebp, %ebp +..B5.19: + movl %ebx, %edx + addl %ebp, %ecx + adcl $0, %esi + shll $17, %edx + shrl $15, %edi + orl %edi, %edx + movl %ecx, %edi + shrl $15, %ebx + subl %ebp, %edi + movl $0, %ebp + movl %esi, %edi + sbbl %ebp, %edi + jae ..B5.22 +..B5.20: + movl $1, %ebp +..B5.22: + movl %ecx, %edi + shll $17, %edi + orl %edi, %ebx + movl 164(%esp), %edi + shrl $15, %ecx + movl %ebx, 4(%edi) + movl %esi, %ebx + shll $17, %ebx + movl %edx, (%edi) + xorl %edx, %edx + shrl $15, %esi + orl %ecx, %ebx + orl %edx, %ebp + je ..B5.24 +..B5.23: + incl %eax + xorl %ebx, %ebx + movl $65536, %esi +..B5.24: + movl %eax, %ecx + cltd + addl $16381, %ecx + movl %edx, %ebp + movl %ecx, %edx + adcl $0, %ebp + shll $16, %edx + addl %esi, %edx + movl 160(%esp), %esi + movl (%esi), %edi + orl %edi, %edx + movl %edi, 32(%esp) + movl $32766, %esi + movl %ecx, %edi + subl %esi, %edi + movl $0, %esi + sbbl %esi, %ebp + jae ..B5.29 +..B5.25: + movl 164(%esp), %eax + movl %edx, 12(%eax) + movl 184(%esp), %edx + movl %ebx, 8(%eax) + movl 8(%edx), %ecx + orl 12(%edx), %ecx + je ..B5.27 +..B5.26: + movl $1182793727, 40(%esp) + flds 40(%esp) + flds 40(%esp) + fmulp %st, %st(1) + fstps 40(%esp) +..B5.27: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B5.40 +..B5.28: + addl $140, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B5.29: + testl %eax, %eax + movl 168(%esp), %ebp + movl 172(%esp), %eax + jl ..L10 + movl 176(%esp), %ebp +..L10: + jl ..L11 + movl 180(%esp), %eax +..L11: + incl %ecx + testl %ecx, %ecx + jg ..B5.35 +..B5.30: + js ..B5.42 +..B5.31: + movl 164(%esp), %ecx + movl %edx, 12(%ecx) + movl 184(%esp), %edx + movl %ebx, 8(%ecx) + movl 8(%edx), %ebx + orl 12(%edx), %ebx + je ..B5.33 +..B5.32: + orl $-2147483648, %eax + jmp ..B5.36 +..B5.33: + movl 136(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B5.40 +..B5.34: + addl $140, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B5.35: + movl 164(%esp), %ecx + movl %ebx, 8(%ecx) + movl %edx, 12(%ecx) +..B5.36: + movl 164(%esp), %ebx + andl $-2013265921, %ebp + orl $268435456, %ebp + movl %ebp, 52(%esp) + movl (%ebx), %edx + movl 4(%ebx), %ecx + movl 8(%ebx), %esi + movl 12(%ebx), %edi + movl %edx, 80(%esp) + movl %ecx, 84(%esp) + movl %esi, 88(%esp) + movl %edi, 92(%esp) + movl %eax, 56(%esp) + addl $4, %esp + lea 48(%esp), %eax + pushl %eax + call __dpml_exception +..B5.69: + movl %eax, %ecx +..B5.37: + movl 164(%esp), %ebp + movl (%ecx), %eax + movl 4(%ecx), %edx + movl %eax, (%ebp) + movl %edx, 4(%ebp) + movl 8(%ecx), %ebx + movl 12(%ecx), %ecx + movl %ebx, 8(%ebp) + movl %ecx, 12(%ebp) + movl 136(%esp), %esi + xorl %esp, %esi + cmpl %gs:20, %esi + jne ..B5.40 +..B5.38: + addl $140, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B5.39: + movl $-16382, %eax + jmp ..B5.13 +..B5.40: + movl 48(%esp), %ebx + call __stack_chk_fail@PLT +..B5.42: + movl 164(%esp), %ecx + movl 32(%esp), %edx + movl $0, 8(%ecx) + movl %edx, 12(%ecx) + jmp ..B5.36 +..B5.44: + movl 160(%esp), %eax + xorl %edx, %edx + movl 164(%esp), %ebx + movl (%eax), %ecx + movl %edx, (%ebx) + movl %edx, 4(%ebx) + movl %edx, 8(%ebx) + movl %ecx, 12(%ebx) + movl 136(%esp), %ebp + xorl %esp, %ebp + cmpl %gs:20, %ebp + jne ..B5.40 + jmp ..B5.28 +..B5.47: + movl 68(%esp), %ebx + xorl %ecx, %ecx + movl %esi, 56(%esp) + movl %ebx, %esi + movl %eax, 52(%esp) + subl %ecx, %esi + movl 60(%esp), %eax + movl 64(%esp), %ebp + jl ..B5.63 +..B5.48: + movl %ebx, %ecx + xorl %esi, %esi + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %esi + je ..B5.50 +..B5.49: + movl $21932, %esi + shrl %cl, %esi + andl $3, %esi + incl %esi + jmp ..B5.53 +..B5.50: + movl %ebp, %esi + movl %ebx, %ecx + andl $-256, %esi + orl %esi, %ecx + jne ..B5.52 +..B5.51: + movl %ebp, %esi +..B5.52: + movl %esi, 32(%esp) + movl %ebx, %esi + movl %ebx, 36(%esp) + fildll 32(%esp) + shrl $31, %esi + movl 48(%esp), %ecx + faddl .L_2il0floatpacket.1@GOTOFF(%ecx,%esi,8) + fstpl 60(%esp) + movl 64(%esp), %esi + sarl $20, %esi + negl %esi + addl $1086, %esi +..B5.53: + cmpl $31, %esi + jbe ..B5.55 +..B5.54: + movl %esi, %ecx + movl %ebp, %ebx + movl $0, 32(%esp) + shll %cl, %ebx + jmp ..B5.56 +..B5.55: + movl %esi, %ecx + shldl %cl, %ebp, %ebx + shll %cl, %ebp + movl %ebp, 32(%esp) +..B5.56: + movl %esi, %ecx + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B5.58 +..B5.57: + movl %edx, %ebp + movl $0, 36(%esp) + shrl %cl, %ebp + jmp ..B5.59 +..B5.58: + movl %edx, %edi + movl 56(%esp), %ebp + shrl %cl, %edi + shrdl %cl, %edx, %ebp + movl %edi, 36(%esp) +..B5.59: + orl 32(%esp), %ebp + orl 36(%esp), %ebx + movl 56(%esp), %edi + cmpl $31, %esi + jbe ..B5.61 +..B5.60: + movl %esi, %ecx + movl %edi, %edx + movl $0, 56(%esp) + shll %cl, %edx + jmp ..B5.62 +..B5.61: + movl %esi, %ecx + shldl %cl, %edi, %edx + shll %cl, %edi + movl %edi, 56(%esp) +..B5.62: + addl %esi, 52(%esp) +..B5.63: + movl 160(%esp), %edi + movl %ebx, %esi + subl 52(%esp), %eax + movl %ebp, %ecx + movl %ebx, 12(%edi) + movl 56(%esp), %ebx + movl %ebp, 8(%edi) + movl %ebx, 16(%edi) + movl %edx, 20(%edi) + movl %eax, 4(%edi) + jmp ..B5.7 + .align 16,0x90 + .type __dpml_pack__,@function + .size __dpml_pack__,.-__dpml_pack__ + .data +# -- End __dpml_pack__ + .text +# -- Begin __dpml_addsub__..0 + .text + .align 16,0x90 +__dpml_addsub__..0: +# parameter 1: %eax +# parameter 2: %edx +# parameter 3: 184 + %esp +# parameter 4: %ecx +..B6.1: +..L12: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $156, %esp + movl %edx, %edi + movl %eax, %ebx + movl %ecx, 132(%esp) + movl %gs:20, %ebp + xorl %esp, %ebp + movl %ebp, 144(%esp) + movl (%ebx), %ebp + movl (%edi), %eax + xorl %ebp, %eax + shrl $31, %eax + movl 4(%ebx), %ecx + movl %eax, 124(%esp) + movl %ecx, %eax + cltd + movl 4(%edi), %eax + movl %edx, %esi + cltd + movl %edx, %eax + movl %ecx, %edx + subl 4(%edi), %edx + movl %ecx, 104(%esp) + sbbl %eax, %esi + xorl %eax, %eax + movl %esi, %ecx + movl $0, 112(%esp) + subl %eax, %ecx + movl 104(%esp), %eax + jl ..B6.3 +..B6.2: + movl $0, 92(%esp) + jmp ..B6.7 +..B6.3: + movl %ebx, %ecx + movl %edi, %ebx + movl %ecx, %edi + movl %edx, %ecx + xorl %edx, %edx + subl %ecx, %edx + movl %esi, %ecx + movl $0, %esi + sbbl %ecx, %esi + addl %edx, %eax + movl 124(%esp), %ecx + orl 112(%esp), %ecx + jne ..B6.5 +..B6.4: + xorl %ecx, %ecx + jmp ..B6.6 +..B6.5: + movl $-2147483648, %ecx +..B6.6: + movl $-2147483648, 92(%esp) + xorl %ecx, %ebp +..B6.7: + movl 16(%edi), %ecx + movl %ecx, 100(%esp) + movl 20(%edi), %ecx + movl %ecx, 96(%esp) + movl 8(%edi), %ecx + movl 12(%edi), %edi + movl %ecx, 120(%esp) + movl %edi, 116(%esp) + movl $2, %edi + movl $0, (%esp) + call ..L13 +..L13: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L13](%ecx), %ecx + movl %ebp, 108(%esp) + movl %ecx, 8(%esp) + movl %edi, 4(%esp) + movl %eax, 104(%esp) + movl %ebx, 128(%esp) + movl (%esp), %ebp + jmp ..B6.8 +..B6.10: + xorl %eax, %eax + movl %eax, 120(%esp) + movl %eax, 116(%esp) +..B6.8: + movl $64, %ebx + xorl %edi, %edi + xorl %eax, %eax + subl %edx, %ebx + sbbl %esi, %eax + movl %eax, %ecx + subl %edi, %ecx + jl ..B6.9 +..B6.85: + orl %ebx, %ecx + jne ..B6.14 +..B6.9: + movl 116(%esp), %esi + movl 120(%esp), %edx + movl %esi, 96(%esp) + xorl %esi, %esi + movl %edx, 100(%esp) + xorl %edx, %edx + subl %ebx, %edx + sbbl %eax, %esi + movl 4(%esp), %eax + addl $-1, %eax + movl %eax, 4(%esp) + adcl $-1, %ebp + orl %ebp, %eax + jne ..B6.10 +..B6.11: + movl 132(%esp), %eax + movl 128(%esp), %ebx + movl 8(%ebx), %ecx + movl 12(%ebx), %esi + movl %ecx, 8(%eax) + movl %esi, 12(%eax) + movl 4(%ebx), %edx + movl 16(%ebx), %edi + movl 20(%ebx), %ebx + movl 108(%esp), %ebp + movl %edx, 4(%eax) + movl %edi, 16(%eax) + movl %ebx, 20(%eax) + movl %ebp, (%eax) + movl 144(%esp), %ebp + xorl %esp, %ebp + cmpl %gs:20, %ebp + jne ..B6.13 +..B6.12: + addl $156, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B6.13: + movl 8(%esp), %ebx + call __stack_chk_fail@PLT +..B6.14: + movl %ebx, 4(%esp) + orl %edx, %esi + movl 108(%esp), %ebp + movl 104(%esp), %eax + movl 128(%esp), %ebx + je ..B6.25 +..B6.15: + cmpl $31, %edx + jbe ..B6.17 +..B6.16: + movl %edx, %ecx + xorl %esi, %esi + movl 96(%esp), %edi + shrl %cl, %edi + movl %edi, 100(%esp) + jmp ..B6.18 +..B6.17: + movl %edx, %ecx + movl 100(%esp), %edi + movl 96(%esp), %esi + shrdl %cl, %esi, %edi + movl %edi, 100(%esp) + shrl %cl, %esi +..B6.18: + cmpl $31, 4(%esp) + jbe ..B6.20 +..B6.19: + movl 4(%esp), %ecx + movl 120(%esp), %edi + shll %cl, %edi + movl $0, (%esp) + movl %edi, 96(%esp) + jmp ..B6.21 +..B6.20: + movl %ebp, 108(%esp) + movl 4(%esp), %ecx + movl 116(%esp), %edi + movl 120(%esp), %ebp + shldl %cl, %ebp, %edi + shll %cl, %ebp + movl %ebp, (%esp) + movl %edi, 96(%esp) + movl 108(%esp), %ebp +..B6.21: + movl (%esp), %edi + orl %edi, 100(%esp) + orl %esi, 96(%esp) + movl 116(%esp), %esi + cmpl $31, %edx + jbe ..B6.23 +..B6.22: + movl %edx, %ecx + shrl %cl, %esi + movl $0, 116(%esp) + movl %esi, 120(%esp) +..B6.25: + xorl %esi, %esi + movl %ebp, 108(%esp) + movl %esi, 48(%esp) + movl %eax, 104(%esp) + movl %ebx, 128(%esp) + jmp ..B6.26 +..B6.23: + movl %edx, %ecx + movl 120(%esp), %edi + shrdl %cl, %esi, %edi + shrl %cl, %esi + movl %edi, 120(%esp) + movl %esi, 116(%esp) + jmp ..B6.25 +..B6.55: + movl 128(%esp), %edi + movl $1, %edx + movl 124(%esp), %eax + xorl %ecx, %ecx + subl %eax, %edx + movl 108(%esp), %ebp + movl 4(%edi), %eax + movl 112(%esp), %ebx + sbbl %ebx, %ecx + xorl 92(%esp), %ebp + xorl $2, %esi + addl $24, 132(%esp) + movl %edx, 124(%esp) + movl %ecx, 112(%esp) + movl %ebp, 108(%esp) + movl %eax, 104(%esp) +..B6.26: + movl 128(%esp), %edx + movl 124(%esp), %eax + orl 112(%esp), %eax + movl 16(%edx), %ebx + movl 20(%edx), %edx + jne ..B6.38 +..B6.27: + movl %ebx, %ebp + movl %edx, %ecx + addl 100(%esp), %ebp + movl %ebp, %eax + adcl 96(%esp), %ecx + andl $15, %esi + subl %ebx, %eax + movl %ecx, %ebx + movl $0, 48(%esp) + sbbl %edx, %ebx + jae ..B6.29 +..B6.28: + movl $1, 72(%esp) + jmp ..B6.30 +..B6.29: + movl $0, 72(%esp) +..B6.30: + movl 128(%esp), %edi + movl 72(%esp), %edx + movl 8(%edi), %ebx + movl %ebx, 52(%esp) + movl 120(%esp), %ebx + movl 12(%edi), %eax + addl %edx, %ebx + movl %eax, 80(%esp) + movl %ebx, %eax + movl 116(%esp), %edi + adcl $0, %edi + subl %edx, %eax + movl $0, %edx + movl %edi, %eax + sbbl %edx, %eax + jae ..B6.32 +..B6.31: + movl $1, 68(%esp) + jmp ..B6.33 +..B6.32: + movl $0, 68(%esp) +..B6.33: + movl 52(%esp), %eax + addl %eax, %ebx + movl %ebx, %edx + adcl 80(%esp), %edi + subl %eax, %edx + movl %edi, %eax + sbbl 80(%esp), %eax + jae ..B6.35 +..B6.34: + movl $1, %edx + jmp ..B6.36 +..B6.35: + xorl %edx, %edx +..B6.36: + movl 68(%esp), %eax + addl %edx, %eax + xorl %edx, %edx + orl %edx, %eax + je ..B6.52 +..B6.37: + movl %ecx, %eax + movl %ebx, %edx + shll $31, %eax + shrl $1, %ebp + orl %eax, %ebp + movl %edi, %eax + shrl $1, %ecx + shll $31, %edx + shll $31, %eax + orl %edx, %ecx + shrl $1, %edi + shrl $1, %ebx + orl $-2147483648, %edi + incl 104(%esp) + orl %eax, %ebx + jmp ..B6.52 +..B6.38: + addl $-8, %esi + movl 100(%esp), %ecx + adcl $-1, 48(%esp) + subl %ebx, %ecx + movl 96(%esp), %eax + sbbl %edx, %eax + jb ..B6.40 +..B6.86: + orl %eax, %ecx + je ..B6.40 +..B6.39: + movl $1, %eax + jmp ..B6.41 +..B6.40: + xorl %eax, %eax +..B6.41: + movl 128(%esp), %edi + movl %ebx, %ebp + subl 100(%esp), %ebp + movl %edx, %ecx + movl 116(%esp), %ebx + movl 8(%edi), %edx + movl %edx, 60(%esp) + movl 12(%edi), %edx + movl 120(%esp), %edi + sbbl 96(%esp), %ecx + addl %eax, %edi + movl %edi, 56(%esp) + adcl $0, %ebx + subl %eax, %edi + movl $0, %eax + movl %ebx, 76(%esp) + sbbl %eax, %ebx + jae ..B6.43 +..B6.42: + movl $1, 64(%esp) + jmp ..B6.44 +..B6.43: + movl $0, 64(%esp) +..B6.44: + movl 60(%esp), %eax + movl %eax, %ebx + subl 56(%esp), %ebx + movl %edx, %edi + sbbl 76(%esp), %edi + subl %ebx, %eax + sbbl %edi, %edx + jae ..B6.46 +..B6.45: + movl $1, %edx + jmp ..B6.47 +..B6.46: + xorl %edx, %edx +..B6.47: + movl 64(%esp), %eax + addl %edx, %eax + xorl %edx, %edx + orl %edx, %eax + je ..B6.52 +..B6.48: + xorl %eax, %eax + movl %ebp, %edx + xorl %ebp, %ebp + subl %edx, %ebp + movl %ecx, %edx + movl %eax, %ecx + movl %ebp, %eax + sbbl %edx, %ecx + xorl $-2147483648, 108(%esp) + orl %ecx, %eax + jne ..B6.50 +..B6.49: + movl $0, 44(%esp) + jmp ..B6.51 +..B6.50: + movl $-1, 44(%esp) +..B6.51: + movl 44(%esp), %eax + cltd + movl %ebx, %eax + movl 44(%esp), %ebx + subl %eax, %ebx + movl %edi, %eax + movl %edx, %edi + movl $-2147483648, 92(%esp) + sbbl %eax, %edi +..B6.52: + movl 132(%esp), %edx + movl 108(%esp), %eax + movl %eax, (%edx) + movl %esi, %edx + andl $16, %edx + xorl %eax, %eax + orl %eax, %edx + jne ..B6.56 +..B6.53: + movl 132(%esp), %edx + movl 104(%esp), %eax + movl %eax, 4(%edx) + movl %ebp, 16(%edx) + movl %ecx, 20(%edx) + movl %ebx, 8(%edx) + movl %edi, 12(%edx) +..B6.54: + movl %esi, %edx + xorl %eax, %eax + andl $2, %edx + orl %eax, %edx + jne ..B6.55 + jmp ..B6.61 +..B6.56: + movl %edi, %edx + movl %ebx, 84(%esp) + subl %eax, %edx + movl %edi, 88(%esp) + jl ..B6.53 +..B6.57: + movl $2, %edx + movl %ebp, 36(%esp) + movl %ecx, 40(%esp) + movl %eax, 32(%esp) + movl %ebx, 12(%esp) + movl %esi, 28(%esp) + movl %edi, 20(%esp) + movl %ecx, 24(%esp) + movl %ebp, 16(%esp) + movl 36(%esp), %esi + movl 40(%esp), %edi + movl %eax, %ebx + movl 32(%esp), %ecx + jmp ..B6.58 +..B6.60: + xorl %esi, %esi + xorl %edi, %edi +..B6.58: + movl 84(%esp), %ebp + orl 88(%esp), %ebp + jne ..B6.65 +..B6.59: + addl $64, %ecx + movl %esi, 84(%esp) + adcl $0, %ebx + addl $-1, %edx + movl %edx, %ebp + adcl $-1, %eax + movl %edi, 88(%esp) + orl %eax, %ebp + jne ..B6.60 + jmp ..B6.64 +..B6.61: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B6.13 + jmp ..B6.12 +..B6.64: + movl 132(%esp), %eax + movl 12(%esp), %ebx + movl 16(%esp), %ebp + movl 20(%esp), %edi + movl 24(%esp), %ecx + movl 28(%esp), %esi + movl %ebp, 16(%eax) + movl %ecx, 20(%eax) + movl %ebx, 8(%eax) + movl %edi, 12(%eax) + movl $-262144, 4(%eax) + jmp ..B6.54 +..B6.65: + xorl %eax, %eax + movl 88(%esp), %edx + movl %esi, 36(%esp) + subl %eax, %edx + movl %edi, 40(%esp) + movl %ecx, 32(%esp) + movl 28(%esp), %esi + jl ..B6.81 +..B6.66: + movl 88(%esp), %ecx + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %eax + je ..B6.68 +..B6.67: + movl $21932, %edx + shrl %cl, %edx + andl $3, %edx + incl %edx + jmp ..B6.71 +..B6.68: + movl 84(%esp), %edx + andl $-256, %edx + movl 88(%esp), %eax + orl %edx, %eax + jne ..B6.70 +..B6.69: + movl 84(%esp), %edx +..B6.70: + movl 88(%esp), %eax + movl %edx, (%esp) + movl %eax, 4(%esp) + fildll (%esp) + shrl $31, %eax + movl 8(%esp), %edx + faddl .L_2il0floatpacket.1@GOTOFF(%edx,%eax,8) + fstpl 136(%esp) + movl 140(%esp), %edx + sarl $20, %edx + negl %edx + addl $1086, %edx +..B6.71: + cmpl $31, %edx + jbe ..B6.73 +..B6.72: + movl %edx, %ecx + xorl %eax, %eax + movl 84(%esp), %ebx + shll %cl, %ebx + movl %ebx, 88(%esp) + jmp ..B6.74 +..B6.73: + movl %edx, %ecx + movl 84(%esp), %eax + movl 88(%esp), %ebx + shldl %cl, %eax, %ebx + movl %ebx, 88(%esp) + shll %cl, %eax +..B6.74: + movl %edx, %ecx + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B6.76 +..B6.75: + movl %edi, %ebx + xorl %ebp, %ebp + shrl %cl, %ebx + movl %ebx, 84(%esp) + jmp ..B6.77 +..B6.76: + movl 36(%esp), %ebx + movl %edi, %ebp + shrdl %cl, %ebp, %ebx + movl %ebx, 84(%esp) + shrl %cl, %ebp +..B6.77: + orl %eax, 84(%esp) + orl %ebp, 88(%esp) + movl 36(%esp), %ebx + cmpl $31, %edx + jbe ..B6.79 +..B6.78: + movl %edx, %ecx + shll %cl, %ebx + movl $0, 36(%esp) + movl %ebx, 40(%esp) + jmp ..B6.80 +..B6.79: + movl %edx, %ecx + movl %edi, %eax + shldl %cl, %ebx, %eax + shll %cl, %ebx + movl %eax, 40(%esp) + movl %ebx, 36(%esp) +..B6.80: + addl %edx, 32(%esp) +..B6.81: + movl 132(%esp), %edi + movl 104(%esp), %ebp + movl 84(%esp), %eax + movl 88(%esp), %edx + movl 36(%esp), %ecx + movl 40(%esp), %ebx + subl 32(%esp), %ebp + movl %eax, 8(%edi) + movl %edx, 12(%edi) + movl %ecx, 16(%edi) + movl %ebx, 20(%edi) + movl %ebp, 4(%edi) + jmp ..B6.54 + .align 16,0x90 + .type __dpml_addsub__..0,@function + .size __dpml_addsub__..0,.-__dpml_addsub__..0 + .data +# -- End __dpml_addsub__..0 + .text +# -- Begin __dpml_evaluate_packed_poly__ + .text + .align 16,0x90 + .globl __dpml_evaluate_packed_poly__ +__dpml_evaluate_packed_poly__: +# parameter 1: 160 + %esp +# parameter 2: 164 + %esp +# parameter 3: 172 + %esp +# parameter 4: 176 + %esp +# parameter 5: 184 + %esp +# parameter 6: 192 + %esp +..B7.1: +..L14: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $140, %esp + movl 172(%esp), %esi + movl 192(%esp), %ebp + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 124(%esp) + movl 12(%esi), %ecx + movl (%esi), %ebx + movl %ebx, %edx + movl 176(%esp), %edi + notl %edi + movl %ecx, 12(%ebp) + andl %edi, %edx + movl 8(%esi), %eax + movl 4(%esi), %ecx + movl %edi, 68(%esp) + movl %ecx, %edi + movl %edx, 16(%ebp) + movl %ebx, %edx + shll $31, %ecx + andl $1, %edx + shrl $1, %ebx + movl %eax, 8(%ebp) + orl %ebx, %ecx + movl 180(%esp), %eax + notl %eax + andl 176(%esp), %ecx + andl %eax, %edi + movl %eax, 64(%esp) + xorl %eax, %eax + subl 184(%esp), %ecx + movl %edi, 20(%ebp) + orl %eax, %edx + jne ..B7.3 +..B7.2: + movl %eax, %edx + jmp ..B7.4 +..B7.3: + movl $-2147483648, %edx +..B7.4: + movl 164(%esp), %edi + addl $-1, %edi + movl %ecx, 4(%ebp) + movl 168(%esp), %ecx + adcl $-1, %ecx + movl %edx, (%ebp) + movl %ecx, %edx + call ..L15 +..L15: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L15](%ebx), %ebx + subl %eax, %edx + jl ..B7.16 +..B7.5: + movl %eax, 104(%esp) + movl %eax, 100(%esp) + movl %ecx, 80(%esp) + movl %ebx, 40(%esp) + movl %edi, 76(%esp) + movl %esi, 72(%esp) +..B7.6: + addl $12, %esp + movl 180(%esp), %eax + pushl %eax + pushl %eax + pushl 156(%esp) + call __dpml_multiply__ +..B7.7: + movl 192(%esp), %eax + xorl %ecx, %ecx + movl 12(%eax), %ebp + movl %ebp, %ebx + movl 4(%eax), %edx + subl %ecx, %ebx + movl 8(%eax), %esi + movl %edx, 56(%esp) + jl ..B7.13 +..B7.8: + movl 192(%esp), %edx + xorl %eax, %eax + movl %eax, 60(%esp) + movl %ebp, 88(%esp) + movl 16(%edx), %ebx + movl 20(%edx), %edi + movl $2, %edx + movl %esi, 84(%esp) + movl %eax, %ebp + movl 60(%esp), %ecx + jmp ..B7.9 +..B7.11: + xorl %ebx, %ebx + xorl %edi, %edi +..B7.9: + movl 84(%esp), %esi + orl 88(%esp), %esi + jne ..B7.19 +..B7.10: + addl $64, %ecx + movl %ebx, 84(%esp) + adcl $0, %ebp + addl $-1, %edx + movl %edx, %ebx + adcl $-1, %eax + movl %edi, 88(%esp) + orl %eax, %ebx + jne ..B7.11 +..B7.12: + movl 192(%esp), %eax + movl $-262144, 4(%eax) +..B7.13: + movl 72(%esp), %esi + addl $16, %esi + movl 68(%esp), %edi + movl 64(%esp), %edx + movl %esi, 72(%esp) + movl 8(%esi), %ebx + movl %ebx, 108(%esp) + movl (%esi), %eax + andl %eax, %edi + movl 4(%esi), %ebx + andl %ebx, %edx + shll $31, %ebx + movl %eax, %ecx + shrl $1, %eax + andl $1, %ecx + orl %eax, %ebx + movl 192(%esp), %eax + andl 176(%esp), %ebx + movl 12(%esi), %ebp + movl %edx, 120(%esp) + lea 100(%esp), %edx + movl %ecx, 8(%esp) + movl %eax, %ecx + movl %ebp, 12(%edx) + movl %edi, 16(%edx) + subl 184(%esp), %ebx + movl $0, 12(%esp) + call __dpml_addsub__. +..B7.14: + movl 192(%esp), %eax + xorl %ecx, %ecx + addl $-1, 76(%esp) + movl 80(%esp), %edx + adcl $-1, %edx + addl %ebx, 4(%eax) + movl %edx, 80(%esp) + subl %ecx, %edx + jge ..B7.6 +..B7.15: + movl 40(%esp), %ebx +..B7.16: + movl 124(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B7.18 +..B7.17: + addl $140, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B7.18: + call __stack_chk_fail@PLT +..B7.19: + movl 88(%esp), %ebp + movl %ebp, %edx + xorl %eax, %eax + movl 84(%esp), %esi + subl %eax, %edx + movl %ecx, 60(%esp) + jl ..B7.35 +..B7.20: + movl %ebp, %ecx + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %eax + je ..B7.22 +..B7.21: + movl $21932, %eax + shrl %cl, %eax + andl $3, %eax + incl %eax + jmp ..B7.25 +..B7.22: + movl %esi, %edx + movl %ebp, %eax + andl $-256, %edx + orl %edx, %eax + jne ..B7.24 +..B7.23: + movl %esi, %edx +..B7.24: + movl %edx, 32(%esp) + movl %ebp, %edx + movl %ebp, 36(%esp) + fildll 32(%esp) + shrl $31, %edx + movl 40(%esp), %eax + faddl .L_2il0floatpacket.1@GOTOFF(%eax,%edx,8) + fstpl 92(%esp) + movl 96(%esp), %eax + sarl $20, %eax + negl %eax + addl $1086, %eax +..B7.25: + cmpl $31, %eax + jbe ..B7.27 +..B7.26: + movl %eax, %ecx + movl %esi, %ebp + movl $0, 48(%esp) + shll %cl, %ebp + jmp ..B7.28 +..B7.27: + movl %eax, %ecx + shldl %cl, %esi, %ebp + shll %cl, %esi + movl %esi, 48(%esp) +..B7.28: + movl %eax, %ecx + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B7.30 +..B7.29: + movl %edi, %esi + movl $0, 44(%esp) + shrl %cl, %esi + jmp ..B7.31 +..B7.30: + movl %edi, %edx + movl %ebx, %esi + shrl %cl, %edx + shrdl %cl, %edi, %esi + movl %edx, 44(%esp) +..B7.31: + orl 48(%esp), %esi + orl 44(%esp), %ebp + movl %ebx, 52(%esp) + cmpl $31, %eax + jbe ..B7.33 +..B7.32: + movl %eax, %ecx + xorl %ebx, %ebx + movl 52(%esp), %edi + shll %cl, %edi + jmp ..B7.34 +..B7.33: + movl %eax, %ecx + shldl %cl, %ebx, %edi + shll %cl, %ebx +..B7.34: + addl %eax, 60(%esp) +..B7.35: + movl 192(%esp), %eax + movl %ebx, 16(%eax) + movl 56(%esp), %ebx + subl 60(%esp), %ebx + movl %esi, 8(%eax) + movl %ebp, 12(%eax) + movl %edi, 20(%eax) + movl %ebx, 4(%eax) + jmp ..B7.13 + .align 16,0x90 + .type __dpml_evaluate_packed_poly__,@function + .size __dpml_evaluate_packed_poly__,.-__dpml_evaluate_packed_poly__ + .data +# -- End __dpml_evaluate_packed_poly__ + .text +# -- Begin __dpml_addsub__ + .text + .align 16,0x90 + .hidden __dpml_addsub__ + .globl __dpml_addsub__ +__dpml_addsub__: +# parameter 1: %eax +# parameter 2: %edx +# parameter 3: 184 + %esp +# parameter 4: %ecx +..B8.1: +..L16: + + movl 4(%esp), %eax + movl 8(%esp), %edx + movl 20(%esp), %ecx + .hidden __dpml_addsub__. + .globl __dpml_addsub__. +__dpml_addsub__.: + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $156, %esp + movl %eax, %esi + movl %edx, %ebp + movl 188(%esp), %edx + movl 184(%esp), %edi + movl %edi, %ebx + movl %edx, 48(%esp) + movl %edi, %edx + movl %ecx, 132(%esp) + andl $4, %ebx + movl (%esi), %eax + shll $31, %edx + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 144(%esp) + xorl %ecx, %ecx + movl %eax, 108(%esp) + xorl %edx, %eax + xorl (%ebp), %eax + orl %ecx, %ebx + je ..B8.3 +..B8.2: + movl $0, 108(%esp) + jmp ..B8.4 +..B8.3: + movl %eax, %edx +..B8.4: + movl 4(%esi), %ecx + movl %ecx, %eax + shrl $31, %edx + movl %edx, 124(%esp) + cltd + movl 4(%ebp), %eax + movl %edx, %ebx + cltd + movl %ecx, %eax + subl 4(%ebp), %eax + movl %ecx, 104(%esp) + sbbl %edx, %ebx + xorl %edx, %edx + movl %ebx, %ecx + movl $0, 112(%esp) + subl %edx, %ecx + movl 124(%esp), %edx + jl ..B8.6 +..B8.5: + movl $0, 92(%esp) + jmp ..B8.10 +..B8.6: + movl %esi, %ecx + movl %ebp, %esi + movl %ecx, %ebp + movl %eax, %ecx + xorl %eax, %eax + subl %ecx, %eax + movl %ebx, %ecx + movl $0, %ebx + sbbl %ecx, %ebx + movl %edx, %ecx + addl %eax, 104(%esp) + orl 112(%esp), %ecx + jne ..B8.8 +..B8.7: + xorl %ecx, %ecx + jmp ..B8.9 +..B8.8: + movl $-2147483648, %ecx +..B8.9: + xorl %ecx, 108(%esp) + movl $-2147483648, 92(%esp) +..B8.10: + movl 16(%ebp), %ecx + movl %ecx, 100(%esp) + movl 20(%ebp), %ecx + movl %ecx, 96(%esp) + movl 8(%ebp), %ecx + movl 12(%ebp), %ebp + movl %ecx, 120(%esp) + movl %ebp, 116(%esp) + movl $2, %ebp + movl $0, (%esp) + call ..L17 +..L17: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L17](%ecx), %ecx + movl %esi, 128(%esp) + movl %ecx, 8(%esp) + movl %edi, 40(%esp) + movl %ebp, 4(%esp) + movl %edx, 124(%esp) + movl (%esp), %esi + jmp ..B8.11 +..B8.13: + xorl %edx, %edx + movl %edx, 120(%esp) + movl %edx, 116(%esp) +..B8.11: + movl $64, %ebp + xorl %edi, %edi + xorl %edx, %edx + subl %eax, %ebp + sbbl %ebx, %edx + movl %edx, %ecx + subl %edi, %ecx + jl ..B8.12 +..B8.90: + orl %ebp, %ecx + jne ..B8.19 +..B8.12: + movl 116(%esp), %ebx + movl 120(%esp), %eax + movl %ebx, 96(%esp) + xorl %ebx, %ebx + movl %eax, 100(%esp) + xorl %eax, %eax + subl %ebp, %eax + sbbl %edx, %ebx + movl 4(%esp), %edx + addl $-1, %edx + movl %edx, 4(%esp) + adcl $-1, %esi + orl %esi, %edx + jne ..B8.13 +..B8.14: + movl 132(%esp), %eax + movl 128(%esp), %esi + movl 8(%esi), %ecx + movl 12(%esi), %ebx + movl 4(%esi), %edx + movl %ecx, 8(%eax) + movl %ebx, 12(%eax) + movl %edx, 4(%eax) + movl 16(%esi), %ebp + movl 20(%esi), %edx + movl 108(%esp), %ecx + movl 40(%esp), %edi + movl %ebp, 16(%eax) + andl $2, %edi + movl %edx, 20(%eax) + movl %ecx, (%eax) + xorl %eax, %eax + orl %eax, %edi + je ..B8.16 +..B8.15: + movl 132(%esp), %eax + movl 8(%esi), %ecx + movl 12(%esi), %ebx + movl %ecx, 32(%eax) + movl %ebx, 36(%eax) + movl 108(%esp), %edi + movl 4(%esi), %edx + movl 16(%esi), %ebp + movl 20(%esi), %esi + xorl 92(%esp), %edi + movl %edx, 28(%eax) + movl %ebp, 40(%eax) + movl %esi, 44(%eax) + movl %edi, 24(%eax) +..B8.16: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B8.18 +..B8.17: + addl $156, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B8.18: + movl 8(%esp), %ebx + call __stack_chk_fail@PLT +..B8.19: + movl %ebp, 4(%esp) + orl %eax, %ebx + movl 40(%esp), %edi + movl 124(%esp), %edx + movl 128(%esp), %esi + je ..B8.30 +..B8.20: + cmpl $31, %eax + jbe ..B8.22 +..B8.21: + movl %eax, %ecx + xorl %ebx, %ebx + movl 96(%esp), %ebp + shrl %cl, %ebp + movl %ebp, 100(%esp) + jmp ..B8.23 +..B8.22: + movl %eax, %ecx + movl 100(%esp), %ebp + movl 96(%esp), %ebx + shrdl %cl, %ebx, %ebp + movl %ebp, 100(%esp) + shrl %cl, %ebx +..B8.23: + cmpl $31, 4(%esp) + jbe ..B8.25 +..B8.24: + movl 4(%esp), %ecx + movl 120(%esp), %ebp + shll %cl, %ebp + movl $0, (%esp) + movl %ebp, 96(%esp) + jmp ..B8.26 +..B8.25: + movl %edi, 40(%esp) + movl 4(%esp), %ecx + movl 116(%esp), %edi + movl 120(%esp), %ebp + shldl %cl, %ebp, %edi + movl %edi, 96(%esp) + shll %cl, %ebp + movl %ebp, (%esp) + movl 40(%esp), %edi +..B8.26: + movl (%esp), %ebp + orl %ebp, 100(%esp) + orl %ebx, 96(%esp) + movl 116(%esp), %ebx + cmpl $31, %eax + jbe ..B8.28 +..B8.27: + movl %eax, %ecx + shrl %cl, %ebx + movl $0, 116(%esp) + movl %ebx, 120(%esp) +..B8.30: + movl %edx, 124(%esp) + movl %esi, 128(%esp) + jmp ..B8.31 +..B8.28: + movl %eax, %ecx + movl 120(%esp), %ebp + shrdl %cl, %ebx, %ebp + shrl %cl, %ebx + movl %ebp, 120(%esp) + movl %ebx, 116(%esp) + jmp ..B8.30 +..B8.60: + movl 128(%esp), %esi + movl $1, %edx + movl 124(%esp), %eax + xorl %ecx, %ecx + subl %eax, %edx + movl 108(%esp), %ebp + movl 4(%esi), %eax + movl 112(%esp), %ebx + sbbl %ebx, %ecx + xorl 92(%esp), %ebp + xorl $2, %edi + addl $24, 132(%esp) + movl %edx, 124(%esp) + movl %ecx, 112(%esp) + movl %ebp, 108(%esp) + movl %eax, 104(%esp) +..B8.31: + movl 128(%esp), %edx + movl 124(%esp), %eax + orl 112(%esp), %eax + movl 16(%edx), %ebx + movl 20(%edx), %edx + jne ..B8.43 +..B8.32: + movl %ebx, %ebp + movl %edx, %ecx + addl 100(%esp), %ebp + movl %ebp, %eax + adcl 96(%esp), %ecx + andl $15, %edi + subl %ebx, %eax + movl %ecx, %ebx + movl $0, 48(%esp) + sbbl %edx, %ebx + jae ..B8.34 +..B8.33: + movl $1, 72(%esp) + jmp ..B8.35 +..B8.34: + movl $0, 72(%esp) +..B8.35: + movl 128(%esp), %esi + movl 72(%esp), %edx + movl 8(%esi), %ebx + movl %ebx, 52(%esp) + movl 120(%esp), %ebx + movl 12(%esi), %eax + addl %edx, %ebx + movl %eax, 80(%esp) + movl %ebx, %eax + movl 116(%esp), %esi + adcl $0, %esi + subl %edx, %eax + movl $0, %edx + movl %esi, %eax + sbbl %edx, %eax + jae ..B8.37 +..B8.36: + movl $1, 68(%esp) + jmp ..B8.38 +..B8.37: + movl $0, 68(%esp) +..B8.38: + movl 52(%esp), %eax + addl %eax, %ebx + movl %ebx, %edx + adcl 80(%esp), %esi + subl %eax, %edx + movl %esi, %eax + sbbl 80(%esp), %eax + jae ..B8.40 +..B8.39: + movl $1, %edx + jmp ..B8.41 +..B8.40: + xorl %edx, %edx +..B8.41: + movl 68(%esp), %eax + addl %edx, %eax + xorl %edx, %edx + orl %edx, %eax + je ..B8.57 +..B8.42: + movl %ecx, %eax + movl %ebx, %edx + shll $31, %eax + shrl $1, %ebp + orl %eax, %ebp + movl %esi, %eax + shrl $1, %ecx + shll $31, %edx + shll $31, %eax + orl %edx, %ecx + shrl $1, %esi + shrl $1, %ebx + orl $-2147483648, %esi + incl 104(%esp) + orl %eax, %ebx + jmp ..B8.57 +..B8.43: + addl $-8, %edi + movl 100(%esp), %ecx + adcl $-1, 48(%esp) + subl %ebx, %ecx + movl 96(%esp), %eax + sbbl %edx, %eax + jb ..B8.45 +..B8.91: + orl %eax, %ecx + je ..B8.45 +..B8.44: + movl $1, %eax + jmp ..B8.46 +..B8.45: + xorl %eax, %eax +..B8.46: + movl 128(%esp), %esi + movl %ebx, %ebp + subl 100(%esp), %ebp + movl %edx, %ecx + movl 116(%esp), %ebx + movl 8(%esi), %edx + movl %edx, 60(%esp) + movl 12(%esi), %edx + movl 120(%esp), %esi + sbbl 96(%esp), %ecx + addl %eax, %esi + movl %esi, 56(%esp) + adcl $0, %ebx + subl %eax, %esi + movl $0, %eax + movl %ebx, 76(%esp) + sbbl %eax, %ebx + jae ..B8.48 +..B8.47: + movl $1, 64(%esp) + jmp ..B8.49 +..B8.48: + movl $0, 64(%esp) +..B8.49: + movl 60(%esp), %eax + movl %eax, %ebx + subl 56(%esp), %ebx + movl %edx, %esi + sbbl 76(%esp), %esi + subl %ebx, %eax + sbbl %esi, %edx + jae ..B8.51 +..B8.50: + movl $1, %edx + jmp ..B8.52 +..B8.51: + xorl %edx, %edx +..B8.52: + movl 64(%esp), %eax + addl %edx, %eax + xorl %edx, %edx + orl %edx, %eax + je ..B8.57 +..B8.53: + xorl %eax, %eax + movl %ebp, %edx + xorl %ebp, %ebp + subl %edx, %ebp + movl %ecx, %edx + movl %eax, %ecx + movl %ebp, %eax + sbbl %edx, %ecx + xorl $-2147483648, 108(%esp) + orl %ecx, %eax + jne ..B8.55 +..B8.54: + movl $0, 44(%esp) + jmp ..B8.56 +..B8.55: + movl $-1, 44(%esp) +..B8.56: + movl 44(%esp), %eax + cltd + movl %ebx, %eax + movl 44(%esp), %ebx + subl %eax, %ebx + movl %esi, %eax + movl %edx, %esi + movl $-2147483648, 92(%esp) + sbbl %eax, %esi +..B8.57: + movl 132(%esp), %edx + movl 108(%esp), %eax + movl %eax, (%edx) + movl %edi, %edx + andl $16, %edx + xorl %eax, %eax + orl %eax, %edx + jne ..B8.61 +..B8.58: + movl 132(%esp), %edx + movl 104(%esp), %eax + movl %eax, 4(%edx) + movl %ebp, 16(%edx) + movl %ecx, 20(%edx) + movl %ebx, 8(%edx) + movl %esi, 12(%edx) +..B8.59: + movl %edi, %edx + xorl %eax, %eax + andl $2, %edx + orl %eax, %edx + jne ..B8.60 + jmp ..B8.66 +..B8.61: + movl %esi, %edx + movl %ebx, 84(%esp) + subl %eax, %edx + movl %esi, 88(%esp) + jl ..B8.58 +..B8.62: + movl $2, %edx + movl %ebp, 32(%esp) + movl %ecx, 36(%esp) + movl %eax, 28(%esp) + movl %ebx, 12(%esp) + movl %edi, 40(%esp) + movl %esi, 20(%esp) + movl %ecx, 24(%esp) + movl %ebp, 16(%esp) + movl 32(%esp), %esi + movl 36(%esp), %edi + movl %eax, %ebx + movl 28(%esp), %ecx + jmp ..B8.63 +..B8.65: + xorl %esi, %esi + xorl %edi, %edi +..B8.63: + movl 84(%esp), %ebp + orl 88(%esp), %ebp + jne ..B8.70 +..B8.64: + addl $64, %ecx + movl %esi, 84(%esp) + adcl $0, %ebx + addl $-1, %edx + movl %edx, %ebp + adcl $-1, %eax + movl %edi, 88(%esp) + orl %eax, %ebp + jne ..B8.65 + jmp ..B8.69 +..B8.66: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B8.18 + jmp ..B8.17 +..B8.69: + movl 132(%esp), %eax + movl 12(%esp), %ebx + movl 16(%esp), %ebp + movl 20(%esp), %esi + movl 24(%esp), %ecx + movl 40(%esp), %edi + movl %ebp, 16(%eax) + movl %ecx, 20(%eax) + movl %ebx, 8(%eax) + movl %esi, 12(%eax) + movl $-262144, 4(%eax) + jmp ..B8.59 +..B8.70: + xorl %eax, %eax + movl 88(%esp), %edx + movl %edi, 36(%esp) + subl %eax, %edx + movl %esi, 32(%esp) + movl %ecx, 28(%esp) + movl 40(%esp), %edi + jl ..B8.86 +..B8.71: + movl 88(%esp), %ecx + shrl $26, %ecx + andl $30, %ecx + orl %ecx, %eax + je ..B8.73 +..B8.72: + movl $21932, %edx + shrl %cl, %edx + andl $3, %edx + incl %edx + jmp ..B8.76 +..B8.73: + movl 84(%esp), %edx + andl $-256, %edx + movl 88(%esp), %eax + orl %edx, %eax + jne ..B8.75 +..B8.74: + movl 84(%esp), %edx +..B8.75: + movl 88(%esp), %eax + movl %edx, (%esp) + movl %eax, 4(%esp) + fildll (%esp) + shrl $31, %eax + movl 8(%esp), %edx + faddl .L_2il0floatpacket.1@GOTOFF(%edx,%eax,8) + fstpl 136(%esp) + movl 140(%esp), %edx + sarl $20, %edx + negl %edx + addl $1086, %edx +..B8.76: + cmpl $31, %edx + jbe ..B8.78 +..B8.77: + movl %edx, %ecx + xorl %eax, %eax + movl 84(%esp), %ebx + shll %cl, %ebx + movl %ebx, 88(%esp) + jmp ..B8.79 +..B8.78: + movl %edx, %ecx + movl 84(%esp), %eax + movl 88(%esp), %ebx + shldl %cl, %eax, %ebx + movl %ebx, 88(%esp) + shll %cl, %eax +..B8.79: + movl %edx, %ecx + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B8.81 +..B8.80: + movl 36(%esp), %ebx + xorl %ebp, %ebp + shrl %cl, %ebx + movl %ebx, 84(%esp) + jmp ..B8.82 +..B8.81: + movl %esi, %ebx + movl 36(%esp), %ebp + shrdl %cl, %ebp, %ebx + movl %ebx, 84(%esp) + shrl %cl, %ebp +..B8.82: + orl %eax, 84(%esp) + orl %ebp, 88(%esp) + movl %esi, %ebx + cmpl $31, %edx + jbe ..B8.84 +..B8.83: + movl %edx, %ecx + shll %cl, %ebx + movl $0, 32(%esp) + movl %ebx, 36(%esp) + jmp ..B8.85 +..B8.84: + movl %edx, %ecx + movl 36(%esp), %eax + shldl %cl, %ebx, %eax + shll %cl, %ebx + movl %eax, 36(%esp) + movl %ebx, 32(%esp) +..B8.85: + addl %edx, 28(%esp) +..B8.86: + movl 132(%esp), %esi + movl 104(%esp), %ebp + movl 84(%esp), %eax + movl 88(%esp), %edx + movl 32(%esp), %ecx + movl 36(%esp), %ebx + subl 28(%esp), %ebp + movl %eax, 8(%esi) + movl %edx, 12(%esi) + movl %ecx, 16(%esi) + movl %ebx, 20(%esi) + movl %ebp, 4(%esi) + jmp ..B8.59 + .align 16,0x90 + .type __dpml_addsub__,@function + .size __dpml_addsub__,.-__dpml_addsub__ + .data +# -- End __dpml_addsub__ + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x00000000,0x00000000,0x00000000,0x43f00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xe6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .align 4 + .globl __x_constants__ +__x_constants__: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1073610752 + .long 0 + .long 0 + .long 0 + .long 1073676288 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 3306619320 + .long 2221509004 + .long 3041149649 + .long 1073648159 + .long 3306619320 + .long 2221509004 + .long 3041149649 + .long 1073779231 + .long 2479964490 + .long 592389929 + .long 3354604061 + .long 1073753495 + .long 3306619320 + .long 2221509004 + .long 3041149649 + .long 1073713695 + .long 0 + .long 0 + .long 0 + .long 1074030592 + .long 0 + .long 0 + .long 0 + .long 1074096128 + .long 0 + .long 0 + .long 0 + .long 1074138624 + .long 0 + .long 0 + .long 0 + .long 1074161664 + .long 0 + .long 0 + .long 0 + .long 2147418112 + .type __x_constants__,@object + .size __x_constants__,208 + .data + .hidden __dpml_multiply__ + .hidden __dpml_exception + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/dpml_ux_ops_64.S b/external/sgx_libm/ia32/dpml_ux_ops_64.S new file mode 100644 index 0000000000..8b6fdba73d --- /dev/null +++ b/external/sgx_libm/ia32/dpml_ux_ops_64.S @@ -0,0 +1,4636 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_ops_64.c" + .text +..TXTST0: +# -- Begin __dpml_multiply__ + .text + .align 16,0x90 + .hidden __dpml_multiply__ + .globl __dpml_multiply__ +__dpml_multiply__: +# parameter 1: 64 + %esp +# parameter 2: 68 + %esp +# parameter 3: 72 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $44, %esp + movl 68(%esp), %edi + movl 64(%esp), %esi + movl 12(%edi), %ebx + movl %ebx, %edx + movl 12(%esi), %ebp + movl 8(%esi), %eax + movl 8(%edi), %ecx + movl %ebp, (%esp) + imull %ecx, %ebp + imull %eax, %edx + movl %eax, 4(%esp) + addl %edx, %ebp + mull %ecx + addl %ebp, %edx + movl %eax, %esi + movl %edx, 24(%esp) + movl %ecx, %eax + movl 64(%esp), %edx + movl 68(%esp), %ebp + movl 64(%esp), %edi + mull 16(%edx) + movl 16(%ebp), %ebp + movl %ecx, %eax + movl %ebp, 20(%esp) + movl 68(%esp), %ebp + movl 20(%edi), %edi + movl %ecx, 8(%esp) + movl 20(%ebp), %ebp + movl %ebp, 16(%esp) + movl %edx, %ebp + mull %edi + movl 64(%esp), %ecx + addl %eax, %ebp + movl %edi, 36(%esp) + movl %edx, %edi + adcl $0, %edi + movl 16(%ecx), %eax + mull %ebx + addl %ebp, %eax + movl %ebx, 12(%esp) + adcl %edi, %edx + subl %ebp, %eax + movl %edx, 28(%esp) + movl 24(%esp), %ebx + sbbl %edi, %edx + jae ..B1.3 +..B1.2: + movl $1, %ebp + jmp ..B1.4 +..B1.3: + xorl %ebp, %ebp +..B1.4: + movl 36(%esp), %eax + mull 12(%esp) + addl %edx, %ebp + addl 28(%esp), %eax + movl %eax, 32(%esp) + movl 64(%esp), %eax + adcl $0, %ebp + movl 68(%esp), %edi + movl 72(%esp), %ecx + movl (%eax), %edx + xorl (%edi), %edx + movl %edx, (%ecx) + movl 4(%eax), %edx + addl 4(%edi), %edx + movl 4(%esp), %eax + movl 20(%esp), %edi + movl %edx, 4(%ecx) + mull %edi + movl %edi, %eax + movl %edx, %ecx + mull (%esp) + addl %eax, %ecx + movl %edx, %edi + movl 4(%esp), %eax + adcl $0, %edi + mull 16(%esp) + addl %ecx, %eax + adcl %edi, %edx + subl %ecx, %eax + movl %edx, 24(%esp) + sbbl %edi, %edx + jae ..B1.6 +..B1.5: + movl $1, %ecx + jmp ..B1.7 +..B1.6: + xorl %ecx, %ecx +..B1.7: + movl 16(%esp), %eax + mull (%esp) + addl %edx, %ecx + addl 24(%esp), %eax + movl 32(%esp), %edi + adcl $0, %ecx + addl %edi, %esi + movl %eax, 20(%esp) + movl %esi, %eax + adcl %ebp, %ebx + subl %edi, %eax + movl %ebx, %edx + sbbl %ebp, %edx + jae ..B1.9 +..B1.8: + movl $1, 24(%esp) + jmp ..B1.10 +..B1.9: + movl $0, 24(%esp) +..B1.10: + movl 8(%esp), %edi + movl %edi, %eax + mull 4(%esp) + movl %edi, %eax + movl %edx, %ebp + mull (%esp) + addl %eax, %ebp + movl %edx, %edi + movl 4(%esp), %eax + adcl $0, %edi + mull 12(%esp) + addl %ebp, %eax + adcl %edi, %edx + subl %ebp, %eax + movl %edx, 16(%esp) + sbbl %edi, %edx + jae ..B1.12 +..B1.11: + movl $1, %ebp + jmp ..B1.13 +..B1.12: + xorl %ebp, %ebp +..B1.13: + movl (%esp), %eax + mull 12(%esp) + addl %edx, %ebp + addl 16(%esp), %eax + movl 20(%esp), %edi + adcl $0, %ebp + addl %edi, %esi + movl %esi, %edx + adcl %ecx, %ebx + subl %edi, %edx + movl %ebx, %edi + sbbl %ecx, %edi + jae ..B1.15 +..B1.14: + movl $1, %edx + jmp ..B1.16 +..B1.15: + xorl %edx, %edx +..B1.16: + movl 24(%esp), %ecx + addl %edx, %ecx + movl 72(%esp), %edx + addl %ecx, %eax + adcl $0, %ebp + movl %esi, 16(%edx) + movl %ebx, 20(%edx) + movl %eax, 8(%edx) + movl %ebp, 12(%edx) + addl $44, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_multiply__,@function + .size __dpml_multiply__,.-__dpml_multiply__ + .data +# -- End __dpml_multiply__ + .text +# -- Begin __dpml_extended_multiply__ + .text + .align 16,0x90 + .hidden __dpml_extended_multiply__ + .globl __dpml_extended_multiply__ +__dpml_extended_multiply__: +# parameter 1: 80 + %esp +# parameter 2: 84 + %esp +# parameter 3: 88 + %esp +# parameter 4: 92 + %esp +..B2.1: +..L2: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $60, %esp + movl 80(%esp), %esi + movl 84(%esp), %edi + movl 20(%esi), %ebx + movl 20(%edi), %edx + movl 16(%edi), %ecx + movl 16(%esi), %ebp + movl %ebp, %eax + movl %ebx, 24(%esp) + movl %edx, 16(%esp) + imull %ecx, %ebx + imull %ebp, %edx + addl %edx, %ebx + mull %ecx + movl %eax, 36(%esp) + movl %ecx, %eax + addl %ebx, %edx + movl %edx, 40(%esp) + mull %ebp + movl 8(%esi), %ebx + movl %ecx, %eax + movl 12(%esi), %esi + movl %esi, (%esp) + movl 8(%edi), %esi + movl %esi, 12(%esp) + movl 12(%edi), %esi + movl %edx, %edi + mull 24(%esp) + addl %eax, %edi + movl %ebp, %eax + movl %esi, 4(%esp) + movl %edx, %esi + adcl $0, %esi + mull 16(%esp) + addl %edi, %eax + movl %ebx, 8(%esp) + movl %edx, %ebx + adcl %esi, %ebx + subl %edi, %eax + movl %ecx, 20(%esp) + movl %ebx, %ecx + sbbl %esi, %ecx + jae ..B2.3 +..B2.2: + movl $1, %ecx + jmp ..B2.4 +..B2.3: + xorl %ecx, %ecx +..B2.4: + movl 24(%esp), %eax + movl 16(%esp), %edi + mull %edi + addl %edx, %ecx + addl %ebx, %eax + movl 92(%esp), %esi + movl %edi, %ebx + adcl $0, %ecx + movl %ebp, 44(%esp) + movl %ecx, 52(%esp) + movl 36(%esp), %ebp + movl 40(%esp), %ecx + movl %ebp, 16(%esi) + movl %ecx, 20(%esi) + movl 80(%esp), %ebp + movl 84(%esp), %esi + movl %eax, 48(%esp) + movl 4(%ebp), %edx + movl 4(%esi), %eax + movl (%ebp), %ecx + xorl (%esi), %ecx + lea -128(%edx,%eax), %esi + movl %esi, 56(%esp) + movl (%esp), %esi + lea (%edx,%eax), %ebp + movl 8(%esp), %edx + movl 20(%esp), %eax + imull %edx, %ebx + imull %eax, %esi + mull %edx + addl %esi, %ebx + movl %edx, %edi + addl %ebx, %edi + movl %eax, %esi + movl 88(%esp), %ebx + movl 12(%esp), %edx + movl 4(%esp), %eax + movl %ecx, (%ebx) + movl %ebp, 4(%ebx) + movl 24(%esp), %ebx + movl 44(%esp), %ebp + imull %edx, %ebx + imull %ebp, %eax + addl %eax, %ebx + movl %ebp, %eax + mull %edx + addl %ebx, %edx + movl 92(%esp), %ebx + movl %edx, 32(%esp) + movl %eax, 28(%esp) + movl %ecx, (%ebx) + movl 56(%esp), %ecx + movl %ecx, 4(%ebx) + movl 48(%esp), %ebx + addl %esi, %ebx + movl %ebx, %edx + movl 52(%esp), %ecx + adcl %edi, %ecx + subl %esi, %edx + movl %ecx, %esi + sbbl %edi, %esi + jae ..B2.6 +..B2.5: + movl $1, %esi + jmp ..B2.7 +..B2.6: + xorl %esi, %esi +..B2.7: + movl %esi, 44(%esp) + movl (%esp), %edi + movl 12(%esp), %esi + movl 4(%esp), %edx + movl 8(%esp), %eax + imull %esi, %edi + imull %eax, %edx + addl %edx, %edi + mull %esi + movl 28(%esp), %esi + addl %edi, %edx + addl %esi, %ebx + movl %edx, 40(%esp) + movl %ebx, %edx + movl 32(%esp), %edi + adcl %edi, %ecx + subl %esi, %edx + movl %ecx, %edx + movl 44(%esp), %esi + sbbl %edi, %edx + movl %eax, 36(%esp) + jae ..B2.9 +..B2.8: + movl $1, %edx + jmp ..B2.10 +..B2.9: + xorl %edx, %edx +..B2.10: + addl %edx, %esi + movl %ebp, %eax + movl 92(%esp), %edx + movl %ecx, 12(%edx) + movl 12(%esp), %ecx + movl %ebx, 8(%edx) + mull %ecx + movl %ecx, %eax + movl %edx, %edi + mull 24(%esp) + addl %eax, %edi + movl %ebp, %eax + movl %edx, %ebx + adcl $0, %ebx + mull 4(%esp) + addl %edi, %eax + movl %edx, %ecx + adcl %ebx, %ecx + subl %edi, %eax + movl %ecx, %ebp + sbbl %ebx, %ebp + jae ..B2.12 +..B2.11: + movl $1, %edi + jmp ..B2.13 +..B2.12: + xorl %edi, %edi +..B2.13: + movl 24(%esp), %eax + mull 4(%esp) + addl %edx, %edi + addl %ecx, %eax + movl 36(%esp), %ebx + adcl $0, %edi + addl %ebx, %esi + movl %eax, 28(%esp) + movl %esi, %ebp + movl 40(%esp), %eax + movl %eax, %ecx + adcl $0, %ecx + subl %ebx, %ebp + movl %ecx, %edx + sbbl %eax, %edx + jae ..B2.15 +..B2.14: + movl $1, %ebp + jmp ..B2.16 +..B2.15: + xorl %ebp, %ebp +..B2.16: + movl 20(%esp), %ebx + movl %ebx, %eax + mull 8(%esp) + movl %ebx, %eax + movl %ecx, 32(%esp) + movl %edx, %ecx + mull (%esp) + addl %eax, %ecx + movl %edx, %ebx + movl 8(%esp), %eax + adcl $0, %ebx + mull 16(%esp) + addl %ecx, %eax + adcl %ebx, %edx + subl %ecx, %eax + movl %edx, 24(%esp) + movl 32(%esp), %ecx + sbbl %ebx, %edx + jae ..B2.18 +..B2.17: + movl $1, %ebx + jmp ..B2.19 +..B2.18: + xorl %ebx, %ebx +..B2.19: + movl 16(%esp), %eax + mull (%esp) + addl %edx, %ebx + addl 24(%esp), %eax + movl %eax, 20(%esp) + movl 28(%esp), %eax + adcl $0, %ebx + addl %eax, %esi + movl %esi, %edx + adcl %edi, %ecx + subl %eax, %edx + movl %ecx, %eax + sbbl %edi, %eax + jae ..B2.21 +..B2.20: + movl $1, %eax + jmp ..B2.22 +..B2.21: + xorl %eax, %eax +..B2.22: + movl 12(%esp), %edi + addl %eax, %ebp + movl %edi, %eax + mull 8(%esp) + movl %edi, %eax + movl %ebp, 24(%esp) + movl %edx, %ebp + mull (%esp) + addl %eax, %ebp + movl %edx, %edi + movl 8(%esp), %eax + adcl $0, %edi + mull 4(%esp) + addl %ebp, %eax + adcl %edi, %edx + subl %ebp, %eax + movl %edx, 16(%esp) + movl 24(%esp), %ebp + sbbl %edi, %edx + jae ..B2.24 +..B2.23: + movl $1, %edi + jmp ..B2.25 +..B2.24: + xorl %edi, %edi +..B2.25: + movl (%esp), %eax + mull 4(%esp) + addl %edx, %edi + addl 16(%esp), %eax + movl %eax, 8(%esp) + movl 20(%esp), %eax + adcl $0, %edi + addl %eax, %esi + movl %esi, %edx + adcl %ebx, %ecx + subl %eax, %edx + movl %ecx, %eax + sbbl %ebx, %eax + jae ..B2.27 +..B2.26: + movl $1, %eax + jmp ..B2.28 +..B2.27: + xorl %eax, %eax +..B2.28: + addl %eax, %ebp + movl 88(%esp), %eax + movl %ecx, 20(%eax) + movl 8(%esp), %ecx + addl %ebp, %ecx + movl %esi, 16(%eax) + adcl $0, %edi + movl %ecx, 8(%eax) + movl %edi, 12(%eax) + addl $60, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_extended_multiply__,@function + .size __dpml_extended_multiply__,.-__dpml_extended_multiply__ + .data +# -- End __dpml_extended_multiply__ + .text +# -- Begin __dpml_divide__ + .text + .align 16,0x90 + .hidden __dpml_divide__ + .globl __dpml_divide__ +__dpml_divide__: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +# parameter 4: 24 + %ebp +..B3.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $148, %esp + call ..L4 +..L4: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ecx), %ecx + movl 12(%ebp), %edi + testl %edi, %edi + movl 8(%ebp), %ebx + movl %ecx, 92(%esp) + lea __ux_one__@GOTOFF(%ecx), %edx + jne ..L5 + movl %edx, %edi +..L5: + testl %ebx, %ebx + movl %gs:20, %eax + jne ..L6 + movl %edx, %ebx +..L6: + xorl %esp, %eax + movl %eax, 140(%esp) + cmpl %edx, %edi + movl 16(%edi), %esi + movl 8(%edi), %eax + movl 12(%edi), %ecx + movl %esi, 104(%esp) + movl %ebx, 108(%esp) + movl %eax, 96(%esp) + movl %ecx, 100(%esp) + movl 20(%edi), %esi + je ..B3.69 +..B3.2: + xorl %edx, %edx + subl %edx, %ecx + jl ..B3.5 +..B3.3: + addl $12, %esp + pushl %edx + pushl %edx + pushl %edi + call __dpml_ffs_and_shift__ +..B3.4: + movl 8(%edi), %eax + movl 12(%edi), %edx + movl 16(%edi), %ecx + movl 20(%edi), %esi + movl %eax, 96(%esp) + movl %edx, 100(%esp) + movl %ecx, 104(%esp) +..B3.5: + addl $4, %esp + lea 108(%esp), %edx + pushl %edx + movl -20(%edx), %ebx + call fegetenv@PLT +..B3.6: + movl %esi, 56(%esp) + movl 100(%esp), %esi + movl %esi, %eax + movl 96(%esp), %ecx + movl %ecx, %edx + movl %edi, 28(%esp) + movl %esi, %edi + shll $31, %eax + shrl $1, %edx + shrl $1, %edi + orl %edx, %eax + movl %eax, 32(%esp) + movl %esi, %eax + movl %edi, 36(%esp) + andl $-64, %eax + fildll 32(%esp) + andl $63, %esi + fstpl 48(%esp) + xorl %edx, %edx + fldl 48(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fdiv %st, %st(1) + shrl $1, %eax + movl %eax, 36(%esp) + movl %ecx, %eax + movl 108(%esp), %edi + shrl $17, %eax + shll $15, %esi + movl %edx, 32(%esp) + orl %esi, %eax + movl 56(%esp), %esi + shll $15, %ecx + shrl $17, %esi + orl %esi, %ecx + movl 12(%edi), %esi + movl %esi, 80(%esp) + fxch %st(1) + fstpl 48(%esp) + fldl 48(%esp) + movl (%edi), %esi + fld %st(0) + fildll 32(%esp) + movl %eax, 36(%esp) + movl %ecx, 32(%esp) + movl 8(%edi), %eax + movl 16(%edi), %ecx + movl %eax, 84(%esp) + movl %ecx, 72(%esp) + movl 20(%edi), %eax + movl 28(%esp), %ecx + movl %eax, 76(%esp) + movl 24(%ebp), %eax + xorl (%ecx), %esi + fstpl 48(%esp) + fldl 48(%esp) + fildll 32(%esp) + movl %esi, (%eax) + fstpl 48(%esp) + fxch %st(1) + fnstcw 16(%esp) + movzwl 16(%esp), %eax + orl $3072, %eax + movl %eax, 24(%esp) + fldcw 24(%esp) + fistpll 40(%esp) + fldcw 16(%esp) + movl %edx, 32(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fldl 48(%esp) + movl 40(%esp), %eax + addl $-1280, %eax + movl 44(%esp), %esi + adcl $-1, %esi + fmul %st(1), %st + andl $-16, %esi + movl %esi, 36(%esp) + fstpl 48(%esp) + fldl 48(%esp) + fildll 32(%esp) + fstpl 48(%esp) + fldl 48(%esp) + fmul %st, %st(3) + movl 4(%edi), %edi + fxch %st(3) + fsubrp %st, %st(5) + fmul %st(2), %st + movl %esi, 88(%esp) + fsubrp %st, %st(4) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + movl 80(%esp), %eax + movl %eax, %ebx + movl 84(%esp), %esi + subl 4(%ecx), %edi + movl %esi, %ecx + shll $21, %ebx + shrl $11, %ecx + fmulp %st, %st(3) + orl %ecx, %ebx + movl %edi, 60(%esp) + movl %eax, %edi + shrl $1, %edi + movl %ebx, %ecx + shrl $22, %ecx + andl $-1024, %edi + shll $10, %ebx + orl %edi, %ecx + movl %ebx, 32(%esp) + movl %eax, %ebx + movl %ecx, 36(%esp) + andl $-64, %ebx + fxch %st(2) + fmulp %st, %st(3) + andl $63, %eax + shrl $1, %ebx + movl 76(%esp), %ecx + shll $15, %eax + shrl $17, %ecx + fxch %st(2) + fstpl 48(%esp) + fldl 48(%esp) + fildll 32(%esp) + movl %edx, 32(%esp) + movl %esi, %edx + movl %ebx, 36(%esp) + shrl $17, %edx + shll $15, %esi + orl %eax, %edx + orl %ecx, %esi + fstpl 48(%esp) + fldl 48(%esp) + movl 92(%esp), %eax + fmul %st(1), %st + fildll 32(%esp) + movl %esi, 32(%esp) + movl %edx, 36(%esp) + fstpl 48(%esp) + fldl 48(%esp) + fildll 32(%esp) + fstpl 48(%esp) + fldl 48(%esp) + fmulp %st, %st(4) + fxch %st(3) + fstpl 48(%esp) + fldl 48(%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + fmulp %st, %st(5) + fxch %st(4) + fstpl 48(%esp) + fldl 48(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpl 48(%esp) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldl 48(%esp) + fxch %st(2) + fstpl 48(%esp) + fldl 48(%esp) + fldt .L_2il0floatpacket.4@GOTOFF(%eax) + fmulp %st, %st(3) + fxch %st(2) + fnstcw 16(%esp) + movzwl 16(%esp), %eax + orl $3072, %eax + movl %eax, 24(%esp) + fldcw 24(%esp) + fistpll 40(%esp) + fldcw 16(%esp) + movl 40(%esp), %ebx + movl %ebx, %edx + movl 44(%esp), %ecx + movl %ecx, %edi + fxch %st(1) + fnstcw 16(%esp) + movzwl 16(%esp), %eax + orl $3072, %eax + movl %eax, 24(%esp) + fldcw 24(%esp) + fistpll 40(%esp) + fldcw 16(%esp) + shrl $30, %edx + shll $2, %ebx + shll $2, %ecx + movl 40(%esp), %esi + orl %ecx, %edx + addl %esi, %ebx + movl %ebx, %ecx + movl 44(%esp), %eax + adcl %eax, %edx + shrl $30, %edi + subl %esi, %ecx + movl %edx, 64(%esp) + movl %edi, 68(%esp) + sbbl %eax, %edx + movl 56(%esp), %esi + movl 88(%esp), %edx + jae ..B3.8 +..B3.7: + movl $1, %ecx + jmp ..B3.9 +..B3.8: + xorl %ecx, %ecx +..B3.9: + addl %ecx, 68(%esp) + movl $1, %ecx + movl 16(%ebp), %edi + subl %ecx, %edi + orl 20(%ebp), %edi + jne ..B3.11 +..B3.10: + fstp %st(0) + xorl %eax, %eax + xorl %edx, %edx + jmp ..B3.59 +..B3.11: + movl 92(%esp), %ecx + fldt .L_2il0floatpacket.5@GOTOFF(%ecx) + fmulp %st, %st(1) + fnstcw 16(%esp) + movzwl 16(%esp), %eax + orl $3072, %eax + movl %eax, 24(%esp) + fldcw 24(%esp) + fistpll 40(%esp) + fldcw 16(%esp) + movl 44(%esp), %edi + movl 40(%esp), %ecx + movl %ecx, 28(%esp) + lea (%edi,%edx,4), %edx + movl %edx, 32(%esp) + orl %edx, %ecx + jne ..B3.13 +..B3.12: + movl $-1, %edx + movl %edx, 28(%esp) + movl %edx, 32(%esp) +..B3.13: + movl %ebx, %eax + xorl %edi, %edi + mull 104(%esp) + xorl %ecx, %ecx + movl %ebx, %eax + subl 68(%esp), %ecx + movl %ecx, 16(%esp) + movl %edx, %ecx + sbbl $0, %edi + mull %esi + addl %eax, %ecx + movl 104(%esp), %eax + movl %edi, 52(%esp) + movl %edx, %edi + adcl $0, %edi + mull 64(%esp) + addl %ecx, %eax + adcl %edi, %edx + subl %ecx, %eax + movl %edx, 20(%esp) + movl 52(%esp), %ecx + sbbl %edi, %edx + jae ..B3.15 +..B3.14: + movl $1, 48(%esp) + jmp ..B3.16 +..B3.15: + movl $0, 48(%esp) +..B3.16: + movl %esi, %eax + movl %esi, 56(%esp) + movl 64(%esp), %esi + mull %esi + movl %ecx, 52(%esp) + movl 48(%esp), %ecx + addl %edx, %ecx + movl %esi, %edx + addl 20(%esp), %eax + movl 96(%esp), %esi + adcl $0, %ecx + movl %ecx, 48(%esp) + movl 100(%esp), %ecx + movl %ecx, %edi + imull %ebx, %edi + imull %esi, %edx + movl %eax, 44(%esp) + movl %esi, %eax + addl %edx, %edi + mull %ebx + movl %eax, 24(%esp) + movl %ebx, %eax + addl %edi, %edx + movl %edx, 36(%esp) + mull %esi + movl %ebx, %eax + movl %edx, %edi + mull %ecx + addl %eax, %edi + movl %esi, %eax + movl %edx, %ecx + adcl $0, %ecx + mull 64(%esp) + addl %edi, %eax + movl 56(%esp), %esi + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 40(%esp) + sbbl %ecx, %edx + movl 52(%esp), %ecx + jae ..B3.18 +..B3.17: + movl $1, %edi + jmp ..B3.19 +..B3.18: + xorl %edi, %edi +..B3.19: + movl %ebx, 20(%esp) + andl %ecx, %esi + movl 100(%esp), %ebx + movl %ebx, %eax + mull 64(%esp) + addl %edx, %edi + andl %ebx, %ecx + addl 40(%esp), %eax + movl %eax, 56(%esp) + movl 104(%esp), %edx + adcl $0, %edi + movl 16(%esp), %eax + andl %eax, %edx + movl 44(%esp), %ebx + andl 96(%esp), %eax + addl %ebx, %edx + movl %eax, 16(%esp) + movl 48(%esp), %eax + adcl %eax, %esi + movl %edx, 104(%esp) + subl %ebx, %edx + movl %esi, %ebx + sbbl %eax, %ebx + movl 20(%esp), %ebx + jae ..B3.21 +..B3.20: + movl $1, %edx + jmp ..B3.22 +..B3.21: + xorl %edx, %edx +..B3.22: + movl %ecx, 52(%esp) + movl 24(%esp), %ecx + movl 104(%esp), %eax + addl %ecx, %eax + movl %ebx, 20(%esp) + movl 36(%esp), %ebx + adcl %ebx, %esi + movl %eax, 104(%esp) + subl %ecx, %eax + movl %esi, %ecx + sbbl %ebx, %ecx + movl 20(%esp), %ebx + movl 52(%esp), %ecx + jae ..B3.24 +..B3.23: + movl $1, %eax + jmp ..B3.25 +..B3.24: + xorl %eax, %eax +..B3.25: + addl %eax, %edx + movl %edx, 24(%esp) + movl 56(%esp), %edx + movl 16(%esp), %eax + addl %edx, %eax + movl %eax, 16(%esp) + adcl %edi, %ecx + subl %edx, %eax + movl %ecx, %edx + sbbl %edi, %edx + movl 24(%esp), %edx + jae ..B3.27 +..B3.26: + movl $1, 24(%esp) + jmp ..B3.28 +..B3.27: + movl $0, 24(%esp) +..B3.28: + movl 16(%esp), %edi + addl %edx, %edi + movl %edi, 16(%esp) + adcl $0, %ecx + subl %edx, %edi + movl $0, %edx + movl %ecx, %edi + sbbl %edx, %edi + jae ..B3.30 +..B3.29: + movl $1, %edi + jmp ..B3.31 +..B3.30: + xorl %edi, %edi +..B3.31: + xorl %eax, %eax + movl 24(%esp), %edx + addl %edi, %edx + xorl %edi, %edi + subl %edx, %edi + movl %eax, %edx + movl 72(%esp), %eax + sbbl $0, %edx + subl 104(%esp), %eax + movl 76(%esp), %eax + sbbl %esi, %eax + jae ..B3.33 +..B3.32: + movl $1, 40(%esp) + jmp ..B3.34 +..B3.33: + movl $0, 40(%esp) +..B3.34: + movl 72(%esp), %eax + subl 104(%esp), %eax + movl %eax, 36(%esp) + movl 76(%esp), %eax + sbbl %esi, %eax + movl 84(%esp), %esi + subl 16(%esp), %esi + movl 80(%esp), %esi + movl %eax, 24(%esp) + sbbl %ecx, %esi + jae ..B3.36 +..B3.35: + movl $1, %esi + jmp ..B3.37 +..B3.36: + xorl %esi, %esi +..B3.37: + subl %esi, %edi + movl 84(%esp), %esi + sbbl $0, %edx + subl 16(%esp), %esi + movl 80(%esp), %eax + movl %esi, 44(%esp) + sbbl %ecx, %eax + xorl %ecx, %ecx + subl 40(%esp), %esi + movl %eax, %esi + sbbl %ecx, %esi + jae ..B3.40 +..B3.38: + movl $1, %ecx +..B3.40: + subl %ecx, %edi + movl 44(%esp), %ecx + sbbl $0, %edx + subl 40(%esp), %ecx + sbbl $0, %eax + orl %eax, %ecx + je ..B3.42 +..B3.41: + movl $1, %esi + jmp ..B3.43 +..B3.42: + xorl %esi, %esi +..B3.43: + orl %edi, %esi + movl %esi, %ecx + movl %edx, 40(%esp) + orl %edx, %ecx + jne ..B3.46 +..B3.44: + movl 96(%esp), %edi + movl 100(%esp), %edx +..B3.46: + movl 96(%esp), %ecx + xorl %edi, %ecx + movl 100(%esp), %eax + movl 36(%esp), %edi + xorl %edx, %eax + subl %ecx, %edi + movl %ebx, 20(%esp) + movl 24(%esp), %ebx + sbbl %eax, %ebx + movl 28(%esp), %eax + mull %edi + movl 28(%esp), %eax + movl %edx, %ecx + mull %ebx + addl %eax, %ecx + movl %edi, %eax + movl %ebx, 24(%esp) + movl %edx, %ebx + adcl $0, %ebx + mull 32(%esp) + addl %ecx, %eax + adcl %ebx, %edx + subl %ecx, %eax + movl %edx, 16(%esp) + sbbl %ebx, %edx + movl 20(%esp), %ebx + jae ..B3.48 +..B3.47: + movl $1, %ecx + jmp ..B3.49 +..B3.48: + xorl %ecx, %ecx +..B3.49: + movl 24(%esp), %eax + xorl %edi, %edi + mull 32(%esp) + addl %edx, %ecx + addl 16(%esp), %eax + adcl $0, %ecx + movl %ecx, %edx + subl %edi, %edx + jl ..B3.51 +..B3.50: + xorl %edx, %edx + jmp ..B3.52 +..B3.51: + movl $1, %edx +..B3.52: + movl 84(%esp), %edi + addl %edx, %esi + movl 80(%esp), %edx + adcl $0, 40(%esp) + orl 72(%esp), %edi + orl 76(%esp), %edx + orl %edx, %edi + je ..B3.54 +..B3.53: + movl $1, %edi + jmp ..B3.55 +..B3.54: + xorl %edi, %edi +..B3.55: + movl %eax, %edx + addl %eax, %eax + shrl $31, %edx + addl %ecx, %ecx + orl %ecx, %edx + addl %edi, %eax + movl 40(%esp), %ecx + adcl $0, %edx + addl %esi, %ebx + movl %ebx, %edi + adcl %ecx, 64(%esp) + subl %esi, %edi + movl 64(%esp), %esi + sbbl %ecx, %esi + jae ..B3.57 +..B3.56: + movl $1, %ecx + jmp ..B3.58 +..B3.57: + xorl %ecx, %ecx +..B3.58: + movl 40(%esp), %esi + sarl $31, %esi + movl 68(%esp), %edi + addl %esi, %edi + addl %ecx, %edi + movl %edi, 68(%esp) +..B3.59: + movl 68(%esp), %ecx + movl %ecx, %esi + shll $31, %esi + cmpl $31, %ecx + jbe ..B3.61 +..B3.60: + movl 64(%esp), %edi + shrl %cl, %edi + movl $0, 20(%esp) + movl %edi, 24(%esp) + jmp ..B3.62 +..B3.61: + movl %ebx, %edi + movl %eax, 16(%esp) + movl 64(%esp), %eax + shrdl %cl, %eax, %edi + shrl %cl, %eax + movl %eax, 20(%esp) + movl %edi, 24(%esp) + movl 16(%esp), %eax +..B3.62: + movl 24(%ebp), %edi + orl 20(%esp), %esi + movl 24(%esp), %ecx + movl %esi, 12(%edi) + movl 68(%esp), %esi + andl %esi, %ebx + shll $31, %ebx + movl %ecx, 8(%edi) + cmpl $31, %esi + jbe ..B3.64 +..B3.63: + movl %edx, %eax + xorl %esi, %esi + movl 68(%esp), %ecx + shrl %cl, %eax + jmp ..B3.65 +..B3.64: + movl %edx, %esi + movl 68(%esp), %ecx + shrdl %cl, %edx, %eax + shrl %cl, %esi +..B3.65: + addl $4, %esp + orl %esi, %ebx + movl 24(%ebp), %ecx + lea 108(%esp), %edx + pushl %edx + movl %eax, 16(%ecx) + movl -52(%edx), %eax + addl -44(%edx), %eax + movl %ebx, 20(%ecx) + movl -20(%edx), %ebx + movl %eax, 4(%ecx) + call fesetenv@PLT +..B3.66: + movl 140(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B3.68 +..B3.67: + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B3.68: + call __stack_chk_fail@PLT +..B3.69: + movl %ebx, %eax + movl 24(%ebp), %edx + movl 8(%eax), %esi + movl 12(%eax), %edi + movl (%eax), %ecx + movl %esi, 8(%edx) + movl %edi, 12(%edx) + movl %ecx, (%edx) + movl 4(%eax), %ebx + movl 16(%eax), %ecx + movl 20(%eax), %eax + movl %ebx, 4(%edx) + movl %ecx, 16(%edx) + movl %eax, 20(%edx) + movl 140(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + je ..B3.67 +..B3.71: + movl 92(%esp), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type __dpml_divide__,@function + .size __dpml_divide__,.-__dpml_divide__ + .data +# -- End __dpml_divide__ + .text +# -- Begin __dpml_evaluate_rational__ + .text + .align 16,0x90 + .hidden __dpml_evaluate_rational__ + .globl __dpml_evaluate_rational__ +__dpml_evaluate_rational__: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +# parameter 4: 24 + %ebp +# parameter 5: 32 + %ebp +..B4.1: +..L7: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $196, %esp + movl 12(%ebp), %eax + movl %eax, 96(%esp) + xorl %eax, %eax + movl 8(%ebp), %ecx + movl %gs:20, %edx + movl 24(%ebp), %esi + xorl %esp, %edx + movl %edx, 180(%esp) + movl %esi, %edx + movl 28(%ebp), %edi + andl $68, %edx + sarl $26, %edi + addl 4(%ecx), %edi + movl %esi, 104(%esp) + orl %eax, %edx + movl %edi, 4(%ecx) + jne ..B4.3 +..B4.2: + movl 8(%ebp), %ebx + movl $136, %edx + cmpl $0, (%ebx) + jne ..L8 + movl $0, %edx +..L8: + xorl %esi, %edx + movl %edx, 104(%esp) + jmp ..B4.19 +..B4.3: + movl %edi, 56(%esp) + movl 8(%ebp), %edi + movl %esi, 88(%esp) + movl 12(%edi), %esi + movl %esi, %ebx + movl 8(%edi), %ecx + movl %ecx, %eax + imull %ecx, %ebx + mull %ecx + addl %ebx, %ebx + addl %ebx, %edx + movl 16(%edi), %ebx + movl %eax, 36(%esp) + movl %ebx, %eax + movl %edx, 40(%esp) + mull %ecx + movl 20(%edi), %edi + movl %edi, 48(%esp) + movl %edx, %edi + movl 48(%esp), %eax + mull %ecx + addl %eax, %edi + movl %esi, %eax + movl %ecx, 44(%esp) + movl %edx, %ecx + adcl $0, %ecx + mull %ebx + addl %edi, %eax + movl %esi, 32(%esp) + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 52(%esp) + movl %ebx, 64(%esp) + lea 156(%esp), %ebx + movl -68(%ebx), %esi + sbbl %ecx, %edx + movl -100(%ebx), %edi + jae ..B4.5 +..B4.4: + movl $1, %ecx + jmp ..B4.6 +..B4.5: + xorl %ecx, %ecx +..B4.6: + movl %ebx, 72(%esp) + addl %edi, %edi + movl 32(%esp), %eax + movl 48(%esp), %ebx + mull %ebx + addl %edx, %ecx + addl 52(%esp), %eax + movl %eax, 60(%esp) + adcl $0, %ecx + movl %ecx, 68(%esp) + movl 64(%esp), %ecx + movl %ecx, %eax + movl %edi, 160(%esp) + movl 44(%esp), %edi + mull %edi + movl 32(%esp), %eax + movl %esi, 88(%esp) + movl %edx, %esi + mull %ecx + addl %eax, %esi + movl %ebx, %eax + movl %edx, %ecx + adcl $0, %ecx + mull %edi + addl %esi, %eax + movl $0, 156(%esp) + adcl %ecx, %edx + subl %esi, %eax + movl %edx, 56(%esp) + movl 88(%esp), %esi + sbbl %ecx, %edx + movl 72(%esp), %ebx + movl 68(%esp), %ecx + jae ..B4.8 +..B4.7: + movl $1, %edi + jmp ..B4.9 +..B4.8: + xorl %edi, %edi +..B4.9: + movl 32(%esp), %eax + mull 48(%esp) + addl %edx, %edi + addl 56(%esp), %eax + movl %eax, 52(%esp) + adcl $0, %edi + movl %edi, 64(%esp) + movl 36(%esp), %eax + movl 60(%esp), %edi + addl %edi, %eax + movl 40(%esp), %edx + adcl %ecx, %edx + movl %eax, 36(%esp) + subl %edi, %eax + movl %edx, 40(%esp) + movl 64(%esp), %edi + sbbl %ecx, %edx + jae ..B4.11 +..B4.10: + movl $1, 48(%esp) + jmp ..B4.12 +..B4.11: + movl $0, 48(%esp) +..B4.12: + movl 32(%esp), %eax + mull 44(%esp) + movl %esi, 88(%esp) + movl %eax, %esi + movl 44(%esp), %eax + movl %edx, %ecx + mull %eax + movl %edx, %eax + movl %ecx, %edx + addl %esi, %eax + adcl $0, %edx + addl %eax, %esi + adcl %edx, %ecx + subl %eax, %esi + movl %ecx, 56(%esp) + movl 88(%esp), %esi + sbbl %edx, %ecx + jae ..B4.14 +..B4.13: + movl $1, %ecx + jmp ..B4.15 +..B4.14: + xorl %ecx, %ecx +..B4.15: + movl 32(%esp), %eax + mull %eax + addl %edx, %ecx + addl 56(%esp), %eax + movl %eax, 44(%esp) + adcl $0, %ecx + movl %ecx, 60(%esp) + movl 36(%esp), %eax + movl 52(%esp), %ecx + addl %ecx, %eax + movl 40(%esp), %edx + adcl %edi, %edx + movl %eax, 36(%esp) + subl %ecx, %eax + movl %edx, 40(%esp) + movl 60(%esp), %ecx + sbbl %edi, %edx + jae ..B4.17 +..B4.16: + movl $1, %edi + jmp ..B4.18 +..B4.17: + xorl %edi, %edi +..B4.18: + movl 48(%esp), %edx + addl %edi, %edx + movl 36(%esp), %edi + movl %edi, 172(%esp) + movl 40(%esp), %edi + movl %edi, 176(%esp) + movl 44(%esp), %edi + addl %edx, %edi + movl %edi, 164(%esp) + adcl $0, %ecx + movl %ecx, 168(%esp) +..B4.19: + addl $12, %esp + xorl %ecx, %ecx + pushl %ecx + pushl %ecx + pushl %ebx + call __dpml_ffs_and_shift__ +..B4.20: + xorl %ecx, %ecx + movl 4(%ebx), %eax + cltd + xorl %eax, %eax + movl 16(%ebp), %edi + subl %edi, %eax + sbbl 20(%ebp), %ecx + imull 4(%ebx), %ecx + imull %eax, %edx + addl %edx, %ecx + mull 4(%ebx) + addl %ecx, %edx + movl %esi, %ecx + movl %edx, 112(%esp) + andl $512, %ecx + xorl %edx, %edx + shll $4, %edi + movl %eax, 108(%esp) + orl %edx, %ecx + movl %edi, 100(%esp) + je ..B4.22 +..B4.21: + movl %esi, %ecx + andl $1024, %ecx + orl %edx, %ecx + je ..B4.23 +..B4.22: + xorl %edx, %edx + jmp ..B4.24 +..B4.23: + movl $1, %edx +..B4.24: + movl 32(%ebp), %ecx + lea (%edx,%edx,2), %edx + movl %esi, %eax + lea (,%edx,8), %edi + andl $15, %eax + lea (%ecx,%edx,8), %ecx + xorl %edx, %edx + orl %edx, %eax + call ..L9 +..L9: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L9](%edx), %edx + movl %edx, 124(%esp) + je ..B4.52 +..B4.25: + negl %edi + xorl %edx, %edx + addl 32(%ebp), %edi + movl 104(%esp), %eax + addl $24, %edi + andl $8, %eax + orl %edx, %eax + je ..B4.27 +..B4.26: + movl 124(%esp), %edx + lea __eval_neg_poly@GOTOFF(%edx), %edx + movl %edx, 32(%esp) + jmp ..B4.28 +..B4.27: + movl 124(%esp), %eax + lea __eval_pos_poly@GOTOFF(%eax), %edx + lea __eval_neg_poly@GOTOFF(%eax), %eax + movl %eax, 32(%esp) +..B4.28: + movl %esi, 88(%esp) + andl $240, %esi + xorl %eax, %eax + movl %esi, 116(%esp) + orl %esi, %eax + movl 88(%esp), %esi + jne ..B4.30 +..B4.29: + movl 32(%ebp), %ecx +..B4.30: + cmpl 32(%esp), %edx + jne ..B4.32 +..B4.31: + movl 108(%esp), %edx + movl %ebx, %eax + movl %edx, 4(%esp) + movl 112(%esp), %edx + movl %edx, 8(%esp) + movl 16(%ebp), %edx + movl %edx, 16(%esp) + movl 20(%ebp), %edx + movl %edx, 20(%esp) + movl 96(%esp), %edx + movl %ecx, 32(%esp) + call __eval_neg_poly. + jmp ..B4.153 +..B4.32: + movl 108(%esp), %edx + movl %ebx, %eax + movl %edx, 4(%esp) + movl 112(%esp), %edx + movl %edx, 8(%esp) + movl 16(%ebp), %edx + movl %edx, 16(%esp) + movl 20(%ebp), %edx + movl %edx, 20(%esp) + movl 96(%esp), %edx + movl %ecx, 32(%esp) + call __eval_pos_poly. +..B4.153: + movl 32(%esp), %ecx +..B4.33: + movl %esi, %eax + xorl %edx, %edx + andl $2, %eax + orl %edx, %eax + jne ..B4.35 +..B4.34: + movl 4(%ecx), %edx + movl %edx, 92(%esp) + jmp ..B4.51 +..B4.35: + movl 8(%ebp), %edx + movl %edi, 48(%esp) + movl %esi, 88(%esp) + movl 12(%edx), %esi + movl 12(%ecx), %edi + movl 8(%edx), %eax + movl %ebx, 72(%esp) + movl 8(%ecx), %ebx + movl %esi, 32(%esp) + movl %edi, 36(%esp) + imull %ebx, %esi + imull %eax, %edi + movl %eax, 52(%esp) + addl %edi, %esi + mull %ebx + addl %esi, %edx + movl %edx, 44(%esp) + movl 8(%ebp), %edx + movl %eax, 40(%esp) + movl %ebx, %eax + movl 8(%ebp), %edi + mull 16(%edx) + movl 16(%ecx), %esi + movl %ebx, %eax + movl %esi, 64(%esp) + movl 20(%ecx), %esi + movl 20(%edi), %edi + movl %esi, 60(%esp) + movl %edx, %esi + mull %edi + movl %ebx, 56(%esp) + addl %eax, %esi + movl 8(%ebp), %ebx + movl %edi, 84(%esp) + movl %edx, %edi + adcl $0, %edi + movl 16(%ebx), %eax + mull 36(%esp) + addl %esi, %eax + movl 72(%esp), %ebx + adcl %edi, %edx + subl %esi, %eax + movl %edx, 68(%esp) + movl 88(%esp), %esi + sbbl %edi, %edx + movl 48(%esp), %edi + jae ..B4.37 +..B4.36: + movl $1, 80(%esp) + jmp ..B4.38 +..B4.37: + movl $0, 80(%esp) +..B4.38: + movl 84(%esp), %eax + mull 36(%esp) + movl %esi, 88(%esp) + movl 80(%esp), %esi + addl %edx, %esi + addl 68(%esp), %eax + movl %edi, 48(%esp) + adcl $0, %esi + movl %esi, 80(%esp) + movl 8(%ebp), %esi + movl %eax, 76(%esp) + movl 52(%esp), %eax + movl 4(%esi), %edx + movl (%esi), %edi + addl 4(%ecx), %edx + xorl %edi, (%ecx) + movl 64(%esp), %edi + movl %edx, 92(%esp) + movl %edx, 4(%ecx) + mull %edi + movl %edi, %eax + movl %edx, %esi + mull 32(%esp) + addl %eax, %esi + movl %edx, %edi + movl 52(%esp), %eax + adcl $0, %edi + mull 60(%esp) + addl %esi, %eax + adcl %edi, %edx + subl %esi, %eax + movl %edx, 72(%esp) + movl 88(%esp), %esi + sbbl %edi, %edx + movl 48(%esp), %edi + jae ..B4.40 +..B4.39: + movl $1, 68(%esp) + jmp ..B4.41 +..B4.40: + movl $0, 68(%esp) +..B4.41: + movl 60(%esp), %eax + mull 32(%esp) + movl %esi, 88(%esp) + movl 68(%esp), %esi + addl %edx, %esi + addl 72(%esp), %eax + movl %eax, 64(%esp) + adcl $0, %esi + movl %esi, 68(%esp) + movl 76(%esp), %esi + movl 40(%esp), %eax + addl %esi, %eax + movl %edi, 48(%esp) + movl 44(%esp), %edi + movl 80(%esp), %edx + adcl %edx, %edi + movl %eax, 40(%esp) + subl %esi, %eax + movl %edi, 44(%esp) + movl 88(%esp), %esi + sbbl %edx, %edi + movl 48(%esp), %edi + jae ..B4.43 +..B4.42: + movl $1, 72(%esp) + jmp ..B4.44 +..B4.43: + movl $0, 72(%esp) +..B4.44: + movl %edi, 48(%esp) + movl 56(%esp), %edi + movl %edi, %eax + mull 52(%esp) + movl %edi, %eax + movl %esi, 88(%esp) + movl %edx, %esi + mull 32(%esp) + addl %eax, %esi + movl %edx, %edi + movl 52(%esp), %eax + adcl $0, %edi + mull 36(%esp) + addl %esi, %eax + adcl %edi, %edx + subl %esi, %eax + movl %edx, 60(%esp) + movl 88(%esp), %esi + sbbl %edi, %edx + movl 48(%esp), %edi + jae ..B4.46 +..B4.45: + movl $1, 56(%esp) + jmp ..B4.47 +..B4.46: + movl $0, 56(%esp) +..B4.47: + movl 32(%esp), %eax + mull 36(%esp) + movl %esi, 88(%esp) + movl 56(%esp), %esi + addl %edx, %esi + addl 60(%esp), %eax + movl %eax, 52(%esp) + adcl $0, %esi + movl %esi, 56(%esp) + movl 64(%esp), %esi + movl 40(%esp), %eax + addl %esi, %eax + movl %edi, 48(%esp) + movl 44(%esp), %edi + movl 68(%esp), %edx + adcl %edx, %edi + movl %eax, 40(%esp) + subl %esi, %eax + movl %edi, 44(%esp) + movl 88(%esp), %esi + sbbl %edx, %edi + movl 48(%esp), %edi + jae ..B4.49 +..B4.48: + movl $1, %edx + jmp ..B4.50 +..B4.49: + xorl %edx, %edx +..B4.50: + movl 72(%esp), %eax + addl %edx, %eax + movl 40(%esp), %edx + movl %edx, 16(%ecx) + movl 44(%esp), %edx + movl %edx, 20(%ecx) + movl 52(%esp), %edx + addl %eax, %edx + movl 56(%esp), %eax + adcl $0, %eax + movl %edx, 8(%ecx) + movl %eax, 12(%ecx) +..B4.51: + movl 96(%esp), %edx + movl 100(%esp), %eax + lea 24(%edx,%eax), %edx + movl 92(%esp), %eax + addl -8(%edx), %eax + movl %edx, 96(%esp) + movl %eax, 4(%ecx) + jmp ..B4.54 +..B4.52: + orl $-1792, %esi + movl %esi, %edx + movl %esi, %eax + andl $240, %edx + andl $1024, %eax + movl %edx, 116(%esp) + xorl %edx, %edx + movl 32(%ebp), %edi + orl %edx, %eax + je ..B4.54 +..B4.53: + movl 96(%esp), %edx + movl 100(%esp), %eax + lea 24(%edx,%eax), %edx + movl %edx, 96(%esp) +..B4.54: + xorl %edx, %edx + movl 116(%esp), %eax + orl %edx, %eax + je ..B4.82 +..B4.55: + movl 104(%esp), %eax + andl $128, %eax + orl %edx, %eax + je ..B4.57 +..B4.56: + movl 124(%esp), %edx + lea __eval_neg_poly@GOTOFF(%edx), %eax + movl %eax, %edx + jmp ..B4.58 +..B4.57: + movl 124(%esp), %edx + lea __eval_pos_poly@GOTOFF(%edx), %eax + lea __eval_neg_poly@GOTOFF(%edx), %edx +..B4.58: + cmpl %edx, %eax + jne ..B4.60 +..B4.59: + movl 108(%esp), %edx + movl %ebx, %eax + movl %edx, 4(%esp) + movl %edi, %ecx + movl 112(%esp), %edx + movl %edx, 8(%esp) + movl 16(%ebp), %edx + movl %edx, 16(%esp) + movl 20(%ebp), %edx + movl %edx, 20(%esp) + movl 96(%esp), %edx + call __eval_neg_poly. + jmp ..B4.61 +..B4.60: + movl 108(%esp), %edx + movl %ebx, %eax + movl %edx, 4(%esp) + movl %edi, %ecx + movl 112(%esp), %edx + movl %edx, 8(%esp) + movl 16(%ebp), %edx + movl %edx, 16(%esp) + movl 20(%ebp), %edx + movl %edx, 20(%esp) + movl 96(%esp), %edx + call __eval_pos_poly. +..B4.61: + movl %esi, %edx + xorl %eax, %eax + andl $32, %edx + orl %eax, %edx + jne ..B4.63 +..B4.62: + movl 4(%edi), %ebx + jmp ..B4.79 +..B4.63: + movl 8(%ebp), %ebx + movl %esi, 88(%esp) + movl 12(%edi), %edx + movl 12(%ebx), %esi + movl 8(%ebx), %eax + movl 8(%edi), %ebx + movl %esi, 32(%esp) + movl %edx, 36(%esp) + imull %ebx, %esi + imull %eax, %edx + movl %eax, 48(%esp) + addl %edx, %esi + mull %ebx + addl %esi, %edx + movl %edx, 44(%esp) + movl 8(%ebp), %edx + movl %eax, 40(%esp) + movl %ebx, %eax + movl 8(%ebp), %esi + mull 16(%edx) + movl 20(%esi), %ecx + movl %ebx, %eax + movl 16(%edi), %esi + movl %esi, 68(%esp) + movl 20(%edi), %esi + movl %esi, 56(%esp) + movl %edx, %esi + mull %ecx + movl %ebx, 52(%esp) + movl %edx, %ebx + movl 8(%ebp), %edx + addl %eax, %esi + movl %ecx, 76(%esp) + adcl $0, %ebx + movl 16(%edx), %eax + mull 36(%esp) + addl %esi, %eax + adcl %ebx, %edx + subl %esi, %eax + movl %edx, 72(%esp) + movl 88(%esp), %esi + sbbl %ebx, %edx + jae ..B4.65 +..B4.64: + movl $1, %ecx + jmp ..B4.66 +..B4.65: + xorl %ecx, %ecx +..B4.66: + movl 76(%esp), %eax + mull 36(%esp) + addl %edx, %ecx + addl 72(%esp), %eax + movl %eax, 64(%esp) + movl 8(%ebp), %eax + adcl $0, %ecx + movl %ecx, 80(%esp) + movl 68(%esp), %ecx + movl 4(%eax), %edx + addl 4(%edi), %edx + movl (%eax), %ebx + movl 48(%esp), %eax + movl %edx, 84(%esp) + movl %edx, 4(%edi) + mull %ecx + movl %ecx, %eax + xorl %ebx, (%edi) + movl %edx, %ebx + mull 32(%esp) + addl %eax, %ebx + movl %edx, %ecx + movl 48(%esp), %eax + adcl $0, %ecx + mull 56(%esp) + addl %ebx, %eax + adcl %ecx, %edx + subl %ebx, %eax + movl %edx, 60(%esp) + movl 84(%esp), %ebx + sbbl %ecx, %edx + movl 80(%esp), %ecx + jae ..B4.68 +..B4.67: + movl $1, 72(%esp) + jmp ..B4.69 +..B4.68: + movl $0, 72(%esp) +..B4.69: + movl 56(%esp), %eax + mull 32(%esp) + movl %esi, 88(%esp) + movl 72(%esp), %esi + addl %edx, %esi + addl 60(%esp), %eax + movl %eax, 68(%esp) + adcl $0, %esi + movl %esi, 72(%esp) + movl 40(%esp), %eax + movl 64(%esp), %esi + addl %esi, %eax + movl 44(%esp), %edx + adcl %ecx, %edx + movl %eax, 40(%esp) + subl %esi, %eax + movl %edx, 44(%esp) + movl 88(%esp), %esi + sbbl %ecx, %edx + jae ..B4.71 +..B4.70: + movl $1, 60(%esp) + jmp ..B4.72 +..B4.71: + movl $0, 60(%esp) +..B4.72: + movl 52(%esp), %ecx + movl %ecx, %eax + mull 48(%esp) + movl %ecx, %eax + movl %esi, 88(%esp) + movl %edx, %esi + mull 32(%esp) + addl %eax, %esi + movl %edx, %ecx + movl 48(%esp), %eax + adcl $0, %ecx + mull 36(%esp) + addl %esi, %eax + adcl %ecx, %edx + subl %esi, %eax + movl %edx, 56(%esp) + movl 88(%esp), %esi + sbbl %ecx, %edx + jae ..B4.74 +..B4.73: + movl $1, %ecx + jmp ..B4.75 +..B4.74: + xorl %ecx, %ecx +..B4.75: + movl 32(%esp), %eax + mull 36(%esp) + addl %edx, %ecx + addl 56(%esp), %eax + movl %esi, 88(%esp) + adcl $0, %ecx + movl %ecx, 52(%esp) + movl 68(%esp), %esi + movl 40(%esp), %ecx + addl %esi, %ecx + movl %eax, 48(%esp) + movl 44(%esp), %edx + movl 72(%esp), %eax + adcl %eax, %edx + movl %ecx, 40(%esp) + subl %esi, %ecx + movl %edx, 44(%esp) + movl 52(%esp), %ecx + sbbl %eax, %edx + movl 88(%esp), %esi + jae ..B4.77 +..B4.76: + movl $1, %edx + jmp ..B4.78 +..B4.77: + xorl %edx, %edx +..B4.78: + movl 60(%esp), %eax + addl %edx, %eax + movl 40(%esp), %edx + movl %edx, 16(%edi) + movl 44(%esp), %edx + movl %edx, 20(%edi) + movl 48(%esp), %edx + addl %eax, %edx + movl %edx, 8(%edi) + adcl $0, %ecx + movl %ecx, 12(%edi) +..B4.79: + movl 96(%esp), %edx + xorl %ecx, %ecx + movl 100(%esp), %eax + addl 16(%eax,%edx), %ebx + movl %ebx, 4(%edi) + movl %esi, %ebx + andl $1024, %ebx + orl %ecx, %ebx + je ..B4.83 +..B4.80: + movl 180(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B4.148 +..B4.81: + addl $196, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B4.82: + orl $-256, %esi +..B4.83: + andl $256, %esi + xorl %eax, %eax + orl %eax, %esi + jne ..B4.146 +..B4.84: + movl 124(%esp), %eax + movl 32(%ebp), %ecx + movl %ecx, %edi + addl $24, %edi + lea __ux_one__@GOTOFF(%eax), %edx + jne ..L10 + movl %edx, %edi +..L10: + testl %ecx, %ecx + movl 12(%edi), %esi + jne ..L11 + movl %edx, %ecx +..L11: + movl 8(%edi), %ebx + cmpl %edx, %edi + movl 16(%edi), %eax + movl %esi, 112(%esp) + movl %ecx, 120(%esp) + movl %ebx, 108(%esp) + movl %eax, 116(%esp) + movl 20(%edi), %esi + je ..B4.150 +..B4.85: + xorl %edx, %edx + movl 112(%esp), %ecx + subl %edx, %ecx + jl ..B4.88 +..B4.86: + addl $12, %esp + pushl %edx + pushl %edx + pushl %edi + call __dpml_ffs_and_shift__ +..B4.87: + movl 8(%edi), %eax + movl 12(%edi), %edx + movl 16(%edi), %ecx + movl 20(%edi), %esi + movl %eax, 108(%esp) + movl %edx, 112(%esp) + movl %ecx, 116(%esp) +..B4.88: + addl $4, %esp + lea 124(%esp), %edx + pushl %edx + movl -4(%edx), %ebx + call fegetenv@PLT +..B4.89: + movl %esi, 72(%esp) + movl 112(%esp), %esi + movl %esi, %eax + movl 108(%esp), %ecx + movl %ecx, %edx + movl %edi, 44(%esp) + movl %esi, %edi + shll $31, %eax + shrl $1, %edx + shrl $1, %edi + orl %edx, %eax + movl %eax, 48(%esp) + movl %esi, %eax + movl %edi, 52(%esp) + andl $-64, %eax + fildll 48(%esp) + andl $63, %esi + fstpl 64(%esp) + xorl %edx, %edx + fldl 64(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fdiv %st, %st(1) + shrl $1, %eax + movl %eax, 52(%esp) + movl %ecx, %eax + movl 120(%esp), %edi + shrl $17, %eax + shll $15, %esi + movl %edx, 48(%esp) + orl %esi, %eax + movl 72(%esp), %esi + shll $15, %ecx + shrl $17, %esi + orl %esi, %ecx + movl 12(%edi), %esi + movl %esi, 88(%esp) + fxch %st(1) + fstpl 64(%esp) + fldl 64(%esp) + movl (%edi), %esi + fld %st(0) + fildll 48(%esp) + movl %eax, 52(%esp) + movl %ecx, 48(%esp) + movl 8(%edi), %eax + movl 16(%edi), %ecx + movl %eax, 92(%esp) + movl %ecx, 80(%esp) + movl 20(%edi), %eax + movl 44(%esp), %ecx + movl %eax, 84(%esp) + movl 32(%ebp), %eax + xorl (%ecx), %esi + fstpl 64(%esp) + fldl 64(%esp) + fildll 48(%esp) + movl %esi, (%eax) + fstpl 64(%esp) + fxch %st(1) + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 56(%esp) + fldcw 32(%esp) + movl %edx, 48(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fldl 64(%esp) + movl 56(%esp), %eax + addl $-1280, %eax + movl 60(%esp), %esi + adcl $-1, %esi + fmul %st(1), %st + andl $-16, %esi + movl %esi, 52(%esp) + fstpl 64(%esp) + fldl 64(%esp) + fildll 48(%esp) + fstpl 64(%esp) + fldl 64(%esp) + fmul %st, %st(3) + movl 4(%edi), %edi + fxch %st(3) + fsubrp %st, %st(5) + fmul %st(2), %st + movl %esi, 96(%esp) + fsubrp %st, %st(4) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + movl 88(%esp), %eax + movl %eax, %ebx + movl 92(%esp), %esi + subl 4(%ecx), %edi + movl %esi, %ecx + shll $21, %ebx + shrl $11, %ecx + fmulp %st, %st(3) + orl %ecx, %ebx + movl %edi, 100(%esp) + movl %eax, %edi + shrl $1, %edi + movl %ebx, %ecx + shrl $22, %ecx + andl $-1024, %edi + shll $10, %ebx + orl %edi, %ecx + movl %ebx, 48(%esp) + movl %eax, %ebx + movl %ecx, 52(%esp) + andl $-64, %ebx + fxch %st(2) + fmulp %st, %st(3) + andl $63, %eax + shrl $1, %ebx + movl 84(%esp), %ecx + shll $15, %eax + shrl $17, %ecx + fxch %st(2) + fstpl 64(%esp) + fldl 64(%esp) + fildll 48(%esp) + movl %edx, 48(%esp) + movl %esi, %edx + movl %ebx, 52(%esp) + shrl $17, %edx + shll $15, %esi + orl %eax, %edx + orl %ecx, %esi + fstpl 64(%esp) + fldl 64(%esp) + movl 124(%esp), %eax + fmul %st(1), %st + fildll 48(%esp) + movl %esi, 48(%esp) + movl %edx, 52(%esp) + fstpl 64(%esp) + fldl 64(%esp) + fildll 48(%esp) + fstpl 64(%esp) + fldl 64(%esp) + fmulp %st, %st(4) + fxch %st(3) + fstpl 64(%esp) + fldl 64(%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + fmulp %st, %st(5) + fxch %st(4) + fstpl 64(%esp) + fldl 64(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpl 64(%esp) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldl 64(%esp) + fxch %st(2) + fstpl 64(%esp) + fldl 64(%esp) + fldt .L_2il0floatpacket.4@GOTOFF(%eax) + fmulp %st, %st(3) + fxch %st(2) + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 56(%esp) + fldcw 32(%esp) + movl 56(%esp), %ebx + movl %ebx, %edx + movl 60(%esp), %ecx + movl %ecx, %edi + fxch %st(1) + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 56(%esp) + fldcw 32(%esp) + shrl $30, %edx + shll $2, %ebx + shll $2, %ecx + movl 56(%esp), %esi + orl %ecx, %edx + addl %esi, %ebx + movl %ebx, %ecx + movl 60(%esp), %eax + adcl %eax, %edx + shrl $30, %edi + subl %esi, %ecx + movl %edx, 76(%esp) + movl %edi, 104(%esp) + sbbl %eax, %edx + movl 72(%esp), %esi + movl 96(%esp), %edx + jae ..B4.91 +..B4.90: + movl $1, %ecx + jmp ..B4.92 +..B4.91: + xorl %ecx, %ecx +..B4.92: + addl %ecx, 104(%esp) + movl 124(%esp), %ecx + fldt .L_2il0floatpacket.5@GOTOFF(%ecx) + fmulp %st, %st(1) + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 56(%esp) + fldcw 32(%esp) + movl 60(%esp), %edi + movl 56(%esp), %ecx + movl %ecx, 44(%esp) + lea (%edi,%edx,4), %edx + movl %edx, 48(%esp) + orl %edx, %ecx + jne ..B4.94 +..B4.93: + movl $-1, %edx + movl %edx, 44(%esp) + movl %edx, 48(%esp) +..B4.94: + movl %ebx, %eax + xorl %edi, %edi + mull 116(%esp) + xorl %ecx, %ecx + movl %ebx, %eax + subl 104(%esp), %ecx + movl %ecx, 32(%esp) + movl %edx, %ecx + sbbl $0, %edi + mull %esi + addl %eax, %ecx + movl 116(%esp), %eax + movl %edi, 68(%esp) + movl %edx, %edi + adcl $0, %edi + mull 76(%esp) + addl %ecx, %eax + adcl %edi, %edx + subl %ecx, %eax + movl %edx, 36(%esp) + movl 68(%esp), %ecx + sbbl %edi, %edx + jae ..B4.96 +..B4.95: + movl $1, 64(%esp) + jmp ..B4.97 +..B4.96: + movl $0, 64(%esp) +..B4.97: + movl %esi, %eax + movl %esi, 72(%esp) + movl 76(%esp), %esi + mull %esi + movl %ecx, 68(%esp) + movl 64(%esp), %ecx + addl %edx, %ecx + movl %esi, %edx + addl 36(%esp), %eax + movl 108(%esp), %esi + adcl $0, %ecx + movl %ecx, 64(%esp) + movl 112(%esp), %ecx + movl %ecx, %edi + imull %ebx, %edi + imull %esi, %edx + movl %eax, 60(%esp) + movl %esi, %eax + addl %edx, %edi + mull %ebx + movl %eax, 40(%esp) + movl %ebx, %eax + addl %edi, %edx + movl %edx, 52(%esp) + mull %esi + movl %ebx, %eax + movl %edx, %edi + mull %ecx + addl %eax, %edi + movl %esi, %eax + movl %edx, %ecx + adcl $0, %ecx + mull 76(%esp) + addl %edi, %eax + movl 72(%esp), %esi + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 56(%esp) + sbbl %ecx, %edx + movl 68(%esp), %ecx + jae ..B4.99 +..B4.98: + movl $1, %edi + jmp ..B4.100 +..B4.99: + xorl %edi, %edi +..B4.100: + movl %ebx, 36(%esp) + andl %ecx, %esi + movl 112(%esp), %ebx + movl %ebx, %eax + mull 76(%esp) + addl %edx, %edi + andl %ebx, %ecx + addl 56(%esp), %eax + movl %eax, 72(%esp) + movl 116(%esp), %edx + adcl $0, %edi + movl 32(%esp), %eax + andl %eax, %edx + movl 60(%esp), %ebx + andl 108(%esp), %eax + addl %ebx, %edx + movl %eax, 32(%esp) + movl 64(%esp), %eax + adcl %eax, %esi + movl %edx, 116(%esp) + subl %ebx, %edx + movl %esi, %ebx + sbbl %eax, %ebx + movl 36(%esp), %ebx + jae ..B4.102 +..B4.101: + movl $1, %edx + jmp ..B4.103 +..B4.102: + xorl %edx, %edx +..B4.103: + movl %ecx, 68(%esp) + movl 40(%esp), %ecx + movl 116(%esp), %eax + addl %ecx, %eax + movl %ebx, 36(%esp) + movl 52(%esp), %ebx + adcl %ebx, %esi + movl %eax, 116(%esp) + subl %ecx, %eax + movl %esi, %ecx + sbbl %ebx, %ecx + movl 36(%esp), %ebx + movl 68(%esp), %ecx + jae ..B4.105 +..B4.104: + movl $1, %eax + jmp ..B4.106 +..B4.105: + xorl %eax, %eax +..B4.106: + addl %eax, %edx + movl %edx, 40(%esp) + movl 72(%esp), %edx + movl 32(%esp), %eax + addl %edx, %eax + movl %eax, 32(%esp) + adcl %edi, %ecx + subl %edx, %eax + movl %ecx, %edx + sbbl %edi, %edx + movl 40(%esp), %edx + jae ..B4.108 +..B4.107: + movl $1, 40(%esp) + jmp ..B4.109 +..B4.108: + movl $0, 40(%esp) +..B4.109: + movl 32(%esp), %edi + addl %edx, %edi + movl %edi, 32(%esp) + adcl $0, %ecx + subl %edx, %edi + movl $0, %edx + movl %ecx, %edi + sbbl %edx, %edi + jae ..B4.111 +..B4.110: + movl $1, %edi + jmp ..B4.112 +..B4.111: + xorl %edi, %edi +..B4.112: + xorl %eax, %eax + movl 40(%esp), %edx + addl %edi, %edx + xorl %edi, %edi + subl %edx, %edi + movl %eax, %edx + movl 80(%esp), %eax + sbbl $0, %edx + subl 116(%esp), %eax + movl 84(%esp), %eax + sbbl %esi, %eax + jae ..B4.114 +..B4.113: + movl $1, 56(%esp) + jmp ..B4.115 +..B4.114: + movl $0, 56(%esp) +..B4.115: + movl 80(%esp), %eax + subl 116(%esp), %eax + movl %eax, 52(%esp) + movl 84(%esp), %eax + sbbl %esi, %eax + movl 92(%esp), %esi + subl 32(%esp), %esi + movl 88(%esp), %esi + movl %eax, 40(%esp) + sbbl %ecx, %esi + jae ..B4.117 +..B4.116: + movl $1, %esi + jmp ..B4.118 +..B4.117: + xorl %esi, %esi +..B4.118: + subl %esi, %edi + movl 92(%esp), %esi + sbbl $0, %edx + subl 32(%esp), %esi + movl 88(%esp), %eax + sbbl %ecx, %eax + movl %esi, %ecx + subl 56(%esp), %ecx + movl $0, %ecx + movl %eax, 60(%esp) + sbbl %ecx, %eax + jae ..B4.121 +..B4.119: + movl $1, %ecx +..B4.121: + subl %ecx, %edi + movl 60(%esp), %ecx + sbbl $0, %edx + subl 56(%esp), %esi + sbbl $0, %ecx + orl %ecx, %esi + je ..B4.123 +..B4.122: + movl $1, %ecx + jmp ..B4.124 +..B4.123: + xorl %ecx, %ecx +..B4.124: + orl %edi, %ecx + movl %ecx, %esi + movl %edx, 56(%esp) + orl %edx, %esi + jne ..B4.127 +..B4.125: + movl 108(%esp), %edi + movl 112(%esp), %edx +..B4.127: + movl %ebx, 36(%esp) + movl 108(%esp), %ebx + xorl %edi, %ebx + movl 112(%esp), %eax + movl 52(%esp), %edi + xorl %edx, %eax + subl %ebx, %edi + movl 40(%esp), %esi + sbbl %eax, %esi + movl 44(%esp), %eax + mull %edi + movl 44(%esp), %eax + movl %edx, %ebx + mull %esi + addl %eax, %ebx + movl %edi, %eax + movl %esi, 40(%esp) + movl %edx, %esi + adcl $0, %esi + mull 48(%esp) + addl %ebx, %eax + adcl %esi, %edx + subl %ebx, %eax + movl %edx, 32(%esp) + movl 36(%esp), %ebx + sbbl %esi, %edx + jae ..B4.129 +..B4.128: + movl $1, %esi + jmp ..B4.130 +..B4.129: + xorl %esi, %esi +..B4.130: + movl 40(%esp), %eax + xorl %edi, %edi + mull 48(%esp) + addl %edx, %esi + addl 32(%esp), %eax + adcl $0, %esi + movl %esi, %edx + subl %edi, %edx + jl ..B4.132 +..B4.131: + xorl %edx, %edx + jmp ..B4.133 +..B4.132: + movl $1, %edx +..B4.133: + movl 92(%esp), %edi + addl %edx, %ecx + movl 88(%esp), %edx + adcl $0, 56(%esp) + orl 80(%esp), %edi + orl 84(%esp), %edx + orl %edx, %edi + je ..B4.135 +..B4.134: + movl $1, %edx + jmp ..B4.136 +..B4.135: + xorl %edx, %edx +..B4.136: + movl %eax, %edi + addl %eax, %eax + shrl $31, %edi + addl %esi, %esi + orl %esi, %edi + addl %edx, %eax + movl 56(%esp), %edx + adcl $0, %edi + addl %ecx, %ebx + movl %ebx, %esi + movl %edi, 32(%esp) + movl 76(%esp), %edi + adcl %edx, %edi + subl %ecx, %esi + movl %edi, 76(%esp) + sbbl %edx, %edi + jae ..B4.138 +..B4.137: + movl $1, %edx + jmp ..B4.139 +..B4.138: + xorl %edx, %edx +..B4.139: + movl 56(%esp), %edi + sarl $31, %edi + movl 104(%esp), %ecx + addl %edi, %ecx + addl %edx, %ecx + movl %ecx, %edi + shll $31, %edi + movl %ecx, 104(%esp) + cmpl $31, %ecx + jbe ..B4.141 +..B4.140: + xorl %edx, %edx + movl 76(%esp), %esi + shrl %cl, %esi + jmp ..B4.142 +..B4.141: + movl %ebx, %esi + movl 76(%esp), %edx + shrdl %cl, %edx, %esi + shrl %cl, %edx +..B4.142: + orl %edx, %edi + movl 32(%ebp), %edx + andl %ecx, %ebx + shll $31, %ebx + movl %esi, 8(%edx) + cmpl $31, %ecx + movl %edi, 12(%edx) + jbe ..B4.144 +..B4.143: + xorl %edx, %edx + movl 32(%esp), %eax + shrl %cl, %eax + jmp ..B4.145 +..B4.144: + movl 32(%esp), %edx + shrdl %cl, %edx, %eax + shrl %cl, %edx +..B4.145: + addl $4, %esp + orl %edx, %ebx + movl 32(%ebp), %edx + lea 124(%esp), %ecx + pushl %ecx + movl %eax, 16(%edx) + movl -28(%ecx), %eax + addl -24(%ecx), %eax + movl %ebx, 20(%edx) + movl -4(%ecx), %ebx + movl %eax, 4(%edx) + call fesetenv@PLT +..B4.146: + movl 180(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B4.148 +..B4.147: + addl $196, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B4.148: + movl 124(%esp), %ebx + call __stack_chk_fail@PLT +..B4.150: + movl %ecx, %eax + movl 32(%ebp), %edx + movl 8(%eax), %esi + movl 12(%eax), %edi + movl (%eax), %ecx + movl %esi, 8(%edx) + movl %edi, 12(%edx) + movl %ecx, (%edx) + movl 4(%eax), %ebx + movl 16(%eax), %ecx + movl 20(%eax), %eax + movl %ebx, 4(%edx) + movl %ecx, 16(%edx) + movl %eax, 20(%edx) + jmp ..B4.146 + .align 16,0x90 + .type __dpml_evaluate_rational__,@function + .size __dpml_evaluate_rational__,.-__dpml_evaluate_rational__ + .data +# -- End __dpml_evaluate_rational__ + .text +# -- Begin __eval_neg_poly + .text + .align 16,0x90 +__eval_neg_poly: +# parameter 1: %eax +# parameter 2: 148 + %esp +# parameter 3: %edx +# parameter 4: 160 + %esp +# parameter 5: %ecx +..B5.1: +..L12: + + movl 4(%esp), %eax + movl 16(%esp), %edx + movl 28(%esp), %ecx +__eval_neg_poly.: + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $124, %esp + movl %edx, 88(%esp) + movl 8(%eax), %edx + movl %edx, 72(%esp) + movl 12(%eax), %edx + movl %edx, 80(%esp) + movl 16(%eax), %edx + movl %edx, 76(%esp) + movl 20(%eax), %edx + movl 4(%eax), %eax + movl 164(%esp), %esi + movl %edx, 92(%esp) + cltd + movl 160(%esp), %edi + movl %esi, 96(%esp) + xorl %esi, %esi + movl %edi, 84(%esp) + movl %edx, %edi + xorl %edx, %edx + subl %eax, %edx + movl 148(%esp), %ebx + sbbl %edi, %esi + movl %ecx, (%esp) + movl %ebx, %ecx + movl %esi, 4(%esp) + movl $128, %esi + subl %esi, %ecx + movl $0, %esi + movl 152(%esp), %ebp + movl %ebp, %ecx + sbbl %esi, %ecx + jge ..B5.4 +..B5.2: + movl $1, %esi +..B5.4: + testl %esi, %esi + jne ..B5.8 +..B5.5: + movl %edx, 16(%esp) + movl %eax, 64(%esp) + movl %edi, 68(%esp) + movl 96(%esp), %edx + movl 84(%esp), %esi + movl 88(%esp), %eax +..B5.6: + addl 64(%esp), %ebx + movl %ebx, %ecx + adcl 68(%esp), %ebp + movl $128, %edi + addl $-1, %esi + adcl $-1, %edx + addl $16, %eax + subl %edi, %ecx + movl $0, %edi + movl %ebp, %ecx + sbbl %edi, %ecx + jge ..B5.6 +..B5.7: + movl %edx, 96(%esp) + movl %eax, 88(%esp) + movl %esi, 84(%esp) + movl 16(%esp), %edx + movl 68(%esp), %edi + movl 64(%esp), %eax +..B5.8: + movl $64, %esi + movl %ebx, %ecx + subl %esi, %ecx + movl $0, %esi + movl %ebp, %ecx + sbbl %esi, %ecx + jge ..B5.11 +..B5.9: + movl $1, %esi +..B5.11: + testl %esi, %esi + je ..B5.13 +..B5.12: + xorl %esi, %esi + movl %esi, 100(%esp) + movl %esi, 104(%esp) + jmp ..B5.28 +..B5.13: + movl %edi, 68(%esp) + movl %edx, 16(%esp) + movl %eax, 64(%esp) + movl 96(%esp), %esi + movl 88(%esp), %edi +..B5.14: + movl 8(%edi), %edx + lea -64(%ebx), %ecx + movl 12(%edi), %eax + cmpl $31, %ecx + jbe ..B5.16 +..B5.15: + movl %eax, %edx + movl $0, 104(%esp) + shrl %cl, %edx + jmp ..B5.17 +..B5.16: + shrdl %cl, %eax, %edx + shrl %cl, %eax + movl %eax, 104(%esp) +..B5.17: + addl 64(%esp), %ebx + movl %ebx, %ecx + adcl 68(%esp), %ebp + movl $64, %eax + addl $16, %edi + addl $-1, 84(%esp) + adcl $-1, %esi + subl %eax, %ecx + movl $0, %eax + movl %ebp, %ecx + sbbl %eax, %ecx + jl ..B5.102 +..B5.18: + movl %edx, %eax + orl 104(%esp), %eax + je ..B5.14 +..B5.19: + movl %edx, 100(%esp) + movl %edi, 88(%esp) + movl %esi, 96(%esp) + movl 16(%esp), %edx + movl 104(%esp), %esi + movl 100(%esp), %edi + movl %ebp, 36(%esp) +..B5.20: + movl 72(%esp), %eax + mull %edi + movl %edi, %eax + movl %edx, %ebp + mull 80(%esp) + addl %eax, %ebp + movl %edx, %ecx + movl 72(%esp), %eax + adcl $0, %ecx + mull %esi + addl %ebp, %eax + movl %edx, %edi + adcl %ecx, %edi + subl %ebp, %eax + movl %edi, %edx + sbbl %ecx, %edx + jae ..B5.22 +..B5.21: + movl $1, %ebp + jmp ..B5.23 +..B5.22: + xorl %ebp, %ebp +..B5.23: + movl 80(%esp), %eax + lea -64(%ebx), %ecx + mull %esi + movl 88(%esp), %esi + addl %edx, %ebp + addl %edi, %eax + adcl $0, %ebp + movl 8(%esi), %edi + cmpl $31, %ecx + movl 12(%esi), %edx + jbe ..B5.25 +..B5.24: + movl %edx, %edi + xorl %esi, %esi + shrl %cl, %edi + jmp ..B5.26 +..B5.25: + movl %edx, %esi + shrdl %cl, %edx, %edi + shrl %cl, %esi +..B5.26: + addl 64(%esp), %ebx + movl 36(%esp), %edx + adcl 68(%esp), %edx + addl $-1, 84(%esp) + movl %edx, 36(%esp) + adcl $-1, 96(%esp) + subl %eax, %edi + movl %ebx, %eax + sbbl %ebp, %esi + movl $64, %ebp + addl $16, 88(%esp) + subl %ebp, %eax + movl $0, %ebp + sbbl %ebp, %edx + jge ..B5.20 +..B5.27: + movl %edi, 100(%esp) + movl %esi, 104(%esp) + movl 36(%esp), %ebp + movl 16(%esp), %edx + movl 68(%esp), %edi + movl 64(%esp), %eax +..B5.28: + xorl %ecx, %ecx + xorl %esi, %esi + subl %ebx, %esi + movl %esi, 8(%esp) + movl %ebx, %esi + sbbl %ebp, %ecx + movl %ecx, 12(%esp) + orl %ebp, %esi + jne ..B5.30 +..B5.29: + xorl %edx, %edx + xorl %esi, %esi + jmp ..B5.78 +..B5.30: + movl %ebp, 36(%esp) + movl %edx, 16(%esp) + movl %edi, 68(%esp) + movl %eax, 64(%esp) +..B5.31: + movl 72(%esp), %esi + movl %esi, %eax + movl 100(%esp), %ebp + mull %ebp + movl %ebp, %eax + movl %edx, %edi + mull 80(%esp) + addl %eax, %edi + movl %esi, %eax + movl %edx, %ebp + adcl $0, %ebp + mull 104(%esp) + addl %edi, %eax + movl %edx, %esi + adcl %ebp, %esi + subl %edi, %eax + movl %esi, %eax + sbbl %ebp, %eax + jae ..B5.33 +..B5.32: + movl $1, %ebp + jmp ..B5.34 +..B5.33: + xorl %ebp, %ebp +..B5.34: + movl 104(%esp), %eax + mull 80(%esp) + movl 88(%esp), %edi + addl %edx, %ebp + addl %esi, %eax + movl %eax, 32(%esp) + movl 12(%edi), %esi + adcl $0, %ebp + movl %esi, 20(%esp) + cmpl $31, %ebx + movl 8(%edi), %edx + movl (%edi), %eax + movl 4(%edi), %esi + jbe ..B5.36 +..B5.35: + movl %ebx, %ecx + movl %esi, %eax + shrl %cl, %eax + xorl %edi, %edi + jmp ..B5.37 +..B5.36: + movl %ebx, %ecx + movl %esi, %edi + shrdl %cl, %esi, %eax + shrl %cl, %edi +..B5.37: + movl 8(%esp), %esi + lea 64(%esi), %ecx + cmpl $31, %ecx + jbe ..B5.39 +..B5.38: + movl %edx, %esi + shll %cl, %esi + movl $0, 24(%esp) + movl %esi, 28(%esp) + jmp ..B5.40 +..B5.39: + movl 20(%esp), %esi + shldl %cl, %edx, %esi + movl %esi, 28(%esp) + movl %edx, %esi + shll %cl, %esi + movl %esi, 24(%esp) +..B5.40: + orl 24(%esp), %eax + orl 28(%esp), %edi + cmpl $31, %ebx + jbe ..B5.42 +..B5.41: + movl %ebx, %ecx + xorl %esi, %esi + movl 20(%esp), %edx + shrl %cl, %edx + jmp ..B5.43 +..B5.42: + movl %ebx, %ecx + movl 20(%esp), %esi + shrdl %cl, %esi, %edx + shrl %cl, %esi +..B5.43: + movl 8(%esp), %ecx + addl 16(%esp), %ecx + movl %ecx, 8(%esp) + movl 12(%esp), %ecx + adcl 4(%esp), %ecx + addl 64(%esp), %ebx + movl %ecx, 12(%esp) + movl 36(%esp), %ecx + adcl 68(%esp), %ecx + addl $-1, 84(%esp) + movl %ecx, 36(%esp) + movl %eax, %ecx + adcl $-1, 96(%esp) + subl 32(%esp), %ecx + movl %ecx, 100(%esp) + movl %edi, %ecx + sbbl %ebp, %ecx + addl $16, 88(%esp) + movl 100(%esp), %ebp + subl %eax, %ebp + movl %ecx, 104(%esp) + movl %ecx, %eax + sbbl %edi, %eax + jb ..B5.45 +..B5.105: + orl %eax, %ebp + je ..B5.45 +..B5.44: + movl $1, %eax + jmp ..B5.46 +..B5.45: + xorl %eax, %eax +..B5.46: + subl %eax, %edx + movl %ebx, %eax + sbbl $0, %esi + orl 36(%esp), %eax + je ..B5.78 +..B5.47: + movl %edx, %eax + orl %esi, %eax + je ..B5.31 +..B5.48: + movl %esi, 108(%esp) + movl %edx, 112(%esp) + movl %ebx, 12(%esp) +..B5.49: + movl 80(%esp), %ecx + movl 112(%esp), %esi + movl 108(%esp), %ebx + movl 72(%esp), %eax + imull %esi, %ecx + imull %eax, %ebx + mull %esi + movl 88(%esp), %ebp + addl %ebx, %ecx + addl %ecx, %edx + movl %eax, 8(%esp) + movl %edx, 4(%esp) + movl 8(%ebp), %ebx + movl 12(%ebp), %eax + movl (%ebp), %esi + movl 4(%ebp), %edx + cmpl $31, 12(%esp) + jbe ..B5.51 +..B5.50: + movl %edx, %esi + movl 12(%esp), %ecx + movl $0, 52(%esp) + shrl %cl, %esi + jmp ..B5.52 +..B5.51: + movl 12(%esp), %ecx + shrdl %cl, %edx, %esi + shrl %cl, %edx + movl %edx, 52(%esp) +..B5.52: + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B5.54 +..B5.53: + movl %ebx, %ebp + xorl %edx, %edx + shll %cl, %ebp + jmp ..B5.55 +..B5.54: + movl %eax, %ebp + movl %ebx, %edx + shldl %cl, %ebx, %ebp + shll %cl, %edx +..B5.55: + orl %ebp, 52(%esp) + orl %edx, %esi + cmpl $31, 12(%esp) + jbe ..B5.57 +..B5.56: + movl %eax, %ebx + xorl %ebp, %ebp + movl 12(%esp), %ecx + shrl %cl, %ebx + jmp ..B5.58 +..B5.57: + movl %eax, %ebp + movl 12(%esp), %ecx + shrdl %cl, %eax, %ebx + shrl %cl, %ebp +..B5.58: + movl 112(%esp), %ecx + movl %ecx, %eax + mull 76(%esp) + movl %ecx, %eax + movl %edx, %edi + mull 92(%esp) + addl %eax, %edi + movl %edx, %ecx + movl 76(%esp), %eax + adcl $0, %ecx + mull 108(%esp) + addl %edi, %eax + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 32(%esp) + sbbl %ecx, %edx + jae ..B5.60 +..B5.59: + movl $1, %edi + jmp ..B5.61 +..B5.60: + xorl %edi, %edi +..B5.61: + movl 92(%esp), %eax + mull 108(%esp) + addl %edx, %edi + addl 32(%esp), %eax + movl %eax, 48(%esp) + movl %esi, %eax + adcl $0, %edi + subl 8(%esp), %eax + movl 52(%esp), %ecx + movl %ecx, %edx + sbbl 4(%esp), %edx + movl %eax, 20(%esp) + subl %esi, %eax + movl %edx, 16(%esp) + sbbl %ecx, %edx + jb ..B5.63 +..B5.106: + orl %edx, %eax + je ..B5.63 +..B5.62: + movl $1, %eax + jmp ..B5.64 +..B5.63: + xorl %eax, %eax +..B5.64: + movl 100(%esp), %ecx + subl %eax, %ebx + movl 72(%esp), %eax + sbbl $0, %ebp + mull %ecx + movl %ecx, %eax + movl %edx, %esi + mull 80(%esp) + addl $-1, 84(%esp) + movl %edx, %ecx + adcl $-1, 96(%esp) + addl %eax, %esi + movl 72(%esp), %eax + adcl $0, %ecx + mull 104(%esp) + addl %esi, %eax + adcl %ecx, %edx + subl %esi, %eax + movl %edx, 40(%esp) + sbbl %ecx, %edx + jae ..B5.66 +..B5.65: + movl $1, %ecx + jmp ..B5.67 +..B5.66: + xorl %ecx, %ecx +..B5.67: + movl 104(%esp), %eax + mull 80(%esp) + addl %edx, %ecx + addl 40(%esp), %eax + movl %eax, 56(%esp) + movl 20(%esp), %eax + movl %eax, %esi + adcl $0, %ecx + subl 48(%esp), %esi + movl %esi, 24(%esp) + movl 16(%esp), %esi + movl %esi, %edx + sbbl %edi, %edx + movl 24(%esp), %edi + subl %eax, %edi + movl %edx, 28(%esp) + sbbl %esi, %edx + jb ..B5.69 +..B5.107: + orl %edx, %edi + je ..B5.69 +..B5.68: + movl $1, %eax + jmp ..B5.70 +..B5.69: + xorl %eax, %eax +..B5.70: + subl %eax, %ebx + movl 12(%esp), %esi + sbbl $0, %ebp + addl 64(%esp), %esi + movl 36(%esp), %edx + adcl 68(%esp), %edx + movl %esi, 12(%esp) + movl 72(%esp), %eax + movl 112(%esp), %esi + movl %edx, 36(%esp) + mull %esi + movl %esi, %eax + movl %edx, %edi + mull 80(%esp) + addl %eax, %edi + movl %edx, %esi + movl 72(%esp), %eax + adcl $0, %esi + mull 108(%esp) + addl %edi, %eax + adcl %esi, %edx + subl %edi, %eax + movl %edx, 44(%esp) + sbbl %esi, %edx + jae ..B5.72 +..B5.71: + movl $1, %esi + jmp ..B5.73 +..B5.72: + xorl %esi, %esi +..B5.73: + movl 80(%esp), %eax + mull 108(%esp) + addl %edx, %esi + addl 44(%esp), %eax + movl 24(%esp), %edi + adcl $0, %esi + movl %esi, 60(%esp) + movl %edi, %esi + subl 56(%esp), %esi + movl %esi, 100(%esp) + movl 28(%esp), %esi + movl %esi, %edx + sbbl %ecx, %edx + movl %edx, 104(%esp) + movl 100(%esp), %edx + subl %edi, %edx + movl 104(%esp), %ecx + sbbl %esi, %ecx + movl 60(%esp), %esi + jb ..B5.75 +..B5.108: + orl %ecx, %edx + je ..B5.75 +..B5.74: + movl $1, %edx + jmp ..B5.76 +..B5.75: + xorl %edx, %edx +..B5.76: + subl %edx, %ebx + sbbl $0, %ebp + subl %eax, %ebx + movl 12(%esp), %eax + sbbl %esi, %ebp + addl $16, 88(%esp) + movl %ebx, 112(%esp) + movl %ebp, 108(%esp) + orl 36(%esp), %eax + jne ..B5.49 +..B5.77: + movl %ebp, %esi + movl %ebx, %edx +..B5.78: + xorl %eax, %eax + movl 96(%esp), %ecx + subl %eax, %ecx + jl ..B5.100 +..B5.79: + movl %esi, 108(%esp) + movl %edx, 112(%esp) +..B5.80: + movl 108(%esp), %ebp + movl %ebp, %edx + movl 80(%esp), %ecx + movl 112(%esp), %edi + movl 72(%esp), %eax + imull %edi, %ecx + imull %eax, %edx + addl %edx, %ecx + mull %edi + movl 88(%esp), %esi + addl %ecx, %edx + movl %edx, 20(%esp) + movl %eax, 12(%esp) + movl %edi, %eax + movl 8(%esi), %ecx + movl 4(%esi), %edx + movl %ecx, 52(%esp) + movl 12(%esi), %ecx + movl (%esi), %ebx + movl 76(%esp), %esi + movl %edx, 40(%esp) + mull %esi + movl %edi, %eax + movl %ebx, 28(%esp) + movl %edx, %ebx + mull 92(%esp) + addl %eax, %ebx + movl %esi, %eax + movl %edx, %edi + adcl $0, %edi + mull %ebp + addl %ebx, %eax + movl %edx, %ebp + adcl %edi, %ebp + subl %ebx, %eax + movl %ebp, %ebx + sbbl %edi, %ebx + jae ..B5.82 +..B5.81: + movl $1, %ebx + jmp ..B5.83 +..B5.82: + xorl %ebx, %ebx +..B5.83: + movl 92(%esp), %eax + mull 108(%esp) + addl %edx, %ebx + addl %ebp, %eax + movl 28(%esp), %edi + movl %edi, %esi + adcl $0, %ebx + subl 12(%esp), %esi + movl 40(%esp), %ebp + movl %eax, 44(%esp) + movl %ebp, %eax + sbbl 20(%esp), %eax + movl %esi, 8(%esp) + subl %edi, %esi + movl %eax, 4(%esp) + sbbl %ebp, %eax + jb ..B5.85 +..B5.109: + orl %eax, %esi + je ..B5.85 +..B5.84: + movl $1, %eax + jmp ..B5.86 +..B5.85: + xorl %eax, %eax +..B5.86: + movl 72(%esp), %esi + subl %eax, 52(%esp) + movl %esi, %eax + movl 100(%esp), %ebp + sbbl $0, %ecx + mull %ebp + movl %ebp, %eax + movl %edx, %edi + mull 80(%esp) + addl $-1, 84(%esp) + movl %edx, %ebp + adcl $-1, 96(%esp) + addl %eax, %edi + movl %esi, %eax + adcl $0, %ebp + mull 104(%esp) + addl %edi, %eax + adcl %ebp, %edx + subl %edi, %eax + movl %edx, 36(%esp) + sbbl %ebp, %edx + jae ..B5.88 +..B5.87: + movl $1, %ebp + jmp ..B5.89 +..B5.88: + xorl %ebp, %ebp +..B5.89: + movl 104(%esp), %eax + mull 80(%esp) + addl %edx, %ebp + addl 36(%esp), %eax + movl 8(%esp), %edi + movl %eax, 48(%esp) + movl %edi, %eax + adcl $0, %ebp + subl 44(%esp), %eax + movl 4(%esp), %edx + movl %edx, %esi + sbbl %ebx, %esi + movl %eax, 16(%esp) + subl %edi, %eax + movl %esi, 24(%esp) + sbbl %edx, %esi + jb ..B5.91 +..B5.110: + orl %esi, %eax + je ..B5.91 +..B5.90: + movl $1, %eax + jmp ..B5.92 +..B5.91: + xorl %eax, %eax +..B5.92: + movl 72(%esp), %esi + subl %eax, 52(%esp) + movl %esi, %eax + movl 112(%esp), %ebx + sbbl $0, %ecx + mull %ebx + movl %ebx, %eax + movl %edx, %edi + mull 80(%esp) + addl %eax, %edi + movl %esi, %eax + movl %edx, %ebx + adcl $0, %ebx + mull 108(%esp) + addl %edi, %eax + adcl %ebx, %edx + subl %edi, %eax + movl %edx, 32(%esp) + sbbl %ebx, %edx + jae ..B5.94 +..B5.93: + movl $1, %ebx + jmp ..B5.95 +..B5.94: + xorl %ebx, %ebx +..B5.95: + movl 80(%esp), %eax + mull 108(%esp) + addl %edx, %ebx + addl 32(%esp), %eax + movl 16(%esp), %edi + movl %edi, %esi + adcl $0, %ebx + subl 48(%esp), %esi + movl %esi, 100(%esp) + movl 24(%esp), %esi + movl %esi, %edx + sbbl %ebp, %edx + movl 100(%esp), %ebp + subl %edi, %ebp + movl %edx, 104(%esp) + sbbl %esi, %edx + jb ..B5.97 +..B5.111: + orl %edx, %ebp + je ..B5.97 +..B5.96: + movl $1, %edx + jmp ..B5.98 +..B5.97: + xorl %edx, %edx +..B5.98: + movl 52(%esp), %ebp + subl %edx, %ebp + movl 96(%esp), %edx + sbbl $0, %ecx + subl %eax, %ebp + sbbl %ebx, %ecx + xorl %eax, %eax + addl $16, 88(%esp) + movl %ebp, 112(%esp) + subl %eax, %edx + movl %ecx, 108(%esp) + jge ..B5.80 +..B5.99: + movl %ecx, %esi + movl %ebp, %edx +..B5.100: + movl (%esp), %ebx + movl 100(%esp), %eax + movl 104(%esp), %ecx + movl %edx, 8(%ebx) + xorl %edx, %edx + movl %eax, 16(%ebx) + movl %ecx, 20(%ebx) + movl %esi, 12(%ebx) + movl %edx, 4(%ebx) + movl %edx, (%ebx) + addl $124, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B5.102: + movl %edx, 100(%esp) + movl %edi, 88(%esp) + movl %esi, 96(%esp) + movl 16(%esp), %edx + movl 68(%esp), %edi + movl 64(%esp), %eax + jmp ..B5.28 + .align 16,0x90 + .type __eval_neg_poly,@function + .size __eval_neg_poly,.-__eval_neg_poly + .data +# -- End __eval_neg_poly + .text +# -- Begin __eval_pos_poly + .text + .align 16,0x90 +__eval_pos_poly: +# parameter 1: %eax +# parameter 2: 180 + %esp +# parameter 3: %edx +# parameter 4: 192 + %esp +# parameter 5: %ecx +..B6.1: +..L13: + + movl 4(%esp), %eax + movl 16(%esp), %edx + movl 28(%esp), %ecx +__eval_pos_poly.: + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $156, %esp + movl 192(%esp), %esi + movl %esi, 84(%esp) + movl 8(%eax), %esi + movl %esi, 68(%esp) + movl 12(%eax), %esi + movl %esi, 72(%esp) + movl 16(%eax), %esi + movl %esi, 76(%esp) + movl 20(%eax), %esi + movl %esi, 80(%esp) + xorl %esi, %esi + movl %ecx, 48(%esp) + xorl %ecx, %ecx + movl 196(%esp), %edi + movl 4(%eax), %eax + subl %eax, %ecx + movl %edx, 64(%esp) + cltd + movl %edi, 140(%esp) + movl %esi, %edi + movl 180(%esp), %ebx + sbbl %edx, %edi + movl %eax, 148(%esp) + movl $128, %eax + movl %edx, 144(%esp) + movl %ebx, %edx + subl %eax, %edx + movl 184(%esp), %ebp + movl %ebp, %edx + sbbl %esi, %edx + jge ..B6.3 +..B6.2: + movl $1, %edx + jmp ..B6.4 +..B6.3: + xorl %edx, %edx +..B6.4: + testl %edx, %edx + jne ..B6.8 +..B6.5: + movl %edi, 8(%esp) + movl %ecx, 12(%esp) + movl 140(%esp), %esi + movl 84(%esp), %eax + movl 64(%esp), %edx +..B6.6: + addl 148(%esp), %ebx + movl %ebx, %ecx + adcl 144(%esp), %ebp + movl $128, %edi + addl $-1, %eax + adcl $-1, %esi + addl $16, %edx + subl %edi, %ecx + movl $0, %edi + movl %ebp, %ecx + sbbl %edi, %ecx + jge ..B6.6 +..B6.7: + movl %esi, 140(%esp) + movl %eax, 84(%esp) + movl %edx, 64(%esp) + movl 8(%esp), %edi + movl 12(%esp), %ecx +..B6.8: + movl $64, %eax + movl %ebx, %edx + xorl %esi, %esi + subl %eax, %edx + movl %ebp, %edx + sbbl %esi, %edx + jge ..B6.10 +..B6.9: + movl $1, %edx + jmp ..B6.11 +..B6.10: + xorl %edx, %edx +..B6.11: + testl %edx, %edx + je ..B6.13 +..B6.12: + xorl %edx, %edx + xorl %esi, %esi + movl %esi, 88(%esp) + movl %esi, 96(%esp) + jmp ..B6.31 +..B6.13: + movl %edi, 8(%esp) + movl %ecx, 12(%esp) + movl 140(%esp), %edx + movl 64(%esp), %esi +..B6.14: + movl 8(%esi), %edi + lea -64(%ebx), %ecx + movl 12(%esi), %eax + cmpl $31, %ecx + jbe ..B6.16 +..B6.15: + movl %eax, %edi + movl $0, 96(%esp) + shrl %cl, %edi + jmp ..B6.17 +..B6.16: + shrdl %cl, %eax, %edi + shrl %cl, %eax + movl %eax, 96(%esp) +..B6.17: + addl 148(%esp), %ebx + movl %ebx, %ecx + adcl 144(%esp), %ebp + movl $64, %eax + addl $16, %esi + addl $-1, 84(%esp) + adcl $-1, %edx + subl %eax, %ecx + movl $0, %eax + movl %ebp, %ecx + sbbl %eax, %ecx + jl ..B6.126 +..B6.18: + movl %edi, %eax + orl 96(%esp), %eax + je ..B6.14 +..B6.19: + movl %edi, 88(%esp) + movl %ebx, 60(%esp) + movl %ebp, 56(%esp) + movl %edx, 140(%esp) + movl %esi, 64(%esp) + movl 96(%esp), %ebx + movl 88(%esp), %ebp +..B6.20: + movl 68(%esp), %esi + movl %esi, %eax + mull %ebp + movl %ebp, %eax + movl %edx, %ecx + mull 72(%esp) + addl %eax, %ecx + movl %esi, %eax + movl %edx, %edi + adcl $0, %edi + mull %ebx + addl %ecx, %eax + movl %edx, %ebp + adcl %edi, %ebp + subl %ecx, %eax + movl %ebp, %edx + sbbl %edi, %edx + jae ..B6.22 +..B6.21: + movl $1, %esi + jmp ..B6.23 +..B6.22: + xorl %esi, %esi +..B6.23: + movl 72(%esp), %eax + mull %ebx + movl 64(%esp), %ecx + addl %edx, %esi + movl 60(%esp), %ebx + addl %ebp, %eax + movl 8(%ecx), %ebp + adcl $0, %esi + movl 12(%ecx), %edx + lea -64(%ebx), %ecx + cmpl $31, %ecx + jbe ..B6.25 +..B6.24: + movl %edx, %ebp + xorl %ebx, %ebx + shrl %cl, %ebp + jmp ..B6.26 +..B6.25: + movl %edx, %ebx + shrdl %cl, %edx, %ebp + shrl %cl, %ebx +..B6.26: + movl 60(%esp), %ecx + movl $64, %edi + addl 148(%esp), %ecx + movl 56(%esp), %edx + adcl 144(%esp), %edx + addl $-1, 84(%esp) + movl %ecx, 60(%esp) + adcl $-1, 140(%esp) + addl %eax, %ebp + movl %edx, 56(%esp) + adcl %esi, %ebx + addl $16, 64(%esp) + subl %edi, %ecx + movl $0, %edi + sbbl %edi, %edx + jge ..B6.20 +..B6.27: + movl %ebp, 88(%esp) + movl %ebp, %edx + subl %eax, %edx + movl %ebx, 96(%esp) + movl %ebx, %eax + movl 60(%esp), %ebx + sbbl %esi, %eax + movl 56(%esp), %ebp + movl 8(%esp), %edi + movl 12(%esp), %ecx + jae ..B6.29 +..B6.28: + movl $1, %edx + jmp ..B6.30 +..B6.29: + xorl %edx, %edx +..B6.30: + xorl %esi, %esi +..B6.31: + movl %esi, 92(%esp) + xorl %esi, %esi + xorl %eax, %eax + subl %ebx, %eax + movl %eax, 4(%esp) + movl %ebx, %eax + sbbl %ebp, %esi + movl %esi, (%esp) + orl %ebp, %eax + movl 92(%esp), %esi + je ..B6.54 +..B6.32: + xorl %eax, %eax + orl %edx, %eax + jne ..B6.52 +..B6.33: + movl %edi, 8(%esp) + movl %ebp, 56(%esp) + movl %ecx, 12(%esp) + movl 96(%esp), %esi + movl 88(%esp), %edi +..B6.34: + movl 68(%esp), %eax + mull %edi + movl %edi, %eax + movl %edx, %ebp + mull 72(%esp) + addl %eax, %ebp + movl %edx, %ecx + movl 68(%esp), %eax + adcl $0, %ecx + mull %esi + addl %ebp, %eax + movl %edx, %edi + adcl %ecx, %edi + subl %ebp, %eax + movl %edi, %edx + sbbl %ecx, %edx + jae ..B6.36 +..B6.35: + movl $1, %ebp + jmp ..B6.37 +..B6.36: + xorl %ebp, %ebp +..B6.37: + movl 72(%esp), %eax + mull %esi + movl 64(%esp), %esi + addl %edx, %ebp + addl %edi, %eax + movl %eax, 28(%esp) + movl 12(%esi), %edi + adcl $0, %ebp + movl %edi, 16(%esp) + cmpl $31, %ebx + movl 8(%esi), %edx + movl (%esi), %edi + movl 4(%esi), %eax + jbe ..B6.39 +..B6.38: + movl %ebx, %ecx + movl %eax, %edi + shrl %cl, %edi + xorl %esi, %esi + jmp ..B6.40 +..B6.39: + movl %ebx, %ecx + movl %eax, %esi + shrdl %cl, %eax, %edi + shrl %cl, %esi +..B6.40: + movl 4(%esp), %eax + lea 64(%eax), %ecx + cmpl $31, %ecx + jbe ..B6.42 +..B6.41: + movl %edx, %eax + shll %cl, %eax + movl $0, 20(%esp) + movl %eax, 24(%esp) + jmp ..B6.43 +..B6.42: + movl 16(%esp), %eax + shldl %cl, %edx, %eax + movl %eax, 24(%esp) + movl %edx, %eax + shll %cl, %eax + movl %eax, 20(%esp) +..B6.43: + orl 20(%esp), %edi + orl 24(%esp), %esi + cmpl $31, %ebx + jbe ..B6.45 +..B6.44: + movl %ebx, %ecx + movl 16(%esp), %edx + movl $0, 92(%esp) + shrl %cl, %edx + jmp ..B6.46 +..B6.45: + movl %ebx, %ecx + movl 16(%esp), %eax + shrdl %cl, %eax, %edx + shrl %cl, %eax + movl %eax, 92(%esp) +..B6.46: + movl 4(%esp), %eax + addl 12(%esp), %eax + movl (%esp), %ecx + adcl 8(%esp), %ecx + addl 148(%esp), %ebx + movl %eax, 4(%esp) + movl 56(%esp), %eax + adcl 144(%esp), %eax + addl $-1, 84(%esp) + movl %ecx, (%esp) + movl 28(%esp), %ecx + adcl $-1, 140(%esp) + addl %ecx, %edi + movl %eax, 56(%esp) + movl %edi, %eax + adcl %ebp, %esi + addl $16, 64(%esp) + subl %ecx, %eax + movl %esi, %ecx + sbbl %ebp, %ecx + jae ..B6.48 +..B6.47: + movl $1, %ebp + jmp ..B6.49 +..B6.48: + xorl %ebp, %ebp +..B6.49: + addl %ebp, %edx + movl %ebx, %ebp + adcl $0, 92(%esp) + orl 56(%esp), %ebp + je ..B6.123 +..B6.50: + movl %edx, %ebp + orl 92(%esp), %ebp + je ..B6.34 +..B6.51: + movl %esi, 96(%esp) + movl %edi, 88(%esp) + movl 56(%esp), %ebp + movl 92(%esp), %esi +..B6.52: + xorl %eax, %eax + movl 140(%esp), %edi + subl %eax, %edi + jge ..B6.124 +..B6.53: + movl 48(%esp), %ebp + movl 88(%esp), %ecx + movl 96(%esp), %ebx + movl %ecx, 16(%ebp) + movl %ebx, 20(%ebp) + movl %edx, 8(%ebp) + movl %esi, 12(%ebp) + movl %eax, 4(%ebp) + movl $0, (%ebp) + addl $156, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B6.54: + xorl %eax, %eax + movl %esi, 92(%esp) + movl %eax, 52(%esp) + movl %edx, 112(%esp) +..B6.55: + xorl %eax, %eax + movl 140(%esp), %edx + subl %eax, %edx + jl ..B6.125 +..B6.56: + movl 92(%esp), %esi + movl %esi, %ebp + movl 112(%esp), %ecx + movl 68(%esp), %eax + imull %eax, %ebp + mull %ecx + movl 72(%esp), %edi + imull %ecx, %edi + addl %ebp, %edi + movl %edx, %ebp + movl 64(%esp), %edx + addl %edi, %ebp + movl %eax, 104(%esp) + movl %ecx, %eax + movl 8(%edx), %edi + movl 12(%edx), %ebx + movl %edi, 100(%esp) + movl %ebx, 108(%esp) + movl (%edx), %edi + movl 4(%edx), %ebx + mull 76(%esp) + movl %ecx, %eax + movl %ebx, 136(%esp) + movl %edx, %ebx + mull 80(%esp) + addl %eax, %ebx + movl %edx, %ecx + movl 76(%esp), %eax + adcl $0, %ecx + mull %esi + addl %ebx, %eax + adcl %ecx, %edx + subl %ebx, %eax + movl %edx, 128(%esp) + movl 136(%esp), %ebx + sbbl %ecx, %edx + jae ..B6.58 +..B6.57: + movl $1, %ecx + jmp ..B6.59 +..B6.58: + xorl %ecx, %ecx +..B6.59: + movl 80(%esp), %eax + mull 92(%esp) + addl %edx, %ecx + addl 128(%esp), %eax + movl 104(%esp), %esi + adcl $0, %ecx + addl %esi, %edi + movl %eax, 132(%esp) + movl %edi, %eax + adcl %ebp, %ebx + subl %esi, %eax + movl %ebx, %edx + sbbl %ebp, %edx + jae ..B6.61 +..B6.60: + movl $1, 116(%esp) + jmp ..B6.62 +..B6.61: + movl $0, 116(%esp) +..B6.62: + movl 68(%esp), %eax + movl 88(%esp), %ebp + mull %ebp + movl %ebp, %eax + movl %edx, %esi + mull 72(%esp) + addl $-1, 84(%esp) + movl %edx, %ebp + adcl $-1, 140(%esp) + addl %eax, %esi + movl 68(%esp), %eax + adcl $0, %ebp + mull 96(%esp) + addl %esi, %eax + adcl %ebp, %edx + subl %esi, %eax + movl %edx, 124(%esp) + sbbl %ebp, %edx + jae ..B6.64 +..B6.63: + movl $1, %ebp + jmp ..B6.65 +..B6.64: + xorl %ebp, %ebp +..B6.65: + movl 96(%esp), %eax + mull 72(%esp) + movl %eax, %esi + addl %edx, %ebp + addl 124(%esp), %esi + movl 132(%esp), %eax + adcl $0, %ebp + addl %eax, %edi + movl %edi, %edx + adcl %ecx, %ebx + subl %eax, %edx + movl %ebx, %eax + sbbl %ecx, %eax + jae ..B6.67 +..B6.66: + movl $1, %eax + jmp ..B6.68 +..B6.67: + xorl %eax, %eax +..B6.68: + movl 112(%esp), %ecx + addl %eax, 116(%esp) + movl %ecx, %eax + mull 68(%esp) + movl %ecx, %eax + movl %ebx, 136(%esp) + movl %edx, %ebx + mull 72(%esp) + addl %eax, %ebx + movl %edx, %ecx + movl 68(%esp), %eax + adcl $0, %ecx + mull 92(%esp) + addl %ebx, %eax + adcl %ecx, %edx + subl %ebx, %eax + movl %edx, 120(%esp) + movl 136(%esp), %ebx + sbbl %ecx, %edx + jae ..B6.70 +..B6.69: + movl $1, %ecx + jmp ..B6.71 +..B6.70: + xorl %ecx, %ecx +..B6.71: + movl 72(%esp), %eax + mull 92(%esp) + addl %edx, %ecx + addl 120(%esp), %eax + adcl $0, %ecx + addl %esi, %edi + movl %edi, 88(%esp) + adcl %ebp, %ebx + subl %esi, %edi + movl %ebx, 96(%esp) + sbbl %ebp, %ebx + jae ..B6.73 +..B6.72: + movl $1, %edx + jmp ..B6.74 +..B6.73: + xorl %edx, %edx +..B6.74: + movl 116(%esp), %ebx + xorl %esi, %esi + addl %edx, %ebx + movl 100(%esp), %edx + addl %ebx, %edx + movl 108(%esp), %ebp + adcl $0, %ebp + movl %edx, 100(%esp) + subl %ebx, %edx + movl %ebp, 108(%esp) + sbbl %esi, %ebp + jae ..B6.76 +..B6.75: + movl $1, %edx + jmp ..B6.77 +..B6.76: + xorl %edx, %edx +..B6.77: + movl %eax, %ebx + movl %ecx, %ebp + addl 100(%esp), %ebx + movl %ebx, 112(%esp) + adcl 108(%esp), %ebp + addl $16, 64(%esp) + subl %eax, %ebx + movl %ebp, 92(%esp) + sbbl %ecx, %ebp + jae ..B6.79 +..B6.78: + movl $1, %eax + jmp ..B6.80 +..B6.79: + xorl %eax, %eax +..B6.80: + addl %eax, %edx + xorl %eax, %eax + orl %eax, %edx + je ..B6.55 +..B6.81: + movl 96(%esp), %ebx + movl %ebx, %eax + movl 112(%esp), %esi + movl %esi, %ecx + movl 92(%esp), %edi + movl %edi, %ebp + movl 88(%esp), %edx + shll $31, %eax + shrl $1, %edx + shrl $1, %ebx + orl %eax, %edx + shll $31, %ecx + xorl %eax, %eax + shll $31, %ebp + orl %ecx, %ebx + shrl $1, %edi + shrl $1, %esi + orl $-2147483648, %edi + movl %edx, 88(%esp) + orl %ebp, %esi + incl 52(%esp) + movl 140(%esp), %edx + movl %ebx, 96(%esp) + subl %eax, %edx + movl %esi, 112(%esp) + movl %edi, 92(%esp) + jge ..B6.83 +..B6.82: + movl %edi, %esi + movl 52(%esp), %eax + movl 112(%esp), %edx + jmp ..B6.53 +..B6.83: + movl $1, %ebx + xorl %ebp, %ebp +..B6.129: + movl %ebx, 60(%esp) + movl %ebp, 56(%esp) + movl 92(%esp), %esi +..B6.84: + movl %esi, %ecx + movl 72(%esp), %ebx + movl 112(%esp), %ebp + movl 68(%esp), %eax + imull %ebp, %ebx + imull %eax, %ecx + mull %ebp + addl %ecx, %ebx + addl %ebx, %edx + movl %edx, 8(%esp) + movl 64(%esp), %edx + movl %eax, (%esp) + cmpl $31, 60(%esp) + movl 8(%edx), %edi + movl 12(%edx), %eax + movl (%edx), %ebx + movl 4(%edx), %edx + movl %edi, 24(%esp) + jbe ..B6.86 +..B6.85: + movl %edx, %ebx + xorl %ebp, %ebp + movl 60(%esp), %ecx + shrl %cl, %ebx + jmp ..B6.87 +..B6.86: + movl %edx, %ebp + movl 60(%esp), %ecx + shrdl %cl, %edx, %ebx + shrl %cl, %ebp +..B6.87: + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B6.89 +..B6.88: + xorl %edx, %edx + shll %cl, %edi + movl %edi, 44(%esp) + jmp ..B6.90 +..B6.89: + movl %eax, %edi + movl 24(%esp), %edx + shldl %cl, %edx, %edi + movl %edi, 44(%esp) + shll %cl, %edx +..B6.90: + orl 44(%esp), %ebp + orl %edx, %ebx + cmpl $31, 60(%esp) + jbe ..B6.92 +..B6.91: + movl 60(%esp), %ecx + shrl %cl, %eax + movl $0, 4(%esp) + movl %eax, 24(%esp) + jmp ..B6.93 +..B6.92: + movl 60(%esp), %ecx + movl 24(%esp), %edx + shrdl %cl, %eax, %edx + shrl %cl, %eax + movl %edx, 24(%esp) + movl %eax, 4(%esp) +..B6.93: + movl 112(%esp), %ecx + movl %ecx, %eax + mull 76(%esp) + movl %ecx, %eax + movl %edx, %edi + mull 80(%esp) + addl %eax, %edi + movl %edx, %ecx + movl 76(%esp), %eax + adcl $0, %ecx + mull %esi + addl %edi, %eax + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 40(%esp) + sbbl %ecx, %edx + jae ..B6.95 +..B6.94: + movl $1, %edi + jmp ..B6.96 +..B6.95: + xorl %edi, %edi +..B6.96: + movl 80(%esp), %eax + mull %esi + addl %edx, %edi + addl 40(%esp), %eax + movl %eax, 32(%esp) + movl (%esp), %eax + adcl $0, %edi + addl %eax, %ebx + movl %ebx, %edx + movl 8(%esp), %ecx + adcl %ecx, %ebp + subl %eax, %edx + movl %ebp, %eax + sbbl %ecx, %eax + jae ..B6.98 +..B6.97: + movl $1, 12(%esp) + jmp ..B6.99 +..B6.98: + movl $0, 12(%esp) +..B6.99: + movl 68(%esp), %eax + movl 88(%esp), %ecx + mull %ecx + movl %ecx, %eax + movl %ebp, 36(%esp) + movl %edx, %ebp + mull 72(%esp) + addl $-1, 84(%esp) + movl %edx, %ecx + adcl $-1, 140(%esp) + addl %eax, %ebp + movl 68(%esp), %eax + adcl $0, %ecx + mull 96(%esp) + addl %ebp, %eax + adcl %ecx, %edx + subl %ebp, %eax + movl %edx, 16(%esp) + movl 36(%esp), %ebp + sbbl %ecx, %edx + jae ..B6.101 +..B6.100: + movl $1, %ecx + jmp ..B6.102 +..B6.101: + xorl %ecx, %ecx +..B6.102: + movl 96(%esp), %eax + mull 72(%esp) + addl %edx, %ecx + addl 16(%esp), %eax + movl %eax, 28(%esp) + movl 32(%esp), %eax + adcl $0, %ecx + addl %eax, %ebx + movl %ebx, %edx + adcl %edi, %ebp + subl %eax, %edx + movl %ebp, %eax + sbbl %edi, %eax + jae ..B6.104 +..B6.103: + movl $1, %eax + jmp ..B6.105 +..B6.104: + xorl %eax, %eax +..B6.105: + movl %ebp, 36(%esp) + movl 60(%esp), %ebp + addl 148(%esp), %ebp + movl 56(%esp), %edx + movl %ebp, 60(%esp) + adcl 144(%esp), %edx + movl 112(%esp), %ebp + addl %eax, 12(%esp) + movl %ebp, %eax + movl %edx, 56(%esp) + mull 68(%esp) + movl %ebp, %eax + movl %edx, %edi + mull 72(%esp) + addl %eax, %edi + movl %edx, %ebp + movl 68(%esp), %eax + adcl $0, %ebp + mull %esi + addl %edi, %eax + adcl %ebp, %edx + subl %edi, %eax + movl %edx, 20(%esp) + sbbl %ebp, %edx + movl 36(%esp), %ebp + jae ..B6.107 +..B6.106: + movl $1, %edi + jmp ..B6.108 +..B6.107: + xorl %edi, %edi +..B6.108: + movl 72(%esp), %eax + mull %esi + addl %edx, %edi + addl 20(%esp), %eax + movl 28(%esp), %esi + adcl $0, %edi + addl %esi, %ebx + movl %ebx, 88(%esp) + adcl %ecx, %ebp + subl %esi, %ebx + movl %ebp, 96(%esp) + sbbl %ecx, %ebp + jae ..B6.110 +..B6.109: + movl $1, %edx + jmp ..B6.111 +..B6.110: + xorl %edx, %edx +..B6.111: + movl 12(%esp), %ecx + xorl %ebp, %ebp + addl %edx, %ecx + movl 24(%esp), %edx + addl %ecx, %edx + movl 4(%esp), %ebx + adcl $0, %ebx + movl %edx, 24(%esp) + subl %ecx, %edx + movl %ebx, 4(%esp) + sbbl %ebp, %ebx + jae ..B6.113 +..B6.112: + movl $1, %edx + jmp ..B6.114 +..B6.113: + xorl %edx, %edx +..B6.114: + movl %eax, %ecx + movl %edi, %esi + addl 24(%esp), %ecx + movl %ecx, 112(%esp) + adcl 4(%esp), %esi + addl $16, 64(%esp) + subl %eax, %ecx + movl %esi, %eax + sbbl %edi, %eax + jae ..B6.116 +..B6.115: + movl $1, %eax + jmp ..B6.117 +..B6.116: + xorl %eax, %eax +..B6.117: + addl %eax, %edx + xorl %eax, %eax + orl %eax, %edx + je ..B6.119 +..B6.118: + movl 96(%esp), %ebx + movl %ebx, %eax + movl 112(%esp), %edi + movl %edi, %ecx + movl %esi, %ebp + addl $1, 60(%esp) + movl 88(%esp), %edx + adcl $0, 56(%esp) + shll $31, %eax + shrl $1, %ebx + shrl $1, %edx + shll $31, %ecx + orl %eax, %edx + shll $31, %ebp + orl %ecx, %ebx + shrl $1, %edi + shrl $1, %esi + orl %ebp, %edi + incl 52(%esp) + orl $-2147483648, %esi + movl %edx, 88(%esp) + movl %ebx, 96(%esp) + movl %edi, 112(%esp) +..B6.119: + movl 60(%esp), %eax + orl 56(%esp), %eax + je ..B6.122 +..B6.120: + xorl %eax, %eax + movl 140(%esp), %edx + subl %eax, %edx + jge ..B6.84 +..B6.121: + movl 52(%esp), %eax + movl 112(%esp), %edx + jmp ..B6.53 +..B6.122: + movl %esi, 92(%esp) + jmp ..B6.55 +..B6.123: + movl %esi, 96(%esp) + movl %edi, 88(%esp) + movl 92(%esp), %esi + jmp ..B6.54 +..B6.124: + movl %esi, 92(%esp) + movl %eax, 52(%esp) + movl %edx, 112(%esp) + jmp ..B6.129 +..B6.125: + movl 92(%esp), %esi + movl 52(%esp), %eax + movl 112(%esp), %edx + jmp ..B6.53 +..B6.126: + movl %edx, 140(%esp) + xorl %edx, %edx + movl %edi, 88(%esp) + movl %esi, 64(%esp) + xorl %esi, %esi + movl 8(%esp), %edi + movl 12(%esp), %ecx + jmp ..B6.31 + .align 16,0x90 + .type __eval_pos_poly,@function + .size __eval_pos_poly,.-__eval_pos_poly + .data +# -- End __eval_pos_poly + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x7b,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xef,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x47,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc3,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x3d,0x40,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .align 4 +__ux_one__: + .long 0 + .long 1 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .type __ux_one__,@object + .size __ux_one__,24 + .data + .hidden __dpml_ffs_and_shift__ + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/dpml_ux_sqrt.S b/external/sgx_libm/ia32/dpml_ux_sqrt.S new file mode 100644 index 0000000000..e1b2ac2e06 --- /dev/null +++ b/external/sgx_libm/ia32/dpml_ux_sqrt.S @@ -0,0 +1,1321 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_sqrt.c" + .text +..TXTST0: +# -- Begin __dpml_ux_sqrt_evaluation__ + .text + .align 16,0x90 + .hidden __dpml_ux_sqrt_evaluation__ + .globl __dpml_ux_sqrt_evaluation__ +__dpml_ux_sqrt_evaluation__: +# parameter 1: %eax +# parameter 2: 12 + %ebp +# parameter 3: %edx +..B1.1: +..L1: + + movl 4(%esp), %eax + movl 16(%esp), %edx + .hidden __dpml_ux_sqrt_evaluation__. + .globl __dpml_ux_sqrt_evaluation__. +__dpml_ux_sqrt_evaluation__.: + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $148, %esp + movl %edx, %esi + movl %eax, 44(%esp) + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 136(%esp) + addl $4, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea 80(%esp), %eax + pushl %eax + call fegetenv@PLT +..B1.2: + movl 44(%esp), %edx + movl %ebx, 80(%esp) + movl %esi, 40(%esp) + movl 8(%edx), %edi + movl %edi, %ecx + movl 12(%edx), %eax + movl %eax, %ebx + shll $21, %ebx + shrl $11, %ecx + orl %ecx, %ebx + movl 4(%edx), %ecx + movl 20(%edx), %esi + movl %ecx, %edx + andl $1, %edx + movl %esi, 36(%esp) + movl %eax, %esi + shrl $11, %esi + addl %edx, %ecx + addl $1070596096, %esi + movl %esi, 68(%esp) + lea 8(%edx), %esi + movl %esi, 32(%esp) + negl %esi + sarl $1, %ecx + movl %ecx, 72(%esp) + movl %esi, %ecx + negl %ecx + movl %ebx, 64(%esp) + addl $31, %ecx + movl %edi, %ebx + shrl %cl, %ebx + movl %esi, %ecx + movl %eax, 76(%esp) + shrl $1, %ebx + shll %cl, %eax + shll %cl, %edi + orl %ebx, %eax + movl 80(%esp), %ebx + movl 40(%esp), %esi +..B1.3: + movl 32(%esp), %ecx + shrl %cl, 36(%esp) +..B1.5: + fldl 64(%esp) + movl %eax, %ecx + orl 36(%esp), %edi + shll $21, %ecx + shrl $11, %edi + shrl $11, %eax + orl %edi, %ecx + movl %ecx, 48(%esp) + movl %eax, 52(%esp) + fildll 48(%esp) + fstpl 56(%esp) + fldl 56(%esp) +..B1.6: + movl 32(%esp), %ecx + movl 76(%esp), %eax + shrl %cl, %eax +..B1.8: + fmull 136+__sqrt_x_table@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + movl 76(%esp), %ecx + shrl $24, %ecx + shll $7, %edx + xorl %edx, %ecx + shll $4, %ecx + movl __sqrt_t_table@GOT(%ebx), %edx + movl %eax, 48(%esp) + fildl 48(%esp) + fstpl 56(%esp) + fldl 56(%esp) + fmull 128+__sqrt_x_table@GOTOFF(%ebx) + fstpl 56(%esp) + fldl 56(%esp) + fxch %st(2) + fstpl 56(%esp) + fldl 56(%esp) + fld %st(0) + movl %ebx, 80(%esp) + fadd %st(3), %st + fxch %st(2) + fmuls (%edx,%ecx) + flds 4(%edx,%ecx) + fmulp %st, %st(5) + fxch %st(4) + faddl 8(%edx,%ecx) + faddp %st, %st(4) + fxch %st(3) + fstpl 56(%esp) + fldl 56(%esp) + fmull 96+__sqrt_x_table@GOTOFF(%ebx) + fstpl 56(%esp) + fldl 56(%esp) + fxch %st(1) + fstpl 56(%esp) + fldl 56(%esp) + fld %st(0) + fmul %st(2), %st + fstps 48(%esp) + flds 48(%esp) + fxch %st(2) + fstps 48(%esp) + flds 48(%esp) + fmul %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fld %st(3) + fmulp %st, %st(2) + fldl 152+__sqrt_x_table@GOTOFF(%ebx) + fmulp %st, %st(3) + fld %st(3) + fmul %st(4), %st + fmulp %st, %st(3) + fxch %st(1) + fsubrl 104+__sqrt_x_table@GOTOFF(%ebx) + fsubp %st, %st(1) + fstpl 56(%esp) + fldl 56(%esp) + fldl 112+__sqrt_x_table@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + fsubrl 144+__sqrt_x_table@GOTOFF(%ebx) + fmulp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpl 56(%esp) + fldl 56(%esp) + flds .L_2il0floatpacket.20@GOTOFF(%ebx) + fld %st(0) + fsubr %st(3), %st + fxch %st(1) + fcomp %st(3) + fnstsw %ax + fxch %st(1) + fmull 120+__sqrt_x_table@GOTOFF(%ebx) + sahf + fxch %st(2) + jp ..L4 + jbe ..L3 +..L4: + fst %st(1) +..L3: + fstp %st(0) + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 64(%esp) + fldcw 32(%esp) + movl 64(%esp), %edx + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 64(%esp) + fldcw 32(%esp) + shll $7, %edx + movl 64(%esp), %ecx + movl %ecx, %ebx + movl 68(%esp), %edi + movl %edi, %eax + shll $20, %eax + shrl $12, %ebx + shrl $11, %ecx + orl %ebx, %eax + sarl $12, %edi + andl $1, %ecx + addl %edi, %edx + addl %ecx, %eax + adcl $0, %edx + xorl %ebx, %ebx + movl %edx, %ecx + andl $1073741824, %ecx + orl %ebx, %ecx + movl 80(%esp), %ebx + je ..B1.10 +..B1.9: + movl $2147483647, 32(%esp) + jmp ..B1.11 +..B1.10: + movl $-1, 32(%esp) +..B1.11: + movl %edx, %edi + xorl %ecx, %ecx + subl %ecx, %edi + jl ..B1.13 +..B1.12: + movl 32(%esp), %edx + movl $-1, %eax +..B1.13: + movl 72(%esp), %ecx + xorl %edi, %edi + negl %ecx + incl %ecx + movl %edi, 48(%esp) + movl %ecx, 52(%esp) + movl %eax, 56(%esp) + movl %edx, 60(%esp) + movl %edi, 64(%esp) + movl %edi, 68(%esp) + addl $12, %esp + lea 100(%esp), %eax + lea 36(%esp), %edx + pushl %eax + pushl 36(%esp) + pushl %edx + call __dpml_multiply__ +..B1.14: + addl $12, %esp + pushl %esi + lea 104(%esp), %eax + pushl %eax + lea 44(%esp), %edx + pushl %edx + call __dpml_multiply__ +..B1.15: + addl $20, %esp + lea 160+__sqrt_x_table@GOTOFF(%ebx), %eax + pushl %esi + pushl $0 + pushl $9 + pushl %esi + pushl %eax + call __dpml_addsub__ +..B1.16: + movl 12(%ebp), %edx + andl $1, %edx + orl %edi, %edx + je ..B1.18 +..B1.17: + lea 112(%esp), %eax + jmp ..B1.19 +..B1.18: + lea 48(%esp), %eax +..B1.19: + addl $12, %esp + pushl %esi + pushl %eax + pushl %esi + call __dpml_multiply__ +..B1.20: + addl $4, %esp + decl 4(%esi) + lea 80(%esp), %eax + pushl %eax + call fesetenv@PLT +..B1.21: + movl 12(%ebp), %edx + xorl %eax, %eax + andl $2, %edx + orl %eax, %edx + jne ..B1.26 +..B1.23: + movl 136(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.25 +..B1.24: + xorl %edx, %edx + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + call __stack_chk_fail@PLT +..B1.26: + addl $12, %esp + pushl %eax + pushl %eax + pushl %esi + call __dpml_ffs_and_shift__ +..B1.27: + movl 16(%esi), %edx + xorl %ecx, %ecx + movl 20(%esi), %eax + movl %edx, 40(%esp) + movl %eax, 36(%esp) + lea 8(%edx), %edi + andl $16368, %edi + orl %ecx, %edi + je ..B1.29 +..B1.28: + xorl %eax, %eax + jmp ..B1.23 +..B1.29: + lea 48(%esp), %edi + pushl %edi + lea 116(%esp), %eax + pushl %eax + pushl %esi + pushl %esi + movl %edx, %edi + andl $-32768, %edi + movl %edi, -72(%eax) + addl $16384, %edi + movl -76(%eax), %edx + adcl $0, %edx + movl %edx, -80(%eax) + movl %edi, 16(%esi) + movl %edx, 20(%esi) + call __dpml_extended_multiply__ +..B1.30: + addl $36, %esp + lea 92(%esp), %eax + pushl %eax + pushl $0 + pushl $1 + pushl %eax + pushl 40(%esp) + call __dpml_addsub__ +..B1.31: + addl $20, %esp + lea 92(%esp), %edx + pushl %edx + pushl $0 + pushl $1 + lea 40(%esp), %eax + pushl %eax + pushl %edx + call __dpml_addsub__ +..B1.32: + movl 112(%esp), %eax + testl %eax, %eax + movl 32(%esp), %edx + je ..L5 + movl 40(%esp), %edi +..L5: + je ..L6 + movl 36(%esp), %edx +..L6: + xorl %ecx, %ecx + movl %edi, 16(%esi) + movl 12(%ebp), %edi + andl $4, %edi + movl %edx, 20(%esi) + orl %ecx, %edi + je ..B1.28 +..B1.33: + movl 4(%esi), %edx + testl %eax, %eax + movl $0, %eax + sete %al + addl $-113, %edx + subl %edx, 116(%esp) + addl $20, %esp + orl $8, %eax + lea 92(%esp), %ecx + pushl %ecx + pushl $0 + pushl %eax + pushl %esi + pushl %ecx + call __dpml_addsub__ +..B1.34: + movl $8192, %eax + movl 128(%esp), %edx + subl %eax, %edx + orl 132(%esp), %edx + jne ..B1.28 +..B1.35: + movl $1, %eax + jmp ..B1.23 + .align 16,0x90 + .type __dpml_ux_sqrt_evaluation__,@function + .size __dpml_ux_sqrt_evaluation__,.-__dpml_ux_sqrt_evaluation__ + .data +# -- End __dpml_ux_sqrt_evaluation__ + .text +# -- Begin __sqrtq + .text + .align 16,0x90 + .globl __sqrtq +__sqrtq: +# parameter 1: 24 + %ebp +..B2.1: +..L7: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $132, %esp + xorl %esi, %esi + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 128(%esp) + call ..L8 +..L8: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L8](%ebx), %ebx + movl $1, 40(%esp) + movl %esi, 44(%esp) + movl %esi, 32(%esp) + lea __sqrt_x_table@GOTOFF(%ebx), %ecx + movl %esi, 36(%esp) + addl $24, %esp + lea 8(%esp), %eax + lea 60(%esp), %edx + pushl %eax + lea 92(%esp), %eax + pushl %eax + pushl %ecx + pushl %edx + pushl %esi + lea 24(%ebp), %ecx + pushl %ecx + call __dpml_unpack_x_or_y__ +..B2.2: + subl %esi, %edx + jl ..B2.8 +..B2.3: + movl $7, 4(%esp) + lea 60(%esp), %edx + movl $0, 8(%esp) + lea 84(%esp), %eax + call __dpml_ux_sqrt_evaluation__. +..B2.4: + orl %edx, %eax + jne ..B2.6 +..B2.5: + movl $1, %edx + jmp ..B2.7 +..B2.6: + movl %esi, %edx +..B2.7: + movl %edx, 40(%esp) + movl %esi, 44(%esp) + addl $28, %esp + lea 4(%esp), %edx + pushl %edx + pushl %esi + pushl %esi + pushl %esi + pushl %esi + lea 104(%esp), %ecx + pushl %ecx + lea 56(%esp), %esi + pushl %esi + call __dpml_pack__ +..B2.8: + movl 112(%esp), %edx + movl %edx, (%edi) + movl 116(%esp), %ecx + movl 120(%esp), %esi + movl 124(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 128(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B2.10 +..B2.9: + movl %edi, %eax + addl $132, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B2.10: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __sqrtq,@function + .size __sqrtq,.-__sqrtq + .data +# -- End __sqrtq + .text +# -- Begin __rsqrtq + .text + .align 16,0x90 + .globl __rsqrtq +__rsqrtq: +# parameter 1: 24 + %ebp +..B3.1: +..L9: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $132, %esp + xorl %esi, %esi + movl %gs:20, %edx + movl 8(%ebp), %edi + xorl %esp, %edx + movl %edx, 128(%esp) + call ..L10 +..L10: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L10](%ebx), %ebx + movl $1, 40(%esp) + movl %esi, 44(%esp) + movl %esi, 32(%esp) + lea 8+__sqrt_x_table@GOTOFF(%ebx), %ecx + movl %esi, 36(%esp) + addl $24, %esp + lea 8(%esp), %eax + lea 60(%esp), %edx + pushl %eax + lea 92(%esp), %eax + pushl %eax + pushl %ecx + pushl %edx + pushl %esi + lea 24(%ebp), %ecx + pushl %ecx + call __dpml_unpack_x_or_y__ +..B3.2: + subl %esi, %edx + jl ..B3.8 +..B3.3: + movl %esi, 4(%esp) + lea 60(%esp), %edx + movl %esi, 8(%esp) + lea 84(%esp), %eax + call __dpml_ux_sqrt_evaluation__. +..B3.4: + orl %edx, %eax + jne ..B3.6 +..B3.5: + movl $1, %edx + jmp ..B3.7 +..B3.6: + movl %esi, %edx +..B3.7: + movl %edx, 40(%esp) + movl %esi, 44(%esp) + addl $28, %esp + lea 4(%esp), %edx + pushl %edx + pushl %esi + pushl %esi + pushl %esi + pushl %esi + lea 104(%esp), %ecx + pushl %ecx + lea 56(%esp), %esi + pushl %esi + call __dpml_pack__ +..B3.8: + movl 112(%esp), %edx + movl %edx, (%edi) + movl 116(%esp), %ecx + movl 120(%esp), %esi + movl 124(%esp), %edx + movl %ecx, 4(%edi) + movl %esi, 8(%edi) + movl %edx, 12(%edi) + movl 128(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B3.10 +..B3.9: + movl %edi, %eax + addl $132, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret $4 +..B3.10: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __rsqrtq,@function + .size __rsqrtq,.-__rsqrtq + .data +# -- End __rsqrtq + .text +# -- Begin __dpml_ux_hypot__ + .text + .align 16,0x90 + .globl __dpml_ux_hypot__ +__dpml_ux_hypot__: +# parameter 1: 144 + %esp +# parameter 2: 148 + %esp +# parameter 3: 152 + %esp +..B4.1: +..L11: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $124, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl 144(%esp), %edx + movl %eax, 112(%esp) + addl $12, %esp + lea 28(%esp), %esi + pushl %esi + pushl %edx + pushl %edx + call __dpml_multiply__ +..B4.2: + addl $12, %esp + movl 136(%esp), %eax + lea 52(%esp), %ebx + pushl %ebx + pushl %eax + pushl %eax + call __dpml_multiply__ +..B4.3: + addl $20, %esp + xorl %ebp, %ebp + lea 68(%esp), %edi + pushl %edi + pushl %ebp + pushl %ebp + pushl %ebx + pushl %esi + call __dpml_addsub__ +..B4.4: + addl $12, %esp + pushl %ebp + pushl %ebp + pushl %edi + call __dpml_ffs_and_shift__ +..B4.5: + movl %edi, %eax + movl $7, 4(%esp) + movl 152(%esp), %edx + movl $0, 8(%esp) + call __dpml_ux_sqrt_evaluation__..0 +..B4.6: + movl %eax, %ecx + orl %edx, %ecx + je ..B4.27 +..B4.7: + movl 44(%esp), %eax + subl 68(%esp), %eax + cltd + movl %edx, %edi + subl %ebp, %edi + jge ..B4.9 +..B4.8: + movl %eax, %esi + movl %ebp, %eax + subl %esi, %eax + movl %edx, %edi + movl %ebp, %edx + movl %ebx, %esi + sbbl %edi, %edx +..B4.9: + movl $128, %ebx + movl %eax, %edi + subl %ebx, %edi + movl %edx, %ebx + sbbl %ebp, %ebx + jl ..B4.11 +..B4.34: + orl %ebx, %edi + je ..B4.11 +..B4.10: + movl %ebp, %eax + movl %eax, %edx + jmp ..B4.27 +..B4.11: + movl $1, %ecx + movl %ebp, %edi +..B4.12: + movl 8(%esi,%ecx,8), %ebp + movl 12(%esi,%ecx,8), %ebx + movl %ebp, 36(%esp) + orl %ebx, %ebp + movl %ebx, 32(%esp) + jne ..B4.31 +..B4.13: + movl $64, %ebx + movl %eax, %ebp + subl %ebx, %ebp + movl $0, %ebx + movl %edx, %ebp + sbbl %ebx, %ebp + jl ..B4.15 +..B4.14: + addl $-64, %eax + adcl $-1, %edx + addl $-1, %ecx + adcl $-1, %edi + movl %edi, %ebp + subl %ebx, %ebp + jge ..B4.12 +..B4.15: + movl 36(%esp), %esi + xorl %ebp, %ebp +..B4.16: + cmpl $31, %eax + jbe ..B4.18 +..B4.17: + movl %eax, %ecx + movl %ebp, %edx + movl 32(%esp), %ebx + shrl %cl, %ebx + jmp ..B4.19 +..B4.18: + movl %eax, %ecx + movl %esi, %ebx + movl 32(%esp), %edx + shrdl %cl, %edx, %ebx + shrl %cl, %edx +..B4.19: + cmpl $31, %eax + jbe ..B4.21 +..B4.20: + movl %eax, %ecx + movl %ebx, %edx + shll %cl, %edx + movl %ebp, %edi + jmp ..B4.22 +..B4.21: + movl %eax, %ecx + movl %ebx, %edi + shldl %cl, %ebx, %edx + shll %cl, %edi +..B4.22: + movl 32(%esp), %eax + subl %edi, %esi + subl %edx, %eax + orl %eax, %esi + jne ..B4.24 +..B4.23: + movl $1, %eax + jmp ..B4.25 +..B4.24: + movl %ebp, %eax +..B4.25: + movl %ebp, %edx +..B4.27: + movl 112(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B4.29 +..B4.28: + addl $124, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B4.29: + call ..L12 +..L12: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L12](%ebx), %ebx + call __stack_chk_fail@PLT +..B4.31: + xorl %ebp, %ebp + movl %ebp, %eax + xorl %edx, %edx + jmp ..B4.27 + .align 16,0x90 + .type __dpml_ux_hypot__,@function + .size __dpml_ux_hypot__,.-__dpml_ux_hypot__ + .data +# -- End __dpml_ux_hypot__ + .text +# -- Begin __dpml_ux_sqrt_evaluation__..0 + .text + .align 16,0x90 +__dpml_ux_sqrt_evaluation__..0: +# parameter 1: %eax +# parameter 2: 12 + %ebp +# parameter 3: %edx +..B5.1: +..L13: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $148, %esp + movl %edx, 76(%esp) + movl %eax, 72(%esp) + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 136(%esp) + addl $4, %esp + call ..L14 +..L14: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L14](%ebx), %ebx + lea 80(%esp), %eax + pushl %eax + call fegetenv@PLT +..B5.2: + movl 72(%esp), %esi + movl %ebx, 36(%esp) + movl 8(%esi), %edi + movl %edi, %edx + movl 12(%esi), %eax + movl %eax, %ecx + shll $21, %ecx + shrl $11, %edx + orl %edx, %ecx + movl 4(%esi), %edx + movl 20(%esi), %ebx + movl %edx, %esi + andl $1, %esi + movl %ebx, 40(%esp) + movl %eax, %ebx + shrl $11, %ebx + addl %esi, %edx + addl $1070596096, %ebx + movl %ebx, 68(%esp) + lea 8(%esi), %ebx + movl %ebx, 32(%esp) + negl %ebx + movl %ecx, 64(%esp) + movl %ebx, %ecx + negl %ecx + sarl $1, %edx + addl $31, %ecx + movl %edx, 44(%esp) + movl %edi, %edx + shrl %cl, %edx + movl %ebx, %ecx + movl %eax, 80(%esp) + shrl $1, %edx + shll %cl, %eax + shll %cl, %edi + orl %edx, %eax + movl 40(%esp), %edx + movl 36(%esp), %ebx +..B5.3: + movl 32(%esp), %ecx + shrl %cl, %edx +..B5.5: + fldl 64(%esp) + orl %edx, %edi + movl %eax, %edx + shll $21, %edx + shrl $11, %edi + shrl $11, %eax + orl %edi, %edx + movl %edx, 48(%esp) + movl %eax, 52(%esp) + fildll 48(%esp) + fstpl 56(%esp) + fldl 56(%esp) +..B5.6: + movl 80(%esp), %eax + shrl %cl, %eax +..B5.8: + fmull 136+__sqrt_x_table@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + movl 80(%esp), %ecx + shrl $24, %ecx + shll $7, %esi + xorl %esi, %ecx + shll $4, %ecx + movl __sqrt_t_table@GOT(%ebx), %edx + movl %eax, 48(%esp) + fildl 48(%esp) + fstpl 56(%esp) + fldl 56(%esp) + fmull 128+__sqrt_x_table@GOTOFF(%ebx) + fstpl 56(%esp) + fldl 56(%esp) + fxch %st(2) + fstpl 56(%esp) + fldl 56(%esp) + fld %st(0) + fadd %st(3), %st + fxch %st(2) + fmuls (%edx,%ecx) + flds 4(%edx,%ecx) + fmulp %st, %st(5) + fxch %st(4) + faddl 8(%edx,%ecx) + faddp %st, %st(4) + fxch %st(3) + fstpl 56(%esp) + fldl 56(%esp) + fmull 96+__sqrt_x_table@GOTOFF(%ebx) + fstpl 56(%esp) + fldl 56(%esp) + fxch %st(1) + fstpl 56(%esp) + fldl 56(%esp) + fld %st(0) + fmul %st(2), %st + fstps 48(%esp) + flds 48(%esp) + fxch %st(2) + fstps 48(%esp) + flds 48(%esp) + fmul %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fld %st(3) + fmulp %st, %st(2) + fldl 152+__sqrt_x_table@GOTOFF(%ebx) + fmulp %st, %st(3) + fld %st(3) + fmul %st(4), %st + fmulp %st, %st(3) + fxch %st(1) + fsubrl 104+__sqrt_x_table@GOTOFF(%ebx) + fsubp %st, %st(1) + fstpl 56(%esp) + fldl 56(%esp) + fldl 112+__sqrt_x_table@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + fsubrl 144+__sqrt_x_table@GOTOFF(%ebx) + fmulp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpl 56(%esp) + fldl 56(%esp) + flds .L_2il0floatpacket.20@GOTOFF(%ebx) + fld %st(0) + fsubr %st(3), %st + fxch %st(1) + fcomp %st(3) + fnstsw %ax + fxch %st(1) + fmull 120+__sqrt_x_table@GOTOFF(%ebx) + sahf + fxch %st(2) + jp ..L16 + jbe ..L15 +..L16: + fst %st(1) +..L15: + fstp %st(0) + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 64(%esp) + fldcw 32(%esp) + movl 64(%esp), %edx + fnstcw 32(%esp) + movzwl 32(%esp), %eax + orl $3072, %eax + movl %eax, 40(%esp) + fldcw 40(%esp) + fistpll 64(%esp) + fldcw 32(%esp) + shll $7, %edx + movl 64(%esp), %ecx + movl %ecx, %esi + movl 68(%esp), %edi + movl %edi, %eax + shll $20, %eax + shrl $12, %esi + shrl $11, %ecx + orl %esi, %eax + sarl $12, %edi + andl $1, %ecx + addl %edi, %edx + addl %ecx, %eax + adcl $0, %edx + xorl %esi, %esi + movl %edx, %ecx + andl $1073741824, %ecx + orl %esi, %ecx + je ..B5.10 +..B5.9: + movl $2147483647, %edi + jmp ..B5.11 +..B5.10: + movl $-1, %edi +..B5.11: + movl %edx, %esi + xorl %ecx, %ecx + subl %ecx, %esi + jl ..B5.13 +..B5.12: + movl $-1, %eax + movl %edi, %edx +..B5.13: + movl 44(%esp), %esi + xorl %ecx, %ecx + negl %esi + incl %esi + movl %ecx, 48(%esp) + movl %esi, 52(%esp) + movl %eax, 56(%esp) + movl %edx, 60(%esp) + movl %ecx, 64(%esp) + movl %ecx, 68(%esp) + addl $12, %esp + lea 100(%esp), %esi + lea 36(%esp), %eax + pushl %esi + pushl 64(%esp) + pushl %eax + call __dpml_multiply__ +..B5.14: + addl $12, %esp + pushl 64(%esp) + pushl %esi + lea 44(%esp), %eax + pushl %eax + call __dpml_multiply__ +..B5.15: + addl $20, %esp + lea 160+__sqrt_x_table@GOTOFF(%ebx), %edx + movl 56(%esp), %eax + pushl %eax + pushl $0 + pushl $9 + pushl %eax + pushl %edx + call __dpml_addsub__ +..B5.16: + addl $12, %esp + movl 64(%esp), %eax + pushl %eax + pushl %esi + pushl %eax + call __dpml_multiply__ +..B5.17: + addl $4, %esp + lea 80(%esp), %eax + pushl %eax + movl -8(%eax), %edx + decl 4(%edx) + call fesetenv@PLT +..B5.18: + addl $12, %esp + xorl %ecx, %ecx + pushl %ecx + pushl %ecx + pushl 72(%esp) + call __dpml_ffs_and_shift__ +..B5.19: + movl 76(%esp), %eax + xorl %edi, %edi + movl 16(%eax), %ecx + movl 20(%eax), %edx + movl %ecx, 44(%esp) + movl %edx, 40(%esp) + lea 8(%ecx), %eax + andl $16368, %eax + orl %edi, %eax + jne ..B5.32 +..B5.21: + lea 48(%esp), %eax + pushl %eax + pushl %esi + movl 28(%eax), %edi + pushl %edi + pushl %edi + movl %ecx, %edx + andl $-32768, %edx + movl %edx, -4(%eax) + addl $16384, %edx + movl -8(%eax), %ecx + adcl $0, %ecx + movl %edx, -12(%eax) + movl %ecx, -16(%eax) + movl %edx, 16(%edi) + movl %ecx, 20(%edi) + call __dpml_extended_multiply__ +..B5.22: + addl $36, %esp + pushl %esi + pushl $0 + pushl $1 + pushl %esi + pushl 68(%esp) + call __dpml_addsub__ +..B5.23: + addl $20, %esp + pushl %esi + pushl $0 + pushl $1 + lea 40(%esp), %eax + pushl %eax + pushl %esi + call __dpml_addsub__ +..B5.24: + movl 112(%esp), %eax + testl %eax, %eax + jne ..B5.26 +..B5.25: + movl %edi, %ecx + movl 36(%esp), %eax + movl 32(%esp), %edx + movl 4(%ecx), %edi + addl $-113, %edi + movl %eax, 16(%ecx) + movl %edx, 20(%ecx) + subl %edi, 116(%esp) + jmp ..B5.27 +..B5.26: + movl 44(%esp), %edx + movl 40(%esp), %ecx + movl %edx, 16(%edi) + movl 4(%edi), %edx + addl $-113, %edx + subl %edx, 116(%esp) + movl %ecx, 20(%edi) + testl %eax, %eax + jne ..B5.28 +..B5.27: + movl $1, %eax + jmp ..B5.29 +..B5.28: + xorl %eax, %eax +..B5.29: + addl $20, %esp + orl $8, %eax + pushl %esi + pushl $0 + pushl %eax + pushl 68(%esp) + pushl %esi + call __dpml_addsub__ +..B5.30: + movl $8192, %eax + movl 128(%esp), %edx + subl %eax, %edx + orl 132(%esp), %edx + jne ..B5.32 +..B5.31: + movl $1, %eax + jmp ..B5.34 +..B5.32: + xorl %eax, %eax +..B5.34: + movl 136(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B5.36 +..B5.35: + xorl %edx, %edx + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B5.36: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __dpml_ux_sqrt_evaluation__..0,@function + .size __dpml_ux_sqrt_evaluation__..0,.-__dpml_ux_sqrt_evaluation__..0 + .data +# -- End __dpml_ux_sqrt_evaluation__..0 + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.20: + .long 0x5f000000 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,4 + .align 4 +__sqrt_x_table: + .long 1088750600 + .long 605086734 + .long 1088766984 + .long 519758862 + .long 112 + .long 0 + .long 113 + .long 0 + .long 114 + .long 0 + .long 0 + .long 0 + .long 0 + .long 268435456 + .long 858997845 + .long 34 + .long 1636176969 + .long 409044504 + .long 1099306057 + .long 404751376 + .long 545392672 + .long 404783624 + .long 142938632 + .long 302522498 + .long 1719614413 + .long 1073127582 + .long 0 + .long 1072693248 + .long 0 + .long 1097859072 + .long 0 + .long 1151336448 + .long 0 + .long 1047527424 + .long 0 + .long 991952896 + .long 0 + .long 1072431104 + .long 0 + .long 1071120384 + .long 0 + .long 2 + .long 0 + .long 3221225472 + .long 0 + .long 0 + .long 0 + .long 0 + .type __sqrt_x_table,@object + .size __sqrt_x_table,192 + .data + .hidden __dpml_extended_multiply__ + .hidden __dpml_multiply__ + .hidden __dpml_ffs_and_shift__ + .hidden __dpml_addsub__ + .hidden __dpml_pack__ + .hidden __dpml_unpack_x_or_y__ + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/dpml_ux_trig.S b/external/sgx_libm/ia32/dpml_ux_trig.S new file mode 100644 index 0000000000..111fd34910 --- /dev/null +++ b/external/sgx_libm/ia32/dpml_ux_trig.S @@ -0,0 +1,4138 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_trig.c" + .text +..TXTST0: +# -- Begin __dpml_ux_radian_reduce__ + .text + .align 16,0x90 +__dpml_ux_radian_reduce__: +# parameter 1: 176 + %esp +# parameter 2: 180 + %esp +# parameter 3: 188 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $156, %esp + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + movl %eax, 76(%esp) + movl 176(%esp), %eax + movl 8(%eax), %edx + movl 12(%eax), %ecx + movl %edx, 108(%esp) + movl %ecx, 104(%esp) + movl 16(%eax), %edx + movl 20(%eax), %ecx + movl 4(%eax), %ebp + testl %ebp, %ebp + movl (%eax), %ebx + movl %edx, 128(%esp) + movl %ecx, 132(%esp) + movl %ebp, 112(%esp) + movl %ebx, 80(%esp) + jl ..B1.120 +..B1.2: + movl %ebp, %eax + xorl %ebp, %ebp + cltd + addl $8, %eax + movl %eax, %edi + adcl $0, %edx + andl $63, %eax + movl 76(%esp), %ebx + shll $26, %edx + shrl $6, %edi + orl %edx, %edi + movl __four_over_pi@GOT(%ebx), %esi + movl %edi, 72(%esp) + movl %eax, 112(%esp) + lea (%esi,%edi,8), %ecx + movl (%ecx), %ebx + movl 4(%ecx), %esi + movl %ebx, 60(%esp) + movl %esi, 56(%esp) + movl 8(%ecx), %edx + movl 12(%ecx), %edi + movl 16(%ecx), %ebx + movl 20(%ecx), %esi + movl %edx, 68(%esp) + movl %edi, 64(%esp) + movl %ebx, 36(%esp) + movl %esi, 32(%esp) + movl 24(%ecx), %ebx + movl 28(%ecx), %esi + movl 32(%ecx), %edx + movl 36(%ecx), %edi + addl $40, %ecx + movl %edx, 120(%esp) + orl %eax, %ebp + movl %edi, 124(%esp) + movl %ecx, 116(%esp) + je ..B1.28 +..B1.3: + movl %eax, %ecx + movl %ecx, %edx + negl %edx + addl $64, %edx + movl %edx, 72(%esp) + cmpl $31, %ecx + jbe ..B1.5 +..B1.4: + xorl %edx, %edx + movl 60(%esp), %ebp + shll %cl, %ebp + movl %ebp, 56(%esp) + jmp ..B1.6 +..B1.5: + movl 56(%esp), %ebp + movl 60(%esp), %edx + shldl %cl, %edx, %ebp + movl %ebp, 56(%esp) + shll %cl, %edx +..B1.6: + cmpl $31, 72(%esp) + jbe ..B1.8 +..B1.7: + movl 72(%esp), %ecx + xorl %ebp, %ebp + movl 64(%esp), %edi + shrl %cl, %edi + movl %edi, 60(%esp) + jmp ..B1.9 +..B1.8: + movl 72(%esp), %ecx + movl 68(%esp), %edi + movl 64(%esp), %ebp + shrdl %cl, %ebp, %edi + movl %edi, 60(%esp) + shrl %cl, %ebp +..B1.9: + orl %edx, 60(%esp) + orl %ebp, 56(%esp) + cmpl $31, 112(%esp) + jbe ..B1.11 +..B1.10: + movl %eax, %ecx + xorl %edx, %edx + movl 68(%esp), %ebp + shll %cl, %ebp + movl %ebp, 64(%esp) + jmp ..B1.12 +..B1.11: + movl %eax, %ecx + movl 64(%esp), %ebp + movl 68(%esp), %edx + shldl %cl, %edx, %ebp + movl %ebp, 64(%esp) + shll %cl, %edx +..B1.12: + cmpl $31, 72(%esp) + jbe ..B1.14 +..B1.13: + movl 72(%esp), %ecx + xorl %ebp, %ebp + movl 32(%esp), %edi + shrl %cl, %edi + movl %edi, 68(%esp) + jmp ..B1.15 +..B1.14: + movl 72(%esp), %ecx + movl 36(%esp), %edi + movl 32(%esp), %ebp + shrdl %cl, %ebp, %edi + movl %edi, 68(%esp) + shrl %cl, %ebp +..B1.15: + orl %edx, 68(%esp) + orl %ebp, 64(%esp) + cmpl $31, 112(%esp) + jbe ..B1.17 +..B1.16: + movl %eax, %ecx + xorl %edx, %edx + movl 36(%esp), %ebp + shll %cl, %ebp + movl %ebp, 32(%esp) + jmp ..B1.18 +..B1.17: + movl %eax, %ecx + movl 32(%esp), %ebp + movl 36(%esp), %edx + shldl %cl, %edx, %ebp + movl %ebp, 32(%esp) + shll %cl, %edx +..B1.18: + cmpl $31, 72(%esp) + jbe ..B1.20 +..B1.19: + movl %esi, %edi + xorl %ebp, %ebp + movl 72(%esp), %ecx + shrl %cl, %edi + movl %edi, 36(%esp) + jmp ..B1.21 +..B1.20: + movl %ebx, %ebp + movl 72(%esp), %ecx + shrdl %cl, %esi, %ebp + movl %ebp, 36(%esp) + movl %esi, %ebp + shrl %cl, %ebp +..B1.21: + orl %edx, 36(%esp) + orl %ebp, 32(%esp) + cmpl $31, 112(%esp) + jbe ..B1.23 +..B1.22: + movl %ebx, %esi + xorl %edx, %edx + movl %eax, %ecx + shll %cl, %esi + jmp ..B1.24 +..B1.23: + movl %ebx, %edx + movl %eax, %ecx + shldl %cl, %ebx, %esi + shll %cl, %edx +..B1.24: + cmpl $31, 72(%esp) + jbe ..B1.26 +..B1.25: + movl 72(%esp), %ecx + xorl %ebp, %ebp + movl 124(%esp), %ebx + shrl %cl, %ebx + jmp ..B1.27 +..B1.26: + movl 72(%esp), %ecx + movl 120(%esp), %ebx + movl 124(%esp), %ebp + shrdl %cl, %ebp, %ebx + shrl %cl, %ebp +..B1.27: + orl %edx, %ebx + orl %ebp, %esi +..B1.28: + movl %ebx, %eax + movl 128(%esp), %ecx + mull %ecx + movl %ebx, %eax + movl %edx, %ebp + mull 132(%esp) + addl %eax, %ebp + movl %ecx, %eax + movl %edx, %edi + adcl $0, %edi + mull %esi + addl %ebp, %eax + movl %edx, %ecx + adcl %edi, %ecx + subl %ebp, %eax + movl %ecx, %edx + sbbl %edi, %edx + jae ..B1.30 +..B1.29: + movl $1, %ebp + jmp ..B1.31 +..B1.30: + xorl %ebp, %ebp +..B1.31: + movl %esi, %eax + movl 132(%esp), %edi + mull %edi + addl %edx, %ebp + addl %ecx, %eax + movl %esi, %ecx + movl %eax, 88(%esp) + adcl $0, %ebp + movl 128(%esp), %eax + imull %ebx, %edi + imull %eax, %ecx + mull %ebx + addl %ecx, %edi + movl 104(%esp), %ecx + addl %edi, %edx + movl %edx, 100(%esp) + movl %esi, %edi + movl %ecx, %edx + movl %ebp, 92(%esp) + movl 108(%esp), %ebp + imull %ebp, %edi + imull %ebx, %edx + movl %eax, 96(%esp) + movl %ebx, %eax + addl %edx, %edi + mull %ebp + movl %eax, 40(%esp) + movl %ebx, %eax + addl %edi, %edx + movl %edx, 44(%esp) + mull %ebp + movl %ebx, %eax + movl %edx, %edi + mull %ecx + addl %eax, %edi + movl %ebp, %eax + movl %edx, %ebx + adcl $0, %ebx + mull %esi + addl %edi, %eax + movl 92(%esp), %ebp + adcl %ebx, %edx + subl %edi, %eax + movl %edx, 48(%esp) + sbbl %ebx, %edx + movl 88(%esp), %ebx + jae ..B1.33 +..B1.32: + movl $1, %ecx + jmp ..B1.34 +..B1.33: + xorl %ecx, %ecx +..B1.34: + movl %esi, %eax + mull 104(%esp) + movl %eax, %esi + addl %edx, %ecx + addl 48(%esp), %esi + movl 40(%esp), %eax + adcl $0, %ecx + addl %eax, %ebx + movl %ebx, %edx + movl 44(%esp), %edi + adcl %edi, %ebp + subl %eax, %edx + movl %ebp, %eax + sbbl %edi, %eax + jae ..B1.36 +..B1.35: + movl $1, %eax + jmp ..B1.37 +..B1.36: + xorl %eax, %eax +..B1.37: + addl %eax, %esi + movl %ebx, 88(%esp) + movl %esi, 84(%esp) + adcl $0, %ecx + movl 132(%esp), %ebx + movl %ebx, %edi + movl 32(%esp), %esi + movl %esi, %edx + movl %ebp, 92(%esp) + movl %ecx, 136(%esp) + movl 36(%esp), %ecx + movl 128(%esp), %ebp + movl %ebp, %eax + imull %ecx, %edi + imull %ebp, %edx + addl %edx, %edi + mull %ecx + movl %eax, 44(%esp) + movl %ebp, %eax + addl %edi, %edx + movl %edx, 48(%esp) + mull %ecx + movl %ecx, %eax + movl %edx, %edi + mull %ebx + addl %eax, %edi + movl %ebp, %eax + movl %edx, %ecx + adcl $0, %ecx + mull %esi + addl %edi, %eax + movl 84(%esp), %esi + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 52(%esp) + movl 88(%esp), %ebx + sbbl %ecx, %edx + movl 136(%esp), %ecx + movl 92(%esp), %ebp + jae ..B1.39 +..B1.38: + movl $1, %edi + jmp ..B1.40 +..B1.39: + xorl %edi, %edi +..B1.40: + movl 32(%esp), %eax + mull 132(%esp) + addl %edx, %edi + addl 52(%esp), %eax + movl %eax, 40(%esp) + movl 44(%esp), %eax + adcl $0, %edi + addl %eax, %ebx + movl %ebx, %edx + adcl 48(%esp), %ebp + subl %eax, %edx + movl %ebp, %eax + sbbl 48(%esp), %eax + jae ..B1.42 +..B1.41: + movl $1, 44(%esp) + jmp ..B1.43 +..B1.42: + movl $0, 44(%esp) +..B1.43: + movl 44(%esp), %eax + addl %eax, %esi + movl %esi, %edx + adcl $0, %ecx + subl %eax, %edx + movl $0, %eax + movl %ecx, %edx + sbbl %eax, %edx + jae ..B1.45 +..B1.44: + movl $1, 52(%esp) + jmp ..B1.46 +..B1.45: + movl $0, 52(%esp) +..B1.46: + movl 40(%esp), %eax + addl %eax, %esi + movl %esi, %edx + adcl %edi, %ecx + subl %eax, %edx + movl %ecx, %eax + sbbl %edi, %eax + jae ..B1.48 +..B1.47: + movl $1, %eax + jmp ..B1.49 +..B1.48: + xorl %eax, %eax +..B1.49: + movl %esi, 84(%esp) + movl %ebx, 88(%esp) + movl 104(%esp), %ebx + movl %ebx, %edi + movl 32(%esp), %esi + movl %esi, %edx + movl %ebp, 92(%esp) + movl %ecx, 136(%esp) + movl 36(%esp), %ecx + movl 108(%esp), %ebp + imull %ecx, %edi + imull %ebp, %edx + addl %eax, 52(%esp) + movl %ebp, %eax + addl %edx, %edi + mull %ecx + movl %eax, 40(%esp) + movl %ebp, %eax + addl %edi, %edx + movl %edx, 44(%esp) + mull %ecx + movl %ecx, %eax + movl %edx, %edi + mull %ebx + addl %eax, %edi + movl %ebp, %eax + movl %edx, %ecx + adcl $0, %ecx + mull %esi + addl %edi, %eax + movl 88(%esp), %ebx + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 48(%esp) + movl 84(%esp), %esi + sbbl %ecx, %edx + movl 136(%esp), %ecx + movl 92(%esp), %ebp + jae ..B1.51 +..B1.50: + movl $1, %edi + jmp ..B1.52 +..B1.51: + xorl %edi, %edi +..B1.52: + movl 32(%esp), %eax + mull 104(%esp) + addl %edx, %edi + addl 48(%esp), %eax + movl %eax, 36(%esp) + movl 40(%esp), %eax + adcl $0, %edi + addl %eax, %esi + movl %esi, %edx + adcl 44(%esp), %ecx + subl %eax, %edx + movl %ecx, %eax + sbbl 44(%esp), %eax + jae ..B1.54 +..B1.53: + movl $1, %eax + jmp ..B1.55 +..B1.54: + xorl %eax, %eax +..B1.55: + movl 52(%esp), %edx + addl 36(%esp), %edx + movl %ebp, 92(%esp) + adcl $0, %edi + addl %eax, %edx + movl %ecx, 136(%esp) + movl 132(%esp), %ecx + adcl $0, %edi + movl 64(%esp), %ebp + movl %esi, 84(%esp) + movl %ecx, %esi + movl %edx, 52(%esp) + movl %ebp, %edx + movl %ebx, 88(%esp) + movl %edi, 48(%esp) + movl 68(%esp), %edi + movl 128(%esp), %ebx + movl %ebx, %eax + imull %edi, %esi + imull %ebx, %edx + addl %edx, %esi + mull %edi + movl %eax, 32(%esp) + movl %ebx, %eax + addl %esi, %edx + movl %edx, 40(%esp) + mull %edi + movl %edi, %eax + movl %edx, %esi + mull %ecx + addl %eax, %esi + movl %ebx, %eax + movl %edx, %edi + adcl $0, %edi + mull %ebp + addl %esi, %eax + movl 88(%esp), %ebx + adcl %edi, %edx + subl %esi, %eax + movl %edx, 44(%esp) + movl 136(%esp), %ecx + sbbl %edi, %edx + movl 48(%esp), %edi + movl 84(%esp), %esi + movl 92(%esp), %ebp + jae ..B1.57 +..B1.56: + movl $1, 48(%esp) + jmp ..B1.58 +..B1.57: + movl $0, 48(%esp) +..B1.58: + movl 64(%esp), %eax + mull 132(%esp) + movl %ebx, 88(%esp) + movl 48(%esp), %ebx + addl %edx, %ebx + addl 44(%esp), %eax + movl %eax, 36(%esp) + movl 32(%esp), %eax + adcl $0, %ebx + addl %eax, %esi + movl %esi, %edx + movl %ebx, 48(%esp) + movl 40(%esp), %ebx + adcl %ebx, %ecx + subl %eax, %edx + movl %ecx, %eax + sbbl %ebx, %eax + movl 88(%esp), %ebx + jae ..B1.60 +..B1.59: + movl $1, 32(%esp) + jmp ..B1.61 +..B1.60: + movl $0, 32(%esp) +..B1.61: + movl %esi, 84(%esp) + movl %ebx, 88(%esp) + movl 104(%esp), %esi + movl 68(%esp), %ebx + movl 108(%esp), %eax + movl 64(%esp), %edx + imull %ebx, %esi + imull %eax, %edx + addl %edx, %esi + mull %ebx + movl %ecx, 136(%esp) + movl %eax, %ecx + movl %edx, %ebx + addl %esi, %ebx + addl 52(%esp), %ecx + movl 60(%esp), %esi + movl 56(%esp), %edx + adcl %edi, %ebx + movl 132(%esp), %edi + movl 128(%esp), %eax + imull %esi, %edi + imull %eax, %edx + addl %edx, %edi + mull %esi + addl 36(%esp), %ecx + adcl 48(%esp), %ebx + addl %edi, %edx + addl 32(%esp), %ecx + adcl $0, %ebx + addl %ecx, %eax + movl 180(%esp), %ecx + movl %ecx, %edi + adcl %ebx, %edx + negl %edi + cmpl $0, 80(%esp) + movl %eax, 140(%esp) + jne ..L3 + movl %ecx, %edi +..L3: + xorl %eax, %eax + shll $29, %edi + addl %edi, %edx + movl %eax, 44(%esp) + movl 88(%esp), %ebx + movl %edx, 152(%esp) + movl %eax, 40(%esp) + jmp ..B1.62 +..B1.96: + addl $64, 44(%esp) + movl 152(%esp), %ecx + movl 136(%esp), %edx + movl 84(%esp), %eax + movl 32(%esp), %esi + movl 36(%esp), %edi + movl %ebx, 84(%esp) + movl %ebp, 136(%esp) + movl 96(%esp), %ebx + movl 100(%esp), %ebp + adcl $0, 40(%esp) + andl $-536870912, %ecx + andl $536870911, %edx + orl %edx, %ecx + movl %eax, 140(%esp) + movl %ecx, 152(%esp) + movl %esi, 96(%esp) + movl %edi, 100(%esp) +..B1.62: + movl 152(%esp), %eax + xorl %edx, %edx + lea 4194304(%eax), %ecx + andl $1065353216, %ecx + orl %edx, %ecx + jne ..B1.119 +..B1.63: + movl 116(%esp), %eax + movl 120(%esp), %esi + movl 124(%esp), %edi + movl (%eax), %edx + movl %edx, 120(%esp) + xorl %edx, %edx + movl 4(%eax), %ecx + addl $8, %eax + movl %ecx, 124(%esp) + movl %eax, 116(%esp) + orl 112(%esp), %edx + je ..B1.71 +..B1.64: + cmpl $31, 112(%esp) + jbe ..B1.66 +..B1.65: + movl %esi, %edi + xorl %edx, %edx + movl 112(%esp), %ecx + shll %cl, %edi + jmp ..B1.67 +..B1.66: + movl %esi, %edx + movl 112(%esp), %ecx + shldl %cl, %esi, %edi + shll %cl, %edx +..B1.67: + cmpl $31, 72(%esp) + jbe ..B1.69 +..B1.68: + movl 72(%esp), %ecx + xorl %eax, %eax + movl 124(%esp), %esi + shrl %cl, %esi + jmp ..B1.70 +..B1.69: + movl 72(%esp), %ecx + movl 120(%esp), %esi + movl 124(%esp), %eax + shrdl %cl, %eax, %esi + shrl %cl, %eax +..B1.70: + orl %edx, %esi + orl %eax, %edi +..B1.71: + movl 132(%esp), %ecx + movl %edi, %edx + movl %ebx, 88(%esp) + movl %ecx, %ebx + movl %ebp, 92(%esp) + movl 128(%esp), %ebp + movl %ebp, %eax + imull %esi, %ebx + imull %ebp, %edx + addl %edx, %ebx + mull %esi + movl %eax, 32(%esp) + movl %ebp, %eax + addl %ebx, %edx + movl %edx, 36(%esp) + mull %esi + movl %esi, %eax + movl %edx, %ebx + mull %ecx + addl %eax, %ebx + movl %ebp, %eax + movl %edx, %ecx + adcl $0, %ecx + mull %edi + addl %ebx, %eax + movl 92(%esp), %ebp + adcl %ecx, %edx + subl %ebx, %eax + movl %edx, 56(%esp) + movl 88(%esp), %ebx + sbbl %ecx, %edx + jae ..B1.73 +..B1.72: + movl $1, %ecx + jmp ..B1.74 +..B1.73: + xorl %ecx, %ecx +..B1.74: + movl 132(%esp), %eax + mull %edi + addl %edx, %ecx + addl 56(%esp), %eax + movl 96(%esp), %edx + adcl $0, %ecx + addl %eax, %edx + movl %ebx, 88(%esp) + movl 100(%esp), %ebx + adcl %ecx, %ebx + movl %edx, 96(%esp) + subl %eax, %edx + movl %ebx, 100(%esp) + sbbl %ecx, %ebx + movl 88(%esp), %ebx + jae ..B1.76 +..B1.75: + movl $1, %ecx + jmp ..B1.77 +..B1.76: + xorl %ecx, %ecx +..B1.77: + movl 104(%esp), %edx + addl %ecx, %ebx + movl 108(%esp), %eax + movl %edi, 64(%esp) + adcl $0, %ebp + imull %esi, %edx + imull %eax, %edi + addl %edi, %edx + movl %ebx, %edi + movl %edx, 68(%esp) + mull %esi + addl 68(%esp), %edx + subl %ecx, %edi + movl $0, %ecx + movl %edx, 52(%esp) + movl %ebp, %edx + movl %eax, 48(%esp) + sbbl %ecx, %edx + movl 64(%esp), %edi + jae ..B1.80 +..B1.78: + movl $1, %ecx +..B1.80: + movl 108(%esp), %eax + mull %esi + movl %esi, %eax + movl %ebx, 88(%esp) + movl %edx, %ebx + mull 104(%esp) + addl %eax, %ebx + movl %edx, %esi + movl 108(%esp), %eax + adcl $0, %esi + mull %edi + addl %ebx, %eax + adcl %esi, %edx + subl %ebx, %eax + movl %edx, 60(%esp) + movl 88(%esp), %ebx + sbbl %esi, %edx + jae ..B1.82 +..B1.81: + movl $1, %esi + jmp ..B1.83 +..B1.82: + xorl %esi, %esi +..B1.83: + movl 104(%esp), %eax + mull %edi + addl %edx, %esi + addl 60(%esp), %eax + movl %eax, 144(%esp) + movl 48(%esp), %edx + adcl $0, %esi + movl 96(%esp), %eax + addl %edx, %eax + movl %esi, 148(%esp) + movl 52(%esp), %esi + movl 100(%esp), %edi + adcl %esi, %edi + movl %eax, 96(%esp) + subl %edx, %eax + movl %edi, 100(%esp) + movl 144(%esp), %eax + sbbl %esi, %edi + movl 148(%esp), %esi + jae ..B1.85 +..B1.84: + movl $1, %edx + jmp ..B1.86 +..B1.85: + xorl %edx, %edx +..B1.86: + addl %edx, %ebx + movl %ebx, %edi + adcl $0, %ebp + subl %edx, %edi + movl $0, %edx + movl %ebp, %edi + sbbl %edx, %edi + jae ..B1.89 +..B1.87: + movl $1, %edx +..B1.89: + addl %eax, %ebx + adcl %esi, %ebp + addl %edx, %ecx + movl %ebx, %edx + subl %eax, %edx + movl %ebp, %eax + sbbl %esi, %eax + jae ..B1.91 +..B1.90: + movl $1, %eax + jmp ..B1.92 +..B1.91: + xorl %eax, %eax +..B1.92: + addl %eax, %ecx + xorl %eax, %eax + orl %eax, %ecx + je ..B1.95 +..B1.93: + movl 84(%esp), %eax + addl $1, %eax + movl 136(%esp), %edx + adcl $0, %edx + movl %eax, 84(%esp) + orl %edx, %eax + movl %edx, 136(%esp) + jne ..B1.95 +..B1.94: + addl $1, 140(%esp) + adcl $0, 152(%esp) +..B1.95: + movl 140(%esp), %ecx + movl %ecx, %eax + movl 152(%esp), %esi + shrl $23, %eax + shll $9, %esi + orl %esi, %eax + movl 136(%esp), %edx + movl %eax, %edi + shrl $23, %edx + shll $9, %ecx + sarl $31, %edi + orl %ecx, %edx + xorl %edi, %edx + xorl %edi, %eax + orl %eax, %edx + je ..B1.96 +..B1.97: + movl 136(%esp), %ecx + movl 84(%esp), %esi + movl 152(%esp), %edx +..B1.98: + movl %ebx, 88(%esp) + lea (,%edx,4), %edi + movl 140(%esp), %ebx + movl %ebx, %eax + sarl $2, %edi + subl %ebx, %eax + movl %eax, 32(%esp) + movl %edi, %eax + sbbl %edi, %edx + sarl $31, %eax + subl %eax, %ebx + negl %eax + addl %edi, %eax + movl %edi, 36(%esp) + orl %eax, %ebx + movl 88(%esp), %ebx + jne ..B1.100 +..B1.99: + movl %esi, 140(%esp) + movl %ebx, %esi + movl %ecx, 36(%esp) + movl %ebp, %ecx + movl 96(%esp), %ebx + movl 100(%esp), %ebp + addl $64, 44(%esp) +..B1.100: + xorl %eax, %eax + subl %eax, %edi + jge ..B1.103 +..B1.102: + movl $-2147483648, %eax +..B1.103: + testl %eax, %eax + je ..B1.111 +..B1.104: + notl %ebx + notl %ebp + addl $1, %ebx + notl %esi + movl %ebx, %edi + notl %ecx + adcl $0, %ebp + notl 140(%esp) + orl %ebp, %edi + notl 36(%esp) + jne ..B1.106 +..B1.105: + movl $1, %edi + jmp ..B1.107 +..B1.106: + xorl %edi, %edi +..B1.107: + addl %edi, %esi + movl %esi, %edi + adcl $0, %ecx + orl %ecx, %edi + jne ..B1.109 +..B1.108: + movl $1, %edi + jmp ..B1.110 +..B1.109: + xorl %edi, %edi +..B1.110: + addl %edi, 140(%esp) + adcl $0, 36(%esp) +..B1.111: + movl %ebp, 92(%esp) + xorl %edi, %edi + movl %ebx, 88(%esp) + addl $12, %esp + pushl %edi + pushl %edi + movl 184(%esp), %ebx + xorl %ebp, %ebp + pushl %ebx + subl 32(%esp), %ebp + movl 80(%esp), %ebp + sbbl %edx, %edi + testl %ebp, %ebp + movl $3, 4(%ebx) + jne ..L4 + movl %edx, %edi +..L4: + xorl %ebp, %eax + movl %eax, (%ebx) + movl 140(%esp), %eax + movl 36(%esp), %edx + movl %eax, 8(%ebx) + movl %edx, 12(%ebx) + movl %esi, 16(%ebx) + movl %ecx, 20(%ebx) + movl %edi, 40(%esp) + movl 88(%esp), %ebx + movl 92(%esp), %ebp + call __dpml_ffs_and_shift__ +..B1.112: + movl 188(%esp), %ecx + movl 4(%ecx), %eax + movl %eax, %ecx + cltd + addl $-3, %ecx + adcl $-1, %edx + orl %ecx, %edx + je ..B1.117 +..B1.113: + movl 188(%esp), %esi + addl $64, %ecx + cmpl $31, %ecx + movl 16(%esi), %edx + movl 20(%esi), %esi + jbe ..B1.115 +..B1.114: + movl %ebp, %ebx + xorl %edi, %edi + shrl %cl, %ebx + jmp ..B1.116 +..B1.115: + movl %ebp, %edi + shrdl %cl, %ebp, %ebx + shrl %cl, %edi +..B1.116: + movl 188(%esp), %ecx + orl %ebx, %edx + orl %edi, %esi + movl %edx, 16(%ecx) + movl %esi, 20(%ecx) +..B1.117: + addl $12, %esp + movl 176(%esp), %ebx + pushl %ebx + movl 68(%esp), %edx + lea 1008+__trig_x_table@GOTOFF(%edx), %ecx + pushl %ecx + pushl %ebx + subl 44(%esp), %eax + movl %eax, 4(%ebx) + call __dpml_multiply__ +..B1.118: + movl 40(%esp), %eax + xorl %edx, %edx + shrl $30, %eax + addl $156, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.119: + movl 136(%esp), %ecx + movl 84(%esp), %esi + movl %eax, %edx + jmp ..B1.98 +..B1.120: + movl %ebx, %eax + sarl $31, %eax + movl 180(%esp), %ecx + cltd + addl %ecx, %eax + movl %eax, %ebp + movl 184(%esp), %ebx + adcl %ebx, %edx + andl $1, %ebp + addl %ebp, %eax + movl %eax, %edi + adcl $0, %edx + subl %eax, %ecx + movl %edx, %ebp + movl %edx, %esi + sbbl %edx, %ebx + shll $31, %ebp + shrl $1, %edi + sarl $1, %esi + orl %edi, %ebp + movl %esi, 32(%esp) + orl %ebx, %ecx + movl %ebp, 36(%esp) + je ..B1.125 +..B1.121: + xorl %eax, %eax + subl %eax, %ebx + jge ..B1.124 +..B1.123: + movl $1, %eax +..B1.124: + addl $20, %esp + pushl 168(%esp) + pushl $0 + pushl %eax + movl 68(%esp), %eax + lea 1008+__trig_x_table@GOTOFF(%eax), %edx + pushl %edx + pushl 172(%esp) + call __dpml_addsub__ + jmp ..B1.126 +..B1.125: + movl 188(%esp), %eax + movl 176(%esp), %esi + movl 108(%esp), %ebx + movl 104(%esp), %ebp + movl 80(%esp), %edx + movl %ebx, 8(%eax) + movl %ebp, 12(%eax) + movl %edx, (%eax) + movl 112(%esp), %ecx + movl 16(%esi), %edi + movl 20(%esi), %edx + movl %ecx, 4(%eax) + movl %edi, 16(%eax) + movl %edx, 20(%eax) +..B1.126: + movl 36(%esp), %eax + movl 32(%esp), %edx + addl $156, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_ux_radian_reduce__,@function + .size __dpml_ux_radian_reduce__,.-__dpml_ux_radian_reduce__ + .data +# -- End __dpml_ux_radian_reduce__ + .text +# -- Begin __dpml_ux_degree_reduce__ + .text + .align 16,0x90 +__dpml_ux_degree_reduce__: +# parameter 1: 128 + %esp +# parameter 2: 132 + %esp +# parameter 3: 140 + %esp +..B2.1: +..L5: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $108, %esp + movl 128(%esp), %ecx + call ..L6 +..L6: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L6](%eax), %eax + movl (%ecx), %edx + movl 4(%ecx), %ebx + cmpl $142, %ebx + movl %eax, 52(%esp) + movl %edx, 48(%esp) + jle ..B2.6 +..B2.2: + movl %eax, %ebp + lea 32641(%ebx), %esi + movl %esi, %eax + cltd + movl %edx, %ecx + mull 264+__trig_x_table@GOTOFF(%ebp) + movl %esi, %eax + movl 268+__trig_x_table@GOTOFF(%ebp), %edi + movl %edx, %ebp + mull %edi + movl %edx, %esi + addl %eax, %ebp + movl 52(%esp), %edx + adcl $0, %esi + movl 264+__trig_x_table@GOTOFF(%edx), %eax + mull %ecx + addl %ebp, %eax + adcl %esi, %edx + subl %ebp, %eax + movl %edx, 16(%esp) + sbbl %esi, %edx +..B2.5: + movl %edi, %eax + mull %ecx + addl 16(%esp), %eax + movl 128(%esp), %edi + lea (,%eax,8), %ebp + lea (%ebp,%eax,4), %esi + negl %esi + lea 32772(%esi,%ebx), %ebx + movl %ebx, 4(%edi) +..B2.6: + cmpl $16, %ebx + jl ..B2.61 +..B2.7: + movl %ebx, %eax + movl %ebx, %ebp + cltd + addl $-15, %ebp + movl %edx, %esi + movl %ebp, %ecx + adcl $-1, %esi + xorl %edx, %edx + andl $63, %ecx + movl %esi, %edi + subl %ecx, %ebx + shll $26, %edi + shrl $6, %ebp + sarl $6, %esi + orl %ebp, %edi + movl %edi, 56(%esp) + orl %ecx, %edx + je ..B2.21 +..B2.8: + movl 128(%esp), %edx + movl %ecx, %edi + negl %edi + addl $64, %edi + movl 20(%edx), %ebp + cmpl $31, %ecx + movl %edi, 28(%esp) + movl 16(%edx), %edi + movl %ebp, 16(%esp) + jbe ..B2.10 +..B2.9: + movl %edi, %edx + xorl %ebp, %ebp + shll %cl, %edx + jmp ..B2.11 +..B2.10: + movl %edi, %ebp + movl 16(%esp), %edx + shldl %cl, %edi, %edx + shll %cl, %ebp +..B2.11: + movl 128(%esp), %eax + cmpl $31, %ecx + movl %ebp, 16(%eax) + movl 12(%eax), %ebp + movl %edx, 20(%eax) + movl 8(%eax), %edx + movl %ebp, 24(%esp) + jbe ..B2.13 +..B2.12: + movl %edx, %ebp + movl $0, 32(%esp) + shll %cl, %ebp + jmp ..B2.14 +..B2.13: + movl %edx, %eax + shll %cl, %eax + shldl %cl, %edx, %ebp + movl %eax, 32(%esp) +..B2.14: + cmpl $31, 28(%esp) + jbe ..B2.16 +..B2.15: + movl 28(%esp), %ecx + movl 16(%esp), %edi + movl $0, 20(%esp) + shrl %cl, %edi + jmp ..B2.17 +..B2.16: + movl 28(%esp), %ecx + movl 16(%esp), %eax + shrdl %cl, %eax, %edi + shrl %cl, %eax + movl %eax, 20(%esp) +..B2.17: + movl 32(%esp), %eax + orl %edi, %eax + movl 128(%esp), %edi + orl 20(%esp), %ebp + cmpl $31, 28(%esp) + movl %eax, 8(%edi) + movl %ebp, 12(%edi) + jbe ..B2.19 +..B2.18: + xorl %ebp, %ebp + movl 24(%esp), %edx + shrl %cl, %edx + jmp ..B2.22 +..B2.19: + movl 24(%esp), %ebp + shrdl %cl, %ebp, %edx + shrl %cl, %ebp + jmp ..B2.22 +..B2.21: + xorl %edx, %edx + xorl %ebp, %ebp +..B2.22: + movl 128(%esp), %edi + movl %esi, %ecx + movl %edx, (%edi) + movl 56(%esp), %edx + movl %ebp, 4(%edi) + movl 8(%edi,%edx,8), %eax + movl 12(%edi,%edx,8), %edi + movl %edi, %ebp + xorl %edx, %edx + shrl $20, %ebp + subl %edx, %ecx + jl ..B2.55 +..B2.23: + movl 56(%esp), %edi + addl $1, %edi + movl %edi, 32(%esp) + adcl $0, %esi + movl %esi, %eax + movl %edi, 72(%esp) + testl %eax, %eax + jge ..B2.25 +..B2.24: + addl $1, 72(%esp) + adcl $0, %eax +..B2.25: + movl 72(%esp), %edi + shrdl $1, %eax, %edi + sarl $1, %eax + movl %edi, 72(%esp) + xorl %edi, %edi + movl %eax, %ecx + movl %edi, 28(%esp) + subl %edi, %ecx + movl %edi, 24(%esp) + jb ..B2.104 +..B2.107: + orl 72(%esp), %ecx + je ..B2.104 +..B2.26: + xorl %ecx, %ecx + movl %ecx, 64(%esp) + movl %ecx, 60(%esp) + movl %eax, 76(%esp) + movl %edi, 68(%esp) + movl %ebx, 20(%esp) + movl %esi, 16(%esp) + movl %edi, 80(%esp) + movl 28(%esp), %ecx + movl 24(%esp), %eax +..B2.27: + movl 56(%esp), %edi + movl 64(%esp), %ebx + movl 128(%esp), %esi + addl %edi, %ebx + movl %ebx, 84(%esp) + movl (%esi,%ebx,8), %edi + movl %edi, 100(%esp) + movl 4(%esi,%ebx,8), %edi + movl %edi, 88(%esp) + xorl %edi, %edi + movl %edi, (%esi,%ebx,8) + movl %edi, 4(%esi,%ebx,8) + movl %ecx, %esi + movl 100(%esp), %ebx + orl %eax, %esi + je ..B2.35 +..B2.28: + cmpl $31, %ecx + jbe ..B2.30 +..B2.29: + xorl %esi, %esi + jmp ..B2.31 +..B2.30: + movl %ebx, %esi + shll %cl, %esi +..B2.31: + andl $4095, %esi + xorl %edi, %edi + addl %esi, %ebp + adcl $0, %edx + movl $12, %esi + subl %ecx, %esi + sbbl %eax, %edi + movl %edi, 36(%esp) + cmpl $31, %esi + jbe ..B2.33 +..B2.32: + movl %esi, %ecx + xorl %eax, %eax + movl 88(%esp), %ebx + shrl %cl, %ebx + jmp ..B2.34 +..B2.33: + movl %esi, %ecx + movl 88(%esp), %eax + shrdl %cl, %eax, %ebx + shrl %cl, %eax +..B2.34: + movl %eax, 88(%esp) + xorl %eax, %eax + xorl %ecx, %ecx + subl %esi, %ecx + sbbl 36(%esp), %eax +..B2.35: + movl 88(%esp), %edi + movl %edi, %esi + shrl $28, %edi + andl $268435455, %esi + addl %edi, %ebx + adcl $0, %esi + addl %ebp, %ebx + adcl %edx, %esi + addl $4, %ecx + movl %esi, 96(%esp) + movl 128(%esp), %esi + adcl $0, %eax + movl 84(%esp), %edx + movl -4(%esi,%edx,8), %edi + movl -8(%esi,%edx,8), %ebp + movl %edi, 92(%esp) + xorl %edi, %edi + movl %edi, -8(%esi,%edx,8) + movl %edi, -4(%esi,%edx,8) + movl %ecx, %edx + orl %eax, %edx + je ..B2.43 +..B2.36: + cmpl $31, %ecx + jbe ..B2.38 +..B2.37: + movl $0, 44(%esp) + jmp ..B2.39 +..B2.38: + movl %ebp, %edx + shll %cl, %edx + movl %edx, 44(%esp) +..B2.39: + movl 44(%esp), %edx + xorl %esi, %esi + andl $4095, %edx + addl %edx, %ebx + adcl $0, 96(%esp) + movl $12, %edx + subl %ecx, %edx + sbbl %eax, %esi + movl %esi, 40(%esp) + cmpl $31, %edx + jbe ..B2.41 +..B2.40: + movl %edx, %ecx + xorl %eax, %eax + movl 92(%esp), %ebp + shrl %cl, %ebp + jmp ..B2.42 +..B2.41: + movl %edx, %ecx + movl 92(%esp), %eax + shrdl %cl, %eax, %ebp + shrl %cl, %eax +..B2.42: + movl %eax, 92(%esp) + xorl %eax, %eax + xorl %ecx, %ecx + subl %edx, %ecx + sbbl 40(%esp), %eax +..B2.43: + movl 92(%esp), %esi + movl %esi, %edx + shrl $28, %esi + andl $268435455, %edx + addl %esi, %ebp + movl 68(%esp), %edi + adcl $0, %edx + addl %ebx, %ebp + movl 80(%esp), %ebx + adcl 96(%esp), %edx + addl $4, %ecx + adcl $0, %eax + addl $-2, 64(%esp) + adcl $-1, 60(%esp) + addl $1, %ebx + movl %ebx, 80(%esp) + adcl $0, %edi + subl 72(%esp), %ebx + movl %edi, 68(%esp) + sbbl 76(%esp), %edi + jb ..B2.27 +..B2.44: + movl 80(%esp), %edi + movl %eax, 24(%esp) + movl %edi, %eax + movl %ecx, 28(%esp) + addl %edi, %edi + movl 68(%esp), %ecx + shrl $31, %eax + addl %ecx, %ecx + orl %ecx, %eax + addl $1, %edi + movl 20(%esp), %ebx + movl 16(%esp), %esi + adcl $0, %eax +..B2.45: + movl %edi, %ecx + addl $-1, %ecx + adcl $-1, %eax + subl %ecx, 32(%esp) + sbbl %eax, %esi + jb ..B2.103 +..B2.108: + movl 32(%esp), %eax + orl %esi, %eax + je ..B2.103 +..B2.46: + negl %edi + xorl %ecx, %ecx + addl 56(%esp), %edi + movl 128(%esp), %eax + movl 8(%eax,%edi,8), %esi + movl %esi, 16(%esp) + movl 12(%eax,%edi,8), %esi + movl %ecx, 8(%eax,%edi,8) + movl %ecx, 12(%eax,%edi,8) + movl 24(%esp), %edi + orl 28(%esp), %edi + je ..B2.54 +..B2.47: + cmpl $31, 28(%esp) + jbe ..B2.49 +..B2.48: + xorl %edi, %edi + jmp ..B2.50 +..B2.49: + movl 28(%esp), %ecx + movl 16(%esp), %edi + shll %cl, %edi +..B2.50: + andl $4095, %edi + addl %edi, %ebp + movl 28(%esp), %edi + adcl $0, %edx + negl %edi + addl $12, %edi + movl %edi, 28(%esp) + cmpl $31, %edi + jbe ..B2.52 +..B2.51: + movl %edi, %ecx + xorl %edi, %edi + shrl %cl, %esi + movl %esi, 16(%esp) + jmp ..B2.53 +..B2.52: + movl %edi, %ecx + movl 16(%esp), %edi + shrdl %cl, %esi, %edi + movl %edi, 16(%esp) + movl %esi, %edi + shrl %cl, %edi +..B2.53: + movl %edi, %esi +..B2.54: + movl %esi, %eax + shrl $28, %esi + andl $268435455, %eax + movl 16(%esp), %edi + addl %esi, %edi + movl 128(%esp), %esi + adcl $0, %eax + addl %edi, %ebp + movl 56(%esp), %edi + adcl %eax, %edx + movl 8(%esi,%edi,8), %eax + movl 12(%esi,%edi,8), %edi +..B2.55: + movl %edx, %esi + movl %ebp, %ecx + shll $20, %esi + shrl $12, %ecx + orl %ecx, %esi + shrl $12, %edx + movl %esi, %ecx + orl %edx, %ecx + je ..B2.59 +..B2.57: + andl $4095, %ebp + addl %esi, %ebp + movl %ebp, %ecx + adcl $0, %edx + movl %edx, %esi + shll $20, %esi + shrl $12, %ecx + orl %ecx, %esi + shrl $12, %edx + movl %esi, %ecx + orl %edx, %ecx + jne ..B2.57 +..B2.59: + addl $12, %esp + xorl %esi, %esi + pushl %esi + pushl %esi + movl 124(%esp), %edx + andl $1048575, %edi + pushl %edx + shll $20, %ebp + orl %ebp, %edi + movl 56(%esp), %ebp + movl %ebx, 4(%edx) + movl %eax, 8(%edx,%ebp,8) + movl %edi, 12(%edx,%ebp,8) + call __dpml_ffs_and_shift__ +..B2.60: + subl %eax, %ebx +..B2.61: + movl %ebx, %eax + addl $-5, %ebx + cltd + movl 128(%esp), %esi + adcl $-1, %edx + xorl %edi, %edi + subl %edi, %edx + movl %edi, (%esi) + movl 8(%esi), %ebp + movl 12(%esi), %esi + jl ..B2.66 +..B2.109: + orl %ebx, %edx + je ..B2.66 +..B2.62: + movl 52(%esp), %edi + movl %ebp, %eax + mull 256+__trig_x_table@GOTOFF(%edi) + movl %ebp, %eax + movl 260+__trig_x_table@GOTOFF(%edi), %ecx + movl %edx, %edi + mull %ecx + movl %ecx, 16(%esp) + movl %edx, %ecx + movl 52(%esp), %edx + addl %eax, %edi + adcl $0, %ecx + movl 256+__trig_x_table@GOTOFF(%edx), %eax + mull %esi + addl %edi, %eax + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 20(%esp) + sbbl %ecx, %edx + jae ..B2.64 +..B2.63: + movl $1, 28(%esp) + jmp ..B2.65 +..B2.64: + movl $0, 28(%esp) +..B2.65: + movl 16(%esp), %eax + mull %esi + movl 28(%esp), %edi + addl %edx, %edi + addl 20(%esp), %eax + movl %eax, 24(%esp) + adcl $0, %edi + movl %edi, 28(%esp) + jmp ..B2.67 +..B2.66: + xorl %edx, %edx + movl $1, %ebx + movl %edx, 24(%esp) + movl %edx, 28(%esp) +..B2.67: + negl %ebx + movl 132(%esp), %eax + andl $1, %eax + incl %eax + lea 64(%ebx), %edx + addl $63, %ebx + movl %edx, 16(%esp) + cmpl $31, %ebx + jbe ..B2.69 +..B2.68: + movl %ebx, %ecx + movl %eax, %edi + shll %cl, %edi + xorl %edx, %edx + jmp ..B2.70 +..B2.69: + movl %ebx, %ecx + xorl %edi, %edi + movl %eax, %edx + shldl %cl, %eax, %edi + shll %cl, %edx +..B2.70: + addl 24(%esp), %edx + adcl 28(%esp), %edi + cmpl $31, 16(%esp) + jbe ..B2.72 +..B2.71: + movl $1, %ebx + xorl %eax, %eax + movl 16(%esp), %ecx + shll %cl, %ebx + jmp ..B2.73 +..B2.72: + xorl %ebx, %ebx + movl $1, %eax + movl 16(%esp), %ecx + shldl %cl, %eax, %ebx + shll %cl, %eax +..B2.73: + addl $-1, %eax + notl %eax + adcl $-1, %ebx + andl %eax, %edx + notl %ebx + andl %ebx, %edi + cmpl $31, 16(%esp) + jbe ..B2.75 +..B2.74: + movl %edi, %eax + shrl %cl, %eax + jmp ..B2.76 +..B2.75: + movl %edx, %eax + shrdl %cl, %edi, %eax +..B2.76: + movl %eax, %ebx + negl %ebx + cmpl $0, 48(%esp) + jne ..L7 + movl %eax, %ebx +..L7: + movl 132(%esp), %eax + shrl $1, %eax + addl %ebx, %eax + movl %eax, 24(%esp) + movl $-1275068416, %eax + mull %edx + movl $-1275068416, %eax + movl %edx, %ecx + mull %edi + movl %edx, %ebx + movl %esi, %edi + movl %ebp, %edx + addl %ecx, %eax + adcl $0, %ebx + andl $3, %ebp + shll $30, %edi + shrl $2, %edx + orl %edx, %edi + shrl $2, %esi + subl %eax, %edi + sbbl %ebx, %esi + movl %edi, %ebx + shll $2, %edi + shrl $30, %ebx + orl %edi, %ebp + xorl %edi, %edi + lea (,%esi,4), %ecx + orl %ecx, %ebx + subl %edi, %esi + jl ..B2.99 +..B2.77: + addl $12, %esp + xorl %eax, %eax + pushl %eax + pushl %eax + movl 124(%esp), %edx + pushl %edx + movl %ebp, 8(%edx) + movl %ebx, 12(%edx) + call __dpml_ffs_and_shift__ +..B2.78: + movl 128(%esp), %esi + xorl %ebx, %ebx + andl $536870911, 24(%esp) + movl 8(%esi), %edi + movl %edi, %eax + movl 4(%esi), %ecx + movl 12(%esi), %esi + orl %esi, %eax + jne ..B2.81 +..B2.79: + movl 24(%esp), %ecx + xorl %eax, %eax + andl $2, %ecx + movl $536870912, %ebx + orl %eax, %ecx + je ..B2.97 +..B2.80: + movl 128(%esp), %eax + xorl $-2147483648, (%eax) + jmp ..B2.97 +..B2.81: + cmpl $5, %ecx + jl ..B2.96 +..B2.82: + movl 128(%esp), %eax + movl 16(%eax), %ebp + orl 20(%eax), %ebp + jne ..B2.96 +..B2.83: + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B2.85 +..B2.84: + movl %esi, %ebp + movl $0, 16(%esp) + shrl %cl, %ebp + jmp ..B2.86 +..B2.85: + movl %esi, %eax + movl %edi, %ebp + shrl %cl, %eax + shrdl %cl, %esi, %ebp + movl %eax, 16(%esp) +..B2.86: + cmpl $31, %ecx + jbe ..B2.88 +..B2.87: + movl %ebp, %eax + movl $0, 20(%esp) + shll %cl, %eax + jmp ..B2.89 +..B2.88: + movl %ebp, %edx + movl 16(%esp), %eax + shll %cl, %edx + shldl %cl, %ebp, %eax + movl %edx, 20(%esp) +..B2.89: + subl 20(%esp), %edi + subl %eax, %esi + orl %esi, %edi + jne ..B2.96 +..B2.90: + movl $30, %eax + negl %eax + addl %ebp, %eax + orl 16(%esp), %eax + jne ..B2.94 +..B2.91: + movl 24(%esp), %ecx + xorl %eax, %eax + andl $1, %ecx + orl %eax, %ecx + jne ..B2.96 +..B2.92: + movl 128(%esp), %ecx + movl $1073741824, %ebx + movl 48(%esp), %eax + xorl %eax, (%ecx) + jmp ..B2.97 +..B2.94: + movl $45, %eax + subl %eax, %ebp + orl 16(%esp), %ebp + jne ..B2.96 +..B2.95: + movl $-2147483648, %ebx +..B2.96: + movl 128(%esp), %ecx + movl 48(%esp), %eax + xorl %eax, (%ecx) +..B2.97: + addl $12, %esp + pushl 128(%esp) + movl 44(%esp), %eax + lea 216+__trig_x_table@GOTOFF(%eax), %ecx + pushl %ecx + pushl 124(%esp) + call __dpml_multiply__ +..B2.98: + movl 24(%esp), %eax + movl %ebx, %edx + addl $108, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B2.99: + movl 128(%esp), %edx + xorl %eax, %eax + xorl $-2147483648, 48(%esp) + movl 16(%edx), %ecx + movl 20(%edx), %esi + xorl %edx, %edx + subl %ecx, %edx + sbbl %esi, %eax + orl %esi, %ecx + je ..B2.101 +..B2.100: + movl $1, %ecx + jmp ..B2.102 +..B2.101: + xorl %ecx, %ecx +..B2.102: + movl 128(%esp), %esi + addl %ecx, %ebp + adcl $0, %ebx + movl %edx, 16(%esi) + xorl %edx, %edx + movl %eax, 20(%esi) + movl %ebp, %eax + xorl %ebp, %ebp + movl %ebx, %ecx + xorl %ebx, %ebx + subl %eax, %ebp + sbbl %ecx, %ebx + jmp ..B2.77 +..B2.103: + movl 56(%esp), %edi + movl 128(%esp), %esi + movl 8(%esi,%edi,8), %eax + movl 12(%esi,%edi,8), %edi + jmp ..B2.55 +..B2.104: + movl $1, %edi + xorl %eax, %eax + jmp ..B2.45 + .align 16,0x90 + .type __dpml_ux_degree_reduce__,@function + .size __dpml_ux_degree_reduce__,.-__dpml_ux_degree_reduce__ + .data +# -- End __dpml_ux_degree_reduce__ + .text +# -- Begin __dpml_ux_sincos + .text + .align 16,0x90 + .hidden __dpml_ux_sincos + .globl __dpml_ux_sincos +__dpml_ux_sincos: +# parameter 1: 192 + %esp +# parameter 2: 196 + %esp +# parameter 3: 204 + %esp +# parameter 4: 212 + %esp +..B3.1: +..L8: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $172, %esp + xorl %ecx, %ecx + call ..L9 +..L9: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L9](%eax), %eax + movl %eax, 148(%esp) + movl 204(%esp), %eax + andl $16, %eax + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 156(%esp) + orl %ecx, %eax + je ..B3.3 +..B3.2: + movl 148(%esp), %eax + lea __dpml_ux_degree_reduce__@GOTOFF(%eax), %edx + movl %edx, %eax + jmp ..B3.4 +..B3.3: + movl 148(%esp), %eax + lea __dpml_ux_radian_reduce__@GOTOFF(%eax), %edx + lea __dpml_ux_degree_reduce__@GOTOFF(%eax), %eax +..B3.4: + cmpl %eax, %edx + jne ..B3.119 +..B3.5: + movl 192(%esp), %edx + movl (%edx), %eax + movl 4(%edx), %ebx + cmpl $142, %ebx + movl %eax, 68(%esp) + jle ..B3.10 +..B3.6: + movl 148(%esp), %ebp + lea 32641(%ebx), %esi + movl %esi, %eax + cltd + movl %edx, %ecx + mull 264+__trig_x_table@GOTOFF(%ebp) + movl %esi, %eax + movl 268+__trig_x_table@GOTOFF(%ebp), %edi + movl %edx, %ebp + mull %edi + movl %edx, %esi + addl %eax, %ebp + movl 148(%esp), %edx + adcl $0, %esi + movl 264+__trig_x_table@GOTOFF(%edx), %eax + mull %ecx + addl %ebp, %eax + adcl %esi, %edx + subl %ebp, %eax + movl %edx, 32(%esp) + sbbl %esi, %edx +..B3.9: + movl %edi, %eax + mull %ecx + addl 32(%esp), %eax + movl 192(%esp), %edi + lea (,%eax,8), %ebp + lea (%ebp,%eax,4), %esi + negl %esi + lea 32772(%esi,%ebx), %ebx + movl %ebx, 4(%edi) +..B3.10: + cmpl $16, %ebx + jl ..B3.65 +..B3.11: + movl %ebx, %eax + movl %ebx, %ebp + cltd + addl $-15, %ebp + movl %edx, %esi + movl %ebp, %ecx + adcl $-1, %esi + xorl %edx, %edx + andl $63, %ecx + movl %esi, %edi + subl %ecx, %ebx + shll $26, %edi + shrl $6, %ebp + sarl $6, %esi + orl %ebp, %edi + movl %edi, 72(%esp) + orl %ecx, %edx + je ..B3.25 +..B3.12: + movl 192(%esp), %edx + movl %ecx, %edi + negl %edi + addl $64, %edi + movl 20(%edx), %ebp + cmpl $31, %ecx + movl %edi, 44(%esp) + movl 16(%edx), %edi + movl %ebp, 32(%esp) + jbe ..B3.14 +..B3.13: + movl %edi, %edx + xorl %ebp, %ebp + shll %cl, %edx + jmp ..B3.15 +..B3.14: + movl %edi, %ebp + movl 32(%esp), %edx + shldl %cl, %edi, %edx + shll %cl, %ebp +..B3.15: + movl 192(%esp), %eax + cmpl $31, %ecx + movl %ebp, 16(%eax) + movl 12(%eax), %ebp + movl %edx, 20(%eax) + movl 8(%eax), %edx + movl %ebp, 40(%esp) + jbe ..B3.17 +..B3.16: + movl %edx, %ebp + movl $0, 48(%esp) + shll %cl, %ebp + jmp ..B3.18 +..B3.17: + movl %edx, %eax + shll %cl, %eax + shldl %cl, %edx, %ebp + movl %eax, 48(%esp) +..B3.18: + cmpl $31, 44(%esp) + jbe ..B3.20 +..B3.19: + movl 44(%esp), %ecx + movl 32(%esp), %edi + movl $0, 36(%esp) + shrl %cl, %edi + jmp ..B3.21 +..B3.20: + movl 44(%esp), %ecx + movl 32(%esp), %eax + shrdl %cl, %eax, %edi + shrl %cl, %eax + movl %eax, 36(%esp) +..B3.21: + movl 48(%esp), %eax + orl %edi, %eax + movl 192(%esp), %edi + orl 36(%esp), %ebp + cmpl $31, 44(%esp) + movl %eax, 8(%edi) + movl %ebp, 12(%edi) + jbe ..B3.23 +..B3.22: + xorl %ebp, %ebp + movl 40(%esp), %edx + shrl %cl, %edx + jmp ..B3.26 +..B3.23: + movl 40(%esp), %ebp + shrdl %cl, %ebp, %edx + shrl %cl, %ebp + jmp ..B3.26 +..B3.25: + xorl %edx, %edx + xorl %ebp, %ebp +..B3.26: + movl 192(%esp), %edi + movl %edx, (%edi) + movl 72(%esp), %edx + movl %ebp, 4(%edi) + movl 8(%edi,%edx,8), %eax + movl 12(%edi,%edx,8), %edi + movl %edi, %ebp + shrl $20, %ebp + xorl %edx, %edx + movl %ebp, 48(%esp) + movl %esi, %ebp + subl %edx, %ebp + jl ..B3.59 +..B3.27: + movl 72(%esp), %eax + addl $1, %eax + movl %eax, 52(%esp) + adcl $0, %esi + movl %esi, %ebp + testl %ebp, %ebp + jge ..B3.29 +..B3.28: + addl $1, %eax + adcl $0, %ebp +..B3.29: + shrdl $1, %ebp, %eax + sarl $1, %ebp + xorl %edi, %edi + movl %ebp, %ecx + movl %edi, 44(%esp) + subl %edi, %ecx + movl %edi, 40(%esp) + jb ..B3.229 +..B3.262: + orl %eax, %ecx + je ..B3.229 +..B3.30: + xorl %ecx, %ecx + movl %ecx, 80(%esp) + movl %ecx, 76(%esp) + movl %ebp, 92(%esp) + movl %eax, 88(%esp) + movl %edi, 84(%esp) + movl %ebx, 32(%esp) + movl %esi, 36(%esp) + movl %edi, 100(%esp) + movl 44(%esp), %ecx + movl 40(%esp), %eax + movl 48(%esp), %ebp +..B3.31: + movl 72(%esp), %edi + movl 80(%esp), %ebx + movl 192(%esp), %esi + addl %edi, %ebx + movl %ebx, 96(%esp) + movl (%esi,%ebx,8), %edi + movl %edi, 116(%esp) + movl 4(%esi,%ebx,8), %edi + movl %edi, 104(%esp) + xorl %edi, %edi + movl %edi, (%esi,%ebx,8) + movl %edi, 4(%esi,%ebx,8) + movl %ecx, %esi + movl 116(%esp), %ebx + orl %eax, %esi + je ..B3.39 +..B3.32: + cmpl $31, %ecx + jbe ..B3.34 +..B3.33: + xorl %esi, %esi + jmp ..B3.35 +..B3.34: + movl %ebx, %esi + shll %cl, %esi +..B3.35: + andl $4095, %esi + xorl %edi, %edi + addl %esi, %ebp + adcl $0, %edx + movl $12, %esi + subl %ecx, %esi + sbbl %eax, %edi + movl %edi, 56(%esp) + cmpl $31, %esi + jbe ..B3.37 +..B3.36: + movl %esi, %ecx + xorl %eax, %eax + movl 104(%esp), %ebx + shrl %cl, %ebx + jmp ..B3.38 +..B3.37: + movl %esi, %ecx + movl 104(%esp), %eax + shrdl %cl, %eax, %ebx + shrl %cl, %eax +..B3.38: + movl %eax, 104(%esp) + xorl %eax, %eax + xorl %ecx, %ecx + subl %esi, %ecx + sbbl 56(%esp), %eax +..B3.39: + movl 104(%esp), %edi + movl %edi, %esi + shrl $28, %edi + andl $268435455, %esi + addl %edi, %ebx + adcl $0, %esi + addl %ebp, %ebx + adcl %edx, %esi + addl $4, %ecx + movl %esi, 112(%esp) + movl 192(%esp), %esi + adcl $0, %eax + movl 96(%esp), %edx + movl -4(%esi,%edx,8), %edi + movl -8(%esi,%edx,8), %ebp + movl %edi, 108(%esp) + xorl %edi, %edi + movl %edi, -8(%esi,%edx,8) + movl %edi, -4(%esi,%edx,8) + movl %ecx, %edx + orl %eax, %edx + je ..B3.47 +..B3.40: + cmpl $31, %ecx + jbe ..B3.42 +..B3.41: + movl $0, 64(%esp) + jmp ..B3.43 +..B3.42: + movl %ebp, %edx + shll %cl, %edx + movl %edx, 64(%esp) +..B3.43: + movl 64(%esp), %edx + xorl %esi, %esi + andl $4095, %edx + addl %edx, %ebx + adcl $0, 112(%esp) + movl $12, %edx + subl %ecx, %edx + sbbl %eax, %esi + movl %esi, 60(%esp) + cmpl $31, %edx + jbe ..B3.45 +..B3.44: + movl %edx, %ecx + xorl %eax, %eax + movl 108(%esp), %ebp + shrl %cl, %ebp + jmp ..B3.46 +..B3.45: + movl %edx, %ecx + movl 108(%esp), %eax + shrdl %cl, %eax, %ebp + shrl %cl, %eax +..B3.46: + movl %eax, 108(%esp) + xorl %eax, %eax + xorl %ecx, %ecx + subl %edx, %ecx + sbbl 60(%esp), %eax +..B3.47: + movl 108(%esp), %esi + movl %esi, %edx + shrl $28, %esi + andl $268435455, %edx + addl %esi, %ebp + movl 84(%esp), %edi + adcl $0, %edx + addl %ebx, %ebp + movl 100(%esp), %ebx + adcl 112(%esp), %edx + addl $4, %ecx + adcl $0, %eax + addl $-2, 80(%esp) + adcl $-1, 76(%esp) + addl $1, %ebx + movl %ebx, 100(%esp) + adcl $0, %edi + subl 88(%esp), %ebx + movl %edi, 84(%esp) + sbbl 92(%esp), %edi + jb ..B3.31 +..B3.48: + movl 100(%esp), %edi + movl %eax, 40(%esp) + movl %edi, %eax + movl %ebp, 48(%esp) + addl %edi, %edi + movl 84(%esp), %ebp + shrl $31, %eax + addl %ebp, %ebp + orl %ebp, %eax + addl $1, %edi + movl 32(%esp), %ebx + movl 36(%esp), %esi + adcl $0, %eax + movl %ecx, 44(%esp) +..B3.49: + movl %edi, %ebp + addl $-1, %ebp + adcl $-1, %eax + subl %ebp, 52(%esp) + sbbl %eax, %esi + jb ..B3.228 +..B3.263: + movl 52(%esp), %ebp + orl %esi, %ebp + je ..B3.228 +..B3.50: + negl %edi + xorl %esi, %esi + addl 72(%esp), %edi + movl 192(%esp), %eax + movl 8(%eax,%edi,8), %ebp + movl %ebp, 32(%esp) + movl 12(%eax,%edi,8), %ebp + movl %esi, 8(%eax,%edi,8) + movl %esi, 12(%eax,%edi,8) + movl 40(%esp), %edi + orl 44(%esp), %edi + je ..B3.58 +..B3.51: + cmpl $31, 44(%esp) + ja ..B3.54 +..B3.53: + movl 44(%esp), %ecx + movl 32(%esp), %esi + shll %cl, %esi +..B3.54: + andl $4095, %esi + addl %esi, 48(%esp) + movl 44(%esp), %esi + adcl $0, %edx + negl %esi + addl $12, %esi + movl %esi, 44(%esp) + cmpl $31, %esi + jbe ..B3.56 +..B3.55: + movl %esi, %ecx + xorl %esi, %esi + shrl %cl, %ebp + movl %ebp, 32(%esp) + jmp ..B3.57 +..B3.56: + movl %esi, %ecx + movl 32(%esp), %esi + shrdl %cl, %ebp, %esi + movl %esi, 32(%esp) + movl %ebp, %esi + shrl %cl, %esi +..B3.57: + movl %esi, %ebp +..B3.58: + movl %ebp, %edi + shrl $28, %ebp + andl $268435455, %edi + movl 32(%esp), %esi + addl %ebp, %esi + movl 192(%esp), %ebp + adcl $0, %edi + addl %esi, 48(%esp) + movl 72(%esp), %esi + adcl %edi, %edx + movl 8(%ebp,%esi,8), %eax + movl 12(%ebp,%esi,8), %edi +..B3.59: + movl %edx, %esi + movl 48(%esp), %ebp + shll $20, %esi + shrl $12, %ebp + orl %ebp, %esi + shrl $12, %edx + movl %esi, %ebp + orl %edx, %ebp + je ..B3.63 +..B3.60: + movl 48(%esp), %ebp +..B3.61: + andl $4095, %ebp + addl %esi, %ebp + movl %ebp, %ecx + adcl $0, %edx + movl %edx, %esi + shll $20, %esi + shrl $12, %ecx + orl %ecx, %esi + shrl $12, %edx + movl %esi, %ecx + orl %edx, %ecx + jne ..B3.61 +..B3.62: + movl %ebp, 48(%esp) +..B3.63: + addl $12, %esp + xorl %ebp, %ebp + pushl %ebp + pushl %ebp + movl 188(%esp), %edx + andl $1048575, %edi + pushl %edx + movl 48(%esp), %esi + shll $20, %esi + orl %esi, %edi + movl 72(%esp), %esi + movl %ebx, 4(%edx) + movl %eax, 8(%edx,%esi,8) + movl %edi, 12(%edx,%esi,8) + call __dpml_ffs_and_shift__ +..B3.64: + subl %eax, %ebx +..B3.65: + movl %ebx, %eax + addl $-5, %ebx + cltd + movl 192(%esp), %esi + adcl $-1, %edx + xorl %edi, %edi + subl %edi, %edx + movl %edi, (%esi) + movl 8(%esi), %ebp + movl 12(%esi), %esi + jl ..B3.70 +..B3.264: + orl %ebx, %edx + je ..B3.70 +..B3.66: + movl 148(%esp), %edi + movl %ebp, %eax + mull 256+__trig_x_table@GOTOFF(%edi) + movl %ebp, %eax + movl 260+__trig_x_table@GOTOFF(%edi), %ecx + movl %edx, %edi + mull %ecx + movl %ecx, 32(%esp) + movl %edx, %ecx + movl 148(%esp), %edx + addl %eax, %edi + adcl $0, %ecx + movl 256+__trig_x_table@GOTOFF(%edx), %eax + mull %esi + addl %edi, %eax + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 36(%esp) + sbbl %ecx, %edx + jae ..B3.68 +..B3.67: + movl $1, 44(%esp) + jmp ..B3.69 +..B3.68: + movl $0, 44(%esp) +..B3.69: + movl 32(%esp), %eax + mull %esi + movl 44(%esp), %edi + addl %edx, %edi + addl 36(%esp), %eax + movl %eax, 40(%esp) + adcl $0, %edi + movl %edi, 44(%esp) + jmp ..B3.71 +..B3.70: + xorl %edx, %edx + movl $1, %ebx + movl %edx, 40(%esp) + movl %edx, 44(%esp) +..B3.71: + negl %ebx + movl 196(%esp), %eax + andl $1, %eax + incl %eax + lea 64(%ebx), %edx + addl $63, %ebx + movl %edx, 32(%esp) + cmpl $31, %ebx + jbe ..B3.73 +..B3.72: + movl %ebx, %ecx + movl %eax, %edi + shll %cl, %edi + xorl %edx, %edx + jmp ..B3.74 +..B3.73: + movl %ebx, %ecx + xorl %edi, %edi + movl %eax, %edx + shldl %cl, %eax, %edi + shll %cl, %edx +..B3.74: + addl 40(%esp), %edx + adcl 44(%esp), %edi + cmpl $31, 32(%esp) + jbe ..B3.76 +..B3.75: + movl $1, %ebx + xorl %eax, %eax + movl 32(%esp), %ecx + shll %cl, %ebx + jmp ..B3.77 +..B3.76: + xorl %ebx, %ebx + movl $1, %eax + movl 32(%esp), %ecx + shldl %cl, %eax, %ebx + shll %cl, %eax +..B3.77: + addl $-1, %eax + notl %eax + adcl $-1, %ebx + andl %eax, %edx + notl %ebx + andl %ebx, %edi + cmpl $31, 32(%esp) + jbe ..B3.79 +..B3.78: + movl %edi, %eax + shrl %cl, %eax + jmp ..B3.80 +..B3.79: + movl %edx, %eax + shrdl %cl, %edi, %eax +..B3.80: + movl %eax, %ebx + negl %ebx + cmpl $0, 68(%esp) + jne ..L10 + movl %eax, %ebx +..L10: + movl 196(%esp), %eax + shrl $1, %eax + addl %ebx, %eax + movl %eax, 44(%esp) + movl $-1275068416, %eax + mull %edx + movl $-1275068416, %eax + movl %edx, %ecx + mull %edi + movl %edx, %ebx + movl %esi, %edi + movl %ebp, %edx + addl %ecx, %eax + adcl $0, %ebx + andl $3, %ebp + shll $30, %edi + shrl $2, %edx + orl %edx, %edi + shrl $2, %esi + subl %eax, %edi + sbbl %ebx, %esi + movl %edi, %ebx + shll $2, %edi + shrl $30, %ebx + orl %edi, %ebp + xorl %edi, %edi + lea (,%esi,4), %ecx + orl %ecx, %ebx + subl %edi, %esi + jl ..B3.224 +..B3.81: + addl $12, %esp + xorl %eax, %eax + pushl %eax + pushl %eax + movl 188(%esp), %edx + pushl %edx + movl %ebp, 8(%edx) + movl %ebx, 12(%edx) + call __dpml_ffs_and_shift__ +..B3.82: + movl 192(%esp), %ebp + xorl %ebx, %ebx + movl 8(%ebp), %esi + movl %esi, %eax + movl 4(%ebp), %ecx + movl 12(%ebp), %ebp + orl %ebp, %eax + jne ..B3.85 +..B3.83: + movl 44(%esp), %edx + xorl %eax, %eax + andl $2, %edx + movl $536870912, %ebx + orl %eax, %edx + je ..B3.101 +..B3.84: + movl 192(%esp), %eax + xorl $-2147483648, (%eax) + jmp ..B3.101 +..B3.85: + cmpl $5, %ecx + jl ..B3.100 +..B3.86: + movl 192(%esp), %eax + movl 16(%eax), %edx + orl 20(%eax), %edx + jne ..B3.100 +..B3.87: + negl %ecx + addl $64, %ecx + cmpl $31, %ecx + jbe ..B3.89 +..B3.88: + movl %ebp, %edx + movl $0, 32(%esp) + shrl %cl, %edx + jmp ..B3.90 +..B3.89: + movl %ebp, %eax + movl %esi, %edx + shrl %cl, %eax + shrdl %cl, %ebp, %edx + movl %eax, 32(%esp) +..B3.90: + cmpl $31, %ecx + jbe ..B3.92 +..B3.91: + movl %edx, %eax + movl $0, 36(%esp) + shll %cl, %eax + jmp ..B3.93 +..B3.92: + movl %edx, %edi + movl 32(%esp), %eax + shll %cl, %edi + shldl %cl, %edx, %eax + movl %edi, 36(%esp) +..B3.93: + subl 36(%esp), %esi + subl %eax, %ebp + orl %ebp, %esi + jne ..B3.100 +..B3.94: + movl $30, %eax + negl %eax + addl %edx, %eax + orl 32(%esp), %eax + jne ..B3.98 +..B3.95: + movl 44(%esp), %edx + xorl %eax, %eax + andl $1, %edx + orl %eax, %edx + jne ..B3.100 +..B3.96: + movl 192(%esp), %edx + movl $1073741824, %ebx + movl 68(%esp), %eax + xorl %eax, (%edx) + jmp ..B3.101 +..B3.98: + movl $45, %eax + subl %eax, %edx + orl 32(%esp), %edx + jne ..B3.100 +..B3.99: + movl $-2147483648, %ebx +..B3.100: + movl 192(%esp), %edx + movl 68(%esp), %eax + xorl %eax, (%edx) +..B3.101: + addl $12, %esp + lea 36(%esp), %eax + pushl %eax + movl 100(%eax), %edx + lea 216+__trig_x_table@GOTOFF(%edx), %ecx + pushl %ecx + pushl 188(%esp) + call __dpml_multiply__ +..B3.103: + movl 204(%esp), %esi + movl $3, %eax + andl $-17, %esi + movl %esi, %edx + subl %eax, %edx + orl 208(%esp), %edx + jne ..B3.106 +..B3.105: + movl $1, %eax +..B3.106: + sarl $29, %ebx + andl %eax, %ebx + xorl %eax, %eax + orl %eax, %ebx + jne ..B3.108 +..B3.107: + movl $1, %ebp + jmp ..B3.109 +..B3.108: + xorl %ebp, %ebp +..B3.109: + movl %esi, %ecx + movl $3, %edx + subl %edx, %ecx + movl 44(%esp), %ebx + andl $1, %ebx + orl 208(%esp), %ecx + je ..B3.220 +..B3.110: + xorl %edx, %edx + orl %edx, %ebx + je ..B3.112 +..B3.111: + movl $1216, %ecx + jmp ..B3.113 +..B3.112: + movl $1038, %ecx +..B3.113: + addl $28, %esp + xorl %edx, %edx + movl 184(%esp), %ebx + pushl %ebx + pushl %edx + pushl %ecx + pushl %edx + pushl $13 + movl 140(%esp), %ecx + lea 272+__trig_x_table@GOTOFF(%ecx), %edi + pushl %edi + lea 44(%esp), %edx + pushl %edx + call __dpml_evaluate_rational__ +..B3.114: + movl 44(%esp), %ecx + xorl %edx, %edx + andl $2, %ecx + orl %edx, %ecx + je ..B3.116 +..B3.115: + xorl $-2147483648, (%ebx) +..B3.116: + movl $3, %edx + subl %edx, %esi + orl 208(%esp), %esi + je ..B3.216 +..B3.117: + movl 156(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B3.215 +..B3.118: + movl %ebp, %eax + xorl %edx, %edx + addl $172, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B3.119: + movl 192(%esp), %ebp + movl 8(%ebp), %eax + movl 12(%ebp), %edx + movl 16(%ebp), %ecx + movl 20(%ebp), %ebx + movl 4(%ebp), %edi + testl %edi, %edi + movl (%ebp), %esi + movl %eax, 104(%esp) + movl %edx, 100(%esp) + movl %ecx, 108(%esp) + movl %ebx, 112(%esp) + movl %edi, 128(%esp) + movl %esi, 76(%esp) + jl ..B3.253 +..B3.120: + movl %edi, %eax + cltd + addl $8, %eax + movl %eax, %edi + adcl $0, %edx + andl $63, %eax + movl 148(%esp), %ebp + shll $26, %edx + shrl $6, %edi + orl %edx, %edi + movl __four_over_pi@GOT(%ebp), %esi + movl %edi, 72(%esp) + movl %eax, 128(%esp) + lea (%esi,%edi,8), %ecx + movl (%ecx), %ebx + movl 4(%ecx), %ebp + movl 8(%ecx), %esi + movl 12(%ecx), %edi + movl 20(%ecx), %edx + movl %ebx, 60(%esp) + movl %ebp, 56(%esp) + movl %esi, 68(%esp) + movl %edi, 64(%esp) + movl %edx, 32(%esp) + movl 16(%ecx), %ebp + movl 24(%ecx), %edi + movl 28(%ecx), %esi + movl 32(%ecx), %ebx + movl 36(%ecx), %edx + addl $40, %ecx + movl %ecx, 120(%esp) + xorl %ecx, %ecx + movl %ebx, 116(%esp) + orl %eax, %ecx + movl %edx, 124(%esp) + je ..B3.146 +..B3.121: + movl %eax, %ecx + movl %ecx, %edx + negl %edx + addl $64, %edx + movl %edx, 72(%esp) + cmpl $31, %ecx + jbe ..B3.123 +..B3.122: + xorl %eax, %eax + movl 60(%esp), %edx + shll %cl, %edx + movl %edx, 56(%esp) + jmp ..B3.124 +..B3.123: + movl 56(%esp), %edx + movl 60(%esp), %eax + shldl %cl, %eax, %edx + movl %edx, 56(%esp) + shll %cl, %eax +..B3.124: + cmpl $31, 72(%esp) + jbe ..B3.126 +..B3.125: + movl 72(%esp), %ecx + xorl %edx, %edx + movl 64(%esp), %ebx + shrl %cl, %ebx + movl %ebx, 60(%esp) + jmp ..B3.127 +..B3.126: + movl 72(%esp), %ecx + movl 68(%esp), %ebx + movl 64(%esp), %edx + shrdl %cl, %edx, %ebx + movl %ebx, 60(%esp) + shrl %cl, %edx +..B3.127: + orl %eax, 60(%esp) + orl %edx, 56(%esp) + cmpl $31, 128(%esp) + jbe ..B3.129 +..B3.128: + movl 128(%esp), %ecx + xorl %eax, %eax + movl 68(%esp), %edx + shll %cl, %edx + movl %edx, 64(%esp) + jmp ..B3.130 +..B3.129: + movl 128(%esp), %ecx + movl 64(%esp), %edx + movl 68(%esp), %eax + shldl %cl, %eax, %edx + movl %edx, 64(%esp) + shll %cl, %eax +..B3.130: + cmpl $31, 72(%esp) + jbe ..B3.132 +..B3.131: + movl 72(%esp), %ecx + xorl %edx, %edx + movl 32(%esp), %ebx + shrl %cl, %ebx + movl %ebx, 68(%esp) + jmp ..B3.133 +..B3.132: + movl %ebp, %ebx + movl 72(%esp), %ecx + movl 32(%esp), %edx + shrdl %cl, %edx, %ebx + movl %ebx, 68(%esp) + shrl %cl, %edx +..B3.133: + orl %eax, 68(%esp) + orl %edx, 64(%esp) + cmpl $31, 128(%esp) + jbe ..B3.135 +..B3.134: + movl 128(%esp), %ecx + xorl %edx, %edx + shll %cl, %ebp + movl %ebp, 32(%esp) + jmp ..B3.136 +..B3.135: + movl 128(%esp), %ecx + movl 32(%esp), %edx + shldl %cl, %ebp, %edx + movl %edx, 32(%esp) + movl %ebp, %edx + shll %cl, %edx +..B3.136: + cmpl $31, 72(%esp) + jbe ..B3.138 +..B3.137: + movl %esi, %ebp + xorl %ebx, %ebx + movl 72(%esp), %ecx + shrl %cl, %ebp + jmp ..B3.139 +..B3.138: + movl %edi, %ebp + movl %esi, %ebx + movl 72(%esp), %ecx + shrdl %cl, %esi, %ebp + shrl %cl, %ebx +..B3.139: + orl %ebx, 32(%esp) + orl %edx, %ebp + cmpl $31, 128(%esp) + jbe ..B3.141 +..B3.140: + movl %edi, %esi + xorl %edx, %edx + movl 128(%esp), %ecx + shll %cl, %esi + jmp ..B3.142 +..B3.141: + movl %edi, %edx + movl 128(%esp), %ecx + shldl %cl, %edi, %esi + shll %cl, %edx +..B3.142: + cmpl $31, 72(%esp) + jbe ..B3.144 +..B3.143: + movl 72(%esp), %ecx + xorl %ebx, %ebx + movl 124(%esp), %edi + shrl %cl, %edi + jmp ..B3.145 +..B3.144: + movl 72(%esp), %ecx + movl 116(%esp), %edi + movl 124(%esp), %ebx + shrdl %cl, %ebx, %edi + shrl %cl, %ebx +..B3.145: + orl %edx, %edi + orl %ebx, %esi +..B3.146: + movl %edi, %eax + mull 108(%esp) + movl %edi, %eax + movl %edx, %ecx + mull 112(%esp) + addl %eax, %ecx + movl %edx, %ebx + movl 108(%esp), %eax + adcl $0, %ebx + mull %esi + addl %ecx, %eax + adcl %ebx, %edx + subl %ecx, %eax + movl %edx, 48(%esp) + sbbl %ebx, %edx + jae ..B3.148 +..B3.147: + movl $1, %ebx + jmp ..B3.149 +..B3.148: + xorl %ebx, %ebx +..B3.149: + movl %esi, %eax + movl 112(%esp), %ecx + mull %ecx + addl %edx, %ebx + addl 48(%esp), %eax + movl %eax, 84(%esp) + adcl $0, %ebx + movl %ebx, 88(%esp) + movl %esi, %ebx + movl 108(%esp), %eax + imull %edi, %ecx + imull %eax, %ebx + mull %edi + addl %ebx, %ecx + movl 100(%esp), %ebx + addl %ecx, %edx + movl %ebp, 52(%esp) + movl %esi, %ebp + movl %edx, 96(%esp) + movl %ebx, %edx + movl 104(%esp), %ecx + imull %ecx, %ebp + imull %edi, %edx + movl %eax, 92(%esp) + movl %edi, %eax + addl %edx, %ebp + mull %ecx + movl %eax, 36(%esp) + movl %edi, %eax + addl %ebp, %edx + movl %edx, 40(%esp) + mull %ecx + movl %edi, %eax + movl %edx, %ebp + mull %ebx + addl %eax, %ebp + movl %ecx, %eax + movl %edx, %edi + adcl $0, %edi + mull %esi + addl %ebp, %eax + movl 88(%esp), %ebx + adcl %edi, %edx + subl %ebp, %eax + movl %edx, 44(%esp) + movl 52(%esp), %ebp + sbbl %edi, %edx + jae ..B3.151 +..B3.150: + movl $1, %ecx + jmp ..B3.152 +..B3.151: + xorl %ecx, %ecx +..B3.152: + movl %esi, %eax + mull 100(%esp) + movl %eax, %esi + addl %edx, %ecx + addl 44(%esp), %esi + movl 36(%esp), %edi + movl 84(%esp), %eax + adcl $0, %ecx + addl %edi, %eax + movl 40(%esp), %edx + adcl %edx, %ebx + movl %eax, 84(%esp) + subl %edi, %eax + movl %ebx, %edi + sbbl %edx, %edi + jae ..B3.154 +..B3.153: + movl $1, %edx + jmp ..B3.155 +..B3.154: + xorl %edx, %edx +..B3.155: + addl %edx, %esi + movl %esi, 80(%esp) + adcl $0, %ecx + movl %ecx, 132(%esp) + movl 112(%esp), %ecx + movl %ecx, %edi + movl 32(%esp), %esi + movl %esi, %edx + movl %ebx, 88(%esp) + movl 108(%esp), %ebx + movl %ebx, %eax + imull %ebp, %edi + imull %ebx, %edx + addl %edx, %edi + mull %ebp + movl %eax, 40(%esp) + movl %ebx, %eax + addl %edi, %edx + movl %edx, 44(%esp) + mull %ebp + movl %ebp, %eax + movl %edx, %edi + mull %ecx + addl %eax, %edi + movl %ebx, %eax + movl %edx, %ecx + adcl $0, %ecx + mull %esi + addl %edi, %eax + movl 80(%esp), %esi + adcl %ecx, %edx + subl %edi, %eax + movl %edx, 48(%esp) + movl 88(%esp), %ebx + sbbl %ecx, %edx + movl 132(%esp), %ecx + jae ..B3.157 +..B3.156: + movl $1, %edi + jmp ..B3.158 +..B3.157: + xorl %edi, %edi +..B3.158: + movl 32(%esp), %eax + mull 112(%esp) + addl %edx, %edi + addl 48(%esp), %eax + movl %eax, 36(%esp) + adcl $0, %edi + movl %edi, 52(%esp) + movl 40(%esp), %edi + movl 84(%esp), %eax + addl %edi, %eax + movl 44(%esp), %edx + adcl %edx, %ebx + movl %eax, 84(%esp) + subl %edi, %eax + movl %ebx, %edi + sbbl %edx, %edi + movl 52(%esp), %edi + jae ..B3.160 +..B3.159: + movl $1, 40(%esp) + jmp ..B3.161 +..B3.160: + movl $0, 40(%esp) +..B3.161: + movl 40(%esp), %edx + addl %edx, %esi + movl %esi, %eax + adcl $0, %ecx + subl %edx, %eax + movl $0, %edx + movl %ecx, %eax + sbbl %edx, %eax + jae ..B3.163 +..B3.162: + movl $1, 48(%esp) + jmp ..B3.164 +..B3.163: + movl $0, 48(%esp) +..B3.164: + movl 36(%esp), %edx + addl %edx, %esi + movl %esi, %eax + adcl %edi, %ecx + subl %edx, %eax + movl %ecx, %edx + sbbl %edi, %edx + jae ..B3.166 +..B3.165: + movl $1, %edx + jmp ..B3.167 +..B3.166: + xorl %edx, %edx +..B3.167: + movl %esi, 80(%esp) + movl %ecx, 132(%esp) + movl 100(%esp), %ecx + movl %ecx, %edi + movl 32(%esp), %esi + addl %edx, 48(%esp) + movl %esi, %edx + movl %ebx, 88(%esp) + movl 104(%esp), %ebx + movl %ebx, %eax + imull %ebp, %edi + imull %ebx, %edx + addl %edx, %edi + mull %ebp + movl %eax, 36(%esp) + movl %ebx, %eax + addl %edi, %edx + movl %edx, 40(%esp) + mull %ebp + movl %ebp, %eax + movl %edx, %edi + mull %ecx + addl %eax, %edi + movl %ebx, %eax + movl %edx, %ebp + adcl $0, %ebp + mull %esi + addl %edi, %eax + movl 132(%esp), %ecx + adcl %ebp, %edx + subl %edi, %eax + movl %edx, 44(%esp) + movl 80(%esp), %esi + sbbl %ebp, %edx + movl 88(%esp), %ebx + jae ..B3.169 +..B3.168: + movl $1, %ebp + jmp ..B3.170 +..B3.169: + xorl %ebp, %ebp +..B3.170: + movl 32(%esp), %eax + mull 100(%esp) + addl %edx, %ebp + addl 44(%esp), %eax + movl 36(%esp), %edi + adcl $0, %ebp + addl %edi, %esi + movl %esi, %edx + adcl 40(%esp), %ecx + subl %edi, %edx + movl %ecx, %edi + sbbl 40(%esp), %edi + jae ..B3.172 +..B3.171: + movl $1, %edx + jmp ..B3.173 +..B3.172: + xorl %edx, %edx +..B3.173: + movl %ebx, 88(%esp) + movl 48(%esp), %ebx + addl %eax, %ebx + movl %esi, 80(%esp) + adcl $0, %ebp + addl %edx, %ebx + movl %ecx, 132(%esp) + movl 112(%esp), %ecx + movl %ecx, %edi + movl 64(%esp), %esi + movl %esi, %edx + adcl $0, %ebp + movl %ebx, 48(%esp) + movl %ebp, 44(%esp) + movl 68(%esp), %ebp + movl 108(%esp), %ebx + movl %ebx, %eax + imull %ebp, %edi + imull %ebx, %edx + addl %edx, %edi + mull %ebp + movl %eax, 32(%esp) + movl %ebx, %eax + addl %edi, %edx + movl %edx, 36(%esp) + mull %ebp + movl %ebp, %eax + movl %edx, %edi + mull %ecx + addl %eax, %edi + movl %ebx, %eax + movl %edx, %ebp + adcl $0, %ebp + mull %esi + addl %edi, %eax + movl 132(%esp), %ecx + adcl %ebp, %edx + subl %edi, %eax + movl %edx, 40(%esp) + movl 80(%esp), %esi + sbbl %ebp, %edx + movl 44(%esp), %ebp + movl 88(%esp), %ebx + jae ..B3.175 +..B3.174: + movl $1, 52(%esp) + jmp ..B3.176 +..B3.175: + movl $0, 52(%esp) +..B3.176: + movl 64(%esp), %eax + mull 112(%esp) + movl 52(%esp), %edi + addl %edx, %edi + addl 40(%esp), %eax + movl %eax, 44(%esp) + movl 32(%esp), %eax + adcl $0, %edi + addl %eax, %esi + movl %esi, %edx + movl %edi, 52(%esp) + movl 36(%esp), %edi + adcl %edi, %ecx + subl %eax, %edx + movl %ecx, %eax + sbbl %edi, %eax + jae ..B3.178 +..B3.177: + movl $1, 32(%esp) + jmp ..B3.179 +..B3.178: + movl $0, 32(%esp) +..B3.179: + movl %esi, 80(%esp) + movl 100(%esp), %edi + movl 68(%esp), %esi + movl 104(%esp), %eax + movl 64(%esp), %edx + imull %esi, %edi + imull %eax, %edx + addl %edx, %edi + mull %esi + movl %ecx, 132(%esp) + movl %eax, %ecx + movl %edx, %esi + addl %edi, %esi + addl 48(%esp), %ecx + movl 60(%esp), %edi + movl 56(%esp), %edx + adcl %ebp, %esi + movl 112(%esp), %ebp + movl 108(%esp), %eax + imull %edi, %ebp + imull %eax, %edx + addl %edx, %ebp + mull %edi + addl 44(%esp), %ecx + adcl 52(%esp), %esi + addl %ebp, %edx + addl 32(%esp), %ecx + adcl $0, %esi + addl %ecx, %eax + movl 196(%esp), %ecx + movl %ecx, %ebp + adcl %esi, %edx + negl %ebp + cmpl $0, 76(%esp) + movl %eax, 136(%esp) + jne ..L11 + movl %ecx, %ebp +..L11: + xorl %eax, %eax + shll $29, %ebp + addl %ebp, %edx + movl %eax, 40(%esp) + movl 84(%esp), %ebp + movl %edx, 152(%esp) + movl %eax, 36(%esp) + jmp ..B3.180 +..B3.214: + addl $64, 40(%esp) + movl 152(%esp), %ecx + movl 132(%esp), %edx + movl 80(%esp), %eax + movl 32(%esp), %esi + movl 44(%esp), %edi + movl %ebp, 80(%esp) + movl %ebx, 132(%esp) + movl 92(%esp), %ebp + movl 96(%esp), %ebx + adcl $0, 36(%esp) + andl $-536870912, %ecx + andl $536870911, %edx + orl %edx, %ecx + movl %eax, 136(%esp) + movl %ecx, 152(%esp) + movl %esi, 92(%esp) + movl %edi, 96(%esp) +..B3.180: + movl 152(%esp), %eax + xorl %edx, %edx + lea 4194304(%eax), %ecx + andl $1065353216, %ecx + orl %edx, %ecx + jne ..B3.252 +..B3.181: + movl 120(%esp), %eax + movl 116(%esp), %esi + movl 124(%esp), %edi + movl (%eax), %edx + movl %edx, 116(%esp) + xorl %edx, %edx + movl 4(%eax), %ecx + addl $8, %eax + movl %ecx, 124(%esp) + movl %eax, 120(%esp) + orl 128(%esp), %edx + je ..B3.189 +..B3.182: + cmpl $31, 128(%esp) + jbe ..B3.184 +..B3.183: + movl %esi, %edi + xorl %edx, %edx + movl 128(%esp), %ecx + shll %cl, %edi + jmp ..B3.185 +..B3.184: + movl %esi, %edx + movl 128(%esp), %ecx + shldl %cl, %esi, %edi + shll %cl, %edx +..B3.185: + cmpl $31, 72(%esp) + jbe ..B3.187 +..B3.186: + movl 72(%esp), %ecx + xorl %eax, %eax + movl 124(%esp), %esi + shrl %cl, %esi + jmp ..B3.188 +..B3.187: + movl 72(%esp), %ecx + movl 116(%esp), %esi + movl 124(%esp), %eax + shrdl %cl, %eax, %esi + shrl %cl, %eax +..B3.188: + orl %edx, %esi + orl %eax, %edi +..B3.189: + movl 112(%esp), %ecx + movl %edi, %edx + movl %ebx, 88(%esp) + movl %ecx, %ebx + movl %ebp, 84(%esp) + movl 108(%esp), %ebp + movl %ebp, %eax + imull %esi, %ebx + imull %ebp, %edx + addl %edx, %ebx + mull %esi + movl %eax, 32(%esp) + movl %ebp, %eax + addl %ebx, %edx + movl %edx, 44(%esp) + mull %esi + movl %esi, %eax + movl %edx, %ebx + mull %ecx + addl %eax, %ebx + movl %ebp, %eax + movl %edx, %ecx + adcl $0, %ecx + mull %edi + addl %ebx, %eax + movl 84(%esp), %ebp + adcl %ecx, %edx + subl %ebx, %eax + movl %edx, 56(%esp) + movl 88(%esp), %ebx + sbbl %ecx, %edx + jae ..B3.191 +..B3.190: + movl $1, %ecx + jmp ..B3.192 +..B3.191: + xorl %ecx, %ecx +..B3.192: + movl 112(%esp), %eax + mull %edi + addl %edx, %ecx + addl 56(%esp), %eax + movl 92(%esp), %edx + adcl $0, %ecx + addl %eax, %edx + movl %ebp, 84(%esp) + movl 96(%esp), %ebp + adcl %ecx, %ebp + movl %edx, 92(%esp) + subl %eax, %edx + movl %ebp, 96(%esp) + sbbl %ecx, %ebp + movl 84(%esp), %ebp + jae ..B3.194 +..B3.193: + movl $1, %ecx + jmp ..B3.195 +..B3.194: + xorl %ecx, %ecx +..B3.195: + movl 100(%esp), %edx + addl %ecx, %ebp + movl 104(%esp), %eax + movl %edi, 64(%esp) + adcl $0, %ebx + imull %esi, %edx + imull %eax, %edi + addl %edi, %edx + movl %ebp, %edi + movl %edx, 68(%esp) + mull %esi + addl 68(%esp), %edx + subl %ecx, %edi + movl $0, %ecx + movl %edx, 52(%esp) + movl %ebx, %edx + movl %eax, 48(%esp) + sbbl %ecx, %edx + movl 64(%esp), %edi + jae ..B3.198 +..B3.196: + movl $1, %ecx +..B3.198: + movl 104(%esp), %eax + mull %esi + movl %esi, %eax + movl %ebp, 84(%esp) + movl %edx, %ebp + mull 100(%esp) + addl %eax, %ebp + movl %edx, %esi + movl 104(%esp), %eax + adcl $0, %esi + mull %edi + addl %ebp, %eax + adcl %esi, %edx + subl %ebp, %eax + movl %edx, 60(%esp) + movl 84(%esp), %ebp + sbbl %esi, %edx + jae ..B3.200 +..B3.199: + movl $1, %esi + jmp ..B3.201 +..B3.200: + xorl %esi, %esi +..B3.201: + movl 100(%esp), %eax + mull %edi + addl %edx, %esi + addl 60(%esp), %eax + movl %eax, 140(%esp) + movl 48(%esp), %edx + adcl $0, %esi + movl 92(%esp), %eax + addl %edx, %eax + movl %esi, 144(%esp) + movl 52(%esp), %esi + movl 96(%esp), %edi + adcl %esi, %edi + movl %eax, 92(%esp) + subl %edx, %eax + movl %edi, 96(%esp) + movl 140(%esp), %eax + sbbl %esi, %edi + movl 144(%esp), %esi + jae ..B3.203 +..B3.202: + movl $1, %edx + jmp ..B3.204 +..B3.203: + xorl %edx, %edx +..B3.204: + addl %edx, %ebp + movl %ebp, %edi + adcl $0, %ebx + subl %edx, %edi + movl $0, %edx + movl %ebx, %edi + sbbl %edx, %edi + jae ..B3.207 +..B3.205: + movl $1, %edx +..B3.207: + addl %eax, %ebp + adcl %esi, %ebx + addl %edx, %ecx + movl %ebp, %edx + subl %eax, %edx + movl %ebx, %eax + sbbl %esi, %eax + jae ..B3.209 +..B3.208: + movl $1, %eax + jmp ..B3.210 +..B3.209: + xorl %eax, %eax +..B3.210: + addl %eax, %ecx + xorl %eax, %eax + orl %eax, %ecx + je ..B3.213 +..B3.211: + movl 80(%esp), %eax + addl $1, %eax + movl 132(%esp), %edx + adcl $0, %edx + movl %eax, 80(%esp) + orl %edx, %eax + movl %edx, 132(%esp) + jne ..B3.213 +..B3.212: + addl $1, 136(%esp) + adcl $0, 152(%esp) +..B3.213: + movl 136(%esp), %ecx + movl %ecx, %eax + movl 152(%esp), %esi + shrl $23, %eax + shll $9, %esi + orl %esi, %eax + movl 132(%esp), %edx + movl %eax, %edi + shrl $23, %edx + shll $9, %ecx + sarl $31, %edi + orl %ecx, %edx + xorl %edi, %edx + xorl %edi, %eax + orl %eax, %edx + jne ..B3.230 + jmp ..B3.214 +..B3.215: + movl 148(%esp), %ebx + call __stack_chk_fail@PLT +..B3.216: + movl 32(%ebx), %edx + orl 36(%ebx), %edx + jne ..B3.218 +..B3.217: + movl $0, 24(%ebx) + jmp ..B3.117 +..B3.218: + movl 44(%esp), %ecx + xorl %edx, %edx + incl %ecx + andl $2, %ecx + orl %edx, %ecx + je ..B3.117 +..B3.219: + xorl $-2147483648, 24(%ebx) + jmp ..B3.117 +..B3.220: + xorl %edx, %edx + orl %edx, %ebx + je ..B3.222 +..B3.221: + movl $512, %ecx + jmp ..B3.223 +..B3.222: + xorl %ecx, %ecx +..B3.223: + orl $462, %ecx + jmp ..B3.113 +..B3.224: + movl 192(%esp), %edx + xorl %eax, %eax + xorl $-2147483648, 68(%esp) + movl 16(%edx), %ecx + movl 20(%edx), %esi + xorl %edx, %edx + subl %ecx, %edx + sbbl %esi, %eax + orl %esi, %ecx + je ..B3.226 +..B3.225: + movl $1, %ecx + jmp ..B3.227 +..B3.226: + xorl %ecx, %ecx +..B3.227: + movl 192(%esp), %esi + addl %ecx, %ebp + adcl $0, %ebx + movl %edx, 16(%esi) + xorl %edx, %edx + movl %eax, 20(%esi) + movl %ebp, %eax + xorl %ebp, %ebp + movl %ebx, %ecx + xorl %ebx, %ebx + subl %eax, %ebp + sbbl %ecx, %ebx + jmp ..B3.81 +..B3.228: + movl 72(%esp), %esi + movl 192(%esp), %ebp + movl 8(%ebp,%esi,8), %eax + movl 12(%ebp,%esi,8), %edi + jmp ..B3.59 +..B3.229: + movl $1, %edi + xorl %eax, %eax + jmp ..B3.49 +..B3.230: + movl %ebp, 84(%esp) + movl 132(%esp), %ecx + movl 80(%esp), %esi + movl 152(%esp), %edx +..B3.231: + movl 136(%esp), %edi + lea (,%edx,4), %eax + movl %edi, %ebp + sarl $2, %eax + subl %edi, %ebp + movl %ebp, 32(%esp) + movl %eax, %ebp + sbbl %eax, %edx + sarl $31, %ebp + subl %ebp, %edi + negl %ebp + addl %eax, %ebp + movl %eax, 36(%esp) + orl %ebp, %edi + jne ..B3.233 +..B3.232: + movl %ecx, %eax + movl %ebx, %ecx + movl 92(%esp), %ebx + movl %esi, 136(%esp) + movl 84(%esp), %esi + movl %ebx, 84(%esp) + movl 96(%esp), %ebx + addl $64, 40(%esp) +..B3.233: + xorl %ebp, %ebp + movl 36(%esp), %edi + subl %ebp, %edi + jge ..B3.236 +..B3.235: + movl $-2147483648, %ebp +..B3.236: + testl %ebp, %ebp + je ..B3.244 +..B3.237: + movl 84(%esp), %edi + notl %ebx + notl %edi + notl %eax + addl $1, %edi + notl %esi + movl %edi, 84(%esp) + notl %ecx + adcl $0, %ebx + notl 136(%esp) + orl %ebx, %edi + jne ..B3.239 +..B3.238: + movl $1, %edi + jmp ..B3.240 +..B3.239: + xorl %edi, %edi +..B3.240: + addl %edi, %esi + movl %esi, %edi + adcl $0, %ecx + orl %ecx, %edi + jne ..B3.242 +..B3.241: + movl $1, %edi + jmp ..B3.243 +..B3.242: + xorl %edi, %edi +..B3.243: + addl %edi, 136(%esp) + adcl $0, %eax +..B3.244: + xorl %edi, %edi + movl %ebx, 88(%esp) + xorl %ebx, %ebx + subl 32(%esp), %ebx + movl 76(%esp), %ebx + sbbl %edx, %edi + testl %ebx, %ebx + movl $3, 52(%esp) + jne ..L12 + movl %edx, %edi +..L12: + xorl %ebx, %ebp + movl %ebp, 48(%esp) + movl 136(%esp), %ebp + movl %edi, 44(%esp) + movl %ebp, 56(%esp) + movl %eax, 60(%esp) + movl %esi, 64(%esp) + movl %ecx, 68(%esp) + addl $12, %esp + xorl %ecx, %ecx + lea 36(%esp), %esi + pushl %ecx + pushl %ecx + pushl %esi + movl 40(%esi), %ebx + call __dpml_ffs_and_shift__ +..B3.245: + movl 52(%esp), %eax + movl %eax, %ecx + cltd + addl $-3, %ecx + adcl $-1, %edx + orl %ecx, %edx + je ..B3.250 +..B3.246: + addl $64, %ecx + movl 64(%esp), %esi + cmpl $31, %ecx + movl 68(%esp), %ebp + jbe ..B3.248 +..B3.247: + shrl %cl, %ebx + xorl %edx, %edx + movl %ebx, 84(%esp) + jmp ..B3.249 +..B3.248: + movl 84(%esp), %edx + shrdl %cl, %ebx, %edx + movl %edx, 84(%esp) + movl %ebx, %edx + shrl %cl, %edx +..B3.249: + orl 84(%esp), %esi + orl %edx, %ebp + movl %esi, 64(%esp) + movl %ebp, 68(%esp) +..B3.250: + subl 40(%esp), %eax + movl %eax, 52(%esp) + addl $12, %esp + lea 36(%esp), %ecx + pushl %ecx + movl 100(%ecx), %eax + lea 1008+__trig_x_table@GOTOFF(%eax), %edx + pushl %edx + pushl %ecx + call __dpml_multiply__ +..B3.251: + shrl $30, 44(%esp) + xorl %ebx, %ebx + jmp ..B3.103 +..B3.252: + movl %ebp, 84(%esp) + movl 132(%esp), %ecx + movl 80(%esp), %esi + movl %eax, %edx + jmp ..B3.231 +..B3.253: + movl %esi, %eax + sarl $31, %eax + movl 196(%esp), %ebp + cltd + addl %ebp, %eax + movl %eax, %ebx + adcl 200(%esp), %edx + andl $1, %ebx + addl %ebx, %eax + movl %eax, %ecx + adcl $0, %edx + shrl $1, %ecx + subl %eax, %ebp + movl %ecx, 44(%esp) + movl %edx, %ebx + movl 200(%esp), %ecx + sbbl %edx, %ecx + sarl $1, %ebx + orl %ecx, %ebp + je ..B3.258 +..B3.254: + xorl %eax, %eax + subl %eax, %ecx + jge ..B3.257 +..B3.256: + movl $1, %eax +..B3.257: + addl $20, %esp + lea 28(%esp), %edx + pushl %edx + pushl $0 + pushl %eax + movl 100(%edx), %eax + lea 1008+__trig_x_table@GOTOFF(%eax), %ecx + pushl %ecx + pushl 188(%esp) + call __dpml_addsub__ + jmp ..B3.103 +..B3.258: + movl %esi, %eax + movl %edi, %edx + movl 104(%esp), %ecx + movl 100(%esp), %ebp + movl 108(%esp), %esi + movl 112(%esp), %edi + movl %eax, 48(%esp) + movl %edx, 52(%esp) + movl %ecx, 56(%esp) + movl %ebp, 60(%esp) + movl %esi, 64(%esp) + movl %edi, 68(%esp) + jmp ..B3.103 + .align 16,0x90 + .type __dpml_ux_sincos,@function + .size __dpml_ux_sincos,.-__dpml_ux_sincos + .data +# -- End __dpml_ux_sincos + .section .rodata, "a" + .align 4 + .align 4 +__trig_x_table: + .long 15442952 + .long 1678786816 + .long 15709192 + .long 1414612240 + .long 15975432 + .long 1141915904 + .long 16241672 + .long 873463808 + .long 16507912 + .long 609305872 + .long 16774152 + .long 336592896 + .long 2 + .long 0 + .long 103 + .long 0 + .long 22 + .long 0 + .long 104 + .long 0 + .long 107 + .long 0 + .long 23 + .long 0 + .long 105 + .long 0 + .long 15176712 + .long 336609536 + .long 115 + .long 0 + .long 15176712 + .long 336592896 + .long 118 + .long 0 + .long 15176712 + .long 519700480 + .long 28 + .long 0 + .long 29 + .long 0 + .long 30 + .long 0 + .long 15176712 + .long 528281504 + .long 34 + .long 0 + .long 32 + .long 0 + .long 33 + .long 0 + .long 35 + .long 0 + .long 36 + .long 0 + .long 0 + .long 4294967291 + .long 2498349230 + .long 2398762258 + .long 2491794649 + .long 247854702 + .long 0 + .long 0 + .long 0 + .long 1073676288 + .long 95443718 + .long 1527099483 + .long 1431655766 + .long 357913941 + .long 2657305954 + .long 3 + .long 0 + .long 0 + .long 3705764381 + .long 2553 + .long 0 + .long 0 + .long 138031221 + .long 1532340 + .long 0 + .long 0 + .long 2983678984 + .long 775364077 + .long 0 + .long 0 + .long 20739419 + .long 3530365445 + .long 75 + .long 0 + .long 674366505 + .long 499172021 + .long 25931 + .long 0 + .long 1191312077 + .long 2630803580 + .long 7053263 + .long 0 + .long 2382099329 + .long 2712937970 + .long 1481185358 + .long 0 + .long 2412211635 + .long 2311528398 + .long 3431649258 + .long 53 + .long 3364759590 + .long 865053377 + .long 3819263687 + .long 5917 + .long 1745256079 + .long 2154301056 + .long 109078534 + .long 426088 + .long 286331142 + .long 286331153 + .long 286331153 + .long 17895697 + .long 1431655765 + .long 1431655765 + .long 1431655765 + .long 357913941 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 2851833826 + .long 97 + .long 0 + .long 0 + .long 1768459388 + .long 63846 + .long 0 + .long 0 + .long 2009193996 + .long 35243820 + .long 0 + .long 0 + .long 1368406537 + .long 3397743743 + .long 3 + .long 0 + .long 3946395699 + .long 2652434014 + .long 1440 + .long 0 + .long 2553743692 + .long 4190957063 + .long 440828 + .long 0 + .long 595011843 + .long 807348040 + .long 105798954 + .long 0 + .long 883371940 + .long 908455249 + .long 2075540478 + .long 4 + .long 761938407 + .long 3951975904 + .long 3388403475 + .long 591 + .long 217841633 + .long 3490513104 + .long 13634816 + .long 53261 + .long 3626846480 + .long 2195205506 + .long 763549741 + .long 2982616 + .long 1431655403 + .long 1431655765 + .long 1431655765 + .long 89478485 + .long 4294967292 + .long 4294967295 + .long 4294967295 + .long 1073741823 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2877741414 + .long 48456580 + .long 4555740 + .long 0 + .long 3312728015 + .long 4268104823 + .long 3744444631 + .long 1 + .long 6483522 + .long 3858350617 + .long 1187701358 + .long 879 + .long 3780777519 + .long 2626127639 + .long 2801410624 + .long 158172 + .long 3864078256 + .long 3316933375 + .long 1275824684 + .long 11667904 + .long 1744149096 + .long 2725495384 + .long 3617949641 + .long 318163395 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 3422290646 + .long 426546810 + .long 43450 + .long 0 + .long 3479121894 + .long 3493673009 + .long 236644653 + .long 0 + .long 4247003031 + .long 1084451344 + .long 1285072157 + .long 46 + .long 1927283714 + .long 2972340862 + .long 2243521359 + .long 13184 + .long 739625925 + .long 4125699428 + .long 1446479475 + .long 1522115 + .long 2250255868 + .long 2030226330 + .long 3149913922 + .long 70000510 + .long 312493331 + .long 1293839619 + .long 2186293876 + .long 1033991278 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 0 + .long 0 + .long 560513588 + .long 3373259426 + .long 2161908945 + .long 3301335691 + .long 0 + .long 0 + .type __trig_x_table,@object + .size __trig_x_table,1040 + .data + .hidden __dpml_multiply__ + .hidden __dpml_ffs_and_shift__ + .hidden __dpml_addsub__ + .hidden __dpml_evaluate_rational__ + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/erf.S b/external/sgx_libm/ia32/erf.S new file mode 100644 index 0000000000..ef56cf4dcb --- /dev/null +++ b/external/sgx_libm/ia32/erf.S @@ -0,0 +1,583 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erf.c" + .text +..TXTST0: +# -- Begin erf + .text + .align 16,0x90 + .globl erf +erf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + subl $24, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movl 12(%ebp), %ecx + movl %ecx, %eax + andl $-2147483648, %eax + andl $2147483647, %ecx + orl $1065353216, %eax + movl %eax, 16(%esp) + cmpl $1075298304, %ecx + flds 16(%esp) + movl 8(%ebp), %esi + fstpt (%esp) + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + jge ..B1.11 +..B1.4: + movzwl 14(%esp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.15 +..B1.5: + orl $-64768, %esi + movw %si, 12(%esp) +..B1.6: + fldcw 12(%esp) +..B1.7: + movl $1, %eax +..B1.8: + fldl 8(%ebp) + lea -1074331648(%ecx), %esi + shrl $20, %ecx + fabs + fldt (%esp) + addl $-1021, %ecx + cmpl $458751, %esi + ja ..L3 + movl $5, %ecx +..L3: + testl %ecx, %ecx + jg ..L4 + movl $0, %ecx +..L4: + movl %ecx, %edi + lea (%ecx,%ecx,2), %esi + shll $4, %edi + shll $7, %ecx + shll $4, %esi + testl %eax, %eax + fxch %st(1) + fmull erfRRTable@GOTOFF(%edi,%edx) + fldl 120+_dbA@GOTOFF(%edx,%ecx) + fldt 36+_ldbA@GOTOFF(%edx,%esi) + fldt 24+_ldbA@GOTOFF(%edx,%esi) + fldt 12+_ldbA@GOTOFF(%edx,%esi) + fldt _ldbA@GOTOFF(%edx,%esi) + fxch %st(5) + faddl 8+erfRRTable@GOTOFF(%edx,%edi) + fmul %st, %st(4) + fxch %st(4) + faddl 112+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 104+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 96+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 88+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 80+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 72+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 64+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 56+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 48+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 40+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 32+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 24+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 16+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl 8+_dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddl _dbA@GOTOFF(%edx,%ecx) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.10 +..B1.9: + fldcw 14(%esp) +..B1.10: + fldt (%esp) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + cmpl $2146435072, %ecx + jl ..B1.14 +..B1.12: + je ..B1.16 +..B1.13: + fldl 8(%ebp) + fadd %st(0), %st + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + fldl 768+_dbA@GOTOFF(%edx) + fldl 776+_dbA@GOTOFF(%edx) + fldt (%esp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + xorl %eax, %eax + jmp ..B1.8 +..B1.16: + testl %esi, %esi + jne ..B1.13 +..B1.17: + fldt (%esp) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type erf,@function + .size erf,.-erf + .data +# -- End erf + .section .rodata, "a" + .align 16 + .align 16 +erfRRTable: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3fd00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xc00d0000 + .type erfRRTable,@object + .size erfRRTable,96 + .align 16 +_dbA: + .long 0 + .long 0 + .long 436480805 + .long 1069343474 + .long 0 + .long 0 + .long 824702180 + .long 3214639822 + .long 0 + .long 0 + .long 3500778474 + .long 1064658364 + .long 0 + .long 0 + .long 596585212 + .long 3209429723 + .long 0 + .long 0 + .long 1470240973 + .long 1059035690 + .long 0 + .long 0 + .long 718843426 + .long 3203353528 + .long 0 + .long 0 + .long 2710426178 + .long 1052473157 + .long 0 + .long 0 + .long 3010232270 + .long 3196296923 + .long 3936437656 + .long 1065568693 + .long 2299323409 + .long 3210429089 + .long 2523607943 + .long 3208348791 + .long 2965083678 + .long 1059250351 + .long 798914934 + .long 1055054643 + .long 3446493953 + .long 3202367749 + .long 3957742900 + .long 1049125428 + .long 3166330044 + .long 1049915994 + .long 2437497479 + .long 3193689582 + .long 3701813711 + .long 3192118067 + .long 4254294173 + .long 1041707319 + .long 3041595886 + .long 1039011503 + .long 177055818 + .long 3184215269 + .long 4076941640 + .long 3180389574 + .long 3283211378 + .long 1031330936 + .long 2299430385 + .long 1025878376 + .long 1560943562 + .long 3215381929 + .long 649600356 + .long 3213783607 + .long 1925487767 + .long 1066650173 + .long 2787104668 + .long 3212012915 + .long 3819886810 + .long 3210959588 + .long 3292869653 + .long 1062994816 + .long 595535285 + .long 3206044511 + .long 2833470226 + .long 3207638255 + .long 3150087827 + .long 1058299310 + .long 4226975388 + .long 1056101349 + .long 3511121228 + .long 3203239297 + .long 4191453678 + .long 1050931364 + .long 2398545468 + .long 1052356106 + .long 1036696996 + .long 3197521914 + .long 406902450 + .long 3195737434 + .long 932124879 + .long 1046963798 + .long 2984826674 + .long 3213958277 + .long 1416337143 + .long 1067493301 + .long 1528223327 + .long 3215470371 + .long 2077734896 + .long 1068079284 + .long 500891590 + .long 3215043166 + .long 1614001607 + .long 1065167414 + .long 397732724 + .long 1066426356 + .long 245285475 + .long 3214320360 + .long 2942435727 + .long 1065970365 + .long 2515085614 + .long 1062242098 + .long 2059023426 + .long 3212710123 + .long 3590542062 + .long 1064841017 + .long 1069940521 + .long 1062119991 + .long 329470371 + .long 1062390329 + .long 2904189456 + .long 1064709094 + .long 1072026573 + .long 1063487818 + .long 2999885720 + .long 3188887951 + .long 3321998034 + .long 3194165661 + .long 778559078 + .long 3198831619 + .long 4123899724 + .long 3202964980 + .long 708728771 + .long 3206666523 + .long 2191638927 + .long 3209872513 + .long 2647513773 + .long 3212706538 + .long 349076715 + .long 3215092788 + .long 3464000864 + .long 3217125251 + .long 2469419808 + .long 3218694220 + .long 396951367 + .long 3219923315 + .long 545534675 + .long 3220654754 + .long 3101724493 + .long 3220952863 + .long 496398401 + .long 3220607311 + .long 1221104108 + .long 3219519496 + .long 4256169036 + .long 3217191486 + .long 2904280702 + .long 3204470624 + .long 1218817182 + .long 1057276414 + .long 54035796 + .long 3204757890 + .long 4162943463 + .long 1056998848 + .long 3226000836 + .long 3203731619 + .long 1250945068 + .long 1055200853 + .long 1745105165 + .long 3201249698 + .long 1720233031 + .long 1051395895 + .long 2751609749 + .long 1047829350 + .long 3766093227 + .long 3196386836 + .long 2511730864 + .long 1047725585 + .long 1042659329 + .long 3192914318 + .long 2981264223 + .long 3189366070 + .long 673045009 + .long 1042560833 + .long 421746295 + .long 3188353310 + .long 3454229363 + .long 3184015574 + .long 4294967295 + .long 1072693247 + .long 0 + .long 1017102336 + .type _dbA,@object + .size _dbA,784 + .align 16 +_ldbA: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26765 + .word 5339 + .word 47746 + .word 36974 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13107 + .word 7119 + .word 41816 + .word 49299 + .word 49149 + .word 0 + .word 64355 + .word 59506 + .word 19372 + .word 46606 + .word 16382 + .word 0 + .word 9448 + .word 50838 + .word 8555 + .word 42135 + .word 16381 + .word 0 + .word 14173 + .word 43489 + .word 45601 + .word 63202 + .word 49147 + .word 0 + .word 56288 + .word 45938 + .word 11407 + .word 56180 + .word 16374 + .word 0 + .word 64911 + .word 39894 + .word 43704 + .word 63314 + .word 16382 + .word 0 + .word 18164 + .word 49445 + .word 47413 + .word 62353 + .word 16379 + .word 0 + .word 62471 + .word 20699 + .word 19176 + .word 46765 + .word 49148 + .word 0 + .word 45860 + .word 23381 + .word 351 + .word 36373 + .word 16380 + .word 0 + .word 52190 + .word 2479 + .word 36194 + .word 65534 + .word 16382 + .word 0 + .word 53234 + .word 6547 + .word 29917 + .word 37380 + .word 16371 + .word 0 + .word 61321 + .word 42597 + .word 44875 + .word 56070 + .word 49141 + .word 0 + .word 35023 + .word 36587 + .word 42382 + .word 52955 + .word 16375 + .word 0 + .word 65130 + .word 65535 + .word 65535 + .word 65535 + .word 16382 + .word 0 + .word 49987 + .word 10941 + .word 20175 + .word 44229 + .word 16331 + .word 0 + .word 45301 + .word 36641 + .word 152 + .word 62959 + .word 49108 + .word 0 + .word 7729 + .word 55572 + .word 4515 + .word 43787 + .word 49115 + .word 0 + .word 12218 + .word 25069 + .word 64268 + .word 65535 + .word 16382 + .word 0 + .word 39514 + .word 2562 + .word 14458 + .word 38069 + .word 16364 + .word 0 + .word 36514 + .word 39186 + .word 15150 + .word 34500 + .word 49134 + .word 0 + .word 9125 + .word 14475 + .word 36819 + .word 40101 + .word 16367 + .word 0 + .type _ldbA,@object + .size _ldbA,288 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/erfc.S b/external/sgx_libm/ia32/erfc.S new file mode 100644 index 0000000000..29656dfd8b --- /dev/null +++ b/external/sgx_libm/ia32/erfc.S @@ -0,0 +1,3498 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfc.c" + .text +..TXTST0: +# -- Begin erfc + .text + .align 16,0x90 + .globl erfc +erfc: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp + movzwl 14(%ebp), %ebx + andl $32752, %ebx + shrl $4, %ebx + movzbl 15(%ebp), %ecx + movl %ebx, %eax + shrl $7, %ecx + shll $31, %ecx + shll $20, %eax + movl 12(%ebp), %edx + orl %eax, %ecx + andl $1048575, %edx + orl %edx, %ecx +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.41 +..B1.4: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.5: + fldcw 12(%esp) +..B1.6: + movl $1, %edx +..B1.7: + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $2047, %ebx + jne ..B1.16 +..B1.8: + testl $1048575, 12(%ebp) + jne ..B1.13 +..B1.9: + cmpl $0, 8(%ebp) + jne ..B1.13 +..B1.10: + movzbl 15(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + testl %edx, %edx + je ..B1.12 +..B1.11: + fldcw 14(%esp) +..B1.12: + flds zero_two@GOTOFF(%eax,%ecx,4) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + testl %edx, %edx + je ..B1.15 +..B1.14: + fldcw 14(%esp) +..B1.15: + fldl 8(%ebp) + fmul %st(0), %st + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + testl %ebx, %ebx + jne ..B1.22 +..B1.17: + testl $1048575, 12(%ebp) + jne ..B1.22 +..B1.18: + cmpl $0, 8(%ebp) + jne ..B1.22 +..B1.19: + testl %edx, %edx + je ..B1.21 +..B1.20: + fldcw 14(%esp) +..B1.21: + fld1 + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.22: + cmpl $1077578514, %ecx + jae ..B1.26 +..B1.23: + fldl 8(%ebp) + fld %st(0) + fld %st(1) + fld1 + movzwl 8+.L_2il0floatpacket.2@GOTOFF(%eax), %edi + fadd %st(3), %st + fmul %st(0), %st + andl $-32768, %edi + fmul %st(0), %st + fstpt 24(%esp) + fldl .L_2il0floatpacket.0@GOTOFF(%eax) + fmul %st(3), %st + movzwl 32(%esp), %ebx + fsub %st, %st(2) + andl $32767, %ebx + fsubp %st, %st(2) + fld %st(1) + lea (%ebx,%ebx,2), %ebx + fmul %st(2), %st + fchs + fxch %st(1) + fsub %st(2), %st + fldt .L_2il0floatpacket.1@GOTOFF(%eax) + shll $6, %ebx + fmulp %st, %st(3) + fmul %st, %st(2) + fmul %st(0), %st + fsubrp %st, %st(2) + fldt _EXPL_TABLE@GOTOFF(%eax) + fmul %st(1), %st + fldt 36+_EXPL_TABLE@GOTOFF(%eax) + fadd %st, %st(1) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fsubp %st, %st(1) + fldt -3145536+_ERFC_TABLE@GOTOFF(%ebx,%eax) + movl 36(%esp), %ecx + movl %ecx, %esi + andl $-128, %esi + andl $127, %ecx + addl $2097024, %esi + fsubrp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fldt .L_2il0floatpacket.2@GOTOFF(%eax) + fstpt 48(%esp) + fldt 12+_EXPL_TABLE@GOTOFF(%eax) + fmul %st(2), %st + shrl $7, %esi + fsubrp %st, %st(3) + fldt 24+_EXPL_TABLE@GOTOFF(%eax) + andl $32767, %esi + fmul %st(2), %st + orl %esi, %edi + movw %di, 56(%esp) + lea (,%ecx,8), %esi + testl %edx, %edx + lea (%esi,%ecx,4), %ecx + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt -3145356+_ERFC_TABLE@GOTOFF(%eax,%ebx) + fmul %st(3), %st + fldt -3145380+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145404+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145428+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145452+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145476+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145500+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145524+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fldt -3145368+_ERFC_TABLE@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fldt -3145392+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145416+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145440+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145464+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145488+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt -3145512+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(4) + fxch %st(4) + fmulp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt 72+_EXP_POLY@GOTOFF(%eax) + fmul %st(1), %st + fldt 60+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt _EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fldt 48(%esp) + fldt _T_TABLE@GOTOFF(%eax,%ecx) + fmulp %st, %st(1) + fmulp %st, %st(1) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.46 +..B1.24: + fstpt 36(%esp) +..B1.44: + fldcw 14(%esp) + jmp ..B1.25 +..B1.46: + fstp %st(0) +..B1.25: + fldt (%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + cmpl $1077673984, %ecx + jae ..B1.30 +..B1.27: + fldl 8(%ebp) + fld %st(0) + fld %st(1) + fld1 + movzwl 8+.L_2il0floatpacket.2@GOTOFF(%eax), %edi + fadd %st(3), %st + fmul %st(0), %st + andl $-32768, %edi + fmul %st(0), %st + fstpt 24(%esp) + fldl .L_2il0floatpacket.0@GOTOFF(%eax) + fmul %st(3), %st + movzwl 32(%esp), %ebx + fsub %st, %st(2) + andl $32767, %ebx + fsubp %st, %st(2) + fld %st(1) + lea (%ebx,%ebx,2), %ebx + fmul %st(2), %st + fchs + fxch %st(1) + fsub %st(2), %st + fldt .L_2il0floatpacket.1@GOTOFF(%eax) + shll $6, %ebx + fmulp %st, %st(3) + fmul %st, %st(2) + fmul %st(0), %st + fsubrp %st, %st(2) + fldt _EXPL_TABLE@GOTOFF(%eax) + fmul %st(1), %st + fldt 36+_EXPL_TABLE@GOTOFF(%eax) + fadd %st, %st(1) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fsubp %st, %st(1) + fldt -3145536+_ERFC_TABLE@GOTOFF(%ebx,%eax) + movl 36(%esp), %ecx + movl %ecx, %esi + andl $-128, %esi + andl $127, %ecx + addl $2097024, %esi + fsubrp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fldt .L_2il0floatpacket.2@GOTOFF(%eax) + fstpt 48(%esp) + fldt 12+_EXPL_TABLE@GOTOFF(%eax) + fmul %st(1), %st + shrl $7, %esi + fsubrp %st, %st(3) + fldt 24+_EXPL_TABLE@GOTOFF(%eax) + andl $32767, %esi + fmulp %st, %st(1) + orl %esi, %edi + movw %di, 56(%esp) + lea (,%ecx,8), %esi + testl %edx, %edx + lea (%esi,%ecx,4), %ecx + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt -3145356+_ERFC_TABLE@GOTOFF(%eax,%ebx) + fmul %st(2), %st + fldt -3145380+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt -3145404+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt -3145428+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt -3145452+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt -3145476+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt -3145500+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt -3145524+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fldt -3145368+_ERFC_TABLE@GOTOFF(%eax,%ebx) + fmul %st(3), %st + fldt -3145392+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145416+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145440+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145464+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt -3145488+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt -3145512+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 72+_EXP_POLY@GOTOFF(%eax) + fmul %st(2), %st + fldt 60+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _EXP_POLY@GOTOFF(%eax) + faddp %st, %st(2) + fldt 48(%esp) + fldt _T_TABLE@GOTOFF(%eax,%ecx) + fmulp %st, %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpl 16(%esp) + je ..B1.29 +..B1.28: + fldcw 14(%esp) +..B1.29: + fldl 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.30: + cmpl $2146435072, %ecx + jb ..B1.38 +..B1.31: + cmpl $-1072168960, %ecx + jae ..B1.35 +..B1.32: + fldl 8(%ebp) + fld %st(0) + fld %st(1) + fchs + fld1 + movzwl 8+.L_2il0floatpacket.2@GOTOFF(%eax), %edi + fadd %st(1), %st + fmul %st(0), %st + andl $-32768, %edi + fmul %st(0), %st + fstpt 24(%esp) + fldl .L_2il0floatpacket.0@GOTOFF(%eax) + fmul %st(3), %st + movzwl 32(%esp), %ebx + fsub %st, %st(2) + andl $32767, %ebx + fsubp %st, %st(2) + fld %st(1) + lea (%ebx,%ebx,2), %ebx + fmul %st(2), %st + fchs + fxch %st(2) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.1@GOTOFF(%eax) + shll $6, %ebx + fmulp %st, %st(1) + fmul %st(3), %st + fxch %st(3) + fmul %st(0), %st + fsubrp %st, %st(3) + fldt _EXPL_TABLE@GOTOFF(%eax) + fmul %st(2), %st + fldt 36+_EXPL_TABLE@GOTOFF(%eax) + fadd %st, %st(1) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fsubp %st, %st(1) + fldt -3145536+_ERFC_TABLE@GOTOFF(%ebx,%eax) + movl 36(%esp), %ecx + movl %ecx, %esi + andl $-128, %esi + andl $127, %ecx + addl $2097024, %esi + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fldt .L_2il0floatpacket.2@GOTOFF(%eax) + fstpt 48(%esp) + fldt 12+_EXPL_TABLE@GOTOFF(%eax) + fmul %st(2), %st + shrl $7, %esi + fsubrp %st, %st(4) + fldt 24+_EXPL_TABLE@GOTOFF(%eax) + andl $32767, %esi + fmul %st(2), %st + orl %esi, %edi + movw %di, 56(%esp) + lea (,%ecx,8), %esi + testl %edx, %edx + lea (%esi,%ecx,4), %ecx + fsubrp %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fldt -3145356+_ERFC_TABLE@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fldt -3145380+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145404+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145428+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145452+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145476+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145500+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt -3145524+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fldt -3145368+_ERFC_TABLE@GOTOFF(%eax,%ebx) + fmul %st(5), %st + fldt -3145392+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(5), %st + fldt -3145416+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(5), %st + fldt -3145440+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(5), %st + fldt -3145464+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmul %st(5), %st + fldt -3145488+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt -3145512+_ERFC_TABLE@GOTOFF(%eax,%ebx) + faddp %st, %st(5) + fxch %st(2) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldt 72+_EXP_POLY@GOTOFF(%eax) + fmul %st(2), %st + fldt 60+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_EXP_POLY@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _EXP_POLY@GOTOFF(%eax) + faddp %st, %st(2) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + fldt 48(%esp) + fldt _T_TABLE@GOTOFF(%eax,%ecx) + fmulp %st, %st(1) + fmulp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fldt 60+_EXPL_TABLE@GOTOFF(%eax) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.47 +..B1.33: + fstpt 36(%esp) +..B1.45: + fldcw 14(%esp) + jmp ..B1.34 +..B1.47: + fstp %st(0) +..B1.34: + fldt (%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.35: + fldt 48+_EXPL_TABLE@GOTOFF(%eax) + testl %edx, %edx + fldt 72+_EXPL_TABLE@GOTOFF(%eax) + fmulp %st, %st(1) + fstpl 16(%esp) + je ..B1.37 +..B1.36: + fldcw 14(%esp) +..B1.37: + fldl 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + fldt 84+_EXPL_TABLE@GOTOFF(%eax) + testl %edx, %edx + fmul %st(0), %st + fstpl 16(%esp) + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldl 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + xorl %edx, %edx + jmp ..B1.7 + .align 16,0x90 + .type erfc,@function + .size erfc,.-erfc + .data +# -- End erfc + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +zero_two: + .long 0x00000000 + .long 0x40000000 + .type zero_two,@object + .size zero_two,8 + .space 8, 0x00 # pad + .align 16 +_ERFC_TABLE: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 26765 + .word 5339 + .word 47746 + .word 36974 + .word 49151 + .word 0 + .word 65515 + .word 65535 + .word 65535 + .word 65535 + .word 16382 + .word 0 + .word 10533 + .word 7119 + .word 41816 + .word 49299 + .word 49150 + .word 0 + .word 52669 + .word 65527 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 16123 + .word 5294 + .word 46560 + .word 39439 + .word 49149 + .word 0 + .word 45245 + .word 18034 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 4032 + .word 40793 + .word 62556 + .word 45073 + .word 49147 + .word 0 + .word 4147 + .word 29718 + .word 43156 + .word 43690 + .word 16378 + .word 0 + .word 16916 + .word 58237 + .word 36396 + .word 40065 + .word 49145 + .word 0 + .word 30369 + .word 5547 + .word 38547 + .word 34949 + .word 16376 + .word 0 + .word 5723 + .word 34549 + .word 4774 + .word 58209 + .word 49142 + .word 0 + .word 32046 + .word 45872 + .word 27437 + .word 46045 + .word 16373 + .word 0 + .word 53798 + .word 26622 + .word 41794 + .word 32792 + .word 49140 + .word 0 + .word 43993 + .word 60371 + .word 27258 + .word 64442 + .word 16369 + .word 0 + .word 19322 + .word 28101 + .word 33420 + .word 49599 + .word 16380 + .word 0 + .word 7793 + .word 15289 + .word 7920 + .word 53594 + .word 16382 + .word 0 + .word 28952 + .word 49971 + .word 44506 + .word 53668 + .word 49150 + .word 0 + .word 36016 + .word 10961 + .word 40954 + .word 43439 + .word 16382 + .word 0 + .word 20915 + .word 61681 + .word 29972 + .word 60599 + .word 49149 + .word 0 + .word 24299 + .word 42445 + .word 45918 + .word 37706 + .word 16381 + .word 0 + .word 61980 + .word 35870 + .word 4262 + .word 42772 + .word 49148 + .word 0 + .word 2378 + .word 21048 + .word 27187 + .word 44880 + .word 16379 + .word 0 + .word 26023 + .word 38535 + .word 63103 + .word 44029 + .word 49146 + .word 0 + .word 51865 + .word 42701 + .word 357 + .word 40715 + .word 16377 + .word 0 + .word 52714 + .word 49990 + .word 38847 + .word 35713 + .word 49144 + .word 0 + .word 43806 + .word 65105 + .word 55139 + .word 59728 + .word 16374 + .word 0 + .word 64429 + .word 64517 + .word 6745 + .word 47746 + .word 49141 + .word 0 + .word 3465 + .word 57626 + .word 20546 + .word 36179 + .word 16372 + .word 0 + .word 22094 + .word 56102 + .word 37959 + .word 48728 + .word 49138 + .word 0 + .word 23306 + .word 25455 + .word 51183 + .word 43976 + .word 16368 + .word 0 + .word 37393 + .word 59257 + .word 52431 + .word 54291 + .word 16381 + .word 0 + .word 39090 + .word 10024 + .word 15035 + .word 43415 + .word 16382 + .word 0 + .word 43741 + .word 37879 + .word 6777 + .word 37983 + .word 49150 + .word 0 + .word 35426 + .word 24730 + .word 14790 + .word 55364 + .word 16381 + .word 0 + .word 35922 + .word 59851 + .word 47783 + .word 35355 + .word 49149 + .word 0 + .word 26997 + .word 19270 + .word 26422 + .word 40719 + .word 16380 + .word 0 + .word 44927 + .word 10365 + .word 61824 + .word 43075 + .word 49147 + .word 0 + .word 58693 + .word 50832 + .word 29111 + .word 42397 + .word 16378 + .word 0 + .word 18548 + .word 6343 + .word 29493 + .word 39194 + .word 49145 + .word 0 + .word 63186 + .word 18681 + .word 63761 + .word 34279 + .word 16376 + .word 0 + .word 30590 + .word 51670 + .word 24700 + .word 57056 + .word 49142 + .word 0 + .word 12395 + .word 18187 + .word 53964 + .word 45381 + .word 16373 + .word 0 + .word 8442 + .word 17290 + .word 60340 + .word 34554 + .word 49140 + .word 0 + .word 42583 + .word 52808 + .word 14422 + .word 49744 + .word 16370 + .word 0 + .word 38491 + .word 10790 + .word 17138 + .word 62758 + .word 49136 + .word 0 + .word 64957 + .word 43359 + .word 35041 + .word 51589 + .word 16366 + .word 0 + .word 54760 + .word 44346 + .word 63893 + .word 44681 + .word 16382 + .word 0 + .word 58037 + .word 18353 + .word 47660 + .word 34940 + .word 16382 + .word 0 + .word 12942 + .word 61844 + .word 37020 + .word 52609 + .word 49149 + .word 0 + .word 9074 + .word 21010 + .word 41308 + .word 34012 + .word 16381 + .word 0 + .word 33111 + .word 27346 + .word 43463 + .word 39226 + .word 49148 + .word 0 + .word 56229 + .word 38650 + .word 52618 + .word 41280 + .word 16379 + .word 0 + .word 28394 + .word 30437 + .word 45662 + .word 40246 + .word 49146 + .word 0 + .word 60627 + .word 1334 + .word 52268 + .word 36747 + .word 16377 + .word 0 + .word 31481 + .word 19361 + .word 56420 + .word 63358 + .word 49143 + .word 0 + .word 4433 + .word 31036 + .word 44150 + .word 51896 + .word 16374 + .word 0 + .word 21935 + .word 37845 + .word 52167 + .word 40591 + .word 49141 + .word 0 + .word 52857 + .word 25760 + .word 12934 + .word 60865 + .word 16371 + .word 0 + .word 30097 + .word 40209 + .word 51883 + .word 43747 + .word 49138 + .word 0 + .word 3097 + .word 41736 + .word 19718 + .word 59248 + .word 16368 + .word 0 + .word 62213 + .word 58640 + .word 23379 + .word 34650 + .word 49135 + .word 0 + .word 39490 + .word 47564 + .word 3293 + .word 51441 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 37057 + .word 51893 + .word 15367 + .word 56044 + .word 16381 + .word 0 + .word 32940 + .word 48642 + .word 29176 + .word 35810 + .word 49149 + .word 0 + .word 5161 + .word 6502 + .word 37918 + .word 40467 + .word 16380 + .word 0 + .word 17565 + .word 33655 + .word 49092 + .word 41537 + .word 49147 + .word 0 + .word 53678 + .word 44288 + .word 26743 + .word 39397 + .word 16378 + .word 0 + .word 31872 + .word 15269 + .word 30938 + .word 34942 + .word 49145 + .word 0 + .word 20440 + .word 62677 + .word 51881 + .word 58469 + .word 16375 + .word 0 + .word 54439 + .word 520 + .word 12343 + .word 46457 + .word 49142 + .word 0 + .word 50526 + .word 61632 + .word 2909 + .word 35241 + .word 16373 + .word 0 + .word 37830 + .word 61581 + .word 47207 + .word 51261 + .word 49139 + .word 0 + .word 25082 + .word 64640 + .word 37139 + .word 35852 + .word 16370 + .word 0 + .word 4883 + .word 40101 + .word 42814 + .word 48151 + .word 49136 + .word 0 + .word 19629 + .word 49380 + .word 65167 + .word 60688 + .word 16366 + .word 0 + .word 28545 + .word 10321 + .word 37155 + .word 65097 + .word 49132 + .word 0 + .word 64819 + .word 9690 + .word 1918 + .word 43254 + .word 16362 + .word 0 + .word 21215 + .word 7025 + .word 57507 + .word 45167 + .word 16383 + .word 0 + .word 55056 + .word 34238 + .word 8713 + .word 44914 + .word 16381 + .word 0 + .word 4267 + .word 1060 + .word 46425 + .word 48156 + .word 49148 + .word 0 + .word 14908 + .word 57526 + .word 48994 + .word 46896 + .word 16379 + .word 0 + .word 21326 + .word 53665 + .word 1969 + .word 42227 + .word 49146 + .word 0 + .word 25051 + .word 4472 + .word 10229 + .word 35587 + .word 16377 + .word 0 + .word 2076 + .word 31531 + .word 22832 + .word 56640 + .word 49143 + .word 0 + .word 60662 + .word 38735 + .word 55096 + .word 42849 + .word 16374 + .word 0 + .word 46215 + .word 1268 + .word 63191 + .word 61960 + .word 49140 + .word 0 + .word 4281 + .word 13548 + .word 25997 + .word 42995 + .word 16371 + .word 0 + .word 59094 + .word 61396 + .word 50012 + .word 57465 + .word 49137 + .word 0 + .word 56623 + .word 39859 + .word 52689 + .word 37061 + .word 16368 + .word 0 + .word 9718 + .word 28760 + .word 6243 + .word 45969 + .word 49134 + .word 0 + .word 22149 + .word 16273 + .word 53084 + .word 53283 + .word 16364 + .word 0 + .word 34037 + .word 57333 + .word 5882 + .word 51824 + .word 49130 + .word 0 + .word 11184 + .word 36893 + .word 23744 + .word 61115 + .word 16359 + .word 0 + .word 51465 + .word 62396 + .word 58983 + .word 59913 + .word 16383 + .word 0 + .word 21679 + .word 9895 + .word 5635 + .word 36049 + .word 16381 + .word 0 + .word 37768 + .word 22289 + .word 42182 + .word 64290 + .word 49147 + .word 0 + .word 29929 + .word 29351 + .word 11432 + .word 53291 + .word 16378 + .word 0 + .word 58374 + .word 18153 + .word 737 + .word 41523 + .word 49145 + .word 0 + .word 31896 + .word 56867 + .word 6398 + .word 61321 + .word 16375 + .word 0 + .word 55425 + .word 64032 + .word 46488 + .word 43176 + .word 49142 + .word 0 + .word 62735 + .word 35007 + .word 19863 + .word 58262 + .word 16372 + .word 0 + .word 2759 + .word 46881 + .word 15376 + .word 37816 + .word 49139 + .word 0 + .word 27202 + .word 45269 + .word 46930 + .word 47379 + .word 16369 + .word 0 + .word 36329 + .word 2846 + .word 16122 + .word 57442 + .word 49135 + .word 0 + .word 7470 + .word 414 + .word 53668 + .word 33732 + .word 16366 + .word 0 + .word 4702 + .word 32984 + .word 47709 + .word 38156 + .word 49132 + .word 0 + .word 59392 + .word 2467 + .word 11268 + .word 40167 + .word 16362 + .word 0 + .word 49683 + .word 209 + .word 55200 + .word 35020 + .word 49128 + .word 0 + .word 45504 + .word 61587 + .word 60548 + .word 36340 + .word 16357 + .word 0 + .word 27380 + .word 54941 + .word 64714 + .word 38724 + .word 16384 + .word 0 + .word 47150 + .word 21425 + .word 33441 + .word 58047 + .word 16380 + .word 0 + .word 10709 + .word 48511 + .word 39648 + .word 42794 + .word 49147 + .word 0 + .word 60862 + .word 8841 + .word 14633 + .word 59785 + .word 16377 + .word 0 + .word 38166 + .word 61183 + .word 58848 + .word 39827 + .word 49144 + .word 0 + .word 18364 + .word 43708 + .word 39063 + .word 50867 + .word 16374 + .word 0 + .word 61920 + .word 34013 + .word 44157 + .word 62530 + .word 49140 + .word 0 + .word 62014 + .word 46109 + .word 55800 + .word 37115 + .word 16371 + .word 0 + .word 46135 + .word 31864 + .word 22791 + .word 42668 + .word 49137 + .word 0 + .word 58857 + .word 54577 + .word 2989 + .word 47612 + .word 16367 + .word 0 + .word 34902 + .word 37732 + .word 51405 + .word 51663 + .word 49133 + .word 0 + .word 9364 + .word 27291 + .word 20920 + .word 54522 + .word 16363 + .word 0 + .word 37485 + .word 50 + .word 60675 + .word 55504 + .word 49129 + .word 0 + .word 35187 + .word 50155 + .word 51754 + .word 52385 + .word 16359 + .word 0 + .word 14814 + .word 63962 + .word 41088 + .word 40486 + .word 49125 + .word 0 + .word 11362 + .word 25769 + .word 50575 + .word 36669 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .word 26223 + .word 5353 + .word 5097 + .word 46924 + .word 16380 + .word 0 + .word 30267 + .word 42379 + .word 29288 + .word 57013 + .word 49146 + .word 0 + .word 42189 + .word 50693 + .word 61652 + .word 33311 + .word 16377 + .word 0 + .word 47396 + .word 16957 + .word 12509 + .word 37576 + .word 49143 + .word 0 + .word 23478 + .word 31241 + .word 24950 + .word 41038 + .word 16373 + .word 0 + .word 17240 + .word 63077 + .word 25824 + .word 43503 + .word 49139 + .word 0 + .word 25576 + .word 39889 + .word 51350 + .word 44857 + .word 16369 + .word 0 + .word 13068 + .word 16791 + .word 29619 + .word 45074 + .word 49135 + .word 0 + .word 60332 + .word 2969 + .word 19586 + .word 44206 + .word 16365 + .word 0 + .word 37599 + .word 42283 + .word 62126 + .word 42363 + .word 49131 + .word 0 + .word 41529 + .word 34093 + .word 65146 + .word 39638 + .word 16361 + .word 0 + .word 10083 + .word 55225 + .word 38396 + .word 35838 + .word 49127 + .word 0 + .word 53136 + .word 32600 + .word 23694 + .word 59889 + .word 16356 + .word 0 + .word 63669 + .word 4602 + .word 61995 + .word 40592 + .word 49122 + .word 0 + .word 64442 + .word 41272 + .word 29937 + .word 63695 + .word 16350 + .word 0 + .word 21215 + .word 7025 + .word 57507 + .word 61551 + .word 16384 + .word 0 + .word 60759 + .word 43057 + .word 21108 + .word 38100 + .word 16380 + .word 0 + .word 19048 + .word 27034 + .word 20875 + .word 38100 + .word 49146 + .word 0 + .word 43286 + .word 62467 + .word 46495 + .word 37059 + .word 16376 + .word 0 + .word 18535 + .word 3739 + .word 31085 + .word 35131 + .word 49142 + .word 0 + .word 47338 + .word 988 + .word 43337 + .word 65023 + .word 16371 + .word 0 + .word 53014 + .word 19205 + .word 31790 + .word 58830 + .word 49137 + .word 0 + .word 64942 + .word 4422 + .word 52367 + .word 52104 + .word 16367 + .word 0 + .word 18376 + .word 62542 + .word 21190 + .word 45226 + .word 49133 + .word 0 + .word 36541 + .word 5903 + .word 55315 + .word 38509 + .word 16363 + .word 0 + .word 58232 + .word 34982 + .word 30759 + .word 64373 + .word 49128 + .word 0 + .word 53034 + .word 58877 + .word 34756 + .word 52727 + .word 16358 + .word 0 + .word 43589 + .word 44050 + .word 54239 + .word 41804 + .word 49124 + .word 0 + .word 58188 + .word 24032 + .word 18788 + .word 61115 + .word 16353 + .word 0 + .word 53178 + .word 32234 + .word 55399 + .word 35974 + .word 49119 + .word 0 + .word 32107 + .word 65066 + .word 9168 + .word 48562 + .word 16347 + .word 0 + .word 25732 + .word 63966 + .word 62259 + .word 38148 + .word 16385 + .word 0 + .word 1290 + .word 5604 + .word 33063 + .word 62145 + .word 16379 + .word 0 + .word 61015 + .word 23258 + .word 11350 + .word 51162 + .word 49145 + .word 0 + .word 27005 + .word 25391 + .word 61437 + .word 41308 + .word 16375 + .word 0 + .word 36713 + .word 64273 + .word 62675 + .word 65487 + .word 49140 + .word 0 + .word 27734 + .word 12066 + .word 17277 + .word 51007 + .word 16370 + .word 0 + .word 22545 + .word 24708 + .word 32287 + .word 39069 + .word 49136 + .word 0 + .word 7137 + .word 26934 + .word 42406 + .word 58901 + .word 16365 + .word 0 + .word 28920 + .word 48738 + .word 2272 + .word 43725 + .word 49131 + .word 0 + .word 12386 + .word 49194 + .word 59841 + .word 63966 + .word 16360 + .word 0 + .word 12291 + .word 20618 + .word 59744 + .word 46112 + .word 49126 + .word 0 + .word 45255 + .word 8860 + .word 16074 + .word 65374 + .word 16355 + .word 0 + .word 24201 + .word 30931 + .word 20557 + .word 44934 + .word 49121 + .word 0 + .word 57092 + .word 56173 + .word 59274 + .word 56860 + .word 16350 + .word 0 + .word 421 + .word 9843 + .word 65450 + .word 57636 + .word 49115 + .word 0 + .word 26834 + .word 64481 + .word 48830 + .word 33265 + .word 16344 + .word 0 + .word 27380 + .word 54941 + .word 64714 + .word 46916 + .word 16385 + .word 0 + .word 16042 + .word 6176 + .word 23933 + .word 50894 + .word 16379 + .word 0 + .word 15496 + .word 30354 + .word 41738 + .word 34536 + .word 49145 + .word 0 + .word 16771 + .word 22379 + .word 52151 + .word 46241 + .word 16374 + .word 0 + .word 13611 + .word 51387 + .word 33531 + .word 61111 + .word 49139 + .word 0 + .word 58938 + .word 199 + .word 35276 + .word 39876 + .word 16369 + .word 0 + .word 34069 + .word 62119 + .word 6313 + .word 51412 + .word 49134 + .word 0 + .word 26024 + .word 61062 + .word 29148 + .word 65510 + .word 16363 + .word 0 + .word 21349 + .word 54243 + .word 12871 + .word 41265 + .word 49129 + .word 0 + .word 4785 + .word 38663 + .word 43132 + .word 51413 + .word 16358 + .word 0 + .word 24101 + .word 62567 + .word 22734 + .word 63346 + .word 49123 + .word 0 + .word 15399 + .word 49395 + .word 40313 + .word 38484 + .word 16353 + .word 0 + .word 28161 + .word 41902 + .word 27845 + .word 45418 + .word 49118 + .word 0 + .word 12182 + .word 20933 + .word 3877 + .word 49303 + .word 16347 + .word 0 + .word 20492 + .word 46011 + .word 10667 + .word 42720 + .word 49112 + .word 0 + .word 46757 + .word 22481 + .word 16184 + .word 41956 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16385 + .word 0 + .word 15972 + .word 32891 + .word 13820 + .word 41838 + .word 16379 + .word 0 + .word 63823 + .word 14280 + .word 41618 + .word 46885 + .word 49144 + .word 0 + .word 62247 + .word 60117 + .word 61219 + .word 52049 + .word 16373 + .word 0 + .word 4514 + .word 2791 + .word 14455 + .word 57256 + .word 49138 + .word 0 + .word 8237 + .word 29451 + .word 46967 + .word 62423 + .word 16367 + .word 0 + .word 38621 + .word 18263 + .word 65293 + .word 33733 + .word 49133 + .word 0 + .word 20437 + .word 17700 + .word 46099 + .word 36151 + .word 16362 + .word 0 + .word 7628 + .word 50188 + .word 47081 + .word 38422 + .word 49127 + .word 0 + .word 27034 + .word 6950 + .word 65014 + .word 40504 + .word 16356 + .word 0 + .word 929 + .word 31466 + .word 57314 + .word 42341 + .word 49121 + .word 0 + .word 51218 + .word 18814 + .word 40699 + .word 43755 + .word 16350 + .word 0 + .word 60139 + .word 33609 + .word 1443 + .word 43987 + .word 49115 + .word 0 + .word 28121 + .word 19894 + .word 16 + .word 40667 + .word 16344 + .word 0 + .word 47275 + .word 5106 + .word 2805 + .word 59896 + .word 49108 + .word 0 + .word 45414 + .word 34202 + .word 16579 + .word 49848 + .word 16336 + .word 0 + .word 43375 + .word 36280 + .word 61521 + .word 34871 + .word 16386 + .word 0 + .word 16506 + .word 6420 + .word 3056 + .word 34509 + .word 16379 + .word 0 + .word 1987 + .word 42760 + .word 41343 + .word 63988 + .word 49143 + .word 0 + .word 60842 + .word 56864 + .word 63566 + .word 58939 + .word 16372 + .word 0 + .word 55417 + .word 6969 + .word 17921 + .word 53943 + .word 49137 + .word 0 + .word 51573 + .word 24611 + .word 61942 + .word 49060 + .word 16366 + .word 0 + .word 60047 + .word 61936 + .word 1505 + .word 44346 + .word 49131 + .word 0 + .word 6985 + .word 28094 + .word 62181 + .word 39841 + .word 16360 + .word 0 + .word 44966 + .word 25211 + .word 37807 + .word 35582 + .word 49125 + .word 0 + .word 18549 + .word 30768 + .word 43886 + .word 63182 + .word 16353 + .word 0 + .word 28367 + .word 55574 + .word 54863 + .word 55743 + .word 49118 + .word 0 + .word 14135 + .word 59968 + .word 11402 + .word 48712 + .word 16347 + .word 0 + .word 10831 + .word 6630 + .word 39162 + .word 41467 + .word 49112 + .word 0 + .word 44318 + .word 36886 + .word 57433 + .word 64946 + .word 16340 + .word 0 + .word 48971 + .word 52692 + .word 39577 + .word 40471 + .word 49105 + .word 0 + .word 51132 + .word 42759 + .word 59794 + .word 56909 + .word 16332 + .word 0 + .word 25732 + .word 63966 + .word 62259 + .word 42244 + .word 16386 + .word 0 + .word 59756 + .word 3318 + .word 14822 + .word 57094 + .word 16378 + .word 0 + .word 53698 + .word 1627 + .word 14262 + .word 43879 + .word 49143 + .word 0 + .word 39975 + .word 26109 + .word 52231 + .word 33570 + .word 16372 + .word 0 + .word 51646 + .word 31403 + .word 31812 + .word 51139 + .word 49136 + .word 0 + .word 2483 + .word 26589 + .word 1676 + .word 38780 + .word 16365 + .word 0 + .word 48498 + .word 1356 + .word 1608 + .word 58560 + .word 49129 + .word 0 + .word 3924 + .word 17004 + .word 812 + .word 44025 + .word 16358 + .word 0 + .word 46861 + .word 28945 + .word 33303 + .word 32957 + .word 49123 + .word 0 + .word 44566 + .word 64586 + .word 45755 + .word 49135 + .word 16351 + .word 0 + .word 24613 + .word 10799 + .word 48364 + .word 36456 + .word 49116 + .word 0 + .word 30085 + .word 45589 + .word 61330 + .word 53663 + .word 16344 + .word 0 + .word 33497 + .word 5155 + .word 3788 + .word 38522 + .word 49109 + .word 0 + .word 14725 + .word 21779 + .word 34456 + .word 50904 + .word 16337 + .word 0 + .word 52940 + .word 10411 + .word 49330 + .word 53514 + .word 49101 + .word 0 + .word 34723 + .word 21028 + .word 57012 + .word 63430 + .word 16328 + .word 0 + .word 27380 + .word 54941 + .word 64714 + .word 51012 + .word 16386 + .word 0 + .word 45653 + .word 64195 + .word 32236 + .word 47349 + .word 16378 + .word 0 + .word 879 + .word 33324 + .word 35436 + .word 60443 + .word 49142 + .word 0 + .word 46894 + .word 26961 + .word 28118 + .word 38458 + .word 16371 + .word 0 + .word 44554 + .word 3572 + .word 63976 + .word 48787 + .word 49135 + .word 0 + .word 2272 + .word 4313 + .word 35324 + .word 61701 + .word 16363 + .word 0 + .word 30703 + .word 23672 + .word 41539 + .word 38897 + .word 49128 + .word 0 + .word 37671 + .word 61454 + .word 12213 + .word 48895 + .word 16356 + .word 0 + .word 61848 + .word 29005 + .word 2524 + .word 61278 + .word 49120 + .word 0 + .word 28836 + .word 16521 + .word 28345 + .word 38282 + .word 16349 + .word 0 + .word 22288 + .word 21607 + .word 62473 + .word 47665 + .word 49113 + .word 0 + .word 61670 + .word 56396 + .word 40174 + .word 58939 + .word 16341 + .word 0 + .word 11500 + .word 65235 + .word 61923 + .word 35576 + .word 49106 + .word 0 + .word 11242 + .word 2180 + .word 826 + .word 39560 + .word 16334 + .word 0 + .word 43321 + .word 47027 + .word 63349 + .word 35004 + .word 49098 + .word 0 + .word 4958 + .word 42423 + .word 31587 + .word 34920 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 16386 + .word 0 + .word 62439 + .word 8267 + .word 42241 + .word 39352 + .word 16378 + .word 0 + .word 51100 + .word 10343 + .word 41485 + .word 41791 + .word 49142 + .word 0 + .word 22569 + .word 27301 + .word 5322 + .word 44285 + .word 16370 + .word 0 + .word 35593 + .word 39735 + .word 46317 + .word 46825 + .word 49134 + .word 0 + .word 62209 + .word 35548 + .word 38355 + .word 49405 + .word 16362 + .word 0 + .word 41076 + .word 45055 + .word 12154 + .word 52016 + .word 49126 + .word 0 + .word 33794 + .word 34841 + .word 26433 + .word 54648 + .word 16354 + .word 0 + .word 32708 + .word 8606 + .word 28372 + .word 57292 + .word 49118 + .word 0 + .word 58537 + .word 41843 + .word 17546 + .word 59935 + .word 16346 + .word 0 + .word 14261 + .word 60109 + .word 32952 + .word 62535 + .word 49110 + .word 0 + .word 15086 + .word 37621 + .word 31044 + .word 64853 + .word 16338 + .word 0 + .word 41112 + .word 8679 + .word 1028 + .word 32860 + .word 49103 + .word 0 + .word 5006 + .word 59706 + .word 53773 + .word 61388 + .word 16330 + .word 0 + .word 8320 + .word 26227 + .word 30276 + .word 45657 + .word 49094 + .word 0 + .word 12516 + .word 27384 + .word 49627 + .word 38295 + .word 16321 + .word 0 + .word 43375 + .word 36280 + .word 61521 + .word 36919 + .word 16387 + .word 0 + .word 13964 + .word 47780 + .word 48486 + .word 65532 + .word 16377 + .word 0 + .word 53655 + .word 14178 + .word 29810 + .word 57985 + .word 49141 + .word 0 + .word 40644 + .word 13825 + .word 33576 + .word 51229 + .word 16369 + .word 0 + .word 43867 + .word 51159 + .word 21808 + .word 45192 + .word 49133 + .word 0 + .word 64774 + .word 25334 + .word 42575 + .word 39806 + .word 16361 + .word 0 + .word 8550 + .word 43268 + .word 19146 + .word 35010 + .word 49125 + .word 0 + .word 10274 + .word 39807 + .word 58829 + .word 61491 + .word 16352 + .word 0 + .word 64510 + .word 64333 + .word 45409 + .word 53921 + .word 49116 + .word 0 + .word 7837 + .word 47962 + .word 10236 + .word 47211 + .word 16344 + .word 0 + .word 58632 + .word 16136 + .word 57648 + .word 41252 + .word 49108 + .word 0 + .word 50839 + .word 20695 + .word 9993 + .word 35851 + .word 16336 + .word 0 + .word 53977 + .word 3173 + .word 20021 + .word 60931 + .word 49099 + .word 0 + .word 21252 + .word 21065 + .word 18238 + .word 47764 + .word 16327 + .word 0 + .word 15598 + .word 48005 + .word 54092 + .word 59667 + .word 49090 + .word 0 + .word 43865 + .word 24204 + .word 30376 + .word 42053 + .word 16317 + .word 0 + .word 25732 + .word 63966 + .word 62259 + .word 44292 + .word 16387 + .word 0 + .word 57042 + .word 17954 + .word 41982 + .word 54649 + .word 16377 + .word 0 + .word 35272 + .word 59341 + .word 60292 + .word 40343 + .word 49141 + .word 0 + .word 50299 + .word 52389 + .word 64962 + .word 59502 + .word 16368 + .word 0 + .word 39701 + .word 8675 + .word 64086 + .word 43833 + .word 49132 + .word 0 + .word 32919 + .word 36749 + .word 17653 + .word 64514 + .word 16359 + .word 0 + .word 20450 + .word 29105 + .word 54347 + .word 47425 + .word 49123 + .word 0 + .word 51457 + .word 46834 + .word 19008 + .word 34827 + .word 16351 + .word 0 + .word 56572 + .word 25900 + .word 35557 + .word 51097 + .word 49114 + .word 0 + .word 52629 + .word 22805 + .word 35492 + .word 37443 + .word 16342 + .word 0 + .word 60134 + .word 44346 + .word 29251 + .word 54790 + .word 49105 + .word 0 + .word 40525 + .word 1894 + .word 29226 + .word 39888 + .word 16333 + .word 0 + .word 58308 + .word 40784 + .word 61879 + .word 56822 + .word 49096 + .word 0 + .word 39626 + .word 13594 + .word 33728 + .word 37362 + .word 16324 + .word 0 + .word 30018 + .word 64156 + .word 50426 + .word 39179 + .word 49087 + .word 0 + .word 26770 + .word 35175 + .word 34395 + .word 46390 + .word 16313 + .word 0 + .word 27380 + .word 54941 + .word 64714 + .word 53060 + .word 16387 + .word 0 + .word 21489 + .word 47049 + .word 52913 + .word 45633 + .word 16377 + .word 0 + .word 34273 + .word 45339 + .word 64425 + .word 56278 + .word 49140 + .word 0 + .word 9281 + .word 44296 + .word 1457 + .word 34678 + .word 16368 + .word 0 + .word 54032 + .word 26533 + .word 19904 + .word 42704 + .word 49131 + .word 0 + .word 4885 + .word 48150 + .word 35442 + .word 52549 + .word 16358 + .word 0 + .word 37026 + .word 46558 + .word 719 + .word 64617 + .word 49121 + .word 0 + .word 24924 + .word 32254 + .word 45168 + .word 39698 + .word 16349 + .word 0 + .word 58798 + .word 11406 + .word 38703 + .word 48743 + .word 49112 + .word 0 + .word 65026 + .word 39487 + .word 36015 + .word 59805 + .word 16339 + .word 0 + .word 17049 + .word 61342 + .word 62907 + .word 36661 + .word 49103 + .word 0 + .word 29048 + .word 51483 + .word 25283 + .word 44910 + .word 16330 + .word 0 + .word 26979 + .word 49508 + .word 25129 + .word 54883 + .word 49093 + .word 0 + .word 1679 + .word 10398 + .word 12735 + .word 33027 + .word 16321 + .word 0 + .word 27523 + .word 22868 + .word 1994 + .word 36413 + .word 49084 + .word 0 + .word 13664 + .word 7895 + .word 2857 + .word 54679 + .word 16310 + .word 0 + .type _ERFC_TABLE,@object + .size _ERFC_TABLE,3840 + .space 768, 0x00 # pad + .align 16 +_EXP_POLY: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .type _EXP_POLY,@object + .size _EXP_POLY,84 + .space 12, 0x00 # pad + .align 16 +_T_TABLE: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 43884 + .word 55705 + .word 60751 + .word 32945 + .word 16383 + .word 0 + .word 1907 + .word 48131 + .word 53747 + .word 33124 + .word 16383 + .word 0 + .word 9708 + .word 29692 + .word 44867 + .word 33304 + .word 16383 + .word 0 + .word 41431 + .word 44075 + .word 34456 + .word 33485 + .word 16383 + .word 0 + .word 60983 + .word 61366 + .word 22862 + .word 33667 + .word 16383 + .word 0 + .word 16454 + .word 44254 + .word 10435 + .word 33850 + .word 16383 + .word 0 + .word 6697 + .word 14236 + .word 63062 + .word 34033 + .word 16383 + .word 0 + .word 31509 + .word 52296 + .word 50023 + .word 34218 + .word 16383 + .word 0 + .word 47620 + .word 37439 + .word 37211 + .word 34404 + .word 16383 + .word 0 + .word 4112 + .word 40589 + .word 24982 + .word 34591 + .word 16383 + .word 0 + .word 55186 + .word 63128 + .word 13695 + .word 34779 + .word 16383 + .word 0 + .word 34087 + .word 37594 + .word 3712 + .word 34968 + .word 16383 + .word 0 + .word 24541 + .word 24974 + .word 60931 + .word 35157 + .word 16383 + .word 0 + .word 64922 + .word 18798 + .word 54645 + .word 35348 + .word 16383 + .word 0 + .word 35108 + .word 11378 + .word 50757 + .word 35540 + .word 16383 + .word 0 + .word 55015 + .word 60043 + .word 49635 + .word 35733 + .word 16383 + .word 0 + .word 19934 + .word 25711 + .word 51652 + .word 35927 + .word 16383 + .word 0 + .word 43494 + .word 32347 + .word 57179 + .word 36122 + .word 16383 + .word 0 + .word 40150 + .word 8934 + .word 1056 + .word 36319 + .word 16383 + .word 0 + .word 21440 + .word 17869 + .word 14731 + .word 36516 + .word 16383 + .word 0 + .word 58820 + .word 59080 + .word 33047 + .word 36714 + .word 16383 + .word 0 + .word 45532 + .word 5222 + .word 56387 + .word 36913 + .word 16383 + .word 0 + .word 45355 + .word 61156 + .word 19595 + .word 37114 + .word 16383 + .word 0 + .word 49974 + .word 43793 + .word 54131 + .word 37315 + .word 16383 + .word 0 + .word 63916 + .word 38193 + .word 29309 + .word 37518 + .word 16383 + .word 0 + .word 59692 + .word 5094 + .word 11055 + .word 37722 + .word 16383 + .word 0 + .word 1206 + .word 43804 + .word 65295 + .word 37926 + .word 16383 + .word 0 + .word 2401 + .word 65271 + .word 61352 + .word 38132 + .word 16383 + .word 0 + .word 32751 + .word 54988 + .word 65158 + .word 38339 + .word 16383 + .word 0 + .word 23040 + .word 8216 + .word 11575 + .word 38548 + .word 16383 + .word 0 + .word 45198 + .word 61818 + .word 32073 + .word 38757 + .word 16383 + .word 0 + .word 43375 + .word 36280 + .word 61521 + .word 38967 + .word 16383 + .word 0 + .word 35242 + .word 26305 + .word 34786 + .word 39179 + .word 16383 + .word 0 + .word 64101 + .word 8375 + .word 17811 + .word 39392 + .word 16383 + .word 0 + .word 34378 + .word 38143 + .word 11004 + .word 39606 + .word 16383 + .word 0 + .word 21817 + .word 54606 + .word 14777 + .word 39821 + .word 16383 + .word 0 + .word 11309 + .word 11971 + .word 29544 + .word 40037 + .word 16383 + .word 0 + .word 46929 + .word 11519 + .word 55719 + .word 40254 + .word 16383 + .word 0 + .word 9248 + .word 40263 + .word 28184 + .word 40473 + .word 16383 + .word 0 + .word 4526 + .word 37281 + .word 12896 + .word 40693 + .word 16383 + .word 0 + .word 56582 + .word 25600 + .word 10277 + .word 40914 + .word 16383 + .word 0 + .word 20418 + .word 47473 + .word 20751 + .word 41136 + .word 16383 + .word 0 + .word 46820 + .word 34116 + .word 44746 + .word 41359 + .word 16383 + .word 0 + .word 26649 + .word 3145 + .word 17155 + .word 41584 + .word 16383 + .word 0 + .word 48019 + .word 59394 + .word 3944 + .word 41810 + .word 16383 + .word 0 + .word 32926 + .word 2534 + .word 5550 + .word 42037 + .word 16383 + .word 0 + .word 62265 + .word 48798 + .word 22406 + .word 42265 + .word 16383 + .word 0 + .word 14570 + .word 45393 + .word 54953 + .word 42494 + .word 16383 + .word 0 + .word 27422 + .word 61160 + .word 38095 + .word 42725 + .word 16383 + .word 0 + .word 13674 + .word 59749 + .word 37812 + .word 42957 + .word 16383 + .word 0 + .word 3593 + .word 31538 + .word 54550 + .word 43190 + .word 16383 + .word 0 + .word 3832 + .word 60028 + .word 23220 + .word 43425 + .word 16383 + .word 0 + .word 30249 + .word 60560 + .word 9810 + .word 43661 + .word 16383 + .word 0 + .word 54071 + .word 43326 + .word 14773 + .word 43898 + .word 16383 + .word 0 + .word 59689 + .word 48703 + .word 38564 + .word 44136 + .word 16383 + .word 0 + .word 19142 + .word 17057 + .word 16106 + .word 44376 + .word 16383 + .word 0 + .word 47118 + .word 51765 + .word 13394 + .word 44617 + .word 16383 + .word 0 + .word 17269 + .word 26890 + .word 30893 + .word 44859 + .word 16383 + .word 0 + .word 17796 + .word 46816 + .word 3531 + .word 45103 + .word 16383 + .word 0 + .word 9616 + .word 53932 + .word 62849 + .word 45347 + .word 16383 + .word 0 + .word 65083 + .word 26136 + .word 12710 + .word 45594 + .word 16383 + .word 0 + .word 9353 + .word 43281 + .word 50194 + .word 45841 + .word 16383 + .word 0 + .word 38977 + .word 25931 + .word 44706 + .word 46090 + .word 16383 + .word 0 + .word 25732 + .word 63966 + .word 62259 + .word 46340 + .word 16383 + .word 0 + .word 63340 + .word 24277 + .word 37800 + .word 46592 + .word 16383 + .word 0 + .word 30609 + .word 10449 + .word 37347 + .word 46845 + .word 16383 + .word 0 + .word 7804 + .word 36004 + .word 61386 + .word 47099 + .word 16383 + .word 0 + .word 40681 + .word 25339 + .word 44871 + .word 47355 + .word 16383 + .word 0 + .word 40427 + .word 11275 + .word 53829 + .word 47612 + .word 16383 + .word 0 + .word 17915 + .word 4926 + .word 23218 + .word 47871 + .word 16383 + .word 0 + .word 64269 + .word 62185 + .word 19070 + .word 48131 + .word 16383 + .word 0 + .word 14015 + .word 22540 + .word 41887 + .word 48392 + .word 16383 + .word 0 + .word 37858 + .word 34313 + .word 26633 + .word 48655 + .word 16383 + .word 0 + .word 4227 + .word 31347 + .word 39350 + .word 48919 + .word 16383 + .word 0 + .word 36272 + .word 61648 + .word 15009 + .word 49185 + .word 16383 + .word 0 + .word 37974 + .word 26224 + .word 19658 + .word 49452 + .word 16383 + .word 0 + .word 26227 + .word 7741 + .word 53809 + .word 49720 + .word 16383 + .word 0 + .word 25607 + .word 9367 + .word 52442 + .word 49990 + .word 16383 + .word 0 + .word 52019 + .word 21300 + .word 16076 + .word 50262 + .word 16383 + .word 0 + .word 56029 + .word 21766 + .word 10769 + .word 50535 + .word 16383 + .word 0 + .word 24441 + .word 43556 + .word 37045 + .word 50809 + .word 16383 + .word 0 + .word 45405 + .word 43961 + .word 29896 + .word 51085 + .word 16383 + .word 0 + .word 11333 + .word 36862 + .word 55388 + .word 51362 + .word 16383 + .word 0 + .word 10147 + .word 28207 + .word 48518 + .word 51641 + .word 16383 + .word 0 + .word 30542 + .word 17040 + .word 9822 + .word 51922 + .word 16383 + .word 0 + .word 31837 + .word 62066 + .word 5374 + .word 52204 + .word 16383 + .word 0 + .word 52690 + .word 20541 + .word 35718 + .word 52487 + .word 16383 + .word 0 + .word 32996 + .word 8068 + .word 35861 + .word 52772 + .word 16383 + .word 0 + .word 6337 + .word 6425 + .word 6351 + .word 53059 + .word 16383 + .word 0 + .word 9621 + .word 61227 + .word 13274 + .word 53347 + .word 16383 + .word 0 + .word 39622 + .word 20841 + .word 57186 + .word 53636 + .word 16383 + .word 0 + .word 58458 + .word 61738 + .word 7569 + .word 53928 + .word 16383 + .word 0 + .word 50041 + .word 34202 + .word 61593 + .word 54220 + .word 16383 + .word 0 + .word 64031 + .word 53229 + .word 23211 + .word 54515 + .word 16383 + .word 0 + .word 52743 + .word 40859 + .word 24062 + .word 54811 + .word 16383 + .word 0 + .word 27380 + .word 54941 + .word 64714 + .word 55108 + .word 16383 + .word 0 + .word 11396 + .word 28083 + .word 14668 + .word 55408 + .word 16383 + .word 0 + .word 55222 + .word 30895 + .word 5570 + .word 55709 + .word 16383 + .word 0 + .word 52338 + .word 10953 + .word 37999 + .word 56011 + .word 16383 + .word 0 + .word 14165 + .word 56050 + .word 46999 + .word 56315 + .word 16383 + .word 0 + .word 19488 + .word 2098 + .word 33157 + .word 56621 + .word 16383 + .word 0 + .word 37156 + .word 24078 + .word 62594 + .word 56928 + .word 16383 + .word 0 + .word 17440 + .word 47344 + .word 4830 + .word 57238 + .word 16383 + .word 0 + .word 57617 + .word 10900 + .word 57068 + .word 57548 + .word 16383 + .word 0 + .word 54121 + .word 65155 + .word 23295 + .word 57861 + .word 16383 + .word 0 + .word 23121 + .word 48778 + .word 35186 + .word 58175 + .word 16383 + .word 0 + .word 43149 + .word 14141 + .word 27808 + .word 58491 + .word 16383 + .word 0 + .word 18600 + .word 31875 + .word 1767 + .word 58809 + .word 16383 + .word 0 + .word 52770 + .word 60959 + .word 23210 + .word 59128 + .word 16383 + .word 0 + .word 56424 + .word 15435 + .word 27216 + .word 59449 + .word 16383 + .word 0 + .word 35927 + .word 27727 + .word 14400 + .word 59772 + .word 16383 + .word 0 + .word 14639 + .word 56612 + .word 50919 + .word 60096 + .word 16383 + .word 0 + .word 48604 + .word 19484 + .word 6326 + .word 60423 + .word 16383 + .word 0 + .word 11140 + .word 55700 + .word 12318 + .word 60751 + .word 16383 + .word 0 + .word 603 + .word 3491 + .word 3992 + .word 61081 + .word 16383 + .word 0 + .word 62923 + .word 56538 + .word 47515 + .word 61412 + .word 16383 + .word 0 + .word 17673 + .word 44297 + .word 12455 + .word 61746 + .word 16383 + .word 0 + .word 45370 + .word 23039 + .word 30524 + .word 62081 + .word 16383 + .word 0 + .word 6747 + .word 14948 + .word 36830 + .word 62418 + .word 16383 + .word 0 + .word 52268 + .word 9350 + .word 32021 + .word 62757 + .word 16383 + .word 0 + .word 33902 + .word 29503 + .word 16748 + .word 63098 + .word 16383 + .word 0 + .word 15289 + .word 2769 + .word 57203 + .word 63440 + .word 16383 + .word 0 + .word 47732 + .word 24020 + .word 22971 + .word 63785 + .word 16383 + .word 0 + .word 826 + .word 29226 + .word 45787 + .word 64131 + .word 16383 + .word 0 + .word 40009 + .word 58864 + .word 60780 + .word 64479 + .word 16383 + .word 0 + .word 49525 + .word 62598 + .word 3084 + .word 64830 + .word 16383 + .word 0 + .word 34892 + .word 31631 + .word 4444 + .word 65182 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .type _T_TABLE,@object + .size _T_TABLE,1548 + .space 4, 0x00 # pad + .align 8 +.L_2il0floatpacket.0: + .long 0x00100000,0x41f00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 2 +_EXPL_TABLE: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16390 + .word 0 + .word 0 + .word 53760 + .word 6135 + .word 45426 + .word 16375 + .word 0 + .word 40944 + .word 28977 + .word 20696 + .word 49689 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 16382 + .word 0 + .word 1 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 1 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 1 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _EXPL_TABLE,@object + .size _EXPL_TABLE,96 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/erfcf.S b/external/sgx_libm/ia32/erfcf.S new file mode 100644 index 0000000000..468faf1c02 --- /dev/null +++ b/external/sgx_libm/ia32/erfcf.S @@ -0,0 +1,635 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfcf.c" + .text +..TXTST0: +# -- Begin erfcf + .text + .align 16,0x90 + .globl erfcf +erfcf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + movl 8(%ebp), %edi + movl %edi, %eax + andl $2147483647, %eax + shrl $31, %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2139095040, %eax + jae ..B1.24 +..B1.2: + cmpl range@GOTOFF(%ebx,%edi,4), %eax + jae ..B1.21 +..B1.3: + cmpl $1081081856, %eax + jae ..B1.15 +..B1.4: + cmpl $1073741824, %eax + jae ..B1.11 +..B1.5: + cmpl $1056964608, %eax + jae ..B1.10 +..B1.6: + flds 8(%ebp) + cmpl $847249408, %eax + jae ..B1.8 +..B1.7: + fld1 + fsubp %st, %st(1) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.8: + fldl 40+_A@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fld1 + fxch %st(3) + faddl 24+_A@GOTOFF(%ebx) + fmul %st(1), %st + fldl 48+_A@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 8+_A@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(1) + faddl 32+_A@GOTOFF(%ebx) + fmul %st(1), %st + faddl 16+_A@GOTOFF(%ebx) + fmulp %st, %st(1) + faddl _A@GOTOFF(%ebx) + fmulp %st, %st(2) + faddp %st, %st(1) +..B1.9: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.10: + flds 8(%ebp) + fabs + fld1 + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 48+_AP@GOTOFF(%ebx) + fmul %st(1), %st + fldl 56+_AP@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 32+_AP@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 40+_AP@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 16+_AP@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 24+_AP@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _AP@GOTOFF(%ebx) + fldl 48+_AQ@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + faddl 8+_AP@GOTOFF(%ebx) + fmul %st(4), %st + faddp %st, %st(1) + fldl 56+_AQ@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + faddl 32+_AQ@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + faddl 40+_AQ@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + faddl 16+_AQ@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + faddl 24+_AQ@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(1) + faddl _AQ@GOTOFF(%ebx) + fxch %st(2) + faddl 8+_AQ@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fdivrp %st, %st(1) + fmuls _ones@GOTOFF(%ebx,%edi,4) + faddl _erfc1@GOTOFF(%ebx,%edi,8) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + flds 8(%ebp) + testl %edi, %edi + fabs + faddl .L_2il0floatpacket.2@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + je ..B1.13 +..B1.12: + fldl 48+_BP1@GOTOFF(%ebx) + fmul %st(1), %st + fldl 40+_BP1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 32+_BP1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 24+_BP1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 16+_BP1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 8+_BP1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl _BP1@GOTOFF(%ebx) + fldl 48+_BQ1@GOTOFF(%ebx) + fmul %st(3), %st + fldl 40+_BQ1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 32+_BQ1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_BQ1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_BQ1@GOTOFF(%ebx) + fmulp %st, %st(4) + faddl 8+_BQ1@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(2) + faddl _BQ1@GOTOFF(%ebx) + fxch %st(2) + jmp ..B1.14 +..B1.13: + fldl 80+_BP2@GOTOFF(%ebx) + fmul %st(1), %st + fldl 88+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 64+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 72+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 48+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 56+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 32+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 40+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 16+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 24+_BP2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _BP2@GOTOFF(%ebx) + fldl 64+_BQ2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(2) + faddl 8+_BP2@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl 48+_BQ2@GOTOFF(%ebx) + fmul %st(3), %st + fldl 56+_BQ2@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 32+_BQ2@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 40+_BQ2@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_BQ2@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_BQ2@GOTOFF(%ebx) + fmulp %st, %st(4) + faddl _BQ2@GOTOFF(%ebx) + fxch %st(3) + faddl 8+_BQ2@GOTOFF(%ebx) + fmulp %st, %st(4) +..B1.14: + faddp %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fdivrp %st, %st(1) + fmuls _ones@GOTOFF(%ebx,%edi,4) + faddl _erfc4@GOTOFF(%ebx,%edi,8) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + flds 8(%ebp) + fabs + fld1 + fdiv %st(1), %st + fstpl 24(%esp) + fmul %st(0), %st + fchs + fstpl (%esp) + call __libm_exp_k32 +..B1.16: + fldl 24(%esp) + testl %edi, %edi + fmul %st, %st(1) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fldl 56+_R1@GOTOFF(%ebx) + fmul %st(1), %st + fldl 48+_R1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 40+_R1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 32+_R1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 24+_R1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 16+_R1@GOTOFF(%ebx) + fmulp %st, %st(2) + faddl 8+_R1@GOTOFF(%ebx) + fmulp %st, %st(2) + faddl _R1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + jne ..B1.20 +..B1.17: + fsts 20(%esp) + cmpl $8388608, 20(%esp) + jl ..B1.28 +..B1.19: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.20: + fsubrs .L_2il0floatpacket.0@GOTOFF(%ebx) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.21: + testl %edi, %edi + je ..B1.29 +..B1.22: + flds .L_2il0floatpacket.0@GOTOFF(%ebx) +..B1.23: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.24: + jne ..B1.26 +..B1.25: + flds zero_two@GOTOFF(%ebx,%edi,4) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + flds 8(%ebp) +..B1.27: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.28: + fstp %st(0) + flds .L_2il0floatpacket.1@GOTOFF(%ebx) + fmul %st(0), %st + fstps 16(%esp) + flds 20(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + flds .L_2il0floatpacket.1@GOTOFF(%ebx) + fmul %st(0), %st + fsts 20(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type erfcf,@function + .size erfcf,.-erfcf + .data +# -- End erfcf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0xc0000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x40000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x0d800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +range: + .long 1092825907 + .long 1081791557 + .type range,@object + .size range,8 + .align 4 +_A: + .long 1346541978 + .long 3220311511 + .long 1794662342 + .long 1071125108 + .long 250944106 + .long 3216827122 + .long 215131671 + .long 1067156170 + .long 548330146 + .long 3212141823 + .long 76350191 + .long 1061937114 + .long 2772654316 + .long 3206307213 + .type _A,@object + .size _A,56 + .align 4 +_AP: + .long 4064916629 + .long 3190878451 + .long 2877165718 + .long 3218164236 + .long 2764139057 + .long 1068232842 + .long 168293639 + .long 3215329394 + .long 881203975 + .long 3215292554 + .long 342818617 + .long 1065638313 + .long 817546319 + .long 3212004140 + .long 1510911299 + .long 3202390104 + .type _AP,@object + .size _AP,64 + .align 4 +_AQ: + .long 1883560946 + .long 1071960885 + .long 853592313 + .long 1071685196 + .long 191605458 + .long 1071250674 + .long 2183121159 + .long 1070390698 + .long 3347411101 + .long 1068928985 + .long 273856425 + .long 1067608207 + .long 671820230 + .long 1065177551 + .long 2414119437 + .long 1063328696 + .type _AQ,@object + .size _AQ,64 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_erfc1: + .long 1879048192 + .long 1069818465 + .long 3523215360 + .long 1073576883 + .type _erfc1,@object + .size _erfc1,16 + .align 4 +_BP1: + .long 4019088381 + .long 1060143686 + .long 4231883845 + .long 3209038463 + .long 1510730124 + .long 1061755778 + .long 2929202078 + .long 3208591153 + .long 1409179897 + .long 1059475758 + .long 439372548 + .long 3204538649 + .long 3357266387 + .long 1053229132 + .type _BP1,@object + .size _BP1,56 + .align 4 +_BQ1: + .long 3444570556 + .long 1068208773 + .long 4145425017 + .long 1069029647 + .long 1145740212 + .long 1069192522 + .long 2413502193 + .long 1068797491 + .long 2712383784 + .long 1068007659 + .long 3941762314 + .long 1066743858 + .long 3272105283 + .long 1065447630 + .type _BQ1,@object + .size _BQ1,56 + .align 4 +_BP2: + .long 3138848853 + .long 1062211012 + .long 544119287 + .long 3211644465 + .long 2662071917 + .long 1064935492 + .long 2106254088 + .long 3212505578 + .long 377059754 + .long 1064517936 + .long 3523110848 + .long 3210978388 + .long 64932799 + .long 1062023575 + .long 2232373525 + .long 3207568747 + .long 3004568351 + .long 1057518327 + .long 1553969795 + .long 3201939481 + .long 865068135 + .long 1050709866 + .long 348213498 + .long 3193161330 + .type _BP2,@object + .size _BP2,96 + .align 4 +_BQ2: + .long 2220299070 + .long 1070256111 + .long 1607355279 + .long 1069737707 + .long 3222185356 + .long 1069664669 + .long 1988590515 + .long 1068489586 + .long 2612211906 + .long 1067468794 + .long 3802943557 + .long 1065572613 + .long 4286646379 + .long 1063895282 + .long 45248763 + .long 1061257684 + .long 3494068347 + .long 1058887001 + .type _BQ2,@object + .size _BQ2,72 + .align 4 +_erfc4: + .long 0 + .long 1045463040 + .long 4225761280 + .long 1073741823 + .type _erfc4,@object + .size _erfc4,16 + .align 4 +_R1: + .long 1340517714 + .long 1071779287 + .long 1760660317 + .long 3218214358 + .long 3277598851 + .long 1071322187 + .long 1776282588 + .long 3220235438 + .long 2229586924 + .long 1074588991 + .long 2042215417 + .long 3224150558 + .long 1374528972 + .long 1078534706 + .long 1825320511 + .long 3227067102 + .type _R1,@object + .size _R1,64 + .align 4 +zero_two: + .long 0x00000000 + .long 0x40000000 + .type zero_two,@object + .size zero_two,8 + .data + .hidden __libm_exp_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/erfcl.S b/external/sgx_libm/ia32/erfcl.S new file mode 100644 index 0000000000..4433175004 --- /dev/null +++ b/external/sgx_libm/ia32/erfcl.S @@ -0,0 +1,3850 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfcl.c" + .text +..TXTST0: +# -- Begin erfcl + .text + .align 16,0x90 + .globl erfcl +erfcl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + fldt 8(%ebp) + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 148(%esp) + fstpt 56(%esp) +..B1.2: + fnstcw 70(%esp) +..B1.3: + movzwl 70(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.76 +..B1.4: + orl $-64768, %edx + movw %dx, 68(%esp) +..B1.5: + fldcw 68(%esp) +..B1.6: + movl $1, %edx +..B1.7: + movl 16(%ebp), %eax + movl %eax, %esi + shrl $15, %esi + andl $32767, %eax + andl $1, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $32767, %eax + je ..B1.56 +..B1.8: + fldt 8(%ebp) + fldl _zeros@GOTOFF(%ebx) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.9 + je ..B1.51 +..B1.9: + fldt _erfcl_RT1@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.15 + jp ..B1.15 +..B1.10: + fldt 12+_erfcl_RT1@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B1.15 +..B1.11: + fstp %st(0) + fldt _Epsilon@GOTOFF(%ebx) + testl %edx, %edx + fsubrl _ones@GOTOFF(%ebx) + fstpt 12(%esp) + je ..B1.13 +..B1.12: + fldcw 70(%esp) +..B1.13: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 +..B1.14: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + fldl 8+_erfcl_ASYMPT@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B1.46 +..B1.16: + fcompl _erfcl_ASYMPT@GOTOFF(%ebx) + fnstsw %ax + sahf + jae ..B1.21 +..B1.17: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + testl %edx, %edx + fldt _Epsilon@GOTOFF(%ebx) + fsubrp %st, %st(1) + fstpt 12(%esp) + je ..B1.19 +..B1.18: + fldcw 70(%esp) +..B1.19: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 +..B1.20: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.21: + fldl _ones@GOTOFF(%ebx) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + andl $32767, 64(%esp) + fstpt 24(%esp) + fldt 24(%esp) + fldt 56(%esp) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 12(%esp) + fld %st(0) + fmulp %st, %st(2) + fld %st(0) + movl 20(%esp), %edi + fsub %st(2), %st + andl $32767, %edi + faddp %st, %st(2) + fld %st(1) + lea -16383(%edi), %eax + fmul %st(2), %st + movl %edi, 52(%esp) + movl %eax, %edi + shll $6, %edi + fchs + fld %st(1) + shll $7, %eax + fsub %st(3), %st + fmul %st, %st(3) + addl %eax, %edi + fxch %st(3) + fchs + lea 100(%esp), %eax + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + fstpt 12(%eax) + addl $-16, %esp + fstpt (%eax) + lea 140(%esp), %ecx + movl %ecx, (%esp) + movl %eax, 4(%esp) + fstpt -60(%eax) + movl %edx, -64(%eax) + call __libm_expl_k80 +..B1.79: + fldt 56(%esp) + movl 52(%esp), %edx + addl $16, %esp +..B1.22: + fldl _TWO_63H@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + movl 12(%esp), %ecx + cmpl $-16300, %ecx + fstpt 12(%esp) + fldt 12(%esp) + jle ..B1.24 +..B1.23: + fldt 124(%esp) + addl $16383, %ecx + movzwl 20(%esp), %eax + andl $32767, %ecx + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 20(%esp) + lea 136(%esp), %eax + fldt (%eax) + fxch %st(1) + jmp ..B1.25 +..B1.24: + fldl _TWO_POW_M400@GOTOFF(%ebx) + fldt 124(%esp) + movl %edi, 36(%esp) + movzwl 20(%esp), %edi + movl %edi, %eax + andl $-32768, %eax + fmul %st(1), %st + lea 400(%edi,%ecx), %ecx + andl $32767, %ecx + orl %ecx, %eax + movw %ax, 20(%esp) + lea 136(%esp), %eax + fldt (%eax) + fmulp %st, %st(2) + movl -100(%eax), %edi +..B1.25: + fldt 24(%esp) + fld %st(1) + fxch %st(1) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%eax) + fldt (%eax) + fxch %st(1) + fstpt 124(%esp) + fldt 56(%esp) + fldt _erfcl_CHDX@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.27 +..B1.26: + fldl _erfcl_DX@GOTOFF(%ebx) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + fadd %st(2), %st + fxch %st(1) + jmp ..B1.28 +..B1.27: + fldl 8+_erfcl_DX@GOTOFF(%ebx) + fld %st(1) + fadd %st(1), %st + fld %st(2) + fsub %st(1), %st + faddp %st, %st(2) +..B1.28: + fldt 24(%esp) + testl %esi, %esi + fld %st(0) + fld %st(2) + fxch %st(6) + fstpt 88(%esp) + fld %st(2) + movl 52(%esp), %ecx + fadd %st(4), %st + fdivr %st(7), %st + lea -131064(,%ecx,8), %eax + fmul %st, %st(1) + lea -65532(%eax,%ecx,4), %eax + fxch %st(7) + fstpt 40(%esp) + fld %st(0) + fadd %st(7), %st + fsubp %st, %st(1) + fsubr %st, %st(6) + fld %st(2) + fmul %st(2), %st + fadd %st, %st(6) + fsubrp %st, %st(6) + fxch %st(2) + fsub %st(5), %st + faddp %st, %st(3) + fld %st(5) + fmul %st(3), %st + fld %st(2) + fmul %st(6), %st + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(5) + fmul %st(6), %st + faddp %st, %st(5) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fld %st(0) + fsub %st(3), %st + fxch %st(1) + fstpt 56(%esp) + fldt 56(%esp) + fsub %st(1), %st + fsubp %st, %st(3) + fxch %st(5) + fsubrp %st, %st(2) + fld %st(0) + fmul %st(5), %st + fld %st(5) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fld %st(5) + fmul %st(2), %st + fld %st(3) + fmul %st(6), %st + fxch %st(3) + fmulp %st, %st(4) + faddp %st, %st(3) + fld %st(0) + fmul %st(2), %st + fxch %st(5) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(2) + fld %st(0) + fadd %st(4), %st + fsubp %st, %st(4) + fsub %st(3), %st + faddp %st, %st(1) + fldt _erfcl_C@GOTOFF(%eax,%ebx) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fldt 168+_erfcl_Q@GOTOFF(%ebx,%edi) + fmul %st(1), %st + fldt 144+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 120+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt _erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fldt 180+_erfcl_Q@GOTOFF(%ebx,%edi) + fmul %st(2), %st + fldt 156+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 132+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 108+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 12+_erfcl_Q@GOTOFF(%ebx,%edi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(3) + fldt 40(%esp) + fld %st(0) + fadd %st(4), %st + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fld %st(5) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldt 88(%esp) + fldt _erfcl_S@GOTOFF(%eax,%ebx) + fmul %st, %st(5) + fxch %st(3) + fmul %st(5), %st + fxch %st(3) + fmulp %st, %st(2) + fld %st(4) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldt 72(%esp) + fld %st(0) + fmul %st(5), %st + fmul %st, %st(7) + fxch %st(3) + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(2) + fadd %st(7), %st + fsubp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 12(%esp) + je ..B1.30 +..B1.29: + fldt 56(%esp) + fxch %st(1) + fmul %st, %st(2) + fmulp %st, %st(3) + fld %st(0) + fsub %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + fsub %st(2), %st + fsub %st(3), %st + faddp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + jmp ..B1.33 +..B1.30: + fld %st(1) + fadd %st(3), %st + fmul %st(1), %st + fstpt 12(%esp) + movzwl 20(%esp), %eax + testl $32767, %eax + jne ..B1.33 +..B1.31: + movzwl 18(%esp), %eax + testl %eax, %eax + jbe ..B1.33 +..B1.32: + fldt 24(%esp) + fmul %st(2), %st + fld %st(2) + fsubr %st(1), %st + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + fadd %st(3), %st + fmul %st(1), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 12(%esp) +..B1.33: + fstp %st(0) + fstp %st(1) + fstp %st(0) + fldt 8(%ebp) + fldt _erfcl_UNDERFLOW_INT@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jp ..B1.34 + jbe ..B1.41 +..B1.34: + testl %edx, %edx + je ..B1.36 +..B1.35: + fldcw 70(%esp) +..B1.36: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 +..B1.37: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.41: + fldt _small_value_80@GOTOFF(%ebx) + testl %edx, %edx + fmul %st(0), %st + fstpt (%esp) + je ..B1.43 +..B1.42: + fldcw 70(%esp) +..B1.43: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 + jmp ..B1.14 +..B1.46: + fstp %st(0) + fldt _Epsilon@GOTOFF(%ebx) + testl %edx, %edx + fmul %st(0), %st + fstpt 12(%esp) + je ..B1.48 +..B1.47: + fldcw 70(%esp) +..B1.48: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 + jmp ..B1.14 +..B1.51: + fstp %st(0) + fldl _ones@GOTOFF(%ebx) + testl %edx, %edx + fstpt 12(%esp) + je ..B1.53 +..B1.52: + fldcw 70(%esp) +..B1.53: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 + jmp ..B1.14 +..B1.56: + movl 12(%ebp), %eax + testl %esi, %esi + jne ..B1.63 +..B1.57: + cmpl $-2147483648, %eax + jne ..B1.69 +..B1.58: + cmpl $0, 8(%ebp) + jne ..B1.69 +..B1.59: + fldl _zeros@GOTOFF(%ebx) + testl %edx, %edx + fstpt 12(%esp) + je ..B1.61 +..B1.60: + fldcw 70(%esp) +..B1.61: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 +..B1.62: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.63: + cmpl $-2147483648, %eax + jne ..B1.69 +..B1.64: + cmpl $0, 8(%ebp) + jne ..B1.69 +..B1.65: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + testl %edx, %edx + fstpt 12(%esp) + je ..B1.67 +..B1.66: + fldcw 70(%esp) +..B1.67: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 +..B1.68: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.69: + fldt 8(%ebp) + testl %edx, %edx + fmull _ones@GOTOFF(%ebx) + fstpt 12(%esp) + je ..B1.71 +..B1.70: + fldcw 70(%esp) +..B1.71: + fldt 12(%esp) + movl 148(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.38 +..B1.72: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.76: + xorl %edx, %edx + jmp ..B1.7 + .align 16,0x90 + .type erfcl,@function + .size erfcl,.-erfcl + .data +# -- End erfcl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_erfcl_ASYMPT: + .long 0 + .long 3222929408 + .long 0 + .long 1079689216 + .type _erfcl_ASYMPT,@object + .size _erfcl_ASYMPT,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_POW_M400: + .long 0 + .long 653262848 + .type _TWO_POW_M400,@object + .size _TWO_POW_M400,8 + .align 4 +_erfcl_DX: + .long 0 + .long 1072431104 + .long 0 + .long 1071906816 + .type _erfcl_DX,@object + .size _erfcl_DX,16 + .align 2 +_erfcl_RT1: + .word 21820 + .word 42875 + .word 50317 + .word 58079 + .word 49086 + .word 0 + .word 21820 + .word 42875 + .word 50317 + .word 58079 + .word 16317 + .word 0 + .type _erfcl_RT1,@object + .size _erfcl_RT1,24 + .align 2 +_Epsilon: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _Epsilon,@object + .size _Epsilon,12 + .align 2 +_erfcl_CHDX: + .word 54762 + .word 44346 + .word 63893 + .word 44681 + .word 16382 + .word 0 + .type _erfcl_CHDX,@object + .size _erfcl_CHDX,12 + .align 2 +_erfcl_C: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50944 + .word 39545 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 61184 + .word 35913 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 55108 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 38967 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58112 + .word 52540 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 34340 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 43938 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 55351 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 34462 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 42532 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 52130 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 63543 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 38558 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 46628 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 56226 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 63488 + .word 33819 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 40606 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 48676 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 58274 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 63488 + .word 34843 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 41630 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 49700 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 59298 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 63488 + .word 35355 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 42142 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 50212 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 54690 + .word 16389 + .word 0 + .type _erfcl_C,@object + .size _erfcl_C,336 + .align 2 +_erfcl_Q: + .word 13465 + .word 63964 + .word 23888 + .word 38962 + .word 49066 + .word 0 + .word 56793 + .word 9364 + .word 2074 + .word 60725 + .word 16376 + .word 0 + .word 38094 + .word 52495 + .word 21659 + .word 37955 + .word 49149 + .word 0 + .word 56255 + .word 60659 + .word 19352 + .word 51197 + .word 16381 + .word 0 + .word 38745 + .word 34996 + .word 58130 + .word 47148 + .word 49149 + .word 0 + .word 27061 + .word 31727 + .word 37700 + .word 35458 + .word 16381 + .word 0 + .word 30316 + .word 60982 + .word 15920 + .word 46457 + .word 49148 + .word 0 + .word 52759 + .word 48094 + .word 27926 + .word 54790 + .word 16379 + .word 0 + .word 31704 + .word 15513 + .word 33742 + .word 59335 + .word 49146 + .word 0 + .word 10280 + .word 12123 + .word 40636 + .word 59798 + .word 16377 + .word 0 + .word 55231 + .word 62106 + .word 54809 + .word 56625 + .word 49144 + .word 0 + .word 36666 + .word 22902 + .word 8427 + .word 50746 + .word 16375 + .word 0 + .word 46592 + .word 43726 + .word 50753 + .word 43230 + .word 49142 + .word 0 + .word 64491 + .word 43284 + .word 59259 + .word 34800 + .word 16373 + .word 0 + .word 61229 + .word 19548 + .word 49801 + .word 49926 + .word 49139 + .word 0 + .word 1687 + .word 39069 + .word 16746 + .word 48555 + .word 16369 + .word 0 + .word 55359 + .word 55853 + .word 34963 + .word 33408 + .word 16366 + .word 0 + .word 24851 + .word 44488 + .word 55772 + .word 44700 + .word 49147 + .word 0 + .word 44447 + .word 58130 + .word 38723 + .word 40258 + .word 49147 + .word 0 + .word 1500 + .word 15080 + .word 64595 + .word 34359 + .word 16380 + .word 0 + .word 52078 + .word 14763 + .word 48694 + .word 63117 + .word 49147 + .word 0 + .word 4694 + .word 53159 + .word 65475 + .word 45416 + .word 16379 + .word 0 + .word 37430 + .word 32424 + .word 1930 + .word 56261 + .word 49146 + .word 0 + .word 33679 + .word 45771 + .word 8173 + .word 62515 + .word 16377 + .word 0 + .word 49757 + .word 3681 + .word 5948 + .word 63753 + .word 49144 + .word 0 + .word 9193 + .word 10955 + .word 22026 + .word 60547 + .word 16375 + .word 0 + .word 55541 + .word 20458 + .word 54828 + .word 54096 + .word 49142 + .word 0 + .word 47142 + .word 16345 + .word 20299 + .word 45812 + .word 16373 + .word 0 + .word 29126 + .word 37494 + .word 48225 + .word 36984 + .word 49140 + .word 0 + .word 15107 + .word 34726 + .word 44130 + .word 57191 + .word 16370 + .word 0 + .word 57806 + .word 26620 + .word 53230 + .word 42777 + .word 49137 + .word 0 + .word 45097 + .word 47803 + .word 25447 + .word 61330 + .word 16367 + .word 0 + .word 40016 + .word 15109 + .word 58793 + .word 33461 + .word 16367 + .word 0 + .word 6456 + .word 21547 + .word 27586 + .word 56453 + .word 49147 + .word 0 + .word 5294 + .word 26959 + .word 24309 + .word 57122 + .word 49144 + .word 0 + .word 9256 + .word 20178 + .word 27285 + .word 56054 + .word 16378 + .word 0 + .word 11974 + .word 6713 + .word 58610 + .word 53898 + .word 49146 + .word 0 + .word 56155 + .word 5104 + .word 43351 + .word 37953 + .word 16378 + .word 0 + .word 31236 + .word 18492 + .word 31580 + .word 45205 + .word 49145 + .word 0 + .word 20337 + .word 4737 + .word 24808 + .word 48018 + .word 16376 + .word 0 + .word 43780 + .word 34731 + .word 45426 + .word 46730 + .word 49143 + .word 0 + .word 61467 + .word 48142 + .word 38368 + .word 42346 + .word 16374 + .word 0 + .word 39936 + .word 34435 + .word 51154 + .word 36121 + .word 49141 + .word 0 + .word 41171 + .word 26385 + .word 45942 + .word 58461 + .word 16371 + .word 0 + .word 31471 + .word 18426 + .word 18937 + .word 45145 + .word 49138 + .word 0 + .word 23734 + .word 23053 + .word 7429 + .word 33424 + .word 16369 + .word 0 + .word 28624 + .word 21549 + .word 30360 + .word 48021 + .word 49135 + .word 0 + .word 9108 + .word 57175 + .word 16609 + .word 33031 + .word 16366 + .word 0 + .word 44968 + .word 30293 + .word 53704 + .word 38182 + .word 16364 + .word 0 + .word 63279 + .word 65139 + .word 8683 + .word 42110 + .word 49144 + .word 0 + .word 43283 + .word 52727 + .word 26719 + .word 56933 + .word 49146 + .word 0 + .word 18528 + .word 63869 + .word 40120 + .word 60712 + .word 16378 + .word 0 + .word 28913 + .word 42968 + .word 213 + .word 43569 + .word 49146 + .word 0 + .word 2240 + .word 11347 + .word 26371 + .word 51717 + .word 16377 + .word 0 + .word 7147 + .word 20723 + .word 31050 + .word 54241 + .word 49144 + .word 0 + .word 49648 + .word 51324 + .word 11444 + .word 51872 + .word 16375 + .word 0 + .word 8690 + .word 5809 + .word 9903 + .word 46065 + .word 49142 + .word 0 + .word 1296 + .word 54160 + .word 11620 + .word 38443 + .word 16373 + .word 0 + .word 251 + .word 19098 + .word 34161 + .word 60807 + .word 49139 + .word 0 + .word 46412 + .word 5592 + .word 55877 + .word 45861 + .word 16370 + .word 0 + .word 5959 + .word 21591 + .word 50019 + .word 33145 + .word 49137 + .word 0 + .word 2025 + .word 457 + .word 9244 + .word 46095 + .word 16367 + .word 0 + .word 54038 + .word 55252 + .word 55370 + .word 62518 + .word 49133 + .word 0 + .word 47036 + .word 16304 + .word 12880 + .word 40628 + .word 16364 + .word 0 + .word 18241 + .word 19196 + .word 21406 + .word 57530 + .word 16365 + .word 0 + .word 21199 + .word 5012 + .word 49009 + .word 34179 + .word 49146 + .word 0 + .word 54990 + .word 53386 + .word 65270 + .word 33668 + .word 49145 + .word 0 + .word 28726 + .word 33993 + .word 32251 + .word 45542 + .word 16377 + .word 0 + .word 13837 + .word 35230 + .word 52966 + .word 64362 + .word 49144 + .word 0 + .word 39173 + .word 47380 + .word 34462 + .word 36139 + .word 16376 + .word 0 + .word 39489 + .word 64902 + .word 49120 + .word 35472 + .word 49143 + .word 0 + .word 21714 + .word 58783 + .word 27254 + .word 63315 + .word 16373 + .word 0 + .word 7367 + .word 49518 + .word 65112 + .word 52470 + .word 49140 + .word 0 + .word 43556 + .word 37199 + .word 28377 + .word 40908 + .word 16371 + .word 0 + .word 37864 + .word 51941 + .word 23210 + .word 60543 + .word 49137 + .word 0 + .word 51520 + .word 41236 + .word 58920 + .word 42796 + .word 16368 + .word 0 + .word 27066 + .word 4055 + .word 50549 + .word 58076 + .word 49134 + .word 0 + .word 8077 + .word 7791 + .word 5643 + .word 37977 + .word 16365 + .word 0 + .word 56642 + .word 7120 + .word 1392 + .word 48650 + .word 49131 + .word 0 + .word 33215 + .word 4176 + .word 55081 + .word 59653 + .word 16361 + .word 0 + .word 38962 + .word 43845 + .word 18883 + .word 41782 + .word 16366 + .word 0 + .word 9405 + .word 19610 + .word 41716 + .word 40526 + .word 49146 + .word 0 + .word 22463 + .word 33011 + .word 2834 + .word 59404 + .word 49138 + .word 0 + .word 23962 + .word 42196 + .word 52880 + .word 56044 + .word 16375 + .word 0 + .word 56651 + .word 1819 + .word 25970 + .word 41984 + .word 49143 + .word 0 + .word 36494 + .word 8013 + .word 55275 + .word 45183 + .word 16374 + .word 0 + .word 29601 + .word 10973 + .word 29140 + .word 41460 + .word 49141 + .word 0 + .word 33142 + .word 6988 + .word 53485 + .word 34321 + .word 16372 + .word 0 + .word 42305 + .word 46215 + .word 46985 + .word 52653 + .word 49138 + .word 0 + .word 32750 + .word 12648 + .word 9511 + .word 38000 + .word 16369 + .word 0 + .word 28037 + .word 7223 + .word 39341 + .word 52115 + .word 49135 + .word 0 + .word 43511 + .word 40096 + .word 33119 + .word 34189 + .word 16366 + .word 0 + .word 41081 + .word 59110 + .word 54072 + .word 43128 + .word 49132 + .word 0 + .word 52022 + .word 40239 + .word 12039 + .word 52524 + .word 16362 + .word 0 + .word 9970 + .word 11940 + .word 19019 + .word 62959 + .word 49128 + .word 0 + .word 8444 + .word 14648 + .word 8577 + .word 36069 + .word 16359 + .word 0 + .word 47055 + .word 6244 + .word 23935 + .word 45569 + .word 16364 + .word 0 + .word 17962 + .word 25012 + .word 42920 + .word 38222 + .word 49146 + .word 0 + .word 32361 + .word 55573 + .word 62116 + .word 40518 + .word 16375 + .word 0 + .word 23469 + .word 12285 + .word 11074 + .word 41169 + .word 16373 + .word 0 + .word 29710 + .word 22026 + .word 53610 + .word 45713 + .word 49141 + .word 0 + .word 19101 + .word 51375 + .word 37915 + .word 49464 + .word 16372 + .word 0 + .word 1487 + .word 25012 + .word 26269 + .word 42849 + .word 49139 + .word 0 + .word 24702 + .word 7300 + .word 26639 + .word 32851 + .word 16370 + .word 0 + .word 5625 + .word 62032 + .word 62646 + .word 46360 + .word 49136 + .word 0 + .word 16670 + .word 28857 + .word 9900 + .word 61429 + .word 16366 + .word 0 + .word 46530 + .word 36341 + .word 10884 + .word 38667 + .word 49133 + .word 0 + .word 26979 + .word 7608 + .word 53990 + .word 46612 + .word 16363 + .word 0 + .word 13306 + .word 33772 + .word 42194 + .word 54094 + .word 49129 + .word 0 + .word 5215 + .word 26849 + .word 40637 + .word 60704 + .word 16359 + .word 0 + .word 22157 + .word 10775 + .word 9954 + .word 33697 + .word 49126 + .word 0 + .word 62485 + .word 60905 + .word 33942 + .word 35703 + .word 16356 + .word 0 + .word 47033 + .word 9473 + .word 12114 + .word 36373 + .word 16366 + .word 0 + .word 18718 + .word 57887 + .word 63790 + .word 64802 + .word 49145 + .word 0 + .word 60436 + .word 32137 + .word 16772 + .word 44812 + .word 16375 + .word 0 + .word 22870 + .word 68 + .word 14788 + .word 47045 + .word 49139 + .word 0 + .word 13858 + .word 11038 + .word 51083 + .word 33832 + .word 49139 + .word 0 + .word 24411 + .word 53664 + .word 52423 + .word 44992 + .word 16370 + .word 0 + .word 23130 + .word 50537 + .word 29298 + .word 38364 + .word 49137 + .word 0 + .word 59445 + .word 25072 + .word 42634 + .word 55036 + .word 16367 + .word 0 + .word 27750 + .word 60051 + .word 51021 + .word 35697 + .word 49134 + .word 0 + .word 41673 + .word 42346 + .word 29154 + .word 43180 + .word 16364 + .word 0 + .word 24646 + .word 17588 + .word 60780 + .word 49501 + .word 49130 + .word 0 + .word 30636 + .word 48402 + .word 41439 + .word 54315 + .word 16360 + .word 0 + .word 53530 + .word 51574 + .word 33266 + .word 57402 + .word 49126 + .word 0 + .word 24832 + .word 32214 + .word 6566 + .word 58730 + .word 16356 + .word 0 + .word 57338 + .word 52017 + .word 53845 + .word 59748 + .word 49122 + .word 0 + .word 1236 + .word 12983 + .word 25321 + .word 57902 + .word 16352 + .word 0 + .word 42696 + .word 11590 + .word 13704 + .word 47288 + .word 16367 + .word 0 + .word 20112 + .word 35255 + .word 63039 + .word 51665 + .word 49145 + .word 0 + .word 20272 + .word 45351 + .word 26440 + .word 36407 + .word 16375 + .word 0 + .word 23351 + .word 42139 + .word 19582 + .word 38935 + .word 49140 + .word 0 + .word 65431 + .word 27369 + .word 16464 + .word 36140 + .word 16367 + .word 0 + .word 53584 + .word 5561 + .word 32961 + .word 55717 + .word 16367 + .word 0 + .word 39374 + .word 7231 + .word 45599 + .word 56117 + .word 49134 + .word 0 + .word 1294 + .word 6051 + .word 44462 + .word 39418 + .word 16365 + .word 0 + .word 34729 + .word 52585 + .word 9627 + .word 47645 + .word 49131 + .word 0 + .word 17858 + .word 59905 + .word 65371 + .word 52695 + .word 16361 + .word 0 + .word 43933 + .word 27878 + .word 22295 + .word 54792 + .word 49127 + .word 0 + .word 57164 + .word 8466 + .word 41536 + .word 54342 + .word 16357 + .word 0 + .word 62613 + .word 13809 + .word 4914 + .word 51847 + .word 49123 + .word 0 + .word 51382 + .word 5505 + .word 45058 + .word 47893 + .word 16353 + .word 0 + .word 20574 + .word 54447 + .word 25989 + .word 44189 + .word 49119 + .word 0 + .word 20867 + .word 50041 + .word 5177 + .word 38746 + .word 16349 + .word 0 + .word 51710 + .word 33997 + .word 26466 + .word 39335 + .word 16367 + .word 0 + .word 35180 + .word 39426 + .word 44580 + .word 39632 + .word 49145 + .word 0 + .word 39102 + .word 49560 + .word 46254 + .word 52105 + .word 16374 + .word 0 + .word 49858 + .word 3610 + .word 18403 + .word 60348 + .word 49139 + .word 0 + .word 63577 + .word 52764 + .word 23423 + .word 53731 + .word 16368 + .word 0 + .word 17746 + .word 20210 + .word 17254 + .word 46087 + .word 49131 + .word 0 + .word 57780 + .word 38655 + .word 62917 + .word 51922 + .word 49131 + .word 0 + .word 56818 + .word 27103 + .word 46800 + .word 44610 + .word 16362 + .word 0 + .word 42772 + .word 47939 + .word 39429 + .word 53363 + .word 49128 + .word 0 + .word 7127 + .word 43872 + .word 47188 + .word 55109 + .word 16358 + .word 0 + .word 35603 + .word 15923 + .word 26337 + .word 52288 + .word 49124 + .word 0 + .word 15540 + .word 23148 + .word 44469 + .word 46826 + .word 16354 + .word 0 + .word 38573 + .word 44351 + .word 49528 + .word 40134 + .word 49120 + .word 0 + .word 46922 + .word 10206 + .word 58026 + .word 33232 + .word 16350 + .word 0 + .word 48893 + .word 37264 + .word 47364 + .word 55135 + .word 49115 + .word 0 + .word 34563 + .word 54412 + .word 19025 + .word 43320 + .word 16345 + .word 0 + .word 50485 + .word 58441 + .word 18478 + .word 53939 + .word 16366 + .word 0 + .word 57295 + .word 1543 + .word 39725 + .word 59283 + .word 49144 + .word 0 + .word 61902 + .word 50672 + .word 60234 + .word 34832 + .word 16374 + .word 0 + .word 47445 + .word 686 + .word 22678 + .word 38214 + .word 49139 + .word 0 + .word 38808 + .word 16930 + .word 17219 + .word 37683 + .word 16368 + .word 0 + .word 15851 + .word 55325 + .word 43407 + .word 60214 + .word 49132 + .word 0 + .word 1143 + .word 605 + .word 3834 + .word 44087 + .word 16360 + .word 0 + .word 37926 + .word 51721 + .word 32650 + .word 51423 + .word 16358 + .word 0 + .word 719 + .word 37404 + .word 19156 + .word 44137 + .word 49125 + .word 0 + .word 35866 + .word 56877 + .word 40751 + .word 46818 + .word 16355 + .word 0 + .word 17240 + .word 30023 + .word 36586 + .word 42015 + .word 49121 + .word 0 + .word 54230 + .word 7254 + .word 30602 + .word 34461 + .word 16351 + .word 0 + .word 8012 + .word 12609 + .word 22719 + .word 53286 + .word 49116 + .word 0 + .word 30585 + .word 22802 + .word 38382 + .word 39498 + .word 16346 + .word 0 + .word 49910 + .word 61459 + .word 13066 + .word 58648 + .word 49111 + .word 0 + .word 4234 + .word 29117 + .word 43487 + .word 41014 + .word 16341 + .word 0 + .word 15283 + .word 31 + .word 53183 + .word 37265 + .word 16366 + .word 0 + .word 38704 + .word 430 + .word 57551 + .word 43591 + .word 49144 + .word 0 + .word 53647 + .word 31489 + .word 59377 + .word 44715 + .word 16373 + .word 0 + .word 58843 + .word 40196 + .word 27184 + .word 44045 + .word 49138 + .word 0 + .word 21712 + .word 17792 + .word 22495 + .word 41091 + .word 16367 + .word 0 + .word 4064 + .word 22340 + .word 38581 + .word 35349 + .word 49132 + .word 0 + .word 24218 + .word 42337 + .word 60128 + .word 52640 + .word 16360 + .word 0 + .word 20378 + .word 19984 + .word 2299 + .word 54122 + .word 49124 + .word 0 + .word 31249 + .word 59274 + .word 16273 + .word 55107 + .word 49119 + .word 0 + .word 52834 + .word 54517 + .word 12431 + .word 49909 + .word 16351 + .word 0 + .word 54832 + .word 24393 + .word 30353 + .word 51256 + .word 49117 + .word 0 + .word 65180 + .word 60129 + .word 24669 + .word 41244 + .word 16347 + .word 0 + .word 6591 + .word 13357 + .word 31681 + .word 59287 + .word 49112 + .word 0 + .word 26454 + .word 14700 + .word 42966 + .word 39875 + .word 16342 + .word 0 + .word 2956 + .word 33652 + .word 3414 + .word 53265 + .word 49107 + .word 0 + .word 52370 + .word 22181 + .word 28024 + .word 33144 + .word 16337 + .word 0 + .word 13170 + .word 827 + .word 21750 + .word 47190 + .word 16367 + .word 0 + .word 46086 + .word 34614 + .word 16391 + .word 63371 + .word 49143 + .word 0 + .word 23901 + .word 55438 + .word 56964 + .word 55951 + .word 16372 + .word 0 + .word 6825 + .word 37234 + .word 16184 + .word 48173 + .word 49137 + .word 0 + .word 100 + .word 15349 + .word 44285 + .word 40213 + .word 16366 + .word 0 + .word 46705 + .word 62401 + .word 15619 + .word 64493 + .word 49130 + .word 0 + .word 5832 + .word 45818 + .word 5603 + .word 48870 + .word 16359 + .word 0 + .word 26154 + .word 11509 + .word 12905 + .word 33853 + .word 49124 + .word 0 + .word 57899 + .word 64916 + .word 17522 + .word 39399 + .word 16352 + .word 0 + .word 11797 + .word 62659 + .word 15787 + .word 52982 + .word 49115 + .word 0 + .word 4387 + .word 49305 + .word 27685 + .word 41688 + .word 49112 + .word 0 + .word 8893 + .word 53993 + .word 6961 + .word 62732 + .word 16342 + .word 0 + .word 6561 + .word 49840 + .word 37854 + .word 49392 + .word 49108 + .word 0 + .word 22913 + .word 52496 + .word 16836 + .word 64532 + .word 16337 + .word 0 + .word 61478 + .word 12903 + .word 22917 + .word 40137 + .word 49103 + .word 0 + .word 20254 + .word 5653 + .word 41280 + .word 45163 + .word 16332 + .word 0 + .word 9250 + .word 21583 + .word 29887 + .word 42398 + .word 16367 + .word 0 + .word 21296 + .word 56033 + .word 20302 + .word 45697 + .word 49143 + .word 0 + .word 2595 + .word 14223 + .word 9373 + .word 34428 + .word 16372 + .word 0 + .word 43880 + .word 13192 + .word 17465 + .word 51046 + .word 49136 + .word 0 + .word 10750 + .word 52386 + .word 15061 + .word 37140 + .word 16365 + .word 0 + .word 43380 + .word 26688 + .word 4603 + .word 52842 + .word 49129 + .word 0 + .word 57923 + .word 50589 + .word 40806 + .word 36546 + .word 16358 + .word 0 + .word 41550 + .word 43340 + .word 52700 + .word 48703 + .word 49122 + .word 0 + .word 2829 + .word 50954 + .word 33981 + .word 61546 + .word 16350 + .word 0 + .word 53540 + .word 53334 + .word 26985 + .word 35726 + .word 49115 + .word 0 + .word 1383 + .word 41626 + .word 39002 + .word 35204 + .word 16343 + .word 0 + .word 4988 + .word 17152 + .word 47624 + .word 42298 + .word 49106 + .word 0 + .word 13081 + .word 59676 + .word 51281 + .word 43278 + .word 49102 + .word 0 + .word 20576 + .word 9083 + .word 44900 + .word 60572 + .word 16332 + .word 0 + .word 5241 + .word 64752 + .word 26216 + .word 43285 + .word 49098 + .word 0 + .word 54740 + .word 4493 + .word 22744 + .word 47855 + .word 16327 + .word 0 + .word 43008 + .word 40170 + .word 38190 + .word 50840 + .word 16367 + .word 0 + .word 64000 + .word 51124 + .word 38392 + .word 32771 + .word 49143 + .word 0 + .word 6193 + .word 27449 + .word 18043 + .word 41906 + .word 16371 + .word 0 + .word 55083 + .word 10857 + .word 24850 + .word 53024 + .word 49135 + .word 0 + .word 39204 + .word 24043 + .word 43883 + .word 33151 + .word 16364 + .word 0 + .word 16615 + .word 33399 + .word 37109 + .word 40897 + .word 49128 + .word 0 + .word 45005 + .word 13768 + .word 23576 + .word 49662 + .word 16356 + .word 0 + .word 19875 + .word 47904 + .word 27295 + .word 59169 + .word 49120 + .word 0 + .word 50767 + .word 38341 + .word 26349 + .word 34421 + .word 16349 + .word 0 + .word 61460 + .word 9200 + .word 49063 + .word 38824 + .word 49113 + .word 0 + .word 17698 + .word 13464 + .word 19312 + .word 41938 + .word 16341 + .word 0 + .word 14145 + .word 49711 + .word 41841 + .word 42410 + .word 49105 + .word 0 + .word 52259 + .word 38890 + .word 11861 + .word 38197 + .word 16333 + .word 0 + .word 37928 + .word 15208 + .word 58116 + .word 52459 + .word 49096 + .word 0 + .word 32955 + .word 48671 + .word 55988 + .word 42873 + .word 49084 + .word 0 + .word 10284 + .word 13591 + .word 10015 + .word 45425 + .word 16321 + .word 0 + .word 60165 + .word 7231 + .word 29309 + .word 47020 + .word 16366 + .word 0 + .word 2826 + .word 34241 + .word 10052 + .word 46822 + .word 49142 + .word 0 + .word 38150 + .word 11520 + .word 57874 + .word 50634 + .word 16370 + .word 0 + .word 13154 + .word 32010 + .word 59285 + .word 54374 + .word 49134 + .word 0 + .word 3630 + .word 36258 + .word 15737 + .word 57945 + .word 16362 + .word 0 + .word 33484 + .word 32040 + .word 11194 + .word 61229 + .word 49126 + .word 0 + .word 29890 + .word 19177 + .word 6587 + .word 64088 + .word 16354 + .word 0 + .word 47912 + .word 33375 + .word 45262 + .word 33179 + .word 49119 + .word 0 + .word 35727 + .word 49010 + .word 4249 + .word 33927 + .word 16347 + .word 0 + .word 48287 + .word 11774 + .word 34966 + .word 34177 + .word 49111 + .word 0 + .word 59219 + .word 12218 + .word 14591 + .word 33807 + .word 16339 + .word 0 + .word 45587 + .word 38263 + .word 60150 + .word 65351 + .word 49102 + .word 0 + .word 64248 + .word 19753 + .word 11467 + .word 61248 + .word 16330 + .word 0 + .word 8987 + .word 4417 + .word 35296 + .word 54967 + .word 49094 + .word 0 + .word 58348 + .word 59855 + .word 58179 + .word 46574 + .word 16322 + .word 0 + .word 838 + .word 40288 + .word 16803 + .word 34203 + .word 49086 + .word 0 + .word 19985 + .word 64792 + .word 35689 + .word 34160 + .word 16365 + .word 0 + .word 63242 + .word 24737 + .word 37564 + .word 33357 + .word 49142 + .word 0 + .word 21080 + .word 30395 + .word 32053 + .word 60879 + .word 16369 + .word 0 + .word 31967 + .word 27284 + .word 22818 + .word 55292 + .word 49133 + .word 0 + .word 25886 + .word 29922 + .word 20917 + .word 49964 + .word 16361 + .word 0 + .word 16415 + .word 22145 + .word 37135 + .word 44903 + .word 49125 + .word 0 + .word 60061 + .word 56529 + .word 59607 + .word 40115 + .word 16353 + .word 0 + .word 61716 + .word 63444 + .word 60667 + .word 35604 + .word 49117 + .word 0 + .word 44658 + .word 58531 + .word 9530 + .word 62744 + .word 16344 + .word 0 + .word 62260 + .word 39586 + .word 42345 + .word 54833 + .word 49108 + .word 0 + .word 28253 + .word 12485 + .word 44364 + .word 47473 + .word 16336 + .word 0 + .word 12640 + .word 24607 + .word 1626 + .word 40656 + .word 49100 + .word 0 + .word 34428 + .word 36370 + .word 1024 + .word 34362 + .word 16328 + .word 0 + .word 29040 + .word 20316 + .word 63988 + .word 57186 + .word 49091 + .word 0 + .word 56625 + .word 35023 + .word 4494 + .word 47694 + .word 16319 + .word 0 + .word 12074 + .word 64589 + .word 55447 + .word 37930 + .word 49083 + .word 0 + .word 50967 + .word 1382 + .word 5204 + .word 52101 + .word 16367 + .word 0 + .word 3284 + .word 33134 + .word 2262 + .word 47439 + .word 49141 + .word 0 + .word 46363 + .word 11691 + .word 13356 + .word 36476 + .word 16369 + .word 0 + .word 3419 + .word 29155 + .word 56063 + .word 55913 + .word 49132 + .word 0 + .word 46070 + .word 27060 + .word 45787 + .word 42709 + .word 16360 + .word 0 + .word 48455 + .word 49617 + .word 63339 + .word 65012 + .word 49123 + .word 0 + .word 11309 + .word 38321 + .word 50476 + .word 49291 + .word 16351 + .word 0 + .word 63177 + .word 54179 + .word 19446 + .word 37218 + .word 49115 + .word 0 + .word 17008 + .word 20702 + .word 63396 + .word 55953 + .word 16342 + .word 0 + .word 58916 + .word 21526 + .word 44533 + .word 41856 + .word 49106 + .word 0 + .word 4054 + .word 60910 + .word 64524 + .word 62288 + .word 16333 + .word 0 + .word 572 + .word 56463 + .word 6651 + .word 46074 + .word 49097 + .word 0 + .word 294 + .word 32916 + .word 12940 + .word 33845 + .word 16325 + .word 0 + .word 61241 + .word 23461 + .word 12133 + .word 49362 + .word 49088 + .word 0 + .word 43813 + .word 54697 + .word 47595 + .word 36628 + .word 16316 + .word 0 + .word 7023 + .word 63196 + .word 1211 + .word 52552 + .word 49079 + .word 0 + .word 49710 + .word 23216 + .word 57316 + .word 57937 + .word 16366 + .word 0 + .word 16917 + .word 54685 + .word 15559 + .word 33684 + .word 49141 + .word 0 + .word 19402 + .word 20755 + .word 35177 + .word 43607 + .word 16368 + .word 0 + .word 18988 + .word 7708 + .word 26373 + .word 56330 + .word 49131 + .word 0 + .word 31678 + .word 36048 + .word 15370 + .word 36299 + .word 16359 + .word 0 + .word 62053 + .word 9463 + .word 59420 + .word 46669 + .word 49122 + .word 0 + .word 43189 + .word 37083 + .word 47017 + .word 59851 + .word 16349 + .word 0 + .word 56431 + .word 23594 + .word 54456 + .word 38275 + .word 49113 + .word 0 + .word 57207 + .word 5358 + .word 61057 + .word 48816 + .word 16340 + .word 0 + .word 55955 + .word 61547 + .word 7096 + .word 62073 + .word 49103 + .word 0 + .word 38324 + .word 43297 + .word 2038 + .word 39337 + .word 16331 + .word 0 + .word 48019 + .word 63539 + .word 58854 + .word 49683 + .word 49094 + .word 0 + .word 38415 + .word 45891 + .word 48038 + .word 62495 + .word 16321 + .word 0 + .word 6285 + .word 58141 + .word 38062 + .word 39153 + .word 49085 + .word 0 + .word 8535 + .word 47970 + .word 20521 + .word 50223 + .word 16312 + .word 0 + .word 3599 + .word 31205 + .word 53376 + .word 62523 + .word 49075 + .word 0 + .word 53390 + .word 39428 + .word 31508 + .word 33365 + .word 16367 + .word 0 + .word 24907 + .word 1998 + .word 17203 + .word 47787 + .word 49140 + .word 0 + .word 65154 + .word 44054 + .word 55771 + .word 52050 + .word 16367 + .word 0 + .word 59345 + .word 56252 + .word 17241 + .word 56609 + .word 49130 + .word 0 + .word 21068 + .word 33081 + .word 36502 + .word 61470 + .word 16357 + .word 0 + .word 5838 + .word 32265 + .word 27141 + .word 33320 + .word 49121 + .word 0 + .word 13157 + .word 36097 + .word 56398 + .word 36061 + .word 16348 + .word 0 + .word 34641 + .word 3406 + .word 61161 + .word 38959 + .word 49111 + .word 0 + .word 36822 + .word 2107 + .word 7812 + .word 42013 + .word 16338 + .word 0 + .word 57689 + .word 7026 + .word 46609 + .word 45217 + .word 49101 + .word 0 + .word 65442 + .word 46672 + .word 32230 + .word 48567 + .word 16328 + .word 0 + .word 38794 + .word 56166 + .word 59740 + .word 52052 + .word 49091 + .word 0 + .word 7020 + .word 42539 + .word 58408 + .word 55641 + .word 16318 + .word 0 + .word 5792 + .word 16154 + .word 40642 + .word 59348 + .word 49081 + .word 0 + .word 45758 + .word 39239 + .word 10684 + .word 64996 + .word 16308 + .word 0 + .word 17135 + .word 25280 + .word 14240 + .word 34593 + .word 49072 + .word 0 + .word 22956 + .word 27174 + .word 6236 + .word 35739 + .word 16367 + .word 0 + .word 41448 + .word 9608 + .word 15061 + .word 33872 + .word 49140 + .word 0 + .word 35041 + .word 22115 + .word 31787 + .word 62060 + .word 16366 + .word 0 + .word 47943 + .word 57954 + .word 5630 + .word 56794 + .word 49129 + .word 0 + .word 12256 + .word 51468 + .word 48243 + .word 51918 + .word 16356 + .word 0 + .word 16861 + .word 555 + .word 19712 + .word 47409 + .word 49119 + .word 0 + .word 14521 + .word 28998 + .word 64476 + .word 43241 + .word 16346 + .word 0 + .word 42742 + .word 52364 + .word 18112 + .word 39394 + .word 49109 + .word 0 + .word 11937 + .word 57143 + .word 59317 + .word 35844 + .word 16336 + .word 0 + .word 54775 + .word 41142 + .word 37066 + .word 65147 + .word 49098 + .word 0 + .word 52047 + .word 20166 + .word 2989 + .word 59124 + .word 16325 + .word 0 + .word 63890 + .word 14576 + .word 19973 + .word 53583 + .word 49088 + .word 0 + .word 51017 + .word 21644 + .word 32682 + .word 48474 + .word 16315 + .word 0 + .word 14951 + .word 9527 + .word 54932 + .word 43797 + .word 49078 + .word 0 + .word 19956 + .word 63323 + .word 21590 + .word 40697 + .word 16305 + .word 0 + .word 13287 + .word 59412 + .word 52293 + .word 36781 + .word 49068 + .word 0 + .word 20654 + .word 3963 + .word 37243 + .word 46202 + .word 16367 + .word 0 + .word 14259 + .word 41161 + .word 56379 + .word 47991 + .word 49139 + .word 0 + .word 29552 + .word 20159 + .word 19967 + .word 36969 + .word 16366 + .word 0 + .word 36671 + .word 37033 + .word 31146 + .word 56915 + .word 49128 + .word 0 + .word 40096 + .word 16159 + .word 8745 + .word 43779 + .word 16355 + .word 0 + .word 31426 + .word 40251 + .word 6629 + .word 33649 + .word 49118 + .word 0 + .word 62460 + .word 14572 + .word 46922 + .word 51685 + .word 16344 + .word 0 + .word 21330 + .word 50824 + .word 20752 + .word 39663 + .word 49107 + .word 0 + .word 59043 + .word 6300 + .word 36178 + .word 60824 + .word 16333 + .word 0 + .word 11117 + .word 55297 + .word 15596 + .word 46598 + .word 49096 + .word 0 + .word 52972 + .word 24185 + .word 7857 + .word 35668 + .word 16323 + .word 0 + .word 48165 + .word 35957 + .word 4973 + .word 54554 + .word 49085 + .word 0 + .word 40559 + .word 40135 + .word 50657 + .word 41665 + .word 16312 + .word 0 + .word 22209 + .word 12399 + .word 38770 + .word 63599 + .word 49074 + .word 0 + .word 21134 + .word 56966 + .word 28654 + .word 49967 + .word 16301 + .word 0 + .word 55252 + .word 38724 + .word 60696 + .word 38196 + .word 49064 + .word 0 + .word 50324 + .word 38050 + .word 41691 + .word 52128 + .word 16367 + .word 0 + .word 57576 + .word 19017 + .word 35093 + .word 33984 + .word 49139 + .word 0 + .word 45261 + .word 53464 + .word 26203 + .word 44021 + .word 16365 + .word 0 + .word 59506 + .word 58350 + .word 50456 + .word 56993 + .word 49127 + .word 0 + .word 39656 + .word 29013 + .word 30706 + .word 36875 + .word 16354 + .word 0 + .word 15950 + .word 25278 + .word 29858 + .word 47692 + .word 49116 + .word 0 + .word 44951 + .word 52254 + .word 26639 + .word 61649 + .word 16342 + .word 0 + .word 14884 + .word 15288 + .word 36355 + .word 39823 + .word 49105 + .word 0 + .word 33589 + .word 37339 + .word 42662 + .word 51420 + .word 16331 + .word 0 + .word 59837 + .word 52901 + .word 27833 + .word 33178 + .word 49094 + .word 0 + .word 23530 + .word 8792 + .word 46326 + .word 42790 + .word 16320 + .word 0 + .word 22918 + .word 41993 + .word 30280 + .word 55154 + .word 49082 + .word 0 + .word 22935 + .word 40180 + .word 10208 + .word 35510 + .word 16309 + .word 0 + .word 24655 + .word 6092 + .word 5569 + .word 45708 + .word 49071 + .word 0 + .word 1836 + .word 9946 + .word 17030 + .word 60600 + .word 16297 + .word 0 + .word 58034 + .word 64044 + .word 12732 + .word 39095 + .word 49060 + .word 0 + .word 54043 + .word 4884 + .word 4993 + .word 50896 + .word 16365 + .word 0 + .word 52175 + .word 36282 + .word 1403 + .word 48115 + .word 49138 + .word 0 + .word 8979 + .word 278 + .word 60581 + .word 52397 + .word 16364 + .word 0 + .word 62427 + .word 36042 + .word 64958 + .word 57041 + .word 49126 + .word 0 + .word 22617 + .word 56486 + .word 29933 + .word 62075 + .word 16352 + .word 0 + .word 6668 + .word 34800 + .word 16726 + .word 33764 + .word 49115 + .word 0 + .word 58438 + .word 34332 + .word 45904 + .word 36716 + .word 16341 + .word 0 + .word 64514 + .word 12491 + .word 17770 + .word 39912 + .word 49103 + .word 0 + .word 38781 + .word 4147 + .word 20350 + .word 43369 + .word 16329 + .word 0 + .word 11653 + .word 23288 + .word 23101 + .word 47107 + .word 49091 + .word 0 + .word 24538 + .word 52112 + .word 19258 + .word 51147 + .word 16317 + .word 0 + .word 55081 + .word 11864 + .word 2795 + .word 55511 + .word 49079 + .word 0 + .word 30359 + .word 7516 + .word 42523 + .word 60199 + .word 16305 + .word 0 + .word 51632 + .word 54516 + .word 60788 + .word 65273 + .word 49067 + .word 0 + .word 8259 + .word 26817 + .word 16640 + .word 36463 + .word 16294 + .word 0 + .word 25358 + .word 21633 + .word 63088 + .word 39650 + .word 49056 + .word 0 + .word 37940 + .word 45084 + .word 22741 + .word 53976 + .word 16366 + .word 0 + .word 56905 + .word 35663 + .word 13071 + .word 34053 + .word 49138 + .word 0 + .word 6338 + .word 45524 + .word 29128 + .word 62353 + .word 16363 + .word 0 + .word 53870 + .word 55231 + .word 26051 + .word 57072 + .word 49125 + .word 0 + .word 25356 + .word 27338 + .word 39402 + .word 52225 + .word 16351 + .word 0 + .word 53832 + .word 61470 + .word 21273 + .word 47778 + .word 49113 + .word 0 + .word 58577 + .word 63695 + .word 35460 + .word 43698 + .word 16339 + .word 0 + .word 4520 + .word 44723 + .word 47409 + .word 39956 + .word 49101 + .word 0 + .word 1812 + .word 29018 + .word 42821 + .word 36525 + .word 16327 + .word 0 + .word 59061 + .word 29228 + .word 16191 + .word 33380 + .word 49089 + .word 0 + .word 39396 + .word 18010 + .word 60638 + .word 60994 + .word 16314 + .word 0 + .word 49088 + .word 9900 + .word 51011 + .word 55711 + .word 49076 + .word 0 + .word 37150 + .word 50516 + .word 56492 + .word 50852 + .word 16302 + .word 0 + .word 28484 + .word 40361 + .word 52896 + .word 46416 + .word 49064 + .word 0 + .word 62255 + .word 31126 + .word 18737 + .word 43665 + .word 16290 + .word 0 + .word 12057 + .word 58357 + .word 2287 + .word 39984 + .word 49052 + .word 0 + .word 10303 + .word 34822 + .word 30753 + .word 42638 + .word 16367 + .word 0 + .word 35383 + .word 38620 + .word 16953 + .word 48193 + .word 49137 + .word 0 + .word 33393 + .word 6703 + .word 23267 + .word 37093 + .word 16363 + .word 0 + .word 15343 + .word 55882 + .word 8818 + .word 57090 + .word 49124 + .word 0 + .word 43704 + .word 64267 + .word 56511 + .word 43925 + .word 16350 + .word 0 + .word 4607 + .word 47760 + .word 9543 + .word 33791 + .word 49112 + .word 0 + .word 56389 + .word 24814 + .word 13621 + .word 51980 + .word 16337 + .word 0 + .word 53957 + .word 28278 + .word 52920 + .word 39972 + .word 49099 + .word 0 + .word 44558 + .word 56829 + .word 64035 + .word 61466 + .word 16324 + .word 0 + .word 38720 + .word 53021 + .word 48635 + .word 47250 + .word 49086 + .word 0 + .word 44746 + .word 16730 + .word 48948 + .word 36315 + .word 16312 + .word 0 + .word 35899 + .word 1861 + .word 5901 + .word 55812 + .word 49073 + .word 0 + .word 22074 + .word 38313 + .word 14608 + .word 42863 + .word 16299 + .word 0 + .word 55515 + .word 23576 + .word 64018 + .word 32920 + .word 49061 + .word 0 + .word 12839 + .word 2194 + .word 19804 + .word 52126 + .word 16286 + .word 0 + .word 11439 + .word 41150 + .word 15351 + .word 40172 + .word 49048 + .word 0 + .word 29431 + .word 9874 + .word 45662 + .word 49530 + .word 16366 + .word 0 + .word 65266 + .word 58931 + .word 1289 + .word 34097 + .word 49137 + .word 0 + .word 37900 + .word 52013 + .word 19533 + .word 44126 + .word 16362 + .word 0 + .word 56648 + .word 29183 + .word 44293 + .word 57098 + .word 49123 + .word 0 + .word 6159 + .word 2813 + .word 55364 + .word 36937 + .word 16349 + .word 0 + .word 43479 + .word 31839 + .word 13895 + .word 47785 + .word 49110 + .word 0 + .word 5187 + .word 20139 + .word 24873 + .word 61810 + .word 16335 + .word 0 + .word 122 + .word 12763 + .word 63612 + .word 39970 + .word 49097 + .word 0 + .word 44050 + .word 14658 + .word 36451 + .word 51689 + .word 16322 + .word 0 + .word 25644 + .word 4873 + .word 38936 + .word 33417 + .word 49084 + .word 0 + .word 47798 + .word 57836 + .word 54492 + .word 43203 + .word 16309 + .word 0 + .word 13594 + .word 52300 + .word 36178 + .word 55848 + .word 49070 + .word 0 + .word 62324 + .word 37045 + .word 44215 + .word 36078 + .word 16296 + .word 0 + .word 9408 + .word 55695 + .word 35369 + .word 46620 + .word 49057 + .word 0 + .word 55933 + .word 58459 + .word 63135 + .word 62102 + .word 16282 + .word 0 + .word 9035 + .word 28599 + .word 9663 + .word 40267 + .word 49044 + .word 0 + .word 64440 + .word 9942 + .word 11459 + .word 51063 + .word 16366 + .word 0 + .word 54621 + .word 1381 + .word 54593 + .word 57593 + .word 49136 + .word 0 + .word 57672 + .word 22144 + .word 48770 + .word 34240 + .word 16362 + .word 0 + .word 41335 + .word 40315 + .word 35384 + .word 40709 + .word 49123 + .word 0 + .word 44154 + .word 2667 + .word 29983 + .word 48395 + .word 16348 + .word 0 + .word 11933 + .word 28752 + .word 33333 + .word 57526 + .word 49109 + .word 0 + .word 28038 + .word 64578 + .word 40018 + .word 34186 + .word 16335 + .word 0 + .word 37517 + .word 65009 + .word 17291 + .word 40628 + .word 49096 + .word 0 + .word 55118 + .word 35846 + .word 36301 + .word 48278 + .word 16321 + .word 0 + .word 8485 + .word 24440 + .word 14912 + .word 57363 + .word 49082 + .word 0 + .word 32377 + .word 28880 + .word 65211 + .word 34074 + .word 16308 + .word 0 + .word 34616 + .word 16831 + .word 8616 + .word 40478 + .word 49069 + .word 0 + .word 8999 + .word 50919 + .word 12017 + .word 48079 + .word 16294 + .word 0 + .word 35787 + .word 61739 + .word 12812 + .word 57101 + .word 49055 + .word 0 + .word 44504 + .word 58876 + .word 42861 + .word 33904 + .word 16281 + .word 0 + .word 47876 + .word 27247 + .word 49503 + .word 40257 + .word 49042 + .word 0 + .type _erfcl_Q,@object + .size _erfcl_Q,5376 + .align 2 +_erfcl_S: + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56559 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55197 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45662 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45290 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44607 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43781 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42924 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42104 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41357 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40696 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40122 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39629 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39210 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38855 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38556 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38304 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38091 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37913 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37763 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37637 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37531 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37442 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37368 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37305 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37252 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37208 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37189 + .word 16382 + .word 0 + .type _erfcl_S,@object + .size _erfcl_S,336 + .align 2 +_erfcl_UNDERFLOW_INT: + .word 42217 + .word 46880 + .word 24677 + .word 54546 + .word 16389 + .word 0 + .type _erfcl_UNDERFLOW_INT,@object + .size _erfcl_UNDERFLOW_INT,12 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_expl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/erff.S b/external/sgx_libm/ia32/erff.S new file mode 100644 index 0000000000..2280e0db4c --- /dev/null +++ b/external/sgx_libm/ia32/erff.S @@ -0,0 +1,251 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erff.c" + .text +..TXTST0: +# -- Begin erff + .text + .align 16,0x90 + .globl erff +erff: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movl 16(%esp), %edx + movl %edx, %eax + andl $-2147483648, %eax + andl $2147483647, %edx + orl $1065353216, %eax + movl %eax, (%esp) + cmpl $2139095040, %edx + flds (%esp) + jge ..B1.8 +..B1.2: + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $1081791744, %edx + jge ..B1.7 +..B1.3: + cmpl $1065353216, %edx + jl ..B1.5 +..B1.4: + movl %edx, %ecx + andl $8388607, %edx + shrl $23, %ecx + orl $1065353216, %edx + movl %edx, (%esp) + flds (%esp) + fsubl .L_2il0floatpacket.0@GOTOFF(%eax) + fld %st(0) + lea (%ecx,%ecx,2), %ecx + shll $5, %ecx + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldl -12104+_dbA@GOTOFF(%eax,%ecx) + fmul %st(3), %st + fldl -12120+_dbA@GOTOFF(%eax,%ecx) + fmul %st(4), %st + fxch %st(1) + faddl -12112+_dbA@GOTOFF(%eax,%ecx) + fmul %st(3), %st + faddp %st, %st(1) + fldl -12072+_dbA@GOTOFF(%eax,%ecx) + fmul %st(4), %st + fxch %st(1) + faddl -12128+_dbA@GOTOFF(%eax,%ecx) + fxch %st(1) + faddl -12080+_dbA@GOTOFF(%eax,%ecx) + fmul %st(3), %st + fldl -12088+_dbA@GOTOFF(%eax,%ecx) + fmul %st(5), %st + faddp %st, %st(1) + fldl -12040+_dbA@GOTOFF(%eax,%ecx) + fmul %st(5), %st + fxch %st(1) + faddl -12096+_dbA@GOTOFF(%eax,%ecx) + fxch %st(1) + faddl -12048+_dbA@GOTOFF(%eax,%ecx) + fmulp %st, %st(4) + fldl -12056+_dbA@GOTOFF(%eax,%ecx) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + faddl -12064+_dbA@GOTOFF(%eax,%ecx) + fmul %st(1), %st + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + addl $12, %esp + ret +..B1.5: + fstp %st(0) + flds 16(%esp) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldl 48+_dbA@GOTOFF(%eax) + fmul %st(1), %st + fldl 56+_dbA@GOTOFF(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 32+_dbA@GOTOFF(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 40+_dbA@GOTOFF(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 16+_dbA@GOTOFF(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 24+_dbA@GOTOFF(%eax) + fmulp %st, %st(2) + faddl _dbA@GOTOFF(%eax) + fxch %st(1) + faddl 8+_dbA@GOTOFF(%eax) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.6: + addl $12, %esp + ret +..B1.7: + fldl 256+_dbA@GOTOFF(%eax) + fmulp %st, %st(1) + addl $12, %esp + ret +..B1.8: + je ..B1.11 +..B1.9: + fstp %st(0) + flds 16(%esp) + fadd %st(0), %st +..B1.11: + addl $12, %esp + ret + .align 16,0x90 + .type erff,@function + .size erff,.-erff + .data +# -- End erff + .section .rodata, "a" + .align 16 + .align 16 +_dbA: + .long 1346373606 + .long 1072827863 + .long 1710987328 + .long 3218608756 + .long 2039146822 + .long 1069343472 + .long 2052989911 + .long 3214639770 + .long 3741021613 + .long 1064657550 + .long 2828932584 + .long 3209415657 + .long 556515485 + .long 1058898537 + .long 1493771156 + .long 3202627648 + .long 1460823802 + .long 1072622165 + .long 647757120 + .long 1069445687 + .long 1478820123 + .long 3217479081 + .long 827266439 + .long 1069662880 + .long 4153551678 + .long 3215381932 + .long 3249389370 + .long 3213783616 + .long 3875823656 + .long 1066650297 + .long 2479749796 + .long 3212012677 + .long 4079794357 + .long 3210967401 + .long 3292960271 + .long 1062989018 + .long 1338933997 + .long 3204757561 + .long 4209598023 + .long 3207545998 + .long 2886434981 + .long 1072693201 + .long 1721637260 + .long 1060257935 + .long 960688093 + .long 3210436681 + .long 1128797080 + .long 1064950642 + .long 798939459 + .long 3213958757 + .long 937205111 + .long 1067493282 + .long 3504975339 + .long 3215465534 + .long 3388113641 + .long 1068080152 + .long 9542307 + .long 3215088353 + .long 1310184383 + .long 1065080747 + .long 3264801679 + .long 1066837484 + .long 3394984936 + .long 3214223095 + .long 4294967295 + .long 1072693247 + .type _dbA,@object + .size _dbA,264 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3ff80000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/erfl.S b/external/sgx_libm/ia32/erfl.S new file mode 100644 index 0000000000..8a7b0eb63c --- /dev/null +++ b/external/sgx_libm/ia32/erfl.S @@ -0,0 +1,1925 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfl.c" + .text +..TXTST0: +# -- Begin erfl + .text + .align 16,0x90 + .globl erfl +erfl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.39 +..B1.4: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.5: + fldcw 12(%esp) +..B1.6: + movl $1, %ecx +..B1.7: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movzwl 16(%ebp), %esi + andl $32767, %esi + flds ones@GOTOFF(%ebx,%edx,4) + movl %esi, %edx + movl 12(%ebp), %edi + movl %edi, %eax + shll $16, %edx + shrl $16, %eax + orl %eax, %edx + fstpt 48(%esp) + cmpl $32767, %esi + je ..B1.32 +..B1.8: + cmpl $1073860832, %edx + jge ..B1.26 +..B1.9: + fldt 8(%ebp) + fstpt 32(%esp) + fldt 32(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fucompp + fnstsw %ax + sahf + jp ..B1.10 + je ..B1.29 +..B1.10: + cmpl $16343, %esi + jle ..B1.18 +..B1.11: + cmpl $16380, %esi + jge ..B1.15 +..B1.12: + fldt 32(%esp) + testl %ecx, %ecx + fld %st(0) + fmul %st(1), %st + fld %st(1) + fld %st(2) + fldl _TWO_32H@GOTOFF(%ebx) + fmul %st(4), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fsub %st(1), %st + fldt 96+_ldbA@GOTOFF(%ebx) + fmul %st(3), %st + fldt 84+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 12+_ldbA@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(3) + fmulp %st, %st(4) + fldt _ldbA@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%esp) + je ..B1.14 +..B1.13: + fldcw 14(%esp) +..B1.14: + fldt 32(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + fldt 48(%esp) + lea -1073793024(%edx), %eax + fldt 32(%esp) + shrl $16, %edx + addl $-16380, %edx + cmpl $47103, %eax + fmulp %st, %st(1) + ja ..L3 + movl $6, %edx +..L3: + movl %edx, %esi + shll $4, %esi + imull $360, %edx, %edx + fmull erfRRTable@GOTOFF(%esi,%ebx) + fldt 456+_ldbA@GOTOFF(%ebx,%edx) + testl %ecx, %ecx + fldt 444+_ldbA@GOTOFF(%ebx,%edx) + fldt 432+_ldbA@GOTOFF(%ebx,%edx) + fldt 420+_ldbA@GOTOFF(%ebx,%edx) + fldt 408+_ldbA@GOTOFF(%ebx,%edx) + fldt 396+_ldbA@GOTOFF(%ebx,%edx) + fldt 384+_ldbA@GOTOFF(%ebx,%edx) + fxch %st(7) + faddl 8+erfRRTable@GOTOFF(%ebx,%esi) + fmul %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fxch %st(4) + fmul %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fxch %st(2) + fmul %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(1), %st + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fldt 372+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 360+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 348+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 336+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 324+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 312+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 300+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 288+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 276+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 264+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fmul %st, %st(1) + fld %st(0) + fldt 252+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 240+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 228+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(3) + fmul %st, %st(2) + fld %st(0) + fldt 216+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fldt 204+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(4) + fxch %st(3) + fstpt (%esp) + fldl _TWO_32H@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fld %st(0) + fxch %st(3) + fsub %st(4), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fmul %st(6), %st + fmul %st(2), %st + faddp %st, %st(3) + fld %st(3) + fmul %st(1), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + fsub %st(4), %st + faddp %st, %st(2) + fldt 132+_ldbA@GOTOFF(%ebx,%edx) + fld %st(0) + fmul %st(6), %st + fstpt 16(%esp) + fmul %st(1), %st + fldt 144+_ldbA@GOTOFF(%ebx,%edx) + fmul %st(7), %st + faddp %st, %st(1) + fldt 180+_ldbA@GOTOFF(%ebx,%edx) + fmul %st, %st(6) + fmulp %st, %st(2) + fldt 192+_ldbA@GOTOFF(%ebx,%edx) + fmulp %st, %st(7) + fxch %st(6) + faddp %st, %st(1) + fldt 156+_ldbA@GOTOFF(%ebx,%edx) + fld %st(0) + fadd %st(6), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(6) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 168+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(1) + fld %st(4) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fmul %st(4), %st + fxch %st(3) + fsubr %st, %st(5) + fxch %st(1) + faddp %st, %st(5) + fxch %st(3) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 108+_ldbA@GOTOFF(%ebx,%edx) + fld %st(0) + fldt 16(%esp) + fadd %st, %st(1) + fld %st(1) + fadd %st(5), %st + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(5) + faddp %st, %st(2) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fldt 32(%esp) + fld %st(0) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fldt (%esp) + fmulp %st, %st(1) + fldt 120+_ldbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 48(%esp) + fmulp %st, %st(1) + fstpt 48(%esp) + je ..B1.17 +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt 48(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + fldt _TWO5600@GOTOFF(%ebx) + testl %esi, %esi + fldt 32(%esp) + fmul %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_32H@GOTOFF(%ebx) + fld %st(0) + fmul %st(2), %st + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(1) + fld %st(0) + fsubr %st(3), %st + fldt _ldbA@GOTOFF(%ebx) + fmul %st, %st(2) + fmulp %st, %st(1) + fldt 12+_ldbA@GOTOFF(%ebx) + fmulp %st, %st(4) + faddp %st, %st(3) + jne ..B1.22 +..B1.19: + testl $65520, %edx + je ..B1.22 +..B1.20: + fldt 48(%esp) + fldt 32(%esp) + fmulp %st, %st(1) + fldt _DenoBND@GOTOFF(%ebx) + fmul %st(5), %st + fcompp + fnstsw %ax + sahf + jbe ..B1.22 +..B1.21: + fstp %st(3) + fld %st(2) + fadd %st(2), %st + fmul %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fldt 12+_TWO5600@GOTOFF(%ebx) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.23 +..B1.22: + fstp %st(1) + fstp %st(2) + faddp %st, %st(1) + fldt 12+_TWO5600@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) +..B1.23: + testl %ecx, %ecx + je ..B1.25 +..B1.24: + fldcw 14(%esp) +..B1.25: + fldt (%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + fldt _Epsilon@GOTOFF(%ebx) + testl %ecx, %ecx + fldt 48(%esp) + fmul %st, %st(1) + fsubp %st, %st(1) + fstpt 48(%esp) + je ..B1.28 +..B1.27: + fldcw 14(%esp) +..B1.28: + fldt 48(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + testl %ecx, %ecx + je ..B1.31 +..B1.30: + fldcw 14(%esp) + fldt 8(%ebp) + fstpt 32(%esp) +..B1.31: + fldt 32(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + cmpl $-2147483648, %edi + jne ..B1.34 +..B1.33: + cmpl $0, 8(%ebp) + je ..B1.36 +..B1.34: + fldt 8(%ebp) + fadd %st(0), %st + fstpt 48(%esp) +..B1.36: + testl %ecx, %ecx + je ..B1.38 +..B1.37: + fldcw 14(%esp) +..B1.38: + fldt 48(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + xorl %ecx, %ecx + jmp ..B1.7 + .align 16,0x90 + .type erfl,@function + .size erfl,.-erfl + .data +# -- End erfl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +_ldbA: + .word 0 + .word 0 + .word 47746 + .word 36974 + .word 16383 + .word 0 + .word 30720 + .word 36515 + .word 17515 + .word 42715 + .word 16348 + .word 0 + .word 13842 + .word 7119 + .word 41816 + .word 49299 + .word 49149 + .word 0 + .word 3215 + .word 8543 + .word 37072 + .word 59159 + .word 16379 + .word 0 + .word 33545 + .word 17489 + .word 29065 + .word 56342 + .word 49145 + .word 0 + .word 23161 + .word 4543 + .word 59015 + .word 43821 + .word 16375 + .word 0 + .word 15198 + .word 65095 + .word 55656 + .word 57366 + .word 49140 + .word 0 + .word 11319 + .word 61676 + .word 11803 + .word 64720 + .word 16369 + .word 0 + .word 23735 + .word 16978 + .word 56014 + .word 63664 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 61888 + .word 54818 + .word 16380 + .word 0 + .word 10044 + .word 28505 + .word 55013 + .word 60780 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 27524 + .word 35697 + .word 16380 + .word 0 + .word 61965 + .word 13477 + .word 25391 + .word 40556 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 8518 + .word 53546 + .word 49142 + .word 0 + .word 60180 + .word 52984 + .word 38086 + .word 60834 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 60744 + .word 44249 + .word 49140 + .word 0 + .word 63138 + .word 9916 + .word 20408 + .word 61684 + .word 16340 + .word 0 + .word 50506 + .word 17424 + .word 9343 + .word 52291 + .word 16367 + .word 0 + .word 50365 + .word 34444 + .word 5016 + .word 49178 + .word 16364 + .word 0 + .word 17941 + .word 44182 + .word 56946 + .word 34035 + .word 49128 + .word 0 + .word 41364 + .word 35872 + .word 36905 + .word 43189 + .word 49124 + .word 0 + .word 47342 + .word 2906 + .word 40861 + .word 33222 + .word 16352 + .word 0 + .word 48408 + .word 44394 + .word 43316 + .word 61646 + .word 16347 + .word 0 + .word 52639 + .word 32949 + .word 29686 + .word 51873 + .word 49111 + .word 0 + .word 13354 + .word 8312 + .word 46883 + .word 36813 + .word 49107 + .word 0 + .word 10783 + .word 42642 + .word 20549 + .word 33739 + .word 16335 + .word 0 + .word 42435 + .word 44080 + .word 27835 + .word 37640 + .word 16330 + .word 0 + .word 55413 + .word 51626 + .word 37570 + .word 37609 + .word 49094 + .word 0 + .word 62471 + .word 35756 + .word 61962 + .word 33520 + .word 49089 + .word 0 + .word 40388 + .word 48302 + .word 32466 + .word 36673 + .word 16317 + .word 0 + .word 21782 + .word 37556 + .word 26897 + .word 52597 + .word 16311 + .word 0 + .word 35272 + .word 16771 + .word 34830 + .word 63430 + .word 49075 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26972 + .word 52968 + .word 16381 + .word 0 + .word 34629 + .word 50944 + .word 29785 + .word 56844 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 26328 + .word 64248 + .word 16380 + .word 0 + .word 5285 + .word 428 + .word 53188 + .word 60110 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 19746 + .word 48186 + .word 49145 + .word 0 + .word 3964 + .word 321 + .word 7123 + .word 45083 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 25230 + .word 61571 + .word 49142 + .word 0 + .word 57803 + .word 48946 + .word 59164 + .word 36732 + .word 49110 + .word 0 + .word 46948 + .word 32819 + .word 54758 + .word 43668 + .word 16372 + .word 0 + .word 16614 + .word 63709 + .word 23635 + .word 47684 + .word 16368 + .word 0 + .word 5734 + .word 50071 + .word 41702 + .word 52540 + .word 49134 + .word 0 + .word 1767 + .word 50346 + .word 34241 + .word 45792 + .word 49129 + .word 0 + .word 21673 + .word 57712 + .word 23306 + .word 47181 + .word 16360 + .word 0 + .word 30917 + .word 34592 + .word 23220 + .word 33297 + .word 16352 + .word 0 + .word 55246 + .word 63001 + .word 17535 + .word 33707 + .word 49122 + .word 0 + .word 5457 + .word 35457 + .word 53300 + .word 62645 + .word 16347 + .word 0 + .word 9460 + .word 62267 + .word 29700 + .word 39878 + .word 16347 + .word 0 + .word 54791 + .word 30369 + .word 50586 + .word 36074 + .word 49110 + .word 0 + .word 2078 + .word 44475 + .word 65531 + .word 40136 + .word 49108 + .word 0 + .word 65081 + .word 909 + .word 65384 + .word 51785 + .word 16335 + .word 0 + .word 42502 + .word 52825 + .word 47801 + .word 35033 + .word 16333 + .word 0 + .word 56809 + .word 22568 + .word 24289 + .word 58056 + .word 49096 + .word 0 + .word 53182 + .word 10272 + .word 7761 + .word 53779 + .word 49093 + .word 0 + .word 48071 + .word 2665 + .word 17237 + .word 54209 + .word 16321 + .word 0 + .word 49513 + .word 25795 + .word 55780 + .word 36409 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19372 + .word 46606 + .word 16382 + .word 0 + .word 22905 + .word 34398 + .word 64354 + .word 59506 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 8556 + .word 42135 + .word 16381 + .word 0 + .word 15826 + .word 39989 + .word 27742 + .word 58791 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 45602 + .word 63202 + .word 49147 + .word 0 + .word 61021 + .word 62759 + .word 37190 + .word 44093 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 11408 + .word 56180 + .word 16374 + .word 0 + .word 10545 + .word 4814 + .word 18495 + .word 39194 + .word 49109 + .word 0 + .word 49818 + .word 2604 + .word 44885 + .word 39501 + .word 16376 + .word 0 + .word 35457 + .word 26400 + .word 3144 + .word 55829 + .word 49141 + .word 0 + .word 1168 + .word 22940 + .word 48307 + .word 56355 + .word 49139 + .word 0 + .word 60825 + .word 56496 + .word 32133 + .word 38661 + .word 16370 + .word 0 + .word 41837 + .word 62246 + .word 39292 + .word 38617 + .word 16366 + .word 0 + .word 61718 + .word 27283 + .word 11883 + .word 33288 + .word 49134 + .word 0 + .word 51738 + .word 39830 + .word 42849 + .word 49937 + .word 16360 + .word 0 + .word 45393 + .word 52381 + .word 54757 + .word 41874 + .word 16361 + .word 0 + .word 45169 + .word 44591 + .word 30009 + .word 57007 + .word 49125 + .word 0 + .word 11552 + .word 4380 + .word 40671 + .word 40665 + .word 49124 + .word 0 + .word 28211 + .word 31057 + .word 64947 + .word 47497 + .word 16353 + .word 0 + .word 61755 + .word 33819 + .word 30246 + .word 61557 + .word 16350 + .word 0 + .word 57599 + .word 65445 + .word 31608 + .word 55873 + .word 49116 + .word 0 + .word 21063 + .word 33239 + .word 23242 + .word 34595 + .word 49113 + .word 0 + .word 24566 + .word 16137 + .word 47167 + .word 52509 + .word 16343 + .word 0 + .word 20857 + .word 62758 + .word 44126 + .word 43729 + .word 16338 + .word 0 + .word 26678 + .word 64201 + .word 37761 + .word 41436 + .word 49106 + .word 0 + .word 15315 + .word 3435 + .word 56025 + .word 62814 + .word 16331 + .word 0 + .word 19814 + .word 59948 + .word 14740 + .word 56311 + .word 16332 + .word 0 + .word 36977 + .word 22840 + .word 9289 + .word 39778 + .word 49096 + .word 0 + .word 62085 + .word 64048 + .word 54574 + .word 65118 + .word 49094 + .word 0 + .word 28752 + .word 34202 + .word 22833 + .word 38817 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 43704 + .word 63314 + .word 16382 + .word 0 + .word 17048 + .word 17271 + .word 64911 + .word 39894 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 47414 + .word 62353 + .word 16379 + .word 0 + .word 53119 + .word 3173 + .word 58504 + .word 64362 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 19176 + .word 46765 + .word 49148 + .word 0 + .word 36591 + .word 64385 + .word 59980 + .word 41399 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 352 + .word 36373 + .word 16380 + .word 0 + .word 63217 + .word 55085 + .word 16723 + .word 42154 + .word 49116 + .word 0 + .word 62758 + .word 20699 + .word 19176 + .word 46765 + .word 49146 + .word 0 + .word 18142 + .word 49445 + .word 47413 + .word 62353 + .word 49144 + .word 0 + .word 54343 + .word 9201 + .word 60310 + .word 40529 + .word 16377 + .word 0 + .word 62797 + .word 60885 + .word 40240 + .word 39787 + .word 49143 + .word 0 + .word 7512 + .word 45008 + .word 10012 + .word 39639 + .word 49142 + .word 0 + .word 20359 + .word 48234 + .word 1564 + .word 57372 + .word 16373 + .word 0 + .word 11764 + .word 26683 + .word 64145 + .word 49882 + .word 49137 + .word 0 + .word 32393 + .word 50330 + .word 31801 + .word 34151 + .word 49139 + .word 0 + .word 5247 + .word 4806 + .word 33577 + .word 41709 + .word 16369 + .word 0 + .word 43823 + .word 34097 + .word 44124 + .word 38558 + .word 16367 + .word 0 + .word 65526 + .word 14942 + .word 25531 + .word 60526 + .word 49134 + .word 0 + .word 38557 + .word 7794 + .word 42920 + .word 40918 + .word 16362 + .word 0 + .word 31363 + .word 35665 + .word 11710 + .word 52655 + .word 16363 + .word 0 + .word 33312 + .word 35439 + .word 34687 + .word 46194 + .word 49129 + .word 0 + .word 21144 + .word 58026 + .word 60687 + .word 57306 + .word 49127 + .word 0 + .word 20701 + .word 12315 + .word 12846 + .word 54836 + .word 16358 + .word 0 + .word 45362 + .word 30760 + .word 28723 + .word 42182 + .word 16354 + .word 0 + .word 16353 + .word 46602 + .word 41748 + .word 42697 + .word 49123 + .word 0 + .word 20735 + .word 3347 + .word 26735 + .word 62816 + .word 16351 + .word 0 + .word 13205 + .word 16964 + .word 38504 + .word 48289 + .word 16351 + .word 0 + .word 28004 + .word 15789 + .word 31604 + .word 37913 + .word 49117 + .word 0 + .word 17923 + .word 56666 + .word 63953 + .word 36481 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 36194 + .word 65534 + .word 16382 + .word 0 + .word 12232 + .word 62525 + .word 48597 + .word 39676 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 29918 + .word 37380 + .word 16371 + .word 0 + .word 48638 + .word 64479 + .word 2811 + .word 58988 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 44876 + .word 56070 + .word 49141 + .word 0 + .word 64093 + .word 3811 + .word 8439 + .word 45892 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 42382 + .word 52955 + .word 16375 + .word 0 + .word 7924 + .word 29399 + .word 61525 + .word 36582 + .word 16343 + .word 0 + .word 46606 + .word 18426 + .word 11663 + .word 35044 + .word 49145 + .word 0 + .word 15382 + .word 23178 + .word 43683 + .word 34109 + .word 16378 + .word 0 + .word 6438 + .word 10314 + .word 6872 + .word 49529 + .word 49146 + .word 0 + .word 64583 + .word 11206 + .word 41955 + .word 52421 + .word 16378 + .word 0 + .word 13495 + .word 31464 + .word 61723 + .word 36178 + .word 49146 + .word 0 + .word 28427 + .word 18799 + .word 40522 + .word 59729 + .word 16375 + .word 0 + .word 47510 + .word 26829 + .word 39947 + .word 33535 + .word 16377 + .word 0 + .word 64666 + .word 11700 + .word 15653 + .word 46358 + .word 49145 + .word 0 + .word 6475 + .word 64324 + .word 16618 + .word 52067 + .word 16376 + .word 0 + .word 31765 + .word 32664 + .word 9436 + .word 33916 + .word 16373 + .word 0 + .word 38078 + .word 37286 + .word 55507 + .word 62195 + .word 49143 + .word 0 + .word 16438 + .word 19728 + .word 54394 + .word 45557 + .word 16375 + .word 0 + .word 34868 + .word 45266 + .word 60847 + .word 41133 + .word 49140 + .word 0 + .word 6929 + .word 9316 + .word 56077 + .word 32933 + .word 49142 + .word 0 + .word 60039 + .word 42217 + .word 20756 + .word 52409 + .word 16373 + .word 0 + .word 38571 + .word 57934 + .word 18985 + .word 61369 + .word 49138 + .word 0 + .word 44492 + .word 40353 + .word 2663 + .word 35859 + .word 49140 + .word 0 + .word 54254 + .word 26892 + .word 54523 + .word 56697 + .word 16370 + .word 0 + .word 63636 + .word 38694 + .word 30824 + .word 51163 + .word 49138 + .word 0 + .word 56107 + .word 41638 + .word 48577 + .word 57632 + .word 49138 + .word 0 + .word 13301 + .word 46198 + .word 34221 + .word 52080 + .word 16368 + .word 0 + .word 6730 + .word 19704 + .word 41453 + .word 49062 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 32541 + .word 25746 + .word 20185 + .word 50811 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 40118 + .word 38623 + .word 16333 + .word 0 + .word 63899 + .word 60569 + .word 18971 + .word 35021 + .word 49068 + .word 0 + .word 0 + .word 0 + .word 35006 + .word 57940 + .word 49105 + .word 0 + .word 31190 + .word 18012 + .word 64261 + .word 44050 + .word 16305 + .word 0 + .word 0 + .word 0 + .word 44288 + .word 57137 + .word 16341 + .word 0 + .word 30741 + .word 21478 + .word 2085 + .word 43126 + .word 49077 + .word 0 + .word 43184 + .word 28511 + .word 48193 + .word 41628 + .word 49113 + .word 0 + .word 38069 + .word 12322 + .word 59848 + .word 47812 + .word 16348 + .word 0 + .word 14423 + .word 51984 + .word 32740 + .word 45128 + .word 49119 + .word 0 + .word 4208 + .word 46602 + .word 27709 + .word 35782 + .word 16354 + .word 0 + .word 36873 + .word 25112 + .word 30428 + .word 48402 + .word 49124 + .word 0 + .word 10843 + .word 45056 + .word 322 + .word 58525 + .word 16358 + .word 0 + .word 34740 + .word 5397 + .word 19459 + .word 63343 + .word 49128 + .word 0 + .word 43258 + .word 62838 + .word 12965 + .word 52557 + .word 16362 + .word 0 + .word 52181 + .word 57107 + .word 24596 + .word 44275 + .word 49132 + .word 0 + .word 8033 + .word 61170 + .word 58452 + .word 55638 + .word 16366 + .word 0 + .word 18754 + .word 55045 + .word 40463 + .word 41822 + .word 49134 + .word 0 + .word 31326 + .word 56708 + .word 50347 + .word 42397 + .word 49136 + .word 0 + .word 54840 + .word 45764 + .word 11355 + .word 33431 + .word 49141 + .word 0 + .word 56285 + .word 35328 + .word 49599 + .word 58875 + .word 49141 + .word 0 + .word 42904 + .word 46324 + .word 60880 + .word 56231 + .word 16375 + .word 0 + .word 42754 + .word 64912 + .word 63809 + .word 36632 + .word 16379 + .word 0 + .word 28983 + .word 59630 + .word 18663 + .word 33292 + .word 16381 + .word 0 + .word 56135 + .word 38086 + .word 60740 + .word 37575 + .word 16382 + .word 0 + .word 11769 + .word 21615 + .word 56585 + .word 54481 + .word 16382 + .word 0 + .word 64055 + .word 1299 + .word 36942 + .word 50744 + .word 16382 + .word 0 + .word 6073 + .word 42872 + .word 14757 + .word 53598 + .word 16381 + .word 0 + .word 7021 + .word 43375 + .word 58781 + .word 46458 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 64268 + .word 65535 + .word 16382 + .word 0 + .word 36579 + .word 26545 + .word 24435 + .word 50138 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 14458 + .word 38069 + .word 16364 + .word 0 + .word 15998 + .word 59065 + .word 36918 + .word 41001 + .word 16328 + .word 0 + .word 0 + .word 0 + .word 15150 + .word 34500 + .word 49134 + .word 0 + .word 33246 + .word 7128 + .word 23211 + .word 39186 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 36820 + .word 40101 + .word 16367 + .word 0 + .word 45920 + .word 25716 + .word 39121 + .word 51060 + .word 49103 + .word 0 + .word 52724 + .word 56956 + .word 1384 + .word 33467 + .word 49136 + .word 0 + .word 16783 + .word 11603 + .word 62021 + .word 42511 + .word 16368 + .word 0 + .word 34064 + .word 49622 + .word 4121 + .word 42444 + .word 49136 + .word 0 + .word 14084 + .word 4161 + .word 1985 + .word 33838 + .word 16368 + .word 0 + .word 65189 + .word 58247 + .word 7682 + .word 43141 + .word 49135 + .word 0 + .word 15983 + .word 3226 + .word 43602 + .word 43186 + .word 16366 + .word 0 + .word 7235 + .word 9522 + .word 4836 + .word 63885 + .word 49132 + .word 0 + .word 33104 + .word 49991 + .word 48728 + .word 55353 + .word 16362 + .word 0 + .word 10837 + .word 43216 + .word 47090 + .word 42202 + .word 16359 + .word 0 + .word 11340 + .word 13469 + .word 16673 + .word 42993 + .word 49128 + .word 0 + .word 19848 + .word 42271 + .word 35005 + .word 38963 + .word 16359 + .word 0 + .word 38280 + .word 23060 + .word 26803 + .word 65491 + .word 49124 + .word 0 + .word 3155 + .word 63825 + .word 24453 + .word 53521 + .word 49121 + .word 0 + .word 8736 + .word 25576 + .word 59728 + .word 40305 + .word 16354 + .word 0 + .word 21836 + .word 54867 + .word 10689 + .word 53743 + .word 49120 + .word 0 + .word 35590 + .word 40641 + .word 40511 + .word 35834 + .word 16349 + .word 0 + .word 42959 + .word 52506 + .word 48660 + .word 55474 + .word 16348 + .word 0 + .word 62734 + .word 58818 + .word 9020 + .word 51302 + .word 49115 + .word 0 + .word 59117 + .word 1762 + .word 19420 + .word 58690 + .word 16344 + .word 0 + .word 54865 + .word 3647 + .word 6267 + .word 65292 + .word 16342 + .word 0 + .word 35287 + .word 43939 + .word 50577 + .word 38705 + .word 49110 + .word 0 + .word 78 + .word 46283 + .word 25201 + .word 34088 + .word 16338 + .word 0 + .type _ldbA,@object + .size _ldbA,2628 + .space 12, 0x00 # pad + .align 16 +erfRRTable: + .long 0x00000000,0x40200000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x40100000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x40000000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3fd00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xc00d0000 + .type erfRRTable,@object + .size erfRRTable,112 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_TWO5600: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 21983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 10783 + .word 0 + .type _TWO5600,@object + .size _TWO5600,24 + .align 2 +_DenoBND: + .word 43678 + .word 54205 + .word 57926 + .word 29039 + .word 0 + .word 0 + .type _DenoBND,@object + .size _DenoBND,12 + .align 2 +_Epsilon: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16313 + .word 0 + .type _Epsilon,@object + .size _Epsilon,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/exp10_wmt.S b/external/sgx_libm/ia32/exp10_wmt.S new file mode 100644 index 0000000000..3357dec2b8 --- /dev/null +++ b/external/sgx_libm/ia32/exp10_wmt.S @@ -0,0 +1,580 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp10_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin exp10 + .text + .align 16,0x90 + .globl exp10 +exp10: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + unpcklpd %xmm0, %xmm0 + movapd 64(%ebx), %xmm1 + movapd 48(%ebx), %xmm6 + movapd 80(%ebx), %xmm2 + movapd 96(%ebx), %xmm3 + pextrw $3, %xmm0, %eax + andl $32767, %eax + movl $16500, %edx + subl %eax, %edx + subl $15472, %eax + orl %eax, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_0.0.3 + mulpd %xmm0, %xmm1 + addpd %xmm6, %xmm1 + movapd %xmm1, %xmm7 + subpd %xmm6, %xmm1 + mulpd %xmm1, %xmm2 + movapd 112(%ebx), %xmm4 + mulpd %xmm1, %xmm3 + movapd 1168(%ebx), %xmm1 + movapd 128(%ebx), %xmm5 + subpd %xmm2, %xmm0 + movd %xmm7, %eax + movl %eax, %ecx + andl $63, %ecx + shll $4, %ecx + sarl $6, %eax + movl %eax, %edx + subpd %xmm3, %xmm0 + movapd 144(%ebx,%ecx), %xmm2 + mulpd %xmm0, %xmm4 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm0 + addpd %xmm4, %xmm5 + mulsd %xmm0, %xmm0 + addsd %xmm2, %xmm1 + unpckhpd %xmm2, %xmm2 + movdqa 16(%ebx), %xmm6 + pand %xmm6, %xmm7 + movdqa 32(%ebx), %xmm6 + paddq %xmm6, %xmm7 + psllq $46, %xmm7 + mulpd %xmm5, %xmm0 + addsd %xmm0, %xmm1 + orpd %xmm7, %xmm2 + unpckhpd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + addl $894, %edx + cmpl $1916, %edx + ja .L_2TAG_PACKET_1.0.3 + mulsd %xmm2, %xmm0 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + fstcw 24(%esp) + movzwl 24(%esp), %edx + orl $768, %edx + movw %dx, 28(%esp) + fldcw 28(%esp) + movl %eax, %edx + sarl $1, %eax + subl %eax, %edx + movdqa (%ebx), %xmm6 + pandn %xmm2, %xmm6 + addl $1023, %eax + movd %eax, %xmm3 + psllq $52, %xmm3 + orpd %xmm3, %xmm6 + addl $1023, %edx + movd %edx, %xmm4 + psllq $52, %xmm4 + movsd %xmm0, 8(%esp) + fldl 8(%esp) + movsd %xmm6, 16(%esp) + fldl 16(%esp) + fmul %st, %st(1) + faddp %st, %st(1) + movsd %xmm4, 8(%esp) + fldl 8(%esp) + fmulp %st, %st(1) + fstpl 8(%esp) + movsd 8(%esp), %xmm0 + fldcw 24(%esp) + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $32752, %ecx + jae .L_2TAG_PACKET_3.0.3 + movl $265, %edx + cmpl $0, %ecx + je .L_2TAG_PACKET_4.0.3 + jmp .L_2TAG_PACKET_2.0.3 + cmpl $-2147483648, %ecx + jb .L_2TAG_PACKET_3.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + movl $166, %edx +.L_2TAG_PACKET_4.0.3: + movsd %xmm0, (%esp) + movsd 128(%esp), %xmm0 + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_6.0.3: + cmpl $2146435072, %eax + jae .L_2TAG_PACKET_7.0.3 + movl 132(%esp), %eax + cmpl $-2147483648, %eax + jae .L_2TAG_PACKET_8.0.3 + movsd 1208(%ebx), %xmm0 + mulsd %xmm0, %xmm0 + movl $166, %edx + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_8.0.3: + movsd 1216(%ebx), %xmm0 + mulsd %xmm0, %xmm0 + movl $265, %edx + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_7.0.3: + movl 128(%esp), %edx + cmpl $2146435072, %eax + ja .L_2TAG_PACKET_9.0.3 + cmpl $0, %edx + jne .L_2TAG_PACKET_9.0.3 + movl 132(%esp), %eax + cmpl $2146435072, %eax + jne .L_2TAG_PACKET_10.0.3 + movsd 1192(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_10.0.3: + movsd 1200(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_9.0.3: + movsd 128(%esp), %xmm0 + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movl 132(%esp), %eax + andl $2147483647, %eax + cmpl $1081344000, %eax + jae .L_2TAG_PACKET_6.0.3 + movsd 128(%esp), %xmm0 + addsd 1184(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 48(%esp) + fldl 48(%esp) +.L_2TAG_PACKET_5.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type exp10,@function + .size exp10,.-exp10 + .data +# -- End exp10 + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 4293918720 + .long 0 + .long 4293918720 + .long 4294967232 + .long 0 + .long 4294967232 + .long 0 + .long 65472 + .long 0 + .long 65472 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 158966641 + .long 1080726351 + .long 158966641 + .long 1080726351 + .long 1352531968 + .long 1064518675 + .long 1352531968 + .long 1064518675 + .long 824119987 + .long 1027055599 + .long 824119987 + .long 1027055599 + .long 3549356600 + .long 1071727285 + .long 2447043358 + .long 1073760005 + .long 2974317904 + .long 1072872823 + .long 3342652200 + .long 1074083108 + .long 0 + .long 0 + .long 0 + .long 0 + .long 235107661 + .long 1018002367 + .long 1048019040 + .long 11418 + .long 896005651 + .long 1015861842 + .long 3541402996 + .long 22960 + .long 1642514529 + .long 1012987726 + .long 410360776 + .long 34629 + .long 1568897900 + .long 1016568486 + .long 1828292879 + .long 46424 + .long 1882168529 + .long 1010744893 + .long 852742562 + .long 58348 + .long 509852888 + .long 1017336174 + .long 3490863952 + .long 70401 + .long 653277307 + .long 1017431380 + .long 2930322911 + .long 82586 + .long 1649557430 + .long 1017729363 + .long 1014845818 + .long 94904 + .long 1058231231 + .long 1015777676 + .long 3949972341 + .long 107355 + .long 1044000607 + .long 1016786167 + .long 828946858 + .long 119943 + .long 1151779725 + .long 1015705409 + .long 2288159958 + .long 132667 + .long 3819481236 + .long 1016499965 + .long 1853186616 + .long 145530 + .long 2552227826 + .long 1015039787 + .long 1709341917 + .long 158533 + .long 1829350193 + .long 1015216097 + .long 4112506593 + .long 171677 + .long 1913391795 + .long 1015756674 + .long 2799960843 + .long 184965 + .long 1303423926 + .long 1015238005 + .long 171030293 + .long 198398 + .long 1574172746 + .long 1016061241 + .long 2992903935 + .long 211976 + .long 3424156969 + .long 1017196428 + .long 926591434 + .long 225703 + .long 1938513547 + .long 1017631273 + .long 887463926 + .long 239579 + .long 2804567149 + .long 1015390024 + .long 1276261410 + .long 253606 + .long 631083525 + .long 1017690182 + .long 569847337 + .long 267786 + .long 1623370770 + .long 1011049453 + .long 1617004845 + .long 282120 + .long 3667985273 + .long 1013894369 + .long 3049340112 + .long 296610 + .long 3145379760 + .long 1014403278 + .long 3577096743 + .long 311258 + .long 2603100681 + .long 1017152460 + .long 1990012070 + .long 326066 + .long 3249202951 + .long 1017448880 + .long 1453150081 + .long 341035 + .long 419288974 + .long 1016280325 + .long 917841882 + .long 356167 + .long 3793507337 + .long 1016095713 + .long 3712504873 + .long 371463 + .long 728023093 + .long 1016345318 + .long 363667784 + .long 386927 + .long 2582678538 + .long 1017123460 + .long 2956612996 + .long 402558 + .long 7592966 + .long 1016721543 + .long 2186617380 + .long 418360 + .long 228611441 + .long 1016696141 + .long 1719614412 + .long 434334 + .long 2261665670 + .long 1017457593 + .long 1013258798 + .long 450482 + .long 544148907 + .long 1017323666 + .long 3907805043 + .long 466805 + .long 2383914918 + .long 1017143586 + .long 1447192520 + .long 483307 + .long 1176412038 + .long 1017267372 + .long 1944781190 + .long 499988 + .long 2882956373 + .long 1013312481 + .long 919555682 + .long 516851 + .long 3154077648 + .long 1016528543 + .long 2571947538 + .long 533897 + .long 348651999 + .long 1016405780 + .long 2604962540 + .long 551129 + .long 3253791412 + .long 1015920431 + .long 1110089947 + .long 568549 + .long 1509121860 + .long 1014756995 + .long 2568320822 + .long 586158 + .long 2617649212 + .long 1017340090 + .long 2966275556 + .long 603959 + .long 553214634 + .long 1016457425 + .long 2682146383 + .long 621954 + .long 730975783 + .long 1014083580 + .long 2191782032 + .long 640145 + .long 1486499517 + .long 1016818996 + .long 2069751140 + .long 658534 + .long 2595788928 + .long 1016407932 + .long 2990417244 + .long 677123 + .long 1853053619 + .long 1015310724 + .long 1434058175 + .long 695915 + .long 2462790535 + .long 1015814775 + .long 2572866477 + .long 714911 + .long 3693944214 + .long 1017259110 + .long 3092190714 + .long 734114 + .long 2979333550 + .long 1017188654 + .long 4076559942 + .long 753526 + .long 174054861 + .long 1014300631 + .long 2420883922 + .long 773150 + .long 816778419 + .long 1014197934 + .long 3716502172 + .long 792987 + .long 3507050924 + .long 1015341199 + .long 777507147 + .long 813041 + .long 1821514088 + .long 1013410604 + .long 3706687593 + .long 833312 + .long 920623539 + .long 1016295433 + .long 1242007931 + .long 853805 + .long 2789017511 + .long 1014276997 + .long 3707479175 + .long 874520 + .long 3586233004 + .long 1015962192 + .long 64696965 + .long 895462 + .long 474650514 + .long 1016642419 + .long 863738718 + .long 916631 + .long 1614448851 + .long 1014281732 + .long 3884662774 + .long 938030 + .long 2450082086 + .long 1016164135 + .long 2728693977 + .long 959663 + .long 1101668360 + .long 1015989180 + .long 3999357479 + .long 981531 + .long 835814894 + .long 1015702697 + .long 1533953344 + .long 1003638 + .long 1301400989 + .long 1014466875 + .long 2174652632 + .long 1025985 + .long 3149223190 + .long 1073900465 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 4294967295 + .long 2146435071 + .long 0 + .long 1048576 + .type static_const_table,@object + .size static_const_table,1224 + .data + .section .note.GNU-stack, "" +# End + + .globl pow10 + .equ pow10, exp10 + diff --git a/external/sgx_libm/ia32/exp10f_wmt.S b/external/sgx_libm/ia32/exp10f_wmt.S new file mode 100644 index 0000000000..c09cfab5d8 --- /dev/null +++ b/external/sgx_libm/ia32/exp10f_wmt.S @@ -0,0 +1,763 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp10f_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin exp10f + .text + .align 16,0x90 + .globl exp10f +exp10f: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %ecx + movsd 2064(%ebx), %xmm3 + xorpd %xmm7, %xmm7 + movl $17208, %eax + pinsrw $3, %eax, %xmm7 + cvtps2pd %xmm0, %xmm1 + andl $2147483647, %ecx + subl $830472192, %ecx + cmpl $278378496, %ecx + jae .L_2TAG_PACKET_0.0.3 + movsd 2048(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + movapd %xmm7, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm7 + movsd 2056(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + addl $830472192, %ecx + cmpl $830472192, %ecx + jb .L_2TAG_PACKET_2.0.3 + cmpl $1115684864, %ecx + jae .L_2TAG_PACKET_3.0.3 + movsd 2048(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + movapd %xmm7, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm7 + movsd 2056(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + cmpl $8388608, %eax + jb .L_2TAG_PACKET_4.0.3 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movd %xmm0, %edx + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_6.0.3 + testl $-2147483648, %edx + je .L_2TAG_PACKET_5.0.3 + movl $8388608, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_4.0.3: + movl $266, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_5.0.3: + movl $2130706432, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 + movl $167, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_2.0.3: + movl $1065353216, %eax + movd %eax, %xmm1 + addss %xmm1, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + cmpl $-8388608, %edx + je .L_2TAG_PACKET_9.0.3 + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_9.0.3: + fldz + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_1.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type exp10f,@function + .size exp10f,.-exp10f + .data +# -- End exp10f + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 4200250559 + .long 1072696090 + .long 2851812149 + .long 1072698941 + .long 339411585 + .long 1072701800 + .long 1048019041 + .long 1072704666 + .long 772914124 + .long 1072707540 + .long 3899555717 + .long 1072710421 + .long 1928746161 + .long 1072713311 + .long 3541402996 + .long 1072716208 + .long 238821257 + .long 1072719114 + .long 702412510 + .long 1072722027 + .long 728934454 + .long 1072724948 + .long 410360776 + .long 1072727877 + .long 4133881824 + .long 1072730813 + .long 3402036099 + .long 1072733758 + .long 2602514713 + .long 1072736711 + .long 1828292879 + .long 1072739672 + .long 1172597893 + .long 1072742641 + .long 728909815 + .long 1072745618 + .long 590962156 + .long 1072748603 + .long 852742562 + .long 1072751596 + .long 1608493509 + .long 1072754597 + .long 2952712987 + .long 1072757606 + .long 685187902 + .long 1072760624 + .long 3490863953 + .long 1072763649 + .long 2875075254 + .long 1072766683 + .long 3228316108 + .long 1072769725 + .long 351405227 + .long 1072772776 + .long 2930322912 + .long 1072775834 + .long 2471440686 + .long 1072778901 + .long 3366293073 + .long 1072781976 + .long 1416741826 + .long 1072785060 + .long 1014845819 + .long 1072788152 + .long 2257959872 + .long 1072791252 + .long 948735466 + .long 1072794361 + .long 1480023343 + .long 1072797478 + .long 3949972341 + .long 1072800603 + .long 4162030108 + .long 1072803737 + .long 2214878420 + .long 1072806880 + .long 2502433899 + .long 1072810031 + .long 828946858 + .long 1072813191 + .long 1588871207 + .long 1072816359 + .long 586995997 + .long 1072819536 + .long 2218315341 + .long 1072822721 + .long 2288159958 + .long 1072825915 + .long 897099801 + .long 1072829118 + .long 2440944790 + .long 1072832329 + .long 2725843665 + .long 1072835549 + .long 1853186616 + .long 1072838778 + .long 4219606026 + .long 1072842015 + .long 1337108031 + .long 1072845262 + .long 1897844341 + .long 1072848517 + .long 1709341917 + .long 1072851781 + .long 874372905 + .long 1072855054 + .long 3790955393 + .long 1072858335 + .long 1972484976 + .long 1072861626 + .long 4112506593 + .long 1072864925 + .long 1724976915 + .long 1072868234 + .long 3504003472 + .long 1072871551 + .long 964107055 + .long 1072874878 + .long 2799960843 + .long 1072878213 + .long 526652809 + .long 1072881558 + .long 2839424854 + .long 1072884911 + .long 1253935211 + .long 1072888274 + .long 171030293 + .long 1072891646 + .long 3991843581 + .long 1072895026 + .long 4232894513 + .long 1072898416 + .long 1000925746 + .long 1072901816 + .long 2992903935 + .long 1072905224 + .long 1726216749 + .long 1072908642 + .long 1603444721 + .long 1072912069 + .long 2732492859 + .long 1072915505 + .long 926591435 + .long 1072918951 + .long 589198666 + .long 1072922406 + .long 1829099622 + .long 1072925870 + .long 460407023 + .long 1072929344 + .long 887463927 + .long 1072932827 + .long 3219942644 + .long 1072936319 + .long 3272845541 + .long 1072939821 + .long 1156440435 + .long 1072943333 + .long 1276261410 + .long 1072946854 + .long 3743175029 + .long 1072950384 + .long 78413852 + .long 1072953925 + .long 3278348324 + .long 1072957474 + .long 569847338 + .long 1072961034 + .long 654919306 + .long 1072964603 + .long 3645941911 + .long 1072968181 + .long 1065662932 + .long 1072971770 + .long 1617004845 + .long 1072975368 + .long 1118294578 + .long 1072978976 + .long 3978100823 + .long 1072982593 + .long 1720398391 + .long 1072986221 + .long 3049340112 + .long 1072989858 + .long 3784486610 + .long 1072993505 + .long 4040676318 + .long 1072997162 + .long 3933059031 + .long 1073000829 + .long 3577096743 + .long 1073004506 + .long 3088564500 + .long 1073008193 + .long 2583551245 + .long 1073011890 + .long 2178460671 + .long 1073015597 + .long 1990012071 + .long 1073019314 + .long 2135241198 + .long 1073023041 + .long 2731501122 + .long 1073026778 + .long 3896463087 + .long 1073030525 + .long 1453150082 + .long 1073034283 + .long 4109806887 + .long 1073038050 + .long 3395129871 + .long 1073041828 + .long 3723038930 + .long 1073045616 + .long 917841882 + .long 1073049415 + .long 3689071823 + .long 1073053223 + .long 3566716925 + .long 1073057042 + .long 671025100 + .long 1073060872 + .long 3712504873 + .long 1073064711 + .long 4222122499 + .long 1073068561 + .long 2321106615 + .long 1073072422 + .long 2425981843 + .long 1073076293 + .long 363667784 + .long 1073080175 + .long 551349105 + .long 1073084067 + .long 3111574537 + .long 1073087969 + .long 3872257780 + .long 1073091882 + .long 2956612997 + .long 1073095806 + .long 488188413 + .long 1073099741 + .long 885834528 + .long 1073103686 + .long 4273770423 + .long 1073107641 + .long 2186617381 + .long 1073111608 + .long 3339203574 + .long 1073115585 + .long 3561793907 + .long 1073119573 + .long 2979960120 + .long 1073123572 + .long 1719614413 + .long 1073127582 + .long 4201977662 + .long 1073131602 + .long 1963711167 + .long 1073135634 + .long 3721688645 + .long 1073139676 + .long 1013258799 + .long 1073143730 + .long 2555984613 + .long 1073147794 + .long 4182873220 + .long 1073151869 + .long 1727278727 + .long 1073155956 + .long 3907805044 + .long 1073160053 + .long 2263535754 + .long 1073164162 + .long 1218806132 + .long 1073168282 + .long 903334909 + .long 1073172413 + .long 1447192521 + .long 1073176555 + .long 2980802057 + .long 1073180708 + .long 1339972927 + .long 1073184873 + .long 950803702 + .long 1073189049 + .long 1944781191 + .long 1073193236 + .long 158781403 + .long 1073197435 + .long 19972402 + .long 1073201645 + .long 1660913392 + .long 1073205866 + .long 919555682 + .long 1073210099 + .long 2224145553 + .long 1073214343 + .long 1413356050 + .long 1073218599 + .long 2916157145 + .long 1073222866 + .long 2571947539 + .long 1073227145 + .long 515457527 + .long 1073231436 + .long 1176749997 + .long 1073235738 + .long 396319521 + .long 1073240052 + .long 2604962541 + .long 1073244377 + .long 3643909174 + .long 1073248714 + .long 3649726105 + .long 1073253063 + .long 2759350287 + .long 1073257424 + .long 1110089947 + .long 1073261797 + .long 3134592888 + .long 1073266181 + .long 380978316 + .long 1073270578 + .long 1577608921 + .long 1073274986 + .long 2568320822 + .long 1073279406 + .long 3492293770 + .long 1073283838 + .long 194117574 + .long 1073288283 + .long 1403662306 + .long 1073292739 + .long 2966275557 + .long 1073297207 + .long 727685349 + .long 1073301688 + .long 3418903055 + .long 1073306180 + .long 2591453363 + .long 1073310685 + .long 2682146384 + .long 1073315202 + .long 3833209506 + .long 1073319731 + .long 1892288442 + .long 1073324273 + .long 1297350157 + .long 1073328827 + .long 2191782032 + .long 1073333393 + .long 424392917 + .long 1073337972 + .long 434316067 + .long 1073342563 + .long 2366108318 + .long 1073347166 + .long 2069751141 + .long 1073351782 + .long 3985553595 + .long 1073356410 + .long 3964284211 + .long 1073361051 + .long 2152073944 + .long 1073365705 + .long 2990417245 + .long 1073370371 + .long 2331271250 + .long 1073375050 + .long 321958744 + .long 1073379742 + .long 1405169241 + .long 1073384446 + .long 1434058175 + .long 1073389163 + .long 557149882 + .long 1073393893 + .long 3218338682 + .long 1073398635 + .long 977020788 + .long 1073403391 + .long 2572866477 + .long 1073408159 + .long 3861050111 + .long 1073412940 + .long 697153126 + .long 1073417735 + .long 1822067026 + .long 1073422542 + .long 3092190715 + .long 1073427362 + .long 364333489 + .long 1073432196 + .long 2380618042 + .long 1073437042 + .long 703710506 + .long 1073441902 + .long 4076559943 + .long 1073446774 + .long 4062661092 + .long 1073451660 + .long 815859274 + .long 1073456560 + .long 3080351519 + .long 1073461472 + .long 2420883922 + .long 1073466398 + .long 3287523847 + .long 1073471337 + .long 1540824585 + .long 1073476290 + .long 1631695677 + .long 1073481256 + .long 3716502172 + .long 1073486235 + .long 3657065772 + .long 1073491228 + .long 1610600570 + .long 1073496235 + .long 2029714210 + .long 1073501255 + .long 777507147 + .long 1073506289 + .long 2307442995 + .long 1073511336 + .long 2483480501 + .long 1073516397 + .long 1464976603 + .long 1073521472 + .long 3706687593 + .long 1073526560 + .long 778901109 + .long 1073531663 + .long 1432208378 + .long 1073536779 + .long 1532734324 + .long 1073541909 + .long 1242007932 + .long 1073547053 + .long 721996136 + .long 1073552211 + .long 135105010 + .long 1073557383 + .long 3939148246 + .long 1073562568 + .long 3707479175 + .long 1073567768 + .long 3898795731 + .long 1073572982 + .long 382305176 + .long 1073578211 + .long 1912561781 + .long 1073583453 + .long 64696965 + .long 1073588710 + .long 3594158869 + .long 1073593980 + .long 4076975200 + .long 1073599265 + .long 1679558232 + .long 1073604565 + .long 863738719 + .long 1073609879 + .long 1796832535 + .long 1073615207 + .long 351641897 + .long 1073620550 + .long 991358482 + .long 1073625907 + .long 3884662774 + .long 1073631278 + .long 610758006 + .long 1073636665 + .long 4224142467 + .long 1073642065 + .long 2009970496 + .long 1073647481 + .long 2728693978 + .long 1073652911 + .long 2256325230 + .long 1073658356 + .long 764307441 + .long 1073663816 + .long 2719515920 + .long 1073669290 + .long 3999357479 + .long 1073674779 + .long 481706282 + .long 1073680284 + .long 929806999 + .long 1073685803 + .long 1222472308 + .long 1073691337 + .long 1533953344 + .long 1073696886 + .long 2038973688 + .long 1073702450 + .long 2912730644 + .long 1073708029 + .long 35929225 + .long 1073713624 + .long 2174652632 + .long 1073719233 + .long 915592468 + .long 1073724858 + .long 730821105 + .long 1073730498 + .long 1797923801 + .long 1073736153 + .long 4286760334 + .long 1053736893 + .long 4277826245 + .long 1063661122 + .long 158966641 + .long 1082823503 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,2088 + .data + .section .note.GNU-stack, "" +# End + + .globl pow10f + .equ pow10f, exp10f + diff --git a/external/sgx_libm/ia32/exp10l.S b/external/sgx_libm/ia32/exp10l.S new file mode 100644 index 0000000000..d351269cc8 --- /dev/null +++ b/external/sgx_libm/ia32/exp10l.S @@ -0,0 +1,1162 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp10l.c" + .text +..TXTST0: +# -- Begin exp10l + .text + .align 16,0x90 + .globl exp10l +exp10l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp +..B1.2: + fnstcw 74(%esp) +..B1.3: + movzbl 17(%ebp), %edx + movl %edx, %ecx + movzwl 16(%ebp), %ebx + movl %ebx, %esi + shrl $7, %ecx + andl $32767, %esi + shll $15, %ecx + orl %esi, %ecx + shll $16, %ecx + movzwl 14(%ebp), %eax + orl %eax, %ecx + addl $-1073709056, %ecx + cmpl $284672, %ecx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + ja ..B1.6 +..B1.4: + fldt 8(%ebp) + fld %st(0) + fldl _TWO_23H@GOTOFF(%ecx) + fadd %st, %st(1) + fxch %st(1) + fstps 68(%esp) + flds 68(%esp) + fsubp %st, %st(1) + fucompp + fnstsw %ax + sahf + jp ..B1.5 + je ..B1.85 +..B1.5: + movl %ebx, %esi + andl $32767, %esi +..B1.6: + cmpl $16388, %esi + jge ..B1.45 +..B1.7: + movzwl 74(%esp), %eax + cmpl $16375, %esi + jge ..B1.38 +..B1.8: + cmpl $16368, %esi + jge ..B1.31 +..B1.9: + cmpl $16357, %esi + jge ..B1.24 +..B1.10: + cmpl $16316, %esi + jge ..B1.17 +..B1.11: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.74 +..B1.12: + orl $-64768, %eax + movw %ax, 72(%esp) +..B1.13: + fldcw 72(%esp) +..B1.14: + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + fldt 8(%ebp) + faddp %st, %st(1) + fstpt (%esp) +..B1.15: + fldcw 74(%esp) +..B1.16: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.75 +..B1.18: + orl $-64768, %eax + movw %ax, 72(%esp) +..B1.19: + fldcw 72(%esp) +..B1.20: + movl $1, %eax +..B1.21: + fldt 8(%ebp) + testl %eax, %eax + fldt 12+_Q2@GOTOFF(%ecx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.23 +..B1.22: + fldcw 74(%esp) +..B1.23: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.24: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.76 +..B1.25: + orl $-64768, %eax + movw %ax, 72(%esp) +..B1.26: + fldcw 72(%esp) +..B1.27: + movl $1, %eax +..B1.28: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%ecx) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%ecx) + fmul %st(2), %st + fldt 12+_Q1@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.30 +..B1.29: + fldcw 74(%esp) +..B1.30: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.77 +..B1.32: + orl $-64768, %eax + movw %ax, 72(%esp) +..B1.33: + fldcw 72(%esp) +..B1.34: + movl $1, %eax +..B1.35: + fldl _TWO_48H@GOTOFF(%ecx) + testl %eax, %eax + fldt 8(%ebp) + fld %st(0) + fmul %st(1), %st + fld %st(1) + fadd %st(3), %st + fsub %st, %st(3) + fld %st(2) + fsub %st(4), %st + fldt 84+_Q0@GOTOFF(%ecx) + fmul %st(3), %st + fldt 72+_Q0@GOTOFF(%ecx) + fmul %st(4), %st + fldt 60+_Q0@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 48+_Q0@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 36+_Q0@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 24+_Q0@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 12+_Q0@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fldt _Q0@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 96+_Q0@GOTOFF(%ecx) + fmul %st, %st(4) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + je ..B1.91 +..B1.36: + fstpt 24(%esp) +..B1.88: + fldcw 74(%esp) + jmp ..B1.37 +..B1.91: + fstp %st(0) +..B1.37: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.78 +..B1.39: + orl $-64768, %eax + movw %ax, 72(%esp) +..B1.40: + fldcw 72(%esp) +..B1.41: + movl $1, %ebx +..B1.42: + fldl _TWO_63H@GOTOFF(%ecx) + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + fadd %st(2), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmul %st(2), %st + movl 24(%esp), %eax + fsubrp %st, %st(1) + fld %st(0) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmulp %st, %st(3) + movsbl %al, %edx + fsub %st(2), %st + fldl _TWO_48H@GOTOFF(%ecx) + subl %edx, %eax + shll $4, %edx + fadd %st, %st(1) + shrl $8, %eax + fsubr %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + shll $23, %eax + fxch %st(4) + fsubrp %st, %st(3) + addl $1065353216, %eax + fadd %st(2), %st + fld %st(0) + testl %ebx, %ebx + fmul %st(1), %st + fldt 60+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%ecx) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%ecx) + movl %eax, 36(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 72+_P@GOTOFF(%ecx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(3) + fldl 2056+__libm_expl_table_256@GOTOFF(%ecx,%edx) + fldl 2048+__libm_expl_table_256@GOTOFF(%ecx,%edx) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(3) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmuls 36(%esp) + fstpt (%esp) + je ..B1.92 +..B1.43: + fstpt 24(%esp) +..B1.89: + fldcw 74(%esp) + jmp ..B1.44 +..B1.92: + fstp %st(0) +..B1.44: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ebx + movzwl 8+_ranges@GOTOFF(%ebx,%ecx), %eax + andl $32767, %eax + cmpl %eax, %esi + jl ..B1.50 +..B1.46: + jne ..B1.63 +..B1.47: + movl 12(%ebp), %eax + cmpl 4+_ranges@GOTOFF(%ebx,%ecx), %eax + jb ..B1.50 +..B1.48: + jne ..B1.63 +..B1.49: + movl 8(%ebp), %eax + cmpl _ranges@GOTOFF(%ebx,%ecx), %eax + jae ..B1.63 +..B1.50: + movzwl 74(%esp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.79 +..B1.51: + orl $-64768, %esi + movw %si, 72(%esp) +..B1.52: + fldcw 72(%esp) +..B1.53: + movl $1, %esi +..B1.54: + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + fstpt (%esp) + fldl _TWO_63H@GOTOFF(%ecx) + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + movl %ebx, 36(%esp) + fadd %st(2), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmul %st(2), %st + movl 24(%esp), %eax + movl %eax, %ebx + movsbl %al, %edi + addl $4196735, %eax + subl %edi, %ebx + fsubr %st(1), %st + fld %st(0) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmulp %st, %st(4) + shll $4, %edi + fsub %st(3), %st + fldl _TWO_48H@GOTOFF(%ecx) + shrl $8, %ebx + fadd %st, %st(1) + fxch %st(1) + fstpt 40(%esp) + fldt 40(%esp) + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + addl SC2_BIAS@GOTOFF(%ecx,%edx,4), %ebx + fxch %st(4) + fsubrp %st, %st(2) + movl %esi, 52(%esp) + andl $32767, %ebx + movzwl 8+.L_2il0floatpacket.3@GOTOFF(%ecx), %esi + fadd %st(1), %st + fld %st(0) + andl $-32768, %esi + fmul %st(1), %st + orl %ebx, %esi + fldt 60+_P@GOTOFF(%ecx) + cmpl $3070, %eax + fmul %st(1), %st + fldt 48+_P@GOTOFF(%ecx) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%ecx) + movw %si, 8(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ecx) + movl 52(%esp), %esi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%ecx) + movl 36(%esp), %ebx + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 72+_P@GOTOFF(%ecx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(3) + fldl 2048+__libm_expl_table_256@GOTOFF(%ecx,%edi) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(4), %st + fxch %st(1) + fmul %st, %st(4) + faddp %st, %st(4) + fmull 2056+__libm_expl_table_256@GOTOFF(%ecx,%edi) + faddp %st, %st(1) + faddl 2056+__libm_expl_table_256@GOTOFF(%ecx,%edi) + ja ..B1.57 +..B1.55: + fldt _exp10but@GOTOFF(%ecx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B1.57 +..B1.56: + fstp %st(1) + fldl _TWO_12H@GOTOFF(%ecx) + fld %st(2) + fadd %st(2), %st + fmul %st, %st(1) + fadd %st(1), %st + fstpt 40(%esp) + fldt 40(%esp) + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt _SC2@GOTOFF(%ebx,%ecx) + fldt (%esp) + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 56(%esp) + jmp ..B1.58 +..B1.57: + fstp %st(1) + fldt (%esp) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt _SC2@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 56(%esp) +..B1.58: + fldt _minnorm@GOTOFF(%ecx) + fldt 56(%esp) + fcompp + fnstsw %ax + sahf + jae ..B1.60 + jp ..B1.60 +..B1.59: + fldt _small_value_80@GOTOFF(%ecx) + fmul %st(0), %st + fstpt 12(%esp) +..B1.60: + testl %esi, %esi + je ..B1.62 +..B1.61: + fldt 40(%esp) + fstpt 24(%esp) +..B1.90: + fldcw 74(%esp) +..B1.62: + fldt 56(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.63: + movzwl 74(%esp), %ebx + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.84 +..B1.64: + orl $-64768, %ebx + movw %bx, 72(%esp) +..B1.65: + fldcw 72(%esp) +..B1.66: + movzwl 16(%ebp), %esi + movl $1, %eax + andl $32767, %esi +..B1.67: + cmpl $32767, %esi + je ..B1.80 +..B1.68: + testl %edx, %edx + je ..B1.70 +..B1.69: + fldt _small_value_80@GOTOFF(%ecx) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.71 +..B1.70: + fldt _large_value_80@GOTOFF(%ecx) + fmul %st(0), %st + fstpt (%esp) +..B1.71: + testl %eax, %eax + je ..B1.73 +..B1.72: + fldcw 74(%esp) +..B1.73: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.74: + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + fldt 8(%ebp) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.16 +..B1.75: + xorl %eax, %eax + jmp ..B1.21 +..B1.76: + xorl %eax, %eax + jmp ..B1.28 +..B1.77: + xorl %eax, %eax + jmp ..B1.35 +..B1.78: + xorl %ebx, %ebx + jmp ..B1.42 +..B1.79: + xorl %esi, %esi + jmp ..B1.54 +..B1.80: + cmpl $-2147483648, 12(%ebp) + jne ..B1.83 +..B1.81: + cmpl $0, 8(%ebp) + jne ..B1.83 +..B1.82: + fldl _inf_zeros@GOTOFF(%ecx,%edx,8) + fstpt (%esp) + jmp ..B1.71 +..B1.83: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.71 +..B1.84: + xorl %eax, %eax + jmp ..B1.67 +..B1.85: + movl 68(%esp), %edx + andl $4194303, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ebx + fldt -12+_exact_values@GOTOFF(%ecx,%ebx) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type exp10l,@function + .size exp10l,.-exp10l + .data +# -- End exp10l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x88,0x1b,0xcd,0x4b,0x78,0x9a,0xd4,0x08,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x85,0x9a,0x20,0x9a,0xf5,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0xc8,0xd4,0x0e,0xee,0x0c,0x01,0x86,0xd0,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +_TWO_23H: + .long 0 + .long 1097334784 + .type _TWO_23H,@object + .size _TWO_23H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +SC2_BIAS: + .long 8191 + .long 24575 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .align 2 +_Q2: + .word 45097 + .word 43688 + .word 36317 + .word 37725 + .word 16384 + .word 0 + .word 18666 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 44055 + .word 43688 + .word 36317 + .word 37725 + .word 16384 + .word 0 + .word 17466 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 8942 + .word 31610 + .word 11407 + .word 33336 + .word 16384 + .word 0 + .word 11423 + .word 35775 + .word 45136 + .word 38379 + .word 16383 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q0: + .word 11092 + .word 42962 + .word 43694 + .word 58436 + .word 49135 + .word 0 + .word 17467 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 8985 + .word 61797 + .word 11406 + .word 33336 + .word 16384 + .word 0 + .word 8830 + .word 60614 + .word 45135 + .word 38379 + .word 16383 + .word 0 + .word 62265 + .word 59600 + .word 65512 + .word 35348 + .word 16382 + .word 0 + .word 36045 + .word 15298 + .word 47170 + .word 54262 + .word 16380 + .word 0 + .word 33342 + .word 6003 + .word 33899 + .word 35698 + .word 16379 + .word 0 + .word 20958 + .word 58269 + .word 28628 + .word 41099 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37726 + .word 16384 + .word 0 + .type _Q0,@object + .size _Q0,108 + .align 2 +_P: + .word 405 + .word 44055 + .word 43688 + .word 36317 + .word 16368 + .word 0 + .word 17467 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 7929 + .word 61789 + .word 11406 + .word 33336 + .word 16384 + .word 0 + .word 36964 + .word 60605 + .word 45135 + .word 38379 + .word 16383 + .word 0 + .word 55739 + .word 36897 + .word 684 + .word 35349 + .word 16382 + .word 0 + .word 13923 + .word 51509 + .word 48217 + .word 54262 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37725 + .word 16384 + .word 0 + .type _P,@object + .size _P,84 + .align 2 +_ranges: + .word 63385 + .word 64463 + .word 39556 + .word 39456 + .word 16395 + .word 0 + .word 55376 + .word 5815 + .word 21149 + .word 39608 + .word 16395 + .word 0 + .type _ranges,@object + .size _ranges,24 + .align 2 +_exp10but: + .word 6424 + .word 10152 + .word 51584 + .word 39451 + .word 49163 + .word 0 + .type _exp10but,@object + .size _exp10but,12 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _SC2,@object + .size _SC2,24 + .align 2 +_minnorm: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _minnorm,@object + .size _minnorm,12 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_exact_values: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40000 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50000 + .word 16399 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62500 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39062 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 8192 + .word 48828 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 10240 + .word 61035 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 63744 + .word 38146 + .word 16416 + .word 0 + .word 0 + .word 0 + .word 46912 + .word 47683 + .word 16419 + .word 0 + .word 0 + .word 0 + .word 42256 + .word 59604 + .word 16422 + .word 0 + .word 0 + .word 0 + .word 59178 + .word 37252 + .word 16426 + .word 0 + .word 0 + .word 32768 + .word 8436 + .word 46566 + .word 16429 + .word 0 + .word 0 + .word 40960 + .word 43313 + .word 58207 + .word 16432 + .word 0 + .word 0 + .word 1024 + .word 51647 + .word 36379 + .word 16436 + .word 0 + .word 0 + .word 50432 + .word 48174 + .word 45474 + .word 16439 + .word 0 + .word 0 + .word 30272 + .word 27450 + .word 56843 + .word 16442 + .word 0 + .word 0 + .word 35304 + .word 8964 + .word 35527 + .word 16446 + .word 0 + .word 0 + .word 44130 + .word 60357 + .word 44408 + .word 16449 + .word 0 + .word 32768 + .word 6010 + .word 9911 + .word 55511 + .word 16452 + .word 0 + .word 36864 + .word 28332 + .word 30770 + .word 34694 + .word 16456 + .word 0 + .word 46080 + .word 2647 + .word 5695 + .word 43368 + .word 16459 + .word 0 + .word 41216 + .word 52461 + .word 7118 + .word 54210 + .word 16462 + .word 0 + .word 33952 + .word 16404 + .word 20833 + .word 33881 + .word 16466 + .word 0 + .word 42440 + .word 36889 + .word 42425 + .word 42351 + .word 16469 + .word 0 + .word 3898 + .word 62496 + .word 36647 + .word 52939 + .word 16472 + .word 0 + .type _exact_values,@object + .size _exact_values,324 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End + + .globl pow10l + .equ pow10l, exp10l + diff --git a/external/sgx_libm/ia32/exp2_wmt.S b/external/sgx_libm/ia32/exp2_wmt.S new file mode 100644 index 0000000000..3d17e6a948 --- /dev/null +++ b/external/sgx_libm/ia32/exp2_wmt.S @@ -0,0 +1,908 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp2_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin exp2 + .text + .align 16,0x90 + .globl exp2 +exp2: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + stmxcsr 16(%esp) + movl 16(%esp), %edx + andl $-24577, %edx + cmpl %edx, 16(%esp) + jne .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + movsd 2112(%ebx), %xmm1 + movsd (%ebx), %xmm2 + paddd %xmm0, %xmm1 + pextrw $3, %xmm0, %ecx + andl $32767, %ecx + movl $16527, %edx + subl %ecx, %edx + subl $15504, %ecx + orl %ecx, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cvtsd2si %xmm1, %eax + movq %xmm1, %xmm0 + addsd %xmm2, %xmm1 + movapd 2064(%ebx), %xmm6 + subsd %xmm2, %xmm1 + movapd 2080(%ebx), %xmm7 + subsd %xmm1, %xmm0 + movsd 2096(%ebx), %xmm2 + unpcklpd %xmm0, %xmm0 + movapd %xmm0, %xmm1 + movl %eax, %ecx + sarl $7, %ecx + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + andl $2032, %eax + movsd 16(%ebx,%eax), %xmm3 + movsd 24(%ebx,%eax), %xmm4 + addl $1023, %ecx + pinsrw $0, %ecx, %xmm5 + psllq $52, %xmm5 + mulpd %xmm0, %xmm6 + mulpd %xmm0, %xmm0 + orpd %xmm5, %xmm3 + mulsd %xmm1, %xmm2 + addpd %xmm7, %xmm6 + movl $2046, %edx + subl %ecx, %edx + subl $60, %ecx + orl %ecx, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_4.0.3 + movapd %xmm3, %xmm7 + mulsd %xmm0, %xmm3 + mulsd %xmm6, %xmm0 + unpckhpd %xmm6, %xmm6 + mulsd %xmm7, %xmm2 + mulsd %xmm5, %xmm4 + addsd %xmm6, %xmm0 + addsd %xmm4, %xmm2 + mulsd %xmm3, %xmm0 + addsd %xmm2, %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_5.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_5.0.3: + addsd %xmm7, %xmm0 + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_4.0.3: + xorpd %xmm5, %xmm3 + addl $60, %ecx + movl %ecx, %edx + subl $1023, %ecx + movl %ecx, %eax + sarl $1, %ecx + subl %ecx, %eax + addl $1023, %ecx + addl $1023, %eax + movd %eax, %xmm7 + psllq $52, %xmm7 + movl $1, %eax + subl %edx, %eax + movd %eax, %xmm5 + movsd 2160(%ebx), %xmm1 + psllq %xmm5, %xmm1 + orpd %xmm7, %xmm3 + mulsd %xmm7, %xmm4 + movapd %xmm3, %xmm7 + movd %ecx, %xmm5 + psllq $52, %xmm5 + andpd %xmm3, %xmm1 + mulsd %xmm0, %xmm3 + mulsd %xmm6, %xmm0 + unpckhpd %xmm6, %xmm6 + mulsd %xmm7, %xmm2 + addsd %xmm6, %xmm0 + addsd %xmm4, %xmm2 + subsd %xmm1, %xmm7 + mulsd %xmm3, %xmm0 + addsd %xmm2, %xmm0 + addsd %xmm7, %xmm0 + cmpl $2047, %edx + jge .L_2TAG_PACKET_7.0.3 + mulsd %xmm5, %xmm1 + mulsd %xmm5, %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_8.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_8.0.3: + addsd %xmm1, %xmm0 + pextrw $3, %xmm0, %eax + movl $162, %edx + andl $32752, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_9.0.3 + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_7.0.3: + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_10.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_10.0.3: + addsd %xmm1, %xmm0 + mulsd %xmm5, %xmm0 + pextrw $3, %xmm0, %eax + movl $161, %edx + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_9.0.3 + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_0.0.3: + movl 16(%esp), %edx + andl $-24577, %edx + movl %edx, 24(%esp) + ldmxcsr 24(%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_9.0.3: + movsd %xmm0, (%esp) + movsd 128(%esp), %xmm0 + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_11.0.3 +.L_2TAG_PACKET_12.0.3: + cmpl $32752, %ecx + jae .L_2TAG_PACKET_13.0.3 + movl 132(%esp), %ecx + cmpl $-2147483648, %ecx + jae .L_2TAG_PACKET_14.0.3 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_15.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_15.0.3: + movsd 2144(%ebx), %xmm0 + mulsd %xmm0, %xmm0 + movl $161, %edx + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_14.0.3: + cmpl $-1064253440, %ecx + jbe .L_2TAG_PACKET_3.0.3 + shrl $4, %ecx + subl $201919680, %ecx + shrl $31, %ecx + xorpd %xmm0, %xmm0 + movd %ecx, %xmm0 + movl 16(%esp), %eax + andl $-24577, %eax + cmpl 16(%esp), %eax + je .L_2TAG_PACKET_16.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %eax + andl $24576, %eax + orl %eax, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_16.0.3: + movsd 2152(%ebx), %xmm1 + mulsd %xmm1, %xmm1 + movl $162, %edx + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_13.0.3: + movl 128(%esp), %edx + movl 132(%esp), %eax + movl $2147483647, %ecx + andl %eax, %ecx + cmpl $2146435072, %ecx + ja .L_2TAG_PACKET_17.0.3 + cmpl $0, %edx + jne .L_2TAG_PACKET_17.0.3 + cmpl $2146435072, %eax + jne .L_2TAG_PACKET_18.0.3 + movsd 2128(%ebx), %xmm0 + jmp .L_2TAG_PACKET_19.0.3 +.L_2TAG_PACKET_18.0.3: + movsd 2136(%ebx), %xmm0 + jmp .L_2TAG_PACKET_19.0.3 +.L_2TAG_PACKET_17.0.3: + movsd 128(%esp), %xmm0 + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_19.0.3 +.L_2TAG_PACKET_2.0.3: + addl $15504, %ecx + cmpl $16527, %ecx + jae .L_2TAG_PACKET_12.0.3 + movsd 128(%esp), %xmm0 + addsd 2120(%ebx), %xmm0 + jmp .L_2TAG_PACKET_19.0.3 +.L_2TAG_PACKET_6.0.3: + movsd %xmm0, 48(%esp) + fldl 48(%esp) + jmp .L_2TAG_PACKET_11.0.3 +.L_2TAG_PACKET_19.0.3: + movsd %xmm0, 48(%esp) + fldl 48(%esp) + movl 16(%esp), %edx + andl $-24577, %edx + cmpl 16(%esp), %edx + je .L_2TAG_PACKET_11.0.3 + stmxcsr 24(%esp) + movl 16(%esp), %edx + andl $24576, %edx + orl %edx, 24(%esp) + ldmxcsr 24(%esp) +.L_2TAG_PACKET_11.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type exp2,@function + .size exp2,.-exp2 + .data +# -- End exp2 + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2851812149 + .long 5693 + .long 2595802551 + .long 1016815913 + .long 1048019041 + .long 11418 + .long 1398474845 + .long 3161559171 + .long 3899555717 + .long 17173 + .long 427280750 + .long 3163595548 + .long 3541402996 + .long 22960 + .long 2759177317 + .long 1015903202 + .long 702412510 + .long 28779 + .long 3803266086 + .long 3163328991 + .long 410360776 + .long 34629 + .long 1269990655 + .long 1013024446 + .long 3402036099 + .long 40510 + .long 405889333 + .long 1016154232 + .long 1828292879 + .long 46424 + .long 1255956746 + .long 1016636974 + .long 728909815 + .long 52370 + .long 383930225 + .long 1016078044 + .long 852742562 + .long 58348 + .long 667253586 + .long 1010842135 + .long 2952712987 + .long 64358 + .long 3293494651 + .long 3161168877 + .long 3490863953 + .long 70401 + .long 960797497 + .long 3163997456 + .long 3228316108 + .long 76477 + .long 3010241991 + .long 3159471380 + .long 2930322912 + .long 82586 + .long 2599499422 + .long 3163762623 + .long 3366293073 + .long 88728 + .long 3119426313 + .long 1015169130 + .long 1014845819 + .long 94904 + .long 3117910645 + .long 3162607681 + .long 948735466 + .long 101113 + .long 3516338027 + .long 3163623459 + .long 3949972341 + .long 107355 + .long 2068408548 + .long 1015962444 + .long 2214878420 + .long 113632 + .long 892270087 + .long 3164164998 + .long 828946858 + .long 119943 + .long 10642492 + .long 1016988014 + .long 586995997 + .long 126288 + .long 41662347 + .long 3163676568 + .long 2288159958 + .long 132667 + .long 2169144468 + .long 1015924597 + .long 2440944790 + .long 139081 + .long 2492769773 + .long 1015196030 + .long 1853186616 + .long 145530 + .long 3066496370 + .long 1016705150 + .long 1337108031 + .long 152014 + .long 3203724452 + .long 1015726421 + .long 1709341917 + .long 158533 + .long 2571168217 + .long 1015201075 + .long 3790955393 + .long 165087 + .long 2352942461 + .long 3164228666 + .long 4112506593 + .long 171677 + .long 2947355221 + .long 1015419624 + .long 3504003472 + .long 178303 + .long 3594001059 + .long 3158379228 + .long 2799960843 + .long 184965 + .long 1423655380 + .long 1016070727 + .long 2839424854 + .long 191663 + .long 1171596163 + .long 1014090255 + .long 171030293 + .long 198398 + .long 3526460132 + .long 1015477354 + .long 4232894513 + .long 205168 + .long 2383938684 + .long 1015717095 + .long 2992903935 + .long 211976 + .long 2218154405 + .long 1016276769 + .long 1603444721 + .long 218821 + .long 1548633640 + .long 3163249902 + .long 926591435 + .long 225703 + .long 3208833761 + .long 3163962090 + .long 1829099622 + .long 232622 + .long 1016661180 + .long 3164509581 + .long 887463927 + .long 239579 + .long 3596744162 + .long 3161842742 + .long 3272845541 + .long 246573 + .long 928852419 + .long 3164536824 + .long 1276261410 + .long 253606 + .long 300981947 + .long 1015732745 + .long 78413852 + .long 260677 + .long 4183226867 + .long 3164065827 + .long 569847338 + .long 267786 + .long 472945272 + .long 3160339305 + .long 3645941911 + .long 274933 + .long 3814685080 + .long 3162621917 + .long 1617004845 + .long 282120 + .long 82804943 + .long 1011391354 + .long 3978100823 + .long 289345 + .long 3513027190 + .long 1016894539 + .long 3049340112 + .long 296610 + .long 3062915824 + .long 1014219171 + .long 4040676318 + .long 303914 + .long 4090609238 + .long 1016712034 + .long 3577096743 + .long 311258 + .long 2951496418 + .long 1014842263 + .long 2583551245 + .long 318642 + .long 3161094195 + .long 1016655067 + .long 1990012071 + .long 326066 + .long 3529070563 + .long 3163861769 + .long 2731501122 + .long 333530 + .long 1774031854 + .long 3163518597 + .long 1453150082 + .long 341035 + .long 498154668 + .long 3162536638 + .long 3395129871 + .long 348580 + .long 4025345434 + .long 3163383964 + .long 917841882 + .long 356167 + .long 18715564 + .long 1016707884 + .long 3566716925 + .long 363794 + .long 1536826855 + .long 1015191009 + .long 3712504873 + .long 371463 + .long 88491948 + .long 1016476236 + .long 2321106615 + .long 379174 + .long 2171176610 + .long 1010584347 + .long 363667784 + .long 386927 + .long 813753949 + .long 1016833785 + .long 3111574537 + .long 394721 + .long 2606161479 + .long 3163808322 + .long 2956612997 + .long 402558 + .long 2118169750 + .long 3163784129 + .long 885834528 + .long 410438 + .long 1973258546 + .long 3163310140 + .long 2186617381 + .long 418360 + .long 2270764083 + .long 3164321289 + .long 3561793907 + .long 426325 + .long 1157054052 + .long 1012938926 + .long 1719614413 + .long 434334 + .long 330458197 + .long 3164331316 + .long 1963711167 + .long 442386 + .long 1744767756 + .long 3161622870 + .long 1013258799 + .long 450482 + .long 1748797610 + .long 3161177658 + .long 4182873220 + .long 458621 + .long 629542646 + .long 3163044879 + .long 3907805044 + .long 466805 + .long 2257091225 + .long 3162598983 + .long 1218806132 + .long 475034 + .long 1818613051 + .long 3163597017 + .long 1447192521 + .long 483307 + .long 1462857171 + .long 3163563097 + .long 1339972927 + .long 491625 + .long 167908908 + .long 1016620728 + .long 1944781191 + .long 499988 + .long 3993278767 + .long 3162772855 + .long 19972402 + .long 508397 + .long 3507899861 + .long 1017057868 + .long 919555682 + .long 516851 + .long 3121969534 + .long 1013996802 + .long 1413356050 + .long 525351 + .long 1651349290 + .long 3163716742 + .long 2571947539 + .long 533897 + .long 3558159063 + .long 3164425245 + .long 1176749997 + .long 542490 + .long 2738998779 + .long 3163084420 + .long 2604962541 + .long 551129 + .long 2614425274 + .long 3164587768 + .long 3649726105 + .long 559815 + .long 4085036346 + .long 1016698050 + .long 1110089947 + .long 568549 + .long 1451641638 + .long 1016523249 + .long 380978316 + .long 577330 + .long 854188970 + .long 3161511262 + .long 2568320822 + .long 586158 + .long 2732824428 + .long 1015401491 + .long 194117574 + .long 595035 + .long 777528611 + .long 3164460665 + .long 2966275557 + .long 603959 + .long 2176155323 + .long 3160891335 + .long 3418903055 + .long 612932 + .long 2527457337 + .long 3161869180 + .long 2682146384 + .long 621954 + .long 2082178512 + .long 3164411995 + .long 1892288442 + .long 631025 + .long 2446255666 + .long 3163648957 + .long 2191782032 + .long 640145 + .long 2960257726 + .long 1014791238 + .long 434316067 + .long 649315 + .long 2028358766 + .long 1014506698 + .long 2069751141 + .long 658534 + .long 1562170674 + .long 3163773257 + .long 3964284211 + .long 667803 + .long 2111583915 + .long 1016475740 + .long 2990417245 + .long 677123 + .long 3683467745 + .long 3164417902 + .long 321958744 + .long 686494 + .long 3401933766 + .long 1016843134 + .long 1434058175 + .long 695915 + .long 251133233 + .long 1016134345 + .long 3218338682 + .long 705387 + .long 3404164304 + .long 3163525684 + .long 2572866477 + .long 714911 + .long 878562433 + .long 1016570317 + .long 697153126 + .long 724487 + .long 1283515428 + .long 3164331765 + .long 3092190715 + .long 734114 + .long 814012167 + .long 3160571998 + .long 2380618042 + .long 743794 + .long 3149557219 + .long 3164369375 + .long 4076559943 + .long 753526 + .long 2119478330 + .long 3161806927 + .long 815859274 + .long 763312 + .long 240396590 + .long 3164536019 + .long 2420883922 + .long 773150 + .long 2049810052 + .long 1015168464 + .long 1540824585 + .long 783042 + .long 1064017010 + .long 3164536266 + .long 3716502172 + .long 792987 + .long 2303740125 + .long 1015091301 + .long 1610600570 + .long 802987 + .long 3766732298 + .long 1016808759 + .long 777507147 + .long 813041 + .long 4282924204 + .long 1016236109 + .long 2483480501 + .long 823149 + .long 1216371780 + .long 1014082748 + .long 3706687593 + .long 833312 + .long 3521726939 + .long 1014301643 + .long 1432208378 + .long 843531 + .long 1401068914 + .long 3163412539 + .long 1242007932 + .long 853805 + .long 1132034716 + .long 3164388407 + .long 135105010 + .long 864135 + .long 1906148727 + .long 3164424315 + .long 3707479175 + .long 874520 + .long 3613079302 + .long 1015213314 + .long 382305176 + .long 884963 + .long 2347622376 + .long 3163627201 + .long 64696965 + .long 895462 + .long 1768797490 + .long 1016865536 + .long 4076975200 + .long 906017 + .long 2029000898 + .long 1016257111 + .long 863738719 + .long 916631 + .long 1326992219 + .long 3163661773 + .long 351641897 + .long 927302 + .long 2172261526 + .long 3164059175 + .long 3884662774 + .long 938030 + .long 2158611599 + .long 1015258761 + .long 4224142467 + .long 948817 + .long 3389820385 + .long 1016255778 + .long 2728693978 + .long 959663 + .long 396109971 + .long 3164511267 + .long 764307441 + .long 970568 + .long 3021057420 + .long 3164378099 + .long 3999357479 + .long 981531 + .long 2258941616 + .long 1016973300 + .long 929806999 + .long 992555 + .long 3205336643 + .long 1016308133 + .long 1533953344 + .long 1003638 + .long 769171850 + .long 1016714209 + .long 2912730644 + .long 1014781 + .long 3490067721 + .long 3164453650 + .long 2174652632 + .long 1025985 + .long 4087714590 + .long 1015498835 + .long 730821105 + .long 1037250 + .long 2523232743 + .long 1013115764 + .long 3884607281 + .long 1025890431 + .long 3607404735 + .long 1046244104 + .long 1874480759 + .long 1036235435 + .long 4286760334 + .long 1055834045 + .long 4277811695 + .long 1064709698 + .long 0 + .long 0 + .long 0 + .long 7340032 + .long 0 + .long 1072693248 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 4294967295 + .long 2146435071 + .long 0 + .long 508559360 + .long 4294967295 + .long 4294967295 + .type static_const_table,@object + .size static_const_table,2168 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/exp2f_wmt.S b/external/sgx_libm/ia32/exp2f_wmt.S new file mode 100644 index 0000000000..acfe909d67 --- /dev/null +++ b/external/sgx_libm/ia32/exp2f_wmt.S @@ -0,0 +1,754 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp2f_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin exp2f + .text + .align 16,0x90 + .globl exp2f +exp2f: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %ecx + xorpd %xmm7, %xmm7 + movl $17080, %eax + pinsrw $3, %eax, %xmm7 + cvtps2pd %xmm0, %xmm3 + andl $2147483647, %ecx + subl $830472192, %ecx + cmpl $293339136, %ecx + jae .L_2TAG_PACKET_0.0.3 + movsd 2048(%ebx), %xmm6 + movapd %xmm7, %xmm2 + addsd %xmm3, %xmm7 + xorpd %xmm1, %xmm1 + movsd 2056(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + addl $830472192, %ecx + cmpl $830472192, %ecx + jb .L_2TAG_PACKET_2.0.3 + cmpl $1126170624, %ecx + jae .L_2TAG_PACKET_3.0.3 + movsd 2048(%ebx), %xmm6 + movapd %xmm7, %xmm2 + addsd %xmm3, %xmm7 + xorpd %xmm1, %xmm1 + movsd 2056(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + cmpl $8388608, %eax + jb .L_2TAG_PACKET_4.0.3 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movd %xmm0, %edx + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_6.0.3 + testl $-2147483648, %edx + je .L_2TAG_PACKET_5.0.3 + movl $8388608, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_4.0.3: + movl $164, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_5.0.3: + movl $2130706432, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 + movl $163, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_2.0.3: + movl $1065353216, %eax + movd %eax, %xmm1 + addss %xmm1, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + cmpl $-8388608, %edx + je .L_2TAG_PACKET_9.0.3 + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_9.0.3: + fldz + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_1.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type exp2f,@function + .size exp2f,.-exp2f + .data +# -- End exp2f + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 4200250559 + .long 1072696090 + .long 2851812149 + .long 1072698941 + .long 339411585 + .long 1072701800 + .long 1048019041 + .long 1072704666 + .long 772914124 + .long 1072707540 + .long 3899555717 + .long 1072710421 + .long 1928746161 + .long 1072713311 + .long 3541402996 + .long 1072716208 + .long 238821257 + .long 1072719114 + .long 702412510 + .long 1072722027 + .long 728934454 + .long 1072724948 + .long 410360776 + .long 1072727877 + .long 4133881824 + .long 1072730813 + .long 3402036099 + .long 1072733758 + .long 2602514713 + .long 1072736711 + .long 1828292879 + .long 1072739672 + .long 1172597893 + .long 1072742641 + .long 728909815 + .long 1072745618 + .long 590962156 + .long 1072748603 + .long 852742562 + .long 1072751596 + .long 1608493509 + .long 1072754597 + .long 2952712987 + .long 1072757606 + .long 685187902 + .long 1072760624 + .long 3490863953 + .long 1072763649 + .long 2875075254 + .long 1072766683 + .long 3228316108 + .long 1072769725 + .long 351405227 + .long 1072772776 + .long 2930322912 + .long 1072775834 + .long 2471440686 + .long 1072778901 + .long 3366293073 + .long 1072781976 + .long 1416741826 + .long 1072785060 + .long 1014845819 + .long 1072788152 + .long 2257959872 + .long 1072791252 + .long 948735466 + .long 1072794361 + .long 1480023343 + .long 1072797478 + .long 3949972341 + .long 1072800603 + .long 4162030108 + .long 1072803737 + .long 2214878420 + .long 1072806880 + .long 2502433899 + .long 1072810031 + .long 828946858 + .long 1072813191 + .long 1588871207 + .long 1072816359 + .long 586995997 + .long 1072819536 + .long 2218315341 + .long 1072822721 + .long 2288159958 + .long 1072825915 + .long 897099801 + .long 1072829118 + .long 2440944790 + .long 1072832329 + .long 2725843665 + .long 1072835549 + .long 1853186616 + .long 1072838778 + .long 4219606026 + .long 1072842015 + .long 1337108031 + .long 1072845262 + .long 1897844341 + .long 1072848517 + .long 1709341917 + .long 1072851781 + .long 874372905 + .long 1072855054 + .long 3790955393 + .long 1072858335 + .long 1972484976 + .long 1072861626 + .long 4112506593 + .long 1072864925 + .long 1724976915 + .long 1072868234 + .long 3504003472 + .long 1072871551 + .long 964107055 + .long 1072874878 + .long 2799960843 + .long 1072878213 + .long 526652809 + .long 1072881558 + .long 2839424854 + .long 1072884911 + .long 1253935211 + .long 1072888274 + .long 171030293 + .long 1072891646 + .long 3991843581 + .long 1072895026 + .long 4232894513 + .long 1072898416 + .long 1000925746 + .long 1072901816 + .long 2992903935 + .long 1072905224 + .long 1726216749 + .long 1072908642 + .long 1603444721 + .long 1072912069 + .long 2732492859 + .long 1072915505 + .long 926591435 + .long 1072918951 + .long 589198666 + .long 1072922406 + .long 1829099622 + .long 1072925870 + .long 460407023 + .long 1072929344 + .long 887463927 + .long 1072932827 + .long 3219942644 + .long 1072936319 + .long 3272845541 + .long 1072939821 + .long 1156440435 + .long 1072943333 + .long 1276261410 + .long 1072946854 + .long 3743175029 + .long 1072950384 + .long 78413852 + .long 1072953925 + .long 3278348324 + .long 1072957474 + .long 569847338 + .long 1072961034 + .long 654919306 + .long 1072964603 + .long 3645941911 + .long 1072968181 + .long 1065662932 + .long 1072971770 + .long 1617004845 + .long 1072975368 + .long 1118294578 + .long 1072978976 + .long 3978100823 + .long 1072982593 + .long 1720398391 + .long 1072986221 + .long 3049340112 + .long 1072989858 + .long 3784486610 + .long 1072993505 + .long 4040676318 + .long 1072997162 + .long 3933059031 + .long 1073000829 + .long 3577096743 + .long 1073004506 + .long 3088564500 + .long 1073008193 + .long 2583551245 + .long 1073011890 + .long 2178460671 + .long 1073015597 + .long 1990012071 + .long 1073019314 + .long 2135241198 + .long 1073023041 + .long 2731501122 + .long 1073026778 + .long 3896463087 + .long 1073030525 + .long 1453150082 + .long 1073034283 + .long 4109806887 + .long 1073038050 + .long 3395129871 + .long 1073041828 + .long 3723038930 + .long 1073045616 + .long 917841882 + .long 1073049415 + .long 3689071823 + .long 1073053223 + .long 3566716925 + .long 1073057042 + .long 671025100 + .long 1073060872 + .long 3712504873 + .long 1073064711 + .long 4222122499 + .long 1073068561 + .long 2321106615 + .long 1073072422 + .long 2425981843 + .long 1073076293 + .long 363667784 + .long 1073080175 + .long 551349105 + .long 1073084067 + .long 3111574537 + .long 1073087969 + .long 3872257780 + .long 1073091882 + .long 2956612997 + .long 1073095806 + .long 488188413 + .long 1073099741 + .long 885834528 + .long 1073103686 + .long 4273770423 + .long 1073107641 + .long 2186617381 + .long 1073111608 + .long 3339203574 + .long 1073115585 + .long 3561793907 + .long 1073119573 + .long 2979960120 + .long 1073123572 + .long 1719614413 + .long 1073127582 + .long 4201977662 + .long 1073131602 + .long 1963711167 + .long 1073135634 + .long 3721688645 + .long 1073139676 + .long 1013258799 + .long 1073143730 + .long 2555984613 + .long 1073147794 + .long 4182873220 + .long 1073151869 + .long 1727278727 + .long 1073155956 + .long 3907805044 + .long 1073160053 + .long 2263535754 + .long 1073164162 + .long 1218806132 + .long 1073168282 + .long 903334909 + .long 1073172413 + .long 1447192521 + .long 1073176555 + .long 2980802057 + .long 1073180708 + .long 1339972927 + .long 1073184873 + .long 950803702 + .long 1073189049 + .long 1944781191 + .long 1073193236 + .long 158781403 + .long 1073197435 + .long 19972402 + .long 1073201645 + .long 1660913392 + .long 1073205866 + .long 919555682 + .long 1073210099 + .long 2224145553 + .long 1073214343 + .long 1413356050 + .long 1073218599 + .long 2916157145 + .long 1073222866 + .long 2571947539 + .long 1073227145 + .long 515457527 + .long 1073231436 + .long 1176749997 + .long 1073235738 + .long 396319521 + .long 1073240052 + .long 2604962541 + .long 1073244377 + .long 3643909174 + .long 1073248714 + .long 3649726105 + .long 1073253063 + .long 2759350287 + .long 1073257424 + .long 1110089947 + .long 1073261797 + .long 3134592888 + .long 1073266181 + .long 380978316 + .long 1073270578 + .long 1577608921 + .long 1073274986 + .long 2568320822 + .long 1073279406 + .long 3492293770 + .long 1073283838 + .long 194117574 + .long 1073288283 + .long 1403662306 + .long 1073292739 + .long 2966275557 + .long 1073297207 + .long 727685349 + .long 1073301688 + .long 3418903055 + .long 1073306180 + .long 2591453363 + .long 1073310685 + .long 2682146384 + .long 1073315202 + .long 3833209506 + .long 1073319731 + .long 1892288442 + .long 1073324273 + .long 1297350157 + .long 1073328827 + .long 2191782032 + .long 1073333393 + .long 424392917 + .long 1073337972 + .long 434316067 + .long 1073342563 + .long 2366108318 + .long 1073347166 + .long 2069751141 + .long 1073351782 + .long 3985553595 + .long 1073356410 + .long 3964284211 + .long 1073361051 + .long 2152073944 + .long 1073365705 + .long 2990417245 + .long 1073370371 + .long 2331271250 + .long 1073375050 + .long 321958744 + .long 1073379742 + .long 1405169241 + .long 1073384446 + .long 1434058175 + .long 1073389163 + .long 557149882 + .long 1073393893 + .long 3218338682 + .long 1073398635 + .long 977020788 + .long 1073403391 + .long 2572866477 + .long 1073408159 + .long 3861050111 + .long 1073412940 + .long 697153126 + .long 1073417735 + .long 1822067026 + .long 1073422542 + .long 3092190715 + .long 1073427362 + .long 364333489 + .long 1073432196 + .long 2380618042 + .long 1073437042 + .long 703710506 + .long 1073441902 + .long 4076559943 + .long 1073446774 + .long 4062661092 + .long 1073451660 + .long 815859274 + .long 1073456560 + .long 3080351519 + .long 1073461472 + .long 2420883922 + .long 1073466398 + .long 3287523847 + .long 1073471337 + .long 1540824585 + .long 1073476290 + .long 1631695677 + .long 1073481256 + .long 3716502172 + .long 1073486235 + .long 3657065772 + .long 1073491228 + .long 1610600570 + .long 1073496235 + .long 2029714210 + .long 1073501255 + .long 777507147 + .long 1073506289 + .long 2307442995 + .long 1073511336 + .long 2483480501 + .long 1073516397 + .long 1464976603 + .long 1073521472 + .long 3706687593 + .long 1073526560 + .long 778901109 + .long 1073531663 + .long 1432208378 + .long 1073536779 + .long 1532734324 + .long 1073541909 + .long 1242007932 + .long 1073547053 + .long 721996136 + .long 1073552211 + .long 135105010 + .long 1073557383 + .long 3939148246 + .long 1073562568 + .long 3707479175 + .long 1073567768 + .long 3898795731 + .long 1073572982 + .long 382305176 + .long 1073578211 + .long 1912561781 + .long 1073583453 + .long 64696965 + .long 1073588710 + .long 3594158869 + .long 1073593980 + .long 4076975200 + .long 1073599265 + .long 1679558232 + .long 1073604565 + .long 863738719 + .long 1073609879 + .long 1796832535 + .long 1073615207 + .long 351641897 + .long 1073620550 + .long 991358482 + .long 1073625907 + .long 3884662774 + .long 1073631278 + .long 610758006 + .long 1073636665 + .long 4224142467 + .long 1073642065 + .long 2009970496 + .long 1073647481 + .long 2728693978 + .long 1073652911 + .long 2256325230 + .long 1073658356 + .long 764307441 + .long 1073663816 + .long 2719515920 + .long 1073669290 + .long 3999357479 + .long 1073674779 + .long 481706282 + .long 1073680284 + .long 929806999 + .long 1073685803 + .long 1222472308 + .long 1073691337 + .long 1533953344 + .long 1073696886 + .long 2038973688 + .long 1073702450 + .long 2912730644 + .long 1073708029 + .long 35929225 + .long 1073713624 + .long 2174652632 + .long 1073719233 + .long 915592468 + .long 1073724858 + .long 730821105 + .long 1073730498 + .long 1797923801 + .long 1073736153 + .long 4286760334 + .long 1070514109 + .long 4277826245 + .long 1072049730 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,2080 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/exp2l.S b/external/sgx_libm/ia32/exp2l.S new file mode 100644 index 0000000000..7318adec21 --- /dev/null +++ b/external/sgx_libm/ia32/exp2l.S @@ -0,0 +1,1010 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp2l.c" + .text +..TXTST0: +# -- Begin exp2l + .text + .align 16,0x90 + .globl exp2l +exp2l: +# parameter 1: 80 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + subl $64, %esp +..B1.2: + fnstcw 54(%esp) +..B1.3: + movzwl 88(%esp), %ebx + movl %ebx, %eax + andl $32767, %eax + lea -16383(%eax), %edx + cmpl $15, %edx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + jae ..B1.10 +..B1.4: + movl %eax, %ecx + movl $-1, %esi + negl %ecx + addl $30, %ecx + shll %cl, %esi + notl %esi + andl 84(%esp), %esi + orl 80(%esp), %esi + jne ..B1.10 +..B1.5: + fldt 80(%esp) + faddl _TWO_23H@GOTOFF(%edx) + fstps 48(%esp) + movl 48(%esp), %ecx + shll $10, %ecx + sarl $10, %ecx + lea 16445(%ecx), %eax + cmpl $32828, %eax + ja ..B1.9 +..B1.6: + movl %ecx, %edx + andb $127, 21(%esp) + addl $16383, %edx + jle ..B1.77 +..B1.7: + movzwl 20(%esp), %eax + andl $32767, %edx + andl $-32768, %eax + orl %edx, %eax + movw %ax, 20(%esp) + movl $-2147483648, 16(%esp) + movl $0, 12(%esp) +..B1.8: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.9: + movl %ebx, %eax + andl $32767, %eax +..B1.10: + cmpl $16389, %eax + jge ..B1.49 +..B1.11: + movzwl 54(%esp), %ecx + cmpl $16377, %eax + jge ..B1.42 +..B1.12: + cmpl $16369, %eax + jge ..B1.35 +..B1.13: + cmpl $16359, %eax + jge ..B1.28 +..B1.14: + cmpl $16316, %eax + jge ..B1.21 +..B1.15: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.80 +..B1.16: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.17: + fldcw 52(%esp) +..B1.18: + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fldt 80(%esp) + faddp %st, %st(1) + fstpt 12(%esp) +..B1.19: + fldcw 54(%esp) +..B1.20: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.21: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.81 +..B1.22: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.23: + fldcw 52(%esp) +..B1.24: + movl $1, %eax +..B1.25: + fldt 80(%esp) + testl %eax, %eax + fldt 12+_Q2@GOTOFF(%edx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + faddp %st, %st(1) + fstpt 12(%esp) + je ..B1.27 +..B1.26: + fldcw 54(%esp) +..B1.27: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.28: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.82 +..B1.29: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.30: + fldcw 52(%esp) +..B1.31: + movl $1, %eax +..B1.32: + fldt 80(%esp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%edx) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%edx) + fmul %st(2), %st + fldt 12+_Q1@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + faddp %st, %st(1) + fstpt 12(%esp) + je ..B1.34 +..B1.33: + fldcw 54(%esp) +..B1.34: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.35: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.83 +..B1.36: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.37: + fldcw 52(%esp) +..B1.38: + movl $1, %eax +..B1.39: + fldl _TWO_48H@GOTOFF(%edx) + testl %eax, %eax + fldt 80(%esp) + fld %st(0) + fmul %st(1), %st + fld %st(1) + fadd %st(3), %st + fsub %st, %st(3) + fld %st(2) + fsub %st(4), %st + fldt 84+_Q0@GOTOFF(%edx) + fmul %st(3), %st + fldt 72+_Q0@GOTOFF(%edx) + fmul %st(4), %st + fldt 60+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 48+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 36+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 24+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 12+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fldt _Q0@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 96+_Q0@GOTOFF(%edx) + fmul %st, %st(4) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + je ..B1.100 +..B1.40: + fstpt 24(%esp) +..B1.96: + fldcw 54(%esp) + jmp ..B1.41 +..B1.100: + fstp %st(0) +..B1.41: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.42: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.84 +..B1.43: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.44: + fldcw 52(%esp) +..B1.45: + movl $1, %ebx +..B1.46: + fldl _TWO_63H@GOTOFF(%edx) + fldt 80(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(1), %st + fadd %st(2), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(2) + movl 24(%esp), %eax + fsubp %st, %st(1) + fldl _TWO_48H@GOTOFF(%edx) + fld %st(0) + movsbl %al, %ecx + fadd %st(2), %st + subl %ecx, %eax + fsub %st, %st(1) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + shll $4, %ecx + fxch %st(2) + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt 60+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%edx) + shrl $8, %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + shll $23, %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + addl $1065353216, %eax + fldt 12+_P@GOTOFF(%edx) + testl %ebx, %ebx + movl %eax, 36(%esp) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 72+_P@GOTOFF(%edx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%ecx) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%ecx) + fld %st(0) + fmul %st(5), %st + fxch %st(4) + fadd %st, %st(5) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmul %st(3), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmuls 36(%esp) + fstpt 12(%esp) + je ..B1.101 +..B1.47: + fstpt 24(%esp) +..B1.97: + fldcw 54(%esp) + jmp ..B1.48 +..B1.101: + fstp %st(0) +..B1.48: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.49: + movzbl 89(%esp), %ebx + andl $128, %ebx + shrl $7, %ebx + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ecx + movzwl 8+_ranges@GOTOFF(%ecx,%edx), %esi + andl $32767, %esi + cmpl %esi, %eax + jl ..B1.54 +..B1.50: + jne ..B1.66 +..B1.51: + movl 84(%esp), %esi + cmpl 4+_ranges@GOTOFF(%ecx,%edx), %esi + jb ..B1.54 +..B1.52: + jne ..B1.66 +..B1.53: + movl 80(%esp), %esi + cmpl _ranges@GOTOFF(%ecx,%edx), %esi + jae ..B1.66 +..B1.54: + movzwl 54(%esp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.88 +..B1.55: + orl $-64768, %esi + movw %si, 52(%esp) +..B1.56: + fldcw 52(%esp) +..B1.57: + movl $1, %esi +..B1.58: + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fstpt 36(%esp) + fldl _TWO_63H@GOTOFF(%edx) + fldt 80(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(1), %st + movl %ecx, 12(%esp) + fadd %st(2), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmulp %st, %st(2) + movl 24(%esp), %eax + movl %eax, %ecx + movsbl %al, %edi + addl $4196735, %eax + subl %edi, %ecx + fsubp %st, %st(1) + fldl _TWO_48H@GOTOFF(%edx) + fld %st(0) + shll $4, %edi + fadd %st(2), %st + shrl $8, %ecx + fsub %st, %st(1) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + addl SC2_BIAS@GOTOFF(%edx,%ebx,4), %ecx + fxch %st(2) + fadd %st(3), %st + fld %st(0) + andl $32767, %ecx + fmul %st(1), %st + fldt 60+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%edx) + movl %esi, 16(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + movzwl 8+.L_2il0floatpacket.2@GOTOFF(%edx), %esi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + andl $-32768, %esi + fldt 12+_P@GOTOFF(%edx) + orl %ecx, %esi + movw %si, 44(%esp) + cmpl $3070, %eax + movl 16(%esp), %esi + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fldt _P@GOTOFF(%edx) + movl 12(%esp), %ecx + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 72+_P@GOTOFF(%edx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(2) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%edi) + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fadd %st, %st(4) + fmul %st(1), %st + faddp %st, %st(1) + fxch %st(3) + fmull 2056+__libm_expl_table_256@GOTOFF(%edx,%edi) + faddp %st, %st(2) + fldt 80(%esp) + fxch %st(2) + faddl 2056+__libm_expl_table_256@GOTOFF(%edx,%edi) + ja ..B1.61 +..B1.59: + fldt _exp2but@GOTOFF(%edx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.61 +..B1.60: + fstp %st(1) + fstp %st(1) + fldl _TWO_12H@GOTOFF(%edx) + fld %st(2) + fadd %st(2), %st + fmul %st, %st(1) + fadd %st(1), %st + fsub %st, %st(1) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt _SC2@GOTOFF(%ecx,%edx) + fldt 36(%esp) + fmul %st, %st(4) + fxch %st(1) + fmul %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + jmp ..B1.62 +..B1.61: + fstp %st(2) + fldt 36(%esp) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fldt _SC2@GOTOFF(%ecx,%edx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) +..B1.62: + fldt _minnorm@GOTOFF(%edx) + fcompp + fnstsw %ax + sahf + ja ..B1.85 +..B1.63: + testl %esi, %esi + je ..B1.102 +..B1.64: + fstpt 24(%esp) +..B1.98: + fldcw 54(%esp) + jmp ..B1.65 +..B1.102: + fstp %st(0) +..B1.65: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.66: + movzwl 54(%esp), %esi + movl %esi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.93 +..B1.67: + orl $-64768, %esi + movw %si, 52(%esp) +..B1.68: + fldcw 52(%esp) +..B1.69: + movzwl 88(%esp), %eax + movl $1, %ecx + andl $32767, %eax +..B1.70: + cmpl $32767, %eax + je ..B1.89 +..B1.71: + testl %ebx, %ebx + je ..B1.73 +..B1.72: + fldt _small_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt 12(%esp) + jmp ..B1.74 +..B1.73: + fldt _large_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt 12(%esp) +..B1.74: + testl %ecx, %ecx + je ..B1.76 +..B1.75: + fldcw 54(%esp) +..B1.76: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.77: + movzwl 20(%esp), %eax + andl $-32768, %eax + movw %ax, 20(%esp) + cmpl $-31, %edx + jle ..B1.79 +..B1.78: + addl $16413, %ecx + movl $1, %eax + shll %cl, %eax + movl %eax, 16(%esp) + movl $0, 12(%esp) + jmp ..B1.8 +..B1.79: + addl $16413, %ecx + movl $1, %eax + shll %cl, %eax + movl $0, 16(%esp) + movl %eax, 12(%esp) + jmp ..B1.8 +..B1.80: + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fldt 80(%esp) + faddp %st, %st(1) + fstpt 12(%esp) + jmp ..B1.20 +..B1.81: + xorl %eax, %eax + jmp ..B1.25 +..B1.82: + xorl %eax, %eax + jmp ..B1.32 +..B1.83: + xorl %eax, %eax + jmp ..B1.39 +..B1.84: + xorl %ebx, %ebx + jmp ..B1.46 +..B1.85: + fldt _small_value_80@GOTOFF(%edx) + testl %esi, %esi + fmul %st(0), %st + fstpt (%esp) + je ..B1.103 +..B1.86: + fstpt 24(%esp) +..B1.99: + fldcw 54(%esp) + jmp ..B1.87 +..B1.103: + fstp %st(0) +..B1.87: + fldt 12(%esp) + addl $64, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.88: + xorl %esi, %esi + jmp ..B1.58 +..B1.89: + cmpl $-2147483648, 84(%esp) + jne ..B1.92 +..B1.90: + cmpl $0, 80(%esp) + jne ..B1.92 +..B1.91: + fldl _inf_zeros@GOTOFF(%edx,%ebx,8) + fstpt 12(%esp) + jmp ..B1.74 +..B1.92: + fldt 80(%esp) + fstpt 12(%esp) + jmp ..B1.74 +..B1.93: + xorl %ecx, %ecx + jmp ..B1.70 + .align 16,0x90 + .type exp2l,@function + .size exp2l,.-exp2l + .data +# -- End exp2l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf7,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .align 4 +_TWO_23H: + .long 0 + .long 1097334784 + .type _TWO_23H,@object + .size _TWO_23H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +SC2_BIAS: + .long 8191 + .long 24575 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .align 2 +_Q2: + .word 32967 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 32541 + .word 5676 + .word 61436 + .word 62973 + .word 16380 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 31148 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 30019 + .word 5676 + .word 61436 + .word 62973 + .word 16380 + .word 0 + .word 64504 + .word 31847 + .word 18104 + .word 58200 + .word 16378 + .word 0 + .word 27878 + .word 3845 + .word 23422 + .word 40341 + .word 16376 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q0: + .word 20226 + .word 52574 + .word 36475 + .word 49086 + .word 16363 + .word 0 + .word 30019 + .word 5676 + .word 61436 + .word 62973 + .word 16380 + .word 0 + .word 64711 + .word 9477 + .word 18104 + .word 58200 + .word 16378 + .word 0 + .word 47522 + .word 53875 + .word 23421 + .word 40341 + .word 16376 + .word 0 + .word 43745 + .word 20212 + .word 65340 + .word 44739 + .word 16373 + .word 0 + .word 65207 + .word 12853 + .word 35196 + .word 41348 + .word 16370 + .word 0 + .word 16083 + .word 62062 + .word 13520 + .word 65510 + .word 16366 + .word 0 + .word 39312 + .word 30281 + .word 14077 + .word 45408 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45426 + .word 16382 + .word 0 + .type _Q0,@object + .size _Q0,108 + .align 2 +_P: + .word 12039 + .word 52575 + .word 36475 + .word 49086 + .word 16363 + .word 0 + .word 30020 + .word 5676 + .word 61436 + .word 62973 + .word 16380 + .word 0 + .word 64966 + .word 9463 + .word 18104 + .word 58200 + .word 16378 + .word 0 + .word 46891 + .word 53866 + .word 23421 + .word 40341 + .word 16376 + .word 0 + .word 12114 + .word 63546 + .word 699 + .word 44740 + .word 16373 + .word 0 + .word 63250 + .word 29232 + .word 35994 + .word 41348 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45426 + .word 16382 + .word 0 + .type _P,@object + .size _P,84 + .align 2 +_ranges: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16397 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 32894 + .word 16397 + .word 0 + .type _ranges,@object + .size _ranges,24 + .align 2 +_exp2but: + .word 0 + .word 0 + .word 0 + .word 65528 + .word 49164 + .word 0 + .type _exp2but,@object + .size _exp2but,12 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _SC2,@object + .size _SC2,24 + .align 2 +_minnorm: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _minnorm,@object + .size _minnorm,12 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/exp_table.S b/external/sgx_libm/ia32/exp_table.S new file mode 100644 index 0000000000..4463ad2089 --- /dev/null +++ b/external/sgx_libm/ia32/exp_table.S @@ -0,0 +1,522 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_exp_hi_table_64 + .globl __libm_exp_hi_table_64 +__libm_exp_hi_table_64: + .long 0x667f3c00,0x3fe6a09e + .long 0x3c651a40,0x3fe6dfb2 + .long 0xe8ec5f80,0x3fe71f75 + .long 0x56426800,0x3fe75feb + .long 0x73eb01c0,0x3fe7a114 + .long 0x36cf4e80,0x3fe7e2f3 + .long 0x994cce20,0x3fe82589 + .long 0x9b449300,0x3fe868d9 + .long 0x422aa0e0,0x3fe8ace5 + .long 0x99157740,0x3fe8f1ae + .long 0xb0cdc600,0x3fe93737 + .long 0x9fde4e60,0x3fe97d82 + .long 0x82a3f0a0,0x3fe9c491 + .long 0x7b5de580,0x3fea0c66 + .long 0xb23e2560,0x3fea5503 + .long 0x5579fdc0,0x3fea9e6b + .long 0x995ad3c0,0x3feae89f + .long 0xb84f1600,0x3feb33a2 + .long 0xf2fb5e60,0x3feb7f76 + .long 0x904bc1e0,0x3febcc1e + .long 0xdd8552a0,0x3fec199b + .long 0x2e57d150,0x3fec67f1 + .long 0xdcef9070,0x3fecb720 + .long 0x4a078980,0x3fed072d + .long 0xdcfba490,0x3fed5818 + .long 0x03db3290,0x3feda9e6 + .long 0x337b9b60,0x3fedfc97 + .long 0xe78b3ff8,0x3fee502e + .long 0xa2a490e0,0x3feea4af + .long 0xee615a28,0x3feefa1b + .long 0x5b6e4544,0x3fef5076 + .long 0x819e90da,0x3fefa7c1 + .long 0x00000000,0x3ff00000 + .long 0x3e778060,0x3ff02c9a + .long 0xd3158574,0x3ff059b0 + .long 0x18759bc8,0x3ff08745 + .long 0x6cf9890c,0x3ff0b558 + .long 0x32d3d1a0,0x3ff0e3ec + .long 0xd0125b50,0x3ff11301 + .long 0xaea92dd8,0x3ff1429a + .long 0x3c7d5178,0x3ff172b8 + .long 0xeb6fcb70,0x3ff1a35b + .long 0x3168b9a8,0x3ff1d487 + .long 0x88628cd0,0x3ff2063b + .long 0x6e756230,0x3ff2387a + .long 0x65e27cd0,0x3ff26b45 + .long 0xf51fdee0,0x3ff29e9d + .long 0xa6e40300,0x3ff2d285 + .long 0x0a31b710,0x3ff306fe + .long 0xb26416f0,0x3ff33c08 + .long 0x373aa9c0,0x3ff371a7 + .long 0x34e59ff0,0x3ff3a7db + .long 0x4c123420,0x3ff3dea6 + .long 0x21f72e20,0x3ff4160a + .long 0x60618920,0x3ff44e08 + .long 0xb5c13cc0,0x3ff486a2 + .long 0xd5362a20,0x3ff4bfda + .long 0x769d2ca0,0x3ff4f9b2 + .long 0x569d4f80,0x3ff5342b + .long 0x36b527c0,0x3ff56f47 + .long 0xdd485420,0x3ff5ab07 + .long 0x15ad2140,0x3ff5e76f + .long 0xb03a5580,0x3ff6247e + .long 0x82552220,0x3ff66238 + .long 0x667f3bc0,0x3ff6a09e + .type __libm_exp_hi_table_64,@object + .size __libm_exp_hi_table_64,520 + .space 8, 0x00 # pad + .align 16 + .hidden __libm_exp_mi_table_64 + .globl __libm_exp_mi_table_64 +__libm_exp_mi_table_64: + .long 0x33018800,0xbfd2bec3 + .long 0x8735cb80,0xbfd2409b + .long 0x2e274100,0xbfd1c114 + .long 0x537b3000,0xbfd14029 + .long 0x1829fc80,0xbfd0bdd7 + .long 0x92616300,0xbfd03a19 + .long 0x9accc780,0xbfcf69d9 + .long 0x92edb400,0xbfce5c99 + .long 0xf7557c80,0xbfcd4c6a + .long 0x9baa2300,0xbfcc3945 + .long 0x3cc8e800,0xbfcb2321 + .long 0x8086c680,0xbfca09f5 + .long 0xf5703d80,0xbfc8edb9 + .long 0x12886a00,0xbfc7ce66 + .long 0x37076a80,0xbfc6abf1 + .long 0xaa180900,0xbfc58652 + .long 0x9a94b100,0xbfc45d81 + .long 0x1ec3a800,0xbfc33175 + .long 0x34128680,0xbfc20224 + .long 0xbed0f880,0xbfc0cf85 + .long 0x13d56b00,0xbfbf3321 + .long 0x8d417580,0xbfbcc076 + .long 0x18837c80,0xbfba46f9 + .long 0xafc3b400,0xbfb7c695 + .long 0x1822db80,0xbfb53f39 + .long 0xe1266b80,0xbfb2b0cf + .long 0x64232500,0xbfb01b46 + .long 0x874c0080,0xbfaafd11 + .long 0xd5b6f200,0xbfa5b505 + .long 0x19ea5d80,0xbfa05e41 + .long 0x92375780,0xbf95f134 + .long 0x985bc980,0xbf860f9f + .long 0x00000000,0x00000000 + .long 0x3bc03000,0x3f864d1f + .long 0xc5615d00,0x3f966c34 + .long 0x0eb37900,0x3fa0e8a3 + .long 0x9f312180,0x3fa6ab0d + .long 0x5a7a3400,0x3fac7d86 + .long 0x0125b500,0x3fb1301d + .long 0xea92dd80,0x3fb429aa + .long 0xc7d51780,0x3fb72b83 + .long 0xb6fcb700,0x3fba35be + .long 0x168b9a80,0x3fbd4873 + .long 0x43146680,0x3fc031dc + .long 0x73ab1180,0x3fc1c3d3 + .long 0x2f13e680,0x3fc35a2b + .long 0xa8fef700,0x3fc4f4ef + .long 0x37201800,0x3fc6942d + .long 0x518db880,0x3fc837f0 + .long 0x9320b780,0x3fc9e045 + .long 0xb9d54e00,0x3fcb8d39 + .long 0xa72cff80,0x3fcd3ed9 + .long 0x6091a100,0x3fcef532 + .long 0x87dcb880,0x3fd05828 + .long 0x81862480,0x3fd13821 + .long 0xd704f300,0x3fd21a8a + .long 0x54d8a880,0x3fd2ff6b + .long 0xda74b280,0x3fd3e6c9 + .long 0x5a753e00,0x3fd4d0ad + .long 0xdad49f00,0x3fd5bd1c + .long 0x75215080,0x3fd6ac1f + .long 0x56b48500,0x3fd79dbc + .long 0xc0e95600,0x3fd891fa + .long 0x09548880,0x3fd988e2 + .long 0x99fcef00,0x3fda8279 + .type __libm_exp_mi_table_64,@object + .size __libm_exp_mi_table_64,520 + .space 8, 0x00 # pad + .align 16 + .hidden __libm_exp_lo_table_64 + .globl __libm_exp_lo_table_64 +__libm_exp_lo_table_64: + .long 0x682764c9,0xbcf9b7ba + .long 0x1d341e44,0xbce10ddf + .long 0x1e1a21ea,0xbcd845b9 + .long 0xb2ae62dc,0xbcfba048 + .long 0x77ee0499,0xbcfc9415 + .long 0xfd45ea87,0xbcedefa2 + .long 0xeea0a997,0xbcdaea60 + .long 0xe26f53db,0xbce37f1b + .long 0xea979b4e,0xbcc29160 + .long 0xb17471a2,0xbcd3a8cf + .long 0xe3c0dabf,0xbceb0baf + .long 0x6df06e17,0xbce07461 + .long 0x729f1c1b,0xbcdfc707 + .long 0x25747355,0xbceb4d65 + .long 0xdb71a83c,0xbcbba5ed + .long 0x78840167,0xbc97829b + .long 0xcb2e88ce,0xbce2a178 + .long 0xbc6109ae,0xbcc42500 + .long 0x4f7e54ac,0xbce91558 + .long 0xbe174986,0xbcdbb708 + .long 0xa76afb72,0xbcbeeef9 + .long 0x200b7c35,0xbcc2d77b + .long 0xd0b85ad9,0xbccbabf0 + .long 0x743797aa,0xbcc1cbc3 + .long 0xf4a29324,0xbcd1b44b + .long 0xfcb49256,0xbcd51ee7 + .long 0x53c612d7,0xbca46973 + .long 0xcfeac66e,0xbcad8c2e + .long 0x3179c289,0xbcc9e9c2 + .long 0xbcada4a8,0xbc911c05 + .long 0xda44ebcf,0xbcbcc583 + .long 0x818b4d9c,0xbcad16f5 + .long 0x00000000,0x00000000 + .long 0x95949ef4,0x3cadcdef + .long 0xa475b465,0x3c8d73e2 + .long 0x4bb284ff,0x3c6186be + .long 0xc95b8c21,0x3ccb14c5 + .long 0x1727c57b,0x3cc0103a + .long 0xe35db263,0x3ca49d77 + .long 0x0650ec96,0x3cdecd04 + .long 0xe4628759,0x3cc6e6fb + .long 0x63da4b47,0x3cd4f2da + .long 0xc0144c88,0x3cc3c02d + .long 0xac0a5425,0x3cd8ee3b + .long 0xf5b6382c,0x3ce0cd83 + .long 0xce6503a7,0x3cea4af4 + .long 0x15f5a24b,0x3cb2c25d + .long 0x3aa6da0f,0x3ce68012 + .long 0x56918c17,0x3cd4b7a3 + .long 0x0c21b2cd,0x3cee9939 + .long 0xaa05e8a9,0x3ce54e28 + .long 0x24a67828,0x3cdba86f + .long 0x911f09ec,0x3cc1ada0 + .long 0x4b71e7b7,0x3ce3f086 + .long 0xde813be0,0x3cea0626 + .long 0xa3b69063,0x3cf013c1 + .long 0x5ebfb10c,0x3cdc750e + .long 0x62da6a82,0x3cdab4cf + .long 0x3c49d86a,0x3cbdf0a8 + .long 0xb004764f,0x3cfa66ec + .long 0x602a323d,0x3ce2b192 + .long 0xc9840733,0x3ce0dd37 + .long 0xe81bf4b7,0x3cd2c7c3 + .long 0x678a6e3d,0x3cd2449f + .long 0x5f626cdd,0x3ce92116 + .type __libm_exp_lo_table_64,@object + .size __libm_exp_lo_table_64,520 + .space 8, 0x00 # pad + .align 16 + .hidden __libm_exp_table_128 + .globl __libm_exp_table_128 +__libm_exp_table_128: + .long 0x908b2fb1,0x3def3bcc + .long 0x66600000,0x3fe6a09e + .long 0xdaed5330,0x3dd7b57d + .long 0x75000000,0x3fe6c012 + .long 0xc8838b30,0x3dc468bb + .long 0x3c600000,0x3fe6dfb2 + .long 0xcf87e1b5,0x3de19483 + .long 0xf9400000,0x3fe6ff7d + .long 0xba46e1e6,0x3dd8bee7 + .long 0xe8e00000,0x3fe71f75 + .long 0xf572693a,0x3dc605ce + .long 0x48a00000,0x3fe73f9a + .long 0xfb74d51a,0x3db33e45 + .long 0x56400000,0x3fe75feb + .long 0x619ae028,0x3dee5d3f + .long 0x4fc00000,0x3fe78069 + .long 0xafaa2048,0x3dd6030d + .long 0x73e00000,0x3fe7a114 + .long 0x7c493344,0x3de0c132 + .long 0x01200000,0x3fe7c1ed + .long 0x20ba0574,0x3dde9cc4 + .long 0x36c00000,0x3fe7e2f3 + .long 0xb60de676,0x3dee1a11 + .long 0x54200000,0x3fe80427 + .long 0x159f115f,0x3dd99c25 + .long 0x99400000,0x3fe82589 + .long 0x7297b5cc,0x3dbe3d66 + .long 0x46200000,0x3fe8471a + .long 0x03907643,0x3dc24bb2 + .long 0x9b400000,0x3fe868d9 + .long 0xcca6179c,0x3dd4cd32 + .long 0xd9800000,0x3fe88ac7 + .long 0xb74f8ab4,0x3dd541b6 + .long 0x42200000,0x3fe8ace5 + .long 0xef2aa1cd,0x3de5448b + .long 0x16a00000,0x3fe8cf32 + .long 0x2b982746,0x3de57736 + .long 0x99000000,0x3fe8f1ae + .long 0x88a61b47,0x3de1ffc5 + .long 0x0b800000,0x3fe9145b + .long 0xe8a0387e,0x3ddb8bc9 + .long 0xb0c00000,0x3fe93737 + .long 0xd36906d3,0x3dd0a41d + .long 0xcbc00000,0x3fe95a44 + .long 0x8b9e9210,0x3dee4e4f + .long 0x9fc00000,0x3fe97d82 + .long 0x74621372,0x3dd40f73 + .long 0x70c00000,0x3fe9a0f1 + .long 0xe3e23584,0x3dbf8480 + .long 0x82a00000,0x3fe9c491 + .long 0xc12653c7,0x3db91918 + .long 0x19e00000,0x3fe9e863 + .long 0xb29ada8c,0x3dede564 + .long 0x7b400000,0x3fea0c66 + .long 0xb182e3ef,0x3dd45a66 + .long 0xec400000,0x3fea309b + .long 0x8b424492,0x3dee255c + .long 0xb2200000,0x3fea5503 + .long 0x6f2dfb2b,0x3de0b358 + .long 0x13200000,0x3fea799e + .long 0x43eb243c,0x3de9fdbf + .long 0x55600000,0x3fea9e6b + .long 0xc0db966a,0x3de3f379 + .long 0xbfc00000,0x3feac36b + .long 0x5e8734d1,0x3dead3ad + .long 0x99400000,0x3feae89f + .long 0x2108559c,0x3ddb6ccb + .long 0x29800000,0x3feb0e07 + .long 0xed7fa1cf,0x3dde2bf5 + .long 0xb8400000,0x3feb33a2 + .long 0x38e20444,0x3dc564e6 + .long 0x8de00000,0x3feb5972 + .long 0xeaa7b082,0x3deb5e46 + .long 0xf2e00000,0x3feb7f76 + .long 0x40cb3c6b,0x3da06498 + .long 0x30a00000,0x3feba5b0 + .long 0x48f741e9,0x3dd783a4 + .long 0x90400000,0x3febcc1e + .long 0x8408d702,0x3de71e08 + .long 0x5bc00000,0x3febf2c2 + .long 0x88832c4b,0x3dc54a70 + .long 0xdd800000,0x3fec199b + .long 0x6d14df82,0x3defd07a + .long 0x5fe00000,0x3fec40ab + .long 0x4a2137fd,0x3de7d14b + .long 0x2e400000,0x3fec67f1 + .long 0x46b2f122,0x3dcb9ed4 + .long 0x94000000,0x3fec8f6d + .long 0x2a0797a4,0x3ddf20d2 + .long 0xdce00000,0x3fecb720 + .long 0xc44f8959,0x3dedc3f9 + .long 0x55400000,0x3fecdf0b + .long 0x343c8bc8,0x3dce25ee + .long 0x4a000000,0x3fed072d + .long 0x15bc2473,0x3ddb13e3 + .long 0x08000000,0x3fed2f87 + .long 0x25da05af,0x3deba487 + .long 0xdce00000,0x3fed5818 + .long 0x7709f3a1,0x3dd3072f + .long 0x16c00000,0x3fed80e3 + .long 0x708c01a6,0x3deb3285 + .long 0x03c00000,0x3feda9e6 + .long 0xb695de3c,0x3dab4604 + .long 0xf3000000,0x3fedd321 + .long 0xb968cac4,0x3deb9b5e + .long 0x33600000,0x3fedfc97 + .long 0xa12761fa,0x3de5a128 + .long 0x14e00000,0x3fee2646 + .long 0x4e7a2603,0x3dd67fec + .long 0xe7800000,0x3fee502e + .long 0x2d522ca1,0x3dcd320d + .long 0xfbc00000,0x3fee7a51 + .long 0x163dce86,0x3dc24366 + .long 0xa2a00000,0x3feea4af + .long 0x1b60625f,0x3ddccfe1 + .long 0x2d800000,0x3feecf48 + .long 0x71fd21a9,0x3da5a277 + .long 0xee600000,0x3feefa1b + .long 0x9d0d2df8,0x3dd7752e + .long 0x37600000,0x3fef252b + .long 0xce9f096f,0x3ddc8a80 + .long 0x5b600000,0x3fef5076 + .long 0x8913b4c0,0x3decbe13 + .long 0xad800000,0x3fef7bfd + .long 0x2e90a7e7,0x3dee90d8 + .long 0x81800000,0x3fefa7c1 + .long 0x12eb7496,0x3ddee3e2 + .long 0x2b800000,0x3fefd3c2 + .long 0x00000000,0x00000000 + .long 0x00000000,0x3ff00000 + .long 0x6d84a66b,0x3dfb3335 + .long 0xa9e00000,0x3ff0163d + .long 0xee6f7cad,0x3df78060 + .long 0x3e600000,0x3ff02c9a + .long 0x7ae71f34,0x3decff09 + .long 0xe8600000,0x3ff04315 + .long 0x3ae7c549,0x3df58574 + .long 0xd3000000,0x3ff059b0 + .long 0xc6dc403b,0x3dfdf6dd + .long 0x29c00000,0x3ff0706b + .long 0x08c35f26,0x3df59bc8 + .long 0x18600000,0x3ff08745 + .long 0x14878183,0x3ddbce0d + .long 0xcac00000,0x3ff09e3e + .long 0x6298b92b,0x3df9890f + .long 0x6ce00000,0x3ff0b558 + .long 0x407b705c,0x3df247f7 + .long 0x2b600000,0x3ff0cc92 + .long 0x020742e5,0x3df3d1a2 + .long 0x32c00000,0x3ff0e3ec + .long 0xf232091e,0x3dfed31a + .long 0xafe00000,0x3ff0fb66 + .long 0xa4ebbf1b,0x3df25b50 + .long 0xd0000000,0x3ff11301 + .long 0xf72575a6,0x3de86397 + .long 0xc0600000,0x3ff12abd + .long 0x66820328,0x3de25bbf + .long 0xaea00000,0x3ff1429a + .long 0x920355cf,0x3dd63944 + .long 0xc8a00000,0x3ff15a98 + .long 0xdcdf7c8c,0x3dfd517a + .long 0x3c600000,0x3ff172b8 + .long 0x777ee173,0x3de91bd3 + .long 0x38800000,0x3ff18af9 + .long 0x796d31ed,0x3def96ea + .long 0xeb600000,0x3ff1a35b + .long 0x6ac79cad,0x3dd1734e + .long 0x84000000,0x3ff1bbe0 + .long 0xf00b7005,0x3de17354 + .long 0x31600000,0x3ff1d487 + .long 0xb8819ff6,0x3dfcd91c + .long 0x22e00000,0x3ff1ed50 + .long 0xdc775815,0x3dc466b1 + .long 0x88600000,0x3ff2063b + .long 0x2552fd29,0x3dfddc96 + .long 0x91600000,0x3ff21f49 + .long 0x66c1fadb,0x3df56238 + .long 0x6e600000,0x3ff2387a + .long 0x3582ab7e,0x3df2a63f + .long 0x4fa00000,0x3ff251ce + .long 0x2bd33994,0x3dc3e6e9 + .long 0x65e00000,0x3ff26b45 + .long 0x96cf15cf,0x3df56380 + .long 0xe1e00000,0x3ff284df + .long 0x2c25d15f,0x3dffdee1 + .long 0xf5000000,0x3ff29e9d + .long 0xfddea465,0x3dfad98f + .long 0xd0c00000,0x3ff2b87f + .long 0x0024754e,0x3dd00c2d + .long 0xa6e00000,0x3ff2d285 + .long 0x11ca0f46,0x3dfe2f56 + .long 0xa9200000,0x3ff2ecaf + .long 0x2de8d5a4,0x3df1b715 + .long 0x0a200000,0x3ff306fe + .long 0x6a739e38,0x3de9b062 + .long 0xfc400000,0x3ff32170 + .long 0x32721843,0x3dd05bfd + .long 0xb2600000,0x3ff33c08 + .long 0xc9462347,0x3df29ff0 + .long 0x5f800000,0x3ff356c5 + .long 0xa7145503,0x3dfaa9ca + .long 0x37200000,0x3ff371a7 + .long 0x16a72c36,0x3dd76196 + .long 0x6d000000,0x3ff38cae + .long 0xa86f24a6,0x3dd67fdb + .long 0x34e00000,0x3ff3a7db + .long 0x84001f23,0x3df3a8e4 + .long 0xc3000000,0x3ff3c32d + .long 0x35b41224,0x3df23422 + .long 0x4c000000,0x3ff3dea6 + .long 0x417ee035,0x3de90037 + .long 0x04a00000,0x3ff3fa45 + .long 0xf84325b9,0x3df72e29 + .long 0x21e00000,0x3ff4160a + .long 0xdc704439,0x3df0a896 + .long 0xd9400000,0x3ff431f5 + .long 0x3136f40a,0x3db892d0 + .long 0x60600000,0x3ff44e08 + .long 0x72512f46,0x3dfd0057 + .long 0xed000000,0x3ff46a41 + .long 0x3c1a3b69,0x3db3cd01 + .long 0xb5c00000,0x3ff486a2 + .long 0x672d8bcf,0x3df7d3de + .long 0xf0c00000,0x3ff4a32a + .long 0x1d4397b0,0x3df62a27 + .long 0xd5200000,0x3ff4bfda + .long 0x63b36ef2,0x3dfddd0d + .long 0x99e00000,0x3ff4dcb2 + .long 0xad33d8b7,0x3dfd2ca6 + .long 0x76800000,0x3ff4f9b2 + .long 0x8225ea59,0x3deecc83 + .long 0xa2c00000,0x3ff516da + .long 0xdf0a83c5,0x3dfd4f81 + .long 0x56800000,0x3ff5342b + .long 0xc52ec620,0x3dfd920e + .long 0xca400000,0x3ff551a4 + .long 0x66ecb004,0x3df527da + .long 0x36a00000,0x3ff56f47 + .long 0x252bc2b7,0x3df7c7fd + .long 0xd4800000,0x3ff58d12 + .long 0xb192602a,0x3de0a852 + .long 0xdd400000,0x3ff5ab07 + .long 0x01c4b1b8,0x3df946b7 + .long 0x8a400000,0x3ff5c926 + .long 0xdd37c984,0x3dea4290 + .long 0x15a00000,0x3ff5e76f + .long 0xb076f593,0x3df6dc08 + .long 0xb9600000,0x3ff605e1 + .long 0xb1f0fa07,0x3dfa5584 + .long 0xb0200000,0x3ff6247e + .long 0x8edf0e2a,0x3de9863f + .long 0x34c00000,0x3ff64346 + .long 0x9127d9e3,0x3df52224 + .long 0x82400000,0x3ff66238 + .long 0x1038ae45,0x3de952e6 + .long 0xd4400000,0x3ff68155 + .long 0x908b2fb1,0x3dff3bcc + .long 0x66600000,0x3ff6a09e + .type __libm_exp_table_128,@object + .size __libm_exp_table_128,2064 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/exp_wmt.S b/external/sgx_libm/ia32/exp_wmt.S new file mode 100644 index 0000000000..6b9e3cda83 --- /dev/null +++ b/external/sgx_libm/ia32/exp_wmt.S @@ -0,0 +1,587 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin exp + .text + .align 16,0x90 + .globl exp +exp: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + unpcklpd %xmm0, %xmm0 + movapd 64(%ebx), %xmm1 + movapd 48(%ebx), %xmm6 + movapd 80(%ebx), %xmm2 + movapd 96(%ebx), %xmm3 + pextrw $3, %xmm0, %eax + andl $32767, %eax + movl $16527, %edx + subl %eax, %edx + subl $15504, %eax + orl %eax, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_0.0.3 + mulpd %xmm0, %xmm1 + addpd %xmm6, %xmm1 + movapd %xmm1, %xmm7 + subpd %xmm6, %xmm1 + mulpd %xmm1, %xmm2 + movapd 128(%ebx), %xmm4 + mulpd %xmm1, %xmm3 + movapd 144(%ebx), %xmm5 + subpd %xmm2, %xmm0 + movd %xmm7, %eax + movl %eax, %ecx + andl $63, %ecx + shll $4, %ecx + sarl $6, %eax + movl %eax, %edx + movdqa 16(%ebx), %xmm6 + pand %xmm6, %xmm7 + movdqa 32(%ebx), %xmm6 + paddq %xmm6, %xmm7 + psllq $46, %xmm7 + subpd %xmm3, %xmm0 + movapd 160(%ebx,%ecx), %xmm2 + mulpd %xmm0, %xmm4 + movapd %xmm0, %xmm6 + movapd %xmm0, %xmm1 + mulpd %xmm6, %xmm6 + mulpd %xmm6, %xmm0 + addpd %xmm4, %xmm5 + mulsd %xmm6, %xmm0 + mulpd 112(%ebx), %xmm6 + addsd %xmm2, %xmm1 + unpckhpd %xmm2, %xmm2 + mulpd %xmm5, %xmm0 + addsd %xmm0, %xmm1 + orpd %xmm7, %xmm2 + unpckhpd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + addsd %xmm6, %xmm0 + addl $894, %edx + cmpl $1916, %edx + ja .L_2TAG_PACKET_1.0.3 + mulsd %xmm2, %xmm0 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + fstcw 24(%esp) + movzwl 24(%esp), %edx + orl $768, %edx + movw %dx, 28(%esp) + fldcw 28(%esp) + movl %eax, %edx + sarl $1, %eax + subl %eax, %edx + movdqa (%ebx), %xmm6 + pandn %xmm2, %xmm6 + addl $1023, %eax + movd %eax, %xmm3 + psllq $52, %xmm3 + orpd %xmm3, %xmm6 + addl $1023, %edx + movd %edx, %xmm4 + psllq $52, %xmm4 + movsd %xmm0, 8(%esp) + fldl 8(%esp) + movsd %xmm6, 16(%esp) + fldl 16(%esp) + fmul %st, %st(1) + faddp %st, %st(1) + movsd %xmm4, 8(%esp) + fldl 8(%esp) + fmulp %st, %st(1) + fstpl 8(%esp) + movsd 8(%esp), %xmm0 + fldcw 24(%esp) + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $32752, %ecx + jae .L_2TAG_PACKET_3.0.3 + cmpl $0, %ecx + je .L_2TAG_PACKET_4.0.3 + jmp .L_2TAG_PACKET_2.0.3 + cmpl $-2147483648, %ecx + jb .L_2TAG_PACKET_3.0.3 + cmpl $-1064950997, %ecx + jb .L_2TAG_PACKET_2.0.3 + ja .L_2TAG_PACKET_4.0.3 + movl 128(%esp), %edx + cmpl $-17155601, %edx + jb .L_2TAG_PACKET_2.0.3 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_3.0.3: + movl $14, %edx + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_4.0.3: + movl $15, %edx +.L_2TAG_PACKET_5.0.3: + movsd %xmm0, (%esp) + movsd 128(%esp), %xmm0 + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_7.0.3: + cmpl $2146435072, %eax + jae .L_2TAG_PACKET_8.0.3 + movl 132(%esp), %eax + cmpl $-2147483648, %eax + jae .L_2TAG_PACKET_9.0.3 + movsd 1208(%ebx), %xmm0 + mulsd %xmm0, %xmm0 + movl $14, %edx + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_9.0.3: + movsd 1216(%ebx), %xmm0 + mulsd %xmm0, %xmm0 + movl $15, %edx + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_8.0.3: + movl 128(%esp), %edx + cmpl $2146435072, %eax + ja .L_2TAG_PACKET_10.0.3 + cmpl $0, %edx + jne .L_2TAG_PACKET_10.0.3 + movl 132(%esp), %eax + cmpl $2146435072, %eax + jne .L_2TAG_PACKET_11.0.3 + movsd 1192(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_11.0.3: + movsd 1200(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_10.0.3: + movsd 128(%esp), %xmm0 + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movl 132(%esp), %eax + andl $2147483647, %eax + cmpl $1083179008, %eax + jae .L_2TAG_PACKET_7.0.3 + movsd 128(%esp), %xmm0 + addsd 1184(%ebx), %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 48(%esp) + fldl 48(%esp) +.L_2TAG_PACKET_6.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type exp,@function + .size exp,.-exp + .data +# -- End exp + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 4293918720 + .long 0 + .long 4293918720 + .long 4294967232 + .long 0 + .long 4294967232 + .long 0 + .long 65472 + .long 0 + .long 65472 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 1697350398 + .long 1079448903 + .long 1697350398 + .long 1079448903 + .long 4277796864 + .long 1065758274 + .long 4277796864 + .long 1065758274 + .long 3164486458 + .long 1025308570 + .long 3164486458 + .long 1025308570 + .long 4294967294 + .long 1071644671 + .long 4294967294 + .long 1071644671 + .long 3811088480 + .long 1062650204 + .long 1432067621 + .long 1067799893 + .long 3230715663 + .long 1065423125 + .long 1431604129 + .long 1069897045 + .long 0 + .long 0 + .long 0 + .long 0 + .long 235107661 + .long 1018002367 + .long 1048019040 + .long 11418 + .long 896005651 + .long 1015861842 + .long 3541402996 + .long 22960 + .long 1642514529 + .long 1012987726 + .long 410360776 + .long 34629 + .long 1568897900 + .long 1016568486 + .long 1828292879 + .long 46424 + .long 1882168529 + .long 1010744893 + .long 852742562 + .long 58348 + .long 509852888 + .long 1017336174 + .long 3490863952 + .long 70401 + .long 653277307 + .long 1017431380 + .long 2930322911 + .long 82586 + .long 1649557430 + .long 1017729363 + .long 1014845818 + .long 94904 + .long 1058231231 + .long 1015777676 + .long 3949972341 + .long 107355 + .long 1044000607 + .long 1016786167 + .long 828946858 + .long 119943 + .long 1151779725 + .long 1015705409 + .long 2288159958 + .long 132667 + .long 3819481236 + .long 1016499965 + .long 1853186616 + .long 145530 + .long 2552227826 + .long 1015039787 + .long 1709341917 + .long 158533 + .long 1829350193 + .long 1015216097 + .long 4112506593 + .long 171677 + .long 1913391795 + .long 1015756674 + .long 2799960843 + .long 184965 + .long 1303423926 + .long 1015238005 + .long 171030293 + .long 198398 + .long 1574172746 + .long 1016061241 + .long 2992903935 + .long 211976 + .long 3424156969 + .long 1017196428 + .long 926591434 + .long 225703 + .long 1938513547 + .long 1017631273 + .long 887463926 + .long 239579 + .long 2804567149 + .long 1015390024 + .long 1276261410 + .long 253606 + .long 631083525 + .long 1017690182 + .long 569847337 + .long 267786 + .long 1623370770 + .long 1011049453 + .long 1617004845 + .long 282120 + .long 3667985273 + .long 1013894369 + .long 3049340112 + .long 296610 + .long 3145379760 + .long 1014403278 + .long 3577096743 + .long 311258 + .long 2603100681 + .long 1017152460 + .long 1990012070 + .long 326066 + .long 3249202951 + .long 1017448880 + .long 1453150081 + .long 341035 + .long 419288974 + .long 1016280325 + .long 917841882 + .long 356167 + .long 3793507337 + .long 1016095713 + .long 3712504873 + .long 371463 + .long 728023093 + .long 1016345318 + .long 363667784 + .long 386927 + .long 2582678538 + .long 1017123460 + .long 2956612996 + .long 402558 + .long 7592966 + .long 1016721543 + .long 2186617380 + .long 418360 + .long 228611441 + .long 1016696141 + .long 1719614412 + .long 434334 + .long 2261665670 + .long 1017457593 + .long 1013258798 + .long 450482 + .long 544148907 + .long 1017323666 + .long 3907805043 + .long 466805 + .long 2383914918 + .long 1017143586 + .long 1447192520 + .long 483307 + .long 1176412038 + .long 1017267372 + .long 1944781190 + .long 499988 + .long 2882956373 + .long 1013312481 + .long 919555682 + .long 516851 + .long 3154077648 + .long 1016528543 + .long 2571947538 + .long 533897 + .long 348651999 + .long 1016405780 + .long 2604962540 + .long 551129 + .long 3253791412 + .long 1015920431 + .long 1110089947 + .long 568549 + .long 1509121860 + .long 1014756995 + .long 2568320822 + .long 586158 + .long 2617649212 + .long 1017340090 + .long 2966275556 + .long 603959 + .long 553214634 + .long 1016457425 + .long 2682146383 + .long 621954 + .long 730975783 + .long 1014083580 + .long 2191782032 + .long 640145 + .long 1486499517 + .long 1016818996 + .long 2069751140 + .long 658534 + .long 2595788928 + .long 1016407932 + .long 2990417244 + .long 677123 + .long 1853053619 + .long 1015310724 + .long 1434058175 + .long 695915 + .long 2462790535 + .long 1015814775 + .long 2572866477 + .long 714911 + .long 3693944214 + .long 1017259110 + .long 3092190714 + .long 734114 + .long 2979333550 + .long 1017188654 + .long 4076559942 + .long 753526 + .long 174054861 + .long 1014300631 + .long 2420883922 + .long 773150 + .long 816778419 + .long 1014197934 + .long 3716502172 + .long 792987 + .long 3507050924 + .long 1015341199 + .long 777507147 + .long 813041 + .long 1821514088 + .long 1013410604 + .long 3706687593 + .long 833312 + .long 920623539 + .long 1016295433 + .long 1242007931 + .long 853805 + .long 2789017511 + .long 1014276997 + .long 3707479175 + .long 874520 + .long 3586233004 + .long 1015962192 + .long 64696965 + .long 895462 + .long 474650514 + .long 1016642419 + .long 863738718 + .long 916631 + .long 1614448851 + .long 1014281732 + .long 3884662774 + .long 938030 + .long 2450082086 + .long 1016164135 + .long 2728693977 + .long 959663 + .long 1101668360 + .long 1015989180 + .long 3999357479 + .long 981531 + .long 835814894 + .long 1015702697 + .long 1533953344 + .long 1003638 + .long 1301400989 + .long 1014466875 + .long 2174652632 + .long 1025985 + .long 0 + .long 1072693248 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 4294967295 + .long 2146435071 + .long 0 + .long 1048576 + .type static_const_table,@object + .size static_const_table,1224 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/expf_wmt.S b/external/sgx_libm/ia32/expf_wmt.S new file mode 100644 index 0000000000..73a3aa54a6 --- /dev/null +++ b/external/sgx_libm/ia32/expf_wmt.S @@ -0,0 +1,759 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin expf + .text + .align 16,0x90 + .globl expf +expf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %ecx + movsd 2064(%ebx), %xmm3 + xorpd %xmm7, %xmm7 + movl $17208, %eax + pinsrw $3, %eax, %xmm7 + cvtps2pd %xmm0, %xmm1 + andl $2147483647, %ecx + subl $830472192, %ecx + cmpl $288180587, %ecx + jae .L_2TAG_PACKET_0.0.3 + movsd 2048(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + movapd %xmm7, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm7 + movsd 2056(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + addl $830472192, %ecx + cmpl $830472192, %ecx + jb .L_2TAG_PACKET_2.0.3 + cmpl $1124073472, %ecx + jae .L_2TAG_PACKET_3.0.3 + movsd 2048(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + movapd %xmm7, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm7 + movsd 2056(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + cmpl $8388608, %eax + jb .L_2TAG_PACKET_4.0.3 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movd %xmm0, %edx + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_6.0.3 + testl $-2147483648, %edx + je .L_2TAG_PACKET_5.0.3 + movl $8388608, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_4.0.3: + movl $17, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_5.0.3: + movl $2130706432, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 + movl $16, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_2.0.3: + movl $1065353216, %eax + movd %eax, %xmm1 + addss %xmm1, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + cmpl $-8388608, %edx + je .L_2TAG_PACKET_9.0.3 + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_9.0.3: + fldz + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_1.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type expf,@function + .size expf,.-expf + .data +# -- End expf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 4200250559 + .long 1072696090 + .long 2851812149 + .long 1072698941 + .long 339411585 + .long 1072701800 + .long 1048019041 + .long 1072704666 + .long 772914124 + .long 1072707540 + .long 3899555717 + .long 1072710421 + .long 1928746161 + .long 1072713311 + .long 3541402996 + .long 1072716208 + .long 238821257 + .long 1072719114 + .long 702412510 + .long 1072722027 + .long 728934454 + .long 1072724948 + .long 410360776 + .long 1072727877 + .long 4133881824 + .long 1072730813 + .long 3402036099 + .long 1072733758 + .long 2602514713 + .long 1072736711 + .long 1828292879 + .long 1072739672 + .long 1172597893 + .long 1072742641 + .long 728909815 + .long 1072745618 + .long 590962156 + .long 1072748603 + .long 852742562 + .long 1072751596 + .long 1608493509 + .long 1072754597 + .long 2952712987 + .long 1072757606 + .long 685187902 + .long 1072760624 + .long 3490863953 + .long 1072763649 + .long 2875075254 + .long 1072766683 + .long 3228316108 + .long 1072769725 + .long 351405227 + .long 1072772776 + .long 2930322912 + .long 1072775834 + .long 2471440686 + .long 1072778901 + .long 3366293073 + .long 1072781976 + .long 1416741826 + .long 1072785060 + .long 1014845819 + .long 1072788152 + .long 2257959872 + .long 1072791252 + .long 948735466 + .long 1072794361 + .long 1480023343 + .long 1072797478 + .long 3949972341 + .long 1072800603 + .long 4162030108 + .long 1072803737 + .long 2214878420 + .long 1072806880 + .long 2502433899 + .long 1072810031 + .long 828946858 + .long 1072813191 + .long 1588871207 + .long 1072816359 + .long 586995997 + .long 1072819536 + .long 2218315341 + .long 1072822721 + .long 2288159958 + .long 1072825915 + .long 897099801 + .long 1072829118 + .long 2440944790 + .long 1072832329 + .long 2725843665 + .long 1072835549 + .long 1853186616 + .long 1072838778 + .long 4219606026 + .long 1072842015 + .long 1337108031 + .long 1072845262 + .long 1897844341 + .long 1072848517 + .long 1709341917 + .long 1072851781 + .long 874372905 + .long 1072855054 + .long 3790955393 + .long 1072858335 + .long 1972484976 + .long 1072861626 + .long 4112506593 + .long 1072864925 + .long 1724976915 + .long 1072868234 + .long 3504003472 + .long 1072871551 + .long 964107055 + .long 1072874878 + .long 2799960843 + .long 1072878213 + .long 526652809 + .long 1072881558 + .long 2839424854 + .long 1072884911 + .long 1253935211 + .long 1072888274 + .long 171030293 + .long 1072891646 + .long 3991843581 + .long 1072895026 + .long 4232894513 + .long 1072898416 + .long 1000925746 + .long 1072901816 + .long 2992903935 + .long 1072905224 + .long 1726216749 + .long 1072908642 + .long 1603444721 + .long 1072912069 + .long 2732492859 + .long 1072915505 + .long 926591435 + .long 1072918951 + .long 589198666 + .long 1072922406 + .long 1829099622 + .long 1072925870 + .long 460407023 + .long 1072929344 + .long 887463927 + .long 1072932827 + .long 3219942644 + .long 1072936319 + .long 3272845541 + .long 1072939821 + .long 1156440435 + .long 1072943333 + .long 1276261410 + .long 1072946854 + .long 3743175029 + .long 1072950384 + .long 78413852 + .long 1072953925 + .long 3278348324 + .long 1072957474 + .long 569847338 + .long 1072961034 + .long 654919306 + .long 1072964603 + .long 3645941911 + .long 1072968181 + .long 1065662932 + .long 1072971770 + .long 1617004845 + .long 1072975368 + .long 1118294578 + .long 1072978976 + .long 3978100823 + .long 1072982593 + .long 1720398391 + .long 1072986221 + .long 3049340112 + .long 1072989858 + .long 3784486610 + .long 1072993505 + .long 4040676318 + .long 1072997162 + .long 3933059031 + .long 1073000829 + .long 3577096743 + .long 1073004506 + .long 3088564500 + .long 1073008193 + .long 2583551245 + .long 1073011890 + .long 2178460671 + .long 1073015597 + .long 1990012071 + .long 1073019314 + .long 2135241198 + .long 1073023041 + .long 2731501122 + .long 1073026778 + .long 3896463087 + .long 1073030525 + .long 1453150082 + .long 1073034283 + .long 4109806887 + .long 1073038050 + .long 3395129871 + .long 1073041828 + .long 3723038930 + .long 1073045616 + .long 917841882 + .long 1073049415 + .long 3689071823 + .long 1073053223 + .long 3566716925 + .long 1073057042 + .long 671025100 + .long 1073060872 + .long 3712504873 + .long 1073064711 + .long 4222122499 + .long 1073068561 + .long 2321106615 + .long 1073072422 + .long 2425981843 + .long 1073076293 + .long 363667784 + .long 1073080175 + .long 551349105 + .long 1073084067 + .long 3111574537 + .long 1073087969 + .long 3872257780 + .long 1073091882 + .long 2956612997 + .long 1073095806 + .long 488188413 + .long 1073099741 + .long 885834528 + .long 1073103686 + .long 4273770423 + .long 1073107641 + .long 2186617381 + .long 1073111608 + .long 3339203574 + .long 1073115585 + .long 3561793907 + .long 1073119573 + .long 2979960120 + .long 1073123572 + .long 1719614413 + .long 1073127582 + .long 4201977662 + .long 1073131602 + .long 1963711167 + .long 1073135634 + .long 3721688645 + .long 1073139676 + .long 1013258799 + .long 1073143730 + .long 2555984613 + .long 1073147794 + .long 4182873220 + .long 1073151869 + .long 1727278727 + .long 1073155956 + .long 3907805044 + .long 1073160053 + .long 2263535754 + .long 1073164162 + .long 1218806132 + .long 1073168282 + .long 903334909 + .long 1073172413 + .long 1447192521 + .long 1073176555 + .long 2980802057 + .long 1073180708 + .long 1339972927 + .long 1073184873 + .long 950803702 + .long 1073189049 + .long 1944781191 + .long 1073193236 + .long 158781403 + .long 1073197435 + .long 19972402 + .long 1073201645 + .long 1660913392 + .long 1073205866 + .long 919555682 + .long 1073210099 + .long 2224145553 + .long 1073214343 + .long 1413356050 + .long 1073218599 + .long 2916157145 + .long 1073222866 + .long 2571947539 + .long 1073227145 + .long 515457527 + .long 1073231436 + .long 1176749997 + .long 1073235738 + .long 396319521 + .long 1073240052 + .long 2604962541 + .long 1073244377 + .long 3643909174 + .long 1073248714 + .long 3649726105 + .long 1073253063 + .long 2759350287 + .long 1073257424 + .long 1110089947 + .long 1073261797 + .long 3134592888 + .long 1073266181 + .long 380978316 + .long 1073270578 + .long 1577608921 + .long 1073274986 + .long 2568320822 + .long 1073279406 + .long 3492293770 + .long 1073283838 + .long 194117574 + .long 1073288283 + .long 1403662306 + .long 1073292739 + .long 2966275557 + .long 1073297207 + .long 727685349 + .long 1073301688 + .long 3418903055 + .long 1073306180 + .long 2591453363 + .long 1073310685 + .long 2682146384 + .long 1073315202 + .long 3833209506 + .long 1073319731 + .long 1892288442 + .long 1073324273 + .long 1297350157 + .long 1073328827 + .long 2191782032 + .long 1073333393 + .long 424392917 + .long 1073337972 + .long 434316067 + .long 1073342563 + .long 2366108318 + .long 1073347166 + .long 2069751141 + .long 1073351782 + .long 3985553595 + .long 1073356410 + .long 3964284211 + .long 1073361051 + .long 2152073944 + .long 1073365705 + .long 2990417245 + .long 1073370371 + .long 2331271250 + .long 1073375050 + .long 321958744 + .long 1073379742 + .long 1405169241 + .long 1073384446 + .long 1434058175 + .long 1073389163 + .long 557149882 + .long 1073393893 + .long 3218338682 + .long 1073398635 + .long 977020788 + .long 1073403391 + .long 2572866477 + .long 1073408159 + .long 3861050111 + .long 1073412940 + .long 697153126 + .long 1073417735 + .long 1822067026 + .long 1073422542 + .long 3092190715 + .long 1073427362 + .long 364333489 + .long 1073432196 + .long 2380618042 + .long 1073437042 + .long 703710506 + .long 1073441902 + .long 4076559943 + .long 1073446774 + .long 4062661092 + .long 1073451660 + .long 815859274 + .long 1073456560 + .long 3080351519 + .long 1073461472 + .long 2420883922 + .long 1073466398 + .long 3287523847 + .long 1073471337 + .long 1540824585 + .long 1073476290 + .long 1631695677 + .long 1073481256 + .long 3716502172 + .long 1073486235 + .long 3657065772 + .long 1073491228 + .long 1610600570 + .long 1073496235 + .long 2029714210 + .long 1073501255 + .long 777507147 + .long 1073506289 + .long 2307442995 + .long 1073511336 + .long 2483480501 + .long 1073516397 + .long 1464976603 + .long 1073521472 + .long 3706687593 + .long 1073526560 + .long 778901109 + .long 1073531663 + .long 1432208378 + .long 1073536779 + .long 1532734324 + .long 1073541909 + .long 1242007932 + .long 1073547053 + .long 721996136 + .long 1073552211 + .long 135105010 + .long 1073557383 + .long 3939148246 + .long 1073562568 + .long 3707479175 + .long 1073567768 + .long 3898795731 + .long 1073572982 + .long 382305176 + .long 1073578211 + .long 1912561781 + .long 1073583453 + .long 64696965 + .long 1073588710 + .long 3594158869 + .long 1073593980 + .long 4076975200 + .long 1073599265 + .long 1679558232 + .long 1073604565 + .long 863738719 + .long 1073609879 + .long 1796832535 + .long 1073615207 + .long 351641897 + .long 1073620550 + .long 991358482 + .long 1073625907 + .long 3884662774 + .long 1073631278 + .long 610758006 + .long 1073636665 + .long 4224142467 + .long 1073642065 + .long 2009970496 + .long 1073647481 + .long 2728693978 + .long 1073652911 + .long 2256325230 + .long 1073658356 + .long 764307441 + .long 1073663816 + .long 2719515920 + .long 1073669290 + .long 3999357479 + .long 1073674779 + .long 481706282 + .long 1073680284 + .long 929806999 + .long 1073685803 + .long 1222472308 + .long 1073691337 + .long 1533953344 + .long 1073696886 + .long 2038973688 + .long 1073702450 + .long 2912730644 + .long 1073708029 + .long 35929225 + .long 1073713624 + .long 2174652632 + .long 1073719233 + .long 915592468 + .long 1073724858 + .long 730821105 + .long 1073730498 + .long 1797923801 + .long 1073736153 + .long 4286760334 + .long 1053736893 + .long 4277826245 + .long 1063661122 + .long 1697350398 + .long 1081546055 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,2088 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/expl.S b/external/sgx_libm/ia32/expl.S new file mode 100644 index 0000000000..48b0f7f0dd --- /dev/null +++ b/external/sgx_libm/ia32/expl.S @@ -0,0 +1,969 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expl.c" + .text +..TXTST0: +# -- Begin expl + .text + .align 16,0x90 + .globl expl +expl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp +..B1.2: + fnstcw 70(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $16389, %eax + jge ..B1.50 +..B1.4: + movzwl 70(%esp), %ecx + cmpl $16378, %eax + jge ..B1.43 +..B1.5: + cmpl $16372, %eax + jge ..B1.36 +..B1.6: + cmpl $16365, %eax + jge ..B1.29 +..B1.7: + cmpl $16357, %eax + jge ..B1.22 +..B1.8: + cmpl $16316, %eax + jge ..B1.15 +..B1.9: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.78 +..B1.10: + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.11: + fldcw 68(%esp) +..B1.12: + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fldt 8(%ebp) + faddp %st, %st(1) + fstpt (%esp) +..B1.13: + fldcw 70(%esp) +..B1.14: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.79 +..B1.16: + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.17: + fldcw 68(%esp) +..B1.18: + movl $1, %eax +..B1.19: + fldt 8(%ebp) + testl %eax, %eax + fldt _Q3@GOTOFF(%edx) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.21 +..B1.20: + fldcw 70(%esp) +..B1.21: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.22: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.80 +..B1.23: + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.24: + fldcw 68(%esp) +..B1.25: + movl $1, %eax +..B1.26: + fldt 8(%ebp) + testl %eax, %eax + fldt 12+_Q2@GOTOFF(%edx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.28 +..B1.27: + fldcw 70(%esp) +..B1.28: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.81 +..B1.30: + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.31: + fldcw 68(%esp) +..B1.32: + movl $1, %eax +..B1.33: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(1) + fldt 36+_Q1@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_Q1@GOTOFF(%edx) + fmul %st(3), %st + fldt 12+_Q1@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt _Q1@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fadd %st, %st(2) + fsubr %st(2), %st + fsubrp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.35 +..B1.34: + fldcw 70(%esp) +..B1.35: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.36: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.82 +..B1.37: + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.38: + fldcw 68(%esp) +..B1.39: + movl $1, %eax +..B1.40: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 84+_Q0@GOTOFF(%edx) + fmul %st(1), %st + fldt 72+_Q0@GOTOFF(%edx) + fmul %st(2), %st + fldt 60+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmul %st(3), %st + fldt _Q0@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fadd %st, %st(1) + fsubr %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.42 +..B1.41: + fldcw 70(%esp) +..B1.42: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.83 +..B1.44: + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.45: + fldcw 68(%esp) +..B1.46: + movl $1, %ebx +..B1.47: + fldl _TWO_63H@GOTOFF(%edx) + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(1), %st + fadd %st(2), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmul %st(2), %st + movl 24(%esp), %eax + fsubrp %st, %st(1) + fld %st(0) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(3) + movsbl %al, %ecx + fsub %st(2), %st + fldl _TWO_32H@GOTOFF(%edx) + subl %ecx, %eax + shll $4, %ecx + fadd %st, %st(1) + shrl $8, %eax + fsubr %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + shll $23, %eax + fxch %st(4) + fsubrp %st, %st(3) + addl $1065353216, %eax + fadd %st(2), %st + fld %st(0) + testl %ebx, %ebx + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + movl %eax, 36(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + faddp %st, %st(2) + fldt _P@GOTOFF(%edx) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%ecx) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%ecx) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(4) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmuls 36(%esp) + fstpt (%esp) + je ..B1.95 +..B1.48: + fstpt 24(%esp) +..B1.93: + fldcw 70(%esp) + jmp ..B1.49 +..B1.95: + fstp %st(0) +..B1.49: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.50: + movzbl 17(%ebp), %ebx + andl $128, %ebx + shrl $7, %ebx + lea (,%ebx,8), %ecx + lea (%ecx,%ebx,4), %ecx + movzwl 8+_ranges@GOTOFF(%ecx,%edx), %esi + andl $32767, %esi + cmpl %esi, %eax + jl ..B1.55 +..B1.51: + jne ..B1.67 +..B1.52: + movl 12(%ebp), %esi + cmpl 4+_ranges@GOTOFF(%ecx,%edx), %esi + jb ..B1.55 +..B1.53: + jne ..B1.67 +..B1.54: + movl 8(%ebp), %esi + cmpl _ranges@GOTOFF(%ecx,%edx), %esi + jae ..B1.67 +..B1.55: + movzwl 70(%esp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.85 +..B1.56: + orl $-64768, %esi + movw %si, 68(%esp) +..B1.57: + fldcw 68(%esp) +..B1.58: + movl $1, %esi +..B1.59: + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fstpt (%esp) + fldl _TWO_63H@GOTOFF(%edx) + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(1), %st + movl %ecx, 36(%esp) + fadd %st(2), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmul %st(2), %st + movl 24(%esp), %eax + movl %eax, %ecx + movsbl %al, %edi + addl $4196735, %eax + subl %edi, %ecx + fsubr %st(1), %st + fld %st(0) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(4) + shll $4, %edi + fsub %st(3), %st + fldl _TWO_32H@GOTOFF(%edx) + shrl $8, %ecx + fadd %st, %st(1) + fxch %st(1) + fstpt 40(%esp) + fldt 40(%esp) + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + addl SC2_BIAS@GOTOFF(%edx,%ebx,4), %ecx + fxch %st(4) + fsubrp %st, %st(2) + movl %esi, 52(%esp) + andl $32767, %ecx + movzwl 8+.L_2il0floatpacket.3@GOTOFF(%edx), %esi + fadd %st(1), %st + fld %st(0) + andl $-32768, %esi + fmul %st(1), %st + orl %ecx, %esi + fldt 48+_P@GOTOFF(%edx) + cmpl $3070, %eax + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + movw %si, 8(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + movl 52(%esp), %esi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + movl 36(%esp), %ecx + faddp %st, %st(2) + fldt _P@GOTOFF(%edx) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%edi) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(4), %st + fxch %st(1) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + fxch %st(1) + fmull 2056+__libm_expl_table_256@GOTOFF(%edx,%edi) + faddp %st, %st(2) + faddl 2056+__libm_expl_table_256@GOTOFF(%edx,%edi) + faddp %st, %st(1) + ja ..B1.62 +..B1.60: + fldt _expbut@GOTOFF(%edx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B1.62 +..B1.61: + fstp %st(1) + fldl _TWO_12H@GOTOFF(%edx) + fld %st(2) + fadd %st(2), %st + fmul %st, %st(1) + fadd %st(1), %st + fstpt 40(%esp) + fldt 40(%esp) + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt _SC2@GOTOFF(%ecx,%edx) + fldt (%esp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 56(%esp) + jmp ..B1.63 +..B1.62: + fstp %st(1) + fldt (%esp) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt _SC2@GOTOFF(%ecx,%edx) + fmulp %st, %st(1) + fstpt 56(%esp) +..B1.63: + fldt _minnorm@GOTOFF(%edx) + fldt 56(%esp) + fcompp + fnstsw %ax + sahf + jp ..B1.64 + jb ..B1.84 +..B1.64: + testl %esi, %esi + je ..B1.66 +..B1.65: + fldt 40(%esp) + fstpt 24(%esp) +..B1.94: + fldcw 70(%esp) +..B1.66: + fldt 56(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.67: + movzwl 70(%esp), %esi + movl %esi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.90 +..B1.68: + orl $-64768, %esi + movw %si, 68(%esp) +..B1.69: + fldcw 68(%esp) +..B1.70: + movzwl 16(%ebp), %eax + movl $1, %ecx + andl $32767, %eax +..B1.71: + cmpl $32767, %eax + je ..B1.86 +..B1.72: + testl %ebx, %ebx + je ..B1.74 +..B1.73: + fldt _small_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.75 +..B1.74: + fldt _large_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt (%esp) +..B1.75: + testl %ecx, %ecx + je ..B1.77 +..B1.76: + fldcw 70(%esp) +..B1.77: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + fldt 8(%ebp) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.14 +..B1.79: + xorl %eax, %eax + jmp ..B1.19 +..B1.80: + xorl %eax, %eax + jmp ..B1.26 +..B1.81: + xorl %eax, %eax + jmp ..B1.33 +..B1.82: + xorl %eax, %eax + jmp ..B1.40 +..B1.83: + xorl %ebx, %ebx + jmp ..B1.47 +..B1.84: + fldt _small_value_80@GOTOFF(%edx) + fmul %st(0), %st + fstpt 12(%esp) + jmp ..B1.64 +..B1.85: + xorl %esi, %esi + jmp ..B1.59 +..B1.86: + cmpl $-2147483648, 12(%ebp) + jne ..B1.89 +..B1.87: + cmpl $0, 8(%ebp) + jne ..B1.89 +..B1.88: + fldl _inf_zeros@GOTOFF(%edx,%ebx,8) + fstpt (%esp) + jmp ..B1.75 +..B1.89: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.75 +..B1.90: + xorl %ecx, %ecx + jmp ..B1.71 + .align 16,0x90 + .type expl,@function + .size expl,.-expl + .data +# -- End expl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +SC2_BIAS: + .long 8191 + .long 24575 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .align 2 +_Q3: + .word 1 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 21845 + .word 85 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 13107 + .word 43827 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 65172 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 43275 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 49902 + .word 27670 + .word 43713 + .word 43690 + .word 16378 + .word 0 + .word 39976 + .word 2496 + .word 34972 + .word 34952 + .word 16376 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q0: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 62628 + .word 43690 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 53890 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 62001 + .word 21104 + .word 24757 + .word 46603 + .word 16373 + .word 0 + .word 21793 + .word 10330 + .word 207 + .word 53261 + .word 16370 + .word 0 + .word 18027 + .word 53571 + .word 10421 + .word 53262 + .word 16367 + .word 0 + .word 54394 + .word 23739 + .word 10794 + .word 47344 + .word 16364 + .word 0 + .type _Q0,@object + .size _Q0,96 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_ranges: + .word 31148 + .word 53711 + .word 6135 + .word 45426 + .word 16396 + .word 0 + .word 488 + .word 27074 + .word 50247 + .word 45600 + .word 16396 + .word 0 + .type _ranges,@object + .size _ranges,24 + .align 2 +_expbut: + .word 60207 + .word 4624 + .word 35943 + .word 45420 + .word 49164 + .word 0 + .type _expbut,@object + .size _expbut,12 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _SC2,@object + .size _SC2,24 + .align 2 +_minnorm: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _minnorm,@object + .size _minnorm,12 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/expl_table.S b/external/sgx_libm/ia32/expl_table.S new file mode 100644 index 0000000000..a3b1c92bfa --- /dev/null +++ b/external/sgx_libm/ia32/expl_table.S @@ -0,0 +1,562 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_expl_table_256 + .globl __libm_expl_table_256 +__libm_expl_table_256: + .long 0x66800000,0x3fe6a09e + .long 0xee9a09d9,0xbd98866d + .long 0xfa800000,0x3fe6b052 + .long 0xcb8e15a7,0xbdd5d183 + .long 0x75000000,0x3fe6c012 + .long 0xdaed5330,0x3dd7b57d + .long 0xde000000,0x3fe6cfdc + .long 0x470aac92,0xbdf5c4dd + .long 0x3c400000,0x3fe6dfb2 + .long 0x79107166,0x3df28d17 + .long 0x98400000,0x3fe6ef92 + .long 0xbd1a2d88,0x3de93ae4 + .long 0xf9400000,0x3fe6ff7d + .long 0xcf87e1b5,0x3de19483 + .long 0x67000000,0x3fe70f74 + .long 0xf314dd96,0xbdd7a2f1 + .long 0xe9000000,0x3fe71f75 + .long 0x22dc8f0d,0xbde3a08c + .long 0x87000000,0x3fe72f82 + .long 0x482a80b3,0xbde52f76 + .long 0x48c00000,0x3fe73f9a + .long 0x42a365b2,0xbdea7e8c + .long 0x35c00000,0x3fe74fbd + .long 0x411ff586,0x3de7cbfd + .long 0x56400000,0x3fe75feb + .long 0xfb74d51a,0x3db33e45 + .long 0xb1c00000,0x3fe77024 + .long 0x921e23a6,0xbde491f6 + .long 0x4fc00000,0x3fe78069 + .long 0x619ae028,0x3dee5d3f + .long 0x38c00000,0x3fe790b9 + .long 0xb2d95e75,0xbde3e309 + .long 0x74000000,0x3fe7a114 + .long 0x282aefdc,0xbde4fe79 + .long 0x09800000,0x3fe7b17b + .long 0xdf5dac23,0xbdd2604a + .long 0x01000000,0x3fe7c1ed + .long 0x3e2499a2,0x3df86099 + .long 0x63000000,0x3fe7d26a + .long 0x4224048d,0xbd8e43ee + .long 0x36c00000,0x3fe7e2f3 + .long 0x20ba0574,0x3dde9cc4 + .long 0x84800000,0x3fe7f387 + .long 0xdf01dc61,0x3de1c490 + .long 0x54400000,0x3fe80427 + .long 0x9f21989b,0xbdae5ee4 + .long 0xae000000,0x3fe814d2 + .long 0x573791e6,0xbdf77c93 + .long 0x99400000,0x3fe82589 + .long 0x159f115f,0x3dd99c25 + .long 0x1e800000,0x3fe8364c + .long 0xb3373464,0x3dfca0fb + .long 0x46400000,0x3fe8471a + .long 0x31ad0947,0xbdec3853 + .long 0x17800000,0x3fe857f4 + .long 0xf9162dc2,0x3def5b20 + .long 0x9b400000,0x3fe868d9 + .long 0x03907643,0x3dc24bb2 + .long 0xd9400000,0x3fe879ca + .long 0xa8b4a0b5,0xbddcb793 + .long 0xd9800000,0x3fe88ac7 + .long 0xcca6179c,0x3dd4cd32 + .long 0xa4800000,0x3fe89bd0 + .long 0x2ac6abb9,0xbdce9fc2 + .long 0x42400000,0x3fe8ace5 + .long 0xa4583aa6,0xbde55f24 + .long 0xbac00000,0x3fe8be05 + .long 0x7b2d7bf1,0x3de61778 + .long 0x16c00000,0x3fe8cf32 + .long 0x21aabc66,0xbdd576e8 + .long 0x5e400000,0x3fe8e06a + .long 0xae2294e0,0xbdfbcc93 + .long 0x99000000,0x3fe8f1ae + .long 0x2b982746,0x3de57736 + .long 0xd0000000,0x3fe902fe + .long 0x2b25950c,0x3df41645 + .long 0x0b800000,0x3fe9145b + .long 0x88a61b47,0x3de1ffc5 + .long 0x53800000,0x3fe925c3 + .long 0xecbaa05a,0x3df517f0 + .long 0xb0c00000,0x3fe93737 + .long 0xe8a0387e,0x3ddb8bc9 + .long 0x2b400000,0x3fe948b8 + .long 0xc478530d,0x3def98e4 + .long 0xcbc00000,0x3fe95a44 + .long 0xd36906d3,0x3dd0a41d + .long 0x9a400000,0x3fe96bdd + .long 0x7c8b4d30,0x3dfb3859 + .long 0x9fc00000,0x3fe97d82 + .long 0x8b9e9210,0x3dee4e4f + .long 0xe4800000,0x3fe98f33 + .long 0x8d509577,0xbdc77577 + .long 0x70c00000,0x3fe9a0f1 + .long 0x74621372,0x3dd40f73 + .long 0x4d400000,0x3fe9b2bb + .long 0x889ec6c8,0x3de3fe0c + .long 0x82800000,0x3fe9c491 + .long 0x0e3e2358,0x3df1f848 + .long 0x19400000,0x3fe9d674 + .long 0x574a0ae1,0x3dd771a9 + .long 0x19c00000,0x3fe9e863 + .long 0x8c12653c,0x3df19191 + .long 0x8d000000,0x3fe9fa5e + .long 0x5ab18aa8,0x3dcfca77 + .long 0x7b400000,0x3fea0c66 + .long 0xb29ada8c,0x3dede564 + .long 0xed800000,0x3fea1e7a + .long 0xe330c774,0x3ddd7176 + .long 0xec400000,0x3fea309b + .long 0xb182e3ef,0x3dd45a66 + .long 0x80400000,0x3fea42c9 + .long 0x5587fa76,0x3dc82b5e + .long 0xb2400000,0x3fea5503 + .long 0x4bdbb6e3,0xbdadaa37 + .long 0x8b000000,0x3fea674a + .long 0xeaf0a9d0,0xbdd73f5b + .long 0x13400000,0x3fea799e + .long 0x21a409aa,0xbdde994f + .long 0x53c00000,0x3fea8bfe + .long 0xc1e61351,0x3da2e58a + .long 0x55400000,0x3fea9e6b + .long 0xa1f5921e,0x3dfcfedf + .long 0x21400000,0x3feab0e5 + .long 0x9d8f3894,0xbdd5228b + .long 0xbfc00000,0x3feac36b + .long 0xc0db966a,0x3de3f379 + .long 0x3a400000,0x3fead5ff + .long 0x0218892a,0xbdbec45d + .long 0x99800000,0x3feae89f + .long 0x50bc6597,0xbdf29629 + .long 0xe6400000,0x3feafb4c + .long 0x52cbf03d,0xbded0d01 + .long 0x29800000,0x3feb0e07 + .long 0x2108559c,0x3ddb6ccb + .long 0x6c800000,0x3feb20ce + .long 0x53740928,0x3dea8952 + .long 0xb8800000,0x3feb33a2 + .long 0x84a0178c,0xbdf87502 + .long 0x15c00000,0x3feb4684 + .long 0x3eec7bd4,0xbdd16c9e + .long 0x8e000000,0x3feb5972 + .long 0x71c77eef,0xbdeaa6c6 + .long 0x2a000000,0x3feb6c6e + .long 0x6ab8656c,0xbddc75ab + .long 0xf3000000,0x3feb7f76 + .long 0x55613df9,0xbdc286e4 + .long 0xf2400000,0x3feb928c + .long 0x6dc85953,0xbde8b61c + .long 0x30c00000,0x3feba5b0 + .long 0x7bf34c39,0xbdeef9b6 + .long 0xb7c00000,0x3febb8e0 + .long 0x80fa968e,0xbdf2c870 + .long 0x90400000,0x3febcc1e + .long 0x48f741e9,0x3dd783a4 + .long 0xc4000000,0x3febdf69 + .long 0x0384c46c,0xbdd8bbf2 + .long 0x5c000000,0x3febf2c2 + .long 0xbdfb947f,0xbdf470fb + .long 0x61400000,0x3fec0628 + .long 0x4eb4abc1,0x3dab33cc + .long 0xdd800000,0x3fec199b + .long 0x88832c4b,0x3dc54a70 + .long 0xd9c00000,0x3fec2d1c + .long 0xd235d3d0,0x3dfd3295 + .long 0x60000000,0x3fec40ab + .long 0x75903ef8,0xbd77c2c9 + .long 0x79000000,0x3fec5447 + .long 0xed0f8db7,0xbdc41376 + .long 0x2e400000,0x3fec67f1 + .long 0x4a2137fd,0x3de7d14b + .long 0x89c00000,0x3fec7ba8 + .long 0x9e76bbbe,0xbdfb9b66 + .long 0x94000000,0x3fec8f6d + .long 0x46b2f122,0x3dcb9ed4 + .long 0x57400000,0x3feca340 + .long 0xd01a825e,0x3de1c4da + .long 0xdd000000,0x3fecb720 + .long 0xeafc342e,0xbde06f96 + .long 0x2e800000,0x3feccb0f + .long 0x1d220f86,0xbde2e98b + .long 0x55400000,0x3fecdf0b + .long 0xc44f8959,0x3dedc3f9 + .long 0x5b800000,0x3fecf315 + .long 0x3411d371,0xbdf22a46 + .long 0x4a000000,0x3fed072d + .long 0x343c8bc8,0x3dce25ee + .long 0x2b000000,0x3fed1b53 + .long 0xaab1b10d,0x3dd192d0 + .long 0x08000000,0x3fed2f87 + .long 0x15bc2473,0x3ddb13e3 + .long 0xeac00000,0x3fed43c8 + .long 0x9eda9dfb,0x3dd543ac + .long 0xdd000000,0x3fed5818 + .long 0x6897e945,0xbdc16de3 + .long 0xe8400000,0x3fed6c76 + .long 0x83fd0f49,0x3df17369 + .long 0x16c00000,0x3fed80e3 + .long 0x7709f3a1,0x3dd3072f + .long 0x72000000,0x3fed955d + .long 0xfd692233,0xbd93f152 + .long 0x04000000,0x3feda9e6 + .long 0x47b9ff2d,0xbdf266bd + .long 0xd6400000,0x3fedbe7c + .long 0xb76f1927,0xbdc5f3ad + .long 0xf3000000,0x3fedd321 + .long 0xb695de3c,0x3dab4604 + .long 0x64000000,0x3fede7d5 + .long 0x8d6ab5c6,0x3dec0657 + .long 0x33800000,0x3fedfc97 + .long 0x1a5cd4f2,0xbdc19285 + .long 0x6b000000,0x3fee1167 + .long 0xed4ad643,0x3de97d16 + .long 0x15000000,0x3fee2646 + .long 0xbdb13c0c,0xbdd4bdae + .long 0x3b000000,0x3fee3b33 + .long 0x982d6f38,0x3de6ee11 + .long 0xe7c00000,0x3fee502e + .long 0xec61767f,0xbdfa6004 + .long 0x24800000,0x3fee6539 + .long 0x2c7ff0ea,0xbde8928a + .long 0xfbc00000,0x3fee7a51 + .long 0x2d522ca1,0x3dcd320d + .long 0x77c00000,0x3fee8f79 + .long 0x77bb5bfa,0x3ddb6e7f + .long 0xa2c00000,0x3feea4af + .long 0x7a708c5e,0xbdeb6f26 + .long 0x86800000,0x3feeb9f4 + .long 0x6f9a1bae,0xbdb9ac8d + .long 0x2d800000,0x3feecf48 + .long 0x1b60625f,0x3ddccfe1 + .long 0xa2000000,0x3feee4aa + .long 0x471a3692,0x3de88510 + .long 0xee400000,0x3feefa1b + .long 0xbb8fe90d,0x3df0ad13 + .long 0x1cc00000,0x3fef0f9c + .long 0x99100329,0xbdd37dac + .long 0x37800000,0x3fef252b + .long 0xb1796904,0xbde44568 + .long 0x48c00000,0x3fef3ac9 + .long 0xe6a5a5c1,0x3ded7273 + .long 0x5b800000,0x3fef5076 + .long 0x98b07b49,0xbde1babf + .long 0x79800000,0x3fef6632 + .long 0xfd1bd9aa,0x3dd089f0 + .long 0xadc00000,0x3fef7bfd + .long 0x3b7625a0,0xbdf1a0f6 + .long 0x02400000,0x3fef91d8 + .long 0x08975454,0xbdebc377 + .long 0x81c00000,0x3fefa7c1 + .long 0xe8b7ac0c,0xbdf0b793 + .long 0x36800000,0x3fefbdba + .long 0xe6988ceb,0x3de2d513 + .long 0x2b800000,0x3fefd3c2 + .long 0x12eb7496,0x3ddee3e2 + .long 0x6b400000,0x3fefe9d9 + .long 0xeb59fc8c,0xbde5dc26 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0x00000000 + .long 0xfa600000,0x3ff00b1a + .long 0xa7b5953b,0xbdd50d04 + .long 0xaa000000,0x3ff0163d + .long 0x49ed6654,0xbdd3332a + .long 0x14400000,0x3ff02168 + .long 0x95f9887e,0xbdd3f5fc + .long 0x3e800000,0x3ff02c9a + .long 0x232106a7,0xbde0ff3e + .long 0x2e200000,0x3ff037d4 + .long 0xea97ee11,0xbdec8867 + .long 0xe8800000,0x3ff04315 + .long 0x428c7066,0xbdf1807b + .long 0x73000000,0x3ff04e5f + .long 0xacf21b15,0xbde3569d + .long 0xd3200000,0x3ff059b0 + .long 0x8a30756e,0xbde4f517 + .long 0x0e400000,0x3ff0650a + .long 0xb96f6af3,0xbdcf03ba + .long 0x29e00000,0x3ff0706b + .long 0xc91dfe2b,0xbdc04911 + .long 0x2b800000,0x3ff07bd4 + .long 0xb3732eaf,0xbdeaaf93 + .long 0x18800000,0x3ff08745 + .long 0xee7941b4,0xbde4c86f + .long 0xf6600000,0x3ff092bd + .long 0x97f9c7ff,0x3dd81f7e + .long 0xcac00000,0x3ff09e3e + .long 0x14878183,0x3ddbce0d + .long 0x9b200000,0x3ff0a9c7 + .long 0x8ba4de31,0xbda8dcda + .long 0x6d000000,0x3ff0b558 + .long 0x759d1b52,0xbdd9dbc2 + .long 0x45e00000,0x3ff0c0f1 + .long 0x4f98906d,0x3dd1b215 + .long 0x2b600000,0x3ff0cc92 + .long 0x407b705c,0x3df247f7 + .long 0x23400000,0x3ff0d83b + .long 0xbc14de44,0xbdda8851 + .long 0x32e00000,0x3ff0e3ec + .long 0xfbf17a36,0xbde85cbb + .long 0x5fe00000,0x3ff0efa5 + .long 0x9db9bc54,0xbd958ed4 + .long 0xb0000000,0x3ff0fb66 + .long 0xdcdf6e22,0xbdb2ce50 + .long 0x28c00000,0x3ff10730 + .long 0x3a8dd62d,0x3df7233e + .long 0xd0200000,0x3ff11301 + .long 0xb62881ca,0xbdeb495e + .long 0xab600000,0x3ff11edb + .long 0x29153dc1,0xbdbd54a7 + .long 0xc0600000,0x3ff12abd + .long 0xf72575a6,0x3de86397 + .long 0x14e00000,0x3ff136a8 + .long 0xf477b823,0x3df204aa + .long 0xaea00000,0x3ff1429a + .long 0x66820328,0x3de25bbf + .long 0x93600000,0x3ff14e95 + .long 0x3723d073,0xbdf0ced2 + .long 0xc8a00000,0x3ff15a98 + .long 0x920355cf,0x3dd63944 + .long 0x54600000,0x3ff166a4 + .long 0x063c8ee1,0x3df1c3c2 + .long 0x3c800000,0x3ff172b8 + .long 0x19041b9d,0xbdc57429 + .long 0x86a00000,0x3ff17ed4 + .long 0xdec3803b,0xbde4887f + .long 0x38800000,0x3ff18af9 + .long 0x777ee173,0x3de91bd3 + .long 0x58400000,0x3ff19726 + .long 0x5aa913d0,0xbde145a1 + .long 0xeb600000,0x3ff1a35b + .long 0x796d31ed,0x3def96ea + .long 0xf8200000,0x3ff1af99 + .long 0x4203d2da,0xbde8ebc7 + .long 0x84000000,0x3ff1bbe0 + .long 0x6ac79cad,0x3dd1734e + .long 0x95200000,0x3ff1c82f + .long 0x804bbc01,0x3de038d6 + .long 0x31800000,0x3ff1d487 + .long 0x87fa47fd,0xbdf74655 + .long 0x5ec00000,0x3ff1e0e7 + .long 0xb7eec044,0xbde77fb2 + .long 0x23000000,0x3ff1ed50 + .long 0x3bf3004f,0xbdc9371a + .long 0x84400000,0x3ff1f9c1 + .long 0xbf524a09,0xbddcc6cd + .long 0x88600000,0x3ff2063b + .long 0xdc775815,0x3dc466b1 + .long 0x35600000,0x3ff212be + .long 0x4d64b4b4,0x3df8a819 + .long 0x91800000,0x3ff21f49 + .long 0xd56816b7,0xbdc11b4e + .long 0xa2800000,0x3ff22bdd + .long 0x16582554,0xbddbb4bb + .long 0x6e800000,0x3ff2387a + .long 0x327c0a4a,0xbde53b8f + .long 0xfba00000,0x3ff2451f + .long 0xca6066de,0xbdfdebf5 + .long 0x4fc00000,0x3ff251ce + .long 0x94faa904,0xbdeab381 + .long 0x71200000,0x3ff25e85 + .long 0x07976d4f,0xbdb318ab + .long 0x65e00000,0x3ff26b45 + .long 0x2bd33994,0x3dc3e6e9 + .long 0x34200000,0x3ff2780e + .long 0x3f307f41,0xbdc106b4 + .long 0xe1e00000,0x3ff284df + .long 0x96cf15cf,0x3df56380 + .long 0x75800000,0x3ff291ba + .long 0xda671baf,0x3df1bb6f + .long 0xf5200000,0x3ff29e9d + .long 0xed175053,0xbd808f69 + .long 0x66c00000,0x3ff2ab8a + .long 0x9aa2f39c,0x3df10f12 + .long 0xd0e00000,0x3ff2b87f + .long 0x08856e6b,0xbdd499c0 + .long 0x39600000,0x3ff2c57e + .long 0xabfae964,0x3df71b2e + .long 0xa7000000,0x3ff2d285 + .long 0xbff6e2ad,0xbdfbfcf4 + .long 0x1f600000,0x3ff2df96 + .long 0xd16cffbc,0x3dd05625 + .long 0xa9400000,0x3ff2ecaf + .long 0xe35f0ba3,0xbdbd0a9e + .long 0x4ac00000,0x3ff2f9d2 + .long 0x54f1554d,0xbdc3bca8 + .long 0x0a200000,0x3ff306fe + .long 0x2de8d5a4,0x3df1b715 + .long 0xee000000,0x3ff31432 + .long 0xcd4cb818,0xbdf14d02 + .long 0xfc400000,0x3ff32170 + .long 0x6a739e38,0x3de9b062 + .long 0x3ba00000,0x3ff32eb8 + .long 0x1dd0be1a,0x3de1d463 + .long 0xb2600000,0x3ff33c08 + .long 0x32721843,0x3dd05bfd + .long 0x66e00000,0x3ff34962 + .long 0xca58a6cf,0x3dcfd166 + .long 0x5fa00000,0x3ff356c5 + .long 0x6d73b971,0xbdeac01e + .long 0xa2e00000,0x3ff36431 + .long 0x8628940e,0xbdb77c53 + .long 0x37400000,0x3ff371a7 + .long 0x63aeabf4,0xbdd558d5 + .long 0x23200000,0x3ff37f26 + .long 0x7d72a7b4,0xbdb8ab66 + .long 0x6d000000,0x3ff38cae + .long 0x16a72c36,0x3dd76196 + .long 0x1b800000,0x3ff39a40 + .long 0xcd4d2fe4,0xbded7e22 + .long 0x34e00000,0x3ff3a7db + .long 0xa86f24a6,0x3dd67fdb + .long 0xc0000000,0x3ff3b57f + .long 0xaace6476,0xbdf3930b + .long 0xc3200000,0x3ff3c32d + .long 0xf7ffc1bb,0xbde8ae36 + .long 0x44e00000,0x3ff3d0e5 + .long 0x3fd1a118,0x3debc2e6 + .long 0x4c200000,0x3ff3dea6 + .long 0x9497dbb8,0xbdeb97bb + .long 0xdf200000,0x3ff3ec70 + .long 0xaf6637b9,0xbdcd7459 + .long 0x04a00000,0x3ff3fa45 + .long 0x417ee035,0x3de90037 + .long 0xc3600000,0x3ff40822 + .long 0xdeefc5b8,0x3dde8090 + .long 0x22000000,0x3ff4160a + .long 0x0f79b48e,0xbde1a3ac + .long 0x27000000,0x3ff423fb + .long 0x3dce91fa,0x3de28d13 + .long 0xd9600000,0x3ff431f5 + .long 0x471f778d,0xbdeeaed2 + .long 0x3f800000,0x3ff43ffa + .long 0xc405f4b8,0x3dd2e750 + .long 0x60600000,0x3ff44e08 + .long 0x3136f40a,0x3db892d0 + .long 0x42a00000,0x3ff45c20 + .long 0xcf37ccfa,0x3ddf48c7 + .long 0xed200000,0x3ff46a41 + .long 0x6d7685d3,0xbdc7fd44 + .long 0x66800000,0x3ff4786d + .long 0x1ef87896,0x3de6646d + .long 0xb5c00000,0x3ff486a2 + .long 0x3c1a3b69,0x3db3cd01 + .long 0xe1a00000,0x3ff494e1 + .long 0x4eca2579,0xbdeaa25c + .long 0xf0e00000,0x3ff4a32a + .long 0x31a4e861,0xbde05843 + .long 0xea800000,0x3ff4b17d + .long 0x224b70fe,0xbdf24829 + .long 0xd5400000,0x3ff4bfda + .long 0xc578d0a0,0xbde3abb1 + .long 0xb8000000,0x3ff4ce41 + .long 0x4178a5a4,0x3df7c114 + .long 0x9a000000,0x3ff4dcb2 + .long 0xe2648873,0xbdc11794 + .long 0x81e00000,0x3ff4eb2d + .long 0x5257d2e6,0xbddd5005 + .long 0x76a00000,0x3ff4f9b2 + .long 0x96613a4b,0xbdc69aca + .long 0x7f400000,0x3ff50841 + .long 0x68926d27,0x3dd4c7b8 + .long 0xa2c00000,0x3ff516da + .long 0x8225ea59,0x3deecc83 + .long 0xe8400000,0x3ff5257d + .long 0x9331a87e,0xbda62223 + .long 0x56a00000,0x3ff5342b + .long 0x07abe1db,0xbdc583f1 + .long 0xf4e00000,0x3ff542e2 + .long 0x2f24da32,0x3df6ad27 + .long 0xca600000,0x3ff551a4 + .long 0xd689ceff,0xbdc36f89 + .long 0xde000000,0x3ff56070 + .long 0x43edb85a,0xbdf6ef2e + .long 0x36800000,0x3ff56f47 + .long 0x33765802,0x3e0a93ed + .long 0xdbc00000,0x3ff57e27 + .long 0x5e8ce6eb,0x3e016267 + .long 0xd4800000,0x3ff58d12 + .long 0x252bc2b7,0x3df7c7fd + .long 0x28000000,0x3ff59c08 + .long 0xf1677234,0xbdaf068b + .long 0xdd400000,0x3ff5ab07 + .long 0xb192602a,0x3de0a852 + .long 0xfb800000,0x3ff5ba11 + .long 0x4910bd68,0x3e043d01 + .long 0x8a400000,0x3ff5c926 + .long 0x01c4b1b8,0x3df946b7 + .long 0x90800000,0x3ff5d845 + .long 0x8ca5615d,0x3df98b92 + .long 0x15800000,0x3ff5e76f + .long 0x374df261,0x3e0690a4 + .long 0x20c00000,0x3ff5f6a3 + .long 0xcc2a4438,0x3dfceb70 + .long 0xb9800000,0x3ff605e1 + .long 0x9f1214db,0xbde247ee + .long 0xe6c00000,0x3ff6152a + .long 0xf259f256,0x3debede8 + .long 0xb0400000,0x3ff6247e + .long 0x383c17e4,0xbdd6a9ed + .long 0x1d000000,0x3ff633dd + .long 0x611c42fb,0x3df929fd + .long 0x34c00000,0x3ff64346 + .long 0x8edf0e2a,0x3de9863f + .long 0xfec00000,0x3ff652b9 + .long 0x5c7ab935,0xbdcb824b + .long 0x82400000,0x3ff66238 + .long 0x9127d9e3,0x3df52224 + .long 0xc7000000,0x3ff671c1 + .long 0x85e3369e,0x3de067eb + .long 0xd4400000,0x3ff68155 + .long 0x1038ae45,0x3de952e6 + .long 0xb1c00000,0x3ff690f4 + .long 0xe7fb4265,0xbe00b563 + .long 0x66800000,0x3ff6a09e + .long 0xee9a09d9,0xbda8866d + .type __libm_expl_table_256,@object + .size __libm_expl_table_256,4112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/expm1_wmt.S b/external/sgx_libm/ia32/expm1_wmt.S new file mode 100644 index 0000000000..6a5235a8eb --- /dev/null +++ b/external/sgx_libm/ia32/expm1_wmt.S @@ -0,0 +1,703 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expm1_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin expm1 + .text + .align 16,0x90 + .globl expm1 +expm1: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + unpcklpd %xmm0, %xmm0 + movapd 64(%ebx), %xmm1 + movapd 48(%ebx), %xmm6 + movapd 80(%ebx), %xmm2 + movapd 96(%ebx), %xmm3 + pextrw $3, %xmm0, %eax + andl $32767, %eax + movl $16527, %edx + subl %eax, %edx + subl $16304, %eax + orl %eax, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_0.0.3 + mulpd %xmm0, %xmm1 + addpd %xmm6, %xmm1 + movapd %xmm1, %xmm7 + subpd %xmm6, %xmm1 + mulpd %xmm1, %xmm2 + movapd 112(%ebx), %xmm4 + mulpd %xmm1, %xmm3 + movapd 128(%ebx), %xmm5 + subpd %xmm2, %xmm0 + movd %xmm7, %eax + movl %eax, %ecx + andl $63, %ecx + shll $4, %ecx + sarl $6, %eax + movl %eax, %edx + subpd %xmm3, %xmm0 + movapd 160(%ebx,%ecx), %xmm2 + movsd 144(%ebx), %xmm3 + mulpd %xmm0, %xmm4 + movapd %xmm0, %xmm1 + mulpd %xmm0, %xmm0 + mulsd %xmm0, %xmm3 + addpd %xmm4, %xmm5 + mulsd %xmm0, %xmm0 + movapd %xmm2, %xmm4 + unpckhpd %xmm2, %xmm2 + movdqa 16(%ebx), %xmm6 + pand %xmm6, %xmm7 + movdqa 32(%ebx), %xmm6 + paddq %xmm6, %xmm7 + psllq $46, %xmm7 + mulsd %xmm0, %xmm3 + mulpd %xmm5, %xmm0 + addsd %xmm3, %xmm0 + addl $894, %edx + cmpl $1916, %edx + ja .L_2TAG_PACKET_1.0.3 + xorpd %xmm3, %xmm3 + movl $16368, %eax + pinsrw $3, %eax, %xmm3 + orpd %xmm7, %xmm2 + mulsd %xmm4, %xmm7 + movapd %xmm3, %xmm6 + addsd %xmm1, %xmm3 + pextrw $3, %xmm2, %edx + pshufd $238, %xmm0, %xmm5 + psrlq $38, %xmm3 + psllq $38, %xmm3 + movapd %xmm2, %xmm4 + subsd %xmm3, %xmm6 + addsd %xmm5, %xmm0 + addsd %xmm6, %xmm1 + addsd %xmm7, %xmm4 + mulsd %xmm3, %xmm7 + mulsd %xmm2, %xmm3 + xorpd %xmm5, %xmm5 + movl $16368, %eax + pinsrw $3, %eax, %xmm5 + addsd %xmm1, %xmm0 + movl $17184, %ecx + subl %edx, %ecx + subl $16256, %edx + orl %edx, %ecx + jl .L_2TAG_PACKET_2.0.3 + mulsd %xmm4, %xmm0 + subsd %xmm5, %xmm3 + addsd %xmm7, %xmm0 + addsd %xmm3, %xmm0 +.L_2TAG_PACKET_3.0.3: + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_2.0.3: + cmpl $0, %edx + jl .L_2TAG_PACKET_5.0.3 + mulsd %xmm4, %xmm0 + subsd %xmm5, %xmm7 + addsd %xmm7, %xmm0 + addsd %xmm3, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_5.0.3: + mulsd %xmm4, %xmm0 + addsd %xmm7, %xmm0 + addsd %xmm3, %xmm0 + subsd %xmm5, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_1.0.3: + movl 132(%esp), %ecx + addsd %xmm0, %xmm1 + unpckhpd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + cmpl $0, %ecx + jl .L_2TAG_PACKET_6.0.3 + fstcw 24(%esp) + movzwl 24(%esp), %edx + orl $768, %edx + movw %dx, 28(%esp) + fldcw 28(%esp) + movl %eax, %edx + sarl $1, %eax + subl %eax, %edx + movdqa (%ebx), %xmm6 + pandn %xmm2, %xmm6 + addl $1023, %eax + movd %eax, %xmm3 + psllq $52, %xmm3 + orpd %xmm3, %xmm6 + mulsd %xmm3, %xmm4 + movsd %xmm0, 8(%esp) + fldl 8(%esp) + movsd %xmm6, 16(%esp) + fldl 16(%esp) + movsd %xmm4, 16(%esp) + fldl 16(%esp) + addl $1023, %edx + movd %edx, %xmm4 + psllq $52, %xmm4 + faddp %st, %st(1) + fmul %st, %st(1) + faddp %st, %st(1) + movsd %xmm4, 8(%esp) + fldl 8(%esp) + fmulp %st, %st(1) + fstpl 8(%esp) + movsd 8(%esp), %xmm0 + fldcw 24(%esp) + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $32752, %ecx + jae .L_2TAG_PACKET_7.0.3 + jmp .L_2TAG_PACKET_4.0.3 + cmpl $-2147483648, %ecx + jb .L_2TAG_PACKET_7.0.3 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_7.0.3: + movl $41, %edx +.L_2TAG_PACKET_8.0.3: + movsd %xmm0, (%esp) + movsd 128(%esp), %xmm0 + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_10.0.3: + cmpl $2146435072, %eax + jae .L_2TAG_PACKET_11.0.3 + movsd 1272(%ebx), %xmm0 + mulsd %xmm0, %xmm0 + movl $41, %edx + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_11.0.3: + movl 132(%esp), %eax + movl 128(%esp), %edx + movl %eax, %ecx + andl $2147483647, %eax + cmpl $2146435072, %eax + ja .L_2TAG_PACKET_12.0.3 + cmpl $0, %edx + jne .L_2TAG_PACKET_12.0.3 + cmpl $0, %ecx + jl .L_2TAG_PACKET_13.0.3 + movsd 1256(%ebx), %xmm0 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_13.0.3: + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_12.0.3: + movsd 128(%esp), %xmm0 + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_14.0.3: + addl $16304, %eax + cmpl $15504, %eax + jb .L_2TAG_PACKET_15.0.3 + movapd 1184(%ebx), %xmm2 + pshufd $68, %xmm0, %xmm1 + movapd 1200(%ebx), %xmm3 + movapd 1216(%ebx), %xmm4 + movsd 1232(%ebx), %xmm5 + mulsd %xmm1, %xmm1 + xorpd %xmm6, %xmm6 + movl $16352, %eax + pinsrw $3, %eax, %xmm6 + mulpd %xmm0, %xmm2 + xorpd %xmm7, %xmm7 + movl $16368, %edx + pinsrw $3, %edx, %xmm7 + addpd %xmm3, %xmm2 + mulsd %xmm1, %xmm5 + pshufd $228, %xmm1, %xmm3 + mulpd %xmm1, %xmm1 + mulsd %xmm0, %xmm6 + mulpd %xmm0, %xmm2 + addpd %xmm4, %xmm2 + movapd %xmm7, %xmm4 + addsd %xmm6, %xmm7 + mulpd %xmm3, %xmm1 + psrlq $27, %xmm7 + psllq $27, %xmm7 + movsd 1288(%ebx), %xmm3 + subsd %xmm7, %xmm4 + mulpd %xmm1, %xmm2 + addsd %xmm4, %xmm6 + pshufd $238, %xmm2, %xmm1 + addsd %xmm2, %xmm6 + andpd %xmm0, %xmm3 + movapd %xmm0, %xmm4 + addsd %xmm6, %xmm1 + subsd %xmm3, %xmm0 + addsd %xmm5, %xmm1 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm0 + mulsd %xmm1, %xmm4 + addsd %xmm4, %xmm0 + addsd %xmm3, %xmm0 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_15.0.3: + cmpl $16, %eax + jae .L_2TAG_PACKET_3.0.3 + movapd %xmm0, %xmm2 + movd %xmm0, %eax + psrlq $31, %xmm2 + movd %xmm2, %ecx + orl %ecx, %eax + je .L_2TAG_PACKET_3.0.3 + movl $16, %edx + xorpd %xmm1, %xmm1 + pinsrw $3, %edx, %xmm1 + mulsd %xmm1, %xmm1 + movl $42, %edx + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_0.0.3: + cmpl $0, %eax + jl .L_2TAG_PACKET_14.0.3 + movl 132(%esp), %eax + cmpl $1083179008, %eax + jge .L_2TAG_PACKET_10.0.3 + cmpl $-1048576, %eax + jae .L_2TAG_PACKET_11.0.3 +.L_2TAG_PACKET_6.0.3: + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_4.0.3: + movsd %xmm0, 48(%esp) + fldl 48(%esp) +.L_2TAG_PACKET_9.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type expm1,@function + .size expm1,.-expm1 + .data +# -- End expm1 + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 4293918720 + .long 0 + .long 4293918720 + .long 4294967232 + .long 0 + .long 4294967232 + .long 0 + .long 65472 + .long 0 + .long 65472 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 1697350398 + .long 1079448903 + .long 1697350398 + .long 1079448903 + .long 4277796864 + .long 1065758274 + .long 4277796864 + .long 1065758274 + .long 3164486458 + .long 1025308570 + .long 3164486458 + .long 1025308570 + .long 1963358694 + .long 1065423121 + .long 1431655765 + .long 1069897045 + .long 1431655765 + .long 1067799893 + .long 0 + .long 1071644672 + .long 381774871 + .long 1062650220 + .long 381774871 + .long 1062650220 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1000070955 + .long 1042145304 + .long 1040187392 + .long 11418 + .long 988267849 + .long 1039500660 + .long 3539992576 + .long 22960 + .long 36755401 + .long 1042114290 + .long 402653184 + .long 34629 + .long 3634769483 + .long 1042178627 + .long 1820327936 + .long 46424 + .long 2155991225 + .long 1041560680 + .long 847249408 + .long 58348 + .long 2766913307 + .long 1039293264 + .long 3489660928 + .long 70401 + .long 3651174602 + .long 1040488175 + .long 2927624192 + .long 82586 + .long 3073892131 + .long 1042240606 + .long 1006632960 + .long 94904 + .long 1328391742 + .long 1042019037 + .long 3942645760 + .long 107355 + .long 2650893825 + .long 1041903210 + .long 822083584 + .long 119943 + .long 2397289153 + .long 1041802037 + .long 2281701376 + .long 132667 + .long 430997175 + .long 1042110606 + .long 1845493760 + .long 145530 + .long 1230936525 + .long 1041801015 + .long 1702887424 + .long 158533 + .long 740675935 + .long 1040178913 + .long 4110417920 + .long 171677 + .long 3489810261 + .long 1041825986 + .long 2793406464 + .long 184965 + .long 2532600530 + .long 1040767882 + .long 167772160 + .long 198398 + .long 3542557060 + .long 1041827263 + .long 2986344448 + .long 211976 + .long 1401563777 + .long 1041061093 + .long 922746880 + .long 225703 + .long 3129406026 + .long 1041852413 + .long 880803840 + .long 239579 + .long 900993572 + .long 1039283234 + .long 1275068416 + .long 253606 + .long 2115029358 + .long 1042140042 + .long 562036736 + .long 267786 + .long 1086643152 + .long 1041785419 + .long 1610612736 + .long 282120 + .long 82864366 + .long 1041256244 + .long 3045064704 + .long 296610 + .long 2392968152 + .long 1040913683 + .long 3573547008 + .long 311258 + .long 2905856183 + .long 1040002214 + .long 1988100096 + .long 326066 + .long 3742008261 + .long 1040011137 + .long 1451229184 + .long 341035 + .long 863393794 + .long 1040880621 + .long 914358272 + .long 356167 + .long 1446136837 + .long 1041372426 + .long 3707764736 + .long 371463 + .long 927855201 + .long 1040617636 + .long 360710144 + .long 386927 + .long 1492679939 + .long 1041050306 + .long 2952790016 + .long 402558 + .long 608827001 + .long 1041582217 + .long 2181038080 + .long 418360 + .long 606260204 + .long 1042271987 + .long 1711276032 + .long 434334 + .long 3163044019 + .long 1041843851 + .long 1006632960 + .long 450482 + .long 4148747325 + .long 1041962972 + .long 3900702720 + .long 466805 + .long 802924201 + .long 1041275378 + .long 1442840576 + .long 483307 + .long 3052749833 + .long 1041940577 + .long 1937768448 + .long 499988 + .long 2216116399 + .long 1041486744 + .long 914358272 + .long 516851 + .long 2729697836 + .long 1041445764 + .long 2566914048 + .long 533897 + .long 540608356 + .long 1041310907 + .long 2600468480 + .long 551129 + .long 2916344493 + .long 1040535661 + .long 1107296256 + .long 568549 + .long 731391814 + .long 1039497014 + .long 2566914048 + .long 586158 + .long 1024722704 + .long 1041461625 + .long 2961178624 + .long 603959 + .long 3806831748 + .long 1041732499 + .long 2675965952 + .long 621954 + .long 238953304 + .long 1040316488 + .long 2189426688 + .long 640145 + .long 749123235 + .long 1041725785 + .long 2063597568 + .long 658534 + .long 1168187977 + .long 1041175214 + .long 2986344448 + .long 677123 + .long 3506096399 + .long 1042186095 + .long 1426063360 + .long 695915 + .long 1470221620 + .long 1041675499 + .long 2566914048 + .long 714911 + .long 3182425146 + .long 1041483134 + .long 3087007744 + .long 734114 + .long 3131698208 + .long 1042208657 + .long 4068474880 + .long 753526 + .long 2300504125 + .long 1041428596 + .long 2415919104 + .long 773150 + .long 2290297931 + .long 1037388400 + .long 3716153344 + .long 792987 + .long 3532148223 + .long 1041626194 + .long 771751936 + .long 813041 + .long 1161884404 + .long 1042015258 + .long 3699376128 + .long 833312 + .long 876383176 + .long 1037968878 + .long 1241513984 + .long 853805 + .long 3379986796 + .long 1042213153 + .long 3699376128 + .long 874520 + .long 1545797737 + .long 1041681569 + .long 58720256 + .long 895462 + .long 2925146801 + .long 1042212567 + .long 855638016 + .long 916631 + .long 1316627971 + .long 1038516204 + .long 3883925504 + .long 938030 + .long 3267869137 + .long 1040337004 + .long 2726297600 + .long 959663 + .long 3720868999 + .long 1041782409 + .long 3992977408 + .long 981531 + .long 433316142 + .long 1041994064 + .long 1526726656 + .long 1003638 + .long 781232103 + .long 1040093400 + .long 2172649472 + .long 1025985 + .long 2773927732 + .long 1053236707 + .long 381774871 + .long 1062650220 + .long 379653899 + .long 1056571845 + .long 286331153 + .long 1065423121 + .long 436314138 + .long 1059717536 + .long 1431655765 + .long 1067799893 + .long 1431655765 + .long 1069897045 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 4294967295 + .long 2146435071 + .long 0 + .long 1048576 + .long 4227858432 + .long 4294967295 + .type static_const_table,@object + .size static_const_table,1296 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/expm1f_wmt.S b/external/sgx_libm/ia32/expm1f_wmt.S new file mode 100644 index 0000000000..72ccdac276 --- /dev/null +++ b/external/sgx_libm/ia32/expm1f_wmt.S @@ -0,0 +1,808 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expm1f_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin expm1f + .text + .align 16,0x90 + .globl expm1f +expm1f: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %ecx + movsd 2112(%ebx), %xmm3 + xorpd %xmm7, %xmm7 + movl $17208, %eax + pinsrw $3, %eax, %xmm7 + cvtps2pd %xmm0, %xmm1 + movl %ecx, %edx + andl $2147483647, %ecx + subl $1043662067, %ecx + cmpl $74990712, %ecx + jae .L_2TAG_PACKET_0.0.3 + movsd 2096(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + movapd %xmm7, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm7 + movsd 2104(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + subsd %xmm1, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + addl $1043662067, %ecx + cmpl $1043662067, %ecx + jb .L_2TAG_PACKET_2.0.3 + cmpl $0, %edx + jl .L_2TAG_PACKET_3.0.3 + cmpl $1124073472, %ecx + jae .L_2TAG_PACKET_4.0.3 + movsd 2096(%ebx), %xmm6 + mulsd %xmm1, %xmm3 + movapd %xmm7, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm7 + movsd 2104(%ebx), %xmm5 + movd %xmm7, %eax + subsd %xmm7, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + xorpd %xmm4, %xmm4 + movl %eax, %ecx + andl $255, %eax + movsd (%ebx,%eax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_6.0.3 + movl $2130706432, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_5.0.3: + movl $43, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_2.0.3: + cmpl $855638016, %ecx + jb .L_2TAG_PACKET_9.0.3 + cmpl $998244352, %ecx + jb .L_2TAG_PACKET_10.0.3 + movapd 2048(%ebx), %xmm2 + pshufd $68, %xmm1, %xmm0 + pshufd $68, %xmm1, %xmm1 + movapd 2064(%ebx), %xmm4 + mulpd %xmm0, %xmm2 + mulpd %xmm1, %xmm1 + pshufd $68, %xmm0, %xmm7 + addpd %xmm4, %xmm2 + movapd 2080(%ebx), %xmm6 + mulsd %xmm1, %xmm7 + mulpd %xmm0, %xmm2 + mulsd %xmm7, %xmm1 + addpd %xmm6, %xmm2 + mulpd %xmm1, %xmm2 + pshufd $238, %xmm2, %xmm3 + addsd %xmm3, %xmm2 + addsd %xmm2, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_10.0.3: + movl $1042983595, %eax + movd %eax, %xmm2 + movss %xmm0, %xmm1 + movl $1056964608, %edx + movd %edx, %xmm3 + mulss %xmm0, %xmm2 + mulss %xmm1, %xmm1 + addss %xmm3, %xmm2 + mulss %xmm1, %xmm2 + addss %xmm2, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_9.0.3: + cmpl $8388608, %ecx + jb .L_2TAG_PACKET_11.0.3 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_11.0.3: + cmpl $0, %ecx + je .L_2TAG_PACKET_1.0.3 + movl $8388608, %eax + movd %eax, %xmm2 + mulss %xmm2, %xmm2 + movl $44, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $2139095040, %ecx + ja .L_2TAG_PACKET_6.0.3 + movl $-1082130432, %edx + movd %edx, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_1.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type expm1f,@function + .size expm1f,.-expm1f + .data +# -- End expm1f + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 4200250559 + .long 1072696090 + .long 2851812149 + .long 1072698941 + .long 339411585 + .long 1072701800 + .long 1048019041 + .long 1072704666 + .long 772914124 + .long 1072707540 + .long 3899555717 + .long 1072710421 + .long 1928746161 + .long 1072713311 + .long 3541402996 + .long 1072716208 + .long 238821257 + .long 1072719114 + .long 702412510 + .long 1072722027 + .long 728934454 + .long 1072724948 + .long 410360776 + .long 1072727877 + .long 4133881824 + .long 1072730813 + .long 3402036099 + .long 1072733758 + .long 2602514713 + .long 1072736711 + .long 1828292879 + .long 1072739672 + .long 1172597893 + .long 1072742641 + .long 728909815 + .long 1072745618 + .long 590962156 + .long 1072748603 + .long 852742562 + .long 1072751596 + .long 1608493509 + .long 1072754597 + .long 2952712987 + .long 1072757606 + .long 685187902 + .long 1072760624 + .long 3490863953 + .long 1072763649 + .long 2875075254 + .long 1072766683 + .long 3228316108 + .long 1072769725 + .long 351405227 + .long 1072772776 + .long 2930322912 + .long 1072775834 + .long 2471440686 + .long 1072778901 + .long 3366293073 + .long 1072781976 + .long 1416741826 + .long 1072785060 + .long 1014845819 + .long 1072788152 + .long 2257959872 + .long 1072791252 + .long 948735466 + .long 1072794361 + .long 1480023343 + .long 1072797478 + .long 3949972341 + .long 1072800603 + .long 4162030108 + .long 1072803737 + .long 2214878420 + .long 1072806880 + .long 2502433899 + .long 1072810031 + .long 828946858 + .long 1072813191 + .long 1588871207 + .long 1072816359 + .long 586995997 + .long 1072819536 + .long 2218315341 + .long 1072822721 + .long 2288159958 + .long 1072825915 + .long 897099801 + .long 1072829118 + .long 2440944790 + .long 1072832329 + .long 2725843665 + .long 1072835549 + .long 1853186616 + .long 1072838778 + .long 4219606026 + .long 1072842015 + .long 1337108031 + .long 1072845262 + .long 1897844341 + .long 1072848517 + .long 1709341917 + .long 1072851781 + .long 874372905 + .long 1072855054 + .long 3790955393 + .long 1072858335 + .long 1972484976 + .long 1072861626 + .long 4112506593 + .long 1072864925 + .long 1724976915 + .long 1072868234 + .long 3504003472 + .long 1072871551 + .long 964107055 + .long 1072874878 + .long 2799960843 + .long 1072878213 + .long 526652809 + .long 1072881558 + .long 2839424854 + .long 1072884911 + .long 1253935211 + .long 1072888274 + .long 171030293 + .long 1072891646 + .long 3991843581 + .long 1072895026 + .long 4232894513 + .long 1072898416 + .long 1000925746 + .long 1072901816 + .long 2992903935 + .long 1072905224 + .long 1726216749 + .long 1072908642 + .long 1603444721 + .long 1072912069 + .long 2732492859 + .long 1072915505 + .long 926591435 + .long 1072918951 + .long 589198666 + .long 1072922406 + .long 1829099622 + .long 1072925870 + .long 460407023 + .long 1072929344 + .long 887463927 + .long 1072932827 + .long 3219942644 + .long 1072936319 + .long 3272845541 + .long 1072939821 + .long 1156440435 + .long 1072943333 + .long 1276261410 + .long 1072946854 + .long 3743175029 + .long 1072950384 + .long 78413852 + .long 1072953925 + .long 3278348324 + .long 1072957474 + .long 569847338 + .long 1072961034 + .long 654919306 + .long 1072964603 + .long 3645941911 + .long 1072968181 + .long 1065662932 + .long 1072971770 + .long 1617004845 + .long 1072975368 + .long 1118294578 + .long 1072978976 + .long 3978100823 + .long 1072982593 + .long 1720398391 + .long 1072986221 + .long 3049340112 + .long 1072989858 + .long 3784486610 + .long 1072993505 + .long 4040676318 + .long 1072997162 + .long 3933059031 + .long 1073000829 + .long 3577096743 + .long 1073004506 + .long 3088564500 + .long 1073008193 + .long 2583551245 + .long 1073011890 + .long 2178460671 + .long 1073015597 + .long 1990012071 + .long 1073019314 + .long 2135241198 + .long 1073023041 + .long 2731501122 + .long 1073026778 + .long 3896463087 + .long 1073030525 + .long 1453150082 + .long 1073034283 + .long 4109806887 + .long 1073038050 + .long 3395129871 + .long 1073041828 + .long 3723038930 + .long 1073045616 + .long 917841882 + .long 1073049415 + .long 3689071823 + .long 1073053223 + .long 3566716925 + .long 1073057042 + .long 671025100 + .long 1073060872 + .long 3712504873 + .long 1073064711 + .long 4222122499 + .long 1073068561 + .long 2321106615 + .long 1073072422 + .long 2425981843 + .long 1073076293 + .long 363667784 + .long 1073080175 + .long 551349105 + .long 1073084067 + .long 3111574537 + .long 1073087969 + .long 3872257780 + .long 1073091882 + .long 2956612997 + .long 1073095806 + .long 488188413 + .long 1073099741 + .long 885834528 + .long 1073103686 + .long 4273770423 + .long 1073107641 + .long 2186617381 + .long 1073111608 + .long 3339203574 + .long 1073115585 + .long 3561793907 + .long 1073119573 + .long 2979960120 + .long 1073123572 + .long 1719614413 + .long 1073127582 + .long 4201977662 + .long 1073131602 + .long 1963711167 + .long 1073135634 + .long 3721688645 + .long 1073139676 + .long 1013258799 + .long 1073143730 + .long 2555984613 + .long 1073147794 + .long 4182873220 + .long 1073151869 + .long 1727278727 + .long 1073155956 + .long 3907805044 + .long 1073160053 + .long 2263535754 + .long 1073164162 + .long 1218806132 + .long 1073168282 + .long 903334909 + .long 1073172413 + .long 1447192521 + .long 1073176555 + .long 2980802057 + .long 1073180708 + .long 1339972927 + .long 1073184873 + .long 950803702 + .long 1073189049 + .long 1944781191 + .long 1073193236 + .long 158781403 + .long 1073197435 + .long 19972402 + .long 1073201645 + .long 1660913392 + .long 1073205866 + .long 919555682 + .long 1073210099 + .long 2224145553 + .long 1073214343 + .long 1413356050 + .long 1073218599 + .long 2916157145 + .long 1073222866 + .long 2571947539 + .long 1073227145 + .long 515457527 + .long 1073231436 + .long 1176749997 + .long 1073235738 + .long 396319521 + .long 1073240052 + .long 2604962541 + .long 1073244377 + .long 3643909174 + .long 1073248714 + .long 3649726105 + .long 1073253063 + .long 2759350287 + .long 1073257424 + .long 1110089947 + .long 1073261797 + .long 3134592888 + .long 1073266181 + .long 380978316 + .long 1073270578 + .long 1577608921 + .long 1073274986 + .long 2568320822 + .long 1073279406 + .long 3492293770 + .long 1073283838 + .long 194117574 + .long 1073288283 + .long 1403662306 + .long 1073292739 + .long 2966275557 + .long 1073297207 + .long 727685349 + .long 1073301688 + .long 3418903055 + .long 1073306180 + .long 2591453363 + .long 1073310685 + .long 2682146384 + .long 1073315202 + .long 3833209506 + .long 1073319731 + .long 1892288442 + .long 1073324273 + .long 1297350157 + .long 1073328827 + .long 2191782032 + .long 1073333393 + .long 424392917 + .long 1073337972 + .long 434316067 + .long 1073342563 + .long 2366108318 + .long 1073347166 + .long 2069751141 + .long 1073351782 + .long 3985553595 + .long 1073356410 + .long 3964284211 + .long 1073361051 + .long 2152073944 + .long 1073365705 + .long 2990417245 + .long 1073370371 + .long 2331271250 + .long 1073375050 + .long 321958744 + .long 1073379742 + .long 1405169241 + .long 1073384446 + .long 1434058175 + .long 1073389163 + .long 557149882 + .long 1073393893 + .long 3218338682 + .long 1073398635 + .long 977020788 + .long 1073403391 + .long 2572866477 + .long 1073408159 + .long 3861050111 + .long 1073412940 + .long 697153126 + .long 1073417735 + .long 1822067026 + .long 1073422542 + .long 3092190715 + .long 1073427362 + .long 364333489 + .long 1073432196 + .long 2380618042 + .long 1073437042 + .long 703710506 + .long 1073441902 + .long 4076559943 + .long 1073446774 + .long 4062661092 + .long 1073451660 + .long 815859274 + .long 1073456560 + .long 3080351519 + .long 1073461472 + .long 2420883922 + .long 1073466398 + .long 3287523847 + .long 1073471337 + .long 1540824585 + .long 1073476290 + .long 1631695677 + .long 1073481256 + .long 3716502172 + .long 1073486235 + .long 3657065772 + .long 1073491228 + .long 1610600570 + .long 1073496235 + .long 2029714210 + .long 1073501255 + .long 777507147 + .long 1073506289 + .long 2307442995 + .long 1073511336 + .long 2483480501 + .long 1073516397 + .long 1464976603 + .long 1073521472 + .long 3706687593 + .long 1073526560 + .long 778901109 + .long 1073531663 + .long 1432208378 + .long 1073536779 + .long 1532734324 + .long 1073541909 + .long 1242007932 + .long 1073547053 + .long 721996136 + .long 1073552211 + .long 135105010 + .long 1073557383 + .long 3939148246 + .long 1073562568 + .long 3707479175 + .long 1073567768 + .long 3898795731 + .long 1073572982 + .long 382305176 + .long 1073578211 + .long 1912561781 + .long 1073583453 + .long 64696965 + .long 1073588710 + .long 3594158869 + .long 1073593980 + .long 4076975200 + .long 1073599265 + .long 1679558232 + .long 1073604565 + .long 863738719 + .long 1073609879 + .long 1796832535 + .long 1073615207 + .long 351641897 + .long 1073620550 + .long 991358482 + .long 1073625907 + .long 3884662774 + .long 1073631278 + .long 610758006 + .long 1073636665 + .long 4224142467 + .long 1073642065 + .long 2009970496 + .long 1073647481 + .long 2728693978 + .long 1073652911 + .long 2256325230 + .long 1073658356 + .long 764307441 + .long 1073663816 + .long 2719515920 + .long 1073669290 + .long 3999357479 + .long 1073674779 + .long 481706282 + .long 1073680284 + .long 929806999 + .long 1073685803 + .long 1222472308 + .long 1073691337 + .long 1533953344 + .long 1073696886 + .long 2038973688 + .long 1073702450 + .long 2912730644 + .long 1073708029 + .long 35929225 + .long 1073713624 + .long 2174652632 + .long 1073719233 + .long 915592468 + .long 1073724858 + .long 730821105 + .long 1073730498 + .long 1797923801 + .long 1073736153 + .long 436314138 + .long 1059717536 + .long 1431655765 + .long 1067799893 + .long 872628277 + .long 1062650688 + .long 1431655765 + .long 1069897045 + .long 286331153 + .long 1065423121 + .long 0 + .long 1071644672 + .long 4286760334 + .long 1053736893 + .long 4277826245 + .long 1063661122 + .long 1697350398 + .long 1081546055 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,2136 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/expm1l.S b/external/sgx_libm/ia32/expm1l.S new file mode 100644 index 0000000000..f10c63d328 --- /dev/null +++ b/external/sgx_libm/ia32/expm1l.S @@ -0,0 +1,1235 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expm1l.c" + .text +..TXTST0: +# -- Begin expm1l + .text + .align 16,0x90 + .globl expm1l +expm1l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp +..B1.2: + fnstcw 58(%esp) +..B1.3: + movzwl 16(%ebp), %ebx + andl $32767, %ebx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $16389, %ebx + jge ..B1.55 +..B1.4: + movzwl 58(%esp), %eax + cmpl $16381, %ebx + jge ..B1.45 +..B1.5: + cmpl $16370, %ebx + jge ..B1.38 +..B1.6: + cmpl $16359, %ebx + jge ..B1.31 +..B1.7: + cmpl $16345, %ebx + jge ..B1.24 +..B1.8: + cmpl $16308, %ebx + jge ..B1.18 +..B1.9: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.88 +..B1.10: + orl $-64768, %eax + movw %ax, 56(%esp) +..B1.11: + fldcw 56(%esp) +..B1.12: + movzwl 16(%ebp), %ebx + movl $1, %edx + andl $32767, %ebx +..B1.13: + testl %ebx, %ebx + jle ..B1.84 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ecx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmul %st(1), %st + fxch %st(1) + fmull ones@GOTOFF(%ecx,%eax,8) + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ecx) + fstpt 16(%esp) +..B1.15: + testl %edx, %edx + je ..B1.17 +..B1.16: + fldcw 58(%esp) +..B1.17: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.89 +..B1.19: + orl $-64768, %eax + movw %ax, 56(%esp) +..B1.20: + fldcw 56(%esp) +..B1.21: + fldt 8(%ebp) + fldt _Q3@GOTOFF(%ecx) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) +..B1.22: + fldcw 58(%esp) +..B1.23: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.24: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.90 +..B1.25: + orl $-64768, %eax + movw %ax, 56(%esp) +..B1.26: + fldcw 56(%esp) +..B1.27: + movl $1, %eax +..B1.28: + fldt 8(%ebp) + testl %eax, %eax + fldt 12+_Q2@GOTOFF(%ecx) + fmul %st(1), %st + fmul %st(1), %st + fldt _Q2@GOTOFF(%ecx) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.30 +..B1.29: + fldcw 58(%esp) +..B1.30: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.91 +..B1.32: + orl $-64768, %eax + movw %ax, 56(%esp) +..B1.33: + fldcw 56(%esp) +..B1.34: + movl $1, %eax +..B1.35: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%ecx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%ecx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.37 +..B1.36: + fldcw 58(%esp) +..B1.37: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.92 +..B1.39: + orl $-64768, %eax + movw %ax, 56(%esp) +..B1.40: + fldcw 56(%esp) +..B1.41: + movl $1, %eax +..B1.42: + fldl _TWO_54H@GOTOFF(%ecx) + testl %eax, %eax + fld %st(0) + fldt 8(%ebp) + fld %st(0) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fsubp %st, %st(3) + fsub %st(2), %st + fld %st(1) + fmul %st(2), %st + fldt 156+_Q@GOTOFF(%ecx) + fmul %st(1), %st + fldt 144+_Q@GOTOFF(%ecx) + fmul %st(2), %st + fldt 132+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_Q@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(4) + fmul %st(3), %st + fld %st(4) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(5) + fldt _Q@GOTOFF(%ecx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(3) + fld %st(5) + fmul %st(6), %st + fmul %st, %st(2) + fld %st(4) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(2) + fldt 192+_Q@GOTOFF(%ecx) + fmul %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fld %st(3) + fldt 180+_Q@GOTOFF(%ecx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(2) + fldt 168+_Q@GOTOFF(%ecx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fmulp %st, %st(2) + fldt 8(%ebp) + fld %st(0) + fadd %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fsubr %st, %st(1) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%esp) + je ..B1.44 +..B1.43: + fldt 16(%esp) + fstpt 44(%esp) +..B1.103: + fldcw 58(%esp) +..B1.44: + fldt 32(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.93 +..B1.46: + orl $-64768, %eax + movw %ax, 56(%esp) +..B1.47: + fldcw 56(%esp) +..B1.48: + movl $1, %eax +..B1.49: + fldl _TWO_63H@GOTOFF(%ecx) + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + fadd %st(2), %st + fstpt 44(%esp) + fldt 44(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmul %st(2), %st + movl 44(%esp), %edx + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmulp %st, %st(2) + fld %st(0) + movsbl %dl, %ebx + fsub %st(2), %st + fldl _TWO_32H@GOTOFF(%ecx) + subl %ebx, %edx + shll $4, %ebx + fadd %st, %st(1) + shrl $8, %edx + fsubr %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + shll $23, %edx + fxch %st(4) + fsubrp %st, %st(3) + addl $1065353216, %edx + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%ecx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ecx) + movl %edx, 12(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmul %st(2), %st + fldt 12+_P@GOTOFF(%ecx) + movzbl 17(%ebp), %edx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + andl $128, %edx + fmulp %st, %st(3) + shrl $7, %edx + faddp %st, %st(2) + fldt _P@GOTOFF(%ecx) + testl %edx, %edx + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%ecx,%ebx) + fldl 2048+__libm_expl_table_256@GOTOFF(%ecx,%ebx) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(4) + fmul %st, %st(4) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + flds 12(%esp) + fmul %st, %st(3) + fmulp %st, %st(2) + je ..B1.51 +..B1.50: + fldt .L_2il0floatpacket.4@GOTOFF(%ecx) + fadd %st(3), %st + fstpt 16(%esp) + fldt 16(%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + faddp %st, %st(1) + fsubp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + jmp ..B1.52 +..B1.51: + movzwl 16(%ebp), %esi + shll $15, %edx + andl $32767, %esi + orl %esi, %edx + shll $16, %edx + movzwl 14(%ebp), %edi + orl %edi, %edx + cmpl $1074049228, %edx + movl $0, %edx + setb %dl + fldl zero_one@GOTOFF(%ecx,%edx,8) + xorl $1, %edx + fsubrp %st, %st(3) + fxch %st(2) + fstpt 16(%esp) + fsubl zero_one@GOTOFF(%ecx,%edx,8) +..B1.52: + fldt 16(%esp) + testl %eax, %eax + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.107 +..B1.53: + fstpt 44(%esp) +..B1.104: + fldcw 58(%esp) + jmp ..B1.54 +..B1.107: + fstp %st(0) +..B1.54: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.55: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %eax + movzwl 8+_ranges@GOTOFF(%eax,%ecx), %esi + andl $32767, %esi + cmpl %esi, %ebx + jl ..B1.60 +..B1.56: + jne ..B1.74 +..B1.57: + movl 12(%ebp), %esi + cmpl 4+_ranges@GOTOFF(%eax,%ecx), %esi + jb ..B1.60 +..B1.58: + jne ..B1.74 +..B1.59: + movl 8(%ebp), %esi + cmpl _ranges@GOTOFF(%eax,%ecx), %esi + jae ..B1.74 +..B1.60: + movzwl 58(%esp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.94 +..B1.61: + orl $-64768, %esi + movw %si, 56(%esp) +..B1.62: + fldcw 56(%esp) +..B1.63: + movzwl 16(%ebp), %ebx + movl $1, %edi + andl $32767, %ebx +..B1.64: + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + cmpl $16396, %ebx + movzwl 8+.L_2il0floatpacket.3@GOTOFF(%ecx), %esi + movl %esi, 40(%esp) + fstpt 28(%esp) + fldt 28(%esp) + fldl _TWO_63H@GOTOFF(%ecx) + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + fadd %st(2), %st + fstpt 44(%esp) + fldt 44(%esp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmul %st(2), %st + movl 44(%esp), %eax + fsubrp %st, %st(1) + fld %st(0) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmulp %st, %st(3) + fsub %st(2), %st + fldl _TWO_32H@GOTOFF(%ecx) + movsbl %al, %esi + fadd %st, %st(1) + fsubr %st(1), %st + fsubr %st, %st(2) + fxch %st(3) + fsubrp %st, %st(2) + jge ..B1.71 +..B1.65: + fldt 48+_P@GOTOFF(%ecx) + fxch %st(1) + fstpt 16(%esp) + fld %st(2) + fadd %st(2), %st + fld %st(0) + subl %esi, %eax + fmul %st(1), %st + fmul %st, %st(2) + fldt 36+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ecx) + shll $4, %esi + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fmul %st, %st(3) + fldt 12+_P@GOTOFF(%ecx) + shrl $8, %eax + faddp %st, %st(2) + fmul %st, %st(1) + addl $16383, %eax + fxch %st(2) + fmulp %st, %st(1) + andl $32767, %eax + movl %edi, 12(%esp) + faddp %st, %st(2) + fldt _P@GOTOFF(%ecx) + fmulp %st, %st(1) + movl 40(%esp), %edi + faddp %st, %st(1) + andl $-32768, %edi + faddp %st, %st(1) + fldl 2048+__libm_expl_table_256@GOTOFF(%ecx,%esi) + orl %eax, %edi + fld %st(0) + testl %edx, %edx + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fld %st(0) + movw %di, 36(%esp) + fadd %st(4), %st + movl 12(%esp), %edi + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fldt 28(%esp) + fmul %st, %st(4) + fxch %st(2) + fmull 2056+__libm_expl_table_256@GOTOFF(%ecx,%esi) + faddp %st, %st(3) + faddl 2056+__libm_expl_table_256@GOTOFF(%ecx,%esi) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt 16(%esp) + je ..B1.67 +..B1.66: + fldt .L_2il0floatpacket.4@GOTOFF(%ecx) + fadd %st(3), %st + fstpt 16(%esp) + fldt 16(%esp) + faddp %st, %st(4) + fxch %st(2) + fsubrp %st, %st(3) + fsubp %st, %st(2) + fxch %st(1) + jmp ..B1.68 +..B1.67: + fstp %st(3) + movzbl 17(%ebp), %eax + xorl %edx, %edx + shrl $7, %eax + shll $15, %eax + orl %ebx, %eax + shll $16, %eax + movzwl 14(%ebp), %esi + orl %esi, %eax + cmpl $1074049228, %eax + setb %dl + fldl zero_one@GOTOFF(%ecx,%edx,8) + xorl $1, %edx + fsubrp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fsubl zero_one@GOTOFF(%ecx,%edx,8) +..B1.68: + fldt 16(%esp) + testl %edi, %edi + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.108 +..B1.69: + fstpt 44(%esp) +..B1.105: + fldcw 58(%esp) + jmp ..B1.70 +..B1.108: + fstp %st(0) +..B1.70: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.71: + fstp %st(3) + fldt 48+_P@GOTOFF(%ecx) + fld %st(2) + fadd %st(2), %st + fld %st(0) + subl %esi, %eax + fmul %st(1), %st + fmul %st, %st(2) + fldt 36+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ecx) + shll $4, %esi + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fmul %st, %st(3) + fldt 12+_P@GOTOFF(%ecx) + shrl $8, %eax + faddp %st, %st(2) + fmul %st, %st(1) + addl $8191, %eax + fxch %st(2) + fmulp %st, %st(1) + andl $32767, %eax + movzwl 36(%esp), %edx + faddp %st, %st(2) + fldt _P@GOTOFF(%ecx) + andl $-32768, %edx + fmulp %st, %st(1) + orl %eax, %edx + movw %dx, 36(%esp) + testl %edi, %edi + faddp %st, %st(1) + faddp %st, %st(1) + fldl 2056+__libm_expl_table_256@GOTOFF(%ecx,%esi) + fldl 2048+__libm_expl_table_256@GOTOFF(%ecx,%esi) + fld %st(0) + fmul %st(3), %st + fxch %st(3) + fadd %st(4), %st + fmul %st(2), %st + faddp %st, %st(3) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 28(%esp) + fmulp %st, %st(1) + fldt _SC2@GOTOFF(%ecx) + fmulp %st, %st(1) + fstpt 16(%esp) + je ..B1.109 +..B1.72: + fstpt 44(%esp) +..B1.106: + fldcw 58(%esp) + jmp ..B1.73 +..B1.109: + fstp %st(0) +..B1.73: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.74: + movzwl 58(%esp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.100 +..B1.75: + orl $-64768, %esi + movw %si, 56(%esp) +..B1.76: + fldcw 56(%esp) +..B1.77: + movzwl 16(%ebp), %ebx + movl $1, %eax + andl $32767, %ebx +..B1.78: + cmpl $32767, %ebx + je ..B1.96 +..B1.79: + testl %edx, %edx + je ..B1.95 +..B1.80: + fldt .L_2il0floatpacket.4@GOTOFF(%ecx) + fldt _small_value_80@GOTOFF(%ecx) + faddp %st, %st(1) + fstpt 16(%esp) +..B1.81: + testl %eax, %eax + je ..B1.83 +..B1.82: + fldcw 58(%esp) +..B1.83: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.84: + cmpl $0, 12(%ebp) + jne ..B1.86 +..B1.85: + cmpl $0, 8(%ebp) + je ..B1.87 +..B1.86: + fldt _small_value_80@GOTOFF(%ecx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmul %st(0), %st + fstpt (%esp) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(1) + fmull ones@GOTOFF(%ecx,%eax,8) + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ecx) + fstpt 16(%esp) + jmp ..B1.15 +..B1.87: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.15 +..B1.88: + xorl %edx, %edx + jmp ..B1.13 +..B1.89: + fldt 8(%ebp) + fldt _Q3@GOTOFF(%ecx) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.23 +..B1.90: + xorl %eax, %eax + jmp ..B1.28 +..B1.91: + xorl %eax, %eax + jmp ..B1.35 +..B1.92: + xorl %eax, %eax + jmp ..B1.42 +..B1.93: + xorl %eax, %eax + jmp ..B1.49 +..B1.94: + xorl %edi, %edi + jmp ..B1.64 +..B1.95: + fldt _large_value_80@GOTOFF(%ecx) + fmul %st(0), %st + fstpt 16(%esp) + jmp ..B1.81 +..B1.96: + cmpl $-2147483648, 12(%ebp) + jne ..B1.99 +..B1.97: + cmpl $0, 8(%ebp) + jne ..B1.99 +..B1.98: + fldl _inf_none@GOTOFF(%ecx,%edx,8) + fstpt 16(%esp) + jmp ..B1.81 +..B1.99: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.81 +..B1.100: + xorl %eax, %eax + jmp ..B1.78 + .align 16,0x90 + .type expm1l,@function + .size expm1l,.-expm1l + .data +# -- End expm1l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +zero_one: + .long 0x00000000,0x00000000 + .long 0x00000000,0x3ff00000 + .type zero_one,@object + .size zero_one,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_54H: + .long 0 + .long 1129840640 + .type _TWO_54H,@object + .size _TWO_54H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_inf_none: + .long 0 + .long 2146435072 + .long 0 + .long 3220176896 + .type _inf_none,@object + .size _inf_none,16 + .align 2 +_Q3: + .word 1 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 2731 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 46967 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 65530 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 43687 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 52365 + .word 52428 + .word 43692 + .word 43690 + .word 16378 + .word 0 + .word 56491 + .word 10318 + .word 34954 + .word 34952 + .word 16376 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 39683 + .word 36691 + .word 42743 + .word 55145 + .word 16297 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16370 + .word 0 + .word 43680 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 46686 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 53372 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 5395 + .word 3321 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 7401 + .word 46642 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 52768 + .word 7506 + .word 32188 + .word 37874 + .word 16361 + .word 0 + .word 23003 + .word 12485 + .word 11072 + .word 55090 + .word 16357 + .word 0 + .word 3702 + .word 18929 + .word 50035 + .word 36726 + .word 16354 + .word 0 + .word 2630 + .word 23096 + .word 11140 + .word 45202 + .word 16350 + .word 0 + .word 46660 + .word 62794 + .word 49270 + .word 51706 + .word 16346 + .word 0 + .word 61237 + .word 7998 + .word 19059 + .word 55154 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43648 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43648 + .word 16378 + .word 0 + .type _Q,@object + .size _Q,204 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_ranges: + .word 31148 + .word 53711 + .word 6135 + .word 45426 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16389 + .word 0 + .type _ranges,@object + .size _ranges,24 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .type _SC2,@object + .size _SC2,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fabs.S b/external/sgx_libm/ia32/fabs.S new file mode 100644 index 0000000000..93c7d46fa0 --- /dev/null +++ b/external/sgx_libm/ia32/fabs.S @@ -0,0 +1,61 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fabs.c" + .text +..TXTST0: +# -- Begin fabs + .text + .align 16,0x90 + .globl fabs +fabs: +# parameter 1: 4 + %esp +..B1.1: +..L1: + +..B1.2: + fldl 4(%esp) + fabs + ret +..B1.3: + .align 16,0x90 + .type fabs,@function + .size fabs,.-fabs + .data +# -- End fabs + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fabsf.S b/external/sgx_libm/ia32/fabsf.S new file mode 100644 index 0000000000..7cb3dfc071 --- /dev/null +++ b/external/sgx_libm/ia32/fabsf.S @@ -0,0 +1,61 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fabsf.c" + .text +..TXTST0: +# -- Begin fabsf + .text + .align 16,0x90 + .globl fabsf +fabsf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + +..B1.2: + flds 4(%esp) + fabs + ret +..B1.3: + .align 16,0x90 + .type fabsf,@function + .size fabsf,.-fabsf + .data +# -- End fabsf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fabsl.S b/external/sgx_libm/ia32/fabsl.S new file mode 100644 index 0000000000..38a16d68ec --- /dev/null +++ b/external/sgx_libm/ia32/fabsl.S @@ -0,0 +1,121 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fabsl.c" + .text +..TXTST0: +# -- Begin fabsl + .text + .align 16,0x90 + .globl fabsl +fabsl: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + subl $28, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.15 +..B1.4: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.5: + fldcw 12(%esp) +..B1.6: + movl $1, %eax +..B1.7: + movzwl 40(%esp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.12 +..B1.8: + fldt 32(%esp) + movzbl 41(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + fmull ones@GOTOFF(%edx,%ecx,8) + fstpt (%esp) +..B1.9: + testl %eax, %eax + je ..B1.11 +..B1.10: + fldcw 14(%esp) +..B1.11: + fldt (%esp) + addl $28, %esp + ret +..B1.12: + cmpl $-2147483648, 36(%esp) + jne ..B1.14 +..B1.13: + cmpl $0, 32(%esp) + je ..B1.8 +..B1.14: + fldt 32(%esp) + movzbl 41(%esp), %edx + fstpt (%esp) + andl $127, %edx + movb %dl, 9(%esp) + jmp ..B1.9 +..B1.15: + xorl %eax, %eax + jmp ..B1.7 + .align 16,0x90 + .type fabsl,@function + .size fabsl,.-fabsl + .data +# -- End fabsl + .section .rodata, "a" + .align 8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fdim_wmt.S b/external/sgx_libm/ia32/fdim_wmt.S new file mode 100644 index 0000000000..92c666fe59 --- /dev/null +++ b/external/sgx_libm/ia32/fdim_wmt.S @@ -0,0 +1,181 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fdim_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fdim + .text + .align 16,0x90 + .globl fdim +fdim: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + stmxcsr 8(%esp) + movsd 112(%esp), %xmm0 + movsd 120(%esp), %xmm1 + movapd %xmm0, %xmm2 + ucomisd %xmm0, %xmm1 + movl 8(%esp), %eax + jp .L_2TAG_PACKET_0.0.3 + testl $8, %eax + cmpnlesd %xmm1, %xmm0 + andpd %xmm0, %xmm1 + andpd %xmm2, %xmm0 + jne .L_2TAG_PACKET_1.0.3 + subsd %xmm1, %xmm0 + andpd (%ebx), %xmm0 + pextrw $3, %xmm0, %eax + cmpl $32751, %eax + jb .L_2TAG_PACKET_2.0.3 + stmxcsr 12(%esp) + movl 12(%esp), %eax + testl $8, %eax + jne .L_2TAG_PACKET_3.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + andl $-9, %eax + movl %eax, 12(%esp) + ldmxcsr 12(%esp) + cmpnlesd %xmm1, %xmm0 + andpd %xmm0, %xmm1 + andpd %xmm2, %xmm0 + subsd %xmm1, %xmm0 + andpd (%ebx), %xmm0 + stmxcsr 12(%esp) + movl 12(%esp), %eax + testl $8, %eax + jne .L_2TAG_PACKET_3.0.3 + ldmxcsr 8(%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + fldl 112(%esp) + fldl 120(%esp) + faddp %st, %st(1) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_3.0.3: + movl $196, %edx +.L_2TAG_PACKET_5.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + movsd 120(%esp), %xmm1 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 120(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 32(%esp) + fldl 32(%esp) +.L_2TAG_PACKET_4.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fdim,@function + .size fdim,.-fdim + .data +# -- End fdim + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fdimf_wmt.S b/external/sgx_libm/ia32/fdimf_wmt.S new file mode 100644 index 0000000000..b2ac1a5c69 --- /dev/null +++ b/external/sgx_libm/ia32/fdimf_wmt.S @@ -0,0 +1,181 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fdimf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fdimf + .text + .align 16,0x90 + .globl fdimf +fdimf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + stmxcsr 8(%esp) + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + movss %xmm0, %xmm2 + ucomiss %xmm0, %xmm1 + movl 8(%esp), %eax + jp .L_2TAG_PACKET_0.0.3 + testl $8, %eax + cmpnless %xmm1, %xmm0 + andps %xmm0, %xmm1 + andps %xmm2, %xmm0 + jne .L_2TAG_PACKET_1.0.3 + subss %xmm1, %xmm0 + andps (%ebx), %xmm0 + movd %xmm0, %eax + cmpl $2139095039, %eax + jb .L_2TAG_PACKET_2.0.3 + stmxcsr 12(%esp) + movl 12(%esp), %eax + testl $8, %eax + jne .L_2TAG_PACKET_3.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + andl $-9, %eax + movl %eax, 12(%esp) + ldmxcsr 12(%esp) + cmpnless %xmm1, %xmm0 + andps %xmm0, %xmm1 + andps %xmm2, %xmm0 + subss %xmm1, %xmm0 + andps (%ebx), %xmm0 + stmxcsr 12(%esp) + movl 12(%esp), %eax + testl $8, %eax + jne .L_2TAG_PACKET_3.0.3 + ldmxcsr 8(%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + flds 112(%esp) + flds 116(%esp) + faddp %st, %st(1) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_3.0.3: + movl $196, %edx +.L_2TAG_PACKET_5.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 116(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_2.0.3: + movss %xmm0, 32(%esp) + flds 32(%esp) +.L_2TAG_PACKET_4.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fdimf,@function + .size fdimf,.-fdimf + .data +# -- End fdimf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 2147483647 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fdiml.S b/external/sgx_libm/ia32/fdiml.S new file mode 100644 index 0000000000..2170a2c478 --- /dev/null +++ b/external/sgx_libm/ia32/fdiml.S @@ -0,0 +1,292 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fdiml.c" + .text +..TXTST0: +# -- Begin fdiml + .text + .align 16,0x90 + .globl fdiml +fdiml: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $24, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + movzwl 28(%ebp), %edx + andl $32767, %edx + cmpl $32767, %ecx + je ..B1.39 +..B1.4: + cmpl $32767, %edx + je ..B1.30 +..B1.5: + movzwl 14(%esp), %ebx + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.6: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %edi +..B1.9: + fldt 20(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fldl _zeros@GOTOFF(%ebx) + fstpt (%esp) + fldt 8(%ebp) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.43 +..B1.10: + cmpl $32767, %ecx + je ..B1.14 +..B1.11: + cmpl $32767, %edx + je ..B1.14 +..B1.12: + cmpl $32766, %ecx + je ..B1.26 +..B1.13: + cmpl $32766, %edx + je ..B1.18 +..B1.14: + fsubp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.43: + fstp %st(0) + fstp %st(0) +..B1.15: + testl %edi, %edi + je ..B1.17 +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + testl %ecx, %ecx + jne ..B1.22 +..B1.19: + cmpl $0, 12(%ebp) + jne ..B1.21 +..B1.20: + cmpl $0, 8(%ebp) + je ..B1.22 +..B1.21: + fldt _ranges@GOTOFF(%ebx) + fxch %st(2) + fsubrp %st, %st(1) + fstpt (%esp) + fldt (%esp) + fucompp + fnstsw %ax + sahf + jne ..B1.15 + jp ..B1.15 + jmp ..B1.24 +..B1.22: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fmul %st, %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fldt 12+_ranges@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jp ..B1.23 + jbe ..B1.25 +..B1.23: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.24: + fldt _large_value_80@GOTOFF(%ebx) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.15 +..B1.25: + fstp %st(0) + fldt _large_value_80@GOTOFF(%ebx) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.15 +..B1.26: + testl %edx, %edx + jne ..B1.22 +..B1.27: + cmpl $0, 24(%ebp) + jne ..B1.21 +..B1.28: + cmpl $0, 20(%ebp) + jne ..B1.21 + jmp ..B1.22 +..B1.29: + xorl %edi, %edi + jmp ..B1.9 +..B1.30: + cmpl $-2147483648, 24(%ebp) + jne ..B1.32 +..B1.31: + cmpl $0, 20(%ebp) + je ..B1.5 +..B1.32: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.33: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.34: + fldcw 12(%esp) +..B1.35: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) +..B1.36: + fldcw 14(%esp) +..B1.37: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.37 +..B1.39: + cmpl $-2147483648, 12(%ebp) + jne ..B1.32 +..B1.40: + cmpl $0, 8(%ebp) + je ..B1.4 + jmp ..B1.32 + .align 16,0x90 + .type fdiml,@function + .size fdiml,.-fdiml + .data +# -- End fdiml + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_ranges: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .type _ranges,@object + .size _ranges,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/feclearexcept.S b/external/sgx_libm/ia32/feclearexcept.S new file mode 100644 index 0000000000..a0bf0865ef --- /dev/null +++ b/external/sgx_libm/ia32/feclearexcept.S @@ -0,0 +1,94 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feclearexcept.c" + .text +..TXTST0: +# -- Begin feclearexcept + .text + .align 16,0x90 + .globl feclearexcept +feclearexcept: +# parameter 1: 48 + %esp +..B1.1: +..L1: + + subl $44, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 32(%esp) + movl 48(%esp), %eax + andl $63, %eax + je ..B1.8 +..B1.2: + fnstenv 4(%esp) +..B1.3: + notl %eax + andw %ax, 8(%esp) +..B1.4: + fnclex +..B1.5: + fldenv 4(%esp) +..B1.6: + stmxcsr (%esp) + movl (%esp), %edx +..B1.7: + andl %eax, %edx + movl %edx, (%esp) + ldmxcsr (%esp) +..B1.8: + movl 32(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.10 +..B1.9: + xorl %eax, %eax + addl $44, %esp + ret +..B1.10: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type feclearexcept,@function + .size feclearexcept,.-feclearexcept + .data +# -- End feclearexcept + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fedisableexcept.S b/external/sgx_libm/ia32/fedisableexcept.S new file mode 100644 index 0000000000..619a544f81 --- /dev/null +++ b/external/sgx_libm/ia32/fedisableexcept.S @@ -0,0 +1,99 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fedisableexcept.c" + .text +..TXTST0: +# -- Begin fedisableexcept + .text + .align 16,0x90 + .globl fedisableexcept +fedisableexcept: +# parameter 1: 48 + %esp +..B1.1: +..L1: + + subl $44, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 36(%esp) + movl 48(%esp), %eax + andl $63, %eax +..B1.2: + fnstcw 4(%esp) +..B1.3: + testl %eax, %eax + je ..B1.10 +..B1.4: + fnstenv 6(%esp) +..B1.5: + orw %ax, 6(%esp) +..B1.6: + fnclex +..B1.7: + fldenv 6(%esp) +..B1.8: + stmxcsr (%esp) +..B1.9: + shll $7, %eax + orl (%esp), %eax + movl %eax, (%esp) + ldmxcsr (%esp) +..B1.10: + movzwl 4(%esp), %eax + movl 36(%esp), %edx + notl %eax + xorl %esp, %edx + andl $63, %eax + cmpl %gs:20, %edx + jne ..B1.12 +..B1.11: + addl $44, %esp + ret +..B1.12: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type fedisableexcept,@function + .size fedisableexcept,.-fedisableexcept + .data +# -- End fedisableexcept + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/feenableexcept.S b/external/sgx_libm/ia32/feenableexcept.S new file mode 100644 index 0000000000..a25752ab85 --- /dev/null +++ b/external/sgx_libm/ia32/feenableexcept.S @@ -0,0 +1,102 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feenableexcept.c" + .text +..TXTST0: +# -- Begin feenableexcept + .text + .align 16,0x90 + .globl feenableexcept +feenableexcept: +# parameter 1: 48 + %esp +..B1.1: +..L1: + + subl $44, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 36(%esp) + movl 48(%esp), %edx + andl $63, %edx +..B1.2: + fnstcw 4(%esp) +..B1.3: + testl %edx, %edx + je ..B1.10 +..B1.4: + fnstenv 6(%esp) +..B1.5: + movl %edx, %eax + notl %eax + andw %ax, 6(%esp) +..B1.6: + fnclex +..B1.7: + fldenv 6(%esp) +..B1.8: + stmxcsr (%esp) +..B1.9: + shll $7, %edx + notl %edx + andl (%esp), %edx + movl %edx, (%esp) + ldmxcsr (%esp) +..B1.10: + movzwl 4(%esp), %eax + movl 36(%esp), %edx + notl %eax + xorl %esp, %edx + andl $63, %eax + cmpl %gs:20, %edx + jne ..B1.12 +..B1.11: + addl $44, %esp + ret +..B1.12: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type feenableexcept,@function + .size feenableexcept,.-feenableexcept + .data +# -- End feenableexcept + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fegetenv.S b/external/sgx_libm/ia32/fegetenv.S new file mode 100644 index 0000000000..6479bf83c9 --- /dev/null +++ b/external/sgx_libm/ia32/fegetenv.S @@ -0,0 +1,75 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetenv.c" + .text +..TXTST0: +# -- Begin fegetenv + .text + .align 16,0x90 + .globl fegetenv +fegetenv: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp +..B1.2: + movl 16(%esp), %eax +..B1.3: + fnstenv (%eax) +..B1.4: + fnclex +..B1.5: + fldenv (%eax) +..B1.6: + stmxcsr (%esp) + movl (%esp), %eax +..B1.7: + movl 16(%esp), %edx + andl $63, %eax + orw %ax, 4(%edx) + xorl %eax, %eax + addl $12, %esp + ret + .align 16,0x90 + .type fegetenv,@function + .size fegetenv,.-fegetenv + .data +# -- End fegetenv + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fegetexcept.S b/external/sgx_libm/ia32/fegetexcept.S new file mode 100644 index 0000000000..021aab378b --- /dev/null +++ b/external/sgx_libm/ia32/fegetexcept.S @@ -0,0 +1,64 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetexcept.c" + .text +..TXTST0: +# -- Begin fegetexcept + .text + .align 16,0x90 + .globl fegetexcept +fegetexcept: +..B1.1: +..L1: + + subl $12, %esp +..B1.2: + fstcw (%esp) +..B1.3: + movzwl (%esp), %eax + notl %eax + andl $63, %eax + addl $12, %esp + ret + .align 16,0x90 + .type fegetexcept,@function + .size fegetexcept,.-fegetexcept + .data +# -- End fegetexcept + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fegetexceptflag.S b/external/sgx_libm/ia32/fegetexceptflag.S new file mode 100644 index 0000000000..14aa8d1bca --- /dev/null +++ b/external/sgx_libm/ia32/fegetexceptflag.S @@ -0,0 +1,73 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetexceptflag.c" + .text +..TXTST0: +# -- Begin fegetexceptflag + .text + .align 16,0x90 + .globl fegetexceptflag +fegetexceptflag: +# parameter 1: 16 + %esp +# parameter 2: 20 + %esp +..B1.1: +..L1: + + subl $12, %esp + movl 20(%esp), %eax + andl $63, %eax +..B1.2: + fnstsw 4(%esp) +..B1.3: + stmxcsr (%esp) +..B1.4: + movl 16(%esp), %ecx + movzwl 4(%esp), %edx + orl (%esp), %edx + andl %eax, %edx + xorl %eax, %eax + movw %dx, (%ecx) + addl $12, %esp + ret + .align 16,0x90 + .type fegetexceptflag,@function + .size fegetexceptflag,.-fegetexceptflag + .data +# -- End fegetexceptflag + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fegetround.S b/external/sgx_libm/ia32/fegetround.S new file mode 100644 index 0000000000..f636955a37 --- /dev/null +++ b/external/sgx_libm/ia32/fegetround.S @@ -0,0 +1,63 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetround.c" + .text +..TXTST0: +# -- Begin fegetround + .text + .align 16,0x90 + .globl fegetround +fegetround: +..B1.1: +..L1: + + subl $12, %esp +..B1.2: + fnstcw (%esp) +..B1.3: + movzwl (%esp), %eax + andl $3072, %eax + addl $12, %esp + ret + .align 16,0x90 + .type fegetround,@function + .size fegetround,.-fegetround + .data +# -- End fegetround + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/feholdexcept.S b/external/sgx_libm/ia32/feholdexcept.S new file mode 100644 index 0000000000..74ba663802 --- /dev/null +++ b/external/sgx_libm/ia32/feholdexcept.S @@ -0,0 +1,102 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feholdexcept.c" + .text +..TXTST0: +# -- Begin feholdexcept + .text + .align 16,0x90 + .globl feholdexcept +feholdexcept: +# parameter 1: 48 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $40, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 32(%esp) + stmxcsr (%esp) + movl (%esp), %ecx +..B1.2: + fnstenv 4(%esp) +..B1.3: + movl 48(%esp), %eax + movl %ecx, %ebx + andl $63, %ebx + andl $-64, %ecx + movzwl 8(%esp), %edx + orl %edx, %ebx + movw %bx, 4(%eax) + andl $-64, %edx + movzwl 4(%esp), %ebx + orl $8064, %ecx + movw %bx, (%eax) + orl $63, %ebx + movw %dx, 8(%esp) + movw %bx, 4(%esp) +..B1.4: + fnclex +..B1.5: + fldenv 4(%esp) +..B1.6: + movl %ecx, (%esp) + movl 32(%esp), %eax + xorl %esp, %eax + ldmxcsr (%esp) + cmpl %gs:20, %eax + jne ..B1.8 +..B1.7: + xorl %eax, %eax + addl $40, %esp + popl %ebx + ret +..B1.8: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type feholdexcept,@function + .size feholdexcept,.-feholdexcept + .data +# -- End feholdexcept + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/feraiseexcept.S b/external/sgx_libm/ia32/feraiseexcept.S new file mode 100644 index 0000000000..cb7981847a --- /dev/null +++ b/external/sgx_libm/ia32/feraiseexcept.S @@ -0,0 +1,185 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feraiseexcept.c" + .text +..TXTST0: +# -- Begin feraiseexcept + .text + .align 16,0x90 + .globl feraiseexcept +feraiseexcept: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movl 16(%esp), %eax + testb $1, %al + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + je ..B1.3 +..B1.2: + flds d_zero@GOTOFF(%edx) + fwait + flds d_zero@GOTOFF(%edx) + fwait + fdivrp %st, %st(1) + fwait + fstps (%esp) + fwait +..B1.3: + testb $4, %al + je ..B1.5 +..B1.4: + movl p_one@GOTOFF(%edx), %ecx + flds (%ecx) + fwait + movl p_zero@GOTOFF(%edx), %ecx + flds (%ecx) + fwait + fdivrp %st, %st(1) + fwait + fstps (%esp) + fwait +..B1.5: + testb $2, %al + je ..B1.7 +..B1.6: + flds d_tiny@GOTOFF(%edx) + fwait + flds d_tiny@GOTOFF(%edx) + fwait + faddp %st, %st(1) + fwait + fstps (%esp) + fwait +..B1.7: + testb $8, %al + je ..B1.9 +..B1.8: + flds d_huge@GOTOFF(%edx) + fwait + flds d_huge@GOTOFF(%edx) + fwait + fmulp %st, %st(1) + fwait + fstps (%esp) + fwait +..B1.9: + testb $16, %al + je ..B1.11 +..B1.10: + flds d_norm@GOTOFF(%edx) + fwait + flds d_norm@GOTOFF(%edx) + fwait + fmulp %st, %st(1) + fwait + fstps (%esp) + fwait +..B1.11: + testb $32, %al + je ..B1.13 +..B1.12: + movl p_one@GOTOFF(%edx), %eax + movl p_norm@GOTOFF(%edx), %edx + flds (%eax) + fwait + flds (%edx) + fwait + faddp %st, %st(1) + fwait + fstps (%esp) + fwait +..B1.13: + xorl %eax, %eax + addl $12, %esp + ret + .align 16,0x90 + .type feraiseexcept,@function + .size feraiseexcept,.-feraiseexcept + .data +# -- End feraiseexcept + .section .rodata, "a" + .align 4 + .align 4 +d_zero: + .long 0 + .type d_zero,@object + .size d_zero,4 + .align 4 +d_one: + .long 1065353216 + .type d_one,@object + .size d_one,4 + .align 4 +d_tiny: + .long 8388607 + .type d_tiny,@object + .size d_tiny,4 + .align 4 +d_huge: + .long 2139095039 + .type d_huge,@object + .size d_huge,4 + .align 4 +d_norm: + .long 8388608 + .type d_norm,@object + .size d_norm,4 + .section .data.rel.ro.local, "aw",@progbits + .align 4 + .align 4 +p_one: + .long d_one + .type p_one,@object + .size p_one,4 + .align 4 +p_zero: + .long d_zero + .type p_zero,@object + .size p_zero,4 + .align 4 +p_norm: + .long d_norm + .type p_norm,@object + .size p_norm,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fesetenv.S b/external/sgx_libm/ia32/fesetenv.S new file mode 100644 index 0000000000..44b7335baa --- /dev/null +++ b/external/sgx_libm/ia32/fesetenv.S @@ -0,0 +1,124 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fesetenv.c" + .text +..TXTST0: +# -- Begin fesetenv + .text + .align 16,0x90 + .globl fesetenv +fesetenv: +# parameter 1: 64 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + pushl %ebp + subl $48, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 32(%esp) + stmxcsr (%esp) + movl (%esp), %ecx +..B1.2: + fnstenv 4(%esp) +..B1.3: + movzwl 4(%esp), %edi + andl $-32704, %ecx + movzwl 8(%esp), %eax + andl $-3136, %edi + movl 64(%esp), %ebp + andl $-64, %eax + cmpl $-1, %ebp + je ..B1.10 +..B1.4: + movzwl (%ebp), %edx + movl %edx, %ebx + movzwl 4(%ebp), %ebp + andl $3135, %ebx + andl $63, %ebp + orl %ebx, %edi + orl %ebp, %eax + movw %ax, 8(%esp) + movl %edx, %eax + andl $63, %eax + andl $3072, %edx + shll $7, %eax + shll $3, %edx + orl %eax, %ecx + orl %edx, %ecx + movw %di, 4(%esp) + orl %ebp, %ecx +..B1.5: + fnclex +..B1.6: + fldenv 4(%esp) +..B1.7: + movl %ecx, (%esp) + movl 32(%esp), %eax + xorl %esp, %eax + ldmxcsr (%esp) + cmpl %gs:20, %eax + jne ..B1.9 +..B1.8: + xorl %eax, %eax + addl $48, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.9: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT +..B1.10: + orl $63, %edi + orl $8064, %ecx + movw %ax, 8(%esp) + movw %di, 4(%esp) + jmp ..B1.5 + .align 16,0x90 + .type fesetenv,@function + .size fesetenv,.-fesetenv + .data +# -- End fesetenv + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fesetexceptflag.S b/external/sgx_libm/ia32/fesetexceptflag.S new file mode 100644 index 0000000000..6574e54d20 --- /dev/null +++ b/external/sgx_libm/ia32/fesetexceptflag.S @@ -0,0 +1,109 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fesetexceptflag.c" + .text +..TXTST0: +# -- Begin fesetexceptflag + .text + .align 16,0x90 + .globl fesetexceptflag +fesetexceptflag: +# parameter 1: 48 + %esp +# parameter 2: 52 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + subl $36, %esp + movl %gs:20, %eax + movl 52(%esp), %ecx + xorl %esp, %eax + movl %eax, 32(%esp) + andl $63, %ecx + je ..B1.8 +..B1.2: + fnstenv 4(%esp) +..B1.3: + movl 48(%esp), %edx + movl %ecx, %eax + notl %eax + movzwl 8(%esp), %edi + movzwl (%edx), %ebx + andl %eax, %edi + andl %ecx, %ebx + orl %ebx, %edi + movw %di, 8(%esp) +..B1.4: + fnclex +..B1.5: + fldenv 4(%esp) +..B1.6: + stmxcsr (%esp) + movl (%esp), %ebx +..B1.7: + andl %eax, %ebx + movzwl (%edx), %eax + andl %ecx, %eax + orl %eax, %ebx + movl %ebx, (%esp) + ldmxcsr (%esp) +..B1.8: + movl 32(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.10 +..B1.9: + xorl %eax, %eax + addl $36, %esp + popl %ebx + popl %edi + ret +..B1.10: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type fesetexceptflag,@function + .size fesetexceptflag,.-fesetexceptflag + .data +# -- End fesetexceptflag + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fesetround.S b/external/sgx_libm/ia32/fesetround.S new file mode 100644 index 0000000000..37e6202a5f --- /dev/null +++ b/external/sgx_libm/ia32/fesetround.S @@ -0,0 +1,107 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fesetround.c" + .text +..TXTST0: +# -- Begin fesetround + .text + .align 16,0x90 + .globl fesetround +fesetround: +# parameter 1: 48 + %esp +..B1.1: +..L1: + + subl $44, %esp + movl %gs:20, %eax + movl 48(%esp), %edx + xorl %esp, %eax + movl %eax, 32(%esp) + testl $-3073, %edx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + jne ..B1.9 +..B1.2: + fnstenv 4(%esp) +..B1.3: + movzwl 4(%esp), %eax + andl $-3073, %eax + orl %edx, %eax + movw %ax, 4(%esp) +..B1.4: + fnclex +..B1.5: + fldenv 4(%esp) +..B1.6: + stmxcsr (%esp) + movl (%esp), %eax +..B1.7: + andl $-24577, %eax + shll $3, %edx + orl %edx, %eax + movl %eax, (%esp) + movl 32(%esp), %eax + xorl %esp, %eax + ldmxcsr (%esp) + cmpl %gs:20, %eax + jne ..B1.11 +..B1.8: + xorl %eax, %eax + addl $44, %esp + ret +..B1.9: + movl 32(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.11 +..B1.10: + movl $1, %eax + addl $44, %esp + ret +..B1.11: + movl %ecx, %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type fesetround,@function + .size fesetround,.-fesetround + .data +# -- End fesetround + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fetestexcept.S b/external/sgx_libm/ia32/fetestexcept.S new file mode 100644 index 0000000000..72b9f7572e --- /dev/null +++ b/external/sgx_libm/ia32/fetestexcept.S @@ -0,0 +1,74 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fetestexcept.c" + .text +..TXTST0: +# -- Begin fetestexcept + .text + .align 16,0x90 + .globl fetestexcept +fetestexcept: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movl 16(%esp), %edx + andl $63, %edx + je ..B1.5 +..B1.2: + fnstsw 4(%esp) +..B1.3: + stmxcsr (%esp) +..B1.4: + movzwl 4(%esp), %eax + orl (%esp), %eax + andl %edx, %eax + addl $12, %esp + ret +..B1.5: + xorl %eax, %eax + addl $12, %esp + ret + .align 16,0x90 + .type fetestexcept,@function + .size fetestexcept,.-fetestexcept + .data +# -- End fetestexcept + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/feupdateenv.S b/external/sgx_libm/ia32/feupdateenv.S new file mode 100644 index 0000000000..4c564b74e2 --- /dev/null +++ b/external/sgx_libm/ia32/feupdateenv.S @@ -0,0 +1,83 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feupdateenv.c" + .text +..TXTST0: +# -- Begin feupdateenv + .text + .align 16,0x90 + .globl feupdateenv +feupdateenv: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $8, %esp +..B1.2: + fnstsw 4(%esp) +..B1.3: + stmxcsr (%esp) + movl (%esp), %eax +..B1.4: + movl 16(%esp), %edx + orw %ax, 4(%esp) + addl $-16, %esp + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edx, (%esp) + call fesetenv@PLT +..B1.5: + movzwl 20(%esp), %eax + andl $63, %eax + movl %eax, (%esp) + call feraiseexcept@PLT +..B1.6: + xorl %eax, %eax + addl $24, %esp + popl %ebx + ret + .align 16,0x90 + .type feupdateenv,@function + .size feupdateenv,.-feupdateenv + .data +# -- End feupdateenv + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/floor_wmt.S b/external/sgx_libm/ia32/floor_wmt.S new file mode 100644 index 0000000000..93d2632114 --- /dev/null +++ b/external/sgx_libm/ia32/floor_wmt.S @@ -0,0 +1,152 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "floor_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin floor + .text + .align 16,0x90 + .globl floor +floor: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + pextrw $3, %xmm0, %eax + movl $32752, %ecx + andl %eax, %ecx + cmpl $17184, %ecx + ja .L_2TAG_PACKET_0.0.2 + je .L_2TAG_PACKET_1.0.2 + cmpl $16368, %ecx + jl .L_2TAG_PACKET_2.0.2 + movq (%ebx), %xmm1 + addsd %xmm0, %xmm1 + subsd (%ebx), %xmm1 + cmpltsd %xmm1, %xmm0 + movq %xmm1, (%esp) + movd %xmm0, %eax + fldl (%esp) + fsubs 20(%ebx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + pxor %xmm1, %xmm1 + cmpnlesd %xmm0, %xmm1 + movd %xmm1, %ecx + shrl $15, %eax + subl %ecx, %eax + flds 32(%ebx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_1.0.2: + pextrw $0, %xmm0, %eax + andl $1, %eax + movq %xmm0, (%esp) + fldl (%esp) + fsubs 48(%ebx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + cmpl $32752, %ecx + movq %xmm0, (%esp) + fldl (%esp) + jae .L_2TAG_PACKET_4.0.2 + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + fldz + faddp +.L_2TAG_PACKET_3.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type floor,@function + .size floor,.-floor + .data +# -- End floor + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 1065353216 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 3212836864 + .long 0 + .long 0 + .long 1056964608 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,64 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/floorf_gen.S b/external/sgx_libm/ia32/floorf_gen.S new file mode 100644 index 0000000000..bd3d935fd3 --- /dev/null +++ b/external/sgx_libm/ia32/floorf_gen.S @@ -0,0 +1,145 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "floorf_gen.c" + .text +..TXTST0: +# -- Begin floorf + .text + .align 16,0x90 + .globl floorf +floorf: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movzwl 18(%esp), %eax + andl $32640, %eax + shrl $7, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $149, %eax + jge ..B1.11 +..B1.2: + cmpl $127, %eax + jl ..B1.7 +..B1.3: + flds .L_2il0floatpacket.0@GOTOFF(%edx) + flds 16(%esp) + fld %st(0) + fadd %st(2), %st + fstps (%esp) + flds (%esp) + fsubp %st, %st(2) + fcomp %st(1) + fnstsw %ax + sahf + jae ..B1.6 + jp ..B1.6 +..B1.4: + fadds .L_2il0floatpacket.1@GOTOFF(%edx) +..B1.6: + addl $12, %esp + ret +..B1.7: + testl %eax, %eax + jne ..B1.10 +..B1.8: + testl $8388607, 16(%esp) + jne ..B1.10 +..B1.9: + flds 16(%esp) + addl $12, %esp + ret +..B1.10: + movzbl 19(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + movl 16(%esp), %eax + movl %eax, (%esp) + flds _pzero_none@GOTOFF(%edx,%ecx,4) + addl $12, %esp + ret +..B1.11: + cmpl $150, %eax + jge ..B1.16 +..B1.12: + flds 16(%esp) + testb $1, 16(%esp) + je ..B1.15 +..B1.13: + fadds .L_2il0floatpacket.2@GOTOFF(%edx) +..B1.15: + addl $12, %esp + ret +..B1.16: + flds 16(%esp) + addl $12, %esp + ret + .align 16,0x90 + .type floorf,@function + .size floorf,.-floorf + .data +# -- End floorf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4b400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0xbf800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0xbf000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +_pzero_none: + .long 0 + .long 3212836864 + .type _pzero_none,@object + .size _pzero_none,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/floorl.S b/external/sgx_libm/ia32/floorl.S new file mode 100644 index 0000000000..00c0faac22 --- /dev/null +++ b/external/sgx_libm/ia32/floorl.S @@ -0,0 +1,246 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "floorl.c" + .text +..TXTST0: +# -- Begin floorl + .text + .align 16,0x90 + .globl floorl +floorl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $16445, %eax + jge ..B1.21 +..B1.4: + cmpl $16383, %eax + jl ..B1.15 +..B1.5: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.6: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %ecx +..B1.9: + fldt 8(%ebp) + fld %st(0) + fldl _TWO_63H@GOTOFF(%edx) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt (%esp) + fldt (%esp) + fcompp + fnstsw %ax + sahf + jbe ..B1.12 +..B1.10: + fldt (%esp) + faddl 8+_ones@GOTOFF(%edx) + fstpt (%esp) +..B1.12: + testl %ecx, %ecx + je ..B1.14 +..B1.13: + fldcw 14(%esp) +..B1.14: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.15: + testl %eax, %eax + jne ..B1.20 +..B1.16: + cmpl $0, 12(%ebp) + jne ..B1.19 +..B1.17: + cmpl $0, 8(%ebp) + jne ..B1.19 +..B1.18: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.19: + fldl _smallest_value_64@GOTOFF(%edx) + fstpl 16(%esp) +..B1.20: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _pzero_none@GOTOFF(%edx,%eax,8) + movl %ebp, %esp + popl %ebp + ret +..B1.21: + cmpl $16446, %eax + jge ..B1.30 +..B1.22: + testb $1, 8(%ebp) + je ..B1.29 +..B1.23: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.24: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.25: + fldcw 12(%esp) +..B1.26: + fldt 8(%ebp) + faddl 8+_halfs@GOTOFF(%edx) + fstpt (%esp) +..B1.27: + fldcw 14(%esp) +..B1.28: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.29: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.30: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.31: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.32: + fldcw 12(%esp) +..B1.33: + fldt 8(%ebp) + fmull _ones@GOTOFF(%edx) + fstpt (%esp) +..B1.34: + fldcw 14(%esp) +..B1.35: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.36: + xorl %ecx, %ecx + jmp ..B1.9 +..B1.37: + fldt 8(%ebp) + faddl 8+_halfs@GOTOFF(%edx) + fstpt (%esp) + jmp ..B1.28 +..B1.38: + fldt 8(%ebp) + fmull _ones@GOTOFF(%edx) + fstpt (%esp) + jmp ..B1.35 + .align 16,0x90 + .type floorl,@function + .size floorl,.-floorl + .data +# -- End floorl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_pzero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _pzero_none,@object + .size _pzero_none,16 + .align 4 +_halfs: + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type _halfs,@object + .size _halfs,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fma.S b/external/sgx_libm/ia32/fma.S new file mode 100644 index 0000000000..d7cc6ab0a1 --- /dev/null +++ b/external/sgx_libm/ia32/fma.S @@ -0,0 +1,1208 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fma.c" + .text +..TXTST0: +# -- Begin fma + .text + .align 16,0x90 + .globl fma +fma: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 24 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp +..B1.2: + fnstcw 80(%esp) +..B1.3: + movl 12(%ebp), %esi + movl 16(%ebp), %ecx + movl 24(%ebp), %eax + movzwl 80(%esp), %edx + movl %esi, 60(%esp) + andl $2147483647, %esi + andl $3072, %edx + movl %edx, 56(%esp) + movl 20(%ebp), %edx + movl %edx, %edi + movl %ecx, 76(%esp) + andl $2147483647, %edi + movl 28(%ebp), %ecx + movl %eax, 72(%esp) + movl %esi, %eax + movl 8(%ebp), %ebx + movl %ecx, 68(%esp) + andl $2147483647, %ecx + orl %ebx, %eax + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + movl %eax, 64(%esp) + jne ..B1.4 +..B1.130: + cmpl $2146435072, %esi + ja ..B1.8 + jmp ..B1.6 +..B1.4: + cmpl $2146435072, %esi + jb ..B1.9 +..B1.5: + ja ..B1.8 +..B1.6: + jne ..B1.134 +..B1.7: + testl %ebx, %ebx + jne ..B1.8 +..B1.133: + cmpl $2146435072, %edi + ja ..B1.15 + jmp ..B1.13 +..B1.8: + fldl 8(%ebp) + faddl 16(%ebp) + fmull 24(%ebp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + lea -1072693248(%esi), %eax + orl %ebx, %eax + je ..B1.133 +..B1.10: + movl %edi, %eax + orl 76(%esp), %eax + je ..B1.133 +..B1.11: + cmpl $2146435072, %edi + jae ..B1.12 + jmp ..B1.16 +..B1.134: + cmpl $2146435072, %edi +..B1.12: + ja ..B1.15 +..B1.13: + jne ..B1.138 +..B1.14: + cmpl $0, 76(%esp) + jne ..B1.15 +..B1.137: + cmpl $2146435072, %ecx + ja ..B1.22 + jmp ..B1.20 +..B1.15: + fldl 16(%ebp) + faddl 24(%ebp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + lea -1072693248(%edi), %eax + orl 76(%esp), %eax + je ..B1.137 +..B1.17: + movl %ecx, %eax + orl 72(%esp), %eax + je ..B1.137 +..B1.18: + cmpl $2146435072, %ecx + jae ..B1.19 + jmp ..B1.28 +..B1.138: + cmpl $2146435072, %ecx +..B1.19: + ja ..B1.22 +..B1.20: + jne ..B1.23 +..B1.21: + cmpl $0, 72(%esp) + je ..B1.23 +..B1.22: + fldl 24(%ebp) + movl 64(%esp), %eax + fmull _ones@GOTOFF(%eax) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + cmpl $2146435072, %esi + jae ..B1.27 +..B1.24: + cmpl $2146435072, %edi + jae ..B1.27 +..B1.25: + cmpl $2146435072, %ecx + jb ..B1.27 +..B1.26: + fldl 24(%ebp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.27: + fldl 8(%ebp) + fmull 16(%ebp) + faddl 24(%ebp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.28: + cmpl $1048576, %esi + jae ..B1.30 +..B1.29: + movl 60(%esp), %ebx + movl %ebx, %eax + shrl $31, %eax + orl $1072693248, %ebx + movl 64(%esp), %esi + movl %ebx, 12(%ebp) + fldl 8(%ebp) + fsubl _ones@GOTOFF(%esi,%eax,8) + fstpl 8(%ebp) + movl 12(%ebp), %esi + movl %esi, 60(%esp) + andl $2147483647, %esi + movl %esi, %eax + shrl $20, %eax + addl $-1022, %eax + movl 8(%ebp), %ebx + movl %eax, 4(%esp) + jmp ..B1.31 +..B1.30: + movl %esi, %eax + shrl $20, %eax + movl %eax, 4(%esp) +..B1.31: + cmpl $1048576, %edi + jae ..B1.33 +..B1.32: + movl %edx, %edi + orl $1072693248, %edx + shrl $31, %edi + movl %edx, 20(%ebp) + fldl 16(%ebp) + movl 64(%esp), %edx + fsubl _ones@GOTOFF(%edx,%edi,8) + fstpl 16(%ebp) + movl 20(%ebp), %edx + movl %edx, %edi + movl 16(%ebp), %eax + andl $2147483647, %edi + movl %eax, 76(%esp) + movl %edi, %eax + shrl $20, %eax + addl $-1022, %eax + movl %eax, 16(%esp) + jmp ..B1.34 +..B1.33: + movl %edi, %eax + shrl $20, %eax + movl %eax, 16(%esp) +..B1.34: + cmpl $1048576, %ecx + jae ..B1.36 +..B1.35: + movl 68(%esp), %eax + movl %eax, %ecx + shrl $31, %ecx + orl $1072693248, %eax + movl %eax, 28(%ebp) + fldl 24(%ebp) + movl 64(%esp), %eax + fsubl _ones@GOTOFF(%eax,%ecx,8) + fstpl 24(%ebp) + movl 28(%ebp), %ecx + movl 24(%ebp), %eax + movl %ecx, 68(%esp) + andl $2147483647, %ecx + movl %eax, 72(%esp) + movl %ecx, %eax + shrl $20, %eax + addl $-1022, %eax + movl %eax, (%esp) + jmp ..B1.37 +..B1.36: + movl %ecx, %eax + shrl $20, %eax + movl %eax, (%esp) +..B1.37: + andl $1048575, %ecx + movl %ebx, %eax + orl $1048576, %ecx + andl $1048575, %esi + movl %ecx, 20(%esp) + orl $1048576, %esi + movl 60(%esp), %ecx + andl $1048575, %edi + xorl %edx, %ecx + orl $1048576, %edi + andl $-2147483648, %ecx + movl %ecx, 60(%esp) + movl 4(%esp), %edx + movl 16(%esp), %ecx + lea -1023(%edx,%ecx), %edx + movl 76(%esp), %ecx + movl %edx, 32(%esp) + mull %ecx + movl %eax, 44(%esp) + movl %ecx, %eax + movl %edx, 24(%esp) + mull %esi + movl %eax, %ecx + movl %ebx, %eax + movl %edx, 28(%esp) + mull %edi + movl %eax, 52(%esp) + movl %esi, %eax + movl %edx, %ebx + xorl %esi, %esi + mull %edi + addl 52(%esp), %ecx + movl 28(%esp), %edi + adcl $0, %esi + addl 24(%esp), %ecx + movl %ecx, 48(%esp) + adcl $0, %esi + addl %eax, %esi + movl $0, %eax + movl 20(%esp), %ecx + adcl $0, %eax + addl %ebx, %edi + movl $0, %ebx + adcl $0, %ebx + addl %edi, %esi + movl %esi, 40(%esp) + adcl %ebx, %eax + addl %eax, %edx + movl %edx, 36(%esp) + testl $512, %edx + je ..B1.39 +..B1.38: + movl %esi, %eax + shll $11, %edx + shrl $21, %eax + orl %eax, %edx + movl %edx, 36(%esp) + movl 48(%esp), %eax + movl %eax, %ebx + movl 44(%esp), %edx + movl %edx, %edi + shll $11, %esi + shrl $21, %ebx + shll $11, %eax + orl %ebx, %esi + shrl $21, %edi + shll $11, %edx + orl %edi, %eax + incl 32(%esp) + movl %esi, 40(%esp) + movl %eax, 48(%esp) + movl %edx, 44(%esp) + jmp ..B1.40 +..B1.39: + movl %esi, %eax + shll $12, %edx + shrl $20, %eax + orl %eax, %edx + movl %edx, 36(%esp) + movl 48(%esp), %eax + movl %eax, %ebx + movl 44(%esp), %edx + movl %edx, %edi + shll $12, %esi + shrl $20, %ebx + shll $12, %eax + orl %ebx, %esi + shrl $20, %edi + shll $12, %edx + orl %edi, %eax + movl %esi, 40(%esp) + movl %eax, 48(%esp) + movl %edx, 44(%esp) +..B1.40: + movl 32(%esp), %eax + cmpl (%esp), %eax + jg ..B1.45 +..B1.41: + cmpl (%esp), %eax + jne ..B1.46 +..B1.42: + cmpl 36(%esp), %ecx + jb ..B1.45 +..B1.43: + jne ..B1.46 +..B1.44: + movl 72(%esp), %eax + cmpl 40(%esp), %eax + ja ..B1.46 +..B1.45: + movl 72(%esp), %eax + movl 32(%esp), %edx + movl 68(%esp), %ebx + movl %eax, 24(%esp) + andl $-2147483648, %ebx + xorl %eax, %eax + subl (%esp), %edx + movl %ecx, 20(%esp) + movl %ebx, 16(%esp) + movl %eax, 28(%esp) + jmp ..B1.47 +..B1.46: + movl 36(%esp), %ebx + movl %ebx, 20(%esp) + movl 72(%esp), %ebx + movl %ebx, 40(%esp) + movl (%esp), %eax + movl %eax, %edx + movl 60(%esp), %ebx + movl 48(%esp), %edi + movl %ebx, 16(%esp) + subl 32(%esp), %edx + movl 68(%esp), %ebx + movl %eax, 32(%esp) + andl $-2147483648, %ebx + movl 44(%esp), %eax + movl %ebx, 60(%esp) + xorl %ebx, %ebx + movl %esi, 24(%esp) + movl %edi, 28(%esp) + movl %ecx, 36(%esp) + movl %ebx, 44(%esp) + movl %ebx, 48(%esp) +..B1.47: + testl %edx, %edx + je ..B1.57 +..B1.48: + cmpl $32, %edx + jge ..B1.50 +..B1.49: + movl %edx, %esi + movl %edx, %ecx + negl %esi + movl %eax, %ebx + movl %esi, (%esp) + movl $-1, %esi + shrl %cl, %esi + movl (%esp), %ecx + notl %esi + shll %cl, %ebx + movl 28(%esp), %edi + andl %esi, %ebx + movl %ebx, 52(%esp) + movl %edi, %ebx + shll %cl, %ebx + movl %edx, %ecx + shrl %cl, %eax + andl %esi, %ebx + orl %ebx, %eax + movl %eax, 4(%esp) + movl 24(%esp), %eax + movl %eax, %ebx + movl (%esp), %ecx + shll %cl, %ebx + movl %edx, %ecx + shrl %cl, %edi + andl %esi, %ebx + orl %ebx, %edi + movl 20(%esp), %ebx + movl %edi, 28(%esp) + movl %ebx, %edi + movl (%esp), %ecx + shll %cl, %edi + movl %edx, %ecx + shrl %cl, %eax + andl %esi, %edi + orl %edi, %eax + movl %eax, 24(%esp) + shrl %cl, %ebx + movl %ebx, 20(%esp) + movl 4(%esp), %eax + jmp ..B1.58 +..B1.50: + cmpl $64, %edx + jge ..B1.52 +..B1.51: + movl %edx, %esi + movl %edx, %ecx + movl $-1, %edi + negl %esi + movl %esi, (%esp) + testl %eax, %eax + movl 28(%esp), %ebx + movl $0, %eax + setne %al + shrl %cl, %edi + movl (%esp), %ecx + notl %edi + shll %cl, %ebx + andl %edi, %ebx + movl 24(%esp), %esi + orl %eax, %ebx + movl %esi, %eax + shll %cl, %eax + movl %edx, %ecx + movl %ebx, 52(%esp) + andl %edi, %eax + movl 28(%esp), %ebx + shrl %cl, %ebx + movl (%esp), %ecx + orl %ebx, %eax + movl 20(%esp), %ebx + shll %cl, %ebx + movl %edx, %ecx + shrl %cl, %esi + andl %edi, %ebx + orl %esi, %ebx + movl %ebx, 28(%esp) + movl 20(%esp), %ebx + shrl %cl, %ebx + movl %ebx, 24(%esp) + movl $0, 20(%esp) + jmp ..B1.58 +..B1.52: + cmpl $96, %edx + jge ..B1.54 +..B1.53: + movl %edx, %edi + movl %edx, %ecx + movl $-1, %esi + negl %edi + movl %edi, (%esp) + shrl %cl, %esi + orl 28(%esp), %eax + notl %esi + movl (%esp), %ecx + movl $0, %eax + movl 24(%esp), %ebx + setne %al + shll %cl, %ebx + andl %esi, %ebx + orl %eax, %ebx + movl %ebx, 52(%esp) + movl 20(%esp), %ebx + movl %ebx, %eax + shll %cl, %eax + movl %edx, %ecx + andl %esi, %eax + xorl %edx, %edx + movl 24(%esp), %esi + shrl %cl, %esi + shrl %cl, %ebx + orl %esi, %eax + movl %ebx, 28(%esp) + movl %edx, 24(%esp) + movl %edx, 20(%esp) + jmp ..B1.58 +..B1.54: + cmpl $128, %edx + jge ..B1.56 +..B1.55: + movl %edx, %ebx + movl %edx, %ecx + negl %ebx + movl $-1, %edi + movl 20(%esp), %esi + shrl %cl, %edi + movl %ebx, %ecx + movl %esi, %ebx + notl %edi + shll %cl, %ebx + movl 24(%esp), %ecx + andl %edi, %ebx + orl 28(%esp), %ecx + orl %eax, %ecx + movl $0, %eax + movl %edx, %ecx + setne %al + xorl %edx, %edx + orl %eax, %ebx + movl %esi, %eax + movl %ebx, 52(%esp) + shrl %cl, %eax + movl %edx, 28(%esp) + movl %edx, 24(%esp) + movl %edx, 20(%esp) + jmp ..B1.58 +..B1.56: + movl 20(%esp), %edi + orl 24(%esp), %edi + orl 28(%esp), %edi + orl %eax, %edi + movl $0, %eax + setne %al + movl %eax, 52(%esp) + xorl %eax, %eax + movl %eax, 28(%esp) + movl %eax, 24(%esp) + movl %eax, 20(%esp) + jmp ..B1.58 +..B1.57: + movl $0, 52(%esp) +..B1.58: + movl 60(%esp), %ecx + cmpl 16(%esp), %ecx + jne ..B1.62 +..B1.59: + movl 44(%esp), %esi + addl %esi, %eax + xorl %ecx, %ecx + cmpl %esi, %eax + movl 48(%esp), %ebx + setb %cl + xorl %edi, %edi + addl 28(%esp), %ebx + adcl $0, %edi + addl %ecx, %ebx + movl 40(%esp), %ecx + adcl $0, %edi + addl 24(%esp), %ecx + movl %ebx, 48(%esp) + movl $0, %ebx + adcl $0, %ebx + addl %edi, %ecx + movl %ecx, 40(%esp) + movl 36(%esp), %ecx + adcl $0, %ebx + addl 20(%esp), %ecx + addl %ebx, %ecx + movl %ecx, 36(%esp) + testl $2097152, %ecx + je ..B1.61 +..B1.60: + orl 48(%esp), %eax + orl 52(%esp), %eax + movl 40(%esp), %esi + movl %esi, %edx + movl %ecx, %ebx + movl $0, %eax + movl %ebx, %ecx + setne %al + shll $31, %edx + shll $31, %ecx + orl %eax, %edx + shrl $1, %esi + shrl $1, %ebx + orl %ecx, %esi + andl $1048575, %ebx + incl 32(%esp) + movl %edx, 20(%esp) + movl %esi, 40(%esp) + movl %ebx, 36(%esp) + jmp ..B1.84 +..B1.61: + orl 52(%esp), %eax + movl $0, %eax + setne %al + orl 48(%esp), %eax + andl $1048575, 36(%esp) + movl %eax, 20(%esp) + jmp ..B1.84 +..B1.62: + xorl %ebx, %ebx + negl 52(%esp) + movl 44(%esp), %esi + setne %bl + xorl %edi, %edi + subl %eax, %esi + movl $0, %eax + sbbl $0, %eax + subl %ebx, %esi + movl 48(%esp), %ecx + sbbl $0, %eax + subl 28(%esp), %ecx + cltd + sbbl $0, %edi + addl %eax, %ecx + movl 40(%esp), %ebx + adcl %edx, %edi + subl 24(%esp), %ebx + movl %edi, %eax + movl %esi, 44(%esp) + movl $0, %esi + cltd + sbbl $0, %esi + addl %ebx, %edi + movl 36(%esp), %eax + adcl %edx, %esi + subl 20(%esp), %eax + movl %ecx, 48(%esp) + addl %esi, %eax + movl %edi, 16(%esp) + movl %eax, 36(%esp) + je ..B1.64 +..B1.63: + shll $11, %eax + movl $0, 4(%esp) + jmp ..B1.72 +..B1.64: + cmpl $0, 16(%esp) + je ..B1.66 +..B1.65: + movl %edi, %eax + movl $21, 4(%esp) + jmp ..B1.72 +..B1.66: + cmpl $0, 48(%esp) + je ..B1.68 +..B1.67: + movl %ecx, %eax + movl $53, 4(%esp) + jmp ..B1.72 +..B1.68: + cmpl $0, 44(%esp) + je ..B1.70 +..B1.69: + movl 44(%esp), %eax + movl $85, 4(%esp) + jmp ..B1.72 +..B1.70: + cmpl $0, 52(%esp) + je ..B1.123 +..B1.71: + movl 52(%esp), %eax + movl $117, 4(%esp) +..B1.72: + testl $-2147483648, %eax + jne ..B1.76 +..B1.73: + movl 4(%esp), %edx +..B1.74: + addl %eax, %eax + incl %edx + testl $-2147483648, %eax + je ..B1.74 +..B1.75: + movl %edx, 4(%esp) +..B1.76: + cmpl $32, 4(%esp) + jge ..B1.78 +..B1.77: + movl 4(%esp), %ebx + movl %ebx, %esi + movl 44(%esp), %eax + negl %esi + orl 52(%esp), %eax + movl %ebx, %ecx + movl %esi, (%esp) + movl $0, %eax + movl 48(%esp), %esi + movl %esi, %edx + setne %al + movl $1, %edi + shll %cl, %edx + orl %eax, %edx + movl %edx, 20(%esp) + movl 16(%esp), %edx + movl %edx, %eax + shll %cl, %edi + shll %cl, %eax + decl %edi + movl (%esp), %ecx + shrl %cl, %esi + movl %ebx, %ecx + andl %edi, %esi + orl %esi, %eax + movl %eax, 40(%esp) + movl 36(%esp), %eax + shll %cl, %eax + movl (%esp), %ecx + shrl %cl, %edx + andl %edi, %edx + orl %edx, %eax + andl $1048575, %eax + movl %eax, 36(%esp) + jmp ..B1.83 +..B1.78: + cmpl $64, 4(%esp) + jge ..B1.80 +..B1.79: + movl 4(%esp), %ebx + movl %ebx, %esi + cmpl $0, 52(%esp) + movl %ebx, %ecx + movl $0, %eax + setne %al + movl $1, %edi + negl %esi + movl %esi, (%esp) + movl 44(%esp), %esi + movl %esi, %edx + shll %cl, %edx + orl %eax, %edx + movl %edx, 20(%esp) + movl 48(%esp), %edx + movl %edx, %eax + shll %cl, %edi + shll %cl, %eax + decl %edi + movl (%esp), %ecx + shrl %cl, %esi + movl %ebx, %ecx + andl %edi, %esi + orl %esi, %eax + movl %eax, 40(%esp) + movl 16(%esp), %eax + shll %cl, %eax + movl (%esp), %ecx + shrl %cl, %edx + andl %edi, %edx + orl %edx, %eax + andl $1048575, %eax + movl %eax, 36(%esp) + jmp ..B1.83 +..B1.80: + cmpl $96, 4(%esp) + jge ..B1.82 +..B1.81: + movl 4(%esp), %edi + movl %edi, %ebx + negl %ebx + movl %edi, %ecx + movl %ebx, (%esp) + movl $1, %ebx + movl 44(%esp), %esi + movl %esi, %edx + movl 52(%esp), %eax + shll %cl, %ebx + shll %cl, %eax + decl %ebx + shll %cl, %edx + movl (%esp), %ecx + movl %eax, 20(%esp) + shrl %cl, %eax + movl %edi, %ecx + andl %ebx, %eax + orl %eax, %edx + movl %edx, 40(%esp) + movl 48(%esp), %edx + shll %cl, %edx + movl (%esp), %ecx + shrl %cl, %esi + andl %ebx, %esi + orl %esi, %edx + andl $1048575, %edx + movl %edx, 36(%esp) + jmp ..B1.83 +..B1.82: + movl 4(%esp), %ecx + xorl %eax, %eax + movl 44(%esp), %edx + shll %cl, %edx + andl $1048575, %edx + cmpl $128, %ecx + movl %eax, 20(%esp) + jl ..L3 + movl $0, %edx +..L3: + movl %eax, 40(%esp) + movl %edx, 36(%esp) +..B1.83: + movl 32(%esp), %eax + subl 4(%esp), %eax + movl %eax, 32(%esp) +..B1.84: + movl 32(%esp), %eax + lea -1(%eax), %edx + cmpl $2046, %edx + jb ..B1.92 +..B1.85: + cmpl $2047, 32(%esp) + jge ..B1.91 +..B1.86: + negl %eax + incl %eax + orl $1048576, 36(%esp) + movl %eax, 32(%esp) + cmpl $32, %eax + jge ..B1.88 +..B1.87: + movl %eax, %ecx + movl %ecx, %edx + negl %edx + movl $-1, %edi + movl 20(%esp), %eax + movl %eax, %ebx + shrl %cl, %edi + movl %edx, %ecx + movl 40(%esp), %esi + notl %edi + shll %cl, %esi + movl 32(%esp), %ecx + andl %edi, %esi + shrl %cl, %ebx + movl %edx, %ecx + shll %cl, %eax + orl %ebx, %esi + testl %edi, %eax + movl $0, %eax + setne %al + orl %esi, %eax + movl %eax, 20(%esp) + movl 36(%esp), %eax + movl %eax, %esi + shll %cl, %esi + movl 32(%esp), %ecx + andl %edi, %esi + movl 40(%esp), %edi + shrl %cl, %edi + orl %esi, %edi + movl %edi, 40(%esp) + shrl %cl, %eax + jmp ..B1.93 +..B1.88: + xorl %eax, %eax + cmpl $53, 32(%esp) + jg ..B1.90 +..B1.89: + movl %eax, (%esp) + movl 32(%esp), %eax + movl %eax, %edx + negl %edx + movl %eax, %ecx + movl %edx, 4(%esp) + movl $-1, %edx + shrl %cl, %edx + movl 4(%esp), %ecx + notl %edx + movl 36(%esp), %edi + movl 40(%esp), %esi + movl %esi, %ebx + shll %cl, %edi + movl %eax, %ecx + shrl %cl, %ebx + andl %edx, %edi + movl 4(%esp), %ecx + orl %ebx, %edi + shll %cl, %esi + movl %eax, %ecx + andl %edx, %esi + xorl %edx, %edx + orl 20(%esp), %esi + movl 36(%esp), %esi + setne %dl + shrl %cl, %esi + orl %edi, %edx + movl (%esp), %eax + movl %edx, 20(%esp) + movl %esi, 40(%esp) + jmp ..B1.93 +..B1.90: + movl $1, 20(%esp) + movl %eax, 40(%esp) + jmp ..B1.94 +..B1.91: + movl 60(%esp), %eax + shrl $31, %eax + movl 64(%esp), %edx + fldl _large_value_64@GOTOFF(%edx,%eax,8) + fmull _large_value_64@GOTOFF(%edx) + fstl 8(%esp) + fstl (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.92: + movl %eax, %edx + shll $20, %edx + movl 36(%esp), %eax + orl %edx, %eax +..B1.93: + cmpl $0, 20(%esp) + je ..B1.122 +..B1.94: + movl 64(%esp), %edx + cmpl $0, 56(%esp) + fldl _small_value_64@GOTOFF(%edx) + fldl _ones@GOTOFF(%edx) + fadd %st(1), %st + fstpl 8(%esp) + je ..B1.124 +..B1.95: + cmpl $3072, 56(%esp) + je ..B1.118 +..B1.96: + cmpl $2048, 56(%esp) + jne ..B1.107 +..B1.97: + cmpl $0, 60(%esp) + je ..B1.99 +..B1.98: + cmpl $1048576, %eax + jb ..B1.104 + jmp ..B1.139 +..B1.99: + cmpl $1048575, %eax + jb ..B1.104 +..B1.100: + jne ..B1.105 +..B1.101: + cmpl $-1, 40(%esp) + jb ..B1.104 +..B1.102: + jne ..B1.105 +..B1.103: + cmpl $-2147483648, 20(%esp) + jae ..B1.105 +..B1.104: + fmul %st(0), %st + fstl 8(%esp) + cmpl $0, 60(%esp) + jne ..B1.139 +..B1.105: + fstp %st(0) + xorl %edx, %edx + incl 40(%esp) + sete %dl + addl %edx, %eax + cmpl $2146435072, %eax + jb ..B1.122 +..B1.106: + movl 60(%esp), %eax + shrl $31, %eax + movl 64(%esp), %edx + fldl _large_value_64@GOTOFF(%edx,%eax,8) + fmull _large_value_64@GOTOFF(%edx) + fstl 8(%esp) + fstl (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.107: + cmpl $1024, 56(%esp) + jne ..B1.139 +..B1.108: + cmpl $0, 60(%esp) + jne ..B1.110 +..B1.109: + cmpl $1048576, %eax + jb ..B1.115 + jmp ..B1.139 +..B1.110: + cmpl $1048575, %eax + jb ..B1.115 +..B1.111: + jne ..B1.116 +..B1.112: + cmpl $-1, 40(%esp) + jb ..B1.115 +..B1.113: + jne ..B1.116 +..B1.114: + cmpl $-2147483648, 20(%esp) + jae ..B1.116 +..B1.115: + fmul %st(0), %st + fstl 8(%esp) + cmpl $0, 60(%esp) + je ..B1.139 +..B1.116: + fstp %st(0) + xorl %edx, %edx + incl 40(%esp) + sete %dl + addl %edx, %eax + cmpl $2146435072, %eax + jb ..B1.122 +..B1.117: + movl 60(%esp), %eax + shrl $31, %eax + movl 64(%esp), %edx + fldl _large_value_64@GOTOFF(%edx,%eax,8) + fmull _large_value_64@GOTOFF(%edx) + fstl 8(%esp) + fstl (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.118: + cmpl $1048576, %eax + jb ..B1.121 +..B1.119: + lea -1048576(%eax), %edx + orl 40(%esp), %edx + jne ..B1.139 +..B1.120: + cmpl $-2147483648, 20(%esp) + jne ..B1.139 +..B1.121: + fmul %st(0), %st + fstpl 8(%esp) +..B1.122: + movl 60(%esp), %edx + orl %eax, %edx + movl 40(%esp), %eax + movl %edx, 4(%esp) + movl %eax, (%esp) + fldl (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.123: + xorl %eax, %eax + cmpl $1024, 56(%esp) + movl 64(%esp), %edi + sete %al + fldl _zeros@GOTOFF(%edi,%eax,8) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.124: + testl $-2147483648, 20(%esp) + je ..B1.118 +..B1.125: + movl 40(%esp), %ecx + movl 20(%esp), %edx + andl $1, %ecx + andl $2147483647, %edx + orl %edx, %ecx + je ..B1.118 +..B1.126: + xorl %edx, %edx + incl 40(%esp) + sete %dl + addl %edx, %eax + cmpl $2146435072, %eax + jb ..B1.118 +..B1.127: + fstp %st(0) + movl 60(%esp), %eax + shrl $31, %eax + movl 64(%esp), %edx + fldl _large_value_64@GOTOFF(%edx,%eax,8) + fmull _large_value_64@GOTOFF(%edx) + fstl 8(%esp) + fstl (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.139: + fstp %st(0) + jmp ..B1.122 + .align 16,0x90 + .type fma,@function + .size fma,.-fma + .data +# -- End fma + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmaf_wmt.S b/external/sgx_libm/ia32/fmaf_wmt.S new file mode 100644 index 0000000000..b76202b99e --- /dev/null +++ b/external/sgx_libm/ia32/fmaf_wmt.S @@ -0,0 +1,425 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmaf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fmaf + .text + .align 16,0x90 + .globl fmaf +fmaf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $136, %esp + movl %ebx, 80(%esp) + call static_func + movl %eax, %ebx + movss 144(%esp), %xmm0 + movss 148(%esp), %xmm1 + movss 152(%esp), %xmm2 + movss %xmm0, 8(%esp) + movss %xmm1, 16(%esp) + movss %xmm2, 24(%esp) + movl 8(%esp), %eax + ucomiss %xmm1, %xmm0 + movl 16(%esp), %ecx + jp .L_2TAG_PACKET_0.0.2 + movl 24(%esp), %edx + ucomiss %xmm2, %xmm2 + jp .L_2TAG_PACKET_1.0.2 + andl $2147483647, %eax + je .L_2TAG_PACKET_2.0.2 + cmpl $1065353216, %eax + je .L_2TAG_PACKET_3.0.2 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_4.0.2 + andl $2147483647, %ecx + je .L_2TAG_PACKET_2.0.2 + cmpl $1065353216, %ecx + je .L_2TAG_PACKET_3.0.2 + cmpl $2139095040, %ecx + je .L_2TAG_PACKET_4.0.2 + andl $2147483647, %edx + je .L_2TAG_PACKET_5.0.2 + cmpl $2139095040, %edx + je .L_2TAG_PACKET_6.0.2 + cmpl $8388608, %eax + jl .L_2TAG_PACKET_7.0.2 + cvtps2pd %xmm0, %xmm3 +.L_2TAG_PACKET_8.0.2: + cmpl $8388608, %ecx + jl .L_2TAG_PACKET_9.0.2 + cvtps2pd %xmm1, %xmm4 +.L_2TAG_PACKET_10.0.2: + cmpl $8388608, %edx + jl .L_2TAG_PACKET_11.0.2 + cvtps2pd %xmm2, %xmm0 +.L_2TAG_PACKET_12.0.2: + mulsd %xmm4, %xmm3 + pextrw $3, %xmm3, %edx + andl $32752, %edx + movl $96, %eax + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + addl %edx, %eax + subl %ecx, %eax + cmpl $560, %eax + jae .L_2TAG_PACKET_13.0.2 + addsd %xmm3, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_0.0.2: +.L_2TAG_PACKET_2.0.2: +.L_2TAG_PACKET_3.0.2: +.L_2TAG_PACKET_4.0.2: +.L_2TAG_PACKET_5.0.2: + flds 8(%esp) + fmuls 16(%esp) + fadds 24(%esp) + jmp .L_2TAG_PACKET_15.0.2 +.L_2TAG_PACKET_1.0.2: + flds 8(%esp) + fadds 24(%esp) + jmp .L_2TAG_PACKET_15.0.2 +.L_2TAG_PACKET_6.0.2: + flds 24(%esp) + jmp .L_2TAG_PACKET_15.0.2 +.L_2TAG_PACKET_7.0.2: + movaps (%ebx), %xmm3 + pand %xmm0, %xmm3 + movaps 48(%ebx), %xmm5 + orpd 16(%ebx), %xmm3 + pand %xmm0, %xmm5 + subsd 16(%ebx), %xmm3 + psllq $32, %xmm5 + mulsd 32(%ebx), %xmm3 + orpd %xmm5, %xmm3 + jmp .L_2TAG_PACKET_8.0.2 +.L_2TAG_PACKET_9.0.2: + movaps (%ebx), %xmm4 + pand %xmm1, %xmm4 + movaps 48(%ebx), %xmm5 + orpd 16(%ebx), %xmm4 + pand %xmm1, %xmm5 + subsd 16(%ebx), %xmm4 + psllq $32, %xmm5 + mulsd 32(%ebx), %xmm4 + orpd %xmm5, %xmm4 + jmp .L_2TAG_PACKET_10.0.2 +.L_2TAG_PACKET_11.0.2: + movaps (%ebx), %xmm0 + pand %xmm2, %xmm0 + movaps 48(%ebx), %xmm5 + orpd 16(%ebx), %xmm0 + pand %xmm2, %xmm5 + subsd 16(%ebx), %xmm0 + psllq $32, %xmm5 + mulsd 32(%ebx), %xmm0 + orpd %xmm5, %xmm0 + jmp .L_2TAG_PACKET_12.0.2 +.L_2TAG_PACKET_13.0.2: + pextrw $1, %xmm2, %ecx + pextrw $3, %xmm3, %edx + sarl $4, %eax + xorl %edx, %ecx + testl $32768, %ecx + jne .L_2TAG_PACKET_16.0.2 + cmpl $53, %eax + jge .L_2TAG_PACKET_17.0.2 + cmpl $-19, %eax + jle .L_2TAG_PACKET_18.0.2 + cmpl $6, %eax + jge .L_2TAG_PACKET_19.0.2 + movl $6, %ecx + subl %eax, %ecx + addl $58, %eax + movsd 64(%ebx), %xmm1 + pand 64(%ebx), %xmm3 + pxor %xmm5, %xmm5 + por 96(%ebx), %xmm3 + pxor %xmm2, %xmm2 + pinsrw $0, %eax, %xmm5 + pinsrw $0, %ecx, %xmm2 + pand %xmm0, %xmm1 + pand 80(%ebx), %xmm0 + movdqa %xmm3, %xmm4 + psllq %xmm5, %xmm3 + por 96(%ebx), %xmm1 + psrlq %xmm2, %xmm4 + psrlq $40, %xmm3 + paddq %xmm4, %xmm1 + movdqa %xmm1, %xmm5 + psrlq $53, %xmm1 + movdqa %xmm5, %xmm4 + psrlq %xmm1, %xmm5 + pand %xmm1, %xmm4 + psllq $52, %xmm1 + por %xmm3, %xmm5 + paddq %xmm1, %xmm0 + por %xmm4, %xmm5 + pand 64(%ebx), %xmm5 + por %xmm5, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_17.0.2: + movapd 112(%ebx), %xmm0 + orpd %xmm3, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_18.0.2: + orpd 112(%ebx), %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_19.0.2: + movl $70, %ecx + subl %eax, %ecx + subl $6, %eax + movsd 64(%ebx), %xmm1 + pand 64(%ebx), %xmm0 + pxor %xmm5, %xmm5 + por 96(%ebx), %xmm0 + pxor %xmm2, %xmm2 + pinsrw $0, %ecx, %xmm5 + pinsrw $0, %eax, %xmm2 + pand %xmm3, %xmm1 + pand 80(%ebx), %xmm3 + movdqa %xmm0, %xmm4 + psllq %xmm5, %xmm0 + por 96(%ebx), %xmm1 + psrlq %xmm2, %xmm4 + pxor %xmm2, %xmm2 + psrlq $18, %xmm0 + psubq %xmm0, %xmm2 + paddq %xmm4, %xmm1 + psrlq $63, %xmm2 + movdqa %xmm1, %xmm0 + psrlq $53, %xmm1 + movdqa %xmm0, %xmm4 + psrlq %xmm1, %xmm0 + pand %xmm1, %xmm4 + psllq $52, %xmm1 + por %xmm2, %xmm0 + paddq %xmm1, %xmm3 + por %xmm4, %xmm0 + pand 64(%ebx), %xmm0 + por %xmm3, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_16.0.2: + cmpl $53, %eax + jge .L_2TAG_PACKET_20.0.2 + cmpl $-22, %eax + jle .L_2TAG_PACKET_21.0.2 + cmpl $6, %eax + jge .L_2TAG_PACKET_22.0.2 + movl $6, %ecx + subl %eax, %ecx + addl $58, %eax + movsd 64(%ebx), %xmm1 + pand 64(%ebx), %xmm3 + pxor %xmm5, %xmm5 + por 96(%ebx), %xmm3 + pxor %xmm2, %xmm2 + pinsrw $0, %eax, %xmm5 + pinsrw $0, %ecx, %xmm2 + pand %xmm0, %xmm1 + pand 80(%ebx), %xmm0 + movdqa %xmm3, %xmm4 + psllq %xmm5, %xmm3 + por 96(%ebx), %xmm1 + psrlq %xmm2, %xmm4 + pxor %xmm2, %xmm2 + psrlq $37, %xmm3 + psubq %xmm3, %xmm2 + psubq %xmm4, %xmm1 + psrlq $63, %xmm2 + psubq %xmm2, %xmm1 + movdqa %xmm1, %xmm3 + movsd 112(%ebx), %xmm2 + psrlq $52, %xmm1 + psubq %xmm1, %xmm2 + movdqa %xmm2, %xmm1 + psllq $52, %xmm2 + psllq %xmm1, %xmm3 + pand 64(%ebx), %xmm3 + psubq %xmm2, %xmm0 + por %xmm3, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_20.0.2: + movsd 64(%ebx), %xmm1 + pand %xmm3, %xmm1 + por 96(%ebx), %xmm1 + psubq 112(%ebx), %xmm1 + movapd %xmm1, %xmm0 + psrlq $52, %xmm1 + movapd 112(%ebx), %xmm4 + psubq %xmm1, %xmm4 + psllq %xmm4, %xmm0 + psllq $52, %xmm4 + pand 80(%ebx), %xmm3 + psubq %xmm4, %xmm3 + pand 64(%ebx), %xmm0 + por %xmm3, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_21.0.2: + movsd 64(%ebx), %xmm1 + pand %xmm0, %xmm1 + por 96(%ebx), %xmm1 + psubq 112(%ebx), %xmm1 + movapd %xmm1, %xmm2 + psrlq $52, %xmm1 + movapd 112(%ebx), %xmm3 + psubq %xmm1, %xmm3 + psllq %xmm3, %xmm2 + psllq $52, %xmm3 + pand 80(%ebx), %xmm0 + psubq %xmm3, %xmm0 + pand 64(%ebx), %xmm2 + por %xmm2, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_22.0.2: + movl $70, %ecx + subl %eax, %ecx + subl $6, %eax + movsd 64(%ebx), %xmm1 + pand 64(%ebx), %xmm0 + pxor %xmm5, %xmm5 + por 96(%ebx), %xmm0 + pxor %xmm2, %xmm2 + pinsrw $0, %ecx, %xmm5 + pinsrw $0, %eax, %xmm2 + pand %xmm3, %xmm1 + pand 80(%ebx), %xmm3 + movdqa %xmm0, %xmm4 + psllq %xmm5, %xmm0 + por 96(%ebx), %xmm1 + psrlq %xmm2, %xmm4 + pxor %xmm2, %xmm2 + psrlq $18, %xmm0 + psubq %xmm0, %xmm2 + psubq %xmm4, %xmm1 + psrlq $63, %xmm2 + psubq %xmm2, %xmm1 + movdqa %xmm1, %xmm0 + movsd 112(%ebx), %xmm2 + psrlq $52, %xmm1 + psubq %xmm1, %xmm2 + movdqa %xmm2, %xmm1 + psllq $52, %xmm2 + psllq %xmm1, %xmm0 + pand 64(%ebx), %xmm0 + psubq %xmm2, %xmm3 + por %xmm3, %xmm0 + jmp .L_2TAG_PACKET_14.0.2 +.L_2TAG_PACKET_14.0.2: + movq %xmm0, (%esp) + fldl (%esp) + fstps 32(%esp) + flds 32(%esp) +.L_2TAG_PACKET_15.0.2: + movl 80(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fmaf,@function + .size fmaf,.-fmaf + .data +# -- End fmaf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 970981376 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 4294967295 + .long 1048575 + .long 0 + .long 0 + .long 0 + .long 4293918720 + .long 0 + .long 0 + .long 0 + .long 1048576 + .long 0 + .long 0 + .long 1 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,128 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmal.S b/external/sgx_libm/ia32/fmal.S new file mode 100644 index 0000000000..d7267db387 --- /dev/null +++ b/external/sgx_libm/ia32/fmal.S @@ -0,0 +1,1483 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmal.c" + .text +..TXTST0: +# -- Begin fmal + .text + .align 16,0x90 + .globl fmal +fmal: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 32 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $100, %esp +..B1.2: + fnstcw 62(%esp) +..B1.3: + fnstcw 88(%esp) +..B1.4: + movzbl 17(%ebp), %edi + movzbl 41(%ebp), %ebx + andl $128, %edi + andl $128, %ebx + movzbl 29(%ebp), %edx + shrl $7, %edi + andl $128, %edx + shrl $7, %ebx + movzwl 88(%esp), %ecx + movl %edi, 80(%esp) + andl $3072, %ecx + movl %ebx, 84(%esp) + movzwl 16(%ebp), %edi + movzwl 40(%ebp), %ebx + movl %ebx, %eax + movl %ecx, 72(%esp) + movl %edi, %ecx + shrl $7, %edx + andl $32767, %ecx + movzwl 28(%ebp), %esi + andl $32767, %eax + movl %edx, 32(%esp) + movl %esi, %edx + movl %eax, 56(%esp) + andl $32767, %edx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $32767, %ecx + movl %eax, 76(%esp) + je ..B1.21 +..B1.5: + testl %ecx, %ecx + jne ..B1.8 +..B1.6: + cmpl $0, 12(%ebp) + jne ..B1.9 +..B1.7: + cmpl $0, 8(%ebp) + je ..B1.20 + jmp ..B1.9 +..B1.8: + cmpl $16383, %ecx + je ..B1.204 +..B1.9: + cmpl $32767, %edx + je ..B1.18 +..B1.10: + testl %edx, %edx + jne ..B1.13 +..B1.11: + cmpl $0, 24(%ebp) + jne ..B1.14 +..B1.12: + cmpl $0, 20(%ebp) + je ..B1.18 + jmp ..B1.14 +..B1.13: + cmpl $16383, %edx + je ..B1.202 +..B1.14: + cmpl $32767, 56(%esp) + je ..B1.18 +..B1.15: + cmpl $0, 56(%esp) + jne ..B1.54 +..B1.16: + cmpl $0, 36(%ebp) + jne ..B1.54 +..B1.17: + cmpl $0, 32(%ebp) + jne ..B1.54 +..B1.18: + testl %ecx, %ecx + jne ..B1.21 +..B1.19: + cmpl $0, 12(%ebp) + jne ..B1.27 +..B1.209: + cmpl $0, 8(%ebp) +..B1.20: + jne ..B1.27 +..B1.21: + testl %edx, %edx + jne ..B1.24 +..B1.22: + cmpl $0, 24(%ebp) + jne ..B1.27 +..B1.23: + cmpl $0, 20(%ebp) + jne ..B1.27 +..B1.24: + cmpl $0, 56(%esp) + jne ..B1.28 +..B1.25: + cmpl $0, 36(%ebp) + jne ..B1.27 +..B1.26: + cmpl $0, 32(%ebp) + je ..B1.28 +..B1.27: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 64(%esp) +..B1.28: + cmpl $32767, %ecx + je ..B1.185 +..B1.29: + cmpl $32767, %edx + je ..B1.176 +..B1.30: + cmpl $32767, 56(%esp) + je ..B1.167 +..B1.31: + cmpl $32767, %ecx + jge ..B1.34 +..B1.32: + cmpl $32767, %edx + jge ..B1.34 +..B1.33: + cmpl $32767, 56(%esp) + je ..B1.206 +..B1.34: + movzwl 62(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.166 +..B1.35: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.36: + fldcw 60(%esp) +..B1.37: + movzwl 16(%ebp), %edi + movl $1, %edx +..B1.38: + fldt 8(%ebp) + testl $32767, %edi + fldt 20(%ebp) + fmulp %st, %st(1) + jne ..B1.41 +..B1.39: + cmpl $0, 12(%ebp) + jne ..B1.41 +..B1.40: + cmpl $0, 8(%ebp) + je ..B1.50 +..B1.41: + movzwl 28(%ebp), %eax + testl $32767, %eax + jne ..B1.46 +..B1.42: + cmpl $0, 24(%ebp) + jne ..B1.46 +..B1.43: + cmpl $0, 20(%ebp) + je ..B1.50 +..B1.46: + fstpt 20(%esp) + fldt 20(%esp) +..B1.47: + movzwl 28(%esp), %eax + testl $32767, %eax + jne ..B1.50 +..B1.48: + cmpl $0, 24(%esp) + jne ..B1.50 +..B1.49: + cmpl $0, 20(%esp) + je ..B1.51 +..B1.50: + fldt 32(%ebp) + faddp %st, %st(1) + fstpt 20(%esp) + fldt 20(%esp) +..B1.51: + fstp %st(0) + testl %edx, %edx + je ..B1.53 +..B1.52: + fldcw 62(%esp) +..B1.53: + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.54: + testl %ecx, %ecx + je ..B1.57 +..B1.55: + testl %edx, %edx + je ..B1.57 +..B1.56: + cmpl $0, 56(%esp) + jne ..B1.69 +..B1.57: + fldl _smallest_value_64@GOTOFF(%eax) + movzwl 62(%esp), %eax + movl %eax, (%esp) + andl $768, %eax + fstpl 64(%esp) + cmpl $768, %eax + je ..B1.201 +..B1.58: + movl (%esp), %eax + orl $-64768, %eax + movw %ax, 60(%esp) +..B1.59: + fldcw 60(%esp) +..B1.60: + movzwl 16(%ebp), %edi + movl $1, %eax + movzwl 28(%ebp), %esi + movzwl 40(%ebp), %ebx +..B1.61: + testl $32767, %edi + jne ..B1.63 +..B1.62: + andl $-32768, %edi + orl $-49153, %edi + movw %di, 16(%ebp) + movl 76(%esp), %ecx + movl 80(%esp), %edi + orl $-2147483648, 12(%ebp) + fldt 8(%ebp) + fsubl _ones@GOTOFF(%ecx,%edi,8) + fstpt 8(%ebp) + movzwl 16(%ebp), %ecx + andl $32767, %ecx + addl $-16382, %ecx +..B1.63: + testl $32767, %esi + jne ..B1.65 +..B1.64: + andl $-32768, %esi + orl $-49153, %esi + movw %si, 28(%ebp) + movl 76(%esp), %edx + movl 32(%esp), %esi + orl $-2147483648, 24(%ebp) + fldt 20(%ebp) + fsubl _ones@GOTOFF(%edx,%esi,8) + fstpt 20(%ebp) + movzwl 28(%ebp), %edx + andl $32767, %edx + addl $-16382, %edx +..B1.65: + testl $32767, %ebx + jne ..B1.67 +..B1.66: + andl $-32768, %ebx + orl $-49153, %ebx + movw %bx, 40(%ebp) + movl 76(%esp), %ebx + movl 84(%esp), %esi + orl $-2147483648, 36(%ebp) + fldt 32(%ebp) + fsubl _ones@GOTOFF(%ebx,%esi,8) + fstpt 32(%ebp) + movzwl 40(%ebp), %edi + andl $32767, %edi + addl $-16382, %edi + movl %edi, 56(%esp) +..B1.67: + testl %eax, %eax + je ..B1.69 +..B1.68: + fldcw 62(%esp) +..B1.69: + movl 36(%ebp), %eax + lea -16383(%ecx,%edx), %edx + movl %eax, 4(%esp) + movl 32(%ebp), %eax + movl %eax, (%esp) + movl 32(%esp), %eax + movl 8(%ebp), %edi + xorl %eax, 80(%esp) + movl %edi, %eax + movl 20(%ebp), %ebx + movl %edx, 52(%esp) + mull %ebx + movl %eax, 44(%esp) + movl %ebx, %eax + movl 12(%ebp), %esi + movl %edx, 20(%esp) + mull %esi + movl %eax, %ecx + movl %edi, %eax + movl 24(%ebp), %ebx + movl %edx, 24(%esp) + mull %ebx + movl %eax, %edi + movl %esi, %eax + movl %edx, 28(%esp) + xorl %esi, %esi + addl %edi, %ecx + adcl $0, %esi + mull %ebx + addl 20(%esp), %ecx + movl %edx, %ebx + movl %ecx, 48(%esp) + adcl $0, %esi + xorl %edx, %edx + addl %eax, %esi + movl 24(%esp), %ecx + adcl $0, %edx + xorl %eax, %eax + addl 28(%esp), %ecx + adcl $0, %eax + addl %ecx, %esi + adcl %eax, %edx + addl %edx, %ebx + movl 52(%esp), %edx + testl $-2147483648, %ebx + je ..B1.71 +..B1.70: + incl %edx + jmp ..B1.72 +..B1.71: + movl %esi, %edi + addl %ebx, %ebx + shrl $31, %edi + addl %esi, %esi + movl 48(%esp), %eax + orl %edi, %ebx + movl %eax, %edi + addl %eax, %eax + shrl $31, %edi + movl 44(%esp), %ecx + orl %edi, %esi + movl %ecx, %edi + addl %ecx, %ecx + shrl $31, %edi + orl %edi, %eax + movl %eax, 48(%esp) + movl %ecx, 44(%esp) +..B1.72: + cmpl 56(%esp), %edx + jg ..B1.77 +..B1.73: + jne ..B1.78 +..B1.74: + cmpl 4(%esp), %ebx + ja ..B1.77 +..B1.75: + jne ..B1.78 +..B1.76: + cmpl (%esp), %esi + jb ..B1.78 +..B1.77: + movl %edx, %eax + subl 56(%esp), %eax + movl 4(%esp), %edi + movl %eax, 32(%esp) + movl (%esp), %eax + movl %edi, 28(%esp) + xorl %edi, %edi + movl %eax, 36(%esp) + movl %edi, 40(%esp) + jmp ..B1.79 +..B1.78: + movl 56(%esp), %eax + movl %eax, %edi + subl %edx, %edi + movl %eax, %edx + movl 80(%esp), %eax + movl %eax, 84(%esp) + movzbl 41(%ebp), %eax + movl %ebx, 28(%esp) + andl $128, %eax + movl 48(%esp), %ebx + movl %edi, 32(%esp) + shrl $7, %eax + movl %esi, 36(%esp) + movl %ebx, 40(%esp) + movl 44(%esp), %edi + movl %eax, 80(%esp) + xorl %eax, %eax + movl 4(%esp), %ebx + movl (%esp), %esi + movl %eax, 44(%esp) + movl %eax, 48(%esp) +..B1.79: + cmpl $0, 32(%esp) + je ..B1.89 +..B1.80: + cmpl $32, 32(%esp) + jge ..B1.82 +..B1.81: + movl %esi, 20(%esp) + movl %edi, %eax + movl 32(%esp), %esi + movl %esi, %ecx + movl %edx, 52(%esp) + movl %esi, %edx + movl %ebx, 24(%esp) + negl %edx + movl $-1, %ebx + shrl %cl, %ebx + movl %edx, %ecx + shll %cl, %eax + notl %ebx + movl %eax, 56(%esp) + movl 40(%esp), %eax + shll %cl, %eax + movl %esi, %ecx + shrl %cl, %edi + andl %ebx, %eax + orl %eax, %edi + movl %edx, %ecx + movl %edi, 4(%esp) + movl 36(%esp), %edi + movl %edi, %eax + shll %cl, %eax + movl %esi, %ecx + andl %ebx, %eax + movl %eax, (%esp) + movl 40(%esp), %eax + shrl %cl, %eax + movl %edx, %ecx + orl (%esp), %eax + movl 28(%esp), %edx + movl %eax, 40(%esp) + movl %edx, %eax + shll %cl, %eax + movl %esi, %ecx + shrl %cl, %edi + andl %ebx, %eax + shrl %cl, %edx + orl %eax, %edi + movl %edi, 36(%esp) + movl %edx, 28(%esp) + movl 20(%esp), %esi + movl 52(%esp), %edx + movl 24(%esp), %ebx + movl 4(%esp), %edi + jmp ..B1.90 +..B1.82: + cmpl $64, 32(%esp) + jge ..B1.84 +..B1.83: + movl %ebx, 24(%esp) + movl 32(%esp), %ebx + movl %ebx, %ecx + movl %edx, 52(%esp) + movl %ebx, %edx + movl %esi, 20(%esp) + negl %edx + movl $-1, %esi + shrl %cl, %esi + movl %edx, %ecx + movl 40(%esp), %eax + notl %esi + shll %cl, %eax + xorl %ecx, %ecx + testl %edi, %edi + movl %esi, (%esp) + setne %cl + andl (%esp), %eax + movl 36(%esp), %esi + orl %ecx, %eax + movl %edx, %ecx + movl %esi, %edi + shll %cl, %edi + movl %ebx, %ecx + movl %eax, 56(%esp) + movl 40(%esp), %eax + andl (%esp), %edi + shrl %cl, %eax + movl %edx, %ecx + movl 28(%esp), %edx + orl %eax, %edi + movl %edx, %eax + shll %cl, %eax + movl %ebx, %ecx + andl (%esp), %eax + shrl %cl, %esi + shrl %cl, %edx + orl %esi, %eax + movl %edx, 36(%esp) + movl %eax, 40(%esp) + movl $0, 28(%esp) + movl 20(%esp), %esi + movl 52(%esp), %edx + movl 24(%esp), %ebx + jmp ..B1.90 +..B1.84: + cmpl $96, 32(%esp) + jge ..B1.86 +..B1.85: + movl %edx, 52(%esp) + movl 32(%esp), %edx + movl %edx, %ecx + movl %ebx, 24(%esp) + movl %edx, %ebx + movl %esi, 20(%esp) + movl $-1, %esi + negl %ebx + movl %ebx, (%esp) + shrl %cl, %esi + xorl %ebx, %ebx + orl 40(%esp), %edi + notl %esi + movl (%esp), %ecx + movl 36(%esp), %eax + setne %bl + shll %cl, %eax + andl %esi, %eax + orl %ebx, %eax + movl %eax, 56(%esp) + movl 28(%esp), %eax + movl %eax, %edi + shll %cl, %edi + movl %edx, %ecx + andl %esi, %edi + xorl %edx, %edx + movl 36(%esp), %esi + shrl %cl, %esi + shrl %cl, %eax + orl %esi, %edi + movl %edx, 36(%esp) + movl %edx, 28(%esp) + movl %eax, 40(%esp) + movl 20(%esp), %esi + movl 52(%esp), %edx + movl 24(%esp), %ebx + jmp ..B1.90 +..B1.86: + cmpl $128, 32(%esp) + jge ..B1.88 +..B1.87: + movl %edx, 52(%esp) + movl 32(%esp), %edx + movl %edx, %eax + movl %ebx, 24(%esp) + negl %eax + movl %edx, %ecx + movl $-1, %ebx + movl %esi, 20(%esp) + movl 28(%esp), %esi + shrl %cl, %ebx + movl %eax, %ecx + movl %esi, %eax + notl %ebx + shll %cl, %eax + movl 36(%esp), %ecx + andl %ebx, %eax + orl 40(%esp), %ecx + xorl %ebx, %ebx + orl %edi, %ecx + movl %edx, %ecx + movl %esi, %edi + setne %bl + xorl %edx, %edx + movl %edx, 40(%esp) + orl %ebx, %eax + movl %edx, 36(%esp) + movl %edx, 28(%esp) + movl %eax, 56(%esp) + shrl %cl, %edi + movl 20(%esp), %esi + movl 52(%esp), %edx + movl 24(%esp), %ebx + jmp ..B1.90 +..B1.88: + movl 28(%esp), %ecx + orl 36(%esp), %ecx + xorl %eax, %eax + orl 40(%esp), %ecx + orl %edi, %ecx + setne %al + xorl %edi, %edi + movl %eax, 56(%esp) + movl %edi, 40(%esp) + movl %edi, 36(%esp) + movl %edi, 28(%esp) + jmp ..B1.90 +..B1.89: + movl $0, 56(%esp) +..B1.90: + movl 80(%esp), %eax + cmpl 84(%esp), %eax + jne ..B1.94 +..B1.91: + movl 44(%esp), %eax + addl %eax, %edi + cmpl %eax, %edi + movl $0, %eax + movl 48(%esp), %ecx + setb %al + addl 40(%esp), %ecx + movl %edi, 4(%esp) + movl $0, %edi + adcl $0, %edi + addl %eax, %ecx + adcl $0, %edi + xorl %eax, %eax + addl 36(%esp), %esi + movl %ecx, 48(%esp) + adcl $0, %eax + addl %edi, %esi + adcl $0, %eax + xorl %edi, %edi + addl 28(%esp), %ebx + adcl $0, %edi + addl %eax, %ebx + adcl $0, %edi + movl 4(%esp), %edi + je ..B1.93 +..B1.92: + orl 48(%esp), %edi + movl %esi, %eax + shll $31, %eax + incl %edx + orl 56(%esp), %edi + movl %eax, 36(%esp) + movl %ebx, %edi + movl $0, %eax + setne %al + shll $31, %edi + shrl $1, %esi + shrl $1, %ebx + orl %edi, %esi + orl %eax, 36(%esp) + orl $-2147483648, %ebx + jmp ..B1.116 +..B1.93: + orl 56(%esp), %edi + movl $0, %eax + setne %al + orl 48(%esp), %eax + movl %eax, 36(%esp) + jmp ..B1.116 +..B1.94: + negl 56(%esp) + movl %edx, 52(%esp) + movl $0, %edx + movl 44(%esp), %ecx + setne %dl + xorl %eax, %eax + subl %edi, %ecx + movl 48(%esp), %edi + sbbl $0, %eax + subl %edx, %ecx + movl %ecx, 44(%esp) + sbbl $0, %eax + xorl %ecx, %ecx + subl 40(%esp), %edi + cltd + sbbl $0, %ecx + addl %eax, %edi + movl %edi, 48(%esp) + adcl %edx, %ecx + xorl %edi, %edi + subl 36(%esp), %esi + movl %ecx, %eax + cltd + sbbl $0, %edi + addl %esi, %ecx + movl %ecx, 32(%esp) + adcl %edx, %edi + subl 28(%esp), %ebx + movl 52(%esp), %edx + addl %edi, %ebx + je ..B1.96 +..B1.95: + movl $0, 28(%esp) + movl %ebx, %eax + jmp ..B1.104 +..B1.96: + cmpl $0, 32(%esp) + je ..B1.98 +..B1.97: + movl %ecx, %eax + movl $32, 28(%esp) + jmp ..B1.104 +..B1.98: + cmpl $0, 48(%esp) + je ..B1.100 +..B1.99: + movl 48(%esp), %eax + movl $64, 28(%esp) + jmp ..B1.104 +..B1.100: + cmpl $0, 44(%esp) + je ..B1.102 +..B1.101: + movl 44(%esp), %eax + movl $96, 28(%esp) + jmp ..B1.104 +..B1.102: + cmpl $0, 56(%esp) + je ..B1.165 +..B1.103: + movl 56(%esp), %eax + movl $128, 28(%esp) +..B1.104: + testl $-2147483648, %eax + jne ..B1.108 +..B1.105: + movl 28(%esp), %esi +..B1.106: + addl %eax, %eax + incl %esi + testl $-2147483648, %eax + je ..B1.106 +..B1.107: + movl %esi, 28(%esp) +..B1.108: + cmpl $32, 28(%esp) + jge ..B1.110 +..B1.109: + movl 28(%esp), %edi + movl %edi, %esi + movl %edx, 52(%esp) + movl %edi, %ecx + movl $1, %edx + negl %esi + movl %esi, (%esp) + shll %cl, %edx + movl 44(%esp), %esi + decl %edx + orl 56(%esp), %esi + movl %ebx, 24(%esp) + movl 48(%esp), %ebx + movl %ebx, %eax + movl %edx, 4(%esp) + movl $0, %edx + setne %dl + shll %cl, %eax + orl %edx, %eax + movl %eax, 36(%esp) + movl 32(%esp), %eax + movl %eax, %esi + shll %cl, %esi + movl (%esp), %ecx + shrl %cl, %ebx + movl %edi, %ecx + andl 4(%esp), %ebx + orl %ebx, %esi + movl 24(%esp), %ebx + shll %cl, %ebx + movl (%esp), %ecx + shrl %cl, %eax + andl 4(%esp), %eax + movl 52(%esp), %edx + orl %eax, %ebx + jmp ..B1.115 +..B1.110: + cmpl $64, 28(%esp) + jge ..B1.112 +..B1.111: + movl 28(%esp), %eax + movl %eax, %ecx + movl %edx, 52(%esp) + movl $1, %edx + shll %cl, %edx + movl %eax, %esi + decl %edx + negl %esi + cmpl $0, 56(%esp) + movl 44(%esp), %edi + movl %edi, %ebx + movl %edx, 4(%esp) + movl $0, %edx + setne %dl + shll %cl, %ebx + orl %edx, %ebx + movl %ebx, 36(%esp) + movl %esi, (%esp) + movl 48(%esp), %ebx + movl %ebx, %esi + shll %cl, %esi + movl (%esp), %ecx + shrl %cl, %edi + movl %eax, %ecx + andl 4(%esp), %edi + orl %edi, %esi + movl 32(%esp), %edi + shll %cl, %edi + movl (%esp), %ecx + shrl %cl, %ebx + andl 4(%esp), %ebx + movl 52(%esp), %edx + orl %edi, %ebx + jmp ..B1.115 +..B1.112: + cmpl $96, 28(%esp) + jge ..B1.114 +..B1.113: + movl 28(%esp), %eax + movl %eax, %esi + movl %eax, %ecx + movl $1, %edi + movl %edx, 52(%esp) + negl %esi + movl 56(%esp), %edx + movl 44(%esp), %ebx + shll %cl, %edx + movl %esi, (%esp) + movl %ebx, %esi + movl %edx, 36(%esp) + shll %cl, %edi + shll %cl, %esi + decl %edi + movl (%esp), %ecx + shrl %cl, %edx + movl %eax, %ecx + andl %edi, %edx + orl %edx, %esi + movl 48(%esp), %edx + shll %cl, %edx + movl (%esp), %ecx + shrl %cl, %ebx + andl %edi, %ebx + orl %edx, %ebx + movl 52(%esp), %edx + jmp ..B1.115 +..B1.114: + movl 28(%esp), %ecx + xorl %eax, %eax + movl 44(%esp), %ebx + xorl %esi, %esi + shll %cl, %ebx + cmpl $128, %ecx + movl %eax, 36(%esp) + jl ..L3 + movl $0, %ebx +..L3: +..B1.115: + subl 28(%esp), %edx +..B1.116: + lea -1(%edx), %edi + cmpl $32766, %edi + jb ..B1.126 +..B1.117: + cmpl $32767, %edx + jge ..B1.164 +..B1.118: + negl %edx + incl %edx + cmpl $32, %edx + jge ..B1.120 +..B1.119: + movl %edx, %edi + movl %edx, %ecx + negl %edi + xorl %eax, %eax + movl %edi, (%esp) + movl $-1, %edi + shrl %cl, %edi + cmpl $0, 36(%esp) + notl %edi + movl (%esp), %ecx + movl %esi, 20(%esp) + setne %al + shll %cl, %esi + andl %edi, %esi + orl %esi, %eax + movl %eax, 36(%esp) + movl %ebx, %eax + movl (%esp), %ecx + shll %cl, %eax + movl %edx, %ecx + movl 20(%esp), %esi + andl %edi, %eax + shrl %cl, %esi + shrl %cl, %ebx + orl %eax, %esi + jmp ..B1.125 +..B1.120: + cmpl $64, %edx + jge ..B1.122 +..B1.121: + movl %edx, %edi + movl %edx, %ecx + negl %edi + movl $-1, %eax + shrl %cl, %eax + movl %edi, %ecx + movl %ebx, %edi + notl %eax + shll %cl, %edi + movl %edx, %ecx + andl %eax, %edi + xorl %eax, %eax + orl 36(%esp), %esi + movl %ebx, %esi + setne %al + xorl %ebx, %ebx + orl %edi, %eax + movl %eax, 36(%esp) + shrl %cl, %esi + jmp ..B1.125 +..B1.122: + cmpl $96, %edx + jge ..B1.124 +..B1.123: + movl %edx, %edi + movl %edx, %ecx + negl %edi + movl $-1, %eax + movl %ebx, %edx + shrl %cl, %eax + shrl %cl, %edx + movl %edi, %ecx + shll %cl, %ebx + notl %eax + andl %eax, %ebx + orl %esi, %ebx + orl 36(%esp), %ebx + movl $0, %ebx + setne %bl + xorl %esi, %esi + orl %edx, %ebx + movl %ebx, 36(%esp) + xorl %ebx, %ebx + jmp ..B1.125 +..B1.124: + xorl %esi, %esi + movl $1, 36(%esp) + xorl %ebx, %ebx +..B1.125: + xorl %edx, %edx +..B1.126: + cmpl $0, 36(%esp) + je ..B1.163 +..B1.127: + movl 76(%esp), %edi + cmpl $0, 72(%esp) + fldt _small_value_80@GOTOFF(%edi) + fldl _ones@GOTOFF(%edi) + fadd %st(1), %st + fstpt 8(%esp) + je ..B1.194 +..B1.128: + cmpl $3072, 72(%esp) + je ..B1.159 +..B1.129: + cmpl $2048, 72(%esp) + jne ..B1.144 +..B1.130: + testl %edx, %edx + jne ..B1.138 +..B1.131: + cmpl $0, 80(%esp) + jne ..B1.137 +..B1.132: + cmpl $2147483647, %ebx + jb ..B1.137 +..B1.133: + jne ..B1.139 +..B1.134: + cmpl $-1, %esi + jb ..B1.137 +..B1.135: + jne ..B1.139 +..B1.136: + cmpl $-2147483648, 36(%esp) + jae ..B1.139 +..B1.137: + fmul %st(0), %st + fstpt 8(%esp) + fldt 8(%esp) +..B1.138: + cmpl $0, 80(%esp) + jne ..B1.211 +..B1.139: + fstp %st(0) + incl %esi + jne ..B1.142 +..B1.140: + movl $-2147483648, %edi + testl %edx, %edx + je ..L4 + movl $0, %edi +..L4: + incl %ebx + cmpl %edi, %ebx + jne ..B1.142 +..B1.141: + orl $-2147483648, %ebx + incl %edx +..B1.142: + cmpl $32767, %edx + jl ..B1.163 +..B1.143: + movl 80(%esp), %edx + movl 76(%esp), %ebx + lea (,%edx,8), %eax + fldt _large_value_80@GOTOFF(%ebx) + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 8(%esp) + fldt 8(%esp) + fstpt 20(%esp) + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.144: + cmpl $1024, 72(%esp) + jne ..B1.211 +..B1.145: + testl %edx, %edx + jne ..B1.153 +..B1.146: + cmpl $0, 80(%esp) + je ..B1.152 +..B1.147: + cmpl $2147483647, %ebx + jb ..B1.152 +..B1.148: + jne ..B1.154 +..B1.149: + cmpl $-1, %esi + jb ..B1.152 +..B1.150: + jne ..B1.154 +..B1.151: + cmpl $-2147483648, 36(%esp) + jae ..B1.154 +..B1.152: + fmul %st(0), %st + fstpt 8(%esp) + fldt 8(%esp) +..B1.153: + cmpl $0, 80(%esp) + je ..B1.211 +..B1.154: + fstp %st(0) + incl %esi + jne ..B1.157 +..B1.155: + movl $-2147483648, %edi + testl %edx, %edx + je ..L5 + movl $0, %edi +..L5: + incl %ebx + cmpl %edi, %ebx + jne ..B1.157 +..B1.156: + orl $-2147483648, %ebx + incl %edx +..B1.157: + cmpl $32767, %edx + jl ..B1.163 +..B1.158: + movl 80(%esp), %edx + movl 76(%esp), %ebx + lea (,%edx,8), %eax + fldt _large_value_80@GOTOFF(%ebx) + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 8(%esp) + fldt 8(%esp) + fstpt 20(%esp) + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.159: + testl %edx, %edx + je ..B1.162 +..B1.160: + lea -1(%edx), %eax + lea -2147483648(%ebx), %edi + orl %edi, %eax + orl %esi, %eax + jne ..B1.211 +..B1.161: + cmpl $-2147483648, 36(%esp) + jne ..B1.211 +..B1.162: + fmul %st(0), %st + fstpt 8(%esp) +..B1.163: + movzbl 29(%esp), %eax + andl $32767, %edx + movl 80(%esp), %edi + andl $127, %eax + shll $7, %edi + orl %edi, %eax + movb %al, 29(%esp) + movzwl 28(%esp), %edi + andl $-32768, %edi + orl %edx, %edi + movw %di, 28(%esp) + movl %ebx, 24(%esp) + movl %esi, 20(%esp) + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.164: + movl 80(%esp), %edx + movl 76(%esp), %ebx + lea (,%edx,8), %eax + fldt _large_value_80@GOTOFF(%ebx) + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 8(%esp) + fldt 8(%esp) + fstpt 20(%esp) + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.165: + xorl %eax, %eax + cmpl $1024, 72(%esp) + movl 76(%esp), %edi + sete %al + fldl _zeros@GOTOFF(%edi,%eax,8) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.166: + xorl %edx, %edx + jmp ..B1.38 +..B1.167: + cmpl $-2147483648, 36(%ebp) + jne ..B1.169 +..B1.168: + cmpl $0, 32(%ebp) + je ..B1.31 +..B1.169: + movzwl 62(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.175 +..B1.170: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.171: + fldcw 60(%esp) +..B1.172: + fldt 32(%ebp) + fldt 8(%ebp) + fmulp %st, %st(1) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt 20(%esp) +..B1.173: + fldcw 62(%esp) +..B1.174: + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.175: + fldt 32(%ebp) + fldt 8(%ebp) + fmulp %st, %st(1) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt 20(%esp) + jmp ..B1.174 +..B1.176: + cmpl $-2147483648, 24(%ebp) + jne ..B1.178 +..B1.177: + cmpl $0, 20(%ebp) + je ..B1.30 +..B1.178: + movzwl 62(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.184 +..B1.179: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.180: + fldcw 60(%esp) +..B1.181: + fldt 20(%ebp) + fldt 32(%ebp) + fmulp %st, %st(1) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 20(%esp) +..B1.182: + fldcw 62(%esp) +..B1.183: + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.184: + fldt 20(%ebp) + fldt 32(%ebp) + fmulp %st, %st(1) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 20(%esp) + jmp ..B1.183 +..B1.185: + cmpl $-2147483648, 12(%ebp) + jne ..B1.187 +..B1.186: + cmpl $0, 8(%ebp) + je ..B1.29 +..B1.187: + movzwl 62(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.193 +..B1.188: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.189: + fldcw 60(%esp) +..B1.190: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fldt 32(%ebp) + fmulp %st, %st(1) + fstpt 20(%esp) +..B1.191: + fldcw 62(%esp) +..B1.192: + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.193: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fldt 32(%ebp) + fmulp %st, %st(1) + fstpt 20(%esp) + jmp ..B1.192 +..B1.194: + testl $-2147483648, 36(%esp) + je ..B1.159 +..B1.195: + movl %esi, %eax + movl 36(%esp), %edi + andl $1, %eax + andl $2147483647, %edi + orl %edi, %eax + je ..B1.159 +..B1.196: + incl %esi + jne ..B1.199 +..B1.197: + movl $-2147483648, %edi + testl %edx, %edx + je ..L6 + movl $0, %edi +..L6: + incl %ebx + cmpl %edi, %ebx + jne ..B1.199 +..B1.198: + orl $-2147483648, %ebx + incl %edx +..B1.199: + cmpl $32767, %edx + jl ..B1.159 +..B1.200: + fstp %st(0) + movl 80(%esp), %edx + movl 76(%esp), %ebx + lea (,%edx,8), %eax + fldt _large_value_80@GOTOFF(%ebx) + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 8(%esp) + fldt 8(%esp) + fstpt 20(%esp) + fldt 20(%esp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.201: + xorl %eax, %eax + jmp ..B1.61 +..B1.202: + cmpl $-2147483648, 24(%ebp) + jne ..B1.14 +..B1.203: + cmpl $0, 20(%ebp) + je ..B1.18 + jmp ..B1.14 +..B1.204: + cmpl $-2147483648, 12(%ebp) + jne ..B1.9 +..B1.205: + cmpl $0, 8(%ebp) + je ..B1.21 + jmp ..B1.9 +..B1.206: + fldt 32(%ebp) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.211: + fstp %st(0) + jmp ..B1.163 + .align 16,0x90 + .type fmal,@function + .size fmal,.-fmal + .data +# -- End fmal + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmax_wmt.S b/external/sgx_libm/ia32/fmax_wmt.S new file mode 100644 index 0000000000..4359fdb54f --- /dev/null +++ b/external/sgx_libm/ia32/fmax_wmt.S @@ -0,0 +1,113 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmax_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fmax + .text + .align 16,0x90 + .globl fmax +fmax: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $88, %esp + movl %ebx, 32(%esp) + call static_func + movl %eax, %ebx + movsd 96(%esp), %xmm0 + movsd 104(%esp), %xmm1 + ucomisd %xmm0, %xmm1 + jp .L_2TAG_PACKET_0.0.2 + jc .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + fldl 104(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + ucomisd %xmm0, %xmm0 + jp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + fldl 96(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_3.0.2: + movl 32(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fmax,@function + .size fmax,.-fmax + .data +# -- End fmax + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmaxf_wmt.S b/external/sgx_libm/ia32/fmaxf_wmt.S new file mode 100644 index 0000000000..736bb2354a --- /dev/null +++ b/external/sgx_libm/ia32/fmaxf_wmt.S @@ -0,0 +1,113 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmaxf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fmaxf + .text + .align 16,0x90 + .globl fmaxf +fmaxf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $88, %esp + movl %ebx, 32(%esp) + call static_func + movl %eax, %ebx + movss 96(%esp), %xmm0 + movss 100(%esp), %xmm1 + ucomiss %xmm0, %xmm1 + jp .L_2TAG_PACKET_0.0.2 + jc .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + flds 100(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + ucomiss %xmm0, %xmm0 + jp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + flds 96(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_3.0.2: + movl 32(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fmaxf,@function + .size fmaxf,.-fmaxf + .data +# -- End fmaxf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmaxl.S b/external/sgx_libm/ia32/fmaxl.S new file mode 100644 index 0000000000..6f40bb3fc4 --- /dev/null +++ b/external/sgx_libm/ia32/fmaxl.S @@ -0,0 +1,189 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmaxl.c" + .text +..TXTST0: +# -- Begin fmaxl + .text + .align 16,0x90 + .globl fmaxl +fmaxl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + movl %eax, %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.33 +..B1.4: + movzwl 28(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.16 +..B1.5: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.15 +..B1.6: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %edx +..B1.9: + fldt 8(%ebp) + fstpt 16(%esp) + fldt 16(%esp) + fldt 20(%ebp) + fxch %st(1) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.11 +..B1.10: + fstp %st(0) + jmp ..B1.12 +..B1.11: + fstpt 16(%esp) +..B1.12: + testl %edx, %edx + je ..B1.14 +..B1.13: + fldcw 14(%esp) +..B1.14: + fldt 16(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.15: + xorl %edx, %edx + jmp ..B1.9 +..B1.16: + cmpl $-2147483648, 24(%ebp) + jne ..B1.18 +..B1.17: + cmpl $0, 20(%ebp) + je ..B1.5 +..B1.18: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.32 +..B1.19: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.20: + fldcw 12(%esp) +..B1.21: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) +..B1.22: + fldcw 14(%esp) + movzwl 16(%ebp), %eax +..B1.23: + andl $32767, %eax + cmpl $32767, %eax + je ..B1.25 +..B1.24: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.25: + cmpl $-2147483648, 12(%ebp) + jne ..B1.27 +..B1.26: + cmpl $0, 8(%ebp) + je ..B1.24 +..B1.27: + movzwl 28(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.29 +..B1.28: + fldt 20(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.29: + cmpl $-2147483648, 24(%ebp) + jne ..B1.31 +..B1.30: + cmpl $0, 20(%ebp) + je ..B1.28 +..B1.31: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.32: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.23 +..B1.33: + cmpl $-2147483648, 12(%ebp) + jne ..B1.18 +..B1.34: + cmpl $0, 8(%ebp) + je ..B1.4 + jmp ..B1.18 + .align 16,0x90 + .type fmaxl,@function + .size fmaxl,.-fmaxl + .data +# -- End fmaxl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmin_wmt.S b/external/sgx_libm/ia32/fmin_wmt.S new file mode 100644 index 0000000000..1fd7131d75 --- /dev/null +++ b/external/sgx_libm/ia32/fmin_wmt.S @@ -0,0 +1,113 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmin_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fmin + .text + .align 16,0x90 + .globl fmin +fmin: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $88, %esp + movl %ebx, 32(%esp) + call static_func + movl %eax, %ebx + movsd 96(%esp), %xmm0 + movsd 104(%esp), %xmm1 + ucomisd %xmm1, %xmm0 + jp .L_2TAG_PACKET_0.0.2 + jc .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + fldl 104(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + ucomisd %xmm0, %xmm0 + jp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + fldl 96(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_3.0.2: + movl 32(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fmin,@function + .size fmin,.-fmin + .data +# -- End fmin + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fminf_wmt.S b/external/sgx_libm/ia32/fminf_wmt.S new file mode 100644 index 0000000000..ccc69eb475 --- /dev/null +++ b/external/sgx_libm/ia32/fminf_wmt.S @@ -0,0 +1,113 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fminf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fminf + .text + .align 16,0x90 + .globl fminf +fminf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $88, %esp + movl %ebx, 32(%esp) + call static_func + movl %eax, %ebx + movss 96(%esp), %xmm0 + movss 100(%esp), %xmm1 + ucomiss %xmm1, %xmm0 + jp .L_2TAG_PACKET_0.0.2 + jc .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + flds 100(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + ucomiss %xmm0, %xmm0 + jp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + flds 96(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_3.0.2: + movl 32(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fminf,@function + .size fminf,.-fminf + .data +# -- End fminf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fminl.S b/external/sgx_libm/ia32/fminl.S new file mode 100644 index 0000000000..ea94a255d0 --- /dev/null +++ b/external/sgx_libm/ia32/fminl.S @@ -0,0 +1,190 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fminl.c" + .text +..TXTST0: +# -- Begin fminl + .text + .align 16,0x90 + .globl fminl +fminl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + movl %eax, %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.33 +..B1.4: + movzwl 28(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.16 +..B1.5: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.15 +..B1.6: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %edx +..B1.9: + fldt 8(%ebp) + fstpt 16(%esp) + fldt 16(%esp) + fldt 20(%ebp) + fcom %st(1) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jbe ..B1.11 +..B1.10: + fstp %st(0) + jmp ..B1.12 +..B1.11: + fstpt 16(%esp) +..B1.12: + testl %edx, %edx + je ..B1.14 +..B1.13: + fldcw 14(%esp) +..B1.14: + fldt 16(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.15: + xorl %edx, %edx + jmp ..B1.9 +..B1.16: + cmpl $-2147483648, 24(%ebp) + jne ..B1.18 +..B1.17: + cmpl $0, 20(%ebp) + je ..B1.5 +..B1.18: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.32 +..B1.19: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.20: + fldcw 12(%esp) +..B1.21: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) +..B1.22: + fldcw 14(%esp) + movzwl 16(%ebp), %eax +..B1.23: + andl $32767, %eax + cmpl $32767, %eax + je ..B1.25 +..B1.24: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.25: + cmpl $-2147483648, 12(%ebp) + jne ..B1.27 +..B1.26: + cmpl $0, 8(%ebp) + je ..B1.24 +..B1.27: + movzwl 28(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.29 +..B1.28: + fldt 20(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.29: + cmpl $-2147483648, 24(%ebp) + jne ..B1.31 +..B1.30: + cmpl $0, 20(%ebp) + je ..B1.28 +..B1.31: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.32: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.23 +..B1.33: + cmpl $-2147483648, 12(%ebp) + jne ..B1.18 +..B1.34: + cmpl $0, 8(%ebp) + je ..B1.4 + jmp ..B1.18 + .align 16,0x90 + .type fminl,@function + .size fminl,.-fminl + .data +# -- End fminl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmod_wmt.S b/external/sgx_libm/ia32/fmod_wmt.S new file mode 100644 index 0000000000..5355b80710 --- /dev/null +++ b/external/sgx_libm/ia32/fmod_wmt.S @@ -0,0 +1,214 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmod_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin fmod + .text + .align 16,0x90 + .globl fmod +fmod: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 120(%esp), %xmm1 + movsd 112(%esp), %xmm0 + fldl 120(%esp) + fldl 112(%esp) + unpcklpd %xmm0, %xmm1 + movdqa (%ebx), %xmm2 + pshufd $212, %xmm1, %xmm1 + movdqa 16(%ebx), %xmm3 + pand %xmm2, %xmm1 + pcmpeqd %xmm1, %xmm3 + movmskps %xmm3, %eax + cmpl $2, %eax + jg .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + fprem + fstsw %ax + sahf + jp .L_2TAG_PACKET_1.0.3 + fstp %st(1) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movl %eax, %edx + andl $3, %eax + cmpl $3, %eax + jne .L_2TAG_PACKET_3.0.3 + movl 112(%esp), %edx + movl 116(%esp), %ecx + xorl %eax, %eax + andl $2147483647, %ecx + subl %edx, %eax + orl %edx, %eax + shrl $31, %eax + orl %eax, %ecx + cmpl $2146435072, %ecx + ja .L_2TAG_PACKET_4.0.3 + fstp %st(0) + fstp %st(0) + movl $2139095040, 8(%esp) + fldz + flds 8(%esp) + fmulp + fstpl (%esp) + movl $121, %edx +.L_2TAG_PACKET_5.0.3: + movsd 112(%esp), %xmm0 + movsd 120(%esp), %xmm1 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 120(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_3.0.3: + movl 112(%esp), %eax + xorl %ecx, %ecx + subl %eax, %ecx + orl %ecx, %eax + shrl $31, %eax + movl 116(%esp), %ecx + orl %ecx, %eax + andl $2147483647, %eax + movl 120(%esp), %edx + xorl %ecx, %ecx + subl %edx, %ecx + orl %ecx, %edx + shrl $31, %edx + movl 124(%esp), %ecx + orl %ecx, %edx + andl $2147483647, %edx + cmpl $2146435072, %eax + ja .L_2TAG_PACKET_4.0.3 + cmpl $2146435072, %edx + ja .L_2TAG_PACKET_4.0.3 + cmpl $2146435072, %eax + je .L_2TAG_PACKET_7.0.3 + fstp %st(1) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + faddp + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_7.0.3: + fstp %st(1) + fldz + fmulp + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_2.0.3: +.L_2TAG_PACKET_6.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type fmod,@function + .size fmod,.-fmod + .data +# -- End fmod + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2147483647 + .long 2146435072 + .long 2146435072 + .long 0 + .long 0 + .long 2146435072 + .long 2146435072 + .type static_const_table,@object + .size static_const_table,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmodf.S b/external/sgx_libm/ia32/fmodf.S new file mode 100644 index 0000000000..45adea29c7 --- /dev/null +++ b/external/sgx_libm/ia32/fmodf.S @@ -0,0 +1,156 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmodf.c" + .text +..TXTST0: +# -- Begin fmodf + .text + .align 16,0x90 + .globl fmodf +fmodf: +# parameter 1: 16 + %esp +# parameter 2: 20 + %esp +..B1.1: +..L1: + + subl $12, %esp + movzwl 22(%esp), %ecx + andl $32640, %ecx + shrl $7, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + testl %ecx, %ecx + jne ..B1.3 +..B1.2: + testl $8388607, 20(%esp) + je ..B1.8 +..B1.3: + movzwl 18(%esp), %edx + andl $32640, %edx + shrl $7, %edx + cmpl $255, %edx + je ..B1.22 +..B1.4: + cmpl $255, %ecx + je ..B1.12 +..B1.6: + flds 20(%esp) + flds 16(%esp) +.L_2TAG_PACKET_0.0.2: + fprem + fstsw %ax + sahf + jp .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstps (%esp) +..B1.7: + flds (%esp) + addl $12, %esp + ret +..B1.8: + movzwl 18(%esp), %edx + andl $32640, %edx + cmpl $32640, %edx + jne ..B1.11 +..B1.9: + testl $8388607, 16(%esp) + je ..B1.11 +..B1.10: + flds 16(%esp) + fadds 20(%esp) + addl $12, %esp + ret +..B1.11: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%eax) + fsts (%esp) + addl $12, %esp + ret +..B1.12: + testl $8388607, 20(%esp) + jne ..B1.16 +..B1.13: + cmpl $255, %edx + je ..B1.20 +..B1.14: + cmpl $255, %ecx + je ..B1.17 + jmp ..B1.6 +..B1.16: + flds 16(%esp) + fadds 20(%esp) + addl $12, %esp + ret +..B1.17: + testl $8388607, 20(%esp) + jne ..B1.6 +..B1.18: + flds 16(%esp) + addl $12, %esp + ret +..B1.20: + testl $8388607, 16(%esp) + jne ..B1.14 +..B1.21: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%eax) + addl $12, %esp + ret +..B1.22: + testl $8388607, 16(%esp) + jne ..B1.16 +..B1.23: + cmpl $255, %ecx + je ..B1.12 + jmp ..B1.13 + .align 16,0x90 + .type fmodf,@function + .size fmodf,.-fmodf + .data +# -- End fmodf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x7f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fmodl.S b/external/sgx_libm/ia32/fmodl.S new file mode 100644 index 0000000000..7413bbd1ba --- /dev/null +++ b/external/sgx_libm/ia32/fmodl.S @@ -0,0 +1,336 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmodl.c" + .text +..TXTST0: +# -- Begin fmodl + .text + .align 16,0x90 + .globl fmodl +fmodl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + subl $28, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 28(%ebp), %edx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + andl $32767, %edx + jne ..B1.6 +..B1.4: + cmpl $0, 24(%ebp) + jne ..B1.6 +..B1.5: + cmpl $0, 20(%ebp) + je ..B1.45 +..B1.6: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.42 +..B1.7: + cmpl $32767, %edx + je ..B1.17 +..B1.8: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.16 +..B1.9: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + movl $1, %esi +..B1.12: + addl $-16, %esp + lea 8(%ebp), %eax + movl %eax, (%esp) + call __fmodl +..B1.60: + fstpt 16(%esp) + addl $16, %esp +..B1.13: + testl %esi, %esi + je ..B1.15 +..B1.14: + fldcw 14(%esp) +..B1.15: + fldt (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + xorl %esi, %esi + jmp ..B1.12 +..B1.17: + cmpl $-2147483648, 24(%ebp) + jne ..B1.19 +..B1.18: + cmpl $0, 20(%ebp) + je ..B1.25 +..B1.19: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.31 +..B1.20: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.21: + fldcw 12(%esp) +..B1.22: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) +..B1.23: + fldcw 14(%esp) +..B1.24: + fldt (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + cmpl $32767, %ecx + je ..B1.32 +..B1.26: + testl %ecx, %ecx + jne ..B1.30 +..B1.27: + cmpl $0, 12(%ebp) + jne ..B1.29 +..B1.28: + cmpl $0, 8(%ebp) + je ..B1.30 +..B1.29: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.30: + fldt 8(%ebp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.24 +..B1.32: + cmpl $-2147483648, 12(%ebp) + jne ..B1.30 +..B1.33: + cmpl $0, 8(%ebp) + jne ..B1.30 +..B1.34: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.41 +..B1.35: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.36: + fldcw 12(%esp) +..B1.37: + movl $1, %edx +..B1.38: + fldl _infs@GOTOFF(%eax) + testl %edx, %edx + fmull _zeros@GOTOFF(%eax) + fstpl (%esp) + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldl (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + xorl %edx, %edx + jmp ..B1.38 +..B1.42: + cmpl $-2147483648, 12(%ebp) + jne ..B1.19 +..B1.43: + cmpl $0, 8(%ebp) + jne ..B1.19 +..B1.44: + cmpl $32767, %edx + je ..B1.17 + jmp ..B1.25 +..B1.45: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.57 +..B1.46: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.47: + fldcw 12(%esp) +..B1.48: + movl $1, %ecx +..B1.49: + movzwl 16(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + jne ..B1.53 +..B1.50: + cmpl $-2147483648, 12(%ebp) + jne ..B1.52 +..B1.51: + cmpl $0, 8(%ebp) + je ..B1.53 +..B1.52: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) + jmp ..B1.54 +..B1.53: + fldl _infs@GOTOFF(%eax) + fmull _zeros@GOTOFF(%eax) + fstpt (%esp) +..B1.54: + testl %ecx, %ecx + je ..B1.56 +..B1.55: + fldcw 14(%esp) +..B1.56: + fldt (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.57: + xorl %ecx, %ecx + jmp ..B1.49 + .align 16,0x90 + .type fmodl,@function + .size fmodl,.-fmodl + .data +# -- End fmodl + .text +# -- Begin __fmodl + .text + .align 16,0x90 +__fmodl: +# parameter 1: 4 + %esp +..B2.1: +..L3: + +..B2.2: + movl 4(%esp), %ecx + fldt 12(%ecx) + fldt (%ecx) +.L_2TAG_PACKET_0.0.2: + fprem + fstsw %ax + sahf + jp .L_2TAG_PACKET_0.0.2 + fstp %st(1) + ret +..B2.3: + .align 16,0x90 + .type __fmodl,@function + .size __fmodl,.-__fmodl + .data +# -- End __fmodl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/fpclassify.S b/external/sgx_libm/ia32/fpclassify.S new file mode 100644 index 0000000000..9eec1838b3 --- /dev/null +++ b/external/sgx_libm/ia32/fpclassify.S @@ -0,0 +1,465 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fpclassify.c" + .text +..TXTST0: +# -- Begin __fpclassifyd + .text + .align 16,0x90 + .globl __fpclassifyd +__fpclassifyd: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + fldl 4(%esp) + fwait + fstp %st(0) + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + cmpl $2146435072, %edx + jb ..B1.6 +..B1.2: + movl $2146435072, %eax + subl %eax, %edx + jb ..B1.4 +..B1.14: + orl %edx, %ecx + je ..B1.4 +..B1.3: + xorl %eax, %eax + ret +..B1.4: + movl $1, %eax +..B1.5: + ret +..B1.6: + cmpl $1048576, %edx + jae ..B1.11 +..B1.7: + orl %edx, %ecx + je ..B1.9 +..B1.8: + movl $3, %eax + ret +..B1.9: + movl $2, %eax +..B1.10: + ret +..B1.11: + movl $4, %eax + ret + .align 16,0x90 + .type __fpclassifyd,@function + .size __fpclassifyd,.-__fpclassifyd + .data +# -- End __fpclassifyd + .text +# -- Begin fpclassifyd + .text + .align 16,0x90 + .globl fpclassifyd +fpclassifyd: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + fldl 4(%esp) + fwait + fstp %st(0) + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + cmpl $2146435072, %edx + jb ..B2.6 +..B2.2: + movl $2146435072, %eax + subl %eax, %edx + jb ..B2.4 +..B2.14: + orl %edx, %ecx + je ..B2.4 +..B2.3: + xorl %eax, %eax + ret +..B2.4: + movl $1, %eax +..B2.5: + ret +..B2.6: + cmpl $1048576, %edx + jae ..B2.11 +..B2.7: + orl %edx, %ecx + je ..B2.9 +..B2.8: + movl $3, %eax + ret +..B2.9: + movl $2, %eax +..B2.10: + ret +..B2.11: + movl $4, %eax + ret + .align 16,0x90 + .type fpclassifyd,@function + .size fpclassifyd,.-fpclassifyd + .data +# -- End fpclassifyd + .text +# -- Begin __fpclassify + .text + .align 16,0x90 + .globl __fpclassify +__fpclassify: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + fldl 4(%esp) + fwait + fstp %st(0) + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + cmpl $2146435072, %edx + jb ..B3.6 +..B3.2: + movl $2146435072, %eax + subl %eax, %edx + jb ..B3.4 +..B3.14: + orl %edx, %ecx + je ..B3.4 +..B3.3: + xorl %eax, %eax + ret +..B3.4: + movl $1, %eax +..B3.5: + ret +..B3.6: + cmpl $1048576, %edx + jae ..B3.11 +..B3.7: + orl %edx, %ecx + je ..B3.9 +..B3.8: + movl $3, %eax + ret +..B3.9: + movl $2, %eax +..B3.10: + ret +..B3.11: + movl $4, %eax + ret + .align 16,0x90 + .type __fpclassify,@function + .size __fpclassify,.-__fpclassify + .data +# -- End __fpclassify + .text +# -- Begin fpclassify + .text + .align 16,0x90 + .globl fpclassify +fpclassify: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + fldl 4(%esp) + fwait + fstp %st(0) + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + cmpl $2146435072, %edx + jb ..B4.6 +..B4.2: + movl $2146435072, %eax + subl %eax, %edx + jb ..B4.4 +..B4.14: + orl %edx, %ecx + je ..B4.4 +..B4.3: + xorl %eax, %eax + ret +..B4.4: + movl $1, %eax +..B4.5: + ret +..B4.6: + cmpl $1048576, %edx + jae ..B4.11 +..B4.7: + orl %edx, %ecx + je ..B4.9 +..B4.8: + movl $3, %eax + ret +..B4.9: + movl $2, %eax +..B4.10: + ret +..B4.11: + movl $4, %eax + ret + .align 16,0x90 + .type fpclassify,@function + .size fpclassify,.-fpclassify + .data +# -- End fpclassify + .text +# -- Begin __fpclassifyf + .text + .align 16,0x90 + .globl __fpclassifyf +__fpclassifyf: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + flds 4(%esp) + fwait + fstp %st(0) + movl 4(%esp), %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jb ..B5.3 +..B5.2: + movl $0, %eax + setbe %al + ret +..B5.3: + cmpl $8388608, %edx + jae ..B5.5 +..B5.4: + testl %edx, %edx + movl $0, %eax + setne %al + addl $2, %eax + ret +..B5.5: + movl $4, %eax + ret + .align 16,0x90 + .type __fpclassifyf,@function + .size __fpclassifyf,.-__fpclassifyf + .data +# -- End __fpclassifyf + .text +# -- Begin fpclassifyf + .text + .align 16,0x90 + .globl fpclassifyf +fpclassifyf: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + flds 4(%esp) + fwait + fstp %st(0) + movl 4(%esp), %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jb ..B6.3 +..B6.2: + movl $0, %eax + setbe %al + ret +..B6.3: + cmpl $8388608, %edx + jae ..B6.5 +..B6.4: + testl %edx, %edx + movl $0, %eax + setne %al + addl $2, %eax + ret +..B6.5: + movl $4, %eax + ret + .align 16,0x90 + .type fpclassifyf,@function + .size fpclassifyf,.-fpclassifyf + .data +# -- End fpclassifyf + .text +# -- Begin __fpclassifyl + .text + .align 16,0x90 + .globl __fpclassifyl +__fpclassifyl: +# parameter 1: 8 + %esp +..B7.1: +..L7: + + pushl %ebx + movzwl 16(%esp), %ecx + andl $32767, %ecx + movl 12(%esp), %ebx + movl %ecx, %eax + movl %ebx, %edx + shll $16, %eax + shrl $16, %edx + orl %edx, %eax + cmpl $2147418112, %eax + jb ..B7.5 +..B7.2: + cmpl $32767, %ecx + je ..B7.12 +..B7.3: + xorl %eax, %eax +..B7.4: + popl %ebx + ret +..B7.5: + cmpl $65536, %eax + jae ..B7.11 +..B7.6: + testl %ebx, %ebx + jne ..B7.8 +..B7.7: + cmpl $0, 8(%esp) + je ..B7.9 +..B7.8: + movl $3, %eax + popl %ebx + ret +..B7.9: + movl $2, %eax +..B7.10: + popl %ebx + ret +..B7.11: + andl $32768, %eax + shrl $15, %eax + addl $3, %eax + popl %ebx + ret +..B7.12: + cmpl $-2147483648, %ebx + jne ..B7.3 +..B7.13: + cmpl $0, 8(%esp) + jne ..B7.3 +..B7.14: + movl $1, %eax + popl %ebx + ret + .align 16,0x90 + .type __fpclassifyl,@function + .size __fpclassifyl,.-__fpclassifyl + .data +# -- End __fpclassifyl + .text +# -- Begin fpclassifyl + .text + .align 16,0x90 + .globl fpclassifyl +fpclassifyl: +# parameter 1: 8 + %esp +..B8.1: +..L8: + + pushl %ebx + movzwl 16(%esp), %ecx + andl $32767, %ecx + movl 12(%esp), %ebx + movl %ecx, %eax + movl %ebx, %edx + shll $16, %eax + shrl $16, %edx + orl %edx, %eax + cmpl $2147418112, %eax + jb ..B8.5 +..B8.2: + cmpl $32767, %ecx + je ..B8.12 +..B8.3: + xorl %eax, %eax +..B8.4: + popl %ebx + ret +..B8.5: + cmpl $65536, %eax + jae ..B8.11 +..B8.6: + testl %ebx, %ebx + jne ..B8.8 +..B8.7: + cmpl $0, 8(%esp) + je ..B8.9 +..B8.8: + movl $3, %eax + popl %ebx + ret +..B8.9: + movl $2, %eax +..B8.10: + popl %ebx + ret +..B8.11: + andl $32768, %eax + shrl $15, %eax + addl $3, %eax + popl %ebx + ret +..B8.12: + cmpl $-2147483648, %ebx + jne ..B8.3 +..B8.13: + cmpl $0, 8(%esp) + jne ..B8.3 +..B8.14: + movl $1, %eax + popl %ebx + ret + .align 16,0x90 + .type fpclassifyl,@function + .size fpclassifyl,.-fpclassifyl + .data +# -- End fpclassifyl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/frexp_wmt.S b/external/sgx_libm/ia32/frexp_wmt.S new file mode 100644 index 0000000000..28f863b30d --- /dev/null +++ b/external/sgx_libm/ia32/frexp_wmt.S @@ -0,0 +1,149 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "frexp_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin frexp + .text + .align 16,0x90 + .globl frexp +frexp: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd %xmm0, 8(%esp) + movl 120(%esp), %ecx + pextrw $3, %xmm0, %eax + movq (%ebx), %xmm1 + andl $32767, %eax + movq 16(%ebx), %xmm2 + subl $16, %eax + js .L_2TAG_PACKET_0.0.2 + cmpl $32736, %eax + jae .L_2TAG_PACKET_1.0.2 + shrl $4, %eax + pand %xmm1, %xmm0 + subl $1021, %eax + por %xmm2, %xmm0 + movl %eax, (%ecx) + movq %xmm0, 8(%esp) + fldl 8(%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + pxor %xmm3, %xmm3 + movq 32(%ebx), %xmm4 + xorl %eax, %eax + comisd %xmm3, %xmm0 + je .L_2TAG_PACKET_3.0.2 + mulsd %xmm4, %xmm0 + pextrw $3, %xmm0, %eax + andl $32767, %eax + pand %xmm1, %xmm0 + shrl $4, %eax + por %xmm2, %xmm0 + subl $1077, %eax + movq %xmm0, 8(%esp) +.L_2TAG_PACKET_3.0.2: + movl %eax, (%ecx) + fldl 8(%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + xorl %eax, %eax + fld1 + movl %eax, (%ecx) + fmull 8(%esp) +.L_2TAG_PACKET_2.0.2: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type frexp,@function + .size frexp,.-frexp + .data +# -- End frexp + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2148532223 + .long 4294967295 + .long 2148532223 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .type static_const_table,@object + .size static_const_table,48 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/frexpf.S b/external/sgx_libm/ia32/frexpf.S new file mode 100644 index 0000000000..56c001b928 --- /dev/null +++ b/external/sgx_libm/ia32/frexpf.S @@ -0,0 +1,112 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "frexpf.c" + .text +..TXTST0: +# -- Begin frexpf + .text + .align 16,0x90 + .globl frexpf +frexpf: +# parameter 1: 8 + %esp +# parameter 2: 12 + %esp +..B1.1: +..L1: + + pushl %edi + movl 8(%esp), %ecx + movl %ecx, %edx + andl $2147483647, %edx + movl 12(%esp), %eax + lea -8388608(%edx), %edi + cmpl $2130706432, %edi + jb ..B1.5 +..B1.2: + decl %edx + cmpl $2139095039, %edx + jae ..B1.6 +..B1.3: + flds 8(%esp) + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + fmuls .L_2il0floatpacket.0@GOTOFF(%edx) + fstps 8(%esp) + movl 8(%esp), %ecx + movl %ecx, %edi + andl $2147483647, %edi + andl $-2139095041, %ecx + shrl $23, %edi + orl $1056964608, %ecx + movl %ecx, 8(%esp) + addl $-151, %edi + flds 8(%esp) + movl %edi, (%eax) +..B1.4: + popl %edi + ret +..B1.5: + andl $-2139095041, %ecx + shrl $23, %edi + orl $1056964608, %ecx + movl %ecx, 8(%esp) + addl $-125, %edi + flds 8(%esp) + movl %edi, (%eax) + popl %edi + ret +..B1.6: + flds 8(%esp) + movl $0, (%eax) + popl %edi + ret + .align 16,0x90 + .type frexpf,@function + .size frexpf,.-frexpf + .data +# -- End frexpf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/frexpl.S b/external/sgx_libm/ia32/frexpl.S new file mode 100644 index 0000000000..09d572fc81 --- /dev/null +++ b/external/sgx_libm/ia32/frexpl.S @@ -0,0 +1,171 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "frexpl.c" + .text +..TXTST0: +# -- Begin frexpl + .text + .align 16,0x90 + .globl frexpl +frexpl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + movl 20(%ebp), %edx +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %ecx + movl %ecx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.16 +..B1.4: + testl %eax, %eax + jne ..B1.14 +..B1.5: + cmpl $0, 12(%ebp) + jne ..B1.8 +..B1.6: + cmpl $0, 8(%ebp) + jne ..B1.8 +..B1.7: + fldt 8(%ebp) + movl $0, (%edx) + movl %ebp, %esp + popl %ebp + ret +..B1.8: + movzwl 14(%esp), %eax + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + je ..B1.15 +..B1.9: + orl $-64768, %eax + movl $0, (%edx) + movw %ax, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%ecx) + fstpt 8(%ebp) +..B1.12: + fldcw 14(%esp) +..B1.13: + movzwl 16(%ebp), %ecx + movl %ecx, %eax + andl $-32768, %ecx + andl $32767, %eax + orl $-49154, %ecx + addl $-16457, %eax + movw %cx, 16(%ebp) + fldt 8(%ebp) + movl %eax, (%edx) + movl %ebp, %esp + popl %ebp + ret +..B1.14: + andl $-32768, %ecx + addl $-16382, %eax + orl $-49154, %ecx + movw %cx, 16(%ebp) + fldt 8(%ebp) + movl %eax, (%edx) + movl %ebp, %esp + popl %ebp + ret +..B1.15: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%ecx) + fstpt 8(%ebp) + jmp ..B1.13 +..B1.16: + movl $0, (%edx) + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.22 +..B1.17: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.18: + fldcw 12(%esp) +..B1.19: + fldt 8(%ebp) + fstpt (%esp) +..B1.20: + fldcw 14(%esp) +..B1.21: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.22: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.21 + .align 16,0x90 + .type frexpl,@function + .size frexpl,.-frexpl + .data +# -- End frexpl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/hypot_wmt.S b/external/sgx_libm/ia32/hypot_wmt.S new file mode 100644 index 0000000000..36b50289d9 --- /dev/null +++ b/external/sgx_libm/ia32/hypot_wmt.S @@ -0,0 +1,230 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "hypot_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin hypot + .text + .align 16,0x90 + .globl hypot +hypot: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $152, %esp + movl %ebx, 96(%esp) + call static_func + movl %eax, %ebx + movapd (%ebx), %xmm3 + movsd 160(%esp), %xmm0 + movsd 168(%esp), %xmm1 + andpd %xmm3, %xmm0 + andpd %xmm3, %xmm1 + pextrw $3, %xmm0, %eax + pextrw $3, %xmm1, %edx + cmpl $24528, %eax + ja .L_2TAG_PACKET_0.0.3 + cmpl $24528, %edx + ja .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + fldl 160(%esp) + fldl 168(%esp) + fxch %st(1) + fmul %st(0), %st + fxch %st(1) + nop + fmul %st(0), %st + faddp %st, %st(1) + fsqrt + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + cmpl $32752, %eax + movl %eax, %ecx + jae .L_2TAG_PACKET_3.0.3 + subl %edx, %ecx + cmpl $32752, %edx + jae .L_2TAG_PACKET_3.0.3 + addl $928, %ecx + addl %edx, %eax + cmpl $1856, %ecx + ja .L_2TAG_PACKET_4.0.3 + cmpl $49056, %eax + jb .L_2TAG_PACKET_1.0.3 + fldl 160(%esp) + fldl 168(%esp) + fxch %st(1) + fmul %st(0), %st + fxch %st(1) + nop + fmul %st(0), %st + faddp %st, %st(1) + fsqrt +.L_2TAG_PACKET_5.0.3: + fstl (%esp) + fstpt 16(%esp) + xorl %eax, %eax + movw 24(%esp), %ax + cmpl $17407, %eax + jae .L_2TAG_PACKET_6.0.3 + fldl (%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_4.0.3: + movsd %xmm0, 32(%esp) + movsd %xmm1, 40(%esp) + fldl 32(%esp) + faddl 40(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_6.0.3: + movl $46, %edx +.L_2TAG_PACKET_8.0.3: + movsd 160(%esp), %xmm0 + movsd 168(%esp), %xmm1 + subl $32, %esp + lea 160(%esp), %eax + movl %eax, (%esp) + lea 168(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_3.0.3: + shufpd $0, %xmm1, %xmm0 + movdqa %xmm0, %xmm2 + movdqa 16(%ebx), %xmm3 + movsd %xmm0, 32(%esp) + movsd %xmm1, 40(%esp) + cmppd $3, %xmm0, %xmm2 + cmppd $0, %xmm0, %xmm3 + movmskpd %xmm2, %edx + movmskpd %xmm3, %eax + testl %edx, %edx + je .L_2TAG_PACKET_9.0.3 + fldl 32(%esp) + fmull 40(%esp) + testl $1, %eax + jne .L_2TAG_PACKET_10.0.3 + testl $2, %eax + jne .L_2TAG_PACKET_11.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_9.0.3: + fldl 32(%esp) + faddl 40(%esp) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_10.0.3: + fstpl 40(%esp) + fldl 32(%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_11.0.3: + fstpl 32(%esp) + fldl 40(%esp) + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_2.0.3: +.L_2TAG_PACKET_7.0.3: + movl 96(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type hypot,@function + .size hypot,.-hypot + .data +# -- End hypot + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .type static_const_table,@object + .size static_const_table,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/hypotf.S b/external/sgx_libm/ia32/hypotf.S new file mode 100644 index 0000000000..c57ab39b1f --- /dev/null +++ b/external/sgx_libm/ia32/hypotf.S @@ -0,0 +1,183 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "hypotf.c" + .text +..TXTST0: +# -- Begin hypotf + .text + .align 16,0x90 + .globl hypotf +hypotf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + movzwl 10(%ebp), %ecx + andl $32640, %ecx + movzwl 14(%ebp), %edx + andl $32640, %edx + shrl $7, %ecx + shrl $7, %edx + cmpl $255, %ecx + je ..B1.9 +..B1.2: + cmpl $255, %edx + je ..B1.9 +..B1.3: + movl %ecx, %eax + subl %edx, %eax + addl $28, %eax + cmpl $56, %eax + ja ..B1.5 +..B1.4: + flds 8(%ebp) + addl %edx, %ecx + fmul %st(0), %st + cmpl $378, %ecx + flds 12(%ebp) + fmul %st(0), %st + faddp %st, %st(1) + fsqrt + jg ..B1.7 + jmp ..B1.6 +..B1.5: + flds 8(%ebp) + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + fabs + flds 12(%ebp) + fabs + fldl .L_2il0floatpacket.0@GOTOFF(%eax) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstps 8(%esp) + flds 8(%esp) + fmuls .L_2il0floatpacket.1@GOTOFF(%eax) + cmpl $2130706432, 8(%esp) +..B1.6: + movl %ebp, %esp + popl %ebp + ret +..B1.7: + fstl (%esp) + cmpl $1206910976, 4(%esp) + jl ..B1.6 +..B1.8: + movl %ebp, %esp + popl %ebp + ret +..B1.9: + andb $127, 11(%ebp) + andb $127, 15(%ebp) + cmpl $255, %ecx + je ..B1.21 +..B1.10: + cmpl $255, %edx + je ..B1.19 +..B1.11: + flds 8(%ebp) + fld %st(0) + fadds 12(%ebp) + fstps 8(%esp) +..B1.12: + cmpl $255, %ecx + je ..B1.17 +..B1.13: + fstp %st(0) + cmpl $255, %edx + jne ..B1.16 +..B1.14: + testl $8388607, 12(%ebp) + jne ..B1.16 +..B1.15: + flds 12(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.16: + flds 8(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.17: + testl $8388607, 8(%ebp) + jne ..B1.13 +..B1.18: + movl %ebp, %esp + popl %ebp + ret +..B1.19: + testl $8388607, 12(%ebp) + je ..B1.11 +..B1.20: + flds 8(%ebp) + fld %st(0) + fmuls 12(%ebp) + fstps 8(%esp) + jmp ..B1.12 +..B1.21: + testl $8388607, 8(%ebp) + jne ..B1.20 + jmp ..B1.10 + .align 16,0x90 + .type hypotf,@function + .size hypotf,.-hypotf + .data +# -- End hypotf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 4 +.L_2il0floatpacket.1: + .long 0x40000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/hypotl.S b/external/sgx_libm/ia32/hypotl.S new file mode 100644 index 0000000000..0533320ea7 --- /dev/null +++ b/external/sgx_libm/ia32/hypotl.S @@ -0,0 +1,858 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "hypotl.c" + .text +..TXTST0: +# -- Begin hypotl + .text + .align 16,0x90 + .globl hypotl +hypotl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $24, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + andb $127, 17(%ebp) + andb $127, 29(%ebp) + movzwl 16(%ebp), %esi + andl $32767, %esi + movzwl 28(%ebp), %ebx + andl $32767, %ebx + cmpl $32767, %esi + je ..B1.73 +..B1.4: + cmpl $32767, %ebx + je ..B1.73 +..B1.5: + movl %esi, %eax + subl %ebx, %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + lea 64(%eax), %edx + cmpl $128, %edx + ja ..B1.27 +..B1.6: + lea (%esi,%ebx), %edx + cmpl $18376, %edx + jge ..B1.38 +..B1.7: + testl %esi, %esi + jne ..B1.14 +..B1.8: + cmpl $0, 12(%ebp) + jne ..B1.14 +..B1.9: + cmpl $0, 8(%ebp) + jne ..B1.14 +..B1.10: + testl %ebx, %ebx + jne ..B1.14 +..B1.11: + cmpl $0, 24(%ebp) + jne ..B1.14 +..B1.12: + cmpl $0, 20(%ebp) + jne ..B1.14 +..B1.13: + fldl _zeros@GOTOFF(%ecx) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + movzwl 14(%esp), %ebx + movl %ebx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.37 +..B1.15: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.16: + fldcw 12(%esp) +..B1.17: + movl $1, %ebx +..B1.18: + fldt _scales@GOTOFF(%ecx) + lea 4(%eax), %edx + fldt 8(%ebp) + cmpl $8, %edx + fmul %st(1), %st + fldt 20(%ebp) + fmulp %st, %st(2) + ja ..B1.22 +..B1.19: + fldl _TWO_48H@GOTOFF(%ecx) + fld %st(1) + fmul %st(1), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fxch %st(3) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fld %st(4) + fsub %st(3), %st + fmul %st, %st(2) + fld %st(6) + fsub %st(5), %st + fmul %st, %st(2) + fxch %st(6) + fcom %st(7) + fnstsw %ax + fmulp %st, %st(1) + sahf + faddp %st, %st(2) + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmul %st(0), %st + fld %st(0) + fxch %st(2) + fmul %st(0), %st + fadd %st, %st(2) + fldl _TWO_32H@GOTOFF(%ecx) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + jbe ..B1.21 +..B1.20: + fxch %st(1) + fsubr %st(3), %st + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + jmp ..B1.24 +..B1.21: + fxch %st(2) + fsubr %st(3), %st + fsubrp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + jmp ..B1.24 +..B1.22: + fldl _TWO_48H@GOTOFF(%ecx) + testl %eax, %eax + fldl _TWO_32H@GOTOFF(%ecx) + jle ..B1.36 +..B1.23: + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(3) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + fxch %st(1) + fxch %st(2) + fxch %st(1) +..B1.24: + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fld %st(1) + testl %ebx, %ebx + fadd %st(4), %st + fsqrt + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(3) + fld %st(3) + fxch %st(1) + fsub %st(4), %st + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(4) + faddp %st, %st(2) + fld %st(2) + fadd %st(4), %st + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 12+_scales@GOTOFF(%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.26 +..B1.25: + fldcw 14(%esp) +..B1.26: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.27: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.72 +..B1.28: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.29: + fldcw 12(%esp) +..B1.30: + movl $1, %edx +..B1.31: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt (%esp) + fldt (%esp) + fldt 12+_ranges@GOTOFF(%ecx) + fcompp + fnstsw %ax + sahf + jae ..B1.33 + jp ..B1.33 +..B1.32: + fldt _large_value_80@GOTOFF(%ecx) + fmul %st(0), %st + fstpt (%esp) +..B1.33: + testl %edx, %edx + je ..B1.35 +..B1.34: + fldcw 14(%esp) +..B1.35: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.36: + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(0), %st + jmp ..B1.24 +..B1.37: + xorl %ebx, %ebx + jmp ..B1.18 +..B1.38: + movzwl 14(%esp), %ebx + cmpl $47156, %edx + jle ..B1.54 +..B1.39: + movl %ebx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.69 +..B1.40: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.41: + fldcw 12(%esp) +..B1.42: + xorl %ebx, %ebx + incl %ebx +..B1.43: + fldt 12+_scales@GOTOFF(%ecx) + lea 4(%eax), %edx + fldt 8(%ebp) + cmpl $8, %edx + fmul %st(1), %st + fldt 20(%ebp) + fmulp %st, %st(2) + ja ..B1.47 +..B1.44: + fldl _TWO_48H@GOTOFF(%ecx) + fld %st(1) + fmul %st(1), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fxch %st(3) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fld %st(4) + fsub %st(3), %st + fmul %st, %st(2) + fld %st(6) + fsub %st(5), %st + fmul %st, %st(2) + fxch %st(6) + fcom %st(7) + fnstsw %ax + fmulp %st, %st(1) + sahf + faddp %st, %st(2) + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmul %st(0), %st + fld %st(0) + fxch %st(2) + fmul %st(0), %st + fadd %st, %st(2) + fldl _TWO_32H@GOTOFF(%ecx) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + jbe ..B1.46 +..B1.45: + fxch %st(1) + fsubr %st(3), %st + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + jmp ..B1.49 +..B1.46: + fxch %st(2) + fsubr %st(3), %st + fsubrp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + jmp ..B1.49 +..B1.47: + fldl _TWO_48H@GOTOFF(%ecx) + testl %eax, %eax + fldl _TWO_32H@GOTOFF(%ecx) + jle ..B1.68 +..B1.48: + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(3) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + fxch %st(1) + fxch %st(2) + fxch %st(1) +..B1.49: + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fld %st(1) + fadd %st(4), %st + fsqrt + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(3) + fld %st(3) + fxch %st(1) + fsub %st(4), %st + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(4) + faddp %st, %st(2) + fld %st(2) + fadd %st(4), %st + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + fldt (%esp) + fldt _ranges@GOTOFF(%ecx) + fcompp + fnstsw %ax + sahf + jp ..B1.50 + jbe ..B1.67 +..B1.50: + fldt _scales@GOTOFF(%ecx) + fldt (%esp) + fmulp %st, %st(1) + fstpt (%esp) +..B1.51: + testl %ebx, %ebx + je ..B1.53 +..B1.52: + fldcw 14(%esp) +..B1.53: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.54: + movl %ebx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.71 +..B1.55: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.56: + fldcw 12(%esp) +..B1.57: + xorl %ebx, %ebx + incl %ebx +..B1.58: + lea 4(%eax), %edx + cmpl $8, %edx + ja ..B1.62 +..B1.59: + fldt 8(%ebp) + fld %st(0) + fld %st(1) + fld %st(2) + fldt 20(%ebp) + fld %st(0) + fxch %st(5) + fcom %st(1) + fnstsw %ax + fldl _TWO_48H@GOTOFF(%ecx) + fmul %st, %st(5) + sahf + fxch %st(4) + fadd %st(5), %st + fsubp %st, %st(5) + fld %st(4) + fld %st(2) + fxch %st(3) + fmul %st, %st(5) + fxch %st(3) + fadd %st(5), %st + fsubp %st, %st(5) + fld %st(4) + fxch %st(4) + fsub %st(6), %st + fmul %st, %st(1) + fxch %st(5) + fsubr %st, %st(7) + fxch %st(4) + fmul %st(7), %st + fxch %st(2) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fmul %st(0), %st + fld %st(0) + fxch %st(2) + fmul %st(0), %st + fadd %st, %st(2) + fldl _TWO_32H@GOTOFF(%ecx) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + jbe ..B1.61 +..B1.60: + fxch %st(1) + fsubr %st(3), %st + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + fxch %st(1) + jmp ..B1.64 +..B1.61: + fxch %st(2) + fsubr %st(3), %st + fsubrp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + fxch %st(1) + jmp ..B1.64 +..B1.62: + fldt 8(%ebp) + testl %eax, %eax + fldt 20(%ebp) + fldl _TWO_48H@GOTOFF(%ecx) + fldl _TWO_32H@GOTOFF(%ecx) + jle ..B1.70 +..B1.63: + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(0), %st + fxch %st(2) + fxch %st(1) + fxch %st(2) +..B1.64: + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fld %st(1) + testl %ebx, %ebx + fadd %st(3), %st + fsqrt + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(3) + fld %st(4) + fxch %st(1) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(3) + fadd %st(3), %st + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.66 +..B1.65: + fldcw 14(%esp) +..B1.66: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.67: + fldt _large_value_80@GOTOFF(%ecx) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.51 +..B1.68: + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(0), %st + jmp ..B1.49 +..B1.69: + xorl %ebx, %ebx + jmp ..B1.43 +..B1.70: + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(3) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + jmp ..B1.64 +..B1.71: + xorl %ebx, %ebx + jmp ..B1.58 +..B1.72: + xorl %edx, %edx + jmp ..B1.31 +..B1.73: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.96 +..B1.74: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.75: + fldcw 12(%esp) +..B1.76: + movl $1, %eax +..B1.77: + cmpl $32767, %esi + je ..B1.94 +..B1.78: + cmpl $32767, %ebx + je ..B1.91 +..B1.79: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt (%esp) +..B1.80: + testl %eax, %eax + je ..B1.82 +..B1.81: + fldcw 14(%esp) +..B1.82: + cmpl $32767, %esi + je ..B1.88 +..B1.83: + cmpl $32767, %ebx + jne ..B1.87 +..B1.84: + cmpl $-2147483648, 24(%ebp) + jne ..B1.87 +..B1.85: + cmpl $0, 20(%ebp) + jne ..B1.87 +..B1.86: + fldt 20(%ebp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.87: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.88: + cmpl $-2147483648, 12(%ebp) + jne ..B1.83 +..B1.89: + cmpl $0, 8(%ebp) + jne ..B1.83 +..B1.90: + fldt 8(%ebp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.91: + cmpl $-2147483648, 24(%ebp) + jne ..B1.93 +..B1.92: + cmpl $0, 20(%ebp) + je ..B1.79 +..B1.93: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.80 +..B1.94: + cmpl $-2147483648, 12(%ebp) + jne ..B1.93 +..B1.95: + cmpl $0, 8(%ebp) + jne ..B1.93 + jmp ..B1.78 +..B1.96: + xorl %eax, %eax + jmp ..B1.77 + .align 16,0x90 + .type hypotl,@function + .size hypotl,.-hypotl + .data +# -- End hypotl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_scales: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24653 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8113 + .word 0 + .type _scales,@object + .size _scales,24 + .align 2 +_ranges: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24497 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 32766 + .word 0 + .type _ranges,@object + .size _ranges,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ilogb_wmt.S b/external/sgx_libm/ia32/ilogb_wmt.S new file mode 100644 index 0000000000..0f482dfe93 --- /dev/null +++ b/external/sgx_libm/ia32/ilogb_wmt.S @@ -0,0 +1,171 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ilogb_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin ilogb + .text + .align 16,0x90 + .globl ilogb +ilogb: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd %xmm0, 8(%esp) + psrlq $52, %xmm0 + movd %xmm0, %eax + andl $2047, %eax + subl $1, %eax + cmpl $2046, %eax + jae .L_2TAG_PACKET_0.0.3 + subl $1022, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + movq 8(%esp), %xmm0 + movq (%ebx), %xmm1 + pxor %xmm2, %xmm2 + testl %eax, %eax + jg .L_2TAG_PACKET_2.0.3 + comisd %xmm2, %xmm0 + mulsd %xmm1, %xmm0 + je .L_2TAG_PACKET_3.0.3 + psrlq $52, %xmm0 + movd %xmm0, %eax + andl $2047, %eax + subl $1078, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + ucomisd %xmm0, %xmm0 + movl $2147483647, %eax + movl $-2147483648, %edx + cmovc %edx, %eax + xorpd %xmm0, %xmm0 + movq 16(%ebx), %xmm1 + mulsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movl $-2147483648, %edx + movl %edx, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $157, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl (%esp), %eax + xorpd %xmm0, %xmm0 + movq 16(%ebx), %xmm1 + mulsd %xmm0, %xmm1 +.L_2TAG_PACKET_1.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type ilogb,@function + .size ilogb,.-ilogb + .data +# -- End ilogb + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .type static_const_table,@object + .size static_const_table,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ilogbf.S b/external/sgx_libm/ia32/ilogbf.S new file mode 100644 index 0000000000..b6ea2b1e32 --- /dev/null +++ b/external/sgx_libm/ia32/ilogbf.S @@ -0,0 +1,129 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ilogbf.c" + .text +..TXTST0: +# -- Begin ilogbf + .text + .align 16,0x90 + .globl ilogbf +ilogbf: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movl 16(%esp), %eax + andl $2147483647, %eax + addl $-8388608, %eax + cmpl $2130706432, %eax + jb ..B1.6 +..B1.2: + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + testl %eax, %eax + jl ..B1.7 +..B1.3: + fldz + cmpl $2130706432, %eax + fmuls .L_2il0floatpacket.0@GOTOFF(%edx) + fstps (%esp) + je ..B1.5 +..B1.4: + flds 16(%esp) + movl $-2147483648, %eax + fmul %st(0), %st + fstps 16(%esp) + movl 16(%esp), %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jae ..L3 + movl $0, %eax +..L3: + addl $12, %esp + ret +..B1.5: + movl $2147483647, %eax + addl $12, %esp + ret +..B1.6: + shrl $23, %eax + addl $-126, %eax + addl $12, %esp + ret +..B1.7: + cmpl $-8388608, %eax + je ..B1.9 +..B1.8: + flds 16(%esp) + fmuls .L_2il0floatpacket.1@GOTOFF(%edx) + fstps 16(%esp) + movl 16(%esp), %eax + andl $2147483647, %eax + shrl $23, %eax + addl $-152, %eax + addl $12, %esp + ret +..B1.9: + fldz + movl $-2147483648, %eax + fmuls .L_2il0floatpacket.0@GOTOFF(%edx) + fstps (%esp) + addl $12, %esp + ret + .align 16,0x90 + .type ilogbf,@function + .size ilogbf,.-ilogbf + .data +# -- End ilogbf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x7f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ilogbl.S b/external/sgx_libm/ia32/ilogbl.S new file mode 100644 index 0000000000..7165b3f701 --- /dev/null +++ b/external/sgx_libm/ia32/ilogbl.S @@ -0,0 +1,200 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ilogbl.c" + .text +..TXTST0: +# -- Begin ilogbl + .text + .align 16,0x90 + .globl ilogbl +ilogbl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $32767, %eax + je ..B1.20 +..B1.4: + testl %eax, %eax + jne ..B1.13 +..B1.5: + cmpl $0, 12(%ebp) + jne ..B1.7 +..B1.6: + cmpl $0, 8(%ebp) + je ..B1.14 +..B1.7: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.19 +..B1.8: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%edx) + fstpt 8(%ebp) +..B1.11: + fldcw 14(%esp) +..B1.12: + movzwl 16(%ebp), %eax + andl $32767, %eax + addl $-16458, %eax + movl %ebp, %esp + popl %ebp + ret +..B1.13: + addl $-16383, %eax + movl %ebp, %esp + popl %ebp + ret +..B1.14: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.18 +..B1.15: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.16: + fldcw 12(%esp) +..B1.17: + fldcw 14(%esp) +..B1.18: + fldl _infs@GOTOFF(%edx) + movl $-2147483648, %eax + fmull _zeros@GOTOFF(%edx) + fstpl 16(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.19: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%edx) + fstpt 8(%ebp) + jmp ..B1.12 +..B1.20: + cmpl $-2147483648, 12(%ebp) + fldl _infs@GOTOFF(%edx) + fmull _zeros@GOTOFF(%edx) + fstpl 16(%esp) + jne ..B1.23 +..B1.21: + cmpl $0, 8(%ebp) + jne ..B1.23 +..B1.22: + movl $2147483647, %eax + movl %ebp, %esp + popl %ebp + ret +..B1.23: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.24: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.25: + fldcw 12(%esp) +..B1.26: + fldt 8(%ebp) + fstpt (%esp) +..B1.27: + fldcw 14(%esp) +..B1.28: + movl $-2147483648, %eax + movl %ebp, %esp + popl %ebp + ret +..B1.29: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.28 + .align 16,0x90 + .type ilogbl,@function + .size ilogbl,.-ilogbl + .data +# -- End ilogbl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/intel_quad_exception.S b/external/sgx_libm/ia32/intel_quad_exception.S new file mode 100644 index 0000000000..c5fabfb8ce --- /dev/null +++ b/external/sgx_libm/ia32/intel_quad_exception.S @@ -0,0 +1,2258 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "intel_quad_exception.c" + .text +..TXTST0: +# -- Begin __dpml_exception + .text + .align 16,0x90 + .hidden __dpml_exception + .globl __dpml_exception +__dpml_exception: +# parameter 1: 48 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $28, %esp + xorl %eax, %eax + movl 48(%esp), %edx + movl (%edx), %ecx + movl 4(%edx), %edx + movl %edx, %ebx + subl %eax, %ebx + jge ..B1.3 +..B1.2: + andl $2147483647, %edx +..B1.3: + call ..L2 +..L2: + popl %ebp + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebp), %ebp + movl %ecx, %ebx + andl $134217727, %ecx + movl %edx, %esi + shll $5, %esi + shrl $27, %ebx + orl %ebx, %esi + movzbl 7+__dpml_response_table@GOTOFF(%ebp,%ecx,8), %edi + movzbl 6+__dpml_response_table@GOTOFF(%ebp,%ecx,8), %ebx + movl %ebx, %eax + movl %edi, 16(%esp) + movl $4, %edi + subl %edi, %eax + xorl %edi, %edi + orl %edi, %eax + jne ..B1.5 +..B1.4: + movl 48(%esp), %eax + lea 28(%eax), %edi + jmp ..B1.6 +..B1.5: + movl 16(%esp), %eax + shll $5, %eax + lea (%eax,%esi,8), %edi + addl __dpml_globals_table@GOT(%ebp), %edi +..B1.6: + addl $-4, %ecx + movl %ecx, %esi + adcl $-1, %edx + movl $171, %eax + subl %eax, %esi + movl $0, %eax + sbbl %eax, %edx + jb ..B1.7 +..B1.89: + orl %edx, %esi + jne ..B1.74 +..B1.7: + movzbl .2.9_2.switchtab.1@GOTOFF(%ebp,%ecx), %eax + lea ..1.1_0.TAG.12.0.1@GOTOFF(%ebp,%eax), %eax + jmp *%eax +..1.1_0.TAG.12.0.1: +..1.1_0.TAG.9.0.1: +..1.1_0.TAG.11.0.1: +..1.1_0.TAG.8.0.1: +..B1.64: + movl 48(%esp), %edi + xorl %ebx, %ebx + lea 28(%edi), %edi + jmp ..B1.75 +..1.1_0.TAG.171.0.1: +..1.1_0.TAG.170.0.1: +..1.1_0.TAG.145.0.1: +..1.1_0.TAG.144.0.1: +..1.1_0.TAG.140.0.1: +..1.1_0.TAG.139.0.1: +..1.1_0.TAG.138.0.1: +..1.1_0.TAG.136.0.1: +..1.1_0.TAG.135.0.1: +..1.1_0.TAG.133.0.1: +..1.1_0.TAG.128.0.1: +..1.1_0.TAG.127.0.1: +..1.1_0.TAG.126.0.1: +..1.1_0.TAG.125.0.1: +..1.1_0.TAG.116.0.1: +..1.1_0.TAG.115.0.1: +..1.1_0.TAG.114.0.1: +..1.1_0.TAG.112.0.1: +..1.1_0.TAG.111.0.1: +..1.1_0.TAG.104.0.1: +..1.1_0.TAG.103.0.1: +..1.1_0.TAG.102.0.1: +..1.1_0.TAG.101.0.1: +..1.1_0.TAG.100.0.1: +..1.1_0.TAG.99.0.1: +..1.1_0.TAG.98.0.1: +..1.1_0.TAG.97.0.1: +..1.1_0.TAG.79.0.1: +..1.1_0.TAG.76.0.1: +..1.1_0.TAG.67.0.1: +..1.1_0.TAG.64.0.1: +..1.1_0.TAG.62.0.1: +..1.1_0.TAG.61.0.1: +..1.1_0.TAG.59.0.1: +..1.1_0.TAG.58.0.1: +..1.1_0.TAG.56.0.1: +..1.1_0.TAG.55.0.1: +..1.1_0.TAG.34.0.1: +..1.1_0.TAG.33.0.1: +..1.1_0.TAG.32.0.1: +..1.1_0.TAG.31.0.1: +..1.1_0.TAG.30.0.1: +..1.1_0.TAG.29.0.1: +..1.1_0.TAG.28.0.1: +..1.1_0.TAG.26.0.1: +..1.1_0.TAG.25.0.1: +..1.1_0.TAG.24.0.1: +..1.1_0.TAG.23.0.1: +..1.1_0.TAG.22.0.1: +..1.1_0.TAG.19.0.1: +..1.1_0.TAG.18.0.1: +..1.1_0.TAG.13.0.1: +..1.1_0.TAG.10.0.1: +..1.1_0.TAG.7.0.1: +..1.1_0.TAG.6.0.1: +..1.1_0.TAG.4.0.1: +..1.1_0.TAG.3.0.1: +..1.1_0.TAG.2.0.1: +..1.1_0.SWBASE.0.1: +..1.1_0.TAG.0.0.1: +..B1.74: + movl %ebx, %esi + movl $4, %edx + xorl %ecx, %ecx + subl %edx, %esi + sbbl %ecx, %ecx + jb ..B1.75 +..B1.90: + orl %ecx, %esi + jne ..B1.86 +..B1.75: + movzbl .2.9_2.switchtab.2@GOTOFF(%ebp,%ebx), %eax + lea ..1.1_1.TAG.4.0.1@GOTOFF(%ebp,%eax), %eax + jmp *%eax +..1.1_1.TAG.4.0.1: +..B1.77: + fldt .L_2il0floatpacket.2@GOTOFF(%ebp) + movl $8388608, 12(%esp) + flds 12(%esp) + fmulp %st, %st(1) + fstps 12(%esp) + jmp ..B1.86 +..1.1_1.TAG.3.0.1: +..B1.79: + movl $2130706432, 8(%esp) + flds 8(%esp) + flds 8(%esp) + fmulp %st, %st(1) + fstps 8(%esp) + jmp ..B1.86 +..1.1_1.TAG.2.0.1: +..B1.81: + movl $0, 4(%esp) +..B1.82: + flds 4(%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%ebp) + fdivp %st, %st(1) + fstps 4(%esp) + jmp ..B1.86 +..1.1_1.TAG.1.0.1: +..B1.84: + movl $2139095040, (%esp) + flds (%esp) + flds (%esp) + fsubrp %st, %st(1) + fstps (%esp) +..1.1_1.TAG.0.0.1: +..B1.86: + movl %edi, %eax + addl $28, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_exception,@function + .size __dpml_exception,.-__dpml_exception + .section .rodata, "a" + .align 16 + .align 1 +.2.9_2.switchtab.1: + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .align 1 +.2.9_2.switchtab.2: + .byte ..1.1_1.TAG.0.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.1.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.2.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.3.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.4.0.1 - ..1.1_1.TAG.4.0.1 + .data +# -- End __dpml_exception + .text +# -- Begin __dpml_intel_atan_fixup + .text + .align 16,0x90 + .globl __dpml_intel_atan_fixup +__dpml_intel_atan_fixup: +# parameter 1: 32 + %esp +# parameter 2: 40 + %esp +# parameter 3: 44 + %esp +# parameter 4: 52 + %esp +..B2.1: +..L3: + + pushl %esi + pushl %edi + pushl %ebp + subl $16, %esp + movl 52(%esp), %eax + movl 36(%esp), %esi + andl $2147483647, %esi + movl 32(%esp), %edx + orl 56(%esp), %eax + je ..B2.3 +..B2.2: + movl %esi, %eax + movl %edx, %ecx + shll $28, %eax + andl $15, %ecx + shrl $4, %edx + shrl $4, %esi + orl %eax, %edx + jmp ..B2.4 +..B2.3: + movl $4, %ecx +..B2.4: + movl $10, %eax + lea (%esi,%esi,4), %edi + mull %edx + movl %eax, %esi + lea (%edx,%edi,2), %eax + addl %ecx, %esi + adcl $0, %eax + movl $77, %ecx + xorl %ebp, %ebp + addl $-22, %esi + movl %esi, %edx + adcl $-1, %eax + subl %ecx, %edx + sbbl %ebp, %eax + jb ..B2.5 +..B2.110: + orl %eax, %edx + jne ..B2.107 +..B2.5: + call ..L4 +..L4: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%edi), %edi + movl 44(%esp), %ecx + movl 48(%esp), %edx + movl __x_constants__@GOT(%edi), %ebp + movzwl .2.10_2.switchtab.4@GOTOFF(%edi,%esi,2), %eax + lea ..1.2_0.TAG.77.0.2@GOTOFF(%edi,%eax), %eax + jmp *%eax +..1.2_0.TAG.77.0.2: +..B2.7: + orl %edx, %ecx + je ..B2.9 +..B2.8: + movl $5, %esi + jmp ..B2.10 +..B2.9: + movl $11, %esi +..B2.10: + movl $3, %eax + jmp ..B2.101 +..1.2_0.TAG.76.0.2: +..B2.12: + movl $3, %eax + xorl %esi, %esi + jmp ..B2.104 +..1.2_0.TAG.75.0.2: +..1.2_0.TAG.73.0.2: +..1.2_0.TAG.71.0.2: +..1.2_0.TAG.65.0.2: +..1.2_0.TAG.63.0.2: +..1.2_0.TAG.61.0.2: +..1.2_0.TAG.57.0.2: +..1.2_0.TAG.56.0.2: +..1.2_0.TAG.51.0.2: +..1.2_0.TAG.47.0.2: +..1.2_0.TAG.46.0.2: +..1.2_0.TAG.41.0.2: +..1.2_0.TAG.37.0.2: +..1.2_0.TAG.36.0.2: +..1.2_0.TAG.31.0.2: +..1.2_0.TAG.27.0.2: +..1.2_0.TAG.26.0.2: +..1.2_0.TAG.21.0.2: +..1.2_0.TAG.17.0.2: +..1.2_0.TAG.16.0.2: +..1.2_0.TAG.15.0.2: +..1.2_0.TAG.14.0.2: +..1.2_0.TAG.13.0.2: +..1.2_0.TAG.12.0.2: +..1.2_0.TAG.7.0.2: +..1.2_0.TAG.6.0.2: +..1.2_0.TAG.5.0.2: +..1.2_0.TAG.4.0.2: +..1.2_0.TAG.3.0.2: +..1.2_0.TAG.2.0.2: +..B2.14: + xorl %eax, %eax + orl %edx, %ecx + jmp ..B2.101 +..1.2_0.TAG.67.0.2: +..B2.20: + orl %edx, %ecx + je ..B2.22 +..B2.21: + movl $5, %esi + jmp ..B2.100 +..B2.22: + movl $11, %esi + jmp ..B2.100 +..1.2_0.TAG.66.0.2: +..B2.25: + movl $2, %eax + xorl %esi, %esi + jmp ..B2.104 +..1.2_0.TAG.11.0.2: +..B2.69: + orl %edx, %ecx + je ..B2.71 +..B2.70: + movl $6, %esi + jmp ..B2.72 +..B2.71: + movl $10, %esi +..B2.72: + movl $3, %eax + jmp ..B2.101 +..1.2_0.TAG.10.0.2: +..B2.74: + orl %edx, %ecx + je ..B2.76 +..B2.75: + movl $4, %esi + jmp ..B2.77 +..B2.76: + movl $8, %esi +..B2.77: + movl $3, %eax + jmp ..B2.101 +..1.2_0.TAG.1.0.2: +..B2.92: + orl %edx, %ecx + je ..B2.94 +..B2.93: + movl $6, %esi + jmp ..B2.100 +..B2.94: + movl $10, %esi + jmp ..B2.100 +..1.2_0.TAG.0.0.2: +..B2.97: + orl %edx, %ecx + je ..B2.99 +..B2.98: + movl $4, %esi + jmp ..B2.100 +..B2.99: + movl $8, %esi +..B2.100: + movl $2, %eax +..B2.101: + je ..B2.103 +..B2.102: + movl $1182793727, (%esp) + flds (%esp) + flds (%esp) + fmulp %st, %st(1) + fstps (%esp) +..B2.103: + xorl %edx, %edx + orl %eax, %edx + je ..B2.107 +..B2.104: + shll $4, %esi + movl $3, %edi + subl %edi, %eax + xorl %edi, %edi + orl %edi, %eax + movl 8(%ebp,%esi), %ecx + movl 12(%ebp,%esi), %edx + jne ..B2.106 +..B2.105: + xorl $-2147483648, %edx +..B2.106: + movl 40(%esp), %eax + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + movl (%ebp,%esi), %edx + movl 4(%ebp,%esi), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + addl $16, %esp + popl %ebp + popl %edi + popl %esi + ret +..1.2_0.SWBASE.0.2: +..B2.107: + addl $16, %esp + popl %ebp + popl %edi + popl %esi + ret + .align 16,0x90 + .type __dpml_intel_atan_fixup,@function + .size __dpml_intel_atan_fixup,.-__dpml_intel_atan_fixup + .section .rodata, "a" + .space 1, 0x00 # pad + .align 2 +.2.10_2.switchtab.4: + .word ..1.2_0.TAG.0.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.1.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.10.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.11.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.66.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.67.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.76.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.77.0.2 - ..1.2_0.TAG.77.0.2 + .data +# -- End __dpml_intel_atan_fixup + .text +# -- Begin __dpml_intel_pow_fixup + .text + .align 16,0x90 + .globl __dpml_intel_pow_fixup +__dpml_intel_pow_fixup: +# parameter 1: 96 + %esp +# parameter 2: 104 + %esp +# parameter 3: 108 + %esp +# parameter 4: 112 + %esp +# parameter 5: 116 + %esp +# parameter 6: 120 + %esp +# parameter 7: 124 + %esp +..B3.1: +..L5: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $76, %esp + xorl %ecx, %ecx + call ..L6 +..L6: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L6](%eax), %eax + movl 96(%esp), %esi + movl %esi, %ebp + movl 100(%esp), %ebx + andl $15, %ebp + shrl $4, %esi + movl %eax, 40(%esp) + movl %ebx, %eax + andl $15, %esi + subl %ecx, %eax + jl ..B3.41 +..B3.2: + movl 112(%esp), %ecx + movl $-2147483648, %eax + movl 12(%ecx), %edi + subl %eax, %edi + orl 8(%ecx), %edi + jne ..B3.4 +..B3.3: + movl $1, %ecx + jmp ..B3.5 +..B3.4: + xorl %ecx, %ecx +..B3.5: + movl 112(%esp), %eax + movl 16(%eax), %edi + orl 20(%eax), %edi + jne ..B3.7 +..B3.6: + movl $1, %eax + jmp ..B3.8 +..B3.7: + xorl %eax, %eax +..B3.8: + andl %eax, %ecx + movl $10, %eax + mull %esi + movl $94, %esi + addl %ebp, %eax + adcl $0, %edx + negl %esi + addl %eax, %esi + orl %edx, %esi + je ..B3.37 +..B3.9: + movl %eax, %esi + movl $1, %edi + addl $-42, %esi + movl %ebp, 36(%esp) + movl %edx, %ebp + adcl $-1, %ebp + subl %edi, %esi + movl $0, %edi + sbbl %edi, %ebp + movl %ebp, 32(%esp) + movl 36(%esp), %ebp + jb ..B3.28 +..B3.58: + orl 32(%esp), %esi + je ..B3.28 +..B3.10: + movl %eax, %esi + movl $1, %edi + addl $-52, %esi + movl %ebp, 36(%esp) + movl %edx, %ebp + adcl $-1, %ebp + subl %edi, %esi + movl $0, %edi + sbbl %edi, %ebp + movl %ebp, 32(%esp) + movl 36(%esp), %ebp + jb ..B3.28 +..B3.59: + orl 32(%esp), %esi + je ..B3.28 +..B3.11: + movl %eax, %esi + movl %edx, %ecx + addl $-34, %esi + adcl $-1, %ecx + movl $1, %edi + subl %edi, %esi + movl $0, %edi + sbbl %edi, %ecx + jb ..B3.12 +..B3.60: + orl %ecx, %esi + jne ..B3.19 +..B3.12: + movl 40(%esp), %eax + movl __x_constants__@GOT(%eax), %ecx + movl 104(%esp), %eax + movl (%ecx), %esi + movl 4(%ecx), %edi + movl %esi, (%eax) + movl %edi, 4(%eax) + movl $5, %eax + subl %eax, %ebp + xorl %eax, %eax + orl %eax, %ebp + je ..B3.15 +..B3.13: + movl $2147418112, %eax +..B3.15: + movl $3, %ecx + movl 124(%esp), %esi + subl %ecx, %esi + movl 128(%esp), %ebp + orl %ebp, %esi + je ..B3.17 +..B3.16: + xorl %ecx, %ecx + jmp ..B3.18 +..B3.17: + movl $-2147483648, %ecx +..B3.18: + xorl %ecx, %eax + orl $-2147483648, %ebx + movl 104(%esp), %ecx + movl $0, 8(%ecx) + movl %eax, 12(%ecx) + jmp ..B3.34 +..B3.19: + movl $44, %ecx + subl %ecx, %eax + orl %edx, %eax + jne ..B3.34 +..B3.20: + movl 116(%esp), %eax + movl %eax, %ecx + movl 40(%esp), %ebp + movl 8(%eax), %edi + movl __x_constants__@GOT(%ebp), %eax + movl 12(%ecx), %esi + subl 24(%eax), %edi + subl 28(%eax), %esi + orl %esi, %edi + jne ..B3.34 +..B3.21: + movl 116(%esp), %ecx + movl %ecx, %ebp + movl (%ecx), %edi + movl 4(%ebp), %esi + subl 16(%eax), %edi + subl 20(%eax), %esi + orl %esi, %edi + jne ..B3.34 +..B3.22: + movl 120(%esp), %ebp + pushl %ebp + pushl $0 + pushl $7 + pushl 124(%esp) + call __dpml_ux_sqrt_evaluation__ +..B3.65: + addl $16, %esp +..B3.23: + orl %edx, %eax + jne ..B3.25 +..B3.24: + movl $1, %eax + jmp ..B3.26 +..B3.25: + xorl %eax, %eax +..B3.26: + xorl %ecx, %ecx + movl %eax, 40(%esp) + movl %ecx, 44(%esp) + addl $28, %esp + lea 4(%esp), %eax + pushl %eax + pushl %ecx + pushl %ecx + pushl %ecx + pushl %ecx + pushl 96(%esp) + pushl %ebp + call __dpml_pack__ + jmp ..B3.33 +..B3.28: + movl 40(%esp), %esi + movl __x_constants__@GOT(%esi), %edx + movl 40(%edx), %edi + movl %edi, 32(%esp) + movl 44(%edx), %esi + movl 32(%edx), %eax + movl 36(%edx), %edi + movl 104(%esp), %edx + movl %eax, (%edx) + movl 112(%esp), %eax + movl %edi, 4(%edx) + movl 4(%eax), %eax + cmpl $1, %eax + je ..B3.35 +..B3.29: + movl $2, %ecx + xorl %esi, %esi + subl %ecx, %ebp + orl %esi, %ebp + je ..B3.31 +..B3.30: + xorl %ecx, %ecx + jmp ..B3.32 +..B3.31: + movl $1, %ecx +..B3.32: + testl %eax, %eax + movl $0, %eax + movl 104(%esp), %esi + setle %al + cmpl %eax, %ecx + movl $2147418112, %ecx + movl $0, 8(%esi) + jne ..L7 + movl $0, %ecx +..L7: + movl %ecx, 12(%esi) +..B3.33: + orl $-2147483648, %ebx +..B3.34: + movl 96(%esp), %eax + movl %ebx, %edx + addl $76, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B3.35: + xorl %edi, %edi + orl %edi, %ecx + je ..B3.29 +..B3.36: + movl 104(%esp), %ecx + movl 32(%esp), %eax + movl %eax, 8(%ecx) + movl %esi, 12(%ecx) + jmp ..B3.33 +..B3.37: + movl $3, %eax + movl 124(%esp), %ebp + subl %eax, %ebp + movl 128(%esp), %ecx + orl %ecx, %ebp + je ..B3.39 +..B3.38: + xorl %eax, %eax + jmp ..B3.40 +..B3.39: + movl $-2147483648, %eax +..B3.40: + movl 104(%esp), %edi + orl $-2147483648, %ebx + movl %eax, 12(%edi) + movl 108(%esp), %eax + movl %eax, %ecx + movl $0, 8(%edi) + movl (%eax), %ebp + movl 4(%ecx), %esi + movl %ebp, (%edi) + movl %esi, 4(%edi) + jmp ..B3.34 +..B3.41: + movl $10, %eax + movl $95, %ecx + mull %esi + addl %eax, %ebp + adcl $0, %edx + negl %ecx + addl %ebp, %ecx + orl %edx, %ecx + je ..B3.53 +..B3.42: + movl %ebp, %edi + movl %edx, %esi + addl $-40, %edi + adcl $-1, %esi + movl $1, %eax + xorl %ecx, %ecx + subl %eax, %edi + sbbl %ecx, %esi + jb ..B3.50 +..B3.61: + orl %esi, %edi + je ..B3.50 +..B3.43: + movl %ebp, %edi + movl %edx, %esi + addl $-80, %edi + adcl $-1, %esi + subl %eax, %edi + sbbl %ecx, %esi + jb ..B3.49 +..B3.62: + orl %esi, %edi + je ..B3.49 +..B3.44: + movl %ebp, %edi + movl %edx, %esi + addl $-90, %edi + adcl $-1, %esi + subl %eax, %edi + sbbl %ecx, %esi + jb ..B3.49 +..B3.63: + orl %esi, %edi + je ..B3.49 +..B3.45: + addl $-46, %ebp + adcl $-1, %edx + subl %eax, %ebp + sbbl %ecx, %edx + jb ..B3.46 +..B3.64: + orl %edx, %ebp + jne ..B3.34 +..B3.46: + movl 108(%esp), %eax + movl %eax, %ecx + movl 40(%esp), %ebp + movl 8(%eax), %edi + movl __x_constants__@GOT(%ebp), %eax + movl 12(%ecx), %esi + subl 40(%eax), %edi + subl 44(%eax), %esi + orl %esi, %edi + jne ..B3.48 +..B3.47: + movl 108(%esp), %ecx + movl %ecx, %ebp + movl (%ecx), %edi + movl 4(%ebp), %esi + subl 32(%eax), %edi + subl 36(%eax), %esi + orl %esi, %edi + je ..B3.34 +..B3.48: + movl $1182793727, 60(%esp) + flds 60(%esp) + flds 60(%esp) + fmulp %st, %st(1) + fstps 60(%esp) + jmp ..B3.34 +..B3.49: + movl 116(%esp), %ecx + movl %ecx, %ebp + movl 104(%esp), %eax + movl 8(%ecx), %esi + movl 12(%ebp), %edi + orl $32768, %edi + movl %esi, 8(%eax) + movl %edi, 12(%eax) + movl (%ecx), %ebp + movl 4(%ecx), %ecx + movl %ebp, (%eax) + movl %ecx, 4(%eax) + jmp ..B3.34 +..B3.50: + movl 40(%esp), %eax + movl 108(%esp), %ecx + movl 108(%esp), %ebp + movl __x_constants__@GOT(%eax), %eax + movl 8(%ecx), %ecx + movl 12(%ebp), %ebp + movl 40(%eax), %edi + subl %edi, %ecx + movl 44(%eax), %esi + subl %esi, %ebp + orl %ebp, %ecx + jne ..B3.49 +..B3.51: + movl 32(%eax), %ebp + movl 36(%eax), %ecx + movl 108(%esp), %eax + movl 108(%esp), %edx + movl (%eax), %eax + movl 4(%edx), %edx + subl %ebp, %eax + subl %ecx, %edx + orl %edx, %eax + jne ..B3.49 +..B3.52: + movl 104(%esp), %eax + movl %esi, 12(%eax) + movl %ebp, %esi + movl %edi, 8(%eax) + movl %esi, (%eax) + movl %ecx, 4(%eax) + jmp ..B3.34 +..B3.53: + movl 128(%esp), %ecx + movl 124(%esp), %eax + orl %eax, %ecx + je ..B3.34 +..B3.54: + movl 124(%esp), %ecx + xorl %eax, %eax + andl $2, %ecx + orl %eax, %ecx + je ..B3.34 +..B3.55: + movl 104(%esp), %eax + xorl $-2147483648, 12(%eax) + jmp ..B3.34 + .align 16,0x90 + .type __dpml_intel_pow_fixup,@function + .size __dpml_intel_pow_fixup,.-__dpml_intel_pow_fixup + .data +# -- End __dpml_intel_pow_fixup + .text +# -- Begin __dpml_d_intel_order_fixup + .text + .align 16,0x90 + .globl __dpml_d_intel_order_fixup +__dpml_d_intel_order_fixup: +# parameter 1: 4 + %esp +..B4.1: +..L8: + + fldl 4(%esp) + ret + .align 16,0x90 + .type __dpml_d_intel_order_fixup,@function + .size __dpml_d_intel_order_fixup,.-__dpml_d_intel_order_fixup + .data +# -- End __dpml_d_intel_order_fixup + .section .rodata, "a" + .space 2, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xe6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +__dpml_response_table: + .long 0 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 1 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 2 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 3 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 3 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 4 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 4 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 6 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 7 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 8 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 8 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 8 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 9 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 9 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 9 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 10 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 10 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 10 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 11 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 11 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 39 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 39 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 12 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 13 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 14 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 33 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 33 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 33 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 33 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 33 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 33 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 34 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 34 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 34 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 34 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 34 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 34 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 34 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 34 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 16 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 16 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 16 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 16 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 17 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 17 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 17 + .byte 0 + .byte 12 + .byte 0 + .byte 12 + .long 38 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 38 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 38 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 47 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 47 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 47 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 47 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 47 + .byte 0 + .byte 8 + .byte 0 + .byte 8 + .long 47 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 47 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 47 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 37 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 18 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 18 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 18 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 19 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 19 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 19 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 20 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 20 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 20 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 45 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 45 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 21 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 21 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 21 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 40 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 40 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 40 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 40 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 22 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 22 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 22 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 22 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 22 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 22 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 22 + .byte 0 + .byte 11 + .byte 0 + .byte 11 + .long 22 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 22 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 22 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 22 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 22 + .byte 0 + .byte 8 + .byte 0 + .byte 8 + .long 22 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 22 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 22 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 41 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 41 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 41 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 41 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 41 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 41 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 41 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 48 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 48 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 23 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 23 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 23 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 24 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 31 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 32 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 32 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 25 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 25 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 26 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 26 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 26 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 27 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 63 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 63 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 28 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 29 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 29 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 29 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 29 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 29 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 30 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 30 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 35 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 36 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 36 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 49 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 50 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 51 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 50 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 50 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 51 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 51 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 42 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 43 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 44 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 42 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 42 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 43 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 43 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 43 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 44 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 44 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 44 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 44 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 46 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 46 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 46 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 46 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 46 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 53 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 78 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .long 64 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 64 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 64 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 64 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 66 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 66 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 66 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 67 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 67 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 67 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 65 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 65 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 65 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 65 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 65 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 65 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 65 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 68 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 69 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 70 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 71 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 72 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 72 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 72 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 73 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 73 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 73 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 73 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 74 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 74 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 77 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 77 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 77 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 77 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 77 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 77 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 79 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 79 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .type __dpml_response_table,@object + .size __dpml_response_table,1520 + .align 4 + .globl __dpml_globals_table +__dpml_globals_table: + .long 4290772992 + .long 0 + .long 0 + .long 4294443008 + .long 0 + .long 0 + .long 0 + .long 4294934528 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 1 + .long 0 + .long 1 + .long 0 + .long 0 + .long 0 + .long 2147483649 + .long 0 + .long 1 + .long 2147483648 + .long 1 + .long 0 + .long 0 + .long 2147483648 + .long 2139095039 + .long 0 + .long 4294967295 + .long 2146435071 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 2147418111 + .long 4286578687 + .long 0 + .long 4294967295 + .long 4293918719 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294901759 + .long 2139095040 + .long 0 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 2147418112 + .long 4286578688 + .long 0 + .long 0 + .long 4293918720 + .long 0 + .long 0 + .long 0 + .long 4294901760 + .long 872415232 + .long 0 + .long 0 + .long 1018167296 + .long 0 + .long 0 + .long 0 + .long 1066336256 + .long 3019898880 + .long 0 + .long 0 + .long 3165650944 + .long 0 + .long 0 + .long 0 + .long 3213819904 + .long 1065353216 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 1073676288 + .long 3212836864 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 3221159936 + .type __dpml_globals_table,@object + .size __dpml_globals_table,416 + .data + .hidden __dpml_ux_sqrt_evaluation__ + .hidden __dpml_pack__ + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/isfinite.S b/external/sgx_libm/ia32/isfinite.S new file mode 100644 index 0000000000..d6e0559c12 --- /dev/null +++ b/external/sgx_libm/ia32/isfinite.S @@ -0,0 +1,389 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isfinite.c" + .text +..TXTST0: +# -- Begin isfinitel + .text + .align 16,0x90 + .globl isfinitel +isfinitel: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movzwl 12(%esp), %edx + shll $16, %edx + movzwl 10(%esp), %eax + orl %eax, %edx + andl $2147483647, %edx + xorl %eax, %eax + cmpl $2147418112, %edx + setb %al + ret + .align 16,0x90 + .type isfinitel,@function + .size isfinitel,.-isfinitel + .data +# -- End isfinitel + .text +# -- Begin __isfinitel + .text + .align 16,0x90 + .globl __isfinitel +__isfinitel: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + movzwl 12(%esp), %edx + shll $16, %edx + movzwl 10(%esp), %eax + orl %eax, %edx + andl $2147483647, %edx + xorl %eax, %eax + cmpl $2147418112, %edx + setb %al + ret + .align 16,0x90 + .type __isfinitel,@function + .size __isfinitel,.-__isfinitel + .data +# -- End __isfinitel + .text +# -- Begin isfinitef + .text + .align 16,0x90 + .globl isfinitef +isfinitef: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type isfinitef,@function + .size isfinitef,.-isfinitef + .data +# -- End isfinitef + .text +# -- Begin __isfinitef + .text + .align 16,0x90 + .globl __isfinitef +__isfinitef: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __isfinitef,@function + .size __isfinitef,.-__isfinitef + .data +# -- End __isfinitef + .text +# -- Begin isfinite + .text + .align 16,0x90 + .globl isfinite +isfinite: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type isfinite,@function + .size isfinite,.-isfinite + .data +# -- End isfinite + .text +# -- Begin __isfinite + .text + .align 16,0x90 + .globl __isfinite +__isfinite: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __isfinite,@function + .size __isfinite,.-__isfinite + .data +# -- End __isfinite + .text +# -- Begin isfinited + .text + .align 16,0x90 + .globl isfinited +isfinited: +# parameter 1: 4 + %esp +..B7.1: +..L7: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type isfinited,@function + .size isfinited,.-isfinited + .data +# -- End isfinited + .text +# -- Begin __isfinited + .text + .align 16,0x90 + .globl __isfinited +__isfinited: +# parameter 1: 4 + %esp +..B8.1: +..L8: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __isfinited,@function + .size __isfinited,.-__isfinited + .data +# -- End __isfinited + .text +# -- Begin finitel + .text + .align 16,0x90 + .globl finitel +finitel: +# parameter 1: 4 + %esp +..B9.1: +..L9: + + movzwl 12(%esp), %edx + shll $16, %edx + movzwl 10(%esp), %eax + orl %eax, %edx + andl $2147483647, %edx + xorl %eax, %eax + cmpl $2147418112, %edx + setb %al + ret + .align 16,0x90 + .type finitel,@function + .size finitel,.-finitel + .data +# -- End finitel + .text +# -- Begin __finitel + .text + .align 16,0x90 + .globl __finitel +__finitel: +# parameter 1: 4 + %esp +..B10.1: +..L10: + + movzwl 12(%esp), %edx + shll $16, %edx + movzwl 10(%esp), %eax + orl %eax, %edx + andl $2147483647, %edx + xorl %eax, %eax + cmpl $2147418112, %edx + setb %al + ret + .align 16,0x90 + .type __finitel,@function + .size __finitel,.-__finitel + .data +# -- End __finitel + .text +# -- Begin finitef + .text + .align 16,0x90 + .globl finitef +finitef: +# parameter 1: 4 + %esp +..B11.1: +..L11: + + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type finitef,@function + .size finitef,.-finitef + .data +# -- End finitef + .text +# -- Begin __finitef + .text + .align 16,0x90 + .globl __finitef +__finitef: +# parameter 1: 4 + %esp +..B12.1: +..L12: + + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __finitef,@function + .size __finitef,.-__finitef + .data +# -- End __finitef + .text +# -- Begin finite + .text + .align 16,0x90 + .globl finite +finite: +# parameter 1: 4 + %esp +..B13.1: +..L13: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type finite,@function + .size finite,.-finite + .data +# -- End finite + .text +# -- Begin __finite + .text + .align 16,0x90 + .globl __finite +__finite: +# parameter 1: 4 + %esp +..B14.1: +..L14: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __finite,@function + .size __finite,.-__finite + .data +# -- End __finite + .text +# -- Begin finited + .text + .align 16,0x90 + .globl finited +finited: +# parameter 1: 4 + %esp +..B15.1: +..L15: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type finited,@function + .size finited,.-finited + .data +# -- End finited + .text +# -- Begin __finited + .text + .align 16,0x90 + .globl __finited +__finited: +# parameter 1: 4 + %esp +..B16.1: +..L16: + + movl 8(%esp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __finited,@function + .size __finited,.-__finited + .data +# -- End __finited + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/isinf.S b/external/sgx_libm/ia32/isinf.S new file mode 100644 index 0000000000..bed0122708 --- /dev/null +++ b/external/sgx_libm/ia32/isinf.S @@ -0,0 +1,313 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isinf.c" + .text +..TXTST0: +# -- Begin __isinfd + .text + .align 16,0x90 + .globl __isinfd +__isinfd: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl $2146435072, %ecx + negl %ecx + movl 8(%esp), %eax + addl %eax, %ecx + movl 4(%esp), %edx + orl %edx, %ecx + jne ..B1.3 +..B1.2: + movl $1, %eax + ret +..B1.3: + movl $-1048576, %ecx + subl %ecx, %eax + orl %eax, %edx + jne ..B1.5 +..B1.4: + movl $-1, %eax + ret +..B1.5: + xorl %eax, %eax +..B1.6: + ret + .align 16,0x90 + .type __isinfd,@function + .size __isinfd,.-__isinfd + .data +# -- End __isinfd + .text +# -- Begin isinfd + .text + .align 16,0x90 + .globl isinfd +isinfd: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + movl $2146435072, %ecx + negl %ecx + movl 8(%esp), %eax + addl %eax, %ecx + movl 4(%esp), %edx + orl %edx, %ecx + jne ..B2.3 +..B2.2: + movl $1, %eax + ret +..B2.3: + movl $-1048576, %ecx + subl %ecx, %eax + orl %eax, %edx + jne ..B2.5 +..B2.4: + movl $-1, %eax + ret +..B2.5: + xorl %eax, %eax +..B2.6: + ret + .align 16,0x90 + .type isinfd,@function + .size isinfd,.-isinfd + .data +# -- End isinfd + .text +# -- Begin __isinf + .text + .align 16,0x90 + .globl __isinf +__isinf: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + movl $2146435072, %ecx + negl %ecx + movl 8(%esp), %eax + addl %eax, %ecx + movl 4(%esp), %edx + orl %edx, %ecx + jne ..B3.3 +..B3.2: + movl $1, %eax + ret +..B3.3: + movl $-1048576, %ecx + subl %ecx, %eax + orl %eax, %edx + jne ..B3.5 +..B3.4: + movl $-1, %eax + ret +..B3.5: + xorl %eax, %eax +..B3.6: + ret + .align 16,0x90 + .type __isinf,@function + .size __isinf,.-__isinf + .data +# -- End __isinf + .text +# -- Begin isinf + .text + .align 16,0x90 + .globl isinf +isinf: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + movl $2146435072, %ecx + negl %ecx + movl 8(%esp), %eax + addl %eax, %ecx + movl 4(%esp), %edx + orl %edx, %ecx + jne ..B4.3 +..B4.2: + movl $1, %eax + ret +..B4.3: + movl $-1048576, %ecx + subl %ecx, %eax + orl %eax, %edx + jne ..B4.5 +..B4.4: + movl $-1, %eax + ret +..B4.5: + xorl %eax, %eax +..B4.6: + ret + .align 16,0x90 + .type isinf,@function + .size isinf,.-isinf + .data +# -- End isinf + .text +# -- Begin __isinff + .text + .align 16,0x90 + .globl __isinff +__isinff: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + movl 4(%esp), %edx + cmpl $2139095040, %edx + jne ..B5.3 +..B5.2: + movl $1, %eax + ret +..B5.3: + cmpl $-8388608, %edx + movl $0, %eax + setne %al + decl %eax + ret + .align 16,0x90 + .type __isinff,@function + .size __isinff,.-__isinff + .data +# -- End __isinff + .text +# -- Begin isinff + .text + .align 16,0x90 + .globl isinff +isinff: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + movl 4(%esp), %edx + cmpl $2139095040, %edx + jne ..B6.3 +..B6.2: + movl $1, %eax + ret +..B6.3: + cmpl $-8388608, %edx + movl $0, %eax + setne %al + decl %eax + ret + .align 16,0x90 + .type isinff,@function + .size isinff,.-isinff + .data +# -- End isinff + .text +# -- Begin __isinfl + .text + .align 16,0x90 + .globl __isinfl +__isinfl: +# parameter 1: 4 + %esp +..B7.1: +..L7: + + movzwl 12(%esp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B7.3 +..B7.2: + xorl %eax, %eax + ret +..B7.3: + cmpl $-2147483648, 8(%esp) + jne ..B7.2 +..B7.4: + cmpl $0, 4(%esp) + jne ..B7.2 +..B7.5: + movzbl 13(%esp), %eax + notl %eax + andl $128, %eax + shrl $6, %eax + decl %eax + ret + .align 16,0x90 + .type __isinfl,@function + .size __isinfl,.-__isinfl + .data +# -- End __isinfl + .text +# -- Begin isinfl + .text + .align 16,0x90 + .globl isinfl +isinfl: +# parameter 1: 4 + %esp +..B8.1: +..L8: + + movzwl 12(%esp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B8.3 +..B8.2: + xorl %eax, %eax + ret +..B8.3: + cmpl $-2147483648, 8(%esp) + jne ..B8.2 +..B8.4: + cmpl $0, 4(%esp) + jne ..B8.2 +..B8.5: + movzbl 13(%esp), %eax + notl %eax + andl $128, %eax + shrl $6, %eax + decl %eax + ret + .align 16,0x90 + .type isinfl,@function + .size isinfl,.-isinfl + .data +# -- End isinfl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/isnan.S b/external/sgx_libm/ia32/isnan.S new file mode 100644 index 0000000000..e49ab0acab --- /dev/null +++ b/external/sgx_libm/ia32/isnan.S @@ -0,0 +1,271 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isnan.c" + .text +..TXTST0: +# -- Begin __isnand + .text + .align 16,0x90 + .globl __isnand +__isnand: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl $2146435072, %eax + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + subl %eax, %edx + jb ..B1.3 +..B1.7: + orl %edx, %ecx + je ..B1.3 +..B1.2: + movl $1, %eax + ret +..B1.3: + xorl %eax, %eax +..B1.4: + ret + .align 16,0x90 + .type __isnand,@function + .size __isnand,.-__isnand + .data +# -- End __isnand + .text +# -- Begin isnand + .text + .align 16,0x90 + .globl isnand +isnand: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + movl $2146435072, %eax + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + subl %eax, %edx + jb ..B2.3 +..B2.7: + orl %edx, %ecx + je ..B2.3 +..B2.2: + movl $1, %eax + ret +..B2.3: + xorl %eax, %eax +..B2.4: + ret + .align 16,0x90 + .type isnand,@function + .size isnand,.-isnand + .data +# -- End isnand + .text +# -- Begin __isnan + .text + .align 16,0x90 + .globl __isnan +__isnan: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + movl $2146435072, %eax + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + subl %eax, %edx + jb ..B3.3 +..B3.7: + orl %edx, %ecx + je ..B3.3 +..B3.2: + movl $1, %eax + ret +..B3.3: + xorl %eax, %eax +..B3.4: + ret + .align 16,0x90 + .type __isnan,@function + .size __isnan,.-__isnan + .data +# -- End __isnan + .text +# -- Begin isnan + .text + .align 16,0x90 + .globl isnan +isnan: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + movl $2146435072, %eax + movl 8(%esp), %edx + andl $2147483647, %edx + movl 4(%esp), %ecx + subl %eax, %edx + jb ..B4.3 +..B4.7: + orl %edx, %ecx + je ..B4.3 +..B4.2: + movl $1, %eax + ret +..B4.3: + xorl %eax, %eax +..B4.4: + ret + .align 16,0x90 + .type isnan,@function + .size isnan,.-isnan + .data +# -- End isnan + .text +# -- Begin __isnanf + .text + .align 16,0x90 + .globl __isnanf +__isnanf: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + movl $0, %eax + seta %al + ret + .align 16,0x90 + .type __isnanf,@function + .size __isnanf,.-__isnanf + .data +# -- End __isnanf + .text +# -- Begin isnanf + .text + .align 16,0x90 + .globl isnanf +isnanf: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + movl $0, %eax + seta %al + ret + .align 16,0x90 + .type isnanf,@function + .size isnanf,.-isnanf + .data +# -- End isnanf + .text +# -- Begin __isnanl + .text + .align 16,0x90 + .globl __isnanl +__isnanl: +# parameter 1: 4 + %esp +..B7.1: +..L7: + + movzwl 12(%esp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B7.4 +..B7.2: + xorl %eax, %eax +..B7.3: + ret +..B7.4: + cmpl $-2147483648, 8(%esp) + jne ..B7.6 +..B7.5: + cmpl $0, 4(%esp) + je ..B7.2 +..B7.6: + movl $1, %eax + ret + .align 16,0x90 + .type __isnanl,@function + .size __isnanl,.-__isnanl + .data +# -- End __isnanl + .text +# -- Begin isnanl + .text + .align 16,0x90 + .globl isnanl +isnanl: +# parameter 1: 4 + %esp +..B8.1: +..L8: + + movzwl 12(%esp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B8.4 +..B8.2: + xorl %eax, %eax +..B8.3: + ret +..B8.4: + cmpl $-2147483648, 8(%esp) + jne ..B8.6 +..B8.5: + cmpl $0, 4(%esp) + je ..B8.2 +..B8.6: + movl $1, %eax + ret + .align 16,0x90 + .type isnanl,@function + .size isnanl,.-isnanl + .data +# -- End isnanl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/isnormal.S b/external/sgx_libm/ia32/isnormal.S new file mode 100644 index 0000000000..abc76f0b8d --- /dev/null +++ b/external/sgx_libm/ia32/isnormal.S @@ -0,0 +1,241 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isnormal.c" + .text +..TXTST0: +# -- Begin __isnormald + .text + .align 16,0x90 + .globl __isnormald +__isnormald: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl 8(%esp), %eax + andl $2147483647, %eax + addl $-1048576, %eax + cmpl $2145386496, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __isnormald,@function + .size __isnormald,.-__isnormald + .data +# -- End __isnormald + .text +# -- Begin isnormald + .text + .align 16,0x90 + .globl isnormald +isnormald: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + movl 8(%esp), %eax + andl $2147483647, %eax + addl $-1048576, %eax + cmpl $2145386496, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type isnormald,@function + .size isnormald,.-isnormald + .data +# -- End isnormald + .text +# -- Begin __isnormal + .text + .align 16,0x90 + .globl __isnormal +__isnormal: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + movl 8(%esp), %eax + andl $2147483647, %eax + addl $-1048576, %eax + cmpl $2145386496, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __isnormal,@function + .size __isnormal,.-__isnormal + .data +# -- End __isnormal + .text +# -- Begin isnormal + .text + .align 16,0x90 + .globl isnormal +isnormal: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + movl 8(%esp), %eax + andl $2147483647, %eax + addl $-1048576, %eax + cmpl $2145386496, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type isnormal,@function + .size isnormal,.-isnormal + .data +# -- End isnormal + .text +# -- Begin __isnormalf + .text + .align 16,0x90 + .globl __isnormalf +__isnormalf: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + movl 4(%esp), %eax + andl $2147483647, %eax + addl $-8388608, %eax + cmpl $2130706432, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type __isnormalf,@function + .size __isnormalf,.-__isnormalf + .data +# -- End __isnormalf + .text +# -- Begin isnormalf + .text + .align 16,0x90 + .globl isnormalf +isnormalf: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + movl 4(%esp), %eax + andl $2147483647, %eax + addl $-8388608, %eax + cmpl $2130706432, %eax + movl $0, %eax + setb %al + ret + .align 16,0x90 + .type isnormalf,@function + .size isnormalf,.-isnormalf + .data +# -- End isnormalf + .text +# -- Begin __isnormall + .text + .align 16,0x90 + .globl __isnormall +__isnormall: +# parameter 1: 4 + %esp +..B7.1: +..L7: + + movzwl 12(%esp), %edx + shll $16, %edx + movzwl 10(%esp), %eax + orl %eax, %edx + andl $2147483647, %edx + cmpl $4096, %edx + jb ..B7.4 +..B7.2: + testl $32768, %edx + jne ..B7.4 +..B7.3: + xorl %eax, %eax + ret +..B7.4: + addl $-65536, %edx + xorl %eax, %eax + cmpl $2147352576, %edx + setb %al + ret + .align 16,0x90 + .type __isnormall,@function + .size __isnormall,.-__isnormall + .data +# -- End __isnormall + .text +# -- Begin isnormall + .text + .align 16,0x90 + .globl isnormall +isnormall: +# parameter 1: 4 + %esp +..B8.1: +..L8: + + movzwl 12(%esp), %edx + shll $16, %edx + movzwl 10(%esp), %eax + orl %eax, %edx + andl $2147483647, %edx + cmpl $4096, %edx + jb ..B8.4 +..B8.2: + testl $32768, %edx + jne ..B8.4 +..B8.3: + xorl %eax, %eax + ret +..B8.4: + addl $-65536, %edx + xorl %eax, %eax + cmpl $2147352576, %edx + setb %al + ret + .align 16,0x90 + .type isnormall,@function + .size isnormall,.-isnormall + .data +# -- End isnormall + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/j0.S b/external/sgx_libm/ia32/j0.S new file mode 100644 index 0000000000..e0d0e8793e --- /dev/null +++ b/external/sgx_libm/ia32/j0.S @@ -0,0 +1,2689 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j0.c" + .text +..TXTST0: +# -- Begin __j0l + .text + .align 16,0x90 + .hidden __j0l + .globl __j0l +__j0l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %ebx + subl $120, %esp + fldt 8(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fldt 132+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B1.9 +..B1.2: + fldt _S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.4 +..B1.3: + fldt _Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 168+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 180+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 204+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 216+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 228+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 240+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.4: + movl $1, %edx +..B1.5: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %ecx + fldt _S@GOTOFF(%ebx,%ecx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.8 + jp ..B1.8 +..B1.6: + incl %edx + cmpl $11, %edx + jl ..B1.5 +..B1.7: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx +..B1.8: + fldt _Z@GOTOFF(%ecx,%ebx) + movl %edx, %eax + fsubrp %st, %st(1) + shll $4, %eax + fld %st(0) + subl %edx, %eax + shll $4, %eax + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt -240+_P@GOTOFF(%eax,%ebx) + fmul %st(1), %st + fldt -228+_P@GOTOFF(%eax,%ebx) + fmul %st(2), %st + fldt -216+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -204+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -192+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -180+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -168+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -156+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -144+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -132+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -120+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -108+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -96+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -84+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -72+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -60+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -48+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -36+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -24+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -12+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fldl _ones@GOTOFF(%ebx) + lea 92(%esp), %eax + fdiv %st(1), %st + lea 64(%esp), %edx + fxch %st(1) + fxch %st(1) + fstpt -60(%eax) + fldt -60(%eax) + fxch %st(1) + fstpt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt -28(%eax) + fldt -28(%eax) + movl %eax, 12(%esp) + movl %edx, 16(%esp) + movl $-1, 20(%esp) + fxch %st(1) + fstpt (%eax) + fldt (%eax) + fldt _PP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -44(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt -12(%eax) + call __libm_sincos_pi4l +..B1.10: + fldt 8(%ebp) + fldt 80(%esp) + fldt 48(%esp) + fldt 64(%esp) + fmulp %st, %st(1) + fldt 92(%esp) + fmulp %st, %st(2) + fsub %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B1.12 + jp ..B1.12 +..B1.11: + fstp %st(1) + fldt _tonpi@GOTOFF(%ebx) + fldt 32(%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.12: + fstp %st(0) + lea 32(%esp), %esi + movl %esi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.19: + addl $-32, %esp + movl (%esi), %ecx + lea 80(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%esi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%esi), %ecx + movl 12(%esi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __j0q@PLT +..B1.18: + addl $28, %esp +..B1.13: + movl 48(%esp), %eax + movl %eax, (%esi) + movl 52(%esp), %edx + movl 56(%esp), %ecx + movl 60(%esp), %eax + addl $4, %esp + pushl %esi + movl %edx, 4(%esi) + movl %ecx, 8(%esi) + movl %eax, 12(%esi) + call __qtol@PLT +..B1.14: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __j0l,@function + .size __j0l,.-__j0l + .data +# -- End __j0l + .text +# -- Begin j0 + .text + .align 16,0x90 + .globl j0 +j0: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp +..B2.2: + fnstcw 46(%esp) +..B2.3: + movl 12(%ebp), %eax + andl $2147483647, %eax + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + cmpl $2146435072, %eax + jge ..B2.26 +..B2.4: + cmpl $1012924416, %eax + jl ..B2.25 +..B2.5: + movzwl 46(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.31 +..B2.6: + orl $-64768, %edx + movw %dx, 44(%esp) +..B2.7: + fldcw 44(%esp) +..B2.8: + movl $1, %edi +..B2.9: + fldl 8(%ebp) + fabs + fldt 132+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B2.17 +..B2.10: + fldt _S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.12 +..B2.11: + fldt _Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 76(%esp) + fldt 76(%esp) + fldt _P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 168+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 180+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 204+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 216+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 228+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 240+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B2.22 +..B2.12: + movl $1, %edx +..B2.13: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %ecx + fldt _S@GOTOFF(%ebx,%ecx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B2.16 + jp ..B2.16 +..B2.14: + incl %edx + cmpl $11, %edx + jl ..B2.13 +..B2.15: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx +..B2.16: + fldt _Z@GOTOFF(%ecx,%ebx) + movl %edx, %eax + shll $4, %eax + fsubrp %st, %st(1) + subl %edx, %eax + fld %st(0) + shll $4, %eax + fmul %st(1), %st + fstpt 76(%esp) + fldt 76(%esp) + fldt -240+_P@GOTOFF(%eax,%ebx) + fmul %st(1), %st + fldt -228+_P@GOTOFF(%eax,%ebx) + fmul %st(2), %st + fldt -216+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -204+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -192+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -180+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -168+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -156+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -144+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -132+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -120+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -108+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -96+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -84+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -72+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -60+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -48+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -36+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -24+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -12+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B2.22 +..B2.17: + fldl _ones@GOTOFF(%ebx) + fdiv %st(1), %st + fstpt (%esp) + fldt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fstpt 76(%esp) + fldt 76(%esp) + addl $-32, %esp + lea 108(%esp), %eax + lea 64(%esp), %edx + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fldt _PP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP@GOTOFF(%ebx) + movl %eax, 12(%esp) + faddp %st, %st(1) + fmul %st(2), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP@GOTOFF(%ebx) + movl %edx, 16(%esp) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_PP@GOTOFF(%ebx) + movl $-1, 20(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fstpt -12(%eax) + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -60(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -28(%eax) + call __libm_sincos_pi4l +..B2.34: + fldt 96(%esp) + fldt 80(%esp) + fldt 48(%esp) + addl $32, %esp +..B2.18: + fldt 32(%esp) + fmulp %st, %st(1) + fldt 76(%esp) + fmulp %st, %st(2) + fsub %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B2.20 + jp ..B2.20 +..B2.19: + fstp %st(1) + fldt _tonpi@GOTOFF(%ebx) + fldt (%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + fstpt 16(%esp) + jmp ..B2.22 +..B2.20: + fstp %st(0) + addl $-16, %esp + lea 16(%esp), %esi + movl %esi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B2.36: + addl $-16, %esp + movl (%esi), %ecx + lea 48(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%esi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%esi), %ecx + movl 12(%esi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __j0q@PLT +..B2.35: + addl $28, %esp +..B2.21: + movl 16(%esp), %eax + movl %eax, (%esi) + movl 20(%esp), %edx + movl 24(%esp), %ecx + movl 28(%esp), %eax + addl $-16, %esp + movl %edx, 4(%esi) + movl %ecx, 8(%esi) + movl %eax, 12(%esi) + movl %esi, (%esp) + call __qtol@PLT +..B2.37: + fstpt 32(%esp) + addl $16, %esp +..B2.22: + testl %edi, %edi + je ..B2.24 +..B2.23: + fldcw 46(%esp) +..B2.24: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.25: + fldl 8(%ebp) + fabs + fsubrl _ones@GOTOFF(%ebx) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.26: + andl $-2146435073, %eax + orl 8(%ebp), %eax + je ..B2.28 +..B2.27: + fldl _ones@GOTOFF(%ebx) + fmull 8(%ebp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.28: + fldl _zeros@GOTOFF(%ebx) +..B2.29: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.31: + xorl %edi, %edi + jmp ..B2.9 + .align 16,0x90 + .type j0,@function + .size j0,.-j0 + .data +# -- End j0 + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_S: + .word 17728 + .word 31608 + .word 43949 + .word 62778 + .word 16384 + .word 0 + .word 32551 + .word 41874 + .word 44957 + .word 57471 + .word 16385 + .word 0 + .word 18949 + .word 61409 + .word 34437 + .word 41670 + .word 16386 + .word 0 + .word 4396 + .word 34605 + .word 55192 + .word 54573 + .word 16386 + .word 0 + .word 9307 + .word 10310 + .word 55728 + .word 33731 + .word 16387 + .word 0 + .word 7613 + .word 2917 + .word 18234 + .word 40173 + .word 16387 + .word 0 + .word 24292 + .word 42693 + .word 42782 + .word 46612 + .word 16387 + .word 0 + .word 12570 + .word 29960 + .word 47214 + .word 53050 + .word 16387 + .word 0 + .word 24415 + .word 36838 + .word 59299 + .word 59487 + .word 16387 + .word 0 + .word 32322 + .word 22879 + .word 15219 + .word 32962 + .word 16388 + .word 0 + .word 56404 + .word 12107 + .word 18542 + .word 36180 + .word 16388 + .word 0 + .word 18639 + .word 44635 + .word 10526 + .word 39398 + .word 16388 + .word 0 + .type _S,@object + .size _S,144 + .align 2 +_Z: + .word 64993 + .word 47321 + .word 43380 + .word 39400 + .word 16384 + .word 0 + .word 10427 + .word 24946 + .word 31449 + .word 45220 + .word 16385 + .word 0 + .word 20142 + .word 26358 + .word 43878 + .word 35445 + .word 16386 + .word 0 + .word 45380 + .word 5013 + .word 8196 + .word 48298 + .word 16386 + .word 0 + .word 36049 + .word 37774 + .word 2551 + .word 61157 + .word 16386 + .word 0 + .word 44499 + .word 20687 + .word 35324 + .word 37009 + .word 16387 + .word 0 + .word 37149 + .word 40892 + .word 28299 + .word 43441 + .word 16387 + .word 0 + .word 59921 + .word 2742 + .word 56472 + .word 49873 + .word 16387 + .word 0 + .word 35749 + .word 60152 + .word 42287 + .word 56306 + .word 16387 + .word 0 + .word 36553 + .word 24054 + .word 44174 + .word 62739 + .word 16387 + .word 0 + .word 12707 + .word 13183 + .word 28829 + .word 34586 + .word 16388 + .word 0 + .word 24309 + .word 45263 + .word 7124 + .word 37803 + .word 16388 + .word 0 + .type _Z,@object + .size _Z,144 + .align 2 +_P1: + .word 41974 + .word 50359 + .word 55 + .word 49432 + .word 49085 + .word 0 + .word 46729 + .word 24287 + .word 10077 + .word 43682 + .word 16323 + .word 0 + .word 54556 + .word 53463 + .word 26566 + .word 47408 + .word 16327 + .word 0 + .word 61625 + .word 30678 + .word 34691 + .word 56786 + .word 49099 + .word 0 + .word 32205 + .word 55323 + .word 47622 + .word 59679 + .word 49103 + .word 0 + .word 29650 + .word 64976 + .word 4011 + .word 64391 + .word 16339 + .word 0 + .word 31057 + .word 21065 + .word 6935 + .word 59041 + .word 16343 + .word 0 + .word 36662 + .word 39842 + .word 13910 + .word 57058 + .word 49115 + .word 0 + .word 21879 + .word 21964 + .word 7382 + .word 44566 + .word 49119 + .word 0 + .word 35904 + .word 38403 + .word 56995 + .word 38056 + .word 16355 + .word 0 + .word 18301 + .word 44371 + .word 51380 + .word 49148 + .word 16358 + .word 0 + .word 24372 + .word 2933 + .word 6164 + .word 36455 + .word 49130 + .word 0 + .word 49391 + .word 5716 + .word 15337 + .word 37270 + .word 49133 + .word 0 + .word 25965 + .word 16194 + .word 56568 + .word 46953 + .word 16368 + .word 0 + .word 45667 + .word 13925 + .word 5584 + .word 35484 + .word 16371 + .word 0 + .word 49022 + .word 26773 + .word 37576 + .word 36812 + .word 49142 + .word 0 + .word 36832 + .word 53763 + .word 58864 + .word 36312 + .word 49144 + .word 0 + .word 33543 + .word 46187 + .word 17185 + .word 59351 + .word 16378 + .word 0 + .word 40102 + .word 5284 + .word 63312 + .word 56590 + .word 16379 + .word 0 + .word 857 + .word 43156 + .word 55730 + .word 34022 + .word 49150 + .word 0 + .word 52121 + .word 9280 + .word 35775 + .word 47190 + .word 16318 + .word 0 + .type _P1,@object + .size _P1,252 + .align 2 +_P: + .word 25701 + .word 56152 + .word 43593 + .word 44746 + .word 49091 + .word 0 + .word 48832 + .word 40943 + .word 62738 + .word 40407 + .word 49095 + .word 0 + .word 27954 + .word 18691 + .word 56371 + .word 61331 + .word 16331 + .word 0 + .word 59673 + .word 34431 + .word 10026 + .word 51320 + .word 16335 + .word 0 + .word 19628 + .word 6656 + .word 43961 + .word 34852 + .word 49108 + .word 0 + .word 10797 + .word 38877 + .word 18617 + .word 49740 + .word 49111 + .word 0 + .word 55276 + .word 31862 + .word 41256 + .word 61817 + .word 16347 + .word 0 + .word 56169 + .word 58452 + .word 6548 + .word 36482 + .word 16351 + .word 0 + .word 22526 + .word 12680 + .word 38609 + .word 41195 + .word 49123 + .word 0 + .word 35707 + .word 29316 + .word 48923 + .word 38609 + .word 49126 + .word 0 + .word 54924 + .word 17159 + .word 27854 + .word 39283 + .word 16362 + .word 0 + .word 7410 + .word 20104 + .word 60324 + .word 54971 + .word 16364 + .word 0 + .word 42961 + .word 8606 + .word 41997 + .word 49951 + .word 49136 + .word 0 + .word 20439 + .word 51893 + .word 4000 + .word 47026 + .word 49138 + .word 0 + .word 59638 + .word 54459 + .word 36852 + .word 37873 + .word 16374 + .word 0 + .word 53889 + .word 4789 + .word 65352 + .word 38847 + .word 16375 + .word 0 + .word 1714 + .word 3910 + .word 34394 + .word 55562 + .word 49146 + .word 0 + .word 303 + .word 16967 + .word 38717 + .word 64635 + .word 49145 + .word 0 + .word 5713 + .word 19393 + .word 12368 + .word 44599 + .word 16381 + .word 0 + .word 21960 + .word 14969 + .word 53843 + .word 43675 + .word 16319 + .word 0 + .word 52500 + .word 174 + .word 33388 + .word 44907 + .word 16323 + .word 0 + .word 36805 + .word 62602 + .word 43329 + .word 35133 + .word 16327 + .word 0 + .word 27761 + .word 25841 + .word 3607 + .word 63286 + .word 49099 + .word 0 + .word 6612 + .word 54609 + .word 58140 + .word 43860 + .word 49103 + .word 0 + .word 37993 + .word 17870 + .word 56109 + .word 35856 + .word 16340 + .word 0 + .word 61675 + .word 27140 + .word 56422 + .word 41440 + .word 16343 + .word 0 + .word 56971 + .word 52432 + .word 57814 + .word 63191 + .word 49115 + .word 0 + .word 25412 + .word 37118 + .word 3118 + .word 58735 + .word 49118 + .word 0 + .word 38291 + .word 36319 + .word 26004 + .word 41665 + .word 16355 + .word 0 + .word 50251 + .word 22788 + .word 9163 + .word 59245 + .word 16357 + .word 0 + .word 15018 + .word 28 + .word 26139 + .word 39028 + .word 49130 + .word 0 + .word 33331 + .word 48247 + .word 16919 + .word 39314 + .word 49132 + .word 0 + .word 9684 + .word 33609 + .word 24106 + .word 48128 + .word 16368 + .word 0 + .word 51011 + .word 47822 + .word 659 + .word 60363 + .word 16369 + .word 0 + .word 37534 + .word 11575 + .word 45084 + .word 34566 + .word 49142 + .word 0 + .word 45912 + .word 27680 + .word 6912 + .word 42099 + .word 49142 + .word 0 + .word 56715 + .word 12873 + .word 49782 + .word 46172 + .word 16378 + .word 0 + .word 26728 + .word 49648 + .word 65144 + .word 32891 + .word 16377 + .word 0 + .word 40426 + .word 15254 + .word 52157 + .word 35579 + .word 49149 + .word 0 + .word 38384 + .word 45177 + .word 47511 + .word 58357 + .word 16319 + .word 0 + .word 58158 + .word 44133 + .word 45474 + .word 44841 + .word 49091 + .word 0 + .word 25822 + .word 50828 + .word 25446 + .word 60617 + .word 49094 + .word 0 + .word 15324 + .word 12408 + .word 38243 + .word 63699 + .word 16331 + .word 0 + .word 14774 + .word 16677 + .word 5572 + .word 37105 + .word 16335 + .word 0 + .word 22149 + .word 54660 + .word 59654 + .word 35846 + .word 49108 + .word 0 + .word 11697 + .word 52785 + .word 2274 + .word 34156 + .word 49111 + .word 0 + .word 53627 + .word 64285 + .word 10253 + .word 62534 + .word 16347 + .word 0 + .word 24801 + .word 65406 + .word 2005 + .word 46814 + .word 16350 + .word 0 + .word 32190 + .word 19121 + .word 50201 + .word 40636 + .word 49123 + .word 0 + .word 54751 + .word 12899 + .word 38715 + .word 45207 + .word 49125 + .word 0 + .word 43490 + .word 42082 + .word 27556 + .word 37283 + .word 16362 + .word 0 + .word 22028 + .word 56865 + .word 50900 + .word 56715 + .word 16363 + .word 0 + .word 16346 + .word 12991 + .word 64075 + .word 44659 + .word 49136 + .word 0 + .word 52492 + .word 22409 + .word 7105 + .word 40702 + .word 49137 + .word 0 + .word 6702 + .word 59476 + .word 47051 + .word 61808 + .word 16373 + .word 0 + .word 62316 + .word 14189 + .word 19866 + .word 53935 + .word 16373 + .word 0 + .word 9195 + .word 51568 + .word 61124 + .word 40040 + .word 49146 + .word 0 + .word 6439 + .word 11299 + .word 34414 + .word 41343 + .word 49144 + .word 0 + .word 46739 + .word 24947 + .word 62261 + .word 60937 + .word 16380 + .word 0 + .word 58365 + .word 23430 + .word 12962 + .word 38007 + .word 49087 + .word 0 + .word 58251 + .word 41189 + .word 49383 + .word 44339 + .word 16323 + .word 0 + .word 48598 + .word 60621 + .word 33089 + .word 52046 + .word 16326 + .word 0 + .word 15609 + .word 33598 + .word 37151 + .word 63031 + .word 49099 + .word 0 + .word 47302 + .word 16218 + .word 41542 + .word 62539 + .word 49102 + .word 0 + .word 57122 + .word 24762 + .word 37625 + .word 35182 + .word 16340 + .word 0 + .word 14554 + .word 11813 + .word 4690 + .word 56239 + .word 16342 + .word 0 + .word 54525 + .word 1724 + .word 15173 + .word 60713 + .word 49115 + .word 0 + .word 63047 + .word 59633 + .word 16097 + .word 37474 + .word 49118 + .word 0 + .word 47674 + .word 64044 + .word 50935 + .word 38909 + .word 16355 + .word 0 + .word 10733 + .word 57181 + .word 7346 + .word 35019 + .word 16357 + .word 0 + .word 60139 + .word 34186 + .word 61790 + .word 35089 + .word 49130 + .word 0 + .word 42252 + .word 41404 + .word 34184 + .word 42385 + .word 49131 + .word 0 + .word 1522 + .word 6058 + .word 55347 + .word 41209 + .word 16368 + .word 0 + .word 8896 + .word 65510 + .word 60684 + .word 58885 + .word 16368 + .word 0 + .word 5547 + .word 57306 + .word 64532 + .word 55968 + .word 49141 + .word 0 + .word 14723 + .word 16104 + .word 43168 + .word 38160 + .word 49141 + .word 0 + .word 64145 + .word 20360 + .word 50512 + .word 35772 + .word 16378 + .word 0 + .word 36202 + .word 63428 + .word 51591 + .word 58021 + .word 16375 + .word 0 + .word 65464 + .word 45991 + .word 59516 + .word 54144 + .word 49148 + .word 0 + .word 24568 + .word 20436 + .word 61634 + .word 37862 + .word 49086 + .word 0 + .word 45319 + .word 25104 + .word 37206 + .word 43484 + .word 49091 + .word 0 + .word 21849 + .word 55910 + .word 13070 + .word 44688 + .word 49094 + .word 0 + .word 3252 + .word 24429 + .word 41684 + .word 61678 + .word 16331 + .word 0 + .word 18877 + .word 5474 + .word 3532 + .word 52835 + .word 16334 + .word 0 + .word 29000 + .word 47276 + .word 64838 + .word 34154 + .word 49108 + .word 0 + .word 20967 + .word 63980 + .word 13404 + .word 46613 + .word 49110 + .word 0 + .word 52562 + .word 53463 + .word 21966 + .word 58373 + .word 16347 + .word 0 + .word 9777 + .word 2939 + .word 17549 + .word 60815 + .word 16349 + .word 0 + .word 26283 + .word 15936 + .word 57935 + .word 36992 + .word 49123 + .word 0 + .word 53769 + .word 29752 + .word 63351 + .word 55571 + .word 49124 + .word 0 + .word 39733 + .word 64164 + .word 46820 + .word 32952 + .word 16362 + .word 0 + .word 176 + .word 24001 + .word 47175 + .word 32916 + .word 16363 + .word 0 + .word 42514 + .word 53223 + .word 40190 + .word 38228 + .word 49136 + .word 0 + .word 32337 + .word 51109 + .word 43299 + .word 44928 + .word 49136 + .word 0 + .word 59799 + .word 62803 + .word 25577 + .word 51379 + .word 16373 + .word 0 + .word 14970 + .word 20015 + .word 15936 + .word 57562 + .word 16372 + .word 0 + .word 65161 + .word 31438 + .word 7531 + .word 65214 + .word 49145 + .word 0 + .word 20513 + .word 44789 + .word 62889 + .word 43571 + .word 49143 + .word 0 + .word 4307 + .word 19900 + .word 64182 + .word 49211 + .word 16380 + .word 0 + .word 23601 + .word 8473 + .word 7427 + .word 49494 + .word 49087 + .word 0 + .word 7362 + .word 8526 + .word 7254 + .word 42403 + .word 16323 + .word 0 + .word 35188 + .word 37258 + .word 23196 + .word 38516 + .word 16326 + .word 0 + .word 28716 + .word 28394 + .word 59353 + .word 59952 + .word 49099 + .word 0 + .word 5380 + .word 17306 + .word 43095 + .word 44938 + .word 49102 + .word 0 + .word 62603 + .word 29353 + .word 43042 + .word 32969 + .word 16340 + .word 0 + .word 14219 + .word 29360 + .word 8286 + .word 39065 + .word 16342 + .word 0 + .word 51755 + .word 8774 + .word 37073 + .word 55906 + .word 49115 + .word 0 + .word 56892 + .word 44416 + .word 43797 + .word 50190 + .word 49117 + .word 0 + .word 61329 + .word 48733 + .word 6023 + .word 35132 + .word 16355 + .word 0 + .word 7541 + .word 9021 + .word 40244 + .word 45179 + .word 16356 + .word 0 + .word 26533 + .word 29344 + .word 18926 + .word 62060 + .word 49129 + .word 0 + .word 30572 + .word 2598 + .word 8389 + .word 52807 + .word 49130 + .word 0 + .word 51943 + .word 22643 + .word 23287 + .word 35717 + .word 16368 + .word 0 + .word 64388 + .word 35284 + .word 47919 + .word 35658 + .word 16368 + .word 0 + .word 29632 + .word 11036 + .word 42088 + .word 47700 + .word 49141 + .word 0 + .word 31422 + .word 44089 + .word 40511 + .word 45376 + .word 49140 + .word 0 + .word 24082 + .word 23937 + .word 40663 + .word 60291 + .word 16377 + .word 0 + .word 35871 + .word 18767 + .word 59204 + .word 34260 + .word 16375 + .word 0 + .word 55945 + .word 59437 + .word 40276 + .word 45420 + .word 49148 + .word 0 + .word 36087 + .word 44447 + .word 31316 + .word 65259 + .word 16318 + .word 0 + .word 33015 + .word 55199 + .word 13485 + .word 41205 + .word 49091 + .word 0 + .word 28040 + .word 38678 + .word 23200 + .word 33402 + .word 49094 + .word 0 + .word 24126 + .word 8131 + .word 32863 + .word 58069 + .word 16331 + .word 0 + .word 35392 + .word 16287 + .word 64004 + .word 38564 + .word 16334 + .word 0 + .word 24419 + .word 65021 + .word 26451 + .word 63502 + .word 49107 + .word 0 + .word 50428 + .word 39809 + .word 46675 + .word 33151 + .word 49110 + .word 0 + .word 43497 + .word 65182 + .word 62592 + .word 53510 + .word 16347 + .word 0 + .word 13653 + .word 47792 + .word 51483 + .word 42124 + .word 16349 + .word 0 + .word 51670 + .word 53417 + .word 2690 + .word 33418 + .word 49123 + .word 0 + .word 18048 + .word 20017 + .word 2806 + .word 37530 + .word 49124 + .word 0 + .word 28377 + .word 1564 + .word 33730 + .word 58682 + .word 16361 + .word 0 + .word 50365 + .word 41139 + .word 10086 + .word 43478 + .word 16362 + .word 0 + .word 61280 + .word 6173 + .word 58518 + .word 33596 + .word 49136 + .word 0 + .word 37780 + .word 41188 + .word 55897 + .word 58318 + .word 49135 + .word 0 + .word 54954 + .word 62311 + .word 27470 + .word 44684 + .word 16373 + .word 0 + .word 57442 + .word 38159 + .word 64608 + .word 36945 + .word 16372 + .word 0 + .word 24087 + .word 55434 + .word 11948 + .word 56328 + .word 49145 + .word 0 + .word 3958 + .word 29640 + .word 49133 + .word 55700 + .word 49142 + .word 0 + .word 27700 + .word 45302 + .word 5983 + .word 42389 + .word 16380 + .word 0 + .word 40427 + .word 54367 + .word 12482 + .word 37240 + .word 16320 + .word 0 + .word 59852 + .word 29007 + .word 23004 + .word 39969 + .word 16323 + .word 0 + .word 34211 + .word 57602 + .word 36659 + .word 58360 + .word 16325 + .word 0 + .word 44442 + .word 16364 + .word 9911 + .word 56161 + .word 49099 + .word 0 + .word 28102 + .word 25155 + .word 37530 + .word 33414 + .word 49102 + .word 0 + .word 6555 + .word 37232 + .word 8513 + .word 61132 + .word 16339 + .word 0 + .word 19389 + .word 63961 + .word 54328 + .word 56964 + .word 16341 + .word 0 + .word 46901 + .word 14299 + .word 54235 + .word 51269 + .word 49115 + .word 0 + .word 21562 + .word 53008 + .word 37762 + .word 35900 + .word 49117 + .word 0 + .word 39053 + .word 49830 + .word 37166 + .word 63741 + .word 16354 + .word 0 + .word 45681 + .word 41863 + .word 1807 + .word 63504 + .word 16355 + .word 0 + .word 32524 + .word 20075 + .word 31047 + .word 55727 + .word 49129 + .word 0 + .word 19491 + .word 55333 + .word 6932 + .word 36559 + .word 49130 + .word 0 + .word 44244 + .word 33552 + .word 34722 + .word 63577 + .word 16367 + .word 0 + .word 16901 + .word 42071 + .word 41001 + .word 48810 + .word 16367 + .word 0 + .word 62438 + .word 12223 + .word 44142 + .word 42160 + .word 49141 + .word 0 + .word 23223 + .word 6493 + .word 11343 + .word 61664 + .word 49139 + .word 0 + .word 62523 + .word 30008 + .word 29610 + .word 53050 + .word 16377 + .word 0 + .word 14947 + .word 31100 + .word 26993 + .word 46432 + .word 16374 + .word 0 + .word 54892 + .word 55125 + .word 25696 + .word 39893 + .word 49148 + .word 0 + .word 64089 + .word 10154 + .word 50994 + .word 64131 + .word 16319 + .word 0 + .word 25208 + .word 35455 + .word 35497 + .word 38745 + .word 49091 + .word 0 + .word 22601 + .word 23897 + .word 16529 + .word 51375 + .word 49093 + .word 0 + .word 39957 + .word 27913 + .word 24611 + .word 54302 + .word 16331 + .word 0 + .word 45382 + .word 20134 + .word 36574 + .word 58452 + .word 16333 + .word 0 + .word 42298 + .word 30543 + .word 37555 + .word 58890 + .word 49107 + .word 0 + .word 22768 + .word 53677 + .word 2298 + .word 49504 + .word 49109 + .word 0 + .word 58111 + .word 6687 + .word 35097 + .word 49208 + .word 16347 + .word 0 + .word 10603 + .word 28285 + .word 57192 + .word 62022 + .word 16348 + .word 0 + .word 32868 + .word 54034 + .word 283 + .word 60966 + .word 49122 + .word 0 + .word 45349 + .word 58038 + .word 8163 + .word 54564 + .word 49123 + .word 0 + .word 55920 + .word 35455 + .word 60237 + .word 53133 + .word 16361 + .word 0 + .word 60123 + .word 63321 + .word 17152 + .word 62548 + .word 16361 + .word 0 + .word 39317 + .word 30736 + .word 60380 + .word 60458 + .word 49135 + .word 0 + .word 49393 + .word 44945 + .word 51803 + .word 41616 + .word 49135 + .word 0 + .word 20738 + .word 26362 + .word 9659 + .word 40012 + .word 16373 + .word 0 + .word 60223 + .word 27976 + .word 18717 + .word 52467 + .word 16371 + .word 0 + .word 54339 + .word 42843 + .word 18062 + .word 50282 + .word 49145 + .word 0 + .word 34001 + .word 60559 + .word 43103 + .word 39476 + .word 49142 + .word 0 + .word 26526 + .word 28531 + .word 16125 + .word 37792 + .word 16380 + .word 0 + .word 6095 + .word 56607 + .word 38079 + .word 40348 + .word 49087 + .word 0 + .word 15971 + .word 7192 + .word 49983 + .word 37562 + .word 16323 + .word 0 + .word 50443 + .word 47213 + .word 11879 + .word 45566 + .word 16325 + .word 0 + .word 11802 + .word 10368 + .word 62578 + .word 52530 + .word 49099 + .word 0 + .word 31461 + .word 32590 + .word 25910 + .word 51580 + .word 49101 + .word 0 + .word 23034 + .word 4503 + .word 56149 + .word 56800 + .word 16339 + .word 0 + .word 23084 + .word 49532 + .word 8891 + .word 43466 + .word 16341 + .word 0 + .word 52278 + .word 51985 + .word 56128 + .word 47325 + .word 49115 + .word 0 + .word 64046 + .word 3409 + .word 24460 + .word 54209 + .word 49116 + .word 0 + .word 21815 + .word 55080 + .word 59949 + .word 58476 + .word 16354 + .word 0 + .word 52803 + .word 16320 + .word 8321 + .word 47500 + .word 16355 + .word 0 + .word 52718 + .word 62993 + .word 9405 + .word 50844 + .word 49129 + .word 0 + .word 54524 + .word 45491 + .word 53115 + .word 54272 + .word 49129 + .word 0 + .word 17147 + .word 2195 + .word 64554 + .word 57739 + .word 16367 + .word 0 + .word 25716 + .word 30593 + .word 61559 + .word 36022 + .word 16367 + .word 0 + .word 34582 + .word 27844 + .word 9712 + .word 38156 + .word 49141 + .word 0 + .word 11089 + .word 32571 + .word 7121 + .word 45346 + .word 49139 + .word 0 + .word 19256 + .word 10500 + .word 41195 + .word 47904 + .word 16377 + .word 0 + .word 34688 + .word 57357 + .word 16578 + .word 34099 + .word 16374 + .word 0 + .word 33812 + .word 7938 + .word 37351 + .word 35991 + .word 49148 + .word 0 + .word 39461 + .word 41125 + .word 38968 + .word 43650 + .word 16319 + .word 0 + .word 44025 + .word 18687 + .word 5475 + .word 36436 + .word 49091 + .word 0 + .word 23695 + .word 42035 + .word 32968 + .word 40701 + .word 49093 + .word 0 + .word 38927 + .word 50812 + .word 3019 + .word 50863 + .word 16331 + .word 0 + .word 61445 + .word 40975 + .word 17938 + .word 45887 + .word 16333 + .word 0 + .word 29652 + .word 52899 + .word 3582 + .word 54866 + .word 49107 + .word 0 + .word 20058 + .word 59066 + .word 2994 + .word 38517 + .word 49109 + .word 0 + .word 39274 + .word 56137 + .word 36322 + .word 45609 + .word 16347 + .word 0 + .word 15638 + .word 5070 + .word 53701 + .word 47866 + .word 16348 + .word 0 + .word 51166 + .word 27629 + .word 45907 + .word 56238 + .word 49122 + .word 0 + .word 29387 + .word 28474 + .word 13265 + .word 41814 + .word 49123 + .word 0 + .word 6001 + .word 55757 + .word 63641 + .word 48808 + .word 16361 + .word 0 + .word 65207 + .word 5152 + .word 25385 + .word 47657 + .word 16361 + .word 0 + .word 16879 + .word 18288 + .word 49778 + .word 55345 + .word 49135 + .word 0 + .word 63014 + .word 23411 + .word 42365 + .word 63147 + .word 49134 + .word 0 + .word 41060 + .word 50204 + .word 58630 + .word 36532 + .word 16373 + .word 0 + .word 38440 + .word 64136 + .word 63792 + .word 39699 + .word 16371 + .word 0 + .word 22495 + .word 32960 + .word 60573 + .word 45833 + .word 49145 + .word 0 + .word 59007 + .word 19608 + .word 21801 + .word 59681 + .word 49141 + .word 0 + .word 39231 + .word 52779 + .word 63106 + .word 34425 + .word 16380 + .word 0 + .word 40257 + .word 55273 + .word 33242 + .word 51859 + .word 16320 + .word 0 + .type _P,@object + .size _P,2640 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,12 + .align 2 +_PP: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP,@object + .size _PP,120 + .align 2 +_QP: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .type _QP,@object + .size _QP,120 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,12 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .type _tonpi,@object + .size _tonpi,12 + .data + .hidden __libm_sincos_pi4l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/j0f.S b/external/sgx_libm/ia32/j0f.S new file mode 100644 index 0000000000..574ec9509c --- /dev/null +++ b/external/sgx_libm/ia32/j0f.S @@ -0,0 +1,588 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j0f.c" + .text +..TXTST0: +# -- Begin j0f + .text + .align 16,0x90 + .globl j0f +j0f: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $124, %esp + movl 8(%ebp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + jae ..B1.24 +..B1.2: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $1099154394, %eax + jae ..B1.22 +..B1.3: + cmpl $1081424556, %eax + jae ..B1.14 +..B1.4: + cmpl $1048576000, %eax + jae ..B1.13 +..B1.5: + cmpl $998244352, %eax + jae ..B1.12 +..B1.6: + cmpl $947912704, %eax + jae ..B1.11 +..B1.7: + flds 8(%ebp) + cmpl $838860800, %eax + fld1 + jae ..B1.9 +..B1.8: + fxch %st(1) + fabs + fsubrp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fxch %st(1) + fmul %st(0), %st + fsubrp %st, %st(1) +..B1.10: + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.11: + flds 8(%ebp) + fmul %st(0), %st + fld1 + fldl 8+_Q3@GOTOFF(%ebx) + fmul %st(2), %st + faddl _Q3@GOTOFF(%ebx) + fmulp %st, %st(2) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.12: + flds 8(%ebp) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fld1 + fldl 24+_Q2@GOTOFF(%ebx) + fmul %st(2), %st + fldl 16+_Q2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 8+_Q2@GOTOFF(%ebx) + fmulp %st, %st(3) + faddl _Q2@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.13: + flds 8(%ebp) + fabs + fldl 104+_Q1@GOTOFF(%ebx) + fldl 88+_Q1@GOTOFF(%ebx) + fldl 96+_Q1@GOTOFF(%ebx) + fldl 80+_Q1@GOTOFF(%ebx) + fxch %st(4) + fsubl 112+_Q1@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 72+_Q1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 56+_Q1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 40+_Q1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 24+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 64+_Q1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 8+_Q1@GOTOFF(%ebx) + fmulp %st, %st(1) + fxch %st(2) + faddl 32+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 48+_Q1@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + faddl 16+_Q1@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddl _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.14: + cmpl $1092798087, %eax + jae ..B1.18 +..B1.15: + cmpl $1088454576, %eax + jae ..B1.17 +..B1.16: + lea _P1@GOTOFF(%ebx), %eax + jmp ..B1.21 +..B1.17: + lea _P2@GOTOFF(%ebx), %eax + jmp ..B1.21 +..B1.18: + cmpl $1096101336, %eax + jae ..B1.20 +..B1.19: + lea _P3@GOTOFF(%ebx), %eax + jmp ..B1.21 +..B1.20: + lea _P4@GOTOFF(%ebx), %eax +..B1.21: + flds 8(%ebp) + fabs + fldl 96(%eax) + fldl 80(%eax) + fldl 88(%eax) + fldl 72(%eax) + fxch %st(4) + fsubl 104(%eax) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 64(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 48(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 32(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 16(%eax) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 56(%eax) + fmul %st(4), %st + fxch %st(3) + faddl (%eax) + fxch %st(5) + faddl 40(%eax) + fmulp %st, %st(4) + fxch %st(2) + faddl 24(%eax) + fmulp %st, %st(1) + fmul %st(1), %st + fxch %st(2) + faddl 8(%eax) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.22: + flds 8(%ebp) + lea 32(%esp), %eax + fabs + lea 40(%esp), %edx + fld1 + fdiv %st(1), %st + fstl 16(%eax) + fldl _val_16_0@GOTOFF(%ebx) + fmulp %st, %st(1) + fstl 24(%eax) + fmul %st(0), %st + fstl 32(%eax) + fmul %st(0), %st + fxch %st(1) + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + movl $-1, 16(%esp) + fstpl 40(%eax) + call __libm_sincos_k32 +..B1.23: + fldl 72(%esp) + fldl 64(%esp) + fldl _tonpi@GOTOFF(%ebx) + fmull 48(%esp) + fsqrt + fldl 40+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fldl 32+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 8+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl _PP@GOTOFF(%ebx) + faddp %st, %st(1) + fldl 40+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + fmull 40(%esp) + fxch %st(1) + faddl 24+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fldl 32+_QP@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(1) + faddl 8+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + faddl 16+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + faddl _QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmull 56(%esp) + fmull 32(%esp) + fsubrp %st, %st(2) + fmulp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.24: + ja ..B1.26 +..B1.25: + fldz + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.26: + flds 8(%ebp) +..B1.27: + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type j0f,@function + .size j0f,.-j0f + .data +# -- End j0f + .section .rodata, "a" + .align 4 + .align 4 +_Q3: + .long 4294966841 + .long 3218079743 + .long 477219499 + .long 1066401791 + .type _Q3,@object + .size _Q3,16 + .align 4 +_Q2: + .long 4294967005 + .long 3218079743 + .long 4292583532 + .long 1066401791 + .long 2963922746 + .long 3208409541 + .long 1698509326 + .long 1054632110 + .type _Q2,@object + .size _Q2,32 + .align 4 +_Q1: + .long 569392270 + .long 3163659129 + .long 911539783 + .long 3219168475 + .long 3927550863 + .long 1069261278 + .long 1680954783 + .long 1068301032 + .long 3247602706 + .long 3212950300 + .long 1528576945 + .long 3210869138 + .long 2120930432 + .long 1060197251 + .long 3147753376 + .long 1057418557 + .long 3445667889 + .long 3201446637 + .long 160313185 + .long 3198274950 + .long 2157358765 + .long 1047004568 + .long 1405517519 + .long 1043512506 + .long 3055202941 + .long 3187001715 + .long 562966967 + .long 3183555197 + .long 781654848 + .long 1073954069 + .type _Q1,@object + .size _Q1,120 + .align 4 +_P1: + .long 2556390964 + .long 3162487616 + .long 168113101 + .long 1070974694 + .long 3865632959 + .long 3214905202 + .long 3384884860 + .long 3215663440 + .long 3461368592 + .long 1064499199 + .long 2947775703 + .long 1063419441 + .long 1964351934 + .long 3207001659 + .long 1081690493 + .long 3204998104 + .long 2315304668 + .long 1053480462 + .long 3655541446 + .long 1050880364 + .long 988219424 + .long 3194139699 + .long 2647984383 + .long 3191029766 + .long 3459760917 + .long 1038956170 + .long 1529622085 + .long 1075188879 + .type _P1,@object + .size _P1,112 + .align 4 +_P2: + .long 2989381656 + .long 3164006638 + .long 2007135498 + .long 3218169721 + .long 3461465629 + .long 1066405759 + .long 1292000183 + .long 1067879320 + .long 1048188593 + .long 3211038307 + .long 2811900586 + .long 3210797269 + .long 275024305 + .long 1058896216 + .long 2179928921 + .long 1057456107 + .long 2316750355 + .long 3200463196 + .long 1626245786 + .long 3198355713 + .long 2429961783 + .long 1046264853 + .long 3081665457 + .long 1043557342 + .long 3760684269 + .long 3186121773 + .long 1825365706 + .long 1075924661 + .type _P2,@object + .size _P2,112 + .align 4 +_P3: + .long 915277891 + .long 3163740397 + .long 1721892699 + .long 1070448958 + .long 3433548142 + .long 3213111280 + .long 3603643349 + .long 3215166749 + .long 2193444562 + .long 1062884841 + .long 1036402988 + .long 1063136790 + .long 2039602830 + .long 3205750717 + .long 2039806946 + .long 3204828766 + .long 3757243411 + .long 1052487712 + .long 2819184679 + .long 1050816211 + .long 1638789445 + .long 3193302656 + .long 96077275 + .long 3191008024 + .long 34207204 + .long 1038327735 + .long 8549046 + .long 1076335940 + .type _P3,@object + .size _P3,112 + .align 4 +_P4: + .long 4010378302 + .long 3164933090 + .long 260862994 + .long 3217715229 + .long 793353311 + .long 1065112761 + .long 2823013001 + .long 1067546520 + .long 4006575139 + .long 3209863700 + .long 3390737311 + .long 3210433566 + .long 1793352299 + .long 1057800372 + .long 3528876835 + .long 1057234714 + .long 2505438989 + .long 3199512871 + .long 2785865938 + .long 3198229698 + .long 565130724 + .long 1045495083 + .long 410977742 + .long 1043470609 + .long 4266013081 + .long 3185543354 + .long 1056076242 + .long 1076747425 + .type _P4,@object + .size _P4,112 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_PP: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP,@object + .size _PP,48 + .align 4 +_QP: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP,@object + .size _QP,48 + .data + .hidden __libm_sincos_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/j0l.S b/external/sgx_libm/ia32/j0l.S new file mode 100644 index 0000000000..c834714533 --- /dev/null +++ b/external/sgx_libm/ia32/j0l.S @@ -0,0 +1,106 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j0l.c" + .text +..TXTST0: +# -- Begin j0l + .text + .align 16,0x90 + .globl j0l +j0l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + fldt 8(%ebp) + lea 16(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.6: + addl $-32, %esp + movl (%edi), %ecx + lea 64(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%edi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __j0q@PLT +..B1.5: + addl $28, %esp +..B1.2: + movl 32(%esp), %eax + movl %eax, (%edi) + movl 36(%esp), %edx + movl 40(%esp), %ecx + movl 44(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.7: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type j0l,@function + .size j0l,.-j0l + .data +# -- End j0l + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/j1.S b/external/sgx_libm/ia32/j1.S new file mode 100644 index 0000000000..ebd71cb540 --- /dev/null +++ b/external/sgx_libm/ia32/j1.S @@ -0,0 +1,2716 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j1.c" + .text +..TXTST0: +# -- Begin __j1l + .text + .align 16,0x90 + .hidden __j1l + .globl __j1l +__j1l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %ebx + subl $120, %esp + fldt 8(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fldt 132+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.9 +..B1.2: + fldt _S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.4 +..B1.3: + fldt 12+_P1@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fstpt 88(%esp) + fmul %st, %st(1) + fstpt 76(%esp) + fldt 76(%esp) + fldt _P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 72+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 120+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 132+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 144+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 156+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 168+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 180+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 192+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 204+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt 216+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.4: + movl $1, %edx +..B1.5: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %esi + fldt _S@GOTOFF(%ebx,%esi) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.8 + jp ..B1.8 +..B1.6: + incl %edx + cmpl $11, %edx + jl ..B1.5 +..B1.8: + lea -8(,%edx,8), %ecx + lea -1(%edx), %eax + movl %eax, %esi + lea -4(%ecx,%edx,4), %edx + fldt _Z@GOTOFF(%ebx,%edx) + shll $4, %esi + fsubrp %st, %st(1) + subl %eax, %esi + fld %st(0) + shll $4, %esi + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fstpt 88(%esp) + fstpt 76(%esp) + fldt 76(%esp) + fldt _P@GOTOFF(%esi,%ebx) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%esi,%ebx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 168+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 180+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 204+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 216+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 228+_P@GOTOFF(%esi,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fldl _ones@GOTOFF(%ebx) + lea 76(%esp), %eax + fdiv %st(1), %st + lea 88(%esp), %edx + fxch %st(1) + fxch %st(1) + fstpt -44(%eax) + fldt -44(%eax) + fxch %st(1) + fstpt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 12(%eax) + fldt 12(%eax) + movl %eax, 12(%esp) + movl %edx, 16(%esp) + movl $-3, 20(%esp) + fxch %st(1) + fstpt (%eax) + fldt (%eax) + fldt _PP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -28(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt -12(%eax) + call __libm_sincos_pi4l +..B1.10: + fldt 8(%ebp) + fldt 64(%esp) + fldt 48(%esp) + fldt 88(%esp) + fmulp %st, %st(1) + fldt 76(%esp) + fmulp %st, %st(2) + fsub %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B1.12 + jp ..B1.12 +..B1.11: + fstp %st(1) + fldt _tonpi@GOTOFF(%ebx) + fldt 32(%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.12: + fstp %st(0) + lea 32(%esp), %esi + movl %esi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.19: + addl $-32, %esp + movl (%esi), %ecx + lea 80(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%esi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%esi), %ecx + movl 12(%esi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __j1q@PLT +..B1.18: + addl $28, %esp +..B1.13: + movl 48(%esp), %eax + movl %eax, (%esi) + movl 52(%esp), %edx + movl 56(%esp), %ecx + movl 60(%esp), %eax + addl $4, %esp + pushl %esi + movl %edx, 4(%esi) + movl %ecx, 8(%esi) + movl %eax, 12(%esi) + call __qtol@PLT +..B1.14: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __j1l,@function + .size __j1l,.-__j1l + .data +# -- End __j1l + .text +# -- Begin j1 + .text + .align 16,0x90 + .globl j1 +j1: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp +..B2.2: + fnstcw 46(%esp) +..B2.3: + movl 12(%ebp), %edi + movl %edi, %edx + andl $2147483647, %edx + shrl $31, %edi + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + cmpl $2146435072, %edx + jge ..B2.34 +..B2.4: + cmpl $1012924416, %edx + jge ..B2.11 +..B2.5: + cmpl $2097152, %edx + jl ..B2.7 +..B2.6: + fldl 8(%ebp) + fmull .L_2il0floatpacket.0@GOTOFF(%ebx) + fldl .L_2il0floatpacket.1@GOTOFF(%ebx) + fmul %st(1), %st + fldl .L_2il0floatpacket.2@GOTOFF(%ebx) + fmulp %st, %st(2) + fsubp %st, %st(1) + fstpl 88(%esp) + fldl 88(%esp) + fmull .L_2il0floatpacket.3@GOTOFF(%ebx) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.7: + movl 8(%ebp), %eax + orl %eax, %edx + je ..B2.9 +..B2.8: + fldl _small_value_64@GOTOFF(%ebx,%edi,8) + fmull _small_value_64@GOTOFF(%ebx) + fstpl 88(%esp) + fldl 88(%esp) + fldl 8(%ebp) + fmull .L_2il0floatpacket.1@GOTOFF(%ebx) + fsubp %st, %st(1) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.9: + fldl 8(%ebp) +..B2.10: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.11: + movzwl 46(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.39 +..B2.12: + orl $-64768, %edx + movw %dx, 44(%esp) +..B2.13: + fldcw 44(%esp) +..B2.14: + movl $1, %esi +..B2.15: + fldl 8(%ebp) + fabs + fldt 132+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.23 +..B2.16: + fldt _S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.18 +..B2.17: + fldt _P1@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 72(%esp) + fstpt 60(%esp) + fldt 60(%esp) + fldt 12+_P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 72+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 120+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 132+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 156+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 180+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 192+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 204+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt 216+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B2.28 +..B2.18: + movl $1, %edx +..B2.19: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %eax + fldt _S@GOTOFF(%ebx,%eax) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B2.22 + jp ..B2.22 +..B2.20: + incl %edx + cmpl $11, %edx + jl ..B2.19 +..B2.22: + lea -8(,%edx,8), %ecx + lea -1(%edx), %eax + lea -4(%ecx,%edx,4), %edx + movl %eax, %ecx + fldt _Z@GOTOFF(%ebx,%edx) + shll $4, %ecx + fsubrp %st, %st(1) + subl %eax, %ecx + fld %st(0) + shll $4, %ecx + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fstpt 72(%esp) + fstpt 60(%esp) + fldt 60(%esp) + fldt _P@GOTOFF(%ecx,%ebx) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%ecx,%ebx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 168+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 180+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 204+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 216+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 228+_P@GOTOFF(%ecx,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B2.28 +..B2.23: + fldl _ones@GOTOFF(%ebx) + fdiv %st(1), %st + fstpt (%esp) + fldt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(1) + fstpt 60(%esp) + fldt 60(%esp) + addl $-32, %esp + lea 92(%esp), %eax + lea 104(%esp), %edx + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fldt _PP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP@GOTOFF(%ebx) + movl %eax, 12(%esp) + faddp %st, %st(1) + fmul %st(2), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP@GOTOFF(%ebx) + movl %edx, 16(%esp) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_PP@GOTOFF(%ebx) + movl $-3, 20(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fstpt -12(%eax) + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -44(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -28(%eax) + call __libm_sincos_pi4l +..B2.42: + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + addl $32, %esp +..B2.24: + fldt 72(%esp) + fmulp %st, %st(1) + fldt 60(%esp) + fmulp %st, %st(2) + fsub %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B2.26 + jp ..B2.26 +..B2.25: + fstp %st(1) + fldt _tonpi@GOTOFF(%ebx) + fldt (%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + fstpt 16(%esp) + jmp ..B2.28 +..B2.26: + fstp %st(0) + addl $-16, %esp + lea 16(%esp), %edx + movl %edx, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B2.44: + lea 16(%esp), %edx + addl $-16, %esp + lea 48(%esp), %ecx + movl %ecx, (%esp) + lea 16(%esp), %eax + movl (%edx), %ecx + movl %ecx, (%eax) + movl 4(%edx), %ecx + movl %ecx, 4(%eax) + movl 8(%edx), %ecx + movl %ecx, 8(%eax) + movl 12(%edx), %ecx + movl %ecx, 12(%eax) + call __j1q@PLT +..B2.43: + lea 28(%esp), %edx + addl $28, %esp +..B2.27: + movl 16(%esp), %eax + movl 20(%esp), %ecx + movl %eax, (%edx) + movl %ecx, 4(%edx) + movl 24(%esp), %eax + movl 28(%esp), %ecx + addl $-16, %esp + movl %eax, 8(%edx) + movl %ecx, 12(%edx) + movl %edx, (%esp) + call __qtol@PLT +..B2.45: + fstpt 32(%esp) + addl $16, %esp +..B2.28: + testl %esi, %esi + je ..B2.30 +..B2.29: + fldcw 46(%esp) +..B2.30: + testl %edi, %edi + je ..B2.33 +..B2.31: + fldt 16(%esp) + fchs + fstpt 16(%esp) +..B2.33: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.34: + andl $-2146435073, %edx + orl 8(%ebp), %edx + je ..B2.36 +..B2.35: + fldl _ones@GOTOFF(%ebx) + fmull 8(%ebp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.36: + fldl _zeros@GOTOFF(%ebx,%edi,8) +..B2.37: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.39: + xorl %esi, %esi + jmp ..B2.15 + .align 16,0x90 + .type j1,@function + .size j1,.-j1 + .data +# -- End j1 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x43b00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3c700000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x3c300000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_S: + .word 64993 + .word 47321 + .word 43380 + .word 39400 + .word 16384 + .word 0 + .word 10427 + .word 24946 + .word 31449 + .word 45220 + .word 16385 + .word 0 + .word 20142 + .word 26358 + .word 43878 + .word 35445 + .word 16386 + .word 0 + .word 45380 + .word 5013 + .word 8196 + .word 48298 + .word 16386 + .word 0 + .word 36049 + .word 37774 + .word 2551 + .word 61157 + .word 16386 + .word 0 + .word 44499 + .word 20687 + .word 35324 + .word 37009 + .word 16387 + .word 0 + .word 37149 + .word 40892 + .word 28299 + .word 43441 + .word 16387 + .word 0 + .word 59921 + .word 2742 + .word 56472 + .word 49873 + .word 16387 + .word 0 + .word 35749 + .word 60152 + .word 42287 + .word 56306 + .word 16387 + .word 0 + .word 36553 + .word 24054 + .word 44174 + .word 62739 + .word 16387 + .word 0 + .word 12707 + .word 13183 + .word 28829 + .word 34586 + .word 16388 + .word 0 + .word 24309 + .word 45263 + .word 7124 + .word 37803 + .word 16388 + .word 0 + .type _S,@object + .size _S,144 + .align 2 +_P1: + .word 26041 + .word 45178 + .word 34801 + .word 41495 + .word 49090 + .word 0 + .word 65370 + .word 9956 + .word 39004 + .word 61276 + .word 49094 + .word 0 + .word 9622 + .word 32383 + .word 51277 + .word 45692 + .word 16332 + .word 0 + .word 53955 + .word 64596 + .word 5222 + .word 35592 + .word 49100 + .word 0 + .word 34986 + .word 10535 + .word 24469 + .word 42796 + .word 49108 + .word 0 + .word 2569 + .word 3934 + .word 58827 + .word 40937 + .word 49103 + .word 0 + .word 16535 + .word 14264 + .word 30755 + .word 37884 + .word 16348 + .word 0 + .word 39497 + .word 52694 + .word 37205 + .word 63078 + .word 49104 + .word 0 + .word 50010 + .word 60332 + .word 8210 + .word 49710 + .word 49123 + .word 0 + .word 10498 + .word 63852 + .word 64151 + .word 35274 + .word 49105 + .word 0 + .word 55591 + .word 43795 + .word 24807 + .word 46603 + .word 16362 + .word 0 + .word 15642 + .word 32907 + .word 52420 + .word 55914 + .word 49103 + .word 0 + .word 53151 + .word 24867 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 37497 + .word 10412 + .word 6022 + .word 55715 + .word 49100 + .word 0 + .word 14397 + .word 43702 + .word 43690 + .word 43690 + .word 16374 + .word 0 + .word 57427 + .word 55015 + .word 8445 + .word 53508 + .word 49095 + .word 0 + .word 64958 + .word 65535 + .word 65535 + .word 65535 + .word 49146 + .word 0 + .word 64696 + .word 39566 + .word 31598 + .word 54025 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .type _P1,@object + .size _P1,228 + .align 2 +_Z: + .word 17728 + .word 31608 + .word 43949 + .word 62778 + .word 16384 + .word 0 + .word 32551 + .word 41874 + .word 44957 + .word 57471 + .word 16385 + .word 0 + .word 18949 + .word 61409 + .word 34437 + .word 41670 + .word 16386 + .word 0 + .word 4396 + .word 34605 + .word 55192 + .word 54573 + .word 16386 + .word 0 + .word 9307 + .word 10310 + .word 55728 + .word 33731 + .word 16387 + .word 0 + .word 7613 + .word 2917 + .word 18234 + .word 40173 + .word 16387 + .word 0 + .word 24292 + .word 42693 + .word 42782 + .word 46612 + .word 16387 + .word 0 + .word 12570 + .word 29960 + .word 47214 + .word 53050 + .word 16387 + .word 0 + .word 24415 + .word 36838 + .word 59299 + .word 59487 + .word 16387 + .word 0 + .word 32322 + .word 22879 + .word 15219 + .word 32962 + .word 16388 + .word 0 + .word 56404 + .word 12107 + .word 18542 + .word 36180 + .word 16388 + .word 0 + .type _Z,@object + .size _Z,132 + .align 2 +_P: + .word 43464 + .word 52019 + .word 16370 + .word 39301 + .word 16323 + .word 0 + .word 45212 + .word 20213 + .word 4367 + .word 36322 + .word 16327 + .word 0 + .word 62182 + .word 43016 + .word 65056 + .word 63104 + .word 49099 + .word 0 + .word 45004 + .word 1793 + .word 2432 + .word 46043 + .word 49103 + .word 0 + .word 10697 + .word 46113 + .word 34013 + .word 35792 + .word 16340 + .word 0 + .word 9065 + .word 41098 + .word 5532 + .word 44900 + .word 16343 + .word 0 + .word 26003 + .word 49876 + .word 4534 + .word 63025 + .word 49115 + .word 0 + .word 42133 + .word 20669 + .word 62629 + .word 33244 + .word 49119 + .word 0 + .word 10663 + .word 14825 + .word 55564 + .word 41652 + .word 16355 + .word 0 + .word 21046 + .word 62601 + .word 18713 + .word 35715 + .word 16358 + .word 0 + .word 28431 + .word 25084 + .word 11881 + .word 39361 + .word 49130 + .word 0 + .word 40049 + .word 63841 + .word 60004 + .word 52172 + .word 49132 + .word 0 + .word 992 + .word 25066 + .word 14104 + .word 49616 + .word 16368 + .word 0 + .word 44948 + .word 43537 + .word 5801 + .word 46886 + .word 16370 + .word 0 + .word 65381 + .word 44162 + .word 41036 + .word 37465 + .word 49142 + .word 0 + .word 14125 + .word 39149 + .word 41569 + .word 43450 + .word 49143 + .word 0 + .word 9425 + .word 2504 + .word 59629 + .word 56004 + .word 16378 + .word 0 + .word 7469 + .word 36200 + .word 7418 + .word 55109 + .word 16378 + .word 0 + .word 63186 + .word 26107 + .word 31425 + .word 52790 + .word 49149 + .word 0 + .word 52143 + .word 25611 + .word 44594 + .word 35227 + .word 49085 + .word 0 + .word 35717 + .word 29166 + .word 20585 + .word 41467 + .word 49091 + .word 0 + .word 2832 + .word 5439 + .word 21266 + .word 33717 + .word 49095 + .word 0 + .word 5378 + .word 24417 + .word 51356 + .word 63335 + .word 16331 + .word 0 + .word 48412 + .word 30659 + .word 29190 + .word 42335 + .word 16335 + .word 0 + .word 9054 + .word 19776 + .word 30431 + .word 35870 + .word 49108 + .word 0 + .word 1836 + .word 17934 + .word 4966 + .word 40411 + .word 49111 + .word 0 + .word 4836 + .word 40500 + .word 17629 + .word 63063 + .word 16347 + .word 0 + .word 23076 + .word 41820 + .word 25860 + .word 58134 + .word 16350 + .word 0 + .word 39832 + .word 57656 + .word 52920 + .word 41521 + .word 49123 + .word 0 + .word 22342 + .word 1014 + .word 59094 + .word 59974 + .word 49125 + .word 0 + .word 25371 + .word 16474 + .word 28775 + .word 38931 + .word 16362 + .word 0 + .word 48127 + .word 54624 + .word 55306 + .word 41258 + .word 16364 + .word 0 + .word 60537 + .word 50282 + .word 14991 + .word 48309 + .word 49136 + .word 0 + .word 15691 + .word 57338 + .word 50654 + .word 33690 + .word 49138 + .word 0 + .word 40468 + .word 19472 + .word 58347 + .word 35325 + .word 16374 + .word 0 + .word 2985 + .word 7922 + .word 38039 + .word 52517 + .word 16374 + .word 0 + .word 33464 + .word 30509 + .word 7663 + .word 49252 + .word 49146 + .word 0 + .word 63790 + .word 6933 + .word 28208 + .word 44856 + .word 49145 + .word 0 + .word 21342 + .word 14964 + .word 50588 + .word 39336 + .word 16381 + .word 0 + .word 56226 + .word 19816 + .word 23757 + .word 47758 + .word 16316 + .word 0 + .word 41064 + .word 34118 + .word 40187 + .word 42472 + .word 16323 + .word 0 + .word 9004 + .word 37522 + .word 42571 + .word 60097 + .word 16326 + .word 0 + .word 40290 + .word 31235 + .word 60424 + .word 63498 + .word 49099 + .word 0 + .word 59943 + .word 36153 + .word 34778 + .word 37099 + .word 49103 + .word 0 + .word 23867 + .word 38881 + .word 17085 + .word 35787 + .word 16340 + .word 0 + .word 43845 + .word 22338 + .word 8742 + .word 34578 + .word 16343 + .word 0 + .word 21920 + .word 9728 + .word 29300 + .word 62498 + .word 49115 + .word 0 + .word 43241 + .word 30911 + .word 50314 + .word 48209 + .word 49118 + .word 0 + .word 5869 + .word 26658 + .word 63775 + .word 40733 + .word 16355 + .word 0 + .word 50245 + .word 25343 + .word 31579 + .word 47683 + .word 16357 + .word 0 + .word 51932 + .word 37189 + .word 37317 + .word 37600 + .word 49130 + .word 0 + .word 35305 + .word 45319 + .word 11991 + .word 61881 + .word 49131 + .word 0 + .word 43727 + .word 7380 + .word 41898 + .word 45538 + .word 16368 + .word 0 + .word 55996 + .word 31666 + .word 20048 + .word 46502 + .word 16369 + .word 0 + .word 20142 + .word 56563 + .word 4676 + .word 64142 + .word 49141 + .word 0 + .word 42758 + .word 26948 + .word 20336 + .word 64653 + .word 49141 + .word 0 + .word 18102 + .word 54076 + .word 11950 + .word 42374 + .word 16378 + .word 0 + .word 55144 + .word 962 + .word 65430 + .word 51473 + .word 16376 + .word 0 + .word 35076 + .word 30182 + .word 41634 + .word 65458 + .word 49148 + .word 0 + .word 45599 + .word 55541 + .word 39885 + .word 63330 + .word 49086 + .word 0 + .word 11397 + .word 64373 + .word 55097 + .word 42716 + .word 49091 + .word 0 + .word 7278 + .word 1186 + .word 16759 + .word 52647 + .word 49094 + .word 0 + .word 55821 + .word 1941 + .word 7835 + .word 62966 + .word 16331 + .word 0 + .word 43692 + .word 51803 + .word 23893 + .word 63855 + .word 16334 + .word 0 + .word 7306 + .word 740 + .word 42177 + .word 35243 + .word 49108 + .word 0 + .word 20304 + .word 26112 + .word 14593 + .word 58152 + .word 49110 + .word 0 + .word 44429 + .word 26104 + .word 43204 + .word 60999 + .word 16347 + .word 0 + .word 43100 + .word 25366 + .word 26069 + .word 39382 + .word 16350 + .word 0 + .word 53318 + .word 3475 + .word 36258 + .word 39277 + .word 49123 + .word 0 + .word 61289 + .word 34432 + .word 35705 + .word 37567 + .word 49125 + .word 0 + .word 47881 + .word 43207 + .word 60352 + .word 35669 + .word 16362 + .word 0 + .word 3664 + .word 62231 + .word 63343 + .word 46625 + .word 16363 + .word 0 + .word 41733 + .word 11611 + .word 33384 + .word 42291 + .word 49136 + .word 0 + .word 22414 + .word 28668 + .word 61827 + .word 33289 + .word 49137 + .word 0 + .word 39839 + .word 31083 + .word 29085 + .word 58078 + .word 16373 + .word 0 + .word 45039 + .word 64406 + .word 35589 + .word 44277 + .word 16373 + .word 0 + .word 21856 + .word 35851 + .word 11264 + .word 37516 + .word 49146 + .word 0 + .word 38193 + .word 55017 + .word 53611 + .word 34369 + .word 49144 + .word 0 + .word 50065 + .word 40254 + .word 39875 + .word 57241 + .word 16380 + .word 0 + .word 21434 + .word 36257 + .word 28860 + .word 44273 + .word 16318 + .word 0 + .word 24899 + .word 55058 + .word 27384 + .word 42408 + .word 16323 + .word 0 + .word 23952 + .word 61552 + .word 63266 + .word 45785 + .word 16326 + .word 0 + .word 20309 + .word 44505 + .word 41003 + .word 61821 + .word 49099 + .word 0 + .word 9759 + .word 19768 + .word 52219 + .word 54624 + .word 49102 + .word 0 + .word 3188 + .word 41981 + .word 52169 + .word 34347 + .word 16340 + .word 0 + .word 7467 + .word 53297 + .word 24491 + .word 48747 + .word 16342 + .word 0 + .word 26956 + .word 25629 + .word 26154 + .word 58912 + .word 49115 + .word 0 + .word 2746 + .word 62708 + .word 29606 + .word 64476 + .word 49117 + .word 0 + .word 23526 + .word 40632 + .word 17955 + .word 37512 + .word 16355 + .word 0 + .word 58003 + .word 45489 + .word 17648 + .word 59859 + .word 16356 + .word 0 + .word 12684 + .word 55359 + .word 8573 + .word 33616 + .word 49130 + .word 0 + .word 29881 + .word 6055 + .word 26438 + .word 36076 + .word 49131 + .word 0 + .word 37160 + .word 17925 + .word 32887 + .word 39269 + .word 16368 + .word 0 + .word 52986 + .word 52867 + .word 51415 + .word 50108 + .word 16368 + .word 0 + .word 29602 + .word 44157 + .word 62211 + .word 53157 + .word 49141 + .word 0 + .word 14158 + .word 17332 + .word 5318 + .word 65232 + .word 49140 + .word 0 + .word 63939 + .word 33203 + .word 7646 + .word 33955 + .word 16378 + .word 0 + .word 29120 + .word 11480 + .word 39280 + .word 50030 + .word 16375 + .word 0 + .word 42029 + .word 1146 + .word 14309 + .word 51502 + .word 49148 + .word 0 + .word 13934 + .word 45324 + .word 64176 + .word 62054 + .word 49087 + .word 0 + .word 407 + .word 40447 + .word 21497 + .word 41724 + .word 49091 + .word 0 + .word 29047 + .word 47840 + .word 58616 + .word 39773 + .word 49094 + .word 0 + .word 45982 + .word 37340 + .word 60343 + .word 60272 + .word 16331 + .word 0 + .word 61708 + .word 5158 + .word 50916 + .word 46783 + .word 16334 + .word 0 + .word 15241 + .word 33011 + .word 52635 + .word 33255 + .word 49108 + .word 0 + .word 27136 + .word 17183 + .word 21500 + .word 41066 + .word 49110 + .word 0 + .word 41313 + .word 44818 + .word 44575 + .word 56585 + .word 16347 + .word 0 + .word 1149 + .word 8286 + .word 16932 + .word 53342 + .word 16349 + .word 0 + .word 29145 + .word 29789 + .word 51640 + .word 35705 + .word 49123 + .word 0 + .word 48645 + .word 17912 + .word 55357 + .word 48589 + .word 49124 + .word 0 + .word 34105 + .word 33794 + .word 2760 + .word 63371 + .word 16361 + .word 0 + .word 30589 + .word 55184 + .word 63547 + .word 57492 + .word 16362 + .word 0 + .word 36766 + .word 25700 + .word 37915 + .word 36654 + .word 49136 + .word 0 + .word 54115 + .word 65102 + .word 9808 + .word 39287 + .word 49136 + .word 0 + .word 15191 + .word 22168 + .word 7058 + .word 49192 + .word 16373 + .word 0 + .word 21631 + .word 11360 + .word 58072 + .word 50534 + .word 16372 + .word 0 + .word 52725 + .word 34636 + .word 1139 + .word 62446 + .word 49145 + .word 0 + .word 53409 + .word 43718 + .word 34635 + .word 38501 + .word 49143 + .word 0 + .word 21083 + .word 16045 + .word 34961 + .word 47202 + .word 16380 + .word 0 + .word 38780 + .word 63942 + .word 22964 + .word 35475 + .word 16316 + .word 0 + .word 58574 + .word 20162 + .word 19964 + .word 40809 + .word 16323 + .word 0 + .word 36576 + .word 45489 + .word 13327 + .word 34648 + .word 16326 + .word 0 + .word 40869 + .word 46352 + .word 6352 + .word 58511 + .word 49099 + .word 0 + .word 38766 + .word 2767 + .word 13055 + .word 40283 + .word 49102 + .word 0 + .word 11002 + .word 40490 + .word 24288 + .word 64180 + .word 16339 + .word 0 + .word 21330 + .word 2672 + .word 53484 + .word 34906 + .word 16342 + .word 0 + .word 11637 + .word 63948 + .word 58709 + .word 54245 + .word 49115 + .word 0 + .word 16451 + .word 23295 + .word 46139 + .word 44738 + .word 49117 + .word 0 + .word 40013 + .word 16865 + .word 3459 + .word 33992 + .word 16355 + .word 0 + .word 28055 + .word 62424 + .word 59084 + .word 40217 + .word 16356 + .word 0 + .word 37015 + .word 7577 + .word 64481 + .word 59907 + .word 49129 + .word 0 + .word 8219 + .word 9822 + .word 27279 + .word 47011 + .word 49130 + .word 0 + .word 859 + .word 2558 + .word 12826 + .word 34425 + .word 16368 + .word 0 + .word 34289 + .word 12934 + .word 665 + .word 63599 + .word 16367 + .word 0 + .word 15142 + .word 54455 + .word 30227 + .word 45946 + .word 49141 + .word 0 + .word 13599 + .word 50987 + .word 20426 + .word 40603 + .word 49140 + .word 0 + .word 224 + .word 55674 + .word 54991 + .word 58096 + .word 16377 + .word 0 + .word 12803 + .word 33902 + .word 43760 + .word 61618 + .word 16374 + .word 0 + .word 3255 + .word 47153 + .word 28829 + .word 43826 + .word 49148 + .word 0 + .word 57503 + .word 42370 + .word 48259 + .word 34977 + .word 16317 + .word 0 + .word 28464 + .word 31222 + .word 4873 + .word 39771 + .word 49091 + .word 0 + .word 7076 + .word 4355 + .word 19850 + .word 60674 + .word 49093 + .word 0 + .word 58695 + .word 18024 + .word 41082 + .word 56674 + .word 16331 + .word 0 + .word 1100 + .word 13540 + .word 64577 + .word 34943 + .word 16334 + .word 0 + .word 25873 + .word 27686 + .word 11323 + .word 61856 + .word 49107 + .word 0 + .word 12188 + .word 35264 + .word 2250 + .word 59962 + .word 49109 + .word 0 + .word 59387 + .word 26772 + .word 9493 + .word 52010 + .word 16347 + .word 0 + .word 50361 + .word 26279 + .word 61391 + .word 38047 + .word 16349 + .word 0 + .word 40446 + .word 22175 + .word 52931 + .word 64839 + .word 49122 + .word 0 + .word 16288 + .word 22519 + .word 41833 + .word 33884 + .word 49124 + .word 0 + .word 22795 + .word 59507 + .word 36930 + .word 56848 + .word 16361 + .word 0 + .word 9090 + .word 34727 + .word 62738 + .word 39279 + .word 16362 + .word 0 + .word 6548 + .word 61899 + .word 57259 + .word 65037 + .word 49135 + .word 0 + .word 20477 + .word 44577 + .word 947 + .word 52780 + .word 49135 + .word 0 + .word 9901 + .word 21929 + .word 34492 + .word 43241 + .word 16373 + .word 0 + .word 52812 + .word 31464 + .word 11463 + .word 33533 + .word 16372 + .word 0 + .word 16273 + .word 3725 + .word 28705 + .word 54534 + .word 49145 + .word 0 + .word 28551 + .word 65013 + .word 38971 + .word 50753 + .word 49142 + .word 0 + .word 55907 + .word 45101 + .word 33737 + .word 41084 + .word 16380 + .word 0 + .word 43426 + .word 25495 + .word 20291 + .word 49461 + .word 49086 + .word 0 + .word 1975 + .word 51775 + .word 24779 + .word 38683 + .word 16323 + .word 0 + .word 29807 + .word 50650 + .word 32397 + .word 53456 + .word 16325 + .word 0 + .word 5564 + .word 52273 + .word 7778 + .word 54851 + .word 49099 + .word 0 + .word 7750 + .word 4868 + .word 38403 + .word 61120 + .word 49101 + .word 0 + .word 15407 + .word 2698 + .word 46605 + .word 59622 + .word 16339 + .word 0 + .word 137 + .word 48802 + .word 34590 + .word 52040 + .word 16341 + .word 0 + .word 61391 + .word 58349 + .word 18865 + .word 49927 + .word 49115 + .word 0 + .word 11732 + .word 37228 + .word 55154 + .word 32778 + .word 49117 + .word 0 + .word 21770 + .word 7395 + .word 32621 + .word 61994 + .word 16354 + .word 0 + .word 14091 + .word 47411 + .word 37523 + .word 57988 + .word 16355 + .word 0 + .word 50358 + .word 51525 + .word 37270 + .word 54151 + .word 49129 + .word 0 + .word 22903 + .word 22329 + .word 47941 + .word 33412 + .word 49130 + .word 0 + .word 47512 + .word 65334 + .word 39843 + .word 61750 + .word 16367 + .word 0 + .word 35590 + .word 32984 + .word 45077 + .word 44683 + .word 16367 + .word 0 + .word 56839 + .word 21073 + .word 60125 + .word 40948 + .word 49141 + .word 0 + .word 16525 + .word 17598 + .word 3587 + .word 56588 + .word 49139 + .word 0 + .word 56933 + .word 2767 + .word 44815 + .word 51549 + .word 16377 + .word 0 + .word 35966 + .word 59943 + .word 1117 + .word 42745 + .word 16374 + .word 0 + .word 40172 + .word 7271 + .word 14707 + .word 38800 + .word 49148 + .word 0 + .word 8476 + .word 4419 + .word 45780 + .word 62512 + .word 49087 + .word 0 + .word 49137 + .word 16671 + .word 19871 + .word 37593 + .word 49091 + .word 0 + .word 63934 + .word 59521 + .word 24158 + .word 47409 + .word 49093 + .word 0 + .word 31258 + .word 33926 + .word 28141 + .word 53090 + .word 16331 + .word 0 + .word 17384 + .word 36966 + .word 994 + .word 53889 + .word 16333 + .word 0 + .word 55527 + .word 7910 + .word 53076 + .word 57518 + .word 49107 + .word 0 + .word 18447 + .word 54969 + .word 49626 + .word 45611 + .word 49109 + .word 0 + .word 13282 + .word 62682 + .word 5627 + .word 48010 + .word 16347 + .word 0 + .word 7550 + .word 10759 + .word 6881 + .word 57138 + .word 16348 + .word 0 + .word 65344 + .word 23540 + .word 39388 + .word 59430 + .word 49122 + .word 0 + .word 2956 + .word 21512 + .word 45255 + .word 50285 + .word 49123 + .word 0 + .word 29054 + .word 47408 + .word 36565 + .word 51766 + .word 16361 + .word 0 + .word 19154 + .word 63758 + .word 53467 + .word 57697 + .word 16361 + .word 0 + .word 22082 + .word 2480 + .word 53967 + .word 58888 + .word 49135 + .word 0 + .word 52243 + .word 32283 + .word 44909 + .word 38447 + .word 49135 + .word 0 + .word 7267 + .word 45206 + .word 61308 + .word 38976 + .word 16373 + .word 0 + .word 10717 + .word 24270 + .word 52189 + .word 48572 + .word 16371 + .word 0 + .word 40118 + .word 3643 + .word 65534 + .word 49002 + .word 49145 + .word 0 + .word 44194 + .word 5661 + .word 50617 + .word 36641 + .word 49142 + .word 0 + .word 26911 + .word 20494 + .word 63331 + .word 36858 + .word 16380 + .word 0 + .word 20013 + .word 62028 + .word 17108 + .word 33468 + .word 16320 + .word 0 + .word 9949 + .word 25572 + .word 4049 + .word 36529 + .word 16323 + .word 0 + .word 39945 + .word 24442 + .word 45585 + .word 42322 + .word 16325 + .word 0 + .word 59756 + .word 52868 + .word 48949 + .word 51417 + .word 49099 + .word 0 + .word 35066 + .word 41141 + .word 44695 + .word 47881 + .word 49101 + .word 0 + .word 42453 + .word 21162 + .word 44569 + .word 55557 + .word 16339 + .word 0 + .word 30136 + .word 39390 + .word 37319 + .word 40338 + .word 16341 + .word 0 + .word 60101 + .word 48639 + .word 6972 + .word 46254 + .word 49115 + .word 0 + .word 56660 + .word 41165 + .word 63413 + .word 50313 + .word 49116 + .word 0 + .word 13109 + .word 12767 + .word 29074 + .word 57119 + .word 16354 + .word 0 + .word 2453 + .word 26502 + .word 15952 + .word 44109 + .word 16355 + .word 0 + .word 44844 + .word 50072 + .word 22431 + .word 49646 + .word 49129 + .word 0 + .word 33416 + .word 16999 + .word 40271 + .word 50445 + .word 49129 + .word 0 + .word 26560 + .word 32264 + .word 54945 + .word 56373 + .word 16367 + .word 0 + .word 58100 + .word 55846 + .word 35515 + .word 33528 + .word 16367 + .word 0 + .word 44190 + .word 42353 + .word 4741 + .word 37259 + .word 49141 + .word 0 + .word 47772 + .word 5308 + .word 50468 + .word 42281 + .word 49139 + .word 0 + .word 53822 + .word 6159 + .word 32580 + .word 46797 + .word 16377 + .word 0 + .word 5509 + .word 51700 + .word 62457 + .word 63728 + .word 16373 + .word 0 + .word 52274 + .word 35926 + .word 43999 + .word 35182 + .word 49148 + .word 0 + .word 33647 + .word 41025 + .word 45844 + .word 37383 + .word 16317 + .word 0 + .type _P,@object + .size _P,2640 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,12 + .align 2 +_PP: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP,@object + .size _PP,120 + .align 2 +_QP: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .type _QP,@object + .size _QP,120 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,12 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .type _tonpi,@object + .size _tonpi,12 + .data + .hidden __libm_sincos_pi4l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/j1f.S b/external/sgx_libm/ia32/j1f.S new file mode 100644 index 0000000000..dec0258eb9 --- /dev/null +++ b/external/sgx_libm/ia32/j1f.S @@ -0,0 +1,695 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j1f.c" + .text +..TXTST0: +# -- Begin j1f + .text + .align 16,0x90 + .globl j1f +j1f: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %ebx + subl $120, %esp + movl 8(%ebp), %esi + movl %esi, %eax + andl $2147483647, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2139095040, %eax + jae ..B1.37 +..B1.2: + cmpl $1099993482, %eax + jae ..B1.32 +..B1.3: + cmpl $1075439785, %eax + jae ..B1.19 +..B1.4: + cmpl $1048576000, %eax + jae ..B1.15 +..B1.5: + cmpl $998244352, %eax + jae ..B1.14 +..B1.6: + cmpl $838860800, %eax + jae ..B1.13 +..B1.7: + shrl $31, %esi + cmpl $16777216, %eax + jb ..B1.9 +..B1.8: + flds 8(%ebp) + fmuls .L_2il0floatpacket.1@GOTOFF(%ebx) + flds .L_2il0floatpacket.0@GOTOFF(%ebx) + fmul %st(1), %st + fldl .L_2il0floatpacket.2@GOTOFF(%ebx) + fmulp %st, %st(2) + fsubp %st, %st(1) + fstps 32(%esp) + flds 32(%esp) + fmuls .L_2il0floatpacket.3@GOTOFF(%ebx) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + testl %eax, %eax + je ..B1.11 +..B1.10: + flds _small_value_32@GOTOFF(%ebx,%esi,4) + fmuls .L_2il0floatpacket.4@GOTOFF(%ebx) + fsts 32(%esp) + flds 8(%ebp) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + fsubp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + flds 8(%ebp) +..B1.12: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + flds 8(%ebp) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fldl 8+_Q2@GOTOFF(%ebx) + fmul %st(1), %st + faddl _Q2@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + flds 8(%ebp) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldl 24+_Q2@GOTOFF(%ebx) + fmul %st(1), %st + fldl 16+_Q2@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 8+_Q2@GOTOFF(%ebx) + fmulp %st, %st(2) + faddl _Q2@GOTOFF(%ebx) + fmulp %st, %st(2) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + flds 8(%ebp) + testl $-2147483648, %esi + fabs + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldl 88+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + fldl 72+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 56+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 40+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 24+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 8+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + faddp %st, %st(1) + fldl 64+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fldl 80+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 32+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 48+_Q1@GOTOFF(%ebx) + fmulp %st, %st(3) + faddl _Q1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl 16+_Q1@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + je ..B1.18 +..B1.16: + fchs +..B1.18: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + flds 8(%ebp) + andl $-2147483648, %esi + fabs + cmpl $1097786634, %eax + jae ..B1.27 +..B1.20: + cmpl $1091204523, %eax + jae ..B1.24 +..B1.21: + cmpl $1085318267, %eax + jae ..B1.23 +..B1.22: + lea _P1@GOTOFF(%ebx), %eax + jmp ..B1.28 +..B1.23: + lea _P2@GOTOFF(%ebx), %eax + jmp ..B1.28 +..B1.24: + cmpl $1094494752, %eax + jae ..B1.26 +..B1.25: + lea _P3@GOTOFF(%ebx), %eax + jmp ..B1.28 +..B1.26: + lea _P4@GOTOFF(%ebx), %eax + jmp ..B1.28 +..B1.27: + lea _P5@GOTOFF(%ebx), %eax +..B1.28: + fldl 104(%eax) + testl %esi, %esi + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldl 96(%eax) + fmul %st(1), %st + fldl 80(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 64(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 48(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 32(%eax) + fmul %st(2), %st + fxch %st(1) + faddl 16(%eax) + fmul %st(3), %st + faddp %st, %st(1) + fldl 72(%eax) + fmul %st(2), %st + fxch %st(1) + faddl (%eax) + fxch %st(1) + faddl 40(%eax) + fmul %st(2), %st + fldl 88(%eax) + fmul %st(3), %st + fxch %st(1) + faddl 8(%eax) + fmul %st(5), %st + fxch %st(1) + faddl 56(%eax) + fmulp %st, %st(3) + fxch %st(2) + faddl 24(%eax) + fmulp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + je ..B1.31 +..B1.29: + fchs +..B1.31: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + flds 8(%ebp) + lea 40(%esp), %eax + fabs + lea 48(%esp), %edx + fld1 + fdiv %st(1), %st + andl $-2147483648, %esi + fstl 16(%eax) + fldl _val_16_0@GOTOFF(%ebx) + fmulp %st, %st(1) + fstl 24(%eax) + fmul %st(0), %st + fstl 32(%eax) + fmul %st(0), %st + fxch %st(1) + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + movl $-3, 16(%esp) + fstpl 40(%eax) + call __libm_sincos_k32 +..B1.33: + fldl 80(%esp) + testl %esi, %esi + fldl 72(%esp) + fldl _tonpi@GOTOFF(%ebx) + fmull 56(%esp) + fsqrt + fldl 40+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fldl 32+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 8+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl _PP@GOTOFF(%ebx) + faddp %st, %st(1) + fldl 40+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + fmull 48(%esp) + fxch %st(1) + faddl 24+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fldl 32+_QP@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(1) + faddl 8+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + faddl 16+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + faddl _QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmull 64(%esp) + fmull 40(%esp) + fsubrp %st, %st(2) + fmulp %st, %st(1) + je ..B1.36 +..B1.34: + fchs +..B1.36: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.37: + ja ..B1.39 +..B1.38: + shrl $31, %esi + flds _zeros@GOTOFF(%ebx,%esi,4) + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + flds 8(%ebp) +..B1.40: + addl $120, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type j1f,@function + .size j1f,.-j1f + .data +# -- End j1f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3e500000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x3f000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4d800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x31800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0x0d800000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_Q2: + .long 4294942533 + .long 3219128319 + .long 1380922587 + .long 1068848469 + .long 4229217063 + .long 3212603831 + .long 2485211372 + .long 1060546867 + .type _Q2,@object + .size _Q2,32 + .align 4 +_Q1: + .long 4294875887 + .long 1071644671 + .long 4170968197 + .long 1038133990 + .long 82133904 + .long 3215982592 + .long 2332230043 + .long 1043853917 + .long 2564340116 + .long 1063605580 + .long 220691470 + .long 1046506888 + .long 254563561 + .long 3205265147 + .long 694808779 + .long 1046622203 + .long 4019568744 + .long 1051070668 + .long 1556554770 + .long 1044540217 + .long 1786312313 + .long 3191946521 + .long 1750363188 + .long 1039907362 + .type _Q1,@object + .size _Q1,96 + .align 4 +_P1: + .long 3288017007 + .long 3163666881 + .long 1479173198 + .long 3218720463 + .long 2681037136 + .long 1068165283 + .long 482223942 + .long 1068193949 + .long 1641242500 + .long 3212130132 + .long 3602486439 + .long 3210890035 + .long 1295520927 + .long 1059513544 + .long 2893642677 + .long 1057503730 + .long 2144568350 + .long 3200875225 + .long 914896231 + .long 3198366754 + .long 1774974526 + .long 1046581392 + .long 3090631217 + .long 1043566169 + .long 3310618599 + .long 3186783429 + .long 1974431497 + .long 1074702165 + .type _P1,@object + .size _P1,112 + .align 4 +_P2: + .long 216484910 + .long 1015040375 + .long 3011708428 + .long 1070806296 + .long 3332724636 + .long 3214272269 + .long 3160644008 + .long 3215461507 + .long 2925435221 + .long 1063888050 + .long 725350898 + .long 1063337916 + .long 297499451 + .long 3206574940 + .long 3278099830 + .long 3204945545 + .long 2222993240 + .long 1053042193 + .long 2059286351 + .long 1050869046 + .long 306569625 + .long 3193793299 + .long 95256688 + .long 3191038309 + .long 616794992 + .long 1039029534 + .long 4088689232 + .long 1075580917 + .type _P2,@object + .size _P2,112 + .align 4 +_P3: + .long 1314465059 + .long 1017127215 + .long 1413823668 + .long 3218077268 + .long 4087546795 + .long 1065951807 + .long 3559351807 + .long 1067757765 + .long 338531188 + .long 3210711466 + .long 2516776276 + .long 3210695105 + .long 1548953411 + .long 1058452686 + .long 3819184955 + .long 1057373236 + .long 1262833741 + .long 3200137243 + .long 325214128 + .long 3198310046 + .long 1253465703 + .long 1045913252 + .long 3453826356 + .long 1043528319 + .long 2667154656 + .long 3186140571 + .long 3502111785 + .long 1076123856 + .type _P3,@object + .size _P3,112 + .align 4 +_P4: + .long 1657852450 + .long 3163577804 + .long 2020212262 + .long 1070330675 + .long 774106997 + .long 3212888122 + .long 2119717923 + .long 3215085957 + .long 2098754573 + .long 1062575793 + .long 2137093530 + .long 1063017421 + .long 2437037263 + .long 3205513537 + .long 2698759453 + .long 3204752976 + .long 1998212634 + .long 1052165362 + .long 2817762251 + .long 1050764623 + .long 357372240 + .long 3193071576 + .long 3891599306 + .long 3190966182 + .long 2865549426 + .long 1038348895 + .long 4077970850 + .long 1076536762 + .type _P4,@object + .size _P4,112 + .align 4 +_P5: + .long 1537387514 + .long 3166104464 + .long 4237757176 + .long 3217630662 + .long 789391682 + .long 1064857043 + .long 3122547501 + .long 1067488355 + .long 3303098147 + .long 3209681410 + .long 2944525948 + .long 3210343613 + .long 1468487066 + .long 1057519518 + .long 285546763 + .long 1057172625 + .long 830693909 + .long 3199311383 + .long 1284260698 + .long 3198182585 + .long 1823688212 + .long 1045254801 + .long 1962790020 + .long 1043427779 + .long 1867031598 + .long 3185590079 + .long 906299589 + .long 1076918395 + .type _P5,@object + .size _P5,112 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_PP: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP,@object + .size _PP,48 + .align 4 +_QP: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP,@object + .size _QP,48 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .data + .hidden __libm_sincos_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/j1l.S b/external/sgx_libm/ia32/j1l.S new file mode 100644 index 0000000000..5c7f1c4c13 --- /dev/null +++ b/external/sgx_libm/ia32/j1l.S @@ -0,0 +1,106 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j1l.c" + .text +..TXTST0: +# -- Begin j1l + .text + .align 16,0x90 + .globl j1l +j1l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + fldt 8(%ebp) + lea 16(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.6: + addl $-32, %esp + movl (%edi), %ecx + lea 64(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%edi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __j1q@PLT +..B1.5: + addl $28, %esp +..B1.2: + movl 32(%esp), %eax + movl %eax, (%edi) + movl 36(%esp), %edx + movl 40(%esp), %ecx + movl 44(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.7: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type j1l,@function + .size j1l,.-j1l + .data +# -- End j1l + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/jn.S b/external/sgx_libm/ia32/jn.S new file mode 100644 index 0000000000..f3e165bf3b --- /dev/null +++ b/external/sgx_libm/ia32/jn.S @@ -0,0 +1,1477 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "jn.c" + .text +..TXTST0: +# -- Begin jn + .text + .align 16,0x90 + .globl jn +jn: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + movl 8(%ebp), %edx +..B1.2: + fnstcw 102(%esp) +..B1.3: + movzwl 18(%ebp), %eax + andl $32752, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $32752, %eax + je ..B1.75 +..B1.4: + testl %edx, %edx + je ..B1.51 +..B1.5: + fldl 12(%ebp) + fldl _zeros@GOTOFF(%ebx) + fucom %st(1) + fnstsw %ax + sahf + jp ..B1.6 + je ..B1.79 +..B1.6: + testl %edx, %edx + jl ..B1.74 +..B1.7: + movl $1, %edi +..B1.8: + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.10 +..B1.9: + movl %edi, %eax + fxch %st(1) + fchs + negl %eax + testb $1, %dl + fstl 12(%ebp) + je ..L3 + movl %eax, %edi +..L3: + fxch %st(1) +..B1.10: + cmpl $1, %edx + je ..B1.71 +..B1.11: + movl %edx, %eax + sarl $5, %eax + cmpl $160, %eax + jg ..B1.13 +..B1.12: + fldl XZERO@GOTOFF(%ebx,%eax,8) + jmp ..B1.14 +..B1.13: + lea -640(,%eax,4), %eax + lea (,%eax,8), %ecx + subl %eax, %ecx + movl %ecx, 80(%esp) + fildl 80(%esp) + faddl .L_2il0floatpacket.0@GOTOFF(%ebx) +..B1.14: + fcomp %st(2) + fnstsw %ax + sahf + ja ..B1.50 +..B1.15: + fstp %st(0) + movzwl 102(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.70 +..B1.16: + fstp %st(0) + orl $-64768, %ecx + movw %cx, 100(%esp) +..B1.17: + fldcw 100(%esp) +..B1.18: + fldl 12(%ebp) + movl $1, %esi +..B1.19: + movl %edx, 80(%esp) + cmpl $1753, %edx + fildl 80(%esp) + jg ..B1.28 +..B1.20: + fldt val_0_4@GOTOFF(%ebx) + fmul %st(1), %st + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B1.28 +..B1.21: + fstp %st(0) + fldt _val_2_0L@GOTOFF(%ebx) + testl %edx, %edx + fdivrp %st, %st(1) + fldt _val_1_0L@GOTOFF(%ebx) + fld %st(0) + fld %st(0) + fld %st(2) + fld %st(3) + jle ..B1.24 +..B1.22: + xorl %eax, %eax +..B1.23: + incl %eax + fmul %st(5), %st + cmpl %edx, %eax + fxch %st(1) + fmul %st(3), %st + fxch %st(3) + fadd %st(4), %st + fxch %st(3) + fxch %st(1) + jb ..B1.23 +..B1.24: + fstp %st(3) +..B1.25: + fxch %st(4) + fmul %st(0), %st + xorl %ecx, %ecx + fchs +..B1.26: + incl %ecx + incl %edx + movl %ecx, %ebx + fld %st(3) + imull %edx, %ebx + fxch %st(1) + fmul %st, %st(2) + movl %ebx, 80(%esp) + fildl 80(%esp) + fdivrp %st, %st(3) + fxch %st(2) + fadd %st, %st(4) + fxch %st(1) + fucomp %st(4) + fnstsw %ax + sahf + fxch %st(1) + jne ..B1.26 + jp ..B1.26 +..B1.27: + fstp %st(0) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(2) + fdivrp %st, %st(1) + fxch %st(1) + fstpt 56(%esp) + jmp ..B1.41 +..B1.28: + fcom %st(1) + fnstsw %ax + sahf + ja ..B1.47 +..B1.29: + fldt _val_20_0L@GOTOFF(%ebx) + fmul %st(1), %st + fldt _val_1000_0L@GOTOFF(%ebx) + faddp %st, %st(1) + fcomp %st(2) + fnstsw %ax + sahf + ja ..B1.53 +..B1.30: + fldt _val_4_0L@GOTOFF(%ebx) + movl $-1, %eax + movl %ebx, 12(%esp) + xorl %ecx, %ecx + fstpt 152(%esp) + fldt 152(%esp) + fld %st(1) + fmulp %st, %st(1) + fmulp %st, %st(1) + fstpt 184(%esp) + fldt 184(%esp) + fxch %st(1) + fstpt 104(%esp) + fldt 104(%esp) + fldt _val_8_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 168(%esp) + fldt 168(%esp) + fldt _val_1_0L@GOTOFF(%ebx) + fld %st(0) + fsubrp %st, %st(3) + fxch %st(1) + fdivrp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 88(%esp) + fldt _val_2_0L@GOTOFF(%ebx) + fstpt 136(%esp) + fldt 136(%esp) + fstpt 48(%esp) + fldt _val_3_0L@GOTOFF(%ebx) + fstpt 120(%esp) + fldt 120(%esp) + fldt _val_5_0L@GOTOFF(%ebx) + movl %eax, %ebx + fstpt (%esp) + fldt (%esp) + fldt 120(%esp) + fldt 48(%esp) + fldt 16(%esp) +..B1.31: + fldt 168(%esp) + fld %st(3) + fmul %st(4), %st + testl %ebx, %ebx + fxch %st(4) + fstpt 120(%esp) + fxch %st(2) + fstpt 48(%esp) + fldt 48(%esp) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fstpt 72(%esp) + fldt 72(%esp) + fldt 184(%esp) + fsub %st, %st(4) + fxch %st(3) + fdivrp %st, %st(4) + fxch %st(6) + fmulp %st, %st(3) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(2) + fdivrp %st, %st(1) + fmul %st(1), %st + fldt 120(%esp) + fldt 48(%esp) + jle ..B1.33 +..B1.32: + fxch %st(3) + faddp %st, %st(6) + fldt 32(%esp) + fadd %st(2), %st + fstpt 32(%esp) + jmp ..B1.34 +..B1.33: + fxch %st(3) + fsubrp %st, %st(6) + fldt 32(%esp) + fsub %st(2), %st + fstpt 32(%esp) +..B1.34: + fldt 136(%esp) + fadd %st, %st(3) + faddp %st, %st(5) + fldt 152(%esp) + fadd %st, %st(1) + faddp %st, %st(4) + fld %st(1) + fdiv %st(6), %st + fabs + fldt 88(%esp) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.36 +..B1.35: + fstpt 88(%esp) + movl $1, %ecx + jmp ..B1.37 +..B1.36: + fstp %st(0) + testl %ecx, %ecx + jne ..B1.52 +..B1.37: + fldt (%esp) + negl %ebx + fucomp %st(6) + fnstsw %ax + sahf + fxch %st(2) + fxch %st(1) + fxch %st(5) + jne ..B1.31 + jp ..B1.31 +..B1.38: + fstp %st(4) + fstp %st(1) + fstp %st(0) + fstp %st(0) + fldt 72(%esp) + movl 12(%esp), %ebx + fstpt (%esp) + fstpt 16(%esp) + fstpt 56(%esp) + fldt 104(%esp) +..B1.39: + addl $-32, %esp + addl %edx, %edx + negl %edx + lea 32(%esp), %eax + decl %edx + lea 88(%esp), %ecx + fstpt (%esp) + fldt (%esp) + movl %eax, 12(%esp) + movl %ecx, 16(%esp) + movl %edx, 20(%esp) + fstpt 104(%eax) + call __libm_sincos_pi4l +..B1.82: + fldt 136(%esp) + addl $32, %esp +..B1.40: + fldt _tonpi@GOTOFF(%ebx) + fdivp %st, %st(1) + fsqrt + fldt 56(%esp) + fldt 16(%esp) + fmulp %st, %st(1) + fldt (%esp) + fldt 32(%esp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fmulp %st, %st(1) +..B1.41: + testl %edi, %edi + jl ..B1.43 +..B1.42: + fstpt (%esp) + jmp ..B1.44 +..B1.43: + fchs + fstpt (%esp) +..B1.44: + testl %esi, %esi + je ..B1.46 +..B1.45: + fldcw 102(%esp) +..B1.46: + fldt (%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.47: + fstp %st(0) + fldt _val_0_0L@GOTOFF(%ebx) + lea (%edx,%edx), %eax + movl %eax, 80(%esp) + fstpt 32(%esp) + fld %st(0) + fmul %st(1), %st + fchs + fstpt 64(%esp) + fld %st(0) + fxch %st(1) + fstpt 104(%esp) + fldt _val_1_0L@GOTOFF(%ebx) + fstpt (%esp) + fldt (%esp) + fld %st(0) + fxch %st(1) + fstpt 16(%esp) + fildl 80(%esp) + fld %st(0) + fldt _val_2_0L@GOTOFF(%ebx) + fstpt 48(%esp) + fldt (%esp) + jmp ..B1.48 +..B1.49: + fstp %st(0) + fxch %st(4) + fxch %st(3) + fxch %st(2) +..B1.48: + fldt 48(%esp) + faddp %st, %st(2) + fld %st(4) + fmul %st(2), %st + fldt 64(%esp) + fmul %st, %st(2) + fldt 32(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(3) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(5) + fstpt 32(%esp) + fld %st(4) + fxch %st(1) + fdivr %st, %st(5) + fxch %st(4) + fucom %st(5) + fnstsw %ax + sahf + jne ..B1.49 + jp ..B1.49 + jmp ..B1.63 +..B1.50: + fstp %st(1) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.51: + fldl 12(%ebp) + addl $-16, %esp + fstpl (%esp) + call j0@PLT +..B1.83: + addl $260, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.52: + fstp %st(4) + fstp %st(3) + fstp %st(0) + fstp %st(0) + fldt 72(%esp) + movl 12(%esp), %ebx + fstpt (%esp) + fxch %st(1) + fstpt 16(%esp) + fstpt 56(%esp) + fldt 104(%esp) + jmp ..B1.39 +..B1.53: + fstp %st(0) + fldt _val_36_0L@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.57 +..B1.54: + fstp %st(0) + addl $-16, %esp + fstpt (%esp) + fldt (%esp) + movl %edx, 52(%esp) + fstpt 120(%esp) + call __j0l@PLT +..B1.84: + fldt 120(%esp) + movl 52(%esp), %edx + addl $16, %esp +..B1.55: + fxch %st(1) + fstpt 56(%esp) + addl $-16, %esp + fstpt (%esp) + fldt (%esp) + movl %edx, 52(%esp) + fstpt 120(%esp) + call __j1l@PLT +..B1.85: + fldt 120(%esp) + movl 52(%esp), %edx + addl $16, %esp +..B1.56: + fxch %st(1) + jmp ..B1.59 +..B1.57: + fldl _ones@GOTOFF(%ebx) + fdiv %st(2), %st + fmul %st, %st(1) + fld %st(1) + fmul %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fxch %st(1) + fstpt 24(%esp) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fldt _PP0@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _PP1@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_PP1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_PP1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 108+_PP0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fstpt 40(%esp) + addl $-32, %esp + lea 44(%esp), %eax + lea 32(%esp), %ecx + fxch %st(3) + fstpt (%esp) + fldt (%esp) + fldt 108+_PP1@GOTOFF(%ebx) + movl %eax, 12(%esp) + faddp %st, %st(4) + fldt _QP0@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP0@GOTOFF(%ebx) + movl %ecx, 16(%esp) + faddp %st, %st(1) + fmul %st(3), %st + fldt _QP1@GOTOFF(%ebx) + fmul %st(4), %st + fldt 12+_QP1@GOTOFF(%ebx) + movl $-1, 20(%esp) + faddp %st, %st(1) + fmul %st(4), %st + fxch %st(5) + fstpt 60(%eax) + movl %edx, 24(%eax) + fxch %st(1) + fstpt 92(%eax) + fldt 24+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_QP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fldt 36+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 48+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 60+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 72+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 84+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 96+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmulp %st, %st(3) + fldt 108+_QP0@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fstpt 44(%eax) + fldt 108+_QP1@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 76(%eax) + call __libm_sincos_pi4l +..B1.86: + fldt 136(%esp) + fldt 120(%esp) + fldt 104(%esp) + fldt 88(%esp) + movl 68(%esp), %edx + addl $32, %esp +..B1.58: + fldt _tonpi@GOTOFF(%ebx) + fldt 24(%esp) + fmulp %st, %st(1) + fsqrt + fldt (%esp) + fldt 12(%esp) + fmul %st, %st(3) + fmulp %st, %st(4) + fldt 40(%esp) + fmul %st(1), %st + fsubp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt 56(%esp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.59: + fldt _val_2_0L@GOTOFF(%ebx) + cmpl $1, %edx + fld %st(0) + jle ..B1.91 +..B1.60: + fldt 56(%esp) + decl %edx + xorl %eax, %eax +..B1.61: + fld %st(1) + incl %eax + fdiv %st(5), %st + cmpl %edx, %eax + fmul %st(4), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(2) + fsubp %st, %st(1) + fld %st(3) + jae ..B1.62 +..B1.92: + fstp %st(4) + fxch %st(3) + jmp ..B1.61 +..B1.62: + fstp %st(0) + fstp %st(1) + fstp %st(3) + fstp %st(0) + fstpt 56(%esp) + jmp ..B1.41 +..B1.63: + fstp %st(1) + fstp %st(3) + fstp %st(0) + fstp %st(2) + fstp %st(1) + fldt 48(%esp) + decl %edx + fldt 16(%esp) + xorl %eax, %eax + movl %edx, 80(%esp) + fld %st(0) + fxch %st(1) + fdiv %st, %st(3) + fildl 80(%esp) + fmul %st(3), %st + fldt 104(%esp) + fdivr %st, %st(3) +..B1.64: + fld %st(5) + incl %eax + fmul %st(2), %st + fxch %st(2) + fsub %st(5), %st + fxch %st(1) + fmul %st, %st(3) + cmpl %edx, %eax + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fld %st(5) + fld %st(1) + jge ..B1.65 +..B1.93: + fstp %st(7) + fstp %st(1) + fxch %st(2) + jmp ..B1.64 +..B1.65: + fstp %st(0) + fstp %st(4) + fstp %st(4) + fstp %st(0) + fxch %st(2) + fstpt 56(%esp) + fldt 56(%esp) + fxch %st(1) + fabs + fxch %st(1) + fabs + fcompp + fnstsw %ax + fxch %st(1) + fstpt (%esp) + sahf + jae ..B1.68 + jp ..B1.68 +..B1.66: + addl $-16, %esp + fstpt (%esp) + call __j1l@PLT +..B1.87: + addl $16, %esp +..B1.67: + fldt (%esp) + fdivrp %st, %st(1) + jmp ..B1.41 +..B1.68: + addl $-16, %esp + fstpt (%esp) + call __j0l@PLT +..B1.88: + addl $16, %esp +..B1.69: + fldt 56(%esp) + fdivrp %st, %st(1) + jmp ..B1.41 +..B1.70: + xorl %esi, %esi + jmp ..B1.19 +..B1.71: + fstp %st(0) + addl $-16, %esp + fstpl (%esp) + call j1@PLT +..B1.89: + addl $16, %esp + testl %edi, %edi + jge ..B1.73 +..B1.72: + fchs +..B1.73: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.74: + movl %edx, %eax + negl %edx + notl %eax + andl $1, %eax + lea -1(%eax,%eax), %edi + jmp ..B1.8 +..B1.75: + testl $1048575, 16(%ebp) + jne ..B1.77 +..B1.76: + cmpl $0, 12(%ebp) + je ..B1.78 +..B1.77: + fldl 12(%ebp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + movzbl 19(%ebp), %ecx + movl %edx, %eax + andl $128, %ecx + shrl $7, %ecx + shrl $31, %eax + xorl %eax, %ecx + andl %edx, %ecx + fldl _zeros@GOTOFF(%ebx,%ecx,8) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.79: + fstp %st(0) + fstp %st(0) + movzbl 19(%ebp), %ecx + movl %edx, %eax + andl $128, %ecx + shrl $7, %ecx + shrl $31, %eax + xorl %eax, %ecx + andl %edx, %ecx + fldl _zeros@GOTOFF(%ebx,%ecx,8) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.91: + fstp %st(0) + fstp %st(2) + fstp %st(1) + jmp ..B1.41 + .align 16,0x90 + .type jn,@function + .size jn,.-jn + .data +# -- End jn + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40add600 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +XZERO: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x33333333,0x3fd33333 + .long 0x66666666,0x3ff66666 + .long 0x00000000,0x400c0000 + .long 0x00000000,0x401c0000 + .long 0x00000000,0x40280000 + .long 0xcccccccd,0x40324ccc + .long 0x00000000,0x403a0000 + .long 0x00000000,0x40418000 + .long 0x9999999a,0x40469999 + .long 0x00000000,0x404c4000 + .long 0x33333333,0x40513333 + .long 0x00000000,0x40548000 + .long 0x00000000,0x40580000 + .long 0x33333333,0x405bb333 + .long 0xcccccccd,0x405f8ccc + .long 0xcccccccd,0x4061cccc + .long 0x33333333,0x4063e333 + .long 0xcccccccd,0x40660ccc + .long 0x33333333,0x40684333 + .long 0xcccccccd,0x406a8ccc + .long 0x33333333,0x406ce333 + .long 0x66666666,0x406f4666 + .long 0x9999999a,0x4070d999 + .long 0x00000000,0x40721800 + .long 0x9999999a,0x40735999 + .long 0x9999999a,0x4074a199 + .long 0x66666666,0x4075ee66 + .long 0x00000000,0x40774000 + .long 0xcccccccd,0x407894cc + .long 0x66666666,0x4079ee66 + .long 0x33333333,0x407b4b33 + .long 0x33333333,0x407cab33 + .long 0x00000000,0x407e1000 + .long 0x66666666,0x407f7666 + .long 0xcccccccd,0x408070cc + .long 0x33333333,0x40812733 + .long 0x33333333,0x4081df33 + .long 0xcccccccd,0x408298cc + .long 0x33333333,0x40835333 + .long 0x33333333,0x40840f33 + .long 0xcccccccd,0x4084cccc + .long 0x66666666,0x40858a66 + .long 0x66666666,0x40864a66 + .long 0x66666666,0x40870a66 + .long 0x00000000,0x4087cc00 + .long 0x66666666,0x40888e66 + .long 0x9999999a,0x40895199 + .long 0x9999999a,0x408a1599 + .long 0x33333333,0x408adb33 + .long 0xcccccccd,0x408ba0cc + .long 0x00000000,0x408c6000 + .long 0x00000000,0x408d2800 + .long 0x00000000,0x408df000 + .long 0x00000000,0x408ec000 + .long 0x00000000,0x408f8800 + .long 0x00000000,0x40902800 + .long 0x00000000,0x40909000 + .long 0x00000000,0x4090f400 + .long 0x00000000,0x40915c00 + .long 0x00000000,0x4091c000 + .long 0x00000000,0x40922800 + .long 0x00000000,0x40929000 + .long 0x00000000,0x4092f800 + .long 0x00000000,0x40935c00 + .long 0x00000000,0x4093c400 + .long 0x00000000,0x40943000 + .long 0x00000000,0x40949800 + .long 0x00000000,0x40950000 + .long 0x00000000,0x40956800 + .long 0x00000000,0x4095d000 + .long 0x00000000,0x40963c00 + .long 0x00000000,0x4096a400 + .long 0x00000000,0x40971000 + .long 0x00000000,0x40977800 + .long 0x00000000,0x4097e400 + .long 0x00000000,0x40984c00 + .long 0x00000000,0x4098b800 + .long 0x00000000,0x40992400 + .long 0x00000000,0x40999000 + .long 0x00000000,0x4099f800 + .long 0x00000000,0x409a6400 + .long 0x00000000,0x409ad000 + .long 0x00000000,0x409b3c00 + .long 0x00000000,0x409ba800 + .long 0x00000000,0x409c1400 + .long 0x00000000,0x409c8000 + .long 0x00000000,0x409cec00 + .long 0x00000000,0x409d5c00 + .long 0x00000000,0x409dc800 + .long 0x00000000,0x409e3400 + .long 0x00000000,0x409ea000 + .long 0x00000000,0x409f1000 + .long 0x00000000,0x409f7c00 + .long 0x00000000,0x409fe800 + .long 0x00000000,0x40a02c00 + .long 0x00000000,0x40a06200 + .long 0x00000000,0x40a09a00 + .long 0x00000000,0x40a0d000 + .long 0x00000000,0x40a10800 + .long 0x00000000,0x40a13e00 + .long 0x00000000,0x40a17600 + .long 0x00000000,0x40a1ae00 + .long 0x00000000,0x40a1e400 + .long 0x00000000,0x40a21c00 + .long 0x00000000,0x40a25400 + .long 0x00000000,0x40a28c00 + .long 0x00000000,0x40a2c200 + .long 0x00000000,0x40a2fa00 + .long 0x00000000,0x40a33200 + .long 0x00000000,0x40a36a00 + .long 0x00000000,0x40a3a200 + .long 0x00000000,0x40a3da00 + .long 0x00000000,0x40a41200 + .long 0x00000000,0x40a44a00 + .long 0x00000000,0x40a48200 + .long 0x00000000,0x40a4ba00 + .long 0x00000000,0x40a4f200 + .long 0x00000000,0x40a52a00 + .long 0x00000000,0x40a56200 + .long 0x00000000,0x40a59a00 + .long 0x00000000,0x40a5d200 + .long 0x00000000,0x40a60a00 + .long 0x00000000,0x40a64400 + .long 0x00000000,0x40a67c00 + .long 0x00000000,0x40a6b400 + .long 0x00000000,0x40a6ec00 + .long 0x00000000,0x40a72600 + .long 0x00000000,0x40a75e00 + .long 0x00000000,0x40a79600 + .long 0x00000000,0x40a7d000 + .long 0x00000000,0x40a80800 + .long 0x00000000,0x40a84000 + .long 0x00000000,0x40a87a00 + .long 0x00000000,0x40a8b200 + .long 0x00000000,0x40a8ec00 + .long 0x00000000,0x40a92400 + .long 0x00000000,0x40a95c00 + .long 0x00000000,0x40a99600 + .long 0x00000000,0x40a9ce00 + .long 0x00000000,0x40aa0800 + .long 0x00000000,0x40aa4200 + .long 0x00000000,0x40aa7a00 + .long 0x00000000,0x40aab400 + .long 0x00000000,0x40aaec00 + .long 0x00000000,0x40ab2600 + .long 0x00000000,0x40ab6000 + .long 0x00000000,0x40ab9800 + .long 0x00000000,0x40abd200 + .long 0x00000000,0x40ac0a00 + .long 0x00000000,0x40ac4400 + .long 0x00000000,0x40ac7e00 + .long 0x00000000,0x40acb800 + .long 0x00000000,0x40acf000 + .long 0x00000000,0x40ad2a00 + .long 0x00000000,0x40ad6400 + .long 0x00000000,0x40ad9e00 + .long 0x00000000,0x40add600 + .type XZERO,@object + .size XZERO,1288 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +val_0_4: + .byte 0x00,0xd0,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xfd,0x3f,0x00,0x00 + .type val_0_4,@object + .size val_0_4,12 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_val_2_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .type _val_2_0L,@object + .size _val_2_0L,12 + .align 2 +_val_1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _val_1_0L,@object + .size _val_1_0L,12 + .align 2 +_val_20_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16387 + .word 0 + .type _val_20_0L,@object + .size _val_20_0L,12 + .align 2 +_val_1000_0L: + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .type _val_1000_0L,@object + .size _val_1000_0L,12 + .align 2 +_val_4_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16385 + .word 0 + .type _val_4_0L,@object + .size _val_4_0L,12 + .align 2 +_val_8_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16386 + .word 0 + .type _val_8_0L,@object + .size _val_8_0L,12 + .align 2 +_val_3_0L: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .type _val_3_0L,@object + .size _val_3_0L,12 + .align 2 +_val_5_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16385 + .word 0 + .type _val_5_0L,@object + .size _val_5_0L,12 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .type _tonpi,@object + .size _tonpi,12 + .align 2 +_val_0_0L: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _val_0_0L,@object + .size _val_0_0L,12 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,12 + .align 2 +_PP0: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP0,@object + .size _PP0,120 + .align 2 +_PP1: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP1,@object + .size _PP1,120 + .align 2 +_QP0: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .type _QP0,@object + .size _QP0,120 + .align 2 +_QP1: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .type _QP1,@object + .size _QP1,120 + .data + .hidden __libm_sincos_pi4l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/jnf.S b/external/sgx_libm/ia32/jnf.S new file mode 100644 index 0000000000..e62e1f69fb --- /dev/null +++ b/external/sgx_libm/ia32/jnf.S @@ -0,0 +1,1401 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "jnf.c" + .text +..TXTST0: +# -- Begin jnf + .text + .align 16,0x90 + .globl jnf +jnf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl 12(%ebp), %edi + movl %edi, %edx + andl $2147483647, %edx + movl 8(%ebp), %esi + cmpl $2139095040, %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jae ..B1.41 +..B1.2: + testl %esi, %esi + je ..B1.39 +..B1.3: + xorl %esi, %edi + shrl $31, %edi + andl %esi, %edi + testl %edx, %edx + je ..B1.38 +..B1.4: + flds 12(%ebp) + movl %esi, %eax + cltd + xorl %edx, %esi + fabs + subl %edx, %esi + fsts 12(%ebp) + cmpl $1, %esi + je ..B1.61 +..B1.5: + movl %esi, %edx + sarl $3, %edx + cmpl $320, %edx + jg ..B1.7 +..B1.6: + flds function_zeros@GOTOFF(%ebx,%edx,4) + jmp ..B1.8 +..B1.7: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + lea -320(%edx), %ecx + lea -2560(,%edx,8), %edx + subl %ecx, %edx + movl %edx, 168(%esp) + fildl 168(%esp) + fstps 168(%esp) + flds 168(%esp) + faddp %st, %st(1) + fstps 168(%esp) + flds 168(%esp) +..B1.8: + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.37 +..B1.9: + movl %esi, 168(%esp) + cmpl $170, %esi + fildl 168(%esp) + fstpl 192(%esp) + fldl 192(%esp) + jg ..B1.18 +..B1.10: + fldl _val_0_6@GOTOFF(%ebx) + fmul %st(1), %st + fcomp %st(2) + fnstsw %ax + sahf + jb ..B1.18 +..B1.11: + fstp %st(2) + fstp %st(1) + fldl _val_2_0@GOTOFF(%ebx) + testl %esi, %esi + fdivrp %st, %st(1) + fstpl 192(%esp) + fld1 + fld %st(0) + fld %st(1) + fldl 192(%esp) + jle ..B1.15 +..B1.12: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fld %st(2) + xorl %edx, %edx + .align 16,0x90 +..B1.13: + fxch %st(2) + fmul %st, %st(3) + incl %edx + fxch %st(3) + fstpl 192(%esp) + cmpl %esi, %edx + fxch %st(1) + fmul %st, %st(3) + fadd %st(1), %st + fldl 192(%esp) + fxch %st(4) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(4) + fxch %st(3) + fxch %st(2) + fxch %st(1) + fxch %st(4) + jb ..B1.13 +..B1.14: + fstp %st(1) + fstp %st(0) +..B1.15: + fldl _TWO_19H@GOTOFF(%ebx) + xorl %edx, %edx + fxch %st(1) + fmul %st(0), %st + fchs + fstpl 192(%esp) + fxch %st(3) + fstl 176(%esp) + fstl 56(%esp) + fldl 192(%esp) +..B1.16: + fldl 176(%esp) + incl %edx + incl %esi + movl %edx, %ecx + imull %esi, %ecx + fmul %st(1), %st + fldl 56(%esp) + movl %ecx, 168(%esp) + fildl 168(%esp) + fstpl 192(%esp) + fldl 192(%esp) + fdivrp %st, %st(2) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fstl 176(%esp) + faddp %st, %st(1) + fstpl 192(%esp) + fld %st(4) + fldl 192(%esp) + fmul %st, %st(1) + fxch %st(1) + fstpl 192(%esp) + fstl 56(%esp) + fldl 192(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 184(%esp) + fldl 184(%esp) + fsubp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(2) + fucomp %st(2) + fnstsw %ax + sahf + jne ..B1.16 + jp ..B1.16 +..B1.17: + fstp %st(0) + fstp %st(0) + fstp %st(2) + fxch %st(1) + fmull 56(%esp) + fdivp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + jmp ..B1.30 +..B1.18: + fcom %st(1) + fnstsw %ax + sahf + ja ..B1.34 +..B1.19: + lea (%esi,%esi,4), %edx + lea 1000(,%edx,4), %ecx + movl %ecx, 168(%esp) + fildl 168(%esp) + fstpl 192(%esp) + fldl 192(%esp) + fcomp %st(2) + fnstsw %ax + sahf + ja ..B1.47 +..B1.20: + fstp %st(2) + fldl _val_4_0@GOTOFF(%ebx) + movl $-1, %ecx + fstl 152(%esp) + fld %st(2) + fmulp %st, %st(1) + xorl %edx, %edx + fmulp %st, %st(2) + fxch %st(1) + fstpl 192(%esp) + fstpt 112(%esp) + fldt 112(%esp) + fldl 192(%esp) + fld %st(0) + fxch %st(1) + fstpt 128(%esp) + fldl _val_8_0@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fstpt 96(%esp) + fldt 96(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fstpt 80(%esp) + fldt 80(%esp) + fsubrp %st, %st(2) + fdivrp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fstpt 64(%esp) + fldt 64(%esp) + fstpl 176(%esp) + fldl _val_2_0@GOTOFF(%ebx) + fstl 144(%esp) + fldl _val_3_0@GOTOFF(%ebx) + fstpt 48(%esp) + fldt 48(%esp) + fldl _val_5_0@GOTOFF(%ebx) + fstpt 32(%esp) + fld1 + fld %st(0) + fstpl 160(%esp) + fldt 80(%esp) + fldt 32(%esp) + fldt 48(%esp) +..B1.21: + fldt 96(%esp) + fld %st(6) + fmul %st(1), %st + testl %ecx, %ecx + fxch %st(1) + fmul %st(6), %st + fxch %st(5) + fstpl 56(%esp) + fld %st(1) + fmul %st(2), %st + fxch %st(4) + fstpt 80(%esp) + fldt 128(%esp) + fsub %st, %st(4) + fxch %st(1) + fdivrp %st, %st(4) + fld %st(2) + fmul %st(3), %st + fsubrp %st, %st(1) + fdivp %st, %st(4) + fxch %st(2) + fmull 176(%esp) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(3) + fstpl 192(%esp) + fldl 192(%esp) + fmul %st(3), %st + fstpl 192(%esp) + fldl 192(%esp) + fldt 80(%esp) + jle ..B1.46 +..B1.22: + faddp %st, %st(4) + fxch %st(3) + fstpl 192(%esp) + fldl 192(%esp) + fldt 64(%esp) + fadd %st(4), %st + fstpl 192(%esp) + fldl 192(%esp) + fstpt 64(%esp) +..B1.23: + fldl 144(%esp) + fadd %st, %st(6) + fxch %st(6) + fstpl 192(%esp) + fxch %st(5) + faddp %st, %st(4) + fxch %st(2) + fstl 176(%esp) + fdiv %st(4), %st + fldl 192(%esp) + fxch %st(4) + fstpl 192(%esp) + fldl 192(%esp) + fldl 152(%esp) + fadd %st, %st(3) + fxch %st(3) + fstpl 192(%esp) + fxch %st(2) + faddp %st, %st(3) + fldl 192(%esp) + fxch %st(3) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fabs + fldl 160(%esp) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.25 +..B1.24: + fstpl 160(%esp) + movl $1, %edx + jmp ..B1.26 +..B1.25: + fstp %st(0) + testl %edx, %edx + jne ..B1.45 +..B1.26: + fldl _TWO_19H@GOTOFF(%ebx) + negl %ecx + fmul %st(5), %st + fstpl 192(%esp) + fld %st(4) + fldl 192(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 184(%esp) + fldl 184(%esp) + fsubp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fldl 56(%esp) + fucomp %st(1) + fnstsw %ax + sahf + fxch %st(3) + fxch %st(2) + fxch %st(4) + fxch %st(5) + fxch %st(2) + jne ..B1.21 + jp ..B1.21 +..B1.27: + fstp %st(3) + fstp %st(2) + fstp %st(1) + fstp %st(1) + fstp %st(1) + fldt 112(%esp) + fxch %st(1) + fstpt 80(%esp) +..B1.28: + addl %esi, %esi + lea 56(%esp), %edx + negl %esi + lea 176(%esp), %ecx + fstl (%esp) + decl %esi + movl %edx, 8(%esp) + movl %ecx, 12(%esp) + movl %esi, 16(%esp) + fstpt 56(%edx) + call __libm_sincos_k32 +..B1.29: + fldt 112(%esp) + fldt 80(%esp) + fmull 176(%esp) + fldl _tonpi@GOTOFF(%ebx) + fdivp %st, %st(2) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fsqrt + fstpl 192(%esp) + fldl 192(%esp) + fldt 64(%esp) + fmull 56(%esp) + fsubrp %st, %st(2) + fmulp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) +..B1.30: + testl %edi, %edi + je ..B1.33 +..B1.31: + fchs +..B1.33: + fstps 168(%esp) + flds 168(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.34: + fstp %st(0) + fldl _val_2_0@GOTOFF(%ebx) + lea (%esi,%esi), %edx + movl %edx, 168(%esp) + fstpl 88(%esp) + fld %st(0) + fmul %st(1), %st + fchs + fld1 + fstl 176(%esp) + fld %st(0) + fxch %st(3) + fstl 48(%esp) + fxch %st(1) + fstpt 32(%esp) + fxch %st(3) + fstl 56(%esp) + fxch %st(3) + fstpt 112(%esp) + fildl 168(%esp) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fstpt 64(%esp) + fldl _TWO_19H@GOTOFF(%ebx) + fstpl 80(%esp) + fld %st(0) + fldl 48(%esp) + jmp ..B1.35 +..B1.36: + fstp %st(1) + fstl 56(%esp) + fstpl 176(%esp) + fxch %st(2) + fxch %st(3) + fxch %st(1) + fxch %st(4) + fxch %st(1) +..B1.35: + fldt 64(%esp) + fmul %st, %st(5) + fld %st(1) + fxch %st(1) + fmulp %st, %st(5) + fld %st(3) + fxch %st(3) + faddl 88(%esp) + fstpl 192(%esp) + fldl 192(%esp) + fmul %st, %st(1) + fxch %st(6) + faddp %st, %st(1) + fstpl 192(%esp) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(3) + fldl 192(%esp) + fld %st(0) + fxch %st(4) + fstpl 192(%esp) + fldl 192(%esp) + fdivr %st, %st(1) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fld %st(0) + fld %st(1) + fxch %st(1) + fmull 80(%esp) + fstpl 192(%esp) + fldl 192(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 184(%esp) + fldl 184(%esp) + fsubp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fldl 176(%esp) + fucomp %st(1) + fnstsw %ax + sahf + jne ..B1.36 + jp ..B1.36 + jmp ..B1.57 +..B1.37: + fstp %st(0) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + fstp %st(0) + flds _zeros@GOTOFF(%ebx,%edi,4) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + fstpl 56(%esp) + addl $4, %esp + pushl 12(%ebp) + call j0f@PLT +..B1.40: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + fstp %st(0) + ja ..B1.43 +..B1.42: + xorl %esi, %edi + shrl $31, %edi + andl %esi, %edi + flds _zeros@GOTOFF(%ebx,%edi,4) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + flds 12(%ebp) +..B1.44: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + fstp %st(2) + fstp %st(1) + fstp %st(0) + fstp %st(0) + fldt 112(%esp) + fxch %st(1) + fstpt 80(%esp) + jmp ..B1.28 +..B1.46: + fsubp %st, %st(4) + fxch %st(3) + fstpl 192(%esp) + fldl 192(%esp) + fldt 64(%esp) + fsub %st(4), %st + fstpl 192(%esp) + fldl 192(%esp) + fstpt 64(%esp) + jmp ..B1.23 +..B1.47: + fstp %st(0) + fxch %st(1) + fstpl 56(%esp) + fldl _val_17_0@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.51 +..B1.48: + fstl (%esp) + fstpt 112(%esp) + call j0@PLT +..B1.69: + fldt 112(%esp) +..B1.49: + fstl (%esp) + fxch %st(1) + fstpl 176(%esp) + fstpt 112(%esp) + call j1@PLT +..B1.70: + fldt 112(%esp) +..B1.50: + fxch %st(1) + jmp ..B1.53 +..B1.51: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + lea 96(%esp), %edx + fdiv %st(1), %st + lea 104(%esp), %ecx + fstpl 96(%edx) + fldl 96(%edx) + fstpt -64(%edx) + fldt -64(%edx) + fldl _val_16_0@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpl 96(%edx) + fldl 96(%edx) + fld %st(0) + fmul %st(1), %st + fstpl 96(%edx) + fldl 96(%edx) + fld %st(0) + fmul %st(1), %st + fstpl 96(%edx) + fldl 96(%edx) + fxch %st(3) + fstl (%esp) + movl %edx, 8(%esp) + movl %ecx, 12(%esp) + movl $-1, 16(%esp) + fxch %st(1) + fstpt -48(%edx) + fxch %st(2) + fstpt -32(%edx) + fstpt -16(%edx) + fstpt 16(%edx) + call __libm_sincos_k32 +..B1.52: + fldt 112(%esp) + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + fldl 40+_PP0@GOTOFF(%ebx) + fmul %st(2), %st + fldl 32+_PP0@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 24+_PP0@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 16+_PP0@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 8+_PP0@GOTOFF(%ebx) + fmul %st(2), %st + fstpl 192(%esp) + fldl 192(%esp) + fldl 32+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl _PP0@GOTOFF(%ebx) + fstpl 192(%esp) + fldl 192(%esp) + faddp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fldl 40+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl 16+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl 24+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl _PP1@GOTOFF(%ebx) + fldl 32+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl 8+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + faddp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fldl 40+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl 16+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl 24+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl _QP0@GOTOFF(%ebx) + fmul %st(6), %st + fxch %st(3) + faddl 8+_QP0@GOTOFF(%ebx) + fmul %st(4), %st + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fstpl 192(%esp) + fldl 192(%esp) + fldl 40+_QP1@GOTOFF(%ebx) + fmul %st(5), %st + faddl 24+_QP1@GOTOFF(%ebx) + fmul %st(5), %st + faddl 8+_QP1@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fldl 32+_QP1@GOTOFF(%ebx) + fmul %st(5), %st + faddl 16+_QP1@GOTOFF(%ebx) + fmulp %st, %st(5) + fldl _tonpi@GOTOFF(%ebx) + fxch %st(5) + faddl _QP1@GOTOFF(%ebx) + fmulp %st, %st(6) + faddp %st, %st(5) + fxch %st(4) + fstpl 192(%esp) + fldl 192(%esp) + fldt 32(%esp) + fmulp %st, %st(4) + fxch %st(3) + fstpl 192(%esp) + fldl 192(%esp) + fsqrt + fstpl 192(%esp) + fldl 192(%esp) + fldl 96(%esp) + fmul %st, %st(3) + fmulp %st, %st(2) + fldl 104(%esp) + fmul %st, %st(5) + fxch %st(3) + fsubrp %st, %st(5) + fmul %st, %st(4) + fxch %st(4) + fstpl 176(%esp) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) +..B1.53: + fldl _val_2_0@GOTOFF(%ebx) + cmpl $1, %esi + fdivp %st, %st(2) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + jle ..B1.74 +..B1.54: + fldl 176(%esp) + movl $1, %edx +..B1.55: + movl %edx, 168(%esp) + incl %edx + fildl 168(%esp) + fstpl 192(%esp) + fld %st(2) + fldl 192(%esp) + cmpl %esi, %edx + fmul %st(3), %st + fmulp %st, %st(4) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(2) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(2) + jl ..B1.55 +..B1.56: + fstp %st(0) + fstp %st(0) + jmp ..B1.30 +..B1.57: + fstp %st(3) + fstp %st(2) + fstp %st(3) + fstp %st(1) + fstp %st(1) + fstp %st(1) + fldl 88(%esp) + lea -2(%esi,%esi), %edx + fldt 32(%esp) + decl %esi + fldt 112(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fdiv %st, %st(4) + movl %edx, 168(%esp) + xorl %edx, %edx + fxch %st(4) + fstpl 192(%esp) + fdivr %st, %st(3) + fildl 168(%esp) + fldl 192(%esp) + fxch %st(1) + fstpl 192(%esp) + fldl 192(%esp) + fxch %st(5) + fstpl 192(%esp) + fldl 192(%esp) +..B1.58: + fld %st(1) + incl %edx + fmul %st(6), %st + fxch %st(5) + fsubr %st, %st(6) + fxch %st(3) + fmul %st, %st(4) + cmpl %esi, %edx + fxch %st(4) + fsubrp %st, %st(5) + fmul %st, %st(4) + fxch %st(4) + fstpl 192(%esp) + fld %st(0) + fldl 192(%esp) + fld %st(0) + fxch %st(7) + fstpl 192(%esp) + fldl 192(%esp) + jge ..B1.59 +..B1.75: + fstp %st(3) + fstp %st(0) + fxch %st(3) + fxch %st(2) + fxch %st(4) + fxch %st(5) + fxch %st(1) + fxch %st(5) + jmp ..B1.58 +..B1.59: + fstp %st(6) + fstp %st(3) + fstp %st(0) + fstp %st(4) + fstp %st(2) + fxch %st(1) + fstpl 176(%esp) + fxch %st(1) + fstpl 56(%esp) + fstpl (%esp) + call j0@PLT +..B1.60: + fldl 176(%esp) + fdivrp %st, %st(1) + fstpl 192(%esp) + fldl 192(%esp) + jmp ..B1.30 +..B1.61: + fxch %st(1) + fstpl 56(%esp) + fstps (%esp) + call j1f@PLT +..B1.62: + testl %edi, %edi + je ..B1.65 +..B1.63: + fchs +..B1.65: + fstps 168(%esp) + flds 168(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.74: + fstp %st(0) + jmp ..B1.30 + .align 16,0x90 + .type jnf,@function + .size jnf,.-jnf + .data +# -- End jnf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x8e,0x0a,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +function_zeros: + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x3f000000 + .long 0x3fcccccd + .long 0x40600000 + .long 0x40c33333 + .long 0x4111999a + .long 0x414b3333 + .long 0x4184cccd + .long 0x41a66666 + .long 0x41ca6666 + .long 0x41f0cccd + .long 0x420c0000 + .long 0x42206666 + .long 0x4235999a + .long 0x424b3333 + .long 0x42613333 + .long 0x42780000 + .long 0x42876666 + .long 0x42930000 + .long 0x429ecccd + .long 0x42aacccd + .long 0x42b6cccd + .long 0x42c30000 + .long 0x42cf6666 + .long 0x42dbcccd + .long 0x42e86666 + .long 0x42f50000 + .long 0x4300e666 + .long 0x43074ccd + .long 0x430db333 + .long 0x43143333 + .long 0x431ab333 + .long 0x43214ccd + .long 0x4327e666 + .long 0x432e8000 + .long 0x4335199a + .long 0x433bcccd + .long 0x43428000 + .long 0x43493333 + .long 0x43500000 + .long 0x43560000 + .long 0x435d0000 + .long 0x43640000 + .long 0x436b0000 + .long 0x43720000 + .long 0x43780000 + .long 0x437f0000 + .long 0x43830000 + .long 0x43868000 + .long 0x438a0000 + .long 0x438d8000 + .long 0x43910000 + .long 0x43948000 + .long 0x43980000 + .long 0x439b8000 + .long 0x439f0000 + .long 0x43a28000 + .long 0x43a60000 + .long 0x43a98000 + .long 0x43ad0000 + .long 0x43b08000 + .long 0x43b40000 + .long 0x43b78000 + .long 0x43bb0000 + .long 0x43bf0000 + .long 0x43c28000 + .long 0x43c60000 + .long 0x43c98000 + .long 0x43cd0000 + .long 0x43d08000 + .long 0x43d40000 + .long 0x43d80000 + .long 0x43db8000 + .long 0x43df0000 + .long 0x43e28000 + .long 0x43e60000 + .long 0x43ea0000 + .long 0x43ed8000 + .long 0x43f10000 + .long 0x43f48000 + .long 0x43f88000 + .long 0x43fc0000 + .long 0x43ff8000 + .long 0x44018000 + .long 0x44038000 + .long 0x44054000 + .long 0x44070000 + .long 0x44090000 + .long 0x440ac000 + .long 0x440c8000 + .long 0x440e4000 + .long 0x44104000 + .long 0x44120000 + .long 0x4413c000 + .long 0x4415c000 + .long 0x44178000 + .long 0x44194000 + .long 0x441b4000 + .long 0x441d0000 + .long 0x441ec000 + .long 0x4420c000 + .long 0x44228000 + .long 0x44244000 + .long 0x44264000 + .long 0x44280000 + .long 0x442a0000 + .long 0x442bc000 + .long 0x442d8000 + .long 0x442f8000 + .long 0x44314000 + .long 0x44334000 + .long 0x44350000 + .long 0x4436c000 + .long 0x4438c000 + .long 0x443a8000 + .long 0x443c8000 + .long 0x443e4000 + .long 0x44400000 + .long 0x44420000 + .long 0x4443c000 + .long 0x4445c000 + .long 0x44478000 + .long 0x44498000 + .long 0x444b4000 + .long 0x444d0000 + .long 0x444f0000 + .long 0x4450c000 + .long 0x4452c000 + .long 0x44548000 + .long 0x44568000 + .long 0x44584000 + .long 0x445a4000 + .long 0x445c0000 + .long 0x445e0000 + .long 0x445fc000 + .long 0x4461c000 + .long 0x44638000 + .long 0x44658000 + .long 0x44674000 + .long 0x44694000 + .long 0x446b0000 + .long 0x446cc000 + .long 0x446ec000 + .long 0x44708000 + .long 0x44728000 + .long 0x44744000 + .long 0x44764000 + .long 0x44784000 + .long 0x447a0000 + .long 0x447c0000 + .long 0x447dc000 + .long 0x447fc000 + .long 0x4480c000 + .long 0x4481c000 + .long 0x4482a000 + .long 0x4483a000 + .long 0x44848000 + .long 0x44858000 + .long 0x44866000 + .long 0x44876000 + .long 0x44884000 + .long 0x44894000 + .long 0x448a2000 + .long 0x448b2000 + .long 0x448c0000 + .long 0x448d0000 + .long 0x448e0000 + .long 0x448ee000 + .long 0x448fe000 + .long 0x4490c000 + .long 0x4491c000 + .long 0x4492a000 + .long 0x4493a000 + .long 0x44948000 + .long 0x44958000 + .long 0x44968000 + .long 0x44976000 + .long 0x44986000 + .long 0x44994000 + .long 0x449a4000 + .long 0x449b2000 + .long 0x449c2000 + .long 0x449d2000 + .long 0x449e0000 + .long 0x449f0000 + .long 0x449fe000 + .long 0x44a0e000 + .long 0x44a1c000 + .long 0x44a2c000 + .long 0x44a3c000 + .long 0x44a4a000 + .long 0x44a5a000 + .long 0x44a68000 + .long 0x44a78000 + .long 0x44a88000 + .long 0x44a96000 + .long 0x44aa6000 + .long 0x44ab4000 + .long 0x44ac4000 + .long 0x44ad4000 + .long 0x44ae2000 + .long 0x44af2000 + .long 0x44b00000 + .long 0x44b10000 + .long 0x44b20000 + .long 0x44b2e000 + .long 0x44b3e000 + .long 0x44b4c000 + .long 0x44b5c000 + .long 0x44b6c000 + .long 0x44b7a000 + .long 0x44b8a000 + .long 0x44b9a000 + .long 0x44ba8000 + .long 0x44bb8000 + .long 0x44bc6000 + .long 0x44bd6000 + .long 0x44be6000 + .long 0x44bf4000 + .long 0x44c04000 + .long 0x44c14000 + .long 0x44c22000 + .long 0x44c32000 + .long 0x44c40000 + .long 0x44c50000 + .long 0x44c60000 + .long 0x44c6e000 + .long 0x44c7e000 + .long 0x44c8e000 + .long 0x44c9c000 + .long 0x44cac000 + .long 0x44cba000 + .long 0x44cca000 + .long 0x44cda000 + .long 0x44ce8000 + .long 0x44cf8000 + .long 0x44d08000 + .long 0x44d16000 + .long 0x44d26000 + .long 0x44d36000 + .long 0x44d44000 + .long 0x44d54000 + .long 0x44d64000 + .long 0x44d72000 + .long 0x44d82000 + .long 0x44d92000 + .long 0x44da0000 + .long 0x44db0000 + .long 0x44dc0000 + .long 0x44dce000 + .long 0x44dde000 + .long 0x44dec000 + .long 0x44dfc000 + .long 0x44e0c000 + .long 0x44e1a000 + .long 0x44e2a000 + .long 0x44e3a000 + .long 0x44e48000 + .long 0x44e58000 + .long 0x44e68000 + .long 0x44e76000 + .long 0x44e86000 + .long 0x44e96000 + .long 0x44ea4000 + .long 0x44eb4000 + .long 0x44ec4000 + .long 0x44ed4000 + .long 0x44ee2000 + .long 0x44ef2000 + .long 0x44f02000 + .long 0x44f10000 + .long 0x44f20000 + .long 0x44f30000 + .long 0x44f3e000 + .long 0x44f4e000 + .long 0x44f5e000 + .long 0x44f6c000 + .long 0x44f7c000 + .long 0x44f8c000 + .long 0x44f9a000 + .long 0x44faa000 + .long 0x44fba000 + .long 0x44fc8000 + .long 0x44fd8000 + .long 0x44fe8000 + .long 0x44ff6000 + .long 0x45003000 + .long 0x4500b000 + .long 0x45013000 + .long 0x4501a000 + .long 0x45022000 + .long 0x4502a000 + .long 0x45031000 + .long 0x45039000 + .long 0x45041000 + .long 0x45048000 + .long 0x45050000 + .long 0x45058000 + .long 0x4505f000 + .long 0x45067000 + .long 0x4506f000 + .long 0x45077000 + .long 0x4507e000 + .long 0x45086000 + .long 0x4508e000 + .long 0x45095000 + .long 0x4509d000 + .long 0x450a5000 + .long 0x450ac000 + .long 0x450b4000 + .long 0x450bc000 + .long 0x450c4000 + .long 0x450cb000 + .long 0x450d3000 + .long 0x450db000 + .long 0x450e2000 + .long 0x450ea000 + .type function_zeros,@object + .size function_zeros,1284 + .align 4 +_val_0_6: + .long 858993459 + .long 1071854387 + .type _val_0_6,@object + .size _val_0_6,8 + .align 4 +_val_2_0: + .long 0 + .long 1073741824 + .type _val_2_0,@object + .size _val_2_0,8 + .align 4 +_TWO_19H: + .long 0 + .long 1093140480 + .type _TWO_19H,@object + .size _TWO_19H,8 + .align 4 +_val_4_0: + .long 0 + .long 1074790400 + .type _val_4_0,@object + .size _val_4_0,8 + .align 4 +_val_8_0: + .long 0 + .long 1075838976 + .type _val_8_0,@object + .size _val_8_0,8 + .align 4 +_val_3_0: + .long 0 + .long 1074266112 + .type _val_3_0,@object + .size _val_3_0,8 + .align 4 +_val_5_0: + .long 0 + .long 1075052544 + .type _val_5_0,@object + .size _val_5_0,8 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_val_17_0: + .long 0 + .long 1076953088 + .type _val_17_0,@object + .size _val_17_0,8 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_PP0: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP0,@object + .size _PP0,48 + .align 4 +_PP1: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP1,@object + .size _PP1,48 + .align 4 +_QP0: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP0,@object + .size _QP0,48 + .align 4 +_QP1: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP1,@object + .size _QP1,48 + .data + .hidden __libm_sincos_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/jnl.S b/external/sgx_libm/ia32/jnl.S new file mode 100644 index 0000000000..4879bd4aa8 --- /dev/null +++ b/external/sgx_libm/ia32/jnl.S @@ -0,0 +1,109 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "jnl.c" + .text +..TXTST0: +# -- Begin jnl + .text + .align 16,0x90 + .globl jnl +jnl: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + fldt 12(%ebp) + lea 16(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.6: + addl $-32, %esp + movl 8(%ebp), %ecx + lea 64(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl %ecx, 4(%esp) + movl (%edi), %edx + movl 4(%edi), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 8(%edi), %edx + movl 12(%edi), %ecx + movl %edx, 8(%eax) + movl %ecx, 12(%eax) + call __jnq@PLT +..B1.5: + addl $28, %esp +..B1.2: + movl 32(%esp), %eax + movl %eax, (%edi) + movl 36(%esp), %edx + movl 40(%esp), %ecx + movl 44(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.7: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type jnl,@function + .size jnl,.-jnl + .data +# -- End jnl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/l2q.S b/external/sgx_libm/ia32/l2q.S new file mode 100644 index 0000000000..bd2cb43042 --- /dev/null +++ b/external/sgx_libm/ia32/l2q.S @@ -0,0 +1,109 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "l2q.c" + .text +..TXTST0: +# -- Begin __ltoq + .text + .align 16,0x90 + .globl __ltoq +__ltoq: +# parameter 1: 32 + %esp +# parameter 2: 36 + %esp +..B1.1: +..L1: + + pushl %edi + subl $24, %esp +..B1.2: + fnstcw 12(%esp) +..B1.3: + movzwl 12(%esp), %eax + orl $-64768, %eax + movw %ax, 14(%esp) +..B1.4: + fldcw 14(%esp) +..B1.5: + fldt 36(%esp) + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + fldt __l_one@GOTOFF(%eax) + fmulp %st, %st(1) + fstpt (%esp) +..B1.6: + fldcw 12(%esp) +..B1.7: + movl 32(%esp), %edx + movl (%esp), %ecx + movl %ecx, %edi + shll $17, %edi + movl %edi, 4(%edx) + movl 4(%esp), %edi + movl %edi, %eax + shll $17, %eax + shrl $15, %ecx + shrl $15, %edi + orl %ecx, %eax + movl 8(%esp), %ecx + movzwl %di, %edi + shll $16, %ecx + orl %ecx, %edi + movl $0, (%edx) + movl %eax, 8(%edx) + movl %edi, 12(%edx) + addl $24, %esp + popl %edi + ret + .align 16,0x90 + .type __ltoq,@function + .size __ltoq,.-__ltoq + .data +# -- End __ltoq + .section .rodata, "a" + .align 4 + .align 4 +__l_one: + .long 0 + .long 2147483648 + .long 16383 + .type __l_one,@object + .size __l_one,12 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ldexp_wmt.S b/external/sgx_libm/ia32/ldexp_wmt.S new file mode 100644 index 0000000000..3db7e3e8dd --- /dev/null +++ b/external/sgx_libm/ia32/ldexp_wmt.S @@ -0,0 +1,242 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ldexp_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin ldexp + .text + .align 16,0x90 + .globl ldexp +ldexp: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movq 64(%ebx), %xmm4 + movsd 128(%esp), %xmm0 + movsd %xmm0, 8(%esp) + movl 136(%esp), %ecx + movl $65536, %eax + movl $-65536, %edx + cmpl %eax, %ecx + cmovg %eax, %ecx + cmpl %edx, %ecx + cmovl %edx, %ecx + andpd %xmm0, %xmm4 + xorpd %xmm4, %xmm0 + ucomisd 128(%ebx), %xmm0 + jp .L_2TAG_PACKET_0.0.3 + je .L_2TAG_PACKET_0.0.3 + comisd 80(%ebx), %xmm0 + jc .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + movapd %xmm0, %xmm2 + movapd (%ebx), %xmm3 + psrlq $52, %xmm2 + movd %ecx, %xmm1 + andpd %xmm3, %xmm2 + paddq %xmm1, %xmm2 + movd %xmm2, %eax + movapd 16(%ebx), %xmm3 + testl %eax, %eax + jle .L_2TAG_PACKET_3.0.3 + cmpl $2047, %eax + jge .L_2TAG_PACKET_4.0.3 + andpd %xmm3, %xmm0 + psllq $52, %xmm2 + xorpd %xmm4, %xmm0 + orpd %xmm2, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_0.0.3: + fldl 8(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_1.0.3: + comisd 144(%ebx), %xmm0 + je .L_2TAG_PACKET_0.0.3 + mulsd 96(%ebx), %xmm0 + subl $55, %ecx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $-52, %eax + jl .L_2TAG_PACKET_6.0.3 + xorpd %xmm5, %xmm5 + andpd %xmm3, %xmm0 + shufpd $1, %xmm3, %xmm3 + paddq %xmm3, %xmm2 + xorpd %xmm4, %xmm0 + psllq $52, %xmm2 + orpd %xmm2, %xmm0 + mulsd 112(%ebx), %xmm0 + comisd %xmm5, %xmm0 + je .L_2TAG_PACKET_6.0.3 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_4.0.3: + lea 32(%ebx), %edx + movl $146, %ecx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_6.0.3: + lea 48(%ebx), %edx + movl $147, %ecx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_7.0.3: + pextrw $3, %xmm4, %eax + shrl $12, %eax + addl %edx, %eax + movq (%edx), %xmm0 + mulsd (%eax), %xmm0 + movq %xmm0, (%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %ecx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) +.L_2TAG_PACKET_5.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type ldexp,@function + .size ldexp,.-ldexp + .data +# -- End ldexp + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 2047 + .long 0 + .long 4294967241 + .long 4294967295 + .long 4294967295 + .long 2148532223 + .long 55 + .long 0 + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 1048576 + .long 0 + .long 1048576 + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .long 0 + .long 1015021568 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,160 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ldexpf.S b/external/sgx_libm/ia32/ldexpf.S new file mode 100644 index 0000000000..9cfcd9f517 --- /dev/null +++ b/external/sgx_libm/ia32/ldexpf.S @@ -0,0 +1,202 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ldexpf.c" + .text +..TXTST0: +# -- Begin ldexpf + .text + .align 16,0x90 + .globl ldexpf +ldexpf: +# parameter 1: 16 + %esp +# parameter 2: 20 + %esp +..B1.1: +..L1: + + pushl %ebx + pushl %ebp + pushl %esi + movzwl 18(%esp), %eax + movl %eax, %ecx + andl $32640, %ecx + shrl $7, %ecx + movl 20(%esp), %edx + cmpl $255, %ecx + je ..B1.15 +..B1.2: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + testl %ecx, %ecx + jne ..B1.5 +..B1.3: + testl $8388607, 16(%esp) + je ..B1.9 +..B1.4: + flds 16(%esp) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + fstps 16(%esp) + movzwl 18(%esp), %eax + movl %eax, %ecx + andl $32640, %ecx + shrl $7, %ecx + addl $-25, %ecx +..B1.5: + cmpl $65536, %edx + jle ..L3 + movl $65536, %edx +..L3: + cmpl $-65536, %edx + jg ..L4 + movl $-65536, %edx +..L4: + lea (%ecx,%edx), %ebp + testl %ebp, %ebp + jle ..B1.11 +..B1.6: + cmpl $255, %ebp + jge ..B1.10 +..B1.7: + andl $255, %ebp + andl $-32641, %eax + shll $7, %ebp + orl %ebp, %eax + movw %ax, 18(%esp) + flds 16(%esp) +..B1.8: + popl %ecx + popl %ebp + popl %ebx + ret +..B1.9: + flds 16(%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.10: + movzbl 19(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _large_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.1@GOTOFF(%ebx) + fsts (%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.11: + cmpl $-23, %ebp + jl ..B1.14 +..B1.12: + movl 16(%esp), %eax + lea 25(%ecx,%edx), %edx + movl %eax, (%esp) + shrl $16, %eax + movzbl %dl, %edx + andl $-32641, %eax + shll $7, %edx + orl %edx, %eax + movw %ax, 2(%esp) + flds (%esp) + fmuls .L_2il0floatpacket.3@GOTOFF(%ebx) + fsts (%esp) +..B1.13: + popl %ecx + popl %ebp + popl %ebx + ret +..B1.14: + movzbl 19(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _small_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.2@GOTOFF(%ebx) + fsts (%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.15: + flds 16(%esp) + popl %ecx + popl %ebp + popl %ebx + ret + .align 16,0x90 + .type ldexpf,@function + .size ldexpf,.-ldexpf + .data +# -- End ldexpf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x0d800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x33000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ldexpl.S b/external/sgx_libm/ia32/ldexpl.S new file mode 100644 index 0000000000..dffdf3c60b --- /dev/null +++ b/external/sgx_libm/ia32/ldexpl.S @@ -0,0 +1,337 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ldexpl.c" + .text +..TXTST0: +# -- Begin ldexpl + .text + .align 16,0x90 + .globl ldexpl +ldexpl: +# parameter 1: 32 + %esp +# parameter 2: 44 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + pushl %ebp + subl $16, %esp + movl 44(%esp), %ebx +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 40(%esp), %eax + movl %eax, %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %ebp + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebp), %ebp + cmpl $32767, %ecx + je ..B1.43 +..B1.4: + testl %ecx, %ecx + jne ..B1.14 +..B1.5: + cmpl $0, 36(%esp) + jne ..B1.8 +..B1.6: + cmpl $0, 32(%esp) + jne ..B1.8 +..B1.7: + fldt 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.8: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.42 +..B1.9: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + fldt 32(%esp) + fmull _TWO_75@GOTOFF(%ebp) + fstpt 32(%esp) +..B1.12: + fldcw 14(%esp) +..B1.13: + movzwl 40(%esp), %eax + movl %eax, %ecx + andl $32767, %ecx + addl $-75, %ecx +..B1.14: + cmpl $65536, %ebx + jle ..L3 + movl $65536, %ebx +..L3: + cmpl $-65536, %ebx + jg ..L4 + movl $-65536, %ebx +..L4: + lea (%ecx,%ebx), %edi + testl %edi, %edi + jle ..B1.25 +..B1.15: + cmpl $32767, %edi + jge ..B1.17 +..B1.16: + andl $-32768, %eax + andl $32767, %edi + orl %edi, %eax + movw %ax, 40(%esp) + fldt 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.17: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.24 +..B1.18: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.19: + fldcw 12(%esp) +..B1.20: + movl $1, %ebx +..B1.21: + fldt _large_value_80@GOTOFF(%ebp) + movzbl 41(%esp), %edx + andl $128, %edx + shrl $7, %edx + testl %ebx, %ebx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebp,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.23 +..B1.22: + fldcw 14(%esp) +..B1.23: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.24: + xorl %ebx, %ebx + jmp ..B1.21 +..B1.25: + movzwl 14(%esp), %edx + cmpl $-63, %edi + jl ..B1.34 +..B1.26: + movl %edx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.33 +..B1.27: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.28: + fldcw 12(%esp) +..B1.29: + movzwl 40(%esp), %eax + movl $1, %edi +..B1.30: + fldt 32(%esp) + lea 75(%ecx,%ebx), %edx + andl $-32768, %eax + andl $32767, %edx + fstpt (%esp) + orl %edx, %eax + movw %ax, 8(%esp) + testl %edi, %edi + fldt (%esp) + fmull 8+_TWO_75@GOTOFF(%ebp) + fstpt (%esp) + je ..B1.32 +..B1.31: + fldcw 14(%esp) +..B1.32: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.33: + xorl %edi, %edi + jmp ..B1.30 +..B1.34: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.41 +..B1.35: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.36: + fldcw 12(%esp) +..B1.37: + movl $1, %ebx +..B1.38: + fldt _small_value_80@GOTOFF(%ebp) + movzbl 41(%esp), %edx + andl $128, %edx + shrl $7, %edx + testl %ebx, %ebx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebp,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.41: + xorl %ebx, %ebx + jmp ..B1.38 +..B1.42: + fldt 32(%esp) + fmull _TWO_75@GOTOFF(%ebp) + fstpt 32(%esp) + jmp ..B1.13 +..B1.43: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.49 +..B1.44: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.45: + fldcw 12(%esp) +..B1.46: + fldt 32(%esp) + fmull _ones@GOTOFF(%ebp) + fstpt (%esp) +..B1.47: + fldcw 14(%esp) +..B1.48: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.49: + fldt 32(%esp) + fmull _ones@GOTOFF(%ebp) + fstpt (%esp) + jmp ..B1.48 + .align 16,0x90 + .type ldexpl,@function + .size ldexpl,.-ldexpl + .data +# -- End ldexpl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lgamma.S b/external/sgx_libm/ia32/lgamma.S new file mode 100644 index 0000000000..ef07e0fff1 --- /dev/null +++ b/external/sgx_libm/ia32/lgamma.S @@ -0,0 +1,6404 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lgamma.c" + .text +..TXTST0: +# -- Begin lgamma + .text + .align 16,0x90 + .globl lgamma +lgamma: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + subl $28, %esp + fldl 32(%esp) + lea 16(%esp), %eax + fstpl (%esp) + movl %eax, 8(%esp) + call __libm_lgamma +..B1.2: + addl $28, %esp + ret + .align 16,0x90 + .type lgamma,@function + .size lgamma,.-lgamma + .data +# -- End lgamma + .text +# -- Begin __libm_lgamma + .text + .align 16,0x90 +__libm_lgamma: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L2: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl 16(%ebp), %eax + movzwl 14(%ebp), %ecx + andl $32752, %ecx + movl %eax, 16(%esp) + shrl $4, %ecx + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 144(%esp) + movl 12(%ebp), %eax + movzbl 15(%ebp), %edx + andl $1048575, %eax + movl %ecx, 4(%esp) + andl $128, %edx + shll $20, %ecx + shrl $7, %edx + orl %eax, %ecx + movl %ecx, 12(%esp) + movl %edx, (%esp) +..B2.2: + fnstcw 46(%esp) +..B2.3: + call fegetround +..B2.208: + movl %eax, 28(%esp) +..B2.4: + cmpl $0, 28(%esp) + jne ..B2.6 +..B2.5: + xorl %edi, %edi + jmp ..B2.8 +..B2.6: + addl $-16, %esp + movl $0, (%esp) + call fesetround +..B2.209: + addl $16, %esp +..B2.7: + movl $1, %edi +..B2.8: + movzwl 46(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.205 +..B2.9: + orl $-64768, %edx + movw %dx, 44(%esp) +..B2.10: + fldcw 44(%esp) +..B2.11: + movl $1, %esi +..B2.12: + call ..L3 +..L3: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L3](%ebx), %ebx + cmpl $2047, 4(%esp) + jne ..B2.19 +..B2.13: + movl 16(%esp), %eax + testl %esi, %esi + movl $1, (%eax) + je ..B2.15 +..B2.14: + fldcw 46(%esp) +..B2.15: + testl %edi, %edi + je ..B2.17 +..B2.16: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.210: + addl $16, %esp +..B2.17: + fldl 8(%ebp) + movl 144(%esp), %eax + xorl %esp, %eax + fmul %st(0), %st + cmpl %gs:20, %eax + jne ..B2.99 +..B2.18: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.19: + cmpl $0, 4(%esp) + jne ..B2.24 +..B2.20: + testl $1048575, 12(%ebp) + jne ..B2.24 +..B2.21: + cmpl $0, 8(%ebp) + je ..B2.100 +..B2.24: + movl 16(%esp), %eax + movl $1, (%eax) +..B2.25: + cmpl $0, (%esp) + je ..B2.126 +..B2.26: + fldl 8(%ebp) + addl $-16, %esp + fstpl (%esp) + call nearbyint@PLT +..B2.211: + fldl 8(%ebp) + addl $16, %esp + fxch %st(1) + fstpl 112(%esp) + fldl 112(%esp) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.27 + je ..B2.119 +..B2.27: + fldl .L_2il0floatpacket.0@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jae ..B2.244 + jp ..B2.244 +..B2.28: + fld %st(1) + frndint + fcom %st(2) + fnstsw %ax + sahf + jnb ..L4 + fld1 + faddp %st, %st(1) +..L4: + fstpl 112(%esp) + fldl 112(%esp) + faddp %st, %st(1) + fstpl 112(%esp) + testb $1, 112(%esp) + jne ..B2.31 +..B2.29: + movl 16(%esp), %eax + movl $-1, (%eax) + jmp ..B2.31 +..B2.244: + fstp %st(0) +..B2.31: + cmpl $1073741824, 12(%esp) + jae ..B2.43 +..B2.32: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.111 +..B2.33: + fld %st(0) +..B2.34: + fmul %st(2), %st + fxch %st(1) + fadd %st, %st(2) + fcom %st(2) + fnstsw %ax + sahf + fxch %st(1) + ja ..B2.34 +..B2.35: + fstp %st(1) + fstpt 72(%esp) +..B2.36: + andb $127, 81(%esp) + addl $-16, %esp + fldt 88(%esp) + fstpt (%esp) + fstpt 104(%esp) + call logl@PLT +..B2.213: + fldt 104(%esp) + addl $16, %esp + fxch %st(1) + fstpt 72(%esp) + fldt 72(%esp) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fstpt 16(%esp) + call lgamma_pos +..B2.212: + fldt 16(%esp) + addl $16, %esp + testl %edi, %edi + je ..B2.39 +..B2.37: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.214: + fldt 16(%esp) + addl $16, %esp +..B2.38: + fldt 72(%esp) +..B2.39: + testl %esi, %esi + fsubrp %st, %st(1) + fstpl 112(%esp) + je ..B2.41 +..B2.40: + fldcw 46(%esp) +..B2.41: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.42: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.43: + cmpl $1076756480, 12(%esp) + jae ..B2.73 +..B2.44: + fldl _TWO_52H@GOTOFF(%ebx) + fld %st(1) + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + fxch %st(1) + faddl .L_2il0floatpacket.3@GOTOFF(%ebx) + fstpl 64(%esp) + fldl 64(%esp) + fsubr %st(2), %st + fstpl 112(%esp) + fldl 112(%esp) + movl 112(%esp), %ecx + fsubp %st, %st(2) + fxch %st(1) + fstpl 112(%esp) + lea 1(%ecx), %edx + fldl 112(%esp) + fldl 64(%esp) + faddp %st, %st(1) + fcompp + fnstsw %ax + sahf + jp ..L6 + jb ..L5 +..L6: + movl %ecx, %edx +..L5: + lea (%edx,%edx,2), %ecx + fcoml _LRIB@GOTOFF(%ebx,%ecx,8) + fnstsw %ax + sahf + jbe ..B2.53 +..B2.45: + fldl 16+_LRIB@GOTOFF(%ebx,%ecx,8) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.53 +..B2.46: + fldl _LRP16@GOTOFF(%ebx,%edx,8) + fxch %st(1) + fsubl 8+_LRIB@GOTOFF(%ebx,%ecx,8) + shll $6, %ecx + fld %st(0) + testl %edi, %edi + fmul %st(1), %st + fmul %st, %st(2) + fldt 64+_LRP@GOTOFF(%ecx,%ebx) + fldt 32+_LRP@GOTOFF(%ecx,%ebx) + fldt _LRP@GOTOFF(%ecx,%ebx) + fldt 48+_LRP@GOTOFF(%ecx,%ebx) + fldt 16+_LRP@GOTOFF(%ecx,%ebx) + fxch %st(7) + faddl 152+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(5), %st + faddl 136+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(5), %st + faddl 120+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(5), %st + faddl 104+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(5), %st + faddl 88+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fldl 160+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(3), %st + faddl 144+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(3), %st + faddl 128+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(3), %st + faddl 112+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(3), %st + faddl 96+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(3), %st + faddl 80+_LRP@GOTOFF(%ecx,%ebx) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + je ..B2.49 +..B2.47: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.215: + addl $16, %esp +..B2.48: + fldt 72(%esp) +..B2.49: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstpl 112(%esp) + je ..B2.51 +..B2.50: + fldcw 46(%esp) +..B2.51: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.52: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.53: + fcoml _RRIB@GOTOFF(%ebx,%ecx,8) + fnstsw %ax + sahf + jbe ..B2.62 +..B2.54: + fldl 16+_RRIB@GOTOFF(%ebx,%ecx,8) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.62 +..B2.55: + fsubl 8+_RRIB@GOTOFF(%ebx,%ecx,8) + fld %st(0) + lea (%edx,%edx,4), %eax + shll $5, %eax + fmul %st(1), %st + testl %edi, %edi + fldl 72+_RRP@GOTOFF(%eax,%ebx) + fmul %st(1), %st + fldt 32+_RRP@GOTOFF(%eax,%ebx) + fldt _RRP@GOTOFF(%eax,%ebx) + fldl 64+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 120+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 112+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 88+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 80+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 136+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 128+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 104+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 96+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + fxch %st(3) + faddl 152+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fldt 48+_RRP@GOTOFF(%eax,%ebx) + fldt 16+_RRP@GOTOFF(%eax,%ebx) + fxch %st(3) + faddl 144+_RRP@GOTOFF(%eax,%ebx) + fmul %st(4), %st + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fstpt (%esp) + je ..B2.58 +..B2.56: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.216: + addl $16, %esp +..B2.57: + fldt 72(%esp) +..B2.58: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstpl 112(%esp) + je ..B2.60 +..B2.59: + fldcw 46(%esp) +..B2.60: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.61: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.62: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.115 +..B2.63: + fld %st(0) +..B2.64: + fmul %st(2), %st + fxch %st(1) + fadd %st, %st(2) + fcom %st(2) + fnstsw %ax + sahf + fxch %st(1) + ja ..B2.64 +..B2.65: + fstp %st(1) + fstpt 72(%esp) +..B2.66: + andb $127, 81(%esp) + addl $-16, %esp + fldt 88(%esp) + fstpt (%esp) + fstpt 104(%esp) + call logl@PLT +..B2.218: + fldt 104(%esp) + addl $16, %esp + fxch %st(1) + fstpt 72(%esp) + fldt 72(%esp) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fstpt 16(%esp) + call lgamma_pos +..B2.217: + fldt 16(%esp) + addl $16, %esp + testl %edi, %edi + je ..B2.69 +..B2.67: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.219: + fldt 16(%esp) + addl $16, %esp +..B2.68: + fldt 72(%esp) +..B2.69: + testl %esi, %esi + fsubrp %st, %st(1) + fstpl 112(%esp) + je ..B2.71 +..B2.70: + fldcw 46(%esp) +..B2.71: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.72: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.73: + cmpl $1076953088, 12(%esp) + jae ..B2.84 +..B2.74: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fstpt 120(%esp) + fldt 120(%esp) + fcom %st(1) + fnstsw %ax + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + fstpt 132(%esp) + fldt 132(%esp) + sahf + jbe ..B2.245 +..B2.75: + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + fstpt 16(%esp) + fstpt (%esp) + .align 16,0x90 +..B2.76: + fldt (%esp) + fstp %st(0) + fld %st(1) + fxch %st(2) + fldt 16(%esp) + fld %st(0) + fmul %st(2), %st + fadd %st, %st(4) + fxch %st(4) + fstpt 100(%esp) + fldt 100(%esp) + fsubp %st, %st(4) + fld %st(1) + fsub %st(4), %st + fxch %st(2) + fadd %st(3), %st + fcom %st(3) + fnstsw %ax + fldt 120(%esp) + fmul %st, %st(2) + fld %st(0) + sahf + fadd %st(3), %st + fstpt 100(%esp) + fldt 132(%esp) + fldt 100(%esp) + fsubp %st, %st(4) + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(1), %st + fld %st(6) + fmul %st(4), %st + fxch %st(2) + fmulp %st, %st(7) + faddp %st, %st(6) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fstpt 120(%esp) + fldt 120(%esp) + fsubp %st, %st(2) + fxch %st(3) + fsubp %st, %st(1) + fstpt 132(%esp) + jp ..B2.77 + jb ..B2.76 +..B2.77: + fstp %st(0) +..B2.78: + andb $127, 129(%esp) + addl $-16, %esp + fldt 136(%esp) + fstpt (%esp) + fstpt 104(%esp) + call logl@PLT +..B2.221: + fldt 104(%esp) + fxch %st(1) + fstpt 32(%esp) + fstpt (%esp) + call lgamma_pos +..B2.220: + addl $16, %esp + testl %edi, %edi + je ..B2.80 +..B2.79: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.222: + fldt 16(%esp) + addl $16, %esp +..B2.80: + fldt 16(%esp) + testl %esi, %esi + fsubrp %st, %st(1) + fstpl 112(%esp) + je ..B2.82 +..B2.81: + fldcw 46(%esp) +..B2.82: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.83: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.84: + cmpl $1082130432, 12(%esp) + jb ..B2.92 +..B2.85: + fldt _LN_SQRT_TWO_PI@GOTOFF(%ebx) + fstpt (%esp) + addl $-16, %esp + fld %st(0) + fchs + fstpt (%esp) + fldt (%esp) + fstpt 32(%esp) + fstpt 104(%esp) + fldt 104(%esp) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fsubrp %st, %st(1) + fstpt 64(%esp) + call logl@PLT +..B2.223: + fldt 104(%esp) + fldt 64(%esp) + fmulp %st, %st(2) + fldt 32(%esp) + addl $16, %esp + fldt (%esp) + testl %edi, %edi + fsubrp %st, %st(3) + fxch %st(1) + fsubr %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fdiv %st(1), %st + fld %st(0) + fmul %st(1), %st + fmull _W4@GOTOFF(%ebx) + fldt _W2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl _TWO_52H@GOTOFF(%ebx) + fstl 112(%esp) + fldl 112(%esp) + fsubp %st, %st(2) + fxch %st(1) + fstpl 112(%esp) + fldl 112(%esp) + fsubp %st, %st(1) + fstpl 112(%esp) + fldl 112(%esp) + fsubrp %st, %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fldl _S26@GOTOFF(%ebx) + fmul %st(1), %st + fldt _S10@GOTOFF(%ebx) + fldt _S06@GOTOFF(%ebx) + fldt _S02@GOTOFF(%ebx) + fldl _S28@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl _S22@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl _S24@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl _S18@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl _S20@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl _S14@GOTOFF(%ebx) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(3) + faddl _S16@GOTOFF(%ebx) + fmul %st(1), %st + fldt _S12@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _S08@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _S04@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + je ..B2.88 +..B2.86: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 64(%esp) + call fesetround +..B2.224: + fldt 64(%esp) + addl $16, %esp +..B2.87: + fldt 72(%esp) +..B2.88: + andb $127, 41(%esp) + addl $-16, %esp + fldt 48(%esp) + fstpt (%esp) + fsubrp %st, %st(1) + fstpt 64(%esp) + call logl@PLT +..B2.225: + fldt 64(%esp) + addl $16, %esp + testl %esi, %esi + fsubp %st, %st(1) + fstpl 112(%esp) + je ..B2.90 +..B2.89: + fldcw 46(%esp) +..B2.90: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.91: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.92: + fldl _TWO_52H@GOTOFF(%ebx) + fstl 112(%esp) + fldl 112(%esp) + fsub %st(2), %st + fstpl 112(%esp) + fxch %st(1) + fchs + fldl 112(%esp) + fsubp %st, %st(2) + fxch %st(1) + fstpl 112(%esp) + fldl 112(%esp) + fsubr %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fmul %st(0), %st + fstpt (%esp) + addl $-16, %esp + fstpt (%esp) + call logl@PLT +..B2.227: + fchs + fldl 8(%ebp) + fchs + fstpt (%esp) + fstpt 32(%esp) + call lgamma_pos +..B2.226: + fldt 32(%esp) + addl $16, %esp + fldt (%esp) + testl %edi, %edi + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fldl _S26@GOTOFF(%ebx) + fmul %st(1), %st + fldt _S10@GOTOFF(%ebx) + fldt _S06@GOTOFF(%ebx) + fldt _S02@GOTOFF(%ebx) + fldt _S12@GOTOFF(%ebx) + fxch %st(4) + faddl _S22@GOTOFF(%ebx) + fmul %st(5), %st + faddl _S18@GOTOFF(%ebx) + fmul %st(5), %st + faddl _S14@GOTOFF(%ebx) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(4) + fldl _S28@GOTOFF(%ebx) + fmul %st(2), %st + fldt _S08@GOTOFF(%ebx) + fldt _S04@GOTOFF(%ebx) + fxch %st(2) + faddl _S24@GOTOFF(%ebx) + fmul %st(4), %st + faddl _S20@GOTOFF(%ebx) + fmul %st(4), %st + faddl _S16@GOTOFF(%ebx) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 72(%esp) + fldt 72(%esp) + je ..B2.95 +..B2.93: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 32(%esp) + call fesetround +..B2.228: + fldt 32(%esp) + addl $16, %esp +..B2.94: + fldt 72(%esp) +..B2.95: + andb $127, 41(%esp) + addl $-16, %esp + fldt 48(%esp) + fstpt (%esp) + fsubrp %st, %st(1) + fstpt 32(%esp) + call logl@PLT +..B2.229: + fldt 32(%esp) + addl $16, %esp + testl %esi, %esi + fsubp %st, %st(1) + fstpl 112(%esp) + je ..B2.97 +..B2.96: + fldcw 46(%esp) +..B2.97: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.98: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.99: + fstp %st(0) + call __stack_chk_fail@PLT +..B2.100: + cmpl $0, (%esp) + je ..B2.102 +..B2.101: + movl 16(%esp), %eax + movl $-1, (%eax) + jmp ..B2.103 +..B2.102: + movl 16(%esp), %eax + movl $1, (%eax) +..B2.103: + testl %edi, %edi + je ..B2.105 +..B2.104: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.230: + addl $16, %esp +..B2.105: + fld1 + fldz + testl %esi, %esi + fstpl 112(%esp) + fldl 112(%esp) + fdivrp %st, %st(1) + fstpl 112(%esp) + je ..B2.107 +..B2.106: + fldcw 46(%esp) +..B2.107: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 + jmp ..B2.18 +..B2.111: + fstpt 72(%esp) + jmp ..B2.36 +..B2.115: + fstpt 72(%esp) + jmp ..B2.66 +..B2.119: + fstp %st(0) + testl %edi, %edi + je ..B2.121 +..B2.120: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.231: + addl $16, %esp +..B2.121: + fld1 + fldz + testl %esi, %esi + fstpl 112(%esp) + fldl 112(%esp) + fdivrp %st, %st(1) + fstpl 112(%esp) + je ..B2.123 +..B2.122: + fldcw 46(%esp) +..B2.123: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 + jmp ..B2.18 +..B2.126: + movzwl 14(%ebp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2037, %eax + jg ..B2.198 +..B2.127: + je ..B2.195 +..B2.128: + fldl 8(%ebp) + fld1 + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.129 + je ..B2.188 +..B2.129: + cmpl $1032, 4(%esp) + jb ..B2.136 +..B2.130: + fldt _LN_SQRT_TWO_PI@GOTOFF(%ebx) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fsubr %st(2), %st + fstpt (%esp) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fxch %st(1) + fstpt 48(%esp) + fstpt 32(%esp) + call logl@PLT +..B2.232: + fldt 32(%esp) + fldt 48(%esp) + addl $16, %esp + fldt (%esp) + testl %edi, %edi + fmulp %st, %st(3) + faddp %st, %st(2) + fsubr %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fdivp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fmull _W4@GOTOFF(%ebx) + fldt _W2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + je ..B2.132 +..B2.131: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 48(%esp) + call fesetround +..B2.233: + fldt 48(%esp) + fldt 16(%esp) + addl $16, %esp +..B2.132: + testl %esi, %esi + faddp %st, %st(1) + fstpl 112(%esp) + je ..B2.134 +..B2.133: + fldcw 46(%esp) +..B2.134: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.135: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.136: + cmpl $1025, 4(%esp) + jb ..B2.143 +..B2.137: + movl 4(%esp), %eax + fsubl -8200+_A@GOTOFF(%ebx,%eax,8) + fmull -8200+_B@GOTOFF(%ebx,%eax,8) + lea -9225(%eax,%eax,8), %edx + shll $5, %edx + fld %st(0) + fmul %st(1), %st + testl %edi, %edi + fldt 12+_C5@GOTOFF(%edx,%ebx) + fmul %st(2), %st + fadd %st(1), %st + fldt _C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fldt 36+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 24+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 60+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 48+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 84+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 72+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 108+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 96+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 132+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 120+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 156+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 144+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 180+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 168+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 204+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 192+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 228+_C5@GOTOFF(%edx,%ebx) + fmul %st(3), %st + fadd %st(2), %st + fldt 216+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 252+_C5@GOTOFF(%edx,%ebx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 240+_C5@GOTOFF(%edx,%ebx) + faddp %st, %st(1) + fmul %st, %st(1) + fxch %st(1) + fstpt 8(%esp) + fstpt 72(%esp) + je ..B2.139 +..B2.138: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + movl %edx, 16(%esp) + call fesetround +..B2.234: + movl 16(%esp), %edx + addl $16, %esp +..B2.139: + fldt 264+_C5@GOTOFF(%edx,%ebx) + testl %esi, %esi + fldt 8(%esp) + fmulp %st, %st(1) + fstpl 112(%esp) + je ..B2.141 +..B2.140: + fldcw 46(%esp) +..B2.141: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.142: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.143: + cmpl $1073872896, 12(%esp) + jb ..B2.150 +..B2.144: + fldt 12+_C4@GOTOFF(%ebx) + testl %edi, %edi + fmul %st(1), %st + fld %st(1) + fmul %st(2), %st + fadd %st, %st(1) + fldt _C4@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 36+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 24+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 60+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 48+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 84+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 72+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 108+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 96+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 132+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 120+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 156+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 144+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 180+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 168+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 204+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 192+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 228+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st(1), %st + fldt 216+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 252+_C4@GOTOFF(%ebx) + fmul %st(3), %st + faddp %st, %st(1) + fldt 240+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st, %st(1) + fstpt 72(%esp) + fldt 264+_C4@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B2.146 +..B2.145: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + fstpt 32(%esp) + call fesetround +..B2.235: + fldt 32(%esp) + addl $16, %esp +..B2.146: + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + testl %esi, %esi + fsubrp %st, %st(1) + fldt (%esp) + fmulp %st, %st(1) + fstpl 112(%esp) + je ..B2.148 +..B2.147: + fldcw 46(%esp) +..B2.148: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.149: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.150: + cmpl $1073479680, 12(%esp) + jb ..B2.158 +..B2.151: + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + testl %edi, %edi + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 168+_C3@GOTOFF(%ebx) + fmul %st(1), %st + fldl 160+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 152+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 144+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 136+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 128+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 120+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 112+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 104+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 96+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 88+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 80+_C3@GOTOFF(%ebx) + fmul %st(2), %st + fldt 64+_C3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 32+_C3@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _C3@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + fstpt 72(%esp) + fldt 72(%esp) + fldt 48+_C3@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 16+_C3@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + je ..B2.154 +..B2.152: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.236: + addl $16, %esp +..B2.153: + fldt 72(%esp) +..B2.154: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstpl 112(%esp) + je ..B2.156 +..B2.155: + fldcw 46(%esp) +..B2.156: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.157: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.158: + cmpl $1072955392, 12(%esp) + jb ..B2.166 +..B2.159: + fldt _LM@GOTOFF(%ebx) + testl %edi, %edi + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 184+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(1), %st + fldt 80+_LGAMMA_C2@GOTOFF(%ebx) + fldt 48+_LGAMMA_C2@GOTOFF(%ebx) + fldt 16+_LGAMMA_C2@GOTOFF(%ebx) + fldt 32+_LGAMMA_C2@GOTOFF(%ebx) + fldt _LGAMMA_C2@GOTOFF(%ebx) + fxch %st(5) + faddl 168+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(6), %st + faddl 152+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(6), %st + faddl 136+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(6), %st + faddl 120+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(6), %st + faddl 104+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fmulp %st, %st(4) + fxch %st(3) + fstpt 72(%esp) + fldt 72(%esp) + fldl 176+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(3), %st + fldt 64+_LGAMMA_C2@GOTOFF(%ebx) + fxch %st(1) + faddl 160+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(4), %st + faddl 144+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(4), %st + faddl 128+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(4), %st + faddl 112+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(4), %st + faddl 96+_LGAMMA_C2@GOTOFF(%ebx) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + je ..B2.162 +..B2.160: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.237: + addl $16, %esp +..B2.161: + fldt 72(%esp) +..B2.162: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstpl 112(%esp) + je ..B2.164 +..B2.163: + fldcw 46(%esp) +..B2.164: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.165: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.166: + cmpl $1072431104, 12(%esp) + jb ..B2.174 +..B2.167: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + testl %edi, %edi + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 168+_C1@GOTOFF(%ebx) + fmul %st(1), %st + fldl 160+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 152+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 144+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 136+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 128+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 120+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 112+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 104+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 96+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 88+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 80+_C1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 64+_C1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 32+_C1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _C1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + fstpt 72(%esp) + fldt 72(%esp) + fldt 48+_C1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 16+_C1@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + je ..B2.170 +..B2.168: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.238: + addl $16, %esp +..B2.169: + fldt 72(%esp) +..B2.170: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstpl 112(%esp) + je ..B2.172 +..B2.171: + fldcw 46(%esp) +..B2.172: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.173: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.174: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + addl $-16, %esp + fadd %st(1), %st + fstpt (%esp) + fstpt 32(%esp) + call lgamma_pos +..B2.240: + fldt 32(%esp) + fxch %st(1) + fstpt 16(%esp) + fstpt (%esp) + call logl@PLT +..B2.239: + addl $16, %esp + fstpt 72(%esp) + fldt 72(%esp) + testl %edi, %edi + je ..B2.177 +..B2.175: + fstp %st(0) + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.241: + addl $16, %esp +..B2.176: + fldt 72(%esp) +..B2.177: + fldt (%esp) + testl %esi, %esi + fsubp %st, %st(1) + fstpl 112(%esp) + je ..B2.179 +..B2.178: + fldcw 46(%esp) +..B2.179: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 +..B2.180: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.188: + fstp %st(0) + testl %esi, %esi + je ..B2.190 +..B2.189: + fldcw 46(%esp) +..B2.190: + testl %edi, %edi + je ..B2.192 +..B2.191: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.242: + addl $16, %esp +..B2.192: + movl 144(%esp), %eax + fldz + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 + jmp ..B2.18 +..B2.195: + movl 12(%ebp), %eax + andl $1048575, %eax + cmpl $480473, %eax + jg ..B2.198 +..B2.196: + jne ..B2.128 +..B2.197: + cmpl $663441831, 8(%ebp) + jbe ..B2.128 +..B2.198: + testl %edi, %edi + je ..B2.200 +..B2.199: + addl $-16, %esp + movl 44(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.243: + addl $16, %esp +..B2.200: + fldl _PBIG@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(0), %st + fstpl 112(%esp) + je ..B2.202 +..B2.201: + fldcw 46(%esp) +..B2.202: + fldl 112(%esp) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.99 + jmp ..B2.18 +..B2.205: + xorl %esi, %esi + jmp ..B2.12 +..B2.245: + fstp %st(1) + fstp %st(0) + jmp ..B2.78 + .align 16,0x90 + .type __libm_lgamma,@function + .size __libm_lgamma,.-__libm_lgamma + .data +# -- End __libm_lgamma + .text +# -- Begin lgamma_pos + .text + .align 16,0x90 +lgamma_pos: +# parameter 1: 8 + %ebp +..B3.1: +..L7: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + fldt 8(%ebp) + fstl (%esp) + movzwl 6(%esp), %ecx + andl $32752, %ecx + shrl $4, %ecx + movl 4(%esp), %edx + shll $20, %ecx + andl $1048575, %edx + orl %edx, %ecx + call ..L8 +..L8: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L8](%eax), %eax + cmpl $1074790400, %ecx + jb ..B3.3 +..B3.2: + addl $-1074790400, %ecx + sarl $20, %ecx + fldl _A@GOTOFF(%eax,%ecx,8) + lea (%ecx,%ecx,8), %edx + shll $5, %edx + fsubrp %st, %st(1) + fmull _B@GOTOFF(%eax,%ecx,8) + fld %st(0) + fmul %st(1), %st + fldt 12+_C5@GOTOFF(%eax,%edx) + fmul %st(2), %st + fadd %st(1), %st + fldt 36+_C5@GOTOFF(%eax,%edx) + fmul %st(3), %st + fadd %st(2), %st + fldt 24+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fldt 60+_C5@GOTOFF(%eax,%edx) + fmul %st(4), %st + fadd %st(3), %st + fldt 48+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fldt 84+_C5@GOTOFF(%eax,%edx) + fmul %st(5), %st + fadd %st(4), %st + fldt 108+_C5@GOTOFF(%eax,%edx) + fmul %st(6), %st + fadd %st(5), %st + fldt _C5@GOTOFF(%edx,%eax) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fldt 72+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 96+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 132+_C5@GOTOFF(%eax,%edx) + fmul %st(3), %st + fadd %st(2), %st + fldt 120+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 156+_C5@GOTOFF(%eax,%edx) + fmul %st(3), %st + fadd %st(2), %st + fldt 144+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 180+_C5@GOTOFF(%eax,%edx) + fmul %st(3), %st + fadd %st(2), %st + fldt 168+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 204+_C5@GOTOFF(%eax,%edx) + fmul %st(3), %st + fadd %st(2), %st + fldt 192+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 228+_C5@GOTOFF(%eax,%edx) + fmul %st(3), %st + fadd %st(2), %st + fldt 216+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 252+_C5@GOTOFF(%eax,%edx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 240+_C5@GOTOFF(%eax,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 264+_C5@GOTOFF(%eax,%edx) + fmulp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.3: + cmpl $1073872896, %ecx + jb ..B3.5 +..B3.4: + fldt 12+_C4@GOTOFF(%eax) + fmul %st(1), %st + fld %st(1) + fmul %st(2), %st + fadd %st, %st(1) + fldt _C4@GOTOFF(%eax) + faddp %st, %st(2) + fldt 36+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 24+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 60+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 48+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 84+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 72+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 108+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 96+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 132+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 120+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 156+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 144+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 180+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 168+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 204+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 192+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 228+_C4@GOTOFF(%eax) + fmul %st(3), %st + fadd %st(1), %st + fldt 216+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 252+_C4@GOTOFF(%eax) + fmul %st(3), %st + faddp %st, %st(1) + fldt 240+_C4@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 264+_C4@GOTOFF(%eax) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.6@GOTOFF(%eax) + fsubrp %st, %st(2) + fmulp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.5: + cmpl $1073479680, %ecx + jb ..B3.7 +..B3.6: + fldt .L_2il0floatpacket.6@GOTOFF(%eax) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 160+_C3@GOTOFF(%eax) + fmul %st(1), %st + fldt 48+_C3@GOTOFF(%eax) + fldt 16+_C3@GOTOFF(%eax) + fldt 64+_C3@GOTOFF(%eax) + fldt 32+_C3@GOTOFF(%eax) + fldt _C3@GOTOFF(%eax) + fxch %st(5) + faddl 144+_C3@GOTOFF(%eax) + fmul %st(6), %st + faddl 128+_C3@GOTOFF(%eax) + fmul %st(6), %st + faddl 112+_C3@GOTOFF(%eax) + fmul %st(6), %st + faddl 96+_C3@GOTOFF(%eax) + fmul %st(6), %st + faddl 80+_C3@GOTOFF(%eax) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldl 168+_C3@GOTOFF(%eax) + fmul %st(5), %st + faddl 152+_C3@GOTOFF(%eax) + fmul %st(5), %st + faddl 136+_C3@GOTOFF(%eax) + fmul %st(5), %st + faddl 120+_C3@GOTOFF(%eax) + fmul %st(5), %st + faddl 104+_C3@GOTOFF(%eax) + fmul %st(5), %st + faddl 88+_C3@GOTOFF(%eax) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.7: + cmpl $1072955392, %ecx + jb ..B3.9 +..B3.8: + fldt _LM@GOTOFF(%eax) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 176+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(1), %st + fldt 64+_LGAMMA_C2@GOTOFF(%eax) + fldt 32+_LGAMMA_C2@GOTOFF(%eax) + fldt _LGAMMA_C2@GOTOFF(%eax) + fldt 48+_LGAMMA_C2@GOTOFF(%eax) + fldt 80+_LGAMMA_C2@GOTOFF(%eax) + fxch %st(5) + faddl 160+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(6), %st + faddl 144+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(6), %st + faddl 128+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(6), %st + faddl 112+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(6), %st + faddl 96+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fldl 184+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(4), %st + faddl 168+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(4), %st + faddl 152+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(4), %st + faddl 136+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(4), %st + faddl 120+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(4), %st + faddl 104+_LGAMMA_C2@GOTOFF(%eax) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 16+_LGAMMA_C2@GOTOFF(%eax) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.9: + cmpl $1072431104, %ecx + jb ..B3.11 +..B3.10: + fldt .L_2il0floatpacket.1@GOTOFF(%eax) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 160+_C1@GOTOFF(%eax) + fmul %st(1), %st + fldt 48+_C1@GOTOFF(%eax) + fldt 16+_C1@GOTOFF(%eax) + fldt 64+_C1@GOTOFF(%eax) + fldt 32+_C1@GOTOFF(%eax) + fldt _C1@GOTOFF(%eax) + fxch %st(5) + faddl 144+_C1@GOTOFF(%eax) + fmul %st(6), %st + faddl 128+_C1@GOTOFF(%eax) + fmul %st(6), %st + faddl 112+_C1@GOTOFF(%eax) + fmul %st(6), %st + faddl 96+_C1@GOTOFF(%eax) + fmul %st(6), %st + faddl 80+_C1@GOTOFF(%eax) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldl 168+_C1@GOTOFF(%eax) + fmul %st(5), %st + faddl 152+_C1@GOTOFF(%eax) + fmul %st(5), %st + faddl 136+_C1@GOTOFF(%eax) + fmul %st(5), %st + faddl 120+_C1@GOTOFF(%eax) + fmul %st(5), %st + faddl 104+_C1@GOTOFF(%eax) + fmul %st(5), %st + faddl 88+_C1@GOTOFF(%eax) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.11: + fstp %st(0) + fldz +..B3.12: + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type lgamma_pos,@function + .size lgamma_pos,.-lgamma_pos + .data +# -- End lgamma_pos + .text +# -- Begin gamma + .text + .align 16,0x90 + .globl gamma +gamma: +# parameter 1: 32 + %esp +..B4.1: +..L9: + + subl $28, %esp + fldl 32(%esp) + lea 16(%esp), %eax + fstpl (%esp) + movl %eax, 8(%esp) + call __libm_lgamma +..B4.2: + addl $28, %esp + ret + .align 16,0x90 + .type gamma,@function + .size gamma,.-gamma + .data +# -- End gamma + .text +# -- Begin lgamma_r + .text + .align 16,0x90 + .globl lgamma_r +lgamma_r: +# parameter 1: 4 + %esp +# parameter 2: 12 + %esp +..B5.1: +..L10: + + jmp __libm_lgamma + .align 16,0x90 + .type lgamma_r,@function + .size lgamma_r,.-lgamma_r + .data +# -- End lgamma_r + .text +# -- Begin gamma_r + .text + .align 16,0x90 + .globl gamma_r +gamma_r: +# parameter 1: 4 + %esp +# parameter 2: 12 + %esp +..B6.1: +..L11: + + jmp __libm_lgamma + .align 16,0x90 + .type gamma_r,@function + .size gamma_r,.-gamma_r + .data +# -- End gamma_r + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +_LRIB: + .long 3639930760 + .long 3221638968 + .long 169597185 + .long 3221617473 + .long 994230906 + .long 3221595977 + .long 249193764 + .long 3222253755 + .long 1417424869 + .long 3222250609 + .long 2585655974 + .long 3222247463 + .long 679699934 + .long 3222534303 + .long 2054089469 + .long 3222533975 + .long 3428479004 + .long 3222533647 + .long 1666697798 + .long 3222798023 + .long 4119983117 + .long 3222797970 + .long 2278301140 + .long 3222797918 + .long 753528318 + .long 3223060435 + .long 4151019248 + .long 3223060427 + .long 3253542882 + .long 3223060420 + .long 1221915992 + .long 3223322618 + .long 2139183567 + .long 3223322617 + .long 3056451142 + .long 3223322616 + .long 2968798493 + .long 3223453695 + .long 2743618512 + .long 3223453695 + .long 2518438531 + .long 3223453695 + .long 4156721779 + .long 3223584767 + .long 4139833280 + .long 3223584767 + .long 4122944781 + .long 3223584767 + .long 4282834537 + .long 3223715839 + .long 4280864212 + .long 3223715839 + .long 4278893887 + .long 3223715839 + .long 4293918703 + .long 3223846911 + .long 4293792039 + .long 3223846911 + .long 4293665375 + .long 3223846911 + .long 4294888151 + .long 3223977983 + .long 4294876892 + .long 3223977983 + .long 4294865633 + .long 3223977983 + .long 4294961261 + .long 3224109055 + .long 4294960839 + .long 3224109055 + .long 4294960417 + .long 3224109055 + .long 4294966894 + .long 3224240127 + .long 4294966866 + .long 3224240127 + .long 4294966838 + .long 3224240127 + .type _LRIB,@object + .size _LRIB,312 + .space 8, 0x00 # pad + .align 16 +_LRP16: + .long 2378050348 + .long 1101969305 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .type _LRP16,@object + .size _LRP16,104 + .space 8, 0x00 # pad + .align 16 +_LRP: + .word 17751 + .word 54196 + .word 10629 + .word 51164 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 41133 + .word 9612 + .word 27976 + .word 62729 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 42459 + .word 13010 + .word 63969 + .word 39219 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 65437 + .word 25696 + .word 54808 + .word 41154 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 58026 + .word 20377 + .word 22118 + .word 64130 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 35937 + .word 22559 + .word 22660 + .word 49256 + .word 8259 + .word 31940 + .word 14143 + .word 16516 + .word 36722 + .word 48879 + .word 8761 + .word 49313 + .word 17702 + .word 59215 + .word 47717 + .word 16573 + .word 13453 + .word 50588 + .word 11555 + .word 49370 + .word 8896 + .word 4195 + .word 22549 + .word 16631 + .word 8306 + .word 47544 + .word 1832 + .word 49429 + .word 60153 + .word 61869 + .word 6523 + .word 16691 + .word 63612 + .word 2764 + .word 26286 + .word 49489 + .word 63356 + .word 31621 + .word 64278 + .word 16751 + .word 24055 + .word 64192 + .word 21464 + .word 49552 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49769 + .word 49242 + .word 6580 + .word 61152 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 7708 + .word 25266 + .word 60595 + .word 42444 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 45975 + .word 8629 + .word 62832 + .word 64438 + .word 16390 + .word 0 + .word 0 + .word 0 + .word 39855 + .word 22905 + .word 44266 + .word 59689 + .word 49162 + .word 0 + .word 0 + .word 0 + .word 10240 + .word 41089 + .word 5368 + .word 62588 + .word 16398 + .word 0 + .word 0 + .word 0 + .word 3194 + .word 32877 + .word 5879 + .word 49457 + .word 40173 + .word 43959 + .word 59635 + .word 16755 + .word 53371 + .word 1664 + .word 56254 + .word 49591 + .word 34510 + .word 44659 + .word 12150 + .word 16893 + .word 33872 + .word 42862 + .word 8799 + .word 49730 + .word 10662 + .word 44157 + .word 53571 + .word 17030 + .word 55074 + .word 58798 + .word 65525 + .word 49868 + .word 1276 + .word 34610 + .word 36363 + .word 17170 + .word 7041 + .word 29575 + .word 61144 + .word 50007 + .word 19121 + .word 53977 + .word 34010 + .word 17312 + .word 54457 + .word 12310 + .word 48419 + .word 50149 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55737 + .word 12115 + .word 42602 + .word 40775 + .word 16337 + .word 0 + .word 0 + .word 0 + .word 42581 + .word 53029 + .word 20983 + .word 59666 + .word 49157 + .word 0 + .word 0 + .word 0 + .word 24816 + .word 20947 + .word 58172 + .word 55961 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 3130 + .word 13042 + .word 49143 + .word 34463 + .word 49170 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 24697 + .word 14253 + .word 47765 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 32693 + .word 5691 + .word 15709 + .word 49649 + .word 20491 + .word 21402 + .word 35932 + .word 16986 + .word 44071 + .word 16276 + .word 1675 + .word 49861 + .word 13758 + .word 14468 + .word 65445 + .word 17200 + .word 60394 + .word 3375 + .word 60434 + .word 50075 + .word 49748 + .word 2796 + .word 14419 + .word 17415 + .word 61579 + .word 22133 + .word 33066 + .word 50291 + .word 25055 + .word 28661 + .word 31699 + .word 17632 + .word 55823 + .word 18661 + .word 6347 + .word 50508 + .word 58142 + .word 19935 + .word 64799 + .word 17849 + .word 41216 + .word 59562 + .word 42287 + .word 50726 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16006 + .word 65034 + .word 42959 + .word 34185 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 40843 + .word 53953 + .word 46369 + .word 45839 + .word 49160 + .word 0 + .word 0 + .word 0 + .word 54179 + .word 42767 + .word 58812 + .word 64462 + .word 16400 + .word 0 + .word 0 + .word 0 + .word 50676 + .word 3143 + .word 1093 + .word 60276 + .word 49177 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56865 + .word 38982 + .word 63406 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 65273 + .word 45226 + .word 24230 + .word 49857 + .word 23450 + .word 59950 + .word 19796 + .word 17236 + .word 4038 + .word 16755 + .word 26702 + .word 50152 + .word 24087 + .word 51196 + .word 62539 + .word 17533 + .word 25486 + .word 58858 + .word 44079 + .word 50450 + .word 31845 + .word 29909 + .word 37453 + .word 17831 + .word 19699 + .word 12384 + .word 3664 + .word 50750 + .word 26808 + .word 47918 + .word 18611 + .word 18131 + .word 25376 + .word 13791 + .word 62285 + .word 51048 + .word 64886 + .word 33542 + .word 28786 + .word 18433 + .word 54686 + .word 5814 + .word 3500 + .word 51351 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33175 + .word 51870 + .word 55516 + .word 61254 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 3685 + .word 30034 + .word 48430 + .word 40287 + .word 49163 + .word 0 + .word 0 + .word 0 + .word 3323 + .word 33320 + .word 53546 + .word 49572 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 19902 + .word 19517 + .word 60782 + .word 40648 + .word 49186 + .word 0 + .word 0 + .word 0 + .word 28672 + .word 31090 + .word 60187 + .word 37497 + .word 16430 + .word 0 + .word 0 + .word 0 + .word 4362 + .word 57115 + .word 1063 + .word 50082 + .word 17298 + .word 34206 + .word 30558 + .word 17506 + .word 19701 + .word 2977 + .word 30695 + .word 50467 + .word 45209 + .word 25144 + .word 62418 + .word 17892 + .word 6287 + .word 3260 + .word 59477 + .word 50854 + .word 26251 + .word 62311 + .word 23506 + .word 18281 + .word 50215 + .word 3065 + .word 23294 + .word 51244 + .word 519 + .word 28602 + .word 60080 + .word 18671 + .word 56824 + .word 33188 + .word 7096 + .word 51634 + .word 27357 + .word 50961 + .word 5574 + .word 19062 + .word 7770 + .word 52374 + .word 38304 + .word 52025 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33559 + .word 2783 + .word 4720 + .word 38214 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 65291 + .word 24589 + .word 47090 + .word 40315 + .word 49166 + .word 0 + .word 0 + .word 0 + .word 7930 + .word 21505 + .word 15205 + .word 49607 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 61775 + .word 9936 + .word 17817 + .word 40691 + .word 49195 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 37628 + .word 658 + .word 37550 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 14352 + .word 33815 + .word 3114 + .word 50322 + .word 43816 + .word 13363 + .word 33081 + .word 17794 + .word 62601 + .word 27719 + .word 33798 + .word 50803 + .word 1036 + .word 16074 + .word 700 + .word 18277 + .word 33117 + .word 56648 + .word 64173 + .word 51286 + .word 17251 + .word 52492 + .word 29265 + .word 18761 + .word 11155 + .word 27451 + .word 30367 + .word 51772 + .word 7487 + .word 7247 + .word 2371 + .word 19248 + .word 14759 + .word 9929 + .word 13587 + .word 52258 + .word 11730 + .word 26190 + .word 56262 + .word 19733 + .word 56923 + .word 11047 + .word 18072 + .word 52745 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37589 + .word 36570 + .word 62298 + .word 45320 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 17708 + .word 57749 + .word 28642 + .word 45359 + .word 49169 + .word 0 + .word 0 + .word 0 + .word 40067 + .word 38581 + .word 2689 + .word 62790 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 36505 + .word 63458 + .word 34596 + .word 57945 + .word 49204 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 38946 + .word 9029 + .word 60159 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 61014 + .word 7077 + .word 17362 + .word 50576 + .word 11572 + .word 44638 + .word 49972 + .word 18098 + .word 64171 + .word 46242 + .word 17172 + .word 51158 + .word 7607 + .word 1130 + .word 63213 + .word 18682 + .word 20847 + .word 56361 + .word 38627 + .word 51744 + .word 49497 + .word 58620 + .word 43800 + .word 19268 + .word 63056 + .word 11021 + .word 657 + .word 52330 + .word 42127 + .word 49291 + .word 30722 + .word 19856 + .word 13674 + .word 31481 + .word 1908 + .word 52917 + .word 60194 + .word 12516 + .word 3868 + .word 20445 + .word 3386 + .word 31577 + .word 62924 + .word 53506 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44838 + .word 25647 + .word 6736 + .word 62345 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 31560 + .word 12645 + .word 60726 + .word 56699 + .word 49172 + .word 0 + .word 0 + .word 0 + .word 56942 + .word 25011 + .word 17364 + .word 49055 + .word 16425 + .word 0 + .word 0 + .word 0 + .word 3371 + .word 3119 + .word 24466 + .word 56588 + .word 49214 + .word 0 + .word 0 + .word 0 + .word 14336 + .word 15684 + .word 2636 + .word 36719 + .word 16468 + .word 0 + .word 0 + .word 0 + .word 47554 + .word 44810 + .word 53673 + .word 50840 + .word 53371 + .word 50832 + .word 58584 + .word 18417 + .word 46548 + .word 9025 + .word 35353 + .word 51530 + .word 2727 + .word 25780 + .word 5967 + .word 19108 + .word 27113 + .word 1073 + .word 59097 + .word 52222 + .word 11834 + .word 38905 + .word 4058 + .word 19800 + .word 56017 + .word 55971 + .word 60637 + .word 52914 + .word 5287 + .word 8439 + .word 65517 + .word 20493 + .word 37028 + .word 58958 + .word 62480 + .word 53607 + .word 57582 + .word 43721 + .word 1738 + .word 21188 + .word 9819 + .word 37368 + .word 17165 + .word 54304 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13429 + .word 7444 + .word 20593 + .word 34837 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 49742 + .word 37689 + .word 16091 + .word 38981 + .word 49176 + .word 0 + .word 0 + .word 0 + .word 46524 + .word 21314 + .word 39987 + .word 46372 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 14081 + .word 37459 + .word 64348 + .word 36776 + .word 49225 + .word 0 + .word 0 + .word 0 + .word 30720 + .word 57650 + .word 51740 + .word 32812 + .word 16482 + .word 0 + .word 0 + .word 0 + .word 13868 + .word 61714 + .word 32487 + .word 51118 + .word 53288 + .word 8914 + .word 15189 + .word 18750 + .word 25547 + .word 51031 + .word 54157 + .word 51918 + .word 4587 + .word 22569 + .word 2868 + .word 19552 + .word 4628 + .word 56702 + .word 63256 + .word 52720 + .word 60585 + .word 38579 + .word 10763 + .word 20354 + .word 20343 + .word 32825 + .word 42223 + .word 53523 + .word 15259 + .word 21287 + .word 25207 + .word 21157 + .word 19232 + .word 27853 + .word 30722 + .word 54327 + .word 6202 + .word 34921 + .word 46892 + .word 21963 + .word 54314 + .word 63337 + .word 3818 + .word 55135 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12932 + .word 7413 + .word 50416 + .word 52775 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 49070 + .word 42612 + .word 57119 + .word 58471 + .word 49179 + .word 0 + .word 0 + .word 0 + .word 37517 + .word 48554 + .word 12217 + .word 52169 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 3686 + .word 14060 + .word 10284 + .word 62061 + .word 49235 + .word 0 + .word 0 + .word 0 + .word 12288 + .word 36186 + .word 45004 + .word 41528 + .word 16496 + .word 0 + .word 0 + .word 0 + .word 36572 + .word 10708 + .word 62070 + .word 51404 + .word 43863 + .word 23526 + .word 34237 + .word 19093 + .word 49453 + .word 49937 + .word 30100 + .word 52320 + .word 42622 + .word 48103 + .word 45810 + .word 20009 + .word 63343 + .word 18283 + .word 24986 + .word 53236 + .word 211 + .word 7406 + .word 23986 + .word 20928 + .word 55487 + .word 58939 + .word 35978 + .word 54154 + .word 20786 + .word 29108 + .word 45903 + .word 21845 + .word 43676 + .word 27033 + .word 56912 + .word 55073 + .word 56762 + .word 13326 + .word 51569 + .word 22766 + .word 11195 + .word 61166 + .word 50980 + .word 55993 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8176 + .word 5164 + .word 64154 + .word 36090 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 19140 + .word 63711 + .word 39190 + .word 47508 + .word 49183 + .word 0 + .word 0 + .word 0 + .word 61957 + .word 29915 + .word 7046 + .word 34440 + .word 16447 + .word 0 + .word 0 + .word 0 + .word 29909 + .word 15770 + .word 39264 + .word 33288 + .word 49247 + .word 0 + .word 0 + .word 0 + .word 38912 + .word 2108 + .word 35420 + .word 36197 + .word 16511 + .word 0 + .word 0 + .word 0 + .word 63755 + .word 16362 + .word 32791 + .word 51700 + .word 7043 + .word 34288 + .word 50374 + .word 19448 + .word 36869 + .word 13569 + .word 51161 + .word 52734 + .word 30422 + .word 39536 + .word 34368 + .word 20483 + .word 2356 + .word 27571 + .word 10627 + .word 53769 + .word 24204 + .word 35273 + .word 27312 + .word 21520 + .word 8451 + .word 46569 + .word 41820 + .word 54805 + .word 23553 + .word 63476 + .word 47626 + .word 22556 + .word 30024 + .word 47627 + .word 14141 + .word 55843 + .word 22061 + .word 10635 + .word 17534 + .word 23595 + .word 50593 + .word 17237 + .word 38322 + .word 56882 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26357 + .word 41545 + .word 7157 + .word 37888 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 28550 + .word 47270 + .word 51275 + .word 41572 + .word 49187 + .word 0 + .word 0 + .word 0 + .word 7474 + .word 4460 + .word 27226 + .word 52743 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 18816 + .word 51641 + .word 26417 + .word 44610 + .word 49258 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 61733 + .word 61279 + .word 42447 + .word 16526 + .word 0 + .word 0 + .word 0 + .word 45407 + .word 18829 + .word 2399 + .word 52005 + .word 35928 + .word 2098 + .word 15792 + .word 19814 + .word 23614 + .word 62930 + .word 12196 + .word 53160 + .word 7674 + .word 56712 + .word 55660 + .word 20970 + .word 53358 + .word 2019 + .word 18277 + .word 54318 + .word 57563 + .word 186 + .word 18788 + .word 22129 + .word 38957 + .word 32276 + .word 61462 + .word 55475 + .word 46995 + .word 58305 + .word 12150 + .word 23287 + .word 60702 + .word 18274 + .word 9955 + .word 56635 + .word 40407 + .word 43665 + .word 14520 + .word 24448 + .word 50736 + .word 28578 + .word 16181 + .word 57795 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5404 + .word 12511 + .word 60447 + .word 38763 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 42770 + .word 34093 + .word 51209 + .word 39016 + .word 49191 + .word 0 + .word 0 + .word 0 + .word 6888 + .word 59302 + .word 12508 + .word 46457 + .word 16462 + .word 0 + .word 0 + .word 0 + .word 49565 + .word 60790 + .word 42341 + .word 36877 + .word 49270 + .word 0 + .word 0 + .word 0 + .word 28672 + .word 39351 + .word 39031 + .word 32932 + .word 16542 + .word 0 + .word 0 + .word 0 + .word 35933 + .word 37102 + .word 41613 + .word 52318 + .word 59745 + .word 3284 + .word 26050 + .word 20190 + .word 16458 + .word 62792 + .word 1547 + .word 53599 + .word 38519 + .word 37566 + .word 10560 + .word 21472 + .word 36560 + .word 62869 + .word 6875 + .word 54881 + .word 58623 + .word 15626 + .word 21634 + .word 22754 + .word 22503 + .word 3380 + .word 55147 + .word 56163 + .word 21679 + .word 23644 + .word 42908 + .word 24037 + .word 43760 + .word 1032 + .word 52442 + .word 57447 + .word 14782 + .word 45605 + .word 45261 + .word 25322 + .word 22271 + .word 11633 + .word 47287 + .word 58733 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _LRP,@object + .size _LRP,2496 + .align 16 +_RRIB: + .long 4234632914 + .long 3221491298 + .long 2516645996 + .long 3221465084 + .long 798659078 + .long 3221438870 + .long 2133702104 + .long 3221835523 + .long 3164494255 + .long 3221825037 + .long 4195286406 + .long 3221814551 + .long 816546054 + .long 3222285677 + .long 2019136897 + .long 3222284366 + .long 3221727740 + .long 3222283055 + .long 2093868532 + .long 3222538608 + .long 1475393241 + .long 3222538346 + .long 856917950 + .long 3222538084 + .long 2471449286 + .long 3222798751 + .long 629767309 + .long 3222798699 + .long 3083052628 + .long 3222798646 + .long 862741805 + .long 3223060539 + .long 4260232735 + .long 3223060531 + .long 3362756369 + .long 3223060524 + .long 3046734174 + .long 3223322627 + .long 1076409337 + .long 3223322627 + .long 3401051796 + .long 3223322626 + .long 1762435764 + .long 3223453696 + .long 1551329531 + .long 3223453696 + .long 1340223298 + .long 3223453696 + .long 175962963 + .long 3223584768 + .long 155133815 + .long 3223584768 + .long 134304667 + .long 3223584768 + .long 16073407 + .long 3223715840 + .long 14103082 + .long 3223715840 + .long 12132757 + .long 3223715840 + .long 1330068 + .long 3223846912 + .long 1175257 + .long 3223846912 + .long 1020446 + .long 3223846912 + .long 101663 + .long 3223977984 + .long 90404 + .long 3223977984 + .long 79145 + .long 3223977984 + .long 7020 + .long 3224109056 + .long 6457 + .long 3224109056 + .long 5894 + .long 3224109056 + .type _RRIB,@object + .size _RRIB,312 + .space 8, 0x00 # pad + .align 16 +_RRP: + .word 26273 + .word 65347 + .word 56168 + .word 33169 + .word 16329 + .word 0 + .word 0 + .word 0 + .word 899 + .word 31387 + .word 19253 + .word 49663 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58984 + .word 6058 + .word 23936 + .word 39799 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 62168 + .word 21442 + .word 12332 + .word 46245 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 32619 + .word 37054 + .word 53131 + .word 16575 + .word 61379 + .word 13125 + .word 14178 + .word 16562 + .word 10270 + .word 45115 + .word 37615 + .word 16506 + .word 38745 + .word 51073 + .word 34560 + .word 16498 + .word 53490 + .word 20212 + .word 2544 + .word 16440 + .word 38291 + .word 26669 + .word 54063 + .word 16440 + .word 45779 + .word 11956 + .word 18019 + .word 16540 + .word 18677 + .word 64033 + .word 42794 + .word 16529 + .word 35035 + .word 51098 + .word 10618 + .word 16473 + .word 64107 + .word 31719 + .word 36522 + .word 16468 + .word 8831 + .word 57419 + .word 13215 + .word 16407 + .word 40450 + .word 31904 + .word 29069 + .word 16417 + .word 3821 + .word 29651 + .word 12061 + .word 62640 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 3177 + .word 32099 + .word 13049 + .word 63749 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 10153 + .word 35464 + .word 38075 + .word 52902 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 20859 + .word 27364 + .word 47250 + .word 57481 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 12411 + .word 3381 + .word 24721 + .word 16978 + .word 33723 + .word 48761 + .word 26869 + .word 16934 + .word 60995 + .word 48715 + .word 17741 + .word 16804 + .word 43031 + .word 16238 + .word 40105 + .word 16761 + .word 3889 + .word 41280 + .word 47482 + .word 16635 + .word 43797 + .word 63405 + .word 37827 + .word 16594 + .word 62186 + .word 39109 + .word 61647 + .word 16889 + .word 62356 + .word 27755 + .word 9779 + .word 16848 + .word 54712 + .word 4438 + .word 22518 + .word 16720 + .word 46932 + .word 1372 + .word 7843 + .word 16677 + .word 64555 + .word 14297 + .word 39523 + .word 16553 + .word 24913 + .word 15735 + .word 26400 + .word 16514 + .word 23128 + .word 31275 + .word 33489 + .word 52246 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 56543 + .word 37040 + .word 59300 + .word 54866 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 35342 + .word 2554 + .word 44652 + .word 41504 + .word 16391 + .word 0 + .word 0 + .word 0 + .word 60438 + .word 21728 + .word 35033 + .word 43725 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 2425 + .word 35124 + .word 13908 + .word 17426 + .word 60985 + .word 47869 + .word 25665 + .word 17352 + .word 21213 + .word 45459 + .word 26876 + .word 17133 + .word 52591 + .word 14597 + .word 24526 + .word 17060 + .word 20426 + .word 18941 + .word 5374 + .word 16845 + .word 38724 + .word 49064 + .word 24125 + .word 16773 + .word 29994 + .word 36366 + .word 21088 + .word 17279 + .word 13269 + .word 25406 + .word 24800 + .word 17205 + .word 56893 + .word 35190 + .word 33689 + .word 16988 + .word 18235 + .word 52539 + .word 13276 + .word 16916 + .word 8454 + .word 46451 + .word 9758 + .word 16704 + .word 59084 + .word 57882 + .word 27928 + .word 16633 + .word 38110 + .word 57460 + .word 5118 + .word 49980 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 32056 + .word 19825 + .word 28737 + .word 63161 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 37650 + .word 4479 + .word 6518 + .word 59238 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 47963 + .word 64405 + .word 49841 + .word 37534 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 53082 + .word 25478 + .word 58397 + .word 17968 + .word 35980 + .word 11362 + .word 59289 + .word 17858 + .word 37178 + .word 29007 + .word 44012 + .word 17530 + .word 40762 + .word 17715 + .word 56491 + .word 17422 + .word 58318 + .word 3223 + .word 43216 + .word 17097 + .word 46157 + .word 23530 + .word 32141 + .word 16991 + .word 63138 + .word 35190 + .word 24151 + .word 17748 + .word 9862 + .word 36309 + .word 14376 + .word 17639 + .word 38034 + .word 65220 + .word 2337 + .word 17314 + .word 16819 + .word 31850 + .word 22525 + .word 17205 + .word 7604 + .word 29558 + .word 57367 + .word 16883 + .word 27719 + .word 62170 + .word 8797 + .word 16778 + .word 19348 + .word 65423 + .word 37299 + .word 53534 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 8233 + .word 55180 + .word 9457 + .word 46319 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 43066 + .word 26574 + .word 6722 + .word 65137 + .word 16400 + .word 0 + .word 0 + .word 0 + .word 4285 + .word 7102 + .word 7454 + .word 61224 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 1453 + .word 4915 + .word 61926 + .word 18584 + .word 43088 + .word 28644 + .word 50480 + .word 18434 + .word 16532 + .word 18100 + .word 54137 + .word 17983 + .word 49885 + .word 46980 + .word 54409 + .word 17832 + .word 24326 + .word 38273 + .word 20489 + .word 17385 + .word 28149 + .word 12270 + .word 61982 + .word 17236 + .word 4581 + .word 37632 + .word 45525 + .word 18282 + .word 46626 + .word 30655 + .word 34430 + .word 18132 + .word 63429 + .word 60638 + .word 37201 + .word 17683 + .word 18031 + .word 50879 + .word 14891 + .word 17535 + .word 64064 + .word 1811 + .word 54229 + .word 17089 + .word 27163 + .word 21077 + .word 40059 + .word 16943 + .word 43177 + .word 42972 + .word 46613 + .word 45511 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 51480 + .word 49923 + .word 15697 + .word 40352 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 9513 + .word 31676 + .word 11989 + .word 49652 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 30527 + .word 7034 + .word 38319 + .word 40746 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 7022 + .word 27009 + .word 58741 + .word 19257 + .word 64033 + .word 16049 + .word 22023 + .word 19062 + .word 45243 + .word 42262 + .word 39716 + .word 18476 + .word 50731 + .word 20793 + .word 36853 + .word 18281 + .word 36100 + .word 48270 + .word 37858 + .word 17699 + .word 42104 + .word 28941 + .word 36380 + .word 17506 + .word 23499 + .word 6717 + .word 19492 + .word 18866 + .word 55911 + .word 14060 + .word 7353 + .word 18672 + .word 26519 + .word 16988 + .word 4787 + .word 18087 + .word 28065 + .word 5309 + .word 5697 + .word 17893 + .word 40193 + .word 22022 + .word 5795 + .word 17314 + .word 8456 + .word 42078 + .word 24130 + .word 17122 + .word 59016 + .word 62162 + .word 39673 + .word 39540 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 38154 + .word 49049 + .word 18422 + .word 40324 + .word 16398 + .word 0 + .word 0 + .word 0 + .word 42164 + .word 50610 + .word 50330 + .word 49617 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 25875 + .word 59750 + .word 15469 + .word 40704 + .word 16427 + .word 0 + .word 0 + .word 0 + .word 34173 + .word 58862 + .word 54392 + .word 19977 + .word 59819 + .word 8454 + .word 18296 + .word 19734 + .word 30024 + .word 20882 + .word 32589 + .word 19004 + .word 29754 + .word 31085 + .word 31060 + .word 18761 + .word 52191 + .word 27376 + .word 34749 + .word 18035 + .word 4562 + .word 4929 + .word 33854 + .word 17794 + .word 25001 + .word 9100 + .word 13901 + .word 19490 + .word 47424 + .word 1290 + .word 2840 + .word 19248 + .word 22386 + .word 25633 + .word 77 + .word 18519 + .word 15514 + .word 17548 + .word 1870 + .word 18277 + .word 63012 + .word 41083 + .word 3742 + .word 17554 + .word 48968 + .word 51531 + .word 22462 + .word 17314 + .word 41404 + .word 42732 + .word 62757 + .word 38778 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 7009 + .word 42712 + .word 36892 + .word 45360 + .word 16401 + .word 0 + .word 0 + .word 0 + .word 39847 + .word 2109 + .word 39294 + .word 62791 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 32179 + .word 43914 + .word 44915 + .word 57947 + .word 16436 + .word 0 + .word 0 + .word 0 + .word 27779 + .word 16034 + .word 51140 + .word 20738 + .word 17003 + .word 57008 + .word 53620 + .word 20444 + .word 23469 + .word 38349 + .word 865 + .word 19562 + .word 25226 + .word 11109 + .word 43957 + .word 19268 + .word 36845 + .word 29881 + .word 17299 + .word 18390 + .word 19837 + .word 16116 + .word 50064 + .word 18098 + .word 57862 + .word 29290 + .word 2992 + .word 20149 + .word 46818 + .word 59090 + .word 31382 + .word 19856 + .word 61466 + .word 30954 + .word 38749 + .word 18976 + .word 30984 + .word 39998 + .word 63388 + .word 18682 + .word 41543 + .word 16681 + .word 17428 + .word 17808 + .word 20643 + .word 64049 + .word 24643 + .word 17517 + .word 52468 + .word 15578 + .word 48717 + .word 44571 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 54595 + .word 6191 + .word 4821 + .word 56700 + .word 16404 + .word 0 + .word 0 + .word 0 + .word 50514 + .word 10282 + .word 25695 + .word 49055 + .word 16425 + .word 0 + .word 0 + .word 0 + .word 13176 + .word 11594 + .word 38881 + .word 56588 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 28019 + .word 59660 + .word 42453 + .word 21536 + .word 50810 + .word 20541 + .word 28938 + .word 21188 + .word 53928 + .word 47752 + .word 60679 + .word 20146 + .word 24270 + .word 60826 + .word 4097 + .word 19800 + .word 57327 + .word 59875 + .word 35368 + .word 18762 + .word 31038 + .word 58486 + .word 58593 + .word 18417 + .word 41074 + .word 26743 + .word 60755 + .word 20839 + .word 49334 + .word 8669 + .word 63919 + .word 20493 + .word 20472 + .word 19395 + .word 59120 + .word 19454 + .word 27230 + .word 61299 + .word 5980 + .word 19108 + .word 60536 + .word 14479 + .word 53684 + .word 18072 + .word 24589 + .word 24698 + .word 60903 + .word 17729 + .word 24724 + .word 11272 + .word 24781 + .word 60135 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 54850 + .word 34200 + .word 16766 + .word 38981 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 58717 + .word 18738 + .word 40849 + .word 46372 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 11614 + .word 63671 + .word 65373 + .word 36776 + .word 16457 + .word 0 + .word 0 + .word 0 + .word 54464 + .word 24503 + .word 3823 + .word 22367 + .word 6780 + .word 11041 + .word 46896 + .word 21963 + .word 31922 + .word 33372 + .word 42225 + .word 20755 + .word 24666 + .word 18144 + .word 10765 + .word 20354 + .word 1690 + .word 51390 + .word 54159 + .word 19150 + .word 40728 + .word 53860 + .word 15190 + .word 18750 + .word 62163 + .word 16835 + .word 30725 + .word 21559 + .word 49586 + .word 46435 + .word 25209 + .word 21157 + .word 392 + .word 18629 + .word 63258 + .word 19952 + .word 57023 + .word 35208 + .word 2869 + .word 19552 + .word 15849 + .word 23514 + .word 32489 + .word 18350 + .word 45455 + .word 56342 + .word 1433 + .word 17952 + .word 26203 + .word 24931 + .word 14914 + .word 64372 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 32494 + .word 4334 + .word 57160 + .word 58471 + .word 16411 + .word 0 + .word 0 + .word 0 + .word 38313 + .word 48554 + .word 12217 + .word 52169 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 13841 + .word 14060 + .word 10284 + .word 62061 + .word 16467 + .word 0 + .word 0 + .word 0 + .word 27928 + .word 25887 + .word 22600 + .word 23226 + .word 25867 + .word 43031 + .word 24792 + .word 22767 + .word 61361 + .word 28179 + .word 36008 + .word 21386 + .word 1901 + .word 19713 + .word 23997 + .word 20928 + .word 53849 + .word 49977 + .word 30100 + .word 19552 + .word 12987 + .word 23545 + .word 34237 + .word 19093 + .word 36035 + .word 18526 + .word 55738 + .word 22305 + .word 4173 + .word 53170 + .word 44844 + .word 21845 + .word 20134 + .word 6065 + .word 24986 + .word 20468 + .word 63684 + .word 40633 + .word 45810 + .word 20009 + .word 28281 + .word 10708 + .word 62070 + .word 18636 + .word 42557 + .word 63889 + .word 18197 + .word 18180 + .word 24464 + .word 43564 + .word 52277 + .word 36083 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 8651 + .word 37688 + .word 39193 + .word 47508 + .word 16415 + .word 0 + .word 0 + .word 0 + .word 61957 + .word 29915 + .word 7046 + .word 34440 + .word 16447 + .word 0 + .word 0 + .word 0 + .word 29909 + .word 15770 + .word 39264 + .word 33288 + .word 16479 + .word 0 + .word 0 + .word 0 + .word 16042 + .word 19253 + .word 38322 + .word 24114 + .word 28448 + .word 10617 + .word 17534 + .word 23595 + .word 64229 + .word 46570 + .word 41820 + .word 22037 + .word 23727 + .word 35273 + .word 27312 + .word 21520 + .word 36874 + .word 13569 + .word 51161 + .word 19966 + .word 7043 + .word 34288 + .word 50374 + .word 19448 + .word 38316 + .word 47529 + .word 14141 + .word 23075 + .word 12297 + .word 63477 + .word 47626 + .word 22556 + .word 1229 + .word 27571 + .word 10627 + .word 21001 + .word 30426 + .word 39536 + .word 34368 + .word 20483 + .word 63755 + .word 16362 + .word 32791 + .word 18932 + .word 1939 + .word 19329 + .word 44209 + .word 18417 + .word 1291 + .word 6677 + .word 4999 + .word 37888 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 36671 + .word 58224 + .word 51275 + .word 41572 + .word 16419 + .word 0 + .word 0 + .word 0 + .word 7476 + .word 4460 + .word 27226 + .word 52743 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 18838 + .word 51641 + .word 26417 + .word 44610 + .word 16490 + .word 0 + .word 0 + .word 0 + .word 10710 + .word 48640 + .word 32083 + .word 25027 + .word 33620 + .word 55766 + .word 26236 + .word 24448 + .word 24667 + .word 39142 + .word 61464 + .word 22707 + .word 56170 + .word 8470 + .word 18789 + .word 22129 + .word 23296 + .word 62931 + .word 12196 + .word 20392 + .word 57231 + .word 2098 + .word 15792 + .word 19814 + .word 1704 + .word 49608 + .word 9547 + .word 23867 + .word 46419 + .word 24648 + .word 11891 + .word 23287 + .word 19376 + .word 1296 + .word 18277 + .word 21550 + .word 46223 + .word 56399 + .word 55660 + .word 20970 + .word 45364 + .word 18829 + .word 2399 + .word 19237 + .word 9387 + .word 60414 + .word 47613 + .word 18660 + .type _RRP,@object + .size _RRP,2080 + .align 16 +_LN_SQRT_TWO_PI: + .word 42293 + .word 9717 + .word 36419 + .word 60223 + .word 16382 + .word 0 + .type _LN_SQRT_TWO_PI,@object + .size _LN_SQRT_TWO_PI,12 + .space 4, 0x00 # pad + .align 16 +_W2: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16379 + .word 0 + .type _W2,@object + .size _W2,12 + .space 4, 0x00 # pad + .align 16 +_S10: + .word 26777 + .word 63736 + .word 61426 + .word 52480 + .word 49148 + .word 0 + .type _S10,@object + .size _S10,12 + .space 4, 0x00 # pad + .align 16 +_S06: + .word 26251 + .word 64205 + .word 25991 + .word 44448 + .word 49149 + .word 0 + .type _S06,@object + .size _S06,12 + .space 4, 0x00 # pad + .align 16 +_S02: + .word 39072 + .word 38974 + .word 13074 + .word 53901 + .word 49151 + .word 0 + .type _S02,@object + .size _S02,12 + .space 4, 0x00 # pad + .align 16 +_S12: + .word 13864 + .word 61389 + .word 41932 + .word 43701 + .word 49148 + .word 0 + .type _S12,@object + .size _S12,12 + .space 4, 0x00 # pad + .align 16 +_S08: + .word 6565 + .word 12686 + .word 39772 + .word 32901 + .word 49149 + .word 0 + .type _S08,@object + .size _S08,12 + .space 4, 0x00 # pad + .align 16 +_S04: + .word 60211 + .word 16071 + .word 37206 + .word 35465 + .word 49150 + .word 0 + .type _S04,@object + .size _S04,12 + .space 4, 0x00 # pad + .align 16 +_A: + .long 0 + .long 1074790400 + .long 0 + .long 1075838976 + .long 0 + .long 1076887552 + .long 0 + .long 1077936128 + .long 0 + .long 1078984704 + .long 0 + .long 1080033280 + .long 0 + .long 1081081856 + .type _A,@object + .size _A,56 + .space 8, 0x00 # pad + .align 16 +_B: + .long 0 + .long 1070596096 + .long 0 + .long 1069547520 + .long 0 + .long 1068498944 + .long 0 + .long 1067450368 + .long 0 + .long 1066401792 + .long 0 + .long 1065353216 + .long 0 + .long 1064304640 + .type _B,@object + .size _B,56 + .space 8, 0x00 # pad + .align 16 +_C5: + .word 65250 + .word 31226 + .word 64195 + .word 51294 + .word 16385 + .word 0 + .word 2062 + .word 11523 + .word 15490 + .word 40735 + .word 49153 + .word 0 + .word 32754 + .word 31980 + .word 31403 + .word 49421 + .word 16385 + .word 0 + .word 43174 + .word 39951 + .word 44282 + .word 37916 + .word 49153 + .word 0 + .word 17740 + .word 24638 + .word 31711 + .word 45907 + .word 16385 + .word 0 + .word 40119 + .word 37337 + .word 13155 + .word 65076 + .word 49152 + .word 0 + .word 17604 + .word 23486 + .word 20029 + .word 41172 + .word 16385 + .word 0 + .word 33185 + .word 5727 + .word 44714 + .word 50187 + .word 49152 + .word 0 + .word 59315 + .word 25153 + .word 8859 + .word 35740 + .word 16385 + .word 0 + .word 56975 + .word 59828 + .word 57702 + .word 65082 + .word 49151 + .word 0 + .word 44451 + .word 24185 + .word 18874 + .word 60288 + .word 16384 + .word 0 + .word 63603 + .word 63450 + .word 63770 + .word 55108 + .word 49150 + .word 0 + .word 29224 + .word 39171 + .word 38378 + .word 49676 + .word 16384 + .word 0 + .word 11522 + .word 59843 + .word 6225 + .word 34695 + .word 16381 + .word 0 + .word 52920 + .word 16467 + .word 35974 + .word 40266 + .word 16384 + .word 0 + .word 32911 + .word 20526 + .word 49212 + .word 40083 + .word 16383 + .word 0 + .word 50633 + .word 19120 + .word 5716 + .word 64631 + .word 16383 + .word 0 + .word 27278 + .word 20509 + .word 60679 + .word 63371 + .word 16383 + .word 0 + .word 47711 + .word 23018 + .word 38994 + .word 51179 + .word 16383 + .word 0 + .word 57200 + .word 35818 + .word 16826 + .word 37630 + .word 16384 + .word 0 + .word 2413 + .word 19605 + .word 64315 + .word 49218 + .word 16381 + .word 0 + .word 41670 + .word 6403 + .word 34702 + .word 40993 + .word 16383 + .word 0 + .word 6011 + .word 2134 + .word 32659 + .word 52266 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42605 + .word 32107 + .word 35187 + .word 43545 + .word 16382 + .word 0 + .word 3574 + .word 60450 + .word 45882 + .word 53610 + .word 16383 + .word 0 + .word 2808 + .word 20835 + .word 5027 + .word 56256 + .word 16383 + .word 0 + .word 3021 + .word 28181 + .word 33636 + .word 39028 + .word 16384 + .word 0 + .word 14493 + .word 33433 + .word 18281 + .word 35725 + .word 16384 + .word 0 + .word 39323 + .word 51299 + .word 2596 + .word 32961 + .word 16384 + .word 0 + .word 28336 + .word 24032 + .word 53553 + .word 44237 + .word 16384 + .word 0 + .word 52853 + .word 63658 + .word 36534 + .word 41882 + .word 16383 + .word 0 + .word 47917 + .word 51227 + .word 19034 + .word 54081 + .word 16384 + .word 0 + .word 51044 + .word 31166 + .word 18963 + .word 37856 + .word 16381 + .word 0 + .word 35962 + .word 40199 + .word 871 + .word 65049 + .word 16384 + .word 0 + .word 39889 + .word 54182 + .word 40011 + .word 55797 + .word 49150 + .word 0 + .word 29169 + .word 47361 + .word 8730 + .word 38268 + .word 16385 + .word 0 + .word 39706 + .word 37143 + .word 20168 + .word 33289 + .word 49152 + .word 0 + .word 16433 + .word 42895 + .word 21426 + .word 43820 + .word 16385 + .word 0 + .word 1625 + .word 9463 + .word 65082 + .word 51468 + .word 49152 + .word 0 + .word 58247 + .word 1594 + .word 2790 + .word 48648 + .word 16385 + .word 0 + .word 20868 + .word 31765 + .word 34026 + .word 33401 + .word 49153 + .word 0 + .word 23737 + .word 4448 + .word 39427 + .word 52225 + .word 16385 + .word 0 + .word 3456 + .word 40222 + .word 65015 + .word 38939 + .word 49153 + .word 0 + .word 35551 + .word 41260 + .word 40325 + .word 54131 + .word 16385 + .word 0 + .word 8973 + .word 47485 + .word 2472 + .word 41842 + .word 49153 + .word 0 + .word 43053 + .word 31703 + .word 19755 + .word 33274 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36731 + .word 27611 + .word 11212 + .word 55816 + .word 16382 + .word 0 + .word 63893 + .word 30149 + .word 45246 + .word 60594 + .word 16383 + .word 0 + .word 47198 + .word 37666 + .word 57801 + .word 61119 + .word 16383 + .word 0 + .word 25856 + .word 56265 + .word 35798 + .word 40402 + .word 16384 + .word 0 + .word 6470 + .word 34102 + .word 54471 + .word 38654 + .word 16384 + .word 0 + .word 9295 + .word 39366 + .word 17179 + .word 34081 + .word 16384 + .word 0 + .word 45822 + .word 31766 + .word 42784 + .word 47587 + .word 16384 + .word 0 + .word 5059 + .word 11140 + .word 37473 + .word 43359 + .word 16383 + .word 0 + .word 58055 + .word 60744 + .word 5900 + .word 57832 + .word 16384 + .word 0 + .word 38212 + .word 45613 + .word 58947 + .word 40054 + .word 16381 + .word 0 + .word 7938 + .word 56610 + .word 27106 + .word 34591 + .word 16385 + .word 0 + .word 32824 + .word 16764 + .word 60057 + .word 56720 + .word 49150 + .word 0 + .word 10908 + .word 30532 + .word 62164 + .word 40510 + .word 16385 + .word 0 + .word 63750 + .word 13029 + .word 27501 + .word 34026 + .word 49152 + .word 0 + .word 33477 + .word 11068 + .word 13144 + .word 46215 + .word 16385 + .word 0 + .word 42530 + .word 57434 + .word 58521 + .word 52671 + .word 49152 + .word 0 + .word 18986 + .word 9605 + .word 39740 + .word 51163 + .word 16385 + .word 0 + .word 28928 + .word 13634 + .word 42974 + .word 34196 + .word 49153 + .word 0 + .word 35215 + .word 30142 + .word 47225 + .word 54824 + .word 16385 + .word 0 + .word 28719 + .word 4316 + .word 52012 + .word 39873 + .word 49153 + .word 0 + .word 4508 + .word 8703 + .word 27075 + .word 56773 + .word 16385 + .word 0 + .word 26288 + .word 30246 + .word 8808 + .word 42848 + .word 49153 + .word 0 + .word 44455 + .word 3575 + .word 25942 + .word 45691 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2794 + .word 62330 + .word 8461 + .word 63853 + .word 16382 + .word 0 + .word 21479 + .word 44765 + .word 7865 + .word 64840 + .word 16383 + .word 0 + .word 31874 + .word 33681 + .word 56423 + .word 65041 + .word 16383 + .word 0 + .word 21473 + .word 44172 + .word 64358 + .word 41494 + .word 16384 + .word 0 + .word 32222 + .word 10523 + .word 55592 + .word 40956 + .word 16384 + .word 0 + .word 21434 + .word 30837 + .word 63797 + .word 34911 + .word 16384 + .word 0 + .word 39649 + .word 32992 + .word 36682 + .word 50257 + .word 16384 + .word 0 + .word 13095 + .word 39473 + .word 7384 + .word 44359 + .word 16383 + .word 0 + .word 31843 + .word 64809 + .word 59872 + .word 60895 + .word 16384 + .word 0 + .word 8672 + .word 5021 + .word 16314 + .word 40945 + .word 16381 + .word 0 + .word 39714 + .word 18801 + .word 4723 + .word 36324 + .word 16385 + .word 0 + .word 614 + .word 42734 + .word 5731 + .word 57950 + .word 49150 + .word 0 + .word 64434 + .word 24821 + .word 2679 + .word 42435 + .word 16385 + .word 0 + .word 12194 + .word 23846 + .word 20957 + .word 34750 + .word 49152 + .word 0 + .word 10830 + .word 21930 + .word 2400 + .word 48308 + .word 16385 + .word 0 + .word 22166 + .word 52453 + .word 43476 + .word 53777 + .word 49152 + .word 0 + .word 47257 + .word 46311 + .word 24367 + .word 53391 + .word 16385 + .word 0 + .word 54217 + .word 40926 + .word 61378 + .word 34907 + .word 49153 + .word 0 + .word 63951 + .word 56465 + .word 60729 + .word 57145 + .word 16385 + .word 0 + .word 26614 + .word 13946 + .word 18662 + .word 40698 + .word 49153 + .word 0 + .word 1838 + .word 12847 + .word 15941 + .word 59142 + .word 16385 + .word 0 + .word 4759 + .word 49273 + .word 38799 + .word 43731 + .word 49153 + .word 0 + .word 26568 + .word 56798 + .word 57629 + .word 34217 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25804 + .word 39657 + .word 51638 + .word 34652 + .word 16383 + .word 0 + .word 2771 + .word 24731 + .word 11874 + .word 33806 + .word 16384 + .word 0 + .word 19474 + .word 34269 + .word 14010 + .word 33912 + .word 16384 + .word 0 + .word 56824 + .word 53459 + .word 23053 + .word 42279 + .word 16384 + .word 0 + .word 18742 + .word 13031 + .word 52011 + .word 42483 + .word 16384 + .word 0 + .word 5937 + .word 64580 + .word 50859 + .word 35501 + .word 16384 + .word 0 + .word 23055 + .word 38603 + .word 6524 + .word 51938 + .word 16384 + .word 0 + .word 3664 + .word 27625 + .word 50793 + .word 45121 + .word 16383 + .word 0 + .word 52489 + .word 3557 + .word 32438 + .word 62735 + .word 16384 + .word 0 + .word 894 + .word 16203 + .word 51477 + .word 42152 + .word 16381 + .word 0 + .word 34963 + .word 47118 + .word 6430 + .word 37322 + .word 16385 + .word 0 + .word 26422 + .word 42936 + .word 42081 + .word 58310 + .word 49150 + .word 0 + .word 13130 + .word 21399 + .word 54693 + .word 43505 + .word 16385 + .word 0 + .word 30323 + .word 50910 + .word 30337 + .word 35076 + .word 49152 + .word 0 + .word 38115 + .word 10576 + .word 10000 + .word 49442 + .word 16385 + .word 0 + .word 37599 + .word 18432 + .word 63354 + .word 54317 + .word 49152 + .word 0 + .word 58822 + .word 42699 + .word 64187 + .word 54575 + .word 16385 + .word 0 + .word 64288 + .word 61574 + .word 23831 + .word 35266 + .word 49153 + .word 0 + .word 11805 + .word 33285 + .word 40274 + .word 58365 + .word 16385 + .word 0 + .word 20167 + .word 739 + .word 36989 + .word 41119 + .word 49153 + .word 0 + .word 62447 + .word 46690 + .word 58491 + .word 60379 + .word 16385 + .word 0 + .word 1463 + .word 47000 + .word 35484 + .word 44185 + .word 49153 + .word 0 + .word 64817 + .word 40328 + .word 40776 + .word 61320 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60250 + .word 42976 + .word 52322 + .word 36598 + .word 16383 + .word 0 + .word 26918 + .word 53639 + .word 1629 + .word 34777 + .word 16384 + .word 0 + .word 192 + .word 43979 + .word 65472 + .word 34978 + .word 16384 + .word 0 + .word 52261 + .word 56023 + .word 49807 + .word 42881 + .word 16384 + .word 0 + .word 1627 + .word 46939 + .word 43260 + .word 43630 + .word 16384 + .word 0 + .word 60557 + .word 13735 + .word 20430 + .word 35946 + .word 16384 + .word 0 + .word 37731 + .word 15708 + .word 47147 + .word 53188 + .word 16384 + .word 0 + .word 21753 + .word 29315 + .word 41089 + .word 45691 + .word 16383 + .word 0 + .word 6001 + .word 56966 + .word 64901 + .word 64096 + .word 16384 + .word 0 + .word 60203 + .word 9392 + .word 60017 + .word 43055 + .word 16381 + .word 0 + .word 63698 + .word 8838 + .word 668 + .word 38058 + .word 16385 + .word 0 + .word 63354 + .word 11979 + .word 38628 + .word 58569 + .word 49150 + .word 0 + .word 14495 + .word 23154 + .word 18917 + .word 44293 + .word 16385 + .word 0 + .word 21391 + .word 34042 + .word 43308 + .word 35313 + .word 49152 + .word 0 + .word 19364 + .word 56057 + .word 34969 + .word 50274 + .word 16385 + .word 0 + .word 24688 + .word 56191 + .word 53239 + .word 54710 + .word 49152 + .word 0 + .word 29387 + .word 5660 + .word 12964 + .word 55444 + .word 16385 + .word 0 + .word 35686 + .word 64227 + .word 46433 + .word 35526 + .word 49153 + .word 0 + .word 36666 + .word 59843 + .word 47733 + .word 59258 + .word 16385 + .word 0 + .word 36678 + .word 17293 + .word 20572 + .word 41425 + .word 49153 + .word 0 + .word 18431 + .word 63251 + .word 49151 + .word 61285 + .word 16385 + .word 0 + .word 60545 + .word 37455 + .word 56348 + .word 44514 + .word 49153 + .word 0 + .word 37261 + .word 1613 + .word 29792 + .word 57954 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15271 + .word 17124 + .word 50042 + .word 38057 + .word 16383 + .word 0 + .word 7933 + .word 60764 + .word 31972 + .word 35498 + .word 16384 + .word 0 + .word 36698 + .word 903 + .word 21735 + .word 35834 + .word 16384 + .word 0 + .word 61921 + .word 64342 + .word 37428 + .word 43367 + .word 16384 + .word 0 + .word 25723 + .word 57108 + .word 17005 + .word 44538 + .word 16384 + .word 0 + .word 55361 + .word 30601 + .word 552 + .word 36302 + .word 16384 + .word 0 + .word 60144 + .word 14680 + .word 32635 + .word 54172 + .word 16384 + .word 0 + .word 56958 + .word 12456 + .word 10479 + .word 46147 + .word 16383 + .word 0 + .word 483 + .word 34108 + .word 14727 + .word 65164 + .word 16384 + .word 0 + .word 43794 + .word 49057 + .word 50532 + .word 43789 + .word 16381 + .word 0 + .word 12225 + .word 29228 + .word 35085 + .word 38633 + .word 16385 + .word 0 + .word 54219 + .word 64754 + .word 11030 + .word 58760 + .word 49150 + .word 0 + .word 52932 + .word 63137 + .word 8758 + .word 44908 + .word 16385 + .word 0 + .word 27270 + .word 37632 + .word 62601 + .word 35495 + .word 49152 + .word 0 + .word 53773 + .word 63879 + .word 47305 + .word 50923 + .word 16385 + .word 0 + .word 29965 + .word 53650 + .word 14162 + .word 55014 + .word 49152 + .word 0 + .word 10444 + .word 24307 + .word 52989 + .word 56120 + .word 16385 + .word 0 + .word 12949 + .word 6021 + .word 2059 + .word 35728 + .word 49153 + .word 0 + .word 41140 + .word 26313 + .word 26076 + .word 59954 + .word 16385 + .word 0 + .word 53675 + .word 12584 + .word 54309 + .word 41661 + .word 49153 + .word 0 + .word 28849 + .word 13964 + .word 11627 + .word 61991 + .word 16385 + .word 0 + .word 33057 + .word 63851 + .word 41026 + .word 44769 + .word 49153 + .word 0 + .word 61939 + .word 60366 + .word 37868 + .word 56319 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _C5,@object + .size _C5,2016 + .align 16 +_C4: + .word 39764 + .word 13333 + .word 46799 + .word 55432 + .word 16385 + .word 0 + .word 6306 + .word 35111 + .word 59607 + .word 63624 + .word 49153 + .word 0 + .word 40772 + .word 10749 + .word 40067 + .word 48311 + .word 16382 + .word 0 + .word 17977 + .word 41258 + .word 10043 + .word 63023 + .word 16381 + .word 0 + .word 17757 + .word 54940 + .word 38650 + .word 52104 + .word 16384 + .word 0 + .word 36152 + .word 14316 + .word 50442 + .word 43322 + .word 49148 + .word 0 + .word 48990 + .word 25502 + .word 42020 + .word 58640 + .word 16385 + .word 0 + .word 57431 + .word 49505 + .word 17362 + .word 46284 + .word 49151 + .word 0 + .word 34483 + .word 2420 + .word 54299 + .word 50782 + .word 16386 + .word 0 + .word 37575 + .word 3091 + .word 26415 + .word 50860 + .word 49152 + .word 0 + .word 5185 + .word 25440 + .word 63351 + .word 37946 + .word 16387 + .word 0 + .word 37934 + .word 12918 + .word 47534 + .word 41618 + .word 49153 + .word 0 + .word 59537 + .word 51974 + .word 16286 + .word 51369 + .word 16387 + .word 0 + .word 31611 + .word 51820 + .word 58572 + .word 58708 + .word 49153 + .word 0 + .word 57757 + .word 54077 + .word 23114 + .word 64558 + .word 16387 + .word 0 + .word 63584 + .word 48263 + .word 62815 + .word 37616 + .word 49154 + .word 0 + .word 281 + .word 14439 + .word 46939 + .word 38182 + .word 16388 + .word 0 + .word 63169 + .word 10307 + .word 53265 + .word 44896 + .word 49154 + .word 0 + .word 22654 + .word 54923 + .word 22649 + .word 42855 + .word 16388 + .word 0 + .word 37607 + .word 64061 + .word 25856 + .word 50581 + .word 49154 + .word 0 + .word 47296 + .word 11647 + .word 64103 + .word 45853 + .word 16388 + .word 0 + .word 30544 + .word 55384 + .word 11467 + .word 54194 + .word 49154 + .word 0 + .word 39553 + .word 55407 + .word 30581 + .word 33698 + .word 49111 + .word 0 + .type _C4,@object + .size _C4,276 + .space 12, 0x00 # pad + .align 16 +_C3: + .word 28854 + .word 1182 + .word 12345 + .word 55415 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 12848 + .word 12413 + .word 26149 + .word 42266 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 13313 + .word 43952 + .word 210 + .word 35312 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 13187 + .word 60452 + .word 5475 + .word 43161 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 20972 + .word 51120 + .word 32272 + .word 61954 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 22296 + .word 60123 + .word 44502 + .word 16231 + .word 21517 + .word 49855 + .word 35525 + .word 48979 + .word 44698 + .word 63620 + .word 45930 + .word 16192 + .word 34147 + .word 51190 + .word 16340 + .word 48941 + .word 42301 + .word 55313 + .word 4730 + .word 16154 + .word 35999 + .word 24973 + .word 36325 + .word 48903 + .word 63277 + .word 55760 + .word 33014 + .word 16117 + .word 6314 + .word 46281 + .word 52205 + .word 48867 + .word 12513 + .word 17037 + .word 21130 + .word 16082 + .word 49946 + .word 1999 + .word 4813 + .word 48833 + .word 595 + .word 34534 + .word 265 + .word 16049 + .word 36690 + .word 64093 + .word 7546 + .word 48800 + .type _C3,@object + .size _C3,176 + .align 16 +_LM: + .word 64512 + .word 46577 + .word 49946 + .word 47894 + .word 16383 + .word 0 + .type _LM,@object + .size _LM,12 + .space 4, 0x00 # pad + .align 16 +_LGAMMA_C2: + .word 3599 + .word 7250 + .word 52710 + .word 63693 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 31159 + .word 473 + .word 17060 + .word 35466 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 23705 + .word 29125 + .word 24135 + .word 63417 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 8259 + .word 13793 + .word 15470 + .word 38689 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 1592 + .word 43035 + .word 5286 + .word 33882 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 34241 + .word 35161 + .word 18170 + .word 34381 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 17215 + .word 38817 + .word 26343 + .word 16274 + .word 43407 + .word 38166 + .word 8095 + .word 49029 + .word 9256 + .word 10755 + .word 64736 + .word 16248 + .word 19293 + .word 8064 + .word 12058 + .word 49006 + .word 55284 + .word 28504 + .word 33554 + .word 16226 + .word 50892 + .word 40251 + .word 63876 + .word 48982 + .word 34903 + .word 32886 + .word 50950 + .word 16204 + .word 5270 + .word 55866 + .word 9779 + .word 48962 + .word 8284 + .word 46907 + .word 3681 + .word 16183 + .word 12968 + .word 35363 + .word 2442 + .word 48942 + .word 52637 + .word 49970 + .word 50463 + .word 16163 + .word 28134 + .word 34361 + .word 26628 + .word 48914 + .type _LGAMMA_C2,@object + .size _LGAMMA_C2,192 + .align 16 +_C1: + .word 51111 + .word 32176 + .word 26595 + .word 37828 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 38980 + .word 38974 + .word 13074 + .word 53901 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30416 + .word 21910 + .word 43743 + .word 52518 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 47709 + .word 16075 + .word 37206 + .word 35465 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 15719 + .word 21694 + .word 57533 + .word 54364 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 13628 + .word 45309 + .word 46092 + .word 16325 + .word 18814 + .word 7557 + .word 28730 + .word 49090 + .word 30522 + .word 27866 + .word 4275 + .word 16320 + .word 35905 + .word 26356 + .word 32871 + .word 49084 + .word 38506 + .word 60969 + .word 40989 + .word 16313 + .word 18199 + .word 53198 + .word 18595 + .word 49079 + .word 21817 + .word 41319 + .word 22094 + .word 16309 + .word 3261 + .word 2506 + .word 46646 + .word 49075 + .word 41261 + .word 44393 + .word 26269 + .word 16306 + .word 45347 + .word 5923 + .word 3109 + .word 49073 + .word 3843 + .word 55608 + .word 31192 + .word 16299 + .word 33944 + .word 58380 + .word 1271 + .word 49050 + .type _C1,@object + .size _C1,176 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xc3300000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x40080000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_W4: + .long 381774871 + .long 3211182444 + .type _W4,@object + .size _W4,8 + .align 4 +_S26: + .long 1826776023 + .long 1070820717 + .type _S26,@object + .size _S26,8 + .align 4 +_S28: + .long 2468013457 + .long 3218873328 + .type _S28,@object + .size _S28,8 + .align 4 +_S22: + .long 342869935 + .long 3214497781 + .type _S22,@object + .size _S22,8 + .align 4 +_S24: + .long 3872164012 + .long 3218225849 + .type _S24,@object + .size _S24,8 + .align 4 +_S18: + .long 1060196486 + .long 3216761200 + .type _S18,@object + .size _S18,8 + .align 4 +_S20: + .long 1339685656 + .long 3216855407 + .type _S20,@object + .size _S20,8 + .align 4 +_S14: + .long 3265047626 + .long 3217180894 + .type _S14,@object + .size _S14,8 + .align 4 +_S16: + .long 618803264 + .long 3217033139 + .type _S16,@object + .size _S16,8 + .align 4 +_PBIG: + .long 4294967295 + .long 2146435071 + .type _PBIG,@object + .size _PBIG,8 + .data + .hidden fesetround + .hidden fegetround + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lgammaf.S b/external/sgx_libm/ia32/lgammaf.S new file mode 100644 index 0000000000..650c48a2f9 --- /dev/null +++ b/external/sgx_libm/ia32/lgammaf.S @@ -0,0 +1,2280 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lgammaf.c" + .text +..TXTST0: +# -- Begin lgammaf + .text + .align 16,0x90 + .globl lgammaf +lgammaf: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + subl $20, %esp + lea 8(%esp), %eax + pushl %eax + pushl 28(%esp) + call __libm_lgammaf +..B1.2: + addl $28, %esp + ret + .align 16,0x90 + .type lgammaf,@function + .size lgammaf,.-lgammaf + .data +# -- End lgammaf + .text +# -- Begin __libm_lgammaf + .text + .align 16,0x90 +__libm_lgammaf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L2: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + movzwl 10(%ebp), %ebx + andl $32640, %ebx + shrl $7, %ebx + movl %ebx, %edi + movzbl 11(%ebp), %ecx + movl 8(%ebp), %edx + andl $128, %ecx + movl 12(%ebp), %eax + andl $8388607, %edx + shll $23, %edi + shrl $7, %ecx + orl %edx, %edi + movl %eax, 12(%esp) + movl %ecx, (%esp) +..B2.2: + fnstcw 90(%esp) +..B2.3: + call fegetround +..B2.164: + movl %eax, 84(%esp) +..B2.4: + cmpl $0, 84(%esp) + jne ..B2.6 +..B2.5: + xorl %edx, %edx + jmp ..B2.8 +..B2.6: + addl $-16, %esp + movl $0, (%esp) + call fesetround +..B2.165: + addl $16, %esp +..B2.7: + movl $1, %edx +..B2.8: + movzwl 90(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.161 +..B2.9: + orl $-64768, %ecx + movw %cx, 88(%esp) +..B2.10: + fldcw 88(%esp) +..B2.11: + movl $1, %esi +..B2.12: + cmpl $255, %ebx + jne ..B2.18 +..B2.13: + movl 12(%esp), %eax + testl %esi, %esi + movl $1, (%eax) + je ..B2.15 +..B2.14: + fldcw 90(%esp) +..B2.15: + testl %edx, %edx + je ..B2.17 +..B2.16: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.166: + addl $16, %esp +..B2.17: + flds 8(%ebp) + fmul %st(0), %st + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.18: + testl %edi, %edi + je ..B2.153 +..B2.19: + movl 12(%esp), %eax + call ..L3 +..L3: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L3](%ebx), %ebx + movl $1, (%eax) + cmpl $0, (%esp) + jne ..B2.76 +..B2.20: + cmpl $2084876174, %edi + jae ..B2.140 +..B2.21: + flds 8(%ebp) + fld1 + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.22 + je ..B2.135 +..B2.22: + cmpl $1174405120, %edi + jb ..B2.28 +..B2.23: + fldt _LN_SQRT_TWO_PI@GOTOFF(%ebx) + fstpt (%esp) + addl $-16, %esp + fstl (%esp) + fstpt 32(%esp) + fldt 32(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + movl %edx, 96(%esp) + fsubrp %st, %st(1) + fstpt 48(%esp) + call log@PLT +..B2.167: + fldt 32(%esp) + fldt 48(%esp) + movl 96(%esp), %edx + addl $16, %esp + fmulp %st, %st(2) + testl %edx, %edx + fxch %st(1) + je ..B2.25 +..B2.24: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpt 48(%esp) + fstpt 32(%esp) + call fesetround +..B2.168: + fldt 32(%esp) + fldt 48(%esp) + addl $16, %esp +..B2.25: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fsubp %st, %st(1) + fstps 76(%esp) + je ..B2.27 +..B2.26: + fldcw 90(%esp) +..B2.27: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.28: + cmpl $1082130432, %edi + jb ..B2.35 +..B2.29: + addl $-1082130432, %edi + sarl $23, %edi + movl %edi, %eax + shll $6, %eax + testl %edx, %edx + fsubs _A@GOTOFF(%ebx,%edi,4) + fmuls _B@GOTOFF(%ebx,%edi,4) + lea (%edi,%edi,2), %ecx + fld %st(0) + fmul %st(1), %st + fldl 8+_C5@GOTOFF(%eax,%ebx) + fmul %st(1), %st + faddl 40+_C5@GOTOFF(%eax,%ebx) + fmul %st(1), %st + faddl 8+_C5_0@GOTOFF(%ebx,%ecx,8) + fmul %st(1), %st + faddl 56+_C5@GOTOFF(%eax,%ebx) + fmul %st(1), %st + faddl 24+_C5@GOTOFF(%eax,%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fldl _C5@GOTOFF(%eax,%ebx) + fmul %st(2), %st + faddl 32+_C5@GOTOFF(%eax,%ebx) + fmul %st(2), %st + faddl _C5_0@GOTOFF(%ebx,%ecx,8) + fmul %st(2), %st + faddl 48+_C5@GOTOFF(%eax,%ebx) + fmul %st(2), %st + faddl 16+_C5@GOTOFF(%eax,%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddl 16+_C5_0@GOTOFF(%ebx,%ecx,8) + fstpt (%esp) + je ..B2.32 +..B2.30: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.169: + addl $16, %esp +..B2.31: + fldt 36(%esp) +..B2.32: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstps 76(%esp) + je ..B2.34 +..B2.33: + fldcw 90(%esp) +..B2.34: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.35: + flds .L_2il0floatpacket.3@GOTOFF(%ebx) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.36 + je ..B2.130 +..B2.36: + cmpl $1073741824, %edi + jbe ..B2.42 +..B2.37: + fldl 8+_C4@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + testl %edx, %edx + fmul %st, %st(1) + fldl _C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 40+_C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 32+_C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 72+_C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 64+_C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 56+_C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 48+_C4@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(2) + faddl 24+_C4@GOTOFF(%ebx) + fmul %st(3), %st + fstpt 36(%esp) + fldt 36(%esp) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fsubrp %st, %st(4) + fxch %st(2) + faddl 16+_C4@GOTOFF(%ebx) + fmulp %st, %st(1) + faddl 80+_C4@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + je ..B2.39 +..B2.38: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.170: + fldt 16(%esp) + addl $16, %esp +..B2.39: + fstps 76(%esp) + testl %esi, %esi + je ..B2.41 +..B2.40: + fldcw 90(%esp) +..B2.41: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.42: + cmpl $1071644672, %edi + jb ..B2.49 +..B2.43: + fldl 16+_C3@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + testl %edx, %edx + fmul %st, %st(1) + fxch %st(1) + faddl 48+_C3@GOTOFF(%ebx) + fmul %st(1), %st + faddl 32+_C3@GOTOFF(%ebx) + fmul %st(1), %st + faddl 64+_C3@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fldl 8+_C3@GOTOFF(%ebx) + fmul %st(2), %st + faddl 40+_C3@GOTOFF(%ebx) + fmul %st(2), %st + faddl 24+_C3@GOTOFF(%ebx) + fmul %st(2), %st + faddl 56+_C3@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddl _C3@GOTOFF(%ebx) + fstpt (%esp) + je ..B2.46 +..B2.44: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.171: + addl $16, %esp +..B2.45: + fldt 36(%esp) +..B2.46: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstps 76(%esp) + je ..B2.48 +..B2.47: + fldcw 90(%esp) +..B2.48: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.49: + cmpl $1069547520, %edi + jb ..B2.56 +..B2.50: + fldl 16+_LGAMMAF_C2@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + testl %edx, %edx + fmul %st, %st(1) + fxch %st(1) + faddl 48+_LGAMMAF_C2@GOTOFF(%ebx) + fmul %st(1), %st + faddl 32+_LGAMMAF_C2@GOTOFF(%ebx) + fmul %st(1), %st + faddl 64+_LGAMMAF_C2@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fldl 8+_LGAMMAF_C2@GOTOFF(%ebx) + fmul %st(2), %st + faddl 40+_LGAMMAF_C2@GOTOFF(%ebx) + fmul %st(2), %st + faddl 24+_LGAMMAF_C2@GOTOFF(%ebx) + fmul %st(2), %st + faddl 56+_LGAMMAF_C2@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddl _LGAMMAF_C2@GOTOFF(%ebx) + fstpt (%esp) + je ..B2.53 +..B2.51: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.172: + addl $16, %esp +..B2.52: + fldt 36(%esp) +..B2.53: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstps 76(%esp) + je ..B2.55 +..B2.54: + fldcw 90(%esp) +..B2.55: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.56: + cmpl $1067450368, %edi + jb ..B2.63 +..B2.57: + fldl 16+_C1@GOTOFF(%ebx) + testl %edx, %edx + fxch %st(1) + fsubl _LM@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(2) + faddl 48+_C1@GOTOFF(%ebx) + fmul %st(2), %st + faddl 32+_C1@GOTOFF(%ebx) + fmul %st(2), %st + faddl 64+_C1@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fldl 8+_C1@GOTOFF(%ebx) + fmul %st(2), %st + faddl 40+_C1@GOTOFF(%ebx) + fmul %st(2), %st + faddl 24+_C1@GOTOFF(%ebx) + fmul %st(2), %st + faddl 56+_C1@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddl _C1@GOTOFF(%ebx) + fstpt (%esp) + je ..B2.60 +..B2.58: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.173: + addl $16, %esp +..B2.59: + fldt 36(%esp) +..B2.60: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstps 76(%esp) + je ..B2.62 +..B2.61: + fldcw 90(%esp) +..B2.62: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.63: + cmpl $1065353216, %edi + jb ..B2.70 +..B2.64: + fldl 16+_C0@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + testl %edx, %edx + fmul %st, %st(1) + fxch %st(1) + faddl 48+_C0@GOTOFF(%ebx) + fmul %st(1), %st + faddl 32+_C0@GOTOFF(%ebx) + fmul %st(1), %st + faddl 64+_C0@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fldl 8+_C0@GOTOFF(%ebx) + fmul %st(2), %st + faddl 40+_C0@GOTOFF(%ebx) + fmul %st(2), %st + faddl 24+_C0@GOTOFF(%ebx) + fmul %st(2), %st + faddl 56+_C0@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddl _C0@GOTOFF(%ebx) + fstpt (%esp) + je ..B2.67 +..B2.65: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.174: + addl $16, %esp +..B2.66: + fldt 36(%esp) +..B2.67: + fldt (%esp) + testl %esi, %esi + faddp %st, %st(1) + fstps 76(%esp) + je ..B2.69 +..B2.68: + fldcw 90(%esp) +..B2.69: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.70: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + addl $-16, %esp + fadd %st(1), %st + fstpt (%esp) + fstpt 32(%esp) + movl %edx, 96(%esp) + call lgammaf_pos +..B2.176: + fldt 32(%esp) + movl 96(%esp), %edx + fxch %st(1) + fstpt 16(%esp) + fstpl (%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.175: + movl 96(%esp), %edx + addl $16, %esp + fstpt 36(%esp) + fldt 36(%esp) + testl %edx, %edx + je ..B2.73 +..B2.71: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.177: + addl $16, %esp +..B2.72: + fldt 36(%esp) +..B2.73: + fldt (%esp) + testl %esi, %esi + fsubp %st, %st(1) + fstps 76(%esp) + je ..B2.75 +..B2.74: + fldcw 90(%esp) +..B2.75: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.76: + addl $-16, %esp + movl 8(%ebp), %eax + movl %eax, (%esp) + movl %edx, 96(%esp) + call nearbyintf@PLT +..B2.178: + flds 8(%ebp) + movl 96(%esp), %edx + addl $16, %esp + fxch %st(1) + fstps 76(%esp) + flds 76(%esp) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.77 + je ..B2.148 +..B2.77: + fcoms .L_2il0floatpacket.0@GOTOFF(%ebx) + fnstsw %ax + sahf + jbe ..B2.80 +..B2.78: + fld %st(0) + frndint + fcom %st(1) + fnstsw %ax + sahf + jnb ..L4 + fld1 + faddp %st, %st(1) +..L4: + fistpl 16(%esp) + movl 16(%esp), %eax + testb $1, %al + jne ..B2.80 +..B2.79: + movl 12(%esp), %eax + movl $-1, (%eax) +..B2.80: + cmpl $1073741824, %edi + jae ..B2.91 +..B2.81: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.145 +..B2.82: + fld %st(0) +..B2.83: + fmul %st(2), %st + fxch %st(1) + fadd %st, %st(2) + fcom %st(2) + fnstsw %ax + sahf + fxch %st(1) + ja ..B2.83 +..B2.84: + fstp %st(1) + fstpt 36(%esp) +..B2.85: + andb $127, 45(%esp) + fldt 36(%esp) + addl $-16, %esp + fstpl (%esp) + fstpt 80(%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.180: + fldt 80(%esp) + movl 96(%esp), %edx + addl $16, %esp + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fstpt 16(%esp) + movl %edx, 96(%esp) + call lgammaf_pos +..B2.179: + fldt 16(%esp) + movl 96(%esp), %edx + addl $16, %esp + testl %edx, %edx + je ..B2.88 +..B2.86: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.181: + fldt 16(%esp) + addl $16, %esp +..B2.87: + fldt 36(%esp) +..B2.88: + testl %esi, %esi + fsubrp %st, %st(1) + fstps 76(%esp) + je ..B2.90 +..B2.89: + fldcw 90(%esp) +..B2.90: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.91: + cmpl $1082130432, %edi + jae ..B2.108 +..B2.92: + flds .L_2il0floatpacket.4@GOTOFF(%ebx) + fsub %st(1), %st + fstps 76(%esp) + flds 76(%esp) + flds .L_2il0floatpacket.5@GOTOFF(%ebx) + fadd %st, %st(1) + fxch %st(1) + fstps 76(%esp) + flds 76(%esp) + movl 76(%esp), %edi + fsubp %st, %st(1) + andl $1, %edi + fstps 76(%esp) + lea (%edi,%edi,2), %ecx + fcoml _LRIB@GOTOFF(%ebx,%ecx,8) + fnstsw %ax + sahf + jbe ..B2.95 +..B2.93: + fldl 16+_LRIB@GOTOFF(%ebx,%ecx,8) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.95 +..B2.94: + fldl 8+_LRIB@GOTOFF(%ebx,%ecx,8) + shll $5, %edi + fsubrp %st, %st(1) + fldl _LRP@GOTOFF(%edi,%ebx) + fmul %st(1), %st + faddl 8+_LRP@GOTOFF(%edi,%ebx) + fmul %st(1), %st + faddl 16+_LRP@GOTOFF(%edi,%ebx) + fmulp %st, %st(1) + faddl 24+_LRP@GOTOFF(%edi,%ebx) + jmp ..B2.103 +..B2.95: + fcoml _RRIB@GOTOFF(%ebx,%ecx,8) + fnstsw %ax + sahf + jbe ..B2.98 +..B2.96: + fldl 16+_RRIB@GOTOFF(%ebx,%ecx,8) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.98 +..B2.97: + fldl 8+_RRIB@GOTOFF(%ebx,%ecx,8) + shll $5, %edi + fsubrp %st, %st(1) + fldl _RRP@GOTOFF(%edi,%ebx) + fmul %st(1), %st + faddl 8+_RRP@GOTOFF(%edi,%ebx) + fmul %st(1), %st + faddl 16+_RRP@GOTOFF(%edi,%ebx) + fmulp %st, %st(1) + faddl 24+_RRP@GOTOFF(%edi,%ebx) + jmp ..B2.103 +..B2.98: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.146 +..B2.99: + fld %st(0) +..B2.100: + fmul %st(2), %st + fxch %st(1) + fadd %st, %st(2) + fcom %st(2) + fnstsw %ax + sahf + fxch %st(1) + ja ..B2.100 +..B2.101: + fstp %st(1) + fstpt 36(%esp) +..B2.102: + andb $127, 45(%esp) + fldt 36(%esp) + addl $-16, %esp + fstpl (%esp) + fstpt 80(%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.183: + fldt 80(%esp) + movl 96(%esp), %edx + addl $16, %esp + fxch %st(1) + fstl (%esp) + fstpt 36(%esp) + addl $-16, %esp + fstpt (%esp) + movl %edx, 96(%esp) + call lgammaf_pos +..B2.182: + movl 96(%esp), %edx + addl $16, %esp + fsubl (%esp) +..B2.103: + testl %edx, %edx + je ..B2.105 +..B2.104: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.184: + fldt 16(%esp) + addl $16, %esp +..B2.105: + fstps 76(%esp) + testl %esi, %esi + je ..B2.107 +..B2.106: + fldcw 90(%esp) +..B2.107: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.108: + cmpl $1091567616, %edi + jae ..B2.119 +..B2.109: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.147 +..B2.110: + fld %st(0) +..B2.111: + fmul %st(2), %st + fxch %st(1) + fadd %st, %st(2) + fcom %st(2) + fnstsw %ax + sahf + fxch %st(1) + ja ..B2.111 +..B2.112: + fstp %st(1) + fstpt 36(%esp) +..B2.113: + andb $127, 45(%esp) + fldt 36(%esp) + addl $-16, %esp + fstpl (%esp) + fstpt 80(%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.186: + fldt 80(%esp) + movl 96(%esp), %edx + addl $16, %esp + fxch %st(1) + fstpt 36(%esp) + fldt 36(%esp) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fstpt 16(%esp) + movl %edx, 96(%esp) + call lgammaf_pos +..B2.185: + fldt 16(%esp) + movl 96(%esp), %edx + addl $16, %esp + testl %edx, %edx + je ..B2.116 +..B2.114: + fstp %st(0) + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.187: + fldt 16(%esp) + addl $16, %esp +..B2.115: + fldt 36(%esp) +..B2.116: + testl %esi, %esi + fsubrp %st, %st(1) + fstps 76(%esp) + je ..B2.118 +..B2.117: + fldcw 90(%esp) +..B2.118: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.119: + flds .L_2il0floatpacket.5@GOTOFF(%ebx) + cmpl $1174405120, %edi + jb ..B2.125 +..B2.120: + fldt _LN_SQRT_TWO_PI@GOTOFF(%ebx) + fstpt 24(%esp) + addl $-16, %esp + fld %st(1) + fchs + fstpl (%esp) + fstps 16(%esp) + fstpt 80(%esp) + fldt 80(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + movl %edx, 96(%esp) + fsubrp %st, %st(1) + fstpt 24(%esp) + call log@PLT +..B2.189: + fldt 80(%esp) + flds 16(%esp) + fldt 24(%esp) + movl 96(%esp), %edx + addl $16, %esp + fmulp %st, %st(3) + fsts 76(%esp) + fldt 24(%esp) + fsubrp %st, %st(3) + fxch %st(1) + fsubr %st, %st(2) + fchs + flds 76(%esp) + fldl _S16@GOTOFF(%ebx) + fxch %st(1) + fsubs 8(%ebp) + fstps 76(%esp) + flds 76(%esp) + fsubp %st, %st(3) + fxch %st(2) + fstps 76(%esp) + flds 76(%esp) + fsubrp %st, %st(1) + fstpt 52(%esp) + fldt 52(%esp) + fmul %st(0), %st + fmul %st, %st(1) + andb $127, 61(%esp) + fxch %st(1) + faddl _S14@GOTOFF(%ebx) + fmul %st(1), %st + faddl _S12@GOTOFF(%ebx) + fmul %st(1), %st + faddl _S10@GOTOFF(%ebx) + fmul %st(1), %st + faddl _S08@GOTOFF(%ebx) + fmul %st(1), %st + faddl _S06@GOTOFF(%ebx) + fmul %st(1), %st + faddl _S04@GOTOFF(%ebx) + fmul %st(1), %st + faddl _S02@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fsubrp %st, %st(1) + fldt 52(%esp) + addl $-16, %esp + fstpl (%esp) + fstpt 24(%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.188: + fldt 24(%esp) + movl 96(%esp), %edx + addl $16, %esp + testl %edx, %edx + fxch %st(1) + je ..B2.122 +..B2.121: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpl 16(%esp) + fstpt 24(%esp) + call fesetround +..B2.190: + fldt 24(%esp) + fldl 16(%esp) + addl $16, %esp +..B2.122: + testl %esi, %esi + fsubrp %st, %st(1) + fstps 76(%esp) + je ..B2.124 +..B2.123: + fldcw 90(%esp) +..B2.124: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.125: + fld %st(0) + fsub %st(2), %st + fstps 76(%esp) + flds 76(%esp) + fsubp %st, %st(1) + fstps 76(%esp) + fld %st(0) + fchs + fstpt 40(%esp) + fldt 40(%esp) + fxch %st(1) + fchs + flds 76(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 52(%esp) + fldt 52(%esp) + fmul %st(0), %st + fstpt 24(%esp) + addl $-16, %esp + fstpl (%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.193: + movl 96(%esp), %edx + fchs + fldt 56(%esp) + fstpt (%esp) + fstpt 24(%esp) + movl %edx, 96(%esp) + call lgammaf_pos +..B2.192: + fldt 24(%esp) + movl 96(%esp), %edx + fsubp %st, %st(1) + addl $16, %esp + fldt 24(%esp) + fld %st(0) + fmul %st(1), %st + fldl _S14@GOTOFF(%ebx) + fmul %st(1), %st + fldl _S16@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _S10@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _S12@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _S06@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _S08@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl _S02@GOTOFF(%ebx) + fmulp %st, %st(3) + faddl _S04@GOTOFF(%ebx) + fmulp %st, %st(1) + andb $127, 61(%esp) + faddp %st, %st(1) + fstpt 36(%esp) + fldt 36(%esp) + fsubrp %st, %st(1) + fldt 52(%esp) + addl $-16, %esp + fstpl (%esp) + fstpt 24(%esp) + movl %edx, 96(%esp) + call log@PLT +..B2.191: + fldt 24(%esp) + movl 96(%esp), %edx + addl $16, %esp + testl %edx, %edx + fxch %st(1) + je ..B2.127 +..B2.126: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + fstpl 16(%esp) + fstpt 24(%esp) + call fesetround +..B2.194: + fldt 24(%esp) + fldl 16(%esp) + addl $16, %esp +..B2.127: + testl %esi, %esi + fsubrp %st, %st(1) + fstps 76(%esp) + je ..B2.129 +..B2.128: + fldcw 90(%esp) +..B2.129: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.130: + fstp %st(0) + testl %esi, %esi + je ..B2.132 +..B2.131: + fldcw 90(%esp) +..B2.132: + testl %edx, %edx + je ..B2.134 +..B2.133: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.195: + addl $16, %esp +..B2.134: + fldz + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.135: + fstp %st(0) + testl %esi, %esi + je ..B2.137 +..B2.136: + fldcw 90(%esp) +..B2.137: + testl %edx, %edx + je ..B2.139 +..B2.138: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.196: + addl $16, %esp +..B2.139: + fldz + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.140: + testl %edx, %edx + je ..B2.142 +..B2.141: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.197: + addl $16, %esp +..B2.142: + fldl _PBIG@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(0), %st + fstps 76(%esp) + je ..B2.144 +..B2.143: + fldcw 90(%esp) +..B2.144: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.145: + fstpt 36(%esp) + jmp ..B2.85 +..B2.146: + fstpt 36(%esp) + jmp ..B2.102 +..B2.147: + fstpt 36(%esp) + jmp ..B2.113 +..B2.148: + fstp %st(0) + testl %edx, %edx + je ..B2.150 +..B2.149: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.198: + addl $16, %esp +..B2.150: + fld1 + movl $0, 76(%esp) + testl %esi, %esi + flds 76(%esp) + fdivrp %st, %st(1) + fstps 76(%esp) + je ..B2.152 +..B2.151: + fldcw 90(%esp) +..B2.152: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.153: + cmpl $0, (%esp) + je ..B2.155 +..B2.154: + movl 12(%esp), %eax + movl $-1, (%eax) + jmp ..B2.156 +..B2.155: + movl 12(%esp), %eax + movl $1, (%eax) +..B2.156: + testl %edx, %edx + je ..B2.158 +..B2.157: + addl $-16, %esp + movl 100(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.199: + addl $16, %esp +..B2.158: + fld1 + movl $0, 76(%esp) + testl %esi, %esi + flds 76(%esp) + fdivrp %st, %st(1) + fstps 76(%esp) + je ..B2.160 +..B2.159: + fldcw 90(%esp) +..B2.160: + flds 76(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.161: + xorl %esi, %esi + jmp ..B2.12 + .align 16,0x90 + .type __libm_lgammaf,@function + .size __libm_lgammaf,.-__libm_lgammaf + .data +# -- End __libm_lgammaf + .text +# -- Begin lgammaf_pos + .text + .align 16,0x90 +lgammaf_pos: +# parameter 1: 8 + %ebp +..B3.1: +..L5: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + fldt 8(%ebp) + fstl (%esp) + movzwl 6(%esp), %edx + andl $32752, %edx + shrl $4, %edx + movl 4(%esp), %eax + shll $20, %edx + andl $1048575, %eax + orl %eax, %edx + call ..L6 +..L6: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L6](%ecx), %ecx + cmpl $1074790400, %edx + jb ..B3.3 +..B3.2: + addl $-1074790400, %edx + sarl $20, %edx + movl %edx, %eax + shll $6, %eax + flds _A@GOTOFF(%ecx,%edx,4) + fsubrp %st, %st(1) + fmuls _B@GOTOFF(%ecx,%edx,4) + lea (%edx,%edx,2), %edx + fld %st(0) + fmul %st(1), %st + fldl _C5@GOTOFF(%eax,%ecx) + fmul %st(1), %st + fldl 8+_C5@GOTOFF(%ecx,%eax) + fmul %st(2), %st + fxch %st(1) + faddl 32+_C5@GOTOFF(%ecx,%eax) + fmul %st(2), %st + fxch %st(1) + faddl 40+_C5@GOTOFF(%ecx,%eax) + fmul %st(2), %st + fxch %st(1) + faddl _C5_0@GOTOFF(%ecx,%edx,8) + fmul %st(2), %st + fxch %st(1) + faddl 8+_C5_0@GOTOFF(%ecx,%edx,8) + fmul %st(2), %st + fxch %st(1) + faddl 48+_C5@GOTOFF(%ecx,%eax) + fmul %st(2), %st + fxch %st(1) + faddl 56+_C5@GOTOFF(%ecx,%eax) + fmul %st(2), %st + fxch %st(1) + faddl 16+_C5@GOTOFF(%ecx,%eax) + fmulp %st, %st(2) + faddl 24+_C5@GOTOFF(%ecx,%eax) + fmulp %st, %st(2) + faddl 16+_C5_0@GOTOFF(%ecx,%edx,8) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.3: + cmpl $1073741824, %edx + jne ..B3.5 +..B3.4: + fstp %st(0) + fldt .L_2il0floatpacket.7@GOTOFF(%ecx) + movl %ebp, %esp + popl %ebp + ret +..B3.5: + jbe ..B3.7 +..B3.6: + fldl _C4@GOTOFF(%ecx) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fldl 8+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 32+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 40+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 64+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 72+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 48+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 56+_C4@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 16+_C4@GOTOFF(%ecx) + fmulp %st, %st(1) + fxch %st(1) + faddl 24+_C4@GOTOFF(%ecx) + fmul %st(2), %st + fxch %st(1) + faddl 80+_C4@GOTOFF(%ecx) + faddp %st, %st(1) + fldt .L_2il0floatpacket.6@GOTOFF(%ecx) + fsubrp %st, %st(2) + fmulp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.7: + cmpl $1073479680, %edx + jb ..B3.9 +..B3.8: + fldl 8+_C3@GOTOFF(%ecx) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fldl 16+_C3@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 40+_C3@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 48+_C3@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 24+_C3@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 32+_C3@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 56+_C3@GOTOFF(%ecx) + fmulp %st, %st(1) + fxch %st(1) + faddl 64+_C3@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl _C3@GOTOFF(%ecx) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.9: + cmpl $1073217536, %edx + jb ..B3.11 +..B3.10: + fldl 8+_LGAMMAF_C2@GOTOFF(%ecx) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fldl 16+_LGAMMAF_C2@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 40+_LGAMMAF_C2@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 48+_LGAMMAF_C2@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 24+_LGAMMAF_C2@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 32+_LGAMMAF_C2@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 56+_LGAMMAF_C2@GOTOFF(%ecx) + fmulp %st, %st(1) + fxch %st(1) + faddl 64+_LGAMMAF_C2@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl _LGAMMAF_C2@GOTOFF(%ecx) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.11: + cmpl $1072955392, %edx + jb ..B3.13 +..B3.12: + fldl _LM@GOTOFF(%ecx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl 8+_C1@GOTOFF(%ecx) + fmul %st(1), %st + fldl 16+_C1@GOTOFF(%ecx) + fmul %st(2), %st + fxch %st(1) + faddl 40+_C1@GOTOFF(%ecx) + fmul %st(2), %st + fxch %st(1) + faddl 48+_C1@GOTOFF(%ecx) + fmul %st(2), %st + fxch %st(1) + faddl 24+_C1@GOTOFF(%ecx) + fmul %st(2), %st + fxch %st(1) + faddl 32+_C1@GOTOFF(%ecx) + fmul %st(2), %st + fxch %st(1) + faddl 56+_C1@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl 64+_C1@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl _C1@GOTOFF(%ecx) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.13: + cmpl $1072693248, %edx + jb ..B3.15 +..B3.14: + fldl 8+_C0@GOTOFF(%ecx) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fldl 16+_C0@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 40+_C0@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 48+_C0@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 24+_C0@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 32+_C0@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(2) + faddl 56+_C0@GOTOFF(%ecx) + fmulp %st, %st(1) + fxch %st(1) + faddl 64+_C0@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl _C0@GOTOFF(%ecx) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B3.15: + fstp %st(0) + fldz +..B3.16: + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type lgammaf_pos,@function + .size lgammaf_pos,.-lgammaf_pos + .data +# -- End lgammaf_pos + .text +# -- Begin gammaf + .text + .align 16,0x90 + .globl gammaf +gammaf: +# parameter 1: 32 + %esp +..B4.1: +..L7: + + subl $20, %esp + lea 8(%esp), %eax + pushl %eax + pushl 28(%esp) + call __libm_lgammaf +..B4.2: + addl $28, %esp + ret + .align 16,0x90 + .type gammaf,@function + .size gammaf,.-gammaf + .data +# -- End gammaf + .text +# -- Begin lgammaf_r + .text + .align 16,0x90 + .globl lgammaf_r +lgammaf_r: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +..B5.1: +..L8: + + jmp __libm_lgammaf + .align 16,0x90 + .type lgammaf_r,@function + .size lgammaf_r,.-lgammaf_r + .data +# -- End lgammaf_r + .text +# -- Begin gammaf_r + .text + .align 16,0x90 + .globl gammaf_r +gammaf_r: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +..B6.1: +..L9: + + jmp __libm_lgammaf + .align 16,0x90 + .type gammaf_r,@function + .size gammaf_r,.-gammaf_r + .data +# -- End gammaf_r + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +_LN_SQRT_TWO_PI: + .word 42293 + .word 9717 + .word 36419 + .word 60223 + .word 16382 + .word 0 + .type _LN_SQRT_TWO_PI,@object + .size _LN_SQRT_TWO_PI,12 + .space 4, 0x00 # pad + .align 16 +_A: + .long 1082130432 + .long 1090519040 + .long 1098907648 + .long 1107296256 + .long 1115684864 + .long 1124073472 + .long 1132462080 + .long 1140850688 + .long 1149239296 + .long 1157627904 + .long 1166016512 + .type _A,@object + .size _A,44 + .space 4, 0x00 # pad + .align 16 +_B: + .long 1048576000 + .long 1040187392 + .long 1031798784 + .long 1023410176 + .long 1015021568 + .long 1006632960 + .long 998244352 + .long 989855744 + .long 981467136 + .long 973078528 + .long 964689920 + .type _B,@object + .size _B,44 + .space 4, 0x00 # pad + .align 16 +_C5: + .long 2219950285 + .long 1064025046 + .long 657069815 + .long 3214307011 + .long 2744833897 + .long 1073883684 + .long 3746154693 + .long 1075058958 + .long 24044097 + .long 1068577021 + .long 1852002888 + .long 3217117620 + .long 426096126 + .long 1071550305 + .long 3945160253 + .long 3219869968 + .long 889741930 + .long 1064529657 + .long 2918550257 + .long 3214927323 + .long 3306758232 + .long 1074858655 + .long 2801363753 + .long 1076895752 + .long 216130741 + .long 1069082446 + .long 2022127190 + .long 3217667546 + .long 4043317980 + .long 1072274701 + .long 948933764 + .long 3220711872 + .long 1837011561 + .long 1065353117 + .long 614133169 + .long 3215620106 + .long 128884864 + .long 1075872424 + .long 1749057555 + .long 1078324632 + .long 1278187959 + .long 1069867493 + .long 1878987920 + .long 3218464301 + .long 2508500615 + .long 1073176520 + .long 3716705454 + .long 3221664954 + .long 1971591775 + .long 1066198339 + .long 3489274850 + .long 3216507307 + .long 2978044890 + .long 1076904104 + .long 399657850 + .long 1079744937 + .long 2176842243 + .long 1070795947 + .long 1642919051 + .long 3219397359 + .long 325839939 + .long 1074155724 + .long 1189620011 + .long 3222667808 + .long 583706808 + .long 1067149757 + .long 1974968851 + .long 3217478792 + .long 3433705325 + .long 1077944360 + .long 3946626575 + .long 1081121452 + .long 1495561758 + .long 1071787114 + .long 4062466621 + .long 3220390645 + .long 1556755231 + .long 1075170624 + .long 75679593 + .long 3223694033 + .long 3504606470 + .long 1068150172 + .long 1348305099 + .long 3218489288 + .long 3580634696 + .long 1078988808 + .long 1259291510 + .long 1082352761 + .long 652214916 + .long 1072807425 + .long 4143445962 + .long 3221412067 + .long 2123749472 + .long 1076202613 + .long 4248403985 + .long 3224731560 + .long 1507106795 + .long 1069174188 + .long 3519298167 + .long 3219518582 + .long 3633366982 + .long 1080035328 + .long 2867629808 + .long 1083583554 + .long 3975256969 + .long 1073841792 + .long 2533063588 + .long 3222447083 + .long 3711656185 + .long 1077242956 + .long 3206083648 + .long 3225774644 + .long 4129446490 + .long 1070209876 + .long 3121668168 + .long 3220557159 + .long 3645659330 + .long 1081082878 + .long 1254870306 + .long 1084814091 + .long 1589013900 + .long 1074883091 + .long 485315198 + .long 3223488795 + .long 402512060 + .long 1078287430 + .long 1922980292 + .long 3226820482 + .long 157052617 + .long 1071251449 + .long 2992469705 + .long 3221600396 + .long 1492808525 + .long 1082130942 + .long 3131814131 + .long 1086044499 + .long 2683002247 + .long 1075927855 + .long 2649378904 + .long 3224533843 + .long 3018380877 + .long 1079333956 + .long 653917322 + .long 3227867691 + .long 2713966257 + .long 1072296037 + .long 4209563533 + .long 3222646006 + .long 943575735 + .long 1083179262 + .long 512478091 + .long 1087274844 + .long 3856346814 + .long 1076974372 + .long 1324813592 + .long 3225580569 + .long 1409229319 + .long 1080381507 + .long 3787450294 + .long 3228915583 + .long 3333539597 + .long 1073342203 + .long 2943809629 + .long 3223692845 + .long 794946536 + .long 1084227710 + .long 1068889795 + .long 1088463522 + .long 3231716378 + .long 1078021787 + .long 4072054083 + .long 3226628144 + .long 1998042203 + .long 1081429569 + .long 1148344549 + .long 3229963818 + .type _C5,@object + .size _C5,704 + .align 16 +_C5_0: + .long 2415979356 + .long 1070304454 + .long 2697119297 + .long 3218348439 + .long 4195263586 + .long 1073523467 + .long 3725211212 + .long 1070931684 + .long 2560716363 + .long 3219131775 + .long 4079479268 + .long 1075907809 + .long 1732432466 + .long 1071796064 + .long 3508892908 + .long 3219947991 + .long 2788858919 + .long 1077667382 + .long 2647999156 + .long 1072759450 + .long 547175205 + .long 3220886396 + .long 4254853098 + .long 1079215590 + .long 2099688739 + .long 1073767129 + .long 1386213411 + .long 3221881825 + .long 1373988558 + .long 1080631372 + .long 3012547841 + .long 1074795638 + .long 3012018428 + .long 3222904295 + .long 3968063321 + .long 1082046682 + .long 2372211290 + .long 1075829504 + .long 1852200321 + .long 3223939920 + .long 822603622 + .long 1083320025 + .long 2940107565 + .long 1076868074 + .long 1118670349 + .long 3224982033 + .long 4034033966 + .long 1084551076 + .long 3328910691 + .long 1077911588 + .long 4065388177 + .long 3226027369 + .long 3374537656 + .long 1085781831 + .long 3604631852 + .long 1078957575 + .long 786281660 + .long 3227074315 + .long 3320933858 + .long 1087012393 + .long 4128496013 + .long 1080004805 + .long 820316847 + .long 3228122065 + .long 596318476 + .long 1088242837 + .type _C5_0,@object + .size _C5_0,264 + .space 8, 0x00 # pad + .align 16 +_C4: + .long 951661919 + .long 3199388794 + .long 406044492 + .long 1057185581 + .long 2144499589 + .long 3220511658 + .long 1533861631 + .long 1073519965 + .long 4190848711 + .long 3208779382 + .long 4195628742 + .long 1064581106 + .long 501584638 + .long 3218581252 + .long 4276665641 + .long 1072296199 + .long 2679252139 + .long 3214810152 + .long 1146917984 + .long 1069511714 + .long 3597634954 + .long 3220184694 + .type _C4,@object + .size _C4,88 + .space 8, 0x00 # pad + .align 16 +_C3: + .long 953601802 + .long 1073782987 + .long 53392282 + .long 1061851682 + .long 2280564131 + .long 3213671573 + .long 126074441 + .long 1073190208 + .long 1099663909 + .long 3221770684 + .long 2017365083 + .long 1069271442 + .long 1709742889 + .long 3219105406 + .long 4029656968 + .long 1074967560 + .long 3888843833 + .long 3222480972 + .type _C3,@object + .size _C3,72 + .space 8, 0x00 # pad + .align 16 +_LGAMMAF_C2: + .long 4192182476 + .long 1073863432 + .long 3945858175 + .long 1063638439 + .long 2616885214 + .long 3215216300 + .long 3886441432 + .long 1074077679 + .long 3758761250 + .long 3222447567 + .long 984616456 + .long 1070653784 + .long 2508733349 + .long 3220210863 + .long 2272977058 + .long 1075337602 + .long 3074119607 + .long 3222665277 + .type _LGAMMAF_C2,@object + .size _LGAMMAF_C2,72 + .space 8, 0x00 # pad + .align 16 +_C1: + .long 3166931522 + .long 3216972217 + .long 900077338 + .long 1065586189 + .long 3591574455 + .long 3213040571 + .long 425993680 + .long 1068534592 + .long 2772351024 + .long 3217220647 + .long 3693139651 + .long 1066567133 + .long 2619486276 + .long 3214985484 + .long 3371509884 + .long 1071576875 + .long 2931564028 + .long 1032391485 + .type _C1,@object + .size _C1,72 + .space 8, 0x00 # pad + .align 16 +_LM: + .long 1666629183 + .long 1073177304 + .type _LM,@object + .size _LM,8 + .space 8, 0x00 # pad + .align 16 +_C0: + .long 561403216 + .long 1074066324 + .long 3155481408 + .long 1068272863 + .long 4228834524 + .long 3219267730 + .long 2107372888 + .long 1076349696 + .long 3392182390 + .long 3224133636 + .long 3282054928 + .long 1074040136 + .long 4253763640 + .long 3223020498 + .long 1528000942 + .long 1076400076 + .long 4059292707 + .long 3223275314 + .type _C0,@object + .size _C0,72 + .space 8, 0x00 # pad + .align 16 +_LRIB: + .long 2838661661 + .long 3221617475 + .long 169597185 + .long 3221617473 + .long 1795500005 + .long 3221617470 + .long 3503748181 + .long 3222250619 + .long 1417424869 + .long 3222250609 + .long 2147483648 + .long 3222250589 + .type _LRIB,@object + .size _LRIB,48 + .align 16 +_LRP: + .long 3272807679 + .long 3224639578 + .long 1009311715 + .long 1076045439 + .long 2835657108 + .long 3221135661 + .long 817526409 + .long 1017707397 + .long 2658191496 + .long 3232572725 + .long 2929834182 + .long 1081046750 + .long 2523682372 + .long 3224680861 + .long 915934040 + .long 3166559235 + .type _LRP,@object + .size _LRP,64 + .align 16 +_RRIB: + .long 890743176 + .long 3221465087 + .long 2516645996 + .long 3221465084 + .long 4142548816 + .long 3221465081 + .long 1538591435 + .long 3221825040 + .long 3164494255 + .long 3221825037 + .long 495429779 + .long 3221825035 + .type _RRIB,@object + .size _RRIB,48 + .align 16 +_RRP: + .long 93164946 + .long 1073124518 + .long 2953029931 + .long 1075015403 + .long 1722766176 + .long 1073233897 + .long 1830807661 + .long 1016083003 + .long 308861496 + .long 1079775543 + .long 2541562915 + .long 1077531858 + .long 1596959842 + .long 1075781798 + .long 3819862626 + .long 1021220357 + .type _RRP,@object + .size _RRP,64 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .align 4 +.L_2il0floatpacket.0: + .long 0xcb400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x40000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0xc0200000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +.L_2il0floatpacket.5: + .long 0x4b400000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,4 + .align 4 +_S16: + .long 2760304672 + .long 3218442033 + .type _S16,@object + .size _S16,8 + .align 4 +_S14: + .long 3264091561 + .long 3215213868 + .type _S14,@object + .size _S14,8 + .align 4 +_S12: + .long 1381164920 + .long 3217582605 + .type _S12,@object + .size _S12,8 + .align 4 +_S10: + .long 3387828299 + .long 3217636872 + .type _S10,@object + .size _S10,8 + .align 4 +_S08: + .long 3786959951 + .long 3218084854 + .type _S08,@object + .size _S08,8 + .align 4 +_S06: + .long 2675586079 + .long 3218453489 + .type _S06,@object + .size _S06,8 + .align 4 +_S04: + .long 1432133341 + .long 3219214642 + .type _S04,@object + .size _S04,8 + .align 4 +_S02: + .long 1648889397 + .long 3220853158 + .type _S02,@object + .size _S02,8 + .align 4 +_PBIG: + .long 2139095039 + .long 2139095039 + .type _PBIG,@object + .size _PBIG,8 + .data + .hidden fesetround + .hidden fegetround + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lgammal.S b/external/sgx_libm/ia32/lgammal.S new file mode 100644 index 0000000000..ff23a64296 --- /dev/null +++ b/external/sgx_libm/ia32/lgammal.S @@ -0,0 +1,8398 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lgammal.c" + .text +..TXTST0: +# -- Begin lgammal + .text + .align 16,0x90 + .globl lgammal +lgammal: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + subl $28, %esp + fldt 32(%esp) + lea 16(%esp), %eax + fstpt (%esp) + movl %eax, 12(%esp) + call __libm_lgammal +..B1.2: + addl $28, %esp + ret + .align 16,0x90 + .type lgammal,@function + .size lgammal,.-lgammal + .data +# -- End lgammal + .text +# -- Begin __libm_lgammal + .text + .align 16,0x90 +__libm_lgammal: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B2.1: +..L2: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + movl 20(%ebp), %eax + movl %eax, 44(%esp) + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 232(%esp) +..B2.2: + fnstcw 182(%esp) +..B2.3: + call fegetround +..B2.291: + movl %eax, 140(%esp) +..B2.4: + cmpl $0, 140(%esp) + jne ..B2.6 +..B2.5: + xorl %edi, %edi + jmp ..B2.8 +..B2.6: + addl $-16, %esp + movl $0, (%esp) + call fesetround +..B2.292: + addl $16, %esp +..B2.7: + movl $1, %edi +..B2.8: + movzwl 182(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.288 +..B2.9: + orl $-64768, %edx + movw %dx, 180(%esp) +..B2.10: + fldcw 180(%esp) +..B2.11: + movl $1, %esi +..B2.12: + movzbl 17(%ebp), %eax + movl %eax, (%esp) + andl $128, %eax + shrl $7, %eax + call ..L3 +..L3: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L3](%ebx), %ebx + movzwl 16(%ebp), %edx + andl $32767, %edx + flds ones@GOTOFF(%ebx,%eax,4) + shll $15, %eax + movl 12(%ebp), %ecx + orl %edx, %eax + movl %ecx, 8(%esp) + shll $16, %eax + shrl $16, %ecx + orl %ecx, %eax + movl %eax, 4(%esp) + cmpl $32767, %edx + je ..B2.273 +..B2.13: + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fucom %st(1) + fnstsw %ax + sahf + jp ..B2.14 + je ..B2.266 +..B2.14: + fldt _OFW_BOUND@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jb ..B2.258 +..B2.15: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fucom %st(2) + fnstsw %ax + sahf + jp ..B2.16 + je ..B2.249 +..B2.16: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fstpt 168(%esp) + fldt 168(%esp) + fucomp %st(3) + fnstsw %ax + sahf + jp ..B2.17 + je ..B2.249 +..B2.17: + cmpl $0, 4(%esp) + jl ..B2.241 +..B2.18: + cmpl $16382, %edx + jl ..B2.177 +..B2.19: + cmpl $16463, %edx + jge ..B2.170 +..B2.20: + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B2.160 +..B2.21: + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jae ..B2.121 + jp ..B2.121 +..B2.22: + fstp %st(3) + movl 4(%esp), %eax + andl $2147483647, %eax + cmpl $1073659904, %eax + jl ..B2.112 +..B2.23: + fcom %st(1) + fnstsw %ax + sahf + jae ..B2.26 + jp ..B2.26 +..B2.24: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B2.26 +..B2.25: + fstp %st(0) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + movl 44(%esp), %eax + movl $1, (%eax) + jmp ..B2.29 +..B2.26: + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fcom %st(2) + fnstsw %ax + sahf + jae ..B2.39 + jp ..B2.39 +..B2.27: + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B2.39 +..B2.28: + fstp %st(1) + movl 44(%esp), %eax + movl $1, (%eax) +..B2.29: + fcomp %st(1) + fnstsw %ax + lea 2100+_ldbA@GOTOFF(%ebx), %edx + sahf + lea 480+_dbA@GOTOFF(%ebx), %ecx + jae ..B2.31 + jp ..B2.31 +..B2.30: + fstp %st(1) + fldt 168(%esp) + addl $176, %ecx + addl $84, %edx + fsubrp %st, %st(1) + jmp ..B2.32 +..B2.31: + fsubrp %st, %st(1) +..B2.32: + fldl _TWO_32H@GOTOFF(%ebx) + fld %st(1) + fmul %st(1), %st + fld %st(2) + testl %edi, %edi + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(2) + fsub %st(1), %st + fldl 88(%ecx) + fmul %st(4), %st + fldt (%edx) + fldt 36(%edx) + fldt 12(%edx) + fxch %st(3) + faddl 104(%ecx) + fmul %st(7), %st + faddl 96(%ecx) + fmul %st(7), %st + faddl 80(%ecx) + fmul %st(7), %st + faddl 152(%ecx) + fmul %st(7), %st + faddl 120(%ecx) + fmul %st(7), %st + faddl 112(%ecx) + fmul %st(7), %st + faddl 136(%ecx) + fmul %st(7), %st + faddl 128(%ecx) + fmul %st(7), %st + faddl 40(%ecx) + fmul %st(7), %st + faddl 32(%ecx) + fmul %st(7), %st + faddl 56(%ecx) + fmul %st(7), %st + faddl 48(%ecx) + fmul %st(7), %st + faddl 144(%ecx) + fmul %st(7), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(1) + fmul %st(5), %st + faddp %st, %st(1) + fmul %st(4), %st + fldt 48(%edx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 24(%edx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 60(%edx) + faddp %st, %st(1) + fmul %st(4), %st + fld %st(3) + fldt 72(%edx) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + fmul %st(6), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fldl (%ecx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(5) + fmul %st(2), %st + fxch %st(1) + faddl 72(%ecx) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 16(%ecx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl 168(%ecx) + faddp %st, %st(2) + fld %st(5) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 64(%ecx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl 8(%ecx) + faddp %st, %st(2) + fld %st(5) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 160(%ecx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(6) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddl 24(%ecx) + faddp %st, %st(1) + fld %st(1) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(2) + fmul %st(4), %st + fxch %st(1) + fsub %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 4(%esp) + fldt 4(%esp) + fxch %st(1) + je ..B2.35 +..B2.33: + fstp %st(1) + fstp %st(0) + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.293: + addl $16, %esp +..B2.34: + fldt 4(%esp) + fldt 16(%esp) +..B2.35: + testl %esi, %esi + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.37 +..B2.36: + fldcw 182(%esp) +..B2.37: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.38: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.39: + fstp %st(0) + fcom %st(1) + fnstsw %ax + sahf + jae ..B2.48 + jp ..B2.48 +..B2.40: + fldt 168(%esp) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B2.48 +..B2.41: + fstp %st(2) + fstp %st(1) + movl 44(%esp), %eax + addl $-32, %esp + lea 832+_dbA@GOTOFF(%ebx), %edx + lea 36(%esp), %ecx + movl $1, (%eax) + lea 2268+_ldbA@GOTOFF(%ebx), %eax + fldt (%eax) + addl $12, %eax + fsubrp %st, %st(1) + fstpt (%esp) + call __libm_p25 +..B2.294: + addl $32, %esp +..B2.42: + testl %edi, %edi + je ..B2.44 +..B2.43: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.295: + addl $16, %esp +..B2.44: + fldt 4(%esp) + testl %esi, %esi + fldt 16(%esp) + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.46 +..B2.45: + fldcw 182(%esp) +..B2.46: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.47: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.48: + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.103 +..B2.49: + fldt .L_2il0floatpacket.14@GOTOFF(%ebx) + fcom %st(2) + fnstsw %ax + sahf + jae ..B2.58 + jp ..B2.58 +..B2.50: + fstp %st(0) + fldt .L_2il0floatpacket.15@GOTOFF(%ebx) + fcom %st(2) + fnstsw %ax + sahf + jbe ..B2.58 +..B2.51: + fstp %st(3) + fstp %st(0) + movl 44(%esp), %eax + addl $-32, %esp + fsubp %st, %st(1) + movl $-1, (%eax) + lea 2568+_ldbA@GOTOFF(%ebx), %eax + fstpt (%esp) + lea 1360+_dbA@GOTOFF(%ebx), %edx + lea 36(%esp), %ecx + call __libm_p25 +..B2.296: + addl $32, %esp +..B2.52: + testl %edi, %edi + je ..B2.54 +..B2.53: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.297: + addl $16, %esp +..B2.54: + fldt 4(%esp) + testl %esi, %esi + fldt 16(%esp) + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.56 +..B2.55: + fldcw 182(%esp) +..B2.56: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.57: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.58: + fstp %st(0) + addl $-16, %esp + fxch %st(1) + fstpt (%esp) + fldt (%esp) + movl %edx, 16(%esp) + fxch %st(2) + fstpt 144(%esp) + fstpt 160(%esp) + fstpt 48(%esp) + call nearbyintl@PLT +..B2.298: + fldt 48(%esp) + movl 16(%esp), %edx + fucom %st(1) + fnstsw %ax + fldt 160(%esp) + fldt 144(%esp) + addl $16, %esp + sahf + jp ..B2.59 + je ..B2.205 +..B2.59: + fldt .L_2il0floatpacket.17@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + ja ..B2.71 + jp ..B2.71 +..B2.60: + fldt .L_2il0floatpacket.18@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jb ..B2.71 +..B2.61: + fstp %st(3) + fldt .L_2il0floatpacket.19@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jae ..B2.63 + jp ..B2.63 +..B2.62: + movl 44(%esp), %eax + movl $-1, (%eax) + jmp ..B2.64 +..B2.63: + movl 44(%esp), %eax + movl $1, (%eax) +..B2.64: + fxch %st(2) + faddp %st, %st(1) + fstpt 84(%esp) + fldt 84(%esp) + fld %st(0) + movzbl 93(%esp), %eax + andl $128, %eax + fmul %st(1), %st + shrl $7, %eax + fstpt 72(%esp) + fld %st(0) + fchs + fstpt (%esp) + addl $-32, %esp + fmuls ones@GOTOFF(%ebx,%eax,4) + lea 216(%esp), %edx + fstpt (%esp) + fstpt 12(%esp) + movl %edx, 24(%esp) + call __libm_logl_k80 +..B2.299: + fstp %st(0) + addl $32, %esp +..B2.65: + fldt 84(%esp) + testl %edi, %edi + fldt (%esp) + fldl 1560+_dbA@GOTOFF(%ebx) + fmul %st(2), %st + fldt 2700+_ldbA@GOTOFF(%ebx) + fldt 2688+_ldbA@GOTOFF(%ebx) + fldt 2676+_ldbA@GOTOFF(%ebx) + fldt 2664+_ldbA@GOTOFF(%ebx) + fldt 2736+_ldbA@GOTOFF(%ebx) + fxch %st(5) + faddl 1552+_dbA@GOTOFF(%ebx) + fmul %st(7), %st + faddl 1544+_dbA@GOTOFF(%ebx) + fmul %st(7), %st + faddl 1536+_dbA@GOTOFF(%ebx) + fmul %st(7), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fmulp %st, %st(3) + fldl 1568+_dbA@GOTOFF(%ebx) + fmul %st(2), %st + fldt 72(%esp) + fldt 2748+_ldbA@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(3) + fmul %st, %st(2) + fxch %st(1) + faddl 1576+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + fldt 2724+_ldbA@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddl 1584+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + faddl 1592+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + faddl 1600+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + faddl 1608+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + faddl 1616+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + faddl 1624+_dbA@GOTOFF(%ebx) + fmul %st(3), %st + fmul %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fstpt 208(%esp) + fldt 208(%esp) + faddp %st, %st(3) + fldt 2712+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fsubp %st, %st(1) + je ..B2.67 +..B2.66: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.300: + fldt 16(%esp) + addl $16, %esp +..B2.67: + fldt 196(%esp) + testl %esi, %esi + fsubrp %st, %st(1) + fldt 184(%esp) + fsubrp %st, %st(1) + fstpt 116(%esp) + je ..B2.69 +..B2.68: + fldcw 182(%esp) +..B2.69: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.70: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.71: + fstp %st(0) + fxch %st(2) + fnstcw (%esp) + movzwl (%esp), %eax + orl $3072, %eax + movl %eax, 8(%esp) + fldcw 8(%esp) + fistl 16(%esp) + fldcw (%esp) + fld %st(1) + movl 16(%esp), %ecx + fsubp %st, %st(1) + negl %ecx + lea -2(%ecx), %eax + movl %eax, 12(%esp) + andl $1, %ecx + jne ..B2.74 +..B2.72: + fcom %st(2) + fnstsw %ax + sahf + jae ..B2.75 + jp ..B2.75 +..B2.73: + movl 44(%esp), %eax + movl $-1, (%eax) + jmp ..B2.76 +..B2.74: + jne ..B2.202 +..B2.75: + movl 44(%esp), %eax + movl $1, (%eax) +..B2.76: + fldt .L_2il0floatpacket.20@GOTOFF(%ebx) + movl 12(%esp), %ecx + fcomp %st(2) + fnstsw %ax + sahf + fcom %st(2) + fnstsw %ax + jae ..L4 + jp ..L4 + movl $0, %ecx +..L4: + sahf + movl $17, %eax + ja ..L5 + movl $0, %eax +..L5: + addl %eax, %ecx + movl %ecx, 12(%esp) + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %eax + fldt 636+_ldbA@GOTOFF(%eax,%ebx) + lea (%ecx,%ecx,2), %ecx + fsubr %st(2), %st + fldt 1068+_ldbA@GOTOFF(%ebx,%ecx,8) + fcomp %st(3) + fnstsw %ax + sahf + jae ..B2.86 + jp ..B2.86 +..B2.77: + fldt 1080+_ldbA@GOTOFF(%ebx,%ecx,8) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B2.86 +..B2.79: + fstp %st(2) + fstp %st(2) + movl 12(%esp), %edx + addl $-32, %esp + lea (,%edx,4), %eax + fstpt (%esp) + lea (%edx,%edx,4), %edx + shll $5, %edx + lea 3360(%eax,%eax,8), %ecx + fstpt 32(%esp) + lea _ldbA@GOTOFF(%ebx,%ecx), %eax + lea 240(%esp), %ecx + lea 2432+_dbA@GOTOFF(%ebx,%edx), %edx + call __libm_p19root +..B2.301: + fldt 32(%esp) + addl $32, %esp +..B2.80: + testl %edi, %edi + je ..B2.82 +..B2.81: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.302: + fldt 16(%esp) + addl $16, %esp +..B2.82: + fldt 208(%esp) + testl %esi, %esi + fldt 220(%esp) + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.344 +..B2.83: + fstpt 84(%esp) +..B2.303: + fldcw 182(%esp) + jmp ..B2.84 +..B2.344: + fstp %st(0) +..B2.84: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.85: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.86: + fstp %st(0) + fstpt 84(%esp) +..B2.87: + lea -16382(%edx), %ecx + cmpl $2, %ecx + jne ..B2.89 +..B2.88: + fldt .L_2il0floatpacket.21@GOTOFF(%ebx) + addl $-16380, %edx + fcomp %st(1) + fnstsw %ax + sahf + jbe ..L6 + movl %edx, %ecx +..L6: +..B2.89: + fldt .L_2il0floatpacket.19@GOTOFF(%ebx) + movl %ecx, %eax + fmul %st, %st(1) + lea (,%ecx,8), %edx + shll $7, %eax + fxch %st(1) + fstpt 156(%esp) + subl %edx, %eax + fxch %st(1) + fstpt 144(%esp) + lea (%ecx,%ecx,4), %edx + fldt .L_2il0floatpacket.16@GOTOFF(%ebx) + movzwl 164(%esp), %ecx + fldt 2868+_ldbA@GOTOFF(%ebx,%eax) + andl $-32768, %ecx + fldt 2856+_ldbA@GOTOFF(%ebx,%eax) + orl $-49153, %ecx + fldt 2820+_ldbA@GOTOFF(%ebx,%eax) + fldt 2808+_ldbA@GOTOFF(%ebx,%eax) + movw %cx, 164(%esp) + fldt 156(%esp) + shll $5, %edx + fsubp %st, %st(5) + fxch %st(4) + fstpt 156(%esp) + fldt 156(%esp) + fldl 1784+_dbA@GOTOFF(%ebx,%edx) + fmul %st(1), %st + fldt 2844+_ldbA@GOTOFF(%ebx,%eax) + fxch %st(1) + faddl 1776+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1768+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1760+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1752+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1744+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1736+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1728+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1720+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1712+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1704+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddl 1696+_dbA@GOTOFF(%ebx,%edx) + fmul %st(2), %st + faddp %st, %st(5) + fxch %st(1) + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 2832+_ldbA@GOTOFF(%ebx,%eax) + faddp %st, %st(3) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(1), %st + fldt 2796+_ldbA@GOTOFF(%ebx,%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 2784+_ldbA@GOTOFF(%ebx,%eax) + faddp %st, %st(1) + fmul %st(1), %st + fld %st(1) + fldt 2772+_ldbA@GOTOFF(%ebx,%eax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 2760+_ldbA@GOTOFF(%ebx,%eax) + faddp %st, %st(1) + fldl _TWO_32H@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fstpt 48(%esp) + fldt 48(%esp) + fld %st(2) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(2), %st + fxch %st(1) + fsubr %st, %st(3) + fld %st(3) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(6) + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(3) + fstpt 16(%esp) + fldt 16(%esp) + fldl 1632+_dbA@GOTOFF(%ebx,%edx) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + fld %st(4) + fxch %st(1) + faddl 1640+_dbA@GOTOFF(%ebx,%edx) + faddp %st, %st(3) + fld %st(1) + fmul %st(5), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fld %st(4) + fmul %st(4), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(2) + fldl 1680+_dbA@GOTOFF(%ebx,%edx) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + fld %st(4) + fxch %st(1) + faddl 1688+_dbA@GOTOFF(%ebx,%edx) + faddp %st, %st(3) + fld %st(1) + fmul %st(5), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fld %st(4) + fmul %st(4), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(2) + fldl 1664+_dbA@GOTOFF(%ebx,%edx) + fld %st(0) + fadd %st(5), %st + fmul %st, %st(2) + fxch %st(2) + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(5) + fld %st(1) + fadd %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(4) + faddl 1672+_dbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fxch %st(3) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fldl 1648+_dbA@GOTOFF(%ebx,%edx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fldt 8(%ebp) + fmulp %st, %st(4) + faddl 1656+_dbA@GOTOFF(%ebx,%edx) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + addl $-32, %esp + lea 240(%esp), %eax + fxch %st(1) + fstpt (%esp) + fldt -64(%eax) + fstpt 12(%esp) + fldt 12(%esp) + movl %eax, 24(%esp) + fxch %st(1) + fstpt 64(%esp) + fstpt -64(%eax) + call __libm_logl_k80 +..B2.304: + fstp %st(0) + fldt 176(%esp) + fldt 64(%esp) + addl $32, %esp +..B2.90: + fldt 84(%esp) + movzbl 93(%esp), %eax + addl $-32, %esp + andl $128, %eax + lea 216(%esp), %edx + shrl $7, %eax + fmuls ones@GOTOFF(%ebx,%eax,4) + fstpt (%esp) + fldt (%esp) + fxch %st(2) + fstpt 12(%esp) + movl %edx, 24(%esp) + fxch %st(1) + fstpt 80(%esp) + fstpt 64(%esp) + call __libm_logl_k80 +..B2.305: + fstp %st(0) + fldt 64(%esp) + fldt 80(%esp) + addl $32, %esp +..B2.91: + fldt 16(%esp) + fld %st(1) + fmul %st(1), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(2) + fsub %st(1), %st + fxch %st(3) + fmul %st(0), %st + fldt 408+_ldbA@GOTOFF(%ebx) + fmul %st(1), %st + fldt 396+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 384+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 372+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 360+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 348+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 336+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 324+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 312+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 300+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 288+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 276+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 264+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 252+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fld %st(3) + fldt 240+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(2) + fldt 228+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 168(%esp) + fmulp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fxch %st(5) + fmul %st(0), %st + faddp %st, %st(5) + fld %st(2) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fld %st(1) + fxch %st(3) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(6) + fld %st(4) + fmul %st(2), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(1) + fld %st(3) + fmul %st(3), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(2) + fmul %st(5), %st + faddp %st, %st(1) + fldl 64+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(4) + fmul %st(3), %st + fxch %st(1) + faddl 72+_dbA@GOTOFF(%ebx) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(3), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fldl 48+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddl 56+_dbA@GOTOFF(%ebx) + faddp %st, %st(2) + fld %st(0) + fadd %st(4), %st + fsubp %st, %st(4) + fsub %st(3), %st + faddp %st, %st(1) + fld %st(1) + fmul %st(3), %st + fxch %st(3) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fld %st(3) + fldt (%esp) + faddp %st, %st(2) + fxch %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fldt 208(%esp) + fld %st(0) + fxch %st(1) + fadd %st, %st(3) + fldt 220(%esp) + movzbl 81(%esp), %edx + fadd %st, %st(2) + fxch %st(2) + fstpt 60(%esp) + fldt 60(%esp) + andl $128, %edx + movzbl 69(%esp), %ecx + andl $128, %ecx + shrl $7, %edx + shrl $7, %ecx + fxch %st(3) + fmuls ones@GOTOFF(%ebx,%edx,4) + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(3) + fmuls ones@GOTOFF(%ebx,%ecx,4) + fstpt 60(%esp) + fldt 60(%esp) + fcomp %st(3) + fnstsw %ax + fxch %st(2) + fstp %st(0) + sahf + jae ..B2.93 + jp ..B2.93 +..B2.92: + fxch %st(2) + fsubr %st, %st(5) + fxch %st(1) + faddp %st, %st(5) + fldt (%esp) + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + jmp ..B2.94 +..B2.93: + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(5) + faddp %st, %st(4) + fldt (%esp) + faddp %st, %st(4) +..B2.94: + fldt 184(%esp) + fld %st(2) + fadd %st(1), %st + fchs + fadd %st, %st(1) + fxch %st(1) + fchs + fsubp %st, %st(3) + fldt 196(%esp) + fsubrp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fld %st(2) + fadd %st(2), %st + fstpt 72(%esp) + fldt 72(%esp) + fld %st(1) + movzbl 81(%esp), %edx + fsubr %st(4), %st + andl $128, %edx + shrl $7, %edx + flds ones@GOTOFF(%ebx,%edx,4) + fmulp %st, %st(2) + fxch %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fld %st(2) + fadd %st(6), %st + fstpt 60(%esp) + fldt 60(%esp) + movzbl 69(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + flds ones@GOTOFF(%ebx,%ecx,4) + fmulp %st, %st(1) + fxch %st(1) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.96 +..B2.95: + fxch %st(1) + fsubr %st, %st(4) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(2) + fxch %st(1) + jmp ..B2.97 +..B2.96: + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(4) + fxch %st(4) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) +..B2.97: + testl %edi, %edi + je ..B2.99 +..B2.98: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 32(%esp) + fstpt 48(%esp) + call fesetround +..B2.306: + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + addl $16, %esp +..B2.99: + testl %esi, %esi + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.345 +..B2.100: + fstpt 60(%esp) +..B2.307: + fldcw 182(%esp) + jmp ..B2.101 +..B2.345: + fstp %st(0) +..B2.101: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.102: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.103: + fstp %st(2) + fstp %st(1) + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + lea 1008+_dbA@GOTOFF(%ebx), %ecx + movl 44(%esp), %eax + cmpl $16385, %edx + movl %ecx, (%esp) + fmul %st, %st(1) + movl $1, (%eax) + lea 2376+_ldbA@GOTOFF(%ebx), %eax + jne ..B2.105 +..B2.104: + fmul %st, %st(1) + addl $96, %eax + addl $176, (%esp) +..B2.105: + fstp %st(0) + fldt .L_2il0floatpacket.16@GOTOFF(%ebx) + addl $-32, %esp + fsubrp %st, %st(1) + fstpt (%esp) + lea 36(%esp), %ecx + movl 32(%esp), %edx + call __libm_p25 +..B2.308: + addl $32, %esp +..B2.106: + testl %edi, %edi + je ..B2.108 +..B2.107: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.309: + addl $16, %esp +..B2.108: + fldt 4(%esp) + testl %esi, %esi + fldt 16(%esp) + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.110 +..B2.109: + fldcw 182(%esp) +..B2.110: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.111: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.112: + fstp %st(2) + fstp %st(1) + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fld %st(1) + cmpl $0, 4(%esp) + lea 1908+_ldbA@GOTOFF(%ebx), %eax + lea 128+_dbA@GOTOFF(%ebx), %edx + fsub %st(1), %st + jl ..B2.214 +..B2.113: + fstp %st(1) + fstp %st(1) + movl 44(%esp), %ecx + movl $1, (%ecx) +..B2.114: + addl $-32, %esp + lea 36(%esp), %ecx + fstpt (%esp) + call __libm_p25 +..B2.310: + addl $32, %esp +..B2.115: + testl %edi, %edi + je ..B2.117 +..B2.116: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.311: + addl $16, %esp +..B2.117: + fldt 4(%esp) + testl %esi, %esi + fldt 16(%esp) + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.119 +..B2.118: + fldcw 182(%esp) +..B2.119: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.120: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.121: + addl $-16, %esp + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fxch %st(2) + fstpt 144(%esp) + fxch %st(2) + fstps 44(%esp) + fxch %st(1) + fstpt 160(%esp) + fstpt 48(%esp) + call nearbyintl@PLT +..B2.312: + fldt 48(%esp) + fld %st(0) + fsub %st(2), %st + fldt 160(%esp) + fucom %st(1) + fnstsw %ax + flds 44(%esp) + fldt 144(%esp) + addl $16, %esp + sahf + jp ..B2.122 + je ..B2.223 +..B2.122: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fcomp %st(5) + fnstsw %ax + sahf + jae ..B2.139 + jp ..B2.139 +..B2.123: + fxch %st(5) + fnstcw (%esp) + movzwl (%esp), %eax + orl $3072, %eax + movl %eax, 8(%esp) + fldcw 8(%esp) + fistl 16(%esp) + fldcw (%esp) + movl 16(%esp), %edx + fxch %st(3) + fcom %st(2) + fnstsw %ax + movl %edx, 12(%esp) + negl %edx + lea -2(%edx), %ecx + addl $15, %edx + sahf + ja ..L7 + movl %ecx, %edx +..L7: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt 636+_ldbA@GOTOFF(%ecx,%ebx) + lea (%edx,%edx,2), %ecx + fsubr %st(5), %st + fldt 1068+_ldbA@GOTOFF(%ebx,%ecx,8) + fcomp %st(6) + fnstsw %ax + sahf + jae ..B2.137 + jp ..B2.137 +..B2.124: + fldt 1080+_ldbA@GOTOFF(%ebx,%ecx,8) + fcomp %st(6) + fnstsw %ax + sahf + jbe ..B2.137 +..B2.125: + fstp %st(6) + fstp %st(3) + fstp %st(3) + fstp %st(2) + movl 12(%esp), %eax + negl %eax + andl $1, %eax + movl %eax, 12(%esp) + jne ..B2.128 +..B2.126: + fcom %st(1) + fnstsw %ax + sahf + jae ..B2.129 + jp ..B2.129 +..B2.127: + fstp %st(1) + movl 44(%esp), %eax + movl $-1, (%eax) + jmp ..B2.130 +..B2.128: + cmpl $0, 12(%esp) + jne ..B2.216 +..B2.129: + fstp %st(1) + movl 44(%esp), %eax + movl $1, (%eax) +..B2.130: + addl $-32, %esp + lea (,%edx,4), %eax + lea (%edx,%edx,4), %edx + shll $5, %edx + lea 3360(%eax,%eax,8), %ecx + lea _ldbA@GOTOFF(%ebx,%ecx), %eax + fxch %st(1) + fstpt (%esp) + lea 240(%esp), %ecx + fstpt 32(%esp) + lea 2432+_dbA@GOTOFF(%ebx,%edx), %edx + call __libm_p19root +..B2.313: + fldt 32(%esp) + addl $32, %esp +..B2.131: + testl %edi, %edi + je ..B2.133 +..B2.132: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.314: + fldt 16(%esp) + addl $16, %esp +..B2.133: + fldt 208(%esp) + testl %esi, %esi + fldt 220(%esp) + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.346 +..B2.134: + fstpt 84(%esp) +..B2.315: + fldcw 182(%esp) + jmp ..B2.135 +..B2.346: + fstp %st(0) +..B2.135: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.136: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.137: + fstp %st(0) + fstpt 84(%esp) + fldt 84(%esp) + fxch %st(5) + fxch %st(3) + fxch %st(5) + jmp ..B2.140 +..B2.139: + fxch %st(3) + fstpt 84(%esp) + fldt 84(%esp) +..B2.140: + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + fmul %st, %st(6) + fstpt 96(%esp) + addl $-16, %esp + fxch %st(5) + fstpt (%esp) + fldt (%esp) + fstpt 32(%esp) + fxch %st(4) + fstpt 16(%esp) + fxch %st(1) + fstpt 144(%esp) + fxch %st(2) + fstps 44(%esp) + fxch %st(1) + fstpt 160(%esp) + fstpt 48(%esp) + call nearbyintl@PLT +..B2.316: + fldt 48(%esp) + fldt 160(%esp) + flds 44(%esp) + fldt 144(%esp) + fldt 16(%esp) + fldt 32(%esp) + addl $16, %esp + fucomp %st(6) + fnstsw %ax + fxch %st(5) + fstp %st(0) + sahf + jp ..B2.141 + je ..B2.220 +..B2.141: + fxch %st(4) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B2.143 +..B2.142: + movl 44(%esp), %eax + movl $-1, (%eax) + jmp ..B2.144 +..B2.143: + movl 44(%esp), %eax + movl $1, (%eax) +..B2.144: + fmulp %st, %st(2) + fxch %st(1) + fstpt 156(%esp) + fldt 156(%esp) + addl $-32, %esp + lea 240(%esp), %eax + fstpt (%esp) + fstpt 12(%esp) + fldt 12(%esp) + movl %eax, 24(%esp) + fxch %st(1) + fstpt -80(%eax) + fstpt -64(%eax) + call __libm_logl_k80 +..B2.317: + fstp %st(0) + fldt 176(%esp) + fldt 160(%esp) + addl $32, %esp +..B2.145: + fldt 156(%esp) + lea 420+_ldbA@GOTOFF(%ebx), %ecx + fld %st(0) + fld %st(1) + fxch %st(4) + fstpt 144(%esp) + lea 80+_dbA@GOTOFF(%ebx), %edx + fxch %st(2) + fstpt 128(%esp) + fldt 128(%esp) + fldl _TWO_32H@GOTOFF(%ebx) + fstpt (%esp) + fldt (%esp) + fmul %st, %st(3) + fxch %st(3) + fadd %st, %st(4) + fsubrp %st, %st(4) + fxch %st(3) + fstpt 48(%esp) + fldt 48(%esp) + fld %st(1) + fsub %st(1), %st + fldt 208(%esp) + fldt 96(%esp) + fld %st(0) + fmul %st(2), %st + fstpt 112(%esp) + fxch %st(6) + fsubrp %st, %st(1) + fmul %st, %st(4) + fxch %st(4) + fstpt 72(%esp) + fldt 72(%esp) + fld %st(4) + fadd %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fsubr %st, %st(5) + fmul %st(2), %st + fldt 220(%esp) + fmul %st, %st(7) + faddp %st, %st(6) + fxch %st(4) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fld %st(0) + fldt 112(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + fldt 144(%esp) + fldt 128(%esp) + sahf + jbe ..B2.147 +..B2.146: + addl $108, %ecx + addl $16, %edx +..B2.147: + fldt (%esp) + fld %st(0) + fld %st(4) + movzbl 93(%esp), %eax + fadd %st(6), %st + fdivr %st(3), %st + andl $128, %eax + fmul %st, %st(1) + fld %st(5) + fxch %st(5) + fstpt 144(%esp) + fld %st(1) + shrl $7, %eax + fadd %st(1), %st + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(5) + fxch %st(3) + fsubrp %st, %st(5) + fsub %st(2), %st + fld %st(0) + fadd %st(3), %st + fmul %st, %st(6) + fxch %st(1) + fmul %st, %st(4) + fxch %st(6) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + fsubrp %st, %st(3) + fld %st(0) + fadd %st(3), %st + fmul %st(0), %st + fldt 96(%ecx) + fmul %st(1), %st + fldt 84(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl (%edx) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(4) + fld %st(0) + fadd %st(5), %st + fsubp %st, %st(5) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(4), %st + fstpt 208(%esp) + fldt 208(%esp) + fxch %st(2) + fsub %st(4), %st + fxch %st(4) + fmul %st(5), %st + fxch %st(1) + faddl 8(%edx) + faddp %st, %st(4) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 220(%esp) + fldt 220(%esp) + fldl 112+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddl 120+_dbA@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt 96(%esp) + fldt 84(%esp) + addl $-32, %esp + fmuls ones@GOTOFF(%ebx,%eax,4) + lea 216(%esp), %edx + fstpt (%esp) + fldt (%esp) + fldt -40(%edx) + fstpt 12(%esp) + movl %edx, 24(%esp) + fstpt -72(%edx) + fstpt -56(%edx) + call __libm_logl_k80 +..B2.318: + fstp %st(0) + fldt 160(%esp) + fldt 144(%esp) + addl $32, %esp +..B2.148: + fldt (%esp) + fld %st(1) + fmul %st(1), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(2) + fsub %st(1), %st + fxch %st(3) + fmul %st(0), %st + fldt 408+_ldbA@GOTOFF(%ebx) + fmul %st(1), %st + fldt 396+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 384+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 372+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 360+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 348+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 336+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 324+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 312+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 300+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 288+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 276+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 264+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 252+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 240+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fldt 228+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fld %st(3) + fmul %st(1), %st + fldt 168(%esp) + fmulp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fxch %st(5) + fmul %st(0), %st + faddp %st, %st(5) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fld %st(2) + fxch %st(2) + fsub %st(4), %st + faddp %st, %st(6) + fld %st(4) + fmul %st(3), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fmul %st(5), %st + fld %st(3) + fmul %st(3), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fldl 64+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fxch %st(1) + faddl 72+_dbA@GOTOFF(%ebx) + faddp %st, %st(3) + fld %st(4) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(1) + fldl 48+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(2) + fsub %st(4), %st + fld %st(3) + fmul %st(5), %st + fxch %st(5) + fmul %st(6), %st + fxch %st(3) + faddl 56+_dbA@GOTOFF(%ebx) + faddp %st, %st(2) + faddp %st, %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(4) + fadd %st(3), %st + fstpt 48(%esp) + fldt 48(%esp) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 96(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 184(%esp) + fld %st(0) + fchs + fldt 32(%esp) + fld %st(0) + fadd %st(3), %st + fstpt 116(%esp) + fldt 116(%esp) + fxch %st(1) + fcomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + fldt 196(%esp) + sahf + jbe ..B2.150 +..B2.149: + fldt 32(%esp) + fsub %st(2), %st + faddp %st, %st(3) + fldt 16(%esp) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + jmp ..B2.151 +..B2.150: + fldt 32(%esp) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 16(%esp) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) +..B2.151: + movzbl 125(%esp), %edx + fld %st(0) + movzbl 57(%esp), %ecx + andl $128, %edx + andl $128, %ecx + fadd %st(2), %st + shrl $7, %edx + shrl $7, %ecx + flds ones@GOTOFF(%ebx,%edx,4) + fmul %st(2), %st + fstpt 72(%esp) + fldt 72(%esp) + flds ones@GOTOFF(%ebx,%ecx,4) + fmul %st(4), %st + fxch %st(1) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.153 +..B2.152: + fldt 32(%esp) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + jmp ..B2.154 +..B2.153: + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt 32(%esp) + faddp %st, %st(2) +..B2.154: + testl %edi, %edi + je ..B2.156 +..B2.155: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 32(%esp) + fstpt 48(%esp) + call fesetround +..B2.319: + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + addl $16, %esp +..B2.156: + testl %esi, %esi + faddp %st, %st(1) + fchs + fstpt 116(%esp) + je ..B2.347 +..B2.157: + fstpt 60(%esp) +..B2.320: + fldcw 182(%esp) + jmp ..B2.158 +..B2.347: + fstp %st(0) +..B2.158: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.159: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.160: + fstp %st(3) + movl 44(%esp), %eax + addl $-32, %esp + lea 240(%esp), %edx + movl $1, (%eax) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %edx, 24(%esp) + fstpt -80(%edx) + call __libm_logl_k80 +..B2.321: + fstp %st(0) + fldt 160(%esp) + addl $32, %esp +..B2.161: + fldt 8(%ebp) + lea 420+_ldbA@GOTOFF(%ebx), %ecx + fld %st(0) + fld %st(1) + fxch %st(3) + fstpt 128(%esp) + fldt 128(%esp) + fld %st(2) + fldl _TWO_32H@GOTOFF(%ebx) + lea 80+_dbA@GOTOFF(%ebx), %edx + fmul %st, %st(3) + fxch %st(3) + fadd %st, %st(5) + fsubrp %st, %st(5) + fxch %st(4) + fstpt 32(%esp) + fldt 32(%esp) + fsubr %st, %st(4) + fxch %st(2) + fstpt 48(%esp) + fldt 48(%esp) + fldt 208(%esp) + fld %st(0) + fxch %st(3) + fsubrp %st, %st(1) + fmul %st, %st(1) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fld %st(1) + fadd %st(1), %st + fstpt (%esp) + fldt (%esp) + fsubp %st, %st(1) + fmul %st, %st(5) + fsubr %st, %st(1) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + fstpt 64(%esp) + fldt 220(%esp) + fmul %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(5) + fmulp %st, %st(2) + fld %st(1) + fldt 64(%esp) + fadd %st, %st(1) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 128(%esp) + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B2.163 +..B2.162: + addl $108, %ecx + addl $16, %edx +..B2.163: + fldt 32(%esp) + testl %edi, %edi + fsubr %st, %st(3) + fxch %st(4) + fstpt 64(%esp) + fld %st(3) + fadd %st(3), %st + fdivr %st(1), %st + fxch %st(2) + fstpt 80(%esp) + fldt 48(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + fadd %st(4), %st + fsubp %st, %st(1) + fsubr %st, %st(3) + fld %st(3) + fadd %st(1), %st + fmul %st, %st(5) + fld %st(6) + fmul %st(5), %st + faddp %st, %st(6) + fxch %st(1) + fmul %st, %st(6) + fxch %st(3) + fsubrp %st, %st(6) + fxch %st(4) + faddp %st, %st(5) + fxch %st(4) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fmul %st(0), %st + fldt 96(%ecx) + fmul %st(1), %st + fldt 84(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl (%edx) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(1) + fsub %st(4), %st + fld %st(3) + fmul %st(5), %st + fstpt 208(%esp) + fldt 208(%esp) + fxch %st(3) + fmul %st, %st(5) + fxch %st(2) + faddl 8(%edx) + faddp %st, %st(1) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 220(%esp) + fldt 220(%esp) + fldl 112+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt 64(%esp) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fxch %st(1) + faddl 120+_dbA@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 80(%esp) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + je ..B2.166 +..B2.164: + fstpt 116(%esp) + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 80(%esp) + call fesetround +..B2.322: + fldt 80(%esp) + addl $16, %esp +..B2.165: + fldt 116(%esp) +..B2.166: + testl %esi, %esi + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.168 +..B2.167: + fldt 32(%esp) + fstpt 48(%esp) + fldt (%esp) + fstpt 60(%esp) + fldt 16(%esp) + fstpt 72(%esp) +..B2.323: + fldcw 182(%esp) +..B2.168: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.169: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.170: + fstp %st(3) + movl 44(%esp), %eax + addl $-32, %esp + lea 240(%esp), %edx + movl $1, (%eax) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %edx, 24(%esp) + fstpt -80(%edx) + call __libm_logl_k80 +..B2.324: + fstp %st(0) + fldt 160(%esp) + addl $32, %esp +..B2.171: + fldt 8(%ebp) + testl %edi, %edi + fldt 12+_TWO5600@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_32H@GOTOFF(%ebx) + fld %st(0) + fmul %st(2), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fsubr %st(2), %st + fldt 208(%esp) + fsubp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fld %st(4) + fadd %st(1), %st + fld %st(0) + fsub %st(2), %st + fmul %st, %st(3) + fxch %st(6) + fstpt 208(%esp) + fldt 208(%esp) + fsub %st(6), %st + fldt 220(%esp) + faddp %st, %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + fmul %st, %st(4) + fxch %st(2) + fxch %st(3) + fxch %st(4) + fxch %st(1) + je ..B2.173 +..B2.172: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 32(%esp) + fstpt 48(%esp) + fstpt 64(%esp) + fstpt 80(%esp) + call fesetround +..B2.325: + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + addl $16, %esp +..B2.173: + fldt _TWO5600@GOTOFF(%ebx) + testl %esi, %esi + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 116(%esp) + je ..B2.348 +..B2.174: + fstpt 48(%esp) + fstpt 60(%esp) + fstpt 72(%esp) +..B2.326: + fldcw 182(%esp) + jmp ..B2.175 +..B2.348: + fstp %st(2) + fstp %st(1) + fstp %st(0) +..B2.175: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.176: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.177: + fstp %st(0) + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B2.179 +..B2.178: + movl 44(%esp), %eax + movl $-1, (%eax) + jmp ..B2.180 +..B2.179: + movl 44(%esp), %eax + movl $1, (%eax) +..B2.180: + fxch %st(2) + fmulp %st, %st(1) + addl $-32, %esp + fstpt (%esp) + fldt (%esp) + lea 240(%esp), %eax + fxch %st(1) + fstpt 12(%esp) + movl %eax, 24(%esp) + movl %edx, 32(%esp) + fstpt 64(%esp) + call __libm_logl_k80 +..B2.327: + fstp %st(0) + fldt 64(%esp) + movl 32(%esp), %edx + addl $32, %esp +..B2.181: + cmpl $16313, %edx + jge ..B2.188 +..B2.182: + fldt 208(%esp) + testl %edi, %edi + fldt 220(%esp) + faddp %st, %st(1) + fchs + fstpt 116(%esp) + je ..B2.184 +..B2.183: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 48(%esp) + call fesetround +..B2.328: + fldt 48(%esp) + addl $16, %esp +..B2.184: + testl %esi, %esi + je ..B2.349 +..B2.185: + fstpt 156(%esp) +..B2.329: + fldcw 182(%esp) + jmp ..B2.186 +..B2.349: + fstp %st(0) +..B2.186: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.187: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.188: + fldt 216+_ldbA@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(1) + fstpt 156(%esp) + fldt 156(%esp) + fldt 204+_ldbA@GOTOFF(%ebx) + cmpl $0, 4(%esp) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 192+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 180+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 156+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 132+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 120+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 108+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 96+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 84+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 72+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 60+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 48+_ldbA@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fld %st(0) + fldt 36+_ldbA@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fld %st(0) + fldt 24+_ldbA@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fldt 12+_ldbA@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt _ldbA@GOTOFF(%ebx) + faddp %st, %st(4) + fld %st(3) + fldl _TWO_32H@GOTOFF(%ebx) + fld %st(0) + fmul %st(6), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st, %st(3) + fxch %st(3) + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(1) + fsub %st(4), %st + fld %st(5) + fsub %st(2), %st + fmul %st(5), %st + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fxch %st(1) + fmul %st(4), %st + fxch %st(3) + fstpt 48(%esp) + fldt 48(%esp) + fldl 32+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + fld %st(1) + fmul %st(5), %st + fxch %st(1) + faddl 40+_dbA@GOTOFF(%ebx) + faddp %st, %st(3) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fmul %st(5), %st + fld %st(2) + fmul %st(6), %st + fxch %st(3) + fmul %st(7), %st + faddp %st, %st(1) + fxch %st(4) + fmul %st(6), %st + faddp %st, %st(4) + fldl 16+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl 24+_dbA@GOTOFF(%ebx) + faddp %st, %st(5) + fld %st(1) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(5) + faddp %st, %st(3) + fld %st(2) + fmul %st(6), %st + fxch %st(5) + fmul %st(7), %st + faddp %st, %st(5) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(4) + fldl _dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(2) + fxch %st(2) + fstpt 104(%esp) + fldt 104(%esp) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fstpt 88(%esp) + fldt 88(%esp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(2) + fmul %st(7), %st + fxch %st(3) + faddl 8+_dbA@GOTOFF(%ebx) + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fld %st(0) + fmul %st(5), %st + faddp %st, %st(2) + fmulp %st, %st(5) + faddp %st, %st(4) + fldt 208(%esp) + jl ..B2.234 +..B2.189: + fstp %st(1) + fldt 220(%esp) + fld %st(2) + testl %edi, %edi + fsub %st(2), %st + fadd %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fxch %st(2) + je ..B2.192 +..B2.190: + fstpt 116(%esp) + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 32(%esp) + fstpt 48(%esp) + call fesetround +..B2.330: + fldt 48(%esp) + fldt 32(%esp) + addl $16, %esp +..B2.191: + fldt 116(%esp) +..B2.192: + testl %esi, %esi + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.350 +..B2.193: + fldt 104(%esp) + fstpt 72(%esp) + fstpt 48(%esp) + fldt 88(%esp) + fstpt 60(%esp) +..B2.331: + fldcw 182(%esp) + jmp ..B2.194 +..B2.350: + fstp %st(0) +..B2.194: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 +..B2.195: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.196: + fstp %st(0) + call __stack_chk_fail@PLT +..B2.202: + fcom %st(2) + fnstsw %ax + sahf + ja ..B2.73 + jmp ..B2.75 +..B2.205: + fstp %st(0) + fstp %st(2) + fstp %st(0) + fstp %st(0) + movl 44(%esp), %eax + testl %edi, %edi + movl $1, (%eax) + je ..B2.207 +..B2.206: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.332: + addl $16, %esp +..B2.207: + fld1 + fldz + testl %esi, %esi + fdivrp %st, %st(1) + fstpt 116(%esp) + je ..B2.209 +..B2.208: + fldcw 182(%esp) +..B2.209: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.214: + fstp %st(0) + movl 44(%esp), %ecx + addl $176, %edx + addl $96, %eax + faddp %st, %st(1) + movl $-1, (%ecx) + jmp ..B2.114 +..B2.216: + fcom %st(1) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jbe ..B2.218 +..B2.217: + movl 44(%esp), %eax + movl $-1, (%eax) + jmp ..B2.130 +..B2.218: + movl 44(%esp), %eax + movl $1, (%eax) + jmp ..B2.130 +..B2.220: + fxch %st(4) + fcomp %st(2) + fnstsw %ax + sahf + jae ..B2.143 + jp ..B2.143 + jmp ..B2.142 +..B2.223: + fstp %st(0) + fstp %st(4) + fstp %st(2) + fstp %st(1) + fstp %st(1) + movl 44(%esp), %eax + testl %edi, %edi + movl $1, (%eax) + je ..B2.225 +..B2.224: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B2.333: + fldt 16(%esp) + addl $16, %esp +..B2.225: + fld1 + fldz + testl %esi, %esi + fdivrp %st, %st(1) + fstpt 116(%esp) + je ..B2.351 +..B2.226: + fstpt 84(%esp) +..B2.334: + fldcw 182(%esp) + jmp ..B2.227 +..B2.351: + fstp %st(0) +..B2.227: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.234: + fldt 408+_ldbA@GOTOFF(%ebx) + testl %edi, %edi + fxch %st(1) + fstpt 16(%esp) + fld %st(1) + fsub %st(4), %st + fxch %st(2) + fmul %st(0), %st + fmul %st, %st(1) + fxch %st(5) + fstpt (%esp) + fxch %st(3) + fstpt 32(%esp) + fldt 32(%esp) + fldt 396+_ldbA@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 384+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 372+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 360+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 348+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 336+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 324+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 312+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 300+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 288+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 276+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 264+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 252+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 240+_ldbA@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt 228+_ldbA@GOTOFF(%ebx) + faddp %st, %st(4) + fld %st(3) + fld %st(3) + fmul %st(4), %st + fldt 168(%esp) + fmulp %st, %st(5) + fxch %st(2) + fmul %st, %st(4) + fmul %st(0), %st + faddp %st, %st(4) + fld %st(1) + fldt 48(%esp) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(6) + fld %st(0) + fmul %st(7), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(6) + fmul %st(5), %st + fld %st(3) + fmul %st(7), %st + faddp %st, %st(1) + fxch %st(5) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(5) + fldl 64+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl 72+_dbA@GOTOFF(%ebx) + faddp %st, %st(6) + fld %st(1) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fld %st(2) + fmul %st(5), %st + fxch %st(5) + fmul %st(6), %st + fld %st(3) + fmul %st(3), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(2) + fldl 48+_dbA@GOTOFF(%ebx) + fld %st(0) + fadd %st(6), %st + fmul %st, %st(2) + fsubr %st, %st(1) + fxch %st(6) + faddp %st, %st(1) + faddl 56+_dbA@GOTOFF(%ebx) + faddp %st, %st(2) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(5), %st + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(4) + faddp %st, %st(3) + fld %st(0) + fldt 16(%esp) + fadd %st, %st(1) + fxch %st(1) + fchs + fadd %st, %st(1) + fxch %st(1) + fchs + fsubp %st, %st(2) + fldt 220(%esp) + fsubrp %st, %st(2) + fldt (%esp) + fsubrp %st, %st(2) + fld %st(0) + fsub %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fchs + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fldt 32(%esp) + fxch %st(2) + fxch %st(1) + je ..B2.236 +..B2.235: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 32(%esp) + fstpt 48(%esp) + call fesetround +..B2.335: + fldt 48(%esp) + fldt 32(%esp) + fldt 16(%esp) + addl $16, %esp +..B2.236: + testl %esi, %esi + faddp %st, %st(1) + fstpt 116(%esp) + je ..B2.352 +..B2.237: + fldt 104(%esp) + fstpt 72(%esp) + fstpt 48(%esp) + fldt 88(%esp) + fstpt 60(%esp) +..B2.336: + fldcw 182(%esp) + jmp ..B2.238 +..B2.352: + fstp %st(0) +..B2.238: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.241: + cmpl $16446, %edx + jle ..B2.18 +..B2.242: + fstp %st(0) + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl 44(%esp), %eax + testl %edi, %edi + movl $1, (%eax) + je ..B2.244 +..B2.243: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.337: + addl $16, %esp +..B2.244: + fld1 + fldz + testl %esi, %esi + fdivrp %st, %st(1) + fstpt 116(%esp) + je ..B2.246 +..B2.245: + fldcw 182(%esp) +..B2.246: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.249: + fstp %st(0) + fstp %st(1) + fstp %st(1) + movl 44(%esp), %eax + movl $1, (%eax) +..B2.250: + testl %edi, %edi + je ..B2.252 +..B2.251: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + fstpt 160(%esp) + call fesetround +..B2.338: + fldt 160(%esp) + addl $16, %esp +..B2.252: + fstpt 116(%esp) + testl %esi, %esi + je ..B2.254 +..B2.253: + fldcw 182(%esp) +..B2.254: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.258: + fstp %st(0) + fstp %st(1) + movl 44(%esp), %eax + testl %edi, %edi + movl $1, (%eax) + je ..B2.261 +..B2.259: + fstp %st(0) + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.339: + addl $16, %esp +..B2.260: + fldt 8(%ebp) +..B2.261: + fld %st(0) + testl %esi, %esi + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 116(%esp) + je ..B2.263 +..B2.262: + fldcw 182(%esp) +..B2.263: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.266: + fstp %st(1) + fstp %st(0) + fstp %st(0) + testl %edi, %edi + je ..B2.268 +..B2.267: + movl 44(%esp), %eax + addl $-16, %esp + movl 156(%esp), %edx + movl $1, (%eax) + movl %edx, (%esp) + call fesetround +..B2.340: + movzbl 17(%ebp), %eax + addl $16, %esp + movl %eax, (%esp) +..B2.268: + fld1 + fldz + fdivrp %st, %st(1) + movl (%esp), %eax + andl $128, %eax + shrl $7, %eax + movl 44(%esp), %edx + addl %eax, %eax + negl %eax + incl %eax + fstpt 116(%esp) + testl %esi, %esi + movl %eax, (%edx) + je ..B2.270 +..B2.269: + fldcw 182(%esp) +..B2.270: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.273: + fstp %st(0) + cmpl $-2147483648, 8(%esp) + jne ..B2.275 +..B2.274: + cmpl $0, 8(%ebp) + je ..B2.278 +..B2.275: + movl 44(%esp), %eax + testl %edi, %edi + movl $0, (%eax) + je ..B2.277 +..B2.276: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.341: + addl $16, %esp +..B2.277: + fldt 8(%ebp) + fadd %st(0), %st + fstpt 116(%esp) + jmp ..B2.281 +..B2.278: + movl 44(%esp), %eax + testl %edi, %edi + movl $1, (%eax) + je ..B2.280 +..B2.279: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.342: + addl $16, %esp +..B2.280: + fldt 8(%ebp) + fmul %st(0), %st + fstpt 116(%esp) +..B2.281: + testl %edi, %edi + je ..B2.283 +..B2.282: + addl $-16, %esp + movl 156(%esp), %eax + movl %eax, (%esp) + call fesetround +..B2.343: + addl $16, %esp +..B2.283: + testl %esi, %esi + je ..B2.285 +..B2.284: + fldcw 182(%esp) +..B2.285: + fldt 116(%esp) + movl 232(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.196 + jmp ..B2.38 +..B2.288: + xorl %esi, %esi + jmp ..B2.12 + .align 16,0x90 + .type __libm_lgammal,@function + .size __libm_lgammal,.-__libm_lgammal + .data +# -- End __libm_lgammal + .text +# -- Begin __libm_p25 + .text + .align 16,0x90 +__libm_p25: +# parameter 1: 8 + %esp +# parameter 2: %eax +# parameter 3: %edx +# parameter 4: %ecx +..B3.1: +..L8: + + pushl %edi + movl %eax, %edi + fldt 8(%esp) + call ..L9 +..L9: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L9](%eax), %eax + fld %st(0) + fld %st(1) + fldl 56(%edx) + fmul %st(3), %st + fldl _TWO_32H@GOTOFF(%eax) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(3) + fsub %st(3), %st + fldt 48(%edi) + fxch %st(2) + faddl 48(%edx) + fmul %st(5), %st + fldt (%edi) + fldt 60(%edi) + fxch %st(2) + faddl 152(%edx) + fmul %st(7), %st + faddl 144(%edx) + fmul %st(7), %st + faddl 168(%edx) + fmul %st(7), %st + faddl 160(%edx) + fmul %st(7), %st + faddl 104(%edx) + fmul %st(7), %st + faddl 96(%edx) + fmul %st(7), %st + faddl 120(%edx) + fmul %st(7), %st + faddl 112(%edx) + fmul %st(7), %st + faddl 136(%edx) + fmul %st(7), %st + faddl 128(%edx) + fmul %st(7), %st + faddl 40(%edx) + fmul %st(7), %st + faddl 32(%edx) + fmul %st(7), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 12(%edi) + faddp %st, %st(1) + fmul %st(4), %st + fldt 72(%edi) + faddp %st, %st(1) + fmul %st(4), %st + fldt 24(%edi) + faddp %st, %st(1) + fmul %st(4), %st + fldt 84(%edi) + faddp %st, %st(1) + fmul %st(4), %st + fld %st(2) + fldt 36(%edi) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + fmul %st(6), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fldl (%edx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(4) + fmul %st(2), %st + fxch %st(1) + faddl 88(%edx) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(5), %st + fld %st(4) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 64(%edx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(4) + fmul %st(3), %st + fxch %st(1) + faddl 72(%edx) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fld %st(4) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 16(%edx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(4) + fmul %st, %st(5) + fsubr %st, %st(2) + fmulp %st, %st(3) + fxch %st(3) + faddl 24(%edx) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fldl 80(%edx) + fld %st(0) + fadd %st(2), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(1) + faddp %st, %st(1) + faddl 8(%edx) + faddp %st, %st(1) + fstpt 12(%ecx) + popl %edi + ret + .align 16,0x90 + .type __libm_p25,@function + .size __libm_p25,.-__libm_p25 + .data +# -- End __libm_p25 + .text +# -- Begin __libm_p19root + .text + .align 16,0x90 +__libm_p19root: +# parameter 1: 32 + %esp +# parameter 2: %eax +# parameter 3: %edx +# parameter 4: %ecx +..B4.1: +..L10: + + pushl %edi + subl $24, %esp + fldt 32(%esp) + call ..L11 +..L11: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L11](%edi), %edi + fld %st(0) + fld %st(1) + fldl 152(%edx) + fmul %st(3), %st + fldl _TWO_32H@GOTOFF(%edi) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(3) + fsub %st(3), %st + fldt 24(%eax) + fxch %st(2) + faddl 144(%edx) + fmul %st(5), %st + fldt 12(%eax) + fldt (%eax) + fxch %st(2) + faddl 136(%edx) + fmul %st(7), %st + faddl 128(%edx) + fmul %st(7), %st + faddl 120(%edx) + fmul %st(7), %st + faddl 112(%edx) + fmul %st(7), %st + faddl 104(%edx) + fmul %st(7), %st + faddl 96(%edx) + fmul %st(7), %st + faddl 88(%edx) + fmul %st(7), %st + faddl 80(%edx) + fmul %st(7), %st + faddl 72(%edx) + fmul %st(7), %st + faddl 64(%edx) + fmul %st(7), %st + faddl 56(%edx) + fmul %st(7), %st + faddl 48(%edx) + fmul %st(7), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fld %st(1) + fld %st(3) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + fmul %st(6), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldl 32(%edx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(4) + fmul %st(2), %st + fxch %st(1) + faddl 40(%edx) + faddp %st, %st(4) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fmul %st(5), %st + fld %st(4) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldl 16(%edx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fxch %st(2) + fsub %st(4), %st + fxch %st(4) + fmulp %st, %st(5) + faddl 24(%edx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt (%esp) + fldt (%esp) + fldl (%edx) + fld %st(0) + fld %st(1) + fadd %st(4), %st + fldl 8(%edx) + fadd %st, %st(2) + fxch %st(2) + fstpt 12(%esp) + fldt 12(%esp) + movzbl 9(%esp), %edx + movzbl 21(%esp), %eax + andl $128, %edx + andl $128, %eax + shrl $7, %edx + shrl $7, %eax + fxch %st(4) + fmuls ones@GOTOFF(%edi,%edx,4) + fstpt (%esp) + fldt (%esp) + fxch %st(4) + fmuls ones@GOTOFF(%edi,%eax,4) + fcomp %st(4) + fnstsw %ax + fxch %st(3) + fstp %st(0) + sahf + jae ..B4.3 + jp ..B4.3 +..B4.2: + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + jmp ..B4.4 +..B4.3: + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) +..B4.4: + fstpt (%ecx) + fstpt 12(%ecx) + addl $24, %esp + popl %edi + ret + .align 16,0x90 + .type __libm_p19root,@function + .size __libm_p19root,.-__libm_p19root + .data +# -- End __libm_p19root + .text +# -- Begin gammal + .text + .align 16,0x90 + .globl gammal +gammal: +# parameter 1: 32 + %esp +..B5.1: +..L12: + + subl $28, %esp + fldt 32(%esp) + lea 16(%esp), %eax + fstpt (%esp) + movl %eax, 12(%esp) + call __libm_lgammal +..B5.2: + addl $28, %esp + ret + .align 16,0x90 + .type gammal,@function + .size gammal,.-gammal + .data +# -- End gammal + .text +# -- Begin lgammal_r + .text + .align 16,0x90 + .globl lgammal_r +lgammal_r: +# parameter 1: 4 + %esp +# parameter 2: 16 + %esp +..B6.1: +..L13: + + jmp __libm_lgammal + .align 16,0x90 + .type lgammal_r,@function + .size lgammal_r,.-lgammal_r + .data +# -- End lgammal_r + .text +# -- Begin gammal_r + .text + .align 16,0x90 + .globl gammal_r +gammal_r: +# parameter 1: 4 + %esp +# parameter 2: 16 + %esp +..B7.1: +..L14: + + jmp __libm_lgammal + .align 16,0x90 + .type gammal_r,@function + .size gammal_r,.-gammal_r + .data +# -- End gammal_r + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x40,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0xc0,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x02,0x40,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x03,0xc0,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.12: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xa6,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.15: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.16: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.17: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.18: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xbf,0x00,0x00 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.19: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.20: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.21: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x00 + .type .L_2il0floatpacket.21,@object + .size .L_2il0floatpacket.21,12 + .space 4, 0x00 # pad + .align 16 +_ldbA: + .word 48403 + .word 16065 + .word 37206 + .word 35465 + .word 16381 + .word 0 + .word 32498 + .word 21186 + .word 57533 + .word 54364 + .word 49148 + .word 0 + .word 48455 + .word 64043 + .word 25991 + .word 44448 + .word 16380 + .word 0 + .word 36906 + .word 8596 + .word 53485 + .word 37761 + .word 49148 + .word 0 + .word 16786 + .word 63789 + .word 39740 + .word 32901 + .word 16380 + .word 0 + .word 43334 + .word 50722 + .word 13591 + .word 58371 + .word 49147 + .word 0 + .word 51242 + .word 42271 + .word 52839 + .word 52480 + .word 16379 + .word 0 + .word 22272 + .word 27707 + .word 58025 + .word 47684 + .word 49147 + .word 0 + .word 48537 + .word 42093 + .word 143 + .word 43693 + .word 16379 + .word 0 + .word 5437 + .word 23105 + .word 19142 + .word 40288 + .word 49147 + .word 0 + .word 43105 + .word 25781 + .word 60600 + .word 37244 + .word 16379 + .word 0 + .word 64996 + .word 46896 + .word 33038 + .word 34212 + .word 49147 + .word 0 + .word 8055 + .word 35794 + .word 25027 + .word 61223 + .word 16378 + .word 0 + .word 26586 + .word 4739 + .word 1082 + .word 51475 + .word 49146 + .word 0 + .word 65450 + .word 65402 + .word 39793 + .word 38562 + .word 16378 + .word 0 + .word 18875 + .word 24550 + .word 64026 + .word 48031 + .word 49145 + .word 0 + .word 3811 + .word 11690 + .word 33485 + .word 45433 + .word 16376 + .word 0 + .word 21488 + .word 64404 + .word 56511 + .word 56861 + .word 49142 + .word 0 + .word 64157 + .word 44249 + .word 62935 + .word 34811 + .word 16372 + .word 0 + .word 1503 + .word 1560 + .word 25992 + .word 44448 + .word 49149 + .word 0 + .word 53495 + .word 49976 + .word 39767 + .word 32901 + .word 49149 + .word 0 + .word 21693 + .word 55175 + .word 61890 + .word 52480 + .word 49148 + .word 0 + .word 18005 + .word 14879 + .word 27421 + .word 43701 + .word 49148 + .word 0 + .word 4785 + .word 48109 + .word 28463 + .word 37451 + .word 49148 + .word 0 + .word 17404 + .word 30303 + .word 36440 + .word 32768 + .word 49148 + .word 0 + .word 19413 + .word 44833 + .word 30216 + .word 58252 + .word 49147 + .word 0 + .word 61231 + .word 61633 + .word 10791 + .word 52455 + .word 49147 + .word 0 + .word 18500 + .word 21868 + .word 57423 + .word 47400 + .word 49147 + .word 0 + .word 24302 + .word 39700 + .word 47161 + .word 45652 + .word 49147 + .word 0 + .word 48514 + .word 20900 + .word 46081 + .word 58518 + .word 49146 + .word 0 + .word 11885 + .word 12460 + .word 35625 + .word 41968 + .word 49148 + .word 0 + .word 41690 + .word 14982 + .word 21018 + .word 53469 + .word 16380 + .word 0 + .word 2894 + .word 27339 + .word 226 + .word 41728 + .word 49150 + .word 0 + .word 26025 + .word 18501 + .word 20978 + .word 46979 + .word 16382 + .word 0 + .word 53900 + .word 55553 + .word 17653 + .word 38916 + .word 49150 + .word 0 + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 49142 + .word 0 + .word 53261 + .word 3328 + .word 208 + .word 53261 + .word 16372 + .word 0 + .word 39946 + .word 2496 + .word 49308 + .word 39945 + .word 49140 + .word 0 + .word 6840 + .word 51193 + .word 61784 + .word 56488 + .word 16372 + .word 0 + .word 58384 + .word 51683 + .word 34508 + .word 64341 + .word 49141 + .word 0 + .word 53773 + .word 3360 + .word 8402 + .word 53773 + .word 16375 + .word 0 + .word 48865 + .word 31388 + .word 13912 + .word 61972 + .word 49145 + .word 0 + .word 65489 + .word 61491 + .word 45504 + .word 47092 + .word 16380 + .word 0 + .word 53102 + .word 49401 + .word 14344 + .word 45627 + .word 49151 + .word 0 + .word 2166 + .word 2831 + .word 24758 + .word 46603 + .word 49142 + .word 0 + .word 9580 + .word 21681 + .word 206 + .word 53261 + .word 16372 + .word 0 + .word 30177 + .word 46479 + .word 48966 + .word 39945 + .word 49140 + .word 0 + .word 52333 + .word 51482 + .word 18491 + .word 56488 + .word 16372 + .word 0 + .word 40942 + .word 14796 + .word 26057 + .word 64313 + .word 49141 + .word 0 + .word 50177 + .word 16139 + .word 15070 + .word 53362 + .word 16375 + .word 0 + .word 2931 + .word 59423 + .word 29748 + .word 57837 + .word 49145 + .word 0 + .word 12931 + .word 12185 + .word 50840 + .word 32873 + .word 16380 + .word 0 + .word 60991 + .word 64091 + .word 63067 + .word 49777 + .word 49149 + .word 0 + .word 24747 + .word 1987 + .word 58544 + .word 40255 + .word 49152 + .word 0 + .word 31726 + .word 62157 + .word 28132 + .word 51504 + .word 49152 + .word 0 + .word 1560 + .word 52396 + .word 29634 + .word 33090 + .word 49153 + .word 0 + .word 51301 + .word 34230 + .word 21183 + .word 41027 + .word 49153 + .word 0 + .word 26476 + .word 19428 + .word 22828 + .word 49163 + .word 49153 + .word 0 + .word 62911 + .word 28656 + .word 40943 + .word 57345 + .word 49153 + .word 0 + .word 51702 + .word 17823 + .word 6657 + .word 32768 + .word 49154 + .word 0 + .word 55405 + .word 47943 + .word 739 + .word 36864 + .word 49154 + .word 0 + .word 47506 + .word 63803 + .word 73 + .word 40960 + .word 49154 + .word 0 + .word 21270 + .word 47505 + .word 6 + .word 45056 + .word 49154 + .word 0 + .word 51059 + .word 36726 + .word 0 + .word 49152 + .word 49154 + .word 0 + .word 8970 + .word 2825 + .word 0 + .word 53248 + .word 49154 + .word 0 + .word 52133 + .word 201 + .word 0 + .word 57344 + .word 49154 + .word 0 + .word 29690 + .word 13 + .word 0 + .word 61440 + .word 49154 + .word 0 + .word 27552 + .word 0 + .word 0 + .word 32768 + .word 49155 + .word 0 + .word 1621 + .word 0 + .word 0 + .word 34816 + .word 49155 + .word 0 + .word 90 + .word 0 + .word 0 + .word 36864 + .word 49155 + .word 0 + .word 5 + .word 0 + .word 0 + .word 38912 + .word 49155 + .word 0 + .word 1630 + .word 57032 + .word 2128 + .word 45018 + .word 49152 + .word 0 + .word 10332 + .word 57727 + .word 35491 + .word 64803 + .word 49152 + .word 0 + .word 59042 + .word 30551 + .word 48083 + .word 40890 + .word 49153 + .word 0 + .word 27388 + .word 36768 + .word 38828 + .word 49140 + .word 49153 + .word 0 + .word 32744 + .word 23607 + .word 24507 + .word 57342 + .word 49153 + .word 0 + .word 30841 + .word 2766 + .word 52220 + .word 65535 + .word 49153 + .word 0 + .word 33024 + .word 16990 + .word 64796 + .word 36863 + .word 49154 + .word 0 + .word 64973 + .word 1725 + .word 65462 + .word 40959 + .word 49154 + .word 0 + .word 40731 + .word 18030 + .word 65529 + .word 45055 + .word 49154 + .word 0 + .word 14452 + .word 28809 + .word 65535 + .word 49151 + .word 49154 + .word 0 + .word 56566 + .word 62710 + .word 65535 + .word 53247 + .word 49154 + .word 0 + .word 13403 + .word 65334 + .word 65535 + .word 57343 + .word 49154 + .word 0 + .word 35846 + .word 65522 + .word 65535 + .word 61439 + .word 49154 + .word 0 + .word 10432 + .word 65535 + .word 65535 + .word 65535 + .word 49154 + .word 0 + .word 63915 + .word 65535 + .word 65535 + .word 34815 + .word 49155 + .word 0 + .word 65446 + .word 65535 + .word 65535 + .word 36863 + .word 49155 + .word 0 + .word 65531 + .word 65535 + .word 65535 + .word 38911 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38912 + .word 49152 + .word 0 + .word 47937 + .word 50671 + .word 32821 + .word 51896 + .word 49152 + .word 0 + .word 8469 + .word 62640 + .word 24113 + .word 51168 + .word 49152 + .word 0 + .word 23666 + .word 39283 + .word 12728 + .word 33144 + .word 49153 + .word 0 + .word 1338 + .word 16824 + .word 25401 + .word 33044 + .word 49153 + .word 0 + .word 38006 + .word 50858 + .word 35636 + .word 41038 + .word 49153 + .word 0 + .word 6523 + .word 10616 + .word 46244 + .word 41017 + .word 49153 + .word 0 + .word 30889 + .word 22666 + .word 15710 + .word 49165 + .word 49153 + .word 0 + .word 22694 + .word 63464 + .word 47653 + .word 49161 + .word 49153 + .word 0 + .word 7860 + .word 665 + .word 58690 + .word 57345 + .word 49153 + .word 0 + .word 35199 + .word 5838 + .word 25732 + .word 57345 + .word 49153 + .word 0 + .word 27551 + .word 53562 + .word 7766 + .word 32768 + .word 49154 + .word 0 + .word 34954 + .word 15277 + .word 5706 + .word 32768 + .word 49154 + .word 0 + .word 10026 + .word 1321 + .word 863 + .word 36864 + .word 49154 + .word 0 + .word 38128 + .word 3645 + .word 634 + .word 36864 + .word 49154 + .word 0 + .word 22656 + .word 19824 + .word 86 + .word 40960 + .word 49154 + .word 0 + .word 3271 + .word 26602 + .word 63 + .word 40960 + .word 49154 + .word 0 + .word 57583 + .word 55422 + .word 7 + .word 45056 + .word 49154 + .word 0 + .word 8869 + .word 50081 + .word 5 + .word 45056 + .word 49154 + .word 0 + .word 59569 + .word 42847 + .word 0 + .word 49152 + .word 49154 + .word 0 + .word 6316 + .word 31480 + .word 0 + .word 49152 + .word 49154 + .word 0 + .word 65078 + .word 3295 + .word 0 + .word 53248 + .word 49154 + .word 0 + .word 35775 + .word 2421 + .word 0 + .word 53248 + .word 49154 + .word 0 + .word 28054 + .word 235 + .word 0 + .word 57344 + .word 49154 + .word 0 + .word 63410 + .word 172 + .word 0 + .word 57344 + .word 49154 + .word 0 + .word 45561 + .word 15 + .word 0 + .word 61440 + .word 49154 + .word 0 + .word 34811 + .word 11 + .word 0 + .word 61440 + .word 49154 + .word 0 + .word 32144 + .word 0 + .word 0 + .word 32768 + .word 49155 + .word 0 + .word 23616 + .word 0 + .word 0 + .word 32768 + .word 49155 + .word 0 + .word 1891 + .word 0 + .word 0 + .word 34816 + .word 49155 + .word 0 + .word 1389 + .word 0 + .word 0 + .word 34816 + .word 49155 + .word 0 + .word 105 + .word 0 + .word 0 + .word 36864 + .word 49155 + .word 0 + .word 77 + .word 0 + .word 0 + .word 36864 + .word 49155 + .word 0 + .word 6 + .word 0 + .word 0 + .word 38912 + .word 49155 + .word 0 + .word 5 + .word 0 + .word 0 + .word 38912 + .word 49155 + .word 0 + .word 30094 + .word 17612 + .word 34825 + .word 45621 + .word 49152 + .word 0 + .word 27787 + .word 64487 + .word 61865 + .word 44498 + .word 49152 + .word 0 + .word 45180 + .word 62215 + .word 30788 + .word 64910 + .word 49152 + .word 0 + .word 56909 + .word 5419 + .word 21954 + .word 64678 + .word 49152 + .word 0 + .word 26983 + .word 61012 + .word 55414 + .word 40900 + .word 49153 + .word 0 + .word 17042 + .word 26812 + .word 58543 + .word 40878 + .word 49153 + .word 0 + .word 17649 + .word 49100 + .word 16895 + .word 49142 + .word 49153 + .word 0 + .word 47753 + .word 6644 + .word 42105 + .word 49138 + .word 49153 + .word 0 + .word 56665 + .word 15855 + .word 40064 + .word 57342 + .word 49153 + .word 0 + .word 9214 + .word 11959 + .word 6291 + .word 57342 + .word 49153 + .word 0 + .word 44995 + .word 64071 + .word 54163 + .word 65535 + .word 49153 + .word 0 + .word 35553 + .word 53091 + .word 49943 + .word 65535 + .word 49153 + .word 0 + .word 39205 + .word 16423 + .word 64904 + .word 36863 + .word 49154 + .word 0 + .word 61074 + .word 52942 + .word 64669 + .word 36863 + .word 49154 + .word 0 + .word 11000 + .word 54094 + .word 65472 + .word 40959 + .word 49154 + .word 0 + .word 41911 + .word 24986 + .word 65449 + .word 40959 + .word 49154 + .word 0 + .word 33350 + .word 16833 + .word 65530 + .word 45055 + .word 49154 + .word 0 + .word 41532 + .word 8229 + .word 65528 + .word 45055 + .word 49154 + .word 0 + .word 52046 + .word 34170 + .word 65535 + .word 49151 + .word 49154 + .word 0 + .word 9080 + .word 22531 + .word 65535 + .word 49151 + .word 49154 + .word 0 + .word 19128 + .word 63123 + .word 65535 + .word 53247 + .word 49154 + .word 0 + .word 61194 + .word 62227 + .word 65535 + .word 53247 + .word 49154 + .word 0 + .word 43497 + .word 65363 + .word 65535 + .word 57343 + .word 49154 + .word 0 + .word 46501 + .word 65299 + .word 65535 + .word 57343 + .word 49154 + .word 0 + .word 33483 + .word 65524 + .word 65535 + .word 61439 + .word 49154 + .word 0 + .word 16207 + .word 65520 + .word 65535 + .word 61439 + .word 49154 + .word 0 + .word 18477 + .word 65535 + .word 65535 + .word 65535 + .word 49154 + .word 0 + .word 1013 + .word 65535 + .word 65535 + .word 65535 + .word 49154 + .word 0 + .word 64152 + .word 65535 + .word 65535 + .word 34815 + .word 49155 + .word 0 + .word 63638 + .word 65535 + .word 65535 + .word 34815 + .word 49155 + .word 0 + .word 65459 + .word 65535 + .word 65535 + .word 36863 + .word 49155 + .word 0 + .word 65431 + .word 65535 + .word 65535 + .word 36863 + .word 49155 + .word 0 + .word 65532 + .word 65535 + .word 65535 + .word 38911 + .word 49155 + .word 0 + .word 65531 + .word 65535 + .word 65535 + .word 38911 + .word 49155 + .word 0 + .word 16368 + .word 23276 + .word 14028 + .word 45039 + .word 16386 + .word 0 + .word 59281 + .word 7220 + .word 1358 + .word 44002 + .word 16385 + .word 0 + .word 209 + .word 31529 + .word 17251 + .word 45971 + .word 16384 + .word 0 + .word 22774 + .word 54591 + .word 46864 + .word 55119 + .word 16383 + .word 0 + .word 36309 + .word 6992 + .word 45734 + .word 65508 + .word 49154 + .word 0 + .word 57509 + .word 44567 + .word 44472 + .word 62561 + .word 49153 + .word 0 + .word 24352 + .word 36914 + .word 35595 + .word 62910 + .word 49152 + .word 0 + .word 36298 + .word 16311 + .word 10079 + .word 34683 + .word 49152 + .word 0 + .word 8745 + .word 24487 + .word 32401 + .word 58540 + .word 16393 + .word 0 + .word 64710 + .word 25493 + .word 17440 + .word 41602 + .word 16391 + .word 0 + .word 9540 + .word 49275 + .word 24345 + .word 64260 + .word 16388 + .word 0 + .word 32123 + .word 43450 + .word 42726 + .word 58824 + .word 16386 + .word 0 + .word 56179 + .word 18517 + .word 55467 + .word 35137 + .word 49163 + .word 0 + .word 59411 + .word 7122 + .word 11027 + .word 48002 + .word 49160 + .word 0 + .word 11599 + .word 47165 + .word 19459 + .word 34091 + .word 49158 + .word 0 + .word 3871 + .word 11740 + .word 51838 + .word 51028 + .word 49155 + .word 0 + .word 54329 + .word 49239 + .word 6514 + .word 47686 + .word 16379 + .word 0 + .word 32133 + .word 56 + .word 14391 + .word 58371 + .word 16379 + .word 0 + .word 29265 + .word 29887 + .word 53486 + .word 37761 + .word 16380 + .word 0 + .word 40734 + .word 56364 + .word 61890 + .word 52480 + .word 16379 + .word 0 + .word 62017 + .word 50151 + .word 39767 + .word 32901 + .word 16380 + .word 0 + .word 62465 + .word 1557 + .word 25992 + .word 44448 + .word 16380 + .word 0 + .word 46350 + .word 21258 + .word 57533 + .word 54364 + .word 16380 + .word 0 + .word 28472 + .word 57318 + .word 11755 + .word 48239 + .word 49136 + .word 0 + .word 64030 + .word 27012 + .word 42555 + .word 59902 + .word 49138 + .word 0 + .word 15295 + .word 64624 + .word 11797 + .word 40022 + .word 49141 + .word 0 + .word 40088 + .word 48672 + .word 55416 + .word 53395 + .word 16369 + .word 0 + .word 32150 + .word 7351 + .word 22467 + .word 34203 + .word 16372 + .word 0 + .word 32397 + .word 56161 + .word 46934 + .word 48494 + .word 16374 + .word 0 + .word 35896 + .word 51119 + .word 32272 + .word 61954 + .word 49143 + .word 0 + .word 64369 + .word 46577 + .word 49946 + .word 47894 + .word 16383 + .word 0 + .word 13507 + .word 11243 + .word 36867 + .word 37912 + .word 16374 + .word 0 + .word 13500 + .word 7397 + .word 345 + .word 51175 + .word 16375 + .word 0 + .word 36308 + .word 1299 + .word 15549 + .word 37687 + .word 16377 + .word 0 + .word 1494 + .word 43036 + .word 5286 + .word 33882 + .word 16379 + .word 0 + .word 51612 + .word 44256 + .word 49203 + .word 47051 + .word 49141 + .word 0 + .word 24103 + .word 45476 + .word 53751 + .word 61816 + .word 49142 + .word 0 + .word 18204 + .word 4207 + .word 64680 + .word 43260 + .word 49144 + .word 0 + .word 39634 + .word 35210 + .word 18170 + .word 34381 + .word 49146 + .word 0 + .word 30073 + .word 2874 + .word 60159 + .word 61890 + .word 16373 + .word 0 + .word 21923 + .word 37483 + .word 63587 + .word 45930 + .word 16375 + .word 0 + .word 17610 + .word 34235 + .word 25953 + .word 38432 + .word 16377 + .word 0 + .word 27391 + .word 45200 + .word 21903 + .word 41572 + .word 16379 + .word 0 + .word 8472 + .word 18376 + .word 37439 + .word 36904 + .word 49141 + .word 0 + .word 15138 + .word 28105 + .word 43771 + .word 52749 + .word 49142 + .word 0 + .word 19597 + .word 13484 + .word 38971 + .word 41168 + .word 49144 + .word 0 + .word 3303 + .word 60299 + .word 50447 + .word 38102 + .word 49146 + .word 0 + .word 47075 + .word 52558 + .word 55475 + .word 37762 + .word 16374 + .word 0 + .word 52173 + .word 35461 + .word 11437 + .word 59897 + .word 16375 + .word 0 + .word 36076 + .word 14373 + .word 35326 + .word 54659 + .word 16377 + .word 0 + .word 59562 + .word 13882 + .word 310 + .word 33073 + .word 16380 + .word 0 + .word 21162 + .word 13390 + .word 51910 + .word 43836 + .word 49141 + .word 0 + .word 25864 + .word 5553 + .word 52105 + .word 33196 + .word 49143 + .word 0 + .word 50214 + .word 4354 + .word 50978 + .word 55906 + .word 49144 + .word 0 + .word 22538 + .word 16515 + .word 54348 + .word 57115 + .word 49146 + .word 0 + .word 25669 + .word 8964 + .word 45428 + .word 52429 + .word 16390 + .word 0 + .word 42066 + .word 12451 + .word 5346 + .word 32773 + .word 16389 + .word 0 + .word 59247 + .word 49506 + .word 42126 + .word 43753 + .word 16387 + .word 0 + .word 41212 + .word 16190 + .word 63627 + .word 33236 + .word 16386 + .word 0 + .word 43030 + .word 44942 + .word 52710 + .word 59310 + .word 49135 + .word 0 + .word 4241 + .word 60350 + .word 9519 + .word 55057 + .word 49131 + .word 0 + .word 13201 + .word 63684 + .word 48400 + .word 58952 + .word 49135 + .word 0 + .word 43405 + .word 43520 + .word 7800 + .word 38026 + .word 49140 + .word 0 + .word 51109 + .word 32176 + .word 26595 + .word 37828 + .word 16382 + .word 0 + .word 39193 + .word 38974 + .word 13074 + .word 53901 + .word 16382 + .word 0 + .word 18403 + .word 21914 + .word 43743 + .word 52518 + .word 16381 + .word 0 + .word 11905 + .word 16066 + .word 37206 + .word 35465 + .word 16381 + .word 0 + .word 39192 + .word 38974 + .word 13074 + .word 53901 + .word 16383 + .word 0 + .word 16822 + .word 16066 + .word 37206 + .word 35465 + .word 16382 + .word 0 + .word 12453 + .word 1560 + .word 25992 + .word 44448 + .word 16381 + .word 0 + .word 46918 + .word 49948 + .word 39767 + .word 32901 + .word 16381 + .word 0 + .word 993 + .word 37711 + .word 1229 + .word 53967 + .word 16378 + .word 0 + .word 22241 + .word 58002 + .word 54887 + .word 56142 + .word 49145 + .word 0 + .word 8639 + .word 23392 + .word 41786 + .word 61781 + .word 16376 + .word 0 + .word 824 + .word 14446 + .word 39837 + .word 35166 + .word 49144 + .word 0 + .word 4398 + .word 47415 + .word 48788 + .word 40961 + .word 16375 + .word 0 + .word 53320 + .word 18702 + .word 33902 + .word 48514 + .word 49142 + .word 0 + .word 47965 + .word 49933 + .word 53838 + .word 58200 + .word 16373 + .word 0 + .word 46987 + .word 9286 + .word 62309 + .word 35268 + .word 49141 + .word 0 + .word 6461 + .word 640 + .word 17377 + .word 43104 + .word 16372 + .word 0 + .word 30338 + .word 25067 + .word 12218 + .word 53050 + .word 49139 + .word 0 + .word 3327 + .word 27408 + .word 8301 + .word 61564 + .word 16378 + .word 0 + .word 59387 + .word 42287 + .word 60059 + .word 60716 + .word 49145 + .word 0 + .word 13826 + .word 21215 + .word 7405 + .word 64741 + .word 16376 + .word 0 + .word 26137 + .word 29234 + .word 53880 + .word 36165 + .word 49144 + .word 0 + .word 10231 + .word 52926 + .word 36203 + .word 41655 + .word 16375 + .word 0 + .word 23407 + .word 27273 + .word 49305 + .word 49005 + .word 49142 + .word 0 + .word 11641 + .word 23288 + .word 44339 + .word 58553 + .word 16373 + .word 0 + .word 25249 + .word 6483 + .word 6272 + .word 35397 + .word 49141 + .word 0 + .word 42921 + .word 12425 + .word 13798 + .word 43198 + .word 16372 + .word 0 + .word 50188 + .word 64017 + .word 41333 + .word 53119 + .word 49139 + .word 0 + .word 25097 + .word 45200 + .word 21903 + .word 41572 + .word 16379 + .word 0 + .word 10972 + .word 60304 + .word 50447 + .word 38102 + .word 49146 + .word 0 + .word 15639 + .word 33828 + .word 25953 + .word 38432 + .word 16377 + .word 0 + .word 37131 + .word 35786 + .word 38971 + .word 41168 + .word 49144 + .word 0 + .word 11219 + .word 39714 + .word 63573 + .word 45930 + .word 16375 + .word 0 + .word 59109 + .word 9738 + .word 44211 + .word 52749 + .word 49142 + .word 0 + .word 51163 + .word 1079 + .word 49343 + .word 61890 + .word 16373 + .word 0 + .word 19090 + .word 15031 + .word 12079 + .word 36906 + .word 49141 + .word 0 + .word 28236 + .word 6956 + .word 155 + .word 44549 + .word 16372 + .word 0 + .word 54475 + .word 22231 + .word 8036 + .word 54711 + .word 49139 + .word 0 + .word 43885 + .word 13882 + .word 310 + .word 33073 + .word 16380 + .word 0 + .word 49382 + .word 16501 + .word 54348 + .word 57115 + .word 49146 + .word 0 + .word 54884 + .word 14552 + .word 35326 + .word 54659 + .word 16377 + .word 0 + .word 24455 + .word 7515 + .word 50978 + .word 55906 + .word 49144 + .word 0 + .word 57687 + .word 611 + .word 11437 + .word 59897 + .word 16375 + .word 0 + .word 26110 + .word 1729 + .word 52102 + .word 33196 + .word 49143 + .word 0 + .word 49827 + .word 25553 + .word 55506 + .word 37762 + .word 16374 + .word 0 + .word 45356 + .word 51283 + .word 52132 + .word 43836 + .word 49141 + .word 0 + .word 37526 + .word 52421 + .word 6331 + .word 51720 + .word 16372 + .word 0 + .word 23504 + .word 7355 + .word 4713 + .word 61833 + .word 49139 + .word 0 + .word 28030 + .word 45200 + .word 21903 + .word 41572 + .word 16379 + .word 0 + .word 64882 + .word 60298 + .word 50447 + .word 38102 + .word 49146 + .word 0 + .word 36628 + .word 34230 + .word 25953 + .word 38432 + .word 16377 + .word 0 + .word 2186 + .word 13495 + .word 38971 + .word 41168 + .word 49144 + .word 0 + .word 42048 + .word 38474 + .word 63587 + .word 45930 + .word 16375 + .word 0 + .word 44984 + .word 21655 + .word 43771 + .word 52749 + .word 49142 + .word 0 + .word 10340 + .word 31180 + .word 60154 + .word 61890 + .word 16373 + .word 0 + .word 29368 + .word 33685 + .word 37418 + .word 36904 + .word 49141 + .word 0 + .word 632 + .word 28858 + .word 25336 + .word 44574 + .word 16372 + .word 0 + .word 47657 + .word 7722 + .word 28520 + .word 54386 + .word 49139 + .word 0 + .word 48861 + .word 21442 + .word 12332 + .word 46245 + .word 16383 + .word 0 + .word 55836 + .word 1266 + .word 27621 + .word 35724 + .word 16386 + .word 0 + .word 19864 + .word 22843 + .word 65282 + .word 47516 + .word 16385 + .word 0 + .word 55755 + .word 27362 + .word 47250 + .word 57481 + .word 16389 + .word 0 + .word 27703 + .word 47960 + .word 491 + .word 37689 + .word 16392 + .word 0 + .word 41421 + .word 53711 + .word 6590 + .word 52435 + .word 16394 + .word 0 + .word 57789 + .word 21731 + .word 35033 + .word 43725 + .word 16395 + .word 0 + .word 55298 + .word 55134 + .word 50960 + .word 52072 + .word 16399 + .word 0 + .word 30636 + .word 39282 + .word 62891 + .word 33072 + .word 16404 + .word 0 + .word 7959 + .word 64403 + .word 49841 + .word 37534 + .word 16402 + .word 0 + .word 5854 + .word 54131 + .word 61334 + .word 53522 + .word 16408 + .word 0 + .word 5803 + .word 45364 + .word 48027 + .word 40704 + .word 16415 + .word 0 + .word 1370 + .word 7138 + .word 7454 + .word 61224 + .word 16409 + .word 0 + .word 57336 + .word 44117 + .word 55954 + .word 64739 + .word 16418 + .word 0 + .word 54670 + .word 41483 + .word 43064 + .word 36510 + .word 16428 + .word 0 + .word 42312 + .word 7696 + .word 38319 + .word 40746 + .word 16418 + .word 0 + .word 12302 + .word 62594 + .word 5410 + .word 37618 + .word 16430 + .word 0 + .word 9293 + .word 14879 + .word 6832 + .word 37045 + .word 16442 + .word 0 + .word 2958 + .word 50542 + .word 15469 + .word 40704 + .word 16427 + .word 0 + .word 42649 + .word 12819 + .word 63050 + .word 37565 + .word 16442 + .word 0 + .word 6063 + .word 43732 + .word 62723 + .word 36980 + .word 16457 + .word 0 + .word 22453 + .word 18298 + .word 44915 + .word 57947 + .word 16436 + .word 0 + .word 20554 + .word 96 + .word 8145 + .word 60162 + .word 16454 + .word 0 + .word 27743 + .word 60960 + .word 41480 + .word 33312 + .word 16473 + .word 0 + .word 22238 + .word 6527 + .word 38867 + .word 56588 + .word 16446 + .word 0 + .word 38516 + .word 42313 + .word 15095 + .word 36719 + .word 16468 + .word 0 + .word 36587 + .word 28039 + .word 41391 + .word 50829 + .word 16489 + .word 0 + .word 29867 + .word 13204 + .word 65176 + .word 36776 + .word 16457 + .word 0 + .word 31042 + .word 28858 + .word 52725 + .word 32812 + .word 16482 + .word 0 + .word 10384 + .word 4515 + .word 18607 + .word 62455 + .word 16506 + .word 0 + .word 9765 + .word 184 + .word 10999 + .word 62061 + .word 16467 + .word 0 + .word 31509 + .word 19231 + .word 45642 + .word 41528 + .word 16496 + .word 0 + .word 9807 + .word 42010 + .word 46528 + .word 59283 + .word 16524 + .word 0 + .word 34508 + .word 54054 + .word 11762 + .word 33288 + .word 16479 + .word 0 + .word 35651 + .word 17126 + .word 61083 + .word 36196 + .word 16511 + .word 0 + .word 61937 + .word 2245 + .word 55342 + .word 41983 + .word 16543 + .word 0 + .word 55800 + .word 52004 + .word 63053 + .word 44600 + .word 16490 + .word 0 + .word 1794 + .word 6965 + .word 62764 + .word 42435 + .word 16526 + .word 0 + .word 31259 + .word 48342 + .word 51287 + .word 43067 + .word 16562 + .word 0 + .word 51054 + .word 24828 + .word 3408 + .word 36750 + .word 16502 + .word 0 + .word 10851 + .word 65289 + .word 49628 + .word 32780 + .word 16542 + .word 0 + .word 55922 + .word 53580 + .word 2985 + .word 62379 + .word 16581 + .word 0 + .word 3514 + .word 59781 + .word 19773 + .word 36749 + .word 16514 + .word 0 + .word 6233 + .word 41678 + .word 56685 + .word 32779 + .word 16558 + .word 0 + .word 7397 + .word 40156 + .word 60492 + .word 62376 + .word 16601 + .word 0 + .word 64764 + .word 30182 + .word 28471 + .word 44055 + .word 16526 + .word 0 + .word 47394 + .word 43518 + .word 20307 + .word 41745 + .word 16574 + .word 0 + .word 48961 + .word 13130 + .word 26792 + .word 42193 + .word 16622 + .word 0 + .word 13149 + .word 49204 + .word 39329 + .word 62843 + .word 16538 + .word 0 + .word 63753 + .word 8765 + .word 38452 + .word 33516 + .word 16591 + .word 0 + .word 60000 + .word 22498 + .word 28021 + .word 38134 + .word 16643 + .word 0 + .word 10643 + .word 26389 + .word 15903 + .word 44739 + .word 16551 + .word 0 + .word 24943 + .word 57881 + .word 5976 + .word 53687 + .word 16607 + .word 0 + .word 62568 + .word 44908 + .word 48389 + .word 34359 + .word 16664 + .word 0 + .word 36352 + .word 25695 + .word 54808 + .word 41154 + .word 49155 + .word 0 + .word 53950 + .word 20364 + .word 22118 + .word 64130 + .word 16388 + .word 0 + .word 29016 + .word 1013 + .word 8897 + .word 49860 + .word 49158 + .word 0 + .word 48790 + .word 22905 + .word 44266 + .word 59689 + .word 49162 + .word 0 + .word 10097 + .word 41173 + .word 5368 + .word 62588 + .word 16398 + .word 0 + .word 18460 + .word 26935 + .word 48131 + .word 34999 + .word 49171 + .word 0 + .word 39812 + .word 13033 + .word 49143 + .word 34463 + .word 49170 + .word 0 + .word 11756 + .word 24889 + .word 14253 + .word 47765 + .word 16408 + .word 0 + .word 27397 + .word 56992 + .word 59569 + .word 35306 + .word 49183 + .word 0 + .word 1499 + .word 3328 + .word 1093 + .word 60276 + .word 49177 + .word 0 + .word 54443 + .word 57316 + .word 38982 + .word 63406 + .word 16418 + .word 0 + .word 46810 + .word 23189 + .word 13701 + .word 35573 + .word 49196 + .word 0 + .word 40551 + .word 19489 + .word 60782 + .word 40648 + .word 49186 + .word 0 + .word 16371 + .word 31130 + .word 60187 + .word 37497 + .word 16430 + .word 0 + .word 56271 + .word 55717 + .word 16120 + .word 36897 + .word 49210 + .word 0 + .word 11488 + .word 11046 + .word 17817 + .word 40691 + .word 49195 + .word 0 + .word 54617 + .word 39007 + .word 658 + .word 37550 + .word 16442 + .word 0 + .word 32140 + .word 49295 + .word 21536 + .word 36961 + .word 49225 + .word 0 + .word 5702 + .word 58081 + .word 34597 + .word 57945 + .word 49204 + .word 0 + .word 48280 + .word 56894 + .word 9030 + .word 60159 + .word 16454 + .word 0 + .word 61535 + .word 4768 + .word 37086 + .word 33310 + .word 49241 + .word 0 + .word 53564 + .word 21787 + .word 24446 + .word 56588 + .word 49214 + .word 0 + .word 35771 + .word 11952 + .word 2619 + .word 36719 + .word 16468 + .word 0 + .word 47624 + .word 53808 + .word 19802 + .word 50829 + .word 49257 + .word 0 + .word 42706 + .word 15946 + .word 64291 + .word 36776 + .word 49225 + .word 0 + .word 8317 + .word 44716 + .word 51672 + .word 32812 + .word 16482 + .word 0 + .word 31251 + .word 20899 + .word 16102 + .word 62455 + .word 49274 + .word 0 + .word 2105 + .word 17517 + .word 10872 + .word 62061 + .word 49235 + .word 0 + .word 60728 + .word 14335 + .word 45529 + .word 41528 + .word 16496 + .word 0 + .word 1336 + .word 56903 + .word 46326 + .word 59283 + .word 49292 + .word 0 + .word 34501 + .word 54054 + .word 11762 + .word 33288 + .word 49247 + .word 0 + .word 35638 + .word 17126 + .word 61083 + .word 36196 + .word 16511 + .word 0 + .word 12489 + .word 2246 + .word 55342 + .word 41983 + .word 49311 + .word 0 + .word 55790 + .word 52004 + .word 63053 + .word 44600 + .word 49258 + .word 0 + .word 1778 + .word 6965 + .word 62764 + .word 42435 + .word 16526 + .word 0 + .word 47762 + .word 48342 + .word 51287 + .word 43067 + .word 49330 + .word 0 + .word 51047 + .word 24828 + .word 3408 + .word 36750 + .word 49270 + .word 0 + .word 10839 + .word 65289 + .word 49628 + .word 32780 + .word 16542 + .word 0 + .word 14289 + .word 53581 + .word 2985 + .word 62379 + .word 49349 + .word 0 + .word 3506 + .word 59781 + .word 19773 + .word 36749 + .word 49282 + .word 0 + .word 6220 + .word 41678 + .word 56685 + .word 32779 + .word 16558 + .word 0 + .word 31299 + .word 40156 + .word 60492 + .word 62376 + .word 49369 + .word 0 + .word 64754 + .word 30182 + .word 28471 + .word 44055 + .word 49294 + .word 0 + .word 47368 + .word 43518 + .word 20307 + .word 41745 + .word 16574 + .word 0 + .word 65114 + .word 13130 + .word 26792 + .word 42193 + .word 49390 + .word 0 + .word 13136 + .word 49204 + .word 39329 + .word 62843 + .word 49306 + .word 0 + .word 63757 + .word 8765 + .word 38452 + .word 33516 + .word 16591 + .word 0 + .word 9085 + .word 22499 + .word 28021 + .word 38134 + .word 49411 + .word 0 + .word 10631 + .word 26389 + .word 15903 + .word 44739 + .word 49319 + .word 0 + .word 24915 + .word 57881 + .word 5976 + .word 53687 + .word 16607 + .word 0 + .word 16910 + .word 44909 + .word 48389 + .word 34359 + .word 49432 + .word 0 + .type _ldbA,@object + .size _ldbA,4620 + .space 4, 0x00 # pad + .align 16 +_dbA: + .long 4235179544 + .long 3219290252 + .long 3295226828 + .long 3164508998 + .long 1649608659 + .long 1072320934 + .long 3173846476 + .long 1014071527 + .long 1542107862 + .long 3218711765 + .long 2540989727 + .long 3163202496 + .long 1649608660 + .long 3220853158 + .long 859914669 + .long 1017880115 + .long 717740104 + .long 3219214642 + .long 2376945980 + .long 3162254827 + .long 1431655765 + .long 1068848469 + .long 1431655765 + .long 1012225365 + .long 1431655765 + .long 1068848469 + .long 42583435 + .long 1011709190 + .long 3362045620 + .long 1072523249 + .long 4064281872 + .long 1016386130 + .long 4002465326 + .long 3220678216 + .long 1750589542 + .long 1014054706 + .long 2343010478 + .long 3220651595 + .long 2022209519 + .long 3165213628 + .long 3582788241 + .long 1077376220 + .long 3584976419 + .long 3225506388 + .long 2237448112 + .long 1085305363 + .long 634573353 + .long 3233318238 + .long 2248101888 + .long 1073427871 + .long 1861873466 + .long 1016835790 + .long 2560862412 + .long 1071060948 + .long 30404090 + .long 3163588833 + .long 1673151062 + .long 1081107801 + .long 641486499 + .long 3229145757 + .long 2847476088 + .long 1079825078 + .long 4109693297 + .long 3227890617 + .long 80699903 + .long 1078574114 + .long 2114691410 + .long 3226679074 + .long 1354791574 + .long 1083527322 + .long 1238563653 + .long 3231741049 + .long 2909836308 + .long 1082322123 + .long 2961745666 + .long 3230453807 + .long 4254370204 + .long 3222569838 + .long 2523116623 + .long 1016608103 + .long 3036354677 + .long 3220338375 + .long 4197032384 + .long 3163739097 + .long 618767413 + .long 1086658447 + .long 4224046954 + .long 3235503748 + .long 918515347 + .long 1104466354 + .long 1558545744 + .long 3253448772 + .long 3598672851 + .long 1075147148 + .long 1862579612 + .long 1019557195 + .long 814211565 + .long 1073042505 + .long 3816489657 + .long 3166119701 + .long 1438601496 + .long 1094947899 + .long 3932640262 + .long 3243813893 + .long 1025077628 + .long 1092155011 + .long 4084583552 + .long 3241103782 + .long 2491631644 + .long 1089473568 + .long 3212116569 + .long 3238261210 + .long 764386880 + .long 1100022671 + .long 1839771210 + .long 3248755462 + .long 3990369246 + .long 1097905463 + .long 1112302030 + .long 3246751353 + .long 717740104 + .long 1070682418 + .long 230143214 + .long 1014072542 + .long 1542107862 + .long 1071228117 + .long 2869986399 + .long 1017025354 + .long 2620920409 + .long 1068568872 + .long 3005931917 + .long 1068498895 + .long 3773030413 + .long 1068741081 + .long 221735135 + .long 1068648815 + .long 1649608659 + .long 1072320934 + .long 2259103138 + .long 1014410184 + .long 1798481678 + .long 1068036068 + .long 1435858614 + .long 1066348979 + .long 2798813559 + .long 1068114295 + .long 1711004053 + .long 1067747678 + .long 2010902109 + .long 1068166444 + .long 2474987820 + .long 1068059813 + .long 780818753 + .long 1068375890 + .long 4117616766 + .long 1068267614 + .long 1604677386 + .long 1068848813 + .long 1854392195 + .long 1067982657 + .long 4235179544 + .long 1071806604 + .long 2606438347 + .long 1015960145 + .long 2893907075 + .long 1066734370 + .long 2294698909 + .long 1014073149 + .long 441808390 + .long 3216064000 + .long 1880662273 + .long 1012321168 + .long 3253204732 + .long 3200326446 + .long 3649195207 + .long 1051723342 + .long 1676415034 + .long 3202599881 + .long 856428669 + .long 1053972858 + .long 3299217318 + .long 1070900044 + .long 4151699616 + .long 1010498715 + .long 1123572530 + .long 1044951237 + .long 3942090667 + .long 3191111442 + .long 179320158 + .long 3191607973 + .long 648955671 + .long 3189543958 + .long 338963396 + .long 3195730567 + .long 729244107 + .long 1047109933 + .long 491939632 + .long 3198035439 + .long 2441649049 + .long 1049392674 + .long 4000663347 + .long 1056276700 + .long 3497022620 + .long 3193423889 + .long 119575502 + .long 1071320806 + .long 3893526980 + .long 3160417465 + .long 2378611747 + .long 3217220647 + .long 3721041488 + .long 3160948136 + .long 212213087 + .long 1003805565 + .long 3707885569 + .long 946762142 + .long 954325311 + .long 1061996326 + .long 2572405945 + .long 3208784108 + .long 2047107390 + .long 1053958905 + .long 2157300588 + .long 3201555925 + .long 3371055275 + .long 1071576875 + .long 1069844800 + .long 1015429887 + .long 3166931521 + .long 3216972217 + .long 3220968514 + .long 3161728497 + .long 4141120019 + .long 1057975373 + .long 3048513049 + .long 3204734413 + .long 1172170140 + .long 1059250739 + .long 2600146741 + .long 3206041877 + .long 2751605624 + .long 1060573214 + .long 1663282963 + .long 3207426590 + .long 3895324829 + .long 1055298027 + .long 157415216 + .long 3202171477 + .long 3734613381 + .long 1056602430 + .long 277770430 + .long 3203481600 + .long 3198889327 + .long 3217706325 + .long 2705408501 + .long 1014676637 + .long 59787751 + .long 1073579891 + .long 1470716836 + .long 1013369721 + .long 2045320829 + .long 1061536716 + .long 93552279 + .long 3208285776 + .long 1578930691 + .long 1053381091 + .long 2541023 + .long 3199217833 + .long 2303467340 + .long 1072252569 + .long 567354353 + .long 1016170573 + .long 4277811695 + .long 1072049730 + .long 3950020367 + .long 3160819724 + .long 2523318625 + .long 1057215902 + .long 2302510246 + .long 3203993877 + .long 298082853 + .long 1058616118 + .long 2097322096 + .long 3205466603 + .long 1798601470 + .long 1060132265 + .long 1407285416 + .long 3206822737 + .long 4077669298 + .long 1054450862 + .long 2333929458 + .long 3201533971 + .long 2747507284 + .long 1055881541 + .long 2839080721 + .long 3202576178 + .long 3383958356 + .long 3218498155 + .long 613656875 + .long 1017795528 + .long 173059452 + .long 1075530818 + .long 704088483 + .long 1015836313 + .long 669591746 + .long 1061765380 + .long 2029568326 + .long 3208524070 + .long 4157429832 + .long 1054150757 + .long 704852271 + .long 3201323640 + .long 846452204 + .long 1073165719 + .long 1707052239 + .long 1015225852 + .long 1011120585 + .long 1074996836 + .long 2354399398 + .long 3161432137 + .long 954697072 + .long 1057288366 + .long 1270411324 + .long 3204047380 + .long 711769130 + .long 1058758297 + .long 1128721 + .long 3205559284 + .long 179011054 + .long 1060257504 + .long 4204770871 + .long 3206955261 + .long 3137275514 + .long 1053955134 + .long 762311517 + .long 3199983289 + .long 728345252 + .long 1056011172 + .long 1369631397 + .long 3202845593 + .long 3569027386 + .long 3214047105 + .long 3629871173 + .long 3159432582 + .long 2480864277 + .long 1072801415 + .long 765976303 + .long 1016615598 + .long 759560957 + .long 1082479958 + .long 4267700141 + .long 3214355674 + .long 519344805 + .long 3246817843 + .long 220815467 + .long 3246677566 + .long 585197945 + .long 1074992152 + .long 3068616556 + .long 1020233496 + .long 4125953813 + .long 3215772665 + .long 1932096513 + .long 3151829739 + .long 891522464 + .long 1087323966 + .long 2489260670 + .long 3237524288 + .long 198576582 + .long 1086294508 + .long 1118764770 + .long 3231025522 + .long 4028480604 + .long 1084377135 + .long 1979567970 + .long 3223360994 + .long 4063308394 + .long 3244561236 + .long 4166146281 + .long 3246077527 + .long 2664161993 + .long 3240072782 + .long 259025260 + .long 3242645417 + .long 378360574 + .long 1070238620 + .long 2959696752 + .long 1069921292 + .long 573154909 + .long 1069707436 + .long 4044344316 + .long 1069551882 + .long 477218588 + .long 1069314503 + .long 0 + .long 3217031168 + .long 2454267026 + .long 1069697316 + .long 1431655765 + .long 3217380693 + .long 2576980378 + .long 1070176665 + .long 0 + .long 3218079744 + .long 1431655765 + .long 1070945621 + .long 0 + .long 3219128320 + .long 2759451285 + .long 3216787420 + .long 439852373 + .long 3160440428 + .long 925239789 + .long 1070204188 + .long 1052235825 + .long 1014694615 + .long 2825585883 + .long 3219218351 + .long 1250510261 + .long 3158266606 + .long 4280873151 + .long 1070880196 + .long 3382653115 + .long 1014364358 + .long 3432120556 + .long 1060112640 + .long 1689864936 + .long 3206804514 + .long 2559966835 + .long 1058598642 + .long 1675881979 + .long 3205446725 + .long 3157807190 + .long 1057195995 + .long 83437824 + .long 3203930944 + .long 714759041 + .long 1055696489 + .long 94115283 + .long 3202310560 + .long 231342353 + .long 1053665780 + .long 2283895727 + .long 3199602663 + .long 2514471110 + .long 1050042839 + .long 1783553765 + .long 3194406773 + .long 2977985131 + .long 3217141333 + .long 1199854581 + .long 3162366396 + .long 2962538897 + .long 3216960405 + .long 4143040985 + .long 3159573871 + .long 1505583242 + .long 1067626192 + .long 1685935487 + .long 1007379916 + .long 1307717362 + .long 1071507942 + .long 2592844004 + .long 1015649171 + .long 799685378 + .long 1060113448 + .long 3181808512 + .long 3206805166 + .long 237118685 + .long 1058600582 + .long 1021521704 + .long 3205452843 + .long 562863096 + .long 1057199158 + .long 124222188 + .long 3203968611 + .long 666083857 + .long 1055962453 + .long 2573104645 + .long 3202709164 + .long 3241565485 + .long 1053885149 + .long 1335355988 + .long 3200533016 + .long 1040080838 + .long 1054134824 + .long 2847172487 + .long 3201012249 + .long 3198889327 + .long 3217706325 + .long 1543330549 + .long 3160864782 + .long 4277811695 + .long 1072049730 + .long 993295933 + .long 1014676638 + .long 59787751 + .long 1073579891 + .long 130295530 + .long 1013369744 + .long 2303467340 + .long 1072252569 + .long 3943765603 + .long 1016170278 + .long 3608922566 + .long 1060045649 + .long 1453569939 + .long 3207287740 + .long 3338057825 + .long 3206066477 + .long 3038862383 + .long 3208900206 + .long 2094875998 + .long 3209983096 + .long 1016858122 + .long 3211012944 + .long 2854570659 + .long 3211659217 + .long 1144696552 + .long 3211904901 + .long 2176258130 + .long 3211749311 + .long 3478125247 + .long 3210994876 + .long 2355567962 + .long 3209692799 + .long 3598755244 + .long 3207186288 + .long 3383958356 + .long 3218498155 + .long 141035778 + .long 3162876606 + .long 1011120585 + .long 1074996836 + .long 1865540452 + .long 1017795522 + .long 173059452 + .long 1075530818 + .long 1582816653 + .long 1015838421 + .long 846452204 + .long 1073165719 + .long 2382960778 + .long 1015259319 + .long 3627221817 + .long 1060257525 + .long 782594551 + .long 3206955283 + .long 1981242537 + .long 1058758037 + .long 1755079229 + .long 3205559658 + .long 2436997517 + .long 1057278666 + .long 3384076381 + .long 3204067450 + .long 2476719666 + .long 1056224805 + .long 337705071 + .long 3201230508 + .long 776493412 + .long 3197801902 + .long 2139883963 + .long 3204685556 + .long 1475852201 + .long 3204789337 + .long 945638604 + .long 3203947238 + .long 3198889327 + .long 3217706325 + .long 4282828456 + .long 3160832800 + .long 4277811695 + .long 1072049730 + .long 993624082 + .long 1014676638 + .long 59787751 + .long 1073579891 + .long 1881378167 + .long 1013369744 + .long 2303467340 + .long 1072252569 + .long 2285482445 + .long 1016170301 + .long 2583886559 + .long 1060132251 + .long 2972085422 + .long 3206822622 + .long 1867851267 + .long 1058615355 + .long 680445507 + .long 3205461644 + .long 1455562209 + .long 1057201491 + .long 2171135678 + .long 3203931082 + .long 973516116 + .long 1055683749 + .long 442346719 + .long 3202274605 + .long 3339219778 + .long 1053603010 + .long 4261370927 + .long 3199529466 + .long 1389725956 + .long 1049937931 + .long 3421055527 + .long 3194266408 + .long 3440444171 + .long 3149749917 + .long 2683862484 + .long 3093774621 + .long 1722766174 + .long 1073233897 + .long 1535800986 + .long 1017782563 + .long 2952983900 + .long 1075015403 + .long 1613333390 + .long 1019450778 + .long 1747624399 + .long 1077465903 + .long 1323746741 + .long 1077414384 + .long 2170768622 + .long 1079283370 + .long 3681271869 + .long 1079585146 + .long 2395326938 + .long 1081247483 + .long 1534348539 + .long 1081774816 + .long 339892429 + .long 1083288020 + .long 3528406654 + .long 1083985153 + .long 2588043907 + .long 1085376283 + .long 2346296707 + .long 1086214596 + .long 207705063 + .long 1087509517 + .long 2560418979 + .long 1088486188 + .long 2868926017 + .long 1088759609 + .long 1843351610 + .long 1091968574 + .long 2991121454 + .long 1008150290 + .long 2149211495 + .long 952864023 + .long 1596959828 + .long 1075781798 + .long 2172289614 + .long 1019977377 + .long 2540785903 + .long 1077531858 + .long 1236674410 + .long 1020936929 + .long 4153228343 + .long 1087542211 + .long 2696338690 + .long 1090238842 + .long 878599865 + .long 1092951715 + .long 1553131440 + .long 1095784438 + .long 1380037893 + .long 1098488966 + .long 2667481451 + .long 1101284640 + .long 2282526011 + .long 1104162081 + .long 2355356013 + .long 1106903006 + .long 2198000318 + .long 1109722332 + .long 415847444 + .long 1112609215 + .long 1244368631 + .long 1115409383 + .long 1504872183 + .long 1118250351 + .long 1483597343 + .long 1121215185 + .long 2372686104 + .long 1123791138 + .long 2950620603 + .long 1012416763 + .long 1854687498 + .long 952811571 + .long 4103214658 + .long 1077594716 + .long 2773032534 + .long 1020189917 + .long 3447799694 + .long 1081361429 + .long 400789830 + .long 1023147708 + .long 3214535591 + .long 1099259453 + .long 1237622722 + .long 1103959294 + .long 3800166525 + .long 1108620252 + .long 3349752687 + .long 1113359257 + .long 1736707866 + .long 1118068670 + .long 1604218008 + .long 1122855127 + .long 472376766 + .long 1127573289 + .long 2849635624 + .long 1132420823 + .long 1552594705 + .long 1137123494 + .long 3251899291 + .long 1141973158 + .long 523050174 + .long 1146711894 + .long 2820496385 + .long 1151553661 + .long 507113183 + .long 1156515491 + .long 3382661695 + .long 1160984436 + .long 1797993220 + .long 1014085677 + .long 1007534641 + .long 957814894 + .long 136949250 + .long 1079957294 + .long 360284395 + .long 1016466469 + .long 784478107 + .long 1086123203 + .long 2737766812 + .long 1029538613 + .long 1541190179 + .long 1113554317 + .long 209153222 + .long 1120512208 + .long 2353533988 + .long 1127569405 + .long 445988592 + .long 1134692642 + .long 3579939511 + .long 1141824664 + .long 1580626808 + .long 1148890066 + .long 214151816 + .long 1156005346 + .long 2068712408 + .long 1163158821 + .long 839406419 + .long 1170342165 + .long 3247543387 + .long 1177546316 + .long 4025420415 + .long 1184654254 + .long 956971024 + .long 1191825477 + .long 2268897124 + .long 1199100768 + .long 3197790250 + .long 1206020453 + .long 2712668744 + .long 1014362371 + .long 420246125 + .long 958137372 + .long 2654663338 + .long 1082564068 + .long 4161996347 + .long 1025251297 + .long 1213005072 + .long 1091554851 + .long 789699257 + .long 1035400076 + .long 800710857 + .long 1129640478 + .long 2496483081 + .long 1139363849 + .long 599798751 + .long 1149188652 + .long 1701185240 + .long 1158910290 + .long 2369516264 + .long 1168692319 + .long 283492325 + .long 1178587937 + .long 3183141054 + .long 1188335795 + .long 3641040163 + .long 1198179274 + .long 561697907 + .long 1208059224 + .long 1909654917 + .long 1217858291 + .long 2831089635 + .long 1227776627 + .long 2923368563 + .long 1237613769 + .long 3277782853 + .long 1247623400 + .long 2305379544 + .long 1257247294 + .long 2173558120 + .long 3167899773 + .long 3928519072 + .long 3112134976 + .long 2855828427 + .long 1085518855 + .long 2402042833 + .long 1029906467 + .long 3668949703 + .long 1097350789 + .long 1498999354 + .long 1041534216 + .long 1894732623 + .long 1147309596 + .long 3157447236 + .long 1159959522 + .long 1106557451 + .long 1172641345 + .long 2830063624 + .long 1185354419 + .long 1827524850 + .long 1198100435 + .long 3148494391 + .long 1210882790 + .long 408406249 + .long 1223697282 + .long 1409028207 + .long 1236424336 + .long 3586220107 + .long 1249179206 + .long 1522157876 + .long 1261965775 + .long 1820647987 + .long 1274787293 + .long 141517691 + .long 1287671841 + .long 1169226569 + .long 1300517027 + .long 1216765362 + .long 1313047128 + .long 1448028998 + .long 1021264728 + .long 3859033985 + .long 964258238 + .long 4275468065 + .long 1088663688 + .long 2839015045 + .long 1031960699 + .long 2471825140 + .long 1103641144 + .long 2116308392 + .long 1045704405 + .long 320063693 + .long 1166181438 + .long 1786259137 + .long 1181976509 + .long 2022503488 + .long 1197803342 + .long 3654410397 + .long 1213661261 + .long 3612544687 + .long 1229551918 + .long 2586390227 + .long 1245478664 + .long 4037720966 + .long 1261441627 + .long 425603198 + .long 1277313397 + .long 2335359117 + .long 1293212748 + .long 663099774 + .long 1309143515 + .long 3275152075 + .long 1325108897 + .long 3939307299 + .long 1341142935 + .long 2389223216 + .long 1357131850 + .long 3001851795 + .long 1372807567 + .long 2843660044 + .long 1027797837 + .long 4081430736 + .long 972886614 + .long 59873159 + .long 1091970578 + .long 89491691 + .long 1036070212 + .long 800587417 + .long 1110354163 + .long 1316695415 + .long 1054362062 + .long 1053415956 + .long 1186120592 + .long 1951112295 + .long 1205224339 + .long 3452306653 + .long 1224406940 + .long 3087408826 + .long 1243649885 + .long 3141065505 + .long 1262791580 + .long 1611223017 + .long 1282016047 + .long 2457220276 + .long 1301315843 + .long 567478369 + .long 1320490698 + .long 744018712 + .long 1339759601 + .long 3767838035 + .long 1359052970 + .long 2731826519 + .long 1378265330 + .long 2965944329 + .long 1397620918 + .long 3792836018 + .long 1416954415 + .long 4140163483 + .long 1435938859 + .long 3803251356 + .long 1031449026 + .long 1468351707 + .long 974519095 + .long 1510773204 + .long 1095479170 + .long 3459876679 + .long 1039900066 + .long 2329980675 + .long 1117254636 + .long 1442547585 + .long 1060380811 + .long 3793321184 + .long 1207035105 + .long 3851928555 + .long 1229621800 + .long 221632261 + .long 1252267869 + .long 2942953492 + .long 1274996464 + .long 3017520070 + .long 1297616871 + .long 239470767 + .long 1320348902 + .long 1043025700 + .long 1343095998 + .long 252688637 + .long 1365768517 + .long 3880214591 + .long 1388528317 + .long 3579258508 + .long 1411323545 + .long 4034496078 + .long 1434003397 + .long 4007330572 + .long 1456787727 + .long 4167750282 + .long 1479686237 + .long 1263363363 + .long 1502124177 + .long 1204128515 + .long 3180787222 + .long 711751003 + .long 3124411148 + .long 655669005 + .long 1099106472 + .long 1779452985 + .long 1041271036 + .long 3714137145 + .long 1124508819 + .long 3422050113 + .long 1068643358 + .long 2129754319 + .long 1228815190 + .long 1696310114 + .long 1255068559 + .long 1933048134 + .long 1281362741 + .long 1387613391 + .long 1307637530 + .long 3120180336 + .long 1333930483 + .long 2543548174 + .long 1360241860 + .long 1743952085 + .long 1386572739 + .long 830746048 + .long 1412924879 + .long 3823372438 + .long 1439300663 + .long 3126160514 + .long 1465701841 + .long 3650788872 + .long 1492126330 + .long 1753940109 + .long 1518485640 + .long 4158688957 + .long 1544943454 + .long 2419002512 + .long 1571054314 + .long 1387068573 + .long 1036196119 + .long 693317055 + .long 975620966 + .long 85037501 + .long 1102875900 + .long 2766547698 + .long 1047046221 + .long 692715848 + .long 1132034342 + .long 4084350207 + .long 1074738271 + .long 3670967869 + .long 1251313085 + .long 877136010 + .long 1281389973 + .long 2367669872 + .long 1311355635 + .long 127681551 + .long 1341415835 + .long 294488793 + .long 1371561390 + .long 2268228308 + .long 1401588863 + .long 1971903155 + .long 1431680659 + .long 3068569563 + .long 1461838328 + .long 2810042085 + .long 1491968471 + .long 1803405805 + .long 1522051425 + .long 2718559511 + .long 1552192554 + .long 1282364655 + .long 1582403523 + .long 2077022624 + .long 1612690417 + .long 3574791831 + .long 1642467624 + .long 1679930357 + .long 3189181796 + .long 2680901783 + .long 3131938295 + .long 3217922759 + .long 1106719372 + .long 512421297 + .long 1047804811 + .long 767402551 + .long 1139855610 + .long 1780644693 + .long 1084244525 + .long 2568107092 + .long 1274594461 + .long 3742446639 + .long 1308542877 + .long 2828203709 + .long 1342408213 + .long 1035153137 + .long 1376332101 + .long 135830143 + .long 1410361976 + .long 3493601403 + .long 1444258562 + .long 2859691870 + .long 1478279541 + .long 289914903 + .long 1512259079 + .long 388251426 + .long 1546250265 + .long 3047966471 + .long 1580303536 + .long 3861742472 + .long 1614266653 + .long 1260166508 + .long 1648392316 + .long 904399223 + .long 1682450578 + .long 3334685854 + .long 1716212562 + .long 883499133 + .long 1045834798 + .long 1040153219 + .long 987496666 + .long 789418155 + .long 1110723643 + .long 2045920566 + .long 1052287721 + .long 682953991 + .long 1147781119 + .long 96584340 + .long 1092099645 + .long 666163210 + .long 1298545479 + .long 1527740296 + .long 1336421526 + .long 43027861 + .long 1374344588 + .long 1893757912 + .long 1412317817 + .long 3310921752 + .long 1450264132 + .long 1086815150 + .long 1488186400 + .long 2822587825 + .long 1526147814 + .long 1629445394 + .long 1564156239 + .long 2622810410 + .long 1602221540 + .long 2876661682 + .long 1640163607 + .long 151499969 + .long 1678143447 + .long 3591180187 + .long 1716205976 + .long 126024331 + .long 1754364017 + .long 3251093187 + .long 1792100966 + .long 2455853998 + .long 3194846833 + .long 2105329433 + .long 3137419111 + .long 1677091468 + .long 1114834807 + .long 3103559369 + .long 1057563919 + .long 156965555 + .long 1155965375 + .long 1332523955 + .long 1098438055 + .long 2734085455 + .long 1323184128 + .long 3116950081 + .long 1365165587 + .long 2683234966 + .long 1407189808 + .long 2373753488 + .long 1449192848 + .long 1367022160 + .long 1491213979 + .long 3828829922 + .long 1533253445 + .long 649201501 + .long 1575312310 + .long 1349232455 + .long 1617392311 + .long 2871919995 + .long 1659495809 + .long 3481654166 + .long 1701624529 + .long 3617101938 + .long 1743779051 + .long 431481593 + .long 1785867563 + .long 121308995 + .long 1828052659 + .long 357611834 + .long 1869892289 + .long 294133886 + .long 3202139689 + .long 3712546231 + .long 3146198591 + .long 3880935161 + .long 1119029102 + .long 59549724 + .long 1063684005 + .long 3647913141 + .long 1164353962 + .long 4227156178 + .long 1109331949 + .long 3682674216 + .long 1348349871 + .long 2807072537 + .long 1394525619 + .long 2124002856 + .long 1440744183 + .long 2605559380 + .long 1486941516 + .long 2185296140 + .long 1533156938 + .long 3364132884 + .long 1579390693 + .long 3636842097 + .long 1625643843 + .long 1564856349 + .long 1671918127 + .long 282911834 + .long 1718215904 + .long 224295158 + .long 1764538898 + .long 1397797422 + .long 1810887684 + .long 130160665 + .long 1857170584 + .long 3494254532 + .long 1903549984 + .long 2087544159 + .long 1949584056 + .long 2070009724 + .long 3207114478 + .long 3313155961 + .long 3151739743 + .long 1799064076 + .long 1123301109 + .long 3318052585 + .long 1067728611 + .long 1398608221 + .long 1172933154 + .long 3195587656 + .long 1117275768 + .long 3966862011 + .long 1374007527 + .long 3094801078 + .long 1424457063 + .long 201966774 + .long 1474951107 + .long 1216746698 + .long 1525492144 + .long 4169038329 + .long 1576047750 + .long 2574869838 + .long 1626540825 + .long 3353136223 + .long 1677069826 + .long 246421124 + .long 1727641760 + .long 3497001028 + .long 1778265406 + .long 1014877316 + .long 1828833334 + .long 2620327651 + .long 1879376562 + .long 1343179361 + .long 1929994932 + .long 3499694378 + .long 1980775534 + .long 852481763 + .long 2031094897 + .long 858300611 + .long 1060903333 + .long 1069421656 + .long 1004554972 + .long 381774873 + .long 1127661932 + .long 2890562600 + .long 1072008419 + .long 3230239600 + .long 1181757061 + .long 1093463150 + .long 1126994478 + .long 2041459920 + .long 1400246667 + .long 1834149192 + .long 1455089424 + .long 3431867819 + .long 1509997896 + .long 673297555 + .long 1564813682 + .long 2939272129 + .long 1619727956 + .long 2561583193 + .long 1674674892 + .long 1592460776 + .long 1729549373 + .long 4229377564 + .long 1784543364 + .long 3147274091 + .long 1839450750 + .long 199676655 + .long 1894400365 + .long 515597810 + .long 1949398723 + .long 2826001657 + .long 2004337665 + .long 1832191040 + .long 2059473164 + .long 486033509 + .long 2114113687 + .long 2615285763 + .long 3215685247 + .long 3139164341 + .long 3160067829 + .long 2576980377 + .long 1132042649 + .long 2136544456 + .long 1076438044 + .long 1202590842 + .long 1190427361 + .long 3058408830 + .long 1135356281 + .long 2163381214 + .long 1426480799 + .long 2353327718 + .long 1485745575 + .long 3794661129 + .long 1544911246 + .long 3594844771 + .long 1604225727 + .long 3801864141 + .long 1663434111 + .long 1474426882 + .long 1722809436 + .long 2103181697 + .long 1782019277 + .long 1306699518 + .long 1841386098 + .long 2394149058 + .long 1900657427 + .long 2802357954 + .long 1959997432 + .long 4190579671 + .long 2019374921 + .long 1589399104 + .long 2078657782 + .long 459261522 + .long 2137266825 + .long 4294967295 + .long 2146435071 + .long 158971950 + .long 3154658393 + .long 3459173435 + .long 3099360488 + .long 2835657100 + .long 3221135661 + .long 3134582638 + .long 3163662002 + .long 1009146449 + .long 1076045439 + .long 2177907437 + .long 1020724564 + .long 2093419253 + .long 1082406719 + .long 3184966549 + .long 3231785529 + .long 3799028631 + .long 1086175845 + .long 81768581 + .long 3235523877 + .long 1017495356 + .long 1089951767 + .long 1546026610 + .long 3239380678 + .long 980092412 + .long 1093867758 + .long 4064795288 + .long 3243341671 + .long 3027586419 + .long 1097863735 + .long 1002816472 + .long 3247290528 + .long 985745927 + .long 1101758613 + .long 1714999460 + .long 3251222455 + .long 808706777 + .long 1105883774 + .long 2540867906 + .long 3255308994 + .long 1548702939 + .long 3157340334 + .long 1276328330 + .long 3102548777 + .long 2523682374 + .long 3224680861 + .long 1002691513 + .long 3168986622 + .long 2919511741 + .long 1081046750 + .long 3737147325 + .long 1024759629 + .long 2879373926 + .long 1098115315 + .long 103788827 + .long 3250052030 + .long 3732555687 + .long 1107111798 + .long 3845853773 + .long 3259114079 + .long 3808164400 + .long 1116131626 + .long 1738785984 + .long 3268214722 + .long 581652 + .long 1125291233 + .long 3382894442 + .long 3277322952 + .long 2879368705 + .long 1134502288 + .long 2391566275 + .long 3286518813 + .long 274553400 + .long 1143638273 + .long 512789562 + .long 3295790146 + .long 3583864087 + .long 1152986324 + .long 2337425402 + .long 3304798727 + .long 1854575809 + .long 3159867196 + .long 1765059742 + .long 3103980390 + .long 1056564255 + .long 3227329098 + .long 957604928 + .long 3170301297 + .long 1737111893 + .long 1086018364 + .long 3821479224 + .long 1030262355 + .long 1397067068 + .long 1113230428 + .long 1054232731 + .long 3267692171 + .long 1978243918 + .long 1127284645 + .long 3722409577 + .long 3281775634 + .long 1918858489 + .long 1141323813 + .long 3391721543 + .long 3295903979 + .long 2607178807 + .long 1155564765 + .long 3212344015 + .long 3310103974 + .long 3369531970 + .long 1169698149 + .long 335451402 + .long 3324302881 + .long 431247382 + .long 1183973580 + .long 3717434926 + .long 3338657222 + .long 1904523769 + .long 1198380992 + .long 8765522 + .long 3352646819 + .long 2089515505 + .long 1016996008 + .long 1260660699 + .long 961055715 + .long 2755288594 + .long 3230032374 + .long 651647436 + .long 3174928677 + .long 3079991920 + .long 1091533276 + .long 3443268597 + .long 1035583207 + .long 3925746702 + .long 1129598292 + .long 1087270140 + .long 3286788174 + .long 494941268 + .long 1149105228 + .long 1413067450 + .long 3306335280 + .long 2943951130 + .long 1168609830 + .long 1917094202 + .long 3325955583 + .long 3282582259 + .long 1188254230 + .long 205065768 + .long 3345548222 + .long 3975827413 + .long 1207978573 + .long 608024766 + .long 3365228477 + .long 514952666 + .long 1227617187 + .long 1683103546 + .long 3384985256 + .long 3324939681 + .long 1247457575 + .long 4078451799 + .long 3404527118 + .long 3100987862 + .long 1019853288 + .long 2384335067 + .long 962691388 + .long 2781784351 + .long 3233000439 + .long 1271614660 + .long 3176489869 + .long 626016822 + .long 1097348250 + .long 3842822006 + .long 1040353260 + .long 2239739676 + .long 1147303774 + .long 189136319 + .long 3307436007 + .long 2396687400 + .long 1172632530 + .long 1908223243 + .long 3332827221 + .long 2121588596 + .long 1198087089 + .long 3983173167 + .long 3358350016 + .long 2487337699 + .long 1223686165 + .long 3249965797 + .long 3383895554 + .long 3887284480 + .long 1249163916 + .long 138948171 + .long 3409430498 + .long 1463100005 + .long 1274763805 + .long 34738943 + .long 3435142323 + .long 2889101777 + .long 1300502035 + .long 2665757401 + .long 3460504734 + .long 987318156 + .long 3170486179 + .long 252831213 + .long 3113594951 + .long 4266405771 + .long 3236147062 + .long 52757777 + .long 3180182741 + .long 1823142101 + .long 1103640807 + .long 3806357955 + .long 1046313461 + .long 875359927 + .long 1166180665 + .long 1815208659 + .long 3329459206 + .long 1303129141 + .long 1197802172 + .long 4280462790 + .long 3361143469 + .long 626701262 + .long 1229550147 + .long 2303856491 + .long 3392960132 + .long 2759522360 + .long 1261440286 + .long 145515022 + .long 3424795397 + .long 2201193688 + .long 1293210725 + .long 2057332964 + .long 3456624552 + .long 3539517099 + .long 1325105434 + .long 1364231459 + .long 3488625947 + .long 3421843712 + .long 1357133388 + .long 200896422 + .long 3520281853 + .long 951171540 + .long 1026768452 + .long 3090769089 + .long 971487574 + .long 4234403032 + .long 3239454189 + .long 1460268972 + .long 3184474466 + .long 1346899734 + .long 1110354113 + .long 145456861 + .long 1052864217 + .long 2924701438 + .long 1186120500 + .long 3023147446 + .long 3352707860 + .long 1486479387 + .long 1224406765 + .long 1193997181 + .long 3391133412 + .long 2679629000 + .long 1262791412 + .long 2670450976 + .long 3429499462 + .long 1831795719 + .long 1301315682 + .long 3473315319 + .long 3467974125 + .long 2616420704 + .long 1339759302 + .long 1949536880 + .long 3506536322 + .long 2518396463 + .long 1378264708 + .long 142869669 + .long 3545106524 + .long 804820494 + .long 1416958345 + .long 2985125801 + .long 3583414179 + .long 2729716642 + .long 3174389784 + .long 1779261930 + .long 3115790859 + .long 2784196366 + .long 3242962813 + .long 2825451289 + .long 3185986297 + .long 2032114899 + .long 1117254632 + .long 1505002334 + .long 1059738942 + .long 3277658686 + .long 1207035096 + .long 498115686 + .long 3377105433 + .long 1711172328 + .long 1252267855 + .long 261417437 + .long 3422480089 + .long 1133240684 + .long 1297616851 + .long 1456800292 + .long 3467832532 + .long 2145797446 + .long 1343095967 + .long 2516644728 + .long 3513252141 + .long 725820954 + .long 1388528302 + .long 3986994814 + .long 3558807006 + .long 1955265405 + .long 1434003000 + .long 122646123 + .long 3604272992 + .long 1491943337 + .long 1479689885 + .long 1036478018 + .long 3649599135 + .long 523859850 + .long 3181400160 + .long 3846079041 + .long 3121433884 + .long 3639230521 + .long 3246590119 + .long 2638130497 + .long 3191278647 + .long 2154057324 + .long 1124508819 + .long 3236410824 + .long 1069265219 + .long 175871336 + .long 1228815189 + .long 2852522281 + .long 3402552205 + .long 1806384070 + .long 1281362740 + .long 423509286 + .long 3455121177 + .long 1160294737 + .long 1333930482 + .long 3543120866 + .long 3507725506 + .long 1036273485 + .long 1386572737 + .long 2942188771 + .long 3560408527 + .long 2777944578 + .long 1439300670 + .long 2738100981 + .long 3613185349 + .long 527942274 + .long 1492126097 + .long 1294011372 + .long 3665970729 + .long 3274455694 + .long 1544947882 + .long 1889769429 + .long 3718530789 + .long 136073262 + .long 1038797747 + .long 502134597 + .long 982165232 + .long 4211775762 + .long 3250359547 + .long 1347037926 + .long 3194312374 + .long 543769047 + .long 1132034342 + .long 1153606166 + .long 1076402838 + .long 3293430877 + .long 1251313085 + .long 540290119 + .long 3428873621 + .long 1766589444 + .long 1311355635 + .long 3887512491 + .long 3488899482 + .long 4113271272 + .long 1371561389 + .long 1216453194 + .long 3549072511 + .long 761821280 + .long 1431680659 + .long 3412859739 + .long 3609321978 + .long 1736216465 + .long 1491968482 + .long 1379671921 + .long 3669534956 + .long 871564305 + .long 1552192257 + .long 3755076681 + .long 3729888559 + .long 465380849 + .long 1612696812 + .long 1801521440 + .long 3789943511 + .long 926050541 + .long 3187761455 + .long 2363428923 + .long 3130505121 + .long 3212464044 + .long 3254203020 + .long 1767044225 + .long 3196691034 + .long 767402551 + .long 1139855610 + .long 3251527812 + .long 1084244526 + .long 2568107110 + .long 1274594461 + .long 3742439917 + .long 3456026525 + .long 2828194370 + .long 1342408213 + .long 1036563767 + .long 3523815749 + .long 138125806 + .long 1410361976 + .long 3332253618 + .long 3591742210 + .long 2265969007 + .long 1478279541 + .long 2044799860 + .long 3659742729 + .long 3159788672 + .long 1546250274 + .long 3040087996 + .long 3727787101 + .long 3566786041 + .long 1614266310 + .long 3445702274 + .long 3795877266 + .long 1647738551 + .long 1682455451 + .long 820553625 + .long 3863686600 + .long 2466985759 + .long 1045839115 + .long 2115301394 + .long 988248469 + .long 789067623 + .long 3258207291 + .long 2594430310 + .long 3200300918 + .long 682953991 + .long 1147781119 + .long 334308353 + .long 1092099647 + .long 666163226 + .long 1298545479 + .long 1527735017 + .long 3483905174 + .long 43015025 + .long 1374344588 + .long 1895454381 + .long 3559801465 + .long 3313337462 + .long 1450264132 + .long 938251762 + .long 3635670048 + .long 2344246077 + .long 1526147814 + .long 3329926839 + .long 3711639890 + .long 2189826955 + .long 1602221552 + .long 307911546 + .long 3787647166 + .long 4271816317 + .long 1678143122 + .long 3455709496 + .long 3863691777 + .long 509127304 + .long 1754367541 + .long 2246034954 + .long 3939578533 + .long 309332673 + .long 3194846686 + .long 4050026421 + .long 3139306075 + .long 1677069013 + .long 3262318455 + .long 407665306 + .long 3207206552 + .long 156965555 + .long 1155965375 + .long 2320115828 + .long 1098438062 + .long 2734085477 + .long 1323184128 + .long 3116943360 + .long 3512649235 + .long 2683227306 + .long 1407189808 + .long 2374702532 + .long 3596676496 + .long 1369556142 + .long 1491213979 + .long 3682738445 + .long 3680737093 + .long 208207094 + .long 1575312310 + .long 1070212038 + .long 3764875962 + .long 1332751409 + .long 1659495819 + .long 2960239586 + .long 3849108041 + .long 1328259946 + .long 1743778590 + .long 2152673987 + .long 3933352648 + .long 2459568424 + .long 1828057070 + .long 1053026559 + .long 4017368800 + .long 4272716315 + .long 3202139688 + .long 2347479448 + .long 3145750572 + .long 3880933726 + .long 3266512750 + .long 1526392126 + .long 3209922805 + .long 3647913141 + .long 1164353962 + .long 3796124307 + .long 1109331951 + .long 3682674239 + .long 1348349871 + .long 2807065817 + .long 3542009267 + .long 2123995152 + .long 1440744183 + .long 2606508288 + .long 3634425164 + .long 2187838465 + .long 1533156938 + .long 3218070138 + .long 3726874341 + .long 3194985081 + .long 1625643843 + .long 1282672122 + .long 3819401778 + .long 3085269549 + .long 1718215913 + .long 4171823927 + .long 3912022409 + .long 2286527342 + .long 1810887222 + .long 4263058773 + .long 4004655668 + .long 276869381 + .long 1903554397 + .long 2981609009 + .long 4097060567 + .long 2069415824 + .long 3207114478 + .long 3815897610 + .long 3150201997 + .long 1799063985 + .long 3270784757 + .long 609928762 + .long 3210962773 + .long 1398608221 + .long 1172933154 + .long 2839394180 + .long 1117275773 + .long 3966862031 + .long 1374007527 + .long 3094795956 + .long 3571940711 + .long 201952387 + .long 1474951107 + .long 1218377639 + .long 3672975792 + .long 4171572408 + .long 1576047750 + .long 2433360787 + .long 3774024473 + .long 2872117748 + .long 1677069826 + .long 1125668053 + .long 3875125411 + .long 1838424462 + .long 1778265418 + .long 1923560800 + .long 3976316898 + .long 2192672438 + .long 1879376253 + .long 2795231406 + .long 4077480577 + .long 3134618972 + .long 1980778833 + .long 2542206299 + .long 4178570441 + .long 858317418 + .long 1060903333 + .long 3120786235 + .long 1004681431 + .long 381774867 + .long 3275145580 + .long 1575769843 + .long 3219836452 + .long 3230239600 + .long 1181757061 + .long 1694309796 + .long 1126994475 + .long 2041459926 + .long 1400246667 + .long 1834143305 + .long 3602573072 + .long 3431862699 + .long 1509997896 + .long 674489055 + .long 3712297330 + .long 2942256815 + .long 1619727956 + .long 2430104127 + .long 3822158540 + .long 1181772448 + .long 1729549373 + .long 3316918483 + .long 3932027016 + .long 2290692518 + .long 1839450757 + .long 717742192 + .long 4041883887 + .long 2723262413 + .long 1949398481 + .long 726994291 + .long 4151823214 + .long 2316520017 + .long 2059476550 + .long 3506192554 + .long 4261590717 + .long 2615285756 + .long 3215685247 + .long 3456994573 + .long 3158988097 + .long 2576980377 + .long 3279526297 + .long 457772008 + .long 3222963352 + .long 1202590842 + .long 1190427361 + .long 3150210795 + .long 1135356295 + .long 2163381170 + .long 1426480799 + .long 2353315751 + .long 3633229223 + .long 3794716365 + .long 1544911246 + .long 3598226895 + .long 3751709375 + .long 3778743776 + .long 1663434111 + .long 1038551128 + .long 3870293084 + .long 2177305923 + .long 1782019278 + .long 316150431 + .long 3988869748 + .long 3666573938 + .long 1900657340 + .long 1225202613 + .long 4107481261 + .long 4106613245 + .long 2019377222 + .long 3685171119 + .long 4226128894 + .long 3001847201 + .long 2137308914 + .long 4294967295 + .long 4293918719 + .type _dbA,@object + .size _dbA,8032 + .space 672, 0x00 # pad + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_OFW_BOUND: + .word 60404 + .word 65533 + .word 19595 + .word 47317 + .word 32753 + .word 0 + .type _OFW_BOUND,@object + .size _OFW_BOUND,12 + .align 2 +_TWO5600: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 21983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 10783 + .word 0 + .type _TWO5600,@object + .size _TWO5600,24 + .data + .hidden __libm_logl_k80 + .hidden fesetround + .hidden fegetround + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_atan2l_k80.S b/external/sgx_libm/ia32/libm_atan2l_k80.S new file mode 100644 index 0000000000..525d374d7f --- /dev/null +++ b/external/sgx_libm/ia32/libm_atan2l_k80.S @@ -0,0 +1,1634 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_atan2l_k80.c" + .text +..TXTST0: +# -- Begin __libm_atan2l_k80 + .text + .align 16,0x90 + .hidden __libm_atan2l_k80 + .globl __libm_atan2l_k80 +__libm_atan2l_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl 16(%ebp), %edx + movl 12(%ebp), %ecx + movl %gs:20, %eax + movzbl 9(%edx), %esi + xorl %esp, %eax + andl $128, %esi + movl %eax, 172(%esp) + shrl $7, %esi + movl %esi, 44(%esp) + movzbl 9(%ecx), %esi + movzwl 8(%ecx), %eax + andl $128, %esi + andl $32767, %eax + movzwl 8(%edx), %edi + shrl $7, %esi + andl $32767, %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $32767, %eax + je ..B1.110 +..B1.2: + cmpl $32767, %edi + je ..B1.97 +..B1.3: + movl 4(%ecx), %eax + testl %eax, %eax + jne ..B1.5 +..B1.4: + cmpl $0, (%ecx) + je ..B1.8 +..B1.5: + cmpl $0, 4(%edx) + jne ..B1.20 +..B1.6: + cmpl $0, (%edx) + jne ..B1.20 +..B1.7: + testl %eax, %eax + jne ..B1.17 +..B1.116: + cmpl $0, (%ecx) +..B1.8: + jne ..B1.17 +..B1.9: + cmpl $0, 4(%edx) + jne ..B1.14 +..B1.10: + cmpl $0, (%edx) + jne ..B1.14 +..B1.11: + movl 8(%ebp), %eax + cmpl $0, 44(%esp) + movl $0, 24(%eax) + je ..B1.13 +..B1.12: + movl 8(%ebp), %ecx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %edx + fldt _pi_00l@GOTOFF(%edx,%ebx) + fstpt (%ecx) + fldt _pilo_00l@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%edx,%ebx) + fsubrp %st, %st(1) + fstpt 12(%ecx) + jmp ..B1.18 +..B1.13: + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fldz + fmull ones@GOTOFF(%ebx,%esi,8) + movl 8(%ebp), %eax + fstpt (%eax) + fstpt 12(%eax) + jmp ..B1.18 +..B1.14: + movl 8(%ebp), %eax + cmpl $0, 44(%esp) + movl $0, 24(%eax) + je ..B1.16 +..B1.15: + movl 8(%ebp), %ecx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %edx + fldt _pi_00l@GOTOFF(%edx,%ebx) + fstpt (%ecx) + fldt _pilo_00l@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%edx,%ebx) + fsubrp %st, %st(1) + fstpt 12(%ecx) + jmp ..B1.18 +..B1.16: + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fldz + fmull ones@GOTOFF(%ebx,%esi,8) + movl 8(%ebp), %eax + fstpt (%eax) + fstpt 12(%eax) + jmp ..B1.18 +..B1.17: + movl 8(%ebp), %edx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %esi + fldt _pi_02l@GOTOFF(%esi,%ebx) + movl $0, 24(%edx) + fstpt (%edx) + fldt _pilo_02l@GOTOFF(%esi,%ebx) + fldt _small_value_80@GOTOFF(%esi,%ebx) + fsubrp %st, %st(1) + fstpt 12(%edx) +..B1.18: + movl 172(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.89 +..B1.19: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.20: + movl (%edx), %edi + lea 116(%esp), %eax + movl %edi, (%eax) + movl 4(%edx), %edi + movl %edi, 4(%eax) + movl 8(%edx), %edi + movl %edi, 8(%eax) + movl 12(%edx), %edi + movl %edi, 12(%eax) + movl 16(%edx), %edi + movl %edi, 16(%eax) + movl 20(%edx), %edi + movl 24(%edx), %edx + movl %edi, 20(%eax) + movl %edx, 24(%eax) + movl (%ecx), %edx + movl 4(%ecx), %edi + movl %edx, 28(%eax) + movl %edi, 32(%eax) + movl 8(%ecx), %edx + movl 12(%ecx), %edi + movl %edx, 36(%eax) + movl %edi, 40(%eax) + movl 16(%ecx), %edx + movl 20(%ecx), %edi + movl 24(%ecx), %ecx + movl %edx, 44(%eax) + movl %edi, 48(%eax) + movl %ecx, 52(%eax) + addl $4, %esp + pushl %eax + call __libm_normalizel_k80 +..B1.21: + addl $4, %esp + lea 140(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.22: + fldt 116(%esp) + fld %st(0) + fldt 128(%esp) + movl 44(%esp), %eax + fadd %st, %st(1) + movl 140(%esp), %ecx + fxch %st(1) + fsub %st, %st(2) + movl 168(%esp), %edx + cmpl %edx, %ecx + fxch %st(2) + fsubrp %st, %st(1) + fldt 144(%esp) + fld %st(0) + fldt 156(%esp) + fadd %st, %st(1) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fldl ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(4) + fmulp %st, %st(3) + fldl ones@GOTOFF(%ebx,%esi,8) + fmul %st, %st(2) + fmul %st, %st(1) + jg ..B1.25 +..B1.23: + jne ..B1.75 +..B1.24: + fxch %st(4) + fcom %st(2) + fnstsw %ax + sahf + fxch %st(4) + jbe ..B1.75 +..B1.25: + lea 12(%edx), %eax + cmpl %eax, %ecx + jle ..B1.70 +..B1.26: + lea 75(%edx), %eax + cmpl %eax, %ecx + jle ..B1.43 +..B1.27: + cmpl $0, 44(%esp) + je ..B1.29 +..B1.28: + fstp %st(0) + fstp %st(2) + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl 8(%ebp), %edx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %esi + fldt _pi_00l@GOTOFF(%esi,%ebx) + movl $0, 24(%edx) + fstpt (%edx) + fldt _pilo_00l@GOTOFF(%esi,%ebx) + fldt _small_value_80@GOTOFF(%esi,%ebx) + fsubrp %st, %st(1) + fstpt 12(%edx) + jmp ..B1.41 +..B1.29: + fxch %st(2) + fstpt 144(%esp) + fldt 144(%esp) + movzwl 152(%esp), %eax + andl $32767, %eax + fxch %st(4) + fstpt 116(%esp) + fldt 116(%esp) + cmpl $8383, %eax + jge ..B1.31 +..B1.30: + fstp %st(4) + fstp %st(3) + fxch %st(2) + fstpt 156(%esp) + fstpt 128(%esp) + jmp ..B1.37 +..B1.31: + cmpl $24383, %eax + jg ..B1.30 +..B1.33: + movzwl 124(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.30 +..B1.35: + cmpl $24383, %eax + fxch %st(3) + fxch %st(2) + fxch %st(4) + fxch %st(1) + jle ..B1.40 +..B1.36: + fstp %st(1) + fstp %st(2) + fxch %st(1) + fstpt 156(%esp) + fstpt 128(%esp) +..B1.37: + addl $4, %esp + lea 140(%esp), %eax + pushl %eax + fstpt -40(%eax) + call __libm_normalizel_k80 +..B1.38: + fldt 104(%esp) + addl $4, %esp + lea 112(%esp), %eax + pushl %eax + fstpt -12(%eax) + call __libm_normalizel_k80 +..B1.39: + fldt 104(%esp) + fldt 116(%esp) + fldt 128(%esp) + fldt 144(%esp) + fldt 156(%esp) + movl 140(%esp), %ecx + movl 168(%esp), %edx +..B1.40: + fld %st(1) + subl %ecx, %edx + fdiv %st(4), %st + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(5) + fstpt 104(%esp) + fxch %st(3) + fstpt 32(%esp) + fldt 32(%esp) + fldt .L_2il0floatpacket.16@GOTOFF(%ebx) + fld %st(0) + fmul %st(6), %st + fld %st(0) + movl 8(%ebp), %eax + fsubr %st(7), %st + movl %edx, 24(%eax) + faddp %st, %st(1) + fld %st(0) + fsubrp %st, %st(7) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsub %st(1), %st + faddp %st, %st(1) + fsubr %st, %st(2) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(7), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(6) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 48(%esp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(0) + fldt 32(%esp) + fdivrp %st, %st(3) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 104(%esp) + fmul %st, %st(1) + fxch %st(1) + fstpt (%eax) + fmulp %st, %st(1) + fstpt 12(%eax) + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + fldt _small_value_80@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt 16(%esp) +..B1.41: + movl 172(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.89 +..B1.42: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + subl %ecx, %edx + movzwl 8+.L_2il0floatpacket.12@GOTOFF(%ebx), %eax + addl $16383, %edx + movl %eax, 28(%esp) + andl $-32768, %eax + andl $32767, %edx + fstpt 88(%esp) + fldt 88(%esp) + orl %edx, %eax + movw %ax, 96(%esp) + xorl %edx, %edx + fxch %st(5) + fstpt 116(%esp) + fldt 116(%esp) + xorl %eax, %eax + fxch %st(5) + fstpt 64(%esp) + xorl %ecx, %ecx + fldt 88(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpt 144(%esp) + fldt 144(%esp) + movzwl 152(%esp), %esi + andl $32767, %esi + fxch %st(3) + fmulp %st, %st(2) + cmpl $0, 44(%esp) + je ..B1.57 +..B1.44: + cmpl $8383, %esi + jge ..B1.46 +..B1.45: + fstp %st(2) + fstp %st(3) + movl %eax, 168(%esp) + movl %eax, 140(%esp) + fxch %st(2) + fstpt 156(%esp) + fstpt 128(%esp) + jmp ..B1.52 +..B1.46: + cmpl $24383, %esi + jg ..B1.45 +..B1.48: + movzwl 124(%esp), %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B1.45 +..B1.50: + cmpl $24383, %esi + fxch %st(4) + fxch %st(3) + fxch %st(2) + fxch %st(1) + jle ..B1.55 +..B1.51: + fstp %st(1) + fstp %st(2) + movl %eax, 168(%esp) + movl %eax, 140(%esp) + fxch %st(1) + fstpt 156(%esp) + fstpt 128(%esp) +..B1.52: + addl $4, %esp + lea 140(%esp), %eax + pushl %eax + fstpt -40(%eax) + call __libm_normalizel_k80 +..B1.53: + fldt 104(%esp) + addl $4, %esp + lea 112(%esp), %eax + pushl %eax + fstpt -12(%eax) + call __libm_normalizel_k80 +..B1.54: + fldt 104(%esp) + fldt 116(%esp) + fldt 128(%esp) + fldt 144(%esp) + fldt 156(%esp) + movl 140(%esp), %edx + movl 168(%esp), %ecx +..B1.55: + fld %st(1) + subl %edx, %ecx + fdiv %st(4), %st + addl $16383, %ecx + fstpt 48(%esp) + fldt 48(%esp) + andl $32767, %ecx + fxch %st(5) + fstpt 104(%esp) + fxch %st(3) + fstpt 32(%esp) + fldt 32(%esp) + fldt .L_2il0floatpacket.16@GOTOFF(%ebx) + fld %st(0) + fmul %st(6), %st + fld %st(0) + movl 28(%esp), %eax + fsubr %st(7), %st + andl $-32768, %eax + faddp %st, %st(1) + fld %st(0) + orl %ecx, %eax + movl 8(%ebp), %edx + fsubrp %st, %st(7) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsub %st(1), %st + faddp %st, %st(1) + fsubr %st, %st(2) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(7), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(6) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 48(%esp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fldt 32(%esp) + fdivrp %st, %st(2) + faddp %st, %st(1) + fldt 64(%esp) + fstpt 88(%esp) + fldt 36+_P@GOTOFF(%ebx) + fldt 12+_P@GOTOFF(%ebx) + fldt 24+_P@GOTOFF(%ebx) + fldt _P@GOTOFF(%ebx) + movw %ax, 96(%esp) + fldt 88(%esp) + fmulp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + fadd %st(1), %st + fxch %st(1) + fstpt 88(%esp) + fldl 8192+__libm_atanl_table_128@GOTOFF(%ebx) + fldl 8200+__libm_atanl_table_128@GOTOFF(%ebx) + movl $0, 24(%edx) + fsubp %st, %st(2) + fldt 104(%esp) + fmul %st, %st(1) + fld %st(1) + fxch %st(1) + fmulp %st, %st(3) + fadd %st(2), %st + fstpt (%edx) + fldt (%edx) + fsubp %st, %st(1) + fsubrp %st, %st(1) + fstpt 12(%edx) + movl 172(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.89 +..B1.56: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.57: + cmpl $8383, %esi + jge ..B1.59 +..B1.58: + fstp %st(2) + fstp %st(3) + movl %eax, 168(%esp) + movl %eax, 140(%esp) + fxch %st(2) + fstpt 156(%esp) + fstpt 128(%esp) + jmp ..B1.65 +..B1.59: + cmpl $24383, %esi + jg ..B1.58 +..B1.61: + movzwl 124(%esp), %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B1.58 +..B1.63: + cmpl $24383, %esi + fxch %st(4) + fxch %st(3) + fxch %st(2) + fxch %st(1) + jle ..B1.68 +..B1.64: + fstp %st(1) + fstp %st(2) + movl %eax, 168(%esp) + movl %eax, 140(%esp) + fxch %st(1) + fstpt 156(%esp) + fstpt 128(%esp) +..B1.65: + addl $4, %esp + lea 140(%esp), %eax + pushl %eax + fstpt -40(%eax) + call __libm_normalizel_k80 +..B1.66: + fldt 104(%esp) + addl $4, %esp + lea 112(%esp), %eax + pushl %eax + fstpt -12(%eax) + call __libm_normalizel_k80 +..B1.67: + fldt 104(%esp) + fldt 116(%esp) + fldt 128(%esp) + fldt 144(%esp) + fldt 156(%esp) + movl 140(%esp), %edx + movl 168(%esp), %ecx +..B1.68: + fld %st(1) + subl %edx, %ecx + fdiv %st(4), %st + addl $16383, %ecx + fstpt 48(%esp) + fldt 48(%esp) + andl $32767, %ecx + fxch %st(5) + fstpt 104(%esp) + fxch %st(3) + fstpt 32(%esp) + fldt 32(%esp) + fldt .L_2il0floatpacket.16@GOTOFF(%ebx) + fld %st(0) + fmul %st(6), %st + fld %st(0) + movl 28(%esp), %eax + fsubr %st(7), %st + andl $-32768, %eax + faddp %st, %st(1) + fld %st(0) + orl %ecx, %eax + movl 8(%ebp), %edx + fsubrp %st, %st(7) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + movl $0, 24(%edx) + fsub %st(1), %st + faddp %st, %st(1) + fsubr %st, %st(2) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(7), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(6) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 48(%esp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fldt 32(%esp) + fdivrp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 64(%esp) + fstpt 88(%esp) + fldt 36+_P@GOTOFF(%ebx) + fldt 12+_P@GOTOFF(%ebx) + fldt _P@GOTOFF(%ebx) + movw %ax, 96(%esp) + fldt 88(%esp) + fmul %st, %st(4) + fmul %st, %st(4) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(1) + fmul %st, %st(6) + fmulp %st, %st(6) + fxch %st(4) + fstpt 88(%esp) + fldt 88(%esp) + fldt 24+_P@GOTOFF(%ebx) + fmulp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(2) + fldt 104(%esp) + fmul %st, %st(1) + fxch %st(1) + fstpt (%edx) + fmulp %st, %st(1) + fstpt 12(%edx) + movl 172(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.89 +..B1.69: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.70: + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + subl %ecx, %edx + addl $16383, %edx + movzwl 8+.L_2il0floatpacket.12@GOTOFF(%ebx), %eax + andl $32767, %edx + andl $-32768, %eax + fstpt 88(%esp) + orl %edx, %eax + movw %ax, 96(%esp) + fld %st(4) + fxch %st(1) + fstpt 104(%esp) + xorl %edx, %edx + fxch %st(4) + fstpt 116(%esp) + fldt 116(%esp) + fxch %st(3) + fstpt 128(%esp) + fldt 128(%esp) + fldt 88(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpt 144(%esp) + fldt 144(%esp) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt 156(%esp) + fldt 156(%esp) + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + fmul %st(3), %st + fdiv %st(4), %st + fldt .L_2il0floatpacket.14@GOTOFF(%ebx) + movl %edx, 140(%esp) + movl %edx, 168(%esp) + fxch %st(1) + faddl _TWO_63H@GOTOFF(%ebx) + fstpt 76(%esp) + fldt 76(%esp) + fldl _TWO_48H@GOTOFF(%ebx) + movl 76(%esp), %eax + shll $4, %eax + fxch %st(1) + fsubl _TWO_63H@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(5) + fmul %st(1), %st + cmpl $0, 44(%esp) + fadd %st, %st(7) + fxch %st(7) + fstpt 76(%esp) + fldt 76(%esp) + fsubp %st, %st(7) + fxch %st(5) + fsub %st(6), %st + faddp %st, %st(3) + fld %st(4) + fmul %st(4), %st + fld %st(0) + fadd %st(5), %st + fstpt 76(%esp) + fldt 76(%esp) + fsubp %st, %st(1) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fmul %st(1), %st + fadd %st(3), %st + fld %st(2) + fmul %st(2), %st + fadd %st(7), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + fsubrp %st, %st(5) + fxch %st(3) + fmulp %st, %st(6) + fxch %st(5) + fsubrp %st, %st(1) + fld %st(4) + fadd %st(2), %st + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + fdivp %st, %st(1) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fstpt 76(%esp) + fxch %st(4) + fstpt 88(%esp) + fldt 88(%esp) + fxch %st(2) + fmul %st(4), %st + fldt 76(%esp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(5), %st + fld %st(6) + fmul %st(1), %st + faddp %st, %st(2) + fxch %st(3) + fmul %st, %st(6) + fldt .L_2il0floatpacket.15@GOTOFF(%ebx) + faddp %st, %st(7) + fxch %st(1) + faddp %st, %st(6) + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fld %st(1) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(2) + fmul %st(3), %st + fxch %st(2) + fadd %st(3), %st + fld %st(1) + fmul %st(1), %st + faddp %st, %st(3) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fldt 36+_P@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ebx) + fmulp %st, %st(2) + fldt _P@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 104(%esp) + je ..B1.72 +..B1.71: + negl %eax + fld %st(2) + fldl 8192+__libm_atanl_table_128@GOTOFF(%ebx,%eax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fxch %st(3) + fstpt 88(%esp) + fldt 88(%esp) + fldl 8200+__libm_atanl_table_128@GOTOFF(%ebx,%eax) + fsubp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.73 +..B1.72: + fldl __libm_atanl_table_128@GOTOFF(%eax,%ebx) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + fstpt 88(%esp) + fldt 88(%esp) + fldl 8+__libm_atanl_table_128@GOTOFF(%eax,%ebx) + faddp %st, %st(3) + faddp %st, %st(2) +..B1.73: + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + movl 8(%ebp), %eax + fadd %st, %st(1) + movl $0, 24(%eax) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fstpt 12(%eax) + fstpt (%eax) + movl 172(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.89 +..B1.74: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.75: + lea 12(%ecx), %eax + cmpl %eax, %edx + jle ..B1.84 +..B1.76: + fstp %st(3) + fstp %st(0) + lea 75(%ecx), %eax + cmpl %eax, %edx + jg ..B1.82 +..B1.77: + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + subl %ecx, %edx + addl $16383, %edx + movzwl 8+.L_2il0floatpacket.12@GOTOFF(%ebx), %eax + andl $32767, %edx + andl $-32768, %eax + fstpt 88(%esp) + orl %edx, %eax + fldt 36+_P@GOTOFF(%ebx) + fldt _P@GOTOFF(%ebx) + movw %ax, 96(%esp) + fldt 88(%esp) + fmulp %st, %st(3) + fxch %st(2) + fdivrp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fldt 12+_P@GOTOFF(%ebx) + movl 8(%ebp), %edx + faddp %st, %st(3) + fmul %st, %st(2) + fldt 24+_P@GOTOFF(%ebx) + fmulp %st, %st(1) + cmpl $0, 44(%esp) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(2) + fldl 4096+__libm_atanl_table_128@GOTOFF(%ebx) + fmul %st(1), %st + fldl 4104+__libm_atanl_table_128@GOTOFF(%ebx) + movl $0, 24(%edx) + je ..B1.79 +..B1.78: + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + jmp ..B1.80 +..B1.79: + fsubp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) +..B1.80: + fld %st(0) + movl 8(%ebp), %eax + fadd %st(2), %st + fstpt (%eax) + fldt (%eax) + fsubp %st, %st(1) + fsubrp %st, %st(1) + fstpt 12(%eax) + movl 172(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.89 +..B1.81: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.82: + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl 8(%ebp), %edx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %esi + fldt _pi_02l@GOTOFF(%esi,%ebx) + movl $0, 24(%edx) + fstpt (%edx) + fldt _pilo_02l@GOTOFF(%esi,%ebx) + fldt _small_value_80@GOTOFF(%esi,%ebx) + fsubrp %st, %st(1) + fstpt 12(%edx) + movl 172(%esp), %ecx + xorl %esp, %ecx + cmpl %gs:20, %ecx + jne ..B1.89 +..B1.83: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.84: + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + subl %ecx, %edx + addl $16383, %edx + movzwl 8+.L_2il0floatpacket.12@GOTOFF(%ebx), %eax + andl $32767, %edx + andl $-32768, %eax + fstpt 88(%esp) + orl %edx, %eax + movw %ax, 96(%esp) + fld %st(4) + fxch %st(1) + fstpt 104(%esp) + xorl %edx, %edx + fxch %st(4) + fstpt 116(%esp) + fldt 116(%esp) + fxch %st(3) + fstpt 128(%esp) + fldt 128(%esp) + fldt 88(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpt 144(%esp) + fldt 144(%esp) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt 156(%esp) + fldt 156(%esp) + fldt .L_2il0floatpacket.13@GOTOFF(%ebx) + fmul %st(4), %st + fdiv %st(3), %st + fldt .L_2il0floatpacket.14@GOTOFF(%ebx) + movl %edx, 140(%esp) + movl %edx, 168(%esp) + fxch %st(1) + faddl _TWO_63H@GOTOFF(%ebx) + fstpt 76(%esp) + fld %st(4) + fldt 76(%esp) + movl 76(%esp), %eax + shll $4, %eax + fsubl _TWO_63H@GOTOFF(%ebx) + fmulp %st, %st(2) + fldl _TWO_48H@GOTOFF(%ebx) + fmul %st, %st(7) + cmpl $0, 44(%esp) + fxch %st(1) + fadd %st(7), %st + fstpt 76(%esp) + fldt 76(%esp) + fsubp %st, %st(7) + fxch %st(5) + fsub %st(6), %st + faddp %st, %st(3) + fld %st(4) + fmul %st(4), %st + fld %st(0) + fadd %st(5), %st + fstpt 76(%esp) + fldt 76(%esp) + fsubp %st, %st(1) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fld %st(5) + fmul %st(1), %st + fadd %st(2), %st + fstpt 32(%esp) + fld %st(2) + fmul %st(1), %st + fadd %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(6) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + fldt 32(%esp) + fadd %st(2), %st + fldt 32(%esp) + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + fdivp %st, %st(2) + fxch %st(1) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fstpt 76(%esp) + fxch %st(4) + fstpt 88(%esp) + fldt 88(%esp) + fxch %st(3) + fmul %st(4), %st + fldt 76(%esp) + fsubp %st, %st(4) + fld %st(3) + fsubr %st(5), %st + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 32(%esp) + fmul %st(4), %st + fldt .L_2il0floatpacket.15@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fsubp %st, %st(3) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fadd %st(4), %st + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fld %st(2) + fxch %st(4) + fmulp %st, %st(2) + fmul %st(1), %st + fld %st(2) + fadd %st(2), %st + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ebx) + fmulp %st, %st(2) + fldt _P@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 104(%esp) + je ..B1.86 +..B1.85: + fldl 4096+__libm_atanl_table_128@GOTOFF(%ebx,%eax) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + fstpt 88(%esp) + fldt 88(%esp) + fldl 4104+__libm_atanl_table_128@GOTOFF(%ebx,%eax) + faddp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.87 +..B1.86: + negl %eax + fld %st(2) + fldl 4096+__libm_atanl_table_128@GOTOFF(%ebx,%eax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fxch %st(3) + fstpt 88(%esp) + fldt 88(%esp) + fldl 4104+__libm_atanl_table_128@GOTOFF(%ebx,%eax) + fsubp %st, %st(3) + faddp %st, %st(2) +..B1.87: + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + movl 8(%ebp), %eax + fadd %st, %st(1) + movl $0, 24(%eax) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fstpt 12(%eax) + fstpt (%eax) + movl 172(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.89 +..B1.88: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.89: + call __stack_chk_fail@PLT +..B1.97: + cmpl $-2147483648, 4(%edx) + jne ..B1.99 +..B1.98: + cmpl $0, (%edx) + je ..B1.100 +..B1.99: + fldt (%edx) + fldt (%ecx) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + movl 8(%ebp), %eax + movl $0, 24(%eax) + fstpt 12(%eax) + fstpt (%eax) + jmp ..B1.104 +..B1.100: + movl 8(%ebp), %edx + cmpl $32767, %eax + movl $0, 24(%edx) + je ..B1.107 +..B1.101: + cmpl $0, 44(%esp) + je ..B1.103 +..B1.102: + movl 8(%ebp), %ecx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %edx + fldt _pi_00l@GOTOFF(%edx,%ebx) + fstpt (%ecx) + fldt _pilo_00l@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%edx,%ebx) + fsubrp %st, %st(1) + fstpt 12(%ecx) + jmp ..B1.104 +..B1.103: + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fldz + fmull ones@GOTOFF(%ebx,%esi,8) + movl 8(%ebp), %eax + fstpt (%eax) + fstpt 12(%eax) +..B1.104: + movl 172(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.89 + jmp ..B1.19 +..B1.107: + cmpl $0, 44(%esp) + lea (,%esi,8), %eax + lea (%eax,%esi,4), %edx + je ..B1.109 +..B1.108: + fldt _pi_34l@GOTOFF(%edx,%ebx) + fldt _pilo_34l@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%edx,%ebx) + movl 8(%ebp), %eax + fsubrp %st, %st(1) + fstpt 12(%eax) + fstpt (%eax) + jmp ..B1.104 +..B1.109: + fldt _pi_04l@GOTOFF(%edx,%ebx) + fldt _pilo_04l@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%edx,%ebx) + movl 8(%ebp), %eax + fsubrp %st, %st(1) + fstpt 12(%eax) + fstpt (%eax) + jmp ..B1.104 +..B1.110: + cmpl $-2147483648, 4(%ecx) + jne ..B1.99 +..B1.111: + cmpl $0, (%ecx) + jne ..B1.99 +..B1.112: + cmpl $32767, %edi + je ..B1.97 +..B1.113: + movl 8(%ebp), %edx + lea (,%esi,8), %eax + lea (%eax,%esi,4), %esi + fldt _pi_02l@GOTOFF(%esi,%ebx) + movl $0, 24(%edx) + fstpt (%edx) + fldt _pilo_02l@GOTOFF(%esi,%ebx) + fldt _small_value_80@GOTOFF(%esi,%ebx) + fsubrp %st, %st(1) + fstpt 12(%edx) + jmp ..B1.104 + .align 16,0x90 + .type __libm_atan2l_k80,@function + .size __libm_atan2l_k80,.-__libm_atan2l_k80 + .data +# -- End __libm_atan2l_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.12: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.15: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.16: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 2 +_pi_00l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49152 + .word 0 + .type _pi_00l,@object + .size _pi_00l,24 + .align 2 +_pilo_00l: + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49086 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 16318 + .word 0 + .type _pilo_00l,@object + .size _pilo_00l,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_pi_02l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .type _pi_02l,@object + .size _pi_02l,24 + .align 2 +_pilo_02l: + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49085 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 16317 + .word 0 + .type _pilo_02l,@object + .size _pilo_02l,24 + .align 2 +_P: + .word 43664 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 43235 + .word 52379 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 59507 + .word 38278 + .word 9340 + .word 37449 + .word 49148 + .word 0 + .word 9132 + .word 55602 + .word 8665 + .word 58245 + .word 16379 + .word 0 + .type _P,@object + .size _P,48 + .align 2 +_pi_34l: + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 16384 + .word 0 + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 49152 + .word 0 + .type _pi_34l,@object + .size _pi_34l,24 + .align 2 +_pilo_34l: + .word 54470 + .word 48821 + .word 27694 + .word 55510 + .word 49087 + .word 0 + .word 54470 + .word 48821 + .word 27694 + .word 55510 + .word 16319 + .word 0 + .type _pilo_34l,@object + .size _pilo_34l,24 + .align 2 +_pi_04l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16382 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49150 + .word 0 + .type _pi_04l,@object + .size _pi_04l,24 + .align 2 +_pilo_04l: + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49084 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 16316 + .word 0 + .type _pilo_04l,@object + .size _pilo_04l,24 + .data + .hidden __libm_atanl_table_128 + .hidden __libm_normalizel_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_coshl_k80.S b/external/sgx_libm/ia32/libm_coshl_k80.S new file mode 100644 index 0000000000..88642ecaeb --- /dev/null +++ b/external/sgx_libm/ia32/libm_coshl_k80.S @@ -0,0 +1,724 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_coshl_k80.c" + .text +..TXTST0: +# -- Begin __libm_coshl_k80 + .text + .align 16,0x90 + .hidden __libm_coshl_k80 + .globl __libm_coshl_k80 +__libm_coshl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp + movzwl 16(%ebp), %eax + andl $32767, %eax + movl 20(%ebp), %ebx + cmpl $16405, %eax + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + jge ..B1.17 +..B1.2: + cmpl $16382, %eax + jge ..B1.13 +..B1.3: + cmpl $16378, %eax + jge ..B1.11 +..B1.4: + fldt .L_2il0floatpacket.1@GOTOFF(%esi) + cmpl $16372, %eax + jge ..B1.10 +..B1.5: + cmpl $16365, %eax + jge ..B1.9 +..B1.6: + fstpt (%ebx) + cmpl $16308, %eax + jge ..B1.8 +..B1.7: + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + fstpt 12(%ebx) + fldt 12(%ebx) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.8: + fldt 8(%ebp) + fldt _Q3@GOTOFF(%esi) + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fldt 8(%ebp) + fmul %st(0), %st + fxch %st(1) + fstpt (%ebx) + fldt 12+_Q2@GOTOFF(%esi) + fmul %st(1), %st + fldt _Q2@GOTOFF(%esi) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.10: + fldt 8(%ebp) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt (%ebx) + fldt 36+_Q1@GOTOFF(%esi) + fmul %st(2), %st + fldt 12+_Q1@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_Q1@GOTOFF(%esi) + fmulp %st, %st(3) + fldt _Q1@GOTOFF(%esi) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + fldt 8(%ebp) + fld %st(0) + fld %st(1) + fld %st(2) + fmul %st(3), %st + fld %st(0) + fmul %st(1), %st + fldl _TWO_48H@GOTOFF(%esi) + fadd %st, %st(4) + fxch %st(4) + fstpt 56(%esp) + fldt 56(%esp) + fsub %st(4), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(1) + fmul %st(4), %st + fxch %st(6) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(5) + fxch %st(2) + fmul %st(0), %st + fldt 72+_Q@GOTOFF(%esi) + fmul %st(3), %st + fldt 48+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_Q@GOTOFF(%esi) + fmul %st(4), %st + fldt 60+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(4), %st + fldt 36+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmulp %st, %st(4) + fld %st(5) + fldt 12+_Q@GOTOFF(%esi) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldt 108+_Q@GOTOFF(%esi) + fld %st(0) + fmul %st(7), %st + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(2) + fldt 96+_Q@GOTOFF(%esi) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fmulp %st, %st(4) + fld %st(1) + fadd %st(4), %st + fadd %st(3), %st + fstpt 56(%esp) + fldt 56(%esp) + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.1@GOTOFF(%esi) + faddp %st, %st(1) + fstpt (%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) +..B1.12: + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%esi) + fldt _KLN2@GOTOFF(%esi) + fldt _LN2K@GOTOFF(%esi) + fldt 12+_LN2K@GOTOFF(%esi) + fldl _TWO_32@GOTOFF(%esi) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fxch %st(5) + fmull ones@GOTOFF(%esi,%eax,8) + fmul %st, %st(3) + fxch %st(3) + fadd %st(4), %st + fstpt 56(%esp) + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 56(%esp) + movl 56(%esp), %eax + fsubp %st, %st(4) + fxch %st(1) + fmul %st(3), %st + movsbl %al, %ecx + fsubrp %st, %st(1) + fld %st(0) + subl %ecx, %eax + fxch %st(2) + fmulp %st, %st(3) + movzwl 16(%ebp), %edx + fxch %st(1) + fsub %st(2), %st + fldl _TWO_32P@GOTOFF(%esi) + andl $32767, %edx + fmul %st(1), %st + fxch %st(4) + fmulp %st, %st(1) + sarl $8, %eax + fsubrp %st, %st(3) + fld %st(2) + cmpl $16387, %edx + fxch %st(1) + fsub %st(3), %st + fsubp %st, %st(2) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%esi) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(1), %st + fldt _P@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%esi) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%esi) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + jle ..B1.15 +..B1.14: + shll $4, %ecx + decl %eax + movl %eax, 48(%esp) + faddp %st, %st(1) + fildl 48(%esp) + fldl 2056+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fldl 2048+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + movzbl 17(%ebp), %eax + faddp %st, %st(4) + fmul %st, %st(4) + fld %st(0) + andl $128, %eax + shrl $7, %eax + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fldl ones@GOTOFF(%esi,%eax,8) + fmul %st, %st(3) + fxch %st(3) + fstpt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + je ..B1.20 +..B1.16: + fldt .L_2il0floatpacket.1@GOTOFF(%esi) + lea -1(%eax), %edi + shll $4, %ecx + fstpt (%esp) + fld %st(0) + movl %edi, 48(%esp) + movl %eax, %edi + negl %edi + fadd %st(2), %st + fxch %st(2) + fsubrp %st, %st(1) + fld %st(2) + addl $16383, %edi + fldl 2056+__libm_expl_table_256@GOTOFF(%esi,%ecx) + subl %eax, %edi + fldl 2048+__libm_expl_table_256@GOTOFF(%esi,%ecx) + negl %ecx + fstpt 16(%esp) + fldt 16(%esp) + andl $32767, %edi + movzwl 8+.L_2il0floatpacket.1@GOTOFF(%esi), %edx + fadd %st(1), %st + fmulp %st, %st(4) + fld %st(4) + fmul %st(1), %st + andl $-32768, %edx + faddp %st, %st(4) + fldl 2056+__libm_expl_table_256@GOTOFF(%esi,%ecx) + orl %edi, %edx + fmul %st, %st(2) + fldl 2048+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fld %st(0) + movw %dx, 8(%esp) + fadd %st(2), %st + fmulp %st, %st(5) + movzbl 17(%ebp), %eax + fxch %st(3) + fsubrp %st, %st(4) + fxch %st(3) + fstpt 32(%esp) + fld %st(4) + fxch %st(2) + fmul %st, %st(5) + andl $128, %eax + fldt 16(%esp) + fmul %st, %st(3) + fld %st(0) + shrl $7, %eax + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fsub %st(5), %st + fsubr %st, %st(4) + fxch %st(5) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fld %st(0) + fldt 32(%esp) + faddp %st, %st(3) + fldt (%esp) + fmul %st, %st(5) + fxch %st(1) + fadd %st(5), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fmulp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldl ones@GOTOFF(%esi,%eax,8) + fmul %st, %st(1) + fxch %st(1) + fstpt (%ebx) + fmulp %st, %st(1) + fstpt 12(%ebx) + fildl 48(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + cmpl $32767, %eax + je ..B1.23 +..B1.18: + fldt _infs@GOTOFF(%esi) + fstpt (%ebx) + fldt (%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + fstpt 12(%ebx) +..B1.19: + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.20: + movl 12(%ebp), %edx + cmpl $-782985146, %edx + ja ..B1.14 +..B1.21: + jne ..B1.16 +..B1.22: + cmpl $1501741449, 8(%ebp) + ja ..B1.14 + jmp ..B1.16 +..B1.23: + fldt 8(%ebp) + fmul %st(0), %st + fstpt (%ebx) + fldt (%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + fstpt 12(%ebx) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_coshl_k80,@function + .size __libm_coshl_k80,.-__libm_coshl_k80 + .data +# -- End __libm_coshl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 2 +_Q3: + .word 21845 + .word 213 + .word 0 + .word 32768 + .word 16382 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 62430 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 22894 + .word 21845 + .word 43733 + .word 43690 + .word 16378 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 65531 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 7054 + .word 43693 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 25016 + .word 58228 + .word 24755 + .word 46603 + .word 16373 + .word 0 + .word 57397 + .word 35800 + .word 53031 + .word 53262 + .word 16367 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 18360 + .word 43637 + .word 28980 + .word 40373 + .word 49076 + .word 0 + .word 16302 + .word 43691 + .word 43690 + .word 43690 + .word 16362 + .word 0 + .word 46125 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 29965 + .word 3335 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 54950 + .word 46751 + .word 32187 + .word 37874 + .word 16361 + .word 0 + .word 30733 + .word 25775 + .word 51110 + .word 36726 + .word 16354 + .word 0 + .word 49850 + .word 450 + .word 9929 + .word 51659 + .word 16346 + .word 0 + .word 2776 + .word 45191 + .word 37201 + .word 55334 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16378 + .word 0 + .type _Q,@object + .size _Q,120 + .align 2 +_KLN2: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16391 + .word 0 + .type _KLN2,@object + .size _KLN2,12 + .align 2 +_LN2K: + .word 0 + .word 0 + .word 6134 + .word 45426 + .word 16374 + .word 0 + .word 55756 + .word 58609 + .word 48341 + .word 59623 + .word 16343 + .word 0 + .type _LN2K,@object + .size _LN2K,24 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_infs: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .type _infs,@object + .size _infs,12 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_cosl_k80.S b/external/sgx_libm/ia32/libm_cosl_k80.S new file mode 100644 index 0000000000..f711b5787d --- /dev/null +++ b/external/sgx_libm/ia32/libm_cosl_k80.S @@ -0,0 +1,703 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_cosl_k80.c" + .text +..TXTST0: +# -- Begin __libm_cosl_k80 + .text + .align 16,0x90 + .hidden __libm_cosl_k80 + .globl __libm_cosl_k80 +__libm_cosl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %ebx + subl $184, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 144(%esp) + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $16378, %eax + movl 20(%ebp), %esi + jge ..B1.18 +..B1.2: + cmpl $16372, %eax + jge ..B1.16 +..B1.3: + cmpl $16364, %eax + jge ..B1.14 +..B1.4: + cmpl $16308, %eax + jge ..B1.12 +..B1.5: + testl %eax, %eax + jne ..B1.8 +..B1.6: + cmpl $0, 12(%ebp) + jne ..B1.8 +..B1.7: + cmpl $0, 8(%ebp) + je ..B1.9 +..B1.8: + fldl _ones@GOTOFF(%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fsubr %st(1), %st + fstpt (%esi) + fldl _zeros@GOTOFF(%ebx) + fstpt 12(%esi) + jmp ..B1.10 +..B1.9: + fldl _ones@GOTOFF(%ebx) + fstpt (%esi) + fldt (%esi) + fldl _zeros@GOTOFF(%ebx) + fstpt 12(%esi) +..B1.10: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.28 +..B1.11: + addl $184, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.12: + fldl _ones@GOTOFF(%ebx) + fstpt (%esi) + fldt (%esi) + fldt 8(%ebp) + fldt _CP3@GOTOFF(%ebx) + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 12(%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.28 +..B1.13: + addl $184, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + fldt 8(%ebp) + fmul %st(0), %st + fldl _ones@GOTOFF(%ebx) + fstpt (%esi) + fldt (%esi) + fldt 12+_CP2@GOTOFF(%ebx) + fmul %st(2), %st + fldt _CP2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.28 +..B1.15: + addl $184, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + fldt 8(%ebp) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fldl _ones@GOTOFF(%ebx) + fstpt (%esi) + fldt (%esi) + fldt 36+_CP1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_CP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_CP1@GOTOFF(%ebx) + fmulp %st, %st(3) + fldt _CP1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.28 +..B1.17: + addl $184, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + cmpl $16382, %eax + jge ..B1.20 +..B1.19: + fldt 8(%ebp) + fldl _TWO_52H@GOTOFF(%ebx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fxch %st(1) + fmull _ones@GOTOFF(%ebx,%eax,8) + xorl %eax, %eax + fmul %st, %st(1) + xorl %edx, %edx + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fxch %st(1) + fstpt 112(%esp) + fldt 112(%esp) + fstpt 8(%ebp) + jmp ..B1.23 +..B1.20: + je ..B1.33 +..B1.21: + fldt 8(%ebp) + lea 128(%esp), %edx + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmull _ones@GOTOFF(%ebx,%eax,8) + fstpt (%esp) + fldt (%esp) + movl $0, 12(%esp) + fstpt 8(%ebp) + movl %edx, 16(%esp) + call __libm_reduce_pi04l +..B1.38: + movl %eax, %edx +..B1.22: + fldl 128(%esp) + lea 3(%edx), %eax + fldl _TWO_52H@GOTOFF(%ebx) + fmul %st(1), %st + fld %st(0) + shrl $2, %eax + fadd %st(2), %st + andl $1, %eax + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddl 136(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpt 112(%esp) +..B1.23: + fldt 112(%esp) + fld %st(2) + fmul %st(2), %st + fld %st(2) + fmulp %st, %st(2) + incl %edx + faddp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fld %st(2) + fmul %st(3), %st + testb $2, %dl + fld %st(0) + fadd %st(2), %st + fstpt 48(%esp) + fldt 48(%esp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 80(%esp) + fldt 80(%esp) + fld %st(1) + fmul %st(2), %st + fld %st(0) + faddp %st, %st(2) + fldl _TWO_53H@GOTOFF(%ebx) + fstpt 64(%esp) + fldl _ones@GOTOFF(%ebx,%eax,8) + je ..B1.25 +..B1.24: + fldt 84+_SP@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + fstpt 32(%esp) + fldt 60+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_SP@GOTOFF(%ebx) + fldt 96+_SP@GOTOFF(%ebx) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(3) + fldt 48(%esp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 80(%esp) + fldt 96(%esp) + fldt 120+_SP@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldt 108+_SP@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fld %st(3) + fldt 64(%esp) + fmul %st(4), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fmul %st(3), %st + fxch %st(2) + fsub %st(3), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st(4), %st + fldt 112(%esp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt (%esi) + fmulp %st, %st(1) + fstpt 12(%esi) + fldl _ones@GOTOFF(%ebx) + jmp ..B1.26 +..B1.25: + fstp %st(4) + fstp %st(4) + fldt 84+_CP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_CP@GOTOFF(%ebx) + fldt 96+_CP@GOTOFF(%ebx) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 48(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 80(%esp) + fldt 96(%esp) + fldt 120+_CP@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(5) + fldt 108+_CP@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fld %st(4) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fadd %st, %st(1) + fldt 64(%esp) + fmul %st(2), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldl _ones@GOTOFF(%ebx) + fadd %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + fstpt (%esi) + fmulp %st, %st(1) + fstpt 12(%esi) +..B1.26: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.28 +..B1.27: + addl $184, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.28: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.33: + movl 12(%ebp), %eax + cmpl $-921707870, %eax + jb ..B1.19 +..B1.34: + jne ..B1.21 +..B1.35: + cmpl $560513589, 8(%ebp) + jbe ..B1.19 + jmp ..B1.21 + .align 16,0x90 + .type __libm_cosl_k80,@function + .size __libm_cosl_k80,.-__libm_cosl_k80 + .data +# -- End __libm_cosl_k80 + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_CP3: + .word 0 + .word 65450 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .type _CP3,@object + .size _CP3,12 + .align 2 +_CP2: + .word 63855 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 18238 + .word 17476 + .word 43656 + .word 43690 + .word 16378 + .word 0 + .type _CP2,@object + .size _CP2,24 + .align 2 +_CP1: + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 47533 + .word 43689 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 14131 + .word 49466 + .word 24756 + .word 46603 + .word 49141 + .word 0 + .word 37142 + .word 18013 + .word 35855 + .word 53259 + .word 16367 + .word 0 + .type _CP1,@object + .size _CP1,48 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .type _SP,@object + .size _SP,132 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .type _CP,@object + .size _CP,132 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_exp_k32.S b/external/sgx_libm/ia32/libm_exp_k32.S new file mode 100644 index 0000000000..e659995caa --- /dev/null +++ b/external/sgx_libm/ia32/libm_exp_k32.S @@ -0,0 +1,237 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_exp_k32.c" + .text +..TXTST0: +# -- Begin __libm_exp_k32 + .text + .align 16,0x90 + .hidden __libm_exp_k32 + .globl __libm_exp_k32 +__libm_exp_k32: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $24, %esp + movl 12(%ebp), %eax + movl %eax, %edx + andl $2147483647, %edx + shrl $31, %eax + cmpl $1012924416, %edx + jb ..B1.3 +..B1.2: + fldl 8(%ebp) + xorl %edx, %edx + call ..L2 +..L2: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi + fld1 + fldl _TWO_52H@GOTOFF(%edi) + fldl .L_2il0floatpacket.0@GOTOFF(%edi) + fmul %st(3), %st + movl %edx, 16(%esp) + fadd %st(1), %st + fstpl (%esp) + fldl (%esp) + movl (%esp), %ecx + movl %ecx, %ebx + shll $25, %ebx + fsubp %st, %st(1) + fldl .L_2il0floatpacket.1@GOTOFF(%edi) + fmul %st(1), %st + sarl $25, %ebx + fsubrp %st, %st(3) + fld %st(2) + subl %ebx, %ecx + fxch %st(3) + fstl 8(%ebp) + fldl .L_2il0floatpacket.2@GOTOFF(%edi) + fmulp %st, %st(2) + shll $4, %ebx + fxch %st(1) + fsubr %st, %st(3) + fld %st(3) + fxch %st(2) + fsub %st(4), %st + shrl $7, %ecx + fsubp %st, %st(1) + addl SC2_BIAS@GOTOFF(%edi,%eax,4), %ecx + fadd %st, %st(1) + fld %st(1) + fmul %st(2), %st + fxch %st(3) + fadd %st(4), %st + fstpl 8(%esp) + fldl .L_2il0floatpacket.3@GOTOFF(%edi) + fldl .L_2il0floatpacket.6@GOTOFF(%edi) + movl %edx, 8(%esp) + fmul %st(4), %st + fldl 8(%esp) + shll $20, %ecx + fadd %st, %st(2) + movl %ecx, 20(%esp) + fxch %st(2) + fsubrp %st, %st(6) + fxch %st(5) + faddp %st, %st(2) + fldl .L_2il0floatpacket.4@GOTOFF(%edi) + fmul %st(4), %st + fxch %st(5) + faddl .L_2il0floatpacket.7@GOTOFF(%edi) + fmulp %st, %st(3) + fxch %st(4) + faddl .L_2il0floatpacket.5@GOTOFF(%edi) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldl .L_2il0floatpacket.8@GOTOFF(%edi) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldl 1032+__libm_exp_table_128@GOTOFF(%edi,%ebx) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(3) + fmulp %st, %st(1) + fxch %st(2) + fmull 1024+__libm_exp_table_128@GOTOFF(%edi,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fmull 16(%esp) + fmull _SC2@GOTOFF(%edi,%eax,8) + addl $24, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.3: + fld1 + faddl 8(%ebp) +..B1.4: + addl $24, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_exp_k32,@function + .size __libm_exp_k32,.-__libm_exp_k32 + .data +# -- End __libm_exp_k32 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +SC2_BIAS: + .long 511 + .long 1535 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_SC2: + .long 0 + .long 1609564160 + .long 0 + .long 535822336 + .type _SC2,@object + .size _SC2,16 + .data + .hidden __libm_exp_table_128 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_expl_k80.S b/external/sgx_libm/ia32/libm_expl_k80.S new file mode 100644 index 0000000000..c519786475 --- /dev/null +++ b/external/sgx_libm/ia32/libm_expl_k80.S @@ -0,0 +1,386 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_expl_k80.c" + .text +..TXTST0: +# -- Begin __libm_expl_k80 + .text + .align 16,0x90 + .hidden __libm_expl_k80 + .globl __libm_expl_k80 +__libm_expl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $40, %esp + movl 12(%ebp), %ebx + movl 8(%ebp), %ecx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + fldt (%ebx) + movzbl 9(%ebx), %eax + movzwl 8(%ebx), %edi + andl $128, %eax + andl $32767, %edi + shrl $7, %eax + fstpt 24(%esp) + fldt 24(%esp) + cmpl $32767, %edi + fldt 12(%ebx) + je ..B1.11 +..B1.2: + cmpl $16358, %edi + jge ..B1.7 +..B1.3: + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + cmpl $16183, %edi + jge ..B1.5 +..B1.4: + fstp %st(2) + fstp %st(0) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fstpt 12(%ecx) + fldt 12(%ecx) + fxch %st(1) + fstpt (%ecx) + addl $40, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.5: + fldt 12+_P1@GOTOFF(%edx) + fmul %st(3), %st + fldt _P1@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(3), %st + fmul %st(3), %st + faddp %st, %st(3) + fld %st(0) + fadd %st(3), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%ecx) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) +..B1.6: + addl $40, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.7: + cmpl $16405, %edi + jge ..B1.9 +..B1.8: + fldt _KLN2@GOTOFF(%edx) + fmulp %st, %st(2) + fldt _TWO_63H@GOTOFF(%edx) + fadd %st, %st(2) + fxch %st(2) + fstpt (%esp) + fldt (%esp) + movl (%esp), %eax + fsubp %st, %st(2) + fldt 24(%esp) + fldt _LN2K@GOTOFF(%edx) + fmul %st(3), %st + fstpt (%esp) + fxch %st(2) + fchs + fldt (%esp) + movsbl %al, %ebx + fsubrp %st, %st(3) + fldt 12+_LN2K@GOTOFF(%edx) + subl %ebx, %eax + fmulp %st, %st(1) + fstpt (%esp) + fldt (%esp) + shll $4, %ebx + fadd %st(2), %st + fld %st(0) + sarl $8, %eax + fsub %st(3), %st + fld %st(1) + movl %eax, 16(%esp) + fsub %st(1), %st + fsubrp %st, %st(4) + fldt (%esp) + fsubp %st, %st(1) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fld %st(2) + fsub %st(2), %st + fchs + fld %st(0) + fsubr %st(3), %st + fsubrp %st, %st(4) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fildl 16(%esp) + fldt 24+_P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt _P@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(3), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%ebx) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%ebx) + fld %st(0) + fmul %st(3), %st + fxch %st(3) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(3) + fmul %st, %st(4) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(2) + fadd %st(1), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%ecx) + addl $40, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fstp %st(1) + fstp %st(0) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + lea (,%eax,8), %ebx + fstpt 12(%ecx) + lea (%ebx,%eax,4), %eax + fldt _inf_zeros@GOTOFF(%edx,%eax) + fstpt (%ecx) + fldt (%ecx) +..B1.10: + addl $40, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + fstp %st(0) + cmpl $-2147483648, 28(%esp) + jne ..B1.15 +..B1.12: + cmpl $0, 24(%esp) + jne ..B1.15 +..B1.13: + fstp %st(0) + lea (,%eax,8), %ebx + lea (%ebx,%eax,4), %eax + fldt _inf_zeros@GOTOFF(%edx,%eax) +..B1.15: + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fstpt 12(%ecx) + fstpt (%ecx) + fldt (%ecx) + addl $40, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_expl_k80,@function + .size __libm_expl_k80,.-__libm_expl_k80 + .data +# -- End __libm_expl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 2 +_P1: + .word 43691 + .word 10 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 30584 + .word 43703 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _P1,@object + .size _P1,24 + .align 2 +_KLN2: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16391 + .word 0 + .type _KLN2,@object + .size _KLN2,12 + .align 2 +_TWO_63H: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .type _TWO_63H,@object + .size _TWO_63H,12 + .align 2 +_LN2K: + .word 0 + .word 0 + .word 6134 + .word 45426 + .word 16374 + .word 0 + .word 55756 + .word 58609 + .word 48341 + .word 59623 + .word 16343 + .word 0 + .type _LN2K,@object + .size _LN2K,24 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_inf_zeros: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _inf_zeros,@object + .size _inf_zeros,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_hypot2l_k80.S b/external/sgx_libm/ia32/libm_hypot2l_k80.S new file mode 100644 index 0000000000..7238ad258a --- /dev/null +++ b/external/sgx_libm/ia32/libm_hypot2l_k80.S @@ -0,0 +1,497 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_hypot2l_k80.c" + .text +..TXTST0: +# -- Begin __libm_hypot2l_k80 + .text + .align 16,0x90 + .hidden __libm_hypot2l_k80 + .globl __libm_hypot2l_k80 +__libm_hypot2l_k80: +# parameter 1: 64 + %esp +# parameter 2: 68 + %esp +# parameter 3: 80 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + subl $48, %esp + movzwl 76(%esp), %eax + testl $32767, %eax + movl 64(%esp), %ecx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jne ..B1.8 +..B1.2: + cmpl $0, 72(%esp) + jne ..B1.8 +..B1.3: + cmpl $0, 68(%esp) + jne ..B1.8 +..B1.4: + movzwl 88(%esp), %eax + testl $32767, %eax + jne ..B1.8 +..B1.5: + cmpl $0, 84(%esp) + jne ..B1.8 +..B1.6: + cmpl $0, 80(%esp) + jne ..B1.8 +..B1.7: + fldt 68(%esp) + fstpt (%ecx) + fldt 80(%esp) + fstpt 12(%ecx) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + addl $48, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.8: + fldt 68(%esp) + fabs + fstpt (%esp) + fldt (%esp) + fldt 80(%esp) + fabs + fstpt 12(%esp) + fldt 12(%esp) + movzwl 8(%esp), %edx + movzwl 20(%esp), %eax + andl $32767, %edx + andl $32767, %eax + cmpl %eax, %edx + jg ..B1.13 +..B1.9: + jne ..B1.14 +..B1.10: + movl 4(%esp), %esi + movl 16(%esp), %edi + cmpl %edi, %esi + ja ..B1.65 +..B1.11: + jne ..B1.64 +..B1.12: + movl (%esp), %esi + cmpl 12(%esp), %esi + jbe ..B1.64 +..B1.65: + cmpl %eax, %edx +..B1.13: + fxch %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fld %st(0) + fxch %st(2) + fxch %st(1) + fxch %st(2) + jl ..B1.20 + jmp ..B1.16 +..B1.14: + fstpt 24(%esp) + fldt 24(%esp) + fld %st(0) +..B1.15: + jl ..B1.20 +..B1.16: + jne ..B1.21 +..B1.17: + movl 4(%esp), %eax + movl 16(%esp), %edx + cmpl %edx, %eax + jb ..B1.20 +..B1.18: + jne ..B1.21 +..B1.19: + movl (%esp), %eax + cmpl 12(%esp), %eax + jae ..B1.21 +..B1.20: + fstp %st(1) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + jmp ..B1.22 +..B1.21: + fstp %st(2) + fstpt 12(%esp) + fldt 12(%esp) +..B1.22: + movswl 20(%esp), %eax + testl %eax, %eax + je ..B1.24 +..B1.23: + addl $-16383, %eax + jmp ..B1.29 +..B1.24: + movzwl 20(%esp), %eax + testl $32767, %eax + jne ..B1.28 +..B1.25: + cmpl $0, 16(%esp) + jne ..B1.28 +..B1.26: + cmpl $0, 12(%esp) + jne ..B1.28 +..B1.27: + movl $-16526, %eax + jmp ..B1.29 +..B1.28: + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fmul %st(1), %st + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) + movswl 8(%esp), %eax + addl $-32828, %eax +..B1.29: + movswl 32(%esp), %edx + testl %edx, %edx + je ..B1.31 +..B1.30: + addl $-16383, %edx + jmp ..B1.32 +..B1.31: + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fmul %st(2), %st + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%esp) + movswl 8(%esp), %edx + addl $-32828, %edx +..B1.32: + addl $-67, %edx + cmpl %edx, %eax + jg ..B1.34 +..B1.33: + fstp %st(0) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) +..B1.34: + movzwl 32(%esp), %eax + andl $32767, %eax + cmpl $24709, %eax + jg ..B1.39 +..B1.35: + jne ..B1.40 +..B1.36: + movl 28(%esp), %edx + cmpl 4+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.39 +..B1.37: + jne ..B1.40 +..B1.38: + movl 24(%esp), %edx + cmpl _CONSTANTS@GOTOFF(%ebx), %edx + jb ..B1.40 +..B1.39: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fmul %st, %st(2) + fxch %st(2) + fstpt 24(%esp) + fldt 24(%esp) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + jmp ..B1.61 +..B1.40: + cmpl $24573, %eax + jg ..B1.45 +..B1.41: + jne ..B1.46 +..B1.42: + movl 28(%esp), %edx + cmpl 16+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.45 +..B1.43: + jne ..B1.46 +..B1.44: + movl 24(%esp), %edx + cmpl 12+_CONSTANTS@GOTOFF(%ebx), %edx + jb ..B1.46 +..B1.45: + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + fstpt 24(%esp) + fldt 24(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + jmp ..B1.61 +..B1.46: + cmpl $8127, %eax + jl ..B1.51 +..B1.47: + jne ..B1.52 +..B1.48: + movl 28(%esp), %edx + cmpl 28+_CONSTANTS@GOTOFF(%ebx), %edx + jb ..B1.51 +..B1.49: + jne ..B1.52 +..B1.50: + movl 24(%esp), %edx + cmpl 24+_CONSTANTS@GOTOFF(%ebx), %edx + ja ..B1.52 +..B1.51: + fldt 48+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fmul %st, %st(2) + fxch %st(2) + fstpt 24(%esp) + fldt 24(%esp) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + jmp ..B1.61 +..B1.52: + cmpl $8323, %eax + jl ..B1.57 +..B1.53: + jne ..B1.60 +..B1.54: + movl 28(%esp), %eax + cmpl 40+_CONSTANTS@GOTOFF(%ebx), %eax + jb ..B1.57 +..B1.55: + jne ..B1.60 +..B1.56: + movl 24(%esp), %eax + cmpl 36+_CONSTANTS@GOTOFF(%ebx), %eax + ja ..B1.60 +..B1.57: + fldt 48+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + fstpt 24(%esp) + fldt 24(%esp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + jmp ..B1.61 +..B1.60: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) +..B1.61: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fld %st(3) + fmul %st(1), %st + fld %st(4) + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(4) + fxch %st(2) + fsubr %st, %st(6) + fxch %st(3) + fmul %st(5), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(5) + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + fmul %st(7), %st + fxch %st(4) + fmulp %st, %st(1) + fmul %st(5), %st + fld %st(1) + fadd %st(4), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(6) + fmul %st(0), %st + faddp %st, %st(3) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fadd %st(7), %st + fstpt (%ecx) + fldt (%ecx) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(4) + fmul %st(0), %st + fxch %st(2) + fsubp %st, %st(4) + fxch %st(3) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 12(%ecx) + addl $48, %esp + popl %ebx + popl %edi + popl %esi + ret +..B1.64: + cmpl %eax, %edx + jmp ..B1.14 + .align 16,0x90 + .type __libm_hypot2l_k80,@function + .size __libm_hypot2l_k80,.-__libm_hypot2l_k80 + .data +# -- End __libm_hypot2l_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0e,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0d,0x40,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0e,0xc0,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0d,0xc0,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24709 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 24573 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 8127 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8323 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24576 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8190 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16445 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,96 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_log1pl_k80.S b/external/sgx_libm/ia32/libm_log1pl_k80.S new file mode 100644 index 0000000000..1025023f13 --- /dev/null +++ b/external/sgx_libm/ia32/libm_log1pl_k80.S @@ -0,0 +1,1912 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_log1pl_k80.c" + .text +..TXTST0: +# -- Begin __libm_log1p_k80 + .text + .align 16,0x90 + .globl __libm_log1p_k80 +__libm_log1p_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl 12(%ebp), %esi + movl %gs:20, %eax + xorl %esp, %eax + movzwl 8(%esi), %ecx + andl $32767, %ecx + movl %eax, 116(%esp) + movl 24(%esi), %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl 8(%ebp), %edi + lea (%eax,%ecx), %edx + cmpl $16511, %edx + jge ..B1.9 +..B1.2: + cmpl $16255, %edx + jle ..B1.8 +..B1.3: + addl $-8383, %ecx + cmpl $16000, %ecx + jbe ..B1.6 +..B1.4: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B1.5: + movl 24(%esi), %eax +..B1.6: + fldt (%esi) + addl $16383, %eax + fldt 12(%esi) + andl $32767, %eax + andb $127, 41(%esp) + lea 68(%esp), %edx + movzwl -28(%edx), %ecx + andl $-32768, %ecx + orl %eax, %ecx + lea 92(%esp), %eax + movw %cx, -52(%eax) + movl $-2147483648, -56(%eax) + movl $0, -60(%eax) + fldt -60(%eax) + fmul %st, %st(2) + fxch %st(2) + fstpt (%edx) + fmulp %st, %st(1) + fstpt -12(%eax) + call __libm_log1pl_k80. +..B1.7: + fldt 92(%esp) + fmul %st(1), %st + movl $0, 24(%edi) + fstpt (%edi) + fldt 104(%esp) + fmulp %st, %st(1) + fstpt 12(%edi) + jmp ..B1.19 +..B1.8: + movl (%esi), %eax + movl %eax, (%edi) + movl 4(%esi), %edx + movl %edx, 4(%edi) + movl 8(%esi), %ecx + movl %ecx, 8(%edi) + movl 12(%esi), %eax + movl %eax, 12(%edi) + movl 16(%esi), %edx + movl %edx, 16(%edi) + movl 20(%esi), %ecx + movl %ecx, 20(%edi) + movl 24(%esi), %esi + movl %esi, 24(%edi) + jmp ..B1.19 +..B1.9: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B1.10: + fildl 24(%esi) + fstpt 32(%esp) + lea 92(%esp), %eax + fldt (%esi) + fstpt (%esp) + fldt (%esp) + fstpt -24(%eax) + fldt 12(%esi) + fstpt 12(%esp) + fldt 12(%esp) + fstpt -12(%eax) + movl %eax, 24(%esp) + call __libm_logl_k80 +..B1.11: + fldt 92(%esp) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt 104(%esp) + fmulp %st, %st(2) + movzwl 100(%esp), %edx + andl $32767, %edx + fxch %st(1) + fstpt 104(%esp) + fldt 104(%esp) + fldt 216+_CONSTANTS@GOTOFF(%ebx) + fldt 228+_CONSTANTS@GOTOFF(%ebx) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 44(%esp) + fldt 44(%esp) + fld %st(0) + movzwl 52(%esp), %eax + fadd %st(5), %st + fxch %st(3) + fmulp %st, %st(2) + andl $32767, %eax + fxch %st(1) + fstpt 56(%esp) + fldt 56(%esp) + cmpl %edx, %eax + movl $0, 24(%edi) + jg ..B1.16 +..B1.12: + jne ..B1.17 +..B1.13: + movl 48(%esp), %eax + movl 96(%esp), %edx + cmpl %edx, %eax + ja ..B1.16 +..B1.14: + jne ..B1.17 +..B1.15: + movl 44(%esp), %eax + cmpl 92(%esp), %eax + jbe ..B1.17 +..B1.16: + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.18 +..B1.17: + fxch %st(2) + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) +..B1.18: + fld %st(1) + fadd %st(1), %st + fstpt (%edi) + fldt (%edi) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%edi) +..B1.19: + movl 116(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.21 +..B1.20: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.21: + call __stack_chk_fail@PLT + .align 16,0x90 + .type __libm_log1p_k80,@function + .size __libm_log1p_k80,.-__libm_log1p_k80 + .data +# -- End __libm_log1p_k80 + .text +# -- Begin __libm_log1pl_k80 + .text + .align 16,0x90 + .hidden __libm_log1pl_k80 + .globl __libm_log1pl_k80 +__libm_log1pl_k80: +# parameter 1: %eax +# parameter 2: %edx +..B2.1: +..L3: + + movl 4(%esp), %eax + movl 8(%esp), %edx + .hidden __libm_log1pl_k80. + .globl __libm_log1pl_k80. +__libm_log1pl_k80.: + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $404, %esp + movl %eax, %ecx + fldt (%edx) + fld %st(0) + fldt 12(%edx) + movl %gs:20, %eax + fadd %st, %st(1) + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + fxch %st(1) + fsub %st, %st(2) + xorl %esp, %eax + fxch %st(2) + fsubrp %st, %st(1) + fldt 48+_CONSTANTS@GOTOFF(%ebx) + movl %eax, 388(%esp) + fstpt 12(%ecx) + fldt 12(%ecx) + fxch %st(2) + fstpt (%esp) + fldt (%esp) + movzbl 9(%esp), %eax + andl $128, %eax + shrl $7, %eax + movzwl 8(%esp), %esi + movl %eax, 16(%esp) + andl $32767, %esi + shll $15, %eax + movl 4(%esp), %edi + orl %esi, %eax + movl %edi, 12(%esp) + shll $16, %eax + shrl $16, %edi + orl %edi, %eax + cmpl $32767, %esi + je ..B2.116 +..B2.2: + cmpl $-1073774592, %eax + jae ..B2.101 +..B2.3: + fstp %st(1) + fxch %st(1) + fstpt (%ecx) + fldt (%ecx) +..B2.4: + cmpl $16375, %esi + jge ..B2.52 +..B2.5: + fstp %st(0) + cmpl $16363, %esi + jge ..B2.30 +..B2.6: + fstp %st(0) + cmpl $16298, %esi + jge ..B2.8 +..B2.7: + fldt (%edx) + fstpt (%ecx) + fldt 12(%edx) + fstpt 12(%ecx) + fldt _CONSTANTS@GOTOFF(%ebx) + jmp ..B2.104 +..B2.8: + fldt (%edx) + fld %st(0) + fld %st(1) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(2) + fld %st(1) + fld %st(3) + fsub %st(3), %st + fmul %st, %st(1) + fxch %st(1) + fadd %st(0), %st + fld %st(0) + fld %st(4) + fmul %st(5), %st + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(2) + fld %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(5) + fxch %st(5) + fstpt 16(%esp) + fldt 16(%esp) + fxch %st(3) + fstpt 32(%esp) + fldt 32(%esp) + fldt 12(%edx) + fmulp %st, %st(6) + fxch %st(5) + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 96+_CONSTANTS@GOTOFF(%ebx) + fld %st(0) + fmul %st(2), %st + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(1) + fmul %st(3), %st + fstpt (%esp) + fldt (%esp) + fstpt 304(%esp) + fld %st(1) + fsub %st(5), %st + faddp %st, %st(5) + fld %st(1) + fsub %st(5), %st + fxch %st(1) + fstpt 292(%esp) + fxch %st(6) + fmulp %st, %st(2) + fld %st(2) + fmul %st(4), %st + fxch %st(3) + fmul %st(6), %st + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldt 12(%edx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fld %st(0) + fld %st(1) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fxch %st(1) + fmul %st(6), %st + fsubr %st, %st(4) + faddp %st, %st(4) + fxch %st(3) + fstpt 64(%esp) + fldt 64(%esp) + fld %st(5) + fsub %st(1), %st + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(2) + fmul %st(4), %st + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fmul %st(6), %st + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 316(%esp) + fldt 316(%esp) + fsubr %st, %st(1) + movzwl 324(%esp), %eax + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 80(%esp) + fldt 80(%esp) + andl $32767, %eax + fstpt 328(%esp) + fldt 16(%esp) + fld %st(0) + fxch %st(1) + fmul %st(3), %st + fldt 64(%esp) + fmul %st, %st(2) + fldt 32(%esp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fld %st(1) + fldt (%edx) + fmul %st, %st(5) + fldt 12(%edx) + fmulp %st, %st(7) + fxch %st(6) + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fldt 120+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + fstpt 340(%esp) + fldt 340(%esp) + fadd %st, %st(1) + fxch %st(4) + fmulp %st, %st(3) + movzwl 348(%esp), %esi + andl $32767, %esi + fxch %st(2) + fstpt 352(%esp) + fldt 352(%esp) + cmpl %esi, %eax + fldt 48(%esp) + fldt 80(%esp) + jg ..B2.13 +..B2.9: + jne ..B2.14 +..B2.10: + movl 320(%esp), %eax + movl 344(%esp), %esi + cmpl %esi, %eax + ja ..B2.13 +..B2.11: + jne ..B2.14 +..B2.12: + movl 316(%esp), %eax + cmpl 340(%esp), %eax + jbe ..B2.14 +..B2.13: + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + jmp ..B2.15 +..B2.14: + fxch %st(4) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) +..B2.15: + fld %st(2) + movzwl 300(%esp), %eax + fadd %st(1), %st + fstpt 364(%esp) + fldt 364(%esp) + andl $32767, %eax + movzwl 372(%esp), %esi + fld %st(2) + andl $32767, %esi + fadd %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + cmpl %esi, %eax + fxch %st(2) + faddp %st, %st(4) + fxch %st(3) + fstpt 376(%esp) + fldt 376(%esp) + jg ..B2.20 +..B2.16: + jne ..B2.21 +..B2.17: + movl 296(%esp), %eax + movl 368(%esp), %esi + cmpl %esi, %eax + ja ..B2.20 +..B2.18: + jne ..B2.21 +..B2.19: + movl 292(%esp), %eax + cmpl 364(%esp), %eax + jbe ..B2.21 +..B2.20: + fldt (%esp) + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.22 +..B2.21: + fldt (%esp) + fxch %st(2) + fsub %st(4), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) +..B2.22: + fld %st(0) + movzwl 8(%edx), %eax + fadd %st(2), %st + fstpt 268(%esp) + fldt 268(%esp) + andl $32767, %eax + movzwl 276(%esp), %esi + fsubr %st, %st(2) + andl $32767, %esi + fxch %st(2) + faddp %st, %st(1) + fstpt 280(%esp) + fldt 280(%esp) + cmpl %esi, %eax + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 12(%ecx) + fldt 12(%ecx) + jg ..B2.27 +..B2.23: + jne ..B2.28 +..B2.24: + movl 272(%esp), %eax + cmpl 4(%edx), %eax + jb ..B2.27 +..B2.25: + jne ..B2.28 +..B2.26: + movl (%edx), %eax + cmpl 268(%esp), %eax + jbe ..B2.28 +..B2.27: + fldt (%edx) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%edx) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + jmp ..B2.29 +..B2.28: + fldt (%edx) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 12(%edx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + fldt 16(%esp) +..B2.29: + fld %st(1) + fadd %st(1), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%ecx) + fldt _CONSTANTS@GOTOFF(%ebx) + jmp ..B2.104 +..B2.30: + fldt (%edx) + fld %st(0) + fld %st(1) + fld %st(2) + fxch %st(4) + fstpt 48(%esp) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(2) + fld %st(1) + fld %st(2) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(5) + fxch %st(1) + fmul %st(5), %st + fadd %st(0), %st + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(5) + fmul %st(6), %st + faddp %st, %st(4) + fld %st(4) + fxch %st(2) + fstpt 64(%esp) + fldt 64(%esp) + fldt 12(%edx) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fmul %st, %st(3) + fld %st(0) + fsub %st(4), %st + faddp %st, %st(4) + fld %st(2) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fxch %st(4) + fstpt 16(%esp) + fldt 16(%esp) + fld %st(1) + fsub %st(4), %st + fmul %st, %st(3) + fxch %st(4) + fmul %st(7), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(5), %st + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(4) + fld %st(4) + fmulp %st, %st(3) + fstpt 80(%esp) + fldt 80(%esp) + fldt 12(%edx) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(3) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st, %st(3) + fld %st(1) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fstpt 96(%esp) + fldt 96(%esp) + fld %st(1) + fsub %st(1), %st + fldt 64(%esp) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st(7), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fldt 12(%edx) + fmul %st(3), %st + faddp %st, %st(5) + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fstpt 112(%esp) + fldt 112(%esp) + faddp %st, %st(3) + fldt 48(%esp) + fmulp %st, %st(3) + fxch %st(2) + fstpt (%esp) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(1) + fld %st(0) + fsub %st(2), %st + faddp %st, %st(2) + fld %st(1) + fld %st(1) + fsub %st(3), %st + fxch %st(3) + fmul %st(6), %st + fxch %st(2) + fmulp %st, %st(4) + fxch %st(2) + fmul %st, %st(5) + fldt 96(%esp) + fmul %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fldt 16(%esp) + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fstpt 316(%esp) + fldt 316(%esp) + fsubr %st, %st(3) + movzwl 324(%esp), %eax + fxch %st(3) + faddp %st, %st(1) + andl $32767, %eax + fstpt 328(%esp) + fldt 328(%esp) + fldt 96+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 304(%esp) + fldt 80(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 292(%esp) + fldt 292(%esp) + fldt 120+_CONSTANTS@GOTOFF(%ebx) + fldt 32(%esp) + fmul %st(1), %st + fstpt 340(%esp) + fldt 340(%esp) + movzwl 348(%esp), %esi + andl $32767, %esi + fstpt 32(%esp) + fldt 32(%esp) + cmpl %esi, %eax + fldt 112(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 352(%esp) + fldt 352(%esp) + fldt 204+_CONSTANTS@GOTOFF(%ebx) + fldt 192+_CONSTANTS@GOTOFF(%ebx) + fldt 48(%esp) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 180+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 156+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt 132+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(1) + fld %st(5) + faddp %st, %st(3) + fldt (%esp) + fmulp %st, %st(1) + fstpt (%esp) + fldt (%edx) + jg ..B2.35 +..B2.31: + jne ..B2.36 +..B2.32: + movl 320(%esp), %eax + movl 344(%esp), %esi + cmpl %esi, %eax + ja ..B2.35 +..B2.33: + jne ..B2.36 +..B2.34: + movl 316(%esp), %eax + cmpl 340(%esp), %eax + jbe ..B2.36 +..B2.35: + fldt 32(%esp) + fxch %st(3) + fsubr %st, %st(6) + fxch %st(3) + faddp %st, %st(6) + fxch %st(1) + faddp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + jmp ..B2.37 +..B2.36: + fldt 32(%esp) + fsub %st(3), %st + faddp %st, %st(6) + fxch %st(4) + faddp %st, %st(5) + faddp %st, %st(4) +..B2.37: + fld %st(3) + movzwl 300(%esp), %eax + fadd %st(1), %st + fstpt 364(%esp) + fldt 364(%esp) + andl $32767, %eax + movzwl 372(%esp), %esi + fsubr %st, %st(1) + andl $32767, %esi + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + fstpt 376(%esp) + fldt 376(%esp) + fld %st(1) + cmpl %esi, %eax + fadd %st(4), %st + jg ..B2.42 +..B2.38: + jne ..B2.43 +..B2.39: + movl 296(%esp), %eax + movl 368(%esp), %esi + cmpl %esi, %eax + ja ..B2.42 +..B2.40: + jne ..B2.43 +..B2.41: + movl 292(%esp), %eax + cmpl 364(%esp), %eax + jbe ..B2.43 +..B2.42: + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 16(%esp) + faddp %st, %st(1) + fxch %st(2) + jmp ..B2.44 +..B2.43: + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fldt 16(%esp) + faddp %st, %st(4) + faddp %st, %st(3) +..B2.44: + fld %st(2) + movzwl 8(%edx), %eax + fadd %st(1), %st + fstpt 268(%esp) + fldt 268(%esp) + andl $32767, %eax + movzwl 276(%esp), %esi + fsubr %st, %st(1) + andl $32767, %esi + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 280(%esp) + fldt 280(%esp) + cmpl %esi, %eax + fxch %st(1) + fadd %st(2), %st + fstpt 12(%ecx) + fldt 12(%ecx) + jg ..B2.49 +..B2.45: + jne ..B2.50 +..B2.46: + movl 272(%esp), %eax + cmpl 4(%edx), %eax + jb ..B2.49 +..B2.47: + jne ..B2.50 +..B2.48: + movl (%edx), %eax + cmpl 268(%esp), %eax + jbe ..B2.50 +..B2.49: + fldt (%edx) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%edx) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + jmp ..B2.51 +..B2.50: + fldt (%edx) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 12(%edx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + fldt 16(%esp) +..B2.51: + fld %st(1) + fadd %st(1), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt (%esp) + faddp %st, %st(1) + fstpt 12(%ecx) + fldt _CONSTANTS@GOTOFF(%ebx) + jmp ..B2.104 +..B2.52: + fstp %st(1) + fldt (%edx) + movzwl 8(%edx), %esi + fld %st(0) + fldt _CONSTANTS@GOTOFF(%ebx) + andl $32767, %esi + movzwl 8+_CONSTANTS@GOTOFF(%ebx), %eax + cmpl $16383, %esi + movl %eax, 12(%esp) + fadd %st, %st(1) + jg ..B2.57 +..B2.53: + jne ..B2.58 +..B2.54: + movl 4(%edx), %eax + cmpl 4+_CONSTANTS@GOTOFF(%ebx), %eax + ja ..B2.57 +..B2.55: + jne ..B2.58 +..B2.56: + movl (%edx), %eax + cmpl _CONSTANTS@GOTOFF(%ebx), %eax + jbe ..B2.58 +..B2.57: + fldt 12(%edx) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + fadd %st, %st(3) + fxch %st(3) + fadd %st(4), %st + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.59 +..B2.58: + fldt 12(%edx) + fld %st(1) + fsub %st(3), %st + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fadd %st(3), %st +..B2.59: + fld %st(0) + fadd %st(2), %st + fstpt 128(%esp) + fldt 128(%esp) + fsubr %st, %st(2) + movzwl 136(%esp), %edx + fxch %st(2) + faddp %st, %st(1) + movl 132(%esp), %eax + andl $32767, %edx + shrl $23, %eax + movzbl %al, %eax + movl %edx, 16(%esp) + fstpt 140(%esp) + fldt 140(%esp) + lea -16383(%edx), %edx + cmpl $16383, %edx + flds __libm_rcp_table_256@GOTOFF(%ebx,%eax,4) + jge ..B2.61 +..B2.60: + movl %edx, %esi + negl %esi + addl $16383, %esi + movl 12(%esp), %edi + andl $32767, %esi + andl $-32768, %edi + fxch %st(3) + fstpt (%esp) + fldt (%esp) + orl %esi, %edi + movw %di, 8(%esp) + fldt (%esp) + fxch %st(1) + fxch %st(4) + fxch %st(1) + jmp ..B2.62 +..B2.61: + fldt 240+_CONSTANTS@GOTOFF(%ebx) +..B2.62: + movzwl 148(%esp), %esi + andl $32767, %esi + addl $128, %esi + fmul %st, %st(3) + cmpl 16(%esp), %esi + jle ..B2.64 +..B2.63: + fmulp %st, %st(2) + fxch %st(1) + jmp ..B2.65 +..B2.64: + fstp %st(0) + fstp %st(1) + fld %st(3) +..B2.65: + fldt 36+_CONSTANTS@GOTOFF(%ebx) + movl %edx, 112(%esp) + fxch %st(4) + fstpt 96(%esp) + shll $4, %eax + fstpt 16(%esp) + fld %st(1) + fildl 112(%esp) + fldt 24+_CONSTANTS@GOTOFF(%ebx) + fmul %st(1), %st + fxch %st(5) + fmulp %st, %st(1) + fld %st(3) + fxch %st(5) + faddl __libm_logl_table_256@GOTOFF(%eax,%ebx) + fstpt 48(%esp) + fldt 48(%esp) + fstpt (%esp) + fld %st(3) + fxch %st(4) + fmul %st(6), %st + fxch %st(1) + faddl 8+__libm_logl_table_256@GOTOFF(%ebx,%eax) + fstpt 32(%esp) + fld %st(2) + fldt 60+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + fsubr %st, %st(5) + faddp %st, %st(5) + fxch %st(4) + fsubr %st, %st(5) + fxch %st(2) + fmul %st, %st(4) + fstpt 64(%esp) + fld %st(2) + fsub %st(4), %st + faddp %st, %st(4) + fld %st(2) + fsub %st(4), %st + fld %st(2) + fmul %st(5), %st + fxch %st(5) + fmul %st(6), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(5), %st + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fldt 16(%esp) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 128(%esp) + fldt 128(%esp) + fsubr %st, %st(1) + movzwl 136(%esp), %eax + fxch %st(1) + faddp %st, %st(2) + andl $32767, %eax + fxch %st(1) + fstpt 140(%esp) + fldt 140(%esp) + cmpl $16383, %eax + fldt 96(%esp) + fld %st(0) + fsubr %st(3), %st + fstpt 80(%esp) + jg ..B2.70 +..B2.66: + jne ..B2.71 +..B2.67: + movl 132(%esp), %eax + cmpl 4+_CONSTANTS@GOTOFF(%ebx), %eax + ja ..B2.70 +..B2.68: + jne ..B2.71 +..B2.69: + movl 128(%esp), %eax + cmpl _CONSTANTS@GOTOFF(%ebx), %eax + jbe ..B2.71 +..B2.70: + fldt 80(%esp) + fsubrp %st, %st(3) + fsubr %st, %st(2) + fxch %st(3) + fsubrp %st, %st(2) + faddp %st, %st(1) + jmp ..B2.72 +..B2.71: + fldt 80(%esp) + fadd %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) +..B2.72: + fldt 80(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 160(%esp) + fldt 160(%esp) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 176(%esp) + fxch %st(2) + fstpt 96(%esp) + fld %st(0) + fxch %st(2) + fstpt 80(%esp) + fldt 80(%esp) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fldt 64(%esp) + fld %st(0) + fmul %st(2), %st + fsubr %st, %st(4) + faddp %st, %st(4) + fld %st(3) + fld %st(2) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(1) + fadd %st(0), %st + fld %st(0) + fld %st(6) + fmul %st(7), %st + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(2) + fld %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(5) + fmul %st(5), %st + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 128(%esp) + fldt 128(%esp) + fld %st(1) + fsub %st(4), %st + faddp %st, %st(4) + fxch %st(1) + fstpt 208(%esp) + fldt 208(%esp) + fld %st(6) + fmul %st(4), %st + fxch %st(1) + fsub %st(4), %st + fxch %st(3) + fmul %st, %st(4) + fxch %st(7) + fstpt 192(%esp) + fldt 192(%esp) + fmul %st(3), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(2) + fld %st(3) + fmulp %st, %st(1) + fld %st(4) + fldt 208(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fstpt 224(%esp) + fldt 224(%esp) + fldt 64(%esp) + fldt 192(%esp) + fxch %st(1) + fmul %st(2), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fstpt 240(%esp) + fldt 240(%esp) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fmul %st(7), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fld %st(2) + fmulp %st, %st(4) + fldt 224(%esp) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fstpt 144(%esp) + fldt 144(%esp) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fstpt 256(%esp) + fldt 256(%esp) + faddp %st, %st(2) + fldt 176(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 112(%esp) + fldt 64(%esp) + fldt 240(%esp) + fldt 72+_CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fld %st(2) + fmul %st(2), %st + fld %st(1) + fsub %st(4), %st + fmul %st, %st(3) + fxch %st(4) + fmul %st(7), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(2) + fldt 84+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 316(%esp) + fldt 316(%esp) + fsubr %st, %st(2) + movzwl 324(%esp), %eax + fxch %st(2) + faddp %st, %st(1) + andl $32767, %eax + fstpt 328(%esp) + fldt 328(%esp) + fldt 96+_CONSTANTS@GOTOFF(%ebx) + fldt 120+_CONSTANTS@GOTOFF(%ebx) + fldt 208(%esp) + fmul %st(2), %st + fstpt 292(%esp) + fldt 292(%esp) + fldt 128(%esp) + fmulp %st, %st(3) + fxch %st(2) + fstpt 128(%esp) + fldt 128(%esp) + fstpt 304(%esp) + fldt 144(%esp) + fmul %st(1), %st + fstpt 340(%esp) + fldt 340(%esp) + movzwl 348(%esp), %edx + andl $32767, %edx + fstpt 144(%esp) + fldt 144(%esp) + cmpl %edx, %eax + fldt 256(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 352(%esp) + fldt 352(%esp) + fldt 204+_CONSTANTS@GOTOFF(%ebx) + fldt 192+_CONSTANTS@GOTOFF(%ebx) + fldt 176(%esp) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 180+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 156+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt 132+_CONSTANTS@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 112(%esp) + fmulp %st, %st(1) + fstpt 112(%esp) + fld %st(4) + faddp %st, %st(2) + fldt 96(%esp) + fldt 160(%esp) + jg ..B2.77 +..B2.73: + jne ..B2.78 +..B2.74: + movl 320(%esp), %eax + movl 344(%esp), %edx + cmpl %edx, %eax + ja ..B2.77 +..B2.75: + jne ..B2.78 +..B2.76: + movl 316(%esp), %eax + cmpl 340(%esp), %eax + jbe ..B2.78 +..B2.77: + fldt 144(%esp) + fxch %st(4) + fsubr %st, %st(7) + fxch %st(4) + faddp %st, %st(7) + fxch %st(2) + faddp %st, %st(6) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fxch %st(4) + jmp ..B2.79 +..B2.78: + fldt 144(%esp) + fsub %st(4), %st + faddp %st, %st(7) + fxch %st(5) + faddp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) +..B2.79: + fld %st(0) + movzwl 300(%esp), %eax + fadd %st(2), %st + fstpt 364(%esp) + fldt 364(%esp) + andl $32767, %eax + movzwl 372(%esp), %edx + fld %st(3) + andl $32767, %edx + fadd %st(1), %st + fxch %st(1) + fsubr %st, %st(3) + cmpl %edx, %eax + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 376(%esp) + fldt 376(%esp) + jg ..B2.84 +..B2.80: + jne ..B2.85 +..B2.81: + movl 296(%esp), %eax + movl 368(%esp), %edx + cmpl %edx, %eax + ja ..B2.84 +..B2.82: + jne ..B2.85 +..B2.83: + movl 292(%esp), %eax + cmpl 364(%esp), %eax + jbe ..B2.85 +..B2.84: + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 128(%esp) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.86 +..B2.85: + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fldt 128(%esp) + faddp %st, %st(2) + faddp %st, %st(1) +..B2.86: + fld %st(0) + movzwl 24(%esp), %eax + fadd %st(2), %st + fstpt 268(%esp) + fldt 268(%esp) + andl $32767, %eax + movzwl 276(%esp), %edx + fld %st(3) + andl $32767, %edx + fadd %st(1), %st + fxch %st(1) + fsubr %st, %st(3) + cmpl %edx, %eax + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 280(%esp) + fldt 280(%esp) + jg ..B2.91 +..B2.87: + jne ..B2.92 +..B2.88: + movl 20(%esp), %eax + movl 272(%esp), %edx + cmpl %edx, %eax + ja ..B2.91 +..B2.89: + jne ..B2.92 +..B2.90: + movl 16(%esp), %eax + cmpl 268(%esp), %eax + jbe ..B2.92 +..B2.91: + fldt 80(%esp) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.93 +..B2.92: + fldt 80(%esp) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) +..B2.93: + fldt 112(%esp) + fld %st(1) + movzwl 8(%esp), %edx + fadd %st(3), %st + fstpt 16(%esp) + fldt 16(%esp) + andl $32767, %edx + movzwl 24(%esp), %eax + fsubr %st, %st(3) + andl $32767, %eax + fxch %st(2) + faddp %st, %st(3) + cmpl %edx, %eax + faddp %st, %st(2) + fldt 48(%esp) + fadd %st(1), %st + jg ..B2.98 +..B2.94: + jne ..B2.99 +..B2.95: + movl 20(%esp), %eax + movl 4(%esp), %edx + cmpl %edx, %eax + ja ..B2.98 +..B2.96: + jne ..B2.99 +..B2.97: + movl 16(%esp), %eax + cmpl (%esp), %eax + jbe ..B2.99 +..B2.98: + fldt 48(%esp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 32(%esp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + jmp ..B2.100 +..B2.99: + fldt 48(%esp) + fsub %st(1), %st + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%esp) + faddp %st, %st(1) +..B2.100: + fld %st(0) + fadd %st(2), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%ecx) + jmp ..B2.104 +..B2.101: + cmpl $1, 16(%esp) + je ..B2.108 +..B2.123: + fstp %st(1) +..B2.102: + fldt 12+_CONSTANTS@GOTOFF(%ebx) + fxch %st(1) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.103 + je ..B2.107 +..B2.103: + fstp %st(0) + fldt 252+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%ecx) + fldt _CONSTANTS@GOTOFF(%ebx) +..B2.104: + movl 388(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.106 +..B2.105: + addl $404, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.106: + fstp %st(0) + call __stack_chk_fail@PLT +..B2.107: + fdivp %st, %st(1) + fstpt (%ecx) + fldt _CONSTANTS@GOTOFF(%ebx) + jmp ..B2.104 +..B2.108: + cmpl $16383, %esi + jne ..B2.123 +..B2.109: + cmpl $-2147483648, 12(%esp) + jne ..B2.123 +..B2.110: + cmpl $0, (%esp) + jne ..B2.123 +..B2.111: + fxch %st(1) + fstpt (%esp) + movzbl 9(%esp), %eax + testl $128, %eax + jne ..B2.102 +..B2.112: + cmpl $0, 4(%esp) + jne ..B2.115 +..B2.114: + cmpl $0, (%esp) + je ..B2.102 +..B2.115: + fxch %st(1) + fstpt (%ecx) + fldt (%ecx) + jmp ..B2.4 +..B2.116: + fstp %st(1) + cmpl $0, 16(%esp) + je ..B2.120 +..B2.117: + cmpl $-2147483648, 12(%esp) + jne ..B2.120 +..B2.118: + cmpl $0, (%esp) + jne ..B2.120 +..B2.119: + fstp %st(0) + fldt 252+_CONSTANTS@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt (%ecx) + fldt _CONSTANTS@GOTOFF(%ebx) + jmp ..B2.104 +..B2.120: + fstp %st(1) + fldt _CONSTANTS@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + fstpt (%ecx) + jmp ..B2.104 + .align 16,0x90 + .type __libm_log1pl_k80,@function + .size __libm_log1pl_k80,.-__libm_log1pl_k80 + .data +# -- End __libm_log1pl_k80 + .section .rodata, "a" + .align 16 + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 2022 + .word 26416 + .word 37831 + .word 62295 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 32768 + .word 16415 + .word 0 + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49149 + .word 0 + .word 52429 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 37449 + .word 18724 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49148 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 16379 + .word 0 + .word 52429 + .word 52428 + .word 52428 + .word 52428 + .word 49147 + .word 0 + .word 11916 + .word 59578 + .word 35746 + .word 47662 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 6136 + .word 45426 + .word 16382 + .word 0 + .word 12704 + .word 55409 + .word 6480 + .word 47298 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16384 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,252 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .hidden __libm_logl_k80 + .hidden __libm_normalizel_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_log_k32.S b/external/sgx_libm/ia32/libm_log_k32.S new file mode 100644 index 0000000000..ed0867162c --- /dev/null +++ b/external/sgx_libm/ia32/libm_log_k32.S @@ -0,0 +1,164 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_log_k32.c" + .text +..TXTST0: +# -- Begin __libm_log_k32 + .text + .align 16,0x90 + .hidden __libm_log_k32 + .globl __libm_log_k32 +__libm_log_k32: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + movl 12(%ebp), %edx + movl %edx, %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + andl $2146435072, %eax + negl %eax + addl $2145386496, %eax + fldl .L_2il0floatpacket.0@GOTOFF(%ecx) + movl %eax, 12(%esp) + lea -1072676864(%edx), %eax + movl $0, 8(%esp) + cmpl $24576, %eax + jae ..B1.3 +..B1.2: + fldl 8(%ebp) + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstl 8(%ebp) + fldl 32+_Q@GOTOFF(%ecx) + fmul %st(2), %st + fldl 24+_Q@GOTOFF(%ecx) + fmul %st(3), %st + fxch %st(1) + faddl 16+_Q@GOTOFF(%ecx) + fmul %st(3), %st + fxch %st(1) + faddl 8+_Q@GOTOFF(%ecx) + fmul %st(2), %st + faddp %st, %st(1) + faddl _Q@GOTOFF(%ecx) + fmulp %st, %st(2) + faddp %st, %st(1) + movl %ebp, %esp + popl %ebp + ret +..B1.3: + fldl 8(%ebp) + movl %edx, %eax + fmull 8(%esp) + shrl $12, %edx + movzbl %dl, %edx + shrl $20, %eax + addl $-1023, %eax + movl %eax, (%esp) + fmuls __libm_rcp_table_256@GOTOFF(%ecx,%edx,4) + faddp %st, %st(1) + fstl 8(%ebp) + fldl 8+_P@GOTOFF(%ecx) + fmul %st(1), %st + fildl (%esp) + fxch %st(1) + faddl _P@GOTOFF(%ecx) + fmul %st(2), %st + fmul %st(2), %st + faddp %st, %st(2) + fmull _LN2@GOTOFF(%ecx) + faddl __libm_logf_table_256@GOTOFF(%ecx,%edx,8) + faddp %st, %st(1) +..B1.4: + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_log_k32,@function + .size __libm_log_k32,.-__libm_log_k32 + .data +# -- End __libm_log_k32 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 4 +_Q: + .long 4294868184 + .long 3219128319 + .long 1443356411 + .long 1070945621 + .long 823147527 + .long 3218079745 + .long 748089218 + .long 1070176642 + .long 1053536005 + .long 3217353219 + .type _Q,@object + .size _Q,40 + .align 4 +_P: + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .type _P,@object + .size _P,16 + .align 4 +_LN2: + .long 4277811695 + .long 1072049730 + .type _LN2,@object + .size _LN2,8 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logf_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_logl.S b/external/sgx_libm/ia32/libm_logl.S new file mode 100644 index 0000000000..32f2852a38 --- /dev/null +++ b/external/sgx_libm/ia32/libm_logl.S @@ -0,0 +1,737 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_logl.c" + .text +..TXTST0: +# -- Begin __libm_logl + .text + .align 16,0x90 + .globl __libm_logl +__libm_logl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %edi + andl $128, %edi + shrl $7, %edi + movzwl 16(%ebp), %edx + movl %edx, %eax + movl %edi, %ebx + andl $32767, %eax + shll $15, %ebx + movl 12(%ebp), %esi + orl %eax, %ebx + movl %esi, %ecx + shll $16, %ebx + shrl $16, %ecx + orl %ecx, %ebx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $2147450880, %ebx + jae ..B1.32 +..B1.4: + lea -1073674240(%ebx), %edi + cmpl $36864, %edi + ja ..B1.21 +..B1.5: + addl $-1073676287, %ebx + cmpl $32769, %ebx + ja ..B1.14 +..B1.6: + cmpl $16383, %eax + je ..B1.42 +..B1.7: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.41 +..B1.8: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movl $1, %eax +..B1.11: + fldt 8(%ebp) + testl %eax, %eax + fldt 36+_Q1@GOTOFF(%ecx) + fldt 12+_Q1@GOTOFF(%ecx) + fldt 24+_Q1@GOTOFF(%ecx) + fldt _Q1@GOTOFF(%ecx) + fxch %st(4) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fadd %st(1), %st + fstpt (%esp) + fstpt 8(%ebp) + je ..B1.13 +..B1.12: + fldcw 14(%esp) +..B1.13: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.15: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.16: + fldcw 12(%esp) +..B1.17: + movl $1, %eax +..B1.18: + fldt 8(%ebp) + testl %eax, %eax + fldl _TWO_52H@GOTOFF(%ecx) + fldt 156+_Q2@GOTOFF(%ecx) + fldt 132+_Q2@GOTOFF(%ecx) + fxch %st(3) + faddl 8+_ones@GOTOFF(%ecx) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fld %st(1) + fsub %st(4), %st + fstpt 16(%esp) + fldt 16(%esp) + fmul %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(0) + fld %st(4) + fmul %st(5), %st + fadd %st, %st(1) + fxch %st(1) + fmul %st, %st(4) + fxch %st(6) + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 108+_Q2@GOTOFF(%ecx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + fldt 84+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 60+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 36+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 12+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 144+_Q2@GOTOFF(%ecx) + fmul %st(6), %st + fldt 120+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(6), %st + fldt 96+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(6), %st + fldt 72+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(6), %st + fldt 48+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(6), %st + fldt 24+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(6) + fldt _Q2@GOTOFF(%ecx) + faddp %st, %st(6) + fxch %st(2) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldt 180+_Q2@GOTOFF(%ecx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(1) + fld %st(1) + fldt 168+_Q2@GOTOFF(%ecx) + fld %st(0) + fmul %st(4), %st + faddp %st, %st(3) + fldt 16(%esp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fxch %st(2) + fadd %st, %st(4) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.20 +..B1.19: + fldcw 14(%esp) +..B1.20: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.21: + movzwl 14(%esp), %esi + movl %esi, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.49 +..B1.22: + orl $-64768, %esi + movw %si, 12(%esp) +..B1.23: + fldcw 12(%esp) +..B1.24: + movzwl 16(%ebp), %edx + movl %edx, %eax + movl $1, %esi + andl $32767, %eax +..B1.25: + testl %eax, %eax + jne ..B1.28 +..B1.26: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%ecx) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _zeros@GOTOFF(%ecx) + fxch %st(1) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.27 + je ..B1.46 +..B1.27: + fstp %st(0) + movzwl 16(%ebp), %edx + movl %edx, %eax + movl $-16458, %ebx + andl $32767, %eax + jmp ..B1.29 +..B1.28: + movl $-16383, %ebx +..B1.29: + fldl _TWO_32H@GOTOFF(%ecx) + andl $-32768, %edx + fldt 60+_P@GOTOFF(%ecx) + orl $-49153, %edx + fldt 36+_P@GOTOFF(%ecx) + addl %eax, %ebx + movw %dx, 16(%ebp) + fldt 8(%ebp) + fld %st(0) + movl 12(%ebp), %eax + fadd %st(4), %st + shrl $23, %eax + fsubp %st, %st(4) + movzbl %al, %eax + fsub %st(3), %st + flds __libm_rcp_table_256@GOTOFF(%ecx,%eax,4) + fmul %st, %st(4) + fmulp %st, %st(1) + fxch %st(3) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + movl %ebx, 16(%esp) + fadd %st(4), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + shll $4, %eax + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + testl %esi, %esi + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fildl 16(%esp) + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(1) + fmulp %st, %st(4) + fldt 48+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl 8+__libm_logl_table_256@GOTOFF(%ecx,%eax) + faddp %st, %st(3) + faddl __libm_logl_table_256@GOTOFF(%eax,%ecx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.31 +..B1.30: + fldcw 14(%esp) +..B1.31: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.58 +..B1.33: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.34: + fldcw 12(%esp) +..B1.35: + movzbl 17(%ebp), %edi + movl $1, %edx + andl $128, %edi + shrl $7, %edi +..B1.36: + testl %edi, %edi + jne ..B1.50 +..B1.37: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ecx) + fstpt (%esp) +..B1.38: + testl %edx, %edx + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + xorl %eax, %eax + jmp ..B1.11 +..B1.42: + cmpl $-2147483648, %esi + jne ..B1.7 +..B1.43: + cmpl $0, 8(%ebp) + jne ..B1.7 +..B1.44: + fldl _zeros@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + xorl %eax, %eax + jmp ..B1.18 +..B1.46: + fldl 8+_ones@GOTOFF(%ecx) + testl %esi, %esi + fdivp %st, %st(1) + fstpl (%esp) + je ..B1.48 +..B1.47: + fldcw 14(%esp) +..B1.48: + fldl (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.49: + xorl %esi, %esi + jmp ..B1.25 +..B1.50: + movzwl 16(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.53 +..B1.51: + cmpl $-2147483648, 12(%ebp) + jne ..B1.37 +..B1.52: + cmpl $0, 8(%ebp) + jne ..B1.37 + jmp ..B1.57 +..B1.53: + testl %eax, %eax + jne ..B1.57 +..B1.54: + cmpl $0, 12(%ebp) + jne ..B1.57 +..B1.55: + cmpl $0, 8(%ebp) + jne ..B1.57 +..B1.56: + fldl 8+_ones@GOTOFF(%ecx) + fdivl _zeros@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.38 +..B1.57: + fldl _infs@GOTOFF(%ecx) + fmull _zeros@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.38 +..B1.58: + xorl %edx, %edx + jmp ..B1.36 + .align 16,0x90 + .type __libm_logl,@function + .size __libm_logl,.-__libm_logl + .data +# -- End __libm_logl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q1: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 5458 + .word 43692 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 44682 + .word 49156 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 63914 + .word 24446 + .word 52434 + .word 52426 + .word 16380 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q2: + .word 58950 + .word 11767 + .word 59949 + .word 40744 + .word 49076 + .word 0 + .word 44486 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 65514 + .word 65535 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 49718 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 36693 + .word 43691 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 41156 + .word 18852 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 14101 + .word 65290 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 21744 + .word 48151 + .word 14557 + .word 58254 + .word 16379 + .word 0 + .word 57454 + .word 983 + .word 52353 + .word 52428 + .word 49147 + .word 0 + .word 54021 + .word 59409 + .word 39452 + .word 47662 + .word 16379 + .word 0 + .word 35608 + .word 4659 + .word 11214 + .word 43692 + .word 49147 + .word 0 + .word 35524 + .word 31332 + .word 8749 + .word 40326 + .word 16379 + .word 0 + .word 54832 + .word 20873 + .word 17674 + .word 36915 + .word 49147 + .word 0 + .word 48567 + .word 9481 + .word 46911 + .word 55870 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .type _Q2,@object + .size _Q2,192 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .type _P,@object + .size _P,72 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_logl_k80.S b/external/sgx_libm/ia32/libm_logl_k80.S new file mode 100644 index 0000000000..f7dd736fcb --- /dev/null +++ b/external/sgx_libm/ia32/libm_logl_k80.S @@ -0,0 +1,1277 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_logl_k80.c" + .text +..TXTST0: +# -- Begin __libm_logl_k80 + .text + .align 16,0x90 + .hidden __libm_logl_k80 + .globl __libm_logl_k80 +__libm_logl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 32 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + fldt 8(%ebp) + movzbl 17(%ebp), %esi + andl $128, %esi + shrl $7, %esi + movzwl 16(%ebp), %ebx + movl %esi, %eax + movl %ebx, 12(%esp) + andl $32767, %ebx + shll $15, %eax + movl 12(%ebp), %edx + orl %ebx, %eax + movl %edx, %edi + shll $16, %eax + shrl $16, %edi + orl %edi, %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $2147450880, %eax + fstpt 24(%esp) + fldt 24(%esp) + fldt 20(%ebp) + jae ..B1.14 +..B1.2: + lea -1073674240(%eax), %esi + cmpl $36864, %esi + ja ..B1.7 +..B1.3: + addl $-1073676287, %eax + cmpl $32769, %eax + ja ..B1.6 +..B1.4: + fldl _ones@GOTOFF(%ecx) + fucom %st(2) + fnstsw %ax + sahf + jp ..B1.5 + je ..B1.23 +..B1.5: + fldt 36+_Q1@GOTOFF(%ecx) + fld %st(3) + movl 32(%ebp), %eax + fsub %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubrp %st, %st(5) + faddp %st, %st(4) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fxch %st(1) + fsub %st, %st(5) + fxch %st(5) + fsubrp %st, %st(4) + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fldt 12+_Q1@GOTOFF(%ecx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 24+_Q1@GOTOFF(%ecx) + fmul %st(1), %st + fldt _Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(3) + fadd %st(1), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 12(%eax) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.6: + fldl 8+_ones@GOTOFF(%ecx) + fld %st(2) + movl 32(%ebp), %eax + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fadd %st, %st(1) + fld %st(1) + fld %st(2) + fxch %st(3) + fstpt 24(%esp) + fldt 24(%esp) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fldl _TWO_52H@GOTOFF(%ecx) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(4) + fxch %st(5) + faddp %st, %st(4) + fxch %st(3) + fstpt (%esp) + fldt (%esp) + fmul %st, %st(3) + fmul %st(2), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fldt 156+_Q2@GOTOFF(%ecx) + fmul %st(1), %st + fldt 132+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 144+_Q2@GOTOFF(%ecx) + fmul %st(2), %st + fldt 120+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _Q2@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 180+_Q2@GOTOFF(%ecx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(2) + fld %st(2) + fldt 168+_Q2@GOTOFF(%ecx) + fld %st(0) + fmul %st(5), %st + faddp %st, %st(4) + fldt (%esp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fmul %st(1), %st + faddp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%eax) + fldl _ones@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.7: + fldl _zeros@GOTOFF(%ecx) + testl %ebx, %ebx + jne ..B1.10 +..B1.8: + fldl _TWO_75@GOTOFF(%ecx) + fmul %st, %st(3) + fxch %st(3) + fucom %st(1) + fnstsw %ax + fxch %st(3) + fmulp %st, %st(2) + sahf + jp ..B1.9 + je ..B1.27 +..B1.9: + fxch %st(2) + fstpt 24(%esp) + movl $-16458, %esi + movzwl 32(%esp), %ebx + movl 28(%esp), %edx + movl %ebx, 12(%esp) + andl $32767, %ebx + jmp ..B1.11 +..B1.10: + fstp %st(2) + movl $-16383, %esi +..B1.11: + addl %ebx, %esi + fucom %st(1) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jp ..B1.12 + je ..B1.13 +..B1.12: + fstpt (%esp) + movzwl 8(%esp), %eax + movl %eax, %edi + subl %ebx, %eax + andl $-32768, %edi + addl $16383, %eax + andl $32767, %eax + orl %eax, %edi + movw %di, 8(%esp) + fldt (%esp) +..B1.13: + fldl _TWO_32H@GOTOFF(%ecx) + fldl 8+_ones@GOTOFF(%ecx) + fldt 60+_P@GOTOFF(%ecx) + movl 12(%esp), %eax + andl $-32768, %eax + orl $-49153, %eax + movw %ax, 32(%esp) + fldt 24(%esp) + fld %st(0) + shrl $23, %edx + fadd %st(4), %st + movzbl %dl, %edx + fsubp %st, %st(4) + movl %esi, 16(%esp) + fsub %st(3), %st + flds __libm_rcp_table_256@GOTOFF(%ecx,%edx,4) + fmul %st, %st(4) + fmul %st, %st(1) + fmulp %st, %st(5) + fxch %st(4) + fstpt (%esp) + fldt (%esp) + fld %st(2) + shll $4, %edx + fadd %st(4), %st + movl 32(%ebp), %ebx + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fld %st(3) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(3) + fld %st(3) + fmul %st(4), %st + fmul %st, %st(2) + fxch %st(4) + fstpt 24(%esp) + fldt 24(%esp) + fildl 16(%esp) + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fmulp %st, %st(1) + fldt 48+_P@GOTOFF(%ecx) + fmul %st(5), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fldt .L_2il0floatpacket.2@GOTOFF(%ecx) + fmul %st(1), %st + fldt .L_2il0floatpacket.3@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl 8+__libm_logl_table_256@GOTOFF(%ecx,%edx) + faddp %st, %st(3) + faddl __libm_logl_table_256@GOTOFF(%edx,%ecx) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt (%ebx) + fldt (%ebx) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 12(%ebx) + fldl _ones@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + fstp %st(0) + testl %esi, %esi + jne ..B1.16 +..B1.15: + fldl _ones@GOTOFF(%ecx) + fmul %st, %st(1) + fldl _zeros@GOTOFF(%ecx) + fxch %st(2) + fxch %st(1) + jmp ..B1.22 +..B1.16: + cmpl $32767, %ebx + je ..B1.25 +..B1.17: + fstp %st(0) + testl %ebx, %ebx + jne ..B1.21 +..B1.18: + testl %edx, %edx + jne ..B1.21 +..B1.19: + cmpl $0, 24(%esp) + jne ..B1.21 +..B1.20: + fldl _zeros@GOTOFF(%ecx) + fldl 8+_ones@GOTOFF(%ecx) + fdiv %st(1), %st + fldl _ones@GOTOFF(%ecx) + jmp ..B1.22 +..B1.21: + fldl _zeros@GOTOFF(%ecx) + fldl _infs@GOTOFF(%ecx) + fmul %st(1), %st + fldl _ones@GOTOFF(%ecx) +..B1.22: + movl 32(%ebp), %eax + fxch %st(1) + fstpt (%eax) + fxch %st(1) + fstpt 12(%eax) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + fldl _zeros@GOTOFF(%ecx) + fucom %st(2) + fnstsw %ax + sahf + jp ..B1.30 + je ..B1.24 +..B1.30: + fstp %st(0) + jmp ..B1.5 +..B1.24: + fstp %st(1) + fstp %st(2) + fstp %st(0) + movl 32(%ebp), %eax + fld %st(0) + fxch %st(1) + fstpt (%eax) + fldt (%eax) + fstpt 12(%eax) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + cmpl $-2147483648, %edx + jne ..B1.15 +..B1.26: + cmpl $0, 24(%esp) + jne ..B1.15 + jmp ..B1.31 +..B1.27: + fstp %st(2) + fstp %st(0) + fldl 8+_ones@GOTOFF(%ecx) + fdiv %st(1), %st + movl 32(%ebp), %eax + fstpt (%eax) + fstpt 12(%eax) + fldl _ones@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + fstp %st(0) + jmp ..B1.21 + .align 16,0x90 + .type __libm_logl_k80,@function + .size __libm_logl_k80,.-__libm_logl_k80 + .data +# -- End __libm_logl_k80 + .text +# -- Begin __libm_log_k80 + .text + .align 16,0x90 + .hidden __libm_log_k80 + .globl __libm_log_k80 +__libm_log_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $100, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 84(%esp) + addl $4, %esp + movl 12(%ebp), %ebx + pushl %ebx + call __libm_normalizel_k80 +..B2.2: + fldt (%ebx) + fldt 12(%ebx) + movl 24(%ebx), %eax + cmpl $-1, %eax + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + je ..B2.41 +..B2.3: + movl %eax, 48(%esp) + fildl 48(%esp) +..B2.4: + fxch %st(2) + fstpt 32(%esp) + fldt 32(%esp) + movzbl 41(%esp), %esi + andl $128, %esi + shrl $7, %esi + movzwl 40(%esp), %edx + movl %esi, %eax + movl %edx, 28(%esp) + andl $32767, %edx + shll $15, %eax + movl 36(%esp), %ecx + orl %edx, %eax + movl %ecx, %edi + shll $16, %eax + shrl $16, %edi + orl %edi, %eax + cmpl $2147450880, %eax + jae ..B2.17 +..B2.5: + lea -1073674240(%eax), %esi + cmpl $36864, %esi + ja ..B2.10 +..B2.6: + fldl _ones@GOTOFF(%ebx) + addl $-1073676287, %eax + cmpl $32769, %eax + ja ..B2.9 +..B2.7: + fucom %st(1) + fnstsw %ax + sahf + jp ..B2.8 + je ..B2.35 +..B2.8: + fldt 12+_Q1@GOTOFF(%ebx) + fld %st(2) + fsub %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + fld %st(3) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(4) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(3) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 24+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + fldt _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(3) + jmp ..B2.26 +..B2.9: + fldl 8+_ones@GOTOFF(%ebx) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(3) + fstpt 32(%esp) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fld %st(1) + fxch %st(5) + fstpt 16(%esp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fldl _TWO_52H@GOTOFF(%ebx) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fxch %st(4) + fstpt 48(%esp) + fldt 48(%esp) + fmul %st, %st(4) + fmul %st(3), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fldt 156+_Q2@GOTOFF(%ebx) + fmul %st(1), %st + fldt 132+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 144+_Q2@GOTOFF(%ebx) + fmul %st(2), %st + fldt 120+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _Q2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 180+_Q2@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmulp %st, %st(3) + fld %st(0) + fldt 168+_Q2@GOTOFF(%ebx) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(5) + fldt 48(%esp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + fmul %st(3), %st + fxch %st(3) + fadd %st(4), %st + fmul %st(1), %st + faddp %st, %st(3) + faddp %st, %st(2) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%esp) + fldt 16(%esp) + fxch %st(3) + fxch %st(1) + jmp ..B2.26 +..B2.10: + fldl _zeros@GOTOFF(%ebx) + testl %edx, %edx + jne ..B2.13 +..B2.11: + fldl _TWO_75@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + fucom %st(1) + fnstsw %ax + fxch %st(2) + fmulp %st, %st(3) + sahf + jp ..B2.12 + je ..B2.37 +..B2.12: + fxch %st(1) + fstpt 32(%esp) + movl $-16458, %esi + movzwl 40(%esp), %edx + movl 36(%esp), %ecx + movl %edx, 28(%esp) + andl $32767, %edx + jmp ..B2.14 +..B2.13: + fstp %st(1) + movl $-16383, %esi +..B2.14: + addl %edx, %esi + fucomp %st(1) + fnstsw %ax + sahf + jp ..B2.15 + je ..B2.16 +..B2.15: + fstpt 16(%esp) + movzwl 24(%esp), %eax + movl %eax, %edi + subl %edx, %eax + andl $-32768, %edi + addl $16383, %eax + andl $32767, %eax + orl %eax, %edi + movw %di, 24(%esp) + fldt 16(%esp) +..B2.16: + fldl _TWO_32H@GOTOFF(%ebx) + fldt 36+_P@GOTOFF(%ebx) + movl 28(%esp), %eax + andl $-32768, %eax + orl $-49153, %eax + movw %ax, 40(%esp) + fldt 32(%esp) + fld %st(0) + shrl $23, %ecx + fadd %st(3), %st + movzbl %cl, %ecx + fsubp %st, %st(3) + movl %esi, 48(%esp) + fsub %st(2), %st + fildl 48(%esp) + flds __libm_rcp_table_256@GOTOFF(%ebx,%ecx,4) + fmul %st, %st(4) + fmul %st, %st(2) + fmulp %st, %st(5) + shll $4, %ecx + fxch %st(1) + faddp %st, %st(4) + fldl 8+_ones@GOTOFF(%ebx) + fld %st(0) + fadd %st(4), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fxch %st(5) + faddp %st, %st(1) + fadd %st, %st(4) + fld %st(4) + fmul %st(5), %st + fldt 60+_P@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(4) + fmul %st, %st(3) + fldt 12+_P@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fxch %st(5) + fmulp %st, %st(3) + fldt 48+_P@GOTOFF(%ebx) + fmul %st(5), %st + fldt 24+_P@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(5), %st + fldt _P@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fmul %st(1), %st + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fmulp %st, %st(2) + faddl 8+__libm_logl_table_256@GOTOFF(%ebx,%ecx) + faddp %st, %st(3) + fldl _ones@GOTOFF(%ebx) + fxch %st(1) + faddl __libm_logl_table_256@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + jmp ..B2.26 +..B2.17: + fstp %st(1) + testl %esi, %esi + jne ..B2.19 +..B2.18: + fldl _ones@GOTOFF(%ebx) + fmul %st, %st(1) + fldl _zeros@GOTOFF(%ebx) + fxch %st(2) + fxch %st(1) + jmp ..B2.26 +..B2.19: + cmpl $32767, %edx + je ..B2.39 +..B2.20: + fstp %st(0) + testl %edx, %edx + jne ..B2.24 +..B2.21: + testl %ecx, %ecx + jne ..B2.24 +..B2.22: + cmpl $0, 32(%esp) + jne ..B2.24 +..B2.23: + fldl _zeros@GOTOFF(%ebx) + fldl 8+_ones@GOTOFF(%ebx) + fdiv %st(1), %st + fldl _ones@GOTOFF(%ebx) + jmp ..B2.26 +..B2.24: + fldl _zeros@GOTOFF(%ebx) + fldl _infs@GOTOFF(%ebx) + fmul %st(1), %st + fldl _ones@GOTOFF(%ebx) +..B2.26: + fldt 12+_LN2_K80@GOTOFF(%ebx) + lea 72(%esp), %edx + fmul %st(4), %st + movl 8(%ebp), %eax + fstpt -44(%edx) + fldt -44(%edx) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt -12(%edx) + fldt -12(%edx) + fxch %st(3) + fmulp %st, %st(2) + movzwl -4(%edx), %esi + andl $32767, %esi + fxch %st(1) + fstpt (%edx) + fldt (%edx) + fldt _LN2_K80@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + fstpt -56(%edx) + fldt -56(%edx) + fld %st(2) + movzwl -48(%edx), %ecx + fadd %st(1), %st + andl $32767, %ecx + movl $0, 24(%eax) + cmpl %esi, %ecx + jg ..B2.31 +..B2.27: + jne ..B2.32 +..B2.28: + movl 20(%esp), %edx + movl 64(%esp), %ecx + cmpl %ecx, %edx + ja ..B2.31 +..B2.29: + jne ..B2.32 +..B2.30: + movl 16(%esp), %edx + cmpl 60(%esp), %edx + jbe ..B2.32 +..B2.31: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + jmp ..B2.33 +..B2.32: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) +..B2.33: + fld %st(0) + fadd %st(2), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 12(%eax) + movl 84(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.38 +..B2.34: + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.35: + fldl _zeros@GOTOFF(%ebx) + fucom %st(3) + fnstsw %ax + sahf + jp ..B2.44 + je ..B2.36 +..B2.44: + fstp %st(0) + jmp ..B2.8 +..B2.36: + fstp %st(2) + fstp %st(2) + fstp %st(1) + fld %st(0) + fld %st(1) + fxch %st(1) + fxch %st(2) + fxch %st(1) + jmp ..B2.26 +..B2.37: + fstp %st(1) + fstp %st(1) + fldl 8+_ones@GOTOFF(%ebx) + fdiv %st(1), %st + fldl _ones@GOTOFF(%ebx) + jmp ..B2.26 +..B2.38: + call __stack_chk_fail@PLT +..B2.39: + cmpl $-2147483648, %ecx + jne ..B2.18 +..B2.40: + cmpl $0, 32(%esp) + jne ..B2.18 + jmp ..B2.45 +..B2.41: + fldl _zeros@GOTOFF(%ebx) + fldt halfs@GOTOFF(%ebx) + fmul %st, %st(3) + fmulp %st, %st(2) + jmp ..B2.4 +..B2.45: + fstp %st(0) + jmp ..B2.24 + .align 16,0x90 + .type __libm_log_k80,@function + .size __libm_log_k80,.-__libm_log_k80 + .data +# -- End __libm_log_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +halfs: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00 + .type halfs,@object + .size halfs,24 + .align 2 +_Q1: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 5458 + .word 43692 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 44682 + .word 49156 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 63914 + .word 24446 + .word 52434 + .word 52426 + .word 16380 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q2: + .word 58950 + .word 11767 + .word 59949 + .word 40744 + .word 49076 + .word 0 + .word 44486 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 65514 + .word 65535 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 49718 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 36693 + .word 43691 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 41156 + .word 18852 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 14101 + .word 65290 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 21744 + .word 48151 + .word 14557 + .word 58254 + .word 16379 + .word 0 + .word 57454 + .word 983 + .word 52353 + .word 52428 + .word 49147 + .word 0 + .word 54021 + .word 59409 + .word 39452 + .word 47662 + .word 16379 + .word 0 + .word 35608 + .word 4659 + .word 11214 + .word 43692 + .word 49147 + .word 0 + .word 35524 + .word 31332 + .word 8749 + .word 40326 + .word 16379 + .word 0 + .word 54832 + .word 20873 + .word 17674 + .word 36915 + .word 49147 + .word 0 + .word 48567 + .word 9481 + .word 46911 + .word 55870 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .type _Q2,@object + .size _Q2,192 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .type _P,@object + .size _P,72 + .align 2 +_LN2_K80: + .word 0 + .word 0 + .word 6136 + .word 45426 + .word 16382 + .word 0 + .word 12704 + .word 55409 + .word 6480 + .word 47298 + .word 49116 + .word 0 + .type _LN2_K80,@object + .size _LN2_K80,24 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .hidden __libm_normalizel_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_normalizel_k80.S b/external/sgx_libm/ia32/libm_normalizel_k80.S new file mode 100644 index 0000000000..66068b39a5 --- /dev/null +++ b/external/sgx_libm/ia32/libm_normalizel_k80.S @@ -0,0 +1,163 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_normalizel_k80.c" + .text +..TXTST0: +# -- Begin __libm_normalizel_k80 + .text + .align 16,0x90 + .hidden __libm_normalizel_k80 + .globl __libm_normalizel_k80 +__libm_normalizel_k80: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + pushl %ebp + movl 16(%esp), %ecx + cmpl $0, 4(%ecx) + jne ..B1.3 +..B1.2: + cmpl $0, (%ecx) + je ..B1.14 +..B1.3: + movzwl 8(%ecx), %ebx + movl %ebx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.14 +..B1.4: + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + testl %eax, %eax + jle ..B1.16 +..B1.5: + andl $-32768, %ebx + addl $-16383, %eax + orl $-49153, %ebx +..B1.6: + movw %bx, 8(%ecx) + cmpl $0, 16(%ecx) + jne ..B1.8 +..B1.7: + cmpl $0, 12(%ecx) + je ..B1.13 +..B1.8: + movzwl 20(%ecx), %ebp + movl %ebp, %edi + andl $32767, %edi + jle ..B1.15 +..B1.9: + andl $-32768, %ebp + addl $-16383, %edi + orl $-49153, %ebp +..B1.10: + lea -256(%eax), %ebx + cmpl %ebx, %edi + jle ..B1.12 +..B1.11: + subl %eax, %edi + andl $-32768, %ebp + addl $16383, %edi + andl $32767, %edi + orl %edi, %ebp + movw %bp, 20(%ecx) + jmp ..B1.13 +..B1.12: + fldt _CONSTANTS@GOTOFF(%edx) + fstpt 12(%ecx) +..B1.13: + addl %eax, 24(%ecx) +..B1.14: + popl %ebp + popl %ebx + popl %edi + ret +..B1.15: + fldt 12(%ecx) + fldt 12+_CONSTANTS@GOTOFF(%edx) + fmulp %st, %st(1) + fstpt 12(%ecx) + movzwl 20(%ecx), %ebp + movl %ebp, %edi + andl $32767, %edi + andl $-32768, %ebp + addl $-16639, %edi + orl $-49153, %ebp + jmp ..B1.10 +..B1.16: + fldt (%ecx) + fldt 12+_CONSTANTS@GOTOFF(%edx) + fmulp %st, %st(1) + fstpt (%ecx) + movzwl 8(%ecx), %ebx + movl %ebx, %eax + andl $32767, %eax + andl $-32768, %ebx + addl $-16639, %eax + orl $-49153, %ebx + jmp ..B1.6 + .align 16,0x90 + .type __libm_normalizel_k80,@function + .size __libm_normalizel_k80,.-__libm_normalizel_k80 + .data +# -- End __libm_normalizel_k80 + .section .rodata, "a" + .align 16 + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_recacoshl_k80.S b/external/sgx_libm/ia32/libm_recacoshl_k80.S new file mode 100644 index 0000000000..529a516ef0 --- /dev/null +++ b/external/sgx_libm/ia32/libm_recacoshl_k80.S @@ -0,0 +1,1806 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_recacoshl_k80.c" + .text +..TXTST0: +# -- Begin __libm_recacoshl_k80 + .text + .align 16,0x90 + .hidden __libm_recacoshl_k80 + .globl __libm_recacoshl_k80 +__libm_recacoshl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +# parameter 4: 20 + %ebp +# parameter 5: 24 + %ebp +# parameter 6: 28 + %ebp +# parameter 7: 32 + %ebp +# parameter 8: 36 + %ebp +# parameter 9: 40 + %ebp +# parameter 10: 44 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $436, %esp + movl 8(%ebp), %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + movl %eax, 76(%esp) + movzwl 8(%ecx), %eax + andl $32767, %eax + movl %gs:20, %edx + xorl %esp, %edx + movl %edx, 428(%esp) + cmpl $16383, %eax + movl 24(%ebp), %ebx + movl 40(%ebp), %esi + jl ..B1.33 +..B1.2: + movzwl 8(%esi), %ecx + movl %ecx, %edi + andl $32767, %edi + cmpl $8383, %edi + jl ..B1.6 +..B1.3: + cmpl $24383, %edi + jg ..B1.6 +..B1.4: + movzwl 8(%ebx), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.6 +..B1.5: + cmpl $24383, %edx + jle ..B1.9 +..B1.6: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B1.7: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.8: + movzwl 8(%esi), %ecx + movl %ecx, %edi + movzwl 8(%ebx), %edx + andl $32767, %edi + movl %edx, 44(%esp) + andl $32767, %edx +..B1.9: + movl 24(%ebx), %eax + movl 24(%esi), %esi + movl %eax, 52(%esp) + movl %esi, 48(%esp) + lea -134(%eax,%edx), %eax + addl %edi, %esi + movl %esi, 36(%esp) + cmpl %esi, %eax + movl 40(%ebp), %esi + jge ..B1.26 +..B1.10: + movl 4(%esi), %eax + movl %eax, 32(%esp) + movl 52(%esp), %eax + lea 134(%eax,%edx), %eax + cmpl 36(%esp), %eax + jle ..B1.27 +..B1.11: + cmpl $0, 32(%esp) + jne ..B1.13 +..B1.12: + cmpl $0, (%esi) + je ..B1.28 +..B1.13: + cmpl $0, 4(%ebx) + jne ..B1.15 +..B1.14: + cmpl $0, (%ebx) + je ..B1.27 +..B1.15: + movl 52(%esp), %eax + cmpl 48(%esp), %eax + je ..B1.17 +..B1.16: + fldt (%esi) + fldt 12(%esi) + movl 48(%esp), %ecx + movl %eax, %edx + subl %edx, %ecx + andb $127, 41(%esp) + addl $16383, %ecx + movzwl 40(%esp), %eax + andl $32767, %ecx + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%esi) + fxch %st(2) + fstpt (%esi) + fldt (%esi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esi) + fldt 12(%esi) + movl 24(%ebx), %edi + movzwl 8(%ebx), %eax + movl %edi, 52(%esp) + movzwl 8(%esi), %ecx + movl %eax, 44(%esp) + jmp ..B1.18 +..B1.17: + fldt (%esi) + fldt 12(%esi) +..B1.18: + fldt (%ebx) + andl $32767, %ecx + movl 44(%esp), %edx + fld %st(2) + andl $32767, %edx + fadd %st(1), %st + movl 52(%esp), %eax + cmpl %edx, %ecx + movl %eax, 116(%esp) + jg ..B1.23 +..B1.19: + jne ..B1.24 +..B1.20: + movl 4(%esi), %eax + cmpl 4(%ebx), %eax + ja ..B1.23 +..B1.21: + jne ..B1.24 +..B1.22: + movl (%esi), %eax + cmpl (%ebx), %eax + jbe ..B1.24 +..B1.23: + fldt 12(%ebx) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B1.25 +..B1.24: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%ebx) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B1.25: + fld %st(0) + fadd %st(2), %st + fstpt 92(%esp) + fldt 92(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 104(%esp) + jmp ..B1.32 +..B1.26: + movl 4(%esi), %eax + movl %eax, 32(%esp) +..B1.27: + cmpl $0, 32(%esp) + jne ..B1.29 +..B1.225: + cmpl $0, (%esi) +..B1.28: + je ..B1.30 +..B1.29: + movl 52(%esp), %eax + lea -16517(%eax,%edx), %ecx + movl 48(%esp), %edx + lea -16383(%edx,%edi), %edi + cmpl %edi, %ecx + jl ..B1.31 +..B1.30: + movl (%ebx), %eax + movl %eax, 92(%esp) + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl 12(%ebx), %esi + movl 16(%ebx), %edi + movl 20(%ebx), %eax + movl 24(%ebx), %ebx + movl %edx, 96(%esp) + movl %ecx, 100(%esp) + movl %esi, 104(%esp) + movl %edi, 108(%esp) + movl %eax, 112(%esp) + movl %ebx, 116(%esp) + jmp ..B1.32 +..B1.31: + movl (%esi), %eax + movl %eax, 92(%esp) + movl 4(%esi), %edx + movl 8(%esi), %ecx + movl 12(%esi), %ebx + movl 16(%esi), %edi + movl 20(%esi), %eax + movl 24(%esi), %esi + movl %edx, 96(%esp) + movl %ecx, 100(%esp) + movl %ebx, 104(%esp) + movl %edi, 108(%esp) + movl %eax, 112(%esp) + movl %esi, 116(%esp) +..B1.32: + movl 76(%esp), %eax + movl $0, 144(%esp) + fldt .L_2il0floatpacket.10@GOTOFF(%eax) + fstpt 120(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%eax) + fstpt 132(%esp) + fldt 132(%esp) + jmp ..B1.63 +..B1.33: + movl 32(%ebp), %eax + movl 4(%eax), %ecx + movl 8(%eax), %edi + movl %ecx, 96(%esp) + movl 16(%eax), %ecx + movl %edi, 100(%esp) + movl 20(%eax), %edi + movl %ecx, 108(%esp) + movl (%eax), %edx + movzwl 8(%esi), %ecx + movl %edi, 112(%esp) + movl %ecx, %edi + movl %edx, 92(%esp) + andl $32767, %edi + movl 12(%eax), %edx + cmpl $8383, %edi + movl 24(%eax), %eax + movl %edx, 104(%esp) + movl %eax, 116(%esp) + jl ..B1.37 +..B1.34: + cmpl $24383, %edi + jg ..B1.37 +..B1.35: + movzwl 8(%ebx), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.37 +..B1.36: + cmpl $24383, %edx + jle ..B1.40 +..B1.37: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B1.38: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.39: + movzwl 8(%esi), %ecx + movl %ecx, %edi + movzwl 8(%ebx), %edx + andl $32767, %edi + movl %edx, 44(%esp) + andl $32767, %edx +..B1.40: + movl 24(%ebx), %eax + movl 24(%esi), %esi + movl %eax, 52(%esp) + movl %esi, 48(%esp) + lea -134(%eax,%edx), %eax + addl %edi, %esi + movl %esi, 36(%esp) + cmpl %esi, %eax + movl 40(%ebp), %esi + jge ..B1.57 +..B1.41: + movl 4(%esi), %eax + movl %eax, 32(%esp) + movl 52(%esp), %eax + lea 134(%eax,%edx), %eax + cmpl 36(%esp), %eax + jle ..B1.58 +..B1.42: + cmpl $0, 32(%esp) + jne ..B1.44 +..B1.43: + cmpl $0, (%esi) + je ..B1.59 +..B1.44: + cmpl $0, 4(%ebx) + jne ..B1.46 +..B1.45: + cmpl $0, (%ebx) + je ..B1.58 +..B1.46: + movl 52(%esp), %eax + cmpl 48(%esp), %eax + je ..B1.48 +..B1.47: + fldt (%esi) + fldt 12(%esi) + movl 48(%esp), %ecx + movl %eax, %edx + subl %edx, %ecx + andb $127, 41(%esp) + addl $16383, %ecx + movzwl 40(%esp), %eax + andl $32767, %ecx + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%esi) + fxch %st(2) + fstpt (%esi) + fldt (%esi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esi) + fldt 12(%esi) + movl 24(%ebx), %edi + movzwl 8(%ebx), %eax + movl %edi, 52(%esp) + movzwl 8(%esi), %ecx + movl %eax, 44(%esp) + jmp ..B1.49 +..B1.48: + fldt (%esi) + fldt 12(%esi) +..B1.49: + fldt (%ebx) + andl $32767, %ecx + movl 44(%esp), %edx + fld %st(2) + andl $32767, %edx + fsub %st(1), %st + movl 52(%esp), %eax + cmpl %edx, %ecx + movl %eax, 144(%esp) + jg ..B1.54 +..B1.50: + jne ..B1.55 +..B1.51: + movl 4(%esi), %eax + cmpl 4(%ebx), %eax + ja ..B1.54 +..B1.52: + jne ..B1.55 +..B1.53: + movl (%esi), %eax + cmpl (%ebx), %eax + jbe ..B1.55 +..B1.54: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 12(%ebx) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B1.56 +..B1.55: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%ebx) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B1.56: + fld %st(1) + movl 76(%esp), %eax + fadd %st(1), %st + fstpt 120(%esp) + fldt 120(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 132(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%eax) + jmp ..B1.63 +..B1.57: + movl 4(%esi), %eax + movl %eax, 32(%esp) +..B1.58: + cmpl $0, 32(%esp) + jne ..B1.60 +..B1.224: + cmpl $0, (%esi) +..B1.59: + je ..B1.61 +..B1.60: + movl 52(%esp), %eax + lea -16517(%eax,%edx), %ecx + movl 48(%esp), %edx + lea -16383(%edx,%edi), %edi + cmpl %edi, %ecx + jl ..B1.62 +..B1.61: + fldt (%ebx) + movl 76(%esp), %edx + fchs + movl 52(%esp), %eax + movl %eax, 144(%esp) + fstpt 120(%esp) + fldt 12(%ebx) + fchs + fstpt 132(%esp) + fldt .L_2il0floatpacket.9@GOTOFF(%edx) + jmp ..B1.63 +..B1.62: + movl (%esi), %eax + movl %eax, 120(%esp) + movl 20(%esi), %eax + movl %eax, 140(%esp) + movl 76(%esp), %eax + movl 4(%esi), %edx + movl 8(%esi), %ecx + fldt .L_2il0floatpacket.9@GOTOFF(%eax) + movl 12(%esi), %ebx + movl 16(%esi), %edi + movl 24(%esi), %esi + movl %edx, 124(%esp) + movl %ecx, 128(%esp) + movl %ebx, 132(%esp) + movl %edi, 136(%esp) + movl %esi, 144(%esp) +..B1.63: + movl 44(%ebp), %edx + movl 76(%esp), %eax + movl $0, 172(%esp) + movzwl 8(%edx), %ecx + movl %ecx, %ebx + fldt .L_2il0floatpacket.11@GOTOFF(%eax) + andl $32767, %ebx + fstpt 148(%esp) + cmpl $8383, %ebx + fstpt 160(%esp) + jl ..B1.67 +..B1.64: + cmpl $24383, %ebx + jg ..B1.67 +..B1.65: + movzwl 156(%esp), %edx + movl %edx, 48(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.67 +..B1.66: + cmpl $24383, %edx + jle ..B1.70 +..B1.67: + addl $4, %esp + pushl 44(%ebp) + call __libm_normalizel_k80 +..B1.68: + addl $4, %esp + lea 144(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.69: + movl 44(%ebp), %ecx + movzwl 156(%esp), %edx + movl %edx, 48(%esp) + andl $32767, %edx + movzwl 8(%ecx), %ecx + movl %ecx, %ebx + andl $32767, %ebx +..B1.70: + movl 44(%ebp), %esi + movl 172(%esp), %eax + movl 24(%esi), %edi + movl %edi, 56(%esp) + lea (%ebx,%edi), %esi + movl %esi, 52(%esp) + lea -134(%eax,%edx), %edi + cmpl %edi, %esi + jle ..B1.87 +..B1.71: + movl 44(%ebp), %esi + movl 4(%esi), %edi + lea 134(%eax,%edx), %esi + movl %edi, 44(%esp) + cmpl 52(%esp), %esi + jle ..B1.88 +..B1.72: + cmpl $0, 44(%esp) + jne ..B1.74 +..B1.73: + movl 44(%ebp), %esi + cmpl $0, (%esi) + je ..B1.89 +..B1.74: + cmpl $0, 152(%esp) + jne ..B1.76 +..B1.75: + cmpl $0, 148(%esp) + je ..B1.88 +..B1.76: + cmpl 56(%esp), %eax + je ..B1.78 +..B1.77: + movl 56(%esp), %edx + subl %eax, %edx + andb $127, 41(%esp) + addl $16383, %edx + movl 44(%ebp), %ebx + andl $32767, %edx + movzwl 40(%esp), %ecx + andl $-32768, %ecx + fldt (%ebx) + orl %edx, %ecx + fldt 12(%ebx) + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %eax, 24(%ebx) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt 12(%ebx) + movzwl 8(%ebx), %ecx + jmp ..B1.79 +..B1.78: + movl 44(%ebp), %edx + fldt (%edx) + fldt 12(%edx) +..B1.79: + fldt 148(%esp) + andl $32767, %ecx + movl %eax, 200(%esp) + fld %st(2) + movl 48(%esp), %eax + fadd %st(1), %st + andl $32767, %eax + cmpl %eax, %ecx + jg ..B1.84 +..B1.80: + movl 48(%esp), %eax + andl $32767, %eax + cmpl %eax, %ecx + jne ..B1.85 +..B1.81: + movl 44(%ebp), %eax + movl 4(%eax), %edx + cmpl 152(%esp), %edx + ja ..B1.84 +..B1.82: + jne ..B1.85 +..B1.83: + movl 44(%ebp), %eax + movl (%eax), %edx + cmpl 148(%esp), %edx + jbe ..B1.85 +..B1.84: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 160(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.86 +..B1.85: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 160(%esp) + faddp %st, %st(1) +..B1.86: + fld %st(0) + fadd %st(2), %st + fstpt 176(%esp) + fldt 176(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 188(%esp) + jmp ..B1.93 +..B1.87: + movl 44(%ebp), %ecx + movl 4(%ecx), %esi + movl %esi, 44(%esp) +..B1.88: + cmpl $0, 44(%esp) + jne ..B1.90 +..B1.226: + movl 44(%ebp), %ecx + cmpl $0, (%ecx) +..B1.89: + je ..B1.91 +..B1.90: + lea -16517(%eax,%edx), %ecx + movl 56(%esp), %edx + lea -16383(%edx,%ebx), %ebx + cmpl %ebx, %ecx + jl ..B1.92 +..B1.91: + movl 148(%esp), %edx + movl %edx, 176(%esp) + movl 152(%esp), %ecx + movl 156(%esp), %ebx + movl 160(%esp), %esi + movl 164(%esp), %edi + movl 168(%esp), %edx + movl %ecx, 180(%esp) + movl %ebx, 184(%esp) + movl %esi, 188(%esp) + movl %edi, 192(%esp) + movl %edx, 196(%esp) + movl %eax, 200(%esp) + jmp ..B1.93 +..B1.92: + movl 44(%ebp), %eax + movl (%eax), %edx + movl %edx, 176(%esp) + movl 4(%eax), %ecx + movl 8(%eax), %ebx + movl 12(%eax), %esi + movl 16(%eax), %edi + movl 20(%eax), %edx + movl 24(%eax), %eax + movl %ecx, 180(%esp) + movl %ebx, 184(%esp) + movl %esi, 188(%esp) + movl %edi, 192(%esp) + movl %edx, 196(%esp) + movl %eax, 200(%esp) +..B1.93: + movzwl 184(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.97 +..B1.94: + cmpl $24383, %eax + jg ..B1.97 +..B1.95: + movzwl 100(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.97 +..B1.96: + cmpl $24383, %eax + jle ..B1.99 +..B1.97: + addl $4, %esp + lea 172(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.98: + addl $4, %esp + lea 88(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.99: + fldt 176(%esp) + movl 76(%esp), %edx + fld %st(0) + fld %st(1) + fldt 92(%esp) + fld %st(0) + fldt .L_2il0floatpacket.12@GOTOFF(%edx) + fld %st(0) + fmul %st(6), %st + movl 36(%ebp), %esi + fsubr %st, %st(5) + movzwl 8(%esi), %edi + movl %edi, %ecx + movl 200(%esp), %eax + andl $32767, %ecx + addl 116(%esp), %eax + faddp %st, %st(5) + fld %st(4) + fld %st(3) + fxch %st(2) + fstpt 48(%esp) + fldt 48(%esp) + cmpl $8383, %ecx + fmul %st(4), %st + movl 28(%ebp), %ebx + fsubr %st, %st(3) + movl %eax, 228(%esp) + faddp %st, %st(3) + fmul %st(2), %st + fxch %st(4) + fsub %st(5), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 104(%esp) + fmulp %st, %st(4) + fldt 188(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 204(%esp) + fldt 204(%esp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 216(%esp) + fstpt 64(%esp) + jl ..B1.103 +..B1.100: + cmpl $24383, %ecx + jg ..B1.103 +..B1.101: + movzwl 8(%ebx), %edx + movl %edx, 60(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.103 +..B1.102: + cmpl $24383, %edx + jle ..B1.106 +..B1.103: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B1.104: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.105: + movzwl 8(%esi), %edi + movl %edi, %ecx + movzwl 8(%ebx), %edx + andl $32767, %ecx + movl %edx, 60(%esp) + andl $32767, %edx +..B1.106: + movl 24(%ebx), %eax + movl 24(%esi), %esi + movl %eax, 88(%esp) + movl %esi, 84(%esp) + lea -134(%eax,%edx), %eax + addl %ecx, %esi + movl %esi, 80(%esp) + cmpl %eax, %esi + movl 36(%ebp), %esi + jle ..B1.123 +..B1.107: + movl 4(%esi), %eax + movl %eax, 44(%esp) + movl 88(%esp), %eax + lea 134(%eax,%edx), %eax + cmpl 80(%esp), %eax + jle ..B1.124 +..B1.108: + cmpl $0, 44(%esp) + jne ..B1.110 +..B1.109: + cmpl $0, (%esi) + je ..B1.125 +..B1.110: + cmpl $0, 4(%ebx) + jne ..B1.112 +..B1.111: + cmpl $0, (%ebx) + je ..B1.124 +..B1.112: + movl 88(%esp), %eax + cmpl 84(%esp), %eax + je ..B1.114 +..B1.113: + fldt 64(%esp) + movl 84(%esp), %edi + movl %eax, %edx + subl %edx, %edi + fstpt 32(%esp) + addl $16383, %edi + fldt (%esi) + andl $32767, %edi + fldt 12(%esi) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%esi) + fxch %st(2) + fstpt (%esi) + fldt (%esi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esi) + fldt 12(%esi) + movl 24(%ebx), %ecx + movzwl 8(%ebx), %eax + movl %ecx, 88(%esp) + movzwl 8(%esi), %edi + movl %eax, 60(%esp) + jmp ..B1.115 +..B1.114: + fldt (%esi) + fldt 12(%esi) +..B1.115: + fldt (%ebx) + andl $32767, %edi + movl 60(%esp), %edx + fld %st(2) + andl $32767, %edx + fadd %st(1), %st + movl 88(%esp), %eax + cmpl %edx, %edi + movl %eax, 256(%esp) + jg ..B1.120 +..B1.116: + jne ..B1.121 +..B1.117: + movl 4(%esi), %eax + cmpl 4(%ebx), %eax + ja ..B1.120 +..B1.118: + jne ..B1.121 +..B1.119: + movl (%esi), %eax + cmpl (%ebx), %eax + jbe ..B1.121 +..B1.120: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 12(%ebx) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.122 +..B1.121: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 12(%ebx) + faddp %st, %st(1) +..B1.122: + fld %st(0) + fadd %st(2), %st + fstpt 232(%esp) + fldt 232(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 244(%esp) + jmp ..B1.129 +..B1.123: + movl 4(%esi), %eax + movl %eax, 44(%esp) +..B1.124: + cmpl $0, 44(%esp) + jne ..B1.126 +..B1.227: + cmpl $0, (%esi) +..B1.125: + je ..B1.127 +..B1.126: + movl 88(%esp), %eax + lea -16517(%eax,%edx), %edi + movl 84(%esp), %edx + lea -16383(%edx,%ecx), %ecx + cmpl %ecx, %edi + jl ..B1.128 +..B1.127: + movl (%ebx), %eax + movl %eax, 232(%esp) + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl 12(%ebx), %esi + movl 16(%ebx), %edi + movl 20(%ebx), %eax + movl 24(%ebx), %ebx + movl %edx, 236(%esp) + movl %ecx, 240(%esp) + movl %esi, 244(%esp) + movl %edi, 248(%esp) + movl %eax, 252(%esp) + movl %ebx, 256(%esp) + jmp ..B1.129 +..B1.128: + movl (%esi), %eax + movl %eax, 232(%esp) + movl 4(%esi), %edx + movl 8(%esi), %ecx + movl 12(%esi), %ebx + movl 16(%esi), %edi + movl 20(%esi), %eax + movl 24(%esi), %esi + movl %edx, 236(%esp) + movl %ecx, 240(%esp) + movl %ebx, 244(%esp) + movl %edi, 248(%esp) + movl %eax, 252(%esp) + movl %esi, 256(%esp) +..B1.129: + movzwl 240(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.133 +..B1.130: + cmpl $24383, %eax + jg ..B1.133 +..B1.131: + movzwl 128(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.133 +..B1.132: + cmpl $24383, %eax + jle ..B1.135 +..B1.133: + addl $4, %esp + lea 228(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.134: + addl $4, %esp + lea 116(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.135: + fldt 232(%esp) + fld %st(0) + fld %st(1) + fldt 48(%esp) + fld %st(0) + fmul %st(4), %st + movl 256(%esp), %edx + fsubr %st, %st(3) + movzwl 212(%esp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + addl 144(%esp), %edx + fxch %st(2) + fsub %st(3), %st + fldt 120(%esp) + cmpl $8383, %eax + fmul %st, %st(2) + fld %st(0) + movl %edx, 284(%esp) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 132(%esp) + fmulp %st, %st(4) + fldt 244(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 260(%esp) + fldt 260(%esp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 272(%esp) + fldt 272(%esp) + jl ..B1.139 +..B1.136: + cmpl $24383, %eax + jg ..B1.139 +..B1.137: + movzwl 268(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.139 +..B1.138: + cmpl $24383, %eax + jle ..B1.142 +..B1.139: + fstp %st(1) + fstp %st(0) + addl $4, %esp + lea 200(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.140: + addl $4, %esp + lea 256(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.141: + fldt 260(%esp) + fldt 272(%esp) + movl 284(%esp), %edx +..B1.142: + fldt 204(%esp) + fld %st(2) + fdivr %st(1), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(4) + fstpt 80(%esp) + fldt 80(%esp) + fldt 48(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movl 228(%esp), %eax + fsubr %st(4), %st + subl %edx, %eax + faddp %st, %st(1) + fld %st(0) + decl %eax + movl %eax, 312(%esp) + fsubr %st(4), %st + fxch %st(2) + fmul %st(3), %st + fsubr %st, %st(7) + faddp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fld %st(2) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(6) + faddp %st, %st(5) + fsubrp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fldt 216(%esp) + faddp %st, %st(1) + fsubp %st, %st(1) + fldt 80(%esp) + fdivrp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 288(%esp) + fldt 288(%esp) + fsubrp %st, %st(2) + movzwl 296(%esp), %esi + movl %esi, %ebx + andl $32767, %ebx + fadd %st, %st(1) + fxch %st(1) + fstpt 300(%esp) + cmpl $8383, %ebx + fstpt 64(%esp) + jl ..B1.146 +..B1.143: + cmpl $24383, %ebx + jg ..B1.146 +..B1.144: + movzwl 156(%esp), %ecx + movl %ecx, 60(%esp) + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B1.146 +..B1.145: + cmpl $24383, %ecx + jle ..B1.149 +..B1.146: + addl $4, %esp + lea 284(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.147: + addl $4, %esp + lea 144(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.148: + movzwl 296(%esp), %esi + movl %esi, %ebx + movzwl 156(%esp), %ecx + andl $32767, %ebx + movl 312(%esp), %eax + movl %ecx, 60(%esp) + andl $32767, %ecx +..B1.149: + movl 172(%esp), %edi + lea (%eax,%ebx), %edx + movl %edi, 84(%esp) + movl %edx, 80(%esp) + lea -134(%edi,%ecx), %edi + cmpl %edi, %edx + jle ..B1.166 +..B1.150: + movl 84(%esp), %edi + movl 292(%esp), %edx + movl %edx, 44(%esp) + lea 134(%edi,%ecx), %edx + cmpl 80(%esp), %edx + jle ..B1.167 +..B1.151: + cmpl $0, 44(%esp) + jne ..B1.153 +..B1.152: + cmpl $0, 288(%esp) + je ..B1.168 +..B1.153: + cmpl $0, 152(%esp) + jne ..B1.155 +..B1.154: + cmpl $0, 148(%esp) + je ..B1.167 +..B1.155: + cmpl 84(%esp), %eax + je ..B1.157 +..B1.156: + fldt 64(%esp) + movl %edi, %ecx + subl %ecx, %eax + fstpt 32(%esp) + addl $16383, %eax + fldt 288(%esp) + andl $32767, %eax + fldt 300(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movl %ecx, %eax + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 288(%esp) + fldt 288(%esp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 296(%esp), %esi + movl %esi, %ebx + andl $32767, %ebx + movl %ecx, 312(%esp) + movl %ebx, %ecx + fstpt 300(%esp) + fldt 300(%esp) + jmp ..B1.158 +..B1.157: + fldt 288(%esp) + movl %esi, %ecx + fldt 300(%esp) + andl $32767, %ecx +..B1.158: + fldt 148(%esp) + fld %st(2) + movl 60(%esp), %edi + fadd %st(1), %st + andl $32767, %edi + movl 84(%esp), %edx + cmpl %edi, %ecx + movl %edx, 340(%esp) + jg ..B1.163 +..B1.159: + movl 60(%esp), %edx + andl $32767, %esi + andl $32767, %edx + cmpl %edx, %esi + jne ..B1.164 +..B1.160: + movl 292(%esp), %edx + cmpl 152(%esp), %edx + ja ..B1.163 +..B1.161: + jne ..B1.164 +..B1.162: + movl 288(%esp), %edx + cmpl 148(%esp), %edx + jbe ..B1.164 +..B1.163: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 160(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.165 +..B1.164: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 160(%esp) + faddp %st, %st(1) +..B1.165: + fld %st(0) + fadd %st(2), %st + fstpt 316(%esp) + fldt 316(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 328(%esp) + jmp ..B1.172 +..B1.166: + movl 292(%esp), %edx + movl %edx, 44(%esp) +..B1.167: + cmpl $0, 44(%esp) + jne ..B1.169 +..B1.229: + cmpl $0, 288(%esp) +..B1.168: + je ..B1.170 +..B1.169: + movl 84(%esp), %edx + lea -16383(%eax,%ebx), %esi + lea -16517(%edx,%ecx), %ecx + cmpl %esi, %ecx + jl ..B1.171 +..B1.170: + movl 148(%esp), %edx + movl 152(%esp), %ecx + movl 156(%esp), %esi + movl %edx, 316(%esp) + movl %ecx, 320(%esp) + movl %esi, 324(%esp) + movl 160(%esp), %edi + movl 164(%esp), %edx + movl 168(%esp), %ecx + movl 84(%esp), %esi + movl %edi, 328(%esp) + movl %edx, 332(%esp) + movl %ecx, 336(%esp) + movl %esi, 340(%esp) + jmp ..B1.172 +..B1.171: + movl 288(%esp), %edx + movl 44(%esp), %ecx + movl 296(%esp), %esi + movl %edx, 316(%esp) + movl %ecx, 320(%esp) + movl %esi, 324(%esp) + movl 300(%esp), %edi + movl 304(%esp), %edx + movl 308(%esp), %ecx + movl 312(%esp), %esi + movl %edi, 328(%esp) + movl %edx, 332(%esp) + movl %ecx, 336(%esp) + movl %esi, 340(%esp) +..B1.172: + cmpl $8383, %ebx + jl ..B1.176 +..B1.173: + cmpl $24383, %ebx + jg ..B1.176 +..B1.174: + movzwl 324(%esp), %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.176 +..B1.175: + cmpl $24383, %edx + jle ..B1.179 +..B1.176: + addl $4, %esp + lea 284(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.177: + addl $4, %esp + lea 312(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.178: + movl 312(%esp), %eax +..B1.179: + fldt 288(%esp) + fld %st(0) + fld %st(1) + fldt 48(%esp) + fld %st(0) + fmul %st(4), %st + addl 340(%esp), %eax + fsubr %st, %st(3) + movl %eax, 368(%esp) + faddp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fldt 316(%esp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 328(%esp) + fmulp %st, %st(4) + fldt 300(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 344(%esp) + fldt 344(%esp) + fsubr %st, %st(1) + movzwl 352(%esp), %edx + fxch %st(1) + faddp %st, %st(2) + andl $32767, %edx + fxch %st(1) + fstpt 356(%esp) + fldt 356(%esp) + cmpl $383, %edx + fxch %st(1) + fstpt 64(%esp) + jl ..B1.181 +..B1.180: + cmpl $32383, %edx + jle ..B1.183 +..B1.181: + fstp %st(0) + addl $4, %esp + lea 340(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.182: + fldt 344(%esp) + fstpt 64(%esp) + fldt 356(%esp) + movl 368(%esp), %eax +..B1.183: + testb $1, %al + jne ..B1.220 +..B1.184: + movl 76(%esp), %edx + fldt .L_2il0floatpacket.13@GOTOFF(%edx) +..B1.185: + fldt 64(%esp) + fld %st(0) + fsqrt + fldt 48(%esp) + fmul %st(1), %st + fld %st(0) + movzwl 296(%esp), %ebx + movl %ebx, %esi + andl $32767, %esi + fsubr %st(2), %st + sarl $1, %eax + faddp %st, %st(1) + fld %st(0) + cmpl $8383, %esi + movl %eax, 396(%esp) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fmulp %st, %st(1) + fdiv %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt 372(%esp) + fldt 372(%esp) + fsubrp %st, %st(2) + fadd %st, %st(1) + fxch %st(1) + fstpt 384(%esp) + fstpt 64(%esp) + jl ..B1.189 +..B1.186: + cmpl $24383, %esi + jg ..B1.189 +..B1.187: + movzwl 380(%esp), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B1.189 +..B1.188: + cmpl $24383, %ecx + jle ..B1.192 +..B1.189: + addl $4, %esp + lea 284(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.190: + addl $4, %esp + lea 368(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.191: + movzwl 296(%esp), %ebx + movl %ebx, %esi + movzwl 380(%esp), %ecx + andl $32767, %esi + movl 396(%esp), %eax + movl %ecx, 44(%esp) + andl $32767, %ecx +..B1.192: + movl 312(%esp), %edx + movl %edx, 52(%esp) + lea (%esi,%edx), %edi + movl %edi, 48(%esp) + lea -134(%eax,%ecx), %edx + cmpl %edx, %edi + jle ..B1.209 +..B1.193: + movl 292(%esp), %edx + lea 134(%eax,%ecx), %edi + cmpl 48(%esp), %edi + jle ..B1.210 +..B1.194: + testl %edx, %edx + jne ..B1.196 +..B1.195: + cmpl $0, 288(%esp) + je ..B1.211 +..B1.196: + cmpl $0, 376(%esp) + jne ..B1.198 +..B1.197: + cmpl $0, 372(%esp) + je ..B1.210 +..B1.198: + cmpl 52(%esp), %eax + je ..B1.200 +..B1.199: + fldt 64(%esp) + movl 52(%esp), %edx + fstpt 32(%esp) + subl %eax, %edx + fldt 288(%esp) + addl $16383, %edx + fldt 300(%esp) + andl $32767, %edx + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %edx, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 288(%esp) + fldt 288(%esp) + fxch %st(2) + fmulp %st, %st(1) + movl %eax, 312(%esp) + fstpt 300(%esp) + fldt 300(%esp) + movzwl 296(%esp), %ebx + jmp ..B1.201 +..B1.200: + fldt 288(%esp) + fldt 300(%esp) +..B1.201: + fldt 372(%esp) + fld %st(2) + movl %eax, 424(%esp) + movl %ebx, %eax + movl 44(%esp), %edx + andl $32767, %eax + andl $32767, %edx + fadd %st(1), %st + cmpl %edx, %eax + jg ..B1.206 +..B1.202: + movl 44(%esp), %eax + andl $32767, %ebx + andl $32767, %eax + cmpl %eax, %ebx + jne ..B1.207 +..B1.203: + movl 292(%esp), %eax + cmpl 376(%esp), %eax + ja ..B1.206 +..B1.204: + jne ..B1.207 +..B1.205: + movl 288(%esp), %eax + cmpl 372(%esp), %eax + jbe ..B1.207 +..B1.206: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 384(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B1.208 +..B1.207: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 384(%esp) + faddp %st, %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B1.208: + fld %st(0) + fadd %st(2), %st + fstpt 400(%esp) + fldt 400(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 412(%esp) + jmp ..B1.215 +..B1.209: + movl 292(%esp), %edx +..B1.210: + testl %edx, %edx + jne ..B1.212 +..B1.228: + cmpl $0, 288(%esp) +..B1.211: + je ..B1.213 +..B1.212: + lea -16517(%eax,%ecx), %ecx + movl 52(%esp), %eax + lea -16383(%eax,%esi), %ebx + cmpl %ebx, %ecx + jl ..B1.214 +..B1.213: + movl 372(%esp), %eax + movl %eax, 400(%esp) + movl 376(%esp), %edx + movl 380(%esp), %ecx + movl 384(%esp), %ebx + movl 388(%esp), %esi + movl 392(%esp), %edi + movl 396(%esp), %eax + movl %edx, 404(%esp) + movl %ecx, 408(%esp) + movl %ebx, 412(%esp) + movl %esi, 416(%esp) + movl %edi, 420(%esp) + movl %eax, 424(%esp) + jmp ..B1.215 +..B1.214: + movl %edx, 404(%esp) + movl 288(%esp), %eax + movl 296(%esp), %edx + movl 300(%esp), %ecx + movl 304(%esp), %ebx + movl 308(%esp), %esi + movl 52(%esp), %edi + movl %eax, 400(%esp) + movl %edx, 408(%esp) + movl %ecx, 412(%esp) + movl %ebx, 416(%esp) + movl %esi, 420(%esp) + movl %edi, 424(%esp) +..B1.215: + addl $8, %esp + lea 392(%esp), %eax + lea 24(%esp), %edx + pushl %eax + pushl %edx + call __libm_log1p_k80 +..B1.216: + fldt 32(%esp) + movl 56(%esp), %eax + fstpt (%esp) + fldt 44(%esp) + fstpt 12(%esp) + movl %eax, 24(%esp) + call __libm_scalbl_k80 +..B1.217: + movl 428(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.219 +..B1.218: + addl $436, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.219: + fstp %st(0) + movl 76(%esp), %ebx + call __stack_chk_fail@PLT +..B1.220: + fldt 64(%esp) + incl %eax + movl 76(%esp), %edx + movl %eax, 368(%esp) + fldt .L_2il0floatpacket.13@GOTOFF(%edx) + fmul %st, %st(1) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt 356(%esp) + fldt 356(%esp) + fxch %st(1) + fstpt 344(%esp) + fxch %st(1) + jmp ..B1.185 + .align 16,0x90 + .type __libm_recacoshl_k80,@function + .size __libm_recacoshl_k80,.-__libm_recacoshl_k80 + .data +# -- End __libm_recacoshl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.12: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,12 + .data + .hidden __libm_log1p_k80 + .hidden __libm_normalizel_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_recacosl_recasinl_k80.S b/external/sgx_libm/ia32/libm_recacosl_recasinl_k80.S new file mode 100644 index 0000000000..d833921901 --- /dev/null +++ b/external/sgx_libm/ia32/libm_recacosl_recasinl_k80.S @@ -0,0 +1,6111 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_recacosl_recasinl_k80.c" + .text +..TXTST0: +# -- Begin __libm_carctrigprepare_k80 + .text + .align 16,0x90 + .hidden __libm_carctrigprepare_k80 + .globl __libm_carctrigprepare_k80 +__libm_carctrigprepare_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +# parameter 4: 20 + %ebp +# parameter 5: 24 + %ebp +# parameter 6: 28 + %ebp +# parameter 7: 32 + %ebp +# parameter 8: 36 + %ebp +# parameter 9: 40 + %ebp +# parameter 10: 44 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $212, %esp + xorl %ecx, %ecx + movl 8(%ebp), %esi + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + movl 16(%ebp), %ebx + movl %edx, 60(%esp) + fldt _CONSTANTS@GOTOFF(%edx) + fldt 24+_CONSTANTS@GOTOFF(%edx) + movl (%esi), %edi + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 200(%esp) + movl %edi, (%ebx) + movl 4(%esi), %eax + movl %eax, 4(%ebx) + movl 8(%esi), %edx + movl %edx, 8(%ebx) + shrl $8, %edx + movl %ecx, 112(%esp) + fstpt 16(%esp) + fldt 16(%esp) + fxch %st(1) + fstpt 88(%esp) + fstpt 100(%esp) + fldt 100(%esp) + addl $4, %esp + movzbl %dl, %edx + pushl %ebx + andl $127, %edx + movl %ecx, 24(%ebx) + movb %dl, 9(%ebx) + fstpt 12(%ebx) + call __libm_normalizel_k80 +..B1.2: + movl 12(%ebp), %edx + addl $4, %esp + movl 20(%ebp), %esi + pushl %esi + fldt 16(%esp) + movl (%edx), %edi + movl %edi, (%esi) + movl 4(%edx), %eax + movl %eax, 4(%esi) + movl 8(%edx), %ecx + movl %ecx, 8(%esi) + shrl $8, %ecx + movzbl %cl, %ecx + andl $127, %ecx + movl $0, 24(%esi) + movb %cl, 9(%esi) + fstpt 12(%esi) + call __libm_normalizel_k80 +..B1.3: + fldt (%esi) + movl 60(%esp), %edx + fld %st(0) + fld %st(1) + fld %st(2) + fldt 12(%esi) + fmulp %st, %st(4) + movl 32(%ebp), %ecx + fxch %st(3) + fadd %st(0), %st + fldt 36+_CONSTANTS@GOTOFF(%edx) + fmul %st, %st(3) + movl 24(%esi), %eax + fxch %st(2) + fsub %st(3), %st + addl %eax, %eax + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(4) + fmul %st(4), %st + movl %eax, 24(%ecx) + fadd %st(0), %st + fxch %st(4) + fmul %st(0), %st + fxch %st(2) + fstpt 32(%esp) + fld %st(3) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt (%ecx) + fldt (%ecx) + fsubrp %st, %st(1) + movzwl 8(%ebx), %eax + fadd %st(1), %st + movl %eax, 68(%esp) + andl $32767, %eax + fstpt 12(%ecx) + cmpl $8383, %eax + fstpt 48(%esp) + jl ..B1.7 +..B1.4: + cmpl $24383, %eax + jg ..B1.7 +..B1.5: + movzwl 96(%esp), %edx + movl %edx, 44(%esp) + andl $32767, %edx + movl %edx, 28(%esp) + cmpl $8383, %edx + jl ..B1.7 +..B1.6: + cmpl $24383, 28(%esp) + jle ..B1.10 +..B1.7: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.8: + addl $4, %esp + lea 84(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.9: + movzwl 96(%esp), %edx + movzwl 8(%ebx), %eax + movl %edx, 44(%esp) + andl $32767, %edx + movl %eax, 68(%esp) + andl $32767, %eax + movl %edx, 28(%esp) +..B1.10: + movl 24(%ebx), %ecx + movl 112(%esp), %esi + movl %ecx, 64(%esp) + lea (%eax,%ecx), %edi + movl %edi, 20(%esp) + lea (%edx,%esi), %ecx + lea -134(%esi,%edx), %edx + cmpl %edi, %edx + jge ..B1.27 +..B1.11: + movl 4(%ebx), %edi + movl %edi, 16(%esp) + movl 28(%esp), %edi + lea 134(%esi,%edi), %edi + cmpl 20(%esp), %edi + jle ..B1.28 +..B1.12: + cmpl $0, 16(%esp) + jne ..B1.14 +..B1.13: + cmpl $0, (%ebx) + je ..B1.29 +..B1.14: + cmpl $0, 92(%esp) + jne ..B1.16 +..B1.15: + cmpl $0, 88(%esp) + je ..B1.28 +..B1.16: + cmpl 64(%esp), %esi + je ..B1.18 +..B1.17: + fldt 48(%esp) + movl 64(%esp), %eax + fstpt 16(%esp) + subl %esi, %eax + fldt (%ebx) + addl $16383, %eax + fldt 12(%ebx) + andl $32767, %eax + andb $127, 25(%esp) + movzwl 24(%esp), %edi + andl $-32768, %edi + orl %eax, %edi + movw %di, 24(%esp) + movl $-2147483648, 20(%esp) + movl $0, 16(%esp) + fldt 16(%esp) + fmul %st, %st(2) + movl %esi, 24(%ebx) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + movzwl 8(%ebx), %eax + fstpt 48(%esp) + movl %eax, 68(%esp) + jmp ..B1.19 +..B1.18: + fldt (%ebx) + fstpt 48(%esp) +..B1.19: + fldt 88(%esp) + fldt 48(%esp) + movl 28(%ebp), %eax + movl 68(%esp), %edi + fadd %st(1), %st + movl %esi, 24(%eax) + andl $32767, %edi + fstpt 12(%eax) + fldt 12(%eax) + movl 44(%esp), %eax + andl $32767, %eax + movl %edi, 68(%esp) + cmpl %eax, %edi + jg ..B1.24 +..B1.20: + movl 44(%esp), %eax + andl $32767, %eax + cmpl 68(%esp), %eax + jne ..B1.25 +..B1.21: + movl 4(%ebx), %eax + cmpl 92(%esp), %eax + ja ..B1.24 +..B1.22: + jne ..B1.25 +..B1.23: + movl (%ebx), %eax + cmpl 88(%esp), %eax + jbe ..B1.25 +..B1.24: + fldt 48(%esp) + fsub %st(1), %st + faddp %st, %st(2) + fldt 100(%esp) + faddp %st, %st(2) + fldt 12(%ebx) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B1.26 +..B1.25: + fldt 48(%esp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 100(%esp) + fldt 12(%ebx) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B1.26: + fldt 48(%esp) + fld %st(0) + movl 28(%ebp), %eax + fadd %st(2), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%eax) + jmp ..B1.33 +..B1.27: + movl 4(%ebx), %edi + movl %edi, 16(%esp) +..B1.28: + cmpl $0, 16(%esp) + jne ..B1.30 +..B1.210: + cmpl $0, (%ebx) +..B1.29: + je ..B1.31 +..B1.30: + movl 28(%esp), %edi + lea -16517(%esi,%edi), %ebx + movl 64(%esp), %edi + lea -16383(%edi,%eax), %eax + cmpl %eax, %ebx + movl 16(%ebp), %ebx + jl ..B1.32 +..B1.31: + movl 28(%ebp), %eax + movl 88(%esp), %edi + movl %edi, (%eax) + movl 92(%esp), %edi + movl %edi, 4(%eax) + movl 96(%esp), %edi + movl %edi, 8(%eax) + movl 100(%esp), %edi + movl %edi, 12(%eax) + movl 104(%esp), %edi + movl %edi, 16(%eax) + movl 108(%esp), %edi + movl %edi, 20(%eax) + movl %esi, 24(%eax) + jmp ..B1.33 +..B1.32: + movl 28(%ebp), %eax + movl (%ebx), %edi + movl %edi, (%eax) + movl 4(%ebx), %edi + movl %edi, 4(%eax) + movl 8(%ebx), %edi + movl %edi, 8(%eax) + movl 12(%ebx), %edi + movl %edi, 12(%eax) + movl 16(%ebx), %edi + movl %edi, 16(%eax) + movl 20(%ebx), %edi + movl %edi, 20(%eax) + movl 24(%ebx), %edi + movl %edi, 24(%eax) +..B1.33: + movzwl 8(%ebx), %eax + movl %eax, 64(%esp) + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.37 +..B1.34: + cmpl $24383, %eax + jg ..B1.37 +..B1.35: + cmpl $8383, 28(%esp) + jl ..B1.37 +..B1.36: + cmpl $24383, 28(%esp) + jle ..B1.40 +..B1.37: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.38: + addl $4, %esp + lea 84(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.39: + movzwl 96(%esp), %edx + movl %edx, 44(%esp) + andl $32767, %edx + movl 112(%esp), %esi + movzwl 8(%ebx), %eax + movl %eax, 64(%esp) + andl $32767, %eax + lea (%esi,%edx), %ecx + lea -134(%esi,%edx), %edx +..B1.40: + movl 24(%ebx), %edi + movl %edi, 72(%esp) + addl %eax, %edi + movl %edi, 68(%esp) + cmpl %edi, %edx + jge ..B1.57 +..B1.41: + movl 4(%ebx), %edx + lea 134(%ecx), %edi + movl %edx, 28(%esp) + cmpl 68(%esp), %edi + jle ..B1.58 +..B1.42: + cmpl $0, 28(%esp) + jne ..B1.44 +..B1.43: + cmpl $0, (%ebx) + je ..B1.59 +..B1.44: + cmpl $0, 92(%esp) + jne ..B1.46 +..B1.45: + cmpl $0, 88(%esp) + je ..B1.58 +..B1.46: + cmpl 72(%esp), %esi + je ..B1.48 +..B1.47: + fldt 48(%esp) + movl 72(%esp), %eax + fstpt 16(%esp) + subl %esi, %eax + fldt (%ebx) + addl $16383, %eax + fldt 12(%ebx) + andl $32767, %eax + andb $127, 25(%esp) + movzwl 24(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 24(%esp) + movl $-2147483648, 20(%esp) + movl $0, 16(%esp) + fldt 16(%esp) + fmul %st, %st(2) + movl %esi, 24(%ebx) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + movzwl 8(%ebx), %ecx + movl %ecx, 64(%esp) + jmp ..B1.49 +..B1.48: + fldt (%ebx) +..B1.49: + fldt 88(%esp) + fld %st(1) + movl 28(%ebp), %eax + fadd %st(1), %st + movl 64(%esp), %edx + movl 44(%esp), %ecx + andl $32767, %edx + andl $32767, %ecx + movl %esi, 24(%eax) + cmpl %ecx, %edx + fstpt 12(%eax) + fldt 12(%eax) + movl %edx, 64(%esp) + jg ..B1.54 +..B1.50: + movl 44(%esp), %eax + andl $32767, %eax + cmpl 64(%esp), %eax + jne ..B1.55 +..B1.51: + movl 4(%ebx), %eax + cmpl 92(%esp), %eax + ja ..B1.54 +..B1.52: + jne ..B1.55 +..B1.53: + movl (%ebx), %eax + cmpl 88(%esp), %eax + jbe ..B1.55 +..B1.54: + fldt 100(%esp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 12(%ebx) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.56 +..B1.55: + fldt 12(%ebx) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 100(%esp) + faddp %st, %st(1) +..B1.56: + fld %st(0) + movl 28(%ebp), %eax + fadd %st(2), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%eax) + jmp ..B1.63 +..B1.57: + movl 4(%ebx), %edx + movl %edx, 28(%esp) +..B1.58: + cmpl $0, 28(%esp) + jne ..B1.60 +..B1.209: + cmpl $0, (%ebx) +..B1.59: + je ..B1.61 +..B1.60: + movl 72(%esp), %edx + addl $-16517, %ecx + lea -16383(%edx,%eax), %eax + cmpl %eax, %ecx + jl ..B1.62 +..B1.61: + movl 28(%ebp), %eax + movl 88(%esp), %edx + movl 92(%esp), %ecx + movl 96(%esp), %edi + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl %edi, 8(%eax) + movl 100(%esp), %edx + movl 104(%esp), %ecx + movl 108(%esp), %edi + movl %edx, 12(%eax) + movl %ecx, 16(%eax) + movl %edi, 20(%eax) + movl %esi, 24(%eax) + jmp ..B1.63 +..B1.62: + movl 28(%ebp), %eax + movl (%ebx), %edx + movl %edx, (%eax) + movl 4(%ebx), %ecx + movl %ecx, 4(%eax) + movl 8(%ebx), %esi + movl %esi, 8(%eax) + movl 12(%ebx), %edi + movl %edi, 12(%eax) + movl 16(%ebx), %edx + movl %edx, 16(%eax) + movl 20(%ebx), %ecx + movl %ecx, 20(%eax) + movl 24(%ebx), %esi + movl %esi, 24(%eax) +..B1.63: + movl 28(%ebp), %eax + movzwl 8(%eax), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.65 +..B1.64: + cmpl $24383, %eax + jle ..B1.67 +..B1.65: + addl $4, %esp + pushl 28(%ebp) + call __libm_normalizel_k80 +..B1.66: + addl $4, %esp + pushl 28(%ebp) + call __libm_normalizel_k80 +..B1.67: + fldt 32(%esp) + movl 28(%ebp), %eax + fldt (%eax) + fmul %st, %st(1) + fld %st(0) + movl 24(%eax), %edi + fsub %st(2), %st + addl %edi, %edi + faddp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fld %st(1) + fsub %st(3), %st + fmul %st, %st(3) + movl %edi, 140(%esp) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(1) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(3) + fldt 12(%eax) + fmulp %st, %st(2) + fxch %st(1) + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 116(%esp) + fldt 116(%esp) + fsubrp %st, %st(1) + movzwl 124(%esp), %ecx + movl %ecx, %esi + andl $32767, %esi + fadd %st(1), %st + fstpt 128(%esp) + cmpl $8383, %esi + fstpt 48(%esp) + jl ..B1.71 +..B1.68: + cmpl $24383, %esi + jg ..B1.71 +..B1.69: + movl 32(%ebp), %eax + movzwl 8(%eax), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.71 +..B1.70: + cmpl $24383, %edx + jle ..B1.74 +..B1.71: + addl $4, %esp + lea 112(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.72: + addl $4, %esp + pushl 32(%ebp) + call __libm_normalizel_k80 +..B1.73: + movl 32(%ebp), %eax + movzwl 124(%esp), %ecx + movl %ecx, %esi + movl 140(%esp), %edi + andl $32767, %esi + movzwl 8(%eax), %edx + movl %edx, 44(%esp) + andl $32767, %edx +..B1.74: + movl 32(%ebp), %ebx + lea (%edi,%esi), %eax + movl %eax, 64(%esp) + movl 24(%ebx), %ebx + movl %ebx, 68(%esp) + lea -134(%ebx,%edx), %ebx + cmpl %ebx, %eax + movl 16(%ebp), %ebx + jle ..B1.91 +..B1.75: + movl 120(%esp), %eax + movl %eax, 28(%esp) + movl 68(%esp), %eax + lea 134(%eax,%edx), %eax + cmpl 64(%esp), %eax + jle ..B1.92 +..B1.76: + cmpl $0, 28(%esp) + jne ..B1.78 +..B1.77: + cmpl $0, 116(%esp) + je ..B1.93 +..B1.78: + movl 32(%ebp), %eax + cmpl $0, 4(%eax) + jne ..B1.80 +..B1.79: + movl 32(%ebp), %eax + cmpl $0, (%eax) + je ..B1.92 +..B1.80: + cmpl 68(%esp), %edi + je ..B1.82 +..B1.81: + fldt 48(%esp) + movl 68(%esp), %edx + subl %edx, %edi + fstpt 16(%esp) + addl $16383, %edi + fldt 116(%esp) + andl $32767, %edi + fldt 128(%esp) + andb $127, 25(%esp) + movzwl 24(%esp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 24(%esp) + movl $-2147483648, 20(%esp) + movl $0, 16(%esp) + fldt 16(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 116(%esp) + fldt 116(%esp) + fxch %st(2) + fmulp %st, %st(1) + movl %edx, 140(%esp) + fstpt 128(%esp) + fldt 128(%esp) + movzwl 124(%esp), %ecx + jmp ..B1.83 +..B1.82: + fldt 116(%esp) + fldt 128(%esp) +..B1.83: + movl 32(%ebp), %edx + movl %ecx, %esi + movl 44(%esp), %edi + andl $32767, %esi + andl $32767, %edi + fld %st(1) + fldt (%edx) + cmpl %edi, %esi + movl 68(%esp), %eax + fadd %st, %st(1) + movl %eax, 168(%esp) + movl %edi, 44(%esp) + jg ..B1.88 +..B1.84: + andl $32767, %ecx + cmpl 44(%esp), %ecx + jne ..B1.89 +..B1.85: + movl 32(%ebp), %eax + movl 4(%eax), %edx + cmpl 120(%esp), %edx + jb ..B1.88 +..B1.86: + jne ..B1.89 +..B1.87: + movl 32(%ebp), %edx + movl 116(%esp), %eax + cmpl (%edx), %eax + jbe ..B1.89 +..B1.88: + movl 32(%ebp), %eax + fxch %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 12(%eax) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B1.90 +..B1.89: + movl 32(%ebp), %eax + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%eax) + faddp %st, %st(2) +..B1.90: + fld %st(1) + fadd %st(1), %st + fstpt 144(%esp) + fldt 144(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 156(%esp) + jmp ..B1.97 +..B1.91: + movl 120(%esp), %eax + movl %eax, 28(%esp) +..B1.92: + cmpl $0, 28(%esp) + jne ..B1.94 +..B1.212: + cmpl $0, 116(%esp) +..B1.93: + je ..B1.95 +..B1.94: + movl 68(%esp), %eax + lea -16383(%edi,%esi), %ecx + lea -16517(%eax,%edx), %edx + cmpl %ecx, %edx + jl ..B1.96 +..B1.95: + movl 32(%ebp), %eax + movl (%eax), %edx + movl 4(%eax), %ecx + movl %edx, 144(%esp) + movl %ecx, 148(%esp) + movl 8(%eax), %esi + movl 12(%eax), %edi + movl 16(%eax), %edx + movl 20(%eax), %ecx + movl 24(%eax), %eax + movl %esi, 152(%esp) + movl %edi, 156(%esp) + movl %edx, 160(%esp) + movl %ecx, 164(%esp) + movl %eax, 168(%esp) + jmp ..B1.97 +..B1.96: + movl 116(%esp), %eax + movl 28(%esp), %edx + movl %eax, 144(%esp) + movl %edx, 148(%esp) + movl 124(%esp), %ecx + movl 128(%esp), %esi + movl 132(%esp), %edi + movl 136(%esp), %eax + movl 140(%esp), %edx + movl %ecx, 152(%esp) + movl %esi, 156(%esp) + movl %edi, 160(%esp) + movl %eax, 164(%esp) + movl %edx, 168(%esp) +..B1.97: + movzwl 152(%esp), %eax + andl $32767, %eax + cmpl $383, %eax + jl ..B1.99 +..B1.98: + cmpl $32383, %eax + jle ..B1.100 +..B1.99: + addl $4, %esp + lea 140(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.100: + movl 168(%esp), %edx + testb $1, %dl + jne ..B1.205 +..B1.101: + fldt 144(%esp) + movl 60(%esp), %eax + fstpt 64(%esp) + fldt 156(%esp) + fldt 48+_CONSTANTS@GOTOFF(%eax) + fstpt 48(%esp) +..B1.102: + fldt 64(%esp) + fld %st(0) + fsqrt + fldt 32(%esp) + movl 36(%ebp), %eax + fmul %st(1), %st + fld %st(0) + sarl $1, %edx + fsubr %st(2), %st + movl %edx, 24(%eax) + faddp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 48(%esp) + fmulp %st, %st(1) + fdiv %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(2) + movzwl 8(%ebx), %ecx + movl %ecx, %esi + andl $32767, %esi + fadd %st, %st(1) + fxch %st(1) + fstpt 12(%eax) + cmpl $8383, %esi + fstpt 64(%esp) + jl ..B1.106 +..B1.103: + cmpl $24383, %esi + jg ..B1.106 +..B1.104: + movzwl 96(%esp), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.106 +..B1.105: + cmpl $24383, %edx + jle ..B1.109 +..B1.106: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.107: + addl $4, %esp + lea 84(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.108: + movzwl 8(%ebx), %ecx + movl %ecx, %esi + movzwl 96(%esp), %edx + andl $32767, %esi + movl %edx, 44(%esp) + andl $32767, %edx +..B1.109: + movl 24(%ebx), %edi + movl %edi, 80(%esp) + lea (%esi,%edi), %eax + movl 112(%esp), %edi + movl %edi, 84(%esp) + movl %eax, 76(%esp) + lea -134(%edi,%edx), %edi + cmpl %edi, %eax + jle ..B1.126 +..B1.110: + movl 84(%esp), %edi + movl 4(%ebx), %eax + movl %eax, 28(%esp) + lea 134(%edi,%edx), %eax + cmpl 76(%esp), %eax + jle ..B1.127 +..B1.111: + cmpl $0, 28(%esp) + jne ..B1.113 +..B1.112: + cmpl $0, (%ebx) + je ..B1.128 +..B1.113: + cmpl $0, 92(%esp) + jne ..B1.115 +..B1.114: + cmpl $0, 88(%esp) + je ..B1.127 +..B1.115: + movl %edi, %eax + cmpl 80(%esp), %eax + je ..B1.117 +..B1.116: + fldt 64(%esp) + movl 80(%esp), %eax + movl %edi, %ecx + subl %ecx, %eax + fstpt 16(%esp) + addl $16383, %eax + fldt (%ebx) + andl $32767, %eax + fldt 12(%ebx) + andb $127, 25(%esp) + movzwl 24(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 24(%esp) + movl $-2147483648, 20(%esp) + movl $0, 16(%esp) + fldt 16(%esp) + fmul %st, %st(2) + movl %ecx, 24(%ebx) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + movzwl 8(%ebx), %ecx + jmp ..B1.118 +..B1.117: + fldt (%ebx) +..B1.118: + fldt 88(%esp) + fld %st(1) + movl 24(%ebp), %edx + andl $32767, %ecx + movl 44(%esp), %esi + fsub %st(1), %st + andl $32767, %esi + movl %edi, %eax + cmpl %esi, %ecx + movl %eax, 24(%edx) + fstpt 12(%edx) + fldt 12(%edx) + jg ..B1.123 +..B1.119: + movl 44(%esp), %eax + andl $32767, %eax + cmpl %eax, %ecx + jne ..B1.124 +..B1.120: + movl 4(%ebx), %eax + cmpl 92(%esp), %eax + ja ..B1.123 +..B1.121: + jne ..B1.124 +..B1.122: + movl (%ebx), %eax + cmpl 88(%esp), %eax + jbe ..B1.124 +..B1.123: + fldt 12(%ebx) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt 100(%esp) + fsubrp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.125 +..B1.124: + fldt 100(%esp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fldt 12(%ebx) + faddp %st, %st(3) + fsubrp %st, %st(2) +..B1.125: + fld %st(1) + movl 24(%ebp), %eax + fadd %st(1), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 12(%eax) + jmp ..B1.132 +..B1.126: + movl 4(%ebx), %eax + movl %eax, 28(%esp) +..B1.127: + cmpl $0, 28(%esp) + jne ..B1.129 +..B1.208: + cmpl $0, (%ebx) +..B1.128: + je ..B1.130 +..B1.129: + movl 84(%esp), %eax + lea -16517(%eax,%edx), %ecx + movl 80(%esp), %edx + lea -16383(%edx,%esi), %esi + cmpl %esi, %ecx + jl ..B1.131 +..B1.130: + fldt 88(%esp) + movl 24(%ebp), %edx + fchs + movl 84(%esp), %eax + movl %eax, 24(%edx) + fstpt (%edx) + fldt 100(%esp) + fchs + fstpt 12(%edx) + jmp ..B1.132 +..B1.131: + movl 24(%ebp), %eax + movl (%ebx), %edx + movl %edx, (%eax) + movl 4(%ebx), %ecx + movl %ecx, 4(%eax) + movl 8(%ebx), %esi + movl %esi, 8(%eax) + movl 12(%ebx), %edi + movl %edi, 12(%eax) + movl 16(%ebx), %edx + movl %edx, 16(%eax) + movl 20(%ebx), %ecx + movl %ecx, 20(%eax) + movl 24(%ebx), %ebx + movl %ebx, 24(%eax) +..B1.132: + movl 24(%ebp), %eax + movzwl 8(%eax), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.134 +..B1.133: + cmpl $24383, %eax + jle ..B1.136 +..B1.134: + addl $4, %esp + pushl 24(%ebp) + call __libm_normalizel_k80 +..B1.135: + addl $4, %esp + pushl 24(%ebp) + call __libm_normalizel_k80 +..B1.136: + fldt 32(%esp) + movl 24(%ebp), %eax + fldt (%eax) + fmul %st, %st(1) + fld %st(0) + movl 24(%eax), %esi + fsub %st(2), %st + addl %esi, %esi + faddp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fld %st(1) + fsub %st(3), %st + fmul %st, %st(3) + movl %esi, 140(%esp) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(1) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(3) + fldt 12(%eax) + fmulp %st, %st(2) + fxch %st(1) + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 116(%esp) + fldt 116(%esp) + fsubrp %st, %st(1) + movzwl 124(%esp), %ecx + movl %ecx, %ebx + andl $32767, %ebx + fadd %st(1), %st + fstpt 128(%esp) + cmpl $8383, %ebx + fstpt 64(%esp) + jl ..B1.140 +..B1.137: + cmpl $24383, %ebx + jg ..B1.140 +..B1.138: + movl 32(%ebp), %eax + movzwl 8(%eax), %edx + movl %edx, 44(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.140 +..B1.139: + cmpl $24383, %edx + jle ..B1.143 +..B1.140: + addl $4, %esp + lea 112(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.141: + addl $4, %esp + pushl 32(%ebp) + call __libm_normalizel_k80 +..B1.142: + movl 32(%ebp), %eax + movzwl 124(%esp), %ecx + movl %ecx, %ebx + movl 140(%esp), %esi + andl $32767, %ebx + movzwl 8(%eax), %edx + movl %edx, 44(%esp) + andl $32767, %edx +..B1.143: + movl 32(%ebp), %edi + lea (%esi,%ebx), %eax + movl %eax, 76(%esp) + movl 24(%edi), %edi + movl %edi, 80(%esp) + lea -134(%edi,%edx), %edi + cmpl %edi, %eax + jle ..B1.160 +..B1.144: + movl 80(%esp), %edi + movl 120(%esp), %eax + movl %eax, 28(%esp) + lea 134(%edi,%edx), %eax + cmpl 76(%esp), %eax + jle ..B1.161 +..B1.145: + cmpl $0, 28(%esp) + jne ..B1.147 +..B1.146: + cmpl $0, 116(%esp) + je ..B1.162 +..B1.147: + movl 32(%ebp), %eax + cmpl $0, 4(%eax) + jne ..B1.149 +..B1.148: + movl 32(%ebp), %eax + cmpl $0, (%eax) + je ..B1.161 +..B1.149: + cmpl 80(%esp), %esi + je ..B1.151 +..B1.150: + fldt 64(%esp) + movl %edi, %edx + subl %edx, %esi + fstpt 16(%esp) + addl $16383, %esi + fldt 116(%esp) + andl $32767, %esi + fldt 128(%esp) + andb $127, 25(%esp) + movzwl 24(%esp), %eax + andl $-32768, %eax + orl %esi, %eax + movw %ax, 24(%esp) + movl $-2147483648, 20(%esp) + movl $0, 16(%esp) + fldt 16(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 116(%esp) + fldt 116(%esp) + fxch %st(2) + fmulp %st, %st(1) + movl %edx, 140(%esp) + fstpt 128(%esp) + fldt 128(%esp) + movzwl 124(%esp), %ecx + jmp ..B1.152 +..B1.151: + fldt 116(%esp) + fldt 128(%esp) +..B1.152: + movl 32(%ebp), %edx + movl %ecx, %ebx + movl 44(%esp), %esi + andl $32767, %ebx + andl $32767, %esi + fld %st(1) + fldt (%edx) + cmpl %esi, %ebx + movl %edi, %eax + fadd %st, %st(1) + movl %eax, 196(%esp) + movl %esi, 44(%esp) + jg ..B1.157 +..B1.153: + andl $32767, %ecx + cmpl 44(%esp), %ecx + jne ..B1.158 +..B1.154: + movl 32(%ebp), %eax + movl 4(%eax), %edx + cmpl 120(%esp), %edx + jb ..B1.157 +..B1.155: + jne ..B1.158 +..B1.156: + movl 32(%ebp), %edx + movl 116(%esp), %eax + cmpl (%edx), %eax + jbe ..B1.158 +..B1.157: + movl 32(%ebp), %eax + fxch %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 12(%eax) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B1.159 +..B1.158: + movl 32(%ebp), %eax + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%eax) + faddp %st, %st(2) +..B1.159: + fld %st(1) + fadd %st(1), %st + fstpt 172(%esp) + fldt 172(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 184(%esp) + jmp ..B1.166 +..B1.160: + movl 120(%esp), %eax + movl %eax, 28(%esp) +..B1.161: + cmpl $0, 28(%esp) + jne ..B1.163 +..B1.211: + cmpl $0, 116(%esp) +..B1.162: + je ..B1.164 +..B1.163: + movl 80(%esp), %eax + lea -16383(%esi,%ebx), %ecx + lea -16517(%eax,%edx), %edx + cmpl %ecx, %edx + jl ..B1.165 +..B1.164: + movl 32(%ebp), %eax + movl (%eax), %edx + movl %edx, 172(%esp) + movl 4(%eax), %ecx + movl 8(%eax), %ebx + movl 12(%eax), %esi + movl 16(%eax), %edi + movl 20(%eax), %edx + movl 24(%eax), %eax + movl %ecx, 176(%esp) + movl %ebx, 180(%esp) + movl %esi, 184(%esp) + movl %edi, 188(%esp) + movl %edx, 192(%esp) + movl %eax, 196(%esp) + jmp ..B1.166 +..B1.165: + movl 116(%esp), %eax + movl %eax, 172(%esp) + movl 28(%esp), %edx + movl 124(%esp), %ecx + movl 128(%esp), %ebx + movl 132(%esp), %esi + movl 136(%esp), %edi + movl 140(%esp), %eax + movl %edx, 176(%esp) + movl %ecx, 180(%esp) + movl %ebx, 184(%esp) + movl %esi, 188(%esp) + movl %edi, 192(%esp) + movl %eax, 196(%esp) +..B1.166: + movzwl 180(%esp), %eax + andl $32767, %eax + cmpl $383, %eax + jl ..B1.168 +..B1.167: + cmpl $32383, %eax + jle ..B1.169 +..B1.168: + addl $4, %esp + lea 168(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B1.169: + movl 196(%esp), %ecx + testb $1, %cl + jne ..B1.204 +..B1.170: + fldt 172(%esp) + fstpt 64(%esp) + fldt 184(%esp) +..B1.171: + fldt 64(%esp) + fld %st(0) + fsqrt + fldt 32(%esp) + fmul %st(1), %st + fld %st(0) + movl 40(%ebp), %ebx + fsubr %st(2), %st + movl 36(%ebp), %eax + faddp %st, %st(1) + fld %st(0) + sarl $1, %ecx + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + movl %ecx, 24(%ebx) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 48(%esp) + fmulp %st, %st(1) + fdiv %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt (%ebx) + fldt (%ebx) + fsubrp %st, %st(2) + movzwl 8(%eax), %edx + fadd %st, %st(1) + movl %edx, 44(%esp) + andl $32767, %edx + fxch %st(1) + fstpt 12(%ebx) + cmpl $8383, %edx + fstpt 64(%esp) + jl ..B1.175 +..B1.172: + cmpl $24383, %edx + jg ..B1.175 +..B1.173: + movzwl 8(%ebx), %eax + movl %eax, 32(%esp) + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.175 +..B1.174: + cmpl $24383, %eax + jle ..B1.178 +..B1.175: + addl $4, %esp + pushl 36(%ebp) + call __libm_normalizel_k80 +..B1.176: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B1.177: + movl 36(%ebp), %edx + movzwl 8(%ebx), %eax + movl 24(%ebx), %ecx + movzwl 8(%edx), %edx + movl %edx, 44(%esp) + andl $32767, %edx + movl %eax, 32(%esp) + andl $32767, %eax +..B1.178: + movl 36(%ebp), %esi + movl 24(%esi), %edi + movl %edi, 40(%esp) + lea (%edx,%edi), %esi + movl %esi, 36(%esp) + lea -134(%ecx,%eax), %edi + cmpl %edi, %esi + jle ..B1.195 +..B1.179: + movl 36(%ebp), %esi + movl 4(%esi), %edi + lea 134(%ecx,%eax), %esi + movl %edi, 28(%esp) + cmpl 36(%esp), %esi + jle ..B1.196 +..B1.180: + cmpl $0, 28(%esp) + jne ..B1.182 +..B1.181: + movl 36(%ebp), %esi + cmpl $0, (%esi) + je ..B1.197 +..B1.182: + cmpl $0, 4(%ebx) + jne ..B1.184 +..B1.183: + cmpl $0, (%ebx) + je ..B1.196 +..B1.184: + cmpl 40(%esp), %ecx + je ..B1.186 +..B1.185: + fldt 64(%esp) + movl 40(%esp), %eax + fstpt 16(%esp) + subl %ecx, %eax + andb $127, 25(%esp) + addl $16383, %eax + movl 36(%ebp), %esi + andl $32767, %eax + movzwl 24(%esp), %edx + andl $-32768, %edx + fldt (%esi) + orl %eax, %edx + fldt 12(%esi) + movw %dx, 24(%esp) + movl $-2147483648, 20(%esp) + movl $0, 16(%esp) + fldt 16(%esp) + fmul %st, %st(2) + movl %ecx, 24(%esi) + fxch %st(2) + fstpt (%esi) + fldt (%esi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esi) + movzwl 8(%esi), %edi + movzwl 8(%ebx), %eax + movl 24(%ebx), %ecx + movl %edi, 44(%esp) + movl %eax, 32(%esp) + jmp ..B1.187 +..B1.186: + movl 36(%ebp), %eax + fldt (%eax) +..B1.187: + fldt (%ebx) + fld %st(1) + movl 44(%ebp), %eax + fadd %st(1), %st + movl %ecx, 24(%eax) + movl 44(%esp), %edx + movl 32(%esp), %ecx + andl $32767, %edx + andl $32767, %ecx + fstpt 12(%eax) + fldt 12(%eax) + cmpl %ecx, %edx + jg ..B1.192 +..B1.188: + jne ..B1.193 +..B1.189: + movl 36(%ebp), %eax + movl 4(%eax), %edx + cmpl 4(%ebx), %edx + ja ..B1.192 +..B1.190: + jne ..B1.193 +..B1.191: + movl 36(%ebp), %eax + movl (%eax), %edx + cmpl (%ebx), %edx + jbe ..B1.193 +..B1.192: + fldt 12(%ebx) + fxch %st(1) + fsubr %st, %st(3) + movl 36(%ebp), %eax + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 12(%eax) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + jmp ..B1.194 +..B1.193: + movl 36(%ebp), %eax + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fldt 12(%eax) + faddp %st, %st(1) + fldt 12(%ebx) + faddp %st, %st(1) + fstpt 16(%esp) + fldt 16(%esp) +..B1.194: + fld %st(0) + movl 44(%ebp), %eax + fadd %st(2), %st + fstpt (%eax) + fldt (%eax) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%eax) + jmp ..B1.201 +..B1.195: + movl 36(%ebp), %esi + movl 4(%esi), %edi + movl %edi, 28(%esp) +..B1.196: + cmpl $0, 28(%esp) + jne ..B1.198 +..B1.213: + movl 36(%ebp), %esi + cmpl $0, (%esi) +..B1.197: + je ..B1.199 +..B1.198: + lea -16517(%ecx,%eax), %ecx + movl 40(%esp), %eax + lea -16383(%eax,%edx), %edx + cmpl %edx, %ecx + jl ..B1.200 +..B1.199: + movl 44(%ebp), %eax + movl (%ebx), %edx + movl %edx, (%eax) + movl 4(%ebx), %ecx + movl %ecx, 4(%eax) + movl 8(%ebx), %esi + movl %esi, 8(%eax) + movl 12(%ebx), %edi + movl %edi, 12(%eax) + movl 16(%ebx), %edx + movl %edx, 16(%eax) + movl 20(%ebx), %ecx + movl %ecx, 20(%eax) + movl 24(%ebx), %ebx + movl %ebx, 24(%eax) + jmp ..B1.201 +..B1.200: + movl 36(%ebp), %eax + movl 44(%ebp), %edx + movl (%eax), %ecx + movl %ecx, (%edx) + movl 4(%eax), %ebx + movl %ebx, 4(%edx) + movl 8(%eax), %esi + movl %esi, 8(%edx) + movl 12(%eax), %edi + movl %edi, 12(%edx) + movl 16(%eax), %ecx + movl %ecx, 16(%edx) + movl 20(%eax), %ebx + movl %ebx, 20(%edx) + movl 24(%eax), %eax + movl %eax, 24(%edx) +..B1.201: + movl 200(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.203 +..B1.202: + addl $212, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.203: + movl 60(%esp), %ebx + call __stack_chk_fail@PLT +..B1.204: + fldt 172(%esp) + incl %ecx + fldt 48(%esp) + fmul %st, %st(1) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fstpt 172(%esp) + fldt 184(%esp) + fmulp %st, %st(1) + movl %ecx, 196(%esp) + fstpt 184(%esp) + fldt 184(%esp) + jmp ..B1.171 +..B1.205: + fldt 144(%esp) + incl %edx + movl 60(%esp), %eax + movl %edx, 168(%esp) + fldt 48+_CONSTANTS@GOTOFF(%eax) + fmul %st, %st(1) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fstpt 144(%esp) + fstpt 48(%esp) + fldt 48(%esp) + fldt 156(%esp) + fmulp %st, %st(1) + fstpt 156(%esp) + fldt 156(%esp) + jmp ..B1.102 + .align 16,0x90 + .type __libm_carctrigprepare_k80,@function + .size __libm_carctrigprepare_k80,.-__libm_carctrigprepare_k80 + .data +# -- End __libm_carctrigprepare_k80 + .text +# -- Begin __libm_recacosl_k80 + .text + .align 16,0x90 + .hidden __libm_recacosl_k80 + .globl __libm_recacosl_k80 +__libm_recacosl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +# parameter 4: 20 + %ebp +# parameter 5: 24 + %ebp +# parameter 6: 28 + %ebp +# parameter 7: 32 + %ebp +# parameter 8: 36 + %ebp +# parameter 9: 40 + %ebp +# parameter 10: 44 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $500, %esp + movl 16(%ebp), %esi + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 488(%esp) + movzwl 8(%esi), %eax + andl $32767, %eax + movl 44(%ebp), %edi + cmpl $8383, %eax + jl ..B2.5 +..B2.2: + cmpl $24383, %eax + jg ..B2.5 +..B2.3: + movzwl 8(%edi), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.5 +..B2.4: + cmpl $24383, %eax + jle ..B2.7 +..B2.5: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B2.6: + addl $4, %esp + pushl %edi + call __libm_normalizel_k80 +..B2.7: + fldt (%esi) + fld %st(0) + fldt (%edi) + fdivr %st, %st(1) + fld %st(0) + call ..L4 +..L4: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%eax), %eax + fld %st(1) + movl 24(%esi), %ebx + subl 24(%edi), %ebx + fldt 36+_CONSTANTS@GOTOFF(%eax) + fld %st(0) + fmul %st(5), %st + lea 1(%ebx), %edx + fld %st(0) + movl %eax, 92(%esp) + fsubr %st(6), %st + movl %edx, 484(%esp) + faddp %st, %st(1) + fld %st(0) + fsubr %st(6), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(4) + fld %st(4) + fsub %st(4), %st + fxch %st(3) + fstpt 80(%esp) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fldt 12(%esi) + faddp %st, %st(3) + fldt 12(%edi) + fmul %st(2), %st + fsubrp %st, %st(3) + fdivrp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 460(%esp) + fldt 460(%esp) + fsubrp %st, %st(1) + movzwl 468(%esp), %ecx + fadd %st(1), %st + andl $32767, %ecx + fstpt 472(%esp) + fstpt 48(%esp) + lea 1(%ecx,%ebx), %eax + cmpl $16382, %eax + jl ..B2.200 +..B2.8: + movl 8(%ebp), %eax + movl 40(%ebp), %ebx + movzwl 8(%eax), %edx + andl $32767, %edx + cmpl $16383, %edx + jl ..B2.39 +..B2.9: + movl 32(%ebp), %eax + movl (%eax), %edx + movl %edx, 264(%esp) + movl 8(%eax), %edx + movl 4(%eax), %ecx + movl %edx, 272(%esp) + movl 16(%eax), %edx + movl %ecx, 268(%esp) + movl 12(%eax), %ecx + movl %edx, 280(%esp) + movzwl 8(%ebx), %edx + movl %ecx, 276(%esp) + movl 20(%eax), %ecx + movl %edx, 68(%esp) + andl $32767, %edx + movl 24(%eax), %eax + cmpl $8383, %edx + movl %ecx, 284(%esp) + movl %eax, 288(%esp) + jl ..B2.13 +..B2.10: + cmpl $24383, %edx + jg ..B2.13 +..B2.11: + movl 24(%ebp), %eax + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) + cmpl $8383, %ecx + jl ..B2.13 +..B2.12: + cmpl $24383, 40(%esp) + jle ..B2.16 +..B2.13: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B2.14: + addl $4, %esp + pushl 24(%ebp) + call __libm_normalizel_k80 +..B2.15: + movl 24(%ebp), %eax + movzwl 8(%ebx), %edx + movl %edx, 68(%esp) + andl $32767, %edx + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) +..B2.16: + movl 24(%ebp), %ecx + movl 24(%ecx), %eax + movl 40(%esp), %ecx + movl %eax, 64(%esp) + lea -134(%eax,%ecx), %eax + movl 24(%ebx), %ecx + movl %ecx, 60(%esp) + addl %edx, %ecx + movl %ecx, 36(%esp) + cmpl %ecx, %eax + jge ..B2.33 +..B2.17: + movl 4(%ebx), %eax + movl %eax, 32(%esp) + movl 64(%esp), %ecx + movl 40(%esp), %eax + lea 134(%ecx,%eax), %ecx + cmpl 36(%esp), %ecx + jle ..B2.34 +..B2.18: + cmpl $0, 32(%esp) + jne ..B2.20 +..B2.19: + cmpl $0, (%ebx) + je ..B2.35 +..B2.20: + movl 24(%ebp), %eax + cmpl $0, 4(%eax) + jne ..B2.22 +..B2.21: + movl 24(%ebp), %eax + cmpl $0, (%eax) + je ..B2.34 +..B2.22: + movl 64(%esp), %eax + cmpl 60(%esp), %eax + je ..B2.24 +..B2.23: + fldt 48(%esp) + movl 60(%esp), %eax + movl 64(%esp), %ecx + subl %ecx, %eax + fstpt 32(%esp) + addl $16383, %eax + fldt (%ebx) + andl $32767, %eax + fldt 12(%ebx) + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %ecx, 24(%ebx) + movl 24(%ebp), %ecx + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fstpt 48(%esp) + fmulp %st, %st(1) + movl 24(%ecx), %eax + fstpt 12(%ebx) + fldt 12(%ebx) + movl %eax, 64(%esp) + movzwl 8(%ebx), %edx + movzwl 8(%ecx), %eax + movl %edx, 68(%esp) + movl %eax, 44(%esp) + jmp ..B2.25 +..B2.24: + fldt (%ebx) + fstpt 48(%esp) + fldt 12(%ebx) +..B2.25: + fldt 48(%esp) + movl 24(%ebp), %edx + movl 64(%esp), %eax + movl %eax, 316(%esp) + fldt (%edx) + movl 68(%esp), %ecx + fadd %st, %st(1) + movl 44(%esp), %eax + andl $32767, %ecx + andl $32767, %eax + cmpl %eax, %ecx + jg ..B2.30 +..B2.26: + jne ..B2.31 +..B2.27: + movl 24(%ebp), %edx + movl 4(%ebx), %eax + cmpl 4(%edx), %eax + ja ..B2.30 +..B2.28: + jne ..B2.31 +..B2.29: + movl 24(%ebp), %edx + movl (%ebx), %eax + cmpl (%edx), %eax + jbe ..B2.31 +..B2.30: + fldt 48(%esp) + movl 24(%ebp), %eax + fsub %st(2), %st + faddp %st, %st(1) + fldt 12(%eax) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B2.32 +..B2.31: + fldt 48(%esp) + fxch %st(1) + fsub %st(2), %st + movl 24(%ebp), %eax + faddp %st, %st(1) + faddp %st, %st(2) + fldt 12(%eax) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B2.32: + fldt 48(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 292(%esp) + fldt 292(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 304(%esp) + jmp ..B2.69 +..B2.33: + movl 4(%ebx), %eax + movl %eax, 32(%esp) +..B2.34: + cmpl $0, 32(%esp) + jne ..B2.36 +..B2.241: + cmpl $0, (%ebx) +..B2.35: + je ..B2.37 +..B2.36: + movl 64(%esp), %ecx + movl 40(%esp), %eax + lea -16517(%ecx,%eax), %eax + movl 60(%esp), %ecx + lea -16383(%ecx,%edx), %edx + cmpl %edx, %eax + jl ..B2.38 +..B2.37: + movl 24(%ebp), %eax + movl (%eax), %edx + movl 4(%eax), %ecx + movl 8(%eax), %ebx + movl %edx, 292(%esp) + movl %ecx, 296(%esp) + movl %ebx, 300(%esp) + movl 12(%eax), %edx + movl 16(%eax), %ecx + movl 20(%eax), %ebx + movl 24(%eax), %eax + movl %edx, 304(%esp) + movl %ecx, 308(%esp) + movl %ebx, 312(%esp) + movl %eax, 316(%esp) + jmp ..B2.69 +..B2.38: + movl (%ebx), %eax + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl %eax, 292(%esp) + movl %edx, 296(%esp) + movl %ecx, 300(%esp) + movl 12(%ebx), %eax + movl 16(%ebx), %edx + movl 20(%ebx), %ecx + movl 24(%ebx), %ebx + movl %eax, 304(%esp) + movl %edx, 308(%esp) + movl %ecx, 312(%esp) + movl %ebx, 316(%esp) + jmp ..B2.69 +..B2.39: + movl 92(%esp), %eax + movzwl 8(%ebx), %edx + movl %edx, 68(%esp) + andl $32767, %edx + fldt _CONSTANTS@GOTOFF(%eax) + cmpl $8383, %edx + movl $0, 316(%esp) + fstpt 292(%esp) + fldt 24+_CONSTANTS@GOTOFF(%eax) + fstpt 304(%esp) + jl ..B2.43 +..B2.40: + cmpl $24383, %edx + jg ..B2.43 +..B2.41: + movl 24(%ebp), %eax + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) + cmpl $8383, %ecx + jl ..B2.43 +..B2.42: + cmpl $24383, 40(%esp) + jle ..B2.46 +..B2.43: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B2.44: + addl $4, %esp + pushl 24(%ebp) + call __libm_normalizel_k80 +..B2.45: + movl 24(%ebp), %eax + movzwl 8(%ebx), %edx + movl %edx, 68(%esp) + andl $32767, %edx + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) +..B2.46: + movl 24(%ebp), %ecx + movl 24(%ecx), %eax + movl 40(%esp), %ecx + movl %eax, 64(%esp) + lea -134(%eax,%ecx), %eax + movl 24(%ebx), %ecx + movl %ecx, 60(%esp) + addl %edx, %ecx + movl %ecx, 36(%esp) + cmpl %ecx, %eax + jge ..B2.63 +..B2.47: + movl 4(%ebx), %eax + movl %eax, 32(%esp) + movl 64(%esp), %ecx + movl 40(%esp), %eax + lea 134(%ecx,%eax), %ecx + cmpl 36(%esp), %ecx + jle ..B2.64 +..B2.48: + cmpl $0, 32(%esp) + jne ..B2.50 +..B2.49: + cmpl $0, (%ebx) + je ..B2.65 +..B2.50: + movl 24(%ebp), %eax + cmpl $0, 4(%eax) + jne ..B2.52 +..B2.51: + movl 24(%ebp), %eax + cmpl $0, (%eax) + je ..B2.64 +..B2.52: + movl 64(%esp), %eax + cmpl 60(%esp), %eax + je ..B2.54 +..B2.53: + fldt 48(%esp) + movl 60(%esp), %eax + movl 64(%esp), %ecx + subl %ecx, %eax + fstpt 32(%esp) + addl $16383, %eax + fldt (%ebx) + andl $32767, %eax + fldt 12(%ebx) + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %ecx, 24(%ebx) + movl 24(%ebp), %ecx + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + movl 24(%ecx), %eax + fstpt 12(%ebx) + fldt 12(%ebx) + movl %eax, 64(%esp) + movzwl 8(%ebx), %edx + movzwl 8(%ecx), %eax + fstpt 48(%esp) + movl %edx, 68(%esp) + movl %eax, 44(%esp) + jmp ..B2.55 +..B2.54: + fldt (%ebx) + fldt 12(%ebx) + fstpt 48(%esp) +..B2.55: + movl 24(%ebp), %edx + fld %st(0) + movl 64(%esp), %eax + movl %eax, 288(%esp) + fldt (%edx) + movl 68(%esp), %ecx + fsubr %st, %st(1) + movl 44(%esp), %eax + andl $32767, %ecx + andl $32767, %eax + cmpl %eax, %ecx + jg ..B2.60 +..B2.56: + jne ..B2.61 +..B2.57: + movl 24(%ebp), %edx + movl 4(%ebx), %eax + cmpl 4(%edx), %eax + ja ..B2.60 +..B2.58: + jne ..B2.61 +..B2.59: + movl 24(%ebp), %edx + movl (%ebx), %eax + cmpl (%edx), %eax + jbe ..B2.61 +..B2.60: + fldt 48(%esp) + fxch %st(2) + fsubr %st, %st(3) + movl 24(%ebp), %eax + fxch %st(1) + fsubrp %st, %st(3) + fldt 12(%eax) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 48(%esp) + jmp ..B2.62 +..B2.61: + movl 24(%ebp), %eax + fadd %st(1), %st + fsubrp %st, %st(2) + fldt 48(%esp) + faddp %st, %st(2) + fldt 12(%eax) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B2.62: + fldt 48(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 264(%esp) + fldt 264(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 276(%esp) + jmp ..B2.69 +..B2.63: + movl 4(%ebx), %eax + movl %eax, 32(%esp) +..B2.64: + cmpl $0, 32(%esp) + jne ..B2.66 +..B2.240: + cmpl $0, (%ebx) +..B2.65: + je ..B2.67 +..B2.66: + movl 64(%esp), %eax + movl 40(%esp), %ecx + movl 60(%esp), %ebx + lea -16517(%eax,%ecx), %eax + lea -16383(%ebx,%edx), %edx + movl 40(%ebp), %ebx + cmpl %edx, %eax + jl ..B2.68 +..B2.67: + movl 24(%ebp), %edx + movl 64(%esp), %eax + movl %eax, 288(%esp) + fldt (%edx) + fchs + fstpt 264(%esp) + fldt 12(%edx) + fchs + fstpt 276(%esp) + jmp ..B2.69 +..B2.68: + movl (%ebx), %eax + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl %eax, 264(%esp) + movl %edx, 268(%esp) + movl %ecx, 272(%esp) + movl 12(%ebx), %eax + movl 16(%ebx), %edx + movl 20(%ebx), %ecx + movl 24(%ebx), %ebx + movl %eax, 276(%esp) + movl %edx, 280(%esp) + movl %ecx, 284(%esp) + movl %ebx, 288(%esp) +..B2.69: + movzwl 8(%esi), %eax + movl %eax, 68(%esp) + andl $32767, %eax + movl 24(%esi), %ecx + incl %ecx + movl %ecx, 24(%esi) + cmpl $8383, %eax + movl %eax, 76(%esp) + jl ..B2.73 +..B2.70: + cmpl $24383, 76(%esp) + jg ..B2.73 +..B2.71: + movzwl 8(%edi), %edx + movl %edx, %eax + andl $32767, %eax + movl %eax, 72(%esp) + cmpl $8383, %eax + jl ..B2.73 +..B2.72: + cmpl $24383, 72(%esp) + jle ..B2.76 +..B2.73: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B2.74: + addl $4, %esp + pushl %edi + call __libm_normalizel_k80 +..B2.75: + movzwl 8(%esi), %edx + movl %edx, 68(%esp) + andl $32767, %edx + movl %edx, 76(%esp) + movzwl 8(%edi), %edx + movl %edx, %eax + andl $32767, %eax + movl %eax, 72(%esp) + movl 24(%esi), %ecx +..B2.76: + movl 76(%esp), %ebx + movl 24(%edi), %edi + movl %edi, 64(%esp) + lea (%ecx,%ebx), %eax + movl 72(%esp), %ebx + movl %eax, 60(%esp) + lea -134(%edi,%ebx), %edi + cmpl %edi, %eax + movl 44(%ebp), %edi + jle ..B2.93 +..B2.77: + movl 4(%esi), %eax + movl %eax, 44(%esp) + movl 64(%esp), %ebx + movl 72(%esp), %eax + lea 134(%ebx,%eax), %ebx + cmpl 60(%esp), %ebx + jle ..B2.94 +..B2.78: + cmpl $0, 44(%esp) + jne ..B2.80 +..B2.79: + cmpl $0, (%esi) + je ..B2.95 +..B2.80: + cmpl $0, 4(%edi) + jne ..B2.82 +..B2.81: + cmpl $0, (%edi) + je ..B2.94 +..B2.82: + cmpl 64(%esp), %ecx + je ..B2.84 +..B2.83: + fldt 48(%esp) + movl 64(%esp), %edx + subl %edx, %ecx + fstpt 32(%esp) + addl $16383, %ecx + fldt (%esi) + andl $32767, %ecx + fldt 12(%esi) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %ecx, %eax + movl %edx, %ecx + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%esi) + fxch %st(2) + fstpt (%esi) + fldt (%esi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esi) + fldt 12(%esi) + movl 24(%edi), %ebx + movzwl 8(%esi), %eax + movl %ebx, 64(%esp) + movl %eax, 68(%esp) + movzwl 8(%edi), %edx + jmp ..B2.85 +..B2.84: + fldt (%esi) + fldt 12(%esi) +..B2.85: + fldt (%edi) + fld %st(2) + movl 64(%esp), %eax + fadd %st(1), %st + movl %eax, 344(%esp) + movl %edx, %eax + movl 68(%esp), %ebx + andl $32767, %eax + andl $32767, %ebx + cmpl %eax, %ebx + jg ..B2.90 +..B2.86: + jne ..B2.91 +..B2.87: + movl 4(%esi), %eax + cmpl 4(%edi), %eax + ja ..B2.90 +..B2.88: + jne ..B2.91 +..B2.89: + movl (%esi), %eax + cmpl (%edi), %eax + jbe ..B2.91 +..B2.90: + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 12(%edi) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + jmp ..B2.92 +..B2.91: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%edi) + faddp %st, %st(2) +..B2.92: + fld %st(1) + fadd %st(1), %st + fstpt 320(%esp) + fldt 320(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 332(%esp) + jmp ..B2.99 +..B2.93: + movl 4(%esi), %eax + movl %eax, 44(%esp) +..B2.94: + cmpl $0, 44(%esp) + jne ..B2.96 +..B2.242: + cmpl $0, (%esi) +..B2.95: + je ..B2.97 +..B2.96: + movl 64(%esp), %ebx + movl 72(%esp), %eax + lea -16517(%ebx,%eax), %eax + movl 76(%esp), %ebx + lea -16383(%ecx,%ebx), %ebx + cmpl %ebx, %eax + jl ..B2.98 +..B2.97: + movl (%edi), %eax + movl %eax, 320(%esp) + movl 4(%edi), %ebx + movl 8(%edi), %eax + movl %ebx, 324(%esp) + movl %eax, 328(%esp) + movl 12(%edi), %ebx + movl 16(%edi), %eax + movl %ebx, 332(%esp) + movl %eax, 336(%esp) + movl 20(%edi), %ebx + movl 24(%edi), %eax + movl %ebx, 340(%esp) + movl %eax, 344(%esp) + jmp ..B2.99 +..B2.98: + movl (%esi), %eax + movl %eax, 320(%esp) + movl 4(%esi), %ebx + movl 8(%esi), %eax + movl %ebx, 324(%esp) + movl %eax, 328(%esp) + movl 12(%esi), %ebx + movl 16(%esi), %eax + movl %ebx, 332(%esp) + movl %eax, 336(%esp) + movl 20(%esi), %ebx + movl 24(%esi), %eax + movl %ebx, 340(%esp) + movl %eax, 344(%esp) +..B2.99: + movzwl 328(%esp), %eax + decl %ecx + andl $32767, %eax + movl %ecx, 24(%esi) + cmpl $8383, %eax + jl ..B2.103 +..B2.100: + cmpl $24383, %eax + jg ..B2.103 +..B2.101: + movzwl 272(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.103 +..B2.102: + cmpl $24383, %eax + jle ..B2.105 +..B2.103: + addl $4, %esp + lea 316(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.104: + addl $4, %esp + lea 260(%esp), %eax + pushl %eax + call __libm_normalizel_k80 + movzwl 8(%edi), %edx +..B2.105: + fldt 320(%esp) + andl $32767, %edx + fld %st(0) + fld %st(1) + fldt 80(%esp) + fld %st(0) + fmul %st(4), %st + movl 344(%esp), %eax + fsubr %st, %st(3) + addl 288(%esp), %eax + faddp %st, %st(3) + fld %st(2) + cmpl $8383, %edx + movl %eax, 372(%esp) + fxch %st(2) + fsub %st(3), %st + fldt 264(%esp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 276(%esp) + fmulp %st, %st(4) + fldt 332(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 348(%esp) + fldt 348(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 360(%esp) + jl ..B2.109 +..B2.106: + cmpl $24383, %edx + jg ..B2.109 +..B2.107: + movzwl 300(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.109 +..B2.108: + cmpl $24383, %eax + jle ..B2.111 +..B2.109: + addl $4, %esp + pushl %edi + call __libm_normalizel_k80 +..B2.110: + addl $4, %esp + lea 288(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.111: + fldt (%edi) + fld %st(0) + fld %st(1) + fldt 80(%esp) + fld %st(0) + fmul %st(4), %st + movl 36(%ebp), %ebx + fsubr %st, %st(3) + movl 316(%esp), %eax + faddp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fldt 292(%esp) + fmul %st, %st(2) + fld %st(0) + addl 24(%edi), %eax + fsub %st(3), %st + movl 28(%ebp), %esi + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + movl %eax, 400(%esp) + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 304(%esp) + fmulp %st, %st(4) + fldt 12(%edi) + fmulp %st, %st(1) + movzwl 8(%ebx), %edi + movl %edi, %ecx + andl $32767, %ecx + faddp %st, %st(3) + cmpl $8383, %ecx + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 376(%esp) + fldt 376(%esp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 388(%esp) + fstpt 48(%esp) + jl ..B2.115 +..B2.112: + cmpl $24383, %ecx + jg ..B2.115 +..B2.113: + movzwl 8(%esi), %edx + movl %edx, 60(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B2.115 +..B2.114: + cmpl $24383, %edx + jle ..B2.118 +..B2.115: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B2.116: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B2.117: + movzwl 8(%ebx), %edi + movl %edi, %ecx + movzwl 8(%esi), %edx + andl $32767, %ecx + movl %edx, 60(%esp) + andl $32767, %edx +..B2.118: + movl 24(%esi), %eax + movl 24(%ebx), %ebx + movl %eax, 72(%esp) + movl %ebx, 68(%esp) + lea -134(%eax,%edx), %eax + addl %ecx, %ebx + movl %ebx, 64(%esp) + cmpl %eax, %ebx + movl 36(%ebp), %ebx + jle ..B2.135 +..B2.119: + movl 4(%ebx), %eax + movl %eax, 44(%esp) + movl 72(%esp), %eax + lea 134(%eax,%edx), %eax + cmpl 64(%esp), %eax + jle ..B2.136 +..B2.120: + cmpl $0, 44(%esp) + jne ..B2.122 +..B2.121: + cmpl $0, (%ebx) + je ..B2.137 +..B2.122: + cmpl $0, 4(%esi) + jne ..B2.124 +..B2.123: + cmpl $0, (%esi) + je ..B2.136 +..B2.124: + movl 72(%esp), %eax + cmpl 68(%esp), %eax + je ..B2.126 +..B2.125: + fldt 48(%esp) + movl 68(%esp), %edi + movl %eax, %edx + subl %edx, %edi + fstpt 32(%esp) + addl $16383, %edi + fldt (%ebx) + andl $32767, %edi + fldt 12(%ebx) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%ebx) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt 12(%ebx) + movl 24(%esi), %ecx + movzwl 8(%esi), %eax + movl %ecx, 72(%esp) + movzwl 8(%ebx), %edi + movl %eax, 60(%esp) + jmp ..B2.127 +..B2.126: + fldt (%ebx) + fldt 12(%ebx) +..B2.127: + fldt (%esi) + andl $32767, %edi + movl 60(%esp), %edx + fld %st(2) + andl $32767, %edx + fadd %st(1), %st + movl 72(%esp), %eax + cmpl %edx, %edi + movl %eax, 428(%esp) + jg ..B2.132 +..B2.128: + jne ..B2.133 +..B2.129: + movl 4(%ebx), %eax + cmpl 4(%esi), %eax + ja ..B2.132 +..B2.130: + jne ..B2.133 +..B2.131: + movl (%ebx), %eax + cmpl (%esi), %eax + jbe ..B2.133 +..B2.132: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 12(%esi) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.134 +..B2.133: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 12(%esi) + faddp %st, %st(1) +..B2.134: + fld %st(0) + fadd %st(2), %st + fstpt 404(%esp) + fldt 404(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 416(%esp) + jmp ..B2.141 +..B2.135: + movl 4(%ebx), %eax + movl %eax, 44(%esp) +..B2.136: + cmpl $0, 44(%esp) + jne ..B2.138 +..B2.243: + cmpl $0, (%ebx) +..B2.137: + je ..B2.139 +..B2.138: + movl 72(%esp), %eax + lea -16517(%eax,%edx), %edi + movl 68(%esp), %edx + lea -16383(%edx,%ecx), %ecx + cmpl %ecx, %edi + jl ..B2.140 +..B2.139: + movl (%esi), %eax + movl %eax, 404(%esp) + movl 4(%esi), %edx + movl 8(%esi), %ecx + movl 12(%esi), %ebx + movl 16(%esi), %edi + movl 20(%esi), %eax + movl 24(%esi), %esi + movl %edx, 408(%esp) + movl %ecx, 412(%esp) + movl %ebx, 416(%esp) + movl %edi, 420(%esp) + movl %eax, 424(%esp) + movl %esi, 428(%esp) + jmp ..B2.141 +..B2.140: + movl (%ebx), %eax + movl %eax, 404(%esp) + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl 12(%ebx), %esi + movl 16(%ebx), %edi + movl 20(%ebx), %eax + movl 24(%ebx), %ebx + movl %edx, 408(%esp) + movl %ecx, 412(%esp) + movl %esi, 416(%esp) + movl %edi, 420(%esp) + movl %eax, 424(%esp) + movl %ebx, 428(%esp) +..B2.141: + movzwl 384(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.145 +..B2.142: + cmpl $24383, %eax + jg ..B2.145 +..B2.143: + movzwl 412(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.145 +..B2.144: + cmpl $24383, %eax + jle ..B2.147 +..B2.145: + addl $4, %esp + lea 372(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.146: + addl $4, %esp + lea 400(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.147: + fldt 376(%esp) + fld %st(0) + fld %st(1) + fldt 80(%esp) + fld %st(0) + fmul %st(4), %st + movl 400(%esp), %edx + fsubr %st, %st(3) + movzwl 356(%esp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + addl 428(%esp), %edx + fxch %st(2) + fsub %st(3), %st + fldt 404(%esp) + cmpl $8383, %eax + fmul %st, %st(2) + fld %st(0) + movl %edx, 456(%esp) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 416(%esp) + fmulp %st, %st(4) + fldt 388(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 432(%esp) + fldt 432(%esp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 444(%esp) + fldt 444(%esp) + jl ..B2.151 +..B2.148: + cmpl $24383, %eax + jg ..B2.151 +..B2.149: + movzwl 440(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.151 +..B2.150: + cmpl $24383, %eax + jle ..B2.154 +..B2.151: + fstp %st(1) + fstp %st(0) + addl $4, %esp + lea 344(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.152: + addl $4, %esp + lea 428(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.153: + fldt 432(%esp) + fldt 444(%esp) + movl 456(%esp), %edx +..B2.154: + fldt 348(%esp) + fld %st(2) + fdivr %st(1), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(4) + fstpt 64(%esp) + fldt 64(%esp) + fldt 80(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movl 372(%esp), %eax + fsubr %st(4), %st + subl %edx, %eax + faddp %st, %st(1) + fld %st(0) + movl 8(%ebp), %edx + fsubr %st(4), %st + fxch %st(2) + fmul %st(3), %st + movzbl 9(%edx), %ecx + testl $128, %ecx + fsubr %st, %st(7) + faddp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fld %st(2) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fxch %st(4) + fsubrp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fldt 360(%esp) + faddp %st, %st(1) + fsubp %st, %st(1) + fldt 64(%esp) + fdivrp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fstpt 48(%esp) + jne ..B2.163 +..B2.155: + fstpt 32(%esp) + fldt 32(%esp) + decl %eax + movzwl 40(%esp), %edx + andl $32767, %edx + movl %eax, 56(%esp) + cmpl $383, %edx + fxch %st(1) + fstpt 44(%esp) + fldt 44(%esp) + jl ..B2.157 +..B2.156: + cmpl $32383, %edx + jle ..B2.159 +..B2.157: + fstp %st(0) + fstp %st(0) + addl $4, %esp + lea 28(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.158: + fldt 32(%esp) + fldt 44(%esp) + movl 56(%esp), %eax +..B2.159: + testb $1, %al + jne ..B2.234 +..B2.160: + movl 92(%esp), %edx + fldt 48+_CONSTANTS@GOTOFF(%edx) +..B2.161: + fldt 80(%esp) + fld %st(3) + fsqrt + lea 236(%esp), %edx + fmul %st, %st(1) + fld %st(1) + sarl $1, %eax + fsubr %st(1), %st + movl %eax, 24(%edx) + lea 208(%esp), %eax + faddp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + fdivr %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 28(%eax) + fldt 28(%eax) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 40(%eax) + call asinpoly +..B2.162: + fldt 208(%esp) + fldt 220(%esp) + movl 232(%esp), %eax + incl %eax + movl %eax, 232(%esp) + jmp ..B2.231 +..B2.163: + fstpt 124(%esp) + fldt 124(%esp) + decl %eax + movzwl 132(%esp), %edx + andl $32767, %edx + movl %eax, 148(%esp) + cmpl $383, %edx + fxch %st(1) + fstpt 136(%esp) + fldt 136(%esp) + jl ..B2.165 +..B2.164: + cmpl $32383, %edx + jle ..B2.167 +..B2.165: + fstp %st(0) + fstp %st(0) + addl $4, %esp + lea 120(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.166: + fldt 124(%esp) + fldt 136(%esp) + movl 148(%esp), %eax +..B2.167: + testb $1, %al + jne ..B2.235 +..B2.168: + movl 92(%esp), %edx + fldt 48+_CONSTANTS@GOTOFF(%edx) +..B2.169: + fldt 80(%esp) + fld %st(3) + fsqrt + lea 152(%esp), %edx + fmul %st, %st(1) + fld %st(1) + sarl $1, %eax + fsubr %st(1), %st + movl %eax, 24(%edx) + lea 96(%esp), %eax + faddp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + fdivr %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 56(%eax) + fldt 56(%eax) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 68(%eax) + call asinpoly +..B2.170: + movl 92(%esp), %edx + movl $1, %esi + movl 120(%esp), %eax + incl %eax + fldt 60+_CONSTANTS@GOTOFF(%edx) + movzwl 68+_CONSTANTS@GOTOFF(%edx), %edi + andl $32767, %edi + movl %eax, 120(%esp) + cmpl $8383, %edi + movl %esi, 204(%esp) + fstpt 180(%esp) + fldt 72+_CONSTANTS@GOTOFF(%edx) + fstpt 192(%esp) + jl ..B2.174 +..B2.171: + cmpl $24383, %edi + jg ..B2.174 +..B2.172: + movzwl 104(%esp), %ebx + andl $32767, %ebx + cmpl $8383, %ebx + jl ..B2.174 +..B2.173: + cmpl $24383, %ebx + jle ..B2.177 +..B2.174: + addl $4, %esp + lea 176(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.175: + addl $4, %esp + lea 92(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.176: + movzwl 188(%esp), %edi + movzwl 104(%esp), %ebx + andl $32767, %edi + movl 120(%esp), %eax + andl $32767, %ebx + movl 204(%esp), %esi +..B2.177: + lea (%esi,%edi), %edx + movl %edx, 44(%esp) + lea -134(%eax,%ebx), %ecx + cmpl %ecx, %edx + jle ..B2.194 +..B2.178: + movl 184(%esp), %ecx + lea 134(%eax,%ebx), %edx + cmpl 44(%esp), %edx + jle ..B2.195 +..B2.179: + testl %ecx, %ecx + jne ..B2.181 +..B2.180: + cmpl $0, 180(%esp) + je ..B2.196 +..B2.181: + movl 100(%esp), %edx + testl %edx, %edx + jne ..B2.183 +..B2.182: + cmpl $0, 96(%esp) + je ..B2.195 +..B2.183: + cmpl %eax, %esi + je ..B2.185 +..B2.184: + fldt 48(%esp) + subl %eax, %esi + fstpt 32(%esp) + addl $16383, %esi + fldt 180(%esp) + andl $32767, %esi + fldt 192(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %esi, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 180(%esp) + fldt 180(%esp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 188(%esp), %edi + movl %eax, 204(%esp) + andl $32767, %edi + fstpt 192(%esp) + fldt 192(%esp) + jmp ..B2.186 +..B2.185: + fldt 180(%esp) + fldt 192(%esp) +..B2.186: + fldt 96(%esp) + fld %st(2) + movl %eax, 232(%esp) + cmpl %ebx, %edi + fsub %st(1), %st + jg ..B2.191 +..B2.187: + jne ..B2.192 +..B2.188: + movl 184(%esp), %ecx + cmpl %edx, %ecx + ja ..B2.191 +..B2.189: + jne ..B2.192 +..B2.190: + movl 180(%esp), %edx + cmpl 96(%esp), %edx + jbe ..B2.192 +..B2.191: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 108(%esp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B2.193 +..B2.192: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 108(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B2.193: + fld %st(0) + fadd %st(2), %st + fstpt 208(%esp) + fldt 208(%esp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 220(%esp) + fldt 220(%esp) + jmp ..B2.231 +..B2.194: + movl 184(%esp), %ecx +..B2.195: + testl %ecx, %ecx + jne ..B2.197 +..B2.244: + cmpl $0, 180(%esp) +..B2.196: + je ..B2.198 +..B2.197: + lea -16517(%eax,%ebx), %edx + lea -16383(%esi,%edi), %ebx + cmpl %ebx, %edx + jl ..B2.199 +..B2.198: + fldt 96(%esp) + fchs + movl %eax, 232(%esp) + fstpt 208(%esp) + fldt 208(%esp) + fldt 108(%esp) + fchs + fstpt 220(%esp) + fldt 220(%esp) + jmp ..B2.231 +..B2.199: + movl 180(%esp), %eax + movl %ecx, 212(%esp) + movl 188(%esp), %edx + movl 192(%esp), %ecx + movl 196(%esp), %ebx + movl 200(%esp), %esi + movl %eax, 208(%esp) + movl %edx, 216(%esp) + fldt 208(%esp) + movl 204(%esp), %eax + movl %ecx, 220(%esp) + movl %ebx, 224(%esp) + movl %esi, 228(%esp) + fldt 220(%esp) + movl %eax, 232(%esp) + jmp ..B2.231 +..B2.200: + movl 92(%esp), %eax + lea 460(%esp), %edx + movl $0, 84(%esp) + fldt 60+_CONSTANTS@GOTOFF(%eax) + fstpt 60(%esp) + fldt 72+_CONSTANTS@GOTOFF(%eax) + lea 96(%esp), %eax + fstpt -24(%eax) + call asinpoly +..B2.201: + fldt 96(%esp) + fldt 108(%esp) + movl 8(%ebp), %eax + movl 92(%esp), %esi + movzwl 68(%esp), %edi + movzbl 9(%eax), %ecx + andl $32767, %edi + andl $128, %ecx + shrl $7, %ecx + cmpl $8383, %edi + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %ebx + fldt _CONSTANTS@GOTOFF(%ebx,%esi) + fmul %st, %st(2) + fxch %st(2) + fstpt 96(%esp) + fmulp %st, %st(1) + fstpt 108(%esp) + jl ..B2.205 +..B2.202: + cmpl $24383, %edi + jg ..B2.205 +..B2.203: + movzwl 104(%esp), %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B2.205 +..B2.204: + cmpl $24383, %esi + jle ..B2.208 +..B2.205: + addl $4, %esp + lea 56(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.206: + addl $4, %esp + lea 92(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B2.207: + movzwl 104(%esp), %esi + movzwl 68(%esp), %edi + andl $32767, %esi + andl $32767, %edi +..B2.208: + movl 120(%esp), %eax + movl 84(%esp), %ebx + lea -134(%eax,%esi), %ecx + lea (%edi,%ebx), %edx + movl %edx, 32(%esp) + cmpl %ecx, %edx + jle ..B2.225 +..B2.209: + movl 64(%esp), %ecx + lea 134(%eax,%esi), %edx + cmpl 32(%esp), %edx + jle ..B2.226 +..B2.210: + testl %ecx, %ecx + jne ..B2.212 +..B2.211: + cmpl $0, 60(%esp) + je ..B2.227 +..B2.212: + movl 100(%esp), %edx + testl %edx, %edx + jne ..B2.214 +..B2.213: + cmpl $0, 96(%esp) + je ..B2.226 +..B2.214: + cmpl %eax, %ebx + je ..B2.216 +..B2.215: + fldt 48(%esp) + subl %eax, %ebx + fstpt 32(%esp) + addl $16383, %ebx + fldt 60(%esp) + andl $32767, %ebx + fldt 72(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %ecx + andl $-32768, %ecx + orl %ebx, %ecx + movw %cx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 60(%esp) + fldt 60(%esp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 68(%esp), %edi + movl %eax, 84(%esp) + andl $32767, %edi + fstpt 72(%esp) + fldt 72(%esp) + jmp ..B2.217 +..B2.216: + fldt 60(%esp) + fldt 72(%esp) +..B2.217: + fldt 96(%esp) + fld %st(2) + movl %eax, 232(%esp) + cmpl %esi, %edi + fsub %st(1), %st + jg ..B2.222 +..B2.218: + jne ..B2.223 +..B2.219: + movl 64(%esp), %ecx + cmpl %edx, %ecx + ja ..B2.222 +..B2.220: + jne ..B2.223 +..B2.221: + movl 60(%esp), %edx + cmpl 96(%esp), %edx + jbe ..B2.223 +..B2.222: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 108(%esp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B2.224 +..B2.223: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 108(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B2.224: + fld %st(0) + fadd %st(2), %st + fstpt 208(%esp) + fldt 208(%esp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 220(%esp) + fldt 220(%esp) + jmp ..B2.231 +..B2.225: + movl 64(%esp), %ecx +..B2.226: + testl %ecx, %ecx + jne ..B2.228 +..B2.245: + cmpl $0, 60(%esp) +..B2.227: + je ..B2.198 +..B2.228: + lea -16517(%eax,%esi), %edx + lea -16383(%ebx,%edi), %esi + cmpl %esi, %edx + jge ..B2.198 +..B2.230: + movl %ecx, 212(%esp) + movl 60(%esp), %eax + movl 68(%esp), %edx + movl 72(%esp), %ecx + movl 76(%esp), %esi + movl 80(%esp), %edi + movl %eax, 208(%esp) + movl %ebx, %eax + movl %edx, 216(%esp) + fldt 208(%esp) + movl %ecx, 220(%esp) + movl %esi, 224(%esp) + movl %edi, 228(%esp) + fldt 220(%esp) + movl %eax, 232(%esp) +..B2.231: + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %eax, 24(%esp) + call __libm_scalbl_k80 +..B2.232: + movl 488(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B2.236 +..B2.233: + addl $500, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.234: + movl 92(%esp), %edx + incl %eax + movl %eax, 56(%esp) + fldt 48+_CONSTANTS@GOTOFF(%edx) + fmul %st, %st(2) + fxch %st(2) + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fmul %st(2), %st + fstpt 44(%esp) + fldt 44(%esp) + fxch %st(1) + fxch %st(2) + jmp ..B2.161 +..B2.235: + movl 92(%esp), %edx + incl %eax + movl %eax, 148(%esp) + fldt 48+_CONSTANTS@GOTOFF(%edx) + fmul %st, %st(2) + fxch %st(2) + fstpt 124(%esp) + fldt 124(%esp) + fxch %st(1) + fmul %st(2), %st + fstpt 136(%esp) + fldt 136(%esp) + fxch %st(1) + fxch %st(2) + jmp ..B2.169 +..B2.236: + fstp %st(0) + movl 92(%esp), %ebx + call __stack_chk_fail@PLT + .align 16,0x90 + .type __libm_recacosl_k80,@function + .size __libm_recacosl_k80,.-__libm_recacosl_k80 + .data +# -- End __libm_recacosl_k80 + .text +# -- Begin asinpoly + .text + .align 16,0x90 +asinpoly: +# parameter 1: %eax +# parameter 2: %edx +..B3.1: +..L5: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $164, %esp + movl %edx, %esi + call ..L6 +..L6: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L6](%ecx), %ecx + movl %eax, %ebx + movl 24(%esi), %edx + fldt _CONSTANTS@GOTOFF(%ecx) + movzwl 8+_CONSTANTS@GOTOFF(%ecx), %eax + andl $-32768, %eax + lea 16383(%edx), %edi + andl $32767, %edi + orl %edi, %eax + movzwl 8(%esi), %edi + andl $32767, %edi + addl %edi, %edx + fstpt 136(%esp) + cmpl $16343, %edx + jl ..B3.38 +..B3.2: + fldt (%esi) + fldt 12(%esi) + fldt 264+_CONSTANTS@GOTOFF(%ecx) + fldt 240+_CONSTANTS@GOTOFF(%ecx) + fldt 216+_CONSTANTS@GOTOFF(%ecx) + movw %ax, 144(%esp) + fldt 136(%esp) + fmul %st, %st(5) + fld %st(5) + fmul %st(6), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fmulp %st, %st(6) + fxch %st(5) + fstpt 40(%esp) + fldt 40(%esp) + fxch %st(6) + fstpt 104(%esp) + fldt 104(%esp) + fstpt (%esp) + fldt (%esp) + fldt 288+_CONSTANTS@GOTOFF(%ecx) + fmul %st(2), %st + faddp %st, %st(5) + fxch %st(1) + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 192+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 168+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 144+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 276+_CONSTANTS@GOTOFF(%ecx) + fmul %st(1), %st + fldt 252+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 228+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 204+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 180+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 156+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 132+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fld %st(1) + fldt 36+_CONSTANTS@GOTOFF(%ecx) + fstpt 72(%esp) + fldt 72(%esp) + fmul %st(3), %st + movzwl 20(%esp), %eax + fsubr %st, %st(1) + andl $32767, %eax + faddp %st, %st(1) + fld %st(0) + cmpl $16377, %eax + fsubr %st(3), %st + fstpt 56(%esp) + fldt 56(%esp) + fld %st(1) + fmul %st(2), %st + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + fadd %st(0), %st + fxch %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fmul %st(3), %st + fadd %st(0), %st + fld %st(0) + fadd %st(5), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(6) + fxch %st(2) + faddp %st, %st(6) + fxch %st(4) + fmul %st(0), %st + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 88(%esp) + fldt 88(%esp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 120(%esp) + fldt 120+_CONSTANTS@GOTOFF(%ecx) + fld %st(0) + fadd %st(2), %st + jg ..B3.7 +..B3.3: + jne ..B3.8 +..B3.4: + movl 16(%esp), %eax + cmpl 124+_CONSTANTS@GOTOFF(%ecx), %eax + ja ..B3.7 +..B3.5: + jne ..B3.8 +..B3.6: + movl 12(%esp), %eax + cmpl 120+_CONSTANTS@GOTOFF(%ecx), %eax + jbe ..B3.8 +..B3.7: + fldt 336+_CONSTANTS@GOTOFF(%ecx) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 24+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + jmp ..B3.9 +..B3.8: + fldt 24+_CONSTANTS@GOTOFF(%ecx) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 336+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) +..B3.9: + fldt 88(%esp) + fld %st(0) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fsubr %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fxch %st(3) + fmul %st, %st(5) + fldt 72(%esp) + fld %st(0) + fmul %st(6), %st + fsubr %st, %st(5) + faddp %st, %st(5) + fxch %st(2) + fsub %st(4), %st + fld %st(1) + fmulp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fstpt 136(%esp) + fldt 136(%esp) + fsubr %st, %st(2) + fxch %st(2) + fstpt 152(%esp) + fldt 152(%esp) + fld %st(3) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(4) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt 120(%esp) + fmulp %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fldt 152(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubr %st, %st(2) + movzwl 20(%esp), %eax + fxch %st(1) + faddp %st, %st(2) + fldt 108+_CONSTANTS@GOTOFF(%ecx) + andl $32767, %eax + fld %st(0) + cmpl $16378, %eax + fadd %st(2), %st + jg ..B3.14 +..B3.10: + jne ..B3.15 +..B3.11: + movl 16(%esp), %eax + cmpl 112+_CONSTANTS@GOTOFF(%ecx), %eax + ja ..B3.14 +..B3.12: + jne ..B3.15 +..B3.13: + movl 12(%esp), %eax + cmpl 108+_CONSTANTS@GOTOFF(%ecx), %eax + jbe ..B3.15 +..B3.14: + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 324+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + jmp ..B3.16 +..B3.15: + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt 324+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(2) +..B3.16: + fldt 136(%esp) + fld %st(0) + fld %st(3) + fadd %st(3), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fsubr %st, %st(5) + fxch %st(6) + faddp %st, %st(5) + fldt 72(%esp) + fmul %st(6), %st + fsubr %st, %st(1) + faddp %st, %st(1) + fmul %st, %st(2) + fsubr %st, %st(1) + fxch %st(1) + fmul %st, %st(3) + fldt 152(%esp) + fmul %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 120(%esp) + fmulp %st, %st(5) + fldt 88(%esp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubr %st, %st(1) + movzwl 20(%esp), %eax + fxch %st(2) + faddp %st, %st(1) + fldt 96+_CONSTANTS@GOTOFF(%ecx) + andl $32767, %eax + fld %st(0) + cmpl $16379, %eax + fadd %st(3), %st + jg ..B3.21 +..B3.17: + jne ..B3.22 +..B3.18: + movl 16(%esp), %eax + cmpl 100+_CONSTANTS@GOTOFF(%ecx), %eax + ja ..B3.21 +..B3.19: + jne ..B3.22 +..B3.20: + movl 12(%esp), %eax + cmpl 96+_CONSTANTS@GOTOFF(%ecx), %eax + jbe ..B3.22 +..B3.21: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 312+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + jmp ..B3.23 +..B3.22: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 312+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(1) +..B3.23: + fldt 136(%esp) + fld %st(0) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fsubr %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fldt 72(%esp) + fmul %st(5), %st + fsubr %st, %st(1) + faddp %st, %st(1) + fmul %st, %st(2) + fsubr %st, %st(1) + fxch %st(1) + fmul %st, %st(3) + fldt 152(%esp) + fmul %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 120(%esp) + fmulp %st, %st(3) + fldt 88(%esp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubr %st, %st(2) + movzwl 20(%esp), %eax + fxch %st(1) + faddp %st, %st(2) + fldt 84+_CONSTANTS@GOTOFF(%ecx) + andl $32767, %eax + fld %st(0) + cmpl $16380, %eax + fadd %st(2), %st + jg ..B3.28 +..B3.24: + jne ..B3.29 +..B3.25: + movl 16(%esp), %eax + cmpl 88+_CONSTANTS@GOTOFF(%ecx), %eax + ja ..B3.28 +..B3.26: + jne ..B3.29 +..B3.27: + movl 12(%esp), %eax + cmpl 84+_CONSTANTS@GOTOFF(%ecx), %eax + jbe ..B3.29 +..B3.28: + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 300+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + jmp ..B3.30 +..B3.29: + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt 300+_CONSTANTS@GOTOFF(%ecx) + faddp %st, %st(2) +..B3.30: + fldt 72(%esp) + fld %st(2) + movzwl 8(%esp), %edx + fadd %st(2), %st + fmul %st, %st(1) + fld %st(0) + andl $32767, %edx + fsub %st(2), %st + faddp %st, %st(2) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(2) + fsub %st(1), %st + fldt 136(%esp) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(2), %st + fldt 152(%esp) + fmul %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 120(%esp) + fmulp %st, %st(5) + fldt 88(%esp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(2) + fldt 72(%esp) + fmul %st(4), %st + fsubr %st, %st(1) + faddp %st, %st(1) + fsubr %st, %st(1) + fldt 24(%esp) + fld %st(0) + fmul %st(2), %st + fxch %st(1) + fmul %st(3), %st + fldt 56(%esp) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(0) + fldt 40(%esp) + fmulp %st, %st(5) + fldt 104(%esp) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fadd %st(3), %st + fstpt 12(%esp) + fldt 12(%esp) + fsubr %st, %st(1) + movzwl 20(%esp), %eax + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fadd %st(2), %st + andl $32767, %eax + cmpl %edx, %eax + jg ..B3.35 +..B3.31: + jne ..B3.36 +..B3.32: + movl 16(%esp), %eax + movl 4(%esp), %edx + cmpl %edx, %eax + ja ..B3.35 +..B3.33: + jne ..B3.36 +..B3.34: + movl 12(%esp), %eax + cmpl (%esp), %eax + jbe ..B3.36 +..B3.35: + fldt 104(%esp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 40(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B3.37 +..B3.36: + fldt 104(%esp) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 40(%esp) + faddp %st, %st(2) +..B3.37: + fld %st(1) + movl $0, 24(%ebx) + fadd %st(1), %st + fstpt (%ebx) + fldt (%ebx) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 12(%ebx) + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B3.38: + movl (%esi), %eax + movl 4(%esi), %edx + movl %eax, (%ebx) + movl %edx, 4(%ebx) + movl 8(%esi), %ecx + movl 12(%esi), %edi + movl 16(%esi), %eax + movl 20(%esi), %edx + movl 24(%esi), %esi + movl %ecx, 8(%ebx) + movl %edi, 12(%ebx) + movl %eax, 16(%ebx) + movl %edx, 20(%ebx) + movl %esi, 24(%ebx) +..B3.39: + addl $164, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type asinpoly,@function + .size asinpoly,.-asinpoly + .data +# -- End asinpoly + .text +# -- Begin __libm_recasinl_k80 + .text + .align 16,0x90 + .hidden __libm_recasinl_k80 + .globl __libm_recasinl_k80 +__libm_recasinl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +# parameter 4: 20 + %ebp +# parameter 5: 24 + %ebp +# parameter 6: 28 + %ebp +# parameter 7: 32 + %ebp +# parameter 8: 36 + %ebp +# parameter 9: 40 + %ebp +# parameter 10: 44 + %ebp +..B4.1: +..L7: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $436, %esp + movl 16(%ebp), %esi + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 432(%esp) + movzwl 8(%esi), %eax + andl $32767, %eax + movl 44(%ebp), %edi + cmpl $8383, %eax + jl ..B4.5 +..B4.2: + cmpl $24383, %eax + jg ..B4.5 +..B4.3: + movzwl 8(%edi), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.5 +..B4.4: + cmpl $24383, %eax + jle ..B4.7 +..B4.5: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B4.6: + addl $4, %esp + pushl %edi + call __libm_normalizel_k80 +..B4.7: + fldt (%esi) + fld %st(0) + fldt (%edi) + fdivr %st, %st(1) + fld %st(0) + call ..L8 +..L8: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L8](%eax), %eax + fld %st(1) + movl 24(%esi), %ebx + subl 24(%edi), %ebx + fldt 36+_CONSTANTS@GOTOFF(%eax) + fld %st(0) + fmul %st(5), %st + lea 1(%ebx), %edx + fld %st(0) + movl %eax, 92(%esp) + fsubr %st(6), %st + movl %edx, 428(%esp) + faddp %st, %st(1) + fld %st(0) + fsubr %st(6), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(4) + fld %st(4) + fsub %st(4), %st + fxch %st(3) + fstpt 80(%esp) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fldt 12(%esi) + faddp %st, %st(3) + fldt 12(%edi) + fmul %st(2), %st + fsubrp %st, %st(3) + fdivrp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 404(%esp) + fldt 404(%esp) + fsubrp %st, %st(1) + movzwl 412(%esp), %ecx + fadd %st(1), %st + andl $32767, %ecx + fstpt 416(%esp) + fstpt 48(%esp) + lea 1(%ecx,%ebx), %eax + cmpl $16382, %eax + jl ..B4.191 +..B4.8: + movl 8(%ebp), %eax + movl 40(%ebp), %ebx + movzwl 8(%eax), %edx + andl $32767, %edx + cmpl $16383, %edx + jl ..B4.39 +..B4.9: + movl 32(%ebp), %eax + movl (%eax), %edx + movl %edx, 96(%esp) + movl 8(%eax), %edx + movl 4(%eax), %ecx + movl %edx, 104(%esp) + movl 16(%eax), %edx + movl %ecx, 100(%esp) + movl 12(%eax), %ecx + movl %edx, 112(%esp) + movzwl 8(%ebx), %edx + movl %ecx, 108(%esp) + movl 20(%eax), %ecx + movl %edx, 68(%esp) + andl $32767, %edx + movl 24(%eax), %eax + cmpl $8383, %edx + movl %ecx, 116(%esp) + movl %eax, 120(%esp) + jl ..B4.13 +..B4.10: + cmpl $24383, %edx + jg ..B4.13 +..B4.11: + movl 24(%ebp), %eax + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) + cmpl $8383, %ecx + jl ..B4.13 +..B4.12: + cmpl $24383, 40(%esp) + jle ..B4.16 +..B4.13: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B4.14: + addl $4, %esp + pushl 24(%ebp) + call __libm_normalizel_k80 +..B4.15: + movl 24(%ebp), %eax + movzwl 8(%ebx), %edx + movl %edx, 68(%esp) + andl $32767, %edx + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) +..B4.16: + movl 24(%ebp), %ecx + movl 24(%ecx), %eax + movl 40(%esp), %ecx + movl %eax, 64(%esp) + lea -134(%eax,%ecx), %eax + movl 24(%ebx), %ecx + movl %ecx, 60(%esp) + addl %edx, %ecx + movl %ecx, 36(%esp) + cmpl %ecx, %eax + jge ..B4.33 +..B4.17: + movl 4(%ebx), %eax + movl %eax, 32(%esp) + movl 64(%esp), %ecx + movl 40(%esp), %eax + lea 134(%ecx,%eax), %ecx + cmpl 36(%esp), %ecx + jle ..B4.34 +..B4.18: + cmpl $0, 32(%esp) + jne ..B4.20 +..B4.19: + cmpl $0, (%ebx) + je ..B4.35 +..B4.20: + movl 24(%ebp), %eax + cmpl $0, 4(%eax) + jne ..B4.22 +..B4.21: + movl 24(%ebp), %eax + cmpl $0, (%eax) + je ..B4.34 +..B4.22: + movl 64(%esp), %eax + cmpl 60(%esp), %eax + je ..B4.24 +..B4.23: + fldt 48(%esp) + movl 60(%esp), %eax + movl 64(%esp), %ecx + subl %ecx, %eax + fstpt 32(%esp) + addl $16383, %eax + fldt (%ebx) + andl $32767, %eax + fldt 12(%ebx) + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %ecx, 24(%ebx) + movl 24(%ebp), %ecx + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fstpt 48(%esp) + fmulp %st, %st(1) + movl 24(%ecx), %eax + fstpt 12(%ebx) + fldt 12(%ebx) + movl %eax, 64(%esp) + movzwl 8(%ebx), %edx + movzwl 8(%ecx), %eax + movl %edx, 68(%esp) + movl %eax, 44(%esp) + jmp ..B4.25 +..B4.24: + fldt (%ebx) + fstpt 48(%esp) + fldt 12(%ebx) +..B4.25: + fldt 48(%esp) + movl 24(%ebp), %edx + movl 64(%esp), %eax + movl %eax, 148(%esp) + fldt (%edx) + movl 68(%esp), %ecx + fadd %st, %st(1) + movl 44(%esp), %eax + andl $32767, %ecx + andl $32767, %eax + cmpl %eax, %ecx + jg ..B4.30 +..B4.26: + jne ..B4.31 +..B4.27: + movl 24(%ebp), %edx + movl 4(%ebx), %eax + cmpl 4(%edx), %eax + ja ..B4.30 +..B4.28: + jne ..B4.31 +..B4.29: + movl 24(%ebp), %edx + movl (%ebx), %eax + cmpl (%edx), %eax + jbe ..B4.31 +..B4.30: + fldt 48(%esp) + movl 24(%ebp), %eax + fsub %st(2), %st + faddp %st, %st(1) + fldt 12(%eax) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + jmp ..B4.32 +..B4.31: + fldt 48(%esp) + fxch %st(1) + fsub %st(2), %st + movl 24(%ebp), %eax + faddp %st, %st(1) + faddp %st, %st(2) + fldt 12(%eax) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B4.32: + fldt 48(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 124(%esp) + fldt 124(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 136(%esp) + jmp ..B4.69 +..B4.33: + movl 4(%ebx), %eax + movl %eax, 32(%esp) +..B4.34: + cmpl $0, 32(%esp) + jne ..B4.36 +..B4.202: + cmpl $0, (%ebx) +..B4.35: + je ..B4.37 +..B4.36: + movl 64(%esp), %ecx + movl 40(%esp), %eax + lea -16517(%ecx,%eax), %eax + movl 60(%esp), %ecx + lea -16383(%ecx,%edx), %edx + cmpl %edx, %eax + jl ..B4.38 +..B4.37: + movl 24(%ebp), %eax + movl (%eax), %edx + movl 4(%eax), %ecx + movl 8(%eax), %ebx + movl %edx, 124(%esp) + movl %ecx, 128(%esp) + movl %ebx, 132(%esp) + movl 12(%eax), %edx + movl 16(%eax), %ecx + movl 20(%eax), %ebx + movl 24(%eax), %eax + movl %edx, 136(%esp) + movl %ecx, 140(%esp) + movl %ebx, 144(%esp) + movl %eax, 148(%esp) + jmp ..B4.69 +..B4.38: + movl (%ebx), %eax + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl %eax, 124(%esp) + movl %edx, 128(%esp) + movl %ecx, 132(%esp) + movl 12(%ebx), %eax + movl 16(%ebx), %edx + movl 20(%ebx), %ecx + movl 24(%ebx), %ebx + movl %eax, 136(%esp) + movl %edx, 140(%esp) + movl %ecx, 144(%esp) + movl %ebx, 148(%esp) + jmp ..B4.69 +..B4.39: + movl 92(%esp), %eax + movzwl 8(%ebx), %edx + movl %edx, 68(%esp) + andl $32767, %edx + fldt _CONSTANTS@GOTOFF(%eax) + cmpl $8383, %edx + movl $0, 148(%esp) + fstpt 124(%esp) + fldt 24+_CONSTANTS@GOTOFF(%eax) + fstpt 136(%esp) + jl ..B4.43 +..B4.40: + cmpl $24383, %edx + jg ..B4.43 +..B4.41: + movl 24(%ebp), %eax + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) + cmpl $8383, %ecx + jl ..B4.43 +..B4.42: + cmpl $24383, 40(%esp) + jle ..B4.46 +..B4.43: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B4.44: + addl $4, %esp + pushl 24(%ebp) + call __libm_normalizel_k80 +..B4.45: + movl 24(%ebp), %eax + movzwl 8(%ebx), %edx + movl %edx, 68(%esp) + andl $32767, %edx + movzwl 8(%eax), %ecx + movl %ecx, 44(%esp) + andl $32767, %ecx + movl %ecx, 40(%esp) +..B4.46: + movl 24(%ebp), %ecx + movl 24(%ecx), %eax + movl 40(%esp), %ecx + movl %eax, 64(%esp) + lea -134(%eax,%ecx), %eax + movl 24(%ebx), %ecx + movl %ecx, 60(%esp) + addl %edx, %ecx + movl %ecx, 36(%esp) + cmpl %ecx, %eax + jge ..B4.63 +..B4.47: + movl 4(%ebx), %eax + movl %eax, 32(%esp) + movl 64(%esp), %ecx + movl 40(%esp), %eax + lea 134(%ecx,%eax), %ecx + cmpl 36(%esp), %ecx + jle ..B4.64 +..B4.48: + cmpl $0, 32(%esp) + jne ..B4.50 +..B4.49: + cmpl $0, (%ebx) + je ..B4.65 +..B4.50: + movl 24(%ebp), %eax + cmpl $0, 4(%eax) + jne ..B4.52 +..B4.51: + movl 24(%ebp), %eax + cmpl $0, (%eax) + je ..B4.64 +..B4.52: + movl 64(%esp), %eax + cmpl 60(%esp), %eax + je ..B4.54 +..B4.53: + fldt 48(%esp) + movl 60(%esp), %eax + movl 64(%esp), %ecx + subl %ecx, %eax + fstpt 32(%esp) + addl $16383, %eax + fldt (%ebx) + andl $32767, %eax + fldt 12(%ebx) + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %ecx, 24(%ebx) + movl 24(%ebp), %ecx + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + movl 24(%ecx), %eax + fstpt 12(%ebx) + fldt 12(%ebx) + movl %eax, 64(%esp) + movzwl 8(%ebx), %edx + movzwl 8(%ecx), %eax + fstpt 48(%esp) + movl %edx, 68(%esp) + movl %eax, 44(%esp) + jmp ..B4.55 +..B4.54: + fldt (%ebx) + fldt 12(%ebx) + fstpt 48(%esp) +..B4.55: + movl 24(%ebp), %edx + fld %st(0) + movl 64(%esp), %eax + movl %eax, 120(%esp) + fldt (%edx) + movl 68(%esp), %ecx + fsubr %st, %st(1) + movl 44(%esp), %eax + andl $32767, %ecx + andl $32767, %eax + cmpl %eax, %ecx + jg ..B4.60 +..B4.56: + jne ..B4.61 +..B4.57: + movl 24(%ebp), %edx + movl 4(%ebx), %eax + cmpl 4(%edx), %eax + ja ..B4.60 +..B4.58: + jne ..B4.61 +..B4.59: + movl 24(%ebp), %edx + movl (%ebx), %eax + cmpl (%edx), %eax + jbe ..B4.61 +..B4.60: + fldt 48(%esp) + fxch %st(2) + fsubr %st, %st(3) + movl 24(%ebp), %eax + fxch %st(1) + fsubrp %st, %st(3) + fldt 12(%eax) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 48(%esp) + jmp ..B4.62 +..B4.61: + movl 24(%ebp), %eax + fadd %st(1), %st + fsubrp %st, %st(2) + fldt 48(%esp) + faddp %st, %st(2) + fldt 12(%eax) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) +..B4.62: + fldt 48(%esp) + fld %st(0) + fadd %st(2), %st + fstpt 96(%esp) + fldt 96(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 108(%esp) + jmp ..B4.69 +..B4.63: + movl 4(%ebx), %eax + movl %eax, 32(%esp) +..B4.64: + cmpl $0, 32(%esp) + jne ..B4.66 +..B4.201: + cmpl $0, (%ebx) +..B4.65: + je ..B4.67 +..B4.66: + movl 64(%esp), %eax + movl 40(%esp), %ecx + movl 60(%esp), %ebx + lea -16517(%eax,%ecx), %eax + lea -16383(%ebx,%edx), %edx + movl 40(%ebp), %ebx + cmpl %edx, %eax + jl ..B4.68 +..B4.67: + movl 24(%ebp), %edx + movl 64(%esp), %eax + movl %eax, 120(%esp) + fldt (%edx) + fchs + fstpt 96(%esp) + fldt 12(%edx) + fchs + fstpt 108(%esp) + jmp ..B4.69 +..B4.68: + movl (%ebx), %eax + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl %eax, 96(%esp) + movl %edx, 100(%esp) + movl %ecx, 104(%esp) + movl 12(%ebx), %eax + movl 16(%ebx), %edx + movl 20(%ebx), %ecx + movl 24(%ebx), %ebx + movl %eax, 108(%esp) + movl %edx, 112(%esp) + movl %ecx, 116(%esp) + movl %ebx, 120(%esp) +..B4.69: + movzwl 8(%esi), %eax + movl %eax, 68(%esp) + andl $32767, %eax + movl 24(%esi), %ecx + incl %ecx + movl %ecx, 24(%esi) + cmpl $8383, %eax + movl %eax, 76(%esp) + jl ..B4.73 +..B4.70: + cmpl $24383, 76(%esp) + jg ..B4.73 +..B4.71: + movzwl 8(%edi), %edx + movl %edx, %eax + andl $32767, %eax + movl %eax, 72(%esp) + cmpl $8383, %eax + jl ..B4.73 +..B4.72: + cmpl $24383, 72(%esp) + jle ..B4.76 +..B4.73: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B4.74: + addl $4, %esp + pushl %edi + call __libm_normalizel_k80 +..B4.75: + movzwl 8(%esi), %edx + movl %edx, 68(%esp) + andl $32767, %edx + movl %edx, 76(%esp) + movzwl 8(%edi), %edx + movl %edx, %eax + andl $32767, %eax + movl %eax, 72(%esp) + movl 24(%esi), %ecx +..B4.76: + movl 76(%esp), %ebx + movl 24(%edi), %edi + movl %edi, 64(%esp) + lea (%ecx,%ebx), %eax + movl 72(%esp), %ebx + movl %eax, 60(%esp) + lea -134(%edi,%ebx), %edi + cmpl %edi, %eax + movl 44(%ebp), %edi + jle ..B4.93 +..B4.77: + movl 4(%esi), %eax + movl %eax, 44(%esp) + movl 64(%esp), %ebx + movl 72(%esp), %eax + lea 134(%ebx,%eax), %ebx + cmpl 60(%esp), %ebx + jle ..B4.94 +..B4.78: + cmpl $0, 44(%esp) + jne ..B4.80 +..B4.79: + cmpl $0, (%esi) + je ..B4.95 +..B4.80: + cmpl $0, 4(%edi) + jne ..B4.82 +..B4.81: + cmpl $0, (%edi) + je ..B4.94 +..B4.82: + cmpl 64(%esp), %ecx + je ..B4.84 +..B4.83: + fldt 48(%esp) + movl 64(%esp), %edx + subl %edx, %ecx + fstpt 32(%esp) + addl $16383, %ecx + fldt (%esi) + andl $32767, %ecx + fldt 12(%esi) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %ecx, %eax + movl %edx, %ecx + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%esi) + fxch %st(2) + fstpt (%esi) + fldt (%esi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%esi) + fldt 12(%esi) + movl 24(%edi), %ebx + movzwl 8(%esi), %eax + movl %ebx, 64(%esp) + movl %eax, 68(%esp) + movzwl 8(%edi), %edx + jmp ..B4.85 +..B4.84: + fldt (%esi) + fldt 12(%esi) +..B4.85: + fldt (%edi) + fld %st(2) + movl 64(%esp), %eax + fadd %st(1), %st + movl %eax, 176(%esp) + movl %edx, %eax + movl 68(%esp), %ebx + andl $32767, %eax + andl $32767, %ebx + cmpl %eax, %ebx + jg ..B4.90 +..B4.86: + jne ..B4.91 +..B4.87: + movl 4(%esi), %eax + cmpl 4(%edi), %eax + ja ..B4.90 +..B4.88: + jne ..B4.91 +..B4.89: + movl (%esi), %eax + cmpl (%edi), %eax + jbe ..B4.91 +..B4.90: + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 12(%edi) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + jmp ..B4.92 +..B4.91: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 12(%edi) + faddp %st, %st(2) +..B4.92: + fld %st(1) + fadd %st(1), %st + fstpt 152(%esp) + fldt 152(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 164(%esp) + jmp ..B4.99 +..B4.93: + movl 4(%esi), %eax + movl %eax, 44(%esp) +..B4.94: + cmpl $0, 44(%esp) + jne ..B4.96 +..B4.203: + cmpl $0, (%esi) +..B4.95: + je ..B4.97 +..B4.96: + movl 64(%esp), %ebx + movl 72(%esp), %eax + lea -16517(%ebx,%eax), %eax + movl 76(%esp), %ebx + lea -16383(%ecx,%ebx), %ebx + cmpl %ebx, %eax + jl ..B4.98 +..B4.97: + movl (%edi), %eax + movl %eax, 152(%esp) + movl 4(%edi), %ebx + movl 8(%edi), %eax + movl %ebx, 156(%esp) + movl %eax, 160(%esp) + movl 12(%edi), %ebx + movl 16(%edi), %eax + movl %ebx, 164(%esp) + movl %eax, 168(%esp) + movl 20(%edi), %ebx + movl 24(%edi), %eax + movl %ebx, 172(%esp) + movl %eax, 176(%esp) + jmp ..B4.99 +..B4.98: + movl (%esi), %eax + movl %eax, 152(%esp) + movl 4(%esi), %ebx + movl 8(%esi), %eax + movl %ebx, 156(%esp) + movl %eax, 160(%esp) + movl 12(%esi), %ebx + movl 16(%esi), %eax + movl %ebx, 164(%esp) + movl %eax, 168(%esp) + movl 20(%esi), %ebx + movl 24(%esi), %eax + movl %ebx, 172(%esp) + movl %eax, 176(%esp) +..B4.99: + movzwl 160(%esp), %eax + decl %ecx + andl $32767, %eax + movl %ecx, 24(%esi) + cmpl $8383, %eax + jl ..B4.103 +..B4.100: + cmpl $24383, %eax + jg ..B4.103 +..B4.101: + movzwl 104(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.103 +..B4.102: + cmpl $24383, %eax + jle ..B4.105 +..B4.103: + addl $4, %esp + lea 148(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.104: + addl $4, %esp + lea 92(%esp), %eax + pushl %eax + call __libm_normalizel_k80 + movzwl 8(%edi), %edx +..B4.105: + fldt 152(%esp) + andl $32767, %edx + fld %st(0) + fld %st(1) + fldt 80(%esp) + fld %st(0) + fmul %st(4), %st + movl 176(%esp), %eax + fsubr %st, %st(3) + addl 120(%esp), %eax + faddp %st, %st(3) + fld %st(2) + cmpl $8383, %edx + movl %eax, 204(%esp) + fxch %st(2) + fsub %st(3), %st + fldt 96(%esp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 108(%esp) + fmulp %st, %st(4) + fldt 164(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 180(%esp) + fldt 180(%esp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 192(%esp) + jl ..B4.109 +..B4.106: + cmpl $24383, %edx + jg ..B4.109 +..B4.107: + movzwl 132(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.109 +..B4.108: + cmpl $24383, %eax + jle ..B4.111 +..B4.109: + addl $4, %esp + pushl %edi + call __libm_normalizel_k80 +..B4.110: + addl $4, %esp + lea 120(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.111: + fldt (%edi) + fld %st(0) + fld %st(1) + fldt 80(%esp) + fld %st(0) + fmul %st(4), %st + movl 36(%ebp), %ebx + fsubr %st, %st(3) + movl 148(%esp), %eax + faddp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fldt 124(%esp) + fmul %st, %st(2) + fld %st(0) + addl 24(%edi), %eax + fsub %st(3), %st + movl 28(%ebp), %esi + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + movl %eax, 232(%esp) + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 136(%esp) + fmulp %st, %st(4) + fldt 12(%edi) + fmulp %st, %st(1) + movzwl 8(%ebx), %edi + movl %edi, %ecx + andl $32767, %ecx + faddp %st, %st(3) + cmpl $8383, %ecx + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 208(%esp) + fldt 208(%esp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 220(%esp) + fstpt 48(%esp) + jl ..B4.115 +..B4.112: + cmpl $24383, %ecx + jg ..B4.115 +..B4.113: + movzwl 8(%esi), %edx + movl %edx, 60(%esp) + andl $32767, %edx + cmpl $8383, %edx + jl ..B4.115 +..B4.114: + cmpl $24383, %edx + jle ..B4.118 +..B4.115: + addl $4, %esp + pushl %ebx + call __libm_normalizel_k80 +..B4.116: + addl $4, %esp + pushl %esi + call __libm_normalizel_k80 +..B4.117: + movzwl 8(%ebx), %edi + movl %edi, %ecx + movzwl 8(%esi), %edx + andl $32767, %ecx + movl %edx, 60(%esp) + andl $32767, %edx +..B4.118: + movl 24(%esi), %eax + movl 24(%ebx), %ebx + movl %eax, 72(%esp) + movl %ebx, 68(%esp) + lea -134(%eax,%edx), %eax + addl %ecx, %ebx + movl %ebx, 64(%esp) + cmpl %eax, %ebx + movl 36(%ebp), %ebx + jle ..B4.135 +..B4.119: + movl 4(%ebx), %eax + movl %eax, 44(%esp) + movl 72(%esp), %eax + lea 134(%eax,%edx), %eax + cmpl 64(%esp), %eax + jle ..B4.136 +..B4.120: + cmpl $0, 44(%esp) + jne ..B4.122 +..B4.121: + cmpl $0, (%ebx) + je ..B4.137 +..B4.122: + cmpl $0, 4(%esi) + jne ..B4.124 +..B4.123: + cmpl $0, (%esi) + je ..B4.136 +..B4.124: + movl 72(%esp), %eax + cmpl 68(%esp), %eax + je ..B4.126 +..B4.125: + fldt 48(%esp) + movl 68(%esp), %edi + movl %eax, %edx + subl %edx, %edi + fstpt 32(%esp) + addl $16383, %edi + fldt (%ebx) + andl $32767, %edi + fldt 12(%ebx) + andb $127, 41(%esp) + movzwl 40(%esp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + movl %edx, 24(%ebx) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt 12(%ebx) + movl 24(%esi), %ecx + movzwl 8(%esi), %eax + movl %ecx, 72(%esp) + movzwl 8(%ebx), %edi + movl %eax, 60(%esp) + jmp ..B4.127 +..B4.126: + fldt (%ebx) + fldt 12(%ebx) +..B4.127: + fldt (%esi) + andl $32767, %edi + movl 60(%esp), %edx + fld %st(2) + andl $32767, %edx + fadd %st(1), %st + movl 72(%esp), %eax + cmpl %edx, %edi + movl %eax, 260(%esp) + jg ..B4.132 +..B4.128: + jne ..B4.133 +..B4.129: + movl 4(%ebx), %eax + cmpl 4(%esi), %eax + ja ..B4.132 +..B4.130: + jne ..B4.133 +..B4.131: + movl (%ebx), %eax + cmpl (%esi), %eax + jbe ..B4.133 +..B4.132: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 12(%esi) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B4.134 +..B4.133: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 12(%esi) + faddp %st, %st(1) +..B4.134: + fld %st(0) + fadd %st(2), %st + fstpt 236(%esp) + fldt 236(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 248(%esp) + jmp ..B4.141 +..B4.135: + movl 4(%ebx), %eax + movl %eax, 44(%esp) +..B4.136: + cmpl $0, 44(%esp) + jne ..B4.138 +..B4.204: + cmpl $0, (%ebx) +..B4.137: + je ..B4.139 +..B4.138: + movl 72(%esp), %eax + lea -16517(%eax,%edx), %edi + movl 68(%esp), %edx + lea -16383(%edx,%ecx), %ecx + cmpl %ecx, %edi + jl ..B4.140 +..B4.139: + movl (%esi), %eax + movl %eax, 236(%esp) + movl 4(%esi), %edx + movl 8(%esi), %ecx + movl 12(%esi), %ebx + movl 16(%esi), %edi + movl 20(%esi), %eax + movl 24(%esi), %esi + movl %edx, 240(%esp) + movl %ecx, 244(%esp) + movl %ebx, 248(%esp) + movl %edi, 252(%esp) + movl %eax, 256(%esp) + movl %esi, 260(%esp) + jmp ..B4.141 +..B4.140: + movl (%ebx), %eax + movl %eax, 236(%esp) + movl 4(%ebx), %edx + movl 8(%ebx), %ecx + movl 12(%ebx), %esi + movl 16(%ebx), %edi + movl 20(%ebx), %eax + movl 24(%ebx), %ebx + movl %edx, 240(%esp) + movl %ecx, 244(%esp) + movl %esi, 248(%esp) + movl %edi, 252(%esp) + movl %eax, 256(%esp) + movl %ebx, 260(%esp) +..B4.141: + movzwl 216(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.145 +..B4.142: + cmpl $24383, %eax + jg ..B4.145 +..B4.143: + movzwl 244(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.145 +..B4.144: + cmpl $24383, %eax + jle ..B4.147 +..B4.145: + addl $4, %esp + lea 204(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.146: + addl $4, %esp + lea 232(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.147: + fldt 208(%esp) + fld %st(0) + fld %st(1) + fldt 80(%esp) + fld %st(0) + fmul %st(4), %st + movl 232(%esp), %edx + fsubr %st, %st(3) + movzwl 188(%esp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + addl 260(%esp), %edx + fxch %st(2) + fsub %st(3), %st + fldt 236(%esp) + cmpl $8383, %eax + fmul %st, %st(2) + fld %st(0) + movl %edx, 288(%esp) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 248(%esp) + fmulp %st, %st(4) + fldt 220(%esp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 264(%esp) + fldt 264(%esp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 276(%esp) + fldt 276(%esp) + jl ..B4.151 +..B4.148: + cmpl $24383, %eax + jg ..B4.151 +..B4.149: + movzwl 272(%esp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.151 +..B4.150: + cmpl $24383, %eax + jle ..B4.154 +..B4.151: + fstp %st(1) + fstp %st(0) + addl $4, %esp + lea 176(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.152: + addl $4, %esp + lea 260(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.153: + fldt 264(%esp) + fldt 276(%esp) + movl 288(%esp), %edx +..B4.154: + fldt 180(%esp) + fld %st(2) + fdivr %st(1), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(4) + fstpt 64(%esp) + fldt 64(%esp) + fldt 80(%esp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movl 204(%esp), %ecx + fsubr %st(4), %st + subl %edx, %ecx + faddp %st, %st(1) + fld %st(0) + decl %ecx + movl %ecx, 316(%esp) + fsubr %st(4), %st + fxch %st(2) + fmul %st(3), %st + fsubr %st, %st(7) + faddp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fld %st(2) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fxch %st(4) + fsubrp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fldt 192(%esp) + faddp %st, %st(1) + fsubp %st, %st(1) + fldt 64(%esp) + fdivrp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 292(%esp) + fldt 292(%esp) + fsubr %st, %st(2) + movzwl 300(%esp), %eax + fxch %st(1) + fadd %st, %st(2) + andl $32767, %eax + fxch %st(2) + fstpt 304(%esp) + fldt 304(%esp) + cmpl $383, %eax + fxch %st(2) + fstpt 48(%esp) + fxch %st(1) + jl ..B4.156 +..B4.155: + cmpl $32383, %eax + jle ..B4.158 +..B4.156: + fstp %st(0) + fstp %st(0) + addl $4, %esp + lea 288(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.157: + fldt 292(%esp) + fldt 304(%esp) + movl 316(%esp), %ecx +..B4.158: + testb $1, %cl + jne ..B4.196 +..B4.159: + movl 92(%esp), %eax + fldt 48+_CONSTANTS@GOTOFF(%eax) +..B4.160: + fldt 80(%esp) + fld %st(3) + fsqrt + lea 320(%esp), %eax + fmul %st, %st(1) + lea 348(%esp), %edx + fld %st(1) + sarl $1, %ecx + fsubr %st(1), %st + movl %ecx, 52(%eax) + faddp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + fdivr %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 28(%eax) + fldt 28(%eax) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 40(%eax) + call asinpoly +..B4.161: + movl 92(%esp), %eax + xorl %ebx, %ebx + movl 344(%esp), %esi + incl %esi + fldt 60+_CONSTANTS@GOTOFF(%eax) + movzwl 68+_CONSTANTS@GOTOFF(%eax), %edi + andl $32767, %edi + movl %esi, 344(%esp) + cmpl $8383, %edi + movl %ebx, 400(%esp) + fstpt 376(%esp) + fldt 72+_CONSTANTS@GOTOFF(%eax) + fstpt 388(%esp) + jl ..B4.165 +..B4.162: + cmpl $24383, %edi + jg ..B4.165 +..B4.163: + movzwl 328(%esp), %ecx + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B4.165 +..B4.164: + cmpl $24383, %ecx + jle ..B4.168 +..B4.165: + addl $4, %esp + lea 372(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.166: + addl $4, %esp + lea 316(%esp), %eax + pushl %eax + call __libm_normalizel_k80 +..B4.167: + movzwl 384(%esp), %edi + movzwl 328(%esp), %ecx + andl $32767, %edi + movl 344(%esp), %esi + andl $32767, %ecx + movl 400(%esp), %ebx +..B4.168: + lea (%ebx,%edi), %eax + movl %eax, 44(%esp) + lea -134(%esi,%ecx), %edx + cmpl %edx, %eax + jle ..B4.185 +..B4.169: + movl 380(%esp), %edx + lea 134(%esi,%ecx), %eax + cmpl 44(%esp), %eax + jle ..B4.186 +..B4.170: + testl %edx, %edx + jne ..B4.172 +..B4.171: + cmpl $0, 376(%esp) + je ..B4.187 +..B4.172: + movl 324(%esp), %eax + testl %eax, %eax + jne ..B4.174 +..B4.173: + cmpl $0, 320(%esp) + je ..B4.186 +..B4.174: + cmpl %esi, %ebx + je ..B4.176 +..B4.175: + fldt 48(%esp) + subl %esi, %ebx + fstpt 32(%esp) + addl $16383, %ebx + fldt 376(%esp) + andl $32767, %ebx + fldt 388(%esp) + andb $127, 41(%esp) + movzwl 40(%esp), %edx + andl $-32768, %edx + orl %ebx, %edx + movw %dx, 40(%esp) + movl $-2147483648, 36(%esp) + movl $0, 32(%esp) + fldt 32(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 376(%esp) + fldt 376(%esp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 384(%esp), %edi + movl %esi, 400(%esp) + andl $32767, %edi + fstpt 388(%esp) + fldt 388(%esp) + jmp ..B4.177 +..B4.176: + fldt 376(%esp) + fldt 388(%esp) +..B4.177: + fldt 320(%esp) + fld %st(2) + movl %esi, 68(%esp) + cmpl %ecx, %edi + fsub %st(1), %st + jg ..B4.182 +..B4.178: + jne ..B4.183 +..B4.179: + movl 380(%esp), %edx + cmpl %eax, %edx + ja ..B4.182 +..B4.180: + jne ..B4.183 +..B4.181: + movl 376(%esp), %eax + cmpl 320(%esp), %eax + jbe ..B4.183 +..B4.182: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 332(%esp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + jmp ..B4.184 +..B4.183: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 332(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) +..B4.184: + fld %st(0) + fadd %st(2), %st + fstpt 44(%esp) + fldt 44(%esp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 56(%esp) + fldt 56(%esp) + jmp ..B4.193 +..B4.185: + movl 380(%esp), %edx +..B4.186: + testl %edx, %edx + jne ..B4.188 +..B4.205: + cmpl $0, 376(%esp) +..B4.187: + je ..B4.189 +..B4.188: + lea -16517(%esi,%ecx), %eax + lea -16383(%ebx,%edi), %ecx + cmpl %ecx, %eax + jl ..B4.190 +..B4.189: + fldt 320(%esp) + fchs + movl %esi, 68(%esp) + fstpt 44(%esp) + fldt 44(%esp) + fldt 332(%esp) + fchs + fstpt 56(%esp) + fldt 56(%esp) + jmp ..B4.193 +..B4.190: + movl %edx, 48(%esp) + movl 396(%esp), %esi + movl 376(%esp), %eax + movl 384(%esp), %edx + movl 388(%esp), %ecx + movl 392(%esp), %ebx + movl %esi, 64(%esp) + movl %eax, 44(%esp) + movl %edx, 52(%esp) + fldt 44(%esp) + movl 400(%esp), %esi + movl %ecx, 56(%esp) + movl %ebx, 60(%esp) + fldt 56(%esp) + movl %esi, 68(%esp) + jmp ..B4.193 +..B4.191: + lea 44(%esp), %eax + lea 404(%esp), %edx + call asinpoly +..B4.192: + fldt 44(%esp) + fldt 56(%esp) + movl 68(%esp), %esi +..B4.193: + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %esi, 24(%esp) + call __libm_scalbl_k80 +..B4.194: + movl 8(%ebp), %eax + movl 92(%esp), %ebx + movl 432(%esp), %edi + movzbl 9(%eax), %ecx + xorl %esp, %edi + andl $128, %ecx + shrl $7, %ecx + cmpl %gs:20, %edi + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %esi + fldt _CONSTANTS@GOTOFF(%ebx,%esi) + fmulp %st, %st(1) + jne ..B4.197 +..B4.195: + addl $436, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B4.196: + movl 92(%esp), %eax + incl %ecx + movl %ecx, 316(%esp) + fldt 48+_CONSTANTS@GOTOFF(%eax) + fmul %st, %st(2) + fxch %st(2) + fstpt 292(%esp) + fldt 292(%esp) + fxch %st(1) + fmul %st(2), %st + fstpt 304(%esp) + fldt 304(%esp) + fxch %st(1) + fxch %st(2) + jmp ..B4.160 +..B4.197: + fstp %st(0) + call __stack_chk_fail@PLT + .align 16,0x90 + .type __libm_recasinl_k80,@function + .size __libm_recasinl_k80,.-__libm_recasinl_k80 + .data +# -- End __libm_recasinl_k80 + .section .rodata, "a" + .align 16 + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 32768 + .word 16415 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 39322 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 28087 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 36409 + .word 63715 + .word 16377 + .word 0 + .word 62186 + .word 9163 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 11943 + .word 18321 + .word 25215 + .word 36391 + .word 16377 + .word 0 + .word 12527 + .word 63486 + .word 51909 + .word 58572 + .word 16376 + .word 0 + .word 16437 + .word 53165 + .word 60799 + .word 48451 + .word 16376 + .word 0 + .word 39560 + .word 816 + .word 43435 + .word 40940 + .word 16376 + .word 0 + .word 47763 + .word 38463 + .word 31161 + .word 35220 + .word 16376 + .word 0 + .word 61035 + .word 37666 + .word 58653 + .word 60832 + .word 16375 + .word 0 + .word 4110 + .word 2419 + .word 35453 + .word 57515 + .word 16375 + .word 0 + .word 3126 + .word 47859 + .word 6163 + .word 61068 + .word 16374 + .word 0 + .word 56145 + .word 58008 + .word 18829 + .word 55579 + .word 16376 + .word 0 + .word 17944 + .word 24712 + .word 25688 + .word 38195 + .word 49145 + .word 0 + .word 27414 + .word 34244 + .word 64801 + .word 51841 + .word 16378 + .word 0 + .word 63442 + .word 25896 + .word 35822 + .word 55851 + .word 49146 + .word 0 + .word 37640 + .word 1996 + .word 32075 + .word 42748 + .word 16378 + .word 0 + .word 39460 + .word 64770 + .word 43690 + .word 43690 + .word 49115 + .word 0 + .word 48327 + .word 21484 + .word 52058 + .word 52428 + .word 49114 + .word 0 + .word 52692 + .word 45548 + .word 47571 + .word 37453 + .word 49112 + .word 0 + .word 9214 + .word 45875 + .word 56244 + .word 56360 + .word 49110 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,348 + .data + .hidden __libm_normalizel_k80 + .hidden __libm_scalbl_k80 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_reduce_pi04d.S b/external/sgx_libm/ia32/libm_reduce_pi04d.S new file mode 100644 index 0000000000..c84df0c92d --- /dev/null +++ b/external/sgx_libm/ia32/libm_reduce_pi04d.S @@ -0,0 +1,365 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_reduce_pi04d.c" + .text +..TXTST0: +# -- Begin __libm_reduce_pi04d + .text + .align 16,0x90 + .hidden __libm_reduce_pi04d + .globl __libm_reduce_pi04d +__libm_reduce_pi04d: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + movl 16(%ebp), %eax + movl 20(%ebp), %ebx + movl %eax, 8(%esp) +..B1.2: + fnstcw 26(%esp) +..B1.3: + movzwl 26(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.19 +..B1.4: + orl $-64768, %ecx + movw %cx, 24(%esp) +..B1.5: + fldcw 24(%esp) +..B1.6: + movl $1, 12(%esp) +..B1.7: + movzwl 14(%ebp), %edi + movl %edi, %ecx + andl $32752, %ecx + andl $-32753, %edi + shrl $4, %ecx + movl $1374389535, %eax + lea -200(%ecx), %esi + andl $2047, %esi + shll $4, %esi + orl %esi, %edi + lea -1052(%ecx), %esi + imull %esi + sarl $3, %edx + sarl $31, %esi + subl %esi, %edx + movw %di, 14(%ebp) + fldl 8(%ebp) + imull $-25, %edx, %edi + andl $-134217728, 8(%ebp) + lea -1052(%edi,%ecx), %ecx + fldl 8(%ebp) + cmpl $17, %ecx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + fsubr %st, %st(1) + movl %ecx, 20(%esp) + jl ..B1.9 +..B1.8: + fldl _DP@GOTOFF(%ecx,%edx,8) + fmul %st(2), %st + fldl 8+_DP@GOTOFF(%ecx,%edx,8) + incl %edx + fmul %st(2), %st + faddp %st, %st(1) + fstl (%esp) + andl $-1048576, (%esp) + fsubl (%esp) + jmp ..B1.10 +..B1.9: + fldz +..B1.10: + fld %st(1) + fld %st(2) + fldl 8+_DP@GOTOFF(%ecx,%edx,8) + fmul %st, %st(2) + fmul %st(5), %st + fldl _DP@GOTOFF(%ecx,%edx,8) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fldl 16+_DP@GOTOFF(%ecx,%edx,8) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fadd %st(2), %st + fstpl (%esp) + movzwl 6(%esp), %ecx + andl $32752, %ecx + shrl $4, %ecx + negl %ecx + addl $1075, %ecx + movl 4(%esp), %esi + cmpl $31, %ecx + movl (%esp), %edi + jbe ..B1.12 +..B1.11: + movl %esi, %edi + movl %edi, %esi + sarl $31, %esi + sarl %cl, %edi + jmp ..B1.13 +..B1.12: + shrdl %cl, %esi, %edi + sarl %cl, %esi +..B1.13: + movl %edi, (%esp) + cmpl $31, %ecx + movl %esi, 4(%esp) + jbe ..B1.15 +..B1.14: + movl %edi, %esi + movl $0, 16(%esp) + shll %cl, %esi + jmp ..B1.16 +..B1.15: + movl %edi, %eax + shll %cl, %eax + shldl %cl, %edi, %esi + movl %eax, 16(%esp) +..B1.16: + movl 16(%esp), %ecx + addl %edi, %ebx + movl %ecx, (%esp) + fld %st(3) + movl %esi, 4(%esp) + movl %ebx, %esi + andl $1, %esi + movl 20(%esp), %edi + fxch %st(1) + fmul %st(5), %st + fxch %st(3) + fsubl (%esp) + fldl 24+_DP@GOTOFF(%edi,%edx,8) + fldl 32+_DP@GOTOFF(%edi,%edx,8) + cmpl $0, 12(%esp) + fxch %st(2) + faddl zero_none@GOTOFF(%edi,%esi,8) + faddp %st, %st(4) + fld %st(5) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fld %st(4) + fmul %st(1), %st + fxch %st(4) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + fmul %st(4), %st + fldl 40+_DP@GOTOFF(%edi,%edx,8) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(2) + fxch %st(2) + fmul %st(4), %st + fxch %st(3) + fmull 56+_DP@GOTOFF(%edi,%edx,8) + fldl 48+_DP@GOTOFF(%edi,%edx,8) + fmul %st, %st(3) + movl 8(%esp), %edx + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fmull .L_2il0floatpacket.0@GOTOFF(%edi) + fstpl (%edx) + je ..B1.18 +..B1.17: + fldcw 26(%esp) +..B1.18: + movl %ebx, %eax + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + movl $0, 12(%esp) + jmp ..B1.7 + .align 16,0x90 + .type __libm_reduce_pi04d,@function + .size __libm_reduce_pi04d,.-__libm_reduce_pi04d + .data +# -- End __libm_reduce_pi04d + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x54442d18,0x3fe921fb + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +zero_none: + .long 0x00000000,0x00000000 + .long 0x00000000,0xbff00000 + .type zero_none,@object + .size zero_none,16 + .align 4 +_DP: + .long 0 + .long 0 + .long 1610612736 + .long 1282694960 + .long 0 + .long 1256952721 + .long 536870912 + .long 1229269500 + .long 3221225472 + .long 1202544455 + .long 0 + .long 1176818551 + .long 2147483648 + .long 1148939346 + .long 536870912 + .long 1124701124 + .long 3758096384 + .long 1099498527 + .long 3758096384 + .long 1071929578 + .long 1342177280 + .long 1046982385 + .long 805306368 + .long 1020320658 + .long 2147483648 + .long 993817732 + .long 0 + .long 968598976 + .long 2684354560 + .long 942220475 + .long 2415919104 + .long 915426956 + .long 0 + .long 885849629 + .long 536870912 + .long 863855510 + .long 1610612736 + .long 836031391 + .long 4026531840 + .long 810828058 + .long 1073741824 + .long 784674491 + .long 1610612736 + .long 757207974 + .long 3489660928 + .long 732020890 + .long 0 + .long 703061904 + .long 1610612736 + .long 679713053 + .long 2147483648 + .long 652001705 + .long 1073741824 + .long 626850382 + .long 2147483648 + .long 597786158 + .long 805306368 + .long 575535400 + .long 536870912 + .long 548814833 + .long 268435456 + .long 523239288 + .long 3758096384 + .long 495550718 + .long 2952790016 + .long 469954840 + .long 1073741824 + .long 442925723 + .long 1073741824 + .long 416247094 + .long 3758096384 + .long 392128403 + .long 2147483648 + .long 364254062 + .long 3221225472 + .long 339643518 + .long 2684354560 + .long 313162111 + .long 805306368 + .long 286354345 + .long 2952790016 + .long 260811902 + .long 1610612736 + .long 234667567 + .long 3758096384 + .long 207520668 + .long 1073741824 + .long 182175017 + .long 4026531840 + .long 155380331 + .long 805306368 + .long 129417058 + .long 536870912 + .long 103691636 + .long 0 + .long 73760972 + .long 3221225472 + .long 48348958 + .type _DP,@object + .size _DP,392 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_reduce_pi04l.S b/external/sgx_libm/ia32/libm_reduce_pi04l.S new file mode 100644 index 0000000000..e61e1f36b6 --- /dev/null +++ b/external/sgx_libm/ia32/libm_reduce_pi04l.S @@ -0,0 +1,3729 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_reduce_pi04l.c" + .text +..TXTST0: +# -- Begin __libm_reduce_pi04l + .text + .align 16,0x90 + .hidden __libm_reduce_pi04l + .globl __libm_reduce_pi04l +__libm_reduce_pi04l: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 24 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $20, %esp + movzwl 16(%ebp), %ebx + andl $32767, %ebx + movl 20(%ebp), %eax + cmpl $16413, %ebx + movl 24(%ebp), %esi + call ..L2 +..L2: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi + movl %eax, 4(%esp) + jge ..B1.8 +..B1.2: + fldt 8(%ebp) + fldl __4onpi_d@GOTOFF(%edi) + fmul %st(1), %st + fstpt 8(%esp) + movzwl 16(%esp), %ecx + negl %ecx + addl $30, %ecx + movl 12(%esp), %eax + shrl %cl, %eax + cmpl $0, 4(%esp) + jne ..B1.4 +..B1.3: + lea 1(%eax), %ecx + andl $-2, %ecx + jmp ..B1.5 +..B1.4: + movl %eax, %ecx + addl 4(%esp), %eax + movl %eax, %edx + andl $1, %edx + addl %edx, %ecx +..B1.5: + fldl _TWO_32H@GOTOFF(%edi) + cmpl $16400, %ebx + movl %ecx, (%esp) + fildl (%esp) + jge ..B1.7 +..B1.6: + fldl _pi04_3d@GOTOFF(%edi) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_pi04_3d@GOTOFF(%edi) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_pi04_3d@GOTOFF(%edi) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.15 +..B1.7: + fldl _pi04_5d@GOTOFF(%edi) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_pi04_5d@GOTOFF(%edi) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_pi04_5d@GOTOFF(%edi) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 24+_pi04_5d@GOTOFF(%edi) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 32+_pi04_5d@GOTOFF(%edi) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.15 +..B1.8: + fldt 8(%ebp) + lea -16417(%ebx), %ecx + fmull _SCALE@GOTOFF(%edi) + movl $-2078209981, %eax + imull %ecx + sarl $31, %ecx + lea -16417(%edx,%ebx), %eax + sarl $4, %eax + subl %ecx, %eax + movl %eax, %ecx + shll $5, %ecx + negl %ecx + addl %eax, %ecx + fstpt 8(%ebp) + fldt 8(%ebp) + movl $0, 8(%ebp) + fldt 8(%ebp) + lea -16417(%ecx,%ebx), %ebx + cmpl $17, %ebx + fsubr %st, %st(1) + jl ..B1.10 +..B1.9: + lea (,%eax,8), %edx + lea (%edx,%eax,4), %ecx + incl %eax + fldt __4onpi_31l@GOTOFF(%ecx,%edi) + fmul %st(2), %st + fldt 12+__4onpi_31l@GOTOFF(%edi,%ecx) + fmul %st(2), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 8(%esp) + andl $-16777216, 8(%esp) + fldt 8(%esp) + fsubrp %st, %st(1) + jmp ..B1.11 +..B1.10: + fldl _zeros@GOTOFF(%edi) + fld %st(0) +..B1.11: + fld %st(0) + lea (,%eax,8), %edx + fld %st(3) + lea (%edx,%eax,4), %eax + fldt __4onpi_31l@GOTOFF(%eax,%edi) + fmul %st(6), %st + movl %eax, (%esp) + fadd %st, %st(2) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt 12+__4onpi_31l@GOTOFF(%eax,%edi) + fmul %st, %st(2) + fld %st(2) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fadd %st(3), %st + fxch %st(2) + fmul %st(5), %st + fadd %st, %st(2) + fld %st(4) + fldt 24+__4onpi_31l@GOTOFF(%eax,%edi) + fmul %st, %st(1) + fxch %st(1) + fadd %st, %st(4) + fxch %st(4) + fstpt 8(%esp) + movzwl 16(%esp), %ebx + andl $32767, %ebx + cmpl $16415, %ebx + jge ..B1.13 +..B1.12: + negl %ebx + addl $30, %ebx + movl %ebx, %ecx + movl 12(%esp), %eax + shrl %cl, %eax + shll %cl, %eax + movl %eax, 12(%esp) + movl $0, 8(%esp) + shrl %cl, %eax + jmp ..B1.14 +..B1.13: + negl %ebx + addl $30, %ebx + movl %ebx, %ecx + movl 8(%esp), %edx + shrl %cl, %edx + shll %cl, %edx + negl %ecx + movl 12(%esp), %eax + shll %cl, %eax + movl %ebx, %ecx + movl %edx, 8(%esp) + shrl %cl, %edx + orl %edx, %eax +..B1.14: + fldt 8(%esp) + addl 4(%esp), %eax + fsubrp %st, %st(3) + fmul %st(6), %st + fld %st(4) + movl %eax, %edx + andl $1, %edx + fadd %st(3), %st + movl (%esp), %ecx + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fld %st(1) + fxch %st(3) + faddl zero_none@GOTOFF(%edi,%edx,8) + fadd %st, %st(3) + fsub %st(3), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fldt 36+__4onpi_31l@GOTOFF(%ecx,%edi) + fmul %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st(4), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fldt 48+__4onpi_31l@GOTOFF(%ecx,%edi) + fmul %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(3) + fxch %st(2) + fmul %st(5), %st + fldt 60+__4onpi_31l@GOTOFF(%ecx,%edi) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fld %st(3) + fxch %st(2) + fmul %st(5), %st + fldt 72+__4onpi_31l@GOTOFF(%ecx,%edi) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(4) + fldt 84+__4onpi_31l@GOTOFF(%edi,%ecx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fldl _TWO_32H@GOTOFF(%edi) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldl _pi04_2d@GOTOFF(%edi) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + fmull 8+_pi04_2d@GOTOFF(%edi) + faddp %st, %st(1) +..B1.15: + fldl _TWO_12H@GOTOFF(%edi) + fld %st(2) + fadd %st(2), %st + fmul %st, %st(1) + fstpt 8(%esp) + fldt 8(%esp) + fadd %st(1), %st + fsubp %st, %st(1) + fstl (%esi) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpl 8(%esi) + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_reduce_pi04l,@function + .size __libm_reduce_pi04l,.-__libm_reduce_pi04l + .data +# -- End __libm_reduce_pi04l + .section .rodata, "a" + .align 8 + .align 8 +zero_none: + .long 0x00000000,0x00000000 + .long 0x00000000,0xbff00000 + .type zero_none,@object + .size zero_none,16 + .align 4 +__4onpi_d: + .long 1841940611 + .long 1072979760 + .type __4onpi_d,@object + .size __4onpi_d,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_pi04_3d: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _pi04_3d,@object + .size _pi04_3d,24 + .align 4 +_pi04_5d: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _pi04_5d,@object + .size _pi04_5d,40 + .align 4 +_SCALE: + .long 0 + .long 845152256 + .type _SCALE,@object + .size _SCALE,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_pi04_2d: + .long 1413480448 + .long 1072243195 + .long 442655537 + .long 1036039265 + .type _pi04_2d,@object + .size _pi04_2d,16 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 2 +__4onpi_31l: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33646 + .word 41721 + .word 16600 + .word 0 + .word 0 + .word 0 + .word 10832 + .word 40072 + .word 16567 + .word 0 + .word 0 + .word 0 + .word 44008 + .word 65043 + .word 16537 + .word 0 + .word 0 + .word 0 + .word 28384 + .word 64154 + .word 16505 + .word 0 + .word 0 + .word 0 + .word 38272 + .word 56162 + .word 16472 + .word 0 + .word 0 + .word 0 + .word 7298 + .word 51682 + .word 16445 + .word 0 + .word 0 + .word 0 + .word 45504 + .word 65320 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 61204 + .word 44922 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 18652 + .word 50030 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 14144 + .word 59657 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 37450 + .word 47105 + .word 16290 + .word 0 + .word 0 + .word 0 + .word 14898 + .word 56641 + .word 16259 + .word 0 + .word 0 + .word 0 + .word 34680 + .word 34623 + .word 16226 + .word 0 + .word 0 + .word 0 + .word 4760 + .word 45515 + .word 16196 + .word 0 + .word 0 + .word 0 + .word 41480 + .word 40187 + .word 16166 + .word 0 + .word 0 + .word 0 + .word 47852 + .word 55252 + .word 16134 + .word 0 + .word 0 + .word 0 + .word 54072 + .word 35081 + .word 16103 + .word 0 + .word 0 + .word 0 + .word 26808 + .word 57421 + .word 16071 + .word 0 + .word 0 + .word 0 + .word 20068 + .word 57232 + .word 16042 + .word 0 + .word 0 + .word 0 + .word 49576 + .word 60188 + .word 16009 + .word 0 + .word 0 + .word 0 + .word 10016 + .word 52861 + .word 15978 + .word 0 + .word 0 + .word 0 + .word 30648 + .word 35825 + .word 15947 + .word 0 + .word 0 + .word 0 + .word 60542 + .word 58528 + .word 15918 + .word 0 + .word 0 + .word 0 + .word 65468 + .word 61743 + .word 15887 + .word 0 + .word 0 + .word 0 + .word 64960 + .word 45825 + .word 15851 + .word 0 + .word 0 + .word 0 + .word 50604 + .word 38792 + .word 15825 + .word 0 + .word 0 + .word 0 + .word 18394 + .word 33435 + .word 15794 + .word 0 + .word 0 + .word 0 + .word 55780 + .word 42703 + .word 15763 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 63841 + .word 15731 + .word 0 + .word 0 + .word 0 + .word 63080 + .word 62563 + .word 15700 + .word 0 + .word 0 + .word 0 + .word 20840 + .word 62207 + .word 15669 + .word 0 + .word 0 + .word 0 + .word 30094 + .word 59983 + .word 15639 + .word 0 + .word 0 + .word 0 + .word 61818 + .word 60389 + .word 15608 + .word 0 + .word 0 + .word 0 + .word 40186 + .word 40579 + .word 15577 + .word 0 + .word 0 + .word 0 + .word 42170 + .word 58004 + .word 15546 + .word 0 + .word 0 + .word 0 + .word 55276 + .word 39678 + .word 15514 + .word 0 + .word 0 + .word 0 + .word 44672 + .word 36806 + .word 15481 + .word 0 + .word 0 + .word 0 + .word 13060 + .word 34144 + .word 15452 + .word 0 + .word 0 + .word 0 + .word 28016 + .word 57231 + .word 15419 + .word 0 + .word 0 + .word 0 + .word 16112 + .word 44995 + .word 15390 + .word 0 + .word 0 + .word 0 + .word 53464 + .word 33387 + .word 15358 + .word 0 + .word 0 + .word 0 + .word 7296 + .word 60751 + .word 15325 + .word 0 + .word 0 + .word 0 + .word 29452 + .word 45231 + .word 15297 + .word 0 + .word 0 + .word 0 + .word 26208 + .word 49689 + .word 15266 + .word 0 + .word 0 + .word 0 + .word 37900 + .word 44002 + .word 15235 + .word 0 + .word 0 + .word 0 + .word 57340 + .word 33800 + .word 15204 + .word 0 + .word 0 + .word 0 + .word 27544 + .word 50178 + .word 15173 + .word 0 + .word 0 + .word 0 + .word 6168 + .word 40132 + .word 15142 + .word 0 + .word 0 + .word 0 + .word 21392 + .word 43702 + .word 15109 + .word 0 + .word 0 + .word 0 + .word 45168 + .word 54372 + .word 15081 + .word 0 + .word 0 + .word 0 + .word 8986 + .word 40688 + .word 15050 + .word 0 + .word 0 + .word 0 + .word 1648 + .word 53745 + .word 15018 + .word 0 + .word 0 + .word 0 + .word 30520 + .word 55795 + .word 14986 + .word 0 + .word 0 + .word 0 + .word 43060 + .word 32914 + .word 14956 + .word 0 + .word 0 + .word 0 + .word 46172 + .word 52771 + .word 14925 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 45285 + .word 14893 + .word 0 + .word 0 + .word 0 + .word 53590 + .word 44868 + .word 14864 + .word 0 + .word 0 + .word 0 + .word 40786 + .word 35970 + .word 14833 + .word 0 + .word 0 + .word 0 + .word 33436 + .word 65411 + .word 14801 + .word 0 + .word 0 + .word 0 + .word 32006 + .word 61382 + .word 14771 + .word 0 + .word 0 + .word 0 + .word 37856 + .word 45239 + .word 14738 + .word 0 + .word 0 + .word 0 + .word 60894 + .word 49555 + .word 14709 + .word 0 + .word 0 + .word 0 + .word 48064 + .word 53065 + .word 14674 + .word 0 + .word 0 + .word 0 + .word 48624 + .word 54844 + .word 14647 + .word 0 + .word 0 + .word 0 + .word 7988 + .word 40762 + .word 14616 + .word 0 + .word 0 + .word 0 + .word 16270 + .word 58745 + .word 14585 + .word 0 + .word 0 + .word 0 + .word 37064 + .word 50168 + .word 14553 + .word 0 + .word 0 + .word 0 + .word 18624 + .word 63736 + .word 14519 + .word 0 + .word 0 + .word 0 + .word 60758 + .word 44966 + .word 14492 + .word 0 + .word 0 + .word 0 + .word 33304 + .word 47465 + .word 14461 + .word 0 + .word 0 + .word 0 + .word 6226 + .word 60503 + .word 14430 + .word 0 + .word 0 + .word 0 + .word 26380 + .word 54900 + .word 14398 + .word 0 + .word 0 + .word 0 + .word 44352 + .word 49860 + .word 14368 + .word 0 + .word 0 + .word 0 + .word 11904 + .word 42646 + .word 14337 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 50279 + .word 14300 + .word 0 + .word 0 + .word 0 + .word 15474 + .word 50606 + .word 14275 + .word 0 + .word 0 + .word 0 + .word 45062 + .word 44137 + .word 14244 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 36063 + .word 14210 + .word 0 + .word 0 + .word 0 + .word 40658 + .word 53854 + .word 14182 + .word 0 + .word 0 + .word 0 + .word 28652 + .word 43690 + .word 14151 + .word 0 + .word 0 + .word 0 + .word 24640 + .word 64348 + .word 14118 + .word 0 + .word 0 + .word 0 + .word 30284 + .word 41980 + .word 14088 + .word 0 + .word 0 + .word 0 + .word 45652 + .word 38222 + .word 14057 + .word 0 + .word 0 + .word 0 + .word 15900 + .word 62940 + .word 14026 + .word 0 + .word 0 + .word 0 + .word 31494 + .word 50741 + .word 13996 + .word 0 + .word 0 + .word 0 + .word 43194 + .word 55096 + .word 13965 + .word 0 + .word 0 + .word 0 + .word 1740 + .word 45646 + .word 13933 + .word 0 + .word 0 + .word 0 + .word 28936 + .word 44150 + .word 13903 + .word 0 + .word 0 + .word 0 + .word 8996 + .word 42955 + .word 13872 + .word 0 + .word 0 + .word 0 + .word 44096 + .word 61205 + .word 13839 + .word 0 + .word 0 + .word 0 + .word 44614 + .word 54550 + .word 13810 + .word 0 + .word 0 + .word 0 + .word 24926 + .word 57347 + .word 13779 + .word 0 + .word 0 + .word 0 + .word 3312 + .word 61415 + .word 13745 + .word 0 + .word 0 + .word 0 + .word 64336 + .word 63884 + .word 13717 + .word 0 + .word 0 + .word 0 + .word 2748 + .word 62259 + .word 13685 + .word 0 + .word 0 + .word 0 + .word 56672 + .word 51775 + .word 13653 + .word 0 + .word 0 + .word 0 + .word 32438 + .word 55423 + .word 13624 + .word 0 + .word 0 + .word 0 + .word 17652 + .word 45713 + .word 13593 + .word 0 + .word 0 + .word 0 + .word 65408 + .word 51586 + .word 13558 + .word 0 + .word 0 + .word 0 + .word 40416 + .word 55736 + .word 13531 + .word 0 + .word 0 + .word 0 + .word 52546 + .word 37734 + .word 13500 + .word 0 + .word 0 + .word 0 + .word 48880 + .word 64238 + .word 13469 + .word 0 + .word 0 + .word 0 + .word 56004 + .word 46833 + .word 13437 + .word 0 + .word 0 + .word 0 + .word 61760 + .word 38110 + .word 13405 + .word 0 + .word 0 + .word 0 + .word 41496 + .word 35659 + .word 13374 + .word 0 + .word 0 + .word 0 + .word 25472 + .word 41269 + .word 13342 + .word 0 + .word 0 + .word 0 + .word 45444 + .word 36018 + .word 13314 + .word 0 + .word 0 + .word 0 + .word 6510 + .word 56417 + .word 13283 + .word 0 + .word 0 + .word 0 + .word 3072 + .word 56837 + .word 13252 + .word 0 + .word 0 + .word 0 + .word 61338 + .word 48440 + .word 13221 + .word 0 + .word 0 + .word 0 + .word 49568 + .word 57088 + .word 13189 + .word 0 + .word 0 + .word 0 + .word 4240 + .word 39283 + .word 13157 + .word 0 + .word 0 + .word 0 + .word 18562 + .word 33537 + .word 13128 + .word 0 + .word 0 + .word 0 + .word 31422 + .word 44487 + .word 13097 + .word 0 + .word 0 + .word 0 + .word 31930 + .word 60459 + .word 13066 + .word 0 + .word 0 + .word 0 + .word 42272 + .word 36641 + .word 13033 + .word 0 + .word 0 + .word 0 + .word 28940 + .word 36150 + .word 13004 + .word 0 + .word 0 + .word 0 + .word 21010 + .word 50925 + .word 12973 + .word 0 + .word 0 + .word 0 + .word 29448 + .word 64886 + .word 12941 + .word 0 + .word 0 + .word 0 + .word 20500 + .word 54600 + .word 12911 + .word 0 + .word 0 + .word 0 + .word 54258 + .word 46233 + .word 12880 + .word 0 + .word 0 + .word 0 + .word 32628 + .word 42502 + .word 12848 + .word 0 + .word 0 + .word 0 + .word 61608 + .word 55072 + .word 12818 + .word 0 + .word 0 + .word 0 + .word 6236 + .word 57871 + .word 12786 + .word 0 + .word 0 + .word 0 + .word 42408 + .word 34616 + .word 12756 + .word 0 + .word 0 + .word 0 + .word 56692 + .word 51963 + .word 12724 + .word 0 + .word 0 + .word 0 + .word 39094 + .word 48526 + .word 12694 + .word 0 + .word 0 + .word 0 + .word 59870 + .word 38783 + .word 12663 + .word 0 + .word 0 + .word 0 + .word 26560 + .word 33165 + .word 12632 + .word 0 + .word 0 + .word 0 + .word 58666 + .word 37666 + .word 12601 + .word 0 + .word 0 + .word 0 + .word 58728 + .word 39788 + .word 12569 + .word 0 + .word 0 + .word 0 + .word 9048 + .word 43530 + .word 12538 + .word 0 + .word 0 + .word 0 + .word 58496 + .word 57659 + .word 12505 + .word 0 + .word 0 + .word 0 + .word 12324 + .word 37025 + .word 12477 + .word 0 + .word 0 + .word 0 + .word 38432 + .word 55856 + .word 12445 + .word 0 + .word 0 + .word 0 + .word 35210 + .word 45960 + .word 12415 + .word 0 + .word 0 + .word 0 + .word 45644 + .word 51345 + .word 12384 + .word 0 + .word 0 + .word 0 + .word 32854 + .word 63883 + .word 12353 + .word 0 + .word 0 + .word 0 + .word 29348 + .word 41450 + .word 12321 + .word 0 + .word 0 + .word 0 + .word 27384 + .word 38024 + .word 12289 + .word 0 + .word 0 + .word 0 + .word 57356 + .word 57291 + .word 12260 + .word 0 + .word 0 + .word 0 + .word 61164 + .word 51521 + .word 12228 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 59151 + .word 12196 + .word 0 + .word 0 + .word 0 + .word 36704 + .word 39943 + .word 12165 + .word 0 + .word 0 + .word 0 + .word 45864 + .word 50151 + .word 12136 + .word 0 + .word 0 + .word 0 + .word 37892 + .word 63687 + .word 12104 + .word 0 + .word 0 + .word 0 + .word 14560 + .word 51615 + .word 12073 + .word 0 + .word 0 + .word 0 + .word 38776 + .word 55684 + .word 12041 + .word 0 + .word 0 + .word 0 + .word 59136 + .word 53570 + .word 12010 + .word 0 + .word 0 + .word 0 + .word 55556 + .word 37955 + .word 11981 + .word 0 + .word 0 + .word 0 + .word 54458 + .word 44670 + .word 11950 + .word 0 + .word 0 + .word 0 + .word 36446 + .word 34084 + .word 11919 + .word 0 + .word 0 + .word 0 + .word 46416 + .word 51693 + .word 11886 + .word 0 + .word 0 + .word 0 + .word 21432 + .word 34376 + .word 11857 + .word 0 + .word 0 + .word 0 + .word 56036 + .word 34809 + .word 11826 + .word 0 + .word 0 + .word 0 + .word 10562 + .word 55654 + .word 11795 + .word 0 + .word 0 + .word 0 + .word 20264 + .word 53052 + .word 11763 + .word 0 + .word 0 + .word 0 + .word 64064 + .word 50415 + .word 11729 + .word 0 + .word 0 + .word 0 + .word 17444 + .word 48295 + .word 11701 + .word 0 + .word 0 + .word 0 + .word 11874 + .word 52677 + .word 11671 + .word 0 + .word 0 + .word 0 + .word 60808 + .word 39275 + .word 11640 + .word 0 + .word 0 + .word 0 + .word 31792 + .word 55677 + .word 11606 + .word 0 + .word 0 + .word 0 + .word 60710 + .word 49006 + .word 11578 + .word 0 + .word 0 + .word 0 + .word 10520 + .word 37403 + .word 11546 + .word 0 + .word 0 + .word 0 + .word 20004 + .word 59470 + .word 11515 + .word 0 + .word 0 + .word 0 + .word 28096 + .word 37612 + .word 11485 + .word 0 + .word 0 + .word 0 + .word 20268 + .word 44280 + .word 11453 + .word 0 + .word 0 + .word 0 + .word 50740 + .word 61588 + .word 11422 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 58835 + .word 11390 + .word 0 + .word 0 + .word 0 + .word 8576 + .word 42496 + .word 11355 + .word 0 + .word 0 + .word 0 + .word 33920 + .word 54912 + .word 11324 + .word 0 + .word 0 + .word 0 + .word 35620 + .word 54843 + .word 11298 + .word 0 + .word 0 + .word 0 + .word 736 + .word 43591 + .word 11264 + .word 0 + .word 0 + .word 0 + .word 39632 + .word 61060 + .word 11235 + .word 0 + .word 0 + .word 0 + .word 63452 + .word 63129 + .word 11206 + .word 0 + .word 0 + .word 0 + .word 56798 + .word 58512 + .word 11175 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 46333 + .word 11141 + .word 0 + .word 0 + .word 0 + .word 37300 + .word 36598 + .word 11112 + .word 0 + .word 0 + .word 0 + .word 41952 + .word 41639 + .word 11079 + .word 0 + .word 0 + .word 0 + .word 52452 + .word 33459 + .word 11050 + .word 0 + .word 0 + .word 0 + .word 58558 + .word 33287 + .word 11020 + .word 0 + .word 0 + .word 0 + .word 7570 + .word 43843 + .word 10989 + .word 0 + .word 0 + .word 0 + .word 59416 + .word 63990 + .word 10957 + .word 0 + .word 0 + .word 0 + .word 65298 + .word 47744 + .word 10927 + .word 0 + .word 0 + .word 0 + .word 21076 + .word 34089 + .word 10896 + .word 0 + .word 0 + .word 0 + .word 7048 + .word 57394 + .word 10865 + .word 0 + .word 0 + .word 0 + .word 12872 + .word 55405 + .word 10832 + .word 0 + .word 0 + .word 0 + .word 12608 + .word 51669 + .word 10798 + .word 0 + .word 0 + .word 0 + .word 5350 + .word 48455 + .word 10772 + .word 0 + .word 0 + .word 0 + .word 23568 + .word 58692 + .word 10740 + .word 0 + .word 0 + .word 0 + .word 40784 + .word 37046 + .word 10708 + .word 0 + .word 0 + .word 0 + .word 38992 + .word 43861 + .word 10678 + .word 0 + .word 0 + .word 0 + .word 10064 + .word 40199 + .word 10648 + .word 0 + .word 0 + .word 0 + .word 26368 + .word 35771 + .word 10611 + .word 0 + .word 0 + .word 0 + .word 23994 + .word 60721 + .word 10586 + .word 0 + .word 0 + .word 0 + .word 25052 + .word 34302 + .word 10554 + .word 0 + .word 0 + .word 0 + .word 39842 + .word 54964 + .word 10524 + .word 0 + .word 0 + .word 0 + .word 11568 + .word 58277 + .word 10491 + .word 0 + .word 0 + .word 0 + .word 26160 + .word 46438 + .word 10461 + .word 0 + .word 0 + .word 0 + .word 23252 + .word 43049 + .word 10431 + .word 0 + .word 0 + .word 0 + .word 35288 + .word 58000 + .word 10400 + .word 0 + .word 0 + .word 0 + .word 14614 + .word 50216 + .word 10369 + .word 0 + .word 0 + .word 0 + .word 1168 + .word 48804 + .word 10336 + .word 0 + .word 0 + .word 0 + .word 60934 + .word 33006 + .word 10307 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 62247 + .word 10272 + .word 0 + .word 0 + .word 0 + .word 59968 + .word 43121 + .word 10240 + .word 0 + .word 0 + .word 0 + .word 25560 + .word 39974 + .word 10212 + .word 0 + .word 0 + .word 0 + .word 1978 + .word 49353 + .word 10183 + .word 0 + .word 0 + .word 0 + .word 16290 + .word 38807 + .word 10152 + .word 0 + .word 0 + .word 0 + .word 8646 + .word 65226 + .word 10121 + .word 0 + .word 0 + .word 0 + .word 56896 + .word 34317 + .word 10088 + .word 0 + .word 0 + .word 0 + .word 40136 + .word 39118 + .word 10057 + .word 0 + .word 0 + .word 0 + .word 14200 + .word 41756 + .word 10026 + .word 0 + .word 0 + .word 0 + .word 59256 + .word 63202 + .word 9995 + .word 0 + .word 0 + .word 0 + .word 22968 + .word 63553 + .word 9965 + .word 0 + .word 0 + .word 0 + .word 736 + .word 44292 + .word 9933 + .word 0 + .word 0 + .word 0 + .word 23186 + .word 37760 + .word 9904 + .word 0 + .word 0 + .word 0 + .word 51008 + .word 34950 + .word 9869 + .word 0 + .word 0 + .word 0 + .word 1664 + .word 64248 + .word 9836 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 35199 + .word 9811 + .word 0 + .word 0 + .word 0 + .word 34656 + .word 63747 + .word 9780 + .word 0 + .word 0 + .word 0 + .word 44330 + .word 49864 + .word 9749 + .word 0 + .word 0 + .word 0 + .word 11654 + .word 35567 + .word 9718 + .word 0 + .word 0 + .word 0 + .word 7924 + .word 58919 + .word 9686 + .word 0 + .word 0 + .word 0 + .word 2532 + .word 32800 + .word 9655 + .word 0 + .word 0 + .word 0 + .word 30024 + .word 53799 + .word 9624 + .word 0 + .word 0 + .word 0 + .word 30172 + .word 64347 + .word 9593 + .word 0 + .word 0 + .word 0 + .word 60036 + .word 51382 + .word 9562 + .word 0 + .word 0 + .word 0 + .word 58576 + .word 33093 + .word 9531 + .word 0 + .word 0 + .word 0 + .word 13888 + .word 38760 + .word 9500 + .word 0 + .word 0 + .word 0 + .word 9322 + .word 52460 + .word 9470 + .word 0 + .word 0 + .word 0 + .word 20944 + .word 41077 + .word 9437 + .word 0 + .word 0 + .word 0 + .word 17976 + .word 41861 + .word 9407 + .word 0 + .word 0 + .word 0 + .word 55176 + .word 55158 + .word 9377 + .word 0 + .word 0 + .word 0 + .word 4976 + .word 35223 + .word 9346 + .word 0 + .word 0 + .word 0 + .word 7816 + .word 39783 + .word 9314 + .word 0 + .word 0 + .word 0 + .word 27656 + .word 55669 + .word 9284 + .word 0 + .word 0 + .word 0 + .word 64944 + .word 53184 + .word 9250 + .word 0 + .word 0 + .word 0 + .word 12544 + .word 49190 + .word 9222 + .word 0 + .word 0 + .word 0 + .word 50612 + .word 44644 + .word 9190 + .word 0 + .word 0 + .word 0 + .word 8832 + .word 63111 + .word 9155 + .word 0 + .word 0 + .word 0 + .word 11744 + .word 36870 + .word 9129 + .word 0 + .word 0 + .word 0 + .word 9404 + .word 63025 + .word 9098 + .word 0 + .word 0 + .word 0 + .word 47316 + .word 43381 + .word 9067 + .word 0 + .word 0 + .word 0 + .word 55716 + .word 47433 + .word 9035 + .word 0 + .word 0 + .word 0 + .word 46414 + .word 48441 + .word 9005 + .word 0 + .word 0 + .word 0 + .word 19116 + .word 39506 + .word 8974 + .word 0 + .word 0 + .word 0 + .word 48060 + .word 53381 + .word 8943 + .word 0 + .word 0 + .word 0 + .word 57112 + .word 50739 + .word 8911 + .word 0 + .word 0 + .word 0 + .word 5840 + .word 60581 + .word 8879 + .word 0 + .word 0 + .word 0 + .word 62112 + .word 57199 + .word 8846 + .word 0 + .word 0 + .word 0 + .word 35908 + .word 59499 + .word 8818 + .word 0 + .word 0 + .word 0 + .word 13760 + .word 48116 + .word 8787 + .word 0 + .word 0 + .word 0 + .word 3136 + .word 56059 + .word 8752 + .word 0 + .word 0 + .word 0 + .word 37596 + .word 39221 + .word 8726 + .word 0 + .word 0 + .word 0 + .word 3232 + .word 48550 + .word 8691 + .word 0 + .word 0 + .word 0 + .word 22872 + .word 42749 + .word 8662 + .word 0 + .word 0 + .word 0 + .word 41948 + .word 40319 + .word 8633 + .word 0 + .word 0 + .word 0 + .word 31196 + .word 64693 + .word 8601 + .word 0 + .word 0 + .word 0 + .word 62052 + .word 52923 + .word 8571 + .word 0 + .word 0 + .word 0 + .word 2750 + .word 33544 + .word 8540 + .word 0 + .word 0 + .word 0 + .word 12462 + .word 46179 + .word 8509 + .word 0 + .word 0 + .word 0 + .word 25128 + .word 45120 + .word 8476 + .word 0 + .word 0 + .word 0 + .word 51634 + .word 62523 + .word 8447 + .word 0 + .word 0 + .word 0 + .word 15758 + .word 42163 + .word 8416 + .word 0 + .word 0 + .word 0 + .word 34022 + .word 36267 + .word 8385 + .word 0 + .word 0 + .word 0 + .word 41252 + .word 39796 + .word 8353 + .word 0 + .word 0 + .word 0 + .word 49782 + .word 54423 + .word 8323 + .word 0 + .word 0 + .word 0 + .word 25428 + .word 42086 + .word 8291 + .word 0 + .word 0 + .word 0 + .word 34388 + .word 44810 + .word 8260 + .word 0 + .word 0 + .word 0 + .word 7456 + .word 64092 + .word 8228 + .word 0 + .word 0 + .word 0 + .word 48336 + .word 62448 + .word 8196 + .word 0 + .word 0 + .word 0 + .word 60912 + .word 61622 + .word 8167 + .word 0 + .word 0 + .word 0 + .word 17852 + .word 37250 + .word 8137 + .word 0 + .word 0 + .word 0 + .word 57940 + .word 56453 + .word 8106 + .word 0 + .word 0 + .word 0 + .word 47256 + .word 59825 + .word 8074 + .word 0 + .word 0 + .word 0 + .word 3774 + .word 59120 + .word 8044 + .word 0 + .word 0 + .word 0 + .word 43448 + .word 62852 + .word 8012 + .word 0 + .word 0 + .word 0 + .word 4840 + .word 57195 + .word 7982 + .word 0 + .word 0 + .word 0 + .word 40862 + .word 52565 + .word 7951 + .word 0 + .word 0 + .word 0 + .word 1440 + .word 60474 + .word 7919 + .word 0 + .word 0 + .word 0 + .word 55520 + .word 38648 + .word 7889 + .word 0 + .word 0 + .word 0 + .word 15316 + .word 52422 + .word 7857 + .word 0 + .word 0 + .word 0 + .word 18704 + .word 47227 + .word 7827 + .word 0 + .word 0 + .word 0 + .word 48892 + .word 54283 + .word 7795 + .word 0 + .word 0 + .word 0 + .word 12670 + .word 41990 + .word 7765 + .word 0 + .word 0 + .word 0 + .word 27570 + .word 49842 + .word 7734 + .word 0 + .word 0 + .word 0 + .word 47230 + .word 47992 + .word 7703 + .word 0 + .word 0 + .word 0 + .word 41020 + .word 56253 + .word 7671 + .word 0 + .word 0 + .word 0 + .word 23404 + .word 58312 + .word 7641 + .word 0 + .word 0 + .word 0 + .word 35176 + .word 51854 + .word 7610 + .word 0 + .word 0 + .word 0 + .word 49188 + .word 59051 + .word 7578 + .word 0 + .word 0 + .word 0 + .word 16656 + .word 54507 + .word 7546 + .word 0 + .word 0 + .word 0 + .word 41320 + .word 48565 + .word 7517 + .word 0 + .word 0 + .word 0 + .word 302 + .word 42490 + .word 7486 + .word 0 + .word 0 + .word 0 + .word 26680 + .word 39967 + .word 7454 + .word 0 + .word 0 + .word 0 + .word 41304 + .word 43638 + .word 7424 + .word 0 + .word 0 + .word 0 + .word 2314 + .word 48533 + .word 7393 + .word 0 + .word 0 + .word 0 + .word 63294 + .word 35693 + .word 7362 + .word 0 + .word 0 + .word 0 + .word 24538 + .word 48319 + .word 7331 + .word 0 + .word 0 + .word 0 + .word 56296 + .word 47263 + .word 7300 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 38599 + .word 7268 + .word 0 + .word 0 + .word 0 + .word 6594 + .word 62116 + .word 7238 + .word 0 + .word 0 + .word 0 + .word 47104 + .word 63573 + .word 7198 + .word 0 + .word 0 + .word 0 + .word 34812 + .word 34303 + .word 7176 + .word 0 + .word 0 + .word 0 + .word 5144 + .word 33695 + .word 7145 + .word 0 + .word 0 + .word 0 + .word 24966 + .word 55768 + .word 7114 + .word 0 + .word 0 + .word 0 + .word 62720 + .word 43946 + .word 7078 + .word 0 + .word 0 + .word 0 + .word 31542 + .word 56062 + .word 7052 + .word 0 + .word 0 + .word 0 + .word 62356 + .word 59096 + .word 7020 + .word 0 + .word 0 + .word 0 + .word 28412 + .word 40533 + .word 6990 + .word 0 + .word 0 + .word 0 + .word 24080 + .word 50467 + .word 6958 + .word 0 + .word 0 + .word 0 + .word 33296 + .word 46841 + .word 6925 + .word 0 + .word 0 + .word 0 + .word 39600 + .word 38627 + .word 6897 + .word 0 + .word 0 + .word 0 + .word 14436 + .word 37607 + .word 6865 + .word 0 + .word 0 + .word 0 + .word 39032 + .word 56421 + .word 6833 + .word 0 + .word 0 + .word 0 + .word 64032 + .word 54987 + .word 6804 + .word 0 + .word 0 + .word 0 + .word 27648 + .word 42212 + .word 6768 + .word 0 + .word 0 + .word 0 + .word 43840 + .word 46107 + .word 6739 + .word 0 + .word 0 + .word 0 + .word 17316 + .word 36574 + .word 6711 + .word 0 + .word 0 + .word 0 + .word 8928 + .word 37652 + .word 6677 + .word 0 + .word 0 + .word 0 + .word 24944 + .word 47433 + .word 6648 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 57430 + .word 6616 + .word 0 + .word 0 + .word 0 + .word 39848 + .word 43340 + .word 6585 + .word 0 + .word 0 + .word 0 + .word 64160 + .word 43542 + .word 6555 + .word 0 + .word 0 + .word 0 + .word 35226 + .word 63015 + .word 6525 + .word 0 + .word 0 + .word 0 + .word 40736 + .word 64368 + .word 6493 + .word 0 + .word 0 + .word 0 + .word 42168 + .word 49526 + .word 6462 + .word 0 + .word 0 + .word 0 + .word 45596 + .word 34243 + .word 6432 + .word 0 + .word 0 + .word 0 + .word 20690 + .word 39705 + .word 6401 + .word 0 + .word 0 + .word 0 + .word 54448 + .word 46856 + .word 6368 + .word 0 + .word 0 + .word 0 + .word 64392 + .word 62736 + .word 6337 + .word 0 + .word 0 + .word 0 + .word 12780 + .word 56461 + .word 6307 + .word 0 + .word 0 + .word 0 + .word 15360 + .word 49145 + .word 6277 + .word 0 + .word 0 + .word 0 + .word 20512 + .word 49931 + .word 6242 + .word 0 + .word 0 + .word 0 + .word 54512 + .word 55820 + .word 6212 + .word 0 + .word 0 + .word 0 + .word 8402 + .word 39333 + .word 6184 + .word 0 + .word 0 + .word 0 + .word 34094 + .word 53593 + .word 6153 + .word 0 + .word 0 + .word 0 + .word 31960 + .word 38817 + .word 6121 + .word 0 + .word 0 + .word 0 + .word 16954 + .word 39291 + .word 6091 + .word 0 + .word 0 + .word 0 + .word 49600 + .word 48765 + .word 6056 + .word 0 + .word 0 + .word 0 + .word 59580 + .word 56541 + .word 6029 + .word 0 + .word 0 + .word 0 + .word 35624 + .word 44550 + .word 5998 + .word 0 + .word 0 + .word 0 + .word 4142 + .word 47316 + .word 5967 + .word 0 + .word 0 + .word 0 + .word 43520 + .word 43612 + .word 5935 + .word 0 + .word 0 + .word 0 + .word 20976 + .word 40896 + .word 5902 + .word 0 + .word 0 + .word 0 + .word 63576 + .word 57729 + .word 5874 + .word 0 + .word 0 + .word 0 + .word 37288 + .word 33122 + .word 5843 + .word 0 + .word 0 + .word 0 + .word 24384 + .word 52079 + .word 5809 + .word 0 + .word 0 + .word 0 + .word 47952 + .word 58719 + .word 5779 + .word 0 + .word 0 + .word 0 + .word 44242 + .word 55445 + .word 5750 + .word 0 + .word 0 + .word 0 + .word 61232 + .word 38847 + .word 5716 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 46039 + .word 5683 + .word 0 + .word 0 + .word 0 + .word 13396 + .word 42933 + .word 5657 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 43305 + .word 5622 + .word 0 + .word 0 + .word 0 + .word 40708 + .word 35319 + .word 5595 + .word 0 + .word 0 + .word 0 + .word 44408 + .word 55685 + .word 5564 + .word 0 + .word 0 + .word 0 + .word 42090 + .word 44607 + .word 5533 + .word 0 + .word 0 + .word 0 + .word 25504 + .word 53466 + .word 5500 + .word 0 + .word 0 + .word 0 + .word 24208 + .word 33149 + .word 5470 + .word 0 + .word 0 + .word 0 + .word 5268 + .word 45375 + .word 5440 + .word 0 + .word 0 + .word 0 + .word 144 + .word 40000 + .word 5409 + .word 0 + .word 0 + .word 0 + .word 56688 + .word 52358 + .word 5376 + .word 0 + .word 0 + .word 0 + .word 25848 + .word 56175 + .word 5345 + .word 0 + .word 0 + .word 0 + .word 57900 + .word 44055 + .word 5315 + .word 0 + .word 0 + .word 0 + .word 24800 + .word 43437 + .word 5283 + .word 0 + .word 0 + .word 0 + .word 17984 + .word 54872 + .word 5249 + .word 0 + .word 0 + .word 0 + .word 25744 + .word 41345 + .word 5223 + .word 0 + .word 0 + .word 0 + .word 7668 + .word 43682 + .word 5191 + .word 0 + .word 0 + .word 0 + .word 47434 + .word 36705 + .word 5161 + .word 0 + .word 0 + .word 0 + .word 20888 + .word 40323 + .word 5129 + .word 0 + .word 0 + .word 0 + .word 3962 + .word 43032 + .word 5099 + .word 0 + .word 0 + .word 0 + .word 50270 + .word 49260 + .word 5068 + .word 0 + .word 0 + .word 0 + .word 20160 + .word 64041 + .word 5032 + .word 0 + .word 0 + .word 0 + .word 25624 + .word 36013 + .word 5004 + .word 0 + .word 0 + .word 0 + .word 48328 + .word 59345 + .word 4975 + .word 0 + .word 0 + .word 0 + .word 51508 + .word 63920 + .word 4943 + .word 0 + .word 0 + .word 0 + .word 27872 + .word 39135 + .word 4913 + .word 0 + .word 0 + .word 0 + .word 13590 + .word 58857 + .word 4882 + .word 0 + .word 0 + .word 0 + .word 50880 + .word 61323 + .word 4847 + .word 0 + .word 0 + .word 0 + .word 44802 + .word 37181 + .word 4820 + .word 0 + .word 0 + .word 0 + .word 53808 + .word 57813 + .word 4789 + .word 0 + .word 0 + .word 0 + .word 64424 + .word 49714 + .word 4757 + .word 0 + .word 0 + .word 0 + .word 31652 + .word 44011 + .word 4727 + .word 0 + .word 0 + .word 0 + .word 28252 + .word 50834 + .word 4696 + .word 0 + .word 0 + .word 0 + .word 30370 + .word 38742 + .word 4665 + .word 0 + .word 0 + .word 0 + .word 57728 + .word 58403 + .word 4628 + .word 0 + .word 0 + .word 0 + .word 35900 + .word 37112 + .word 4603 + .word 0 + .word 0 + .word 0 + .word 40764 + .word 40914 + .word 4572 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 46910 + .word 4541 + .word 0 + .word 0 + .word 0 + .word 17854 + .word 35030 + .word 4510 + .word 0 + .word 0 + .word 0 + .word 4378 + .word 35776 + .word 4479 + .word 0 + .word 0 + .word 0 + .word 57962 + .word 55295 + .word 4448 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 56717 + .word 4415 + .word 0 + .word 0 + .word 0 + .word 37744 + .word 49416 + .word 4384 + .word 0 + .word 0 + .word 0 + .word 38484 + .word 35759 + .word 4355 + .word 0 + .word 0 + .word 0 + .word 55020 + .word 54969 + .word 4324 + .word 0 + .word 0 + .word 0 + .word 9188 + .word 55223 + .word 4292 + .word 0 + .word 0 + .word 0 + .word 6822 + .word 43079 + .word 4262 + .word 0 + .word 0 + .word 0 + .word 48870 + .word 40943 + .word 4231 + .word 0 + .word 0 + .word 0 + .word 9936 + .word 42731 + .word 4198 + .word 0 + .word 0 + .word 0 + .word 23430 + .word 43136 + .word 4169 + .word 0 + .word 0 + .word 0 + .word 4700 + .word 55665 + .word 4137 + .word 0 + .word 0 + .word 0 + .word 8056 + .word 40216 + .word 4106 + .word 0 + .word 0 + .word 0 + .word 3716 + .word 45403 + .word 4075 + .word 0 + .word 0 + .word 0 + .word 53440 + .word 49488 + .word 4044 + .word 0 + .word 0 + .word 0 + .word 41776 + .word 50188 + .word 4013 + .word 0 + .word 0 + .word 0 + .word 20994 + .word 64556 + .word 3983 + .word 0 + .word 0 + .word 0 + .word 16252 + .word 60661 + .word 3951 + .word 0 + .word 0 + .word 0 + .word 61252 + .word 65021 + .word 3920 + .word 0 + .word 0 + .word 0 + .word 16236 + .word 43803 + .word 3889 + .word 0 + .word 0 + .word 0 + .word 63064 + .word 35308 + .word 3857 + .word 0 + .word 0 + .word 0 + .word 49096 + .word 39848 + .word 3828 + .word 0 + .word 0 + .word 0 + .word 15680 + .word 48673 + .word 3797 + .word 0 + .word 0 + .word 0 + .word 48068 + .word 50957 + .word 3766 + .word 0 + .word 0 + .word 0 + .word 20824 + .word 56086 + .word 3734 + .word 0 + .word 0 + .word 0 + .word 46504 + .word 43224 + .word 3704 + .word 0 + .word 0 + .word 0 + .word 52428 + .word 46094 + .word 3672 + .word 0 + .word 0 + .word 0 + .word 17548 + .word 52066 + .word 3642 + .word 0 + .word 0 + .word 0 + .word 61738 + .word 35565 + .word 3611 + .word 0 + .word 0 + .word 0 + .word 31184 + .word 50588 + .word 3579 + .word 0 + .word 0 + .word 0 + .word 1716 + .word 52681 + .word 3549 + .word 0 + .word 0 + .word 0 + .word 44656 + .word 43385 + .word 3518 + .word 0 + .word 0 + .word 0 + .word 12668 + .word 43259 + .word 3486 + .word 0 + .word 0 + .word 0 + .word 24544 + .word 35408 + .word 3453 + .word 0 + .word 0 + .word 0 + .word 28854 + .word 65018 + .word 3425 + .word 0 + .word 0 + .word 0 + .word 5696 + .word 40391 + .word 3393 + .word 0 + .word 0 + .word 0 + .word 39580 + .word 56400 + .word 3363 + .word 0 + .word 0 + .word 0 + .word 20428 + .word 39579 + .word 3332 + .word 0 + .word 0 + .word 0 + .word 32328 + .word 36727 + .word 3301 + .word 0 + .word 0 + .word 0 + .word 34020 + .word 54457 + .word 3270 + .word 0 + .word 0 + .word 0 + .word 34016 + .word 48400 + .word 3238 + .word 0 + .word 0 + .word 0 + .word 6922 + .word 51417 + .word 3208 + .word 0 + .word 0 + .word 0 + .word 27208 + .word 64641 + .word 3176 + .word 0 + .word 0 + .word 0 + .word 1802 + .word 48886 + .word 3146 + .word 0 + .word 0 + .word 0 + .word 35440 + .word 61590 + .word 3115 + .word 0 + .word 0 + .word 0 + .word 60610 + .word 51604 + .word 3084 + .word 0 + .word 0 + .word 0 + .word 5440 + .word 38199 + .word 3050 + .word 0 + .word 0 + .word 0 + .word 6914 + .word 43867 + .word 3022 + .word 0 + .word 0 + .word 0 + .word 24000 + .word 45256 + .word 2989 + .word 0 + .word 0 + .word 0 + .word 51496 + .word 57396 + .word 2959 + .word 0 + .word 0 + .word 0 + .word 11538 + .word 46256 + .word 2929 + .word 0 + .word 0 + .word 0 + .word 36802 + .word 48020 + .word 2898 + .word 0 + .word 0 + .word 0 + .word 57910 + .word 57903 + .word 2867 + .word 0 + .word 0 + .word 0 + .word 47484 + .word 48798 + .word 2835 + .word 0 + .word 0 + .word 0 + .word 57766 + .word 57709 + .word 2805 + .word 0 + .word 0 + .word 0 + .word 54064 + .word 47856 + .word 2774 + .word 0 + .word 0 + .word 0 + .word 49340 + .word 48080 + .word 2743 + .word 0 + .word 0 + .word 0 + .word 36454 + .word 56731 + .word 2712 + .word 0 + .word 0 + .word 0 + .word 51548 + .word 63385 + .word 2681 + .word 0 + .word 0 + .word 0 + .word 56000 + .word 48716 + .word 2645 + .word 0 + .word 0 + .word 0 + .word 44992 + .word 50040 + .word 2615 + .word 0 + .word 0 + .word 0 + .word 43136 + .word 58177 + .word 2585 + .word 0 + .word 0 + .word 0 + .word 49730 + .word 33270 + .word 2557 + .word 0 + .word 0 + .word 0 + .word 29808 + .word 51063 + .word 2526 + .word 0 + .word 0 + .word 0 + .word 25276 + .word 46724 + .word 2494 + .word 0 + .word 0 + .word 0 + .word 17324 + .word 35928 + .word 2463 + .word 0 + .word 0 + .word 0 + .word 52284 + .word 63916 + .word 2433 + .word 0 + .word 0 + .word 0 + .word 5414 + .word 46704 + .word 2402 + .word 0 + .word 0 + .word 0 + .word 51710 + .word 57168 + .word 2371 + .word 0 + .word 0 + .word 0 + .word 27366 + .word 49253 + .word 2340 + .word 0 + .word 0 + .word 0 + .word 45332 + .word 53033 + .word 2309 + .word 0 + .word 0 + .word 0 + .word 54152 + .word 37418 + .word 2276 + .word 0 + .word 0 + .word 0 + .word 53076 + .word 47398 + .word 2247 + .word 0 + .word 0 + .word 0 + .word 14374 + .word 59477 + .word 2216 + .word 0 + .word 0 + .word 0 + .word 59336 + .word 33435 + .word 2184 + .word 0 + .word 0 + .word 0 + .word 21612 + .word 43267 + .word 2154 + .word 0 + .word 0 + .word 0 + .word 34664 + .word 39372 + .word 2121 + .word 0 + .word 0 + .word 0 + .word 172 + .word 62761 + .word 2091 + .word 0 + .word 0 + .word 0 + .word 9816 + .word 40715 + .word 2060 + .word 0 + .word 0 + .word 0 + .word 65116 + .word 40481 + .word 2030 + .word 0 + .word 0 + .word 0 + .word 28066 + .word 39184 + .word 1999 + .word 0 + .word 0 + .word 0 + .word 37408 + .word 63923 + .word 1968 + .word 0 + .word 0 + .word 0 + .word 15760 + .word 42305 + .word 1937 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 59340 + .word 1905 + .word 0 + .word 0 + .word 0 + .word 43258 + .word 59402 + .word 1875 + .word 0 + .word 0 + .word 0 + .word 19988 + .word 50087 + .word 1844 + .word 0 + .word 0 + .word 0 + .word 63456 + .word 47833 + .word 1810 + .word 0 + .word 0 + .word 0 + .word 65184 + .word 61426 + .word 1781 + .word 0 + .word 0 + .word 0 + .word 52982 + .word 48456 + .word 1751 + .word 0 + .word 0 + .word 0 + .word 30020 + .word 62809 + .word 1719 + .word 0 + .word 0 + .word 0 + .word 9096 + .word 63061 + .word 1688 + .word 0 + .word 0 + .word 0 + .word 59648 + .word 44374 + .word 1654 + .word 0 + .word 0 + .word 0 + .word 11456 + .word 33847 + .word 1625 + .word 0 + .word 0 + .word 0 + .word 12392 + .word 50500 + .word 1595 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 59196 + .word 1563 + .word 0 + .word 0 + .word 0 + .word 61008 + .word 40265 + .word 1532 + .word 0 + .word 0 + .word 0 + .word 37842 + .word 33270 + .word 1503 + .word 0 + .word 0 + .word 0 + .word 37916 + .word 44543 + .word 1471 + .word 0 + .word 0 + .word 0 + .word 11490 + .word 36421 + .word 1441 + .word 0 + .word 0 + .word 0 + .word 19040 + .word 38397 + .word 1409 + .word 0 + .word 0 + .word 0 + .word 31224 + .word 47162 + .word 1379 + .word 0 + .word 0 + .word 0 + .word 52056 + .word 41461 + .word 1347 + .word 0 + .word 0 + .word 0 + .word 10810 + .word 56374 + .word 1317 + .word 0 + .word 0 + .word 0 + .word 5358 + .word 35086 + .word 1286 + .word 0 + .word 0 + .word 0 + .word 36640 + .word 50226 + .word 1251 + .word 0 + .word 0 + .word 0 + .word 33856 + .word 45597 + .word 1222 + .word 0 + .word 0 + .word 0 + .word 21552 + .word 63128 + .word 1191 + .word 0 + .word 0 + .word 0 + .word 1198 + .word 35616 + .word 1162 + .word 0 + .word 0 + .word 0 + .word 1232 + .word 59506 + .word 1131 + .word 0 + .word 0 + .word 0 + .word 51086 + .word 34963 + .word 1100 + .word 0 + .word 0 + .word 0 + .word 3960 + .word 39061 + .word 1067 + .word 0 + .word 0 + .word 0 + .word 4564 + .word 57134 + .word 1037 + .word 0 + .word 0 + .word 0 + .word 59468 + .word 35285 + .word 1007 + .word 0 + .word 0 + .word 0 + .word 63422 + .word 35431 + .word 976 + .word 0 + .word 0 + .word 0 + .word 38352 + .word 51462 + .word 945 + .word 0 + .word 0 + .word 0 + .word 25806 + .word 55660 + .word 914 + .word 0 + .word 0 + .word 0 + .word 38842 + .word 41327 + .word 883 + .word 0 + .word 0 + .word 0 + .word 17980 + .word 50458 + .word 852 + .word 0 + .word 0 + .word 0 + .word 61194 + .word 59710 + .word 821 + .word 0 + .word 0 + .word 0 + .word 21098 + .word 42086 + .word 790 + .word 0 + .word 0 + .word 0 + .word 16704 + .word 43341 + .word 757 + .word 0 + .word 0 + .word 0 + .word 46316 + .word 52840 + .word 728 + .word 0 + .word 0 + .word 0 + .word 20386 + .word 33936 + .word 697 + .word 0 + .word 0 + .word 0 + .word 20064 + .word 51864 + .word 664 + .word 0 + .word 0 + .word 0 + .word 2268 + .word 57500 + .word 634 + .word 0 + .word 0 + .word 0 + .word 11152 + .word 51171 + .word 604 + .word 0 + .word 0 + .word 0 + .word 23164 + .word 63727 + .word 572 + .word 0 + .word 0 + .word 0 + .word 20514 + .word 40280 + .word 542 + .word 0 + .word 0 + .word 0 + .word 21818 + .word 57922 + .word 511 + .word 0 + .word 0 + .word 0 + .word 32366 + .word 46413 + .word 480 + .word 0 + .word 0 + .word 0 + .word 53972 + .word 43148 + .word 449 + .word 0 + .word 0 + .word 0 + .word 30134 + .word 65133 + .word 418 + .word 0 + .word 0 + .word 0 + .word 15282 + .word 61516 + .word 387 + .word 0 + .word 0 + .word 0 + .word 49872 + .word 49222 + .word 355 + .word 0 + .word 0 + .word 0 + .word 9484 + .word 63958 + .word 325 + .word 0 + .word 0 + .word 0 + .word 47028 + .word 35341 + .word 294 + .word 0 + .word 0 + .word 0 + .word 6770 + .word 58613 + .word 263 + .word 0 + .word 0 + .word 0 + .word 33372 + .word 43448 + .word 232 + .word 0 + .word 0 + .word 0 + .word 27792 + .word 51629 + .word 198 + .word 0 + .word 0 + .word 0 + .word 19712 + .word 53691 + .word 170 + .word 0 + .word 0 + .word 0 + .word 42144 + .word 60929 + .word 135 + .word 0 + .word 0 + .word 0 + .word 35240 + .word 48799 + .word 107 + .word 0 + .word 0 + .word 0 + .word 910 + .word 51212 + .word 77 + .word 0 + .word 0 + .word 0 + .word 65062 + .word 33668 + .word 46 + .word 0 + .word 0 + .word 0 + .word 52624 + .word 51799 + .word 14 + .word 0 + .type __4onpi_31l,@object + .size __4onpi_31l,6444 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_scalbl_k80.S b/external/sgx_libm/ia32/libm_scalbl_k80.S new file mode 100644 index 0000000000..72e69a7f51 --- /dev/null +++ b/external/sgx_libm/ia32/libm_scalbl_k80.S @@ -0,0 +1,264 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_scalbl_k80.c" + .text +..TXTST0: +# -- Begin __libm_scalbl_k80 + .text + .align 16,0x90 + .hidden __libm_scalbl_k80 + .globl __libm_scalbl_k80 +__libm_scalbl_k80: +# parameter 1: 48 + %esp +# parameter 2: 60 + %esp +# parameter 3: 72 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %ebx + subl $36, %esp + fldt 60(%esp) + fldt 48(%esp) + fld %st(0) + movl 72(%esp), %ebx + fadd %st(2), %st + cmpl $0, 52(%esp) + jne ..B1.4 +..B1.2: + cmpl $0, 48(%esp) + jne ..B1.4 +..B1.3: + fstp %st(2) + fstp %st(1) + fstpt 24(%esp) + fldt 24(%esp) + addl $36, %esp + popl %ebx + popl %esi + ret +..B1.4: + movzwl 56(%esp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.3 +..B1.5: + fstpt 24(%esp) + fldt 24(%esp) + movzwl 32(%esp), %esi + movl %esi, %edx + andl $32767, %edx + lea -1(%ebx,%edx), %ecx + cmpl $32765, %ecx + lea (%ebx,%edx), %eax + ja ..B1.7 +..B1.6: + fstp %st(1) + fstp %st(1) + fstp %st(0) + andl $-32768, %esi + andl $32767, %eax + orl %eax, %esi + movw %si, 32(%esp) + fldt 24(%esp) + addl $36, %esp + popl %ebx + popl %esi + ret +..B1.7: + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $32766, %eax + jle ..B1.9 +..B1.8: + fstp %st(2) + fstp %st(1) + fldt _CONSTANTS@GOTOFF(%ecx) + fmul %st(0), %st + fmulp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) + addl $36, %esp + popl %ebx + popl %esi + ret +..B1.9: + cmpl $-63, %eax + fldt 12+_CONSTANTS@GOTOFF(%ecx) + jge ..B1.11 +..B1.10: + fstp %st(3) + fstp %st(0) + fxch %st(1) + fmul %st(0), %st + fmulp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) + addl $36, %esp + popl %ebx + popl %esi + ret +..B1.11: + cmpl $-19, %eax + jge ..B1.13 +..B1.12: + fstp %st(2) + fstp %st(2) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + movzwl 8+.L_2il0floatpacket.0@GOTOFF(%ecx), %eax + andl $-32768, %eax + fstpt (%esp) + fmul %st(0), %st + faddp %st, %st(1) + fstpt 24(%esp) + movzwl 32(%esp), %edx + lea 256(%ebx,%edx), %ebx + andl $-32768, %edx + andl $32767, %ebx + orl $-49409, %edx + orl %ebx, %eax + movw %ax, 8(%esp) + fldt (%esp) + movw %dx, 32(%esp) + fldt 24(%esp) + fmulp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) + addl $36, %esp + popl %ebx + popl %esi + ret +..B1.13: + fstp %st(1) + fldt 24+_CONSTANTS@GOTOFF(%ecx) + fxch %st(1) + fmul %st(0), %st + movzwl 8+.L_2il0floatpacket.0@GOTOFF(%ecx), %eax + faddp %st, %st(2) + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + andl $-32768, %eax + fmul %st(2), %st + fld %st(0) + fsub %st(3), %st + fsubrp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fsubrp %st, %st(2) + movzwl 20(%esp), %edx + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + lea -16383(%edx), %esi + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + negl %esi + addl $16383, %esi + lea -32512(%ebx,%edx), %ecx + andl $32767, %esi + andl $32767, %ecx + fstpt (%esp) + orl %esi, %eax + movw %ax, 8(%esp) + movl %edx, %esi + fldt (%esp) + andl $-32768, %esi + fmulp %st, %st(1) + andl $-32768, %eax + orl $-49409, %esi + orl %ecx, %eax + movw %si, 20(%esp) + fldt 12(%esp) + movw %ax, 8(%esp) + fldt (%esp) + fmul %st, %st(1) + fxch %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) +..B1.14: + addl $36, %esp + popl %ebx + popl %esi + ret + .align 16,0x90 + .type __libm_scalbl_k80,@function + .size __libm_scalbl_k80,.-__libm_scalbl_k80 + .data +# -- End __libm_scalbl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16127 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,36 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_sincos_huge.S b/external/sgx_libm/ia32/libm_sincos_huge.S new file mode 100644 index 0000000000..b25c4d96b5 --- /dev/null +++ b/external/sgx_libm/ia32/libm_sincos_huge.S @@ -0,0 +1,708 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sincos_huge.c" + .text +..TXTST0: +# -- Begin __libm_sincos_huge + .text + .align 16,0x90 + .hidden __libm_sincos_huge + .globl __libm_sincos_huge +__libm_sincos_huge: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + movl 16(%ebp), %eax + movl 20(%ebp), %edx + movl %eax, 16(%esp) + movl %edx, 20(%esp) + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 40(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + fldl 8(%ebp) + movl 12(%ebp), %edi + movl %edi, %eax + andl $2147483647, %eax + fabs + shrl $31, %edi + movl %eax, 24(%esp) + cmpl $1104150528, %eax + fstl 8(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jae ..B1.14 +..B1.4: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + fldl _Pi4Inv@GOTOFF(%ebx) + fmul %st(1), %st + fstpl (%esp) + je ..B1.52 +..B1.5: + fstp %st(0) + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.6: + fldcw 12(%esp) +..B1.7: + fldl 8(%ebp) + movl $1, %esi +..B1.8: + movl (%esp), %eax + movl 4(%esp), %edx + movl %edx, %ecx + movl %eax, 8(%esp) + movl %edx, %eax + andl $1048575, %eax + shrl $20, %ecx + orl $1048576, %eax + cmpl $1094713344, %edx + jae ..B1.10 +..B1.9: + negl %ecx + addl $19, %ecx + shrl %cl, %eax + jmp ..B1.11 +..B1.10: + movl %ecx, %edx + lea 13(%edx), %ecx + negl %edx + addl $19, %edx + shll %cl, %eax + movl %edx, %ecx + movl 8(%esp), %edx + shrl %cl, %edx + orl %edx, %eax +..B1.11: + lea 1(%eax), %edx + movl %edx, %ecx + andl $-2, %ecx + movl %ecx, (%esp) + fildl (%esp) + cmpl $1094713344, 24(%esp) + jae ..B1.13 +..B1.12: + fldl _Pi4x3@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(2) + fldl 8+_Pi4x3@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(2) + fldl 16+_Pi4x3@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + jmp ..B1.20 +..B1.13: + fldl _Pi4x4@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(2) + fldl 8+_Pi4x4@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(2) + fldl 16+_Pi4x4@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(2) + fldl 24+_Pi4x4@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + jmp ..B1.20 +..B1.14: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.60 +..B1.15: + fstp %st(0) + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.16: + fldcw 12(%esp) +..B1.17: + fldl 8(%ebp) + movl $1, %esi +..B1.18: + addl $-32, %esp + lea 56(%esp), %eax + fstpt (%esp) + movl $0, 12(%esp) + movl %eax, 16(%esp) + call __libm_reduce_pi04l +..B1.63: + addl $32, %esp +..B1.19: + fldl 24(%esp) + lea 1(%eax), %edx + faddl 32(%esp) +..B1.20: + movl %edx, %ecx + addl $3, %eax + shrl $2, %ecx + andl $1, %ecx + shrl $2, %eax + xorl %ecx, %edi + movl 20(%esp), %ecx + andl $1, %eax + andl $3, %ecx + cmpl $3, %ecx + jne ..B1.30 +..B1.21: + fldt 84+_SP@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + testb $2, %dl + fmul %st, %st(1) + fldt 72+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 60+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 84+_CP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 72+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%edi,8) + fldl _ones@GOTOFF(%ebx,%eax,8) + je ..B1.26 +..B1.22: + fmulp %st, %st(4) + testl %esi, %esi + fxch %st(2) + fmul %st(3), %st + movl 16(%esp), %eax + faddp %st, %st(3) + fxch %st(2) + fstpl (%eax) + fmul %st, %st(1) + faddp %st, %st(1) + fstpl 8(%eax) + je ..B1.24 +..B1.23: + fldcw 14(%esp) +..B1.24: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.25: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + fxch %st(1) + fmulp %st, %st(4) + testl %esi, %esi + fxch %st(2) + fmul %st(3), %st + movl 16(%esp), %eax + faddp %st, %st(3) + fxch %st(2) + fstpl 8(%eax) + fmul %st, %st(1) + faddp %st, %st(1) + fstpl (%eax) + je ..B1.28 +..B1.27: + fldcw 14(%esp) +..B1.28: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.29: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.30: + testb $2, 20(%esp) + je ..B1.40 +..B1.31: + fld %st(0) + testb $2, %dl + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + je ..B1.36 +..B1.32: + fstp %st(2) + fldt 84+_CP@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(2), %st + fldt 72+_CP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 60+_CP@GOTOFF(%ebx) + movl 16(%esp), %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%edi,8) + fmul %st, %st(1) + faddp %st, %st(1) + fstpl 8(%eax) + je ..B1.34 +..B1.33: + fldcw 14(%esp) +..B1.34: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.35: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.36: + fldt 84+_SP@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(1), %st + fxch %st(3) + fmull _ones@GOTOFF(%ebx,%edi,8) + fldt 72+_SP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 60+_SP@GOTOFF(%ebx) + movl 16(%esp), %eax + faddp %st, %st(5) + fxch %st(2) + fmul %st, %st(4) + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(5) + fmul %st, %st(4) + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(5) + fmulp %st, %st(4) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + faddp %st, %st(1) + fstpl 8(%eax) + je ..B1.38 +..B1.37: + fldcw 14(%esp) +..B1.38: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.39: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.40: + testb $1, 20(%esp) + je ..B1.50 +..B1.41: + fld %st(0) + testb $2, %dl + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + je ..B1.46 +..B1.42: + fldt 84+_SP@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(1), %st + fxch %st(3) + fmull _ones@GOTOFF(%ebx,%eax,8) + fldt 72+_SP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 60+_SP@GOTOFF(%ebx) + movl 16(%esp), %eax + faddp %st, %st(5) + fxch %st(2) + fmul %st, %st(4) + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(5) + fmul %st, %st(4) + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(5) + fmulp %st, %st(4) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(1) + faddp %st, %st(1) + fstpl (%eax) + je ..B1.44 +..B1.43: + fldcw 14(%esp) +..B1.44: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.45: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + fstp %st(2) + fldt 84+_CP@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(2), %st + fldt 72+_CP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(1) + movl 16(%esp), %eax + faddp %st, %st(1) + fstpl (%eax) + je ..B1.48 +..B1.47: + fldcw 14(%esp) +..B1.48: + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.49: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.50: + fstp %st(0) + movl 40(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.53 +..B1.51: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.52: + xorl %esi, %esi + jmp ..B1.8 +..B1.53: + call __stack_chk_fail@PLT +..B1.60: + xorl %esi, %esi + jmp ..B1.18 + .align 16,0x90 + .type __libm_sincos_huge,@function + .size __libm_sincos_huge,.-__libm_sincos_huge + .data +# -- End __libm_sincos_huge + .section .rodata, "a" + .align 16 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_Pi4x3: + .long 1413754880 + .long 3219726843 + .long 993632256 + .long 1027030475 + .long 3773204808 + .long 3129236486 + .type _Pi4x3,@object + .size _Pi4x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi4x4: + .long 1413480448 + .long 3219726843 + .long 442499072 + .long 3183522913 + .long 771751936 + .long 3146979722 + .long 622873025 + .long 3110831002 + .type _Pi4x4,@object + .size _Pi4x4,32 + .align 16 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 34951 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 50471 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 17910 + .word 46614 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 33371 + .word 14743 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 48947 + .word 35764 + .word 12250 + .word 45202 + .word 16350 + .word 0 + .word 17574 + .word 60698 + .word 10735 + .word 55102 + .word 49110 + .word 0 + .word 34320 + .word 12415 + .word 25249 + .word 51489 + .word 16334 + .word 0 + .type _SP,@object + .size _SP,96 + .align 16 +_CP: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 39983 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 61476 + .word 3244 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 1022 + .word 16229 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 55373 + .word 44526 + .word 50840 + .word 36726 + .word 16354 + .word 0 + .word 55994 + .word 65145 + .word 59958 + .word 51657 + .word 49114 + .word 0 + .word 15046 + .word 2976 + .word 1998 + .word 54661 + .word 16338 + .word 0 + .type _CP,@object + .size _CP,96 + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_sincos_k32.S b/external/sgx_libm/ia32/libm_sincos_k32.S new file mode 100644 index 0000000000..25e11ef7ed --- /dev/null +++ b/external/sgx_libm/ia32/libm_sincos_k32.S @@ -0,0 +1,337 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sincos_k32.c" + .text +..TXTST0: +# -- Begin __libm_sincos_k32 + .text + .align 16,0x90 + .hidden __libm_sincos_k32 + .globl __libm_sincos_k32 +__libm_sincos_k32: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 20 + %ebp +# parameter 4: 24 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + fldl 8(%ebp) + movl 12(%ebp), %edi + movl %edi, %edx + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + andl $2147483647, %edx + fabs + shrl $31, %edi + movl 24(%ebp), %ecx + movl 16(%ebp), %eax + movl 20(%ebp), %ebx + imull iones@GOTOFF(%esi,%edi,4), %ecx + movl %eax, 36(%esp) + cmpl $1103101952, %edx + jae ..B1.9 +..B1.2: + cmpl $1073283072, %edx + ja ..B1.6 +..B1.3: + incl %ecx + movl %ecx, %edx + andl $2, %edx + je ..B1.5 +..B1.4: + fsubl .L_2il0floatpacket.0@GOTOFF(%esi) + fstl 8(%ebp) + jmp ..B1.11 +..B1.5: + fstl 8(%ebp) + jmp ..B1.11 +..B1.6: + fldl _INV_PI04@GOTOFF(%esi) + fmul %st(1), %st + movl %edi, 32(%esp) + fxch %st(1) + fstl 8(%ebp) + fldl _TWO_52H@GOTOFF(%esi) + fadd %st(2), %st + fstpl 16(%esp) + fildl 16(%esp) + movl 16(%esp), %edi + fcomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + movl $1, %eax + ja ..L3 + movl $0, %eax +..L3: + subl %eax, %edi + addl %edi, %ecx + movl %ecx, %eax + andl $1, %eax + addl %eax, %edi + addl %eax, %ecx + movl %edi, 24(%esp) + cmpl $1090519040, %edx + fildl 24(%esp) + movl 32(%esp), %edi + jae ..B1.8 +..B1.7: + fldl _DP2@GOTOFF(%esi) + movl %ecx, %edx + fmul %st(1), %st + andl $2, %edx + fsubrp %st, %st(2) + fldl 8+_DP2@GOTOFF(%esi) + fmul %st(1), %st + fsubrp %st, %st(2) + fldl 16+_DP2@GOTOFF(%esi) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstl 8(%ebp) + jmp ..B1.11 +..B1.8: + fstp %st(1) + fldl _DP3@GOTOFF(%esi) + movl %ecx, %edx + fmul %st(1), %st + andl $2, %edx + fldl 8+_DP3@GOTOFF(%esi) + fmul %st(2), %st + fxch %st(1) + fsubrl 8(%ebp) + fsubp %st, %st(1) + fldl 16+_DP3@GOTOFF(%esi) + fmul %st(2), %st + fsubrp %st, %st(1) + fldl 24+_DP3@GOTOFF(%esi) + fmulp %st, %st(2) + fsubp %st, %st(1) + fstl 8(%ebp) + jmp ..B1.11 +..B1.9: + fstl (%esp) + lea 8(%ebp), %eax + movl %eax, 8(%esp) + fstpl (%eax) + movl %ecx, 12(%esp) + call __libm_reduce_pi04d +..B1.17: + movl %eax, %ecx +..B1.10: + fldl 8(%ebp) + incl %ecx + movl %ecx, %edx + andl $2, %edx +..B1.11: + fldl 24+_CP@GOTOFF(%esi) + fld %st(1) + fmul %st(2), %st + lea 2(%ecx), %eax + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fld1 + fxch %st(3) + faddl 8+_CP@GOTOFF(%esi) + fmul %st(1), %st + shrl $2, %ecx + faddp %st, %st(3) + fldl 32+_CP@GOTOFF(%esi) + andl $1, %ecx + fmul %st(1), %st + xorl %ecx, %edi + fldl 24+_SP@GOTOFF(%esi) + fmul %st(2), %st + fxch %st(1) + faddl 16+_CP@GOTOFF(%esi) + fmul %st(2), %st + fxch %st(1) + faddl 8+_SP@GOTOFF(%esi) + fmul %st(2), %st + fmul %st(5), %st + shrl $2, %eax + fadd %st(5), %st + fxch %st(1) + faddl _CP@GOTOFF(%esi) + fmul %st(3), %st + andl $1, %eax + testl %edx, %edx + faddp %st, %st(4) + fldl 32+_SP@GOTOFF(%esi) + fmul %st(2), %st + faddl 16+_SP@GOTOFF(%esi) + fmulp %st, %st(2) + fxch %st(1) + faddl _SP@GOTOFF(%esi) + fmulp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fldl ones@GOTOFF(%esi,%edi,8) + je ..B1.13 +..B1.12: + fxch %st(2) + fmull ones@GOTOFF(%esi,%eax,8) + fxch %st(2) + fmulp %st, %st(1) + movl 36(%esp), %edx + fstpl (%edx) + fstpl (%ebx) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + fxch %st(1) + fmull ones@GOTOFF(%esi,%eax,8) + fxch %st(2) + fmulp %st, %st(1) + movl 36(%esp), %edx + fstpl (%edx) + fstpl (%ebx) +..B1.14: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_sincos_k32,@function + .size __libm_sincos_k32,.-__libm_sincos_k32 + .data +# -- End __libm_sincos_k32 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x54442d18,0x3fe921fb + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_INV_PI04: + .long 1841940611 + .long 1072979760 + .type _INV_PI04,@object + .size _INV_PI04,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_DP2: + .long 1413742592 + .long 1072243195 + .long 1279262720 + .long 1031179299 + .long 1880851354 + .long 996723793 + .type _DP2,@object + .size _DP2,24 + .align 4 +_DP3: + .long 1073741824 + .long 1072243195 + .long 0 + .long 1046758445 + .long 2147483648 + .long 1021855384 + .long 1880851354 + .long 996723793 + .type _DP3,@object + .size _DP3,32 + .align 4 +_CP: + .long 4294960802 + .long 3219128319 + .long 1427442001 + .long 1067799893 + .long 2926645240 + .long 3210133867 + .long 2571283200 + .long 1056571689 + .long 2069816734 + .long 3197257552 + .type _CP,@object + .size _CP,40 + .align 4 +_SP: + .long 1431654765 + .long 3217380693 + .long 285032968 + .long 1065423121 + .long 3653044354 + .long 3207201183 + .long 2777006020 + .long 1053236634 + .long 43514947 + .long 3193610888 + .type _SP,@object + .size _SP,40 + .data + .hidden __libm_reduce_pi04d + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_sinhl_k80.S b/external/sgx_libm/ia32/libm_sinhl_k80.S new file mode 100644 index 0000000000..b429851799 --- /dev/null +++ b/external/sgx_libm/ia32/libm_sinhl_k80.S @@ -0,0 +1,723 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sinhl_k80.c" + .text +..TXTST0: +# -- Begin __libm_sinhl_k80 + .text + .align 16,0x90 + .hidden __libm_sinhl_k80 + .globl __libm_sinhl_k80 +__libm_sinhl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp + movzwl 16(%ebp), %eax + andl $32767, %eax + movl 20(%ebp), %ebx + cmpl $16405, %eax + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + jge ..B1.17 +..B1.2: + cmpl $16382, %eax + jge ..B1.13 +..B1.3: + fldt 8(%ebp) + cmpl $16378, %eax + jge ..B1.11 +..B1.4: + cmpl $16373, %eax + jge ..B1.10 +..B1.5: + cmpl $16366, %eax + jge ..B1.9 +..B1.6: + fstpt (%ebx) + fldt (%ebx) + cmpl $16308, %eax + jge ..B1.8 +..B1.7: + fstp %st(0) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + fstpt 12(%ebx) + fldt 12(%ebx) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.8: + fldt _Q3@GOTOFF(%esi) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fldt 12+_Q2@GOTOFF(%esi) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fxch %st(2) + fstpt (%ebx) + fldt (%ebx) + fldt _Q2@GOTOFF(%esi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.10: + fldt 36+_Q1@GOTOFF(%esi) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(3) + fstpt (%ebx) + fldt (%ebx) + fldt 12+_Q1@GOTOFF(%esi) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 24+_Q1@GOTOFF(%esi) + fmulp %st, %st(4) + fldt _Q1@GOTOFF(%esi) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + fldl _TWO_48H@GOTOFF(%esi) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fld %st(3) + fadd %st(3), %st + fstpt 72(%esp) + fxch %st(3) + fstpt (%esp) + fldt (%esp) + fldt 72(%esp) + fsubp %st, %st(3) + fld %st(2) + fld %st(1) + fsub %st(4), %st + fmul %st, %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(3) + fstpt 16(%esp) + fldt 16(%esp) + fmul %st(0), %st + fldt 84+_Q@GOTOFF(%esi) + fmul %st(5), %st + fldt 60+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(5), %st + fldt 36+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(5), %st + fldt 12+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(5), %st + fldt 72+_Q@GOTOFF(%esi) + fmul %st(6), %st + fldt 48+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(6), %st + fldt 24+_Q@GOTOFF(%esi) + faddp %st, %st(1) + fmulp %st, %st(6) + fldt _Q@GOTOFF(%esi) + faddp %st, %st(6) + fxch %st(3) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(2) + fld %st(0) + fldt 96+_Q@GOTOFF(%esi) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(2) + fmul %st(3), %st + fldt (%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 16(%esp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fstpt (%ebx) + fldt (%ebx) + fsubrp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 12(%ebx) + fldt .L_2il0floatpacket.0@GOTOFF(%esi) +..B1.12: + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%esi) + fldt _KLN2@GOTOFF(%esi) + fldt _LN2K@GOTOFF(%esi) + fldl _TWO_32@GOTOFF(%esi) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl ones@GOTOFF(%esi,%eax,8) + fmul %st, %st(5) + fxch %st(3) + fmul %st(5), %st + fadd %st(4), %st + fstpt 72(%esp) + fxch %st(4) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 72(%esp) + movl 72(%esp), %eax + fsubp %st, %st(4) + fxch %st(1) + fmul %st(3), %st + movsbl %al, %ecx + fsubrp %st, %st(1) + fld %st(0) + subl %ecx, %eax + fldt 12+_LN2K@GOTOFF(%esi) + fmulp %st, %st(4) + movzwl 16(%ebp), %edx + fsub %st(3), %st + fldl _TWO_32P@GOTOFF(%esi) + andl $32767, %edx + fmul %st(1), %st + fxch %st(5) + fmulp %st, %st(1) + sarl $8, %eax + fsubrp %st, %st(4) + fld %st(3) + cmpl $16387, %edx + fxch %st(1) + fsub %st(4), %st + fsubp %st, %st(3) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%esi) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(1), %st + fldt _P@GOTOFF(%esi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%esi) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%esi) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + jle ..B1.15 +..B1.14: + shll $4, %ecx + decl %eax + movl %eax, 64(%esp) + faddp %st, %st(2) + fildl 64(%esp) + fldl 2056+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fldl 2048+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fld %st(0) + fmul %st(5), %st + fxch %st(5) + fadd %st(6), %st + fmul %st(2), %st + faddp %st, %st(5) + fmul %st, %st(5) + fld %st(0) + fadd %st(6), %st + fsubr %st, %st(1) + fxch %st(6) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fstpt (%ebx) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%ebx) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + je ..B1.20 +..B1.16: + fldt .L_2il0floatpacket.1@GOTOFF(%esi) + lea -1(%eax), %edi + shll $4, %ecx + fstpt (%esp) + fld %st(0) + movl %edi, 64(%esp) + movl %eax, %edi + negl %edi + fadd %st(3), %st + fxch %st(3) + fsubrp %st, %st(1) + fxch %st(1) + fstpt 16(%esp) + fld %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%esi,%ecx) + addl $16383, %edi + fldl 2048+__libm_expl_table_256@GOTOFF(%esi,%ecx) + negl %ecx + fstpt 32(%esp) + fldt 32(%esp) + subl %eax, %edi + movzwl 8+.L_2il0floatpacket.1@GOTOFF(%esi), %edx + andl $32767, %edi + andl $-32768, %edx + fadd %st(1), %st + fmulp %st, %st(4) + fld %st(4) + fmul %st(1), %st + orl %edi, %edx + faddp %st, %st(4) + fldl 2056+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fldl 2048+__libm_expl_table_256@GOTOFF(%esi,%ecx) + fld %st(0) + movw %dx, 8(%esp) + fadd %st(2), %st + fmulp %st, %st(5) + fld %st(6) + fmul %st(2), %st + fsubrp %st, %st(5) + fxch %st(4) + fstpt 48(%esp) + fxch %st(3) + fmul %st, %st(5) + fldt 32(%esp) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fsub %st(5), %st + fsubr %st, %st(4) + fxch %st(5) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fld %st(0) + fldt 48(%esp) + faddp %st, %st(3) + fldt (%esp) + fmul %st, %st(5) + fxch %st(1) + fsub %st(5), %st + fsubr %st, %st(2) + fxch %st(5) + fsubrp %st, %st(2) + fmulp %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 16(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt (%ebx) + fmulp %st, %st(1) + fstpt 12(%ebx) + fildl 64(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + cmpl $32767, %eax + je ..B1.23 +..B1.18: + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + lea (,%edx,8), %eax + fstpt 12(%ebx) + lea (%eax,%edx,4), %edx + fldt _infs@GOTOFF(%esi,%edx) + fstpt (%ebx) + fldt _infs@GOTOFF(%esi) +..B1.19: + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.20: + movl 12(%ebp), %edx + cmpl $-782985146, %edx + ja ..B1.14 +..B1.21: + jne ..B1.16 +..B1.22: + cmpl $1501741449, 8(%ebp) + ja ..B1.14 + jmp ..B1.16 +..B1.23: + fldt 8(%ebp) + fstpt (%ebx) + fldt (%ebx) + fmul %st(0), %st + fldt .L_2il0floatpacket.0@GOTOFF(%esi) + fstpt 12(%ebx) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __libm_sinhl_k80,@function + .size __libm_sinhl_k80,.-__libm_sinhl_k80 + .data +# -- End __libm_sinhl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 2 +_Q3: + .word 21845 + .word 44373 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 29491 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 1838 + .word 3745 + .word 35050 + .word 34952 + .word 16376 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 56472 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 6470 + .word 8609 + .word 207 + .word 53261 + .word 16370 + .word 0 + .word 51515 + .word 9159 + .word 10794 + .word 47344 + .word 16364 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 43620 + .word 43690 + .word 43690 + .word 43690 + .word 16364 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 52382 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 44665 + .word 46658 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 15678 + .word 35942 + .word 11071 + .word 55090 + .word 16357 + .word 0 + .word 10412 + .word 23121 + .word 12507 + .word 45202 + .word 16350 + .word 0 + .word 37213 + .word 41879 + .word 65084 + .word 55102 + .word 16342 + .word 0 + .word 1721 + .word 42148 + .word 19309 + .word 52099 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16380 + .word 0 + .type _Q,@object + .size _Q,108 + .align 2 +_KLN2: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16391 + .word 0 + .type _KLN2,@object + .size _KLN2,12 + .align 2 +_LN2K: + .word 0 + .word 0 + .word 6134 + .word 45426 + .word 16374 + .word 0 + .word 55756 + .word 58609 + .word 48341 + .word 59623 + .word 16343 + .word 0 + .type _LN2K,@object + .size _LN2K,24 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_infs: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 65535 + .word 0 + .type _infs,@object + .size _infs,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_sinl_k80.S b/external/sgx_libm/ia32/libm_sinl_k80.S new file mode 100644 index 0000000000..a1a3c58489 --- /dev/null +++ b/external/sgx_libm/ia32/libm_sinl_k80.S @@ -0,0 +1,676 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sinl_k80.c" + .text +..TXTST0: +# -- Begin __libm_sinl_k80 + .text + .align 16,0x90 + .hidden __libm_sinl_k80 + .globl __libm_sinl_k80 +__libm_sinl_k80: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 144(%esp) + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $16378, %eax + movl 20(%ebp), %edi + jge ..B1.13 +..B1.2: + fldt 8(%ebp) + cmpl $16372, %eax + jge ..B1.11 +..B1.3: + cmpl $16364, %eax + jge ..B1.9 +..B1.4: + fstpt (%edi) + fldt (%edi) + cmpl $16308, %eax + jge ..B1.6 +..B1.5: + fstp %st(0) + fldl _zeros@GOTOFF(%ebx) + fstpt 12(%edi) + fldl _ones@GOTOFF(%ebx) + jmp ..B1.7 +..B1.6: + fldt _SP3@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 12(%edi) + fldl _ones@GOTOFF(%ebx) +..B1.7: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.23 +..B1.8: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + fldt 12+_SP2@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fxch %st(2) + fstpt (%edi) + fldt (%edi) + fldt _SP2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fmulp %st, %st(1) + fstpt 12(%edi) + fldl _ones@GOTOFF(%ebx) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.23 +..B1.10: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + fldt 36+_SP1@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(3) + fstpt (%edi) + fldt (%edi) + fldt 12+_SP1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 24+_SP1@GOTOFF(%ebx) + fmulp %st, %st(4) + fldt _SP1@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 12(%edi) + fldl _ones@GOTOFF(%ebx) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.23 +..B1.12: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + cmpl $16382, %eax + jge ..B1.15 +..B1.14: + fldt 8(%ebp) + xorl %edx, %edx + fldl _TWO_52H@GOTOFF(%ebx) + movzbl 17(%ebp), %esi + andl $128, %esi + shrl $7, %esi + fxch %st(1) + fmull _ones@GOTOFF(%ebx,%esi,8) + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt 32(%esp) + fstpt 112(%esp) + fldt 112(%esp) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 32(%esp) + fsubp %st, %st(2) + fld %st(1) + fsubrp %st, %st(1) + jmp ..B1.18 +..B1.15: + je ..B1.27 +..B1.16: + fldt 8(%ebp) + lea 128(%esp), %eax + movzbl 17(%ebp), %esi + andl $128, %esi + shrl $7, %esi + fmull _ones@GOTOFF(%ebx,%esi,8) + fstpt (%esp) + fldt (%esp) + movl $0, 12(%esp) + fstpt 8(%ebp) + movl %eax, 16(%esp) + call __libm_reduce_pi04l +..B1.32: + movl %eax, %edx +..B1.17: + fldl 128(%esp) + lea 1(%edx), %eax + fldl _TWO_52H@GOTOFF(%ebx) + fmul %st(1), %st + fld %st(0) + shrl $2, %eax + fadd %st(2), %st + fstpt 32(%esp) + xorl %eax, %esi + fldt 32(%esp) + andl $1, %esi + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddl 136(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpt 112(%esp) +..B1.18: + fldt 112(%esp) + fld %st(2) + fmul %st(2), %st + fld %st(2) + fmulp %st, %st(2) + incl %edx + faddp %st, %st(1) + fstpt 48(%esp) + fldt 48(%esp) + fld %st(2) + fmul %st(3), %st + testb $2, %dl + fld %st(0) + fadd %st(2), %st + fstpt 80(%esp) + fldt 80(%esp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fmul %st(0), %st + fld %st(0) + faddp %st, %st(2) + fldl _TWO_53H@GOTOFF(%ebx) + je ..B1.20 +..B1.19: + fstp %st(3) + fstp %st(3) + fldt 84+_CP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_CP@GOTOFF(%ebx) + fldt 96+_CP@GOTOFF(%ebx) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 80(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 64(%esp) + fldt 48(%esp) + fldt 96(%esp) + fldt 120+_CP@GOTOFF(%ebx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(5) + fldt 108+_CP@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fld %st(4) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fadd %st(1), %st + fmul %st, %st(2) + fadd %st(2), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldl _ones@GOTOFF(%ebx) + fld %st(0) + fxch %st(1) + fadd %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldl _ones@GOTOFF(%ebx,%esi,8) + fmul %st, %st(1) + fxch %st(1) + fstpt (%edi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 12(%edi) + jmp ..B1.21 +..B1.20: + fldt 84+_SP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 60+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_SP@GOTOFF(%ebx) + fldt 96+_SP@GOTOFF(%ebx) + fmul %st(5), %st + faddp %st, %st(1) + fmul %st(4), %st + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(4) + fldt 80(%esp) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt 64(%esp) + fldt 48(%esp) + fldt 120+_SP@GOTOFF(%ebx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(3) + fldt 108+_SP@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fldt 96(%esp) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fmul %st, %st(1) + fadd %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmul %st(4), %st + fldt 112(%esp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%esi,8) + fmul %st, %st(2) + fxch %st(2) + fstpt (%edi) + fmulp %st, %st(1) + fstpt 12(%edi) + fldl _ones@GOTOFF(%ebx) +..B1.21: + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.23 +..B1.22: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.27: + movl 12(%ebp), %eax + cmpl $-921707870, %eax + jb ..B1.14 +..B1.28: + jne ..B1.16 +..B1.29: + cmpl $560513589, 8(%ebp) + jbe ..B1.14 + jmp ..B1.16 + .align 16,0x90 + .type __libm_sinl_k80,@function + .size __libm_sinl_k80,.-__libm_sinl_k80 + .data +# -- End __libm_sinl_k80 + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_SP3: + .word 17476 + .word 43656 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .type _SP3,@object + .size _SP3,12 + .align 2 +_SP2: + .word 43210 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 1587 + .word 57422 + .word 34932 + .word 34952 + .word 16376 + .word 0 + .type _SP2,@object + .size _SP2,24 + .align 2 +_SP1: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 12518 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 43088 + .word 7396 + .word 207 + .word 53261 + .word 49138 + .word 0 + .word 55827 + .word 48618 + .word 3602 + .word 47342 + .word 16364 + .word 0 + .type _SP1,@object + .size _SP1,48 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .type _CP,@object + .size _CP,132 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .type _SP,@object + .size _SP,132 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_strtoull.S b/external/sgx_libm/ia32/libm_strtoull.S new file mode 100644 index 0000000000..2656daf3b5 --- /dev/null +++ b/external/sgx_libm/ia32/libm_strtoull.S @@ -0,0 +1,1128 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_strtoull.c" + .text +..TXTST0: +# -- Begin __libm_conv_strtoull + .text + .align 16,0x90 + .hidden __libm_conv_strtoull + .globl __libm_conv_strtoull +__libm_conv_strtoull: +# parameter 1: 64 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $44, %esp + movl 64(%esp), %eax + testl %eax, %eax + je ..B1.21 +..B1.2: + movsbl (%eax), %ebx + testl %ebx, %ebx + je ..B1.21 +..B1.3: + xorl %edx, %edx + movl %eax, %ecx +..B1.4: + incl %ecx + incl %edx + cmpb $0, (%ecx) + jne ..B1.4 +..B1.5: + testl %edx, %edx + je ..B1.21 +..B1.6: + lea -48(%ebx), %ebp + cmpl $9, %ebp + ja ..B1.21 +..B1.8: + cmpl $48, %ebx + je ..B1.25 +..B1.9: + cmpl $1, %edx + jle ..B1.14 +..B1.10: + movl $1, %ebx +..B1.11: + movsbl (%ebx,%eax), %ebp + addl $-48, %ebp + cmpl $9, %ebp + ja ..B1.21 +..B1.12: + incl %ebx + cmpl %edx, %ebx + jl ..B1.11 +..B1.14: + cmpl $64, %edx + movl %edx, %ebx + jb ..L2 + movl $64, %ebx +..L2: + testl %edx, %edx + jle ..B1.21 +..B1.15: + movl %ebx, %edx + xorl %ebp, %ebp + shrl $1, %edx + xorl %esi, %esi + call ..L3 +..L3: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L3](%edi), %edi + testl %edx, %edx + jbe ..B1.23 +..B1.16: + movl %ecx, (%esp) + xorl %eax, %eax + movl %edx, 12(%esp) + movl %ebx, 8(%esp) + movl %ecx, 4(%esp) + movl (%esp), %edx +..B1.17: + movzbl -1(%edx), %ebx + addl $-48, %ebx + movsbl %bl, %ecx + lea (%eax,%eax,4), %ebx + shll $5, %ebx + incl %eax + lea _C_MUL_10_POW_I@GOTOFF(%edi,%ecx,8), %ecx + addl (%ecx,%ebx), %ebp + adcl 4(%ecx,%ebx), %esi + movzbl -2(%edx), %ecx + addl $-2, %edx + addl $-48, %ecx + movsbl %cl, %ecx + lea _C_MUL_10_POW_I@GOTOFF(%edi,%ecx,8), %ecx + addl 80(%ecx,%ebx), %ebp + adcl 84(%ecx,%ebx), %esi + cmpl 12(%esp), %eax + jb ..B1.17 +..B1.18: + movl 8(%esp), %ebx + lea 1(%eax,%eax), %eax + movl 4(%esp), %ecx +..B1.19: + lea -1(%eax), %edx + cmpl %edx, %ebx + jbe ..B1.22 +..B1.20: + subl %eax, %ecx + lea (%eax,%eax,4), %ebx + shll $4, %ebx + movzbl (%ecx), %ecx + addl $-48, %ecx + movsbl %cl, %ecx + lea (%ebx,%ecx,8), %ecx + addl -80+_C_MUL_10_POW_I@GOTOFF(%edi,%ecx), %ebp + adcl -76+_C_MUL_10_POW_I@GOTOFF(%edi,%ecx), %esi + jmp ..B1.22 +..B1.21: + xorl %ebp, %ebp + xorl %esi, %esi +..B1.22: + movl %ebp, %eax + movl %esi, %edx + addl $44, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.23: + movl $1, %eax + jmp ..B1.19 +..B1.25: + cmpl $3, %edx + jl ..B1.27 +..B1.26: + movsbl 1(%eax), %ebx + andl $-33, %ebx + cmpl $88, %ebx + je ..B1.51 + jmp ..B1.28 +..B1.27: + cmpl $1, %edx + jle ..B1.32 +..B1.28: + movl $1, %ebx +..B1.29: + movsbl (%ebx,%eax), %ebp + addl $-48, %ebp + cmpl $7, %ebp + ja ..B1.21 +..B1.30: + incl %ebx + cmpl %edx, %ebx + jl ..B1.29 +..B1.32: + decl %edx + cmpl $22, %edx + movl %edx, %edi + jb ..L4 + movl $22, %edi +..L4: + testl %edx, %edx + jle ..B1.21 +..B1.33: + movl %edi, %eax + xorl %ebp, %ebp + shrl $1, %eax + xorl %esi, %esi + testl %eax, %eax + jbe ..B1.49 +..B1.34: + movl %ecx, %ebx + movl %ebp, 16(%esp) + movl %eax, 8(%esp) + movl %edi, (%esp) + movl %ecx, 4(%esp) +..B1.35: + movl 16(%esp), %edi + movzbl -1(%ebx), %ecx + addl $-48, %ecx + movsbl %cl, %eax + lea (%edi,%edi,2), %ecx + movl %ecx, 12(%esp) + addl %ecx, %ecx + cmpl $31, %ecx + cltd + jbe ..B1.37 +..B1.36: + movl %eax, %edx + xorl %edi, %edi + shll %cl, %edx + jmp ..B1.38 +..B1.37: + movl %eax, %edi + shldl %cl, %edi, %edx + shll %cl, %edi +..B1.38: + addl %edi, %ebp + movl 12(%esp), %edi + movzbl -2(%ebx), %ecx + adcl %edx, %esi + addl $-48, %ecx + movsbl %cl, %eax + lea 3(%edi,%edi), %ecx + cltd + cmpl $31, %ecx + jbe ..B1.40 +..B1.39: + movl %eax, %edx + xorl %edi, %edi + shll %cl, %edx + jmp ..B1.41 +..B1.40: + movl %eax, %edi + shldl %cl, %eax, %edx + shll %cl, %edi +..B1.41: + addl %edi, %ebp + movl 16(%esp), %ecx + adcl %edx, %esi + incl %ecx + addl $-2, %ebx + movl %ecx, 16(%esp) + cmpl 8(%esp), %ecx + jb ..B1.35 +..B1.42: + movl %ecx, %edx + lea 1(%edx,%edx), %ebx + movl (%esp), %edi + movl 4(%esp), %ecx +..B1.43: + lea -1(%ebx), %eax + cmpl %eax, %edi + jbe ..B1.22 +..B1.44: + subl %ebx, %ecx + movzbl (%ecx), %ecx + addl $-48, %ecx + movsbl %cl, %eax + lea -3(%ebx,%ebx,2), %ecx + cltd + cmpl $31, %ecx + jbe ..B1.46 +..B1.45: + movl %eax, %edx + xorl %ebx, %ebx + shll %cl, %edx +..B1.47: + addl %ebx, %ebp + adcl %edx, %esi + jmp ..B1.22 +..B1.46: + movl %eax, %ebx + shldl %cl, %eax, %edx + shll %cl, %ebx + jmp ..B1.47 +..B1.49: + movl $1, %ebx + jmp ..B1.43 +..B1.51: + addl $-2, %edx + xorl %ebx, %ebx +..B1.52: + movsbl 2(%ebx,%eax), %esi + lea -48(%esi), %ebp + cmpl $9, %ebp + jbe ..B1.55 +..B1.53: + lea -97(%esi), %ebp + cmpl $5, %ebp + jbe ..B1.55 +..B1.54: + addl $-65, %esi + cmpl $5, %esi + ja ..B1.21 +..B1.55: + incl %ebx + cmpl %edx, %ebx + jb ..B1.52 +..B1.56: + cmpl $16, %edx + movl %edx, %eax + jb ..L5 + movl $16, %eax +..L5: + testl %edx, %edx + jle ..B1.21 +..B1.57: + movl %eax, %edx + xorl %ebp, %ebp + shrl $1, %edx + xorl %esi, %esi + testl %edx, %edx + jbe ..B1.89 +..B1.58: + movl %ecx, %edi + xorl %ebx, %ebx + movl %edi, 32(%esp) + movl %edx, 28(%esp) + movl %eax, (%esp) + movl %ecx, 4(%esp) +..B1.59: + movl 32(%esp), %edi + movsbl -1(%edi), %ecx + movl %ecx, 20(%esp) + lea -48(%ecx), %ecx + movl %ecx, 8(%esp) + cmpl $9, %ecx + ja ..B1.61 +..B1.60: + movsbl 8(%esp), %eax + jmp ..B1.64 +..B1.61: + movl 20(%esp), %ecx + lea -97(%ecx), %edi + cmpl $5, %edi + ja ..B1.63 +..B1.62: + addl $-87, %ecx + movsbl %cl, %eax + jmp ..B1.64 +..B1.63: + addl $-55, %ecx + movsbl %cl, %eax +..B1.64: + cltd + lea (,%ebx,8), %ecx + cmpl $31, %ecx + jbe ..B1.66 +..B1.65: + movl %eax, %edx + movl $0, 16(%esp) + shll %cl, %edx + jmp ..B1.67 +..B1.66: + shldl %cl, %eax, %edx + shll %cl, %eax + movl %eax, 16(%esp) +..B1.67: + movl 32(%esp), %edi + addl 16(%esp), %ebp + movsbl -2(%edi), %ecx + adcl %edx, %esi + movl %ecx, 24(%esp) + lea -48(%ecx), %ecx + movl %ecx, 12(%esp) + cmpl $9, %ecx + ja ..B1.69 +..B1.68: + movsbl 12(%esp), %eax + jmp ..B1.72 +..B1.69: + movl 24(%esp), %ecx + lea -97(%ecx), %edi + cmpl $5, %edi + ja ..B1.71 +..B1.70: + addl $-87, %ecx + movsbl %cl, %eax + jmp ..B1.72 +..B1.71: + addl $-55, %ecx + movsbl %cl, %eax +..B1.72: + cltd + lea 4(,%ebx,8), %ecx + cmpl $31, %ecx + jbe ..B1.74 +..B1.73: + movl %eax, %edx + xorl %edi, %edi + shll %cl, %edx + jmp ..B1.75 +..B1.74: + movl %eax, %edi + shldl %cl, %eax, %edx + shll %cl, %edi +..B1.75: + addl %edi, %ebp + adcl %edx, %esi + incl %ebx + addl $-2, 32(%esp) + cmpl 28(%esp), %ebx + jb ..B1.59 +..B1.76: + movl (%esp), %eax + lea 1(%ebx,%ebx), %edi + movl 4(%esp), %ecx +..B1.77: + lea -1(%edi), %ebx + cmpl %ebx, %eax + jbe ..B1.22 +..B1.78: + subl %edi, %ecx + movsbl (%ecx), %ebx + lea -48(%ebx), %ecx + cmpl $9, %ecx + ja ..B1.80 +..B1.79: + movsbl %cl, %eax + jmp ..B1.83 +..B1.80: + lea -97(%ebx), %ecx + cmpl $5, %ecx + ja ..B1.82 +..B1.81: + addl $-87, %ebx + movsbl %bl, %eax + jmp ..B1.83 +..B1.82: + addl $-55, %ebx + movsbl %bl, %eax +..B1.83: + cltd + lea -4(,%edi,4), %ecx + cmpl $31, %ecx + jbe ..B1.85 +..B1.84: + movl %eax, %edx + xorl %ebx, %ebx + shll %cl, %edx +..B1.86: + addl %ebx, %ebp + adcl %edx, %esi + jmp ..B1.22 +..B1.85: + movl %eax, %ebx + shldl %cl, %eax, %edx + shll %cl, %ebx + jmp ..B1.86 +..B1.89: + movl $1, %edi + jmp ..B1.77 + .align 16,0x90 + .type __libm_conv_strtoull,@function + .size __libm_conv_strtoull,.-__libm_conv_strtoull + .data +# -- End __libm_conv_strtoull + .section .rodata, "a" + .align 8 + .align 8 +_C_MUL_10_POW_I: + .long 0x00000000,0x00000000 + .long 0x00000001,0x00000000 + .long 0x00000002,0x00000000 + .long 0x00000003,0x00000000 + .long 0x00000004,0x00000000 + .long 0x00000005,0x00000000 + .long 0x00000006,0x00000000 + .long 0x00000007,0x00000000 + .long 0x00000008,0x00000000 + .long 0x00000009,0x00000000 + .long 0x00000000,0x00000000 + .long 0x0000000a,0x00000000 + .long 0x00000014,0x00000000 + .long 0x0000001e,0x00000000 + .long 0x00000028,0x00000000 + .long 0x00000032,0x00000000 + .long 0x0000003c,0x00000000 + .long 0x00000046,0x00000000 + .long 0x00000050,0x00000000 + .long 0x0000005a,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000064,0x00000000 + .long 0x000000c8,0x00000000 + .long 0x0000012c,0x00000000 + .long 0x00000190,0x00000000 + .long 0x000001f4,0x00000000 + .long 0x00000258,0x00000000 + .long 0x000002bc,0x00000000 + .long 0x00000320,0x00000000 + .long 0x00000384,0x00000000 + .long 0x00000000,0x00000000 + .long 0x000003e8,0x00000000 + .long 0x000007d0,0x00000000 + .long 0x00000bb8,0x00000000 + .long 0x00000fa0,0x00000000 + .long 0x00001388,0x00000000 + .long 0x00001770,0x00000000 + .long 0x00001b58,0x00000000 + .long 0x00001f40,0x00000000 + .long 0x00002328,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00002710,0x00000000 + .long 0x00004e20,0x00000000 + .long 0x00007530,0x00000000 + .long 0x00009c40,0x00000000 + .long 0x0000c350,0x00000000 + .long 0x0000ea60,0x00000000 + .long 0x00011170,0x00000000 + .long 0x00013880,0x00000000 + .long 0x00015f90,0x00000000 + .long 0x00000000,0x00000000 + .long 0x000186a0,0x00000000 + .long 0x00030d40,0x00000000 + .long 0x000493e0,0x00000000 + .long 0x00061a80,0x00000000 + .long 0x0007a120,0x00000000 + .long 0x000927c0,0x00000000 + .long 0x000aae60,0x00000000 + .long 0x000c3500,0x00000000 + .long 0x000dbba0,0x00000000 + .long 0x00000000,0x00000000 + .long 0x000f4240,0x00000000 + .long 0x001e8480,0x00000000 + .long 0x002dc6c0,0x00000000 + .long 0x003d0900,0x00000000 + .long 0x004c4b40,0x00000000 + .long 0x005b8d80,0x00000000 + .long 0x006acfc0,0x00000000 + .long 0x007a1200,0x00000000 + .long 0x00895440,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00989680,0x00000000 + .long 0x01312d00,0x00000000 + .long 0x01c9c380,0x00000000 + .long 0x02625a00,0x00000000 + .long 0x02faf080,0x00000000 + .long 0x03938700,0x00000000 + .long 0x042c1d80,0x00000000 + .long 0x04c4b400,0x00000000 + .long 0x055d4a80,0x00000000 + .long 0x00000000,0x00000000 + .long 0x05f5e100,0x00000000 + .long 0x0bebc200,0x00000000 + .long 0x11e1a300,0x00000000 + .long 0x17d78400,0x00000000 + .long 0x1dcd6500,0x00000000 + .long 0x23c34600,0x00000000 + .long 0x29b92700,0x00000000 + .long 0x2faf0800,0x00000000 + .long 0x35a4e900,0x00000000 + .long 0x00000000,0x00000000 + .long 0x3b9aca00,0x00000000 + .long 0x77359400,0x00000000 + .long 0xb2d05e00,0x00000000 + .long 0xee6b2800,0x00000000 + .long 0x2a05f200,0x00000001 + .long 0x65a0bc00,0x00000001 + .long 0xa13b8600,0x00000001 + .long 0xdcd65000,0x00000001 + .long 0x18711a00,0x00000002 + .long 0x00000000,0x00000000 + .long 0x540be400,0x00000002 + .long 0xa817c800,0x00000004 + .long 0xfc23ac00,0x00000006 + .long 0x502f9000,0x00000009 + .long 0xa43b7400,0x0000000b + .long 0xf8475800,0x0000000d + .long 0x4c533c00,0x00000010 + .long 0xa05f2000,0x00000012 + .long 0xf46b0400,0x00000014 + .long 0x00000000,0x00000000 + .long 0x4876e800,0x00000017 + .long 0x90edd000,0x0000002e + .long 0xd964b800,0x00000045 + .long 0x21dba000,0x0000005d + .long 0x6a528800,0x00000074 + .long 0xb2c97000,0x0000008b + .long 0xfb405800,0x000000a2 + .long 0x43b74000,0x000000ba + .long 0x8c2e2800,0x000000d1 + .long 0x00000000,0x00000000 + .long 0xd4a51000,0x000000e8 + .long 0xa94a2000,0x000001d1 + .long 0x7def3000,0x000002ba + .long 0x52944000,0x000003a3 + .long 0x27395000,0x0000048c + .long 0xfbde6000,0x00000574 + .long 0xd0837000,0x0000065d + .long 0xa5288000,0x00000746 + .long 0x79cd9000,0x0000082f + .long 0x00000000,0x00000000 + .long 0x4e72a000,0x00000918 + .long 0x9ce54000,0x00001230 + .long 0xeb57e000,0x00001b48 + .long 0x39ca8000,0x00002461 + .long 0x883d2000,0x00002d79 + .long 0xd6afc000,0x00003691 + .long 0x25226000,0x00003faa + .long 0x73950000,0x000048c2 + .long 0xc207a000,0x000051da + .long 0x00000000,0x00000000 + .long 0x107a4000,0x00005af3 + .long 0x20f48000,0x0000b5e6 + .long 0x316ec000,0x000110d9 + .long 0x41e90000,0x00016bcc + .long 0x52634000,0x0001c6bf + .long 0x62dd8000,0x000221b2 + .long 0x7357c000,0x00027ca5 + .long 0x83d20000,0x0002d798 + .long 0x944c4000,0x0003328b + .long 0x00000000,0x00000000 + .long 0xa4c68000,0x00038d7e + .long 0x498d0000,0x00071afd + .long 0xee538000,0x000aa87b + .long 0x931a0000,0x000e35fa + .long 0x37e08000,0x0011c379 + .long 0xdca70000,0x001550f7 + .long 0x816d8000,0x0018de76 + .long 0x26340000,0x001c6bf5 + .long 0xcafa8000,0x001ff973 + .long 0x00000000,0x00000000 + .long 0x6fc10000,0x002386f2 + .long 0xdf820000,0x00470de4 + .long 0x4f430000,0x006a94d7 + .long 0xbf040000,0x008e1bc9 + .long 0x2ec50000,0x00b1a2bc + .long 0x9e860000,0x00d529ae + .long 0x0e470000,0x00f8b0a1 + .long 0x7e080000,0x011c3793 + .long 0xedc90000,0x013fbe85 + .long 0x00000000,0x00000000 + .long 0x5d8a0000,0x01634578 + .long 0xbb140000,0x02c68af0 + .long 0x189e0000,0x0429d069 + .long 0x76280000,0x058d15e1 + .long 0xd3b20000,0x06f05b59 + .long 0x313c0000,0x0853a0d2 + .long 0x8ec60000,0x09b6e64a + .long 0xec500000,0x0b1a2bc2 + .long 0x49da0000,0x0c7d713b + .long 0x00000000,0x00000000 + .long 0xa7640000,0x0de0b6b3 + .long 0x4ec80000,0x1bc16d67 + .long 0xf62c0000,0x29a2241a + .long 0x9d900000,0x3782dace + .long 0x44f40000,0x45639182 + .long 0xec580000,0x53444835 + .long 0x93bc0000,0x6124fee9 + .long 0x3b200000,0x6f05b59d + .long 0xe2840000,0x7ce66c50 + .long 0x00000000,0x00000000 + .long 0x89e80000,0x8ac72304 + .long 0x13d00000,0x158e4609 + .long 0x9db80000,0xa055690d + .long 0x27a00000,0x2b1c8c12 + .long 0xb1880000,0xb5e3af16 + .long 0x3b700000,0x40aad21b + .long 0xc5580000,0xcb71f51f + .long 0x4f400000,0x56391824 + .long 0xd9280000,0xe1003b28 + .long 0x00000000,0x00000000 + .long 0x63100000,0x6bc75e2d + .long 0xc6200000,0xd78ebc5a + .long 0x29300000,0x43561a88 + .long 0x8c400000,0xaf1d78b5 + .long 0xef500000,0x1ae4d6e2 + .long 0x52600000,0x86ac3510 + .long 0xb5700000,0xf273933d + .long 0x18800000,0x5e3af16b + .long 0x7b900000,0xca024f98 + .long 0x00000000,0x00000000 + .long 0xdea00000,0x35c9adc5 + .long 0xbd400000,0x6b935b8b + .long 0x9be00000,0xa15d0951 + .long 0x7a800000,0xd726b717 + .long 0x59200000,0x0cf064dd + .long 0x37c00000,0x42ba12a3 + .long 0x16600000,0x7883c069 + .long 0xf5000000,0xae4d6e2e + .long 0xd3a00000,0xe4171bf4 + .long 0x00000000,0x00000000 + .long 0xb2400000,0x19e0c9ba + .long 0x64800000,0x33c19375 + .long 0x16c00000,0x4da25d30 + .long 0xc9000000,0x678326ea + .long 0x7b400000,0x8163f0a5 + .long 0x2d800000,0x9b44ba60 + .long 0xdfc00000,0xb525841a + .long 0x92000000,0xcf064dd5 + .long 0x44400000,0xe8e71790 + .long 0x00000000,0x00000000 + .long 0xf6800000,0x02c7e14a + .long 0xed000000,0x058fc295 + .long 0xe3800000,0x0857a3e0 + .long 0xda000000,0x0b1f852b + .long 0xd0800000,0x0de76676 + .long 0xc7000000,0x10af47c1 + .long 0xbd800000,0x1377290c + .long 0xb4000000,0x163f0a57 + .long 0xaa800000,0x1906eba2 + .long 0x00000000,0x00000000 + .long 0xa1000000,0x1bcecced + .long 0x42000000,0x379d99db + .long 0xe3000000,0x536c66c8 + .long 0x84000000,0x6f3b33b6 + .long 0x25000000,0x8b0a00a4 + .long 0xc6000000,0xa6d8cd91 + .long 0x67000000,0xc2a79a7f + .long 0x08000000,0xde76676d + .long 0xa9000000,0xfa45345a + .long 0x00000000,0x00000000 + .long 0x4a000000,0x16140148 + .long 0x94000000,0x2c280290 + .long 0xde000000,0x423c03d8 + .long 0x28000000,0x58500521 + .long 0x72000000,0x6e640669 + .long 0xbc000000,0x847807b1 + .long 0x06000000,0x9a8c08fa + .long 0x50000000,0xb0a00a42 + .long 0x9a000000,0xc6b40b8a + .long 0x00000000,0x00000000 + .long 0xe4000000,0xdcc80cd2 + .long 0xc8000000,0xb99019a5 + .long 0xac000000,0x96582678 + .long 0x90000000,0x7320334b + .long 0x74000000,0x4fe8401e + .long 0x58000000,0x2cb04cf1 + .long 0x3c000000,0x097859c4 + .long 0x20000000,0xe6406697 + .long 0x04000000,0xc308736a + .long 0x00000000,0x00000000 + .long 0xe8000000,0x9fd0803c + .long 0xd0000000,0x3fa10079 + .long 0xb8000000,0xdf7180b6 + .long 0xa0000000,0x7f4200f3 + .long 0x88000000,0x1f128130 + .long 0x70000000,0xbee3016d + .long 0x58000000,0x5eb381aa + .long 0x40000000,0xfe8401e7 + .long 0x28000000,0x9e548224 + .long 0x00000000,0x00000000 + .long 0x10000000,0x3e250261 + .long 0x20000000,0x7c4a04c2 + .long 0x30000000,0xba6f0723 + .long 0x40000000,0xf8940984 + .long 0x50000000,0x36b90be5 + .long 0x60000000,0x74de0e46 + .long 0x70000000,0xb30310a7 + .long 0x80000000,0xf1281308 + .long 0x90000000,0x2f4d1569 + .long 0x00000000,0x00000000 + .long 0xa0000000,0x6d7217ca + .long 0x40000000,0xdae42f95 + .long 0xe0000000,0x4856475f + .long 0x80000000,0xb5c85f2a + .long 0x20000000,0x233a76f5 + .long 0xc0000000,0x90ac8ebf + .long 0x60000000,0xfe1ea68a + .long 0x00000000,0x6b90be55 + .long 0xa0000000,0xd902d61f + .long 0x00000000,0x00000000 + .long 0x40000000,0x4674edea + .long 0x80000000,0x8ce9dbd4 + .long 0xc0000000,0xd35ec9be + .long 0x00000000,0x19d3b7a9 + .long 0x40000000,0x6048a593 + .long 0x80000000,0xa6bd937d + .long 0xc0000000,0xed328167 + .long 0x00000000,0x33a76f52 + .long 0x40000000,0x7a1c5d3c + .long 0x00000000,0x00000000 + .long 0x80000000,0xc0914b26 + .long 0x00000000,0x8122964d + .long 0x80000000,0x41b3e173 + .long 0x00000000,0x02452c9a + .long 0x80000000,0xc2d677c0 + .long 0x00000000,0x8367c2e7 + .long 0x80000000,0x43f90e0d + .long 0x00000000,0x048a5934 + .long 0x80000000,0xc51ba45a + .long 0x00000000,0x00000000 + .long 0x00000000,0x85acef81 + .long 0x00000000,0x0b59df02 + .long 0x00000000,0x9106ce83 + .long 0x00000000,0x16b3be04 + .long 0x00000000,0x9c60ad85 + .long 0x00000000,0x220d9d06 + .long 0x00000000,0xa7ba8c87 + .long 0x00000000,0x2d677c08 + .long 0x00000000,0xb3146b89 + .long 0x00000000,0x00000000 + .long 0x00000000,0x38c15b0a + .long 0x00000000,0x7182b614 + .long 0x00000000,0xaa44111e + .long 0x00000000,0xe3056c28 + .long 0x00000000,0x1bc6c732 + .long 0x00000000,0x5488223c + .long 0x00000000,0x8d497d46 + .long 0x00000000,0xc60ad850 + .long 0x00000000,0xfecc335a + .long 0x00000000,0x00000000 + .long 0x00000000,0x378d8e64 + .long 0x00000000,0x6f1b1cc8 + .long 0x00000000,0xa6a8ab2c + .long 0x00000000,0xde363990 + .long 0x00000000,0x15c3c7f4 + .long 0x00000000,0x4d515658 + .long 0x00000000,0x84dee4bc + .long 0x00000000,0xbc6c7320 + .long 0x00000000,0xf3fa0184 + .long 0x00000000,0x00000000 + .long 0x00000000,0x2b878fe8 + .long 0x00000000,0x570f1fd0 + .long 0x00000000,0x8296afb8 + .long 0x00000000,0xae1e3fa0 + .long 0x00000000,0xd9a5cf88 + .long 0x00000000,0x052d5f70 + .long 0x00000000,0x30b4ef58 + .long 0x00000000,0x5c3c7f40 + .long 0x00000000,0x87c40f28 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb34b9f10 + .long 0x00000000,0x66973e20 + .long 0x00000000,0x19e2dd30 + .long 0x00000000,0xcd2e7c40 + .long 0x00000000,0x807a1b50 + .long 0x00000000,0x33c5ba60 + .long 0x00000000,0xe7115970 + .long 0x00000000,0x9a5cf880 + .long 0x00000000,0x4da89790 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00f436a0 + .long 0x00000000,0x01e86d40 + .long 0x00000000,0x02dca3e0 + .long 0x00000000,0x03d0da80 + .long 0x00000000,0x04c51120 + .long 0x00000000,0x05b947c0 + .long 0x00000000,0x06ad7e60 + .long 0x00000000,0x07a1b500 + .long 0x00000000,0x0895eba0 + .long 0x00000000,0x00000000 + .long 0x00000000,0x098a2240 + .long 0x00000000,0x13144480 + .long 0x00000000,0x1c9e66c0 + .long 0x00000000,0x26288900 + .long 0x00000000,0x2fb2ab40 + .long 0x00000000,0x393ccd80 + .long 0x00000000,0x42c6efc0 + .long 0x00000000,0x4c511200 + .long 0x00000000,0x55db3440 + .long 0x00000000,0x00000000 + .long 0x00000000,0x5f655680 + .long 0x00000000,0xbecaad00 + .long 0x00000000,0x1e300380 + .long 0x00000000,0x7d955a00 + .long 0x00000000,0xdcfab080 + .long 0x00000000,0x3c600700 + .long 0x00000000,0x9bc55d80 + .long 0x00000000,0xfb2ab400 + .long 0x00000000,0x5a900a80 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb9f56100 + .long 0x00000000,0x73eac200 + .long 0x00000000,0x2de02300 + .long 0x00000000,0xe7d58400 + .long 0x00000000,0xa1cae500 + .long 0x00000000,0x5bc04600 + .long 0x00000000,0x15b5a700 + .long 0x00000000,0xcfab0800 + .long 0x00000000,0x89a06900 + .long 0x00000000,0x00000000 + .long 0x00000000,0x4395ca00 + .long 0x00000000,0x872b9400 + .long 0x00000000,0xcac15e00 + .long 0x00000000,0x0e572800 + .long 0x00000000,0x51ecf200 + .long 0x00000000,0x9582bc00 + .long 0x00000000,0xd9188600 + .long 0x00000000,0x1cae5000 + .long 0x00000000,0x60441a00 + .long 0x00000000,0x00000000 + .long 0x00000000,0xa3d9e400 + .long 0x00000000,0x47b3c800 + .long 0x00000000,0xeb8dac00 + .long 0x00000000,0x8f679000 + .long 0x00000000,0x33417400 + .long 0x00000000,0xd71b5800 + .long 0x00000000,0x7af53c00 + .long 0x00000000,0x1ecf2000 + .long 0x00000000,0xc2a90400 + .long 0x00000000,0x00000000 + .long 0x00000000,0x6682e800 + .long 0x00000000,0xcd05d000 + .long 0x00000000,0x3388b800 + .long 0x00000000,0x9a0ba000 + .long 0x00000000,0x008e8800 + .long 0x00000000,0x67117000 + .long 0x00000000,0xcd945800 + .long 0x00000000,0x34174000 + .long 0x00000000,0x9a9a2800 + .long 0x00000000,0x00000000 + .long 0x00000000,0x011d1000 + .long 0x00000000,0x023a2000 + .long 0x00000000,0x03573000 + .long 0x00000000,0x04744000 + .long 0x00000000,0x05915000 + .long 0x00000000,0x06ae6000 + .long 0x00000000,0x07cb7000 + .long 0x00000000,0x08e88000 + .long 0x00000000,0x0a059000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x0b22a000 + .long 0x00000000,0x16454000 + .long 0x00000000,0x2167e000 + .long 0x00000000,0x2c8a8000 + .long 0x00000000,0x37ad2000 + .long 0x00000000,0x42cfc000 + .long 0x00000000,0x4df26000 + .long 0x00000000,0x59150000 + .long 0x00000000,0x6437a000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x6f5a4000 + .long 0x00000000,0xdeb48000 + .long 0x00000000,0x4e0ec000 + .long 0x00000000,0xbd690000 + .long 0x00000000,0x2cc34000 + .long 0x00000000,0x9c1d8000 + .long 0x00000000,0x0b77c000 + .long 0x00000000,0x7ad20000 + .long 0x00000000,0xea2c4000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x59868000 + .long 0x00000000,0xb30d0000 + .long 0x00000000,0x0c938000 + .long 0x00000000,0x661a0000 + .long 0x00000000,0xbfa08000 + .long 0x00000000,0x19270000 + .long 0x00000000,0x72ad8000 + .long 0x00000000,0xcc340000 + .long 0x00000000,0x25ba8000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x7f410000 + .long 0x00000000,0xfe820000 + .long 0x00000000,0x7dc30000 + .long 0x00000000,0xfd040000 + .long 0x00000000,0x7c450000 + .long 0x00000000,0xfb860000 + .long 0x00000000,0x7ac70000 + .long 0x00000000,0xfa080000 + .long 0x00000000,0x79490000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xf88a0000 + .long 0x00000000,0xf1140000 + .long 0x00000000,0xe99e0000 + .long 0x00000000,0xe2280000 + .long 0x00000000,0xdab20000 + .long 0x00000000,0xd33c0000 + .long 0x00000000,0xcbc60000 + .long 0x00000000,0xc4500000 + .long 0x00000000,0xbcda0000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb5640000 + .long 0x00000000,0x6ac80000 + .long 0x00000000,0x202c0000 + .long 0x00000000,0xd5900000 + .long 0x00000000,0x8af40000 + .long 0x00000000,0x40580000 + .long 0x00000000,0xf5bc0000 + .long 0x00000000,0xab200000 + .long 0x00000000,0x60840000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x15e80000 + .long 0x00000000,0x2bd00000 + .long 0x00000000,0x41b80000 + .long 0x00000000,0x57a00000 + .long 0x00000000,0x6d880000 + .long 0x00000000,0x83700000 + .long 0x00000000,0x99580000 + .long 0x00000000,0xaf400000 + .long 0x00000000,0xc5280000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xdb100000 + .long 0x00000000,0xb6200000 + .long 0x00000000,0x91300000 + .long 0x00000000,0x6c400000 + .long 0x00000000,0x47500000 + .long 0x00000000,0x22600000 + .long 0x00000000,0xfd700000 + .long 0x00000000,0xd8800000 + .long 0x00000000,0xb3900000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x8ea00000 + .long 0x00000000,0x1d400000 + .long 0x00000000,0xabe00000 + .long 0x00000000,0x3a800000 + .long 0x00000000,0xc9200000 + .long 0x00000000,0x57c00000 + .long 0x00000000,0xe6600000 + .long 0x00000000,0x75000000 + .long 0x00000000,0x03a00000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x92400000 + .long 0x00000000,0x24800000 + .long 0x00000000,0xb6c00000 + .long 0x00000000,0x49000000 + .long 0x00000000,0xdb400000 + .long 0x00000000,0x6d800000 + .long 0x00000000,0xffc00000 + .long 0x00000000,0x92000000 + .long 0x00000000,0x24400000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb6800000 + .long 0x00000000,0x6d000000 + .long 0x00000000,0x23800000 + .long 0x00000000,0xda000000 + .long 0x00000000,0x90800000 + .long 0x00000000,0x47000000 + .long 0x00000000,0xfd800000 + .long 0x00000000,0xb4000000 + .long 0x00000000,0x6a800000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x21000000 + .long 0x00000000,0x42000000 + .long 0x00000000,0x63000000 + .long 0x00000000,0x84000000 + .long 0x00000000,0xa5000000 + .long 0x00000000,0xc6000000 + .long 0x00000000,0xe7000000 + .long 0x00000000,0x08000000 + .long 0x00000000,0x29000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x4a000000 + .long 0x00000000,0x94000000 + .long 0x00000000,0xde000000 + .long 0x00000000,0x28000000 + .long 0x00000000,0x72000000 + .long 0x00000000,0xbc000000 + .long 0x00000000,0x06000000 + .long 0x00000000,0x50000000 + .long 0x00000000,0x9a000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xe4000000 + .long 0x00000000,0xc8000000 + .long 0x00000000,0xac000000 + .long 0x00000000,0x90000000 + .long 0x00000000,0x74000000 + .long 0x00000000,0x58000000 + .long 0x00000000,0x3c000000 + .long 0x00000000,0x20000000 + .long 0x00000000,0x04000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xe8000000 + .long 0x00000000,0xd0000000 + .long 0x00000000,0xb8000000 + .long 0x00000000,0xa0000000 + .long 0x00000000,0x88000000 + .long 0x00000000,0x70000000 + .long 0x00000000,0x58000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x28000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x10000000 + .long 0x00000000,0x20000000 + .long 0x00000000,0x30000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x50000000 + .long 0x00000000,0x60000000 + .long 0x00000000,0x70000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x90000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xa0000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0xe0000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x20000000 + .long 0x00000000,0xc0000000 + .long 0x00000000,0x60000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xa0000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0xc0000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0xc0000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .type _C_MUL_10_POW_I,@object + .size _C_MUL_10_POW_I,5120 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/libm_tancot_huge.S b/external/sgx_libm/ia32/libm_tancot_huge.S new file mode 100644 index 0000000000..f1b018ed73 --- /dev/null +++ b/external/sgx_libm/ia32/libm_tancot_huge.S @@ -0,0 +1,800 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_tancot_huge.c" + .text +..TXTST0: +# -- Begin __libm_tancot_huge + .text + .align 16,0x90 + .hidden __libm_tancot_huge + .globl __libm_tancot_huge +__libm_tancot_huge: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + movl 16(%ebp), %eax + movl 20(%ebp), %edx + movl %eax, 28(%esp) + movl %edx, 32(%esp) + movl %gs:20, %ecx + xorl %esp, %ecx + movl %ecx, 64(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movl 12(%ebp), %edx + movl %edx, %eax + andl $2147483647, %eax + shrl $31, %edx + movl %edx, 44(%esp) + cmpl $1104150528, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jae ..B1.14 +..B1.4: + fldl 8(%ebp) + fabs + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + fstpt 16(%esp) + fldt 16(%esp) + cmpl $768, %edx + fstl 8(%ebp) + fldl _Pi4Inv@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpl (%esp) + je ..B1.46 +..B1.5: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.6: + fldcw 12(%esp) +..B1.7: + fldl 8(%ebp) + movl $1, %esi + fstpt 16(%esp) +..B1.8: + movl (%esp), %edx + movl 4(%esp), %ecx + movl %ecx, %edi + movl %edx, 8(%esp) + movl %ecx, %edx + andl $1048575, %edx + shrl $20, %edi + orl $1048576, %edx + cmpl $1094713344, %ecx + jae ..B1.10 +..B1.9: + movl %edi, %ecx + negl %ecx + addl $19, %ecx + shrl %cl, %edx + jmp ..B1.11 +..B1.10: + lea 13(%edi), %ecx + negl %edi + addl $19, %edi + shll %cl, %edx + movl %edi, %ecx + movl 8(%esp), %edi + shrl %cl, %edi + orl %edi, %edx +..B1.11: + lea 1(%edx), %ecx + andl $-2, %ecx + movl %ecx, (%esp) + cmpl $1094713344, %eax + fildl (%esp) + jae ..B1.13 +..B1.12: + fldl _Pi4x3@GOTOFF(%ebx) + fmul %st(1), %st + fldl 8+_Pi4x3@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(2) + fmull 16+_Pi4x3@GOTOFF(%ebx) + fldt 16(%esp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.20 +..B1.13: + fldl _Pi4x4@GOTOFF(%ebx) + fmul %st(1), %st + fldl 8+_Pi4x4@GOTOFF(%ebx) + fmul %st(2), %st + fldl 16+_Pi4x4@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(3) + fmull 24+_Pi4x4@GOTOFF(%ebx) + fldt 16(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.20 +..B1.14: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.51 +..B1.15: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.16: + fldcw 12(%esp) +..B1.17: + movl $1, %esi +..B1.18: + fldl 8(%ebp) + addl $-32, %esp + fabs + lea 80(%esp), %eax + fstpt (%esp) + movl $0, 12(%esp) + movl %eax, 16(%esp) + call __libm_reduce_pi04l +..B1.54: + movl %eax, %edx + addl $32, %esp +..B1.19: + fldl 48(%esp) + faddl 56(%esp) + fstpt 16(%esp) +..B1.20: + movl 32(%esp), %eax + andl $3, %eax + cmpl $3, %eax + jne ..B1.28 +..B1.21: + fldl _ones@GOTOFF(%ebx) + incl %edx + fldt 16(%esp) + testb $2, %dl + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fdivr %st, %st(3) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fldt 36+_TP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_TP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_TP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _TP@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 36+_TQ@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt 32(%esp) + fldt 132+_GP@GOTOFF(%ebx) + fmul %st(4), %st + fldt 120+_GP@GOTOFF(%ebx) + fmul %st(5), %st + fldt 108+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 96+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 84+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 72+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 60+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 48+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 36+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 24+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fldt 12+_GP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt _GP@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%esp) + je ..B1.23 +..B1.22: + fldt (%esp) + fxch %st(1) + fdivrp %st, %st(3) + fmulp %st, %st(2) + fldt 16(%esp) + movl 44(%esp), %eax + xorl $1, %eax + fmul %st, %st(2) + fldl _ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(2) + fmul %st, %st(4) + fmul %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + faddp %st, %st(1) + fstpt 32(%esp) + jmp ..B1.24 +..B1.23: + fdivrp %st, %st(2) + fldt (%esp) + fmulp %st, %st(2) + fldt 16(%esp) + fmul %st, %st(2) + movl 44(%esp), %eax + fldl _ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(3) + fmul %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 32(%esp) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) +..B1.24: + testl %esi, %esi + je ..B1.26 +..B1.25: + fldcw 14(%esp) +..B1.26: + fldt 32(%esp) + fldt (%esp) + movl 28(%esp), %eax + fstpl 8(%eax) + fstpl (%eax) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.47 +..B1.27: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.28: + testb $2, 32(%esp) + je ..B1.36 +..B1.29: + fldt 16(%esp) + incl %edx + testb $2, %dl + fmul %st(0), %st + je ..B1.31 +..B1.30: + fldl _ones@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fldt 16(%esp) + fdivr %st, %st(2) + fldt 132+_GP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 120+_GP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 108+_GP@GOTOFF(%ebx) + movl 44(%esp), %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + xorl $1, %eax + fldt 96+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 72+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 36+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt 12+_GP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt _GP@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fldl _ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.32 +..B1.31: + fldt 36+_TP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_TP@GOTOFF(%ebx) + movl 44(%esp), %eax + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_TQ@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12+_TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 12+_TP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt _TP@GOTOFF(%ebx) + faddp %st, %st(1) + fdivp %st, %st(1) + fmulp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%eax,8) + fldt 16(%esp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) +..B1.32: + testl %esi, %esi + je ..B1.34 +..B1.33: + fldcw 14(%esp) +..B1.34: + fldt 16(%esp) + movl 28(%esp), %eax + fstpl (%eax) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.47 +..B1.35: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.36: + testb $1, 32(%esp) + je ..B1.44 +..B1.37: + fldt 16(%esp) + incl %edx + testb $2, %dl + fmul %st(0), %st + fstpt (%esp) + je ..B1.39 +..B1.38: + fldt 36+_TP@GOTOFF(%ebx) + fldt 24+_TP@GOTOFF(%ebx) + fldt 12+_TP@GOTOFF(%ebx) + fldt _TP@GOTOFF(%ebx) + fldt 36+_TQ@GOTOFF(%ebx) + fldt 24+_TQ@GOTOFF(%ebx) + fldt 12+_TQ@GOTOFF(%ebx) + fldt (%esp) + fmul %st, %st(7) + movl 44(%esp), %eax + fxch %st(6) + faddp %st, %st(7) + fxch %st(5) + fmul %st, %st(6) + xorl $1, %eax + fxch %st(4) + faddp %st, %st(6) + fxch %st(3) + fmul %st, %st(5) + fxch %st(2) + faddp %st, %st(5) + fmul %st(1), %st + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(1), %st + fldt _TQ@GOTOFF(%ebx) + faddp %st, %st(1) + fdivrp %st, %st(2) + fmulp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%eax,8) + fldt 16(%esp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.40 +..B1.39: + fldl _ones@GOTOFF(%ebx) + fldt 16(%esp) + fdivr %st, %st(1) + fldt (%esp) + fld %st(0) + fmul %st(1), %st + fldt 132+_GP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 120+_GP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 108+_GP@GOTOFF(%ebx) + movl 44(%esp), %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_GP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 12+_GP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt _GP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldl _ones@GOTOFF(%ebx,%eax,8) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) +..B1.40: + testl %esi, %esi + je ..B1.42 +..B1.41: + fldcw 14(%esp) +..B1.42: + fldt (%esp) + movl 28(%esp), %eax + fstpl 8(%eax) + movl 64(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.47 +..B1.43: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.44: + movl 64(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.47 +..B1.45: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + xorl %esi, %esi + jmp ..B1.8 +..B1.47: + call __stack_chk_fail@PLT +..B1.51: + xorl %esi, %esi + jmp ..B1.18 + .align 16,0x90 + .type __libm_tancot_huge,@function + .size __libm_tancot_huge,.-__libm_tancot_huge + .data +# -- End __libm_tancot_huge + .section .rodata, "a" + .align 16 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_Pi4x3: + .long 1413754880 + .long 3219726843 + .long 993632256 + .long 1027030475 + .long 3773204808 + .long 3129236486 + .type _Pi4x3,@object + .size _Pi4x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi4x4: + .long 1413480448 + .long 3219726843 + .long 442499072 + .long 3183522913 + .long 771751936 + .long 3146979722 + .long 622873025 + .long 3110831002 + .type _Pi4x4,@object + .size _Pi4x4,32 + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_TP: + .word 19670 + .word 44908 + .word 50960 + .word 50786 + .word 49149 + .word 0 + .word 19206 + .word 45228 + .word 54194 + .word 52268 + .word 16377 + .word 0 + .word 227 + .word 51280 + .word 43560 + .word 38195 + .word 49139 + .word 0 + .word 12272 + .word 18029 + .word 6715 + .word 45670 + .word 16357 + .word 0 + .type _TP,@object + .size _TP,48 + .align 16 +_TQ: + .word 14748 + .word 33681 + .word 5452 + .word 38090 + .word 49151 + .word 0 + .word 46755 + .word 50026 + .word 17634 + .word 35372 + .word 16382 + .word 0 + .word 46863 + .word 53352 + .word 42702 + .word 59869 + .word 49145 + .word 0 + .word 33295 + .word 20942 + .word 32118 + .word 39935 + .word 16371 + .word 0 + .type _TQ,@object + .size _TQ,48 + .align 16 +_GP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 46639 + .word 2912 + .word 24758 + .word 46603 + .word 49145 + .word 0 + .word 57255 + .word 2218 + .word 21984 + .word 35507 + .word 49142 + .word 0 + .word 34208 + .word 43033 + .word 48281 + .word 56811 + .word 49138 + .word 0 + .word 28773 + .word 27191 + .word 31071 + .word 45908 + .word 49135 + .word 0 + .word 43257 + .word 33777 + .word 11976 + .word 37184 + .word 49132 + .word 0 + .word 62410 + .word 35990 + .word 36363 + .word 60269 + .word 49128 + .word 0 + .word 13659 + .word 55568 + .word 26569 + .word 48851 + .word 49125 + .word 0 + .word 10347 + .word 46238 + .word 47188 + .word 39576 + .word 49122 + .word 0 + .word 2161 + .word 6703 + .word 25719 + .word 64708 + .word 49118 + .word 0 + .word 42329 + .word 7593 + .word 44754 + .word 47734 + .word 49115 + .word 0 + .word 163 + .word 32746 + .word 39875 + .word 61957 + .word 49112 + .word 0 + .type _GP,@object + .size _GP,144 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/llrint.S b/external/sgx_libm/ia32/llrint.S new file mode 100644 index 0000000000..07c6aac047 --- /dev/null +++ b/external/sgx_libm/ia32/llrint.S @@ -0,0 +1,171 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llrint.c" + .text +..TXTST0: +# -- Begin llrint + .text + .align 16,0x90 + .globl llrint +llrint: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + movl 12(%ebp), %ebx + movl %ebx, %edi + andl $2147483647, %edi + cmpl $1137704960, %edi + jae ..B1.4 +..B1.2: + fldl 8(%ebp) + fistpll 16(%esp) +..B1.3: + movl 16(%esp), %eax + movl 20(%esp), %edx + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.4: + cmpl $1139802112, %edi + jae ..B1.7 +..B1.5: + movl %edi, %edx + andl $1048575, %edi + shrl $20, %edx + orl $1048576, %edi + movl 8(%ebp), %esi + xorl %eax, %eax + shrl $31, %ebx + movl %ebx, (%esp) + addl $-1, %ebx + lea 13(%edx), %ecx + movl %ecx, 4(%esp) + adcl $2147483647, %eax + negl %edx + addl $19, %edx + shll %cl, %edi + movl %edx, %ecx + movl %esi, %edx + shrl %cl, %edx + movl 4(%esp), %ecx + orl %edx, %edi + shll %cl, %esi + movl %edi, %ecx + movl %esi, %edx + subl %ebx, %edx + movl (%esp), %ebx + sbbl %eax, %ecx + jb ..B1.6 +..B1.10: + orl %ecx, %edx + jne ..B1.7 +..B1.6: + xorl %eax, %eax + xorl %edx, %edx + subl %esi, %eax + sbbl %edi, %edx + testl %ebx, %ebx + jne ..L2 + movl %esi, %eax +..L2: + jne ..L3 + movl %edi, %edx +..L3: + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.7: + call ..L4 +..L4: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%eax), %eax + movl $-2147483648, %edx + movl $0, 16(%esp) + movl $-2147483648, 20(%esp) + fldl _infs@GOTOFF(%eax) + fmull _zeros@GOTOFF(%eax) + xorl %eax, %eax + fstpl 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type llrint,@function + .size llrint,.-llrint + .data +# -- End llrint + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/llrintf.S b/external/sgx_libm/ia32/llrintf.S new file mode 100644 index 0000000000..f3e668b7e8 --- /dev/null +++ b/external/sgx_libm/ia32/llrintf.S @@ -0,0 +1,143 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llrintf.c" + .text +..TXTST0: +# -- Begin llrintf + .text + .align 16,0x90 + .globl llrintf +llrintf: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + pushl %ebx + pushl %ebp + subl $20, %esp + movl 32(%esp), %ebp + movl %ebp, %ebx + andl $2147483647, %ebx + cmpl $1585446912, %ebx + jae ..B1.4 +..B1.2: + flds 32(%esp) + fistpll 8(%esp) +..B1.3: + movl 8(%esp), %eax + movl 12(%esp), %edx + addl $20, %esp + popl %ebp + popl %ebx + ret +..B1.4: + cmpl $1602224128, %ebx + jae ..B1.7 +..B1.5: + shrl $31, %ebp + movl %ebx, %ecx + shrl $23, %ecx + andl $8388607, %ebx + movl %ebp, %eax + orl $8388608, %ebx + xorl %edx, %edx + addl $-1, %eax + adcl $2147483647, %edx + addl $10, %ecx + shll %cl, %ebx + xorl %ecx, %ecx + subl %eax, %ecx + movl %ebx, %eax + sbbl %edx, %eax + jb ..B1.6 +..B1.10: + orl %eax, %ecx + jne ..B1.7 +..B1.6: + movl %ebx, %edx + xorl %eax, %eax + negl %edx + testl %ebp, %ebp + jne ..L2 + movl %ebx, %edx +..L2: + addl $20, %esp + popl %ebp + popl %ebx + ret +..B1.7: + call ..L3 +..L3: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L3](%eax), %eax + movl $-2147483648, %edx + movl $0, 8(%esp) + movl $-2147483648, 12(%esp) + fldl _infs@GOTOFF(%eax) + fmull _zeros@GOTOFF(%eax) + xorl %eax, %eax + fstpl (%esp) + addl $20, %esp + popl %ebp + popl %ebx + ret + .align 16,0x90 + .type llrintf,@function + .size llrintf,.-llrintf + .data +# -- End llrintf + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/llrintl.S b/external/sgx_libm/ia32/llrintl.S new file mode 100644 index 0000000000..c61248bbf7 --- /dev/null +++ b/external/sgx_libm/ia32/llrintl.S @@ -0,0 +1,339 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llrintl.c" + .text +..TXTST0: +# -- Begin llrintl + .text + .align 16,0x90 + .globl llrintl +llrintl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + movzbl 17(%ebp), %eax + movzwl 16(%ebp), %edx + andl $128, %eax + andl $32767, %edx + shrl $7, %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $16445, %edx + jge ..B1.8 +..B1.2: + testl %edx, %edx + jne ..B1.6 +..B1.3: + cmpl $0, 12(%ebp) + jne ..B1.5 +..B1.4: + cmpl $0, 8(%ebp) + je ..B1.6 +..B1.5: + fldl _smallest_value_64@GOTOFF(%ecx) + fstpl 24(%esp) +..B1.6: + fldt 8(%ebp) + fistpll 40(%esp) +..B1.7: + movl 40(%esp), %eax + movl 44(%esp), %edx + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.8: + cmpl $16447, %edx + jge ..B1.35 +..B1.9: + movl %eax, %ebx + xorl %esi, %esi + addl $-1, %ebx + movl %ebx, 36(%esp) + adcl $2147483647, %esi + movl %esi, 32(%esp) + cmpl $16446, %edx + jge ..B1.21 +..B1.10: + fnstcw 20(%esp) +..B1.11: + movl 8(%ebp), %ebx + movzwl 20(%esp), %esi + movl %ebx, 12(%esp) + andl $1, %ebx + movl %ebx, 8(%esp) + andl $3072, %esi + jne ..B1.13 +..B1.12: + movl 12(%esp), %esi + movl %eax, (%esp) + movl %esi, %eax + movl 12(%ebp), %edi + movl %edi, %ebx + shll $31, %edi + andl $3, %esi + shrl $1, %eax + orl %eax, %edi + cmpl $3, %esi + movl $0, %eax + sete %al + shrl $1, %ebx + addl %eax, %edi + movl (%esp), %eax + adcl $0, %ebx + jmp ..B1.22 +..B1.13: + cmpl $2048, %esi + jne ..B1.15 +..B1.14: + xorl %ebx, %ebx + testl %eax, %eax + setne %bl + movl %ebx, (%esp) + jmp ..B1.16 +..B1.15: + movl $0, (%esp) + cmpl $1024, %esi + je ..B1.17 +..B1.16: + movl $0, 4(%esp) + jmp ..B1.18 +..B1.17: + xorl %ebx, %ebx + testl %eax, %eax + sete %bl + movl %ebx, 4(%esp) +..B1.18: + cmpl $3072, %esi + movl $0, %ebx + sete %bl + orl (%esp), %ebx + movl 12(%ebp), %edi + orl 4(%esp), %ebx + je ..B1.20 +..B1.19: + movl 12(%esp), %esi + movl %edi, %ebx + shll $31, %edi + shrl $1, %esi + shrl $1, %ebx + orl %esi, %edi + jmp ..B1.22 +..B1.20: + movl 12(%esp), %esi + movl %edi, %ebx + movl %eax, (%esp) + movl %esi, %eax + shll $31, %edi + andl $1, %esi + shrl $1, %eax + orl %eax, %edi + shrl $1, %ebx + addl %esi, %edi + movl (%esp), %eax + adcl $0, %ebx + jmp ..B1.22 +..B1.21: + movl 12(%ebp), %ebx + movl 8(%ebp), %edi + movl $0, 8(%esp) +..B1.22: + testl %eax, %eax + je ..B1.24 +..B1.23: + xorl %eax, %eax + xorl %esi, %esi + subl %edi, %eax + movl %eax, (%esp) + sbbl %ebx, %esi + movl %esi, 12(%esp) + movl %esi, 4(%esp) + jmp ..B1.25 +..B1.24: + movl %ebx, 12(%esp) + movl %edi, %eax + movl %edi, (%esp) + movl %ebx, 4(%esp) +..B1.25: + movl %eax, %esi + subl %edi, %esi + movl 12(%esp), %esi + sbbl %ebx, %esi + jb ..B1.27 +..B1.26: + movl $1, %esi + jmp ..B1.28 +..B1.27: + xorl %esi, %esi +..B1.28: + subl 36(%esp), %edi + sbbl 32(%esp), %ebx + jb ..B1.29 +..B1.46: + orl %ebx, %edi + jne ..B1.30 +..B1.29: + movl $1, %ebx + jmp ..B1.31 +..B1.30: + xorl %ebx, %ebx +..B1.31: + testl %ebx, %esi + je ..B1.35 +..B1.32: + cmpl $0, 8(%esp) + je ..B1.34 +..B1.33: + fldl _ones@GOTOFF(%ecx) + movl (%esp), %eax + movl 4(%esp), %edx + movl %eax, 40(%esp) + movl %edx, 44(%esp) + movl %edx, 12(%esp) + faddl _small_value_64@GOTOFF(%ecx) + fstpl 24(%esp) +..B1.34: + movl 12(%esp), %edx + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.35: + fldl _infs@GOTOFF(%ecx) + cmpl $32767, %edx + fmull _zeros@GOTOFF(%ecx) + fstpl 24(%esp) + movl $0, 40(%esp) + movl $-2147483648, 44(%esp) + jne ..B1.38 +..B1.36: + cmpl $-2147483648, 12(%ebp) + jne ..B1.43 +..B1.37: + cmpl $0, 8(%ebp) + jne ..B1.43 +..B1.38: + fnstcw 18(%esp) +..B1.39: + movzwl 18(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.40: + orl $-64768, %edx + movw %dx, 16(%esp) +..B1.41: + fldcw 16(%esp) +..B1.42: + fldcw 18(%esp) +..B1.43: + movl 40(%esp), %eax + movl 44(%esp), %edx + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type llrintl,@function + .size llrintl,.-llrintl + .data +# -- End llrintl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/llround_wmt.S b/external/sgx_libm/ia32/llround_wmt.S new file mode 100644 index 0000000000..a4f36ea8bf --- /dev/null +++ b/external/sgx_libm/ia32/llround_wmt.S @@ -0,0 +1,239 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llround_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin llround + .text + .align 16,0x90 + .globl llround +llround: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movsd %xmm0, 16(%esp) + pextrw $3, %xmm0, %eax + movl $32767, %edx + andl %eax, %edx + cmpl $17200, %edx + jge .L_2TAG_PACKET_0.0.3 + cmpl $16368, %edx + jl .L_2TAG_PACKET_1.0.3 + movapd %xmm0, %xmm5 + movapd 112(%ebx), %xmm4 + pxor %xmm6, %xmm6 + pand %xmm0, %xmm4 + movapd %xmm0, %xmm1 + psrlq $52, %xmm0 + cmpltsd %xmm6, %xmm5 + pand 64(%ebx), %xmm0 + movss 80(%ebx), %xmm2 + movss 96(%ebx), %xmm3 + pcmpeqd %xmm6, %xmm6 + psubd %xmm0, %xmm2 + psubd %xmm0, %xmm3 + psrlq %xmm3, %xmm1 + por 128(%ebx), %xmm4 + pand 144(%ebx), %xmm1 + psrlq %xmm2, %xmm4 + pxor %xmm5, %xmm6 + paddq %xmm1, %xmm4 + pand %xmm4, %xmm5 + pand %xmm4, %xmm6 + psubq %xmm5, %xmm6 + movd %xmm6, %eax + psrlq $32, %xmm6 + movd %xmm6, %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + comisd 16(%ebx), %xmm0 + jc .L_2TAG_PACKET_3.0.3 + comisd (%ebx), %xmm0 + jnc .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_4.0.3: + fldl 16(%esp) + subl $8, %esp + fistpll (%esp) + popl %eax + popl %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + subl $16352, %edx + xorl $32768, %eax + movl $1, %ecx + shrl $31, %edx + shrl $15, %eax + xorl %edx, %ecx + orl %eax, %edx + andl %ecx, %eax + shll $31, %ecx + addl %edx, %eax + movl 20(%esp), %edx + subl $1, %eax + andl %ecx, %edx + sarl $31, %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + jp .L_2TAG_PACKET_5.0.3 + pcmpeqd %xmm1, %xmm1 + pslld $23, %xmm1 + subss %xmm1, %xmm1 + movl $0, (%esp) + movl $-2147483648, 4(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $194, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl (%esp), %eax + movl 4(%esp), %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_5.0.3: + movl $-2147483648, %edx + movl $0, %eax +.L_2TAG_PACKET_2.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type llround,@function + .size llround,.-llround + .data +# -- End llround + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1138753536 + .long 0 + .long 1138753536 + .long 0 + .long 3286237184 + .long 0 + .long 3286237184 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 2047 + .long 0 + .long 2047 + .long 0 + .long 1075 + .long 1075 + .long 1075 + .long 1075 + .long 1074 + .long 1074 + .long 1074 + .long 1074 + .long 4294967295 + .long 1048575 + .long 0 + .long 0 + .long 0 + .long 1048576 + .long 0 + .long 0 + .long 1 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,160 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/llroundf_wmt.S b/external/sgx_libm/ia32/llroundf_wmt.S new file mode 100644 index 0000000000..a32aa8225e --- /dev/null +++ b/external/sgx_libm/ia32/llroundf_wmt.S @@ -0,0 +1,195 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llroundf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin llroundf + .text + .align 16,0x90 + .globl llroundf +llroundf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movss 128(%esp), %xmm0 + movss %xmm0, 16(%esp) + movl 16(%esp), %eax + movl $2147483647, %edx + andl %eax, %edx + cmpl $1258291200, %edx + jge .L_2TAG_PACKET_0.0.3 + cmpl $1065353216, %edx + jl .L_2TAG_PACKET_1.0.3 + shrl $23, %edx + movl $149, %ecx + subl %edx, %ecx + movl $8388607, %edx + andl %eax, %edx + shrl %cl, %eax + orl $8388608, %edx + andl $1, %eax + shrl %cl, %edx + movl $-2147483648, %ecx + shrl $1, %edx + xorl 16(%esp), %ecx + addl %edx, %eax + movl 16(%esp), %edx + sarl $31, %ecx + sarl $31, %edx + andl %eax, %edx + andl %ecx, %eax + subl %edx, %eax + movl 16(%esp), %edx + sarl $31, %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + cmpl $-553648128, %eax + ja .L_2TAG_PACKET_3.0.3 + cmpl $1593835520, %eax + jge .L_2TAG_PACKET_3.0.3 + flds 16(%esp) + subl $8, %esp + fistpll (%esp) + popl %eax + popl %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + ucomiss %xmm0, %xmm0 + subl $1056964608, %edx + xorl $-2147483648, %eax + movl $1, %ecx + shrl $31, %edx + shrl $31, %eax + xorl %edx, %ecx + orl %eax, %edx + andl %ecx, %eax + addl %edx, %eax + movl $-1, %edx + addl %eax, %edx + subl $1, %eax + sarl $31, %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + comiss %xmm0, %xmm0 + jp .L_2TAG_PACKET_4.0.3 + pcmpeqd %xmm1, %xmm1 + pslld $23, %xmm1 + subss %xmm1, %xmm1 + movl $-2147483648, (%esp) + movl $0, 4(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $194, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl (%esp), %eax + movl 4(%esp), %edx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + movl $-2147483648, %eax +.L_2TAG_PACKET_2.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type llroundf,@function + .size llroundf,.-llroundf + .data +# -- End llroundf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .type static_const_table,@object + .size static_const_table,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/llroundl.S b/external/sgx_libm/ia32/llroundl.S new file mode 100644 index 0000000000..a414b2823b --- /dev/null +++ b/external/sgx_libm/ia32/llroundl.S @@ -0,0 +1,383 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llroundl.c" + .text +..TXTST0: +# -- Begin llroundl + .text + .align 16,0x90 + .globl llroundl +llroundl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + movzbl 17(%ebp), %ebx + movzwl 16(%ebp), %eax + andl $128, %ebx + andl $32767, %eax + shrl $7, %ebx + call ..L2 +..L2: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi + cmpl $16445, %eax + jge ..B1.17 +..B1.2: + cmpl $16415, %eax + jge ..B1.16 +..B1.3: + cmpl $16414, %eax + jge ..B1.15 +..B1.4: + cmpl $16413, %eax + jge ..B1.14 +..B1.5: + cmpl $16383, %eax + jge ..B1.13 +..B1.6: + cmpl $16382, %eax + jge ..B1.12 +..B1.7: + testl %eax, %eax + jne ..B1.11 +..B1.8: + cmpl $0, 12(%ebp) + jne ..B1.10 +..B1.9: + cmpl $0, 8(%ebp) + je ..B1.11 +..B1.10: + fldl _smallest_value_64@GOTOFF(%edi) + fstpl 8(%esp) +..B1.11: + xorl %eax, %eax + xorl %edx, %edx + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.12: + movl iones@GOTOFF(%edi,%ebx,4), %eax + cltd + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + negl %eax + movl 12(%ebp), %esi + movl %esi, %edi + lea 30(%eax), %ecx + addl $29, %eax + shrl %cl, %edi + movl %eax, %ecx + shrl %cl, %esi + andl $1, %esi + addl %esi, %edi + movl %edi, %eax + negl %eax + testl %ebx, %ebx + jne ..L3 + movl %edi, %eax +..L3: + cltd + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + negl %eax + addl $30, %eax + movl 12(%ebp), %edx + movl %edx, %esi + movl %eax, %ecx + andl $1, %esi + shrl %cl, %edx + xorl %eax, %eax + addl %edx, %esi + xorl %edx, %edx + subl %esi, %eax + sbbl $0, %edx + testl %ebx, %ebx + jne ..L4 + movl %esi, %eax +..L4: + jne ..L5 + movl $0, %edx +..L5: + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + movl 8(%ebp), %ecx + xorl %esi, %esi + shrl $31, %ecx + xorl %eax, %eax + addl 12(%ebp), %ecx + adcl $0, %esi + xorl %edx, %edx + subl %ecx, %eax + sbbl %esi, %edx + testl %ebx, %ebx + jne ..L6 + movl %ecx, %eax +..L6: + jne ..L7 + movl %esi, %edx +..L7: + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + movl %eax, %esi + addl $2, %eax + negl %esi + movl 12(%ebp), %edi + movl %esi, (%esp) + lea 30(%esi), %edx + movl %edi, %esi + movl %edx, %ecx + shrl %cl, %esi + movl %eax, %ecx + shll %cl, %edi + movl %edx, %ecx + movl 8(%ebp), %edx + movl %edx, %eax + shrl %cl, %eax + movl (%esp), %ecx + orl %eax, %edi + addl $29, %ecx + xorl %eax, %eax + shrl %cl, %edx + andl $1, %edx + addl %edx, %edi + adcl $0, %esi + xorl %edx, %edx + subl %edi, %eax + sbbl %esi, %edx + testl %ebx, %ebx + jne ..L8 + movl %edi, %eax +..L8: + jne ..L9 + movl %esi, %edx +..L9: + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + cmpl $16447, %eax + jge ..B1.29 +..B1.18: + movl %ebx, %edx + xorl %esi, %esi + addl $-1, %edx + movl %edx, 20(%esp) + adcl $2147483647, %esi + movl %esi, 16(%esp) + cmpl $16446, %eax + movl 12(%ebp), %edx + movl 8(%ebp), %esi + jge ..B1.21 +..B1.19: + movl %ebx, (%esp) + movl %esi, %ebx + shrl $1, %ebx + movl %edx, %ecx + shll $31, %edx + andl $1, %esi + orl %ebx, %edx + shrl $1, %ecx + addl %edx, %esi + movl %ecx, %edx + movl (%esp), %ebx + adcl $0, %edx +..B1.21: + xorl %ecx, %ecx + subl %esi, %ecx + movl %eax, 28(%esp) + movl $0, %eax + sbbl %edx, %eax + testl %ebx, %ebx + jne ..L10 + movl %esi, %ecx +..L10: + jne ..L11 + movl %edx, %eax +..L11: + movl %ecx, 24(%esp) + subl %esi, %ecx + movl %eax, (%esp) + sbbl %edx, %eax + movl 28(%esp), %eax + jb ..B1.23 +..B1.22: + movl $1, %ebx + jmp ..B1.24 +..B1.23: + xorl %ebx, %ebx +..B1.24: + subl 20(%esp), %esi + sbbl 16(%esp), %edx + jb ..B1.25 +..B1.40: + orl %edx, %esi + jne ..B1.26 +..B1.25: + movl $1, %edx + jmp ..B1.27 +..B1.26: + xorl %edx, %edx +..B1.27: + testl %edx, %ebx + je ..B1.29 +..B1.28: + movl 24(%esp), %eax + movl (%esp), %edx + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + fldl _infs@GOTOFF(%edi) + cmpl $32767, %eax + fmull _zeros@GOTOFF(%edi) + fstpl 8(%esp) + jne ..B1.32 +..B1.30: + cmpl $-2147483648, 12(%ebp) + jne ..B1.37 +..B1.31: + cmpl $0, 8(%ebp) + jne ..B1.37 +..B1.32: + fnstcw 6(%esp) +..B1.33: + movzwl 6(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.34: + orl $-64768, %edx + movw %dx, 4(%esp) +..B1.35: + fldcw 4(%esp) +..B1.36: + fldcw 6(%esp) +..B1.37: + xorl %eax, %eax + movl $-2147483648, %edx + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type llroundl,@function + .size llroundl,.-llroundl + .data +# -- End llroundl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log10_wmt.S b/external/sgx_libm/ia32/log10_wmt.S new file mode 100644 index 0000000000..741ba00edf --- /dev/null +++ b/external/sgx_libm/ia32/log10_wmt.S @@ -0,0 +1,815 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log10 + .text + .align 16,0x90 + .globl log10 +log10: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movl $1054736384, %ecx + movd %ecx, %xmm7 + xorpd %xmm3, %xmm3 + movl $30704, %edx + pinsrw $3, %edx, %xmm3 + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + movl $32768, %edx + movd %edx, %xmm4 + movapd 2128(%ebx), %xmm5 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $16352, %ecx + psllq $5, %xmm0 + movsd 2144(%ebx), %xmm2 + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + mulss %xmm7, %xmm0 + orpd %xmm3, %xmm1 + andpd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + subsd %xmm5, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm6, %xmm0 + andl $32752, %eax + subl %ecx, %eax + cvtsi2sdl %eax, %xmm7 + mulpd %xmm0, %xmm5 + mulsd %xmm0, %xmm1 + movsd 2064(%ebx), %xmm6 + movapd 2080(%ebx), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd -1504(%ebx,%edx), %xmm0 + movapd 2096(%ebx), %xmm4 + addsd %xmm5, %xmm1 + movapd 2112(%ebx), %xmm2 + mulsd %xmm7, %xmm6 + pshufd $68, %xmm1, %xmm5 + mulsd 2072(%ebx), %xmm7 + mulsd %xmm1, %xmm3 + addsd %xmm6, %xmm0 + mulpd %xmm5, %xmm4 + movsd 2152(%ebx), %xmm6 + mulpd %xmm5, %xmm5 + addpd %xmm2, %xmm4 + mulpd %xmm5, %xmm3 + pshufd $228, %xmm0, %xmm2 + addsd %xmm1, %xmm0 + mulsd %xmm1, %xmm4 + subsd %xmm0, %xmm2 + mulsd %xmm1, %xmm6 + addsd %xmm2, %xmm1 + pshufd $238, %xmm0, %xmm2 + mulsd %xmm5, %xmm5 + addsd %xmm2, %xmm7 + addsd %xmm6, %xmm1 + addpd %xmm3, %xmm4 + addsd %xmm7, %xmm1 + mulpd %xmm5, %xmm4 + addsd %xmm4, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_3.0.3 + cmpl $16, %eax + jb .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + ja .L_2TAG_PACKET_5.0.3 + cmpl $0, %edx + ja .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_3.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_6.0.3 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_7.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + movl $9, %edx + mulsd %xmm1, %xmm0 +.L_2TAG_PACKET_9.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_10.0.3 +.L_2TAG_PACKET_8.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $8, %edx + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_4.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_8.0.3 + xorpd %xmm1, %xmm1 + movl $18416, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movapd %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $18416, %ecx + psllq $5, %xmm0 + movsd 2144(%ebx), %xmm2 + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_10.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log10,@function + .size log10,.-log10 + .data +# -- End log10 + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1352628224 + .long 1070810131 + .long 521319256 + .long 1025503025 + .long 2150839296 + .long 1070801944 + .long 3329350096 + .long 3170190015 + .long 1360613376 + .long 1070793794 + .long 2024059075 + .long 1024991594 + .long 1875350528 + .long 1070785680 + .long 2163882141 + .long 3163564137 + .long 2312126464 + .long 1070777602 + .long 1975711076 + .long 1023674196 + .long 1306336256 + .long 1070769560 + .long 3524899523 + .long 3170508164 + .long 1806334976 + .long 1070761553 + .long 4254777025 + .long 1025238739 + .long 2483193856 + .long 1070753581 + .long 3800671317 + .long 3172916830 + .long 2025350144 + .long 1070745644 + .long 1731514745 + .long 1025501083 + .long 3433285632 + .long 1070737741 + .long 2551857336 + .long 3169662186 + .long 1134317568 + .long 1070729873 + .long 3426297655 + .long 3172637891 + .long 2457152512 + .long 1070722038 + .long 63549415 + .long 1025415416 + .long 1861803008 + .long 1070714237 + .long 1910171636 + .long 1023977580 + .long 2414140416 + .long 1070706469 + .long 4002514337 + .long 3170841618 + .long 2900726784 + .long 1070698734 + .long 3268064083 + .long 1022459609 + .long 2123517952 + .long 1070691032 + .long 1767031218 + .long 1022448156 + .long 3194569728 + .long 1070683362 + .long 3402332618 + .long 3171671160 + .long 650882048 + .long 1070675725 + .long 4146023905 + .long 3171023038 + .long 1928988672 + .long 1070668119 + .long 1438617867 + .long 1016360491 + .long 1594908672 + .long 1070660545 + .long 971389377 + .long 1024763979 + .long 2818746368 + .long 1070653002 + .long 3555925341 + .long 3172434821 + .long 194584576 + .long 1070645491 + .long 943919215 + .long 3172950063 + .long 1215096832 + .long 1070638010 + .long 2283358588 + .long 1022335098 + .long 501519360 + .long 1070630560 + .long 480904295 + .long 1024437959 + .long 1278266368 + .long 1070623140 + .long 2755806066 + .long 3172342012 + .long 2487812096 + .long 1070615750 + .long 2489653202 + .long 3172481099 + .long 3085451264 + .long 1070608390 + .long 3759184951 + .long 3172574892 + .long 2039090176 + .long 1070601060 + .long 1361176676 + .long 3172355319 + .long 953057280 + .long 1070591423 + .long 1176587546 + .long 3166422018 + .long 3370524672 + .long 1070576879 + .long 3669570051 + .long 1025376630 + .long 749742080 + .long 1070562394 + .long 707700964 + .long 3170814058 + .long 4008353792 + .long 1070547965 + .long 3247327652 + .long 1022431400 + .long 2612455424 + .long 1070533594 + .long 2453457344 + .long 3172322969 + .long 3230920704 + .long 1070519279 + .long 1296781801 + .long 1025115335 + .long 3965253632 + .long 1070505020 + .long 373075289 + .long 1017938528 + .long 2593157120 + .long 1070476669 + .long 1068054086 + .long 1021616576 + .long 925962240 + .long 1070448537 + .long 850121213 + .long 1023928989 + .long 1732556800 + .long 1070420620 + .long 1305206740 + .long 3172665570 + .long 3815630848 + .long 1070392915 + .long 192642943 + .long 3172699907 + .long 2001758208 + .long 1070365420 + .long 2820786683 + .long 1024704867 + .long 16746496 + .long 1070338131 + .long 1399573110 + .long 3171372773 + .long 1886492672 + .long 1070311044 + .long 3621428075 + .long 3172974358 + .long 3338196992 + .long 1070284157 + .long 3793882035 + .long 1025124701 + .long 381769728 + .long 1070257468 + .long 3877933342 + .long 3170195490 + .long 2186491904 + .long 1070230972 + .long 1838687089 + .long 1017927292 + .long 1008330752 + .long 1070204668 + .long 2228321664 + .long 1025352196 + .long 2247065600 + .long 1070178552 + .long 1413900906 + .long 3170902532 + .long 2964070400 + .long 1070152622 + .long 3590454629 + .long 1025016844 + .long 465154048 + .long 1070126876 + .long 2079688550 + .long 3172268183 + .long 883615744 + .long 1070101310 + .long 989244452 + .long 3171900485 + .long 1993768960 + .long 1070075922 + .long 1124327841 + .long 3172964992 + .long 1794471936 + .long 1070050710 + .long 1140575046 + .long 1022673726 + .long 2797932544 + .long 1070025671 + .long 1894836933 + .long 3172544059 + .long 3433797632 + .long 1070000803 + .long 3221831166 + .long 3171921685 + .long 2338371584 + .long 1069976104 + .long 3732461053 + .long 3164513518 + .long 2644013056 + .long 1069951571 + .long 2519460462 + .long 3172548740 + .long 3383814144 + .long 1069927202 + .long 2290997657 + .long 1025499649 + .long 3781380096 + .long 1069902995 + .long 380479405 + .long 1025184136 + .long 3245785088 + .long 1069878948 + .long 1096398261 + .long 3169885192 + .long 1366712320 + .long 1069855059 + .long 2218343715 + .long 3170281628 + .long 2204717056 + .long 1069831325 + .long 2668334011 + .long 1025264524 + .long 1401772032 + .long 1069807745 + .long 4103993159 + .long 1022925721 + .long 3356721152 + .long 1069784316 + .long 3573790772 + .long 3172186527 + .long 4041148416 + .long 1069761037 + .long 4027691910 + .long 3171276990 + .long 3880151040 + .long 1069737906 + .long 4087118786 + .long 3172710734 + .long 3453364224 + .long 1069714921 + .long 99014299 + .long 3172003077 + .long 3491092480 + .long 1069692080 + .long 3801836701 + .long 3172989287 + .long 575580160 + .long 1069669382 + .long 1920406012 + .long 3170874125 + .long 22282240 + .long 1069646824 + .long 964193370 + .long 1019363159 + .long 2991429632 + .long 1069624404 + .long 3372589890 + .long 1023425053 + .long 2189645824 + .long 1069602122 + .long 2610503872 + .long 1023652442 + .long 3341467648 + .long 1069579975 + .long 1190292004 + .long 1022425665 + .long 3711293440 + .long 1069557962 + .long 1104795356 + .long 1023625829 + .long 1380401152 + .long 1069524644 + .long 1156998217 + .long 1025100499 + .long 765710336 + .long 1069481144 + .long 1736649113 + .long 1024999439 + .long 849412096 + .long 1069437902 + .long 2618178330 + .long 3170853629 + .long 1433104384 + .long 1069394915 + .long 43477267 + .long 3170378811 + .long 2548596736 + .long 1069352180 + .long 3967367063 + .long 1025246584 + .long 157577216 + .long 1069309695 + .long 100402533 + .long 3172825502 + .long 3326238720 + .long 1069267455 + .long 1176892909 + .long 1025464099 + .long 4155494400 + .long 1069225459 + .long 3713707617 + .long 3172630046 + .long 3545804800 + .long 1069183704 + .long 857007315 + .long 1024965777 + .long 2602520576 + .long 1069142187 + .long 2588758347 + .long 1022463131 + .long 2631196672 + .long 1069100905 + .long 2118424235 + .long 1022490989 + .long 838135808 + .long 1069059856 + .long 4117002727 + .long 1024874520 + .long 3210903552 + .long 1069019036 + .long 650070125 + .long 3172012966 + .long 3039211520 + .long 1068978444 + .long 438055812 + .long 1017743757 + .long 2385633280 + .long 1068938077 + .long 3011990369 + .long 3171312044 + .long 3491618816 + .long 1068897932 + .long 712813818 + .long 3172720400 + .long 183644160 + .long 1068858008 + .long 4287006742 + .long 1022379728 + .long 3639214080 + .long 1068818300 + .long 353762279 + .long 3172980009 + .long 3728416768 + .long 1068778808 + .long 1851367730 + .long 1025486574 + .long 3370094592 + .long 1068739529 + .long 4046594913 + .long 3172567047 + .long 1348407296 + .long 1068700461 + .long 143189675 + .long 1025397632 + .long 899403776 + .long 1068661601 + .long 3753687842 + .long 3170772772 + .long 1117708288 + .long 1068622947 + .long 1857340812 + .long 3170782678 + .long 1248276480 + .long 1068584497 + .long 1289858203 + .long 1025222289 + .long 683237376 + .long 1068546249 + .long 2356679608 + .long 3171629170 + .long 3253764096 + .long 1068508200 + .long 3267136556 + .long 1018554987 + .long 94478336 + .long 1068441756 + .long 1927868814 + .long 3169378180 + .long 3233144832 + .long 1068366445 + .long 2682188854 + .long 1023964004 + .long 2940297216 + .long 1068291522 + .long 275301289 + .long 1023944679 + .long 3677708288 + .long 1068216982 + .long 302658771 + .long 1024465567 + .long 1576968192 + .long 1068142822 + .long 3672035940 + .long 3172254610 + .long 1614069760 + .long 1068069037 + .long 480052905 + .long 3172692062 + .long 424435712 + .long 1067995624 + .long 2207869657 + .long 3170965436 + .long 3477782528 + .long 1067922578 + .long 2980661858 + .long 3164990018 + .long 3598401536 + .long 1067849897 + .long 1974393034 + .long 3171357083 + .long 2435235840 + .long 1067777577 + .long 1385289011 + .long 1024615823 + .long 1867333632 + .long 1067705614 + .long 3442236633 + .long 1025334384 + .long 3999301632 + .long 1067634004 + .long 3506472073 + .long 1025132546 + .long 2566971392 + .long 1067562745 + .long 1425757592 + .long 3172358463 + .long 112943104 + .long 1067491833 + .long 1693407156 + .long 3172426603 + .long 3079929856 + .long 1067392159 + .long 3999942455 + .long 1018549369 + .long 2443837440 + .long 1067251701 + .long 974534460 + .long 1023963412 + .long 359366656 + .long 1067111917 + .long 2204915018 + .long 1013514416 + .long 3564519424 + .long 1066972799 + .long 3977441659 + .long 3170879860 + .long 2011086848 + .long 1066834343 + .long 590145514 + .long 1025390011 + .long 3216982016 + .long 1066696541 + .long 3629120110 + .long 1024330313 + .long 2194128896 + .long 1066559388 + .long 2367098512 + .long 3172260338 + .long 2916220928 + .long 1066422877 + .long 2262431886 + .long 1021229446 + .long 2263941120 + .long 1066172214 + .long 3118507287 + .long 1021484970 + .long 3076292608 + .long 1065901726 + .long 1411737803 + .long 3172957147 + .long 1186136064 + .long 1065632488 + .long 3109349337 + .long 1025397383 + .long 3085303808 + .long 1065364487 + .long 584715031 + .long 3172596519 + .long 1821048832 + .long 1064842211 + .long 2182246895 + .long 3172536214 + .long 697368576 + .long 1064311094 + .long 3157561765 + .long 3172716357 + .long 894042112 + .long 1063260131 + .long 3237958154 + .long 3172587292 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1352628224 + .long 1066615827 + .long 521319256 + .long 1021308721 + .long 3248877870 + .long 1077250164 + .long 1691676429 + .long 3221787401 + .long 945132465 + .long 3223701783 + .long 3700831335 + .long 1073506818 + .long 2141010593 + .long 1075227551 + .long 3698831637 + .long 3220339442 + .long 4160749568 + .long 4294967295 + .long 0 + .long 4294959104 + .long 0 + .long 1071366144 + .long 3207479560 + .long 1062894188 + .type static_const_table,@object + .size static_const_table,2160 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log10f_wmt.S b/external/sgx_libm/ia32/log10f_wmt.S new file mode 100644 index 0000000000..083ec694e1 --- /dev/null +++ b/external/sgx_libm/ia32/log10f_wmt.S @@ -0,0 +1,745 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10f_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log10f + .text + .align 16,0x90 + .globl log10f +log10f: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl $16384, %ecx + movd %ecx, %xmm4 + movl $-32768, %eax + movd %eax, %xmm2 + xorpd %xmm3, %xmm3 + movl $16368, %edx + pinsrw $3, %edx, %xmm3 + xorpd %xmm5, %xmm5 +.L_2TAG_PACKET_0.0.3: + movd %xmm0, %edx + rcpss %xmm0, %xmm1 + movsd 2080(%ebx), %xmm7 + pshuflw $68, %xmm0, %xmm0 + paddd %xmm4, %xmm1 + subl $8388608, %edx + cmpl $2113929216, %edx + jae .L_2TAG_PACKET_1.0.3 + andps %xmm1, %xmm2 + cvtps2pd %xmm0, %xmm0 + cvtps2pd %xmm2, %xmm1 + movd %xmm2, %eax + andl $-8388608, %edx + subl $1056964608, %edx + cvtsi2sdl %edx, %xmm6 + mulsd %xmm1, %xmm0 + subl $1056964608, %edx + addl %edx, %eax + shrl $12, %eax + movsd (%ebx,%eax), %xmm4 + subsd %xmm3, %xmm0 + movsd 2088(%ebx), %xmm2 + movsd 2096(%ebx), %xmm1 + mulsd %xmm0, %xmm7 + addsd %xmm0, %xmm5 + mulsd %xmm0, %xmm0 + movsd 2104(%ebx), %xmm3 + mulsd %xmm2, %xmm6 + addsd %xmm7, %xmm1 + mulsd %xmm3, %xmm5 + addsd %xmm4, %xmm6 + mulsd %xmm1, %xmm0 + mulsd %xmm3, %xmm0 + addsd %xmm6, %xmm5 + addsd %xmm0, %xmm5 + cvtpd2ps %xmm5, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + addl $8388608, %edx + js .L_2TAG_PACKET_3.0.3 + cmpl $8388608, %edx + jb .L_2TAG_PACKET_4.0.3 + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_5.0.3 + movl $528482304, %eax + movd %eax, %xmm6 + movsd 2064(%ebx), %xmm5 + mulss %xmm6, %xmm0 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_5.0.3: + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $-2147483648, %edx + je .L_2TAG_PACKET_6.0.3 + addl %edx, %edx + cmpl $-16777216, %edx + ja .L_2TAG_PACKET_5.0.3 + xorps %xmm0, %xmm0 + divss %xmm0, %xmm0 + movl $11, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $0, %edx + je .L_2TAG_PACKET_6.0.3 + movl $1602224128, %eax + movd %eax, %xmm7 + mulss %xmm7, %xmm0 + movsd 2072(%ebx), %xmm5 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_6.0.3: + movl $-1082130432, %eax + movd %eax, %xmm0 + xorps %xmm1, %xmm1 + divss %xmm1, %xmm0 + movl $10, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_2.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log10f,@function + .size log10f,.-log10f + .data +# -- End log10f + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1352628734 + .long 1070810131 + .long 2987063119 + .long 1070803029 + .long 2814064164 + .long 1070795955 + .long 4212141943 + .long 1070788908 + .long 1980466875 + .long 1070781889 + .long 3813543508 + .long 1070774896 + .long 236279882 + .long 1070767931 + .long 3258536649 + .long 1070760991 + .long 3425300546 + .long 1070754078 + .long 4176272103 + .long 1070747191 + .long 370881335 + .long 1070740331 + .long 4057946465 + .long 1070733495 + .long 1525858624 + .long 1070726686 + .long 547082415 + .long 1070719902 + .long 313247743 + .long 1070713143 + .long 24949840 + .long 1070706409 + .long 3186584478 + .long 1070699699 + .long 426349118 + .long 1070693015 + .long 3855853989 + .long 1070686354 + .long 4120324153 + .long 1070679718 + .long 463247870 + .long 1070673107 + .long 726256111 + .long 1070666519 + .long 4169135061 + .long 1070659954 + .long 1469709924 + .long 1070653414 + .long 493534586 + .long 1070646897 + .long 523975765 + .long 1070640403 + .long 852037507 + .long 1070633932 + .long 776253054 + .long 1070627484 + .long 3897545900 + .long 1070621058 + .long 939256246 + .long 1070614656 + .long 4106776832 + .long 1070608275 + .long 4137779223 + .long 1070601917 + .long 733771778 + .long 1070595068 + .long 1451145848 + .long 1070582440 + .long 534475932 + .long 1070569856 + .long 988918143 + .long 1070557315 + .long 1537935568 + .long 1070544817 + .long 918084032 + .long 1070532362 + .long 2173800955 + .long 1070519949 + .long 4067295355 + .long 1070507578 + .long 1078375409 + .long 1070495250 + .long 584148105 + .long 1070482963 + .long 1384016078 + .long 1070470717 + .long 2289448314 + .long 1070458512 + .long 2123818995 + .long 1070446348 + .long 4017216324 + .long 1070434224 + .long 2521384792 + .long 1070422141 + .long 789441093 + .long 1070410098 + .long 1985788785 + .long 1070398094 + .long 696035438 + .long 1070386130 + .long 106715969 + .long 1070374205 + .long 3415214590 + .long 1070362318 + .long 944721792 + .long 1070350471 + .long 208866570 + .long 1070338662 + .long 141776059 + .long 1070326891 + .long 3982843004 + .long 1070315157 + .long 2096724351 + .long 1070303462 + .long 2037982183 + .long 1070291804 + .long 2781151897 + .long 1070280183 + .long 3310550777 + .long 1070268599 + .long 2620153983 + .long 1070257052 + .long 4008439778 + .long 1070245541 + .long 2193367512 + .long 1070234067 + .long 492128552 + .long 1070222629 + .long 2231095287 + .long 1070211226 + .long 2155771957 + .long 1070199859 + .long 3610551033 + .long 1070188527 + .long 1358732975 + .long 1070177231 + .long 3057253384 + .long 1070165969 + .long 3486771566 + .long 1070154742 + .long 1731433722 + .long 1070143550 + .long 1178768569 + .long 1070132392 + .long 929649969 + .long 1070121268 + .long 93163010 + .long 1070110178 + .long 2081471614 + .long 1070099121 + .long 1724818481 + .long 1070088098 + .long 2451297579 + .long 1070077108 + .long 3401857016 + .long 1070066151 + .long 3725172527 + .long 1070055227 + .long 2577555067 + .long 1070044336 + .long 3417827070 + .long 1070033477 + .long 1122330889 + .long 1070022651 + .long 3459676923 + .long 1070011856 + .long 1025885499 + .long 1070001094 + .long 1604039477 + .long 1069990363 + .long 99428678 + .long 1069979664 + .long 14303095 + .long 1069968996 + .long 562888951 + .long 1069958359 + .long 966275143 + .long 1069947753 + .long 452333559 + .long 1069937178 + .long 2550607841 + .long 1069926633 + .long 2207334103 + .long 1069916119 + .long 2965233831 + .long 1069905635 + .long 4078536805 + .long 1069895181 + .long 512906990 + .long 1069884758 + .long 125238661 + .long 1069874364 + .long 2188747907 + .long 1069863999 + .long 1687868933 + .long 1069853664 + .long 2203085958 + .long 1069843358 + .long 3025962321 + .long 1069833081 + .long 3454039745 + .long 1069822833 + .long 2790771261 + .long 1069812614 + .long 345455060 + .long 1069802424 + .long 4023103876 + .long 1069792261 + .long 259609597 + .long 1069782128 + .long 1266320102 + .long 1069772022 + .long 2080303760 + .long 1069761944 + .long 2039124234 + .long 1069751894 + .long 485812347 + .long 1069741872 + .long 1063773386 + .long 1069731877 + .long 3126793337 + .long 1069721909 + .long 1738980508 + .long 1069711969 + .long 559609852 + .long 1069702056 + .long 3253131575 + .long 1069692169 + .long 604213228 + .long 1069682310 + .long 582455508 + .long 1069672477 + .long 2572533957 + .long 1069662670 + .long 1669112468 + .long 1069652890 + .long 1561692097 + .long 1069643136 + .long 1649656812 + .long 1069633408 + .long 1337189125 + .long 1069623706 + .long 33219107 + .long 1069614030 + .long 1446341380 + .long 1069604379 + .long 699863590 + .long 1069594754 + .long 1511626603 + .long 1069585154 + .long 3309054272 + .long 1069575579 + .long 1229105731 + .long 1069566030 + .long 3298097489 + .long 1069556505 + .long 733771778 + .long 1069546492 + .long 941119219 + .long 1069527542 + .long 1822213925 + .long 1069508641 + .long 2284546201 + .long 1069489789 + .long 1244064507 + .long 1069470986 + .long 1920055672 + .long 1069452231 + .long 3245124337 + .long 1069433524 + .long 4160075380 + .long 1069414865 + .long 3613830132 + .long 1069396254 + .long 563343667 + .long 1069377691 + .long 2563457724 + .long 1069359174 + .long 4291983602 + .long 1069340704 + .long 434524432 + .long 1069322282 + .long 2864265762 + .long 1069303905 + .long 1987192266 + .long 1069285575 + .long 1101749477 + .long 1069267291 + .long 3513866209 + .long 1069249052 + .long 3946945232 + .long 1069230859 + .long 1426691339 + .long 1069212712 + .long 3576005763 + .long 1069194609 + .long 845110406 + .long 1069176552 + .long 871215109 + .long 1069158539 + .long 2708643652 + .long 1069140570 + .long 1123731696 + .long 1069122646 + .long 3774627455 + .long 1069104765 + .long 1146452958 + .long 1069086929 + .long 910975575 + .long 1069069136 + .long 2156738207 + .long 1069051386 + .long 3978928660 + .long 1069033679 + .long 1184347907 + .long 1069016016 + .long 1471215619 + .long 1068998395 + .long 3954270793 + .long 1068980816 + .long 3459676923 + .long 1068963280 + .long 3409862493 + .long 1068945786 + .long 2938558446 + .long 1068928334 + .long 1185705548 + .long 1068910924 + .long 1592362480 + .long 1068893555 + .long 3310712728 + .long 1068876227 + .long 1204006778 + .long 1068858941 + .long 3026374165 + .long 1068841695 + .long 3652963247 + .long 1068824490 + .long 2259754590 + .long 1068807326 + .long 2323505846 + .long 1068790202 + .long 3031762664 + .long 1068773118 + .long 3577772136 + .long 1068756074 + .long 3160429577 + .long 1068739070 + .long 984225922 + .long 1068722106 + .long 554163028 + .long 1068705181 + .long 1085767694 + .long 1068688295 + .long 1800008162 + .long 1068671448 + .long 1923243906 + .long 1068654640 + .long 687176001 + .long 1068637871 + .long 1623765358 + .long 1068621140 + .long 3975249632 + .long 1068604447 + .long 2694095274 + .long 1068587793 + .long 1327852021 + .long 1068571177 + .long 3429171449 + .long 1068554598 + .long 3965826047 + .long 1068538057 + .long 2205565303 + .long 1068521554 + .long 1716070423 + .long 1068505088 + .long 3549949915 + .long 1068478374 + .long 3329575661 + .long 1068445590 + .long 1345699131 + .long 1068412880 + .long 477545290 + .long 1068380243 + .long 3613830132 + .long 1068347678 + .long 767774141 + .long 1068315187 + .long 3436756955 + .long 1068282767 + .long 1652561627 + .long 1068250420 + .long 2635998437 + .long 1068218144 + .long 732052851 + .long 1068185940 + .long 3179609247 + .long 1068153806 + .long 46600657 + .long 1068121744 + .long 2884636118 + .long 1068089751 + .long 1779250255 + .long 1068057829 + .long 4004532339 + .long 1068025976 + .long 3958279445 + .long 1067994193 + .long 341790679 + .long 1067962480 + .long 454760347 + .long 1067930835 + .long 3015335440 + .long 1067899258 + .long 2455010382 + .long 1067867750 + .long 1803457173 + .long 1067836310 + .long 4098519806 + .long 1067804937 + .long 3796209455 + .long 1067773632 + .long 3950504195 + .long 1067742394 + .long 3328378381 + .long 1067711223 + .long 704701956 + .long 1067680119 + .long 3452107772 + .long 1067649080 + .long 1771121268 + .long 1067618108 + .long 3049832979 + .long 1067587201 + .long 1799062323 + .long 1067556360 + .long 1127129613 + .long 1067525584 + .long 4149857684 + .long 1067494872 + .long 1105606892 + .long 1067464226 + .long 3134934760 + .long 1067416919 + .long 166917834 + .long 1067355883 + .long 3892547049 + .long 1067294973 + .long 3436756955 + .long 1067234191 + .long 823651223 + .long 1067173536 + .long 2386449519 + .long 1067113006 + .long 1587501031 + .long 1067052602 + .long 493004867 + .long 1066992323 + .long 1182960573 + .long 1066932168 + .long 1456087142 + .long 1066872137 + .long 3419645072 + .long 1066812229 + .long 604423097 + .long 1066752445 + .long 3734431729 + .long 1066692782 + .long 2072088478 + .long 1066633242 + .long 2072815517 + .long 1066573823 + .long 1615129006 + .long 1066514525 + .long 2885435162 + .long 1066455347 + .long 3281014557 + .long 1066390787 + .long 184567846 + .long 1066272911 + .long 930630719 + .long 1066155272 + .long 1403389293 + .long 1066037870 + .long 1806815988 + .long 1065920704 + .long 2369503088 + .long 1065803773 + .long 3344465584 + .long 1065687076 + .long 713978687 + .long 1065570613 + .long 3369253777 + .long 1065454381 + .long 1795984717 + .long 1065323547 + .long 182837330 + .long 1065092008 + .long 2643543972 + .long 1064860927 + .long 1379209260 + .long 1064630304 + .long 1522032624 + .long 1064400136 + .long 3615182786 + .long 1064036203 + .long 2033862474 + .long 1063577678 + .long 494771387 + .long 1062984042 + .long 1170198564 + .long 1061933680 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 4277811695 + .long 1078341186 + .long 4277811695 + .long 3225824834 + .long 1431655765 + .long 1070945621 + .long 1352628734 + .long 1046692883 + .long 1107282704 + .long 3219128321 + .long 354870542 + .long 1071369083 + .type static_const_table,@object + .size static_const_table,2112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log10l.S b/external/sgx_libm/ia32/log10l.S new file mode 100644 index 0000000000..806e9dc4df --- /dev/null +++ b/external/sgx_libm/ia32/log10l.S @@ -0,0 +1,921 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10l.c" + .text +..TXTST0: +# -- Begin log10l + .text + .align 16,0x90 + .globl log10l +log10l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %edi + andl $128, %edi + shrl $7, %edi + movzwl 16(%ebp), %esi + movl %esi, %ebx + movl %edi, %edx + andl $32767, %ebx + shll $15, %edx + movl 12(%ebp), %eax + orl %ebx, %edx + movl %eax, %ecx + shll $16, %edx + shrl $16, %ecx + orl %ecx, %edx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $2147450880, %edx + jae ..B1.30 +..B1.4: + addl $-1073676224, %edx + cmpl $32863, %edx + ja ..B1.13 +..B1.5: + cmpl $16383, %ebx + je ..B1.40 +..B1.6: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.39 +..B1.7: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.8: + fldcw 12(%esp) +..B1.9: + movl $1, %eax +..B1.10: + fldt 8(%ebp) + testl %eax, %eax + fldl _TWO_32H@GOTOFF(%ecx) + fldt 84+_P@GOTOFF(%ecx) + fldt 60+_P@GOTOFF(%ecx) + fldt 36+_P@GOTOFF(%ecx) + fxch %st(4) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fld %st(1) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(1) + fsub %st(3), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 72+_P@GOTOFF(%ecx) + fmul %st(5), %st + fldt 48+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt 96+_P@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.12 +..B1.11: + fldcw 14(%esp) +..B1.12: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + cmpl $16383, %ebx + jl ..B1.19 +..B1.14: + cmpl $16471, %ebx + jge ..B1.19 +..B1.15: + movl %eax, (%esp) + lea -16383(%ebx), %edi + movl $1431655766, %eax + imull %edi + sarl $31, %edi + subl %edi, %edx + lea (%edx,%edx,2), %edx + movzwl 8+_exact_values@GOTOFF(%ecx,%edx,8), %eax + andl $32767, %eax + cmpl %eax, %ebx + movl (%esp), %eax + jne ..B1.19 +..B1.16: + cmpl 4+_exact_values@GOTOFF(%ecx,%edx,8), %eax + jne ..B1.19 +..B1.17: + movl 8(%ebp), %eax + cmpl _exact_values@GOTOFF(%ecx,%edx,8), %eax + jne ..B1.19 +..B1.18: + fldt 12+_exact_values@GOTOFF(%ecx,%edx,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.46 +..B1.20: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.21: + fldcw 12(%esp) +..B1.22: + movzwl 16(%ebp), %esi + movl %esi, %ebx + movl $1, %edx + andl $32767, %ebx +..B1.23: + testl %ebx, %ebx + jne ..B1.26 +..B1.24: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%ecx) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _zeros@GOTOFF(%ecx) + fxch %st(1) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.25 + je ..B1.43 +..B1.25: + fstp %st(0) + movzwl 16(%ebp), %esi + movl %esi, %ebx + movl $-16458, %eax + andl $32767, %ebx + jmp ..B1.27 +..B1.26: + movl $-16383, %eax +..B1.27: + fldl _TWO_32H@GOTOFF(%ecx) + andl $-32768, %esi + fldt 84+_P@GOTOFF(%ecx) + orl $-49153, %esi + fldt 60+_P@GOTOFF(%ecx) + addl %eax, %ebx + movw %si, 16(%ebp) + fldt 8(%ebp) + fld %st(0) + movl 12(%ebp), %eax + fadd %st(4), %st + shrl $23, %eax + fsubp %st, %st(4) + movzbl %al, %eax + fsub %st(3), %st + flds __libm_rcp_table_256@GOTOFF(%ecx,%eax,4) + fmul %st, %st(4) + fmulp %st, %st(1) + fxch %st(3) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + movl %ebx, 16(%esp) + fadd %st(4), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + shll $4, %eax + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + testl %edx, %edx + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 72+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 96+_P@GOTOFF(%ecx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(2) + fildl 16(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl 8+__libm_log10l_table_256@GOTOFF(%ecx,%eax) + faddp %st, %st(2) + faddl __libm_log10l_table_256@GOTOFF(%eax,%ecx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.29 +..B1.28: + fldcw 14(%esp) +..B1.29: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.30: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.55 +..B1.31: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.32: + fldcw 12(%esp) +..B1.33: + movzbl 17(%ebp), %edi + movl $1, %edx + andl $128, %edi + shrl $7, %edi +..B1.34: + testl %edi, %edi + jne ..B1.47 +..B1.35: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ecx) + fstpt (%esp) +..B1.36: + testl %edx, %edx + je ..B1.38 +..B1.37: + fldcw 14(%esp) +..B1.38: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + xorl %eax, %eax + jmp ..B1.10 +..B1.40: + cmpl $-2147483648, %eax + jne ..B1.6 +..B1.41: + cmpl $0, 8(%ebp) + jne ..B1.6 +..B1.42: + fldl _zeros@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + fldl 8+_ones@GOTOFF(%ecx) + testl %edx, %edx + fdivp %st, %st(1) + fstpl (%esp) + je ..B1.45 +..B1.44: + fldcw 14(%esp) +..B1.45: + fldl (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + xorl %edx, %edx + jmp ..B1.23 +..B1.47: + movzwl 16(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.50 +..B1.48: + cmpl $-2147483648, 12(%ebp) + jne ..B1.35 +..B1.49: + cmpl $0, 8(%ebp) + jne ..B1.35 + jmp ..B1.54 +..B1.50: + testl %eax, %eax + jne ..B1.54 +..B1.51: + cmpl $0, 12(%ebp) + jne ..B1.54 +..B1.52: + cmpl $0, 8(%ebp) + jne ..B1.54 +..B1.53: + fldl 8+_ones@GOTOFF(%ecx) + fdivl _zeros@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.36 +..B1.54: + fldl _infs@GOTOFF(%ecx) + fmull _zeros@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.36 +..B1.55: + xorl %edx, %edx + jmp ..B1.34 + .align 16,0x90 + .type log10l,@function + .size log10l,.-log10l + .data +# -- End log10l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xc8,0xd4,0x0e,0xee,0x0c,0x01,0x86,0xd8,0xbf,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x85,0x9a,0x20,0x9a,0xfd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_P: + .word 23339 + .word 38197 + .word 10353 + .word 43319 + .word 16357 + .word 0 + .word 29077 + .word 14120 + .word 55465 + .word 56923 + .word 49148 + .word 0 + .word 63176 + .word 31258 + .word 15131 + .word 37949 + .word 16380 + .word 0 + .word 29577 + .word 14120 + .word 55465 + .word 56923 + .word 49147 + .word 0 + .word 61319 + .word 34328 + .word 5050 + .word 45539 + .word 16379 + .word 0 + .word 52415 + .word 26390 + .word 15131 + .word 37949 + .word 49147 + .word 0 + .word 16765 + .word 7621 + .word 20590 + .word 65056 + .word 16378 + .word 0 + .word 14162 + .word 11829 + .word 26041 + .word 56924 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 56923 + .word 16381 + .word 0 + .type _P,@object + .size _P,108 + .align 2 +_exact_values: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40000 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50000 + .word 16399 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62500 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39062 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 8192 + .word 48828 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 10240 + .word 61035 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 63744 + .word 38146 + .word 16416 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 46912 + .word 47683 + .word 16419 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45056 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 42256 + .word 59604 + .word 16422 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 59178 + .word 37252 + .word 16426 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53248 + .word 16386 + .word 0 + .word 0 + .word 32768 + .word 8436 + .word 46566 + .word 16429 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16386 + .word 0 + .word 0 + .word 40960 + .word 43313 + .word 58207 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 16386 + .word 0 + .word 0 + .word 1024 + .word 51647 + .word 36379 + .word 16436 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16387 + .word 0 + .word 0 + .word 50432 + .word 48174 + .word 45474 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16387 + .word 0 + .word 0 + .word 30272 + .word 27450 + .word 56843 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 35304 + .word 8964 + .word 35527 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38912 + .word 16387 + .word 0 + .word 0 + .word 44130 + .word 60357 + .word 44408 + .word 16449 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16387 + .word 0 + .word 32768 + .word 6010 + .word 9911 + .word 55511 + .word 16452 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16387 + .word 0 + .word 36864 + .word 28332 + .word 30770 + .word 34694 + .word 16456 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45056 + .word 16387 + .word 0 + .word 46080 + .word 2647 + .word 5695 + .word 43368 + .word 16459 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47104 + .word 16387 + .word 0 + .word 41216 + .word 52461 + .word 7118 + .word 54210 + .word 16462 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16387 + .word 0 + .word 33952 + .word 16404 + .word 20833 + .word 33881 + .word 16466 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 16387 + .word 0 + .word 42440 + .word 36889 + .word 42425 + .word 42351 + .word 16469 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53248 + .word 16387 + .word 0 + .word 3898 + .word 62496 + .word 36647 + .word 52939 + .word 16472 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 16387 + .word 0 + .type _exact_values,@object + .size _exact_values,720 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_log10l_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log10l_table.S b/external/sgx_libm/ia32/log10l_table.S new file mode 100644 index 0000000000..61b661e651 --- /dev/null +++ b/external/sgx_libm/ia32/log10l_table.S @@ -0,0 +1,560 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10l_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_log10l_table_256 + .globl __libm_log10l_table_256 +__libm_log10l_table_256: + .long 0x45bfc000,0x3f4bd270 + .long 0xeb5a6902,0x3cc024b0 + .long 0x793a4000,0x3f64e84e + .long 0xbdc59429,0x3ccd29dc + .long 0x5ab86000,0x3f717508 + .long 0xf6df9894,0xbc6f70c9 + .long 0x9d914000,0x3f787cff + .long 0xeb029384,0x3cde94f0 + .long 0x72b8c000,0x3f7ea9d3 + .long 0x75a2920a,0xbd001bfa + .long 0x95daa000,0x3f82df9d + .long 0x77634a76,0xbcf3c705 + .long 0x72d64000,0x3f866df1 + .long 0x93609ef4,0xbcf1a833 + .long 0xef5ec000,0x3f898d79 + .long 0x7a519e99,0x3d16f7e1 + .long 0xf3f94000,0x3f8d22ad + .long 0xa10c1504,0x3d079c92 + .long 0x1d30c000,0x3f902423 + .long 0x2dcf9263,0x3cecc021 + .long 0x98898000,0x3f91f23a + .long 0x21ad4280,0xbce5b1e0 + .long 0x7b818000,0x3f93881a + .long 0x9c5111b1,0x3d0f3cbd + .long 0x1e75a000,0x3f951f6e + .long 0xaf539251,0xbcdcad0e + .long 0xe7adc000,0x3f96f2bc + .long 0x7385f0a6,0x3cf6d084 + .long 0x2cdf4000,0x3f988d36 + .long 0x41385083,0xbd04c3af + .long 0xaf014000,0x3f9a292b + .long 0x3724b270,0xbd2b3f0c + .long 0x3117c000,0x3f9bc6a0 + .long 0x667331b5,0x3d25cb86 + .long 0x7de3c000,0x3f9d6596 + .long 0x31612f8e,0xbd14f74b + .long 0x67fc4000,0x3f9f0611 + .long 0x143b6bad,0xbd0c30f3 + .long 0xe4f78000,0x3fa05409 + .long 0x5b985713,0x3ce9bb8e + .long 0x432ea000,0x3fa125d0 + .long 0x68a0dc47,0x3cf06e09 + .long 0x440d2000,0x3fa1f85d + .long 0x507c1dd7,0x3d133627 + .long 0x57496000,0x3fa2ad75 + .long 0x7f319445,0x3ce7c850 + .long 0x2a00e000,0x3fa38177 + .long 0x9d2bb1a5,0x3d080fdc + .long 0xe165a000,0x3fa45643 + .long 0xf742c845,0x3d0c2a9f + .long 0x03446000,0x3fa52bdd + .long 0x5036c404,0x3d25b862 + .long 0x6b7ec000,0x3fa5e396 + .long 0x23196824,0xbd36b572 + .long 0x47c5c000,0x3fa6baaf + .long 0x6d3e4a28,0xbd1b7614 + .long 0xe8c4c000,0x3fa773b3 + .long 0xf794b354,0x3d39e3f5 + .long 0xebee8000,0x3fa84c51 + .long 0x2cb6638b,0x3d1a2aaa + .long 0x786fc000,0x3fa906a6 + .long 0xdfffb059,0x3cecab9f + .long 0xabf00000,0x3fa9c197 + .long 0x3d6e4566,0x3d1badcf + .long 0x71218000,0x3faa9c78 + .long 0xcb03a47d,0x3d21f757 + .long 0x9c8d4000,0x3fab58c0 + .long 0x3b0fe4fe,0x3d31be11 + .long 0xbcdd4000,0x3fac15a8 + .long 0xb6d13ff4,0x3d3dbf2d + .long 0xe2c28000,0x3facd331 + .long 0x77fafd44,0x3d267bed + .long 0xd766c000,0x3fadb11e + .long 0x23c3e44c,0xbd240bcd + .long 0x9346c000,0x3fae7008 + .long 0xd4c5edca,0xbd2619d1 + .long 0xc6754000,0x3faf2f96 + .long 0xb182cded,0x3d15dbd8 + .long 0x8d450000,0x3fafefca + .long 0xcc1beb8a,0x3d2fd5cf + .long 0x83764000,0x3fb05852 + .long 0x779b9fcf,0x3cf77c3e + .long 0xaac7c000,0x3fb0b913 + .long 0xbc7f44a6,0x3d33a6ff + .long 0x4f258000,0x3fb11a29 + .long 0xb8d25b3a,0xbd360a72 + .long 0xa2698000,0x3fb16b51 + .long 0x7904e2d7,0xbd376f39 + .long 0xadacc000,0x3fb1cd03 + .long 0x084a2298,0x3d217bee + .long 0xdd776000,0x3fb22f0b + .long 0xa204f9bf,0xbd3a0ad1 + .long 0xca38e000,0x3fb2916a + .long 0xffeb8381,0xbd2c3074 + .long 0x0df76000,0x3fb2f421 + .long 0x0d443b33,0x3d18f3ef + .long 0xc3c48000,0x3fb346a6 + .long 0x15025ea7,0x3d306599 + .long 0xbc606000,0x3fb3a9fe + .long 0xa7db519f,0xbd27eca8 + .long 0x10a3c000,0x3fb3fd0c + .long 0xb6f7db46,0xbd35abc5 + .long 0xd3540000,0x3fb46107 + .long 0x813a4964,0x3d25039a + .long 0xd1696000,0x3fb4c55d + .long 0x64286476,0x3d1ff9d8 + .long 0x330c0000,0x3fb51940 + .long 0x2c505825,0x3ca5ed92 + .long 0x0ee70000,0x3fb56d62 + .long 0x06e88a06,0x3d315e58 + .long 0xcf260000,0x3fb5d2ab + .long 0xd90fb16b,0x3d378d89 + .long 0xa5dec000,0x3fb6275a + .long 0x405920cd,0xbcdfa0db + .long 0xaf26c000,0x3fb68d4e + .long 0x1d3da9e2,0x3d37ee53 + .long 0x5c54c000,0x3fb6e28c + .long 0x9d9b5afe,0xbd3d72f7 + .long 0x9665c000,0x3fb7380b + .long 0xb00e89cf,0xbd20707b + .long 0xc2790000,0x3fb78dcc + .long 0x9a7343d9,0xbd37a4ff + .long 0x2cf28000,0x3fb7f50c + .long 0xfacefdb0,0xbd45431c + .long 0xd5eb0000,0x3fb84b5f + .long 0x2b4f09ce,0xbd302851 + .long 0xbab2c000,0x3fb8a1f6 + .long 0x11e41a3e,0xbd2bb389 + .long 0x44558000,0x3fb8f8d1 + .long 0xbf96339c,0xbd1083fd + .long 0xdcd64000,0x3fb94fef + .long 0xe07d5241,0xbd4136f4 + .long 0xef314000,0x3fb9a752 + .long 0xa5e3191a,0x3d40a49e + .long 0xe7614000,0x3fb9fefa + .long 0xa1f54e0a,0xbd40902f + .long 0x325f4000,0x3fba56e8 + .long 0xec5e03cc,0x3d3c86ee + .long 0x3e298000,0x3fbaaf1b + .long 0xcb09696b,0xbd1130fe + .long 0x79c34000,0x3fbb0794 + .long 0x628b8546,0x3d495642 + .long 0x553b0000,0x3fbb6054 + .long 0xa20d3394,0x3d32f77b + .long 0x41ab8000,0x3fbbb95b + .long 0x61433066,0xbd418d39 + .long 0xb1400000,0x3fbc12a9 + .long 0xd5882f66,0xbd3f86c6 + .long 0x17380000,0x3fbc6c40 + .long 0x219900ae,0x3d45f518 + .long 0xba424000,0x3fbcb41f + .long 0x6665a718,0x3d443661 + .long 0xce734000,0x3fbd0e38 + .long 0xd0afc15d,0xbd1b04a7 + .long 0x21940000,0x3fbd689b + .long 0x80039681,0xbd2d9a08 + .long 0x2b1d0000,0x3fbdc347 + .long 0xd102c576,0x3d442ff9 + .long 0x300d8000,0x3fbe0c06 + .long 0xe391d6b6,0xbd46ba4d + .long 0x190e4000,0x3fbe6738 + .long 0x23d01c6b,0xbd1ad0ad + .long 0x0d208000,0x3fbec2b5 + .long 0xb6656ff4,0x3d2b355d + .long 0x2b938000,0x3fbf0c1c + .long 0x4980111b,0xbd37d822 + .long 0x6c9cc000,0x3fbf6821 + .long 0xd0891bcc,0x3d1c9a3b + .long 0x38184000,0x3fbfb1f6 + .long 0x16ca77f0,0x3d36f3d3 + .long 0xaf4ce000,0x3fc00742 + .long 0xee8b5696,0x3d27e0ee + .long 0x90650000,0x3fc02c64 + .long 0xe445f2fd,0x3d42d27a + .long 0xe63e2000,0x3fc05af1 + .long 0xa16f7336,0xbd4c4b92 + .long 0xea724000,0x3fc0804b + .long 0xb736f965,0xbd255d7c + .long 0xd6712000,0x3fc0af1f + .long 0x009609f5,0xbd35b214 + .long 0xa8806000,0x3fc0d4b2 + .long 0xc4dfdce2,0xbd2800b0 + .long 0xf136a000,0x3fc0fa5e + .long 0x2043a891,0x3ceb0a92 + .long 0x4fb3e000,0x3fc1299a + .long 0x26f70b35,0x3d182c63 + .long 0x6253c000,0x3fc14f80 + .long 0x44ac2d9f,0x3d1f65c1 + .long 0x5d158000,0x3fc17580 + .long 0x33b79054,0x3d2f04d6 + .long 0x637cc000,0x3fc19b9a + .long 0xe16cee25,0xbd4d6b79 + .long 0xc26ee000,0x3fc1cb5f + .long 0x6b51c369,0xbd0e934a + .long 0xe65f2000,0x3fc1f1b4 + .long 0x70fcf287,0x3d264160 + .long 0x8b5dc000,0x3fc21824 + .long 0xa3811df5,0x3d1f2866 + .long 0xd62ae000,0x3fc23eae + .long 0x75f6e51d,0xbd1c4ef6 + .long 0xebd34000,0x3fc26553 + .long 0xcd48326e,0xbd308652 + .long 0xf1b12000,0x3fc28c13 + .long 0xdfe3a7af,0xbd2c0024 + .long 0x14382000,0x3fc2bcaa + .long 0x21480e44,0xbd38f4c6 + .long 0x40b78000,0x3fc2e3a7 + .long 0x60689912,0x3cbd2885 + .long 0xd8f34000,0x3fc30abf + .long 0x508d5aa5,0xbd3893a6 + .long 0x03984000,0x3fc331f4 + .long 0xe9a3a8db,0x3d409691 + .long 0xe7a60000,0x3fc35943 + .long 0x43d5764a,0x3d2a3e8e + .long 0xac6e8000,0x3fc380af + .long 0x4d90e64e,0xbd1fc4d9 + .long 0x7997c000,0x3fc3a837 + .long 0xab2a4593,0xbd286816 + .long 0x771ca000,0x3fc3cfdb + .long 0x16e57a0f,0xbd2493c7 + .long 0x0d39a000,0x3fc3eda9 + .long 0x2ae78433,0x3d277ad1 + .long 0xc0950000,0x3fc4157e + .long 0xa37f5324,0x3d27333a + .long 0x13fb2000,0x3fc43d71 + .long 0xb82461da,0xbd4b3f09 + .long 0x30ad2000,0x3fc46580 + .long 0x72bdc442,0xbd198b79 + .long 0x40464000,0x3fc48dac + .long 0xc1788616,0xbd2c28bc + .long 0x6cbbc000,0x3fc4b5f5 + .long 0xef1ba41e,0xbd2e5a23 + .long 0xe05e6000,0x3fc4de5b + .long 0x8b90e0a0,0x3d4582b8 + .long 0x07770000,0x3fc4fcbc + .long 0x794dd932,0xbd13d6f8 + .long 0x1e926000,0x3fc52556 + .long 0x9b81384c,0xbd322350 + .long 0xf3198000,0x3fc54e0d + .long 0x2cd70aca,0x3d30ca92 + .long 0x7112c000,0x3fc56cab + .long 0x2a6e4407,0xbd10ed4c + .long 0xba734000,0x3fc59597 + .long 0x187e8930,0x3d4b1553 + .long 0x3a508000,0x3fc5bea2 + .long 0x1e386e4d,0xbd402641 + .long 0x08de4000,0x3fc5dd7e + .long 0x0b3f247b,0xbd2f4535 + .long 0xd3f90000,0x3fc606bd + .long 0x7c6ff8cd,0x3d51aaa0 + .long 0x518a4000,0x3fc6301c + .long 0x4d6761d0,0x3d401ece + .long 0x70618000,0x3fc64f37 + .long 0xa791b8a6,0x3d322b46 + .long 0x14c20000,0x3fc678cc + .long 0x7917b19f,0xbd4d287f + .long 0x05ed4000,0x3fc69810 + .long 0xcb5870e8,0xbd46b8cb + .long 0x5f9bc000,0x3fc6c1db + .long 0x986fe812,0xbd3994b8 + .long 0x8ecd0000,0x3fc6e148 + .long 0x4fa56719,0x3d54407b + .long 0x2e7e4000,0x3fc70b4b + .long 0xc215a307,0x3d0b8ea3 + .long 0x09144000,0x3fc72ae2 + .long 0x8e443b8a,0x3d55fc4a + .long 0x81bd8000,0x3fc7551c + .long 0xaffc42e9,0x3d3b9ef2 + .long 0x76cc4000,0x3fc774dd + .long 0x8d3f5094,0x3d1ded36 + .long 0x5db00000,0x3fc79f50 + .long 0xdd7a0df9,0x3d3d105d + .long 0xde098000,0x3fc7bf3b + .long 0xf47b93c9,0x3d4f301f + .long 0xcac44000,0x3fc7e9e7 + .long 0x64ca2675,0xbd300eff + .long 0x49030000,0x3fc809fe + .long 0xa2382d7a,0xbd57f954 + .long 0x57998000,0x3fc82a27 + .long 0xa5427ebe,0xbd51a131 + .long 0xc6260000,0x3fc85525 + .long 0x18660d2c,0xbd4f67be + .long 0x79834000,0x3fc8757a + .long 0xe73d6696,0xbd53bc75 + .long 0x058d8000,0x3fc895e2 + .long 0x37dbd0a7,0x3d3c0532 + .long 0x37698000,0x3fc8c134 + .long 0x6534d35a,0xbd55670a + .long 0x12ef0000,0x3fc8e1c8 + .long 0x21fe7581,0x3d595f21 + .long 0x11218000,0x3fc9026f + .long 0xaefa5f2f,0x3d47e805 + .long 0x48888000,0x3fc92329 + .long 0xfa5a2c46,0x3d301501 + .long 0x4b834000,0x3fc94eea + .long 0x142e461b,0xbd361a29 + .long 0xb63a0000,0x3fc96fd1 + .long 0xe74e02a0,0xbd1fb7d8 + .long 0xa6620000,0x3fc990cc + .long 0x8c78b1e9,0x3d54d5fa + .long 0x33334000,0x3fc9b1db + .long 0xf104deb4,0x3d3085fd + .long 0x740e4000,0x3fc9d2fd + .long 0x4be3a88f,0x3d530348 + .long 0xeedc8000,0x3fc9ff49 + .long 0xe2bda395,0x3d5aa98b + .long 0x84fc0000,0x3fca209a + .long 0xb83b532a,0xbd580433 + .long 0x1e440000,0x3fca41ff + .long 0xada9a5e4,0xbd3fa98d + .long 0xd2cec000,0x3fca6377 + .long 0xe131e3b9,0xbd564407 + .long 0xbae0c000,0x3fca8504 + .long 0x018eb699,0x3d49f5f5 + .long 0xeeec0000,0x3fcaa6a5 + .long 0x1db03170,0xbd401d1e + .long 0x878d8000,0x3fcac85b + .long 0x09bf0cc9,0xbd2e1c0b + .long 0x9d900000,0x3fcaea25 + .long 0x1d013253,0xbd27d321 + .long 0x49eb4000,0x3fcb0c04 + .long 0x85567deb,0x3d36d506 + .long 0xa5c50000,0x3fcb2df7 + .long 0xe6dd603b,0x3d14c9cc + .long 0xca710000,0x3fcb4fff + .long 0x81ec1ae1,0xbd4b2ea2 + .long 0xd1714000,0x3fcb721c + .long 0xf660b9da,0x3d47e295 + .long 0xd4780000,0x3fcb944e + .long 0xa337b6c0,0xbd558993 + .long 0xed658000,0x3fcbb695 + .long 0x5395b891,0xbd51c199 + .long 0x364ac000,0x3fcbd8f2 + .long 0xa0feae19,0x3d560784 + .long 0xc96a0000,0x3fcbfb63 + .long 0xd6eafbe6,0xbd36014a + .long 0xc134c000,0x3fcc1dea + .long 0x84f72786,0x3d44e96e + .long 0x384f4000,0x3fcc4087 + .long 0x3f7c716e,0x3d3f006e + .long 0x498f0000,0x3fcc6339 + .long 0x93e69cea,0x3d33c317 + .long 0x0ffc0000,0x3fcc8601 + .long 0x7e3ccfb7,0x3d2dae5f + .long 0x065c4000,0x3fcc9d3d + .long 0xa7bafd57,0x3d4b4180 + .long 0x375b8000,0x3fccc029 + .long 0xfa45fc85,0x3d503cf7 + .long 0x6697c000,0x3fcce32b + .long 0xcc5fc3d0,0xbd5a2df8 + .long 0xafd54000,0x3fcd0643 + .long 0xf7c24bc7,0xbd55fdc6 + .long 0x2f0e0000,0x3fcd2972 + .long 0xc812d894,0xbd45bacd + .long 0x00710000,0x3fcd4cb7 + .long 0x2cb52790,0xbd0bc64a + .long 0xab3f8000,0x3fcd6446 + .long 0x8139913c,0x3d392b7b + .long 0xef71c000,0x3fcd87b0 + .long 0x822c4d80,0x3d4b449e + .long 0xd1fe8000,0x3fcdab31 + .long 0x4f09d1d4,0x3d49a698 + .long 0x6fdc8000,0x3fcdcec9 + .long 0x4231d353,0x3d311dde + .long 0x88764000,0x3fcde690 + .long 0x8e8f9b14,0xbd350c11 + .long 0x4a25c000,0x3fce0a4e + .long 0x1868dfd1,0x3d0ffb66 + .long 0x15754000,0x3fce2e23 + .long 0x6ad712e4,0x3d4e32b0 + .long 0x22d18000,0x3fce4613 + .long 0x75f8b410,0xbd4b758b + .long 0x95c78000,0x3fce6a0e + .long 0x94c67dc7,0xbd2e13dc + .long 0x6243c000,0x3fce8e21 + .long 0xf23f1279,0x3d4d600d + .long 0xf26e0000,0x3fcea63a + .long 0x668806d4,0x3cef1bb1 + .long 0xed160000,0x3fceca74 + .long 0xfe665305,0xbd4f489c + .long 0x92ccc000,0x3fceeec6 + .long 0x1d627f70,0x3d4259f1 + .long 0x36b8c000,0x3fcf070a + .long 0x714687e0,0x3d49c0c3 + .long 0x93e34000,0x3fcf2b83 + .long 0x5715356c,0x3d345a59 + .long 0xef53c000,0x3fcf5014 + .long 0xb6f783a8,0xbd5ad2b5 + .long 0x3af18000,0x3fcf6883 + .long 0x4bcc6e04,0x3d58bfdb + .long 0xd9f3c000,0x3fcf8d3c + .long 0xf63ab05d,0x3d58276d + .long 0x1add8000,0x3fcfa5c6 + .long 0x9beccf8d,0x3d43e926 + .long 0x567e8000,0x3fcfcaa8 + .long 0x362fdd81,0x3d5d3cfe + .long 0xc8744000,0x3fcfe34c + .long 0xc008381c,0xbd113e5f + .long 0xfd74e000,0x3fd0042b + .long 0x617c00f4,0x3d551936 + .long 0xf6a18000,0x3fd016bd + .long 0x52b01c58,0x3cd77bf6 + .long 0x2f906000,0x3fd02326 + .long 0x9269b5c5,0x3d53227c + .long 0xed8d4000,0x3fd035cc + .long 0x46d0dd58,0xbd4abd7e + .long 0x0e86a000,0x3fd04243 + .long 0x07af3e66,0xbcb117c1 + .long 0xc842c000,0x3fd04ebe + .long 0xa51b431d,0xbd4a401d + .long 0xe84fc000,0x3fd06182 + .long 0x4e2f0b29,0x3d54abd9 + .long 0xb609c000,0x3fd06e0c + .long 0xcd12a34d,0x3d538308 + .long 0x0bec8000,0x3fd080e6 + .long 0x7faf9c27,0x3d4e24d8 + .long 0x0d896000,0x3fd08d7e + .long 0xf5dd9bd9,0xbd58cad1 + .long 0xc96a2000,0x3fd0a06c + .long 0xb30ebd03,0x3cf56aec + .long 0x1f3b2000,0x3fd0ad13 + .long 0xf6264d3a,0x3d5c5508 + .long 0x71e78000,0x3fd0c017 + .long 0x801d3fff,0xbd440944 + .long 0x3cad8000,0x3fd0cccc + .long 0x8fd76450,0xbd50b4df + .long 0xd91a4000,0x3fd0d986 + .long 0xeca91a49,0xbd46ae31 + .long 0xb8860000,0x3fd0eca9 + .long 0x0cf1281c,0x3d5a2d53 + .long 0xf87fe000,0x3fd0f972 + .long 0x0e3b7b78,0x3d53d583 + .long 0x1cf0e000,0x3fd10642 + .long 0x36cc41d7,0x3d37dcbc + .long 0xebe28000,0x3fd11983 + .long 0x56ee7372,0x3d453935 + .long 0xe35b8000,0x3fd12661 + .long 0xf97392ab,0xbd3e990a + .long 0xd277a000,0x3fd13345 + .long 0xd681ef76,0xbd2625f2 + .long 0xf5974000,0x3fd146a6 + .long 0x4e1038a4,0xbd57c5c5 + .long 0xe81ea000,0x3fd15399 + .long 0xd5972106,0x3d407ab6 + .long 0xe5d3a000,0x3fd16092 + .long 0x74a3a2b7,0x3d434c04 + .long 0xc3b7a000,0x3fd17413 + .long 0xadcb10c6,0x3d46bb42 + .long 0xf629e000,0x3fd1811b + .long 0xc5305a70,0xbd420a8b + .long 0x47b46000,0x3fd18e2a + .long 0x61f0b069,0x3d3a17c8 + .long 0xbe1a4000,0x3fd19b3e + .long 0x9d0c4bc2,0x3d306106 + .long 0x017cc000,0x3fd1aee9 + .long 0xf7f8b601,0xbd475f35 + .long 0xed714000,0x3fd1bc0c + .long 0x4ef21e21,0xbd463c17 + .long 0x12abc000,0x3fd1c937 + .long 0x61c2e7a5,0x3d3ffdc5 + .long 0x77148000,0x3fd1d667 + .long 0xa4cb0170,0xbd260af0 + .long 0xd1286000,0x3fd1ea3b + .long 0xc64da380,0x3d4c38dc + .long 0xed934000,0x3fd1f77b + .long 0x11c5ddf7,0xbd53b3e4 + .long 0x5e1b0000,0x3fd204c2 + .long 0x7b28110e,0x3d28fa35 + .long 0x28ce8000,0x3fd2120f + .long 0x0bc856ad,0xbd564e99 + .long 0x53c4a000,0x3fd21f62 + .long 0xe0bb0bd9,0xbd52ff6c + .long 0xe51d6000,0x3fd22cbb + .long 0x9c33f19c,0x3d0531fc + .long 0x4c976000,0x3fd240ce + .long 0x4672ee85,0xbd4777b4 + .long 0xf8ece000,0x3fd24e37 + .long 0x8e29bedb,0xbd3461fa + .long 0x215b0000,0x3fd25ba8 + .long 0x2d8bf07a,0xbd4007bf + .long 0xcc2a0000,0x3fd2691e + .long 0xd592a8b0,0xbd4f7b1a + .long 0xffab4000,0x3fd2769b + .long 0x75f34cfe,0xbd520002 + .long 0xc2394000,0x3fd2841f + .long 0xf75ce6c1,0x3d52c96f + .long 0x1a384000,0x3fd291aa + .long 0x73fd8960,0x3d42f012 + .long 0x0e154000,0x3fd29f3b + .long 0xa111a5a3,0x3d584ad4 + .long 0xee47a000,0x3fd2b3a0 + .long 0x875f458c,0xbd2044f7 + .long 0x842c0000,0x3fd2c142 + .long 0xb02650df,0x3d43cbc1 + .long 0xccb7c000,0x3fd2ceea + .long 0xb6dc5d61,0xbd249ad3 + .long 0xce830000,0x3fd2dc99 + .long 0xfe13a4e3,0xbd0beb52 + .long 0x902fc000,0x3fd2ea4f + .long 0x4d1def58,0x3d57d999 + .long 0x186a2000,0x3fd2f80c + .long 0xb0baac1f,0x3d37f290 + .long 0x6de7c000,0x3fd305cf + .long 0x4343671c,0xbd4e1284 + .long 0x97684000,0x3fd31399 + .long 0x31df7b15,0xbd28c485 + .long 0x9bb5a000,0x3fd3216a + .long 0xc8a62d99,0xbd1838f8 + .long 0x81a3c000,0x3fd32f42 + .long 0x7ce7627b,0x3d4dfd72 + .long 0x50110000,0x3fd33d21 + .long 0x0c6b638c,0x3d023363 + .type __libm_log10l_table_256,@object + .size __libm_log10l_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log1p_wmt.S b/external/sgx_libm/ia32/log1p_wmt.S new file mode 100644 index 0000000000..1afd321182 --- /dev/null +++ b/external/sgx_libm/ia32/log1p_wmt.S @@ -0,0 +1,847 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log1p_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log1p + .text + .align 16,0x90 + .globl log1p +log1p: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + xorpd %xmm3, %xmm3 + movl $32768, %ecx + movd %ecx, %xmm4 + movsd 2128(%ebx), %xmm5 + pshufd $68, %xmm0, %xmm7 + movapd %xmm2, %xmm6 + pextrw $3, %xmm0, %ecx + addsd %xmm2, %xmm0 + movapd %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + subsd %xmm0, %xmm6 + orpd %xmm2, %xmm0 + psllq $5, %xmm0 + psrlq $34, %xmm0 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.3 + addsd %xmm6, %xmm7 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $228, %xmm5, %xmm6 + psrlq $12, %xmm1 + andl $32752, %ecx + cmpl $16256, %ecx + jb .L_2TAG_PACKET_1.0.3 + andl $32752, %eax + movl $32720, %ecx + subl %eax, %ecx + pinsrw $3, %ecx, %xmm3 +.L_2TAG_PACKET_2.0.3: + mulsd %xmm3, %xmm7 + paddd %xmm4, %xmm0 + xorpd %xmm4, %xmm4 + movl $14336, %ecx + pinsrw $3, %ecx, %xmm4 + orpd %xmm2, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm1, %xmm5 + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm1 + paddd %xmm4, %xmm0 + mulsd %xmm0, %xmm5 + movl $16352, %ecx + subl %ecx, %eax + cvtsi2sdl %eax, %xmm4 + mulsd %xmm0, %xmm7 + mulsd %xmm0, %xmm1 + movsd 2064(%ebx), %xmm6 + movapd 2080(%ebx), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd (%ebx,%edx), %xmm0 + movapd 2096(%ebx), %xmm2 + addsd %xmm5, %xmm1 + movapd %xmm1, %xmm5 + addsd %xmm7, %xmm1 + subsd %xmm1, %xmm5 + addsd %xmm5, %xmm7 + mulsd %xmm4, %xmm6 + mulsd 2072(%ebx), %xmm4 + mulsd %xmm1, %xmm3 + pshufd $68, %xmm1, %xmm5 + addsd %xmm6, %xmm0 + mulpd %xmm5, %xmm2 + mulpd %xmm5, %xmm5 + pshufd $228, %xmm0, %xmm6 + addsd %xmm1, %xmm0 + addpd 2112(%ebx), %xmm2 + mulpd %xmm5, %xmm3 + subsd %xmm0, %xmm6 + mulsd %xmm1, %xmm2 + addsd %xmm7, %xmm4 + mulsd %xmm1, %xmm7 + addsd %xmm6, %xmm1 + pshufd $238, %xmm0, %xmm6 + mulsd %xmm5, %xmm5 + addsd %xmm6, %xmm4 + subsd %xmm7, %xmm1 + addpd %xmm3, %xmm2 + addsd %xmm4, %xmm1 + mulpd %xmm5, %xmm2 + addsd %xmm2, %xmm1 + pshufd $238, %xmm2, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_0.0.3: + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_4.0.3 + cmpl $0, %eax + je .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_6.0.3: + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_7.0.3: + ja .L_2TAG_PACKET_6.0.3 + cmpl $0, %edx + ja .L_2TAG_PACKET_6.0.3 + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_4.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_7.0.3 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_8.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + movl $141, %edx + mulsd %xmm1, %xmm0 +.L_2TAG_PACKET_9.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_10.0.3 +.L_2TAG_PACKET_5.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $140, %edx + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_1.0.3: + movsd 112(%esp), %xmm0 + cmpl $15504, %ecx + jb .L_2TAG_PACKET_11.0.3 + movapd 2144(%ebx), %xmm1 + pshufd $68, %xmm0, %xmm0 + movapd 2160(%ebx), %xmm2 + pshufd $68, %xmm0, %xmm4 + movapd 2176(%ebx), %xmm3 + mulpd %xmm0, %xmm1 + xorpd %xmm6, %xmm6 + mulpd %xmm4, %xmm4 + addpd %xmm2, %xmm1 + pshufd $68, %xmm4, %xmm5 + mulpd %xmm0, %xmm4 + movl $49120, %eax + pinsrw $3, %eax, %xmm6 + mulpd %xmm0, %xmm1 + mulsd %xmm4, %xmm4 + addpd %xmm3, %xmm1 + mulsd %xmm6, %xmm5 + mulpd %xmm4, %xmm1 + pshufd $238, %xmm1, %xmm7 + addsd %xmm7, %xmm1 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_11.0.3: + cmpl $16, %ecx + jb .L_2TAG_PACKET_12.0.3 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_12.0.3: + movapd %xmm0, %xmm1 + mulsd %xmm1, %xmm1 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_3.0.3: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_10.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log1p,@function + .size log1p,.-log1p + .data +# -- End log1p + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4277811200 + .long 1072049730 + .long 2479318832 + .long 1026487127 + .long 2854492160 + .long 1072033410 + .long 215631550 + .long 1025638968 + .long 1547061248 + .long 1072017216 + .long 2886781435 + .long 1026423395 + .long 649825280 + .long 1072001146 + .long 4281533405 + .long 1024038923 + .long 646346752 + .long 1071985198 + .long 1562735921 + .long 1023790276 + .long 2203734016 + .long 1071969370 + .long 1838397691 + .long 3173936209 + .long 1872169984 + .long 1071953661 + .long 3981202460 + .long 1022325013 + .long 669557760 + .long 1071938069 + .long 4182597802 + .long 3173174122 + .long 4076413952 + .long 1071922591 + .long 1209029111 + .long 3170736207 + .long 556125184 + .long 1071907228 + .long 821086028 + .long 3173437049 + .long 204914688 + .long 1071891976 + .long 2097025986 + .long 3171071798 + .long 387545088 + .long 1071876834 + .long 3142936996 + .long 3173092218 + .long 2912783360 + .long 1071861800 + .long 2502420140 + .long 1024505919 + .long 1144260608 + .long 1071846874 + .long 3315658140 + .long 3173469843 + .long 1471209472 + .long 1071832053 + .long 129621009 + .long 3172443877 + .long 1829683200 + .long 1071817336 + .long 3885467693 + .long 1025535275 + .long 288676864 + .long 1071802722 + .long 86139472 + .long 3171639793 + .long 3636378624 + .long 1071788208 + .long 1850238587 + .long 1024654342 + .long 1606817792 + .long 1071773795 + .long 3388899795 + .long 3173675586 + .long 1236164608 + .long 1071759480 + .long 3983599207 + .long 1020046558 + .long 1089616896 + .long 1071745262 + .long 4171974224 + .long 1024773198 + .long 4143093760 + .long 1071731139 + .long 2727587401 + .long 3173965207 + .long 600267776 + .long 1071717112 + .long 3147685042 + .long 3173353031 + .long 2249313280 + .long 1071703177 + .long 125835074 + .long 1025255832 + .long 3805303808 + .long 1071689334 + .long 2289991207 + .long 1025460331 + .long 87278592 + .long 1071675583 + .long 1106114045 + .long 1025933602 + .long 3195405312 + .long 1071661920 + .long 3885316576 + .long 3171206239 + .long 3853649920 + .long 1071648346 + .long 2977069852 + .long 3171236771 + .long 2944026624 + .long 1071625048 + .long 1008093493 + .long 1023444474 + .long 3993180160 + .long 1071598247 + .long 1862355595 + .long 1024642533 + .long 1454641152 + .long 1071571617 + .long 1514603089 + .long 1026500596 + .long 3286085632 + .long 1071545154 + .long 1400028424 + .long 3173279056 + .long 438773760 + .long 1071518858 + .long 120727864 + .long 3172148914 + .long 1212979200 + .long 1071492725 + .long 1625055594 + .long 3172901933 + .long 1189017600 + .long 1071466754 + .long 3920062376 + .long 1025727407 + .long 403064832 + .long 1071440943 + .long 1053271728 + .long 3171391427 + .long 3343210496 + .long 1071415289 + .long 3243395502 + .long 3173627613 + .long 1765777408 + .long 1071389792 + .long 2145968512 + .long 1026354304 + .long 461430784 + .long 1071364449 + .long 4094322285 + .long 1026021467 + .long 71706624 + .long 1071339258 + .long 763632021 + .long 1024496933 + .long 1380503552 + .long 1071314217 + .long 1383547992 + .long 3173088453 + .long 1015732224 + .long 1071289325 + .long 3198646877 + .long 1025390322 + .long 35977216 + .long 1071264580 + .long 2141026805 + .long 1025754693 + .long 3927306240 + .long 1071239979 + .long 282116272 + .long 3173394334 + .long 1125341184 + .long 1071215523 + .long 2768427504 + .long 3172279059 + .long 1666971648 + .long 1071191208 + .long 786837629 + .long 3172427445 + .long 2827694080 + .long 1071167033 + .long 3857122416 + .long 3173014241 + .long 2003683328 + .long 1071142997 + .long 859010954 + .long 1026545007 + .long 1004017664 + .long 1071119098 + .long 3356644970 + .long 3173458064 + .long 1753020416 + .long 1071095334 + .long 788338552 + .long 1026157693 + .long 1992718336 + .long 1071071704 + .long 1239179443 + .long 1026394889 + .long 3870234624 + .long 1071048206 + .long 2082614663 + .long 1024926053 + .long 1050437632 + .long 1071024840 + .long 660007840 + .long 1025548499 + .long 188395520 + .long 1071001603 + .long 3878792704 + .long 3173889571 + .long 3747176448 + .long 1070978493 + .long 144991708 + .long 3171552042 + .long 1405669376 + .long 1070955511 + .long 3999088879 + .long 1025486317 + .long 121151488 + .long 1070932654 + .long 2170865497 + .long 1026473584 + .long 2652319744 + .long 1070909920 + .long 453695652 + .long 3173916809 + .long 3262236672 + .long 1070887309 + .long 157800053 + .long 3173984206 + .long 601221120 + .long 1070864820 + .long 3968917661 + .long 1023992886 + .long 1999843328 + .long 1070842450 + .long 3053895004 + .long 1024998228 + .long 1992167424 + .long 1070820199 + .long 2968614856 + .long 1024552653 + .long 3788726272 + .long 1070798065 + .long 3542170808 + .long 3173573242 + .long 2094829568 + .long 1070776048 + .long 1246758132 + .long 1026202874 + .long 288675840 + .long 1070754146 + .long 3747328950 + .long 1026331585 + .long 1829681152 + .long 1070732357 + .long 3125197546 + .long 1024100318 + .long 1666869248 + .long 1070710681 + .long 1363656119 + .long 1026336493 + .long 3417110528 + .long 1070689116 + .long 4154791553 + .long 1026267853 + .long 2183653376 + .long 1070667662 + .long 1671819292 + .long 3173785870 + .long 1734434816 + .long 1070646317 + .long 373091049 + .long 1025972363 + .long 1615681536 + .long 1070625080 + .long 384650897 + .long 1022926043 + .long 1445382144 + .long 1070603950 + .long 344320330 + .long 3172397196 + .long 1823715328 + .long 1070569756 + .long 3389841200 + .long 1025231852 + .long 3839688704 + .long 1070527917 + .long 1706790417 + .long 3167363349 + .long 4293332992 + .long 1070486286 + .long 1614935088 + .long 1019351591 + .long 2966720512 + .long 1070444861 + .long 4145393717 + .long 3173711658 + .long 4066729984 + .long 1070403639 + .long 1974925028 + .long 3171437182 + .long 3337621504 + .long 1070362619 + .long 3314953170 + .long 3169971314 + .long 943448064 + .long 1070321799 + .long 1498682038 + .long 3173862340 + .long 1465634816 + .long 1070281176 + .long 1319952810 + .long 3171693965 + .long 1015734272 + .long 1070240749 + .long 1347821929 + .long 3173544515 + .long 118001664 + .long 1070200516 + .long 1751482746 + .long 1026134093 + .long 3707174912 + .long 1070160474 + .long 1486946159 + .long 1023930920 + .long 3946381312 + .long 1070120623 + .long 2867408081 + .long 3171368276 + .long 1699848192 + .long 1070080961 + .long 2590187139 + .long 1025379803 + .long 2235846656 + .long 1070041485 + .long 1888568069 + .long 3172754960 + .long 2339729408 + .long 1070002194 + .long 3852214753 + .long 3173323149 + .long 3196850176 + .long 1069963086 + .long 742141560 + .long 1025101707 + .long 1800683520 + .long 1069924160 + .long 3949500444 + .long 3172102179 + .long 3835801600 + .long 1069885413 + .long 3848895943 + .long 1025913832 + .long 2201202688 + .long 1069846845 + .long 1425913464 + .long 1025868665 + .long 2778279936 + .long 1069808453 + .long 2120889677 + .long 3173831128 + .long 2954203136 + .long 1069770236 + .long 592147081 + .long 1019621288 + .long 210141184 + .long 1069732193 + .long 3414275233 + .long 1023647084 + .long 709476352 + .long 1069694321 + .long 2413027164 + .long 1024462115 + .long 2116284416 + .long 1069656619 + .long 1144559924 + .long 1026336654 + .long 2183651328 + .long 1069619086 + .long 3459057650 + .long 1025634168 + .long 3047047168 + .long 1069581720 + .long 1879674924 + .long 3173508573 + .long 970711040 + .long 1069541521 + .long 1335954173 + .long 3173332182 + .long 2198478848 + .long 1069467449 + .long 2951103968 + .long 3173892200 + .long 1669611520 + .long 1069393703 + .long 531044147 + .long 1025149248 + .long 29114368 + .long 1069320280 + .long 3327831251 + .long 1025918673 + .long 2376949760 + .long 1069247176 + .long 737634533 + .long 3172176000 + .long 1085390848 + .long 1069174390 + .long 3108243400 + .long 3171828406 + .long 1566130176 + .long 1069101918 + .long 985483226 + .long 1025708380 + .long 792780800 + .long 1069029758 + .long 4184866295 + .long 1024426204 + .long 183156736 + .long 1068957907 + .long 2845699378 + .long 1022107277 + .long 1301782528 + .long 1068886362 + .long 1012735262 + .long 3173804294 + .long 1562411008 + .long 1068815121 + .long 2197086703 + .long 3170187813 + .long 2815549440 + .long 1068744181 + .long 2782613207 + .long 1026345054 + .long 2756124672 + .long 1068673540 + .long 2929486205 + .long 3173037800 + .long 3511050240 + .long 1068603195 + .long 1443733147 + .long 3173331549 + .long 3047047168 + .long 1068533144 + .long 1879674924 + .long 3172459997 + .long 3221667840 + .long 1068427825 + .long 1338588027 + .long 3171815742 + .long 3453861888 + .long 1068288883 + .long 1205348359 + .long 3172624626 + .long 3506110464 + .long 1068150514 + .long 893105198 + .long 1025571866 + .long 346013696 + .long 1068012714 + .long 3495569021 + .long 3172563349 + .long 4074029056 + .long 1067875476 + .long 3961106338 + .long 3171065595 + .long 3559784448 + .long 1067738798 + .long 1975385384 + .long 3173783155 + .long 797769728 + .long 1067602675 + .long 3760305787 + .long 1026047642 + .long 2313633792 + .long 1067467101 + .long 1559353171 + .long 1023480256 + .long 3960766464 + .long 1067213778 + .long 1067365107 + .long 1025865926 + .long 684261376 + .long 1066944805 + .long 844762164 + .long 3173687482 + .long 630718464 + .long 1066676905 + .long 2458269694 + .long 1024033081 + .long 1486061568 + .long 1066410070 + .long 115537874 + .long 3173243995 + .long 2743664640 + .long 1065886792 + .long 3665098304 + .long 3173471607 + .long 1971912704 + .long 1065357333 + .long 2577214440 + .long 3171993451 + .long 1498939392 + .long 1064306693 + .long 3409036923 + .long 1025599151 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 4277811200 + .long 1067855426 + .long 2479318832 + .long 1022292823 + .long 2454267026 + .long 1069697316 + .long 0 + .long 3218079744 + .long 1030730101 + .long 3217380702 + .long 1431655765 + .long 1070945621 + .long 2576980378 + .long 1070176665 + .long 0 + .long 3219128320 + .long 0 + .long 4294959104 + .long 0 + .long 4294959104 + .long 0 + .long 3217031168 + .long 2576980378 + .long 1070176665 + .long 2454267026 + .long 1069697316 + .long 0 + .long 3218079744 + .long 1431655765 + .long 3217380693 + .long 1431655765 + .long 1070945621 + .type static_const_table,@object + .size static_const_table,2192 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log1pf_wmt.S b/external/sgx_libm/ia32/log1pf_wmt.S new file mode 100644 index 0000000000..d1ebeb33bf --- /dev/null +++ b/external/sgx_libm/ia32/log1pf_wmt.S @@ -0,0 +1,751 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log1pf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log1pf + .text + .align 16,0x90 + .globl log1pf +log1pf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl $1065353216, %edx + movd %edx, %xmm1 + movl $16384, %ecx + movd %ecx, %xmm4 + movl $-32768, %eax + movd %eax, %xmm2 + xorpd %xmm3, %xmm3 + movl $16368, %edx + pinsrw $3, %edx, %xmm3 + xorpd %xmm5, %xmm5 + addss %xmm0, %xmm1 +.L_2TAG_PACKET_0.0.3: + movd %xmm0, %ecx + movd %xmm1, %edx + rcpss %xmm1, %xmm1 + movsd 2080(%ebx), %xmm7 + pshuflw $68, %xmm0, %xmm0 + paddd %xmm4, %xmm1 + andl $2147483647, %ecx + cmpl $864026624, %ecx + jb .L_2TAG_PACKET_1.0.3 + subl $8388608, %edx + cmpl $2113929216, %edx + jae .L_2TAG_PACKET_2.0.3 + andps %xmm1, %xmm2 + cvtps2pd %xmm0, %xmm0 + cvtps2pd %xmm2, %xmm1 + movd %xmm2, %eax + andl $-8388608, %edx + subl $1056964608, %edx + cvtsi2sdl %edx, %xmm6 + mulsd %xmm1, %xmm0 + subsd %xmm3, %xmm1 + subl $1056964608, %edx + addl %edx, %eax + shrl $12, %eax + movsd (%ebx,%eax), %xmm4 + addsd %xmm1, %xmm0 + movsd 2088(%ebx), %xmm2 + movsd 2096(%ebx), %xmm1 + mulsd %xmm0, %xmm7 + addsd %xmm0, %xmm5 + mulsd %xmm0, %xmm0 + mulsd %xmm2, %xmm6 + addsd %xmm7, %xmm1 + addsd %xmm4, %xmm5 + mulsd %xmm1, %xmm0 + addsd %xmm6, %xmm5 + addsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_2.0.3: + addl $8388608, %edx + js .L_2TAG_PACKET_4.0.3 + cmpl $0, %edx + je .L_2TAG_PACKET_5.0.3 + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_6.0.3 + movl $528482304, %eax + movd %eax, %xmm6 + movsd 2064(%ebx), %xmm5 + mulss %xmm6, %xmm0 + movss %xmm0, %xmm1 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_6.0.3: + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $-2147483648, %edx + je .L_2TAG_PACKET_5.0.3 + addl %edx, %edx + cmpl $-16777216, %edx + ja .L_2TAG_PACKET_6.0.3 + xorps %xmm0, %xmm0 + divss %xmm0, %xmm0 + movl $143, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_1.0.3: + cmpl $8388608, %ecx + jb .L_2TAG_PACKET_9.0.3 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_9.0.3: + movss %xmm0, %xmm1 + mulss %xmm1, %xmm1 + jmp .L_2TAG_PACKET_3.0.3 +.L_2TAG_PACKET_5.0.3: + movl $-1082130432, %eax + movd %eax, %xmm0 + xorps %xmm1, %xmm1 + divss %xmm1, %xmm0 + movl $142, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_3.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log1pf,@function + .size log1pf,.-log1pf + .data +# -- End log1pf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4277811695 + .long 1072049730 + .long 4099377379 + .long 1072041554 + .long 2854492448 + .long 1072033410 + .long 3783013829 + .long 1072025297 + .long 1547061728 + .long 1072017216 + .long 3705668804 + .long 1072009165 + .long 649825382 + .long 1072001146 + .long 4257004898 + .long 1071993156 + .long 646346839 + .long 1071985198 + .long 1718090839 + .long 1071977269 + .long 2203733529 + .long 1071969370 + .long 1140698018 + .long 1071961501 + .long 1872170015 + .long 1071953661 + .long 3457002416 + .long 1071945850 + .long 669557459 + .long 1071938069 + .long 1179420986 + .long 1071930316 + .long 4076413893 + .long 1071922591 + .long 4165410145 + .long 1071914895 + .long 556124819 + .long 1071907228 + .long 957937516 + .long 1071899588 + .long 204914613 + .long 1071891976 + .long 1730507025 + .long 1071884391 + .long 387544807 + .long 1071876834 + .long 3922939863 + .long 1071869303 + .long 2912783494 + .long 1071861800 + .long 826988438 + .long 1071854324 + .long 1144260235 + .long 1071846874 + .long 3057005434 + .long 1071839450 + .long 1471209283 + .long 1071832053 + .long 4186184763 + .long 1071824681 + .long 1829683463 + .long 1071817336 + .long 2217517956 + .long 1071810016 + .long 288676754 + .long 1071802722 + .long 3875016090 + .long 1071795452 + .long 3636378776 + .long 1071788208 + .long 3125257108 + .long 1071780989 + .long 1606817369 + .long 1071773795 + .long 2648729924 + .long 1071766625 + .long 1236164615 + .long 1071759480 + .long 951558972 + .long 1071752359 + .long 1089617062 + .long 1071745262 + .long 952179194 + .long 1071738189 + .long 4143093266 + .long 1071731139 + .long 1388251237 + .long 1071724114 + .long 600267432 + .long 1071717112 + .long 1108583542 + .long 1071710133 + .long 2249313505 + .long 1071703177 + .long 3365155278 + .long 1071696244 + .long 3805304058 + .long 1071689334 + .long 2925366939 + .long 1071682447 + .long 87278952 + .long 1071675583 + .long 3249155078 + .long 1071668740 + .long 3195405229 + .long 1071661920 + .long 3601425396 + .long 1071655122 + .long 3853649835 + .long 1071648346 + .long 2393914686 + .long 1071638513 + .long 2944026756 + .long 1071625048 + .long 3870651933 + .long 1071611626 + .long 3993180461 + .long 1071598247 + .long 2142264402 + .long 1071584911 + .long 1454642149 + .long 1071571617 + .long 783063308 + .long 1071558365 + .long 3286084979 + .long 1071545154 + .long 3543033726 + .long 1071531985 + .long 438773454 + .long 1071518858 + .long 1458540784 + .long 1071505771 + .long 1212978710 + .long 1071492725 + .long 2912845216 + .long 1071479719 + .long 1189018219 + .long 1071466754 + .long 3567208110 + .long 1071453828 + .long 403064643 + .long 1071440943 + .long 3536762435 + .long 1071428096 + .long 3343209673 + .long 1071415289 + .long 3091669954 + .long 1071402521 + .long 1765778334 + .long 1071389792 + .long 2653362897 + .long 1071377101 + .long 461431547 + .long 1071364449 + .long 2790898835 + .long 1071351834 + .long 71706889 + .long 1071339258 + .long 4217424686 + .long 1071326718 + .long 1380502992 + .long 1071314217 + .long 3491778671 + .long 1071301752 + .long 1015732707 + .long 1071289325 + .long 1605095660 + .long 1071276934 + .long 35977849 + .long 1071264580 + .long 3977575844 + .long 1071252261 + .long 3927305531 + .long 1071239979 + .long 3275478714 + .long 1071227733 + .long 1125340846 + .long 1071215523 + .long 882913881 + .long 1071203348 + .long 1666971274 + .long 1071191208 + .long 2603916163 + .long 1071179103 + .long 2827693557 + .long 1071167033 + .long 1479703759 + .long 1071154998 + .long 2003684347 + .long 1071142997 + .long 3555691467 + .long 1071131030 + .long 1004016924 + .long 1071119098 + .long 2108975630 + .long 1071107199 + .long 1753021246 + .long 1071095334 + .long 3415503221 + .long 1071083502 + .long 1992719281 + .long 1071071704 + .long 977707388 + .long 1071059939 + .long 3870234994 + .long 1071048206 + .long 1291822077 + .long 1071036507 + .long 1050438164 + .long 1071024840 + .long 2370625547 + .long 1071013205 + .long 188394569 + .long 1071001603 + .long 2331021804 + .long 1070990032 + .long 3747176240 + .long 1070978493 + .long 3686719393 + .long 1070966986 + .long 1405669883 + .long 1070955511 + .long 461103529 + .long 1070944067 + .long 121152472 + .long 1070932654 + .long 3954874384 + .long 1070921271 + .long 2652318780 + .long 1070909920 + .long 4089234463 + .long 1070898599 + .long 3262235675 + .long 1070887309 + .long 3763576649 + .long 1070876049 + .long 601221319 + .long 1070864820 + .long 1673619518 + .long 1070853620 + .long 1999843716 + .long 1070842450 + .long 899399508 + .long 1070831310 + .long 1992167703 + .long 1070820199 + .long 313445281 + .long 1070809118 + .long 3788725476 + .long 1070798065 + .long 3168871046 + .long 1070787042 + .long 2094830420 + .long 1070776048 + .long 4212681596 + .long 1070765082 + .long 288676754 + .long 1070754146 + .long 2568927817 + .long 1070743237 + .long 1829681364 + .long 1070732357 + .long 1737005556 + .long 1070721505 + .long 1666870165 + .long 1070710681 + .long 1000063738 + .long 1070699885 + .long 3417111411 + .long 1070689116 + .long 4013324163 + .long 1070678375 + .long 2183652476 + .long 1070667662 + .long 1622638721 + .long 1070656976 + .long 1734435555 + .long 1070646317 + .long 1927726804 + .long 1070635685 + .long 1615681634 + .long 1070625080 + .long 215909304 + .long 1070614502 + .long 1445381777 + .long 1070603950 + .long 870975437 + .long 1070590754 + .long 1823716217 + .long 1070569756 + .long 323875369 + .long 1070548811 + .long 3839688678 + .long 1070527917 + .long 2667883253 + .long 1070507076 + .long 4293333010 + .long 1070486286 + .long 3324205749 + .long 1070465548 + .long 2966718784 + .long 1070444861 + .long 2140157205 + .long 1070424225 + .long 4066729595 + .long 1070403639 + .long 3386588242 + .long 1070383104 + .long 3337621361 + .long 1070362619 + .long 2870475188 + .long 1070342184 + .long 943446189 + .long 1070321799 + .long 817374162 + .long 1070301463 + .long 1465634365 + .long 1070281176 + .long 1869032404 + .long 1070260938 + .long 1015732707 + .long 1070240749 + .long 2196155141 + .long 1070220608 + .long 118003300 + .long 1070200516 + .long 2381031992 + .long 1070180471 + .long 3707175295 + .long 1070160474 + .long 3120348377 + .long 1070140525 + .long 3946380940 + .long 1070120623 + .long 928049556 + .long 1070100769 + .long 1699849154 + .long 1070080961 + .long 1018125008 + .long 1070061200 + .long 2235845747 + .long 1070041485 + .long 122671437 + .long 1070021817 + .long 2339728060 + .long 1070002194 + .long 3669742467 + .long 1069982617 + .long 3196851002 + .long 1069963086 + .long 11572342 + .long 1069943601 + .long 1800682930 + .long 1069924160 + .long 3372322013 + .long 1069904764 + .long 3835803021 + .long 1069885413 + .long 2306589128 + .long 1069866107 + .long 2201204065 + .long 1069846845 + .long 2647241692 + .long 1069827627 + .long 2778278092 + .long 1069808453 + .long 1733817001 + .long 1069789323 + .long 2954203158 + .long 1069770236 + .long 1295667077 + .long 1069751193 + .long 210141498 + .long 1069732193 + .long 3155274661 + .long 1069713235 + .long 709476866 + .long 1069694321 + .long 636640577 + .long 1069675449 + .long 2116286250 + .long 1069656619 + .long 38479793 + .long 1069637832 + .long 2183652476 + .long 1069619086 + .long 3452748429 + .long 1069600382 + .long 3047045639 + .long 1069581720 + .long 173141005 + .long 1069563100 + .long 970708326 + .long 1069541521 + .long 2106590683 + .long 1069504444 + .long 2198475040 + .long 1069467449 + .long 3996141691 + .long 1069430535 + .long 1669613218 + .long 1069393703 + .long 2283901796 + .long 1069356951 + .long 29117219 + .long 1069320280 + .long 1990183441 + .long 1069283688 + .long 2376948508 + .long 1069247176 + .long 3998935692 + .long 1069210743 + .long 1085389880 + .long 1069174390 + .long 760030536 + .long 1069138115 + .long 1566132617 + .long 1069101918 + .long 2056379433 + .long 1069065799 + .long 792781808 + .long 1069029758 + .long 641565395 + .long 1068993794 + .long 183156961 + .long 1068957907 + .long 2302040698 + .long 1068922096 + .long 1301778891 + .long 1068886362 + .long 84804484 + .long 1068850704 + .long 1562410668 + .long 1068815121 + .long 64741293 + .long 1068779614 + .long 2815553124 + .long 1068744181 + .long 4162338635 + .long 1068708823 + .long 2756122533 + .long 1068673540 + .long 1551389854 + .long 1068638331 + .long 3511047527 + .long 1068603195 + .long 3016419377 + .long 1068568133 + .long 3047045639 + .long 1068533144 + .long 296456961 + .long 1068497513 + .long 3221665916 + .long 1068427825 + .long 3697798734 + .long 1068358282 + .long 3453858508 + .long 1068288883 + .long 4234736672 + .long 1068219627 + .long 3506114812 + .long 1068150514 + .long 3044269692 + .long 1068081543 + .long 346010435 + .long 1068012714 + .long 1513453498 + .long 1067944025 + .long 4074027864 + .long 1067875476 + .long 1275317999 + .long 1067807068 + .long 3559777258 + .long 1067738798 + .long 4204867691 + .long 1067670667 + .long 797775935 + .long 1067602675 + .long 3825228429 + .long 1067534819 + .long 2313634884 + .long 1067467101 + .long 672386641 + .long 1067348671 + .long 3960777458 + .long 1067213778 + .long 1220920383 + .long 1067079157 + .long 684247743 + .long 1066944805 + .long 2020150230 + .long 1066810721 + .long 630721729 + .long 1066676905 + .long 535440936 + .long 1066543355 + .long 1486051399 + .long 1066410070 + .long 2227658502 + .long 1066152307 + .long 2743640746 + .long 1065886792 + .long 4184355568 + .long 1065621801 + .long 1971904113 + .long 1065357333 + .long 341338964 + .long 1064833554 + .long 1498975029 + .long 1064306693 + .long 1440057502 + .long 1063257089 + .long 0 + .long 0 + .long 0 + .long 0 + .long 4277811695 + .long 1078341186 + .long 4277811695 + .long 3225824834 + .long 1431655765 + .long 1070945621 + .long 4277811695 + .long 1047932482 + .long 1107282704 + .long 3219128321 + .long 4277811695 + .long 1047932482 + .type static_const_table,@object + .size static_const_table,2112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log1pl.S b/external/sgx_libm/ia32/log1pl.S new file mode 100644 index 0000000000..16d16a844d --- /dev/null +++ b/external/sgx_libm/ia32/log1pl.S @@ -0,0 +1,949 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log1pl.c" + .text +..TXTST0: +# -- Begin log1pl + .text + .align 16,0x90 + .globl log1pl +log1pl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %edi + pushl %ebx + subl $56, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + movl %eax, %edx + movzwl 16(%ebp), %edi + shll $15, %edx + andl $32767, %edi + orl %edi, %edx + shll $16, %edx + movzwl 14(%ebp), %ecx + orl %ecx, %edx + movzwl 14(%esp), %ebx + cmpl $32767, %edi + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + je ..B1.78 +..B1.4: + cmpl $-1073774592, %edx + jae ..B1.57 +..B1.5: + cmpl $16379, %edi + jge ..B1.47 +..B1.6: + cmpl $16369, %edi + jge ..B1.40 +..B1.7: + cmpl $16358, %edi + jge ..B1.33 +..B1.8: + cmpl $16345, %edi + jge ..B1.26 +..B1.9: + cmpl $16308, %edi + jge ..B1.19 +..B1.10: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.71 +..B1.11: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.12: + fldcw 12(%esp) +..B1.13: + movzwl 16(%ebp), %edi + movl $1, %edx + andl $32767, %edi +..B1.14: + testl %edi, %edi + jle ..B1.67 +..B1.15: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ecx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmul %st(1), %st + fxch %st(1) + fmull _ones@GOTOFF(%ecx,%eax,8) + fsubrp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ecx) + fstpt 16(%esp) +..B1.16: + testl %edx, %edx + je ..B1.18 +..B1.17: + fldcw 14(%esp) +..B1.18: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.72 +..B1.20: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.21: + fldcw 12(%esp) +..B1.22: + movl $1, %eax +..B1.23: + fldt 8(%ebp) + testl %eax, %eax + fldt _Q3@GOTOFF(%ecx) + fmul %st(1), %st + fmul %st(1), %st + fadd %st(1), %st + fstpt 16(%esp) + fldl _TWO_75@GOTOFF(%ecx) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%esp) + je ..B1.25 +..B1.24: + fldcw 14(%esp) +..B1.25: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.73 +..B1.27: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.28: + fldcw 12(%esp) +..B1.29: + movl $1, %eax +..B1.30: + fldt 8(%ebp) + testl %eax, %eax + fldt 12+_Q2@GOTOFF(%ecx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.32 +..B1.31: + fldcw 14(%esp) +..B1.32: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.33: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.74 +..B1.34: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.35: + fldcw 12(%esp) +..B1.36: + movl $1, %eax +..B1.37: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%ecx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%ecx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.39 +..B1.38: + fldcw 14(%esp) +..B1.39: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.40: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.75 +..B1.41: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.42: + fldcw 12(%esp) +..B1.43: + movl $1, %eax +..B1.44: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fld %st(1) + fld %st(2) + fldl _TWO_52H@GOTOFF(%ecx) + fmul %st(4), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fxch %st(3) + fstpt 32(%esp) + fldt 32(%esp) + fmul %st(0), %st + fadd %st, %st(3) + fldt 156+_Q@GOTOFF(%ecx) + fmul %st(4), %st + fldt 132+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 108+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 84+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 60+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 36+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 12+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 144+_Q@GOTOFF(%ecx) + fmul %st(5), %st + fldt 120+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 96+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 72+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 48+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 24+_Q@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(5) + fld %st(2) + fldt _Q@GOTOFF(%ecx) + faddp %st, %st(6) + fxch %st(5) + fmul %st(6), %st + faddp %st, %st(1) + fldt 180+_Q@GOTOFF(%ecx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(1) + fldt 168+_Q@GOTOFF(%ecx) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(5) + fldt 32(%esp) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.46 +..B1.45: + fldcw 14(%esp) +..B1.46: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.47: + movl %ebx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.76 +..B1.48: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.49: + fldcw 12(%esp) +..B1.50: + movzbl 17(%ebp), %eax + movl $1, %ebx + andl $128, %eax + shrl $7, %eax +..B1.51: + cmpl ranges@GOTOFF(%ecx,%eax,4), %edx + jae ..B1.53 +..B1.52: + fldt 8(%ebp) + xorl %edx, %edx + movzwl 16(%ebp), %edi + fld %st(0) + fldl _ones@GOTOFF(%ecx) + andl $32767, %edi + addl $-16415, %edi + fstpt 16(%esp) + setl %dl + fldl _shifters@GOTOFF(%ecx,%edx,8) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + faddl zero_one@GOTOFF(%ecx,%edx,8) + xorl $1, %edx + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + faddl zero_one@GOTOFF(%ecx,%edx,8) + movzwl 24(%esp), %edx + fadd %st, %st(1) + fxch %st(1) + fstpt 8(%ebp) + andl $-32768, %edx + movzwl 16(%ebp), %eax + andl $32767, %eax + movl %eax, %edi + addl $-16383, %eax + negl %edi + addl $-2, %edi + andl $32767, %edi + orl %edi, %edx + movl 12(%ebp), %edi + shrl $23, %edi + andl $255, %edi + movw %dx, 24(%esp) + fldt 16(%esp) + fmuls __libm_rcp_table_256@GOTOFF(%ecx,%edi,4) + jmp ..B1.54 +..B1.53: + fldt 8(%ebp) + fldl _TWO_32H@GOTOFF(%ecx) + fxch %st(1) + faddl zero_one@GOTOFF(%ecx,%eax,8) + fstpt 8(%ebp) + movzwl 16(%ebp), %edx + movl %edx, %eax + andl $-32768, %edx + andl $32767, %eax + orl $-49153, %edx + addl $-16383, %eax + movw %dx, 16(%ebp) + fldt 8(%ebp) + fld %st(0) + movl 12(%ebp), %edi + fadd %st(2), %st + shrl $23, %edi + fsubp %st, %st(2) + andl $255, %edi + fsub %st(1), %st + fxch %st(1) + fstpt 32(%esp) + flds __libm_rcp_table_256@GOTOFF(%ecx,%edi,4) +..B1.54: + fldt 32(%esp) + fmul %st(1), %st + fxch %st(2) + fmulp %st, %st(1) + fxch %st(1) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + movl %eax, 16(%esp) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fildl 16(%esp) + fldt 60+_P@GOTOFF(%ecx) + fmul %st(3), %st + fldt 36+_P@GOTOFF(%ecx) + shll $4, %edi + faddp %st, %st(1) + fmul %st(3), %st + testl %ebx, %ebx + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fmulp %st, %st(2) + fldt 48+_P@GOTOFF(%ecx) + fmul %st(3), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(3), %st + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0@GOTOFF(%ecx) + fmul %st(1), %st + fldt .L_2il0floatpacket.1@GOTOFF(%ecx) + fmulp %st, %st(2) + faddl 8+__libm_logl_table_256@GOTOFF(%ecx,%edi) + faddp %st, %st(3) + faddl __libm_logl_table_256@GOTOFF(%edi,%ecx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%esp) + je ..B1.56 +..B1.55: + fldcw 14(%esp) +..B1.56: + fldt 32(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.57: + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.77 +..B1.58: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.59: + fldcw 12(%esp) +..B1.60: + movl $1, %edx +..B1.61: + fldl 8+_ones@GOTOFF(%ecx) + fstpt 16(%esp) + fldt 16(%esp) + fldl _zeros@GOTOFF(%ecx) + fldt 8(%ebp) + fucomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jp ..B1.62 + je ..B1.63 +..B1.62: + fldl _infs@GOTOFF(%ecx) + fmulp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.64 +..B1.63: + fldt 16(%esp) + fdivp %st, %st(1) + fstpt 16(%esp) +..B1.64: + testl %edx, %edx + je ..B1.66 +..B1.65: + fldcw 14(%esp) +..B1.66: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.67: + cmpl $0, 12(%ebp) + jne ..B1.69 +..B1.68: + cmpl $0, 8(%ebp) + je ..B1.70 +..B1.69: + fldt _small_value_80@GOTOFF(%ecx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fmul %st(0), %st + fstpt (%esp) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ecx) + fmul %st(1), %st + fxch %st(1) + fmull _ones@GOTOFF(%ecx,%eax,8) + fsubrp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ecx) + fstpt 16(%esp) + jmp ..B1.16 +..B1.70: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.16 +..B1.71: + xorl %edx, %edx + jmp ..B1.14 +..B1.72: + xorl %eax, %eax + jmp ..B1.23 +..B1.73: + xorl %eax, %eax + jmp ..B1.30 +..B1.74: + xorl %eax, %eax + jmp ..B1.37 +..B1.75: + xorl %eax, %eax + jmp ..B1.44 +..B1.76: + xorl %ebx, %ebx + jmp ..B1.51 +..B1.77: + xorl %edx, %edx + jmp ..B1.61 +..B1.78: + movl %ebx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.90 +..B1.79: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.80: + fldcw 12(%esp) +..B1.81: + movzbl 17(%ebp), %eax + movl $1, %edx + andl $128, %eax + shrl $7, %eax +..B1.82: + testl %eax, %eax + je ..B1.85 +..B1.83: + cmpl $-2147483648, 12(%ebp) + jne ..B1.85 +..B1.84: + cmpl $0, 8(%ebp) + je ..B1.89 +..B1.85: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ecx) + fstpt 16(%esp) +..B1.86: + testl %edx, %edx + je ..B1.88 +..B1.87: + fldcw 14(%esp) +..B1.88: + fldt 16(%esp) + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret +..B1.89: + fldl _infs@GOTOFF(%ecx) + fmull _zeros@GOTOFF(%ecx) + fstpt 16(%esp) + jmp ..B1.86 +..B1.90: + xorl %edx, %edx + jmp ..B1.82 + .align 16,0x90 + .type log1pl,@function + .size log1pl,.-log1pl + .data +# -- End log1pl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 8 +zero_one: + .long 0x00000000,0x00000000 + .long 0x00000000,0x3ff00000 + .type zero_one,@object + .size zero_one,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +ranges: + .long 1078558720 + .long 3221127168 + .type ranges,@object + .size ranges,8 + .align 4 +_shifters: + .long 0 + .long 1098383360 + .long 0 + .long 1123549184 + .type _shifters,@object + .size _shifters,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q3: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 4096 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 53521 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 65509 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 43631 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 43680 + .word 43690 + .word 6 + .word 32768 + .word 49149 + .word 0 + .word 60885 + .word 52536 + .word 52444 + .word 52428 + .word 16380 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 14363 + .word 62279 + .word 27629 + .word 62293 + .word 49080 + .word 0 + .word 44555 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 64968 + .word 65535 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 50395 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 39590 + .word 43714 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 15749 + .word 18782 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 61040 + .word 7204 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 10454 + .word 61175 + .word 14561 + .word 58254 + .word 16379 + .word 0 + .word 57771 + .word 22430 + .word 52985 + .word 52428 + .word 49147 + .word 0 + .word 7036 + .word 15828 + .word 36565 + .word 47662 + .word 16379 + .word 0 + .word 17194 + .word 46991 + .word 54030 + .word 43687 + .word 49147 + .word 0 + .word 63541 + .word 11931 + .word 21910 + .word 40326 + .word 16379 + .word 0 + .word 36457 + .word 1697 + .word 61895 + .word 37932 + .word 49147 + .word 0 + .word 65454 + .word 16107 + .word 6024 + .word 35469 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .type _Q,@object + .size _Q,192 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .type _P,@object + .size _P,72 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log2_wmt.S b/external/sgx_libm/ia32/log2_wmt.S new file mode 100644 index 0000000000..4033738373 --- /dev/null +++ b/external/sgx_libm/ia32/log2_wmt.S @@ -0,0 +1,808 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log2 + .text + .align 16,0x90 + .globl log2 +log2: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movl $1069088768, %ecx + movd %ecx, %xmm7 + xorpd %xmm3, %xmm3 + movl $30704, %edx + pinsrw $3, %edx, %xmm3 + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + movl $32768, %edx + movd %edx, %xmm4 + movapd 2112(%ebx), %xmm5 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $16352, %ecx + psllq $5, %xmm0 + movsd 2128(%ebx), %xmm2 + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + mulss %xmm7, %xmm0 + orpd %xmm3, %xmm1 + andpd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + subsd %xmm5, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm6, %xmm0 + andl $32752, %eax + subl %ecx, %eax + sarl $4, %eax + cvtsi2sdl %eax, %xmm7 + mulpd %xmm0, %xmm5 + mulsd %xmm0, %xmm1 + movapd 2064(%ebx), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd -912(%ebx,%edx), %xmm0 + movapd 2080(%ebx), %xmm4 + addsd %xmm5, %xmm1 + movapd 2096(%ebx), %xmm2 + movsd 2136(%ebx), %xmm6 + pshufd $68, %xmm1, %xmm5 + mulsd %xmm1, %xmm3 + addsd %xmm7, %xmm0 + mulpd %xmm5, %xmm4 + mulpd %xmm5, %xmm5 + addpd %xmm2, %xmm4 + mulpd %xmm5, %xmm3 + pshufd $228, %xmm0, %xmm7 + addsd %xmm1, %xmm0 + mulsd %xmm1, %xmm4 + subsd %xmm0, %xmm7 + mulsd %xmm1, %xmm6 + addsd %xmm7, %xmm1 + pshufd $238, %xmm0, %xmm2 + mulsd %xmm5, %xmm5 + addsd %xmm6, %xmm1 + addpd %xmm3, %xmm4 + addsd %xmm2, %xmm1 + mulpd %xmm5, %xmm4 + addsd %xmm4, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_3.0.3 + cmpl $16, %eax + jb .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + ja .L_2TAG_PACKET_5.0.3 + cmpl $0, %edx + ja .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_3.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_6.0.3 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_7.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + movl $171, %edx + mulsd %xmm1, %xmm0 +.L_2TAG_PACKET_9.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_10.0.3 +.L_2TAG_PACKET_8.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $170, %edx + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_4.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_8.0.3 + xorpd %xmm1, %xmm1 + movl $18416, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movapd %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $18416, %ecx + psllq $5, %xmm0 + movsd 2128(%ebx), %xmm2 + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_10.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log2,@function + .size log2,.-log2 + .data +# -- End log2 + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 3065110528 + .long 1072676937 + .long 969155058 + .long 1027421928 + .long 3789631488 + .long 1072660714 + .long 1061361078 + .long 1026032326 + .long 2461925376 + .long 1072644578 + .long 1624763829 + .long 3175910818 + .long 3729080320 + .long 1072628527 + .long 1845599454 + .long 1028591843 + .long 3710689280 + .long 1072612561 + .long 3776236642 + .long 1025648432 + .long 2882404352 + .long 1072596679 + .long 3683226528 + .long 3174591570 + .long 1779716096 + .long 1072580880 + .long 1916484889 + .long 3173934989 + .long 996708352 + .long 1072565163 + .long 716999656 + .long 3175673444 + .long 1184837632 + .long 1072549527 + .long 1973599317 + .long 3174949482 + .long 3051761664 + .long 1072533971 + .long 1437348984 + .long 1028530411 + .long 3065225216 + .long 1072518495 + .long 1219343899 + .long 1028525753 + .long 2041864192 + .long 1072503098 + .long 388496599 + .long 3175919551 + .long 851140608 + .long 1072487779 + .long 2822909360 + .long 3173772990 + .long 414302208 + .long 1072472537 + .long 1306322068 + .long 1026235748 + .long 1703325696 + .long 1072457371 + .long 1651655805 + .long 3174368281 + .long 1444937728 + .long 1072442281 + .long 1145646243 + .long 3175573309 + .long 709566464 + .long 1072427266 + .long 3608295147 + .long 3168585112 + .long 615415808 + .long 1072412325 + .long 2957847316 + .long 1027961637 + .long 2327523328 + .long 1072397457 + .long 3266875511 + .long 3175163169 + .long 2761863168 + .long 1072382662 + .long 3329930550 + .long 1027790656 + .long 3174416384 + .long 1072367939 + .long 3349298596 + .long 3172501429 + .long 570335232 + .long 1072353288 + .long 905028281 + .long 3175970581 + .long 588005376 + .long 1072338707 + .long 40558280 + .long 1022275054 + .long 318357504 + .long 1072324196 + .long 3000963593 + .long 3175644723 + .long 1188933632 + .long 1072309754 + .long 1152643439 + .long 3171407768 + .long 373186560 + .long 1072295381 + .long 3440409283 + .long 3174861647 + .long 3674587136 + .long 1072281075 + .long 1985407462 + .long 1026124611 + .long 4051050496 + .long 1072266837 + .long 2734481544 + .long 1026856954 + .long 3089022976 + .long 1072252666 + .long 3365453112 + .long 1028135364 + .long 2412838912 + .long 1072238561 + .long 1203709499 + .long 3175656792 + .long 3683999744 + .long 1072224521 + .long 4237943120 + .long 3176014210 + .long 10571776 + .long 1072210547 + .long 1358548904 + .long 3174161579 + .long 1716314112 + .long 1072196636 + .long 1192519078 + .long 3175777045 + .long 1980272640 + .long 1072182789 + .long 1567013979 + .long 3174472130 + .long 2605957120 + .long 1072169005 + .long 1671600287 + .long 1028158963 + .long 1135812608 + .long 1072155284 + .long 1547709291 + .long 3174179085 + .long 3735490560 + .long 1072141624 + .long 2225392115 + .long 1027056729 + .long 3718443008 + .long 1072128026 + .long 3797315894 + .long 3175978381 + .long 3020144640 + .long 1072114489 + .long 569231379 + .long 3176080301 + .long 3607605248 + .long 1072101012 + .long 2931542967 + .long 1028585043 + .long 3183849472 + .long 1072087595 + .long 1779595699 + .long 1025078612 + .long 3777277952 + .long 1072074237 + .long 3836888569 + .long 3176101128 + .long 3151212544 + .long 1072060938 + .long 4204238866 + .long 1027628024 + .long 3393323008 + .long 1072047697 + .long 3590952967 + .long 1024914744 + .long 2325151744 + .long 1072034514 + .long 2081953065 + .long 1024436445 + .long 2091569152 + .long 1072021388 + .long 1869579321 + .long 3176039801 + .long 570331136 + .long 1072008319 + .long 1169272038 + .long 1028145343 + .long 4256530432 + .long 1071995305 + .long 3897289024 + .long 3171837174 + .long 2492289024 + .long 1071982348 + .long 3892405903 + .long 3175484647 + .long 1826058240 + .long 1071969446 + .long 4079999923 + .long 3175326622 + .long 242364416 + .long 1071956599 + .long 850820968 + .long 3175983841 + .long 46260224 + .long 1071943806 + .long 2164938638 + .long 1028426857 + .long 3567947776 + .long 1071931066 + .long 2011723452 + .long 1028083988 + .long 277430272 + .long 1071918381 + .long 2531435800 + .long 3169601318 + .long 1143848960 + .long 1071905748 + .long 294923185 + .long 1023738369 + .long 4275343360 + .long 1071893167 + .long 2459435756 + .long 1028412742 + .long 3508592640 + .long 1071880639 + .long 503755275 + .long 3173140530 + .long 1293312000 + .long 1071868163 + .long 3333822795 + .long 1026993594 + .long 101961728 + .long 1071855738 + .long 2904005851 + .long 1027338469 + .long 2429362176 + .long 1071843363 + .long 1235892196 + .long 3175679811 + .long 2202386432 + .long 1071831039 + .long 2295142960 + .long 1028565357 + .long 1959501824 + .long 1071818765 + .long 254808788 + .long 1028157588 + .long 4260454400 + .long 1071806540 + .long 1281464327 + .long 3173548784 + .long 3096002560 + .long 1071794365 + .long 2126040068 + .long 3168834094 + .long 1067458560 + .long 1071782239 + .long 957416402 + .long 3171516564 + .long 796413952 + .long 1071770161 + .long 3663270514 + .long 1026937343 + .long 629456896 + .long 1071758131 + .long 2081311685 + .long 1026861414 + .long 3227787264 + .long 1071746148 + .long 325239760 + .long 3175812466 + .long 2681995264 + .long 1071734213 + .long 692600417 + .long 1028316258 + .long 1691656192 + .long 1071722325 + .long 2854288619 + .long 3174069820 + .long 2975059968 + .long 1071710483 + .long 2357806657 + .long 3175896595 + .long 1853362176 + .long 1071686938 + .long 182026883 + .long 3174676055 + .long 4247105536 + .long 1071663574 + .long 1264810745 + .long 1026738550 + .long 671424512 + .long 1071636109 + .long 321222784 + .long 1028039985 + .long 4092968960 + .long 1071590092 + .long 3658154599 + .long 3175856095 + .long 193347584 + .long 1071544424 + .long 723354347 + .long 3173824323 + .long 985587712 + .long 1071499097 + .long 2344377442 + .long 1027857554 + .long 1801297920 + .long 1071454107 + .long 2398211919 + .long 3175430015 + .long 2750758912 + .long 1071409449 + .long 223148174 + .long 1028267694 + .long 118882304 + .long 1071365119 + .long 1958423088 + .long 1026816298 + .long 3531350016 + .long 1071321110 + .long 875023512 + .long 1027316085 + .long 1581752320 + .long 1071277420 + .long 345754833 + .long 1027657950 + .long 473587712 + .long 1071234043 + .long 3024467474 + .long 3175496105 + .long 2533163008 + .long 1071190974 + .long 3279280870 + .long 3173991880 + .long 1902854144 + .long 1071148210 + .long 3170372974 + .long 3174359141 + .long 1709547520 + .long 1071105746 + .long 3312617382 + .long 3175326532 + .long 1168744448 + .long 1071063578 + .long 2799128425 + .long 1027228825 + .long 4163903488 + .long 1071021701 + .long 1285964057 + .long 3176060221 + .long 2056257536 + .long 1070980113 + .long 2706516695 + .long 1028650734 + .long 3739770880 + .long 1070938808 + .long 246392277 + .long 3174722093 + .long 1271734272 + .long 1070897784 + .long 3679462403 + .long 3174159366 + .long 4223328256 + .long 1070857035 + .long 2433294629 + .long 1027980203 + .long 1015963648 + .long 1070816560 + .long 4253198713 + .long 1026847814 + .long 1862295552 + .long 1070776353 + .long 1509191037 + .long 3173682029 + .long 103178240 + .long 1070736412 + .long 3582688163 + .long 3173089500 + .long 2264358912 + .long 1070696732 + .long 1779381280 + .long 1025292403 + .long 2278850560 + .long 1070657311 + .long 3240888728 + .long 1027177644 + .long 2954207232 + .long 1070618145 + .long 3564986365 + .long 1024870970 + .long 1865613312 + .long 1070562367 + .long 3892585078 + .long 1027946215 + .long 3434348544 + .long 1070485036 + .long 3011363162 + .long 3175199985 + .long 671449088 + .long 1070408197 + .long 1145012811 + .long 1026506981 + .long 1327038464 + .long 1070331842 + .long 227553652 + .long 1028331265 + .long 766836736 + .long 1070255966 + .long 518075456 + .long 3175312400 + .long 3434479616 + .long 1070180562 + .long 1452680450 + .long 3174267422 + .long 1364688896 + .long 1070105626 + .long 2571031723 + .long 3174222501 + .long 4236263424 + .long 1070031150 + .long 3514507731 + .long 3175326685 + .long 706019328 + .long 1069957131 + .long 2980398698 + .long 1026808442 + .long 1347502080 + .long 1069883561 + .long 1818423398 + .long 3175271900 + .long 4280483840 + .long 1069810435 + .long 3925170731 + .long 3175415416 + .long 3750608896 + .long 1069737749 + .long 710015584 + .long 3170118559 + .long 3004235776 + .long 1069665497 + .long 3823542833 + .long 3174354681 + .long 1393737728 + .long 1069593674 + .long 4238122296 + .long 1028475778 + .long 1621164032 + .long 1069497029 + .long 2232087921 + .long 3175937870 + .long 2762080256 + .long 1069355067 + .long 3580752115 + .long 3175802838 + .long 2914779136 + .long 1069213933 + .long 1251526596 + .long 1028548772 + .long 3808428032 + .long 1069073617 + .long 1491573749 + .long 1025131695 + .long 3589865472 + .long 1068934110 + .long 2320751647 + .long 3175285520 + .long 1102381056 + .long 1068795403 + .long 2369472545 + .long 3174735692 + .long 164790272 + .long 1068657486 + .long 3958705468 + .long 1027545055 + .long 966098944 + .long 1068520350 + .long 91754714 + .long 3174161762 + .long 100794368 + .long 1068269030 + .long 3205869737 + .long 3173509296 + .long 2079653888 + .long 1067997831 + .long 930310477 + .long 1028614386 + .long 3471048704 + .long 1067728143 + .long 1091811766 + .long 1028000848 + .long 1092419584 + .long 1067459950 + .long 629649056 + .long 3175844743 + .long 3079012352 + .long 1066936100 + .long 3939938999 + .long 3172112142 + .long 3666608128 + .long 1066405591 + .long 4185504407 + .long 3175959388 + .long 526647296 + .long 1065354156 + .long 1469727419 + .long 3173760470 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1367832035 + .long 1066403058 + .long 2677381210 + .long 3216320731 + .long 3610762001 + .long 3214607116 + .long 1215221452 + .long 1069835102 + .long 2894285243 + .long 1067936923 + .long 3011779882 + .long 3218479542 + .long 4160749568 + .long 4294967295 + .long 0 + .long 4294959104 + .long 0 + .long 1073160192 + .long 370913857 + .long 3210587105 + .type static_const_table,@object + .size static_const_table,2144 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log2f_wmt.S b/external/sgx_libm/ia32/log2f_wmt.S new file mode 100644 index 0000000000..6d3fbbcf6b --- /dev/null +++ b/external/sgx_libm/ia32/log2f_wmt.S @@ -0,0 +1,745 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2f_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log2f + .text + .align 16,0x90 + .globl log2f +log2f: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl $16384, %ecx + movd %ecx, %xmm4 + movl $-32768, %eax + movd %eax, %xmm2 + xorpd %xmm3, %xmm3 + movl $16368, %edx + pinsrw $3, %edx, %xmm3 + xorpd %xmm5, %xmm5 +.L_2TAG_PACKET_0.0.3: + movd %xmm0, %edx + rcpss %xmm0, %xmm1 + movsd 2080(%ebx), %xmm7 + pshuflw $68, %xmm0, %xmm0 + paddd %xmm4, %xmm1 + subl $8388608, %edx + cmpl $2113929216, %edx + jae .L_2TAG_PACKET_1.0.3 + andps %xmm1, %xmm2 + cvtps2pd %xmm0, %xmm0 + cvtps2pd %xmm2, %xmm1 + movd %xmm2, %eax + andl $-8388608, %edx + subl $1056964608, %edx + movl %edx, %ecx + sarl $23, %edx + cvtsi2sdl %edx, %xmm6 + mulsd %xmm1, %xmm0 + subl $1056964608, %ecx + addl %ecx, %eax + shrl $12, %eax + movsd (%ebx,%eax), %xmm4 + subsd %xmm3, %xmm0 + movsd 2088(%ebx), %xmm2 + movsd 2096(%ebx), %xmm1 + mulsd %xmm0, %xmm7 + addsd %xmm0, %xmm5 + mulsd %xmm0, %xmm0 + addsd %xmm4, %xmm6 + addsd %xmm7, %xmm1 + mulsd %xmm2, %xmm5 + mulsd %xmm1, %xmm0 + mulsd %xmm2, %xmm0 + addsd %xmm6, %xmm5 + addsd %xmm0, %xmm5 + cvtpd2ps %xmm5, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + addl $8388608, %edx + js .L_2TAG_PACKET_3.0.3 + cmpl $8388608, %edx + jb .L_2TAG_PACKET_4.0.3 + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_5.0.3 + movl $528482304, %eax + movd %eax, %xmm6 + movsd 2064(%ebx), %xmm5 + mulss %xmm6, %xmm0 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_5.0.3: + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $-2147483648, %edx + je .L_2TAG_PACKET_6.0.3 + addl %edx, %edx + cmpl $-16777216, %edx + ja .L_2TAG_PACKET_5.0.3 + xorps %xmm0, %xmm0 + divss %xmm0, %xmm0 + movl $173, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $0, %edx + je .L_2TAG_PACKET_6.0.3 + movl $1602224128, %eax + movd %eax, %xmm7 + mulss %xmm7, %xmm0 + movsd 2072(%ebx), %xmm5 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_6.0.3: + movl $-1082130432, %eax + movd %eax, %xmm0 + xorps %xmm1, %xmm1 + divss %xmm1, %xmm0 + movl $172, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_2.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log2f,@function + .size log2f,.-log2f + .data +# -- End log2f + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 1998916263 + .long 1072681452 + .long 3173270495 + .long 1072669702 + .long 2000860199 + .long 1072657998 + .long 1272047984 + .long 1072646339 + .long 3794524037 + .long 1072634724 + .long 3803106495 + .long 1072623154 + .long 4139350621 + .long 1072611628 + .long 3366391848 + .long 1072600146 + .long 63662823 + .long 1072588708 + .long 1416582474 + .long 1072577312 + .long 1741478598 + .long 1072565959 + .long 3960187916 + .long 1072554648 + .long 2419954872 + .long 1072543380 + .long 73073096 + .long 1072532154 + .long 4181694601 + .long 1072520968 + .long 547806622 + .long 1072509825 + .long 757656496 + .long 1072498722 + .long 3526834581 + .long 1072487659 + .long 3290001261 + .long 1072476637 + .long 3085585033 + .long 1072465655 + .long 1670680485 + .long 1072454713 + .long 2110786378 + .long 1072443810 + .long 3189678060 + .long 1072432946 + .long 3704185224 + .long 1072422121 + .long 2464005749 + .long 1072411335 + .long 2586490145 + .long 1072400587 + .long 2906527345 + .long 1072389877 + .long 2271335546 + .long 1072379205 + .long 3835256167 + .long 1072368570 + .long 2174681645 + .long 1072357973 + .long 467757278 + .long 1072347413 + .long 1904282206 + .long 1072336889 + .long 1095613242 + .long 1072326402 + .long 1254375265 + .long 1072315951 + .long 1309403273 + .long 1072305536 + .long 200556308 + .long 1072295157 + .long 1173533989 + .long 1072284813 + .long 3189793736 + .long 1072274504 + .long 926405093 + .long 1072264231 + .long 1955775707 + .long 1072253992 + .long 975706757 + .long 1072243788 + .long 1284091012 + .long 1072233618 + .long 1893874830 + .long 1072223482 + .long 1827891621 + .long 1072213380 + .long 118730237 + .long 1072203312 + .long 103572845 + .long 1072193277 + .long 834133047 + .long 1072183275 + .long 1371497981 + .long 1072173306 + .long 786005198 + .long 1072163370 + .long 2452088827 + .long 1072153466 + .long 1163258553 + .long 1072143595 + .long 311851589 + .long 1072133756 + .long 3298982784 + .long 1072123948 + .long 649529288 + .long 1072114173 + .long 76790007 + .long 1072104429 + .long 712572003 + .long 1072094716 + .long 1697017023 + .long 1072085034 + .long 2178495145 + .long 1072075383 + .long 1313500133 + .long 1072065763 + .long 2561513738 + .long 1072056173 + .long 800002435 + .long 1072046614 + .long 3799154139 + .long 1072037084 + .long 2157008926 + .long 1072027585 + .long 3659100731 + .long 1072018115 + .long 3213591115 + .long 1072008675 + .long 31044775 + .long 1071999265 + .long 1919304603 + .long 1071989883 + .long 3808564412 + .long 1071980530 + .long 636181417 + .long 1071971207 + .long 231490093 + .long 1071961912 + .long 1840879012 + .long 1071952645 + .long 422672785 + .long 1071943407 + .long 3826917183 + .long 1071934196 + .long 2730525283 + .long 1071925014 + .long 701967006 + .long 1071915860 + .long 1316286934 + .long 1071906733 + .long 3860057913 + .long 1071897633 + .long 3331303149 + .long 1071888561 + .long 3324321351 + .long 1071879516 + .long 3144709244 + .long 1071870498 + .long 2104254386 + .long 1071861507 + .long 3815829096 + .long 1071852542 + .long 3308416273 + .long 1071843604 + .long 4206907352 + .long 1071834692 + .long 1552162950 + .long 1071825807 + .long 3275780188 + .long 1071816947 + .long 135253478 + .long 1071808114 + .long 73645744 + .long 1071799306 + .long 2449718467 + .long 1071790523 + .long 2332833768 + .long 1071781766 + .long 3387792013 + .long 1071773034 + .long 694899285 + .long 1071764328 + .long 2224741414 + .long 1071755646 + .long 3068318658 + .long 1071746989 + .long 2616854210 + .long 1071738357 + .long 266767097 + .long 1071729750 + .long 4009547812 + .long 1071721166 + .long 366929114 + .long 1071712608 + .long 1635468980 + .long 1071704073 + .long 2936821143 + .long 1071695562 + .long 3692515865 + .long 1071687075 + .long 3328937712 + .long 1071678612 + .long 1277271392 + .long 1071670173 + .long 1268415641 + .long 1071661757 + .long 2742995963 + .long 1071653364 + .long 851312691 + .long 1071644995 + .long 2971350593 + .long 1071628625 + .long 3905998082 + .long 1071611978 + .long 3424346780 + .long 1071595377 + .long 453058438 + .long 1071578822 + .long 2517515273 + .long 1071562311 + .long 4266887860 + .long 1071545845 + .long 358942687 + .long 1071529425 + .long 2639818283 + .long 1071513048 + .long 1489227762 + .long 1071496716 + .long 180106617 + .long 1071480428 + .long 1993621493 + .long 1071464183 + .long 1629147435 + .long 1071447982 + .long 2384050109 + .long 1071431824 + .long 3268698085 + .long 1071415709 + .long 3301345460 + .long 1071399637 + .long 1508048308 + .long 1071383608 + .long 1217549516 + .long 1071367621 + .long 1471262833 + .long 1071351676 + .long 1318159864 + .long 1071335773 + .long 4109658129 + .long 1071319911 + .long 319673664 + .long 1071304092 + .long 1904282206 + .long 1071288313 + .long 3646937343 + .long 1071272575 + .long 338264500 + .long 1071256879 + .long 3955855899 + .long 1071241222 + .long 714524339 + .long 1071225607 + .long 2605838414 + .long 1071210031 + .long 153410875 + .long 1071194496 + .long 1067533806 + .long 1071179000 + .long 180337971 + .long 1071163544 + .long 920560604 + .long 1071148127 + .long 2428575699 + .long 1071132749 + .long 3851294344 + .long 1071117410 + .long 47131309 + .long 1071102111 + .long 3060776247 + .long 1071086849 + .long 3468423567 + .long 1071071626 + .long 442479858 + .long 1071056442 + .long 1751501034 + .long 1071041295 + .long 2285293781 + .long 1071026186 + .long 1234723448 + .long 1071011115 + .long 2091653508 + .long 1070996081 + .long 4058951182 + .long 1070981084 + .long 2050428397 + .long 1070966125 + .long 3870652645 + .long 1070951202 + .long 150118312 + .long 1070936317 + .long 2999895448 + .long 1070921467 + .long 3061900616 + .long 1070906654 + .long 3868579735 + .long 1070891877 + .long 368016775 + .long 1070877137 + .long 398716067 + .long 1070862432 + .long 3214712303 + .long 1070847762 + .long 3780484976 + .long 1070833128 + .long 1360840737 + .long 1070818530 + .long 3815829096 + .long 1070803966 + .long 1830887666 + .long 1070789438 + .long 3276530156 + .long 1070774944 + .long 3143525540 + .long 1070760485 + .long 722718060 + .long 1070746061 + .long 3899945937 + .long 1070731670 + .long 3386189576 + .long 1070717314 + .long 2782295200 + .long 1070702992 + .long 1399058777 + .long 1070688704 + .long 2847114277 + .long 1070674449 + .long 2151986001 + .long 1070660228 + .long 2933912513 + .long 1070646040 + .long 227932728 + .long 1070631886 + .long 1958678199 + .long 1070617764 + .long 3170525653 + .long 1070603675 + .long 2119878685 + .long 1070583143 + .long 2835758645 + .long 1070555096 + .long 2899780145 + .long 1070527114 + .long 1026954088 + .long 1070499197 + .long 236130878 + .long 1070471344 + .long 3554951635 + .long 1070443554 + .long 1134865757 + .long 1070415829 + .long 315822346 + .long 1070388167 + .long 4151355006 + .long 1070360567 + .long 2818569420 + .long 1070333031 + .long 3682837470 + .long 1070305557 + .long 1232950086 + .long 1070278146 + .long 2850845811 + .long 1070250796 + .long 3041732649 + .long 1070223508 + .long 613883718 + .long 1070196282 + .long 2973531841 + .long 1070169116 + .long 354993871 + .long 1070142012 + .long 180337971 + .long 1070114968 + .long 1289509543 + .long 1070087984 + .long 2530196301 + .long 1070061060 + .long 2757759525 + .long 1070034196 + .long 835166085 + .long 1070007392 + .long 4222855792 + .long 1069980646 + .long 3208871137 + .long 1069953960 + .long 973562605 + .long 1069927333 + .long 704621746 + .long 1069900764 + .long 1302049555 + .long 1069874253 + .long 1673060149 + .long 1069847800 + .long 732017834 + .long 1069821405 + .long 1695342161 + .long 1069795067 + .long 3491511767 + .long 1069768786 + .long 761003473 + .long 1069742563 + .long 1036101224 + .long 1069716396 + .long 3266000023 + .long 1069690285 + .long 2111714268 + .long 1069664231 + .long 830921328 + .long 1069638233 + .long 2687969258 + .long 1069612290 + .long 2363885129 + .long 1069586403 + .long 3136187749 + .long 1069560571 + .long 3692892517 + .long 1069522069 + .long 3570253499 + .long 1069470625 + .long 3908238678 + .long 1069419290 + .long 2723302721 + .long 1069368064 + .long 2339434949 + .long 1069316946 + .long 798118803 + .long 1069265936 + .long 448161615 + .long 1069215033 + .long 3650623571 + .long 1069164236 + .long 4188780490 + .long 1069113546 + .long 152924137 + .long 1069062963 + .long 2530196301 + .long 1069012484 + .long 844750970 + .long 1068962111 + .long 1812361559 + .long 1068911842 + .long 3570519722 + .long 1068861677 + .long 4268273545 + .long 1068811616 + .long 2066132126 + .long 1068761659 + .long 3725905754 + .long 1068711804 + .long 3135775963 + .long 1068662052 + .long 2785039517 + .long 1068612402 + .long 879114973 + .long 1068562854 + .long 4224353950 + .long 1068513406 + .long 621328030 + .long 1068429177 + .long 522185727 + .long 1068330685 + .long 354069551 + .long 1068232393 + .long 930992923 + .long 1068134300 + .long 3088087314 + .long 1068036405 + .long 3386464469 + .long 1067938708 + .long 2702982241 + .long 1067841208 + .long 1935110224 + .long 1067743904 + .long 2000764363 + .long 1067646795 + .long 3838143225 + .long 1067549880 + .long 4110598596 + .long 1067453159 + .long 3297851897 + .long 1067262895 + .long 3492345695 + .long 1067070223 + .long 2250192214 + .long 1066877934 + .long 1645815860 + .long 1066686026 + .long 3792308805 + .long 1066494497 + .long 207414749 + .long 1066204903 + .long 2718921511 + .long 1065823355 + .long 2393819184 + .long 1065442558 + .long 3228205918 + .long 1064771801 + .long 2754502619 + .long 1063721742 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 4277811695 + .long 1078341186 + .long 4277811695 + .long 3225824834 + .long 1431655765 + .long 1070945621 + .long 1697350398 + .long 1073157447 + .long 1107282704 + .long 3219128321 + .long 354870542 + .long 1071369083 + .type static_const_table,@object + .size static_const_table,2112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log2l.S b/external/sgx_libm/ia32/log2l.S new file mode 100644 index 0000000000..978a410236 --- /dev/null +++ b/external/sgx_libm/ia32/log2l.S @@ -0,0 +1,532 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2l.c" + .text +..TXTST0: +# -- Begin log2l + .text + .align 16,0x90 + .globl log2l +log2l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %edi + andl $128, %edi + shrl $7, %edi + movzwl 16(%ebp), %edx + movl %edx, %eax + movl %edi, %ebx + andl $32767, %eax + shll $15, %ebx + movl 12(%ebp), %esi + orl %eax, %ebx + movl %esi, %ecx + shll $16, %ebx + shrl $16, %ecx + orl %ecx, %ebx + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + cmpl $2147450880, %ebx + jae ..B1.29 +..B1.4: + addl $-1073676224, %ebx + cmpl $32863, %ebx + ja ..B1.13 +..B1.5: + cmpl $16383, %eax + je ..B1.39 +..B1.6: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.7: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.8: + fldcw 12(%esp) +..B1.9: + movl $1, %eax +..B1.10: + fldt 8(%ebp) + testl %eax, %eax + fldl _TWO_32H@GOTOFF(%ecx) + fldt 84+_P@GOTOFF(%ecx) + fldt 60+_P@GOTOFF(%ecx) + fldt 36+_P@GOTOFF(%ecx) + fxch %st(4) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fld %st(1) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(1) + fsub %st(3), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 72+_P@GOTOFF(%ecx) + fmul %st(5), %st + fldt 48+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(5), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt 96+_P@GOTOFF(%ecx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.12 +..B1.11: + fldcw 14(%esp) +..B1.12: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + movzwl 14(%esp), %esi + movl %esi, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.45 +..B1.14: + orl $-64768, %esi + movw %si, 12(%esp) +..B1.15: + fldcw 12(%esp) +..B1.16: + movzwl 16(%ebp), %edx + movl %edx, %eax + movl $1, %esi + andl $32767, %eax +..B1.17: + testl %eax, %eax + jne ..B1.20 +..B1.18: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%ecx) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _zeros@GOTOFF(%ecx) + fxch %st(1) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.19 + je ..B1.42 +..B1.19: + fstp %st(0) + movzwl 16(%ebp), %edx + movl %edx, %eax + movl $-16458, %ebx + andl $32767, %eax + jmp ..B1.21 +..B1.20: + movl $-16383, %ebx +..B1.21: + movl 12(%ebp), %edi + cmpl $-2147483648, %edi + jne ..B1.26 +..B1.22: + cmpl $0, 8(%ebp) + jne ..B1.26 +..B1.23: + addl %eax, %ebx + movl %ebx, 16(%esp) + testl %esi, %esi + fildl 16(%esp) + fstpt (%esp) + je ..B1.25 +..B1.24: + fldcw 14(%esp) +..B1.25: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + fldl _TWO_32H@GOTOFF(%ecx) + andl $-32768, %edx + fldt 84+_P@GOTOFF(%ecx) + orl $-49153, %edx + fldt 60+_P@GOTOFF(%ecx) + addl %eax, %ebx + movw %dx, 16(%ebp) + fldt 8(%ebp) + fld %st(0) + shrl $23, %edi + fadd %st(4), %st + andl $255, %edi + fsubp %st, %st(4) + movl %ebx, 16(%esp) + fsub %st(3), %st + flds __libm_rcp_table_256@GOTOFF(%ecx,%edi,4) + fmul %st, %st(4) + fmulp %st, %st(1) + fxch %st(3) + faddl 8+_ones@GOTOFF(%ecx) + fld %st(0) + shll $4, %edi + fadd %st(4), %st + fld %st(0) + testl %esi, %esi + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_P@GOTOFF(%ecx) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fldt 12+_P@GOTOFF(%ecx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 72+_P@GOTOFF(%ecx) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt _P@GOTOFF(%ecx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 96+_P@GOTOFF(%ecx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(2) + fildl 16(%esp) + fxch %st(1) + faddl 8+__libm_log2l_table_256@GOTOFF(%ecx,%edi) + fxch %st(1) + faddl __libm_log2l_table_256@GOTOFF(%edi,%ecx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.28 +..B1.27: + fldcw 14(%esp) +..B1.28: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.54 +..B1.30: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.31: + fldcw 12(%esp) +..B1.32: + movzbl 17(%ebp), %edi + movl $1, %edx + andl $128, %edi + shrl $7, %edi +..B1.33: + testl %edi, %edi + jne ..B1.46 +..B1.34: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ecx) + fstpt (%esp) +..B1.35: + testl %edx, %edx + je ..B1.37 +..B1.36: + fldcw 14(%esp) +..B1.37: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.38: + xorl %eax, %eax + jmp ..B1.10 +..B1.39: + cmpl $-2147483648, %esi + jne ..B1.6 +..B1.40: + cmpl $0, 8(%ebp) + jne ..B1.6 +..B1.41: + fldl _zeros@GOTOFF(%ecx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.42: + fldl 8+_ones@GOTOFF(%ecx) + testl %esi, %esi + fdivp %st, %st(1) + fstpl (%esp) + je ..B1.44 +..B1.43: + fldcw 14(%esp) +..B1.44: + fldl (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + xorl %esi, %esi + jmp ..B1.17 +..B1.46: + movzwl 16(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.49 +..B1.47: + cmpl $-2147483648, 12(%ebp) + jne ..B1.34 +..B1.48: + cmpl $0, 8(%ebp) + jne ..B1.34 + jmp ..B1.53 +..B1.49: + testl %eax, %eax + jne ..B1.53 +..B1.50: + cmpl $0, 12(%ebp) + jne ..B1.53 +..B1.51: + cmpl $0, 8(%ebp) + jne ..B1.53 +..B1.52: + fldl 8+_ones@GOTOFF(%ecx) + fdivl _zeros@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.35 +..B1.53: + fldl _infs@GOTOFF(%ecx) + fmull _zeros@GOTOFF(%ecx) + fstpt (%esp) + jmp ..B1.35 +..B1.54: + xorl %edx, %edx + jmp ..B1.33 + .align 16,0x90 + .type log2l,@function + .size log2l,.-log2l + .data +# -- End log2l + .section .rodata, "a" + .align 4 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_P: + .word 17354 + .word 24031 + .word 3064 + .word 38062 + .word 16360 + .word 0 + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 49150 + .word 0 + .word 60493 + .word 53279 + .word 20193 + .word 63032 + .word 16381 + .word 0 + .word 62043 + .word 23575 + .word 15145 + .word 47274 + .word 49149 + .word 0 + .word 33329 + .word 29325 + .word 25223 + .word 37819 + .word 16381 + .word 0 + .word 5068 + .word 45194 + .word 20193 + .word 63032 + .word 49148 + .word 0 + .word 43239 + .word 63403 + .word 6517 + .word 54028 + .word 16380 + .word 0 + .word 25259 + .word 45714 + .word 45135 + .word 47274 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 14848 + .word 47274 + .word 16383 + .word 0 + .type _P,@object + .size _P,108 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_log2l_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log2l_table.S b/external/sgx_libm/ia32/log2l_table.S new file mode 100644 index 0000000000..ccfd504219 --- /dev/null +++ b/external/sgx_libm/ia32/log2l_table.S @@ -0,0 +1,560 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2l_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_log2l_table_256 + .globl __libm_log2l_table_256 +__libm_log2l_table_256: + .long 0xa42e4000,0x3f671b0e + .long 0x1dbbd1a5,0x3cefda26 + .long 0x8eaec000,0x3f815cfe + .long 0xac00d0eb,0x3cf06028 + .long 0x0c5d0000,0x3f8cfee7 + .long 0x6dfa58c3,0xbd0a2394 + .long 0x62192000,0x3f94564a + .long 0x88333d4e,0x3d0068bc + .long 0xace34000,0x3f997723 + .long 0xac9ac44a,0x3d1765d0 + .long 0xc69b8000,0x3f9f5923 + .long 0xcfb08e1d,0xbd25afb7 + .long 0xa085c000,0x3fa2a094 + .long 0xa481e15f,0x3d2692b8 + .long 0x1776a000,0x3fa53894 + .long 0x36a2459e,0x3d201dc0 + .long 0x9b914000,0x3fa8324c + .long 0x2b15e585,0x3d178efe + .long 0xce080000,0x3faacf54 + .long 0x8e2d6a53,0xbd340b58 + .long 0x58dac000,0x3fadced9 + .long 0xd3ddb87a,0x3d2c119c + .long 0xfbca8000,0x3fb0387e + .long 0x16f872eb,0x3d1a7682 + .long 0x06748000,0x3fb18ac6 + .long 0xdff59ce4,0xbd18ff0d + .long 0x3e136000,0x3fb30edd + .long 0x15f8f5c1,0xbd29e679 + .long 0x59364000,0x3fb463c1 + .long 0x07b8e917,0x3d193671 + .long 0x3c3f8000,0x3fb5b9e1 + .long 0x4ce80f25,0x3d410e4a + .long 0x3259c000,0x3fb7113f + .long 0x637425fc,0x3d403cdb + .long 0x8d1b0000,0x3fb869dd + .long 0x3dfca47b,0x3d401a71 + .long 0xa49d0000,0x3fb9c3be + .long 0x8c6c8e73,0x3d4909ed + .long 0xd7960000,0x3fbb1ee4 + .long 0xf4540d3e,0x3d370159 + .long 0x8b70c000,0x3fbc7b52 + .long 0x0d939dcf,0x3d48e27d + .long 0x2c678000,0x3fbdd90a + .long 0x04d3d5b4,0xbd312b9c + .long 0x976c4000,0x3fbf05d4 + .long 0xcd9838ba,0xbd3fd7bc + .long 0xbaee8000,0x3fc032fb + .long 0x7d1edf2f,0xbd429af3 + .long 0xa9f32000,0x3fc0e3b5 + .long 0xeeb39e80,0x3d3094fb + .long 0x5c7d2000,0x3fc19519 + .long 0xa7453897,0xbd3b4aad + .long 0xc2ab2000,0x3fc22dad + .long 0xd23af327,0x3d4496d2 + .long 0x231e0000,0x3fc2e050 + .long 0xa377c7ec,0xbd350520 + .long 0x9c2b2000,0x3fc379f7 + .long 0xa3793dbe,0x3d256aea + .long 0x2ba1c000,0x3fc42ddd + .long 0xac74b87f,0xbd36ad5b + .long 0x9e680000,0x3fc4c89b + .long 0x02de76ad,0x3d2fd2e8 + .long 0x29ffc000,0x3fc563dc + .long 0x78df21ad,0xbd434df3 + .long 0x5f5d8000,0x3fc619a2 + .long 0xaf108e66,0xbd29cc54 + .long 0xbf368000,0x3fc6b5ff + .long 0x175a06f6,0xbd337788 + .long 0xf6610000,0x3fc752e1 + .long 0x902c7d37,0xbd2ca90f + .long 0xe7540000,0x3fc7f049 + .long 0xec326af7,0xbd483153 + .long 0x0abfc000,0x3fc8a898 + .long 0xab240e90,0xbd166ccc + .long 0xcca64000,0x3fc94724 + .long 0x82d7bfe5,0x3d47be4d + .long 0x24970000,0x3fc9e63a + .long 0xca6bec19,0x3d4f45ea + .long 0xfeb20000,0x3fca85d8 + .long 0xd08dc20f,0x3d17b6aa + .long 0x497d8000,0x3fcb2602 + .long 0x90cb67ba,0xbd565d39 + .long 0xf5ee4000,0x3fcbc6b6 + .long 0xcabaa043,0xbd51b254 + .long 0xf770c000,0x3fcc67f7 + .long 0xab00c050,0xbd49821f + .long 0xb2234000,0x3fcceec4 + .long 0xdad67ab8,0x3d3f73bc + .long 0x7ad10000,0x3fcd9109 + .long 0x370c6558,0x3d5cc12e + .long 0x57f3c000,0x3fce33dd + .long 0x4a928ccd,0x3d433481 + .long 0x46bc8000,0x3fced741 + .long 0x984a7cdc,0xbd23bfd7 + .long 0x46ff0000,0x3fcf7b36 + .long 0x48e15c73,0xbd32f9b5 + .long 0xa943e000,0x3fd00223 + .long 0x00388584,0xbd2f3862 + .long 0x74bf0000,0x3fd054a4 + .long 0xf7113597,0x3d4d6efe + .long 0x9b926000,0x3fd0999d + .long 0xa7e48c00,0xbd397bf5 + .long 0x6d3b4000,0x3fd0eca6 + .long 0xcb31a070,0xbd5a7f50 + .long 0x2e85c000,0x3fd13ffa + .long 0xc54ae907,0xbd471577 + .long 0x44fa0000,0x3fd185a4 + .long 0x6fa317ed,0x3d44f66d + .long 0x12f28000,0x3fd1cb83 + .long 0xce4e50d0,0xbd1010cf + .long 0x441ce000,0x3fd21fa1 + .long 0xf89df349,0x3d379e4a + .long 0x26e60000,0x3fd265f5 + .long 0x84a6a593,0x3d2e59ad + .long 0xc34be000,0x3fd2baa0 + .long 0xcd51a1bf,0x3d1ebefe + .long 0x45de2000,0x3fd3016b + .long 0xec0723df,0x3d1ce045 + .long 0x38aa2000,0x3fd3486c + .long 0xaa5dfd69,0x3d434f09 + .long 0xefaa8000,0x3fd38fa3 + .long 0x91962d0f,0x3d2313fc + .long 0xc0816000,0x3fd3e562 + .long 0xfa64765f,0x3d440340 + .long 0x1f53c000,0x3fd42d14 + .long 0x167aead5,0xbd4374da + .long 0x543f2000,0x3fd474fd + .long 0x400ce06e,0x3d216293 + .long 0xb6810000,0x3fd4bd1e + .long 0x8d05e4fa,0xbd5ab857 + .long 0x9e236000,0x3fd50578 + .long 0xbbaffd12,0xbd542eea + .long 0x64004000,0x3fd54e0b + .long 0x92de8d74,0xbd323e74 + .long 0x61c40000,0x3fd596d7 + .long 0xb5eabc35,0xbd6f07ff + .long 0xf1eec000,0x3fd5dfdc + .long 0xd2926f16,0xbd51f1bb + .long 0x6fd94000,0x3fd6291c + .long 0xdc0e627c,0xbd4ac899 + .long 0x37b58000,0x3fd67296 + .long 0xd82f9efc,0x3d541782 + .long 0xa6930000,0x3fd6bc4a + .long 0x46b4eaee,0xbd5f036d + .long 0x1a5fc000,0x3fd7063a + .long 0x0e43a37f,0xbd461b8d + .long 0xf1ed0000,0x3fd75064 + .long 0xec06848a,0x3d3c558f + .long 0x8cf10000,0x3fd79acb + .long 0x9ea019ad,0x3d2c7d46 + .long 0x1e438000,0x3fd7d67c + .long 0x2119c4e9,0x3d672dc9 + .long 0x4068c000,0x3fd8214f + .long 0x8322d649,0xbd505944 + .long 0x36dec000,0x3fd86c5f + .long 0x982b6522,0xbd5c2445 + .long 0x64dd8000,0x3fd8b7ac + .long 0x3c24b943,0xbcf8cd4c + .long 0x7a0c8000,0x3fd8f416 + .long 0x1882631a,0xbd506e0d + .long 0xd5e1c000,0x3fd93fd2 + .long 0x37daf317,0xbd0c6d2c + .long 0x84298000,0x3fd98bcd + .long 0x1c4482c6,0xbd56ba65 + .long 0x33e70000,0x3fd9c8c3 + .long 0x2b947c14,0xbd565ac6 + .long 0x14298000,0x3fda152f + .long 0x0e65d2ce,0x3d1b3d7b + .long 0xd95fc000,0x3fda527f + .long 0xad63ae87,0x3d58ff36 + .long 0x3edec000,0x3fda9f5e + .long 0x112e6c5e,0xbd38668d + .long 0x2b574000,0x3fdadd0b + .long 0x1a609aaa,0x3d55a69a + .long 0x6f520000,0x3fdb2a5d + .long 0xfdf426cf,0xbcff5369 + .long 0x99b00000,0x3fdb6867 + .long 0x84b3fb1a,0x3d47c5c7 + .long 0x1b888000,0x3fdbb62f + .long 0xef0b8928,0xbd29427b + .long 0x9f664000,0x3fdbf497 + .long 0x3da6863a,0x3d63342a + .long 0x6e83c000,0x3fdc332a + .long 0xb6303c0d,0xbd6315fe + .long 0xc2d44000,0x3fdc819d + .long 0x95d8ac46,0x3d5fe438 + .long 0x8e19c000,0x3fdcc090 + .long 0x870d5301,0xbd4085c5 + .long 0x611b0000,0x3fdcffae + .long 0xb8e97d14,0xbd676a4e + .long 0x76d44000,0x3fdd3ef7 + .long 0x378ff59d,0xbcc81e2b + .long 0x02710000,0x3fdd8e50 + .long 0x99a48379,0x3d128679 + .long 0x486cc000,0x3fddcdfb + .long 0x57e20e48,0xbd397d70 + .long 0x94244000,0x3fde0dd2 + .long 0x4e05d479,0x3d5fe3e2 + .long 0x22a28000,0x3fde4dd6 + .long 0x3522eadc,0x3d407f39 + .long 0x31710000,0x3fde8e06 + .long 0xd1f94399,0x3d54efc5 + .long 0xfe9ac000,0x3fdece62 + .long 0x793f3b67,0xbd63755a + .long 0x4a154000,0x3fdf1f16 + .long 0x1e0f6657,0xbd3d990d + .long 0xa9064000,0x3fdf5fd8 + .long 0x0109b0f1,0xbd1cb6f7 + .long 0x937e8000,0x3fdfa0c8 + .long 0xcacac36e,0xbd2515e1 + .long 0x49bb8000,0x3fdfe1e6 + .long 0x293a746b,0xbd5cca93 + .long 0x06416000,0x3fe01199 + .long 0xd8721fec,0xbd594c3a + .long 0x0e91e000,0x3fe03256 + .long 0x3e307cbb,0x3d467783 + .long 0x5ebce000,0x3fe0532a + .long 0xa9a9f37a,0xbd576c46 + .long 0x17f60000,0x3fe07416 + .long 0xbbaf9ab0,0xbd3ebdb1 + .long 0x53f38000,0x3fe08cd6 + .long 0x7d0732d6,0x3d5072ba + .long 0x55c12000,0x3fe0adeb + .long 0x502d528c,0xbd5f89ea + .long 0x1d5d2000,0x3fe0cf18 + .long 0x656576a5,0xbd317e70 + .long 0xcd0ac000,0x3fe0f05c + .long 0xc4d028f0,0x3d5dae75 + .long 0x87578000,0x3fe111b9 + .long 0xfb8eb2af,0x3d51553a + .long 0x6f1bc000,0x3fe1332e + .long 0x1e351573,0x3d5ee62e + .long 0xa77c2000,0x3fe154bb + .long 0x96dcbe61,0x3d1109e5 + .long 0x9bfa2000,0x3fe16df5 + .long 0x0adf6a55,0xbd693ea9 + .long 0xb6e2c000,0x3fe18fad + .long 0x517ae88c,0x3d63c19b + .long 0x849ae000,0x3fe1b17e + .long 0xff1e8ea2,0xbd3ecf4d + .long 0x6a0de000,0x3fe1caeb + .long 0x854dfeca,0x3d5027e9 + .long 0xc8310000,0x3fe1ece7 + .long 0x7a9fc25e,0xbd6136da + .long 0x3dae0000,0x3fe20efd + .long 0xa02e61be,0x3d2df373 + .long 0xe375e000,0x3fe2289d + .long 0xc27a8169,0xbd4bfa6f + .long 0x9b6a8000,0x3fe24adf + .long 0x14538362,0xbd601f94 + .long 0xd1aea000,0x3fe26d3a + .long 0xb5d13c0f,0x3d6cfc3a + .long 0x0c276000,0x3fe28710 + .long 0xcec1b4ea,0x3d61f3e3 + .long 0x3b3c0000,0x3fe2a998 + .long 0xcb3fff52,0x3d6b2840 + .long 0x5c842000,0x3fe2c38f + .long 0xdfa568f7,0x3d10bad7 + .long 0xfac06000,0x3fe2e644 + .long 0xbe206bcc,0xbd60284e + .long 0x5c482000,0x3fe3005e + .long 0x50757c6c,0x3d4411d0 + .long 0xe1d88000,0x3fe32341 + .long 0x4bed16a8,0x3d5370c2 + .long 0xde748000,0x3fe33d7d + .long 0x4a603b86,0xbd57fbb4 + .long 0xc5650000,0x3fe3608f + .long 0x14f8ca8f,0x3d3a63aa + .long 0xb9548000,0x3fe37aee + .long 0xc4484d2e,0xbd52b278 + .long 0x7d9a8000,0x3fe39e2f + .long 0xf9f603ee,0xbd627a85 + .long 0xc68fa000,0x3fe3b8b1 + .long 0x9336b66e,0x3d4bb4b6 + .long 0xe613e000,0x3fe3dc21 + .long 0xe04a7773,0xbd60c6e3 + .long 0xe33ba000,0x3fe3f6c7 + .long 0xfc271317,0x3d325d25 + .long 0x4b1fe000,0x3fe4117d + .long 0xf19c5879,0xbd47fe42 + .long 0xefeec000,0x3fe43531 + .long 0x74b82e7e,0xbd52f11d + .long 0x969d0000,0x3fe4500b + .long 0xbb075298,0x3d65b869 + .long 0xe41a2000,0x3fe46af4 + .long 0x4d994a2a,0xbd182943 + .long 0x19316000,0x3fe48eef + .long 0x3956fa5e,0x3d6990d4 + .long 0x333d4000,0x3fe4a9fd + .long 0xe1bd6277,0x3d67e24a + .long 0x318c0000,0x3fe4c51b + .long 0x2a8a4d7a,0xbd5f91de + .long 0x26d38000,0x3fe4e049 + .long 0xdd409e96,0xbd320665 + .long 0x63f64000,0x3fe5049f + .long 0x7b11231a,0x3d5b76a8 + .long 0xe3022000,0x3fe51ff2 + .long 0xa00b120a,0xbd56879f + .long 0x98572000,0x3fe53b56 + .long 0xfa5c51d1,0x3d673642 + .long 0x973dc000,0x3fe556ca + .long 0x459db47f,0xbd53cd8a + .long 0xf3200000,0x3fe5724e + .long 0x9385d649,0x3d591597 + .long 0x03a5c000,0x3fe59719 + .long 0x449e2590,0xbd31bb71 + .long 0xda198000,0x3fe5b2c3 + .long 0x492bf6ff,0xbd5b8afe + .long 0x4f3e4000,0x3fe5ce7f + .long 0x4f9a9e0c,0x3d76ae3f + .long 0x77184000,0x3fe5ea4b + .long 0x06727b86,0x3d65cd66 + .long 0x65cf0000,0x3fe60628 + .long 0x2f6664db,0x3d5e3c54 + .long 0x2faf4000,0x3fe62216 + .long 0x60c37437,0xbd773ea5 + .long 0xe929c000,0x3fe63e14 + .long 0xcd9d28e6,0x3d346549 + .long 0xa6d5c000,0x3fe65a24 + .long 0xc074b84d,0x3d5de792 + .long 0x7d6f8000,0x3fe67645 + .long 0x3180227e,0x3d45bfa4 + .long 0x81d94000,0x3fe69277 + .long 0x137a3d8c,0xbd5aaf6f + .long 0xc91b8000,0x3fe6aeba + .long 0x459f4910,0xbd2c3a4f + .long 0x6865c000,0x3fe6cb0f + .long 0xdb502403,0x3d51d406 + .long 0x750e8000,0x3fe6e775 + .long 0x54ae8096,0x3d57aac5 + .long 0x0493c000,0x3fe703ed + .long 0xd0d1a7f0,0xbd4c2657 + .long 0x2c9b0000,0x3fe72076 + .long 0xf1ec6bfa,0x3d6cb070 + .long 0x02f2c000,0x3fe73d11 + .long 0x28f88499,0x3d130454 + .long 0x9d914000,0x3fe759bd + .long 0x84b0b58b,0x3d5ed855 + .long 0x12968000,0x3fe7767c + .long 0x12e0b4f3,0xbd46eb96 + .long 0x784b4000,0x3fe7934c + .long 0x9cb23d17,0x3d6f0113 + .long 0xe522c000,0x3fe7b02e + .long 0xa5258bb7,0x3d77f7ed + .long 0x92280000,0x3fe7c37a + .long 0x818d34cf,0xbd6804b7 + .long 0x3d39c000,0x3fe7e07b + .long 0xf457de07,0x3d650290 + .long 0x2c1b4000,0x3fe7fd8e + .long 0xb343a140,0x3d2a15a5 + .long 0x75dc0000,0x3fe81ab3 + .long 0x2ec63274,0x3d584b7a + .long 0x31b7c000,0x3fe837eb + .long 0x22b56634,0x3d6c362e + .long 0x7716c000,0x3fe85535 + .long 0xa24036e1,0xbd7707b5 + .long 0xa808c000,0x3fe868c6 + .long 0xdc0e40d3,0xbd5bd2ae + .long 0x0713c000,0x3fe88630 + .long 0x6f909cf3,0xbd6203b8 + .long 0x2ee78000,0x3fe8a3ac + .long 0xbd315db9,0xbd5c935d + .long 0x3791c000,0x3fe8c13b + .long 0x11e2bd73,0x3d5dffed + .long 0x70e24000,0x3fe8d4fa + .long 0x8994b162,0xbd3b912d + .long 0x2639c000,0x3fe8f2a9 + .long 0x1cc06b22,0xbd677406 + .long 0xfd704000,0x3fe9106a + .long 0x6f31880a,0xbd1b76a4 + .long 0x3a284000,0x3fe9244c + .long 0x7db199c6,0xbd72bd2d + .long 0x2b878000,0x3fe9422e + .long 0x1eceebf4,0x3d607320 + .long 0x81210000,0x3fe96023 + .long 0x2956f019,0x3d6518a1 + .long 0x3737c000,0x3fe97427 + .long 0x71deb637,0x3d61e54d + .long 0x16b18000,0x3fe9923d + .long 0xebd2e82c,0x3d5028ed + .long 0x9e1bc000,0x3fe9b066 + .long 0xc89c6f2d,0xbd210f7a + .long 0x45f2c000,0x3fe9c48d + .long 0xe6a10cca,0xbd55b5da + .long 0xc93fc000,0x3fe9e2d7 + .long 0x6045b96c,0xbd74e31c + .long 0x39988000,0x3fea0136 + .long 0xd9459b34,0x3d3d25cf + .long 0x4e0bc000,0x3fea1580 + .long 0xd0364be2,0x3d744421 + .long 0x2ea54000,0x3fea3400 + .long 0x3388b97b,0x3d5c79a4 + .long 0xa67f8000,0x3fea4860 + .long 0xa2e241fc,0xbd5eddce + .long 0x414dc000,0x3fea6702 + .long 0xcc538261,0xbd43167c + .long 0x4e2e0000,0x3fea7b79 + .long 0xf16ff990,0xbd43cf0f + .long 0xee1c0000,0x3fea9a3c + .long 0xe3084679,0x3cf6c31d + .long 0x1be18000,0x3feab915 + .long 0x2c022617,0xbd672292 + .long 0xb33ac000,0x3feacdb0 + .long 0xb1410c94,0xbd4b23e5 + .long 0x60094000,0x3feaecab + .long 0x0ae3394c,0x3d50556b + .long 0x107c4000,0x3feb015e + .long 0xed2b2eb2,0xbd5d0db1 + .long 0x0cb28000,0x3feb161a + .long 0xd90df0b9,0x3d5353b3 + .long 0x8761c000,0x3feb3545 + .long 0x2b834fe3,0x3d647978 + .long 0xe5b20000,0x3feb4a18 + .long 0x2a855a1a,0x3d402327 + .long 0x9b240000,0x3feb6967 + .long 0x3726f484,0xbd7b3b86 + .long 0x90874000,0x3feb7e52 + .long 0x09b9625e,0x3d2d2152 + .long 0xd0b8c000,0x3feb9dc4 + .long 0x29c44115,0xbd46be4a + .long 0x92ddc000,0x3febb2c7 + .long 0xd690403e,0xbd28b7fc + .long 0xaeddc000,0x3febd25d + .long 0xb0f92e32,0x3d46a10e + .long 0x742ac000,0x3febe778 + .long 0x7ecf463f,0xbd6ad6fb + .long 0xe3b98000,0x3febfc9c + .long 0x1185e784,0xbd42cbe5 + .long 0xbdb50000,0x3fec1c65 + .long 0x6951096d,0x3d3e742a + .long 0x7dd04000,0x3fec31a2 + .long 0xcbdb5d9e,0xbd7a5b21 + .long 0x076cc000,0x3fec46e9 + .long 0x86f88587,0xbd3ddb78 + .long 0x43730000,0x3fec66e5 + .long 0xbaa5a734,0x3d523bf0 + .long 0x6c790000,0x3fec7c44 + .long 0xf67dd7ae,0xbd7c7a0d + .long 0x7ed84000,0x3fec91ad + .long 0x6188e18f,0x3d722f0b + .long 0xc4194000,0x3fecb1dd + .long 0x4bba7e1c,0x3d77b6c1 + .long 0xc6410000,0x3fecc75f + .long 0xb0c280a9,0x3d64f1b9 + .long 0xd2374000,0x3fecdceb + .long 0x391924a7,0xbd49ad57 + .long 0xcb184000,0x3fecfd50 + .long 0x6ab58d83,0xbd6078ca + .long 0x18c18000,0x3fed12f6 + .long 0xeb119dc6,0xbd6fe599 + .long 0x914e4000,0x3fed28a5 + .long 0x26c0de13,0xbd6fb0e6 + .long 0x3e504000,0x3fed3e5f + .long 0x9ace87f7,0xbd506b11 + .long 0xf93fc000,0x3fed5f08 + .long 0x4f2d37b7,0xbd73bb6d + .long 0x539dc000,0x3fed74dc + .long 0xb806844c,0x3d727a5f + .long 0x045b0000,0x3fed8aba + .long 0xf65ddbc9,0x3d2c7a4f + .long 0x15464000,0x3feda0a2 + .long 0x0af75927,0x3d74c8da + .long 0xb896c000,0x3fedc191 + .long 0x5363737e,0xbd6cdb50 + .long 0xe53dc000,0x3fedd793 + .long 0xa1dc7b13,0xbd76ffa3 + .long 0x94d7c000,0x3fededa0 + .long 0x1919aabd,0x3d6747e2 + .long 0xd174c000,0x3fee03b7 + .long 0x2f683f98,0xbd514fc4 + .long 0xa531c000,0x3fee19d9 + .long 0x3a87769f,0x3d7728dc + .long 0x1a3c0000,0x3fee3006 + .long 0x768a06ef,0xbd7a0e7d + .long 0xce9f8000,0x3fee515c + .long 0x518e12cc,0xbd65f71b + .long 0x03cb4000,0x3fee67a4 + .long 0xfaf8e258,0x3d75735c + .long 0xfe538000,0x3fee7df5 + .long 0xf6a2b592,0x3d55669d + .long 0xc8a70000,0x3fee9452 + .long 0xec9f90f7,0x3d60278c + .long 0x6d444000,0x3feeaaba + .long 0x2268e3e2,0x3d799543 + .long 0xf6b98000,0x3feec12c + .long 0x09d2dc10,0xbd468988 + .long 0x6fa38000,0x3feed7aa + .long 0x51433cdb,0xbd7387ac + .long 0xe2aec000,0x3feeee32 + .long 0x4fd75f61,0x3d597da2 + .long 0x3bbf4000,0x3fef1014 + .long 0x68ea48c7,0x3d71983c + .long 0x4f39c000,0x3fef26b8 + .long 0x4efa434d,0xbd72177b + .long 0x82ae0000,0x3fef3d67 + .long 0xf9197819,0x3d6fbc2b + .long 0xe1110000,0x3fef5421 + .long 0xa92b420d,0x3d69402d + .long 0x75670000,0x3fef6ae7 + .long 0x00c52b20,0xbd67cf2e + .long 0x4ac44000,0x3fef81b8 + .long 0x10fed627,0x3d2f2407 + .long 0x6c4e4000,0x3fef9894 + .long 0xd2088b22,0x3d61d346 + .long 0xe53ac000,0x3fefaf7b + .long 0xf5920222,0x3d69b7dc + .long 0xc0d04000,0x3fefc66e + .long 0xdbf33c61,0x3d6314d8 + .long 0x0a660000,0x3fefdd6d + .long 0x088b0624,0x3d603dc6 + .long 0xcd644000,0x3feff476 + .long 0xf02b035e,0x3d6e05d5 + .type __libm_log2l_table_256,@object + .size __libm_log2l_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log_table.S b/external/sgx_libm/ia32/log_table.S new file mode 100644 index 0000000000..8f16b4ac78 --- /dev/null +++ b/external/sgx_libm/ia32/log_table.S @@ -0,0 +1,560 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_log_table_256 + .globl __libm_log_table_256 +__libm_log_table_256: + .long 0x2779c19c,0x3e057562 + .long 0x00000000,0x3f600401 + .long 0x540e0a5d,0x3df4586b + .long 0x00000000,0x3f781212 + .long 0x5df1d574,0x3e3f2d06 + .long 0x00000000,0x3f841929 + .long 0xe0cc0310,0x3e3098eb + .long 0x00000000,0x3f8c3173 + .long 0x861d36aa,0x3e1ac733 + .long 0x00000000,0x3f91a6b9 + .long 0x0e5dc270,0x3e3766b0 + .long 0x00000000,0x3f95ba9a + .long 0xcf80538b,0x3dfd0c97 + .long 0x00000000,0x3f99d2a8 + .long 0x01095e5d,0x3e22cbcc + .long 0x00000000,0x3f9d6b27 + .long 0x5531753a,0x3e5433bf + .long 0x00000000,0x3fa0c58f + .long 0x86a4cae2,0x3e4e32f3 + .long 0x00000000,0x3fa2954c + .long 0x2b382296,0x3e36d4b6 + .long 0x00000000,0x3fa4a94d + .long 0x6b08209f,0x3e5e5a97 + .long 0x00000000,0x3fa67c94 + .long 0x0d02a20b,0x3e56c61e + .long 0x00000000,0x3fa85188 + .long 0xe988d46e,0x3e57ce75 + .long 0x00000000,0x3faa6b8a + .long 0x78fa4c28,0x3e0bdcaa + .long 0x00000000,0x3fac441e + .long 0x069e5bd9,0x3e23606d + .long 0x00000000,0x3fae1e67 + .long 0x008c9838,0x3e21ab93 + .long 0x00000000,0x3faffa69 + .long 0xc0123f2a,0x3e638bb4 + .long 0x00000000,0x3fb0ec13 + .long 0x42c9365e,0x3e590f46 + .long 0x00000000,0x3fb1dbd2 + .long 0xe38bd0cb,0x3e609fcb + .long 0x00000000,0x3fb2cc72 + .long 0xcc85ea5e,0x3e64fa3d + .long 0x00000000,0x3fb3bdf5 + .long 0xb814e378,0x3e5ea804 + .long 0x00000000,0x3fb4b05d + .long 0xc07f6cbe,0x3e5f3ad5 + .long 0x00000000,0x3fb580db + .long 0x4f332994,0x3e6126cb + .long 0x00000000,0x3fb674f0 + .long 0x46bb18e7,0x3e4635ab + .long 0x00000000,0x3fb769ef + .long 0x23f3f334,0x3e43a835 + .long 0x00000000,0x3fb85fd9 + .long 0x622b8758,0x3e575652 + .long 0x00000000,0x3fb9335e + .long 0xfa6531cd,0x3e406472 + .long 0x00000000,0x3fba2b02 + .long 0xd57cb81c,0x3e658350 + .long 0x00000000,0x3fbb0004 + .long 0x843191b0,0x3e5da7f2 + .long 0x00000000,0x3fbbf968 + .long 0x750465fd,0x3e67fdc2 + .long 0x00000000,0x3fbccfed + .long 0xa89401fa,0x3e58e111 + .long 0x00000000,0x3fbda727 + .long 0xde61a8fd,0x3e5ff843 + .long 0x00000000,0x3fbea325 + .long 0xbcbe8b53,0x3e6fdb7f + .long 0x00000000,0x3fbf7be9 + .long 0x7ce635d5,0x3e64bfc9 + .long 0x00000000,0x3fc02ab3 + .long 0x133742da,0x3e65e748 + .long 0x00000000,0x3fc097ce + .long 0x8f7bc671,0x3e7044fc + .long 0x00000000,0x3fc1178e + .long 0xcce888b8,0x3e6f6fb3 + .long 0x00000000,0x3fc18574 + .long 0xa08b164f,0x3e52f92e + .long 0x00000000,0x3fc1f3b9 + .long 0x56b4e87b,0x3e4e6ddf + .long 0x00000000,0x3fc2625d + .long 0x73ad9970,0x3e390d02 + .long 0x00000000,0x3fc2d161 + .long 0x85c23082,0x3e72e822 + .long 0x00000000,0x3fc340c5 + .long 0xaa42e1ae,0x3e69d5fc + .long 0x00000000,0x3fc3b08b + .long 0x06ed14f1,0x3e306f00 + .long 0x00000000,0x3fc40dfb + .long 0xef836a49,0x3e7d194b + .long 0x00000000,0x3fc47e74 + .long 0xbc83d21d,0x3e7ec8cd + .long 0x00000000,0x3fc4ef51 + .long 0xa2c28034,0x3e7c0574 + .long 0x00000000,0x3fc56092 + .long 0x3530a5ba,0x3e65f35d + .long 0x00000000,0x3fc5d238 + .long 0xbb20ab0e,0x3e5b99ae + .long 0x00000000,0x3fc6313a + .long 0x706cb199,0x3e7b577a + .long 0x00000000,0x3fc6a399 + .long 0x8350bc53,0x3e7ba79c + .long 0x00000000,0x3fc70337 + .long 0x274badf2,0x3e428f61 + .long 0x00000000,0x3fc77654 + .long 0x16849fa4,0x3e550581 + .long 0x00000000,0x3fc7e9d8 + .long 0x4baffaa4,0x3e6d67d4 + .long 0x00000000,0x3fc84a6b + .long 0x61fae141,0x3e7abeb4 + .long 0x00000000,0x3fc8ab47 + .long 0x0369cf31,0x3e7212cb + .long 0x00000000,0x3fc91fe4 + .long 0x9d5bb3d2,0x3e60046a + .long 0x00000000,0x3fc98163 + .long 0x904d6866,0x3e2c2259 + .long 0x00000000,0x3fc9f6c4 + .long 0xa19f5411,0x3e549a47 + .long 0x00000000,0x3fca58e7 + .long 0x759a5351,0x3e7862d2 + .long 0x00000000,0x3fcabb55 + .long 0xf400c4b3,0x3e62467b + .long 0x00000000,0x3fcb1e10 + .long 0xf9503717,0x3e727c6c + .long 0x00000000,0x3fcb94ee + .long 0xabdf1b3f,0x3e780cea + .long 0x00000000,0x3fcbf851 + .long 0xe97aab9f,0x3e652fc8 + .long 0x00000000,0x3fcc5c02 + .long 0x8a4a9e8b,0x3e793b67 + .long 0x00000000,0x3fccc000 + .long 0xce7d8064,0x3e73390a + .long 0x00000000,0x3fcd244d + .long 0x2835ff73,0x3e5fd97a + .long 0x00000000,0x3fcd88e9 + .long 0x804954d6,0x3e5bf577 + .long 0x00000000,0x3fcdedd4 + .long 0x024244ec,0x3e7ffce2 + .long 0x00000000,0x3fce530e + .long 0x7137ba40,0x3e4648b9 + .long 0x00000000,0x3fceb89a + .long 0x7bcea6d1,0x3e7f5bf3 + .long 0x00000000,0x3fcf1e75 + .long 0x1abc74cf,0x3e5756be + .long 0x00000000,0x3fcf84a3 + .long 0xe6831bc0,0x3e59f503 + .long 0x00000000,0x3fcfeb22 + .long 0x83851858,0x3e88e06b + .long 0x00000000,0x3fd028f9 + .long 0x6b43c71e,0x3e8c1b2c + .long 0x00000000,0x3fd05c8b + .long 0xf2ea89fa,0x3e81f15c + .long 0x00000000,0x3fd085eb + .long 0x2224e892,0x3e8c65a3 + .long 0x00000000,0x3fd0b9c8 + .long 0x20336a5b,0x3e782de0 + .long 0x00000000,0x3fd0edd0 + .long 0x8fdd9770,0x3e733c01 + .long 0x00000000,0x3fd12202 + .long 0x9a817c85,0x3e824f5d + .long 0x00000000,0x3fd14be2 + .long 0x5be801bd,0x3e81de31 + .long 0x00000000,0x3fd18061 + .long 0xc766b993,0x3e87c5f8 + .long 0x00000000,0x3fd1b50b + .long 0x85a1f823,0x3e88f9e4 + .long 0x00000000,0x3fd1df4c + .long 0x350fbd75,0x3e7b43ae + .long 0x00000000,0x3fd21445 + .long 0x4920ddbb,0x3e8323d7 + .long 0x00000000,0x3fd23ec5 + .long 0x5f6600ba,0x3e83f0e1 + .long 0x00000000,0x3fd2740d + .long 0x4073b3be,0x3e8579bf + .long 0x00000000,0x3fd29ecd + .long 0x72f2232b,0x3e256e67 + .long 0x00000000,0x3fd2d466 + .long 0x3a896d5f,0x3e8609d5 + .long 0x00000000,0x3fd2ff66 + .long 0x8ddf913a,0x3e72cd56 + .long 0x00000000,0x3fd33550 + .long 0xd7253e69,0x3e77b113 + .long 0x00000000,0x3fd36092 + .long 0xce9e941f,0x3e88666f + .long 0x00000000,0x3fd38bf1 + .long 0x60ed52d8,0x3e7dcccc + .long 0x00000000,0x3fd3c252 + .long 0x0f983d68,0x3e78f05a + .long 0x00000000,0x3fd3edf4 + .long 0x6390dbb2,0x3e61eaf4 + .long 0x00000000,0x3fd419b4 + .long 0xe916a76d,0x3e8c0a73 + .long 0x00000000,0x3fd44591 + .long 0x2b59a2e0,0x3e7d6dbc + .long 0x00000000,0x3fd47c91 + .long 0xc24fc7a2,0x3e70554a + .long 0x00000000,0x3fd4a8b3 + .long 0x33faf275,0x3e821120 + .long 0x00000000,0x3fd4d4f3 + .long 0x2cfac6d3,0x3e81b43f + .long 0x00000000,0x3fd50152 + .long 0x3d98a28d,0x3e78d1f5 + .long 0x00000000,0x3fd52dd0 + .long 0x44e3b5b4,0x3e6e3dc5 + .long 0x00000000,0x3fd55a6d + .long 0x2c814b0b,0x3e658895 + .long 0x00000000,0x3fd5925d + .long 0x6c7ee0a5,0x3e7ad50f + .long 0x00000000,0x3fd5bf40 + .long 0xd6e34245,0x3e6eae1a + .long 0x00000000,0x3fd5ec43 + .long 0x83dd4a7f,0x3e89b605 + .long 0x00000000,0x3fd61965 + .long 0xa87b925b,0x3e724d6c + .long 0x00000000,0x3fd646a8 + .long 0xd28ed1d3,0x3e8ba63b + .long 0x00000000,0x3fd6740a + .long 0x18a4a613,0x3e86e94b + .long 0x00000000,0x3fd6a18d + .long 0xb0b244a7,0x3e3619c3 + .long 0x00000000,0x3fd6cf31 + .long 0x173b6f5e,0x3e8d0a5e + .long 0x00000000,0x3fd6f180 + .long 0x3be91c4c,0x3e7c6e25 + .long 0x00000000,0x3fd71f5d + .long 0xab8359ed,0x3e8dfacd + .long 0x00000000,0x3fd74d5a + .long 0x6fb93ec4,0x3e82457a + .long 0x00000000,0x3fd77b79 + .long 0x3c4bbc8b,0x3e8113e3 + .long 0x00000000,0x3fd7a9b9 + .long 0x31fa7741,0x3e2bf5b5 + .long 0x00000000,0x3fd7d81b + .long 0x186f4789,0x3e69c139 + .long 0x00000000,0x3fd8069e + .long 0x7956aae8,0x3e8a7df1 + .long 0x00000000,0x3fd82996 + .long 0xfeab799a,0x3e7ddb72 + .long 0x00000000,0x3fd85855 + .long 0x33b8ef04,0x3e760c9f + .long 0x00000000,0x3fd88736 + .long 0x19dccb10,0x3e82e757 + .long 0x00000000,0x3fd8aa75 + .long 0x9c910289,0x3e8b9104 + .long 0x00000000,0x3fd8d992 + .long 0xa230be1d,0x3e8d4fb2 + .long 0x00000000,0x3fd908d2 + .long 0xcac1703a,0x3e8cf381 + .long 0x00000000,0x3fd92c59 + .long 0xb4a553e7,0x3e743b8f + .long 0x00000000,0x3fd95bd7 + .long 0x5b5274b7,0x3e51a3ee + .long 0x00000000,0x3fd98b78 + .long 0x0d70a52d,0x3e8e67a8 + .long 0x00000000,0x3fd9af47 + .long 0x4f0d2c7f,0x3e483229 + .long 0x00000000,0x3fd9df27 + .long 0xb48f7d3d,0x3e8da29f + .long 0x00000000,0x3fda0325 + .long 0xc6457f9d,0x3e2127d3 + .long 0x00000000,0x3fda3344 + .long 0xe0b95e88,0x3e77a030 + .long 0x00000000,0x3fda5772 + .long 0x991f7846,0x3e565dd1 + .long 0x00000000,0x3fda87d0 + .long 0x256f237b,0x3e7b00fe + .long 0x00000000,0x3fdaac2e + .long 0xa0437713,0x3e7bf7da + .long 0x00000000,0x3fdadccc + .long 0xc8192dd8,0x3e6f58f3 + .long 0x00000000,0x3fdb015b + .long 0xa41f8565,0x3e6d31ac + .long 0x00000000,0x3fdb323a + .long 0x25494b61,0x3e3118a4 + .long 0x00000000,0x3fdb56fa + .long 0x92694e9d,0x3e84cb37 + .long 0x00000000,0x3fdb881a + .long 0x2c99792a,0x3e8de7b6 + .long 0x00000000,0x3fdbad0b + .long 0x85ec7449,0x3e82ef03 + .long 0x00000000,0x3fdbd212 + .long 0x0c4250d7,0x3e6b7844 + .long 0x00000000,0x3fdc0392 + .long 0xfce511d5,0x3e5e4d32 + .long 0x00000000,0x3fdc28cb + .long 0x78348ca5,0x3e8708e4 + .long 0x00000000,0x3fdc4e19 + .long 0x992488fb,0x3e88e8aa + .long 0x00000000,0x3fdc7ff9 + .long 0xc144344b,0x3e793a76 + .long 0x00000000,0x3fdca57b + .long 0x5f7d6efe,0x3e44b9d7 + .long 0x00000000,0x3fdccb13 + .long 0x4de9f3e0,0x3e8a31e6 + .long 0x00000000,0x3fdcf0c0 + .long 0x80488966,0x3e7d6d68 + .long 0x00000000,0x3fdd2320 + .long 0x9add7f4d,0x3e71b7be + .long 0x00000000,0x3fdd4902 + .long 0xb9ac5131,0x3e8231a4 + .long 0x00000000,0x3fdd6efa + .long 0x4bdc3bac,0x3e7c1eb9 + .long 0x00000000,0x3fdd9509 + .long 0xaa85604a,0x3e8fd258 + .long 0x00000000,0x3fddbb2e + .long 0x57753a10,0x3e6a22f2 + .long 0x00000000,0x3fddee2f + .long 0xcd94df8d,0x3e5a2726 + .long 0x00000000,0x3fde148a + .long 0x7ff6aa8c,0x3e4493fe + .long 0x00000000,0x3fde3afc + .long 0xb6cae4c0,0x3e6036a8 + .long 0x00000000,0x3fde6185 + .long 0x546c92af,0x3e7e208f + .long 0x00000000,0x3fde8825 + .long 0x8619d6bd,0x3e67564c + .long 0x00000000,0x3fdeaedd + .long 0xf8b97910,0x3e77d0da + .long 0x00000000,0x3fded5ac + .long 0x5c542068,0x3e6368b5 + .long 0x00000000,0x3fdefc93 + .long 0xbff8880b,0x3e8442ae + .long 0x00000000,0x3fdf2391 + .long 0x259bcade,0x3e8dc063 + .long 0x00000000,0x3fdf4aa7 + .long 0xd802b8c4,0x3e63e185 + .long 0x00000000,0x3fdf71d6 + .long 0xde5f6650,0x3e7b2cec + .long 0x00000000,0x3fdf991c + .long 0x21ff49a1,0x3e8b4d35 + .long 0x00000000,0x3fdfc07a + .long 0xa7c2b8c5,0x3e81d607 + .long 0x00000000,0x3fdfe7f1 + .long 0x0b9d6ee5,0x3e84f140 + .long 0x00000000,0x3fe007c0 + .long 0xd0756a93,0x3e70cc52 + .long 0x00000000,0x3fe01b94 + .long 0x3aad0772,0x3e800319 + .long 0x00000000,0x3fe02f74 + .long 0x759dd00c,0x3e97cec0 + .long 0x00000000,0x3fe04360 + .long 0xc67418f8,0x3e9588ff + .long 0x00000000,0x3fe05759 + .long 0x51e8da67,0x3e6911cf + .long 0x00000000,0x3fe06b5f + .long 0xa048907b,0x3e44cf15 + .long 0x00000000,0x3fe078bf + .long 0xc39803ff,0x3e8a1f9e + .long 0x00000000,0x3fe08cd9 + .long 0x06525ba1,0x3e8d33e4 + .long 0x00000000,0x3fe0a100 + .long 0x3b46098d,0x3e7d11a2 + .long 0x00000000,0x3fe0b534 + .long 0x39b814fa,0x3e991286 + .long 0x00000000,0x3fe0c974 + .long 0x432f7532,0x3e782dcc + .long 0x00000000,0x3fe0ddc2 + .long 0x4618affd,0x3e82ebf2 + .long 0x00000000,0x3fe0eb52 + .long 0x1d77bbef,0x3e8084e9 + .long 0x00000000,0x3fe0ffb5 + .long 0xcfaf1c2c,0x3e7ed4be + .long 0x00000000,0x3fe11425 + .long 0xbfce7a70,0x3e83c766 + .long 0x00000000,0x3fe128a2 + .long 0x1930b4c4,0x3e84afc2 + .long 0x00000000,0x3fe13652 + .long 0x4b441313,0x3e862d2a + .long 0x00000000,0x3fe14ae5 + .long 0xcb6b7c9c,0x3e94338e + .long 0x00000000,0x3fe15f85 + .long 0xfd3aea12,0x3e7c608c + .long 0x00000000,0x3fe16d4d + .long 0x266a0b45,0x3e9841ba + .long 0x00000000,0x3fe18203 + .long 0xe75899eb,0x3e978963 + .long 0x00000000,0x3fe196c7 + .long 0x9e2b1260,0x3e7c5bd1 + .long 0x00000000,0x3fe1a4a7 + .long 0xa79bc2a5,0x3e98192c + .long 0x00000000,0x3fe1b981 + .long 0x0d5eb986,0x3e9d1762 + .long 0x00000000,0x3fe1ce69 + .long 0x28836a17,0x3e93bc0d + .long 0x00000000,0x3fe1dc61 + .long 0xb47416ca,0x3e9455a1 + .long 0x00000000,0x3fe1f160 + .long 0xdf997414,0x3e8dd01c + .long 0x00000000,0x3fe2066d + .long 0x72755e61,0x3e9748f4 + .long 0x00000000,0x3fe2147d + .long 0x586cc870,0x3e978bd7 + .long 0x00000000,0x3fe229a1 + .long 0x05ced5b8,0x3e90834a + .long 0x00000000,0x3fe237c1 + .long 0xb34d2934,0x3e9cdf01 + .long 0x00000000,0x3fe24cfc + .long 0xd891ba01,0x3e857355 + .long 0x00000000,0x3fe25b2c + .long 0x103a61e4,0x3e8357df + .long 0x00000000,0x3fe2707f + .long 0x7071361a,0x3e908594 + .long 0x00000000,0x3fe285e0 + .long 0xdcc2f0a7,0x3e81c22d + .long 0x00000000,0x3fe29429 + .long 0xc30f37c8,0x3e89c2bf + .long 0x00000000,0x3fe2a9a2 + .long 0x604c3ff4,0x3e76468e + .long 0x00000000,0x3fe2b7fb + .long 0x7d42bf88,0x3e88e57d + .long 0x00000000,0x3fe2c65a + .long 0xd0b235f1,0x3e85ec37 + .long 0x00000000,0x3fe2dbf5 + .long 0xca965170,0x3e987f2e + .long 0x00000000,0x3fe2ea64 + .long 0xb996d64e,0x3e71b426 + .long 0x00000000,0x3fe30018 + .long 0xb998ef97,0x3e9d3516 + .long 0x00000000,0x3fe30e97 + .long 0x9d3de3b9,0x3e9d7ba6 + .long 0x00000000,0x3fe32463 + .long 0xcad27856,0x3e78a56b + .long 0x00000000,0x3fe332f4 + .long 0x9f9e227c,0x3e5ce8c9 + .long 0x00000000,0x3fe348d9 + .long 0xadb2d775,0x3e9f1887 + .long 0x00000000,0x3fe35779 + .long 0x53263e64,0x3e92c34d + .long 0x00000000,0x3fe36621 + .long 0xcd4571cb,0x3e93e786 + .long 0x00000000,0x3fe37c29 + .long 0xe748544b,0x3e671976 + .long 0x00000000,0x3fe38ae2 + .long 0xf9cce311,0x3e85e980 + .long 0x00000000,0x3fe399a1 + .long 0x3a222092,0x3e9fcef7 + .long 0x00000000,0x3fe3afcc + .long 0xed5008bd,0x3e840d4c + .long 0x00000000,0x3fe3be9d + .long 0x1452e9ec,0x3e901695 + .long 0x00000000,0x3fe3cd74 + .long 0xb62b2ce8,0x3e7c8c7b + .long 0x00000000,0x3fe3e3c4 + .long 0xd8d571ad,0x3e964fda + .long 0x00000000,0x3fe3f2ac + .long 0x498c3678,0x3e7092e5 + .long 0x00000000,0x3fe4019c + .long 0xc8960bd4,0x3e884e25 + .long 0x00000000,0x3fe41810 + .long 0x5157ce35,0x3e84637d + .long 0x00000000,0x3fe42711 + .long 0xafcc2a6b,0x3e8384ad + .long 0x00000000,0x3fe43619 + .long 0x9a4ffe6d,0x3e875a3a + .long 0x00000000,0x3fe44528 + .long 0x4e8516c0,0x3e819322 + .long 0x00000000,0x3fe45bcc + .long 0xfe3457c8,0x3e70f88b + .long 0x00000000,0x3fe46aed + .long 0x69a4a836,0x3e73f451 + .long 0x00000000,0x3fe47a15 + .long 0x32f98351,0x3e87bfff + .long 0x00000000,0x3fe48944 + .long 0x06a8d925,0x3e9796d3 + .long 0x00000000,0x3fe4a018 + .long 0xaef076e2,0x3e593acb + .long 0x00000000,0x3fe4af5a + .long 0xd0e13620,0x3e94b7b7 + .long 0x00000000,0x3fe4bea2 + .long 0x88cfb12e,0x3e91e215 + .long 0x00000000,0x3fe4cdf2 + .long 0x0b0cb912,0x3e99f328 + .long 0x00000000,0x3fe4dd49 + .long 0xa0e67b10,0x3e8b9929 + .long 0x00000000,0x3fe4eca8 + .long 0xb401f873,0x3e7e6c75 + .long 0x00000000,0x3fe503c4 + .long 0x15ce5326,0x3e8999ff + .long 0x00000000,0x3fe51335 + .long 0x5f3840b2,0x3e4ce28f + .long 0x00000000,0x3fe522ae + .long 0x2b9988ba,0x3e73433c + .long 0x00000000,0x3fe5322e + .long 0x0122cc5c,0x3e9972f3 + .long 0x00000000,0x3fe541b5 + .long 0xac4eb353,0x3e9fb797 + .long 0x00000000,0x3fe55144 + .long 0x78d26225,0x3e988a2a + .long 0x00000000,0x3fe560db + .long 0x333017fe,0x3e735dc6 + .long 0x00000000,0x3fe5707a + .long 0xff9e8c9a,0x3e5dab71 + .long 0x00000000,0x3fe587f6 + .long 0xe623c257,0x3e92ef91 + .long 0x00000000,0x3fe597a7 + .long 0x715f0d98,0x3e9ac697 + .long 0x00000000,0x3fe5a760 + .long 0x21dc5b09,0x3e9a52be + .long 0x00000000,0x3fe5b721 + .long 0xdf20565e,0x3e928863 + .long 0x00000000,0x3fe5c6ea + .long 0x7afa1d46,0x3e717543 + .long 0x00000000,0x3fe5d6bb + .long 0x71f3b726,0x3e90c8ba + .long 0x00000000,0x3fe5e693 + .long 0xda3470be,0x3e98c345 + .long 0x00000000,0x3fe5f673 + .long 0x24c45894,0x3e9d470b + .long 0x00000000,0x3fe6065b + .long 0x0d6b6214,0x3e9f4f98 + .long 0x00000000,0x3fe6164b + .long 0xe85e3147,0x3e9fd9f2 + .long 0x00000000,0x3fe62643 + .type __libm_log_table_256,@object + .size __libm_log_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/log_wmt.S b/external/sgx_libm/ia32/log_wmt.S new file mode 100644 index 0000000000..b43eb8a34a --- /dev/null +++ b/external/sgx_libm/ia32/log_wmt.S @@ -0,0 +1,800 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin log + .text + .align 16,0x90 + .globl log +log: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + xorpd %xmm3, %xmm3 + movl $30704, %edx + pinsrw $3, %edx, %xmm3 + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + movl $32768, %ecx + movd %ecx, %xmm4 + movsd 2128(%ebx), %xmm5 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + psllq $5, %xmm0 + movl $16352, %ecx + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $228, %xmm5, %xmm6 + psrlq $12, %xmm1 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + paddd %xmm4, %xmm0 + orpd %xmm3, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm1, %xmm5 + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm1 + mulpd %xmm0, %xmm5 + andl $32752, %eax + subl %ecx, %eax + cvtsi2sdl %eax, %xmm7 + mulsd %xmm0, %xmm1 + movsd 2064(%ebx), %xmm6 + movapd 2080(%ebx), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd (%ebx,%edx), %xmm0 + movapd 2096(%ebx), %xmm4 + addsd %xmm5, %xmm1 + movapd 2112(%ebx), %xmm2 + mulsd %xmm7, %xmm6 + pshufd $68, %xmm1, %xmm5 + mulsd 2072(%ebx), %xmm7 + mulsd %xmm1, %xmm3 + addsd %xmm6, %xmm0 + mulpd %xmm5, %xmm4 + mulpd %xmm5, %xmm5 + pshufd $228, %xmm0, %xmm6 + addsd %xmm1, %xmm0 + addpd %xmm2, %xmm4 + mulpd %xmm5, %xmm3 + subsd %xmm0, %xmm6 + mulsd %xmm1, %xmm4 + pshufd $238, %xmm0, %xmm2 + addsd %xmm6, %xmm1 + mulsd %xmm5, %xmm5 + addsd %xmm2, %xmm7 + addpd %xmm3, %xmm4 + addsd %xmm7, %xmm1 + mulpd %xmm5, %xmm4 + addsd %xmm4, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + movsd 112(%esp), %xmm0 + movapd %xmm0, %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_3.0.3 + cmpl $16, %eax + jb .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + ja .L_2TAG_PACKET_5.0.3 + cmpl $0, %edx + ja .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_3.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_6.0.3 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_7.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + movl $3, %edx + mulsd %xmm1, %xmm0 +.L_2TAG_PACKET_9.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_10.0.3 +.L_2TAG_PACKET_8.0.3: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $2, %edx + jmp .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_4.0.3: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_8.0.3 + xorpd %xmm1, %xmm1 + movl $18416, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + movapd %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + psllq $5, %xmm0 + movl $18416, %ecx + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $228, %xmm5, %xmm6 + psrlq $12, %xmm1 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_10.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type log,@function + .size log,.-log + .data +# -- End log + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4277811200 + .long 1072049730 + .long 2479318832 + .long 1026487127 + .long 2854492160 + .long 1072033410 + .long 215631550 + .long 1025638968 + .long 1547061248 + .long 1072017216 + .long 2886781435 + .long 1026423395 + .long 649825280 + .long 1072001146 + .long 4281533405 + .long 1024038923 + .long 646346752 + .long 1071985198 + .long 1562735921 + .long 1023790276 + .long 2203734016 + .long 1071969370 + .long 1838397691 + .long 3173936209 + .long 1872169984 + .long 1071953661 + .long 3981202460 + .long 1022325013 + .long 669557760 + .long 1071938069 + .long 4182597802 + .long 3173174122 + .long 4076413952 + .long 1071922591 + .long 1209029111 + .long 3170736207 + .long 556125184 + .long 1071907228 + .long 821086028 + .long 3173437049 + .long 204914688 + .long 1071891976 + .long 2097025986 + .long 3171071798 + .long 387545088 + .long 1071876834 + .long 3142936996 + .long 3173092218 + .long 2912783360 + .long 1071861800 + .long 2502420140 + .long 1024505919 + .long 1144260608 + .long 1071846874 + .long 3315658140 + .long 3173469843 + .long 1471209472 + .long 1071832053 + .long 129621009 + .long 3172443877 + .long 1829683200 + .long 1071817336 + .long 3885467693 + .long 1025535275 + .long 288676864 + .long 1071802722 + .long 86139472 + .long 3171639793 + .long 3636378624 + .long 1071788208 + .long 1850238587 + .long 1024654342 + .long 1606817792 + .long 1071773795 + .long 3388899795 + .long 3173675586 + .long 1236164608 + .long 1071759480 + .long 3983599207 + .long 1020046558 + .long 1089616896 + .long 1071745262 + .long 4171974224 + .long 1024773198 + .long 4143093760 + .long 1071731139 + .long 2727587401 + .long 3173965207 + .long 600267776 + .long 1071717112 + .long 3147685042 + .long 3173353031 + .long 2249313280 + .long 1071703177 + .long 125835074 + .long 1025255832 + .long 3805303808 + .long 1071689334 + .long 2289991207 + .long 1025460331 + .long 87278592 + .long 1071675583 + .long 1106114045 + .long 1025933602 + .long 3195405312 + .long 1071661920 + .long 3885316576 + .long 3171206239 + .long 3853649920 + .long 1071648346 + .long 2977069852 + .long 3171236771 + .long 2944026624 + .long 1071625048 + .long 1008093493 + .long 1023444474 + .long 3993180160 + .long 1071598247 + .long 1862355595 + .long 1024642533 + .long 1454641152 + .long 1071571617 + .long 1514603089 + .long 1026500596 + .long 3286085632 + .long 1071545154 + .long 1400028424 + .long 3173279056 + .long 438773760 + .long 1071518858 + .long 120727864 + .long 3172148914 + .long 1212979200 + .long 1071492725 + .long 1625055594 + .long 3172901933 + .long 1189017600 + .long 1071466754 + .long 3920062376 + .long 1025727407 + .long 403064832 + .long 1071440943 + .long 1053271728 + .long 3171391427 + .long 3343210496 + .long 1071415289 + .long 3243395502 + .long 3173627613 + .long 1765777408 + .long 1071389792 + .long 2145968512 + .long 1026354304 + .long 461430784 + .long 1071364449 + .long 4094322285 + .long 1026021467 + .long 71706624 + .long 1071339258 + .long 763632021 + .long 1024496933 + .long 1380503552 + .long 1071314217 + .long 1383547992 + .long 3173088453 + .long 1015732224 + .long 1071289325 + .long 3198646877 + .long 1025390322 + .long 35977216 + .long 1071264580 + .long 2141026805 + .long 1025754693 + .long 3927306240 + .long 1071239979 + .long 282116272 + .long 3173394334 + .long 1125341184 + .long 1071215523 + .long 2768427504 + .long 3172279059 + .long 1666971648 + .long 1071191208 + .long 786837629 + .long 3172427445 + .long 2827694080 + .long 1071167033 + .long 3857122416 + .long 3173014241 + .long 2003683328 + .long 1071142997 + .long 859010954 + .long 1026545007 + .long 1004017664 + .long 1071119098 + .long 3356644970 + .long 3173458064 + .long 1753020416 + .long 1071095334 + .long 788338552 + .long 1026157693 + .long 1992718336 + .long 1071071704 + .long 1239179443 + .long 1026394889 + .long 3870234624 + .long 1071048206 + .long 2082614663 + .long 1024926053 + .long 1050437632 + .long 1071024840 + .long 660007840 + .long 1025548499 + .long 188395520 + .long 1071001603 + .long 3878792704 + .long 3173889571 + .long 3747176448 + .long 1070978493 + .long 144991708 + .long 3171552042 + .long 1405669376 + .long 1070955511 + .long 3999088879 + .long 1025486317 + .long 121151488 + .long 1070932654 + .long 2170865497 + .long 1026473584 + .long 2652319744 + .long 1070909920 + .long 453695652 + .long 3173916809 + .long 3262236672 + .long 1070887309 + .long 157800053 + .long 3173984206 + .long 601221120 + .long 1070864820 + .long 3968917661 + .long 1023992886 + .long 1999843328 + .long 1070842450 + .long 3053895004 + .long 1024998228 + .long 1992167424 + .long 1070820199 + .long 2968614856 + .long 1024552653 + .long 3788726272 + .long 1070798065 + .long 3542170808 + .long 3173573242 + .long 2094829568 + .long 1070776048 + .long 1246758132 + .long 1026202874 + .long 288675840 + .long 1070754146 + .long 3747328950 + .long 1026331585 + .long 1829681152 + .long 1070732357 + .long 3125197546 + .long 1024100318 + .long 1666869248 + .long 1070710681 + .long 1363656119 + .long 1026336493 + .long 3417110528 + .long 1070689116 + .long 4154791553 + .long 1026267853 + .long 2183653376 + .long 1070667662 + .long 1671819292 + .long 3173785870 + .long 1734434816 + .long 1070646317 + .long 373091049 + .long 1025972363 + .long 1615681536 + .long 1070625080 + .long 384650897 + .long 1022926043 + .long 1445382144 + .long 1070603950 + .long 344320330 + .long 3172397196 + .long 1823715328 + .long 1070569756 + .long 3389841200 + .long 1025231852 + .long 3839688704 + .long 1070527917 + .long 1706790417 + .long 3167363349 + .long 4293332992 + .long 1070486286 + .long 1614935088 + .long 1019351591 + .long 2966720512 + .long 1070444861 + .long 4145393717 + .long 3173711658 + .long 4066729984 + .long 1070403639 + .long 1974925028 + .long 3171437182 + .long 3337621504 + .long 1070362619 + .long 3314953170 + .long 3169971314 + .long 943448064 + .long 1070321799 + .long 1498682038 + .long 3173862340 + .long 1465634816 + .long 1070281176 + .long 1319952810 + .long 3171693965 + .long 1015734272 + .long 1070240749 + .long 1347821929 + .long 3173544515 + .long 118001664 + .long 1070200516 + .long 1751482746 + .long 1026134093 + .long 3707174912 + .long 1070160474 + .long 1486946159 + .long 1023930920 + .long 3946381312 + .long 1070120623 + .long 2867408081 + .long 3171368276 + .long 1699848192 + .long 1070080961 + .long 2590187139 + .long 1025379803 + .long 2235846656 + .long 1070041485 + .long 1888568069 + .long 3172754960 + .long 2339729408 + .long 1070002194 + .long 3852214753 + .long 3173323149 + .long 3196850176 + .long 1069963086 + .long 742141560 + .long 1025101707 + .long 1800683520 + .long 1069924160 + .long 3949500444 + .long 3172102179 + .long 3835801600 + .long 1069885413 + .long 3848895943 + .long 1025913832 + .long 2201202688 + .long 1069846845 + .long 1425913464 + .long 1025868665 + .long 2778279936 + .long 1069808453 + .long 2120889677 + .long 3173831128 + .long 2954203136 + .long 1069770236 + .long 592147081 + .long 1019621288 + .long 210141184 + .long 1069732193 + .long 3414275233 + .long 1023647084 + .long 709476352 + .long 1069694321 + .long 2413027164 + .long 1024462115 + .long 2116284416 + .long 1069656619 + .long 1144559924 + .long 1026336654 + .long 2183651328 + .long 1069619086 + .long 3459057650 + .long 1025634168 + .long 3047047168 + .long 1069581720 + .long 1879674924 + .long 3173508573 + .long 970711040 + .long 1069541521 + .long 1335954173 + .long 3173332182 + .long 2198478848 + .long 1069467449 + .long 2951103968 + .long 3173892200 + .long 1669611520 + .long 1069393703 + .long 531044147 + .long 1025149248 + .long 29114368 + .long 1069320280 + .long 3327831251 + .long 1025918673 + .long 2376949760 + .long 1069247176 + .long 737634533 + .long 3172176000 + .long 1085390848 + .long 1069174390 + .long 3108243400 + .long 3171828406 + .long 1566130176 + .long 1069101918 + .long 985483226 + .long 1025708380 + .long 792780800 + .long 1069029758 + .long 4184866295 + .long 1024426204 + .long 183156736 + .long 1068957907 + .long 2845699378 + .long 1022107277 + .long 1301782528 + .long 1068886362 + .long 1012735262 + .long 3173804294 + .long 1562411008 + .long 1068815121 + .long 2197086703 + .long 3170187813 + .long 2815549440 + .long 1068744181 + .long 2782613207 + .long 1026345054 + .long 2756124672 + .long 1068673540 + .long 2929486205 + .long 3173037800 + .long 3511050240 + .long 1068603195 + .long 1443733147 + .long 3173331549 + .long 3047047168 + .long 1068533144 + .long 1879674924 + .long 3172459997 + .long 3221667840 + .long 1068427825 + .long 1338588027 + .long 3171815742 + .long 3453861888 + .long 1068288883 + .long 1205348359 + .long 3172624626 + .long 3506110464 + .long 1068150514 + .long 893105198 + .long 1025571866 + .long 346013696 + .long 1068012714 + .long 3495569021 + .long 3172563349 + .long 4074029056 + .long 1067875476 + .long 3961106338 + .long 3171065595 + .long 3559784448 + .long 1067738798 + .long 1975385384 + .long 3173783155 + .long 797769728 + .long 1067602675 + .long 3760305787 + .long 1026047642 + .long 2313633792 + .long 1067467101 + .long 1559353171 + .long 1023480256 + .long 3960766464 + .long 1067213778 + .long 1067365107 + .long 1025865926 + .long 684261376 + .long 1066944805 + .long 844762164 + .long 3173687482 + .long 630718464 + .long 1066676905 + .long 2458269694 + .long 1024033081 + .long 1486061568 + .long 1066410070 + .long 115537874 + .long 3173243995 + .long 2743664640 + .long 1065886792 + .long 3665098304 + .long 3173471607 + .long 1971912704 + .long 1065357333 + .long 2577214440 + .long 3171993451 + .long 1498939392 + .long 1064306693 + .long 3409036923 + .long 1025599151 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 4277811200 + .long 1067855426 + .long 2479318832 + .long 1022292823 + .long 2454267026 + .long 1069697316 + .long 0 + .long 3218079744 + .long 1030730101 + .long 3217380702 + .long 1431655765 + .long 1070945621 + .long 2576980378 + .long 1070176665 + .long 0 + .long 3219128320 + .long 0 + .long 4294959104 + .long 0 + .long 4294959104 + .type static_const_table,@object + .size static_const_table,2144 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logb_wmt.S b/external/sgx_libm/ia32/logb_wmt.S new file mode 100644 index 0000000000..f5d36ff39e --- /dev/null +++ b/external/sgx_libm/ia32/logb_wmt.S @@ -0,0 +1,171 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logb_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin logb + .text + .align 16,0x90 + .globl logb +logb: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movq %xmm0, 8(%esp) + psrlq $52, %xmm0 + movd %xmm0, %eax + andl $2047, %eax + subl $1, %eax + cmpl $2046, %eax + jae .L_2TAG_PACKET_0.0.3 + subl $1022, %eax + movl %eax, (%esp) + fildl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + movq 8(%esp), %xmm0 + movq 16(%ebx), %xmm1 + pxor %xmm2, %xmm2 + testl %eax, %eax + jg .L_2TAG_PACKET_2.0.3 + comisd %xmm2, %xmm0 + mulsd %xmm1, %xmm0 + je .L_2TAG_PACKET_3.0.3 + psrlq $52, %xmm0 + movd %xmm0, %eax + andl $2047, %eax + subl $1078, %eax + movl %eax, (%esp) + fildl (%esp) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + psrlq $60, %xmm0 + fldl 8(%esp) + movd %xmm0, %eax + andl $8, %eax + fmull (%ebx,%eax) + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movq 8(%ebx), %xmm0 + divsd %xmm2, %xmm0 + movq %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $151, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) +.L_2TAG_PACKET_1.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type logb,@function + .size logb,.-logb + .data +# -- End logb + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 0 + .long 1130364928 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logbf.S b/external/sgx_libm/ia32/logbf.S new file mode 100644 index 0000000000..69539c7124 --- /dev/null +++ b/external/sgx_libm/ia32/logbf.S @@ -0,0 +1,122 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logbf.c" + .text +..TXTST0: +# -- Begin logbf + .text + .align 16,0x90 + .globl logbf +logbf: +# parameter 1: 16 + %esp +..B1.1: +..L1: + + subl $12, %esp + movl 16(%esp), %eax + movl %eax, %edx + andl $2147483647, %edx + addl $-8388608, %edx + cmpl $2130706432, %edx + jb ..B1.7 +..B1.2: + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + testl %edx, %edx + jge ..B1.6 +..B1.3: + cmpl $-8388608, %edx + je ..B1.8 +..B1.4: + flds 16(%esp) + fmuls .L_2il0floatpacket.1@GOTOFF(%ecx) + fstps 16(%esp) + movl 16(%esp), %eax + andl $2147483647, %eax + shrl $23, %eax + addl $-152, %eax + movl %eax, (%esp) + fildl (%esp) +..B1.5: + addl $12, %esp + ret +..B1.6: + flds 16(%esp) + shrl $31, %eax + fmuls _ones@GOTOFF(%ecx,%eax,4) + addl $12, %esp + ret +..B1.7: + shrl $23, %edx + addl $-126, %edx + movl %edx, (%esp) + fildl (%esp) + addl $12, %esp + ret +..B1.8: + fldz + fdivrs .L_2il0floatpacket.0@GOTOFF(%ecx) + addl $12, %esp + ret + .align 16,0x90 + .type logbf,@function + .size logbf,.-logbf + .data +# -- End logbf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logbl.S b/external/sgx_libm/ia32/logbl.S new file mode 100644 index 0000000000..f7fe85e705 --- /dev/null +++ b/external/sgx_libm/ia32/logbl.S @@ -0,0 +1,161 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logbl.c" + .text +..TXTST0: +# -- Begin logbl + .text + .align 16,0x90 + .globl logbl +logbl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 22(%esp) +..B1.3: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.18 +..B1.4: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.5: + fldcw 20(%esp) +..B1.6: + movl $1, %edx +..B1.7: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $32767, %ecx + je ..B1.17 +..B1.8: + testl %ecx, %ecx + jne ..B1.12 +..B1.9: + cmpl $0, 12(%ebp) + jne ..B1.11 +..B1.10: + cmpl $0, 8(%ebp) + je ..B1.16 +..B1.11: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%eax) + fstpt 8(%ebp) + movzwl 16(%ebp), %eax + andl $32767, %eax + addl $-16458, %eax + movl %eax, (%esp) + fildl (%esp) + fstpt 8(%esp) + jmp ..B1.13 +..B1.12: + addl $-16383, %ecx + movl %ecx, (%esp) + fildl (%esp) + fstpt 8(%esp) +..B1.13: + testl %edx, %edx + je ..B1.15 +..B1.14: + fldcw 22(%esp) +..B1.15: + fldt 8(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.16: + fldl 8+_ones@GOTOFF(%eax) + fdivl _zeros@GOTOFF(%eax) + fstpt 8(%esp) + jmp ..B1.13 +..B1.17: + fldt 8(%ebp) + movzbl 17(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + fmull _ones@GOTOFF(%eax,%ecx,8) + fstpt 8(%esp) + jmp ..B1.13 +..B1.18: + xorl %edx, %edx + jmp ..B1.7 + .align 16,0x90 + .type logbl,@function + .size logbl,.-logbl + .data +# -- End logbl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logf_table.S b/external/sgx_libm/ia32/logf_table.S new file mode 100644 index 0000000000..5cf1f0703d --- /dev/null +++ b/external/sgx_libm/ia32/logf_table.S @@ -0,0 +1,304 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logf_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_logf_table_256 + .globl __libm_logf_table_256 +__libm_logf_table_256: + .long 0x55d5889e,0x3f600401 + .long 0x14586b54,0x3f781212 + .long 0xf96832f0,0x3f841929 + .long 0x84c75f07,0x3f8c3173 + .long 0x1ac73386,0x3f91a6b9 + .long 0x5d9ac03a,0x3f95ba9a + .long 0x074325f4,0x3f99d2a8 + .long 0x25979802,0x3f9d6b27 + .long 0xa19dfaa9,0x3fa0c58f + .long 0x78cbce1b,0x3fa2954c + .long 0x2da96c57,0x3fa4a94d + .long 0xf2d4bb58,0x3fa67c94 + .long 0xb630f068,0x3fa85188 + .long 0xbe73af4c,0x3faa6b8a + .long 0x06f72a9e,0x3fac441e + .long 0x13606d07,0x3fae1e67 + .long 0x11ab9301,0x3faffa69 + .long 0x9c5da601,0x3fb0ec13 + .long 0x643d190b,0x3fb1dbd2 + .long 0x84fe5f1c,0x3fb2cc72 + .long 0xa7d1ee64,0x3fb3bdf5 + .long 0x7aa012e0,0x3fb4b05d + .long 0x7ceb5702,0x3fb580db + .long 0x89365a7a,0x3fb674f0 + .long 0x2c6b568d,0x3fb769ef + .long 0x27506a48,0x3fb85fd9 + .long 0x5d594989,0x3fb9335e + .long 0x20c8e5f5,0x3fba2b02 + .long 0xac1a86ac,0x3fbb0004 + .long 0x769fca11,0x3fbbf968 + .long 0xbfee13a8,0x3fbccfed + .long 0x638446a2,0x3fbda727 + .long 0x7fe10f7a,0x3fbea325 + .long 0xfedbfde6,0x3fbf7be9 + .long 0x52ff25f4,0x3fc02ab3 + .long 0x579d204d,0x3fc097ce + .long 0x8227e47c,0x3fc1178e + .long 0x7dbecf34,0x3fc18574 + .long 0x25f25d41,0x3fc1f3b9 + .long 0x1e6ddf57,0x3fc2625d + .long 0x0c86813a,0x3fc2d161 + .long 0x9741142e,0x3fc340c5 + .long 0x6757f2a9,0x3fc3b08b + .long 0x08378004,0x3fc40dfb + .long 0xe8ca5f7c,0x3fc47e74 + .long 0xf6466de4,0x3fc4ef51 + .long 0xe02ba516,0x3fc56092 + .long 0x57cd74d5,0x3fc5d238 + .long 0x37335d76,0x3fc6313a + .long 0xdabbd383,0x3fc6a399 + .long 0xdd3ce41a,0x3fc70337 + .long 0x128f6127,0x3fc77654 + .long 0x2a0b022d,0x3fc7e9d8 + .long 0x759f512f,0x3fc84a6b + .long 0xd5f5a310,0x3fc8ab47 + .long 0x9096581b,0x3fc91fe4 + .long 0x4011aa76,0x3fc98163 + .long 0x07089664,0x3fc9f6c4 + .long 0x29348f43,0x3fca58e7 + .long 0xc31693ad,0x3fcabb55 + .long 0x4919efd0,0x3fcb1e10 + .long 0x93e367cb,0x3fcb94ee + .long 0xc067555f,0x3fcbf851 + .long 0x54bf23a6,0x3fcc5c02 + .long 0xc9db3c52,0x3fccc000 + .long 0x99c85674,0x3fcd244d + .long 0x3fb2f450,0x3fcd88e9 + .long 0x37eaef01,0x3fcdedd4 + .long 0xffe71012,0x3fce530e + .long 0x1648b971,0x3fceb89a + .long 0xfadf9bde,0x3fcf1e75 + .long 0x2ead7c36,0x3fcf84a3 + .long 0x33ea07cd,0x3fcfeb22 + .long 0xc7035c1c,0x3fd028f9 + .long 0xe0d9635a,0x3fd05c8b + .long 0x8f8ae797,0x3fd085eb + .long 0xe32d1911,0x3fd0b9c8 + .long 0x60b78081,0x3fd0edd0 + .long 0x4cf0063f,0x3fd12202 + .long 0x927aecd4,0x3fd14be2 + .long 0x8ef18adf,0x3fd18061 + .long 0xbe2fc63b,0x3fd1b50b + .long 0xc7cf242d,0x3fd1df4c + .long 0x6d0eb8d4,0x3fd21445 + .long 0x991eba49,0x3fd23ec5 + .long 0x9f870afb,0x3fd2740d + .long 0xabcdfa04,0x3fd29ecd + .long 0x02adccee,0x3fd2d466 + .long 0xb04ea9d4,0x3fd2ff66 + .long 0x4b355a38,0x3fd33550 + .long 0x5ec44f5d,0x3fd36092 + .long 0xc3337e75,0x3fd38bf1 + .long 0x77333184,0x3fd3c252 + .long 0x63c1683e,0x3fd3edf4 + .long 0x23d5e8c7,0x3fd419b4 + .long 0xe0539f49,0x3fd44591 + .long 0x75b6f0ad,0x3fd47c91 + .long 0x41552b09,0x3fd4a8b3 + .long 0x908901a0,0x3fd4d4f3 + .long 0x8da1f968,0x3fd50152 + .long 0x6347d4f6,0x3fd52dd0 + .long 0x3c7b8a8a,0x3fd55a6d + .long 0x2b112a59,0x3fd5925d + .long 0x6b543db2,0x3fd5bf40 + .long 0x3d5c35ae,0x3fd5ec43 + .long 0xcdb02c1f,0x3fd61965 + .long 0x4935b2a2,0x3fd646a8 + .long 0xdd31de95,0x3fd6740a + .long 0xb74a58c5,0x3fd6a18d + .long 0x058670ec,0x3fd6cf31 + .long 0xe852f0ba,0x3fd6f180 + .long 0x71b894f0,0x3fd71f5d + .long 0xefd66d5c,0x3fd74d5a + .long 0x922bd37e,0x3fd77b79 + .long 0x889f19e2,0x3fd7a9b9 + .long 0x037eb6a6,0x3fd7d81b + .long 0x33827231,0x3fd8069e + .long 0xd3ef8bcb,0x3fd82996 + .long 0x776dcbfb,0x3fd85855 + .long 0x58327ccf,0x3fd88736 + .long 0x973ab8cf,0x3fd8aa75 + .long 0xdc8824e5,0x3fd8d992 + .long 0xea7d9512,0x3fd908d2 + .long 0xe79c0e56,0x3fd92c59 + .long 0x50ee3ed3,0x3fd95bd7 + .long 0x11a3ee5b,0x3fd98b78 + .long 0xf33d406c,0x3fd9af47 + .long 0x0c1914a8,0x3fd9df27 + .long 0xed14fda5,0x3fda0325 + .long 0x0224fa79,0x3fda3344 + .long 0x5e80c383,0x3fda5772 + .long 0x165dd199,0x3fda87d0 + .long 0x6c03f896,0x3fdaac2e + .long 0x6fdf6a81,0x3fdadccc + .long 0x3eb1e790,0x3fdb015b + .long 0x3a635948,0x3fdb323a + .long 0x04462909,0x3fdb56fa + .long 0xa659bc93,0x3fdb881a + .long 0xef3db165,0x3fdbad0b + .long 0x97781c2f,0x3fdbd212 + .long 0x36f08819,0x3fdc0392 + .long 0x1e4d32fd,0x3fdc28cb + .long 0xb84723c2,0x3fdc4e19 + .long 0xc74554c9,0x3fdc7ff9 + .long 0x64e9db05,0x3fdca57b + .long 0x0a5cebb0,0x3fdccb13 + .long 0xd18f326f,0x3fdcf0c0 + .long 0x75b5a201,0x3fdd2320 + .long 0x46defa6b,0x3fdd4902 + .long 0x918d25cd,0x3fdd6efa + .long 0x707ae52f,0x3fdd9509 + .long 0xfe92c554,0x3fddbb2e + .long 0x3445e4af,0x3fddee2f + .long 0x1a2726ce,0x3fde148a + .long 0x0a49ff40,0x3fde3afc + .long 0x206d516e,0x3fde6185 + .long 0x78823d52,0x3fde8825 + .long 0x2eac990c,0x3fdeaedd + .long 0x5f436be3,0x3fded5ac + .long 0x26d16ab9,0x3fdefc93 + .long 0xa2157600,0x3fdf2391 + .long 0xee03192d,0x3fdf4aa7 + .long 0x27c30bb0,0x3fdf71d6 + .long 0x6cb3b379,0x3fdf991c + .long 0xda69a910,0x3fdfc07a + .long 0x8eb03d3e,0x3fdfe7f1 + .long 0x53c5002e,0x3fe007c0 + .long 0x2198a5a1,0x3fe01b94 + .long 0x400c64eb,0x3fe02f74 + .long 0xbe7603ad,0x3fe04360 + .long 0xac47fe34,0x3fe05759 + .long 0x1911cf52,0x3fe06b5f + .long 0x0533c568,0x3fe078bf + .long 0x687e7b0e,0x3fe08cd9 + .long 0x74cf9019,0x3fe0a100 + .long 0x3a234477,0x3fe0b534 + .long 0xc89431ce,0x3fe0c974 + .long 0x305b9886,0x3fe0ddc2 + .long 0x4bafc918,0x3fe0eb52 + .long 0x4213a476,0x3fe0ffb5 + .long 0x3da97d9f,0x3fe11425 + .long 0x4f1d9aff,0x3fe128a2 + .long 0x52bf0865,0x3fe13652 + .long 0x58b4a92d,0x3fe14ae5 + .long 0xa19c765b,0x3fe15f85 + .long 0x38c119fa,0x3fe16d4d + .long 0xc20dd133,0x3fe18203 + .long 0xbc4b1f3b,0x3fe196c7 + .long 0x38b7a33c,0x3fe1a4a7 + .long 0xc0c9653d,0x3fe1b981 + .long 0xe8bb106b,0x3fe1ce69 + .long 0x9de06944,0x3fe1dc61 + .long 0xa2ad0da4,0x3fe1f160 + .long 0x7740737e,0x3fe2066d + .long 0xba47a394,0x3fe2147d + .long 0xbc5ebac3,0x3fe229a1 + .long 0x841a502e,0x3fe237c1 + .long 0xe6f80d9a,0x3fe24cfc + .long 0x55cd5762,0x3fe25b2c + .long 0x4d5f7c41,0x3fe2707f + .long 0x842ca384,0x3fe285e0 + .long 0x4708b773,0x3fe29429 + .long 0x670aff0c,0x3fe2a9a2 + .long 0x2c8d1cc1,0x3fe2b7fb + .long 0x6395f5f5,0x3fe2c65a + .long 0x57b0df43,0x3fe2dbf5 + .long 0xc3f97655,0x3fe2ea64 + .long 0x23684d73,0x3fe30018 + .long 0xe9a8b5cd,0x3fe30e97 + .long 0xebdd34ea,0x3fe32463 + .long 0x314ad796,0x3fe332f4 + .long 0x0e7464d0,0x3fe348d9 + .long 0xf8c43d6e,0x3fe35779 + .long 0x961a6a99,0x3fe36621 + .long 0x9f3c366a,0x3fe37c29 + .long 0x171976e7,0x3fe38ae2 + .long 0x57a603e7,0x3fe399a1 + .long 0xfe77b9d1,0x3fe3afcc + .long 0x503533b5,0x3fe3be9d + .long 0x80b4a8a3,0x3fe3cd74 + .long 0x3918f76c,0x3fe3e3c4 + .long 0xb27ed6c7,0x3fe3f2ac + .long 0x2125ca93,0x3fe4019c + .long 0x61389722,0x3fe41810 + .long 0x518df545,0x3fe42711 + .long 0x4e12b6bf,0x3fe43619 + .long 0x5d68ea69,0x3fe44528 + .long 0x464c893a,0x3fe45bcc + .long 0x21f117fc,0x3fe46aed + .long 0x27e8a2d3,0x3fe47a15 + .long 0x5efffccc,0x3fe48944 + .long 0xbcb69835,0x3fe4a018 + .long 0x0c9d65d7,0x3fe4af5a + .long 0xa5bdbe87,0x3fe4bea2 + .long 0x8f10ac47,0x3fe4cdf2 + .long 0xcf994058,0x3fe4dd49 + .long 0x6e64a684,0x3fe4eca8 + .long 0x3cd8eb68,0x3fe503c4 + .long 0x6667fc57,0x3fe51335 + .long 0x0738a3d8,0x3fe522ae + .long 0x26867857,0x3fe5322e + .long 0xcb979809,0x3fe541b5 + .long 0xfdbcbd62,0x3fe55144 + .long 0xc45153c7,0x3fe560db + .long 0x26bb8c66,0x3fe5707a + .long 0x0ed5b900,0x3fe587f6 + .long 0x977c8f31,0x3fe597a7 + .long 0xd634bb8b,0x3fe5a760 + .long 0xd295f10f,0x3fe5b721 + .long 0x94431ef9,0x3fe5c6ea + .long 0x22ea86f6,0x3fe5d6bb + .long 0x8645d390,0x3fe5e693 + .long 0xc61a2ed2,0x3fe5f673 + .long 0xea385926,0x3fe6065b + .long 0xfa7cc06b,0x3fe6164b + .long 0xfecf9743,0x3fe62643 + .type __libm_logf_table_256,@object + .size __libm_logf_table_256,2048 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logf_wmt.S b/external/sgx_libm/ia32/logf_wmt.S new file mode 100644 index 0000000000..4a00864c73 --- /dev/null +++ b/external/sgx_libm/ia32/logf_wmt.S @@ -0,0 +1,742 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin logf + .text + .align 16,0x90 + .globl logf +logf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl $16384, %ecx + movd %ecx, %xmm4 + movl $-32768, %eax + movd %eax, %xmm2 + xorpd %xmm3, %xmm3 + movl $16368, %edx + pinsrw $3, %edx, %xmm3 + xorpd %xmm5, %xmm5 +.L_2TAG_PACKET_0.0.3: + movd %xmm0, %edx + rcpss %xmm0, %xmm1 + movsd 2080(%ebx), %xmm7 + pshuflw $68, %xmm0, %xmm0 + paddd %xmm4, %xmm1 + subl $8388608, %edx + cmpl $2113929216, %edx + jae .L_2TAG_PACKET_1.0.3 + andps %xmm1, %xmm2 + cvtps2pd %xmm0, %xmm0 + cvtps2pd %xmm2, %xmm1 + movd %xmm2, %eax + andl $-8388608, %edx + subl $1056964608, %edx + cvtsi2sdl %edx, %xmm6 + mulsd %xmm1, %xmm0 + subl $1056964608, %edx + addl %edx, %eax + shrl $12, %eax + movsd (%ebx,%eax), %xmm4 + subsd %xmm3, %xmm0 + movsd 2088(%ebx), %xmm2 + movsd 2096(%ebx), %xmm1 + mulsd %xmm0, %xmm7 + addsd %xmm0, %xmm5 + mulsd %xmm0, %xmm0 + mulsd %xmm2, %xmm6 + addsd %xmm7, %xmm1 + addsd %xmm4, %xmm5 + mulsd %xmm1, %xmm0 + addsd %xmm6, %xmm5 + addsd %xmm0, %xmm5 + cvtpd2ps %xmm5, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + addl $8388608, %edx + js .L_2TAG_PACKET_3.0.3 + cmpl $8388608, %edx + jb .L_2TAG_PACKET_4.0.3 + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_5.0.3 + movl $528482304, %eax + movd %eax, %xmm6 + movsd 2064(%ebx), %xmm5 + mulss %xmm6, %xmm0 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_5.0.3: + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $-2147483648, %edx + je .L_2TAG_PACKET_6.0.3 + addl %edx, %edx + cmpl $-16777216, %edx + ja .L_2TAG_PACKET_5.0.3 + xorps %xmm0, %xmm0 + divss %xmm0, %xmm0 + movl $5, %edx +.L_2TAG_PACKET_7.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $0, %edx + je .L_2TAG_PACKET_6.0.3 + movl $1602224128, %eax + movd %eax, %xmm7 + mulss %xmm7, %xmm0 + movsd 2072(%ebx), %xmm5 + jmp .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_6.0.3: + movl $-1082130432, %eax + movd %eax, %xmm0 + xorps %xmm1, %xmm1 + divss %xmm1, %xmm0 + movl $4, %edx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_2.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type logf,@function + .size logf,.-logf + .data +# -- End logf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4277811695 + .long 1072049730 + .long 4099377379 + .long 1072041554 + .long 2854492448 + .long 1072033410 + .long 3783013829 + .long 1072025297 + .long 1547061728 + .long 1072017216 + .long 3705668804 + .long 1072009165 + .long 649825382 + .long 1072001146 + .long 4257004898 + .long 1071993156 + .long 646346839 + .long 1071985198 + .long 1718090839 + .long 1071977269 + .long 2203733529 + .long 1071969370 + .long 1140698018 + .long 1071961501 + .long 1872170015 + .long 1071953661 + .long 3457002416 + .long 1071945850 + .long 669557459 + .long 1071938069 + .long 1179420986 + .long 1071930316 + .long 4076413893 + .long 1071922591 + .long 4165410145 + .long 1071914895 + .long 556124819 + .long 1071907228 + .long 957937516 + .long 1071899588 + .long 204914613 + .long 1071891976 + .long 1730507025 + .long 1071884391 + .long 387544807 + .long 1071876834 + .long 3922939863 + .long 1071869303 + .long 2912783494 + .long 1071861800 + .long 826988438 + .long 1071854324 + .long 1144260235 + .long 1071846874 + .long 3057005434 + .long 1071839450 + .long 1471209283 + .long 1071832053 + .long 4186184763 + .long 1071824681 + .long 1829683463 + .long 1071817336 + .long 2217517956 + .long 1071810016 + .long 288676754 + .long 1071802722 + .long 3875016090 + .long 1071795452 + .long 3636378776 + .long 1071788208 + .long 3125257108 + .long 1071780989 + .long 1606817369 + .long 1071773795 + .long 2648729924 + .long 1071766625 + .long 1236164615 + .long 1071759480 + .long 951558972 + .long 1071752359 + .long 1089617062 + .long 1071745262 + .long 952179194 + .long 1071738189 + .long 4143093266 + .long 1071731139 + .long 1388251237 + .long 1071724114 + .long 600267432 + .long 1071717112 + .long 1108583542 + .long 1071710133 + .long 2249313505 + .long 1071703177 + .long 3365155278 + .long 1071696244 + .long 3805304058 + .long 1071689334 + .long 2925366939 + .long 1071682447 + .long 87278952 + .long 1071675583 + .long 3249155078 + .long 1071668740 + .long 3195405229 + .long 1071661920 + .long 3601425396 + .long 1071655122 + .long 3853649835 + .long 1071648346 + .long 2393914686 + .long 1071638513 + .long 2944026756 + .long 1071625048 + .long 3870651933 + .long 1071611626 + .long 3993180461 + .long 1071598247 + .long 2142264402 + .long 1071584911 + .long 1454642149 + .long 1071571617 + .long 783063308 + .long 1071558365 + .long 3286084979 + .long 1071545154 + .long 3543033726 + .long 1071531985 + .long 438773454 + .long 1071518858 + .long 1458540784 + .long 1071505771 + .long 1212978710 + .long 1071492725 + .long 2912845216 + .long 1071479719 + .long 1189018219 + .long 1071466754 + .long 3567208110 + .long 1071453828 + .long 403064643 + .long 1071440943 + .long 3536762435 + .long 1071428096 + .long 3343209673 + .long 1071415289 + .long 3091669954 + .long 1071402521 + .long 1765778334 + .long 1071389792 + .long 2653362897 + .long 1071377101 + .long 461431547 + .long 1071364449 + .long 2790898835 + .long 1071351834 + .long 71706889 + .long 1071339258 + .long 4217424686 + .long 1071326718 + .long 1380502992 + .long 1071314217 + .long 3491778671 + .long 1071301752 + .long 1015732707 + .long 1071289325 + .long 1605095660 + .long 1071276934 + .long 35977849 + .long 1071264580 + .long 3977575844 + .long 1071252261 + .long 3927305531 + .long 1071239979 + .long 3275478714 + .long 1071227733 + .long 1125340846 + .long 1071215523 + .long 882913881 + .long 1071203348 + .long 1666971274 + .long 1071191208 + .long 2603916163 + .long 1071179103 + .long 2827693557 + .long 1071167033 + .long 1479703759 + .long 1071154998 + .long 2003684347 + .long 1071142997 + .long 3555691467 + .long 1071131030 + .long 1004016924 + .long 1071119098 + .long 2108975630 + .long 1071107199 + .long 1753021246 + .long 1071095334 + .long 3415503221 + .long 1071083502 + .long 1992719281 + .long 1071071704 + .long 977707388 + .long 1071059939 + .long 3870234994 + .long 1071048206 + .long 1291822077 + .long 1071036507 + .long 1050438164 + .long 1071024840 + .long 2370625547 + .long 1071013205 + .long 188394569 + .long 1071001603 + .long 2331021804 + .long 1070990032 + .long 3747176240 + .long 1070978493 + .long 3686719393 + .long 1070966986 + .long 1405669883 + .long 1070955511 + .long 461103529 + .long 1070944067 + .long 121152472 + .long 1070932654 + .long 3954874384 + .long 1070921271 + .long 2652318780 + .long 1070909920 + .long 4089234463 + .long 1070898599 + .long 3262235675 + .long 1070887309 + .long 3763576649 + .long 1070876049 + .long 601221319 + .long 1070864820 + .long 1673619518 + .long 1070853620 + .long 1999843716 + .long 1070842450 + .long 899399508 + .long 1070831310 + .long 1992167703 + .long 1070820199 + .long 313445281 + .long 1070809118 + .long 3788725476 + .long 1070798065 + .long 3168871046 + .long 1070787042 + .long 2094830420 + .long 1070776048 + .long 4212681596 + .long 1070765082 + .long 288676754 + .long 1070754146 + .long 2568927817 + .long 1070743237 + .long 1829681364 + .long 1070732357 + .long 1737005556 + .long 1070721505 + .long 1666870165 + .long 1070710681 + .long 1000063738 + .long 1070699885 + .long 3417111411 + .long 1070689116 + .long 4013324163 + .long 1070678375 + .long 2183652476 + .long 1070667662 + .long 1622638721 + .long 1070656976 + .long 1734435555 + .long 1070646317 + .long 1927726804 + .long 1070635685 + .long 1615681634 + .long 1070625080 + .long 215909304 + .long 1070614502 + .long 1445381777 + .long 1070603950 + .long 870975437 + .long 1070590754 + .long 1823716217 + .long 1070569756 + .long 323875369 + .long 1070548811 + .long 3839688678 + .long 1070527917 + .long 2667883253 + .long 1070507076 + .long 4293333010 + .long 1070486286 + .long 3324205749 + .long 1070465548 + .long 2966718784 + .long 1070444861 + .long 2140157205 + .long 1070424225 + .long 4066729595 + .long 1070403639 + .long 3386588242 + .long 1070383104 + .long 3337621361 + .long 1070362619 + .long 2870475188 + .long 1070342184 + .long 943446189 + .long 1070321799 + .long 817374162 + .long 1070301463 + .long 1465634365 + .long 1070281176 + .long 1869032404 + .long 1070260938 + .long 1015732707 + .long 1070240749 + .long 2196155141 + .long 1070220608 + .long 118003300 + .long 1070200516 + .long 2381031992 + .long 1070180471 + .long 3707175295 + .long 1070160474 + .long 3120348377 + .long 1070140525 + .long 3946380940 + .long 1070120623 + .long 928049556 + .long 1070100769 + .long 1699849154 + .long 1070080961 + .long 1018125008 + .long 1070061200 + .long 2235845747 + .long 1070041485 + .long 122671437 + .long 1070021817 + .long 2339728060 + .long 1070002194 + .long 3669742467 + .long 1069982617 + .long 3196851002 + .long 1069963086 + .long 11572342 + .long 1069943601 + .long 1800682930 + .long 1069924160 + .long 3372322013 + .long 1069904764 + .long 3835803021 + .long 1069885413 + .long 2306589128 + .long 1069866107 + .long 2201204065 + .long 1069846845 + .long 2647241692 + .long 1069827627 + .long 2778278092 + .long 1069808453 + .long 1733817001 + .long 1069789323 + .long 2954203158 + .long 1069770236 + .long 1295667077 + .long 1069751193 + .long 210141498 + .long 1069732193 + .long 3155274661 + .long 1069713235 + .long 709476866 + .long 1069694321 + .long 636640577 + .long 1069675449 + .long 2116286250 + .long 1069656619 + .long 38479793 + .long 1069637832 + .long 2183652476 + .long 1069619086 + .long 3452748429 + .long 1069600382 + .long 3047045639 + .long 1069581720 + .long 173141005 + .long 1069563100 + .long 970708326 + .long 1069541521 + .long 2106590683 + .long 1069504444 + .long 2198475040 + .long 1069467449 + .long 3996141691 + .long 1069430535 + .long 1669613218 + .long 1069393703 + .long 2283901796 + .long 1069356951 + .long 29117219 + .long 1069320280 + .long 1990183441 + .long 1069283688 + .long 2376948508 + .long 1069247176 + .long 3998935692 + .long 1069210743 + .long 1085389880 + .long 1069174390 + .long 760030536 + .long 1069138115 + .long 1566132617 + .long 1069101918 + .long 2056379433 + .long 1069065799 + .long 792781808 + .long 1069029758 + .long 641565395 + .long 1068993794 + .long 183156961 + .long 1068957907 + .long 2302040698 + .long 1068922096 + .long 1301778891 + .long 1068886362 + .long 84804484 + .long 1068850704 + .long 1562410668 + .long 1068815121 + .long 64741293 + .long 1068779614 + .long 2815553124 + .long 1068744181 + .long 4162338635 + .long 1068708823 + .long 2756122533 + .long 1068673540 + .long 1551389854 + .long 1068638331 + .long 3511047527 + .long 1068603195 + .long 3016419377 + .long 1068568133 + .long 3047045639 + .long 1068533144 + .long 296456961 + .long 1068497513 + .long 3221665916 + .long 1068427825 + .long 3697798734 + .long 1068358282 + .long 3453858508 + .long 1068288883 + .long 4234736672 + .long 1068219627 + .long 3506114812 + .long 1068150514 + .long 3044269692 + .long 1068081543 + .long 346010435 + .long 1068012714 + .long 1513453498 + .long 1067944025 + .long 4074027864 + .long 1067875476 + .long 1275317999 + .long 1067807068 + .long 3559777258 + .long 1067738798 + .long 4204867691 + .long 1067670667 + .long 797775935 + .long 1067602675 + .long 3825228429 + .long 1067534819 + .long 2313634884 + .long 1067467101 + .long 672386641 + .long 1067348671 + .long 3960777458 + .long 1067213778 + .long 1220920383 + .long 1067079157 + .long 684247743 + .long 1066944805 + .long 2020150230 + .long 1066810721 + .long 630721729 + .long 1066676905 + .long 535440936 + .long 1066543355 + .long 1486051399 + .long 1066410070 + .long 2227658502 + .long 1066152307 + .long 2743640746 + .long 1065886792 + .long 4184355568 + .long 1065621801 + .long 1971904113 + .long 1065357333 + .long 341338964 + .long 1064833554 + .long 1498975029 + .long 1064306693 + .long 1440057502 + .long 1063257089 + .long 0 + .long 0 + .long 0 + .long 0 + .long 4277811695 + .long 1078341186 + .long 4277811695 + .long 3225824834 + .long 1431655765 + .long 1070945621 + .long 4277811695 + .long 1047932482 + .long 1107282704 + .long 3219128321 + .long 4277811695 + .long 1047932482 + .type static_const_table,@object + .size static_const_table,2112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logl.S b/external/sgx_libm/ia32/logl.S new file mode 100644 index 0000000000..f22a73fb41 --- /dev/null +++ b/external/sgx_libm/ia32/logl.S @@ -0,0 +1,70 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logl.c" + .text +..TXTST0: +# -- Begin logl + .text + .align 16,0x90 + .hidden logl + .globl logl +logl: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $24, %esp + fldt 32(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fstpt (%esp) + call __libm_logl@PLT +..B1.2: + addl $24, %esp + popl %ebx + ret + .align 16,0x90 + .type logl,@function + .size logl,.-logl + .data +# -- End logl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/logl_table.S b/external/sgx_libm/ia32/logl_table.S new file mode 100644 index 0000000000..8bff76cadb --- /dev/null +++ b/external/sgx_libm/ia32/logl_table.S @@ -0,0 +1,560 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_logl_table_256 + .globl __libm_logl_table_256 +__libm_logl_table_256: + .long 0x55d5a000,0x3f600401 + .long 0xf98e1114,0xbce76218 + .long 0x14588000,0x3f781212 + .long 0xf5a30364,0xbcf4abf1 + .long 0xf9684000,0x3f841929 + .long 0xa8bfb25e,0xbcfa20e2 + .long 0x84c74000,0x3f8c3173 + .long 0x18823013,0x3d0f0660 + .long 0x1ac72000,0x3f91a6b9 + .long 0x36a9c5bb,0x3d13861d + .long 0x5d9ac000,0x3f95ba9a + .long 0xe08d78ac,0x3cacbb84 + .long 0x07434000,0x3f99d2a8 + .long 0xeb1d2ef8,0xbd1a0c1f + .long 0x2597c000,0x3f9d6b27 + .long 0xa1a37071,0xbd23fef6 + .long 0xa19e0000,0x3fa0c58f + .long 0x58b17913,0xbd0559d1 + .long 0x78cbc000,0x3fa2954c + .long 0x570c1572,0x3d1c3526 + .long 0x2da98000,0x3fa4a94d + .long 0xbad48944,0xbd23a98f + .long 0xf2d4c000,0x3fa67c94 + .long 0xec19afa2,0xbd029efb + .long 0xb6310000,0x3fa85188 + .long 0xdf4d03fb,0xbd1f2fd5 + .long 0xbe73c000,0x3faa6b8a + .long 0x5c8ed1b8,0xbd20b3b9 + .long 0x06f74000,0x3fac441e + .long 0x6cf5e5d5,0xbd2561c1 + .long 0x13608000,0x3fae1e67 + .long 0xa4275f13,0xbd22f961 + .long 0x11ab8000,0x3faffa69 + .long 0x98381a8f,0x3d23008c + .long 0x9c5da000,0x3fb0ec13 + .long 0xe54ebd73,0x3d180247 + .long 0x643d2000,0x3fb1dbd2 + .long 0x9a20edb0,0xbd1bd36c + .long 0x84fe6000,0x3fb2cc72 + .long 0x34cd5d84,0xbcec742f + .long 0xa7d1e000,0x3fb3bdf5 + .long 0xa5db4ed7,0x3d2cc85e + .long 0x7aa00000,0x3fb4b05d + .long 0x8ddf26e3,0x3d32e053 + .long 0x7ceb8000,0x3fb580db + .long 0x26833e56,0xbd447f01 + .long 0x89364000,0x3fb674f0 + .long 0x4c9d3302,0x3d3a7999 + .long 0x2c6b8000,0x3fb769ef + .long 0xe71892b5,0xbd44b944 + .long 0x27508000,0x3fb85fd9 + .long 0x19970c1c,0xbd35b818 + .long 0x5d594000,0x3fb9335e + .long 0x3abd47da,0x3d23115c + .long 0x20c90000,0x3fba2b02 + .long 0x9c652090,0xbd3a0b35 + .long 0xac1a8000,0x3fbb0004 + .long 0x037f2b35,0x3d1aaf97 + .long 0x769fc000,0x3fbbf968 + .long 0x8d824283,0x3d24218c + .long 0xbfee0000,0x3fbccfed + .long 0x2fe71256,0x3d33a823 + .long 0x63844000,0x3fbda727 + .long 0x1fa71733,0x3d1a8940 + .long 0x7fe10000,0x3fbea325 + .long 0x47e4627a,0x3d2ef30d + .long 0xfedc0000,0x3fbf7be9 + .long 0x2b2b3bc6,0xbd00d05d + .long 0x52ff2000,0x3fc02ab3 + .long 0x5d569b2b,0x3d27ce63 + .long 0x579d2000,0x3fc097ce + .long 0xda652881,0x3ce33742 + .long 0x82280000,0x3fc1178e + .long 0xcc74be04,0xbd4b8421 + .long 0x7dbec000,0x3fc18574 + .long 0x45bd9b49,0x3d3e6744 + .long 0x25f26000,0x3fc1f3b9 + .long 0x9b083633,0xbd15f74e + .long 0x1e6de000,0x3fc2625d + .long 0xf09e3d82,0xbcf52962 + .long 0x0c868000,0x3fc2d161 + .long 0xcb81b4a1,0x3d039d6c + .long 0x97412000,0x3fc340c5 + .long 0xf7d9d386,0xbd37a3dc + .long 0x67580000,0x3fc3b08b + .long 0xf29320fb,0xbd3aade8 + .long 0x08378000,0x3fc40dfb + .long 0xc4f7b685,0x3c9bb453 + .long 0xe8ca6000,0x3fc47e74 + .long 0xb7020316,0xbcf07c95 + .long 0xf6466000,0x3fc4ef51 + .long 0x21c8cd53,0x3d3bc83d + .long 0xe02bc000,0x3fc56092 + .long 0xfe5d989a,0xbd4ae9eb + .long 0x57cd4000,0x3fc5d238 + .long 0x4b74dcf5,0x3d5a6a61 + .long 0x37334000,0x3fc6313a + .long 0x561bc2b2,0x3d4d7641 + .long 0xdabc0000,0x3fc6a399 + .long 0x399a856a,0xbd563e4d + .long 0xdd3d0000,0x3fc70337 + .long 0x1d685519,0xbd4be57a + .long 0x128f8000,0x3fc77654 + .long 0x520d9718,0xbd4ed8b4 + .long 0x2a0b4000,0x3fc7e9d8 + .long 0x605bf1b1,0xbd5ee97b + .long 0x759f8000,0x3fc84a6b + .long 0x0ab7e182,0xbd5768a0 + .long 0xd5f5c000,0x3fc8ab47 + .long 0xf5f4572e,0xbd4cf028 + .long 0x90964000,0x3fc91fe4 + .long 0x79850e19,0x3d481b4e + .long 0x4011c000,0x3fc98163 + .long 0x30b7dd0f,0xbd458a91 + .long 0x07088000,0x3fc9f6c4 + .long 0x5a19605e,0x3d466413 + .long 0x29348000,0x3fca58e7 + .long 0x504551b1,0x3d3e867d + .long 0xc3168000,0x3fcabb55 + .long 0x9a875994,0x3d43acd2 + .long 0x491a0000,0x3fcb1e10 + .long 0xed340663,0xbd402ffc + .long 0x93e38000,0x3fcb94ee + .long 0x47492dd7,0xbd48357e + .long 0xc0674000,0x3fcbf851 + .long 0xd9fbd5aa,0x3d455ef8 + .long 0x54bf4000,0x3fcc5c02 + .long 0x5184bd39,0xbd4c5a15 + .long 0xc9db4000,0x3fccc000 + .long 0x5d57aff9,0xbd1d6d58 + .long 0x99c84000,0x3fcd244d + .long 0x032241dc,0x3d4673ec + .long 0x3fb30000,0x3fcd88e9 + .long 0x0234bf51,0xbd375f28 + .long 0x37eb0000,0x3fcdedd4 + .long 0x565353b4,0xbd40ff6d + .long 0xffe70000,0x3fce530e + .long 0x276041f4,0x3d401212 + .long 0x1648c000,0x3fceb89a + .long 0x16fee901,0xbd2a3b21 + .long 0xfadfc000,0x3fcf1e75 + .long 0x64bb07ee,0xbd5210c5 + .long 0x2ead8000,0x3fcf84a3 + .long 0xb3098725,0xbd1e5438 + .long 0x33ea0000,0x3fcfeb22 + .long 0xde00938b,0x3d2f3418 + .long 0xc7036000,0x3fd028f9 + .long 0xe9f33100,0xbd2f1eb9 + .long 0xe0d96000,0x3fd05c8b + .long 0xc77ccb58,0x3d2ad0f1 + .long 0x8f8ae000,0x3fd085eb + .long 0x3f45fe7b,0x3d3e5d51 + .long 0xe32d2000,0x3fd0b9c8 + .long 0xedbee0d8,0xbd3bbb62 + .long 0x60b78000,0x3fd0edd0 + .long 0x2d8435f5,0x3d0019b5 + .long 0x4cf02000,0x3fd12202 + .long 0xa2415097,0xbd59c089 + .long 0x927ae000,0x3fd14be2 + .long 0xc85685e2,0x3d49a817 + .long 0x8ef18000,0x3fd18061 + .long 0x1bc9638d,0x3d45be80 + .long 0xbe2fc000,0x3fd1b50b + .long 0x3263201f,0x3d38ecd7 + .long 0xc7cf2000,0x3fd1df4c + .long 0x0455f7e4,0x3d30b43f + .long 0x6d0ea000,0x3fd21445 + .long 0xf5d235d7,0x3d58d43e + .long 0x991ec000,0x3fd23ec5 + .long 0x48a2e522,0xbd36dbe4 + .long 0x9f872000,0x3fd2740d + .long 0xfa32bfeb,0xbd5504cf + .long 0xabce0000,0x3fd29ecd + .long 0x8847bb7a,0xbd37f189 + .long 0x02ade000,0x3fd2d466 + .long 0xbb9aa833,0xbd5311a1 + .long 0xb04ea000,0x3fd2ff66 + .long 0xd5f0c8e9,0x3d43a896 + .long 0x4b356000,0x3fd33550 + .long 0xec6206db,0xbd372206 + .long 0x5ec44000,0x3fd36092 + .long 0xf344bbd1,0x3d4eb929 + .long 0xc3336000,0x3fd38bf1 + .long 0xa0f4a8b7,0x3d5e74f4 + .long 0x77332000,0x3fd3c252 + .long 0x4b606bd6,0x3d5183b5 + .long 0x63c16000,0x3fd3edf4 + .long 0xeb4069e1,0x3d407cc1 + .long 0x23d5e000,0x3fd419b4 + .long 0x6ec90e0a,0x3d418e43 + .long 0xe053a000,0x3fd44591 + .long 0x92923d88,0xbd06e958 + .long 0x75b6e000,0x3fd47c91 + .long 0x8b804f1b,0x3d50ad66 + .long 0x41554000,0x3fd4a8b3 + .long 0xe1791b98,0xbd54f6c0 + .long 0x90890000,0x3fd4d4f3 + .long 0x3a9f1441,0x3d19fd79 + .long 0x8da1e000,0x3fd50152 + .long 0x3694fa6b,0x3d5967d6 + .long 0x6347e000,0x3fd52dd0 + .long 0xeb98a049,0xbd46133a + .long 0x3c7b8000,0x3fd55a6d + .long 0xd6cf85a4,0x3d45138e + .long 0x2b110000,0x3fd5925d + .long 0x4b0b521a,0x3d652c81 + .long 0x6b544000,0x3fd5bf40 + .long 0xeb68981c,0xbd227023 + .long 0x3d5c4000,0x3fd5ec43 + .long 0xf6eb1741,0xbd44a472 + .long 0xcdb04000,0x3fd61965 + .long 0xac078912,0xbd53e115 + .long 0x4935c000,0x3fd646a8 + .long 0x6d25a6ca,0xbd4abc23 + .long 0xdd320000,0x3fd6740a + .long 0xb8b270ac,0xbd60b5c4 + .long 0xb74a8000,0x3fd6a18d + .long 0x67b50a45,0xbd639d6d + .long 0x05868000,0x3fd6cf31 + .long 0xddac7ab9,0xbd4e27a6 + .long 0xe8530000,0x3fd6f180 + .long 0x0a20af33,0xbd4e8c49 + .long 0x71b88000,0x3fd71f5d + .long 0x712fcc92,0x3d54efa4 + .long 0xefd68000,0x3fd74d5a + .long 0x30990150,0xbd52a3e5 + .long 0x922bc000,0x3fd77b79 + .long 0xf6201124,0x3d537dc9 + .long 0x889f4000,0x3fd7a9b9 + .long 0x0dd20a44,0xbd630ed1 + .long 0x037ec000,0x3fd7d81b + .long 0x622fc2c1,0xbd42b381 + .long 0x33828000,0x3fd8069e + .long 0xe1da7992,0xbd4b9e42 + .long 0xd3ef8000,0x3fd82996 + .long 0xae7d64a2,0x3d47956a + .long 0x776e0000,0x3fd85855 + .long 0x0cccc887,0xbd6a02a9 + .long 0x58328000,0x3fd88736 + .long 0x1f7fc497,0xbd2988e2 + .long 0x973ac000,0x3fd8aa75 + .long 0x9e0af65a,0xbd3cc466 + .long 0xdc884000,0x3fd8d992 + .long 0xebb56b23,0xbd5b1b77 + .long 0xea7d8000,0x3fd908d2 + .long 0xf0e513c0,0x3d551185 + .long 0xe79c0000,0x3fd92c59 + .long 0x039fe987,0x3d4cac17 + .long 0x50ee4000,0x3fd95bd7 + .long 0x0649244f,0xbd12d6ab + .long 0x11a3c000,0x3fd98b78 + .long 0x3a5b6609,0x3d672da9 + .long 0xf33d4000,0x3fd9af47 + .long 0x59d98c86,0x3cfae14a + .long 0x0c190000,0x3fd9df27 + .long 0x963f4336,0x3d54a786 + .long 0xed150000,0x3fda0325 + .long 0xb0d5e095,0xbd22dc20 + .long 0x02250000,0x3fda3344 + .long 0x40314305,0xbd361cdd + .long 0x5e80c000,0x3fda5772 + .long 0xd1062b1b,0x3d2c172b + .long 0x165dc000,0x3fda87d0 + .long 0x7845f58e,0x3d51991f + .long 0x6c040000,0x3fdaac2e + .long 0xc856ee3b,0xbd3da90d + .long 0x6fdf8000,0x3fdadccc + .long 0x23b48979,0xbd557ef2 + .long 0x3eb20000,0x3fdb015b + .long 0xa4504de4,0xbd586fcd + .long 0x3a638000,0x3fdb323a + .long 0x7a9aa342,0xbd635be0 + .long 0x04464000,0x3fdb56fa + .long 0xad27be67,0xbd56f6ad + .long 0xa659c000,0x3fdb881a + .long 0x58ba5c9c,0xbd2b65ac + .long 0xef3d8000,0x3fdbad0b + .long 0xe4a81b98,0x3d68b265 + .long 0x97780000,0x3fdbd212 + .long 0xa247841c,0x3d5c2f63 + .long 0x36f08000,0x3fdc0392 + .long 0x435af523,0x3d403109 + .long 0x1e4d4000,0x3fdc28cb + .long 0xdc568214,0xbd4a0635 + .long 0xb8474000,0x3fdc4e19 + .long 0x9ad9f32c,0xbd5c3e5b + .long 0xc7454000,0x3fdc7ff9 + .long 0x47d5b6ca,0x3d54c924 + .long 0x64e9c000,0x3fdca57b + .long 0xd12a2803,0x3d5b0510 + .long 0x0a5d0000,0x3fdccb13 + .long 0x48811a12,0xbd545041 + .long 0xd18f4000,0x3fdcf0c0 + .long 0xc2008d44,0xbd4b2160 + .long 0x75b58000,0x3fdd2320 + .long 0x12cccc3a,0x3d610091 + .long 0x46df0000,0x3fdd4902 + .long 0x0b2c4c2c,0xbd365228 + .long 0x918d4000,0x3fdd6efa + .long 0x7676c78e,0xbd5a329d + .long 0x707ac000,0x3fdd9509 + .long 0x77579caf,0x3d6297b8 + .long 0xfe92c000,0x3fddbb2e + .long 0x0943c435,0x3d3550ac + .long 0x3445c000,0x3fddee2f + .long 0x3a0f9d04,0x3d625775 + .long 0x1a274000,0x3fde148a + .long 0x20732293,0xbd59326b + .long 0x0a4a0000,0x3fde3afc + .long 0x573921f0,0xbd080095 + .long 0x206d4000,0x3fde6185 + .long 0xc9807dcf,0x3d516d95 + .long 0x78824000,0x3fde8825 + .long 0xaa15d3d9,0xbd25726d + .long 0x2eac8000,0x3fdeaedd + .long 0xad7934b2,0x3d590c33 + .long 0x5f438000,0x3fded5ac + .long 0x1bc1c15c,0xbd541d1a + .long 0x26d14000,0x3fdefc93 + .long 0x206858e7,0x3d655c54 + .long 0xa2154000,0x3fdf2391 + .long 0x202b7ba5,0x3d6affe2 + .long 0xee030000,0x3fdf4aa7 + .long 0x56f014a9,0x3d592cde + .long 0x27c30000,0x3fdf71d6 + .long 0xe30f87ad,0x3d47600a + .long 0x6cb38000,0x3fdf991c + .long 0xcca0cdf3,0x3d69bcbe + .long 0xda698000,0x3fdfc07a + .long 0x2683bdae,0x3d6487fd + .long 0x8eb04000,0x3fdfe7f1 + .long 0xceb37e7a,0xbd260f51 + .long 0x53c50000,0x3fe007c0 + .long 0xc9c065f1,0x3cf73add + .long 0x2198a000,0x3fe01b94 + .long 0x5498efb5,0x3d4683ab + .long 0x400c8000,0x3fe02f74 + .long 0xe23775e2,0xbd6b154b + .long 0xbe760000,0x3fe04360 + .long 0x030d58c4,0x3d3d6774 + .long 0xac480000,0x3fe05759 + .long 0x83c1e850,0xbd2cc5f3 + .long 0x1911e000,0x3fe06b5f + .long 0x2598b50b,0xbd60ae17 + .long 0x0533c000,0x3fe078bf + .long 0x907b7d7f,0x3d45a048 + .long 0x687e8000,0x3fe08cd9 + .long 0xc00a19af,0xbd43c67f + .long 0x74cfa000,0x3fe0a100 + .long 0x22f73f90,0xbd5fcd6d + .long 0x3a234000,0x3fe0b534 + .long 0x4c68a7e5,0x3d41da30 + .long 0xc8942000,0x3fe0c974 + .long 0xa7cdcbb8,0x3d61cdc0 + .long 0x305ba000,0x3fe0ddc2 + .long 0x566f7df8,0xbd4de684 + .long 0x4bafc000,0x3fe0eb52 + .long 0x7feb3411,0x3d5230c5 + .long 0x4213a000,0x3fe0ffb5 + .long 0xbeeae6be,0x3d41d77b + .long 0x3da98000,0x3fe11425 + .long 0x3d4743ea,0xbd33050e + .long 0x4f1da000,0x3fe128a2 + .long 0x5906450d,0xbd440318 + .long 0x52bf0000,0x3fe13652 + .long 0xa621d4be,0x3d50c985 + .long 0x58b4a000,0x3fe14ae5 + .long 0x9895512f,0x3d525a20 + .long 0xa19c6000,0x3fe15f85 + .long 0xe4dca81e,0x3d665b5b + .long 0x38c12000,0x3fe16d4d + .long 0xaf71a89e,0xbd481628 + .long 0xc20de000,0x3fe18203 + .long 0x4bb7b8b9,0xbd5d995f + .long 0xbc4b2000,0x3fe196c7 + .long 0x14cec2c3,0xbd18a766 + .long 0x38b7a000,0x3fe1a4a7 + .long 0x26042793,0x3d39e2b1 + .long 0xc0c96000,0x3fe1b981 + .long 0x549461ed,0x3d44f378 + .long 0xe8bb0000,0x3fe1ce69 + .long 0xcc3339e5,0x3d606af5 + .long 0x9de06000,0x3fe1dc61 + .long 0xa1767071,0x3d528836 + .long 0xa2ad0000,0x3fe1f160 + .long 0x6c9de298,0x3d5b4741 + .long 0x77406000,0x3fe2066d + .long 0xd051f38d,0x3d637e65 + .long 0xba47c000,0x3fe2147d + .long 0x0cf5c8e9,0xbd6c6c55 + .long 0xbc5ec000,0x3fe229a1 + .long 0xf20d6e42,0xbd44f266 + .long 0x841a6000,0x3fe237c1 + .long 0xa47dba85,0xbd5fa312 + .long 0xe6f82000,0x3fe24cfc + .long 0xb65cb7bb,0xbd626596 + .long 0x55cd6000,0x3fe25b2c + .long 0x2ff856c0,0xbd513b72 + .long 0x4d5f8000,0x3fe2707f + .long 0xc37d4cdf,0xbd3df8b3 + .long 0x842ca000,0x3fe285e0 + .long 0x866d5f22,0x3d3c1c4d + .long 0x4708c000,0x3fe29429 + .long 0x7aca88eb,0xbd5119e8 + .long 0x670b0000,0x3fe2a9a2 + .long 0x1c2e5d10,0xbd1e7864 + .long 0x2c8d2000,0x3fe2b7fb + .long 0x00c270dd,0xbd39fb3c + .long 0x63960000,0x3fe2c65a + .long 0x03be9586,0xbd5415ea + .long 0x57b0e000,0x3fe2dbf5 + .long 0x07b9dc11,0xbd17a6e5 + .long 0xc3f96000,0x3fe2ea64 + .long 0x8b7d46fa,0x3d6654b2 + .long 0x23686000,0x3fe30018 + .long 0x5363d25e,0xbd628cd2 + .long 0xe9a8c000,0x3fe30e97 + .long 0x06943683,0xbd546671 + .long 0xebdd4000,0x3fe32463 + .long 0xc46cb528,0xbd562c21 + .long 0x314ae000,0x3fe332f4 + .long 0x1ea74541,0xbd50d4b6 + .long 0x0e746000,0x3fe348d9 + .long 0x44f828b5,0x3d433f3c + .long 0xf8c44000,0x3fe35779 + .long 0x22a46dd6,0xbd34934a + .long 0x961a8000,0x3fe36621 + .long 0x0cdd9d24,0xbd6566ce + .long 0x9f3c2000,0x3fe37c29 + .long 0x8e5820fe,0x3d666a2b + .long 0x17198000,0x3fe38ae2 + .long 0x576aad35,0xbd52316f + .long 0x57a60000,0x3fe399a1 + .long 0x62286d89,0x3d3f399c + .long 0xfe77c000,0x3fe3afcc + .long 0xedc1a56f,0xbd48bbbb + .long 0x50352000,0x3fe3be9d + .long 0x22f47589,0x3d63b540 + .long 0x80b4a000,0x3fe3cd74 + .long 0x9ebf0b71,0x3d51452e + .long 0x39190000,0x3fe3e3c4 + .long 0x4c617cda,0xbd512753 + .long 0xb27ec000,0x3fe3f2ac + .long 0x8d68a543,0x3d66c6ab + .long 0x2125c000,0x3fe4019c + .long 0xd9e1e717,0x3d552630 + .long 0x6138a000,0x3fe41810 + .long 0xa1618e8d,0xbd51bb4f + .long 0x518de000,0x3fe42711 + .long 0x38d47013,0x3d65455f + .long 0x4e12c000,0x3fe43619 + .long 0xaca69593,0xbd52819e + .long 0x5d68e000,0x3fe44528 + .long 0xf367503a,0x3d54d27f + .long 0x464ca000,0x3fe45bcc + .long 0xa4ffdcb2,0xbd66c5eb + .long 0x21f12000,0x3fe46aed + .long 0xa0df038b,0xbd50072e + .long 0x27e8a000,0x3fe47a15 + .long 0x83594fab,0x3d369a4a + .long 0x5f000000,0x3fe48944 + .long 0x95dc2343,0xbd39a0cf + .long 0xbcb6a000,0x3fe4a018 + .long 0xdb5ebf58,0xbd4f2ae4 + .long 0x0c9d6000,0x3fe4af5a + .long 0xedc4bac0,0x3d475de0 + .long 0xa5bdc000,0x3fe4bea2 + .long 0xefe50211,0xbd278f64 + .long 0x8f10c000,0x3fe4cdf2 + .long 0x7690ed86,0xbd63b982 + .long 0xcf994000,0x3fe4dd49 + .long 0x24d59d34,0x3d061972 + .long 0x6e64a000,0x3fe4eca8 + .long 0xb1079278,0x3d4a0e67 + .long 0x3cd90000,0x3fe503c4 + .long 0x0f1a734d,0xbd6497fc + .long 0x6667e000,0x3fe51335 + .long 0x4c9987aa,0x3d6c5739 + .long 0x0738a000,0x3fe522ae + .long 0x8164c759,0x3d3ebe70 + .long 0x26868000,0x3fe5322e + .long 0xba2da8ad,0xbd4ea333 + .long 0xcb978000,0x3fe541b5 + .long 0x62e3a6b9,0x3d680916 + .long 0xfdbcc000,0x3fe55144 + .long 0x2b35ba3e,0xbd34ec53 + .long 0xc4518000,0x3fe560db + .long 0x776b86a6,0xbd761cb6 + .long 0x26bb8000,0x3fe5707a + .long 0x5ff9981f,0x3d58ccc0 + .long 0x0ed5c000,0x3fe587f6 + .long 0xe6cce4c9,0xbd4c00c2 + .long 0x977cc000,0x3fe597a7 + .long 0xf6a33533,0xbd786770 + .long 0xd6348000,0x3fe5a760 + .long 0x365e53d9,0x3d7dc57c + .long 0xd2960000,0x3fe5b721 + .long 0x4f6ab8cd,0xbd5de23a + .long 0x94434000,0x3fe5c6ea + .long 0xa68978ec,0xbd70837e + .long 0x22ea8000,0x3fe5d6bb + .long 0xea2eecbe,0x3d4bd7d0 + .long 0x86460000,0x3fe5e693 + .long 0x23677de5,0xbd763831 + .long 0xc61a4000,0x3fe5f673 + .long 0x7a110a0e,0xbd612e5c + .long 0xea384000,0x3fe6065b + .long 0xc49e2cb9,0x3d692622 + .long 0xfa7cc000,0x3fe6164b + .long 0x27c383a0,0x3d0ad6c4 + .long 0xfecfc000,0x3fe62643 + .long 0x3ae25ed1,0xbd745e87 + .type __libm_logl_table_256,@object + .size __libm_logl_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lrint_wmt.S b/external/sgx_libm/ia32/lrint_wmt.S new file mode 100644 index 0000000000..5be751fc71 --- /dev/null +++ b/external/sgx_libm/ia32/lrint_wmt.S @@ -0,0 +1,188 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lrint_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin lrint + .text + .align 16,0x90 + .globl lrint +lrint: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movsd %xmm0, 16(%esp) + pextrw $3, %xmm0, %ecx + andl $32767, %ecx + cmpl $16863, %ecx + jge .L_2TAG_PACKET_0.0.3 +.L_2TAG_PACKET_1.0.3: + cvtsd2si %xmm0, %eax + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + comisd (%ebx), %xmm0 + jp .L_2TAG_PACKET_3.0.3 + ja .L_2TAG_PACKET_4.0.3 + ucomisd 16(%ebx), %xmm0 + jb .L_2TAG_PACKET_5.0.3 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_5.0.3: + ucomisd 32(%ebx), %xmm0 + ja .L_2TAG_PACKET_6.0.3 + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_4.0.3: + ucomisd 48(%ebx), %xmm0 + jb .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_7.0.3: + movl $-2147483648, %eax + movss 64(%ebx), %xmm1 + subss %xmm1, %xmm1 + movl %eax, 8(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $184, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl 8(%esp), %eax + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + movl $-2147483648, %eax + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + stmxcsr (%esp) + movl (%esp), %eax + andl $-2, %eax + movl %eax, (%esp) + ldmxcsr (%esp) + cvtsd2si %xmm0, %eax + stmxcsr (%esp) + movl (%esp), %edx + testl $1, %edx + jne .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_2.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type lrint,@function + .size lrint,.-lrint + .data +# -- End lrint + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4290772992 + .long 1105199103 + .long 4290772992 + .long 1105199103 + .long 0 + .long 3252682752 + .long 0 + .long 3252682752 + .long 2097152 + .long 3252682752 + .long 2097152 + .long 3252682752 + .long 0 + .long 1105199104 + .long 0 + .long 1105199104 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .type static_const_table,@object + .size static_const_table,80 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lrintf_wmt.S b/external/sgx_libm/ia32/lrintf_wmt.S new file mode 100644 index 0000000000..9a3925257b --- /dev/null +++ b/external/sgx_libm/ia32/lrintf_wmt.S @@ -0,0 +1,153 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lrintf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin lrintf + .text + .align 16,0x90 + .globl lrintf +lrintf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movss 128(%esp), %xmm0 + movss %xmm0, 16(%esp) + pextrw $1, %xmm0, %ecx + andl $32640, %ecx + cmpl $20224, %ecx + jge .L_2TAG_PACKET_0.0.3 + cvtss2si %xmm0, %eax + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + comiss (%ebx), %xmm0 + jp .L_2TAG_PACKET_2.0.3 + je .L_2TAG_PACKET_3.0.3 + movl $-2147483648, %eax + movss 16(%ebx), %xmm1 + subss %xmm1, %xmm1 + movl %eax, 8(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $185, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl 8(%esp), %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: +.L_2TAG_PACKET_3.0.3: + movl $-2147483648, %eax +.L_2TAG_PACKET_1.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type lrintf,@function + .size lrintf,.-lrintf + .data +# -- End lrintf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 3472883712 + .long 3472883712 + .long 3472883712 + .long 3472883712 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .type static_const_table,@object + .size static_const_table,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lrintl.S b/external/sgx_libm/ia32/lrintl.S new file mode 100644 index 0000000000..139d84c86c --- /dev/null +++ b/external/sgx_libm/ia32/lrintl.S @@ -0,0 +1,292 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lrintl.c" + .text +..TXTST0: +# -- Begin lrintl + .text + .align 16,0x90 + .globl lrintl +lrintl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + movzbl 17(%ebp), %edi + movzwl 16(%ebp), %ebx + andl $128, %edi + andl $32767, %ebx + shrl $7, %edi + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + cmpl $16413, %ebx + jge ..B1.8 +..B1.2: + testl %ebx, %ebx + jne ..B1.6 +..B1.3: + cmpl $0, 12(%ebp) + jne ..B1.5 +..B1.4: + cmpl $0, 8(%ebp) + je ..B1.6 +..B1.5: + fldl _smallest_value_64@GOTOFF(%esi) + fstpl 16(%esp) +..B1.6: + fldt 8(%ebp) + fistpl 36(%esp) +..B1.7: + movl 36(%esp), %eax + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.8: + cmpl $16415, %ebx + jge ..B1.28 +..B1.9: + lea 2147483647(%edi), %eax + movl %eax, 12(%esp) +..B1.10: + fnstcw 32(%esp) +..B1.11: + movzwl 32(%esp), %eax + andl $3072, %eax + movl %eax, 28(%esp) + cmpl $16414, %ebx + movl 8(%ebp), %eax + movl 12(%ebp), %edx + movl %eax, 24(%esp) + jge ..B1.14 +..B1.12: + cmpl $0, 24(%esp) + movl %edx, %ecx + movl $0, %eax + setne %al + shll $31, %ecx + orl %ecx, %eax + movl %eax, 24(%esp) +..B1.14: + movl %ebx, %ecx + negl %ecx + addl $30, %ecx + shrl %cl, %edx + cmpl $0, 28(%esp) + jne ..B1.16 +..B1.15: + testl $2147483647, %eax + movl %edi, (%esp) + movl %eax, %edi + movl $0, %eax + movl %eax, %ecx + setne %cl + shrl $31, %edi + orl %edx, %ecx + andl %ecx, %edi + xorl %ecx, %ecx + addl %edi, %edx + movl (%esp), %edi + adcl $0, %ecx + jmp ..B1.24 +..B1.16: + cmpl $2048, 28(%esp) + jne ..B1.18 +..B1.17: + testl %edi, %edi + movl $0, %eax + setne %al + movl %eax, (%esp) + jmp ..B1.19 +..B1.18: + movl $0, (%esp) + cmpl $1024, 28(%esp) + je ..B1.20 +..B1.19: + movl $0, 4(%esp) + jmp ..B1.21 +..B1.20: + testl %edi, %edi + movl $0, %eax + sete %al + movl %eax, 4(%esp) +..B1.21: + cmpl $3072, 28(%esp) + movl $0, %eax + sete %al + xorl %ecx, %ecx + orl (%esp), %eax + orl 4(%esp), %eax + jne ..B1.24 +..B1.23: + cmpl $0, 24(%esp) + movl $0, %eax + setne %al + addl %eax, %edx + adcl $0, %ecx +..B1.24: + movl %edx, %eax + subl 12(%esp), %eax + movl %eax, (%esp) + movl $0, %eax + sbbl %eax, %ecx + jb ..B1.25 +..B1.39: + movl (%esp), %eax + orl %ecx, %eax + jne ..B1.28 +..B1.25: + cmpl $0, 24(%esp) + je ..B1.27 +..B1.26: + fldl _ones@GOTOFF(%esi) + movl %edx, 36(%esp) + faddl _small_value_64@GOTOFF(%esi) + fstpl 16(%esp) +..B1.27: + movl %edx, %eax + negl %eax + testl %edi, %edi + jne ..L3 + movl %edx, %eax +..L3: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.28: + fldl _infs@GOTOFF(%esi) + cmpl $32767, %ebx + fmull _zeros@GOTOFF(%esi) + fstpl 16(%esp) + movl $-2147483648, 36(%esp) + jne ..B1.31 +..B1.29: + cmpl $-2147483648, 12(%ebp) + jne ..B1.36 +..B1.30: + cmpl $0, 8(%ebp) + jne ..B1.36 +..B1.31: + fnstcw 10(%esp) +..B1.32: + movzwl 10(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.33: + orl $-64768, %edx + movw %dx, 8(%esp) +..B1.34: + fldcw 8(%esp) +..B1.35: + fldcw 10(%esp) +..B1.36: + movl 36(%esp), %eax + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type lrintl,@function + .size lrintl,.-lrintl + .data +# -- End lrintl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lround_wmt.S b/external/sgx_libm/ia32/lround_wmt.S new file mode 100644 index 0000000000..1b3502a60d --- /dev/null +++ b/external/sgx_libm/ia32/lround_wmt.S @@ -0,0 +1,220 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lround_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin lround + .text + .align 16,0x90 + .globl lround +lround: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movq %xmm0, 16(%esp) + movq 16(%ebx), %xmm4 + movq 64(%ebx), %xmm5 + movq 96(%ebx), %xmm3 + movq (%ebx), %xmm1 + movdqa %xmm4, %xmm2 + pandn %xmm0, %xmm4 + pand %xmm0, %xmm2 + por %xmm5, %xmm2 + pextrw $3, %xmm0, %eax + andl $32752, %eax + subl $16368, %eax + cmpl $480, %eax + jae .L_2TAG_PACKET_0.0.3 + psrlq $52, %xmm4 + psubq %xmm4, %xmm3 + psllq %xmm3, %xmm1 + addsd %xmm2, %xmm0 + pand %xmm1, %xmm0 + cvttsd2si %xmm0, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + js .L_2TAG_PACKET_2.0.3 + movdqa %xmm2, %xmm6 + movq 80(%ebx), %xmm7 + psrlq $63, %xmm6 + paddq %xmm6, %xmm7 + cmpl $512, %eax + jge .L_2TAG_PACKET_3.0.3 + movq 48(%ebx), %xmm2 + addsd %xmm4, %xmm5 + psrlq $52, %xmm4 + psubq %xmm4, %xmm3 + movd %xmm6, %edx + psllq %xmm3, %xmm1 + pand %xmm1, %xmm5 + addsd %xmm2, %xmm5 + por %xmm7, %xmm2 + movd %xmm5, %eax + psubd %xmm5, %xmm2 + pmovmskb %xmm2, %ecx + andl $136, %ecx + jne .L_2TAG_PACKET_3.0.3 + testl %edx, %edx + je .L_2TAG_PACKET_4.0.3 + negl %eax +.L_2TAG_PACKET_4.0.3: + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + addl $16, %eax + js .L_2TAG_PACKET_5.0.3 + addsd %xmm2, %xmm2 + cvttsd2si %xmm2, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_5.0.3: + xorl %eax, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movq 32(%ebx), %xmm1 + movl $-2147483648, %eax + pxor %xmm2, %xmm2 + movd %eax, %xmm7 + mulsd %xmm2, %xmm1 + ucomisd %xmm0, %xmm0 + jc .L_2TAG_PACKET_6.0.3 + movq %xmm7, 8(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $190, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl 8(%esp), %eax +.L_2TAG_PACKET_6.0.3: +.L_2TAG_PACKET_1.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type lround,@function + .size lround,.-lround + .data +# -- End lround + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 2147483647 + .long 0 + .long 2147483647 + .long 0 + .long 1075 + .long 0 + .long 1075 + .long 0 + .type static_const_table,@object + .size static_const_table,112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lroundf_wmt.S b/external/sgx_libm/ia32/lroundf_wmt.S new file mode 100644 index 0000000000..d8a462096b --- /dev/null +++ b/external/sgx_libm/ia32/lroundf_wmt.S @@ -0,0 +1,228 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lroundf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin lroundf + .text + .align 16,0x90 + .globl lroundf +lroundf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movss 128(%esp), %xmm0 + movss %xmm0, 16(%esp) + movd 16(%ebx), %xmm4 + movd 64(%ebx), %xmm5 + movd 112(%ebx), %xmm3 + movd (%ebx), %xmm1 + movdqa %xmm4, %xmm2 + pandn %xmm0, %xmm4 + pand %xmm0, %xmm2 + por %xmm5, %xmm2 + pextrw $1, %xmm0, %eax + andl $32640, %eax + subl $16256, %eax + cmpl $2944, %eax + jae .L_2TAG_PACKET_0.0.3 + psrld $23, %xmm4 + psubd %xmm4, %xmm3 + pslld %xmm3, %xmm1 + addss %xmm2, %xmm0 + pand %xmm1, %xmm0 + cvttss2si %xmm0, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_0.0.3: + js .L_2TAG_PACKET_2.0.3 + cmpl $3840, %eax + jae .L_2TAG_PACKET_3.0.3 + cvttss2si %xmm0, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + movdqa %xmm2, %xmm6 + movd 32(%ebx), %xmm7 + psrld $31, %xmm6 + paddd %xmm6, %xmm7 + cmpl $4096, %eax + jge .L_2TAG_PACKET_4.0.3 + movd 96(%ebx), %xmm5 + movd 80(%ebx), %xmm2 + psrld $23, %xmm4 + pand %xmm0, %xmm5 + psubd %xmm3, %xmm4 + por %xmm2, %xmm5 + movd %xmm6, %edx + psllq %xmm4, %xmm5 + movd %xmm5, %eax + psubd %xmm5, %xmm7 + pmovmskb %xmm7, %ecx + andl $136, %ecx + jne .L_2TAG_PACKET_4.0.3 + testl %edx, %edx + je .L_2TAG_PACKET_5.0.3 + negl %eax +.L_2TAG_PACKET_5.0.3: + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + addl $128, %eax + js .L_2TAG_PACKET_6.0.3 + addss %xmm2, %xmm2 + cvttss2si %xmm2, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + xorl %eax, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_4.0.3: + movd 48(%ebx), %xmm1 + movl $-2147483648, %eax + pxor %xmm2, %xmm2 + movd %eax, %xmm7 + mulss %xmm2, %xmm1 + ucomiss %xmm0, %xmm0 + jc .L_2TAG_PACKET_7.0.3 + movq %xmm7, 8(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 128(%esp), %eax + movl %eax, 4(%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $191, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movl 8(%esp), %eax +.L_2TAG_PACKET_7.0.3: +.L_2TAG_PACKET_1.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type lroundf,@function + .size lroundf,.-lroundf + .data +# -- End lroundf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 2147483648 + .long 2147483648 + .long 2147483648 + .long 2147483648 + .long 2147483647 + .long 2147483647 + .long 2147483647 + .long 2147483647 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .long 2139095040 + .long 1056964608 + .long 1056964608 + .long 1056964608 + .long 1056964608 + .long 8388608 + .long 8388608 + .long 8388608 + .long 8388608 + .long 8388607 + .long 8388607 + .long 8388607 + .long 8388607 + .long 150 + .long 150 + .long 150 + .long 150 + .type static_const_table,@object + .size static_const_table,128 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/lroundl.S b/external/sgx_libm/ia32/lroundl.S new file mode 100644 index 0000000000..df2caf23a8 --- /dev/null +++ b/external/sgx_libm/ia32/lroundl.S @@ -0,0 +1,253 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lroundl.c" + .text +..TXTST0: +# -- Begin lroundl + .text + .align 16,0x90 + .globl lroundl +lroundl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $20, %esp + movzbl 17(%ebp), %edi + movzwl 16(%ebp), %esi + andl $128, %edi + andl $32767, %esi + shrl $7, %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $16413, %esi + jge ..B1.11 +..B1.2: + cmpl $16383, %esi + jge ..B1.10 +..B1.3: + cmpl $16382, %esi + jge ..B1.9 +..B1.4: + testl %esi, %esi + jne ..B1.8 +..B1.5: + cmpl $0, 12(%ebp) + jne ..B1.7 +..B1.6: + cmpl $0, 8(%ebp) + je ..B1.8 +..B1.7: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl 8(%esp) +..B1.8: + xorl %eax, %eax + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.9: + movl iones@GOTOFF(%ebx,%edi,4), %eax + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.10: + negl %esi + movl 12(%ebp), %eax + movl %eax, %edx + lea 30(%esi), %ecx + addl $29, %esi + shrl %cl, %edx + movl %esi, %ecx + shrl %cl, %eax + andl $1, %eax + addl %eax, %edx + movl %edx, %eax + negl %eax + testl %edi, %edi + jne ..L3 + movl %edx, %eax +..L3: + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + cmpl $16415, %esi + jge ..B1.17 +..B1.12: + movl %esi, %ecx + lea 2147483647(%edi), %edx + negl %ecx + movl %edx, 4(%esp) + addl $30, %ecx + movl 12(%ebp), %edx + movl %edx, %eax + shrl %cl, %eax + cmpl $16414, %esi + jge ..B1.14 +..B1.13: + andl $1, %edx + addl %eax, %edx + movl $0, %eax + adcl $0, %eax + jmp ..B1.15 +..B1.14: + movl 8(%ebp), %edx + shrl $31, %edx + addl %eax, %edx + movl $0, %eax + adcl $0, %eax +..B1.15: + movl %edx, %ecx + subl 4(%esp), %ecx + movl %ecx, 16(%esp) + movl $0, %ecx + sbbl %ecx, %eax + jb ..B1.16 +..B1.28: + movl 16(%esp), %ecx + orl %eax, %ecx + jne ..B1.17 +..B1.16: + movl %edx, %eax + negl %eax + testl %edi, %edi + jne ..L4 + movl %edx, %eax +..L4: + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + fldl _infs@GOTOFF(%ebx) + cmpl $32767, %esi + fmull _zeros@GOTOFF(%ebx) + fstpl 8(%esp) + jne ..B1.20 +..B1.18: + cmpl $-2147483648, 12(%ebp) + jne ..B1.25 +..B1.19: + cmpl $0, 8(%ebp) + jne ..B1.25 +..B1.20: + fnstcw 2(%esp) +..B1.21: + movzwl 2(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.25 +..B1.22: + orl $-64768, %edx + movw %dx, (%esp) +..B1.23: + fldcw (%esp) +..B1.24: + fldcw 2(%esp) +..B1.25: + movl $-2147483648, %eax + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type lroundl,@function + .size lroundl,.-lroundl + .data +# -- End lroundl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/modf_wmt.S b/external/sgx_libm/ia32/modf_wmt.S new file mode 100644 index 0000000000..ca77aede89 --- /dev/null +++ b/external/sgx_libm/ia32/modf_wmt.S @@ -0,0 +1,150 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "modf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin modf + .text + .align 16,0x90 + .globl modf +modf: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movsd %xmm0, 16(%esp) + movapd %xmm0, %xmm1 + movq (%ebx), %xmm2 + movq 32(%ebx), %xmm5 + movl 136(%esp), %ecx + movdqa %xmm1, %xmm0 + psrlq $52, %xmm1 + pand %xmm0, %xmm5 + movq 16(%ebx), %xmm3 + movd %xmm1, %eax + andl $2047, %eax + subl $1023, %eax + js .L_2TAG_PACKET_0.0.2 + cmpl $52, %eax + jae .L_2TAG_PACKET_1.0.2 + pand %xmm3, %xmm1 + movdqa %xmm0, %xmm4 + psubd %xmm1, %xmm2 + psrlq %xmm2, %xmm4 + psllq %xmm2, %xmm4 + movq %xmm4, (%ecx) + subsd %xmm4, %xmm0 + por %xmm5, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + movq %xmm5, (%ecx) + fldl 16(%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + ucomisd %xmm0, %xmm0 + jp .L_2TAG_PACKET_3.0.2 + movq %xmm0, (%ecx) + movq %xmm5, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_3.0.2: + mulsd %xmm0, %xmm0 + movq %xmm0, (%ecx) + movq %xmm0, (%esp) + fldl (%esp) +.L_2TAG_PACKET_2.0.2: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type modf,@function + .size modf,.-modf + .data +# -- End modf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1075 + .long 0 + .long 1075 + .long 0 + .long 2047 + .long 0 + .long 2047 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .type static_const_table,@object + .size static_const_table,48 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/modff.S b/external/sgx_libm/ia32/modff.S new file mode 100644 index 0000000000..6cef6fb071 --- /dev/null +++ b/external/sgx_libm/ia32/modff.S @@ -0,0 +1,132 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "modff.c" + .text +..TXTST0: +# -- Begin modff + .text + .align 16,0x90 + .globl modff +modff: +# parameter 1: 12 + %esp +# parameter 2: 16 + %esp +..B1.1: +..L1: + + pushl %ebx + pushl %ebp + movl 12(%esp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + movl 16(%esp), %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea -1065353216(%ecx), %ebp + cmpl $192937984, %ebp + jae ..B1.6 +..B1.2: + shrl $23, %ecx + movl $-1, %ebp + negl %ecx + addl $22, %ecx + shll %cl, %ebp + movl %ebp, %ecx + andl %eax, %ebp + notl %ecx + movl %ebp, (%edx) + testl %ecx, %eax + je ..B1.4 +..B1.3: + flds 12(%esp) + fsubs (%edx) + popl %ebp + popl %ebx + ret +..B1.4: + shrl $31, %eax + flds _zeros@GOTOFF(%ebx,%eax,4) +..B1.5: + popl %ebp + popl %ebx + ret +..B1.6: + movl %eax, %ebp + shrl $31, %ebp + cmpl $2139095040, %ecx + ja ..B1.11 +..B1.7: + cmpl $1065353216, %ecx + jbe ..B1.9 +..B1.8: + flds _zeros@GOTOFF(%ebx,%ebp,4) + movl %eax, (%edx) + popl %ebp + popl %ebx + ret +..B1.9: + flds 12(%esp) + movl _zeros@GOTOFF(%ebx,%ebp,4), %eax + movl %eax, (%edx) +..B1.10: + popl %ebp + popl %ebx + ret +..B1.11: + flds 12(%esp) + fadd %st(0), %st + fsts (%edx) + popl %ebp + popl %ebx + ret + .align 16,0x90 + .type modff,@function + .size modff,.-modff + .data +# -- End modff + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/modfl.S b/external/sgx_libm/ia32/modfl.S new file mode 100644 index 0000000000..fff4efcbc1 --- /dev/null +++ b/external/sgx_libm/ia32/modfl.S @@ -0,0 +1,263 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "modfl.c" + .text +..TXTST0: +# -- Begin modfl + .text + .align 16,0x90 + .globl modfl +modfl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %ebx + subl $24, %esp + movl 20(%ebp), %edx +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $16446, %ecx + jge ..B1.21 +..B1.4: + cmpl $16383, %ecx + jl ..B1.16 +..B1.5: + fldt 8(%ebp) + cmpl $16415, %ecx + fstpt (%esp) + jge ..B1.7 +..B1.6: + negl %ecx + movl $-1, %ebx + addl $30, %ecx + shll %cl, %ebx + movl %ebx, %ecx + notl %ecx + movl 12(%ebp), %esi + andl %esi, %ecx + andl %ebx, %esi + xorl %ebx, %ebx + orl 8(%ebp), %ecx + movl %esi, 12(%ebp) + jmp ..B1.8 +..B1.7: + negl %ecx + movl $-1, %ebx + addl $30, %ecx + shll %cl, %ebx + movl %ebx, %ecx + notl %ecx + movl 8(%ebp), %esi + andl %esi, %ecx + andl %esi, %ebx +..B1.8: + movl %ebx, 8(%ebp) + testl %ecx, %ecx + je ..B1.14 +..B1.9: + movzwl 14(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.23 +..B1.10: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.11: + fldcw 12(%esp) +..B1.12: + fldt 8(%ebp) + fstpt (%edx) + fldt (%edx) + fldt (%esp) + fsubp %st, %st(1) + fstpt (%esp) +..B1.13: + fldcw 14(%esp) + jmp ..B1.15 +..B1.14: + fldt 8(%ebp) + fstpt (%edx) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _zeros@GOTOFF(%eax,%edx,8) + fstpt (%esp) +..B1.15: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + testl %ecx, %ecx + jne ..B1.20 +..B1.17: + cmpl $0, 12(%ebp) + jne ..B1.19 +..B1.18: + cmpl $0, 8(%ebp) + je ..B1.20 +..B1.19: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.20: + movzbl 17(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + fldl _zeros@GOTOFF(%eax,%ecx,8) + fstpt (%edx) + fldt 8(%ebp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.21: + cmpl $32767, %ecx + je ..B1.24 +..B1.22: + fldt 8(%ebp) + fstpt (%edx) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _zeros@GOTOFF(%eax,%edx,8) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + fldt 8(%ebp) + fstpt (%edx) + fldt (%edx) + fldt (%esp) + fsubp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.24: + cmpl $-2147483648, 12(%ebp) + jne ..B1.26 +..B1.25: + cmpl $0, 8(%ebp) + je ..B1.22 +..B1.26: + movzwl 14(%esp), %ebx + movl %ebx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.32 +..B1.27: + orl $-64768, %ebx + movw %bx, 12(%esp) +..B1.28: + fldcw 12(%esp) +..B1.29: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) + fldt (%esp) + fstpt (%edx) +..B1.30: + fldcw 14(%esp) +..B1.31: + fldt (%esp) + addl $24, %esp + popl %ebx + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) + fldt (%esp) + fstpt (%edx) + jmp ..B1.31 + .align 16,0x90 + .type modfl,@function + .size modfl,.-modfl + .data +# -- End modfl + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nan.S b/external/sgx_libm/ia32/nan.S new file mode 100644 index 0000000000..a112ca9b8a --- /dev/null +++ b/external/sgx_libm/ia32/nan.S @@ -0,0 +1,120 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nan.c" + .text +..TXTST0: +# -- Begin nanf + .text + .align 16,0x90 + .globl nanf +nanf: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + subl $24, %esp + pushl 28(%esp) + call __libm_conv_strtoull +..B1.2: + andl $4194303, %eax + orl $2143289344, %eax + movl %eax, 16(%esp) + flds 16(%esp) + addl $28, %esp + ret + .align 16,0x90 + .type nanf,@function + .size nanf,.-nanf + .data +# -- End nanf + .text +# -- Begin nan + .text + .align 16,0x90 + .globl nan +nan: +# parameter 1: 32 + %esp +..B2.1: +..L2: + + subl $24, %esp + pushl 28(%esp) + call __libm_conv_strtoull +..B2.2: + andl $524287, %edx + orl $2146959360, %edx + movl %eax, 16(%esp) + movl %edx, 20(%esp) + fldl 16(%esp) + addl $28, %esp + ret + .align 16,0x90 + .type nan,@function + .size nan,.-nan + .data +# -- End nan + .text +# -- Begin nanl + .text + .align 16,0x90 + .globl nanl +nanl: +# parameter 1: 32 + %esp +..B3.1: +..L3: + + subl $24, %esp + pushl 28(%esp) + call __libm_conv_strtoull +..B3.2: + movl %eax, 16(%esp) + orl $-1073741824, %edx + movl $32767, %eax + movl %edx, 20(%esp) + movw %ax, 24(%esp) + fldt 16(%esp) + addl $28, %esp + ret + .align 16,0x90 + .type nanl,@function + .size nanl,.-nanl + .data +# -- End nanl + .data + .hidden __libm_conv_strtoull + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nearbyint_wmt.S b/external/sgx_libm/ia32/nearbyint_wmt.S new file mode 100644 index 0000000000..19391794e1 --- /dev/null +++ b/external/sgx_libm/ia32/nearbyint_wmt.S @@ -0,0 +1,295 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nearbyint_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin nearbyint + .text + .align 16,0x90 + .globl nearbyint +nearbyint: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + pextrw $3, %xmm0, %ecx + movl $32752, %eax + andl %ecx, %eax + cmpl $17200, %eax + jge .L_2TAG_PACKET_0.0.2 + fnstcw 8(%esp) + subl $16368, %eax + jl .L_2TAG_PACKET_1.0.2 + movzwl 8(%esp), %edx + andl $3072, %edx + jne .L_2TAG_PACKET_2.0.2 + movq (%ebx), %xmm1 + movq 16(%ebx), %xmm2 + pand %xmm0, %xmm1 + movq 32(%ebx), %xmm4 + movq 32(%ebx), %xmm3 + psubq 48(%ebx), %xmm1 + pand %xmm0, %xmm2 + psrlq $52, %xmm1 + movapd %xmm0, %xmm5 + psllq %xmm1, %xmm0 + por 48(%ebx), %xmm2 + pand %xmm0, %xmm4 + pand 64(%ebx), %xmm0 + psrlq %xmm1, %xmm3 + por 80(%ebx), %xmm0 + por 48(%ebx), %xmm4 + pandn %xmm5, %xmm3 + cmpeqsd 96(%ebx), %xmm0 + cmpnlesd 96(%ebx), %xmm4 + por %xmm4, %xmm0 + pand %xmm2, %xmm0 + addsd %xmm3, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + cmpl $3072, %edx + je .L_2TAG_PACKET_4.0.2 + testl $1024, %edx + je .L_2TAG_PACKET_5.0.2 + movq (%ebx), %xmm1 + pand %xmm0, %xmm1 + xorpd %xmm2, %xmm2 + movq 32(%ebx), %xmm3 + psubq 48(%ebx), %xmm1 + movapd %xmm0, %xmm5 + xorpd %xmm4, %xmm4 + psrlq $52, %xmm1 + cmpnlesd %xmm0, %xmm2 + psllq %xmm1, %xmm0 + pand 32(%ebx), %xmm0 + pcmpeqd %xmm4, %xmm0 + psrlq %xmm1, %xmm3 + pshufd $1, %xmm0, %xmm4 + pandn %xmm5, %xmm3 + pand %xmm4, %xmm0 + pandn %xmm2, %xmm0 + pand 48(%ebx), %xmm0 + subsd %xmm0, %xmm3 + movq %xmm3, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_5.0.2: + movq (%ebx), %xmm1 + pand %xmm0, %xmm1 + xorpd %xmm2, %xmm2 + movq 32(%ebx), %xmm3 + psubq 48(%ebx), %xmm1 + movapd %xmm0, %xmm5 + xorpd %xmm4, %xmm4 + psrlq $52, %xmm1 + cmplesd %xmm0, %xmm2 + psllq %xmm1, %xmm0 + pand 32(%ebx), %xmm0 + pcmpeqd %xmm4, %xmm0 + psrlq %xmm1, %xmm3 + pshufd $1, %xmm0, %xmm4 + pandn %xmm5, %xmm3 + pand %xmm4, %xmm0 + pandn %xmm2, %xmm0 + pand 48(%ebx), %xmm0 + addsd %xmm3, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + movq (%ebx), %xmm1 + pand %xmm0, %xmm1 + movq 32(%ebx), %xmm3 + psubq 48(%ebx), %xmm1 + psrlq $52, %xmm1 + psrlq %xmm1, %xmm3 + pandn %xmm0, %xmm3 + movq %xmm3, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_1.0.2: + movzwl 8(%esp), %edx + andl $3072, %edx + jne .L_2TAG_PACKET_6.0.2 + andpd 112(%ebx), %xmm0 + addl $16, %eax + shrl $14, %ecx + shrl $31, %eax + ucomisd 128(%ebx), %xmm0 + je .L_2TAG_PACKET_7.0.2 + andl $2, %ecx + orl %ecx, %eax + flds 144(%ebx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_7.0.2: + shrl $15, %ecx + flds 160(%ebx,%ecx,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_6.0.2: + cmpl $3072, %edx + je .L_2TAG_PACKET_8.0.2 + testl $1024, %edx + je .L_2TAG_PACKET_9.0.2 + pxor %xmm1, %xmm1 + cmpnlesd %xmm0, %xmm1 + movd %xmm1, %eax + shrl $15, %ecx + subl %eax, %ecx + flds 176(%ebx,%ecx,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_9.0.2: + pxor %xmm1, %xmm1 + cmpnltsd %xmm0, %xmm1 + movd %xmm1, %eax + shrl $15, %ecx + subl %ecx, %eax + flds 200(%ebx,%eax,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_8.0.2: + shrl $15, %ecx + flds 208(%ebx,%ecx,4) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + movq %xmm0, (%esp) + fldl (%esp) + fldz + faddp +.L_2TAG_PACKET_3.0.2: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type nearbyint,@function + .size nearbyint,.-nearbyint + .data +# -- End nearbyint + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 4294967295 + .long 2097151 + .long 4294967295 + .long 2097151 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 1073217536 + .long 0 + .long 1073217536 + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 1065353216 + .long 0 + .long 3212836864 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 3212836864 + .long 0 + .long 2147483648 + .long 0 + .long 1065353216 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,224 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nearbyintf_gen.S b/external/sgx_libm/ia32/nearbyintf_gen.S new file mode 100644 index 0000000000..f36b9a94f0 --- /dev/null +++ b/external/sgx_libm/ia32/nearbyintf_gen.S @@ -0,0 +1,375 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nearbyintf_gen.c" + .text +..TXTST0: +# -- Begin nearbyintf + .text + .align 16,0x90 + .globl nearbyintf +nearbyintf: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + pushl %ebp + subl $16, %esp +..B1.2: + fnstcw 4(%esp) +..B1.3: + movzwl 34(%esp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $150, %eax + jge ..B1.40 +..B1.4: + movzwl 4(%esp), %ebx + andl $3072, %ebx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + cmpl $1024, %ebx + je ..B1.31 +..B1.5: + cmpl $2048, %ebx + jne ..B1.15 +..B1.6: + cmpl $127, %eax + jl ..B1.11 +..B1.7: + negl %eax + movl $8388607, %edx + addl $22, %eax + movl 32(%esp), %ebx + movl %ebx, %ebp + movl %eax, %ecx + andl $8388607, %ebp + shll %cl, %edx + andl $-8388608, %ebx + andl %ebp, %edx + orl %edx, %ebx + movl %ebx, %eax + andl $8388607, %eax + movl %ebx, 32(%esp) + testl $-2147483648, %ebx + jne ..B1.10 +..B1.8: + cmpl %ebp, %eax + je ..B1.10 +..B1.9: + fld1 + fadds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.10: + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.11: + testl %eax, %eax + jne ..B1.14 +..B1.12: + testl $8388607, 32(%esp) + jne ..B1.14 +..B1.13: + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.14: + movzbl 35(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + movl 32(%esp), %eax + movl %eax, (%esp) + flds _pone_nzero@GOTOFF(%edx,%ecx,4) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.15: + cmpl $3072, %ebx + jne ..B1.20 +..B1.16: + cmpl $127, %eax + jl ..B1.18 +..B1.17: + negl %eax + movl $8388607, %edx + addl $22, %eax + movl %eax, %ecx + shll %cl, %edx + movl 32(%esp), %ebx + movl %ebx, %ebp + andl %edx, %ebx + andl $-8388608, %ebp + andl $8388607, %ebx + orl %ebx, %ebp + movl %ebp, 32(%esp) + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.18: + movzbl 35(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + movl 32(%esp), %eax + movl %eax, (%esp) + flds _zeros@GOTOFF(%edx,%ecx,4) +..B1.19: + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.20: + cmpl $127, %eax + jl ..B1.27 +..B1.21: + movl 32(%esp), %edi + movl %edi, %ebp + andl $8388607, %ebp + lea 10(%eax), %ecx + negl %eax + movl %ebp, %ebx + addl $22, %eax + andl $-8388608, %edi + shll %cl, %ebx + movl %eax, %ecx + movl $8388607, %eax + shll %cl, %eax + andl %eax, %ebp + orl %ebp, %edi + movl %edi, 32(%esp) + testl %ebx, %ebx + jge ..B1.26 +..B1.22: + cmpl $-2147483648, %ebx + jne ..B1.25 +..B1.23: + movzwl 34(%esp), %ecx + movl $1, %eax + shrl $7, %ecx + negl %ecx + addl $22, %ecx + shll %cl, %eax + testl %eax, 32(%esp) + je ..B1.26 +..B1.24: + flds 32(%esp) + movzbl 35(%esp), %eax + andl $128, %eax + shrl $7, %eax + fadds _ones@GOTOFF(%edx,%eax,4) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.25: + flds 32(%esp) + movzbl 35(%esp), %eax + andl $128, %eax + shrl $7, %eax + fadds _ones@GOTOFF(%edx,%eax,4) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.26: + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.27: + cmpl $126, %eax + jle ..B1.29 +..B1.28: + movzbl 35(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _ones@GOTOFF(%edx,%eax,4) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.29: + je ..B1.41 +..B1.30: + movzbl 35(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + movl 32(%esp), %eax + movl %eax, (%esp) + flds _zeros@GOTOFF(%edx,%ecx,4) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.31: + cmpl $127, %eax + jl ..B1.36 +..B1.32: + negl %eax + movl $8388607, %edi + addl $22, %eax + movl 32(%esp), %ebx + movl %ebx, %ebp + movl %eax, %ecx + andl $8388607, %ebp + shll %cl, %edi + andl $-8388608, %ebx + andl %ebp, %edi + orl %edi, %ebx + movl %ebx, %eax + andl $8388607, %eax + movl %ebx, 32(%esp) + testl $-2147483648, %ebx + je ..B1.35 +..B1.33: + cmpl %ebp, %eax + je ..B1.35 +..B1.34: + flds 32(%esp) + fadds .L_2il0floatpacket.0@GOTOFF(%edx) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.35: + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.36: + testl %eax, %eax + jne ..B1.39 +..B1.37: + testl $8388607, 32(%esp) + jne ..B1.39 +..B1.38: + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.39: + movzbl 35(%esp), %ecx + andl $128, %ecx + shrl $7, %ecx + movl 32(%esp), %eax + movl %eax, (%esp) + flds _pzero_none@GOTOFF(%edx,%ecx,4) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.40: + flds 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.41: + testl $8388607, 32(%esp) + jg ..B1.28 + jmp ..B1.30 + .align 16,0x90 + .type nearbyintf,@function + .size nearbyintf,.-nearbyintf + .data +# -- End nearbyintf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +_pone_nzero: + .long 1065353216 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_pzero_none: + .long 0 + .long 3212836864 + .type _pzero_none,@object + .size _pzero_none,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nearbyintl.S b/external/sgx_libm/ia32/nearbyintl.S new file mode 100644 index 0000000000..d1e1813adf --- /dev/null +++ b/external/sgx_libm/ia32/nearbyintl.S @@ -0,0 +1,663 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nearbyintl.c" + .text +..TXTST0: +# -- Begin nearbyintl + .text + .align 16,0x90 + .globl nearbyintl +nearbyintl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %ebx + andl $32767, %ebx + movzwl 14(%esp), %edx + cmpl $16446, %ebx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + jge ..B1.97 +..B1.4: + movl %edx, %esi + andl $3072, %esi + cmpl $1024, %esi + je ..B1.78 +..B1.5: + cmpl $2048, %esi + jne ..B1.25 +..B1.6: + cmpl $16383, %ebx + jl ..B1.19 +..B1.7: + cmpl $16415, %ebx + jl ..B1.9 +..B1.8: + negl %ebx + movl $-1, %esi + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %esi + movl 8(%ebp), %edi + andl %edi, %esi + movl %esi, 8(%ebp) + xorl %edi, %esi + jmp ..B1.10 +..B1.9: + negl %ebx + movl $-1, %esi + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %esi + movl 12(%ebp), %edi + andl %edi, %esi + movl %esi, 12(%ebp) + xorl %edi, %esi + orl 8(%ebp), %esi + movl $0, 8(%ebp) +..B1.10: + movzbl 17(%ebp), %ecx + testl $128, %ecx + jne ..B1.18 +..B1.11: + testl %esi, %esi + je ..B1.18 +..B1.12: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.103 +..B1.13: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.14: + fldcw 12(%esp) +..B1.15: + fldt 8(%ebp) + faddl _ones@GOTOFF(%eax) + fstpt (%esp) +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + testl %ebx, %ebx + jne ..B1.24 +..B1.20: + cmpl $0, 12(%ebp) + jne ..B1.23 +..B1.21: + cmpl $0, 8(%ebp) + jne ..B1.23 +..B1.22: + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.24: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _pone_nzero@GOTOFF(%eax,%edx,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + cmpl $3072, %esi + jne ..B1.36 +..B1.26: + cmpl $16383, %ebx + jl ..B1.31 +..B1.27: + cmpl $16415, %ebx + jl ..B1.29 +..B1.28: + negl %ebx + movl $-1, %eax + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %eax + andl 8(%ebp), %eax + jmp ..B1.30 +..B1.29: + negl %ebx + movl $-1, %eax + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %eax + andl %eax, 12(%ebp) + xorl %eax, %eax +..B1.30: + movl %eax, 8(%ebp) + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + testl %ebx, %ebx + jne ..B1.35 +..B1.32: + cmpl $0, 12(%ebp) + jne ..B1.34 +..B1.33: + cmpl $0, 8(%ebp) + je ..B1.35 +..B1.34: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.35: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _zeros@GOTOFF(%eax,%edx,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.36: + cmpl $16383, %ebx + jl ..B1.70 +..B1.37: + movl 8(%ebp), %edi + cmpl $16414, %ebx + jl ..B1.39 +..B1.38: + movl %edi, %esi + lea 2(%ebx), %ecx + shll %cl, %esi + movl %esi, 4(%esp) + movl $0, (%esp) + jmp ..B1.40 +..B1.39: + movl 12(%ebp), %esi + lea 2(%ebx), %ecx + shll %cl, %esi + movl %esi, 4(%esp) + movl %edi, (%esp) +..B1.40: + cmpl $16415, %ebx + jl ..B1.42 +..B1.41: + movl %ebx, %ecx + movl $-1, %esi + negl %ecx + addl $30, %ecx + shll %cl, %esi + andl %esi, %edi + movl %edi, 8(%ebp) + jmp ..B1.43 +..B1.42: + movl %ebx, %ecx + movl $-1, %esi + negl %ecx + xorl %edi, %edi + addl $30, %ecx + shll %cl, %esi + movl %edi, 8(%ebp) + andl %esi, 12(%ebp) +..B1.43: + cmpl $0, 4(%esp) + jge ..B1.69 +..B1.44: + movl 4(%esp), %esi + andl $2147483647, %esi + orl (%esp), %esi + je ..B1.52 +..B1.45: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.104 +..B1.46: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.47: + fldcw 12(%esp) +..B1.48: + movl $1, %ecx +..B1.49: + fldt 8(%ebp) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + testl %ecx, %ecx + faddl _ones@GOTOFF(%eax,%edx,8) + fstpt (%esp) + je ..B1.51 +..B1.50: + fldcw 14(%esp) +..B1.51: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.52: + cmpl $16415, %ebx + jl ..B1.61 +..B1.53: + negl %ebx + movl $1, %esi + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %esi + testl %esi, %edi + je ..B1.69 +..B1.54: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.105 +..B1.55: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.56: + fldcw 12(%esp) +..B1.57: + movl $1, %ecx +..B1.58: + fldt 8(%ebp) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + testl %ecx, %ecx + faddl _ones@GOTOFF(%eax,%edx,8) + fstpt (%esp) + je ..B1.60 +..B1.59: + fldcw 14(%esp) +..B1.60: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + negl %ebx + movl $1, %esi + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %esi + testl %esi, 12(%ebp) + je ..B1.69 +..B1.62: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.106 +..B1.63: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.64: + fldcw 12(%esp) +..B1.65: + movl $1, %ecx +..B1.66: + fldt 8(%ebp) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + testl %ecx, %ecx + faddl _ones@GOTOFF(%eax,%edx,8) + fstpt (%esp) + je ..B1.68 +..B1.67: + fldcw 14(%esp) +..B1.68: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.69: + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.70: + cmpl $16382, %ebx + jle ..B1.72 +..B1.71: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _ones@GOTOFF(%eax,%edx,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.72: + je ..B1.107 +..B1.73: + testl %ebx, %ebx + jne ..B1.77 +..B1.74: + cmpl $0, 12(%ebp) + jne ..B1.76 +..B1.75: + cmpl $0, 8(%ebp) + je ..B1.77 +..B1.76: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.77: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _zeros@GOTOFF(%eax,%edx,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + cmpl $16383, %ebx + jl ..B1.91 +..B1.79: + cmpl $16415, %ebx + jl ..B1.81 +..B1.80: + negl %ebx + movl $-1, %edi + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %edi + movl 8(%ebp), %esi + andl %esi, %edi + movl %edi, 8(%ebp) + xorl %edi, %esi + jmp ..B1.82 +..B1.81: + negl %ebx + movl $-1, %edi + addl $30, %ebx + movl %ebx, %ecx + shll %cl, %edi + movl 12(%ebp), %esi + andl %esi, %edi + xorl %edi, %esi + orl 8(%ebp), %esi + movl %edi, 12(%ebp) + movl $0, 8(%ebp) +..B1.82: + movzbl 17(%ebp), %ecx + testl $128, %ecx + je ..B1.90 +..B1.83: + testl %esi, %esi + je ..B1.90 +..B1.84: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.110 +..B1.85: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.86: + fldcw 12(%esp) +..B1.87: + fldt 8(%ebp) + faddl 8+_ones@GOTOFF(%eax) + fstpt (%esp) +..B1.88: + fldcw 14(%esp) +..B1.89: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.90: + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.91: + testl %ebx, %ebx + jne ..B1.96 +..B1.92: + cmpl $0, 12(%ebp) + jne ..B1.95 +..B1.93: + cmpl $0, 8(%ebp) + jne ..B1.95 +..B1.94: + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.95: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.96: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _pzero_none@GOTOFF(%eax,%edx,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.97: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.111 +..B1.98: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.99: + fldcw 12(%esp) +..B1.100: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) +..B1.101: + fldcw 14(%esp) +..B1.102: + fldt (%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.103: + fldt 8(%ebp) + faddl _ones@GOTOFF(%eax) + fstpt (%esp) + jmp ..B1.17 +..B1.104: + xorl %ecx, %ecx + jmp ..B1.49 +..B1.105: + xorl %ecx, %ecx + jmp ..B1.58 +..B1.106: + xorl %ecx, %ecx + jmp ..B1.66 +..B1.107: + movl 12(%ebp), %edx + cmpl $-2147483648, %edx + ja ..B1.71 +..B1.108: + jne ..B1.77 +..B1.109: + cmpl $0, 8(%ebp) + ja ..B1.71 + jmp ..B1.77 +..B1.110: + fldt 8(%ebp) + faddl 8+_ones@GOTOFF(%eax) + fstpt (%esp) + jmp ..B1.89 +..B1.111: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) + jmp ..B1.102 + .align 16,0x90 + .type nearbyintl,@function + .size nearbyintl,.-nearbyintl + .data +# -- End nearbyintl + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_pone_nzero: + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_pzero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _pzero_none,@object + .size _pzero_none,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nextafter_wmt.S b/external/sgx_libm/ia32/nextafter_wmt.S new file mode 100644 index 0000000000..ecc9282675 --- /dev/null +++ b/external/sgx_libm/ia32/nextafter_wmt.S @@ -0,0 +1,210 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nextafter_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin nextafter + .text + .align 16,0x90 + .globl nextafter +nextafter: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 120(%esp), %xmm1 + ucomisd %xmm1, %xmm0 + jp .L_2TAG_PACKET_0.0.3 + je .L_2TAG_PACKET_1.0.3 + cmpltsd %xmm0, %xmm1 + comisd (%ebx), %xmm0 + je .L_2TAG_PACKET_2.0.3 + xorpd %xmm0, %xmm1 + paddq 48(%ebx), %xmm0 + psrlq $63, %xmm1 + psllq $1, %xmm1 + psubq %xmm1, %xmm0 + pextrw $3, %xmm0, %eax + andl $32767, %eax + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_3.0.3 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_0.0.3: + movsd %xmm1, (%esp) + fldl (%esp) + movsd %xmm0, (%esp) + faddl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_1.0.3: + movsd %xmm1, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_2.0.3: + movsd 16(%ebx), %xmm0 + andpd 32(%ebx), %xmm1 + orpd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_3.0.3: + testl %eax, %eax + jns .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_5.0.3: + movsd 80(%ebx), %xmm1 + mulsd %xmm1, %xmm1 + movsd %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 120(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $268, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_6.0.3: + movsd 64(%ebx), %xmm1 + mulsd %xmm1, %xmm1 + movsd %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 120(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $154, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_4.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type nextafter,@function + .size nextafter,.-nextafter + .data +# -- End nextafter + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 1 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 1 + .long 0 + .long 0 + .long 2121269248 + .long 1 + .long 0 + .long 0 + .long 24117248 + .long 1 + .long 0 + .type static_const_table,@object + .size static_const_table,96 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nextafterf_wmt.S b/external/sgx_libm/ia32/nextafterf_wmt.S new file mode 100644 index 0000000000..bdcd59ba9d --- /dev/null +++ b/external/sgx_libm/ia32/nextafterf_wmt.S @@ -0,0 +1,200 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nextafterf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin nextafterf + .text + .align 16,0x90 + .globl nextafterf +nextafterf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 36(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + ucomiss %xmm1, %xmm0 + movl 112(%esp), %eax + jp .L_2TAG_PACKET_0.0.3 + movl $2147483647, %edx + je .L_2TAG_PACKET_1.0.3 + andl %eax, %edx + movl 116(%esp), %ecx + movl 112(%esp), %eax + je .L_2TAG_PACKET_2.0.3 + movl 116(%esp), %edx + subl %eax, %ecx + xorl %edx, %eax + orl %eax, %ecx + movl 112(%esp), %eax + sarl $31, %ecx + orl $1, %ecx + movl $2147483647, %edx + addl %ecx, %eax + andl %eax, %edx + subl $8388608, %edx + cmpl $2130706432, %edx + movl %eax, (%esp) + flds (%esp) + jae .L_2TAG_PACKET_3.0.3 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_0.0.3: + movss %xmm1, (%esp) + flds (%esp) + movss %xmm0, (%esp) + fadds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_1.0.3: + movss %xmm1, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_2.0.3: + movl $1, %eax + andl $-2147483648, %ecx + orl %ecx, %eax + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_3.0.3: + fstp %st(0) + testl %edx, %edx + jns .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_5.0.3: + movss (%ebx), %xmm1 + mulss %xmm1, %xmm1 + movl %eax, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 116(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $269, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_6.0.3: + movss 16(%ebx), %xmm1 + mulss %xmm1, %xmm1 + movl %eax, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 116(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl $155, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) +.L_2TAG_PACKET_4.0.3: + movl 36(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type nextafterf,@function + .size nextafterf,.-nextafterf + .data +# -- End nextafterf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 226492416 + .long 226492416 + .long 0 + .long 0 + .long 1904214016 + .long 1904214016 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nextafterl.S b/external/sgx_libm/ia32/nextafterl.S new file mode 100644 index 0000000000..f2a732a4da --- /dev/null +++ b/external/sgx_libm/ia32/nextafterl.S @@ -0,0 +1,371 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nextafterl.c" + .text +..TXTST0: +# -- Begin nextafterl + .text + .align 16,0x90 + .globl nextafterl +nextafterl: +# parameter 1: 48 + %esp +# parameter 2: 60 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + subl $36, %esp +..B1.2: + fnstcw 26(%esp) +..B1.3: + movzwl 56(%esp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.54 +..B1.4: + movzwl 68(%esp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.45 +..B1.5: + fldt 48(%esp) + fldt 60(%esp) + fucom %st(1) + fnstsw %ax + sahf + jp ..B1.6 + je ..B1.56 +..B1.6: + fstp %st(0) + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + testl %ecx, %ecx + jne ..B1.9 +..B1.7: + cmpl $0, 52(%esp) + jne ..B1.9 +..B1.8: + cmpl $0, 48(%esp) + je ..B1.44 +..B1.9: + movzbl 69(%esp), %eax + movzbl 57(%esp), %edi + andl $128, %eax + andl $128, %edi + shrl $7, %eax + shrl $7, %edi + fstpt 12(%esp) + cmpl %edi, %eax + jne ..B1.15 +..B1.10: + cmpl %edx, %ecx + jg ..B1.15 +..B1.11: + jne ..B1.29 +..B1.12: + movl 52(%esp), %eax + movl 64(%esp), %edx + cmpl %edx, %eax + ja ..B1.15 +..B1.13: + jne ..B1.29 +..B1.14: + movl 48(%esp), %eax + cmpl 60(%esp), %eax + jbe ..B1.29 +..B1.15: + movzwl 20(%esp), %ecx + movl %ecx, %edx + movl 12(%esp), %eax + andl $32767, %edx + decl %eax + movl %eax, 12(%esp) + cmpl $-1, %eax + jne ..B1.34 +..B1.16: + movl 16(%esp), %eax + decl %eax + testl %edx, %edx + je ..B1.22 +..B1.17: + cmpl $2147483647, %eax + jne ..B1.21 +..B1.18: + decl %edx + andl $-32768, %ecx + andl $32767, %edx + orl %edx, %ecx + movw %cx, 20(%esp) + testl %edx, %edx + je ..B1.20 +..B1.19: + movl %ecx, %edx + orl $-2147483648, %eax + movl %eax, 16(%esp) + andl $32767, %edx + jmp ..B1.34 +..B1.20: + movl %ecx, %edx + movl %eax, 16(%esp) + andl $32767, %edx + jmp ..B1.34 +..B1.21: + movl %eax, 16(%esp) + jmp ..B1.35 +..B1.22: + movl %eax, 16(%esp) +..B1.23: + movzwl 26(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.24: + orl $-64768, %edx + movw %dx, 24(%esp) +..B1.25: + fldcw 24(%esp) +..B1.26: + fldt _small_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) +..B1.27: + fldcw 26(%esp) +..B1.28: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.29: + movzwl 20(%esp), %eax + movl %eax, %edx + movl 12(%esp), %ecx + andl $32767, %edx + incl %ecx + movl %ecx, 12(%esp) + jne ..B1.33 +..B1.30: + movl $-2147483648, %ecx + testl %edx, %edx + movl 16(%esp), %edi + je ..L3 + movl $0, %ecx +..L3: + incl %edi + cmpl %ecx, %edi + jne ..B1.32 +..B1.31: + incl %edx + andl $-32768, %eax + andl $32767, %edx + orl $-2147483648, %edi + orl %edx, %eax + movl %eax, %edx + movl %edi, 16(%esp) + andl $32767, %edx + movw %ax, 20(%esp) + jmp ..B1.33 +..B1.32: + movl %edi, 16(%esp) +..B1.33: + cmpl $32767, %edx + je ..B1.37 +..B1.34: + testl %edx, %edx + je ..B1.23 +..B1.35: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.36: + fldt _small_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.28 +..B1.37: + movzwl 26(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.38: + orl $-64768, %edx + movw %dx, 24(%esp) +..B1.39: + fldcw 24(%esp) +..B1.40: + fldt _large_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) +..B1.41: + fldcw 26(%esp) +..B1.42: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.43: + fldt _large_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.42 +..B1.44: + fstp %st(0) + movzbl 69(%esp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _smallest_value_80@GOTOFF(%esi,%ecx) + movzwl 8+_smallest_value_80@GOTOFF(%esi,%ecx), %edx + fstpt 12(%esp) + andl $32767, %edx + jmp ..B1.34 +..B1.45: + cmpl $-2147483648, 64(%esp) + jne ..B1.47 +..B1.46: + cmpl $0, 60(%esp) + je ..B1.5 +..B1.47: + movzwl 26(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.53 +..B1.48: + orl $-64768, %edx + movw %dx, 24(%esp) +..B1.49: + fldcw 24(%esp) +..B1.50: + fldt 48(%esp) + fldt 60(%esp) + fmulp %st, %st(1) + fstpt 12(%esp) +..B1.51: + fldcw 26(%esp) +..B1.52: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.53: + fldt 48(%esp) + fldt 60(%esp) + fmulp %st, %st(1) + fstpt 12(%esp) + jmp ..B1.52 +..B1.54: + cmpl $-2147483648, 52(%esp) + jne ..B1.47 +..B1.55: + cmpl $0, 48(%esp) + jne ..B1.47 + jmp ..B1.4 +..B1.56: + fstp %st(1) + addl $36, %esp + popl %edi + popl %esi + ret + .align 16,0x90 + .type nextafterl,@function + .size nextafterl,.-nextafterl + .data +# -- End nextafterl + .section .rodata, "a" + .align 4 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_smallest_value_80: + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .type _smallest_value_80,@object + .size _smallest_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nexttoward_wmt.S b/external/sgx_libm/ia32/nexttoward_wmt.S new file mode 100644 index 0000000000..028c7517c2 --- /dev/null +++ b/external/sgx_libm/ia32/nexttoward_wmt.S @@ -0,0 +1,246 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nexttoward_wmt.c" + .text +..TXTST0: +# -- Begin nexttoward + .text + .align 16,0x90 + .globl nexttoward +nexttoward: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $20, %esp + movzwl 14(%ebp), %eax + andl $32752, %eax + cmpl $32752, %eax + je ..B1.23 +..B1.2: + movzwl 24(%ebp), %ebx + andl $32767, %ebx + cmpl $32767, %ebx + je ..B1.20 +..B1.3: + fldl 8(%ebp) + fldt 16(%ebp) + fucom %st(1) + fnstsw %ax + sahf + jp ..B1.4 + je ..B1.25 +..B1.4: + fstp %st(0) + movl 12(%ebp), %ecx + movl %ecx, %eax + andl $2147483647, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + orl 8(%ebp), %eax + je ..B1.19 +..B1.5: + fstpt 8(%esp) + movzbl 17(%esp), %edi + movzbl 25(%ebp), %esi + andl $128, %edi + andl $128, %esi + shrl $7, %edi + shrl $7, %esi + movl 8(%ebp), %eax + cmpl %edi, %esi + jne ..B1.11 +..B1.6: + movzwl 16(%esp), %esi + andl $32767, %esi + cmpl %ebx, %esi + jg ..B1.11 +..B1.7: + jne ..B1.12 +..B1.8: + movl 12(%esp), %ebx + movl 20(%ebp), %esi + cmpl %esi, %ebx + ja ..B1.11 +..B1.9: + jne ..B1.12 +..B1.10: + movl 8(%esp), %ebx + cmpl 16(%ebp), %ebx + jbe ..B1.12 +..B1.11: + addl $-1, %eax + movl %eax, 8(%esp) + adcl $-1, %ecx + movl %ecx, 12(%esp) + jmp ..B1.13 +..B1.12: + addl $1, %eax + movl %eax, 8(%esp) + adcl $0, %ecx + movl %ecx, 12(%esp) +..B1.13: + movl 12(%esp), %ecx + andl $2147483647, %ecx + lea -1048576(%ecx), %eax + cmpl $2145386496, %eax + jb ..B1.18 +..B1.14: + cmpl $1048576, %ecx + jae ..B1.16 +..B1.15: + fldl _small_value_64@GOTOFF(%edx) + fmul %st(0), %st + fstpl (%esp) + fldl 8(%esp) + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + fldl _large_value_64@GOTOFF(%edx) + fmul %st(0), %st + fstpl (%esp) + fldl 8(%esp) +..B1.17: + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + fldl 8(%esp) + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + fstp %st(0) + movzbl 25(%ebp), %eax + fldl _small_value_64@GOTOFF(%edx) + andl $128, %eax + shrl $7, %eax + fmul %st(0), %st + movl _smallest_value_64@GOTOFF(%edx,%eax,8), %ecx + movl 4+_smallest_value_64@GOTOFF(%edx,%eax,8), %ebx + movl %ecx, 8(%esp) + movl %ebx, 12(%esp) + fstpl (%esp) + jmp ..B1.18 +..B1.20: + cmpl $-2147483648, 20(%ebp) + jne ..B1.22 +..B1.21: + cmpl $0, 16(%ebp) + je ..B1.3 +..B1.22: + fldt 16(%ebp) + fmull 8(%ebp) + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + testl $1048575, 12(%ebp) + jne ..B1.22 +..B1.24: + cmpl $0, 8(%ebp) + jne ..B1.22 + jmp ..B1.2 +..B1.25: + fstp %st(1) + addl $20, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type nexttoward,@function + .size nexttoward,.-nexttoward + .data +# -- End nexttoward + .section .rodata, "a" + .align 4 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nexttowardf_wmt.S b/external/sgx_libm/ia32/nexttowardf_wmt.S new file mode 100644 index 0000000000..43ae5c9911 --- /dev/null +++ b/external/sgx_libm/ia32/nexttowardf_wmt.S @@ -0,0 +1,212 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nexttowardf_wmt.c" + .text +..TXTST0: +# -- Begin nexttowardf + .text + .align 16,0x90 + .globl nexttowardf +nexttowardf: +# parameter 1: 32 + %esp +# parameter 2: 36 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + subl $20, %esp + movzwl 34(%esp), %eax + andl $32640, %eax + cmpl $32640, %eax + je ..B1.23 +..B1.2: + movzwl 44(%esp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.20 +..B1.3: + flds 32(%esp) + fldt 36(%esp) + fucom %st(1) + fnstsw %ax + sahf + jp ..B1.4 + je ..B1.24 +..B1.4: + fstp %st(0) + movl 32(%esp), %eax + testl $2147483647, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + je ..B1.19 +..B1.5: + fstpt (%esp) + movzbl 9(%esp), %edi + movzbl 45(%esp), %ebx + andl $128, %edi + andl $128, %ebx + shrl $7, %edi + shrl $7, %ebx + cmpl %edi, %ebx + jne ..B1.11 +..B1.6: + movzwl 8(%esp), %ebx + andl $32767, %ebx + cmpl %ecx, %ebx + jg ..B1.11 +..B1.7: + jne ..B1.12 +..B1.8: + movl 4(%esp), %ecx + movl 40(%esp), %ebx + cmpl %ebx, %ecx + ja ..B1.11 +..B1.9: + jne ..B1.12 +..B1.10: + movl (%esp), %ecx + cmpl 36(%esp), %ecx + jbe ..B1.12 +..B1.11: + decl %eax + movl %eax, (%esp) + jmp ..B1.13 +..B1.12: + incl %eax + movl %eax, (%esp) +..B1.13: + andl $2147483647, %eax + lea -8388608(%eax), %ecx + cmpl $2130706432, %ecx + jb ..B1.18 +..B1.14: + cmpl $8388608, %eax + jae ..B1.16 +..B1.15: + flds .L_2il0floatpacket.0@GOTOFF(%edx) + fsts 12(%esp) + flds 12(%esp) + fmulp %st, %st(1) + fstps 12(%esp) + flds (%esp) + addl $20, %esp + popl %ebx + popl %edi + ret +..B1.16: + flds .L_2il0floatpacket.1@GOTOFF(%edx) + fsts 12(%esp) + flds 12(%esp) + fmulp %st, %st(1) + fstps 12(%esp) + flds (%esp) +..B1.17: + addl $20, %esp + popl %ebx + popl %edi + ret +..B1.18: + flds (%esp) + addl $20, %esp + popl %ebx + popl %edi + ret +..B1.19: + fstp %st(0) + movzbl 45(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds .L_2il0floatpacket.0@GOTOFF(%edx) + fsts 12(%esp) + flds 12(%esp) + fmulp %st, %st(1) + movl _smallest_value_32@GOTOFF(%edx,%eax,4), %ecx + movl %ecx, (%esp) + fstps 12(%esp) + jmp ..B1.18 +..B1.20: + cmpl $-2147483648, 40(%esp) + jne ..B1.22 +..B1.21: + cmpl $0, 36(%esp) + je ..B1.3 +..B1.22: + fldt 36(%esp) + fmuls 32(%esp) + addl $20, %esp + popl %ebx + popl %edi + ret +..B1.23: + testl $8388607, 32(%esp) + jne ..B1.22 + jmp ..B1.2 +..B1.24: + fstp %st(1) + addl $20, %esp + popl %ebx + popl %edi + ret + .align 16,0x90 + .type nexttowardf,@function + .size nexttowardf,.-nexttowardf + .data +# -- End nexttowardf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x0d800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_smallest_value_32: + .long 1 + .long 2147483649 + .type _smallest_value_32,@object + .size _smallest_value_32,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/nexttowardl.S b/external/sgx_libm/ia32/nexttowardl.S new file mode 100644 index 0000000000..f59a42795b --- /dev/null +++ b/external/sgx_libm/ia32/nexttowardl.S @@ -0,0 +1,371 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nexttowardl.c" + .text +..TXTST0: +# -- Begin nexttowardl + .text + .align 16,0x90 + .globl nexttowardl +nexttowardl: +# parameter 1: 48 + %esp +# parameter 2: 60 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + subl $36, %esp +..B1.2: + fnstcw 26(%esp) +..B1.3: + movzwl 56(%esp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.54 +..B1.4: + movzwl 68(%esp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.45 +..B1.5: + fldt 48(%esp) + fldt 60(%esp) + fucom %st(1) + fnstsw %ax + sahf + jp ..B1.6 + je ..B1.56 +..B1.6: + fstp %st(0) + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + testl %ecx, %ecx + jne ..B1.9 +..B1.7: + cmpl $0, 52(%esp) + jne ..B1.9 +..B1.8: + cmpl $0, 48(%esp) + je ..B1.44 +..B1.9: + movzbl 69(%esp), %eax + movzbl 57(%esp), %edi + andl $128, %eax + andl $128, %edi + shrl $7, %eax + shrl $7, %edi + fstpt 12(%esp) + cmpl %edi, %eax + jne ..B1.15 +..B1.10: + cmpl %edx, %ecx + jg ..B1.15 +..B1.11: + jne ..B1.29 +..B1.12: + movl 52(%esp), %eax + movl 64(%esp), %edx + cmpl %edx, %eax + ja ..B1.15 +..B1.13: + jne ..B1.29 +..B1.14: + movl 48(%esp), %eax + cmpl 60(%esp), %eax + jbe ..B1.29 +..B1.15: + movzwl 20(%esp), %ecx + movl %ecx, %edx + movl 12(%esp), %eax + andl $32767, %edx + decl %eax + movl %eax, 12(%esp) + cmpl $-1, %eax + jne ..B1.34 +..B1.16: + movl 16(%esp), %eax + decl %eax + testl %edx, %edx + je ..B1.22 +..B1.17: + cmpl $2147483647, %eax + jne ..B1.21 +..B1.18: + decl %edx + andl $-32768, %ecx + andl $32767, %edx + orl %edx, %ecx + movw %cx, 20(%esp) + testl %edx, %edx + je ..B1.20 +..B1.19: + movl %ecx, %edx + orl $-2147483648, %eax + movl %eax, 16(%esp) + andl $32767, %edx + jmp ..B1.34 +..B1.20: + movl %ecx, %edx + movl %eax, 16(%esp) + andl $32767, %edx + jmp ..B1.34 +..B1.21: + movl %eax, 16(%esp) + jmp ..B1.35 +..B1.22: + movl %eax, 16(%esp) +..B1.23: + movzwl 26(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.24: + orl $-64768, %edx + movw %dx, 24(%esp) +..B1.25: + fldcw 24(%esp) +..B1.26: + fldt _small_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) +..B1.27: + fldcw 26(%esp) +..B1.28: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.29: + movzwl 20(%esp), %eax + movl %eax, %edx + movl 12(%esp), %ecx + andl $32767, %edx + incl %ecx + movl %ecx, 12(%esp) + jne ..B1.33 +..B1.30: + movl $-2147483648, %ecx + testl %edx, %edx + movl 16(%esp), %edi + je ..L3 + movl $0, %ecx +..L3: + incl %edi + cmpl %ecx, %edi + jne ..B1.32 +..B1.31: + incl %edx + andl $-32768, %eax + andl $32767, %edx + orl $-2147483648, %edi + orl %edx, %eax + movl %eax, %edx + movl %edi, 16(%esp) + andl $32767, %edx + movw %ax, 20(%esp) + jmp ..B1.33 +..B1.32: + movl %edi, 16(%esp) +..B1.33: + cmpl $32767, %edx + je ..B1.37 +..B1.34: + testl %edx, %edx + je ..B1.23 +..B1.35: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.36: + fldt _small_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.28 +..B1.37: + movzwl 26(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.38: + orl $-64768, %edx + movw %dx, 24(%esp) +..B1.39: + fldcw 24(%esp) +..B1.40: + fldt _large_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) +..B1.41: + fldcw 26(%esp) +..B1.42: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.43: + fldt _large_value_80@GOTOFF(%esi) + fmul %st(0), %st + fstpt (%esp) + jmp ..B1.42 +..B1.44: + fstp %st(0) + movzbl 69(%esp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _smallest_value_80@GOTOFF(%esi,%ecx) + movzwl 8+_smallest_value_80@GOTOFF(%esi,%ecx), %edx + fstpt 12(%esp) + andl $32767, %edx + jmp ..B1.34 +..B1.45: + cmpl $-2147483648, 64(%esp) + jne ..B1.47 +..B1.46: + cmpl $0, 60(%esp) + je ..B1.5 +..B1.47: + movzwl 26(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.53 +..B1.48: + orl $-64768, %edx + movw %dx, 24(%esp) +..B1.49: + fldcw 24(%esp) +..B1.50: + fldt 48(%esp) + fldt 60(%esp) + fmulp %st, %st(1) + fstpt 12(%esp) +..B1.51: + fldcw 26(%esp) +..B1.52: + fldt 12(%esp) + addl $36, %esp + popl %edi + popl %esi + ret +..B1.53: + fldt 48(%esp) + fldt 60(%esp) + fmulp %st, %st(1) + fstpt 12(%esp) + jmp ..B1.52 +..B1.54: + cmpl $-2147483648, 52(%esp) + jne ..B1.47 +..B1.55: + cmpl $0, 48(%esp) + jne ..B1.47 + jmp ..B1.4 +..B1.56: + fstp %st(1) + addl $36, %esp + popl %edi + popl %esi + ret + .align 16,0x90 + .type nexttowardl,@function + .size nexttowardl,.-nexttowardl + .data +# -- End nexttowardl + .section .rodata, "a" + .align 4 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_smallest_value_80: + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .type _smallest_value_80,@object + .size _smallest_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/pow_wmt.S b/external/sgx_libm/ia32/pow_wmt.S new file mode 100644 index 0000000000..3f6206c1ae --- /dev/null +++ b/external/sgx_libm/ia32/pow_wmt.S @@ -0,0 +1,4274 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "pow_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin pow + .text + .align 16,0x90 + .globl pow +pow: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movsd 136(%esp), %xmm1 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movl $1069088768, %ecx + movd %ecx, %xmm7 + movsd %xmm1, 16(%esp) + xorpd %xmm1, %xmm1 + movl $30704, %edx + pinsrw $3, %edx, %xmm1 + movsd %xmm0, 8(%esp) + movapd %xmm0, %xmm3 + movl $8192, %edx + movd %edx, %xmm4 + movapd 8240(%ebx), %xmm6 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + psllq $5, %xmm0 + movsd 8256(%ebx), %xmm2 + psrlq $34, %xmm0 + movl %eax, %edx + andl $32752, %edx + subl $16368, %edx + movl %edx, %ecx + sarl $31, %edx + addl %edx, %ecx + xorl %edx, %ecx + rcpss %xmm0, %xmm0 + psllq $12, %xmm3 + addl $16, %ecx + bsr %ecx, %ecx + psrlq $12, %xmm3 + movl %esi, 24(%esp) + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.3 + movl $0, %esi +.L_2TAG_PACKET_1.0.3: + mulss %xmm7, %xmm0 + movl $-1, %edx + subl $4, %ecx + shll %cl, %edx + movd %edx, %xmm5 + orpd %xmm1, %xmm3 + subl $16351, %eax + cmpl $1, %eax + jbe .L_2TAG_PACKET_2.0.3 + paddd %xmm4, %xmm0 + psllq $32, %xmm5 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm3, %xmm5 +.L_2TAG_PACKET_3.0.3: + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm3 + subl $1, %eax + sarl $4, %eax + cvtsi2sdl %eax, %xmm7 + mulpd %xmm0, %xmm5 +.L_2TAG_PACKET_4.0.3: + mulsd %xmm0, %xmm3 + movapd 8272(%ebx), %xmm1 + subsd %xmm2, %xmm5 + movapd 8288(%ebx), %xmm4 + movl %eax, %ecx + sarl $31, %eax + addl %eax, %ecx + xorl %ecx, %eax + addl $1, %eax + bsr %eax, %eax + unpcklpd %xmm3, %xmm5 + movapd 8304(%ebx), %xmm6 + addsd %xmm5, %xmm3 + andl $16760832, %edx + shrl $10, %edx + addpd -3616(%ebx,%edx), %xmm5 + movapd 8320(%ebx), %xmm0 + pshufd $68, %xmm3, %xmm2 + mulsd %xmm3, %xmm3 + mulpd %xmm2, %xmm1 + mulpd %xmm2, %xmm4 + addsd %xmm7, %xmm5 + mulsd %xmm3, %xmm2 + addpd %xmm1, %xmm6 + mulsd %xmm3, %xmm3 + addpd %xmm4, %xmm0 + movsd 16(%esp), %xmm1 + movzwl 22(%esp), %ecx + pshufd $238, %xmm5, %xmm7 + movsd 8368(%ebx), %xmm4 + mulpd %xmm2, %xmm6 + pshufd $68, %xmm3, %xmm3 + mulpd %xmm2, %xmm0 + shll $4, %eax + subl $15872, %eax + andl $32752, %ecx + addl %ecx, %eax + mulpd %xmm6, %xmm3 + cmpl $624, %eax + jae .L_2TAG_PACKET_5.0.3 + xorpd %xmm6, %xmm6 + movl $17080, %edx + pinsrw $3, %edx, %xmm6 + movapd %xmm1, %xmm2 + andpd %xmm1, %xmm4 + subsd %xmm4, %xmm1 + mulsd %xmm5, %xmm4 + addsd %xmm7, %xmm0 + mulsd %xmm5, %xmm1 + movapd %xmm6, %xmm7 + addsd %xmm4, %xmm6 + addpd %xmm0, %xmm3 + movd %xmm6, %edx + subsd %xmm7, %xmm6 + pshufd $238, %xmm3, %xmm0 + subsd %xmm6, %xmm4 + addsd %xmm3, %xmm0 + movl %edx, %ecx + andl $255, %edx + addl %edx, %edx + movapd 8384(%ebx,%edx,8), %xmm5 + addsd %xmm1, %xmm4 + mulsd %xmm0, %xmm2 + movapd 12480(%ebx), %xmm7 + movapd 12496(%ebx), %xmm3 + shll $12, %ecx + xorl %esi, %ecx + andl $-1048576, %ecx + movd %ecx, %xmm6 + addsd %xmm4, %xmm2 + movsd 12512(%ebx), %xmm1 + pshufd $68, %xmm2, %xmm0 + pshufd $68, %xmm2, %xmm4 + mulpd %xmm0, %xmm0 + movl 24(%esp), %esi + mulpd %xmm4, %xmm7 + pshufd $17, %xmm6, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm0, %xmm0 + paddd %xmm6, %xmm5 + addpd %xmm7, %xmm3 + mulsd %xmm5, %xmm1 + pshufd $238, %xmm5, %xmm6 + mulpd %xmm3, %xmm0 + addsd %xmm6, %xmm1 + pshufd $238, %xmm0, %xmm3 + mulsd %xmm5, %xmm0 + mulsd %xmm5, %xmm3 + addsd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + addsd %xmm5, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_7.0.3: + movsd 128(%esp), %xmm0 + movsd 136(%esp), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_0.0.3: + addl $16, %eax + movl $32752, %edx + andl %eax, %edx + cmpl $32752, %edx + je .L_2TAG_PACKET_8.0.3 + testl $32768, %eax + jne .L_2TAG_PACKET_9.0.3 +.L_2TAG_PACKET_10.0.3: + movl 16(%esp), %ecx + xorl %edx, %edx + testl %ecx, %ecx + movl $1, %ecx + cmovne %ecx, %edx + orl 20(%esp), %edx + cmpl $1072693248, %edx + je .L_2TAG_PACKET_7.0.3 + movsd 8(%esp), %xmm0 + movsd 8(%esp), %xmm3 + movd %xmm3, %edx + psrlq $32, %xmm3 + movd %xmm3, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_11.0.3 + xorpd %xmm3, %xmm3 + movl $18416, %eax + pinsrw $3, %eax, %xmm3 + mulsd %xmm3, %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movapd %xmm0, %xmm3 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $18416, %ecx + psllq $5, %xmm0 + movsd 8256(%ebx), %xmm2 + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm3 + movapd 8240(%ebx), %xmm6 + psrlq $12, %xmm3 + mulss %xmm7, %xmm0 + movl $-1024, %edx + movd %edx, %xmm5 + orpd %xmm1, %xmm3 + paddd %xmm4, %xmm0 + psllq $32, %xmm5 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm3, %xmm5 + movl $0, %esi + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm3 + andl $32752, %eax + subl $18416, %eax + sarl $4, %eax + cvtsi2sdl %eax, %xmm7 + mulpd %xmm0, %xmm5 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_12.0.3: + movl 16(%esp), %ecx + xorl %edx, %edx + testl %ecx, %ecx + movl $1, %ecx + cmovne %ecx, %edx + orl 20(%esp), %edx + cmpl $1072693248, %edx + je .L_2TAG_PACKET_7.0.3 + movsd 8(%esp), %xmm0 + movsd 8(%esp), %xmm3 + movd %xmm3, %edx + psrlq $32, %xmm3 + movd %xmm3, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_11.0.3 + xorpd %xmm3, %xmm3 + movl $18416, %eax + pinsrw $3, %eax, %xmm3 + mulsd %xmm3, %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movapd %xmm0, %xmm3 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $18416, %ecx + psllq $5, %xmm0 + movsd 8256(%ebx), %xmm2 + psrlq $34, %xmm0 + rcpss %xmm0, %xmm0 + psllq $12, %xmm3 + movapd 8240(%ebx), %xmm6 + psrlq $12, %xmm3 + mulss %xmm7, %xmm0 + movl $-1024, %edx + movd %edx, %xmm5 + orpd %xmm1, %xmm3 + paddd %xmm4, %xmm0 + psllq $32, %xmm5 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm3, %xmm5 + movl $-2147483648, %esi + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm3 + andl $32752, %eax + subl $18416, %eax + sarl $4, %eax + cvtsi2sdl %eax, %xmm7 + mulpd %xmm0, %xmm5 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + cmpl $0, %eax + jl .L_2TAG_PACKET_13.0.3 + cmpl $752, %eax + jae .L_2TAG_PACKET_14.0.3 +.L_2TAG_PACKET_15.0.3: + addsd %xmm7, %xmm0 + movsd 12544(%ebx), %xmm2 + addpd %xmm0, %xmm3 + xorpd %xmm6, %xmm6 + movl $17080, %eax + pinsrw $3, %eax, %xmm6 + pshufd $238, %xmm3, %xmm0 + addsd %xmm3, %xmm0 + movapd %xmm5, %xmm3 + addsd %xmm0, %xmm5 + movapd %xmm2, %xmm4 + subsd %xmm5, %xmm3 + movapd %xmm5, %xmm7 + andpd %xmm2, %xmm5 + movapd %xmm1, %xmm2 + andpd %xmm1, %xmm4 + subsd %xmm5, %xmm7 + addsd %xmm3, %xmm0 + subsd %xmm4, %xmm1 + mulsd %xmm5, %xmm4 + addsd %xmm7, %xmm0 + mulsd %xmm0, %xmm2 + movapd %xmm6, %xmm7 + mulsd %xmm5, %xmm1 + addsd %xmm4, %xmm6 + movd %xmm6, %eax + subsd %xmm7, %xmm6 + addsd %xmm1, %xmm2 + movapd 12480(%ebx), %xmm7 + movapd 12496(%ebx), %xmm3 + subsd %xmm6, %xmm4 + pextrw $3, %xmm6, %edx + movl %eax, %ecx + andl $255, %eax + addl %eax, %eax + movapd 8384(%ebx,%eax,8), %xmm5 + addsd %xmm4, %xmm2 + sarl $8, %ecx + movl %ecx, %eax + sarl $1, %ecx + subl %ecx, %eax + shll $20, %ecx + xorl %esi, %ecx + movd %ecx, %xmm6 + movsd 12512(%ebx), %xmm1 + andl $32767, %edx + cmpl $16529, %edx + ja .L_2TAG_PACKET_14.0.3 + pshufd $68, %xmm2, %xmm0 + pshufd $68, %xmm2, %xmm4 + mulpd %xmm0, %xmm0 + mulpd %xmm4, %xmm7 + pshufd $17, %xmm6, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm0, %xmm0 + paddd %xmm6, %xmm5 + addpd %xmm7, %xmm3 + mulsd %xmm5, %xmm1 + pshufd $238, %xmm5, %xmm6 + mulpd %xmm3, %xmm0 + addsd %xmm6, %xmm1 + pshufd $238, %xmm0, %xmm3 + mulsd %xmm5, %xmm0 + mulsd %xmm5, %xmm3 + shll $4, %eax + xorpd %xmm4, %xmm4 + addl $16368, %eax + pinsrw $3, %eax, %xmm4 + addsd %xmm1, %xmm0 + movl 24(%esp), %esi + addsd %xmm3, %xmm0 + movapd %xmm0, %xmm1 + addsd %xmm5, %xmm0 + mulsd %xmm4, %xmm0 + pextrw $3, %xmm0, %eax + andl $32752, %eax + je .L_2TAG_PACKET_16.0.3 + cmpl $32752, %eax + je .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_18.0.3: + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_8.0.3: + movsd 16(%esp), %xmm1 + movsd 8(%esp), %xmm0 + movapd %xmm0, %xmm2 + movd %xmm2, %eax + psrlq $20, %xmm2 + movd %xmm2, %edx + orl %edx, %eax + je .L_2TAG_PACKET_19.0.3 + addsd %xmm0, %xmm0 + movd %xmm1, %eax + psrlq $32, %xmm1 + movd %xmm1, %edx + movl %edx, %ecx + addl %edx, %edx + orl %edx, %eax + je .L_2TAG_PACKET_20.0.3 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_20.0.3: + xorpd %xmm0, %xmm0 + movl $16368, %eax + pinsrw $3, %eax, %xmm0 + movl $29, %edx + jmp .L_2TAG_PACKET_21.0.3 +.L_2TAG_PACKET_22.0.3: + movsd 16(%esp), %xmm0 + addpd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_19.0.3: + movd %xmm1, %eax + movapd %xmm1, %xmm2 + psrlq $32, %xmm1 + movd %xmm1, %edx + movl %edx, %ecx + addl %edx, %edx + orl %edx, %eax + je .L_2TAG_PACKET_23.0.3 + pextrw $3, %xmm2, %eax + andl $32752, %eax + cmpl $32752, %eax + jne .L_2TAG_PACKET_24.0.3 + movd %xmm2, %eax + psrlq $20, %xmm2 + movd %xmm2, %edx + orl %edx, %eax + jne .L_2TAG_PACKET_22.0.3 +.L_2TAG_PACKET_24.0.3: + pextrw $3, %xmm0, %eax + testl $32768, %eax + jne .L_2TAG_PACKET_25.0.3 + testl $-2147483648, %ecx + jne .L_2TAG_PACKET_26.0.3 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_27.0.3: + movsd 16(%esp), %xmm1 + movd %xmm1, %eax + testl $1, %eax + jne .L_2TAG_PACKET_28.0.3 + testl $2, %eax + jne .L_2TAG_PACKET_29.0.3 + jmp .L_2TAG_PACKET_28.0.3 +.L_2TAG_PACKET_25.0.3: + shrl $20, %ecx + andl $2047, %ecx + cmpl $1075, %ecx + ja .L_2TAG_PACKET_28.0.3 + je .L_2TAG_PACKET_30.0.3 + cmpl $1074, %ecx + ja .L_2TAG_PACKET_27.0.3 + cmpl $1023, %ecx + jb .L_2TAG_PACKET_28.0.3 + movsd 16(%esp), %xmm1 + movl $17208, %eax + xorpd %xmm3, %xmm3 + pinsrw $3, %eax, %xmm3 + movapd %xmm3, %xmm4 + addsd %xmm1, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm1 + pextrw $3, %xmm1, %eax + andl $32752, %eax + jne .L_2TAG_PACKET_28.0.3 + movd %xmm3, %eax + andl $1, %eax + je .L_2TAG_PACKET_28.0.3 +.L_2TAG_PACKET_29.0.3: + movsd 16(%esp), %xmm1 + pextrw $3, %xmm1, %eax + andl $32768, %eax + je .L_2TAG_PACKET_18.0.3 + xorpd %xmm0, %xmm0 + movl $32768, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_28.0.3: + movsd 16(%esp), %xmm1 + pextrw $3, %xmm1, %eax + andl $32768, %eax + jne .L_2TAG_PACKET_26.0.3 +.L_2TAG_PACKET_31.0.3: + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_30.0.3: + movsd 16(%esp), %xmm1 + movd %xmm1, %eax + andl $1, %eax + je .L_2TAG_PACKET_28.0.3 + jmp .L_2TAG_PACKET_29.0.3 +.L_2TAG_PACKET_32.0.3: + movd %xmm1, %eax + psrlq $20, %xmm1 + movd %xmm1, %edx + orl %edx, %eax + je .L_2TAG_PACKET_33.0.3 + movsd 16(%esp), %xmm0 + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_33.0.3: + movsd 8(%esp), %xmm0 + pextrw $3, %xmm0, %eax + cmpl $49136, %eax + jne .L_2TAG_PACKET_34.0.3 + movd %xmm0, %ecx + psrlq $20, %xmm0 + movd %xmm0, %edx + orl %edx, %ecx + jne .L_2TAG_PACKET_34.0.3 + xorpd %xmm0, %xmm0 + movl $16368, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_34.0.3: + movsd 16(%esp), %xmm1 + andl $32752, %eax + subl $16368, %eax + pextrw $3, %xmm1, %edx + xorpd %xmm0, %xmm0 + xorl %edx, %eax + andl $32768, %eax + jne .L_2TAG_PACKET_18.0.3 + movl $32752, %ecx + pinsrw $3, %ecx, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_35.0.3: + movd %xmm1, %eax + cmpl $17184, %edx + ja .L_2TAG_PACKET_36.0.3 + testl $1, %eax + jne .L_2TAG_PACKET_37.0.3 + testl $2, %eax + je .L_2TAG_PACKET_38.0.3 + jmp .L_2TAG_PACKET_39.0.3 +.L_2TAG_PACKET_36.0.3: + testl $1, %eax + je .L_2TAG_PACKET_38.0.3 + jmp .L_2TAG_PACKET_39.0.3 +.L_2TAG_PACKET_9.0.3: + movsd 8(%esp), %xmm2 + movd %xmm2, %eax + psrlq $31, %xmm2 + movd %xmm2, %ecx + orl %ecx, %eax + je .L_2TAG_PACKET_11.0.3 + movsd 16(%esp), %xmm1 + pextrw $3, %xmm1, %edx + movd %xmm1, %eax + movapd %xmm1, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + addl %ecx, %ecx + orl %eax, %ecx + je .L_2TAG_PACKET_40.0.3 + andl $32752, %edx + cmpl $32752, %edx + je .L_2TAG_PACKET_32.0.3 + cmpl $17200, %edx + ja .L_2TAG_PACKET_38.0.3 + cmpl $17184, %edx + jae .L_2TAG_PACKET_35.0.3 + cmpl $16368, %edx + jb .L_2TAG_PACKET_37.0.3 + movl $17208, %eax + xorpd %xmm2, %xmm2 + pinsrw $3, %eax, %xmm2 + movapd %xmm2, %xmm4 + addsd %xmm1, %xmm2 + subsd %xmm2, %xmm4 + addsd %xmm4, %xmm1 + pextrw $3, %xmm1, %eax + andl $32767, %eax + jne .L_2TAG_PACKET_37.0.3 + movd %xmm2, %eax + andl $1, %eax + je .L_2TAG_PACKET_38.0.3 +.L_2TAG_PACKET_39.0.3: + xorpd %xmm1, %xmm1 + movl $30704, %edx + pinsrw $3, %edx, %xmm1 + movsd 8256(%ebx), %xmm2 + movsd 8(%esp), %xmm4 + pextrw $3, %xmm4, %eax + movl $8192, %edx + movd %edx, %xmm4 + andl $32767, %eax + subl $16, %eax + jl .L_2TAG_PACKET_12.0.3 + movl %eax, %edx + andl $32752, %edx + subl $16368, %edx + movl %edx, %ecx + sarl $31, %edx + addl %edx, %ecx + xorl %edx, %ecx + addl $16, %ecx + bsr %ecx, %ecx + movl $-2147483648, %esi + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_37.0.3: + xorpd %xmm1, %xmm1 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + xorpd %xmm0, %xmm0 + mulsd %xmm1, %xmm0 + movl $28, %edx + jmp .L_2TAG_PACKET_21.0.3 +.L_2TAG_PACKET_38.0.3: + xorpd %xmm1, %xmm1 + movl $30704, %edx + pinsrw $3, %edx, %xmm1 + movsd 8256(%ebx), %xmm2 + movsd 8(%esp), %xmm4 + pextrw $3, %xmm4, %eax + movl $8192, %edx + movd %edx, %xmm4 + andl $32767, %eax + subl $16, %eax + jl .L_2TAG_PACKET_10.0.3 + movl %eax, %edx + andl $32752, %edx + subl $16368, %edx + movl %edx, %ecx + sarl $31, %edx + addl %edx, %ecx + xorl %edx, %ecx + addl $16, %ecx + bsr %ecx, %ecx + movl $0, %esi + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_23.0.3: + xorpd %xmm0, %xmm0 + movl $16368, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_26.0.3: + xorpd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_13.0.3: + addl $384, %eax + cmpl $0, %eax + jl .L_2TAG_PACKET_41.0.3 + mulsd %xmm1, %xmm5 + addsd %xmm7, %xmm0 + shrl $31, %esi + addpd %xmm0, %xmm3 + pshufd $238, %xmm3, %xmm0 + addsd %xmm0, %xmm3 + movsd 12528(%ebx,%esi,8), %xmm4 + mulsd %xmm3, %xmm1 + xorpd %xmm0, %xmm0 + movl $16368, %eax + shll $15, %esi + orl %esi, %eax + pinsrw $3, %eax, %xmm0 + addsd %xmm1, %xmm5 + movl 24(%esp), %esi + mulsd %xmm4, %xmm5 + addsd %xmm5, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_41.0.3: + movl 24(%esp), %esi + xorpd %xmm0, %xmm0 + movl $16368, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_40.0.3: + xorpd %xmm0, %xmm0 + movl $16368, %eax + pinsrw $3, %eax, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_42.0.3: + xorpd %xmm0, %xmm0 + movl $16368, %eax + pinsrw $3, %eax, %xmm0 + movl $26, %edx + jmp .L_2TAG_PACKET_21.0.3 +.L_2TAG_PACKET_11.0.3: + movsd 16(%esp), %xmm1 + movapd %xmm1, %xmm2 + pextrw $3, %xmm1, %eax + andl $32752, %eax + cmpl $32752, %eax + jne .L_2TAG_PACKET_43.0.3 + movd %xmm2, %eax + psrlq $20, %xmm2 + movd %xmm2, %edx + orl %edx, %eax + jne .L_2TAG_PACKET_22.0.3 +.L_2TAG_PACKET_43.0.3: + movd %xmm1, %eax + psrlq $32, %xmm1 + movd %xmm1, %edx + movl %edx, %ecx + addl %edx, %edx + orl %edx, %eax + je .L_2TAG_PACKET_42.0.3 + shrl $21, %edx + cmpl $1075, %edx + ja .L_2TAG_PACKET_44.0.3 + je .L_2TAG_PACKET_45.0.3 + cmpl $1023, %edx + jb .L_2TAG_PACKET_44.0.3 + movsd 16(%esp), %xmm1 + movl $17208, %eax + xorpd %xmm3, %xmm3 + pinsrw $3, %eax, %xmm3 + movapd %xmm3, %xmm4 + addsd %xmm1, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm1 + pextrw $3, %xmm1, %eax + andl $32752, %eax + jne .L_2TAG_PACKET_44.0.3 + movd %xmm3, %eax + andl $1, %eax + je .L_2TAG_PACKET_44.0.3 +.L_2TAG_PACKET_46.0.3: + movsd 8(%esp), %xmm0 + testl $-2147483648, %ecx + jne .L_2TAG_PACKET_47.0.3 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_45.0.3: + movsd 16(%esp), %xmm1 + movd %xmm1, %eax + testl $1, %eax + jne .L_2TAG_PACKET_46.0.3 +.L_2TAG_PACKET_44.0.3: + testl $-2147483648, %ecx + je .L_2TAG_PACKET_26.0.3 + xorpd %xmm0, %xmm0 +.L_2TAG_PACKET_47.0.3: + movl $16368, %eax + xorpd %xmm1, %xmm1 + pinsrw $3, %eax, %xmm1 + divsd %xmm0, %xmm1 + movapd %xmm1, %xmm0 + movl $27, %edx + jmp .L_2TAG_PACKET_21.0.3 +.L_2TAG_PACKET_14.0.3: + movsd 8(%esp), %xmm2 + movsd 16(%esp), %xmm6 + pextrw $3, %xmm2, %eax + pextrw $3, %xmm6, %edx + movl $32752, %ecx + andl %edx, %ecx + cmpl $32752, %ecx + je .L_2TAG_PACKET_48.0.3 + andl $32752, %eax + subl $16368, %eax + xorl %eax, %edx + testl $32768, %edx + jne .L_2TAG_PACKET_49.0.3 +.L_2TAG_PACKET_50.0.3: + movl $32736, %eax + pinsrw $3, %eax, %xmm0 + shrl $16, %esi + orl %esi, %eax + pinsrw $3, %eax, %xmm1 + movl 24(%esp), %esi + mulsd %xmm1, %xmm0 +.L_2TAG_PACKET_17.0.3: + movl $24, %edx +.L_2TAG_PACKET_21.0.3: + movsd %xmm0, (%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_49.0.3: + movl $16, %eax + pinsrw $3, %eax, %xmm0 + mulsd %xmm0, %xmm0 + testl $-2147483648, %esi + je .L_2TAG_PACKET_51.0.3 + movsd 12560(%ebx), %xmm2 + xorpd %xmm2, %xmm0 +.L_2TAG_PACKET_51.0.3: + movl 24(%esp), %esi + movl $25, %edx + jmp .L_2TAG_PACKET_21.0.3 +.L_2TAG_PACKET_16.0.3: + pextrw $3, %xmm5, %ecx + pextrw $3, %xmm4, %edx + movl $-1, %eax + andl $32752, %ecx + subl $16368, %ecx + andl $32752, %edx + addl %ecx, %edx + movl $-31, %ecx + sarl $4, %edx + subl %edx, %ecx + jle .L_2TAG_PACKET_52.0.3 + cmpl $20, %ecx + ja .L_2TAG_PACKET_53.0.3 + shll %cl, %eax +.L_2TAG_PACKET_52.0.3: + movd %eax, %xmm0 + psllq $32, %xmm0 + andpd %xmm5, %xmm0 + subsd %xmm0, %xmm5 + addsd %xmm1, %xmm5 + mulsd %xmm4, %xmm0 + mulsd %xmm4, %xmm5 + addsd %xmm5, %xmm0 +.L_2TAG_PACKET_53.0.3: + movl $25, %edx + jmp .L_2TAG_PACKET_21.0.3 +.L_2TAG_PACKET_2.0.3: + movzwl 22(%esp), %ecx + movl $-2147483648, %edx + movd %edx, %xmm1 + xorpd %xmm7, %xmm7 + paddd %xmm4, %xmm0 + psllq $32, %xmm5 + movd %xmm0, %edx + psllq $29, %xmm0 + paddq %xmm3, %xmm1 + andpd %xmm1, %xmm5 + andl $32752, %ecx + cmpl $16560, %ecx + jb .L_2TAG_PACKET_3.0.3 + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm3 + addl $16351, %eax + shrl $4, %eax + subl $1022, %eax + cvtsi2sdl %eax, %xmm7 + mulpd %xmm0, %xmm5 + movsd (%ebx), %xmm4 + mulsd %xmm0, %xmm3 + movsd (%ebx), %xmm6 + subsd %xmm2, %xmm5 + movsd 8(%ebx), %xmm1 + pshufd $68, %xmm3, %xmm2 + unpcklpd %xmm3, %xmm5 + addsd %xmm5, %xmm3 + movsd 8(%ebx), %xmm0 + andl $16760832, %edx + shrl $10, %edx + addpd -3616(%ebx,%edx), %xmm7 + mulsd %xmm5, %xmm4 + mulsd %xmm5, %xmm0 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + movapd %xmm5, %xmm2 + mulsd %xmm5, %xmm4 + addsd %xmm0, %xmm5 + movapd %xmm7, %xmm0 + addsd %xmm3, %xmm2 + addsd %xmm5, %xmm7 + mulsd %xmm2, %xmm6 + subsd %xmm7, %xmm0 + movapd %xmm7, %xmm2 + addsd %xmm4, %xmm7 + addsd %xmm5, %xmm0 + subsd %xmm7, %xmm2 + addsd %xmm2, %xmm4 + pshufd $238, %xmm5, %xmm2 + movapd %xmm7, %xmm5 + addsd %xmm2, %xmm7 + addsd %xmm0, %xmm4 + movapd 8272(%ebx), %xmm0 + subsd %xmm7, %xmm5 + addsd %xmm4, %xmm6 + movapd %xmm7, %xmm4 + addsd %xmm2, %xmm5 + addsd %xmm1, %xmm7 + movapd 8336(%ebx), %xmm2 + subsd %xmm7, %xmm4 + addsd %xmm5, %xmm6 + addsd %xmm1, %xmm4 + pshufd $238, %xmm7, %xmm5 + movapd %xmm7, %xmm1 + addsd %xmm5, %xmm7 + subsd %xmm7, %xmm1 + addsd %xmm5, %xmm1 + movapd 8352(%ebx), %xmm5 + pshufd $68, %xmm3, %xmm3 + addsd %xmm4, %xmm6 + addsd %xmm1, %xmm6 + movapd 8304(%ebx), %xmm1 + mulpd %xmm3, %xmm0 + mulpd %xmm3, %xmm2 + pshufd $68, %xmm3, %xmm4 + mulpd %xmm3, %xmm3 + addpd %xmm1, %xmm0 + addpd %xmm2, %xmm5 + mulsd %xmm3, %xmm4 + movsd 16(%ebx), %xmm2 + mulpd %xmm3, %xmm3 + movsd 16(%esp), %xmm1 + movzwl 22(%esp), %ecx + mulpd %xmm4, %xmm0 + pextrw $3, %xmm7, %eax + mulpd %xmm4, %xmm5 + mulpd %xmm3, %xmm0 + movsd 8376(%ebx), %xmm4 + andpd %xmm7, %xmm2 + addsd %xmm6, %xmm5 + subsd %xmm2, %xmm7 + addpd %xmm0, %xmm5 + andl $32752, %eax + subl $16368, %eax + andl $32752, %ecx + cmpl $32752, %ecx + je .L_2TAG_PACKET_48.0.3 + addl %eax, %ecx + cmpl $16576, %ecx + jae .L_2TAG_PACKET_54.0.3 + pshufd $238, %xmm5, %xmm0 + andpd %xmm1, %xmm4 + movapd %xmm1, %xmm3 + addsd %xmm0, %xmm5 + subsd %xmm4, %xmm1 + xorpd %xmm6, %xmm6 + movl $17080, %edx + pinsrw $3, %edx, %xmm6 + addsd %xmm5, %xmm7 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm1 + movapd %xmm6, %xmm5 + mulsd %xmm7, %xmm3 + addsd %xmm4, %xmm6 + addsd %xmm3, %xmm1 + movapd 12480(%ebx), %xmm7 + movd %xmm6, %edx + subsd %xmm5, %xmm6 + movapd 12496(%ebx), %xmm3 + movsd 12512(%ebx), %xmm2 + subsd %xmm6, %xmm4 + movl %edx, %ecx + andl $255, %edx + addl %edx, %edx + movapd 8384(%ebx,%edx,8), %xmm5 + addsd %xmm1, %xmm4 + pextrw $3, %xmm6, %edx + shrl $8, %ecx + movl %ecx, %eax + shrl $1, %ecx + subl %ecx, %eax + shll $20, %ecx + movd %ecx, %xmm6 + pshufd $68, %xmm4, %xmm0 + pshufd $68, %xmm4, %xmm1 + mulpd %xmm0, %xmm0 + mulpd %xmm1, %xmm7 + pshufd $17, %xmm6, %xmm6 + mulsd %xmm4, %xmm2 + andl $32767, %edx + cmpl $16529, %edx + ja .L_2TAG_PACKET_14.0.3 + mulsd %xmm0, %xmm0 + paddd %xmm6, %xmm5 + addpd %xmm7, %xmm3 + mulsd %xmm5, %xmm2 + pshufd $238, %xmm5, %xmm6 + mulpd %xmm3, %xmm0 + addsd %xmm6, %xmm2 + pshufd $238, %xmm0, %xmm3 + addl $1023, %eax + shll $20, %eax + orl %esi, %eax + movd %eax, %xmm4 + mulsd %xmm5, %xmm0 + mulsd %xmm5, %xmm3 + addsd %xmm2, %xmm0 + psllq $32, %xmm4 + addsd %xmm3, %xmm0 + movapd %xmm0, %xmm1 + addsd %xmm5, %xmm0 + movl 24(%esp), %esi + mulsd %xmm4, %xmm0 + pextrw $3, %xmm0, %eax + andl $32752, %eax + je .L_2TAG_PACKET_16.0.3 + cmpl $32752, %eax + je .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_55.0.3: + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_6.0.3 +.L_2TAG_PACKET_48.0.3: + movl 24(%esp), %esi +.L_2TAG_PACKET_56.0.3: + movsd 8(%esp), %xmm0 + movsd 16(%esp), %xmm1 + addsd %xmm1, %xmm1 + xorpd %xmm2, %xmm2 + movl $49136, %eax + pinsrw $3, %eax, %xmm2 + addsd %xmm0, %xmm2 + pextrw $3, %xmm2, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_18.0.3 + movd %xmm1, %edx + movapd %xmm1, %xmm3 + psrlq $20, %xmm3 + movd %xmm3, %ecx + orl %edx, %ecx + je .L_2TAG_PACKET_57.0.3 + addsd %xmm1, %xmm1 + movapd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_57.0.3: + pextrw $3, %xmm0, %eax + andl $32752, %eax + pextrw $3, %xmm1, %edx + xorpd %xmm0, %xmm0 + subl $16368, %eax + xorl %edx, %eax + testl $32768, %eax + jne .L_2TAG_PACKET_18.0.3 + movl $32752, %edx + pinsrw $3, %edx, %xmm0 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_54.0.3: + pextrw $3, %xmm1, %eax + pextrw $3, %xmm2, %ecx + xorl %ecx, %eax + testl $32768, %eax + je .L_2TAG_PACKET_50.0.3 + jmp .L_2TAG_PACKET_49.0.3 +.L_2TAG_PACKET_6.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type pow,@function + .size pow,.-pow + .data +# -- End pow + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 3218479616 + .long 0 + .long 3210587105 + .long 4160749568 + .long 4294967295 + .long 0 + .long 4294965248 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 536870912 + .long 1072689162 + .long 2523013013 + .long 1046157398 + .long 3758096384 + .long 1072685081 + .long 3851513758 + .long 3190968952 + .long 0 + .long 1072681007 + .long 2241466466 + .long 1046044599 + .long 3221225472 + .long 1072676937 + .long 2990928271 + .long 3193084984 + .long 3758096384 + .long 1072672873 + .long 2905112743 + .long 3192918576 + .long 1610612736 + .long 1072668815 + .long 3370591264 + .long 1046051793 + .long 2147483648 + .long 1072664762 + .long 3272361216 + .long 3193793653 + .long 3758096384 + .long 1072660714 + .long 46546755 + .long 1043206936 + .long 3221225472 + .long 1072656672 + .long 3017067724 + .long 3192177962 + .long 0 + .long 1072652636 + .long 3688436631 + .long 3192814956 + .long 2684354560 + .long 1072648604 + .long 1707461992 + .long 3193056712 + .long 2684354560 + .long 1072644578 + .long 1188114540 + .long 3193603086 + .long 3758096384 + .long 1072640557 + .long 3533180564 + .long 1045459375 + .long 2684354560 + .long 1072636542 + .long 2000337630 + .long 3193475557 + .long 2684354560 + .long 1072632532 + .long 3698062443 + .long 3193752766 + .long 3758096384 + .long 1072628527 + .long 3161606138 + .long 3190532995 + .long 2147483648 + .long 1072624528 + .long 3165265478 + .long 3193158459 + .long 1610612736 + .long 1072620534 + .long 1600940077 + .long 3193226777 + .long 2147483648 + .long 1072616545 + .long 1363272552 + .long 3192614278 + .long 3758096384 + .long 1072612561 + .long 3966209910 + .long 3191249654 + .long 2147483648 + .long 1072608583 + .long 1093672789 + .long 3190637330 + .long 1610612736 + .long 1072604610 + .long 1735239357 + .long 3192753616 + .long 1610612736 + .long 1072600642 + .long 1470665156 + .long 1045559697 + .long 2684354560 + .long 1072596679 + .long 3840624926 + .long 1045928953 + .long 536870912 + .long 1072592722 + .long 4259072556 + .long 3191035622 + .long 3221225472 + .long 1072588769 + .long 3613088753 + .long 3192165681 + .long 2147483648 + .long 1072584822 + .long 3175234446 + .long 1039486948 + .long 1610612736 + .long 1072580880 + .long 856576441 + .long 1045702812 + .long 2147483648 + .long 1072576943 + .long 2253498719 + .long 3193285334 + .long 2684354560 + .long 1072573011 + .long 1587070728 + .long 3190801577 + .long 3758096384 + .long 1072569084 + .long 159986317 + .long 1042519436 + .long 1073741824 + .long 1072565163 + .long 3999541949 + .long 3192020440 + .long 2684354560 + .long 1072561246 + .long 3281310262 + .long 1045586786 + .long 536870912 + .long 1072557335 + .long 3775179406 + .long 1045226055 + .long 3221225472 + .long 1072553428 + .long 643472356 + .long 3193681786 + .long 1073741824 + .long 1072549527 + .long 248169775 + .long 1045068977 + .long 3758096384 + .long 1072545630 + .long 307016632 + .long 1042640932 + .long 2147483648 + .long 1072541739 + .long 3872718526 + .long 3189781486 + .long 536870912 + .long 1072537853 + .long 969711630 + .long 3191724732 + .long 3221225472 + .long 1072533971 + .long 4018820394 + .long 3193189264 + .long 1073741824 + .long 1072530095 + .long 3102233092 + .long 1045510224 + .long 3758096384 + .long 1072526223 + .long 1029307912 + .long 3193812776 + .long 1073741824 + .long 1072522357 + .long 984083153 + .long 1045987403 + .long 3221225472 + .long 1072518495 + .long 4171455401 + .long 3193084080 + .long 0 + .long 1072514639 + .long 2592660757 + .long 1046121691 + .long 1073741824 + .long 1072510787 + .long 2964365712 + .long 1046054453 + .long 2147483648 + .long 1072506940 + .long 3792777877 + .long 3193704729 + .long 2147483648 + .long 1072503098 + .long 2948536104 + .long 3192467100 + .long 1610612736 + .long 1072499261 + .long 3836005619 + .long 1041873166 + .long 536870912 + .long 1072495429 + .long 3124543160 + .long 1044409168 + .long 3221225472 + .long 1072491601 + .long 286227933 + .long 1041065990 + .long 1073741824 + .long 1072487779 + .long 2111296776 + .long 3193604419 + .long 2147483648 + .long 1072483961 + .long 2606822001 + .long 3192940394 + .long 2147483648 + .long 1072480148 + .long 194696800 + .long 1046026063 + .long 1610612736 + .long 1072476340 + .long 8535452 + .long 1046200178 + .long 536870912 + .long 1072472537 + .long 950463625 + .long 3192731897 + .long 2147483648 + .long 1072468738 + .long 973831566 + .long 1045683197 + .long 3221225472 + .long 1072464944 + .long 3330435892 + .long 3190277577 + .long 3221225472 + .long 1072461155 + .long 208692097 + .long 3193517651 + .long 1610612736 + .long 1072457371 + .long 2113097415 + .long 1044781749 + .long 3758096384 + .long 1072453591 + .long 1088808936 + .long 3193716142 + .long 0 + .long 1072449817 + .long 1443002127 + .long 3193250205 + .long 3221225472 + .long 1072446046 + .long 3967357419 + .long 1046109477 + .long 1610612736 + .long 1072442281 + .long 3013517861 + .long 3193159691 + .long 2147483648 + .long 1072438520 + .long 2524586286 + .long 1046121951 + .long 1610612736 + .long 1072434764 + .long 1476892861 + .long 1046434731 + .long 0 + .long 1072431013 + .long 3089640950 + .long 3192305780 + .long 536870912 + .long 1072427266 + .long 3812255529 + .long 1045730879 + .long 0 + .long 1072423524 + .long 995354762 + .long 3191528673 + .long 1610612736 + .long 1072419786 + .long 3260567684 + .long 1046273695 + .long 2147483648 + .long 1072416053 + .long 2738210286 + .long 3191471516 + .long 536870912 + .long 1072412325 + .long 1931849805 + .long 1044560405 + .long 1610612736 + .long 1072408601 + .long 358896655 + .long 1044029237 + .long 1073741824 + .long 1072404882 + .long 2214589842 + .long 3193202126 + .long 2684354560 + .long 1072401167 + .long 3118097363 + .long 3192592906 + .long 2147483648 + .long 1072397457 + .long 1835998884 + .long 1045788247 + .long 0 + .long 1072393752 + .long 1585488319 + .long 1045289910 + .long 0 + .long 1072390051 + .long 480160949 + .long 1046030455 + .long 2684354560 + .long 1072386354 + .long 1832959667 + .long 3193013644 + .long 2684354560 + .long 1072382662 + .long 3611346555 + .long 1044544210 + .long 1073741824 + .long 1072378975 + .long 2749418734 + .long 3193712580 + .long 1073741824 + .long 1072375292 + .long 2390043472 + .long 3191710658 + .long 3221225472 + .long 1072371613 + .long 2828199902 + .long 1042265217 + .long 3221225472 + .long 1072367939 + .long 569209321 + .long 3191230982 + .long 536870912 + .long 1072364270 + .long 236159139 + .long 1046240123 + .long 536870912 + .long 1072360605 + .long 1010656270 + .long 3193813968 + .long 1610612736 + .long 1072356944 + .long 2409080597 + .long 1044025029 + .long 536870912 + .long 1072353288 + .long 598419513 + .long 1043327370 + .long 1073741824 + .long 1072349636 + .long 4105950479 + .long 1045747958 + .long 3758096384 + .long 1072345988 + .long 343243853 + .long 3192420172 + .long 3221225472 + .long 1072342345 + .long 2088439530 + .long 1046172091 + .long 536870912 + .long 1072338707 + .long 4117721107 + .long 1043882496 + .long 3758096384 + .long 1072335072 + .long 3192032958 + .long 3192998645 + .long 3758096384 + .long 1072331442 + .long 2366522518 + .long 1045401957 + .long 1610612736 + .long 1072327817 + .long 3685533141 + .long 3193701947 + .long 536870912 + .long 1072324196 + .long 1058658672 + .long 3193572492 + .long 536870912 + .long 1072320579 + .long 166346347 + .long 1045456348 + .long 2147483648 + .long 1072316966 + .long 2027889772 + .long 1046349302 + .long 1073741824 + .long 1072313358 + .long 1079497888 + .long 1044585259 + .long 1073741824 + .long 1072309754 + .long 2189851573 + .long 1045132990 + .long 2684354560 + .long 1072306154 + .long 2486629386 + .long 3193613625 + .long 536870912 + .long 1072302559 + .long 1263686579 + .long 1044789259 + .long 0 + .long 1072298968 + .long 2412061798 + .long 3191369627 + .long 536870912 + .long 1072295381 + .long 584315716 + .long 3193144135 + .long 1610612736 + .long 1072291798 + .long 449000738 + .long 1046330451 + .long 0 + .long 1072288220 + .long 3938320157 + .long 1044446220 + .long 3758096384 + .long 1072284645 + .long 2949844595 + .long 3193462371 + .long 3758096384 + .long 1072281075 + .long 2771329642 + .long 3192121593 + .long 536870912 + .long 1072277510 + .long 3971508621 + .long 3193002806 + .long 2147483648 + .long 1072273948 + .long 4071942301 + .long 1044952619 + .long 536870912 + .long 1072270391 + .long 2090502395 + .long 1044660556 + .long 0 + .long 1072266838 + .long 3657520961 + .long 3193770938 + .long 3758096384 + .long 1072263288 + .long 1608175110 + .long 1045543239 + .long 0 + .long 1072259744 + .long 2506924180 + .long 1045530501 + .long 1073741824 + .long 1072256203 + .long 18238493 + .long 1046305623 + .long 3221225472 + .long 1072252666 + .long 3862640487 + .long 3192882407 + .long 1073741824 + .long 1072249134 + .long 3850158761 + .long 1043656099 + .long 3758096384 + .long 1072245605 + .long 2356524356 + .long 1045915296 + .long 3221225472 + .long 1072242081 + .long 936497287 + .long 3193842353 + .long 2147483648 + .long 1072238561 + .long 2840845344 + .long 1046454771 + .long 2147483648 + .long 1072235045 + .long 3688100713 + .long 1044895451 + .long 2684354560 + .long 1072231533 + .long 479979913 + .long 3193842442 + .long 2684354560 + .long 1072228025 + .long 1016321898 + .long 1046251032 + .long 3758096384 + .long 1072224521 + .long 562232474 + .long 3191974558 + .long 536870912 + .long 1072221022 + .long 3870512029 + .long 3193113881 + .long 1610612736 + .long 1072217526 + .long 1239780547 + .long 3191583604 + .long 2684354560 + .long 1072214034 + .long 2815421327 + .long 1045873682 + .long 0 + .long 1072210547 + .long 2371009561 + .long 1041508792 + .long 1610612736 + .long 1072207063 + .long 1304636524 + .long 3192414284 + .long 3221225472 + .long 1072203583 + .long 210144854 + .long 3193327333 + .long 0 + .long 1072200108 + .long 1454303272 + .long 1046360024 + .long 1610612736 + .long 1072196636 + .long 2095757548 + .long 1044984677 + .long 3221225472 + .long 1072193168 + .long 2027215580 + .long 3192880933 + .long 0 + .long 1072189705 + .long 214794880 + .long 1043457954 + .long 1073741824 + .long 1072186245 + .long 884624917 + .long 1043497079 + .long 2147483648 + .long 1072182789 + .long 2792396634 + .long 3193171685 + .long 2684354560 + .long 1072179337 + .long 4128995250 + .long 3192103434 + .long 2684354560 + .long 1072175889 + .long 333866043 + .long 1046372325 + .long 3221225472 + .long 1072172445 + .long 2194445544 + .long 3193958905 + .long 2684354560 + .long 1072169005 + .long 2316082269 + .long 3192041703 + .long 1610612736 + .long 1072165569 + .long 581005057 + .long 1046322848 + .long 536870912 + .long 1072162137 + .long 3280786513 + .long 1045457251 + .long 3221225472 + .long 1072158708 + .long 2567093361 + .long 1044710359 + .long 1073741824 + .long 1072155284 + .long 3740443584 + .long 1044224237 + .long 2684354560 + .long 1072151863 + .long 3981028272 + .long 1042596351 + .long 3758096384 + .long 1072148446 + .long 3820011120 + .long 3191915623 + .long 0 + .long 1072145034 + .long 2946439484 + .long 3193831276 + .long 3758096384 + .long 1072141624 + .long 3075274422 + .long 3190132432 + .long 2684354560 + .long 1072138219 + .long 496052167 + .long 1043619760 + .long 1073741824 + .long 1072134818 + .long 271106589 + .long 3192265149 + .long 2684354560 + .long 1072131420 + .long 2091955684 + .long 1044443554 + .long 3758096384 + .long 1072128026 + .long 723240109 + .long 3191007419 + .long 3758096384 + .long 1072124636 + .long 1748629070 + .long 1044510075 + .long 3221225472 + .long 1072121250 + .long 3289522046 + .long 3193095178 + .long 1610612736 + .long 1072117868 + .long 3599052146 + .long 3193720427 + .long 3221225472 + .long 1072114489 + .long 2446758135 + .long 3193436303 + .long 3758096384 + .long 1072111114 + .long 1652171097 + .long 3192137173 + .long 3221225472 + .long 1072107743 + .long 1353007155 + .long 1044523902 + .long 1610612736 + .long 1072104376 + .long 990601105 + .long 1046296663 + .long 3758096384 + .long 1072101012 + .long 2228627618 + .long 3193041040 + .long 0 + .long 1072097653 + .long 812484756 + .long 3191950723 + .long 3758096384 + .long 1072094296 + .long 817833130 + .long 3192279242 + .long 2147483648 + .long 1072090944 + .long 3563228521 + .long 3193810951 + .long 3221225472 + .long 1072087595 + .long 2729108859 + .long 3190936185 + .long 3221225472 + .long 1072084250 + .long 2249121662 + .long 3190639690 + .long 2147483648 + .long 1072080909 + .long 4082471745 + .long 3193929368 + .long 3758096384 + .long 1072077571 + .long 2827323806 + .long 3193708561 + .long 3758096384 + .long 1072074237 + .long 735866167 + .long 1042434690 + .long 2684354560 + .long 1072070907 + .long 3240808889 + .long 3191918422 + .long 0 + .long 1072067581 + .long 466482777 + .long 3186962221 + .long 0 + .long 1072064258 + .long 1576076296 + .long 1045849056 + .long 3221225472 + .long 1072060938 + .long 2751923560 + .long 3191910703 + .long 0 + .long 1072057623 + .long 1908755527 + .long 1046437515 + .long 0 + .long 1072054311 + .long 3175841411 + .long 1044572886 + .long 2684354560 + .long 1072051002 + .long 1633258450 + .long 3192670420 + .long 3221225472 + .long 1072047697 + .long 1867746657 + .long 1045726209 + .long 2684354560 + .long 1072044396 + .long 338968864 + .long 3193084662 + .long 0 + .long 1072041099 + .long 1501742471 + .long 3191742031 + .long 0 + .long 1072037805 + .long 4266775786 + .long 3192686970 + .long 2147483648 + .long 1072034514 + .long 4249283553 + .long 1045769728 + .long 2684354560 + .long 1072031227 + .long 2758366873 + .long 1046402161 + .long 1610612736 + .long 1072027944 + .long 2161186990 + .long 1044736865 + .long 2684354560 + .long 1072024664 + .long 810300171 + .long 1045748777 + .long 2147483648 + .long 1072021388 + .long 183688927 + .long 3191515581 + .long 3758096384 + .long 1072018115 + .long 368874072 + .long 3192363575 + .long 3221225472 + .long 1072014846 + .long 2459092970 + .long 1041794640 + .long 536870912 + .long 1072011581 + .long 867488640 + .long 1046310291 + .long 536870912 + .long 1072008319 + .long 50140871 + .long 1043327329 + .long 2684354560 + .long 1072005060 + .long 1241902518 + .long 3192739252 + .long 2684354560 + .long 1072001805 + .long 1027881659 + .long 3193858388 + .long 0 + .long 1071998554 + .long 38457322 + .long 1045489179 + .long 0 + .long 1071995306 + .long 3432963337 + .long 3190969347 + .long 1610612736 + .long 1071992061 + .long 534931792 + .long 1046302734 + .long 1610612736 + .long 1071988820 + .long 1817895268 + .long 3192551860 + .long 3221225472 + .long 1071985582 + .long 357237383 + .long 3191870833 + .long 2684354560 + .long 1071982348 + .long 108262401 + .long 3193365867 + .long 3758096384 + .long 1071979117 + .long 1964729244 + .long 1042502249 + .long 2684354560 + .long 1071975890 + .long 2088446957 + .long 1038010503 + .long 3221225472 + .long 1071972666 + .long 2947239447 + .long 1046377845 + .long 1610612736 + .long 1071969446 + .long 774932072 + .long 1046064854 + .long 2147483648 + .long 1071966229 + .long 4080937590 + .long 3193041284 + .long 3758096384 + .long 1071963015 + .long 2208251454 + .long 1045945089 + .long 3221225472 + .long 1071959805 + .long 2850924475 + .long 1045650959 + .long 0 + .long 1071956599 + .long 714040997 + .long 1046275153 + .long 3221225472 + .long 1071953395 + .long 85533782 + .long 3192816920 + .long 3221225472 + .long 1071950195 + .long 1252511005 + .long 1044805706 + .long 1073741824 + .long 1071946999 + .long 2384659038 + .long 3193391602 + .long 0 + .long 1071943806 + .long 416481813 + .long 1043730233 + .long 536870912 + .long 1071940616 + .long 1675424499 + .long 1046348030 + .long 3221225472 + .long 1071937429 + .long 1175989513 + .long 3193009113 + .long 2684354560 + .long 1071934246 + .long 2400084650 + .long 3192451713 + .long 3758096384 + .long 1071931066 + .long 1467335692 + .long 3193350868 + .long 1610612736 + .long 1071927890 + .long 266493801 + .long 1044954481 + .long 1073741824 + .long 1071924717 + .long 3919093445 + .long 1046023575 + .long 2147483648 + .long 1071921547 + .long 3017408483 + .long 1044880828 + .long 536870912 + .long 1071918381 + .long 948849966 + .long 3193892224 + .long 3758096384 + .long 1071915217 + .long 1870232600 + .long 1045777228 + .long 536870912 + .long 1071912058 + .long 822381492 + .long 3193639186 + .long 2147483648 + .long 1071908901 + .long 788243705 + .long 1044966343 + .long 1073741824 + .long 1071905748 + .long 1344278809 + .long 1044428545 + .long 1073741824 + .long 1071902598 + .long 172864300 + .long 1045765608 + .long 2684354560 + .long 1071899451 + .long 211555467 + .long 3192963574 + .long 536870912 + .long 1071896308 + .long 3373438023 + .long 1045643168 + .long 0 + .long 1071893168 + .long 2867180960 + .long 3189945998 + .long 536870912 + .long 1071890031 + .long 36724362 + .long 3193240584 + .long 1610612736 + .long 1071886897 + .long 2140176984 + .long 1045945349 + .long 0 + .long 1071883767 + .long 436842360 + .long 1040712587 + .long 3758096384 + .long 1071880639 + .long 1225147329 + .long 3193814594 + .long 3758096384 + .long 1071877515 + .long 1586157348 + .long 3191614322 + .long 536870912 + .long 1071874395 + .long 3329332918 + .long 1041699791 + .long 2684354560 + .long 1071871277 + .long 1635968041 + .long 3191783756 + .long 1073741824 + .long 1071868163 + .long 2876158382 + .long 1046097093 + .long 1073741824 + .long 1071865052 + .long 4267556964 + .long 3193723000 + .long 1073741824 + .long 1071861944 + .long 195475940 + .long 1045520795 + .long 2147483648 + .long 1071858839 + .long 2239193514 + .long 1046478675 + .long 0 + .long 1071855738 + .long 4168275596 + .long 1044926285 + .long 2684354560 + .long 1071852639 + .long 142514114 + .long 1045595182 + .long 2147483648 + .long 1071849544 + .long 1943457984 + .long 3192930015 + .long 2147483648 + .long 1071846452 + .long 202659489 + .long 3193926317 + .long 2684354560 + .long 1071843363 + .long 2208408789 + .long 3193857484 + .long 3758096384 + .long 1071840277 + .long 2237297552 + .long 3192939576 + .long 1073741824 + .long 1071837195 + .long 2726920839 + .long 1044193954 + .long 3758096384 + .long 1071834115 + .long 2337732207 + .long 3193611773 + .long 2147483648 + .long 1071831039 + .long 1390088602 + .long 1044000317 + .long 1610612736 + .long 1071827966 + .long 3806188736 + .long 3193463913 + .long 1073741824 + .long 1071824896 + .long 1795276560 + .long 1043671965 + .long 1073741824 + .long 1071821829 + .long 2960792799 + .long 1046240474 + .long 2147483648 + .long 1071818765 + .long 3350591592 + .long 3193333939 + .long 3221225472 + .long 1071815704 + .long 408870754 + .long 3193322854 + .long 0 + .long 1071812647 + .long 4146717132 + .long 1046063520 + .long 2147483648 + .long 1071809592 + .long 1681114919 + .long 3192114313 + .long 0 + .long 1071806541 + .long 1098393137 + .long 3190846732 + .long 2684354560 + .long 1071803492 + .long 2437484983 + .long 3193448718 + .long 1073741824 + .long 1071800447 + .long 1036809185 + .long 3192023501 + .long 0 + .long 1071797405 + .long 659668848 + .long 3193596312 + .long 3221225472 + .long 1071794365 + .long 1112062459 + .long 3192773376 + .long 2147483648 + .long 1071791329 + .long 4082956335 + .long 1045830513 + .long 1610612736 + .long 1071788296 + .long 2387089965 + .long 1045532601 + .long 1610612736 + .long 1071785266 + .long 1522101980 + .long 3193941957 + .long 1073741824 + .long 1071782239 + .long 2157197585 + .long 3188193305 + .long 1073741824 + .long 1071779215 + .long 946810220 + .long 3193223819 + .long 1073741824 + .long 1071776194 + .long 4069942444 + .long 3193878549 + .long 536870912 + .long 1071773176 + .long 1693463440 + .long 1046360588 + .long 536870912 + .long 1071770161 + .long 1954543254 + .long 1046409381 + .long 1073741824 + .long 1071767149 + .long 1050471249 + .long 3193933095 + .long 536870912 + .long 1071764140 + .long 1256240478 + .long 1046456865 + .long 536870912 + .long 1071761134 + .long 676764254 + .long 1046055503 + .long 536870912 + .long 1071758131 + .long 1421032967 + .long 1044779786 + .long 536870912 + .long 1071755131 + .long 38735992 + .long 3192766355 + .long 0 + .long 1071752134 + .long 2960669690 + .long 1044484680 + .long 3758096384 + .long 1071749139 + .long 788707382 + .long 1045299895 + .long 3221225472 + .long 1071746148 + .long 685689300 + .long 1040778831 + .long 2147483648 + .long 1071743160 + .long 1170994182 + .long 1046159174 + .long 1073741824 + .long 1071740175 + .long 64591436 + .long 1046153849 + .long 0 + .long 1071737193 + .long 2338031659 + .long 3189997702 + .long 2684354560 + .long 1071734213 + .long 1941624568 + .long 3186752676 + .long 536870912 + .long 1071731237 + .long 1401255580 + .long 1046383990 + .long 2684354560 + .long 1071728263 + .long 376888427 + .long 1045896456 + .long 536870912 + .long 1071725293 + .long 2831424639 + .long 3193539109 + .long 1610612736 + .long 1071722325 + .long 3303123696 + .long 1044599415 + .long 2684354560 + .long 1071719360 + .long 1077295329 + .long 3189877372 + .long 3221225472 + .long 1071716398 + .long 1434061099 + .long 3184529771 + .long 3221225472 + .long 1071713439 + .long 2104991590 + .long 1045062074 + .long 3221225472 + .long 1071710483 + .long 722060869 + .long 3193788526 + .long 536870912 + .long 1071704580 + .long 3928796486 + .long 1046129020 + .long 536870912 + .long 1071698688 + .long 588844628 + .long 1045492135 + .long 2684354560 + .long 1071692807 + .long 326739366 + .long 3193004445 + .long 1610612736 + .long 1071686938 + .long 2456436042 + .long 1046278169 + .long 2684354560 + .long 1071681080 + .long 2831303512 + .long 1043670046 + .long 536870912 + .long 1071675234 + .long 607223418 + .long 1045507322 + .long 0 + .long 1071669399 + .long 4254921332 + .long 3193290483 + .long 0 + .long 1071663575 + .long 914994333 + .long 3191263853 + .long 1073741824 + .long 1071657762 + .long 4147050180 + .long 3193228552 + .long 2684354560 + .long 1071651960 + .long 594554157 + .long 3193503935 + .long 0 + .long 1071646170 + .long 1062846796 + .long 1045944331 + .long 1073741824 + .long 1071636109 + .long 2909238893 + .long 3193436884 + .long 1073741824 + .long 1071624572 + .long 1682918119 + .long 1042211899 + .long 1073741824 + .long 1071613057 + .long 2419209426 + .long 1045437062 + .long 1073741824 + .long 1071601564 + .long 2951341321 + .long 3190193214 + .long 0 + .long 1071590093 + .long 3084900875 + .long 3192394907 + .long 1073741824 + .long 1071578643 + .long 999567454 + .long 1046433447 + .long 2147483648 + .long 1071567215 + .long 1570101857 + .long 3193291160 + .long 0 + .long 1071555809 + .long 1080647881 + .long 3185154585 + .long 0 + .long 1071544424 + .long 3526309177 + .long 1044843640 + .long 2147483648 + .long 1071533060 + .long 2213463349 + .long 3191738930 + .long 1073741824 + .long 1071521718 + .long 1039925195 + .long 3192618353 + .long 1073741824 + .long 1071510397 + .long 2115757280 + .long 3193671567 + .long 1073741824 + .long 1071499097 + .long 1188751495 + .long 3191145560 + .long 2147483648 + .long 1071487818 + .long 3983461449 + .long 3193897029 + .long 2147483648 + .long 1071476560 + .long 782141500 + .long 1042879962 + .long 2147483648 + .long 1071465323 + .long 4038904626 + .long 1045063881 + .long 2147483648 + .long 1071454107 + .long 2613036921 + .long 3193217642 + .long 0 + .long 1071442912 + .long 2095723435 + .long 1044629175 + .long 1073741824 + .long 1071431737 + .long 3879795974 + .long 1045767874 + .long 1073741824 + .long 1071420583 + .long 2662198042 + .long 3191434637 + .long 3221225472 + .long 1071409449 + .long 4037605722 + .long 3193703090 + .long 2147483648 + .long 1071398336 + .long 1860331835 + .long 1040814822 + .long 3221225472 + .long 1071387243 + .long 1522972033 + .long 3190305974 + .long 1073741824 + .long 1071376171 + .long 2361534207 + .long 1043699366 + .long 0 + .long 1071365119 + .long 4180309179 + .long 1044142099 + .long 0 + .long 1071354087 + .long 1201038528 + .long 3192968772 + .long 0 + .long 1071343075 + .long 1342478171 + .long 3193251215 + .long 0 + .long 1071332083 + .long 3836883348 + .long 3193472007 + .long 3221225472 + .long 1071321110 + .long 3864874250 + .long 1045593126 + .long 2147483648 + .long 1071310158 + .long 2169494998 + .long 1046045346 + .long 1073741824 + .long 1071299226 + .long 3785165075 + .long 3193319246 + .long 2147483648 + .long 1071288313 + .long 1137692678 + .long 3192716779 + .long 1073741824 + .long 1071277420 + .long 1752107598 + .long 1046366120 + .long 3221225472 + .long 1071266546 + .long 1912656912 + .long 1046352281 + .long 3221225472 + .long 1071255692 + .long 2882676334 + .long 1046406353 + .long 1073741824 + .long 1071244858 + .long 963612460 + .long 1045282811 + .long 0 + .long 1071234043 + .long 3811255773 + .long 1046231636 + .long 1073741824 + .long 1071223247 + .long 1126055989 + .long 3192224037 + .long 2147483648 + .long 1071212470 + .long 2079145427 + .long 1044432413 + .long 0 + .long 1071201713 + .long 3611595621 + .long 1043358745 + .long 2147483648 + .long 1071190974 + .long 390522769 + .long 1045888252 + .long 1073741824 + .long 1071180255 + .long 4087939723 + .long 3192930745 + .long 3221225472 + .long 1071169554 + .long 1451494480 + .long 3190219274 + .long 1073741824 + .long 1071158873 + .long 427176194 + .long 3193042022 + .long 2147483648 + .long 1071148210 + .long 1882381948 + .long 3192727946 + .long 2147483648 + .long 1071137566 + .long 3736313771 + .long 3192087019 + .long 1073741824 + .long 1071126941 + .long 1560398816 + .long 3193185715 + .long 2147483648 + .long 1071116334 + .long 1021942441 + .long 1041526696 + .long 2147483648 + .long 1071105746 + .long 3517080249 + .long 3193576041 + .long 3221225472 + .long 1071095176 + .long 2248589878 + .long 1044527624 + .long 2147483648 + .long 1071084625 + .long 2412896695 + .long 1046112867 + .long 3221225472 + .long 1071074092 + .long 3834725738 + .long 1044562378 + .long 1073741824 + .long 1071063578 + .long 1150920407 + .long 1043768986 + .long 0 + .long 1071053082 + .long 1379393428 + .long 3188690690 + .long 0 + .long 1071042604 + .long 3058183278 + .long 3193617655 + .long 0 + .long 1071032144 + .long 421133665 + .long 3193417186 + .long 0 + .long 1071021702 + .long 2860161357 + .long 3191816125 + .long 0 + .long 1071011278 + .long 1742405964 + .long 1043580240 + .long 0 + .long 1071000872 + .long 2821215927 + .long 3188984273 + .long 3221225472 + .long 1070990483 + .long 510275597 + .long 1045813401 + .long 2147483648 + .long 1070980113 + .long 304266588 + .long 3191193536 + .long 3221225472 + .long 1070969760 + .long 1854784211 + .long 1046302073 + .long 0 + .long 1070959426 + .long 3773082854 + .long 3193008899 + .long 2147483648 + .long 1070949108 + .long 3003572392 + .long 1046404879 + .long 3221225472 + .long 1070938808 + .long 1702149204 + .long 1046407257 + .long 2147483648 + .long 1070928526 + .long 3935314439 + .long 1046438280 + .long 3221225472 + .long 1070918261 + .long 2677087609 + .long 1045501749 + .long 2147483648 + .long 1070908014 + .long 4190598039 + .long 3193640515 + .long 1073741824 + .long 1070897784 + .long 368874072 + .long 1044879927 + .long 2147483648 + .long 1070887571 + .long 3584052697 + .long 3192024662 + .long 3221225472 + .long 1070877375 + .long 3762307829 + .long 1045886918 + .long 1073741824 + .long 1070867197 + .long 495710920 + .long 1046317072 + .long 0 + .long 1070857036 + .long 2292768238 + .long 3190887508 + .long 3221225472 + .long 1070846891 + .long 1044078151 + .long 3193772914 + .long 1073741824 + .long 1070836764 + .long 3266010457 + .long 1043443755 + .long 3221225472 + .long 1070826653 + .long 3571665822 + .long 1045547823 + .long 1073741824 + .long 1070816560 + .long 393348347 + .long 3190525143 + .long 2147483648 + .long 1070806483 + .long 4241722498 + .long 3192084193 + .long 2147483648 + .long 1070796423 + .long 1693797068 + .long 3192807972 + .long 0 + .long 1070786380 + .long 2860086745 + .long 1046331646 + .long 2147483648 + .long 1070776353 + .long 1366141759 + .long 3192979363 + .long 1073741824 + .long 1070766343 + .long 737899283 + .long 1045853346 + .long 3221225472 + .long 1070756349 + .long 88734873 + .long 1043881257 + .long 3221225472 + .long 1070746372 + .long 1438003315 + .long 3192917101 + .long 0 + .long 1070736412 + .long 1066505530 + .long 1043896695 + .long 3221225472 + .long 1070726467 + .long 2706653041 + .long 3191113643 + .long 3221225472 + .long 1070716539 + .long 1321764476 + .long 1039573724 + .long 0 + .long 1070706628 + .long 1126753211 + .long 1044502976 + .long 2147483648 + .long 1070696732 + .long 773642884 + .long 1044110727 + .long 1073741824 + .long 1070686853 + .long 1263743406 + .long 3193115278 + .long 0 + .long 1070676990 + .long 3115237732 + .long 3193089176 + .long 3221225472 + .long 1070667142 + .long 3642626838 + .long 3191146032 + .long 2147483648 + .long 1070657311 + .long 2091696428 + .long 1044337177 + .long 1073741824 + .long 1070647496 + .long 3168958391 + .long 1044197568 + .long 0 + .long 1070637697 + .long 711148669 + .long 3193181047 + .long 2147483648 + .long 1070627913 + .long 4207182773 + .long 3193402092 + .long 3221225472 + .long 1070618145 + .long 918070640 + .long 3192902845 + .long 3221225472 + .long 1070608393 + .long 3135571447 + .long 3192193928 + .long 2147483648 + .long 1070598657 + .long 1043705517 + .long 3193188604 + .long 2147483648 + .long 1070581777 + .long 1886680492 + .long 1043890286 + .long 2147483648 + .long 1070562367 + .long 3373799420 + .long 3191917802 + .long 2147483648 + .long 1070542988 + .long 2919618025 + .long 3192461752 + .long 2147483648 + .long 1070523640 + .long 2926365158 + .long 3193113492 + .long 0 + .long 1070504323 + .long 519978638 + .long 1045918846 + .long 0 + .long 1070485037 + .long 3665353151 + .long 3193546248 + .long 0 + .long 1070465781 + .long 2327718958 + .long 1045050797 + .long 0 + .long 1070446556 + .long 345326861 + .long 3188224716 + .long 2147483648 + .long 1070427361 + .long 2263747488 + .long 3192871328 + .long 0 + .long 1070408197 + .long 3894192264 + .long 1045693123 + .long 0 + .long 1070389063 + .long 994321593 + .long 1046347203 + .long 2147483648 + .long 1070369959 + .long 3540366700 + .long 1042296230 + .long 0 + .long 1070350886 + .long 966420752 + .long 3192400412 + .long 2147483648 + .long 1070331842 + .long 1954511160 + .long 3193467762 + .long 2147483648 + .long 1070312828 + .long 1875003040 + .long 1045485629 + .long 0 + .long 1070293845 + .long 4003372005 + .long 3193714109 + .long 2147483648 + .long 1070274890 + .long 2216083644 + .long 1045720399 + .long 0 + .long 1070255966 + .long 1240985743 + .long 1045879414 + .long 0 + .long 1070237071 + .long 1573064162 + .long 1046427916 + .long 0 + .long 1070218206 + .long 2500166582 + .long 3193848169 + .long 2147483648 + .long 1070199369 + .long 862131539 + .long 1045606065 + .long 0 + .long 1070180563 + .long 3733427622 + .long 3193545988 + .long 0 + .long 1070161785 + .long 124515358 + .long 1045504766 + .long 2147483648 + .long 1070143036 + .long 689228007 + .long 1044238436 + .long 0 + .long 1070124317 + .long 976284835 + .long 3189879978 + .long 2147483648 + .long 1070105626 + .long 2997446224 + .long 3193394244 + .long 2147483648 + .long 1070086964 + .long 594985163 + .long 3190453447 + .long 2147483648 + .long 1070068331 + .long 3634411091 + .long 3193012662 + .long 0 + .long 1070049727 + .long 841316482 + .long 3192551604 + .long 0 + .long 1070031151 + .long 518949849 + .long 3189505693 + .long 2147483648 + .long 1070012603 + .long 207633604 + .long 1043791305 + .long 2147483648 + .long 1069994084 + .long 925415631 + .long 3189658670 + .long 2147483648 + .long 1069975593 + .long 3348775015 + .long 1046231055 + .long 0 + .long 1069957131 + .long 4137593961 + .long 1045760644 + .long 2147483648 + .long 1069938696 + .long 3081207972 + .long 1046319652 + .long 2147483648 + .long 1069920290 + .long 2912811806 + .long 3193250863 + .long 0 + .long 1069901912 + .long 1704663230 + .long 3192651171 + .long 2147483648 + .long 1069883561 + .long 1726887473 + .long 3193427817 + .long 2147483648 + .long 1069865238 + .long 516302873 + .long 1042556919 + .long 2147483648 + .long 1069846943 + .long 3737277289 + .long 3192083505 + .long 0 + .long 1069828676 + .long 2829909067 + .long 3191628520 + .long 0 + .long 1069810436 + .long 3474800299 + .long 3187384991 + .long 2147483648 + .long 1069792223 + .long 2041291754 + .long 3186735048 + .long 2147483648 + .long 1069774038 + .long 3100739290 + .long 3192991951 + .long 2147483648 + .long 1069755880 + .long 2641686866 + .long 1042449846 + .long 0 + .long 1069737750 + .long 1353612457 + .long 3192928544 + .long 2147483648 + .long 1069719646 + .long 1823398190 + .long 3193125156 + .long 0 + .long 1069701570 + .long 2629108558 + .long 3192983089 + .long 2147483648 + .long 1069683520 + .long 314889080 + .long 3193178947 + .long 2147483648 + .long 1069665497 + .long 3426846470 + .long 1046055034 + .long 0 + .long 1069647502 + .long 2451521798 + .long 3193081447 + .long 2147483648 + .long 1069629532 + .long 963200030 + .long 1046315089 + .long 0 + .long 1069611590 + .long 3644976987 + .long 1046450297 + .long 2147483648 + .long 1069593674 + .long 1514045874 + .long 3193337489 + .long 0 + .long 1069575785 + .long 2640752615 + .long 3192734715 + .long 0 + .long 1069557922 + .long 177381730 + .long 3193107348 + .long 0 + .long 1069532650 + .long 546871269 + .long 1045601847 + .long 0 + .long 1069497029 + .long 2220408187 + .long 1045964849 + .long 0 + .long 1069461461 + .long 3101209784 + .long 3192417098 + .long 0 + .long 1069425944 + .long 3768825782 + .long 1046196178 + .long 0 + .long 1069390480 + .long 737308942 + .long 1043872555 + .long 0 + .long 1069355068 + .long 1944808119 + .long 3193362317 + .long 0 + .long 1069319707 + .long 852406261 + .long 3191004250 + .long 0 + .long 1069284398 + .long 3202370743 + .long 3192549796 + .long 0 + .long 1069249140 + .long 900633975 + .long 1043862575 + .long 0 + .long 1069213934 + .long 3417168564 + .long 3193213168 + .long 0 + .long 1069178778 + .long 2513309972 + .long 1046051953 + .long 0 + .long 1069143674 + .long 1836846968 + .long 1044036653 + .long 0 + .long 1069108621 + .long 675391362 + .long 3193334972 + .long 0 + .long 1069073618 + .long 1859398086 + .long 3191668729 + .long 0 + .long 1069038666 + .long 3835994043 + .long 3193252196 + .long 0 + .long 1069003764 + .long 563337246 + .long 3192060530 + .long 0 + .long 1068968912 + .long 3715154210 + .long 1045592716 + .long 0 + .long 1068934111 + .long 51415636 + .long 3192193939 + .long 0 + .long 1068899359 + .long 822049108 + .long 1045846080 + .long 0 + .long 1068864658 + .long 3739043340 + .long 3193184949 + .long 0 + .long 1068830006 + .long 2500828997 + .long 3193115638 + .long 0 + .long 1068795403 + .long 1479335089 + .long 1045458233 + .long 0 + .long 1068760850 + .long 1914098598 + .long 1045079833 + .long 0 + .long 1068726346 + .long 1470374909 + .long 1046125471 + .long 0 + .long 1068691892 + .long 2048101185 + .long 3192960024 + .long 0 + .long 1068657486 + .long 801101802 + .long 1042523454 + .long 0 + .long 1068623129 + .long 412171467 + .long 1044799425 + .long 0 + .long 1068588821 + .long 2124566049 + .long 1040459843 + .long 0 + .long 1068554561 + .long 2087558263 + .long 1046083102 + .long 0 + .long 1068520350 + .long 290389316 + .long 1045220023 + .long 0 + .long 1068473430 + .long 393737815 + .long 1045770085 + .long 0 + .long 1068405202 + .long 3273111658 + .long 3193594336 + .long 0 + .long 1068337068 + .long 3076935419 + .long 3191993934 + .long 0 + .long 1068269030 + .long 1564279721 + .long 1040713632 + .long 0 + .long 1068201088 + .long 1950103787 + .long 3191285473 + .long 0 + .long 1068133240 + .long 111301617 + .long 1046140470 + .long 0 + .long 1068065488 + .long 2740933659 + .long 1046091898 + .long 0 + .long 1067997832 + .long 1267131462 + .long 3192947024 + .long 0 + .long 1067930268 + .long 629787343 + .long 1045599114 + .long 0 + .long 1067862800 + .long 2943029746 + .long 3191100621 + .long 0 + .long 1067795426 + .long 2538631151 + .long 3193953989 + .long 0 + .long 1067728144 + .long 3881795033 + .long 3191377363 + .long 0 + .long 1067660956 + .long 2752747058 + .long 3186250103 + .long 0 + .long 1067593862 + .long 892170014 + .long 3193330390 + .long 0 + .long 1067526860 + .long 2000985783 + .long 3192968647 + .long 0 + .long 1067459950 + .long 1954077304 + .long 1044399908 + .long 0 + .long 1067335900 + .long 4120702847 + .long 3193150730 + .long 0 + .long 1067202448 + .long 353489980 + .long 1045676744 + .long 0 + .long 1067069184 + .long 2609643324 + .long 3192108001 + .long 0 + .long 1066936100 + .long 2904433317 + .long 1044836541 + .long 0 + .long 1066803200 + .long 319656790 + .long 1044863904 + .long 0 + .long 1066670484 + .long 2407987331 + .long 3192995083 + .long 0 + .long 1066537948 + .long 2437746120 + .long 3193127733 + .long 0 + .long 1066405592 + .long 762570215 + .long 3189946997 + .long 0 + .long 1066145040 + .long 3317159694 + .long 1046060125 + .long 0 + .long 1065881056 + .long 2317845886 + .long 3191679176 + .long 0 + .long 1065617424 + .long 3665195816 + .long 1045633853 + .long 0 + .long 1065354160 + .long 2008730355 + .long 3193898211 + .long 0 + .long 1064829264 + .long 3746236192 + .long 1046121471 + .long 0 + .long 1064303680 + .long 885296753 + .long 3191852441 + .long 0 + .long 1063253696 + .long 449976495 + .long 3192682663 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 4294965248 + .long 0 + .long 4294965248 + .long 0 + .long 1073160192 + .long 370913857 + .long 3210587105 + .long 1841914130 + .long 3213059448 + .long 3995341938 + .long 3214607105 + .long 2677381210 + .long 3216320731 + .long 3011779882 + .long 3218479542 + .long 1367832035 + .long 1066403058 + .long 2894285243 + .long 1067936923 + .long 1215221452 + .long 1069835102 + .long 370913857 + .long 3210587105 + .long 2677381210 + .long 3216320731 + .long 4172642429 + .long 1056068382 + .long 1215221451 + .long 1069835102 + .long 1092638156 + .long 3184925618 + .long 0 + .long 4294967288 + .long 0 + .long 4294967295 + .long 0 + .long 1072693248 + .long 0 + .long 997195776 + .long 4200250559 + .long 1072696090 + .long 2808127345 + .long 3162830514 + .long 2851812149 + .long 1072698941 + .long 2595802551 + .long 1016815913 + .long 339411585 + .long 1072701800 + .long 264588982 + .long 3162685233 + .long 1048019041 + .long 1072704666 + .long 1398474845 + .long 3161559171 + .long 772914124 + .long 1072707540 + .long 4004372762 + .long 1013278737 + .long 3899555717 + .long 1072710421 + .long 427280750 + .long 3163595548 + .long 1928746161 + .long 1072713311 + .long 983617676 + .long 1015333753 + .long 3541402996 + .long 1072716208 + .long 2759177317 + .long 1015903202 + .long 238821257 + .long 1072719114 + .long 1469694871 + .long 3163933563 + .long 702412510 + .long 1072722027 + .long 3803266087 + .long 3163328991 + .long 728934454 + .long 1072724948 + .long 1413842688 + .long 1015227188 + .long 410360776 + .long 1072727877 + .long 1269990655 + .long 1013024446 + .long 4133881824 + .long 1072730813 + .long 2148155345 + .long 3163979875 + .long 3402036099 + .long 1072733758 + .long 405889334 + .long 1016154232 + .long 2602514713 + .long 1072736711 + .long 2268929336 + .long 1015402860 + .long 1828292879 + .long 1072739672 + .long 1255956747 + .long 1016636974 + .long 1172597893 + .long 1072742641 + .long 114433263 + .long 1016396169 + .long 728909815 + .long 1072745618 + .long 383930225 + .long 1016078044 + .long 590962156 + .long 1072748603 + .long 3829346666 + .long 3164324173 + .long 852742562 + .long 1072751596 + .long 667253586 + .long 1010842135 + .long 1608493509 + .long 1072754597 + .long 3159622171 + .long 3163856313 + .long 2952712987 + .long 1072757606 + .long 3293494651 + .long 3161168877 + .long 685187902 + .long 1072760624 + .long 378731989 + .long 1015891691 + .long 3490863953 + .long 1072763649 + .long 960797498 + .long 3163997456 + .long 2875075254 + .long 1072766683 + .long 4144233330 + .long 3164382292 + .long 3228316108 + .long 1072769725 + .long 3010241991 + .long 3159471380 + .long 351405227 + .long 1072772776 + .long 3125337328 + .long 3160871055 + .long 2930322912 + .long 1072775834 + .long 2599499422 + .long 3163762623 + .long 2471440686 + .long 1072778901 + .long 968836267 + .long 3163263464 + .long 3366293073 + .long 1072781976 + .long 3119426314 + .long 1015169130 + .long 1416741826 + .long 1072785060 + .long 2196380210 + .long 1012462139 + .long 1014845819 + .long 1072788152 + .long 3117910646 + .long 3162607681 + .long 2257959872 + .long 1072791252 + .long 3802946148 + .long 1014013503 + .long 948735466 + .long 1072794361 + .long 3516338028 + .long 3163623459 + .long 1480023343 + .long 1072797478 + .long 2247196168 + .long 1016376029 + .long 3949972341 + .long 1072800603 + .long 2068408548 + .long 1015962444 + .long 4162030108 + .long 1072803737 + .long 2763428480 + .long 1016577925 + .long 2214878420 + .long 1072806880 + .long 892270087 + .long 3164164998 + .long 2502433899 + .long 1072810031 + .long 2148595913 + .long 1016072567 + .long 828946858 + .long 1072813191 + .long 10642492 + .long 1016988014 + .long 1588871207 + .long 1072816359 + .long 143439582 + .long 3164011992 + .long 586995997 + .long 1072819536 + .long 41662348 + .long 3163676568 + .long 2218315341 + .long 1072822721 + .long 2694295388 + .long 3164337444 + .long 2288159958 + .long 1072825915 + .long 2169144469 + .long 1015924597 + .long 897099801 + .long 1072829118 + .long 754756297 + .long 1016289581 + .long 2440944790 + .long 1072832329 + .long 2492769774 + .long 1015196030 + .long 2725843665 + .long 1072835549 + .long 1433917087 + .long 1015887099 + .long 1853186616 + .long 1072838778 + .long 3066496371 + .long 1016705150 + .long 4219606026 + .long 1072842015 + .long 2434574742 + .long 1015730124 + .long 1337108031 + .long 1072845262 + .long 3203724452 + .long 1015726421 + .long 1897844341 + .long 1072848517 + .long 1254300460 + .long 1016324514 + .long 1709341917 + .long 1072851781 + .long 2571168217 + .long 1015201075 + .long 874372905 + .long 1072855054 + .long 100263788 + .long 1016989308 + .long 3790955393 + .long 1072858335 + .long 2352942462 + .long 3164228666 + .long 1972484976 + .long 1072861626 + .long 675290301 + .long 3162688626 + .long 4112506593 + .long 1072864925 + .long 2947355221 + .long 1015419624 + .long 1724976915 + .long 1072868234 + .long 420909223 + .long 3164165955 + .long 3504003472 + .long 1072871551 + .long 3594001060 + .long 3158379228 + .long 964107055 + .long 1072874878 + .long 2800439588 + .long 3163881797 + .long 2799960843 + .long 1072878213 + .long 1423655381 + .long 1016070727 + .long 526652809 + .long 1072881558 + .long 4223459736 + .long 1016927951 + .long 2839424854 + .long 1072884911 + .long 1171596163 + .long 1014090255 + .long 1253935211 + .long 1072888274 + .long 1395382931 + .long 3160751189 + .long 171030293 + .long 1072891646 + .long 3526460132 + .long 1015477354 + .long 3991843581 + .long 1072895026 + .long 4092853457 + .long 1015634339 + .long 4232894513 + .long 1072898416 + .long 2383938684 + .long 1015717095 + .long 1000925746 + .long 1072901816 + .long 1018491672 + .long 3164358120 + .long 2992903935 + .long 1072905224 + .long 2218154406 + .long 1016276769 + .long 1726216749 + .long 1072908642 + .long 2466808228 + .long 3162724981 + .long 1603444721 + .long 1072912069 + .long 1548633640 + .long 3163249902 + .long 2732492859 + .long 1072915505 + .long 2691479646 + .long 3163304260 + .long 926591435 + .long 1072918951 + .long 3208833762 + .long 3163962090 + .long 589198666 + .long 1072922406 + .long 2664346172 + .long 3164206538 + .long 1829099622 + .long 1072925870 + .long 1016661181 + .long 3164509581 + .long 460407023 + .long 1072929344 + .long 4237175092 + .long 3164187045 + .long 887463927 + .long 1072932827 + .long 3596744163 + .long 3161842742 + .long 3219942644 + .long 1072936319 + .long 3798990616 + .long 1016417382 + .long 3272845541 + .long 1072939821 + .long 928852419 + .long 3164536824 + .long 1156440435 + .long 1072943333 + .long 2351451249 + .long 1015015632 + .long 1276261410 + .long 1072946854 + .long 300981948 + .long 1015732745 + .long 3743175029 + .long 1072950384 + .long 2072812490 + .long 3163223651 + .long 78413852 + .long 1072953925 + .long 4183226867 + .long 3164065827 + .long 3278348324 + .long 1072957474 + .long 3069497416 + .long 1015799288 + .long 569847338 + .long 1072961034 + .long 472945272 + .long 3160339305 + .long 654919306 + .long 1072964603 + .long 3232961757 + .long 3164096045 + .long 3645941911 + .long 1072968181 + .long 3814685081 + .long 3162621917 + .long 1065662932 + .long 1072971770 + .long 2533670915 + .long 1015578814 + .long 1617004845 + .long 1072975368 + .long 82804944 + .long 1011391354 + .long 1118294578 + .long 1072978976 + .long 2197495694 + .long 3160957977 + .long 3978100823 + .long 1072982593 + .long 3513027190 + .long 1016894539 + .long 1720398391 + .long 1072986221 + .long 3980678963 + .long 3164348656 + .long 3049340112 + .long 1072989858 + .long 3062915824 + .long 1014219171 + .long 3784486610 + .long 1072993505 + .long 1581883040 + .long 3162747529 + .long 4040676318 + .long 1072997162 + .long 4090609238 + .long 1016712034 + .long 3933059031 + .long 1073000829 + .long 2133366768 + .long 3162580408 + .long 3577096743 + .long 1073004506 + .long 2951496418 + .long 1014842263 + .long 3088564500 + .long 1073008193 + .long 1762311517 + .long 1016094249 + .long 2583551245 + .long 1073011890 + .long 3161094195 + .long 1016655067 + .long 2178460671 + .long 1073015597 + .long 777878098 + .long 3163891069 + .long 1990012071 + .long 1073019314 + .long 3529070563 + .long 3163861769 + .long 2135241198 + .long 1073023041 + .long 1236747871 + .long 1014637723 + .long 2731501122 + .long 1073026778 + .long 1774031855 + .long 3163518597 + .long 3896463087 + .long 1073030525 + .long 1139797873 + .long 3162282381 + .long 1453150082 + .long 1073034283 + .long 498154669 + .long 3162536638 + .long 4109806887 + .long 1073038050 + .long 422403966 + .long 1015517805 + .long 3395129871 + .long 1073041828 + .long 4025345435 + .long 3163383964 + .long 3723038930 + .long 1073045616 + .long 378465264 + .long 3163618158 + .long 917841882 + .long 1073049415 + .long 18715565 + .long 1016707884 + .long 3689071823 + .long 1073053223 + .long 2321004996 + .long 3163601292 + .long 3566716925 + .long 1073057042 + .long 1536826856 + .long 1015191009 + .long 671025100 + .long 1073060872 + .long 3832014351 + .long 3164070606 + .long 3712504873 + .long 1073064711 + .long 88491949 + .long 1016476236 + .long 4222122499 + .long 1073068561 + .long 1277378074 + .long 3164305313 + .long 2321106615 + .long 1073072422 + .long 2171176610 + .long 1010584347 + .long 2425981843 + .long 1073076293 + .long 2830390851 + .long 3164395175 + .long 363667784 + .long 1073080175 + .long 813753950 + .long 1016833785 + .long 551349105 + .long 1073084067 + .long 3821916050 + .long 3163155165 + .long 3111574537 + .long 1073087969 + .long 2606161479 + .long 3163808322 + .long 3872257780 + .long 1073091882 + .long 1253592103 + .long 1017006910 + .long 2956612997 + .long 1073095806 + .long 2118169751 + .long 3163784129 + .long 488188413 + .long 1073099741 + .long 3199821029 + .long 1016612624 + .long 885834528 + .long 1073103686 + .long 1973258547 + .long 3163310140 + .long 4273770423 + .long 1073107641 + .long 3383180809 + .long 3164267477 + .long 2186617381 + .long 1073111608 + .long 2270764084 + .long 3164321289 + .long 3339203574 + .long 1073115585 + .long 1483497780 + .long 3163457330 + .long 3561793907 + .long 1073119573 + .long 1157054053 + .long 1012938926 + .long 2979960120 + .long 1073123572 + .long 2599109725 + .long 1015547069 + .long 1719614413 + .long 1073127582 + .long 330458198 + .long 3164331316 + .long 4201977662 + .long 1073131602 + .long 748330254 + .long 1014642933 + .long 1963711167 + .long 1073135634 + .long 1744767757 + .long 3161622870 + .long 3721688645 + .long 1073139676 + .long 3069276937 + .long 1016887977 + .long 1013258799 + .long 1073143730 + .long 1748797611 + .long 3161177658 + .long 2555984613 + .long 1073147794 + .long 2652555442 + .long 3163601268 + .long 4182873220 + .long 1073151869 + .long 629542646 + .long 3163044879 + .long 1727278727 + .long 1073155956 + .long 3562710623 + .long 1012520516 + .long 3907805044 + .long 1073160053 + .long 2257091225 + .long 3162598983 + .long 2263535754 + .long 1073164162 + .long 752233586 + .long 3163687584 + .long 1218806132 + .long 1073168282 + .long 1818613052 + .long 3163597017 + .long 903334909 + .long 1073172413 + .long 1636462108 + .long 1016088573 + .long 1447192521 + .long 1073176555 + .long 1462857171 + .long 3163563097 + .long 2980802057 + .long 1073180708 + .long 378619896 + .long 1016821879 + .long 1339972927 + .long 1073184873 + .long 167908909 + .long 1016620728 + .long 950803702 + .long 1073189049 + .long 1655364926 + .long 1016285608 + .long 1944781191 + .long 1073193236 + .long 3993278767 + .long 3162772855 + .long 158781403 + .long 1073197435 + .long 2221464712 + .long 3164335029 + .long 19972402 + .long 1073201645 + .long 3507899862 + .long 1017057868 + .long 1660913392 + .long 1073205866 + .long 4218599604 + .long 1016184283 + .long 919555682 + .long 1073210099 + .long 3121969534 + .long 1013996802 + .long 2224145553 + .long 1073214343 + .long 3482522030 + .long 3162537745 + .long 1413356050 + .long 1073218599 + .long 1651349291 + .long 3163716742 + .long 2916157145 + .long 1073222866 + .long 219487565 + .long 1016357943 + .long 2571947539 + .long 1073227145 + .long 3558159064 + .long 3164425245 + .long 515457527 + .long 1073231436 + .long 836709333 + .long 1016699802 + .long 1176749997 + .long 1073235738 + .long 2738998779 + .long 3163084420 + .long 396319521 + .long 1073240052 + .long 4172420816 + .long 3160123208 + .long 2604962541 + .long 1073244377 + .long 2614425274 + .long 3164587768 + .long 3643909174 + .long 1073248714 + .long 3537586109 + .long 1015403223 + .long 3649726105 + .long 1073253063 + .long 4085036346 + .long 1016698050 + .long 2759350287 + .long 1073257424 + .long 1148526634 + .long 1016943509 + .long 1110089947 + .long 1073261797 + .long 1451641639 + .long 1016523249 + .long 3134592888 + .long 1073266181 + .long 4232266862 + .long 1017039710 + .long 380978316 + .long 1073270578 + .long 854188970 + .long 3161511262 + .long 1577608921 + .long 1073274986 + .long 1875489510 + .long 3164016970 + .long 2568320822 + .long 1073279406 + .long 2732824428 + .long 1015401491 + .long 3492293770 + .long 1073283838 + .long 2248032210 + .long 1016435402 + .long 194117574 + .long 1073288283 + .long 777528612 + .long 3164460665 + .long 1403662306 + .long 1073292739 + .long 2788809599 + .long 3162719583 + .long 2966275557 + .long 1073297207 + .long 2176155324 + .long 3160891335 + .long 727685349 + .long 1073301688 + .long 2038246809 + .long 3163407318 + .long 3418903055 + .long 1073306180 + .long 2527457337 + .long 3161869180 + .long 2591453363 + .long 1073310685 + .long 2132396182 + .long 3160122774 + .long 2682146384 + .long 1073315202 + .long 2082178513 + .long 3164411995 + .long 3833209506 + .long 1073319731 + .long 2722920684 + .long 1014803418 + .long 1892288442 + .long 1073324273 + .long 2446255666 + .long 3163648957 + .long 1297350157 + .long 1073328827 + .long 1308022040 + .long 3164461134 + .long 2191782032 + .long 1073333393 + .long 2960257726 + .long 1014791238 + .long 424392917 + .long 1073337972 + .long 2749202995 + .long 3163887294 + .long 434316067 + .long 1073342563 + .long 2028358766 + .long 1014506698 + .long 2366108318 + .long 1073347166 + .long 2867985102 + .long 3162810830 + .long 2069751141 + .long 1073351782 + .long 1562170675 + .long 3163773257 + .long 3985553595 + .long 1073356410 + .long 4002146062 + .long 1016882712 + .long 3964284211 + .long 1073361051 + .long 2111583915 + .long 1016475740 + .long 2152073944 + .long 1073365705 + .long 1486860576 + .long 3164252032 + .long 2990417245 + .long 1073370371 + .long 3683467745 + .long 3164417902 + .long 2331271250 + .long 1073375050 + .long 812057446 + .long 1013256022 + .long 321958744 + .long 1073379742 + .long 3401933767 + .long 1016843134 + .long 1405169241 + .long 1073384446 + .long 2998539689 + .long 3163879527 + .long 1434058175 + .long 1073389163 + .long 251133233 + .long 1016134345 + .long 557149882 + .long 1073393893 + .long 3672720709 + .long 1015585841 + .long 3218338682 + .long 1073398635 + .long 3404164304 + .long 3163525684 + .long 977020788 + .long 1073403391 + .long 3065100517 + .long 1016590139 + .long 2572866477 + .long 1073408159 + .long 878562433 + .long 1016570317 + .long 3861050111 + .long 1073412940 + .long 254893773 + .long 3163861756 + .long 697153126 + .long 1073417735 + .long 1283515429 + .long 3164331765 + .long 1822067026 + .long 1073422542 + .long 1241994956 + .long 1016388866 + .long 3092190715 + .long 1073427362 + .long 814012168 + .long 3160571998 + .long 364333489 + .long 1073432196 + .long 3923737744 + .long 3162469949 + .long 2380618042 + .long 1073437042 + .long 3149557219 + .long 3164369375 + .long 703710506 + .long 1073441902 + .long 1384660846 + .long 1016244467 + .long 4076559943 + .long 1073446774 + .long 2119478331 + .long 3161806927 + .long 4062661092 + .long 1073451660 + .long 1422616006 + .long 3164303894 + .long 815859274 + .long 1073456560 + .long 240396590 + .long 3164536019 + .long 3080351519 + .long 1073461472 + .long 3379126789 + .long 3158266577 + .long 2420883922 + .long 1073466398 + .long 2049810052 + .long 1015168464 + .long 3287523847 + .long 1073471337 + .long 1625971539 + .long 3158058531 + .long 1540824585 + .long 1073476290 + .long 1064017011 + .long 3164536266 + .long 1631695677 + .long 1073481256 + .long 2717633076 + .long 3163392602 + .long 3716502172 + .long 1073486235 + .long 2303740125 + .long 1015091301 + .long 3657065772 + .long 1073491228 + .long 399025623 + .long 3164005654 + .long 1610600570 + .long 1073496235 + .long 3766732298 + .long 1016808759 + .long 2029714210 + .long 1073501255 + .long 613660079 + .long 1016147719 + .long 777507147 + .long 1073506289 + .long 4282924205 + .long 1016236109 + .long 2307442995 + .long 1073511336 + .long 3190117721 + .long 3163453115 + .long 2483480501 + .long 1073516397 + .long 1216371780 + .long 1014082748 + .long 1464976603 + .long 1073521472 + .long 3507292405 + .long 3163026110 + .long 3706687593 + .long 1073526560 + .long 3521726939 + .long 1014301643 + .long 778901109 + .long 1073531663 + .long 2248183954 + .long 3162317327 + .long 1432208378 + .long 1073536779 + .long 1401068914 + .long 3163412539 + .long 1532734324 + .long 1073541909 + .long 3094216535 + .long 3164211433 + .long 1242007932 + .long 1073547053 + .long 1132034716 + .long 3164388407 + .long 721996136 + .long 1073552211 + .long 563754734 + .long 1016419894 + .long 135105010 + .long 1073557383 + .long 1906148728 + .long 3164424315 + .long 3939148246 + .long 1073562568 + .long 3210352148 + .long 1016322899 + .long 3707479175 + .long 1073567768 + .long 3613079303 + .long 1015213314 + .long 3898795731 + .long 1073572982 + .long 1249994144 + .long 1012918394 + .long 382305176 + .long 1073578211 + .long 2347622376 + .long 3163627201 + .long 1912561781 + .long 1073583453 + .long 3147495102 + .long 1016726829 + .long 64696965 + .long 1073588710 + .long 1768797490 + .long 1016865536 + .long 3594158869 + .long 1073593980 + .long 2456521700 + .long 3164305137 + .long 4076975200 + .long 1073599265 + .long 2029000899 + .long 1016257111 + .long 1679558232 + .long 1073604565 + .long 2390342287 + .long 3164382546 + .long 863738719 + .long 1073609879 + .long 1326992220 + .long 3163661773 + .long 1796832535 + .long 1073615207 + .long 3176955716 + .long 3161634089 + .long 351641897 + .long 1073620550 + .long 2172261526 + .long 3164059175 + .long 991358482 + .long 1073625907 + .long 838715019 + .long 3164206244 + .long 3884662774 + .long 1073631278 + .long 2158611599 + .long 1015258761 + .long 610758006 + .long 1073636665 + .long 1965209397 + .long 3162914808 + .long 4224142467 + .long 1073642065 + .long 3389820386 + .long 1016255778 + .long 2009970496 + .long 1073647481 + .long 2159039665 + .long 3163621524 + .long 2728693978 + .long 1073652911 + .long 396109971 + .long 3164511267 + .long 2256325230 + .long 1073658356 + .long 580117746 + .long 1016365871 + .long 764307441 + .long 1073663816 + .long 3021057420 + .long 3164378099 + .long 2719515920 + .long 1073669290 + .long 2760332941 + .long 1016186509 + .long 3999357479 + .long 1073674779 + .long 2258941616 + .long 1016973300 + .long 481706282 + .long 1073680284 + .long 1696079173 + .long 3163759104 + .long 929806999 + .long 1073685803 + .long 3205336643 + .long 1016308133 + .long 1222472308 + .long 1073691337 + .long 1054357470 + .long 3162069594 + .long 1533953344 + .long 1073696886 + .long 769171851 + .long 1016714209 + .long 2038973688 + .long 1073702450 + .long 892941374 + .long 1017095035 + .long 2912730644 + .long 1073708029 + .long 3490067722 + .long 3164453650 + .long 35929225 + .long 1073713624 + .long 2809788041 + .long 3160485544 + .long 2174652632 + .long 1073719233 + .long 4087714590 + .long 1015498835 + .long 915592468 + .long 1073724858 + .long 352947894 + .long 3162072947 + .long 730821105 + .long 1073730498 + .long 2523232743 + .long 1013115764 + .long 1797923801 + .long 1073736153 + .long 1950547427 + .long 1014277635 + .long 3884607281 + .long 1062590591 + .long 3607404736 + .long 1068264200 + .long 1874480759 + .long 1065595563 + .long 4286760335 + .long 1070514109 + .long 4277811695 + .long 1072049730 + .long 0 + .long 0 + .long 4277811695 + .long 1072049730 + .long 4277811695 + .long 3219533378 + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,12576 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/powf_wmt.S b/external/sgx_libm/ia32/powf_wmt.S new file mode 100644 index 0000000000..fa55a81bba --- /dev/null +++ b/external/sgx_libm/ia32/powf_wmt.S @@ -0,0 +1,986 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "powf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin powf + .text + .align 16,0x90 + .globl powf +powf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 48(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + movl 112(%esp), %eax + movaps %xmm1, %xmm5 + movss %xmm1, 8(%esp) + movsd 1424(%ebx), %xmm1 + movsd 1440(%ebx), %xmm7 + movss %xmm0, 4(%esp) + psllq $29, %xmm0 + movapd 1312(%ebx), %xmm6 + cvtss2sd %xmm5, %xmm5 + movsd 528(%ebx), %xmm2 + orpd %xmm0, %xmm1 + movl $2130706431, %ecx + movl %eax, %edx + subl $8388608, %edx + cmpl %edx, %ecx + jb .L_2TAG_PACKET_0.0.3 + movl $0, %ecx + shrl $16, %eax +.L_2TAG_PACKET_1.0.3: +.L_2TAG_PACKET_2.0.3: + movl $127, %edx + andl %eax, %edx + addl $1, %edx + andl $254, %edx + movsd 528(%ebx,%edx,4), %xmm3 + movsd (%ebx,%edx,4), %xmm0 + addl $65, %eax + sarl $7, %eax + subl $127, %eax + cvtsi2sdl %eax, %xmm4 + andpd %xmm3, %xmm7 + subsd %xmm7, %xmm3 + mulsd %xmm1, %xmm7 + mulsd %xmm3, %xmm1 + movl %eax, %edx + sarl $31, %eax + addl %eax, %edx + xorl %edx, %eax + subsd %xmm2, %xmm7 + movapd 1328(%ebx), %xmm2 + addsd %xmm7, %xmm1 + movsd 1472(%ebx), %xmm3 + pshufd $68, %xmm1, %xmm7 + addsd %xmm1, %xmm0 + bsr %eax, %eax + mulpd %xmm7, %xmm6 + movzwl 10(%esp), %edx + mulpd %xmm7, %xmm7 + addsd %xmm4, %xmm0 + addpd %xmm2, %xmm6 + andl $32752, %edx + shrl $7, %edx + subl $97, %eax + addl %edx, %eax + cmpl $35, %eax + jae .L_2TAG_PACKET_3.0.3 + mulsd %xmm5, %xmm0 + mulsd %xmm7, %xmm7 + movapd %xmm0, %xmm4 + addsd %xmm3, %xmm0 + mulpd %xmm7, %xmm6 + movd %xmm0, %eax + subsd %xmm3, %xmm0 + pshufd $238, %xmm6, %xmm7 + subsd %xmm0, %xmm4 + addsd %xmm7, %xmm6 + movapd 1344(%ebx), %xmm7 + mulsd %xmm6, %xmm5 + movapd 1360(%ebx), %xmm2 + xorpd %xmm6, %xmm6 + addsd %xmm5, %xmm4 + pshufd $68, %xmm4, %xmm1 + movl %eax, %edx + sarl $1, %edx + andl $31, %eax + movsd 1056(%ebx,%eax,8), %xmm3 + orl $16368, %ecx + andl $-16, %edx + addl %edx, %ecx + pinsrw $3, %ecx, %xmm6 + mulpd %xmm1, %xmm7 + mulsd %xmm1, %xmm1 + mulsd %xmm3, %xmm4 + addpd %xmm7, %xmm2 + mulsd %xmm6, %xmm3 + mulsd %xmm6, %xmm4 + mulsd %xmm2, %xmm1 + pshufd $238, %xmm2, %xmm0 + addsd %xmm1, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm0, %xmm3 + cvtpd2ps %xmm3, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_5.0.3: + movss 112(%esp), %xmm0 + movss 116(%esp), %xmm1 + mulss %xmm1, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_0.0.3: + cmpl $1065353216, 8(%esp) + je .L_2TAG_PACKET_5.0.3 + movsd 1392(%ebx), %xmm3 + movd %xmm5, %edx + movapd %xmm5, %xmm0 + movapd %xmm5, %xmm7 + andpd %xmm3, %xmm0 + psrlq $32, %xmm0 + movd %xmm0, %ecx + cmpl $2146435072, %ecx + jae .L_2TAG_PACKET_6.0.3 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.3 + movl 4(%esp), %edx + cmpl $2139095039, %edx + jbe .L_2TAG_PACKET_8.0.3 + psllq $52, %xmm3 + orpd %xmm3, %xmm7 + movl $1011, %ecx + movd %ecx, %xmm3 + psrlq $20, %xmm0 + psubd %xmm3, %xmm0 + pxor %xmm3, %xmm3 + pmaxsw %xmm3, %xmm0 + psllq %xmm0, %xmm7 + pcmpeqd %xmm3, %xmm7 + pmovmskb %xmm7, %ecx + andl $255, %ecx + andl $2147483647, %edx + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_9.0.3 + cmpl $255, %ecx + jne .L_2TAG_PACKET_10.0.3 + movsd 1392(%ebx), %xmm3 + movapd %xmm5, %xmm0 + movapd %xmm5, %xmm7 + andpd %xmm3, %xmm0 + movl $1012, %ecx + movd %ecx, %xmm3 + andpd 1392(%ebx), %xmm0 + psrlq $52, %xmm0 + psubd %xmm3, %xmm0 + movsd 1488(%ebx), %xmm3 + psllq %xmm0, %xmm7 + pcmpeqd %xmm3, %xmm7 + pmovmskb %xmm7, %ecx + andl $255, %ecx + addl $32513, %ecx + andl $32768, %ecx + movsd 1440(%ebx), %xmm7 + cmpl $8388608, %edx + jb .L_2TAG_PACKET_11.0.3 + movl 4(%esp), %eax + shrl $16, %eax + andl $32767, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_6.0.3: + movss 4(%esp), %xmm0 + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + ja .L_2TAG_PACKET_12.0.3 + jmp .L_2TAG_PACKET_13.0.3 +.L_2TAG_PACKET_12.0.3: + movss 4(%esp), %xmm0 + addss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_8.0.3: + movl $0, %ecx +.L_2TAG_PACKET_11.0.3: + xorpd %xmm0, %xmm0 + movl $24448, %edx + pinsrw $1, %edx, %xmm0 + movss 4(%esp), %xmm4 + movsd 1424(%ebx), %xmm1 + mulss %xmm0, %xmm4 + movd %xmm4, %edx + andl $2147483647, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_14.0.3 + pextrw $1, %xmm4, %eax + movaps %xmm4, %xmm0 + andps 1376(%ebx), %xmm4 + psllq $29, %xmm0 + orpd %xmm0, %xmm1 + andl $32767, %eax + subl $8192, %eax + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_15.0.3: + movl 8(%esp), %edx + andl $-2147483648, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_16.0.3 + movss 1536(%ebx), %xmm0 + xorps %xmm4, %xmm4 + divss %xmm4, %xmm0 + movl $33, %edx + jmp .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_14.0.3: + movl 8(%esp), %edx + andl $-2147483648, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_18.0.3 + shll $16, %ecx + movl 4(%esp), %edx + andl %ecx, %edx + orl $2139095040, %edx + movd %edx, %xmm0 + movss 1536(%ebx), %xmm1 + divss %xmm4, %xmm1 + movl $33, %edx + jmp .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_18.0.3: + shll $16, %ecx + movd %xmm4, %edx + andl %ecx, %edx + cmpl $0, %edx + jne .L_2TAG_PACKET_19.0.3 + fldz + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_9.0.3: + movl 4(%esp), %edx + cmpl $2139095040, %edx + je .L_2TAG_PACKET_20.0.3 + andl $2147483647, %edx + cmpl $2139095040, %edx + ja .L_2TAG_PACKET_12.0.3 + cmpl $255, %ecx + jne .L_2TAG_PACKET_21.0.3 + movapd %xmm5, %xmm1 + movapd %xmm5, %xmm2 + movl $1012, %ecx + movd %ecx, %xmm3 + andpd 1392(%ebx), %xmm1 + psrlq $52, %xmm1 + psubd %xmm3, %xmm1 + pxor %xmm3, %xmm3 + psllq %xmm1, %xmm2 + pcmpeqd %xmm3, %xmm2 + pmovmskb %xmm2, %eax + andl $255, %eax + cmpl $255, %eax + je .L_2TAG_PACKET_21.0.3 + pextrw $3, %xmm5, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_22.0.3 +.L_2TAG_PACKET_19.0.3: + flds 1552(%ebx) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_22.0.3: + flds 1520(%ebx) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_21.0.3: + pextrw $3, %xmm5, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_23.0.3 + fldz + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_20.0.3: + pextrw $3, %xmm5, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_23.0.3 + fldz + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_10.0.3: + cmpl $0, %edx + je .L_2TAG_PACKET_15.0.3 + movss 1568(%ebx), %xmm0 + mulss %xmm0, %xmm0 + movl $34, %edx + jmp .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_13.0.3: + movss 4(%esp), %xmm4 + movss 8(%esp), %xmm5 + movl 8(%esp), %eax + movl %eax, %ecx + andl $2147483647, %eax + cmpl $2139095040, %eax + ja .L_2TAG_PACKET_24.0.3 + andl $-2147483648, %ecx + movd %xmm4, %edx + movl $2147483647, %eax + andl %edx, %eax + je .L_2TAG_PACKET_14.0.3 + xorl $-1082130432, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_25.0.3 + cmpl $0, %ecx + je .L_2TAG_PACKET_26.0.3 + movd %xmm4, %eax + andl $2147483647, %eax + cmpl $1065353216, %eax + jae .L_2TAG_PACKET_16.0.3 + jmp .L_2TAG_PACKET_23.0.3 +.L_2TAG_PACKET_16.0.3: + fldz + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_25.0.3: + movss 116(%esp), %xmm1 + xorps %xmm0, %xmm0 + addss %xmm1, %xmm0 + fld1 + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_26.0.3: + pextrw $1, %xmm4, %eax + andl $32640, %eax + cmpl $16256, %eax + jae .L_2TAG_PACKET_23.0.3 + fldz + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_23.0.3: + flds 1504(%ebx) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_24.0.3: + movss 8(%esp), %xmm5 + addss %xmm5, %xmm5 + movss %xmm5, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_7.0.3: + movss 4(%esp), %xmm4 + movss 8(%esp), %xmm5 + movd %xmm4, %eax + movss 1536(%ebx), %xmm0 + movl $32, %edx + cmpl $0, %eax + je .L_2TAG_PACKET_17.0.3 + movd %xmm4, %eax + xorps %xmm2, %xmm2 + addss %xmm2, %xmm4 + movl $35, %edx + andl $2147483647, %eax + cmpl $2139095040, %eax + ja .L_2TAG_PACKET_17.0.3 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_27.0.3: + mulsd %xmm7, %xmm7 + mulpd %xmm7, %xmm6 + pshufd $238, %xmm6, %xmm7 + addsd %xmm7, %xmm0 + mulsd %xmm5, %xmm0 + movapd 1344(%ebx), %xmm7 + mulsd %xmm6, %xmm5 + movapd %xmm0, %xmm4 + addsd %xmm3, %xmm0 + movd %xmm0, %eax + subsd %xmm3, %xmm0 + subsd %xmm0, %xmm4 + movapd 1360(%ebx), %xmm2 + xorpd %xmm6, %xmm6 + addsd %xmm5, %xmm4 + pshufd $68, %xmm4, %xmm1 + movl %eax, %edx + sarl $1, %edx + andl $31, %eax + movsd 1056(%ebx,%eax,8), %xmm3 + orl $16368, %ecx + andl $-16, %edx + addl %edx, %ecx + pinsrw $3, %ecx, %xmm6 + mulpd %xmm1, %xmm7 + mulsd %xmm1, %xmm1 + mulsd %xmm3, %xmm4 + addpd %xmm7, %xmm2 + mulsd %xmm6, %xmm3 + mulsd %xmm6, %xmm4 + mulsd %xmm2, %xmm1 + pshufd $238, %xmm2, %xmm0 + addsd %xmm1, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm3, %xmm0 + cvtpd2ps %xmm0, %xmm0 + pextrw $1, %xmm0, %eax + andl $32767, %eax + movl $30, %edx + cmpl $32640, %eax + jae .L_2TAG_PACKET_17.0.3 + movl $31, %edx + cmpl $16, %eax + jb .L_2TAG_PACKET_17.0.3 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_28.0.3: + movl $30, %edx + orl $32639, %ecx + xorpd %xmm0, %xmm0 + pinsrw $1, %ecx, %xmm0 + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_29.0.3: + movl $31, %edx + movl $8388608, %eax + movd %eax, %xmm1 + mulss %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + pinsrw $1, %ecx, %xmm0 +.L_2TAG_PACKET_17.0.3: + movss %xmm0, (%esp) + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 116(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_3.0.3: + movl 4(%esp), %edx + cmpl $1065353216, %edx + je .L_2TAG_PACKET_25.0.3 + movl 8(%esp), %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_13.0.3 + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.3 + cmpl $0, %eax + jl .L_2TAG_PACKET_30.0.3 + cmpl $38, %eax + jb .L_2TAG_PACKET_27.0.3 + movl 4(%esp), %edx + andl $2139095040, %edx + subl $1056964608, %edx + cmpl $8388608, %edx + jbe .L_2TAG_PACKET_31.0.3 +.L_2TAG_PACKET_32.0.3: + movl 4(%esp), %eax + movl 8(%esp), %edx + andl $2139095040, %eax + subl $1065353216, %eax + xorl %edx, %eax + andl $-2147483648, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_28.0.3 + jmp .L_2TAG_PACKET_29.0.3 +.L_2TAG_PACKET_31.0.3: + movss 4(%esp), %xmm4 + movl $1065353216, %eax + movd %eax, %xmm2 + pslld $1, %xmm4 + psrld $1, %xmm4 + subss %xmm4, %xmm2 + movd %xmm2, %edx + andl $2139095040, %edx + je .L_2TAG_PACKET_30.0.3 + movapd %xmm5, %xmm4 + mulsd %xmm0, %xmm4 + pextrw $3, %xmm4, %eax + andl $32752, %eax + cmpl $16496, %eax + jb .L_2TAG_PACKET_27.0.3 + jmp .L_2TAG_PACKET_32.0.3 +.L_2TAG_PACKET_30.0.3: + shll $16, %ecx + orl $1065353216, %ecx + movd %ecx, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_4.0.3: + movl 48(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type powf,@function + .size powf,.-powf + .data +# -- End powf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 2244132864 + .long 1066854294 + .long 1972305920 + .long 1067891411 + .long 2678235136 + .long 1068559160 + .long 4207480832 + .long 1068917750 + .long 1085124608 + .long 1069271106 + .long 2363127808 + .long 1069583448 + .long 3799560192 + .long 1069755113 + .long 972806144 + .long 1069924378 + .long 3492741120 + .long 1070091307 + .long 766832640 + .long 1070255966 + .long 1278367744 + .long 1070418414 + .long 3103942656 + .long 1070578710 + .long 3671264256 + .long 1070666503 + .long 2869823488 + .long 1070744583 + .long 3466906624 + .long 1070821668 + .long 1271733248 + .long 1070897784 + .long 972806144 + .long 1070972954 + .long 3449621504 + .long 1071047201 + .long 1662393344 + .long 1071120549 + .long 2300516352 + .long 1071193018 + .long 176119808 + .long 1071264630 + .long 4147676160 + .long 1071335403 + .long 2905168896 + .long 1071405359 + .long 3761433600 + .long 1071474515 + .long 2716292096 + .long 1071542890 + .long 1758136320 + .long 1071610501 + .long 2341968384 + .long 1071661018 + .long 14039552 + .long 1071694085 + .long 4204914176 + .long 1071726793 + .long 513134592 + .long 1071759153 + .long 3559335936 + .long 1071791169 + .long 1904282624 + .long 3218771961 + .long 714524672 + .long 3218709255 + .long 180337664 + .long 3218647192 + .long 47131648 + .long 3218585759 + .long 1751500800 + .long 3218524943 + .long 4058951680 + .long 3218464732 + .long 2999895040 + .long 3218405115 + .long 398715904 + .long 3218346080 + .long 3815829504 + .long 3218287614 + .long 722717696 + .long 3218229709 + .long 1399058432 + .long 3218172352 + .long 227933184 + .long 3218115534 + .long 2835759104 + .long 3218038744 + .long 3554951168 + .long 3217927202 + .long 2818570240 + .long 3217816679 + .long 3041732608 + .long 3217707156 + .long 180338688 + .long 3217598616 + .long 835166208 + .long 3217491040 + .long 704622592 + .long 3217384412 + .long 1695342592 + .long 3217278715 + .long 3266000896 + .long 3217173933 + .long 2363885568 + .long 3217070051 + .long 3908239360 + .long 3216902938 + .long 448159744 + .long 3216698681 + .long 2530197504 + .long 3216496132 + .long 4268273664 + .long 3216295264 + .long 2785038336 + .long 3216096050 + .long 522182656 + .long 3215814333 + .long 3386466304 + .long 3215422356 + .long 3838140416 + .long 3215033528 + .long 2250194944 + .long 3214361582 + .long 2718924800 + .long 3213307003 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1697350398 + .long 1073157447 + .long 3983912013 + .long 1073134173 + .long 3077571303 + .long 1073111605 + .long 787997771 + .long 1073089711 + .long 2608086797 + .long 1073068460 + .long 4250927815 + .long 1073047825 + .long 4006130247 + .long 1073027780 + .long 2255915958 + .long 1073008300 + .long 1031537321 + .long 1072989361 + .long 3606154084 + .long 1072970940 + .long 1235818328 + .long 1072953018 + .long 2880061438 + .long 1072935573 + .long 525144062 + .long 1072918588 + .long 3251485016 + .long 1072902043 + .long 2604098795 + .long 1072885923 + .long 2408035495 + .long 1072870211 + .long 1357880318 + .long 1072854892 + .long 1394140652 + .long 1072839951 + .long 3210356685 + .long 1072825374 + .long 1774519652 + .long 1072811149 + .long 3338441873 + .long 1072797262 + .long 3804456356 + .long 1072783702 + .long 1462910403 + .long 1072770458 + .long 1149890700 + .long 1072757518 + .long 1234436653 + .long 1072744872 + .long 2089211650 + .long 1072732510 + .long 1684223316 + .long 1072720423 + .long 4072784951 + .long 1072708601 + .long 2114454037 + .long 1072697037 + .long 2012861074 + .long 1072678195 + .long 2037138800 + .long 1072656045 + .long 3417210877 + .long 1072634361 + .long 3694789629 + .long 1072613129 + .long 2992528814 + .long 1072592335 + .long 3882342941 + .long 1072571965 + .long 2671772639 + .long 1072552007 + .long 2172608510 + .long 1072532448 + .long 3001586108 + .long 1072513276 + .long 3477449063 + .long 1072494480 + .long 3818975826 + .long 1072476049 + .long 1758664544 + .long 1072457973 + .long 1046539701 + .long 1072440241 + .long 2778964739 + .long 1072422843 + .long 1026978211 + .long 1072405771 + .long 4238694625 + .long 1072389014 + .long 811117725 + .long 1072372566 + .long 1975098645 + .long 1072356416 + .long 3079413536 + .long 1072340557 + .long 712695513 + .long 1072324982 + .long 1238508315 + .long 1072309682 + .long 3563503614 + .long 1072294650 + .long 3383126459 + .long 1072279880 + .long 1724836050 + .long 1072265365 + .long 608820196 + .long 1072251098 + .long 3005930546 + .long 1072237072 + .long 4207804139 + .long 1072223282 + .long 378851326 + .long 1072209723 + .long 1405092650 + .long 1072196387 + .long 795096448 + .long 1072183270 + .long 1417164049 + .long 1072170366 + .long 2583387630 + .long 1072157670 + .long 20099889 + .long 1072145178 + .long 3019600065 + .long 1072132883 + .long 53601996 + .long 1072120783 + .long 1697350398 + .long 1072108871 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 3541402996 + .long 1072716208 + .long 1828292879 + .long 1072739672 + .long 3490863953 + .long 1072763649 + .long 1014845819 + .long 1072788152 + .long 828946858 + .long 1072813191 + .long 1853186616 + .long 1072838778 + .long 4112506593 + .long 1072864925 + .long 171030293 + .long 1072891646 + .long 926591435 + .long 1072918951 + .long 1276261410 + .long 1072946854 + .long 1617004845 + .long 1072975368 + .long 3577096743 + .long 1073004506 + .long 1453150082 + .long 1073034283 + .long 3712504873 + .long 1073064711 + .long 2956612997 + .long 1073095806 + .long 1719614413 + .long 1073127582 + .long 3907805044 + .long 1073160053 + .long 1944781191 + .long 1073193236 + .long 2571947539 + .long 1073227145 + .long 1110089947 + .long 1073261797 + .long 2966275557 + .long 1073297207 + .long 2191782032 + .long 1073333393 + .long 2990417245 + .long 1073370371 + .long 2572866477 + .long 1073408159 + .long 4076559943 + .long 1073446774 + .long 3716502172 + .long 1073486235 + .long 3706687593 + .long 1073526560 + .long 3707479175 + .long 1073567768 + .long 863738719 + .long 1073609879 + .long 2728693978 + .long 1073652911 + .long 1533953344 + .long 1073696886 + .long 531389993 + .long 1067950900 + .long 4289495988 + .long 1069842387 + .long 2705553552 + .long 3216330822 + .long 4277811695 + .long 3218484802 + .long 1874480759 + .long 1065595563 + .long 4286760334 + .long 1070514109 + .long 3607404735 + .long 1068264200 + .long 4277811695 + .long 1072049730 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 1048575 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 4227858432 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 1077936128 + .long 0 + .long 0 + .long 0 + .long 1122500608 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 2139095040 + .long 0 + .long 0 + .long 0 + .long 4286578688 + .long 0 + .long 0 + .long 0 + .long 1065353216 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2139095041 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,1584 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/powl.S b/external/sgx_libm/ia32/powl.S new file mode 100644 index 0000000000..ff72d76753 --- /dev/null +++ b/external/sgx_libm/ia32/powl.S @@ -0,0 +1,2423 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "powl.c" + .text +..TXTST0: +# -- Begin powl + .text + .align 16,0x90 + .globl powl +powl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $148, %esp +..B1.2: + fnstcw 70(%esp) +..B1.3: + movzbl 17(%ebp), %ecx + shrl $7, %ecx + movzwl 16(%ebp), %eax + shll $15, %ecx + andl $32767, %eax + orl %eax, %ecx + movl 12(%ebp), %ebx + shll $16, %ecx + shrl $16, %ebx + movl %eax, 44(%esp) + orl %ebx, %ecx + movzbl 29(%ebp), %eax + movl %ecx, %edi + shrl $7, %eax + movl %ecx, %edx + movzwl 28(%ebp), %esi + andl $2147483647, %edx + shll $15, %eax + andl $32767, %esi + movl 24(%ebp), %ebx + orl %esi, %eax + shrl $31, %edi + cmpl $1073709056, %edx + movl %edi, 28(%esp) + movl %ebx, %edi + movl %edx, 12(%esp) + movl $0, %edx + movl %esi, 48(%esp) + setb %dl + shll $16, %eax + shrl $16, %edi + orl %edi, %eax + movl %eax, %esi + andl $2147483647, %eax + shrl $31, %esi + xorl %esi, %edx + movl %edx, 124(%esp) + movl %eax, %edx + movl 8(%ebp), %edi + orl %ebx, %edx + movl %edi, 32(%esp) + movl 20(%ebp), %edi + orl %edi, %edx + movl %esi, 56(%esp) + movl %edx, 40(%esp) + movl %ebx, 60(%esp) + movl %edi, 36(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl 12(%ebp), %edx + movl 12(%esp), %esi + je ..B1.5 +..B1.4: + addl $-1073709056, %ecx + lea -2147483648(%edx), %edi + orl %edi, %ecx + movl %edi, 24(%esp) + orl 32(%esp), %ecx + jne ..B1.10 +..B1.5: + cmpl $2147450880, %eax + jae ..B1.8 +..B1.6: + cmpl $2147450880, %esi + jb ..B1.9 +..B1.7: + addl $-2147483648, %edx + orl 32(%esp), %edx + je ..B1.9 +..B1.8: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt 136(%esp) +..B1.9: + fldl _ones@GOTOFF(%ebx) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.10: + lea -1073709056(%eax), %ecx + movl %ecx, 20(%esp) + cmpl $4194304, %ecx + jae ..B1.17 +..B1.11: + movl %eax, %ecx + shrl $16, %ecx + movl %ecx, 52(%esp) + cmpl $1075806208, %eax + ja ..B1.13 +..B1.12: + movl %ebx, 12(%esp) + movl %ecx, %ebx + movl %ebx, %ecx + negl %ecx + addl $30, %ecx + movl 60(%esp), %edi + shrl %cl, %edi + lea 2(%ebx), %ecx + movl %edi, 16(%esp) + movl 60(%esp), %edi + shll %cl, %edi + movl 36(%esp), %ebx + orl %ebx, %edi + cmpl $1075740672, %eax + jbe ..L3 + movl %ebx, %edi +..L3: + movl 12(%esp), %ebx + movl %edi, 40(%esp) + jmp ..B1.14 +..B1.13: + movl %ebx, 12(%esp) + movl %ecx, %ebx + movl %ebx, %ecx + negl %ecx + addl $30, %ecx + movl 36(%esp), %edi + shrl %cl, %edi + lea 2(%ebx), %ecx + movl 36(%esp), %ebx + shll %cl, %ebx + cmpl $1077837824, %eax + movl %edi, 16(%esp) + jb ..L4 + movl $0, %ebx +..L4: + movl %ebx, 40(%esp) + movl 12(%esp), %ebx +..B1.14: + testb $1, 16(%esp) + je ..B1.16 +..B1.15: + movl 28(%esp), %ecx + movl %ecx, 108(%esp) + movl $1, 12(%esp) + jmp ..B1.18 +..B1.16: + xorl %ecx, %ecx + movl %ecx, 12(%esp) + movl %ecx, 108(%esp) + jmp ..B1.18 +..B1.17: + cmpl $1073709056, %eax + movl 40(%esp), %edi + jb ..L5 + movl $0, %edi +..L5: + xorl %ecx, %ecx + movl %ecx, 12(%esp) + movl %ecx, 108(%esp) + movl %edi, 40(%esp) +..B1.18: + cmpl $32767, 44(%esp) + je ..B1.189 +..B1.19: + cmpl $32767, 48(%esp) + je ..B1.156 +..B1.20: + movl %edx, %ecx + andl $2147483647, %ecx + orl 32(%esp), %ecx + jne ..B1.26 +..B1.21: + movl %edx, %ecx + orl %esi, %ecx + jne ..B1.26 +..B1.22: + xorl %edx, %edx + cmpl $0, 40(%esp) + sete %dl + andl %edx, 108(%esp) + cmpl $0, 56(%esp) + jne ..B1.193 +..B1.23: + cmpl $65536, %eax + jae ..B1.25 +..B1.24: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl 128(%esp) +..B1.25: + movl 108(%esp), %eax + fldl _zeros@GOTOFF(%ebx,%eax,8) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + cmpl $0, 28(%esp) + je ..B1.31 +..B1.27: + cmpl $1077837824, %eax + jae ..B1.29 +..B1.28: + cmpl $0, 40(%esp) + jne ..B1.192 +..B1.29: + lea -1073709056(%esi), %ecx + orl 24(%esp), %ecx + orl 32(%esp), %ecx + jne ..B1.31 +..B1.30: + movl 12(%esp), %eax + fldl _ones@GOTOFF(%ebx,%eax,8) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + lea -65536(%esi), %edi + lea -65536(%eax), %ecx + orl %ecx, %edi + testl $-2147483648, %edi + je ..B1.33 +..B1.32: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl 128(%esp) +..B1.33: + movl 60(%esp), %ecx + andl $2147483647, %ecx + orl 36(%esp), %ecx + jne ..B1.61 +..B1.34: + cmpl $1073709056, %eax + jne ..B1.43 +..B1.35: + cmpl $0, 56(%esp) + je ..B1.42 +..B1.36: + movzwl 70(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.141 +..B1.37: + orl $-64768, %edx + movw %dx, 68(%esp) +..B1.38: + fldcw 68(%esp) +..B1.39: + fldt 8(%ebp) + fdivrl _ones@GOTOFF(%ebx) + fstpt 24(%esp) +..B1.40: + fldcw 70(%esp) +..B1.41: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.42: + fldt 8(%ebp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + cmpl $1073643520, %eax + jne ..B1.61 +..B1.44: + movzwl 70(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.142 +..B1.45: + orl $-64768, %edx + movw %dx, 68(%esp) +..B1.46: + fldcw 68(%esp) +..B1.47: + movl $1, %esi +..B1.48: + cmpl $0, 56(%esp) + je ..B1.56 +..B1.49: + fldl _ones@GOTOFF(%ebx) + movzbl 17(%ebp), %edi + fld %st(0) + shrl $7, %edi + movzwl 16(%ebp), %eax + shll $15, %edi + andl $32767, %eax + orl %eax, %edi + shll $16, %edi + movzwl 14(%ebp), %edx + orl %edx, %edi + lea -536838144(%edi), %ecx + cmpl $1073741824, %ecx + jbe ..B1.53 +..B1.50: + fstp %st(0) + cmpl $536838144, %edi + jae ..B1.52 +..B1.51: + fldt 8(%ebp) + fldt _invsqrtl_scales@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 12+_invsqrtl_scales@GOTOFF(%ebx) + fldt 8(%ebp) + fxch %st(2) + fxch %st(1) + fxch %st(2) + jmp ..B1.54 +..B1.52: + fldt 8(%ebp) + fldt 24+_invsqrtl_scales@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 36+_invsqrtl_scales@GOTOFF(%ebx) + fldt 8(%ebp) + fxch %st(2) + fxch %st(1) + fxch %st(2) + jmp ..B1.54 +..B1.53: + fldt 8(%ebp) + fld %st(0) +..B1.54: + fldl _TWO_43H@GOTOFF(%ebx) + fld %st(2) + fmul %st(1), %st + fxch %st(3) + fdivr %st, %st(5) + fxch %st(5) + fstpt 12(%esp) + fxch %st(2) + fadd %st, %st(4) + fxch %st(4) + fstpt (%esp) + fldt (%esp) + addl $-16, %esp + fsubp %st, %st(4) + fsub %st(3), %st + lea 28(%esp), %eax + movl %eax, (%esp) + fstpt 28(%eax) + fstpt 12(%eax) + fxch %st(1) + fstpt 44(%eax) + fstpt 60(%eax) + call __sqrtl +..B1.196: + fldt 88(%esp) + fldt 72(%esp) + fldt 56(%esp) + fldt 40(%esp) + addl $16, %esp +..B1.55: + fmul %st(4), %st + fld %st(4) + fadd %st(1), %st + fstpt (%esp) + fld %st(4) + fxch %st(2) + fmul %st(5), %st + fxch %st(5) + fstpt 12(%esp) + fldt 12(%esp) + fldt (%esp) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fld %st(3) + fmul %st(3), %st + faddp %st, %st(6) + fxch %st(1) + fmul %st, %st(5) + fld %st(2) + fxch %st(2) + fmul %st, %st(4) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(6) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddl 8+_ones@GOTOFF(%ebx) + faddp %st, %st(5) + fmulp %st, %st(4) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fmulp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 24(%esp) + jmp ..B1.58 +..B1.56: + addl $-16, %esp + lea 8(%ebp), %eax + movl %eax, (%esp) + call __sqrtl +..B1.197: + addl $16, %esp +..B1.57: + fstpt 24(%esp) +..B1.58: + testl %esi, %esi + je ..B1.60 +..B1.59: + fldcw 70(%esp) +..B1.60: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + movzwl 70(%esp), %edi + movl %edi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.155 +..B1.62: + orl $-64768, %edi + movw %di, 68(%esp) +..B1.63: + fldcw 68(%esp) +..B1.64: + movl $1, 36(%esp) +..B1.65: + fldt 8(%ebp) + movl 28(%esp), %ecx + cmpl $0, 40(%esp) + fmull _ones@GOTOFF(%ebx,%ecx,8) + fstpt 8(%ebp) + fldt 8(%ebp) + jne ..B1.92 +..B1.66: + cmpl $1048576, 20(%esp) + jae ..B1.92 +..B1.67: + movl %eax, %ecx + shrl $16, %ecx + negl %ecx + addl $30, %ecx + movl 60(%esp), %edi + shrl %cl, %edi + cmpl $46, %edi + movl %edi, 60(%esp) + lea -2(%edi), %ecx + movl 32(%esp), %edi + jb ..L6 + movl $46, %ecx +..L6: + andl 4+_exact_masks@GOTOFF(%ebx,%ecx,8), %edx + andl _exact_masks@GOTOFF(%ebx,%ecx,8), %edi + movl %ecx, 52(%esp) + orl %edi, %edx + jne ..B1.92 +..B1.68: + movl 108(%esp), %eax + cmpl $65535, %esi + fldl _ones@GOTOFF(%ebx,%eax,8) + ja ..B1.70 +..B1.69: + fldl _TWO_75@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 40(%esp) + movzwl 48(%esp), %ecx + movl %ecx, %edx + andl $32767, %edx + addl $-16458, %edx + jmp ..B1.71 +..B1.70: + movzwl 16(%ebp), %edx + fxch %st(1) + fstpt 40(%esp) + andl $32767, %edx + movzwl 48(%esp), %ecx + addl $-16383, %edx +..B1.71: + movl 56(%esp), %eax + andl $-32768, %ecx + orl $-49153, %ecx + movw %cx, 48(%esp) + movl iones@GOTOFF(%ebx,%eax,4), %eax + imull 60(%esp), %eax + imull %edx, %eax + lea 16445(%eax), %ecx + cmpl $32829, %ecx + lea 16383(%eax), %edx + jb ..B1.78 +..B1.72: + movl 108(%esp), %ecx + cmpl $-63, %edx + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %eax + jg ..B1.74 +..B1.73: + fldt _small_value_80@GOTOFF(%eax,%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + jmp ..B1.75 +..B1.74: + fldt _large_value_80@GOTOFF(%eax,%ebx) + fldt _large_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.75: + fstpt 24(%esp) + cmpl $0, 36(%esp) + je ..B1.200 +..B1.76: + fstpt 12(%esp) +..B1.198: + fldcw 70(%esp) + jmp ..B1.77 +..B1.200: + fstp %st(0) +..B1.77: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + fstpt 12(%esp) + testl %edx, %edx + jg ..B1.80 +..B1.79: + addl $16458, %eax + movzwl 20(%esp), %edx + andl $32767, %eax + andl $-32768, %edx + orl %eax, %edx + movw %dx, 20(%esp) + fldt 12(%esp) + fmull 8+_TWO_75@GOTOFF(%ebx) + fstpt 12(%esp) + jmp ..B1.81 +..B1.80: + movzwl 20(%esp), %eax + andl $32767, %edx + andl $-32768, %eax + orl %edx, %eax + movw %ax, 20(%esp) +..B1.81: + cmpl $-2147483648, 44(%esp) + jne ..B1.87 +..B1.82: + cmpl $0, 40(%esp) + jne ..B1.87 +..B1.83: + fldt 12(%esp) + fstpt 24(%esp) +..B1.84: + cmpl $0, 36(%esp) + je ..B1.86 +..B1.85: + fldcw 70(%esp) +..B1.86: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.87: + fldt 40(%esp) + fstpt 24(%esp) + fldt 24(%esp) + fstpt 96(%esp) + fldt 96(%esp) + fldl _ones@GOTOFF(%ebx) + movl $0, 24(%esp) + fstpt 72(%esp) + fldt 72(%esp) + fldt 24(%esp) + movl 60(%esp), %eax + fsubr %st, %st(2) + fldt 72(%esp) + fldl _zeros@GOTOFF(%ebx) + jmp ..B1.88 +..B1.91: + fld %st(2) + fadd %st(5), %st + fld %st(3) + fmul %st(6), %st + fxch %st(4) + fmul %st(0), %st + fstpt 24(%esp) + fldt 24(%esp) + fxch %st(1) + fmulp %st, %st(6) + movl $0, 24(%esp) + fxch %st(5) + faddp %st, %st(3) + fxch %st(4) + fstpt 96(%esp) + fldt 96(%esp) + fldt 24(%esp) + fsubr %st, %st(1) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(3) + fxch %st(2) + fxch %st(4) +..B1.88: + testb $1, %al + je ..B1.90 +..B1.89: + fld %st(4) + fadd %st(3), %st + fmulp %st, %st(1) + fld %st(4) + fmul %st(2), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + fstpt 72(%esp) + fldt 72(%esp) + fstpt 96(%esp) + fldt 96(%esp) + movl $0, 72(%esp) + fldt 72(%esp) + fsubr %st, %st(1) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fxch %st(1) +..B1.90: + shrl $1, %eax + testl %eax, %eax + je ..B1.143 + jmp ..B1.91 +..B1.92: + lea -1073676224(%esi), %edx + cmpl $32864, %edx + jae ..B1.94 +..B1.93: + fldl 8+_ones@GOTOFF(%ebx) + movl $1, %ecx + faddp %st, %st(1) + fld %st(0) + fld %st(1) + fxch %st(2) + fstpt 40(%esp) + fldt 40(%esp) + fldl _TWO_32H@GOTOFF(%ebx) + fstpt 112(%esp) + fldt 112(%esp) + fmul %st(1), %st + fadd %st, %st(2) + fxch %st(2) + fstpt 84(%esp) + fldt 84(%esp) + fsubp %st, %st(2) + fxch %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fsubr %st, %st(2) + fxch %st(1) + fxch %st(2) + fxch %st(1) + jmp ..B1.98 +..B1.94: + cmpl $65535, %esi + ja ..B1.96 +..B1.95: + fmull _TWO_75@GOTOFF(%ebx) + fstpt 40(%esp) + movzwl 48(%esp), %ecx + movl %ecx, %edx + andl $32767, %edx + addl $-16458, %edx + movl %edx, 52(%esp) + jmp ..B1.97 +..B1.96: + movzwl 16(%ebp), %edx + andl $32767, %edx + fstpt 40(%esp) + addl $-16383, %edx + movl %edx, 52(%esp) + movzwl 48(%esp), %ecx +..B1.97: + fldl _TWO_32H@GOTOFF(%ebx) + andl $-32768, %ecx + orl $-49153, %ecx + movw %cx, 48(%esp) + xorl %ecx, %ecx + movl 44(%esp), %edx + shrl $23, %edx + movzbl %dl, %edx + fstpt 112(%esp) + fldt 112(%esp) + fldt 40(%esp) + fld %st(0) + fmul %st(2), %st + fld %st(1) + fadd %st(1), %st + fstpt 84(%esp) + fldt 84(%esp) + fsubp %st, %st(1) + fsubr %st, %st(1) + flds __libm_rcp_table_256@GOTOFF(%ebx,%edx,4) + fmul %st, %st(1) + fstpt 56(%esp) + fldt 56(%esp) + fmulp %st, %st(2) + faddl 8+_ones@GOTOFF(%ebx) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fstpt 84(%esp) + fstpt 40(%esp) + fldt 40(%esp) + fldt 84(%esp) + fsubp %st, %st(4) + fxch %st(3) + fstpt 24(%esp) + fldt 24(%esp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) +..B1.98: + fldt 112(%esp) + testl %ecx, %ecx + fld %st(0) + fxch %st(2) + fadd %st, %st(4) + fxch %st(3) + fmul %st, %st(4) + fxch %st(3) + fmul %st(0), %st + fld %st(0) + fadd %st(5), %st + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fstpt 84(%esp) + fldt 84(%esp) + fsubp %st, %st(4) + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(5) + fldt 96+_LP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 84+_LP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 72+_LP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_LP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_LP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_LP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_LP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_LP@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 40(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(0) + fmul %st(3), %st + fld %st(1) + fadd %st(1), %st + fstpt 84(%esp) + fldt 84(%esp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(7), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fmul %st(3), %st + fldt _LP@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + fstpt 96(%esp) + fldt 96(%esp) + fadd %st(1), %st + fstpt 72(%esp) + fldt 72(%esp) + fxch %st(4) + fmulp %st, %st(6) + fxch %st(1) + faddp %st, %st(5) + fldt 96(%esp) + fsub %st(3), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 24(%esp) + fstpt 96(%esp) + fldt 96(%esp) + fadd %st(1), %st + fstpt 24(%esp) + fldt 24(%esp) + fldt 96(%esp) + fsub %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + je ..B1.100 +..B1.99: + fstpt 40(%esp) + fldt 40(%esp) + jmp ..B1.101 +..B1.100: + fstp %st(0) + fldt 12+_LLN2@GOTOFF(%ebx) + movl %edx, %ecx + fldt _LLN2@GOTOFF(%ebx) + shll $4, %ecx + fldl 8+__libm_logl_table_256@GOTOFF(%ecx,%ebx) + fldl __libm_logl_table_256@GOTOFF(%ecx,%ebx) + fxch %st(1) + fadds _LT2@GOTOFF(%ebx,%edx,4) + movl 52(%esp), %edx + movl %edx, 16(%esp) + fildl 16(%esp) + fmul %st, %st(3) + fxch %st(3) + fstpt 96(%esp) + fldt 96(%esp) + fadd %st(2), %st + fxch %st(3) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt 96(%esp) + fsub %st(2), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fldt 24(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpt 40(%esp) + fldt 40(%esp) + fldt 96(%esp) + fsub %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) +..B1.101: + fld %st(0) + fadd %st(2), %st + fstpt 56(%esp) + fldt 56(%esp) + movzwl 64(%esp), %ecx + shll $16, %ecx + movzwl 62(%esp), %edx + orl %edx, %ecx + andl $2147483647, %ecx + lea (%eax,%ecx), %edx + lea -1610514432(%ecx,%eax), %eax + cmpl $538050560, %eax + jbe ..B1.113 +..B1.102: + cmpl $-2146402304, %edx + jbe ..B1.109 +..B1.103: + fstp %st(0) + fstp %st(2) + fstp %st(0) + fstp %st(0) + movl 108(%esp), %edx + cmpl $0, 124(%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %eax + je ..B1.105 +..B1.104: + fldt _small_value_80@GOTOFF(%eax,%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + jmp ..B1.106 +..B1.105: + fldt _large_value_80@GOTOFF(%eax,%ebx) + fldt _large_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.106: + fstpt 24(%esp) + cmpl $0, 36(%esp) + je ..B1.108 +..B1.107: + fldcw 70(%esp) +..B1.108: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.109: + cmpl $1610514432, %edx + jae ..B1.113 +..B1.110: + fstp %st(0) + fstp %st(2) + fstp %st(0) + fstp %st(0) + movl 108(%esp), %ecx + movl 124(%esp), %eax + xorl %ecx, %eax + cmpl $0, 36(%esp) + lea (,%eax,8), %esi + lea (%esi,%eax,4), %edx + fldt _small_value_80@GOTOFF(%ebx,%edx) + faddl _ones@GOTOFF(%ebx,%ecx,8) + fstpt 24(%esp) + je ..B1.112 +..B1.111: + fldcw 70(%esp) +..B1.112: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.113: + fldt 56(%esp) + fxch %st(1) + fmulp %st, %st(4) + movl 108(%esp), %eax + fadd %st(3), %st + fxch %st(1) + fstpt 96(%esp) + fstpt 84(%esp) + fldt 84(%esp) + fsubp %st, %st(2) + fxch %st(1) + fstpt 40(%esp) + fldt 40(%esp) + fldt 96(%esp) + fsub %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fldt 112(%esp) + fldt 20(%ebp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 84(%esp) + fld %st(0) + fxch %st(1) + fmulp %st, %st(4) + fldt 84(%esp) + fsubp %st, %st(2) + fsub %st(1), %st + fmul %st(2), %st + faddp %st, %st(3) + fld %st(2) + fxch %st(1) + fmulp %st, %st(2) + fadd %st(1), %st + fstpt 56(%esp) + fldt 56(%esp) + fldl _ones@GOTOFF(%ebx,%eax,8) + movzwl 64(%esp), %eax + shll $16, %eax + movzwl 62(%esp), %edx + orl %edx, %eax + andl $2147483647, %eax + cmpl $1072398336, %eax + jae ..B1.120 +..B1.114: + cmpl $1069318144, %eax + jae ..B1.116 +..B1.115: + fstp %st(3) + fmul %st(2), %st + fadd %st(2), %st + fxch %st(2) + jmp ..B1.117 +..B1.116: + fldt 12+_EP1@GOTOFF(%ebx) + fmul %st(2), %st + fldt _EP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + fadd %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fld %st(0) + faddp %st, %st(3) +..B1.117: + fxch %st(2) + fstpt 24(%esp) + cmpl $0, 36(%esp) + je ..B1.201 +..B1.118: + fstpt 40(%esp) + fstpt 12(%esp) +..B1.199: + fldcw 70(%esp) + jmp ..B1.119 +..B1.201: + fstp %st(0) + fstp %st(0) +..B1.119: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.120: + fldl _TWO_63H@GOTOFF(%ebx) + fxch %st(1) + fstpt 12(%esp) + fxch %st(2) + fstpt 40(%esp) + fldt 40(%esp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + movl 124(%esp), %eax + fadd %st(2), %st + fstpt 84(%esp) + fldt 84(%esp) + movl 84(%esp), %ecx + fsubp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fldt 96(%esp) + fldt 112(%esp) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fmulp %st, %st(3) + movsbl %cl, %edx + fxch %st(2) + fsubrp %st, %st(3) + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + movl %ecx, 24(%esp) + subl %edx, %ecx + sarl $8, %ecx + fsubr %st(2), %st + movl ESC2_BIAS@GOTOFF(%ebx,%eax,4), %esi + fadd %st(1), %st + fstpt 84(%esp) + lea -1(%esi,%ecx), %edi + fldt 84(%esp) + lea (%esi,%ecx), %eax + cmpl $32766, %edi + fsubp %st, %st(1) + fsubr %st, %st(1) + fldt 96(%esp) + fsubrp %st, %st(2) + jb ..B1.127 +..B1.121: + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl 108(%esp), %ecx + cmpl $1, %eax + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + jg ..B1.123 +..B1.122: + fldt _small_value_80@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + jmp ..B1.124 +..B1.123: + fldt _large_value_80@GOTOFF(%edx,%ebx) + fldt _large_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.124: + fstpt 24(%esp) + cmpl $0, 36(%esp) + je ..B1.126 +..B1.125: + fldcw 70(%esp) +..B1.126: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.127: + fldt 48+_EP@GOTOFF(%ebx) + andl $32767, %eax + fstpt 96(%esp) + fld %st(0) + shll $4, %edx + fxch %st(2) + faddp %st, %st(3) + movzwl 20(%esp), %esi + fxch %st(1) + fadd %st(2), %st + fld %st(0) + andl $-32768, %esi + fmul %st(1), %st + orl %eax, %esi + fldt 96(%esp) + fmul %st(1), %st + fstpt 96(%esp) + fldt 36+_EP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_EP@GOTOFF(%ebx) + fldt 12+_EP@GOTOFF(%ebx) + movl 24(%esp), %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + addl $4196735, %eax + fmulp %st, %st(3) + cmpl $3070, %eax + fldt 96(%esp) + movw %si, 20(%esp) + faddp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fmul %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + fldt _EP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fmulp %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(1) + faddp %st, %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%ebx) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%ebx) + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fadd %st, %st(4) + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmul %st, %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fadd %st(1), %st + fldt 96(%esp) + fsub %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + ja ..B1.130 +..B1.128: + fldt 56(%esp) + fldt _Eexpbut@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jbe ..B1.130 +..B1.129: + fldl _TWO_12H@GOTOFF(%ebx) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fadd %st(2), %st + fmul %st, %st(1) + movl 124(%esp), %eax + fadd %st(1), %st + fstpt 84(%esp) + lea (,%eax,8), %esi + fldt 84(%esp) + lea (%esi,%eax,4), %edx + fsubp %st, %st(1) + fldt 96(%esp) + fsub %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(2) + fldt 12(%esp) + fmul %st, %st(1) + fmulp %st, %st(2) + fldt _ESC2@GOTOFF(%edx,%ebx) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 24(%esp) + jmp ..B1.131 +..B1.130: + movl 124(%esp), %eax + lea (,%eax,8), %esi + lea (%esi,%eax,4), %edx + fldt _ESC2@GOTOFF(%edx,%ebx) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 12(%esp) + fmulp %st, %st(1) + fstpt 24(%esp) +..B1.131: + movzwl 32(%esp), %eax + shll $16, %eax + movzwl 30(%esp), %edx + orl %edx, %eax + andl $2147483647, %eax + lea -98304(%eax), %ecx + cmpl $2147319808, %ecx + jb ..B1.138 +..B1.132: + movl 108(%esp), %ecx + cmpl $65535, %eax + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + ja ..B1.134 +..B1.133: + fldt _small_value_80@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 136(%esp) + jmp ..B1.135 +..B1.134: + fldt _large_value_80@GOTOFF(%edx,%ebx) + fldt _large_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 24(%esp) +..B1.135: + cmpl $0, 36(%esp) + je ..B1.137 +..B1.136: + fldcw 70(%esp) +..B1.137: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.138: + cmpl $0, 36(%esp) + je ..B1.140 +..B1.139: + fldcw 70(%esp) +..B1.140: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.141: + fldt 8(%ebp) + fdivrl _ones@GOTOFF(%ebx) + fstpt 24(%esp) + jmp ..B1.41 +..B1.142: + xorl %esi, %esi + jmp ..B1.48 +..B1.143: + fstp %st(2) + fstp %st(3) + cmpl $0, 56(%esp) + jne ..B1.145 +..B1.144: + fstp %st(1) + fxch %st(1) + fstpt 40(%esp) + fldt 40(%esp) + fxch %st(1) + jmp ..B1.146 +..B1.145: + fld %st(2) + fadd %st(1), %st + fdivr %st, %st(2) + fxch %st(2) + fstpt 40(%esp) + fldt 40(%esp) + movl $0, 40(%esp) + fstpt 56(%esp) + fldt 56(%esp) + fldt 40(%esp) + fld %st(0) + fsubr %st(2), %st + fmul %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddl 8+_ones@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fsubrp %st, %st(1) +..B1.146: + fldt 12(%esp) + fld %st(2) + fmul %st(1), %st + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + fstpt 24(%esp) + movzwl 32(%esp), %eax + shll $16, %eax + movzwl 30(%esp), %edx + orl %edx, %eax + andl $2147483647, %eax + cmpl $65535, %eax + ja ..B1.148 +..B1.147: + fldt 40(%esp) + fmul %st(1), %st + fstpt 40(%esp) + fldt 40(%esp) + fxch %st(3) + fstpt 96(%esp) + fld %st(0) + fdivr %st(3), %st + fldt 96(%esp) + fsub %st(1), %st + fstpt 96(%esp) + fldt 96(%esp) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st, %st(3) + fxch %st(3) + fstpt 24(%esp) + movzwl 32(%esp), %eax + shll $16, %eax + movzwl 30(%esp), %edx + orl %edx, %eax + andl $2147483647, %eax + fxch %st(2) + fxch %st(1) +..B1.148: + fstp %st(1) + fstp %st(1) + fstp %st(0) + lea -98304(%eax), %edx + cmpl $2147319808, %edx + jb ..B1.84 +..B1.149: + movl 108(%esp), %ecx + cmpl $65535, %eax + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %edx + ja ..B1.151 +..B1.150: + fldt _small_value_80@GOTOFF(%edx,%ebx) + fldt _small_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 136(%esp) + jmp ..B1.152 +..B1.151: + fldt _large_value_80@GOTOFF(%edx,%ebx) + fldt _large_value_80@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 24(%esp) +..B1.152: + cmpl $0, 36(%esp) + je ..B1.154 +..B1.153: + fldcw 70(%esp) +..B1.154: + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.155: + movl $0, 36(%esp) + jmp ..B1.65 +..B1.156: + cmpl $-2147483648, 60(%esp) + jne ..B1.158 +..B1.157: + cmpl $0, 36(%esp) + je ..B1.159 +..B1.158: + fldt 8(%ebp) + fldt 20(%ebp) + fmulp %st, %st(1) + fstpt 136(%esp) + fldt 136(%esp) + fstpt 24(%esp) + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.159: + cmpl $32767, 44(%esp) + je ..B1.181 +..B1.160: + cmpl $32767, 48(%esp) + jne ..B1.20 +..B1.161: + cmpl $-2147483648, 60(%esp) + jne ..B1.20 +..B1.162: + cmpl $0, 36(%esp) + jne ..B1.20 +..B1.163: + cmpl $1073709056, %esi + jae ..B1.174 +..B1.164: + movl 32(%esp), %eax + orl %esi, %eax + jne ..B1.168 +..B1.165: + fldl _zeros@GOTOFF(%ebx) + cmpl $0, 56(%esp) + jne ..B1.180 +..B1.167: + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.168: + cmpl $65536, %esi + jae ..B1.170 +..B1.169: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl 128(%esp) +..B1.170: + cmpl $0, 56(%esp) + je ..B1.172 +..B1.171: + fldl _infs@GOTOFF(%ebx) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.172: + fldl _zeros@GOTOFF(%ebx) +..B1.173: + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.174: + addl $-1073709056, %esi + orl 24(%esp), %esi + orl 32(%esp), %esi + je ..B1.179 +..B1.175: + cmpl $0, 56(%esp) + je ..B1.177 +..B1.176: + fldl _zeros@GOTOFF(%ebx) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.177: + fldl _infs@GOTOFF(%ebx) +..B1.178: + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.179: + movl 12(%esp), %eax + fldl _ones@GOTOFF(%ebx,%eax,8) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.180: + fldl _ones@GOTOFF(%ebx) + fdivp %st, %st(1) + fstpt 24(%esp) + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.181: + cmpl $-2147483648, %edx + jne ..B1.160 +..B1.182: + cmpl $0, 32(%esp) + jne ..B1.160 +..B1.183: + cmpl $65536, %eax + jae ..B1.185 +..B1.184: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl 128(%esp) +..B1.185: + cmpl $0, 40(%esp) + movl %ecx, %eax + je ..L7 + movl $0, %eax +..L7: + movl %eax, 108(%esp) + cmpl $0, 56(%esp) + je ..B1.187 +..B1.186: + fldl _zeros@GOTOFF(%ebx,%eax,8) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.187: + fldl _infs@GOTOFF(%ebx,%eax,8) +..B1.188: + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.189: + cmpl $-2147483648, %edx + jne ..B1.158 +..B1.190: + cmpl $0, 32(%esp) + jne ..B1.158 +..B1.191: + cmpl $32767, 48(%esp) + je ..B1.156 + jmp ..B1.159 +..B1.192: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt 24(%esp) + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.193: + movl 108(%esp), %eax + fldl _ones@GOTOFF(%ebx,%eax,8) + fdivl _zeros@GOTOFF(%ebx) + fstpt 24(%esp) + fldt 24(%esp) + addl $148, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type powl,@function + .size powl,.-powl + .data +# -- End powl + .text +# -- Begin __sqrtl + .text + .align 16,0x90 +__sqrtl: +# parameter 1: 4 + %esp +..B2.1: +..L8: + +..B2.2: + movl 4(%esp), %ecx + fldt (%ecx) + fsqrt + ret +..B2.3: + .align 16,0x90 + .type __sqrtl,@function + .size __sqrtl,.-__sqrtl + .data +# -- End __sqrtl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_43H: + .long 0 + .long 1118306304 + .type _TWO_43H,@object + .size _TWO_43H,8 + .align 4 +_exact_masks: + .long 131071 + .long 0 + .long 4294967295 + .long 1 + .long 4294967295 + .long 511 + .long 4294967295 + .long 16383 + .long 4294967295 + .long 131071 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 2097151 + .long 4294967295 + .long 8388607 + .long 4294967295 + .long 16777215 + .long 4294967295 + .long 33554431 + .long 4294967295 + .long 33554431 + .long 4294967295 + .long 67108863 + .long 4294967295 + .long 134217727 + .long 4294967295 + .long 134217727 + .long 4294967295 + .long 134217727 + .long 4294967295 + .long 268435455 + .long 4294967295 + .long 268435455 + .long 4294967295 + .long 268435455 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .type _exact_masks,@object + .size _exact_masks,376 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_LT2: + .long 180342526 + .long 2357584585 + .long 2340989257 + .long 193458247 + .long 2370723239 + .long 2317577053 + .long 2382055315 + .long 232148275 + .long 200972627 + .long 2376530255 + .long 2376860906 + .long 222325808 + .long 228268523 + .long 229816737 + .long 2387925496 + .long 239088248 + .long 235445027 + .long 219576635 + .long 2365457762 + .long 200344795 + .long 2377779510 + .long 2396359259 + .long 256760275 + .long 2390604874 + .long 2403557039 + .long 2397936349 + .long 2387307486 + .long 2389941185 + .long 2375749593 + .long 224865835 + .long 2394232861 + .long 180745560 + .long 231885773 + .long 2352962188 + .long 2306055684 + .long 206875141 + .long 258325764 + .long 2386208973 + .long 231066739 + .long 195513036 + .long 2360327132 + .long 2396045581 + .long 236564318 + .long 2282584976 + .long 2351736009 + .long 236364231 + .long 2384427773 + .long 267355851 + .long 255771104 + .long 265321597 + .long 2384375360 + .long 2399209743 + .long 186438128 + .long 2407131686 + .long 2382793784 + .long 2395218767 + .long 229223248 + .long 256892528 + .long 2394735602 + .long 2385223602 + .long 2372921302 + .long 2398642377 + .long 2399679754 + .long 255686225 + .long 220689523 + .long 2385772978 + .long 209771590 + .long 2396079173 + .long 247531082 + .long 236085121 + .long 264660069 + .long 2357821390 + .long 236486650 + .long 2368138461 + .long 239690108 + .long 2396070228 + .long 196955922 + .long 217533735 + .long 255641653 + .long 249646543 + .long 253232621 + .long 246212714 + .long 2396427575 + .long 261629730 + .long 2364672847 + .long 2403865410 + .long 251273869 + .long 261125380 + .long 2388321036 + .long 2375891827 + .long 2381014317 + .long 2414822930 + .long 2406245053 + .long 2406988902 + .long 2395399973 + .long 213294711 + .long 2401319324 + .long 265450299 + .long 231845893 + .long 260578794 + .long 258934474 + .long 2368795786 + .long 2422506717 + .long 218205033 + .long 258708287 + .long 257044854 + .long 2396281866 + .long 2415975150 + .long 257697283 + .long 2393801226 + .long 2388654986 + .long 262910764 + .long 235638432 + .long 268054962 + .long 271083258 + .long 256780444 + .long 256064350 + .long 252979189 + .long 2420460964 + .long 233178508 + .long 251655134 + .long 2404577473 + .long 2408876374 + .long 2401072099 + .long 228623072 + .long 2421706621 + .long 2353033467 + .long 2411792212 + .long 2345330012 + .long 2397189005 + .long 243110369 + .long 2408213151 + .long 219253901 + .long 246695172 + .long 259288551 + .long 254210780 + .long 261865355 + .long 230359170 + .long 263524551 + .long 2405618542 + .long 2399869921 + .long 233826616 + .long 2362750769 + .long 257576291 + .long 251808114 + .long 2403390977 + .long 253249058 + .long 261065811 + .long 215406974 + .long 2407628993 + .long 258391343 + .long 2394470699 + .long 258495470 + .long 2415771687 + .long 224670583 + .long 263047889 + .long 2389031226 + .long 259453051 + .long 266564569 + .long 2422023012 + .long 264051375 + .long 2409075373 + .long 252244729 + .long 220302768 + .long 254847756 + .long 243124762 + .long 2363519942 + .long 2393496158 + .long 2402135082 + .long 2365706590 + .long 237902971 + .long 262295026 + .long 252689257 + .long 236678680 + .long 255167613 + .long 2406879752 + .long 274254693 + .long 259983961 + .long 245852525 + .long 256459527 + .long 220533989 + .long 245387845 + .long 243835221 + .long 2377853444 + .long 274540751 + .long 229741069 + .long 263626566 + .long 220608387 + .long 226161046 + .long 247301717 + .long 268433686 + .long 222008210 + .long 2414961139 + .long 276137642 + .long 2412197898 + .long 258445918 + .long 2412645341 + .long 260857859 + .long 263113037 + .long 2386484264 + .long 2390742630 + .long 259665290 + .long 2363417497 + .long 2384122046 + .long 263493300 + .long 219472625 + .long 2420433676 + .long 274201285 + .long 2404911312 + .long 257926520 + .long 260332203 + .long 256695016 + .long 218494534 + .long 2420150889 + .long 2414586287 + .long 267006159 + .long 231320206 + .long 2382797064 + .long 2414903062 + .long 263514471 + .long 2406010284 + .long 2410428205 + .long 2414319991 + .long 249083715 + .long 2381171937 + .long 236369629 + .long 2409614279 + .long 2424220710 + .long 2378379154 + .long 218677462 + .long 2382987336 + .long 2377870458 + .long 258155310 + .long 2368239928 + .long 2414896572 + .long 193310867 + .long 256673115 + .long 2406448055 + .long 271719709 + .long 248566852 + .long 229016248 + .long 272541555 + .long 2382115967 + .long 2375311600 + .long 2393766434 + .long 257187362 + .long 277931545 + .long 281038165 + .long 2373962226 + .long 261638946 + .long 255465134 + .long 273460929 + .long 275851296 + .long 2417166241 + .long 2361106656 + .long 278653754 + .type _LT2,@object + .size _LT2,1024 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +ESC2_BIAS: + .long 4095 + .long 28671 + .type ESC2_BIAS,@object + .size ESC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_invsqrtl_scales: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 20479 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 12287 + .word 0 + .type _invsqrtl_scales,@object + .size _invsqrtl_scales,48 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_LP: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49149 + .word 0 + .word 52785 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 44453 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 25655 + .word 14678 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 38741 + .word 53722 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 45676 + .word 59527 + .word 48579 + .word 58254 + .word 16379 + .word 0 + .word 41682 + .word 64796 + .word 25002 + .word 52429 + .word 49147 + .word 0 + .type _LP,@object + .size _LP,108 + .align 2 +_LLN2: + .word 0 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 2022 + .word 26416 + .word 37831 + .word 62295 + .word 16333 + .word 0 + .type _LLN2,@object + .size _LLN2,24 + .align 2 +_EP1: + .word 43691 + .word 10 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 30584 + .word 43703 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _EP1,@object + .size _EP1,24 + .align 2 +_EP: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _EP,@object + .size _EP,60 + .align 2 +_Eexpbut: + .word 60207 + .word 4624 + .word 35943 + .word 45420 + .word 49164 + .word 0 + .type _Eexpbut,@object + .size _Eexpbut,12 + .align 2 +_ESC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 28671 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 4095 + .word 0 + .type _ESC2,@object + .size _ESC2,24 + .data + .hidden __libm_rcp_table_256 + .hidden __libm_logl_table_256 + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/q2l.S b/external/sgx_libm/ia32/q2l.S new file mode 100644 index 0000000000..a9c7852f18 --- /dev/null +++ b/external/sgx_libm/ia32/q2l.S @@ -0,0 +1,353 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "q2l.c" + .text +..TXTST0: +# -- Begin __qtol + .text + .align 16,0x90 + .globl __qtol +__qtol: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + movl 8(%ebp), %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + movl 12(%eax), %edx + movl 8(%eax), %esi + movl %ecx, 16(%esp) + movl (%eax), %ecx + movl 4(%eax), %ebx + movl %edx, %eax + movl %edx, 12(%esp) + movzwl %dx, %edi + movl %esi, %edx + shrl $17, %edx + shll $15, %edi + orl %edi, %edx + movl %ebx, %edi + shll $15, %esi + shrl $17, %edi + orl %edi, %esi + movl %ecx, %edi + shrl $16, %eax + shrl $17, %edi + shll $15, %ebx + movl %eax, 24(%esp) + andl $32767, %eax + shll $15, %ecx + orl %ebx, %edi + movl %edi, 28(%esp) + cmpl $32767, %eax + jne ..B1.7 +..B1.2: + movl %edi, %eax + orl %esi, %ecx + orl %edx, %eax + orl %eax, %ecx + je ..B1.6 +..B1.3: + movl %edx, %eax + xorl %ecx, %ecx + andl $1073741824, %eax + orl %eax, %ecx + jne ..B1.5 +..B1.4: + movl 16(%esp), %eax + movl p_zero@GOTOFF(%eax), %ecx + fldl (%ecx) + fdiv %st(0), %st + fstpl (%esp) +..B1.5: + orl $-1073741824, %edx +..B1.6: + movl 24(%esp), %eax + orl $-2147483648, %edx + movl %eax, 16(%esp) + movl %esi, 8(%esp) + movl %edx, 12(%esp) + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.7: + testl %eax, %eax + je ..B1.9 +..B1.8: + orl $-2147483648, %edx + jmp ..B1.11 +..B1.9: + movl %esi, %edi + movl %edx, %ebx + orl 28(%esp), %ebx + orl %ecx, %edi + orl %ebx, %edi + je ..B1.22 +..B1.10: + movl 16(%esp), %edi + movl p_tiny@GOTOFF(%edi), %ebx + fldl (%ebx) + movl p_one@GOTOFF(%edi), %ebx + fmull (%ebx) + fstpl (%esp) +..B1.11: + movl %ecx, %ebx + orl 28(%esp), %ebx + je ..B1.21 +..B1.12: + fnstcw 20(%esp) +..B1.13: + movl 20(%esp), %ebx + andl $3072, %ebx + movl %ebx, 8(%esp) + jne ..B1.15 +..B1.14: + xorl %ebx, %ebx + movl 28(%esp), %edi + subl %ebx, %edi + jl ..B1.23 + jmp ..B1.18 +..B1.15: + testl $-2147483648, 12(%esp) + je ..B1.17 +..B1.16: + cmpl $1024, 8(%esp) + je ..B1.23 + jmp ..B1.18 +..B1.17: + cmpl $2048, 8(%esp) + je ..B1.23 +..B1.18: + testl %eax, %eax + jne ..B1.20 +..B1.19: + movl 16(%esp), %eax + movl p_norm@GOTOFF(%eax), %ecx + fldl (%ecx) + fmul %st(0), %st + fstpl (%esp) + jmp ..B1.21 +..B1.20: + movl 16(%esp), %eax + movl p_one@GOTOFF(%eax), %ecx + movl p_norm@GOTOFF(%eax), %ebx + fldl (%ecx) + faddl (%ebx) + fstpl (%esp) +..B1.21: + movl 24(%esp), %eax + movl %eax, 16(%esp) + movl %esi, 8(%esp) + movl %edx, 12(%esp) + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.22: + movl 24(%esp), %eax + xorl %edx, %edx + movl %eax, 16(%esp) + movl %edx, 8(%esp) + movl %edx, 12(%esp) + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + addl $1, %esi + adcl $0, %edx + testl %eax, %eax + je ..B1.32 +..B1.24: + movl %esi, %eax + orl %edx, %eax + jne ..B1.28 +..B1.25: + movl 24(%esp), %eax + xorl %esi, %esi + incl %eax + movl $-2147483648, %edx + movl %eax, 24(%esp) + andl $32767, %eax +..B1.26: + cmpl $32767, %eax + jne ..B1.18 +..B1.27: + movl 16(%esp), %eax + movl p_huge@GOTOFF(%eax), %ecx + fldl (%ecx) + fmul %st(0), %st + fstpl (%esp) + jmp ..B1.21 +..B1.28: + movl $-2147483648, %eax + movl 28(%esp), %ebx + subl %eax, %ebx + orl %ebx, %ecx + jne ..B1.30 +..B1.29: + movl $1, %eax + jmp ..B1.31 +..B1.30: + xorl %eax, %eax +..B1.31: + xorl %ecx, %ecx + cmpl $0, 8(%esp) + sete %cl + andl %ecx, %eax + notl %eax + andl %eax, %esi + movl 16(%esp), %eax + movl p_one@GOTOFF(%eax), %ebx + movl p_norm@GOTOFF(%eax), %eax + fldl (%ebx) + faddl (%eax) + fstpl (%esp) + jmp ..B1.21 +..B1.32: + movl $-2147483648, %eax + movl 28(%esp), %ebx + subl %eax, %ebx + orl %ebx, %ecx + jne ..B1.34 +..B1.33: + movl $1, %ecx + jmp ..B1.35 +..B1.34: + xorl %ecx, %ecx +..B1.35: + xorl %edi, %edi + xorl %eax, %eax + cmpl $0, 8(%esp) + sete %al + andl %eax, %ecx + notl %ecx + andl %ecx, %esi + movl %edx, %ecx + subl %edi, %ecx + jge ..B1.19 +..B1.36: + movl 24(%esp), %eax + incl %eax + movl %eax, 24(%esp) + andl $32767, %eax + jmp ..B1.26 + .align 16,0x90 + .type __qtol,@function + .size __qtol,.-__qtol + .data +# -- End __qtol + .data + .align 4 + .align 4 +p_zero: + .long d_zero + .type p_zero,@object + .size p_zero,4 + .align 4 +p_tiny: + .long d_tiny + .type p_tiny,@object + .size p_tiny,4 + .align 4 +p_one: + .long d_one + .type p_one,@object + .size p_one,4 + .align 4 +p_norm: + .long d_norm + .type p_norm,@object + .size p_norm,4 + .align 4 +p_huge: + .long d_huge + .type p_huge,@object + .size p_huge,4 + .section .rodata, "a" + .align 8 + .align 8 +d_zero: + .long 0x00000000,0x00000000 + .type d_zero,@object + .size d_zero,8 + .align 8 +d_tiny: + .long 0x00000001,0x00000000 + .type d_tiny,@object + .size d_tiny,8 + .align 8 +d_one: + .long 0x00000000,0x3ff00000 + .type d_one,@object + .size d_one,8 + .align 8 +d_norm: + .long 0x00000000,0x00100000 + .type d_norm,@object + .size d_norm,8 + .align 8 +d_huge: + .long 0xffffffff,0x7fefffff + .type d_huge,@object + .size d_huge,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/rcp_table.S b/external/sgx_libm/ia32/rcp_table.S new file mode 100644 index 0000000000..1877177d5a --- /dev/null +++ b/external/sgx_libm/ia32/rcp_table.S @@ -0,0 +1,822 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rcp_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_rcp_table_256 + .globl __libm_rcp_table_256 +__libm_rcp_table_256: + .long 0x3f7f8000 + .long 0x3f7e8000 + .long 0x3f7d8000 + .long 0x3f7c8000 + .long 0x3f7ba000 + .long 0x3f7aa000 + .long 0x3f79a000 + .long 0x3f78c000 + .long 0x3f77c000 + .long 0x3f76e000 + .long 0x3f75e000 + .long 0x3f750000 + .long 0x3f742000 + .long 0x3f732000 + .long 0x3f724000 + .long 0x3f716000 + .long 0x3f708000 + .long 0x3f6fa000 + .long 0x3f6ec000 + .long 0x3f6de000 + .long 0x3f6d0000 + .long 0x3f6c2000 + .long 0x3f6b6000 + .long 0x3f6a8000 + .long 0x3f69a000 + .long 0x3f68c000 + .long 0x3f680000 + .long 0x3f672000 + .long 0x3f666000 + .long 0x3f658000 + .long 0x3f64c000 + .long 0x3f640000 + .long 0x3f632000 + .long 0x3f626000 + .long 0x3f61a000 + .long 0x3f60e000 + .long 0x3f600000 + .long 0x3f5f4000 + .long 0x3f5e8000 + .long 0x3f5dc000 + .long 0x3f5d0000 + .long 0x3f5c4000 + .long 0x3f5b8000 + .long 0x3f5ae000 + .long 0x3f5a2000 + .long 0x3f596000 + .long 0x3f58a000 + .long 0x3f57e000 + .long 0x3f574000 + .long 0x3f568000 + .long 0x3f55e000 + .long 0x3f552000 + .long 0x3f546000 + .long 0x3f53c000 + .long 0x3f532000 + .long 0x3f526000 + .long 0x3f51c000 + .long 0x3f510000 + .long 0x3f506000 + .long 0x3f4fc000 + .long 0x3f4f2000 + .long 0x3f4e6000 + .long 0x3f4dc000 + .long 0x3f4d2000 + .long 0x3f4c8000 + .long 0x3f4be000 + .long 0x3f4b4000 + .long 0x3f4aa000 + .long 0x3f4a0000 + .long 0x3f496000 + .long 0x3f48c000 + .long 0x3f482000 + .long 0x3f478000 + .long 0x3f46e000 + .long 0x3f464000 + .long 0x3f45c000 + .long 0x3f452000 + .long 0x3f448000 + .long 0x3f43e000 + .long 0x3f436000 + .long 0x3f42c000 + .long 0x3f422000 + .long 0x3f41a000 + .long 0x3f410000 + .long 0x3f408000 + .long 0x3f3fe000 + .long 0x3f3f6000 + .long 0x3f3ec000 + .long 0x3f3e4000 + .long 0x3f3da000 + .long 0x3f3d2000 + .long 0x3f3ca000 + .long 0x3f3c0000 + .long 0x3f3b8000 + .long 0x3f3b0000 + .long 0x3f3a8000 + .long 0x3f39e000 + .long 0x3f396000 + .long 0x3f38e000 + .long 0x3f386000 + .long 0x3f37e000 + .long 0x3f376000 + .long 0x3f36c000 + .long 0x3f364000 + .long 0x3f35c000 + .long 0x3f354000 + .long 0x3f34c000 + .long 0x3f344000 + .long 0x3f33c000 + .long 0x3f334000 + .long 0x3f32e000 + .long 0x3f326000 + .long 0x3f31e000 + .long 0x3f316000 + .long 0x3f30e000 + .long 0x3f306000 + .long 0x3f2fe000 + .long 0x3f2f8000 + .long 0x3f2f0000 + .long 0x3f2e8000 + .long 0x3f2e2000 + .long 0x3f2da000 + .long 0x3f2d2000 + .long 0x3f2cc000 + .long 0x3f2c4000 + .long 0x3f2bc000 + .long 0x3f2b6000 + .long 0x3f2ae000 + .long 0x3f2a8000 + .long 0x3f2a0000 + .long 0x3f29a000 + .long 0x3f292000 + .long 0x3f28c000 + .long 0x3f284000 + .long 0x3f27e000 + .long 0x3f276000 + .long 0x3f270000 + .long 0x3f268000 + .long 0x3f262000 + .long 0x3f25c000 + .long 0x3f254000 + .long 0x3f24e000 + .long 0x3f248000 + .long 0x3f240000 + .long 0x3f23a000 + .long 0x3f234000 + .long 0x3f22e000 + .long 0x3f226000 + .long 0x3f220000 + .long 0x3f21a000 + .long 0x3f214000 + .long 0x3f20e000 + .long 0x3f206000 + .long 0x3f200000 + .long 0x3f1fa000 + .long 0x3f1f4000 + .long 0x3f1ee000 + .long 0x3f1e8000 + .long 0x3f1e2000 + .long 0x3f1dc000 + .long 0x3f1d6000 + .long 0x3f1d0000 + .long 0x3f1ca000 + .long 0x3f1c4000 + .long 0x3f1be000 + .long 0x3f1b8000 + .long 0x3f1b2000 + .long 0x3f1ac000 + .long 0x3f1a6000 + .long 0x3f1a0000 + .long 0x3f19a000 + .long 0x3f194000 + .long 0x3f190000 + .long 0x3f18a000 + .long 0x3f184000 + .long 0x3f17e000 + .long 0x3f178000 + .long 0x3f172000 + .long 0x3f16e000 + .long 0x3f168000 + .long 0x3f162000 + .long 0x3f15c000 + .long 0x3f158000 + .long 0x3f152000 + .long 0x3f14c000 + .long 0x3f148000 + .long 0x3f142000 + .long 0x3f13c000 + .long 0x3f138000 + .long 0x3f132000 + .long 0x3f12c000 + .long 0x3f128000 + .long 0x3f122000 + .long 0x3f11c000 + .long 0x3f118000 + .long 0x3f112000 + .long 0x3f10e000 + .long 0x3f108000 + .long 0x3f104000 + .long 0x3f0fe000 + .long 0x3f0f8000 + .long 0x3f0f4000 + .long 0x3f0ee000 + .long 0x3f0ea000 + .long 0x3f0e6000 + .long 0x3f0e0000 + .long 0x3f0dc000 + .long 0x3f0d6000 + .long 0x3f0d2000 + .long 0x3f0cc000 + .long 0x3f0c8000 + .long 0x3f0c2000 + .long 0x3f0be000 + .long 0x3f0ba000 + .long 0x3f0b4000 + .long 0x3f0b0000 + .long 0x3f0ac000 + .long 0x3f0a6000 + .long 0x3f0a2000 + .long 0x3f09e000 + .long 0x3f098000 + .long 0x3f094000 + .long 0x3f090000 + .long 0x3f08a000 + .long 0x3f086000 + .long 0x3f082000 + .long 0x3f07e000 + .long 0x3f078000 + .long 0x3f074000 + .long 0x3f070000 + .long 0x3f06c000 + .long 0x3f066000 + .long 0x3f062000 + .long 0x3f05e000 + .long 0x3f05a000 + .long 0x3f056000 + .long 0x3f052000 + .long 0x3f04c000 + .long 0x3f048000 + .long 0x3f044000 + .long 0x3f040000 + .long 0x3f03c000 + .long 0x3f038000 + .long 0x3f034000 + .long 0x3f030000 + .long 0x3f02a000 + .long 0x3f026000 + .long 0x3f022000 + .long 0x3f01e000 + .long 0x3f01a000 + .long 0x3f016000 + .long 0x3f012000 + .long 0x3f00e000 + .long 0x3f00a000 + .long 0x3f006000 + .long 0x3f002000 + .type __libm_rcp_table_256,@object + .size __libm_rcp_table_256,1024 + .align 16 + .hidden __libm_double_rcp_table_256 + .globl __libm_double_rcp_table_256 +__libm_double_rcp_table_256: + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type __libm_double_rcp_table_256,@object + .size __libm_double_rcp_table_256,2048 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/remainder.S b/external/sgx_libm/ia32/remainder.S new file mode 100644 index 0000000000..2e9c586a07 --- /dev/null +++ b/external/sgx_libm/ia32/remainder.S @@ -0,0 +1,199 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remainder.c" + .text +..TXTST0: +# -- Begin remainder + .text + .align 16,0x90 + .globl remainder +remainder: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + movzwl 22(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + testl %ecx, %ecx + jne ..B1.4 +..B1.2: + testl $1048575, 20(%ebp) + jne ..B1.4 +..B1.3: + cmpl $0, 16(%ebp) + je ..B1.9 +..B1.4: + movzwl 14(%ebp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + je ..B1.28 +..B1.5: + cmpl $2047, %ecx + je ..B1.14 +..B1.7: + fldl 16(%ebp) + fldl 8(%ebp) +.L_2TAG_PACKET_0.0.2: + fprem1 + fstsw %ax + sahf + jp .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstpl (%esp) +..B1.8: + fldl (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.9: + movzwl 14(%ebp), %edx + andl $32752, %edx + cmpl $32752, %edx + je ..B1.11 +..B1.10: + fldl _infs@GOTOFF(%eax) + fmull _zeros@GOTOFF(%eax) + fstl (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.11: + testl $1048575, 12(%ebp) + jne ..B1.13 +..B1.12: + cmpl $0, 8(%ebp) + je ..B1.10 +..B1.13: + fldl 8(%ebp) + faddl 16(%ebp) + fstl (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.14: + testl $1048575, 20(%ebp) + jne ..B1.19 +..B1.15: + cmpl $0, 16(%ebp) + jne ..B1.19 +..B1.16: + cmpl $2047, %edx + je ..B1.25 +..B1.17: + cmpl $2047, %ecx + je ..B1.20 + jmp ..B1.7 +..B1.19: + fldl 8(%ebp) + faddl 16(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.20: + testl $1048575, 20(%ebp) + jne ..B1.7 +..B1.21: + cmpl $0, 16(%ebp) + jne ..B1.7 +..B1.22: + fldl 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.25: + testl $1048575, 12(%ebp) + jne ..B1.17 +..B1.26: + cmpl $0, 8(%ebp) + jne ..B1.17 +..B1.27: + fldl _infs@GOTOFF(%eax) + fmull _zeros@GOTOFF(%eax) + movl %ebp, %esp + popl %ebp + ret +..B1.28: + testl $1048575, 12(%ebp) + jne ..B1.19 +..B1.29: + cmpl $0, 8(%ebp) + jne ..B1.19 +..B1.30: + cmpl $2047, %ecx + je ..B1.14 + jmp ..B1.16 + .align 16,0x90 + .type remainder,@function + .size remainder,.-remainder + .data +# -- End remainder + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End + + .globl drem + .equ drem, remainder + diff --git a/external/sgx_libm/ia32/remainderf.S b/external/sgx_libm/ia32/remainderf.S new file mode 100644 index 0000000000..c526c49495 --- /dev/null +++ b/external/sgx_libm/ia32/remainderf.S @@ -0,0 +1,161 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remainderf.c" + .text +..TXTST0: +# -- Begin remainderf + .text + .align 16,0x90 + .globl remainderf +remainderf: +# parameter 1: 16 + %esp +# parameter 2: 20 + %esp +..B1.1: +..L1: + + subl $12, %esp + movzwl 22(%esp), %ecx + andl $32640, %ecx + shrl $7, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + testl %ecx, %ecx + jne ..B1.3 +..B1.2: + testl $8388607, 20(%esp) + je ..B1.8 +..B1.3: + movzwl 18(%esp), %edx + andl $32640, %edx + shrl $7, %edx + cmpl $255, %edx + je ..B1.22 +..B1.4: + cmpl $255, %ecx + je ..B1.12 +..B1.6: + flds 20(%esp) + flds 16(%esp) +.L_2TAG_PACKET_0.0.2: + fprem1 + fstsw %ax + sahf + jp .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstps (%esp) +..B1.7: + flds (%esp) + addl $12, %esp + ret +..B1.8: + movzwl 18(%esp), %edx + andl $32640, %edx + cmpl $32640, %edx + jne ..B1.11 +..B1.9: + testl $8388607, 16(%esp) + je ..B1.11 +..B1.10: + flds 16(%esp) + fadds 20(%esp) + fsts (%esp) + addl $12, %esp + ret +..B1.11: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%eax) + fsts (%esp) + addl $12, %esp + ret +..B1.12: + testl $8388607, 20(%esp) + jne ..B1.16 +..B1.13: + cmpl $255, %edx + je ..B1.20 +..B1.14: + cmpl $255, %ecx + je ..B1.17 + jmp ..B1.6 +..B1.16: + flds 16(%esp) + fadds 20(%esp) + addl $12, %esp + ret +..B1.17: + testl $8388607, 20(%esp) + jne ..B1.6 +..B1.18: + flds 16(%esp) + addl $12, %esp + ret +..B1.20: + testl $8388607, 16(%esp) + jne ..B1.14 +..B1.21: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%eax) + addl $12, %esp + ret +..B1.22: + testl $8388607, 16(%esp) + jne ..B1.16 +..B1.23: + cmpl $255, %ecx + je ..B1.12 + jmp ..B1.13 + .align 16,0x90 + .type remainderf,@function + .size remainderf,.-remainderf + .data +# -- End remainderf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x7f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +# End + + .globl dremf + .equ dremf, remainderf + diff --git a/external/sgx_libm/ia32/remainderl.S b/external/sgx_libm/ia32/remainderl.S new file mode 100644 index 0000000000..168204a7b5 --- /dev/null +++ b/external/sgx_libm/ia32/remainderl.S @@ -0,0 +1,340 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remainderl.c" + .text +..TXTST0: +# -- Begin remainderl + .text + .align 16,0x90 + .globl remainderl +remainderl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + subl $28, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 28(%ebp), %edx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + andl $32767, %edx + jne ..B1.6 +..B1.4: + cmpl $0, 24(%ebp) + jne ..B1.6 +..B1.5: + cmpl $0, 20(%ebp) + je ..B1.45 +..B1.6: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.42 +..B1.7: + cmpl $32767, %edx + je ..B1.17 +..B1.8: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.16 +..B1.9: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + movl $1, %esi +..B1.12: + addl $-16, %esp + lea 8(%ebp), %eax + movl %eax, (%esp) + call __remainderl +..B1.60: + fstpt 16(%esp) + addl $16, %esp +..B1.13: + testl %esi, %esi + je ..B1.15 +..B1.14: + fldcw 14(%esp) +..B1.15: + fldt (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + xorl %esi, %esi + jmp ..B1.12 +..B1.17: + cmpl $-2147483648, 24(%ebp) + jne ..B1.19 +..B1.18: + cmpl $0, 20(%ebp) + je ..B1.25 +..B1.19: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.31 +..B1.20: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.21: + fldcw 12(%esp) +..B1.22: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt (%esp) +..B1.23: + fldcw 14(%esp) +..B1.24: + fldt (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + cmpl $32767, %ecx + je ..B1.32 +..B1.26: + testl %ecx, %ecx + jne ..B1.30 +..B1.27: + cmpl $0, 12(%ebp) + jne ..B1.29 +..B1.28: + cmpl $0, 8(%ebp) + je ..B1.30 +..B1.29: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl 16(%esp) +..B1.30: + fldt 8(%ebp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt (%esp) + jmp ..B1.24 +..B1.32: + cmpl $-2147483648, 12(%ebp) + jne ..B1.30 +..B1.33: + cmpl $0, 8(%ebp) + jne ..B1.30 +..B1.34: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.41 +..B1.35: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.36: + fldcw 12(%esp) +..B1.37: + movl $1, %edx +..B1.38: + fldl _infs@GOTOFF(%eax) + testl %edx, %edx + fmull _zeros@GOTOFF(%eax) + fstpl (%esp) + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldl (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + xorl %edx, %edx + jmp ..B1.38 +..B1.42: + cmpl $-2147483648, 12(%ebp) + jne ..B1.19 +..B1.43: + cmpl $0, 8(%ebp) + jne ..B1.19 +..B1.44: + cmpl $32767, %edx + je ..B1.17 + jmp ..B1.25 +..B1.45: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.57 +..B1.46: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.47: + fldcw 12(%esp) +..B1.48: + movl $1, %ecx +..B1.49: + movzwl 16(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.54 +..B1.50: + fldl _infs@GOTOFF(%eax) + fmull _zeros@GOTOFF(%eax) + fstpt (%esp) +..B1.51: + testl %ecx, %ecx + je ..B1.53 +..B1.52: + fldcw 14(%esp) +..B1.53: + fldt (%esp) + addl $28, %esp + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.54: + cmpl $-2147483648, 12(%ebp) + jne ..B1.56 +..B1.55: + cmpl $0, 8(%ebp) + je ..B1.50 +..B1.56: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) + jmp ..B1.51 +..B1.57: + xorl %ecx, %ecx + jmp ..B1.49 + .align 16,0x90 + .type remainderl,@function + .size remainderl,.-remainderl + .data +# -- End remainderl + .text +# -- Begin __remainderl + .text + .align 16,0x90 +__remainderl: +# parameter 1: 4 + %esp +..B2.1: +..L3: + +..B2.2: + movl 4(%esp), %ecx + fldt 12(%ecx) + fldt (%ecx) +.L_2TAG_PACKET_0.0.2: + fprem1 + fstsw %ax + sahf + jp .L_2TAG_PACKET_0.0.2 + fstp %st(1) + ret +..B2.3: + .align 16,0x90 + .type __remainderl,@function + .size __remainderl,.-__remainderl + .data +# -- End __remainderl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +# End + + .globl dreml + .equ dreml, remainderl + diff --git a/external/sgx_libm/ia32/remquo.S b/external/sgx_libm/ia32/remquo.S new file mode 100644 index 0000000000..d154009af2 --- /dev/null +++ b/external/sgx_libm/ia32/remquo.S @@ -0,0 +1,573 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remquo.c" + .text +..TXTST0: +# -- Begin remquo + .text + .align 16,0x90 + .globl remquo +remquo: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 24 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp + movl 24(%ebp), %ecx + movl %ecx, 56(%esp) + movl 12(%ebp), %ecx + movl %ecx, %edx + movl 20(%ebp), %esi + movl %esi, %eax + andl $-2147483648, %edx + andl $-2147483648, %eax + cmpl %edx, %eax + movl $-1, %eax + movl %edx, 48(%esp) + jne ..L2 + movl $1, %eax +..L2: + andl $2147483647, %ecx + andl $2147483647, %esi + movl %ecx, %edi + movl %esi, %ebx + andl $2146435072, %edi + andl $2146435072, %ebx + movl %eax, 52(%esp) + shrl $20, %edi + movl 8(%ebp), %eax + movl 16(%ebp), %edx + shrl $20, %ebx + movl %eax, 8(%esp) + cmpl $2047, %edi + movl %ecx, 12(%esp) + movl %edx, 68(%esp) + movl %edx, 40(%esp) + movl %esi, 44(%esp) + movl %edi, 60(%esp) + movl %ebx, 64(%esp) + je ..B1.5 +..B1.2: + cmpl $2047, 64(%esp) + je ..B1.5 +..B1.3: + movl %eax, %edx + orl %ecx, %edx + je ..B1.5 +..B1.4: + movl 68(%esp), %edx + orl %esi, %edx + jne ..B1.6 +..B1.5: + movl $1, %edi + jmp ..B1.7 +..B1.6: + xorl %edi, %edi +..B1.7: + fldl 8(%esp) + movl %ecx, %ebx + fldl 40(%esp) + movl %esi, %edx + andl $1048575, %ebx + andl $1048575, %edx + movl %edx, 16(%esp) + testl %edi, %edi + je ..B1.16 +..B1.8: + fstp %st(1) + fstp %st(0) + movl 56(%esp), %edx + movl %ecx, %ebx + movl $0, (%edx) + movl $2146435072, %edx + subl %edx, %ebx + jb ..B1.9 +..B1.86: + orl %eax, %ebx + jne ..B1.10 +..B1.9: + movl %esi, %ebx + subl %edx, %ebx + jb ..B1.11 +..B1.87: + orl 68(%esp), %ebx + je ..B1.11 +..B1.10: + fldl 8(%ebp) + faddl 16(%ebp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.11: + movl 68(%esp), %ebx + orl %esi, %ebx + je ..B1.13 +..B1.12: + subl %edx, %ecx + orl %ecx, %eax + jne ..B1.14 +..B1.13: + fldz + fdiv %st(0), %st + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.14: + fldl 8(%ebp) +..B1.15: + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.16: + movl 68(%esp), %edx + movl %edx, 32(%esp) + movl 60(%esp), %edx + subl 64(%esp), %edx + movl 16(%esp), %edi + cmpl $31, %edx + movl %edi, 36(%esp) + fxch %st(1) + fstpl 24(%esp) + jle ..B1.21 +..B1.17: + cmpl $2016, 64(%esp) + jge ..B1.21 +..B1.18: + movl %eax, 8(%esp) + call ..L3 +..L3: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L3](%eax), %eax + fstl 16(%esp) + movl %ebx, 12(%esp) + fldl .L_2il0floatpacket.0@GOTOFF(%eax) + fmulp %st, %st(1) + fstpl (%esp) +..B1.19: + fldl (%esp) + fldl 24(%esp) +.L_2TAG_PACKET_0.0.2: + fprem + fstsw %ax + sahf + jp .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstpl 24(%esp) +..B1.20: + fldl 16(%esp) + movl 28(%esp), %ecx + movl %ecx, %ebx + andl $2146435072, %ebx + shrl $20, %ebx + movl 40(%esp), %edx + movl %ebx, 60(%esp) + movl %ecx, %ebx + movl 24(%esp), %eax + andl $1048575, %ebx + movl 44(%esp), %esi + movl %edx, 68(%esp) +..B1.21: + movl %eax, %edi + movl %ecx, %edx + subl 68(%esp), %edi + sbbl %esi, %edx + movl %edx, 16(%esp) + jb ..B1.22 +..B1.88: + orl 16(%esp), %edi + jne ..B1.34 +..B1.22: + subl 68(%esp), %eax + subl %esi, %ecx + orl %ecx, %eax + je ..B1.33 +..B1.23: + fldl 24(%esp) + cmpl $2046, 60(%esp) + je ..B1.29 +..B1.24: + fld %st(0) + fadd %st(1), %st + fcomp %st(2) + fnstsw %ax + sahf + ja ..B1.29 + jp ..B1.29 +..B1.25: + fstp %st(1) + movl 56(%esp), %eax + cmpl $0, 48(%esp) + movl $0, (%eax) + je ..B1.28 +..B1.26: + fchs +..B1.28: + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.29: + movl 56(%esp), %edx + movl 52(%esp), %eax + movl %eax, (%edx) +..B1.30: + cmpl $0, 48(%esp) + fsubp %st, %st(1) + je ..B1.32 +..B1.31: + fchs +..B1.32: + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.33: + fstp %st(0) + fldz + fmull 8(%ebp) + movl 56(%esp), %edx + movl 52(%esp), %eax + movl %eax, (%edx) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.34: + cmpl $0, 60(%esp) + jne ..B1.43 +..B1.35: + movl %eax, %edx + orl %ebx, %edx + je ..B1.43 +..B1.36: + movl %eax, 8(%esp) + testl %ebx, %ebx + movl %ebx, 12(%esp) + je ..B1.38 +..B1.37: + bsr %ebx, %edx + negl %edx + addl $20, %edx + movl %edx, 60(%esp) + jmp ..B1.39 +..B1.38: + bsr 8(%esp), %edx + negl %edx + addl $52, %edx + movl %edx, 60(%esp) +..B1.39: + cmpl $31, 60(%esp) + jbe ..B1.41 +..B1.40: + movl %eax, %ebx + xorl %esi, %esi + movl %edx, %ecx + shll %cl, %ebx +..B1.42: + movl %edx, %eax + negl %eax + incl %eax + movl %eax, 60(%esp) + jmp ..B1.44 +..B1.41: + movl %eax, %esi + movl %edx, %ecx + shldl %cl, %eax, %ebx + shll %cl, %esi + jmp ..B1.42 +..B1.43: + movl %eax, %esi + orl $1048576, %ebx +..B1.44: + movl 36(%esp), %edx + movl 32(%esp), %eax + movl %edx, 20(%esp) + cmpl $0, 64(%esp) + jne ..B1.53 +..B1.45: + movl %eax, %edx + orl 20(%esp), %edx + je ..B1.53 +..B1.46: + cmpl $0, 20(%esp) + je ..B1.48 +..B1.47: + bsr 20(%esp), %edx + negl %edx + addl $20, %edx + movl %edx, 64(%esp) + jmp ..B1.49 +..B1.48: + bsr 32(%esp), %edx + negl %edx + addl $52, %edx + movl %edx, 64(%esp) +..B1.49: + cmpl $31, 64(%esp) + jbe ..B1.51 +..B1.50: + movl %edx, %ecx + shll %cl, %eax + movl $0, 16(%esp) + movl %eax, 20(%esp) +..B1.52: + movl %ecx, %eax + negl %eax + incl %eax + movl %eax, 64(%esp) + jmp ..B1.54 +..B1.51: + movl %edx, %ecx + movl 20(%esp), %edx + shldl %cl, %eax, %edx + shll %cl, %eax + movl %edx, 20(%esp) + movl %eax, 16(%esp) + jmp ..B1.52 +..B1.53: + movl %eax, 16(%esp) + orl $1048576, 20(%esp) +..B1.54: + movl 60(%esp), %eax + xorl %edx, %edx + subl 64(%esp), %eax + xorl %ecx, %ecx + movl %eax, 60(%esp) + cmpl $-1, %eax + je ..B1.60 +..B1.56: + movl %edx, %edi + addl %ecx, %ecx + shrl $31, %edi + addl %edx, %edx + orl %edi, %ecx + movl %esi, %edi + subl 16(%esp), %edi + movl %ebx, %edi + sbbl 20(%esp), %edi + jb ..B1.58 +..B1.57: + subl 16(%esp), %esi + sbbl 20(%esp), %ebx + addl $1, %edx + adcl $0, %ecx +..B1.58: + movl %esi, %edi + addl %ebx, %ebx + shrl $31, %edi + decl %eax + addl %esi, %esi + orl %edi, %ebx + cmpl $-1, %eax + jne ..B1.56 +..B1.60: + movl %esi, %eax + orl %ebx, %eax + je ..B1.83 +..B1.61: + movl %ebx, %eax + shll $31, %eax + shrl $1, %esi + shrl $1, %ebx + orl %esi, %eax + testl %ebx, %ebx + movl %eax, 8(%esp) + movl %ebx, 12(%esp) + je ..B1.63 +..B1.62: + bsr %ebx, %ecx + negl %ecx + addl $20, %ecx + jmp ..B1.64 +..B1.63: + bsr 8(%esp), %ecx + negl %ecx + addl $52, %ecx +..B1.64: + cmpl $31, %ecx + jbe ..B1.66 +..B1.65: + movl %eax, %ebx + xorl %eax, %eax + shll %cl, %ebx + jmp ..B1.67 +..B1.66: + shldl %cl, %eax, %ebx + shll %cl, %eax +..B1.67: + movl 64(%esp), %esi + subl %ecx, %esi + movl %esi, 64(%esp) + testl %esi, %esi + jle ..B1.69 +..B1.68: + movl %ebx, %esi + andl $1048575, %esi + jmp ..B1.73 +..B1.69: + movl %esi, %ecx + negl %ecx + incl %ecx + movl %ecx, 64(%esp) + cmpl $31, %ecx + jbe ..B1.71 +..B1.70: + movl %ebx, %eax + xorl %esi, %esi + shrl %cl, %eax + jmp ..B1.72 +..B1.71: + movl %ebx, %esi + shrdl %cl, %ebx, %eax + shrl %cl, %esi +..B1.72: + movl $0, 64(%esp) +..B1.73: + movl 64(%esp), %ecx + shll $20, %ecx + orl %ecx, %esi + movl %eax, 8(%esp) + movl %esi, 12(%esp) + fldl 8(%esp) + fld %st(0) + fadd %st(1), %st + fcom %st(2) + fnstsw %ax + sahf + jb ..B1.89 +..B1.74: + fucomp %st(2) + fnstsw %ax + sahf + jp ..B1.75 + je ..B1.81 +..B1.75: + incl %edx + fsubp %st, %st(1) + jmp ..B1.76 +..B1.89: + fstp %st(2) + fstp %st(1) +..B1.76: + andl $2147483647, %edx + movl 52(%esp), %eax + imull %edx, %eax + movl 56(%esp), %edx + cmpl $0, 48(%esp) + movl %eax, (%edx) + je ..B1.78 +..B1.77: + fchs +..B1.78: + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.81: + fstp %st(1) + movl %edx, %ecx + xorl %eax, %eax + andl $1, %ecx + orl %eax, %ecx + je ..B1.76 +..B1.82: + fchs + incl %edx + jmp ..B1.76 +..B1.83: + fstp %st(0) + fldz + andl $2147483647, %edx + fmull 8(%ebp) + movl 52(%esp), %eax + imull %edx, %eax + movl 56(%esp), %edx + movl %eax, (%edx) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type remquo,@function + .size remquo,.-remquo + .data +# -- End remquo + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xc1e00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/remquof.S b/external/sgx_libm/ia32/remquof.S new file mode 100644 index 0000000000..44803efcac --- /dev/null +++ b/external/sgx_libm/ia32/remquof.S @@ -0,0 +1,75 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remquof.c" + .text +..TXTST0: +# -- Begin remquof + .text + .align 16,0x90 + .globl remquof +remquof: +# parameter 1: 48 + %esp +# parameter 2: 52 + %esp +# parameter 3: 56 + %esp +..B1.1: +..L1: + + pushl %ebx + subl $40, %esp + flds 48(%esp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl 56(%esp), %eax + fstpl (%esp) + flds 52(%esp) + fstpl 8(%esp) + movl %eax, 16(%esp) + call remquo@PLT +..B1.2: + addl $40, %esp + popl %ebx + ret + .align 16,0x90 + .type remquof,@function + .size remquof,.-remquof + .data +# -- End remquof + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/remquol.S b/external/sgx_libm/ia32/remquol.S new file mode 100644 index 0000000000..1421eee78c --- /dev/null +++ b/external/sgx_libm/ia32/remquol.S @@ -0,0 +1,900 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remquol.c" + .text +..TXTST0: +# -- Begin remquol + .text + .align 16,0x90 + .globl remquol +remquol: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 32 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + movl 32(%ebp), %esi +..B1.2: + fnstcw 30(%esp) +..B1.3: + movzwl 28(%ebp), %eax + movl $0, (%esi) + andl $32767, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jne ..B1.6 +..B1.4: + cmpl $0, 24(%ebp) + jne ..B1.6 +..B1.5: + cmpl $0, 20(%ebp) + je ..B1.54 +..B1.6: + movzwl 16(%ebp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.51 +..B1.7: + cmpl $32767, %eax + je ..B1.26 +..B1.8: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + movl %eax, (%esp) + movzwl 30(%esp), %eax + movl %eax, %ecx + movzbl 29(%ebp), %edx + andl $3840, %ecx + andl $128, %edx + shrl $7, %edx + movl %edx, 4(%esp) + cmpl $768, %ecx + je ..B1.25 +..B1.9: + andl $-3841, %eax + orl $-64768, %eax + movw %ax, 28(%esp) +..B1.10: + fldcw 28(%esp) +..B1.11: + movl $1, %edi +..B1.12: + fldt 8(%ebp) + addl $-32, %esp + fstpt (%esp) + fldt 20(%ebp) + fstpt 12(%esp) + movl %esi, 24(%esp) + call __libm_remquol +..B1.69: + addl $32, %esp +..B1.13: + fstpt 16(%esp) + testl %edi, %edi + je ..B1.15 +..B1.14: + fldcw 30(%esp) +..B1.15: + movl (%esi), %edx + testl %edx, %edx + je ..B1.19 +..B1.16: + movl 4(%esp), %eax + imull iones@GOTOFF(%ebx,%eax,4), %edx + cmpl (%esp), %eax + je ..B1.18 +..B1.17: + orl $-2147483648, %edx + movl %edx, (%esi) + jmp ..B1.19 +..B1.18: + andl $2147483647, %edx + movl %edx, (%esi) +..B1.19: + movzwl 24(%esp), %eax + testl $32767, %eax + jne ..B1.24 +..B1.20: + cmpl $0, 20(%esp) + jne ..B1.23 +..B1.21: + cmpl $0, 16(%esp) + jne ..B1.23 +..B1.22: + movl (%esp), %eax + fldl _zeros@GOTOFF(%ebx,%eax,8) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.23: + fldl _small_value_64@GOTOFF(%ebx) + fmul %st(0), %st + fstpl 8(%esp) + fldt 16(%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.24: + fldt 16(%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + xorl %edi, %edi + jmp ..B1.12 +..B1.26: + cmpl $-2147483648, 24(%ebp) + jne ..B1.28 +..B1.27: + cmpl $0, 20(%ebp) + je ..B1.34 +..B1.28: + movzwl 30(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.40 +..B1.29: + orl $-64768, %edx + movw %dx, 28(%esp) +..B1.30: + fldcw 28(%esp) +..B1.31: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt 16(%esp) +..B1.32: + fldcw 30(%esp) +..B1.33: + fldt 16(%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.34: + cmpl $32767, %edx + je ..B1.41 +..B1.35: + testl %edx, %edx + jne ..B1.39 +..B1.36: + cmpl $0, 12(%ebp) + jne ..B1.38 +..B1.37: + cmpl $0, 8(%ebp) + je ..B1.39 +..B1.38: + fldl _smallest_value_64@GOTOFF(%ebx) + fstpl 8(%esp) +..B1.39: + fldt 8(%ebp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.40: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt 16(%esp) + jmp ..B1.33 +..B1.41: + cmpl $-2147483648, 12(%ebp) + jne ..B1.39 +..B1.42: + cmpl $0, 8(%ebp) + jne ..B1.39 +..B1.43: + movzwl 30(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.50 +..B1.44: + orl $-64768, %edx + movw %dx, 28(%esp) +..B1.45: + fldcw 28(%esp) +..B1.46: + movl $1, %eax +..B1.47: + fldl _infs@GOTOFF(%ebx) + testl %eax, %eax + fmull _zeros@GOTOFF(%ebx) + fstpl (%esp) + fldl (%esp) + fstpt 16(%esp) + je ..B1.49 +..B1.48: + fldcw 30(%esp) +..B1.49: + fldt 16(%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.50: + xorl %eax, %eax + jmp ..B1.47 +..B1.51: + cmpl $-2147483648, 12(%ebp) + jne ..B1.28 +..B1.52: + cmpl $0, 8(%ebp) + jne ..B1.28 +..B1.53: + cmpl $32767, %eax + je ..B1.26 + jmp ..B1.34 +..B1.54: + movzwl 30(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.66 +..B1.55: + orl $-64768, %edx + movw %dx, 28(%esp) +..B1.56: + fldcw 28(%esp) +..B1.57: + movl $1, %edx +..B1.58: + movzwl 16(%ebp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.63 +..B1.59: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpl (%esp) + fldl (%esp) + fstpt 16(%esp) +..B1.60: + testl %edx, %edx + je ..B1.62 +..B1.61: + fldcw 30(%esp) +..B1.62: + fldt 16(%esp) + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.63: + cmpl $-2147483648, 12(%ebp) + jne ..B1.65 +..B1.64: + cmpl $0, 8(%ebp) + je ..B1.59 +..B1.65: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt 16(%esp) + jmp ..B1.60 +..B1.66: + xorl %edx, %edx + jmp ..B1.58 + .align 16,0x90 + .type remquol,@function + .size remquol,.-remquol + .data +# -- End remquol + .text +# -- Begin __libm_remquol + .text + .align 16,0x90 +__libm_remquol: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 32 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + fldt 8(%ebp) + call ..L4 +..L4: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%esi), %esi + fstpt 156(%esp) + fldt 156(%esp) + andb $127, 29(%ebp) + fldt 20(%ebp) + movzwl 16(%ebp), %eax + andl $32767, %eax + movzwl 28(%ebp), %edi + andl $32767, %edi + fstpt 168(%esp) + fldt 168(%esp) + cmpl $32703, %eax + fldl _ones@GOTOFF(%esi) + movl 32(%ebp), %ebx + movl $0, 168(%esp) + jl ..B2.5 +..B2.2: + fstp %st(0) + cmpl $32703, %edi + jl ..B2.9 +..B2.3: + fldl 8+_scales@GOTOFF(%esi) + fmul %st, %st(2) + fxch %st(2) + fstpt (%esp) + fmulp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + fstpt 20(%ebp) + movl %ebx, 24(%esp) + call __libm_remquol +..B2.4: + fmull _scales@GOTOFF(%esi) + fstpt 156(%esp) + fldt 156(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.5: + cmpl $64, %edi + jge ..B2.12 +..B2.6: + fstp %st(0) + fldl _scales@GOTOFF(%esi) + fmul %st, %st(1) + fxch %st(1) + fstpt 20(%ebp) + fldt 20(%ebp) + fxch %st(1) + fstpt 32(%esp) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %ebx, 24(%esp) + call __libm_remquol +..B2.7: + fldt 32(%esp) + fmulp %st, %st(1) + fstpt (%esp) + fldt 20(%ebp) + fstpt 12(%esp) + movl %ebx, 24(%esp) + call __libm_remquol +..B2.8: + fmull 8+_scales@GOTOFF(%esi) + fstpt 156(%esp) + fldt 156(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.9: + fldl 8+_scales@GOTOFF(%esi) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fstpt 12(%esp) + movl %ebx, 24(%esp) + call __libm_remquol +..B2.10: + fldl _scales@GOTOFF(%esi) + fmulp %st, %st(1) + fstpt (%esp) + fldt 20(%ebp) + fstpt 12(%esp) + movl %ebx, 24(%esp) + call __libm_remquol +..B2.11: + fstpt 156(%esp) + fldt 156(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.12: + lea 1(%eax), %edx + cmpl %edx, %edi + jg ..B2.34 +..B2.13: + lea -32(%eax), %edx + cmpl %edx, %edi + jle ..B2.22 +..B2.14: + fstp %st(0) + fldt 168(%esp) + fld %st(2) + fdiv %st(2), %st + fld %st(2) + fsub %st(2), %st + fldl _TWO_63H@GOTOFF(%esi) + fld %st(0) + fadd %st(3), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(1) + fld %st(0) + movl 32(%esp), %edx + fsubr %st(3), %st + fabs + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + fsubrp %st, %st(6) + fxch %st(1) + fmul %st(3), %st + fsubrp %st, %st(5) + fldl _halfs@GOTOFF(%esi) + fucom %st(1) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jp ..B2.15 + je ..B2.16 +..B2.15: + fstp %st(2) + fstp %st(0) + fstp %st(0) + fstp %st(0) + movl %edx, (%ebx) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.16: + fmul %st(3), %st + fld %st(4) + fabs + fcompp + fnstsw %ax + sahf + jp ..B2.17 + jbe ..B2.21 +..B2.17: + fcompp + fnstsw %ax + sahf + ja ..B2.19 + jp ..B2.19 +..B2.18: + decl %edx + faddp %st, %st(1) + movl %edx, (%ebx) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.19: + incl %edx + fsubrp %st, %st(1) + movl %edx, (%ebx) +..B2.20: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.21: + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl %edx, (%ebx) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.22: + fldt 168(%esp) + subl %edi, %eax + fstpt 56(%esp) + fldt 56(%esp) + fld %st(1) + fdiv %st(3), %st + fld %st(3) + fsubp %st, %st(2) + addl $-31, %eax + movl %eax, 80(%esp) + jle ..B2.35 +..B2.23: + fstpt 96(%esp) + fldt 96(%esp) + movzwl 104(%esp), %edx + fstpt 44(%esp) + fldt 44(%esp) + movl %edx, 144(%esp) + movl 48(%esp), %edx + movzwl 52(%esp), %ecx + fxch %st(2) + fstpt 108(%esp) + movl %edx, 136(%esp) + movzwl 176(%esp), %edx + fstpt 84(%esp) + fldt 84(%esp) + movl %ecx, 140(%esp) + movzwl 116(%esp), %ecx + movl %edx, 128(%esp) + movzwl 92(%esp), %edx + fstpt 32(%esp) + fldt 32(%esp) + fldl _TWO_63H@GOTOFF(%esi) + movl %ecx, 132(%esp) + movl 172(%esp), %ecx + movl %edx, 68(%esp) + movl 36(%esp), %edx + movl %ecx, 124(%esp) + movzwl 40(%esp), %ecx + andl $32767, %ecx + movl %ecx, 148(%esp) + movl %esi, 76(%esp) + movl %edx, 120(%esp) + xorl %edx, %edx + movl %edi, 152(%esp) + movl %ebx, 72(%esp) + movl 68(%esp), %esi + movl %eax, %ecx +..B2.24: + movl 140(%esp), %ebx + andl $-32768, %esi + subl %eax, %ebx + subl %eax, %ecx + movl 144(%esp), %edi + andl $32767, %ebx + andl $-32768, %edi + orl %ebx, %edi + movl 136(%esp), %ebx + movw %di, 104(%esp) + movl %ebx, 100(%esp) + fldt 96(%esp) + movl 128(%esp), %ebx + fmul %st(5), %st + movl %edi, 144(%esp) + addl %eax, %ebx + movl 132(%esp), %edi + andl $32767, %ebx + andl $-32768, %edi + fadd %st(1), %st + orl %ebx, %edi + movl %edi, 132(%esp) + xorl %ebx, %ebx + movw %di, 116(%esp) + movl 124(%esp), %edi + movl %edi, 112(%esp) + movl 148(%esp), %edi + testl %edi, %edi + fstpt 32(%esp) + fldt 32(%esp) + fsub %st(1), %st + fldt 108(%esp) + setne %bl + imull %eax, %ebx + fmul %st(1), %st + addl %edi, %ebx + fsubrp %st, %st(6) + andl $32767, %ebx + orl %ebx, %esi + movl 120(%esp), %ebx + movw %si, 92(%esp) + movl %ebx, 88(%esp) + fldt 84(%esp) + fmulp %st, %st(1) + shll %cl, %edx + cmpl $32, %ecx + movl %eax, %ecx + fsubrp %st, %st(5) + jb ..L5 + movl $0, %edx +..L5: + fxch %st(4) + fstpt 156(%esp) + fldt 156(%esp) + movzwl 164(%esp), %edi + andl $32767, %edi + subl 152(%esp), %edi + movl %edi, %eax + addl 32(%esp), %edx + addl $-31, %eax + fxch %st(4) + jg ..B2.24 +..B2.25: + movl %ecx, 80(%esp) + movl 72(%esp), %ebx + movl 76(%esp), %esi +..B2.26: + fldt 56(%esp) + fld %st(1) + fxch %st(4) + fmul %st(6), %st + movl 80(%esp), %ecx + fadd %st, %st(4) + fxch %st(4) + fstpt 32(%esp) + fldt 32(%esp) + fld %st(3) + shll %cl, %edx + cmpl $32, %ecx + fxch %st(1) + fsub %st(3), %st + jb ..L6 + movl $0, %edx +..L6: + fmul %st, %st(2) + addl 32(%esp), %edx + fxch %st(2) + fsubrp %st, %st(7) + fmul %st(1), %st + fsubrp %st, %st(6) + fld %st(5) + fabs + fldl _halfs@GOTOFF(%esi) + fmul %st(6), %st + fcom %st(1) + fnstsw %ax + sahf + ja ..B2.33 +..B2.27: + fcompp + fnstsw %ax + sahf + jae ..B2.32 + jp ..B2.32 +..B2.28: + fstp %st(1) + fstp %st(1) + movl %edx, (%ebx) + fcompp + fnstsw %ax + sahf + ja ..B2.30 + jp ..B2.30 +..B2.29: + fsubrp %st, %st(1) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.30: + faddp %st, %st(1) +..B2.31: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.32: + fstp %st(0) + fstp %st(2) + fldt 56(%esp) + fxch %st(3) + fdivr %st(4), %st + fadd %st(2), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + addl 32(%esp), %edx + fxch %st(2) + fsubrp %st, %st(3) + fmulp %st, %st(1) + movl %edx, (%ebx) + fsubrp %st, %st(1) + fstpt 156(%esp) + fldt 156(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.33: + fstp %st(2) + fstp %st(2) + fstp %st(2) + fstp %st(2) + fstp %st(2) + fstp %st(0) + fstp %st(0) + movl %edx, (%ebx) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.34: + fstp %st(0) + fstp %st(0) + movl $0, (%ebx) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.35: + fstp %st(2) + fldl _TWO_63H@GOTOFF(%esi) + xorl %edx, %edx + jmp ..B2.26 + .align 16,0x90 + .type __libm_remquol,@function + .size __libm_remquol,.-__libm_remquol + .data +# -- End __libm_remquol + .section .rodata, "a" + .align 4 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_scales: + .long 0 + .long 1341128704 + .long 0 + .long 804257792 + .type _scales,@object + .size _scales,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_halfs: + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type _halfs,@object + .size _halfs,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/rint_gen.S b/external/sgx_libm/ia32/rint_gen.S new file mode 100644 index 0000000000..2106963d3e --- /dev/null +++ b/external/sgx_libm/ia32/rint_gen.S @@ -0,0 +1,61 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rint_gen.c" + .text +..TXTST0: +# -- Begin rint + .text + .align 16,0x90 + .globl rint +rint: +# parameter 1: 4 + %esp +..B1.1: +..L1: + +..B1.2: + fldl 4(%esp) + frndint + ret +..B1.3: + .align 16,0x90 + .type rint,@function + .size rint,.-rint + .data +# -- End rint + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/rintf_gen.S b/external/sgx_libm/ia32/rintf_gen.S new file mode 100644 index 0000000000..831ed856b1 --- /dev/null +++ b/external/sgx_libm/ia32/rintf_gen.S @@ -0,0 +1,61 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rintf_gen.c" + .text +..TXTST0: +# -- Begin rintf + .text + .align 16,0x90 + .globl rintf +rintf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + +..B1.2: + flds 4(%esp) + frndint + ret +..B1.3: + .align 16,0x90 + .type rintf,@function + .size rintf,.-rintf + .data +# -- End rintf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/rintl.S b/external/sgx_libm/ia32/rintl.S new file mode 100644 index 0000000000..2849fd3483 --- /dev/null +++ b/external/sgx_libm/ia32/rintl.S @@ -0,0 +1,160 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rintl.c" + .text +..TXTST0: +# -- Begin rintl + .text + .align 16,0x90 + .globl rintl +rintl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzbl 17(%ebp), %edx + movzwl 16(%ebp), %ecx + andl $128, %edx + andl $32767, %ecx + shrl $7, %edx + movzwl 14(%esp), %eax + cmpl $16446, %ecx + jge ..B1.13 +..B1.4: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.20 +..B1.5: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.6: + fldcw 12(%esp) +..B1.7: + movl $1, %eax +..B1.8: + fldt 8(%ebp) + testl %eax, %eax + call ..L2 +..L2: + popl %ecx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ecx), %ecx + fldl _TWO_63@GOTOFF(%ecx,%edx,8) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 8(%ebp) + je ..B1.10 +..B1.9: + fldcw 14(%esp) +..B1.10: + fldt 8(%ebp) + fldl _zeros@GOTOFF(%ecx) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.12 + je ..B1.19 +..B1.12: + movl %ebp, %esp + popl %ebp + ret +..B1.13: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.21 +..B1.14: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.15: + fldcw 12(%esp) +..B1.16: + fldt 8(%ebp) + fstpt (%esp) +..B1.17: + fldcw 14(%esp) +..B1.18: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.19: + fstp %st(0) + fldl _zeros@GOTOFF(%ecx,%edx,8) + movl %ebp, %esp + popl %ebp + ret +..B1.20: + xorl %eax, %eax + jmp ..B1.8 +..B1.21: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.18 + .align 16,0x90 + .type rintl,@function + .size rintl,.-rintl + .data +# -- End rintl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63: + .long 0 + .long 1138753536 + .long 0 + .long 3286237184 + .type _TWO_63,@object + .size _TWO_63,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/round_wmt.S b/external/sgx_libm/ia32/round_wmt.S new file mode 100644 index 0000000000..756ba57df5 --- /dev/null +++ b/external/sgx_libm/ia32/round_wmt.S @@ -0,0 +1,147 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "round_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin round + .text + .align 16,0x90 + .globl round +round: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + pextrw $3, %xmm0, %ecx + movl $32752, %eax + andl %ecx, %eax + cmpl $16352, %eax + jl .L_2TAG_PACKET_0.0.2 + cmpl $17200, %eax + jge .L_2TAG_PACKET_1.0.2 + movq 16(%ebx), %xmm1 + andpd %xmm0, %xmm1 + orpd (%ebx), %xmm1 + addsd %xmm1, %xmm0 + movq 24(%ebx), %xmm1 + movq 32(%ebx), %xmm2 + andpd %xmm0, %xmm1 + psubd %xmm1, %xmm2 + psrlq $52, %xmm2 + psrlq %xmm2, %xmm0 + psllq %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + addsd %xmm0, %xmm0 + testl $32768, %ecx + jne .L_2TAG_PACKET_3.0.2 + fldz + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_3.0.2: + fldl 40(%ebx) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_1.0.2: + cmpl $32752, %eax + je .L_2TAG_PACKET_5.0.2 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_5.0.2: + fldl 112(%esp) + fldz + faddp + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_2.0.2: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_4.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type round,@function + .size round,.-round + .data +# -- End round + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 2147483648 + .long 0 + .long 2146435072 + .long 0 + .long 1127219200 + .long 0 + .long 2147483648 + .type static_const_table,@object + .size static_const_table,48 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/roundf_wmt.S b/external/sgx_libm/ia32/roundf_wmt.S new file mode 100644 index 0000000000..99c7f46f0c --- /dev/null +++ b/external/sgx_libm/ia32/roundf_wmt.S @@ -0,0 +1,133 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "roundf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin roundf + .text + .align 16,0x90 + .globl roundf +roundf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %eax + testl %eax, %eax + jl .L_2TAG_PACKET_0.0.2 + cmpl $1056964608, %eax + jl .L_2TAG_PACKET_1.0.2 + cmpl $1258291200, %eax + jge .L_2TAG_PACKET_2.0.2 + cmpl $1065353216, %eax + je .L_2TAG_PACKET_2.0.2 + addss (%ebx), %xmm0 + cvttss2si %xmm0, %eax + movl %eax, 24(%esp) + fildl 24(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_1.0.2: + fldz + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + flds 4(%ebx) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_0.0.2: + andl $2147483647, %eax + cmpl $1056964608, %eax + jl .L_2TAG_PACKET_4.0.2 + cmpl $1258291200, %eax + jge .L_2TAG_PACKET_2.0.2 + cmpl $1065353216, %eax + je .L_2TAG_PACKET_2.0.2 + subss (%ebx), %xmm0 + cvttss2si %xmm0, %eax + movl %eax, 24(%esp) + fildl 24(%esp) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_3.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type roundf,@function + .size roundf,.-roundf + .data +# -- End roundf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1056964608 + .long 2147483648 + .type static_const_table,@object + .size static_const_table,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/roundl.S b/external/sgx_libm/ia32/roundl.S new file mode 100644 index 0000000000..ae7e25123d --- /dev/null +++ b/external/sgx_libm/ia32/roundl.S @@ -0,0 +1,248 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "roundl.c" + .text +..TXTST0: +# -- Begin roundl + .text + .align 16,0x90 + .globl roundl +roundl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + subl $24, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + cmpl $16446, %eax + jge ..B1.25 +..B1.4: + cmpl $16383, %eax + jl ..B1.19 +..B1.5: + cmpl $16414, %eax + jge ..B1.7 +..B1.6: + movl 12(%ebp), %edi + lea 2(%eax), %ecx + negl %eax + movl %edi, %edx + addl $30, %eax + shll %cl, %edx + movl %eax, %ecx + shrl %cl, %edi + shll %cl, %edi + movl %edi, 12(%ebp) + movl $0, 8(%ebp) + jmp ..B1.10 +..B1.7: + jle ..B1.9 +..B1.8: + movl 8(%ebp), %edi + lea 2(%eax), %ecx + negl %eax + movl %edi, %edx + addl $30, %eax + shll %cl, %edx + movl %eax, %ecx + shrl %cl, %edi + shll %cl, %edi + movl %edi, 8(%ebp) + jmp ..B1.10 +..B1.9: + movl 8(%ebp), %edx + movl $0, 8(%ebp) +..B1.10: + testl %edx, %edx + jge ..B1.18 +..B1.11: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.31 +..B1.12: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.13: + fldcw 12(%esp) +..B1.14: + movl $1, %edx +..B1.15: + fldt 8(%ebp) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + testl %edx, %edx + faddl _ones@GOTOFF(%esi,%eax,8) + fstpt (%esp) + je ..B1.17 +..B1.16: + fldcw 14(%esp) +..B1.17: + fldt (%esp) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + fldt 8(%ebp) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + cmpl $16382, %eax + je ..B1.33 +..B1.20: + testl %eax, %eax + jne ..B1.24 +..B1.21: + cmpl $0, 12(%ebp) + jne ..B1.23 +..B1.22: + cmpl $0, 8(%ebp) + je ..B1.24 +..B1.23: + fldl _smallest_value_64@GOTOFF(%esi) + fstpl 16(%esp) +..B1.24: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _zeros@GOTOFF(%esi,%eax,8) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.32 +..B1.26: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.27: + fldcw 12(%esp) +..B1.28: + fldt 8(%ebp) + fmull _ones@GOTOFF(%esi) + fstpt (%esp) +..B1.29: + fldcw 14(%esp) +..B1.30: + fldt (%esp) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.31: + xorl %edx, %edx + jmp ..B1.15 +..B1.32: + fldt 8(%ebp) + fmull _ones@GOTOFF(%esi) + fstpt (%esp) + jmp ..B1.30 +..B1.33: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _ones@GOTOFF(%esi,%eax,8) + addl $24, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type roundl,@function + .size roundl,.-roundl + .data +# -- End roundl + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalb_wmt.S b/external/sgx_libm/ia32/scalb_wmt.S new file mode 100644 index 0000000000..b4ee579932 --- /dev/null +++ b/external/sgx_libm/ia32/scalb_wmt.S @@ -0,0 +1,328 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalb_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin scalb + .text + .align 16,0x90 + .globl scalb +scalb: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movsd 136(%esp), %xmm1 + movq %xmm0, (%esp) + movq %xmm1, 8(%esp) + pextrw $3, %xmm0, %eax + pextrw $3, %xmm1, %edx + andl $32752, %eax + andl $32752, %edx + subl $16, %eax + subl $16368, %edx + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.3 + cmpl $256, %edx + jae .L_2TAG_PACKET_0.0.3 + movq 144(%ebx), %xmm7 +.L_2TAG_PACKET_1.0.3: + movdqa %xmm1, %xmm2 + addsd %xmm7, %xmm2 + movd %xmm2, %ecx + shll $4, %ecx + addl %ecx, %eax + movdqa %xmm2, %xmm3 + subsd %xmm7, %xmm3 + comisd %xmm1, %xmm3 + jne .L_2TAG_PACKET_2.0.3 + cmpl $32736, %eax + jae .L_2TAG_PACKET_3.0.3 + psllq $52, %xmm2 + paddq %xmm2, %xmm0 +.L_2TAG_PACKET_4.0.3: + movq %xmm0, 16(%esp) + fldl 16(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_6.0.3: + fldl (%esp) + faddl 8(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_2.0.3: + fldl 48(%ebx) + fmull (%ebx) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_7.0.3: + pextrw $3, %xmm1, %ecx + comisd %xmm7, %xmm0 + je .L_2TAG_PACKET_8.0.3 + cmpl $32736, %eax + je .L_2TAG_PACKET_9.0.3 + pextrw $3, %xmm0, %eax + shrl $12, %eax + andl $8, %eax + testl $32768, %ecx + je .L_2TAG_PACKET_10.0.3 + fldl 48(%ebx,%eax) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_9.0.3: + xorl $32768, %ecx +.L_2TAG_PACKET_8.0.3: + testl $32768, %ecx + je .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_11.0.3: + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_12.0.3: + movq 80(%ebx), %xmm7 + movq 96(%ebx), %xmm6 + pandn %xmm1, %xmm7 + comisd %xmm6, %xmm7 + jc .L_2TAG_PACKET_2.0.3 + pextrw $3, %xmm0, %eax + shrl $12, %eax + andl $8, %eax +.L_2TAG_PACKET_10.0.3: + fldl (%ebx,%eax) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_0.0.3: + movl %edx, %ecx + pxor %xmm7, %xmm7 + shrl $4, %ecx + ucomisd %xmm1, %xmm0 + jp .L_2TAG_PACKET_6.0.3 + addl $12, %ecx + cmpl $16384, %edx + je .L_2TAG_PACKET_7.0.3 + movdqa %xmm1, %xmm2 + comisd %xmm7, %xmm1 + je .L_2TAG_PACKET_11.0.3 + movd %ecx, %xmm3 + cmpl $32736, %eax + je .L_2TAG_PACKET_12.0.3 + psllq %xmm3, %xmm2 + testl %edx, %edx + jl .L_2TAG_PACKET_2.0.3 + pcmpeqd %xmm7, %xmm2 + cmpl $832, %edx + jae .L_2TAG_PACKET_13.0.3 + pmovmskb %xmm2, %ecx + cmpl $65535, %ecx + jne .L_2TAG_PACKET_2.0.3 + comisd %xmm7, %xmm0 + je .L_2TAG_PACKET_11.0.3 + cmpl $256, %edx + jae .L_2TAG_PACKET_14.0.3 + mulsd 112(%ebx), %xmm0 + movq 160(%ebx), %xmm7 + pextrw $3, %xmm0, %eax + andl $32752, %eax + subl $16, %eax + jmp .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_3.0.3: + jge .L_2TAG_PACKET_15.0.3 + sarl $4, %eax + cmpl $-53, %eax + jl .L_2TAG_PACKET_16.0.3 + movd 176(%ebx), %xmm3 + movq 128(%ebx), %xmm4 + pxor %xmm7, %xmm7 + pshufd $236, %xmm2, %xmm2 + paddd %xmm3, %xmm2 + psllq $52, %xmm2 + paddq %xmm2, %xmm0 + mulsd %xmm4, %xmm0 + comisd %xmm7, %xmm0 + jne .L_2TAG_PACKET_4.0.3 + movl $53, %ecx + jmp .L_2TAG_PACKET_17.0.3 +.L_2TAG_PACKET_13.0.3: + comisd %xmm7, %xmm0 + je .L_2TAG_PACKET_11.0.3 +.L_2TAG_PACKET_14.0.3: + pextrw $3, %xmm1, %edx + testl $32768, %edx + jne .L_2TAG_PACKET_16.0.3 +.L_2TAG_PACKET_15.0.3: + lea 16(%ebx), %edx + movl $53, %ecx + pxor %xmm1, %xmm1 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_16.0.3: + lea 32(%ebx), %edx + movl $54, %ecx + movq 64(%ebx), %xmm1 + jmp .L_2TAG_PACKET_18.0.3 +.L_2TAG_PACKET_18.0.3: + pxor %xmm7, %xmm7 + pextrw $3, %xmm0, %eax + shrl $12, %eax + andl $8, %eax + addl %edx, %eax + movq (%edx), %xmm0 + mulsd (%eax), %xmm0 + pand %xmm0, %xmm1 + comisd %xmm7, %xmm1 + jne .L_2TAG_PACKET_4.0.3 +.L_2TAG_PACKET_17.0.3: + movq %xmm0, 16(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 48(%esp), %eax + movl %eax, 8(%esp) + movl %ecx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl 16(%esp) +.L_2TAG_PACKET_5.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type scalb,@function + .size scalb,.-scalb + .data +# -- End scalb + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 1 + .long 1048576 + .long 1 + .long 1048576 + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .long 0 + .long 1015021568 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 4294967241 + .long 1127743487 + .long 4294967241 + .long 1127743487 + .long 55 + .long 55 + .long 55 + .long 55 + .type static_const_table,@object + .size static_const_table,192 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalbf.S b/external/sgx_libm/ia32/scalbf.S new file mode 100644 index 0000000000..d6d68d7ec3 --- /dev/null +++ b/external/sgx_libm/ia32/scalbf.S @@ -0,0 +1,410 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbf.c" + .text +..TXTST0: +# -- Begin scalbf + .text + .align 16,0x90 + .globl scalbf +scalbf: +# parameter 1: 32 + %esp +# parameter 2: 36 + %esp +..B1.1: +..L1: + + pushl %esi + pushl %edi + pushl %ebx + pushl %ebp + subl $12, %esp + movzwl 34(%esp), %ebx + movl %ebx, %edx + andl $32640, %edx + movzwl 38(%esp), %edi + andl $32640, %edi + shrl $7, %edx + shrl $7, %edi + call ..L2 +..L2: + popl %ebp + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebp), %ebp + cmpl $255, %edx + je ..B1.48 +..B1.2: + cmpl $255, %edi + je ..B1.31 +..B1.3: + cmpl $127, %edi + jl ..B1.16 +..B1.4: + cmpl $150, %edi + jge ..B1.7 +..B1.5: + movl 36(%esp), %esi + movl %edi, %ecx + andl $8388607, %esi + negl %ecx + movl %esi, %eax + addl $22, %ecx + orl $8388608, %eax + addl $10, %edi + shrl %cl, %eax + movl %edi, %ecx + shll %cl, %esi + testl %esi, %esi + je ..B1.8 +..B1.6: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%ebp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.7: + movl $65536, %eax +..B1.8: + testl %edx, %edx + jne ..B1.11 +..B1.9: + testl $8388607, 32(%esp) + je ..B1.15 +..B1.10: + flds 32(%esp) + fmuls .L_2il0floatpacket.1@GOTOFF(%ebp) + fstps 32(%esp) + movzwl 34(%esp), %ebx + movl %ebx, %edx + andl $32640, %edx + shrl $7, %edx + addl $-25, %edx +..B1.11: + cmpl $65536, %eax + movzbl 39(%esp), %esi + jle ..L3 + movl $65536, %eax +..L3: + movl %eax, %ecx + negl %ecx + testl $128, %esi + jne ..L4 + movl %eax, %ecx +..L4: + lea (%edx,%ecx), %eax + testl %eax, %eax + jle ..B1.26 +..B1.12: + cmpl $255, %eax + jge ..B1.25 +..B1.13: + movzbl %al, %eax + andl $-32641, %ebx + shll $7, %eax + orl %eax, %ebx + movw %bx, 34(%esp) + flds 32(%esp) +..B1.14: + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.15: + flds 32(%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.16: + testl %edi, %edi + jne ..B1.19 +..B1.17: + testl $8388607, 36(%esp) + jne ..B1.19 +..B1.18: + flds 32(%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.19: + cmpl $255, %edx + jne ..B1.24 +..B1.20: + testl %edi, %edi + jg ..B1.22 +..B1.21: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%ebp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.22: + cmpl $1, %edi + je ..B1.30 +..B1.23: + movzbl 35(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _infs@GOTOFF(%ebp,%eax,4) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.24: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%ebp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.25: + movzbl 35(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _large_value_32@GOTOFF(%ebp,%eax,4) + fmuls .L_2il0floatpacket.2@GOTOFF(%ebp) + fsts (%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.26: + cmpl $-23, %eax + jge ..B1.28 +..B1.27: + movzbl 35(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _small_value_32@GOTOFF(%ebp,%eax,4) + fmuls .L_2il0floatpacket.3@GOTOFF(%ebp) + jmp ..B1.29 +..B1.28: + movl 32(%esp), %eax + lea 25(%edx,%ecx), %edx + movl %eax, (%esp) + shrl $16, %eax + movzbl %dl, %edx + andl $-32641, %eax + shll $7, %edx + orl %edx, %eax + movw %ax, 2(%esp) + flds (%esp) + fmuls .L_2il0floatpacket.4@GOTOFF(%ebp) +..B1.29: + fsts (%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.30: + testl $8388607, 36(%esp) + jle ..B1.21 + jmp ..B1.23 +..B1.31: + testl $8388607, 36(%esp) + jne ..B1.43 +..B1.32: + testl %edx, %edx + jne ..B1.38 +..B1.33: + testl $8388607, 32(%esp) + jne ..B1.39 +..B1.34: + movzbl 39(%esp), %eax + testl $128, %eax + je ..B1.36 +..B1.35: + flds 32(%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.36: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%ebp) +..B1.37: + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.38: + cmpl $255, %edx + je ..B1.44 +..B1.39: + movzbl 35(%esp), %edx + andl $128, %edx + movzbl 39(%esp), %eax + shrl $7, %edx + testl $128, %eax + je ..B1.41 +..B1.40: + flds _zeros@GOTOFF(%ebp,%edx,4) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.41: + flds _infs@GOTOFF(%ebp,%edx,4) +..B1.42: + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.43: + flds 32(%esp) + fadds 36(%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.44: + movzbl 39(%esp), %eax + testl $128, %eax + jne ..B1.46 +..B1.45: + flds 32(%esp) + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.46: + fldz + fmuls .L_2il0floatpacket.0@GOTOFF(%ebp) +..B1.47: + addl $12, %esp + popl %ebp + popl %ebx + popl %edi + popl %esi + ret +..B1.48: + testl $8388607, 32(%esp) + jne ..B1.43 +..B1.49: + cmpl $255, %edi + je ..B1.31 + jmp ..B1.16 + .align 16,0x90 + .type scalbf,@function + .size scalbf,.-scalbf + .data +# -- End scalbf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x7f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x71800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x0d800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0x33000000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +_infs: + .long 2139095040 + .long 4286578688 + .type _infs,@object + .size _infs,8 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalbl.S b/external/sgx_libm/ia32/scalbl.S new file mode 100644 index 0000000000..5779076e12 --- /dev/null +++ b/external/sgx_libm/ia32/scalbl.S @@ -0,0 +1,641 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbl.c" + .text +..TXTST0: +# -- Begin scalbl + .text + .align 16,0x90 + .globl scalbl +scalbl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp +..B1.2: + fnstcw 22(%esp) +..B1.3: + movzwl 16(%ebp), %edi + andl $32767, %edi + movzwl 28(%ebp), %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %esi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%esi), %esi + cmpl $32767, %edi + je ..B1.107 +..B1.4: + cmpl $32767, %ecx + je ..B1.74 +..B1.5: + cmpl $16383, %ecx + jl ..B1.33 +..B1.6: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.57 +..B1.7: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.8: + fldcw 20(%esp) +..B1.9: + movl $1, %ebx +..B1.10: + cmpl $16414, %ecx + jge ..B1.15 +..B1.11: + fldt 20(%ebp) + fldl _TWO_63H@GOTOFF(%esi) + fadd %st(1), %st + fstpt 8(%esp) + fildl 8(%esp) + movl 8(%esp), %edx + fucompp + fnstsw %ax + sahf + jp ..B1.12 + je ..B1.20 +..B1.12: + fldl _infs@GOTOFF(%esi) + testl %ebx, %ebx + fmull _zeros@GOTOFF(%esi) + fstpt 8(%esp) + je ..B1.14 +..B1.13: + fldcw 22(%esp) +..B1.14: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + movzbl 29(%ebp), %eax + andl $128, %eax + shrl $7, %eax + cmpl $16446, %ecx + movl large_integers@GOTOFF(%esi,%eax,4), %edx + jge ..B1.20 +..B1.16: + addl $2, %ecx + movl 20(%ebp), %eax + shll %cl, %eax + testl %eax, %eax + je ..B1.20 +..B1.17: + fldl _infs@GOTOFF(%esi) + testl %ebx, %ebx + fmull _zeros@GOTOFF(%esi) + fstpt 8(%esp) + je ..B1.19 +..B1.18: + fldcw 22(%esp) +..B1.19: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.20: + testl %edi, %edi + jne ..B1.27 +..B1.21: + cmpl $0, 12(%ebp) + jne ..B1.26 +..B1.22: + cmpl $0, 8(%ebp) + jne ..B1.26 +..B1.23: + testl %ebx, %ebx + je ..B1.25 +..B1.24: + fldcw 22(%esp) +..B1.25: + fldt 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%esi) + fstpt 8(%ebp) + movzwl 16(%ebp), %edi + andl $32767, %edi + addl $-75, %edi +..B1.27: + cmpl $65536, %edx + jle ..L3 + movl $65536, %edx +..L3: + cmpl $-65536, %edx + jge ..L4 + movl $-65536, %edx +..L4: + lea (%edi,%edx), %ecx + testl %ecx, %ecx + jle ..B1.51 +..B1.28: + cmpl $32767, %ecx + jge ..B1.50 +..B1.29: + movzwl 16(%ebp), %eax + andl $32767, %ecx + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 16(%ebp) + fldt 8(%ebp) +..B1.30: + fstpt 8(%esp) + testl %ebx, %ebx + je ..B1.32 +..B1.31: + fldcw 22(%esp) +..B1.32: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.33: + testl %ecx, %ecx + jne ..B1.42 +..B1.34: + cmpl $0, 24(%ebp) + jne ..B1.42 +..B1.35: + cmpl $0, 20(%ebp) + jne ..B1.42 +..B1.36: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.58 +..B1.37: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.38: + fldcw 20(%esp) +..B1.39: + fldt 8(%ebp) + fmull _ones@GOTOFF(%esi) + fstpt 8(%esp) +..B1.40: + fldcw 22(%esp) +..B1.41: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.42: + cmpl $32767, %edi + je ..B1.60 +..B1.43: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.59 +..B1.44: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.45: + fldcw 20(%esp) +..B1.46: + movl $1, %eax +..B1.47: + fldl _infs@GOTOFF(%esi) + testl %eax, %eax + fmull _zeros@GOTOFF(%esi) + fstpt 8(%esp) + je ..B1.49 +..B1.48: + fldcw 22(%esp) +..B1.49: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.50: + fldt _large_value_80@GOTOFF(%esi) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%esi,%ecx) + fmulp %st, %st(1) + jmp ..B1.30 +..B1.51: + cmpl $-63, %ecx + jge ..B1.53 +..B1.52: + fldt _small_value_80@GOTOFF(%esi) + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%esi,%ecx) + fmulp %st, %st(1) + jmp ..B1.54 +..B1.53: + fldt 8(%ebp) + lea 75(%edi,%edx), %edx + movzwl 16(%ebp), %eax + andl $32767, %edx + andl $-32768, %eax + fstpt 8(%esp) + orl %edx, %eax + movw %ax, 16(%esp) + fldt 8(%esp) + fmull 8+_TWO_75@GOTOFF(%esi) +..B1.54: + fstpt 8(%esp) + testl %ebx, %ebx + je ..B1.56 +..B1.55: + fldcw 22(%esp) +..B1.56: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.57: + xorl %ebx, %ebx + jmp ..B1.10 +..B1.58: + fldt 8(%ebp) + fmull _ones@GOTOFF(%esi) + fstpt 8(%esp) + jmp ..B1.41 +..B1.59: + xorl %eax, %eax + jmp ..B1.47 +..B1.60: + testl %ecx, %ecx + jg ..B1.68 +..B1.61: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.70 +..B1.62: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.63: + fldcw 20(%esp) +..B1.64: + movl $1, %eax +..B1.65: + fldl _infs@GOTOFF(%esi) + testl %eax, %eax + fmull _zeros@GOTOFF(%esi) + fstpt 8(%esp) + je ..B1.67 +..B1.66: + fldcw 22(%esp) +..B1.67: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.68: + cmpl $1, %ecx + je ..B1.71 +..B1.69: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _infs@GOTOFF(%esi,%eax,8) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.70: + xorl %eax, %eax + jmp ..B1.65 +..B1.71: + movl 24(%ebp), %eax + cmpl $-2147483648, %eax + jb ..B1.61 +..B1.72: + jne ..B1.69 +..B1.73: + cmpl $0, 20(%ebp) + jbe ..B1.61 + jmp ..B1.69 +..B1.74: + cmpl $-2147483648, 24(%ebp) + jne ..B1.76 +..B1.75: + cmpl $0, 20(%ebp) + je ..B1.82 +..B1.76: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.102 +..B1.77: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.78: + fldcw 20(%esp) +..B1.79: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt 8(%esp) +..B1.80: + fldcw 22(%esp) +..B1.81: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.82: + movzwl 22(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.106 +..B1.83: + orl $-64768, %edx + movw %dx, 20(%esp) +..B1.84: + fldcw 20(%esp) +..B1.85: + movl $1, %eax +..B1.86: + testl %edi, %edi + jne ..B1.94 +..B1.87: + cmpl $0, 12(%ebp) + jne ..B1.89 +..B1.88: + cmpl $0, 8(%ebp) + je ..B1.90 +..B1.112: + cmpl $0, 12(%ebp) +..B1.89: + fldl _smallest_value_64@GOTOFF(%esi) + fstpl (%esp) + jne ..B1.95 +..B1.113: + cmpl $0, 8(%ebp) +..B1.90: + jne ..B1.95 +..B1.91: + movzbl 29(%ebp), %edx + testl $128, %edx + je ..B1.93 +..B1.92: + fldt 8(%ebp) + fstpt 8(%esp) + jmp ..B1.99 +..B1.93: + fldl _infs@GOTOFF(%esi) + fmull _zeros@GOTOFF(%esi) + fstpt 8(%esp) + jmp ..B1.99 +..B1.94: + cmpl $32767, %edi + je ..B1.103 +..B1.95: + movzbl 17(%ebp), %ecx + andl $128, %ecx + movzbl 29(%ebp), %edx + shrl $7, %ecx + testl $128, %edx + je ..B1.97 +..B1.96: + fldl _zeros@GOTOFF(%esi,%ecx,8) + jmp ..B1.98 +..B1.97: + fldl _infs@GOTOFF(%esi,%ecx,8) +..B1.98: + fstpt 8(%esp) +..B1.99: + testl %eax, %eax + je ..B1.101 +..B1.100: + fldcw 22(%esp) +..B1.101: + fldt 8(%esp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.102: + fldt 8(%ebp) + fldt 20(%ebp) + faddp %st, %st(1) + fstpt 8(%esp) + jmp ..B1.81 +..B1.103: + movzbl 29(%ebp), %edx + testl $128, %edx + jne ..B1.105 +..B1.104: + fldt 8(%ebp) + fstpt 8(%esp) + jmp ..B1.99 +..B1.105: + fldl _infs@GOTOFF(%esi) + fmull _zeros@GOTOFF(%esi) + fstpt 8(%esp) + jmp ..B1.99 +..B1.106: + xorl %eax, %eax + jmp ..B1.86 +..B1.107: + cmpl $-2147483648, 12(%ebp) + jne ..B1.76 +..B1.108: + cmpl $0, 8(%ebp) + jne ..B1.76 +..B1.109: + cmpl $32767, %ecx + je ..B1.74 + jmp ..B1.33 + .align 16,0x90 + .type scalbl,@function + .size scalbl,.-scalbl + .data +# -- End scalbl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +large_integers: + .long 65536 + .long -65536 + .type large_integers,@object + .size large_integers,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalbln_wmt.S b/external/sgx_libm/ia32/scalbln_wmt.S new file mode 100644 index 0000000000..3b57a2cbd9 --- /dev/null +++ b/external/sgx_libm/ia32/scalbln_wmt.S @@ -0,0 +1,243 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbln_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin scalbln + .text + .align 16,0x90 + .globl scalbln +scalbln: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movq %xmm0, (%esp) + movq 64(%ebx), %xmm4 + movl 136(%esp), %ecx + movl %ecx, 8(%esp) + movl $65536, %eax + movl $-65536, %edx + cmpl %eax, %ecx + cmovg %eax, %ecx + cmpl %edx, %ecx + cmovl %edx, %ecx + andpd %xmm0, %xmm4 + xorpd %xmm4, %xmm0 + ucomisd 128(%ebx), %xmm0 + jp .L_2TAG_PACKET_0.0.3 + je .L_2TAG_PACKET_0.0.3 + comisd 80(%ebx), %xmm0 + jc .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + movapd %xmm0, %xmm2 + movapd (%ebx), %xmm3 + psrlq $52, %xmm2 + movd %ecx, %xmm1 + andpd %xmm3, %xmm2 + paddq %xmm1, %xmm2 + movd %xmm2, %eax + movapd 16(%ebx), %xmm3 + testl %eax, %eax + jle .L_2TAG_PACKET_3.0.3 + cmpl $2047, %eax + jge .L_2TAG_PACKET_4.0.3 + andpd %xmm3, %xmm0 + psllq $52, %xmm2 + xorpd %xmm4, %xmm0 + orpd %xmm2, %xmm0 + movq %xmm0, 16(%esp) + fldl 16(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_0.0.3: + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_1.0.3: + comisd 144(%ebx), %xmm0 + je .L_2TAG_PACKET_0.0.3 + mulsd 96(%ebx), %xmm0 + subl $55, %ecx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $-52, %eax + jl .L_2TAG_PACKET_6.0.3 + xorpd %xmm5, %xmm5 + andpd %xmm3, %xmm0 + shufpd $1, %xmm3, %xmm3 + paddq %xmm3, %xmm2 + xorpd %xmm4, %xmm0 + psllq $52, %xmm2 + orpd %xmm2, %xmm0 + mulsd 112(%ebx), %xmm0 + comisd %xmm5, %xmm0 + je .L_2TAG_PACKET_6.0.3 + movq %xmm0, 16(%esp) + fldl 16(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_4.0.3: + lea 32(%ebx), %edx + movl $203, %ecx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_6.0.3: + lea 48(%ebx), %edx + movl $204, %ecx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_7.0.3: + pextrw $3, %xmm4, %eax + shrl $12, %eax + addl %edx, %eax + movq (%edx), %xmm0 + mulsd (%eax), %xmm0 + movq %xmm0, 16(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 48(%esp), %eax + movl %eax, 8(%esp) + movl %ecx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl 16(%esp) +.L_2TAG_PACKET_5.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type scalbln,@function + .size scalbln,.-scalbln + .data +# -- End scalbln + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 2047 + .long 0 + .long 4294967241 + .long 4294967295 + .long 4294967295 + .long 2148532223 + .long 55 + .long 0 + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 1048576 + .long 0 + .long 1048576 + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .long 0 + .long 1015021568 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,160 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalblnf.S b/external/sgx_libm/ia32/scalblnf.S new file mode 100644 index 0000000000..f26c38a751 --- /dev/null +++ b/external/sgx_libm/ia32/scalblnf.S @@ -0,0 +1,202 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalblnf.c" + .text +..TXTST0: +# -- Begin scalblnf + .text + .align 16,0x90 + .globl scalblnf +scalblnf: +# parameter 1: 16 + %esp +# parameter 2: 20 + %esp +..B1.1: +..L1: + + pushl %ebx + pushl %ebp + pushl %esi + movzwl 18(%esp), %eax + movl %eax, %ecx + andl $32640, %ecx + shrl $7, %ecx + movl 20(%esp), %edx + cmpl $255, %ecx + je ..B1.15 +..B1.2: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + testl %ecx, %ecx + jne ..B1.5 +..B1.3: + testl $8388607, 16(%esp) + je ..B1.9 +..B1.4: + flds 16(%esp) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + fstps 16(%esp) + movzwl 18(%esp), %eax + movl %eax, %ecx + andl $32640, %ecx + shrl $7, %ecx + addl $-25, %ecx +..B1.5: + cmpl $65536, %edx + jle ..L3 + movl $65536, %edx +..L3: + cmpl $-65536, %edx + jg ..L4 + movl $-65536, %edx +..L4: + lea (%ecx,%edx), %ebp + testl %ebp, %ebp + jle ..B1.11 +..B1.6: + cmpl $255, %ebp + jge ..B1.10 +..B1.7: + andl $255, %ebp + andl $-32641, %eax + shll $7, %ebp + orl %ebp, %eax + movw %ax, 18(%esp) + flds 16(%esp) +..B1.8: + popl %ecx + popl %ebp + popl %ebx + ret +..B1.9: + flds 16(%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.10: + movzbl 19(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _large_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.1@GOTOFF(%ebx) + fsts (%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.11: + cmpl $-23, %ebp + jl ..B1.14 +..B1.12: + movl 16(%esp), %eax + lea 25(%ecx,%edx), %edx + movl %eax, (%esp) + shrl $16, %eax + movzbl %dl, %edx + andl $-32641, %eax + shll $7, %edx + orl %edx, %eax + movw %ax, 2(%esp) + flds (%esp) + fmuls .L_2il0floatpacket.3@GOTOFF(%ebx) + fsts (%esp) +..B1.13: + popl %ecx + popl %ebp + popl %ebx + ret +..B1.14: + movzbl 19(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _small_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.2@GOTOFF(%ebx) + fsts (%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.15: + flds 16(%esp) + popl %ecx + popl %ebp + popl %ebx + ret + .align 16,0x90 + .type scalblnf,@function + .size scalblnf,.-scalblnf + .data +# -- End scalblnf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x0d800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x33000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalblnl.S b/external/sgx_libm/ia32/scalblnl.S new file mode 100644 index 0000000000..41ae09f3a3 --- /dev/null +++ b/external/sgx_libm/ia32/scalblnl.S @@ -0,0 +1,337 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalblnl.c" + .text +..TXTST0: +# -- Begin scalblnl + .text + .align 16,0x90 + .globl scalblnl +scalblnl: +# parameter 1: 32 + %esp +# parameter 2: 44 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + pushl %ebp + subl $16, %esp + movl 44(%esp), %ebx +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 40(%esp), %eax + movl %eax, %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %ebp + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebp), %ebp + cmpl $32767, %ecx + je ..B1.43 +..B1.4: + testl %ecx, %ecx + jne ..B1.14 +..B1.5: + cmpl $0, 36(%esp) + jne ..B1.8 +..B1.6: + cmpl $0, 32(%esp) + jne ..B1.8 +..B1.7: + fldt 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.8: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.42 +..B1.9: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + fldt 32(%esp) + fmull _TWO_75@GOTOFF(%ebp) + fstpt 32(%esp) +..B1.12: + fldcw 14(%esp) +..B1.13: + movzwl 40(%esp), %eax + movl %eax, %ecx + andl $32767, %ecx + addl $-75, %ecx +..B1.14: + cmpl $65536, %ebx + jle ..L3 + movl $65536, %ebx +..L3: + cmpl $-65536, %ebx + jg ..L4 + movl $-65536, %ebx +..L4: + lea (%ecx,%ebx), %edi + testl %edi, %edi + jle ..B1.25 +..B1.15: + cmpl $32767, %edi + jge ..B1.17 +..B1.16: + andl $-32768, %eax + andl $32767, %edi + orl %edi, %eax + movw %ax, 40(%esp) + fldt 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.17: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.24 +..B1.18: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.19: + fldcw 12(%esp) +..B1.20: + movl $1, %ebx +..B1.21: + fldt _large_value_80@GOTOFF(%ebp) + movzbl 41(%esp), %edx + andl $128, %edx + shrl $7, %edx + testl %ebx, %ebx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebp,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.23 +..B1.22: + fldcw 14(%esp) +..B1.23: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.24: + xorl %ebx, %ebx + jmp ..B1.21 +..B1.25: + movzwl 14(%esp), %edx + cmpl $-63, %edi + jl ..B1.34 +..B1.26: + movl %edx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.33 +..B1.27: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.28: + fldcw 12(%esp) +..B1.29: + movzwl 40(%esp), %eax + movl $1, %edi +..B1.30: + fldt 32(%esp) + lea 75(%ecx,%ebx), %edx + andl $-32768, %eax + andl $32767, %edx + fstpt (%esp) + orl %edx, %eax + movw %ax, 8(%esp) + testl %edi, %edi + fldt (%esp) + fmull 8+_TWO_75@GOTOFF(%ebp) + fstpt (%esp) + je ..B1.32 +..B1.31: + fldcw 14(%esp) +..B1.32: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.33: + xorl %edi, %edi + jmp ..B1.30 +..B1.34: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.41 +..B1.35: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.36: + fldcw 12(%esp) +..B1.37: + movl $1, %ebx +..B1.38: + fldt _small_value_80@GOTOFF(%ebp) + movzbl 41(%esp), %edx + andl $128, %edx + shrl $7, %edx + testl %ebx, %ebx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebp,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.41: + xorl %ebx, %ebx + jmp ..B1.38 +..B1.42: + fldt 32(%esp) + fmull _TWO_75@GOTOFF(%ebp) + fstpt 32(%esp) + jmp ..B1.13 +..B1.43: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.49 +..B1.44: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.45: + fldcw 12(%esp) +..B1.46: + fldt 32(%esp) + fmull _ones@GOTOFF(%ebp) + fstpt (%esp) +..B1.47: + fldcw 14(%esp) +..B1.48: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.49: + fldt 32(%esp) + fmull _ones@GOTOFF(%ebp) + fstpt (%esp) + jmp ..B1.48 + .align 16,0x90 + .type scalblnl,@function + .size scalblnl,.-scalblnl + .data +# -- End scalblnl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalbn_wmt.S b/external/sgx_libm/ia32/scalbn_wmt.S new file mode 100644 index 0000000000..4e5635c2f4 --- /dev/null +++ b/external/sgx_libm/ia32/scalbn_wmt.S @@ -0,0 +1,243 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbn_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin scalbn + .text + .align 16,0x90 + .globl scalbn +scalbn: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movq %xmm0, (%esp) + movq 64(%ebx), %xmm4 + movl 136(%esp), %ecx + movl %ecx, 8(%esp) + movl $65536, %eax + movl $-65536, %edx + cmpl %eax, %ecx + cmovg %eax, %ecx + cmpl %edx, %ecx + cmovl %edx, %ecx + andpd %xmm0, %xmm4 + xorpd %xmm4, %xmm0 + ucomisd 128(%ebx), %xmm0 + jp .L_2TAG_PACKET_0.0.3 + je .L_2TAG_PACKET_0.0.3 + comisd 80(%ebx), %xmm0 + jc .L_2TAG_PACKET_1.0.3 +.L_2TAG_PACKET_2.0.3: + movapd %xmm0, %xmm2 + movapd (%ebx), %xmm3 + psrlq $52, %xmm2 + movd %ecx, %xmm1 + andpd %xmm3, %xmm2 + paddq %xmm1, %xmm2 + movd %xmm2, %eax + movapd 16(%ebx), %xmm3 + testl %eax, %eax + jle .L_2TAG_PACKET_3.0.3 + cmpl $2047, %eax + jge .L_2TAG_PACKET_4.0.3 + andpd %xmm3, %xmm0 + psllq $52, %xmm2 + xorpd %xmm4, %xmm0 + orpd %xmm2, %xmm0 + movq %xmm0, 16(%esp) + fldl 16(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_0.0.3: + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_1.0.3: + comisd 144(%ebx), %xmm0 + je .L_2TAG_PACKET_0.0.3 + mulsd 96(%ebx), %xmm0 + subl $55, %ecx + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $-52, %eax + jl .L_2TAG_PACKET_6.0.3 + xorpd %xmm5, %xmm5 + andpd %xmm3, %xmm0 + shufpd $1, %xmm3, %xmm3 + paddq %xmm3, %xmm2 + xorpd %xmm4, %xmm0 + psllq $52, %xmm2 + orpd %xmm2, %xmm0 + mulsd 112(%ebx), %xmm0 + comisd %xmm5, %xmm0 + je .L_2TAG_PACKET_6.0.3 + movq %xmm0, 16(%esp) + fldl 16(%esp) + jmp .L_2TAG_PACKET_5.0.3 +.L_2TAG_PACKET_4.0.3: + lea 32(%ebx), %edx + movl $176, %ecx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_6.0.3: + lea 48(%ebx), %edx + movl $177, %ecx + jmp .L_2TAG_PACKET_7.0.3 +.L_2TAG_PACKET_7.0.3: + pextrw $3, %xmm4, %eax + shrl $12, %eax + addl %edx, %eax + movq (%edx), %xmm0 + mulsd (%eax), %xmm0 + movq %xmm0, 16(%esp) + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 48(%esp), %eax + movl %eax, 8(%esp) + movl %ecx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl 16(%esp) +.L_2TAG_PACKET_5.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type scalbn,@function + .size scalbn,.-scalbn + .data +# -- End scalbn + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 2047 + .long 0 + .long 4294967241 + .long 4294967295 + .long 4294967295 + .long 2148532223 + .long 55 + .long 0 + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 1048576 + .long 0 + .long 1048576 + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .long 0 + .long 1015021568 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,160 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalbnf.S b/external/sgx_libm/ia32/scalbnf.S new file mode 100644 index 0000000000..2ff48cc797 --- /dev/null +++ b/external/sgx_libm/ia32/scalbnf.S @@ -0,0 +1,202 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbnf.c" + .text +..TXTST0: +# -- Begin scalbnf + .text + .align 16,0x90 + .globl scalbnf +scalbnf: +# parameter 1: 16 + %esp +# parameter 2: 20 + %esp +..B1.1: +..L1: + + pushl %ebx + pushl %ebp + pushl %esi + movzwl 18(%esp), %eax + movl %eax, %ecx + andl $32640, %ecx + shrl $7, %ecx + movl 20(%esp), %edx + cmpl $255, %ecx + je ..B1.15 +..B1.2: + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + testl %ecx, %ecx + jne ..B1.5 +..B1.3: + testl $8388607, 16(%esp) + je ..B1.9 +..B1.4: + flds 16(%esp) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + fstps 16(%esp) + movzwl 18(%esp), %eax + movl %eax, %ecx + andl $32640, %ecx + shrl $7, %ecx + addl $-25, %ecx +..B1.5: + cmpl $65536, %edx + jle ..L3 + movl $65536, %edx +..L3: + cmpl $-65536, %edx + jg ..L4 + movl $-65536, %edx +..L4: + lea (%ecx,%edx), %ebp + testl %ebp, %ebp + jle ..B1.11 +..B1.6: + cmpl $255, %ebp + jge ..B1.10 +..B1.7: + andl $255, %ebp + andl $-32641, %eax + shll $7, %ebp + orl %ebp, %eax + movw %ax, 18(%esp) + flds 16(%esp) +..B1.8: + popl %ecx + popl %ebp + popl %ebx + ret +..B1.9: + flds 16(%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.10: + movzbl 19(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _large_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.1@GOTOFF(%ebx) + fsts (%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.11: + cmpl $-23, %ebp + jl ..B1.14 +..B1.12: + movl 16(%esp), %eax + lea 25(%ecx,%edx), %edx + movl %eax, (%esp) + shrl $16, %eax + movzbl %dl, %edx + andl $-32641, %eax + shll $7, %edx + orl %edx, %eax + movw %ax, 2(%esp) + flds (%esp) + fmuls .L_2il0floatpacket.3@GOTOFF(%ebx) + fsts (%esp) +..B1.13: + popl %ecx + popl %ebp + popl %ebx + ret +..B1.14: + movzbl 19(%esp), %eax + andl $128, %eax + shrl $7, %eax + flds _small_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.2@GOTOFF(%ebx) + fsts (%esp) + popl %ecx + popl %ebp + popl %ebx + ret +..B1.15: + flds 16(%esp) + popl %ecx + popl %ebp + popl %ebx + ret + .align 16,0x90 + .type scalbnf,@function + .size scalbnf,.-scalbnf + .data +# -- End scalbnf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x0d800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x33000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/scalbnl.S b/external/sgx_libm/ia32/scalbnl.S new file mode 100644 index 0000000000..2c7b59580b --- /dev/null +++ b/external/sgx_libm/ia32/scalbnl.S @@ -0,0 +1,337 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbnl.c" + .text +..TXTST0: +# -- Begin scalbnl + .text + .align 16,0x90 + .globl scalbnl +scalbnl: +# parameter 1: 32 + %esp +# parameter 2: 44 + %esp +..B1.1: +..L1: + + pushl %edi + pushl %ebx + pushl %ebp + subl $16, %esp + movl 44(%esp), %ebx +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 40(%esp), %eax + movl %eax, %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %ebp + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebp), %ebp + cmpl $32767, %ecx + je ..B1.43 +..B1.4: + testl %ecx, %ecx + jne ..B1.14 +..B1.5: + cmpl $0, 36(%esp) + jne ..B1.8 +..B1.6: + cmpl $0, 32(%esp) + jne ..B1.8 +..B1.7: + fldt 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.8: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.42 +..B1.9: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + fldt 32(%esp) + fmull _TWO_75@GOTOFF(%ebp) + fstpt 32(%esp) +..B1.12: + fldcw 14(%esp) +..B1.13: + movzwl 40(%esp), %eax + movl %eax, %ecx + andl $32767, %ecx + addl $-75, %ecx +..B1.14: + cmpl $65536, %ebx + jle ..L3 + movl $65536, %ebx +..L3: + cmpl $-65536, %ebx + jg ..L4 + movl $-65536, %ebx +..L4: + lea (%ecx,%ebx), %edi + testl %edi, %edi + jle ..B1.25 +..B1.15: + cmpl $32767, %edi + jge ..B1.17 +..B1.16: + andl $-32768, %eax + andl $32767, %edi + orl %edi, %eax + movw %ax, 40(%esp) + fldt 32(%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.17: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.24 +..B1.18: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.19: + fldcw 12(%esp) +..B1.20: + movl $1, %ebx +..B1.21: + fldt _large_value_80@GOTOFF(%ebp) + movzbl 41(%esp), %edx + andl $128, %edx + shrl $7, %edx + testl %ebx, %ebx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _large_value_80@GOTOFF(%ebp,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.23 +..B1.22: + fldcw 14(%esp) +..B1.23: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.24: + xorl %ebx, %ebx + jmp ..B1.21 +..B1.25: + movzwl 14(%esp), %edx + cmpl $-63, %edi + jl ..B1.34 +..B1.26: + movl %edx, %edi + andl $768, %edi + cmpl $768, %edi + je ..B1.33 +..B1.27: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.28: + fldcw 12(%esp) +..B1.29: + movzwl 40(%esp), %eax + movl $1, %edi +..B1.30: + fldt 32(%esp) + lea 75(%ecx,%ebx), %edx + andl $-32768, %eax + andl $32767, %edx + fstpt (%esp) + orl %edx, %eax + movw %ax, 8(%esp) + testl %edi, %edi + fldt (%esp) + fmull 8+_TWO_75@GOTOFF(%ebp) + fstpt (%esp) + je ..B1.32 +..B1.31: + fldcw 14(%esp) +..B1.32: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.33: + xorl %edi, %edi + jmp ..B1.30 +..B1.34: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.41 +..B1.35: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.36: + fldcw 12(%esp) +..B1.37: + movl $1, %ebx +..B1.38: + fldt _small_value_80@GOTOFF(%ebp) + movzbl 41(%esp), %edx + andl $128, %edx + shrl $7, %edx + testl %ebx, %ebx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebp,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.40 +..B1.39: + fldcw 14(%esp) +..B1.40: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.41: + xorl %ebx, %ebx + jmp ..B1.38 +..B1.42: + fldt 32(%esp) + fmull _TWO_75@GOTOFF(%ebp) + fstpt 32(%esp) + jmp ..B1.13 +..B1.43: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.49 +..B1.44: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.45: + fldcw 12(%esp) +..B1.46: + fldt 32(%esp) + fmull _ones@GOTOFF(%ebp) + fstpt (%esp) +..B1.47: + fldcw 14(%esp) +..B1.48: + fldt (%esp) + addl $16, %esp + popl %ebp + popl %ebx + popl %edi + ret +..B1.49: + fldt 32(%esp) + fmull _ones@GOTOFF(%ebp) + fstpt (%esp) + jmp ..B1.48 + .align 16,0x90 + .type scalbnl,@function + .size scalbnl,.-scalbnl + .data +# -- End scalbnl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/signbit.S b/external/sgx_libm/ia32/signbit.S new file mode 100644 index 0000000000..4e446703ff --- /dev/null +++ b/external/sgx_libm/ia32/signbit.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "signbit.c" + .text +..TXTST0: +# -- Begin __signbitd + .text + .align 16,0x90 + .globl __signbitd +__signbitd: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl 8(%esp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .type __signbitd,@function + .size __signbitd,.-__signbitd + .data +# -- End __signbitd + .text +# -- Begin signbitd + .text + .align 16,0x90 + .globl signbitd +signbitd: +# parameter 1: 4 + %esp +..B2.1: +..L2: + + movl 8(%esp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .type signbitd,@function + .size signbitd,.-signbitd + .data +# -- End signbitd + .text +# -- Begin __signbit + .text + .align 16,0x90 + .globl __signbit +__signbit: +# parameter 1: 4 + %esp +..B3.1: +..L3: + + movl 8(%esp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .type __signbit,@function + .size __signbit,.-__signbit + .data +# -- End __signbit + .text +# -- Begin signbit + .text + .align 16,0x90 + .globl signbit +signbit: +# parameter 1: 4 + %esp +..B4.1: +..L4: + + movl 8(%esp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .type signbit,@function + .size signbit,.-signbit + .data +# -- End signbit + .text +# -- Begin __signbitf + .text + .align 16,0x90 + .globl __signbitf +__signbitf: +# parameter 1: 4 + %esp +..B5.1: +..L5: + + movl 4(%esp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .type __signbitf,@function + .size __signbitf,.-__signbitf + .data +# -- End __signbitf + .text +# -- Begin signbitf + .text + .align 16,0x90 + .globl signbitf +signbitf: +# parameter 1: 4 + %esp +..B6.1: +..L6: + + movl 4(%esp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .type signbitf,@function + .size signbitf,.-signbitf + .data +# -- End signbitf + .text +# -- Begin __signbitl + .text + .align 16,0x90 + .globl __signbitl +__signbitl: +# parameter 1: 4 + %esp +..B7.1: +..L7: + + movzbl 13(%esp), %eax + shrl $7, %eax + movzwl 12(%esp), %edx + shll $15, %eax + andl $32767, %edx + orl %edx, %eax + shll $16, %eax + movzwl 10(%esp), %ecx + orl %ecx, %eax + shrl $31, %eax + ret + .align 16,0x90 + .type __signbitl,@function + .size __signbitl,.-__signbitl + .data +# -- End __signbitl + .text +# -- Begin signbitl + .text + .align 16,0x90 + .globl signbitl +signbitl: +# parameter 1: 4 + %esp +..B8.1: +..L8: + + movzbl 13(%esp), %eax + shrl $7, %eax + movzwl 12(%esp), %edx + shll $15, %eax + andl $32767, %edx + orl %edx, %eax + shll $16, %eax + movzwl 10(%esp), %ecx + orl %ecx, %eax + shrl $31, %eax + ret + .align 16,0x90 + .type signbitl,@function + .size signbitl,.-signbitl + .data +# -- End signbitl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/significand_wmt.S b/external/sgx_libm/ia32/significand_wmt.S new file mode 100644 index 0000000000..483a3e8850 --- /dev/null +++ b/external/sgx_libm/ia32/significand_wmt.S @@ -0,0 +1,136 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "significand_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin significand + .text + .align 16,0x90 + .globl significand +significand: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + pextrw $3, %xmm0, %eax + movq (%ebx), %xmm1 + andl $32767, %eax + movq 16(%ebx), %xmm2 + subl $16, %eax + js .L_2TAG_PACKET_0.0.2 + cmpl $32736, %eax + jae .L_2TAG_PACKET_1.0.2 + pand %xmm1, %xmm0 + por %xmm2, %xmm0 + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + pxor %xmm3, %xmm3 + movq 32(%ebx), %xmm4 + comisd %xmm3, %xmm0 + je .L_2TAG_PACKET_3.0.2 + mulsd %xmm4, %xmm0 + pand %xmm1, %xmm0 + por %xmm2, %xmm0 +.L_2TAG_PACKET_3.0.2: + movq %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + fld1 + movsd %xmm0, (%esp) + fmull (%esp) +.L_2TAG_PACKET_2.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type significand,@function + .size significand,.-significand + .data +# -- End significand + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 4294967295 + .long 2148532223 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 1130364928 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,48 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/significandf.S b/external/sgx_libm/ia32/significandf.S new file mode 100644 index 0000000000..a91b5d2329 --- /dev/null +++ b/external/sgx_libm/ia32/significandf.S @@ -0,0 +1,97 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "significandf.c" + .text +..TXTST0: +# -- Begin significandf + .text + .align 16,0x90 + .globl significandf +significandf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl 4(%esp), %ecx + movl %ecx, %edx + andl $2147483647, %edx + lea -8388608(%edx), %eax + cmpl $2130706432, %eax + jb ..B1.6 +..B1.2: + decl %edx + cmpl $2139095039, %edx + jae ..B1.4 +..B1.3: + flds 4(%esp) + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + fmuls .L_2il0floatpacket.0@GOTOFF(%eax) + fstps 4(%esp) + movl 4(%esp), %edx + andl $-2139095041, %edx + orl $1065353216, %edx + movl %edx, 4(%esp) + flds 4(%esp) + ret +..B1.4: + flds 4(%esp) +..B1.5: + ret +..B1.6: + andl $-2139095041, %ecx + orl $1065353216, %ecx + movl %ecx, 4(%esp) + flds 4(%esp) + ret + .align 16,0x90 + .type significandf,@function + .size significandf,.-significandf + .data +# -- End significandf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/significandl.S b/external/sgx_libm/ia32/significandl.S new file mode 100644 index 0000000000..b14ab825d5 --- /dev/null +++ b/external/sgx_libm/ia32/significandl.S @@ -0,0 +1,160 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "significandl.c" + .text +..TXTST0: +# -- Begin significandl + .text + .align 16,0x90 + .globl significandl +significandl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %edx + movl %edx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.16 +..B1.4: + testl %eax, %eax + jne ..B1.14 +..B1.5: + cmpl $0, 12(%ebp) + jne ..B1.8 +..B1.6: + cmpl $0, 8(%ebp) + jne ..B1.8 +..B1.7: + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.8: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + je ..B1.15 +..B1.9: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.10: + fldcw 12(%esp) +..B1.11: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%eax) + fstpt 8(%ebp) +..B1.12: + fldcw 14(%esp) +..B1.13: + movzwl 16(%ebp), %eax + andl $-32768, %eax + orl $-49153, %eax + movw %ax, 16(%ebp) + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.14: + andl $-32768, %edx + orl $-49153, %edx + movw %dx, 16(%ebp) + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.15: + fldt 8(%ebp) + fmull _TWO_75@GOTOFF(%eax) + fstpt 8(%ebp) + jmp ..B1.13 +..B1.16: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.22 +..B1.17: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.18: + fldcw 12(%esp) +..B1.19: + fldt 8(%ebp) + fstpt (%esp) +..B1.20: + fldcw 14(%esp) +..B1.21: + fldt (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.22: + fldt 8(%ebp) + fstpt (%esp) + jmp ..B1.21 + .align 16,0x90 + .type significandl,@function + .size significandl,.-significandl + .data +# -- End significandl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sin_wmt.S b/external/sgx_libm/ia32/sin_wmt.S new file mode 100644 index 0000000000..5b38a2f2de --- /dev/null +++ b/external/sgx_libm/ia32/sin_wmt.S @@ -0,0 +1,779 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sin_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sin + .text + .align 16,0x90 + .globl sin +sin: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 56(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + pextrw $3, %xmm0, %eax + andl $32767, %eax + subl $12336, %eax + cmpl $4293, %eax + ja .L_2TAG_PACKET_0.0.2 + movsd 2160(%ebx), %xmm1 + mulsd %xmm0, %xmm1 + movsd 2272(%ebx), %xmm5 + movapd 2256(%ebx), %xmm4 + andpd %xmm0, %xmm4 + orps %xmm4, %xmm5 + movsd 2128(%ebx), %xmm3 + movapd 2112(%ebx), %xmm2 + addpd %xmm5, %xmm1 + cvttsd2si %xmm1, %edx + cvtsi2sdl %edx, %xmm1 + mulsd %xmm1, %xmm3 + unpcklpd %xmm1, %xmm1 + addl $1865216, %edx + movapd %xmm0, %xmm4 + andl $63, %edx + movapd 2096(%ebx), %xmm5 + lea (%ebx), %eax + shll $5, %edx + addl %edx, %eax + mulpd %xmm1, %xmm2 + subsd %xmm3, %xmm0 + mulsd 2144(%ebx), %xmm1 + subsd %xmm3, %xmm4 + movsd 8(%eax), %xmm7 + unpcklpd %xmm0, %xmm0 + movapd %xmm4, %xmm3 + subsd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + movapd 2064(%ebx), %xmm6 + mulsd %xmm4, %xmm7 + subsd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subsd %xmm2, %xmm3 + movapd (%eax), %xmm2 + subsd %xmm3, %xmm1 + movsd 24(%eax), %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm7 + mulsd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulsd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm0 + addpd 2080(%ebx), %xmm5 + mulsd (%eax), %xmm4 + addpd 2048(%ebx), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addsd 8(%eax), %xmm3 + mulpd %xmm7, %xmm1 + movapd %xmm4, %xmm7 + addsd %xmm3, %xmm4 + addpd %xmm5, %xmm6 + movsd 8(%eax), %xmm5 + subsd %xmm3, %xmm5 + subsd %xmm4, %xmm3 + addsd 16(%eax), %xmm1 + mulpd %xmm2, %xmm6 + addsd %xmm0, %xmm5 + addsd %xmm7, %xmm3 + addsd %xmm5, %xmm1 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + unpckhpd %xmm6, %xmm6 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm4 + movsd %xmm4, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + jg .L_2TAG_PACKET_2.0.2 + shrl $4, %eax + cmpl $268434685, %eax + jne .L_2TAG_PACKET_3.0.2 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_3.0.2: + movsd 2192(%ebx), %xmm3 + mulsd %xmm0, %xmm3 + subsd %xmm0, %xmm3 + mulsd 2208(%ebx), %xmm3 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + movl 132(%esp), %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + je .L_2TAG_PACKET_4.0.2 + subl $32, %esp + movsd %xmm0, (%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $2, %eax + movl %eax, 12(%esp) + call __libm_sincos_huge + addl $32, %esp + fldl 16(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + fldl 128(%esp) + fmull 2240(%ebx) +.L_2TAG_PACKET_1.0.2: + movl 56(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sin,@function + .size sin,.-sin + .data +# -- End sin + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 1072693248 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1071644672 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 1071644672 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1070596096 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 1070596096 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1069547520 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 3217031168 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 3218079744 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 3218079744 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 3219128320 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 3220176896 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3219128320 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 3219128320 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3218079744 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 3218079744 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 1069547520 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 1070596096 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 1070596096 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 1071644672 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 1072693248 + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .long 1413480448 + .long 1069097467 + .long 0 + .long 0 + .long 771977331 + .long 996350346 + .long 0 + .long 0 + .long 1841940611 + .long 1076125488 + .long 0 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 0 + .long 1130364928 + .long 0 + .long 0 + .long 0 + .long 1015021568 + .long 0 + .long 0 + .long 4294967295 + .long 1072693247 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .type static_const_table,@object + .size static_const_table,2288 + .data + .hidden __libm_sincos_huge + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sincos_pi4l.S b/external/sgx_libm/ia32/sincos_pi4l.S new file mode 100644 index 0000000000..f3074c36da --- /dev/null +++ b/external/sgx_libm/ia32/sincos_pi4l.S @@ -0,0 +1,3894 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincos_pi4l.c" + .text +..TXTST0: +# -- Begin __libm_sincos_pi4l + .text + .align 16,0x90 + .hidden __libm_sincos_pi4l + .globl __libm_sincos_pi4l +__libm_sincos_pi4l: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 24 + %ebp +# parameter 4: 28 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $52, %esp + fldt 8(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %gs:20, %edx + xorl %esp, %edx + fldt _pzerol_value@GOTOFF(%ebx) + movl %edx, 36(%esp) + fcom %st(1) + fnstsw %ax + movl 28(%ebp), %ecx + sahf + jbe ..B1.3 +..B1.2: + negl %ecx + movl $-1, %esi + fxch %st(1) + fchs + fxch %st(1) + jmp ..B1.4 +..B1.3: + movl $1, %esi +..B1.4: + fldt _pion4@GOTOFF(%ebx) + fcom %st(2) + fnstsw %ax + sahf + jbe ..B1.8 +..B1.5: + fstp %st(1) + testb $1, %cl + je ..B1.7 +..B1.6: + fsubrp %st, %st(1) + jmp ..B1.27 +..B1.7: + fstp %st(0) + jmp ..B1.27 +..B1.8: + fldt _cody_thres_val@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + fldz + sahf + jbe ..B1.10 +..B1.9: + fstp %st(2) + fstp %st(0) + fstp %st(0) + fldt __4onpi@GOTOFF(%ebx) + fmul %st(1), %st + fnstcw (%esp) + movzwl (%esp), %eax + orl $3072, %eax + movl %eax, 8(%esp) + fldcw 8(%esp) + fistpl 16(%esp) + fldcw (%esp) + fldt _PI04@GOTOFF(%ebx) + fldt 12+_PI04@GOTOFF(%ebx) + fldt 24+_PI04@GOTOFF(%ebx) + movl 16(%esp), %eax + addl %eax, %ecx + testb $1, %cl + lea 1(%eax), %edx + jne ..L3 + movl %eax, %edx +..L3: + movl %edx, 24(%esp) + fildl 24(%esp) + fmul %st, %st(3) + fxch %st(3) + fsubrp %st, %st(4) + fxch %st(1) + fmul %st(2), %st + fsubrp %st, %st(3) + fmulp %st, %st(1) + fsubrp %st, %st(1) + jmp ..B1.27 +..B1.10: + fxch %st(3) + fstpt 16(%esp) + movzwl 24(%esp), %eax + movl %ecx, 12(%esp) + movl %eax, %ecx + andl $32767, %ecx + andl $-32768, %eax + lea -62(%ecx), %edx + andl $32767, %edx + lea -16417(%ecx), %edi + orl %edx, %eax + movw %ax, 24(%esp) + movl $-2078209981, %eax + fldt 16(%esp) + imull %edi + sarl $31, %edi + lea -16417(%edx,%ecx), %edx + sarl $4, %edx + subl %edi, %edx + movl %edx, %edi + shll $5, %edi + negl %edi + addl %edx, %edi + fstpt (%esp) + fldt (%esp) + movl $0, (%esp) + fldt (%esp) + lea -16417(%edi,%ecx), %ecx + cmpl $23, %ecx + fsubr %st, %st(1) + movl 12(%esp), %ecx + jl ..B1.12 +..B1.11: + fxch %st(4) + fstpt (%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %edi + incl %edx + fldt _4OPI@GOTOFF(%edi,%ebx) + fmul %st(1), %st + fldt 12+_4OPI@GOTOFF(%edi,%ebx) + fmul %st(5), %st + faddp %st, %st(1) + fstpt 12(%esp) + fldt 12(%esp) + andl $-16777216, 12(%esp) + fldt 12(%esp) + fsubrp %st, %st(1) + jmp ..B1.13 +..B1.12: + fstp %st(4) + fld %st(2) +..B1.13: + fld %st(4) + lea (,%edx,8), %edi + lea (%edi,%edx,4), %eax + fldt 12+_4OPI@GOTOFF(%eax,%ebx) + fmul %st, %st(1) + fmul %st(3), %st + fldt _4OPI@GOTOFF(%eax,%ebx) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fldt 24+_4OPI@GOTOFF(%eax,%ebx) + fmul %st(7), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fadd %st, %st(1) + fstpt 12(%esp) + fldt _ADDING@GOTOFF(%ebx) + fld %st(0) + fadd %st(2), %st + fstpt (%esp) + fldt (%esp) + fsubp %st, %st(1) + movl (%esp), %edi + fcom %st(1) + fnstsw %ax + fxch %st(1) + fstp %st(0) + fldt 24(%esp) + sahf + jbe ..B1.15 +..B1.14: + fldt _nonel_value@GOTOFF(%ebx) + decl %edi + faddp %st, %st(2) +..B1.15: + addl %edi, %ecx + fxch %st(1) + fsubrp %st, %st(2) + testb $1, %cl + je ..B1.18 +..B1.16: + fstp %st(4) + fldt _nonel_value@GOTOFF(%ebx) + fxch %st(4) +..B1.18: + lea 2(%edx), %edi + movl %edi, %eax + fxch %st(1) + faddp %st, %st(4) + negl %eax + faddp %st, %st(3) + addl $532, %eax + cmpl $5, %eax + jbe ..L4 + movl $5, %eax +..L4: + movl %eax, 8(%esp) + cmpl $532, %edi + jge ..B1.25 +..B1.19: + shrl $1, %eax + movl %eax, 12(%esp) + testl %eax, %eax + jbe ..B1.33 +..B1.20: + movl %esi, (%esp) + lea 16(,%edx,8), %eax + movl %ebx, 4(%esp) + lea 8(%eax,%edx,4), %eax + movl 12(%esp), %esi + xorl %edi, %edi + lea _4OPI@GOTOFF(%ebx,%eax), %eax +..B1.21: + jmp ..L5 +..L6: + faddp %st, %st(3) +..L5: + fld %st(3) + lea (%edi,%edi,2), %ebx + fldt 12(%eax,%ebx,8) + incl %edi + fmul %st, %st(1) + cmpl %esi, %edi + fmul %st(2), %st + fldt (%eax,%ebx,8) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fldt 24(%eax,%ebx,8) + fmul %st(5), %st + faddp %st, %st(1) + jb ..L6 + faddp %st, %st(3) +..B1.22: + movl (%esp), %esi + lea 1(%edi,%edi), %edi + movl 4(%esp), %ebx +..B1.23: + lea -1(%edi), %eax + cmpl 8(%esp), %eax + jae ..B1.25 +..B1.24: + lea 1(%edi,%edx), %edx + lea (,%edx,8), %eax + lea (%eax,%edx,4), %edi + fldt _4OPI@GOTOFF(%ebx,%edi) + fmulp %st, %st(1) + fldt 12+_4OPI@GOTOFF(%ebx,%edi) + fmulp %st, %st(4) + fadd %st(3), %st + fadd %st, %st(2) +..B1.25: + fstp %st(3) + fstp %st(2) + fmulp %st, %st(1) +..B1.27: + testb $1, %cl + lea 1(%ecx), %edi + fld %st(0) + jne ..L7 + movl %ecx, %edi +..L7: + andl $7, %edi + movl 24(%ebp), %edx + fmul %st(1), %st + imull ssign@GOTOFF(%ebx,%edi,4), %esi + movl csign@GOTOFF(%ebx,%edi,4), %eax + andl $3, %edi + decl %edi + movl %esi, 24(%esp) + cmpl $1, %edi + fildl 24(%esp) + ja ..B1.29 +..B1.28: + fldt _PC@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PC@GOTOFF(%ebx) + movl 20(%ebp), %ecx + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PC@GOTOFF(%ebx) + movl %eax, 24(%esp) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _ponel_value@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%ecx) + fldt _PS@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fildl 24(%esp) + fmulp %st, %st(1) + fstpt (%edx) + jmp ..B1.30 +..B1.29: + fldt _PS@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PS@GOTOFF(%ebx) + movl 20(%ebp), %ecx + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PS@GOTOFF(%ebx) + movl %eax, 24(%esp) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fildl 24(%esp) + fldt 60+_PS@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 72+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_PS@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fmul %st(4), %st + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(1) + fstpt (%ecx) + fldt _PC@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84+_PC@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt _ponel_value@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%edx) +..B1.30: + movl 36(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.32 +..B1.31: + addl $52, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + call __stack_chk_fail@PLT +..B1.33: + movl $1, %edi + jmp ..B1.23 + .align 16,0x90 + .type __libm_sincos_pi4l,@function + .size __libm_sincos_pi4l,.-__libm_sincos_pi4l + .data +# -- End __libm_sincos_pi4l + .section .rodata, "a" + .align 4 + .align 4 +ssign: + .long 1 + .long 1 + .long 1 + .long 1 + .long -1 + .long -1 + .long -1 + .long -1 + .type ssign,@object + .size ssign,32 + .align 4 +csign: + .long 1 + .long 1 + .long -1 + .long -1 + .long -1 + .long -1 + .long 1 + .long 1 + .type csign,@object + .size csign,32 + .align 2 +_pzerol_value: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _pzerol_value,@object + .size _pzerol_value,12 + .align 2 +_pion4: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16382 + .word 0 + .type _pion4,@object + .size _pion4,12 + .align 2 +_cody_thres_val: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16413 + .word 0 + .type _cody_thres_val,@object + .size _cody_thres_val,12 + .align 2 +__4onpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16383 + .word 0 + .type __4onpi,@object + .size __4onpi,12 + .align 2 +_PI04: + .word 0 + .word 0 + .word 55936 + .word 51471 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 41728 + .word 34949 + .word 16356 + .word 0 + .word 14087 + .word 41696 + .word 12696 + .word 36145 + .word 16328 + .word 0 + .type _PI04,@object + .size _PI04,36 + .align 2 +_4OPI: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33646 + .word 41721 + .word 16445 + .word 0 + .word 0 + .word 0 + .word 10832 + .word 40072 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 44008 + .word 65043 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 28384 + .word 64154 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 38272 + .word 56162 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 7298 + .word 51682 + .word 16290 + .word 0 + .word 0 + .word 0 + .word 45504 + .word 65320 + .word 16254 + .word 0 + .word 0 + .word 0 + .word 61204 + .word 44922 + .word 16227 + .word 0 + .word 0 + .word 0 + .word 18652 + .word 50030 + .word 16196 + .word 0 + .word 0 + .word 0 + .word 14144 + .word 59657 + .word 16163 + .word 0 + .word 0 + .word 0 + .word 37450 + .word 47105 + .word 16135 + .word 0 + .word 0 + .word 0 + .word 14898 + .word 56641 + .word 16104 + .word 0 + .word 0 + .word 0 + .word 34680 + .word 34623 + .word 16071 + .word 0 + .word 0 + .word 0 + .word 4760 + .word 45515 + .word 16041 + .word 0 + .word 0 + .word 0 + .word 41480 + .word 40187 + .word 16011 + .word 0 + .word 0 + .word 0 + .word 47852 + .word 55252 + .word 15979 + .word 0 + .word 0 + .word 0 + .word 54072 + .word 35081 + .word 15948 + .word 0 + .word 0 + .word 0 + .word 26808 + .word 57421 + .word 15916 + .word 0 + .word 0 + .word 0 + .word 20068 + .word 57232 + .word 15887 + .word 0 + .word 0 + .word 0 + .word 49576 + .word 60188 + .word 15854 + .word 0 + .word 0 + .word 0 + .word 10016 + .word 52861 + .word 15823 + .word 0 + .word 0 + .word 0 + .word 30648 + .word 35825 + .word 15792 + .word 0 + .word 0 + .word 0 + .word 60542 + .word 58528 + .word 15763 + .word 0 + .word 0 + .word 0 + .word 65468 + .word 61743 + .word 15732 + .word 0 + .word 0 + .word 0 + .word 64960 + .word 45825 + .word 15696 + .word 0 + .word 0 + .word 0 + .word 50604 + .word 38792 + .word 15670 + .word 0 + .word 0 + .word 0 + .word 18394 + .word 33435 + .word 15639 + .word 0 + .word 0 + .word 0 + .word 55780 + .word 42703 + .word 15608 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 63841 + .word 15576 + .word 0 + .word 0 + .word 0 + .word 63080 + .word 62563 + .word 15545 + .word 0 + .word 0 + .word 0 + .word 20840 + .word 62207 + .word 15514 + .word 0 + .word 0 + .word 0 + .word 30094 + .word 59983 + .word 15484 + .word 0 + .word 0 + .word 0 + .word 61818 + .word 60389 + .word 15453 + .word 0 + .word 0 + .word 0 + .word 40186 + .word 40579 + .word 15422 + .word 0 + .word 0 + .word 0 + .word 42170 + .word 58004 + .word 15391 + .word 0 + .word 0 + .word 0 + .word 55276 + .word 39678 + .word 15359 + .word 0 + .word 0 + .word 0 + .word 44672 + .word 36806 + .word 15326 + .word 0 + .word 0 + .word 0 + .word 13060 + .word 34144 + .word 15297 + .word 0 + .word 0 + .word 0 + .word 28016 + .word 57231 + .word 15264 + .word 0 + .word 0 + .word 0 + .word 16112 + .word 44995 + .word 15235 + .word 0 + .word 0 + .word 0 + .word 53464 + .word 33387 + .word 15203 + .word 0 + .word 0 + .word 0 + .word 7296 + .word 60751 + .word 15170 + .word 0 + .word 0 + .word 0 + .word 29452 + .word 45231 + .word 15142 + .word 0 + .word 0 + .word 0 + .word 26208 + .word 49689 + .word 15111 + .word 0 + .word 0 + .word 0 + .word 37900 + .word 44002 + .word 15080 + .word 0 + .word 0 + .word 0 + .word 57340 + .word 33800 + .word 15049 + .word 0 + .word 0 + .word 0 + .word 27544 + .word 50178 + .word 15018 + .word 0 + .word 0 + .word 0 + .word 6168 + .word 40132 + .word 14987 + .word 0 + .word 0 + .word 0 + .word 21392 + .word 43702 + .word 14954 + .word 0 + .word 0 + .word 0 + .word 45168 + .word 54372 + .word 14926 + .word 0 + .word 0 + .word 0 + .word 8986 + .word 40688 + .word 14895 + .word 0 + .word 0 + .word 0 + .word 1648 + .word 53745 + .word 14863 + .word 0 + .word 0 + .word 0 + .word 30520 + .word 55795 + .word 14831 + .word 0 + .word 0 + .word 0 + .word 43060 + .word 32914 + .word 14801 + .word 0 + .word 0 + .word 0 + .word 46172 + .word 52771 + .word 14770 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 45285 + .word 14738 + .word 0 + .word 0 + .word 0 + .word 53590 + .word 44868 + .word 14709 + .word 0 + .word 0 + .word 0 + .word 40786 + .word 35970 + .word 14678 + .word 0 + .word 0 + .word 0 + .word 33436 + .word 65411 + .word 14646 + .word 0 + .word 0 + .word 0 + .word 32006 + .word 61382 + .word 14616 + .word 0 + .word 0 + .word 0 + .word 37856 + .word 45239 + .word 14583 + .word 0 + .word 0 + .word 0 + .word 60894 + .word 49555 + .word 14554 + .word 0 + .word 0 + .word 0 + .word 48064 + .word 53065 + .word 14519 + .word 0 + .word 0 + .word 0 + .word 48624 + .word 54844 + .word 14492 + .word 0 + .word 0 + .word 0 + .word 7988 + .word 40762 + .word 14461 + .word 0 + .word 0 + .word 0 + .word 16270 + .word 58745 + .word 14430 + .word 0 + .word 0 + .word 0 + .word 37064 + .word 50168 + .word 14398 + .word 0 + .word 0 + .word 0 + .word 18624 + .word 63736 + .word 14364 + .word 0 + .word 0 + .word 0 + .word 60758 + .word 44966 + .word 14337 + .word 0 + .word 0 + .word 0 + .word 33304 + .word 47465 + .word 14306 + .word 0 + .word 0 + .word 0 + .word 6226 + .word 60503 + .word 14275 + .word 0 + .word 0 + .word 0 + .word 26380 + .word 54900 + .word 14243 + .word 0 + .word 0 + .word 0 + .word 44352 + .word 49860 + .word 14213 + .word 0 + .word 0 + .word 0 + .word 11904 + .word 42646 + .word 14182 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 50279 + .word 14145 + .word 0 + .word 0 + .word 0 + .word 15474 + .word 50606 + .word 14120 + .word 0 + .word 0 + .word 0 + .word 45062 + .word 44137 + .word 14089 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 36063 + .word 14055 + .word 0 + .word 0 + .word 0 + .word 40658 + .word 53854 + .word 14027 + .word 0 + .word 0 + .word 0 + .word 28652 + .word 43690 + .word 13996 + .word 0 + .word 0 + .word 0 + .word 24640 + .word 64348 + .word 13963 + .word 0 + .word 0 + .word 0 + .word 30284 + .word 41980 + .word 13933 + .word 0 + .word 0 + .word 0 + .word 45652 + .word 38222 + .word 13902 + .word 0 + .word 0 + .word 0 + .word 15900 + .word 62940 + .word 13871 + .word 0 + .word 0 + .word 0 + .word 31494 + .word 50741 + .word 13841 + .word 0 + .word 0 + .word 0 + .word 43194 + .word 55096 + .word 13810 + .word 0 + .word 0 + .word 0 + .word 1740 + .word 45646 + .word 13778 + .word 0 + .word 0 + .word 0 + .word 28936 + .word 44150 + .word 13748 + .word 0 + .word 0 + .word 0 + .word 8996 + .word 42955 + .word 13717 + .word 0 + .word 0 + .word 0 + .word 44096 + .word 61205 + .word 13684 + .word 0 + .word 0 + .word 0 + .word 44614 + .word 54550 + .word 13655 + .word 0 + .word 0 + .word 0 + .word 24926 + .word 57347 + .word 13624 + .word 0 + .word 0 + .word 0 + .word 3312 + .word 61415 + .word 13590 + .word 0 + .word 0 + .word 0 + .word 64336 + .word 63884 + .word 13562 + .word 0 + .word 0 + .word 0 + .word 2748 + .word 62259 + .word 13530 + .word 0 + .word 0 + .word 0 + .word 56672 + .word 51775 + .word 13498 + .word 0 + .word 0 + .word 0 + .word 32438 + .word 55423 + .word 13469 + .word 0 + .word 0 + .word 0 + .word 17652 + .word 45713 + .word 13438 + .word 0 + .word 0 + .word 0 + .word 65408 + .word 51586 + .word 13403 + .word 0 + .word 0 + .word 0 + .word 40416 + .word 55736 + .word 13376 + .word 0 + .word 0 + .word 0 + .word 52546 + .word 37734 + .word 13345 + .word 0 + .word 0 + .word 0 + .word 48880 + .word 64238 + .word 13314 + .word 0 + .word 0 + .word 0 + .word 56004 + .word 46833 + .word 13282 + .word 0 + .word 0 + .word 0 + .word 61760 + .word 38110 + .word 13250 + .word 0 + .word 0 + .word 0 + .word 41496 + .word 35659 + .word 13219 + .word 0 + .word 0 + .word 0 + .word 25472 + .word 41269 + .word 13187 + .word 0 + .word 0 + .word 0 + .word 45444 + .word 36018 + .word 13159 + .word 0 + .word 0 + .word 0 + .word 6510 + .word 56417 + .word 13128 + .word 0 + .word 0 + .word 0 + .word 3072 + .word 56837 + .word 13097 + .word 0 + .word 0 + .word 0 + .word 61338 + .word 48440 + .word 13066 + .word 0 + .word 0 + .word 0 + .word 49568 + .word 57088 + .word 13034 + .word 0 + .word 0 + .word 0 + .word 4240 + .word 39283 + .word 13002 + .word 0 + .word 0 + .word 0 + .word 18562 + .word 33537 + .word 12973 + .word 0 + .word 0 + .word 0 + .word 31422 + .word 44487 + .word 12942 + .word 0 + .word 0 + .word 0 + .word 31930 + .word 60459 + .word 12911 + .word 0 + .word 0 + .word 0 + .word 42272 + .word 36641 + .word 12878 + .word 0 + .word 0 + .word 0 + .word 28940 + .word 36150 + .word 12849 + .word 0 + .word 0 + .word 0 + .word 21010 + .word 50925 + .word 12818 + .word 0 + .word 0 + .word 0 + .word 29448 + .word 64886 + .word 12786 + .word 0 + .word 0 + .word 0 + .word 20500 + .word 54600 + .word 12756 + .word 0 + .word 0 + .word 0 + .word 54258 + .word 46233 + .word 12725 + .word 0 + .word 0 + .word 0 + .word 32628 + .word 42502 + .word 12693 + .word 0 + .word 0 + .word 0 + .word 61608 + .word 55072 + .word 12663 + .word 0 + .word 0 + .word 0 + .word 6236 + .word 57871 + .word 12631 + .word 0 + .word 0 + .word 0 + .word 42408 + .word 34616 + .word 12601 + .word 0 + .word 0 + .word 0 + .word 56692 + .word 51963 + .word 12569 + .word 0 + .word 0 + .word 0 + .word 39094 + .word 48526 + .word 12539 + .word 0 + .word 0 + .word 0 + .word 59870 + .word 38783 + .word 12508 + .word 0 + .word 0 + .word 0 + .word 26560 + .word 33165 + .word 12477 + .word 0 + .word 0 + .word 0 + .word 58666 + .word 37666 + .word 12446 + .word 0 + .word 0 + .word 0 + .word 58728 + .word 39788 + .word 12414 + .word 0 + .word 0 + .word 0 + .word 9048 + .word 43530 + .word 12383 + .word 0 + .word 0 + .word 0 + .word 58496 + .word 57659 + .word 12350 + .word 0 + .word 0 + .word 0 + .word 12324 + .word 37025 + .word 12322 + .word 0 + .word 0 + .word 0 + .word 38432 + .word 55856 + .word 12290 + .word 0 + .word 0 + .word 0 + .word 35210 + .word 45960 + .word 12260 + .word 0 + .word 0 + .word 0 + .word 45644 + .word 51345 + .word 12229 + .word 0 + .word 0 + .word 0 + .word 32854 + .word 63883 + .word 12198 + .word 0 + .word 0 + .word 0 + .word 29348 + .word 41450 + .word 12166 + .word 0 + .word 0 + .word 0 + .word 27384 + .word 38024 + .word 12134 + .word 0 + .word 0 + .word 0 + .word 57356 + .word 57291 + .word 12105 + .word 0 + .word 0 + .word 0 + .word 61164 + .word 51521 + .word 12073 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 59151 + .word 12041 + .word 0 + .word 0 + .word 0 + .word 36704 + .word 39943 + .word 12010 + .word 0 + .word 0 + .word 0 + .word 45864 + .word 50151 + .word 11981 + .word 0 + .word 0 + .word 0 + .word 37892 + .word 63687 + .word 11949 + .word 0 + .word 0 + .word 0 + .word 14560 + .word 51615 + .word 11918 + .word 0 + .word 0 + .word 0 + .word 38776 + .word 55684 + .word 11886 + .word 0 + .word 0 + .word 0 + .word 59136 + .word 53570 + .word 11855 + .word 0 + .word 0 + .word 0 + .word 55556 + .word 37955 + .word 11826 + .word 0 + .word 0 + .word 0 + .word 54458 + .word 44670 + .word 11795 + .word 0 + .word 0 + .word 0 + .word 36446 + .word 34084 + .word 11764 + .word 0 + .word 0 + .word 0 + .word 46416 + .word 51693 + .word 11731 + .word 0 + .word 0 + .word 0 + .word 21432 + .word 34376 + .word 11702 + .word 0 + .word 0 + .word 0 + .word 56036 + .word 34809 + .word 11671 + .word 0 + .word 0 + .word 0 + .word 10562 + .word 55654 + .word 11640 + .word 0 + .word 0 + .word 0 + .word 20264 + .word 53052 + .word 11608 + .word 0 + .word 0 + .word 0 + .word 64064 + .word 50415 + .word 11574 + .word 0 + .word 0 + .word 0 + .word 17444 + .word 48295 + .word 11546 + .word 0 + .word 0 + .word 0 + .word 11874 + .word 52677 + .word 11516 + .word 0 + .word 0 + .word 0 + .word 60808 + .word 39275 + .word 11485 + .word 0 + .word 0 + .word 0 + .word 31792 + .word 55677 + .word 11451 + .word 0 + .word 0 + .word 0 + .word 60710 + .word 49006 + .word 11423 + .word 0 + .word 0 + .word 0 + .word 10520 + .word 37403 + .word 11391 + .word 0 + .word 0 + .word 0 + .word 20004 + .word 59470 + .word 11360 + .word 0 + .word 0 + .word 0 + .word 28096 + .word 37612 + .word 11330 + .word 0 + .word 0 + .word 0 + .word 20268 + .word 44280 + .word 11298 + .word 0 + .word 0 + .word 0 + .word 50740 + .word 61588 + .word 11267 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 58835 + .word 11235 + .word 0 + .word 0 + .word 0 + .word 8576 + .word 42496 + .word 11200 + .word 0 + .word 0 + .word 0 + .word 33920 + .word 54912 + .word 11169 + .word 0 + .word 0 + .word 0 + .word 35620 + .word 54843 + .word 11143 + .word 0 + .word 0 + .word 0 + .word 736 + .word 43591 + .word 11109 + .word 0 + .word 0 + .word 0 + .word 39632 + .word 61060 + .word 11080 + .word 0 + .word 0 + .word 0 + .word 63452 + .word 63129 + .word 11051 + .word 0 + .word 0 + .word 0 + .word 56798 + .word 58512 + .word 11020 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 46333 + .word 10986 + .word 0 + .word 0 + .word 0 + .word 37300 + .word 36598 + .word 10957 + .word 0 + .word 0 + .word 0 + .word 41952 + .word 41639 + .word 10924 + .word 0 + .word 0 + .word 0 + .word 52452 + .word 33459 + .word 10895 + .word 0 + .word 0 + .word 0 + .word 58558 + .word 33287 + .word 10865 + .word 0 + .word 0 + .word 0 + .word 7570 + .word 43843 + .word 10834 + .word 0 + .word 0 + .word 0 + .word 59416 + .word 63990 + .word 10802 + .word 0 + .word 0 + .word 0 + .word 65298 + .word 47744 + .word 10772 + .word 0 + .word 0 + .word 0 + .word 21076 + .word 34089 + .word 10741 + .word 0 + .word 0 + .word 0 + .word 7048 + .word 57394 + .word 10710 + .word 0 + .word 0 + .word 0 + .word 12872 + .word 55405 + .word 10677 + .word 0 + .word 0 + .word 0 + .word 12608 + .word 51669 + .word 10643 + .word 0 + .word 0 + .word 0 + .word 5350 + .word 48455 + .word 10617 + .word 0 + .word 0 + .word 0 + .word 23568 + .word 58692 + .word 10585 + .word 0 + .word 0 + .word 0 + .word 40784 + .word 37046 + .word 10553 + .word 0 + .word 0 + .word 0 + .word 38992 + .word 43861 + .word 10523 + .word 0 + .word 0 + .word 0 + .word 10064 + .word 40199 + .word 10493 + .word 0 + .word 0 + .word 0 + .word 26368 + .word 35771 + .word 10456 + .word 0 + .word 0 + .word 0 + .word 23994 + .word 60721 + .word 10431 + .word 0 + .word 0 + .word 0 + .word 25052 + .word 34302 + .word 10399 + .word 0 + .word 0 + .word 0 + .word 39842 + .word 54964 + .word 10369 + .word 0 + .word 0 + .word 0 + .word 11568 + .word 58277 + .word 10336 + .word 0 + .word 0 + .word 0 + .word 26160 + .word 46438 + .word 10306 + .word 0 + .word 0 + .word 0 + .word 23252 + .word 43049 + .word 10276 + .word 0 + .word 0 + .word 0 + .word 35288 + .word 58000 + .word 10245 + .word 0 + .word 0 + .word 0 + .word 14614 + .word 50216 + .word 10214 + .word 0 + .word 0 + .word 0 + .word 1168 + .word 48804 + .word 10181 + .word 0 + .word 0 + .word 0 + .word 60934 + .word 33006 + .word 10152 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 62247 + .word 10117 + .word 0 + .word 0 + .word 0 + .word 59968 + .word 43121 + .word 10085 + .word 0 + .word 0 + .word 0 + .word 25560 + .word 39974 + .word 10057 + .word 0 + .word 0 + .word 0 + .word 1978 + .word 49353 + .word 10028 + .word 0 + .word 0 + .word 0 + .word 16290 + .word 38807 + .word 9997 + .word 0 + .word 0 + .word 0 + .word 8646 + .word 65226 + .word 9966 + .word 0 + .word 0 + .word 0 + .word 56896 + .word 34317 + .word 9933 + .word 0 + .word 0 + .word 0 + .word 40136 + .word 39118 + .word 9902 + .word 0 + .word 0 + .word 0 + .word 14200 + .word 41756 + .word 9871 + .word 0 + .word 0 + .word 0 + .word 59256 + .word 63202 + .word 9840 + .word 0 + .word 0 + .word 0 + .word 22968 + .word 63553 + .word 9810 + .word 0 + .word 0 + .word 0 + .word 736 + .word 44292 + .word 9778 + .word 0 + .word 0 + .word 0 + .word 23186 + .word 37760 + .word 9749 + .word 0 + .word 0 + .word 0 + .word 51008 + .word 34950 + .word 9714 + .word 0 + .word 0 + .word 0 + .word 1664 + .word 64248 + .word 9681 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 35199 + .word 9656 + .word 0 + .word 0 + .word 0 + .word 34656 + .word 63747 + .word 9625 + .word 0 + .word 0 + .word 0 + .word 44330 + .word 49864 + .word 9594 + .word 0 + .word 0 + .word 0 + .word 11654 + .word 35567 + .word 9563 + .word 0 + .word 0 + .word 0 + .word 7924 + .word 58919 + .word 9531 + .word 0 + .word 0 + .word 0 + .word 2532 + .word 32800 + .word 9500 + .word 0 + .word 0 + .word 0 + .word 30024 + .word 53799 + .word 9469 + .word 0 + .word 0 + .word 0 + .word 30172 + .word 64347 + .word 9438 + .word 0 + .word 0 + .word 0 + .word 60036 + .word 51382 + .word 9407 + .word 0 + .word 0 + .word 0 + .word 58576 + .word 33093 + .word 9376 + .word 0 + .word 0 + .word 0 + .word 13888 + .word 38760 + .word 9345 + .word 0 + .word 0 + .word 0 + .word 9322 + .word 52460 + .word 9315 + .word 0 + .word 0 + .word 0 + .word 20944 + .word 41077 + .word 9282 + .word 0 + .word 0 + .word 0 + .word 17976 + .word 41861 + .word 9252 + .word 0 + .word 0 + .word 0 + .word 55176 + .word 55158 + .word 9222 + .word 0 + .word 0 + .word 0 + .word 4976 + .word 35223 + .word 9191 + .word 0 + .word 0 + .word 0 + .word 7816 + .word 39783 + .word 9159 + .word 0 + .word 0 + .word 0 + .word 27656 + .word 55669 + .word 9129 + .word 0 + .word 0 + .word 0 + .word 64944 + .word 53184 + .word 9095 + .word 0 + .word 0 + .word 0 + .word 12544 + .word 49190 + .word 9067 + .word 0 + .word 0 + .word 0 + .word 50612 + .word 44644 + .word 9035 + .word 0 + .word 0 + .word 0 + .word 8832 + .word 63111 + .word 9000 + .word 0 + .word 0 + .word 0 + .word 11744 + .word 36870 + .word 8974 + .word 0 + .word 0 + .word 0 + .word 9404 + .word 63025 + .word 8943 + .word 0 + .word 0 + .word 0 + .word 47316 + .word 43381 + .word 8912 + .word 0 + .word 0 + .word 0 + .word 55716 + .word 47433 + .word 8880 + .word 0 + .word 0 + .word 0 + .word 46414 + .word 48441 + .word 8850 + .word 0 + .word 0 + .word 0 + .word 19116 + .word 39506 + .word 8819 + .word 0 + .word 0 + .word 0 + .word 48060 + .word 53381 + .word 8788 + .word 0 + .word 0 + .word 0 + .word 57112 + .word 50739 + .word 8756 + .word 0 + .word 0 + .word 0 + .word 5840 + .word 60581 + .word 8724 + .word 0 + .word 0 + .word 0 + .word 62112 + .word 57199 + .word 8691 + .word 0 + .word 0 + .word 0 + .word 35908 + .word 59499 + .word 8663 + .word 0 + .word 0 + .word 0 + .word 13760 + .word 48116 + .word 8632 + .word 0 + .word 0 + .word 0 + .word 3136 + .word 56059 + .word 8597 + .word 0 + .word 0 + .word 0 + .word 37596 + .word 39221 + .word 8571 + .word 0 + .word 0 + .word 0 + .word 3232 + .word 48550 + .word 8536 + .word 0 + .word 0 + .word 0 + .word 22872 + .word 42749 + .word 8507 + .word 0 + .word 0 + .word 0 + .word 41948 + .word 40319 + .word 8478 + .word 0 + .word 0 + .word 0 + .word 31196 + .word 64693 + .word 8446 + .word 0 + .word 0 + .word 0 + .word 62052 + .word 52923 + .word 8416 + .word 0 + .word 0 + .word 0 + .word 2750 + .word 33544 + .word 8385 + .word 0 + .word 0 + .word 0 + .word 12462 + .word 46179 + .word 8354 + .word 0 + .word 0 + .word 0 + .word 25128 + .word 45120 + .word 8321 + .word 0 + .word 0 + .word 0 + .word 51634 + .word 62523 + .word 8292 + .word 0 + .word 0 + .word 0 + .word 15758 + .word 42163 + .word 8261 + .word 0 + .word 0 + .word 0 + .word 34022 + .word 36267 + .word 8230 + .word 0 + .word 0 + .word 0 + .word 41252 + .word 39796 + .word 8198 + .word 0 + .word 0 + .word 0 + .word 49782 + .word 54423 + .word 8168 + .word 0 + .word 0 + .word 0 + .word 25428 + .word 42086 + .word 8136 + .word 0 + .word 0 + .word 0 + .word 34388 + .word 44810 + .word 8105 + .word 0 + .word 0 + .word 0 + .word 7456 + .word 64092 + .word 8073 + .word 0 + .word 0 + .word 0 + .word 48336 + .word 62448 + .word 8041 + .word 0 + .word 0 + .word 0 + .word 60912 + .word 61622 + .word 8012 + .word 0 + .word 0 + .word 0 + .word 17852 + .word 37250 + .word 7982 + .word 0 + .word 0 + .word 0 + .word 57940 + .word 56453 + .word 7951 + .word 0 + .word 0 + .word 0 + .word 47256 + .word 59825 + .word 7919 + .word 0 + .word 0 + .word 0 + .word 3774 + .word 59120 + .word 7889 + .word 0 + .word 0 + .word 0 + .word 43448 + .word 62852 + .word 7857 + .word 0 + .word 0 + .word 0 + .word 4840 + .word 57195 + .word 7827 + .word 0 + .word 0 + .word 0 + .word 40862 + .word 52565 + .word 7796 + .word 0 + .word 0 + .word 0 + .word 1440 + .word 60474 + .word 7764 + .word 0 + .word 0 + .word 0 + .word 55520 + .word 38648 + .word 7734 + .word 0 + .word 0 + .word 0 + .word 15316 + .word 52422 + .word 7702 + .word 0 + .word 0 + .word 0 + .word 18704 + .word 47227 + .word 7672 + .word 0 + .word 0 + .word 0 + .word 48892 + .word 54283 + .word 7640 + .word 0 + .word 0 + .word 0 + .word 12670 + .word 41990 + .word 7610 + .word 0 + .word 0 + .word 0 + .word 27570 + .word 49842 + .word 7579 + .word 0 + .word 0 + .word 0 + .word 47230 + .word 47992 + .word 7548 + .word 0 + .word 0 + .word 0 + .word 41020 + .word 56253 + .word 7516 + .word 0 + .word 0 + .word 0 + .word 23404 + .word 58312 + .word 7486 + .word 0 + .word 0 + .word 0 + .word 35176 + .word 51854 + .word 7455 + .word 0 + .word 0 + .word 0 + .word 49188 + .word 59051 + .word 7423 + .word 0 + .word 0 + .word 0 + .word 16656 + .word 54507 + .word 7391 + .word 0 + .word 0 + .word 0 + .word 41320 + .word 48565 + .word 7362 + .word 0 + .word 0 + .word 0 + .word 302 + .word 42490 + .word 7331 + .word 0 + .word 0 + .word 0 + .word 26680 + .word 39967 + .word 7299 + .word 0 + .word 0 + .word 0 + .word 41304 + .word 43638 + .word 7269 + .word 0 + .word 0 + .word 0 + .word 2314 + .word 48533 + .word 7238 + .word 0 + .word 0 + .word 0 + .word 63294 + .word 35693 + .word 7207 + .word 0 + .word 0 + .word 0 + .word 24538 + .word 48319 + .word 7176 + .word 0 + .word 0 + .word 0 + .word 56296 + .word 47263 + .word 7145 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 38599 + .word 7113 + .word 0 + .word 0 + .word 0 + .word 6594 + .word 62116 + .word 7083 + .word 0 + .word 0 + .word 0 + .word 47104 + .word 63573 + .word 7043 + .word 0 + .word 0 + .word 0 + .word 34812 + .word 34303 + .word 7021 + .word 0 + .word 0 + .word 0 + .word 5144 + .word 33695 + .word 6990 + .word 0 + .word 0 + .word 0 + .word 24966 + .word 55768 + .word 6959 + .word 0 + .word 0 + .word 0 + .word 62720 + .word 43946 + .word 6923 + .word 0 + .word 0 + .word 0 + .word 31542 + .word 56062 + .word 6897 + .word 0 + .word 0 + .word 0 + .word 62356 + .word 59096 + .word 6865 + .word 0 + .word 0 + .word 0 + .word 28412 + .word 40533 + .word 6835 + .word 0 + .word 0 + .word 0 + .word 24080 + .word 50467 + .word 6803 + .word 0 + .word 0 + .word 0 + .word 33296 + .word 46841 + .word 6770 + .word 0 + .word 0 + .word 0 + .word 39600 + .word 38627 + .word 6742 + .word 0 + .word 0 + .word 0 + .word 14436 + .word 37607 + .word 6710 + .word 0 + .word 0 + .word 0 + .word 39032 + .word 56421 + .word 6678 + .word 0 + .word 0 + .word 0 + .word 64032 + .word 54987 + .word 6649 + .word 0 + .word 0 + .word 0 + .word 27648 + .word 42212 + .word 6613 + .word 0 + .word 0 + .word 0 + .word 43840 + .word 46107 + .word 6584 + .word 0 + .word 0 + .word 0 + .word 17316 + .word 36574 + .word 6556 + .word 0 + .word 0 + .word 0 + .word 8928 + .word 37652 + .word 6522 + .word 0 + .word 0 + .word 0 + .word 24944 + .word 47433 + .word 6493 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 57430 + .word 6461 + .word 0 + .word 0 + .word 0 + .word 39848 + .word 43340 + .word 6430 + .word 0 + .word 0 + .word 0 + .word 64160 + .word 43542 + .word 6400 + .word 0 + .word 0 + .word 0 + .word 35226 + .word 63015 + .word 6370 + .word 0 + .word 0 + .word 0 + .word 40736 + .word 64368 + .word 6338 + .word 0 + .word 0 + .word 0 + .word 42168 + .word 49526 + .word 6307 + .word 0 + .word 0 + .word 0 + .word 45596 + .word 34243 + .word 6277 + .word 0 + .word 0 + .word 0 + .word 20690 + .word 39705 + .word 6246 + .word 0 + .word 0 + .word 0 + .word 54448 + .word 46856 + .word 6213 + .word 0 + .word 0 + .word 0 + .word 64392 + .word 62736 + .word 6182 + .word 0 + .word 0 + .word 0 + .word 12780 + .word 56461 + .word 6152 + .word 0 + .word 0 + .word 0 + .word 15360 + .word 49145 + .word 6122 + .word 0 + .word 0 + .word 0 + .word 20512 + .word 49931 + .word 6087 + .word 0 + .word 0 + .word 0 + .word 54512 + .word 55820 + .word 6057 + .word 0 + .word 0 + .word 0 + .word 8402 + .word 39333 + .word 6029 + .word 0 + .word 0 + .word 0 + .word 34094 + .word 53593 + .word 5998 + .word 0 + .word 0 + .word 0 + .word 31960 + .word 38817 + .word 5966 + .word 0 + .word 0 + .word 0 + .word 16954 + .word 39291 + .word 5936 + .word 0 + .word 0 + .word 0 + .word 49600 + .word 48765 + .word 5901 + .word 0 + .word 0 + .word 0 + .word 59580 + .word 56541 + .word 5874 + .word 0 + .word 0 + .word 0 + .word 35624 + .word 44550 + .word 5843 + .word 0 + .word 0 + .word 0 + .word 4142 + .word 47316 + .word 5812 + .word 0 + .word 0 + .word 0 + .word 43520 + .word 43612 + .word 5780 + .word 0 + .word 0 + .word 0 + .word 20976 + .word 40896 + .word 5747 + .word 0 + .word 0 + .word 0 + .word 63576 + .word 57729 + .word 5719 + .word 0 + .word 0 + .word 0 + .word 37288 + .word 33122 + .word 5688 + .word 0 + .word 0 + .word 0 + .word 24384 + .word 52079 + .word 5654 + .word 0 + .word 0 + .word 0 + .word 47952 + .word 58719 + .word 5624 + .word 0 + .word 0 + .word 0 + .word 44242 + .word 55445 + .word 5595 + .word 0 + .word 0 + .word 0 + .word 61232 + .word 38847 + .word 5561 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 46039 + .word 5528 + .word 0 + .word 0 + .word 0 + .word 13396 + .word 42933 + .word 5502 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 43305 + .word 5467 + .word 0 + .word 0 + .word 0 + .word 40708 + .word 35319 + .word 5440 + .word 0 + .word 0 + .word 0 + .word 44408 + .word 55685 + .word 5409 + .word 0 + .word 0 + .word 0 + .word 42090 + .word 44607 + .word 5378 + .word 0 + .word 0 + .word 0 + .word 25504 + .word 53466 + .word 5345 + .word 0 + .word 0 + .word 0 + .word 24208 + .word 33149 + .word 5315 + .word 0 + .word 0 + .word 0 + .word 5268 + .word 45375 + .word 5285 + .word 0 + .word 0 + .word 0 + .word 144 + .word 40000 + .word 5254 + .word 0 + .word 0 + .word 0 + .word 56688 + .word 52358 + .word 5221 + .word 0 + .word 0 + .word 0 + .word 25848 + .word 56175 + .word 5190 + .word 0 + .word 0 + .word 0 + .word 57900 + .word 44055 + .word 5160 + .word 0 + .word 0 + .word 0 + .word 24800 + .word 43437 + .word 5128 + .word 0 + .word 0 + .word 0 + .word 17984 + .word 54872 + .word 5094 + .word 0 + .word 0 + .word 0 + .word 25744 + .word 41345 + .word 5068 + .word 0 + .word 0 + .word 0 + .word 7668 + .word 43682 + .word 5036 + .word 0 + .word 0 + .word 0 + .word 47434 + .word 36705 + .word 5006 + .word 0 + .word 0 + .word 0 + .word 20888 + .word 40323 + .word 4974 + .word 0 + .word 0 + .word 0 + .word 3962 + .word 43032 + .word 4944 + .word 0 + .word 0 + .word 0 + .word 50270 + .word 49260 + .word 4913 + .word 0 + .word 0 + .word 0 + .word 20160 + .word 64041 + .word 4877 + .word 0 + .word 0 + .word 0 + .word 25624 + .word 36013 + .word 4849 + .word 0 + .word 0 + .word 0 + .word 48328 + .word 59345 + .word 4820 + .word 0 + .word 0 + .word 0 + .word 51508 + .word 63920 + .word 4788 + .word 0 + .word 0 + .word 0 + .word 27872 + .word 39135 + .word 4758 + .word 0 + .word 0 + .word 0 + .word 13590 + .word 58857 + .word 4727 + .word 0 + .word 0 + .word 0 + .word 50880 + .word 61323 + .word 4692 + .word 0 + .word 0 + .word 0 + .word 44802 + .word 37181 + .word 4665 + .word 0 + .word 0 + .word 0 + .word 53808 + .word 57813 + .word 4634 + .word 0 + .word 0 + .word 0 + .word 64424 + .word 49714 + .word 4602 + .word 0 + .word 0 + .word 0 + .word 31652 + .word 44011 + .word 4572 + .word 0 + .word 0 + .word 0 + .word 28252 + .word 50834 + .word 4541 + .word 0 + .word 0 + .word 0 + .word 30370 + .word 38742 + .word 4510 + .word 0 + .word 0 + .word 0 + .word 57728 + .word 58403 + .word 4473 + .word 0 + .word 0 + .word 0 + .word 35900 + .word 37112 + .word 4448 + .word 0 + .word 0 + .word 0 + .word 40764 + .word 40914 + .word 4417 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 46910 + .word 4386 + .word 0 + .word 0 + .word 0 + .word 17854 + .word 35030 + .word 4355 + .word 0 + .word 0 + .word 0 + .word 4378 + .word 35776 + .word 4324 + .word 0 + .word 0 + .word 0 + .word 57962 + .word 55295 + .word 4293 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 56717 + .word 4260 + .word 0 + .word 0 + .word 0 + .word 37744 + .word 49416 + .word 4229 + .word 0 + .word 0 + .word 0 + .word 38484 + .word 35759 + .word 4200 + .word 0 + .word 0 + .word 0 + .word 55020 + .word 54969 + .word 4169 + .word 0 + .word 0 + .word 0 + .word 9188 + .word 55223 + .word 4137 + .word 0 + .word 0 + .word 0 + .word 6822 + .word 43079 + .word 4107 + .word 0 + .word 0 + .word 0 + .word 48870 + .word 40943 + .word 4076 + .word 0 + .word 0 + .word 0 + .word 9936 + .word 42731 + .word 4043 + .word 0 + .word 0 + .word 0 + .word 23430 + .word 43136 + .word 4014 + .word 0 + .word 0 + .word 0 + .word 4700 + .word 55665 + .word 3982 + .word 0 + .word 0 + .word 0 + .word 8056 + .word 40216 + .word 3951 + .word 0 + .word 0 + .word 0 + .word 3716 + .word 45403 + .word 3920 + .word 0 + .word 0 + .word 0 + .word 53440 + .word 49488 + .word 3889 + .word 0 + .word 0 + .word 0 + .word 41776 + .word 50188 + .word 3858 + .word 0 + .word 0 + .word 0 + .word 20994 + .word 64556 + .word 3828 + .word 0 + .word 0 + .word 0 + .word 16252 + .word 60661 + .word 3796 + .word 0 + .word 0 + .word 0 + .word 61252 + .word 65021 + .word 3765 + .word 0 + .word 0 + .word 0 + .word 16236 + .word 43803 + .word 3734 + .word 0 + .word 0 + .word 0 + .word 63064 + .word 35308 + .word 3702 + .word 0 + .word 0 + .word 0 + .word 49096 + .word 39848 + .word 3673 + .word 0 + .word 0 + .word 0 + .word 15680 + .word 48673 + .word 3642 + .word 0 + .word 0 + .word 0 + .word 48068 + .word 50957 + .word 3611 + .word 0 + .word 0 + .word 0 + .word 20824 + .word 56086 + .word 3579 + .word 0 + .word 0 + .word 0 + .word 46504 + .word 43224 + .word 3549 + .word 0 + .word 0 + .word 0 + .word 52428 + .word 46094 + .word 3517 + .word 0 + .word 0 + .word 0 + .word 17548 + .word 52066 + .word 3487 + .word 0 + .word 0 + .word 0 + .word 61738 + .word 35565 + .word 3456 + .word 0 + .word 0 + .word 0 + .word 31184 + .word 50588 + .word 3424 + .word 0 + .word 0 + .word 0 + .word 1716 + .word 52681 + .word 3394 + .word 0 + .word 0 + .word 0 + .word 44656 + .word 43385 + .word 3363 + .word 0 + .word 0 + .word 0 + .word 12668 + .word 43259 + .word 3331 + .word 0 + .word 0 + .word 0 + .word 24544 + .word 35408 + .word 3298 + .word 0 + .word 0 + .word 0 + .word 28854 + .word 65018 + .word 3270 + .word 0 + .word 0 + .word 0 + .word 5696 + .word 40391 + .word 3238 + .word 0 + .word 0 + .word 0 + .word 39580 + .word 56400 + .word 3208 + .word 0 + .word 0 + .word 0 + .word 20428 + .word 39579 + .word 3177 + .word 0 + .word 0 + .word 0 + .word 32328 + .word 36727 + .word 3146 + .word 0 + .word 0 + .word 0 + .word 34020 + .word 54457 + .word 3115 + .word 0 + .word 0 + .word 0 + .word 34016 + .word 48400 + .word 3083 + .word 0 + .word 0 + .word 0 + .word 6922 + .word 51417 + .word 3053 + .word 0 + .word 0 + .word 0 + .word 27208 + .word 64641 + .word 3021 + .word 0 + .word 0 + .word 0 + .word 1802 + .word 48886 + .word 2991 + .word 0 + .word 0 + .word 0 + .word 35440 + .word 61590 + .word 2960 + .word 0 + .word 0 + .word 0 + .word 60610 + .word 51604 + .word 2929 + .word 0 + .word 0 + .word 0 + .word 5440 + .word 38199 + .word 2895 + .word 0 + .word 0 + .word 0 + .word 6914 + .word 43867 + .word 2867 + .word 0 + .word 0 + .word 0 + .word 24000 + .word 45256 + .word 2834 + .word 0 + .word 0 + .word 0 + .word 51496 + .word 57396 + .word 2804 + .word 0 + .word 0 + .word 0 + .word 11538 + .word 46256 + .word 2774 + .word 0 + .word 0 + .word 0 + .word 36802 + .word 48020 + .word 2743 + .word 0 + .word 0 + .word 0 + .word 57910 + .word 57903 + .word 2712 + .word 0 + .word 0 + .word 0 + .word 47484 + .word 48798 + .word 2680 + .word 0 + .word 0 + .word 0 + .word 57766 + .word 57709 + .word 2650 + .word 0 + .word 0 + .word 0 + .word 54064 + .word 47856 + .word 2619 + .word 0 + .word 0 + .word 0 + .word 49340 + .word 48080 + .word 2588 + .word 0 + .word 0 + .word 0 + .word 36454 + .word 56731 + .word 2557 + .word 0 + .word 0 + .word 0 + .word 51548 + .word 63385 + .word 2526 + .word 0 + .word 0 + .word 0 + .word 56000 + .word 48716 + .word 2490 + .word 0 + .word 0 + .word 0 + .word 44992 + .word 50040 + .word 2460 + .word 0 + .word 0 + .word 0 + .word 43136 + .word 58177 + .word 2430 + .word 0 + .word 0 + .word 0 + .word 49730 + .word 33270 + .word 2402 + .word 0 + .word 0 + .word 0 + .word 29808 + .word 51063 + .word 2371 + .word 0 + .word 0 + .word 0 + .word 25276 + .word 46724 + .word 2339 + .word 0 + .word 0 + .word 0 + .word 17324 + .word 35928 + .word 2308 + .word 0 + .word 0 + .word 0 + .word 52284 + .word 63916 + .word 2278 + .word 0 + .word 0 + .word 0 + .word 5414 + .word 46704 + .word 2247 + .word 0 + .word 0 + .word 0 + .word 51710 + .word 57168 + .word 2216 + .word 0 + .word 0 + .word 0 + .word 27366 + .word 49253 + .word 2185 + .word 0 + .word 0 + .word 0 + .word 45332 + .word 53033 + .word 2154 + .word 0 + .word 0 + .word 0 + .word 54152 + .word 37418 + .word 2121 + .word 0 + .word 0 + .word 0 + .word 53076 + .word 47398 + .word 2092 + .word 0 + .word 0 + .word 0 + .word 14374 + .word 59477 + .word 2061 + .word 0 + .word 0 + .word 0 + .word 59336 + .word 33435 + .word 2029 + .word 0 + .word 0 + .word 0 + .word 21612 + .word 43267 + .word 1999 + .word 0 + .word 0 + .word 0 + .word 34664 + .word 39372 + .word 1966 + .word 0 + .word 0 + .word 0 + .word 172 + .word 62761 + .word 1936 + .word 0 + .word 0 + .word 0 + .word 9816 + .word 40715 + .word 1905 + .word 0 + .word 0 + .word 0 + .word 65116 + .word 40481 + .word 1875 + .word 0 + .word 0 + .word 0 + .word 28066 + .word 39184 + .word 1844 + .word 0 + .word 0 + .word 0 + .word 37408 + .word 63923 + .word 1813 + .word 0 + .word 0 + .word 0 + .word 15760 + .word 42305 + .word 1782 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 59340 + .word 1750 + .word 0 + .word 0 + .word 0 + .word 43258 + .word 59402 + .word 1720 + .word 0 + .word 0 + .word 0 + .word 19988 + .word 50087 + .word 1689 + .word 0 + .word 0 + .word 0 + .word 63456 + .word 47833 + .word 1655 + .word 0 + .word 0 + .word 0 + .word 65184 + .word 61426 + .word 1626 + .word 0 + .word 0 + .word 0 + .word 52982 + .word 48456 + .word 1596 + .word 0 + .word 0 + .word 0 + .word 30020 + .word 62809 + .word 1564 + .word 0 + .word 0 + .word 0 + .word 9096 + .word 63061 + .word 1533 + .word 0 + .word 0 + .word 0 + .word 59648 + .word 44374 + .word 1499 + .word 0 + .word 0 + .word 0 + .word 11456 + .word 33847 + .word 1470 + .word 0 + .word 0 + .word 0 + .word 12392 + .word 50500 + .word 1440 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 59196 + .word 1408 + .word 0 + .word 0 + .word 0 + .word 61008 + .word 40265 + .word 1377 + .word 0 + .word 0 + .word 0 + .word 37842 + .word 33270 + .word 1348 + .word 0 + .word 0 + .word 0 + .word 37916 + .word 44543 + .word 1316 + .word 0 + .word 0 + .word 0 + .word 11490 + .word 36421 + .word 1286 + .word 0 + .word 0 + .word 0 + .word 19040 + .word 38397 + .word 1254 + .word 0 + .word 0 + .word 0 + .word 31224 + .word 47162 + .word 1224 + .word 0 + .word 0 + .word 0 + .word 52056 + .word 41461 + .word 1192 + .word 0 + .word 0 + .word 0 + .word 10810 + .word 56374 + .word 1162 + .word 0 + .word 0 + .word 0 + .word 5358 + .word 35086 + .word 1131 + .word 0 + .word 0 + .word 0 + .word 36640 + .word 50226 + .word 1096 + .word 0 + .word 0 + .word 0 + .word 33856 + .word 45597 + .word 1067 + .word 0 + .word 0 + .word 0 + .word 21552 + .word 63128 + .word 1036 + .word 0 + .word 0 + .word 0 + .word 1198 + .word 35616 + .word 1007 + .word 0 + .word 0 + .word 0 + .word 1232 + .word 59506 + .word 976 + .word 0 + .word 0 + .word 0 + .word 51086 + .word 34963 + .word 945 + .word 0 + .word 0 + .word 0 + .word 3960 + .word 39061 + .word 912 + .word 0 + .word 0 + .word 0 + .word 4564 + .word 57134 + .word 882 + .word 0 + .word 0 + .word 0 + .word 59468 + .word 35285 + .word 852 + .word 0 + .word 0 + .word 0 + .word 63422 + .word 35431 + .word 821 + .word 0 + .word 0 + .word 0 + .word 38352 + .word 51462 + .word 790 + .word 0 + .word 0 + .word 0 + .word 25806 + .word 55660 + .word 759 + .word 0 + .word 0 + .word 0 + .word 38842 + .word 41327 + .word 728 + .word 0 + .word 0 + .word 0 + .word 17980 + .word 50458 + .word 697 + .word 0 + .word 0 + .word 0 + .word 61194 + .word 59710 + .word 666 + .word 0 + .word 0 + .word 0 + .word 21098 + .word 42086 + .word 635 + .word 0 + .word 0 + .word 0 + .word 16704 + .word 43341 + .word 602 + .word 0 + .word 0 + .word 0 + .word 46316 + .word 52840 + .word 573 + .word 0 + .word 0 + .word 0 + .word 20386 + .word 33936 + .word 542 + .word 0 + .word 0 + .word 0 + .word 20064 + .word 51864 + .word 509 + .word 0 + .word 0 + .word 0 + .word 2268 + .word 57500 + .word 479 + .word 0 + .word 0 + .word 0 + .word 11152 + .word 51171 + .word 449 + .word 0 + .word 0 + .word 0 + .word 23164 + .word 63727 + .word 417 + .word 0 + .word 0 + .word 0 + .word 20514 + .word 40280 + .word 387 + .word 0 + .word 0 + .word 0 + .word 21818 + .word 57922 + .word 356 + .word 0 + .word 0 + .word 0 + .word 32366 + .word 46413 + .word 325 + .word 0 + .word 0 + .word 0 + .word 53972 + .word 43148 + .word 294 + .word 0 + .word 0 + .word 0 + .word 30134 + .word 65133 + .word 263 + .word 0 + .word 0 + .word 0 + .word 15282 + .word 61516 + .word 232 + .word 0 + .word 0 + .word 0 + .word 49872 + .word 49222 + .word 200 + .word 0 + .word 0 + .word 0 + .word 9484 + .word 63958 + .word 170 + .word 0 + .word 0 + .word 0 + .word 47028 + .word 35341 + .word 139 + .word 0 + .word 0 + .word 0 + .word 6770 + .word 58613 + .word 108 + .word 0 + .word 0 + .word 0 + .word 33372 + .word 43448 + .word 77 + .word 0 + .word 0 + .word 0 + .word 27792 + .word 51629 + .word 43 + .word 0 + .word 0 + .word 0 + .word 19712 + .word 53691 + .word 15 + .word 0 + .type _4OPI,@object + .size _4OPI,6384 + .align 2 +_ADDING: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16446 + .word 0 + .type _ADDING,@object + .size _ADDING,12 + .align 2 +_nonel_value: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .type _nonel_value,@object + .size _nonel_value,12 + .align 2 +_PC: + .word 23996 + .word 61276 + .word 60076 + .word 54715 + .word 16338 + .word 0 + .word 29541 + .word 45883 + .word 23690 + .word 51658 + .word 49114 + .word 0 + .word 41007 + .word 30189 + .word 50933 + .word 36726 + .word 16354 + .word 0 + .word 11013 + .word 35124 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 13032 + .word 3304 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 45630 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .type _PC,@object + .size _PC,96 + .align 2 +_ponel_value: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _ponel_value,@object + .size _ponel_value,12 + .align 2 +_PS: + .word 25 + .word 22807 + .word 53737 + .word 51452 + .word 16334 + .word 0 + .word 54536 + .word 42444 + .word 58524 + .word 55101 + .word 49110 + .word 0 + .word 63911 + .word 27722 + .word 12213 + .word 45202 + .word 16350 + .word 0 + .word 3718 + .word 18986 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 10480 + .word 46680 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 12958 + .word 3329 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 35030 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .type _PS,@object + .size _PS,96 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sincos_wmt.S b/external/sgx_libm/ia32/sincos_wmt.S new file mode 100644 index 0000000000..6807fe1cfa --- /dev/null +++ b/external/sgx_libm/ia32/sincos_wmt.S @@ -0,0 +1,1343 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincos_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sincos + .text + .align 16,0x90 + .globl sincos +sincos: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 20 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $168, %esp + movl %ebx, 112(%esp) + call static_func + movl %eax, %ebx + movsd 176(%esp), %xmm0 + movl 184(%esp), %eax + movl %eax, 32(%esp) + movl 188(%esp), %eax + movl %eax, 36(%esp) + stmxcsr 64(%esp) + movl 64(%esp), %edx + andl $-24577, %edx + cmpl %edx, 64(%esp) + jne .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + pextrw $3, %xmm0, %eax + andl $32767, %eax + subl $12336, %eax + cmpl $4293, %eax + ja .L_2TAG_PACKET_2.0.2 + unpcklpd %xmm0, %xmm0 + movapd 4160(%ebx), %xmm1 + mulpd %xmm0, %xmm1 + movapd 4176(%ebx), %xmm2 + cvtsd2si %xmm1, %edx + addpd %xmm2, %xmm1 + movapd 4192(%ebx), %xmm3 + subpd %xmm2, %xmm1 + movapd 4208(%ebx), %xmm2 + mulpd %xmm1, %xmm3 + addl $1865216, %edx + movapd %xmm0, %xmm4 + andl $63, %edx + movapd 4144(%ebx), %xmm5 + lea (%ebx), %eax + shll $6, %edx + addl %edx, %eax + mulpd %xmm1, %xmm2 + subpd %xmm3, %xmm0 + mulpd 4224(%ebx), %xmm1 + subpd %xmm3, %xmm4 + movapd 16(%eax), %xmm7 + movapd %xmm4, %xmm3 + subpd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + movapd 4112(%ebx), %xmm6 + mulpd %xmm4, %xmm7 + subpd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%eax), %xmm2 + subpd %xmm3, %xmm1 + movapd 48(%eax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm7 + mulpd %xmm7, %xmm1 + movapd 16(%eax), %xmm7 + mulpd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulpd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm7 + mulpd %xmm0, %xmm0 + addpd 4128(%ebx), %xmm5 + mulpd (%eax), %xmm4 + addpd 4096(%ebx), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addpd 16(%eax), %xmm3 + addpd %xmm5, %xmm6 + movapd %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulpd %xmm7, %xmm6 + mulpd %xmm5, %xmm2 + movapd %xmm4, %xmm7 + addpd %xmm3, %xmm4 + movapd 16(%eax), %xmm5 + subpd %xmm3, %xmm5 + subpd %xmm4, %xmm3 + addpd 32(%eax), %xmm1 + addpd %xmm0, %xmm5 + addpd %xmm7, %xmm3 + addpd %xmm5, %xmm1 + addpd %xmm3, %xmm1 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + movl 64(%esp), %edx + andl $-24577, %edx + cmpl 64(%esp), %edx + je .L_2TAG_PACKET_3.0.2 + stmxcsr 72(%esp) + movl 64(%esp), %edx + andl $24576, %edx + orl %edx, 72(%esp) + ldmxcsr 72(%esp) +.L_2TAG_PACKET_3.0.2: + addpd %xmm4, %xmm1 + movapd %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + movl 32(%esp), %eax + movsd %xmm0, (%eax) + movl 36(%esp), %eax + movsd %xmm1, (%eax) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_2.0.2: + jg .L_2TAG_PACKET_5.0.2 + movapd %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orl $32768, %eax + pinsrw $3, %eax, %xmm1 + movl 64(%esp), %edx + andl $-24577, %edx + cmpl 64(%esp), %edx + je .L_2TAG_PACKET_6.0.2 + stmxcsr 72(%esp) + movl 64(%esp), %edx + andl $24576, %edx + orl %edx, 72(%esp) + ldmxcsr 72(%esp) +.L_2TAG_PACKET_6.0.2: + addsd 4288(%ebx), %xmm1 + cmpl $32784, %eax + jge .L_2TAG_PACKET_7.0.2 + mulsd 4272(%ebx), %xmm0 + movl 32(%esp), %eax + movsd %xmm0, (%eax) + movl 36(%esp), %eax + movsd %xmm1, (%eax) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_7.0.2: + movsd 4240(%ebx), %xmm3 + mulsd %xmm0, %xmm3 + subsd %xmm0, %xmm3 + movsd 4256(%ebx), %xmm0 + mulsd %xmm3, %xmm0 + movl 32(%esp), %eax + movsd %xmm0, (%eax) + movl 36(%esp), %eax + movsd %xmm1, (%eax) + jmp .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_0.0.2: + movl 64(%esp), %edx + andl $-24577, %edx + movl %edx, 72(%esp) + ldmxcsr 72(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_5.0.2: + subl $32, %esp + movsd %xmm0, (%esp) + lea 80(%esp), %eax + movl %eax, 8(%esp) + movl $3, %eax + movl %eax, 12(%esp) + call __libm_sincos_huge + addl $32, %esp + movq 56(%esp), %xmm0 + movq 48(%esp), %xmm1 + movl 32(%esp), %eax + movl 36(%esp), %edx + movq %xmm0, (%eax) + movq %xmm1, (%edx) +.L_2TAG_PACKET_8.0.2: + movl 64(%esp), %edx + andl $-24577, %edx + cmpl 64(%esp), %edx + je .L_2TAG_PACKET_4.0.2 + stmxcsr 72(%esp) + movl 64(%esp), %edx + andl $24576, %edx + orl %edx, 72(%esp) + ldmxcsr 72(%esp) +.L_2TAG_PACKET_4.0.2: + movl 112(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sincos,@function + .size sincos,.-sincos + .data +# -- End sincos + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 3217031168 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 3220176896 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 1069547520 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 1071644672 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 1072693248 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 1069547520 + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .long 1841940611 + .long 1076125488 + .long 1841940611 + .long 1076125488 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 1413480448 + .long 1069097467 + .long 1413480448 + .long 1069097467 + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .long 771977331 + .long 996350346 + .long 771977331 + .long 996350346 + .long 0 + .long 1130364928 + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .long 0 + .long 1015021568 + .long 4294967295 + .long 1072693247 + .long 4294967295 + .long 1072693247 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .type static_const_table,@object + .size static_const_table,4304 + .data + .hidden __libm_sincos_huge + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sincosdl_table.S b/external/sgx_libm/ia32/sincosdl_table.S new file mode 100644 index 0000000000..c9ef20a3e4 --- /dev/null +++ b/external/sgx_libm/ia32/sincosdl_table.S @@ -0,0 +1,768 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincosdl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .hidden __libm_sindl_cosdl_table + .globl __libm_sindl_cosdl_table +__libm_sindl_cosdl_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 730455326 + .long 1066524427 + .long 1746175880 + .long 1010139981 + .long 2549460874 + .long 1072692928 + .long 4286585365 + .long 3162605893 + .long 3388464167 + .long 1067572824 + .long 3405773388 + .long 1011262106 + .long 2025784679 + .long 1072691970 + .long 3458349249 + .long 3162669794 + .long 1223674126 + .long 1068157895 + .long 1350368814 + .long 3158420169 + .long 3977438749 + .long 1072690373 + .long 2138672104 + .long 1015504988 + .long 1835684136 + .long 1068620687 + .long 3698316769 + .long 3158223757 + .long 1903230966 + .long 1072688139 + .long 1549185311 + .long 1015860439 + .long 3099754755 + .long 1068912598 + .long 85775068 + .long 3160181596 + .long 3021477282 + .long 1072685267 + .long 1009168830 + .long 3161309439 + .long 2604423020 + .long 1069204064 + .long 2303648607 + .long 1009017464 + .long 2499307462 + .long 1072681759 + .long 1081812731 + .long 1015750919 + .long 1280271059 + .long 1069494996 + .long 1784430238 + .long 1012342196 + .long 631389835 + .long 1072677616 + .long 319889322 + .long 1015931913 + .long 2525863449 + .long 1069666412 + .long 3319430370 + .long 1012720668 + .long 2838533242 + .long 1072672838 + .long 3931096191 + .long 3163228296 + .long 1739084661 + .long 1069811211 + .long 266127812 + .long 1005440081 + .long 2486166620 + .long 1072667428 + .long 1862034983 + .long 3163124964 + .long 2114679690 + .long 1069955610 + .long 1043937223 + .long 3160884320 + .long 2357271575 + .long 1072661387 + .long 1809738197 + .long 1015448300 + .long 3715523151 + .long 1070099565 + .long 3282620278 + .long 1013092107 + .long 1765324482 + .long 1072654717 + .long 2731192352 + .long 3162086677 + .long 2890029302 + .long 1070243033 + .long 2223107338 + .long 3159965253 + .long 846856320 + .long 1072647420 + .long 116450415 + .long 3163379753 + .long 919455349 + .long 1070385970 + .long 2064618035 + .long 3159935516 + .long 558794511 + .long 1072639498 + .long 1424282741 + .long 3161718678 + .long 4075075869 + .long 1070528331 + .long 3748620424 + .long 3160490968 + .long 2675554853 + .long 1072630953 + .long 3840651826 + .long 3156703495 + .long 3247638160 + .long 1070633085 + .long 3696489768 + .long 1014652612 + .long 1195949845 + .long 1072621789 + .long 1259393923 + .long 3162332067 + .long 3711077929 + .long 1070703626 + .long 3146917124 + .long 1014611084 + .long 3814620032 + .long 1072612007 + .long 3070837564 + .long 3162674392 + .long 3481523655 + .long 1070773815 + .long 2713761655 + .long 1014001377 + .long 1853610783 + .long 1072601612 + .long 3649998803 + .long 1015704482 + .long 925886800 + .long 1070843631 + .long 436010265 + .long 3162460259 + .long 323245311 + .long 1072590606 + .long 3093873492 + .long 1015519453 + .long 3489713627 + .long 1070913051 + .long 528334979 + .long 1014764117 + .long 738112715 + .long 1072578992 + .long 334349375 + .long 3162809522 + .long 1955204085 + .long 1070982056 + .long 1689242582 + .long 1014445850 + .long 1112681756 + .long 1072566774 + .long 1734695380 + .long 3163113281 + .long 533648188 + .long 1071050624 + .long 3960375553 + .long 1012377538 + .long 251639813 + .long 1072553956 + .long 3380683078 + .long 1012638586 + .long 4008023681 + .long 1071118733 + .long 570275026 + .long 1014484594 + .long 2039991128 + .long 1072540541 + .long 1062999797 + .long 3162182390 + .long 580452267 + .long 1071186365 + .long 3449718872 + .long 3161633148 + .long 2553046639 + .long 1072526534 + .long 2419472295 + .long 3163244343 + .long 554048209 + .long 1071253497 + .long 2399772791 + .long 3156410517 + .long 2935979925 + .long 1072511939 + .long 1428602113 + .long 1015064920 + .long 2000132179 + .long 1071320109 + .long 2171125689 + .long 3159852223 + .long 808310631 + .long 1072496761 + .long 4227501583 + .long 1014931887 + .long 3669886408 + .long 1071386181 + .long 3536165134 + .long 1013933230 + .long 3142990026 + .long 1072481003 + .long 4101727212 + .long 3163150444 + .long 725933569 + .long 1071451694 + .long 522349177 + .long 3161311953 + .long 490548333 + .long 1072464672 + .long 2395907389 + .long 3162833649 + .long 1948536952 + .long 1071516626 + .long 320619183 + .long 1014863857 + .long 1332553480 + .long 1072447771 + .long 3321840403 + .long 3163208850 + .long 3991904492 + .long 1071580958 + .long 2374541978 + .long 1014892768 + .long 2010331591 + .long 1072430306 + .long 1428309641 + .long 3163418034 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .long 3898100906 + .long 1072412282 + .long 3501572579 + .long 1015868565 + .long 553508627 + .long 1071676209 + .long 3116078237 + .long 1016033865 + .long 511109854 + .long 1072393706 + .long 3227708102 + .long 3163199948 + .long 1051516202 + .long 1071707417 + .long 2823792103 + .long 1015984420 + .long 3268258117 + .long 1072374581 + .long 893580578 + .long 1013933326 + .long 3614471965 + .long 1071738286 + .long 2346555295 + .long 3158494963 + .long 2829987804 + .long 1072354915 + .long 4086147764 + .long 3161968777 + .long 2215771410 + .long 1071768808 + .long 2812627676 + .long 1015346091 + .long 3450400421 + .long 1072334713 + .long 2241324349 + .long 3163087632 + .long 4168894840 + .long 1071798972 + .long 555969416 + .long 1015775320 + .long 1494583111 + .long 1072313982 + .long 92043893 + .long 3160700658 + .long 74799710 + .long 1071828771 + .long 2770520589 + .long 3160558553 + .long 2610427048 + .long 1072292727 + .long 436010265 + .long 3162460259 + .long 2488647350 + .long 1071858193 + .long 3884027735 + .long 1013773085 + .long 245529108 + .long 1072270956 + .long 3304882442 + .long 1014213155 + .long 2982005049 + .long 1071887231 + .long 3980032926 + .long 3161177863 + .long 1408525265 + .long 1072248674 + .long 1201054953 + .long 1015994881 + .long 2219342526 + .long 1071915876 + .long 3430823751 + .long 3163318748 + .long 890610472 + .long 1072225889 + .long 1982309908 + .long 3162056199 + .long 1379669533 + .long 1071944119 + .long 3329850390 + .long 3162839200 + .long 2731495481 + .long 1072202607 + .long 1347545148 + .long 1014567853 + .long 2167951316 + .long 1071971951 + .long 2070879930 + .long 1013227818 + .long 3030457399 + .long 1072178836 + .long 162525240 + .long 3161624810 + .long 2531396568 + .long 1071999364 + .long 4091857862 + .long 3162202094 + .long 2821963458 + .long 1072154583 + .long 1545337900 + .long 3160735078 + .long 965516331 + .long 1072026350 + .long 156922899 + .long 1014731144 + .long 3771230594 + .long 1072129855 + .long 3521184819 + .long 1014696396 + .long 820015888 + .long 1072052900 + .long 2191736501 + .long 1015202773 + .long 3869592889 + .long 1072104660 + .long 2133682458 + .long 3163440098 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 3869592889 + .long 1072104660 + .long 2133682458 + .long 3163440098 + .long 820015888 + .long 1072052900 + .long 2191736501 + .long 1015202773 + .long 3771230594 + .long 1072129855 + .long 3521184819 + .long 1014696396 + .long 965516331 + .long 1072026350 + .long 156922899 + .long 1014731144 + .long 2821963458 + .long 1072154583 + .long 1545337900 + .long 3160735078 + .long 2531396568 + .long 1071999364 + .long 4091857862 + .long 3162202094 + .long 3030457399 + .long 1072178836 + .long 162525240 + .long 3161624810 + .long 2167951316 + .long 1071971951 + .long 2070879930 + .long 1013227818 + .long 2731495481 + .long 1072202607 + .long 1347545148 + .long 1014567853 + .long 1379669533 + .long 1071944119 + .long 3329850390 + .long 3162839200 + .long 890610472 + .long 1072225889 + .long 1982309908 + .long 3162056199 + .long 2219342526 + .long 1071915876 + .long 3430823751 + .long 3163318748 + .long 1408525265 + .long 1072248674 + .long 1201054953 + .long 1015994881 + .long 2982005049 + .long 1071887231 + .long 3980032926 + .long 3161177863 + .long 245529108 + .long 1072270956 + .long 3304882442 + .long 1014213155 + .long 2488647350 + .long 1071858193 + .long 3884027735 + .long 1013773085 + .long 2610427048 + .long 1072292727 + .long 436010265 + .long 3162460259 + .long 74799710 + .long 1071828771 + .long 2770520589 + .long 3160558553 + .long 1494583111 + .long 1072313982 + .long 92043893 + .long 3160700658 + .long 4168894840 + .long 1071798972 + .long 555969416 + .long 1015775320 + .long 3450400421 + .long 1072334713 + .long 2241324349 + .long 3163087632 + .long 2215771410 + .long 1071768808 + .long 2812627676 + .long 1015346091 + .long 2829987804 + .long 1072354915 + .long 4086147764 + .long 3161968777 + .long 3614471965 + .long 1071738286 + .long 2346555295 + .long 3158494963 + .long 3268258117 + .long 1072374581 + .long 893580578 + .long 1013933326 + .long 1051516202 + .long 1071707417 + .long 2823792103 + .long 1015984420 + .long 511109854 + .long 1072393706 + .long 3227708102 + .long 3163199948 + .long 553508627 + .long 1071676209 + .long 3116078237 + .long 1016033865 + .long 3898100906 + .long 1072412282 + .long 3501572579 + .long 1015868565 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .long 2010331591 + .long 1072430306 + .long 1428309641 + .long 3163418034 + .long 3991904492 + .long 1071580958 + .long 2374541978 + .long 1014892768 + .long 1332553480 + .long 1072447771 + .long 3321840403 + .long 3163208850 + .long 1948536952 + .long 1071516626 + .long 320619183 + .long 1014863857 + .long 490548333 + .long 1072464672 + .long 2395907389 + .long 3162833649 + .long 725933569 + .long 1071451694 + .long 522349177 + .long 3161311953 + .long 3142990026 + .long 1072481003 + .long 4101727212 + .long 3163150444 + .long 3669886408 + .long 1071386181 + .long 3536165134 + .long 1013933230 + .long 808310631 + .long 1072496761 + .long 4227501583 + .long 1014931887 + .long 2000132179 + .long 1071320109 + .long 2171125689 + .long 3159852223 + .long 2935979925 + .long 1072511939 + .long 1428602113 + .long 1015064920 + .long 554048209 + .long 1071253497 + .long 2399772791 + .long 3156410517 + .long 2553046639 + .long 1072526534 + .long 2419472295 + .long 3163244343 + .long 580452267 + .long 1071186365 + .long 3449718872 + .long 3161633148 + .long 2039991128 + .long 1072540541 + .long 1062999797 + .long 3162182390 + .long 4008023681 + .long 1071118733 + .long 570275026 + .long 1014484594 + .long 251639813 + .long 1072553956 + .long 3380683078 + .long 1012638586 + .long 533648188 + .long 1071050624 + .long 3960375553 + .long 1012377538 + .long 1112681756 + .long 1072566774 + .long 1734695380 + .long 3163113281 + .long 1955204085 + .long 1070982056 + .long 1689242582 + .long 1014445850 + .long 738112715 + .long 1072578992 + .long 334349375 + .long 3162809522 + .long 3489713627 + .long 1070913051 + .long 528334979 + .long 1014764117 + .long 323245311 + .long 1072590606 + .long 3093873492 + .long 1015519453 + .long 925886800 + .long 1070843631 + .long 436010265 + .long 3162460259 + .long 1853610783 + .long 1072601612 + .long 3649998803 + .long 1015704482 + .long 3481523655 + .long 1070773815 + .long 2713761655 + .long 1014001377 + .long 3814620032 + .long 1072612007 + .long 3070837564 + .long 3162674392 + .long 3711077929 + .long 1070703626 + .long 3146917124 + .long 1014611084 + .long 1195949845 + .long 1072621789 + .long 1259393923 + .long 3162332067 + .long 3247638160 + .long 1070633085 + .long 3696489768 + .long 1014652612 + .long 2675554853 + .long 1072630953 + .long 3840651826 + .long 3156703495 + .long 4075075869 + .long 1070528331 + .long 3748620424 + .long 3160490968 + .long 558794511 + .long 1072639498 + .long 1424282741 + .long 3161718678 + .long 919455349 + .long 1070385970 + .long 2064618035 + .long 3159935516 + .long 846856320 + .long 1072647420 + .long 116450415 + .long 3163379753 + .long 2890029302 + .long 1070243033 + .long 2223107338 + .long 3159965253 + .long 1765324482 + .long 1072654717 + .long 2731192352 + .long 3162086677 + .long 3715523151 + .long 1070099565 + .long 3282620278 + .long 1013092107 + .long 2357271575 + .long 1072661387 + .long 1809738197 + .long 1015448300 + .long 2114679690 + .long 1069955610 + .long 1043937223 + .long 3160884320 + .long 2486166620 + .long 1072667428 + .long 1862034983 + .long 3163124964 + .long 1739084661 + .long 1069811211 + .long 266127812 + .long 1005440081 + .long 2838533242 + .long 1072672838 + .long 3931096191 + .long 3163228296 + .long 2525863449 + .long 1069666412 + .long 3319430370 + .long 1012720668 + .long 631389835 + .long 1072677616 + .long 319889322 + .long 1015931913 + .long 1280271059 + .long 1069494996 + .long 1784430238 + .long 1012342196 + .long 2499307462 + .long 1072681759 + .long 1081812731 + .long 1015750919 + .long 2604423020 + .long 1069204064 + .long 2303648607 + .long 1009017464 + .long 3021477282 + .long 1072685267 + .long 1009168830 + .long 3161309439 + .long 3099754755 + .long 1068912598 + .long 85775068 + .long 3160181596 + .long 1903230966 + .long 1072688139 + .long 1549185311 + .long 1015860439 + .long 1835684136 + .long 1068620687 + .long 3698316769 + .long 3158223757 + .long 3977438749 + .long 1072690373 + .long 2138672104 + .long 1015504988 + .long 1223674126 + .long 1068157895 + .long 1350368814 + .long 3158420169 + .long 2025784679 + .long 1072691970 + .long 3458349249 + .long 3162669794 + .long 3388464167 + .long 1067572824 + .long 3405773388 + .long 1011262106 + .long 2549460874 + .long 1072692928 + .long 4286585365 + .long 3162605893 + .long 730455326 + .long 1066524427 + .long 1746175880 + .long 1010139981 + .type __libm_sindl_cosdl_table,@object + .size __libm_sindl_cosdl_table,2880 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sincosf_wmt.S b/external/sgx_libm/ia32/sincosf_wmt.S new file mode 100644 index 0000000000..e9e8131d55 --- /dev/null +++ b/external/sgx_libm/ia32/sincosf_wmt.S @@ -0,0 +1,576 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincosf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sincosf + .text + .align 16,0x90 + .globl sincosf +sincosf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +# parameter 3: 16 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $136, %esp + movl %ebx, 80(%esp) + call static_func + movl %eax, %ebx + movss 144(%esp), %xmm0 + movl 144(%esp), %ecx + movl 148(%esp), %eax + movl %eax, 32(%esp) + movl 152(%esp), %eax + movl %eax, 36(%esp) + movaps %xmm0, %xmm1 + cvtps2pd %xmm1, %xmm1 + movsd 1360(%ebx), %xmm2 + movl $2147483647, %eax + movl $1241513983, %edx + andl %ecx, %eax + subl %eax, %edx + subl $964689920, %eax + orl %eax, %edx + jl .L_2TAG_PACKET_0.0.2 + movsd 1376(%ebx), %xmm4 + mulsd %xmm1, %xmm2 + movsd 1392(%ebx), %xmm3 + movapd %xmm2, %xmm5 + addsd %xmm4, %xmm2 + movd %xmm2, %ecx + subsd %xmm4, %xmm2 + mulsd %xmm3, %xmm1 +.L_2TAG_PACKET_1.0.2: + movl $256, %eax + movapd 1040(%ebx), %xmm4 + subsd %xmm2, %xmm5 + addl %ecx, %ecx + movl %ecx, %edx + shll $24, %ecx + sarl $31, %ecx + andl %edx, %eax + addl %ecx, %edx + xorl %ecx, %edx + addsd %xmm5, %xmm1 + movsd 1440(%ebx), %xmm6 + andl $254, %edx + movapd (%ebx,%edx,8), %xmm3 + pshufd $68, %xmm1, %xmm2 + shrl $4, %eax + movapd 1072(%ebx,%eax), %xmm7 + movapd 1056(%ebx), %xmm5 + mulpd %xmm2, %xmm2 + mulsd %xmm6, %xmm1 + andl $1, %ecx + movd %ecx, %xmm0 + psllq $63, %xmm0 + xorpd %xmm0, %xmm3 + xorpd %xmm7, %xmm3 + mulpd %xmm4, %xmm2 + pshufd $78, %xmm3, %xmm6 + mulsd %xmm1, %xmm3 + addpd %xmm2, %xmm5 + mulsd %xmm1, %xmm6 + mulpd %xmm5, %xmm3 + mulpd %xmm5, %xmm6 + pshufd $238, %xmm3, %xmm0 + pshufd $238, %xmm6, %xmm1 + addsd %xmm3, %xmm0 + subsd %xmm6, %xmm1 + cvtpd2ps %xmm0, %xmm0 + cvtpd2ps %xmm1, %xmm1 + movl 32(%esp), %eax + movss %xmm0, (%eax) + movl 36(%esp), %edx + movss %xmm1, (%edx) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + andl $2147483647, %ecx + cmpl $1040187392, %ecx + ja .L_2TAG_PACKET_3.0.2 + cvtss2sd %xmm0, %xmm0 + mulsd 1344(%ebx), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movl 32(%esp), %eax + movss %xmm0, (%eax) + movl 36(%esp), %edx + movl $1065353216, %ecx + movl %ecx, (%edx) + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_3.0.2: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_4.0.2 + shrl $23, %ecx + subl $142, %ecx + andl $65528, %ecx + movsd 1104(%ebx,%ecx,2), %xmm3 + movsd 1112(%ebx,%ecx,2), %xmm5 + movsd 1424(%ebx), %xmm2 + xorpd %xmm4, %xmm4 + movl $17208, %eax + pinsrw $3, %eax, %xmm4 + andpd %xmm3, %xmm2 + psllq $40, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + movapd %xmm2, %xmm0 + addsd %xmm3, %xmm2 + movapd %xmm2, %xmm5 + subsd %xmm2, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm0, %xmm3 + movd %xmm2, %ecx + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + subss %xmm0, %xmm0 + movl 32(%esp), %eax + movss %xmm0, (%eax) + movl 36(%esp), %edx + movss %xmm0, (%edx) +.L_2TAG_PACKET_2.0.2: + movl 80(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sincosf,@function + .size sincosf,.-sincosf + .data +# -- End sincosf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1619315981 + .long 1072692616 + .long 4154680958 + .long 1067000149 + .long 3816385918 + .long 1072690721 + .long 4044216340 + .long 1068048229 + .long 2902558778 + .long 1072687565 + .long 2462980598 + .long 1068684576 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 1893834707 + .long 1072677476 + .long 1453945614 + .long 1069504078 + .long 2131272983 + .long 1072670549 + .long 1854824762 + .long 1069729808 + .long 4201728937 + .long 1072662372 + .long 1149976518 + .long 1069933076 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 2892293513 + .long 1072642291 + .long 1786662755 + .long 1070336898 + .long 4220661975 + .long 1072630398 + .long 2065784603 + .long 1070537209 + .long 3882371427 + .long 1072617280 + .long 1655830135 + .long 1070666194 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3964199186 + .long 1072587400 + .long 2484561409 + .long 1070863196 + .long 83265253 + .long 1072570657 + .long 1974149085 + .long 1070960538 + .long 3066872380 + .long 1072552723 + .long 821708191 + .long 1071057029 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 3511535930 + .long 1072513332 + .long 1135144330 + .long 1071247225 + .long 4097623923 + .long 1072491898 + .long 165764288 + .long 1071340816 + .long 557060597 + .long 1072469323 + .long 2570175582 + .long 1071433326 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 2892993834 + .long 1072420800 + .long 3690502842 + .long 1071614884 + .long 1159294526 + .long 1072394883 + .long 2569207790 + .long 1071674247 + .long 1477771776 + .long 1072367882 + .long 1411074851 + .long 1071718067 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 2688952194 + .long 1072310695 + .long 1289556703 + .long 1071803653 + .long 1207142209 + .long 1072280544 + .long 4242632757 + .long 1071845367 + .long 1234330619 + .long 1072249378 + .long 689983673 + .long 1071886330 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 201299822 + .long 1072184078 + .long 3152274921 + .long 1071965898 + .long 577417135 + .long 1072149983 + .long 881650848 + .long 1072004457 + .long 938475414 + .long 1072114952 + .long 1427975391 + .long 1072042167 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 1427975391 + .long 1072042167 + .long 938475414 + .long 1072114952 + .long 881650848 + .long 1072004457 + .long 577417135 + .long 1072149983 + .long 3152274921 + .long 1071965898 + .long 201299822 + .long 1072184078 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 689983673 + .long 1071886330 + .long 1234330619 + .long 1072249378 + .long 4242632757 + .long 1071845367 + .long 1207142209 + .long 1072280544 + .long 1289556703 + .long 1071803653 + .long 2688952194 + .long 1072310695 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 1411074851 + .long 1071718067 + .long 1477771776 + .long 1072367882 + .long 2569207790 + .long 1071674247 + .long 1159294526 + .long 1072394883 + .long 3690502842 + .long 1071614884 + .long 2892993834 + .long 1072420800 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 2570175582 + .long 1071433326 + .long 557060597 + .long 1072469323 + .long 165764288 + .long 1071340816 + .long 4097623923 + .long 1072491898 + .long 1135144330 + .long 1071247225 + .long 3511535930 + .long 1072513332 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 821708191 + .long 1071057029 + .long 3066872380 + .long 1072552723 + .long 1974149085 + .long 1070960538 + .long 83265253 + .long 1072570657 + .long 2484561409 + .long 1070863196 + .long 3964199186 + .long 1072587400 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 1655830135 + .long 1070666194 + .long 3882371427 + .long 1072617280 + .long 2065784603 + .long 1070537209 + .long 4220661975 + .long 1072630398 + .long 1786662755 + .long 1070336898 + .long 2892293513 + .long 1072642291 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 1149976518 + .long 1069933076 + .long 4201728937 + .long 1072662372 + .long 1854824762 + .long 1069729808 + .long 2131272983 + .long 1072670549 + .long 1453945614 + .long 1069504078 + .long 1893834707 + .long 1072677476 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 2462980598 + .long 1068684576 + .long 2902558778 + .long 1072687565 + .long 4044216340 + .long 1068048229 + .long 3816385918 + .long 1072690721 + .long 4154680958 + .long 1067000149 + .long 1619315981 + .long 1072692616 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 1649608659 + .long 3206173094 + .long 3384690142 + .long 3207839036 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1916669064 + .long 1072155675 + .long 660066805 + .long 1024797180 + .long 3829231700 + .long 1062745828 + .long 2884172442 + .long 1017445907 + .long 540874025 + .long 1055617650 + .long 4198409884 + .long 1011844330 + .long 2839315448 + .long 1046639136 + .long 4204424928 + .long 1000582120 + .long 1329339431 + .long 1038229673 + .long 1295478839 + .long 993391741 + .long 658191860 + .long 1024797180 + .long 3691886121 + .long 979325773 + .long 1966800710 + .long 1020436418 + .long 1882642597 + .long 977095991 + .long 2100977488 + .long 1012908661 + .long 1840335565 + .long 967470816 + .long 4198093645 + .long 1000582120 + .long 3307942521 + .long 957055414 + .long 2839123165 + .long 996851343 + .long 1387472776 + .long 952638316 + .long 2788761024 + .long 988712873 + .long 3005712498 + .long 944467026 + .long 3694676832 + .long 979325773 + .long 1326507024 + .long 934847846 + .long 221775557 + .long 970149340 + .long 1133527550 + .long 924162364 + .long 4286578688 + .long 1072693247 + .long 4286578688 + .long 1072693247 + .long 1845493760 + .long 1078222640 + .long 1845493760 + .long 1078222640 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 2908765579 + .long 3193641918 + .long 2908765579 + .long 3193641918 + .long 2308576600 + .long 1086551075 + .long 1646446368 + .long 1084878895 + .long 4278190080 + .long 4294967295 + .long 0 + .long 0 + .long 1413754136 + .long 1067000315 + .long 1413754136 + .long 1067000315 + .type static_const_table,@object + .size static_const_table,1456 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sincosl.S b/external/sgx_libm/ia32/sincosl.S new file mode 100644 index 0000000000..e5c71ee7ee --- /dev/null +++ b/external/sgx_libm/ia32/sincosl.S @@ -0,0 +1,1173 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincosl.c" + .text +..TXTST0: +# -- Begin sincosl + .text + .align 16,0x90 + .globl sincosl +sincosl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 24 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 144(%esp) + movl 20(%ebp), %edi + movl 24(%ebp), %esi +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + movzwl 62(%esp), %edx + cmpl $16378, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jge ..B1.41 +..B1.4: + cmpl $16372, %eax + jge ..B1.33 +..B1.5: + cmpl $16364, %eax + jge ..B1.25 +..B1.6: + cmpl $16308, %eax + jge ..B1.17 +..B1.7: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.75 +..B1.8: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.9: + fldcw 60(%esp) +..B1.10: + movzwl 16(%ebp), %eax + movl $1, %edx + andl $32767, %eax +..B1.11: + testl %eax, %eax + jle ..B1.71 +..B1.12: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + fsubp %st, %st(1) + fldt _small_value_80@GOTOFF(%ebx) + fsubrl _ones@GOTOFF(%ebx) + fstpt 32(%esp) + fmull 8+_TWO_75@GOTOFF(%ebx) + fstpt 16(%esp) +..B1.13: + testl %edx, %edx + je ..B1.15 +..B1.14: + fldcw 62(%esp) +..B1.15: + fldt 16(%esp) + fstpt (%edi) + fldt 32(%esp) + fstpt (%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.16: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.77 +..B1.18: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.19: + fldcw 60(%esp) +..B1.20: + movl $1, %eax +..B1.21: + fldt 8(%ebp) + testl %eax, %eax + fldt _SP3@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + fadd %st(1), %st + fstpt 16(%esp) + fldt _CP3@GOTOFF(%ebx) + fmul %st(1), %st + fmulp %st, %st(1) + faddl _ones@GOTOFF(%ebx) + fstpt 32(%esp) + je ..B1.23 +..B1.22: + fldcw 62(%esp) +..B1.23: + fldt 16(%esp) + fstpt (%edi) + fldt 32(%esp) + fstpt (%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.24: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.79 +..B1.26: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.27: + fldcw 60(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_SP2@GOTOFF(%ebx) + fmul %st(1), %st + fldt _SP2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 12+_CP2@GOTOFF(%ebx) + fmul %st(1), %st + fldt _CP2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddl _ones@GOTOFF(%ebx) + fstpt 32(%esp) + je ..B1.31 +..B1.30: + fldcw 62(%esp) +..B1.31: + fldt 16(%esp) + fstpt (%edi) + fldt 32(%esp) + fstpt (%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.32: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.33: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.81 +..B1.34: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.35: + fldcw 60(%esp) +..B1.36: + movl $1, %eax +..B1.37: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 36+_SP1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_SP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_SP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _SP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 36+_CP1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_CP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_CP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _CP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddl _ones@GOTOFF(%ebx) + fstpt 16(%esp) + je ..B1.39 +..B1.38: + fldcw 62(%esp) +..B1.39: + fldt 32(%esp) + fstpt (%edi) + fldt 16(%esp) + fstpt (%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.40: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.84 +..B1.42: + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.43: + fldcw 60(%esp) +..B1.44: + movzwl 16(%ebp), %eax + movl $1, 28(%esp) + andl $32767, %eax +..B1.45: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + movl %edx, 44(%esp) + cmpl $16413, %eax + jge ..B1.52 +..B1.46: + fldt 8(%ebp) + fldl _Pi4Inv@GOTOFF(%ebx) + fxch %st(1) + fmull _ones@GOTOFF(%ebx,%edx,8) + fmul %st, %st(1) + fxch %st(1) + fstpt 32(%esp) + movzwl 40(%esp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.48 +..B1.47: + fldl _TWO_52H@GOTOFF(%ebx) + xorl %edx, %edx + fmul %st(1), %st + fstpt 16(%esp) + fldt 16(%esp) + fld %st(1) + movl $1, 12(%esp) + fadd %st(1), %st + fsubp %st, %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fld %st(1) + fsubp %st, %st(1) + fxch %st(1) + jmp ..B1.63 +..B1.48: + fldl _TWO_32H@GOTOFF(%ebx) + negl %ecx + addl $30, %ecx + movl 36(%esp), %edx + shrl %cl, %edx + lea 1(%edx), %ecx + movl %ecx, 12(%esp) + andl $-2, %ecx + movl %ecx, 16(%esp) + cmpl $16400, %eax + fildl 16(%esp) + jge ..B1.50 +..B1.49: + fldl _Pi04x3@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x3@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmull 16+_Pi04x3@GOTOFF(%ebx) + fld %st(0) + fsubr %st(2), %st + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(2) + fsubrp %st, %st(1) + faddp %st, %st(1) + jmp ..B1.51 +..B1.50: + fldl _Pi04x5@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x5@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 24+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + fmull 32+_Pi04x5@GOTOFF(%ebx) + fld %st(0) + fsubr %st(2), %st + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(2) + fsubrp %st, %st(1) + faddp %st, %st(1) +..B1.51: + fldl _TWO_52H@GOTOFF(%ebx) + addl $3, %edx + fldt 16(%esp) + fmul %st, %st(1) + fld %st(1) + movl 12(%esp), %eax + fadd %st(1), %st + shrl $2, %eax + fsubp %st, %st(2) + movl 44(%esp), %ecx + fsub %st(1), %st + xorl %eax, %ecx + fadd %st, %st(2) + shrl $2, %edx + fld %st(1) + andl $1, %ecx + movl %ecx, 44(%esp) + andl $1, %edx + fadd %st(3), %st + fxch %st(2) + fstpt 64(%esp) + fstpt 16(%esp) + jmp ..B1.63 +..B1.52: + cmpl $32767, %eax + jne ..B1.61 +..B1.53: + cmpl $-2147483648, 12(%ebp) + jne ..B1.56 +..B1.54: + cmpl $0, 8(%ebp) + jne ..B1.56 +..B1.55: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt 16(%esp) + jmp ..B1.57 +..B1.56: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt 16(%esp) +..B1.57: + cmpl $0, 28(%esp) + je ..B1.59 +..B1.58: + fldcw 62(%esp) +..B1.59: + fldt 16(%esp) + fstpt (%edi) + fldt (%edi) + fstpt (%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.60: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + fldt 8(%ebp) + addl $-32, %esp + movl %edx, %eax + lea 160(%esp), %edx + fmull _ones@GOTOFF(%ebx,%eax,8) + fstpt (%esp) + movl $0, 12(%esp) + movl %edx, 16(%esp) + call __libm_reduce_pi04l +..B1.87: + movl %eax, %edx + addl $32, %esp +..B1.62: + fldl 128(%esp) + lea 1(%edx), %eax + fldl _TWO_52H@GOTOFF(%ebx) + addl $3, %edx + fmul %st(1), %st + fld %st(0) + movl %eax, 12(%esp) + fadd %st(2), %st + shrl $2, %eax + fsubp %st, %st(1) + movl 44(%esp), %ecx + fsubr %st, %st(1) + xorl %eax, %ecx + shrl $2, %edx + andl $1, %ecx + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + andl $1, %edx + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fldl 136(%esp) + movl %ecx, 44(%esp) + faddp %st, %st(2) + fadd %st(1), %st +..B1.63: + fldt 64(%esp) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(0), %st + fld %st(0) + fld %st(1) + fxch %st(5) + fstpt 80(%esp) + fldt 80(%esp) + fmul %st(4), %st + movl 44(%esp), %eax + faddp %st, %st(3) + fld %st(2) + fld %st(2) + fmul %st(3), %st + fxch %st(2) + fadd %st(4), %st + fmul %st, %st(1) + fxch %st(4) + fmul %st, %st(6) + testb $2, 12(%esp) + fxch %st(1) + faddp %st, %st(6) + fxch %st(4) + fstpt 96(%esp) + fldt 96+_SP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 84+_SP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_CP@GOTOFF(%ebx) + fmul %st(4), %st + fldt 84+_CP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 72+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 72+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 60+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fld %st(5) + fldt 120+_SP@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmul %st(2), %st + fldt 120+_CP@GOTOFF(%ebx) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(5) + fxch %st(6) + fstpt 112(%esp) + fld %st(4) + fldt 108+_SP@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 108+_SP@GOTOFF(%ebx) + fmul %st(3), %st + faddp %st, %st(6) + fld %st(5) + fadd %st(1), %st + fldt 108+_CP@GOTOFF(%ebx) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(5) + fxch %st(5) + fmulp %st, %st(3) + fldt 112(%esp) + fmulp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fldl _TWO_53H@GOTOFF(%ebx) + fld %st(0) + fmul %st(6), %st + fadd %st, %st(6) + fsubrp %st, %st(6) + fxch %st(5) + fsubr %st, %st(6) + fxch %st(6) + faddp %st, %st(3) + fmul %st, %st(4) + fadd %st(4), %st + fsubp %st, %st(4) + fld %st(3) + fxch %st(1) + fsub %st(4), %st + faddp %st, %st(3) + fldt 80(%esp) + fmul %st(5), %st + fldt 96(%esp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 64(%esp) + fmul %st, %st(5) + fld %st(0) + fadd %st(6), %st + fstpt 48(%esp) + fldt 48(%esp) + fsubrp %st, %st(1) + faddp %st, %st(5) + fldl _ones@GOTOFF(%ebx) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 80(%esp) + faddp %st, %st(1) + faddp %st, %st(3) + fldl _ones@GOTOFF(%ebx,%eax,8) + fldl _ones@GOTOFF(%ebx,%edx,8) + je ..B1.65 +..B1.64: + fxch %st(1) + fmul %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st, %st(2) + fldt 48(%esp) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%esp) + fstpt 64(%esp) + jmp ..B1.66 +..B1.65: + fldt 48(%esp) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fxch %st(2) + fmul %st(3), %st + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fstpt 64(%esp) + fstpt 48(%esp) +..B1.66: + cmpl $0, 28(%esp) + je ..B1.68 +..B1.67: + fldt 16(%esp) + fstpt 32(%esp) +..B1.88: + fldcw 62(%esp) +..B1.68: + fldt 64(%esp) + fstpt (%edi) + fldt 48(%esp) + fstpt (%esi) + movl 144(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.69: + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.70: + call __stack_chk_fail@PLT +..B1.71: + cmpl $0, 12(%ebp) + jne ..B1.73 +..B1.72: + cmpl $0, 8(%ebp) + je ..B1.74 +..B1.73: + fldt _small_value_80@GOTOFF(%ebx) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + movzbl 17(%ebp), %ecx + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ebx) + andl $128, %ecx + shrl $7, %ecx + fstpt 16(%esp) + fldl _ones@GOTOFF(%ebx) + fsub %st(1), %st + fstpt 32(%esp) + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %eax + fldt _small_value_80@GOTOFF(%ebx,%eax) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.13 +..B1.74: + fldt 8(%ebp) + fstpt 16(%esp) + fldl _ones@GOTOFF(%ebx) + fstpt 32(%esp) + jmp ..B1.13 +..B1.75: + xorl %edx, %edx + jmp ..B1.11 +..B1.77: + xorl %eax, %eax + jmp ..B1.21 +..B1.79: + xorl %eax, %eax + jmp ..B1.29 +..B1.81: + xorl %eax, %eax + jmp ..B1.37 +..B1.84: + movl $0, 28(%esp) + jmp ..B1.45 + .align 16,0x90 + .type sincosl,@function + .size sincosl,.-sincosl + .data +# -- End sincosl + .section .rodata, "a" + .align 16 + .align 16 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_SP3: + .word 17476 + .word 43656 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .type _SP3,@object + .size _SP3,12 + .space 4, 0x00 # pad + .align 16 +_CP3: + .word 0 + .word 65450 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .type _CP3,@object + .size _CP3,12 + .space 4, 0x00 # pad + .align 16 +_SP2: + .word 43210 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 1587 + .word 57422 + .word 34932 + .word 34952 + .word 16376 + .word 0 + .type _SP2,@object + .size _SP2,24 + .space 8, 0x00 # pad + .align 16 +_CP2: + .word 63855 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 18238 + .word 17476 + .word 43656 + .word 43690 + .word 16378 + .word 0 + .type _CP2,@object + .size _CP2,24 + .space 8, 0x00 # pad + .align 16 +_SP1: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 12518 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 43088 + .word 7396 + .word 207 + .word 53261 + .word 49138 + .word 0 + .word 55827 + .word 48618 + .word 3602 + .word 47342 + .word 16364 + .word 0 + .type _SP1,@object + .size _SP1,48 + .align 16 +_CP1: + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 47533 + .word 43689 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 14131 + .word 49466 + .word 24756 + .word 46603 + .word 49141 + .word 0 + .word 37142 + .word 18013 + .word 35855 + .word 53259 + .word 16367 + .word 0 + .type _CP1,@object + .size _CP1,48 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .space 8, 0x00 # pad + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_Pi04x3: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _Pi04x3,@object + .size _Pi04x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi04x5: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _Pi04x5,@object + .size _Pi04x5,40 + .space 8, 0x00 # pad + .align 16 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .type _SP,@object + .size _SP,132 + .space 12, 0x00 # pad + .align 16 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .type _CP,@object + .size _CP,132 + .space 12, 0x00 # pad + .align 16 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sindl.S b/external/sgx_libm/ia32/sindl.S new file mode 100644 index 0000000000..2da756f394 --- /dev/null +++ b/external/sgx_libm/ia32/sindl.S @@ -0,0 +1,871 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sindl.c" + .text +..TXTST0: +# -- Begin sindl + .text + .align 16,0x90 + .globl sindl +sindl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp +..B1.2: + fnstcw 30(%esp) +..B1.3: + movzwl 30(%esp), %edx + movl %edx, %eax + andl $3840, %eax + cmpl $768, %eax + je ..B1.53 +..B1.4: + andl $-3841, %edx + orl $-64768, %edx + movw %dx, 28(%esp) +..B1.5: + fldcw 28(%esp) +..B1.6: + movl $1, %edi +..B1.7: + movzbl 17(%ebp), %esi + movzwl 16(%ebp), %ecx + andl $128, %esi + andl $32767, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + shrl $7, %esi + movl %eax, 12(%esp) + cmpl $16446, %ecx + jge ..B1.26 +..B1.8: + cmpl $16318, %ecx + jge ..B1.19 +..B1.9: + fldt 8(%ebp) + movl %eax, %edx + fstpt 16(%esp) + fldt 16(%esp) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fucompp + fnstsw %ax + sahf + jp ..B1.10 + je ..B1.43 +..B1.10: + testl %ecx, %ecx + jle ..B1.16 +..B1.11: + cmpl $6, %ecx + jge ..B1.15 +..B1.12: + fldt 16(%esp) + testl %edi, %edi + movl %edx, %eax + fabs + fldt _TWO5600@GOTOFF(%eax) + fmulp %st, %st(1) + fld %st(0) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_53H@GOTOFF(%eax) + fmul %st(1), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fldl 8+_sindl_mp_poly_coeff@GOTOFF(%eax) + fmulp %st, %st(2) + fldl _sindl_mp_poly_coeff@GOTOFF(%eax) + fmul %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(2) + flds ones@GOTOFF(%eax,%esi,4) + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt fBreaker@GOTOFF(%eax) + fmul %st(1), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fsub %st(1), %st + faddp %st, %st(2) + fldt 12+_TWO5600@GOTOFF(%eax) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt (%esp) + fldt _Underflow@GOTOFF(%eax) + fldt .L_2il0floatpacket.5@GOTOFF(%eax) + fmulp %st, %st(1) + fstpt 60(%esp) + je ..B1.14 +..B1.13: + fldcw 30(%esp) +..B1.14: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.15: + je ..B1.40 +..B1.16: + fldt 16(%esp) + testl %edi, %edi + movl %edx, %eax + fabs + fldt _TWO5600@GOTOFF(%eax) + fmulp %st, %st(1) + fld %st(0) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_53H@GOTOFF(%eax) + fmul %st(1), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fldl 8+_sindl_mp_poly_coeff@GOTOFF(%eax) + fmulp %st, %st(2) + fldl _sindl_mp_poly_coeff@GOTOFF(%eax) + fmul %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(2) + flds ones@GOTOFF(%eax,%esi,4) + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt fBreaker@GOTOFF(%eax) + fmul %st(1), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fsub %st(1), %st + faddp %st, %st(2) + faddp %st, %st(1) + fldt 12+_TWO5600@GOTOFF(%eax) + fmulp %st, %st(1) + fstpt (%esp) + je ..B1.18 +..B1.17: + fldcw 30(%esp) +..B1.18: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + fldt 8(%ebp) + movl %eax, %ebx + fabs + fstpt 8(%ebp) + fldt 8(%ebp) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fldt _Rcp90@GOTOFF(%ebx) + fmul %st(2), %st + fadd %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + movl 60(%esp), %edx + movl %edx, %ecx + andl $2, %ecx + fsubp %st, %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fmulp %st, %st(1) + shrl $1, %ecx + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + xorl %ecx, %esi + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.20 + je ..B1.46 +..B1.20: + movl %ebx, %eax + fld %st(0) + fld %st(1) + fld %st(2) + fld %st(3) + testb $1, %dl + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + fmul %st(5), %st + fsub %st, %st(4) + fsubp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fld %st(0) + fxch %st(4) + fsub %st(5), %st + fmul %st, %st(5) + fmul %st(6), %st + faddp %st, %st(5) + fldl _TWO_53H@GOTOFF(%eax) + fmul %st, %st(3) + fld %st(0) + fmul %st(2), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + fxch %st(1) + fsub %st(4), %st + faddp %st, %st(5) + fld %st(5) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fstpt 48(%esp) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + flds ones@GOTOFF(%eax,%esi,4) + fstps 12(%esp) + je ..B1.22 +..B1.21: + fstp %st(6) + fstp %st(2) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(1) + fld %st(2) + fmul %st(5), %st + fxch %st(4) + fstpt (%esp) + fldt (%esp) + fld %st(3) + fmul %st(7), %st + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(5) + fld %st(1) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fstpt 16(%esp) + fldt 16(%esp) + fsubrp %st, %st(1) + faddp %st, %st(3) + fldt 84+_cosdl_poly_coeff@GOTOFF(%eax) + fmul %st(5), %st + fldt 60+_cosdl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(5), %st + fldt 36+_cosdl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_cosdl_poly_coeff@GOTOFF(%eax) + fmul %st(6), %st + fldt 48+_cosdl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(6), %st + fldt 24+_cosdl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl 24+_cosdl_mp_poly_coeff@GOTOFF(%eax) + fmulp %st, %st(5) + faddp %st, %st(4) + fldl 8+_cosdl_mp_poly_coeff@GOTOFF(%eax) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 16+_cosdl_mp_poly_coeff@GOTOFF(%eax) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldl _cosdl_mp_poly_coeff@GOTOFF(%eax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%esp) + fmulp %st, %st(2) + fld %st(1) + fldt 16(%esp) + fmulp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + flds 12(%esp) + fld %st(0) + fldt .L_2il0floatpacket.4@GOTOFF(%eax) + fld %st(0) + fadd %st(4), %st + fmul %st, %st(2) + fsubrp %st, %st(1) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%esp) + jmp ..B1.23 +..B1.22: + fld %st(6) + fmul %st(2), %st + fstpt 16(%esp) + fld %st(4) + fmul %st(4), %st + fmul %st, %st(3) + fxch %st(6) + fmul %st(7), %st + fxch %st(4) + fstpt (%esp) + fldt 48(%esp) + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fld %st(5) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fldt 96+_sindl_poly_coeff@GOTOFF(%eax) + fmul %st(2), %st + fldt 72+_sindl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_sindl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_sindl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 84+_sindl_poly_coeff@GOTOFF(%eax) + fmul %st(2), %st + fldt 60+_sindl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_sindl_poly_coeff@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 16(%esp) + fmul %st, %st(1) + fldl 24+_sindl_mp_poly_coeff@GOTOFF(%eax) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl 8+_sindl_mp_poly_coeff@GOTOFF(%eax) + fmulp %st, %st(5) + faddp %st, %st(4) + fldl 16+_sindl_mp_poly_coeff@GOTOFF(%eax) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldl _sindl_mp_poly_coeff@GOTOFF(%eax) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldt (%esp) + fmulp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + flds 12(%esp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%esp) +..B1.23: + testl %edi, %edi + je ..B1.25 +..B1.24: + fldcw 30(%esp) +..B1.25: + fldt 32(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.26: + cmpl $32767, %ecx + je ..B1.52 +..B1.27: + lea -16446(%ecx), %eax + movl %eax, (%esp) + cmpl $14, %eax + jle ..B1.29 +..B1.28: + addl $-16449, %ecx + movl $715827883, %eax + imull %ecx + movl %ecx, %ebx + sarl $1, %edx + sarl $31, %ebx + subl %ebx, %edx + lea (,%edx,8), %ebx + lea (%ebx,%edx,4), %eax + subl %eax, %ecx + lea 3(%ecx), %ecx + movl %ecx, (%esp) +..B1.29: + movl 12(%ebp), %ecx + movl %ecx, %ebx + shll $8, %ebx + movl $381774871, %eax + movl %ebx, %edx + andl $-16777216, %ecx + shrl $3, %edx + mull %edx + shrl $2, %edx + imull $-360, %edx, %eax + movl %ecx, %edx + shrl $19, %ecx + addl %eax, %ebx + movl $381774871, %eax + shrl $16, %edx + movl %edx, 4(%esp) + mull %ecx + shrl $2, %edx + imull $-360, %edx, %ecx + movl 4(%esp), %eax + addl %ecx, %eax + movl 8(%ebp), %ecx + movl %ecx, %edx + shrl $3, %edx + addl %eax, %ebx + movl $381774871, %eax + mull %edx + shrl $2, %edx + imull $-360, %edx, %eax + addl %eax, %ecx + movl $-1240768329, %eax + addl %ecx, %ebx + movl (%esp), %ecx + shll %cl, %ebx + imull %ebx + addl %ebx, %edx + movl %ebx, %ecx + sarl $8, %edx + sarl $31, %ecx + subl %ecx, %edx + imull $-360, %edx, %eax + addl %eax, %ebx + cmpl $180, %ebx + jl ..B1.31 +..B1.30: + addl $-180, %ebx + movl $2, %eax + jmp ..B1.32 +..B1.31: + xorl %eax, %eax +..B1.32: + cmpl $90, %ebx + jl ..B1.34 +..B1.33: + incl %eax + addl $-90, %ebx +..B1.34: + movl %eax, %edx + movl %eax, %ecx + andl $2, %edx + shrl $1, %edx + xorl %edx, %esi + orl %ebx, %ecx + je ..B1.36 +..B1.35: + andl $1, %eax + shll $4, %eax + shll $5, %ebx + addl %ebx, %eax + movl 12(%esp), %edx + fldl __libm_sindl_cosdl_table@GOTOFF(%eax,%edx) + faddl 8+__libm_sindl_cosdl_table@GOTOFF(%edx,%eax) + fmuls ones@GOTOFF(%edx,%esi,4) + fstpt (%esp) + jmp ..B1.37 +..B1.36: + movl 12(%esp), %eax + fldt .L_2il0floatpacket.0@GOTOFF(%eax) + fstpt (%esp) +..B1.37: + testl %edi, %edi + je ..B1.39 +..B1.38: + fldcw 30(%esp) +..B1.39: + fldt (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.40: + movl 12(%ebp), %eax + cmpl $-449912621, %eax + jb ..B1.12 +..B1.41: + jne ..B1.16 +..B1.42: + cmpl $504348098, 8(%ebp) + jbe ..B1.12 + jmp ..B1.16 +..B1.43: + testl %edi, %edi + je ..B1.45 +..B1.44: + fldcw 30(%esp) +..B1.45: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + fstp %st(0) + testb $1, %dl + je ..B1.48 +..B1.47: + movl %ebx, %eax + flds ones@GOTOFF(%eax,%esi,4) + fstps (%esp) + jmp ..B1.49 +..B1.48: + fldz + fstps (%esp) +..B1.49: + testl %edi, %edi + je ..B1.51 +..B1.50: + fldcw 30(%esp) +..B1.51: + flds (%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.52: + fldt 8(%ebp) + fldt .L_2il0floatpacket.0@GOTOFF(%eax) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.37 +..B1.53: + xorl %edi, %edi + jmp ..B1.7 + .align 16,0x90 + .type sindl,@function + .size sindl,.-sindl + .data +# -- End sindl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3e,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x05,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 16 +_sindl_mp_poly_coeff: + .long 2723323193 + .long 1066524486 + .long 2863989530 + .long 1008058840 + .long 227815288 + .long 3199056770 + .long 3752327299 + .long 3142458725 + .type _sindl_mp_poly_coeff,@object + .size _sindl_mp_poly_coeff,32 + .align 16 +_Underflow: + .word 1 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _Underflow,@object + .size _Underflow,12 + .space 4, 0x00 # pad + .align 16 +_cosdl_poly_coeff: + .word 52350 + .word 41213 + .word 3800 + .word 40885 + .word 49138 + .word 0 + .word 28613 + .word 7908 + .word 35668 + .word 34008 + .word 16355 + .word 0 + .word 19927 + .word 58728 + .word 49885 + .word 45261 + .word 49106 + .word 0 + .word 32884 + .word 22035 + .word 23267 + .word 64541 + .word 16320 + .word 0 + .word 36401 + .word 51897 + .word 8309 + .word 57265 + .word 49070 + .word 0 + .word 34286 + .word 2728 + .word 41564 + .word 34642 + .word 16284 + .word 0 + .word 63248 + .word 18030 + .word 35596 + .word 60796 + .word 49032 + .word 0 + .word 52149 + .word 21294 + .word 63985 + .word 40123 + .word 16245 + .word 0 + .type _cosdl_poly_coeff,@object + .size _cosdl_poly_coeff,96 + .align 16 +_cosdl_mp_poly_coeff: + .long 3675529145 + .long 3206805153 + .long 2134983071 + .long 3151100167 + .long 1787026573 + .long 1043372817 + .long 205083639 + .long 988746860 + .type _cosdl_mp_poly_coeff,@object + .size _cosdl_mp_poly_coeff,32 + .align 16 +_sindl_poly_coeff: + .word 51374 + .word 38121 + .word 13586 + .word 36602 + .word 16377 + .word 0 + .word 50116 + .word 41339 + .word 4204 + .word 60892 + .word 49130 + .word 0 + .word 33704 + .word 2155 + .word 42839 + .word 60780 + .word 16346 + .word 0 + .word 21250 + .word 19076 + .word 27901 + .word 57780 + .word 49097 + .word 0 + .word 9076 + .word 49244 + .word 613 + .word 64083 + .word 16311 + .word 0 + .word 40572 + .word 30418 + .word 36251 + .word 46520 + .word 49061 + .word 0 + .word 3227 + .word 25505 + .word 5540 + .word 47626 + .word 16274 + .word 0 + .word 60933 + .word 3300 + .word 57416 + .word 36218 + .word 49023 + .word 0 + .word 45811 + .word 42646 + .word 37125 + .word 42185 + .word 16235 + .word 0 + .type _sindl_poly_coeff,@object + .size _sindl_poly_coeff,108 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +fBreaker: + .byte 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x80,0x13,0x40,0x00,0x00 + .type fBreaker,@object + .size fBreaker,12 + .align 2 +_TWO5600: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 21983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 10783 + .word 0 + .type _TWO5600,@object + .size _TWO5600,24 + .align 2 +_Rcp90: + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 16376 + .word 0 + .type _Rcp90,@object + .size _Rcp90,12 + .data + .hidden __libm_sindl_cosdl_table + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinf_wmt.S b/external/sgx_libm/ia32/sinf_wmt.S new file mode 100644 index 0000000000..ddf67be8a9 --- /dev/null +++ b/external/sgx_libm/ia32/sinf_wmt.S @@ -0,0 +1,585 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sinf + .text + .align 16,0x90 + .globl sinf +sinf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 36(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movl 112(%esp), %ecx + subl $16, %esp + stmxcsr 4(%esp) + movl 4(%esp), %eax + andl $-24577, %eax + cmpl %eax, 4(%esp) + jne .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + movapd %xmm0, %xmm1 + cvtps2pd %xmm1, %xmm1 + movsd 1296(%ebx), %xmm2 + movl $2147483647, %eax + movl $1241513983, %edx + andl %ecx, %eax + subl %eax, %edx + subl $964689920, %eax + orl %eax, %edx + jl .L_2TAG_PACKET_2.0.2 + movsd 1312(%ebx), %xmm4 + mulsd %xmm1, %xmm2 + movsd 1328(%ebx), %xmm3 + movapd %xmm2, %xmm5 + addsd %xmm4, %xmm2 + movd %xmm2, %ecx + subsd %xmm4, %xmm2 + mulsd %xmm3, %xmm1 +.L_2TAG_PACKET_3.0.2: + movl $384, %eax + movsd 1344(%ebx), %xmm4 + subsd %xmm2, %xmm5 + addl %ecx, %ecx + movl %ecx, %edx + shll $24, %ecx + sarl $31, %ecx + andl %edx, %eax + addl %ecx, %edx + xorl %ecx, %edx + addsd %xmm5, %xmm1 + andl $254, %edx + movsd (%ebx,%edx,8), %xmm3 + movsd 1352(%ebx), %xmm0 + pshufd $68, %xmm1, %xmm2 + mulsd %xmm1, %xmm1 + movsd 8(%ebx,%edx,8), %xmm5 + movl %eax, %ecx + addl $128, %ecx + andl $256, %ecx + shll $23, %ecx + mulsd %xmm2, %xmm3 + movd %ecx, %xmm2 + subsd %xmm1, %xmm0 + andl $256, %eax + shll $23, %eax + subsd %xmm1, %xmm4 + psllq $32, %xmm2 + movd %eax, %xmm1 + xorpd %xmm2, %xmm4 + mulsd %xmm5, %xmm0 + mulsd %xmm4, %xmm3 + psllq $32, %xmm1 + xorpd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_4.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_4.0.2: + cvtpd2ps %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_2.0.2: + andl $2147483647, %ecx + cmpl $1040187392, %ecx + ja .L_2TAG_PACKET_6.0.2 + cvtss2sd %xmm0, %xmm0 + mulsd 1280(%ebx), %xmm0 + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_7.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_7.0.2: + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_0.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + movl %eax, 8(%esp) + ldmxcsr 8(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_6.0.2: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_8.0.2 + shrl $23, %ecx + subl $142, %ecx + andl $65528, %ecx + movsd 1040(%ebx,%ecx,2), %xmm3 + movsd 1048(%ebx,%ecx,2), %xmm5 + movsd 1360(%ebx), %xmm2 + xorpd %xmm4, %xmm4 + movl $17208, %eax + pinsrw $3, %eax, %xmm4 + andpd %xmm3, %xmm2 + psllq $40, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + movapd %xmm2, %xmm0 + addsd %xmm3, %xmm2 + movapd %xmm2, %xmm5 + subsd %xmm2, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm0, %xmm3 + movd %xmm2, %ecx + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_8.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_9.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_9.0.2: + subss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) +.L_2TAG_PACKET_5.0.2: + addl $16, %esp + movl 36(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sinf,@function + .size sinf,.-sinf + .data +# -- End sinf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 3861233235 + .long 1053076412 + .long 0 + .long 0 + .long 3836476539 + .long 1053076004 + .long 1466910230 + .long 1054802127 + .long 522802171 + .long 1053074781 + .long 1693671239 + .long 1055850091 + .long 1381230637 + .long 1053072742 + .long 3419039295 + .long 1056390099 + .long 3096463640 + .long 1053069889 + .long 3054827835 + .long 1056896220 + .long 163641427 + .long 1053066225 + .long 3381119115 + .long 1057182863 + .long 2063766514 + .long 1053061750 + .long 544295963 + .long 1057434550 + .long 3193221610 + .long 1053056468 + .long 3297207428 + .long 1057685321 + .long 36665700 + .long 1053050383 + .long 2811721921 + .long 1057935027 + .long 4043704933 + .long 1053043496 + .long 2950925715 + .long 1058098350 + .long 2964703016 + .long 1053035814 + .long 2674059679 + .long 1058221912 + .long 3789723003 + .long 1053027340 + .long 879820317 + .long 1058344717 + .long 2671784286 + .long 1053018080 + .long 1979618421 + .long 1058466690 + .long 2093526290 + .long 1053008039 + .long 3945677176 + .long 1058587758 + .long 2262842797 + .long 1052997223 + .long 2796081240 + .long 1058707849 + .long 1097233945 + .long 1052985639 + .long 1373383079 + .long 1058826890 + .long 2796885356 + .long 1052973293 + .long 941816458 + .long 1058944809 + .long 646746141 + .long 1052960194 + .long 1372808103 + .long 1059061535 + .long 2767093429 + .long 1052946348 + .long 664370609 + .long 1059119379 + .long 2028347177 + .long 1052931765 + .long 1369913724 + .long 1059176444 + .long 1799297257 + .long 1052916453 + .long 3344537919 + .long 1059232808 + .long 3039475318 + .long 1052900421 + .long 2500108843 + .long 1059288438 + .long 4275292648 + .long 1052883679 + .long 944109265 + .long 1059343300 + .long 1575056534 + .long 1052866238 + .long 2771364651 + .long 1059397360 + .long 1407782048 + .long 1052848107 + .long 1264637048 + .long 1059450587 + .long 3436142021 + .long 1052829297 + .long 453708735 + .long 1059502948 + .long 488211833 + .long 1052809821 + .long 2313428161 + .long 1059554411 + .long 2993330 + .long 1052789689 + .long 2550341159 + .long 1059604946 + .long 755484892 + .long 1052767523 + .long 3567792879 + .long 1059654522 + .long 3348027550 + .long 1052724710 + .long 1659779181 + .long 1059703110 + .long 2580634211 + .long 1052680662 + .long 4268074870 + .long 1059750679 + .long 742418353 + .long 1052635405 + .long 4288148241 + .long 1059797202 + .long 3250975870 + .long 1052588965 + .long 1618129506 + .long 1059842651 + .long 1401987205 + .long 1052541372 + .long 3231311734 + .long 1059886997 + .long 2361617751 + .long 1052492653 + .long 1772140623 + .long 1059930215 + .long 3322544997 + .long 1052442838 + .long 1395127179 + .long 1059972278 + .long 17970311 + .long 1052391958 + .long 652328457 + .long 1060013161 + .long 3823857331 + .long 1052340041 + .long 1148832537 + .long 1060052839 + .long 3024934267 + .long 1052287121 + .long 3311502568 + .long 1060091288 + .long 1388494065 + .long 1052233229 + .long 1077921708 + .long 1060119411 + .long 902054988 + .long 1052178397 + .long 115411415 + .long 1060137373 + .long 1689375324 + .long 1052122658 + .long 3838419993 + .long 1060154686 + .long 1925003623 + .long 1052066046 + .long 1813501338 + .long 1060171342 + .long 2042383238 + .long 1052008595 + .long 2490283769 + .long 1060187329 + .long 350661592 + .long 1051950340 + .long 3162654741 + .long 1060202638 + .long 1535093810 + .long 1051891315 + .long 2878576948 + .long 1060217260 + .long 3681356269 + .long 1051831556 + .long 2463945945 + .long 1060231186 + .long 2478530408 + .long 1051771100 + .long 250409509 + .long 1060244408 + .long 3726787968 + .long 1051698237 + .long 687004205 + .long 1060256917 + .long 2082609563 + .long 1051574753 + .long 1475857720 + .long 1060268706 + .long 1666812989 + .long 1051450094 + .long 2181617495 + .long 1060279768 + .long 2865853451 + .long 1051324335 + .long 4249822861 + .long 1060290096 + .long 321119318 + .long 1051197553 + .long 2434209605 + .long 1060299685 + .long 4207787592 + .long 1051069822 + .long 1992674941 + .long 1060308528 + .long 1382541649 + .long 1050941222 + .long 1522351063 + .long 1060316620 + .long 2429158325 + .long 1050811828 + .long 1563320407 + .long 1060323956 + .long 2803392399 + .long 1050681719 + .long 316258674 + .long 1060330532 + .long 3917367244 + .long 1050428795 + .long 2243801771 + .long 1060336343 + .long 1991825541 + .long 1050166188 + .long 900924147 + .long 1060341387 + .long 624330694 + .long 1049902623 + .long 418831766 + .long 1060345660 + .long 3087185898 + .long 1049638258 + .long 2627920248 + .long 1060349159 + .long 3670374716 + .long 1049121932 + .long 2769466396 + .long 1060351883 + .long 3431923622 + .long 1048590963 + .long 2385983684 + .long 1060353830 + .long 918535681 + .long 1047542708 + .long 735532773 + .long 1060354999 + .long 0 + .long 0 + .long 3384690142 + .long 1060355388 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1916669064 + .long 1072155675 + .long 660066805 + .long 1024797180 + .long 3829231700 + .long 1062745828 + .long 2884172442 + .long 1017445907 + .long 540874025 + .long 1055617650 + .long 4198409884 + .long 1011844330 + .long 2839315448 + .long 1046639136 + .long 4204424928 + .long 1000582120 + .long 1329339431 + .long 1038229673 + .long 1295478839 + .long 993391741 + .long 658191860 + .long 1024797180 + .long 3691886121 + .long 979325773 + .long 1966800710 + .long 1020436418 + .long 1882642597 + .long 977095991 + .long 2100977488 + .long 1012908661 + .long 1840335565 + .long 967470816 + .long 4198093645 + .long 1000582120 + .long 3307942521 + .long 957055414 + .long 2839123165 + .long 996851343 + .long 1387472776 + .long 952638316 + .long 2788761024 + .long 988712873 + .long 3005712498 + .long 944467026 + .long 3694676832 + .long 979325773 + .long 1326507024 + .long 934847846 + .long 221775557 + .long 970149340 + .long 1133527550 + .long 924162364 + .long 4286578688 + .long 1072693247 + .long 0 + .long 0 + .long 1845493760 + .long 1078222640 + .long 0 + .long 0 + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 2908765579 + .long 3193641918 + .long 0 + .long 0 + .long 2308576600 + .long 1086551075 + .long 1646446368 + .long 1084878895 + .long 4278190080 + .long 4294967295 + .long 0 + .long 0 + .type static_const_table,@object + .size static_const_table,1376 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinh_wmt.S b/external/sgx_libm/ia32/sinh_wmt.S new file mode 100644 index 0000000000..9dbe63d099 --- /dev/null +++ b/external/sgx_libm/ia32/sinh_wmt.S @@ -0,0 +1,1404 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sinh + .text + .align 16,0x90 + .globl sinh +sinh: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 4272(%ebx), %xmm3 + xorpd %xmm4, %xmm4 + movsd 4192(%ebx), %xmm1 + movsd 4200(%ebx), %xmm2 + movl $32768, %eax + pinsrw $3, %eax, %xmm4 + movsd 4096(%ebx), %xmm6 + pextrw $3, %xmm0, %ecx + andpd %xmm0, %xmm3 + andnpd %xmm0, %xmm4 + pshufd $68, %xmm4, %xmm5 + movl $32768, %edx + andl %ecx, %edx + andl $32767, %ecx + subl $16343, %ecx + cmpl $177, %ecx + jae .L_2TAG_PACKET_0.0.3 + subsd %xmm3, %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm2 + cvtsd2si %xmm3, %eax + shll $3, %edx + orl %edx, %eax + movapd %xmm3, %xmm7 + addsd %xmm6, %xmm3 + mulsd %xmm4, %xmm1 + xorpd %xmm5, %xmm5 + subsd %xmm6, %xmm3 + movapd 4112(%ebx), %xmm4 + addsd %xmm1, %xmm2 + movapd 4128(%ebx), %xmm6 + subsd %xmm3, %xmm7 + movl $32704, %edx + pinsrw $3, %edx, %xmm5 + movapd 4144(%ebx), %xmm1 + addsd %xmm7, %xmm2 + movl $127, %edx + andl %eax, %edx + addl %edx, %edx + shrl $3, %eax + andl $65520, %eax + addl $16352, %eax + xorpd %xmm0, %xmm0 + cmpl $161, %ecx + jae .L_2TAG_PACKET_1.0.3 + pshufd $68, %xmm5, %xmm5 + pinsrw $3, %eax, %xmm0 + pshufd $68, %xmm0, %xmm0 + psubw %xmm0, %xmm5 + mulpd (%ebx,%edx,8), %xmm0 + mulpd 2048(%ebx,%edx,8), %xmm5 + pshufd $68, %xmm2, %xmm3 + movapd 4160(%ebx), %xmm7 + pshufd $68, %xmm2, %xmm2 + mulpd %xmm3, %xmm3 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm6 + mulpd 4176(%ebx), %xmm2 + mulpd %xmm3, %xmm1 + mulpd %xmm3, %xmm7 + mulpd %xmm3, %xmm4 + mulpd %xmm3, %xmm1 + addpd %xmm7, %xmm6 + movapd %xmm0, %xmm7 + addpd %xmm1, %xmm4 + shufpd $0, %xmm5, %xmm7 + subpd %xmm5, %xmm0 + mulpd %xmm7, %xmm2 + addpd %xmm6, %xmm4 + subsd %xmm0, %xmm7 + mulpd %xmm2, %xmm4 + pshufd $238, %xmm0, %xmm6 + subsd %xmm5, %xmm7 + addpd %xmm2, %xmm4 + addsd %xmm6, %xmm7 + pshufd $238, %xmm4, %xmm2 + addsd %xmm7, %xmm2 + addsd %xmm4, %xmm2 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + subl $16352, %eax + movl %eax, %ecx + andl $32752, %eax + shrl $1, %eax + andl $65520, %eax + subl %eax, %ecx + addl $16352, %eax + pinsrw $3, %eax, %xmm0 + pshufd $68, %xmm0, %xmm0 + mulpd (%ebx,%edx,8), %xmm0 + pshufd $68, %xmm2, %xmm3 + movsd 4160(%ebx), %xmm7 + mulsd %xmm3, %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm6 + mulsd 4176(%ebx), %xmm2 + mulsd %xmm3, %xmm1 + mulsd %xmm3, %xmm7 + mulsd %xmm3, %xmm4 + addl $16368, %ecx + pinsrw $3, %ecx, %xmm5 + mulsd %xmm3, %xmm1 + addsd %xmm7, %xmm6 + addsd %xmm1, %xmm4 + mulsd %xmm0, %xmm2 + addsd %xmm6, %xmm4 + mulsd %xmm2, %xmm4 + pshufd $238, %xmm0, %xmm6 + addsd %xmm6, %xmm4 + addsd %xmm4, %xmm2 + addsd %xmm2, %xmm0 + mulsd %xmm5, %xmm0 + pextrw $3, %xmm0, %eax + andl $32752, %eax + movl $127, %edx + cmpl $32752, %eax + je .L_2TAG_PACKET_3.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + addl $16343, %ecx + cmpl $16343, %ecx + ja .L_2TAG_PACKET_4.0.3 + cmpl $15856, %ecx + jb .L_2TAG_PACKET_5.0.3 + movapd 4208(%ebx), %xmm1 + pshufd $68, %xmm0, %xmm6 + mulpd %xmm5, %xmm5 + movapd 4224(%ebx), %xmm2 + pshufd $68, %xmm0, %xmm7 + movapd 4240(%ebx), %xmm3 + pshufd $68, %xmm0, %xmm4 + andpd 4256(%ebx), %xmm6 + mulpd %xmm5, %xmm1 + mulsd %xmm5, %xmm2 + subpd %xmm6, %xmm4 + mulpd %xmm5, %xmm7 + addpd %xmm3, %xmm1 + pshufd $68, %xmm6, %xmm3 + mulpd %xmm5, %xmm5 + mulsd %xmm7, %xmm2 + mulpd %xmm7, %xmm1 + pshufd $68, %xmm0, %xmm7 + mulsd %xmm6, %xmm6 + addsd %xmm7, %xmm7 + mulsd %xmm4, %xmm4 + mulpd %xmm5, %xmm1 + addsd %xmm0, %xmm7 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm7 + pshufd $238, %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm2, %xmm3 + pshufd $238, %xmm2, %xmm2 + addsd %xmm4, %xmm7 + movapd %xmm0, %xmm4 + mulsd %xmm2, %xmm6 + mulsd %xmm5, %xmm7 + addsd %xmm6, %xmm0 + mulsd %xmm2, %xmm7 + subsd %xmm0, %xmm4 + addsd %xmm7, %xmm1 + addsd %xmm4, %xmm6 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_5.0.3: + cmpl $16, %ecx + jae .L_2TAG_PACKET_6.0.3 + movapd %xmm0, %xmm1 + mulsd %xmm1, %xmm1 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + xorpd %xmm2, %xmm2 + movl $17392, %ecx + pinsrw $3, %ecx, %xmm2 + xorpd %xmm3, %xmm3 + movl $15344, %edx + pinsrw $3, %edx, %xmm3 + mulsd %xmm0, %xmm2 + addsd %xmm2, %xmm0 + mulsd %xmm3, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $32752, %ecx + jae .L_2TAG_PACKET_7.0.3 + xorpd %xmm0, %xmm0 + movl $32736, %eax + pinsrw $3, %eax, %xmm0 + orl %edx, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + movl $127, %edx +.L_2TAG_PACKET_3.0.3: + movsd %xmm0, (%esp) + movsd 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + fldl (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_7.0.3: + xorpd %xmm1, %xmm1 + movl $32768, %eax + pinsrw $3, %eax, %xmm1 + andnpd %xmm0, %xmm1 + mulsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_2.0.3: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sinh,@function + .size sinh,.-sinh + .data +# -- End sinh + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 2851812149 + .long 1072698941 + .long 2595802551 + .long 1016815913 + .long 1048019041 + .long 1072704666 + .long 1398474845 + .long 3161559171 + .long 3899555717 + .long 1072710421 + .long 427280750 + .long 3163595548 + .long 3541402996 + .long 1072716208 + .long 2759177317 + .long 1015903202 + .long 702412510 + .long 1072722027 + .long 3803266087 + .long 3163328991 + .long 410360776 + .long 1072727877 + .long 1269990655 + .long 1013024446 + .long 3402036099 + .long 1072733758 + .long 405889334 + .long 1016154232 + .long 1828292879 + .long 1072739672 + .long 1255956747 + .long 1016636974 + .long 728909815 + .long 1072745618 + .long 383930225 + .long 1016078044 + .long 852742562 + .long 1072751596 + .long 667253586 + .long 1010842135 + .long 2952712987 + .long 1072757606 + .long 3293494651 + .long 3161168877 + .long 3490863953 + .long 1072763649 + .long 960797498 + .long 3163997456 + .long 3228316108 + .long 1072769725 + .long 3010241991 + .long 3159471380 + .long 2930322912 + .long 1072775834 + .long 2599499422 + .long 3163762623 + .long 3366293073 + .long 1072781976 + .long 3119426314 + .long 1015169130 + .long 1014845819 + .long 1072788152 + .long 3117910646 + .long 3162607681 + .long 948735466 + .long 1072794361 + .long 3516338028 + .long 3163623459 + .long 3949972341 + .long 1072800603 + .long 2068408548 + .long 1015962444 + .long 2214878420 + .long 1072806880 + .long 892270087 + .long 3164164998 + .long 828946858 + .long 1072813191 + .long 10642492 + .long 1016988014 + .long 586995997 + .long 1072819536 + .long 41662348 + .long 3163676568 + .long 2288159958 + .long 1072825915 + .long 2169144469 + .long 1015924597 + .long 2440944790 + .long 1072832329 + .long 2492769774 + .long 1015196030 + .long 1853186616 + .long 1072838778 + .long 3066496371 + .long 1016705150 + .long 1337108031 + .long 1072845262 + .long 3203724452 + .long 1015726421 + .long 1709341917 + .long 1072851781 + .long 2571168217 + .long 1015201075 + .long 3790955393 + .long 1072858335 + .long 2352942462 + .long 3164228666 + .long 4112506593 + .long 1072864925 + .long 2947355221 + .long 1015419624 + .long 3504003472 + .long 1072871551 + .long 3594001060 + .long 3158379228 + .long 2799960843 + .long 1072878213 + .long 1423655381 + .long 1016070727 + .long 2839424854 + .long 1072884911 + .long 1171596163 + .long 1014090255 + .long 171030293 + .long 1072891646 + .long 3526460132 + .long 1015477354 + .long 4232894513 + .long 1072898416 + .long 2383938684 + .long 1015717095 + .long 2992903935 + .long 1072905224 + .long 2218154406 + .long 1016276769 + .long 1603444721 + .long 1072912069 + .long 1548633640 + .long 3163249902 + .long 926591435 + .long 1072918951 + .long 3208833762 + .long 3163962090 + .long 1829099622 + .long 1072925870 + .long 1016661181 + .long 3164509581 + .long 887463927 + .long 1072932827 + .long 3596744163 + .long 3161842742 + .long 3272845541 + .long 1072939821 + .long 928852419 + .long 3164536824 + .long 1276261410 + .long 1072946854 + .long 300981948 + .long 1015732745 + .long 78413852 + .long 1072953925 + .long 4183226867 + .long 3164065827 + .long 569847338 + .long 1072961034 + .long 472945272 + .long 3160339305 + .long 3645941911 + .long 1072968181 + .long 3814685081 + .long 3162621917 + .long 1617004845 + .long 1072975368 + .long 82804944 + .long 1011391354 + .long 3978100823 + .long 1072982593 + .long 3513027190 + .long 1016894539 + .long 3049340112 + .long 1072989858 + .long 3062915824 + .long 1014219171 + .long 4040676318 + .long 1072997162 + .long 4090609238 + .long 1016712034 + .long 3577096743 + .long 1073004506 + .long 2951496418 + .long 1014842263 + .long 2583551245 + .long 1073011890 + .long 3161094195 + .long 1016655067 + .long 1990012071 + .long 1073019314 + .long 3529070563 + .long 3163861769 + .long 2731501122 + .long 1073026778 + .long 1774031855 + .long 3163518597 + .long 1453150082 + .long 1073034283 + .long 498154669 + .long 3162536638 + .long 3395129871 + .long 1073041828 + .long 4025345435 + .long 3163383964 + .long 917841882 + .long 1073049415 + .long 18715565 + .long 1016707884 + .long 3566716925 + .long 1073057042 + .long 1536826856 + .long 1015191009 + .long 3712504873 + .long 1073064711 + .long 88491949 + .long 1016476236 + .long 2321106615 + .long 1073072422 + .long 2171176610 + .long 1010584347 + .long 363667784 + .long 1073080175 + .long 813753950 + .long 1016833785 + .long 3111574537 + .long 1073087969 + .long 2606161479 + .long 3163808322 + .long 2956612997 + .long 1073095806 + .long 2118169751 + .long 3163784129 + .long 885834528 + .long 1073103686 + .long 1973258547 + .long 3163310140 + .long 2186617381 + .long 1073111608 + .long 2270764084 + .long 3164321289 + .long 3561793907 + .long 1073119573 + .long 1157054053 + .long 1012938926 + .long 1719614413 + .long 1073127582 + .long 330458198 + .long 3164331316 + .long 1963711167 + .long 1073135634 + .long 1744767757 + .long 3161622870 + .long 1013258799 + .long 1073143730 + .long 1748797611 + .long 3161177658 + .long 4182873220 + .long 1073151869 + .long 629542646 + .long 3163044879 + .long 3907805044 + .long 1073160053 + .long 2257091225 + .long 3162598983 + .long 1218806132 + .long 1073168282 + .long 1818613052 + .long 3163597017 + .long 1447192521 + .long 1073176555 + .long 1462857171 + .long 3163563097 + .long 1339972927 + .long 1073184873 + .long 167908909 + .long 1016620728 + .long 1944781191 + .long 1073193236 + .long 3993278767 + .long 3162772855 + .long 19972402 + .long 1073201645 + .long 3507899862 + .long 1017057868 + .long 919555682 + .long 1073210099 + .long 3121969534 + .long 1013996802 + .long 1413356050 + .long 1073218599 + .long 1651349291 + .long 3163716742 + .long 2571947539 + .long 1073227145 + .long 3558159064 + .long 3164425245 + .long 1176749997 + .long 1073235738 + .long 2738998779 + .long 3163084420 + .long 2604962541 + .long 1073244377 + .long 2614425274 + .long 3164587768 + .long 3649726105 + .long 1073253063 + .long 4085036346 + .long 1016698050 + .long 1110089947 + .long 1073261797 + .long 1451641639 + .long 1016523249 + .long 380978316 + .long 1073270578 + .long 854188970 + .long 3161511262 + .long 2568320822 + .long 1073279406 + .long 2732824428 + .long 1015401491 + .long 194117574 + .long 1073288283 + .long 777528612 + .long 3164460665 + .long 2966275557 + .long 1073297207 + .long 2176155324 + .long 3160891335 + .long 3418903055 + .long 1073306180 + .long 2527457337 + .long 3161869180 + .long 2682146384 + .long 1073315202 + .long 2082178513 + .long 3164411995 + .long 1892288442 + .long 1073324273 + .long 2446255666 + .long 3163648957 + .long 2191782032 + .long 1073333393 + .long 2960257726 + .long 1014791238 + .long 434316067 + .long 1073342563 + .long 2028358766 + .long 1014506698 + .long 2069751141 + .long 1073351782 + .long 1562170675 + .long 3163773257 + .long 3964284211 + .long 1073361051 + .long 2111583915 + .long 1016475740 + .long 2990417245 + .long 1073370371 + .long 3683467745 + .long 3164417902 + .long 321958744 + .long 1073379742 + .long 3401933767 + .long 1016843134 + .long 1434058175 + .long 1073389163 + .long 251133233 + .long 1016134345 + .long 3218338682 + .long 1073398635 + .long 3404164304 + .long 3163525684 + .long 2572866477 + .long 1073408159 + .long 878562433 + .long 1016570317 + .long 697153126 + .long 1073417735 + .long 1283515429 + .long 3164331765 + .long 3092190715 + .long 1073427362 + .long 814012168 + .long 3160571998 + .long 2380618042 + .long 1073437042 + .long 3149557219 + .long 3164369375 + .long 4076559943 + .long 1073446774 + .long 2119478331 + .long 3161806927 + .long 815859274 + .long 1073456560 + .long 240396590 + .long 3164536019 + .long 2420883922 + .long 1073466398 + .long 2049810052 + .long 1015168464 + .long 1540824585 + .long 1073476290 + .long 1064017011 + .long 3164536266 + .long 3716502172 + .long 1073486235 + .long 2303740125 + .long 1015091301 + .long 1610600570 + .long 1073496235 + .long 3766732298 + .long 1016808759 + .long 777507147 + .long 1073506289 + .long 4282924205 + .long 1016236109 + .long 2483480501 + .long 1073516397 + .long 1216371780 + .long 1014082748 + .long 3706687593 + .long 1073526560 + .long 3521726940 + .long 1014301643 + .long 1432208378 + .long 1073536779 + .long 1401068914 + .long 3163412539 + .long 1242007932 + .long 1073547053 + .long 1132034716 + .long 3164388407 + .long 135105010 + .long 1073557383 + .long 1906148728 + .long 3164424315 + .long 3707479175 + .long 1073567768 + .long 3613079303 + .long 1015213314 + .long 382305176 + .long 1073578211 + .long 2347622376 + .long 3163627201 + .long 64696965 + .long 1073588710 + .long 1768797490 + .long 1016865536 + .long 4076975200 + .long 1073599265 + .long 2029000899 + .long 1016257111 + .long 863738719 + .long 1073609879 + .long 1326992220 + .long 3163661773 + .long 351641897 + .long 1073620550 + .long 2172261526 + .long 3164059175 + .long 3884662774 + .long 1073631278 + .long 2158611599 + .long 1015258761 + .long 4224142467 + .long 1073642065 + .long 3389820386 + .long 1016255778 + .long 2728693978 + .long 1073652911 + .long 396109971 + .long 3164511267 + .long 764307441 + .long 1073663816 + .long 3021057420 + .long 3164378099 + .long 3999357479 + .long 1073674779 + .long 2258941616 + .long 1016973300 + .long 929806999 + .long 1073685803 + .long 3205336643 + .long 1016308133 + .long 1533953344 + .long 1073696886 + .long 769171851 + .long 1016714209 + .long 2912730644 + .long 1073708029 + .long 3490067722 + .long 3164453650 + .long 2174652632 + .long 1073719233 + .long 4087714590 + .long 1015498835 + .long 730821105 + .long 1073730498 + .long 2523232743 + .long 1013115764 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 730821105 + .long 1072681922 + .long 2523232743 + .long 1012067188 + .long 2174652632 + .long 1072670657 + .long 4087714590 + .long 1014450259 + .long 2912730644 + .long 1072659453 + .long 3490067722 + .long 3163405074 + .long 1533953344 + .long 1072648310 + .long 769171851 + .long 1015665633 + .long 929806999 + .long 1072637227 + .long 3205336643 + .long 1015259557 + .long 3999357479 + .long 1072626203 + .long 2258941616 + .long 1015924724 + .long 764307441 + .long 1072615240 + .long 3021057420 + .long 3163329523 + .long 2728693978 + .long 1072604335 + .long 396109971 + .long 3163462691 + .long 4224142467 + .long 1072593489 + .long 3389820386 + .long 1015207202 + .long 3884662774 + .long 1072582702 + .long 2158611599 + .long 1014210185 + .long 351641897 + .long 1072571974 + .long 2172261526 + .long 3163010599 + .long 863738719 + .long 1072561303 + .long 1326992220 + .long 3162613197 + .long 4076975200 + .long 1072550689 + .long 2029000899 + .long 1015208535 + .long 64696965 + .long 1072540134 + .long 1768797490 + .long 1015816960 + .long 382305176 + .long 1072529635 + .long 2347622376 + .long 3162578625 + .long 3707479175 + .long 1072519192 + .long 3613079303 + .long 1014164738 + .long 135105010 + .long 1072508807 + .long 1906148728 + .long 3163375739 + .long 1242007932 + .long 1072498477 + .long 1132034716 + .long 3163339831 + .long 1432208378 + .long 1072488203 + .long 1401068914 + .long 3162363963 + .long 3706687593 + .long 1072477984 + .long 3521726940 + .long 1013253067 + .long 2483480501 + .long 1072467821 + .long 1216371780 + .long 1013034172 + .long 777507147 + .long 1072457713 + .long 4282924205 + .long 1015187533 + .long 1610600570 + .long 1072447659 + .long 3766732298 + .long 1015760183 + .long 3716502172 + .long 1072437659 + .long 2303740125 + .long 1014042725 + .long 1540824585 + .long 1072427714 + .long 1064017011 + .long 3163487690 + .long 2420883922 + .long 1072417822 + .long 2049810052 + .long 1014119888 + .long 815859274 + .long 1072407984 + .long 240396590 + .long 3163487443 + .long 4076559943 + .long 1072398198 + .long 2119478331 + .long 3160758351 + .long 2380618042 + .long 1072388466 + .long 3149557219 + .long 3163320799 + .long 3092190715 + .long 1072378786 + .long 814012168 + .long 3159523422 + .long 697153126 + .long 1072369159 + .long 1283515429 + .long 3163283189 + .long 2572866477 + .long 1072359583 + .long 878562433 + .long 1015521741 + .long 3218338682 + .long 1072350059 + .long 3404164304 + .long 3162477108 + .long 1434058175 + .long 1072340587 + .long 251133233 + .long 1015085769 + .long 321958744 + .long 1072331166 + .long 3401933767 + .long 1015794558 + .long 2990417245 + .long 1072321795 + .long 3683467745 + .long 3163369326 + .long 3964284211 + .long 1072312475 + .long 2111583915 + .long 1015427164 + .long 2069751141 + .long 1072303206 + .long 1562170675 + .long 3162724681 + .long 434316067 + .long 1072293987 + .long 2028358766 + .long 1013458122 + .long 2191782032 + .long 1072284817 + .long 2960257726 + .long 1013742662 + .long 1892288442 + .long 1072275697 + .long 2446255666 + .long 3162600381 + .long 2682146384 + .long 1072266626 + .long 2082178513 + .long 3163363419 + .long 3418903055 + .long 1072257604 + .long 2527457337 + .long 3160820604 + .long 2966275557 + .long 1072248631 + .long 2176155324 + .long 3159842759 + .long 194117574 + .long 1072239707 + .long 777528612 + .long 3163412089 + .long 2568320822 + .long 1072230830 + .long 2732824428 + .long 1014352915 + .long 380978316 + .long 1072222002 + .long 854188970 + .long 3160462686 + .long 1110089947 + .long 1072213221 + .long 1451641639 + .long 1015474673 + .long 3649726105 + .long 1072204487 + .long 4085036346 + .long 1015649474 + .long 2604962541 + .long 1072195801 + .long 2614425274 + .long 3163539192 + .long 1176749997 + .long 1072187162 + .long 2738998779 + .long 3162035844 + .long 2571947539 + .long 1072178569 + .long 3558159064 + .long 3163376669 + .long 1413356050 + .long 1072170023 + .long 1651349291 + .long 3162668166 + .long 919555682 + .long 1072161523 + .long 3121969534 + .long 1012948226 + .long 19972402 + .long 1072153069 + .long 3507899862 + .long 1016009292 + .long 1944781191 + .long 1072144660 + .long 3993278767 + .long 3161724279 + .long 1339972927 + .long 1072136297 + .long 167908909 + .long 1015572152 + .long 1447192521 + .long 1072127979 + .long 1462857171 + .long 3162514521 + .long 1218806132 + .long 1072119706 + .long 1818613052 + .long 3162548441 + .long 3907805044 + .long 1072111477 + .long 2257091225 + .long 3161550407 + .long 4182873220 + .long 1072103293 + .long 629542646 + .long 3161996303 + .long 1013258799 + .long 1072095154 + .long 1748797611 + .long 3160129082 + .long 1963711167 + .long 1072087058 + .long 1744767757 + .long 3160574294 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 3561793907 + .long 1072070997 + .long 1157054053 + .long 1011890350 + .long 2186617381 + .long 1072063032 + .long 2270764084 + .long 3163272713 + .long 885834528 + .long 1072055110 + .long 1973258547 + .long 3162261564 + .long 2956612997 + .long 1072047230 + .long 2118169751 + .long 3162735553 + .long 3111574537 + .long 1072039393 + .long 2606161479 + .long 3162759746 + .long 363667784 + .long 1072031599 + .long 813753950 + .long 1015785209 + .long 2321106615 + .long 1072023846 + .long 2171176610 + .long 1009535771 + .long 3712504873 + .long 1072016135 + .long 88491949 + .long 1015427660 + .long 3566716925 + .long 1072008466 + .long 1536826856 + .long 1014142433 + .long 917841882 + .long 1072000839 + .long 18715565 + .long 1015659308 + .long 3395129871 + .long 1071993252 + .long 4025345435 + .long 3162335388 + .long 1453150082 + .long 1071985707 + .long 498154669 + .long 3161488062 + .long 2731501122 + .long 1071978202 + .long 1774031855 + .long 3162470021 + .long 1990012071 + .long 1071970738 + .long 3529070563 + .long 3162813193 + .long 2583551245 + .long 1071963314 + .long 3161094195 + .long 1015606491 + .long 3577096743 + .long 1071955930 + .long 2951496418 + .long 1013793687 + .long 4040676318 + .long 1071948586 + .long 4090609238 + .long 1015663458 + .long 3049340112 + .long 1071941282 + .long 3062915824 + .long 1013170595 + .long 3978100823 + .long 1071934017 + .long 3513027190 + .long 1015845963 + .long 1617004845 + .long 1071926792 + .long 82804944 + .long 1010342778 + .long 3645941911 + .long 1071919605 + .long 3814685081 + .long 3161573341 + .long 569847338 + .long 1071912458 + .long 472945272 + .long 3159290729 + .long 78413852 + .long 1071905349 + .long 4183226867 + .long 3163017251 + .long 1276261410 + .long 1071898278 + .long 300981948 + .long 1014684169 + .long 3272845541 + .long 1071891245 + .long 928852419 + .long 3163488248 + .long 887463927 + .long 1071884251 + .long 3596744163 + .long 3160794166 + .long 1829099622 + .long 1071877294 + .long 1016661181 + .long 3163461005 + .long 926591435 + .long 1071870375 + .long 3208833762 + .long 3162913514 + .long 1603444721 + .long 1071863493 + .long 1548633640 + .long 3162201326 + .long 2992903935 + .long 1071856648 + .long 2218154406 + .long 1015228193 + .long 4232894513 + .long 1071849840 + .long 2383938684 + .long 1014668519 + .long 171030293 + .long 1071843070 + .long 3526460132 + .long 1014428778 + .long 2839424854 + .long 1071836335 + .long 1171596163 + .long 1013041679 + .long 2799960843 + .long 1071829637 + .long 1423655381 + .long 1015022151 + .long 3504003472 + .long 1071822975 + .long 3594001060 + .long 3157330652 + .long 4112506593 + .long 1071816349 + .long 2947355221 + .long 1014371048 + .long 3790955393 + .long 1071809759 + .long 2352942462 + .long 3163180090 + .long 1709341917 + .long 1071803205 + .long 2571168217 + .long 1014152499 + .long 1337108031 + .long 1071796686 + .long 3203724452 + .long 1014677845 + .long 1853186616 + .long 1071790202 + .long 3066496371 + .long 1015656574 + .long 2440944790 + .long 1071783753 + .long 2492769774 + .long 1014147454 + .long 2288159958 + .long 1071777339 + .long 2169144469 + .long 1014876021 + .long 586995997 + .long 1071770960 + .long 41662348 + .long 3162627992 + .long 828946858 + .long 1071764615 + .long 10642492 + .long 1015939438 + .long 2214878420 + .long 1071758304 + .long 892270087 + .long 3163116422 + .long 3949972341 + .long 1071752027 + .long 2068408548 + .long 1014913868 + .long 948735466 + .long 1071745785 + .long 3516338028 + .long 3162574883 + .long 1014845819 + .long 1071739576 + .long 3117910646 + .long 3161559105 + .long 3366293073 + .long 1071733400 + .long 3119426314 + .long 1014120554 + .long 2930322912 + .long 1071727258 + .long 2599499422 + .long 3162714047 + .long 3228316108 + .long 1071721149 + .long 3010241991 + .long 3158422804 + .long 3490863953 + .long 1071715073 + .long 960797498 + .long 3162948880 + .long 2952712987 + .long 1071709030 + .long 3293494651 + .long 3160120301 + .long 852742562 + .long 1071703020 + .long 667253586 + .long 1009793559 + .long 728909815 + .long 1071697042 + .long 383930225 + .long 1015029468 + .long 1828292879 + .long 1071691096 + .long 1255956747 + .long 1015588398 + .long 3402036099 + .long 1071685182 + .long 405889334 + .long 1015105656 + .long 410360776 + .long 1071679301 + .long 1269990655 + .long 1011975870 + .long 702412510 + .long 1071673451 + .long 3803266087 + .long 3162280415 + .long 3541402996 + .long 1071667632 + .long 2759177317 + .long 1014854626 + .long 3899555717 + .long 1071661845 + .long 427280750 + .long 3162546972 + .long 1048019041 + .long 1071656090 + .long 1398474845 + .long 3160510595 + .long 2851812149 + .long 1071650365 + .long 2595802551 + .long 1015767337 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 3607404736 + .long 1044146952 + .long 3607404736 + .long 3191630600 + .long 4277811695 + .long 1063661122 + .long 4277811695 + .long 3211144770 + .long 2140175755 + .long 1033864261 + .long 2140175755 + .long 1033864261 + .long 4289495988 + .long 1054113747 + .long 4289495988 + .long 1054113747 + .long 4277811695 + .long 1064709698 + .long 4277811695 + .long 1064709698 + .long 1610612736 + .long 1080497479 + .long 4166901572 + .long 1053077003 + .long 329805064 + .long 1038488134 + .long 2773927730 + .long 1053236707 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1069897045 + .long 1744127201 + .long 1046144581 + .long 436314137 + .long 1059717536 + .long 0 + .long 4294967280 + .long 0 + .long 4294967280 + .long 4160749568 + .long 2147483647 + .type static_const_table,@object + .size static_const_table,4280 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinhcosh_wmt.S b/external/sgx_libm/ia32/sinhcosh_wmt.S new file mode 100644 index 0000000000..fd0ad63143 --- /dev/null +++ b/external/sgx_libm/ia32/sinhcosh_wmt.S @@ -0,0 +1,1518 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinhcosh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sinhcosh + .text + .align 16,0x90 + .globl sinhcosh +sinhcosh: +# parameter 1: 8 + %ebp +# parameter 2: 16 + %ebp +# parameter 3: 20 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 64(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + movl 136(%esp), %eax + movl %eax, 24(%esp) + movl 140(%esp), %eax + movl %eax, 28(%esp) + movsd %xmm0, 16(%esp) + movsd 4320(%ebx), %xmm3 + xorpd %xmm4, %xmm4 + movsd 4192(%ebx), %xmm1 + movsd 4200(%ebx), %xmm2 + movl $32768, %eax + pinsrw $3, %eax, %xmm4 + movsd 4096(%ebx), %xmm6 + pextrw $3, %xmm0, %ecx + andpd %xmm0, %xmm3 + andnpd %xmm0, %xmm4 + pshufd $68, %xmm4, %xmm5 + movl $32768, %edx + andl %ecx, %edx + andl $32767, %ecx + subl $16343, %ecx + cmpl $177, %ecx + jae .L_2TAG_PACKET_0.0.3 + subsd %xmm3, %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm2 + cvtsd2si %xmm3, %eax + shll $3, %edx + orl %edx, %eax + movapd %xmm3, %xmm7 + addsd %xmm6, %xmm3 + mulsd %xmm4, %xmm1 + xorpd %xmm5, %xmm5 + subsd %xmm6, %xmm3 + movapd 4112(%ebx), %xmm4 + addsd %xmm1, %xmm2 + movapd 4128(%ebx), %xmm6 + subsd %xmm3, %xmm7 + movl $32704, %edx + pinsrw $3, %edx, %xmm5 + movapd 4144(%ebx), %xmm1 + addsd %xmm7, %xmm2 + movl $127, %edx + andl %eax, %edx + addl %edx, %edx + shrl $3, %eax + andl $65520, %eax + addl $16352, %eax + xorpd %xmm0, %xmm0 + cmpl $161, %ecx + jae .L_2TAG_PACKET_1.0.3 + pshufd $68, %xmm5, %xmm5 + pinsrw $3, %eax, %xmm0 + pshufd $68, %xmm0, %xmm0 + psubw %xmm0, %xmm5 + mulpd (%ebx,%edx,8), %xmm0 + mulpd 2048(%ebx,%edx,8), %xmm5 + pshufd $68, %xmm2, %xmm3 + movapd 4160(%ebx), %xmm7 + pshufd $68, %xmm2, %xmm2 + mulpd %xmm3, %xmm3 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm6 + mulpd 4176(%ebx), %xmm2 + mulpd %xmm3, %xmm1 + mulpd %xmm3, %xmm7 + mulpd %xmm3, %xmm4 + mulpd %xmm3, %xmm1 + addpd %xmm7, %xmm6 + movapd %xmm0, %xmm7 + addpd %xmm1, %xmm4 + shufpd $0, %xmm5, %xmm7 + mulpd %xmm7, %xmm2 + shufpd $3, %xmm5, %xmm0 + addpd %xmm6, %xmm4 + mulpd %xmm2, %xmm4 + addpd %xmm0, %xmm4 + movapd %xmm7, %xmm1 + addpd %xmm2, %xmm4 + addpd %xmm4, %xmm1 + subpd %xmm1, %xmm7 + movapd %xmm1, %xmm0 + movapd %xmm1, %xmm5 + movapd %xmm1, %xmm6 + addpd %xmm7, %xmm4 + pshufd $238, %xmm1, %xmm2 + movapd %xmm4, %xmm3 + pshufd $238, %xmm4, %xmm7 + addsd %xmm2, %xmm1 + subsd %xmm2, %xmm0 + addsd %xmm7, %xmm4 + subsd %xmm7, %xmm3 + subsd %xmm1, %xmm5 + movsd 4352(%ebx), %xmm7 + subsd %xmm0, %xmm6 + addsd %xmm2, %xmm5 + subsd %xmm2, %xmm6 + addsd %xmm5, %xmm4 + addsd %xmm6, %xmm3 + addsd %xmm4, %xmm1 + addsd %xmm3, %xmm0 + andpd %xmm7, %xmm1 + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movl 28(%esp), %ecx + movsd %xmm1, (%ecx) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + subl $16352, %eax + movl %eax, %ecx + andl $32752, %eax + shrl $1, %eax + andl $65520, %eax + subl %eax, %ecx + addl $16352, %eax + pinsrw $3, %eax, %xmm0 + pshufd $68, %xmm0, %xmm0 + mulpd (%ebx,%edx,8), %xmm0 + pshufd $68, %xmm2, %xmm3 + movsd 4160(%ebx), %xmm7 + mulsd %xmm3, %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm6 + mulsd 4176(%ebx), %xmm2 + mulsd %xmm3, %xmm1 + mulsd %xmm3, %xmm7 + mulsd %xmm3, %xmm4 + addl $16368, %ecx + pinsrw $3, %ecx, %xmm5 + mulsd %xmm3, %xmm1 + addsd %xmm7, %xmm6 + addsd %xmm1, %xmm4 + mulsd %xmm0, %xmm2 + addsd %xmm6, %xmm4 + mulsd %xmm2, %xmm4 + pshufd $238, %xmm0, %xmm6 + addsd %xmm6, %xmm4 + movsd 4352(%ebx), %xmm1 + addsd %xmm4, %xmm2 + addsd %xmm2, %xmm0 + mulsd %xmm5, %xmm0 + pextrw $3, %xmm0, %eax + andpd %xmm0, %xmm1 + andl $32752, %eax + movl $229, %edx + cmpl $32752, %eax + je .L_2TAG_PACKET_3.0.3 + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movl 28(%esp), %eax + movsd %xmm1, (%eax) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + addl $16343, %ecx + cmpl $16343, %ecx + ja .L_2TAG_PACKET_4.0.3 + cmpl $15856, %ecx + jb .L_2TAG_PACKET_5.0.3 + movapd 4208(%ebx), %xmm1 + pshufd $68, %xmm0, %xmm6 + mulpd %xmm5, %xmm5 + movapd 4224(%ebx), %xmm2 + pshufd $68, %xmm0, %xmm7 + movapd 4240(%ebx), %xmm3 + pshufd $68, %xmm0, %xmm4 + andpd 4304(%ebx), %xmm6 + mulpd %xmm5, %xmm1 + mulsd %xmm5, %xmm2 + subpd %xmm6, %xmm4 + mulpd %xmm5, %xmm7 + addpd %xmm3, %xmm1 + pshufd $68, %xmm6, %xmm3 + mulpd %xmm5, %xmm5 + mulsd %xmm7, %xmm2 + mulpd %xmm7, %xmm1 + pshufd $68, %xmm0, %xmm7 + mulsd %xmm6, %xmm6 + addsd %xmm7, %xmm7 + mulsd %xmm4, %xmm4 + mulpd %xmm5, %xmm1 + addsd %xmm0, %xmm7 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm7 + pshufd $238, %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm2, %xmm3 + pshufd $238, %xmm2, %xmm2 + addsd %xmm4, %xmm7 + movapd %xmm0, %xmm4 + mulsd %xmm2, %xmm6 + mulsd %xmm5, %xmm7 + addsd %xmm6, %xmm0 + mulsd %xmm2, %xmm7 + subsd %xmm0, %xmm4 + addsd %xmm7, %xmm1 + addsd %xmm4, %xmm6 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movsd 16(%esp), %xmm5 + pshufd $68, %xmm5, %xmm5 + movapd 4256(%ebx), %xmm1 + mulpd %xmm5, %xmm5 + movapd 4272(%ebx), %xmm2 + xorpd %xmm3, %xmm3 + movsd 4288(%ebx), %xmm7 + movapd %xmm5, %xmm0 + mulpd %xmm5, %xmm1 + movsd 4336(%ebx), %xmm6 + mulpd %xmm5, %xmm5 + movl $16352, %eax + pinsrw $3, %eax, %xmm3 + addpd %xmm2, %xmm1 + mulsd %xmm5, %xmm7 + mulpd %xmm5, %xmm1 + mulsd %xmm5, %xmm7 + pshufd $238, %xmm1, %xmm2 + mulsd %xmm5, %xmm1 + mulsd %xmm5, %xmm7 + mulsd %xmm3, %xmm0 + addsd %xmm2, %xmm1 + addsd %xmm7, %xmm1 + addsd %xmm0, %xmm1 + addsd %xmm6, %xmm1 + movl 28(%esp), %ecx + movsd %xmm1, (%ecx) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_5.0.3: + movsd 4336(%ebx), %xmm1 + cmpl $16, %ecx + jae .L_2TAG_PACKET_6.0.3 + movapd %xmm0, %xmm2 + mulsd %xmm2, %xmm2 + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movl 28(%esp), %ecx + movsd %xmm1, (%ecx) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_6.0.3: + xorpd %xmm2, %xmm2 + movl $17392, %ecx + pinsrw $3, %ecx, %xmm2 + xorpd %xmm3, %xmm3 + movl $15344, %edx + pinsrw $3, %edx, %xmm3 + mulsd %xmm0, %xmm2 + addsd %xmm2, %xmm0 + mulsd %xmm3, %xmm0 + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movl 28(%esp), %ecx + movsd %xmm1, (%ecx) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + cmpl $32752, %ecx + jae .L_2TAG_PACKET_7.0.3 + movsd 4352(%ebx), %xmm3 + xorpd %xmm0, %xmm0 + movl $32736, %eax + pinsrw $3, %eax, %xmm0 + orl %edx, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + movapd %xmm0, %xmm1 + andpd %xmm3, %xmm1 + movl $229, %edx +.L_2TAG_PACKET_3.0.3: + movsd %xmm0, (%esp) + movsd %xmm1, 8(%esp) + movsd 16(%esp), %xmm0 + subl $32, %esp + lea 128(%esp), %eax + movl %eax, (%esp) + lea 136(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + movsd (%esp), %xmm0 + movsd 8(%esp), %xmm1 + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movl 28(%esp), %ecx + movsd %xmm1, (%ecx) + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_7.0.3: + xorpd %xmm1, %xmm1 + movl $32768, %eax + pinsrw $3, %eax, %xmm2 + andnpd %xmm0, %xmm2 + mulsd %xmm2, %xmm0 + movapd %xmm0, %xmm1 + movd %xmm0, %edx + movapd %xmm0, %xmm3 + cmpl $0, %edx + jne .L_2TAG_PACKET_8.0.3 + psrlq $20, %xmm3 + movd %xmm3, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_8.0.3 + movapd %xmm2, %xmm1 +.L_2TAG_PACKET_8.0.3: + movl 24(%esp), %eax + movsd %xmm0, (%eax) + movl 28(%esp), %ecx + movsd %xmm1, (%ecx) +.L_2TAG_PACKET_2.0.3: + movl 64(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sinhcosh,@function + .size sinhcosh,.-sinhcosh + .data +# -- End sinhcosh + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 2851812149 + .long 1072698941 + .long 2595802551 + .long 1016815913 + .long 1048019041 + .long 1072704666 + .long 1398474845 + .long 3161559171 + .long 3899555717 + .long 1072710421 + .long 427280750 + .long 3163595548 + .long 3541402996 + .long 1072716208 + .long 2759177317 + .long 1015903202 + .long 702412510 + .long 1072722027 + .long 3803266087 + .long 3163328991 + .long 410360776 + .long 1072727877 + .long 1269990655 + .long 1013024446 + .long 3402036099 + .long 1072733758 + .long 405889334 + .long 1016154232 + .long 1828292879 + .long 1072739672 + .long 1255956747 + .long 1016636974 + .long 728909815 + .long 1072745618 + .long 383930225 + .long 1016078044 + .long 852742562 + .long 1072751596 + .long 667253586 + .long 1010842135 + .long 2952712987 + .long 1072757606 + .long 3293494651 + .long 3161168877 + .long 3490863953 + .long 1072763649 + .long 960797498 + .long 3163997456 + .long 3228316108 + .long 1072769725 + .long 3010241991 + .long 3159471380 + .long 2930322912 + .long 1072775834 + .long 2599499422 + .long 3163762623 + .long 3366293073 + .long 1072781976 + .long 3119426314 + .long 1015169130 + .long 1014845819 + .long 1072788152 + .long 3117910646 + .long 3162607681 + .long 948735466 + .long 1072794361 + .long 3516338028 + .long 3163623459 + .long 3949972341 + .long 1072800603 + .long 2068408548 + .long 1015962444 + .long 2214878420 + .long 1072806880 + .long 892270087 + .long 3164164998 + .long 828946858 + .long 1072813191 + .long 10642492 + .long 1016988014 + .long 586995997 + .long 1072819536 + .long 41662348 + .long 3163676568 + .long 2288159958 + .long 1072825915 + .long 2169144469 + .long 1015924597 + .long 2440944790 + .long 1072832329 + .long 2492769774 + .long 1015196030 + .long 1853186616 + .long 1072838778 + .long 3066496371 + .long 1016705150 + .long 1337108031 + .long 1072845262 + .long 3203724452 + .long 1015726421 + .long 1709341917 + .long 1072851781 + .long 2571168217 + .long 1015201075 + .long 3790955393 + .long 1072858335 + .long 2352942462 + .long 3164228666 + .long 4112506593 + .long 1072864925 + .long 2947355221 + .long 1015419624 + .long 3504003472 + .long 1072871551 + .long 3594001060 + .long 3158379228 + .long 2799960843 + .long 1072878213 + .long 1423655381 + .long 1016070727 + .long 2839424854 + .long 1072884911 + .long 1171596163 + .long 1014090255 + .long 171030293 + .long 1072891646 + .long 3526460132 + .long 1015477354 + .long 4232894513 + .long 1072898416 + .long 2383938684 + .long 1015717095 + .long 2992903935 + .long 1072905224 + .long 2218154406 + .long 1016276769 + .long 1603444721 + .long 1072912069 + .long 1548633640 + .long 3163249902 + .long 926591435 + .long 1072918951 + .long 3208833762 + .long 3163962090 + .long 1829099622 + .long 1072925870 + .long 1016661181 + .long 3164509581 + .long 887463927 + .long 1072932827 + .long 3596744163 + .long 3161842742 + .long 3272845541 + .long 1072939821 + .long 928852419 + .long 3164536824 + .long 1276261410 + .long 1072946854 + .long 300981948 + .long 1015732745 + .long 78413852 + .long 1072953925 + .long 4183226867 + .long 3164065827 + .long 569847338 + .long 1072961034 + .long 472945272 + .long 3160339305 + .long 3645941911 + .long 1072968181 + .long 3814685081 + .long 3162621917 + .long 1617004845 + .long 1072975368 + .long 82804944 + .long 1011391354 + .long 3978100823 + .long 1072982593 + .long 3513027190 + .long 1016894539 + .long 3049340112 + .long 1072989858 + .long 3062915824 + .long 1014219171 + .long 4040676318 + .long 1072997162 + .long 4090609238 + .long 1016712034 + .long 3577096743 + .long 1073004506 + .long 2951496418 + .long 1014842263 + .long 2583551245 + .long 1073011890 + .long 3161094195 + .long 1016655067 + .long 1990012071 + .long 1073019314 + .long 3529070563 + .long 3163861769 + .long 2731501122 + .long 1073026778 + .long 1774031855 + .long 3163518597 + .long 1453150082 + .long 1073034283 + .long 498154669 + .long 3162536638 + .long 3395129871 + .long 1073041828 + .long 4025345435 + .long 3163383964 + .long 917841882 + .long 1073049415 + .long 18715565 + .long 1016707884 + .long 3566716925 + .long 1073057042 + .long 1536826856 + .long 1015191009 + .long 3712504873 + .long 1073064711 + .long 88491949 + .long 1016476236 + .long 2321106615 + .long 1073072422 + .long 2171176610 + .long 1010584347 + .long 363667784 + .long 1073080175 + .long 813753950 + .long 1016833785 + .long 3111574537 + .long 1073087969 + .long 2606161479 + .long 3163808322 + .long 2956612997 + .long 1073095806 + .long 2118169751 + .long 3163784129 + .long 885834528 + .long 1073103686 + .long 1973258547 + .long 3163310140 + .long 2186617381 + .long 1073111608 + .long 2270764084 + .long 3164321289 + .long 3561793907 + .long 1073119573 + .long 1157054053 + .long 1012938926 + .long 1719614413 + .long 1073127582 + .long 330458198 + .long 3164331316 + .long 1963711167 + .long 1073135634 + .long 1744767757 + .long 3161622870 + .long 1013258799 + .long 1073143730 + .long 1748797611 + .long 3161177658 + .long 4182873220 + .long 1073151869 + .long 629542646 + .long 3163044879 + .long 3907805044 + .long 1073160053 + .long 2257091225 + .long 3162598983 + .long 1218806132 + .long 1073168282 + .long 1818613052 + .long 3163597017 + .long 1447192521 + .long 1073176555 + .long 1462857171 + .long 3163563097 + .long 1339972927 + .long 1073184873 + .long 167908909 + .long 1016620728 + .long 1944781191 + .long 1073193236 + .long 3993278767 + .long 3162772855 + .long 19972402 + .long 1073201645 + .long 3507899862 + .long 1017057868 + .long 919555682 + .long 1073210099 + .long 3121969534 + .long 1013996802 + .long 1413356050 + .long 1073218599 + .long 1651349291 + .long 3163716742 + .long 2571947539 + .long 1073227145 + .long 3558159064 + .long 3164425245 + .long 1176749997 + .long 1073235738 + .long 2738998779 + .long 3163084420 + .long 2604962541 + .long 1073244377 + .long 2614425274 + .long 3164587768 + .long 3649726105 + .long 1073253063 + .long 4085036346 + .long 1016698050 + .long 1110089947 + .long 1073261797 + .long 1451641639 + .long 1016523249 + .long 380978316 + .long 1073270578 + .long 854188970 + .long 3161511262 + .long 2568320822 + .long 1073279406 + .long 2732824428 + .long 1015401491 + .long 194117574 + .long 1073288283 + .long 777528612 + .long 3164460665 + .long 2966275557 + .long 1073297207 + .long 2176155324 + .long 3160891335 + .long 3418903055 + .long 1073306180 + .long 2527457337 + .long 3161869180 + .long 2682146384 + .long 1073315202 + .long 2082178513 + .long 3164411995 + .long 1892288442 + .long 1073324273 + .long 2446255666 + .long 3163648957 + .long 2191782032 + .long 1073333393 + .long 2960257726 + .long 1014791238 + .long 434316067 + .long 1073342563 + .long 2028358766 + .long 1014506698 + .long 2069751141 + .long 1073351782 + .long 1562170675 + .long 3163773257 + .long 3964284211 + .long 1073361051 + .long 2111583915 + .long 1016475740 + .long 2990417245 + .long 1073370371 + .long 3683467745 + .long 3164417902 + .long 321958744 + .long 1073379742 + .long 3401933767 + .long 1016843134 + .long 1434058175 + .long 1073389163 + .long 251133233 + .long 1016134345 + .long 3218338682 + .long 1073398635 + .long 3404164304 + .long 3163525684 + .long 2572866477 + .long 1073408159 + .long 878562433 + .long 1016570317 + .long 697153126 + .long 1073417735 + .long 1283515429 + .long 3164331765 + .long 3092190715 + .long 1073427362 + .long 814012168 + .long 3160571998 + .long 2380618042 + .long 1073437042 + .long 3149557219 + .long 3164369375 + .long 4076559943 + .long 1073446774 + .long 2119478331 + .long 3161806927 + .long 815859274 + .long 1073456560 + .long 240396590 + .long 3164536019 + .long 2420883922 + .long 1073466398 + .long 2049810052 + .long 1015168464 + .long 1540824585 + .long 1073476290 + .long 1064017011 + .long 3164536266 + .long 3716502172 + .long 1073486235 + .long 2303740125 + .long 1015091301 + .long 1610600570 + .long 1073496235 + .long 3766732298 + .long 1016808759 + .long 777507147 + .long 1073506289 + .long 4282924205 + .long 1016236109 + .long 2483480501 + .long 1073516397 + .long 1216371780 + .long 1014082748 + .long 3706687593 + .long 1073526560 + .long 3521726940 + .long 1014301643 + .long 1432208378 + .long 1073536779 + .long 1401068914 + .long 3163412539 + .long 1242007932 + .long 1073547053 + .long 1132034716 + .long 3164388407 + .long 135105010 + .long 1073557383 + .long 1906148728 + .long 3164424315 + .long 3707479175 + .long 1073567768 + .long 3613079303 + .long 1015213314 + .long 382305176 + .long 1073578211 + .long 2347622376 + .long 3163627201 + .long 64696965 + .long 1073588710 + .long 1768797490 + .long 1016865536 + .long 4076975200 + .long 1073599265 + .long 2029000899 + .long 1016257111 + .long 863738719 + .long 1073609879 + .long 1326992220 + .long 3163661773 + .long 351641897 + .long 1073620550 + .long 2172261526 + .long 3164059175 + .long 3884662774 + .long 1073631278 + .long 2158611599 + .long 1015258761 + .long 4224142467 + .long 1073642065 + .long 3389820386 + .long 1016255778 + .long 2728693978 + .long 1073652911 + .long 396109971 + .long 3164511267 + .long 764307441 + .long 1073663816 + .long 3021057420 + .long 3164378099 + .long 3999357479 + .long 1073674779 + .long 2258941616 + .long 1016973300 + .long 929806999 + .long 1073685803 + .long 3205336643 + .long 1016308133 + .long 1533953344 + .long 1073696886 + .long 769171851 + .long 1016714209 + .long 2912730644 + .long 1073708029 + .long 3490067722 + .long 3164453650 + .long 2174652632 + .long 1073719233 + .long 4087714590 + .long 1015498835 + .long 730821105 + .long 1073730498 + .long 2523232743 + .long 1013115764 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 730821105 + .long 1072681922 + .long 2523232743 + .long 1012067188 + .long 2174652632 + .long 1072670657 + .long 4087714590 + .long 1014450259 + .long 2912730644 + .long 1072659453 + .long 3490067722 + .long 3163405074 + .long 1533953344 + .long 1072648310 + .long 769171851 + .long 1015665633 + .long 929806999 + .long 1072637227 + .long 3205336643 + .long 1015259557 + .long 3999357479 + .long 1072626203 + .long 2258941616 + .long 1015924724 + .long 764307441 + .long 1072615240 + .long 3021057420 + .long 3163329523 + .long 2728693978 + .long 1072604335 + .long 396109971 + .long 3163462691 + .long 4224142467 + .long 1072593489 + .long 3389820386 + .long 1015207202 + .long 3884662774 + .long 1072582702 + .long 2158611599 + .long 1014210185 + .long 351641897 + .long 1072571974 + .long 2172261526 + .long 3163010599 + .long 863738719 + .long 1072561303 + .long 1326992220 + .long 3162613197 + .long 4076975200 + .long 1072550689 + .long 2029000899 + .long 1015208535 + .long 64696965 + .long 1072540134 + .long 1768797490 + .long 1015816960 + .long 382305176 + .long 1072529635 + .long 2347622376 + .long 3162578625 + .long 3707479175 + .long 1072519192 + .long 3613079303 + .long 1014164738 + .long 135105010 + .long 1072508807 + .long 1906148728 + .long 3163375739 + .long 1242007932 + .long 1072498477 + .long 1132034716 + .long 3163339831 + .long 1432208378 + .long 1072488203 + .long 1401068914 + .long 3162363963 + .long 3706687593 + .long 1072477984 + .long 3521726940 + .long 1013253067 + .long 2483480501 + .long 1072467821 + .long 1216371780 + .long 1013034172 + .long 777507147 + .long 1072457713 + .long 4282924205 + .long 1015187533 + .long 1610600570 + .long 1072447659 + .long 3766732298 + .long 1015760183 + .long 3716502172 + .long 1072437659 + .long 2303740125 + .long 1014042725 + .long 1540824585 + .long 1072427714 + .long 1064017011 + .long 3163487690 + .long 2420883922 + .long 1072417822 + .long 2049810052 + .long 1014119888 + .long 815859274 + .long 1072407984 + .long 240396590 + .long 3163487443 + .long 4076559943 + .long 1072398198 + .long 2119478331 + .long 3160758351 + .long 2380618042 + .long 1072388466 + .long 3149557219 + .long 3163320799 + .long 3092190715 + .long 1072378786 + .long 814012168 + .long 3159523422 + .long 697153126 + .long 1072369159 + .long 1283515429 + .long 3163283189 + .long 2572866477 + .long 1072359583 + .long 878562433 + .long 1015521741 + .long 3218338682 + .long 1072350059 + .long 3404164304 + .long 3162477108 + .long 1434058175 + .long 1072340587 + .long 251133233 + .long 1015085769 + .long 321958744 + .long 1072331166 + .long 3401933767 + .long 1015794558 + .long 2990417245 + .long 1072321795 + .long 3683467745 + .long 3163369326 + .long 3964284211 + .long 1072312475 + .long 2111583915 + .long 1015427164 + .long 2069751141 + .long 1072303206 + .long 1562170675 + .long 3162724681 + .long 434316067 + .long 1072293987 + .long 2028358766 + .long 1013458122 + .long 2191782032 + .long 1072284817 + .long 2960257726 + .long 1013742662 + .long 1892288442 + .long 1072275697 + .long 2446255666 + .long 3162600381 + .long 2682146384 + .long 1072266626 + .long 2082178513 + .long 3163363419 + .long 3418903055 + .long 1072257604 + .long 2527457337 + .long 3160820604 + .long 2966275557 + .long 1072248631 + .long 2176155324 + .long 3159842759 + .long 194117574 + .long 1072239707 + .long 777528612 + .long 3163412089 + .long 2568320822 + .long 1072230830 + .long 2732824428 + .long 1014352915 + .long 380978316 + .long 1072222002 + .long 854188970 + .long 3160462686 + .long 1110089947 + .long 1072213221 + .long 1451641639 + .long 1015474673 + .long 3649726105 + .long 1072204487 + .long 4085036346 + .long 1015649474 + .long 2604962541 + .long 1072195801 + .long 2614425274 + .long 3163539192 + .long 1176749997 + .long 1072187162 + .long 2738998779 + .long 3162035844 + .long 2571947539 + .long 1072178569 + .long 3558159064 + .long 3163376669 + .long 1413356050 + .long 1072170023 + .long 1651349291 + .long 3162668166 + .long 919555682 + .long 1072161523 + .long 3121969534 + .long 1012948226 + .long 19972402 + .long 1072153069 + .long 3507899862 + .long 1016009292 + .long 1944781191 + .long 1072144660 + .long 3993278767 + .long 3161724279 + .long 1339972927 + .long 1072136297 + .long 167908909 + .long 1015572152 + .long 1447192521 + .long 1072127979 + .long 1462857171 + .long 3162514521 + .long 1218806132 + .long 1072119706 + .long 1818613052 + .long 3162548441 + .long 3907805044 + .long 1072111477 + .long 2257091225 + .long 3161550407 + .long 4182873220 + .long 1072103293 + .long 629542646 + .long 3161996303 + .long 1013258799 + .long 1072095154 + .long 1748797611 + .long 3160129082 + .long 1963711167 + .long 1072087058 + .long 1744767757 + .long 3160574294 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 3561793907 + .long 1072070997 + .long 1157054053 + .long 1011890350 + .long 2186617381 + .long 1072063032 + .long 2270764084 + .long 3163272713 + .long 885834528 + .long 1072055110 + .long 1973258547 + .long 3162261564 + .long 2956612997 + .long 1072047230 + .long 2118169751 + .long 3162735553 + .long 3111574537 + .long 1072039393 + .long 2606161479 + .long 3162759746 + .long 363667784 + .long 1072031599 + .long 813753950 + .long 1015785209 + .long 2321106615 + .long 1072023846 + .long 2171176610 + .long 1009535771 + .long 3712504873 + .long 1072016135 + .long 88491949 + .long 1015427660 + .long 3566716925 + .long 1072008466 + .long 1536826856 + .long 1014142433 + .long 917841882 + .long 1072000839 + .long 18715565 + .long 1015659308 + .long 3395129871 + .long 1071993252 + .long 4025345435 + .long 3162335388 + .long 1453150082 + .long 1071985707 + .long 498154669 + .long 3161488062 + .long 2731501122 + .long 1071978202 + .long 1774031855 + .long 3162470021 + .long 1990012071 + .long 1071970738 + .long 3529070563 + .long 3162813193 + .long 2583551245 + .long 1071963314 + .long 3161094195 + .long 1015606491 + .long 3577096743 + .long 1071955930 + .long 2951496418 + .long 1013793687 + .long 4040676318 + .long 1071948586 + .long 4090609238 + .long 1015663458 + .long 3049340112 + .long 1071941282 + .long 3062915824 + .long 1013170595 + .long 3978100823 + .long 1071934017 + .long 3513027190 + .long 1015845963 + .long 1617004845 + .long 1071926792 + .long 82804944 + .long 1010342778 + .long 3645941911 + .long 1071919605 + .long 3814685081 + .long 3161573341 + .long 569847338 + .long 1071912458 + .long 472945272 + .long 3159290729 + .long 78413852 + .long 1071905349 + .long 4183226867 + .long 3163017251 + .long 1276261410 + .long 1071898278 + .long 300981948 + .long 1014684169 + .long 3272845541 + .long 1071891245 + .long 928852419 + .long 3163488248 + .long 887463927 + .long 1071884251 + .long 3596744163 + .long 3160794166 + .long 1829099622 + .long 1071877294 + .long 1016661181 + .long 3163461005 + .long 926591435 + .long 1071870375 + .long 3208833762 + .long 3162913514 + .long 1603444721 + .long 1071863493 + .long 1548633640 + .long 3162201326 + .long 2992903935 + .long 1071856648 + .long 2218154406 + .long 1015228193 + .long 4232894513 + .long 1071849840 + .long 2383938684 + .long 1014668519 + .long 171030293 + .long 1071843070 + .long 3526460132 + .long 1014428778 + .long 2839424854 + .long 1071836335 + .long 1171596163 + .long 1013041679 + .long 2799960843 + .long 1071829637 + .long 1423655381 + .long 1015022151 + .long 3504003472 + .long 1071822975 + .long 3594001060 + .long 3157330652 + .long 4112506593 + .long 1071816349 + .long 2947355221 + .long 1014371048 + .long 3790955393 + .long 1071809759 + .long 2352942462 + .long 3163180090 + .long 1709341917 + .long 1071803205 + .long 2571168217 + .long 1014152499 + .long 1337108031 + .long 1071796686 + .long 3203724452 + .long 1014677845 + .long 1853186616 + .long 1071790202 + .long 3066496371 + .long 1015656574 + .long 2440944790 + .long 1071783753 + .long 2492769774 + .long 1014147454 + .long 2288159958 + .long 1071777339 + .long 2169144469 + .long 1014876021 + .long 586995997 + .long 1071770960 + .long 41662348 + .long 3162627992 + .long 828946858 + .long 1071764615 + .long 10642492 + .long 1015939438 + .long 2214878420 + .long 1071758304 + .long 892270087 + .long 3163116422 + .long 3949972341 + .long 1071752027 + .long 2068408548 + .long 1014913868 + .long 948735466 + .long 1071745785 + .long 3516338028 + .long 3162574883 + .long 1014845819 + .long 1071739576 + .long 3117910646 + .long 3161559105 + .long 3366293073 + .long 1071733400 + .long 3119426314 + .long 1014120554 + .long 2930322912 + .long 1071727258 + .long 2599499422 + .long 3162714047 + .long 3228316108 + .long 1071721149 + .long 3010241991 + .long 3158422804 + .long 3490863953 + .long 1071715073 + .long 960797498 + .long 3162948880 + .long 2952712987 + .long 1071709030 + .long 3293494651 + .long 3160120301 + .long 852742562 + .long 1071703020 + .long 667253586 + .long 1009793559 + .long 728909815 + .long 1071697042 + .long 383930225 + .long 1015029468 + .long 1828292879 + .long 1071691096 + .long 1255956747 + .long 1015588398 + .long 3402036099 + .long 1071685182 + .long 405889334 + .long 1015105656 + .long 410360776 + .long 1071679301 + .long 1269990655 + .long 1011975870 + .long 702412510 + .long 1071673451 + .long 3803266087 + .long 3162280415 + .long 3541402996 + .long 1071667632 + .long 2759177317 + .long 1014854626 + .long 3899555717 + .long 1071661845 + .long 427280750 + .long 3162546972 + .long 1048019041 + .long 1071656090 + .long 1398474845 + .long 3160510595 + .long 2851812149 + .long 1071650365 + .long 2595802551 + .long 1015767337 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 3607404736 + .long 1044146952 + .long 3607404736 + .long 3191630600 + .long 4277811695 + .long 1063661122 + .long 4277811695 + .long 3211144770 + .long 2140175755 + .long 1033864261 + .long 2140175755 + .long 1033864261 + .long 4289495988 + .long 1054113747 + .long 4289495988 + .long 1054113747 + .long 4277811695 + .long 1064709698 + .long 4277811695 + .long 3212193346 + .long 1610612736 + .long 1080497479 + .long 4166901572 + .long 1053077003 + .long 329805064 + .long 1038488134 + .long 2773927730 + .long 1053236707 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1069897045 + .long 1744127201 + .long 1046144581 + .long 436314137 + .long 1059717536 + .long 3078135644 + .long 1049787983 + .long 381774870 + .long 1062650220 + .long 436314137 + .long 1056571808 + .long 1431655765 + .long 1067799893 + .long 1835802424 + .long 1042411711 + .long 1431655765 + .long 1067799893 + .long 0 + .long 4294967280 + .long 0 + .long 4294967280 + .long 4160749568 + .long 2147483647 + .long 4160749568 + .long 2147483647 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .type static_const_table,@object + .size static_const_table,4368 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinhcoshl.S b/external/sgx_libm/ia32/sinhcoshl.S new file mode 100644 index 0000000000..3bfad5c3f1 --- /dev/null +++ b/external/sgx_libm/ia32/sinhcoshl.S @@ -0,0 +1,1273 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinhcoshl.c" + .text +..TXTST0: +# -- Begin sinhcoshl + .text + .align 16,0x90 + .globl sinhcoshl +sinhcoshl: +# parameter 1: 8 + %ebp +# parameter 2: 20 + %ebp +# parameter 3: 24 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $100, %esp + movl 20(%ebp), %esi + movl 24(%ebp), %ebx +..B1.2: + fnstcw 62(%esp) +..B1.3: + movzwl 16(%ebp), %edx + andl $32767, %edx + movl 12(%ebp), %edi + movl %edx, %eax + movl %edi, (%esp) + shll $16, %eax + shrl $16, %edi + movzbl 17(%ebp), %ecx + orl %edi, %eax + andl $128, %ecx + shrl $7, %ecx + cmpl $1073992020, %eax + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + jae ..B1.53 +..B1.4: + movzwl 62(%esp), %edi + cmpl $16382, %edx + movl %edi, (%esp) + jge ..B1.46 +..B1.5: + cmpl $16378, %edx + jge ..B1.39 +..B1.6: + cmpl $16372, %edx + jge ..B1.32 +..B1.7: + cmpl $16365, %edx + jge ..B1.25 +..B1.8: + cmpl $16308, %edx + jge ..B1.18 +..B1.9: + andl $768, %edi + cmpl $768, %edi + je ..B1.76 +..B1.10: + movl (%esp), %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.11: + fldcw 60(%esp) +..B1.12: + movzbl 17(%ebp), %ecx + movl $1, %edi + andl $128, %ecx + movzwl 16(%ebp), %edx + shrl $7, %ecx + andl $32767, %edx +..B1.13: + testl %edx, %edx + jle ..B1.72 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%eax) + fmul %st(1), %st + fadd %st(1), %st + fmull 8+_TWO_75@GOTOFF(%eax) + fstpt (%esp) +..B1.15: + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + testl %edi, %edi + fxch %st(1) + fmull ones@GOTOFF(%eax,%ecx,8) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.17 +..B1.16: + fldcw 62(%esp) +..B1.17: + fldt (%esp) + fstpt (%esi) + fldt 16(%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %edi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.77 +..B1.19: + movl %edi, %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.20: + fldcw 60(%esp) +..B1.21: + movl $1, %edx +..B1.22: + fldt 8(%ebp) + testl %edx, %edx + fld %st(0) + fmul %st(1), %st + fldt _PS3@GOTOFF(%eax) + fmul %st(1), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt _PC3@GOTOFF(%eax) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.24 +..B1.23: + fldcw 62(%esp) +..B1.24: + fldt (%esp) + fstpt (%esi) + fldt 16(%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %edi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.78 +..B1.26: + movl %edi, %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.27: + fldcw 60(%esp) +..B1.28: + movl $1, %edx +..B1.29: + fldt 8(%ebp) + testl %edx, %edx + fld %st(0) + fmul %st(1), %st + fldt 12+_PS2@GOTOFF(%eax) + fmul %st(1), %st + fldt _PS2@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt 12+_PC2@GOTOFF(%eax) + fmul %st(1), %st + fldt _PC2@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.31 +..B1.30: + fldcw 62(%esp) +..B1.31: + fldt (%esp) + fstpt (%esi) + fldt 16(%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movl %edi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.79 +..B1.33: + movl %edi, %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.34: + fldcw 60(%esp) +..B1.35: + movl $1, %edx +..B1.36: + fldt 8(%ebp) + testl %edx, %edx + fld %st(0) + fmul %st(1), %st + fldt 36+_PS1@GOTOFF(%eax) + fmul %st(1), %st + fldt 24+_PS1@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_PS1@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt _PS1@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + fldt 36+_PC1@GOTOFF(%eax) + fmul %st(1), %st + fldt 24+_PC1@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_PC1@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt _PC1@GOTOFF(%eax) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + faddp %st, %st(1) + fstpt (%esp) + je ..B1.38 +..B1.37: + fldcw 62(%esp) +..B1.38: + fldt 16(%esp) + fstpt (%esi) + fldt (%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %edi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.80 +..B1.40: + movl %edi, %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.41: + fldcw 60(%esp) +..B1.42: + movl $1, %edx +..B1.43: + fldl _TWO_48H@GOTOFF(%eax) + testl %edx, %edx + fld %st(0) + fldt 8(%ebp) + fld %st(0) + fmul %st(1), %st + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%esp) + fldt 32(%esp) + fld %st(2) + fsub %st(1), %st + fldt 84+_PS@GOTOFF(%eax) + fmul %st(3), %st + fldt 72+_PS@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PS@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_PS@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PS@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_PS@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(3), %st + fldt 12+_PS@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_PC@GOTOFF(%eax) + fmul %st(4), %st + fldt 72+_PC@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(4), %st + fldt 60+_PC@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(4), %st + fldt 48+_PC@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(4), %st + fldt 36+_PC@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(4), %st + fldt 24+_PC@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(4), %st + fldt 12+_PC@GOTOFF(%eax) + faddp %st, %st(1) + fmul %st(4), %st + fstpt 64(%esp) + fld %st(4) + fmul %st(2), %st + fldt _PS@GOTOFF(%eax) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(1) + fld %st(2) + fmul %st(2), %st + faddp %st, %st(4) + fld %st(2) + fmul %st(3), %st + fldt 96+_PS@GOTOFF(%eax) + fld %st(0) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(6) + fld %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(6) + fxch %st(5) + faddp %st, %st(2) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%esp) + fldt 108+_PC@GOTOFF(%eax) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(4), %st + fldt 64(%esp) + faddp %st, %st(2) + fld %st(3) + fmul %st(1), %st + fxch %st(1) + fmul %st(5), %st + fldt 48(%esp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%esp) + fld %st(0) + fldt 96+_PC@GOTOFF(%eax) + fmul %st, %st(6) + fxch %st(3) + faddp %st, %st(6) + fxch %st(2) + fmulp %st, %st(6) + fldt 80(%esp) + fadd %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fld %st(2) + fadd %st(1), %st + fldl _TWO_48H@GOTOFF(%eax) + fadd %st, %st(1) + fsubr %st(1), %st + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + je ..B1.90 +..B1.44: + fstpt 80(%esp) +..B1.89: + fldcw 62(%esp) + jmp ..B1.45 +..B1.90: + fstp %st(0) +..B1.45: + fldt (%esp) + fstpt (%esi) + fldt 16(%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + movl %edi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.81 +..B1.47: + movl %edi, %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.48: + fldcw 60(%esp) +..B1.49: + movzbl 17(%ebp), %ecx + movl $1, %edi + andl $128, %ecx + shrl $7, %ecx +..B1.50: + fldl ones@GOTOFF(%eax,%ecx,8) + fstpt 32(%esp) + fldt 32(%esp) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%eax) + fldt .L_2il0floatpacket.0@GOTOFF(%eax) + fmul %st(2), %st + movl %ebx, 44(%esp) + fadd %st(1), %st + fstpt 80(%esp) + fldt 80(%esp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%eax) + fmul %st(1), %st + movl 80(%esp), %edx + fsubrp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%eax) + fmulp %st, %st(2) + movsbl %dl, %ebx + fsub %st(1), %st + fldl _TWO_32P@GOTOFF(%eax) + subl %ebx, %edx + fmul %st(1), %st + fxch %st(1) + fmull _TWO_32@GOTOFF(%eax) + shll $4, %ebx + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + shrl $8, %edx + fxch %st(2) + fsubrp %st, %st(3) + movl %edx, %ecx + negl %edx + shll $23, %ecx + fadd %st(2), %st + fld %st(0) + addl $1056964608, %ecx + fmul %st(1), %st + fldt 48+_PE@GOTOFF(%eax) + fmul %st(1), %st + fldt 36+_PE@GOTOFF(%eax) + fmul %st(2), %st + fldt 24+_PE@GOTOFF(%eax) + shll $23, %edx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + addl $1056964608, %edx + fldt 12+_PE@GOTOFF(%eax) + movl %ecx, 12(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + movl %edx, 28(%esp) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fldt _PE@GOTOFF(%eax) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + fadd %st, %st(1) + fsubp %st, %st(3) + fldl 2056+__libm_expl_table_256@GOTOFF(%eax,%ebx) + fldl 2048+__libm_expl_table_256@GOTOFF(%eax,%ebx) + negl %ebx + fstpt 48(%esp) + fldt 48(%esp) + testl %edi, %edi + fadd %st(1), %st + fmulp %st, %st(2) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(2) + fldl 2056+__libm_expl_table_256@GOTOFF(%eax,%ebx) + fld %st(0) + fmul %st(4), %st + fldl 2048+__libm_expl_table_256@GOTOFF(%eax,%ebx) + fld %st(0) + movl 44(%esp), %ebx + fadd %st(3), %st + fmulp %st, %st(7) + fxch %st(1) + fsubrp %st, %st(6) + fxch %st(5) + fstpt 64(%esp) + fldt 48(%esp) + fld %st(0) + fmul %st(5), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + fmul %st(4), %st + fld %st(4) + fsub %st(1), %st + fsubr %st, %st(5) + fxch %st(1) + fsubrp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fldt 64(%esp) + faddp %st, %st(3) + flds 12(%esp) + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + flds 28(%esp) + fmul %st, %st(5) + fld %st(5) + fadd %st(4), %st + fxch %st(5) + fmulp %st, %st(1) + fxch %st(2) + fsub %st(5), %st + fld %st(0) + fsubr %st(4), %st + fsub %st(6), %st + fld %st(2) + fsub %st(4), %st + faddp %st, %st(1) + fxch %st(4) + fsub %st(5), %st + faddp %st, %st(6) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt 32(%esp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.52 +..B1.51: + fldcw 62(%esp) +..B1.52: + fldt 16(%esp) + fstpt (%esi) + fldt (%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.53: + cmpl $16396, %edx + jge ..B1.61 +..B1.54: + movzwl 62(%esp), %edi + movl %edi, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.82 +..B1.55: + orl $-64768, %edi + movw %di, 60(%esp) +..B1.56: + fldcw 60(%esp) +..B1.57: + movzbl 17(%ebp), %ecx + movl $1, %edi + andl $128, %ecx + shrl $7, %ecx +..B1.58: + fldl ones@GOTOFF(%eax,%ecx,8) + fstpt 48(%esp) + fldt 48(%esp) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt .L_2il0floatpacket.3@GOTOFF(%eax) + fstpt (%esp) + fldl _TWO_63H@GOTOFF(%eax) + fldt .L_2il0floatpacket.0@GOTOFF(%eax) + fmul %st(2), %st + movl %ebx, 44(%esp) + fadd %st(1), %st + fstpt 80(%esp) + fldt 80(%esp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%eax) + fmul %st(1), %st + movl 80(%esp), %edx + fsubrp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%eax) + fmulp %st, %st(2) + movsbl %dl, %ebx + fsub %st(1), %st + fldl _TWO_32@GOTOFF(%eax) + subl %ebx, %edx + fldl _TWO_32P@GOTOFF(%eax) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + shll $4, %ebx + fxch %st(2) + fsubrp %st, %st(1) + shrl $8, %edx + fsubr %st, %st(3) + addl $16350, %edx + fxch %st(2) + fsubrp %st, %st(3) + fld %st(1) + andl $32767, %edx + movzwl 8+.L_2il0floatpacket.3@GOTOFF(%eax), %ecx + fadd %st(3), %st + fld %st(0) + andl $-32768, %ecx + fmul %st(1), %st + orl %edx, %ecx + fldt 48+_PE@GOTOFF(%eax) + testl %edi, %edi + fmul %st(1), %st + fldt 36+_PE@GOTOFF(%eax) + fmul %st(2), %st + fldt 24+_PE@GOTOFF(%eax) + movw %cx, 8(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_PE@GOTOFF(%eax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(5) + fldt _PE@GOTOFF(%eax) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 2048+__libm_expl_table_256@GOTOFF(%eax,%ebx) + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fadd %st, %st(4) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(4) + fmull 2056+__libm_expl_table_256@GOTOFF(%eax,%ebx) + faddp %st, %st(3) + fldt (%esp) + fmul %st, %st(4) + fxch %st(2) + fmul %st, %st(4) + fxch %st(1) + faddl 2056+__libm_expl_table_256@GOTOFF(%eax,%ebx) + movl 44(%esp), %ebx + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + fldt 48(%esp) + fld %st(0) + fmul %st(3), %st + fxch %st(2) + fadd %st, %st(3) + fxch %st(3) + fstpt 16(%esp) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%esp) + je ..B1.60 +..B1.59: + fldcw 62(%esp) +..B1.60: + fldt 32(%esp) + fstpt (%esi) + fldt 16(%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + je ..B1.84 +..B1.62: + movzwl 62(%esp), %edi + movl %edi, (%esp) + andl $768, %edi + cmpl $768, %edi + je ..B1.83 +..B1.63: + movl (%esp), %edx + orl $-64768, %edx + movw %dx, 60(%esp) +..B1.64: + fldcw 60(%esp) +..B1.65: + movzbl 17(%ebp), %ecx + movl $1, %edi + andl $128, %ecx + movzwl 16(%ebp), %edx + shrl $7, %ecx + andl $32767, %edx +..B1.66: + cmpl $32767, %edx + jne ..B1.68 +..B1.67: + fldt 8(%ebp) + fstpt 16(%esp) + fldt 16(%esp) + fldl ones@GOTOFF(%eax,%ecx,8) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.69 +..B1.68: + fldt _large_value_80@GOTOFF(%eax) + lea (,%ecx,8), %edx + lea (%edx,%ecx,4), %ecx + fldt _large_value_80@GOTOFF(%eax,%ecx) + fmul %st(1), %st + fstpt 16(%esp) + fmul %st(0), %st + fstpt (%esp) +..B1.69: + testl %edi, %edi + je ..B1.71 +..B1.70: + fldcw 62(%esp) +..B1.71: + fldt 16(%esp) + fstpt (%esi) + fldt (%esp) + fstpt (%ebx) + addl $100, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.72: + cmpl $0, 12(%ebp) + jne ..B1.74 +..B1.73: + cmpl $0, 8(%ebp) + je ..B1.75 +..B1.74: + fldt _small_value_80@GOTOFF(%eax) + lea (,%ecx,8), %edx + fldt 8(%ebp) + lea (%edx,%ecx,4), %edx + fldt _small_value_80@GOTOFF(%eax,%edx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%esp) + fldt 80(%esp) + fadd %st(1), %st + fstpt (%esp) + jmp ..B1.15 +..B1.75: + fldt 8(%ebp) + fstpt (%esp) + fldt (%esp) + jmp ..B1.15 +..B1.76: + xorl %edi, %edi + jmp ..B1.13 +..B1.77: + xorl %edx, %edx + jmp ..B1.22 +..B1.78: + xorl %edx, %edx + jmp ..B1.29 +..B1.79: + xorl %edx, %edx + jmp ..B1.36 +..B1.80: + xorl %edx, %edx + jmp ..B1.43 +..B1.81: + xorl %edi, %edi + jmp ..B1.50 +..B1.82: + xorl %edi, %edi + jmp ..B1.58 +..B1.83: + xorl %edi, %edi + jmp ..B1.66 +..B1.84: + cmpl $-1317741120, (%esp) + jb ..B1.54 +..B1.85: + jne ..B1.62 +..B1.86: + cmpl $833536233, 8(%ebp) + jbe ..B1.54 + jmp ..B1.62 + .align 16,0x90 + .type sinhcoshl,@function + .size sinhcoshl,.-sinhcoshl + .data +# -- End sinhcoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 2 +_PS3: + .word 21845 + .word 44373 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _PS3,@object + .size _PS3,12 + .align 2 +_PC3: + .word 21845 + .word 213 + .word 0 + .word 32768 + .word 16382 + .word 0 + .type _PC3,@object + .size _PC3,12 + .align 2 +_PS2: + .word 29491 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 1838 + .word 3745 + .word 35050 + .word 34952 + .word 16376 + .word 0 + .type _PS2,@object + .size _PS2,24 + .align 2 +_PC2: + .word 62430 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 22894 + .word 21845 + .word 43733 + .word 43690 + .word 16378 + .word 0 + .type _PC2,@object + .size _PC2,24 + .align 2 +_PS1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 56472 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 6470 + .word 8609 + .word 207 + .word 53261 + .word 16370 + .word 0 + .word 51515 + .word 9159 + .word 10794 + .word 47344 + .word 16364 + .word 0 + .type _PS1,@object + .size _PS1,48 + .align 2 +_PC1: + .word 65531 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 7054 + .word 43693 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 25016 + .word 58228 + .word 24755 + .word 46603 + .word 16373 + .word 0 + .word 57397 + .word 35800 + .word 53031 + .word 53262 + .word 16367 + .word 0 + .type _PC1,@object + .size _PC1,48 + .align 2 +_PS: + .word 43620 + .word 43690 + .word 43690 + .word 43690 + .word 16364 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 52382 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 44665 + .word 46658 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 15678 + .word 35942 + .word 11071 + .word 55090 + .word 16357 + .word 0 + .word 10412 + .word 23121 + .word 12507 + .word 45202 + .word 16350 + .word 0 + .word 37213 + .word 41879 + .word 65084 + .word 55102 + .word 16342 + .word 0 + .word 1721 + .word 42148 + .word 19309 + .word 52099 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16380 + .word 0 + .type _PS,@object + .size _PS,108 + .align 2 +_PC: + .word 18360 + .word 43637 + .word 28980 + .word 40373 + .word 49076 + .word 0 + .word 16302 + .word 43691 + .word 43690 + .word 43690 + .word 16362 + .word 0 + .word 46125 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 29965 + .word 3335 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 54950 + .word 46751 + .word 32187 + .word 37874 + .word 16361 + .word 0 + .word 30733 + .word 25775 + .word 51110 + .word 36726 + .word 16354 + .word 0 + .word 49850 + .word 450 + .word 9929 + .word 51659 + .word 16346 + .word 0 + .word 2776 + .word 45191 + .word 37201 + .word 55334 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16378 + .word 0 + .type _PC,@object + .size _PC,120 + .align 2 +_PE: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _PE,@object + .size _PE,60 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinhf_wmt.S b/external/sgx_libm/ia32/sinhf_wmt.S new file mode 100644 index 0000000000..e415ba11e6 --- /dev/null +++ b/external/sgx_libm/ia32/sinhf_wmt.S @@ -0,0 +1,422 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinhf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin sinhf + .text + .align 16,0x90 + .globl sinhf +sinhf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + movsd 608(%ebx), %xmm3 + movsd 576(%ebx), %xmm6 + movd %xmm0, %ecx + movl $-2147483648, %edx + psllq $33, %xmm0 + psrlq $4, %xmm0 + movapd 512(%ebx), %xmm4 + andl %ecx, %edx + andl $2147418112, %ecx + subl $1052246016, %ecx + cmpl $67633152, %ecx + jae .L_2TAG_PACKET_0.0.3 + mulsd %xmm0, %xmm3 + movapd %xmm3, %xmm2 + addsd %xmm6, %xmm3 + xorpd %xmm0, %xmm0 + movd %xmm3, %eax + subsd %xmm6, %xmm3 + movapd 528(%ebx), %xmm1 + xorpd %xmm5, %xmm5 + subsd %xmm3, %xmm2 + shrl $16, %edx + orl $16352, %edx + cmpl $59244544, %ecx + jae .L_2TAG_PACKET_1.0.3 + movl $31, %ecx + andl %eax, %ecx + shrl $1, %eax + addl %ecx, %ecx + andl $65520, %eax + addl %edx, %eax + pinsrw $3, %eax, %xmm0 + movl $32704, %edx + subl %eax, %edx + movapd 544(%ebx), %xmm3 + movapd (%ebx,%ecx,8), %xmm7 + pinsrw $3, %edx, %xmm5 + pshufd $68, %xmm2, %xmm2 + shufpd $0, %xmm5, %xmm0 + movapd 560(%ebx), %xmm6 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm1 + mulpd %xmm2, %xmm3 + mulpd %xmm7, %xmm0 + mulpd %xmm2, %xmm4 + addpd %xmm1, %xmm6 + mulpd %xmm0, %xmm3 + addpd %xmm6, %xmm4 + mulpd %xmm3, %xmm4 + addpd %xmm4, %xmm0 + pshufd $78, %xmm0, %xmm4 + subpd %xmm4, %xmm0 + cvtsd2ss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_0.0.3: + addl $1052246016, %ecx + cmpl $1052246016, %ecx + ja .L_2TAG_PACKET_3.0.3 + cmpl $956301312, %ecx + jae .L_2TAG_PACKET_4.0.3 + cmpl $8388608, %ecx + jae .L_2TAG_PACKET_5.0.3 + movss 112(%esp), %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_5.0.3: + movss 112(%esp), %xmm0 + movl $1283457024, %eax + movd %eax, %xmm1 + movl $847249408, %ecx + movd %ecx, %xmm2 + mulss %xmm0, %xmm1 + addss %xmm1, %xmm0 + mulss %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_1.0.3: + movl $31, %ecx + andl %eax, %ecx + shrl $1, %eax + addl %ecx, %ecx + andl $65520, %eax + addl %edx, %eax + pinsrw $3, %eax, %xmm0 + movsd 544(%ebx), %xmm3 + pshufd $68, %xmm2, %xmm2 + mulsd (%ebx,%ecx,8), %xmm0 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm1, %xmm4 + mulsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 + mulsd %xmm0, %xmm4 + addsd %xmm4, %xmm0 + cvtsd2ss %xmm0, %xmm0 + pextrw $1, %xmm0, %eax + andl $32640, %eax + movl $128, %edx + cmpl $32640, %eax + je .L_2TAG_PACKET_6.0.3 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_4.0.3: + psrlq $29, %xmm0 + movss 592(%ebx), %xmm7 + movss %xmm0, %xmm5 + mulss %xmm0, %xmm0 + movss 596(%ebx), %xmm2 + movss %xmm0, %xmm1 + mulss %xmm0, %xmm7 + movl $1042983595, %eax + movd %eax, %xmm3 + mulss %xmm0, %xmm0 + addss %xmm2, %xmm7 + movd %edx, %xmm4 + mulss %xmm3, %xmm1 + mulss %xmm7, %xmm0 + addss %xmm1, %xmm0 + orps %xmm4, %xmm5 + mulss %xmm5, %xmm0 + addss %xmm5, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_3.0.3: + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_7.0.3 + movl $2130706432, %eax + movd %eax, %xmm0 + orl %edx, %eax + movd %eax, %xmm1 + mulss %xmm1, %xmm0 + movl $128, %edx +.L_2TAG_PACKET_6.0.3: + movss %xmm0, (%esp) + movss 112(%esp), %xmm0 + subl $32, %esp + lea 112(%esp), %eax + movl %eax, (%esp) + lea 112(%esp), %eax + movl %eax, 4(%esp) + lea 32(%esp), %eax + movl %eax, 8(%esp) + movl %edx, %eax + movl %eax, 12(%esp) + call __libm_error_support + addl $32, %esp + flds (%esp) + jmp .L_2TAG_PACKET_8.0.3 +.L_2TAG_PACKET_7.0.3: + movss 112(%esp), %xmm0 + movss %xmm0, %xmm1 + pslld $1, %xmm0 + psrld $1, %xmm0 + mulss %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.3 +.L_2TAG_PACKET_2.0.3: + movss %xmm0, 24(%esp) + flds 24(%esp) +.L_2TAG_PACKET_8.0.3: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type sinhf,@function + .size sinhf,.-sinhf + .data +# -- End sinhf + .text +# -- Begin __libm_error_support + .text + .align 16,0x90 +__libm_error_support: +# parameter 1: 4 + %esp +# parameter 2: 8 + %esp +# parameter 3: 12 + %esp +# parameter 4: 16 + %esp +..B3.1: +..L4: + + ret + .align 16,0x90 + .type __libm_error_support,@function + .size __libm_error_support,.-__libm_error_support + .data +# -- End __libm_error_support + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 3541402996 + .long 1072716208 + .long 1533953344 + .long 1072648310 + .long 1828292879 + .long 1072739672 + .long 2728693978 + .long 1072604335 + .long 3490863953 + .long 1072763649 + .long 863738719 + .long 1072561303 + .long 1014845819 + .long 1072788152 + .long 3707479175 + .long 1072519192 + .long 828946858 + .long 1072813191 + .long 3706687593 + .long 1072477984 + .long 1853186616 + .long 1072838778 + .long 3716502172 + .long 1072437659 + .long 4112506593 + .long 1072864925 + .long 4076559943 + .long 1072398198 + .long 171030293 + .long 1072891646 + .long 2572866477 + .long 1072359583 + .long 926591435 + .long 1072918951 + .long 2990417245 + .long 1072321795 + .long 1276261410 + .long 1072946854 + .long 2191782032 + .long 1072284817 + .long 1617004845 + .long 1072975368 + .long 2966275557 + .long 1072248631 + .long 3577096743 + .long 1073004506 + .long 1110089947 + .long 1072213221 + .long 1453150082 + .long 1073034283 + .long 2571947539 + .long 1072178569 + .long 3712504873 + .long 1073064711 + .long 1944781191 + .long 1072144660 + .long 2956612997 + .long 1073095806 + .long 3907805044 + .long 1072111477 + .long 1719614413 + .long 1073127582 + .long 1719614413 + .long 1072079006 + .long 3907805044 + .long 1073160053 + .long 2956612997 + .long 1072047230 + .long 1944781191 + .long 1073193236 + .long 3712504873 + .long 1072016135 + .long 2571947539 + .long 1073227145 + .long 1453150082 + .long 1071985707 + .long 1110089947 + .long 1073261797 + .long 3577096743 + .long 1071955930 + .long 2966275557 + .long 1073297207 + .long 1617004845 + .long 1071926792 + .long 2191782032 + .long 1073333393 + .long 1276261410 + .long 1071898278 + .long 2990417245 + .long 1073370371 + .long 926591435 + .long 1071870375 + .long 2572866477 + .long 1073408159 + .long 171030293 + .long 1071843070 + .long 4076559943 + .long 1073446774 + .long 4112506593 + .long 1071816349 + .long 3716502172 + .long 1073486235 + .long 1853186616 + .long 1071790202 + .long 3706687593 + .long 1073526560 + .long 828946858 + .long 1071764615 + .long 3707479175 + .long 1073567768 + .long 1014845819 + .long 1071739576 + .long 863738719 + .long 1073609879 + .long 3490863953 + .long 1071715073 + .long 2728693978 + .long 1073652911 + .long 1828292879 + .long 1071691096 + .long 1533953344 + .long 1073696886 + .long 3541402996 + .long 1071667632 + .long 4289495988 + .long 1058308051 + .long 4289495988 + .long 1058308051 + .long 4277811695 + .long 1065758274 + .long 4277811695 + .long 3213241922 + .long 4277811695 + .long 1066806850 + .long 4277811695 + .long 3214290498 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 961547521 + .long 1007192201 + .long 1042983595 + .long 0 + .long 1697350398 + .long 2017924423 + .type static_const_table,@object + .size static_const_table,616 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinhl.S b/external/sgx_libm/ia32/sinhl.S new file mode 100644 index 0000000000..7726807ca0 --- /dev/null +++ b/external/sgx_libm/ia32/sinhl.S @@ -0,0 +1,1005 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinhl.c" + .text +..TXTST0: +# -- Begin sinhl + .text + .align 16,0x90 + .globl sinhl +sinhl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $84, %esp +..B1.2: + fnstcw 46(%esp) +..B1.3: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + movl 12(%ebp), %esi + movl %ecx, %edx + movl %esi, %eax + shll $16, %edx + shrl $16, %eax + movzbl 17(%ebp), %ebx + orl %eax, %edx + andl $128, %ebx + shrl $7, %ebx + cmpl $1073992020, %edx + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + jae ..B1.53 +..B1.4: + movzwl 46(%esp), %eax + cmpl $16382, %ecx + jge ..B1.46 +..B1.5: + cmpl $16378, %ecx + jge ..B1.39 +..B1.6: + cmpl $16373, %ecx + jge ..B1.32 +..B1.7: + cmpl $16366, %ecx + jge ..B1.25 +..B1.8: + cmpl $16308, %ecx + jge ..B1.18 +..B1.9: + movl %eax, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.76 +..B1.10: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.11: + fldcw 44(%esp) +..B1.12: + movzwl 16(%ebp), %ecx + movl $1, %esi + andl $32767, %ecx +..B1.13: + testl %ecx, %ecx + jle ..B1.72 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%edx) + fmul %st(1), %st + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%edx) + fstpt 16(%esp) +..B1.15: + testl %esi, %esi + je ..B1.17 +..B1.16: + fldcw 46(%esp) +..B1.17: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.77 +..B1.19: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.20: + fldcw 44(%esp) +..B1.21: + movl $1, %eax +..B1.22: + fldt 8(%ebp) + testl %eax, %eax + fldt _Q3@GOTOFF(%edx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.24 +..B1.23: + fldcw 46(%esp) +..B1.24: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.78 +..B1.26: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.27: + fldcw 44(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_Q2@GOTOFF(%edx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.31 +..B1.30: + fldcw 46(%esp) +..B1.31: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.79 +..B1.33: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.34: + fldcw 44(%esp) +..B1.35: + movl $1, %eax +..B1.36: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%edx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%edx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.38 +..B1.37: + fldcw 46(%esp) +..B1.38: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.80 +..B1.40: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.41: + fldcw 44(%esp) +..B1.42: + movzbl 17(%ebp), %ebx + movl $1, %eax + andl $128, %ebx + shrl $7, %ebx +..B1.43: + fldl ones@GOTOFF(%edx,%ebx,8) + testl %eax, %eax + fstl 48(%esp) + fldt 8(%ebp) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_48H@GOTOFF(%edx) + fld %st(0) + fadd %st(2), %st + fstpt 32(%esp) + fldt 32(%esp) + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fldt 84+_Q@GOTOFF(%edx) + fmul %st(5), %st + fldt 72+_Q@GOTOFF(%edx) + fmul %st(6), %st + fldt 60+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(6), %st + fldt 48+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(6), %st + fldt 36+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(6), %st + fldt 24+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(6), %st + fldt 12+_Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(6) + fld %st(2) + fmul %st(3), %st + fldt _Q@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fld %st(1) + fmul %st(1), %st + fld %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fldt 96+_Q@GOTOFF(%edx) + fmul %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(5) + fxch %st(4) + fmulp %st, %st(2) + fld %st(3) + fmul %st(3), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldl 48(%esp) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.45 +..B1.44: + fldt 32(%esp) + fstpt 60(%esp) +..B1.89: + fldcw 46(%esp) +..B1.45: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.81 +..B1.47: + orl $-64768, %eax + movw %ax, 44(%esp) +..B1.48: + fldcw 44(%esp) +..B1.49: + movzbl 17(%ebp), %ebx + movl $1, %edi + andl $128, %ebx + shrl $7, %ebx +..B1.50: + fldt 8(%ebp) + fmull ones@GOTOFF(%edx,%ebx,8) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%edx) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(2), %st + fadd %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmul %st(1), %st + movl 60(%esp), %eax + fsubrp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(2) + movsbl %al, %esi + fsub %st(1), %st + fldl _TWO_32P@GOTOFF(%edx) + subl %esi, %eax + fmul %st(1), %st + fxch %st(1) + fmull _TWO_32@GOTOFF(%edx) + shll $4, %esi + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + shrl $8, %eax + fxch %st(2) + fsubrp %st, %st(3) + movl %eax, %ecx + negl %eax + shll $23, %ecx + fadd %st(2), %st + fld %st(0) + addl $1056964608, %ecx + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + shll $23, %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + addl $1056964608, %eax + fldt 12+_P@GOTOFF(%edx) + movl %ecx, 12(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + movl %eax, 28(%esp) + fxch %st(2) + faddp %st, %st(4) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fmulp %st, %st(1) + fld %st(2) + fadd %st(1), %st + fxch %st(3) + fsubrp %st, %st(1) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%esi) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%esi) + negl %esi + fstpt 32(%esp) + fldt 32(%esp) + testl %edi, %edi + fadd %st(1), %st + fmulp %st, %st(4) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(4) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%esi) + fld %st(0) + fmul %st(4), %st + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%esi) + fld %st(0) + fadd %st(3), %st + fmulp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(3) + fstpt 48(%esp) + fldt 32(%esp) + fld %st(0) + fmul %st(5), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(5) + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(3) + fld %st(0) + fsub %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + fsubrp %st, %st(1) + faddp %st, %st(2) + fldt 48(%esp) + faddp %st, %st(2) + flds 12(%esp) + fmull ones@GOTOFF(%edx,%ebx,8) + fmul %st, %st(4) + fld %st(4) + fxch %st(1) + fmul %st, %st(2) + flds 28(%esp) + fmull ones@GOTOFF(%edx,%ebx,8) + fmul %st, %st(5) + fxch %st(2) + fsub %st(5), %st + fsubr %st, %st(6) + fxch %st(5) + fsubrp %st, %st(6) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + je ..B1.91 +..B1.51: + fstps 28(%esp) + fstps 12(%esp) +..B1.90: + fldcw 46(%esp) + jmp ..B1.52 +..B1.91: + fstp %st(0) + fstp %st(0) +..B1.52: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.53: + cmpl $16396, %ecx + jge ..B1.61 +..B1.54: + movzwl 46(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.82 +..B1.55: + orl $-64768, %ecx + movw %cx, 44(%esp) +..B1.56: + fldcw 44(%esp) +..B1.57: + movzbl 17(%ebp), %ebx + movl $1, %esi + andl $128, %ebx + shrl $7, %ebx +..B1.58: + fldl ones@GOTOFF(%edx,%ebx,8) + fstpt 16(%esp) + fldt 16(%esp) + fldt 8(%ebp) + fmulp %st, %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%edx) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fmul %st(2), %st + movzwl 24(%esp), %ecx + fadd %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + andl $-32768, %ecx + movl 60(%esp), %eax + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fmul %st(1), %st + movsbl %al, %ebx + fsubrp %st, %st(2) + fld %st(1) + subl %ebx, %eax + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(2) + shll $4, %ebx + fsub %st(1), %st + fldl _TWO_32@GOTOFF(%edx) + fldl _TWO_32P@GOTOFF(%edx) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + shrl $8, %eax + fxch %st(2) + fsubrp %st, %st(1) + fld %st(0) + addl $16350, %eax + andl $32767, %eax + fxch %st(1) + fsubr %st, %st(4) + orl %eax, %ecx + fxch %st(3) + fsubrp %st, %st(4) + movw %cx, 24(%esp) + testl %esi, %esi + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(5) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%ebx) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%ebx) + fld %st(0) + fmul %st(5), %st + fxch %st(4) + fadd %st, %st(5) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldt 16(%esp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%esp) + je ..B1.60 +..B1.59: + fldcw 46(%esp) +..B1.60: + fldt 32(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + je ..B1.84 +..B1.62: + movzwl 46(%esp), %ebx + movl %ebx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.83 +..B1.63: + orl $-64768, %ebx + movw %bx, 44(%esp) +..B1.64: + fldcw 44(%esp) +..B1.65: + movzwl 16(%ebp), %ecx + movl $1, %esi + andl $32767, %ecx +..B1.66: + cmpl $32767, %ecx + jne ..B1.68 +..B1.67: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.69 +..B1.68: + fldt _large_value_80@GOTOFF(%edx) + movzbl 17(%ebp), %ecx + andl $128, %ecx + shrl $7, %ecx + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %ebx + fldt _large_value_80@GOTOFF(%edx,%ebx) + fmulp %st, %st(1) + fstpt 16(%esp) +..B1.69: + testl %esi, %esi + je ..B1.71 +..B1.70: + fldcw 46(%esp) +..B1.71: + fldt 16(%esp) + addl $84, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.72: + cmpl $0, 12(%ebp) + jne ..B1.74 +..B1.73: + cmpl $0, 8(%ebp) + je ..B1.75 +..B1.74: + fldt _small_value_80@GOTOFF(%edx) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%edx) + fmul %st(1), %st + movzbl 17(%ebp), %ecx + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%edx) + andl $128, %ecx + shrl $7, %ecx + fstpt 16(%esp) + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %ebx + fldt _small_value_80@GOTOFF(%edx,%ebx) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.75: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.15 +..B1.76: + xorl %esi, %esi + jmp ..B1.13 +..B1.77: + xorl %eax, %eax + jmp ..B1.22 +..B1.78: + xorl %eax, %eax + jmp ..B1.29 +..B1.79: + xorl %eax, %eax + jmp ..B1.36 +..B1.80: + xorl %eax, %eax + jmp ..B1.43 +..B1.81: + xorl %edi, %edi + jmp ..B1.50 +..B1.82: + xorl %esi, %esi + jmp ..B1.58 +..B1.83: + xorl %esi, %esi + jmp ..B1.66 +..B1.84: + cmpl $-1317741120, %esi + jb ..B1.54 +..B1.85: + jne ..B1.62 +..B1.86: + cmpl $833536233, 8(%ebp) + jbe ..B1.54 + jmp ..B1.62 + .align 16,0x90 + .type sinhl,@function + .size sinhl,.-sinhl + .data +# -- End sinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 2 +_Q3: + .word 21845 + .word 44373 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 29491 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 1838 + .word 3745 + .word 35050 + .word 34952 + .word 16376 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 56472 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 6470 + .word 8609 + .word 207 + .word 53261 + .word 16370 + .word 0 + .word 51515 + .word 9159 + .word 10794 + .word 47344 + .word 16364 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 43620 + .word 43690 + .word 43690 + .word 43690 + .word 16364 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 52382 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 44665 + .word 46658 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 15678 + .word 35942 + .word 11071 + .word 55090 + .word 16357 + .word 0 + .word 10412 + .word 23121 + .word 12507 + .word 45202 + .word 16350 + .word 0 + .word 37213 + .word 41879 + .word 65084 + .word 55102 + .word 16342 + .word 0 + .word 1721 + .word 42148 + .word 19309 + .word 52099 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16380 + .word 0 + .type _Q,@object + .size _Q,108 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sinl.S b/external/sgx_libm/ia32/sinl.S new file mode 100644 index 0000000000..62c48998f9 --- /dev/null +++ b/external/sgx_libm/ia32/sinl.S @@ -0,0 +1,1038 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinl.c" + .text +..TXTST0: +# -- Begin sinl + .text + .align 16,0x90 + .globl sinl +sinl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $180, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 152(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + movzwl 14(%esp), %edx + cmpl $16378, %eax + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jge ..B1.41 +..B1.4: + cmpl $16372, %eax + jge ..B1.33 +..B1.5: + cmpl $16364, %eax + jge ..B1.25 +..B1.6: + cmpl $16308, %eax + jge ..B1.17 +..B1.7: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.75 +..B1.8: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movzwl 16(%ebp), %eax + movl $1, %esi + andl $32767, %eax +..B1.11: + testl %eax, %eax + jle ..B1.71 +..B1.12: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ebx) + fstpt 16(%esp) +..B1.13: + testl %esi, %esi + je ..B1.15 +..B1.14: + fldcw 14(%esp) +..B1.15: + movl 152(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.16: + fldt 16(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.77 +..B1.18: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.19: + fldcw 12(%esp) +..B1.20: + movl $1, %eax +..B1.21: + fldt 8(%ebp) + testl %eax, %eax + fldt _SP3@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.23 +..B1.22: + fldcw 14(%esp) +..B1.23: + movl 152(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.24: + fldt 16(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.79 +..B1.26: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.27: + fldcw 12(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_SP2@GOTOFF(%ebx) + fmul %st(1), %st + fldt _SP2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.31 +..B1.30: + fldcw 14(%esp) +..B1.31: + movl 152(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.32: + fldt 16(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.33: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.81 +..B1.34: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.35: + fldcw 12(%esp) +..B1.36: + movl $1, %eax +..B1.37: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_SP1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_SP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_SP1@GOTOFF(%ebx) + fmulp %st, %st(2) + fldt _SP1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.39 +..B1.38: + fldcw 14(%esp) +..B1.39: + movl 152(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.40: + fldt 16(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + movl %edx, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.84 +..B1.42: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.43: + fldcw 12(%esp) +..B1.44: + movzwl 16(%ebp), %eax + movl $1, %edi + andl $32767, %eax +..B1.45: + movzbl 17(%ebp), %esi + andl $128, %esi + shrl $7, %esi + cmpl $16413, %eax + jge ..B1.52 +..B1.46: + fldt 8(%ebp) + fldl _Pi4Inv@GOTOFF(%ebx) + fxch %st(1) + fmull _ones@GOTOFF(%ebx,%esi,8) + fmul %st, %st(1) + fxch %st(1) + fstpt 24(%esp) + movzwl 32(%esp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.48 +..B1.47: + fldl _TWO_52H@GOTOFF(%ebx) + movl $1, %edx + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(1) + fsub %st(1), %st + fxch %st(2) + fxch %st(1) + fxch %st(2) + jmp ..B1.63 +..B1.48: + fldl _TWO_32H@GOTOFF(%ebx) + negl %ecx + addl $30, %ecx + movl 28(%esp), %edx + shrl %cl, %edx + incl %edx + movl %edx, %ecx + andl $-2, %ecx + movl %ecx, 16(%esp) + cmpl $16400, %eax + fildl 16(%esp) + jge ..B1.50 +..B1.49: + fldl _Pi04x3@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x3@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x3@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + jmp ..B1.51 +..B1.50: + fldl _Pi04x5@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x5@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 24+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl 32+_Pi04x5@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) +..B1.51: + fldl _TWO_52H@GOTOFF(%ebx) + movl %edx, %eax + fmul %st(1), %st + fld %st(1) + shrl $2, %eax + fadd %st(1), %st + xorl %eax, %esi + fsubp %st, %st(1) + andl $1, %esi + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fxch %st(1) + fxch %st(2) + jmp ..B1.63 +..B1.52: + cmpl $32767, %eax + jne ..B1.61 +..B1.53: + cmpl $-2147483648, 12(%ebp) + jne ..B1.56 +..B1.54: + cmpl $0, 8(%ebp) + jne ..B1.56 +..B1.55: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt 16(%esp) + jmp ..B1.57 +..B1.56: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt 16(%esp) +..B1.57: + testl %edi, %edi + je ..B1.59 +..B1.58: + fldcw 14(%esp) +..B1.59: + movl 152(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.60: + fldt 16(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + fldt 8(%ebp) + addl $-32, %esp + fmull _ones@GOTOFF(%ebx,%esi,8) + lea 168(%esp), %eax + fstpt (%esp) + movl $0, 12(%esp) + movl %eax, 16(%esp) + call __libm_reduce_pi04l +..B1.87: + movl %eax, %edx + addl $32, %esp +..B1.62: + fldl 136(%esp) + incl %edx + fldl _TWO_52H@GOTOFF(%ebx) + movl %edx, %eax + fmul %st(1), %st + fld %st(0) + shrl $2, %eax + fadd %st(2), %st + xorl %eax, %esi + fsubp %st, %st(1) + fld %st(0) + andl $1, %esi + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddl 144(%esp) + fadd %st, %st(1) +..B1.63: + fld %st(2) + testb $2, %dl + fmul %st(1), %st + fld %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 56(%esp) + fldt 56(%esp) + fld %st(3) + fmul %st(4), %st + fld %st(0) + fadd %st(2), %st + fstpt 72(%esp) + fldt 72(%esp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 88(%esp) + fldt 88(%esp) + fxch %st(1) + fstpt 104(%esp) + fldt 104(%esp) + fmul %st(0), %st + fld %st(0) + faddp %st, %st(2) + fldl _TWO_53H@GOTOFF(%ebx) + fstpt 40(%esp) + fldl _ones@GOTOFF(%ebx,%esi,8) + fstpl 16(%esp) + je ..B1.65 +..B1.64: + fstp %st(2) + fstp %st(2) + fstp %st(2) + fldt 96+_CP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 84+_CP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 72+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_CP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt _CP@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 72(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 88(%esp) + fldt 56(%esp) + fldt 104(%esp) + fldt 40(%esp) + fldt 120+_CP@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(5) + fldt 108+_CP@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fld %st(4) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fadd %st(2), %st + fmul %st, %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldl _ones@GOTOFF(%ebx) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fldl 16(%esp) + fmul %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 120(%esp) + jmp ..B1.66 +..B1.65: + fldt 96+_SP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 84+_SP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 72+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 36+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 12+_SP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt _SP@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 72(%esp) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 88(%esp) + fldt 120+_SP@GOTOFF(%ebx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + fldt 108+_SP@GOTOFF(%ebx) + fldt 56(%esp) + fmul %st(1), %st + faddp %st, %st(3) + fldt 104(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fld %st(3) + fldt 40(%esp) + fmul %st(2), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fldl 16(%esp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 120(%esp) +..B1.66: + testl %edi, %edi + je ..B1.89 +..B1.67: + fstpt 24(%esp) +..B1.88: + fldcw 14(%esp) + jmp ..B1.68 +..B1.89: + fstp %st(0) +..B1.68: + movl 152(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.70 +..B1.69: + fldt 120(%esp) + addl $180, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.70: + call __stack_chk_fail@PLT +..B1.71: + cmpl $0, 12(%ebp) + jne ..B1.73 +..B1.72: + cmpl $0, 8(%ebp) + je ..B1.74 +..B1.73: + fldt _small_value_80@GOTOFF(%ebx) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + movzbl 17(%ebp), %edx + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ebx) + andl $128, %edx + shrl $7, %edx + fstpt 16(%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.13 +..B1.74: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.13 +..B1.75: + xorl %esi, %esi + jmp ..B1.11 +..B1.77: + xorl %eax, %eax + jmp ..B1.21 +..B1.79: + xorl %eax, %eax + jmp ..B1.29 +..B1.81: + xorl %eax, %eax + jmp ..B1.37 +..B1.84: + xorl %edi, %edi + jmp ..B1.45 + .align 16,0x90 + .type sinl,@function + .size sinl,.-sinl + .data +# -- End sinl + .section .rodata, "a" + .align 16 + .align 16 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 16 +_SP3: + .word 17476 + .word 43656 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .type _SP3,@object + .size _SP3,12 + .space 4, 0x00 # pad + .align 16 +_SP2: + .word 43210 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 1587 + .word 57422 + .word 34932 + .word 34952 + .word 16376 + .word 0 + .type _SP2,@object + .size _SP2,24 + .space 8, 0x00 # pad + .align 16 +_SP1: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 12518 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 43088 + .word 7396 + .word 207 + .word 53261 + .word 49138 + .word 0 + .word 55827 + .word 48618 + .word 3602 + .word 47342 + .word 16364 + .word 0 + .type _SP1,@object + .size _SP1,48 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .space 8, 0x00 # pad + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_Pi04x3: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _Pi04x3,@object + .size _Pi04x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi04x5: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _Pi04x5,@object + .size _Pi04x5,40 + .space 8, 0x00 # pad + .align 16 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .space 8, 0x00 # pad + .align 16 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .type _CP,@object + .size _CP,132 + .space 12, 0x00 # pad + .align 16 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .type _SP,@object + .size _SP,132 + .space 12, 0x00 # pad + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sqrt_tab_t.S b/external/sgx_libm/ia32/sqrt_tab_t.S new file mode 100644 index 0000000000..7fb5162aff --- /dev/null +++ b/external/sgx_libm/ia32/sqrt_tab_t.S @@ -0,0 +1,816 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrt_tab_t.c" + .section .rodata, "a" + .align 32 + .align 32 + .hidden __sqrt_t_table + .globl __sqrt_t_table +__sqrt_t_table: + .long 0x400672f9 + .long 0xc060f4f5 + .long 0xba659415,0x40052c06 + .long 0x4003de5a + .long 0xc05e5b2f + .long 0xfe66c797,0x4005170e + .long 0x40015b59 + .long 0xc05bce24 + .long 0x13b32f30,0x40050255 + .long 0x3ffdd2b8 + .long 0xc0594d7e + .long 0xdae79d26,0x4004edd7 + .long 0x3ff90fa1 + .long 0xc056d8e8 + .long 0x13220f7f,0x4004d996 + .long 0x3ff46c51 + .long 0xc0547012 + .long 0xb3fa6a49,0x4004c58e + .long 0x3fefe7bb + .long 0xc05212ae + .long 0xa20bcbc6,0x4004b1c0 + .long 0x3feb80db + .long 0xc04fc070 + .long 0xc76937e4,0x40049e2a + .long 0x3fe736b7 + .long 0xc04d790f + .long 0x1f93d776,0x40048acc + .long 0x3fe30860 + .long 0xc04b3c44 + .long 0xa15ae4b0,0x400477a3 + .long 0x3fdef4f0 + .long 0xc04909cc + .long 0x697f4726,0x400464b0 + .long 0x3fdafb8a + .long 0xc046e163 + .long 0x6403b289,0x400451f1 + .long 0x3fd71b59 + .long 0xc044c2ca + .long 0xb7aecc11,0x40043f65 + .long 0x3fd35392 + .long 0xc042adc3 + .long 0x76dd1156,0x40042d0c + .long 0x3fcfa371 + .long 0xc040a213 + .long 0xd01983f9,0x40041ae4 + .long 0x3fcc0a37 + .long 0xc03e9f7d + .long 0xbecf4a2b,0x400408ed + .long 0x3fc88730 + .long 0xc03ca5ca + .long 0x7b0eeed7,0x4003f726 + .long 0x3fc519ad + .long 0xc03ab4c5 + .long 0x50846ea3,0x4003e58e + .long 0x3fc1c105 + .long 0xc038cc36 + .long 0x3decb5a1,0x4003d424 + .long 0x3fbe7c97 + .long 0xc036ebed + .long 0xb2048812,0x4003c2e7 + .long 0x3fbb4bc6 + .long 0xc03513b5 + .long 0xb29c9700,0x4003b1d7 + .long 0x3fb82dfc + .long 0xc0334360 + .long 0xa89c0a0a,0x4003a0f3 + .long 0x3fb522a8 + .long 0xc0317abe + .long 0xc440fe15,0x4003903a + .long 0x3fb2293e + .long 0xc02fb9a2 + .long 0x596206ff,0x40037fac + .long 0x3faf4138 + .long 0xc02dffe0 + .long 0xb44972f3,0x40036f47 + .long 0x3fac6a14 + .long 0xc02c4d4c + .long 0x1107001d,0x40035f0c + .long 0x3fa9a354 + .long 0xc02aa1be + .long 0xe7c62025,0x40034ef8 + .long 0x3fa6ec80 + .long 0xc028fd0d + .long 0x815ec2da,0x40033f0d + .long 0x3fa44523 + .long 0xc0275f11 + .long 0x2e0b0c0e,0x40032f49 + .long 0x3fa1accc + .long 0xc025c7a5 + .long 0x66b9f8b6,0x40031fab + .long 0x3f9f230f + .long 0xc02436a3 + .long 0x788665c8,0x40031033 + .long 0x3f9ca783 + .long 0xc022abe8 + .long 0xded1e594,0x400300e0 + .long 0x3f9a39c2 + .long 0xc0212751 + .long 0x0842a075,0x4002f1b3 + .long 0x3f97d96b + .long 0xc01fa8bb + .long 0x494fbc25,0x4002e2a9 + .long 0x3f95861f + .long 0xc01e3006 + .long 0x2b018f07,0x4002d3c3 + .long 0x3f933f82 + .long 0xc01cbd11 + .long 0x142c8510,0x4002c500 + .long 0x3f91053c + .long 0xc01b4fbd + .long 0x7f1daa26,0x4002b65f + .long 0x3f8ed6f7 + .long 0xc019e7eb + .long 0xdda5e7e2,0x4002a7e0 + .long 0x3f8cb461 + .long 0xc018857f + .long 0xc9948908,0x40029983 + .long 0x3f8a9d2a + .long 0xc017285b + .long 0xaa59eeeb,0x40028b47 + .long 0x3f889104 + .long 0xc015d062 + .long 0xf2821162,0x40027d2b + .long 0x3f868fa5 + .long 0xc0147d7c + .long 0x669445ed,0x40026f30 + .long 0x3f8498c3 + .long 0xc0132f8a + .long 0x3b85fad8,0x40026154 + .long 0x3f82ac1a + .long 0xc011e676 + .long 0x3e988364,0x40025397 + .long 0x3f80c964 + .long 0xc010a224 + .long 0xcf7601fc,0x400245f8 + .long 0x3f7de0c1 + .long 0xc00f627e + .long 0xaab7acb5,0x40023878 + .long 0x3f7a419f + .long 0xc00e276a + .long 0x36aab17c,0x40022b16 + .long 0x3f76b4e6 + .long 0xc00cf0d1 + .long 0x0f2aa54c,0x40021dd1 + .long 0x3f733a1e + .long 0xc00bbe9d + .long 0xdacdcc1a,0x400210a8 + .long 0x3f6fd0d4 + .long 0xc00a90b8 + .long 0x30e54b08,0x4002039d + .long 0x3f6c7897 + .long 0xc009670b + .long 0x8e05e1b3,0x4001f6ad + .long 0x3f6930fa + .long 0xc0084182 + .long 0xa51b1d74,0x4001e9d9 + .long 0x3f65f994 + .long 0xc0072009 + .long 0x1cf6297b,0x4001dd21 + .long 0x3f62d1fe + .long 0xc006028b + .long 0x8103f9e2,0x4001d083 + .long 0x3f5fb9d5 + .long 0xc004e8f5 + .long 0x7cc51dba,0x4001c400 + .long 0x3f5cb0b7 + .long 0xc003d333 + .long 0xa3e7f161,0x4001b797 + .long 0x3f59b649 + .long 0xc002c134 + .long 0xb4f86544,0x4001ab48 + .long 0x3f56ca2e + .long 0xc001b2e5 + .long 0x4bc09f7e,0x40019f13 + .long 0x3f53ec0f + .long 0xc000a834 + .long 0x04a8d6a9,0x400192f7 + .long 0x3f511b96 + .long 0xbfff4221 + .long 0x9d5a7e63,0x400186f3 + .long 0x3f4e5870 + .long 0xbffd3ad2 + .long 0xb211c804,0x40017b08 + .long 0x3f4ba24c + .long 0xbffb3a5b + .long 0xfc173425,0x40016f35 + .long 0x3f48f8dc + .long 0xbff9409b + .long 0x1e599490,0x4001637b + .long 0x3f465bd5 + .long 0xbff74d73 + .long 0xc880b659,0x400157d7 + .long 0x3f43caeb + .long 0xbff560c5 + .long 0xbd156bcf,0x40014c4b + .long 0x3f4145d7 + .long 0xbff37a71 + .long 0x9283ab1d,0x400140d6 + .long 0x3f3ecc53 + .long 0xbff19a5c + .long 0x19073c6b,0x40013578 + .long 0x3f3c5e1c + .long 0xbfefc069 + .long 0xfd4a0663,0x40012a2f + .long 0x3f39faef + .long 0xbfedec7b + .long 0xede7b908,0x40011efd + .long 0x3f37a28c + .long 0xbfec1e78 + .long 0xb252b4d7,0x400113e1 + .long 0x3f3554b6 + .long 0xbfea5645 + .long 0xf9904832,0x400108da + .long 0x3f33112e + .long 0xbfe893c7 + .long 0x7e150822,0x4000fde9 + .long 0x3f30d7ba + .long 0xbfe6d6e5 + .long 0xfd1a5086,0x4000f30c + .long 0x3f2ea821 + .long 0xbfe51f87 + .long 0x3d632fc4,0x4000e845 + .long 0x3f2c822c + .long 0xbfe36d94 + .long 0xf11c7d33,0x4000dd91 + .long 0x3f2a65a2 + .long 0xbfe1c0f3 + .long 0xd61ea754,0x4000d2f2 + .long 0x3f285250 + .long 0xbfe0198f + .long 0xc0d51627,0x4000c867 + .long 0x3f264803 + .long 0xbfde7750 + .long 0x61244ec6,0x4000bdf0 + .long 0x3f244687 + .long 0xbfdcda1f + .long 0x7a6b2e99,0x4000b38c + .long 0x3f224dad + .long 0xbfdb41e7 + .long 0xd19f4764,0x4000a93b + .long 0x3f205d44 + .long 0xbfd9ae92 + .long 0x2ad2e77d,0x40009efe + .long 0x3f1e751f + .long 0xbfd8200d + .long 0x5dbcaf97,0x400094d3 + .long 0x3f1c9510 + .long 0xbfd69641 + .long 0x14b04d5e,0x40008abb + .long 0x3f1abcec + .long 0xbfd5111c + .long 0x2cda2e67,0x400080b5 + .long 0x3f18ec88 + .long 0xbfd3908a + .long 0x6ab42acc,0x400076c1 + .long 0x3f1723ba + .long 0xbfd21477 + .long 0x8e9d45e3,0x40006cdf + .long 0x3f156259 + .long 0xbfd09cd0 + .long 0x62171386,0x4000630f + .long 0x3f13a83e + .long 0xbfcf2984 + .long 0xbfb6fb6a,0x40005950 + .long 0x3f11f542 + .long 0xbfcdba80 + .long 0x68a7e5f7,0x40004fa3 + .long 0x3f104940 + .long 0xbfcc4fb3 + .long 0x2ef38d27,0x40004607 + .long 0x3f0ea414 + .long 0xbfcae90c + .long 0xe03435f5,0x40003c7b + .long 0x3f0d0598 + .long 0xbfc98678 + .long 0x3b99fee4,0x40003301 + .long 0x3f0b6dab + .long 0xbfc827e9 + .long 0x28d4ef26,0x40002997 + .long 0x3f09dc2b + .long 0xbfc6cd4e + .long 0x6d906b03,0x4000203d + .long 0x3f0850f6 + .long 0xbfc57696 + .long 0xd0880103,0x400016f3 + .long 0x3f06cbec + .long 0xbfc423b3 + .long 0x37509185,0x40000dba + .long 0x3f054cee + .long 0xbfc2d495 + .long 0x66ce8c53,0x40000490 + .long 0x3f03d3dc + .long 0xbfc1892d + .long 0x72279bc0,0x3ffff6ec + .long 0x3f026099 + .long 0xbfc0416c + .long 0xeda5cd81,0x3fffe4d6 + .long 0x3f00f308 + .long 0xbfbefd45 + .long 0x0c012834,0x3fffd2e0 + .long 0x3eff1616 + .long 0xbfbdbca8 + .long 0x52f75b3b,0x3fffc107 + .long 0x3efc510e + .long 0xbfbc7f88 + .long 0x799a7f94,0x3fffaf4c + .long 0x3ef996c2 + .long 0xbfbb45d9 + .long 0x55edcc30,0x3fff9daf + .long 0x3ef6e6fb + .long 0xbfba0f8b + .long 0x537eb099,0x3fff8c2f + .long 0x3ef44186 + .long 0xbfb8dc92 + .long 0x38cd722f,0x3fff7acc + .long 0x3ef1a631 + .long 0xbfb7ace2 + .long 0xc800858f,0x3fff6985 + .long 0x3eef14c9 + .long 0xbfb6806e + .long 0xaed5086e,0x3fff585b + .long 0x3eec8d1e + .long 0xbfb55729 + .long 0x88bfcc7e,0x3fff474d + .long 0x3eea0f02 + .long 0xbfb43109 + .long 0x3db0d3c5,0x3fff365b + .long 0x3ee79a45 + .long 0xbfb30e00 + .long 0x4f3507e4,0x3fff2584 + .long 0x3ee52ebb + .long 0xbfb1ee03 + .long 0x7dab64e4,0x3fff14c8 + .long 0x3ee2cc37 + .long 0xbfb0d107 + .long 0x9247f5f1,0x3fff0427 + .long 0x3ee0728f + .long 0xbfafb700 + .long 0x252987ab,0x3ffef3a1 + .long 0x3ede2198 + .long 0xbfae9fe4 + .long 0x12fb7286,0x3ffee335 + .long 0x3edbd929 + .long 0xbfad8ba8 + .long 0x0e1fbfd6,0x3ffed2e3 + .long 0x3ed9991a + .long 0xbfac7a41 + .long 0xc33c7a14,0x3ffec2aa + .long 0x3ed76144 + .long 0xbfab6ba5 + .long 0xf7968902,0x3ffeb28b + .long 0x3ed53180 + .long 0xbfaa5fca + .long 0x72271f31,0x3ffea286 + .long 0x3ed309a8 + .long 0xbfa956a6 + .long 0xf446dfa2,0x3ffe9299 + .long 0x3ed0e998 + .long 0xbfa8502f + .long 0x31fc7113,0x3ffe82c6 + .long 0x3eced12c + .long 0xbfa74c5a + .long 0xc17a77a1,0x3ffe730a + .long 0x3eccc040 + .long 0xbfa64b20 + .long 0xb683d568,0x3ffe6367 + .long 0x3ecab6b3 + .long 0xbfa54c76 + .long 0x93851ebf,0x3ffe53dc + .long 0x3ec8b462 + .long 0xbfa45054 + .long 0x48e8d2d8,0x3ffe4469 + .long 0x3ec6b92d + .long 0xbfa356b0 + .long 0x72ed724b,0x3ffe350d + .long 0x3ec4c4f3 + .long 0xbfa25f82 + .long 0xf5acec61,0x3ffe25c8 + .long 0x3ec2d795 + .long 0xbfa16ac0 + .long 0x67c5c2c3,0x3ffe169b + .long 0x3ec0f0f5 + .long 0xbfa07864 + .long 0xd8265439,0x3ffe0784 + .long 0x3fbe23c8 + .long 0xc01f118b + .long 0x1ec5a532,0x3ffdf113 + .long 0x3fba7d85 + .long 0xc01d3ac5 + .long 0x0000d4c8,0x3ffdd36c + .long 0x3fb6f02d + .long 0xc01b6d00 + .long 0x57cb9031,0x3ffdb61c + .long 0x3fb37ae5 + .long 0xc019a7fe + .long 0x72ed1c77,0x3ffd9922 + .long 0x3fb01cdd + .long 0xc017eb83 + .long 0x95b0b15c,0x3ffd7c7c + .long 0x3facd54f + .long 0xc0163758 + .long 0x6603fec1,0x3ffd6029 + .long 0x3fa9a37b + .long 0xc0148b45 + .long 0x469777ae,0x3ffd4427 + .long 0x3fa686a9 + .long 0xc012e714 + .long 0xa71adcce,0x3ffd2874 + .long 0x3fa37e28 + .long 0xc0114a91 + .long 0x0c38599d,0x3ffd0d10 + .long 0x3fa08950 + .long 0xc00fb58a + .long 0xfc8f14cb,0x3ffcf1f7 + .long 0x3f9da77d + .long 0xc00e27d0 + .long 0x5027d5b6,0x3ffcd72b + .long 0x3f9ad814 + .long 0xc00ca133 + .long 0x77f69e05,0x3ffcbca8 + .long 0x3f981a7f + .long 0xc00b2187 + .long 0x4e14c785,0x3ffca26e + .long 0x3f956e2d + .long 0xc009a89f + .long 0x67cdb787,0x3ffc887b + .long 0x3f92d292 + .long 0xc0083650 + .long 0x7d1a45e5,0x3ffc6ece + .long 0x3f90472b + .long 0xc006ca73 + .long 0x887296e4,0x3ffc5566 + .long 0x3f8dcb76 + .long 0xc00564de + .long 0x1b6717e3,0x3ffc3c42 + .long 0x3f8b5ef7 + .long 0xc004056b + .long 0x264323b8,0x3ffc2360 + .long 0x3f890138 + .long 0xc002abf5 + .long 0x8c0c1853,0x3ffc0abf + .long 0x3f86b1c6 + .long 0xc0015858 + .long 0x4069b804,0x3ffbf25f + .long 0x3f847032 + .long 0xc0000a6f + .long 0xf2c0f56b,0x3ffbda3d + .long 0x3f823c13 + .long 0xbffd8435 + .long 0xe82b41be,0x3ffbc25a + .long 0x3f801501 + .long 0xbffafe6e + .long 0xd0c8f1c2,0x3ffbaab4 + .long 0x3f7bf536 + .long 0xbff8834b + .long 0xc1a3163f,0x3ffb934a + .long 0x3f77d900 + .long 0xbff6128d + .long 0xc6e21d7e,0x3ffb7c1b + .long 0x3f73d4ab + .long 0xbff3abf8 + .long 0xe60015a5,0x3ffb6526 + .long 0x3f6fe784 + .long 0xbff14f50 + .long 0x21cbd876,0x3ffb4e6b + .long 0x3f6c10e1 + .long 0xbfeefc5d + .long 0x9ee07b4c,0x3ffb37e7 + .long 0x3f68501d + .long 0xbfecb2e7 + .long 0x6d2d48b6,0x3ffb219b + .long 0x3f64a499 + .long 0xbfea72b8 + .long 0xa81c9b61,0x3ffb0b85 + .long 0x3f610dbb + .long 0xbfe83b9d + .long 0x902fdc83,0x3ffaf5a5 + .long 0x3f5d8aee + .long 0xbfe60d61 + .long 0x27f22c44,0x3ffadffa + .long 0x3f5a1ba3 + .long 0xbfe3e7d3 + .long 0xa3884d02,0x3ffaca82 + .long 0x3f56bf51 + .long 0xbfe1cac5 + .long 0x554d369e,0x3ffab53e + .long 0x3f537570 + .long 0xbfdfb606 + .long 0x5450035a,0x3ffaa02c + .long 0x3f503d7f + .long 0xbfdda969 + .long 0xe28ff013,0x3ffa8b4b + .long 0x3f4d1702 + .long 0xbfdba4c2 + .long 0x3ccf3bef,0x3ffa769c + .long 0x3f4a017f + .long 0xbfd9a7e6 + .long 0xadd0d7d8,0x3ffa621c + .long 0x3f46fc82 + .long 0xbfd7b2ab + .long 0x73a23063,0x3ffa4dcc + .long 0x3f440799 + .long 0xbfd5c4e8 + .long 0xd9b8e6fd,0x3ffa39aa + .long 0x3f412258 + .long 0xbfd3de77 + .long 0x47a99575,0x3ffa25b7 + .long 0x3f3e4c53 + .long 0xbfd1ff2e + .long 0xd6d4c329,0x3ffa11f0 + .long 0x3f3b8525 + .long 0xbfd026eb + .long 0x1e725d64,0x3ff9fe57 + .long 0x3f38cc6a + .long 0xbfce5587 + .long 0x4a856a92,0x3ff9eae9 + .long 0x3f3621c3 + .long 0xbfcc8ae0 + .long 0xd3534a3f,0x3ff9d7a6 + .long 0x3f3384d1 + .long 0xbfcac6d1 + .long 0xf6170fe5,0x3ff9c48e + .long 0x3f30f53c + .long 0xbfc9093b + .long 0x43d296cd,0x3ff9b1a1 + .long 0x3f2e72ac + .long 0xbfc751fb + .long 0xfbbf8768,0x3ff99edc + .long 0x3f2bfccb + .long 0xbfc5a0f2 + .long 0xaa7c60ad,0x3ff98c41 + .long 0x3f299349 + .long 0xbfc3f600 + .long 0x9e5e0c30,0x3ff979ce + .long 0x3f2735d5 + .long 0xbfc25106 + .long 0x47a967c7,0x3ff96783 + .long 0x3f24e423 + .long 0xbfc0b1e7 + .long 0x213a91b3,0x3ff9555f + .long 0x3f229de8 + .long 0xbfbf1887 + .long 0xb92f1e71,0x3ff94361 + .long 0x3f2062db + .long 0xbfbd84c7 + .long 0x4e9fbb55,0x3ff9318a + .long 0x3f1e32b7 + .long 0xbfbbf68e + .long 0x8c3e135d,0x3ff91fd8 + .long 0x3f1c0d36 + .long 0xbfba6dc0 + .long 0xe5486399,0x3ff90e4b + .long 0x3f19f217 + .long 0xbfb8ea42 + .long 0xbecd10bc,0x3ff8fce3 + .long 0x3f17e11a + .long 0xbfb76bfc + .long 0xbe525978,0x3ff8eb9f + .long 0x3f15d9ff + .long 0xbfb5f2d3 + .long 0x48293568,0x3ff8da7f + .long 0x3f13dc8c + .long 0xbfb47eb1 + .long 0x05d5e650,0x3ff8c982 + .long 0x3f11e884 + .long 0xbfb30f7c + .long 0x60ba5dac,0x3ff8b8a7 + .long 0x3f0ffdb0 + .long 0xbfb1a51e + .long 0xefd22e82,0x3ff8a7ee + .long 0x3f0e1bd7 + .long 0xbfb03f80 + .long 0x47805b92,0x3ff89758 + .long 0x3f0c42c3 + .long 0xbfaede8a + .long 0xcd57cc04,0x3ff886e2 + .long 0x3f0a7241 + .long 0xbfad8229 + .long 0x46b3d0d8,0x3ff8768e + .long 0x3f08aa1e + .long 0xbfac2a48 + .long 0x4cc7ad59,0x3ff8665a + .long 0x3f06ea27 + .long 0xbfaad6cf + .long 0x3347fcf1,0x3ff85646 + .long 0x3f05322e + .long 0xbfa987ad + .long 0xcc7c68cf,0x3ff84651 + .long 0x3f038204 + .long 0xbfa83ccd + .long 0x95d48bda,0x3ff8367c + .long 0x3f01d97a + .long 0xbfa6f61c + .long 0x40b0d774,0x3ff826c6 + .long 0x3f003866 + .long 0xbfa5b387 + .long 0x521e69ab,0x3ff8172e + .long 0x3efd3d38 + .long 0xbfa474fb + .long 0x64a31380,0x3ff807b4 + .long 0x3efa17e4 + .long 0xbfa33a67 + .long 0x344463f5,0x3ff7f858 + .long 0x3ef70080 + .long 0xbfa203b9 + .long 0x536e309d,0x3ff7e919 + .long 0x3ef3f6bd + .long 0xbfa0d0df + .long 0x51d9db7f,0x3ff7d9f7 + .long 0x3ef0fa4e + .long 0xbf9fa1ca + .long 0x03bdd024,0x3ff7caf2 + .long 0x3eee0ae8 + .long 0xbf9e7667 + .long 0xd06a95a6,0x3ff7bc08 + .long 0x3eeb2842 + .long 0xbf9d4ea8 + .long 0x96a621bf,0x3ff7ad3b + .long 0x3ee85215 + .long 0xbf9c2a7d + .long 0xfac56bba,0x3ff79e89 + .long 0x3ee5881d + .long 0xbf9b09d5 + .long 0x79c2bb58,0x3ff78ff3 + .long 0x3ee2ca16 + .long 0xbf99eca3 + .long 0xfa3e419f,0x3ff78177 + .long 0x3ee017bf + .long 0xbf98d2d7 + .long 0x07c1acb7,0x3ff77317 + .long 0x3edd70d7 + .long 0xbf97bc62 + .long 0x49bbc9e6,0x3ff764d0 + .long 0x3edad522 + .long 0xbf96a937 + .long 0x8367baca,0x3ff756a3 + .long 0x3ed84462 + .long 0xbf959948 + .long 0x6acc6906,0x3ff74890 + .long 0x3ed5be5d + .long 0xbf948c88 + .long 0xbcc0ac8a,0x3ff73a96 + .long 0x3ed342d8 + .long 0xbf9382e7 + .long 0xed77fbb2,0x3ff72cb5 + .long 0x3ed0d19d + .long 0xbf927c5c + .long 0x1262b283,0x3ff71eee + .long 0x3ece6a74 + .long 0xbf9178d7 + .long 0x928b4839,0x3ff7113e + .long 0x3ecc0d29 + .long 0xbf90784d + .long 0x46765494,0x3ff703a7 + .long 0x3ec9b988 + .long 0xbf8f7ab1 + .long 0xd271890f,0x3ff6f627 + .long 0x3ec76f5d + .long 0xbf8e7ff8 + .long 0x1330f37e,0x3ff6e8c0 + .long 0x3ec52e79 + .long 0xbf8d8817 + .long 0xca5f6659,0x3ff6db6f + .long 0x3ec2f6aa + .long 0xbf8c9300 + .long 0x7a3c2c24,0x3ff6ce36 + .long 0x3ec0c7c2 + .long 0xbf8ba0aa + .long 0x18d80162,0x3ff6c114 + .long 0x3ebea193 + .long 0xbf8ab109 + .long 0x4b1eb26b,0x3ff6b408 + .long 0x3ebc83f0 + .long 0xbf89c412 + .long 0xcd29fcba,0x3ff6a712 + .long 0x3eba6eaf + .long 0xbf88d9bb + .long 0x664b0f09,0x3ff69a33 + .long 0x3eb861a4 + .long 0xbf87f1f9 + .long 0xcfa00fd5,0x3ff68d69 + .long 0x3eb65ca6 + .long 0xbf870cc3 + .long 0xe9d2a6b3,0x3ff680b5 + .long 0x3eb45f8c + .long 0xbf862a0e + .long 0x5e7a0e0b,0x3ff67417 + .long 0x3eb26a30 + .long 0xbf8549d1 + .long 0xfe6852bf,0x3ff6678d + .long 0x3eb07c6a + .long 0xbf846c01 + .long 0x6f577b40,0x3ff65b19 + .long 0x3eae9616 + .long 0xbf839096 + .long 0x94beacb4,0x3ff64eb9 + .long 0x3eacb70d + .long 0xbf82b786 + .long 0x2d87a5b4,0x3ff6426e + .long 0x3eaadf2d + .long 0xbf81e0c9 + .long 0x133eca3a,0x3ff63637 + .long 0x3ea90e52 + .long 0xbf810c55 + .long 0xf3b8ca64,0x3ff62a13 + .long 0x3ea74459 + .long 0xbf803a22 + .long 0xb1e928a1,0x3ff61e04 + .long 0x3ea58123 + .long 0xbf7ed44e + .long 0xf9c12cea,0x3ff61208 + .long 0x3ea3c48d + .long 0xbf7d38b8 + .long 0xb0f105b4,0x3ff60620 + .long 0x3ea20e79 + .long 0xbf7ba172 + .long 0x9c747236,0x3ff5fa4b + .long 0x3ea05ec6 + .long 0xbf7a0e6a + .long 0x79454bb5,0x3ff5ee89 + .long 0x3e9eb556 + .long 0xbf787f92 + .long 0x2c804088,0x3ff5e2da + .long 0x3e9d120c + .long 0xbf76f4d9 + .long 0x686ac26d,0x3ff5d73d + .long 0x3e9b74ca + .long 0xbf756e31 + .long 0x1493b001,0x3ff5cbb3 + .long 0x3e99dd75 + .long 0xbf73eb8c + .long 0x048406f4,0x3ff5c03b + .long 0x3e984bef + .long 0xbf726cd9 + .long 0xf4dbeebe,0x3ff5b4d4 + .long 0x3e96c01f + .long 0xbf70f20b + .long 0xbbe3f38a,0x3ff5a980 + .long 0x3e9539e9 + .long 0xbf6f7b14 + .long 0x37ac4b0e,0x3ff59e3e + .long 0x3e93b933 + .long 0xbf6e07e5 + .long 0x294f0c16,0x3ff5930d + .long 0x3e923de4 + .long 0xbf6c9870 + .long 0x5aaed17d,0x3ff587ed + .long 0x3e90c7e3 + .long 0xbf6b2caa + .long 0xc550e64d,0x3ff57cde + .long 0x3e8f5718 + .long 0xbf69c484 + .long 0x1e1a64d6,0x3ff571e1 + .long 0x3e8deb6b + .long 0xbf685ff2 + .long 0x4990847b,0x3ff566f4 + .long 0x3e8c84c4 + .long 0xbf66fee6 + .long 0x0dee1cfa,0x3ff55c18 + .long 0x3e8b230e + .long 0xbf65a155 + .long 0x4a4098f7,0x3ff5514c + .long 0x3e89c631 + .long 0xbf644732 + .long 0xd65fdb98,0x3ff54690 + .long 0x3e886e18 + .long 0xbf62f072 + .long 0x9358f9fc,0x3ff53be5 + .type __sqrt_t_table,@object + .size __sqrt_t_table,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sqrt_wmt.S b/external/sgx_libm/ia32/sqrt_wmt.S new file mode 100644 index 0000000000..7667579e79 --- /dev/null +++ b/external/sgx_libm/ia32/sqrt_wmt.S @@ -0,0 +1,135 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrt_wmt.c" + .text +..TXTST0: +# -- Begin sqrt + .text + .align 16,0x90 + .globl sqrt +sqrt: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp + fldl 8(%ebp) + movl %gs:20, %edx + xorl %esp, %edx + movl 12(%ebp), %ecx + cmpl $2146435072, %ecx + movl %edx, 16(%esp) + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + fstl (%esp) + ja ..B1.5 +..B1.2: + fstpl 8(%esp) + movsd 8(%esp), %xmm0 + sqrtsd %xmm0, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + movl 16(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.4 +..B1.3: + movl %ebp, %esp + popl %ebp + ret +..B1.4: + fstp %st(0) + movl %eax, %ebx + call __stack_chk_fail@PLT +..B1.5: + cmpl $0, (%esp) + movl $0, %edx + setne %dl + orl %edx, %ecx + movl %ecx, %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + ja ..B1.12 +..B1.6: + cmpl $-2147483648, %ecx + je ..B1.8 +..B1.7: + fstp %st(0) + movsd _ConstantTable@GOTOFF(%eax), %xmm0 + mulsd 16+_ConstantTable@GOTOFF(%eax), %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) +..B1.8: + movl 16(%esp), %edx + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.4 + jmp ..B1.3 +..B1.12: + movl 16(%esp), %edx + fadd %st(0), %st + xorl %esp, %edx + cmpl %gs:20, %edx + jne ..B1.4 + jmp ..B1.3 + .align 16,0x90 + .type sqrt,@function + .size sqrt,.-sqrt + .data +# -- End sqrt + .section .rodata, "a" + .align 16 + .align 16 +_ConstantTable: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _ConstantTable,@object + .size _ConstantTable,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sqrtf_wmt.S b/external/sgx_libm/ia32/sqrtf_wmt.S new file mode 100644 index 0000000000..1e9785cc4a --- /dev/null +++ b/external/sgx_libm/ia32/sqrtf_wmt.S @@ -0,0 +1,114 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrtf_wmt.c" + .text +..TXTST0: +# -- Begin sqrtf + .text + .align 16,0x90 + .globl sqrtf +sqrtf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $16, %esp + flds 8(%ebp) + movl 8(%ebp), %edx + cmpl $2139095040, %edx + ja ..B1.3 +..B1.2: + fstps 8(%esp) + movss 8(%esp), %xmm0 + sqrtss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.3: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.8 +..B1.4: + cmpl $-2147483648, %edx + je ..B1.6 +..B1.5: + fstp %st(0) + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + movss _ConstantTable@GOTOFF(%eax), %xmm0 + mulss 16+_ConstantTable@GOTOFF(%eax), %xmm0 + movss %xmm0, (%esp) + flds (%esp) +..B1.6: + movl %ebp, %esp + popl %ebp + ret +..B1.8: + fadd %st(0), %st + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type sqrtf,@function + .size sqrtf,.-sqrtf + .data +# -- End sqrtf + .section .rodata, "a" + .align 16 + .align 16 +_ConstantTable: + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 2139095040 + .long 4286578688 + .long 0 + .long 0 + .type _ConstantTable,@object + .size _ConstantTable,32 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/sqrtl.S b/external/sgx_libm/ia32/sqrtl.S new file mode 100644 index 0000000000..d0db6b5d4b --- /dev/null +++ b/external/sgx_libm/ia32/sqrtl.S @@ -0,0 +1,200 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrtl.c" + .text +..TXTST0: +# -- Begin sqrtl + .text + .align 16,0x90 + .globl sqrtl +sqrtl: +# parameter 1: 32 + %esp +..B1.1: +..L1: + + subl $28, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 40(%esp), %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $32767, %ecx + je ..B1.26 +..B1.4: + movzbl 41(%esp), %edx + testl $128, %edx + jne ..B1.14 +..B1.5: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.13 +..B1.6: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %eax +..B1.9: + fldt 32(%esp) + fsqrt + fstpt (%esp) +..B1.10: + testl %eax, %eax + je ..B1.12 +..B1.11: + fldcw 14(%esp) +..B1.12: + fldt (%esp) + addl $28, %esp + ret +..B1.13: + xorl %eax, %eax + jmp ..B1.9 +..B1.14: + testl %ecx, %ecx + jne ..B1.18 +..B1.15: + cmpl $0, 36(%esp) + jne ..B1.18 +..B1.16: + cmpl $0, 32(%esp) + jne ..B1.18 +..B1.17: + fldt 32(%esp) + addl $28, %esp + ret +..B1.18: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.25 +..B1.19: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.20: + fldcw 12(%esp) +..B1.21: + movl $1, %edx +..B1.22: + fldl _infs@GOTOFF(%eax) + testl %edx, %edx + fmull _zeros@GOTOFF(%eax) + fstpt (%esp) + je ..B1.24 +..B1.23: + fldcw 14(%esp) +..B1.24: + fldt (%esp) + addl $28, %esp + ret +..B1.25: + xorl %edx, %edx + jmp ..B1.22 +..B1.26: + cmpl $-2147483648, 36(%esp) + jne ..B1.28 +..B1.27: + cmpl $0, 32(%esp) + je ..B1.4 +..B1.28: + movzwl 14(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.34 +..B1.29: + orl $-64768, %ecx + movw %cx, 12(%esp) +..B1.30: + fldcw 12(%esp) +..B1.31: + fldt 32(%esp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) +..B1.32: + fldcw 14(%esp) +..B1.33: + fldt (%esp) + addl $28, %esp + ret +..B1.34: + fldt 32(%esp) + fmull _ones@GOTOFF(%eax) + fstpt (%esp) + jmp ..B1.33 + .align 16,0x90 + .type sqrtl,@function + .size sqrtl,.-sqrtl + .data +# -- End sqrtl + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tan_wmt.S b/external/sgx_libm/ia32/tan_wmt.S new file mode 100644 index 0000000000..747378fdf9 --- /dev/null +++ b/external/sgx_libm/ia32/tan_wmt.S @@ -0,0 +1,1713 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tan_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin tan + .text + .align 16,0x90 + .globl tan +tan: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 56(%esp) + call static_func + movl %eax, %ebx + movsd 128(%esp), %xmm0 + pextrw $3, %xmm0, %eax + andl $32767, %eax + subl $14368, %eax + cmpl $2216, %eax + ja .L_2TAG_PACKET_0.0.2 + movapd 5840(%ebx), %xmm5 + movapd 5856(%ebx), %xmm6 + unpcklpd %xmm0, %xmm0 + movapd 5712(%ebx), %xmm4 + andpd %xmm0, %xmm4 + movapd 5632(%ebx), %xmm1 + mulpd %xmm0, %xmm1 + orpd %xmm4, %xmm5 + addpd %xmm5, %xmm1 + movapd %xmm1, %xmm7 + unpckhpd %xmm7, %xmm7 + cvttsd2si %xmm7, %edx + cvttpd2dq %xmm1, %xmm1 + cvtdq2pd %xmm1, %xmm1 + mulpd %xmm6, %xmm1 + movapd 5664(%ebx), %xmm3 + movsd 5728(%ebx), %xmm5 + addl $469248, %edx + movapd 5680(%ebx), %xmm4 + mulpd %xmm1, %xmm3 + andl $31, %edx + mulsd %xmm1, %xmm5 + movl %edx, %ecx + mulpd %xmm1, %xmm4 + shll $1, %ecx + subpd %xmm3, %xmm0 + mulpd 5696(%ebx), %xmm1 + addl %ecx, %edx + shll $2, %ecx + addl %ecx, %edx + addsd %xmm0, %xmm5 + movapd %xmm0, %xmm2 + subpd %xmm4, %xmm0 + movsd 5744(%ebx), %xmm6 + shll $4, %edx + lea (%ebx), %eax + andpd 5776(%ebx), %xmm5 + movapd %xmm0, %xmm3 + addl %edx, %eax + subpd %xmm0, %xmm2 + unpckhpd %xmm0, %xmm0 + divsd %xmm5, %xmm6 + subpd %xmm4, %xmm2 + movapd 16(%eax), %xmm7 + subsd %xmm5, %xmm3 + mulpd %xmm0, %xmm7 + subpd %xmm1, %xmm2 + movapd 48(%eax), %xmm1 + mulpd %xmm0, %xmm1 + movapd 96(%eax), %xmm4 + mulpd %xmm0, %xmm4 + addsd %xmm3, %xmm2 + movapd %xmm0, %xmm3 + mulpd %xmm0, %xmm0 + addpd (%eax), %xmm7 + addpd 32(%eax), %xmm1 + mulpd %xmm0, %xmm1 + addpd 80(%eax), %xmm4 + addpd %xmm1, %xmm7 + movapd 112(%eax), %xmm1 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm0 + addpd %xmm1, %xmm4 + movapd 64(%eax), %xmm1 + mulpd %xmm0, %xmm1 + addpd %xmm1, %xmm7 + movapd %xmm3, %xmm1 + mulpd %xmm0, %xmm3 + mulsd %xmm0, %xmm0 + mulpd 144(%eax), %xmm1 + mulpd %xmm3, %xmm4 + movapd %xmm1, %xmm3 + addpd %xmm4, %xmm7 + movapd %xmm1, %xmm4 + mulsd %xmm7, %xmm0 + unpckhpd %xmm7, %xmm7 + addsd %xmm7, %xmm0 + unpckhpd %xmm1, %xmm1 + addsd %xmm1, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm1 + movapd %xmm2, %xmm4 + movsd 144(%eax), %xmm7 + unpckhpd %xmm2, %xmm2 + addsd 152(%eax), %xmm7 + mulsd %xmm2, %xmm7 + addsd 136(%eax), %xmm7 + addsd %xmm1, %xmm7 + addsd %xmm7, %xmm0 + movsd 5744(%ebx), %xmm7 + mulsd %xmm6, %xmm4 + movsd 168(%eax), %xmm2 + andpd %xmm6, %xmm2 + mulsd %xmm2, %xmm5 + mulsd 160(%eax), %xmm6 + subsd %xmm5, %xmm7 + subsd 128(%eax), %xmm2 + subsd %xmm4, %xmm7 + mulsd %xmm6, %xmm7 + movapd %xmm3, %xmm4 + subsd %xmm2, %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm4 + addsd %xmm4, %xmm0 + subsd %xmm7, %xmm0 + addsd %xmm3, %xmm0 + movsd %xmm0, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + jg .L_2TAG_PACKET_2.0.2 + shrl $4, %eax + cmpl $268434558, %eax + jne .L_2TAG_PACKET_3.0.2 + movapd %xmm0, %xmm3 + mulsd 5808(%ebx), %xmm3 +.L_2TAG_PACKET_3.0.2: + movsd 5792(%ebx), %xmm3 + mulsd %xmm0, %xmm3 + addsd %xmm0, %xmm3 + mulsd 5808(%ebx), %xmm3 + movsd %xmm3, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + movq 5712(%ebx), %xmm7 + andpd %xmm0, %xmm7 + xorpd %xmm0, %xmm7 + ucomisd 5760(%ebx), %xmm7 + je .L_2TAG_PACKET_4.0.2 + subl $32, %esp + movsd %xmm0, (%esp) + lea 40(%esp), %eax + movl %eax, 8(%esp) + movl $2, %eax + movl %eax, 12(%esp) + call __libm_tancot_huge + addl $32, %esp + fldl 8(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + movq %xmm0, (%esp) + fldl (%esp) + fsubl (%esp) +.L_2TAG_PACKET_1.0.2: + movl 56(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type tan,@function + .size tan,.-tan + .data +# -- End tan + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 2284589306 + .long 1066820852 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1441186365 + .long 1065494243 + .long 1431655765 + .long 1070945621 + .long 0 + .long 0 + .long 0 + .long 0 + .long 236289504 + .long 1064135997 + .long 286331153 + .long 1069617425 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1160476131 + .long 1062722102 + .long 463583772 + .long 1068212666 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1313038235 + .long 1066745731 + .long 0 + .long 0 + .long 1013878342 + .long 1067152618 + .long 0 + .long 0 + .long 3663426833 + .long 1065725283 + .long 3693284251 + .long 1069118808 + .long 650852232 + .long 1065882376 + .long 1996245381 + .long 1071000265 + .long 2008746170 + .long 1064664197 + .long 3055842593 + .long 1068578846 + .long 1495406348 + .long 1064652437 + .long 2269530157 + .long 1069711235 + .long 285563696 + .long 1063576465 + .long 1046897440 + .long 1067705865 + .long 233429731 + .long 1063453151 + .long 522045958 + .long 1068476590 + .long 2354785698 + .long 1069102779 + .long 1317599141 + .long 1012432133 + .long 0 + .long 1072693248 + .long 2828230105 + .long 1065606626 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1512545955 + .long 1068119047 + .long 0 + .long 0 + .long 1127048698 + .long 1067909459 + .long 0 + .long 0 + .long 2300200450 + .long 1067254767 + .long 3593250296 + .long 1070233561 + .long 3009365544 + .long 1066902117 + .long 1127373050 + .long 1071173457 + .long 3046103305 + .long 1066371299 + .long 24583402 + .long 1069723988 + .long 4082511758 + .long 1065914199 + .long 3223889699 + .long 1070020367 + .long 548927984 + .long 1065415756 + .long 558065897 + .long 1068949418 + .long 680073315 + .long 1064940726 + .long 388873200 + .long 1068944270 + .long 3763679576 + .long 1070167541 + .long 1497360404 + .long 1009710547 + .long 0 + .long 1072693248 + .long 64931152 + .long 1067729411 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2467582782 + .long 1069256389 + .long 0 + .long 0 + .long 162150096 + .long 1068946420 + .long 0 + .long 0 + .long 3702794237 + .long 1068579152 + .long 3631919291 + .long 1070936926 + .long 3456821413 + .long 1068217218 + .long 2031366438 + .long 1071495745 + .long 1596664020 + .long 1067799281 + .long 1509038701 + .long 1070601643 + .long 583171477 + .long 1067510148 + .long 3785344682 + .long 1070618476 + .long 2402036048 + .long 1067075736 + .long 3233018412 + .long 1069913186 + .long 411280568 + .long 1066710556 + .long 1065584192 + .long 1069747896 + .long 895247324 + .long 1070819848 + .long 500078909 + .long 3161288781 + .long 0 + .long 1072693248 + .long 729983843 + .long 1068994194 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1458794562 + .long 1070398550 + .long 0 + .long 0 + .long 2857777489 + .long 1070137637 + .long 0 + .long 0 + .long 1024359517 + .long 1069876531 + .long 2616040238 + .long 1071582937 + .long 1609024636 + .long 1069675088 + .long 2529240549 + .long 1071836633 + .long 1510128600 + .long 1069440113 + .long 2251697184 + .long 1071253687 + .long 1262761453 + .long 1069142850 + .long 1263091857 + .long 1071190461 + .long 3043383486 + .long 1068885191 + .long 2476932470 + .long 1070842002 + .long 3659995028 + .long 1068669200 + .long 855891755 + .long 1070696894 + .long 2583490354 + .long 1071284857 + .long 3062633575 + .long 1014008623 + .long 0 + .long 1072693248 + .long 2550940471 + .long 1069938201 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3422807297 + .long 1071640847 + .long 0 + .long 0 + .long 1151658053 + .long 1071494715 + .long 0 + .long 0 + .long 929607071 + .long 1071346340 + .long 1037049034 + .long 1072037305 + .long 2786928657 + .long 1071215282 + .long 1447406859 + .long 1072265209 + .long 3490952107 + .long 1071090851 + .long 3205232916 + .long 1071968658 + .long 1297344304 + .long 1070977120 + .long 1066110976 + .long 1071946035 + .long 3803721480 + .long 1070871082 + .long 1496754229 + .long 1071807201 + .long 2982550683 + .long 1070773243 + .long 4014441989 + .long 1071736222 + .long 419968236 + .long 1071717047 + .long 3451266538 + .long 3163444811 + .long 0 + .long 1072693248 + .long 2960267235 + .long 1070745841 + .long 0 + .long 0 + .long 0 + .long 0 + .long 724322768 + .long 1072881308 + .long 0 + .long 0 + .long 643153048 + .long 1072905816 + .long 0 + .long 0 + .long 4285079458 + .long 1072928558 + .long 3912524733 + .long 1072622983 + .long 118362272 + .long 1072952754 + .long 4107767972 + .long 1072827408 + .long 2689502883 + .long 1072976922 + .long 946523347 + .long 1072772766 + .long 573204189 + .long 1073001761 + .long 581531518 + .long 1072826391 + .long 1386236526 + .long 1073026959 + .long 3718905905 + .long 1072832823 + .long 1145558140 + .long 1073052673 + .long 513572637 + .long 1072861969 + .long 716700048 + .long 1071997368 + .long 547126769 + .long 1015523525 + .long 0 + .long 1072693248 + .long 1097907398 + .long 1071420120 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3349892442 + .long 1074290212 + .long 0 + .long 0 + .long 3913197405 + .long 1074501181 + .long 0 + .long 0 + .long 2494034522 + .long 1074739170 + .long 1264738763 + .long 1073084804 + .long 1520293906 + .long 1074899632 + .long 1958936600 + .long 1073411493 + .long 2133649635 + .long 1075052171 + .long 4270740730 + .long 1073574708 + .long 1728930189 + .long 1075224844 + .long 1303998552 + .long 1073799186 + .long 618611933 + .long 1075420255 + .long 1769828046 + .long 1073938542 + .long 2200537986 + .long 1075641421 + .long 433361110 + .long 1074105369 + .long 719595600 + .long 1072317184 + .long 294527206 + .long 3162140088 + .long 0 + .long 1073741824 + .long 3811788216 + .long 3218400550 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1704352102 + .long 1075943001 + .long 0 + .long 0 + .long 2284589306 + .long 1076258036 + .long 0 + .long 0 + .long 2211264291 + .long 1076659010 + .long 0 + .long 1073741824 + .long 1441186365 + .long 1077028579 + .long 1431655765 + .long 1074091349 + .long 876943673 + .long 1077353622 + .long 2863311531 + .long 1074440874 + .long 236289504 + .long 1077767485 + .long 286331153 + .long 1074860305 + .long 2805473311 + .long 1078115278 + .long 95443718 + .long 1075163227 + .long 1160476131 + .long 1078450742 + .long 463583772 + .long 1075552698 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1330165971 + .long 3207850745 + .long 0 + .long 0 + .long 217536623 + .long 1059109098 + .long 0 + .long 0 + .long 3492120849 + .long 3205151475 + .long 602185705 + .long 3215678092 + .long 760422958 + .long 1056312597 + .long 555127889 + .long 1067545266 + .long 3139784124 + .long 3202470837 + .long 3690544014 + .long 3213150171 + .long 95707915 + .long 1053635428 + .long 4003114407 + .long 1064581412 + .long 2034926231 + .long 3199711161 + .long 3759536023 + .long 3210559989 + .long 3826928214 + .long 1050893819 + .long 3837960785 + .long 1061790379 + .long 1526325248 + .long 3217967566 + .long 2356426521 + .long 1025423456 + .long 0 + .long 0 + .long 457728975 + .long 1071088276 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1398462608 + .long 3207303968 + .long 0 + .long 0 + .long 26205983 + .long 1058461213 + .long 0 + .long 0 + .long 56226238 + .long 3204528612 + .long 2754706541 + .long 3215359511 + .long 2187799823 + .long 1055634437 + .long 790323742 + .long 1067402587 + .long 1372385848 + .long 3201651479 + .long 4097292716 + .long 3212856302 + .long 3348210357 + .long 1052830099 + .long 2442796466 + .long 1064337602 + .long 862608142 + .long 3198830754 + .long 170296152 + .long 3210060867 + .long 3755571428 + .long 1049933343 + .long 3614866008 + .long 1061361670 + .long 719978496 + .long 3217669096 + .long 1998842465 + .long 3174703977 + .long 0 + .long 0 + .long 3749156607 + .long 1071048258 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3120498638 + .long 3206749304 + .long 0 + .long 0 + .long 2773578114 + .long 1058009312 + .long 0 + .long 0 + .long 2030783676 + .long 3203817873 + .long 2223654598 + .long 3215071936 + .long 2976134650 + .long 1054987244 + .long 706390066 + .long 1067217386 + .long 4258437615 + .long 3200900378 + .long 1066252975 + .long 3212391267 + .long 815777514 + .long 1051989462 + .long 3202745457 + .long 1064010682 + .long 2493556375 + .long 3198004753 + .long 1046243251 + .long 3209678971 + .long 2593078846 + .long 1049017717 + .long 2763962276 + .long 1060970161 + .long 701480960 + .long 3217377742 + .long 3205862232 + .long 3174660915 + .long 0 + .long 0 + .long 2267016812 + .long 1071015664 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 2107155798 + .long 3206166872 + .long 0 + .long 0 + .long 2642992129 + .long 1057424578 + .long 0 + .long 0 + .long 1936992811 + .long 3203204426 + .long 1485063559 + .long 3214682643 + .long 1432914553 + .long 1054319398 + .long 3996381654 + .long 1067075828 + .long 2833029256 + .long 3200223545 + .long 2866066872 + .long 3211982662 + .long 2432888737 + .long 1051234178 + .long 3669764559 + .long 1063748136 + .long 2458496952 + .long 3197170774 + .long 1948234989 + .long 3209098147 + .long 2843698787 + .long 1048163519 + .long 3398041407 + .long 1060559728 + .long 2829230080 + .long 3217092115 + .long 1034046433 + .long 3174271903 + .long 0 + .long 0 + .long 298675305 + .long 1070989821 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 437603223 + .long 3205589761 + .long 0 + .long 0 + .long 759330352 + .long 1057048511 + .long 0 + .long 0 + .long 3107463368 + .long 3202507988 + .long 3144465176 + .long 3214191500 + .long 2290961810 + .long 1053841035 + .long 1618153340 + .long 1066971547 + .long 3836869393 + .long 3199400272 + .long 584032116 + .long 3211469261 + .long 1245704358 + .long 1050626462 + .long 4247487438 + .long 1063561943 + .long 1669034927 + .long 3196274812 + .long 3844233498 + .long 3208626322 + .long 2706958524 + .long 1047411374 + .long 3857199098 + .long 1060281647 + .long 3593904128 + .long 3216590719 + .long 3267547836 + .long 3172163321 + .long 0 + .long 0 + .long 4076712227 + .long 1070970214 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3290090340 + .long 3204793485 + .long 0 + .long 0 + .long 3685760367 + .long 1056668370 + .long 0 + .long 0 + .long 2655163949 + .long 3201674917 + .long 628750575 + .long 3213566872 + .long 680140505 + .long 1053299777 + .long 2954464709 + .long 1066900026 + .long 803201619 + .long 3198516435 + .long 1466315631 + .long 3210837162 + .long 1611220163 + .long 1049972438 + .long 2766187256 + .long 1063437894 + .long 1804579484 + .long 3195331491 + .long 3695969289 + .long 3207854418 + .long 2617238373 + .long 1046675948 + .long 3095830084 + .long 1060095334 + .long 3789570048 + .long 3216034914 + .long 23826559 + .long 3172048060 + .long 0 + .long 0 + .long 3870939386 + .long 1070956467 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1571758758 + .long 3203672535 + .long 0 + .long 0 + .long 113026373 + .long 1056416381 + .long 0 + .long 0 + .long 1913766298 + .long 3200523326 + .long 2507068734 + .long 3212502004 + .long 4000648818 + .long 1053003803 + .long 2446607349 + .long 1066858259 + .long 912662124 + .long 3197333001 + .long 1349489537 + .long 3209765608 + .long 3412972607 + .long 1049641401 + .long 1721283327 + .long 1063366855 + .long 1466691883 + .long 3194116746 + .long 3852528092 + .long 3206760861 + .long 285443293 + .long 1046158380 + .long 1758739894 + .long 1059895449 + .long 1858781184 + .long 3214984212 + .long 3447575948 + .long 1024675855 + .long 0 + .long 0 + .long 2242038011 + .long 1070948320 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 0 + .long 0 + .long 0 + .long 0 + .long 737611454 + .long 1056336527 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3594790527 + .long 1052911621 + .long 381774871 + .long 1066844524 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3303051618 + .long 1049456050 + .long 3154187623 + .long 1063343722 + .long 0 + .long 0 + .long 0 + .long 0 + .long 528061788 + .long 1045944910 + .long 2469719819 + .long 1059831159 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1431655765 + .long 1070945621 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1571758758 + .long 1056188887 + .long 0 + .long 0 + .long 113026373 + .long 1056416381 + .long 0 + .long 0 + .long 1913766298 + .long 1053039678 + .long 2507068734 + .long 1065018356 + .long 4000648818 + .long 1053003803 + .long 2446607349 + .long 1066858259 + .long 912662124 + .long 1049849353 + .long 1349489537 + .long 1062281960 + .long 3412972607 + .long 1049641401 + .long 1721283327 + .long 1063366855 + .long 1466691883 + .long 1046633098 + .long 3852528092 + .long 1059277213 + .long 285443293 + .long 1046158380 + .long 1758739894 + .long 1059895449 + .long 1858781184 + .long 1067500564 + .long 3447575948 + .long 3172159503 + .long 0 + .long 0 + .long 2242038011 + .long 1070948320 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3290090340 + .long 1057309837 + .long 0 + .long 0 + .long 3685760367 + .long 1056668370 + .long 0 + .long 0 + .long 2655163949 + .long 1054191269 + .long 628750575 + .long 1066083224 + .long 680140505 + .long 1053299777 + .long 2954464709 + .long 1066900026 + .long 803201619 + .long 1051032787 + .long 1466315631 + .long 1063353514 + .long 1611220163 + .long 1049972438 + .long 2766187256 + .long 1063437894 + .long 1804579484 + .long 1047847843 + .long 3695969289 + .long 1060370770 + .long 2617238373 + .long 1046675948 + .long 3095830084 + .long 1060095334 + .long 3789570048 + .long 1068551266 + .long 23826559 + .long 1024564412 + .long 0 + .long 0 + .long 3870939386 + .long 1070956467 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 437603223 + .long 1058106113 + .long 0 + .long 0 + .long 759330352 + .long 1057048511 + .long 0 + .long 0 + .long 3107463368 + .long 1055024340 + .long 3144465176 + .long 1066707852 + .long 2290961810 + .long 1053841035 + .long 1618153340 + .long 1066971547 + .long 3836869393 + .long 1051916624 + .long 584032116 + .long 1063985613 + .long 1245704358 + .long 1050626462 + .long 4247487438 + .long 1063561943 + .long 1669034927 + .long 1048791164 + .long 3844233498 + .long 1061142674 + .long 2706958524 + .long 1047411374 + .long 3857199098 + .long 1060281647 + .long 3593904128 + .long 1069107071 + .long 3267547836 + .long 1024679673 + .long 0 + .long 0 + .long 4076712227 + .long 1070970214 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 2107155798 + .long 1058683224 + .long 0 + .long 0 + .long 2642992129 + .long 1057424578 + .long 0 + .long 0 + .long 1936992811 + .long 1055720778 + .long 1485063559 + .long 1067198995 + .long 1432914553 + .long 1054319398 + .long 3996381654 + .long 1067075828 + .long 2833029256 + .long 1052739897 + .long 2866066872 + .long 1064499014 + .long 2432888737 + .long 1051234178 + .long 3669764559 + .long 1063748136 + .long 2458496952 + .long 1049687126 + .long 1948234989 + .long 1061614499 + .long 2843698787 + .long 1048163519 + .long 3398041407 + .long 1060559728 + .long 2829230080 + .long 1069608467 + .long 1034046433 + .long 1026788255 + .long 0 + .long 0 + .long 298675305 + .long 1070989821 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3120498638 + .long 1059265656 + .long 0 + .long 0 + .long 2773578114 + .long 1058009312 + .long 0 + .long 0 + .long 2030783676 + .long 1056334225 + .long 2223654598 + .long 1067588288 + .long 2976134650 + .long 1054987244 + .long 706390066 + .long 1067217386 + .long 4258437615 + .long 1053416730 + .long 1066252975 + .long 1064907619 + .long 815777514 + .long 1051989462 + .long 3202745457 + .long 1064010682 + .long 2493556375 + .long 1050521105 + .long 1046243251 + .long 1062195323 + .long 2593078846 + .long 1049017717 + .long 2763962276 + .long 1060970161 + .long 701480960 + .long 1069894094 + .long 3205862232 + .long 1027177267 + .long 0 + .long 0 + .long 2267016812 + .long 1071015664 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1398462608 + .long 1059820320 + .long 0 + .long 0 + .long 26205983 + .long 1058461213 + .long 0 + .long 0 + .long 56226238 + .long 1057044964 + .long 2754706541 + .long 1067875863 + .long 2187799823 + .long 1055634437 + .long 790323742 + .long 1067402587 + .long 1372385848 + .long 1054167831 + .long 4097292716 + .long 1065372654 + .long 3348210357 + .long 1052830099 + .long 2442796466 + .long 1064337602 + .long 862608142 + .long 1051347106 + .long 170296152 + .long 1062577219 + .long 3755571428 + .long 1049933343 + .long 3614866008 + .long 1061361670 + .long 719978496 + .long 1070185448 + .long 1998842465 + .long 1027220329 + .long 0 + .long 0 + .long 3749156607 + .long 1071048258 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1330165971 + .long 1060367097 + .long 0 + .long 0 + .long 217536623 + .long 1059109098 + .long 0 + .long 0 + .long 3492120849 + .long 1057667827 + .long 602185705 + .long 1068194444 + .long 760422958 + .long 1056312597 + .long 555127889 + .long 1067545266 + .long 3139784124 + .long 1054987189 + .long 3690544014 + .long 1065666523 + .long 95707915 + .long 1053635428 + .long 4003114407 + .long 1064581412 + .long 2034926231 + .long 1052227513 + .long 3759536023 + .long 1063076341 + .long 3826928214 + .long 1050893819 + .long 3837960785 + .long 1061790379 + .long 1526325248 + .long 1070483918 + .long 2356426521 + .long 3172907104 + .long 0 + .long 0 + .long 457728975 + .long 1071088276 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1704352102 + .long 3223426649 + .long 0 + .long 0 + .long 2284589306 + .long 1076258036 + .long 0 + .long 0 + .long 2211264291 + .long 3224142658 + .long 0 + .long 3221225472 + .long 1441186365 + .long 1077028579 + .long 1431655765 + .long 1074091349 + .long 876943673 + .long 3224837270 + .long 2863311531 + .long 3221924522 + .long 236289504 + .long 1077767485 + .long 286331153 + .long 1074860305 + .long 2805473311 + .long 3225598926 + .long 95443718 + .long 3222646875 + .long 1160476131 + .long 1078450742 + .long 463583772 + .long 1075552698 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3349892442 + .long 3221773860 + .long 0 + .long 0 + .long 3913197405 + .long 1074501181 + .long 0 + .long 0 + .long 2494034522 + .long 3222222818 + .long 1264738763 + .long 3220568452 + .long 1520293906 + .long 1074899632 + .long 1958936600 + .long 1073411493 + .long 2133649635 + .long 3222535819 + .long 4270740730 + .long 3221058356 + .long 1728930189 + .long 1075224844 + .long 1303998552 + .long 1073799186 + .long 618611933 + .long 3222903903 + .long 1769828046 + .long 3221422190 + .long 2200537986 + .long 1075641421 + .long 433361110 + .long 1074105369 + .long 719595600 + .long 3219800832 + .long 294527206 + .long 1014656440 + .long 0 + .long 1073741824 + .long 3811788216 + .long 3218400550 + .long 0 + .long 0 + .long 0 + .long 0 + .long 724322768 + .long 3220364956 + .long 0 + .long 0 + .long 643153048 + .long 1072905816 + .long 0 + .long 0 + .long 4285079458 + .long 3220412206 + .long 3912524733 + .long 3220106631 + .long 118362272 + .long 1072952754 + .long 4107767972 + .long 1072827408 + .long 2689502883 + .long 3220460570 + .long 946523347 + .long 3220256414 + .long 573204189 + .long 1073001761 + .long 581531518 + .long 1072826391 + .long 1386236526 + .long 3220510607 + .long 3718905905 + .long 3220316471 + .long 1145558140 + .long 1073052673 + .long 513572637 + .long 1072861969 + .long 716700048 + .long 3219481016 + .long 547126769 + .long 3163007173 + .long 0 + .long 1072693248 + .long 1097907398 + .long 1071420120 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3422807297 + .long 3219124495 + .long 0 + .long 0 + .long 1151658053 + .long 1071494715 + .long 0 + .long 0 + .long 929607071 + .long 3218829988 + .long 1037049034 + .long 3219520953 + .long 2786928657 + .long 1071215282 + .long 1447406859 + .long 1072265209 + .long 3490952107 + .long 3218574499 + .long 3205232916 + .long 3219452306 + .long 1297344304 + .long 1070977120 + .long 1066110976 + .long 1071946035 + .long 3803721480 + .long 3218354730 + .long 1496754229 + .long 3219290849 + .long 2982550683 + .long 1070773243 + .long 4014441989 + .long 1071736222 + .long 419968236 + .long 3219200695 + .long 3451266538 + .long 1015961163 + .long 0 + .long 1072693248 + .long 2960267235 + .long 1070745841 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1458794562 + .long 3217882198 + .long 0 + .long 0 + .long 2857777489 + .long 1070137637 + .long 0 + .long 0 + .long 1024359517 + .long 3217360179 + .long 2616040238 + .long 3219066585 + .long 1609024636 + .long 1069675088 + .long 2529240549 + .long 1071836633 + .long 1510128600 + .long 3216923761 + .long 2251697184 + .long 3218737335 + .long 1262761453 + .long 1069142850 + .long 1263091857 + .long 1071190461 + .long 3043383486 + .long 3216368839 + .long 2476932470 + .long 3218325650 + .long 3659995028 + .long 1068669200 + .long 855891755 + .long 1070696894 + .long 2583490354 + .long 3218768505 + .long 3062633575 + .long 3161492271 + .long 0 + .long 1072693248 + .long 2550940471 + .long 1069938201 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2467582782 + .long 3216740037 + .long 0 + .long 0 + .long 162150096 + .long 1068946420 + .long 0 + .long 0 + .long 3702794237 + .long 3216062800 + .long 3631919291 + .long 3218420574 + .long 3456821413 + .long 1068217218 + .long 2031366438 + .long 1071495745 + .long 1596664020 + .long 3215282929 + .long 1509038701 + .long 3218085291 + .long 583171477 + .long 1067510148 + .long 3785344682 + .long 1070618476 + .long 2402036048 + .long 3214559384 + .long 3233018412 + .long 3217396834 + .long 411280568 + .long 1066710556 + .long 1065584192 + .long 1069747896 + .long 895247324 + .long 3218303496 + .long 500078909 + .long 1013805133 + .long 0 + .long 1072693248 + .long 729983843 + .long 1068994194 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1512545955 + .long 3215602695 + .long 0 + .long 0 + .long 1127048698 + .long 1067909459 + .long 0 + .long 0 + .long 2300200450 + .long 3214738415 + .long 3593250296 + .long 3217717209 + .long 3009365544 + .long 1066902117 + .long 1127373050 + .long 1071173457 + .long 3046103305 + .long 3213854947 + .long 24583402 + .long 3217207636 + .long 4082511758 + .long 1065914199 + .long 3223889699 + .long 1070020367 + .long 548927984 + .long 3212899404 + .long 558065897 + .long 3216433066 + .long 680073315 + .long 1064940726 + .long 388873200 + .long 1068944270 + .long 3763679576 + .long 3217651189 + .long 1497360404 + .long 3157194195 + .long 0 + .long 1072693248 + .long 64931152 + .long 1067729411 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1313038235 + .long 3214229379 + .long 0 + .long 0 + .long 1013878342 + .long 1067152618 + .long 0 + .long 0 + .long 3663426833 + .long 3213208931 + .long 3693284251 + .long 3216602456 + .long 650852232 + .long 1065882376 + .long 1996245381 + .long 1071000265 + .long 2008746170 + .long 3212147845 + .long 3055842593 + .long 3216062494 + .long 1495406348 + .long 1064652437 + .long 2269530157 + .long 1069711235 + .long 285563696 + .long 3211060113 + .long 1046897440 + .long 3215189513 + .long 233429731 + .long 1063453151 + .long 522045958 + .long 1068476590 + .long 2354785698 + .long 3216586427 + .long 1317599141 + .long 3159915781 + .long 0 + .long 1072693248 + .long 2828230105 + .long 1065606626 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1841940611 + .long 1071931184 + .long 1841940611 + .long 1076125488 + .long 0 + .long 1131937792 + .long 0 + .long 1127743488 + .long 1413758976 + .long 1069097467 + .long 1413742592 + .long 1069097467 + .long 1734819840 + .long 3174229945 + .long 1280049152 + .long 1028033571 + .long 923219018 + .long 984130272 + .long 57701189 + .long 988383790 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 1734816687 + .long 1026746297 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 4294705152 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 1130364928 + .long 0 + .long 0 + .long 0 + .long 1015021568 + .long 0 + .long 0 + .long 0 + .long 1017118720 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 0 + .long 1076887552 + .long 0 + .long 1072693248 + .type static_const_table,@object + .size static_const_table,5872 + .data + .hidden __libm_tancot_huge + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tanf_wmt.S b/external/sgx_libm/ia32/tanf_wmt.S new file mode 100644 index 0000000000..58ae7e0bf7 --- /dev/null +++ b/external/sgx_libm/ia32/tanf_wmt.S @@ -0,0 +1,1045 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin tanf + .text + .align 16,0x90 + .globl tanf +tanf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $120, %esp + movl %ebx, 56(%esp) + call static_func + movl %eax, %ebx + movss 128(%esp), %xmm0 + subl $16, %esp + stmxcsr 4(%esp) + movl 4(%esp), %eax + andl $-24577, %eax + cmpl %eax, 4(%esp) + jne .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + pextrw $1, %xmm0, %eax + andl $32767, %eax + subl $128, %eax + cmpl $18175, %eax + ja .L_2TAG_PACKET_2.0.2 + movsd 2656(%ebx), %xmm1 + mulss %xmm0, %xmm1 + movapd 2544(%ebx), %xmm7 + cvtss2si %xmm1, %edx + andpd %xmm0, %xmm7 + cvtss2sd %xmm0, %xmm0 +.L_2TAG_PACKET_3.0.2: + movsd 2672(%ebx), %xmm4 + addss %xmm1, %xmm4 + addss 2704(%ebx), %xmm1 + subss 2672(%ebx), %xmm4 + subss 2704(%ebx), %xmm1 + movapd %xmm7, %xmm5 + psllq $32, %xmm7 + psllq $29, %xmm5 + xorpd %xmm5, %xmm7 + addl $1865216, %edx + andl $31, %edx + movsd 2608(%ebx), %xmm5 + xorpd %xmm7, %xmm5 + movsd 2576(%ebx), %xmm2 + xorpd %xmm7, %xmm2 + movsd 2592(%ebx), %xmm6 + xorpd %xmm7, %xmm6 + movsd 2560(%ebx), %xmm3 + xorpd %xmm7, %xmm3 + lea (%ebx), %eax + shll $3, %edx + addl %edx, %eax + shll $3, %edx + addl %edx, %eax + psllq $29, %xmm4 + psllq $29, %xmm1 + mulsd %xmm4, %xmm5 + mulsd %xmm1, %xmm2 + mulsd %xmm4, %xmm6 + mulsd %xmm1, %xmm3 + addsd %xmm0, %xmm5 + addsd %xmm0, %xmm2 + addsd %xmm6, %xmm5 + addsd %xmm3, %xmm2 + movsd 2624(%ebx), %xmm7 + divsd %xmm5, %xmm7 + mulsd 64(%eax), %xmm7 + movsd 56(%eax), %xmm3 + mulsd %xmm2, %xmm3 + movsd 24(%eax), %xmm4 + mulsd %xmm2, %xmm4 + movsd 40(%eax), %xmm5 + mulsd %xmm2, %xmm5 + movsd 8(%eax), %xmm6 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm2 + addsd 48(%eax), %xmm3 + addsd 16(%eax), %xmm4 + addsd 32(%eax), %xmm5 + addsd (%eax), %xmm6 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm2 + addsd %xmm5, %xmm3 + addsd %xmm6, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm4, %xmm3 + subsd %xmm7, %xmm3 + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_4.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_4.0.2: + movsd %xmm3, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_2.0.2: + jg .L_2TAG_PACKET_6.0.2 + cvtss2sd %xmm0, %xmm0 + mulsd 2640(%ebx), %xmm0 + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_7.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_7.0.2: + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, (%esp) + flds (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_0.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + movl %eax, 8(%esp) + ldmxcsr 8(%esp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_6.0.2: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_8.0.2 + pshuflw $68, %xmm0, %xmm1 + movd %xmm0, %ecx + cvtps2pd %xmm1, %xmm1 + andl $2147483647, %ecx + subl $964689920, %ecx + shrl $23, %ecx + subl $27, %ecx + andl $65528, %ecx + movsd 2304(%ebx,%ecx,2), %xmm3 + movsd 2312(%ebx,%ecx,2), %xmm5 + movsd 2736(%ebx), %xmm2 + xorpd %xmm4, %xmm4 + movl $17352, %edx + pinsrw $3, %edx, %xmm4 + andpd %xmm3, %xmm2 + psllq $40, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + movapd %xmm2, %xmm0 + addsd %xmm3, %xmm2 + movapd %xmm2, %xmm5 + subsd %xmm2, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm3, %xmm0 + movsd 2720(%ebx), %xmm6 + subsd %xmm4, %xmm2 + addsd %xmm1, %xmm0 + subsd %xmm2, %xmm5 + movsd %xmm5, %xmm1 + andpd 2768(%ebx), %xmm5 + subsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + movsd %xmm5, %xmm6 + mulsd 2752(%ebx), %xmm5 + mulsd 2760(%ebx), %xmm6 + mulsd 2720(%ebx), %xmm0 + addsd %xmm6, %xmm0 + movsd %xmm5, 8(%esp) + movsd %xmm0, 16(%esp) + cvtpd2ps %xmm5, %xmm2 + movss 2656(%ebx), %xmm1 + mulss %xmm2, %xmm1 + movaps 2544(%ebx), %xmm7 + cvtss2si %xmm1, %edx + andps %xmm2, %xmm7 + movsd 2672(%ebx), %xmm4 + addss %xmm1, %xmm4 + addss 2704(%ebx), %xmm1 + subss 2672(%ebx), %xmm4 + subss 2704(%ebx), %xmm1 + movapd %xmm7, %xmm5 + psllq $32, %xmm7 + psllq $29, %xmm5 + xorpd %xmm5, %xmm7 + addl $1865216, %edx + andl $31, %edx + movsd 2608(%ebx), %xmm5 + xorpd %xmm7, %xmm5 + movsd 2576(%ebx), %xmm2 + xorpd %xmm7, %xmm2 + movsd 2592(%ebx), %xmm6 + xorpd %xmm7, %xmm6 + movsd 2560(%ebx), %xmm3 + xorpd %xmm7, %xmm3 + lea (%ebx), %eax + shll $3, %edx + addl %edx, %eax + shll $3, %edx + addl %edx, %eax + psllq $29, %xmm4 + psllq $29, %xmm1 + mulsd %xmm4, %xmm5 + mulsd %xmm1, %xmm2 + mulsd %xmm4, %xmm6 + mulsd %xmm1, %xmm3 + addsd 8(%esp), %xmm5 + addsd 16(%esp), %xmm5 + addsd 8(%esp), %xmm2 + addsd 16(%esp), %xmm2 + addsd %xmm6, %xmm5 + addsd %xmm3, %xmm2 + movsd 2624(%ebx), %xmm7 + divsd %xmm5, %xmm7 + mulsd 64(%eax), %xmm7 + movsd 56(%eax), %xmm3 + mulsd %xmm2, %xmm3 + movsd 24(%eax), %xmm4 + mulsd %xmm2, %xmm4 + movsd 40(%eax), %xmm5 + mulsd %xmm2, %xmm5 + movsd 8(%eax), %xmm6 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm2 + addsd 48(%eax), %xmm3 + addsd 16(%eax), %xmm4 + addsd 32(%eax), %xmm5 + addsd (%eax), %xmm6 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm2 + addsd %xmm5, %xmm3 + addsd %xmm6, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm4, %xmm3 + subsd %xmm7, %xmm3 + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_9.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_9.0.2: + movsd %xmm3, (%esp) + fldl (%esp) + jmp .L_2TAG_PACKET_5.0.2 +.L_2TAG_PACKET_8.0.2: + movl 4(%esp), %eax + andl $-24577, %eax + cmpl 4(%esp), %eax + je .L_2TAG_PACKET_10.0.2 + stmxcsr 8(%esp) + movl 4(%esp), %eax + andl $24576, %eax + orl %eax, 8(%esp) + ldmxcsr 8(%esp) +.L_2TAG_PACKET_10.0.2: + movss %xmm0, (%esp) + flds (%esp) + fsubs (%esp) +.L_2TAG_PACKET_5.0.2: + addl $16, %esp + movl 56(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type tanf,@function + .size tanf,.-tanf + .data +# -- End tanf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1431655765 + .long 1070945621 + .long 0 + .long 0 + .long 286331153 + .long 1069617425 + .long 0 + .long 0 + .long 463583772 + .long 1068212666 + .long 0 + .long 0 + .long 2354785698 + .long 1069102779 + .long 3310429884 + .long 1072703419 + .long 3693284251 + .long 1069118808 + .long 1996245381 + .long 1071000265 + .long 3055842593 + .long 1068578846 + .long 2269530157 + .long 1069711235 + .long 1046897440 + .long 1067705865 + .long 522045958 + .long 1068476590 + .long 0 + .long 0 + .long 3763679576 + .long 1070167541 + .long 404682282 + .long 1072734736 + .long 3593250296 + .long 1070233561 + .long 1127373050 + .long 1071173457 + .long 24583402 + .long 1069723988 + .long 3223889699 + .long 1070020367 + .long 558065897 + .long 1068949418 + .long 388873200 + .long 1068944270 + .long 0 + .long 0 + .long 895247324 + .long 1070819848 + .long 582494902 + .long 1072789737 + .long 3631919291 + .long 1070936926 + .long 2031366438 + .long 1071495745 + .long 1509038701 + .long 1070601643 + .long 3785344682 + .long 1070618476 + .long 3233018412 + .long 1069913186 + .long 1065584192 + .long 1069747896 + .long 0 + .long 0 + .long 2583490354 + .long 1071284857 + .long 855738471 + .long 1072873155 + .long 2616040238 + .long 1071582937 + .long 2529240549 + .long 1071836633 + .long 2251697184 + .long 1071253687 + .long 1263091857 + .long 1071190461 + .long 2476932470 + .long 1070842002 + .long 855891755 + .long 1070696894 + .long 0 + .long 0 + .long 419968236 + .long 1071717047 + .long 1813808633 + .long 1072992828 + .long 1037049034 + .long 1072037305 + .long 1447406859 + .long 1072265209 + .long 3205232916 + .long 1071968658 + .long 1066110976 + .long 1071946035 + .long 1496754229 + .long 1071807201 + .long 4014441989 + .long 1071736222 + .long 0 + .long 0 + .long 716700048 + .long 1071997368 + .long 274476850 + .long 1073161398 + .long 3912524733 + .long 1072622983 + .long 4107767972 + .long 1072827408 + .long 946523347 + .long 1072772766 + .long 581531518 + .long 1072826391 + .long 3718905905 + .long 1072832823 + .long 513572637 + .long 1072861969 + .long 0 + .long 0 + .long 719595600 + .long 1072317184 + .long 1194536594 + .long 1073399478 + .long 1264738763 + .long 1073084804 + .long 1958936600 + .long 1073411493 + .long 4270740730 + .long 1073574708 + .long 1303998552 + .long 1073799186 + .long 1769828046 + .long 1073938542 + .long 433361110 + .long 1074105369 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 1073741824 + .long 0 + .long 1073741824 + .long 1431655765 + .long 1074091349 + .long 2863311531 + .long 1074440874 + .long 286331153 + .long 1074860305 + .long 95443718 + .long 1075163227 + .long 463583772 + .long 1075552698 + .long 0 + .long 0 + .long 1526324265 + .long 3217967566 + .long 457728975 + .long 1071088276 + .long 602185705 + .long 3215678092 + .long 555127889 + .long 1067545266 + .long 3690544014 + .long 3213150171 + .long 4003114407 + .long 1064581412 + .long 3759536023 + .long 3210559989 + .long 3837960785 + .long 1061790379 + .long 0 + .long 1072693248 + .long 719981842 + .long 3217669096 + .long 3749156607 + .long 1071048258 + .long 2754706541 + .long 3215359511 + .long 790323742 + .long 1067402587 + .long 4097292716 + .long 3212856302 + .long 2442796466 + .long 1064337602 + .long 170296152 + .long 3210060867 + .long 3614866008 + .long 1061361670 + .long 0 + .long 1072693248 + .long 701484222 + .long 3217377742 + .long 2267016812 + .long 1071015664 + .long 2223654598 + .long 3215071936 + .long 706390066 + .long 1067217386 + .long 1066252975 + .long 3212391267 + .long 3202745457 + .long 1064010682 + .long 1046243251 + .long 3209678971 + .long 2763962276 + .long 1060970161 + .long 0 + .long 1072693248 + .long 2829232582 + .long 3217092115 + .long 298675305 + .long 1070989821 + .long 1485063559 + .long 3214682643 + .long 3996381654 + .long 1067075828 + .long 2866066872 + .long 3211982662 + .long 3669764559 + .long 1063748136 + .long 1948234989 + .long 3209098147 + .long 3398041407 + .long 1060559728 + .long 0 + .long 1072693248 + .long 3593905368 + .long 3216590719 + .long 4076712227 + .long 1070970214 + .long 3144465176 + .long 3214191500 + .long 1618153340 + .long 1066971547 + .long 584032116 + .long 3211469261 + .long 4247487438 + .long 1063561943 + .long 3844233498 + .long 3208626322 + .long 3857199098 + .long 1060281647 + .long 0 + .long 1072693248 + .long 3789571175 + .long 3216034914 + .long 3870939386 + .long 1070956467 + .long 628750575 + .long 3213566872 + .long 2954464709 + .long 1066900026 + .long 1466315631 + .long 3210837162 + .long 2766187256 + .long 1063437894 + .long 3695969289 + .long 3207854418 + .long 3095830084 + .long 1060095334 + .long 0 + .long 1072693248 + .long 1858778712 + .long 3214984212 + .long 2242038011 + .long 1070948320 + .long 2507068734 + .long 3212502004 + .long 2446607349 + .long 1066858259 + .long 1349489537 + .long 3209765608 + .long 1721283327 + .long 1063366855 + .long 3852528092 + .long 3206760861 + .long 1758739894 + .long 1059895449 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1431655765 + .long 1070945621 + .long 0 + .long 0 + .long 381774871 + .long 1066844524 + .long 0 + .long 0 + .long 3154187623 + .long 1063343722 + .long 0 + .long 0 + .long 2469719819 + .long 1059831159 + .long 0 + .long 1072693248 + .long 1858778712 + .long 1067500564 + .long 2242038011 + .long 1070948320 + .long 2507068734 + .long 1065018356 + .long 2446607349 + .long 1066858259 + .long 1349489537 + .long 1062281960 + .long 1721283327 + .long 1063366855 + .long 3852528092 + .long 1059277213 + .long 1758739894 + .long 1059895449 + .long 0 + .long 1072693248 + .long 3789571175 + .long 1068551266 + .long 3870939386 + .long 1070956467 + .long 628750575 + .long 1066083224 + .long 2954464709 + .long 1066900026 + .long 1466315631 + .long 1063353514 + .long 2766187256 + .long 1063437894 + .long 3695969289 + .long 1060370770 + .long 3095830084 + .long 1060095334 + .long 0 + .long 1072693248 + .long 3593905368 + .long 1069107071 + .long 4076712227 + .long 1070970214 + .long 3144465176 + .long 1066707852 + .long 1618153340 + .long 1066971547 + .long 584032116 + .long 1063985613 + .long 4247487438 + .long 1063561943 + .long 3844233498 + .long 1061142674 + .long 3857199098 + .long 1060281647 + .long 0 + .long 1072693248 + .long 2829232582 + .long 1069608467 + .long 298675305 + .long 1070989821 + .long 1485063559 + .long 1067198995 + .long 3996381654 + .long 1067075828 + .long 2866066872 + .long 1064499014 + .long 3669764559 + .long 1063748136 + .long 1948234989 + .long 1061614499 + .long 3398041407 + .long 1060559728 + .long 0 + .long 1072693248 + .long 701484222 + .long 1069894094 + .long 2267016812 + .long 1071015664 + .long 2223654598 + .long 1067588288 + .long 706390066 + .long 1067217386 + .long 1066252975 + .long 1064907619 + .long 3202745457 + .long 1064010682 + .long 1046243251 + .long 1062195323 + .long 2763962276 + .long 1060970161 + .long 0 + .long 1072693248 + .long 719981842 + .long 1070185448 + .long 3749156607 + .long 1071048258 + .long 2754706541 + .long 1067875863 + .long 790323742 + .long 1067402587 + .long 4097292716 + .long 1065372654 + .long 2442796466 + .long 1064337602 + .long 170296152 + .long 1062577219 + .long 3614866008 + .long 1061361670 + .long 0 + .long 1072693248 + .long 1526324265 + .long 1070483918 + .long 457728975 + .long 1071088276 + .long 602185705 + .long 1068194444 + .long 555127889 + .long 1067545266 + .long 3690544014 + .long 1065666523 + .long 4003114407 + .long 1064581412 + .long 3759536023 + .long 1063076341 + .long 3837960785 + .long 1061790379 + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 0 + .long 1073741824 + .long 0 + .long 3221225472 + .long 1431655765 + .long 1074091349 + .long 2863311531 + .long 3221924522 + .long 286331153 + .long 1074860305 + .long 95443718 + .long 3222646875 + .long 463583772 + .long 1075552698 + .long 0 + .long 0 + .long 719595600 + .long 3219800832 + .long 1194536594 + .long 1073399478 + .long 1264738763 + .long 3220568452 + .long 1958936600 + .long 1073411493 + .long 4270740730 + .long 3221058356 + .long 1303998552 + .long 1073799186 + .long 1769828046 + .long 3221422190 + .long 433361110 + .long 1074105369 + .long 0 + .long 0 + .long 716700048 + .long 3219481016 + .long 274476850 + .long 1073161398 + .long 3912524733 + .long 3220106631 + .long 4107767972 + .long 1072827408 + .long 946523347 + .long 3220256414 + .long 581531518 + .long 1072826391 + .long 3718905905 + .long 3220316471 + .long 513572637 + .long 1072861969 + .long 0 + .long 0 + .long 419968236 + .long 3219200695 + .long 1813808633 + .long 1072992828 + .long 1037049034 + .long 3219520953 + .long 1447406859 + .long 1072265209 + .long 3205232916 + .long 3219452306 + .long 1066110976 + .long 1071946035 + .long 1496754229 + .long 3219290849 + .long 4014441989 + .long 1071736222 + .long 0 + .long 0 + .long 2583490354 + .long 3218768505 + .long 855738471 + .long 1072873155 + .long 2616040238 + .long 3219066585 + .long 2529240549 + .long 1071836633 + .long 2251697184 + .long 3218737335 + .long 1263091857 + .long 1071190461 + .long 2476932470 + .long 3218325650 + .long 855891755 + .long 1070696894 + .long 0 + .long 0 + .long 895247324 + .long 3218303496 + .long 582494902 + .long 1072789737 + .long 3631919291 + .long 3218420574 + .long 2031366438 + .long 1071495745 + .long 1509038701 + .long 3218085291 + .long 3785344682 + .long 1070618476 + .long 3233018412 + .long 3217396834 + .long 1065584192 + .long 1069747896 + .long 0 + .long 0 + .long 3763679576 + .long 3217651189 + .long 404682282 + .long 1072734736 + .long 3593250296 + .long 3217717209 + .long 1127373050 + .long 1071173457 + .long 24583402 + .long 3217207636 + .long 3223889699 + .long 1070020367 + .long 558065897 + .long 3216433066 + .long 388873200 + .long 1068944270 + .long 0 + .long 0 + .long 2354785698 + .long 3216586427 + .long 3310429884 + .long 1072703419 + .long 3693284251 + .long 3216602456 + .long 1996245381 + .long 1071000265 + .long 3055842593 + .long 3216062494 + .long 2269530157 + .long 1069711235 + .long 1046897440 + .long 3215189513 + .long 522045958 + .long 1068476590 + .long 0 + .long 0 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1916669064 + .long 1072155675 + .long 660066805 + .long 1024797180 + .long 3829231700 + .long 1062745828 + .long 2884172442 + .long 1017445907 + .long 540874025 + .long 1055617650 + .long 4198409884 + .long 1011844330 + .long 2839315448 + .long 1046639136 + .long 4204424928 + .long 1000582120 + .long 1329339431 + .long 1038229673 + .long 1295478839 + .long 993391741 + .long 658191860 + .long 1024797180 + .long 3691886121 + .long 979325773 + .long 1966800710 + .long 1020436418 + .long 1882642597 + .long 977095991 + .long 2100977488 + .long 1012908661 + .long 1840335565 + .long 967470816 + .long 4198093645 + .long 1000582120 + .long 3307942521 + .long 957055414 + .long 2839123165 + .long 996851343 + .long 1387472776 + .long 952638316 + .long 2788761024 + .long 988712873 + .long 3005712498 + .long 944467026 + .long 3694676832 + .long 979325773 + .long 1326507024 + .long 934847846 + .long 221775557 + .long 970149340 + .long 1133527550 + .long 924162364 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 3409656221 + .long 1972279101 + .long 0 + .long 0 + .long 1414004736 + .long 4156105211 + .long 0 + .long 0 + .long 1280075305 + .long 4115041315 + .long 0 + .long 0 + .long 1413742592 + .long 4156105211 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 4194304 + .long 1072693248 + .long 0 + .long 0 + .long 1092811139 + .long 0 + .long 0 + .long 0 + .long 1296039936 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 1262485504 + .long 0 + .long 0 + .long 0 + .long 1413754136 + .long 1067000315 + .long 0 + .long 0 + .long 4278190080 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 1067000315 + .long 1175561766 + .long 1043665163 + .long 4290772992 + .long 4294967295 + .long 4290772992 + .long 4294967295 + .type static_const_table,@object + .size static_const_table,2784 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tanh_wmt.S b/external/sgx_libm/ia32/tanh_wmt.S new file mode 100644 index 0000000000..a232a7d3a0 --- /dev/null +++ b/external/sgx_libm/ia32/tanh_wmt.S @@ -0,0 +1,1329 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanh_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin tanh + .text + .align 16,0x90 + .globl tanh +tanh: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movsd 4256(%ebx), %xmm3 + xorpd %xmm4, %xmm4 + movsd 4112(%ebx), %xmm1 + movsd 4120(%ebx), %xmm2 + movl $32768, %eax + pinsrw $3, %eax, %xmm4 + movsd 4096(%ebx), %xmm6 + pextrw $3, %xmm0, %ecx + andpd %xmm0, %xmm3 + andnpd %xmm0, %xmm4 + pshufd $68, %xmm4, %xmm5 + movl $32768, %edx + andl %ecx, %edx + andl $32767, %ecx + subl $16304, %ecx + cmpl $144, %ecx + jae .L_2TAG_PACKET_0.0.2 + subsd %xmm3, %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm2 + cvtsd2si %xmm3, %eax + movapd %xmm3, %xmm7 + addsd %xmm6, %xmm3 + mulsd %xmm4, %xmm1 + movsd 4264(%ebx), %xmm4 + subsd %xmm6, %xmm3 + xorpd %xmm0, %xmm0 + addsd %xmm1, %xmm2 + subsd %xmm3, %xmm7 + movapd 4128(%ebx), %xmm6 + addsd %xmm7, %xmm2 + movl $255, %ecx + andl %eax, %ecx + addl %ecx, %ecx + movapd (%ebx,%ecx,8), %xmm5 + shrl $4, %eax + andl $65520, %eax + subl $16368, %eax + negl %eax + pinsrw $3, %eax, %xmm0 + movapd 4144(%ebx), %xmm1 + pshufd $68, %xmm0, %xmm0 + mulpd %xmm5, %xmm0 + movsd 4160(%ebx), %xmm7 + pshufd $68, %xmm2, %xmm2 + movapd %xmm4, %xmm5 + addsd %xmm0, %xmm4 + mulpd %xmm2, %xmm6 + mulsd %xmm2, %xmm7 + mulpd %xmm2, %xmm2 + addpd %xmm6, %xmm1 + mulsd %xmm2, %xmm2 + movsd 4264(%ebx), %xmm3 + mulpd %xmm2, %xmm1 + pshufd $78, %xmm1, %xmm6 + addsd %xmm6, %xmm1 + movapd %xmm1, %xmm6 + addsd %xmm7, %xmm1 + mulsd %xmm0, %xmm1 + addsd %xmm4, %xmm1 + andpd 4224(%ebx), %xmm4 + divsd %xmm1, %xmm5 + subsd %xmm4, %xmm3 + pshufd $238, %xmm0, %xmm1 + addsd %xmm0, %xmm3 + movapd %xmm4, %xmm2 + addsd %xmm1, %xmm3 + mulsd %xmm7, %xmm1 + mulsd %xmm0, %xmm7 + addsd %xmm1, %xmm3 + addsd %xmm7, %xmm4 + movsd 4240(%ebx), %xmm1 + mulsd %xmm0, %xmm6 + andpd 4224(%ebx), %xmm4 + addsd %xmm6, %xmm3 + movapd %xmm4, %xmm6 + subsd %xmm4, %xmm2 + addsd %xmm7, %xmm2 + movsd 4264(%ebx), %xmm7 + andpd %xmm1, %xmm5 + addsd %xmm2, %xmm3 + mulsd %xmm5, %xmm4 + xorpd %xmm2, %xmm2 + mulsd %xmm5, %xmm3 + subsd 4272(%ebx), %xmm6 + subsd %xmm7, %xmm4 + xorl $32768, %edx + pinsrw $3, %edx, %xmm2 + addsd %xmm3, %xmm4 + mulsd %xmm5, %xmm6 + movapd %xmm3, %xmm1 + mulsd %xmm4, %xmm3 + movapd %xmm6, %xmm0 + mulsd %xmm4, %xmm6 + subsd %xmm3, %xmm1 + subsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + xorpd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + addl $960, %ecx + cmpl $1104, %ecx + jae .L_2TAG_PACKET_2.0.2 + movapd 4176(%ebx), %xmm2 + pshufd $68, %xmm0, %xmm1 + movapd 4192(%ebx), %xmm3 + mulpd %xmm1, %xmm1 + movapd 4208(%ebx), %xmm4 + mulpd %xmm1, %xmm2 + pshufd $68, %xmm1, %xmm5 + addpd %xmm3, %xmm2 + mulsd %xmm5, %xmm5 + mulpd %xmm1, %xmm2 + mulsd %xmm5, %xmm5 + addpd %xmm4, %xmm2 + mulpd %xmm5, %xmm2 + pshufd $238, %xmm2, %xmm5 + addsd %xmm5, %xmm2 + mulsd %xmm0, %xmm2 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + addl $15344, %ecx + cmpl $16448, %ecx + jae .L_2TAG_PACKET_3.0.2 + cmpl $16, %ecx + jb .L_2TAG_PACKET_4.0.2 + xorpd %xmm2, %xmm2 + movl $17392, %eax + pinsrw $3, %eax, %xmm2 + mulsd %xmm0, %xmm2 + addsd %xmm0, %xmm2 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + movapd %xmm0, %xmm2 + mulsd %xmm2, %xmm2 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_3.0.2: + cmpl $32752, %ecx + jae .L_2TAG_PACKET_5.0.2 + xorpd %xmm2, %xmm2 + movl $15344, %ecx + pinsrw $3, %ecx, %xmm2 + movapd %xmm2, %xmm3 + mulsd %xmm2, %xmm2 + addsd %xmm3, %xmm2 +.L_2TAG_PACKET_6.0.2: + xorpd %xmm0, %xmm0 + orl $16368, %edx + pinsrw $3, %edx, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_5.0.2: + movapd %xmm0, %xmm2 + movd %xmm0, %eax + psrlq $20, %xmm2 + movd %xmm2, %ecx + orl %eax, %ecx + cmpl $0, %ecx + je .L_2TAG_PACKET_6.0.2 + addsd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_1.0.2: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_7.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type tanh,@function + .size tanh,.-tanh + .data +# -- End tanh + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1797923801 + .long 1072687577 + .long 1950547427 + .long 1013229059 + .long 730821105 + .long 1072681922 + .long 2523232743 + .long 1012067188 + .long 915592468 + .long 1072676282 + .long 352947894 + .long 3161024371 + .long 2174652632 + .long 1072670657 + .long 4087714590 + .long 1014450259 + .long 35929225 + .long 1072665048 + .long 2809788041 + .long 3159436968 + .long 2912730644 + .long 1072659453 + .long 3490067722 + .long 3163405074 + .long 2038973688 + .long 1072653874 + .long 892941374 + .long 1016046459 + .long 1533953344 + .long 1072648310 + .long 769171851 + .long 1015665633 + .long 1222472308 + .long 1072642761 + .long 1054357470 + .long 3161021018 + .long 929806999 + .long 1072637227 + .long 3205336643 + .long 1015259557 + .long 481706282 + .long 1072631708 + .long 1696079173 + .long 3162710528 + .long 3999357479 + .long 1072626203 + .long 2258941616 + .long 1015924724 + .long 2719515920 + .long 1072620714 + .long 2760332941 + .long 1015137933 + .long 764307441 + .long 1072615240 + .long 3021057420 + .long 3163329523 + .long 2256325230 + .long 1072609780 + .long 580117746 + .long 1015317295 + .long 2728693978 + .long 1072604335 + .long 396109971 + .long 3163462691 + .long 2009970496 + .long 1072598905 + .long 2159039665 + .long 3162572948 + .long 4224142467 + .long 1072593489 + .long 3389820386 + .long 1015207202 + .long 610758006 + .long 1072588089 + .long 1965209397 + .long 3161866232 + .long 3884662774 + .long 1072582702 + .long 2158611599 + .long 1014210185 + .long 991358482 + .long 1072577331 + .long 838715019 + .long 3163157668 + .long 351641897 + .long 1072571974 + .long 2172261526 + .long 3163010599 + .long 1796832535 + .long 1072566631 + .long 3176955716 + .long 3160585513 + .long 863738719 + .long 1072561303 + .long 1326992220 + .long 3162613197 + .long 1679558232 + .long 1072555989 + .long 2390342287 + .long 3163333970 + .long 4076975200 + .long 1072550689 + .long 2029000899 + .long 1015208535 + .long 3594158869 + .long 1072545404 + .long 2456521700 + .long 3163256561 + .long 64696965 + .long 1072540134 + .long 1768797490 + .long 1015816960 + .long 1912561781 + .long 1072534877 + .long 3147495102 + .long 1015678253 + .long 382305176 + .long 1072529635 + .long 2347622376 + .long 3162578625 + .long 3898795731 + .long 1072524406 + .long 1249994144 + .long 1011869818 + .long 3707479175 + .long 1072519192 + .long 3613079303 + .long 1014164738 + .long 3939148246 + .long 1072513992 + .long 3210352148 + .long 1015274323 + .long 135105010 + .long 1072508807 + .long 1906148728 + .long 3163375739 + .long 721996136 + .long 1072503635 + .long 563754734 + .long 1015371318 + .long 1242007932 + .long 1072498477 + .long 1132034716 + .long 3163339831 + .long 1532734324 + .long 1072493333 + .long 3094216535 + .long 3163162857 + .long 1432208378 + .long 1072488203 + .long 1401068914 + .long 3162363963 + .long 778901109 + .long 1072483087 + .long 2248183955 + .long 3161268751 + .long 3706687593 + .long 1072477984 + .long 3521726940 + .long 1013253067 + .long 1464976603 + .long 1072472896 + .long 3507292405 + .long 3161977534 + .long 2483480501 + .long 1072467821 + .long 1216371780 + .long 1013034172 + .long 2307442995 + .long 1072462760 + .long 3190117721 + .long 3162404539 + .long 777507147 + .long 1072457713 + .long 4282924205 + .long 1015187533 + .long 2029714210 + .long 1072452679 + .long 613660079 + .long 1015099143 + .long 1610600570 + .long 1072447659 + .long 3766732298 + .long 1015760183 + .long 3657065772 + .long 1072442652 + .long 399025623 + .long 3162957078 + .long 3716502172 + .long 1072437659 + .long 2303740125 + .long 1014042725 + .long 1631695677 + .long 1072432680 + .long 2717633076 + .long 3162344026 + .long 1540824585 + .long 1072427714 + .long 1064017011 + .long 3163487690 + .long 3287523847 + .long 1072422761 + .long 1625971539 + .long 3157009955 + .long 2420883922 + .long 1072417822 + .long 2049810052 + .long 1014119888 + .long 3080351519 + .long 1072412896 + .long 3379126788 + .long 3157218001 + .long 815859274 + .long 1072407984 + .long 240396590 + .long 3163487443 + .long 4062661092 + .long 1072403084 + .long 1422616006 + .long 3163255318 + .long 4076559943 + .long 1072398198 + .long 2119478331 + .long 3160758351 + .long 703710506 + .long 1072393326 + .long 1384660846 + .long 1015195891 + .long 2380618042 + .long 1072388466 + .long 3149557219 + .long 3163320799 + .long 364333489 + .long 1072383620 + .long 3923737744 + .long 3161421373 + .long 3092190715 + .long 1072378786 + .long 814012168 + .long 3159523422 + .long 1822067026 + .long 1072373966 + .long 1241994956 + .long 1015340290 + .long 697153126 + .long 1072369159 + .long 1283515429 + .long 3163283189 + .long 3861050111 + .long 1072364364 + .long 254893773 + .long 3162813180 + .long 2572866477 + .long 1072359583 + .long 878562433 + .long 1015521741 + .long 977020788 + .long 1072354815 + .long 3065100517 + .long 1015541563 + .long 3218338682 + .long 1072350059 + .long 3404164304 + .long 3162477108 + .long 557149882 + .long 1072345317 + .long 3672720709 + .long 1014537265 + .long 1434058175 + .long 1072340587 + .long 251133233 + .long 1015085769 + .long 1405169241 + .long 1072335870 + .long 2998539689 + .long 3162830951 + .long 321958744 + .long 1072331166 + .long 3401933767 + .long 1015794558 + .long 2331271250 + .long 1072326474 + .long 812057446 + .long 1012207446 + .long 2990417245 + .long 1072321795 + .long 3683467745 + .long 3163369326 + .long 2152073944 + .long 1072317129 + .long 1486860576 + .long 3163203456 + .long 3964284211 + .long 1072312475 + .long 2111583915 + .long 1015427164 + .long 3985553595 + .long 1072307834 + .long 4002146062 + .long 1015834136 + .long 2069751141 + .long 1072303206 + .long 1562170675 + .long 3162724681 + .long 2366108318 + .long 1072298590 + .long 2867985102 + .long 3161762254 + .long 434316067 + .long 1072293987 + .long 2028358766 + .long 1013458122 + .long 424392917 + .long 1072289396 + .long 2749202995 + .long 3162838718 + .long 2191782032 + .long 1072284817 + .long 2960257726 + .long 1013742662 + .long 1297350157 + .long 1072280251 + .long 1308022040 + .long 3163412558 + .long 1892288442 + .long 1072275697 + .long 2446255666 + .long 3162600381 + .long 3833209506 + .long 1072271155 + .long 2722920684 + .long 1013754842 + .long 2682146384 + .long 1072266626 + .long 2082178513 + .long 3163363419 + .long 2591453363 + .long 1072262109 + .long 2132396182 + .long 3159074198 + .long 3418903055 + .long 1072257604 + .long 2527457337 + .long 3160820604 + .long 727685349 + .long 1072253112 + .long 2038246809 + .long 3162358742 + .long 2966275557 + .long 1072248631 + .long 2176155324 + .long 3159842759 + .long 1403662306 + .long 1072244163 + .long 2788809599 + .long 3161671007 + .long 194117574 + .long 1072239707 + .long 777528612 + .long 3163412089 + .long 3492293770 + .long 1072235262 + .long 2248032210 + .long 1015386826 + .long 2568320822 + .long 1072230830 + .long 2732824428 + .long 1014352915 + .long 1577608921 + .long 1072226410 + .long 1875489510 + .long 3162968394 + .long 380978316 + .long 1072222002 + .long 854188970 + .long 3160462686 + .long 3134592888 + .long 1072217605 + .long 4232266862 + .long 1015991134 + .long 1110089947 + .long 1072213221 + .long 1451641639 + .long 1015474673 + .long 2759350287 + .long 1072208848 + .long 1148526634 + .long 1015894933 + .long 3649726105 + .long 1072204487 + .long 4085036346 + .long 1015649474 + .long 3643909174 + .long 1072200138 + .long 3537586109 + .long 1014354647 + .long 2604962541 + .long 1072195801 + .long 2614425274 + .long 3163539192 + .long 396319521 + .long 1072191476 + .long 4172420816 + .long 3159074632 + .long 1176749997 + .long 1072187162 + .long 2738998779 + .long 3162035844 + .long 515457527 + .long 1072182860 + .long 836709333 + .long 1015651226 + .long 2571947539 + .long 1072178569 + .long 3558159064 + .long 3163376669 + .long 2916157145 + .long 1072174290 + .long 219487565 + .long 1015309367 + .long 1413356050 + .long 1072170023 + .long 1651349291 + .long 3162668166 + .long 2224145553 + .long 1072165767 + .long 3482522030 + .long 3161489169 + .long 919555682 + .long 1072161523 + .long 3121969534 + .long 1012948226 + .long 1660913392 + .long 1072157290 + .long 4218599604 + .long 1015135707 + .long 19972402 + .long 1072153069 + .long 3507899862 + .long 1016009292 + .long 158781403 + .long 1072148859 + .long 2221464712 + .long 3163286453 + .long 1944781191 + .long 1072144660 + .long 3993278767 + .long 3161724279 + .long 950803702 + .long 1072140473 + .long 1655364926 + .long 1015237032 + .long 1339972927 + .long 1072136297 + .long 167908909 + .long 1015572152 + .long 2980802057 + .long 1072132132 + .long 378619896 + .long 1015773303 + .long 1447192521 + .long 1072127979 + .long 1462857171 + .long 3162514521 + .long 903334909 + .long 1072123837 + .long 1636462108 + .long 1015039997 + .long 1218806132 + .long 1072119706 + .long 1818613052 + .long 3162548441 + .long 2263535754 + .long 1072115586 + .long 752233586 + .long 3162639008 + .long 3907805044 + .long 1072111477 + .long 2257091225 + .long 3161550407 + .long 1727278727 + .long 1072107380 + .long 3562710623 + .long 1011471940 + .long 4182873220 + .long 1072103293 + .long 629542646 + .long 3161996303 + .long 2555984613 + .long 1072099218 + .long 2652555442 + .long 3162552692 + .long 1013258799 + .long 1072095154 + .long 1748797611 + .long 3160129082 + .long 3721688645 + .long 1072091100 + .long 3069276937 + .long 1015839401 + .long 1963711167 + .long 1072087058 + .long 1744767757 + .long 3160574294 + .long 4201977662 + .long 1072083026 + .long 748330254 + .long 1013594357 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 2979960120 + .long 1072074996 + .long 2599109725 + .long 1014498493 + .long 3561793907 + .long 1072070997 + .long 1157054053 + .long 1011890350 + .long 3339203574 + .long 1072067009 + .long 1483497780 + .long 3162408754 + .long 2186617381 + .long 1072063032 + .long 2270764084 + .long 3163272713 + .long 4273770423 + .long 1072059065 + .long 3383180809 + .long 3163218901 + .long 885834528 + .long 1072055110 + .long 1973258547 + .long 3162261564 + .long 488188413 + .long 1072051165 + .long 3199821029 + .long 1015564048 + .long 2956612997 + .long 1072047230 + .long 2118169751 + .long 3162735553 + .long 3872257780 + .long 1072043306 + .long 1253592103 + .long 1015958334 + .long 3111574537 + .long 1072039393 + .long 2606161479 + .long 3162759746 + .long 551349105 + .long 1072035491 + .long 3821916050 + .long 3162106589 + .long 363667784 + .long 1072031599 + .long 813753950 + .long 1015785209 + .long 2425981843 + .long 1072027717 + .long 2830390851 + .long 3163346599 + .long 2321106615 + .long 1072023846 + .long 2171176610 + .long 1009535771 + .long 4222122499 + .long 1072019985 + .long 1277378074 + .long 3163256737 + .long 3712504873 + .long 1072016135 + .long 88491949 + .long 1015427660 + .long 671025100 + .long 1072012296 + .long 3832014351 + .long 3163022030 + .long 3566716925 + .long 1072008466 + .long 1536826856 + .long 1014142433 + .long 3689071823 + .long 1072004647 + .long 2321004996 + .long 3162552716 + .long 917841882 + .long 1072000839 + .long 18715565 + .long 1015659308 + .long 3723038930 + .long 1071997040 + .long 378465264 + .long 3162569582 + .long 3395129871 + .long 1071993252 + .long 4025345435 + .long 3162335388 + .long 4109806887 + .long 1071989474 + .long 422403966 + .long 1014469229 + .long 1453150082 + .long 1071985707 + .long 498154669 + .long 3161488062 + .long 3896463087 + .long 1071981949 + .long 1139797873 + .long 3161233805 + .long 2731501122 + .long 1071978202 + .long 1774031855 + .long 3162470021 + .long 2135241198 + .long 1071974465 + .long 1236747871 + .long 1013589147 + .long 1990012071 + .long 1071970738 + .long 3529070563 + .long 3162813193 + .long 2178460671 + .long 1071967021 + .long 777878098 + .long 3162842493 + .long 2583551245 + .long 1071963314 + .long 3161094195 + .long 1015606491 + .long 3088564500 + .long 1071959617 + .long 1762311517 + .long 1015045673 + .long 3577096743 + .long 1071955930 + .long 2951496418 + .long 1013793687 + .long 3933059031 + .long 1071952253 + .long 2133366768 + .long 3161531832 + .long 4040676318 + .long 1071948586 + .long 4090609238 + .long 1015663458 + .long 3784486610 + .long 1071944929 + .long 1581883040 + .long 3161698953 + .long 3049340112 + .long 1071941282 + .long 3062915824 + .long 1013170595 + .long 1720398391 + .long 1071937645 + .long 3980678963 + .long 3163300080 + .long 3978100823 + .long 1071934017 + .long 3513027190 + .long 1015845963 + .long 1118294578 + .long 1071930400 + .long 2197495694 + .long 3159909401 + .long 1617004845 + .long 1071926792 + .long 82804944 + .long 1010342778 + .long 1065662932 + .long 1071923194 + .long 2533670915 + .long 1014530238 + .long 3645941911 + .long 1071919605 + .long 3814685081 + .long 3161573341 + .long 654919306 + .long 1071916027 + .long 3232961757 + .long 3163047469 + .long 569847338 + .long 1071912458 + .long 472945272 + .long 3159290729 + .long 3278348324 + .long 1071908898 + .long 3069497416 + .long 1014750712 + .long 78413852 + .long 1071905349 + .long 4183226867 + .long 3163017251 + .long 3743175029 + .long 1071901808 + .long 2072812490 + .long 3162175075 + .long 1276261410 + .long 1071898278 + .long 300981948 + .long 1014684169 + .long 1156440435 + .long 1071894757 + .long 2351451249 + .long 1013967056 + .long 3272845541 + .long 1071891245 + .long 928852419 + .long 3163488248 + .long 3219942644 + .long 1071887743 + .long 3798990616 + .long 1015368806 + .long 887463927 + .long 1071884251 + .long 3596744163 + .long 3160794166 + .long 460407023 + .long 1071880768 + .long 4237175092 + .long 3163138469 + .long 1829099622 + .long 1071877294 + .long 1016661181 + .long 3163461005 + .long 589198666 + .long 1071873830 + .long 2664346172 + .long 3163157962 + .long 926591435 + .long 1071870375 + .long 3208833762 + .long 3162913514 + .long 2732492859 + .long 1071866929 + .long 2691479646 + .long 3162255684 + .long 1603444721 + .long 1071863493 + .long 1548633640 + .long 3162201326 + .long 1726216749 + .long 1071860066 + .long 2466808228 + .long 3161676405 + .long 2992903935 + .long 1071856648 + .long 2218154406 + .long 1015228193 + .long 1000925746 + .long 1071853240 + .long 1018491672 + .long 3163309544 + .long 4232894513 + .long 1071849840 + .long 2383938684 + .long 1014668519 + .long 3991843581 + .long 1071846450 + .long 4092853457 + .long 1014585763 + .long 171030293 + .long 1071843070 + .long 3526460132 + .long 1014428778 + .long 1253935211 + .long 1071839698 + .long 1395382931 + .long 3159702613 + .long 2839424854 + .long 1071836335 + .long 1171596163 + .long 1013041679 + .long 526652809 + .long 1071832982 + .long 4223459736 + .long 1015879375 + .long 2799960843 + .long 1071829637 + .long 1423655381 + .long 1015022151 + .long 964107055 + .long 1071826302 + .long 2800439588 + .long 3162833221 + .long 3504003472 + .long 1071822975 + .long 3594001060 + .long 3157330652 + .long 1724976915 + .long 1071819658 + .long 420909223 + .long 3163117379 + .long 4112506593 + .long 1071816349 + .long 2947355221 + .long 1014371048 + .long 1972484976 + .long 1071813050 + .long 675290301 + .long 3161640050 + .long 3790955393 + .long 1071809759 + .long 2352942462 + .long 3163180090 + .long 874372905 + .long 1071806478 + .long 100263788 + .long 1015940732 + .long 1709341917 + .long 1071803205 + .long 2571168217 + .long 1014152499 + .long 1897844341 + .long 1071799941 + .long 1254300460 + .long 1015275938 + .long 1337108031 + .long 1071796686 + .long 3203724452 + .long 1014677845 + .long 4219606026 + .long 1071793439 + .long 2434574742 + .long 1014681548 + .long 1853186616 + .long 1071790202 + .long 3066496371 + .long 1015656574 + .long 2725843665 + .long 1071786973 + .long 1433917087 + .long 1014838523 + .long 2440944790 + .long 1071783753 + .long 2492769774 + .long 1014147454 + .long 897099801 + .long 1071780542 + .long 754756297 + .long 1015241005 + .long 2288159958 + .long 1071777339 + .long 2169144469 + .long 1014876021 + .long 2218315341 + .long 1071774145 + .long 2694295388 + .long 3163288868 + .long 586995997 + .long 1071770960 + .long 41662348 + .long 3162627992 + .long 1588871207 + .long 1071767783 + .long 143439582 + .long 3162963416 + .long 828946858 + .long 1071764615 + .long 10642492 + .long 1015939438 + .long 2502433899 + .long 1071761455 + .long 2148595913 + .long 1015023991 + .long 2214878420 + .long 1071758304 + .long 892270087 + .long 3163116422 + .long 4162030108 + .long 1071755161 + .long 2763428480 + .long 1015529349 + .long 3949972341 + .long 1071752027 + .long 2068408548 + .long 1014913868 + .long 1480023343 + .long 1071748902 + .long 2247196168 + .long 1015327453 + .long 948735466 + .long 1071745785 + .long 3516338028 + .long 3162574883 + .long 2257959872 + .long 1071742676 + .long 3802946148 + .long 1012964927 + .long 1014845819 + .long 1071739576 + .long 3117910646 + .long 3161559105 + .long 1416741826 + .long 1071736484 + .long 2196380210 + .long 1011413563 + .long 3366293073 + .long 1071733400 + .long 3119426314 + .long 1014120554 + .long 2471440686 + .long 1071730325 + .long 968836267 + .long 3162214888 + .long 2930322912 + .long 1071727258 + .long 2599499422 + .long 3162714047 + .long 351405227 + .long 1071724200 + .long 3125337328 + .long 3159822479 + .long 3228316108 + .long 1071721149 + .long 3010241991 + .long 3158422804 + .long 2875075254 + .long 1071718107 + .long 4144233330 + .long 3163333716 + .long 3490863953 + .long 1071715073 + .long 960797498 + .long 3162948880 + .long 685187902 + .long 1071712048 + .long 378731989 + .long 1014843115 + .long 2952712987 + .long 1071709030 + .long 3293494651 + .long 3160120301 + .long 1608493509 + .long 1071706021 + .long 3159622171 + .long 3162807737 + .long 852742562 + .long 1071703020 + .long 667253586 + .long 1009793559 + .long 590962156 + .long 1071700027 + .long 3829346666 + .long 3163275597 + .long 728909815 + .long 1071697042 + .long 383930225 + .long 1015029468 + .long 1172597893 + .long 1071694065 + .long 114433263 + .long 1015347593 + .long 1828292879 + .long 1071691096 + .long 1255956747 + .long 1015588398 + .long 2602514713 + .long 1071688135 + .long 2268929336 + .long 1014354284 + .long 3402036099 + .long 1071685182 + .long 405889334 + .long 1015105656 + .long 4133881824 + .long 1071682237 + .long 2148155345 + .long 3162931299 + .long 410360776 + .long 1071679301 + .long 1269990655 + .long 1011975870 + .long 728934454 + .long 1071676372 + .long 1413842688 + .long 1014178612 + .long 702412510 + .long 1071673451 + .long 3803266087 + .long 3162280415 + .long 238821257 + .long 1071670538 + .long 1469694871 + .long 3162884987 + .long 3541402996 + .long 1071667632 + .long 2759177317 + .long 1014854626 + .long 1928746161 + .long 1071664735 + .long 983617676 + .long 1014285177 + .long 3899555717 + .long 1071661845 + .long 427280750 + .long 3162546972 + .long 772914124 + .long 1071658964 + .long 4004372762 + .long 1012230161 + .long 1048019041 + .long 1071656090 + .long 1398474845 + .long 3160510595 + .long 339411585 + .long 1071653224 + .long 264588982 + .long 3161636657 + .long 2851812149 + .long 1071650365 + .long 2595802551 + .long 1015767337 + .long 4200250559 + .long 1071647514 + .long 2808127345 + .long 3161781938 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 1610612736 + .long 1082594631 + .long 4166901572 + .long 1055174155 + .long 3884607281 + .long 3168131199 + .long 3607404735 + .long 3190582024 + .long 1874480759 + .long 1032041131 + .long 4286760334 + .long 1053736893 + .long 4277811695 + .long 3211144770 + .long 0 + .long 0 + .long 236289503 + .long 1064135997 + .long 463583772 + .long 3215696314 + .long 1441186365 + .long 3212977891 + .long 286331153 + .long 1069617425 + .long 2284589306 + .long 1066820852 + .long 1431655765 + .long 3218429269 + .long 0 + .long 4294967280 + .long 0 + .long 4294967280 + .long 4294705152 + .long 4294967295 + .long 4294705152 + .long 4294967295 + .long 4160749568 + .long 2147483647 + .long 0 + .long 1072693248 + .long 0 + .long 1073741824 + .type static_const_table,@object + .size static_const_table,4280 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tanhf_wmt.S b/external/sgx_libm/ia32/tanhf_wmt.S new file mode 100644 index 0000000000..b26daf3fdd --- /dev/null +++ b/external/sgx_libm/ia32/tanhf_wmt.S @@ -0,0 +1,291 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanhf_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin tanhf + .text + .align 16,0x90 + .globl tanhf +tanhf: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movss 112(%esp), %xmm0 + xorpd %xmm1, %xmm1 + movsd 304(%ebx), %xmm3 + movl $14336, %eax + pinsrw $3, %eax, %xmm1 + movsd 288(%ebx), %xmm6 + pextrw $1, %xmm0, %ecx + psllq $33, %xmm0 + psrlq $4, %xmm0 + paddw %xmm0, %xmm1 + movapd 256(%ebx), %xmm4 + movl $32768, %edx + andl %ecx, %edx + andl $32767, %ecx + subl $15744, %ecx + cmpl $1056, %ecx + jae .L_2TAG_PACKET_0.0.2 + mulsd %xmm1, %xmm3 + cvtsd2si %xmm3, %eax + movapd %xmm3, %xmm2 + addsd %xmm6, %xmm3 + xorpd %xmm0, %xmm0 + subsd %xmm6, %xmm3 + movapd 272(%ebx), %xmm1 + subsd %xmm3, %xmm2 + movl $31, %ecx + andl %eax, %ecx + movsd (%ebx,%ecx,8), %xmm5 + shrl $1, %eax + andl $65520, %eax + subl $16368, %eax + negl %eax + pshufd $68, %xmm2, %xmm2 + pinsrw $3, %eax, %xmm0 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm1 + movsd 312(%ebx), %xmm7 + xorpd %xmm3, %xmm3 + mulpd %xmm2, %xmm4 + mulpd %xmm2, %xmm2 + mulsd %xmm5, %xmm0 + addpd %xmm4, %xmm1 + pinsrw $3, %edx, %xmm3 + mulsd %xmm2, %xmm1 + movapd %xmm7, %xmm6 + pshufd $238, %xmm1, %xmm2 + addsd %xmm0, %xmm7 + addsd %xmm2, %xmm1 + subsd %xmm0, %xmm6 + mulsd %xmm1, %xmm0 + addsd %xmm0, %xmm7 + subsd %xmm0, %xmm6 + xorpd %xmm3, %xmm7 + divsd %xmm7, %xmm6 + cvtsd2ss %xmm6, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_0.0.2: + addl $1152, %ecx + cmpl $1152, %ecx + jae .L_2TAG_PACKET_2.0.2 + movl $-1117975087, %eax + movd %eax, %xmm1 + movss 112(%esp), %xmm0 + movl $-1096111445, %ecx + movd %ecx, %xmm3 + movl $1040746633, %edx + movd %edx, %xmm2 + pshufd $68, %xmm0, %xmm4 + mulss %xmm0, %xmm0 + mulss %xmm0, %xmm1 + mulss %xmm0, %xmm3 + mulss %xmm0, %xmm0 + addss %xmm2, %xmm1 + mulss %xmm1, %xmm0 + addss %xmm3, %xmm0 + mulss %xmm4, %xmm0 + addss %xmm4, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + addl $14592, %ecx + cmpl $15744, %ecx + jae .L_2TAG_PACKET_3.0.2 + movss 112(%esp), %xmm0 + cmpl $128, %ecx + jb .L_2TAG_PACKET_4.0.2 + movl $1333788672, %eax + movd %eax, %xmm2 + mulss %xmm0, %xmm2 + addss %xmm0, %xmm2 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + movss %xmm0, %xmm2 + mulss %xmm2, %xmm2 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_3.0.2: + cmpl $32640, %ecx + jae .L_2TAG_PACKET_5.0.2 + movl $796917760, %eax + movd %eax, %xmm2 + movss %xmm2, %xmm3 + mulss %xmm2, %xmm2 + addss %xmm3, %xmm2 +.L_2TAG_PACKET_6.0.2: + xorps %xmm0, %xmm0 + orl $16256, %edx + pinsrw $1, %edx, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_5.0.2: + movl 112(%esp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_6.0.2 + movss 112(%esp), %xmm0 + addss %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_1.0.2: + movss %xmm0, 24(%esp) + flds 24(%esp) + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type tanhf,@function + .size tanhf,.-tanhf + .data +# -- End tanhf + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 0 + .long 1072693248 + .long 1533953344 + .long 1072648310 + .long 2728693978 + .long 1072604335 + .long 863738719 + .long 1072561303 + .long 3707479175 + .long 1072519192 + .long 3706687593 + .long 1072477984 + .long 3716502172 + .long 1072437659 + .long 4076559943 + .long 1072398198 + .long 2572866477 + .long 1072359583 + .long 2990417245 + .long 1072321795 + .long 2191782032 + .long 1072284817 + .long 2966275557 + .long 1072248631 + .long 1110089947 + .long 1072213221 + .long 2571947539 + .long 1072178569 + .long 1944781191 + .long 1072144660 + .long 3907805044 + .long 1072111477 + .long 1719614413 + .long 1072079006 + .long 2956612997 + .long 1072047230 + .long 3712504873 + .long 1072016135 + .long 1453150082 + .long 1071985707 + .long 3577096743 + .long 1071955930 + .long 1617004845 + .long 1071926792 + .long 1276261410 + .long 1071898278 + .long 926591435 + .long 1071870375 + .long 171030293 + .long 1071843070 + .long 4112506593 + .long 1071816349 + .long 1853186616 + .long 1071790202 + .long 828946858 + .long 1071764615 + .long 1014845819 + .long 1071739576 + .long 3490863953 + .long 1071715073 + .long 1828292879 + .long 1071691096 + .long 3541402996 + .long 1071667632 + .long 1874480759 + .long 1044624043 + .long 4286760334 + .long 1060028349 + .long 3607404735 + .long 3200019208 + .long 4277811695 + .long 3214290498 + .long 0 + .long 1127743488 + .long 0 + .long 3275227136 + .long 1697350398 + .long 1079448903 + .long 0 + .long 1072693248 + .type static_const_table,@object + .size static_const_table,320 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tanhl.S b/external/sgx_libm/ia32/tanhl.S new file mode 100644 index 0000000000..71411db054 --- /dev/null +++ b/external/sgx_libm/ia32/tanhl.S @@ -0,0 +1,992 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanhl.c" + .text +..TXTST0: +# -- Begin tanhl + .text + .align 16,0x90 + .globl tanhl +tanhl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp +..B1.2: + fnstcw 54(%esp) +..B1.3: + movzwl 16(%ebp), %eax + andl $32767, %eax + movzwl 54(%esp), %ecx + cmpl $16388, %eax + call ..L2 +..L2: + popl %edx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edx), %edx + jge ..B1.56 +..B1.4: + cmpl $16382, %eax + jge ..B1.46 +..B1.5: + cmpl $16376, %eax + jge ..B1.39 +..B1.6: + cmpl $16371, %eax + jge ..B1.32 +..B1.7: + cmpl $16365, %eax + jge ..B1.25 +..B1.8: + cmpl $16308, %eax + jge ..B1.18 +..B1.9: + movl %ecx, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.69 +..B1.10: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.11: + fldcw 52(%esp) +..B1.12: + movzwl 16(%ebp), %eax + movl $1, %esi + andl $32767, %eax +..B1.13: + testl %eax, %eax + jle ..B1.65 +..B1.14: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%edx) + fmul %st(1), %st + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%edx) + fstpt 16(%esp) +..B1.15: + testl %esi, %esi + je ..B1.17 +..B1.16: + fldcw 54(%esp) +..B1.17: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.70 +..B1.19: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.20: + fldcw 52(%esp) +..B1.21: + movl $1, %eax +..B1.22: + fldt 8(%ebp) + testl %eax, %eax + fldt _Q3@GOTOFF(%edx) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.24 +..B1.23: + fldcw 54(%esp) +..B1.24: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.71 +..B1.26: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.27: + fldcw 52(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_Q2@GOTOFF(%edx) + fmul %st(1), %st + fldt _Q2@GOTOFF(%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.31 +..B1.30: + fldcw 54(%esp) +..B1.31: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.32: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.72 +..B1.33: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.34: + fldcw 52(%esp) +..B1.35: + movl $1, %eax +..B1.36: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_Q1@GOTOFF(%edx) + fmul %st(1), %st + fldt 12+_Q1@GOTOFF(%edx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_Q1@GOTOFF(%edx) + fmulp %st, %st(2) + fldt _Q1@GOTOFF(%edx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.38 +..B1.37: + fldcw 54(%esp) +..B1.38: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.39: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.73 +..B1.40: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.41: + fldcw 52(%esp) +..B1.42: + movl $1, %ecx +..B1.43: + fldt 8(%ebp) + fldl _TWO_52H@GOTOFF(%edx) + fldt 180+_Q@GOTOFF(%edx) + fldt 168+_Q@GOTOFF(%edx) + fldt 156+_Q@GOTOFF(%edx) + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + testl %ecx, %ecx + fxch %st(4) + fmull ones@GOTOFF(%edx,%eax,8) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(6) + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fxch %st(2) + fmul %st(5), %st + fxch %st(1) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(5) + fld %st(4) + fsubr %st(1), %st + fxch %st(5) + fstpt 16(%esp) + fldt 16(%esp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 144+_Q@GOTOFF(%edx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(6), %st + fldt 132+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 120+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 108+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 96+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 84+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 72+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 60+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 48+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 36+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 24+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 12+_Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(6) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fmul %st(0), %st + fldt _Q@GOTOFF(%edx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + faddp %st, %st(6) + fld %st(4) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fld %st(2) + fmul %st(3), %st + fldt 204+_Q@GOTOFF(%edx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(7) + fmulp %st, %st(1) + fldt 192+_Q@GOTOFF(%edx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(4) + fld %st(2) + fldl _TWO_48H@GOTOFF(%edx) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fmul %st, %st(2) + fsubr %st, %st(3) + fxch %st(6) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt 16(%esp) + fmul %st, %st(3) + faddp %st, %st(3) + fxch %st(1) + fmull ones@GOTOFF(%edx,%eax,8) + fxch %st(2) + fmull ones@GOTOFF(%edx,%eax,8) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + je ..B1.83 +..B1.44: + fstpt 28(%esp) +..B1.82: + fldcw 54(%esp) + jmp ..B1.45 +..B1.83: + fstp %st(0) +..B1.45: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.46: + movl %ecx, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.74 +..B1.47: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.48: + fldcw 52(%esp) +..B1.49: + movzwl 16(%ebp), %eax + movl $1, %ebx +..B1.50: + fldt 8(%ebp) + fldl _TWO_63H@GOTOFF(%edx) + fldt .L_2il0floatpacket.0@GOTOFF(%edx) + fldt .L_2il0floatpacket.1@GOTOFF(%edx) + fldl _TWO_32@GOTOFF(%edx) + movzbl 17(%ebp), %esi + andl $128, %esi + shrl $7, %esi + fstl 56(%esp) + shll $16, %eax + fldl twos@GOTOFF(%edx,%esi,8) + fmul %st, %st(5) + fxch %st(3) + fmul %st(5), %st + fadd %st(4), %st + fstpt 28(%esp) + fldt 28(%esp) + fsubp %st, %st(4) + fxch %st(1) + fmul %st(3), %st + movl 28(%esp), %ecx + fsubrp %st, %st(4) + fld %st(3) + fldt .L_2il0floatpacket.2@GOTOFF(%edx) + fmulp %st, %st(4) + movsbl %cl, %edi + fsub %st(3), %st + fldl _TWO_32P@GOTOFF(%edx) + subl %edi, %ecx + fmul %st(1), %st + fxch %st(2) + fmulp %st, %st(1) + shll $4, %edi + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + shrl $8, %ecx + fxch %st(3) + fsubrp %st, %st(4) + shll $23, %ecx + fadd %st(3), %st + fld %st(0) + addl $1065353216, %ecx + fmul %st(1), %st + fldt 48+_P@GOTOFF(%edx) + fmul %st(1), %st + fldt 36+_P@GOTOFF(%edx) + fmul %st(2), %st + fldt 24+_P@GOTOFF(%edx) + movl %ecx, 12(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 12+_P@GOTOFF(%edx) + movzwl 14(%ebp), %ecx + orl %ecx, %eax + andl $2147483647, %eax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + cmpl $1073845862, %eax + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(5) + fldt _P@GOTOFF(%edx) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 2056+__libm_expl_table_256@GOTOFF(%edx,%edi) + fldl 2048+__libm_expl_table_256@GOTOFF(%edx,%edi) + fld %st(0) + fmul %st(5), %st + fxch %st(4) + fadd %st, %st(5) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fxch %st(3) + fstpt 16(%esp) + fmul %st(2), %st + flds 12(%esp) + fldt .L_2il0floatpacket.3@GOTOFF(%edx) + jae ..B1.52 +..B1.51: + fldl 56(%esp) + fld %st(5) + fadd %st(4), %st + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fmul %st, %st(1) + fxch %st(1) + fadd %st(3), %st + fld %st(0) + fldt 16(%esp) + faddp %st, %st(6) + fxch %st(5) + fmulp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fdivr %st(4), %st + fmul %st, %st(2) + fldl _TWO_32H@GOTOFF(%edx) + fld %st(0) + fadd %st(2), %st + fstpt 28(%esp) + fldt 28(%esp) + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fmul %st, %st(7) + fxch %st(4) + faddp %st, %st(7) + fmul %st, %st(2) + fxch %st(5) + fsubrp %st, %st(2) + fxch %st(5) + faddp %st, %st(1) + fmulp %st, %st(4) + fsubp %st, %st(3) + fmul %st, %st(1) + fmulp %st, %st(2) + fsubrl ones@GOTOFF(%edx,%esi,8) + fsubp %st, %st(1) + fstpt 40(%esp) + jmp ..B1.53 +..B1.52: + fldt 16(%esp) + faddp %st, %st(6) + fxch %st(2) + faddp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fdivrp %st, %st(1) + fsubrl ones@GOTOFF(%edx,%esi,8) + fstpt 40(%esp) +..B1.53: + testl %ebx, %ebx + je ..B1.55 +..B1.54: + fldcw 54(%esp) +..B1.55: + fldt 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.56: + movl %ecx, %ebx + andl $768, %ebx + cmpl $768, %ebx + je ..B1.79 +..B1.57: + orl $-64768, %ecx + movw %cx, 52(%esp) +..B1.58: + fldcw 52(%esp) +..B1.59: + movzwl 16(%ebp), %eax + movl $1, %ecx + andl $32767, %eax +..B1.60: + cmpl $32767, %eax + je ..B1.75 +..B1.61: + movzbl 17(%ebp), %esi + andl $128, %esi + shrl $7, %esi + lea (,%esi,8), %eax + lea (%eax,%esi,4), %ebx + fldt _small_value_80@GOTOFF(%edx,%ebx) + fsubrl ones@GOTOFF(%edx,%esi,8) + fstpt 16(%esp) +..B1.62: + testl %ecx, %ecx + je ..B1.64 +..B1.63: + fldcw 54(%esp) +..B1.64: + fldt 16(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.65: + cmpl $0, 12(%ebp) + jne ..B1.67 +..B1.66: + cmpl $0, 8(%ebp) + je ..B1.68 +..B1.67: + fldt _small_value_80@GOTOFF(%edx) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%edx) + fmul %st(1), %st + movzbl 17(%ebp), %ecx + fsubp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%edx) + andl $128, %ecx + shrl $7, %ecx + fstpt 16(%esp) + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %ebx + fldt _small_value_80@GOTOFF(%edx,%ebx) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.15 +..B1.68: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.15 +..B1.69: + xorl %esi, %esi + jmp ..B1.13 +..B1.70: + xorl %eax, %eax + jmp ..B1.22 +..B1.71: + xorl %eax, %eax + jmp ..B1.29 +..B1.72: + xorl %eax, %eax + jmp ..B1.36 +..B1.73: + xorl %ecx, %ecx + jmp ..B1.43 +..B1.74: + xorl %ebx, %ebx + jmp ..B1.50 +..B1.75: + cmpl $-2147483648, 12(%ebp) + jne ..B1.78 +..B1.76: + cmpl $0, 8(%ebp) + jne ..B1.78 +..B1.77: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl ones@GOTOFF(%edx,%eax,8) + fstpt 16(%esp) + jmp ..B1.62 +..B1.78: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.62 +..B1.79: + xorl %ecx, %ecx + jmp ..B1.60 + .align 16,0x90 + .type tanhl,@function + .size tanhl,.-tanhl + .data +# -- End tanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +twos: + .long 0x00000000,0x40000000 + .long 0x00000000,0xc0000000 + .type twos,@object + .size twos,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_Q3: + .word 21845 + .word 42325 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .type _Q3,@object + .size _Q3,12 + .align 2 +_Q2: + .word 36147 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 55638 + .word 59918 + .word 34848 + .word 34952 + .word 16380 + .word 0 + .type _Q2,@object + .size _Q2,24 + .align 2 +_Q1: + .word 43688 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 48627 + .word 34947 + .word 34952 + .word 34952 + .word 16380 + .word 0 + .word 23872 + .word 38674 + .word 53460 + .word 56589 + .word 49146 + .word 0 + .word 33152 + .word 13396 + .word 6324 + .word 45860 + .word 16377 + .word 0 + .type _Q1,@object + .size _Q1,48 + .align 2 +_Q: + .word 43505 + .word 43690 + .word 43690 + .word 43690 + .word 49137 + .word 0 + .word 51768 + .word 34951 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 53715 + .word 3536 + .word 53469 + .word 56589 + .word 49146 + .word 0 + .word 37274 + .word 24708 + .word 42049 + .word 45863 + .word 16377 + .word 0 + .word 51222 + .word 13677 + .word 6831 + .word 37175 + .word 49144 + .word 0 + .word 45961 + .word 31945 + .word 59504 + .word 60265 + .word 16374 + .word 0 + .word 5972 + .word 17449 + .word 45604 + .word 48849 + .word 49141 + .word 0 + .word 32816 + .word 2946 + .word 4564 + .word 39596 + .word 16372 + .word 0 + .word 14786 + .word 2112 + .word 44465 + .word 64190 + .word 49138 + .word 0 + .word 3031 + .word 16844 + .word 22916 + .word 52030 + .word 16369 + .word 0 + .word 47485 + .word 32270 + .word 51436 + .word 42167 + .word 49136 + .word 0 + .word 3071 + .word 14344 + .word 30185 + .word 34131 + .word 16367 + .word 0 + .word 24996 + .word 54454 + .word 53234 + .word 54781 + .word 49133 + .word 0 + .word 39193 + .word 24581 + .word 37984 + .word 42131 + .word 16364 + .word 0 + .word 5913 + .word 28127 + .word 47865 + .word 55395 + .word 49130 + .word 0 + .word 25952 + .word 54950 + .word 21582 + .word 44803 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34944 + .word 16380 + .word 0 + .type _Q,@object + .size _Q,216 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .type _P,@object + .size _P,60 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .data + .hidden __libm_expl_table_256 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tanl.S b/external/sgx_libm/ia32/tanl.S new file mode 100644 index 0000000000..f26955b9ac --- /dev/null +++ b/external/sgx_libm/ia32/tanl.S @@ -0,0 +1,1683 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanl.c" + .text +..TXTST0: +# -- Begin tanl + .text + .align 16,0x90 + .globl tanl +tanl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 88(%esp) +..B1.2: + fnstcw 14(%esp) +..B1.3: + movzwl 16(%ebp), %edi + andl $32767, %edi + movzwl 14(%esp), %eax + cmpl $16373, %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + jge ..B1.41 +..B1.4: + cmpl $16371, %edi + jge ..B1.33 +..B1.5: + cmpl $16364, %edi + jge ..B1.25 +..B1.6: + cmpl $16308, %edi + jge ..B1.17 +..B1.7: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.87 +..B1.8: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.9: + fldcw 12(%esp) +..B1.10: + movzwl 16(%ebp), %edi + movl $1, %esi + andl $32767, %edi +..B1.11: + testl %edi, %edi + jle ..B1.83 +..B1.12: + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ebx) + fstpt 16(%esp) +..B1.13: + testl %esi, %esi + je ..B1.15 +..B1.14: + fldcw 14(%esp) +..B1.15: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.16: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.17: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.89 +..B1.18: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.19: + fldcw 12(%esp) +..B1.20: + movl $1, %eax +..B1.21: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt _P3@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.23 +..B1.22: + fldcw 14(%esp) +..B1.23: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.24: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.25: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.91 +..B1.26: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.27: + fldcw 12(%esp) +..B1.28: + movl $1, %eax +..B1.29: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fldt 12+_P2@GOTOFF(%ebx) + fmul %st(1), %st + fldt _P2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.31 +..B1.30: + fldcw 14(%esp) +..B1.31: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.32: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.33: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.93 +..B1.34: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.35: + fldcw 12(%esp) +..B1.36: + movl $1, %eax +..B1.37: + fldt 8(%ebp) + testl %eax, %eax + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt 36+_P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_P1@GOTOFF(%ebx) + fmulp %st, %st(2) + fldt _P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.39 +..B1.38: + fldcw 14(%esp) +..B1.39: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.40: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.99 +..B1.42: + orl $-64768, %eax + movw %ax, 12(%esp) +..B1.43: + fldcw 12(%esp) +..B1.44: + movzwl 16(%ebp), %edi + movl $1, %esi + andl $32767, %edi +..B1.45: + movzbl 17(%ebp), %eax + andl $128, %eax + shrl $7, %eax + cmpl $16413, %edi + jge ..B1.52 +..B1.46: + fldt 8(%ebp) + fldl _Pi4Inv@GOTOFF(%ebx) + fldl _ones@GOTOFF(%ebx,%eax,8) + fld %st(0) + fmul %st(3), %st + fmul %st, %st(2) + fxch %st(2) + fstpt 60(%esp) + movzwl 68(%esp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.48 +..B1.47: + fstp %st(0) + fstp %st(0) + fldl _TWO_48H@GOTOFF(%ebx) + fld %st(1) + fmul %st(1), %st + fld %st(2) + movl $1, %edx + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(2) + fsub %st(1), %st + fldt _KPi04@GOTOFF(%ebx) + fmul %st(4), %st + fstpt 60(%esp) + fxch %st(3) + jmp ..B1.63 +..B1.48: + fstp %st(2) + fldl _TWO_32H@GOTOFF(%ebx) + negl %ecx + addl $30, %ecx + movl 64(%esp), %edx + shrl %cl, %edx + incl %edx + movl %edx, %eax + andl $-2, %eax + movl %eax, 16(%esp) + cmpl $16400, %edi + fildl 16(%esp) + jge ..B1.50 +..B1.49: + fldl _Pi04x3@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x3@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x3@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + jmp ..B1.51 +..B1.50: + fldl _Pi04x5@GOTOFF(%ebx) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl 8+_Pi04x5@GOTOFF(%ebx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl 16+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fldl 24+_Pi04x5@GOTOFF(%ebx) + fmul %st(2), %st + fld %st(0) + fsubr %st(4), %st + fsubr %st, %st(4) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fldl 32+_Pi04x5@GOTOFF(%ebx) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) +..B1.51: + fldl _TWO_48H@GOTOFF(%ebx) + fld %st(1) + fmul %st(1), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fxch %st(3) + fmulp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fstpt 8(%ebp) + fldt 8(%ebp) + fldt _KPi04@GOTOFF(%ebx) + fmul %st(1), %st + fstpt 60(%esp) + jmp ..B1.63 +..B1.52: + cmpl $32767, %edi + jne ..B1.61 +..B1.53: + cmpl $-2147483648, 12(%ebp) + jne ..B1.56 +..B1.54: + cmpl $0, 8(%ebp) + jne ..B1.56 +..B1.55: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + fstpt 16(%esp) + jmp ..B1.57 +..B1.56: + fldt 8(%ebp) + fmull _ones@GOTOFF(%ebx) + fstpt 16(%esp) +..B1.57: + testl %esi, %esi + je ..B1.59 +..B1.58: + fldcw 14(%esp) +..B1.59: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.60: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.61: + fldl _ones@GOTOFF(%ebx,%eax,8) + fstl 16(%esp) + addl $-32, %esp + fldt 8(%ebp) + lea 104(%esp), %eax + fmulp %st, %st(1) + fstpt (%esp) + movl $0, 12(%esp) + movl %eax, 16(%esp) + call __libm_reduce_pi04l +..B1.102: + movl %eax, %edx + addl $32, %esp +..B1.62: + fldl 72(%esp) + incl %edx + fld %st(0) + fldl 16(%esp) + fldl _TWO_48H@GOTOFF(%ebx) + fmul %st, %st(2) + fld %st(2) + fadd %st(4), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fmul %st(1), %st + fld %st(0) + fxch %st(4) + faddl 80(%esp) + fmulp %st, %st(2) + fxch %st(1) + fadd %st, %st(3) + fxch %st(3) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt _KPi04@GOTOFF(%ebx) + fmul %st(1), %st + fstpt 60(%esp) +..B1.63: + movzwl 68(%esp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.73 +..B1.64: + testb $2, %dl + je ..B1.69 +..B1.65: + fldl 8+_ones@GOTOFF(%ebx) + testl %esi, %esi + fdiv %st(1), %st + fmul %st, %st(3) + fld %st(2) + fmul %st(5), %st + fxch %st(5) + fstpt 32(%esp) + fldt 32(%esp) + fmul %st(2), %st + faddp %st, %st(5) + fxch %st(2) + fstpt 48(%esp) + fldt 48(%esp) + fmul %st(0), %st + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fldt 60+_PG@GOTOFF(%ebx) + fmul %st(1), %st + fldt 48+_PG@GOTOFF(%ebx) + fmul %st(2), %st + fldt 36+_PG@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_PG@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(3) + fadd %st(5), %st + fsub %st(5), %st + fldt 12+_PG@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(6) + fldt _PG@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fld %st(3) + fsub %st(2), %st + fxch %st(6) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 48(%esp) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmul %st(2), %st + fldt 32(%esp) + fmul %st(5), %st + faddp %st, %st(2) + faddl _ones@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + je ..B1.107 +..B1.66: + fstpt 60(%esp) +..B1.103: + fldcw 14(%esp) + jmp ..B1.67 +..B1.107: + fstp %st(0) +..B1.67: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.68: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.69: + fldt 60+_PT@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + testl %esi, %esi + fxch %st(3) + fstpt 48(%esp) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(1) + fldt 48+_PT@GOTOFF(%ebx) + fmul %st(1), %st + fldt 36+_PT@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 24+_PT@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 12+_PT@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt _PT@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fsub %st(2), %st + fmulp %st, %st(1) + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + faddp %st, %st(2) + fldt 48(%esp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 16(%esp) + je ..B1.108 +..B1.70: + fstpt 60(%esp) +..B1.104: + fldcw 14(%esp) + jmp ..B1.71 +..B1.108: + fstp %st(0) +..B1.71: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.72: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.73: + fstp %st(0) + fldl .L_2il0floatpacket.0@GOTOFF(%ebx) + negl %ecx + fldl .L_2il0floatpacket.1@GOTOFF(%ebx) + addl $30, %ecx + movl 64(%esp), %eax + shrl %cl, %eax + movl %eax, %ecx + movzbl 17(%ebp), %edi + negl %ecx + testl $128, %edi + jne ..L3 + movl %eax, %ecx +..L3: + movl %ecx, 16(%esp) + testb $2, %dl + fildl 16(%esp) + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fld %st(2) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fsubrp %st, %st(4) + fadd %st(3), %st + je ..B1.78 +..B1.74: + fld %st(1) + fmul %st(4), %st + fld %st(4) + fmul %st(2), %st + shll $4, %ecx + faddp %st, %st(1) + fld %st(2) + testl %esi, %esi + fmul %st(3), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(4) + fstpt 32(%esp) + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fldt 60+_PT@GOTOFF(%ebx) + fmul %st(4), %st + fldt 48+_PT@GOTOFF(%ebx) + fmul %st(5), %st + fldt 36+_PT@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 24+_PT@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt 12+_PT@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(1) + fmul %st, %st(4) + fldt _PT@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fldl 272+_TG@GOTOFF(%ecx,%ebx) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fld %st(0) + fxch %st(5) + faddl 280+_TT@GOTOFF(%ecx,%ebx) + fxch %st(3) + fmull 280+_TG@GOTOFF(%ecx,%ebx) + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(4) + fldt 32(%esp) + fadd %st, %st(5) + fsubr %st, %st(5) + fxch %st(2) + fsub %st(5), %st + fstpt 48(%esp) + fldt 48(%esp) + faddp %st, %st(1) + fxch %st(3) + faddl 272+_TT@GOTOFF(%ecx,%ebx) + fld %st(0) + fadd %st(3), %st + fdivrl _ones@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(0) + fsub %st(3), %st + fld %st(0) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fxch %st(2) + fmul %st(3), %st + fld %st(3) + fmul %st(6), %st + fxch %st(6) + fadd %st(7), %st + fxch %st(7) + fmulp %st, %st(4) + faddl 8+_ones@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fsubp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + faddl 272+_GG@GOTOFF(%ecx,%ebx) + fxch %st(1) + faddl 280+_GG@GOTOFF(%ecx,%ebx) + faddp %st, %st(1) + fstpt 16(%esp) + fldt 48(%esp) + je ..B1.109 +..B1.75: + fstpt 60(%esp) +..B1.105: + fldcw 14(%esp) + jmp ..B1.76 +..B1.109: + fstp %st(0) +..B1.76: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.77: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + fldt 48+_PT@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(4) + fstpt 48(%esp) + fldt 60+_PT@GOTOFF(%ebx) + fmul %st(4), %st + fldt 36+_PT@GOTOFF(%ebx) + shll $4, %ecx + faddp %st, %st(1) + fmul %st(4), %st + testl %esi, %esi + fldt 24+_PT@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 12+_PT@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(4) + fldt _PT@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fmul %st(3), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(3) + fmul %st(1), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt 48(%esp) + fmul %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fstpt 8(%ebp) + fldt 8(%ebp) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(1), %st + fldl 272+_TG@GOTOFF(%ecx,%ebx) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(5), %st + fxch %st(3) + faddl 280+_GG@GOTOFF(%ecx,%ebx) + fxch %st(5) + faddl 272+_GG@GOTOFF(%ecx,%ebx) + fxch %st(2) + fmull 280+_TG@GOTOFF(%ecx,%ebx) + faddp %st, %st(1) + fld %st(1) + fadd %st(5), %st + fdivrl 8+_ones@GOTOFF(%ebx) + fmul %st, %st(4) + fld %st(0) + fadd %st(5), %st + fsubp %st, %st(5) + fld %st(0) + fsub %st(5), %st + fld %st(0) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(2) + fxch %st(3) + fmul %st(5), %st + fld %st(5) + fmul %st(3), %st + fxch %st(3) + fadd %st(5), %st + fxch %st(5) + fmulp %st, %st(6) + faddl _ones@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fldl 272+_TT@GOTOFF(%ecx,%ebx) + fadd %st, %st(1) + fsubr %st(1), %st + fsubr %st(2), %st + fxch %st(3) + faddl 280+_TT@GOTOFF(%ecx,%ebx) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%esp) + je ..B1.110 +..B1.79: + fstpt 60(%esp) +..B1.106: + fldcw 14(%esp) + jmp ..B1.80 +..B1.110: + fstp %st(0) +..B1.80: + movl 88(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.82 +..B1.81: + fldt 16(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.82: + call __stack_chk_fail@PLT +..B1.83: + cmpl $0, 12(%ebp) + jne ..B1.85 +..B1.84: + cmpl $0, 8(%ebp) + je ..B1.86 +..B1.85: + fldt _small_value_80@GOTOFF(%ebx) + fldt 8(%ebp) + fldl _TWO_75@GOTOFF(%ebx) + fmul %st(1), %st + movzbl 17(%ebp), %edx + faddp %st, %st(1) + fmull 8+_TWO_75@GOTOFF(%ebx) + andl $128, %edx + shrl $7, %edx + fstpt 16(%esp) + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt (%esp) + jmp ..B1.13 +..B1.86: + fldt 8(%ebp) + fstpt 16(%esp) + jmp ..B1.13 +..B1.87: + xorl %esi, %esi + jmp ..B1.11 +..B1.89: + xorl %eax, %eax + jmp ..B1.21 +..B1.91: + xorl %eax, %eax + jmp ..B1.29 +..B1.93: + xorl %eax, %eax + jmp ..B1.37 +..B1.99: + xorl %esi, %esi + jmp ..B1.45 + .align 16,0x90 + .type tanl,@function + .size tanl,.-tanl + .data +# -- End tanl + .section .rodata, "a" + .align 16 + .align 16 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 16 +_P3: + .word 13380 + .word 43827 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .type _P3,@object + .size _P3,12 + .space 4, 0x00 # pad + .align 16 +_P2: + .word 42806 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 23834 + .word 52331 + .word 35007 + .word 34952 + .word 16380 + .word 0 + .type _P2,@object + .size _P2,24 + .space 8, 0x00 # pad + .align 16 +_P1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16380 + .word 0 + .word 31445 + .word 3491 + .word 53469 + .word 56589 + .word 16378 + .word 0 + .word 16733 + .word 58542 + .word 44372 + .word 45863 + .word 16377 + .word 0 + .type _P1,@object + .size _P1,48 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .space 8, 0x00 # pad + .align 16 +_KPi04: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16387 + .word 0 + .type _KPi04,@object + .size _KPi04,12 + .space 4, 0x00 # pad + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_Pi04x3: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _Pi04x3,@object + .size _Pi04x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi04x5: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _Pi04x5,@object + .size _Pi04x5,40 + .space 8, 0x00 # pad + .align 16 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_PG: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 46604 + .word 2912 + .word 24758 + .word 46603 + .word 16377 + .word 0 + .word 64867 + .word 2218 + .word 21984 + .word 35507 + .word 16374 + .word 0 + .word 37428 + .word 49066 + .word 48281 + .word 56811 + .word 16370 + .word 0 + .word 28819 + .word 40692 + .word 30466 + .word 45908 + .word 16367 + .word 0 + .word 58229 + .word 57025 + .word 27882 + .word 37211 + .word 16364 + .word 0 + .type _PG,@object + .size _PG,72 + .space 8, 0x00 # pad + .align 16 +_PT: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 35260 + .word 34952 + .word 34952 + .word 34952 + .word 16380 + .word 0 + .word 59431 + .word 3445 + .word 53469 + .word 56589 + .word 16378 + .word 0 + .word 60805 + .word 19035 + .word 42054 + .word 45863 + .word 16377 + .word 0 + .word 32963 + .word 17667 + .word 64505 + .word 37174 + .word 16376 + .word 0 + .word 33271 + .word 14204 + .word 52730 + .word 60442 + .word 16374 + .word 0 + .type _PT,@object + .size _PT,72 + .space 8, 0x00 # pad + .align 16 +_TG: + .long 2684354560 + .long 3221230545 + .long 1980244105 + .long 1046278452 + .long 0 + .long 3221225472 + .long 0 + .long 0 + .long 2684354560 + .long 3221230545 + .long 1980244105 + .long 1046278452 + .long 3758096384 + .long 3221246014 + .long 1513286675 + .long 1048381067 + .long 0 + .long 3221272655 + .long 4057975187 + .long 3193921290 + .long 2147483648 + .long 3221311866 + .long 2902494488 + .long 1046516509 + .long 3221225472 + .long 3221365863 + .long 1948335328 + .long 3196126810 + .long 2684354560 + .long 3221438007 + .long 3744091947 + .long 3192783219 + .long 2684354560 + .long 3221533379 + .long 3860423252 + .long 1047335024 + .long 2147483648 + .long 3221659806 + .long 862942416 + .long 1049198788 + .long 0 + .long 3221829776 + .long 543592927 + .long 3195468420 + .long 0 + .long 3222064283 + .long 2814267453 + .long 1048596082 + .long 536870912 + .long 3222337673 + .long 2980891112 + .long 3196362141 + .long 2684354560 + .long 3222595502 + .long 141458722 + .long 1049458206 + .long 3221225472 + .long 3223031588 + .long 2120823910 + .long 1049591613 + .long 3221225472 + .long 3223617753 + .long 663882580 + .long 3198186420 + .long 2147483648 + .long 3224659859 + .long 3051968734 + .long 3194791707 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1077176211 + .long 3051968734 + .long 1047308059 + .long 3221225472 + .long 1076134105 + .long 663882580 + .long 1050702772 + .long 3221225472 + .long 1075547940 + .long 2120823910 + .long 3197075261 + .long 2684354560 + .long 1075111854 + .long 141458722 + .long 3196941854 + .long 536870912 + .long 1074854025 + .long 2980891112 + .long 1048878493 + .long 0 + .long 1074580635 + .long 2814267453 + .long 3196079730 + .long 0 + .long 1074346128 + .long 543592927 + .long 1047984772 + .long 2147483648 + .long 1074176158 + .long 862942416 + .long 3196682436 + .long 2684354560 + .long 1074049731 + .long 3860423252 + .long 3194818672 + .long 2684354560 + .long 1073954359 + .long 3744091947 + .long 1045299571 + .long 3221225472 + .long 1073882215 + .long 1948335328 + .long 1048643162 + .long 2147483648 + .long 1073828218 + .long 2902494488 + .long 3194000157 + .long 0 + .long 1073789007 + .long 4057975187 + .long 1046437642 + .long 3758096384 + .long 1073762366 + .long 1513286675 + .long 3195864715 + .long 2684354560 + .long 1073746897 + .long 1980244105 + .long 3193762100 + .long 0 + .long 1073741824 + .long 0 + .long 0 + .long 2684354560 + .long 1073746897 + .long 1980244105 + .long 3193762100 + .type _TG,@object + .size _TG,560 + .align 16 +_TT: + .long 1610612736 + .long 3220285245 + .long 1765132704 + .long 1046851815 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 3221225472 + .long 3219980491 + .long 3100042604 + .long 3192709428 + .long 1073741824 + .long 3219800832 + .long 2956254064 + .long 1046813655 + .long 0 + .long 3219635098 + .long 829070670 + .long 1046664815 + .long 0 + .long 3219481016 + .long 3358544266 + .long 3195362300 + .long 2147483648 + .long 3219336728 + .long 4185368031 + .long 3193047295 + .long 536870912 + .long 3219200695 + .long 1373988029 + .long 1045159724 + .long 0 + .long 3219014926 + .long 4104169752 + .long 3192540796 + .long 2147483648 + .long 3218768505 + .long 843197631 + .long 3193568495 + .long 0 + .long 3218531914 + .long 1839318447 + .long 1044402419 + .long 1073741824 + .long 3218303496 + .long 1215676724 + .long 1044727608 + .long 1610612736 + .long 3218081786 + .long 2922073518 + .long 3193275942 + .long 0 + .long 3217651190 + .long 2818065035 + .long 1045408462 + .long 2147483648 + .long 3217226924 + .long 2142552361 + .long 1043903475 + .long 2147483648 + .long 3216586427 + .long 1153689642 + .long 3190339163 + .long 2147483648 + .long 3215533863 + .long 3288774277 + .long 3189012002 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1068050215 + .long 3288774277 + .long 1041528354 + .long 2147483648 + .long 1069102779 + .long 1153689642 + .long 1042855515 + .long 2147483648 + .long 1069743276 + .long 2142552361 + .long 3191387123 + .long 0 + .long 1070167542 + .long 2818065035 + .long 3192892110 + .long 1610612736 + .long 1070598138 + .long 2922073518 + .long 1045792294 + .long 1073741824 + .long 1070819848 + .long 1215676724 + .long 3192211256 + .long 0 + .long 1071048266 + .long 1839318447 + .long 3191886067 + .long 2147483648 + .long 1071284857 + .long 843197631 + .long 1046084847 + .long 0 + .long 1071531278 + .long 4104169752 + .long 1045057148 + .long 536870912 + .long 1071717047 + .long 1373988029 + .long 3192643372 + .long 2147483648 + .long 1071853080 + .long 4185368031 + .long 1045563647 + .long 0 + .long 1071997368 + .long 3358544266 + .long 1047878652 + .long 0 + .long 1072151450 + .long 829070670 + .long 3194148463 + .long 1073741824 + .long 1072317184 + .long 2956254064 + .long 3194297303 + .long 3221225472 + .long 1072496843 + .long 3100042604 + .long 1045225780 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1610612736 + .long 1072801597 + .long 1765132704 + .long 3194335463 + .type _TT,@object + .size _TT,560 + .align 16 +_GG: + .long 3221225472 + .long 1072496843 + .long 3100042604 + .long 1045225780 + .long 0 + .long 1072693248 + .long 2680413623 + .long 2803148914 + .long 1610612736 + .long 1072801597 + .long 1765132704 + .long 3194335463 + .long 2147483648 + .long 1072922365 + .long 4224648010 + .long 1047203520 + .long 0 + .long 1073058513 + .long 1429029132 + .long 1047610106 + .long 0 + .long 1073213977 + .long 2662307862 + .long 3195905419 + .long 2147483648 + .long 1073394115 + .long 2332932060 + .long 3196140229 + .long 3221225472 + .long 1073606419 + .long 4089189126 + .long 3194062807 + .long 3758096384 + .long 1073801761 + .long 295749197 + .long 3195130376 + .long 1073741824 + .long 1073958991 + .long 862942416 + .long 3195633860 + .long 0 + .long 1074158535 + .long 1551453531 + .long 3197746903 + .long 0 + .long 1074421594 + .long 590804010 + .long 3196516863 + .long 0 + .long 1074786323 + .long 1872593098 + .long 1046983523 + .long 3758096384 + .long 1075059710 + .long 2286165020 + .long 1046614587 + .long 2147483648 + .long 1075509055 + .long 2023416727 + .long 3198791271 + .long 1610612736 + .long 1076121196 + .long 3469402705 + .long 3196752904 + .long 0 + .long 1077172992 + .long 2869016295 + .long 3199393764 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3224656640 + .long 2869016295 + .long 1051910116 + .long 1610612736 + .long 3223604844 + .long 3469402705 + .long 1049269256 + .long 2147483648 + .long 3222992703 + .long 2023416727 + .long 1051307623 + .long 3758096384 + .long 3222543358 + .long 2286165020 + .long 3194098235 + .long 0 + .long 3222269971 + .long 1872593098 + .long 3194467171 + .long 0 + .long 3221905242 + .long 590804010 + .long 1049033215 + .long 0 + .long 3221642183 + .long 1551453531 + .long 1050263255 + .long 1073741824 + .long 3221442639 + .long 862942416 + .long 1048150212 + .long 3758096384 + .long 3221285409 + .long 295749197 + .long 1047646728 + .long 3221225472 + .long 3221090067 + .long 4089189126 + .long 1046579159 + .long 2147483648 + .long 3220877763 + .long 2332932060 + .long 1048656581 + .long 0 + .long 3220697625 + .long 2662307862 + .long 1048421771 + .long 0 + .long 3220542161 + .long 1429029132 + .long 3195093754 + .long 2147483648 + .long 3220406013 + .long 4224648010 + .long 3194687168 + .long 1610612736 + .long 3220285245 + .long 1765132704 + .long 1046851815 + .long 0 + .long 3220176896 + .long 2680413623 + .long 655665266 + .long 3221225472 + .long 3219980491 + .long 3100042604 + .long 3192709428 + .type _GG,@object + .size _GG,560 + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 8 +.L_2il0floatpacket.0: + .long 0x54400000,0x3fa921fb + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x1a626331,0x3d80b461 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .data + .hidden __libm_reduce_pi04l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tgamma.S b/external/sgx_libm/ia32/tgamma.S new file mode 100644 index 0000000000..eab73c8522 --- /dev/null +++ b/external/sgx_libm/ia32/tgamma.S @@ -0,0 +1,3035 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tgamma.c" + .text +..TXTST0: +# -- Begin tgamma + .text + .align 16,0x90 + .globl tgamma +tgamma: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $68, %esp + fldl 8(%ebp) + call ..L2 +..L2: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi + fstpl 16(%esp) + fldl _zeros@GOTOFF(%edi) + fstpl 40(%esp) +..B1.2: + fnstcw 54(%esp) +..B1.3: + movzwl 54(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.125 +..B1.4: + orl $-64768, %edx + movw %dx, 52(%esp) +..B1.5: + fldcw 52(%esp) +..B1.6: + movl $1, %ebx +..B1.7: + call fegetround +..B1.128: + movl %eax, 48(%esp) +..B1.8: + cmpl $0, 48(%esp) + jne ..B1.10 +..B1.9: + xorl %ecx, %ecx + jmp ..B1.12 +..B1.10: + addl $-16, %esp + movl $0, (%esp) + call fesetround +..B1.129: + addl $16, %esp +..B1.11: + movl $1, %ecx +..B1.12: + movzwl 14(%ebp), %eax + andl $32752, %eax + shrl $4, %eax + movl 12(%ebp), %esi + shrl $31, %esi + movl %eax, 4(%esp) + cmpl $2047, %eax + je ..B1.114 +..B1.13: + fldl 8(%ebp) + fldl _zeros@GOTOFF(%edi) + movl 16(%esp), %eax + movl %eax, (%esp) + fucom %st(1) + fnstsw %ax + movl 20(%esp), %edx + andl $2147483647, %edx + movl %edx, 20(%esp) + sahf + jp ..B1.14 + je ..B1.109 +..B1.14: + cmpl $262144, %edx + jl ..B1.104 +..B1.15: + je ..B1.103 +..B1.16: + testl %esi, %esi + je ..B1.145 +..B1.17: + cmpl $1075, 4(%esp) + jge ..B1.93 +..B1.18: + fldl 16(%esp) + fld %st(0) + fldl _TWO_52H@GOTOFF(%edi) + fadd %st, %st(1) + fxch %st(1) + fstpl 32(%esp) + fldl 32(%esp) + movl 32(%esp), %edx + fsubp %st, %st(1) + movl %edx, (%esp) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.20 +..B1.19: + incl (%esp) + fsubl _ones@GOTOFF(%edi) +..B1.20: + fucompp + fnstsw %ax + sahf + jp ..B1.21 + je ..B1.88 +..B1.21: + fstp %st(0) + fldl .L_2il0floatpacket.0@GOTOFF(%edi) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.27 +..B1.22: + fstp %st(0) + testl %ecx, %ecx + je ..B1.24 +..B1.23: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.130: + addl $16, %esp +..B1.24: + movl (%esp), %eax + notl %eax + andl $1, %eax + testl %ebx, %ebx + fldl _small_value_64@GOTOFF(%edi,%eax,8) + fmull _small_value_64@GOTOFF(%edi) + fstpl 40(%esp) + je ..B1.26 +..B1.25: + fldcw 54(%esp) +..B1.26: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.145: + fstp %st(0) +..B1.27: + fcompl _overflow_boundary@GOTOFF(%edi) + fnstsw %ax + sahf + jae ..B1.98 +..B1.28: + testl %esi, %esi + je ..B1.30 +..B1.29: + fldl 16(%esp) + fld %st(0) + fldl _TWO_52H@GOTOFF(%edi) + fadd %st, %st(1) + fxch %st(1) + fstpl 32(%esp) + fldl 32(%esp) + fsub %st(1), %st + fsubr %st(2), %st + fstpl 24(%esp) + fldt 108+_tgamma_sin_table@GOTOFF(%edi) + fldt 96+_tgamma_sin_table@GOTOFF(%edi) + fldt 84+_tgamma_sin_table@GOTOFF(%edi) + fldt 72+_tgamma_sin_table@GOTOFF(%edi) + andl $2147483647, 28(%esp) + fldl 24(%esp) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 60+_tgamma_sin_table@GOTOFF(%edi) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 48+_tgamma_sin_table@GOTOFF(%edi) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 36+_tgamma_sin_table@GOTOFF(%edi) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 24+_tgamma_sin_table@GOTOFF(%edi) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 12+_tgamma_sin_table@GOTOFF(%edi) + faddp %st, %st(3) + fmul %st, %st(2) + fmul %st(1), %st + fldt _tgamma_sin_table@GOTOFF(%edi) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + jmp ..B1.31 +..B1.30: + fldl 16(%esp) + fldz + fldl _TWO_52H@GOTOFF(%edi) +..B1.31: + fldl _ones@GOTOFF(%edi) + fxch %st(1) + fadd %st(3), %st + fstpl 32(%esp) + fldl 32(%esp) + movl 32(%esp), %edx + fsubl _TWO_52H@GOTOFF(%edi) + fcom %st(3) + fnstsw %ax + sahf + jbe ..B1.33 +..B1.32: + decl %edx + fsub %st(1), %st +..B1.33: + lea 1(%edx), %eax + andl $1, %eax + movl %eax, 12(%esp) + fxch %st(3) + fcoml .L_2il0floatpacket.1@GOTOFF(%edi) + fnstsw %ax + sahf + jb ..B1.56 +..B1.34: + movl %esi, 4(%esp) + movl %edx, %esi + andl $15, %esi + movl %edx, %eax + andl $-16, %eax + cmpl $16, %edx + movl %ebx, 8(%esp) + movl %eax, %edx + fsub %st, %st(3) + fld %st(3) + lea -2(%esi), %ebx + jl ..L3 + movl %esi, %ebx +..L3: + sarl $2, %edx + movl %eax, %esi + sarl $3, %esi + addl %eax, %edx + sarl $4, %eax + addl %eax, %esi + addl %esi, %edx + fmul %st(4), %st + testl %ebx, %ebx + movl %ebx, (%esp) + lea (,%edx,8), %eax + movl 8(%esp), %ebx + lea (%eax,%edx,4), %edx + fldt 264+_tgamma_A_table@GOTOFF(%edi,%edx) + fldt _tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(6), %st + movl 4(%esp), %esi + fadd %st(2), %st + fldt 132+_tgamma_A_table@GOTOFF(%edi,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 144+_tgamma_A_table@GOTOFF(%edi,%edx) + fldt 12+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(7), %st + fadd %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 24+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(6), %st + fadd %st(2), %st + fldt 156+_tgamma_A_table@GOTOFF(%edi,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 168+_tgamma_A_table@GOTOFF(%edi,%edx) + fldt 36+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(7), %st + fadd %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 48+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(6), %st + fadd %st(2), %st + fldt 180+_tgamma_A_table@GOTOFF(%edi,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 192+_tgamma_A_table@GOTOFF(%edi,%edx) + fldt 60+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(7), %st + fadd %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 72+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(6), %st + fadd %st(2), %st + fldt 204+_tgamma_A_table@GOTOFF(%edi,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 216+_tgamma_A_table@GOTOFF(%edi,%edx) + fldt 84+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(7), %st + fadd %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 96+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(6), %st + fadd %st(2), %st + fldt 228+_tgamma_A_table@GOTOFF(%edi,%edx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 240+_tgamma_A_table@GOTOFF(%edi,%edx) + fldt 108+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(7), %st + fadd %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 120+_tgamma_A_table@GOTOFF(%edi,%edx) + fmul %st(6), %st + faddp %st, %st(2) + fldt 252+_tgamma_A_table@GOTOFF(%edi,%edx) + faddp %st, %st(2) + fmulp %st, %st(1) + fld %st(2) + je ..B1.39 +..B1.35: + jle ..B1.39 +..B1.36: + movl (%esp), %edx + movl $1, %eax +..B1.37: + movl %eax, (%esp) + incl %eax + fildl (%esp) + cmpl %edx, %eax + fsubr %st(3), %st + fmulp %st, %st(1) + jle ..B1.37 +..B1.39: + testl %esi, %esi + je ..B1.50 +..B1.40: + fxch %st(4) + fmulp %st, %st(2) + fmulp %st, %st(1) + fmulp %st, %st(2) + fdivp %st, %st(1) + fldl .L_2il0floatpacket.2@GOTOFF(%edi) + fcompl 8(%ebp) + fnstsw %ax + sahf + fxch %st(1) + jbe ..B1.48 +..B1.41: + cmpl $0, 12(%esp) + je ..B1.43 +..B1.42: + fxch %st(1) + fchs + fxch %st(1) +..B1.43: + testl %ecx, %ecx + je ..B1.46 +..B1.44: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpl 32(%esp) + fstpt 16(%esp) + call fesetround +..B1.131: + fldt 16(%esp) + fldl 32(%esp) + addl $16, %esp +..B1.45: + xorl %ecx, %ecx +..B1.46: + fldt _tgamma_A176_inv@GOTOFF(%edi) + fmulp %st, %st(2) + cmpl $0, 12(%esp) + je ..B1.48 +..B1.47: + fxch %st(1) + fchs + fxch %st(1) +..B1.48: + movl 12(%esp), %eax + fxch %st(1) + fstpl 40(%esp) + shll $31, %eax + xorl %eax, 44(%esp) + testl %ecx, %ecx + je ..B1.53 +..B1.49: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpl 32(%esp) + call fesetround +..B1.132: + fldl 32(%esp) + addl $16, %esp + jmp ..B1.53 +..B1.50: + fstp %st(3) + fstp %st(3) + fstp %st(0) + fmulp %st, %st(1) + testl %ecx, %ecx + je ..B1.52 +..B1.51: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpl 32(%esp) + call fesetround +..B1.133: + fldl 32(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.52: + fstpl 40(%esp) +..B1.53: + testl %ebx, %ebx + je ..B1.146 +..B1.54: + fstpl 24(%esp) +..B1.134: + fldcw 54(%esp) + jmp ..B1.55 +..B1.146: + fstp %st(0) +..B1.55: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.56: + fstp %st(3) + fcom %st(2) + fnstsw %ax + sahf + jbe ..B1.58 +..B1.57: + fld %st(2) + fadd %st(1), %st + jmp ..B1.59 +..B1.58: + fld %st(2) +..B1.59: + fldt .L_2il0floatpacket.3@GOTOFF(%edi) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.61 + jp ..B1.61 +..B1.60: + fsub %st(1), %st + fstpl 24(%esp) + lea _tgamma_A150_table@GOTOFF(%edi), %eax + jmp ..B1.66 +..B1.61: + fldt .L_2il0floatpacket.4@GOTOFF(%edi) + fcom %st(1) + fnstsw %ax + sahf + ja ..B1.63 + jp ..B1.63 +..B1.62: + fstp %st(0) + fldt _local_minimum_l@GOTOFF(%edi) + lea _tgamma_A125_table@GOTOFF(%edi), %eax + fsubrp %st, %st(1) + fstpl 24(%esp) + jmp ..B1.66 +..B1.63: + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.65 +..B1.64: + fsub %st(1), %st + fstpl 24(%esp) + lea _tgamma_A100_table@GOTOFF(%edi), %eax + jmp ..B1.66 +..B1.65: + fstp %st(0) +..B1.66: + fldt (%eax) + cmpl $0, 4(%esp) + je ..B1.69 +..B1.67: + fldl 24(%esp) + fldt 180(%eax) + fmul %st(1), %st + fldt 168(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 156(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 144(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 132(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 120(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24(%eax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12(%eax) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) +..B1.69: + fxch %st(1) + fcom %st(3) + fnstsw %ax + sahf + jbe ..B1.78 +..B1.70: + testl %esi, %esi + je ..B1.74 +..B1.71: + fstp %st(3) + fmulp %st, %st(1) + testl %ecx, %ecx + fdivrp %st, %st(1) + fchs + je ..B1.73 +..B1.72: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B1.135: + fldt 16(%esp) + addl $16, %esp +..B1.73: + movl 12(%esp), %eax + fchs + fstpl 40(%esp) + shll $31, %eax + xorl %eax, 44(%esp) + jmp ..B1.85 +..B1.74: + fstp %st(0) + fstp %st(1) + testl %ecx, %ecx + fxch %st(1) + je ..B1.77 +..B1.75: + fstp %st(0) + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B1.136: + fldt 16(%esp) + addl $16, %esp +..B1.76: + fldl 16(%esp) +..B1.77: + fdivrp %st, %st(1) + fstpl 40(%esp) + jmp ..B1.85 +..B1.78: + testl %esi, %esi + je ..B1.82 +..B1.79: + fxch %st(3) + fmulp %st, %st(2) + testl %ecx, %ecx + fmulp %st, %st(1) + fdivrp %st, %st(1) + je ..B1.81 +..B1.80: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B1.137: + fldt 16(%esp) + addl $16, %esp +..B1.81: + fstpl 40(%esp) + jmp ..B1.85 +..B1.82: + fstp %st(0) + fstp %st(1) + fstp %st(1) + testl %ecx, %ecx + je ..B1.84 +..B1.83: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + call fesetround +..B1.138: + fldt 16(%esp) + addl $16, %esp +..B1.84: + fstpl 40(%esp) +..B1.85: + testl %ebx, %ebx + je ..B1.87 +..B1.86: + fldcw 54(%esp) +..B1.87: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.88: + fstp %st(1) + testl %ecx, %ecx + je ..B1.90 +..B1.89: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpl 16(%esp) + call fesetround +..B1.139: + fldl 16(%esp) + addl $16, %esp +..B1.90: + fdiv %st(0), %st + testl %ebx, %ebx + fstpl 40(%esp) + je ..B1.92 +..B1.91: + fldcw 54(%esp) +..B1.92: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.93: + fstp %st(1) + testl %ecx, %ecx + je ..B1.95 +..B1.94: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpl 16(%esp) + call fesetround +..B1.140: + fldl 16(%esp) + addl $16, %esp +..B1.95: + fdiv %st(0), %st + testl %ebx, %ebx + fstpl 40(%esp) + je ..B1.97 +..B1.96: + fldcw 54(%esp) +..B1.97: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.98: + testl %ecx, %ecx + je ..B1.100 +..B1.99: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.141: + addl $16, %esp +..B1.100: + fldl _large_value_64@GOTOFF(%edi) + testl %ebx, %ebx + fmul %st(0), %st + fstpl 40(%esp) + je ..B1.102 +..B1.101: + fldcw 54(%esp) +..B1.102: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.103: + cmpl $0, (%esp) + jne ..B1.16 +..B1.104: + fstp %st(0) + fstp %st(0) + testl %ecx, %ecx + je ..B1.106 +..B1.105: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.142: + addl $16, %esp +..B1.106: + fldl _large_value_64@GOTOFF(%edi,%esi,8) + testl %ebx, %ebx + fmull _large_value_64@GOTOFF(%edi) + fstpl 40(%esp) + je ..B1.108 +..B1.107: + fldcw 54(%esp) +..B1.108: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.109: + fstp %st(1) + testl %ecx, %ecx + je ..B1.111 +..B1.110: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + fstpl 16(%esp) + call fesetround +..B1.143: + fldl 16(%esp) + addl $16, %esp +..B1.111: + fldl _ones@GOTOFF(%edi,%esi,8) + testl %ebx, %ebx + fdivp %st, %st(1) + fstpl 40(%esp) + je ..B1.113 +..B1.112: + fldcw 54(%esp) +..B1.113: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.114: + testl %ecx, %ecx + je ..B1.116 +..B1.115: + addl $-16, %esp + movl 64(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.144: + addl $16, %esp +..B1.116: + testl %esi, %esi + je ..B1.119 +..B1.117: + testl $1048575, 12(%ebp) + jne ..B1.119 +..B1.118: + cmpl $0, 8(%ebp) + je ..B1.122 +..B1.119: + fldl 8(%ebp) + testl %ebx, %ebx + fmull _ones@GOTOFF(%edi) + fstpl 40(%esp) + je ..B1.121 +..B1.120: + fldcw 54(%esp) +..B1.121: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.122: + fldl 8+_zeros@GOTOFF(%edi) + testl %ebx, %ebx + fdivl _zeros@GOTOFF(%edi) + fstpl 40(%esp) + je ..B1.124 +..B1.123: + fldcw 54(%esp) +..B1.124: + fldl 40(%esp) + addl $68, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.125: + xorl %ebx, %ebx + jmp ..B1.7 + .align 16,0x90 + .type tgamma,@function + .size tgamma,.-tgamma + .data +# -- End tgamma + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xc0672000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0xc0660000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_overflow_boundary: + .long 3848402504 + .long 1080390650 + .type _overflow_boundary,@object + .size _overflow_boundary,8 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 2 +_tgamma_sin_table: + .word 39192 + .word 38974 + .word 13074 + .word 53901 + .word 49151 + .word 0 + .word 25233 + .word 24099 + .word 23041 + .word 53198 + .word 16382 + .word 0 + .word 14010 + .word 1755 + .word 29241 + .word 50004 + .word 49148 + .word 0 + .word 12661 + .word 39557 + .word 743 + .word 54836 + .word 16377 + .word 0 + .word 23329 + .word 12349 + .word 46418 + .word 39360 + .word 49142 + .word 0 + .word 43549 + .word 22984 + .word 36093 + .word 39843 + .word 16370 + .word 0 + .word 50635 + .word 59140 + .word 19560 + .word 59922 + .word 49133 + .word 0 + .word 39826 + .word 40176 + .word 51583 + .word 34788 + .word 16361 + .word 0 + .word 63061 + .word 25910 + .word 60600 + .word 64252 + .word 49123 + .word 0 + .word 21154 + .word 4399 + .word 17218 + .word 48316 + .word 16350 + .word 0 + .type _tgamma_sin_table,@object + .size _tgamma_sin_table,120 + .align 2 +_tgamma_A_table: + .word 44002 + .word 44608 + .word 34249 + .word 61198 + .word 16384 + .word 0 + .word 28120 + .word 46089 + .word 18909 + .word 51744 + .word 16384 + .word 0 + .word 6796 + .word 56365 + .word 948 + .word 39330 + .word 16384 + .word 0 + .word 21872 + .word 3113 + .word 40348 + .word 48989 + .word 16383 + .word 0 + .word 15275 + .word 60291 + .word 893 + .word 59613 + .word 16381 + .word 0 + .word 41018 + .word 41834 + .word 14754 + .word 46766 + .word 49150 + .word 0 + .word 10107 + .word 10320 + .word 24796 + .word 32841 + .word 49152 + .word 0 + .word 40832 + .word 16832 + .word 38712 + .word 55795 + .word 49152 + .word 0 + .word 8761 + .word 28554 + .word 35431 + .word 39961 + .word 49153 + .word 0 + .word 12838 + .word 702 + .word 32174 + .word 51595 + .word 49153 + .word 0 + .word 442 + .word 50835 + .word 62234 + .word 59850 + .word 49153 + .word 0 + .word 53618 + .word 2208 + .word 54662 + .word 64445 + .word 16384 + .word 0 + .word 33537 + .word 7687 + .word 12653 + .word 64976 + .word 16384 + .word 0 + .word 5604 + .word 18060 + .word 46944 + .word 34352 + .word 16385 + .word 0 + .word 5422 + .word 18393 + .word 57870 + .word 37869 + .word 16385 + .word 0 + .word 27417 + .word 51069 + .word 14904 + .word 43119 + .word 16385 + .word 0 + .word 16515 + .word 36952 + .word 46206 + .word 50255 + .word 16385 + .word 0 + .word 22913 + .word 57796 + .word 61047 + .word 59491 + .word 16385 + .word 0 + .word 55054 + .word 14521 + .word 23522 + .word 35521 + .word 16386 + .word 0 + .word 3828 + .word 37429 + .word 19301 + .word 42457 + .word 16386 + .word 0 + .word 18611 + .word 8353 + .word 56126 + .word 50041 + .word 16386 + .word 0 + .word 63177 + .word 14708 + .word 18871 + .word 56010 + .word 16386 + .word 0 + .word 51349 + .word 6910 + .word 18794 + .word 33038 + .word 16353 + .word 0 + .word 59411 + .word 13918 + .word 30079 + .word 63615 + .word 16384 + .word 0 + .word 40356 + .word 37493 + .word 20410 + .word 60584 + .word 16384 + .word 0 + .word 59667 + .word 1960 + .word 42334 + .word 54496 + .word 16384 + .word 0 + .word 24443 + .word 19594 + .word 17897 + .word 45291 + .word 16384 + .word 0 + .word 24957 + .word 63432 + .word 54964 + .word 32848 + .word 16384 + .word 0 + .word 7770 + .word 43625 + .word 45329 + .word 33905 + .word 16383 + .word 0 + .word 34249 + .word 63845 + .word 17962 + .word 44463 + .word 49148 + .word 0 + .word 49963 + .word 34728 + .word 51109 + .word 54055 + .word 49151 + .word 0 + .word 57585 + .word 19701 + .word 6443 + .word 57077 + .word 49152 + .word 0 + .word 61186 + .word 8282 + .word 25787 + .word 47837 + .word 49153 + .word 0 + .word 26720 + .word 42621 + .word 41546 + .word 37680 + .word 49154 + .word 0 + .word 18366 + .word 28044 + .word 60147 + .word 62846 + .word 16384 + .word 0 + .word 6968 + .word 10789 + .word 37601 + .word 32880 + .word 16385 + .word 0 + .word 60700 + .word 57063 + .word 36736 + .word 35909 + .word 16385 + .word 0 + .word 61862 + .word 56439 + .word 50993 + .word 40752 + .word 16385 + .word 0 + .word 41843 + .word 39363 + .word 59360 + .word 47812 + .word 16385 + .word 0 + .word 63511 + .word 43763 + .word 855 + .word 57724 + .word 16385 + .word 0 + .word 64510 + .word 20731 + .word 32839 + .word 35752 + .word 16386 + .word 0 + .word 60398 + .word 46667 + .word 43836 + .word 45454 + .word 16386 + .word 0 + .word 49807 + .word 23281 + .word 46849 + .word 59658 + .word 16386 + .word 0 + .word 37270 + .word 40485 + .word 38862 + .word 41131 + .word 16387 + .word 0 + .word 55072 + .word 194 + .word 57504 + .word 62944 + .word 16387 + .word 0 + .word 6484 + .word 60537 + .word 3975 + .word 55679 + .word 16389 + .word 0 + .word 11759 + .word 24340 + .word 39489 + .word 49925 + .word 16384 + .word 0 + .word 22650 + .word 18020 + .word 56002 + .word 47553 + .word 16384 + .word 0 + .word 65458 + .word 2450 + .word 7569 + .word 42768 + .word 16384 + .word 0 + .word 2740 + .word 58538 + .word 8888 + .word 35477 + .word 16384 + .word 0 + .word 24012 + .word 19369 + .word 10014 + .word 51050 + .word 16383 + .word 0 + .word 32754 + .word 14555 + .word 56874 + .word 50646 + .word 16382 + .word 0 + .word 6322 + .word 39288 + .word 8326 + .word 56228 + .word 49148 + .word 0 + .word 51606 + .word 9409 + .word 56084 + .word 47341 + .word 49151 + .word 0 + .word 19293 + .word 17746 + .word 29435 + .word 49011 + .word 49152 + .word 0 + .word 22538 + .word 37169 + .word 56949 + .word 41021 + .word 49153 + .word 0 + .word 65507 + .word 8897 + .word 64576 + .word 64934 + .word 49153 + .word 0 + .word 21309 + .word 38834 + .word 44023 + .word 38745 + .word 16384 + .word 0 + .word 52933 + .word 53016 + .word 24774 + .word 40865 + .word 16384 + .word 0 + .word 4045 + .word 21262 + .word 61923 + .word 45295 + .word 16384 + .word 0 + .word 26065 + .word 18177 + .word 3420 + .word 52438 + .word 16384 + .word 0 + .word 45505 + .word 1968 + .word 16227 + .word 62949 + .word 16384 + .word 0 + .word 1037 + .word 13974 + .word 10559 + .word 38924 + .word 16385 + .word 0 + .word 39502 + .word 38026 + .word 65467 + .word 49371 + .word 16385 + .word 0 + .word 34978 + .word 59813 + .word 17957 + .word 64181 + .word 16385 + .word 0 + .word 4031 + .word 54789 + .word 33142 + .word 42976 + .word 16386 + .word 0 + .word 2719 + .word 21031 + .word 60489 + .word 60330 + .word 16386 + .word 0 + .word 20734 + .word 53765 + .word 40154 + .word 46919 + .word 16387 + .word 0 + .word 63028 + .word 7231 + .word 17811 + .word 43725 + .word 16468 + .word 0 + .word 32606 + .word 48355 + .word 22399 + .word 43710 + .word 16384 + .word 0 + .word 29042 + .word 46559 + .word 51950 + .word 41588 + .word 16384 + .word 0 + .word 47396 + .word 18113 + .word 2918 + .word 37305 + .word 16384 + .word 0 + .word 22233 + .word 40098 + .word 6225 + .word 61543 + .word 16383 + .word 0 + .word 611 + .word 49379 + .word 57729 + .word 43678 + .word 16383 + .word 0 + .word 10450 + .word 9675 + .word 56147 + .word 41083 + .word 16382 + .word 0 + .word 37401 + .word 8271 + .word 47219 + .word 34504 + .word 49149 + .word 0 + .word 34774 + .word 15943 + .word 11357 + .word 45081 + .word 49151 + .word 0 + .word 6639 + .word 15692 + .word 42534 + .word 45536 + .word 49152 + .word 0 + .word 51630 + .word 6378 + .word 12961 + .word 37818 + .word 49153 + .word 0 + .word 59527 + .word 55742 + .word 41884 + .word 59714 + .word 49153 + .word 0 + .word 15629 + .word 31501 + .word 45205 + .word 59448 + .word 16383 + .word 0 + .word 53044 + .word 1871 + .word 3840 + .word 62990 + .word 16383 + .word 0 + .word 49829 + .word 44544 + .word 39222 + .word 35206 + .word 16384 + .word 0 + .word 8319 + .word 42513 + .word 20106 + .word 41214 + .word 16384 + .word 0 + .word 56062 + .word 65309 + .word 8860 + .word 50097 + .word 16384 + .word 0 + .word 39637 + .word 65 + .word 3840 + .word 62744 + .word 16384 + .word 0 + .word 8819 + .word 49083 + .word 32007 + .word 40272 + .word 16385 + .word 0 + .word 33763 + .word 5027 + .word 16250 + .word 52917 + .word 16385 + .word 0 + .word 4751 + .word 2633 + .word 61342 + .word 35759 + .word 16386 + .word 0 + .word 8844 + .word 54174 + .word 63762 + .word 50574 + .word 16386 + .word 0 + .word 8334 + .word 8890 + .word 4484 + .word 39560 + .word 16387 + .word 0 + .word 4811 + .word 30700 + .word 3620 + .word 48492 + .word 16556 + .word 0 + .word 24963 + .word 23772 + .word 56823 + .word 39936 + .word 16384 + .word 0 + .word 33598 + .word 3946 + .word 44700 + .word 37958 + .word 16384 + .word 0 + .word 46964 + .word 13072 + .word 50440 + .word 33963 + .word 16384 + .word 0 + .word 60803 + .word 30641 + .word 14857 + .word 55738 + .word 16383 + .word 0 + .word 54016 + .word 37905 + .word 6345 + .word 39067 + .word 16383 + .word 0 + .word 52847 + .word 8984 + .word 26176 + .word 34926 + .word 16382 + .word 0 + .word 36664 + .word 26865 + .word 35876 + .word 39170 + .word 49149 + .word 0 + .word 52449 + .word 52544 + .word 53629 + .word 43890 + .word 49151 + .word 0 + .word 12025 + .word 58412 + .word 44187 + .word 43481 + .word 49152 + .word 0 + .word 31442 + .word 43543 + .word 55683 + .word 35857 + .word 49153 + .word 0 + .word 3846 + .word 7199 + .word 40600 + .word 56439 + .word 49153 + .word 0 + .word 59606 + .word 22885 + .word 19144 + .word 49661 + .word 16383 + .word 0 + .word 40642 + .word 40248 + .word 11664 + .word 52797 + .word 16383 + .word 0 + .word 62936 + .word 44294 + .word 39296 + .word 59383 + .word 16383 + .word 0 + .word 2909 + .word 51304 + .word 40819 + .word 35037 + .word 16384 + .word 0 + .word 28573 + .word 45780 + .word 52012 + .word 42966 + .word 16384 + .word 0 + .word 18650 + .word 49015 + .word 44104 + .word 54288 + .word 16384 + .word 0 + .word 55601 + .word 45035 + .word 39824 + .word 35129 + .word 16385 + .word 0 + .word 34144 + .word 30699 + .word 57231 + .word 46486 + .word 16385 + .word 0 + .word 46246 + .word 1151 + .word 17498 + .word 63193 + .word 16385 + .word 0 + .word 4951 + .word 25890 + .word 61661 + .word 44882 + .word 16386 + .word 0 + .word 6537 + .word 64648 + .word 46171 + .word 35209 + .word 16387 + .word 0 + .word 3418 + .word 59105 + .word 44678 + .word 47100 + .word 16651 + .word 0 + .word 12496 + .word 39220 + .word 65358 + .word 37319 + .word 16384 + .word 0 + .word 42985 + .word 15941 + .word 31416 + .word 35438 + .word 16384 + .word 0 + .word 48809 + .word 58407 + .word 25474 + .word 63277 + .word 16383 + .word 0 + .word 16086 + .word 46002 + .word 58617 + .word 51682 + .word 16383 + .word 0 + .word 55157 + .word 44549 + .word 61270 + .word 35823 + .word 16383 + .word 0 + .word 21856 + .word 27160 + .word 26283 + .word 61078 + .word 16381 + .word 0 + .word 57421 + .word 61358 + .word 44892 + .word 42671 + .word 49149 + .word 0 + .word 51328 + .word 61945 + .word 60158 + .word 43127 + .word 49151 + .word 0 + .word 51733 + .word 1166 + .word 54323 + .word 42075 + .word 49152 + .word 0 + .word 52270 + .word 46964 + .word 5686 + .word 34493 + .word 49153 + .word 0 + .word 2083 + .word 1761 + .word 7136 + .word 54130 + .word 49153 + .word 0 + .word 16904 + .word 37253 + .word 64186 + .word 43390 + .word 16383 + .word 0 + .word 30519 + .word 46073 + .word 2795 + .word 46255 + .word 16383 + .word 0 + .word 6923 + .word 13957 + .word 9241 + .word 52280 + .word 16383 + .word 0 + .word 60036 + .word 4102 + .word 42534 + .word 62082 + .word 16383 + .word 0 + .word 23471 + .word 7124 + .word 59867 + .word 38328 + .word 16384 + .word 0 + .word 43652 + .word 58293 + .word 38720 + .word 48757 + .word 16384 + .word 0 + .word 30217 + .word 2002 + .word 31515 + .word 63491 + .word 16384 + .word 0 + .word 32079 + .word 61591 + .word 63175 + .word 42230 + .word 16385 + .word 0 + .word 708 + .word 13247 + .word 38402 + .word 57649 + .word 16385 + .word 0 + .word 48098 + .word 14626 + .word 62525 + .word 41069 + .word 16386 + .word 0 + .word 41824 + .word 29269 + .word 27314 + .word 64550 + .word 16386 + .word 0 + .word 61231 + .word 60847 + .word 45074 + .word 55796 + .word 16751 + .word 0 + .word 41222 + .word 6965 + .word 41751 + .word 35359 + .word 16384 + .word 0 + .word 3873 + .word 17289 + .word 23432 + .word 33549 + .word 16384 + .word 0 + .word 31267 + .word 5735 + .word 3862 + .word 59787 + .word 16383 + .word 0 + .word 54508 + .word 24423 + .word 13439 + .word 48632 + .word 16383 + .word 0 + .word 1373 + .word 13548 + .word 5598 + .word 33375 + .word 16383 + .word 0 + .word 51134 + .word 47274 + .word 24966 + .word 54404 + .word 16381 + .word 0 + .word 6577 + .word 45385 + .word 2362 + .word 45409 + .word 49149 + .word 0 + .word 3828 + .word 42112 + .word 22766 + .word 42583 + .word 49151 + .word 0 + .word 12956 + .word 14074 + .word 46709 + .word 41030 + .word 49152 + .word 0 + .word 36968 + .word 52126 + .word 60443 + .word 33467 + .word 49153 + .word 0 + .word 6923 + .word 15273 + .word 58034 + .word 52381 + .word 49153 + .word 0 + .word 32660 + .word 35575 + .word 5652 + .word 38971 + .word 16383 + .word 0 + .word 58845 + .word 37118 + .word 55534 + .word 41636 + .word 16383 + .word 0 + .word 18460 + .word 14335 + .word 18170 + .word 47252 + .word 16383 + .word 0 + .word 64257 + .word 33925 + .word 29284 + .word 56405 + .word 16383 + .word 0 + .word 4762 + .word 47478 + .word 23933 + .word 35021 + .word 16384 + .word 0 + .word 60070 + .word 43233 + .word 33997 + .word 44796 + .word 16384 + .word 0 + .word 15498 + .word 56159 + .word 37136 + .word 58624 + .word 16384 + .word 0 + .word 45618 + .word 14567 + .word 62599 + .word 39157 + .word 16385 + .word 0 + .word 56427 + .word 8703 + .word 58958 + .word 53630 + .word 16385 + .word 0 + .word 17868 + .word 58209 + .word 63399 + .word 38294 + .word 16386 + .word 0 + .word 23727 + .word 3602 + .word 56293 + .word 60260 + .word 16386 + .word 0 + .word 11566 + .word 31203 + .word 21261 + .word 41104 + .word 16856 + .word 0 + .word 50659 + .word 54826 + .word 2447 + .word 33815 + .word 16384 + .word 0 + .word 40123 + .word 27511 + .word 38472 + .word 64120 + .word 16383 + .word 0 + .word 60369 + .word 44894 + .word 35604 + .word 57033 + .word 16383 + .word 0 + .word 46499 + .word 27632 + .word 5436 + .word 46222 + .word 16383 + .word 0 + .word 30082 + .word 48277 + .word 45112 + .word 62871 + .word 16382 + .word 0 + .word 22164 + .word 19009 + .word 61576 + .word 49094 + .word 16381 + .word 0 + .word 46565 + .word 37565 + .word 23059 + .word 47623 + .word 49149 + .word 0 + .word 32180 + .word 46156 + .word 40449 + .word 42167 + .word 49151 + .word 0 + .word 43791 + .word 4543 + .word 64119 + .word 40210 + .word 49152 + .word 0 + .word 35508 + .word 36368 + .word 50300 + .word 65316 + .word 49152 + .word 0 + .word 24682 + .word 25954 + .word 24264 + .word 50994 + .word 49153 + .word 0 + .word 2360 + .word 57697 + .word 56537 + .word 35655 + .word 16383 + .word 0 + .word 35000 + .word 46863 + .word 45329 + .word 38168 + .word 16383 + .word 0 + .word 34434 + .word 1782 + .word 6514 + .word 43468 + .word 16383 + .word 0 + .word 42662 + .word 49367 + .word 10572 + .word 52120 + .word 16383 + .word 0 + .word 20865 + .word 43286 + .word 18750 + .word 65033 + .word 16383 + .word 0 + .word 9813 + .word 41323 + .word 59938 + .word 41786 + .word 16384 + .word 0 + .word 37980 + .word 55255 + .word 47419 + .word 54914 + .word 16384 + .word 0 + .word 3267 + .word 59107 + .word 21702 + .word 36808 + .word 16385 + .word 0 + .word 56442 + .word 35583 + .word 19842 + .word 50549 + .word 16385 + .word 0 + .word 14786 + .word 14705 + .word 8555 + .word 36161 + .word 16386 + .word 0 + .word 5861 + .word 33921 + .word 55110 + .word 56952 + .word 16386 + .word 0 + .word 12507 + .word 56326 + .word 38818 + .word 47266 + .word 16964 + .word 0 + .word 3472 + .word 16935 + .word 53300 + .word 65107 + .word 16383 + .word 0 + .word 37860 + .word 60441 + .word 22458 + .word 61688 + .word 16383 + .word 0 + .word 12243 + .word 56252 + .word 28016 + .word 54783 + .word 16383 + .word 0 + .word 4212 + .word 39051 + .word 42484 + .word 44250 + .word 16383 + .word 0 + .word 23380 + .word 35543 + .word 1695 + .word 59694 + .word 16382 + .word 0 + .word 16948 + .word 23513 + .word 25700 + .word 44731 + .word 16381 + .word 0 + .word 46140 + .word 40761 + .word 17956 + .word 49463 + .word 49149 + .word 0 + .word 31263 + .word 46633 + .word 29941 + .word 41835 + .word 49151 + .word 0 + .word 63205 + .word 61824 + .word 34317 + .word 39543 + .word 49152 + .word 0 + .word 2572 + .word 33857 + .word 17789 + .word 63992 + .word 49152 + .word 0 + .word 34199 + .word 18923 + .word 17606 + .word 49855 + .word 49153 + .word 0 + .word 56334 + .word 35260 + .word 24180 + .word 33058 + .word 16383 + .word 0 + .word 60689 + .word 52750 + .word 35337 + .word 35448 + .word 16383 + .word 0 + .word 55452 + .word 53681 + .word 28550 + .word 40494 + .word 16383 + .word 0 + .word 52405 + .word 7414 + .word 26290 + .word 48744 + .word 16383 + .word 0 + .word 27310 + .word 49480 + .word 17006 + .word 61076 + .word 16383 + .word 0 + .word 58002 + .word 7573 + .word 241 + .word 39403 + .word 16384 + .word 0 + .word 30618 + .word 4587 + .word 23737 + .word 51968 + .word 16384 + .word 0 + .word 41850 + .word 57331 + .word 43567 + .word 34937 + .word 16385 + .word 0 + .word 44076 + .word 54284 + .word 21386 + .word 48090 + .word 16385 + .word 0 + .word 47582 + .word 54033 + .word 55369 + .word 34454 + .word 16386 + .word 0 + .word 6559 + .word 5249 + .word 7172 + .word 54302 + .word 16386 + .word 0 + .word 25070 + .word 13550 + .word 42045 + .word 60321 + .word 17075 + .word 0 + .word 25751 + .word 29482 + .word 15881 + .word 62993 + .word 16383 + .word 0 + .word 20424 + .word 12720 + .word 54361 + .word 59648 + .word 16383 + .word 0 + .word 47709 + .word 29790 + .word 54671 + .word 52895 + .word 16383 + .word 0 + .word 19590 + .word 27782 + .word 43363 + .word 42595 + .word 16383 + .word 0 + .word 58921 + .word 35180 + .word 21269 + .word 57023 + .word 16382 + .word 0 + .word 30519 + .word 24253 + .word 59969 + .word 41055 + .word 16381 + .word 0 + .word 16433 + .word 48540 + .word 61714 + .word 51024 + .word 49149 + .word 0 + .word 28524 + .word 50460 + .word 14901 + .word 41561 + .word 49151 + .word 0 + .word 3212 + .word 32692 + .word 57818 + .word 38984 + .word 49152 + .word 0 + .word 39499 + .word 42357 + .word 61063 + .word 62879 + .word 49152 + .word 0 + .word 23069 + .word 2532 + .word 8249 + .word 48896 + .word 49153 + .word 0 + .word 10213 + .word 8193 + .word 57687 + .word 61912 + .word 16382 + .word 0 + .word 54407 + .word 51976 + .word 21399 + .word 33245 + .word 16383 + .word 0 + .word 30319 + .word 6795 + .word 56359 + .word 38081 + .word 16383 + .word 0 + .word 56783 + .word 23918 + .word 44955 + .word 45999 + .word 16383 + .word 0 + .word 48670 + .word 51841 + .word 19543 + .word 57851 + .word 16383 + .word 0 + .word 40765 + .word 30890 + .word 33317 + .word 37455 + .word 16384 + .word 0 + .word 26976 + .word 54195 + .word 64249 + .word 49555 + .word 16384 + .word 0 + .word 53450 + .word 46734 + .word 58278 + .word 33402 + .word 16385 + .word 0 + .word 16139 + .word 61138 + .word 10791 + .word 46069 + .word 16385 + .word 0 + .word 19833 + .word 46025 + .word 1951 + .word 33050 + .word 16386 + .word 0 + .word 63698 + .word 28854 + .word 16724 + .word 52116 + .word 16386 + .word 0 + .word 51628 + .word 52030 + .word 9741 + .word 32928 + .word 17190 + .word 0 + .word 12285 + .word 10951 + .word 58642 + .word 61183 + .word 16383 + .word 0 + .word 21683 + .word 21165 + .word 28859 + .word 57903 + .word 16383 + .word 0 + .word 16106 + .word 65177 + .word 61473 + .word 51279 + .word 16383 + .word 0 + .word 10066 + .word 60251 + .word 8712 + .word 41178 + .word 16383 + .word 0 + .word 11765 + .word 63661 + .word 54012 + .word 54733 + .word 16382 + .word 0 + .word 6745 + .word 52609 + .word 60525 + .word 37899 + .word 16381 + .word 0 + .word 48001 + .word 64846 + .word 20212 + .word 52373 + .word 49149 + .word 0 + .word 17748 + .word 43200 + .word 11817 + .word 41329 + .word 49151 + .word 0 + .word 21018 + .word 45635 + .word 21983 + .word 38507 + .word 49152 + .word 0 + .word 3148 + .word 52957 + .word 41657 + .word 61926 + .word 49152 + .word 0 + .word 4827 + .word 784 + .word 31692 + .word 48072 + .word 49153 + .word 0 + .word 34179 + .word 53889 + .word 29926 + .word 58425 + .word 16382 + .word 0 + .word 50615 + .word 27492 + .word 10833 + .word 62832 + .word 16382 + .word 0 + .word 38001 + .word 13025 + .word 51995 + .word 36075 + .word 16383 + .word 0 + .word 57519 + .word 47991 + .word 3845 + .word 43713 + .word 16383 + .word 0 + .word 52312 + .word 45573 + .word 61386 + .word 55158 + .word 16383 + .word 0 + .word 13085 + .word 59531 + .word 16529 + .word 35826 + .word 16384 + .word 0 + .word 20993 + .word 34790 + .word 57361 + .word 47533 + .word 16384 + .word 0 + .word 9726 + .word 28278 + .word 20623 + .word 64228 + .word 16384 + .word 0 + .word 29543 + .word 44397 + .word 26216 + .word 44369 + .word 16385 + .word 0 + .word 63031 + .word 4436 + .word 65303 + .word 63733 + .word 16385 + .word 0 + .word 3202 + .word 26777 + .word 12818 + .word 50273 + .word 16386 + .word 0 + .word 59134 + .word 17584 + .word 37875 + .word 50102 + .word 17306 + .word 0 + .word 7773 + .word 6529 + .word 24897 + .word 59610 + .word 16383 + .word 0 + .word 9176 + .word 34994 + .word 24066 + .word 56385 + .word 16383 + .word 0 + .word 38670 + .word 17644 + .word 9278 + .word 49874 + .word 16383 + .word 0 + .word 31722 + .word 46384 + .word 26212 + .word 39944 + .word 16383 + .word 0 + .word 4438 + .word 35654 + .word 55200 + .word 52739 + .word 16382 + .word 0 + .word 27356 + .word 43702 + .word 58298 + .word 35147 + .word 16381 + .word 0 + .word 11597 + .word 6768 + .word 60887 + .word 53553 + .word 49149 + .word 0 + .word 2200 + .word 56289 + .word 1997 + .word 41129 + .word 49151 + .word 0 + .word 51208 + .word 51045 + .word 15577 + .word 38092 + .word 49152 + .word 0 + .word 64525 + .word 30741 + .word 24355 + .word 61096 + .word 49152 + .word 0 + .word 16273 + .word 9188 + .word 1200 + .word 47354 + .word 49153 + .word 0 + .word 32505 + .word 64701 + .word 51161 + .word 55474 + .word 16382 + .word 0 + .word 58255 + .word 43751 + .word 28307 + .word 59734 + .word 16382 + .word 0 + .word 597 + .word 44015 + .word 59274 + .word 34374 + .word 16383 + .word 0 + .word 17221 + .word 11824 + .word 60854 + .word 41770 + .word 16383 + .word 0 + .word 32240 + .word 33006 + .word 58370 + .word 52867 + .word 16383 + .word 0 + .word 22765 + .word 17058 + .word 17899 + .word 34437 + .word 16384 + .word 0 + .word 3694 + .word 59578 + .word 1196 + .word 45807 + .word 16384 + .word 0 + .word 37424 + .word 8934 + .word 53804 + .word 62023 + .word 16384 + .word 0 + .word 6800 + .word 58264 + .word 43923 + .word 42913 + .word 16385 + .word 0 + .word 27007 + .word 15916 + .word 20851 + .word 61705 + .word 16385 + .word 0 + .word 33570 + .word 44306 + .word 22975 + .word 48691 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _tgamma_A_table,@object + .size _tgamma_A_table,3312 + .align 2 +_tgamma_A176_inv: + .word 38655 + .word 8470 + .word 22633 + .word 47709 + .word 15340 + .word 0 + .type _tgamma_A176_inv,@object + .size _tgamma_A176_inv,12 + .align 2 +_tgamma_A150_table: + .word 61060 + .word 8155 + .word 61816 + .word 65535 + .word 16382 + .word 0 + .word 47752 + .word 30749 + .word 4057 + .word 37827 + .word 49150 + .word 0 + .word 24760 + .word 16820 + .word 52631 + .word 64803 + .word 16382 + .word 0 + .word 36324 + .word 24890 + .word 11532 + .word 59368 + .word 49150 + .word 0 + .word 63381 + .word 49585 + .word 20519 + .word 63827 + .word 16382 + .word 0 + .word 54086 + .word 22318 + .word 4776 + .word 62483 + .word 49150 + .word 0 + .word 24236 + .word 16506 + .word 21666 + .word 59746 + .word 16382 + .word 0 + .word 44402 + .word 44414 + .word 37650 + .word 53079 + .word 49150 + .word 0 + .word 34766 + .word 8695 + .word 24359 + .word 42592 + .word 16382 + .word 0 + .word 30542 + .word 64415 + .word 14059 + .word 59378 + .word 49149 + .word 0 + .word 36037 + .word 62568 + .word 21045 + .word 34628 + .word 16381 + .word 0 + .word 39650 + .word 28877 + .word 62299 + .word 64900 + .word 49147 + .word 0 + .word 43413 + .word 4175 + .word 59877 + .word 46549 + .word 16378 + .word 0 + .word 13603 + .word 64648 + .word 43425 + .word 47701 + .word 49144 + .word 0 + .word 48047 + .word 22044 + .word 23868 + .word 61943 + .word 16373 + .word 0 + .word 17548 + .word 29243 + .word 63955 + .word 38195 + .word 49138 + .word 0 + .type _tgamma_A150_table,@object + .size _tgamma_A150_table,192 + .align 2 +_local_minimum_l: + .word 64512 + .word 46577 + .word 49946 + .word 47894 + .word 16383 + .word 0 + .type _local_minimum_l,@object + .size _local_minimum_l,12 + .align 2 +_tgamma_A125_table: + .word 29804 + .word 14935 + .word 58389 + .word 58038 + .word 16382 + .word 0 + .word 54039 + .word 49353 + .word 64455 + .word 62712 + .word 16326 + .word 0 + .word 7246 + .word 48092 + .word 40889 + .word 56162 + .word 16381 + .word 0 + .word 5238 + .word 25576 + .word 20384 + .word 34263 + .word 49148 + .word 0 + .word 38009 + .word 2645 + .word 35759 + .word 42176 + .word 16380 + .word 0 + .word 32410 + .word 34387 + .word 48471 + .word 48379 + .word 49147 + .word 0 + .word 9060 + .word 33571 + .word 56968 + .word 36683 + .word 16379 + .word 0 + .word 26873 + .word 9749 + .word 59107 + .word 49208 + .word 49146 + .word 0 + .word 61297 + .word 63742 + .word 25286 + .word 34210 + .word 16378 + .word 0 + .word 6011 + .word 50033 + .word 7349 + .word 46841 + .word 49145 + .word 0 + .word 30597 + .word 45929 + .word 271 + .word 64276 + .word 16376 + .word 0 + .word 60120 + .word 8046 + .word 54753 + .word 44175 + .word 49144 + .word 0 + .word 32461 + .word 45691 + .word 56111 + .word 58214 + .word 16375 + .word 0 + .word 38908 + .word 23877 + .word 33636 + .word 50495 + .word 49143 + .word 0 + .word 35983 + .word 59115 + .word 59685 + .word 60013 + .word 16371 + .word 0 + .word 38519 + .word 97 + .word 2340 + .word 53304 + .word 49143 + .word 0 + .type _tgamma_A125_table,@object + .size _tgamma_A125_table,192 + .align 2 +_tgamma_A100_table: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 50486 + .word 32176 + .word 26595 + .word 37828 + .word 49150 + .word 0 + .word 33232 + .word 55464 + .word 50705 + .word 64818 + .word 16382 + .word 0 + .word 56000 + .word 37024 + .word 35961 + .word 59472 + .word 49150 + .word 0 + .word 6308 + .word 2395 + .word 34858 + .word 64338 + .word 16382 + .word 0 + .word 22779 + .word 60710 + .word 1868 + .word 64356 + .word 49150 + .word 0 + .word 33054 + .word 60854 + .word 741 + .word 65087 + .word 16382 + .word 0 + .word 46387 + .word 11445 + .word 51950 + .word 65273 + .word 49150 + .word 0 + .word 6735 + .word 17127 + .word 21437 + .word 65409 + .word 16382 + .word 0 + .word 40596 + .word 22792 + .word 61241 + .word 65445 + .word 49150 + .word 0 + .word 7521 + .word 26365 + .word 15230 + .word 65303 + .word 16382 + .word 0 + .word 33891 + .word 37638 + .word 54039 + .word 64371 + .word 49150 + .word 0 + .word 37411 + .word 53884 + .word 56799 + .word 60663 + .word 16382 + .word 0 + .word 30408 + .word 30767 + .word 55068 + .word 50398 + .word 49150 + .word 0 + .word 49794 + .word 38369 + .word 16703 + .word 62901 + .word 16381 + .word 0 + .word 52540 + .word 1662 + .word 21259 + .word 41989 + .word 49148 + .word 0 + .type _tgamma_A100_table,@object + .size _tgamma_A100_table,192 + .data + .hidden fesetround + .hidden fegetround + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tgammaf.S b/external/sgx_libm/ia32/tgammaf.S new file mode 100644 index 0000000000..e057b83ee4 --- /dev/null +++ b/external/sgx_libm/ia32/tgammaf.S @@ -0,0 +1,1018 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tgammaf.c" + .text +..TXTST0: +# -- Begin tgammaf + .text + .align 16,0x90 + .globl tgammaf +tgammaf: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $36, %esp + movl 8(%ebp), %edi + call fegetround +..B1.96: + movl %eax, 32(%esp) +..B1.2: + cmpl $0, 32(%esp) + jne ..B1.4 +..B1.3: + xorl %ecx, %ecx + jmp ..B1.6 +..B1.4: + addl $4, %esp + pushl $0 + call fesetround +..B1.5: + movl $1, %ecx +..B1.6: + movzwl 10(%ebp), %edx + andl $32640, %edx + shrl $7, %edx + movl 8(%ebp), %esi + shrl $31, %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $255, %edx + je ..B1.88 +..B1.7: + flds 8(%ebp) + fldz + andl $2147483647, %edi + fucom %st(1) + fnstsw %ax + movl %edi, 20(%esp) + sahf + jp ..B1.8 + je ..B1.85 +..B1.8: + cmpl $2097152, %edi + jle ..B1.82 +..B1.9: + testl %esi, %esi + je ..B1.18 +..B1.10: + cmpl $150, %edx + jge ..B1.76 +..B1.11: + flds .L_2il0floatpacket.2@GOTOFF(%ebx) + flds 20(%esp) + fld %st(0) + fadd %st(2), %st + fstps 24(%esp) + flds 24(%esp) + movl 24(%esp), %edi + fsubp %st, %st(2) + movl %edi, 16(%esp) + fcom %st(1) + fnstsw %ax + sahf + jae ..B1.13 + jp ..B1.13 +..B1.12: + fld1 + incl 16(%esp) + fsubrp %st, %st(2) +..B1.13: + fucompp + fnstsw %ax + sahf + jp ..B1.14 + je ..B1.73 +..B1.14: + flds .L_2il0floatpacket.3@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B1.18 +..B1.15: + fstp %st(0) + fstp %st(0) + testl %ecx, %ecx + je ..B1.17 +..B1.16: + addl $4, %esp + pushl 28(%esp) + call fesetround +..B1.17: + movl 16(%esp), %eax + notl %eax + andl $1, %eax + flds _small_value_32@GOTOFF(%ebx,%eax,4) + fmuls .L_2il0floatpacket.5@GOTOFF(%ebx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + fxch %st(1) + fcompl _overflow_boundary@GOTOFF(%ebx) + fnstsw %ax + sahf + jae ..B1.79 +..B1.19: + flds .L_2il0floatpacket.2@GOTOFF(%ebx) + testl %esi, %esi + je ..B1.21 +..B1.20: + fstp %st(1) + flds 20(%esp) + fld %st(1) + fadd %st(1), %st + fstps 24(%esp) + flds 24(%esp) + fsub %st(2), %st + fsubr %st(1), %st + fabs + fld %st(0) + fmul %st(1), %st + fldl 8+_tgamma_sin_table@GOTOFF(%ebx) + fmul %st(1), %st + fldl 24+_tgamma_sin_table@GOTOFF(%ebx) + fadd %st(2), %st + fmul %st(2), %st + fxch %st(1) + faddl _tgamma_sin_table@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 16+_tgamma_sin_table@GOTOFF(%ebx) + fmulp %st, %st(1) + fldl 40+_tgamma_sin_table@GOTOFF(%ebx) + fadd %st(2), %st + fmul %st(2), %st + fldl 56+_tgamma_sin_table@GOTOFF(%ebx) + fadd %st(3), %st + fmulp %st, %st(3) + faddl 32+_tgamma_sin_table@GOTOFF(%ebx) + fmulp %st, %st(1) + fxch %st(1) + faddl 48+_tgamma_sin_table@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + fadd %st(1), %st + fxch %st(3) + fxch %st(2) + fxch %st(1) + jmp ..B1.22 +..B1.21: + flds 20(%esp) + fld %st(2) +..B1.22: + fld %st(1) + fxch %st(2) + fadd %st(3), %st + fstps 24(%esp) + flds 24(%esp) + movl 24(%esp), %edi + fsubp %st, %st(3) + andl $1048575, %edi + fxch %st(2) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.97 +..B1.23: + fld1 + decl %edi + fsubr %st, %st(1) +..B1.24: + lea 1(%edi), %eax + andl $1, %eax + movl %eax, 28(%esp) + fxch %st(2) + fcoms .L_2il0floatpacket.4@GOTOFF(%ebx) + fnstsw %ax + sahf + jb ..B1.41 +..B1.25: + fstp %st(3) + movl %edi, %eax + fsubr %st(2), %st + movl %esi, 16(%esp) + andl $-8, %eax + movl %edi, %esi + fld %st(0) + andl $7, %esi + cmpl $8, %edi + movl %eax, %edi + fmul %st(1), %st + lea -2(%esi), %edx + jl ..L3 + movl %esi, %edx +..L3: + sarl $1, %edi + addl %eax, %edi + sarl $3, %eax + addl %eax, %edi + movl 16(%esp), %esi + testl %edx, %edx + fldl _tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmul %st(2), %st + fadd %st(1), %st + fldl 8+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmul %st(3), %st + fadd %st(2), %st + fldl 16+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmul %st(4), %st + fadd %st(3), %st + fxch %st(2) + faddl 48+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fxch %st(1) + faddl 56+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fxch %st(2) + faddl 64+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fxch %st(1) + fmull 96+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmulp %st, %st(2) + fmulp %st, %st(1) + fldl 32+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmul %st(3), %st + fadd %st(2), %st + fldl 24+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmul %st(4), %st + fadd %st(3), %st + fxch %st(1) + faddl 80+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fxch %st(1) + faddl 72+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmulp %st, %st(2) + fmulp %st, %st(1) + fldl 40+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddl 88+_tgamma_A_table@GOTOFF(%ebx,%edi,8) + fmulp %st, %st(1) + je ..B1.30 +..B1.26: + fld %st(1) + jle ..B1.31 +..B1.27: + movl $1, %eax +..B1.28: + movl %eax, 16(%esp) + incl %eax + fildl 16(%esp) + cmpl %edx, %eax + fsubr %st(4), %st + fmulp %st, %st(1) + jle ..B1.28 + jmp ..B1.31 +..B1.30: + fld %st(1) +..B1.31: + testl %esi, %esi + je ..B1.38 +..B1.32: + fxch %st(4) + fmulp %st, %st(3) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fdivrp %st, %st(1) + flds .L_2il0floatpacket.7@GOTOFF(%ebx) + fcomps 8(%ebp) + fnstsw %ax + sahf + jbe ..B1.34 +..B1.33: + fldt _tgamma_A40_inv@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.34: + testl %ecx, %ecx + je ..B1.36 +..B1.35: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.103: + fldl 16(%esp) +..B1.36: + cmpl $0, 28(%esp) + je ..B1.40 +..B1.37: + fchs + jmp ..B1.40 +..B1.38: + fstp %st(4) + fstp %st(2) + fstp %st(0) + testl %ecx, %ecx + fmulp %st, %st(1) + je ..B1.40 +..B1.39: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.102: + fldl 16(%esp) +..B1.40: + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.41: + fstp %st(1) + fcom %st(1) + fnstsw %ax + sahf + jae ..B1.43 + jp ..B1.43 +..B1.42: + fld %st(0) + fadd %st(2), %st + jmp ..B1.44 +..B1.43: + fld %st(0) +..B1.44: + fcoml .L_2il0floatpacket.6@GOTOFF(%ebx) + fnstsw %ax + sahf + jb ..B1.46 +..B1.45: + fstp %st(3) + lea _tgamma_A175_table@GOTOFF(%ebx), %eax + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + jmp ..B1.53 +..B1.46: + fcoml .L_2il0floatpacket.8@GOTOFF(%ebx) + fnstsw %ax + sahf + jb ..B1.48 +..B1.47: + fstp %st(3) + lea _tgamma_A150_table@GOTOFF(%ebx), %eax + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + jmp ..B1.53 +..B1.48: + fldl .L_2il0floatpacket.9@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + ja ..B1.50 + jp ..B1.50 +..B1.49: + fstp %st(0) + fstp %st(3) + fld %st(1) + lea _tgamma_A125_table@GOTOFF(%ebx), %eax + faddl _local_minimum@GOTOFF(%ebx) + fsubrp %st, %st(3) + jmp ..B1.53 +..B1.50: + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.52 +..B1.51: + fstp %st(3) + lea _tgamma_A100_table@GOTOFF(%ebx), %eax + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + jmp ..B1.53 +..B1.52: + fstp %st(0) +..B1.53: + fldl (%eax) + testl %edx, %edx + je ..B1.55 +..B1.54: + fldl 56(%eax) + fmul %st(4), %st + faddl 48(%eax) + fmul %st(4), %st + faddl 40(%eax) + fmul %st(4), %st + faddl 32(%eax) + fmul %st(4), %st + faddl 24(%eax) + fmul %st(4), %st + faddl 16(%eax) + fmul %st(4), %st + faddl 8(%eax) + fmulp %st, %st(4) + faddp %st, %st(3) + jmp ..B1.56 +..B1.55: + fstp %st(3) +..B1.56: + fcom %st(1) + fnstsw %ax + sahf + jae ..B1.65 + jp ..B1.65 +..B1.57: + testl %esi, %esi + je ..B1.62 +..B1.58: + fstp %st(0) + fxch %st(1) + fmulp %st, %st(2) + fdivp %st, %st(1) + testl %ecx, %ecx + je ..B1.60 +..B1.59: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.101: + fldl 16(%esp) +..B1.60: + cmpl $0, 28(%esp) + je ..B1.72 +..B1.61: + fchs + jmp ..B1.72 +..B1.62: + fstp %st(3) + fstp %st(0) + fdivp %st, %st(1) + testl %ecx, %ecx + jne ..B1.70 + jmp ..B1.72 +..B1.65: + testl %esi, %esi + je ..B1.69 +..B1.66: + fmulp %st, %st(3) + testl %ecx, %ecx + fxch %st(1) + fmulp %st, %st(2) + fdivp %st, %st(1) + jne ..B1.70 + jmp ..B1.72 +..B1.69: + fstp %st(3) + fstp %st(2) + fstp %st(1) + testl %ecx, %ecx + je ..B1.72 +..B1.70: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.98: + fldl 16(%esp) +..B1.72: + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.73: + fstp %st(1) + testl %ecx, %ecx + je ..B1.75 +..B1.74: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.106: + fldl 16(%esp) +..B1.75: + fdiv %st(0), %st + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.76: + fstp %st(1) + testl %ecx, %ecx + je ..B1.78 +..B1.77: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.105: + fldl 16(%esp) +..B1.78: + fdiv %st(0), %st + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.79: + fstp %st(0) + testl %ecx, %ecx + je ..B1.81 +..B1.80: + addl $4, %esp + pushl 28(%esp) + call fesetround +..B1.81: + flds .L_2il0floatpacket.0@GOTOFF(%ebx) + fmul %st(0), %st + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.82: + fstp %st(0) + fstp %st(0) + testl %ecx, %ecx + je ..B1.84 +..B1.83: + addl $4, %esp + pushl 28(%esp) + call fesetround +..B1.84: + flds _large_value_32@GOTOFF(%ebx,%esi,4) + fmuls .L_2il0floatpacket.0@GOTOFF(%ebx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.85: + fstp %st(1) + testl %ecx, %ecx + je ..B1.87 +..B1.86: + addl $4, %esp + pushl 28(%esp) + fstpl 16(%esp) + call fesetround +..B1.104: + fldl 16(%esp) +..B1.87: + fdivrs _ones@GOTOFF(%ebx,%esi,4) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.88: + testl %ecx, %ecx + je ..B1.90 +..B1.89: + addl $4, %esp + pushl 28(%esp) + call fesetround +..B1.90: + testl %esi, %esi + je ..B1.92 +..B1.91: + testl $8388607, 8(%ebp) + je ..B1.93 +..B1.92: + flds 8(%ebp) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.93: + fldz + fdivrs .L_2il0floatpacket.1@GOTOFF(%ebx) + addl $36, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.97: + fld1 + jmp ..B1.24 + .align 16,0x90 + .type tgammaf,@function + .size tgammaf,.-tgammaf + .data +# -- End tgammaf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0x3ffc0000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3ff80000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3ff40000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x71800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x80000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x4b400000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0xc22c0000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0x40000000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +.L_2il0floatpacket.5: + .long 0x0d800000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,4 + .align 4 +.L_2il0floatpacket.7: + .long 0xc2200000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_overflow_boundary: + .long 0 + .long 1078035746 + .type _overflow_boundary,@object + .size _overflow_boundary,8 + .align 4 +_tgamma_sin_table: + .long 1980114658 + .long 3200337074 + .long 804494867 + .long 1049689241 + .long 2884431818 + .long 1079329239 + .long 930502348 + .long 3223780109 + .long 1245824743 + .long 1080878479 + .long 2510431012 + .long 1073721695 + .long 1661126174 + .long 1078219640 + .long 1205599443 + .long 3223573914 + .type _tgamma_sin_table,@object + .size _tgamma_sin_table,64 + .align 4 +_tgamma_A_table: + .long 3121394612 + .long 1074393041 + .long 2029996066 + .long 1073722195 + .long 4137005464 + .long 1071238760 + .long 3372276227 + .long 3220751114 + .long 68401302 + .long 3222286887 + .long 1275947047 + .long 3223263002 + .long 4031994882 + .long 1074665426 + .long 1089993416 + .long 1074817170 + .long 427005612 + .long 1075089294 + .long 1508975772 + .long 1075601433 + .long 2111623053 + .long 1076192020 + .long 75538972 + .long 1077100653 + .long 2171869559 + .long 1055005400 + .long 2919987515 + .long 1074143787 + .long 860307162 + .long 1073890599 + .long 2407232453 + .long 1073038722 + .long 1468490975 + .long 3216757264 + .long 846192051 + .long 3221294835 + .long 402234383 + .long 3222573752 + .long 2566208764 + .long 1073763360 + .long 162360449 + .long 1073949715 + .long 1512348533 + .long 1074371728 + .long 2920174397 + .long 1074968946 + .long 3785085665 + .long 1075671857 + .long 1922428759 + .long 1076496000 + .long 2446382284 + .long 1072101083 + .long 42366358 + .long 1073746704 + .long 3587290866 + .long 1073390434 + .long 1169958761 + .long 1072607731 + .long 3891474799 + .long 3217275878 + .long 1452792685 + .long 3221010072 + .long 1006385979 + .long 3222363118 + .long 3663632771 + .long 1072778759 + .long 3212960448 + .long 1073036150 + .long 2202365811 + .long 1073636095 + .long 2023822532 + .long 1074258740 + .long 40477660 + .long 1075053854 + .long 658935515 + .long 1076010306 + .long 932572503 + .long 1105834679 + .long 1233355998 + .long 1073412029 + .long 3033646034 + .long 1073097432 + .long 3149182759 + .long 1072206908 + .long 1726027606 + .long 3217766868 + .long 3439348786 + .long 3220880557 + .long 2080997065 + .long 3222253033 + .long 843307201 + .long 1072200111 + .long 3138702878 + .long 1072613342 + .long 3610734718 + .long 1073142430 + .long 2651617324 + .long 1073914526 + .long 2611481547 + .long 1074796471 + .long 3284459136 + .long 1075745821 + .long 1365755587 + .long 1144167771 + .long 2699624028 + .long 1073212595 + .long 2232824171 + .long 1072922970 + .long 3659224963 + .long 1071959670 + .long 3026238542 + .long 3218100813 + .long 4240441539 + .long 3220810712 + .long 1772362075 + .long 3222132889 + .long 3742687744 + .long 1071863890 + .long 56227394 + .long 1072220001 + .long 969667939 + .long 1072882737 + .long 880059910 + .long 1073714908 + .long 247554419 + .long 1074515829 + .long 48918556 + .long 1075495246 + .long 2601377264 + .long 1185936586 + .long 3625529495 + .long 1073077476 + .long 3298250746 + .long 1072804056 + .long 2971501690 + .long 1071788510 + .long 2950162741 + .long 3218231788 + .long 26528490 + .long 3220765509 + .long 3761284804 + .long 3222050392 + .long 3800626879 + .long 1071658634 + .long 1108715276 + .long 1071977390 + .long 286829382 + .long 1072720005 + .long 3141975933 + .long 1073477575 + .long 4145290123 + .long 1074329952 + .long 2167683451 + .long 1075329952 + .long 0 + .long 1072693248 + .type _tgamma_A_table,@object + .size _tgamma_A_table,624 + .align 4 +_tgamma_A175_table: + .long 1682645026 + .long 1072688670 + .long 3753006229 + .long 3219243438 + .long 177700005 + .long 1072453288 + .long 3289039035 + .long 3219374666 + .long 2492560830 + .long 1071326765 + .long 123078934 + .long 3217486055 + .long 3499570675 + .long 1068068407 + .long 1362583934 + .long 3212265128 + .type _tgamma_A175_table,@object + .size _tgamma_A175_table,64 + .align 4 +_tgamma_A150_table: + .long 988281800 + .long 1072692321 + .long 502740408 + .long 3219277207 + .long 2058512241 + .long 1072588117 + .long 2109547492 + .long 3219675970 + .long 3371209031 + .long 1071892748 + .long 3191518250 + .long 3218447665 + .long 3816909947 + .long 1069498883 + .long 1366906983 + .long 3214177035 + .type _tgamma_A150_table,@object + .size _tgamma_A150_table,64 + .align 4 +_tgamma_A125_table: + .long 2191760034 + .long 1072453340 + .long 2642694891 + .long 3186525859 + .long 1706815263 + .long 1071344724 + .long 1896485049 + .long 3217079006 + .long 441733475 + .long 1069848224 + .long 978611902 + .long 3216500728 + .long 351495825 + .long 1068442485 + .long 1680249708 + .long 3216253219 + .type _tgamma_A125_table,@object + .size _tgamma_A125_table,64 + .align 4 +_local_minimum: + .long 2371549438 + .long 1071483745 + .type _local_minimum,@object + .size _local_minimum,8 + .align 4 +_tgamma_A100_table: + .long 4293468318 + .long 1072693247 + .long 3444857508 + .long 3219290252 + .long 3510931740 + .long 1072670280 + .long 3644082616 + .long 3219982336 + .long 2685454907 + .long 1072646231 + .long 4151446349 + .long 3220059936 + .long 4004008463 + .long 1072263166 + .long 1217534056 + .long 3218706582 + .type _tgamma_A100_table,@object + .size _tgamma_A100_table,64 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 2 +_tgamma_A40_inv: + .word 64725 + .word 58913 + .word 22381 + .word 51879 + .word 16232 + .word 0 + .type _tgamma_A40_inv,@object + .size _tgamma_A40_inv,12 + .data + .hidden fesetround + .hidden fegetround + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/tgammal.S b/external/sgx_libm/ia32/tgammal.S new file mode 100644 index 0000000000..11cb8a5ab1 --- /dev/null +++ b/external/sgx_libm/ia32/tgammal.S @@ -0,0 +1,3738 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tgammal.c" + .text +..TXTST0: +# -- Begin tgammal + .text + .align 16,0x90 + .globl tgammal +tgammal: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $308, %esp + fldt 8(%ebp) + movl %gs:20, %eax + xorl %esp, %eax + movl %eax, 248(%esp) + fstpt 212(%esp) +..B1.2: + fnstcw 150(%esp) +..B1.3: + movzwl 150(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.195 +..B1.4: + orl $-64768, %edx + movw %dx, 148(%esp) +..B1.5: + fldcw 148(%esp) +..B1.6: + movl $1, %esi +..B1.7: + call fegetround +..B1.198: + movl %eax, 116(%esp) +..B1.8: + cmpl $0, 116(%esp) + jne ..B1.10 +..B1.9: + xorl %edi, %edi + jmp ..B1.12 +..B1.10: + addl $-16, %esp + movl $0, (%esp) + call fesetround +..B1.199: + addl $16, %esp +..B1.11: + movl $1, %edi +..B1.12: + movl 16(%ebp), %eax + movzwl 16(%ebp), %ecx + shrl $15, %eax + andl $32767, %ecx + andl $1, %eax + movl %eax, 132(%esp) + cmpl $32767, %ecx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + je ..B1.180 +..B1.13: + fldt 8(%ebp) + andl $32767, 220(%esp) + fldl _zeros@GOTOFF(%ebx) + fucom %st(1) + fnstsw %ax + sahf + jp ..B1.14 + je ..B1.173 +..B1.14: + cmpl $0, 132(%esp) + je ..B1.27 +..B1.15: + cmpl $16446, %ecx + jge ..B1.143 +..B1.16: + fldt 212(%esp) + fld %st(0) + fldl _TWO_63H@GOTOFF(%ebx) + fadd %st, %st(1) + fxch %st(1) + fstpt 92(%esp) + fldt 92(%esp) + fsubp %st, %st(1) + movl 92(%esp), %edx + fcom %st(1) + fnstsw %ax + movl %edx, 36(%esp) + sahf + jbe ..B1.18 +..B1.17: + incl 36(%esp) + fsubl _ones@GOTOFF(%ebx) +..B1.18: + fucompp + fnstsw %ax + sahf + jp ..B1.19 + je ..B1.136 +..B1.19: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B1.27 +..B1.20: + fstp %st(0) + fstp %st(0) + testl %edi, %edi + je ..B1.22 +..B1.21: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.200: + addl $16, %esp +..B1.22: + fldt _small_value_80@GOTOFF(%ebx) + movl 36(%esp), %edx + notl %edx + andl $1, %edx + testl %esi, %esi + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fldt _small_value_80@GOTOFF(%ebx,%ecx) + fmulp %st, %st(1) + fstpt 64(%esp) + je ..B1.24 +..B1.23: + fldcw 150(%esp) +..B1.24: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.25: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.27: + fldt _POS_OVERFLOW@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + fxch %st(1) + fstp %st(0) + sahf + jp ..B1.28 + jb ..B1.166 +..B1.28: + testl %ecx, %ecx + je ..B1.156 +..B1.29: + fldt 212(%esp) + fld %st(1) + fxch %st(1) + fstpt 152(%esp) + fldt 152(%esp) + fstpt 168(%esp) + fldt 168(%esp) + fxch %st(2) + fstpt 136(%esp) + fldt 136(%esp) + cmpl $0, 132(%esp) + je ..B1.33 +..B1.30: + fldl _TWO_63H@GOTOFF(%ebx) + cmpl $16299, %ecx + jle ..B1.32 +..B1.31: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fxch %st(3) + fstpt 24(%esp) + fld %st(3) + fadd %st(1), %st + fsub %st(1), %st + fsubr %st(4), %st + fstpt 52(%esp) + andl $32767, 60(%esp) + fstpt 40(%esp) + fstpt 80(%esp) + fxch %st(1) + fstpt 64(%esp) + fldt 64(%esp) + fldt 52(%esp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + fchs + fsubrp %st, %st(3) + fld %st(2) + fld %st(1) + fsub %st(4), %st + fmul %st, %st(1) + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(4) + fmul %st(5), %st + fxch %st(3) + fstpt (%esp) + fld %st(2) + fldl _TWO_53H@GOTOFF(%ebx) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fld %st(4) + fmul %st(1), %st + fld %st(5) + fadd %st(1), %st + fsubp %st, %st(1) + fstpt 152(%esp) + fldt 152(%esp) + fsubrp %st, %st(5) + fxch %st(4) + fstpt 136(%esp) + fldt 72+_tgammal_S@GOTOFF(%ebx) + fmul %st(1), %st + fldt 60+_tgammal_S@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_tgammal_S@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 36+_tgammal_S@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 24+_tgammal_S@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 12+_tgammal_S@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt _tgammal_S@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl _tgammal_S2@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + faddl 8+_tgammal_S2@GOTOFF(%ebx) + fld %st(0) + fmul %st(4), %st + faddp %st, %st(3) + fmul %st(4), %st + faddp %st, %st(2) + fldl 8+_tgammal_S1@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldl _tgammal_S1@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(4) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fmul %st(3), %st + fld %st(2) + fmul %st(5), %st + fxch %st(4) + fmulp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fldl _ones@GOTOFF(%ebx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fmul %st(7), %st + fmul %st, %st(6) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fmul %st, %st(4) + fldt (%esp) + fld %st(0) + fmulp %st, %st(2) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(3) + fld %st(2) + fxch %st(2) + fstpt 184(%esp) + fldt 184(%esp) + fxch %st(3) + fstpt 200(%esp) + fldt 200(%esp) + fldt 152(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpt 104(%esp) + fmulp %st, %st(1) + fldt 136(%esp) + fmul %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 120(%esp) + fldt 80(%esp) + fldt 24(%esp) + fldt 40(%esp) + fldt 64(%esp) + fxch %st(3) + fxch %st(1) + jmp ..B1.34 +..B1.32: + fldt 168(%esp) + fstpt 184(%esp) + fxch %st(1) + fstpt 104(%esp) + fldt 104(%esp) + fxch %st(2) + fstpt 200(%esp) + fld %st(1) + fxch %st(2) + fstpt 120(%esp) + fldt 120(%esp) + fxch %st(1) + jmp ..B1.34 +..B1.33: + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + fstpt 120(%esp) + fldt 120(%esp) + fstpt 104(%esp) + fldt 104(%esp) + fstpt 200(%esp) + fldt 200(%esp) + fstpt 184(%esp) + fldl _TWO_63H@GOTOFF(%ebx) +..B1.34: + fldt .L_2il0floatpacket.3@GOTOFF(%ebx) + fcomp %st(4) + fnstsw %ax + sahf + jp ..B1.35 + jbe ..B1.96 +..B1.35: + fld %st(3) + fadd %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fsubp %st, %st(1) + movl 92(%esp), %edx + fcom %st(3) + fnstsw %ax + sahf + jbe ..B1.37 +..B1.36: + decl %edx + fsubl _ones@GOTOFF(%ebx) +..B1.37: + cmpl $2, %edx + lea 1(%edx), %eax + movl %eax, 76(%esp) + jl ..B1.42 +..B1.38: + testb $1, %dl + je ..B1.40 +..B1.39: + fldl _ones@GOTOFF(%ebx) + lea -1(%edx), %eax + movl %eax, (%esp) + fsubr %st, %st(4) + fxch %st(4) + fstpt 168(%esp) + fsubp %st, %st(3) + jmp ..B1.41 +..B1.40: + fstp %st(3) + movl %edx, (%esp) +..B1.41: + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + movl (%esp), %eax + faddp %st, %st(3) + fldt 168(%esp) + addl $-2, %eax + sarl $1, %eax + movl %edi, 40(%esp) + fsubp %st, %st(3) + imull $180, %eax, %edi + lea (%eax,%eax,2), %eax + shll $5, %eax + lea _tgammal_T2@GOTOFF(%ebx,%edi), %edi + movl %edi, 36(%esp) + movl 40(%esp), %edi + lea _tgammal_A2@GOTOFF(%ebx,%eax), %eax + jmp ..B1.56 +..B1.42: + fstp %st(0) + fldt .L_2il0floatpacket.5@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.44 +..B1.43: + movl $3, (%esp) + jmp ..B1.55 +..B1.44: + fldt .L_2il0floatpacket.7@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.46 +..B1.45: + movl $0, (%esp) + jmp ..B1.55 +..B1.46: + fldt .L_2il0floatpacket.8@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.48 +..B1.47: + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + movl $1, (%esp) + fsubrp %st, %st(3) + jmp ..B1.55 +..B1.48: + fldt .L_2il0floatpacket.9@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.50 +..B1.49: + movl $2, (%esp) + fxch %st(2) + fsubrl _ones@GOTOFF(%ebx) + fxch %st(2) + jmp ..B1.55 +..B1.50: + fldt .L_2il0floatpacket.10@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.52 +..B1.51: + movl $0, (%esp) + fxch %st(2) + fsubl _ones@GOTOFF(%ebx) + fxch %st(2) + jmp ..B1.55 +..B1.52: + fldt .L_2il0floatpacket.11@GOTOFF(%ebx) + fcomp %st(3) + fnstsw %ax + sahf + jbe ..B1.54 +..B1.53: + fldt .L_2il0floatpacket.12@GOTOFF(%ebx) + movl $1, (%esp) + fsubrp %st, %st(3) + jmp ..B1.55 +..B1.54: + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + movl $2, (%esp) + fsubp %st, %st(3) +..B1.55: + movl (%esp), %eax + fldz + movl %edi, 40(%esp) + imull $180, %eax, %edi + fstpt 168(%esp) + lea (%eax,%eax,2), %eax + shll $5, %eax + lea _tgammal_T1@GOTOFF(%ebx,%edi), %edi + movl %edi, 36(%esp) + movl 40(%esp), %edi + lea _tgammal_A1@GOTOFF(%ebx,%eax), %eax +..B1.56: + cmpl $16299, %ecx + jle ..B1.62 +..B1.57: + fstp %st(1) + movl %edi, 40(%esp) + testb $1, %dl + movl 36(%esp), %edi + fstpt 80(%esp) + fldt 168(%edi) + fmul %st(1), %st + fldt 156(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 144(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 132(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 120(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 108(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 84(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 72(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 60(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%edi) + faddp %st, %st(1) + fmul %st(1), %st + fld %st(1) + fldt 36(%edi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24(%edi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 12(%edi) + faddp %st, %st(1) + fmul %st(2), %st + fld %st(2) + fldt (%edi) + movl 40(%esp), %edi + faddp %st, %st(2) + fld %st(3) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fmul %st, %st(4) + fxch %st(2) + fadd %st(4), %st + fsubp %st, %st(4) + fsub %st(3), %st + fld %st(0) + fld %st(2) + fmul %st(4), %st + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(5) + fxch %st(2) + fmul %st(5), %st + fxch %st(5) + fmul %st(6), %st + faddp %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(4) + fxch %st(2) + fstpt (%esp) + fldt (%esp) + fldl 88(%eax) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + fld %st(4) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fldl 80(%eax) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fld %st(1) + fmul %st(5), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fld %st(1) + fmul %st(4), %st + fld %st(3) + fmul %st(6), %st + fxch %st(5) + fmul %st(6), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldl 72(%eax) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + faddp %st, %st(4) + fldl 64(%eax) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fld %st(1) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(5) + faddp %st, %st(3) + fld %st(3) + fmul %st(3), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fldl 56(%eax) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fldl 48(%eax) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fld %st(0) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(3) + fmul %st(2), %st + fld %st(3) + fmul %st(6), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(1) + fxch %st(3) + fmul %st(4), %st + faddp %st, %st(3) + fldl 40(%eax) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fldl 32(%eax) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fld %st(1) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fld %st(4) + fmul %st(4), %st + fxch %st(4) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(3) + fldl 24(%eax) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fldl 16(%eax) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fmul %st, %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsub %st, %st(1) + fld %st(1) + fmul %st(6), %st + fxch %st(2) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + fmul %st, %st(5) + fld %st(4) + fmulp %st, %st(1) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 8(%eax) + fld %st(0) + fadd %st(4), %st + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(1) + fadd %st, %st(4) + fsubrp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fldl (%eax) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt 80(%esp) + je ..B1.60 +..B1.58: + cmpl $1, %edx + jle ..B1.60 +..B1.59: + fstp %st(0) + fstp %st(0) + fldt (%esp) + fld %st(1) + fmul %st(1), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fld %st(1) + fldt 168(%esp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fstpt 92(%esp) + fldt 92(%esp) + fsubp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(3) + fld %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B1.64 +..B1.60: + fxch %st(1) + fstpt 92(%esp) + fxch %st(1) + jmp ..B1.63 +..B1.62: + fldl _ones@GOTOFF(%ebx) +..B1.63: + testl %edx, %edx + jle ..B1.77 +..B1.225: + fstp %st(1) +..B1.64: + cmpl $0, 132(%esp) + jne ..B1.71 +..B1.65: + testl %edi, %edi + je ..B1.67 +..B1.66: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 40(%esp) + fstpt 80(%esp) + call fesetround +..B1.201: + fldt 80(%esp) + fldt 40(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.67: + testl %esi, %esi + faddp %st, %st(1) + fstpt 64(%esp) + je ..B1.226 +..B1.68: + fstpt 52(%esp) +..B1.202: + fldcw 150(%esp) + jmp ..B1.69 +..B1.226: + fstp %st(0) +..B1.69: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.70: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.71: + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fld %st(1) + fldt 104(%esp) + testl %edi, %edi + fld %st(0) + fmul %st(3), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fldt 120(%esp) + faddp %st, %st(2) + fld %st(4) + fmul %st(4), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fmul %st(1), %st + fxch %st(3) + fsubr %st, %st(5) + fxch %st(5) + faddp %st, %st(6) + fld %st(5) + fmul %st(2), %st + fxch %st(1) + fmulp %st, %st(6) + faddp %st, %st(5) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fld %st(1) + fld %st(3) + fxch %st(2) + fdivrl _ones@GOTOFF(%ebx) + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(2) + fsub %st(1), %st + fld %st(3) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(5) + faddp %st, %st(4) + fld %st(1) + fmul %st(4), %st + fld %st(1) + fmul %st(6), %st + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fld %st(0) + fsub %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + fsubp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fstpt 224(%esp) + fldt 224(%esp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(4) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(4) + fld %st(5) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fxch %st(3) + fstpt 236(%esp) + fxch %st(2) + fxch %st(1) + je ..B1.73 +..B1.72: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 40(%esp) + fstpt 56(%esp) + fstpt 80(%esp) + call fesetround +..B1.203: + fldt 80(%esp) + fldt 56(%esp) + fldt 40(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.73: + movl 76(%esp), %eax + faddp %st, %st(1) + andl $1, %eax + fstpt 64(%esp) + shll $15, %eax + xorl %eax, 72(%esp) + testl %esi, %esi + je ..B1.227 +..B1.74: + fxch %st(1) + fstpt 52(%esp) + fstpt 92(%esp) +..B1.204: + fldcw 150(%esp) + jmp ..B1.75 +..B1.227: + fstp %st(0) + fstp %st(0) +..B1.75: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.76: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.77: + fldl _ones@GOTOFF(%ebx) + cmpl $0, 132(%esp) + jne ..B1.87 +..B1.78: + fldt 152(%esp) + cmpl $100, %ecx + fldt 136(%esp) + faddp %st, %st(1) + jge ..B1.80 +..B1.79: + fstp %st(4) + fdivp %st, %st(3) + fmulp %st, %st(2) + fxch %st(2) + jmp ..B1.81 +..B1.80: + fstp %st(3) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fld %st(0) + fxch %st(4) + fdivrp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fsub %st(3), %st + fxch %st(5) + fstpt 64(%esp) + fxch %st(3) + fstpt 24(%esp) + fldt 152(%esp) + fld %st(0) + fmul %st(4), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fld %st(5) + fldt 136(%esp) + faddp %st, %st(3) + fmul %st(2), %st + fld %st(4) + fmul %st(2), %st + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fld %st(0) + fsub %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + fsubrp %st, %st(1) + fsubp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(5) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 224(%esp) + fldt 224(%esp) + fld %st(4) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(4) + fld %st(6) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(3) + fld %st(1) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(4) + fld %st(2) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(5) + fstpt 236(%esp) + fld %st(0) + fadd %st(4), %st + fstpt 92(%esp) + fldt 92(%esp) + fsubp %st, %st(4) + fsub %st(3), %st + faddp %st, %st(2) + fldt 24(%esp) + faddp %st, %st(1) + fld %st(0) + fmul %st(2), %st + fld %st(4) + fmul %st(4), %st + fxch %st(3) + fmulp %st, %st(5) + faddp %st, %st(4) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 64(%esp) +..B1.81: + testl %edi, %edi + fxch %st(1) + je ..B1.83 +..B1.82: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 80(%esp) + fstpt 96(%esp) + call fesetround +..B1.205: + fldt 96(%esp) + fldt 80(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.83: + testl %esi, %esi + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%esp) + je ..B1.228 +..B1.84: + fstpt 52(%esp) +..B1.206: + fldcw 150(%esp) + jmp ..B1.85 +..B1.228: + fstp %st(0) +..B1.85: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.86: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.87: + cmpl $100, %ecx + jge ..B1.89 +..B1.88: + fldt 184(%esp) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fdivrp %st, %st(2) + fxch %st(2) + jmp ..B1.90 +..B1.89: + fstp %st(2) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fld %st(1) + fxch %st(5) + fstpt 64(%esp) + fld %st(1) + fmul %st(1), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + fxch %st(1) + fsub %st(4), %st + faddp %st, %st(3) + fldt 184(%esp) + fld %st(0) + fmul %st(2), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fld %st(5) + fmul %st(1), %st + fxch %st(1) + fmul %st(5), %st + fldt 200(%esp) + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(6) + fmulp %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fld %st(2) + fadd %st(4), %st + fdivrp %st, %st(2) + fld %st(0) + fmul %st(2), %st + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(1) + fld %st(0) + fsubrp %st, %st(3) + fld %st(1) + fmul %st(5), %st + fld %st(5) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fld %st(2) + fmul %st(4), %st + fld %st(1) + fmul %st(6), %st + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fxch %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fld %st(0) + fsub %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(4) + fsubrp %st, %st(1) + fadd %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fld %st(5) + fxch %st(2) + fsubrp %st, %st(1) + fmul %st, %st(5) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmul %st(2), %st + fld %st(3) + fmul %st(2), %st + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + fstpt 236(%esp) + fxch %st(1) + fstpt 224(%esp) + fldt 64(%esp) +..B1.90: + testl %edi, %edi + fxch %st(1) + je ..B1.92 +..B1.91: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 80(%esp) + fstpt 96(%esp) + call fesetround +..B1.207: + fldt 96(%esp) + fldt 80(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.92: + movl 76(%esp), %eax + faddp %st, %st(2) + andl $1, %eax + fxch %st(1) + fstpt 64(%esp) + shll $15, %eax + xorl %eax, 72(%esp) + testl %esi, %esi + je ..B1.229 +..B1.93: + fstpt 52(%esp) +..B1.208: + fldcw 150(%esp) + jmp ..B1.94 +..B1.229: + fstp %st(0) +..B1.94: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.95: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.96: + fstp %st(2) + fldl _ones@GOTOFF(%ebx) + fstl 56(%esp) + fld %st(3) + fdivrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt (%esp) + addl $-32, %esp + lea 208(%esp), %eax + fxch %st(3) + fstpt (%esp) + fstpt 12(%esp) + movl %eax, 24(%esp) + fxch %st(1) + fstpt 56(%esp) + fstpt 72(%esp) + call __libm_logl_k80 +..B1.209: + fstp %st(0) + fldt 72(%esp) + fldt 56(%esp) + addl $32, %esp +..B1.97: + fldl 56+_tgammal_B@GOTOFF(%ebx) + fxch %st(2) + fstpt 40(%esp) + fldt (%esp) + fmul %st, %st(2) + fldt _tgammal_B0@GOTOFF(%ebx) + fldt .L_2il0floatpacket.4@GOTOFF(%ebx) + cmpl $0, 132(%esp) + fxch %st(4) + faddl 48+_tgammal_B@GOTOFF(%ebx) + fmul %st(2), %st + faddl 40+_tgammal_B@GOTOFF(%ebx) + fmul %st(2), %st + faddl 32+_tgammal_B@GOTOFF(%ebx) + fmul %st(2), %st + faddl 24+_tgammal_B@GOTOFF(%ebx) + fmul %st(2), %st + faddl 16+_tgammal_B@GOTOFF(%ebx) + fmul %st(2), %st + faddl 8+_tgammal_B@GOTOFF(%ebx) + fmul %st(2), %st + faddl _tgammal_B@GOTOFF(%ebx) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 212(%esp) + fsub %st, %st(2) + fld %st(2) + fxch %st(1) + fchs + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fldt 176(%esp) + fld %st(0) + fmulp %st, %st(4) + fld %st(0) + fadd %st(4), %st + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(4) + fxch %st(3) + fstpt 176(%esp) + fldt 176(%esp) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(4) + fldt 188(%esp) + faddp %st, %st(5) + fxch %st(2) + fmul %st(4), %st + fld %st(6) + fmul %st(5), %st + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fadd %st(6), %st + fsub %st, %st(6) + fxch %st(6) + fchs + fadd %st(1), %st + fxch %st(4) + fstpt 188(%esp) + fsubrp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(2) + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fadd %st, %st(1) + fxch %st(1) + fsub %st, %st(4) + fxch %st(4) + fchs + fadd %st(1), %st + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldl 8+_tgammal_C@GOTOFF(%ebx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldl _tgammal_C@GOTOFF(%ebx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.2@GOTOFF(%ebx) + fldt 40(%esp) + jne ..B1.109 +..B1.98: + fstp %st(1) + fxch %st(1) + fstpt 236(%esp) + lea 224(%esp), %edx + addl $-16, %esp + fxch %st(1) + fstpt (%edx) + lea 168(%esp), %eax + movl %eax, (%esp) + movl %edx, 4(%esp) + fstpt -112(%eax) + call __libm_expl_k80 +..B1.210: + fldt 56(%esp) + addl $16, %esp +..B1.99: + testl %edi, %edi + fxch %st(1) + je ..B1.102 +..B1.100: + fstpt (%esp) + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 56(%esp) + call fesetround +..B1.211: + fldt 56(%esp) + addl $16, %esp +..B1.101: + fldt (%esp) +..B1.102: + fldt 152(%esp) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%esp) + fldt 164(%esp) + movl (%esp), %edx + cmpl $16383, %edx + faddp %st, %st(1) + fldl 56(%esp) + fstpt (%esp) + jg ..B1.104 +..B1.103: + addl $16383, %edx + movzwl 8(%esp), %eax + andl $32767, %edx + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%esp) + fldt (%esp) + fmulp %st, %st(1) + jmp ..B1.105 +..B1.104: + fldt _TWO_POW_16383@GOTOFF(%ebx) + andl $32767, %edx + fmulp %st, %st(1) + movzwl 8(%esp), %eax + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%esp) + fldt (%esp) + fmulp %st, %st(1) +..B1.105: + fstpt 64(%esp) + testl %esi, %esi + je ..B1.107 +..B1.106: + fldt 24(%esp) + fstpt 92(%esp) +..B1.212: + fldcw 150(%esp) +..B1.107: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.108: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.109: + fxch %st(2) + fchs + lea 224(%esp), %edx + incl 36(%esp) + fstpt 12(%edx) + addl $-16, %esp + fxch %st(2) + fchs + lea 168(%esp), %eax + fstpt (%edx) + movl %eax, (%esp) + movl %edx, 4(%esp) + fxch %st(1) + fstpt 16(%esp) + fstpt -112(%eax) + call __libm_expl_k80 +..B1.213: + fldt 56(%esp) + fxch %st(1) + fstpt 40(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.110: + fldt 104(%esp) + fld %st(0) + fld %st(2) + fld %st(2) + fldt 120(%esp) + fadd %st, %st(3) + fxch %st(3) + fdivrl 56(%esp) + fmul %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(3) + fsub %st(2), %st + fld %st(4) + fmul %st(6), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fld %st(3) + fmul %st(1), %st + fld %st(3) + fmul %st(3), %st + fxch %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt .L_2il0floatpacket.6@GOTOFF(%ebx) + fld %st(0) + fsub %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + fsubrp %st, %st(1) + fsubp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(4) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fstpt 224(%esp) + fldt 224(%esp) + fld %st(4) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(4) + fld %st(3) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fstpt 236(%esp) + fld %st(2) + fxch %st(1) + fmul %st, %st(3) + fldt 152(%esp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fstpt 152(%esp) + fldt 152(%esp) + fld %st(1) + fadd %st(5), %st + fsub %st, %st(5) + fxch %st(2) + fsub %st(5), %st + faddp %st, %st(4) + fld %st(3) + fxch %st(1) + fsubr %st, %st(3) + fmul %st, %st(4) + fldt 164(%esp) + faddp %st, %st(4) + fxch %st(1) + fmul %st(3), %st + fld %st(5) + fmulp %st, %st(2) + fxch %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fstpt 64(%esp) + fldt 64(%esp) + movzwl 72(%esp), %ecx + andl $32767, %ecx + fxch %st(4) + fstpt 164(%esp) + fldt 24(%esp) + faddp %st, %st(5) + fxch %st(4) + fstpt (%esp) + movl (%esp), %edx + lea (%edx,%ecx), %eax + lea -1(%edx,%ecx), %ecx + cmpl $32765, %ecx + ja ..B1.116 +..B1.111: + fstp %st(1) + fstp %st(0) + fldl 56(%esp) + lea 16382(%edx), %eax + fstpt (%esp) + cmpl $32765, %eax + ja ..B1.113 +..B1.112: + addl $16383, %edx + movzwl 8(%esp), %eax + andl $32767, %edx + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.129 +..B1.113: + cmpl $16383, %edx + jle ..B1.115 +..B1.114: + fldt _TWO_POW_16383@GOTOFF(%ebx) + andl $32767, %edx + fmulp %st, %st(1) + movzwl 8(%esp), %eax + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.129 +..B1.115: + fldt _TWO_POW_M16382@GOTOFF(%ebx) + addl $32765, %edx + fmulp %st, %st(1) + andl $32767, %edx + movzwl 8(%esp), %eax + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%esp) + fldt (%esp) + fmulp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.129 +..B1.116: + fstp %st(2) + cmpl $32766, %eax + jle ..B1.118 +..B1.117: + fstp %st(0) + fstp %st(0) + fldt _TWO_POW_16383@GOTOFF(%ebx) + fmul %st(0), %st + fstpt 64(%esp) + jmp ..B1.129 +..B1.118: + cmpl $-65, %eax + jg ..B1.120 +..B1.119: + fstp %st(0) + fstp %st(0) + fldt _TWO_POW_M16382@GOTOFF(%ebx) + fmul %st(0), %st + fstpt 64(%esp) + jmp ..B1.129 +..B1.120: + fldl 56(%esp) + cmpl $-16382, %edx + fstpt (%esp) + jl ..B1.125 +..B1.121: + fstp %st(2) + fldl _TWO_53H@GOTOFF(%ebx) + addl $16383, %edx + fmul %st(2), %st + fld %st(2) + movzwl 8(%esp), %eax + andl $32767, %edx + andl $-32768, %eax + fsubr %st(1), %st + orl %edx, %eax + fsubr %st, %st(1) + movw %ax, 8(%esp) + testl %edi, %edi + fxch %st(1) + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(2) + fldt (%esp) + fmul %st, %st(3) + fxch %st(3) + fstpt 24(%esp) + fxch %st(2) + fmulp %st, %st(1) + je ..B1.124 +..B1.122: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 56(%esp) + call fesetround +..B1.214: + fldt 56(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.123: + xorl %edi, %edi +..B1.124: + fldt 24(%esp) + faddp %st, %st(1) + fstpt 64(%esp) + jmp ..B1.129 +..B1.125: + fldl _TWO_32HP@GOTOFF(%ebx) + negl %edx + fldt _TWO_POW_M16000@GOTOFF(%ebx) + addl $-15999, %edx + fmul %st, %st(2) + andl $32767, %edx + fld %st(2) + fxch %st(1) + fmulp %st, %st(4) + movzwl 8(%esp), %eax + fadd %st(3), %st + fldt _small_value_80@GOTOFF(%ebx) + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%esp) + testl %edi, %edi + fmul %st(0), %st + fstpt 12(%esp) + fldt (%esp) + fadd %st, %st(1) + fxch %st(1) + fmul %st, %st(2) + fmull _TWO_32H@GOTOFF(%ebx) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 24(%esp) + fldt 24(%esp) + fsubp %st, %st(1) + fsubrp %st, %st(1) + faddp %st, %st(1) + je ..B1.128 +..B1.126: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 16(%esp) + fstpt 56(%esp) + call fesetround +..B1.215: + fldt 56(%esp) + fldt 16(%esp) + addl $16, %esp +..B1.127: + xorl %edi, %edi +..B1.128: + fldt 24(%esp) + faddp %st, %st(1) + fstpt 64(%esp) + movzwl 72(%esp), %eax + andl $-32768, %eax + andl $2147483647, 68(%esp) + movw %ax, 72(%esp) +..B1.129: + movl 36(%esp), %eax + andl $1, %eax + shll $15, %eax + xorl %eax, 72(%esp) + testl %edi, %edi + je ..B1.131 +..B1.130: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 56(%esp) + call fesetround +..B1.216: + fldt 56(%esp) + addl $16, %esp +..B1.131: + testl %esi, %esi + je ..B1.230 +..B1.132: + fstpt 92(%esp) +..B1.217: + fldcw 150(%esp) + jmp ..B1.133 +..B1.230: + fstp %st(0) +..B1.133: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.134: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.135: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.136: + fstp %st(1) + testl %edi, %edi + je ..B1.138 +..B1.137: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 96(%esp) + call fesetround +..B1.218: + fldt 96(%esp) + addl $16, %esp +..B1.138: + fdiv %st(0), %st + testl %esi, %esi + fstpt 64(%esp) + je ..B1.140 +..B1.139: + fldcw 150(%esp) +..B1.140: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 + jmp ..B1.25 +..B1.143: + fstp %st(1) + testl %edi, %edi + je ..B1.145 +..B1.144: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 96(%esp) + call fesetround +..B1.219: + fldt 96(%esp) + addl $16, %esp +..B1.145: + fdiv %st(0), %st + testl %esi, %esi + fstpt 64(%esp) + je ..B1.147 +..B1.146: + fldcw 150(%esp) +..B1.147: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 + jmp ..B1.25 +..B1.156: + movl 12(%ebp), %eax + cmpl $536870912, %eax + jb ..B1.159 +..B1.157: + jne ..B1.29 +..B1.158: + cmpl $0, 8(%ebp) + jne ..B1.29 +..B1.159: + fstp %st(0) + testl %edi, %edi + je ..B1.161 +..B1.160: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.220: + addl $16, %esp +..B1.161: + fldt _large_value_80@GOTOFF(%ebx) + movl 132(%esp), %ecx + lea (,%ecx,8), %eax + lea (%eax,%ecx,4), %edx + shll $15, %ecx + fldt _large_value_80@GOTOFF(%ebx,%edx) + fmulp %st, %st(1) + fstpt 64(%esp) + orl %ecx, 72(%esp) + testl %esi, %esi + je ..B1.163 +..B1.162: + fldcw 150(%esp) +..B1.163: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 + jmp ..B1.25 +..B1.166: + fstp %st(0) + testl %edi, %edi + je ..B1.168 +..B1.167: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.221: + addl $16, %esp +..B1.168: + fldt _large_value_80@GOTOFF(%ebx) + testl %esi, %esi + fmul %st(0), %st + fstpt 64(%esp) + je ..B1.170 +..B1.169: + fldcw 150(%esp) +..B1.170: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 + jmp ..B1.25 +..B1.173: + fstp %st(1) + testl %edi, %edi + je ..B1.175 +..B1.174: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + fstpt 96(%esp) + call fesetround +..B1.222: + fldt 96(%esp) + addl $16, %esp +..B1.175: + movl 132(%esp), %eax + testl %esi, %esi + fldl _ones@GOTOFF(%ebx,%eax,8) + fdivp %st, %st(1) + fstpt 64(%esp) + je ..B1.177 +..B1.176: + fldcw 150(%esp) +..B1.177: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 + jmp ..B1.25 +..B1.180: + cmpl $0, 132(%esp) + je ..B1.183 +..B1.181: + cmpl $-2147483648, 12(%ebp) + jne ..B1.183 +..B1.182: + cmpl $0, 8(%ebp) + je ..B1.189 +..B1.183: + fldt 8(%ebp) + testl %esi, %esi + fmull _ones@GOTOFF(%ebx) + fstpt 64(%esp) + je ..B1.185 +..B1.184: + fldcw 150(%esp) +..B1.185: + testl %edi, %edi + je ..B1.187 +..B1.186: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.223: + addl $16, %esp +..B1.187: + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 +..B1.188: + addl $308, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.189: + testl %edi, %edi + je ..B1.191 +..B1.190: + addl $-16, %esp + movl 132(%esp), %eax + movl %eax, (%esp) + call fesetround +..B1.224: + addl $16, %esp +..B1.191: + fldl 8+_zeros@GOTOFF(%ebx) + fdivl _zeros@GOTOFF(%ebx) + fstpt 64(%esp) + fldt 64(%esp) + movl 248(%esp), %eax + xorl %esp, %eax + cmpl %gs:20, %eax + jne ..B1.135 + jmp ..B1.25 +..B1.195: + xorl %esi, %esi + jmp ..B1.7 + .align 16,0x90 + .type tgammal,@function + .size tgammal,.-tgammal + .data +# -- End tgammal + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xdc,0x09,0xc0,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x02,0x40,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfc,0x3f,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xfe,0x3f,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.12: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,12 + .space 4, 0x00 # pad + .align 16 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_tgammal_S2: + .long 1076610156 + .long 1072298443 + .long 2174450924 + .long 1012377779 + .type _tgammal_S2,@object + .size _tgammal_S2,16 + .align 4 +_tgammal_S1: + .long 1649608659 + .long 3220853158 + .long 544854255 + .long 3162597952 + .type _tgammal_S1,@object + .size _tgammal_S1,16 + .align 4 +_tgammal_A2: + .long 1833415567 + .long 1073038586 + .long 2552883231 + .long 1018148522 + .long 1595568275 + .long 1072556376 + .long 458238143 + .long 1015211580 + .long 3568820252 + .long 1071968804 + .long 1244365593 + .long 1010337025 + .long 799339768 + .long 1070612333 + .long 3666663601 + .long 1014637144 + .long 2303274075 + .long 1069290379 + .long 1349342802 + .long 1013375288 + .long 3297989586 + .long 1067256475 + .long 254004781 + .long 1007721194 + .long 3884346469 + .long 1076314993 + .long 442477728 + .long 1020223370 + .long 318512670 + .long 1076897708 + .long 471158811 + .long 1020359281 + .long 2510778168 + .long 1076450444 + .long 1901825555 + .long 1020381374 + .long 1635478559 + .long 1075598710 + .long 824259222 + .long 1018719588 + .long 1081324001 + .long 1074338163 + .long 3447625061 + .long 1017363587 + .long 3947156014 + .long 1072861090 + .long 1379190805 + .long 1015115048 + .long 420607958 + .long 1081212458 + .long 3477976495 + .long 1025491940 + .long 3806068795 + .long 1082138936 + .long 4217379562 + .long 1025598832 + .long 3604563515 + .long 1082026571 + .long 2373575058 + .long 1026208390 + .long 2007420787 + .long 1081336307 + .long 1677630540 + .long 1025930127 + .long 1505609351 + .long 1080304853 + .long 3680187356 + .long 1024342399 + .long 1798798240 + .long 1079036631 + .long 724429118 + .long 1022004699 + .long 573661072 + .long 1087072564 + .long 1175535566 + .long 1031320119 + .long 3742832273 + .long 1088193077 + .long 2163102943 + .long 1030481607 + .long 1347160184 + .long 1088323961 + .long 872134502 + .long 1032553403 + .long 3527047012 + .long 1087786342 + .long 974187100 + .long 1028831099 + .long 1718309677 + .long 1086914107 + .long 744179587 + .long 1031128181 + .long 2775103229 + .long 1085724862 + .long 1153587355 + .long 1029745229 + .long 1670522313 + .long 1093749470 + .long 3603089619 + .long 1038783597 + .long 2795800948 + .long 1094969738 + .long 1113103030 + .long 1039749901 + .long 3483985892 + .long 1095195750 + .long 707212107 + .long 1037942235 + .long 3634938287 + .long 1094882573 + .long 3822913920 + .long 1039689416 + .long 1233016495 + .long 1094091821 + .long 3838048750 + .long 1037461559 + .long 817468048 + .long 1093018536 + .long 360059332 + .long 1037856380 + .long 3404619429 + .long 1101025312 + .long 2324006265 + .long 1046266629 + .long 1757595371 + .long 1102333247 + .long 3317464771 + .long 1041601336 + .long 2951620935 + .long 1102677785 + .long 2114793479 + .long 1046829217 + .long 1356962213 + .long 1102426961 + .long 3236647680 + .long 1046257529 + .long 378361594 + .long 1101790815 + .long 2326245451 + .long 1045004339 + .long 704627613 + .long 1100821691 + .long 771850637 + .long 1043974839 + .type _tgammal_A2,@object + .size _tgammal_A2,576 + .align 4 +_tgammal_A1: + .long 4294967295 + .long 1072693247 + .long 4294254158 + .long 1017118719 + .long 4235179544 + .long 3219290252 + .long 1647137719 + .long 3164508998 + .long 3258652024 + .long 1072670296 + .long 2787078119 + .long 1015928435 + .long 2402437986 + .long 3219982865 + .long 3119239167 + .long 3164440263 + .long 89167536 + .long 1072654929 + .long 3734368228 + .long 1015667286 + .long 3963139337 + .long 3220139136 + .long 2050876349 + .long 3162686202 + .long 2444554090 + .long 1072454648 + .long 2100370444 + .long 1016394631 + .long 2397397425 + .long 1067486888 + .long 3603318790 + .long 1011860326 + .long 3126988118 + .long 1071287373 + .long 3410508918 + .long 1015153675 + .long 480439205 + .long 3216734124 + .long 3426889025 + .long 3160197739 + .long 927904425 + .long 1069712317 + .long 1130465219 + .long 1014845612 + .long 4266680347 + .long 3216234636 + .long 1626218864 + .long 3161277677 + .long 0 + .long 1072693248 + .long 1528870101 + .long 964807786 + .long 119575502 + .long 3218804454 + .long 1881625935 + .long 3159804816 + .long 2341912255 + .long 1071274903 + .long 3500227044 + .long 1010193322 + .long 2554745004 + .long 3216302649 + .long 3304224511 + .long 3156439793 + .long 2968672914 + .long 1068696059 + .long 4206584367 + .long 1012030447 + .long 1090398824 + .long 1060208439 + .long 842313838 + .long 1004803849 + .long 4294967295 + .long 1072693247 + .long 4294967295 + .long 1017118719 + .long 4235179544 + .long 3219290252 + .long 4177388891 + .long 3164508998 + .long 3258652024 + .long 1072670296 + .long 1161858311 + .long 1015929131 + .long 2402437986 + .long 3219982865 + .long 3056812941 + .long 3164521903 + .long 89167541 + .long 1072654929 + .long 2427235615 + .long 1014999039 + .long 3963139706 + .long 3220139136 + .long 3024603167 + .long 3163626566 + .type _tgammal_A1,@object + .size _tgammal_A1,384 + .align 4 +_tgammal_B: + .long 381774871 + .long 3211182444 + .long 436314138 + .long 1061814688 + .long 327235604 + .long 3208872248 + .long 723058467 + .long 1061917982 + .long 3650698365 + .long 3210701488 + .long 440509466 + .long 1064976804 + .long 3406779288 + .long 3214819974 + .long 941491840 + .long 1070005910 + .type _tgammal_B,@object + .size _tgammal_B,64 + .align 4 +_tgammal_C: + .long 3362045620 + .long 1072523249 + .long 4064281872 + .long 1016386130 + .type _tgammal_C,@object + .size _tgammal_C,16 + .align 4 +_TWO_32HP: + .long 1048576 + .long 1106771968 + .type _TWO_32HP,@object + .size _TWO_32HP,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .type _small_value_80,@object + .size _small_value_80,24 + .align 2 +_POS_OVERFLOW: + .word 11809 + .word 27445 + .word 35846 + .word 56177 + .word 16393 + .word 0 + .type _POS_OVERFLOW,@object + .size _POS_OVERFLOW,12 + .align 2 +_tgammal_S: + .word 24210 + .word 1753 + .word 29241 + .word 50004 + .word 49148 + .word 0 + .word 51350 + .word 39166 + .word 743 + .word 54836 + .word 16377 + .word 0 + .word 3640 + .word 30975 + .word 46417 + .word 39360 + .word 49142 + .word 0 + .word 53672 + .word 10841 + .word 35989 + .word 39843 + .word 16370 + .word 0 + .word 36569 + .word 52859 + .word 829 + .word 59922 + .word 49133 + .word 0 + .word 48029 + .word 59092 + .word 17416 + .word 34773 + .word 16361 + .word 0 + .word 51219 + .word 52454 + .word 61951 + .word 62382 + .word 49123 + .word 0 + .type _tgammal_S,@object + .size _tgammal_S,84 + .align 2 +_tgammal_T2: + .word 46722 + .word 54455 + .word 58933 + .word 43588 + .word 16376 + .word 0 + .word 11656 + .word 9670 + .word 26887 + .word 53935 + .word 16373 + .word 0 + .word 37336 + .word 10857 + .word 59094 + .word 50631 + .word 16372 + .word 0 + .word 42778 + .word 63737 + .word 45056 + .word 33859 + .word 16365 + .word 0 + .word 26755 + .word 45167 + .word 18275 + .word 32926 + .word 16369 + .word 0 + .word 44721 + .word 19678 + .word 48085 + .word 54982 + .word 49134 + .word 0 + .word 51053 + .word 39319 + .word 36729 + .word 62310 + .word 16365 + .word 0 + .word 45874 + .word 5043 + .word 3955 + .word 43983 + .word 49132 + .word 0 + .word 10698 + .word 13153 + .word 62730 + .word 37178 + .word 16363 + .word 0 + .word 47802 + .word 34638 + .word 48577 + .word 58524 + .word 49129 + .word 0 + .word 5552 + .word 49084 + .word 18209 + .word 47263 + .word 16360 + .word 0 + .word 27946 + .word 40146 + .word 45659 + .word 36839 + .word 49127 + .word 0 + .word 43027 + .word 63179 + .word 35272 + .word 58163 + .word 16357 + .word 0 + .word 51497 + .word 52569 + .word 40730 + .word 59709 + .word 49124 + .word 0 + .word 50075 + .word 12939 + .word 25687 + .word 50566 + .word 16355 + .word 0 + .word 50229 + .word 1163 + .word 49491 + .word 48597 + .word 16381 + .word 0 + .word 65107 + .word 33673 + .word 57229 + .word 54934 + .word 16379 + .word 0 + .word 40234 + .word 4993 + .word 58268 + .word 55864 + .word 16377 + .word 0 + .word 37170 + .word 65173 + .word 7022 + .word 51747 + .word 16375 + .word 0 + .word 26509 + .word 26471 + .word 6311 + .word 44116 + .word 16373 + .word 0 + .word 19430 + .word 24800 + .word 9769 + .word 34884 + .word 16371 + .word 0 + .word 11267 + .word 5159 + .word 36913 + .word 51530 + .word 16368 + .word 0 + .word 64725 + .word 57237 + .word 10436 + .word 35732 + .word 16366 + .word 0 + .word 9979 + .word 17874 + .word 14609 + .word 46771 + .word 16363 + .word 0 + .word 48661 + .word 14142 + .word 37902 + .word 57970 + .word 16360 + .word 0 + .word 44331 + .word 229 + .word 33140 + .word 34177 + .word 16358 + .word 0 + .word 18505 + .word 49699 + .word 39129 + .word 38384 + .word 16355 + .word 0 + .word 55009 + .word 45387 + .word 16863 + .word 41316 + .word 16352 + .word 0 + .word 32472 + .word 62749 + .word 3488 + .word 43302 + .word 16349 + .word 0 + .word 38507 + .word 49300 + .word 64329 + .word 42149 + .word 16346 + .word 0 + .word 54685 + .word 59022 + .word 19355 + .word 48977 + .word 16387 + .word 0 + .word 11322 + .word 9818 + .word 14110 + .word 61121 + .word 16385 + .word 0 + .word 35672 + .word 18289 + .word 56841 + .word 34043 + .word 16384 + .word 0 + .word 40623 + .word 27826 + .word 27872 + .word 34330 + .word 16382 + .word 0 + .word 23588 + .word 8736 + .word 44949 + .word 63368 + .word 16379 + .word 0 + .word 65458 + .word 32180 + .word 45318 + .word 53999 + .word 16377 + .word 0 + .word 7083 + .word 36157 + .word 35044 + .word 42795 + .word 16375 + .word 0 + .word 41937 + .word 53706 + .word 63704 + .word 63466 + .word 16372 + .word 0 + .word 56782 + .word 14002 + .word 58756 + .word 44258 + .word 16370 + .word 0 + .word 50000 + .word 929 + .word 21531 + .word 58307 + .word 16367 + .word 0 + .word 29164 + .word 41738 + .word 63210 + .word 36416 + .word 16365 + .word 0 + .word 22318 + .word 7527 + .word 19550 + .word 43267 + .word 16362 + .word 0 + .word 36459 + .word 32677 + .word 20918 + .word 49089 + .word 16359 + .word 0 + .word 54142 + .word 37469 + .word 39035 + .word 54353 + .word 16356 + .word 0 + .word 43987 + .word 37066 + .word 46591 + .word 55009 + .word 16353 + .word 0 + .word 23593 + .word 355 + .word 54000 + .word 36277 + .word 16394 + .word 0 + .word 38981 + .word 26613 + .word 65277 + .word 49004 + .word 16392 + .word 0 + .word 37709 + .word 48898 + .word 35761 + .word 58794 + .word 16390 + .word 0 + .word 20062 + .word 54760 + .word 43546 + .word 63578 + .word 16388 + .word 0 + .word 4376 + .word 65424 + .word 42405 + .word 62684 + .word 16386 + .word 0 + .word 53174 + .word 32360 + .word 45557 + .word 56872 + .word 16384 + .word 0 + .word 50961 + .word 21643 + .word 2055 + .word 47845 + .word 16382 + .word 0 + .word 44504 + .word 53228 + .word 208 + .word 37559 + .word 16380 + .word 0 + .word 22458 + .word 24129 + .word 6745 + .word 55322 + .word 16377 + .word 0 + .word 45571 + .word 12909 + .word 9586 + .word 38400 + .word 16375 + .word 0 + .word 63967 + .word 2945 + .word 37284 + .word 50443 + .word 16372 + .word 0 + .word 40100 + .word 52281 + .word 37909 + .word 62907 + .word 16369 + .word 0 + .word 14124 + .word 37910 + .word 18802 + .word 37402 + .word 16367 + .word 0 + .word 28370 + .word 35717 + .word 42940 + .word 43396 + .word 16364 + .word 0 + .word 57898 + .word 23307 + .word 6391 + .word 45620 + .word 16361 + .word 0 + .word 46932 + .word 12112 + .word 28768 + .word 37645 + .word 16401 + .word 0 + .word 4289 + .word 37433 + .word 59606 + .word 54245 + .word 16399 + .word 0 + .word 64482 + .word 38480 + .word 36982 + .word 34595 + .word 16398 + .word 0 + .word 60245 + .word 51970 + .word 24673 + .word 39653 + .word 16396 + .word 0 + .word 5116 + .word 50868 + .word 49618 + .word 41328 + .word 16394 + .word 0 + .word 41766 + .word 46400 + .word 3930 + .word 39543 + .word 16392 + .word 0 + .word 10780 + .word 29057 + .word 64174 + .word 35004 + .word 16390 + .word 0 + .word 53671 + .word 48824 + .word 23962 + .word 57716 + .word 16387 + .word 0 + .word 53678 + .word 31584 + .word 52783 + .word 44557 + .word 16385 + .word 0 + .word 6190 + .word 44351 + .word 42084 + .word 64733 + .word 16382 + .word 0 + .word 38744 + .word 53501 + .word 23462 + .word 44426 + .word 16380 + .word 0 + .word 5624 + .word 56691 + .word 10270 + .word 57805 + .word 16377 + .word 0 + .word 37833 + .word 48670 + .word 48257 + .word 35818 + .word 16375 + .word 0 + .word 2793 + .word 44149 + .word 23652 + .word 43316 + .word 16372 + .word 0 + .word 36532 + .word 60099 + .word 3358 + .word 47101 + .word 16369 + .word 0 + .word 26210 + .word 6795 + .word 18267 + .word 52540 + .word 16408 + .word 0 + .word 4852 + .word 29729 + .word 14912 + .word 39944 + .word 16407 + .word 0 + .word 5407 + .word 41984 + .word 60375 + .word 53635 + .word 16405 + .word 0 + .word 50093 + .word 12566 + .word 13387 + .word 64582 + .word 16403 + .word 0 + .word 49147 + .word 13632 + .word 405 + .word 35287 + .word 16402 + .word 0 + .word 19308 + .word 51191 + .word 49444 + .word 35336 + .word 16400 + .word 0 + .word 42358 + .word 64331 + .word 14656 + .word 65374 + .word 16397 + .word 0 + .word 20975 + .word 39047 + .word 28983 + .word 56232 + .word 16395 + .word 0 + .word 29936 + .word 14466 + .word 41903 + .word 45232 + .word 16393 + .word 0 + .word 29960 + .word 52783 + .word 56228 + .word 34190 + .word 16391 + .word 0 + .word 35121 + .word 10599 + .word 28021 + .word 48776 + .word 16388 + .word 0 + .word 24922 + .word 26565 + .word 63850 + .word 32942 + .word 16386 + .word 0 + .word 35914 + .word 31178 + .word 25984 + .word 42348 + .word 16383 + .word 0 + .word 32787 + .word 34531 + .word 38943 + .word 53136 + .word 16380 + .word 0 + .word 12957 + .word 55078 + .word 57592 + .word 59546 + .word 16377 + .word 0 + .type _tgammal_T2,@object + .size _tgammal_T2,1080 + .align 2 +_tgammal_T1: + .word 33333 + .word 22332 + .word 1335 + .word 65087 + .word 16382 + .word 0 + .word 47908 + .word 35098 + .word 63659 + .word 65273 + .word 49150 + .word 0 + .word 46380 + .word 12569 + .word 56008 + .word 65411 + .word 16382 + .word 0 + .word 48850 + .word 62280 + .word 7688 + .word 65472 + .word 49150 + .word 0 + .word 39250 + .word 51171 + .word 14264 + .word 65504 + .word 16382 + .word 0 + .word 1152 + .word 29364 + .word 36762 + .word 65519 + .word 49150 + .word 0 + .word 3017 + .word 25231 + .word 24799 + .word 65523 + .word 16382 + .word 0 + .word 25322 + .word 65334 + .word 59366 + .word 65496 + .word 49150 + .word 0 + .word 56776 + .word 58800 + .word 13007 + .word 65323 + .word 16382 + .word 0 + .word 19307 + .word 43631 + .word 60167 + .word 64530 + .word 49150 + .word 0 + .word 36275 + .word 49480 + .word 28369 + .word 61762 + .word 16382 + .word 0 + .word 21913 + .word 46254 + .word 26555 + .word 54444 + .word 49150 + .word 0 + .word 35908 + .word 6208 + .word 45367 + .word 40294 + .word 16382 + .word 0 + .word 27036 + .word 5944 + .word 26542 + .word 42848 + .word 49149 + .word 0 + .word 29582 + .word 26316 + .word 64938 + .word 47331 + .word 16379 + .word 0 + .word 2023 + .word 42870 + .word 23457 + .word 61457 + .word 16378 + .word 0 + .word 65015 + .word 19522 + .word 60134 + .word 39847 + .word 49146 + .word 0 + .word 37347 + .word 35810 + .word 25431 + .word 54185 + .word 16377 + .word 0 + .word 59586 + .word 38885 + .word 5307 + .word 36118 + .word 49145 + .word 0 + .word 55581 + .word 26604 + .word 61099 + .word 48328 + .word 16376 + .word 0 + .word 26530 + .word 8530 + .word 11497 + .word 64510 + .word 49143 + .word 0 + .word 5884 + .word 49309 + .word 23213 + .word 43047 + .word 16375 + .word 0 + .word 39008 + .word 7698 + .word 42498 + .word 57424 + .word 49142 + .word 0 + .word 52706 + .word 42552 + .word 1743 + .word 38295 + .word 16374 + .word 0 + .word 36375 + .word 51085 + .word 41378 + .word 51088 + .word 49141 + .word 0 + .word 45665 + .word 51480 + .word 46902 + .word 34067 + .word 16373 + .word 0 + .word 45474 + .word 25613 + .word 9050 + .word 44941 + .word 49140 + .word 0 + .word 10137 + .word 18971 + .word 38654 + .word 59779 + .word 16371 + .word 0 + .word 53562 + .word 56969 + .word 3619 + .word 46768 + .word 49139 + .word 0 + .word 12931 + .word 40754 + .word 53864 + .word 63282 + .word 16370 + .word 0 + .word 16582 + .word 62753 + .word 30052 + .word 46783 + .word 16376 + .word 0 + .word 41763 + .word 18743 + .word 29826 + .word 47859 + .word 16374 + .word 0 + .word 61445 + .word 12179 + .word 9444 + .word 35298 + .word 16374 + .word 0 + .word 19195 + .word 47291 + .word 36415 + .word 61711 + .word 16372 + .word 0 + .word 13845 + .word 40089 + .word 27018 + .word 32909 + .word 16372 + .word 0 + .word 12017 + .word 58217 + .word 13416 + .word 64677 + .word 16370 + .word 0 + .word 35895 + .word 43222 + .word 31657 + .word 65323 + .word 16369 + .word 0 + .word 20613 + .word 26232 + .word 50069 + .word 65270 + .word 16368 + .word 0 + .word 35252 + .word 65344 + .word 3340 + .word 65456 + .word 16367 + .word 0 + .word 10600 + .word 13283 + .word 40541 + .word 64928 + .word 16366 + .word 0 + .word 11880 + .word 32674 + .word 50280 + .word 34435 + .word 16366 + .word 0 + .word 63446 + .word 286 + .word 54268 + .word 48349 + .word 16364 + .word 0 + .word 8548 + .word 23982 + .word 1825 + .word 63713 + .word 16364 + .word 0 + .word 34666 + .word 29375 + .word 64038 + .word 41244 + .word 49131 + .word 0 + .word 59811 + .word 4152 + .word 44775 + .word 65267 + .word 16363 + .word 0 + .word 18717 + .word 22920 + .word 1335 + .word 65087 + .word 16382 + .word 0 + .word 45811 + .word 56269 + .word 63659 + .word 65273 + .word 49150 + .word 0 + .word 65298 + .word 48931 + .word 56016 + .word 65411 + .word 16382 + .word 0 + .word 32491 + .word 12018 + .word 7860 + .word 65472 + .word 49150 + .word 0 + .word 14368 + .word 44485 + .word 16906 + .word 65504 + .word 16382 + .word 0 + .word 41970 + .word 59715 + .word 3074 + .word 65520 + .word 49150 + .word 0 + .word 4801 + .word 21592 + .word 65211 + .word 65527 + .word 16382 + .word 0 + .word 62592 + .word 41973 + .word 39337 + .word 65531 + .word 49150 + .word 0 + .word 13381 + .word 40677 + .word 15011 + .word 65529 + .word 16382 + .word 0 + .word 46580 + .word 36519 + .word 54875 + .word 65490 + .word 49150 + .word 0 + .word 37477 + .word 29387 + .word 41414 + .word 65216 + .word 16382 + .word 0 + .word 16797 + .word 56146 + .word 15453 + .word 63766 + .word 49150 + .word 0 + .word 40859 + .word 15091 + .word 60713 + .word 58161 + .word 16382 + .word 0 + .word 1004 + .word 12255 + .word 49061 + .word 43226 + .word 49150 + .word 0 + .word 52096 + .word 41479 + .word 59455 + .word 37399 + .word 16381 + .word 0 + .type _tgammal_T1,@object + .size _tgammal_T1,720 + .align 2 +_tgammal_B0: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16379 + .word 0 + .type _tgammal_B0,@object + .size _tgammal_B0,12 + .align 2 +_TWO_POW_16383: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .type _TWO_POW_16383,@object + .size _TWO_POW_16383,12 + .align 2 +_TWO_POW_M16382: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .type _TWO_POW_M16382,@object + .size _TWO_POW_M16382,12 + .align 2 +_TWO_POW_M16000: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 383 + .word 0 + .type _TWO_POW_M16000,@object + .size _TWO_POW_M16000,12 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .type _large_value_80,@object + .size _large_value_80,24 + .data + .hidden __libm_expl_k80 + .hidden __libm_logl_k80 + .hidden fesetround + .hidden fegetround + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/trig_pi_bits.S b/external/sgx_libm/ia32/trig_pi_bits.S new file mode 100644 index 0000000000..380eaacb6c --- /dev/null +++ b/external/sgx_libm/ia32/trig_pi_bits.S @@ -0,0 +1,311 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "trig_pi_bits.c" + .section .rodata, "a" + .align 32 + .align 32 + .hidden __four_over_pi + .globl __four_over_pi +__four_over_pi: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0xdb939105,0x0028be60 + .long 0xf47d4d37,0x4a7f09d5 + .long 0x664f10e4,0x7036d8a5 + .long 0xeaf7aef1,0x107f9458 + .long 0x8e909374,0x586dc91b + .long 0xba827464,0xb801924b + .long 0xc72c4a69,0x873f877a + .long 0x7d4baed1,0xcfba208d + .long 0x09ad17df,0x213a671c + .long 0x8e60d4ce,0x904e6475 + .long 0xe2ef7e4a,0x7d272117 + .long 0xfff78166,0x0ec7fe25 + .long 0x62d6829b,0x03fbcbc4 + .long 0xb3c9f2c2,0x47db4d9f + .long 0xd9a797fa,0x6dd3d18f + .long 0xb1faf97c,0x8b5d49ee + .long 0x7de294a4,0x5ecf41ce + .long 0xec47e357,0xba9afed7 + .long 0x11bf1eda,0x421580cc + .long 0x0826bd0d,0xeafc33ef + .long 0x5857b986,0x876a78e4 + .long 0x57c5281a,0xc2196661 + .long 0x20135cc9,0x10237ff6 + .long 0x55b29cea,0xcc418185 + .long 0xf0231ad1,0x3258389e + .long 0xf3773a02,0xf10670d9 + .long 0x1da2e587,0x4aa0d671 + .long 0x3455c641,0x29b76bd1 + .long 0xc14fdf8c,0x4fa97fc1 + .long 0x93e60c9f,0xfa0cb0b7 + .long 0xbbdac797,0x6ef0cf49 + .long 0xcd72bc9f,0xbe27ce87 + .long 0x641f1f09,0xc761fc48 + .long 0x5dcb4c10,0x1abe9bb5 + .long 0x2d674670,0xcec57185 + .long 0x534b1740,0xf0b12b50 + .long 0x8b5c78e6,0x03119f61 + .long 0x8cdf34ad,0xb1a6c018 + .long 0x554dfd8f,0x25e9ed35 + .long 0xff1d934a,0xb5c60428 + .long 0xdc3e1f18,0xa7592af5 + .long 0xc545d592,0xd5ec1eb9 + .long 0xce2129f2,0x7036758e + .long 0xb588d516,0xc8c91de2 + .long 0xc2bc77f3,0xae47c006 + .long 0xda879998,0x867fcc67 + .long 0xeb361fdf,0x55e651fe + .long 0x7a0c982f,0xadd948a2 + .long 0xc24d9b35,0xf9b3713b + .long 0x85b78ed6,0x0fd775f7 + .long 0x08b4ba21,0x24a6f78a + .long 0x8cb2b185,0x8a135638 + .long 0x78143005,0xb8c232df + .long 0xf8060d04,0xe9c77cd6 + .long 0xc05220d6,0xcb9884a0 + .long 0x2b7cba47,0xe3bd5fec + .long 0xd9c43637,0x90d29234 + .long 0xb3985aa9,0x6a9097eb + .long 0x74fca981,0x0a02ad26 + .long 0xf0a8e20f,0x9fddd720 + .long 0x96a32bef,0x185e1ce2 + .long 0x8b72effd,0x75dbd8e9 + .long 0xf0499172,0x3be06359 + .long 0xb4aa0a23,0x954db672 + .long 0x44850981,0x58709df2 + .long 0x16711131,0x26d184b1 + .long 0x7cc5c02b,0x72246c93 + .long 0x4a44357f,0x50f53952 + .long 0x2507bbb3,0x7f2f8033 + .long 0xe03c7b30,0x9c3d4f84 + .long 0x31e50164,0xf9ecca3e + .long 0xc24bbcd1,0xcf9c706c + .long 0x1ec82ae7,0x42e704a2 + .long 0x91cbcc9e,0xed4bb0a4 + .long 0x29dc87f9,0xdb554324 + .long 0x52859e78,0xdae5b2cc + .long 0xfd25e53a,0x9e506277 + .long 0xcc665afb,0x2139b8a5 + .long 0xc3bf6eed,0x620d97d7 + .long 0x19d09c9c,0x26921b29 + .long 0x0567c279,0x4c97636e + .long 0x4e5d3dc7,0x6f094c63 + .long 0x035a0212,0x014c0043 + .long 0x2a91c0b9,0xd63b8b24 + .long 0x699f7ddc,0xdd0935af + .long 0xa7e9a523,0x921bbbc5 + .long 0x54f47c82,0xbda46d14 + .long 0x1f92fd5a,0xb3cce608 + .long 0xb740d750,0x18ec97cf + .long 0x54957019,0x1fe2614a + .long 0x4c920c9d,0x0dc4361b + .long 0x539b9511,0x5316f51c + .long 0x7d4ab559,0x704242da + .long 0xd4011776,0x852741c9 + .long 0xba85fe61,0xceed315d + .long 0x89c74a5a,0xdf5ad26e + .long 0x95052b5a,0x65ab3331 + .long 0x62141c8b,0xb8a42276 + .long 0x01dddc0c,0x2fa90125 + .long 0x2a1c7a92,0x3cc9ff00 + .long 0x1920f765,0x70998f78 + .long 0x6510e321,0xe5cfe8ff + .long 0x674e64a3,0x8377904c + .long 0xc5cef7c2,0x1c3779ed + .long 0x201724e0,0x0acdc568 + .long 0x363a03eb,0x16a48444 + .long 0xf6c3e40e,0xe01b12ff + .long 0x6958aef2,0x1d861645 + .long 0xef500401,0xd86e6271 + .long 0x527dadba,0x3cb489dd + .long 0x85028bc9,0xeec8b6ea + .long 0x0ccec246,0xa25da0d9 + .long 0x9470a8c7,0xa503aa8e + .long 0x89971370,0x6bbb6bc4 + .long 0x65d5b020,0x9b671e8b + .long 0x0263100a,0xcfc0fdbc + .long 0xed0e4548,0xe64c5b41 + .long 0x3124bd52,0x0316f0f6 + .long 0x93b34de9,0xeb71a972 + .long 0x24aada10,0xcdaa79a5 + .long 0x7be31d94,0xb77798c6 + .long 0xff2ae86b,0xa2da0df6 + .long 0x6b8036be,0x8c4577e8 + .long 0x2dc17b4c,0xc3199359 + .long 0x95cebfd1,0x194a6fd5 + .long 0xef9d77e4,0xee7e5abc + .long 0xfda31985,0xca0c202a + .long 0xbe877936,0x72c10188 + .long 0xc6d5c273,0x692ccf63 + .long 0xa92f84ed,0x4dba5093 + .long 0xbc2a1953,0x48ccc6aa + .long 0xcfc2f35e,0xe9707483 + .long 0xc122dedc,0x16ddbe48 + .long 0xb1b89b9b,0x85e254e9 + .long 0x12a6edf6,0xc03afbd6 + .long 0xb3f3dd87,0xb12e99aa + .long 0x6c706663,0x40b44b7c + .long 0x9221a817,0x1deb70f6 + .long 0x8bfc2b26,0x7dfd2031 + .long 0x0fdb77b4,0xbb376f17 + .long 0xb6ca8e89,0x07f1e42d + .long 0x24d4eb41,0x68e6abc0 + .long 0x4a5fa012,0x15edad0b + .long 0xaa9da856,0xe9c1f683 + .long 0x8b6df73f,0x5eca8485 + .long 0xe27f6fa2,0x797ebfb6 + .long 0x2a419c20,0x5b1db93f + .long 0x7fe1ff41,0x0f855ba1 + .long 0xd861860a,0xcf8a0cd9 + .long 0xf9ecdb9b,0xbaaf536b + .long 0x56efcc52,0x63ce59e5 + .long 0xcc10cb71,0x35e105b7 + .long 0x9c326e32,0xcd584973 + .long 0xe8802939,0xcc3f5b2f + .long 0x5691dbc8,0x1b016837 + .long 0x172e5258,0x748498a1 + .long 0xc054a64d,0x5c38159a + .long 0x47b13c4c,0xd5542df5 + .long 0x0c176a4b,0xd7db84f9 + .long 0x4d8ca869,0xa170ec87 + .long 0x7a887dc5,0x2dc2352c + .long 0xffc9e000,0xb91a63dd + .long 0x683353e6,0xc30b5023 + .long 0xacc2974b,0x694834e8 + .long 0xf684742f,0xd0be6d32 + .long 0xef45eae0,0x9f7076e6 + .long 0x8205d54b,0x68b2971a + .long 0x051fe181,0x954009fc + .long 0x235065b7,0xf85902c5 + .long 0x76ad895a,0xafa1cabf + .long 0xbcc167af,0xcd225eff + .long 0x2a0a9296,0xee53da9a + .long 0x0b6616b5,0xb113ef3e + .long 0x5343698e,0xe571fd23 + .long 0x2c4fc525,0x8817d5e9 + .long 0x3321b75c,0x4e200048 + .long 0x582fc459,0x6db7b27d + .long 0x6b2c2334,0x535ac1c0 + .long 0x5443bec7,0x302c9215 + .long 0xc1a8cd50,0xb0dca54e + .long 0xb311783e,0x301ef701 + .long 0xb5907cfa,0x8a53b232 + .long 0x1926cc6f,0x37991f36 + .long 0x35161df1,0xb670e5e9 + .long 0xbc0f0eae,0x78da44f6 + .long 0xdd557d6f,0x91861197 + .long 0x974bab3b,0x74b1a49b + .long 0x8721f118,0x5103908f + .long 0xf5b9f29f,0x7a7f4a7c + .long 0xf1780223,0x088d645b + .long 0x9bb1bf6c,0x75fff89a + .long 0x175f2cab,0x304224dd + .long 0x5edc8f9a,0x5ae75bb3 + .long 0xfdf7dcca,0x8471aa73 + .long 0x402dc36c,0x6eb26d54 + .long 0x181f7962,0xb8892e9d + .long 0x43430620,0xb61d0b05 + .long 0x8a405d9e,0x65199f85 + .long 0x7bd1558d,0xa7efbf7f + .long 0x7b2e6ea2,0x9fb644f6 + .long 0xea0c70db,0xff25f109 + .long 0x15aa362d,0xbc4db165 + .long 0x33cb6244,0x6a2d03b3 + .long 0x558b38f3,0x8d15dbe2 + .long 0xaa979ae7,0xa66e4835 + .long 0xc45282ff,0x0a8fb317 + .long 0x4ee38b21,0x7efd385b + .long 0x6a6d3f34,0xb8a1353a + .long 0x4b984e4b,0x7bbbf24d + .long 0x3646c2bf,0xd1084e32 + .long 0xf6070be1,0x205a92be + .long 0x53b30895,0x2d14e326 + .long 0xb1b02586,0x37154ab5 + .long 0x99255a58,0x42ee1c06 + .long 0x8fc3c45f,0x1689bb94 + .long 0x72ff0b6f,0xc46d7d3d + .long 0x33177a18,0x0d3baf0d + .long 0x99fbcce4,0x17b766e3 + .long 0xd6186f15,0xae05f266 + .long 0x440fb612,0xf871a0d4 + .long 0x0b68462b,0x1c777747 + .long 0xfcd6661e,0xd18b0875 + .long 0xbea193ff,0xb6701527 + .long 0x794d88a2,0x0195ab9e + .long 0x24d9eaba,0x48ab4e37 + .long 0xa6f9f2a9,0x154e09a0 + .long 0xe643b5ea,0x03546c4c + .long 0x2c9969e2,0x52015a7c + .long 0x0db47e6c,0x1fe5d322 + .long 0x9ec873e6,0xe48852a0 + .long 0x51f70e9d,0x3727d015 + .long 0xf7e77f97,0x3850bad9 + .long 0xdedeab2e,0xf517a919 + .long 0xe20ad56e,0xa8bd9548 + .long 0x618a8860,0x90421b96 + .long 0xe27527b9,0xd1ce79b8 + .long 0x55bff283,0x503ed27a + .long 0x4afea531,0xc7229671 + .long 0x43eb96b6,0x7074f3f1 + .long 0x90e14ee1,0xe1b151d8 + .long 0x21d8441e,0x88651e4b + .long 0x2004afd0,0xd30a868b + .long 0x4f1e3931,0xe409a222 + .long 0x708eb13a,0x2a1ef6f9 + .long 0xfdefe483,0xbd09a299 + .long 0x64cf42df,0x4ae8d96c + .long 0x18f749f7,0x2f771469 + .long 0x26a54a6a,0x785a4665 + .long 0x3b424827,0x0a339a2d + .long 0x98e09c08,0xd132a613 + .long 0x43e3bd69,0xdf1f8cae + .long 0x3c484aa7,0xf9d58502 + .long 0xd446696a,0x6d535f9b + .long 0xe0987765,0xfe6d75b7 + .long 0xceb12868,0x808d85a7 + .long 0x9ea34e6a,0xa0db7b5c + .long 0x9ad6c9d1,0x6e20970c + .long 0xc034957d,0xbb4d001d + .long 0x601c7838,0x3f135640 + .long 0x7cd92a3c,0x4fe26ca5 + .long 0x3f133aac,0x6ba9d2ce + .type __four_over_pi,@object + .size __four_over_pi,2104 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/trunc_wmt.S b/external/sgx_libm/ia32/trunc_wmt.S new file mode 100644 index 0000000000..b239f42b52 --- /dev/null +++ b/external/sgx_libm/ia32/trunc_wmt.S @@ -0,0 +1,130 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "trunc_wmt.c" + .text +..TXTST0: +# -- Begin static_func + .text + .align 16,0x90 +static_func: +..B1.1: +..L1: + + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + lea static_const_table@GOTOFF(%eax), %eax + ret + .align 16,0x90 + .type static_func,@function + .size static_func,.-static_func + .data +# -- End static_func + .text +# -- Begin trunc + .text + .align 16,0x90 + .globl trunc +trunc: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + +..B2.2: + pushl %ebp + movl %esp, %ebp + subl $104, %esp + movl %ebx, 40(%esp) + call static_func + movl %eax, %ebx + movsd 112(%esp), %xmm0 + movq (%ebx), %xmm2 + movdqa %xmm0, %xmm1 + psrlq $52, %xmm1 + movq 8(%ebx), %xmm3 + movd %xmm1, %eax + andl $2047, %eax + subl $1023, %eax + js .L_2TAG_PACKET_0.0.2 + cmpl $52, %eax + jae .L_2TAG_PACKET_1.0.2 + pand %xmm3, %xmm1 + psubd %xmm1, %xmm2 + psrlq %xmm2, %xmm0 + psllq %xmm2, %xmm0 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_0.0.2: + movsd 112(%esp), %xmm0 + movq 16(%ebx), %xmm1 + pand %xmm1, %xmm0 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_1.0.2: + fldl 112(%esp) + fld1 + fxch %st(1) + fmulp %st, %st(1) + jmp .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_2.0.2: + movsd %xmm0, 24(%esp) + fldl 24(%esp) +.L_2TAG_PACKET_3.0.2: + movl 40(%esp), %ebx + movl %ebp, %esp + popl %ebp + ret +..B2.3: + .align 16,0x90 + .type trunc,@function + .size trunc,.-trunc + .data +# -- End trunc + .section .rodata, "a" + .align 16 + .align 16 +static_const_table: + .long 1075 + .long 0 + .long 2047 + .long 0 + .long 0 + .long 2147483648 + .type static_const_table,@object + .size static_const_table,24 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/truncf.S b/external/sgx_libm/ia32/truncf.S new file mode 100644 index 0000000000..69e5b3da83 --- /dev/null +++ b/external/sgx_libm/ia32/truncf.S @@ -0,0 +1,84 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "truncf.c" + .text +..TXTST0: +# -- Begin truncf + .text + .align 16,0x90 + .globl truncf +truncf: +# parameter 1: 4 + %esp +..B1.1: +..L1: + + movl 4(%esp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + addl $-1065353216, %ecx + cmpl $192937984, %ecx + jb ..B1.5 +..B1.2: + testl %ecx, %ecx + jl ..B1.6 +..B1.3: + flds 4(%esp) +..B1.4: + ret +..B1.5: + shrl $23, %ecx + movl $-1, %edx + negl %ecx + addl $23, %ecx + shll %cl, %edx + andl %edx, %eax + movl %eax, 4(%esp) + flds 4(%esp) + ret +..B1.6: + andl $-2147483648, %eax + movl %eax, 4(%esp) + flds 4(%esp) + ret + .align 16,0x90 + .type truncf,@function + .size truncf,.-truncf + .data +# -- End truncf + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/truncl.S b/external/sgx_libm/ia32/truncl.S new file mode 100644 index 0000000000..54f1c680ca --- /dev/null +++ b/external/sgx_libm/ia32/truncl.S @@ -0,0 +1,171 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "truncl.c" + .text +..TXTST0: +# -- Begin truncl + .text + .align 16,0x90 + .globl truncl +truncl: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-16, %esp + subl $32, %esp +..B1.2: + fnstcw 22(%esp) +..B1.3: + movzwl 16(%ebp), %ecx + andl $32767, %ecx + call ..L2 +..L2: + popl %eax + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%eax), %eax + cmpl $16446, %ecx + jge ..B1.14 +..B1.4: + cmpl $16383, %ecx + jl ..B1.9 +..B1.5: + cmpl $16415, %ecx + jge ..B1.7 +..B1.6: + negl %ecx + addl $30, %ecx + movl 12(%ebp), %eax + shrl %cl, %eax + shll %cl, %eax + movl %eax, 12(%ebp) + xorl %eax, %eax + jmp ..B1.8 +..B1.7: + negl %ecx + addl $30, %ecx + movl 8(%ebp), %eax + shrl %cl, %eax + shll %cl, %eax +..B1.8: + movl %eax, 8(%ebp) + fldt 8(%ebp) + movl %ebp, %esp + popl %ebp + ret +..B1.9: + testl %ecx, %ecx + jne ..B1.13 +..B1.10: + cmpl $0, 12(%ebp) + jne ..B1.12 +..B1.11: + cmpl $0, 8(%ebp) + je ..B1.13 +..B1.12: + fldl _smallest_value_64@GOTOFF(%eax) + fstpl (%esp) +..B1.13: + movzbl 17(%ebp), %edx + andl $128, %edx + shrl $7, %edx + fldl _zeros@GOTOFF(%eax,%edx,8) + movl %ebp, %esp + popl %ebp + ret +..B1.14: + movzwl 22(%esp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.15: + orl $-64768, %ecx + movw %cx, 20(%esp) +..B1.16: + fldcw 20(%esp) +..B1.17: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt 8(%esp) +..B1.18: + fldcw 22(%esp) +..B1.19: + fldt 8(%esp) + movl %ebp, %esp + popl %ebp + ret +..B1.20: + fldt 8(%ebp) + fmull _ones@GOTOFF(%eax) + fstpt 8(%esp) + jmp ..B1.19 + .align 16,0x90 + .type truncl,@function + .size truncl,.-truncl + .data +# -- End truncl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/y0.S b/external/sgx_libm/ia32/y0.S new file mode 100644 index 0000000000..168c36b27d --- /dev/null +++ b/external/sgx_libm/ia32/y0.S @@ -0,0 +1,3324 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y0.c" + .text +..TXTST0: +# -- Begin y0 + .text + .align 16,0x90 + .globl y0 +y0: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + subl $56, %esp +..B1.2: + fnstcw 14(%esp) +..B1.3: + movl 12(%ebp), %edx + movl %edx, %esi + andl $2147483647, %esi + call ..L2 +..L2: + popl %edi + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%edi), %edi + cmpl $2146435072, %esi + jge ..B1.13 +..B1.4: + xorl %eax, %eax + movl 8(%ebp), %ecx + subl %eax, %edx + jl ..B1.20 +..B1.26: + orl %ecx, %edx + je ..B1.20 +..B1.5: + movzwl 14(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.19 +..B1.6: + orl $-64768, %edx + movw %dx, 12(%esp) +..B1.7: + fldcw 12(%esp) +..B1.8: + movl $1, %esi +..B1.9: + fldl 8(%ebp) + addl $-16, %esp + fstpt (%esp) + call __y0l. +..B1.27: + fstpt 16(%esp) + addl $16, %esp +..B1.10: + testl %esi, %esi + je ..B1.12 +..B1.11: + fldcw 14(%esp) +..B1.12: + fldt (%esp) + addl $56, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.13: + andl $-2146435073, %esi + orl 8(%ebp), %esi + jne ..B1.18 +..B1.14: + fldl _zeros@GOTOFF(%edi) + testl $-2147483648, %edx + je ..B1.17 +..B1.16: + fldl _infs@GOTOFF(%edi) + fmulp %st, %st(1) +..B1.17: + addl $56, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.18: + fldl 8(%ebp) + addl $56, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.19: + xorl %esi, %esi + jmp ..B1.9 +..B1.20: + fldl _zeros@GOTOFF(%edi) + orl %ecx, %esi + je ..B1.22 +..B1.21: + fldl _infs@GOTOFF(%edi) + fmulp %st, %st(1) + addl $56, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.22: + fldl 8+_ones@GOTOFF(%edi) + fdivp %st, %st(1) +..B1.23: + addl $56, %esp + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type y0,@function + .size y0,.-y0 + .data +# -- End y0 + .text +# -- Begin __y0l + .text + .align 16,0x90 + .hidden __y0l + .globl __y0l +__y0l: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + + .hidden __y0l. + .globl __y0l. +__y0l.: + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $120, %esp + fldt 8(%ebp) + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + fldt 132+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B2.22 +..B2.2: + fldt _val_0_6L@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B2.20 +..B2.3: + fldt _val_1_2L@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.5 +..B2.4: + fstp %st(0) + fldt _Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P11@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P11@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt _Q11@GOTOFF(%ebx) + fmul %st(4), %st + fldt 12+_Q11@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 72+_P11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 84+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 108+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_Q11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 120+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 132+_P11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 144+_P11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 156+_P11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 36+_Q11@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 168+_P11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fxch %st(1) + fdivrl _ones@GOTOFF(%ebx) + fldt 180+_P11@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fldt 192+_P11@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 204+_P11@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B2.27 +..B2.5: + fldt _S@GOTOFF(%ebx) + fcomp %st(2) + fnstsw %ax + sahf + jbe ..B2.7 +..B2.6: + fldt _P12@GOTOFF(%ebx) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fstpt 92(%esp) + fldt 92(%esp) + fldt 12+_P12@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 36+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 48+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 60+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 72+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 84+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 96+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 108+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 120+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 132+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 156+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 180+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 192+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 204+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 216+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 228+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 240+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 252+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 264+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 276+_P12@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 288+_P12@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt 300+_P12@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 312+_P12@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.7: + fstp %st(0) + fldt _val_3_0L@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.9 +..B2.8: + fldt 24+_P20@GOTOFF(%ebx) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P20@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(2) + fmul %st, %st(1) + fldt 12+_P20@GOTOFF(%ebx) + fmul %st(1), %st + fldt 36+_P20@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48+_P20@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 60+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 72+_P20@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 84+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 96+_P20@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 108+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 120+_P20@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 132+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_P20@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 156+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_P20@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 180+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt 192+_P20@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 204+_P20@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.9: + fstp %st(0) + fldt _val_3_875L@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B2.11 +..B2.10: + fldt _P21@GOTOFF(%ebx) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fstpt 92(%esp) + fldt 92(%esp) + fldt 12+_P21@GOTOFF(%ebx) + fmul %st(1), %st + fldt 24+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt 36+_P21@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 48+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 60+_P21@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 72+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 84+_P21@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 96+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 108+_P21@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 120+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 132+_P21@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 144+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 156+_P21@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt 168+_P21@GOTOFF(%ebx) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt 180+_P21@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 192+_P21@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.11: + fstp %st(0) + fldt 12+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B2.13 +..B2.12: + fldt 12+_Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P22@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P22@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 168+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 180+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192+_P22@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 204+_P22@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 216+_P22@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.13: + fldt 24+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B2.15 +..B2.14: + fldt 24+_Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P3@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P3@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 168+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 180+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 204+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 216+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 228+_P3@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 240+_P3@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 252+_P3@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.15: + movl $3, %edx +..B2.16: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %ecx + fldt _S@GOTOFF(%ebx,%ecx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B2.19 + jp ..B2.19 +..B2.17: + incl %edx + cmpl $11, %edx + jl ..B2.16 +..B2.18: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx +..B2.19: + fldt _Z@GOTOFF(%ecx,%ebx) + movl %edx, %eax + fsubrp %st, %st(1) + shll $4, %eax + fld %st(0) + subl %edx, %eax + shll $4, %eax + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt -720+_P@GOTOFF(%eax,%ebx) + fmul %st(1), %st + fldt -708+_P@GOTOFF(%eax,%ebx) + fmul %st(2), %st + fldt -696+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -684+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -672+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -660+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -648+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -636+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -624+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -612+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -600+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -588+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -576+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -564+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -552+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -540+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -528+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -516+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -504+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -492+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.20: + fldt _P0@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(2) + fstpt 64(%esp) + fldt 64(%esp) + fxch %st(3) + fstpt 92(%esp) + fldt 92(%esp) + fxch %st(1) + fstpt (%esp) + fldt 12+_P0@GOTOFF(%ebx) + fmul %st(3), %st + fldt 24+_P0@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 36+_P0@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 48+_P0@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 60+_P0@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fldt 72+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt 84+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%esp) + call __j0l@PLT +..B2.31: + fldt 8(%ebp) + fxch %st(1) + fstpt 48(%esp) + fldt 32(%esp) +..B2.21: + fxch %st(1) + fstpt (%esp) + fstpt 32(%esp) + call logl@PLT +..B2.32: + fldt 32(%esp) + fldt 48(%esp) + fldt _tonpi@GOTOFF(%ebx) + fmulp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + jmp ..B2.27 +..B2.22: + fldl _ones@GOTOFF(%ebx) + lea 92(%esp), %eax + fdiv %st(1), %st + lea 64(%esp), %edx + fxch %st(1) + fxch %st(1) + fstpt -60(%eax) + fldt -60(%eax) + fxch %st(1) + fstpt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt (%eax) + fldt (%eax) + movl %eax, 12(%esp) + movl %edx, 16(%esp) + movl $-1, 20(%esp) + fxch %st(1) + fstpt -28(%eax) + fldt -28(%eax) + fldt _PP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -44(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt -12(%eax) + call __libm_sincos_pi4l +..B2.23: + fldt 8(%ebp) + fldt 80(%esp) + fldt 48(%esp) + fldt 92(%esp) + fmulp %st, %st(1) + fldt 64(%esp) + fmulp %st, %st(2) + fadd %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B2.25 + jp ..B2.25 +..B2.24: + fstp %st(1) + fldt _tonpi@GOTOFF(%ebx) + fldt 32(%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + jmp ..B2.27 +..B2.25: + fstp %st(0) + lea 32(%esp), %edi + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B2.34: + addl $-32, %esp + movl (%edi), %ecx + lea 80(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%edi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __y0q@PLT +..B2.33: + addl $28, %esp +..B2.26: + movl 48(%esp), %eax + movl %eax, (%edi) + movl 52(%esp), %edx + movl 56(%esp), %ecx + movl 60(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B2.27: + addl $120, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __y0l,@function + .size __y0l,.-__y0l + .data +# -- End __y0l + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_S: + .word 5921 + .word 65426 + .word 63142 + .word 35997 + .word 16384 + .word 0 + .word 29632 + .word 15745 + .word 62068 + .word 44479 + .word 16385 + .word 0 + .word 41288 + .word 2893 + .word 15731 + .word 35209 + .word 16386 + .word 0 + .word 12322 + .word 41360 + .word 35270 + .word 48124 + .word 16386 + .word 0 + .word 21828 + .word 62500 + .word 60486 + .word 61019 + .word 16386 + .word 0 + .word 54460 + .word 63729 + .word 58186 + .word 36952 + .word 16387 + .word 0 + .word 27250 + .word 3142 + .word 10825 + .word 43393 + .word 16387 + .word 0 + .word 20649 + .word 49414 + .word 53633 + .word 49831 + .word 16387 + .word 0 + .word 59160 + .word 26587 + .word 26484 + .word 56269 + .word 16387 + .word 0 + .word 57283 + .word 10561 + .word 16432 + .word 62706 + .word 16387 + .word 0 + .word 44243 + .word 51162 + .word 18495 + .word 34571 + .word 16388 + .word 0 + .word 63781 + .word 54231 + .word 15770 + .word 37789 + .word 16388 + .word 0 + .type _S,@object + .size _S,144 + .align 2 +_val_0_6L: + .word 39322 + .word 39321 + .word 39321 + .word 39321 + .word 16382 + .word 0 + .type _val_0_6L,@object + .size _val_0_6L,12 + .align 2 +_val_1_2L: + .word 39322 + .word 39321 + .word 39321 + .word 39321 + .word 16383 + .word 0 + .type _val_1_2L,@object + .size _val_1_2L,12 + .align 2 +_Z: + .word 20971 + .word 41151 + .word 30150 + .word 58561 + .word 16382 + .word 0 + .word 56848 + .word 49844 + .word 39532 + .word 64842 + .word 16384 + .word 0 + .word 5940 + .word 14600 + .word 60967 + .word 58048 + .word 16385 + .word 0 + .word 48233 + .word 9194 + .word 47533 + .word 41870 + .word 16386 + .word 0 + .word 19716 + .word 3898 + .word 3621 + .word 54727 + .word 16386 + .word 0 + .word 41547 + .word 400 + .word 58272 + .word 33793 + .word 16387 + .word 0 + .word 46312 + .word 65374 + .word 26362 + .word 40225 + .word 16387 + .word 0 + .word 15253 + .word 48480 + .word 38891 + .word 46657 + .word 16387 + .word 0 + .word 12158 + .word 16394 + .word 14239 + .word 53090 + .word 16387 + .word 0 + .word 31253 + .word 2914 + .word 8779 + .word 59523 + .word 16387 + .word 0 + .word 29606 + .word 9567 + .word 8455 + .word 32978 + .word 16388 + .word 0 + .word 51148 + .word 41491 + .word 50276 + .word 36194 + .word 16388 + .word 0 + .type _Z,@object + .size _Z,144 + .align 2 +_P11: + .word 21672 + .word 14168 + .word 38767 + .word 33539 + .word 49130 + .word 0 + .word 41169 + .word 50619 + .word 21849 + .word 37014 + .word 16364 + .word 0 + .word 55003 + .word 42793 + .word 44721 + .word 50737 + .word 49133 + .word 0 + .word 1169 + .word 13656 + .word 30890 + .word 57268 + .word 16366 + .word 0 + .word 2761 + .word 22275 + .word 55697 + .word 58639 + .word 49135 + .word 0 + .word 63624 + .word 9235 + .word 64995 + .word 56818 + .word 16368 + .word 0 + .word 62376 + .word 14952 + .word 24232 + .word 50456 + .word 49137 + .word 0 + .word 35764 + .word 14862 + .word 11423 + .word 44812 + .word 16370 + .word 0 + .word 799 + .word 749 + .word 44421 + .word 44099 + .word 49140 + .word 0 + .word 57800 + .word 45157 + .word 3532 + .word 40524 + .word 16373 + .word 0 + .word 54824 + .word 35595 + .word 46140 + .word 46550 + .word 16376 + .word 0 + .word 57927 + .word 14014 + .word 38764 + .word 61194 + .word 49142 + .word 0 + .word 31025 + .word 58986 + .word 13056 + .word 57752 + .word 49148 + .word 0 + .word 25304 + .word 41780 + .word 21387 + .word 41754 + .word 49148 + .word 0 + .word 38881 + .word 54183 + .word 37931 + .word 34827 + .word 16383 + .word 0 + .word 19650 + .word 12565 + .word 569 + .word 58514 + .word 16383 + .word 0 + .word 23916 + .word 27820 + .word 49726 + .word 50434 + .word 16382 + .word 0 + .word 37686 + .word 17141 + .word 5720 + .word 38948 + .word 16317 + .word 0 + .type _P11,@object + .size _P11,216 + .align 2 +_Q11: + .word 14194 + .word 21345 + .word 52686 + .word 49437 + .word 16382 + .word 0 + .word 16969 + .word 59638 + .word 1826 + .word 39310 + .word 16384 + .word 0 + .word 28926 + .word 48282 + .word 1364 + .word 41291 + .word 16384 + .word 0 + .word 13574 + .word 15497 + .word 63728 + .word 57349 + .word 16382 + .word 0 + .type _Q11,@object + .size _Q11,48 + .align 2 +_P12: + .word 59330 + .word 22263 + .word 34178 + .word 51006 + .word 49126 + .word 0 + .word 16861 + .word 21193 + .word 35273 + .word 46715 + .word 16362 + .word 0 + .word 2103 + .word 12628 + .word 1838 + .word 41114 + .word 49133 + .word 0 + .word 46148 + .word 53581 + .word 46203 + .word 46468 + .word 16367 + .word 0 + .word 19710 + .word 1268 + .word 64842 + .word 38086 + .word 49137 + .word 0 + .word 10276 + .word 59226 + .word 39596 + .word 48586 + .word 16370 + .word 0 + .word 31029 + .word 64049 + .word 23137 + .word 50693 + .word 49139 + .word 0 + .word 22014 + .word 1854 + .word 56980 + .word 45052 + .word 16372 + .word 0 + .word 12740 + .word 38047 + .word 44756 + .word 35383 + .word 49141 + .word 0 + .word 9689 + .word 42893 + .word 35756 + .word 50848 + .word 16373 + .word 0 + .word 16570 + .word 20820 + .word 51546 + .word 34499 + .word 49142 + .word 0 + .word 49962 + .word 36228 + .word 57995 + .word 45370 + .word 16374 + .word 0 + .word 32489 + .word 35981 + .word 43312 + .word 58898 + .word 49142 + .word 0 + .word 10311 + .word 12657 + .word 16405 + .word 38148 + .word 16375 + .word 0 + .word 32504 + .word 29604 + .word 49577 + .word 49580 + .word 49143 + .word 0 + .word 65322 + .word 54336 + .word 27403 + .word 64825 + .word 16375 + .word 0 + .word 33227 + .word 51353 + .word 11288 + .word 42704 + .word 49144 + .word 0 + .word 30209 + .word 39595 + .word 16790 + .word 56786 + .word 16376 + .word 0 + .word 17645 + .word 4926 + .word 40100 + .word 38165 + .word 49145 + .word 0 + .word 6983 + .word 2488 + .word 5292 + .word 51990 + .word 16377 + .word 0 + .word 4652 + .word 21592 + .word 9570 + .word 36478 + .word 49146 + .word 0 + .word 53361 + .word 14763 + .word 26464 + .word 52381 + .word 16378 + .word 0 + .word 50485 + .word 35307 + .word 30503 + .word 59794 + .word 49146 + .word 0 + .word 18614 + .word 21402 + .word 49824 + .word 37715 + .word 16379 + .word 0 + .word 55547 + .word 61092 + .word 564 + .word 48870 + .word 49149 + .word 0 + .word 9082 + .word 24716 + .word 52021 + .word 40706 + .word 16382 + .word 0 + .word 17305 + .word 30912 + .word 47308 + .word 59790 + .word 16380 + .word 0 + .type _P12,@object + .size _P12,324 + .align 2 +_val_3_0L: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .type _val_3_0L,@object + .size _val_3_0L,12 + .align 2 +_P20: + .word 37654 + .word 4018 + .word 25149 + .word 64448 + .word 16354 + .word 0 + .word 19189 + .word 12397 + .word 54733 + .word 33028 + .word 16357 + .word 0 + .word 22349 + .word 41220 + .word 13172 + .word 45200 + .word 16358 + .word 0 + .word 43891 + .word 61784 + .word 34756 + .word 53833 + .word 16358 + .word 0 + .word 23592 + .word 62506 + .word 40671 + .word 50152 + .word 16359 + .word 0 + .word 27771 + .word 49376 + .word 49653 + .word 53593 + .word 49126 + .word 0 + .word 29892 + .word 65375 + .word 48818 + .word 47355 + .word 16361 + .word 0 + .word 33664 + .word 20071 + .word 46988 + .word 35237 + .word 49131 + .word 0 + .word 40179 + .word 47562 + .word 27113 + .word 46088 + .word 16364 + .word 0 + .word 39977 + .word 33568 + .word 2856 + .word 39237 + .word 49134 + .word 0 + .word 22462 + .word 11227 + .word 63692 + .word 48552 + .word 16369 + .word 0 + .word 9895 + .word 49985 + .word 29445 + .word 35598 + .word 49139 + .word 0 + .word 41034 + .word 13031 + .word 20740 + .word 35245 + .word 49142 + .word 0 + .word 32927 + .word 48253 + .word 43 + .word 37376 + .word 16375 + .word 0 + .word 5109 + .word 58801 + .word 31733 + .word 33042 + .word 16379 + .word 0 + .word 34717 + .word 51477 + .word 15888 + .word 35209 + .word 49148 + .word 0 + .word 4166 + .word 43043 + .word 47592 + .word 42555 + .word 49149 + .word 0 + .word 20077 + .word 289 + .word 31753 + .word 49394 + .word 16381 + .word 0 + .type _P20,@object + .size _P20,216 + .align 2 +_val_3_875L: + .word 0 + .word 0 + .word 0 + .word 63488 + .word 16384 + .word 0 + .type _val_3_875L,@object + .size _val_3_875L,12 + .align 2 +_P21: + .word 27895 + .word 14185 + .word 11256 + .word 61473 + .word 49117 + .word 0 + .word 55110 + .word 27090 + .word 21413 + .word 51858 + .word 49119 + .word 0 + .word 47481 + .word 51958 + .word 45685 + .word 44708 + .word 49121 + .word 0 + .word 53606 + .word 43192 + .word 10601 + .word 36675 + .word 49120 + .word 0 + .word 9703 + .word 39697 + .word 3773 + .word 54687 + .word 49123 + .word 0 + .word 39016 + .word 46259 + .word 57439 + .word 47927 + .word 16357 + .word 0 + .word 18601 + .word 64800 + .word 43294 + .word 45654 + .word 49126 + .word 0 + .word 11755 + .word 20846 + .word 12691 + .word 36847 + .word 49129 + .word 0 + .word 34925 + .word 21969 + .word 12496 + .word 40232 + .word 49133 + .word 0 + .word 33074 + .word 22131 + .word 45345 + .word 58077 + .word 16368 + .word 0 + .word 28402 + .word 30562 + .word 17788 + .word 44258 + .word 16370 + .word 0 + .word 64431 + .word 22682 + .word 21098 + .word 38133 + .word 49142 + .word 0 + .word 38064 + .word 47115 + .word 9737 + .word 49752 + .word 49143 + .word 0 + .word 32940 + .word 23551 + .word 17164 + .word 63584 + .word 16378 + .word 0 + .word 20289 + .word 55054 + .word 36724 + .word 37823 + .word 16378 + .word 0 + .word 46434 + .word 29308 + .word 2375 + .word 53705 + .word 49149 + .word 0 + .word 16931 + .word 9593 + .word 51956 + .word 35227 + .word 16378 + .word 0 + .type _P21,@object + .size _P21,204 + .align 2 +_P22: + .word 40244 + .word 7737 + .word 8636 + .word 43048 + .word 49106 + .word 0 + .word 47822 + .word 28463 + .word 39991 + .word 46660 + .word 16342 + .word 0 + .word 52293 + .word 15799 + .word 45377 + .word 51162 + .word 49113 + .word 0 + .word 37860 + .word 10494 + .word 27911 + .word 39108 + .word 16348 + .word 0 + .word 1970 + .word 24596 + .word 57275 + .word 48105 + .word 49118 + .word 0 + .word 64547 + .word 28877 + .word 41771 + .word 52711 + .word 16352 + .word 0 + .word 63459 + .word 4647 + .word 40018 + .word 64048 + .word 49122 + .word 0 + .word 38817 + .word 50313 + .word 34514 + .word 41599 + .word 16357 + .word 0 + .word 6873 + .word 59727 + .word 11575 + .word 48044 + .word 49125 + .word 0 + .word 29515 + .word 62000 + .word 64058 + .word 40336 + .word 49129 + .word 0 + .word 47818 + .word 19180 + .word 47066 + .word 42033 + .word 49133 + .word 0 + .word 35527 + .word 6093 + .word 4081 + .word 54678 + .word 16368 + .word 0 + .word 16787 + .word 50723 + .word 15144 + .word 52417 + .word 16370 + .word 0 + .word 27442 + .word 31785 + .word 24103 + .word 36633 + .word 49142 + .word 0 + .word 6233 + .word 52232 + .word 32482 + .word 57483 + .word 49143 + .word 0 + .word 59606 + .word 43125 + .word 44255 + .word 61366 + .word 16378 + .word 0 + .word 29998 + .word 6975 + .word 18760 + .word 53326 + .word 16378 + .word 0 + .word 24786 + .word 2384 + .word 4789 + .word 52762 + .word 49149 + .word 0 + .word 34816 + .word 30902 + .word 22802 + .word 44066 + .word 49086 + .word 0 + .type _P22,@object + .size _P22,228 + .align 2 +_P3: + .word 38373 + .word 25081 + .word 52784 + .word 41269 + .word 16319 + .word 0 + .word 2433 + .word 58494 + .word 34093 + .word 49310 + .word 49089 + .word 0 + .word 20384 + .word 14386 + .word 32743 + .word 56565 + .word 16322 + .word 0 + .word 12279 + .word 3882 + .word 34299 + .word 37877 + .word 49096 + .word 0 + .word 57529 + .word 46240 + .word 60154 + .word 40126 + .word 16332 + .word 0 + .word 46223 + .word 16522 + .word 54101 + .word 39334 + .word 16335 + .word 0 + .word 17152 + .word 52627 + .word 55415 + .word 33597 + .word 49108 + .word 0 + .word 46957 + .word 15713 + .word 64890 + .word 47269 + .word 49111 + .word 0 + .word 63416 + .word 7921 + .word 11783 + .word 63655 + .word 16347 + .word 0 + .word 22182 + .word 52374 + .word 10257 + .word 64822 + .word 16350 + .word 0 + .word 20533 + .word 18718 + .word 7837 + .word 41493 + .word 49123 + .word 0 + .word 34870 + .word 43221 + .word 2667 + .word 34068 + .word 49126 + .word 0 + .word 62446 + .word 64657 + .word 15033 + .word 39509 + .word 16362 + .word 0 + .word 31017 + .word 38768 + .word 5018 + .word 46409 + .word 16364 + .word 0 + .word 37858 + .word 10529 + .word 62079 + .word 49339 + .word 49136 + .word 0 + .word 60794 + .word 51427 + .word 47345 + .word 37742 + .word 49138 + .word 0 + .word 8999 + .word 61205 + .word 62511 + .word 36506 + .word 16374 + .word 0 + .word 22683 + .word 43326 + .word 42314 + .word 55672 + .word 16374 + .word 0 + .word 37536 + .word 24482 + .word 58150 + .word 50356 + .word 49146 + .word 0 + .word 47735 + .word 57962 + .word 45199 + .word 44407 + .word 49145 + .word 0 + .word 54502 + .word 19410 + .word 25859 + .word 39334 + .word 16381 + .word 0 + .word 1861 + .word 57822 + .word 27975 + .word 42824 + .word 49086 + .word 0 + .type _P3,@object + .size _P3,264 + .align 2 +_P: + .word 6710 + .word 46975 + .word 45541 + .word 45018 + .word 16323 + .word 0 + .word 47994 + .word 32334 + .word 52627 + .word 65214 + .word 16326 + .word 0 + .word 25829 + .word 961 + .word 45314 + .word 63623 + .word 49099 + .word 0 + .word 56740 + .word 896 + .word 13408 + .word 40400 + .word 49103 + .word 0 + .word 60385 + .word 50719 + .word 53670 + .word 35961 + .word 16340 + .word 0 + .word 18363 + .word 40724 + .word 30788 + .word 37641 + .word 16343 + .word 0 + .word 54199 + .word 26560 + .word 1100 + .word 63052 + .word 49115 + .word 0 + .word 31112 + .word 47384 + .word 24910 + .word 52460 + .word 49118 + .word 0 + .word 62051 + .word 62630 + .word 7457 + .word 41285 + .word 16355 + .word 0 + .word 41021 + .word 16553 + .word 53133 + .word 51701 + .word 16357 + .word 0 + .word 43336 + .word 19494 + .word 20322 + .word 38261 + .word 49130 + .word 0 + .word 44128 + .word 40851 + .word 40287 + .word 33282 + .word 49132 + .word 0 + .word 15978 + .word 61692 + .word 60093 + .word 46462 + .word 16368 + .word 0 + .word 34924 + .word 34591 + .word 27618 + .word 49090 + .word 16369 + .word 0 + .word 22325 + .word 56457 + .word 51367 + .word 65297 + .word 49141 + .word 0 + .word 21258 + .word 62600 + .word 63264 + .word 33170 + .word 49142 + .word 0 + .word 31459 + .word 43701 + .word 15672 + .word 42803 + .word 16378 + .word 0 + .word 10392 + .word 64190 + .word 8847 + .word 51227 + .word 16376 + .word 0 + .word 34244 + .word 38351 + .word 44643 + .word 65457 + .word 49148 + .word 0 + .word 24705 + .word 53181 + .word 1549 + .word 55232 + .word 16319 + .word 0 + .word 24274 + .word 2157 + .word 59872 + .word 44641 + .word 49091 + .word 0 + .word 44404 + .word 52032 + .word 31206 + .word 56185 + .word 49094 + .word 0 + .word 42376 + .word 53700 + .word 44782 + .word 63474 + .word 16331 + .word 0 + .word 55880 + .word 43379 + .word 3093 + .word 34064 + .word 16335 + .word 0 + .word 62288 + .word 61979 + .word 24976 + .word 35576 + .word 49108 + .word 0 + .word 30673 + .word 34148 + .word 2010 + .word 61956 + .word 49110 + .word 0 + .word 45192 + .word 28065 + .word 60055 + .word 61722 + .word 16347 + .word 0 + .word 24582 + .word 59932 + .word 774 + .word 41831 + .word 16350 + .word 0 + .word 39741 + .word 15639 + .word 29541 + .word 39821 + .word 49123 + .word 0 + .word 32965 + .word 53765 + .word 3652 + .word 39681 + .word 49125 + .word 0 + .word 55274 + .word 5931 + .word 14729 + .word 36200 + .word 16362 + .word 0 + .word 4659 + .word 41741 + .word 5124 + .word 48783 + .word 16363 + .word 0 + .word 61896 + .word 13936 + .word 31722 + .word 42885 + .word 49136 + .word 0 + .word 29587 + .word 13947 + .word 35938 + .word 34351 + .word 49137 + .word 0 + .word 30548 + .word 42185 + .word 15217 + .word 58709 + .word 16373 + .word 0 + .word 32944 + .word 45803 + .word 62008 + .word 44929 + .word 16373 + .word 0 + .word 15543 + .word 17819 + .word 22981 + .word 37733 + .word 49146 + .word 0 + .word 40787 + .word 12944 + .word 27687 + .word 34273 + .word 49144 + .word 0 + .word 14474 + .word 51712 + .word 20794 + .word 57241 + .word 16380 + .word 0 + .word 31505 + .word 44115 + .word 25843 + .word 56405 + .word 49084 + .word 0 + .word 29537 + .word 33343 + .word 23367 + .word 43948 + .word 16323 + .word 0 + .word 15837 + .word 34931 + .word 8097 + .word 48214 + .word 16326 + .word 0 + .word 1126 + .word 23018 + .word 59367 + .word 62418 + .word 49099 + .word 0 + .word 50591 + .word 16203 + .word 45917 + .word 57446 + .word 49102 + .word 0 + .word 6095 + .word 44294 + .word 16725 + .word 34699 + .word 16340 + .word 0 + .word 2346 + .word 25530 + .word 14073 + .word 51139 + .word 16342 + .word 0 + .word 48724 + .word 10078 + .word 7882 + .word 59578 + .word 49115 + .word 0 + .word 3077 + .word 7734 + .word 24746 + .word 33688 + .word 49118 + .word 0 + .word 52085 + .word 9505 + .word 49832 + .word 37954 + .word 16355 + .word 0 + .word 41663 + .word 47247 + .word 238 + .word 62191 + .word 16356 + .word 0 + .word 48361 + .word 39255 + .word 14492 + .word 33999 + .word 49130 + .word 0 + .word 35816 + .word 34414 + .word 54424 + .word 37185 + .word 49131 + .word 0 + .word 20077 + .word 189 + .word 48758 + .word 39656 + .word 16368 + .word 0 + .word 35728 + .word 48114 + .word 41225 + .word 51144 + .word 16368 + .word 0 + .word 10943 + .word 64308 + .word 2314 + .word 53541 + .word 49141 + .word 0 + .word 32154 + .word 56468 + .word 40039 + .word 32925 + .word 49141 + .word 0 + .word 4941 + .word 52917 + .word 35073 + .word 34082 + .word 16378 + .word 0 + .word 61194 + .word 15048 + .word 42139 + .word 49938 + .word 16375 + .word 0 + .word 19128 + .word 18289 + .word 6860 + .word 51502 + .word 49148 + .word 0 + .word 49300 + .word 58708 + .word 59005 + .word 55071 + .word 16319 + .word 0 + .word 26502 + .word 47642 + .word 36933 + .word 42964 + .word 49091 + .word 0 + .word 30051 + .word 60756 + .word 30625 + .word 41460 + .word 49094 + .word 0 + .word 61015 + .word 15762 + .word 48007 + .word 60846 + .word 16331 + .word 0 + .word 21975 + .word 20753 + .word 22643 + .word 48677 + .word 16334 + .word 0 + .word 54246 + .word 4624 + .word 38600 + .word 33572 + .word 49108 + .word 0 + .word 59379 + .word 53723 + .word 32353 + .word 42607 + .word 49110 + .word 0 + .word 40791 + .word 16038 + .word 57576 + .word 57139 + .word 16347 + .word 0 + .word 25939 + .word 3603 + .word 54023 + .word 55128 + .word 16349 + .word 0 + .word 7176 + .word 58381 + .word 25669 + .word 36047 + .word 49123 + .word 0 + .word 23057 + .word 6107 + .word 22526 + .word 49962 + .word 49124 + .word 0 + .word 19351 + .word 39386 + .word 35003 + .word 63923 + .word 16361 + .word 0 + .word 45293 + .word 12882 + .word 9948 + .word 58748 + .word 16362 + .word 0 + .word 20001 + .word 20829 + .word 53529 + .word 36918 + .word 49136 + .word 0 + .word 21919 + .word 49831 + .word 37577 + .word 39856 + .word 49136 + .word 0 + .word 47026 + .word 46471 + .word 55318 + .word 49443 + .word 16373 + .word 0 + .word 61519 + .word 51459 + .word 6950 + .word 50870 + .word 16372 + .word 0 + .word 1555 + .word 2971 + .word 23597 + .word 62610 + .word 49145 + .word 0 + .word 45926 + .word 36681 + .word 39043 + .word 38451 + .word 49143 + .word 0 + .word 64160 + .word 21923 + .word 31542 + .word 47202 + .word 16380 + .word 0 + .word 36569 + .word 36429 + .word 41036 + .word 40257 + .word 49085 + .word 0 + .word 63272 + .word 57206 + .word 4215 + .word 41813 + .word 16323 + .word 0 + .word 38880 + .word 42175 + .word 14999 + .word 35837 + .word 16326 + .word 0 + .word 42787 + .word 9806 + .word 63168 + .word 59020 + .word 49099 + .word 0 + .word 31095 + .word 14929 + .word 48209 + .word 41580 + .word 49102 + .word 0 + .word 36413 + .word 27679 + .word 45695 + .word 64718 + .word 16339 + .word 0 + .word 24761 + .word 31380 + .word 27544 + .word 35930 + .word 16342 + .word 0 + .word 11221 + .word 62995 + .word 50975 + .word 54692 + .word 49115 + .word 0 + .word 29668 + .word 1933 + .word 17144 + .word 45888 + .word 49117 + .word 0 + .word 30810 + .word 24149 + .word 32113 + .word 34254 + .word 16355 + .word 0 + .word 34856 + .word 24408 + .word 21475 + .word 41075 + .word 16356 + .word 0 + .word 33943 + .word 23810 + .word 62559 + .word 60314 + .word 49129 + .word 0 + .word 3305 + .word 24934 + .word 37437 + .word 47776 + .word 49130 + .word 0 + .word 54895 + .word 55211 + .word 32000 + .word 34613 + .word 16368 + .word 0 + .word 35009 + .word 47065 + .word 21660 + .word 64281 + .word 16367 + .word 0 + .word 9852 + .word 9156 + .word 55656 + .word 46121 + .word 49141 + .word 0 + .word 36442 + .word 41210 + .word 20060 + .word 40802 + .word 49140 + .word 0 + .word 21758 + .word 47322 + .word 2788 + .word 58210 + .word 16377 + .word 0 + .word 52348 + .word 9004 + .word 18276 + .word 61559 + .word 16374 + .word 0 + .word 54786 + .word 7147 + .word 27070 + .word 43826 + .word 49148 + .word 0 + .word 34268 + .word 15768 + .word 2480 + .word 60089 + .word 49085 + .word 0 + .word 1157 + .word 52048 + .word 20458 + .word 40588 + .word 49091 + .word 0 + .word 51540 + .word 48806 + .word 47292 + .word 62380 + .word 49093 + .word 0 + .word 19999 + .word 57758 + .word 46120 + .word 57112 + .word 16331 + .word 0 + .word 21459 + .word 54484 + .word 23863 + .word 35854 + .word 16334 + .word 0 + .word 28754 + .word 5362 + .word 55327 + .word 62303 + .word 49107 + .word 0 + .word 45243 + .word 6687 + .word 17114 + .word 61365 + .word 49109 + .word 0 + .word 32048 + .word 1009 + .word 39781 + .word 52368 + .word 16347 + .word 0 + .word 64584 + .word 3308 + .word 26412 + .word 38818 + .word 16349 + .word 0 + .word 23088 + .word 38547 + .word 22659 + .word 65247 + .word 49122 + .word 0 + .word 14061 + .word 22418 + .word 61292 + .word 34447 + .word 49124 + .word 0 + .word 57848 + .word 26921 + .word 61797 + .word 57155 + .word 16361 + .word 0 + .word 1597 + .word 31414 + .word 38572 + .word 39774 + .word 16362 + .word 0 + .word 30034 + .word 27108 + .word 16687 + .word 65316 + .word 49135 + .word 0 + .word 32265 + .word 44536 + .word 9779 + .word 53216 + .word 49135 + .word 0 + .word 550 + .word 16407 + .word 19715 + .word 43369 + .word 16373 + .word 0 + .word 7132 + .word 1973 + .word 39654 + .word 33659 + .word 16372 + .word 0 + .word 19090 + .word 42384 + .word 19608 + .word 54616 + .word 49145 + .word 0 + .word 29916 + .word 8899 + .word 53582 + .word 50715 + .word 49142 + .word 0 + .word 63987 + .word 34002 + .word 32751 + .word 41084 + .word 16380 + .word 0 + .word 31930 + .word 50610 + .word 35321 + .word 40669 + .word 49085 + .word 0 + .word 64556 + .word 32042 + .word 47688 + .word 39353 + .word 16323 + .word 0 + .word 22761 + .word 33268 + .word 25802 + .word 54704 + .word 16325 + .word 0 + .word 48596 + .word 35082 + .word 36228 + .word 55222 + .word 49099 + .word 0 + .word 62834 + .word 26257 + .word 62649 + .word 62428 + .word 49101 + .word 0 + .word 22216 + .word 57771 + .word 11637 + .word 59993 + .word 16339 + .word 0 + .word 32841 + .word 24077 + .word 25618 + .word 53031 + .word 16341 + .word 0 + .word 7134 + .word 15474 + .word 25724 + .word 50216 + .word 49115 + .word 0 + .word 679 + .word 61058 + .word 8963 + .word 33314 + .word 49117 + .word 0 + .word 30607 + .word 23707 + .word 50236 + .word 62315 + .word 16354 + .word 0 + .word 57112 + .word 44811 + .word 22996 + .word 58760 + .word 16355 + .word 0 + .word 7925 + .word 14145 + .word 19419 + .word 54389 + .word 49129 + .word 0 + .word 15063 + .word 11101 + .word 53306 + .word 33747 + .word 49130 + .word 0 + .word 17212 + .word 63840 + .word 49608 + .word 61962 + .word 16367 + .word 0 + .word 64221 + .word 2367 + .word 56115 + .word 44976 + .word 16367 + .word 0 + .word 25958 + .word 42476 + .word 21228 + .word 41045 + .word 49141 + .word 0 + .word 39160 + .word 29939 + .word 20970 + .word 56757 + .word 49139 + .word 0 + .word 34212 + .word 35958 + .word 8729 + .word 51611 + .word 16377 + .word 0 + .word 47817 + .word 56326 + .word 46415 + .word 42719 + .word 16374 + .word 0 + .word 14697 + .word 51278 + .word 14116 + .word 38800 + .word 49148 + .word 0 + .word 42056 + .word 1202 + .word 6817 + .word 52251 + .word 16319 + .word 0 + .word 9811 + .word 3897 + .word 54180 + .word 38147 + .word 49091 + .word 0 + .word 22279 + .word 36400 + .word 23268 + .word 48339 + .word 49093 + .word 0 + .word 3604 + .word 63501 + .word 23839 + .word 53404 + .word 16331 + .word 0 + .word 1179 + .word 37183 + .word 50892 + .word 54850 + .word 16333 + .word 0 + .word 59751 + .word 27404 + .word 14795 + .word 57826 + .word 49107 + .word 0 + .word 14718 + .word 11779 + .word 34360 + .word 46330 + .word 49109 + .word 0 + .word 59705 + .word 41619 + .word 32041 + .word 48245 + .word 16347 + .word 0 + .word 23030 + .word 54615 + .word 27535 + .word 57905 + .word 16348 + .word 0 + .word 39169 + .word 62610 + .word 58529 + .word 59687 + .word 49122 + .word 0 + .word 51398 + .word 44311 + .word 12717 + .word 50833 + .word 49123 + .word 0 + .word 27431 + .word 2954 + .word 22657 + .word 51954 + .word 16361 + .word 0 + .word 58296 + .word 29685 + .word 27243 + .word 58169 + .word 16361 + .word 0 + .word 51216 + .word 48206 + .word 42318 + .word 59054 + .word 49135 + .word 0 + .word 56132 + .word 37000 + .word 55250 + .word 38652 + .word 49135 + .word 0 + .word 33362 + .word 39562 + .word 49329 + .word 39051 + .word 16373 + .word 0 + .word 45334 + .word 5673 + .word 58520 + .word 48690 + .word 16371 + .word 0 + .word 35653 + .word 20625 + .word 33642 + .word 49050 + .word 49145 + .word 0 + .word 58051 + .word 8993 + .word 6809 + .word 36624 + .word 49142 + .word 0 + .word 52356 + .word 59873 + .word 62958 + .word 36858 + .word 16380 + .word 0 + .word 32142 + .word 25405 + .word 33867 + .word 33307 + .word 16319 + .word 0 + .word 49519 + .word 13151 + .word 56037 + .word 36991 + .word 16323 + .word 0 + .word 44868 + .word 63207 + .word 24006 + .word 43028 + .word 16325 + .word 0 + .word 8083 + .word 45145 + .word 39702 + .word 51683 + .word 49099 + .word 0 + .word 45111 + .word 52725 + .word 38011 + .word 48603 + .word 49101 + .word 0 + .word 60521 + .word 20244 + .word 23464 + .word 55814 + .word 16339 + .word 0 + .word 20556 + .word 16261 + .word 38082 + .word 40872 + .word 16341 + .word 0 + .word 25337 + .word 58099 + .word 56911 + .word 46447 + .word 49115 + .word 0 + .word 37285 + .word 19168 + .word 56812 + .word 50878 + .word 49116 + .word 0 + .word 15949 + .word 20065 + .word 40118 + .word 57328 + .word 16354 + .word 0 + .word 40507 + .word 40248 + .word 14830 + .word 44509 + .word 16355 + .word 0 + .word 5104 + .word 24529 + .word 29756 + .word 49797 + .word 49129 + .word 0 + .word 46472 + .word 25780 + .word 5432 + .word 50788 + .word 49129 + .word 0 + .word 15446 + .word 10547 + .word 15373 + .word 56506 + .word 16367 + .word 0 + .word 3213 + .word 104 + .word 59551 + .word 33676 + .word 16367 + .word 0 + .word 34009 + .word 54843 + .word 32265 + .word 37318 + .word 49141 + .word 0 + .word 45472 + .word 58672 + .word 64591 + .word 42366 + .word 49139 + .word 0 + .word 32200 + .word 21528 + .word 8481 + .word 46835 + .word 16377 + .word 0 + .word 49716 + .word 3176 + .word 29068 + .word 63703 + .word 16373 + .word 0 + .word 39156 + .word 24341 + .word 43754 + .word 35182 + .word 49148 + .word 0 + .word 61730 + .word 30329 + .word 55010 + .word 38388 + .word 16320 + .word 0 + .type _P,@object + .size _P,2160 + .align 2 +_P0: + .word 46060 + .word 21479 + .word 19707 + .word 37102 + .word 16345 + .word 0 + .word 35676 + .word 11242 + .word 15120 + .word 54134 + .word 49120 + .word 0 + .word 34641 + .word 49003 + .word 21090 + .word 56946 + .word 16359 + .word 0 + .word 36501 + .word 52298 + .word 48288 + .word 40780 + .word 49134 + .word 0 + .word 2947 + .word 56486 + .word 859 + .word 36145 + .word 16372 + .word 0 + .word 6106 + .word 41115 + .word 36319 + .word 33709 + .word 49145 + .word 0 + .word 13230 + .word 6676 + .word 23048 + .word 46558 + .word 16380 + .word 0 + .word 62532 + .word 24192 + .word 46286 + .word 38694 + .word 49147 + .word 0 + .type _P0,@object + .size _P0,96 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .type _tonpi,@object + .size _tonpi,12 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,12 + .align 2 +_PP: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP,@object + .size _PP,120 + .align 2 +_QP: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .type _QP,@object + .size _QP,120 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,12 + .data + .hidden __libm_sincos_pi4l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/y0f.S b/external/sgx_libm/ia32/y0f.S new file mode 100644 index 0000000000..0a7690f452 --- /dev/null +++ b/external/sgx_libm/ia32/y0f.S @@ -0,0 +1,805 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y0f.c" + .text +..TXTST0: +# -- Begin y0f + .text + .align 16,0x90 + .globl y0f +y0f: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $124, %esp + movl 8(%ebp), %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea -1(%edx), %eax + cmpl $2139095039, %eax + jae ..B1.21 +..B1.2: + cmpl $1099978979, %edx + jae ..B1.19 +..B1.3: + cmpl $1094450314, %edx + jae ..B1.15 +..B1.4: + cmpl $1085128690, %edx + jae ..B1.11 +..B1.5: + cmpl $1074568695, %edx + jae ..B1.10 +..B1.6: + cmpl $1058642330, %edx + jae ..B1.9 +..B1.7: + flds 8(%ebp) + fstl (%esp) + fstpl 32(%esp) + call __libm_log_k32 +..B1.31: + fldl 32(%esp) +..B1.8: + fldl _tonpi@GOTOFF(%ebx) + fmulp %st, %st(2) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fldl 32+_Q1@GOTOFF(%ebx) + fmul %st(1), %st + fldl 24+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 16+_Q1@GOTOFF(%ebx) + fmul %st(2), %st + fxch %st(1) + faddl 8+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl _Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fldl 24+_Q2@GOTOFF(%ebx) + fmul %st(2), %st + fldl 16+_Q2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 8+_Q2@GOTOFF(%ebx) + fmulp %st, %st(3) + faddl _Q2@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.9: + flds 8(%ebp) + fldl 160+_P1@GOTOFF(%ebx) + fldl 144+_P1@GOTOFF(%ebx) + fldl 152+_P1@GOTOFF(%ebx) + fldl 136+_P1@GOTOFF(%ebx) + fxch %st(4) + fsubl 168+_P1@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 128+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 112+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 96+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 80+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 64+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 48+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 32+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 16+_P1@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 120+_P1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(5) + faddl 104+_P1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(5) + faddl 88+_P1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(5) + faddl 72+_P1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(5) + faddl 56+_P1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(3) + faddl _P1@GOTOFF(%ebx) + fxch %st(5) + faddl 40+_P1@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(2) + faddl 24+_P1@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + fxch %st(2) + faddl 8+_P1@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.10: + flds 8(%ebp) + fldl 136+_P2@GOTOFF(%ebx) + fldl 120+_P2@GOTOFF(%ebx) + fldl 128+_P2@GOTOFF(%ebx) + fldl 112+_P2@GOTOFF(%ebx) + fxch %st(4) + fsubl 144+_P2@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 104+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 88+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 72+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 56+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 40+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 24+_P2@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(2), %st + fxch %st(4) + faddl 8+_P2@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + faddl 96+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 80+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 64+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 48+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 32+_P2@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(3) + faddl 16+_P2@GOTOFF(%ebx) + fmulp %st, %st(1) + fxch %st(1) + faddl _P2@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.11: + cmpl $1091143997, %edx + jae ..B1.13 +..B1.12: + lea _P3@GOTOFF(%ebx), %eax + jmp ..B1.14 +..B1.13: + lea _P4@GOTOFF(%ebx), %eax +..B1.14: + flds 8(%ebp) + fldl 104(%eax) + fldl 88(%eax) + fldl 96(%eax) + fldl 80(%eax) + fxch %st(4) + fsubl 112(%eax) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 72(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 56(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 40(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 24(%eax) + fmul %st(1), %st + fmul %st(2), %st + fxch %st(4) + faddl 8(%eax) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + faddl 64(%eax) + fmul %st(3), %st + fxch %st(4) + faddl 48(%eax) + fmul %st(3), %st + fxch %st(4) + faddl 32(%eax) + fmulp %st, %st(3) + fxch %st(3) + faddl 16(%eax) + fmulp %st, %st(1) + fxch %st(1) + faddl (%eax) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.15: + cmpl $1097751532, %edx + jae ..B1.17 +..B1.16: + lea _P5@GOTOFF(%ebx), %eax + jmp ..B1.18 +..B1.17: + lea _P6@GOTOFF(%ebx), %eax +..B1.18: + flds 8(%ebp) + fldl 80(%eax) + fldl 96(%eax) + fldl 88(%eax) + fldl 72(%eax) + fxch %st(4) + fsubl 104(%eax) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(3) + fmul %st, %st(4) + fmul %st, %st(6) + fxch %st(5) + faddl 48(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 64(%eax) + fmul %st(5), %st + fxch %st(4) + faddl 16(%eax) + fmul %st(1), %st + fxch %st(4) + faddl 32(%eax) + fmul %st(5), %st + fxch %st(4) + faddl (%eax) + faddp %st, %st(4) + fxch %st(2) + faddl 56(%eax) + fmul %st(4), %st + fxch %st(5) + faddl 40(%eax) + fmulp %st, %st(4) + fxch %st(4) + faddl 24(%eax) + fmulp %st, %st(1) + fmul %st(3), %st + fxch %st(2) + faddl 8(%eax) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.19: + flds 8(%ebp) + lea 32(%esp), %eax + fld1 + fdiv %st(1), %st + lea 40(%esp), %edx + fstl 16(%eax) + fldl _val_16_0@GOTOFF(%ebx) + fmulp %st, %st(1) + fstl 24(%eax) + fmul %st(0), %st + fstl 32(%eax) + fmul %st(0), %st + fxch %st(1) + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + movl $-1, 16(%esp) + fstpl 40(%eax) + call __libm_sincos_k32 +..B1.20: + fldl 72(%esp) + fldl 64(%esp) + fldl _tonpi@GOTOFF(%ebx) + fmull 48(%esp) + fsqrt + fldl 40+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fldl 32+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 8+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl _PP@GOTOFF(%ebx) + faddp %st, %st(1) + fldl 40+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + fmull 32(%esp) + fxch %st(1) + faddl 24+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fldl 32+_QP@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(1) + faddl 8+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + faddl 16+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + faddl _QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmull 56(%esp) + fmull 40(%esp) + faddp %st, %st(2) + fmulp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.21: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.27 +..B1.22: + testl %eax, %eax + je ..B1.28 +..B1.23: + fldz + testl $-2147483648, %edx + je ..B1.26 +..B1.25: + flds .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.26: + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.27: + flds 8(%ebp) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.28: + fldz + fdivrs .L_2il0floatpacket.0@GOTOFF(%ebx) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type y0f,@function + .size y0f,.-y0f + .data +# -- End y0f + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x7f800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_Q1: + .long 2580172613 + .long 3216172246 + .long 1084453148 + .long 1069988811 + .long 2056290550 + .long 3213915569 + .long 1236657422 + .long 1061266913 + .long 2321867150 + .long 3202594720 + .type _Q1,@object + .size _Q1,40 + .align 4 +_Q2: + .long 4294648676 + .long 3218079743 + .long 3841535415 + .long 1066401791 + .long 664070481 + .long 3208409496 + .long 1981210199 + .long 1054621065 + .type _Q2,@object + .size _Q2,32 + .align 4 +_P1: + .long 4195291908 + .long 3162175307 + .long 406986291 + .long 1072440375 + .long 2776221165 + .long 3219095096 + .long 1133938471 + .long 1070349075 + .long 2954828429 + .long 3217879437 + .long 2763399148 + .long 1070335612 + .long 808830809 + .long 3217701246 + .long 1570268664 + .long 1070154462 + .long 3296077481 + .long 3217609508 + .long 420330990 + .long 1070118798 + .long 773510171 + .long 3217614074 + .long 4056659129 + .long 1070174592 + .long 3219431954 + .long 3217750970 + .long 3785879815 + .long 1070358232 + .long 574751405 + .long 3217779900 + .long 4260549547 + .long 1069957964 + .long 2938320462 + .long 3216782740 + .long 3378329138 + .long 1068120728 + .long 1915664650 + .long 3213929269 + .long 3426344990 + .long 1063895342 + .long 349103460 + .long 3207738231 + .long 3100907498 + .long 1072470062 + .type _P1,@object + .size _P1,176 + .align 4 +_P2: + .long 1454683265 + .long 3163093641 + .long 1453379447 + .long 3218719554 + .long 687601567 + .long 1068108233 + .long 2612704149 + .long 1068365525 + .long 3658933664 + .long 3212579183 + .long 2932711330 + .long 3210863403 + .long 1642366143 + .long 1059690534 + .long 3271323791 + .long 1057665714 + .long 1907282597 + .long 3201598976 + .long 379771377 + .long 3197347542 + .long 4245487245 + .long 3193415108 + .long 3608497393 + .long 1045674492 + .long 2931231697 + .long 3190739602 + .long 990015633 + .long 1041359383 + .long 1316300206 + .long 3186258158 + .long 3640313785 + .long 3183477336 + .long 2399178872 + .long 3182342144 + .long 1279629276 + .long 1034489495 + .long 1301829276 + .long 1074768211 + .type _P2,@object + .size _P2,152 + .align 4 +_P3: + .long 2564005090 + .long 1014927793 + .long 2691273771 + .long 1070806220 + .long 300870104 + .long 3214257910 + .long 1691761700 + .long 3215496860 + .long 2795355208 + .long 1063989012 + .long 2286168356 + .long 1063375710 + .long 3010782666 + .long 3206704598 + .long 629642940 + .long 3204978559 + .long 4085313989 + .long 1053206786 + .long 1695842824 + .long 1050888907 + .long 399213285 + .long 3194002865 + .long 3012936744 + .long 3191097259 + .long 3874678520 + .long 1039019405 + .long 2821019721 + .long 1035940102 + .long 3303481603 + .long 1075599389 + .type _P3,@object + .size _P3,120 + .align 4 +_P4: + .long 3357785889 + .long 3165432791 + .long 3430075659 + .long 3218077237 + .long 1374220014 + .long 1065943908 + .long 2803440381 + .long 1067771495 + .long 3788987270 + .long 3210752606 + .long 378839180 + .long 3210732089 + .long 3385429871 + .long 1058535500 + .long 2609792408 + .long 1057402845 + .long 2316098656 + .long 3200270393 + .long 2785606124 + .long 3198332594 + .long 1489685130 + .long 1046034133 + .long 973177683 + .long 1043605688 + .long 113866720 + .long 3186126026 + .long 1355313597 + .long 3183357512 + .long 899972440 + .long 1076130263 + .type _P4,@object + .size _P4,120 + .align 4 +_P5: + .long 1219042543 + .long 1017436670 + .long 659497129 + .long 1070330666 + .long 2213395954 + .long 3212885037 + .long 920472610 + .long 3215092907 + .long 483400048 + .long 1062596670 + .long 3012498212 + .long 1063037606 + .long 1375970636 + .long 3205547500 + .long 3836089736 + .long 3204771982 + .long 199192965 + .long 1052233910 + .long 194857414 + .long 1050781561 + .long 2407988550 + .long 3193126966 + .long 3806101946 + .long 3190982557 + .long 3164279536 + .long 1038193510 + .long 3298944842 + .long 1076541665 + .type _P5,@object + .size _P5,112 + .align 4 +_P6: + .long 4139807906 + .long 1017960487 + .long 1501500641 + .long 3217630659 + .long 2447579003 + .long 1064854100 + .long 511348540 + .long 1067492433 + .long 1810619958 + .long 3209696179 + .long 1806624601 + .long 3210355872 + .long 4035698547 + .long 1057552651 + .long 467530437 + .long 1057185016 + .long 2985801821 + .long 3199346510 + .long 2460583618 + .long 3198194818 + .long 4117830692 + .long 1045310355 + .long 1133672721 + .long 1043441078 + .long 2717688296 + .long 3185336108 + .long 1946169876 + .long 1076920380 + .type _P6,@object + .size _P6,112 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_PP: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP,@object + .size _PP,48 + .align 4 +_QP: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP,@object + .size _QP,48 + .data + .hidden __libm_sincos_k32 + .hidden __libm_log_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/y0l.S b/external/sgx_libm/ia32/y0l.S new file mode 100644 index 0000000000..7e1c5ca464 --- /dev/null +++ b/external/sgx_libm/ia32/y0l.S @@ -0,0 +1,106 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y0l.c" + .text +..TXTST0: +# -- Begin y0l + .text + .align 16,0x90 + .globl y0l +y0l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + fldt 8(%ebp) + lea 16(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.6: + addl $-32, %esp + movl (%edi), %ecx + lea 64(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%edi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __y0q@PLT +..B1.5: + addl $28, %esp +..B1.2: + movl 32(%esp), %eax + movl %eax, (%edi) + movl 36(%esp), %edx + movl 40(%esp), %ecx + movl 44(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.7: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type y0l,@function + .size y0l,.-y0l + .data +# -- End y0l + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/y1.S b/external/sgx_libm/ia32/y1.S new file mode 100644 index 0000000000..2db65d362f --- /dev/null +++ b/external/sgx_libm/ia32/y1.S @@ -0,0 +1,3196 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y1.c" + .text +..TXTST0: +# -- Begin __y1l + .text + .align 16,0x90 + .hidden __y1l + .globl __y1l +__y1l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $120, %esp + fldt 8(%ebp) + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + fldt 132+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B1.14 +..B1.2: + fldt _val_1_77L@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.12 +..B1.3: + fldt _S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.5 +..B1.4: + fldt _Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt _Q1@GOTOFF(%ebx) + fmul %st(4), %st + fldt 12+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_Q1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 72+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 36+_Q1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_Q1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 120+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 132+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 60+_Q1@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 144+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fxch %st(1) + fdivrl _ones@GOTOFF(%ebx) + fldt 156+_P1@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fldt 168+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 180+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B1.19 +..B1.5: + fldt 12+_S@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.7 +..B1.6: + fldt 12+_Z@GOTOFF(%ebx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt _P2@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P2@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt _Q2@GOTOFF(%ebx) + fmul %st(4), %st + fldt 12+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 48+_P2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 60+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 24+_Q2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 72+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_P2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 36+_Q2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 96+_P2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 108+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_Q2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt 120+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 132+_P2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt 60+_Q2@GOTOFF(%ebx) + faddp %st, %st(2) + fldt 144+_P2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fxch %st(1) + fdivrl _ones@GOTOFF(%ebx) + fldt 156+_P2@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fldt 168+_P2@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 180+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B1.19 +..B1.7: + movl $2, %edx +..B1.8: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %ecx + fldt _S@GOTOFF(%ebx,%ecx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.11 + jp ..B1.11 +..B1.9: + incl %edx + cmpl $11, %edx + jl ..B1.8 +..B1.10: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx +..B1.11: + fldt _Z@GOTOFF(%ecx,%ebx) + movl %edx, %eax + fsubrp %st, %st(1) + shll $4, %eax + fld %st(0) + subl %edx, %eax + shll $4, %eax + fmul %st(1), %st + fstpt 92(%esp) + fldt 92(%esp) + fldt -480+_P@GOTOFF(%eax,%ebx) + fmul %st(1), %st + fldt -468+_P@GOTOFF(%eax,%ebx) + fmul %st(2), %st + fldt -456+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -444+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -432+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -420+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -408+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -396+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -384+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -372+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -360+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -348+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -336+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -324+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -312+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -300+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -288+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -276+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -264+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -252+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B1.19 +..B1.12: + fldt _P0@GOTOFF(%ebx) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(2) + fstpt 64(%esp) + fldt 64(%esp) + fxch %st(3) + fstpt 92(%esp) + fldt 92(%esp) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fldt 12+_P0@GOTOFF(%ebx) + fmul %st(4), %st + fldt 24+_P0@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 36+_P0@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 48+_P0@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 60+_P0@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 72+_P0@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 84+_P0@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(4) + fldt 96+_P0@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + fldt 108+_P0@GOTOFF(%ebx) + faddp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 32(%esp) + call __j1l@PLT +..B1.23: + fldt 8(%ebp) + fldt 32(%esp) +..B1.13: + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fstp %st(0) + fxch %st(1) + fstpt 48(%esp) + fstpt 32(%esp) + call logl@PLT +..B1.24: + fldt 8(%ebp) + fldt 32(%esp) + fldt 48(%esp) + fmulp %st, %st(3) + fldt _tonpi@GOTOFF(%ebx) + fldt _val_N1_0L@GOTOFF(%ebx) + fdivp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + jmp ..B1.19 +..B1.14: + fldl _ones@GOTOFF(%ebx) + lea 92(%esp), %eax + fdiv %st(1), %st + lea 64(%esp), %edx + fxch %st(1) + fxch %st(1) + fstpt -60(%eax) + fldt -60(%eax) + fxch %st(1) + fstpt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt -28(%eax) + fldt -28(%eax) + movl %eax, 12(%esp) + movl %edx, 16(%esp) + movl $-3, 20(%esp) + fxch %st(1) + fstpt (%eax) + fldt (%eax) + fldt _PP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -44(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt -12(%eax) + call __libm_sincos_pi4l +..B1.15: + fldt 8(%ebp) + fldt 80(%esp) + fldt 48(%esp) + fldt 92(%esp) + fmulp %st, %st(1) + fldt 64(%esp) + fmulp %st, %st(2) + fadd %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B1.17 + jp ..B1.17 +..B1.16: + fstp %st(1) + fldt _tonpi@GOTOFF(%ebx) + fldt 32(%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + jmp ..B1.19 +..B1.17: + fstp %st(0) + lea 32(%esp), %edi + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.26: + addl $-32, %esp + movl (%edi), %ecx + lea 80(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%edi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __y1q@PLT +..B1.25: + addl $28, %esp +..B1.18: + movl 48(%esp), %eax + movl %eax, (%edi) + movl 52(%esp), %edx + movl 56(%esp), %ecx + movl 60(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.19: + addl $120, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type __y1l,@function + .size __y1l,.-__y1l + .data +# -- End __y1l + .text +# -- Begin y1 + .text + .align 16,0x90 + .globl y1 +y1: +# parameter 1: 8 + %ebp +..B2.1: +..L3: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $116, %esp +..B2.2: + fnstcw 46(%esp) +..B2.3: + movl 12(%ebp), %edx + movl %edx, %esi + andl $2147483647, %esi + call ..L4 +..L4: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L4](%ebx), %ebx + cmpl $2146435072, %esi + jge ..B2.30 +..B2.4: + xorl %eax, %eax + movl 8(%ebp), %ecx + subl %eax, %edx + jl ..B2.37 +..B2.44: + orl %ecx, %edx + je ..B2.37 +..B2.5: + movzwl 46(%esp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.36 +..B2.6: + orl $-64768, %edx + movw %dx, 44(%esp) +..B2.7: + fldcw 44(%esp) +..B2.8: + movl $1, %edi +..B2.9: + fldl 8(%ebp) + fstpt 72(%esp) + fldt 72(%esp) + fldt 132+_S@GOTOFF(%ebx) + fcompp + fnstsw %ax + sahf + jb ..B2.22 +..B2.10: + fldt _val_1_77L@GOTOFF(%ebx) + fldt 72(%esp) + fcompp + fnstsw %ax + sahf + jp ..B2.11 + jb ..B2.20 +..B2.11: + fldt _S@GOTOFF(%ebx) + fldt 72(%esp) + fcompp + fnstsw %ax + sahf + jae ..B2.13 + jp ..B2.13 +..B2.12: + fldt _Z@GOTOFF(%ebx) + fldt 72(%esp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + fldt _P1@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P1@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 168+_P1@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 180+_P1@GOTOFF(%ebx) + faddp %st, %st(2) + fldt _Q1@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 60+_Q1@GOTOFF(%ebx) + faddp %st, %st(1) + fdivrl _ones@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 72(%esp) + jmp ..B2.27 +..B2.13: + fldt 12+_S@GOTOFF(%ebx) + fldt 72(%esp) + fcompp + fnstsw %ax + sahf + jae ..B2.15 + jp ..B2.15 +..B2.14: + fldt 12+_Z@GOTOFF(%ebx) + fldt 72(%esp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + fldt _P2@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_P2@GOTOFF(%ebx) + fmul %st(2), %st + fldt 24+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 72+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 108+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 120+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 132+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 156+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 168+_P2@GOTOFF(%ebx) + faddp %st, %st(1) + fldt 180+_P2@GOTOFF(%ebx) + faddp %st, %st(2) + fldt _Q2@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 60+_Q2@GOTOFF(%ebx) + faddp %st, %st(1) + fdivrl _ones@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 72(%esp) + jmp ..B2.27 +..B2.15: + fldt 72(%esp) + movl $2, %edx +..B2.16: + lea (,%edx,8), %ecx + lea (%ecx,%edx,4), %ecx + fldt _S@GOTOFF(%ebx,%ecx) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B2.35 + jp ..B2.35 +..B2.17: + incl %edx + cmpl $11, %edx + jl ..B2.16 +..B2.18: + lea (,%edx,8), %eax + lea (%eax,%edx,4), %ecx + fstp %st(0) +..B2.19: + fldt _Z@GOTOFF(%ecx,%ebx) + movl %edx, %eax + fldt 72(%esp) + shll $4, %eax + fsubp %st, %st(1) + subl %edx, %eax + fld %st(0) + shll $4, %eax + fmul %st(1), %st + fstpt 60(%esp) + fldt 60(%esp) + fldt -480+_P@GOTOFF(%eax,%ebx) + fmul %st(1), %st + fldt -468+_P@GOTOFF(%eax,%ebx) + fmul %st(2), %st + fldt -456+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -444+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -432+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -420+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -408+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -396+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -384+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -372+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -360+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -348+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -336+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -324+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -312+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -300+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -288+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -276+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -264+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -252+_P@GOTOFF(%eax,%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 72(%esp) + jmp ..B2.27 +..B2.20: + fldt 72(%esp) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fstpt 60(%esp) + fldt 60(%esp) + fldt _P0@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_P0@GOTOFF(%ebx) + fmul %st(3), %st + fldt 24+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 36+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 72+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt 96+_P0@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 108+_P0@GOTOFF(%ebx) + faddp %st, %st(2) + faddp %st, %st(1) + fmul %st(1), %st + fstpt (%esp) + addl $-16, %esp + fstpt (%esp) + call __j1l@PLT +..B2.45: + fstpt 32(%esp) +..B2.21: + fldt 88(%esp) + fstpt (%esp) + call logl@PLT +..B2.46: + fldt _tonpi@GOTOFF(%ebx) + addl $16, %esp + fldt 16(%esp) + fmulp %st, %st(2) + fldt 72(%esp) + fldt (%esp) + fldt _val_N1_0L@GOTOFF(%ebx) + fdivp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 72(%esp) + jmp ..B2.27 +..B2.22: + fldl _ones@GOTOFF(%ebx) + fldt 72(%esp) + fdivr %st, %st(1) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fldt _val_36_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 32(%esp) + fldt 32(%esp) + fxch %st(1) + fstpt 60(%esp) + fldt 60(%esp) + addl $-32, %esp + lea 92(%esp), %eax + lea 64(%esp), %edx + fxch %st(2) + fstpt (%esp) + fldt _PP@GOTOFF(%ebx) + fmul %st(1), %st + fldt 12+_PP@GOTOFF(%ebx) + movl %eax, 12(%esp) + faddp %st, %st(1) + fmul %st(1), %st + fldt _QP@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_QP@GOTOFF(%ebx) + movl %edx, 16(%esp) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP@GOTOFF(%ebx) + movl $-3, 20(%esp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 24+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 36+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 36+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 60+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 60+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 72+_PP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 84+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 84+_QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 108+_PP@GOTOFF(%ebx) + faddp %st, %st(1) + fstpt -44(%eax) + fldt 108+_QP@GOTOFF(%ebx) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -12(%eax) + call __libm_sincos_pi4l +..B2.47: + fldt 80(%esp) + fldt 48(%esp) + addl $32, %esp +..B2.23: + fldt 60(%esp) + fmulp %st, %st(1) + fldt 32(%esp) + fmulp %st, %st(2) + fadd %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt _val_0_03L@GOTOFF(%ebx) + fmulp %st, %st(1) + fcompp + fnstsw %ax + sahf + jae ..B2.25 + jp ..B2.25 +..B2.24: + fldt _tonpi@GOTOFF(%ebx) + fldt (%esp) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + fstpt 72(%esp) + jmp ..B2.27 +..B2.25: + fstp %st(0) + addl $-16, %esp + lea 16(%esp), %esi + movl %esi, (%esp) + fldt 72(%esi) + fstpt 4(%esp) + call __ltoq@PLT +..B2.49: + addl $-16, %esp + movl (%esi), %ecx + lea 48(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%esi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%esi), %ecx + movl 12(%esi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __y1q@PLT +..B2.48: + addl $28, %esp +..B2.26: + movl 16(%esp), %eax + movl %eax, (%esi) + movl 20(%esp), %edx + movl 24(%esp), %ecx + movl 28(%esp), %eax + addl $-16, %esp + movl %edx, 4(%esi) + movl %ecx, 8(%esi) + movl %eax, 12(%esi) + movl %esi, (%esp) + call __qtol@PLT +..B2.50: + fstpt 88(%esp) + addl $16, %esp +..B2.27: + testl %edi, %edi + je ..B2.29 +..B2.28: + fldcw 46(%esp) +..B2.29: + fldt 72(%esp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.30: + andl $-2146435073, %esi + orl 8(%ebp), %esi + jne ..B2.34 +..B2.31: + testl $-2147483648, %edx + jne ..B2.41 +..B2.32: + shrl $31, %edx + fldl _zeros@GOTOFF(%ebx,%edx,8) +..B2.33: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.34: + fldl 8(%ebp) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.35: + fstp %st(0) + jmp ..B2.19 +..B2.36: + xorl %edi, %edi + jmp ..B2.9 +..B2.37: + fldl _zeros@GOTOFF(%ebx) + orl %ecx, %esi + je ..B2.39 +..B2.38: + fldl _infs@GOTOFF(%ebx) + fmulp %st, %st(1) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.39: + fldl 8+_ones@GOTOFF(%ebx) + fdivp %st, %st(1) +..B2.40: + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B2.41: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + addl $116, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type y1,@function + .size y1,.-y1 + .data +# -- End y1 + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_S: + .word 56848 + .word 49844 + .word 39532 + .word 64842 + .word 16384 + .word 0 + .word 5940 + .word 14600 + .word 60967 + .word 58048 + .word 16385 + .word 0 + .word 48233 + .word 9194 + .word 47533 + .word 41870 + .word 16386 + .word 0 + .word 19716 + .word 3898 + .word 3621 + .word 54727 + .word 16386 + .word 0 + .word 41547 + .word 400 + .word 58272 + .word 33793 + .word 16387 + .word 0 + .word 46312 + .word 65374 + .word 26362 + .word 40225 + .word 16387 + .word 0 + .word 15253 + .word 48480 + .word 38891 + .word 46657 + .word 16387 + .word 0 + .word 12158 + .word 16394 + .word 14239 + .word 53090 + .word 16387 + .word 0 + .word 31253 + .word 2914 + .word 8779 + .word 59523 + .word 16387 + .word 0 + .word 29606 + .word 9567 + .word 8455 + .word 32978 + .word 16388 + .word 0 + .word 51148 + .word 41491 + .word 50276 + .word 36194 + .word 16388 + .word 0 + .word 1224 + .word 58769 + .word 30330 + .word 39411 + .word 16388 + .word 0 + .type _S,@object + .size _S,144 + .align 2 +_val_1_77L: + .word 36700 + .word 62914 + .word 23592 + .word 57999 + .word 16383 + .word 0 + .type _val_1_77L,@object + .size _val_1_77L,12 + .align 2 +_Z: + .word 5921 + .word 65426 + .word 63142 + .word 35997 + .word 16384 + .word 0 + .word 29632 + .word 15745 + .word 62068 + .word 44479 + .word 16385 + .word 0 + .word 41288 + .word 2893 + .word 15731 + .word 35209 + .word 16386 + .word 0 + .word 12322 + .word 41360 + .word 35270 + .word 48124 + .word 16386 + .word 0 + .word 21828 + .word 62500 + .word 60486 + .word 61019 + .word 16386 + .word 0 + .word 54460 + .word 63729 + .word 58186 + .word 36952 + .word 16387 + .word 0 + .word 27250 + .word 3142 + .word 10825 + .word 43393 + .word 16387 + .word 0 + .word 20649 + .word 49414 + .word 53633 + .word 49831 + .word 16387 + .word 0 + .word 59160 + .word 26587 + .word 26484 + .word 56269 + .word 16387 + .word 0 + .word 57283 + .word 10561 + .word 16432 + .word 62706 + .word 16387 + .word 0 + .word 44243 + .word 51162 + .word 18495 + .word 34571 + .word 16388 + .word 0 + .word 63781 + .word 54231 + .word 15770 + .word 37789 + .word 16388 + .word 0 + .type _Z,@object + .size _Z,144 + .align 2 +_P1: + .word 21770 + .word 62666 + .word 46899 + .word 35378 + .word 16344 + .word 0 + .word 28454 + .word 23396 + .word 41885 + .word 48017 + .word 49112 + .word 0 + .word 61344 + .word 9332 + .word 29378 + .word 47284 + .word 49120 + .word 0 + .word 60127 + .word 25512 + .word 35054 + .word 43181 + .word 16353 + .word 0 + .word 25808 + .word 25324 + .word 9989 + .word 53047 + .word 16359 + .word 0 + .word 46582 + .word 21062 + .word 5476 + .word 44690 + .word 49126 + .word 0 + .word 61332 + .word 1419 + .word 18476 + .word 34785 + .word 49134 + .word 0 + .word 51513 + .word 63307 + .word 40855 + .word 38307 + .word 49134 + .word 0 + .word 22560 + .word 55588 + .word 5655 + .word 48627 + .word 16371 + .word 0 + .word 56966 + .word 1018 + .word 54245 + .word 62436 + .word 16372 + .word 0 + .word 17453 + .word 15035 + .word 65421 + .word 57312 + .word 49143 + .word 0 + .word 53367 + .word 52143 + .word 3664 + .word 58921 + .word 49145 + .word 0 + .word 16321 + .word 41163 + .word 52734 + .word 35978 + .word 16377 + .word 0 + .word 15288 + .word 52738 + .word 13594 + .word 53174 + .word 16380 + .word 0 + .word 42685 + .word 25071 + .word 48779 + .word 62301 + .word 16380 + .word 0 + .word 7354 + .word 8216 + .word 60720 + .word 54923 + .word 49085 + .word 0 + .type _P1,@object + .size _P1,192 + .align 2 +_Q1: + .word 64227 + .word 6706 + .word 76 + .word 58690 + .word 16369 + .word 0 + .word 8371 + .word 16695 + .word 56692 + .word 45251 + .word 16372 + .word 0 + .word 9179 + .word 20845 + .word 29706 + .word 43997 + .word 16377 + .word 0 + .word 44943 + .word 15045 + .word 18794 + .word 45614 + .word 16380 + .word 0 + .word 10671 + .word 41768 + .word 56247 + .word 64663 + .word 16381 + .word 0 + .word 25530 + .word 4231 + .word 4140 + .word 59815 + .word 16381 + .word 0 + .type _Q1,@object + .size _Q1,72 + .align 2 +_P2: + .word 42420 + .word 39002 + .word 59647 + .word 60050 + .word 16339 + .word 0 + .word 9209 + .word 30875 + .word 32003 + .word 38109 + .word 49111 + .word 0 + .word 63337 + .word 29381 + .word 46828 + .word 35859 + .word 49116 + .word 0 + .word 25340 + .word 63034 + .word 61574 + .word 39960 + .word 16351 + .word 0 + .word 21587 + .word 1531 + .word 17186 + .word 56230 + .word 16355 + .word 0 + .word 35654 + .word 56865 + .word 61897 + .word 49746 + .word 49126 + .word 0 + .word 6701 + .word 41291 + .word 18798 + .word 55141 + .word 49130 + .word 0 + .word 35596 + .word 2936 + .word 34861 + .word 35797 + .word 16365 + .word 0 + .word 59382 + .word 44988 + .word 46794 + .word 33373 + .word 16369 + .word 0 + .word 39208 + .word 51898 + .word 38063 + .word 56363 + .word 49138 + .word 0 + .word 34426 + .word 35681 + .word 546 + .word 45071 + .word 49142 + .word 0 + .word 27055 + .word 35919 + .word 19182 + .word 39238 + .word 16375 + .word 0 + .word 11379 + .word 16934 + .word 10723 + .word 57120 + .word 16378 + .word 0 + .word 30778 + .word 48366 + .word 51582 + .word 60462 + .word 49145 + .word 0 + .word 38504 + .word 65531 + .word 34807 + .word 43722 + .word 49149 + .word 0 + .word 52867 + .word 16075 + .word 29885 + .word 33161 + .word 49086 + .word 0 + .type _P2,@object + .size _P2,192 + .align 2 +_Q2: + .word 24596 + .word 8363 + .word 28671 + .word 51312 + .word 16360 + .word 0 + .word 22889 + .word 23763 + .word 37225 + .word 46345 + .word 16361 + .word 0 + .word 24119 + .word 47441 + .word 54379 + .word 48688 + .word 16372 + .word 0 + .word 1240 + .word 59184 + .word 48701 + .word 46748 + .word 16374 + .word 0 + .word 22888 + .word 65215 + .word 58633 + .word 45869 + .word 16380 + .word 0 + .word 31023 + .word 50278 + .word 49158 + .word 64237 + .word 16382 + .word 0 + .type _Q2,@object + .size _Q2,72 + .align 2 +_P: + .word 61722 + .word 43505 + .word 23994 + .word 37346 + .word 49091 + .word 0 + .word 30291 + .word 24028 + .word 22863 + .word 34750 + .word 49095 + .word 0 + .word 1126 + .word 901 + .word 35659 + .word 64778 + .word 16331 + .word 0 + .word 24961 + .word 30514 + .word 59096 + .word 39096 + .word 16335 + .word 0 + .word 35564 + .word 61687 + .word 10716 + .word 35707 + .word 49108 + .word 0 + .word 46848 + .word 13986 + .word 10777 + .word 37699 + .word 49111 + .word 0 + .word 25983 + .word 4211 + .word 22533 + .word 63008 + .word 16347 + .word 0 + .word 41622 + .word 55080 + .word 16927 + .word 53017 + .word 16350 + .word 0 + .word 59504 + .word 42891 + .word 54413 + .word 41203 + .word 49123 + .word 0 + .word 12571 + .word 13616 + .word 30559 + .word 53698 + .word 49125 + .word 0 + .word 24504 + .word 22188 + .word 22875 + .word 38390 + .word 16362 + .word 0 + .word 45455 + .word 51567 + .word 14687 + .word 35767 + .word 16364 + .word 0 + .word 2489 + .word 10124 + .word 54664 + .word 47037 + .word 49136 + .word 0 + .word 18722 + .word 39166 + .word 48910 + .word 55942 + .word 49137 + .word 0 + .word 52167 + .word 5 + .word 15467 + .word 33747 + .word 16374 + .word 0 + .word 64650 + .word 13451 + .word 38167 + .word 40566 + .word 16374 + .word 0 + .word 40279 + .word 20454 + .word 61426 + .word 45514 + .word 49146 + .word 0 + .word 34995 + .word 30989 + .word 51614 + .word 33113 + .word 49145 + .word 0 + .word 57629 + .word 30042 + .word 51710 + .word 35580 + .word 16381 + .word 0 + .word 22801 + .word 35092 + .word 8589 + .word 55177 + .word 16319 + .word 0 + .word 18213 + .word 9889 + .word 16490 + .word 42684 + .word 16323 + .word 0 + .word 35117 + .word 3709 + .word 30056 + .word 56315 + .word 16326 + .word 0 + .word 23979 + .word 26668 + .word 51699 + .word 63315 + .word 49099 + .word 0 + .word 37328 + .word 63574 + .word 8303 + .word 34466 + .word 49103 + .word 0 + .word 46391 + .word 17329 + .word 18036 + .word 35570 + .word 16340 + .word 0 + .word 30054 + .word 21312 + .word 25061 + .word 63482 + .word 16342 + .word 0 + .word 2570 + .word 34880 + .word 30954 + .word 61846 + .word 49115 + .word 0 + .word 48934 + .word 61799 + .word 17650 + .word 43599 + .word 49118 + .word 0 + .word 9996 + .word 54252 + .word 12364 + .word 40067 + .word 16355 + .word 0 + .word 26028 + .word 41231 + .word 49512 + .word 42301 + .word 16357 + .word 0 + .word 36582 + .word 15370 + .word 8472 + .word 36675 + .word 49130 + .word 0 + .word 63654 + .word 5080 + .word 49106 + .word 53579 + .word 49131 + .word 0 + .word 31057 + .word 54537 + .word 2640 + .word 43916 + .word 16368 + .word 0 + .word 21142 + .word 46896 + .word 24614 + .word 39087 + .word 16369 + .word 0 + .word 3964 + .word 40668 + .word 52365 + .word 60967 + .word 49141 + .word 0 + .word 39332 + .word 9457 + .word 22878 + .word 52919 + .word 49141 + .word 0 + .word 54210 + .word 18213 + .word 48816 + .word 39742 + .word 16378 + .word 0 + .word 59971 + .word 56061 + .word 65402 + .word 41492 + .word 16376 + .word 0 + .word 50867 + .word 29775 + .word 29962 + .word 60938 + .word 49148 + .word 0 + .word 39008 + .word 10804 + .word 60432 + .word 53771 + .word 49083 + .word 0 + .word 8797 + .word 29964 + .word 61128 + .word 42619 + .word 49091 + .word 0 + .word 49667 + .word 64253 + .word 56687 + .word 49119 + .word 49094 + .word 0 + .word 12708 + .word 20574 + .word 59517 + .word 62457 + .word 16331 + .word 0 + .word 61123 + .word 30114 + .word 53775 + .word 59072 + .word 16334 + .word 0 + .word 12480 + .word 24376 + .word 40478 + .word 34829 + .word 49108 + .word 0 + .word 31610 + .word 2541 + .word 29797 + .word 53230 + .word 49110 + .word 0 + .word 57351 + .word 51530 + .word 20151 + .word 60005 + .word 16347 + .word 0 + .word 27929 + .word 50140 + .word 46261 + .word 35597 + .word 16350 + .word 0 + .word 13266 + .word 42539 + .word 17988 + .word 38413 + .word 49123 + .word 0 + .word 60482 + .word 30188 + .word 54757 + .word 33461 + .word 49125 + .word 0 + .word 28412 + .word 55589 + .word 45206 + .word 34637 + .word 16362 + .word 0 + .word 32067 + .word 62816 + .word 60815 + .word 40858 + .word 16363 + .word 0 + .word 5401 + .word 9100 + .word 50782 + .word 40732 + .word 49136 + .word 0 + .word 54621 + .word 58390 + .word 59249 + .word 57428 + .word 49136 + .word 0 + .word 35825 + .word 1375 + .word 322 + .word 55483 + .word 16373 + .word 0 + .word 16432 + .word 16110 + .word 8852 + .word 37720 + .word 16373 + .word 0 + .word 5000 + .word 34131 + .word 51425 + .word 35608 + .word 49146 + .word 0 + .word 53929 + .word 6276 + .word 23388 + .word 58152 + .word 49143 + .word 0 + .word 51579 + .word 17004 + .word 5616 + .word 54145 + .word 16380 + .word 0 + .word 7103 + .word 16103 + .word 63732 + .word 61608 + .word 16316 + .word 0 + .word 53540 + .word 14563 + .word 28490 + .word 42103 + .word 16323 + .word 0 + .word 50538 + .word 7801 + .word 54621 + .word 42667 + .word 16326 + .word 0 + .word 21289 + .word 53272 + .word 50234 + .word 61084 + .word 49099 + .word 0 + .word 53615 + .word 53374 + .word 57363 + .word 50528 + .word 49102 + .word 0 + .word 54514 + .word 9539 + .word 36475 + .word 33817 + .word 16340 + .word 0 + .word 31658 + .word 4746 + .word 1163 + .word 44700 + .word 16342 + .word 0 + .word 52867 + .word 45166 + .word 52684 + .word 57761 + .word 49115 + .word 0 + .word 48341 + .word 5188 + .word 19803 + .word 58551 + .word 49117 + .word 0 + .word 18455 + .word 50865 + .word 10646 + .word 36603 + .word 16355 + .word 0 + .word 16819 + .word 38651 + .word 15489 + .word 53797 + .word 16356 + .word 0 + .word 57587 + .word 29612 + .word 6330 + .word 65256 + .word 49129 + .word 0 + .word 60926 + .word 53369 + .word 5356 + .word 64182 + .word 49130 + .word 0 + .word 26295 + .word 42515 + .word 37715 + .word 37910 + .word 16368 + .word 0 + .word 26848 + .word 34589 + .word 11687 + .word 44170 + .word 16368 + .word 0 + .word 52547 + .word 41404 + .word 29188 + .word 51071 + .word 49141 + .word 0 + .word 59720 + .word 37814 + .word 50864 + .word 57112 + .word 49140 + .word 0 + .word 63754 + .word 1059 + .word 28610 + .word 65011 + .word 16377 + .word 0 + .word 48135 + .word 53252 + .word 54091 + .word 43638 + .word 16375 + .word 0 + .word 14971 + .word 8471 + .word 3609 + .word 49212 + .word 49148 + .word 0 + .word 4052 + .word 57147 + .word 31484 + .word 54446 + .word 16318 + .word 0 + .word 11824 + .word 2112 + .word 5588 + .word 41288 + .word 49091 + .word 0 + .word 30937 + .word 56824 + .word 10791 + .word 37103 + .word 49094 + .word 0 + .word 13479 + .word 25038 + .word 44704 + .word 59408 + .word 16331 + .word 0 + .word 6837 + .word 41457 + .word 42451 + .word 43375 + .word 16334 + .word 0 + .word 53800 + .word 46435 + .word 51001 + .word 65352 + .word 49107 + .word 0 + .word 15811 + .word 55852 + .word 5902 + .word 37814 + .word 49110 + .word 0 + .word 19663 + .word 64639 + .word 1883 + .word 55408 + .word 16347 + .word 0 + .word 5332 + .word 44968 + .word 15414 + .word 48765 + .word 16349 + .word 0 + .word 24635 + .word 46043 + .word 59114 + .word 34832 + .word 49123 + .word 0 + .word 15088 + .word 55241 + .word 15044 + .word 44102 + .word 49124 + .word 0 + .word 6405 + .word 38383 + .word 37570 + .word 61587 + .word 16361 + .word 0 + .word 22931 + .word 45450 + .word 10147 + .word 51835 + .word 16362 + .word 0 + .word 64299 + .word 50831 + .word 27180 + .word 35495 + .word 49136 + .word 0 + .word 23200 + .word 7806 + .word 1364 + .word 35222 + .word 49136 + .word 0 + .word 45807 + .word 4679 + .word 55327 + .word 47491 + .word 16373 + .word 0 + .word 30764 + .word 65323 + .word 55387 + .word 45120 + .word 16372 + .word 0 + .word 15039 + .word 21256 + .word 11217 + .word 60156 + .word 49145 + .word 0 + .word 57173 + .word 14361 + .word 2624 + .word 34299 + .word 49143 + .word 0 + .word 56410 + .word 62508 + .word 42699 + .word 45420 + .word 16380 + .word 0 + .word 50446 + .word 42024 + .word 63781 + .word 38435 + .word 49087 + .word 0 + .word 10333 + .word 60348 + .word 17128 + .word 40300 + .word 16323 + .word 0 + .word 43838 + .word 25371 + .word 62467 + .word 64794 + .word 16325 + .word 0 + .word 26845 + .word 6377 + .word 43437 + .word 57595 + .word 49099 + .word 0 + .word 7442 + .word 5283 + .word 26036 + .word 37481 + .word 49102 + .word 0 + .word 15454 + .word 29184 + .word 54291 + .word 63010 + .word 16339 + .word 0 + .word 5297 + .word 38874 + .word 4456 + .word 64615 + .word 16341 + .word 0 + .word 12966 + .word 61910 + .word 53167 + .word 53110 + .word 49115 + .word 0 + .word 20395 + .word 4102 + .word 12283 + .word 41188 + .word 49117 + .word 0 + .word 19094 + .word 29300 + .word 12828 + .word 33187 + .word 16355 + .word 0 + .word 28120 + .word 22694 + .word 2680 + .word 36839 + .word 16356 + .word 0 + .word 25698 + .word 43431 + .word 60429 + .word 58329 + .word 49129 + .word 0 + .word 59006 + .word 57475 + .word 62067 + .word 42866 + .word 49130 + .word 0 + .word 60088 + .word 17714 + .word 44332 + .word 33435 + .word 16368 + .word 0 + .word 3844 + .word 12917 + .word 11965 + .word 57777 + .word 16367 + .word 0 + .word 17310 + .word 43236 + .word 29566 + .word 44535 + .word 49141 + .word 0 + .word 38891 + .word 11594 + .word 35001 + .word 36788 + .word 49140 + .word 0 + .word 62784 + .word 19866 + .word 27725 + .word 56232 + .word 16377 + .word 0 + .word 26552 + .word 62874 + .word 50518 + .word 55747 + .word 16374 + .word 0 + .word 41449 + .word 54733 + .word 7288 + .word 42389 + .word 49148 + .word 0 + .word 25436 + .word 16965 + .word 21076 + .word 40960 + .word 16320 + .word 0 + .word 39083 + .word 3258 + .word 61438 + .word 39229 + .word 49091 + .word 0 + .word 62602 + .word 12963 + .word 51303 + .word 56904 + .word 49093 + .word 0 + .word 41532 + .word 46799 + .word 27449 + .word 55757 + .word 16331 + .word 0 + .word 25508 + .word 35836 + .word 14539 + .word 65290 + .word 16333 + .word 0 + .word 34796 + .word 56106 + .word 58112 + .word 60724 + .word 49107 + .word 0 + .word 52331 + .word 50671 + .word 56071 + .word 55789 + .word 49109 + .word 0 + .word 50430 + .word 49256 + .word 15625 + .word 50948 + .word 16347 + .word 0 + .word 15753 + .word 56169 + .word 3376 + .word 35261 + .word 16349 + .word 0 + .word 47489 + .word 43658 + .word 29070 + .word 63380 + .word 49122 + .word 0 + .word 14447 + .word 45157 + .word 5 + .word 62576 + .word 49123 + .word 0 + .word 14392 + .word 17120 + .word 59854 + .word 55457 + .word 16361 + .word 0 + .word 2389 + .word 54610 + .word 7938 + .word 36154 + .word 16362 + .word 0 + .word 24225 + .word 54966 + .word 22944 + .word 63335 + .word 49135 + .word 0 + .word 6246 + .word 36346 + .word 2616 + .word 48455 + .word 49135 + .word 0 + .word 61678 + .word 13662 + .word 7713 + .word 42050 + .word 16373 + .word 0 + .word 4329 + .word 54820 + .word 31411 + .word 61458 + .word 16371 + .word 0 + .word 48026 + .word 57812 + .word 53661 + .word 52979 + .word 49145 + .word 0 + .word 47545 + .word 24071 + .word 10224 + .word 46463 + .word 49142 + .word 0 + .word 51405 + .word 19517 + .word 26454 + .word 39893 + .word 16380 + .word 0 + .word 2714 + .word 52847 + .word 64285 + .word 36922 + .word 49088 + .word 0 + .word 51895 + .word 36793 + .word 33802 + .word 38136 + .word 16323 + .word 0 + .word 2488 + .word 31490 + .word 30800 + .word 50300 + .word 16325 + .word 0 + .word 13623 + .word 29920 + .word 59063 + .word 53960 + .word 49099 + .word 0 + .word 4071 + .word 44015 + .word 56417 + .word 57333 + .word 49101 + .word 0 + .word 57861 + .word 52773 + .word 20389 + .word 58553 + .word 16339 + .word 0 + .word 64934 + .word 37948 + .word 51829 + .word 48662 + .word 16341 + .word 0 + .word 56954 + .word 19807 + .word 167 + .word 48948 + .word 49115 + .word 0 + .word 28104 + .word 12997 + .word 51038 + .word 61119 + .word 49116 + .word 0 + .word 3409 + .word 4305 + .word 3650 + .word 60679 + .word 16354 + .word 0 + .word 43193 + .word 24597 + .word 44129 + .word 53916 + .word 16355 + .word 0 + .word 17521 + .word 14667 + .word 10096 + .word 52923 + .word 49129 + .word 0 + .word 55445 + .word 18677 + .word 32228 + .word 61988 + .word 49129 + .word 0 + .word 19057 + .word 4855 + .word 59096 + .word 60271 + .word 16367 + .word 0 + .word 13479 + .word 55645 + .word 42570 + .word 41372 + .word 16367 + .word 0 + .word 1282 + .word 28535 + .word 31957 + .word 39927 + .word 49141 + .word 0 + .word 572 + .word 61602 + .word 36341 + .word 52326 + .word 49139 + .word 0 + .word 28923 + .word 3577 + .word 27552 + .word 50228 + .word 16377 + .word 0 + .word 55167 + .word 15365 + .word 46318 + .word 39497 + .word 16374 + .word 0 + .word 19602 + .word 36437 + .word 16591 + .word 37792 + .word 49148 + .word 0 + .word 46605 + .word 39778 + .word 56315 + .word 52295 + .word 16316 + .word 0 + .word 30298 + .word 45364 + .word 48554 + .word 37056 + .word 49091 + .word 0 + .word 36916 + .word 47157 + .word 55353 + .word 44757 + .word 49093 + .word 0 + .word 36754 + .word 52515 + .word 12207 + .word 52242 + .word 16331 + .word 0 + .word 22625 + .word 1809 + .word 14640 + .word 50749 + .word 16333 + .word 0 + .word 16563 + .word 52625 + .word 13365 + .word 56520 + .word 49107 + .word 0 + .word 27329 + .word 9102 + .word 21835 + .word 42848 + .word 49109 + .word 0 + .word 25313 + .word 26147 + .word 37973 + .word 47112 + .word 16347 + .word 0 + .word 62093 + .word 47762 + .word 2878 + .word 53553 + .word 16348 + .word 0 + .word 45304 + .word 46632 + .word 22697 + .word 58245 + .word 49122 + .word 0 + .word 52304 + .word 22429 + .word 48300 + .word 47033 + .word 49123 + .word 0 + .word 1240 + .word 8778 + .word 3434 + .word 50676 + .word 16361 + .word 0 + .word 64382 + .word 35832 + .word 24068 + .word 53872 + .word 16361 + .word 0 + .word 9372 + .word 49794 + .word 11542 + .word 57592 + .word 49135 + .word 0 + .word 29118 + .word 43193 + .word 8003 + .word 35849 + .word 49135 + .word 0 + .word 3582 + .word 16932 + .word 42429 + .word 38089 + .word 16373 + .word 0 + .word 26846 + .word 61869 + .word 11277 + .word 45246 + .word 16371 + .word 0 + .word 12490 + .word 64508 + .word 30037 + .word 47862 + .word 49145 + .word 0 + .word 36625 + .word 65383 + .word 13633 + .word 34114 + .word 49142 + .word 0 + .word 6011 + .word 54183 + .word 37651 + .word 35991 + .word 16380 + .word 0 + .word 43024 + .word 51442 + .word 35220 + .word 35244 + .word 16321 + .word 0 + .word 2338 + .word 9974 + .word 58099 + .word 36011 + .word 16323 + .word 0 + .word 54231 + .word 56678 + .word 56840 + .word 40082 + .word 16325 + .word 0 + .word 47406 + .word 57592 + .word 65286 + .word 50617 + .word 49099 + .word 0 + .word 15992 + .word 46142 + .word 20381 + .word 45257 + .word 49101 + .word 0 + .word 17722 + .word 6937 + .word 55940 + .word 54630 + .word 16339 + .word 0 + .word 44953 + .word 7303 + .word 1203 + .word 38053 + .word 16341 + .word 0 + .word 9155 + .word 41724 + .word 2745 + .word 45433 + .word 49115 + .word 0 + .word 23208 + .word 13836 + .word 51920 + .word 47377 + .word 49116 + .word 0 + .word 46053 + .word 58453 + .word 7516 + .word 56049 + .word 16354 + .word 0 + .word 51100 + .word 31216 + .word 1872 + .word 41469 + .word 16355 + .word 0 + .word 24653 + .word 32384 + .word 37643 + .word 48672 + .word 49129 + .word 0 + .word 61101 + .word 35176 + .word 37213 + .word 47362 + .word 49129 + .word 0 + .word 62301 + .word 22066 + .word 41591 + .word 55226 + .word 16367 + .word 0 + .word 37791 + .word 15476 + .word 41140 + .word 62892 + .word 16366 + .word 0 + .word 18919 + .word 33505 + .word 35758 + .word 36479 + .word 49141 + .word 0 + .word 58610 + .word 16753 + .word 52674 + .word 39626 + .word 49139 + .word 0 + .word 19653 + .word 21667 + .word 11428 + .word 45800 + .word 16377 + .word 0 + .word 51212 + .word 10491 + .word 15737 + .word 59703 + .word 16373 + .word 0 + .word 54759 + .word 31668 + .word 63308 + .word 34425 + .word 49148 + .word 0 + .word 62523 + .word 11996 + .word 50486 + .word 33912 + .word 49089 + .word 0 + .type _P,@object + .size _P,2400 + .align 2 +_P0: + .word 10891 + .word 2847 + .word 4043 + .word 50135 + .word 16324 + .word 0 + .word 8878 + .word 10523 + .word 36094 + .word 35357 + .word 49101 + .word 0 + .word 12191 + .word 2098 + .word 38631 + .word 38182 + .word 16341 + .word 0 + .word 58416 + .word 39431 + .word 6152 + .word 63591 + .word 49116 + .word 0 + .word 18600 + .word 1852 + .word 53867 + .word 39282 + .word 16356 + .word 0 + .word 37377 + .word 45824 + .word 1379 + .word 34108 + .word 49131 + .word 0 + .word 58815 + .word 28468 + .word 57342 + .word 38462 + .word 16369 + .word 0 + .word 35703 + .word 42482 + .word 52164 + .word 49581 + .word 49142 + .word 0 + .word 14326 + .word 44453 + .word 47843 + .word 56988 + .word 16378 + .word 0 + .word 21045 + .word 58852 + .word 12449 + .word 51395 + .word 49148 + .word 0 + .type _P0,@object + .size _P0,120 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .type _tonpi,@object + .size _tonpi,12 + .align 2 +_val_N1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .type _val_N1_0L,@object + .size _val_N1_0L,12 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,12 + .align 2 +_PP: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP,@object + .size _PP,120 + .align 2 +_QP: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .type _QP,@object + .size _QP,120 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,12 + .data + .hidden __libm_sincos_pi4l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/y1f.S b/external/sgx_libm/ia32/y1f.S new file mode 100644 index 0000000000..cd84d78990 --- /dev/null +++ b/external/sgx_libm/ia32/y1f.S @@ -0,0 +1,880 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y1f.c" + .text +..TXTST0: +# -- Begin y1f + .text + .align 16,0x90 + .globl y1f +y1f: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %ebx + subl $124, %esp + movl 8(%ebp), %edx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea -1(%edx), %eax + cmpl $2139095039, %eax + jae ..B1.19 +..B1.2: + cmpl $1100816743, %edx + jae ..B1.17 +..B1.3: + cmpl $1099170276, %edx + jae ..B1.16 +..B1.4: + cmpl $1096140558, %edx + jae ..B1.15 +..B1.5: + cmpl $1092849338, %edx + jae ..B1.14 +..B1.6: + cmpl $1088602350, %edx + jae ..B1.13 +..B1.7: + cmpl $1081952922, %edx + jae ..B1.12 +..B1.8: + cmpl $1071812444, %edx + jae ..B1.11 +..B1.9: + flds 8(%ebp) + fstl (%esp) + fstps 32(%esp) + call __libm_log_k32 +..B1.29: + flds 32(%esp) +..B1.10: + fldl _tonpi@GOTOFF(%ebx) + fmul %st, %st(2) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fdiv %st(3), %st + fldl 40+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + fldl 32+_Q1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_Q1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_Q1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 8+_Q1@GOTOFF(%ebx) + fmul %st(3), %st + fmul %st(5), %st + fxch %st(1) + faddl _Q1@GOTOFF(%ebx) + fmul %st(5), %st + faddp %st, %st(1) + fldl 40+_Q2@GOTOFF(%ebx) + fmul %st(4), %st + fldl 32+_Q2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(1) + faddl 24+_Q2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(1) + faddl 16+_Q2@GOTOFF(%ebx) + fmulp %st, %st(5) + faddl 8+_Q2@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fxch %st(3) + faddl _Q2@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + fsubrp %st, %st(2) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.11: + flds 8(%ebp) + fldl 120+_P1@GOTOFF(%ebx) + fldl 104+_P1@GOTOFF(%ebx) + fldl 112+_P1@GOTOFF(%ebx) + fldl 96+_P1@GOTOFF(%ebx) + fxch %st(4) + fsubl 128+_P1@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 88+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 72+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 56+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 40+_P1@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 24+_P1@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(2), %st + fxch %st(4) + faddl 8+_P1@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(4) + faddl 64+_P1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 80+_P1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 32+_P1@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 48+_P1@GOTOFF(%ebx) + fmulp %st, %st(3) + faddl _P1@GOTOFF(%ebx) + fxch %st(2) + faddl 16+_P1@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.12: + flds 8(%ebp) + fldl 104+_P2@GOTOFF(%ebx) + fldl 88+_P2@GOTOFF(%ebx) + fldl 96+_P2@GOTOFF(%ebx) + fldl 80+_P2@GOTOFF(%ebx) + fxch %st(4) + fsubl 112+_P2@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 72+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 56+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 40+_P2@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 24+_P2@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(2), %st + fxch %st(4) + faddl 8+_P2@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + faddl 64+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 48+_P2@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 32+_P2@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(3) + faddl 16+_P2@GOTOFF(%ebx) + fmulp %st, %st(1) + fxch %st(1) + faddl _P2@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.13: + flds 8(%ebp) + fldl 96+_P3@GOTOFF(%ebx) + fldl 80+_P3@GOTOFF(%ebx) + fldl 88+_P3@GOTOFF(%ebx) + fldl 72+_P3@GOTOFF(%ebx) + fxch %st(4) + fsubl 104+_P3@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 64+_P3@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 48+_P3@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 32+_P3@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 16+_P3@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 56+_P3@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(3) + faddl _P3@GOTOFF(%ebx) + fxch %st(5) + faddl 40+_P3@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(2) + faddl 24+_P3@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + fxch %st(2) + faddl 8+_P3@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.14: + flds 8(%ebp) + fldl 104+_P4@GOTOFF(%ebx) + fldl 88+_P4@GOTOFF(%ebx) + fldl 96+_P4@GOTOFF(%ebx) + fldl 80+_P4@GOTOFF(%ebx) + fxch %st(4) + fsubl 112+_P4@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 72+_P4@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 56+_P4@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 40+_P4@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 24+_P4@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(2), %st + fxch %st(4) + faddl 8+_P4@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + faddl 64+_P4@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 48+_P4@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 32+_P4@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(3) + faddl 16+_P4@GOTOFF(%ebx) + fmulp %st, %st(1) + fxch %st(1) + faddl _P4@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.15: + flds 8(%ebp) + fldl 96+_P5@GOTOFF(%ebx) + fldl 80+_P5@GOTOFF(%ebx) + fldl 88+_P5@GOTOFF(%ebx) + fldl 72+_P5@GOTOFF(%ebx) + fxch %st(4) + fsubl 104+_P5@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 64+_P5@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 48+_P5@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 32+_P5@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 16+_P5@GOTOFF(%ebx) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 56+_P5@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(3) + faddl _P5@GOTOFF(%ebx) + fxch %st(5) + faddl 40+_P5@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(2) + faddl 24+_P5@GOTOFF(%ebx) + fmulp %st, %st(1) + fmul %st(1), %st + fxch %st(2) + faddl 8+_P5@GOTOFF(%ebx) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.16: + flds 8(%ebp) + fldl 104+_P6@GOTOFF(%ebx) + fldl 88+_P6@GOTOFF(%ebx) + fldl 96+_P6@GOTOFF(%ebx) + fldl 80+_P6@GOTOFF(%ebx) + fxch %st(4) + fsubl 112+_P6@GOTOFF(%ebx) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fmul %st, %st(4) + fmul %st, %st(3) + fmul %st, %st(6) + fxch %st(5) + faddl 72+_P6@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 56+_P6@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 40+_P6@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(4) + faddl 24+_P6@GOTOFF(%ebx) + fmul %st(1), %st + fmul %st(2), %st + fxch %st(4) + faddl 8+_P6@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + faddl 64+_P6@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 48+_P6@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(4) + faddl 32+_P6@GOTOFF(%ebx) + fmulp %st, %st(3) + fxch %st(3) + faddl 16+_P6@GOTOFF(%ebx) + fmulp %st, %st(1) + fxch %st(1) + faddl _P6@GOTOFF(%ebx) + faddp %st, %st(1) + faddp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.17: + flds 8(%ebp) + lea 32(%esp), %eax + fld1 + fdiv %st(1), %st + lea 40(%esp), %edx + fstl 16(%eax) + fldl _val_16_0@GOTOFF(%ebx) + fmulp %st, %st(1) + fstl 24(%eax) + fmul %st(0), %st + fstl 32(%eax) + fmul %st(0), %st + fxch %st(1) + fstpl (%esp) + movl %eax, 8(%esp) + movl %edx, 12(%esp) + movl $-3, 16(%esp) + fstpl 40(%eax) + call __libm_sincos_k32 +..B1.18: + fldl 72(%esp) + fldl 64(%esp) + fldl _tonpi@GOTOFF(%ebx) + fmull 48(%esp) + fsqrt + fldl 40+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fldl 32+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 24+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 16+_PP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + faddl 8+_PP@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl _PP@GOTOFF(%ebx) + faddp %st, %st(1) + fldl 40+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(1) + fmull 32(%esp) + fxch %st(1) + faddl 24+_QP@GOTOFF(%ebx) + fmul %st(4), %st + fldl 32+_QP@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(1) + faddl 8+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + faddl 16+_QP@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + faddl _QP@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmull 56(%esp) + fmull 40(%esp) + faddp %st, %st(2) + fmulp %st, %st(1) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.19: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.25 +..B1.20: + testl %eax, %eax + je ..B1.26 +..B1.21: + fldz + testl $-2147483648, %edx + je ..B1.24 +..B1.23: + flds .L_2il0floatpacket.1@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.24: + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.25: + flds 8(%ebp) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret +..B1.26: + fldz + fdivrs .L_2il0floatpacket.0@GOTOFF(%ebx) + addl $124, %esp + popl %ebx + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type y1f,@function + .size y1f,.-y1f + .data +# -- End y1f + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x7f800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_Q1: + .long 330682653 + .long 3217627238 + .long 1311559603 + .long 1068225431 + .long 1711886415 + .long 3211277751 + .long 3301707240 + .long 1058195349 + .long 1381458166 + .long 3199245881 + .long 361785213 + .long 1044511851 + .type _Q1,@object + .size _Q1,48 + .align 4 +_Q2: + .long 4294700894 + .long 1071644671 + .long 4245872852 + .long 3215982591 + .long 2793978972 + .long 1063605588 + .long 1731774639 + .long 3205263755 + .long 824990963 + .long 1051113520 + .long 1573521749 + .long 3191272273 + .type _Q2,@object + .size _Q2,48 + .align 4 +_P1: + .long 3588334709 + .long 1014823416 + .long 1143617537 + .long 1071688264 + .long 543393268 + .long 3216922360 + .long 1079832790 + .long 3214987951 + .long 1415988155 + .long 3212027618 + .long 2493495630 + .long 1065248537 + .long 1666720954 + .long 3211084359 + .long 543676354 + .long 1062304274 + .long 4191589146 + .long 3208689738 + .long 2170605073 + .long 1060053158 + .long 3542706363 + .long 3206309752 + .long 3704389215 + .long 1057513307 + .long 2063423420 + .long 3203511534 + .long 3202091398 + .long 1054023270 + .long 2674374220 + .long 3198818668 + .long 2780141937 + .long 1047561374 + .long 3571446339 + .long 1073845182 + .type _P1,@object + .size _P1,136 + .align 4 +_P2: + .long 2989758108 + .long 1017408064 + .long 1458640109 + .long 3218458565 + .long 2240523794 + .long 1067453343 + .long 773815536 + .long 1068111321 + .long 2743923681 + .long 3211856434 + .long 3232814431 + .long 3210853997 + .long 2451601872 + .long 1059272649 + .long 1805313442 + .long 1057512342 + .long 1838988672 + .long 3200779931 + .long 3139341808 + .long 3198309937 + .long 844655003 + .long 1046186753 + .long 3216852589 + .long 1043859826 + .long 2659303056 + .long 3187506951 + .long 2880143704 + .long 1034033463 + .long 1317515310 + .long 1075165182 + .type _P2,@object + .size _P2,120 + .align 4 +_P3: + .long 280256326 + .long 3163962304 + .long 1070207352 + .long 1070686105 + .long 878012560 + .long 3213896505 + .long 4238571140 + .long 3215341917 + .long 3113338666 + .long 1063505618 + .long 910161668 + .long 1063287399 + .long 1478416875 + .long 3206238429 + .long 3015160168 + .long 3204904859 + .long 3974776004 + .long 1052866426 + .long 579855125 + .long 1050851686 + .long 261378128 + .long 3193590641 + .long 798233178 + .long 3191027115 + .long 1498363474 + .long 1038832298 + .long 2925619636 + .long 1075917095 + .type _P3,@object + .size _P3,112 + .align 4 +_P4: + .long 738390343 + .long 1012897491 + .long 2706267969 + .long 3217932622 + .long 4014538048 + .long 1065632415 + .long 3590329970 + .long 1067673559 + .long 671215353 + .long 3210335979 + .long 2374781669 + .long 3210593529 + .long 1890699418 + .long 1058215403 + .long 1890155166 + .long 1057321344 + .long 1713507622 + .long 3199871308 + .long 2862637523 + .long 3198281783 + .long 1122846306 + .long 1045733660 + .long 622299794 + .long 1043564297 + .long 2771483851 + .long 3185854918 + .long 1632198108 + .long 3183235242 + .long 953430534 + .long 1076330385 + .type _P4,@object + .size _P4,120 + .align 4 +_P5: + .long 342107947 + .long 1017254688 + .long 3187585117 + .long 1070231586 + .long 1823227594 + .long 3212600587 + .long 444207028 + .long 3215024921 + .long 1802122913 + .long 1062365956 + .long 1966738039 + .long 1062934367 + .long 3649894624 + .long 3205237410 + .long 1726294277 + .long 3204703097 + .long 1880085380 + .long 1051980794 + .long 1949762981 + .long 1050731607 + .long 2695921962 + .long 3192939649 + .long 1096030507 + .long 3190939319 + .long 3356663664 + .long 1038219909 + .long 2296284299 + .long 1076743037 + .type _P5,@object + .size _P5,112 + .align 4 +_P6: + .long 1104511903 + .long 3165887820 + .long 3273918356 + .long 3217557377 + .long 1767833442 + .long 1064652506 + .long 4164235278 + .long 1067433581 + .long 3499046825 + .long 3209421592 + .long 1038038689 + .long 3210276846 + .long 3702826228 + .long 1057329476 + .long 3651609877 + .long 1057129169 + .long 1779967631 + .long 3199161987 + .long 3308825176 + .long 3198147781 + .long 897891533 + .long 1045052198 + .long 2444111938 + .long 1043454098 + .long 144575532 + .long 3185257015 + .long 1701846534 + .long 3183129264 + .long 1767841339 + .long 1077021468 + .type _P6,@object + .size _P6,120 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_PP: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP,@object + .size _PP,48 + .align 4 +_QP: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP,@object + .size _QP,48 + .data + .hidden __libm_sincos_k32 + .hidden __libm_log_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/y1l.S b/external/sgx_libm/ia32/y1l.S new file mode 100644 index 0000000000..74cf8a4144 --- /dev/null +++ b/external/sgx_libm/ia32/y1l.S @@ -0,0 +1,106 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y1l.c" + .text +..TXTST0: +# -- Begin y1l + .text + .align 16,0x90 + .globl y1l +y1l: +# parameter 1: 8 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + fldt 8(%ebp) + lea 16(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.6: + addl $-32, %esp + movl (%edi), %ecx + lea 64(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl 4(%edi), %edx + movl %ecx, (%eax) + movl %edx, 4(%eax) + movl 8(%edi), %ecx + movl 12(%edi), %edx + movl %ecx, 8(%eax) + movl %edx, 12(%eax) + call __y1q@PLT +..B1.5: + addl $28, %esp +..B1.2: + movl 32(%esp), %eax + movl %eax, (%edi) + movl 36(%esp), %edx + movl 40(%esp), %ecx + movl 44(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.7: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type y1l,@function + .size y1l,.-y1l + .data +# -- End y1l + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/yn.S b/external/sgx_libm/ia32/yn.S new file mode 100644 index 0000000000..c5c9742f6e --- /dev/null +++ b/external/sgx_libm/ia32/yn.S @@ -0,0 +1,1341 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "yn.c" + .text +..TXTST0: +# -- Begin yn + .text + .align 16,0x90 + .globl yn +yn: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + movl 8(%ebp), %edx +..B1.2: + fnstcw 70(%esp) +..B1.3: + movzwl 18(%ebp), %ecx + andl $32752, %ecx + shrl $4, %ecx + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + cmpl $2047, %ecx + je ..B1.69 +..B1.4: + fldl 12(%ebp) + fldl _zeros@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jb ..B1.8 +..B1.5: + fxch %st(1) + fucomp %st(1) + fnstsw %ax + sahf + jp ..B1.6 + je ..B1.44 +..B1.6: + fldl _infs@GOTOFF(%ebx) + fmulp %st, %st(1) +..B1.7: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.8: + fstp %st(0) + testl %edx, %edx + je ..B1.43 +..B1.9: + jl ..B1.11 +..B1.10: + movl $1, %edi + jmp ..B1.12 +..B1.11: + negl %edx + movl %edx, %eax + notl %eax + andl $1, %eax + lea -1(%eax,%eax), %edi +..B1.12: + cmpl $1, %edx + je ..B1.58 +..B1.13: + movl %edx, %eax + sarl $5, %eax + cmpl $160, %eax + jg ..B1.15 +..B1.14: + fldl XINF@GOTOFF(%ebx,%eax,8) + jmp ..B1.16 +..B1.15: + lea -640(,%eax,4), %eax + lea (,%eax,8), %ecx + subl %eax, %ecx + movl %ecx, (%esp) + fildl (%esp) + faddl .L_2il0floatpacket.0@GOTOFF(%ebx) +..B1.16: + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.42 +..B1.17: + movzwl 70(%esp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.57 +..B1.18: + fstp %st(0) + orl $-64768, %ecx + movw %cx, 68(%esp) +..B1.19: + fldcw 68(%esp) +..B1.20: + fldl 12(%ebp) + movl $1, %esi +..B1.21: + fldt _val_20_0L@GOTOFF(%ebx) + fldt _val_1000_0L@GOTOFF(%ebx) + movl %edx, (%esp) + fildl (%esp) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fcomp %st(2) + fnstsw %ax + sahf + ja ..B1.46 +..B1.22: + fldt _val_4_0L@GOTOFF(%ebx) + movl $-1, %eax + fstpt 144(%esp) + fldt 144(%esp) + fld %st(1) + fmulp %st, %st(1) + xorl %ecx, %ecx + fmulp %st, %st(1) + movl %ebx, 28(%esp) + fstpt 192(%esp) + fldt 192(%esp) + fxch %st(1) + fstl 104(%esp) + fldt _val_8_0L@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpt 176(%esp) + fldt 176(%esp) + fldt _val_p1_0L@GOTOFF(%ebx) + fstpt (%esp) + fldt (%esp) + fstpt 112(%esp) + fldt _val_n1_0L@GOTOFF(%ebx) + faddp %st, %st(2) + fdivrp %st, %st(1) + fstpt 72(%esp) + fldt 72(%esp) + fldt _val_2_0L@GOTOFF(%ebx) + fstpt 48(%esp) + fldt 48(%esp) + fstpt 160(%esp) + fldt _val_3_0L@GOTOFF(%ebx) + fstpt 32(%esp) + fldt 32(%esp) + fstpt 128(%esp) + fldt _val_5_0L@GOTOFF(%ebx) + fstpt 16(%esp) + fldt _val_0_0L@GOTOFF(%ebx) + movl %eax, %ebx + fstpt 88(%esp) + fldt 16(%esp) + fldt 128(%esp) + fldt 32(%esp) + fldt 48(%esp) + fldt (%esp) +..B1.23: + fldt 192(%esp) + fld %st(4) + fmul %st(5), %st + testl %ebx, %ebx + fsubr %st(1), %st + fxch %st(5) + fstpt 128(%esp) + fxch %st(2) + fstpt 48(%esp) + fldt 48(%esp) + fxch %st(1) + fstpt 16(%esp) + fldt 16(%esp) + fstpt 32(%esp) + fldt 32(%esp) + fldt 176(%esp) + fmul %st, %st(2) + fxch %st(2) + fdivrp %st, %st(5) + fxch %st(6) + fmulp %st, %st(4) + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(2) + fmul %st(2), %st + fdivrp %st, %st(1) + fmul %st(2), %st + fldt 128(%esp) + fldt 48(%esp) + jle ..B1.25 +..B1.24: + fldt 72(%esp) + fadd %st(3), %st + fstpt 72(%esp) + fxch %st(4) + faddp %st, %st(6) + jmp ..B1.26 +..B1.25: + fldt 72(%esp) + fsub %st(3), %st + fstpt 72(%esp) + fxch %st(4) + fsubrp %st, %st(6) +..B1.26: + fldt 160(%esp) + fadd %st, %st(4) + faddp %st, %st(3) + fld %st(1) + fdiv %st(6), %st + fldt 144(%esp) + fadd %st, %st(2) + faddp %st, %st(6) + fldt 88(%esp) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.29 +..B1.27: + fchs +..B1.29: + fldt 112(%esp) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.31 +..B1.30: + fstpt 112(%esp) + movl $1, %ecx + jmp ..B1.32 +..B1.31: + fstp %st(0) + testl %ecx, %ecx + jne ..B1.45 +..B1.32: + fldt 16(%esp) + negl %ebx + fucomp %st(6) + fnstsw %ax + sahf + fxch %st(3) + fxch %st(1) + fxch %st(5) + jne ..B1.23 + jp ..B1.23 +..B1.33: + fstp %st(2) + fstp %st(3) + fstp %st(2) + fstp %st(0) + fldt 32(%esp) + movl 28(%esp), %ebx + fstpt 12(%esp) + fstpt (%esp) + fstpt 56(%esp) + fldl 104(%esp) +..B1.34: + addl $-32, %esp + addl %edx, %edx + negl %edx + lea 44(%esp), %eax + decl %edx + lea 88(%esp), %ecx + fstpt (%esp) + fldt (%esp) + movl %eax, 12(%esp) + movl %ecx, 16(%esp) + movl %edx, 20(%esp) + fstpl 92(%eax) + call __libm_sincos_pi4l +..B1.78: + fldl 136(%esp) + addl $32, %esp +..B1.35: + fldt _tonpi@GOTOFF(%ebx) + fdivp %st, %st(1) + fsqrt + fldt 12(%esp) + fldt (%esp) + fmulp %st, %st(1) + fldt 56(%esp) + fldt 72(%esp) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 12(%esp) +..B1.36: + testl %esi, %esi + je ..B1.38 +..B1.37: + fldcw 70(%esp) +..B1.38: + fldt 12(%esp) + testl %edi, %edi + jge ..B1.41 +..B1.40: + fchs +..B1.41: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.42: + fstp %st(0) + movzbl 19(%ebp), %eax + andl $128, %eax + shrl $7, %eax + fldl _large_value_64@GOTOFF(%ebx,%eax,8) + fmull _large_value_64@GOTOFF(%ebx) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.43: + addl $-16, %esp + fstpl (%esp) + call y0@PLT +..B1.79: + addl $260, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.44: + fldl 8+_ones@GOTOFF(%ebx) + fdivp %st, %st(1) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.45: + fstp %st(2) + fstp %st(3) + fstp %st(1) + fstp %st(0) + fldt 32(%esp) + movl 28(%esp), %ebx + fstpt 12(%esp) + fxch %st(1) + fstpt (%esp) + fstpt 56(%esp) + fldl 104(%esp) + jmp ..B1.34 +..B1.46: + fstp %st(0) + fldt _val_36_0L@GOTOFF(%ebx) + fcom %st(1) + fnstsw %ax + sahf + jbe ..B1.50 +..B1.47: + fstp %st(0) + addl $-16, %esp + fstpt (%esp) + fldt (%esp) + fstpl 120(%esp) + movl %edx, 52(%esp) + call __y0l@PLT +..B1.80: + fldl 120(%esp) + movl 52(%esp), %edx + addl $16, %esp +..B1.48: + fxch %st(1) + fstpt 56(%esp) + addl $-16, %esp + fstpt (%esp) + fldt (%esp) + fstpl 120(%esp) + movl %edx, 52(%esp) + call __y1l@PLT +..B1.81: + fldl 120(%esp) + movl 52(%esp), %edx + addl $16, %esp +..B1.49: + fxch %st(1) + jmp ..B1.52 +..B1.50: + fldl _ones@GOTOFF(%ebx) + fdiv %st(2), %st + fmul %st, %st(1) + fld %st(1) + fmul %st(2), %st + fstpt 12(%esp) + fldt 12(%esp) + fxch %st(1) + fstpt 24(%esp) + fxch %st(1) + fstpt (%esp) + fldt (%esp) + fldt _PP0@GOTOFF(%ebx) + fmul %st(2), %st + fldt 12+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(2), %st + fldt _PP1@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 24+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 36+_PP0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 48+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 60+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 48+_PP1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 60+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 72+_PP0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 84+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 96+_PP0@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 84+_PP1@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt 96+_PP1@GOTOFF(%ebx) + faddp %st, %st(1) + fmul %st(3), %st + fldt 108+_PP0@GOTOFF(%ebx) + faddp %st, %st(2) + fxch %st(1) + fstpt 40(%esp) + addl $-32, %esp + lea 32(%esp), %eax + lea 44(%esp), %ecx + fxch %st(3) + fstpt (%esp) + fldt (%esp) + fldt 108+_PP1@GOTOFF(%ebx) + movl %eax, 12(%esp) + faddp %st, %st(4) + fldt _QP0@GOTOFF(%ebx) + fmul %st(3), %st + fldt 12+_QP0@GOTOFF(%ebx) + movl %ecx, 16(%esp) + faddp %st, %st(1) + fmul %st(3), %st + fldt _QP1@GOTOFF(%ebx) + fmul %st(4), %st + fldt 12+_QP1@GOTOFF(%ebx) + movl $-1, 20(%esp) + faddp %st, %st(1) + fmul %st(4), %st + fxch %st(5) + fstpt 88(%eax) + fxch %st(1) + fstpl 104(%eax) + fldt 24+_QP0@GOTOFF(%ebx) + movl %edx, 36(%eax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 24+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fldt 36+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 48+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 60+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 72+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 84+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fmul %st, %st(3) + fldt 96+_QP1@GOTOFF(%ebx) + faddp %st, %st(4) + fldt 36+_QP0@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 48+_QP0@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 60+_QP0@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 72+_QP0@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 84+_QP0@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt 96+_QP0@GOTOFF(%ebx) + faddp %st, %st(3) + fmul %st, %st(2) + fmulp %st, %st(3) + fldt 108+_QP0@GOTOFF(%ebx) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fstpt 56(%eax) + fldt 108+_QP1@GOTOFF(%ebx) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 72(%eax) + call __libm_sincos_pi4l +..B1.82: + fldl 136(%esp) + fldt 120(%esp) + fldt 104(%esp) + fldt 88(%esp) + movl 68(%esp), %edx + addl $32, %esp +..B1.51: + fldt _tonpi@GOTOFF(%ebx) + fldt 24(%esp) + fmulp %st, %st(1) + fsqrt + fldt (%esp) + fldt 12(%esp) + fmul %st, %st(3) + fmulp %st, %st(5) + fldt 40(%esp) + fmul %st(1), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt 56(%esp) + fmulp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fmulp %st, %st(1) +..B1.52: + fldt _val_2_0L@GOTOFF(%ebx) + cmpl $1, %edx + fld %st(0) + jle ..B1.56 +..B1.53: + fldt 56(%esp) + decl %edx + xorl %eax, %eax +..B1.54: + fld %st(1) + incl %eax + fdiv %st(5), %st + cmpl %edx, %eax + fmul %st(4), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(2) + fsubp %st, %st(1) + fld %st(3) + jae ..B1.55 +..B1.84: + fstp %st(4) + fxch %st(3) + jmp ..B1.54 +..B1.55: + fstp %st(5) + fstp %st(4) + fstp %st(0) + fstp %st(0) + fxch %st(1) + fstpt 12(%esp) + fstpt 56(%esp) + jmp ..B1.36 +..B1.56: + fstp %st(3) + fstp %st(2) + fstp %st(1) + fstpt 12(%esp) + jmp ..B1.36 +..B1.57: + xorl %esi, %esi + jmp ..B1.21 +..B1.58: + testl %ecx, %ecx + jne ..B1.65 +..B1.59: + testl $1048575, 16(%ebp) + jne ..B1.65 +..B1.60: + cmpl $1, 12(%ebp) + jne ..B1.65 +..B1.61: + fstp %st(0) + fldl _large_value_64@GOTOFF(%ebx) + testl %edi, %edi + jl ..B1.63 +..B1.62: + fldl 8+_large_value_64@GOTOFF(%ebx) + fmulp %st, %st(1) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.63: + fld %st(0) + fmulp %st, %st(1) +..B1.64: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.65: + addl $-16, %esp + fstpl (%esp) + call y1@PLT +..B1.83: + addl $16, %esp + testl %edi, %edi + jge ..B1.68 +..B1.67: + fchs +..B1.68: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.69: + testl $1048575, 16(%ebp) + jne ..B1.74 +..B1.70: + cmpl $0, 12(%ebp) + jne ..B1.74 +..B1.71: + movzbl 19(%ebp), %eax + testl $128, %eax + jne ..B1.75 +..B1.72: + movl %edx, %eax + shrl $31, %eax + andl %edx, %eax + fldl _zeros@GOTOFF(%ebx,%eax,8) +..B1.73: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.74: + fldl 12(%ebp) + fmull _ones@GOTOFF(%ebx) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.75: + fldl _infs@GOTOFF(%ebx) + fmull _zeros@GOTOFF(%ebx) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type yn,@function + .size yn,.-yn + .data +# -- End yn + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40adc000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +XINF: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x33333333,0x3fd33333 + .long 0xcccccccd,0x3ff4cccc + .long 0x33333333,0x400b3333 + .long 0x33333333,0x401b3333 + .long 0x33333333,0x40273333 + .long 0xcccccccd,0x4031cccc + .long 0x66666666,0x40396666 + .long 0x9999999a,0x40411999 + .long 0x9999999a,0x40461999 + .long 0x66666666,0x404ba666 + .long 0x9999999a,0x4050d999 + .long 0x00000000,0x40542000 + .long 0x33333333,0x40579333 + .long 0x9999999a,0x405b3999 + .long 0x00000000,0x405f0000 + .long 0x00000000,0x40618000 + .long 0x00000000,0x40638000 + .long 0x00000000,0x4065a000 + .long 0x00000000,0x4067e000 + .long 0x00000000,0x406a2000 + .long 0x00000000,0x406c8000 + .long 0x00000000,0x406ee000 + .long 0x00000000,0x4070a000 + .long 0x00000000,0x4071e000 + .long 0x00000000,0x40732000 + .long 0x00000000,0x40746000 + .long 0x00000000,0x4075b000 + .long 0x00000000,0x40770000 + .long 0x00000000,0x40785000 + .long 0x00000000,0x4079a000 + .long 0x00000000,0x407b0000 + .long 0x00000000,0x407c6000 + .long 0x00000000,0x407dc000 + .long 0x00000000,0x407f3000 + .long 0x00000000,0x40804800 + .long 0x00000000,0x40810000 + .long 0x00000000,0x4081b800 + .long 0x00000000,0x40827000 + .long 0x00000000,0x40832800 + .long 0x00000000,0x4083e000 + .long 0x00000000,0x4084a000 + .long 0x00000000,0x40856000 + .long 0x00000000,0x40861800 + .long 0x00000000,0x4086d800 + .long 0x00000000,0x4087a000 + .long 0x00000000,0x40886000 + .long 0x00000000,0x40892000 + .long 0x00000000,0x4089e800 + .long 0x00000000,0x408aa800 + .long 0x00000000,0x408b7000 + .long 0x00000000,0x408c3000 + .long 0x00000000,0x408cf800 + .long 0x00000000,0x408dc000 + .long 0x00000000,0x408e8800 + .long 0x00000000,0x408f5800 + .long 0x00000000,0x40901000 + .long 0x00000000,0x40907400 + .long 0x00000000,0x4090d800 + .long 0x00000000,0x40914000 + .long 0x00000000,0x4091a800 + .long 0x00000000,0x40920c00 + .long 0x00000000,0x40927400 + .long 0x00000000,0x4092dc00 + .long 0x00000000,0x40934400 + .long 0x00000000,0x4093a800 + .long 0x00000000,0x40941000 + .long 0x00000000,0x40947800 + .long 0x00000000,0x4094e400 + .long 0x00000000,0x40954c00 + .long 0x00000000,0x4095b400 + .long 0x00000000,0x40961c00 + .long 0x00000000,0x40968800 + .long 0x00000000,0x4096f000 + .long 0x00000000,0x40975c00 + .long 0x00000000,0x4097c400 + .long 0x00000000,0x40983000 + .long 0x00000000,0x40989800 + .long 0x00000000,0x40990400 + .long 0x00000000,0x40997000 + .long 0x00000000,0x4099d800 + .long 0x00000000,0x409a4400 + .long 0x00000000,0x409ab000 + .long 0x00000000,0x409b1c00 + .long 0x00000000,0x409b8800 + .long 0x00000000,0x409bf400 + .long 0x00000000,0x409c6000 + .long 0x00000000,0x409ccc00 + .long 0x00000000,0x409d3800 + .long 0x00000000,0x409da400 + .long 0x00000000,0x409e1000 + .long 0x00000000,0x409e8000 + .long 0x00000000,0x409eec00 + .long 0x00000000,0x409f5800 + .long 0x00000000,0x409fc800 + .long 0x00000000,0x40a01a00 + .long 0x00000000,0x40a05000 + .long 0x00000000,0x40a08800 + .long 0x00000000,0x40a0be00 + .long 0x00000000,0x40a0f600 + .long 0x00000000,0x40a12c00 + .long 0x00000000,0x40a16400 + .long 0x00000000,0x40a19a00 + .long 0x00000000,0x40a1d200 + .long 0x00000000,0x40a20a00 + .long 0x00000000,0x40a24000 + .long 0x00000000,0x40a27800 + .long 0x00000000,0x40a2b000 + .long 0x00000000,0x40a2e800 + .long 0x00000000,0x40a31e00 + .long 0x00000000,0x40a35600 + .long 0x00000000,0x40a38e00 + .long 0x00000000,0x40a3c600 + .long 0x00000000,0x40a3fe00 + .long 0x00000000,0x40a43600 + .long 0x00000000,0x40a46e00 + .long 0x00000000,0x40a4a600 + .long 0x00000000,0x40a4de00 + .long 0x00000000,0x40a51600 + .long 0x00000000,0x40a54e00 + .long 0x00000000,0x40a58600 + .long 0x00000000,0x40a5be00 + .long 0x00000000,0x40a5f600 + .long 0x00000000,0x40a62e00 + .long 0x00000000,0x40a66600 + .long 0x00000000,0x40a6a000 + .long 0x00000000,0x40a6d800 + .long 0x00000000,0x40a71000 + .long 0x00000000,0x40a74800 + .long 0x00000000,0x40a78200 + .long 0x00000000,0x40a7ba00 + .long 0x00000000,0x40a7f200 + .long 0x00000000,0x40a82c00 + .long 0x00000000,0x40a86400 + .long 0x00000000,0x40a89c00 + .long 0x00000000,0x40a8d600 + .long 0x00000000,0x40a90e00 + .long 0x00000000,0x40a94600 + .long 0x00000000,0x40a98000 + .long 0x00000000,0x40a9b800 + .long 0x00000000,0x40a9f200 + .long 0x00000000,0x40aa2a00 + .long 0x00000000,0x40aa6400 + .long 0x00000000,0x40aa9c00 + .long 0x00000000,0x40aad600 + .long 0x00000000,0x40ab1000 + .long 0x00000000,0x40ab4800 + .long 0x00000000,0x40ab8200 + .long 0x00000000,0x40abba00 + .long 0x00000000,0x40abf400 + .long 0x00000000,0x40ac2e00 + .long 0x00000000,0x40ac6600 + .long 0x00000000,0x40aca000 + .long 0x00000000,0x40acda00 + .long 0x00000000,0x40ad1200 + .long 0x00000000,0x40ad4c00 + .long 0x00000000,0x40ad8600 + .long 0x00000000,0x40adc000 + .type XINF,@object + .size XINF,1288 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_val_20_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16387 + .word 0 + .type _val_20_0L,@object + .size _val_20_0L,12 + .align 2 +_val_1000_0L: + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .type _val_1000_0L,@object + .size _val_1000_0L,12 + .align 2 +_val_4_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16385 + .word 0 + .type _val_4_0L,@object + .size _val_4_0L,12 + .align 2 +_val_8_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16386 + .word 0 + .type _val_8_0L,@object + .size _val_8_0L,12 + .align 2 +_val_p1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _val_p1_0L,@object + .size _val_p1_0L,12 + .align 2 +_val_n1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .type _val_n1_0L,@object + .size _val_n1_0L,12 + .align 2 +_val_2_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .type _val_2_0L,@object + .size _val_2_0L,12 + .align 2 +_val_3_0L: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .type _val_3_0L,@object + .size _val_3_0L,12 + .align 2 +_val_5_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16385 + .word 0 + .type _val_5_0L,@object + .size _val_5_0L,12 + .align 2 +_val_0_0L: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _val_0_0L,@object + .size _val_0_0L,12 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .type _tonpi,@object + .size _tonpi,12 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,12 + .align 2 +_PP0: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP0,@object + .size _PP0,120 + .align 2 +_PP1: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .type _PP1,@object + .size _PP1,120 + .align 2 +_QP0: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .type _QP0,@object + .size _QP0,120 + .align 2 +_QP1: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .type _QP1,@object + .size _QP1,120 + .data + .hidden __libm_sincos_pi4l + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ynf.S b/external/sgx_libm/ia32/ynf.S new file mode 100644 index 0000000000..1aae4059b3 --- /dev/null +++ b/external/sgx_libm/ia32/ynf.S @@ -0,0 +1,1442 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ynf.c" + .text +..TXTST0: +# -- Begin ynf + .text + .align 16,0x90 + .globl ynf +ynf: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %esi + pushl %edi + pushl %ebx + subl $244, %esp + fldz + movl 12(%ebp), %ecx + movl 8(%ebp), %esi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + lea -1(%ecx), %edx + cmpl $2139095039, %edx + jae ..B1.51 +..B1.2: + testl %esi, %esi + je ..B1.66 +..B1.3: + movl %ecx, %edi + movl %esi, %eax + xorl %esi, %edi + cltd + shrl $31, %edi + andl %esi, %edi + xorl %edx, %esi + subl %edx, %esi + cmpl $1, %esi + je ..B1.61 +..B1.4: + movl %esi, %eax + sarl $3, %eax + cmpl $320, %eax + jg ..B1.6 +..B1.5: + flds function_zeros@GOTOFF(%ebx,%eax,4) + jmp ..B1.7 +..B1.6: + fldt .L_2il0floatpacket.0@GOTOFF(%ebx) + lea -320(%eax), %edx + lea -2560(,%eax,8), %eax + subl %edx, %eax + movl %eax, 192(%esp) + fildl 192(%esp) + fstps 192(%esp) + flds 192(%esp) + faddp %st, %st(1) + fstps 192(%esp) + flds 192(%esp) +..B1.7: + flds 12(%ebp) + fxch %st(1) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.50 +..B1.8: + cmpl $6, %esi + jge ..B1.23 +..B1.9: + fldl _val_0_6@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jb ..B1.24 +..B1.10: + fldl _val_2_0@GOTOFF(%ebx) + fld %st(1) + fdiv %st(1), %st + testl %esi, %esi + fstpl 200(%esp) + fdiv %st(1), %st + fldl 200(%esp) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + flds _ones@GOTOFF(%ebx) + fstpt 32(%esp) + fldt 32(%esp) + fld %st(0) + fxch %st(1) + fstpt 96(%esp) + fldt 96(%esp) + fld %st(0) + flds _zeros@GOTOFF(%ebx) + jle ..B1.57 +..B1.11: + fstp %st(7) + fxch %st(4) + fstpt 112(%esp) + xorl %edx, %edx + fxch %st(2) + fstpt 48(%esp) + fxch %st(3) + fstps 44(%esp) + fldt 96(%esp) + fldt 32(%esp) +..B1.12: + fldt 112(%esp) + incl %edx + fmulp %st, %st(5) + cmpl %esi, %edx + fxch %st(4) + fstpl 200(%esp) + fld %st(3) + fxch %st(3) + fmul %st, %st(4) + fldl 200(%esp) + fldt 48(%esp) + fmulp %st, %st(3) + fxch %st(2) + fstpl 200(%esp) + fld %st(2) + fdiv %st(1), %st + faddp %st, %st(6) + fadd %st(2), %st + fldl 200(%esp) + fxch %st(5) + fstpl 200(%esp) + fldl 200(%esp) + fxch %st(6) + fstpl 200(%esp) + fldl 200(%esp) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + jae ..B1.13 +..B1.77: + fstp %st(4) + fxch %st(5) + fxch %st(4) + fxch %st(1) + fxch %st(4) + jmp ..B1.12 +..B1.13: + fstp %st(0) + flds 44(%esp) + fxch %st(5) + fstpt 96(%esp) + fxch %st(5) + fstpt 32(%esp) + fldt 112(%esp) + fxch %st(3) + fxch %st(5) + fxch %st(2) +..B1.14: + fldl _TWO_19H@GOTOFF(%ebx) + fld %st(3) + fxch %st(5) + fmul %st(0), %st + xorl %ecx, %ecx + fchs + movl %esi, %edx + fstpl 200(%esp) + fxch %st(1) + fstl 168(%esp) + fxch %st(3) + fstl 184(%esp) + fxch %st(2) + fstpt 48(%esp) + fxch %st(4) + fstps 44(%esp) + fldl 200(%esp) +..B1.15: + incl %ecx + incl %edx + movl %ecx, %eax + imull %edx, %eax + movl %eax, 192(%esp) + lea (%esi,%ecx,2), %eax + fildl 192(%esp) + fstps 192(%esp) + flds 192(%esp) + fdivrs _ones@GOTOFF(%ebx) + movl %eax, 192(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fildl 192(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(4) + fstpl 200(%esp) + fldl 200(%esp) + fldl 168(%esp) + fmul %st(2), %st + fmulp %st, %st(5) + fxch %st(4) + fstpl 200(%esp) + fldl 200(%esp) + fstl 168(%esp) + fadd %st, %st(3) + fxch %st(3) + fstpl 200(%esp) + fxch %st(2) + fmul %st(3), %st + fldl 200(%esp) + fxch %st(1) + faddl 184(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fld %st(0) + fmul %st(6), %st + fstpl 200(%esp) + fstl 184(%esp) + fldl 200(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 176(%esp) + fldl 176(%esp) + fsubp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fucom %st(2) + fnstsw %ax + fxch %st(2) + fstp %st(0) + sahf + fxch %st(2) + jne ..B1.15 + jp ..B1.15 +..B1.16: + fstp %st(1) + fstp %st(3) + fstp %st(1) + fldt 48(%esp) + flds 44(%esp) + fldt 32(%esp) + fdivrp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fmul %st, %st(2) + fxch %st(2) + fstpl 200(%esp) + fxch %st(1) + fstpl 168(%esp) + fldl 200(%esp) + fldl _eulon2@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpl (%esp) + fxch %st(1) + fstpt 112(%esp) + fstpt 64(%esp) + fstpt 80(%esp) + call __libm_log_k32 +..B1.72: + fldt 80(%esp) + fldt 64(%esp) + fldt 112(%esp) +..B1.17: + fldl _oonpi@GOTOFF(%ebx) + fxch %st(1) + fchs + fldl _tonpi@GOTOFF(%ebx) + cmpl $1, %esi + fmulp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + fldl 184(%esp) + fmul %st(1), %st + fmull 168(%esp) + fsubrp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + jle ..B1.78 +..B1.18: + movl $1, %ecx + lea -1(%esi), %edx + fld %st(2) + .align 16,0x90 +..B1.19: + movl %ecx, %ebx + incl %ecx + imull %edx, %ebx + decl %edx + fmul %st(4), %st + movl %ebx, 192(%esp) + cmpl %esi, %ecx + fildl 192(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fdivrp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fadd %st, %st(3) + fxch %st(3) + fstpl 200(%esp) + fldl 200(%esp) + fxch %st(3) + jl ..B1.19 +..B1.20: + fstp %st(0) + fstp %st(3) +..B1.21: + fldt 96(%esp) + fxch %st(2) + fmulp %st, %st(1) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) + jmp ..B1.46 +..B1.23: + cmpl $80, %esi + jge ..B1.35 +..B1.24: + fxch %st(1) + fstpl 184(%esp) +..B1.25: + fldl _val_18_0@GOTOFF(%ebx) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.29 +..B1.26: + fstl (%esp) + fstps 44(%esp) + call y0@PLT +..B1.73: + flds 44(%esp) +..B1.27: + fstl (%esp) + fxch %st(1) + fstpl 168(%esp) + fstps 44(%esp) + call y1@PLT +..B1.74: + flds 44(%esp) +..B1.28: + fxch %st(1) + jmp ..B1.31 +..B1.29: + flds _ones@GOTOFF(%ebx) + lea 96(%esp), %edx + fdiv %st(1), %st + lea 104(%esp), %ecx + fstpl 104(%edx) + fldl 104(%edx) + fstpt -64(%edx) + fldt -64(%edx) + fldl _val_16_0@GOTOFF(%ebx) + fmulp %st, %st(1) + fstpl 104(%edx) + fldl 104(%edx) + fld %st(0) + fmul %st(1), %st + fstpl 104(%edx) + fldl 104(%edx) + fld %st(0) + fmul %st(1), %st + fstpl 104(%edx) + fldl 104(%edx) + fxch %st(3) + fstl (%esp) + movl %edx, 8(%esp) + movl %ecx, 12(%esp) + movl $-1, 16(%esp) + fxch %st(1) + fstpt -48(%edx) + fxch %st(2) + fstpt -32(%edx) + fstpt -16(%edx) + fstps -52(%edx) + call __libm_sincos_k32 +..B1.30: + flds 44(%esp) + fldt 80(%esp) + fldt 64(%esp) + fldt 48(%esp) + fldl 40+_PP0@GOTOFF(%ebx) + fmul %st(2), %st + fldl 32+_PP0@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 24+_PP0@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 16+_PP0@GOTOFF(%ebx) + fmul %st(3), %st + fxch %st(1) + faddl 8+_PP0@GOTOFF(%ebx) + fmul %st(2), %st + fstpl 200(%esp) + fldl 200(%esp) + fldl 32+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl _PP0@GOTOFF(%ebx) + fstpl 200(%esp) + fldl 200(%esp) + faddp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fldl 40+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl 16+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl 24+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fxch %st(2) + faddl _PP1@GOTOFF(%ebx) + fldl 32+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl 8+_PP1@GOTOFF(%ebx) + fmul %st(4), %st + fstpl 200(%esp) + fldl 200(%esp) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + faddp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fldl 40+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl 16+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl 24+_QP0@GOTOFF(%ebx) + fmul %st(5), %st + fxch %st(3) + faddl _QP0@GOTOFF(%ebx) + fmul %st(6), %st + fxch %st(3) + faddl 8+_QP0@GOTOFF(%ebx) + fmul %st(4), %st + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fstpl 200(%esp) + fldl 200(%esp) + fldl 40+_QP1@GOTOFF(%ebx) + fmul %st(5), %st + faddl 24+_QP1@GOTOFF(%ebx) + fmul %st(5), %st + faddl 8+_QP1@GOTOFF(%ebx) + fmulp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fldl 32+_QP1@GOTOFF(%ebx) + fmul %st(5), %st + faddl 16+_QP1@GOTOFF(%ebx) + fmulp %st, %st(5) + fldl _tonpi@GOTOFF(%ebx) + fxch %st(5) + faddl _QP1@GOTOFF(%ebx) + fmulp %st, %st(6) + faddp %st, %st(5) + fxch %st(4) + fstpl 200(%esp) + fldl 200(%esp) + fldt 32(%esp) + fmulp %st, %st(4) + fxch %st(3) + fstpl 200(%esp) + fldl 200(%esp) + fsqrt + fstpl 200(%esp) + fldl 200(%esp) + fldl 96(%esp) + fmul %st, %st(5) + fmulp %st, %st(4) + fldl 104(%esp) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fmul %st, %st(4) + fxch %st(4) + fstpl 168(%esp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fmulp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) +..B1.31: + fldl _val_2_0@GOTOFF(%ebx) + cmpl $1, %esi + fdivp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + jle ..B1.79 +..B1.32: + fldl 168(%esp) + movl $1, %edx +..B1.33: + movl %edx, 192(%esp) + incl %edx + fildl 192(%esp) + fstpl 200(%esp) + fld %st(2) + fldl 200(%esp) + cmpl %esi, %edx + fmul %st(3), %st + fmulp %st, %st(4) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(2) + fstpl 200(%esp) + fldl 200(%esp) + fxch %st(2) + jl ..B1.33 +..B1.34: + fstp %st(0) + fstp %st(0) + jmp ..B1.46 +..B1.35: + lea 5000(%esi,%esi,4), %edx + movl %edx, 192(%esp) + fildl 192(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fcomp %st(1) + fnstsw %ax + sahf + ja ..B1.24 +..B1.36: + fstp %st(1) + fldl _val_4_0@GOTOFF(%ebx) + movl $-1, %ecx + movl %esi, 192(%esp) + xorl %edx, %edx + fstl 160(%esp) + fxch %st(1) + fsts 44(%esp) + fildl 192(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fld %st(0) + fmulp %st, %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fstpt 128(%esp) + fldt 128(%esp) + fldl _val_8_0@GOTOFF(%ebx) + fmulp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fstpt 112(%esp) + fldt 112(%esp) + flds _ones@GOTOFF(%ebx) + fstl 152(%esp) + fstpt 80(%esp) + fldt 80(%esp) + flds 4+_ones@GOTOFF(%ebx) + faddp %st, %st(3) + fxch %st(1) + fdivrp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fstpt 64(%esp) + fldt 64(%esp) + fstpl 168(%esp) + fldl _val_2_0@GOTOFF(%ebx) + fstl 144(%esp) + fldl _val_3_0@GOTOFF(%ebx) + fstpt 48(%esp) + fldt 48(%esp) + fldl _val_5_0@GOTOFF(%ebx) + fstpt 32(%esp) + fld %st(2) + fdiv %st(3), %st + fstpl 200(%esp) + fldl 200(%esp) + fstpt 96(%esp) + fldt 80(%esp) + fldt 32(%esp) + fldt 48(%esp) +..B1.37: + fldt 112(%esp) + fld %st(5) + fmul %st(1), %st + testl %ecx, %ecx + fxch %st(1) + fmul %st(5), %st + fxch %st(7) + fstpl 184(%esp) + fld %st(1) + fmul %st(2), %st + fxch %st(4) + fstpt 80(%esp) + fldt 128(%esp) + fsub %st, %st(4) + fxch %st(1) + fdivrp %st, %st(4) + fld %st(2) + fmul %st(3), %st + fsubrp %st, %st(1) + fdivp %st, %st(6) + fxch %st(2) + fmull 168(%esp) + fstpl 200(%esp) + fldl 200(%esp) + fxch %st(5) + fstpl 200(%esp) + fldl 200(%esp) + fmul %st(5), %st + fstpl 200(%esp) + fldl 200(%esp) + fldt 80(%esp) + jle ..B1.59 +..B1.38: + faddp %st, %st(6) + fxch %st(5) + fstpl 200(%esp) + fldl 200(%esp) + fldt 64(%esp) + fadd %st(6), %st + fstpl 200(%esp) + fldl 200(%esp) + fstpt 64(%esp) +..B1.39: + fldl 144(%esp) + fadd %st, %st(5) + fxch %st(5) + fstpl 200(%esp) + fxch %st(4) + faddp %st, %st(3) + fxch %st(4) + fstl 168(%esp) + fldl 200(%esp) + fxch %st(3) + fstpl 200(%esp) + fldl 200(%esp) + fldl 160(%esp) + fadd %st, %st(3) + fxch %st(3) + fstpl 200(%esp) + fxch %st(2) + faddp %st, %st(5) + fldl 200(%esp) + fxch %st(5) + fstpl 200(%esp) + fldl 200(%esp) + fldt 96(%esp) + fmulp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fabs + fldl 152(%esp) + fcomp %st(1) + fnstsw %ax + sahf + jbe ..B1.41 +..B1.40: + fstpl 152(%esp) + movl $1, %edx + jmp ..B1.42 +..B1.41: + fstp %st(0) + testl %edx, %edx + jne ..B1.58 +..B1.42: + fldl _TWO_19H@GOTOFF(%ebx) + negl %ecx + fmul %st(4), %st + fstpl 200(%esp) + fld %st(3) + fldl 200(%esp) + fadd %st, %st(1) + fxch %st(1) + fstpl 176(%esp) + fldl 176(%esp) + fsubp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fldl 184(%esp) + fucomp %st(1) + fnstsw %ax + sahf + fxch %st(5) + fxch %st(2) + fxch %st(3) + fxch %st(4) + fxch %st(2) + jne ..B1.37 + jp ..B1.37 +..B1.43: + fstp %st(5) + fstp %st(4) + fstp %st(3) + fstp %st(0) + fstp %st(0) + fstpt 80(%esp) + flds 44(%esp) +..B1.44: + addl %esi, %esi + lea 184(%esp), %edx + negl %esi + lea 168(%esp), %ecx + fstl (%esp) + decl %esi + movl %edx, 8(%esp) + movl %ecx, 12(%esp) + movl %esi, 16(%esp) + fstps -124(%ecx) + call __libm_sincos_k32 +..B1.45: + flds 44(%esp) + fldt 80(%esp) + fmull 184(%esp) + fldt 64(%esp) + fmull 168(%esp) + faddp %st, %st(1) + fldl _tonpi@GOTOFF(%ebx) + fdivp %st, %st(2) + fxch %st(1) + fstpl 200(%esp) + fldl 200(%esp) + fsqrt + fstpl 200(%esp) + fldl 200(%esp) + fmulp %st, %st(1) + fstpl 200(%esp) + fldl 200(%esp) +..B1.46: + testl %edi, %edi + je ..B1.49 +..B1.47: + fchs +..B1.49: + fstps 192(%esp) + flds 192(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.50: + fstp %st(1) + fstp %st(0) + fldt .L_2il0floatpacket.1@GOTOFF(%ebx) + shrl $31, %ecx + fmuls _large_value_32@GOTOFF(%ebx,%ecx,4) + fstps 192(%esp) + flds 192(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.51: + fstp %st(0) + movl %ecx, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + ja ..B1.56 +..B1.52: + testl %edx, %edx + je ..B1.69 +..B1.53: + testl $-2147483648, %ecx + jne ..B1.68 +..B1.54: + movl %esi, %edx + shrl $31, %edx + andl %esi, %edx + flds _zeros@GOTOFF(%ebx,%edx,4) +..B1.55: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.56: + flds 12(%ebp) + fmuls _ones@GOTOFF(%ebx) + fstps 192(%esp) + flds 192(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.57: + fstp %st(1) + fstp %st(3) + jmp ..B1.14 +..B1.58: + fstp %st(4) + fstp %st(3) + fstp %st(2) + fstp %st(1) + fstpt 80(%esp) + flds 44(%esp) + jmp ..B1.44 +..B1.59: + fsubp %st, %st(6) + fxch %st(5) + fstpl 200(%esp) + fldl 200(%esp) + fldt 64(%esp) + fsub %st(6), %st + fstpl 200(%esp) + fldl 200(%esp) + fstpt 64(%esp) + jmp ..B1.39 +..B1.61: + fstpl 184(%esp) + addl $4, %esp + pushl 12(%ebp) + call y1f@PLT +..B1.62: + testl %edi, %edi + je ..B1.65 +..B1.63: + fchs +..B1.65: + fstps 192(%esp) + flds 192(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.66: + fstpl 184(%esp) + addl $4, %esp + pushl 12(%ebp) + call y0f@PLT +..B1.67: + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.68: + flds _zeros@GOTOFF(%ebx) + fmuls _infs@GOTOFF(%ebx) + fstps 192(%esp) + flds 192(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.69: + flds 4+_ones@GOTOFF(%ebx) + fdivs _zeros@GOTOFF(%ebx) + fstps 192(%esp) + flds 192(%esp) + addl $244, %esp + popl %ebx + popl %edi + popl %esi + movl %ebp, %esp + popl %ebp + ret +..B1.78: + fstp %st(3) + jmp ..B1.21 +..B1.79: + fstp %st(0) + jmp ..B1.46 + .align 16,0x90 + .type ynf,@function + .size ynf,.-ynf + .data +# -- End ynf + .data + .align 4 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_infs: + .long 2139095040 + .long 4286578688 + .type _infs,@object + .size _infs,8 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x8e,0x0a,0x40,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,12 + .space 4, 0x00 # pad + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x63,0x40,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,12 + .align 4 +function_zeros: + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x3ecccccd + .long 0x3fa66666 + .long 0x40400000 + .long 0x40a9999a + .long 0x4101999a + .long 0x41366666 + .long 0x4171999a + .long 0x4198cccd + .long 0x41ba6666 + .long 0x41df3333 + .long 0x42026666 + .long 0x42160000 + .long 0x422a0000 + .long 0x423f3333 + .long 0x42546666 + .long 0x426a0000 + .long 0x42803333 + .long 0x428b999a + .long 0x42970000 + .long 0x42a2999a + .long 0x42ae6666 + .long 0x42ba6666 + .long 0x42c66666 + .long 0x42d2999a + .long 0x42decccd + .long 0x42eb3333 + .long 0x42f7999a + .long 0x4302199a + .long 0x43086666 + .long 0x430ecccd + .long 0x43153333 + .long 0x431b999a + .long 0x4322199a + .long 0x4328999a + .long 0x432f199a + .long 0x4335b333 + .long 0x433c3333 + .long 0x4342e666 + .long 0x43498000 + .long 0x43503333 + .long 0x4356e666 + .long 0x435d999a + .long 0x43644ccd + .long 0x436b0000 + .long 0x4371cccd + .long 0x4378999a + .long 0x437f6666 + .long 0x4383199a + .long 0x43868ccd + .long 0x4389f333 + .long 0x438d6666 + .long 0x4390d99a + .long 0x43944ccd + .long 0x4397c000 + .long 0x439b3333 + .long 0x439eb333 + .long 0x43a23333 + .long 0x43a5a666 + .long 0x43a92666 + .long 0x43aca666 + .long 0x43b02666 + .long 0x43b3a666 + .long 0x43b73333 + .long 0x43bab333 + .long 0x43be4000 + .long 0x43c1c000 + .long 0x43c54ccd + .long 0x43c8d99a + .long 0x43cc6666 + .long 0x43cff333 + .long 0x43d38000 + .long 0x43d70ccd + .long 0x43da999a + .long 0x43de2666 + .long 0x43e1c000 + .long 0x43e54ccd + .long 0x43e8e666 + .long 0x43ec8000 + .long 0x43f00ccd + .long 0x43f3a666 + .long 0x43f74000 + .long 0x43fad99a + .long 0x43fe7333 + .long 0x44010666 + .long 0x4402d333 + .long 0x4404a000 + .long 0x44067333 + .long 0x44084000 + .long 0x440a0ccd + .long 0x440be000 + .long 0x440daccd + .long 0x440f8000 + .long 0x44114ccd + .long 0x44132000 + .long 0x4414f333 + .long 0x4416c666 + .long 0x4418999a + .long 0x441a6666 + .long 0x441c399a + .long 0x441e0ccd + .long 0x441fe000 + .long 0x4421b333 + .long 0x44238ccd + .long 0x44256000 + .long 0x44273333 + .long 0x44290666 + .long 0x442ae000 + .long 0x442cb333 + .long 0x442e8666 + .long 0x44306000 + .long 0x44323333 + .long 0x44340ccd + .long 0x4435e000 + .long 0x4437b99a + .long 0x44398ccd + .long 0x443b6666 + .long 0x443d4000 + .long 0x443f199a + .long 0x4440eccd + .long 0x4442c666 + .long 0x4444a000 + .long 0x4446799a + .long 0x44485333 + .long 0x444a2ccd + .long 0x444c0666 + .long 0x444de000 + .long 0x444fb99a + .long 0x44519333 + .long 0x44536ccd + .long 0x44554666 + .long 0x44572000 + .long 0x44590000 + .long 0x445ad99a + .long 0x445cb333 + .long 0x445e9333 + .long 0x44606ccd + .long 0x44624666 + .long 0x44642666 + .long 0x44660000 + .long 0x4467d99a + .long 0x4469b99a + .long 0x446b9333 + .long 0x446d7333 + .long 0x446f5333 + .long 0x44712ccd + .long 0x44730ccd + .long 0x4474e666 + .long 0x4476c666 + .long 0x4478a666 + .long 0x447a8000 + .long 0x447c6000 + .long 0x447e4000 + .long 0x44801000 + .long 0x4480fccd + .long 0x4481eccd + .long 0x4482dccd + .long 0x4483cccd + .long 0x4484bccd + .long 0x4485accd + .long 0x44869ccd + .long 0x44878ccd + .long 0x44887ccd + .long 0x44896ccd + .long 0x448a5ccd + .long 0x448b4ccd + .long 0x448c3ccd + .long 0x448d2ccd + .long 0x448e1ccd + .long 0x448f0ccd + .long 0x448ffccd + .long 0x4490eccd + .long 0x4491e000 + .long 0x4492d000 + .long 0x4493c000 + .long 0x4494b000 + .long 0x4495a333 + .long 0x44969333 + .long 0x44978333 + .long 0x44987333 + .long 0x44996666 + .long 0x449a5666 + .long 0x449b499a + .long 0x449c399a + .long 0x449d299a + .long 0x449e1ccd + .long 0x449f0ccd + .long 0x44a00000 + .long 0x44a0f000 + .long 0x44a1e333 + .long 0x44a2d333 + .long 0x44a3c666 + .long 0x44a4b666 + .long 0x44a5a99a + .long 0x44a6999a + .long 0x44a78ccd + .long 0x44a87ccd + .long 0x44a97000 + .long 0x44aa6333 + .long 0x44ab5333 + .long 0x44ac4666 + .long 0x44ad399a + .long 0x44ae299a + .long 0x44af1ccd + .long 0x44b01000 + .long 0x44b10333 + .long 0x44b1f333 + .long 0x44b2e666 + .long 0x44b3d99a + .long 0x44b4cccd + .long 0x44b5bccd + .long 0x44b6b000 + .long 0x44b7a333 + .long 0x44b89666 + .long 0x44b9899a + .long 0x44ba7ccd + .long 0x44bb6ccd + .long 0x44bc6000 + .long 0x44bd5333 + .long 0x44be4666 + .long 0x44bf399a + .long 0x44c02ccd + .long 0x44c12000 + .long 0x44c21333 + .long 0x44c30666 + .long 0x44c3f99a + .long 0x44c4eccd + .long 0x44c5e000 + .long 0x44c6d333 + .long 0x44c7c666 + .long 0x44c8b99a + .long 0x44c9accd + .long 0x44caa000 + .long 0x44cb9333 + .long 0x44cc899a + .long 0x44cd7ccd + .long 0x44ce7000 + .long 0x44cf6333 + .long 0x44d05666 + .long 0x44d1499a + .long 0x44d23ccd + .long 0x44d33333 + .long 0x44d42666 + .long 0x44d5199a + .long 0x44d60ccd + .long 0x44d70000 + .long 0x44d7f666 + .long 0x44d8e99a + .long 0x44d9dccd + .long 0x44dad000 + .long 0x44dbc666 + .long 0x44dcb99a + .long 0x44ddaccd + .long 0x44dea333 + .long 0x44df9666 + .long 0x44e0899a + .long 0x44e18000 + .long 0x44e27333 + .long 0x44e36666 + .long 0x44e45ccd + .long 0x44e55000 + .long 0x44e64333 + .long 0x44e7399a + .long 0x44e82ccd + .long 0x44e92333 + .long 0x44ea1666 + .long 0x44eb099a + .long 0x44ec0000 + .long 0x44ecf333 + .long 0x44ede99a + .long 0x44eedccd + .long 0x44efd333 + .long 0x44f0c666 + .long 0x44f1bccd + .long 0x44f2b000 + .long 0x44f3a666 + .long 0x44f4999a + .long 0x44f59000 + .long 0x44f68333 + .long 0x44f7799a + .long 0x44f86ccd + .long 0x44f96333 + .long 0x44fa599a + .long 0x44fb4ccd + .long 0x44fc4333 + .long 0x44fd3666 + .long 0x44fe2ccd + .long 0x44ff2000 + .long 0x45000b33 + .long 0x45008666 + .long 0x45010000 + .long 0x45017000 + .long 0x4501f000 + .long 0x45027000 + .long 0x4502e000 + .long 0x45036000 + .long 0x4503e000 + .long 0x45045000 + .long 0x4504d000 + .long 0x45055000 + .long 0x4505c000 + .long 0x45064000 + .long 0x4506c000 + .long 0x45073000 + .long 0x4507b000 + .long 0x45083000 + .long 0x4508a000 + .long 0x45092000 + .long 0x4509a000 + .long 0x450a1000 + .long 0x450a9000 + .long 0x450b1000 + .long 0x450b8000 + .long 0x450c0000 + .long 0x450c8000 + .long 0x450cf000 + .long 0x450d7000 + .long 0x450df000 + .long 0x450e6000 + .type function_zeros,@object + .size function_zeros,1284 + .align 4 +_val_0_6: + .long 858993459 + .long 1071854387 + .type _val_0_6,@object + .size _val_0_6,8 + .align 4 +_val_2_0: + .long 0 + .long 1073741824 + .type _val_2_0,@object + .size _val_2_0,8 + .align 4 +_TWO_19H: + .long 0 + .long 1093140480 + .type _TWO_19H,@object + .size _TWO_19H,8 + .align 4 +_eulon2: + .long 3400611180 + .long 1072463685 + .type _eulon2,@object + .size _eulon2,8 + .align 4 +_oonpi: + .long 1841940611 + .long 1070882608 + .type _oonpi,@object + .size _oonpi,8 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_val_18_0: + .long 0 + .long 1077018624 + .type _val_18_0,@object + .size _val_18_0,8 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_PP0: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP0,@object + .size _PP0,48 + .align 4 +_PP1: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP1,@object + .size _PP1,48 + .align 4 +_QP0: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP0,@object + .size _QP0,48 + .align 4 +_QP1: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP1,@object + .size _QP1,48 + .align 4 +_val_4_0: + .long 0 + .long 1074790400 + .type _val_4_0,@object + .size _val_4_0,8 + .align 4 +_val_8_0: + .long 0 + .long 1075838976 + .type _val_8_0,@object + .size _val_8_0,8 + .align 4 +_val_3_0: + .long 0 + .long 1074266112 + .type _val_3_0,@object + .size _val_3_0,8 + .align 4 +_val_5_0: + .long 0 + .long 1075052544 + .type _val_5_0,@object + .size _val_5_0,8 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .data + .hidden __libm_sincos_k32 + .hidden __libm_log_k32 + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/ia32/ynl.S b/external/sgx_libm/ia32/ynl.S new file mode 100644 index 0000000000..db3a032599 --- /dev/null +++ b/external/sgx_libm/ia32/ynl.S @@ -0,0 +1,109 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ynl.c" + .text +..TXTST0: +# -- Begin ynl + .text + .align 16,0x90 + .globl ynl +ynl: +# parameter 1: 8 + %ebp +# parameter 2: 12 + %ebp +..B1.1: +..L1: + + pushl %ebp + movl %esp, %ebp + andl $-64, %esp + pushl %edi + pushl %ebx + subl $56, %esp + fldt 12(%ebp) + lea 16(%esp), %edi + call ..L2 +..L2: + popl %ebx + lea _GLOBAL_OFFSET_TABLE_+[. - ..L2](%ebx), %ebx + movl %edi, (%esp) + fstpt 4(%esp) + call __ltoq@PLT +..B1.6: + addl $-32, %esp + movl 8(%ebp), %ecx + lea 64(%esp), %edx + movl %edx, (%esp) + lea 16(%esp), %eax + movl %ecx, 4(%esp) + movl (%edi), %edx + movl 4(%edi), %ecx + movl %edx, (%eax) + movl %ecx, 4(%eax) + movl 8(%edi), %edx + movl 12(%edi), %ecx + movl %edx, 8(%eax) + movl %ecx, 12(%eax) + call __ynq@PLT +..B1.5: + addl $28, %esp +..B1.2: + movl 32(%esp), %eax + movl %eax, (%edi) + movl 36(%esp), %edx + movl 40(%esp), %ecx + movl 44(%esp), %eax + addl $4, %esp + pushl %edi + movl %edx, 4(%edi) + movl %ecx, 8(%edi) + movl %eax, 12(%edi) + call __qtol@PLT +..B1.7: + addl $56, %esp + popl %ebx + popl %edi + movl %ebp, %esp + popl %ebp + ret + .align 16,0x90 + .type ynl,@function + .size ynl,.-ynl + .data +# -- End ynl + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/acos.S b/external/sgx_libm/intel64/acos.S new file mode 100644 index 0000000000..9f611cbebd --- /dev/null +++ b/external/sgx_libm/intel64/acos.S @@ -0,0 +1,1912 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acos.c" + .text +..TXTST0: +# -- Begin acos + .text + .align 16,0x90 + .globl acos +acos: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_acos.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + movsd ABSVALMASK(%rip), %xmm4 + movsd ONEMASK(%rip), %xmm3 + xorpd %xmm5, %xmm5 + movsd TMASK(%rip), %xmm2 + movq %xmm0, %xmm1 + psrlq $44, %xmm0 + movd %xmm0, %edx + movq %xmm1, %xmm7 + movl $8192, %ecx + pinsrw $2, %ecx, %xmm5 + movq %xmm1, %xmm0 + movl $524287, %eax + andl %edx, %eax + subl $260864, %eax + cmpl $955, %eax + jae .L_2TAG_PACKET_0.0.2 + mulsd %xmm1, %xmm1 + andl $65535, %edx + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + andpd %xmm7, %xmm2 + andl $-4, %edx + subl $64256, %edx + lea T_table(%rip), %r8 + movsd (%r8,%rdx,2), %xmm1 + orpd %xmm5, %xmm2 + lea Tbl_addr(%rip), %r8 + movapd (%r8,%rdx,4), %xmm4 + movq %xmm7, %xmm6 + addsd %xmm2, %xmm7 + subsd %xmm2, %xmm0 + mulsd %xmm0, %xmm7 + mulsd %xmm1, %xmm6 + mulsd %xmm2, %xmm3 + movq %xmm6, %xmm1 + addsd %xmm3, %xmm6 + divsd %xmm6, %xmm7 + movsd 24+cv(%rip), %xmm0 + movsd 8+cv(%rip), %xmm5 + subsd %xmm3, %xmm1 + psrlq $63, %xmm2 + movq %xmm1, %xmm3 + psllq $63, %xmm2 + mulsd %xmm1, %xmm1 + pshufd $68, %xmm2, %xmm2 + movsd 16+cv(%rip), %xmm6 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm0 + xorpd %xmm2, %xmm4 + mulsd %xmm3, %xmm5 + subpd PI_BY_2(%rip), %xmm4 + mulsd %xmm1, %xmm3 + addsd %xmm6, %xmm0 + mulsd %xmm3, %xmm0 + subsd %xmm4, %xmm5 + pshufd $238, %xmm4, %xmm4 + addsd %xmm5, %xmm0 + subsd %xmm7, %xmm0 + subsd %xmm4, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + subl $955, %eax + cmpl $65, %eax + jae .L_2TAG_PACKET_1.0.2 + psrlq $38, %xmm7 + psllq $38, %xmm7 + pmovmskb %xmm0, %eax + andnpd %xmm0, %xmm4 + subsd %xmm7, %xmm1 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + addsd %xmm6, %xmm0 + orpd %xmm4, %xmm5 + subsd %xmm7, %xmm3 + mulsd %xmm1, %xmm0 + movq %xmm3, %xmm4 + subsd %xmm0, %xmm3 + sqrtsd %xmm3, %xmm3 + andl $128, %eax + shrl $7, %eax + negl %eax + movq %xmm3, %xmm7 + andpd %xmm3, %xmm2 + psllq $2, %xmm3 + pextrw $3, %xmm3, %edx + orpd %xmm5, %xmm2 + movd %eax, %xmm3 + pshufd $0, %xmm3, %xmm3 + subl $65216, %edx + addl %edx, %edx + lea T_table(%rip), %r8 + mulsd (%r8,%rdx,4), %xmm7 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + subsd %xmm7, %xmm6 + andpd NEG_PI(%rip), %xmm3 + addsd %xmm1, %xmm6 + subsd %xmm2, %xmm4 + addsd %xmm7, %xmm7 + movsd 8+cv(%rip), %xmm5 + subsd %xmm0, %xmm4 + addsd %xmm6, %xmm7 + movsd 24+cv(%rip), %xmm0 + divsd %xmm7, %xmm4 + movsd 16+cv(%rip), %xmm2 + lea Tbl_addr(%rip), %r8 + addpd (%r8,%rdx,8), %xmm3 + movq %xmm6, %xmm1 + mulsd %xmm6, %xmm6 + mulsd %xmm6, %xmm0 + mulsd %xmm6, %xmm1 + mulsd %xmm1, %xmm5 + mulsd %xmm6, %xmm1 + addsd %xmm2, %xmm0 + pxor %xmm6, %xmm6 + mulsd %xmm1, %xmm0 + addsd %xmm3, %xmm5 + addsd %xmm5, %xmm0 + andl $32768, %eax + pinsrw $3, %eax, %xmm6 + movq %xmm4, %xmm5 + pshufd $238, %xmm3, %xmm3 + addsd %xmm3, %xmm4 + subsd %xmm4, %xmm3 + addsd %xmm3, %xmm5 + addsd %xmm5, %xmm0 + addsd %xmm4, %xmm0 + xorpd %xmm6, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_1.0.2: + addl $15291, %eax + cmpl $14336, %eax + jae .L_2TAG_PACKET_2.0.2 + unpcklpd %xmm0, %xmm0 + movapd cv2(%rip), %xmm6 + unpcklpd %xmm0, %xmm1 + movapd 16+cv2(%rip), %xmm2 + movapd 32+cv2(%rip), %xmm4 + mulpd %xmm0, %xmm0 + movapd PI_BY_2(%rip), %xmm5 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm6 + mulpd %xmm0, %xmm0 + movq %xmm1, %xmm3 + mulsd %xmm1, %xmm1 + addpd %xmm2, %xmm6 + mulpd %xmm0, %xmm4 + mulsd %xmm3, %xmm1 + addpd %xmm4, %xmm6 + pshufd $238, %xmm5, %xmm0 + mulpd %xmm6, %xmm1 + pshufd $238, %xmm5, %xmm6 + subsd %xmm7, %xmm0 + pshufd $238, %xmm1, %xmm2 + subsd %xmm1, %xmm5 + subsd %xmm0, %xmm6 + subsd %xmm2, %xmm5 + subsd %xmm6, %xmm7 + subsd %xmm7, %xmm5 + addsd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_2.0.2: + subl $15356, %eax + cmpl $4, %eax + jae .L_2TAG_PACKET_3.0.2 + xorpd %xmm6, %xmm6 + andpd ABSVALMASK(%rip), %xmm7 + movsd ONE_BY_2(%rip), %xmm4 + movapd cv2(%rip), %xmm1 + mulsd %xmm4, %xmm7 + movapd 16+cv2(%rip), %xmm2 + subsd %xmm7, %xmm4 + movapd 32+cv2(%rip), %xmm3 + pshufd $68, %xmm4, %xmm7 + sqrtsd %xmm4, %xmm4 + mulpd %xmm7, %xmm1 + pshufd $68, %xmm7, %xmm5 + pextrw $3, %xmm0, %eax + mulpd %xmm7, %xmm7 + addpd %xmm1, %xmm2 + movsd HALFMASK(%rip), %xmm1 + mulpd %xmm7, %xmm3 + cmpsd $1, %xmm6, %xmm0 + mulsd %xmm5, %xmm7 + addpd %xmm3, %xmm2 + pshufd $68, %xmm0, %xmm0 + mulsd %xmm7, %xmm2 + andpd NEG_PI(%rip), %xmm0 + mulpd %xmm5, %xmm2 + andpd %xmm4, %xmm1 + pshufd $68, %xmm4, %xmm3 + subsd %xmm1, %xmm4 + addsd %xmm3, %xmm3 + mulsd %xmm1, %xmm1 + subsd %xmm4, %xmm3 + subsd %xmm1, %xmm5 + mulsd %xmm3, %xmm4 + pshufd $238, %xmm3, %xmm3 + subsd %xmm4, %xmm5 + divsd %xmm3, %xmm5 + addpd %xmm3, %xmm3 + mulpd %xmm3, %xmm2 + pshufd $238, %xmm2, %xmm4 + addsd %xmm0, %xmm2 + andl $32768, %eax + pinsrw $3, %eax, %xmm6 + pshufd $238, %xmm0, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm5, %xmm2 + addsd %xmm3, %xmm2 + addsd %xmm2, %xmm0 + xorpd %xmm6, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_3.0.2: + addl $261884, %eax + cmpl $261888, %eax + jb .L_2TAG_PACKET_4.0.2 + movd %xmm7, %ecx + psrlq $32, %xmm7 + movd %xmm7, %edx + andl $2147483647, %edx + movl $1072693248, %eax + subl %edx, %eax + orl %ecx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_5.0.2 + movsd (%rsp), %xmm2 + movd %xmm2, %edx + psrlq $32, %xmm2 + movd %xmm2, %ecx + andl $2147483647, %ecx + subl $1, %edx + sbbl $2146435072, %ecx + cmpl $0, %ecx + jge .L_2TAG_PACKET_6.0.2 + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %edx + pinsrw $3, %edx, %xmm1 + mulsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_7.0.2 +.L_2TAG_PACKET_5.0.2: + pextrw $1, %xmm7, %edx + shrl $15, %edx + negl %edx + movd %edx, %xmm7 + pshufd $0, %xmm7, %xmm7 + movsd PI(%rip), %xmm2 + movsd 8+PI(%rip), %xmm0 + andpd %xmm7, %xmm2 + andpd %xmm7, %xmm0 + addsd %xmm2, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_4.0.2: + movsd PI_BY_2(%rip), %xmm2 + movsd 8+PI_BY_2(%rip), %xmm0 + addsd %xmm2, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_6.0.2: + xorpd %xmm6, %xmm6 + addsd %xmm6, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_7.0.2: + movq %xmm0, 8(%rsp) +..B1.3: + movq 8(%rsp), %xmm0 +.L_2TAG_PACKET_8.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type acos,@function + .size acos,.-acos + .data +# -- End acos + .section .rodata, "a" + .align 16 + .align 16 +ABSVALMASK: + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .type ABSVALMASK,@object + .size ABSVALMASK,16 + .align 16 +T_table: + .long 2642784509 + .long 1072689083 + .long 1514442531 + .long 1072688953 + .long 333108933 + .long 1072688821 + .long 3392112024 + .long 1072688686 + .long 2099852862 + .long 1072688550 + .long 749609004 + .long 1072688412 + .long 3634632596 + .long 1072688271 + .long 2163248461 + .long 1072688129 + .long 628657846 + .long 1072687985 + .long 3324036511 + .long 1072687838 + .long 1657632815 + .long 1072687690 + .long 4217538760 + .long 1072687539 + .long 2411951597 + .long 1072687387 + .long 533944872 + .long 1072687233 + .long 2876566508 + .long 1072687076 + .long 847936891 + .long 1072686918 + .long 3036019913 + .long 1072686757 + .long 848884575 + .long 1072686595 + .long 2874443326 + .long 1072686430 + .long 520713666 + .long 1072686264 + .long 2375556481 + .long 1072686095 + .long 4141904948 + .long 1072685924 + .long 1522666382 + .long 1072685752 + .long 3105624104 + .long 1072685577 + .long 298666327 + .long 1072685401 + .long 1689524500 + .long 1072685222 + .long 2981002200 + .long 1072685041 + .long 4170844284 + .long 1072684858 + .long 961802263 + .long 1072684674 + .long 1941503454 + .long 1072684487 + .long 2812647170 + .long 1072684298 + .long 3572873869 + .long 1072684107 + .long 4219797823 + .long 1072683914 + .long 456039788 + .long 1072683720 + .long 869096151 + .long 1072683523 + .long 1161535119 + .long 1072683324 + .long 1330865866 + .long 1072683123 + .long 1374571204 + .long 1072682920 + .long 1290107538 + .long 1072682715 + .long 1074904836 + .long 1072682508 + .long 726366587 + .long 1072682299 + .long 241869763 + .long 1072682088 + .long 3913732079 + .long 1072681874 + .long 3149342765 + .long 1072681659 + .long 2240966306 + .long 1072681442 + .long 1185873216 + .long 1072681223 + .long 4276274591 + .long 1072681001 + .long 2919452883 + .long 1072680778 + .long 1407565635 + .long 1072680553 + .long 4032743551 + .long 1072680325 + .long 2202188565 + .long 1072680096 + .long 207977577 + .long 1072679865 + .long 2342160518 + .long 1072679631 + .long 11858423 + .long 1072679396 + .long 1804034453 + .long 1072679158 + .long 3420722787 + .long 1072678918 + .long 563930456 + .long 1072678677 + .long 1820539192 + .long 1072678433 + .long 2892501606 + .long 1072678187 + .long 3776710320 + .long 1072677939 + .long 175063337 + .long 1072677690 + .long 674333171 + .long 1072677438 + .long 976363026 + .long 1072677184 + .long 1077935934 + .long 1072676928 + .long 1921075490 + .long 1072676540 + .long 881493302 + .long 1072676016 + .long 3275752439 + .long 1072675483 + .long 486855588 + .long 1072674943 + .long 1077229111 + .long 1072674394 + .long 723950308 + .long 1072673837 + .long 3693582199 + .long 1072673271 + .long 1367335316 + .long 1072672698 + .long 2305837020 + .long 1072672116 + .long 2184358641 + .long 1072671526 + .long 972682840 + .long 1072670928 + .long 2935101762 + .long 1072670321 + .long 3745513263 + .long 1072669706 + .long 3372320886 + .long 1072669083 + .long 1783464620 + .long 1072668452 + .long 3241386215 + .long 1072667812 + .long 3418125284 + .long 1072667164 + .long 2280219148 + .long 1072666508 + .long 4088700758 + .long 1072665843 + .long 219227400 + .long 1072665171 + .long 3521816918 + .long 1072664489 + .long 1076205279 + .long 1072663800 + .long 1436484616 + .long 1072663102 + .long 271362610 + .long 1072662396 + .long 1838996688 + .long 1072661681 + .long 1807122518 + .long 1072660958 + .long 137953542 + .long 1072660227 + .long 1088178584 + .long 1072659487 + .long 324057537 + .long 1072658739 + .long 2101288076 + .long 1072657982 + .long 2085133974 + .long 1072657217 + .long 235324451 + .long 1072656444 + .long 806051592 + .long 1072655662 + .long 3756033140 + .long 1072654871 + .long 453542543 + .long 1072654073 + .long 3741177327 + .long 1072653265 + .long 691216109 + .long 1072652450 + .long 4145223372 + .long 1072651625 + .long 1174439091 + .long 1072650793 + .long 324416139 + .long 1072649952 + .long 1550246310 + .long 1072649102 + .long 511524674 + .long 1072648244 + .long 1457248482 + .long 1072647377 + .long 45944955 + .long 1072646502 + .long 525537397 + .long 1072645618 + .long 2848440188 + .long 1072644725 + .long 2671555633 + .long 1072643824 + .long 4241172637 + .long 1072642914 + .long 3213094278 + .long 1072641996 + .long 3832503688 + .long 1072641069 + .long 1754091534 + .long 1072640134 + .long 1221921804 + .long 1072639190 + .long 2184526489 + .long 1072638237 + .long 294902089 + .long 1072637276 + .long 4090375270 + .long 1072636305 + .long 632860906 + .long 1072635327 + .long 2753498702 + .long 1072634339 + .long 1808009252 + .long 1072633343 + .long 2036428672 + .long 1072632338 + .long 3383235626 + .long 1072631324 + .long 1497347484 + .long 1072630302 + .long 617018317 + .long 1072629271 + .long 684933058 + .long 1072628231 + .long 1643170798 + .long 1072627182 + .long 3011066360 + .long 1072625592 + .long 957158713 + .long 1072623442 + .long 1390907941 + .long 1072621256 + .long 3819155270 + .long 1072619034 + .long 3443571196 + .long 1072616777 + .long 4045412458 + .long 1072614484 + .long 805503923 + .long 1072612156 + .long 1778922015 + .long 1072609791 + .long 2125033665 + .long 1072607390 + .long 1287203863 + .long 1072604953 + .long 2992629568 + .long 1072602479 + .long 2367267127 + .long 1072599969 + .long 3115526047 + .long 1072597422 + .long 340219539 + .long 1072594839 + .long 2017215719 + .long 1072592218 + .long 3225443424 + .long 1072589560 + .long 3326565673 + .long 1072586865 + .long 1669811211 + .long 1072584133 + .long 1886735022 + .long 1072581363 + .long 3301071171 + .long 1072578555 + .long 928514283 + .long 1072575710 + .long 2656364059 + .long 1072572826 + .long 3473490507 + .long 1072569904 + .long 2649965606 + .long 1072566944 + .long 3736819052 + .long 1072563945 + .long 1680885175 + .long 1072560908 + .long 4413771 + .long 1072557832 + .long 2214869753 + .long 1072554716 + .long 3214725184 + .long 1072551561 + .long 2186079903 + .long 1072548367 + .long 2590372131 + .long 1072545133 + .long 3578146079 + .long 1072541859 + .long 4283712755 + .long 1072538545 + .long 3824834510 + .long 1072535191 + .long 1302400298 + .long 1072531797 + .long 95058636 + .long 1072528362 + .long 3563906063 + .long 1072524885 + .long 2167230730 + .long 1072521368 + .long 3524918334 + .long 1072517809 + .long 2353304918 + .long 1072514209 + .long 1939625839 + .long 1072510567 + .long 1256714581 + .long 1072506883 + .long 3552525848 + .long 1072503156 + .long 3464809522 + .long 1072499387 + .long 4200542593 + .long 1072495575 + .long 355609124 + .long 1072491721 + .long 3684139099 + .long 1072487822 + .long 148355918 + .long 1072483881 + .long 1457689242 + .long 1072479895 + .long 2118591596 + .long 1072475865 + .long 908848089 + .long 1072471791 + .long 877032689 + .long 1072467672 + .long 752012304 + .long 1072463508 + .long 3532301749 + .long 1072459298 + .long 3600563221 + .long 1072455043 + .long 3902857084 + .long 1072450742 + .long 3063101036 + .long 1072446395 + .long 3972344374 + .long 1072442001 + .long 903183549 + .long 1072437561 + .long 983892938 + .long 1072433073 + .long 2722858568 + .long 1072428537 + .long 302790515 + .long 1072423954 + .long 759811057 + .long 1072419322 + .long 2507809922 + .long 1072414641 + .long 2388408813 + .long 1072407528 + .long 2084492942 + .long 1072397870 + .long 2435703301 + .long 1072388010 + .long 1935433360 + .long 1072377945 + .long 2742047290 + .long 1072367671 + .long 2053284205 + .long 1072357185 + .long 657783367 + .long 1072346483 + .long 2893664841 + .long 1072335560 + .long 3718906405 + .long 1072324413 + .long 1547896303 + .long 1072313038 + .long 2494058440 + .long 1072301429 + .long 3133238742 + .long 1072289582 + .long 3327000086 + .long 1072277492 + .long 1860667274 + .long 1072265154 + .long 665340747 + .long 1072252562 + .long 443347841 + .long 1072239710 + .long 581282618 + .long 1072226592 + .long 3349780465 + .long 1072213201 + .long 914217606 + .long 1072199532 + .long 989797661 + .long 1072185576 + .long 945436416 + .long 1072171326 + .long 549291300 + .long 1072156774 + .long 1814636389 + .long 1072141911 + .long 239092858 + .long 1072126729 + .long 1794680724 + .long 1072111217 + .long 1241534678 + .long 1072095366 + .long 3366566214 + .long 1072079164 + .long 1244090828 + .long 1072062601 + .long 1708448120 + .long 1072045663 + .long 3544260650 + .long 1072028337 + .long 1402741403 + .long 1072010610 + .long 2551936888 + .long 1071992465 + .long 617669739 + .long 1071973887 + .long 794002186 + .long 1071954857 + .long 2021237693 + .long 1071935356 + .long 540450384 + .long 1071915364 + .long 1920555537 + .long 1071894857 + .long 2879585206 + .long 1071873811 + .long 3000237455 + .long 1071852199 + .long 3352974346 + .long 1071829991 + .long 569629937 + .long 1071807155 + .long 2077237208 + .long 1071783653 + .long 2284891805 + .long 1071759446 + .long 1226651784 + .long 1071734489 + .long 1102047405 + .long 1071708731 + .long 2009896384 + .long 1071682115 + .long 927419082 + .long 1071654577 + .long 85010366 + .long 1071607413 + .long 696431025 + .long 1071548180 + .long 2611410541 + .long 1071486585 + .long 2612593658 + .long 1071422396 + .long 3548155306 + .long 1071355336 + .long 3887997484 + .long 1071285073 + .long 244854763 + .long 1071211202 + .long 4214445648 + .long 1071133216 + .long 2303966727 + .long 1071050478 + .long 3991040013 + .long 1070962152 + .long 3126952278 + .long 1070867118 + .long 1817448378 + .long 1070763804 + .long 1793814864 + .long 1070649884 + .long 3507224072 + .long 1070447193 + .long 4027609105 + .long 1070148772 + .long 577507993 + .long 1069779414 + .long 2310232419 + .long 1068931829 + .type T_table,@object + .size T_table,2048 + .align 16 +Tbl_addr: + .long 3822952792 + .long 1021639372 + .long 182792448 + .long 1068507836 + .long 2264213271 + .long 1019558908 + .long 649052928 + .long 1068524253 + .long 1797139609 + .long 1022295143 + .long 1243095296 + .long 1068540671 + .long 1415938756 + .long 1021439537 + .long 2033294592 + .long 1068557090 + .long 2356809978 + .long 1021777916 + .long 3088063744 + .long 1068573510 + .long 2669055318 + .long 1022124482 + .long 180888576 + .long 1068589932 + .long 3566445325 + .long 1021358712 + .long 1970196992 + .long 1068606354 + .long 896980323 + .long 1021319659 + .long 4229555456 + .long 1068622777 + .long 436049712 + .long 1021319758 + .long 2732572160 + .long 1068639202 + .long 583123209 + .long 1020797960 + .long 1842831872 + .long 1068655628 + .long 1370449804 + .long 1021429270 + .long 1628994560 + .long 1068672055 + .long 2411391464 + .long 1021057980 + .long 2159763712 + .long 1068688483 + .long 1208692749 + .long 1021943903 + .long 3503886336 + .long 1068704912 + .long 538793309 + .long 1019744063 + .long 1435187200 + .long 1068721343 + .long 4085087612 + .long 1020608419 + .long 317469952 + .long 1068737775 + .long 144386942 + .long 1021440732 + .long 219617280 + .long 1068754208 + .long 2940088361 + .long 1019981122 + .long 1210558208 + .long 1068770642 + .long 2176850347 + .long 1018373705 + .long 3359268352 + .long 1068787077 + .long 2395611454 + .long 1021889042 + .long 2439803648 + .long 1068803514 + .long 1650705253 + .long 1020227966 + .long 2816203520 + .long 1068819952 + .long 3702166386 + .long 1019379914 + .long 262620672 + .long 1068836392 + .long 1855649370 + .long 1020453124 + .long 3438159616 + .long 1068852832 + .long 923063860 + .long 1019273834 + .long 3822105856 + .long 1068869274 + .long 4289947947 + .long 1019434249 + .long 1483729920 + .long 1068885718 + .long 787455814 + .long 1020738379 + .long 787321088 + .long 1068902163 + .long 3321653337 + .long 1021842569 + .long 1802253312 + .long 1068918609 + .long 2653633526 + .long 1021821525 + .long 302985984 + .long 1068935057 + .long 161272028 + .long 1021655149 + .long 653966080 + .long 1068951506 + .long 2566098667 + .long 1020066219 + .long 2924727296 + .long 1068967956 + .long 3646493722 + .long 1014292285 + .long 2889890304 + .long 1068984408 + .long 1081009196 + .long 1022189620 + .long 619098112 + .long 1069000862 + .long 4011643355 + .long 1021773297 + .long 477017600 + .long 1069017317 + .long 4030305534 + .long 1021292252 + .long 2533403904 + .long 1069033773 + .long 2645187591 + .long 1019527099 + .long 2563102208 + .long 1069050231 + .long 3857293792 + .long 1022311697 + .long 635982336 + .long 1069066691 + .long 3625936637 + .long 1017511744 + .long 1116940800 + .long 1069083152 + .long 3653872993 + .long 1022016631 + .long 4075964160 + .long 1069099614 + .long 2468900271 + .long 1021769532 + .long 993165568 + .long 1069116079 + .long 1358104224 + .long 1021199776 + .long 528586752 + .long 1069132545 + .long 2200950332 + .long 1022024872 + .long 2752395776 + .long 1069149012 + .long 3197072454 + .long 1017751319 + .long 3439855616 + .long 1069165481 + .long 1651081806 + .long 1020809338 + .long 2661257728 + .long 1069181952 + .long 539032752 + .long 1021728805 + .long 486957312 + .long 1069198425 + .long 3136045149 + .long 1016888671 + .long 1282340352 + .long 1069214899 + .long 2593963259 + .long 1018956103 + .long 822921728 + .long 1069231375 + .long 2146032737 + .long 1022306465 + .long 3474216192 + .long 1069247852 + .long 3976811625 + .long 1021350207 + .long 716902656 + .long 1069264332 + .long 718267222 + .long 1018624727 + .long 1211594496 + .long 1069280813 + .long 1485641389 + .long 1018447451 + .long 734070272 + .long 1069297296 + .long 354455128 + .long 1021341291 + .long 3650110720 + .long 1069313780 + .long 682185947 + .long 1021651853 + .long 1440663040 + .long 1069330267 + .long 3558574550 + .long 1021615110 + .long 2766612224 + .long 1069346755 + .long 874607978 + .long 1017746872 + .long 3404011008 + .long 1069363245 + .long 4154988502 + .long 1021439906 + .long 3423949056 + .long 1069379737 + .long 2263202309 + .long 1021479615 + .long 2897587712 + .long 1069396231 + .long 2562065031 + .long 1022090363 + .long 1896159232 + .long 1069412727 + .long 3836237663 + .long 1019867288 + .long 490968576 + .long 1069429225 + .long 3322056743 + .long 1006752762 + .long 3048360192 + .long 1069445724 + .long 1152314833 + .long 1013122252 + .long 1049850624 + .long 1069462226 + .long 3601590727 + .long 1022214610 + .long 3156899584 + .long 1069478729 + .long 1855169970 + .long 1019487271 + .long 851173376 + .long 1069495235 + .long 312649594 + .long 1020868604 + .long 2794281728 + .long 1069511742 + .long 1093490181 + .long 1020777577 + .long 468042496 + .long 1069528252 + .long 1152540679 + .long 1021403732 + .long 2534219264 + .long 1069544763 + .long 2292126035 + .long 1021872430 + .long 1376146432 + .long 1069558527 + .long 3293753641 + .long 1020500454 + .long 4175442432 + .long 1069575044 + .long 3626347564 + .long 1021610969 + .long 3523113472 + .long 1069591566 + .long 339956500 + .long 1021119039 + .long 4003350528 + .long 1069608092 + .long 3429333082 + .long 1022813542 + .long 1611067392 + .long 1069624623 + .long 2298017544 + .long 1021977587 + .long 931782144 + .long 1069641158 + .long 2164684743 + .long 1021250988 + .long 2256725504 + .long 1069657697 + .long 1138762335 + .long 1021443776 + .long 1582853120 + .long 1069674241 + .long 1084010382 + .long 1022994693 + .long 3497758720 + .long 1069690789 + .long 406366244 + .long 1022713586 + .long 3999816960 + .long 1069707342 + .long 1488723042 + .long 1023381290 + .long 3383096064 + .long 1069723900 + .long 2541558953 + .long 1019137887 + .long 1942403584 + .long 1069740463 + .long 1879620343 + .long 1022653642 + .long 4268263680 + .long 1069757030 + .long 3039077047 + .long 1022252545 + .long 2067062272 + .long 1069773603 + .long 4190670677 + .long 1020725863 + .long 4225828096 + .long 1069790180 + .long 1998567321 + .long 1022014385 + .long 2452507136 + .long 1069806763 + .long 1511628873 + .long 1021900300 + .long 1340746240 + .long 1069823351 + .long 788367341 + .long 1022726208 + .long 1190035456 + .long 1069839944 + .long 3856337230 + .long 1021834118 + .long 2300688384 + .long 1069856542 + .long 3211396579 + .long 1022621365 + .long 678886400 + .long 1069873146 + .long 4001011887 + .long 1022042646 + .long 921594112 + .long 1069889755 + .long 557811968 + .long 1023065533 + .long 3331668992 + .long 1069906369 + .long 1877060679 + .long 1022419742 + .long 3917875200 + .long 1069922989 + .long 1181055171 + .long 1022752712 + .long 2984829696 + .long 1069939615 + .long 4294526932 + .long 1021499988 + .long 838049024 + .long 1069956247 + .long 3658081878 + .long 1022957952 + .long 2078928384 + .long 1069972884 + .long 820353701 + .long 1019391107 + .long 2719854336 + .long 1069989527 + .long 1644022489 + .long 1023378240 + .long 3069117696 + .long 1070006176 + .long 2771393702 + .long 1019319954 + .long 3435962368 + .long 1070022831 + .long 3876394145 + .long 1023024433 + .long 4130595328 + .long 1070039492 + .long 1630447748 + .long 1021465882 + .long 1169236224 + .long 1070056160 + .long 2828355997 + .long 1020458120 + .long 3453997312 + .long 1070072833 + .long 164091641 + .long 1020388279 + .long 2708127744 + .long 1070089513 + .long 3036550223 + .long 1023328684 + .long 3540797696 + .long 1070106199 + .long 3710949463 + .long 1022568805 + .long 1972276736 + .long 1070122892 + .long 3885277950 + .long 1019761674 + .long 2613815552 + .long 1070139591 + .long 2764165077 + .long 1022921023 + .long 1487791616 + .long 1070156297 + .long 1330644769 + .long 1023162679 + .long 3207593472 + .long 1070173009 + .long 3911007221 + .long 1022993496 + .long 3797764608 + .long 1070189728 + .long 979712598 + .long 1022554580 + .long 3578920448 + .long 1070206454 + .long 2825738223 + .long 1020223708 + .long 2872795648 + .long 1070223187 + .long 392451124 + .long 1022666279 + .long 2002258432 + .long 1070239927 + .long 3730407632 + .long 1023148291 + .long 1291326464 + .long 1070256674 + .long 3723802980 + .long 1022514089 + .long 1065180928 + .long 1070273428 + .long 2635617463 + .long 1022654470 + .long 1650181632 + .long 1070290189 + .long 2061982883 + .long 1022853411 + .long 3373882880 + .long 1070306957 + .long 319732785 + .long 1022017175 + .long 2270081280 + .long 1070323733 + .long 2237757411 + .long 1023064087 + .long 2963732736 + .long 1070340516 + .long 468839165 + .long 1023293774 + .long 1491099904 + .long 1070357307 + .long 1502657946 + .long 1021533479 + .long 2479636480 + .long 1070374105 + .long 482913562 + .long 1021986286 + .long 1968133632 + .long 1070390911 + .long 3281474337 + .long 1022646400 + .long 291639040 + .long 1070407725 + .long 2453320259 + .long 1022812423 + .long 2081472512 + .long 1070424546 + .long 2939989570 + .long 1023091888 + .long 3380340480 + .long 1070441375 + .long 2850707499 + .long 1021921109 + .long 232287488 + .long 1070458213 + .long 3674625342 + .long 1020725130 + .long 1567614208 + .long 1070475058 + .long 9347334 + .long 1022024009 + .long 3433091072 + .long 1070491911 + .long 282524999 + .long 1021433523 + .long 1876877312 + .long 1070508773 + .long 3470449440 + .long 1019309721 + .long 1538472192 + .long 1070525643 + .long 2089486825 + .long 1019698916 + .long 2763830784 + .long 1070542521 + .long 443498115 + .long 1020505194 + .long 1605381632 + .long 1070559408 + .long 3018871601 + .long 1022869913 + .long 2706946048 + .long 1070576303 + .long 3936260892 + .long 1023175875 + .long 2123887360 + .long 1070593207 + .long 2994220655 + .long 1022825948 + .long 104015104 + .long 1070603108 + .long 335054493 + .long 1023441853 + .long 2904568832 + .long 1070615800 + .long 1451215633 + .long 1023853857 + .long 3456197120 + .long 1070632739 + .long 436334733 + .long 1024026432 + .long 252452352 + .long 1070649697 + .long 34596167 + .long 1024031396 + .long 3328018432 + .long 1070666672 + .long 2644547073 + .long 1024296758 + .long 1255829248 + .long 1070683667 + .long 552832586 + .long 1023763122 + .long 4097058560 + .long 1070700680 + .long 1955640623 + .long 1021394654 + .long 451770112 + .long 1070717714 + .long 3428903777 + .long 1022941142 + .long 408920832 + .long 1070734767 + .long 165503263 + .long 1023894958 + .long 1186960640 + .long 1070751840 + .long 435826450 + .long 1024026134 + .long 19078656 + .long 1070768934 + .long 1834169749 + .long 1022899284 + .long 2743490304 + .long 1070786048 + .long 494581074 + .long 1018818479 + .long 2328961024 + .long 1070803184 + .long 2987908834 + .long 1022581110 + .long 350011392 + .long 1070820342 + .long 240771184 + .long 1024143083 + .long 2692326912 + .long 1070837521 + .long 666056837 + .long 1022394776 + .long 2373274368 + .long 1070854723 + .long 2484337770 + .long 1024228156 + .long 1017131520 + .long 1070871948 + .long 3285648279 + .long 1024025789 + .long 265558272 + .long 1070889196 + .long 392241896 + .long 1024252809 + .long 1778008064 + .long 1070906467 + .long 1536107943 + .long 1023949300 + .long 2937184768 + .long 1070923762 + .long 3541062251 + .long 1019448646 + .long 1144442880 + .long 1070941082 + .long 3691683781 + .long 1022123948 + .long 2410165504 + .long 1070958426 + .long 1804181960 + .long 1023945221 + .long 4174350848 + .long 1070975795 + .long 2016094861 + .long 1021716585 + .long 3897012480 + .long 1070993190 + .long 175294410 + .long 1023703404 + .long 3353623040 + .long 1071010611 + .long 167973242 + .long 1023240839 + .long 45671168 + .long 1071028059 + .long 2166856113 + .long 1021565413 + .long 86063872 + .long 1071045533 + .long 2676254727 + .long 1023985299 + .long 1019772672 + .long 1071063034 + .long 989043593 + .long 1021549587 + .long 414297344 + .long 1071080563 + .long 3960972046 + .long 1024307251 + .long 155173120 + .long 1071098120 + .long 1830919291 + .long 1021592251 + .long 2151562240 + .long 1071115705 + .long 405408666 + .long 1023423128 + .long 4041854720 + .long 1071133319 + .long 2043497827 + .long 1024411503 + .long 3489224192 + .long 1071150963 + .long 3072215864 + .long 1022698635 + .long 2477196288 + .long 1071168637 + .long 1812195139 + .long 1022689192 + .long 3015298816 + .long 1071186341 + .long 764841969 + .long 1021027331 + .long 2844731136 + .long 1071204076 + .long 2878117321 + .long 1019116513 + .long 4028950528 + .long 1071221842 + .long 698911452 + .long 1023265602 + .long 69441536 + .long 1071239641 + .long 3253467847 + .long 1020795075 + .long 1676209920 + .long 1071257471 + .long 4272431167 + .long 1022873982 + .long 2408752384 + .long 1071275334 + .long 648519100 + .long 1024385717 + .long 151623680 + .long 1071293231 + .long 345257017 + .long 1019561408 + .long 1410154240 + .long 1071311161 + .long 197863993 + .long 1023224207 + .long 4131351552 + .long 1071329125 + .long 2620801789 + .long 1024411169 + .long 1999664384 + .long 1071347125 + .long 3952692616 + .long 1024168086 + .long 1617668864 + .long 1071365160 + .long 3019889809 + .long 1021907692 + .long 1032074240 + .long 1071383231 + .long 59469899 + .long 1023656194 + .long 2619492096 + .long 1071401338 + .long 1417526820 + .long 1021457783 + .long 202429440 + .long 1071419483 + .long 2927667935 + .long 1019175447 + .long 525044224 + .long 1071437665 + .long 38166811 + .long 1023981879 + .long 1779258880 + .long 1071455885 + .long 481252500 + .long 1023310234 + .long 2195673600 + .long 1071474144 + .long 3962395981 + .long 1021339088 + .long 44573696 + .long 1071492443 + .long 3936281395 + .long 1023014829 + .long 2226905344 + .long 1071510781 + .long 1515320476 + .long 1024320623 + .long 2800512512 + .long 1071529160 + .long 1225403697 + .long 1021081846 + .long 161113600 + .long 1071547581 + .long 3064809733 + .long 1024173917 + .long 1338410240 + .long 1071566043 + .long 2027604973 + .long 1024362526 + .long 522433280 + .long 1071584548 + .long 2055171723 + .long 1023858825 + .long 539595776 + .long 1071603096 + .long 3868820135 + .long 1022936424 + .long 4264017664 + .long 1071621687 + .long 3228065145 + .long 1023479578 + .long 1733924096 + .long 1071640324 + .long 3511934475 + .long 1022496355 + .long 108880384 + .long 1071651839 + .long 615880967 + .long 1023519706 + .long 3517856512 + .long 1071661202 + .long 3113108559 + .long 1025190289 + .long 4043153152 + .long 1071670589 + .long 1571836218 + .long 1023106116 + .long 3251299072 + .long 1071680000 + .long 3444076102 + .long 1022187841 + .long 2736921600 + .long 1071689435 + .long 272771483 + .long 1025095280 + .long 3897698560 + .long 1071703633 + .long 2075390188 + .long 1022489022 + .long 3209485056 + .long 1071722652 + .long 1438094065 + .long 1021844944 + .long 3781432064 + .long 1071741774 + .long 1675017145 + .long 1024143828 + .long 2684184064 + .long 1071761003 + .long 2259963753 + .long 1024731393 + .long 1840489728 + .long 1071780342 + .long 3372883597 + .long 1023431408 + .long 3764087808 + .long 1071799794 + .long 3307523102 + .long 1024485788 + .long 3006232320 + .long 1071819364 + .long 3088971966 + .long 1025213251 + .long 3374881280 + .long 1071839055 + .long 834437749 + .long 1025236452 + .long 797284864 + .long 1071858872 + .long 3122663941 + .long 1025320473 + .long 545765120 + .long 1071878818 + .long 826539625 + .long 1022450955 + .long 107562240 + .long 1071898898 + .long 339584600 + .long 1022481255 + .long 2123649024 + .long 1071919116 + .long 3912959833 + .long 1024321009 + .long 1562385664 + .long 1071939478 + .long 2846067230 + .long 1023343981 + .long 2963085824 + .long 1071959988 + .long 954548627 + .long 1021475211 + .long 3325550592 + .long 1071980652 + .long 3459651155 + .long 1025305573 + .long 775752448 + .long 1072001476 + .long 3582746667 + .long 1023859460 + .long 3238590720 + .long 1072022464 + .long 634636162 + .long 1024472353 + .long 2758801920 + .long 1072043624 + .long 3078216319 + .long 1025304516 + .long 1370319104 + .long 1072064962 + .long 2570569078 + .long 1025099442 + .long 2615805184 + .long 1072086484 + .long 3729933412 + .long 1024605112 + .long 3077336576 + .long 1072108198 + .long 1948916066 + .long 1024781603 + .long 1099528192 + .long 1072130112 + .long 3139143157 + .long 1023729360 + .long 1231903232 + .long 1072152233 + .long 1349513477 + .long 1024737515 + .long 1507504128 + .long 1072174570 + .long 3484516322 + .long 1024000959 + .long 2214659840 + .long 1072197132 + .long 2563820917 + .long 1025225535 + .long 1804739840 + .long 1072219929 + .long 760038746 + .long 1024482855 + .long 1413746688 + .long 1072242971 + .long 3401734714 + .long 1025129838 + .long 821409536 + .long 1072266269 + .long 3729772551 + .long 1025484796 + .long 3031825664 + .long 1072289834 + .long 122256749 + .long 1024752594 + .long 1710784256 + .long 1072313680 + .long 1518205483 + .long 1024724809 + .long 3025265152 + .long 1072337819 + .long 409951989 + .long 1022835555 + .long 287769088 + .long 1072362267 + .long 800355594 + .long 1022484850 + .long 198179840 + .long 1072387038 + .long 3502926213 + .long 1024209373 + .long 1909130496 + .long 1072412149 + .long 3064694319 + .long 1025380823 + .long 1941732096 + .long 1072437619 + .long 4112930390 + .long 1024294679 + .long 3492010496 + .long 1072463467 + .long 2684918107 + .long 1023220233 + .long 81959680 + .long 1072489716 + .long 220021366 + .long 1020635131 + .long 2297837056 + .long 1072516387 + .long 4027683826 + .long 1021041185 + .long 270404096 + .long 1072543508 + .long 2012766065 + .long 1021780753 + .long 3667376896 + .long 1072571105 + .long 2727981522 + .long 1023009874 + .long 330400256 + .long 1072599212 + .long 2940017003 + .long 1025393439 + .long 1119293952 + .long 1072627861 + .long 1608550416 + .long 1022675612 + .long 3536155904 + .long 1072657091 + .long 349665778 + .long 1025156751 + .long 3078046720 + .long 1072686946 + .long 2016159996 + .long 1022193169 + .long 455228416 + .long 1072705361 + .long 1908539328 + .long 1026126332 + .long 1871505664 + .long 1072720988 + .long 2784700894 + .long 1025922277 + .long 1630994432 + .long 1072737010 + .long 361107678 + .long 1022887244 + .long 2084558336 + .long 1072753462 + .type Tbl_addr,@object + .size Tbl_addr,3840 + .space 768, 0x00 # pad + .align 16 +cv: + .long 0 + .long 0 + .long 1431655765 + .long 3217380693 + .long 858993459 + .long 3216192307 + .long 3067833783 + .long 3215383405 + .type cv,@object + .size cv,32 + .align 16 +PI_BY_2: + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1073291771 + .type PI_BY_2,@object + .size PI_BY_2,16 + .align 16 +NEG_PI: + .long 856972295 + .long 3164710438 + .long 1413754136 + .long 3221823995 + .type NEG_PI,@object + .size NEG_PI,16 + .align 16 +cv2: + .long 780903145 + .long 1066854586 + .long 858993459 + .long 1068708659 + .long 3340530119 + .long 1067392113 + .long 1431655765 + .long 1069897045 + .long 1321528399 + .long 1066517740 + .long 3067833783 + .long 1067899757 + .long 2021159460 + .long 1065855096 + .long 2576980378 + .long 1066178969 + .type cv2,@object + .size cv2,64 + .align 16 +HALFMASK: + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .type HALFMASK,@object + .size HALFMASK,16 + .align 16 +PI: + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 1074340347 + .type PI,@object + .size PI,16 + .align 4 +ONEMASK: + .long 0 + .long 1072693248 + .type ONEMASK,@object + .size ONEMASK,8 + .align 4 +TMASK: + .long 0 + .long 4294950912 + .type TMASK,@object + .size TMASK,8 + .align 4 +ONE_BY_2: + .long 0 + .long 1071644672 + .type ONE_BY_2,@object + .size ONE_BY_2,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/acosf_gen.S b/external/sgx_libm/intel64/acosf_gen.S new file mode 100644 index 0000000000..9a81f29fb2 --- /dev/null +++ b/external/sgx_libm/intel64/acosf_gen.S @@ -0,0 +1,291 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acosf_gen.c" + .text +..TXTST0: +# -- Begin acosf + .text + .align 16,0x90 + .globl acosf +acosf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_acosf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %eax + andl $2147483647, %eax + cmpl $1065353216, %eax + jae ..B1.10 +..B1.2: + cmpl $1056964608, %eax + jae ..B1.6 +..B1.3: + cmpl $838860800, %eax + jae ..B1.5 +..B1.4: + cvtss2sd %xmm0, %xmm0 + movsd .L_2il0floatpacket.8(%rip), %xmm1 + subsd %xmm0, %xmm1 + cvtsd2ss %xmm1, %xmm1 + movaps %xmm1, %xmm0 + ret +..B1.5: + pxor %xmm5, %xmm5 + cvtss2sd -8(%rsp), %xmm5 + movaps %xmm5, %xmm1 + mulsd %xmm5, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.0(%rip), %xmm4 + movsd .L_2il0floatpacket.4(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.1(%rip), %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.2(%rip), %xmm4 + addsd .L_2il0floatpacket.6(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.3(%rip), %xmm4 + addsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + movsd .L_2il0floatpacket.8(%rip), %xmm3 + addsd %xmm2, %xmm4 + subsd %xmm5, %xmm3 + mulsd %xmm4, %xmm5 + subsd %xmm5, %xmm3 + jmp ..B1.9 +..B1.6: + pxor %xmm3, %xmm3 + testl $-2147483648, %edx + cvtss2sd -8(%rsp), %xmm3 + movsd .L_2il0floatpacket.1(%rip), %xmm6 + movsd .L_2il0floatpacket.2(%rip), %xmm9 + movsd .L_2il0floatpacket.3(%rip), %xmm10 + movsd .L_2il0floatpacket.5(%rip), %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm1 + movsd .L_2il0floatpacket.7(%rip), %xmm2 + je ..B1.8 +..B1.7: + movsd .L_2il0floatpacket.13(%rip), %xmm5 + pxor %xmm8, %xmm8 + movsd .L_2il0floatpacket.0(%rip), %xmm7 + addsd %xmm3, %xmm5 + mulsd .L_2il0floatpacket.9(%rip), %xmm5 + movaps %xmm5, %xmm4 + mulsd %xmm5, %xmm4 + sqrtsd %xmm5, %xmm8 + mulsd %xmm4, %xmm7 + mulsd .L_2il0floatpacket.10(%rip), %xmm8 + addsd %xmm6, %xmm7 + movsd .L_2il0floatpacket.4(%rip), %xmm6 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm7 + addsd %xmm0, %xmm6 + addsd %xmm9, %xmm7 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm7 + addsd %xmm1, %xmm6 + addsd %xmm10, %xmm7 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm7 + addsd %xmm2, %xmm6 + mulsd %xmm5, %xmm6 + movsd .L_2il0floatpacket.11(%rip), %xmm3 + addsd %xmm6, %xmm7 + subsd %xmm8, %xmm3 + mulsd %xmm7, %xmm8 + subsd %xmm8, %xmm3 + jmp ..B1.9 +..B1.8: + movsd .L_2il0floatpacket.13(%rip), %xmm5 + movsd .L_2il0floatpacket.0(%rip), %xmm7 + subsd %xmm3, %xmm5 + mulsd .L_2il0floatpacket.9(%rip), %xmm5 + pxor %xmm3, %xmm3 + movaps %xmm5, %xmm4 + mulsd %xmm5, %xmm4 + sqrtsd %xmm5, %xmm3 + mulsd %xmm4, %xmm7 + mulsd .L_2il0floatpacket.10(%rip), %xmm3 + addsd %xmm6, %xmm7 + movsd .L_2il0floatpacket.4(%rip), %xmm6 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm7 + addsd %xmm0, %xmm6 + addsd %xmm9, %xmm7 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm7 + addsd %xmm1, %xmm6 + addsd %xmm10, %xmm7 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm7 + addsd %xmm2, %xmm6 + mulsd %xmm5, %xmm6 + addsd %xmm6, %xmm7 + mulsd %xmm3, %xmm7 + addsd %xmm7, %xmm3 +..B1.9: + cvtsd2ss %xmm3, %xmm3 + movaps %xmm3, %xmm0 + ret +..B1.10: + cmpl $2139095040, %eax + ja ..B1.16 +..B1.11: + cmpl $1065353216, %eax + jne ..B1.17 +..B1.12: + testl $-2147483648, %edx + je ..B1.14 +..B1.13: + lea _small_value_64(%rip), %rax + movsd .L_2il0floatpacket.11(%rip), %xmm0 + addsd (%rax), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.14: + pxor %xmm0, %xmm0 +..B1.15: + ret +..B1.16: + movss -8(%rsp), %xmm0 + ret +..B1.17: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.12(%rip), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type acosf,@function + .size acosf,.-acosf + .data +# -- End acosf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0xa6220783,0x3f9e3be5 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0xb5dc5888,0x3f93d64d + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x5290ac8c,0x3f9f20d0 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x4fa3bc7b,0x3fb33333 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xa9336e0b,0x3f758206 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0xecc3fecb,0x3f96a6f2 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x9e7be0cc,0x3fa6db5b + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x554dfea4,0x3fc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x54442d18,0x3ff921fb + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x54442d18,0x400921fb + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 4 +.L_2il0floatpacket.12: + .long 0x7f800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/acosh_gen.S b/external/sgx_libm/intel64/acosh_gen.S new file mode 100644 index 0000000000..d7ac4c73a2 --- /dev/null +++ b/external/sgx_libm/intel64/acosh_gen.S @@ -0,0 +1,384 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acosh_gen.c" + .text +..TXTST0: +# -- Begin acosh + .text + .align 16,0x90 + .globl acosh +acosh: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_acosh.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + lea -1072693248(%rax), %edx + cmpl $1073741824, %edx + jae ..B1.14 +..B1.2: + cmpl $6144, %edx + jae ..B1.6 +..B1.3: + movl -8(%rsp), %eax + orl %eax, %edx + jne ..B1.5 +..B1.4: + lea _zeros(%rip), %rax + movsd (%rax), %xmm0 + ret +..B1.5: + lea 8+_ones(%rip), %rax + pxor %xmm3, %xmm3 + movsd -8(%rsp), %xmm5 + xorl %r9d, %r9d + movsd .L_2il0floatpacket.0(%rip), %xmm4 + lea 32+_PA(%rip), %rdx + lea 16+_PA(%rip), %rcx + lea 24+_PA(%rip), %rdi + lea _PA(%rip), %rsi + addsd (%rax), %xmm5 + mulsd %xmm5, %xmm4 + movaps %xmm5, %xmm6 + mulsd %xmm5, %xmm6 + sqrtsd %xmm4, %xmm3 + movsd %xmm3, -16(%rsp) + movaps %xmm3, %xmm0 + movl %r9d, -16(%rsp) + lea 8+_PA(%rip), %r8 + movsd -16(%rsp), %xmm11 + movaps %xmm11, %xmm1 + movaps %xmm11, %xmm2 + movsd (%rdx), %xmm8 + subsd %xmm11, %xmm0 + mulsd %xmm11, %xmm1 + mulsd %xmm6, %xmm8 + mulsd %xmm0, %xmm2 + subsd %xmm1, %xmm4 + addsd (%rcx), %xmm8 + subsd %xmm2, %xmm4 + mulsd %xmm6, %xmm8 + divsd %xmm3, %xmm4 + movsd (%rdi), %xmm7 + addsd %xmm4, %xmm0 + mulsd %xmm6, %xmm7 + addsd (%rsi), %xmm8 + mulsd .L_2il0floatpacket.1(%rip), %xmm0 + addsd (%r8), %xmm7 + mulsd %xmm5, %xmm8 + mulsd %xmm6, %xmm7 + addsd %xmm7, %xmm8 + movsd %xmm8, -24(%rsp) + movaps %xmm8, %xmm9 + movl %r9d, -24(%rsp) + movsd -24(%rsp), %xmm10 + mulsd %xmm0, %xmm8 + subsd %xmm10, %xmm9 + mulsd %xmm11, %xmm10 + mulsd %xmm11, %xmm9 + movsd %xmm10, -24(%rsp) + addsd %xmm8, %xmm9 + addsd %xmm9, %xmm0 + addsd %xmm10, %xmm0 + addsd %xmm11, %xmm0 + ret +..B1.6: + cmpl $29360128, %edx + jae ..B1.11 +..B1.7: + movsd -8(%rsp), %xmm7 + cmpl $2293760, %edx + jae ..B1.9 +..B1.8: + xorl %edx, %edx + movaps %xmm7, %xmm1 + movl %edx, -8(%rsp) + lea 8+_ones(%rip), %rax + movsd -8(%rsp), %xmm8 + movaps %xmm8, %xmm4 + subsd %xmm8, %xmm1 + mulsd %xmm8, %xmm4 + addsd %xmm8, %xmm7 + mulsd %xmm1, %xmm7 + addsd (%rax), %xmm4 + movaps %xmm4, %xmm0 + addsd %xmm7, %xmm0 + sqrtsd %xmm0, %xmm0 + movsd %xmm0, -16(%rsp) + movl %edx, -16(%rsp) + movsd -16(%rsp), %xmm6 + movaps %xmm6, %xmm2 + movaps %xmm6, %xmm3 + mulsd %xmm6, %xmm2 + subsd %xmm6, %xmm0 + addsd %xmm6, %xmm8 + mulsd %xmm0, %xmm3 + subsd %xmm2, %xmm4 + movaps %xmm6, %xmm5 + subsd %xmm3, %xmm4 + addsd %xmm0, %xmm5 + addsd %xmm4, %xmm7 + divsd %xmm5, %xmm7 + addsd %xmm7, %xmm0 + mulsd .L_2il0floatpacket.1(%rip), %xmm0 + addsd %xmm0, %xmm1 + jmp ..B1.10 +..B1.9: + movaps %xmm7, %xmm0 + lea 8+_ones(%rip), %rax + movsd .L_2il0floatpacket.0(%rip), %xmm2 + mulsd %xmm7, %xmm0 + movsd (%rax), %xmm1 + addsd %xmm1, %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm7, %xmm0 + mulsd %xmm2, %xmm7 + divsd %xmm0, %xmm1 + movsd %xmm7, -8(%rsp) + movl $0, -8(%rsp) + movsd -8(%rsp), %xmm8 + subsd %xmm8, %xmm7 + addsd %xmm7, %xmm1 +..B1.10: + movaps %xmm1, %xmm0 + movq $0x3ff0000000000000, %rax + addsd %xmm8, %xmm0 + movsd %xmm0, -8(%rsp) + movl $0, -8(%rsp) + movsd -8(%rsp), %xmm7 + movzwl -2(%rsp), %ecx + subsd %xmm7, %xmm8 + andl $32752, %ecx + addsd %xmm8, %xmm1 + shrl $4, %ecx + addl $-1023, %ecx + movslq %ecx, %rdx + negq %rdx + shlq $52, %rdx + addq %rax, %rdx + movq %rdx, -24(%rsp) + movsd -24(%rsp), %xmm2 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm7 + movaps %xmm1, %xmm3 + addsd %xmm7, %xmm3 + movsd %xmm3, -16(%rsp) + movl -12(%rsp), %esi + shrl $12, %esi + movzbl %sil, %edx + jmp ..B1.12 +..B1.11: + movzwl -2(%rsp), %eax + movl %eax, %ecx + andl $-32753, %eax + andl $32752, %ecx + orl $-49168, %eax + movw %ax, -2(%rsp) + movsd -8(%rsp), %xmm1 + movl $0, -8(%rsp) + movl -4(%rsp), %edx + movsd -8(%rsp), %xmm7 + shrl $4, %ecx + subsd %xmm7, %xmm1 + shrl $12, %edx + addl $-1022, %ecx + movzbl %dl, %edx +..B1.12: + movq __libm_rcp_table_256@GOTPCREL(%rip), %rsi + pxor %xmm0, %xmm0 + lea _ones(%rip), %rdi + lea 32+_PL(%rip), %r8 + lea 24+_PL(%rip), %r11 + lea 16+_PL(%rip), %r9 + lea _PL(%rip), %r10 + pxor %xmm6, %xmm6 + movq __libm_log_table_256@GOTPCREL(%rip), %rax + movsd (%r8), %xmm5 + movsd (%r11), %xmm4 + cvtss2sd (%rsi,%rdx,4), %xmm0 + cvtsi2sd %ecx, %xmm6 + mulsd %xmm0, %xmm7 + mulsd %xmm0, %xmm1 + subsd (%rdi), %xmm7 + movaps %xmm7, %xmm3 + lea _LN2(%rip), %rcx + lea 8+_PL(%rip), %rsi + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm4 + addsd (%r9), %xmm5 + addsd (%rsi), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm4 + addsd (%r10), %xmm5 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm5 + movsd (%rcx), %xmm0 + addsd %xmm4, %xmm5 + mulsd %xmm6, %xmm0 + addsd %xmm5, %xmm1 + shlq $4, %rdx + lea 8+_LN2(%rip), %rcx + movsd %xmm3, -16(%rsp) + addsd (%rax,%rdx), %xmm0 + addsd %xmm1, %xmm0 + movsd (%rcx), %xmm1 + mulsd %xmm1, %xmm6 + addsd 8(%rax,%rdx), %xmm6 + movsd %xmm6, -24(%rsp) + addsd %xmm6, %xmm7 + movsd %xmm7, -8(%rsp) + addsd %xmm7, %xmm0 +..B1.13: + ret +..B1.14: + movl %eax, %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + jbe ..B1.16 +..B1.15: + movsd -8(%rsp), %xmm0 + addsd %xmm0, %xmm0 + ret +..B1.16: + cmpl $2146435072, %eax + jne ..B1.18 +..B1.17: + cmpl $0, -8(%rsp) + je ..B1.15 +..B1.18: + cmpl $2146435072, %edx + jne ..B1.20 +..B1.19: + cmpl $0, -8(%rsp) + jne ..B1.15 +..B1.20: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type acosh,@function + .size acosh,.-acosh + .data +# -- End acosh + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_PA: + .long 1431655760 + .long 3216332117 + .long 858954823 + .long 1066611507 + .long 2956777430 + .long 3212237677 + .long 4158004615 + .long 1063197775 + .long 2173429939 + .long 3209085130 + .type _PA,@object + .size _PA,40 + .align 4 +_PL: + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .type _PL,@object + .size _PL,40 + .align 4 +_LN2: + .long 897137782 + .long 1038760431 + .long 4276092928 + .long 1072049730 + .type _LN2,@object + .size _LN2,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/acoshf_gen.S b/external/sgx_libm/intel64/acoshf_gen.S new file mode 100644 index 0000000000..c7ac5ad419 --- /dev/null +++ b/external/sgx_libm/intel64/acoshf_gen.S @@ -0,0 +1,248 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acoshf_gen.c" + .text +..TXTST0: +# -- Begin acoshf + .text + .align 16,0x90 + .globl acoshf +acoshf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_acoshf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -16(%rsp) + lea -1065353216(%rdx), %eax + cmpl $1073741824, %eax + jae ..B1.11 +..B1.2: + cmpl $4194304, %eax + jae ..B1.6 +..B1.3: + testl %eax, %eax + jne ..B1.5 +..B1.4: + pxor %xmm0, %xmm0 + ret +..B1.5: + pxor %xmm3, %xmm3 + cvtss2sd -16(%rsp), %xmm3 + movsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd %xmm3, -24(%rsp) + addsd %xmm0, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + movsd .L_2il0floatpacket.2(%rip), %xmm5 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.3(%rip), %xmm5 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.4(%rip), %xmm5 + addsd .L_2il0floatpacket.8(%rip), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm5 + addsd .L_2il0floatpacket.9(%rip), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm3, %xmm4 + movsd .L_2il0floatpacket.1(%rip), %xmm1 + addsd %xmm4, %xmm5 + mulsd %xmm3, %xmm1 + sqrtsd %xmm1, %xmm1 + mulsd %xmm1, %xmm5 + addsd %xmm1, %xmm5 + jmp ..B1.10 +..B1.6: + pxor %xmm1, %xmm1 + cmpl $134217728, %eax + cvtss2sd -16(%rsp), %xmm1 + jae ..B1.8 +..B1.7: + movaps %xmm1, %xmm0 + movl $-1023, %edi + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.0(%rip), %xmm2 + addsd %xmm2, %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm0, %xmm1 + movsd %xmm1, -24(%rsp) + jmp ..B1.9 +..B1.8: + movsd %xmm1, -24(%rsp) + movl $-1022, %edi + movsd .L_2il0floatpacket.0(%rip), %xmm2 +..B1.9: + movzwl -18(%rsp), %edx + movl %edx, %eax + andl $-32753, %edx + pxor %xmm0, %xmm0 + orl $-49168, %edx + andl $32752, %eax + movw %dx, -18(%rsp) + pxor %xmm1, %xmm1 + movq __libm_rcp_table_256@GOTPCREL(%rip), %rsi + movl -20(%rsp), %ecx + andl $1048575, %ecx + shrl $12, %ecx + cvtss2sd (%rsi,%rcx,4), %xmm0 + mulsd -24(%rsp), %xmm0 + movsd .L_2il0floatpacket.11(%rip), %xmm5 + addsd %xmm2, %xmm0 + mulsd %xmm0, %xmm5 + shrl $4, %eax + addsd .L_2il0floatpacket.12(%rip), %xmm5 + addl %eax, %edi + cvtsi2sd %edi, %xmm1 + mulsd %xmm0, %xmm5 + mulsd .L_2il0floatpacket.13(%rip), %xmm1 + mulsd %xmm0, %xmm5 + movq __libm_logf_table_256@GOTPCREL(%rip), %r8 + addsd %xmm0, %xmm5 + addsd (%r8,%rcx,8), %xmm1 + movsd %xmm0, -24(%rsp) + addsd %xmm1, %xmm5 +..B1.10: + cvtsd2ss %xmm5, %xmm5 + movaps %xmm5, %xmm0 + ret +..B1.11: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.14 +..B1.12: + cmpl $2139095040, %edx + je ..B1.14 +..B1.13: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.10(%rip), %xmm0 + ret +..B1.14: + movss -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type acoshf,@function + .size acoshf,.-acoshf + .data +# -- End acoshf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0xd28ee596,0x3ef3cb17 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x9b9f611c,0x3f31287a + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xac0cf195,0x3f5f1aa4 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x1236cb49,0x3f933333 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xd27f5e7d,0xbf174400 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x4197b1a0,0xbf46d307 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0xdacdeace,0xbf76db62 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x552ea1bd,0xbfb55555 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x6890dd10,0x3fd5555a + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0xe7362feb,0xbfe00001 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0xfefa39ef,0x3fe62e42 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 4 +.L_2il0floatpacket.10: + .long 0x7f800000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/acoshl.S b/external/sgx_libm/intel64/acoshl.S new file mode 100644 index 0000000000..7d9a3aab0b --- /dev/null +++ b/external/sgx_libm/intel64/acoshl.S @@ -0,0 +1,947 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acoshl.c" + .text +..TXTST0: +# -- Begin acoshl + .text + .align 16,0x90 + .globl acoshl +acoshl: +# parameter 1: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_acoshl.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %cl, %cl +..B1.2: + fnstcw 50(%rsp) +..B1.3: + movzwl 72(%rsp), %edi + movl %edi, %edx + movzbl 73(%rsp), %esi + andl $32767, %edx + shrl $7, %esi + shll $15, %esi + orl %edx, %esi + shll $16, %esi + movzwl 70(%rsp), %eax + orl %eax, %esi + addl $-1073709056, %esi + cmpl $1073741824, %esi + jae ..B1.40 +..B1.4: + cmpl $8192, %esi + jae ..B1.21 +..B1.5: + cmpl $64, %esi + jae ..B1.14 +..B1.6: + cmpl $16383, %edx + je ..B1.38 +..B1.7: + movzwl 50(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.11 +..B1.8: + orl $-64768, %edx + movw %dx, 48(%rsp) +..B1.9: + fldcw 48(%rsp) +..B1.10: + movb $1, %cl +..B1.11: + fldt 64(%rsp) + lea 8+_ones(%rip), %rax + lea _TWO_52H(%rip), %rdx + lea 80+_Q1(%rip), %rsi + lea 48+_Q1(%rip), %rdi + lea 16+_Q1(%rip), %r8 + lea 64+_Q1(%rip), %r9 + lea 32+_Q1(%rip), %r10 + lea _Q1(%rip), %r11 + testb %cl, %cl + fldl (%rdx) + fld %st(0) + fxch %st(2) + faddl (%rax) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(0) + fmul %st(1), %st + fld %st(1) + fsub %st(4), %st + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rsi) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r11) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + fmul %st, %st(2) + fld %st(2) + fxch %st(1) + fmulp %st, %st(5) + fadd %st(4), %st + fsqrt + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(6) + fld %st(4) + fmul %st(1), %st + fsubrp %st, %st(6) + fxch %st(3) + faddp %st, %st(5) + fdivrp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(2) + fadd %st(1), %st + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.13 +..B1.12: + fldcw 50(%rsp) +..B1.13: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.14: + movzwl 50(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.18 +..B1.15: + orl $-64768, %edx + movw %dx, 48(%rsp) +..B1.16: + fldcw 48(%rsp) +..B1.17: + movb $1, %cl +..B1.18: + fldt 64(%rsp) + lea 8+_ones(%rip), %rax + lea _TWO_52H(%rip), %rdx + lea 208+_Q(%rip), %rsi + lea 176+_Q(%rip), %rdi + lea 144+_Q(%rip), %r8 + lea 112+_Q(%rip), %r9 + lea 80+_Q(%rip), %r10 + lea 48+_Q(%rip), %r11 + testb %cl, %cl + fldl (%rdx) + lea 192+_Q(%rip), %rdx + fstpt 16(%rsp) + fldt 16(%rsp) + fldt (%rdi) + lea 128+_Q(%rip), %rdi + fldt (%r8) + lea 96+_Q(%rip), %r8 + fxch %st(3) + faddl (%rax) + lea 16+_Q(%rip), %rax + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fld %st(1) + fsub %st(4), %st + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fxch %st(5) + fstpt 32(%rsp) + fldt 32(%rsp) + fmul %st(0), %st + fadd %st, %st(5) + fxch %st(3) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rsi) + lea 160+_Q(%rip), %rsi + fmul %st(6), %st + faddp %st, %st(5) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(6) + fxch %st(4) + fmul %st, %st(5) + fldt (%r9) + lea 64+_Q(%rip), %r9 + faddp %st, %st(6) + fmul %st, %st(5) + fldt (%r10) + lea 32+_Q(%rip), %r10 + faddp %st, %st(6) + fmul %st, %st(5) + fldt (%r11) + lea _Q(%rip), %r11 + faddp %st, %st(6) + fmul %st, %st(5) + fldt (%rax) + lea 240+_Q(%rip), %rax + faddp %st, %st(6) + fmul %st, %st(5) + fldt (%rdx) + lea 224+_Q(%rip), %rdx + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(4) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fmulp %st, %st(1) + fldt (%rdx) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(4) + fldt 32(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fld %st(0) + fadd %st(3), %st + fsub %st(1), %st + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fldt .L_2il0floatpacket.0(%rip) + fmul %st, %st(4) + fld %st(4) + fxch %st(1) + fmulp %st, %st(3) + fadd %st(2), %st + fsqrt + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fsubrp %st, %st(3) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(1), %st + fsubrp %st, %st(4) + fxch %st(5) + faddp %st, %st(3) + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fld %st(0) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(4) + fadd %st(3), %st + fmulp %st, %st(4) + fld %st(1) + fmul %st(3), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fmul %st(2), %st + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.20 +..B1.19: + fldcw 50(%rsp) +..B1.20: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.21: + movzwl 50(%rsp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.25 +..B1.22: + orl $-64768, %esi + movw %si, 48(%rsp) +..B1.23: + fldcw 48(%rsp) +..B1.24: + movzwl 72(%rsp), %edi + movl %edi, %edx + movb $1, %cl + andl $32767, %edx +..B1.25: + cmpl $16417, %edx + jge ..B1.34 +..B1.26: + fldt 64(%rsp) + cmpl $16388, %edx + jge ..B1.28 +..B1.27: + lea _TWO_52H(%rip), %rax + fld %st(0) + fld %st(1) + lea 8+_ones(%rip), %r8 + lea _ones(%rip), %rdx + fldl (%rax) + fld %st(0) + fxch %st(1) + fadd %st, %st(3) + fsubr %st, %st(3) + fld %st(3) + fxch %st(3) + fsub %st(4), %st + fmul %st, %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fld %st(3) + fmul %st(4), %st + faddl (%r8) + fld %st(0) + fadd %st(4), %st + fsqrt + fadd %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fsubrp %st, %st(1) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fdivrp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl (%rdx) + jmp ..B1.33 +..B1.28: + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_32H(%rip), %rax + fmul %st(1), %st + lea _ones(%rip), %rsi + fld %st(0) + lea 8+_ones(%rip), %r8 + fldl (%rax) + cmpl $16394, %edx + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubr %st(1), %st + fldl (%rsi) + fldl (%r8) + jge ..B1.30 +..B1.29: + fstp %st(3) + fld %st(3) + fadd %st(3), %st + fld %st(4) + fadd %st(2), %st + fmulp %st, %st(1) + fsqrt + faddp %st, %st(4) + fxch %st(3) + fdivrp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + jmp ..B1.33 +..B1.30: + fstp %st(4) + cmpl $16401, %edx + jge ..B1.32 +..B1.31: + fld %st(3) + fdiv %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fdivrp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.33 +..B1.32: + fxch %st(2) + fdivrp %st, %st(3) + faddp %st, %st(2) +..B1.33: + fldt 16(%rsp) + fld %st(0) + fadd %st(3), %st + fstpt 64(%rsp) + movzwl 72(%rsp), %edx + andl $32767, %edx + movl %edx, %eax + addl $-16383, %edx + negl %eax + fxch %st(1) + fstpt (%rsp) + addl $-2, %eax + movzwl 8(%rsp), %esi + andl $32767, %eax + andl $-32768, %esi + orl %eax, %esi + movw %si, 8(%rsp) + fldt (%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fmulp %st, %st(1) + jmp ..B1.35 +..B1.34: + lea _TWO_52H(%rip), %rax + andl $-32768, %edi + orl $-49153, %edi + addl $-16382, %edx + movw %di, 72(%rsp) + lea 8+_ones(%rip), %r8 + fldt 64(%rsp) + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) +..B1.35: + fldt 16(%rsp) + lea 16+_P(%rip), %r9 + movl 68(%rsp), %esi + lea 64+_P(%rip), %r10 + shrl $23, %esi + lea 32+_P(%rip), %r11 + movzbl %sil, %eax + fldt (%r9) + movq __libm_rcp_table_256@GOTPCREL(%rip), %rdi + movl %edx, 32(%rsp) + lea 80+_P(%rip), %rdx + fildl 32(%rsp) + flds (%rdi,%rax,4) + fmul %st, %st(3) + fmulp %st, %st(4) + fxch %st(2) + faddl (%r8) + fld %st(0) + lea 48+_P(%rip), %r8 + shlq $4, %rax + fadd %st(4), %st + fld %st(0) + testb %cl, %cl + fmul %st(1), %st + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea _P(%rip), %rdx + fmul %st(2), %st + fldt (%r8) + movq __libm_logl_table_256@GOTPCREL(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fldt (%r10) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(2), %st + fldt .L_2il0floatpacket.3(%rip) + fmulp %st, %st(3) + faddl 8(%rsi,%rax) + faddp %st, %st(3) + fxch %st(1) + faddl (%rax,%rsi) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.37 +..B1.36: + fldcw 50(%rsp) +..B1.37: + fldt 16(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.38: + movq $0x8000000000000000, %rax + cmpq 64(%rsp), %rax + jne ..B1.7 +..B1.39: + lea _zeros(%rip), %rax + fldl (%rax) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.40: + movzwl 50(%rsp), %esi + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.44 +..B1.41: + orl $-64768, %esi + movw %si, 48(%rsp) +..B1.42: + fldcw 48(%rsp) +..B1.43: + movzwl 72(%rsp), %edx + movb $1, %cl + andl $32767, %edx +..B1.44: + cmpl $32767, %edx + jne ..B1.47 +..B1.45: + movq $0x8000000000000000, %rax + cmpq 64(%rsp), %rax + je ..B1.51 +..B1.46: + fldt 64(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) + jmp ..B1.48 +..B1.47: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt (%rsp) +..B1.48: + testb %cl, %cl + je ..B1.50 +..B1.49: + fldcw 50(%rsp) +..B1.50: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.51: + testb $-128, 73(%rsp) + je ..B1.46 + jmp ..B1.47 + .align 16,0x90 + .cfi_endproc + .type acoshl,@function + .size acoshl,.-acoshl + .data +# -- End acoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 37372 + .word 39321 + .word 39321 + .word 39321 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 18586 + .word 55971 + .word 28086 + .word 46811 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 15813 + .word 59837 + .word 36396 + .word 63715 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 53727 + .word 45078 + .word 40330 + .word 46917 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 48396 + .word 8155 + .word 33124 + .word 36271 + .word 16371 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,96 + .align 2 +_Q: + .word 48098 + .word 43690 + .word 43690 + .word 43690 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 20923 + .word 52462 + .word 52428 + .word 52428 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 38527 + .word 56172 + .word 28086 + .word 46811 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 47050 + .word 58060 + .word 36408 + .word 63715 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 28121 + .word 12720 + .word 53620 + .word 46917 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 5738 + .word 23392 + .word 25199 + .word 36391 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 9822 + .word 24561 + .word 52037 + .word 58572 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 32045 + .word 31633 + .word 41878 + .word 48451 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 16262 + .word 24754 + .word 13643 + .word 40941 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 36557 + .word 45689 + .word 21168 + .word 35169 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 29793 + .word 40103 + .word 23573 + .word 60969 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 51189 + .word 17117 + .word 14297 + .word 51855 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 6461 + .word 12463 + .word 55551 + .word 38957 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 34939 + .word 19802 + .word 20012 + .word 37205 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43696 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,256 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,96 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/acosl.S b/external/sgx_libm/intel64/acosl.S new file mode 100644 index 0000000000..417a3ff052 --- /dev/null +++ b/external/sgx_libm/intel64/acosl.S @@ -0,0 +1,1366 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "acosl.c" + .text +..TXTST0: +# -- Begin acosl + .text + .align 16,0x90 + .globl acosl +acosl: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_acosl.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %cl, %cl +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movb 105(%rsp), %dl + movzwl 104(%rsp), %edi + andb $-128, %dl + andl $32767, %edi + shrb $7, %dl + movzwl 82(%rsp), %eax + cmpl $16383, %edi + jge ..B1.60 +..B1.4: + cmpl $16382, %edi + jge ..B1.47 +..B1.5: + cmpl $16376, %edi + jge ..B1.37 +..B1.6: + cmpl $16371, %edi + jge ..B1.30 +..B1.7: + cmpl $16365, %edi + jge ..B1.23 +..B1.8: + cmpl $16308, %edi + jge ..B1.16 +..B1.9: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.13 +..B1.10: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.11: + fldcw 80(%rsp) +..B1.12: + movb $1, %cl +..B1.13: + fldt 96(%rsp) + lea 16+_pi_02(%rip), %rax + lea _pi_02(%rip), %rdx + testb %cl, %cl + fldt (%rax) + fsubp %st, %st(1) + fldt (%rdx) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.15 +..B1.14: + fldcw 82(%rsp) +..B1.15: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.16: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.17: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.18: + fldcw 80(%rsp) +..B1.19: + movb $1, %cl +..B1.20: + fldt 96(%rsp) + lea _P4(%rip), %rax + lea 16+_pi_02(%rip), %rdx + lea _pi_02(%rip), %rsi + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fldt (%rdx) + fsubp %st, %st(1) + fldt (%rsi) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.22 +..B1.21: + fldcw 82(%rsp) +..B1.22: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.23: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.27 +..B1.24: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.25: + fldcw 80(%rsp) +..B1.26: + movb $1, %cl +..B1.27: + fldt 96(%rsp) + lea 16+_P3(%rip), %rax + fld %st(0) + lea _P3(%rip), %rdx + fmul %st(1), %st + lea 16+_pi_02(%rip), %rsi + fldt (%rax) + lea _pi_02(%rip), %rdi + fmul %st(1), %st + testb %cl, %cl + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fldt (%rsi) + fsubp %st, %st(1) + fldt (%rdi) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.29 +..B1.28: + fldcw 82(%rsp) +..B1.29: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.30: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.34 +..B1.31: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.32: + fldcw 80(%rsp) +..B1.33: + movb $1, %cl +..B1.34: + fldt 96(%rsp) + lea _TWO_32H(%rip), %rax + fld %st(0) + lea 48+_P2(%rip), %rdx + fmul %st(1), %st + lea 16+_P2(%rip), %rsi + fld %st(0) + lea 32+_P2(%rip), %rdi + fmul %st(1), %st + fld %st(2) + lea _P2(%rip), %r8 + fld %st(3) + fldl (%rax) + lea 16+_pi_02(%rip), %r9 + fmul %st(5), %st + lea _pi_02(%rip), %r10 + testb %cl, %cl + fadd %st, %st(2) + fsubrp %st, %st(2) + fsub %st(1), %st + fldt (%rdx) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + fmulp %st, %st(4) + fldt (%r8) + faddp %st, %st(4) + fxch %st(4) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%r9) + fsubp %st, %st(1) + fldt (%r10) + fsubp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.36 +..B1.35: + fldcw 82(%rsp) +..B1.36: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.37: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.41 +..B1.38: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.39: + fldcw 80(%rsp) +..B1.40: + movzwl 104(%rsp), %edi + movb $1, %cl + andl $32767, %edi +..B1.41: + fldt 96(%rsp) + lea _TWO_52H(%rip), %rax + fld %st(0) + cmpl $16381, %edi + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fldl (%rax) + fmul %st, %st(2) + fstpt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fld %st(1) + fsub %st(3), %st + fmul %st, %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fld %st(3) + fmul %st(4), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fld %st(2) + fmul %st(2), %st + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fld %st(1) + fmul %st(2), %st + fadd %st, %st(1) + fxch %st(3) + fstpt 16(%rsp) + jge ..B1.43 +..B1.42: + fstp %st(2) + lea 176+_P1(%rip), %rax + lea 144+_P1(%rip), %rdx + lea 112+_P1(%rip), %rsi + lea 80+_P1(%rip), %rdi + lea 160+_P1(%rip), %r10 + lea 48+_P1(%rip), %r8 + lea 128+_P1(%rip), %r11 + lea 16+_P1(%rip), %r9 + fldt (%rax) + lea 96+_P1(%rip), %rax + fmul %st(2), %st + fldt (%rdx) + lea 64+_P1(%rip), %rdx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 32+_P1(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + lea _P1(%rip), %rdi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + lea 192+_P1(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%rdi) + faddp %st, %st(3) + fldt 64(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 16(%rsp) + fldt (%r8) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + fxch %st(1) + jmp ..B1.44 +..B1.43: + lea 272+_P(%rip), %rax + lea 240+_P(%rip), %rdx + lea 208+_P(%rip), %rsi + lea 176+_P(%rip), %rdi + lea 144+_P(%rip), %r8 + lea 112+_P(%rip), %r9 + lea 80+_P(%rip), %r10 + lea 48+_P(%rip), %r11 + fldt (%rax) + lea 16+_P(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + lea 256+_P(%rip), %rdx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + lea 224+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea 192+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 160+_P(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + lea 128+_P(%rip), %r9 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + lea 96+_P(%rip), %r10 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + lea 64+_P(%rip), %r11 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea 32+_P(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + lea _P(%rip), %rdx + fmul %st(2), %st + fldt (%rsi) + lea 304+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 288+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rdx) + faddp %st, %st(2) + fldt 64(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + fldt 16(%rsp) + fldt (%rsi) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(4) + fldt (%rdi) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fld %st(3) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 32(%rsp) + fmul %st(3), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) +..B1.44: + fldt (%rsp) + lea _pi_02(%rip), %rax + fmulp %st, %st(1) + fld %st(2) + fmul %st(2), %st + lea 16+_pi_02(%rip), %rdx + testb %cl, %cl + faddp %st, %st(1) + faddp %st, %st(2) + fmul %st(2), %st + faddp %st, %st(2) + fldt (%rax) + fld %st(0) + fsubr %st(3), %st + fchs + fsub %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt (%rdx) + fsubp %st, %st(2) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.46 +..B1.45: + fldcw 82(%rsp) +..B1.46: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.47: + movl %eax, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.51 +..B1.48: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.49: + fldcw 80(%rsp) +..B1.50: + movb $1, %cl +..B1.51: + fldt 96(%rsp) + lea _ones(%rip), %rsi + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_32H(%rip), %rdi + movzbl %dl, %eax + lea _TWO_52H(%rip), %r8 + fldl (%rdi) + fxch %st(2) + fmull (%rsi,%rax,8) + fldl (%r8) + fstpt 16(%rsp) + fldt 16(%rsp) + fxch %st(1) + fsubrl (%rsi) + fmul %st(2), %st + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubp %st, %st(4) + fld %st(3) + fxch %st(1) + fsub %st(4), %st + fadd %st, %st(1) + fxch %st(1) + fsqrt + fmul %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fsubr %st, %st(5) + fld %st(3) + fxch %st(2) + fsub %st(4), %st + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(6) + fxch %st(2) + faddp %st, %st(5) + fld %st(2) + fadd %st(1), %st + fdivrp %st, %st(5) + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fmul %st(3), %st + fld %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(5), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fld %st(1) + fmul %st(6), %st + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(1) + fstpt (%rsp) + fld %st(4) + fmul %st(5), %st + fadd %st, %st(1) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fcomip %st(1), %st + fstp %st(0) + jbe ..B1.53 +..B1.52: + fstp %st(1) + lea 176+_P1(%rip), %rax + lea 144+_P1(%rip), %rsi + lea 112+_P1(%rip), %rdi + lea 80+_P1(%rip), %r8 + lea 160+_P1(%rip), %r11 + lea 48+_P1(%rip), %r9 + lea 16+_P1(%rip), %r10 + fldt (%rax) + lea 128+_P1(%rip), %rax + fmul %st(1), %st + fldt (%rsi) + lea 96+_P1(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea 64+_P1(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 32+_P1(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + lea _P1(%rip), %r9 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + lea 192+_P1(%rip), %r10 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r9) + faddp %st, %st(2) + fldt 48(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%rsp) + fldt (%r10) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(4) + fxch %st(3) + jmp ..B1.54 +..B1.53: + lea 272+_P(%rip), %rax + lea 240+_P(%rip), %rsi + lea 208+_P(%rip), %rdi + lea 176+_P(%rip), %r8 + lea 144+_P(%rip), %r9 + lea 112+_P(%rip), %r10 + lea 80+_P(%rip), %r11 + fldt (%rax) + lea 48+_P(%rip), %rax + fmul %st(1), %st + fldt (%rsi) + lea 16+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea 256+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 224+_P(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + lea 192+_P(%rip), %r9 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + lea 160+_P(%rip), %r10 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + lea 128+_P(%rip), %r11 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea 96+_P(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + lea 64+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea 32+_P(%rip), %rdi + fmul %st(2), %st + fldt (%r8) + lea _P(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + lea 304+_P(%rip), %r9 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + lea 288+_P(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r8) + faddp %st, %st(2) + fldt 48(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fldt (%rsp) + fldt (%r9) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fldt (%r10) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fld %st(0) + fldt 16(%rsp) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) +..B1.54: + fldt 64(%rsp) + testb %dl, %dl + fmulp %st, %st(4) + fld %st(2) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + je ..B1.56 +..B1.55: + fstp %st(3) + fstp %st(0) + fldt .L_2il0floatpacket.2(%rip) + lea _pi_00(%rip), %rax + lea 16+_pi_00(%rip), %rdx + fmul %st, %st(2) + fmulp %st, %st(1) + fldt (%rax) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fldt (%rdx) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.57 +..B1.56: + fldt .L_2il0floatpacket.3(%rip) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.57: + testb %cl, %cl + je ..B1.59 +..B1.58: + fldcw 82(%rsp) +..B1.59: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.60: + movl %eax, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.64 +..B1.61: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.62: + fldcw 80(%rsp) +..B1.63: + movzwl 104(%rsp), %edi + movb $1, %cl + andl $32767, %edi +..B1.64: + cmpl $32767, %edi + jne ..B1.68 +..B1.65: + cmpl $-2147483648, 100(%rsp) + jne ..B1.67 +..B1.66: + cmpl $0, 96(%rsp) + je ..B1.74 +..B1.67: + fldt 96(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) + jmp ..B1.75 +..B1.68: + cmpl $16383, %edi + jne ..B1.74 +..B1.69: + cmpl $-2147483648, 100(%rsp) + jne ..B1.74 +..B1.70: + cmpl $0, 96(%rsp) + jne ..B1.74 +..B1.71: + testb %dl, %dl + je ..B1.73 +..B1.72: + lea _pi_0l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rax) + fldt (%rdx) + fsubrp %st, %st(1) + fstpt 8(%rsp) + jmp ..B1.75 +..B1.73: + lea _zeros(%rip), %rax + fldl (%rax) + fstpt 8(%rsp) + jmp ..B1.75 +..B1.74: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 8(%rsp) +..B1.75: + testb %cl, %cl + je ..B1.77 +..B1.76: + fldcw 82(%rsp) +..B1.77: + fldt 8(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type acosl,@function + .size acosl,.-acosl + .data +# -- End acosl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_pi_02: + .word 0 + .word 0 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 35374 + .word 4889 + .word 2259 + .word 34211 + .word 16349 + .word 0 + .word 0 + .word 0 + .type _pi_02,@object + .size _pi_02,32 + .align 2 +_P4: + .word 43691 + .word 44938 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P4,@object + .size _P4,16 + .align 2 +_P3: + .word 36763 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 40704 + .word 58046 + .word 39460 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P3,@object + .size _P3,32 + .align 2 +_P2: + .word 43688 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 20771 + .word 39331 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 23807 + .word 53798 + .word 28073 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 35198 + .word 7516 + .word 54204 + .word 63722 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _P2,@object + .size _P2,64 + .align 2 +_P1: + .word 43589 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 39364 + .word 39321 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 17602 + .word 56173 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 47501 + .word 58414 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 27078 + .word 6583 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 39781 + .word 21053 + .word 25224 + .word 36391 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 46568 + .word 6235 + .word 50749 + .word 58572 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 41318 + .word 51558 + .word 37628 + .word 48452 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 55026 + .word 7893 + .word 43866 + .word 40925 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43387 + .word 19951 + .word 2911 + .word 35445 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 32572 + .word 59281 + .word 11243 + .word 56666 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 49800 + .word 50337 + .word 42707 + .word 39184 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,208 + .align 2 +_P: + .word 42691 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 4317 + .word 52400 + .word 52428 + .word 52428 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 26206 + .word 56172 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 36130 + .word 58514 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 21592 + .word 8113 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 3093 + .word 49950 + .word 25215 + .word 36391 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 21499 + .word 24428 + .word 51889 + .word 58572 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 54828 + .word 41264 + .word 61120 + .word 48451 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 10243 + .word 1489 + .word 39717 + .word 40940 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 51433 + .word 46039 + .word 63564 + .word 35220 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 60402 + .word 39286 + .word 25675 + .word 60826 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 34219 + .word 36833 + .word 44839 + .word 57547 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 13013 + .word 26091 + .word 19721 + .word 60832 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 22353 + .word 41544 + .word 55443 + .word 55735 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 14948 + .word 7038 + .word 38091 + .word 38339 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 61727 + .word 61480 + .word 15906 + .word 51927 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 13386 + .word 23084 + .word 64443 + .word 55906 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 17499 + .word 23573 + .word 43947 + .word 42761 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,320 + .align 2 +_pi_00: + .word 0 + .word 0 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 35374 + .word 4889 + .word 2259 + .word 34211 + .word 16350 + .word 0 + .word 0 + .word 0 + .type _pi_00,@object + .size _pi_00,32 + .align 2 +_pi_0l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49152 + .word 0 + .word 0 + .word 0 + .type _pi_0l,@object + .size _pi_0l,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/asin.S b/external/sgx_libm/intel64/asin.S new file mode 100644 index 0000000000..1de85746a3 --- /dev/null +++ b/external/sgx_libm/intel64/asin.S @@ -0,0 +1,1998 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asin.c" + .text +..TXTST0: +# -- Begin asin + .text + .align 16,0x90 + .globl asin +asin: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_asin.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + stmxcsr 16(%rsp) + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + jne .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + movsd ABSVALMASK(%rip), %xmm4 + movsd ONEMASK(%rip), %xmm3 + xorpd %xmm5, %xmm5 + movsd TMASK(%rip), %xmm2 + movl $8192, %ecx + pinsrw $2, %ecx, %xmm5 + movq %xmm0, %xmm1 + psrlq $44, %xmm0 + movd %xmm0, %edx + movq %xmm1, %xmm7 + movl $8192, %ecx + pinsrw $2, %ecx, %xmm5 + movq %xmm1, %xmm0 + movl $524287, %eax + andl %edx, %eax + subl $260864, %eax + cmpl $955, %eax + jae .L_2TAG_PACKET_2.0.2 + mulsd %xmm1, %xmm1 + andl $65535, %edx + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + andpd %xmm7, %xmm2 + andl $-4, %edx + subl $64256, %edx + lea T_table(%rip), %r8 + movsd (%r8,%rdx,2), %xmm1 + orpd %xmm5, %xmm2 + lea Tbl_addr(%rip), %r8 + movapd (%r8,%rdx,4), %xmm4 + movq %xmm7, %xmm6 + addsd %xmm2, %xmm7 + subsd %xmm2, %xmm0 + mulsd %xmm7, %xmm0 + mulsd %xmm1, %xmm6 + mulsd %xmm2, %xmm3 + movq %xmm6, %xmm1 + addsd %xmm3, %xmm6 + divsd %xmm6, %xmm0 + movsd 16+cv(%rip), %xmm7 + movsd cv(%rip), %xmm5 + subsd %xmm3, %xmm1 + andpd SIGNMASK(%rip), %xmm2 + movq %xmm1, %xmm3 + mulsd %xmm1, %xmm1 + movsd 8+cv(%rip), %xmm6 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm7 + mulsd %xmm3, %xmm5 + xorpd %xmm2, %xmm4 + mulsd %xmm1, %xmm3 + addsd %xmm7, %xmm6 + mulsd %xmm3, %xmm6 + addsd %xmm4, %xmm5 + pshufd $238, %xmm4, %xmm4 + addsd %xmm5, %xmm6 + orpd %xmm2, %xmm4 + addsd %xmm6, %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_3.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_3.0.2: + addsd %xmm4, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_2.0.2: + subl $955, %eax + cmpl $67, %eax + jae .L_2TAG_PACKET_4.0.2 + mulsd %xmm1, %xmm1 + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + movl %edx, %eax + andpd ABSVALMASK(%rip), %xmm0 + andpd HALFMASK2(%rip), %xmm7 + movq %xmm0, %xmm1 + movsd ONEMASK(%rip), %xmm4 + movq %xmm7, %xmm6 + subsd %xmm7, %xmm1 + mulsd %xmm7, %xmm7 + addsd %xmm6, %xmm0 + subsd %xmm7, %xmm4 + mulsd %xmm1, %xmm0 + movq %xmm3, %xmm7 + andpd %xmm3, %xmm2 + psllq $2, %xmm3 + pextrw $3, %xmm3, %edx + orpd %xmm5, %xmm2 + subl $65216, %edx + addl %edx, %edx + lea T_table(%rip), %r8 + mulsd (%r8,%rdx,4), %xmm7 + mulsd %xmm2, %xmm6 + movapd PI_BY_2(%rip), %xmm3 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + subsd %xmm7, %xmm6 + addsd %xmm1, %xmm6 + subsd %xmm2, %xmm4 + addsd %xmm7, %xmm7 + movsd cv(%rip), %xmm5 + subsd %xmm0, %xmm4 + addsd %xmm6, %xmm7 + movsd 16+cv(%rip), %xmm0 + divsd %xmm7, %xmm4 + movsd 8+cv(%rip), %xmm2 + lea Tbl_addr(%rip), %r8 + subpd (%r8,%rdx,8), %xmm3 + movq %xmm6, %xmm1 + mulsd %xmm6, %xmm6 + andl $524288, %eax + shrl $4, %eax + mulsd %xmm6, %xmm0 + mulsd %xmm6, %xmm1 + mulsd %xmm1, %xmm5 + mulsd %xmm6, %xmm1 + addsd %xmm2, %xmm0 + pxor %xmm6, %xmm6 + mulsd %xmm1, %xmm0 + addsd %xmm3, %xmm5 + pinsrw $3, %eax, %xmm6 + addsd %xmm5, %xmm0 + movq %xmm4, %xmm5 + pshufd $238, %xmm3, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm3 + subsd %xmm3, %xmm5 + subsd %xmm5, %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_5.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_5.0.2: + xorpd %xmm6, %xmm0 + xorpd %xmm6, %xmm4 + subsd %xmm4, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_4.0.2: + addl $15291, %eax + cmpl $14336, %eax + jae .L_2TAG_PACKET_6.0.2 + unpcklpd %xmm7, %xmm7 + movapd cv2(%rip), %xmm1 + movapd %xmm7, %xmm6 + movapd 16+cv2(%rip), %xmm2 + movapd 32+cv2(%rip), %xmm4 + mulpd %xmm7, %xmm7 + mulpd %xmm7, %xmm6 + mulpd %xmm7, %xmm1 + mulpd %xmm7, %xmm7 + movq %xmm6, %xmm3 + mulsd %xmm6, %xmm6 + addpd %xmm2, %xmm1 + mulpd %xmm7, %xmm4 + mulsd %xmm3, %xmm6 + addpd %xmm4, %xmm1 + mulpd %xmm6, %xmm1 + pshufd $238, %xmm1, %xmm2 + addsd %xmm2, %xmm1 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_7.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_7.0.2: + addsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_6.0.2: + subl $15358, %eax + cmpl $2, %eax + jae .L_2TAG_PACKET_8.0.2 + mulsd %xmm1, %xmm1 + subsd %xmm1, %xmm3 + sqrtsd %xmm3, %xmm3 + movl %edx, %eax + andpd HALFMASK(%rip), %xmm7 + pshufd $68, %xmm3, %xmm5 + andpd HALFMASK(%rip), %xmm3 + movq %xmm7, %xmm1 + movsd ONEMASK(%rip), %xmm4 + movq %xmm7, %xmm6 + subsd %xmm7, %xmm0 + mulsd %xmm7, %xmm7 + addsd %xmm1, %xmm1 + mulsd %xmm0, %xmm1 + subsd %xmm7, %xmm4 + movq %xmm3, %xmm6 + mulsd %xmm3, %xmm3 + mulsd %xmm0, %xmm0 + subsd %xmm1, %xmm4 + subsd %xmm5, %xmm6 + addsd %xmm5, %xmm5 + subsd %xmm3, %xmm4 + movapd cv2(%rip), %xmm2 + pshufd $238, %xmm5, %xmm3 + subsd %xmm0, %xmm4 + addsd %xmm6, %xmm5 + pshufd $238, %xmm3, %xmm7 + addsd %xmm3, %xmm3 + mulsd %xmm6, %xmm5 + addsd %xmm5, %xmm4 + pshufd $238, %xmm7, %xmm6 + divsd %xmm3, %xmm4 + movapd 48+cv2(%rip), %xmm1 + movapd 16+cv2(%rip), %xmm5 + movapd 32+cv2(%rip), %xmm0 + mulpd %xmm7, %xmm7 + movq %xmm6, %xmm3 + mulpd %xmm7, %xmm2 + mulpd %xmm7, %xmm6 + shrl $4, %eax + andl $32768, %eax + mulsd %xmm7, %xmm1 + mulpd %xmm7, %xmm7 + addpd %xmm2, %xmm5 + movapd %xmm6, %xmm2 + mulsd %xmm6, %xmm6 + mulpd %xmm0, %xmm7 + movapd PI_BY_2(%rip), %xmm0 + mulsd %xmm6, %xmm2 + addpd %xmm5, %xmm7 + pshufd $238, %xmm1, %xmm5 + mulsd %xmm2, %xmm6 + mulpd %xmm2, %xmm7 + addsd %xmm5, %xmm1 + xorpd %xmm5, %xmm5 + pshufd $238, %xmm7, %xmm2 + mulsd %xmm6, %xmm1 + pshufd $238, %xmm0, %xmm6 + addsd %xmm2, %xmm7 + movq %xmm3, %xmm2 + pinsrw $3, %eax, %xmm5 + subsd %xmm6, %xmm3 + addsd %xmm1, %xmm0 + addsd %xmm3, %xmm6 + addsd %xmm4, %xmm7 + subsd %xmm6, %xmm2 + subsd %xmm7, %xmm0 + subsd %xmm2, %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_9.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_9.0.2: + xorpd %xmm5, %xmm0 + xorpd %xmm5, %xmm3 + subsd %xmm3, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_8.0.2: + addl $261886, %eax + cmpl $261888, %eax + jb .L_2TAG_PACKET_10.0.2 + movd %xmm0, %ecx + psrlq $32, %xmm0 + movd %xmm0, %edx + andl $2147483647, %edx + movl $1072693248, %eax + subl %edx, %eax + orl %ecx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_11.0.2 + movsd (%rsp), %xmm2 + movd %xmm2, %edx + psrlq $32, %xmm2 + movd %xmm2, %ecx + andl $2147483647, %ecx + subl $1, %edx + sbbl $2146435072, %ecx + cmpl $0, %ecx + jge .L_2TAG_PACKET_10.0.2 + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %edx + pinsrw $3, %edx, %xmm1 + mulsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_12.0.2 +.L_2TAG_PACKET_11.0.2: + movsd ABSVALMASK(%rip), %xmm1 + movsd PI_BY_2(%rip), %xmm2 + movsd 8+PI_BY_2(%rip), %xmm0 + addsd %xmm2, %xmm0 + andnpd %xmm7, %xmm1 + orpd %xmm1, %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_13.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_13.0.2: + jmp ..B1.5 +.L_2TAG_PACKET_10.0.2: + movsd (%rsp), %xmm0 + xorpd %xmm6, %xmm6 + movq %xmm0, %xmm7 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_14.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_14.0.2: + pextrw $3, %xmm0, %edx + andl $32752, %edx + subl $16, %edx + cmpl $32736, %edx + jb .L_2TAG_PACKET_15.0.2 + addsd %xmm0, %xmm6 + orpd %xmm6, %xmm0 + mulsd %xmm0, %xmm7 +.L_2TAG_PACKET_15.0.2: + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movl %eax, 20(%rsp) + ldmxcsr 20(%rsp) + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_12.0.2: + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_16.0.2 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_16.0.2: + movq %xmm0, 8(%rsp) +..B1.3: + movq 8(%rsp), %xmm0 +.L_2TAG_PACKET_17.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type asin,@function + .size asin,.-asin + .data +# -- End asin + .section .rodata, "a" + .align 16 + .align 16 +ABSVALMASK: + .long 4294967295 + .long 2147483647 + .long 0 + .long 0 + .type ABSVALMASK,@object + .size ABSVALMASK,16 + .align 16 +T_table: + .long 2642784509 + .long 1072689083 + .long 1514442531 + .long 1072688953 + .long 333108933 + .long 1072688821 + .long 3392112024 + .long 1072688686 + .long 2099852862 + .long 1072688550 + .long 749609004 + .long 1072688412 + .long 3634632596 + .long 1072688271 + .long 2163248461 + .long 1072688129 + .long 628657846 + .long 1072687985 + .long 3324036511 + .long 1072687838 + .long 1657632815 + .long 1072687690 + .long 4217538760 + .long 1072687539 + .long 2411951597 + .long 1072687387 + .long 533944872 + .long 1072687233 + .long 2876566508 + .long 1072687076 + .long 847936891 + .long 1072686918 + .long 3036019913 + .long 1072686757 + .long 848884575 + .long 1072686595 + .long 2874443326 + .long 1072686430 + .long 520713666 + .long 1072686264 + .long 2375556481 + .long 1072686095 + .long 4141904948 + .long 1072685924 + .long 1522666382 + .long 1072685752 + .long 3105624104 + .long 1072685577 + .long 298666327 + .long 1072685401 + .long 1689524500 + .long 1072685222 + .long 2981002200 + .long 1072685041 + .long 4170844284 + .long 1072684858 + .long 961802263 + .long 1072684674 + .long 1941503454 + .long 1072684487 + .long 2812647170 + .long 1072684298 + .long 3572873869 + .long 1072684107 + .long 4219797823 + .long 1072683914 + .long 456039788 + .long 1072683720 + .long 869096151 + .long 1072683523 + .long 1161535119 + .long 1072683324 + .long 1330865866 + .long 1072683123 + .long 1374571204 + .long 1072682920 + .long 1290107538 + .long 1072682715 + .long 1074904836 + .long 1072682508 + .long 726366587 + .long 1072682299 + .long 241869763 + .long 1072682088 + .long 3913732079 + .long 1072681874 + .long 3149342765 + .long 1072681659 + .long 2240966306 + .long 1072681442 + .long 1185873216 + .long 1072681223 + .long 4276274591 + .long 1072681001 + .long 2919452883 + .long 1072680778 + .long 1407565635 + .long 1072680553 + .long 4032743551 + .long 1072680325 + .long 2202188565 + .long 1072680096 + .long 207977577 + .long 1072679865 + .long 2342160518 + .long 1072679631 + .long 11858423 + .long 1072679396 + .long 1804034453 + .long 1072679158 + .long 3420722787 + .long 1072678918 + .long 563930456 + .long 1072678677 + .long 1820539192 + .long 1072678433 + .long 2892501606 + .long 1072678187 + .long 3776710320 + .long 1072677939 + .long 175063337 + .long 1072677690 + .long 674333171 + .long 1072677438 + .long 976363026 + .long 1072677184 + .long 1077935934 + .long 1072676928 + .long 1921075490 + .long 1072676540 + .long 881493302 + .long 1072676016 + .long 3275752439 + .long 1072675483 + .long 486855588 + .long 1072674943 + .long 1077229111 + .long 1072674394 + .long 723950308 + .long 1072673837 + .long 3693582199 + .long 1072673271 + .long 1367335316 + .long 1072672698 + .long 2305837020 + .long 1072672116 + .long 2184358641 + .long 1072671526 + .long 972682840 + .long 1072670928 + .long 2935101762 + .long 1072670321 + .long 3745513263 + .long 1072669706 + .long 3372320886 + .long 1072669083 + .long 1783464620 + .long 1072668452 + .long 3241386215 + .long 1072667812 + .long 3418125284 + .long 1072667164 + .long 2280219148 + .long 1072666508 + .long 4088700758 + .long 1072665843 + .long 219227400 + .long 1072665171 + .long 3521816918 + .long 1072664489 + .long 1076205279 + .long 1072663800 + .long 1436484616 + .long 1072663102 + .long 271362610 + .long 1072662396 + .long 1838996688 + .long 1072661681 + .long 1807122518 + .long 1072660958 + .long 137953542 + .long 1072660227 + .long 1088178584 + .long 1072659487 + .long 324057537 + .long 1072658739 + .long 2101288076 + .long 1072657982 + .long 2085133974 + .long 1072657217 + .long 235324451 + .long 1072656444 + .long 806051592 + .long 1072655662 + .long 3756033140 + .long 1072654871 + .long 453542543 + .long 1072654073 + .long 3741177327 + .long 1072653265 + .long 691216109 + .long 1072652450 + .long 4145223372 + .long 1072651625 + .long 1174439091 + .long 1072650793 + .long 324416139 + .long 1072649952 + .long 1550246310 + .long 1072649102 + .long 511524674 + .long 1072648244 + .long 1457248482 + .long 1072647377 + .long 45944955 + .long 1072646502 + .long 525537397 + .long 1072645618 + .long 2848440188 + .long 1072644725 + .long 2671555633 + .long 1072643824 + .long 4241172637 + .long 1072642914 + .long 3213094278 + .long 1072641996 + .long 3832503688 + .long 1072641069 + .long 1754091534 + .long 1072640134 + .long 1221921804 + .long 1072639190 + .long 2184526489 + .long 1072638237 + .long 294902089 + .long 1072637276 + .long 4090375270 + .long 1072636305 + .long 632860906 + .long 1072635327 + .long 2753498702 + .long 1072634339 + .long 1808009252 + .long 1072633343 + .long 2036428672 + .long 1072632338 + .long 3383235626 + .long 1072631324 + .long 1497347484 + .long 1072630302 + .long 617018317 + .long 1072629271 + .long 684933058 + .long 1072628231 + .long 1643170798 + .long 1072627182 + .long 3011066360 + .long 1072625592 + .long 957158713 + .long 1072623442 + .long 1390907941 + .long 1072621256 + .long 3819155270 + .long 1072619034 + .long 3443571196 + .long 1072616777 + .long 4045412458 + .long 1072614484 + .long 805503923 + .long 1072612156 + .long 1778922015 + .long 1072609791 + .long 2125033665 + .long 1072607390 + .long 1287203863 + .long 1072604953 + .long 2992629568 + .long 1072602479 + .long 2367267127 + .long 1072599969 + .long 3115526047 + .long 1072597422 + .long 340219539 + .long 1072594839 + .long 2017215719 + .long 1072592218 + .long 3225443424 + .long 1072589560 + .long 3326565673 + .long 1072586865 + .long 1669811211 + .long 1072584133 + .long 1886735022 + .long 1072581363 + .long 3301071171 + .long 1072578555 + .long 928514283 + .long 1072575710 + .long 2656364059 + .long 1072572826 + .long 3473490507 + .long 1072569904 + .long 2649965606 + .long 1072566944 + .long 3736819052 + .long 1072563945 + .long 1680885175 + .long 1072560908 + .long 4413771 + .long 1072557832 + .long 2214869753 + .long 1072554716 + .long 3214725184 + .long 1072551561 + .long 2186079903 + .long 1072548367 + .long 2590372131 + .long 1072545133 + .long 3578146079 + .long 1072541859 + .long 4283712755 + .long 1072538545 + .long 3824834510 + .long 1072535191 + .long 1302400298 + .long 1072531797 + .long 95058636 + .long 1072528362 + .long 3563906063 + .long 1072524885 + .long 2167230730 + .long 1072521368 + .long 3524918334 + .long 1072517809 + .long 2353304918 + .long 1072514209 + .long 1939625839 + .long 1072510567 + .long 1256714581 + .long 1072506883 + .long 3552525848 + .long 1072503156 + .long 3464809522 + .long 1072499387 + .long 4200542593 + .long 1072495575 + .long 355609124 + .long 1072491721 + .long 3684139099 + .long 1072487822 + .long 148355918 + .long 1072483881 + .long 1457689242 + .long 1072479895 + .long 2118591596 + .long 1072475865 + .long 908848089 + .long 1072471791 + .long 877032689 + .long 1072467672 + .long 752012304 + .long 1072463508 + .long 3532301749 + .long 1072459298 + .long 3600563221 + .long 1072455043 + .long 3902857084 + .long 1072450742 + .long 3063101036 + .long 1072446395 + .long 3972344374 + .long 1072442001 + .long 903183549 + .long 1072437561 + .long 983892938 + .long 1072433073 + .long 2722858568 + .long 1072428537 + .long 302790515 + .long 1072423954 + .long 759811057 + .long 1072419322 + .long 2507809922 + .long 1072414641 + .long 2388408813 + .long 1072407528 + .long 2084492942 + .long 1072397870 + .long 2435703301 + .long 1072388010 + .long 1935433360 + .long 1072377945 + .long 2742047290 + .long 1072367671 + .long 2053284205 + .long 1072357185 + .long 657783367 + .long 1072346483 + .long 2893664841 + .long 1072335560 + .long 3718906405 + .long 1072324413 + .long 1547896303 + .long 1072313038 + .long 2494058440 + .long 1072301429 + .long 3133238742 + .long 1072289582 + .long 3327000086 + .long 1072277492 + .long 1860667274 + .long 1072265154 + .long 665340747 + .long 1072252562 + .long 443347841 + .long 1072239710 + .long 581282618 + .long 1072226592 + .long 3349780465 + .long 1072213201 + .long 914217606 + .long 1072199532 + .long 989797661 + .long 1072185576 + .long 945436416 + .long 1072171326 + .long 549291300 + .long 1072156774 + .long 1814636389 + .long 1072141911 + .long 239092858 + .long 1072126729 + .long 1794680724 + .long 1072111217 + .long 1241534678 + .long 1072095366 + .long 3366566214 + .long 1072079164 + .long 1244090828 + .long 1072062601 + .long 1708448120 + .long 1072045663 + .long 3544260650 + .long 1072028337 + .long 1402741403 + .long 1072010610 + .long 2551936888 + .long 1071992465 + .long 617669739 + .long 1071973887 + .long 794002186 + .long 1071954857 + .long 2021237693 + .long 1071935356 + .long 540450384 + .long 1071915364 + .long 1920555537 + .long 1071894857 + .long 2879585206 + .long 1071873811 + .long 3000237455 + .long 1071852199 + .long 3352974346 + .long 1071829991 + .long 569629937 + .long 1071807155 + .long 2077237208 + .long 1071783653 + .long 2284891805 + .long 1071759446 + .long 1226651784 + .long 1071734489 + .long 1102047405 + .long 1071708731 + .long 2009896384 + .long 1071682115 + .long 927419082 + .long 1071654577 + .long 85010366 + .long 1071607413 + .long 696431025 + .long 1071548180 + .long 2611410541 + .long 1071486585 + .long 2612593658 + .long 1071422396 + .long 3548155306 + .long 1071355336 + .long 3887997484 + .long 1071285073 + .long 244854763 + .long 1071211202 + .long 4214445648 + .long 1071133216 + .long 2303966727 + .long 1071050478 + .long 3991040013 + .long 1070962152 + .long 3126952278 + .long 1070867118 + .long 1817448378 + .long 1070763804 + .long 1793814864 + .long 1070649884 + .long 3507224072 + .long 1070447193 + .long 4027609105 + .long 1070148772 + .long 577507993 + .long 1069779414 + .long 2310232419 + .long 1068931829 + .type T_table,@object + .size T_table,2048 + .align 16 +Tbl_addr: + .long 3822952792 + .long 1021639372 + .long 182792448 + .long 1068507836 + .long 2264213271 + .long 1019558908 + .long 649052928 + .long 1068524253 + .long 1797139609 + .long 1022295143 + .long 1243095296 + .long 1068540671 + .long 1415938756 + .long 1021439537 + .long 2033294592 + .long 1068557090 + .long 2356809978 + .long 1021777916 + .long 3088063744 + .long 1068573510 + .long 2669055318 + .long 1022124482 + .long 180888576 + .long 1068589932 + .long 3566445325 + .long 1021358712 + .long 1970196992 + .long 1068606354 + .long 896980323 + .long 1021319659 + .long 4229555456 + .long 1068622777 + .long 436049712 + .long 1021319758 + .long 2732572160 + .long 1068639202 + .long 583123209 + .long 1020797960 + .long 1842831872 + .long 1068655628 + .long 1370449804 + .long 1021429270 + .long 1628994560 + .long 1068672055 + .long 2411391464 + .long 1021057980 + .long 2159763712 + .long 1068688483 + .long 1208692749 + .long 1021943903 + .long 3503886336 + .long 1068704912 + .long 538793309 + .long 1019744063 + .long 1435187200 + .long 1068721343 + .long 4085087612 + .long 1020608419 + .long 317469952 + .long 1068737775 + .long 144386942 + .long 1021440732 + .long 219617280 + .long 1068754208 + .long 2940088361 + .long 1019981122 + .long 1210558208 + .long 1068770642 + .long 2176850347 + .long 1018373705 + .long 3359268352 + .long 1068787077 + .long 2395611454 + .long 1021889042 + .long 2439803648 + .long 1068803514 + .long 1650705253 + .long 1020227966 + .long 2816203520 + .long 1068819952 + .long 3702166386 + .long 1019379914 + .long 262620672 + .long 1068836392 + .long 1855649370 + .long 1020453124 + .long 3438159616 + .long 1068852832 + .long 923063860 + .long 1019273834 + .long 3822105856 + .long 1068869274 + .long 4289947947 + .long 1019434249 + .long 1483729920 + .long 1068885718 + .long 787455814 + .long 1020738379 + .long 787321088 + .long 1068902163 + .long 3321653337 + .long 1021842569 + .long 1802253312 + .long 1068918609 + .long 2653633526 + .long 1021821525 + .long 302985984 + .long 1068935057 + .long 161272028 + .long 1021655149 + .long 653966080 + .long 1068951506 + .long 2566098667 + .long 1020066219 + .long 2924727296 + .long 1068967956 + .long 3646493722 + .long 1014292285 + .long 2889890304 + .long 1068984408 + .long 1081009196 + .long 1022189620 + .long 619098112 + .long 1069000862 + .long 4011643355 + .long 1021773297 + .long 477017600 + .long 1069017317 + .long 4030305534 + .long 1021292252 + .long 2533403904 + .long 1069033773 + .long 2645187591 + .long 1019527099 + .long 2563102208 + .long 1069050231 + .long 3857293792 + .long 1022311697 + .long 635982336 + .long 1069066691 + .long 3625936637 + .long 1017511744 + .long 1116940800 + .long 1069083152 + .long 3653872993 + .long 1022016631 + .long 4075964160 + .long 1069099614 + .long 2468900271 + .long 1021769532 + .long 993165568 + .long 1069116079 + .long 1358104224 + .long 1021199776 + .long 528586752 + .long 1069132545 + .long 2200950332 + .long 1022024872 + .long 2752395776 + .long 1069149012 + .long 3197072454 + .long 1017751319 + .long 3439855616 + .long 1069165481 + .long 1651081806 + .long 1020809338 + .long 2661257728 + .long 1069181952 + .long 539032752 + .long 1021728805 + .long 486957312 + .long 1069198425 + .long 3136045149 + .long 1016888671 + .long 1282340352 + .long 1069214899 + .long 2593963259 + .long 1018956103 + .long 822921728 + .long 1069231375 + .long 2146032737 + .long 1022306465 + .long 3474216192 + .long 1069247852 + .long 3976811625 + .long 1021350207 + .long 716902656 + .long 1069264332 + .long 718267222 + .long 1018624727 + .long 1211594496 + .long 1069280813 + .long 1485641389 + .long 1018447451 + .long 734070272 + .long 1069297296 + .long 354455128 + .long 1021341291 + .long 3650110720 + .long 1069313780 + .long 682185947 + .long 1021651853 + .long 1440663040 + .long 1069330267 + .long 3558574550 + .long 1021615110 + .long 2766612224 + .long 1069346755 + .long 874607978 + .long 1017746872 + .long 3404011008 + .long 1069363245 + .long 4154988502 + .long 1021439906 + .long 3423949056 + .long 1069379737 + .long 2263202309 + .long 1021479615 + .long 2897587712 + .long 1069396231 + .long 2562065031 + .long 1022090363 + .long 1896159232 + .long 1069412727 + .long 3836237663 + .long 1019867288 + .long 490968576 + .long 1069429225 + .long 3322056743 + .long 1006752762 + .long 3048360192 + .long 1069445724 + .long 1152314833 + .long 1013122252 + .long 1049850624 + .long 1069462226 + .long 3601590727 + .long 1022214610 + .long 3156899584 + .long 1069478729 + .long 1855169970 + .long 1019487271 + .long 851173376 + .long 1069495235 + .long 312649594 + .long 1020868604 + .long 2794281728 + .long 1069511742 + .long 1093490181 + .long 1020777577 + .long 468042496 + .long 1069528252 + .long 1152540679 + .long 1021403732 + .long 2534219264 + .long 1069544763 + .long 2292126035 + .long 1021872430 + .long 1376146432 + .long 1069558527 + .long 3293753641 + .long 1020500454 + .long 4175442432 + .long 1069575044 + .long 3626347564 + .long 1021610969 + .long 3523113472 + .long 1069591566 + .long 339956500 + .long 1021119039 + .long 4003350528 + .long 1069608092 + .long 3429333082 + .long 1022813542 + .long 1611067392 + .long 1069624623 + .long 2298017544 + .long 1021977587 + .long 931782144 + .long 1069641158 + .long 2164684743 + .long 1021250988 + .long 2256725504 + .long 1069657697 + .long 1138762335 + .long 1021443776 + .long 1582853120 + .long 1069674241 + .long 1084010382 + .long 1022994693 + .long 3497758720 + .long 1069690789 + .long 406366244 + .long 1022713586 + .long 3999816960 + .long 1069707342 + .long 1488723042 + .long 1023381290 + .long 3383096064 + .long 1069723900 + .long 2541558953 + .long 1019137887 + .long 1942403584 + .long 1069740463 + .long 1879620343 + .long 1022653642 + .long 4268263680 + .long 1069757030 + .long 3039077047 + .long 1022252545 + .long 2067062272 + .long 1069773603 + .long 4190670677 + .long 1020725863 + .long 4225828096 + .long 1069790180 + .long 1998567321 + .long 1022014385 + .long 2452507136 + .long 1069806763 + .long 1511628873 + .long 1021900300 + .long 1340746240 + .long 1069823351 + .long 788367341 + .long 1022726208 + .long 1190035456 + .long 1069839944 + .long 3856337230 + .long 1021834118 + .long 2300688384 + .long 1069856542 + .long 3211396579 + .long 1022621365 + .long 678886400 + .long 1069873146 + .long 4001011887 + .long 1022042646 + .long 921594112 + .long 1069889755 + .long 557811968 + .long 1023065533 + .long 3331668992 + .long 1069906369 + .long 1877060679 + .long 1022419742 + .long 3917875200 + .long 1069922989 + .long 1181055171 + .long 1022752712 + .long 2984829696 + .long 1069939615 + .long 4294526932 + .long 1021499988 + .long 838049024 + .long 1069956247 + .long 3658081878 + .long 1022957952 + .long 2078928384 + .long 1069972884 + .long 820353701 + .long 1019391107 + .long 2719854336 + .long 1069989527 + .long 1644022489 + .long 1023378240 + .long 3069117696 + .long 1070006176 + .long 2771393702 + .long 1019319954 + .long 3435962368 + .long 1070022831 + .long 3876394145 + .long 1023024433 + .long 4130595328 + .long 1070039492 + .long 1630447748 + .long 1021465882 + .long 1169236224 + .long 1070056160 + .long 2828355997 + .long 1020458120 + .long 3453997312 + .long 1070072833 + .long 164091641 + .long 1020388279 + .long 2708127744 + .long 1070089513 + .long 3036550223 + .long 1023328684 + .long 3540797696 + .long 1070106199 + .long 3710949463 + .long 1022568805 + .long 1972276736 + .long 1070122892 + .long 3885277950 + .long 1019761674 + .long 2613815552 + .long 1070139591 + .long 2764165077 + .long 1022921023 + .long 1487791616 + .long 1070156297 + .long 1330644769 + .long 1023162679 + .long 3207593472 + .long 1070173009 + .long 3911007221 + .long 1022993496 + .long 3797764608 + .long 1070189728 + .long 979712598 + .long 1022554580 + .long 3578920448 + .long 1070206454 + .long 2825738223 + .long 1020223708 + .long 2872795648 + .long 1070223187 + .long 392451124 + .long 1022666279 + .long 2002258432 + .long 1070239927 + .long 3730407632 + .long 1023148291 + .long 1291326464 + .long 1070256674 + .long 3723802980 + .long 1022514089 + .long 1065180928 + .long 1070273428 + .long 2635617463 + .long 1022654470 + .long 1650181632 + .long 1070290189 + .long 2061982883 + .long 1022853411 + .long 3373882880 + .long 1070306957 + .long 319732785 + .long 1022017175 + .long 2270081280 + .long 1070323733 + .long 2237757411 + .long 1023064087 + .long 2963732736 + .long 1070340516 + .long 468839165 + .long 1023293774 + .long 1491099904 + .long 1070357307 + .long 1502657946 + .long 1021533479 + .long 2479636480 + .long 1070374105 + .long 482913562 + .long 1021986286 + .long 1968133632 + .long 1070390911 + .long 3281474337 + .long 1022646400 + .long 291639040 + .long 1070407725 + .long 2453320259 + .long 1022812423 + .long 2081472512 + .long 1070424546 + .long 2939989570 + .long 1023091888 + .long 3380340480 + .long 1070441375 + .long 2850707499 + .long 1021921109 + .long 232287488 + .long 1070458213 + .long 3674625342 + .long 1020725130 + .long 1567614208 + .long 1070475058 + .long 9347334 + .long 1022024009 + .long 3433091072 + .long 1070491911 + .long 282524999 + .long 1021433523 + .long 1876877312 + .long 1070508773 + .long 3470449440 + .long 1019309721 + .long 1538472192 + .long 1070525643 + .long 2089486825 + .long 1019698916 + .long 2763830784 + .long 1070542521 + .long 443498115 + .long 1020505194 + .long 1605381632 + .long 1070559408 + .long 3018871601 + .long 1022869913 + .long 2706946048 + .long 1070576303 + .long 3936260892 + .long 1023175875 + .long 2123887360 + .long 1070593207 + .long 2994220655 + .long 1022825948 + .long 104015104 + .long 1070603108 + .long 335054493 + .long 1023441853 + .long 2904568832 + .long 1070615800 + .long 1451215633 + .long 1023853857 + .long 3456197120 + .long 1070632739 + .long 436334733 + .long 1024026432 + .long 252452352 + .long 1070649697 + .long 34596167 + .long 1024031396 + .long 3328018432 + .long 1070666672 + .long 2644547073 + .long 1024296758 + .long 1255829248 + .long 1070683667 + .long 552832586 + .long 1023763122 + .long 4097058560 + .long 1070700680 + .long 1955640623 + .long 1021394654 + .long 451770112 + .long 1070717714 + .long 3428903777 + .long 1022941142 + .long 408920832 + .long 1070734767 + .long 165503263 + .long 1023894958 + .long 1186960640 + .long 1070751840 + .long 435826450 + .long 1024026134 + .long 19078656 + .long 1070768934 + .long 1834169749 + .long 1022899284 + .long 2743490304 + .long 1070786048 + .long 494581074 + .long 1018818479 + .long 2328961024 + .long 1070803184 + .long 2987908834 + .long 1022581110 + .long 350011392 + .long 1070820342 + .long 240771184 + .long 1024143083 + .long 2692326912 + .long 1070837521 + .long 666056837 + .long 1022394776 + .long 2373274368 + .long 1070854723 + .long 2484337770 + .long 1024228156 + .long 1017131520 + .long 1070871948 + .long 3285648279 + .long 1024025789 + .long 265558272 + .long 1070889196 + .long 392241896 + .long 1024252809 + .long 1778008064 + .long 1070906467 + .long 1536107943 + .long 1023949300 + .long 2937184768 + .long 1070923762 + .long 3541062251 + .long 1019448646 + .long 1144442880 + .long 1070941082 + .long 3691683781 + .long 1022123948 + .long 2410165504 + .long 1070958426 + .long 1804181960 + .long 1023945221 + .long 4174350848 + .long 1070975795 + .long 2016094861 + .long 1021716585 + .long 3897012480 + .long 1070993190 + .long 175294410 + .long 1023703404 + .long 3353623040 + .long 1071010611 + .long 167973242 + .long 1023240839 + .long 45671168 + .long 1071028059 + .long 2166856113 + .long 1021565413 + .long 86063872 + .long 1071045533 + .long 2676254727 + .long 1023985299 + .long 1019772672 + .long 1071063034 + .long 989043593 + .long 1021549587 + .long 414297344 + .long 1071080563 + .long 3960972046 + .long 1024307251 + .long 155173120 + .long 1071098120 + .long 1830919291 + .long 1021592251 + .long 2151562240 + .long 1071115705 + .long 405408666 + .long 1023423128 + .long 4041854720 + .long 1071133319 + .long 2043497827 + .long 1024411503 + .long 3489224192 + .long 1071150963 + .long 3072215864 + .long 1022698635 + .long 2477196288 + .long 1071168637 + .long 1812195139 + .long 1022689192 + .long 3015298816 + .long 1071186341 + .long 764841969 + .long 1021027331 + .long 2844731136 + .long 1071204076 + .long 2878117321 + .long 1019116513 + .long 4028950528 + .long 1071221842 + .long 698911452 + .long 1023265602 + .long 69441536 + .long 1071239641 + .long 3253467847 + .long 1020795075 + .long 1676209920 + .long 1071257471 + .long 4272431167 + .long 1022873982 + .long 2408752384 + .long 1071275334 + .long 648519100 + .long 1024385717 + .long 151623680 + .long 1071293231 + .long 345257017 + .long 1019561408 + .long 1410154240 + .long 1071311161 + .long 197863993 + .long 1023224207 + .long 4131351552 + .long 1071329125 + .long 2620801789 + .long 1024411169 + .long 1999664384 + .long 1071347125 + .long 3952692616 + .long 1024168086 + .long 1617668864 + .long 1071365160 + .long 3019889809 + .long 1021907692 + .long 1032074240 + .long 1071383231 + .long 59469899 + .long 1023656194 + .long 2619492096 + .long 1071401338 + .long 1417526820 + .long 1021457783 + .long 202429440 + .long 1071419483 + .long 2927667935 + .long 1019175447 + .long 525044224 + .long 1071437665 + .long 38166811 + .long 1023981879 + .long 1779258880 + .long 1071455885 + .long 481252500 + .long 1023310234 + .long 2195673600 + .long 1071474144 + .long 3962395981 + .long 1021339088 + .long 44573696 + .long 1071492443 + .long 3936281395 + .long 1023014829 + .long 2226905344 + .long 1071510781 + .long 1515320476 + .long 1024320623 + .long 2800512512 + .long 1071529160 + .long 1225403697 + .long 1021081846 + .long 161113600 + .long 1071547581 + .long 3064809733 + .long 1024173917 + .long 1338410240 + .long 1071566043 + .long 2027604973 + .long 1024362526 + .long 522433280 + .long 1071584548 + .long 2055171723 + .long 1023858825 + .long 539595776 + .long 1071603096 + .long 3868820135 + .long 1022936424 + .long 4264017664 + .long 1071621687 + .long 3228065145 + .long 1023479578 + .long 1733924096 + .long 1071640324 + .long 3511934475 + .long 1022496355 + .long 108880384 + .long 1071651839 + .long 615880967 + .long 1023519706 + .long 3517856512 + .long 1071661202 + .long 3113108559 + .long 1025190289 + .long 4043153152 + .long 1071670589 + .long 1571836218 + .long 1023106116 + .long 3251299072 + .long 1071680000 + .long 3444076102 + .long 1022187841 + .long 2736921600 + .long 1071689435 + .long 272771483 + .long 1025095280 + .long 3897698560 + .long 1071703633 + .long 2075390188 + .long 1022489022 + .long 3209485056 + .long 1071722652 + .long 1438094065 + .long 1021844944 + .long 3781432064 + .long 1071741774 + .long 1675017145 + .long 1024143828 + .long 2684184064 + .long 1071761003 + .long 2259963753 + .long 1024731393 + .long 1840489728 + .long 1071780342 + .long 3372883597 + .long 1023431408 + .long 3764087808 + .long 1071799794 + .long 3307523102 + .long 1024485788 + .long 3006232320 + .long 1071819364 + .long 3088971966 + .long 1025213251 + .long 3374881280 + .long 1071839055 + .long 834437749 + .long 1025236452 + .long 797284864 + .long 1071858872 + .long 3122663941 + .long 1025320473 + .long 545765120 + .long 1071878818 + .long 826539625 + .long 1022450955 + .long 107562240 + .long 1071898898 + .long 339584600 + .long 1022481255 + .long 2123649024 + .long 1071919116 + .long 3912959833 + .long 1024321009 + .long 1562385664 + .long 1071939478 + .long 2846067230 + .long 1023343981 + .long 2963085824 + .long 1071959988 + .long 954548627 + .long 1021475211 + .long 3325550592 + .long 1071980652 + .long 3459651155 + .long 1025305573 + .long 775752448 + .long 1072001476 + .long 3582746667 + .long 1023859460 + .long 3238590720 + .long 1072022464 + .long 634636162 + .long 1024472353 + .long 2758801920 + .long 1072043624 + .long 3078216319 + .long 1025304516 + .long 1370319104 + .long 1072064962 + .long 2570569078 + .long 1025099442 + .long 2615805184 + .long 1072086484 + .long 3729933412 + .long 1024605112 + .long 3077336576 + .long 1072108198 + .long 1948916066 + .long 1024781603 + .long 1099528192 + .long 1072130112 + .long 3139143157 + .long 1023729360 + .long 1231903232 + .long 1072152233 + .long 1349513477 + .long 1024737515 + .long 1507504128 + .long 1072174570 + .long 3484516322 + .long 1024000959 + .long 2214659840 + .long 1072197132 + .long 2563820917 + .long 1025225535 + .long 1804739840 + .long 1072219929 + .long 760038746 + .long 1024482855 + .long 1413746688 + .long 1072242971 + .long 3401734714 + .long 1025129838 + .long 821409536 + .long 1072266269 + .long 3729772551 + .long 1025484796 + .long 3031825664 + .long 1072289834 + .long 122256749 + .long 1024752594 + .long 1710784256 + .long 1072313680 + .long 1518205483 + .long 1024724809 + .long 3025265152 + .long 1072337819 + .long 409951989 + .long 1022835555 + .long 287769088 + .long 1072362267 + .long 800355594 + .long 1022484850 + .long 198179840 + .long 1072387038 + .long 3502926213 + .long 1024209373 + .long 1909130496 + .long 1072412149 + .long 3064694319 + .long 1025380823 + .long 1941732096 + .long 1072437619 + .long 4112930390 + .long 1024294679 + .long 3492010496 + .long 1072463467 + .long 2684918107 + .long 1023220233 + .long 81959680 + .long 1072489716 + .long 220021366 + .long 1020635131 + .long 2297837056 + .long 1072516387 + .long 4027683826 + .long 1021041185 + .long 270404096 + .long 1072543508 + .long 2012766065 + .long 1021780753 + .long 3667376896 + .long 1072571105 + .long 2727981522 + .long 1023009874 + .long 330400256 + .long 1072599212 + .long 2940017003 + .long 1025393439 + .long 1119293952 + .long 1072627861 + .long 1608550416 + .long 1022675612 + .long 3536155904 + .long 1072657091 + .long 349665778 + .long 1025156751 + .long 3078046720 + .long 1072686946 + .long 2016159996 + .long 1022193169 + .long 455228416 + .long 1072705361 + .long 1908539328 + .long 1026126332 + .long 1871505664 + .long 1072720988 + .long 2784700894 + .long 1025922277 + .long 1630994432 + .long 1072737010 + .long 361107678 + .long 1022887244 + .long 2084558336 + .long 1072753462 + .type Tbl_addr,@object + .size Tbl_addr,3840 + .space 768, 0x00 # pad + .align 16 +SIGNMASK: + .long 0 + .long 2147483648 + .long 0 + .long 0 + .type SIGNMASK,@object + .size SIGNMASK,16 + .align 16 +HALFMASK2: + .long 0 + .long 2147483584 + .long 0 + .long 0 + .type HALFMASK2,@object + .size HALFMASK2,16 + .align 16 +PI_BY_2: + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1073291771 + .type PI_BY_2,@object + .size PI_BY_2,16 + .align 16 +cv2: + .long 780903145 + .long 1066854586 + .long 858993459 + .long 1068708659 + .long 3340530119 + .long 1067392113 + .long 1431655765 + .long 1069897045 + .long 1321528399 + .long 1066517740 + .long 3067833783 + .long 1067899757 + .long 2021159460 + .long 1065855096 + .long 2576980378 + .long 1066178969 + .type cv2,@object + .size cv2,64 + .align 16 +HALFMASK: + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .type HALFMASK,@object + .size HALFMASK,16 + .align 4 +ONEMASK: + .long 0 + .long 1072693248 + .type ONEMASK,@object + .size ONEMASK,8 + .align 4 +TMASK: + .long 0 + .long 4294950912 + .type TMASK,@object + .size TMASK,8 + .align 4 +cv: + .long 1431655765 + .long 1069897045 + .long 858993459 + .long 1068708659 + .long 3067833783 + .long 1067899757 + .type cv,@object + .size cv,24 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/asinf_gen.S b/external/sgx_libm/intel64/asinf_gen.S new file mode 100644 index 0000000000..3773399cbc --- /dev/null +++ b/external/sgx_libm/intel64/asinf_gen.S @@ -0,0 +1,394 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinf_gen.c" + .text +..TXTST0: +# -- Begin asinf + .text + .align 16,0x90 + .globl asinf +asinf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_asinf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -16(%rsp) + movl %edx, %eax + andl $2147483647, %eax + cmpl $1065353216, %eax + jae ..B1.14 +..B1.2: + pxor %xmm5, %xmm5 + cmpl $1056964608, %eax + cvtss2sd %xmm0, %xmm5 + jae ..B1.11 +..B1.3: + cmpl $947912704, %eax + jae ..B1.10 +..B1.4: + shrl $31, %edx + cmpl $8388608, %eax + jb ..B1.6 +..B1.5: + movl %edx, %edx + lea _small_value_32(%rip), %rax + movss (%rax,%rdx,4), %xmm1 + mulss .L_2il0floatpacket.26(%rip), %xmm1 + addss %xmm1, %xmm0 + ret +..B1.6: + testl %eax, %eax + je ..B1.9 +..B1.7: + lea _small_value_32(%rip), %rax + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + cvtss2sd -16(%rsp), %xmm2 + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.26(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm1 + addsd %xmm2, %xmm0 + movss %xmm1, -24(%rsp) + cvtsd2ss %xmm0, %xmm0 +..B1.9: + ret +..B1.10: + movaps %xmm5, %xmm1 + mulsd %xmm5, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + movsd .L_2il0floatpacket.4(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.1(%rip), %xmm3 + addsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.2(%rip), %xmm3 + addsd .L_2il0floatpacket.6(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.3(%rip), %xmm3 + addsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm1, %xmm2 + pxor %xmm0, %xmm0 + addsd %xmm2, %xmm3 + mulsd %xmm5, %xmm3 + addsd %xmm3, %xmm5 + cvtsd2ss %xmm5, %xmm0 + ret +..B1.11: + cmpl $1061997772, %eax + jb ..B1.13 +..B1.12: + andps .L_2il0floatpacket.28(%rip), %xmm5 + pxor %xmm4, %xmm4 + movsd .L_2il0floatpacket.27(%rip), %xmm1 + testl %edx, %edx + movsd .L_2il0floatpacket.0(%rip), %xmm3 + subsd %xmm5, %xmm1 + mulsd .L_2il0floatpacket.22(%rip), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + sqrtsd %xmm1, %xmm4 + mulsd %xmm0, %xmm3 + movsd .L_2il0floatpacket.4(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.1(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.2(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.6(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.3(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm3 + mulsd %xmm4, %xmm3 + addsd %xmm3, %xmm4 + mulsd .L_2il0floatpacket.24(%rip), %xmm4 + addsd .L_2il0floatpacket.23(%rip), %xmm4 + movaps %xmm4, %xmm0 + xorps .L_2il0floatpacket.29(%rip), %xmm0 + jl ..L3 + movaps %xmm4, %xmm0 +..L3: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.13: + movaps %xmm5, %xmm1 + mulsd %xmm5, %xmm1 + movsd .L_2il0floatpacket.9(%rip), %xmm4 + movsd .L_2il0floatpacket.15(%rip), %xmm3 + addsd .L_2il0floatpacket.8(%rip), %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.10(%rip), %xmm4 + addsd .L_2il0floatpacket.16(%rip), %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.11(%rip), %xmm4 + addsd .L_2il0floatpacket.17(%rip), %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.12(%rip), %xmm4 + addsd .L_2il0floatpacket.18(%rip), %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.13(%rip), %xmm4 + addsd .L_2il0floatpacket.19(%rip), %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.14(%rip), %xmm4 + addsd .L_2il0floatpacket.20(%rip), %xmm3 + mulsd %xmm1, %xmm4 + addsd %xmm3, %xmm4 + addsd .L_2il0floatpacket.21(%rip), %xmm4 + mulsd %xmm5, %xmm4 + addsd %xmm4, %xmm5 + cvtsd2ss %xmm5, %xmm5 + movaps %xmm5, %xmm0 + ret +..B1.14: + cmpl $2139095040, %eax + ja ..B1.18 +..B1.15: + cmpl $1065353216, %eax + jne ..B1.19 +..B1.16: + lea pi_2f(%rip), %rax + lea _small_value_32(%rip), %rcx + shrl $31, %edx + movss (%rax,%rdx,4), %xmm0 + subss (%rcx,%rdx,4), %xmm0 +..B1.17: + ret +..B1.18: + movss -16(%rsp), %xmm0 + ret +..B1.19: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.25(%rip), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type asinf,@function + .size asinf,.-asinf + .data +# -- End asinf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.28: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.28,@object + .size .L_2il0floatpacket.28,16 + .align 16 +.L_2il0floatpacket.29: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.29,@object + .size .L_2il0floatpacket.29,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x32950b15,0x3fa10044 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x0f078e5a,0x3f9547bd + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x282596ea,0x3f9f2932 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x3b07aed0,0x3fb33334 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x15b528b3,0x3f5b565b + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x1acf0c57,0x3f965bd0 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x8a6efcbd,0x3fa6db1b + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x541021e2,0x3fc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0xbfd00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x7c6f097b,0x4014f3d9 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x617c2eba,0x4018ed42 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0xb9e8c253,0x3fea66bf + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x7e9f31d2,0x3fb9a89d + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x74fb38bf,0x3fb8e90d + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0xe950ab19,0x3fcb8550 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +.L_2il0floatpacket.15: + .long 0x8c8953a2,0xc0202794 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,8 + .align 8 +.L_2il0floatpacket.16: + .long 0x94b6927c,0xc0047249 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,8 + .align 8 +.L_2il0floatpacket.17: + .long 0x3a6dbb00,0xbfa654a1 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,8 + .align 8 +.L_2il0floatpacket.18: + .long 0x020f8f24,0x3fb60e1d + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,8 + .align 8 +.L_2il0floatpacket.19: + .long 0x726ca18f,0x3fbff1ac + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,8 + .align 8 +.L_2il0floatpacket.20: + .long 0xc94e1724,0x3f352382 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,8 + .align 8 +.L_2il0floatpacket.21: + .long 0x00000000,0x3fa80000 + .type .L_2il0floatpacket.21,@object + .size .L_2il0floatpacket.21,8 + .align 8 +.L_2il0floatpacket.22: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.22,@object + .size .L_2il0floatpacket.22,8 + .align 8 +.L_2il0floatpacket.23: + .long 0x54442d18,0x3ff921fb + .type .L_2il0floatpacket.23,@object + .size .L_2il0floatpacket.23,8 + .align 8 +.L_2il0floatpacket.24: + .long 0x00000000,0xc0000000 + .type .L_2il0floatpacket.24,@object + .size .L_2il0floatpacket.24,8 + .align 8 +.L_2il0floatpacket.27: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.27,@object + .size .L_2il0floatpacket.27,8 + .align 4 +.L_2il0floatpacket.25: + .long 0x7f800000 + .type .L_2il0floatpacket.25,@object + .size .L_2il0floatpacket.25,4 + .align 4 +.L_2il0floatpacket.26: + .long 0x0d800000 + .type .L_2il0floatpacket.26,@object + .size .L_2il0floatpacket.26,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +pi_2f: + .long 0x3fc90fdb + .long 0xbfc90fdb + .type pi_2f,@object + .size pi_2f,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/asinh_gen.S b/external/sgx_libm/intel64/asinh_gen.S new file mode 100644 index 0000000000..7356a28bb8 --- /dev/null +++ b/external/sgx_libm/intel64/asinh_gen.S @@ -0,0 +1,382 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinh_gen.c" + .text +..TXTST0: +# -- Begin asinh + .text + .align 16,0x90 + .globl asinh +asinh: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_asinh.1: +..L2: + + movsd %xmm0, -16(%rsp) + movl -12(%rsp), %esi + movl %esi, %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + jae ..B1.18 +..B1.2: + cmpl $1102053376, %edx + jae ..B1.16 +..B1.3: + cmpl $1074987008, %edx + jae ..B1.14 +..B1.4: + cmpl $1068498944, %edx + jae ..B1.13 +..B1.5: + cmpl $1012924416, %edx + jae ..B1.12 +..B1.6: + shrl $31, %esi + cmpl $1048576, %edx + jb ..B1.8 +..B1.7: + lea _SCALE(%rip), %rax + lea _MINNORM(%rip), %rdx + movl %esi, %esi + lea 8+_SCALE(%rip), %rcx + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + subsd (%rdx,%rsi,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.8: + movl -16(%rsp), %eax + orl %eax, %edx + je ..B1.10 +..B1.9: + lea _small_value_64(%rip), %rax + movsd -16(%rsp), %xmm0 + movsd (%rax,%rsi,8), %xmm1 + mulsd (%rax), %xmm1 + movsd %xmm1, -40(%rsp) + subsd %xmm1, %xmm0 + ret +..B1.10: + movsd -16(%rsp), %xmm0 +..B1.11: + ret +..B1.12: + movsd -16(%rsp), %xmm0 + lea 32+_PA(%rip), %rax + movaps %xmm0, %xmm4 + lea 24+_PA(%rip), %rcx + mulsd %xmm0, %xmm4 + lea 16+_PA(%rip), %rdx + movaps %xmm4, %xmm1 + lea 8+_PA(%rip), %rsi + mulsd %xmm4, %xmm1 + lea _PA(%rip), %rdi + movsd (%rax), %xmm3 + movsd (%rcx), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm3 + addsd (%rsi), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm4, %xmm2 + mulsd %xmm0, %xmm4 + addsd %xmm2, %xmm3 + addsd (%rdi), %xmm3 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm0 + ret +..B1.13: + movsd -16(%rsp), %xmm5 + xorl %eax, %eax + andps .L_2il0floatpacket.2(%rip), %xmm5 + movsd %xmm5, -16(%rsp) + movaps %xmm5, %xmm1 + movl %eax, -16(%rsp) + movsd -16(%rsp), %xmm9 + movaps %xmm9, %xmm7 + subsd %xmm9, %xmm1 + mulsd %xmm9, %xmm7 + addsd %xmm9, %xmm5 + movsd .L_2il0floatpacket.3(%rip), %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm0, %xmm7 + movaps %xmm7, %xmm2 + addsd %xmm5, %xmm2 + sqrtsd %xmm2, %xmm2 + movsd %xmm2, -24(%rsp) + movl %eax, -24(%rsp) + movsd -24(%rsp), %xmm8 + movaps %xmm8, %xmm3 + movaps %xmm8, %xmm4 + mulsd %xmm8, %xmm3 + subsd %xmm8, %xmm2 + addsd %xmm8, %xmm9 + mulsd %xmm2, %xmm4 + subsd %xmm3, %xmm7 + movaps %xmm8, %xmm6 + subsd %xmm4, %xmm7 + addsd %xmm2, %xmm6 + addsd %xmm5, %xmm7 + divsd %xmm6, %xmm7 + addsd %xmm7, %xmm2 + mulsd .L_2il0floatpacket.1(%rip), %xmm2 + addsd %xmm2, %xmm1 + jmp ..B1.15 +..B1.14: + movsd -16(%rsp), %xmm1 + andps .L_2il0floatpacket.2(%rip), %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + movsd .L_2il0floatpacket.3(%rip), %xmm0 + movaps %xmm0, %xmm4 + addsd %xmm0, %xmm2 + sqrtsd %xmm2, %xmm2 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + addsd %xmm1, %xmm2 + mulsd %xmm3, %xmm1 + divsd %xmm2, %xmm4 + movsd %xmm1, -16(%rsp) + movl $0, -16(%rsp) + movsd -16(%rsp), %xmm9 + subsd %xmm9, %xmm1 + addsd %xmm4, %xmm1 +..B1.15: + movaps %xmm1, %xmm2 + movq $0x3ff0000000000000, %rax + addsd %xmm9, %xmm2 + movsd %xmm2, -16(%rsp) + movl $0, -16(%rsp) + movsd -16(%rsp), %xmm8 + movzwl -10(%rsp), %ecx + subsd %xmm8, %xmm9 + andl $32752, %ecx + addsd %xmm9, %xmm1 + shrl $4, %ecx + addl $-1023, %ecx + movslq %ecx, %rdx + negq %rdx + shlq $52, %rdx + addq %rax, %rdx + movq %rdx, -32(%rsp) + movsd -32(%rsp), %xmm3 + mulsd %xmm3, %xmm1 + mulsd %xmm3, %xmm8 + movaps %xmm1, %xmm4 + addsd %xmm8, %xmm4 + movsd %xmm4, -24(%rsp) + movl -20(%rsp), %edi + shrl $12, %edi + movzbl %dil, %edx + jmp ..B1.17 +..B1.16: + movsd -16(%rsp), %xmm0 + andps .L_2il0floatpacket.2(%rip), %xmm0 + movsd %xmm0, -16(%rsp) + movzwl -10(%rsp), %eax + movl %eax, %ecx + andl $-32753, %eax + andl $32752, %ecx + orl $-49168, %eax + movw %ax, -10(%rsp) + movsd -16(%rsp), %xmm1 + movl $0, -16(%rsp) + movl -12(%rsp), %edx + movsd -16(%rsp), %xmm8 + shrl $4, %ecx + subsd %xmm8, %xmm1 + shrl $12, %edx + addl $-1022, %ecx + movzbl %dl, %edx + movsd .L_2il0floatpacket.3(%rip), %xmm0 +..B1.17: + movq __libm_rcp_table_256@GOTPCREL(%rip), %rdi + pxor %xmm2, %xmm2 + lea 32+_PL(%rip), %r8 + lea 16+_PL(%rip), %r9 + lea 24+_PL(%rip), %r11 + lea _PL(%rip), %r10 + cvtss2sd (%rdi,%rdx,4), %xmm2 + mulsd %xmm2, %xmm8 + lea 8+_PL(%rip), %rdi + mulsd %xmm2, %xmm1 + subsd %xmm0, %xmm8 + movaps %xmm8, %xmm3 + movsd (%r8), %xmm5 + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm0 + mulsd %xmm3, %xmm0 + mulsd %xmm0, %xmm5 + movsd (%r11), %xmm4 + mulsd %xmm0, %xmm4 + addsd (%r9), %xmm5 + mulsd %xmm0, %xmm5 + addsd (%rdi), %xmm4 + mulsd %xmm0, %xmm4 + addsd (%r10), %xmm5 + mulsd %xmm0, %xmm5 + pxor %xmm0, %xmm0 + cvtsi2sd %ecx, %xmm0 + mulsd %xmm3, %xmm4 + lea _LN2(%rip), %rcx + addsd %xmm4, %xmm5 + movsd (%rcx), %xmm6 + lea 8+_LN2(%rip), %rcx + mulsd %xmm0, %xmm6 + addsd %xmm5, %xmm1 + movsd (%rcx), %xmm7 + mulsd %xmm7, %xmm0 + shlq $4, %rdx + movq __libm_log_table_256@GOTPCREL(%rip), %rax + shrl $31, %esi + addsd (%rax,%rdx), %xmm6 + addsd 8(%rax,%rdx), %xmm0 + addsd %xmm6, %xmm1 + addsd %xmm8, %xmm0 + lea ones(%rip), %rdx + movsd %xmm0, -16(%rsp) + movsd (%rdx,%rsi,8), %xmm8 + mulsd %xmm8, %xmm0 + mulsd %xmm8, %xmm1 + movsd %xmm8, -24(%rsp) + addsd %xmm1, %xmm0 + ret +..B1.18: + movsd -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type asinh,@function + .size asinh,.-asinh + .data +# -- End asinh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +_SCALE: + .long 0 + .long 1177550848 + .long 0 + .long 967835648 + .type _SCALE,@object + .size _SCALE,16 + .align 16 +_MINNORM: + .long 0 + .long 1048576 + .long 0 + .long 2148532224 + .type _MINNORM,@object + .size _MINNORM,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_PA: + .long 1431655746 + .long 3217380693 + .long 858875226 + .long 1068708659 + .long 2809361764 + .long 3215383405 + .long 1241898124 + .long 1067392054 + .long 966918340 + .long 3214324669 + .type _PA,@object + .size _PA,40 + .align 4 +_PL: + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .type _PL,@object + .size _PL,40 + .align 4 +_LN2: + .long 897137782 + .long 1038760431 + .long 4276092928 + .long 1072049730 + .type _LN2,@object + .size _LN2,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/asinhf_gen.S b/external/sgx_libm/intel64/asinhf_gen.S new file mode 100644 index 0000000000..9f16b5ca90 --- /dev/null +++ b/external/sgx_libm/intel64/asinhf_gen.S @@ -0,0 +1,295 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinhf_gen.c" + .text +..TXTST0: +# -- Begin asinhf + .text + .align 16,0x90 + .globl asinhf +asinhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_asinhf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + jge ..B1.15 +..B1.2: + cmpl $1056964608, %eax + jge ..B1.11 +..B1.3: + cmpl $838860800, %eax + jge ..B1.10 +..B1.4: + shrl $31, %edx + cmpl $8388608, %eax + jl ..B1.6 +..B1.5: + movss .L_2il0floatpacket.8(%rip), %xmm1 + lea _MINNORM(%rip), %rax + mulss %xmm1, %xmm0 + movl %edx, %edx + subss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.9(%rip), %xmm0 + ret +..B1.6: + testl %eax, %eax + je ..B1.8 +..B1.7: + lea _small_value_32(%rip), %rax + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + cvtss2sd -8(%rsp), %xmm2 + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.9(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm1 + subsd %xmm0, %xmm2 + pxor %xmm0, %xmm0 + movss %xmm1, -24(%rsp) + cvtsd2ss %xmm2, %xmm0 + ret +..B1.8: + movss -8(%rsp), %xmm0 +..B1.9: + ret +..B1.10: + pxor %xmm3, %xmm3 + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.0(%rip), %xmm4 + movsd .L_2il0floatpacket.4(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.1(%rip), %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.2(%rip), %xmm4 + addsd .L_2il0floatpacket.6(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.3(%rip), %xmm4 + addsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + movsd %xmm3, -16(%rsp) + addsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 + cvtsd2ss %xmm4, %xmm4 + movaps %xmm4, %xmm0 + ret +..B1.11: + pxor %xmm1, %xmm1 + cmpl $1199570944, %eax + cvtss2sd -8(%rsp), %xmm1 + andps .L_2il0floatpacket.15(%rip), %xmm1 + jge ..B1.13 +..B1.12: + movaps %xmm1, %xmm0 + movl $-1023, %r8d + mulsd %xmm1, %xmm0 + addsd .L_2il0floatpacket.14(%rip), %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm0, %xmm1 + movsd %xmm1, -16(%rsp) + jmp ..B1.14 +..B1.13: + movsd %xmm1, -16(%rsp) + movl $-1022, %r8d +..B1.14: + movzwl -10(%rsp), %ecx + movl %ecx, %eax + andl $-32753, %ecx + pxor %xmm0, %xmm0 + orl $-49168, %ecx + andl $32752, %eax + movw %cx, -10(%rsp) + pxor %xmm1, %xmm1 + movq __libm_rcp_table_256@GOTPCREL(%rip), %rdi + movl -12(%rsp), %esi + andl $1048575, %esi + shrl $12, %esi + cvtss2sd (%rdi,%rsi,4), %xmm0 + mulsd -16(%rsp), %xmm0 + movsd .L_2il0floatpacket.11(%rip), %xmm2 + shrl $4, %eax + addsd .L_2il0floatpacket.10(%rip), %xmm0 + mulsd %xmm0, %xmm2 + addl %eax, %r8d + cvtsi2sd %r8d, %xmm1 + addsd .L_2il0floatpacket.12(%rip), %xmm2 + mulsd .L_2il0floatpacket.13(%rip), %xmm1 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm2 + testl $-2147483648, %edx + movq __libm_logf_table_256@GOTPCREL(%rip), %r9 + addsd %xmm0, %xmm2 + addsd (%r9,%rsi,8), %xmm1 + addsd %xmm1, %xmm2 + movaps %xmm2, %xmm0 + xorps .L_2il0floatpacket.16(%rip), %xmm0 + jne ..L3 + movaps %xmm2, %xmm0 +..L3: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.15: + movss -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type asinhf,@function + .size asinhf,.-asinhf + .data +# -- End asinhf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.15: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 8 +.L_2il0floatpacket.0: + .long 0xd28ee596,0x3f73cb17 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x9b9f611c,0x3f91287a + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0xac0cf195,0x3f9f1aa4 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x1236cb49,0x3fb33333 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xd27f5e7d,0xbf874400 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x4197b1a0,0xbf96d307 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xdacdeace,0xbfa6db62 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x552ea1bd,0xbfc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x6890dd10,0x3fd5555a + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0xe7362feb,0xbfe00001 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0xfefa39ef,0x3fe62e42 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 4 +.L_2il0floatpacket.8: + .long 0x71800000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +.L_2il0floatpacket.9: + .long 0x0d800000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,4 + .align 4 +_MINNORM: + .long 8388608 + .long 2155872256 + .type _MINNORM,@object + .size _MINNORM,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/asinhl.S b/external/sgx_libm/intel64/asinhl.S new file mode 100644 index 0000000000..b1c8f734b1 --- /dev/null +++ b/external/sgx_libm/intel64/asinhl.S @@ -0,0 +1,1088 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinhl.c" + .text +..TXTST0: +# -- Begin asinhl + .text + .align 16,0x90 + .globl asinhl +asinhl: +# parameter 1: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_asinhl.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %cl, %cl +..B1.2: + fnstcw 50(%rsp) +..B1.3: + movzwl 72(%rsp), %esi + andl $32767, %esi + movzwl 50(%rsp), %eax + cmpl $32767, %esi + je ..B1.67 +..B1.4: + cmpl $16382, %esi + jge ..B1.46 +..B1.5: + cmpl $16376, %esi + jge ..B1.39 +..B1.6: + cmpl $16371, %esi + jge ..B1.32 +..B1.7: + cmpl $16365, %esi + jge ..B1.25 +..B1.8: + cmpl $16308, %esi + jge ..B1.18 +..B1.9: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.13 +..B1.10: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.11: + fldcw 48(%rsp) +..B1.12: + movzwl 72(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.13: + testl %esi, %esi + jle ..B1.63 +..B1.14: + fldt 64(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + fsubp %st, %st(1) + fmull (%rdx) + fstpt (%rsp) +..B1.15: + testb %cl, %cl + je ..B1.17 +..B1.16: + fldcw 50(%rsp) +..B1.17: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.18: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.22 +..B1.19: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.20: + fldcw 48(%rsp) +..B1.21: + movb $1, %cl +..B1.22: + fldt 64(%rsp) + lea _Q3(%rip), %rax + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 50(%rsp) +..B1.24: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.25: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.29 +..B1.26: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.27: + fldcw 48(%rsp) +..B1.28: + movb $1, %cl +..B1.29: + fldt 64(%rsp) + lea 16+_Q2(%rip), %rax + fld %st(0) + lea _Q2(%rip), %rdx + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.31 +..B1.30: + fldcw 50(%rsp) +..B1.31: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.32: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.36 +..B1.33: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.34: + fldcw 48(%rsp) +..B1.35: + movb $1, %cl +..B1.36: + fldt 64(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rsi + fmul %st(1), %st + lea 16+_Q1(%rip), %rdx + fld %st(0) + lea _Q1(%rip), %rdi + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.38 +..B1.37: + fldcw 50(%rsp) +..B1.38: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.39: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.43 +..B1.40: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.41: + fldcw 48(%rsp) +..B1.42: + movb $1, %cl +..B1.43: + fldt 64(%rsp) + lea _TWO_53H(%rip), %rax + fld %st(0) + fld %st(1) + lea 304+_Q(%rip), %rdx + lea 272+_Q(%rip), %rsi + lea 240+_Q(%rip), %rdi + lea 208+_Q(%rip), %r8 + fldl (%rax) + lea 176+_Q(%rip), %r9 + fmul %st(3), %st + lea 144+_Q(%rip), %r10 + lea 112+_Q(%rip), %r11 + lea 80+_Q(%rip), %rax + testb %cl, %cl + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + fmul %st(0), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fadd %st, %st(2) + fld %st(2) + fmul %st(2), %st + fxch %st(4) + fstpt 16(%rsp) + fld %st(1) + fmul %st(1), %st + faddp %st, %st(4) + fld %st(3) + fxch %st(1) + fmul %st(0), %st + fadd %st, %st(1) + fldt (%rdx) + fmul %st(2), %st + lea 48+_Q(%rip), %rdx + fldt (%rsi) + lea 16+_Q(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 288+_Q(%rip), %rdi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + lea 256+_Q(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + lea 224+_Q(%rip), %r9 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + lea 192+_Q(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + lea 160+_Q(%rip), %r11 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_Q(%rip), %rax + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 96+_Q(%rip), %rdx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 64+_Q(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 32+_Q(%rip), %rdi + fmul %st(3), %st + fldt (%r8) + lea _Q(%rip), %r8 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r9) + lea 336+_Q(%rip), %r9 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r10) + lea 320+_Q(%rip), %r10 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r11) + lea _TWO_48H(%rip), %r11 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r8) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt (%r9) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmulp %st, %st(3) + fldt (%r10) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 32(%rsp) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fld %st(0) + fldl (%r11) + fld %st(0) + fadd %st(5), %st + fsubp %st, %st(1) + fmul %st, %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fldt 64(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt (%rsp) + fmul %st, %st(2) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.45 +..B1.44: + fldcw 50(%rsp) +..B1.45: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.46: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.50 +..B1.47: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.48: + fldcw 48(%rsp) +..B1.49: + movb $1, %cl +..B1.50: + fldt 64(%rsp) + lea ones(%rip), %rdx + movb 73(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %esi + fldl (%rdx,%rsi,8) + fmul %st, %st(1) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + movzwl 72(%rsp), %eax + movl %eax, %edx + andl $32767, %edx + cmpl $16421, %edx + jge ..B1.59 +..B1.51: + cmpl $16388, %edx + jge ..B1.53 +..B1.52: + lea _TWO_52H(%rip), %rax + fld %st(0) + fld %st(1) + fldl (%rax) + fld %st(0) + fxch %st(1) + fadd %st, %st(3) + fsubr %st, %st(3) + fld %st(3) + fld %st(4) + fmul %st(5), %st + fxch %st(4) + fsub %st(5), %st + fmul %st, %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fsqrt + fadd %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fsubrp %st, %st(4) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fdivrp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + fxch %st(1) + jmp ..B1.58 +..B1.53: + fldt .L_2il0floatpacket.2(%rip) + lea _TWO_32H(%rip), %rax + fmul %st(1), %st + cmpl $16394, %edx + fld %st(0) + fldl (%rax) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubr %st(1), %st + fldt .L_2il0floatpacket.0(%rip) + jge ..B1.55 +..B1.54: + fstp %st(2) + fld %st(2) + fmul %st(3), %st + fadd %st(2), %st + fsqrt + faddp %st, %st(3) + fxch %st(1) + fdiv %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + jmp ..B1.58 +..B1.55: + fstp %st(3) + cmpl $16401, %edx + jge ..B1.57 +..B1.56: + fld %st(2) + fdiv %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fdivr %st(2), %st + faddp %st, %st(1) + jmp ..B1.58 +..B1.57: + fxch %st(1) + fdivr %st(2), %st + faddp %st, %st(1) +..B1.58: + fldt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 64(%rsp) + movzwl 72(%rsp), %edx + andl $32767, %edx + movl %edx, %eax + addl $-16383, %edx + negl %eax + fxch %st(2) + fstpt (%rsp) + addl $-2, %eax + movzwl 8(%rsp), %esi + andl $32767, %eax + andl $-32768, %esi + orl %eax, %esi + movw %si, 8(%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 16(%rsp) + fmulp %st, %st(1) + jmp ..B1.60 +..B1.59: + fstp %st(0) + andl $-32768, %eax + addl $-16382, %edx + orl $-49153, %eax + movw %ax, 72(%rsp) + lea _TWO_52H(%rip), %rax + fldt 64(%rsp) + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) +..B1.60: + fldt 16(%rsp) + lea 48+_P(%rip), %r8 + fldt .L_2il0floatpacket.3(%rip) + lea 16+_P(%rip), %r9 + movl 68(%rsp), %esi + lea 64+_P(%rip), %r10 + shrl $23, %esi + lea 32+_P(%rip), %r11 + fldt (%r8) + movzbl %sil, %eax + movq __libm_rcp_table_256@GOTPCREL(%rip), %rdi + movl %edx, (%rsp) + lea 80+_P(%rip), %rdx + movq __libm_logl_table_256@GOTPCREL(%rip), %rsi + flds (%rdi,%rax,4) + fmul %st, %st(3) + shlq $4, %rax + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(1) + fld %st(1) + testb %cl, %cl + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fildl (%rsp) + fldt (%rdx) + lea _P(%rip), %rdx + fmul %st(3), %st + faddp %st, %st(6) + fxch %st(2) + fmul %st, %st(5) + fldt (%r9) + faddp %st, %st(6) + fmul %st, %st(5) + fxch %st(1) + fmulp %st, %st(5) + fldt (%r10) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldt .L_2il0floatpacket.4(%rip) + fmul %st(3), %st + fldt .L_2il0floatpacket.5(%rip) + fmulp %st, %st(4) + faddl 8(%rsi,%rax) + faddp %st, %st(1) + fxch %st(2) + faddl (%rax,%rsi) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rsp) + je ..B1.62 +..B1.61: + fldcw 50(%rsp) +..B1.62: + fldt 16(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.63: + cmpl $0, 68(%rsp) + jne ..B1.65 +..B1.64: + cmpl $0, 64(%rsp) + je ..B1.66 +..B1.65: + fldt 64(%rsp) + lea _small_value_80(%rip), %rsi + movb 73(%rsp), %al + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %edx + shlq $4, %rdx + fldt (%rsi,%rdx) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.66: + fldt 64(%rsp) + fstpt (%rsp) + jmp ..B1.15 +..B1.67: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.73 +..B1.68: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.69: + fldcw 48(%rsp) +..B1.70: + fldt 64(%rsp) + fstpt (%rsp) +..B1.71: + fldcw 50(%rsp) +..B1.72: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.73: + fldt 64(%rsp) + fstpt (%rsp) + jmp ..B1.72 + .align 16,0x90 + .cfi_endproc + .type asinhl,@function + .size asinhl,.-asinhl + .data +# -- End asinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_Q3: + .word 6991 + .word 42216 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 33268 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 9764 + .word 39322 + .word 39161 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 43682 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 14144 + .word 39303 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 10686 + .word 40209 + .word 28068 + .word 46811 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 6376 + .word 25459 + .word 13370 + .word 63707 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 42228 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 4505 + .word 52442 + .word 52428 + .word 52428 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 31967 + .word 56173 + .word 28086 + .word 46811 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 26124 + .word 58234 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 22137 + .word 23222 + .word 53620 + .word 46917 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 45395 + .word 61656 + .word 25205 + .word 36391 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 28077 + .word 15147 + .word 52421 + .word 58572 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 19650 + .word 2873 + .word 50009 + .word 48451 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 47538 + .word 64725 + .word 9133 + .word 40943 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 42460 + .word 64288 + .word 29314 + .word 35191 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 54924 + .word 18085 + .word 19628 + .word 61339 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 8359 + .word 63244 + .word 48955 + .word 54066 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 13301 + .word 22367 + .word 28967 + .word 48066 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 47487 + .word 41074 + .word 54143 + .word 42870 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 18176 + .word 28317 + .word 25378 + .word 37849 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 2947 + .word 59345 + .word 39582 + .word 64148 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 7071 + .word 46945 + .word 60101 + .word 49232 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 33184 + .word 23492 + .word 18153 + .word 62298 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 44779 + .word 60944 + .word 30881 + .word 55868 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 22870 + .word 51718 + .word 28591 + .word 51709 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,352 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,96 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/asinl.S b/external/sgx_libm/intel64/asinl.S new file mode 100644 index 0000000000..36b558921e --- /dev/null +++ b/external/sgx_libm/intel64/asinl.S @@ -0,0 +1,1320 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "asinl.c" + .text +..TXTST0: +# -- Begin asinl + .text + .align 16,0x90 + .globl asinl +asinl: +# parameter 1: 112 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_asinl.1: +..L2: + + subq $104, %rsp + .cfi_def_cfa_offset 112 + xorb %dl, %dl +..B1.2: + fnstcw 90(%rsp) +..B1.3: + movb 121(%rsp), %dil + movzwl 120(%rsp), %esi + andb $-128, %dil + andl $32767, %esi + shrb $7, %dil + movzwl 90(%rsp), %eax + cmpl $16383, %esi + jge ..B1.59 +..B1.4: + cmpl $16382, %esi + jge ..B1.49 +..B1.5: + cmpl $16376, %esi + jge ..B1.39 +..B1.6: + cmpl $16371, %esi + jge ..B1.32 +..B1.7: + cmpl $16365, %esi + jge ..B1.25 +..B1.8: + cmpl $16308, %esi + jge ..B1.18 +..B1.9: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.13 +..B1.10: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.11: + fldcw 88(%rsp) +..B1.12: + movzwl 120(%rsp), %esi + movb $1, %dl + andl $32767, %esi +..B1.13: + testl %esi, %esi + jle ..B1.75 +..B1.14: + fldt 112(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rcx + fldl (%rax) + fmul %st(1), %st + faddp %st, %st(1) + fmull (%rcx) + fstpt (%rsp) +..B1.15: + testb %dl, %dl + je ..B1.17 +..B1.16: + fldcw 90(%rsp) +..B1.17: + fldt (%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.18: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.22 +..B1.19: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.20: + fldcw 88(%rsp) +..B1.21: + movb $1, %dl +..B1.22: + fldt 112(%rsp) + lea _P4(%rip), %rax + testb %dl, %dl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 90(%rsp) +..B1.24: + fldt (%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.25: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.29 +..B1.26: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.27: + fldcw 88(%rsp) +..B1.28: + movb $1, %dl +..B1.29: + fldt 112(%rsp) + lea 16+_P3(%rip), %rax + fld %st(0) + lea _P3(%rip), %rcx + fmul %st(1), %st + testb %dl, %dl + fldt (%rax) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.31 +..B1.30: + fldcw 90(%rsp) +..B1.31: + fldt (%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.32: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.36 +..B1.33: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.34: + fldcw 88(%rsp) +..B1.35: + movb $1, %dl +..B1.36: + fldt 112(%rsp) + lea 48+_P2(%rip), %rax + fld %st(0) + lea 32+_P2(%rip), %rsi + fmul %st(1), %st + lea 16+_P2(%rip), %rcx + fld %st(0) + lea _P2(%rip), %rdi + fmul %st(1), %st + testb %dl, %dl + fldt (%rax) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.38 +..B1.37: + fldcw 90(%rsp) +..B1.38: + fldt (%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.39: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.43 +..B1.40: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.41: + fldcw 88(%rsp) +..B1.42: + movzwl 120(%rsp), %esi + movb $1, %dl + andl $32767, %esi +..B1.43: + fldt 112(%rsp) + lea _TWO_52H(%rip), %rax + fld %st(0) + cmpl $16381, %esi + fldl (%rax) + fmul %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubp %st, %st(2) + fld %st(1) + fxch %st(1) + fstpt 16(%rsp) + fld %st(1) + fsubr %st(3), %st + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fld %st(1) + fmul %st(4), %st + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fld %st(2) + fmul %st(3), %st + fld %st(0) + faddp %st, %st(2) + jge ..B1.45 +..B1.44: + fstp %st(0) + lea 176+_P1(%rip), %rax + lea 144+_P1(%rip), %rcx + lea 112+_P1(%rip), %rsi + lea 80+_P1(%rip), %rdi + lea 160+_P1(%rip), %r10 + lea 48+_P1(%rip), %r8 + lea 128+_P1(%rip), %r11 + lea 16+_P1(%rip), %r9 + fldt (%rax) + lea 96+_P1(%rip), %rax + fmul %st(1), %st + fldt (%rcx) + lea 64+_P1(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + lea 32+_P1(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea _P1(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 192+_P1(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fldt 48(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%rsp) + fldt (%r8) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + jmp ..B1.46 +..B1.45: + lea 272+_P(%rip), %rax + lea 240+_P(%rip), %rcx + lea 208+_P(%rip), %rsi + lea 176+_P(%rip), %rdi + lea 144+_P(%rip), %r8 + lea 112+_P(%rip), %r9 + lea 80+_P(%rip), %r10 + lea 48+_P(%rip), %r11 + fldt (%rax) + lea 16+_P(%rip), %rax + fmul %st(2), %st + fldt (%rcx) + lea 256+_P(%rip), %rcx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 224+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 192+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + lea 160+_P(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + lea 128+_P(%rip), %r9 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + lea 96+_P(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + lea 64+_P(%rip), %r11 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + lea 32+_P(%rip), %rax + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + lea _P(%rip), %rcx + fmul %st(3), %st + fldt (%rsi) + lea 304+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + lea 288+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%rcx) + faddp %st, %st(3) + fldt 48(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 32(%rsp) + fldt (%rsp) + fldt (%rsi) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rdi) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fld %st(1) + fxch %st(5) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fmul %st(1), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fsub %st(3), %st + faddp %st, %st(1) +..B1.46: + fldt 64(%rsp) + fld %st(2) + fmul %st(4), %st + testb %dl, %dl + fxch %st(5) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 64(%rsp) + je ..B1.48 +..B1.47: + fldcw 90(%rsp) +..B1.48: + fldt 64(%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.49: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.53 +..B1.50: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.51: + fldcw 88(%rsp) +..B1.52: + movb $1, %dl +..B1.53: + fldt 112(%rsp) + lea _ones(%rip), %rcx + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_32H(%rip), %rsi + movzbl %dil, %eax + lea _TWO_52H(%rip), %rdi + fldl (%rsi) + fldl (%rcx,%rax,8) + fmul %st, %st(3) + fstpl 80(%rsp) + fxch %st(2) + fsubrl (%rcx) + fmul %st(1), %st + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fxch %st(1) + fsub %st(3), %st + fadd %st, %st(1) + fxch %st(1) + fsqrt + fldl (%rdi) + fstpt 32(%rsp) + fldt 32(%rsp) + fmul %st(1), %st + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fsubr %st, %st(5) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fsubrp %st, %st(6) + fxch %st(3) + faddp %st, %st(5) + fld %st(0) + fadd %st(2), %st + fdivrp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fmulp %st, %st(2) + fld %st(1) + fld %st(3) + fadd %st(3), %st + fmul %st, %st(1) + fld %st(4) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(2) + fadd %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fld %st(2) + fmul %st(3), %st + fld %st(0) + faddp %st, %st(2) + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + fstpt 112(%rsp) + fldt 112(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fcomip %st(1), %st + fstp %st(0) + jbe ..B1.55 +..B1.54: + fstp %st(1) + lea 176+_P1(%rip), %rax + lea 144+_P1(%rip), %rcx + lea 112+_P1(%rip), %rsi + lea 80+_P1(%rip), %rdi + lea 160+_P1(%rip), %r10 + lea 48+_P1(%rip), %r8 + lea 128+_P1(%rip), %r11 + lea 16+_P1(%rip), %r9 + fldt (%rax) + lea 96+_P1(%rip), %rax + fmul %st(1), %st + fldt (%rcx) + lea 64+_P1(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + lea 32+_P1(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea _P1(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 192+_P1(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fldt 64(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 16(%rsp) + fldt (%r8) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(2) + fxch %st(1) + jmp ..B1.56 +..B1.55: + lea 272+_P(%rip), %rax + lea 240+_P(%rip), %rcx + lea 208+_P(%rip), %rsi + lea 176+_P(%rip), %rdi + lea 144+_P(%rip), %r8 + lea 112+_P(%rip), %r9 + lea 80+_P(%rip), %r10 + lea 48+_P(%rip), %r11 + fldt (%rax) + lea 16+_P(%rip), %rax + fmul %st(1), %st + fldt (%rcx) + lea 256+_P(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + lea 224+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea 192+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 160+_P(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + lea 128+_P(%rip), %r9 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + lea 96+_P(%rip), %r10 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + lea 64+_P(%rip), %r11 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea 32+_P(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea _P(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 304+_P(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 288+_P(%rip), %rdi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rcx) + faddp %st, %st(2) + fldt 64(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + fldt 16(%rsp) + fldt (%rsi) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fldt (%rdi) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fldt 32(%rsp) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) +..B1.56: + fldt (%rsp) + lea _pi_02(%rip), %rax + fmulp %st, %st(2) + fld %st(2) + fmul %st(1), %st + lea 16+_pi_02(%rip), %rcx + testb %dl, %dl + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st(2), %st + faddp %st, %st(2) + fldt .L_2il0floatpacket.2(%rip) + fmul %st, %st(1) + fmulp %st, %st(2) + fldt (%rax) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fmull 80(%rsp) + fstpt 16(%rsp) + je ..B1.58 +..B1.57: + fldcw 90(%rsp) +..B1.58: + fldt 16(%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.59: + movl %eax, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.63 +..B1.60: + orl $-64768, %eax + movw %ax, 88(%rsp) +..B1.61: + fldcw 88(%rsp) +..B1.62: + movzwl 120(%rsp), %esi + movb $1, %dl + andl $32767, %esi +..B1.63: + cmpl $32767, %esi + jne ..B1.67 +..B1.64: + cmpl $-2147483648, 116(%rsp) + jne ..B1.66 +..B1.65: + cmpl $0, 112(%rsp) + je ..B1.71 +..B1.66: + fldt 112(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) + jmp ..B1.72 +..B1.67: + cmpl $16383, %esi + jne ..B1.71 +..B1.68: + cmpl $-2147483648, 116(%rsp) + jne ..B1.71 +..B1.69: + cmpl $0, 112(%rsp) + jne ..B1.71 +..B1.70: + movzbl %dil, %ecx + lea _pi_2l(%rip), %rax + shlq $4, %rcx + lea _small_value_80(%rip), %rsi + fldt (%rcx,%rax) + fldt (%rcx,%rsi) + faddp %st, %st(1) + fstpt 8(%rsp) + jmp ..B1.72 +..B1.71: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 8(%rsp) +..B1.72: + testb %dl, %dl + je ..B1.74 +..B1.73: + fldcw 90(%rsp) +..B1.74: + fldt 8(%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.75: + cmpl $0, 116(%rsp) + jne ..B1.77 +..B1.76: + cmpl $0, 112(%rsp) + je ..B1.78 +..B1.77: + fldt 112(%rsp) + lea _small_value_80(%rip), %rcx + movzbl %dil, %eax + shlq $4, %rax + fldt (%rcx) + fldt (%rcx,%rax) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.78: + fldt 112(%rsp) + fstpt (%rsp) + jmp ..B1.15 + .align 16,0x90 + .cfi_endproc + .type asinl,@function + .size asinl,.-asinl + .data +# -- End asinl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_P4: + .word 43691 + .word 44938 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P4,@object + .size _P4,16 + .align 2 +_P3: + .word 36763 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 40704 + .word 58046 + .word 39460 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P3,@object + .size _P3,32 + .align 2 +_P2: + .word 43688 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 20771 + .word 39331 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 23807 + .word 53798 + .word 28073 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 35198 + .word 7516 + .word 54204 + .word 63722 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _P2,@object + .size _P2,64 + .align 2 +_P1: + .word 43589 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 39364 + .word 39321 + .word 39321 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 17602 + .word 56173 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 47501 + .word 58414 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 27078 + .word 6583 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 39781 + .word 21053 + .word 25224 + .word 36391 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 46568 + .word 6235 + .word 50749 + .word 58572 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 41318 + .word 51558 + .word 37628 + .word 48452 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 55026 + .word 7893 + .word 43866 + .word 40925 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43387 + .word 19951 + .word 2911 + .word 35445 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 32572 + .word 59281 + .word 11243 + .word 56666 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 49800 + .word 50337 + .word 42707 + .word 39184 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,208 + .align 2 +_P: + .word 42691 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 4317 + .word 52400 + .word 52428 + .word 52428 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 26206 + .word 56172 + .word 28086 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 36130 + .word 58514 + .word 36408 + .word 63715 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 21592 + .word 8113 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 3093 + .word 49950 + .word 25215 + .word 36391 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 21499 + .word 24428 + .word 51889 + .word 58572 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 54828 + .word 41264 + .word 61120 + .word 48451 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 10243 + .word 1489 + .word 39717 + .word 40940 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 51433 + .word 46039 + .word 63564 + .word 35220 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 60402 + .word 39286 + .word 25675 + .word 60826 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 34219 + .word 36833 + .word 44839 + .word 57547 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 13013 + .word 26091 + .word 19721 + .word 60832 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 22353 + .word 41544 + .word 55443 + .word 55735 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 14948 + .word 7038 + .word 38091 + .word 38339 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 61727 + .word 61480 + .word 15906 + .word 51927 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 13386 + .word 23084 + .word 64443 + .word 55906 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 17499 + .word 23573 + .word 43947 + .word 42761 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39328 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,320 + .align 2 +_pi_02: + .word 0 + .word 0 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 35374 + .word 4889 + .word 2259 + .word 34211 + .word 16349 + .word 0 + .word 0 + .word 0 + .type _pi_02,@object + .size _pi_02,32 + .align 2 +_pi_2l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _pi_2l,@object + .size _pi_2l,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atan2.S b/external/sgx_libm/intel64/atan2.S new file mode 100644 index 0000000000..023bababa2 --- /dev/null +++ b/external/sgx_libm/intel64/atan2.S @@ -0,0 +1,1197 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2.c" + .text +..TXTST0: +# -- Begin atan2 + .text + .align 16,0x90 + .globl atan2 +atan2: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_atan2.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) + movsd %xmm1, 8(%rsp) +..B1.2: + pextrw $3, %xmm0, %eax + andl $32752, %eax + subl $14448, %eax + cmpl $3840, %eax + ja .L_2TAG_PACKET_0.0.2 + pextrw $3, %xmm1, %eax + andl $32752, %eax + subl $14448, %eax + cmpl $3840, %eax + ja .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + unpcklpd %xmm1, %xmm0 + xorpd %xmm5, %xmm5 + xorpd %xmm3, %xmm3 + movl $2048, %eax + pinsrw $3, %eax, %xmm5 + paddw %xmm1, %xmm5 + psrlq $29, %xmm5 + rcpss %xmm5, %xmm3 + xorpd %xmm4, %xmm4 + movl $14336, %ecx + pinsrw $3, %ecx, %xmm4 + psllq $29, %xmm3 + paddw %xmm4, %xmm3 + mulsd %xmm0, %xmm3 + xorpd %xmm2, %xmm2 + xorpd %xmm6, %xmm6 + xorpd %xmm7, %xmm7 + movl $32768, %eax + pinsrw $2, %eax, %xmm6 + movl $32767, %ecx + pinsrw $3, %ecx, %xmm7 + paddd %xmm6, %xmm3 + andpd %xmm7, %xmm3 + movq %xmm3, %xmm5 + pextrw $3, %xmm3, %eax + movl $16448, %ecx + pinsrw $3, %ecx, %xmm2 + minsd %xmm2, %xmm3 + movmskpd %xmm0, %edx + psllq $1, %xmm0 + psrlq $1, %xmm0 + cmpsd $2, %xmm2, %xmm5 + psllq $1, %xmm1 + psrlq $1, %xmm1 + movq %xmm1, %xmm6 + movq %xmm1, %xmm7 + movq %xmm0, %xmm2 + movl $0, %ecx + pinsrw $0, %ecx, %xmm6 + subsd %xmm6, %xmm7 + movq %xmm0, %xmm4 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm7 + andpd %xmm5, %xmm0 + subsd %xmm6, %xmm0 + andpd %xmm5, %xmm1 + addsd %xmm1, %xmm4 + subsd %xmm7, %xmm0 + andl $32752, %eax + subl $16286, %eax + cmpl $1121, %eax + ja .L_2TAG_PACKET_3.0.2 + divsd %xmm4, %xmm0 + pextrw $3, %xmm3, %ecx + movsd a2(%rip), %xmm2 + movsd b2(%rip), %xmm3 + pextrw $0, %xmm5, %eax + addl %edx, %edx + lea P_TBL(%rip), %r8 + movapd (%r8,%rdx,8), %xmm6 + lea SGN_TBL(%rip), %r8 + movapd (%r8,%rdx,8), %xmm1 + subl $16286, %ecx + notl %eax + andl $1, %eax + addl %eax, %ecx + addl %ecx, %ecx + lea ATAN_TBL(%rip), %r8 + movapd (%r8,%rcx,8), %xmm5 + xorpd %xmm1, %xmm5 + addpd %xmm6, %xmm5 + movq %xmm5, %xmm6 + unpckhpd %xmm5, %xmm5 + xorpd %xmm0, %xmm1 + movq %xmm1, %xmm4 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm2 + addsd %xmm0, %xmm3 + addsd %xmm6, %xmm1 + subsd %xmm1, %xmm6 + addsd %xmm4, %xmm6 + addsd 8+a2(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm4, %xmm0 + addsd %xmm5, %xmm6 + mulsd %xmm2, %xmm0 + addsd 8+b2(%rip), %xmm3 + mulsd %xmm3, %xmm0 + addsd %xmm6, %xmm0 + addsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_3.0.2: + addl $942, %eax + cmpl $942, %eax + ja .L_2TAG_PACKET_4.0.2 + xorpd %xmm4, %xmm4 + movl $16368, %ecx + pinsrw $3, %ecx, %xmm4 + divsd %xmm1, %xmm4 + addl %edx, %edx + lea SGN_TBL(%rip), %r8 + movapd (%r8,%rdx,8), %xmm6 + unpcklpd %xmm3, %xmm3 + xorpd %xmm6, %xmm0 + xorpd %xmm6, %xmm2 + xorpd %xmm6, %xmm3 + lea P_TBL2(%rip), %r8 + movapd (%r8,%rdx,8), %xmm7 + movsd a2(%rip), %xmm1 + movsd b2(%rip), %xmm5 + lea SELECT_B(%rip), %r8 + andpd (%r8,%rdx,8), %xmm3 + mulsd %xmm4, %xmm2 + mulsd %xmm4, %xmm0 + movq %xmm2, %xmm6 + mulsd %xmm2, %xmm2 + mulsd %xmm2, %xmm1 + addsd %xmm2, %xmm5 + mulsd %xmm2, %xmm6 + addsd 8+a2(%rip), %xmm1 + mulsd %xmm2, %xmm5 + addsd %xmm0, %xmm7 + addpd %xmm3, %xmm7 + mulsd %xmm6, %xmm1 + addsd 8+b2(%rip), %xmm5 + mulsd %xmm1, %xmm5 + addsd %xmm7, %xmm5 + pshufd $238, %xmm7, %xmm0 + addsd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_4.0.2: + movsd 8(%rsp), %xmm1 + movsd (%rsp), %xmm0 + pextrw $3, %xmm1, %eax + andl $32752, %eax + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl %eax, %ecx + jg .L_2TAG_PACKET_5.0.2 + pextrw $3, %xmm1, %ecx + cmpl $32767, %ecx + jg .L_2TAG_PACKET_6.0.2 + divsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_6.0.2: + andpd SGNMASK(%rip), %xmm0 + movsd pi_table(%rip), %xmm2 + xorpd %xmm2, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + andpd SGNMASK(%rip), %xmm0 + movsd pi2_table(%rip), %xmm2 + xorpd %xmm2, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: +.L_2TAG_PACKET_1.0.2: + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + pextrw $3, %xmm1, %eax + andl $32752, %eax + cmpl $32752, %ecx + je .L_2TAG_PACKET_7.0.2 + cmpl $32752, %eax + je .L_2TAG_PACKET_8.0.2 + movsd POW55(%rip), %xmm3 + movl $1024, %edx + movsd INVEXPMASK(%rip), %xmm4 + xorpd %xmm6, %xmm6 + movsd EXPMASK(%rip), %xmm7 + cmpl $0, %ecx + je .L_2TAG_PACKET_9.0.2 +.L_2TAG_PACKET_10.0.2: + cmpl $0, %eax + je .L_2TAG_PACKET_11.0.2 +.L_2TAG_PACKET_12.0.2: + addl %ecx, %edx + subl %eax, %edx + cmpl $2048, %edx + ja .L_2TAG_PACKET_4.0.2 + addl $15344, %edx + pinsrw $3, %edx, %xmm6 + andpd %xmm4, %xmm0 + andpd %xmm4, %xmm1 + orpd %xmm6, %xmm0 + orpd %xmm7, %xmm1 + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_9.0.2: + subl $880, %edx + mulsd %xmm3, %xmm0 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $0, %ecx + je .L_2TAG_PACKET_13.0.2 + jmp .L_2TAG_PACKET_10.0.2 +.L_2TAG_PACKET_11.0.2: + addl $880, %edx + mulsd %xmm3, %xmm1 + pextrw $3, %xmm1, %eax + andl $32752, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_14.0.2 + jmp .L_2TAG_PACKET_12.0.2 +.L_2TAG_PACKET_7.0.2: + movd %xmm0, %edx + movq %xmm0, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + andl $1048575, %ecx + orl %edx, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_15.0.2 + psrlq $63, %xmm0 + psllq $63, %xmm0 + cmpl $32752, %eax + jae .L_2TAG_PACKET_16.0.2 + movapd pi2_table(%rip), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_15.0.2: + addsd %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_16.0.2: + movd %xmm1, %eax + movq %xmm1, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + movl $-2147483648, %edx + andl %ecx, %edx + andl $1048575, %ecx + orl %eax, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_17.0.2 + cmpl $0, %edx + jne .L_2TAG_PACKET_18.0.2 + movapd pi4_table(%rip), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_17.0.2: + movq %xmm1, %xmm0 + addsd %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_18.0.2: + movapd pi4_table(%rip), %xmm5 + movapd pi2_table(%rip), %xmm6 + addpd %xmm6, %xmm5 + pshufd $238, %xmm5, %xmm6 + addpd %xmm6, %xmm5 + orpd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_8.0.2: + movd %xmm1, %eax + movq %xmm1, %xmm2 + psrlq $32, %xmm2 + movd %xmm2, %ecx + movl $-2147483648, %edx + andl %ecx, %edx + andl $1048575, %ecx + orl %eax, %ecx + cmpl $0, %ecx + jne .L_2TAG_PACKET_17.0.2 + psrlq $63, %xmm0 + psllq $63, %xmm0 + cmpl $0, %edx + jne .L_2TAG_PACKET_19.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_19.0.2: + movapd pi_table(%rip), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_13.0.2: + pextrw $3, %xmm1, %edx + andl $32768, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_20.0.2 + movapd pi_table(%rip), %xmm5 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + comisd %xmm0, %xmm1 + orpd %xmm5, %xmm0 + je .L_2TAG_PACKET_21.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_20.0.2: + comisd %xmm0, %xmm1 + je .L_2TAG_PACKET_21.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_14.0.2: + movapd pi2_table(%rip), %xmm5 + psrlq $63, %xmm0 + psllq $63, %xmm0 + pshufd $238, %xmm5, %xmm4 + addsd %xmm4, %xmm5 + orpd %xmm5, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_21.0.2: + movq %xmm0, 16(%rsp) +..B1.3: + movq 16(%rsp), %xmm0 +.L_2TAG_PACKET_22.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type atan2,@function + .size atan2,.-atan2 + .data +# -- End atan2 + .section .rodata, "a" + .align 16 + .align 16 +a2: + .long 2006262985 + .long 1069310863 + .long 2358449471 + .long 3217342131 + .type a2,@object + .size a2,16 + .align 16 +b2: + .long 3845454352 + .long 1069952297 + .long 2829679149 + .long 1073771565 + .type b2,@object + .size b2,16 + .align 16 +P_TBL: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 3221823995 + .long 856972295 + .long 3164710438 + .type P_TBL,@object + .size P_TBL,64 + .align 16 +SGN_TBL: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 0 + .type SGN_TBL,@object + .size SGN_TBL,64 + .align 16 +ATAN_TBL: + .long 3390881280 + .long 1067318733 + .long 1411116779 + .long 1018950063 + .long 2985987840 + .long 1067384211 + .long 2088903695 + .long 1018086027 + .long 3148445184 + .long 1067449685 + .long 2044163806 + .long 1017271335 + .long 3667629184 + .long 1067515494 + .long 2353092775 + .long 1019967309 + .long 1546568832 + .long 1067580954 + .long 611991315 + .long 1017602584 + .long 3815996800 + .long 1067646404 + .long 466038598 + .long 1019686426 + .long 4050241920 + .long 1067711845 + .long 3265026328 + .long 1019626952 + .long 120454912 + .long 1067777277 + .long 1542207696 + .long 1020155608 + .long 2784639744 + .long 1067842697 + .long 3883834623 + .long 1018602870 + .long 1328010624 + .long 1067908107 + .long 1791097456 + .long 1019053126 + .long 2217794048 + .long 1067973505 + .long 551619938 + .long 1018494194 + .long 3333520000 + .long 1068038891 + .long 2390331823 + .long 1019033022 + .long 2557052032 + .long 1068104265 + .long 2423976108 + .long 1019728674 + .long 2067649536 + .long 1068169626 + .long 3757397745 + .long 1018672362 + .long 4047094784 + .long 1068234973 + .long 481613184 + .long 1019275104 + .long 2089853184 + .long 1068300307 + .long 1733914374 + .long 1020124677 + .long 2678003840 + .long 1068365626 + .long 1373600282 + .long 1013935474 + .long 3706496128 + .long 1068430930 + .long 1000610902 + .long 1019673285 + .long 3073179008 + .long 1068496219 + .long 1497143008 + .long 1019900342 + .long 2803716736 + .long 1068562846 + .long 1476677416 + .long 1019444094 + .long 3204984128 + .long 1068628077 + .long 1192335905 + .long 1018748628 + .long 831146624 + .long 1068693273 + .long 2733586224 + .long 1018823295 + .long 243029376 + .long 1068758431 + .long 950106081 + .long 1019046675 + .long 1735561920 + .long 1068823549 + .long 3546440856 + .long 1020104712 + .long 1339217792 + .long 1068888626 + .long 3028812387 + .long 1019818321 + .long 3706342144 + .long 1068953659 + .long 3814564029 + .long 1017763871 + .long 637726976 + .long 1069018648 + .long 3584007699 + .long 1017976868 + .long 1148779264 + .long 1069083589 + .long 2282532133 + .long 1019483954 + .long 1406131392 + .long 1069148481 + .long 1547359113 + .long 1019786342 + .long 1908875904 + .long 1069213322 + .long 1315508410 + .long 1020009473 + .long 3194947520 + .long 1069278110 + .long 3845393201 + .long 1015803761 + .long 1547487744 + .long 1069342844 + .long 3863107865 + .long 1019810104 + .long 1881061952 + .long 1069407521 + .long 4288343548 + .long 1019687581 + .long 563086336 + .long 1069472140 + .long 2582230241 + .long 1020099350 + .long 2594975552 + .long 1069536698 + .long 2306443764 + .long 1019667244 + .long 3438545024 + .long 1069606573 + .long 957455549 + .long 1015587735 + .long 4211357472 + .long 1069670906 + .long 2611778754 + .long 1017877214 + .long 3002835424 + .long 1069735101 + .long 235580458 + .long 1020211685 + .long 3905315424 + .long 1069799150 + .long 3630647617 + .long 1018736849 + .long 2849656576 + .long 1069863047 + .long 2412165062 + .long 1019693004 + .long 507429472 + .long 1069926785 + .long 1397750723 + .long 1018412717 + .long 2307470272 + .long 1069990356 + .long 1796470904 + .long 1019796181 + .long 1271814912 + .long 1070053755 + .long 189761565 + .long 1016149115 + .long 3800538144 + .long 1070116974 + .long 2524871582 + .long 1018263353 + .long 3916203552 + .long 1070180008 + .long 127848658 + .long 1017672664 + .long 457192032 + .long 1070242851 + .long 4020400938 + .long 1019823010 + .long 1385324704 + .long 1070305495 + .long 564511179 + .long 1016079094 + .long 2322869856 + .long 1070367935 + .long 2347103319 + .long 1018927760 + .long 3743438624 + .long 1070430165 + .long 877973862 + .long 1019638162 + .long 2392255552 + .long 1070492180 + .long 2432782267 + .long 1018872629 + .long 4180443328 + .long 1070553973 + .long 3102990015 + .long 1020093101 + .long 2547540832 + .long 1070636485 + .long 3877738253 + .long 1017300424 + .long 2735468912 + .long 1070697461 + .long 2446470256 + .long 1019235378 + .long 542633792 + .long 1070757943 + .long 583606328 + .long 1018624131 + .long 923265984 + .long 1070817911 + .long 1793926708 + .long 1019714161 + .long 918728448 + .long 1070877348 + .long 3726463586 + .long 1019433296 + .long 2572275008 + .long 1070936237 + .long 1845354238 + .long 1019459238 + .long 50974688 + .long 1070994564 + .long 983808064 + .long 1016685418 + .long 1105518320 + .long 1071052313 + .long 2357496692 + .long 1015139882 + .long 1264825328 + .long 1071109472 + .long 2244129354 + .long 1019046344 + .long 961157920 + .long 1071166029 + .long 3124185339 + .long 1018541776 + .long 1162701584 + .long 1071221973 + .long 1279780948 + .long 1019268918 + .long 3284935664 + .long 1071277294 + .long 2670033472 + .long 1019833744 + .long 497441888 + .long 1071331985 + .long 1032737410 + .long 1019795212 + .long 3377383904 + .long 1071386036 + .long 2356897182 + .long 1020205553 + .long 1126962000 + .long 1071439443 + .long 3723724586 + .long 1015212418 + .long 90291008 + .long 1071492199 + .long 4178672431 + .long 1020186971 + .long 190059536 + .long 1071595741 + .long 1763589807 + .long 1019162163 + .long 2497392840 + .long 1071670654 + .long 3036997041 + .long 1020204325 + .long 2616971944 + .long 1071719773 + .long 300151069 + .long 1017041957 + .long 2883518128 + .long 1071767563 + .long 2203981414 + .long 1019190108 + .long 1496354352 + .long 1071814030 + .long 332287966 + .long 1016846435 + .long 483276728 + .long 1071859184 + .long 653845024 + .long 1018830914 + .long 3097401072 + .long 1071903039 + .long 1514746408 + .long 1019278972 + .long 2737217248 + .long 1071945615 + .long 1358845067 + .long 1017268275 + .long 2072577560 + .long 1071986933 + .long 3041024735 + .long 1019929672 + .long 2266405656 + .long 1072027017 + .long 1271261130 + .long 1012925070 + .long 958652544 + .long 1072065894 + .long 2158017058 + .long 1019955372 + .long 3312993840 + .long 1072103591 + .long 765809169 + .long 1019114443 + .long 3177001304 + .long 1072140139 + .long 144180084 + .long 1019822186 + .long 3071642184 + .long 1072175568 + .long 4004602424 + .long 1019420740 + .long 4283953648 + .long 1072209909 + .long 1511950430 + .long 1020176966 + .long 1413754136 + .long 1072243195 + .long 856972295 + .long 1015129638 + .long 4073202944 + .long 1072306725 + .long 4068194804 + .long 1019714860 + .long 946117760 + .long 1072366415 + .long 694980733 + .long 1020150135 + .long 3980632032 + .long 1072422512 + .long 1313251280 + .long 1019948709 + .long 1468297112 + .long 1072475260 + .long 330111143 + .long 1019809198 + .long 3478063816 + .long 1072524887 + .long 2930067044 + .long 1017784081 + .long 1153979856 + .long 1072571613 + .long 2225786102 + .long 1017634481 + .long 2089828808 + .long 1072615641 + .long 474621367 + .long 1017043414 + .long 3531732632 + .long 1072657163 + .long 2276396220 + .long 1018757240 + .long 775214612 + .long 1072694803 + .long 3209744818 + .long 1019963015 + .long 662307284 + .long 1072713319 + .long 1381696763 + .long 1019763781 + .long 1192776652 + .long 1072730830 + .long 3017932994 + .long 1015179769 + .long 744202396 + .long 1072747407 + .long 2073854034 + .long 1019512292 + .long 8337908 + .long 1072763115 + .long 16004448 + .long 1019599514 + .long 3589868768 + .long 1072778013 + .long 1374369804 + .long 1018019237 + .long 121647320 + .long 1072792159 + .long 128481634 + .long 1018115438 + .long 2464923204 + .long 1072805601 + .long 1787331214 + .long 1016798022 + .long 4093304372 + .long 1072830562 + .long 3306868969 + .long 1019384078 + .long 1436891684 + .long 1072853231 + .long 676347266 + .long 1017302183 + .long 1104571840 + .long 1072873890 + .long 2870400285 + .long 1019938149 + .long 2037009832 + .long 1072892781 + .long 2956702105 + .long 1016472908 + .long 3139037960 + .long 1072910111 + .long 916057147 + .long 1018364335 + .long 1826698064 + .long 1072926058 + .long 2171961098 + .long 1019669816 + .long 1353941060 + .long 1072940774 + .long 1722928782 + .long 1019926215 + .long 1803191644 + .long 1072954391 + .long 1547878639 + .long 1020259262 + .long 1092591296 + .long 1072967024 + .long 3070107923 + .long 1018320401 + .long 2205372832 + .long 1072978772 + .long 787328196 + .long 1014621351 + .long 1291577100 + .long 1072989723 + .long 2964757301 + .long 1020242528 + .long 4234512804 + .long 1072999952 + .long 3136030038 + .long 1017522144 + .long 3248069132 + .long 1073009528 + .long 1506192355 + .long 1018050472 + .long 3932628500 + .long 1073018509 + .long 1045823554 + .long 1019946655 + .long 4195697848 + .long 1073026948 + .long 233443322 + .long 1018917447 + .long 2501811452 + .long 1073034892 + .long 901427976 + .long 1017333852 + .long 866379428 + .long 1073049455 + .long 2437443742 + .long 1019678792 + .long 1376865888 + .long 1073062480 + .long 3365790232 + .long 1014547152 + .long 3290094268 + .long 1073074195 + .long 3898947415 + .long 1018683566 + .long 354764884 + .long 1073084787 + .long 3854322404 + .long 1019662058 + .long 3332975496 + .long 1073094406 + .long 3171701655 + .long 1017830922 + .long 1141460088 + .long 1073103181 + .long 3946082701 + .long 1020032019 + .long 745761284 + .long 1073111216 + .long 1347210591 + .long 1019106121 + .long 1673304508 + .long 1073118600 + .long 1760606642 + .long 1017324577 + .long 983388240 + .long 1073125409 + .long 3740651204 + .long 1019514104 + .long 3895509100 + .long 1073131706 + .long 2409629983 + .long 1020069322 + .long 2128523668 + .long 1073137548 + .long 3045605368 + .long 1018579174 + .long 2075485692 + .long 1073142981 + .long 3720571789 + .long 1017557436 + .long 121855976 + .long 1073148047 + .long 2391744767 + .long 1020160645 + .long 4181733780 + .long 1073152780 + .long 995028816 + .long 1019681295 + .long 2887813280 + .long 1073157214 + .long 218733247 + .long 1020003509 + .long 2862180896 + .long 1073161375 + .long 2043806490 + .long 1018602288 + .long 3909375184 + .long 1073168973 + .long 1559903412 + .long 1020103444 + .long 3533966292 + .long 1073175738 + .long 734884149 + .long 1018462962 + .long 3815044608 + .long 1073181799 + .long 3630523428 + .long 1017250093 + .long 739639376 + .long 1073187261 + .long 4167476661 + .long 1020008277 + .long 1068309648 + .long 1073192207 + .long 2110061437 + .long 1019295858 + .long 2350566352 + .long 1073196707 + .long 582596516 + .long 1018568821 + .long 2529520024 + .long 1073200819 + .long 745552787 + .long 1019053165 + .long 1841667508 + .long 1073204591 + .long 3982568700 + .long 1016503327 + .long 2242261080 + .long 1073208063 + .long 3433582258 + .long 1016196763 + .long 715134328 + .long 1073211270 + .long 355901358 + .long 1020087916 + .long 2700735876 + .long 1073214240 + .long 3640957736 + .long 1019780205 + .long 141607580 + .long 1073217000 + .long 2488245051 + .long 1020262395 + .long 287934404 + .long 1073219570 + .long 2392691085 + .long 1019883292 + .long 2363373988 + .long 1073221969 + .long 4194561737 + .long 1019237447 + .long 3829340424 + .long 1073224214 + .long 429455526 + .long 1019490975 + .long 1988805928 + .long 1073226320 + .long 3029848706 + .long 1018104889 + .long 1647572320 + .long 1073230161 + .long 10289938 + .long 1017394880 + .long 3988000624 + .long 1073233576 + .long 1957559169 + .long 1019434816 + .long 4263843944 + .long 1073236633 + .long 204710264 + .long 1019908761 + .long 663197724 + .long 1073239386 + .long 1921757578 + .long 1019778948 + .long 3560800700 + .long 1073241876 + .long 3994348896 + .long 1019230192 + .long 2441785656 + .long 1073244141 + .long 871468611 + .long 1014800505 + .long 3277400272 + .long 1073246209 + .long 4092218139 + .long 1020040842 + .long 3951990120 + .long 1073248105 + .long 4276546478 + .long 1019763677 + .long 2737338540 + .long 1073249850 + .long 252776012 + .long 1018794951 + .long 1511361316 + .long 1073251461 + .long 3119653999 + .long 1018514803 + .long 3969162516 + .long 1073252952 + .long 1037069016 + .long 1016792900 + .long 413985240 + .long 1073254338 + .long 4110171432 + .long 1020001345 + .long 3681283576 + .long 1073255627 + .long 1463092818 + .long 1020260354 + .long 3146455488 + .long 1073256831 + .long 1031209123 + .long 1016554799 + .long 95214512 + .long 1073257958 + .long 1373808632 + .long 1019493031 + .long 4250240828 + .long 1073259013 + .long 3891047882 + .long 1020108730 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .type ATAN_TBL,@object + .size ATAN_TBL,2624 + .align 16 +P_TBL2: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 856972295 + .long 1017226790 + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 3164710438 + .long 1413754136 + .long 3221823995 + .type P_TBL2,@object + .size P_TBL2,64 + .align 16 +SELECT_B: + .long 0 + .long 0 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .type SELECT_B,@object + .size SELECT_B,64 + .align 16 +SGNMASK: + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .type SGNMASK,@object + .size SGNMASK,16 + .align 16 +pi_table: + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 1017226790 + .type pi_table,@object + .size pi_table,16 + .align 16 +pi2_table: + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .type pi2_table,@object + .size pi2_table,16 + .align 16 +pi4_table: + .long 1413754136 + .long 1072243195 + .long 856972295 + .long 1015129638 + .type pi4_table,@object + .size pi4_table,16 + .align 4 +POW55: + .long 0 + .long 1130364928 + .type POW55,@object + .size POW55,8 + .align 4 +INVEXPMASK: + .long 4294967295 + .long 2148532223 + .type INVEXPMASK,@object + .size INVEXPMASK,8 + .align 4 +EXPMASK: + .long 0 + .long 1072693248 + .type EXPMASK,@object + .size EXPMASK,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atan2dl.S b/external/sgx_libm/intel64/atan2dl.S new file mode 100644 index 0000000000..84cc078f5d --- /dev/null +++ b/external/sgx_libm/intel64/atan2dl.S @@ -0,0 +1,1433 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2dl.c" + .text +..TXTST0: +# -- Begin atand2l + .text + .align 16,0x90 + .globl atand2l +atand2l: +# parameter 1: 8 + %rsp +# parameter 2: 24 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_atand2l.1: +..L2: + + fldt 8(%rsp) + fldt 24(%rsp) + fstpt 24(%rsp) + fstpt 8(%rsp) + jmp atan2dl@PLT + .align 16,0x90 + .cfi_endproc + .type atand2l,@function + .size atand2l,.-atand2l + .data +# -- End atand2l + .text +# -- Begin atan2dl + .text + .align 16,0x90 + .globl atan2dl +atan2dl: +# parameter 1: 96 + %rsp +# parameter 2: 112 + %rsp +..B2.1: + .cfi_startproc +..___tag_value_atan2dl.4: +..L5: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %dl, %dl +..B2.2: + fnstcw 74(%rsp) +..B2.3: + movzbl 105(%rsp), %r8d + andl $128, %r8d + movzbl 121(%rsp), %eax + movzwl 104(%rsp), %esi + andl $128, %eax + andl $32767, %esi + shrl $7, %r8d + movzwl 120(%rsp), %edi + movl %r8d, %r9d + shrl $7, %eax + andl $32767, %edi + cmpl $32767, %esi + je ..B2.105 +..B2.4: + cmpl $32767, %edi + je ..B2.88 +..B2.5: + testl %esi, %esi + jne ..B2.7 +..B2.6: + cmpq $0, 96(%rsp) + je ..B2.11 +..B2.7: + testl %edi, %edi + jne ..B2.23 +..B2.8: + cmpq $0, 112(%rsp) + jne ..B2.23 +..B2.9: + testl %esi, %esi + jne ..B2.22 +..B2.10: + cmpq $0, 96(%rsp) + jne ..B2.18 +..B2.11: + testl %edi, %edi + jne ..B2.14 +..B2.12: + cmpq $0, 112(%rsp) + je ..B2.83 +..B2.13: + lea _smallest_value_64(%rip), %rdx + movq (%rdx), %rcx + movq %rcx, 48(%rsp) +..B2.14: + testl %eax, %eax + je ..B2.16 +..B2.15: + lea c180(%rip), %rax + fldl (%rax,%r9,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.16: + lea _zeros(%rip), %rax + fldl (%rax,%r9,8) +..B2.17: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.18: + testl %edi, %edi + jne ..B2.23 +..B2.19: + cmpq $0, 112(%rsp) + jne ..B2.23 +..B2.20: + testl %esi, %esi + jne ..B2.22 +..B2.21: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 48(%rsp) +..B2.22: + lea c90(%rip), %rax + fldl (%rax,%r9,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.23: + cmpl %esi, %edi + jne ..B2.29 +..B2.24: + movl 116(%rsp), %ecx + cmpl 100(%rsp), %ecx + jne ..B2.29 +..B2.25: + movl 112(%rsp), %ecx + cmpl 96(%rsp), %ecx + jne ..B2.29 +..B2.26: + orl %esi, %edi + jne ..B2.28 +..B2.27: + lea _smallest_value_64(%rip), %rdx + movq (%rdx), %rcx + movq %rcx, 48(%rsp) +..B2.28: + movl %eax, %eax + lea exact(%rip), %rdx + lea (%r9,%rax,2), %rcx + fldl (%rdx,%rcx,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.29: + movzwl 74(%rsp), %r10d + movl %r10d, %ecx + andl $3840, %ecx + cmpl $768, %ecx + je ..B2.33 +..B2.30: + andl $-3841, %r10d + orl $-64768, %r10d + movw %r10w, 72(%rsp) +..B2.31: + fldcw 72(%rsp) +..B2.32: + movb $1, %dl +..B2.33: + cmpl $8191, %edi + jg ..B2.37 +..B2.34: + cmpl $8191, %esi + jg ..B2.36 +..B2.35: + fldt 112(%rsp) + lea _TWO_8192(%rip), %rcx + fldt 96(%rsp) + fldt (%rcx) + fmul %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + movzwl 120(%rsp), %edi + movzwl 104(%rsp), %esi + andl $32767, %edi + andl $32767, %esi + jmp ..B2.38 +..B2.36: + fldt 112(%rsp) + fldt 96(%rsp) + jmp ..B2.41 +..B2.37: + fldt 112(%rsp) + fldt 96(%rsp) +..B2.38: + cmpl $24575, %edi + jl ..B2.41 +..B2.39: + cmpl $24575, %esi + jl ..B2.41 +..B2.40: + lea 16+_TWO_8192(%rip), %rcx + fldt (%rcx) + fmul %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + movzwl 120(%rsp), %edi + movzwl 104(%rsp), %esi + andl $32767, %edi + andl $32767, %esi +..B2.41: + lea _ones(%rip), %rcx + fldl (%rcx,%rax,8) + fmulp %st, %st(2) + fld %st(0) + fldl (%rcx,%r9,8) + fmul %st, %st(1) + fxch %st(3) + fcomi %st(1), %st + jbe ..B2.69 +..B2.42: + lea 12(%rsi), %r10d + cmpl %r10d, %edi + jle ..B2.65 +..B2.43: + lea 75(%rsi), %r10d + cmpl %r10d, %edi + jle ..B2.62 +..B2.44: + fstp %st(0) + fstp %st(0) + fstp %st(1) + testl %eax, %eax + je ..B2.46 +..B2.45: + fstp %st(0) + movq %r9, %rcx + lea _small_value_80(%rip), %rax + shlq $4, %rcx + lea c180(%rip), %rsi + fldt (%rax,%rcx) + fsubrl (%rsi,%r9,8) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.46: + testl %esi, %esi + jle ..B2.87 +..B2.47: + fstp %st(0) + xorl %esi, %esi +..B2.48: + shll $15, %eax + orl $-49153, %eax + movw %ax, 120(%rsp) + lea _TWO_32H(%rip), %rax + fldt 112(%rsp) + fld %st(0) + fld %st(1) + fld %st(2) + fxch %st(3) + fstpt 32(%rsp) + fldt 32(%rsp) + fldl (%rax) + fmul %st, %st(3) + shll $15, %r8d + fxch %st(2) + fsubr %st(3), %st + movzwl 104(%rsp), %r9d + orl $-49153, %r8d + movw %r8w, 104(%rsp) + lea 8+_C180byPi(%rip), %r8 + andl $32767, %r9d + fsubrp %st, %st(3) + subl %r9d, %edi + fxch %st(2) + fsubr %st, %st(3) + fld %st(1) + cmpl $16382, %edi + fldl (%rcx) + lea _C180byPi(%rip), %rcx + fld %st(0) + fdivp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fld %st(0) + fsub %st(5), %st + fsubrp %st, %st(1) + fld %st(0) + fsubr %st(5), %st + fld %st(3) + fmul %st(1), %st + fxch %st(6) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(6) + fxch %st(1) + fmul %st, %st(3) + fxch %st(2) + fsub %st, %st(3) + fxch %st(5) + fsubrp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fldl (%rcx) + fmul %st, %st(1) + fmulp %st, %st(2) + fldl (%r8) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldt 96(%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(1) + fsubr %st(1), %st + fsubrp %st, %st(1) + fxch %st(3) + fmul %st(5), %st + fld %st(0) + fsub %st(6), %st + fsubrp %st, %st(1) + fsubr %st, %st(5) + fxch %st(2) + faddp %st, %st(5) + fmul %st, %st(4) + fld %st(0) + fsub %st(3), %st + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(5) + faddp %st, %st(3) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(5), %st + fsubr %st, %st(1) + fxch %st(1) + fchs + fsubrp %st, %st(1) + fstpt 56(%rsp) + fldt 56(%rsp) + fsubrp %st, %st(4) + fxch %st(3) + fstpt 16(%rsp) + fldt 16(%rsp) + faddp %st, %st(1) + jl ..B2.52 +..B2.49: + fldt 56(%rsp) + lea _small(%rip), %rax + addl $-16318, %edi + cmpl $16382, %edi + fldt (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt 56(%rsp) + fmul %st, %st(1) + jl ..B2.51 +..B2.50: + fldt 56(%rsp) + addl $-16318, %edi + fmul %st(1), %st + fstpt 56(%rsp) + fldt 56(%rsp) + fstpt (%rsp) + fmulp %st, %st(1) + jmp ..B2.53 +..B2.51: + fstp %st(0) + fldt 56(%rsp) + fstpt (%rsp) + jmp ..B2.53 +..B2.52: + fldt 56(%rsp) + fstpt (%rsp) +..B2.53: + movl %edi, %eax + negl %eax + addl $16383, %eax + fxch %st(1) + fstpt 16(%rsp) + testl %esi, %esi + movw %ax, 24(%rsp) + je ..B2.55 +..B2.54: + fldt 16(%rsp) + lea 8+_two64(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) + fldt 16(%rsp) + jmp ..B2.56 +..B2.55: + fldt 16(%rsp) +..B2.56: + movzwl 8(%rsp), %eax + andl $32767, %eax + subl %esi, %eax + subl %edi, %eax + cmpl $-9, %eax + jl ..B2.59 +..B2.57: + testl %eax, %eax + jg ..B2.59 +..B2.58: + fldt 56(%rsp) + fmul %st(1), %st + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 56(%rsp) + jmp ..B2.60 +..B2.59: + fldt 56(%rsp) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 56(%rsp) +..B2.60: + fldt 56(%rsp) + lea _zeros(%rip), %rax + fldl (%rax) + fxch %st(1) + fucomip %st(1), %st + jp ..B2.113 + je ..B2.61 +..B2.113: + fstp %st(0) + fstp %st(0) + jmp ..B2.80 +..B2.61: + fldt 32(%rsp) + fdivrp %st, %st(2) + fmulp %st, %st(1) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.62: + fstp %st(2) + testl %eax, %eax + je ..B2.64 +..B2.63: + fdivp %st, %st(1) + lea _TWO_32H(%rip), %rax + lea _C180byPi(%rip), %rcx + lea 8+_C180byPi(%rip), %rsi + lea 48+_P(%rip), %rdi + lea 16+_P(%rip), %r8 + lea 32+_P(%rip), %r9 + lea _P(%rip), %r10 + movq __libm_atandl_table_128@GOTPCREL(%rip), %r11 + fstpt 112(%rsp) + fldt 112(%rsp) + fldl (%rax) + fmul %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(2) + fmul %st(3), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl (%rcx) + fmul %st, %st(4) + fmulp %st, %st(3) + fldl (%rsi) + fmul %st(5), %st + faddp %st, %st(3) + fldt (%rdi) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + fmulp %st, %st(3) + fldt (%r10) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fsubrl 8200(%r11) + faddl 8192(%r11) + fmulp %st, %st(1) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.64: + fld %st(0) + lea 48+_P(%rip), %rax + lea 16+_P(%rip), %rsi + lea 32+_P(%rip), %rdi + lea _P(%rip), %r8 + lea _TWO_32H(%rip), %r9 + lea _C180byPi(%rip), %r10 + lea 8+_C180byPi(%rip), %r11 + fdiv %st(2), %st + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(5) + fstpl 32(%rsp) + fldt (%rax) + fmul %st(5), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rdi) + fmulp %st, %st(6) + fldt (%r8) + faddp %st, %st(6) + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fmulp %st, %st(3) + fxch %st(2) + fstpt (%rsp) + fld %st(0) + fld %st(2) + fld %st(2) + fld %st(4) + fldl (%r9) + fmul %st, %st(4) + fxch %st(2) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fsubr %st, %st(4) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(4) + fsub %st(3), %st + fld %st(2) + fxch %st(6) + fmull (%r11) + fldl (%r10) + fmul %st, %st(5) + fxch %st(5) + fmul %st, %st(7) + fxch %st(5) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(4) + fadd %st(2), %st + fld %st(4) + fadd %st(7), %st + fsubp %st, %st(7) + fxch %st(4) + fsub %st(6), %st + faddp %st, %st(1) + fxch %st(3) + fdivrl (%rcx) + fmul %st, %st(2) + lea 8+_ones(%rip), %rcx + fld %st(2) + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fld %st(2) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(2) + fxch %st(2) + fmul %st(3), %st + fldt (%rsp) + fxch %st(1) + faddl (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + fsubrp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fxch %st(3) + fadd %st(5), %st + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmull 32(%rsp) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.65: + fstp %st(2) + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rsi + fmul %st(1), %st + lea _TWO_48H(%rip), %rdi + fdiv %st(2), %st + fld %st(1) + fxch %st(4) + fstpl 32(%rsp) + fld %st(2) + fldl (%rsi) + lea _C180byPi(%rip), %r8 + lea 8+_C180byPi(%rip), %r9 + lea 48+_P(%rip), %r10 + lea 16+_P(%rip), %r11 + fadd %st, %st(2) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(2) + fld %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(3) + fld %st(3) + fldl (%rdi) + lea _P(%rip), %rdi + fmul %st, %st(7) + movl 16(%rsp), %esi + fxch %st(1) + fadd %st(7), %st + addl %esi, %esi + fsubp %st, %st(7) + testl %eax, %eax + fxch %st(4) + fsub %st(6), %st + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(5) + fxch %st(2) + fadd %st(5), %st + fld %st(6) + fmul %st(4), %st + fadd %st(3), %st + fxch %st(4) + fmul %st, %st(6) + fxch %st(6) + fsubrp %st, %st(2) + fld %st(3) + fadd %st(1), %st + fxch %st(3) + fmulp %st, %st(6) + fxch %st(5) + fsubrp %st, %st(6) + fld %st(2) + fxch %st(2) + fdivrl (%rcx) + fmul %st, %st(4) + lea 8+_ones(%rip), %rcx + fld %st(4) + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(5) + fld %st(4) + fsubr %st(1), %st + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(3) + fxch %st(3) + fmul %st(4), %st + faddl (%rcx) + lea 32+_P(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(1) + fmul %st(3), %st + fxch %st(3) + fadd %st(4), %st + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fld %st(2) + fxch %st(4) + fmulp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fadd %st(2), %st + fmul %st, %st(4) + fld %st(3) + fmul %st(3), %st + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(4) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl (%r8) + fmul %st, %st(3) + fmulp %st, %st(4) + fldl (%r9) + fmul %st(5), %st + faddp %st, %st(4) + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + fmulp %st, %st(3) + fldt (%rdi) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldl 32(%rsp) + je ..B2.67 +..B2.66: + negl %esi + fld %st(2) + movslq %esi, %rsi + movq __libm_atandl_table_128@GOTPCREL(%rip), %rax + fldl 8192(%rax,%rsi,8) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fldl 8200(%rax,%rsi,8) + fsubp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 56(%rsp) + jmp ..B2.68 +..B2.67: + movslq %esi, %rsi + fld %st(2) + movq __libm_atandl_table_128@GOTPCREL(%rip), %rax + fldl (%rax,%rsi,8) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 8(%rax,%rsi,8) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 56(%rsp) +..B2.68: + fldt 56(%rsp) + fmulp %st, %st(1) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.69: + fstp %st(2) + lea 12(%rdi), %r8d + cmpl %r8d, %esi + jle ..B2.76 +..B2.70: + addl $75, %edi + cmpl %edi, %esi + jle ..B2.72 +..B2.71: + fstp %st(1) + fstp %st(0) + fstp %st(0) + movq %r9, %rcx + lea _small_value_80(%rip), %rax + shlq $4, %rcx + lea c90(%rip), %rsi + fldt (%rax,%rcx) + fsubrl (%rsi,%r9,8) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.72: + fdivrp %st, %st(1) + lea _TWO_32H(%rip), %rcx + lea _C180byPi(%rip), %rsi + lea 8+_C180byPi(%rip), %rdi + lea 48+_P(%rip), %r8 + lea 16+_P(%rip), %r9 + lea 32+_P(%rip), %r10 + lea _P(%rip), %r11 + fstpt 112(%rsp) + fldt 112(%rsp) + testl %eax, %eax + fldl (%rcx) + fmul %st(1), %st + fld %st(0) + movq __libm_atandl_table_128@GOTPCREL(%rip), %rcx + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(2) + fmul %st(3), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl (%rsi) + fmul %st, %st(4) + fmulp %st, %st(3) + fldl (%rdi) + fmul %st(5), %st + faddp %st, %st(3) + fldt (%r8) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + fmulp %st, %st(3) + fldt (%r11) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldl 4096(%rcx) + fstpt 56(%rsp) + fldl 4104(%rcx) + je ..B2.74 +..B2.73: + fldt 56(%rsp) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 56(%rsp) + jmp ..B2.75 +..B2.74: + fldt 56(%rsp) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 56(%rsp) +..B2.75: + fldt 56(%rsp) + fmulp %st, %st(1) + fstpt 56(%rsp) + jmp ..B2.80 +..B2.76: + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rsi + fmul %st(2), %st + lea _TWO_48H(%rip), %rdi + fdiv %st(1), %st + fld %st(2) + fxch %st(4) + fstpl 32(%rsp) + fld %st(1) + fldl (%rsi) + lea _C180byPi(%rip), %r8 + lea 8+_C180byPi(%rip), %r9 + lea 48+_P(%rip), %r10 + lea 16+_P(%rip), %r11 + fadd %st, %st(2) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(2) + fld %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(3) + fld %st(3) + fldl (%rdi) + lea _P(%rip), %rdi + fmul %st, %st(7) + movl 16(%rsp), %esi + fxch %st(2) + fadd %st(7), %st + addl %esi, %esi + fsubp %st, %st(7) + fld %st(6) + testl %eax, %eax + fmul %st(4), %st + fxch %st(6) + fsub %st(7), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fld %st(1) + fmul %st(4), %st + fadd %st(5), %st + fxch %st(4) + fmul %st, %st(5) + fxch %st(5) + fsubrp %st, %st(2) + fmul %st, %st(4) + fxch %st(4) + fsubrp %st, %st(6) + fxch %st(3) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fld %st(4) + fxch %st(1) + fdivrl (%rcx) + lea 8+_ones(%rip), %rcx + fmul %st, %st(2) + fld %st(2) + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddl (%rcx) + lea 32+_P(%rip), %rcx + faddp %st, %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fadd %st(4), %st + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fld %st(1) + fxch %st(4) + fmulp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fadd %st(3), %st + fmul %st, %st(4) + fld %st(2) + fmul %st(4), %st + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(4) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl (%r8) + fmul %st, %st(4) + fmulp %st, %st(3) + fldl (%r9) + fmul %st(5), %st + faddp %st, %st(3) + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + fmulp %st, %st(3) + fldt (%rdi) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fldl 32(%rsp) + je ..B2.78 +..B2.77: + movslq %esi, %rsi + fld %st(1) + movq __libm_atandl_table_128@GOTPCREL(%rip), %rax + fldl 4096(%rax,%rsi,8) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(3) + faddl 4104(%rax,%rsi,8) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 56(%rsp) + jmp ..B2.79 +..B2.78: + negl %esi + fld %st(1) + movslq %esi, %rsi + movq __libm_atandl_table_128@GOTPCREL(%rip), %rax + fldl 4096(%rax,%rsi,8) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(3) + fldl 4104(%rax,%rsi,8) + fsubp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 56(%rsp) +..B2.79: + fldt 56(%rsp) + fmulp %st, %st(1) + fstpt 56(%rsp) +..B2.80: + testb %dl, %dl + je ..B2.82 +..B2.81: + fldcw 74(%rsp) +..B2.82: + fldt 56(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.83: + testl %eax, %eax + je ..B2.85 +..B2.84: + lea c180(%rip), %rax + fldl (%rax,%r9,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.85: + lea _zeros(%rip), %rax + fldl (%rax,%r9,8) +..B2.86: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.87: + lea _two64(%rip), %rsi + fldl (%rsi) + movl $64, %esi + fmulp %st, %st(1) + fstpt 96(%rsp) + jmp ..B2.48 +..B2.88: + movq $0x8000000000000000, %rdx + cmpq 112(%rsp), %rdx + je ..B2.90 +..B2.89: + fldt 112(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.90: + testl %esi, %esi + jne ..B2.96 +..B2.91: + cmpl $0, 100(%rsp) + jne ..B2.93 +..B2.92: + cmpl $0, 96(%rsp) + je ..B2.97 +..B2.93: + lea _smallest_value_64(%rip), %rdx + movq (%rdx), %rcx + movq %rcx, 48(%rsp) +..B2.94: + cmpl $32767, %edi + je ..B2.96 +..B2.95: + lea c90(%rip), %rax + fldl (%rax,%r9,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.96: + cmpl $32767, %esi + je ..B2.101 +..B2.97: + testl %eax, %eax + je ..B2.99 +..B2.98: + lea c180(%rip), %rax + fldl (%rax,%r9,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.99: + lea _zeros(%rip), %rax + fldl (%rax,%r9,8) +..B2.100: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.101: + testl %eax, %eax + je ..B2.103 +..B2.102: + lea c135(%rip), %rax + fldl (%rax,%r9,8) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.103: + lea c45(%rip), %rax + fldl (%rax,%r9,8) +..B2.104: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.105: + movq $0x8000000000000000, %rdx + cmpq 96(%rsp), %rdx + jne ..B2.89 +..B2.106: + cmpl $32767, %edi + je ..B2.88 +..B2.107: + testl %edi, %edi + jne ..B2.94 +..B2.108: + cmpl $0, 116(%rsp) + jne ..B2.93 +..B2.109: + cmpl $0, 112(%rsp) + jne ..B2.93 + jmp ..B2.95 + .align 16,0x90 + .cfi_endproc + .type atan2dl,@function + .size atan2dl,.-atan2dl + .data +# -- End atan2dl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x80,0x13,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_TWO_8192: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _TWO_8192,@object + .size _TWO_8192,32 + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_C180byPi: + .long 442499072 + .long 1078765020 + .long 3272251219 + .long 1042157501 + .type _C180byPi,@object + .size _C180byPi,16 + .align 16 +_small: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 65 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32769 + .word 0 + .word 0 + .word 0 + .type _small,@object + .size _small,32 + .align 16 +_two64: + .long 0 + .long 1139802112 + .long 0 + .long 1005584384 + .type _two64,@object + .size _two64,16 + .align 16 +_P: + .word 54228 + .word 26975 + .word 60215 + .word 39113 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 30637 + .word 6142 + .word 46044 + .word 46936 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 47408 + .word 26349 + .word 14153 + .word 33526 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 53934 + .word 32714 + .word 35699 + .word 52145 + .word 16385 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,64 + .align 16 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .space 8, 0x00 # pad + .align 16 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 8 +c180: + .long 0x00000000,0x40668000 + .long 0x00000000,0xc0668000 + .type c180,@object + .size c180,16 + .align 8 +c90: + .long 0x00000000,0x40568000 + .long 0x00000000,0xc0568000 + .type c90,@object + .size c90,16 + .align 8 +exact: + .long 0x00000000,0x40468000 + .long 0x00000000,0xc0468000 + .long 0x00000000,0x4060e000 + .long 0x00000000,0xc060e000 + .type exact,@object + .size exact,32 + .align 8 +c135: + .long 0x00000000,0x4060e000 + .long 0x00000000,0xc060e000 + .type c135,@object + .size c135,16 + .align 8 +c45: + .long 0x00000000,0x40468000 + .long 0x00000000,0xc0468000 + .type c45,@object + .size c45,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atan2f_gen.S b/external/sgx_libm/intel64/atan2f_gen.S new file mode 100644 index 0000000000..72d4155595 --- /dev/null +++ b/external/sgx_libm/intel64/atan2f_gen.S @@ -0,0 +1,556 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2f_gen.c" + .text +..TXTST0: +# -- Begin atan2f + .text + .align 16,0x90 + .globl atan2f +atan2f: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_atan2f.1: +..L2: + + movd %xmm0, %esi + movd %xmm1, %ecx + movss %xmm0, -16(%rsp) + movss %xmm1, -8(%rsp) + movl %esi, %edi + movl %esi, %eax + movl %ecx, %edx + movl %ecx, %r8d + andl $2147483647, %edi + andl $2147483647, %r8d + shrl $31, %eax + shrl $31, %edx + movl %ecx, -24(%rsp) + cmpl $2139095040, %edi + movl %esi, -24(%rsp) + jl ..B1.3 +..B1.2: + jg ..B1.16 +..B1.52: + cmpl $2139095040, %r8d + jg ..B1.16 + jmp ..B1.5 +..B1.3: + cmpl $2139095040, %r8d + jl ..B1.17 +..B1.4: + jg ..B1.16 +..B1.5: + jl ..B1.15 +..B1.6: + movl %eax, %eax + cmpl $2139095040, %edi + jge ..B1.11 +..B1.7: + testl %edx, %edx + je ..B1.9 +..B1.8: + lea pi(%rip), %rdx + lea _small_value_64(%rip), %rcx + movsd (%rdx,%rax,8), %xmm0 + addsd (%rcx,%rax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.9: + lea _zeros(%rip), %rdx + movss (%rdx,%rax,4), %xmm0 +..B1.10: + ret +..B1.11: + lea _small_value_64(%rip), %rcx + testl %edx, %edx + movsd (%rcx,%rax,8), %xmm1 + je ..B1.13 +..B1.12: + lea pi34(%rip), %rdx + movsd (%rdx,%rax,8), %xmm0 + addsd %xmm1, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.13: + lea pi4(%rip), %rdx + movsd (%rdx,%rax,8), %xmm0 + addsd %xmm1, %xmm0 + cvtsd2ss %xmm0, %xmm0 +..B1.14: + ret +..B1.15: + movl %eax, %eax + lea pi2(%rip), %rdx + lea _small_value_64(%rip), %rcx + movsd (%rdx,%rax,8), %xmm0 + addsd (%rcx,%rax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.16: + movss -8(%rsp), %xmm0 + mulss -16(%rsp), %xmm0 + ret +..B1.17: + testl %r8d, %edi + jne ..B1.25 +..B1.18: + testl %edi, %edi + jne ..B1.24 +..B1.19: + movl %eax, %eax + testl %r8d, %r8d + je ..B1.45 +..B1.20: + testl %edx, %edx + je ..B1.22 +..B1.21: + lea pi(%rip), %rdx + lea _small_value_64(%rip), %rcx + movsd (%rdx,%rax,8), %xmm0 + addsd (%rcx,%rax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.22: + lea _zeros(%rip), %rdx + movss (%rdx,%rax,4), %xmm0 +..B1.23: + ret +..B1.24: + testl %r8d, %r8d + je ..B1.49 +..B1.25: + pxor %xmm0, %xmm0 + pxor %xmm5, %xmm5 + cvtss2sd -16(%rsp), %xmm0 + cvtss2sd -8(%rsp), %xmm5 + movsd %xmm0, -40(%rsp) + movsd %xmm5, -32(%rsp) + movl -36(%rsp), %edi + movl -28(%rsp), %esi + andl $2147483647, %edi + andl $2147483647, %esi + cmpl %esi, %edi + jl ..B1.32 +..B1.26: + lea 1048576(%rsi), %ecx + cmpl %ecx, %edi + jle ..B1.31 +..B1.27: + movl %eax, %eax + lea pi2(%rip), %rdx + addl $33554432, %esi + cmpl %esi, %edi + movsd (%rdx,%rax,8), %xmm4 + jle ..B1.29 +..B1.28: + divsd %xmm0, %xmm5 + subsd %xmm5, %xmm4 + cvtsd2ss %xmm4, %xmm4 + jmp ..B1.30 +..B1.29: + divsd %xmm0, %xmm5 + movaps %xmm5, %xmm1 + subsd %xmm5, %xmm4 + mulsd %xmm5, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm3 + movsd .L_2il0floatpacket.10(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.7(%rip), %xmm3 + addsd .L_2il0floatpacket.11(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.8(%rip), %xmm3 + addsd .L_2il0floatpacket.12(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.9(%rip), %xmm3 + addsd .L_2il0floatpacket.13(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm3 + mulsd %xmm3, %xmm5 + subsd %xmm5, %xmm4 + cvtsd2ss %xmm4, %xmm4 +..B1.30: + movaps %xmm4, %xmm0 + ret +..B1.31: + movl %eax, %eax + lea _ones(%rip), %rcx + movl %edx, %edx + pxor %xmm1, %xmm1 + pxor %xmm2, %xmm2 + lea pi4n(%rip), %rsi + movsd .L_2il0floatpacket.3(%rip), %xmm4 + cmpl %eax, %edx + cvtss2sd (%rcx,%rax,4), %xmm1 + cvtss2sd (%rcx,%rdx,4), %xmm2 + mulsd %xmm1, %xmm0 + mulsd %xmm2, %xmm5 + movaps %xmm0, %xmm6 + addsd %xmm5, %xmm0 + subsd %xmm5, %xmm6 + divsd %xmm0, %xmm6 + movaps %xmm6, %xmm0 + mulsd %xmm6, %xmm0 + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movsd .L_2il0floatpacket.0(%rip), %xmm5 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm4 + addsd .L_2il0floatpacket.1(%rip), %xmm5 + addsd .L_2il0floatpacket.4(%rip), %xmm4 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm4 + addsd .L_2il0floatpacket.2(%rip), %xmm5 + addsd .L_2il0floatpacket.5(%rip), %xmm4 + mulsd %xmm0, %xmm5 + addsd %xmm4, %xmm5 + mulsd %xmm5, %xmm6 + addsd (%rsi,%rdx,8), %xmm6 + movaps %xmm6, %xmm0 + xorps .L_2il0floatpacket.15(%rip), %xmm0 + jne ..L3 + movaps %xmm6, %xmm0 +..L3: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.32: + lea 1048576(%rdi), %ecx + cmpl %ecx, %esi + jle ..B1.44 +..B1.33: + addl $33554432, %edi + cmpl %edi, %esi + jle ..B1.40 +..B1.34: + testl %edx, %edx + jne ..B1.39 +..B1.35: + divsd %xmm5, %xmm0 + lea _minnormf(%rip), %rax + movaps %xmm0, %xmm2 + andps .L_2il0floatpacket.16(%rip), %xmm2 + movsd (%rax), %xmm1 + comisd %xmm2, %xmm1 + jbe ..B1.37 +..B1.36: + movss .L_2il0floatpacket.14(%rip), %xmm1 + mulss %xmm1, %xmm1 + movss %xmm1, -24(%rsp) + jmp ..B1.38 +..B1.37: + movl $1065353216, -24(%rsp) +..B1.38: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.39: + divsd %xmm5, %xmm0 + movl %eax, %eax + lea pi(%rip), %rdx + addsd (%rdx,%rax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.40: + divsd %xmm5, %xmm0 + movaps %xmm0, %xmm2 + testl %edx, %edx + mulsd %xmm0, %xmm2 + movaps %xmm2, %xmm1 + mulsd %xmm2, %xmm1 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movsd .L_2il0floatpacket.10(%rip), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm1, %xmm3 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + addsd .L_2il0floatpacket.11(%rip), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm1, %xmm3 + addsd .L_2il0floatpacket.8(%rip), %xmm4 + addsd .L_2il0floatpacket.12(%rip), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm1, %xmm3 + addsd .L_2il0floatpacket.9(%rip), %xmm4 + addsd .L_2il0floatpacket.13(%rip), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm4 + mulsd %xmm0, %xmm4 + addsd %xmm4, %xmm0 + je ..B1.42 +..B1.41: + movl %eax, %eax + lea pi(%rip), %rdx + movsd (%rdx,%rax,8), %xmm1 + addsd %xmm1, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.42: + cvtsd2ss %xmm0, %xmm0 +..B1.43: + ret +..B1.44: + movl %eax, %eax + lea _ones(%rip), %rcx + pxor %xmm1, %xmm1 + pxor %xmm2, %xmm2 + lea pi4n(%rip), %rsi + movsd .L_2il0floatpacket.0(%rip), %xmm4 + cmpl %eax, %edx + cvtss2sd (%rcx,%rax,4), %xmm1 + cvtss2sd (%rcx,%rdx,4), %xmm2 + mulsd %xmm1, %xmm0 + mulsd %xmm2, %xmm5 + movaps %xmm0, %xmm6 + addsd %xmm5, %xmm0 + subsd %xmm5, %xmm6 + xorps .L_2il0floatpacket.15(%rip), %xmm6 + divsd %xmm0, %xmm6 + movaps %xmm6, %xmm0 + mulsd %xmm6, %xmm0 + movaps %xmm0, %xmm5 + mulsd %xmm0, %xmm5 + mulsd %xmm5, %xmm4 + movsd .L_2il0floatpacket.3(%rip), %xmm3 + mulsd %xmm5, %xmm3 + addsd .L_2il0floatpacket.1(%rip), %xmm4 + mulsd %xmm5, %xmm4 + addsd .L_2il0floatpacket.4(%rip), %xmm3 + mulsd %xmm5, %xmm3 + addsd .L_2il0floatpacket.2(%rip), %xmm4 + mulsd %xmm0, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm3 + movsd (%rsi,%rdx,8), %xmm7 + addsd %xmm3, %xmm4 + mulsd %xmm4, %xmm6 + subsd %xmm6, %xmm7 + movaps %xmm7, %xmm0 + xorps .L_2il0floatpacket.15(%rip), %xmm0 + jne ..L4 + movaps %xmm7, %xmm0 +..L4: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.45: + testl %edx, %edx + je ..B1.47 +..B1.46: + lea pi(%rip), %rdx + lea _small_value_64(%rip), %rcx + movsd (%rdx,%rax,8), %xmm0 + addsd (%rcx,%rax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.47: + lea _zeros(%rip), %rdx + movss (%rdx,%rax,4), %xmm0 +..B1.48: + ret +..B1.49: + lea pi2(%rip), %rdx + lea _small_value_64(%rip), %rcx + movsd (%rdx,%rax,8), %xmm0 + addsd (%rcx,%rax,8), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type atan2f,@function + .size atan2f,.-atan2f + .data +# -- End atan2f + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.15: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 8 +.L_2il0floatpacket.0: + .long 0xd9d9aa33,0xbfb1c1c0 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x04ba093e,0xbfc24485 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x312dd43c,0xbfd55555 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x947e6edc,0x3fbbcbeb + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x700fa0b3,0x3fc9997b + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0xfff8f7db,0x3fefffff + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xa1fbc9d9,0x3f9a8eb6 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x713e98d0,0x3fb32474 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0xa367efd7,0x3fbc70d3 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x8eac5238,0x3fc99999 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x95b6793b,0xbfac6c73 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x306ebb4b,0xbfb73640 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0xe2eb2ece,0xbfc24920 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x5552abff,0xbfd55555 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +pi: + .long 0x54442d18,0x400921fb + .long 0x54442d18,0xc00921fb + .type pi,@object + .size pi,16 + .align 8 +pi34: + .long 0x7f3321d2,0x4002d97c + .long 0x7f3321d2,0xc002d97c + .type pi34,@object + .size pi34,16 + .align 8 +pi4: + .long 0x54442d18,0x3fe921fb + .long 0x54442d18,0xbfe921fb + .type pi4,@object + .size pi4,16 + .align 8 +pi2: + .long 0x54442d18,0x3ff921fb + .long 0x54442d18,0xbff921fb + .type pi2,@object + .size pi2,16 + .align 8 +pi4n: + .long 0x54442d18,0x3fe921fb + .long 0x7f3321d2,0xc002d97c + .type pi4n,@object + .size pi4n,16 + .align 4 +.L_2il0floatpacket.14: + .long 0x0d800000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,4 + .align 4 +.L_2il0floatpacket.17: + .long 0x3f800000 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,4 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_minnormf: + .long 0 + .long 940572672 + .type _minnormf,@object + .size _minnormf,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atan2l.S b/external/sgx_libm/intel64/atan2l.S new file mode 100644 index 0000000000..f49cbdbfec --- /dev/null +++ b/external/sgx_libm/intel64/atan2l.S @@ -0,0 +1,1202 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan2l.c" + .text +..TXTST0: +# -- Begin atan2l + .text + .align 16,0x90 + .globl atan2l +atan2l: +# parameter 1: 80 + %rsp +# parameter 2: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_atan2l.1: +..L2: + + subq $72, %rsp + .cfi_def_cfa_offset 80 + xorb %r8b, %r8b +..B1.2: + fnstcw 66(%rsp) +..B1.3: + movb 89(%rsp), %al + andb $-128, %al + shrb $7, %al + movb 105(%rsp), %dil + movzbl %al, %esi + andb $-128, %dil + movzwl 88(%rsp), %eax + andl $32767, %eax + movzwl 104(%rsp), %ecx + shrb $7, %dil + andl $32767, %ecx + cmpl $32767, %eax + je ..B1.80 +..B1.4: + cmpl $32767, %ecx + je ..B1.80 +..B1.5: + testl %eax, %eax + jne ..B1.7 +..B1.6: + cmpq $0, 80(%rsp) + je ..B1.9 +..B1.7: + testl %ecx, %ecx + jne ..B1.26 +..B1.8: + cmpq $0, 96(%rsp) + jne ..B1.26 +..B1.9: + movzwl 66(%rsp), %r9d + movl %r9d, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.13 +..B1.10: + orl $-64768, %r9d + movw %r9w, 64(%rsp) +..B1.11: + fldcw 64(%rsp) +..B1.12: + movb $1, %r8b +..B1.13: + testl %eax, %eax + jne ..B1.22 +..B1.14: + cmpq $0, 80(%rsp) + jne ..B1.21 +..B1.15: + testl %ecx, %ecx + jne ..B1.18 +..B1.16: + cmpq $0, 96(%rsp) + je ..B1.77 +..B1.17: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 56(%rsp) +..B1.18: + testb %dil, %dil + je ..B1.20 +..B1.19: + shlq $4, %rsi + lea _pi_00l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.23 +..B1.20: + lea _zeros(%rip), %rax + fldl (%rax,%rsi,8) + fstpt (%rsp) + jmp ..B1.23 +..B1.21: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 56(%rsp) +..B1.22: + shlq $4, %rsi + lea _pi_02l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) +..B1.23: + testb %r8b, %r8b + je ..B1.25 +..B1.24: + fldcw 66(%rsp) +..B1.25: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.26: + movzwl 66(%rsp), %r9d + movl %r9d, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.30 +..B1.27: + orl $-64768, %r9d + movw %r9w, 64(%rsp) +..B1.28: + fldcw 64(%rsp) +..B1.29: + movb $1, %r8b +..B1.30: + cmpl $8191, %ecx + jg ..B1.34 +..B1.31: + cmpl $8191, %eax + jg ..B1.33 +..B1.32: + fldt 96(%rsp) + lea _TWO_8192(%rip), %rax + fldt 80(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + movzwl 104(%rsp), %ecx + movzwl 88(%rsp), %eax + andl $32767, %ecx + fstpt (%rsp) + andl $32767, %eax + jmp ..B1.35 +..B1.33: + fldt 96(%rsp) + fldt 80(%rsp) + fstpt (%rsp) + jmp ..B1.38 +..B1.34: + fldt 96(%rsp) + fldt 80(%rsp) + fstpt (%rsp) +..B1.35: + cmpl $24575, %ecx + jl ..B1.38 +..B1.36: + cmpl $24575, %eax + jl ..B1.38 +..B1.37: + fldt (%rsp) + lea 16+_TWO_8192(%rip), %rax + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + movzwl 104(%rsp), %ecx + movzwl 88(%rsp), %eax + andl $32767, %ecx + fstpt (%rsp) + andl $32767, %eax +..B1.38: + fldt (%rsp) + lea _ones(%rip), %rdx + movzbl %dil, %r9d + fldl (%rdx,%rsi,8) + fmul %st, %st(1) + fldl (%rdx,%r9,8) + fmul %st(3), %st + fcomi %st(2), %st + jbe ..B1.60 +..B1.39: + lea 12(%rax), %r9d + cmpl %r9d, %ecx + jle ..B1.54 +..B1.40: + addl $75, %eax + cmpl %eax, %ecx + jle ..B1.47 +..B1.41: + fstp %st(2) + fstp %st(1) + fstp %st(0) + testb %dil, %dil + je ..B1.43 +..B1.42: + fstp %st(0) + shlq $4, %rsi + lea _pi_00l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.44 +..B1.43: + fldt (%rsp) + fdivp %st, %st(1) + fstpt (%rsp) +..B1.44: + testb %r8b, %r8b + je ..B1.46 +..B1.45: + fldcw 66(%rsp) +..B1.46: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.47: + fstp %st(3) + testb %dil, %dil + je ..B1.51 +..B1.48: + fxch %st(2) + fdivrp %st, %st(1) + lea 48+_P(%rip), %rax + fld %st(0) + lea 32+_P(%rip), %rcx + fmul %st(1), %st + lea 16+_P(%rip), %rdx + fld %st(0) + lea _P(%rip), %rsi + fmul %st(1), %st + testb %r8b, %r8b + movq __libm_atanl_table_128@GOTPCREL(%rip), %rdi + fxch %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rax) + fmul %st(3), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + fmulp %st, %st(4) + fldt (%rsi) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fmul %st, %st(1) + faddp %st, %st(1) + fsubrl 8200(%rdi) + faddl 8192(%rdi) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.50 +..B1.49: + fldcw 66(%rsp) +..B1.50: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.51: + fld %st(1) + lea 48+_P(%rip), %rax + fdiv %st(3), %st + lea 16+_P(%rip), %rcx + fld %st(0) + lea 32+_P(%rip), %rsi + fmul %st(1), %st + lea _P(%rip), %rdi + fxch %st(2) + fstpl 48(%rsp) + fld %st(1) + fmul %st(2), %st + lea _TWO_32H(%rip), %r9 + fldt (%rax) + testb %r8b, %r8b + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fld %st(4) + fldt (%rdi) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 32(%rsp) + fld %st(2) + fld %st(3) + fld %st(3) + fldl (%r9) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(5) + fld %st(5) + fadd %st(1), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(3) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fsubr %st, %st(4) + fld %st(3) + fxch %st(2) + fdivrl (%rdx) + fmul %st, %st(3) + lea 8+_ones(%rip), %rdx + fld %st(3) + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(3) + fxch %st(3) + fmul %st, %st(4) + fld %st(5) + fmul %st(1), %st + fxch %st(2) + fadd %st, %st(6) + fmulp %st, %st(1) + fxch %st(4) + faddl (%rdx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + fsubrp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 32(%rsp) + faddp %st, %st(2) + faddp %st, %st(1) + fmull 48(%rsp) + fstpt (%rsp) + je ..B1.53 +..B1.52: + fldt 16(%rsp) + fstpt 32(%rsp) +..B1.110: + fldcw 66(%rsp) +..B1.53: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.54: + fstp %st(3) + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rax + fmul %st(2), %st + lea _TWO_48H(%rip), %rcx + fdiv %st(3), %st + fld %st(2) + fxch %st(2) + fstpl 48(%rsp) + fld %st(2) + fld %st(4) + fld %st(5) + fldl (%rax) + lea 48+_P(%rip), %rsi + lea 16+_P(%rip), %r9 + lea 32+_P(%rip), %r10 + lea _P(%rip), %r11 + fadd %st, %st(4) + fxch %st(4) + fstpt 32(%rsp) + fldt 32(%rsp) + fsubp %st, %st(4) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(4) + fldl (%rcx) + fmul %st, %st(3) + movslq 32(%rsp), %rax + fxch %st(3) + fadd %st, %st(5) + shlq $4, %rax + fsubrp %st, %st(5) + fld %st(4) + testb %dil, %dil + fmul %st(4), %st + fxch %st(5) + fsubr %st, %st(6) + fxch %st(2) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(6) + fld %st(5) + fmul %st(4), %st + fadd %st(7), %st + fxch %st(4) + fmul %st, %st(7) + fxch %st(7) + fsubrp %st, %st(6) + fmul %st, %st(6) + fxch %st(6) + fsubrp %st, %st(1) + fxch %st(5) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fdivrl (%rdx) + lea 8+_ones(%rip), %rdx + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt (%rsp) + fldt (%rsp) + fsubp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(4) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(4) + fld %st(0) + fmul %st(6), %st + fxch %st(6) + fadd %st(7), %st + fxch %st(7) + fmulp %st, %st(1) + fxch %st(4) + faddl (%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 96(%rsp) + fldt 96(%rsp) + fld %st(1) + fmul %st(3), %st + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rsi) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + fmulp %st, %st(3) + fldt (%r11) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl 48(%rsp) + je ..B1.56 +..B1.55: + negq %rax + fld %st(2) + movq __libm_atanl_table_128@GOTPCREL(%rip), %rdx + fldl 8192(%rdx,%rax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fldl 8200(%rdx,%rax) + fsubp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.57 +..B1.56: + movq __libm_atanl_table_128@GOTPCREL(%rip), %rdx + fld %st(2) + fldl (%rax,%rdx) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 8(%rax,%rdx) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rsp) +..B1.57: + testb %r8b, %r8b + je ..B1.59 +..B1.58: + fldt (%rsp) + fstpt 32(%rsp) +..B1.111: + fldcw 66(%rsp) +..B1.59: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.60: + fstp %st(3) + lea 12(%rcx), %r9d + cmpl %r9d, %eax + jle ..B1.71 +..B1.61: + addl $75, %ecx + cmpl %ecx, %eax + jle ..B1.65 +..B1.62: + fstp %st(1) + fstp %st(1) + fstp %st(0) + shlq $4, %rsi + lea _pi_02l(%rip), %rax + lea _small_value_80(%rip), %rdx + testb %r8b, %r8b + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + je ..B1.64 +..B1.63: + fldcw 66(%rsp) +..B1.64: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.65: + fxch %st(1) + fdivrp %st, %st(2) + lea 48+_P(%rip), %rax + fld %st(1) + lea 32+_P(%rip), %rcx + fmul %st(2), %st + lea 16+_P(%rip), %rdx + fld %st(0) + lea _P(%rip), %rsi + fmul %st(1), %st + testb %dil, %dil + movq __libm_atanl_table_128@GOTPCREL(%rip), %r9 + fxch %st(3) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rax) + fmul %st(4), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rcx) + fmulp %st, %st(5) + fldt (%rsi) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fmul %st, %st(2) + faddp %st, %st(2) + fldl 4096(%r9) + fstpt (%rsp) + fldl 4104(%r9) + je ..B1.67 +..B1.66: + faddp %st, %st(2) + fldt (%rsp) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.68 +..B1.67: + fsubp %st, %st(2) + fldt (%rsp) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.68: + testb %r8b, %r8b + je ..B1.70 +..B1.69: + fldcw 66(%rsp) +..B1.70: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.71: + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rax + fmul %st(3), %st + lea _TWO_48H(%rip), %rcx + fdiv %st(2), %st + fld %st(3) + fxch %st(2) + fstpl 48(%rsp) + fld %st(2) + fld %st(3) + lea 48+_P(%rip), %rsi + fldl (%rax) + lea 16+_P(%rip), %r9 + lea 32+_P(%rip), %r10 + lea _P(%rip), %r11 + fadd %st, %st(3) + fxch %st(3) + fstpt 32(%rsp) + fldt 32(%rsp) + fsubp %st, %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(3) + fld %st(5) + fldl (%rcx) + fmul %st, %st(5) + movslq 32(%rsp), %rax + fxch %st(1) + fadd %st(5), %st + shlq $4, %rax + fsubp %st, %st(5) + testb %dil, %dil + fxch %st(4) + fsubr %st, %st(6) + fld %st(6) + fmul %st(4), %st + fxch %st(3) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(5) + fxch %st(2) + fadd %st(5), %st + fld %st(1) + fmul %st(4), %st + fadd %st(3), %st + fxch %st(4) + fmul %st, %st(6) + fxch %st(6) + fsubrp %st, %st(7) + fxch %st(2) + fmulp %st, %st(5) + fsubp %st, %st(4) + fld %st(1) + fadd %st(1), %st + fdivrl (%rdx) + lea 8+_ones(%rip), %rdx + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fstpt (%rsp) + fldt (%rsp) + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fld %st(3) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + fmul %st(4), %st + fld %st(4) + fmul %st(7), %st + fxch %st(6) + fadd %st, %st(7) + fmulp %st, %st(5) + faddl (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 96(%rsp) + fldt 96(%rsp) + fld %st(1) + fmul %st(3), %st + fld %st(2) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rsi) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + fmulp %st, %st(3) + fldt (%r11) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl 48(%rsp) + je ..B1.73 +..B1.72: + movq __libm_atanl_table_128@GOTPCREL(%rip), %rdx + fld %st(2) + fldl 4096(%rdx,%rax) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(2) + faddl 4104(%rdx,%rax) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.74 +..B1.73: + negq %rax + fld %st(2) + movq __libm_atanl_table_128@GOTPCREL(%rip), %rdx + fldl 4096(%rdx,%rax) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fldl 4104(%rdx,%rax) + fsubp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + fstpt 16(%rsp) +..B1.74: + testb %r8b, %r8b + je ..B1.76 +..B1.75: + fldt (%rsp) + fstpt 32(%rsp) +..B1.112: + fldcw 66(%rsp) +..B1.76: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.77: + testb %dil, %dil + je ..B1.79 +..B1.78: + shlq $4, %rsi + lea _pi_00l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.23 +..B1.79: + lea _zeros(%rip), %rax + fldl (%rax,%rsi,8) + fstpt (%rsp) + jmp ..B1.23 +..B1.80: + movzwl 66(%rsp), %r9d + movl %r9d, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.84 +..B1.81: + orl $-64768, %r9d + movw %r9w, 64(%rsp) +..B1.82: + fldcw 64(%rsp) +..B1.83: + movb $1, %r8b +..B1.84: + cmpl $32767, %eax + je ..B1.107 +..B1.85: + cmpl $32767, %ecx + je ..B1.105 +..B1.86: + testl %eax, %eax + jne ..B1.89 +..B1.87: + cmpl $0, 84(%rsp) + jne ..B1.92 +..B1.88: + cmpl $0, 80(%rsp) + jne ..B1.92 +..B1.89: + testl %ecx, %ecx + jne ..B1.93 +..B1.90: + cmpl $0, 100(%rsp) + jne ..B1.92 +..B1.91: + cmpl $0, 96(%rsp) + je ..B1.94 +..B1.92: + lea _smallest_value_64(%rip), %rdx + movq (%rdx), %r9 + movq %r9, 56(%rsp) +..B1.93: + cmpl $32767, %ecx + je ..B1.98 +..B1.94: + shlq $4, %rsi + lea _pi_02l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) +..B1.95: + testb %r8b, %r8b + je ..B1.97 +..B1.96: + fldcw 66(%rsp) +..B1.97: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.98: + cmpl $32767, %eax + je ..B1.102 +..B1.99: + testb %dil, %dil + je ..B1.101 +..B1.100: + shlq $4, %rsi + lea _pi_00l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.95 +..B1.101: + lea _zeros(%rip), %rax + fldl (%rax,%rsi,8) + fstpt (%rsp) + jmp ..B1.95 +..B1.102: + shlq $4, %rsi + testb %dil, %dil + je ..B1.104 +..B1.103: + lea _pi_34l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.95 +..B1.104: + lea _pi_04l(%rip), %rax + lea _small_value_80(%rip), %rdx + fldt (%rsi,%rax) + fldt (%rsi,%rdx) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.95 +..B1.105: + movq $0x8000000000000000, %rdx + cmpq 96(%rsp), %rdx + je ..B1.86 +..B1.106: + fldt 96(%rsp) + fldt 80(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.95 +..B1.107: + movq $0x8000000000000000, %rdx + cmpq 80(%rsp), %rdx + jne ..B1.106 + jmp ..B1.85 + .align 16,0x90 + .cfi_endproc + .type atan2l,@function + .size atan2l,.-atan2l + .data +# -- End atan2l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 2 +_pi_00l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49152 + .word 0 + .word 0 + .word 0 + .type _pi_00l,@object + .size _pi_00l,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_pi_02l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _pi_02l,@object + .size _pi_02l,32 + .align 2 +_TWO_8192: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _TWO_8192,@object + .size _TWO_8192,32 + .align 2 +_P: + .word 43664 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 43235 + .word 52379 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59507 + .word 38278 + .word 9340 + .word 37449 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 9132 + .word 55602 + .word 8665 + .word 58245 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,64 + .align 2 +_pi_34l: + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 49152 + .word 0 + .word 0 + .word 0 + .type _pi_34l,@object + .size _pi_34l,32 + .align 2 +_pi_04l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49150 + .word 0 + .word 0 + .word 0 + .type _pi_04l,@object + .size _pi_04l,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atan_gen.S b/external/sgx_libm/intel64/atan_gen.S new file mode 100644 index 0000000000..9e80c811c4 --- /dev/null +++ b/external/sgx_libm/intel64/atan_gen.S @@ -0,0 +1,887 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atan_gen.c" + .text +..TXTST0: +# -- Begin atan + .text + .align 16,0x90 + .globl atan +atan: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_atan.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + movsd %xmm0, (%rsp) +..B1.2: + movlpd BMASK1(%rip), %xmm3 + xorpd %xmm2, %xmm2 + movlpd BMASK2(%rip), %xmm6 + movlpd SGNMASK(%rip), %xmm7 + pextrw $3, %xmm0, %edx + movl %edx, %eax + andl $32767, %edx + movl $16448, %ecx + pinsrw $3, %ecx, %xmm2 + andpd %xmm7, %xmm0 + xorpd %xmm7, %xmm7 + movq %xmm0, %xmm1 + andpd %xmm0, %xmm3 + pinsrw $3, %ecx, %xmm7 + orpd %xmm6, %xmm3 + movlpd ONEMASK(%rip), %xmm5 + subl $16288, %edx + cmpl $1119, %edx + ja .L_2TAG_PACKET_0.0.1 + cmpsd $6, %xmm0, %xmm2 + minsd %xmm7, %xmm3 + andpd %xmm2, %xmm5 + andpd %xmm2, %xmm0 + mulsd %xmm3, %xmm1 + subsd %xmm3, %xmm0 + addsd %xmm5, %xmm1 + divsd %xmm1, %xmm0 + pextrw $3, %xmm3, %edx + subl $16287, %edx + movlpd a2(%rip), %xmm2 + movlpd b2(%rip), %xmm4 + andl $32768, %eax + pinsrw $3, %eax, %xmm7 + addl %edx, %edx + lea atan_tbl(%rip), %r8 + movlpd (%r8,%rdx,8), %xmm6 + addl $1, %edx + movlpd (%r8,%rdx,8), %xmm5 + xorpd %xmm7, %xmm5 + xorpd %xmm7, %xmm6 + movq %xmm0, %xmm1 + xorpd %xmm7, %xmm1 + movq %xmm1, %xmm3 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm2 + addsd %xmm0, %xmm4 + addsd %xmm6, %xmm1 + subsd %xmm1, %xmm6 + addsd %xmm3, %xmm6 + addsd 8+a2(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm3, %xmm0 + addsd %xmm5, %xmm6 + mulsd %xmm2, %xmm0 + addsd 8+b2(%rip), %xmm4 + mulsd %xmm4, %xmm0 + addsd %xmm6, %xmm0 + addsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_0.0.1: + addl $944, %edx + cmpl $2063, %edx + ja .L_2TAG_PACKET_2.0.1 + movlpd a2(%rip), %xmm4 + movlpd b2(%rip), %xmm7 + movlpd (%rsp), %xmm0 + mulsd %xmm1, %xmm1 + movlpd 8+a2(%rip), %xmm2 + movlpd 8+b2(%rip), %xmm5 + mulsd %xmm1, %xmm4 + addsd %xmm1, %xmm7 + movq %xmm1, %xmm6 + mulsd %xmm0, %xmm1 + addsd %xmm4, %xmm2 + mulsd %xmm6, %xmm7 + mulsd %xmm1, %xmm2 + addsd %xmm5, %xmm7 + mulsd %xmm7, %xmm2 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_2.0.1: + addl $15344, %edx + cmpl $17392, %edx + jae .L_2TAG_PACKET_3.0.1 + movlpd (%rsp), %xmm0 + movlpd (%rsp), %xmm1 + cmpl $16, %edx + jae .L_2TAG_PACKET_1.0.1 + mulsd %xmm0, %xmm1 + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_3.0.1: + movlpd (%rsp), %xmm4 + movlpd SGNMASK(%rip), %xmm0 + movlpd pi_table(%rip), %xmm2 + movlpd 8+pi_table(%rip), %xmm3 + movd %xmm1, %eax + psrlq $32, %xmm1 + movd %xmm1, %edx + cmpl $2146435072, %edx + jae .L_2TAG_PACKET_4.0.1 +.L_2TAG_PACKET_5.0.1: + andnpd %xmm4, %xmm0 + orpd %xmm0, %xmm2 + orpd %xmm3, %xmm0 + addsd %xmm2, %xmm0 + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_4.0.1: + subl $2146435072, %edx + orl %edx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_5.0.1 + movq %xmm4, %xmm0 + addsd %xmm0, %xmm0 +.L_2TAG_PACKET_1.0.1: +..B1.3: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type atan,@function + .size atan,.-atan + .data +# -- End atan + .section .rodata, "a" + .align 4 + .align 4 +BMASK1: + .long 0 + .long 4294901760 + .type BMASK1,@object + .size BMASK1,8 + .align 4 +BMASK2: + .long 0 + .long 32768 + .type BMASK2,@object + .size BMASK2,8 + .align 4 +SGNMASK: + .long 4294967295 + .long 2147483647 + .type SGNMASK,@object + .size SGNMASK,8 + .align 4 +ONEMASK: + .long 0 + .long 1072693248 + .type ONEMASK,@object + .size ONEMASK,8 + .align 4 +a2: + .long 2006262985 + .long 1069310863 + .long 2358449471 + .long 3217342131 + .type a2,@object + .size a2,16 + .align 4 +b2: + .long 3845454352 + .long 1069952297 + .long 2829679149 + .long 1073771565 + .type b2,@object + .size b2,16 + .align 4 +atan_tbl: + .long 0 + .long 0 + .long 0 + .long 0 + .long 3819695742 + .long 1067482761 + .long 2398680355 + .long 3155462074 + .long 2998791009 + .long 1067548225 + .long 3868465248 + .long 3157182472 + .long 3339424991 + .long 1067613680 + .long 3296670360 + .long 1010752543 + .long 2710002256 + .long 1067679126 + .long 3403896007 + .long 1010910768 + .long 3275701428 + .long 1067744562 + .long 119959933 + .long 1011482843 + .long 2908636881 + .long 1067809988 + .long 2464489612 + .long 1011545526 + .long 3777889398 + .long 1067875403 + .long 3262682165 + .long 1009703919 + .long 3759667419 + .long 1067940807 + .long 1838130851 + .long 3157373556 + .long 732369940 + .long 1068006200 + .long 1203428313 + .long 1010055371 + .long 1166616461 + .long 1068071580 + .long 2901274051 + .long 3158549977 + .long 2945472892 + .long 1068136947 + .long 3726120658 + .long 1009762715 + .long 3954480976 + .long 1068202301 + .long 1289173457 + .long 1009429861 + .long 2081752829 + .long 1068267642 + .long 1836909874 + .long 1006212095 + .long 3807999788 + .long 1068332968 + .long 2172459940 + .long 3156162078 + .long 2731789884 + .long 1068398280 + .long 3450718392 + .long 3159216547 + .long 1044477961 + .long 1068463577 + .long 2230553229 + .long 1011424339 + .long 1486930287 + .long 1068530218 + .long 2861547474 + .long 1012041376 + .long 2293016881 + .long 1068595466 + .long 136843272 + .long 1012684797 + .long 201518157 + .long 1068660680 + .long 63231984 + .long 1012427198 + .long 4054234584 + .long 1068725856 + .long 3927006960 + .long 1011878955 + .long 1246477213 + .long 1068790995 + .long 1494265652 + .long 3155219350 + .long 678186699 + .long 1068856093 + .long 1264361424 + .long 3159256693 + .long 2690594995 + .long 1068921148 + .long 3906996379 + .long 1009288267 + .long 3362611517 + .long 1068986159 + .long 1650970041 + .long 3158331771 + .long 3102162111 + .long 1069051124 + .long 365917035 + .long 3160264153 + .long 2352611067 + .long 1069116041 + .long 4008970190 + .long 3159478182 + .long 1594134794 + .long 1069180908 + .long 466690178 + .long 1012526501 + .long 1345079306 + .long 1069245723 + .long 2268273568 + .long 3160164092 + .long 2163300970 + .long 1069310484 + .long 2750834800 + .long 3158113482 + .long 352522716 + .long 1069375190 + .long 1750411372 + .long 1011790845 + .long 848541647 + .long 1069439838 + .long 2164207573 + .long 1011698350 + .long 40647312 + .long 1069504427 + .long 2949165434 + .long 3159107267 + .long 2216766270 + .long 1069574357 + .long 2197920765 + .long 3161055954 + .long 1090914384 + .long 1069638757 + .long 2330454674 + .long 1013365998 + .long 387601244 + .long 1069703022 + .long 3185681168 + .long 1013434071 + .long 3991640484 + .long 1069767144 + .long 1313211590 + .long 3161087959 + .long 3322489502 + .long 1069831118 + .long 3013977995 + .long 1013053011 + .long 3121698570 + .long 1069894936 + .long 4069015667 + .long 1013023362 + .long 4289964660 + .long 1069958591 + .long 1736191156 + .long 3158266731 + .long 3903312386 + .long 1070022077 + .long 1833592413 + .long 3159731471 + .long 3818449864 + .long 1070085387 + .long 851036429 + .long 3159730451 + .long 2097480306 + .long 1070148515 + .long 3506390884 + .long 3160462302 + .long 1611694502 + .long 1070211454 + .long 2785735540 + .long 3160465144 + .long 1464694796 + .long 1070274198 + .long 4229277299 + .long 3159907000 + .long 1299612775 + .long 1070336741 + .long 4116653788 + .long 3160427739 + .long 1310544789 + .long 1070399077 + .long 1064430331 + .long 1013218202 + .long 2253168030 + .long 1070461200 + .long 1405044609 + .long 3157623179 + .long 1159567373 + .long 1070523105 + .long 2353445521 + .long 3159992176 + .long 1359373750 + .long 1070605818 + .long 1748171336 + .long 3161879263 + .long 908341706 + .long 1070667034 + .long 3372710815 + .long 3161775245 + .long 1743027350 + .long 1070727765 + .long 687089934 + .long 3160507171 + .long 2055355646 + .long 1070787992 + .long 2392855242 + .long 1013682469 + .long 690426164 + .long 1070847697 + .long 1103926666 + .long 1014052810 + .long 1483247847 + .long 1070906862 + .long 2082645847 + .long 3161345479 + .long 392040270 + .long 1070965472 + .long 2407720023 + .long 1014053754 + .long 2673846014 + .long 1071023511 + .long 1293605532 + .long 3158464385 + .long 1384215810 + .long 1071080967 + .long 2446095872 + .long 3159216407 + .long 3101660631 + .long 1071137826 + .long 698040758 + .long 1014855328 + .long 2094057058 + .long 1071194078 + .long 2282048339 + .long 1014040385 + .long 1712750594 + .long 1071249712 + .long 1204372378 + .long 3162276464 + .long 1411515787 + .long 1071304719 + .long 949080808 + .long 1015006403 + .long 931538085 + .long 1071359091 + .long 3027127039 + .long 1014307233 + .long 179139065 + .long 1071412821 + .long 4285547492 + .long 3161934731 + .long 3387721259 + .long 1071465902 + .long 373225773 + .long 1013486625 + .long 2132236852 + .long 1071544299 + .long 3250533429 + .long 1014031677 + .long 1942070284 + .long 1071645596 + .long 1237964179 + .long 3163239113 + .long 1532707802 + .long 1071695380 + .long 330645583 + .long 1012495610 + .long 2294184979 + .long 1071743834 + .long 3959472897 + .long 1015833116 + .long 3805060714 + .long 1071790961 + .long 2671256142 + .long 1013727772 + .long 2215037898 + .long 1071836770 + .long 2683359117 + .long 1015831902 + .long 483661594 + .long 1071881273 + .long 836288326 + .long 3162648643 + .long 1534679894 + .long 1071924486 + .long 373258696 + .long 3162470096 + .long 1538714628 + .long 1071966430 + .long 3199433068 + .long 1015325501 + .long 527642555 + .long 1072007128 + .long 3636832592 + .long 3161843145 + .long 291339150 + .long 1072046605 + .long 890169537 + .long 3160586117 + .long 2450210201 + .long 1072084888 + .long 1636353294 + .long 3163193400 + .long 2411367951 + .long 1072122007 + .long 374899873 + .long 1011331750 + .long 681549971 + .long 1072157992 + .long 506411689 + .long 1015373954 + .long 1466745541 + .long 1072192873 + .long 2143860931 + .long 1013364334 + .long 2845622366 + .long 1072226682 + .long 2869178209 + .long 3162423682 + .long 2838871438 + .long 1072275456 + .long 3742223599 + .long 1014338577 + .long 4200275274 + .long 1072337034 + .long 1566539915 + .long 3161839550 + .long 3034733530 + .long 1072394897 + .long 652621408 + .long 3162261964 + .long 3207412993 + .long 1072449290 + .long 3206124665 + .long 1014408733 + .long 624461478 + .long 1072500450 + .long 932437485 + .long 1015204343 + .long 767665908 + .long 1072548600 + .long 1037911952 + .long 3163527627 + .long 1110773639 + .long 1072593952 + .long 2371517912 + .long 3160465741 + .long 1940828530 + .long 1072636704 + .long 2731408428 + .long 3162895795 + .long 1911329388 + .long 1072677041 + .long 1773089615 + .long 3159569267 + .long 1764715788 + .long 1072704191 + .long 691346949 + .long 3164069946 + .long 3332979233 + .long 1072722195 + .long 3550733983 + .long 1014770628 + .long 1321870254 + .long 1072739231 + .long 1415315820 + .long 1016224052 + .long 3657429030 + .long 1072755365 + .long 3910539033 + .long 1015966402 + .long 4197624557 + .long 1072770661 + .long 2333399254 + .long 3164546480 + .long 1512059493 + .long 1072785177 + .long 2701510318 + .long 1016178092 + .long 453379037 + .long 1072798965 + .long 4046344253 + .long 3162814364 + .long 1942345162 + .long 1072818388 + .long 621134147 + .long 1016335195 + .long 4210176273 + .long 1072842164 + .long 2701013387 + .long 3164326619 + .long 4185644010 + .long 1072863795 + .long 4163699341 + .long 1016203112 + .long 679688788 + .long 1072883543 + .long 4147276762 + .long 1014066750 + .long 29432865 + .long 1072901630 + .long 970415797 + .long 1016902063 + .long 4070721092 + .long 1072918247 + .long 2539004411 + .long 3163736096 + .long 2252468843 + .long 1072933561 + .long 3424082887 + .long 3163407177 + .long 2929724825 + .long 1072947712 + .long 3661482235 + .long 3163846989 + .long 1377513368 + .long 1072960824 + .long 3987926680 + .long 1013647908 + .long 1031632908 + .long 1072973003 + .long 3672217151 + .long 1016614619 + .long 2516508130 + .long 1072984342 + .long 545855020 + .long 3162728930 + .long 3792452178 + .long 1072994923 + .long 3420119467 + .long 1016471430 + .long 3147791459 + .long 1073004818 + .long 1342204979 + .long 1013937254 + .long 999189752 + .long 1073014090 + .long 1006335472 + .long 3162850919 + .long 711011011 + .long 1073022794 + .long 4633488 + .long 3162966895 + .long 15640363 + .long 1073030980 + .long 1686389560 + .long 3164376226 + .long 1218463589 + .long 1073042382 + .long 1526837110 + .long 3163533985 + .long 2538470555 + .long 1073056144 + .long 2273304406 + .long 3163784996 + .long 1229720947 + .long 1073068489 + .long 2971628206 + .long 3162356540 + .long 3115427016 + .long 1073079621 + .long 4215132957 + .long 3164282762 + .long 4030612557 + .long 1073089709 + .long 1913251691 + .long 3163671292 + .long 2728521257 + .long 1073098892 + .long 2861089500 + .long 1015454459 + .long 1118696283 + .long 1073107285 + .long 1628948053 + .long 1016179658 + .long 2682711255 + .long 1073114984 + .long 2906306266 + .long 1014142643 + .long 2073898081 + .long 1073122072 + .long 1322740454 + .long 3164497217 + .long 1403700297 + .long 1073128618 + .long 416137895 + .long 3162781466 + .long 2502685617 + .long 1073134681 + .long 3242008732 + .long 1014593495 + .long 1531926851 + .long 1073140313 + .long 1362708094 + .long 1016517604 + .long 3572814411 + .long 1073145557 + .long 3709790527 + .long 1012646874 + .long 1695536111 + .long 1073150453 + .long 3980346340 + .long 1016705136 + .long 2363057203 + .long 1073155033 + .long 2551194792 + .long 1012569695 + .long 2873365682 + .long 1073159327 + .long 3181154748 + .long 1017041450 + .long 1053384691 + .long 1073165288 + .long 3074536879 + .long 1016965660 + .long 3270542712 + .long 1073172451 + .long 2535319415 + .long 3163051778 + .long 1353631484 + .long 1073178850 + .long 1173833755 + .long 1015534537 + .long 3511218460 + .long 1073184599 + .long 1243608109 + .long 3161592122 + .long 4121259284 + .long 1073189793 + .long 398584912 + .long 3163829923 + .long 1193862106 + .long 1073194509 + .long 1873745539 + .long 3163802819 + .long 3861949790 + .long 1073198808 + .long 3841261147 + .long 1015587248 + .long 1486904578 + .long 1073202745 + .long 1634726776 + .long 3163847886 + .long 2879153715 + .long 1073206362 + .long 200456242 + .long 3164138657 + .long 385353253 + .long 1073209698 + .long 1186355517 + .long 1014887155 + .long 1125865839 + .long 1073212783 + .long 203561262 + .long 3161244927 + .long 1221361475 + .long 1073215645 + .long 3382476563 + .long 1014936138 + .long 2077323573 + .long 1073218307 + .long 1005121005 + .long 3164430752 + .long 215611373 + .long 1073220790 + .long 353198764 + .long 3164485137 + .long 2347419265 + .long 1073223110 + .long 1103143360 + .long 1016542137 + .long 1379112765 + .long 1073225284 + .long 381583533 + .long 3162870833 + .long 3891198463 + .long 1073228298 + .long 1771275754 + .long 1014654681 + .long 3395914051 + .long 1073231917 + .long 2350900914 + .long 3164013978 + .long 2799919478 + .long 1073235146 + .long 2893950164 + .long 3163260901 + .long 1138673476 + .long 1073238045 + .long 2622204785 + .long 3164174388 + .long 3408855940 + .long 1073240661 + .long 2800881650 + .long 1016008624 + .long 2044858738 + .long 1073243035 + .long 604544785 + .long 1017022901 + .long 2578795176 + .long 1073245198 + .long 2557332925 + .long 1016135165 + .long 4196285314 + .long 1073247177 + .long 2032365307 + .long 1016194735 + .long 224877747 + .long 1073248996 + .long 497926916 + .long 1016947111 + .long 3271386490 + .long 1073250671 + .long 2689994846 + .long 1016631513 + .long 813635989 + .long 1073252221 + .long 747035277 + .long 3164530136 + .long 369829519 + .long 1073253658 + .long 2182033858 + .long 3163190340 + .long 1187679052 + .long 1073254994 + .long 673954443 + .long 1016149821 + .long 4232586098 + .long 1073256239 + .long 497775200 + .long 3162179015 + .long 426690558 + .long 1073257404 + .long 3063343247 + .long 1016865578 + .long 1624065902 + .long 1073258494 + .long 1354224996 + .long 3163503778 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .type atan_tbl,@object + .size atan_tbl,2592 + .align 4 +pi_table: + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .type pi_table,@object + .size pi_table,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atandl_table.S b/external/sgx_libm/intel64/atandl_table.S new file mode 100644 index 0000000000..534f96c90f --- /dev/null +++ b/external/sgx_libm/intel64/atandl_table.S @@ -0,0 +1,2099 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atandl_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .globl __libm_atandl_table_128 +__libm_atandl_table_128: + .long 0 + .long 0 + .long 0 + .long 0 + .long 3896508416 + .long 1071424949 + .long 2497855885 + .long 1035107781 + .long 1447034880 + .long 1072473411 + .long 1733066939 + .long 3185173141 + .long 1421869056 + .long 1073052515 + .long 1368774744 + .long 1038726731 + .long 1314914304 + .long 1073521529 + .long 3636885973 + .long 3186244272 + .long 1199570944 + .long 1073866069 + .long 2275810035 + .long 3185989885 + .long 476053504 + .long 1074100319 + .long 3721769433 + .long 3184582046 + .long 3514826752 + .long 1074334397 + .long 1919096566 + .long 3184722268 + .long 845152256 + .long 1074568277 + .long 2005889037 + .long 1036405998 + .long 2545942528 + .long 1074796164 + .long 4215566178 + .long 1040782263 + .long 4057989120 + .long 1074912862 + .long 2215314489 + .long 1040552811 + .long 3430940672 + .long 1075029419 + .long 314220031 + .long 3187779646 + .long 1717567488 + .long 1075145821 + .long 2152308088 + .long 1040271717 + .long 455081984 + .long 1075262054 + .long 1186928436 + .long 1040902706 + .long 1694498816 + .long 1075378104 + .long 4227739998 + .long 1040491905 + .long 3747610624 + .long 1075493958 + .long 535382953 + .long 1040666985 + .long 1226833920 + .long 1075609604 + .long 1790336138 + .long 1040185867 + .long 2260729856 + .long 1075725027 + .long 3899937368 + .long 3188375434 + .long 3525312512 + .long 1075839595 + .long 4053544535 + .long 3185741100 + .long 3957325824 + .long 1075897065 + .long 4030890856 + .long 1040553080 + .long 3248488448 + .long 1075954405 + .long 1333464106 + .long 3189137055 + .long 452984832 + .long 1076011609 + .long 3448918206 + .long 3189528508 + .long 3615490048 + .long 1076068669 + .long 608092114 + .long 1041523725 + .long 4020240384 + .long 1076125581 + .long 1336102440 + .long 3188870826 + .long 1960837120 + .long 1076182339 + .long 2391933274 + .long 3189275321 + .long 2470445056 + .long 1076238936 + .long 4283795024 + .long 1041937846 + .long 2451570688 + .long 1076295367 + .long 4217000778 + .long 1039765656 + .long 3560964096 + .long 1076351626 + .long 3936906987 + .long 3182578922 + .long 3640655872 + .long 1076407708 + .long 1439536878 + .long 1040659594 + .long 1023410176 + .long 1076463608 + .long 2552585681 + .long 3189615238 + .long 3122659328 + .long 1076519319 + .long 31715936 + .long 1042073699 + .long 689963008 + .long 1076574838 + .long 3139108801 + .long 1040611849 + .long 2164260864 + .long 1076630158 + .long 1139819401 + .long 3187965768 + .long 3623878656 + .long 1076685275 + .long 3513262155 + .long 1039670426 + .long 1679818752 + .long 1076740185 + .long 728891110 + .long 1041952788 + .long 2069889024 + .long 1076794882 + .long 3614319306 + .long 1039599785 + .long 2480930816 + .long 1076849362 + .long 1879438446 + .long 3188546042 + .long 2720006144 + .long 1076895586 + .long 4246516390 + .long 1042916956 + .long 574619648 + .long 1076922603 + .long 3568262924 + .long 1040145602 + .long 3061841920 + .long 1076949504 + .long 290418758 + .long 3187677511 + .long 1539309568 + .long 1076976289 + .long 635731916 + .long 1042641148 + .long 532676608 + .long 1077002955 + .long 4225033962 + .long 3189573420 + .long 545259520 + .long 1077029500 + .long 2007583995 + .long 1042491810 + .long 2369781760 + .long 1077055922 + .long 2061076001 + .long 3190167169 + .long 2774532096 + .long 1077082220 + .long 2608380742 + .long 1042446121 + .long 3112173568 + .long 1077108392 + .long 2901961231 + .long 1042075808 + .long 715128832 + .long 1077134437 + .long 3828632392 + .long 3189418038 + .long 1782579200 + .long 1077160352 + .long 519110621 + .long 1041924126 + .long 4206886912 + .long 1077186136 + .long 2078221814 + .long 1039357043 + .long 1858076672 + .long 1077211789 + .long 2404314454 + .long 3190701797 + .long 1763704832 + .long 1077237308 + .long 1129624783 + .long 3189333294 + .long 2638217216 + .long 1077262692 + .long 1872508293 + .long 3187027668 + .long 3464495104 + .long 1077287940 + .long 2518581518 + .long 1039154339 + .long 3493855232 + .long 1077313051 + .long 2874645533 + .long 3188678970 + .long 2241855488 + .long 1077338024 + .long 182480744 + .long 3187988055 + .long 3783262208 + .long 1077362857 + .long 41710967 + .long 3189176765 + .long 3860856832 + .long 1077387550 + .long 3921914980 + .long 1040188295 + .long 2770337792 + .long 1077412102 + .long 2195237132 + .long 1043018421 + .long 1061158912 + .long 1077436512 + .long 1866130671 + .long 1042885968 + .long 3825205248 + .long 1077460778 + .long 2099274145 + .long 1043277518 + .long 3519021056 + .long 1077484901 + .long 2434136291 + .long 3190760305 + .long 1423966208 + .long 1077508880 + .long 786043090 + .long 3189674834 + .long 3361734656 + .long 1077532713 + .long 1735814367 + .long 1041228653 + .long 2501902336 + .long 1077556401 + .long 2532076405 + .long 1041674477 + .long 832569344 + .long 1077579943 + .long 1067893357 + .long 1041790735 + .long 568328192 + .long 1077603338 + .long 42353869 + .long 1040967961 + .long 4143972352 + .long 1077626585 + .long 3035382168 + .long 1043228732 + .long 1329594368 + .long 1077649686 + .long 2622169537 + .long 1042608561 + .long 3579838464 + .long 1077672638 + .long 3279279360 + .long 1039969098 + .long 1082130432 + .long 1077695443 + .long 152088799 + .long 1042154031 + .long 1409286144 + .long 1077718099 + .long 1577179566 + .long 1043010748 + .long 3743416320 + .long 1077740606 + .long 164745699 + .long 3187116092 + .long 3162505216 + .long 1077762965 + .long 3525309094 + .long 3189988831 + .long 3525312512 + .long 1077785175 + .long 790013831 + .long 3189219565 + .long 287309824 + .long 1077807237 + .long 3014793090 + .long 3190791112 + .long 1965031424 + .long 1077829149 + .long 2967000185 + .long 3189805146 + .long 73400320 + .long 1077850913 + .long 923692587 + .long 1033248306 + .long 3477078016 + .long 1077872527 + .long 797568562 + .long 1037083943 + .long 4024434688 + .long 1077893993 + .long 1829946853 + .long 1043203029 + .long 2319450112 + .long 1077915311 + .long 1559006781 + .long 3189221910 + .long 1704984576 + .long 1077936304 + .long 2364400925 + .long 3186972503 + .long 4104126464 + .long 1077946814 + .long 2278278095 + .long 3191749589 + .long 2438987776 + .long 1077957251 + .long 3465285131 + .long 1042435970 + .long 1606418432 + .long 1077967614 + .long 1692530062 + .long 1043648146 + .long 2273312768 + .long 1077977903 + .long 4155795398 + .long 1043918312 + .long 878706688 + .long 1077988119 + .long 1476207680 + .long 1043900034 + .long 2516582400 + .long 1077998261 + .long 2925970384 + .long 1039575776 + .long 3751804928 + .long 1078008330 + .long 2856171667 + .long 3191395954 + .long 1207959552 + .long 1078018327 + .long 2148760563 + .long 1039453383 + .long 161480704 + .long 1078028251 + .long 3632513556 + .long 3191302868 + .long 1642070016 + .long 1078038102 + .long 3240138768 + .long 1043718443 + .long 2447376384 + .long 1078047881 + .long 3100705142 + .long 3191740341 + .long 3709861888 + .long 1078057588 + .long 1674862667 + .long 1041748151 + .long 2325741568 + .long 1078067224 + .long 4255018693 + .long 1044226144 + .long 3827302400 + .long 1078076788 + .long 4142119676 + .long 3191232448 + .long 899678208 + .long 1078086282 + .long 700553623 + .long 1043581423 + .long 3462397952 + .long 1078095704 + .long 1067893357 + .long 3190322959 + .long 4286578688 + .long 1078105056 + .long 3385731218 + .long 1043691060 + .long 486539264 + .long 1078114339 + .long 2289432889 + .long 1035999008 + .long 2092957696 + .long 1078123551 + .long 653388941 + .long 3186809946 + .long 1996488704 + .long 1078132694 + .long 3139143286 + .long 3191209215 + .long 1709178880 + .long 1078141768 + .long 643854101 + .long 3190510369 + .long 2778726400 + .long 1078150773 + .long 2948057503 + .long 3191040876 + .long 2485125120 + .long 1078159710 + .long 172509481 + .long 1044304413 + .long 2438987776 + .long 1078168579 + .long 1352848207 + .long 1043175137 + .long 4271898624 + .long 1078177380 + .long 2864918449 + .long 1043427968 + .long 1054867456 + .long 1078186115 + .long 1735520057 + .long 1044098886 + .long 3063939072 + .long 1078194782 + .long 2894826982 + .long 1043616305 + .long 3418357760 + .long 1078203383 + .long 442938097 + .long 3191392387 + .long 3844079616 + .long 1078211918 + .long 4004776912 + .long 1043962348 + .long 1801453568 + .long 1078220388 + .long 2102624066 + .long 1044353828 + .long 3355443200 + .long 1078228792 + .long 1225643377 + .long 3190452555 + .long 1700790272 + .long 1078237132 + .long 2531804346 + .long 3191195152 + .long 2936012800 + .long 1078245407 + .long 928991542 + .long 1043548181 + .long 293601280 + .long 1078253619 + .long 3229203938 + .long 1042779359 + .long 4194304000 + .long 1078261766 + .long 1071139240 + .long 1044201053 + .long 3600809984 + .long 1078269851 + .long 3018208080 + .long 1043941200 + .long 371195904 + .long 1078277874 + .long 2039162957 + .long 3189903110 + .long 666894336 + .long 1078285834 + .long 1431034507 + .long 3190628953 + .long 2071986176 + .long 1078293732 + .long 3412027605 + .long 3191381190 + .long 2176843776 + .long 1078301569 + .long 183216755 + .long 3188772215 + .long 2877292544 + .long 1078309345 + .long 3207515339 + .long 3189828782 + .long 1778384896 + .long 1078317061 + .long 847503884 + .long 3191075565 + .long 784334848 + .long 1078324717 + .long 2952309205 + .long 1043794080 + .long 1809842176 + .long 1078332313 + .long 467544888 + .long 1042040199 + .long 2472542208 + .long 1078339850 + .long 3311174937 + .long 1039371295 + .long 396361728 + .long 1078347329 + .long 676857836 + .long 3191368341 + .long 1795162112 + .long 1078354749 + .long 2052116880 + .long 3191818486 + .long 0 + .long 1078362112 + .long 0 + .long 0 + .long 2499805184 + .long 1078369474 + .long 2052116880 + .long 1044334838 + .long 3898605568 + .long 1078376894 + .long 676857836 + .long 1043884693 + .long 1822425088 + .long 1078384373 + .long 3311174937 + .long 3186854943 + .long 2485125120 + .long 1078391910 + .long 467544888 + .long 3189523847 + .long 3510632448 + .long 1078399506 + .long 2952309205 + .long 3191277728 + .long 2516582400 + .long 1078407162 + .long 847503884 + .long 1043591917 + .long 1417674752 + .long 1078414878 + .long 3207515339 + .long 1042345134 + .long 2118123520 + .long 1078422654 + .long 183216755 + .long 1041288567 + .long 2222981120 + .long 1078430491 + .long 3412027605 + .long 1043897542 + .long 3628072960 + .long 1078438389 + .long 1431034507 + .long 1043145305 + .long 3923771392 + .long 1078446349 + .long 2039162957 + .long 1042419462 + .long 694157312 + .long 1078454372 + .long 3018208080 + .long 3191424848 + .long 100663296 + .long 1078462457 + .long 1071139240 + .long 3191684701 + .long 4001366016 + .long 1078470604 + .long 3229203938 + .long 3190263007 + .long 1358954496 + .long 1078478816 + .long 928991542 + .long 3191031829 + .long 2594177024 + .long 1078487091 + .long 2531804346 + .long 1043711504 + .long 939524096 + .long 1078495431 + .long 1225643377 + .long 1042968907 + .long 2493513728 + .long 1078503835 + .long 2102624066 + .long 3191837476 + .long 450887680 + .long 1078512305 + .long 4004776912 + .long 3191445996 + .long 876609536 + .long 1078520840 + .long 442938097 + .long 1043908739 + .long 1231028224 + .long 1078529441 + .long 2894826982 + .long 3191099953 + .long 3240099840 + .long 1078538108 + .long 1735520057 + .long 3191582534 + .long 23068672 + .long 1078546843 + .long 2864918449 + .long 3190911616 + .long 1855979520 + .long 1078555644 + .long 1352848207 + .long 3190658785 + .long 1809842176 + .long 1078564513 + .long 172509481 + .long 3191788061 + .long 1516240896 + .long 1078573450 + .long 2948057503 + .long 1043557228 + .long 2585788416 + .long 1078582455 + .long 643854101 + .long 1043026721 + .long 2298478592 + .long 1078591529 + .long 3139143286 + .long 1043725567 + .long 2202009600 + .long 1078600672 + .long 653388941 + .long 1039326298 + .long 3808428032 + .long 1078609884 + .long 2289432889 + .long 3183482656 + .long 8388608 + .long 1078619167 + .long 3385731218 + .long 3191174708 + .long 832569344 + .long 1078628519 + .long 1067893357 + .long 1042839311 + .long 3395289088 + .long 1078637941 + .long 700553623 + .long 3191065071 + .long 467664896 + .long 1078647435 + .long 4142119676 + .long 1043748800 + .long 1969225728 + .long 1078656999 + .long 4255018693 + .long 3191709792 + .long 585105408 + .long 1078666635 + .long 1674862667 + .long 3189231799 + .long 1847590912 + .long 1078676342 + .long 3100705142 + .long 1044256693 + .long 2652897280 + .long 1078686121 + .long 3240138768 + .long 3191202091 + .long 4133486592 + .long 1078695972 + .long 3632513556 + .long 1043819220 + .long 3087007744 + .long 1078705896 + .long 2148760563 + .long 3186937031 + .long 543162368 + .long 1078715893 + .long 2856171667 + .long 1043912306 + .long 1778384896 + .long 1078725962 + .long 2925970384 + .long 3187059424 + .long 3416260608 + .long 1078736104 + .long 1476207680 + .long 3191383682 + .long 2021654528 + .long 1078746320 + .long 4155795398 + .long 3191401960 + .long 2688548864 + .long 1078756609 + .long 1692530062 + .long 3191131794 + .long 1855979520 + .long 1078766972 + .long 3465285131 + .long 3189919618 + .long 190840832 + .long 1078777409 + .long 2278278095 + .long 1044265941 + .long 2589982720 + .long 1078787919 + .long 2364400925 + .long 1039488855 + .long 987758592 + .long 1078798504 + .long 1559006781 + .long 1041738262 + .long 134217728 + .long 1078809163 + .long 1232510221 + .long 1043398165 + .long 408944640 + .long 1078819896 + .long 797568562 + .long 3184567591 + .long 2109734912 + .long 1078830703 + .long 1936866404 + .long 1044380280 + .long 1166016512 + .long 1078841585 + .long 2811467203 + .long 3191322578 + .long 2004877312 + .long 1078852541 + .long 2787570751 + .long 3190829595 + .long 385875968 + .long 1078863572 + .long 3023722014 + .long 3191478212 + .long 566231040 + .long 1078874677 + .long 3525309094 + .long 1042505183 + .long 2424307712 + .long 1078885856 + .long 1063445218 + .long 3191768956 + .long 1442840576 + .long 1078897110 + .long 1577179566 + .long 3190494396 + .long 1606418432 + .long 1078908438 + .long 152088799 + .long 3189637679 + .long 2503999488 + .long 1078919840 + .long 1405657776 + .long 1044264267 + .long 3630170112 + .long 1078931316 + .long 2622169537 + .long 3190092209 + .long 75497472 + .long 1078942867 + .long 3035382168 + .long 3190712380 + .long 4009754624 + .long 1078954490 + .long 3752802150 + .long 1044153052 + .long 1730150400 + .long 1078966188 + .long 806768485 + .long 1043980860 + .long 895483904 + .long 1078977959 + .long 2588206371 + .long 1044009924 + .long 2380267520 + .long 1078987253 + .long 1393635940 + .long 1044120466 + .long 3938451456 + .long 1078993211 + .long 1171997210 + .long 1044632170 + .long 2342518784 + .long 1078999206 + .long 2612691399 + .long 3192403747 + .long 1191182336 + .long 1079005237 + .long 2099274145 + .long 3190761166 + .long 4028628992 + .long 1079011303 + .long 3828434628 + .long 1045017771 + .long 1455423488 + .long 1079017406 + .long 1622551107 + .long 3192310957 + .long 1182793728 + .long 1079023544 + .long 2124167878 + .long 3191930936 + .long 2275409920 + .long 1079029717 + .long 41710967 + .long 1041693117 + .long 3735027712 + .long 1079035925 + .long 514060819 + .long 3191694645 + .long 201326592 + .long 1079042169 + .long 1430947390 + .long 3192785388 + .long 3428843520 + .long 1079048446 + .long 2518581518 + .long 3186637987 + .long 3636461568 + .long 1079054758 + .long 1552096852 + .long 3192868489 + .long 3854565376 + .long 1079061104 + .long 1865077452 + .long 3191449780 + .long 2757754880 + .long 1079067484 + .long 2620146859 + .long 3192418374 + .long 3242196992 + .long 1079073897 + .long 1679886032 + .long 1045390684 + .long 3848273920 + .long 1079080343 + .long 1008852996 + .long 1045213180 + .long 3042967552 + .long 1079086822 + .long 1190325550 + .long 3191428594 + .long 3516923904 + .long 1079093333 + .long 2901961231 + .long 3189559456 + .long 3600809984 + .long 1079099876 + .long 843293277 + .long 1043776619 + .long 1556086784 + .long 1079106451 + .long 2705956472 + .long 3192552031 + .long 4158652416 + .long 1079113056 + .long 2007583995 + .long 3189975458 + .long 941621248 + .long 1079119693 + .long 1619354403 + .long 3192676122 + .long 2835349504 + .long 1079126359 + .long 4136034317 + .long 1045078976 + .long 3529506816 + .long 1079133055 + .long 290418758 + .long 1040193863 + .long 929038336 + .long 1079139781 + .long 3915023624 + .long 1045366041 + .long 1468006400 + .long 1079146535 + .long 1061629098 + .long 3192285591 + .long 2910846976 + .long 1079153317 + .long 1308671630 + .long 1043573567 + .long 2963275776 + .long 1079160127 + .long 1320907030 + .long 3192436805 + .long 3548381184 + .long 1079166964 + .long 182222777 + .long 3191258117 + .long 2231369728 + .long 1079173828 + .long 3513262155 + .long 3187154074 + .long 803209216 + .long 1079180718 + .long 1139819401 + .long 1040482120 + .long 987758592 + .long 1079187633 + .long 929259512 + .long 3191000897 + .long 146800640 + .long 1079194573 + .long 3229154456 + .long 3191288344 + .long 4167041024 + .long 1079201536 + .long 2552585681 + .long 1042131590 + .long 1692401664 + .long 1079208524 + .long 1439536878 + .long 3188143242 + .long 2776629248 + .long 1079215534 + .long 353720209 + .long 3191860659 + .long 230686720 + .long 1079222567 + .long 2411046197 + .long 3190921481 + .long 3986685952 + .long 1079229620 + .long 3756699850 + .long 3192084150 + .long 2438987776 + .long 1079236695 + .long 1671725142 + .long 1043734190 + .long 1107296256 + .long 1079243790 + .long 1240754629 + .long 1045055957 + .long 1157627904 + .long 1079250904 + .long 1534601222 + .long 1045263230 + .long 3701473280 + .long 1079258036 + .long 3448918206 + .long 1042044860 + .long 1203765248 + .long 1079265187 + .long 3924779397 + .long 1045089235 + .long 3263168512 + .long 1079272354 + .long 3287244582 + .long 1042979553 + .long 2243952640 + .long 1079279538 + .long 820395291 + .long 3190740781 + .long 3349151744 + .long 1079286737 + .long 1366866651 + .long 3192280071 + .long 3143630848 + .long 1079293951 + .long 2762624284 + .long 1045102639 + .long 2449473536 + .long 1079301179 + .long 1845586757 + .long 1044548329 + .long 2040528896 + .long 1079308420 + .long 3762298090 + .long 1045345703 + .long 2654994432 + .long 1079315673 + .long 3683913357 + .long 1045057884 + .long 698351616 + .long 1079322938 + .long 2953393071 + .long 3191482668 + .long 1128267776 + .long 1079330213 + .long 1034464320 + .long 3191720696 + .long 283115520 + .long 1079337498 + .long 1039826403 + .long 1041577546 + .long 3061841920 + .long 1079344791 + .long 19850279 + .long 1042922258 + .long 1449132032 + .long 1079352093 + .long 294154384 + .long 1045031347 + .long 293601280 + .long 1079359402 + .long 1192966610 + .long 3192379901 + .long 119537664 + .long 1079366717 + .long 152130161 + .long 3190257939 + .long 1438646272 + .long 1079374037 + .long 3963433176 + .long 1043378887 + .long 448790528 + .long 1079381362 + .long 2261136335 + .long 1044042197 + .long 1923088384 + .long 1079388690 + .long 3535382687 + .long 1045010726 + .long 2036334592 + .long 1079396021 + .long 3576784639 + .long 3192441914 + .long 1243611136 + .long 1079403354 + .long 3804918049 + .long 3191900478 + .long 0 + .long 1079410688 + .long 0 + .long 0 + .long 3051356160 + .long 1079418021 + .long 3804918049 + .long 1044416830 + .long 2258632704 + .long 1079425354 + .long 3576784639 + .long 1044958266 + .long 2371878912 + .long 1079432685 + .long 3535382687 + .long 3192494374 + .long 3846176768 + .long 1079440013 + .long 2261136335 + .long 3191525845 + .long 2856321024 + .long 1079447338 + .long 3963433176 + .long 3190862535 + .long 4175429632 + .long 1079454658 + .long 152130161 + .long 1042774291 + .long 4001366016 + .long 1079461973 + .long 1192966610 + .long 1044896253 + .long 2845835264 + .long 1079469282 + .long 294154384 + .long 3192514995 + .long 1233125376 + .long 1079476584 + .long 19850279 + .long 3190405906 + .long 4011851776 + .long 1079483877 + .long 1039826403 + .long 3189061194 + .long 3166699520 + .long 1079491162 + .long 1034464320 + .long 1044237048 + .long 3596615680 + .long 1079498437 + .long 2953393071 + .long 1043999020 + .long 1639972864 + .long 1079505702 + .long 3683913357 + .long 3192541532 + .long 2254438400 + .long 1079512955 + .long 3762298090 + .long 3192829351 + .long 1845493760 + .long 1079520196 + .long 1845586757 + .long 3192031977 + .long 1151336448 + .long 1079527424 + .long 2762624284 + .long 3192586287 + .long 945815552 + .long 1079534638 + .long 1366866651 + .long 1044796423 + .long 2051014656 + .long 1079541837 + .long 820395291 + .long 1043257133 + .long 1031798784 + .long 1079549021 + .long 3287244582 + .long 3190463201 + .long 3091202048 + .long 1079556188 + .long 3924779397 + .long 3192572883 + .long 593494016 + .long 1079563339 + .long 3448918206 + .long 3189528508 + .long 3137339392 + .long 1079570471 + .long 1534601222 + .long 3192746878 + .long 3187671040 + .long 1079577585 + .long 1240754629 + .long 3192539605 + .long 1855979520 + .long 1079584680 + .long 1671725142 + .long 3191217838 + .long 308281344 + .long 1079591755 + .long 3756699850 + .long 1044600502 + .long 4064280576 + .long 1079598808 + .long 2411046197 + .long 1043437833 + .long 1518338048 + .long 1079605841 + .long 353720209 + .long 1044377011 + .long 2602565632 + .long 1079612851 + .long 1439536878 + .long 1040659594 + .long 127926272 + .long 1079619839 + .long 2552585681 + .long 3189615238 + .long 4148166656 + .long 1079626802 + .long 3229154456 + .long 1043804696 + .long 3307208704 + .long 1079633742 + .long 929259512 + .long 1043517249 + .long 3491758080 + .long 1079640657 + .long 1139819401 + .long 3187965768 + .long 2063597568 + .long 1079647547 + .long 3513262155 + .long 1039670426 + .long 746586112 + .long 1079654411 + .long 182222777 + .long 1043774469 + .long 1331691520 + .long 1079661248 + .long 1320907030 + .long 1044953157 + .long 1384120320 + .long 1079668058 + .long 1308671630 + .long 3191057215 + .long 2826960896 + .long 1079674840 + .long 1061629098 + .long 1044801943 + .long 3365928960 + .long 1079681594 + .long 3915023624 + .long 3192849689 + .long 765460480 + .long 1079688320 + .long 290418758 + .long 3187677511 + .long 1459617792 + .long 1079695016 + .long 4136034317 + .long 3192562624 + .long 3353346048 + .long 1079701682 + .long 1619354403 + .long 1045192474 + .long 136314880 + .long 1079708319 + .long 2007583995 + .long 1042491810 + .long 2738880512 + .long 1079714924 + .long 2705956472 + .long 1045068383 + .long 694157312 + .long 1079721499 + .long 843293277 + .long 3191260267 + .long 778043392 + .long 1079728042 + .long 2901961231 + .long 1042075808 + .long 1251999744 + .long 1079734553 + .long 1190325550 + .long 1043944946 + .long 446693376 + .long 1079741032 + .long 1008852996 + .long 3192696828 + .long 1052770304 + .long 1079747478 + .long 1679886032 + .long 3192874332 + .long 1537212416 + .long 1079753891 + .long 2620146859 + .long 1044934726 + .long 440401920 + .long 1079760271 + .long 1865077452 + .long 1043966132 + .long 658505728 + .long 1079766617 + .long 1552096852 + .long 1045384841 + .long 866123776 + .long 1079772929 + .long 2518581518 + .long 1039154339 + .long 4093640704 + .long 1079779206 + .long 1430947390 + .long 1045301740 + .long 559939584 + .long 1079785450 + .long 514060819 + .long 1044210997 + .long 2019557376 + .long 1079791658 + .long 41710967 + .long 3189176765 + .long 3112173568 + .long 1079797831 + .long 2124167878 + .long 1044447288 + .long 2839543808 + .long 1079803969 + .long 1622551107 + .long 1044827309 + .long 266338304 + .long 1079810072 + .long 3828434628 + .long 3192501419 + .long 3103784960 + .long 1079816138 + .long 2099274145 + .long 1043277518 + .long 1952448512 + .long 1079822169 + .long 2612691399 + .long 1044920099 + .long 356515840 + .long 1079828164 + .long 1171997210 + .long 3192115818 + .long 1914699776 + .long 1079834122 + .long 1393635940 + .long 3191604114 + .long 1698693120 + .long 1079840044 + .long 3000864111 + .long 1044567581 + .long 3428843520 + .long 1079845929 + .long 3891583054 + .long 1044582113 + .long 2290089984 + .long 1079851778 + .long 3752802150 + .long 3191636700 + .long 2109734912 + .long 1079857590 + .long 3035382168 + .long 1043228732 + .long 2480930816 + .long 1079863365 + .long 2565683088 + .long 3192570771 + .long 3042967552 + .long 1079869103 + .long 1405657776 + .long 3191747915 + .long 3491758080 + .long 1079874804 + .long 152088799 + .long 1042154031 + .long 3573547008 + .long 1079880468 + .long 1577179566 + .long 1043010748 + .long 3082813440 + .long 1079886095 + .long 1063445218 + .long 1044285308 + .long 1864368128 + .long 1079891685 + .long 3525309094 + .long 3189988831 + .long 4102029312 + .long 1079897237 + .long 3023722014 + .long 1043994564 + .long 1145044992 + .long 1079902753 + .long 2787570751 + .long 1043345947 + .long 1564475392 + .long 1079908231 + .long 2811467203 + .long 1043838930 + .long 1092616192 + .long 1079913672 + .long 1936866404 + .long 3191863928 + .long 4091543552 + .long 1079919075 + .long 2980113444 + .long 3192905397 + .long 2080374784 + .long 1079924442 + .long 1232510221 + .long 3190881813 + .long 3800039424 + .long 1079929771 + .long 878865976 + .long 1045236413 + .long 851443712 + .long 1079935064 + .long 1134072023 + .long 1045386565 + .long 2051014656 + .long 1079940319 + .long 1008344600 + .long 1044439573 + .long 3368026112 + .long 1079945537 + .long 1281162365 + .long 3192613919 + .long 803209216 + .long 1079950719 + .long 1692530062 + .long 1043648146 + .long 3284140032 + .long 1079955863 + .long 4155795398 + .long 1043918312 + .long 2587885568 + .long 1079960971 + .long 3556863456 + .long 3192106174 + .long 3405774848 + .long 1079966042 + .long 2925970384 + .long 1039575776 + .long 1874853888 + .long 1079971077 + .long 2866881462 + .long 1044616390 + .long 2751463424 + .long 1079976075 + .long 2148760563 + .long 1039453383 + .long 2227175424 + .long 1079981037 + .long 2478710518 + .long 1044662933 + .long 822083584 + .long 1079985963 + .long 527414264 + .long 3192196970 + .long 3370123264 + .long 1079990852 + .long 597131077 + .long 1044444197 + .long 1855979520 + .long 1079995706 + .long 327513079 + .long 3192718825 + .long 1163919360 + .long 1080000524 + .long 2167457950 + .long 3191943119 + .long 1912602624 + .long 1080005306 + .long 2223907458 + .long 1044698143 + .long 450887680 + .long 1080010053 + .long 1797206836 + .long 3192265480 + .long 1730150400 + .long 1080014764 + .long 806768485 + .long 1045029436 + .long 2143289344 + .long 1080019440 + .long 3385731218 + .long 1043691060 + .long 2390753280 + .long 1080024081 + .long 2289432889 + .long 1035999008 + .long 3193962496 + .long 1080028687 + .long 653388941 + .long 3186809946 + .long 998244352 + .long 1080033259 + .long 3139143286 + .long 3191209215 + .long 427819008 + .long 1080035538 + .long 617352675 + .long 3193137764 + .long 1767899136 + .long 1080037789 + .long 2820938545 + .long 1044793929 + .long 2768240640 + .long 1080040023 + .long 1116869194 + .long 1045935239 + .long 3831496704 + .long 1080042240 + .long 2883013420 + .long 3192429127 + .long 1067450368 + .long 1080044441 + .long 716229612 + .long 1045716128 + .long 3485466624 + .long 1080046624 + .long 3427207267 + .long 3192006748 + .long 2912944128 + .long 1080048791 + .long 1797448570 + .long 1045763212 + .long 4074766336 + .long 1080050941 + .long 963007300 + .long 1046072799 + .long 3107979264 + .long 1080053075 + .long 1001194228 + .long 1045849723 + .long 450887680 + .long 1080055193 + .long 3243655263 + .long 3191879277 + .long 838860800 + .long 1080057294 + .long 1225643377 + .long 3190452555 + .long 425721856 + .long 1080059379 + .long 632951086 + .long 3193270660 + .long 3955228672 + .long 1080061447 + .long 928991542 + .long 1043548181 + .long 3294625792 + .long 1080063500 + .long 3229203938 + .long 1042779359 + .long 3196059648 + .long 1080065537 + .long 1071139240 + .long 1044201053 + .long 4120903680 + .long 1080067558 + .long 754552020 + .long 1045844436 + .long 2239758336 + .long 1080069564 + .long 1637692909 + .long 1045134398 + .long 2313158656 + .long 1080071554 + .long 3579217071 + .long 1046240180 + .long 517996544 + .long 1080073529 + .long 3412027605 + .long 3191381190 + .long 1616904192 + .long 1080075488 + .long 2404468057 + .long 1046410024 + .long 1793064960 + .long 1080077432 + .long 3207515339 + .long 3189828782 + .long 1518338048 + .long 1080079361 + .long 847503884 + .long 3191075565 + .long 1270874112 + .long 1080081275 + .long 3556889995 + .long 3193585111 + .long 1526726656 + .long 1080083174 + .long 478427801 + .long 3192682319 + .long 2766143488 + .long 1080085058 + .long 30743511 + .long 3192873887 + .long 1172307968 + .long 1080086928 + .long 1809054730 + .long 1044630197 + .long 1522532352 + .long 1080088783 + .long 2052116880 + .long 3191818486 + .long 0 + .long 1080090624 + .long 0 + .long 0 + .long 2772434944 + .long 1080092464 + .long 2052116880 + .long 1044334838 + .long 3122659328 + .long 1080094319 + .long 1809054730 + .long 3192113845 + .long 1528823808 + .long 1080096189 + .long 30743511 + .long 1045390239 + .long 2768240640 + .long 1080098073 + .long 478427801 + .long 1045198671 + .long 3024093184 + .long 1080099972 + .long 3556889995 + .long 1046101463 + .long 2776629248 + .long 1080101886 + .long 847503884 + .long 1043591917 + .long 2501902336 + .long 1080103815 + .long 3207515339 + .long 1042345134 + .long 2678063104 + .long 1080105759 + .long 2404468057 + .long 3193893672 + .long 3776970752 + .long 1080107718 + .long 3412027605 + .long 1043897542 + .long 1981808640 + .long 1080109693 + .long 3579217071 + .long 3193723828 + .long 2055208960 + .long 1080111683 + .long 1637692909 + .long 3192618046 + .long 174063616 + .long 1080113689 + .long 754552020 + .long 3193328084 + .long 1098907648 + .long 1080115710 + .long 1071139240 + .long 3191684701 + .long 1000341504 + .long 1080117747 + .long 3229203938 + .long 3190263007 + .long 339738624 + .long 1080119800 + .long 928991542 + .long 3191031829 + .long 3869245440 + .long 1080121868 + .long 632951086 + .long 1045787012 + .long 3456106496 + .long 1080123953 + .long 1225643377 + .long 1042968907 + .long 3844079616 + .long 1080126054 + .long 3243655263 + .long 1044395629 + .long 1186988032 + .long 1080128172 + .long 1001194228 + .long 3193333371 + .long 220200960 + .long 1080130306 + .long 963007300 + .long 3193556447 + .long 1382023168 + .long 1080132456 + .long 1797448570 + .long 3193246860 + .long 809500672 + .long 1080134623 + .long 3427207267 + .long 1044523100 + .long 3227516928 + .long 1080136806 + .long 716229612 + .long 3193199776 + .long 463470592 + .long 1080139007 + .long 2883013420 + .long 1044945479 + .long 1526726656 + .long 1080141224 + .long 1116869194 + .long 3193418887 + .long 2527068160 + .long 1080143458 + .long 2820938545 + .long 3192277577 + .long 3867148288 + .long 1080145709 + .long 617352675 + .long 1045654116 + .long 1648361472 + .long 1080147978 + .long 3139143286 + .long 1043725567 + .long 551550976 + .long 1080150264 + .long 2539927630 + .long 3193943182 + .long 952107008 + .long 1080152567 + .long 2289432889 + .long 3183482656 + .long 3223322624 + .long 1080154887 + .long 3385731218 + .long 3191174708 + .long 3428843520 + .long 1080157225 + .long 3891583054 + .long 1045630689 + .long 1923088384 + .long 1080159581 + .long 3396363878 + .long 3193238139 + .long 3338665984 + .long 1080161954 + .long 2223907458 + .long 3192181791 + .long 3714056192 + .long 1080164345 + .long 1063754673 + .long 3193399320 + .long 3368026112 + .long 1080166754 + .long 1983727109 + .long 3193011467 + .long 2608857088 + .long 1080169181 + .long 1848918109 + .long 1045923309 + .long 1736441856 + .long 1080171626 + .long 527414264 + .long 1044713322 + .long 1033895936 + .long 1080174089 + .long 2478710518 + .long 3192146581 + .long 771751936 + .long 1080176570 + .long 2148760563 + .long 3186937031 + .long 1210056704 + .long 1080179069 + .long 2866881462 + .long 3192100038 + .long 2592079872 + .long 1080181586 + .long 2925970384 + .long 3187059424 + .long 853540864 + .long 1080184122 + .long 3556863456 + .long 1044622526 + .long 505413632 + .long 1080186676 + .long 4155795398 + .long 3191401960 + .long 1744830464 + .long 1080189248 + .long 1724351133 + .long 1046137947 + .long 463470592 + .long 1080191839 + .long 1281162365 + .long 1045130271 + .long 1121976320 + .long 1080194448 + .long 1008344600 + .long 3191923221 + .long 3869245440 + .long 1080197075 + .long 1134072023 + .long 3192870213 + .long 247463936 + .long 1080199722 + .long 878865976 + .long 3192720061 + .long 3254779904 + .long 1080202386 + .long 1232510221 + .long 1043398165 + .long 102760448 + .long 1080205070 + .long 657426926 + .long 3192918181 + .long 3749707776 + .long 1080207771 + .long 3810750695 + .long 3193438561 + .long 1365245952 + .long 1080210492 + .long 2811467203 + .long 3191322578 + .long 1574961152 + .long 1080213231 + .long 2787570751 + .long 3190829595 + .long 96468992 + .long 1080215989 + .long 3023722014 + .long 3191478212 + .long 1216348160 + .long 1080218765 + .long 96207275 + .long 3193803844 + .long 606076928 + .long 1080221560 + .long 1063445218 + .long 3191768956 + .long 2508193792 + .long 1080224373 + .long 1577179566 + .long 3190494396 + .long 2548039680 + .long 1080227205 + .long 258929906 + .long 1046355933 + .long 627048448 + .long 1080230056 + .long 722327380 + .long 3193467565 + .long 908066816 + .long 1080232925 + .long 864642104 + .long 3193085494 + .long 3240099840 + .long 1080235812 + .long 3035382168 + .long 3190712380 + .long 3149922304 + .long 1080238718 + .long 3752802150 + .long 1044153052 + .long 432013312 + .long 1080241643 + .long 201692121 + .long 1045854351 + .long 3445620736 + .long 1080244585 + .long 3000864111 + .long 3192051229 + .long 3338665984 + .long 1080247546 + .long 1799074663 + .long 3193503515 + .long 4116709376 + .long 1080250525 + .long 1171997210 + .long 1044632170 + .long 1170210816 + .long 1080253523 + .long 841137948 + .long 1045685358 + .long 2743074816 + .long 1080256538 + .long 2099274145 + .long 3190761166 + .long 4162846720 + .long 1080259571 + .long 233266334 + .long 3193120170 + .long 727711744 + .long 1080262623 + .long 1622551107 + .long 3192310957 + .long 591396864 + .long 1080265692 + .long 2124167878 + .long 3191930936 + .long 3286237184 + .long 1080268778 + .long 802699433 + .long 3193868388 + .long 4013948928 + .long 1080271882 + .long 3092710267 + .long 1045997234 + .long 2248146944 + .long 1080275004 + .long 1430947390 + .long 3192785388 + .long 1713373184 + .long 1080278143 + .long 1906804220 + .long 1046462221 + .long 1818230784 + .long 1080281299 + .long 1552096852 + .long 3192868489 + .long 1927282688 + .long 1080284472 + .long 1865077452 + .long 3191449780 + .long 1377828864 + .long 1080287662 + .long 2984893867 + .long 1045678044 + .long 3768582144 + .long 1080290868 + .long 1679886032 + .long 1045390684 + .long 4072669184 + .long 1080294091 + .long 3790540798 + .long 3193022465 + .long 1520435200 + .long 1080297331 + .long 1849902261 + .long 1046063747 + .long 3904897024 + .long 1080300586 + .long 4113594719 + .long 1046360821 + .long 1801453568 + .long 1080303858 + .long 862918505 + .long 3193589477 + .long 2925527040 + .long 1080307145 + .long 2705956472 + .long 3192552031 + .long 2078277632 + .long 1080310448 + .long 2970277473 + .long 1046321867 + .long 2617245696 + .long 1080313766 + .long 3485290095 + .long 1045549170 + .long 3565158400 + .long 1080317099 + .long 4136034317 + .long 1045078976 + .long 3913285632 + .long 1080320447 + .long 3346367614 + .long 3193929525 + .long 2613051392 + .long 1080323810 + .long 189971836 + .long 3192946035 + .long 2881486848 + .long 1080327187 + .long 1061629098 + .long 3192285591 + .long 3602907136 + .long 1080330578 + .long 1308671630 + .long 1043573567 + .long 3628072960 + .long 1080333983 + .long 1487030133 + .long 1045668829 + .long 1774190592 + .long 1080337402 + .long 182222777 + .long 3191258117 + .long 1115684864 + .long 1080340834 + .long 3513262155 + .long 3187154074 + .long 402653184 + .long 1080344279 + .long 3185606116 + .long 3193920517 + .long 2640314368 + .long 1080347736 + .long 2988910594 + .long 1046170671 + .long 2220883968 + .long 1080351206 + .long 3229154456 + .long 3191288344 + .long 2084569088 + .long 1080354688 + .long 2524817955 + .long 3193840983 + .long 845152256 + .long 1080358182 + .long 2907804489 + .long 1046431323 + .long 1388314624 + .long 1080361687 + .long 353720209 + .long 3191860659 + .long 2262827008 + .long 1080365203 + .long 2411046197 + .long 3190921481 + .long 1992294400 + .long 1080368730 + .long 2416617371 + .long 1045845156 + .long 3368026112 + .long 1080372267 + .long 1729552362 + .long 3193600084 + .long 553648128 + .long 1080375815 + .long 1240754629 + .long 1045055957 + .long 578813952 + .long 1080379372 + .long 1534601222 + .long 1045263230 + .long 1851785216 + .long 1080382938 + .long 858184436 + .long 3193846404 + .long 2749366272 + .long 1080386513 + .long 3924779397 + .long 1045089235 + .long 1631584256 + .long 1080390097 + .long 3287244582 + .long 1042979553 + .long 1121976320 + .long 1080393689 + .long 820395291 + .long 3190740781 + .long 3821010944 + .long 1080397288 + .long 1464050323 + .long 1045747196 + .long 3720347648 + .long 1080400895 + .long 766171506 + .long 3193077736 + .long 3372220416 + .long 1080404509 + .long 1845586757 + .long 1044548329 + .long 1021313024 + .long 1080408130 + .long 266334603 + .long 3192956204 + .long 3474980864 + .long 1080411756 + .long 3683913357 + .long 1045057884 + .long 348127232 + .long 1080415389 + .long 3556619028 + .long 1046050228 + .long 2711617536 + .long 1080419026 + .long 1034464320 + .long 3191720696 + .long 142606336 + .long 1080422669 + .long 1545623586 + .long 3193875611 + .long 3678404608 + .long 1080426315 + .long 19850279 + .long 1042922258 + .long 2873098240 + .long 1080429966 + .long 2000406456 + .long 3193113382 + .long 146800640 + .long 1080433621 + .long 1192966610 + .long 3192379901 + .long 2206203904 + .long 1080437278 + .long 2665338290 + .long 1046286557 + .long 2866806784 + .long 1080440938 + .long 3963433176 + .long 1043378887 + .long 224395264 + .long 1080444601 + .long 2261136335 + .long 1044042197 + .long 962592768 + .long 1080448265 + .long 2527275953 + .long 3193123692 + .long 3164602368 + .long 1080451930 + .long 2506574977 + .long 1045666274 + .long 620756992 + .long 1080455597 + .long 2392508272 + .long 1045936992 + .long 0 + .long 1080459264 + .long 0 + .long 0 + .type __libm_atandl_table_128,@object + .size __libm_atandl_table_128,8208 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/atanf_gen.S b/external/sgx_libm/intel64/atanf_gen.S new file mode 100644 index 0000000000..2a715bf18b --- /dev/null +++ b/external/sgx_libm/intel64/atanf_gen.S @@ -0,0 +1,338 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanf_gen.c" + .text +..TXTST0: +# -- Begin atanf + .text + .align 16,0x90 + .globl atanf +atanf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_atanf.1: +..L2: + + pxor %xmm5, %xmm5 + movd %xmm0, %edx + cvtss2sd %xmm0, %xmm5 + movl %edx, %eax + andl $2147483647, %eax + cmpl $1300234240, %eax + jae ..B1.14 +..B1.2: + cmpl $1073741824, %eax + jae ..B1.13 +..B1.3: + cmpl $1056964608, %eax + jae ..B1.12 +..B1.4: + cmpl $964689920, %eax + jae ..B1.11 +..B1.5: + shrl $31, %edx + cmpl $8388608, %eax + jb ..B1.7 +..B1.6: + movl %edx, %edx + lea _small_value_32(%rip), %rax + movss (%rax,%rdx,4), %xmm1 + mulss .L_2il0floatpacket.17(%rip), %xmm1 + subss %xmm1, %xmm0 + ret +..B1.7: + testl %eax, %eax + je ..B1.10 +..B1.8: + lea _small_value_32(%rip), %rax + pxor %xmm1, %xmm1 + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.17(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm1 + subsd %xmm0, %xmm5 + pxor %xmm0, %xmm0 + movss %xmm1, -8(%rsp) + cvtsd2ss %xmm5, %xmm0 +..B1.10: + ret +..B1.11: + movaps %xmm5, %xmm1 + mulsd %xmm5, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.4(%rip), %xmm2 + mulsd %xmm0, %xmm2 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.1(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.6(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.2(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.3(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.8(%rip), %xmm2 + mulsd %xmm1, %xmm2 + pxor %xmm0, %xmm0 + addsd %xmm2, %xmm3 + mulsd %xmm5, %xmm3 + subsd %xmm3, %xmm5 + cvtsd2ss %xmm5, %xmm0 + ret +..B1.12: + andps .L_2il0floatpacket.19(%rip), %xmm5 + testl $-2147483648, %edx + movsd .L_2il0floatpacket.9(%rip), %xmm4 + movsd .L_2il0floatpacket.18(%rip), %xmm1 + addsd %xmm5, %xmm4 + addsd %xmm1, %xmm5 + divsd %xmm5, %xmm4 + movaps %xmm4, %xmm0 + mulsd %xmm4, %xmm0 + movaps %xmm0, %xmm2 + mulsd %xmm0, %xmm2 + movsd .L_2il0floatpacket.10(%rip), %xmm5 + mulsd %xmm2, %xmm5 + movsd .L_2il0floatpacket.13(%rip), %xmm3 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.11(%rip), %xmm5 + mulsd %xmm2, %xmm5 + addsd .L_2il0floatpacket.14(%rip), %xmm3 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.12(%rip), %xmm5 + mulsd %xmm0, %xmm5 + addsd .L_2il0floatpacket.15(%rip), %xmm3 + addsd %xmm3, %xmm5 + mulsd %xmm4, %xmm5 + addsd .L_2il0floatpacket.16(%rip), %xmm5 + movaps %xmm5, %xmm0 + xorps .L_2il0floatpacket.20(%rip), %xmm0 + jne ..L3 + movaps %xmm5, %xmm0 +..L3: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.13: + movsd .L_2il0floatpacket.18(%rip), %xmm2 + lea pi_2d(%rip), %rax + divsd %xmm5, %xmm2 + movaps %xmm2, %xmm0 + mulsd %xmm2, %xmm0 + movaps %xmm0, %xmm5 + mulsd %xmm0, %xmm5 + movsd .L_2il0floatpacket.4(%rip), %xmm1 + mulsd %xmm5, %xmm1 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + mulsd %xmm5, %xmm3 + addsd .L_2il0floatpacket.5(%rip), %xmm1 + mulsd %xmm5, %xmm1 + addsd .L_2il0floatpacket.1(%rip), %xmm3 + mulsd %xmm5, %xmm3 + addsd .L_2il0floatpacket.6(%rip), %xmm1 + mulsd %xmm5, %xmm1 + addsd .L_2il0floatpacket.2(%rip), %xmm3 + mulsd %xmm5, %xmm3 + addsd .L_2il0floatpacket.7(%rip), %xmm1 + mulsd %xmm5, %xmm1 + addsd .L_2il0floatpacket.3(%rip), %xmm3 + mulsd %xmm5, %xmm3 + addsd .L_2il0floatpacket.8(%rip), %xmm1 + mulsd %xmm0, %xmm1 + shrl $31, %edx + addsd %xmm1, %xmm3 + movsd (%rax,%rdx,8), %xmm0 + mulsd %xmm2, %xmm3 + subsd %xmm2, %xmm0 + addsd %xmm3, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.14: + cmpl $2139095040, %eax + ja ..B1.17 +..B1.15: + lea pi_2f(%rip), %rax + lea _small_value_32(%rip), %rcx + shrl $31, %edx + movss (%rax,%rdx,4), %xmm0 + subss (%rcx,%rdx,4), %xmm0 +..B1.17: + ret + .align 16,0x90 + .cfi_endproc + .type atanf,@function + .size atanf,.-atanf + .data +# -- End atanf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.19: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,16 + .align 16 +.L_2il0floatpacket.20: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,16 + .align 8 +.L_2il0floatpacket.0: + .long 0xd091d944,0xbf9ca14d + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x12effb80,0xbfb28de9 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0xcda40e6e,0xbfbc6a7e + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x1185f36d,0xbfc99997 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x3cb73089,0x3f7fa335 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x44053df6,0x3faac31f + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x1cf194fa,0x3fb70b87 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xb177868e,0x3fc248e0 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x509fdfb1,0x3fd55555 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0xd9d9aa33,0xbfb1c1c0 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x04ba093e,0xbfc24485 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x312dd43c,0xbfd55555 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x947e6edc,0x3fbbcbeb + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x700fa0b3,0x3fc9997b + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +.L_2il0floatpacket.15: + .long 0xfff8f7db,0x3fefffff + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,8 + .align 8 +.L_2il0floatpacket.16: + .long 0x54442d18,0x3fe921fb + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,8 + .align 8 +.L_2il0floatpacket.18: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,8 + .align 8 +pi_2d: + .long 0x54442d18,0x3ff921fb + .long 0x54442d18,0xbff921fb + .type pi_2d,@object + .size pi_2d,16 + .align 4 +.L_2il0floatpacket.17: + .long 0x0d800000 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +pi_2f: + .long 0x3fc90fdb + .long 0xbfc90fdb + .type pi_2f,@object + .size pi_2f,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atanh_gen.S b/external/sgx_libm/intel64/atanh_gen.S new file mode 100644 index 0000000000..e0be35a646 --- /dev/null +++ b/external/sgx_libm/intel64/atanh_gen.S @@ -0,0 +1,360 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanh_gen.c" + .text +..TXTST0: +# -- Begin atanh + .text + .align 16,0x90 + .globl atanh +atanh: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_atanh.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %esi + movl %esi, %edx + andl $2147483647, %edx + cmpl $1072693248, %edx + jae ..B1.12 +..B1.2: + cmpl $1068498944, %edx + jae ..B1.11 +..B1.3: + cmpl $1012924416, %edx + jae ..B1.10 +..B1.4: + shrl $31, %esi + cmpl $1048576, %edx + jb ..B1.6 +..B1.5: + lea _ones(%rip), %rax + movsd (%rax), %xmm1 + addsd %xmm0, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm2 + mulsd %xmm2, %xmm0 + ret +..B1.6: + movl -8(%rsp), %eax + orl %eax, %edx + je ..B1.8 +..B1.7: + lea _small_value_64(%rip), %rax + movsd -8(%rsp), %xmm0 + movsd (%rax,%rsi,8), %xmm1 + mulsd (%rax), %xmm1 + movsd %xmm1, -40(%rsp) + addsd %xmm1, %xmm0 + ret +..B1.8: + movsd -8(%rsp), %xmm0 +..B1.9: + ret +..B1.10: + movsd -8(%rsp), %xmm4 + lea 40+_PA(%rip), %rax + movaps %xmm4, %xmm3 + lea 32+_PA(%rip), %rsi + mulsd %xmm4, %xmm3 + lea 24+_PA(%rip), %rdx + movaps %xmm3, %xmm1 + lea 16+_PA(%rip), %rdi + mulsd %xmm3, %xmm1 + lea 8+_PA(%rip), %rcx + movsd (%rax), %xmm0 + lea _PA(%rip), %r8 + mulsd %xmm1, %xmm0 + movsd (%rsi), %xmm2 + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm0 + mulsd %xmm1, %xmm0 + addsd (%rdi), %xmm2 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm0 + mulsd %xmm3, %xmm0 + addsd (%r8), %xmm2 + addsd %xmm2, %xmm0 + mulsd %xmm4, %xmm0 + mulsd %xmm3, %xmm0 + addsd %xmm4, %xmm0 + ret +..B1.11: + movsd -8(%rsp), %xmm9 + lea 8+_ones(%rip), %rdi + andps .L_2il0floatpacket.0(%rip), %xmm9 + lea _ones(%rip), %r8 + movsd %xmm9, -8(%rsp) + movq $0x3ff0000000000000, %r10 + andl $-268435456, -8(%rsp) + pxor %xmm15, %xmm15 + movsd -8(%rsp), %xmm12 + movsd (%rdi), %xmm0 + movaps %xmm12, %xmm6 + movaps %xmm0, %xmm8 + lea 32+_PL(%rip), %rdi + movsd (%r8), %xmm4 + lea 16+_PL(%rip), %r8 + movq __libm_rcp_table_256@GOTPCREL(%rip), %rax + addsd %xmm0, %xmm6 + subsd %xmm12, %xmm9 + addsd %xmm4, %xmm12 + movaps %xmm6, %xmm2 + movaps %xmm6, %xmm5 + movaps %xmm9, %xmm3 + movaps %xmm12, %xmm1 + shrl $31, %esi + addsd %xmm9, %xmm2 + divsd %xmm2, %xmm8 + movsd %xmm8, -32(%rsp) + pxor %xmm2, %xmm2 + andl $-268435456, -32(%rsp) + movsd -32(%rsp), %xmm10 + movaps %xmm10, %xmm7 + subsd %xmm10, %xmm8 + mulsd %xmm10, %xmm6 + mulsd %xmm10, %xmm12 + mulsd %xmm8, %xmm5 + addsd %xmm8, %xmm7 + addsd %xmm4, %xmm6 + mulsd %xmm7, %xmm3 + addsd %xmm3, %xmm5 + addsd %xmm5, %xmm6 + mulsd %xmm6, %xmm7 + addsd %xmm7, %xmm8 + mulsd %xmm8, %xmm1 + addsd %xmm10, %xmm8 + mulsd %xmm8, %xmm9 + addsd %xmm9, %xmm1 + movaps %xmm1, %xmm11 + addsd %xmm12, %xmm11 + movsd %xmm11, -8(%rsp) + movl $0, -8(%rsp) + movsd -8(%rsp), %xmm3 + movl -4(%rsp), %ecx + subsd %xmm3, %xmm12 + sarl $20, %ecx + addsd %xmm12, %xmm1 + addl $-1023, %ecx + movslq %ecx, %r9 + shlq $52, %r9 + subq %r9, %r10 + lea _PL(%rip), %r9 + movq %r10, -24(%rsp) + lea 24+_PL(%rip), %r10 + movsd -24(%rsp), %xmm13 + mulsd %xmm13, %xmm1 + cvtsi2sd %ecx, %xmm2 + mulsd %xmm13, %xmm3 + movaps %xmm1, %xmm14 + lea _LN2(%rip), %rcx + movsd (%r10), %xmm13 + addsd %xmm3, %xmm14 + movsd %xmm14, -16(%rsp) + movl -12(%rsp), %r11d + shrl $12, %r11d + movzbl %r11b, %edx + lea 8+_PL(%rip), %r11 + movsd (%rdi), %xmm14 + cvtss2sd (%rax,%rdx,4), %xmm15 + mulsd %xmm15, %xmm3 + mulsd %xmm15, %xmm1 + addsd %xmm0, %xmm3 + movaps %xmm3, %xmm12 + shlq $4, %rdx + addsd %xmm1, %xmm12 + movaps %xmm12, %xmm0 + mulsd %xmm12, %xmm0 + mulsd %xmm0, %xmm14 + mulsd %xmm0, %xmm13 + addsd (%r8), %xmm14 + addsd (%r11), %xmm13 + mulsd %xmm0, %xmm14 + mulsd %xmm0, %xmm13 + addsd (%r9), %xmm14 + mulsd %xmm12, %xmm13 + mulsd %xmm0, %xmm14 + movsd (%rcx), %xmm0 + lea halfs(%rip), %rcx + mulsd %xmm2, %xmm0 + addsd %xmm13, %xmm14 + movq __libm_log_table_256@GOTPCREL(%rip), %rax + addsd %xmm14, %xmm1 + addsd (%rax,%rdx), %xmm0 + movsd (%rcx,%rsi,8), %xmm4 + lea 8+_LN2(%rip), %rcx + movsd %xmm4, -16(%rsp) + addsd %xmm1, %xmm0 + movsd (%rcx), %xmm1 + mulsd %xmm1, %xmm2 + addsd 8(%rax,%rdx), %xmm2 + movsd %xmm2, -32(%rsp) + addsd %xmm2, %xmm3 + movsd %xmm3, -8(%rsp) + addsd %xmm3, %xmm0 + mulsd %xmm4, %xmm0 + ret +..B1.12: + jne ..B1.15 +..B1.13: + cmpl $0, -8(%rsp) + je ..B1.19 +..B1.14: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + ret +..B1.15: + cmpl $2146435072, %edx + jb ..B1.14 +..B1.16: + jne ..B1.18 +..B1.17: + cmpl $0, -8(%rsp) + je ..B1.14 +..B1.18: + lea _ones(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + ret +..B1.19: + lea _ones(%rip), %rax + lea _zeros(%rip), %rdx + shrl $31, %esi + movsd (%rax,%rsi,8), %xmm0 + divsd (%rdx), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type atanh,@function + .size atanh,.-atanh + .data +# -- End atanh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 8 +halfs: + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbfe00000 + .type halfs,@object + .size halfs,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_PA: + .long 1431655765 + .long 1070945621 + .long 2576980801 + .long 1070176665 + .long 2453616913 + .long 1069697316 + .long 1427436931 + .long 1069314503 + .long 2129349532 + .long 1068975486 + .long 1629438381 + .long 1068756329 + .type _PA,@object + .size _PA,48 + .align 4 +_PL: + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .type _PL,@object + .size _PL,40 + .align 4 +_LN2: + .long 897137782 + .long 1038760431 + .long 4276092928 + .long 1072049730 + .type _LN2,@object + .size _LN2,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atanhf_gen.S b/external/sgx_libm/intel64/atanhf_gen.S new file mode 100644 index 0000000000..1ea90340e4 --- /dev/null +++ b/external/sgx_libm/intel64/atanhf_gen.S @@ -0,0 +1,324 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanhf_gen.c" + .text +..TXTST0: +# -- Begin atanhf + .text + .align 16,0x90 + .globl atanhf +atanhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_atanhf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -16(%rsp) + movl %edx, %eax + andl $2147483647, %eax + cmpl $1065353216, %eax + jae ..B1.12 +..B1.2: + cmpl $1056964608, %eax + jae ..B1.11 +..B1.3: + cmpl $838860800, %eax + jae ..B1.10 +..B1.4: + shrl $31, %edx + cmpl $8388608, %eax + jb ..B1.6 +..B1.5: + movss .L_2il0floatpacket.15(%rip), %xmm1 + addss %xmm0, %xmm1 + mulss %xmm1, %xmm0 + ret +..B1.6: + testl %eax, %eax + je ..B1.8 +..B1.7: + lea _small_value_32(%rip), %rax + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + cvtss2sd -16(%rsp), %xmm2 + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.14(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm1 + addsd %xmm0, %xmm2 + pxor %xmm0, %xmm0 + movss %xmm1, -40(%rsp) + cvtsd2ss %xmm2, %xmm0 + ret +..B1.8: + movss -16(%rsp), %xmm0 +..B1.9: + ret +..B1.10: + pxor %xmm3, %xmm3 + cvtss2sd -16(%rsp), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.5(%rip), %xmm4 + movsd .L_2il0floatpacket.9(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.6(%rip), %xmm4 + addsd .L_2il0floatpacket.10(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + addsd .L_2il0floatpacket.11(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.8(%rip), %xmm4 + addsd .L_2il0floatpacket.12(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 + cvtsd2ss %xmm4, %xmm4 + movaps %xmm4, %xmm0 + ret +..B1.11: + pxor %xmm1, %xmm1 + pxor %xmm4, %xmm4 + cvtss2sd -16(%rsp), %xmm1 + movsd .L_2il0floatpacket.16(%rip), %xmm2 + pxor %xmm6, %xmm6 + movaps %xmm2, %xmm0 + pxor %xmm8, %xmm8 + movq __libm_rcp_table_256@GOTPCREL(%rip), %r9 + addsd %xmm1, %xmm0 + subsd %xmm1, %xmm2 + movsd %xmm0, -32(%rsp) + movsd %xmm2, -24(%rsp) + movzwl -26(%rsp), %ecx + movl %ecx, %eax + movzwl -18(%rsp), %esi + movl %esi, %edx + andl $-32753, %ecx + andl $-32753, %esi + orl $-49168, %ecx + orl $-49168, %esi + movw %cx, -26(%rsp) + andl $32752, %eax + movw %si, -18(%rsp) + andl $32752, %edx + movl -28(%rsp), %edi + movl -20(%rsp), %r8d + andl $1048575, %edi + andl $1048575, %r8d + shrl $12, %edi + shrl $12, %r8d + cvtss2sd (%r9,%rdi,4), %xmm4 + cvtss2sd (%r9,%r8,4), %xmm6 + mulsd -32(%rsp), %xmm4 + mulsd -24(%rsp), %xmm6 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + movsd .L_2il0floatpacket.1(%rip), %xmm7 + addsd %xmm3, %xmm4 + addsd %xmm3, %xmm6 + movaps %xmm7, %xmm0 + mulsd %xmm4, %xmm0 + mulsd %xmm6, %xmm7 + movsd .L_2il0floatpacket.2(%rip), %xmm5 + shrl $4, %eax + addsd %xmm5, %xmm0 + addsd %xmm5, %xmm7 + mulsd %xmm4, %xmm0 + mulsd %xmm6, %xmm7 + mulsd %xmm4, %xmm0 + mulsd %xmm6, %xmm7 + addsd %xmm4, %xmm0 + addsd %xmm6, %xmm7 + shrl $4, %edx + addl $-1023, %eax + addl $-1023, %edx + subsd %xmm7, %xmm0 + subl %edx, %eax + cvtsi2sd %eax, %xmm8 + movq __libm_logf_table_256@GOTPCREL(%rip), %r10 + mulsd .L_2il0floatpacket.3(%rip), %xmm8 + movsd (%r10,%rdi,8), %xmm9 + movsd %xmm4, -32(%rsp) + movsd %xmm6, -24(%rsp) + subsd (%r10,%r8,8), %xmm9 + addsd %xmm8, %xmm9 + addsd %xmm9, %xmm0 + mulsd .L_2il0floatpacket.4(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.12: + cmpl $2139095040, %eax + ja ..B1.17 +..B1.13: + cmpl $1065353216, %eax + jne ..B1.15 +..B1.14: + lea _ones(%rip), %rax + shrl $31, %edx + pxor %xmm1, %xmm1 + movss (%rax,%rdx,4), %xmm0 + divss %xmm1, %xmm0 + ret +..B1.15: + movss .L_2il0floatpacket.13(%rip), %xmm1 + pxor %xmm0, %xmm0 + mulss %xmm1, %xmm0 +..B1.16: + ret +..B1.17: + movss -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type atanhf,@function + .size atanhf,.-atanhf + .data +# -- End atanhf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x6890dd10,0x3fd5555a + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0xe7362feb,0xbfe00001 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0xfefa39ef,0x3fe62e42 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x1c66784b,0x3fc717fd + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xdc2b5888,0x3fb8b0df + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x5a00faf0,0x3fbc8408 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x9016c8e5,0x3fc9999c + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x10091234,0xbf68c8ed + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x64e392ec,0x3fb67c91 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0xb0fd5c67,0x3fc248ae + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x51abeffb,0x3fd55555 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.16: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,8 + .align 4 +.L_2il0floatpacket.13: + .long 0x7f800000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,4 + .align 4 +.L_2il0floatpacket.14: + .long 0x0d800000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,4 + .align 4 +.L_2il0floatpacket.15: + .long 0x3f800000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atanhl.S b/external/sgx_libm/intel64/atanhl.S new file mode 100644 index 0000000000..c8b2dea87b --- /dev/null +++ b/external/sgx_libm/intel64/atanhl.S @@ -0,0 +1,966 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanhl.c" + .text +..TXTST0: +# -- Begin atanhl + .text + .align 16,0x90 + .globl atanhl +atanhl: +# parameter 1: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_atanhl.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %cl, %cl +..B1.2: + fnstcw 50(%rsp) +..B1.3: + movzwl 72(%rsp), %esi + andl $32767, %esi + movzwl 50(%rsp), %eax + cmpl $16383, %esi + jge ..B1.53 +..B1.4: + cmpl $16381, %esi + jge ..B1.46 +..B1.5: + cmpl $16376, %esi + jge ..B1.39 +..B1.6: + cmpl $16371, %esi + jge ..B1.32 +..B1.7: + cmpl $16365, %esi + jge ..B1.25 +..B1.8: + cmpl $16308, %esi + jge ..B1.18 +..B1.9: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.13 +..B1.10: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.11: + fldcw 48(%rsp) +..B1.12: + movzwl 72(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.13: + testl %esi, %esi + jle ..B1.64 +..B1.14: + fldt 64(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + faddp %st, %st(1) + fmull (%rdx) + fstpt (%rsp) +..B1.15: + testb %cl, %cl + je ..B1.17 +..B1.16: + fldcw 50(%rsp) +..B1.17: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.18: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.22 +..B1.19: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.20: + fldcw 48(%rsp) +..B1.21: + movb $1, %cl +..B1.22: + fldt 64(%rsp) + lea _Q3(%rip), %rax + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 50(%rsp) +..B1.24: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.25: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.29 +..B1.26: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.27: + fldcw 48(%rsp) +..B1.28: + movb $1, %cl +..B1.29: + fldt 64(%rsp) + lea 16+_Q2(%rip), %rax + fld %st(0) + lea _Q2(%rip), %rdx + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.31 +..B1.30: + fldcw 50(%rsp) +..B1.31: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.32: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.36 +..B1.33: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.34: + fldcw 48(%rsp) +..B1.35: + movb $1, %cl +..B1.36: + fldt 64(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rsi + fmul %st(1), %st + lea 16+_Q1(%rip), %rdx + fld %st(0) + lea _Q1(%rip), %rdi + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.38 +..B1.37: + fldcw 50(%rsp) +..B1.38: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.39: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.43 +..B1.40: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.41: + fldcw 48(%rsp) +..B1.42: + movb $1, %cl +..B1.43: + fldt 64(%rsp) + lea _TWO_52H(%rip), %rax + lea 176+_Q(%rip), %rdx + lea 144+_Q(%rip), %rsi + lea 112+_Q(%rip), %rdi + lea 80+_Q(%rip), %r8 + lea 48+_Q(%rip), %r9 + lea 160+_Q(%rip), %r11 + fldl (%rax) + lea 16+_Q(%rip), %r10 + fmul %st(1), %st + lea 128+_Q(%rip), %rax + fld %st(0) + testb %cl, %cl + fadd %st(2), %st + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(1) + fmul %st(1), %st + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fmul %st, %st(2) + fld %st(1) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fldt (%rdx) + fmul %st(1), %st + lea 96+_Q(%rip), %rdx + fldt (%rsi) + lea 64+_Q(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + lea 32+_Q(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea _Q(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + lea 208+_Q(%rip), %r9 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + lea 192+_Q(%rip), %r10 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + lea _TWO_48H(%rip), %r11 + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r8) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt (%r9) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(2) + fldt (%r10) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 32(%rsp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fldt 16(%rsp) + fld %st(0) + fldl (%r11) + fadd %st, %st(3) + fsubrp %st, %st(3) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fldt 64(%rsp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(2) + fldt (%rsp) + fmul %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.45 +..B1.44: + fldcw 50(%rsp) +..B1.45: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.46: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.50 +..B1.47: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.48: + fldcw 48(%rsp) +..B1.49: + movb $1, %cl +..B1.50: + fldt 64(%rsp) + lea _ones(%rip), %rdi + movb 73(%rsp), %sil + lea _TWO_48H(%rip), %r8 + andb $-128, %sil + shrb $7, %sil + fldl (%rdi) + fld %st(0) + fld %st(1) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fldl (%r8) + movzbl %sil, %edx + lea 48+_P(%rip), %r8 + movzwl 24(%rsp), %r10d + andl $-32768, %r10d + fxch %st(4) + fmull (%rdi,%rdx,8) + lea 80+_P(%rip), %rdi + fsubr %st, %st(2) + fld %st(2) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fsubr %st(2), %st + fsub %st(1), %st + fld %st(3) + fadd %st(1), %st + fxch %st(2) + fadd %st, %st(5) + fld %st(5) + fmul %st(7), %st + fadd %st, %st(6) + fsubrp %st, %st(6) + fxch %st(5) + fstpt (%rsp) + fldt (%rsp) + fsubr %st(3), %st + faddp %st, %st(5) + fld %st(1) + fdivr %st(3), %st + fmul %st, %st(6) + fld %st(0) + fadd %st(7), %st + fsubp %st, %st(7) + fxch %st(1) + fmul %st(6), %st + fld %st(1) + fsub %st(7), %st + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(4) + fmul %st(6), %st + fsubrp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fldt (%rsp) + fadd %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 64(%rsp) + fldt (%rdi) + lea 32+_P(%rip), %rdi + fldt (%r8) + lea _P(%rip), %r8 + movzwl 72(%rsp), %esi + andl $32767, %esi + movl %esi, %r9d + addl $-16383, %esi + negl %r9d + addl $-2, %r9d + andl $32767, %r9d + orl %r9d, %r10d + movw %r10w, 24(%rsp) + lea 8+_ones(%rip), %r10 + fldt 16(%rsp) + movl 68(%rsp), %r11d + shrl $23, %r11d + fmul %st, %st(3) + fmulp %st, %st(4) + movzbl %r11b, %eax + lea 16+_P(%rip), %r11 + movq __libm_rcp_table_256@GOTPCREL(%rip), %r9 + movl %esi, 32(%rsp) + lea 64+_P(%rip), %rsi + fildl 32(%rsp) + fxch %st(3) + fmuls (%r9,%rax,4) + fxch %st(4) + fmuls (%r9,%rax,4) + fxch %st(4) + faddl (%r10) + fld %st(0) + shlq $4, %rax + fadd %st(5), %st + fld %st(0) + testb %cl, %cl + fmul %st(1), %st + fmul %st, %st(4) + movq __libm_logl_table_256@GOTPCREL(%rip), %r9 + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%r11) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fldt (%rsi) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fmul %st(2), %st + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(3) + faddl 8(%r9,%rax) + faddp %st, %st(3) + fxch %st(1) + faddl (%rax,%r9) + lea halfs(%rip), %rax + faddp %st, %st(1) + faddp %st, %st(1) + fmull (%rax,%rdx,8) + fstpt (%rsp) + je ..B1.52 +..B1.51: + fldcw 50(%rsp) +..B1.52: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.53: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.57 +..B1.54: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.55: + fldcw 48(%rsp) +..B1.56: + movzwl 72(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.57: + cmpl $32767, %esi + jl ..B1.68 +..B1.58: + cmpl $-2147483648, 68(%rsp) + jne ..B1.60 +..B1.59: + cmpl $0, 64(%rsp) + je ..B1.68 +..B1.60: + fldt 64(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.61: + testb %cl, %cl + je ..B1.63 +..B1.62: + fldcw 50(%rsp) +..B1.63: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.64: + cmpl $0, 68(%rsp) + jne ..B1.66 +..B1.65: + cmpl $0, 64(%rsp) + je ..B1.67 +..B1.66: + fldt 64(%rsp) + lea _small_value_80(%rip), %rsi + movb 73(%rsp), %al + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %edx + shlq $4, %rdx + fldt (%rsi,%rdx) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.67: + fldt 64(%rsp) + fstpt (%rsp) + jmp ..B1.15 +..B1.68: + cmpl $16383, %esi + jne ..B1.72 +..B1.69: + cmpl $-2147483648, 68(%rsp) + jne ..B1.72 +..B1.70: + cmpl $0, 64(%rsp) + jne ..B1.72 +..B1.71: + movb 73(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + lea _zeros(%rip), %rdi + shrb $7, %al + movzbl %al, %esi + movsd (%rdx,%rsi,8), %xmm0 + divsd (%rdi), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt (%rsp) + jmp ..B1.61 +..B1.72: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt (%rsp) + jmp ..B1.61 + .align 16,0x90 + .cfi_endproc + .type atanhl,@function + .size atanhl,.-atanhl + .data +# -- End atanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +halfs: + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbfe00000 + .type halfs,@object + .size halfs,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q3: + .word 43691 + .word 45330 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 33124 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58478 + .word 29023 + .word 52648 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 43686 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 5258 + .word 52447 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 10439 + .word 34405 + .word 9349 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 25253 + .word 49895 + .word 32943 + .word 58261 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 43101 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 4657 + .word 52441 + .word 52428 + .word 52428 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 42633 + .word 18723 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 11223 + .word 36719 + .word 14563 + .word 58254 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 64465 + .word 27664 + .word 35746 + .word 47662 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 6969 + .word 8211 + .word 55486 + .word 40329 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 15522 + .word 40807 + .word 33480 + .word 34952 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 44124 + .word 7207 + .word 21918 + .word 61682 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 13236 + .word 62073 + .word 35694 + .word 55158 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 859 + .word 55468 + .word 55479 + .word 50356 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 19186 + .word 33607 + .word 822 + .word 41715 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 51623 + .word 9477 + .word 49456 + .word 61855 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52416 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,224 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,96 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atanl.S b/external/sgx_libm/intel64/atanl.S new file mode 100644 index 0000000000..8ea00fdc5a --- /dev/null +++ b/external/sgx_libm/intel64/atanl.S @@ -0,0 +1,745 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanl.c" + .text +..TXTST0: +# -- Begin atanl + .text + .align 16,0x90 + .globl atanl +atanl: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_atanl.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %cl, %cl +..B1.2: + fnstcw 74(%rsp) +..B1.3: + movzbl 105(%rsp), %edx + movzwl 104(%rsp), %edi + andl $128, %edx + andl $32767, %edi + shrl $7, %edx + movzwl 74(%rsp), %eax + cmpl $16394, %edi + jge ..B1.48 +..B1.4: + cmpl $16376, %edi + jge ..B1.38 +..B1.5: + cmpl $16371, %edi + jge ..B1.31 +..B1.6: + cmpl $16365, %edi + jge ..B1.24 +..B1.7: + cmpl $16308, %edi + jge ..B1.17 +..B1.8: + movl %eax, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.12 +..B1.9: + orl $-64768, %eax + movw %ax, 72(%rsp) +..B1.10: + fldcw 72(%rsp) +..B1.11: + movzwl 104(%rsp), %edi + movb $1, %cl + andl $32767, %edi +..B1.12: + testl %edi, %edi + jle ..B1.64 +..B1.13: + fldt 96(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + fsubp %st, %st(1) + fmull (%rdx) + fstpt (%rsp) +..B1.14: + testb %cl, %cl + je ..B1.16 +..B1.15: + fldcw 74(%rsp) +..B1.16: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.17: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.21 +..B1.18: + orl $-64768, %eax + movw %ax, 72(%rsp) +..B1.19: + fldcw 72(%rsp) +..B1.20: + movb $1, %cl +..B1.21: + fldt 96(%rsp) + lea _P2(%rip), %rax + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.23 +..B1.22: + fldcw 74(%rsp) +..B1.23: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.24: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.28 +..B1.25: + orl $-64768, %eax + movw %ax, 72(%rsp) +..B1.26: + fldcw 72(%rsp) +..B1.27: + movb $1, %cl +..B1.28: + fldt 96(%rsp) + lea 16+_P1(%rip), %rax + fld %st(0) + lea _P1(%rip), %rdx + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.30 +..B1.29: + fldcw 74(%rsp) +..B1.30: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.31: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.35 +..B1.32: + orl $-64768, %eax + movw %ax, 72(%rsp) +..B1.33: + fldcw 72(%rsp) +..B1.34: + movb $1, %cl +..B1.35: + fldt 96(%rsp) + lea 48+_P(%rip), %rax + fld %st(0) + lea 32+_P(%rip), %rsi + fmul %st(1), %st + lea 16+_P(%rip), %rdx + fld %st(0) + lea _P(%rip), %rdi + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.37 +..B1.36: + fldcw 74(%rsp) +..B1.37: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.38: + movl %eax, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.42 +..B1.39: + orl $-64768, %eax + movw %ax, 72(%rsp) +..B1.40: + fldcw 72(%rsp) +..B1.41: + movb $1, %cl +..B1.42: + fldt 96(%rsp) + lea ones(%rip), %rax + movl %edx, %edx + lea _TWO_63H(%rip), %rsi + fldl (%rax,%rdx,8) + fmul %st, %st(1) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + movzwl 104(%rsp), %edi + andl $32767, %edi + fxch %st(1) + fstpl 64(%rsp) + cmpl $16383, %edi + fldl (%rsi) + jge ..B1.44 +..B1.43: + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_48H(%rip), %rax + fmul %st(2), %st + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(2) + fld %st(3) + fld %st(4) + movl 16(%rsp), %edx + fxch %st(4) + fsubrp %st, %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fldl (%rax) + fmul %st, %st(2) + fxch %st(2) + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(2) + fmul %st, %st(4) + fld %st(1) + fmul %st(4), %st + fxch %st(1) + fmulp %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.2(%rip) + fadd %st, %st(3) + fldt .L_2il0floatpacket.3(%rip) + fstpt (%rsp) + jmp ..B1.45 +..B1.44: + fldt .L_2il0floatpacket.2(%rip) + fld %st(2) + fdivrp %st, %st(1) + lea _TWO_48H(%rip), %rax + fld %st(2) + fldt .L_2il0floatpacket.0(%rip) + fmulp %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(2) + fld %st(2) + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(3) + fldl (%rax) + fmul %st, %st(2) + movl 16(%rsp), %edx + fxch %st(1) + fadd %st(2), %st + negl %edx + fsubp %st, %st(2) + fld %st(1) + addl $256, %edx + fmul %st(3), %st + fld %st(2) + fadd %st(4), %st + fxch %st(3) + fsubr %st, %st(5) + fld %st(5) + fmul %st(5), %st + fldt .L_2il0floatpacket.3(%rip) + fstpt (%rsp) + fldt (%rsp) + faddp %st, %st(3) + fld %st(3) + fmul %st(5), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fldt .L_2il0floatpacket.2(%rip) +..B1.45: + fld %st(3) + lea 48+_P(%rip), %rax + lea 32+_P(%rip), %rdi + lea 16+_P(%rip), %rsi + lea _P(%rip), %r8 + lea _TWO_32H(%rip), %r9 + movslq %edx, %rdx + fadd %st(6), %st + fdivrp %st, %st(1) + fmul %st, %st(2) + fld %st(2) + shlq $4, %rdx + fadd %st(1), %st + movq __libm_atanl_table_128@GOTPCREL(%rip), %r10 + testb %cl, %cl + fsubp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fld %st(4) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(5) + fxch %st(7) + faddp %st, %st(5) + fxch %st(3) + fstpt 48(%rsp) + fldt (%rsp) + faddp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fmul %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fldt 48(%rsp) + fmulp %st, %st(2) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt (%rax) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + fmulp %st, %st(4) + fldt (%r8) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fldl (%r10,%rdx) + fld %st(0) + fadd %st(2), %st + fldl (%r9) + fmul %st(1), %st + fadd %st, %st(1) + fsubr %st(1), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + faddl 8(%r10,%rdx) + faddp %st, %st(1) + faddp %st, %st(1) + fmull 64(%rsp) + fstpt 32(%rsp) + je ..B1.74 +..B1.46: + fstpt 16(%rsp) +..B1.73: + fldcw 74(%rsp) + jmp ..B1.47 +..B1.74: + fstp %st(0) +..B1.47: + fldt 32(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.48: + movl %eax, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.52 +..B1.49: + orl $-64768, %eax + movw %ax, 72(%rsp) +..B1.50: + fldcw 72(%rsp) +..B1.51: + movzwl 104(%rsp), %edi + movb $1, %cl + andl $32767, %edi +..B1.52: + cmpl $32767, %edi + je ..B1.68 +..B1.53: + cmpl $16448, %edi + jge ..B1.60 +..B1.54: + fldt 96(%rsp) + xorl %esi, %esi + testl %edx, %edx + lea ones(%rip), %rdi + sete %sil + fdivrl (%rdi,%rsi,8) + fstpt 96(%rsp) + fldt 96(%rsp) + movzwl 104(%rsp), %eax + andl $32767, %eax + fstpt (%rsp) + cmpl $16398, %eax + jge ..B1.56 +..B1.55: + fldt (%rsp) + lea 16+_P1(%rip), %rax + fld %st(0) + lea _P1(%rip), %rsi + fmul %st(1), %st + fldt (%rax) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.59 +..B1.56: + cmpl $16408, %eax + jge ..B1.59 +..B1.57: + fldt (%rsp) + lea _P2(%rip), %rax + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) +..B1.59: + fldt .L_2il0floatpacket.4(%rip) + fldt (%rsp) + movl %edx, %edx + faddp %st, %st(1) + fldt .L_2il0floatpacket.5(%rip) + faddp %st, %st(1) + fmull (%rdi,%rdx,8) + fstpt (%rsp) + jmp ..B1.61 +..B1.60: + movl %edx, %edx + lea _pi_2l(%rip), %rax + shlq $4, %rdx + lea _small_value_80(%rip), %rsi + fldt (%rdx,%rax) + fldt (%rdx,%rsi) + fsubrp %st, %st(1) + fstpt (%rsp) +..B1.61: + testb %cl, %cl + je ..B1.63 +..B1.62: + fldcw 74(%rsp) +..B1.63: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.64: + cmpl $0, 100(%rsp) + jne ..B1.66 +..B1.65: + cmpl $0, 96(%rsp) + je ..B1.67 +..B1.66: + fldt 96(%rsp) + lea _small_value_80(%rip), %rax + shlq $4, %rdx + fldt (%rax) + fldt (%rax,%rdx) + fmulp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.14 +..B1.67: + fldt 96(%rsp) + fstpt (%rsp) + jmp ..B1.14 +..B1.68: + cmpl $-2147483648, 100(%rsp) + jne ..B1.70 +..B1.69: + cmpl $0, 96(%rsp) + je ..B1.53 +..B1.70: + fldt 96(%rsp) + fstpt (%rsp) + jmp ..B1.61 + .align 16,0x90 + .cfi_endproc + .type atanl,@function + .size atanl,.-atanl + .data +# -- End atanl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x88,0x19,0x13,0xd3,0x08,0xa3,0x85,0xdd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0xa2,0xda,0x0f,0xc9,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_P2: + .word 43691 + .word 41642 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _P2,@object + .size _P2,16 + .align 2 +_P1: + .word 23723 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 22830 + .word 33705 + .word 52154 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,32 + .align 2 +_P: + .word 43664 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 43235 + .word 52379 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59507 + .word 38278 + .word 9340 + .word 37449 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 9132 + .word 55602 + .word 8665 + .word 58245 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,64 + .align 2 +_pi_2l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _pi_2l,@object + .size _pi_2l,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/atanl_table.S b/external/sgx_libm/intel64/atanl_table.S new file mode 100644 index 0000000000..5127afbea7 --- /dev/null +++ b/external/sgx_libm/intel64/atanl_table.S @@ -0,0 +1,1073 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "atanl_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_atanl_table_128 +__libm_atanl_table_128: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x55c00000,0x3f7fffd5 + .long 0x4bfcee57,0xbd5115a3 + .long 0x5bc00000,0x3f8fff55 + .long 0x220c39d5,0xbd623595 + .long 0x18800000,0x3f97fee0 + .long 0x286313f8,0xbdaad1e5 + .long 0xbb800000,0x3f9ffd55 + .long 0x542779d7,0x3da4bb12 + .long 0xf1600000,0x3fa3fd65 + .long 0x2e4614e3,0x3d9393b2 + .long 0x84400000,0x3fa7fb81 + .long 0x0c377c7c,0xbd9e4bac + .long 0xf1400000,0x3fabf8dd + .long 0x89fe34b3,0xbd88eef1 + .long 0xb7400000,0x3faff55b + .long 0x39269b0e,0xbda30216 + .long 0xbf000000,0x3fb1f86d + .long 0xbda88e23,0x3da05ab1 + .long 0x0e800000,0x3fb3f59f + .long 0xa7663af4,0xbd8d5314 + .long 0x4fc00000,0x3fb5f232 + .long 0x62a36910,0x3db2d7b2 + .long 0x26000000,0x3fb7ee18 + .long 0x6093567e,0x3d878874 + .long 0x53c00000,0x3fb9e941 + .long 0xd19970eb,0x3dafb9e2 + .long 0xbe400000,0x3fbbe39e + .long 0xbef71e53,0x3dc783e1 + .long 0x70400000,0x3fbddd21 + .long 0xcd620065,0xbdc0a2c8 + .long 0x9ac00000,0x3fbfd5ba + .long 0x39a6ed0d,0xbdb3d092 + .long 0xcce00000,0x3fc0e6ad + .long 0x8a397391,0x3dc40881 + .long 0xfb000000,0x3fc1e1fa + .long 0x92de9bad,0x3da0dc9b + .long 0xb3000000,0x3fc2dcbd + .long 0x386bc7d5,0xbda17803 + .long 0xe8c00000,0x3fc3d6ee + .long 0x61a3b0cf,0x3da989b1 + .long 0xa9c00000,0x3fc4d087 + .long 0x47cc8fc7,0x3dca4f17 + .long 0x1e400000,0x3fc5c981 + .long 0x0a956580,0xbd83d962 + .long 0x89800000,0x3fc6c1d4 + .long 0xb5aad628,0x3db267b1 + .long 0x4c000000,0x3fc7b97b + .long 0xecb84f4b,0xbdd8d27e + .long 0xe2800000,0x3fc8b06e + .long 0xee732cfd,0x3dae70a2 + .long 0xe9400000,0x3fc9a6a8 + .long 0x0e7b00f4,0x3dd64313 + .long 0x1b400000,0x3fca9c23 + .long 0xd177d13a,0x3d593ca1 + .long 0x52c00000,0x3fcb90d7 + .long 0xfdd09de6,0xbdd6cfae + .long 0x8a800000,0x3fcc84bf + .long 0x656f741a,0xbdb7a324 + .long 0xdf400000,0x3fcd77d5 + .long 0x8e6dcbab,0xbdcfa8c9 + .long 0x8e800000,0x3fce6a14 + .long 0x619ac881,0x3dc6ec4d + .long 0xf9400000,0x3fcf5b75 + .long 0x9d52470c,0xbdc37f22 + .long 0x51200000,0x3fd025fa + .long 0x59cb7da1,0xbdd99a4a + .long 0x97c00000,0x3fd09dc5 + .long 0x58b91ce4,0x3dd86362 + .long 0x36200000,0x3fd1151a + .long 0xb2372370,0x3db0c726 + .long 0xa3200000,0x3fd18bf5 + .long 0xd9e6b717,0xbdd40e87 + .long 0x67e00000,0x3fd20255 + .long 0x73e6e6b8,0x3db1f257 + .long 0x20400000,0x3fd27837 + .long 0xbe20c8b2,0x3dd7ef45 + .long 0x7a800000,0x3fd2ed98 + .long 0xb91258ea,0x3da1e7f1 + .long 0x37000000,0x3fd36277 + .long 0x34e2d5da,0x3dbfaf2f + .long 0x29400000,0x3fd3d6d1 + .long 0xbb20d6f9,0xbdd8eecb + .long 0x36c00000,0x3fd44aa4 + .long 0x45437875,0x3da5784d + .long 0x58600000,0x3fd4bdee + .long 0x86c8e20f,0x3dc121cd + .long 0x99400000,0x3fd530ad + .long 0xdb5336ff,0x3dd1cd49 + .long 0x17400000,0x3fd5a2e0 + .long 0x44edea3e,0x3dde0f4e + .long 0x03000000,0x3fd61484 + .long 0x2c6d4754,0x3dc39fc3 + .long 0x9f400000,0x3fd68597 + .long 0xf6d43f59,0x3ddfa6fd + .long 0x41c00000,0x3fd6f619 + .long 0x4738aa32,0x3de26f78 + .long 0x52800000,0x3fd76607 + .long 0x11774372,0x3d97501f + .long 0x4b400000,0x3fd7d560 + .long 0xad3910b8,0x3de1d9fb + .long 0xb9000000,0x3fd84422 + .long 0x4512bfad,0xbde03514 + .long 0x39400000,0x3fd8b24d + .long 0xdb685d1c,0x3dc4364a + .long 0x7cc00000,0x3fd91fde + .long 0x441d0620,0x3dd0c662 + .long 0x45400000,0x3fd98cd5 + .long 0xcf364c48,0x3dcad630 + .long 0x66000000,0x3fd9f930 + .long 0x8df63ee1,0x3dd68001 + .long 0xc3c00000,0x3fda64ee + .long 0x6d909f25,0x3dc847f9 + .long 0x54400000,0x3fdad00f + .long 0x80ecf31e,0xbdddfa74 + .long 0x1dc00000,0x3fdb3a91 + .long 0x9479e139,0xbdd9a393 + .long 0x37800000,0x3fdba473 + .long 0x519a1b47,0x3db89295 + .long 0xc9400000,0x3fdc0db4 + .long 0x19f18c7b,0x3dcd93df + .long 0x0ac00000,0x3fdc7655 + .long 0x5d2e2ffe,0xbdd28e07 + .long 0x43000000,0x3fdcde53 + .long 0x4ba60b78,0x3de609a8 + .long 0xca000000,0x3fdd45ae + .long 0xced7bdd4,0xbdd379d4 + .long 0x05800000,0x3fddac67 + .long 0x97520377,0xbdde44b0 + .long 0x6b000000,0x3fde127b + .long 0xb53d9e72,0x3dbd12bf + .long 0x7f400000,0x3fde77eb + .long 0xde35847d,0xbde452e5 + .long 0xd4400000,0x3fdedcb6 + .long 0xf25d8cc2,0xbd7ef2c7 + .long 0x0b800000,0x3fdf40dd + .long 0x1a3992dc,0xbde5f5f4 + .long 0xd3400000,0x3fdfa45d + .long 0xb94ac7b8,0xbdeeb6d3 + .long 0x73e00000,0x3fe0039c + .long 0x6ccb2527,0xbdee5bf4 + .long 0x09400000,0x3fe034b7 + .long 0xce0c98e5,0xbdeafb77 + .long 0x94e00000,0x3fe0657e + .long 0xeada4afb,0xbdc33cc0 + .long 0x08600000,0x3fe095f3 + .long 0xdbc9bebd,0x3daa58fd + .long 0x5b600000,0x3fe0c614 + .long 0xcd160bd9,0xbdc2f097 + .long 0x8b600000,0x3fe0f5e2 + .long 0x004c46c6,0x3dcf8a54 + .long 0x9be00000,0x3fe1255d + .long 0xf6a1288f,0x3debd2a8 + .long 0x96400000,0x3fe15485 + .long 0xa5d3e2a4,0xbdd1372c + .long 0x88c00000,0x3fe1835a + .long 0xe778c500,0xbda83ec8 + .long 0x87800000,0x3fe1b1dc + .long 0xede17375,0x3de04284 + .long 0xabe00000,0x3fe1e00b + .long 0xc946f944,0xbda014c0 + .long 0x13e00000,0x3fe20de8 + .long 0x43714561,0x3dd04763 + .long 0xe2c00000,0x3fe23b71 + .long 0x3884393e,0x3dd93cd4 + .long 0x40800000,0x3fe268a9 + .long 0xf1765bb0,0xbde69259 + .long 0x59400000,0x3fe2958e + .long 0x4279cec3,0xbddee39e + .long 0x5e000000,0x3fe2c221 + .long 0xd68fde4c,0x3db2232f + .long 0x84000000,0x3fe2ee62 + .long 0xc5d5e9ff,0x3dcb2f29 + .long 0x04a00000,0x3fe31a52 + .long 0xafcd51e1,0xbde78b41 + .long 0x1ce00000,0x3fe345f0 + .long 0xbbf7bb21,0xbde1c844 + .long 0x0e000000,0x3fe3713d + .long 0x14f789e0,0xbdd275f8 + .long 0x1ce00000,0x3fe39c39 + .long 0x9182198f,0xbdd7d1cc + .long 0x91c00000,0x3fe3c6e4 + .long 0x1ebaf6b0,0x3dce3712 + .long 0xb8a00000,0x3fe3f13f + .long 0x260e96db,0xbda690bc + .long 0xe0800000,0x3fe41b4a + .long 0xec29f5ad,0xbde015be + .long 0x5b800000,0x3fe44506 + .long 0xfbb680b2,0xbdca92a8 + .long 0x7f000000,0x3fe46e72 + .long 0x39b9b1b8,0xbdab8ea1 + .long 0xa3200000,0x3fe4978f + .long 0x920cd440,0x3dca7b84 + .long 0x22e00000,0x3fe4c05e + .long 0x02b07c28,0xbda6b1b7 + .long 0x5ba00000,0x3fe4e8de + .long 0x528cf6fb,0x3de6ec04 + .long 0xadc00000,0x3fe51110 + .long 0x91ee6b42,0x3dc7b604 + .long 0x7b800000,0x3fe538f5 + .long 0x72245aa1,0x3dd20c3d + .long 0x29c00000,0x3fe5608d + .long 0x9939cf0e,0x3dcc30d1 + .long 0x1f800000,0x3fe587d8 + .long 0x57972763,0xbdd9a08a + .long 0xc5800000,0x3fe5aed6 + .long 0x5cc4bdc5,0x3de09517 + .long 0x87000000,0x3fe5d589 + .long 0x10028e4c,0x3de69b18 + .long 0xd0c00000,0x3fe5fbf0 + .long 0xf2598180,0x3de5cc49 + .long 0x11400000,0x3fe6220d + .long 0xed487acb,0x3ded7b8d + .long 0xb8c00000,0x3fe647de + .long 0xf84d7eff,0x3df105c7 + .long 0x39400000,0x3fe66d66 + .long 0x2dd4dfd8,0xbdec1f79 + .long 0x05400000,0x3fe692a4 + .long 0x7652e56a,0x3de6fb6a + .long 0x92000000,0x3fe6b798 + .long 0x2bfe3cf4,0x3dd67b31 + .long 0x55000000,0x3fe6dc44 + .long 0xf203bce5,0x3de553ae + .long 0xc5800000,0x3fe700a7 + .long 0xc61a692d,0xbdcee730 + .long 0x5b400000,0x3fe724c3 + .long 0x1948b32e,0x3ddf5cf6 + .long 0x8f800000,0x3fe74897 + .long 0x82f654c3,0x3dfd4707 + .long 0xdcc00000,0x3fe76c24 + .long 0x1952551b,0x3dcb1b01 + .long 0xbd400000,0x3fe78f6b + .long 0x501a8226,0x3ded315e + .long 0xad400000,0x3fe7b26c + .long 0x73a037cc,0xbde1af02 + .long 0x28c00000,0x3fe7d528 + .long 0x553efbc4,0xbdf02fb6 + .long 0xacc00000,0x3fe7f79e + .long 0x02a357f1,0xbdca1d9e + .long 0xb7400000,0x3fe819d0 + .long 0x9bf7622a,0xbdf53ad9 + .long 0xc6000000,0x3fe83bbe + .long 0xf677c77e,0xbdf908ee + .long 0x57800000,0x3fe85d69 + .long 0xe9499180,0xbde33d3a + .long 0xeb000000,0x3fe87ed0 + .long 0xef50a527,0xbdf1d2ea + .long 0xff800000,0x3fe89ff5 + .long 0x2ab734bc,0xbdf40704 + .long 0x14400000,0x3fe8c0d9 + .long 0x6fa901db,0x3decf49d + .long 0xa9800000,0x3fe8e17a + .long 0xc27cfaaa,0x3decc05d + .long 0x3ec00000,0x3fe901db + .long 0xad0ccbcb,0x3df778c3 + .long 0x54400000,0x3fe921fb + .long 0x1a626331,0x3dc0b461 + .long 0x69800000,0x3fe9421b + .long 0x33179a03,0x3de968a9 + .long 0xff000000,0x3fe9627b + .long 0x354bc911,0xbde4662d + .long 0x94400000,0x3fe9831d + .long 0xe277d043,0xbde49a6c + .long 0xa9000000,0x3fe9a400 + .long 0x714fcd89,0x3df8341c + .long 0xbdc00000,0x3fe9c525 + .long 0x942d841a,0xbde3fff9 + .long 0x51000000,0x3fe9e68d + .long 0x767ac319,0x3deb976b + .long 0xe2c00000,0x3fea0837 + .long 0x177cfdb1,0xbdc64fc6 + .long 0xf1800000,0x3fea2a25 + .long 0x75c01427,0xbdda6038 + .long 0xfbc00000,0x3fea4c57 + .long 0x1bb40f2a,0x3dddc330 + .long 0x80000000,0x3fea6ece + .long 0xc850d6e0,0xbde74662 + .long 0xfb400000,0x3fea9189 + .long 0x00d16965,0x3dea0933 + .long 0xeb000000,0x3feab48a + .long 0x1e8b57b9,0x3df59469 + .long 0xcbc00000,0x3fead7d1 + .long 0x6dc9c51f,0x3da93704 + .long 0x18c00000,0x3feafb5f + .long 0x0e891026,0x3ddb9843 + .long 0x4d400000,0x3feb1f33 + .long 0xfdcc9ff9,0xbdcd5129 + .long 0xe3400000,0x3feb434e + .long 0xa0a41a0e,0xbdf7f601 + .long 0x53800000,0x3feb67b2 + .long 0xc9a51699,0xbdd9f2fc + .long 0x16800000,0x3feb8c5e + .long 0x466f670a,0xbdb71b40 + .long 0xa3400000,0x3febb152 + .long 0xd24367a3,0xbddd4273 + .long 0x6f800000,0x3febd690 + .long 0x44f9ee90,0xbdeb8656 + .long 0xef800000,0x3febfc17 + .long 0x4e4b19cd,0x3df32750 + .long 0x97400000,0x3fec21e9 + .long 0x60174932,0xbde5215d + .long 0xd7c00000,0x3fec4805 + .long 0xca509fcf,0xbddae432 + .long 0x21800000,0x3fec6e6d + .long 0x05a2b966,0xbddc81cf + .long 0xe2c00000,0x3fec951f + .long 0x983639ea,0x3dfbe28c + .long 0x89000000,0x3fecbc1e + .long 0xb8fcc54a,0x3de52a75 + .long 0x7ec00000,0x3fece369 + .long 0x6e2bdd53,0x3da4dfc2 + .long 0x2d000000,0x3fed0b01 + .long 0x7c1f76fe,0xbd957dc5 + .long 0xfac00000,0x3fed32e5 + .long 0x45acb642,0x3db3657b + .long 0x4cc00000,0x3fed5b18 + .long 0x3aa43a9e,0x3de16e2c + .long 0x85c00000,0x3fed8398 + .long 0x02a3c6a5,0xbde63ab4 + .long 0x05800000,0x3fedac67 + .long 0x97520377,0xbdee44b0 + .long 0x29800000,0x3fedd584 + .long 0x41999968,0x3dd42635 + .long 0x4d000000,0x3fedfef0 + .long 0x983da38a,0x3dddfdb5 + .long 0xc8400000,0x3fee28ab + .long 0x43526c5d,0xbdf3c808 + .long 0xf0000000,0x3fee52b6 + .long 0xb06de4fa,0xbde63cc3 + .long 0x16c00000,0x3fee7d12 + .long 0xb04e7d93,0x3d998d80 + .long 0x8b800000,0x3feea7bd + .long 0x6af91f30,0x3dfa218b + .long 0x9a800000,0x3feed2b9 + .long 0x97acf689,0x3de1952c + .long 0x8bc00000,0x3feefe06 + .long 0xdb5c4d1a,0xbdc7762a + .long 0xa4000000,0x3fef29a4 + .long 0x017c85fc,0xbd6a8dc3 + .long 0x24800000,0x3fef5594 + .long 0xbbbb718e,0x3da8e661 + .long 0x4a800000,0x3fef81d5 + .long 0x497cd73d,0x3dc8572a + .long 0x4f400000,0x3fefae68 + .long 0xae6e18fa,0x3de7cbff + .long 0x68000000,0x3fefdb4d + .long 0x7ea78d48,0x3deeec8a + .long 0x62e00000,0x3ff00442 + .long 0x3c43ac1a,0xbdc110e6 + .long 0x4a400000,0x3ff01b07 + .long 0x75bc4774,0x3df01b3f + .long 0x7e400000,0x3ff031f5 + .long 0x4ce2d096,0x3df4adbe + .long 0x10800000,0x3ff0490d + .long 0x82c10772,0xbdcfa151 + .long 0x0fe00000,0x3ff0604e + .long 0x37517bd1,0x3dd3bc3a + .long 0x89200000,0x3ff077b8 + .long 0xe01b22eb,0x3de0f5c6 + .long 0x86600000,0x3ff08f4c + .long 0x34b7fb7b,0xbdf9bc3c + .long 0x0e800000,0x3ff0a70a + .long 0xc68f0ff4,0x3df03bcd + .long 0x26800000,0x3ff0bef1 + .long 0x403b5a47,0x3df68b2b + .long 0xd0000000,0x3ff0d701 + .long 0x57ba4ad6,0x3df35a50 + .long 0x09e00000,0x3ff0ef3c + .long 0x38183ba9,0xbde2d69f + .long 0xcfc00000,0x3ff1079f + .long 0xa4c23582,0xbdecaa57 + .long 0x1a600000,0x3ff1202d + .long 0xe7f15aff,0x3dcad893 + .long 0xdf800000,0x3ff138e3 + .long 0x19efe544,0x3dcc4411 + .long 0x11600000,0x3ff151c4 + .long 0xa76ac475,0x3dee5024 + .long 0x9f200000,0x3ff16acd + .long 0x0e8af659,0x3df44c0b + .long 0x74800000,0x3ff18400 + .long 0xa4ca4f57,0xbdba974c + .long 0x79800000,0x3ff19d5c + .long 0x5a25f72a,0x3dc2df62 + .long 0x92e00000,0x3ff1b6e1 + .long 0xd8da3354,0x3de77c88 + .long 0xa1c00000,0x3ff1d08f + .long 0xf49d1082,0x3de2171a + .long 0x83800000,0x3ff1ea66 + .long 0x7ce9b3be,0xbddb5eef + .long 0x11800000,0x3ff20466 + .long 0x1de424cc,0x3df8d09a + .long 0x22000000,0x3ff21e8e + .long 0x394b3186,0xbdef0ac7 + .long 0x86600000,0x3ff238de + .long 0x8bf7b8bf,0x3dc51f77 + .long 0x0cc00000,0x3ff25357 + .long 0x2bb7111b,0x3dfa95fd + .long 0x7f400000,0x3ff26df7 + .long 0x64b0a9b1,0xbdd1512a + .long 0xa3400000,0x3ff288bf + .long 0x18e684e8,0x3df12419 + .long 0x3ac00000,0x3ff2a3af + .long 0xce4f6ebe,0xbdb72e81 + .long 0x03000000,0x3ff2bec6 + .long 0xa69c6179,0xbdee5b5b + .long 0xb5000000,0x3ff2da03 + .long 0x6b22ae89,0x3deff6ff + .long 0x06000000,0x3ff2f568 + .long 0x29a8e5ae,0xbdecb362 + .long 0xa6000000,0x3ff310f2 + .long 0xd243f145,0x3de88f44 + .long 0x41600000,0x3ff32ca3 + .long 0xdff820e0,0x3de68034 + .long 0x7fa00000,0x3ff34879 + .long 0x5295ddf4,0x3dce7ebe + .long 0x03c00000,0x3ff36475 + .long 0x45f88767,0x3de5eab8 + .long 0x6c600000,0x3ff38095 + .long 0x91c711ec,0x3de886b1 + .long 0x53800000,0x3ff39cda + .long 0x10aefe1c,0x3dbb91fe + .long 0x4e800000,0x3ff3b943 + .long 0x4aa2e1c3,0xbdf356bb + .long 0xee000000,0x3ff3d5cf + .long 0x303c34f3,0xbdf0463a + .long 0xbe200000,0x3ff3f27f + .long 0x2b7ef915,0x3de411bd + .long 0x46a00000,0x3ff40f52 + .long 0x472305ef,0xbde8fd54 + .long 0x09e00000,0x3ff42c47 + .long 0x3560ce8b,0x3dfa68cb + .long 0x86a00000,0x3ff4495d + .long 0xacb59491,0xbdfdcdda + .long 0x35a00000,0x3ff46695 + .long 0xc6803028,0x3dcceec5 + .long 0x8c200000,0x3ff483ed + .long 0xae20cd3f,0x3dec628d + .long 0xfa600000,0x3ff4a165 + .long 0x30a5d59f,0xbdf4f20d + .long 0xeb800000,0x3ff4befd + .long 0xd1246921,0x3db30ba3 + .long 0xc6c00000,0x3ff4dcb4 + .long 0x922b65ab,0xbdd37d68 + .long 0xee400000,0x3ff4fa89 + .long 0x60d4a327,0x3dec287f + .long 0xc0000000,0x3ff5187c + .long 0xe85bc1a4,0x3dc49d56 + .long 0x95200000,0x3ff5368c + .long 0x5bd1e523,0xbdb63036 + .long 0xc2600000,0x3ff554b8 + .long 0x9a653fbc,0x3df14f8e + .long 0x98800000,0x3ff57300 + .long 0x8799adbe,0xbdffddce + .long 0x62c00000,0x3ff59163 + .long 0x4677c807,0x3e0ad3a5 + .long 0x6a000000,0x3ff5afe0 + .long 0xf3e67f75,0xbdec3df7 + .long 0xf0c00000,0x3ff5ce76 + .long 0x1e243ad8,0x3dfc26c9 + .long 0x37000000,0x3ff5ed26 + .long 0x82f9d88f,0x3df69c53 + .long 0x78000000,0x3ff60bed + .long 0xa1b60137,0xbde98cd9 + .long 0xeac00000,0x3ff62acb + .long 0x038d593e,0x3de4c370 + .long 0xc3400000,0x3ff649c0 + .long 0x6a610a4b,0xbe067cb1 + .long 0x30800000,0x3ff668cb + .long 0xaa91e345,0xbdcd59a7 + .long 0x5f000000,0x3ff687ea + .long 0xbb3e0da7,0x3de1c66a + .long 0x77400000,0x3ff6a71d + .long 0x447484ba,0xbdf49f35 + .long 0x9e000000,0x3ff6c663 + .long 0x9fa408f5,0xbdfb4727 + .long 0xf5000000,0x3ff6e5bb + .long 0x95fe5c11,0xbdfc59cc + .long 0x9a800000,0x3ff70525 + .long 0x0aa8b52d,0x3e02d604 + .long 0xaac00000,0x3ff7249f + .long 0x4ae67c31,0xbe034aef + .long 0x3d400000,0x3ff74429 + .long 0x0226c6c8,0x3dc20b8b + .long 0x68800000,0x3ff763c1 + .long 0xf8a3257f,0xbe0161b1 + .long 0x3f000000,0x3ff78367 + .long 0xc02f3514,0x3ddcbd24 + .long 0xd2000000,0x3ff7a319 + .long 0xa2288de1,0xbdfc01f8 + .long 0x2f400000,0x3ff7c2d8 + .long 0x81b988ed,0x3ddbfe74 + .long 0x63800000,0x3ff7e2a1 + .long 0xc80c4d5f,0xbe01cc20 + .long 0x78400000,0x3ff80274 + .long 0xb8ab545b,0x3df3aa42 + .long 0x76800000,0x3ff82250 + .long 0xf0c39b49,0x3de58a51 + .long 0x64c00000,0x3ff84234 + .long 0x594dab29,0xbdd68427 + .long 0x48000000,0x3ff8621f + .long 0x7b64bb5f,0x3e015323 + .long 0x24c00000,0x3ff88210 + .long 0x0881fe1d,0xbddc84da + .long 0xfd400000,0x3ff8a205 + .long 0xb3f75cfe,0x3df5873f + .long 0xd4000000,0x3ff8c1ff + .long 0x90244e94,0xbdfcfc58 + .long 0xa9800000,0x3ff8e1fc + .long 0x22533dd2,0x3de96c66 + .long 0x7ec00000,0x3ff901fb + .long 0xd7b5cc04,0x3e0738ae + .long 0x54400000,0x3ff921fb + .long 0x1a626331,0x3dd0b461 + .long 0x29800000,0x3ff941fb + .long 0xddc59991,0x3df9e8d2 + .long 0xff000000,0x3ff961f9 + .long 0x0fe1b542,0xbdd1700a + .long 0xd4c00000,0x3ff981f6 + .long 0xe2aa7fd3,0xbdfaa976 + .long 0xab400000,0x3ff9a1f0 + .long 0x4d8c56ca,0xbdea5a1e + .long 0x83c00000,0x3ff9c1e6 + .long 0x1ea36240,0x3deef6ce + .long 0x60800000,0x3ff9e1d7 + .long 0x69984526,0xbdfa4c16 + .long 0x43c00000,0x3ffa01c2 + .long 0xc70938c6,0x3debf674 + .long 0x32000000,0x3ffa21a6 + .long 0x5984e061,0xbdc357c3 + .long 0x30400000,0x3ffa4182 + .long 0x56f44585,0xbde6a024 + .long 0x45000000,0x3ffa6155 + .long 0x0ea4e62b,0x3e05f939 + .long 0x79400000,0x3ffa811e + .long 0xcc2cf5d5,0x3db5a936 + .long 0xd6c00000,0x3ffaa0dc + .long 0xd0a64087,0xbdfba3d6 + .long 0x69800000,0x3ffac08f + .long 0xd256453b,0x3db2ae75 + .long 0x40000000,0x3ffae035 + .long 0x3f3bbe4b,0x3e058eca + .long 0x6b400000,0x3ffaffcd + .long 0xb3b162ff,0x3dd862fc + .long 0xfe000000,0x3ffb1f56 + .long 0xdd01d604,0xbdf10ff0 + .long 0x0e000000,0x3ffb3ed1 + .long 0x882038c2,0xbdfd51d7 + .long 0xb3c00000,0x3ffb5e3a + .long 0xdcd07256,0xbdfb4c02 + .long 0x0ac00000,0x3ffb7d93 + .long 0xd32ac572,0xbdfc5ea7 + .long 0x31400000,0x3ffb9cd9 + .long 0xd1a5b653,0x3dfcf965 + .long 0x49800000,0x3ffbbc0c + .long 0x0dbaa75b,0xbda1209a + .long 0x78000000,0x3ffbdb2b + .long 0x0506dc03,0x3de80acb + .long 0xe5800000,0x3ffbfa35 + .long 0x3c1973a2,0xbde558d9 + .long 0xbdc00000,0x3ffc192a + .long 0xa4abd834,0xbdc03c3b + .long 0x30c00000,0x3ffc3809 + .long 0x50f9e6e6,0xbe056fb1 + .long 0x71800000,0x3ffc56d0 + .long 0xeb914ded,0xbdec8445 + .long 0xb7c00000,0x3ffc757f + .long 0x90f3093f,0xbdf3cc98 + .long 0x3e800000,0x3ffc9416 + .long 0x87247153,0x3df6792c + .long 0x45800000,0x3ffcb293 + .long 0x0041a18b,0x3df2b2e6 + .long 0x10000000,0x3ffcd0f6 + .long 0x8a656fab,0x3e041bff + .long 0xe6000000,0x3ffcef3d + .long 0xf2cbf1dc,0x3df70aa1 + .long 0x13400000,0x3ffd0d6a + .long 0xf97727f5,0x3e04de99 + .long 0xe8800000,0x3ffd2b79 + .long 0xc096e590,0x3dd71a16 + .long 0xba400000,0x3ffd496c + .long 0x8ce47feb,0xbdd6e83c + .long 0xe2000000,0x3ffd6741 + .long 0xa721fa7e,0xbe09633a + .long 0xbd000000,0x3ffd84f8 + .long 0x407bac1a,0x3ddca5d9 + .long 0xae400000,0x3ffda290 + .long 0x1147c641,0xbdc59e12 + .long 0x1c400000,0x3ffdc009 + .long 0xb620caf9,0x3dfa28e9 + .long 0x73000000,0x3ffddd61 + .long 0x2b9ed46c,0xbdfb43a8 + .long 0x22400000,0x3ffdfa99 + .long 0x630c9ceb,0xbe0cebfa + .long 0x9e800000,0x3ffe17af + .long 0xafa0c61c,0x3debe2ca + .long 0x61c00000,0x3ffe34a4 + .long 0x58615a48,0x3e0a6c6d + .long 0xea400000,0x3ffe5176 + .long 0xf771b50e,0x3dfe5151 + .long 0xba800000,0x3ffe6e26 + .long 0xbd6d668c,0x3df8a06a + .long 0x5a000000,0x3ffe8ab3 + .long 0xd7d4135c,0x3dfbb0eb + .long 0x55000000,0x3ffea71c + .long 0xb09906dc,0x3dda8442 + .long 0x3c000000,0x3ffec361 + .long 0xc44da8a3,0x3dfc16d7 + .long 0xa4c00000,0x3ffedf81 + .long 0xae5890d5,0xbdc4d95c + .long 0x29000000,0x3ffefb7d + .long 0x3d218a26,0xbdfb75a7 + .long 0x67400000,0x3fff1753 + .long 0xf1656f6c,0xbe0172f4 + .long 0x02800000,0x3fff3304 + .long 0xdf863851,0xbdcf6b8e + .long 0xa2800000,0x3fff4e8e + .long 0xa205a470,0x3df6b3e1 + .long 0xf3800000,0x3fff69f2 + .long 0xa18096af,0xbdde853c + .long 0xa5800000,0x3fff8530 + .long 0x607f6255,0x3df787de + .long 0x6dc00000,0x3fffa047 + .long 0x542c5109,0x3de39a31 + .long 0x05400000,0x3fffbb37 + .long 0x176aa69e,0xbde193d1 + .long 0x29400000,0x3fffd5ff + .long 0x4cbab80a,0x3de95cf6 + .long 0x9bc00000,0x3ffff09f + .long 0x9e85df82,0xbdf23bcc + .long 0x11200000,0x4000058c + .long 0x644dc57f,0xbdfa49be + .long 0x43400000,0x400012b4 + .long 0x29d6ca5c,0x3df7df94 + .long 0x4b800000,0x40001fc8 + .long 0x90b2f333,0xbdf07669 + .long 0x12800000,0x40002cc8 + .long 0xd8d73d10,0x3dee63d8 + .long 0x83600000,0x400039b3 + .long 0xa3aad512,0xbda62b9d + .long 0x8ac00000,0x4000468a + .long 0x20c417ef,0x3dfc9bec + .long 0x17800000,0x4000534d + .long 0x07b1cace,0x3dd7f911 + .long 0x1a000000,0x40005ffb + .long 0xaefbad1c,0x3de4074a + .long 0x84a00000,0x40006c94 + .long 0x7ea63b40,0x3df40e25 + .long 0x4b800000,0x40007919 + .long 0x397bcf5e,0x3df9321e + .long 0x64800000,0x40008589 + .long 0xa7ccd3c1,0x3dd346b9 + .long 0xc7200000,0x400091e4 + .long 0xefccf9c7,0xbdfb00e1 + .long 0x6c800000,0x40009e2b + .long 0xd036d9d3,0xbe04a851 + .long 0x4f600000,0x4000aa5d + .long 0xad856126,0xbdec74ff + .long 0x6c400000,0x4000b67a + .long 0x9512327c,0xbde6003f + .long 0xc1000000,0x4000c282 + .long 0x6614515e,0xbdec61f5 + .long 0x4d000000,0x4000ce76 + .long 0xe577796c,0xbddf8674 + .long 0x11200000,0x4000da55 + .long 0x0f49689f,0x3dc0b366 + .long 0x0fa00000,0x4000e61f + .long 0x1d23a023,0x3dffdf4d + .long 0x4c600000,0x4000f1d4 + .long 0x00a32d5c,0xbdfc94de + .long 0xcc000000,0x4000fd74 + .long 0x7b12a50e,0x3de89cb5 + .long 0x95200000,0x40010900 + .long 0x7f633dfc,0xbde8a71b + .long 0xaf200000,0x40011477 + .long 0xa22c576e,0xbddf043b + .long 0x22e00000,0x40011fda + .long 0xab4658e4,0xbdf583b2 + .long 0xfa400000,0x40012b27 + .long 0xc88a542e,0xbddc7052 + .long 0x40600000,0x40013661 + .long 0xb5fa251c,0x3dfc7430 + .long 0x01a00000,0x40014186 + .long 0x10065ac4,0x3dd53d2d + .long 0x4b200000,0x40014c96 + .long 0xfd4d5831,0x3dde4bf5 + .long 0x2b400000,0x40015792 + .long 0xdd63dfb7,0x3de0ceee + .long 0xb1400000,0x40016279 + .long 0xf44e5d9e,0x3e05a47a + .long 0xeda00000,0x40016d4c + .long 0xa9526aef,0xbd9c196f + .long 0xf1600000,0x4001780b + .long 0xddc7ed97,0xbdf1c75a + .long 0xce800000,0x400182b6 + .long 0x4537fbd1,0x3e03f9fd + .long 0x98600000,0x40018d4d + .long 0xcd4bedf5,0xbe0643b6 + .long 0x62400000,0x400197d0 + .long 0x7be31051,0xbdceee39 + .long 0x41000000,0x4001a23f + .long 0xe43916c2,0x3dab5864 + .long 0x49e00000,0x4001ac9a + .long 0xe65659f4,0x3dca8519 + .long 0x92e00000,0x4001b6e1 + .long 0xd8da3354,0x3df77c88 + .long 0x32e00000,0x4001c115 + .long 0xe2f9d62a,0xbde910ea + .long 0x41200000,0x4001cb35 + .long 0xc81075db,0xbe002e72 + .long 0xd5a00000,0x4001d541 + .long 0x272999cb,0xbdf8dc27 + .long 0x09000000,0x4001df3b + .long 0x46435ee9,0x3de1604f + .long 0xf4a00000,0x4001e920 + .long 0x86402d52,0xbdf84ccd + .long 0xb2000000,0x4001f2f3 + .long 0x7a698864,0xbdc1d852 + .long 0x5b800000,0x4001fcb3 + .long 0xe9f5ef5e,0x3de8ef47 + .long 0x0be00000,0x40020660 + .long 0x9d33bfe4,0x3deef548 + .long 0xde400000,0x40020ff9 + .long 0x9fe2acc6,0x3e07899e + .long 0xee800000,0x40021980 + .long 0x8586539c,0xbdea2a41 + .long 0x58600000,0x400222f5 + .long 0x8233d068,0xbde59a3f + .long 0x38600000,0x40022c57 + .long 0xafae28e0,0x3df61d5b + .long 0xab600000,0x400235a6 + .long 0xc0e105c1,0x3e07d566 + .long 0xcea00000,0x40023ee3 + .long 0x23305012,0x3de397c9 + .long 0xbf600000,0x4002480e + .long 0x7f34ee7e,0x3dedaddf + .long 0x9b800000,0x40025127 + .long 0x7552e9aa,0x3d940c8b + .long 0x80e00000,0x40025a2e + .long 0xe67562cc,0x3e06022a + .long 0x8e200000,0x40026323 + .long 0x36711271,0xbdfe8be0 + .long 0xe1400000,0x40026c06 + .long 0x34e171b8,0x3e03c83c + .long 0x99800000,0x400274d8 + .long 0x22b44c41,0xbdea7471 + .long 0xd5600000,0x40027d98 + .long 0x0cc87ce6,0x3dfb5597 + .long 0xb4400000,0x40028647 + .long 0xf1599d09,0x3df3fd61 + .long 0x55400000,0x40028ee5 + .long 0x432216e7,0x3e0074b2 + .long 0xd7e00000,0x40029771 + .long 0x55426d45,0x3dede47d + .long 0x5b800000,0x40029fed + .long 0xa81068a7,0x3e059214 + .long 0x00000000,0x4002a858 + .long 0xb830bfcf,0xbdd5c614 + .long 0xe4c00000,0x4002b0b1 + .long 0xaba3f9d3,0x3e092d16 + .long 0x2a000000,0x4002b8fb + .long 0xc83d37e0,0xbdefb3d7 + .long 0xef200000,0x4002c133 + .long 0x7f368cdd,0x3e0953b3 + .long 0x54800000,0x4002c95c + .long 0x27d71621,0x3df28d47 + .long 0x79e00000,0x4002d174 + .long 0x316a6da4,0xbdd16890 + .long 0x7f400000,0x4002d97c + .long 0x961b1ace,0xbdf9bc5b + .long 0x84800000,0x4002e184 + .long 0xe02465ce,0x3df0e16c + .long 0xa9e00000,0x4002e99c + .long 0x50352ef1,0xbdd817f9 + .long 0x0f400000,0x4002f1c5 + .long 0x1551a7ab,0xbe03100f + .long 0xd4800000,0x4002f9fd + .long 0xa40bccd6,0xbe01cf65 + .long 0x19800000,0x40030247 + .long 0x7c81d6bf,0x3dfa2d1b + .long 0xfe600000,0x40030aa0 + .long 0x01d5fa59,0x3df1f8ce + .long 0xa2c00000,0x4003130b + .long 0xc1d47c8b,0x3e00b18f + .long 0x26800000,0x40031b87 + .long 0xb6bb61ec,0xbdc357ae + .long 0xa9200000,0x40032413 + .long 0xb27a6369,0xbdf4621b + .long 0x4a200000,0x40032cb1 + .long 0x763f4a8f,0xbdddd864 + .long 0x29000000,0x40033560 + .long 0x71fd6503,0xbded9c9c + .long 0x64e00000,0x40033e20 + .long 0x6523f086,0x3df9c181 + .long 0x1d200000,0x400346f2 + .long 0x95f9190b,0xbdfb092f + .long 0x70600000,0x40034fd5 + .long 0xf5c5232a,0xbdf4ecd6 + .long 0x7d800000,0x400358ca + .long 0xf920fb33,0xbdff7d0c + .long 0x62e00000,0x400361d1 + .long 0x4be8fd7d,0x3de86e2d + .long 0x3f000000,0x40036aea + .long 0x5e8566d0,0xbdc27d37 + .long 0x2fc00000,0x40037415 + .long 0x118d12de,0x3dc5db22 + .long 0x53000000,0x40037d52 + .long 0x56fc208e,0xbe0191c2 + .long 0xc5e00000,0x400386a1 + .long 0x920dd0c2,0x3e0b34f6 + .long 0xa6200000,0x40039003 + .long 0xb58e26b3,0xbe0455cb + .long 0x10000000,0x40039978 + .long 0x34b985e6,0xbe0331cb + .long 0x20200000,0x4003a2ff + .long 0x35fdc794,0xbe0145fa + .long 0xf2800000,0x4003ac98 + .long 0xd680ac6a,0xbdc79adb + .long 0xa2e00000,0x4003b645 + .long 0x9da56c1b,0x3d6f49bd + .long 0x4c600000,0x4003c005 + .long 0x462df6e3,0x3ded84a6 + .long 0x09e00000,0x4003c9d8 + .long 0xa5f60849,0xbdfb2be9 + .long 0xf5600000,0x4003d3bd + .long 0x8540d783,0x3dceb909 + .long 0x28c00000,0x4003ddb7 + .long 0xfd79b218,0x3e02b1b7 + .long 0xbd400000,0x4003e7c3 + .long 0x31f55b0e,0x3e067217 + .long 0xcb800000,0x4003f1e3 + .long 0x4546b57a,0x3df90fbe + .long 0x6b600000,0x4003fc17 + .long 0xfd77cb88,0x3e0a855f + .long 0xb4800000,0x4004065e + .long 0x2dfdfe4d,0x3de26d4b + .long 0xbd600000,0x400410b9 + .long 0x5950035e,0x3de7590b + .long 0x9c200000,0x40041b28 + .long 0x03462c6f,0x3df06510 + .long 0x66200000,0x400425ab + .long 0x467966c2,0xbddbc526 + .long 0x2fe00000,0x40043042 + .long 0xb6a62d3d,0xbdfb6cb1 + .long 0x0d200000,0x40043aed + .long 0x27372402,0xbe00d8ae + .long 0x10c00000,0x400445ac + .long 0x24de2821,0x3de9ef5d + .long 0x4d200000,0x4004507f + .long 0x14d2f0d7,0xbdfec1ad + .long 0xd3200000,0x40045b66 + .long 0x945f6a25,0x3dd07f45 + .long 0xb3400000,0x40046662 + .long 0x51d9d163,0x3dd3d12d + .long 0xfcc00000,0x40047172 + .long 0x3f20ced0,0x3ddcdff6 + .long 0xbe000000,0x40047c97 + .long 0xc460b56d,0xbdefd9cf + .long 0x04200000,0x400487d1 + .long 0x85ec5f71,0x3df3a35d + .long 0xdba00000,0x4004931e + .long 0x80efdcb7,0xbdfdf504 + .long 0x4f400000,0x40049e81 + .long 0xbc54e040,0x3df44857 + .long 0x69400000,0x4004a9f8 + .long 0x937b6963,0x3df8dad6 + .long 0x32600000,0x4004b584 + .long 0x203bef0d,0x3d8c770b + .long 0xb2000000,0x4004c124 + .long 0x6a367be0,0x3e048e13 + .long 0xeec00000,0x4004ccd9 + .long 0x4959d5be,0xbdf35804 + .long 0xed400000,0x4004d8a3 + .long 0x23c13aa2,0x3de4e1b8 + .long 0xb1600000,0x4004e482 + .long 0x0d27a8c0,0x3df468e6 + .long 0x3d600000,0x4004f076 + .long 0x86d3f314,0x3dfab843 + .long 0x92200000,0x4004fc7e + .long 0x9e52e3a3,0x3df78768 + .long 0xaf200000,0x4005089b + .long 0xaab9c284,0xbe029f1b + .long 0x92000000,0x400514cd + .long 0x179103ea,0xbde45027 + .long 0x37400000,0x40052114 + .long 0x61cb6216,0x3e03c415 + .long 0x99e00000,0x40052d6f + .long 0xa75a55d3,0x3dded669 + .long 0xb2e00000,0x400539df + .long 0xcb6409f3,0xbde955aa + .long 0x79c00000,0x40054664 + .long 0xab71c36a,0xbdde1b72 + .long 0xe4600000,0x400552fd + .long 0xe25f9eb7,0x3dc41d1b + .long 0xe6c00000,0x40055fab + .long 0x247755ec,0x3e11a241 + .long 0x73800000,0x40056c6e + .long 0x5982d93b,0x3e07f5ae + .long 0x7b000000,0x40057945 + .long 0x81ce421b,0x3dea714b + .long 0xec000000,0x40058630 + .long 0xe6287509,0xbe10aaa8 + .long 0xb3000000,0x40059330 + .long 0xcdc1a134,0xbe018126 + .long 0xbb000000,0x4005a044 + .long 0x54f98005,0x3e0a53da + .long 0xed800000,0x4005ad6c + .long 0x31fa1c07,0xbe164bbe + .long 0x30800000,0x4005baa9 + .long 0x724fa9e7,0x3dfec315 + .long 0x69c00000,0x4005c7f9 + .long 0x49c8cff7,0xbd839929 + .long 0x7c000000,0x4005d55d + .long 0xa8203893,0xbe1aabb3 + .long 0x47800000,0x4005e2d5 + .long 0x4d9d0f03,0x3dc5d181 + .long 0xab800000,0x4005f060 + .long 0x39a53408,0x3e0a7fb5 + .long 0x84c00000,0x4005fdff + .long 0x01eb07f8,0xbe05ebb4 + .long 0xad400000,0x40060bb1 + .long 0x338ef683,0xbe128b26 + .long 0xfd400000,0x40061976 + .long 0xa822b748,0xbe07c5a2 + .long 0x4ac00000,0x4006274f + .long 0x5b4a549e,0x3e07b699 + .long 0x6a000000,0x4006353a + .long 0xef14ab75,0xbdf8030f + .long 0x2c000000,0x40064338 + .long 0xd329b8ff,0x3dee44e8 + .long 0x60800000,0x40065148 + .long 0xbc20f78f,0xbe13e3e3 + .long 0xd3c00000,0x40065f6a + .long 0x09e8e22c,0x3e11798e + .long 0x51400000,0x40066d9f + .long 0x7dfadb85,0x3e086b2e + .long 0xa1000000,0x40067be5 + .long 0x0b2e31ec,0x3e09f36f + .long 0x89400000,0x40068a3d + .long 0x23a7eaa9,0xbdf1ca09 + .long 0xcd800000,0x400698a6 + .long 0xee7c7516,0xbe0428c8 + .long 0x2f000000,0x4006a721 + .long 0xbdfcb3ab,0x3e0f4af1 + .long 0x6d400000,0x4006b5ac + .long 0x6678c10f,0x3e1197cf + .long 0x45000000,0x4006c448 + .long 0x0097612f,0xbdf8350f + .long 0x70400000,0x4006d2f4 + .long 0xc4ae0128,0xbdeb4341 + .long 0xa7400000,0x4006e1b0 + .long 0x2be5865a,0x3dee7616 + .long 0xa0000000,0x4006f07c + .long 0xbe2a9051,0xbe0d5116 + .long 0x0d800000,0x4006ff58 + .long 0xbe4813cb,0xbda6483b + .long 0xa1400000,0x40070e42 + .long 0xf702ea60,0x3df24157 + .long 0x0a000000,0x40071d3c + .long 0xc8e90440,0x3e11b030 + .long 0xf4800000,0x40072c43 + .long 0x3836de9f,0x3e18b285 + .long 0x0b400000,0x40073b5a + .long 0x707eec44,0x3e0abe53 + .long 0xf6400000,0x40074a7d + .long 0xdf7f7587,0x3e0227a4 + .long 0x5b800000,0x400759af + .long 0x69c4146d,0x3e0cea31 + .long 0xdf000000,0x400768ed + .long 0x2652ac89,0x3e0b070e + .long 0x22800000,0x40077839 + .long 0xb25e69d2,0x3e0029f0 + .long 0xc5800000,0x40078790 + .long 0xf2649c57,0x3e16b25a + .long 0x66400000,0x400796f4 + .long 0x229099f4,0xbe122655 + .long 0x9f800000,0x4007a663 + .long 0x90be8ad7,0x3ded1da0 + .long 0x0b800000,0x4007b5de + .long 0x5c75a10e,0x3e15cced + .long 0x42400000,0x4007c563 + .long 0xd4519719,0x3e102078 + .long 0xd9800000,0x4007d4f2 + .long 0x690de7e8,0x3e134413 + .long 0x65c00000,0x4007e48c + .long 0xfddbebee,0xbdf0721c + .long 0x79000000,0x4007f42f + .long 0x537a47ec,0x3e0472f8 + .long 0xa4800000,0x400803db + .long 0xd84d1e5e,0x3e03e9a5 + .long 0x77800000,0x40081390 + .long 0xa415fcda,0xbdf626df + .long 0x7f800000,0x4008234d + .long 0x279a2fcb,0xbe013463 + .long 0x48c00000,0x40083312 + .long 0x9b75c695,0x3dd9ba26 + .long 0x5e400000,0x400842de + .long 0x2aa926e7,0x3e00b4da + .long 0x49c00000,0x400852b1 + .long 0x44adccf7,0xbe0a51cf + .long 0x93400000,0x4008628a + .long 0x16e3fd45,0xbe15f538 + .long 0xc1c00000,0x40087269 + .long 0xce0df60f,0x3de6596a + .long 0x5c000000,0x4008824e + .long 0x5260007c,0xbe17daca + .long 0xe6400000,0x40089237 + .long 0xff43ed28,0x3df7d75a + .long 0xe5800000,0x4008a225 + .long 0x6082ccc7,0xbe0886df + .long 0xdc800000,0x4008b217 + .long 0xfbad1fdf,0xbdb73f18 + .long 0x4e400000,0x4008c20d + .long 0xc29df075,0xbdf92ca0 + .long 0xbc800000,0x4008d205 + .long 0xdc3f35d7,0xbdc7a0f1 + .long 0xa8c00000,0x4008e200 + .long 0xfa8ff5ca,0x3df9b457 + .long 0x94400000,0x4008f1fd + .long 0x1262ed72,0xbe1633d0 + .long 0xff000000,0x400901fb + .long 0x541ee425,0xbe078e5a + .long 0x69800000,0x400911fb + .long 0xfb02186a,0x3e094f3a + .long 0x54400000,0x400921fb + .long 0x1a626331,0x3de0b461 + .type __libm_atanl_table_128,@object + .size __libm_atanl_table_128,8208 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/cabs.S b/external/sgx_libm/intel64/cabs.S new file mode 100644 index 0000000000..4b3e945ec7 --- /dev/null +++ b/external/sgx_libm/intel64/cabs.S @@ -0,0 +1,73 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cabs.c" + .text +..TXTST0: +# -- Begin cabs + .text + .align 16,0x90 + .globl cabs +cabs: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cabs.1: +..L2: + + movaps %xmm0, %xmm2 + pushq %rsi + .cfi_def_cfa_offset 16 + movaps %xmm1, %xmm0 + movaps %xmm2, %xmm1 + call hypot@PLT +..B1.4: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cabs,@function + .size cabs,.-cabs + .data +# -- End cabs + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cabsf.S b/external/sgx_libm/intel64/cabsf.S new file mode 100644 index 0000000000..c6252af3d6 --- /dev/null +++ b/external/sgx_libm/intel64/cabsf.S @@ -0,0 +1,76 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cabsf.c" + .text +..TXTST0: +# -- Begin cabsf + .text + .align 16,0x90 + .globl cabsf +cabsf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cabsf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + pxor %xmm1, %xmm1 + movsd %xmm0, (%rsp) + pxor %xmm0, %xmm0 + cvtss2sd 4(%rsp), %xmm0 + cvtss2sd (%rsp), %xmm1 + call hypot@PLT +..B1.4: + cvtsd2ss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cabsf,@function + .size cabsf,.-cabsf + .data +# -- End cabsf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cabsl.S b/external/sgx_libm/intel64/cabsl.S new file mode 100644 index 0000000000..e1c51f4639 --- /dev/null +++ b/external/sgx_libm/intel64/cabsl.S @@ -0,0 +1,74 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cabsl.c" + .text +..TXTST0: +# -- Begin cabsl + .text + .align 16,0x90 + .globl cabsl +cabsl: +# parameter 1: 16 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cabsl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + fldt 64(%rsp) + fstpt (%rsp) + fldt 48(%rsp) + fstpt 16(%rsp) + call hypotl@PLT +..B1.4: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cabsl,@function + .size cabsl,.-cabsl + .data +# -- End cabsl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cacos.S b/external/sgx_libm/intel64/cacos.S new file mode 100644 index 0000000000..8f29e29b03 --- /dev/null +++ b/external/sgx_libm/intel64/cacos.S @@ -0,0 +1,743 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacos.c" + .text +..TXTST0: +# -- Begin cacosf + .text + .align 16,0x90 + .globl cacosf +cacosf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cacosf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_cacosf.4: + call cacos@PLT +..___tag_value_cacosf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movss .L_2il0floatpacket.12(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + movsd 4(%rsp), %xmm0 +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cacosf,@function + .size cacosf,.-cacosf + .data +# -- End cacosf + .text +# -- Begin cacos + .text + .align 16,0x90 + .globl cacos +cacos: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_cacos.8: +..L9: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + xorb %r12b, %r12b + subq $152, %rsp + .cfi_def_cfa_offset 176 + movsd %xmm0, 32(%rsp) + movsd %xmm1, 40(%rsp) +..B2.2: + fnstcw 138(%rsp) +..B2.3: + movzwl 38(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B2.36 +..B2.4: + testl %edx, %edx + jle ..B2.57 +..B2.5: + movzwl 46(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + jge ..B2.36 +..B2.6: + testl %eax, %eax + jle ..B2.55 +..B2.7: + movzwl 138(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.11 +..B2.8: + orl $-64768, %edx + movw %dx, 136(%rsp) +..B2.9: + fldcw 136(%rsp) +..B2.10: + movb $1, %r12b +..B2.11: + fldt .L_2il0floatpacket.14(%rip) + lea BcrossA(%rip), %rax + movsd 32(%rsp), %xmm0 + fld %st(0) + fldt .L_2il0floatpacket.15(%rip) + movsd %xmm0, 120(%rsp) + fldt (%rax) + andps .L_2il0floatpacket.18(%rip), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + movsd 40(%rsp), %xmm1 + fadd %st, %st(3) + movsd %xmm1, 128(%rsp) + andps .L_2il0floatpacket.18(%rip), %xmm1 + movsd %xmm1, (%rsp) + fxch %st(3) + fstpt 104(%rsp) + fldt 104(%rsp) + fxch %st(3) + fsubr %st, %st(4) + fxch %st(4) + fstpt 88(%rsp) + fldt 88(%rsp) + fxch %st(3) + fmul %st(0), %st + fxch %st(3) + fmul %st(0), %st + fldl (%rsp) + fld %st(0) + fmul %st(1), %st + fadd %st, %st(5) + fxch %st(5) + fsqrt + fld %st(0) + fxch %st(3) + fadd %st(6), %st + fsqrt + fstpt 72(%rsp) + fldt 72(%rsp) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + fld %st(5) + fdiv %st(2), %st + fxch %st(3) + fcomip %st(3), %st + jbe ..B2.13 +..B2.12: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fxch %st(1) + fstpt (%rsp) + fxch %st(3) + fstpl 80(%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + call acosl@PLT +..B2.78: + fldt 48(%rsp) + fldt 32(%rsp) + fldt 16(%rsp) + fldl 80(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + jmp ..B2.16 +..B2.13: + fstp %st(2) + fldt .L_2il0floatpacket.14(%rip) + fcomip %st(5), %st + jb ..B2.15 +..B2.14: + fstp %st(1) + fldt .L_2il0floatpacket.15(%rip) + addq $-32, %rsp + .cfi_def_cfa_offset 208 + fld %st(2) + fld %st(2) + fadd %st(6), %st + fmulp %st, %st(2) + fldt 136(%rsp) + faddp %st, %st(1) + fdivr %st(4), %st + fldt 104(%rsp) + fldt 120(%rsp) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fsqrt + fstpt (%rsp) + fxch %st(3) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpl 96(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + fstpt 64(%rsp) + call atan2l@PLT + jmp ..B2.80 + .cfi_def_cfa_offset 176 +..B2.15: + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 208 + fld %st(2) + fadd %st(5), %st + fldt 136(%rsp) + faddp %st, %st(2) + fdiv %st, %st(1) + fldt 104(%rsp) + fldt 120(%rsp) + fsubrp %st, %st(1) + fdivrp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.15(%rip) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + fstpt (%rsp) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpl 96(%rsp) + fstpt 48(%rsp) + fstpt 64(%rsp) + fldt 32(%rsp) + fstpt 32(%rsp) + call atan2l@PLT +..B2.80: + fldt 64(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + fldl 96(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 176 +..B2.16: + lea AcrossA(%rip), %rax + fldt (%rax) + fcomip %st(4), %st + jb ..B2.21 +..B2.17: + fldt 104(%rsp) + faddp %st, %st(2) + fldt .L_2il0floatpacket.14(%rip) + fcomip %st(1), %st + fstp %st(0) + jbe ..B2.19 +..B2.18: + fldt 72(%rsp) + fxch %st(1) + fdivr %st(2), %st + fldt 88(%rsp) + faddp %st, %st(2) + fxch %st(1) + fdivrp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.15(%rip) + fmulp %st, %st(1) + jmp ..B2.20 +..B2.19: + fldt 88(%rsp) + fxch %st(1) + fdivrp %st, %st(2) + fldt 72(%rsp) + fsubp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.15(%rip) + fmulp %st, %st(1) +..B2.20: + fldt .L_2il0floatpacket.14(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call log1pl@PLT + jmp ..B2.82 + .cfi_def_cfa_offset 176 +..B2.21: + fstp %st(1) + fstp %st(1) + fstp %st(0) + fldt .L_2il0floatpacket.14(%rip) + fld %st(1) + fmul %st(2), %st + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fsubp %st, %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call logl@PLT +..B2.82: + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 +..B2.22: + lea ZEROA(%rip), %rax + movsd (%rax), %xmm1 + comisd 120(%rsp), %xmm1 + jbe ..B2.24 +..B2.23: + fldt .L_2il0floatpacket.16(%rip) + lea PIBY2HIA(%rip), %rax + lea PIBY2LOA(%rip), %rdx + fldl (%rax) + faddl (%rdx) + fmulp %st, %st(1) + fsubp %st, %st(1) +..B2.24: + movsd 128(%rsp), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B2.26 +..B2.25: + fldt .L_2il0floatpacket.17(%rip) + fmulp %st, %st(2) +..B2.26: + fstpl 16(%rsp) + movzwl 22(%rsp), %eax + testl $32752, %eax + fstpl 24(%rsp) + jne ..B2.29 +..B2.27: + testl $1048575, 20(%rsp) + jne ..B2.32 +..B2.28: + cmpl $0, 16(%rsp) + jne ..B2.32 +..B2.29: + movzwl 30(%rsp), %eax + testl $32752, %eax + jne ..B2.33 +..B2.30: + testl $1048575, 28(%rsp) + jne ..B2.32 +..B2.31: + cmpl $0, 24(%rsp) + je ..B2.33 +..B2.32: + lea _LDB_MIN_NORMAL(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 48(%rsp) +..B2.33: + testb %r12b, %r12b + je ..B2.35 +..B2.34: + fldcw 138(%rsp) +..B2.35: + movsd 16(%rsp), %xmm0 + movsd 24(%rsp), %xmm1 + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B2.36: + testl %edx, %edx + jne ..B2.40 +..B2.37: + testl $1048575, 36(%rsp) + jne ..B2.40 +..B2.38: + cmpl $0, 32(%rsp) + jne ..B2.40 +..B2.39: + movsd 40(%rsp), %xmm0 + movq $0x3ff921fb54442d18, %rax + movq %rax, 16(%rsp) + call asinh@PLT +..B2.83: + xorps .L_2il0floatpacket.19(%rip), %xmm0 + movsd %xmm0, 24(%rsp) + movsd 16(%rsp), %xmm0 + movhpd 24(%rsp), %xmm0 + jmp ..B2.54 +..B2.40: + movzwl 46(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + je ..B2.72 +..B2.89: + cmpl $2047, %edx +..B2.41: + je ..B2.62 +..B2.42: + cmpl $2047, %eax + je ..B2.59 +..B2.43: + testl %eax, %eax + jne ..B2.50 +..B2.44: + testl $1048575, 44(%rsp) + jne ..B2.50 +..B2.45: + cmpl $0, 40(%rsp) + jne ..B2.50 +..B2.46: + movsd 32(%rsp), %xmm0 + cmpl $1023, %edx + jl ..B2.48 +..B2.47: + movb 39(%rsp), %r12b + andb $-128, %r12b + shrb $7, %r12b + movzbl %r12b, %eax + lea ones(%rip), %r12 + movsd (%r12,%rax,8), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm1, (%rsp) + call acosh@PLT +..B2.85: + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + call acos@PLT +..B2.84: + movsd %xmm0, 16(%rsp) + jmp ..B2.49 +..B2.48: + pxor %xmm1, %xmm1 + movsd %xmm1, 8(%rsp) + call acos@PLT +..B2.86: + movsd %xmm0, 16(%rsp) + lea ones(%rip), %r12 +..B2.49: + movb 47(%rsp), %al + andb $-128, %al + shrb $7, %al + movsd 8(%rsp), %xmm0 + xorb $1, %al + movzbl %al, %edx + mulsd (%r12,%rdx,8), %xmm0 + movsd %xmm0, 24(%rsp) + movsd 16(%rsp), %xmm0 + movhpd 24(%rsp), %xmm0 + jmp ..B2.54 +..B2.50: + movsd 40(%rsp), %xmm0 + cmpl $2047, %eax + movsd 32(%rsp), %xmm1 + je ..B2.52 +..B2.51: + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + jmp ..B2.53 +..B2.52: + movaps %xmm0, %xmm2 + mulsd %xmm0, %xmm2 +..B2.53: + movb 47(%rsp), %r13b + andb $-128, %r13b + shrb $7, %r13b + movb %r13b, %r12b + xorb $1, %r12b + movzbl %r12b, %eax + lea ones(%rip), %r12 + mulsd (%r12,%rax,8), %xmm2 + movsd %xmm2, 24(%rsp) + call atan2@PLT +..B2.87: + movzbl %r13b, %eax + mulsd (%r12,%rax,8), %xmm0 + movsd %xmm0, 16(%rsp) + movhpd 24(%rsp), %xmm0 +..B2.54: + movaps %xmm0, %xmm1 + unpckhpd %xmm0, %xmm1 + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B2.55: + testl $1048575, 44(%rsp) + jne ..B2.7 +..B2.56: + cmpl $0, 40(%rsp) + jne ..B2.7 + jmp ..B2.36 +..B2.57: + testl $1048575, 36(%rsp) + jne ..B2.5 +..B2.58: + cmpl $0, 32(%rsp) + jne ..B2.5 + jmp ..B2.36 +..B2.59: + testl $1048575, 44(%rsp) + jne ..B2.61 +..B2.60: + cmpl $0, 40(%rsp) + je ..B2.50 +..B2.61: + movsd 32(%rsp), %xmm1 + movsd 40(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + unpcklpd %xmm1, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.54 +..B2.62: + testl $1048575, 36(%rsp) + jne ..B2.64 +..B2.63: + cmpl $0, 32(%rsp) + je ..B2.66 +..B2.64: + cmpl $2047, %eax + jge ..B2.66 +..B2.65: + movsd 32(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.54 +..B2.66: + testl $1048575, 36(%rsp) + jne ..B2.68 +..B2.67: + cmpl $0, 32(%rsp) + je ..B2.42 +..B2.68: + cmpl $2047, %eax + jne ..B2.43 +..B2.69: + testl $1048575, 44(%rsp) + jne ..B2.71 +..B2.70: + cmpl $0, 40(%rsp) + je ..B2.59 +..B2.71: + movsd 32(%rsp), %xmm0 + movsd 40(%rsp), %xmm1 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + unpcklpd %xmm1, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.54 +..B2.72: + testl $1048575, 44(%rsp) + jne ..B2.74 +..B2.73: + cmpl $0, 40(%rsp) + je ..B2.88 +..B2.74: + cmpl $2047, %edx + jge ..B2.41 +..B2.75: + movsd 40(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.54 +..B2.88: + cmpl $2047, %edx + je ..B2.62 + jmp ..B2.42 + .align 16,0x90 + .cfi_endproc + .type cacos,@function + .size cacos,.-cacos + .data +# -- End cacos + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 16 +.L_2il0floatpacket.15: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 16 +.L_2il0floatpacket.17: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,16 + .align 16 +.L_2il0floatpacket.18: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,16 + .align 16 +.L_2il0floatpacket.19: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,16 + .align 16 +BcrossA: + .long 3621516424 + .long 2756080513 + .long 16382 + .long 0 + .type BcrossA,@object + .size BcrossA,16 + .align 16 +AcrossA: + .long 0 + .long 3221225472 + .long 16383 + .long 0 + .type AcrossA,@object + .size AcrossA,16 + .align 16 +ZEROA: + .long 0 + .long 0 + .type ZEROA,@object + .size ZEROA,8 + .space 8, 0x00 # pad + .align 16 +PIBY2HIA: + .long 1413754136 + .long 1073291771 + .type PIBY2HIA,@object + .size PIBY2HIA,8 + .space 8, 0x00 # pad + .align 16 +PIBY2LOA: + .long 856972295 + .long 1016178214 + .type PIBY2LOA,@object + .size PIBY2LOA,8 + .space 8, 0x00 # pad + .align 16 +_LDB_MIN_NORMAL: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _LDB_MIN_NORMAL,@object + .size _LDB_MIN_NORMAL,16 + .align 8 +.L_2il0floatpacket.13: + .long 0x54442d18,0x3ff921fb + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +.L_2il0floatpacket.12: + .long 0x00800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cacosh.S b/external/sgx_libm/intel64/cacosh.S new file mode 100644 index 0000000000..d3232ca863 --- /dev/null +++ b/external/sgx_libm/intel64/cacosh.S @@ -0,0 +1,739 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacosh.c" + .text +..TXTST0: +# -- Begin cacoshf + .text + .align 16,0x90 + .globl cacoshf +cacoshf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cacoshf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_cacoshf.4: + call cacosh@PLT +..___tag_value_cacoshf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movss .L_2il0floatpacket.12(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + movsd 4(%rsp), %xmm0 +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cacoshf,@function + .size cacoshf,.-cacoshf + .data +# -- End cacoshf + .text +# -- Begin cacosh + .text + .align 16,0x90 + .globl cacosh +cacosh: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_cacosh.8: +..L9: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + xorb %r13b, %r13b + subq $160, %rsp + .cfi_def_cfa_offset 176 + movsd %xmm0, 136(%rsp) + movsd %xmm1, 144(%rsp) +..B2.2: + fnstcw 154(%rsp) +..B2.3: + movzwl 142(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B2.36 +..B2.4: + testl %edx, %edx + jle ..B2.62 +..B2.5: + movzwl 150(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + jge ..B2.37 +..B2.6: + testl %eax, %eax + jle ..B2.60 +..B2.7: + movzwl 154(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.11 +..B2.8: + orl $-64768, %edx + movw %dx, 152(%rsp) +..B2.9: + fldcw 152(%rsp) +..B2.10: + movb $1, %r13b +..B2.11: + fldt .L_2il0floatpacket.13(%rip) + lea BcrossA(%rip), %rax + movsd 136(%rsp), %xmm0 + fld %st(0) + fldt .L_2il0floatpacket.14(%rip) + movsd %xmm0, 128(%rsp) + fldt (%rax) + andps .L_2il0floatpacket.17(%rip), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + movsd 144(%rsp), %xmm1 + fadd %st, %st(3) + movsd %xmm1, 120(%rsp) + andps .L_2il0floatpacket.17(%rip), %xmm1 + movsd %xmm1, (%rsp) + fxch %st(3) + fstpt 104(%rsp) + fldt 104(%rsp) + fxch %st(3) + fsubr %st, %st(4) + fxch %st(4) + fstpt 88(%rsp) + fldt 88(%rsp) + fxch %st(3) + fmul %st(0), %st + fxch %st(3) + fmul %st(0), %st + fldl (%rsp) + fld %st(0) + fmul %st(1), %st + fadd %st, %st(5) + fxch %st(5) + fsqrt + fld %st(0) + fxch %st(3) + fadd %st(6), %st + fsqrt + fstpt 72(%rsp) + fldt 72(%rsp) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + fld %st(5) + fdiv %st(2), %st + fxch %st(3) + fcomip %st(3), %st + jbe ..B2.13 +..B2.12: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fxch %st(1) + fstpt (%rsp) + fxch %st(3) + fstpl 80(%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + call acosl@PLT +..B2.84: + fldt 48(%rsp) + fldt 32(%rsp) + fldt 16(%rsp) + fldl 80(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + jmp ..B2.16 +..B2.13: + fstp %st(2) + fldt .L_2il0floatpacket.13(%rip) + fcomip %st(5), %st + jb ..B2.15 +..B2.14: + fstp %st(1) + fldt .L_2il0floatpacket.14(%rip) + addq $-32, %rsp + .cfi_def_cfa_offset 208 + fld %st(2) + fld %st(2) + fadd %st(6), %st + fmulp %st, %st(2) + fldt 136(%rsp) + faddp %st, %st(1) + fdivr %st(4), %st + fldt 104(%rsp) + fldt 120(%rsp) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fsqrt + fstpt (%rsp) + fxch %st(3) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpl 96(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + fstpt 64(%rsp) + call atan2l@PLT + jmp ..B2.86 + .cfi_def_cfa_offset 176 +..B2.15: + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 208 + fld %st(2) + fadd %st(5), %st + fldt 136(%rsp) + faddp %st, %st(2) + fdiv %st, %st(1) + fldt 104(%rsp) + fldt 120(%rsp) + fsubrp %st, %st(1) + fdivrp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.14(%rip) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + fstpt (%rsp) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpl 96(%rsp) + fstpt 48(%rsp) + fstpt 64(%rsp) + fldt 32(%rsp) + fstpt 32(%rsp) + call atan2l@PLT +..B2.86: + fldt 64(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + fldl 96(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 176 +..B2.16: + lea AcrossA(%rip), %rax + fldt (%rax) + fcomip %st(4), %st + jb ..B2.21 +..B2.17: + fldt 104(%rsp) + faddp %st, %st(2) + fldt .L_2il0floatpacket.13(%rip) + fcomip %st(1), %st + fstp %st(0) + jbe ..B2.19 +..B2.18: + fldt 72(%rsp) + fxch %st(1) + fdivr %st(2), %st + fldt 88(%rsp) + faddp %st, %st(2) + fxch %st(1) + fdivrp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.14(%rip) + fmulp %st, %st(1) + jmp ..B2.20 +..B2.19: + fldt 88(%rsp) + fxch %st(1) + fdivrp %st, %st(2) + fldt 72(%rsp) + fsubp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.14(%rip) + fmulp %st, %st(1) +..B2.20: + fldt .L_2il0floatpacket.13(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call log1pl@PLT + jmp ..B2.88 + .cfi_def_cfa_offset 176 +..B2.21: + fstp %st(1) + fstp %st(1) + fstp %st(0) + fldt .L_2il0floatpacket.13(%rip) + fld %st(1) + fmul %st(2), %st + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fsubp %st, %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call logl@PLT +..B2.88: + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 +..B2.22: + lea ZEROA(%rip), %rax + movsd (%rax), %xmm0 + comisd 128(%rsp), %xmm0 + jbe ..B2.24 +..B2.23: + fldt .L_2il0floatpacket.15(%rip) + lea PIBY2HIA(%rip), %rax + lea PIBY2LOA(%rip), %rdx + fldl (%rax) + faddl (%rdx) + fmulp %st, %st(1) + fsubp %st, %st(1) +..B2.24: + comisd 120(%rsp), %xmm0 + jbe ..B2.26 +..B2.25: + fldt .L_2il0floatpacket.16(%rip) + fmulp %st, %st(1) +..B2.26: + movb 151(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + fxch %st(1) + fstpl (%rsp) + movsd (%rsp), %xmm0 + fstpl (%rsp) + movsd (%rsp), %xmm1 + andps .L_2il0floatpacket.17(%rip), %xmm1 + andps .L_2il0floatpacket.17(%rip), %xmm0 + movsd %xmm0, 16(%rsp) + movzbl %al, %ecx + movzwl 22(%rsp), %esi + testl $32752, %esi + mulsd (%rdx,%rcx,8), %xmm1 + movsd %xmm1, 24(%rsp) + jne ..B2.29 +..B2.27: + testl $1048575, 20(%rsp) + jne ..B2.32 +..B2.28: + cmpl $0, 16(%rsp) + jne ..B2.32 +..B2.29: + movzwl 30(%rsp), %eax + testl $32752, %eax + jne ..B2.33 +..B2.30: + testl $1048575, 28(%rsp) + jne ..B2.32 +..B2.31: + cmpl $0, 24(%rsp) + je ..B2.33 +..B2.32: + lea _LDB_MIN_NORMAL(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 48(%rsp) +..B2.33: + testb %r13b, %r13b + je ..B2.35 +..B2.34: + fldcw 154(%rsp) +..B2.35: + movsd 16(%rsp), %xmm0 + movsd 24(%rsp), %xmm1 + addq $160, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 13, -16 +..B2.36: + movzwl 150(%rsp), %eax + andl $32752, %eax + shrl $4, %eax +..B2.37: + testl %eax, %eax + jne ..B2.47 +..B2.38: + testl $1048575, 148(%rsp) + jne ..B2.47 +..B2.39: + cmpl $0, 144(%rsp) + jne ..B2.47 +..B2.40: + cmpl $2047, %edx + jl ..B2.43 +..B2.41: + testl $1048575, 140(%rsp) + jne ..B2.47 +..B2.42: + cmpl $0, 136(%rsp) + jne ..B2.47 +..B2.43: + cmpl $1023, %edx + jl ..B2.45 +..B2.44: + movb 143(%rsp), %r13b + andb $-128, %r13b + shrb $7, %r13b + movsd 136(%rsp), %xmm0 + movzbl %r13b, %eax + lea ones(%rip), %r13 + movsd (%r13,%rax,8), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm1, (%rsp) + call acosh@PLT +..B2.90: + movsd %xmm0, 16(%rsp) + movsd (%rsp), %xmm0 + call acos@PLT +..B2.89: + lea 24(%rsp), %rcx + jmp ..B2.46 +..B2.45: + movsd 136(%rsp), %xmm0 + movq $0, 16(%rsp) + call acos@PLT +..B2.91: + lea ones(%rip), %r13 + lea 24(%rsp), %rcx +..B2.46: + movb 151(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + mulsd (%r13,%rdx,8), %xmm0 + movsd %xmm0, (%rcx) + movsd 16(%rsp), %xmm0 + movhpd 24(%rsp), %xmm0 + jmp ..B2.59 +..B2.47: + testl %edx, %edx + jne ..B2.54 +..B2.48: + testl $1048575, 140(%rsp) + jne ..B2.55 +..B2.49: + cmpl $0, 136(%rsp) + jne ..B2.55 +..B2.50: + cmpl $2047, %eax + jl ..B2.53 +..B2.51: + testl $1048575, 148(%rsp) + jne ..B2.55 +..B2.52: + cmpl $0, 144(%rsp) + jne ..B2.55 +..B2.53: + movb 151(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movsd 144(%rsp), %xmm1 + movsd %xmm1, (%rsp) + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm0 + mulsd %xmm1, %xmm0 + call asinh@PLT +..B2.93: + movsd %xmm0, 16(%rsp) + movsd 136(%rsp), %xmm1 + movsd (%rsp), %xmm0 + call atan2@PLT + jmp ..B2.94 +..B2.54: + cmpl $2047, %edx + je ..B2.72 +..B2.55: + cmpl $2047, %eax + je ..B2.68 +..B2.96: + cmpl $2047, %edx +..B2.56: + je ..B2.65 +..B2.57: + movsd 144(%rsp), %xmm0 + movaps %xmm0, %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, 16(%rsp) + movsd 136(%rsp), %xmm1 +..B2.58: + call atan2@PLT +..B2.94: + movsd %xmm0, 24(%rsp) + movsd 16(%rsp), %xmm0 + movhpd 24(%rsp), %xmm0 +..B2.59: + movaps %xmm0, %xmm1 + unpckhpd %xmm0, %xmm1 + addq $160, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 13, -16 +..B2.60: + testl $1048575, 148(%rsp) + jne ..B2.7 +..B2.61: + cmpl $0, 144(%rsp) + jne ..B2.7 + jmp ..B2.37 +..B2.62: + testl $1048575, 140(%rsp) + jne ..B2.5 +..B2.63: + cmpl $0, 136(%rsp) + jne ..B2.5 + jmp ..B2.36 +..B2.65: + testl $1048575, 140(%rsp) + jne ..B2.57 +..B2.66: + cmpl $0, 136(%rsp) + jne ..B2.57 +..B2.67: + movsd 136(%rsp), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, 16(%rsp) + movsd 144(%rsp), %xmm0 + jmp ..B2.58 +..B2.68: + testl $1048575, 148(%rsp) + jne ..B2.70 +..B2.69: + cmpl $0, 144(%rsp) + je ..B2.95 +..B2.70: + cmpl $2047, %edx + jge ..B2.56 +..B2.71: + movsd 144(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.59 +..B2.72: + testl $1048575, 140(%rsp) + jne ..B2.74 +..B2.73: + cmpl $0, 136(%rsp) + je ..B2.75 +..B2.74: + cmpl $2047, %eax + je ..B2.79 +..B2.75: + testl $1048575, 140(%rsp) + jne ..B2.77 +..B2.76: + cmpl $0, 136(%rsp) + je ..B2.55 +..B2.77: + cmpl $2047, %eax + jge ..B2.55 +..B2.78: + movsd 136(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.59 +..B2.79: + testl $1048575, 148(%rsp) + jne ..B2.81 +..B2.80: + cmpl $0, 144(%rsp) + je ..B2.75 +..B2.81: + movsd 144(%rsp), %xmm1 + movsd 136(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + unpcklpd %xmm1, %xmm0 + movsd %xmm0, 16(%rsp) + movhpd %xmm0, 24(%rsp) + jmp ..B2.59 +..B2.95: + cmpl $2047, %edx + je ..B2.65 + jmp ..B2.57 + .align 16,0x90 + .cfi_endproc + .type cacosh,@function + .size cacosh,.-cacosh + .data +# -- End cacosh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 16 +.L_2il0floatpacket.15: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 16 +.L_2il0floatpacket.17: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,16 + .align 16 +BcrossA: + .long 3621516424 + .long 2756080513 + .long 16382 + .long 0 + .type BcrossA,@object + .size BcrossA,16 + .align 16 +AcrossA: + .long 0 + .long 3221225472 + .long 16383 + .long 0 + .type AcrossA,@object + .size AcrossA,16 + .align 16 +ZEROA: + .long 0 + .long 0 + .type ZEROA,@object + .size ZEROA,8 + .space 8, 0x00 # pad + .align 16 +PIBY2HIA: + .long 1413754136 + .long 1073291771 + .type PIBY2HIA,@object + .size PIBY2HIA,8 + .space 8, 0x00 # pad + .align 16 +PIBY2LOA: + .long 856972295 + .long 1016178214 + .type PIBY2LOA,@object + .size PIBY2LOA,8 + .space 8, 0x00 # pad + .align 16 +_LDB_MIN_NORMAL: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _LDB_MIN_NORMAL,@object + .size _LDB_MIN_NORMAL,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +.L_2il0floatpacket.12: + .long 0x00800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cacoshl.S b/external/sgx_libm/intel64/cacoshl.S new file mode 100644 index 0000000000..4a014c1174 --- /dev/null +++ b/external/sgx_libm/intel64/cacoshl.S @@ -0,0 +1,483 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacoshl.c" + .text +..TXTST0: +# -- Begin cacoshl + .text + .align 16,0x90 + .globl cacoshl +cacoshl: +# parameter 1: 512 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cacoshl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $464, %rsp + .cfi_def_cfa_offset 512 + xorb %bpl, %bpl + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 448(%rsp) + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.5: + fldcw 16(%rsp) +..B1.6: + movb $1, %bpl +..B1.7: + movzwl 520(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + jge ..B1.15 +..B1.8: + testl %esi, %esi + jle ..B1.39 +..B1.9: + movzwl 536(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.15 +..B1.10: + testl %eax, %eax + jle ..B1.37 +..B1.11: + lea 32(%rsp), %rbx + lea 80(%rsp), %r12 + lea 176(%rsp), %r15 + lea 128(%rsp), %r14 + pushq %rbx + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r14 + .cfi_def_cfa_offset 536 + pushq %r15 + .cfi_def_cfa_offset 544 + lea 544(%rsp), %rdi + lea 560(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_cacoshl.18: + call __libm_carctrigprepare_k80@PLT +..___tag_value_cacoshl.19: +..B1.61: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.12: + pushq %rbx + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r14 + .cfi_def_cfa_offset 536 + pushq %r15 + .cfi_def_cfa_offset 544 + lea 544(%rsp), %rdi + lea 560(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_cacoshl.25: + call __libm_recacoshl_k80@PLT +..___tag_value_cacoshl.26: +..B1.62: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.13: + fstpt 416(%rsp) + pushq %rbx + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r14 + .cfi_def_cfa_offset 536 + pushq %r15 + .cfi_def_cfa_offset 544 + lea 544(%rsp), %rdi + lea 560(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_cacoshl.32: + call __libm_recacosl_k80@PLT +..___tag_value_cacoshl.33: +..B1.63: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.14: + movb 537(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fmulp %st, %st(1) + fstpt 432(%rsp) + jmp ..B1.32 +..B1.15: + movq 528(%rsp), %rdx + testq %rdx, %rdx + jne ..B1.22 +..B1.16: + cmpl $32767, %esi + jge ..B1.21 +..B1.17: + cmpl $16383, %esi + jl ..B1.19 +..B1.18: + fldt 512(%rsp) + movb 521(%rsp), %bl + andb $-128, %bl + shrb $7, %bl + movzbl %bl, %eax + lea ones(%rip), %rbx + fldl (%rbx,%rax,8) + fstl (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fmulp %st, %st(1) + fstpt (%rsp) + call acoshl@PLT +..B1.65: + addq $16, %rsp + .cfi_def_cfa_offset 512 + fstpt 416(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fldl 16(%rsp) + fstpt (%rsp) + call acosl@PLT +..B1.64: + addq $16, %rsp + .cfi_def_cfa_offset 512 + lea 432(%rsp), %rcx + jmp ..B1.20 +..B1.19: + fldt .L_2il0floatpacket.8(%rip) + fstpt 416(%rsp) + fldt 512(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fstpt (%rsp) + call acosl@PLT +..B1.66: + addq $16, %rsp + .cfi_def_cfa_offset 512 + lea ones(%rip), %rbx + lea 432(%rsp), %rcx +..B1.20: + movb 537(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + fldl (%rbx,%rdx,8) + fmulp %st, %st(1) + fstpt (%rcx) + jmp ..B1.32 +..B1.21: + movq $0x8000000000000000, %rax + movq 512(%rsp), %rbx + cmpq %rax, %rbx + je ..B1.17 + jmp ..B1.23 +..B1.22: + movq 512(%rsp), %rbx +..B1.23: + movzwl 536(%rsp), %ecx + andl $32767, %ecx + testq %rbx, %rbx + jne ..B1.27 +..B1.24: + cmpl $32767, %ecx + jge ..B1.26 +..B1.25: + fldt 528(%rsp) + lea ones(%rip), %rdx + fstpt (%rsp) + fldt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + movb 553(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fmulp %st, %st(1) + fstpt (%rsp) + call asinhl@PLT +..B1.68: + addq $16, %rsp + .cfi_def_cfa_offset 512 + fstpt 416(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 544 + fldt 32(%rsp) + fstpt (%rsp) + fldt 544(%rsp) + fstpt 16(%rsp) + call atan2l@PLT + jmp ..B1.69 + .cfi_def_cfa_offset 512 +..B1.26: + movq $0x8000000000000000, %rax + cmpq %rax, %rdx + je ..B1.25 +..B1.27: + cmpl $32767, %esi + je ..B1.49 +..B1.73: + cmpl $32767, %ecx +..B1.28: + je ..B1.45 +..B1.71: + cmpl $32767, %esi +..B1.29: + je ..B1.43 +..B1.30: + fldt 528(%rsp) + fld %st(0) + fmul %st(1), %st + fstpt 416(%rsp) + fldt 512(%rsp) + fxch %st(1) +..B1.31: + addq $-32, %rsp + .cfi_def_cfa_offset 544 + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B1.69: + addq $32, %rsp + .cfi_def_cfa_offset 512 + fstpt 432(%rsp) +..B1.32: + testb %bpl, %bpl + je ..B1.34 +..B1.33: + fldcw 18(%rsp) +..B1.34: + movq 448(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.42 +..B1.35: + fldt 416(%rsp) + fldt 432(%rsp) + movq 448(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.41 +..B1.36: + addq $464, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 512 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.37: + cmpl $0, 532(%rsp) + jne ..B1.11 +..B1.38: + cmpl $0, 528(%rsp) + jne ..B1.11 + jmp ..B1.15 +..B1.39: + cmpl $0, 516(%rsp) + jne ..B1.9 +..B1.40: + cmpl $0, 512(%rsp) + jne ..B1.9 + jmp ..B1.15 +..B1.41: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.42: + call __stack_chk_fail@PLT +..B1.43: + movq $0x8000000000000000, %rax + cmpq %rax, %rbx + jne ..B1.30 +..B1.44: + fldt 512(%rsp) + fld %st(0) + fmul %st(1), %st + fstpt 416(%rsp) + fldt 528(%rsp) + jmp ..B1.31 +..B1.45: + cmpl $-2147483648, 532(%rsp) + jne ..B1.47 +..B1.46: + cmpl $0, 528(%rsp) + je ..B1.70 +..B1.47: + cmpl $32767, %esi + jge ..B1.29 +..B1.48: + fldt 528(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) + jmp ..B1.32 +..B1.49: + cmpl $-2147483648, 516(%rsp) + jne ..B1.51 +..B1.50: + cmpl $0, 512(%rsp) + je ..B1.52 +..B1.51: + cmpl $32767, %ecx + je ..B1.56 +..B1.52: + cmpl $-2147483648, 516(%rsp) + jne ..B1.54 +..B1.53: + cmpl $0, 512(%rsp) + je ..B1.72 +..B1.54: + cmpl $32767, %ecx + jge ..B1.28 +..B1.55: + fldt 512(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) + jmp ..B1.32 +..B1.56: + cmpl $-2147483648, 532(%rsp) + jne ..B1.58 +..B1.57: + cmpl $0, 528(%rsp) + je ..B1.52 +..B1.58: + fldt 512(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 528(%rsp) + fmul %st(0), %st + fstpt 432(%rsp) + jmp ..B1.32 +..B1.70: + cmpl $32767, %esi + je ..B1.43 + jmp ..B1.30 +..B1.72: + cmpl $32767, %ecx + je ..B1.45 + jmp ..B1.71 + .align 16,0x90 + .cfi_endproc + .type cacoshl,@function + .size cacoshl,.-cacoshl + .data +# -- End cacoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cacosl.S b/external/sgx_libm/intel64/cacosl.S new file mode 100644 index 0000000000..529708962c --- /dev/null +++ b/external/sgx_libm/intel64/cacosl.S @@ -0,0 +1,476 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cacosl.c" + .text +..TXTST0: +# -- Begin cacosl + .text + .align 16,0x90 + .globl cacosl +cacosl: +# parameter 1: 512 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cacosl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $464, %rsp + .cfi_def_cfa_offset 512 + xorb %bl, %bl + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 448(%rsp) + fstpt 8(%rsp) + fldt 8(%rsp) + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.5: + fldcw 24(%rsp) +..B1.6: + movb $1, %bl +..B1.7: + movzwl 520(%rsp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.15 +..B1.8: + testl %edx, %edx + jle ..B1.36 +..B1.9: + movzwl 536(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.15 +..B1.10: + testl %eax, %eax + jle ..B1.34 +..B1.11: + lea 32(%rsp), %rbp + lea 80(%rsp), %r12 + lea 176(%rsp), %r14 + lea 128(%rsp), %r13 + pushq %rbp + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r13 + .cfi_def_cfa_offset 536 + pushq %r14 + .cfi_def_cfa_offset 544 + lea 544(%rsp), %rdi + lea 560(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_cacosl.18: + call __libm_carctrigprepare_k80@PLT +..___tag_value_cacosl.19: +..B1.59: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.12: + pushq %rbp + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r13 + .cfi_def_cfa_offset 536 + pushq %r14 + .cfi_def_cfa_offset 544 + lea 544(%rsp), %rdi + lea 560(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_cacosl.25: + call __libm_recacosl_k80@PLT +..___tag_value_cacosl.26: +..B1.60: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.13: + fstpt 416(%rsp) + pushq %rbp + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r13 + .cfi_def_cfa_offset 536 + pushq %r14 + .cfi_def_cfa_offset 544 + lea 544(%rsp), %rdi + lea 560(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_cacosl.32: + call __libm_recacoshl_k80@PLT +..___tag_value_cacosl.33: +..B1.61: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.14: + movb 537(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + xorb $1, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fmulp %st, %st(1) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.15: + cmpq $0, 512(%rsp) + jne ..B1.17 +..B1.16: + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fldt 24(%rsp) + fstpt (%rsp) + call acosl@PLT +..B1.63: + addq $16, %rsp + .cfi_def_cfa_offset 512 + fstpt 416(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fldt 544(%rsp) + fstpt (%rsp) + call asinhl@PLT +..B1.62: + fldt .L_2il0floatpacket.9(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 512 + fmulp %st, %st(1) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.17: + movzwl 536(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.53 +..B1.69: + cmpl $32767, %edx +..B1.18: + je ..B1.43 +..B1.19: + cmpl $32767, %eax + je ..B1.40 +..B1.20: + cmpq $0, 528(%rsp) + jne ..B1.25 +..B1.21: + fldt 512(%rsp) + cmpl $16383, %edx + jl ..B1.23 +..B1.22: + movb 521(%rsp), %al + lea ones(%rip), %rbp + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + fldl (%rbp,%rdx,8) + fstl (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fmulp %st, %st(1) + fstpt (%rsp) + call acoshl@PLT +..B1.65: + fstpt 24(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + call acosl@PLT +..B1.64: + addq $16, %rsp + .cfi_def_cfa_offset 512 + fstpt 416(%rsp) + jmp ..B1.24 +..B1.23: + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fstpt (%rsp) + call acosl@PLT +..B1.66: + addq $16, %rsp + .cfi_def_cfa_offset 512 + lea ones(%rip), %rbp + fstpt 416(%rsp) +..B1.24: + fldt 8(%rsp) + movb 537(%rsp), %al + andb $-128, %al + shrb $7, %al + xorb $1, %al + movzbl %al, %edx + fmull (%rbp,%rdx,8) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.25: + fldt 528(%rsp) + cmpl $32767, %eax + fldt 512(%rsp) + je ..B1.27 +..B1.26: + fld %st(0) + fmul %st(1), %st + jmp ..B1.28 +..B1.27: + fld %st(1) + fmul %st(2), %st +..B1.28: + movb 537(%rsp), %bpl + lea ones(%rip), %r12 + andb $-128, %bpl + shrb $7, %bpl + movb %bpl, %al + xorb $1, %al + movzbl %al, %edx + fldl (%r12,%rdx,8) + fmulp %st, %st(1) + fstpt 432(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 544 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B1.67: + movzbl %bpl, %eax + addq $32, %rsp + .cfi_def_cfa_offset 512 + fmull (%r12,%rax,8) + fstpt 416(%rsp) +..B1.29: + testb %bl, %bl + je ..B1.31 +..B1.30: + fldcw 26(%rsp) +..B1.31: + movq 448(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.39 +..B1.32: + fldt 416(%rsp) + fldt 432(%rsp) + movq 448(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.33: + addq $464, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 512 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.34: + cmpl $0, 532(%rsp) + jne ..B1.11 +..B1.35: + cmpl $0, 528(%rsp) + jne ..B1.11 + jmp ..B1.15 +..B1.36: + cmpl $0, 516(%rsp) + jne ..B1.9 +..B1.37: + cmpl $0, 512(%rsp) + jne ..B1.9 + jmp ..B1.15 +..B1.38: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.39: + call __stack_chk_fail@PLT +..B1.40: + cmpl $-2147483648, 532(%rsp) + jne ..B1.42 +..B1.41: + cmpl $0, 528(%rsp) + je ..B1.20 +..B1.42: + fldt 528(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 512(%rsp) + fmul %st(0), %st + fstpt 432(%rsp) + jmp ..B1.29 +..B1.43: + cmpl $-2147483648, 516(%rsp) + jne ..B1.45 +..B1.44: + cmpl $0, 512(%rsp) + je ..B1.47 +..B1.45: + cmpl $32767, %eax + jge ..B1.47 +..B1.46: + fldt 512(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.47: + cmpl $-2147483648, 516(%rsp) + jne ..B1.49 +..B1.48: + cmpl $0, 512(%rsp) + je ..B1.19 +..B1.49: + cmpl $32767, %eax + jne ..B1.20 +..B1.50: + cmpl $-2147483648, 532(%rsp) + jne ..B1.52 +..B1.51: + cmpl $0, 528(%rsp) + je ..B1.40 +..B1.52: + fldt 512(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 528(%rsp) + fmul %st(0), %st + fstpt 432(%rsp) + jmp ..B1.29 +..B1.53: + cmpl $-2147483648, 532(%rsp) + jne ..B1.55 +..B1.54: + cmpl $0, 528(%rsp) + je ..B1.68 +..B1.55: + cmpl $32767, %edx + jge ..B1.18 +..B1.56: + fldt 528(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.68: + cmpl $32767, %edx + je ..B1.43 + jmp ..B1.19 + .align 16,0x90 + .cfi_endproc + .type cacosl,@function + .size cacosl,.-cacosl + .data +# -- End cacosl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/carg.S b/external/sgx_libm/intel64/carg.S new file mode 100644 index 0000000000..457e309c1f --- /dev/null +++ b/external/sgx_libm/intel64/carg.S @@ -0,0 +1,73 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "carg.c" + .text +..TXTST0: +# -- Begin carg + .text + .align 16,0x90 + .globl carg +carg: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_carg.1: +..L2: + + movaps %xmm0, %xmm2 + pushq %rsi + .cfi_def_cfa_offset 16 + movaps %xmm1, %xmm0 + movaps %xmm2, %xmm1 + call atan2@PLT +..B1.4: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type carg,@function + .size carg,.-carg + .data +# -- End carg + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cargf.S b/external/sgx_libm/intel64/cargf.S new file mode 100644 index 0000000000..4ed957a6eb --- /dev/null +++ b/external/sgx_libm/intel64/cargf.S @@ -0,0 +1,76 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cargf.c" + .text +..TXTST0: +# -- Begin cargf + .text + .align 16,0x90 + .globl cargf +cargf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cargf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + pxor %xmm1, %xmm1 + movsd %xmm0, (%rsp) + pxor %xmm0, %xmm0 + cvtss2sd 4(%rsp), %xmm0 + cvtss2sd (%rsp), %xmm1 + call atan2@PLT +..B1.4: + cvtsd2ss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cargf,@function + .size cargf,.-cargf + .data +# -- End cargf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cargl.S b/external/sgx_libm/intel64/cargl.S new file mode 100644 index 0000000000..8292dc4946 --- /dev/null +++ b/external/sgx_libm/intel64/cargl.S @@ -0,0 +1,74 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cargl.c" + .text +..TXTST0: +# -- Begin cargl + .text + .align 16,0x90 + .globl cargl +cargl: +# parameter 1: 16 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cargl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + fldt 64(%rsp) + fstpt (%rsp) + fldt 48(%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B1.4: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cargl,@function + .size cargl,.-cargl + .data +# -- End cargl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/casin.S b/external/sgx_libm/intel64/casin.S new file mode 100644 index 0000000000..bdd370cc0a --- /dev/null +++ b/external/sgx_libm/intel64/casin.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casin.c" + .text +..TXTST0: +# -- Begin casin + .text + .align 16,0x90 + .globl casin +casin: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_casin.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movsd %xmm1, 24(%rsp) + movzwl 30(%rsp), %eax + andl $32752, %eax + movsd %xmm0, 16(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.5 +..B1.3: + testl $1048575, 28(%rsp) + jne ..B1.7 +..B1.4: + cmpl $0, 24(%rsp) + jne ..B1.7 +..B1.5: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.6: + movb 31(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm1 + movhpd 8(%rsp), %xmm1 +..B1.7: + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + call casinh@PLT +..B1.16: + movsd %xmm0, 16(%rsp) + movzwl 22(%rsp), %eax + andl $32752, %eax + movsd %xmm1, 24(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.11 +..B1.9: + testl $1048575, 20(%rsp) + jne ..B1.13 +..B1.10: + cmpl $0, 16(%rsp) + jne ..B1.13 +..B1.11: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.12: + movb 23(%rsp), %al + notb %al + movb 15(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movsd (%rsp), %xmm1 + movb %dl, 15(%rsp) + movhpd 8(%rsp), %xmm1 +..B1.13: + movaps %xmm1, %xmm2 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm2 + movaps %xmm2, %xmm1 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type casin,@function + .size casin,.-casin + .data +# -- End casin + .text +# -- Begin casinf + .text + .align 16,0x90 + .globl casinf +casinf: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_casinf.6: +..L7: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) + movzwl 14(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.4 +..B2.3: + testl $8388607, 12(%rsp) + jne ..B2.6 +..B2.4: + movsd %xmm0, (%rsp) +..B2.5: + movb 15(%rsp), %al + notb %al + movb 3(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 3(%rsp) + movsd (%rsp), %xmm0 +..B2.6: + call casinhf@PLT +..B2.14: + movsd %xmm0, 8(%rsp) + movzwl 10(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.9 +..B2.8: + testl $8388607, 8(%rsp) + jne ..B2.11 +..B2.9: + movsd %xmm0, (%rsp) +..B2.10: + movb 11(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm0 +..B2.11: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type casinf,@function + .size casinf,.-casinf + .data +# -- End casinf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/casinh.S b/external/sgx_libm/intel64/casinh.S new file mode 100644 index 0000000000..1f39178807 --- /dev/null +++ b/external/sgx_libm/intel64/casinh.S @@ -0,0 +1,699 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinh.c" + .text +..TXTST0: +# -- Begin casinhf + .text + .align 16,0x90 + .globl casinhf +casinhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_casinhf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_casinhf.4: + call casinh@PLT +..___tag_value_casinhf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movss .L_2il0floatpacket.12(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + movsd 4(%rsp), %xmm0 +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type casinhf,@function + .size casinhf,.-casinhf + .data +# -- End casinhf + .text +# -- Begin casinh + .text + .align 16,0x90 + .globl casinh +casinh: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_casinh.8: +..L9: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + xorb %r14b, %r14b + subq $176, %rsp + .cfi_def_cfa_offset 192 + movsd %xmm0, 16(%rsp) + movsd %xmm1, 24(%rsp) +..B2.2: + fnstcw 162(%rsp) +..B2.3: + movzwl 22(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B2.38 +..B2.4: + testl %edx, %edx + jle ..B2.61 +..B2.5: + movzwl 30(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + jge ..B2.39 +..B2.6: + testl %eax, %eax + jle ..B2.59 +..B2.7: + movzwl 162(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.11 +..B2.8: + orl $-64768, %edx + movw %dx, 160(%rsp) +..B2.9: + fldcw 160(%rsp) +..B2.10: + movb $1, %r14b +..B2.11: + fldt .L_2il0floatpacket.13(%rip) + lea BcrossA(%rip), %rax + movsd 24(%rsp), %xmm0 + fld %st(0) + fldt .L_2il0floatpacket.14(%rip) + movsd %xmm0, 136(%rsp) + fldt (%rax) + andps .L_2il0floatpacket.15(%rip), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + movsd 16(%rsp), %xmm1 + fadd %st, %st(4) + movsd %xmm1, 128(%rsp) + xorps .L_2il0floatpacket.16(%rip), %xmm1 + andps .L_2il0floatpacket.15(%rip), %xmm1 + movsd %xmm1, (%rsp) + fxch %st(4) + fstpt 72(%rsp) + fldt 72(%rsp) + fxch %st(3) + fsubr %st(4), %st + fstpt 104(%rsp) + fldt 104(%rsp) + fxch %st(3) + fmul %st(0), %st + fxch %st(3) + fmul %st(0), %st + fldl (%rsp) + fld %st(0) + fmul %st(1), %st + fadd %st, %st(5) + fxch %st(5) + fsqrt + fld %st(0) + fxch %st(3) + fadd %st(6), %st + fsqrt + fstpt 88(%rsp) + fldt 88(%rsp) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + fld %st(5) + fdiv %st(2), %st + fxch %st(3) + fcomip %st(3), %st + jb ..B2.13 +..B2.12: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 208 + fxch %st(1) + fstpt (%rsp) + fxch %st(3) + fstpl 136(%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + call asinl@PLT + jmp ..B2.85 + .cfi_def_cfa_offset 192 +..B2.13: + fstp %st(2) + fldt .L_2il0floatpacket.13(%rip) + fcomip %st(5), %st + jb ..B2.15 +..B2.14: + fstp %st(1) + addq $-16, %rsp + .cfi_def_cfa_offset 208 + fld %st(0) + lea halfs(%rip), %rax + fadd %st(4), %st + fmull (%rax) + fldt 88(%rsp) + fldt 104(%rsp) + fxch %st(1) + fadd %st(4), %st + fdivr %st(5), %st + fldt 120(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fsqrt + fld1 + fdivp %st, %st(1) + fmul %st(4), %st + fstpt (%rsp) + fxch %st(3) + fstpl 136(%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + call atanl@PLT + jmp ..B2.85 + .cfi_def_cfa_offset 192 +..B2.15: + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 208 + fld %st(2) + fadd %st(5), %st + fldt 88(%rsp) + faddp %st, %st(2) + fdiv %st, %st(1) + fldt 120(%rsp) + fldt 104(%rsp) + faddp %st, %st(1) + fdivrp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.14(%rip) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + fdivr %st(3), %st + fstpt (%rsp) + fxch %st(2) + fstpl 136(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + fldt 16(%rsp) + fstpt 16(%rsp) + call atanl@PLT +..B2.85: + fldt 48(%rsp) + fxch %st(1) + fchs + fldt 32(%rsp) + fldt 16(%rsp) + fldl 136(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 192 + fxch %st(3) + fstpl 64(%rsp) +..B2.16: + lea AcrossA(%rip), %rax + fldt (%rax) + fcomip %st(4), %st + jb ..B2.21 +..B2.17: + fldt 72(%rsp) + faddp %st, %st(1) + fldt .L_2il0floatpacket.13(%rip) + fcomip %st(3), %st + fxch %st(2) + fstp %st(0) + jbe ..B2.19 +..B2.18: + fldt 88(%rsp) + fxch %st(1) + fdiv %st, %st(2) + fldt 104(%rsp) + fsubrp %st, %st(2) + fdivp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.14(%rip) + fmulp %st, %st(1) + jmp ..B2.20 +..B2.19: + fldt 88(%rsp) + fxch %st(2) + fdivrp %st, %st(1) + fldt 104(%rsp) + faddp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.14(%rip) + fmulp %st, %st(1) +..B2.20: + fldt .L_2il0floatpacket.13(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 208 + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%rsp) + call log1pl@PLT + jmp ..B2.87 + .cfi_def_cfa_offset 192 +..B2.21: + fstp %st(0) + fstp %st(0) + fstp %st(0) + fldt .L_2il0floatpacket.13(%rip) + fld %st(1) + fmul %st(2), %st + addq $-16, %rsp + .cfi_def_cfa_offset 208 + fsubp %st, %st(1) + fsqrt + faddp %st, %st(1) + fstpt (%rsp) + call logl@PLT +..B2.87: + addq $16, %rsp + .cfi_def_cfa_offset 192 + fstpl (%rsp) + movsd (%rsp), %xmm2 +..B2.22: + lea ZEROA(%rip), %rax + movsd 136(%rsp), %xmm0 + movsd (%rax), %xmm1 + comisd %xmm1, %xmm0 + jbe ..B2.24 +..B2.23: + movsd 64(%rsp), %xmm0 + xorps .L_2il0floatpacket.16(%rip), %xmm0 + movsd %xmm0, 152(%rsp) + jmp ..B2.25 +..B2.24: + movsd 64(%rsp), %xmm0 + movsd %xmm0, 152(%rsp) +..B2.25: + comisd 128(%rsp), %xmm1 + jbe ..B2.27 +..B2.26: + xorps .L_2il0floatpacket.16(%rip), %xmm2 + movsd %xmm2, 144(%rsp) + jmp ..B2.28 +..B2.27: + movsd %xmm2, 144(%rsp) +..B2.28: + movzwl 150(%rsp), %eax + testl $32752, %eax + jne ..B2.31 +..B2.29: + testl $1048575, 148(%rsp) + jne ..B2.34 +..B2.30: + cmpl $0, 144(%rsp) + jne ..B2.34 +..B2.31: + movzwl 158(%rsp), %eax + testl $32752, %eax + jne ..B2.35 +..B2.32: + testl $1048575, 156(%rsp) + jne ..B2.34 +..B2.33: + cmpl $0, 152(%rsp) + je ..B2.35 +..B2.34: + lea _LDB_MIN_NORMAL(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 48(%rsp) +..B2.35: + testb %r14b, %r14b + je ..B2.37 +..B2.36: + fldcw 162(%rsp) +..B2.37: + movsd 144(%rsp), %xmm0 + movsd 152(%rsp), %xmm1 + addq $176, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 14, -16 +..B2.38: + movzwl 30(%rsp), %eax + andl $32752, %eax + shrl $4, %eax +..B2.39: + testl %eax, %eax + jne ..B2.43 +..B2.40: + testl $1048575, 28(%rsp) + jne ..B2.43 +..B2.41: + cmpl $0, 24(%rsp) + jne ..B2.43 +..B2.42: + movsd 16(%rsp), %xmm0 + call asinh@PLT +..B2.88: + movhpd 24(%rsp), %xmm0 + movsd %xmm0, 144(%rsp) + movhpd %xmm0, 152(%rsp) + jmp ..B2.58 +..B2.43: + testl %edx, %edx + jne ..B2.53 +..B2.44: + testl $1048575, 20(%rsp) + jne ..B2.54 +..B2.45: + cmpl $0, 16(%rsp) + jne ..B2.54 +..B2.46: + cmpl $2047, %eax + jl ..B2.49 +..B2.47: + testl $1048575, 28(%rsp) + jne ..B2.54 +..B2.48: + cmpl $0, 24(%rsp) + jne ..B2.54 +..B2.49: + movsd 24(%rsp), %xmm0 + cmpl $1023, %eax + jl ..B2.51 +..B2.50: + movb 31(%rsp), %r14b + andb $-128, %r14b + shrb $7, %r14b + movzbl %r14b, %eax + lea ones(%rip), %r14 + movsd (%r14,%rax,8), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm1, (%rsp) + call acosh@PLT +..B2.90: + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + call asin@PLT + jmp ..B2.52 +..B2.51: + pxor %xmm1, %xmm1 + movsd %xmm1, 8(%rsp) + call asin@PLT +..B2.91: + lea ones(%rip), %r14 +..B2.52: + movb 23(%rsp), %al + andb $-128, %al + shrb $7, %al + movsd %xmm0, 152(%rsp) + movsd 8(%rsp), %xmm0 + movzbl %al, %edx + mulsd (%r14,%rdx,8), %xmm0 + movsd %xmm0, 144(%rsp) + movhpd 152(%rsp), %xmm0 + jmp ..B2.58 +..B2.53: + cmpl $2047, %edx + je ..B2.71 +..B2.54: + cmpl $2047, %eax + je ..B2.67 +..B2.94: + cmpl $2047, %edx +..B2.55: + je ..B2.64 +..B2.56: + movsd 24(%rsp), %xmm0 + movaps %xmm0, %xmm3 + movsd 16(%rsp), %xmm2 + mulsd %xmm0, %xmm3 +..B2.57: + movb 23(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm1 + mulsd %xmm1, %xmm3 + mulsd %xmm2, %xmm1 + movsd %xmm3, 144(%rsp) + call atan2@PLT +..B2.92: + movsd %xmm0, 152(%rsp) + movsd 144(%rsp), %xmm0 + movhpd 152(%rsp), %xmm0 +..B2.58: + movaps %xmm0, %xmm1 + unpckhpd %xmm0, %xmm1 + addq $176, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 14, -16 +..B2.59: + testl $1048575, 28(%rsp) + jne ..B2.7 +..B2.60: + cmpl $0, 24(%rsp) + jne ..B2.7 + jmp ..B2.39 +..B2.61: + testl $1048575, 20(%rsp) + jne ..B2.5 +..B2.62: + cmpl $0, 16(%rsp) + jne ..B2.5 + jmp ..B2.38 +..B2.64: + testl $1048575, 20(%rsp) + jne ..B2.56 +..B2.65: + cmpl $0, 16(%rsp) + jne ..B2.56 +..B2.66: + movsd 16(%rsp), %xmm2 + movaps %xmm2, %xmm3 + movsd 24(%rsp), %xmm0 + mulsd %xmm2, %xmm3 + jmp ..B2.57 +..B2.67: + testl $1048575, 28(%rsp) + jne ..B2.69 +..B2.68: + cmpl $0, 24(%rsp) + je ..B2.93 +..B2.69: + cmpl $2047, %edx + jge ..B2.55 +..B2.70: + movsd 24(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + movsd %xmm0, 144(%rsp) + movhpd %xmm0, 152(%rsp) + jmp ..B2.58 +..B2.71: + testl $1048575, 20(%rsp) + jne ..B2.73 +..B2.72: + cmpl $0, 16(%rsp) + je ..B2.74 +..B2.73: + cmpl $2047, %eax + je ..B2.78 +..B2.74: + testl $1048575, 20(%rsp) + jne ..B2.76 +..B2.75: + cmpl $0, 16(%rsp) + je ..B2.54 +..B2.76: + cmpl $2047, %eax + jge ..B2.54 +..B2.77: + movsd 16(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + unpcklpd %xmm0, %xmm0 + movsd %xmm0, 144(%rsp) + movhpd %xmm0, 152(%rsp) + jmp ..B2.58 +..B2.78: + testl $1048575, 28(%rsp) + jne ..B2.80 +..B2.79: + cmpl $0, 24(%rsp) + je ..B2.74 +..B2.80: + movsd 24(%rsp), %xmm1 + movsd 16(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + unpcklpd %xmm1, %xmm0 + movsd %xmm0, 144(%rsp) + movhpd %xmm0, 152(%rsp) + jmp ..B2.58 +..B2.93: + cmpl $2047, %edx + je ..B2.64 + jmp ..B2.56 + .align 16,0x90 + .cfi_endproc + .type casinh,@function + .size casinh,.-casinh + .data +# -- End casinh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 16 +.L_2il0floatpacket.15: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 16 +BcrossA: + .long 1717986918 + .long 3865470566 + .long 16382 + .long 0 + .type BcrossA,@object + .size BcrossA,16 + .align 16 +AcrossA: + .long 0 + .long 3221225472 + .long 16383 + .long 0 + .type AcrossA,@object + .size AcrossA,16 + .align 16 +ZEROA: + .long 0 + .long 0 + .type ZEROA,@object + .size ZEROA,8 + .space 8, 0x00 # pad + .align 16 +_LDB_MIN_NORMAL: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _LDB_MIN_NORMAL,@object + .size _LDB_MIN_NORMAL,16 + .align 8 +halfs: + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbfe00000 + .type halfs,@object + .size halfs,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +.L_2il0floatpacket.12: + .long 0x00800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/casinhl.S b/external/sgx_libm/intel64/casinhl.S new file mode 100644 index 0000000000..62d9e31076 --- /dev/null +++ b/external/sgx_libm/intel64/casinhl.S @@ -0,0 +1,463 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinhl.c" + .text +..TXTST0: +# -- Begin casinhl + .text + .align 16,0x90 + .globl casinhl +casinhl: +# parameter 1: 512 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_casinhl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $464, %rsp + .cfi_def_cfa_offset 512 + xorb %r15b, %r15b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 448(%rsp) + fstpt 8(%rsp) + fldt 8(%rsp) + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.5: + fldcw 24(%rsp) +..B1.6: + movb $1, %r15b +..B1.7: + movzwl 520(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + jge ..B1.15 +..B1.8: + testl %esi, %esi + jle ..B1.36 +..B1.9: + movzwl 536(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.15 +..B1.10: + testl %eax, %eax + jle ..B1.34 +..B1.11: + lea 32(%rsp), %rbp + lea 80(%rsp), %r12 + lea 176(%rsp), %r14 + lea 128(%rsp), %r13 + pushq %rbp + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r13 + .cfi_def_cfa_offset 536 + pushq %r14 + .cfi_def_cfa_offset 544 + lea 560(%rsp), %rdi + lea 544(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_casinhl.18: + call __libm_carctrigprepare_k80@PLT +..___tag_value_casinhl.19: +..B1.58: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.12: + pushq %rbp + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r13 + .cfi_def_cfa_offset 536 + pushq %r14 + .cfi_def_cfa_offset 544 + lea 560(%rsp), %rdi + lea 544(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_casinhl.25: + call __libm_recacoshl_k80@PLT +..___tag_value_casinhl.26: +..B1.59: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.13: + movb 521(%rsp), %al + lea ones(%rip), %r10 + andb $-128, %al + shrb $7, %al + movzbl %al, %r11d + fldl (%r10,%r11,8) + fmulp %st, %st(1) + fstpt 416(%rsp) + pushq %rbp + .cfi_def_cfa_offset 520 + pushq %r12 + .cfi_def_cfa_offset 528 + pushq %r13 + .cfi_def_cfa_offset 536 + pushq %r14 + .cfi_def_cfa_offset 544 + lea 560(%rsp), %rdi + lea 544(%rsp), %rsi + lea 400(%rsp), %rdx + lea 352(%rsp), %rcx + lea 304(%rsp), %r8 + lea 256(%rsp), %r9 +..___tag_value_casinhl.32: + call __libm_recasinl_k80@PLT +..___tag_value_casinhl.33: +..B1.60: + addq $32, %rsp + .cfi_def_cfa_offset 512 +..B1.14: + fstpt 432(%rsp) + jmp ..B1.29 +..B1.15: + movq 528(%rsp), %rax + testq %rax, %rax + jne ..B1.17 +..B1.16: + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fldt 528(%rsp) + fstpt (%rsp) + call asinhl@PLT +..B1.61: + addq $16, %rsp + .cfi_def_cfa_offset 512 + fldt 528(%rsp) + fstpt 432(%rsp) + fstpt 416(%rsp) + jmp ..B1.29 +..B1.17: + movzwl 536(%rsp), %ecx + movq 512(%rsp), %rbp + andl $32767, %ecx + testq %rbp, %rbp + jne ..B1.24 +..B1.18: + cmpl $32767, %ecx + jge ..B1.23 +..B1.19: + fldt 528(%rsp) + cmpl $16383, %ecx + jl ..B1.21 +..B1.20: + movb 537(%rsp), %al + lea ones(%rip), %rbp + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + fldl (%rbp,%rdx,8) + fstl (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fmulp %st, %st(1) + fstpt (%rsp) + call acoshl@PLT +..B1.63: + fstpt 24(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + call asinl@PLT +..B1.62: + addq $16, %rsp + .cfi_def_cfa_offset 512 + fstpt 432(%rsp) + jmp ..B1.22 +..B1.21: + addq $-16, %rsp + .cfi_def_cfa_offset 528 + fstpt (%rsp) + call asinl@PLT +..B1.64: + addq $16, %rsp + .cfi_def_cfa_offset 512 + lea ones(%rip), %rbp + fstpt 432(%rsp) +..B1.22: + fldt 8(%rsp) + movb 521(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + fmull (%rbp,%rdx,8) + fstpt 416(%rsp) + jmp ..B1.29 +..B1.23: + movq $0x8000000000000000, %rdx + cmpq %rdx, %rax + je ..B1.19 +..B1.24: + cmpl $32767, %esi + je ..B1.46 +..B1.69: + cmpl $32767, %ecx +..B1.25: + je ..B1.42 +..B1.67: + cmpl $32767, %esi +..B1.26: + je ..B1.40 +..B1.27: + fldt 528(%rsp) + fld %st(0) + fmul %st(1), %st + fldt 512(%rsp) + fxch %st(2) +..B1.28: + movb 521(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fmul %st, %st(2) + fxch %st(2) + fstpt 416(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 544 + fxch %st(2) + fmulp %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B1.65: + addq $32, %rsp + .cfi_def_cfa_offset 512 + fstpt 432(%rsp) +..B1.29: + testb %r15b, %r15b + je ..B1.31 +..B1.30: + fldcw 26(%rsp) +..B1.31: + movq 448(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.39 +..B1.32: + fldt 416(%rsp) + fldt 432(%rsp) + movq 448(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.33: + addq $464, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 512 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.34: + cmpl $0, 532(%rsp) + jne ..B1.11 +..B1.35: + cmpl $0, 528(%rsp) + jne ..B1.11 + jmp ..B1.15 +..B1.36: + cmpl $0, 516(%rsp) + jne ..B1.9 +..B1.37: + cmpl $0, 512(%rsp) + jne ..B1.9 + jmp ..B1.15 +..B1.38: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.39: + call __stack_chk_fail@PLT +..B1.40: + movq $0x8000000000000000, %rax + cmpq %rax, %rbp + jne ..B1.27 +..B1.41: + fldt 512(%rsp) + fld %st(0) + fmul %st(1), %st + fldt 528(%rsp) + jmp ..B1.28 +..B1.42: + cmpl $-2147483648, 532(%rsp) + jne ..B1.44 +..B1.43: + cmpl $0, 528(%rsp) + je ..B1.66 +..B1.44: + cmpl $32767, %esi + jge ..B1.26 +..B1.45: + fldt 528(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.46: + cmpl $-2147483648, 516(%rsp) + jne ..B1.48 +..B1.47: + cmpl $0, 512(%rsp) + je ..B1.49 +..B1.48: + cmpl $32767, %ecx + je ..B1.53 +..B1.49: + cmpl $-2147483648, 516(%rsp) + jne ..B1.51 +..B1.50: + cmpl $0, 512(%rsp) + je ..B1.68 +..B1.51: + cmpl $32767, %ecx + jge ..B1.25 +..B1.52: + fldt 512(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fstpt 432(%rsp) + jmp ..B1.29 +..B1.53: + cmpl $-2147483648, 532(%rsp) + jne ..B1.55 +..B1.54: + cmpl $0, 528(%rsp) + je ..B1.49 +..B1.55: + fldt 512(%rsp) + fmul %st(0), %st + fstpt 416(%rsp) + fldt 528(%rsp) + fmul %st(0), %st + fstpt 432(%rsp) + jmp ..B1.29 +..B1.66: + cmpl $32767, %esi + je ..B1.40 + jmp ..B1.27 +..B1.68: + cmpl $32767, %ecx + je ..B1.42 + jmp ..B1.67 + .align 16,0x90 + .cfi_endproc + .type casinhl,@function + .size casinhl,.-casinhl + .data +# -- End casinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/casinl.S b/external/sgx_libm/intel64/casinl.S new file mode 100644 index 0000000000..1e144dea73 --- /dev/null +++ b/external/sgx_libm/intel64/casinl.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "casinl.c" + .text +..TXTST0: +# -- Begin casinl + .text + .align 16,0x90 + .globl casinl +casinl: +# parameter 1: 144 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_casinl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + subq $128, %rsp + .cfi_def_cfa_offset 144 + xorb %r13b, %r13b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 112(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 96(%rsp) +..B1.2: + fnstcw 2(%rsp) +..B1.3: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.5: + fldcw (%rsp) +..B1.6: + movb $1, %r13b +..B1.7: + fldt 160(%rsp) + movzwl 168(%rsp), %eax + andl $32767, %eax + fstpt 80(%rsp) + cmpl $32767, %eax + fldt 144(%rsp) + fstpt 96(%rsp) + jl ..B1.9 +..B1.8: + movq $0x8000000000000000, %rax + cmpq 160(%rsp), %rax + jne ..B1.10 +..B1.9: + movb 169(%rsp), %al + notb %al + movb 89(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 89(%rsp) +..B1.10: + addq $-32, %rsp + .cfi_def_cfa_offset 176 + movq %rsp, %rdi + movq 112(%rsp), %rax + movq 120(%rsp), %rdx + movq 128(%rsp), %rcx + movq 136(%rsp), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %rsi, 24(%rdi) + call casinhl@PLT +..B1.22: + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 144 + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 24(%rsp), %eax + andl $32767, %eax + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + cmpl $32767, %eax + fstpt 48(%rsp) + fstpt 64(%rsp) + jl ..B1.12 +..B1.11: + movq $0x8000000000000000, %rax + cmpq 16(%rsp), %rax + jne ..B1.13 +..B1.12: + movb 25(%rsp), %al + notb %al + movb 73(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 73(%rsp) +..B1.13: + testb %r13b, %r13b + je ..B1.15 +..B1.14: + fldcw 2(%rsp) +..B1.15: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.19 +..B1.16: + fldt 48(%rsp) + fldt 64(%rsp) + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.18 +..B1.17: + addq $128, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 +..B1.18: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.19: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type casinl,@function + .size casinl,.-casinl + .data +# -- End casinl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/catan.S b/external/sgx_libm/intel64/catan.S new file mode 100644 index 0000000000..dcb5372f0f --- /dev/null +++ b/external/sgx_libm/intel64/catan.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catan.c" + .text +..TXTST0: +# -- Begin catan + .text + .align 16,0x90 + .globl catan +catan: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_catan.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movsd %xmm1, 24(%rsp) + movzwl 30(%rsp), %eax + andl $32752, %eax + movsd %xmm0, 16(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.5 +..B1.3: + testl $1048575, 28(%rsp) + jne ..B1.7 +..B1.4: + cmpl $0, 24(%rsp) + jne ..B1.7 +..B1.5: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.6: + movb 31(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm1 + movhpd 8(%rsp), %xmm1 +..B1.7: + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + call catanh@PLT +..B1.16: + movsd %xmm0, 16(%rsp) + movzwl 22(%rsp), %eax + andl $32752, %eax + movsd %xmm1, 24(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.11 +..B1.9: + testl $1048575, 20(%rsp) + jne ..B1.13 +..B1.10: + cmpl $0, 16(%rsp) + jne ..B1.13 +..B1.11: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.12: + movb 23(%rsp), %al + notb %al + movb 15(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movsd (%rsp), %xmm1 + movb %dl, 15(%rsp) + movhpd 8(%rsp), %xmm1 +..B1.13: + movaps %xmm1, %xmm2 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm2 + movaps %xmm2, %xmm1 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type catan,@function + .size catan,.-catan + .data +# -- End catan + .text +# -- Begin catanf + .text + .align 16,0x90 + .globl catanf +catanf: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_catanf.6: +..L7: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) + movzwl 14(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.4 +..B2.3: + testl $8388607, 12(%rsp) + jne ..B2.6 +..B2.4: + movsd %xmm0, (%rsp) +..B2.5: + movb 15(%rsp), %al + notb %al + movb 3(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 3(%rsp) + movsd (%rsp), %xmm0 +..B2.6: + call catanhf@PLT +..B2.14: + movsd %xmm0, 8(%rsp) + movzwl 10(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.9 +..B2.8: + testl $8388607, 8(%rsp) + jne ..B2.11 +..B2.9: + movsd %xmm0, (%rsp) +..B2.10: + movb 11(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm0 +..B2.11: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type catanf,@function + .size catanf,.-catanf + .data +# -- End catanf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/catanh.S b/external/sgx_libm/intel64/catanh.S new file mode 100644 index 0000000000..5bf3d15489 --- /dev/null +++ b/external/sgx_libm/intel64/catanh.S @@ -0,0 +1,713 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanh.c" + .text +..TXTST0: +# -- Begin catanhf + .text + .align 16,0x90 + .globl catanhf +catanhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_catanhf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_catanhf.4: + call catanh@PLT +..___tag_value_catanhf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movss .L_2il0floatpacket.12(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + movsd 4(%rsp), %xmm0 +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type catanhf,@function + .size catanhf,.-catanhf + .data +# -- End catanhf + .text +# -- Begin catanh + .text + .align 16,0x90 + .globl catanh +catanh: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_catanh.8: +..L9: + + pushq %r15 + .cfi_def_cfa_offset 16 + .cfi_offset 15, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + xorb %r15b, %r15b + subq $200, %rsp + .cfi_def_cfa_offset 224 + movsd %xmm0, (%rsp) + movsd %xmm1, 8(%rsp) +..B2.2: + fnstcw 186(%rsp) +..B2.3: + movzwl 6(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + jge ..B2.26 +..B2.4: + testl %eax, %eax + jle ..B2.54 +..B2.5: + movzwl 14(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $2047, %edx + jge ..B2.27 +..B2.6: + testl %edx, %edx + jle ..B2.52 +..B2.7: + movzwl 186(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.11 +..B2.8: + orl $-64768, %edx + movw %dx, 184(%rsp) +..B2.9: + fldcw 184(%rsp) +..B2.10: + movb $1, %r15b +..B2.11: + fldl (%rsp) + fstl 160(%rsp) + fmul %st(0), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fldl 8(%rsp) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt .L_2il0floatpacket.13(%rip) + fldt pc_thresh(%rip) + fxch %st(4) + fsubrp %st, %st(1) + fsubp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fabs + fcomip %st(2), %st + fxch %st(1) + fstp %st(0) + jae ..B2.13 + jp ..B2.13 +..B2.12: + fldt .L_2il0floatpacket.13(%rip) + faddl 160(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 256 + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fxch %st(1) + fstpt 16(%rsp) + fstpt 32(%rsp) + call atan2l@PLT +..B2.79: + fldt 32(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 224 + fchs + fxch %st(1) + fstpt 112(%rsp) + fldt .L_2il0floatpacket.13(%rip) + fsubl 160(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 256 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 48(%rsp) + call atan2l@PLT +..B2.78: + fldt 48(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 224 + fldt .L_2il0floatpacket.14(%rip) + fxch %st(2) + fstpt 128(%rsp) + fldt 112(%rsp) + fldt 128(%rsp) + fsubrp %st, %st(1) + fmul %st(2), %st + fstpl 176(%rsp) + jmp ..B2.14 +..B2.13: + fldt 96(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 256 + fldt .L_2il0floatpacket.15(%rip) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B2.80: + fldt .L_2il0floatpacket.14(%rip) + addq $32, %rsp + .cfi_def_cfa_offset 224 + fldt .L_2il0floatpacket.13(%rip) + fld %st(0) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + fstpl 176(%rsp) + fldl 160(%rsp) + fadd %st, %st(2) + fxch %st(2) + fstpt 80(%rsp) + fsubp %st, %st(1) +..B2.14: + fldt 80(%rsp) + lea ones(%rip), %rdx + fstpt 112(%rsp) + fchs + fldt 112(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 64(%rsp) + fadd %st, %st(1) + fxch %st(1) + fstpt 144(%rsp) + fxch %st(1) + fstpt 128(%rsp) + fldt 128(%rsp) + fldt 128(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 144(%rsp) + fldt 96(%rsp) + fdivrp %st, %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fldt .L_2il0floatpacket.13(%rip) + fldt pc_thresh(%rip) + movb 121(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fxch %st(2) + fmull (%rdx,%rcx,8) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(1) + fabs + fcomip %st(1), %st + fstp %st(0) + jbe ..B2.16 +..B2.15: + fstp %st(0) + fldt 112(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 240 + fstpt (%rsp) + call logl@PLT +..B2.81: + fldt .L_2il0floatpacket.16(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 224 + fmulp %st, %st(1) + fstpl 168(%rsp) + jmp ..B2.17 +..B2.16: + fldt 48(%rsp) + fldt 64(%rsp) + faddp %st, %st(1) + fldt .L_2il0floatpacket.13(%rip) + faddp %st, %st(1) + fstpt 96(%rsp) + fldt .L_2il0floatpacket.15(%rip) + fmull 160(%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + fldt 96(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 240 + fdivrp %st, %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atanhl@PLT +..B2.82: + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 224 + fmulp %st, %st(1) + fstpl 168(%rsp) +..B2.17: + movzwl 174(%rsp), %eax + testl $32752, %eax + jne ..B2.20 +..B2.18: + testl $1048575, 172(%rsp) + jne ..B2.23 +..B2.19: + cmpl $0, 168(%rsp) + jne ..B2.23 +..B2.20: + movzwl 182(%rsp), %eax + testl $32752, %eax + jne ..B2.24 +..B2.21: + testl $1048575, 180(%rsp) + jne ..B2.23 +..B2.22: + cmpl $0, 176(%rsp) + je ..B2.24 +..B2.23: + lea _LDB_MIN_NORMAL(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 32(%rsp) +..B2.24: + testb %r15b, %r15b + je ..B2.51 +..B2.25: + fldcw 186(%rsp) + jmp ..B2.51 +..B2.26: + movzwl 14(%rsp), %edx + andl $32752, %edx + shrl $4, %edx +..B2.27: + cmpl $2047, %eax + je ..B2.68 +..B2.28: + cmpl $2047, %edx + je ..B2.61 +..B2.29: + cmpl $2047, %edx + jge ..B2.50 +..B2.30: + testl %eax, %eax + jle ..B2.59 +..B2.31: + cmpl $1023, %eax + jge ..B2.33 +..B2.32: + movsd (%rsp), %xmm0 + call atanh@PLT +..B2.83: + movb 15(%rsp), %dl + lea zeros(%rip), %rax + andb $-128, %dl + lea ones(%rip), %rcx + movsd %xmm0, 168(%rsp) + shrb $7, %dl + movsd (%rax), %xmm1 + movzbl %dl, %ebx + mulsd (%rcx,%rbx,8), %xmm1 + movsd %xmm1, 176(%rsp) + jmp ..B2.51 +..B2.33: + je ..B2.57 +..B2.34: + cmpl $2047, %eax + jge ..B2.49 +..B2.35: + movzwl 186(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.39 +..B2.36: + orl $-64768, %edx + movw %dx, 184(%rsp) +..B2.37: + fldcw 184(%rsp) +..B2.38: + movb $1, %r15b +..B2.39: + fldl (%rsp) + fld %st(0) + fmul %st(1), %st + fldl 8(%rsp) + fmul %st(0), %st + fldt .L_2il0floatpacket.13(%rip) + fld %st(0) + fadd %st(4), %st + fstpt 112(%rsp) + fld %st(0) + fsub %st(4), %st + fchs + fldt 112(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fadd %st(3), %st + fstpt 144(%rsp) + fstpt 128(%rsp) + fldt 128(%rsp) + fldt 128(%rsp) + fmulp %st, %st(1) + fadd %st(2), %st + fstpt 96(%rsp) + fldt 144(%rsp) + fldt 96(%rsp) + fdivrp %st, %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fldt pc_thresh(%rip) + movb 121(%rsp), %bl + andb $-128, %bl + shrb $7, %bl + movzbl %bl, %eax + lea ones(%rip), %rbx + fxch %st(1) + fmull (%rbx,%rax,8) + fstpt 112(%rsp) + fldt 112(%rsp) + fsub %st(2), %st + fabs + fcomip %st(1), %st + fstp %st(0) + jbe ..B2.41 +..B2.40: + fstp %st(0) + fstp %st(0) + fstp %st(0) + fstp %st(0) + fldt 112(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 240 + fstpt (%rsp) + call logl@PLT +..B2.84: + fldt .L_2il0floatpacket.16(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 224 + fmulp %st, %st(1) + fstpl 168(%rsp) + jmp ..B2.42 +..B2.41: + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 96(%rsp) + fldt .L_2il0floatpacket.15(%rip) + fmulp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + fldt 96(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 240 + fdivrp %st, %st(1) + fstpt (%rsp) + call atanhl@PLT +..B2.85: + fldt .L_2il0floatpacket.14(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 224 + fmulp %st, %st(1) + fstpl 168(%rsp) +..B2.42: + movzwl 174(%rsp), %eax + testl $32752, %eax + jne ..B2.46 +..B2.43: + testl $1048575, 172(%rsp) + jne ..B2.45 +..B2.44: + cmpl $0, 168(%rsp) + je ..B2.46 +..B2.45: + lea _LDB_MIN_NORMAL(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 32(%rsp) +..B2.46: + testb %r15b, %r15b + je ..B2.48 +..B2.47: + fldcw 186(%rsp) +..B2.48: + movb 15(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rbx,%rdx,8), %xmm0 + call asin@PLT + jmp ..B2.88 +..B2.49: + movb 7(%rsp), %al + lea ones(%rip), %rbx + andb $-128, %al + shrb $7, %al + pxor %xmm0, %xmm0 + movb 15(%rsp), %cl + andb $-128, %cl + shrb $7, %cl + movzbl %al, %edx + movzbl %cl, %esi + mulsd (%rbx,%rdx,8), %xmm0 + movsd %xmm0, 168(%rsp) + movsd (%rbx,%rsi,8), %xmm0 + call asin@PLT + jmp ..B2.88 +..B2.50: + movb 7(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + pxor %xmm0, %xmm0 + movzbl %al, %ecx + mulsd (%rdx,%rcx,8), %xmm0 + movsd %xmm0, 168(%rsp) + movsd 8(%rsp), %xmm0 + call atan@PLT +..B2.88: + movsd %xmm0, 176(%rsp) +..B2.51: + movsd 168(%rsp), %xmm0 + movsd 176(%rsp), %xmm1 + addq $200, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 224 + .cfi_offset 3, -24 + .cfi_offset 15, -16 +..B2.52: + testl $1048575, 12(%rsp) + jne ..B2.7 +..B2.53: + cmpl $0, 8(%rsp) + jne ..B2.7 + jmp ..B2.27 +..B2.54: + testl $1048575, 4(%rsp) + jne ..B2.5 +..B2.55: + cmpl $0, (%rsp) + jne ..B2.5 + jmp ..B2.26 +..B2.57: + testl $1048575, 4(%rsp) + jne ..B2.34 +..B2.58: + cmpl $0, (%rsp) + je ..B2.32 + jmp ..B2.34 +..B2.59: + testl $1048575, 4(%rsp) + jne ..B2.31 +..B2.60: + cmpl $0, (%rsp) + jne ..B2.31 + jmp ..B2.50 +..B2.61: + testl $1048575, 12(%rsp) + jne ..B2.63 +..B2.62: + cmpl $0, 8(%rsp) + je ..B2.29 +..B2.63: + cmpl $2047, %eax + jge ..B2.29 +..B2.64: + testl %eax, %eax + jle ..B2.66 +..B2.65: + movsd 8(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 168(%rsp) + movsd %xmm0, 176(%rsp) + jmp ..B2.51 +..B2.66: + testl $1048575, 4(%rsp) + jne ..B2.65 +..B2.67: + cmpl $0, (%rsp) + jne ..B2.65 + jmp ..B2.29 +..B2.68: + testl $1048575, 4(%rsp) + jne ..B2.70 +..B2.69: + cmpl $0, (%rsp) + je ..B2.28 +..B2.70: + cmpl $2047, %edx + jge ..B2.72 +..B2.71: + movsd (%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 168(%rsp) + movsd %xmm0, 176(%rsp) + jmp ..B2.51 +..B2.72: + testl $1048575, 12(%rsp) + jne ..B2.75 +..B2.73: + cmpl $0, 8(%rsp) + jne ..B2.75 +..B2.74: + movsd (%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, (%rsp) + movsd 8(%rsp), %xmm0 + movq $0, 168(%rsp) + call atan@PLT + jmp ..B2.88 +..B2.75: + movsd 8(%rsp), %xmm1 + movsd (%rsp), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + movsd %xmm0, 168(%rsp) + movsd %xmm1, 176(%rsp) + jmp ..B2.51 + .align 16,0x90 + .cfi_endproc + .type catanh,@function + .size catanh,.-catanh + .data +# -- End catanh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 16 +.L_2il0floatpacket.15: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 16 +pc_thresh: + .byte 0x00,0xc0,0xf5,0x28,0x5c,0x8f,0xc2,0xf5,0xf9,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type pc_thresh,@object + .size pc_thresh,16 + .align 16 +_LDB_MIN_NORMAL: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _LDB_MIN_NORMAL,@object + .size _LDB_MIN_NORMAL,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +zeros: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .type zeros,@object + .size zeros,16 + .align 4 +.L_2il0floatpacket.12: + .long 0x00800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/catanhl.S b/external/sgx_libm/intel64/catanhl.S new file mode 100644 index 0000000000..b30a49259c --- /dev/null +++ b/external/sgx_libm/intel64/catanhl.S @@ -0,0 +1,2753 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanhl.c" + .text +..TXTST0: +# -- Begin catanhl + .text + .align 16,0x90 + .globl catanhl +catanhl: +# parameter 1: 80 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_catanhl.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + subq $64, %rsp + .cfi_def_cfa_offset 80 + xorb %bpl, %bpl + fldt .L_2il0floatpacket.17(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 48(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) +..B1.2: + fnstcw 2(%rsp) +..B1.3: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.5: + fldcw (%rsp) +..B1.6: + movb $1, %bpl +..B1.7: + movzwl 88(%rsp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.14 +..B1.8: + testl %edx, %edx + jle ..B1.35 +..B1.9: + movzwl 104(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.15 +..B1.10: + testl %eax, %eax + jle ..B1.33 +..B1.11: + addq $-32, %rsp + .cfi_def_cfa_offset 112 + fldt 112(%rsp) + fstpt (%rsp) + fldt 128(%rsp) + fstpt 16(%rsp) +..___tag_value_catanhl.7: + call recatanhl +..___tag_value_catanhl.8: +..B1.56: + addq $32, %rsp + .cfi_def_cfa_offset 80 +..B1.12: + fstpt 16(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 112 + fldt 112(%rsp) + fstpt (%rsp) + fldt 128(%rsp) + fstpt 16(%rsp) +..___tag_value_catanhl.11: + call imcatanhl +..___tag_value_catanhl.12: +..B1.57: + addq $32, %rsp + .cfi_def_cfa_offset 80 +..B1.13: + fstpt 32(%rsp) + jmp ..B1.28 +..B1.14: + movzwl 104(%rsp), %eax + andl $32767, %eax +..B1.15: + cmpl $32767, %edx + je ..B1.47 +..B1.16: + cmpl $32767, %eax + je ..B1.41 +..B1.17: + cmpl $32767, %eax + jge ..B1.27 +..B1.18: + cmpl $0, 84(%rsp) + jne ..B1.20 +..B1.19: + cmpl $0, 80(%rsp) + je ..B1.27 +..B1.20: + cmpl $16383, %edx + jge ..B1.22 +..B1.21: + addq $-16, %rsp + .cfi_def_cfa_offset 96 + fldt 96(%rsp) + fstpt (%rsp) + call atanhl@PLT +..B1.58: + addq $16, %rsp + .cfi_def_cfa_offset 80 + lea 64+_CONSTANTS(%rip), %rax + movb 105(%rsp), %dl + lea _CONSTANTS(%rip), %rcx + andb $-128, %dl + fstpt 16(%rsp) + fldt (%rax) + shrb $7, %dl + movzbl %dl, %esi + shlq $4, %rsi + fldt (%rcx,%rsi) + fmulp %st, %st(1) + fstpt 32(%rsp) + jmp ..B1.28 +..B1.22: + je ..B1.38 +..B1.23: + cmpl $32767, %edx + jl ..B1.25 +..B1.24: + movb 89(%rsp), %dl + lea 64+_CONSTANTS(%rip), %rax + andb $-128, %dl + lea _CONSTANTS(%rip), %rdi + shrb $7, %dl + fldt (%rax) + movzbl %dl, %ecx + shlq $4, %rcx + fldt (%rdi,%rcx) + fmulp %st, %st(1) + fstpt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 96 + movb 121(%rsp), %sil + andb $-128, %sil + shrb $7, %sil + movzbl %sil, %r8d + shlq $4, %r8 + fldt (%rdi,%r8) + fstpt (%rsp) + call asinl@PLT + jmp ..B1.62 + .cfi_def_cfa_offset 80 +..B1.25: + addq $-32, %rsp + .cfi_def_cfa_offset 112 + fldt 112(%rsp) + fstpt (%rsp) + fldt 128(%rsp) + fstpt 16(%rsp) +..___tag_value_catanhl.19: + call recatanhl +..___tag_value_catanhl.20: +..B1.60: + addq $32, %rsp + .cfi_def_cfa_offset 80 +..B1.26: + fstpt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 96 + movb 121(%rsp), %al + lea _CONSTANTS(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + shlq $4, %rcx + fldt (%rdx,%rcx) + fstpt (%rsp) + call asinl@PLT + jmp ..B1.62 + .cfi_def_cfa_offset 80 +..B1.27: + movb 89(%rsp), %dl + lea 64+_CONSTANTS(%rip), %rax + andb $-128, %dl + lea _CONSTANTS(%rip), %rcx + shrb $7, %dl + fldt (%rax) + movzbl %dl, %esi + shlq $4, %rsi + fldt (%rcx,%rsi) + fmulp %st, %st(1) + fstpt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 96 + fldt 112(%rsp) + fstpt (%rsp) + call atanl@PLT +..B1.62: + addq $16, %rsp + .cfi_def_cfa_offset 80 + fstpt 32(%rsp) +..B1.28: + testb %bpl, %bpl + je ..B1.30 +..B1.29: + fldcw 2(%rsp) +..B1.30: + movq 48(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.40 +..B1.31: + fldt 16(%rsp) + fldt 32(%rsp) + movq 48(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.39 +..B1.32: + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 80 + .cfi_offset 6, -16 +..B1.33: + cmpl $0, 100(%rsp) + jne ..B1.11 +..B1.34: + cmpl $0, 96(%rsp) + jne ..B1.11 + jmp ..B1.15 +..B1.35: + cmpl $0, 84(%rsp) + jne ..B1.9 +..B1.36: + cmpl $0, 80(%rsp) + jne ..B1.9 + jmp ..B1.14 +..B1.38: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + je ..B1.21 + jmp ..B1.23 +..B1.39: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.40: + call __stack_chk_fail@PLT +..B1.41: + cmpl $-2147483648, 100(%rsp) + jne ..B1.43 +..B1.42: + cmpl $0, 96(%rsp) + je ..B1.17 +..B1.43: + cmpl $32767, %edx + jge ..B1.17 +..B1.44: + cmpl $0, 84(%rsp) + jne ..B1.46 +..B1.45: + cmpl $0, 80(%rsp) + je ..B1.17 +..B1.46: + fldt 96(%rsp) + fmul %st(0), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + jmp ..B1.28 +..B1.47: + cmpl $-2147483648, 84(%rsp) + jne ..B1.49 +..B1.48: + cmpl $0, 80(%rsp) + je ..B1.16 +..B1.49: + cmpl $32767, %eax + jge ..B1.51 +..B1.50: + fldt 80(%rsp) + fmul %st(0), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + jmp ..B1.28 +..B1.51: + fldt 80(%rsp) + movq $0x8000000000000000, %rax + cmpq 96(%rsp), %rax + je ..B1.53 +..B1.52: + fmul %st(0), %st + fstpt 16(%rsp) + fldt 96(%rsp) + fmul %st(0), %st + fstpt 32(%rsp) + jmp ..B1.28 +..B1.53: + fmul %st(0), %st + lea 64+_CONSTANTS(%rip), %rax + fstpt 80(%rsp) + fldt (%rax) + fstpt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 96 + fldt 112(%rsp) + fstpt (%rsp) + call atanl@PLT + jmp ..B1.62 + .align 16,0x90 + .cfi_endproc + .type catanhl,@function + .size catanhl,.-catanhl + .data +# -- End catanhl + .text +# -- Begin recatanhl + .text + .align 16,0x90 +recatanhl: +# parameter 1: 576 + %rsp +# parameter 2: 592 + %rsp +..B2.1: + .cfi_startproc +..___tag_value_recatanhl.33: +..L34: + + subq $568, %rsp + .cfi_def_cfa_offset 576 + lea 64+_CONSTANTS(%rip), %rdx + fldt 576(%rsp) + lea 128(%rsp), %rdi + movq %fs:40, %rax + xorq %rsp, %rax + fldt (%rdx) + movq %rax, 432(%rdi) + movl $0, 32(%rdi) + fstpt (%rsp) + fldt (%rsp) + fxch %st(1) + fstpt (%rdi) + fstpt 16(%rdi) +..___tag_value_recatanhl.36: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.37: +..B2.2: + fldt 592(%rsp) + lea 176(%rsp), %rdi + movl $0, 32(%rdi) + fstpt (%rdi) + fldt (%rsp) + fstpt 16(%rdi) +..___tag_value_recatanhl.38: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.39: +..B2.3: + fldt (%rsp) + lea _CONSTANTS(%rip), %rax + movzwl 136(%rsp), %edx + movl %edx, %esi + andl $32767, %esi + xorl %r9d, %r9d + movl $0, 256(%rsp) + cmpl $8383, %esi + fstpt 240(%rsp) + fldt (%rax) + fstpt 224(%rsp) + jl ..B2.7 +..B2.4: + cmpl $24383, %esi + jg ..B2.7 +..B2.5: + movzwl 232(%rsp), %r8d + movl %r8d, %ecx + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B2.7 +..B2.6: + cmpl $24383, %ecx + jle ..B2.10 +..B2.7: + lea 128(%rsp), %rdi +..___tag_value_recatanhl.40: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.41: +..B2.8: + lea 224(%rsp), %rdi +..___tag_value_recatanhl.42: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.43: +..B2.9: + movzwl 136(%rsp), %edx + movl %edx, %esi + movzwl 232(%rsp), %r8d + movl %r8d, %ecx + movl 256(%rsp), %r9d + andl $32767, %esi + andl $32767, %ecx +..B2.10: + movl 160(%rsp), %edi + lea -134(%r9,%rcx), %r10d + lea (%rsi,%rdi), %eax + cmpl %r10d, %eax + jle ..B2.27 +..B2.11: + movl 132(%rsp), %r11d + lea 134(%r9,%rcx), %r10d + cmpl %r10d, %eax + jge ..B2.28 +..B2.12: + testl %r11d, %r11d + jne ..B2.14 +..B2.13: + cmpl $0, 128(%rsp) + je ..B2.29 +..B2.14: + cmpl $0, 228(%rsp) + jne ..B2.16 +..B2.15: + cmpl $0, 224(%rsp) + je ..B2.28 +..B2.16: + cmpl %r9d, %edi + je ..B2.18 +..B2.17: + fldt 128(%rsp) + subl %r9d, %edi + fldt 144(%rsp) + addl $16383, %edi + andb $127, 9(%rsp) + andl $32767, %edi + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r9d, 160(%rsp) + fxch %st(2) + fstpt 128(%rsp) + fldt 128(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + movzwl 136(%rsp), %edx + jmp ..B2.19 +..B2.18: + fldt 128(%rsp) + fldt 144(%rsp) +..B2.19: + fldt 224(%rsp) + andl $32767, %edx + andl $32767, %r8d + fld %st(2) + movl %r9d, 304(%rsp) + cmpl %r8d, %edx + fadd %st(1), %st + jg ..B2.24 +..B2.20: + jne ..B2.25 +..B2.21: + movl 132(%rsp), %eax + movl 228(%rsp), %edx + cmpl %edx, %eax + ja ..B2.24 +..B2.22: + jne ..B2.25 +..B2.23: + movl 128(%rsp), %eax + cmpl 224(%rsp), %eax + jbe ..B2.25 +..B2.24: + fldt 240(%rsp) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + jmp ..B2.26 +..B2.25: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 240(%rsp) + faddp %st, %st(2) +..B2.26: + fld %st(1) + fadd %st(1), %st + fstpt 272(%rsp) + fldt 272(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 288(%rsp) + jmp ..B2.33 +..B2.27: + movl 132(%rsp), %r11d +..B2.28: + testl %r11d, %r11d + jne ..B2.30 +..B2.162: + cmpl $0, 128(%rsp) +..B2.29: + je ..B2.31 +..B2.30: + lea -16517(%r9,%rcx), %eax + lea -16383(%rdi,%rsi), %edx + cmpl %edx, %eax + jl ..B2.32 +..B2.31: + movaps 224(%rsp), %xmm0 + movaps 240(%rsp), %xmm1 + movaps 256(%rsp), %xmm2 + movaps %xmm0, 272(%rsp) + movaps %xmm1, 288(%rsp) + movaps %xmm2, 304(%rsp) + jmp ..B2.33 +..B2.32: + movaps 128(%rsp), %xmm0 + movaps 144(%rsp), %xmm1 + movaps 160(%rsp), %xmm2 + movaps %xmm0, 272(%rsp) + movaps %xmm1, 288(%rsp) + movaps %xmm2, 304(%rsp) +..B2.33: + movzwl 280(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.35 +..B2.34: + cmpl $24383, %eax + jle ..B2.37 +..B2.35: + lea 272(%rsp), %rdi +..___tag_value_recatanhl.44: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.45: +..B2.36: + lea 272(%rsp), %rdi +..___tag_value_recatanhl.46: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.47: +..B2.37: + fldt 272(%rsp) + lea 80+_CONSTANTS(%rip), %rdx + fld %st(0) + fld %st(1) + fld %st(2) + fldt 288(%rsp) + fmulp %st, %st(4) + movl 304(%rsp), %eax + fxch %st(3) + fadd %st(0), %st + fldt (%rdx) + addl %eax, %eax + fmul %st, %st(3) + movl %eax, 352(%rsp) + fxch %st(2) + fsub %st(3), %st + movzwl 184(%rsp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(4) + fmul %st(4), %st + cmpl $8383, %eax + fadd %st(0), %st + fxch %st(2) + fstpt 16(%rsp) + fxch %st(3) + fmul %st(0), %st + fld %st(1) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 320(%rsp) + fldt 320(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 336(%rsp) + jl ..B2.39 +..B2.38: + cmpl $24383, %eax + jle ..B2.41 +..B2.39: + lea 176(%rsp), %rdi +..___tag_value_recatanhl.48: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.49: +..B2.40: + lea 176(%rsp), %rdi +..___tag_value_recatanhl.50: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.51: +..B2.41: + fldt 176(%rsp) + fld %st(0) + fld %st(1) + fldt 16(%rsp) + fldt 192(%rsp) + fmul %st(4), %st + movzwl 328(%rsp), %edx + movl %edx, %esi + andl $32767, %esi + fadd %st(0), %st + fxch %st(4) + fmulp %st, %st(1) + movl 208(%rsp), %r9d + fsubr %st, %st(2) + addl %r9d, %r9d + faddp %st, %st(2) + fld %st(1) + cmpl $8383, %esi + fmul %st(2), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(2) + movl %r9d, 400(%rsp) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(1) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 368(%rsp) + fldt 368(%rsp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 384(%rsp) + fstpt 32(%rsp) + jl ..B2.45 +..B2.42: + cmpl $24383, %esi + jg ..B2.45 +..B2.43: + movzwl 376(%rsp), %r8d + movl %r8d, %ecx + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B2.45 +..B2.44: + cmpl $24383, %ecx + jle ..B2.48 +..B2.45: + lea 320(%rsp), %rdi +..___tag_value_recatanhl.52: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.53: +..B2.46: + lea 368(%rsp), %rdi +..___tag_value_recatanhl.54: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.55: +..B2.47: + movzwl 328(%rsp), %edx + movl %edx, %esi + movzwl 376(%rsp), %r8d + movl %r8d, %ecx + movl 400(%rsp), %r9d + andl $32767, %esi + andl $32767, %ecx +..B2.48: + movl 352(%rsp), %edi + lea -134(%r9,%rcx), %r10d + lea (%rsi,%rdi), %eax + cmpl %r10d, %eax + jle ..B2.65 +..B2.49: + movl 324(%rsp), %r11d + lea 134(%r9,%rcx), %r10d + cmpl %r10d, %eax + jge ..B2.66 +..B2.50: + testl %r11d, %r11d + jne ..B2.52 +..B2.51: + cmpl $0, 320(%rsp) + je ..B2.67 +..B2.52: + cmpl $0, 372(%rsp) + jne ..B2.54 +..B2.53: + cmpl $0, 368(%rsp) + je ..B2.66 +..B2.54: + cmpl %r9d, %edi + je ..B2.56 +..B2.55: + fldt 32(%rsp) + subl %r9d, %edi + fstpt (%rsp) + addl $16383, %edi + fldt 320(%rsp) + andl $32767, %edi + fldt 336(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r9d, 352(%rsp) + fxch %st(2) + fstpt 320(%rsp) + fldt 320(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 336(%rsp) + fldt 336(%rsp) + fxch %st(1) + fstpt 32(%rsp) + movzwl 328(%rsp), %edx + jmp ..B2.57 +..B2.56: + fldt 320(%rsp) + fstpt 32(%rsp) + fldt 336(%rsp) +..B2.57: + fldt 368(%rsp) + andl $32767, %edx + fldt 32(%rsp) + andl $32767, %r8d + movl %r9d, 448(%rsp) + cmpl %r8d, %edx + fadd %st(1), %st + jg ..B2.62 +..B2.58: + jne ..B2.63 +..B2.59: + movl 324(%rsp), %eax + movl 372(%rsp), %edx + cmpl %edx, %eax + ja ..B2.62 +..B2.60: + jne ..B2.63 +..B2.61: + movl 320(%rsp), %eax + cmpl 368(%rsp), %eax + jbe ..B2.63 +..B2.62: + fldt 32(%rsp) + fsub %st(1), %st + faddp %st, %st(2) + fldt 384(%rsp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B2.64 +..B2.63: + fldt 32(%rsp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 384(%rsp) + faddp %st, %st(1) + fstpt 32(%rsp) +..B2.64: + fldt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 432(%rsp) + jmp ..B2.71 +..B2.65: + movl 324(%rsp), %r11d +..B2.66: + testl %r11d, %r11d + jne ..B2.68 +..B2.164: + cmpl $0, 320(%rsp) +..B2.67: + je ..B2.69 +..B2.68: + lea -16517(%r9,%rcx), %eax + lea -16383(%rdi,%rsi), %edx + cmpl %edx, %eax + jl ..B2.70 +..B2.69: + movaps 368(%rsp), %xmm0 + movaps 384(%rsp), %xmm1 + movaps 400(%rsp), %xmm2 + movaps %xmm0, 416(%rsp) + movaps %xmm1, 432(%rsp) + movaps %xmm2, 448(%rsp) + jmp ..B2.71 +..B2.70: + movaps 320(%rsp), %xmm0 + movaps 336(%rsp), %xmm1 + movaps 352(%rsp), %xmm2 + movaps %xmm0, 416(%rsp) + movaps %xmm1, 432(%rsp) + movaps %xmm2, 448(%rsp) +..B2.71: + movzwl 136(%rsp), %edx + movl %edx, %esi + andl $32767, %esi + cmpl $8383, %esi + jl ..B2.75 +..B2.72: + cmpl $24383, %esi + jg ..B2.75 +..B2.73: + movzwl 232(%rsp), %r9d + movl %r9d, %ecx + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B2.75 +..B2.74: + cmpl $24383, %ecx + jle ..B2.78 +..B2.75: + lea 128(%rsp), %rdi +..___tag_value_recatanhl.56: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.57: +..B2.76: + lea 224(%rsp), %rdi +..___tag_value_recatanhl.58: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.59: +..B2.77: + movzwl 136(%rsp), %edx + movl %edx, %esi + movzwl 232(%rsp), %r9d + movl %r9d, %ecx + andl $32767, %esi + andl $32767, %ecx +..B2.78: + movl 160(%rsp), %edi + movl 256(%rsp), %r8d + lea (%rsi,%rdi), %eax + lea -134(%r8,%rcx), %r10d + cmpl %r10d, %eax + jle ..B2.95 +..B2.79: + movl 132(%rsp), %r11d + lea 134(%r8,%rcx), %r10d + cmpl %r10d, %eax + jge ..B2.96 +..B2.80: + testl %r11d, %r11d + jne ..B2.82 +..B2.81: + cmpl $0, 128(%rsp) + je ..B2.97 +..B2.82: + cmpl $0, 228(%rsp) + jne ..B2.84 +..B2.83: + cmpl $0, 224(%rsp) + je ..B2.96 +..B2.84: + cmpl %r8d, %edi + je ..B2.86 +..B2.85: + fldt 32(%rsp) + subl %r8d, %edi + fstpt (%rsp) + addl $16383, %edi + fldt 128(%rsp) + andl $32767, %edi + fldt 144(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r8d, 160(%rsp) + fxch %st(2) + fstpt 128(%rsp) + fldt 128(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + movzwl 136(%rsp), %edx + jmp ..B2.87 +..B2.86: + fldt 128(%rsp) + fldt 144(%rsp) +..B2.87: + fldt 224(%rsp) + andl $32767, %edx + andl $32767, %r9d + fld %st(2) + movl %r8d, 304(%rsp) + cmpl %r9d, %edx + fsub %st(1), %st + jg ..B2.92 +..B2.88: + jne ..B2.93 +..B2.89: + movl 132(%rsp), %eax + movl 228(%rsp), %edx + cmpl %edx, %eax + ja ..B2.92 +..B2.90: + jne ..B2.93 +..B2.91: + movl 128(%rsp), %eax + cmpl 224(%rsp), %eax + jbe ..B2.93 +..B2.92: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 240(%rsp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B2.94 +..B2.93: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 240(%rsp) + fsubrp %st, %st(2) +..B2.94: + fld %st(1) + fadd %st(1), %st + fstpt 272(%rsp) + fldt 272(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 288(%rsp) + jmp ..B2.101 +..B2.95: + movl 132(%rsp), %r11d +..B2.96: + testl %r11d, %r11d + jne ..B2.98 +..B2.161: + cmpl $0, 128(%rsp) +..B2.97: + je ..B2.99 +..B2.98: + lea -16517(%r8,%rcx), %eax + lea -16383(%rdi,%rsi), %edx + cmpl %edx, %eax + jl ..B2.100 +..B2.99: + fldt 224(%rsp) + fchs + movl %r8d, 304(%rsp) + fstpt 272(%rsp) + fldt 240(%rsp) + fchs + fstpt 288(%rsp) + jmp ..B2.101 +..B2.100: + movaps 128(%rsp), %xmm0 + movaps 144(%rsp), %xmm1 + movaps 160(%rsp), %xmm2 + movaps %xmm0, 272(%rsp) + movaps %xmm1, 288(%rsp) + movaps %xmm2, 304(%rsp) +..B2.101: + movzwl 280(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.103 +..B2.102: + cmpl $24383, %eax + jle ..B2.105 +..B2.103: + lea 272(%rsp), %rdi +..___tag_value_recatanhl.60: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.61: +..B2.104: + lea 272(%rsp), %rdi +..___tag_value_recatanhl.62: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.63: +..B2.105: + fldt 272(%rsp) + fld %st(0) + fld %st(1) + fldt 16(%rsp) + fldt 288(%rsp) + fxch %st(1) + fmul %st(4), %st + movl 304(%rsp), %edi + fsubr %st, %st(3) + addl %edi, %edi + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(3) + movl %edi, 352(%rsp) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(1) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 320(%rsp) + fldt 320(%rsp) + fsubrp %st, %st(2) + movzwl 328(%rsp), %edx + movl %edx, %esi + andl $32767, %esi + fadd %st, %st(1) + fxch %st(1) + fstpt 336(%rsp) + cmpl $8383, %esi + fstpt 32(%rsp) + jl ..B2.109 +..B2.106: + cmpl $24383, %esi + jg ..B2.109 +..B2.107: + movzwl 376(%rsp), %r9d + movl %r9d, %ecx + andl $32767, %ecx + cmpl $8383, %ecx + jl ..B2.109 +..B2.108: + cmpl $24383, %ecx + jle ..B2.112 +..B2.109: + lea 320(%rsp), %rdi +..___tag_value_recatanhl.64: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.65: +..B2.110: + lea 368(%rsp), %rdi +..___tag_value_recatanhl.66: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.67: +..B2.111: + movzwl 328(%rsp), %edx + movl %edx, %esi + movzwl 376(%rsp), %r9d + movl %r9d, %ecx + movl 352(%rsp), %edi + andl $32767, %esi + andl $32767, %ecx +..B2.112: + movl 400(%rsp), %r8d + lea (%rdi,%rsi), %eax + lea -134(%r8,%rcx), %r10d + cmpl %r10d, %eax + jle ..B2.129 +..B2.113: + movl 324(%rsp), %r11d + lea 134(%r8,%rcx), %r10d + cmpl %r10d, %eax + jge ..B2.130 +..B2.114: + testl %r11d, %r11d + jne ..B2.116 +..B2.115: + cmpl $0, 320(%rsp) + je ..B2.131 +..B2.116: + cmpl $0, 372(%rsp) + jne ..B2.118 +..B2.117: + cmpl $0, 368(%rsp) + je ..B2.130 +..B2.118: + cmpl %r8d, %edi + je ..B2.120 +..B2.119: + fldt 32(%rsp) + subl %r8d, %edi + fstpt (%rsp) + addl $16383, %edi + fldt 320(%rsp) + andl $32767, %edi + fldt 336(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r8d, 352(%rsp) + fxch %st(2) + fstpt 320(%rsp) + fldt 320(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 336(%rsp) + fldt 336(%rsp) + movzwl 328(%rsp), %edx + jmp ..B2.121 +..B2.120: + fldt 320(%rsp) + fldt 336(%rsp) +..B2.121: + fldt 368(%rsp) + andl $32767, %edx + andl $32767, %r9d + fld %st(2) + movl %r8d, 496(%rsp) + cmpl %r9d, %edx + fadd %st(1), %st + jg ..B2.126 +..B2.122: + jne ..B2.127 +..B2.123: + movl 324(%rsp), %eax + movl 372(%rsp), %edx + cmpl %edx, %eax + ja ..B2.126 +..B2.124: + jne ..B2.127 +..B2.125: + movl 320(%rsp), %eax + cmpl 368(%rsp), %eax + jbe ..B2.127 +..B2.126: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 384(%rsp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.128 +..B2.127: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 384(%rsp) + faddp %st, %st(1) +..B2.128: + fld %st(0) + fadd %st(2), %st + fstpt 464(%rsp) + fldt 464(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 480(%rsp) + jmp ..B2.135 +..B2.129: + movl 324(%rsp), %r11d +..B2.130: + testl %r11d, %r11d + jne ..B2.132 +..B2.163: + cmpl $0, 320(%rsp) +..B2.131: + je ..B2.133 +..B2.132: + lea -16517(%r8,%rcx), %eax + lea -16383(%rdi,%rsi), %edx + cmpl %edx, %eax + jl ..B2.134 +..B2.133: + movaps 368(%rsp), %xmm0 + movaps 384(%rsp), %xmm1 + movaps 400(%rsp), %xmm2 + movaps %xmm0, 464(%rsp) + movaps %xmm1, 480(%rsp) + movaps %xmm2, 496(%rsp) + jmp ..B2.135 +..B2.134: + movaps 320(%rsp), %xmm0 + movaps 336(%rsp), %xmm1 + movaps 352(%rsp), %xmm2 + movl 352(%rsp), %r8d + movaps %xmm0, 464(%rsp) + movaps %xmm1, 480(%rsp) + movaps %xmm2, 496(%rsp) +..B2.135: + movzwl 424(%rsp), %ecx + movzwl 472(%rsp), %edi + andl $32767, %ecx + andl $32767, %edi + movl 448(%rsp), %esi + lea (%rsi,%rcx), %edx + lea (%r8,%rdi), %eax + subl %eax, %edx + cmpl $-1, %edx + jge ..B2.145 +..B2.136: + cmpl $8383, %ecx + jl ..B2.140 +..B2.137: + cmpl $24383, %ecx + jg ..B2.140 +..B2.138: + cmpl $8383, %edi + jl ..B2.140 +..B2.139: + cmpl $24383, %edi + jle ..B2.143 +..B2.140: + lea 416(%rsp), %rdi +..___tag_value_recatanhl.68: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.69: +..B2.141: + lea 464(%rsp), %rdi +..___tag_value_recatanhl.70: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.71: +..B2.142: + movl 448(%rsp), %esi + movl 496(%rsp), %r8d +..B2.143: + fldt 464(%rsp) + subl %r8d, %esi + fld %st(0) + fld %st(1) + fldt 416(%rsp) + lea 512(%rsp), %rdi + fld %st(0) + fdiv %st(4), %st + fldt 16(%rsp) + fld %st(0) + fmul %st(2), %st + fld %st(0) + movl %esi, 64(%rsp) + lea 32(%rsp), %rsi + fsubr %st(3), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(3), %st + fxch %st(2) + fmul %st(7), %st + fsubr %st, %st(6) + faddp %st, %st(6) + fxch %st(4) + fsub %st(5), %st + fld %st(4) + fmul %st(6), %st + fxch %st(2) + fmul %st, %st(6) + fxch %st(1) + fmul %st, %st(5) + fxch %st(6) + faddp %st, %st(5) + fld %st(4) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fsubp %st, %st(1) + fldt 400(%rsi) + faddp %st, %st(1) + fldt 448(%rsi) + fmul %st(2), %st + fsubrp %st, %st(1) + fdivp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt (%rsi) + fldt (%rsi) + fsubrp %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + faddp %st, %st(1) + fstpt 16(%rsi) +..___tag_value_recatanhl.72: + call __libm_log_k80@PLT +..___tag_value_recatanhl.73: + jmp ..B2.153 +..B2.145: + movzwl 136(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.149 +..B2.146: + cmpl $24383, %eax + jg ..B2.149 +..B2.147: + cmpl $8383, %edi + jl ..B2.149 +..B2.148: + cmpl $24383, %edi + jle ..B2.152 +..B2.149: + lea 128(%rsp), %rdi +..___tag_value_recatanhl.74: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.75: +..B2.150: + lea 464(%rsp), %rdi +..___tag_value_recatanhl.76: + call __libm_normalizel_k80@PLT +..___tag_value_recatanhl.77: +..B2.151: + movl 496(%rsp), %r8d +..B2.152: + fldt 128(%rsp) + lea 512(%rsp), %rdi + fld %st(0) + lea 80(%rsp), %rsi + fldt 384(%rsi) + fdivr %st, %st(1) + fld %st(0) + fld %st(1) + fldt -64(%rsi) + fld %st(0) + fmul %st(5), %st + fld %st(0) + movl 80(%rsi), %eax + fsubr %st(6), %st + subl %r8d, %eax + faddp %st, %st(1) + fld %st(0) + addl $2, %eax + movl %eax, 32(%rsi) + fsubr %st(6), %st + fxch %st(2) + fmul %st(5), %st + fsubr %st, %st(4) + faddp %st, %st(4) + fxch %st(2) + fsub %st(3), %st + fld %st(2) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fldt 64(%rsi) + faddp %st, %st(3) + fldt 400(%rsi) + fmul %st(2), %st + fsubrp %st, %st(3) + fdivrp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt (%rsi) + fldt (%rsi) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 16(%rsi) + fstpt (%rsp) +..___tag_value_recatanhl.78: + call __libm_log1p_k80@PLT +..___tag_value_recatanhl.79: +..B2.153: + movl 544(%rsp), %edi + addl $-2, %edi + movl %edi, 544(%rsp) +..B2.154: + addq $-32, %rsp + .cfi_def_cfa_offset 608 + fldt 544(%rsp) + fstpt (%rsp) + fldt 560(%rsp) + fstpt 16(%rsp) +..___tag_value_recatanhl.81: + call __libm_scalbl_k80@PLT +..___tag_value_recatanhl.82: +..B2.160: + addq $32, %rsp + .cfi_def_cfa_offset 576 +..B2.155: + movq 560(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.157 +..B2.156: + addq $568, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 576 +..B2.157: + fstp %st(0) + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type recatanhl,@function + .size recatanhl,.-recatanhl + .data +# -- End recatanhl + .text +# -- Begin imcatanhl + .text + .align 16,0x90 +imcatanhl: +# parameter 1: 656 + %rsp +# parameter 2: 672 + %rsp +..B3.1: + .cfi_startproc +..___tag_value_imcatanhl.87: +..L88: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + subq $632, %rsp + .cfi_def_cfa_offset 656 + lea _CONSTANTS(%rip), %rbx + fldt 656(%rsp) + lea 64+_CONSTANTS(%rip), %r9 + movb 665(%rsp), %sil + lea 288(%rsp), %rdi + andb $-128, %sil + shrb $7, %sil + fldt (%r9) + movb 681(%rsp), %dl + andb $-128, %dl + shrb $7, %dl + movzbl %sil, %r8d + shlq $4, %r8 + movzbl %dl, %ecx + shlq $4, %rcx + movq %fs:40, %rax + fldt (%rbx,%r8) + xorq %rsp, %rax + fmulp %st, %st(2) + fldt 32(%rbx,%rcx) + movq %rax, 336(%rdi) + fstpt 16(%rsp) + movl $0, 32(%rdi) + fxch %st(1) + fstpt (%rdi) + fstpt (%rsp) + fldt (%rsp) + fstpt 16(%rdi) +..___tag_value_imcatanhl.94: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.95: +..B3.2: + fldt 672(%rsp) + lea 336(%rsp), %rdi + fldt (%rsp) + movb 681(%rsp), %al + andb $-128, %al + shrb $7, %al + fstpt 16(%rdi) + movzbl %al, %edx + shlq $4, %rdx + movl $0, 32(%rdi) + fldt (%rbx,%rdx) + fmulp %st, %st(1) + fstpt (%rdi) +..___tag_value_imcatanhl.96: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.97: +..B3.3: + fldt (%rbx) + movzwl 296(%rsp), %eax + andl $32767, %eax + movl $0, 416(%rsp) + cmpl $8383, %eax + fstpt 384(%rsp) + fldt (%rsp) + fstpt 400(%rsp) + jl ..B3.5 +..B3.4: + cmpl $24383, %eax + jle ..B3.7 +..B3.5: + lea 288(%rsp), %rdi +..___tag_value_imcatanhl.98: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.99: +..B3.6: + lea 288(%rsp), %rdi +..___tag_value_imcatanhl.100: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.101: +..B3.7: + fldt 288(%rsp) + lea 80+_CONSTANTS(%rip), %rdx + fld %st(0) + fld %st(1) + fld %st(2) + fld %st(3) + movl 320(%rsp), %eax + fldt (%rdx) + addl %eax, %eax + fmul %st, %st(4) + movl %eax, 464(%rsp) + fxch %st(3) + fsubr %st(4), %st + fld %st(0) + fchs + movzwl 344(%rsp), %eax + fadd %st(5), %st + fld %st(0) + andl $32767, %eax + fxch %st(5) + fstpt (%rsp) + cmpl $8383, %eax + fxch %st(1) + fsubrp %st, %st(5) + fxch %st(3) + fmul %st(4), %st + fxch %st(2) + fsub %st(3), %st + fxch %st(1) + fsub %st(4), %st + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 304(%rsp) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 432(%rsp) + fldt 432(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 448(%rsp) + jl ..B3.9 +..B3.8: + cmpl $24383, %eax + jle ..B3.11 +..B3.9: + lea 336(%rsp), %rdi +..___tag_value_imcatanhl.102: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.103: +..B3.10: + lea 336(%rsp), %rdi +..___tag_value_imcatanhl.104: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.105: +..B3.11: + fldt 336(%rsp) + fld %st(0) + fld %st(1) + fldt (%rsp) + fmul %st(3), %st + movzwl 392(%rsp), %esi + movl %esi, %r10d + andl $32767, %r10d + fsubr %st, %st(2) + movl 368(%rsp), %eax + faddp %st, %st(2) + fld %st(1) + addl %eax, %eax + fmul %st(2), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(2) + cmpl $8383, %r10d + movl %eax, 512(%rsp) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fldt 352(%rsp) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 480(%rsp) + fldt 480(%rsp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 496(%rsp) + fstpt 32(%rsp) + jl ..B3.15 +..B3.12: + cmpl $24383, %r10d + jg ..B3.15 +..B3.13: + movzwl 440(%rsp), %edi + movl %edi, %r9d + andl $32767, %r9d + cmpl $8383, %r9d + jl ..B3.15 +..B3.14: + cmpl $24383, %r9d + jle ..B3.18 +..B3.15: + lea 384(%rsp), %rdi +..___tag_value_imcatanhl.106: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.107: +..B3.16: + lea 432(%rsp), %rdi +..___tag_value_imcatanhl.108: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.109: +..B3.17: + movzwl 392(%rsp), %esi + movl %esi, %r10d + movzwl 440(%rsp), %edi + movl %edi, %r9d + andl $32767, %r10d + andl $32767, %r9d +..B3.18: + movl 416(%rsp), %eax + movl 464(%rsp), %edx + lea (%r10,%rax), %ebx + lea -134(%rdx,%r9), %ecx + cmpl %ecx, %ebx + jle ..B3.35 +..B3.19: + movl 388(%rsp), %r8d + lea 134(%rdx,%r9), %ecx + cmpl %ecx, %ebx + jge ..B3.36 +..B3.20: + testl %r8d, %r8d + jne ..B3.22 +..B3.21: + cmpl $0, 384(%rsp) + je ..B3.37 +..B3.22: + cmpl $0, 436(%rsp) + jne ..B3.24 +..B3.23: + cmpl $0, 432(%rsp) + je ..B3.36 +..B3.24: + cmpl %edx, %eax + je ..B3.26 +..B3.25: + fldt 32(%rsp) + subl %edx, %eax + fstpt (%rsp) + addl $16383, %eax + fldt 384(%rsp) + andl $32767, %eax + fldt 400(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 416(%rsp) + fxch %st(2) + fstpt 384(%rsp) + fldt 384(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 400(%rsp) + fldt 400(%rsp) + fxch %st(1) + fstpt 32(%rsp) + movzwl 392(%rsp), %esi + jmp ..B3.27 +..B3.26: + fldt 384(%rsp) + fstpt 32(%rsp) + fldt 400(%rsp) +..B3.27: + fldt 432(%rsp) + andl $32767, %esi + fldt 32(%rsp) + andl $32767, %edi + movl %edx, 560(%rsp) + cmpl %edi, %esi + fsub %st(1), %st + jg ..B3.32 +..B3.28: + jne ..B3.33 +..B3.29: + movl 388(%rsp), %eax + movl 436(%rsp), %edx + cmpl %edx, %eax + ja ..B3.32 +..B3.30: + jne ..B3.33 +..B3.31: + movl 384(%rsp), %eax + cmpl 432(%rsp), %eax + jbe ..B3.33 +..B3.32: + fldt 32(%rsp) + fsub %st(1), %st + fsubp %st, %st(2) + fldt 448(%rsp) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B3.34 +..B3.33: + fldt 32(%rsp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fldt 448(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) +..B3.34: + fldt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 528(%rsp) + fldt 528(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 544(%rsp) + jmp ..B3.41 +..B3.35: + movl 388(%rsp), %r8d +..B3.36: + testl %r8d, %r8d + jne ..B3.38 +..B3.179: + cmpl $0, 384(%rsp) +..B3.37: + je ..B3.39 +..B3.38: + lea -16517(%rdx,%r9), %ecx + lea -16383(%rax,%r10), %eax + cmpl %eax, %ecx + jl ..B3.40 +..B3.39: + fldt 432(%rsp) + fchs + movl %edx, 560(%rsp) + fstpt 528(%rsp) + fldt 448(%rsp) + fchs + fstpt 544(%rsp) + jmp ..B3.41 +..B3.40: + movaps 384(%rsp), %xmm0 + movaps 400(%rsp), %xmm1 + movaps 416(%rsp), %xmm2 + movaps %xmm0, 528(%rsp) + movaps %xmm1, 544(%rsp) + movaps %xmm2, 560(%rsp) +..B3.41: + movzwl 536(%rsp), %esi + movl %esi, %r10d + andl $32767, %r10d + cmpl $8383, %r10d + jl ..B3.45 +..B3.42: + cmpl $24383, %r10d + jg ..B3.45 +..B3.43: + movzwl 488(%rsp), %edi + movl %edi, %r9d + andl $32767, %r9d + cmpl $8383, %r9d + jl ..B3.45 +..B3.44: + cmpl $24383, %r9d + jle ..B3.48 +..B3.45: + lea 528(%rsp), %rdi +..___tag_value_imcatanhl.110: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.111: +..B3.46: + lea 480(%rsp), %rdi +..___tag_value_imcatanhl.112: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.113: +..B3.47: + movzwl 536(%rsp), %esi + movl %esi, %r10d + movzwl 488(%rsp), %edi + movl %edi, %r9d + andl $32767, %r10d + andl $32767, %r9d +..B3.48: + movl 512(%rsp), %edx + movl 560(%rsp), %eax + lea -134(%rdx,%r9), %ecx + lea (%r10,%rax), %ebx + cmpl %ecx, %ebx + jle ..B3.65 +..B3.49: + movl 532(%rsp), %r8d + lea 134(%rdx,%r9), %ecx + cmpl %ecx, %ebx + jge ..B3.66 +..B3.50: + testl %r8d, %r8d + jne ..B3.52 +..B3.51: + cmpl $0, 528(%rsp) + je ..B3.67 +..B3.52: + cmpl $0, 484(%rsp) + jne ..B3.54 +..B3.53: + cmpl $0, 480(%rsp) + je ..B3.66 +..B3.54: + cmpl %edx, %eax + je ..B3.56 +..B3.55: + fldt 32(%rsp) + subl %edx, %eax + fstpt (%rsp) + addl $16383, %eax + fldt 528(%rsp) + andl $32767, %eax + fldt 544(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 560(%rsp) + fxch %st(2) + fstpt 528(%rsp) + fldt 528(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 544(%rsp) + fldt 544(%rsp) + fstpt 32(%rsp) + movzwl 536(%rsp), %esi + jmp ..B3.57 +..B3.56: + fldt 528(%rsp) + fldt 544(%rsp) + fstpt 32(%rsp) +..B3.57: + fldt 480(%rsp) + andl $32767, %esi + andl $32767, %edi + fld %st(1) + movl %edx, 608(%rsp) + cmpl %edi, %esi + fsub %st(1), %st + jg ..B3.62 +..B3.58: + jne ..B3.63 +..B3.59: + movl 532(%rsp), %eax + movl 484(%rsp), %ecx + cmpl %ecx, %eax + ja ..B3.62 +..B3.60: + jne ..B3.63 +..B3.61: + movl 528(%rsp), %eax + cmpl 480(%rsp), %eax + jbe ..B3.63 +..B3.62: + fldt 32(%rsp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt 496(%rsp) + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) + jmp ..B3.64 +..B3.63: + fldt 496(%rsp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fldt 32(%rsp) + faddp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) +..B3.64: + fldt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 576(%rsp) + fldt 576(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 592(%rsp) + jmp ..B3.71 +..B3.65: + movl 532(%rsp), %r8d +..B3.66: + testl %r8d, %r8d + jne ..B3.68 +..B3.180: + cmpl $0, 528(%rsp) +..B3.67: + je ..B3.69 +..B3.68: + lea -16517(%rdx,%r9), %ecx + lea -16383(%rax,%r10), %ebx + cmpl %ebx, %ecx + jl ..B3.70 +..B3.69: + fldt 480(%rsp) + fchs + movl %edx, 608(%rsp) + fstpt 576(%rsp) + fldt 496(%rsp) + fchs + fstpt 592(%rsp) + jmp ..B3.71 +..B3.70: + movaps 528(%rsp), %xmm0 + movl %eax, %edx + movaps 544(%rsp), %xmm1 + movaps 560(%rsp), %xmm2 + movaps %xmm0, 576(%rsp) + movaps %xmm1, 592(%rsp) + movaps %xmm2, 608(%rsp) +..B3.71: + movzwl 584(%rsp), %eax + andl $32767, %eax + lea -16383(%rdx,%rax), %edx + cmpl $-6, %edx + jge ..B3.164 +..B3.72: + movzwl 392(%rsp), %eax + movl %eax, %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B3.76 +..B3.73: + cmpl $24383, %edx + jg ..B3.76 +..B3.74: + movzwl 296(%rsp), %ecx + movl %ecx, %r9d + andl $32767, %r9d + cmpl $8383, %r9d + jl ..B3.76 +..B3.75: + cmpl $24383, %r9d + jle ..B3.79 +..B3.76: + lea 384(%rsp), %rdi +..___tag_value_imcatanhl.114: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.115: +..B3.77: + lea 288(%rsp), %rdi +..___tag_value_imcatanhl.116: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.117: +..B3.78: + movzwl 296(%rsp), %ecx + movl %ecx, %r9d + movzwl 392(%rsp), %eax + movl %eax, %edx + andl $32767, %r9d + andl $32767, %edx +..B3.79: + movl 320(%rsp), %r8d + movl 416(%rsp), %edi + lea -134(%r8,%r9), %ebx + lea (%rdx,%rdi), %r10d + cmpl %r10d, %ebx + lea (%r9,%r8), %esi + jge ..B3.96 +..B3.80: + movl 388(%rsp), %r13d + lea 134(%r8,%r9), %r11d + cmpl %r11d, %r10d + jge ..B3.97 +..B3.81: + testl %r13d, %r13d + jne ..B3.83 +..B3.82: + cmpl $0, 384(%rsp) + je ..B3.98 +..B3.83: + cmpl $0, 292(%rsp) + jne ..B3.85 +..B3.84: + cmpl $0, 288(%rsp) + je ..B3.97 +..B3.85: + cmpl %r8d, %edi + je ..B3.87 +..B3.86: + fldt 32(%rsp) + subl %r8d, %edi + fstpt (%rsp) + addl $16383, %edi + fldt 384(%rsp) + andl $32767, %edi + fldt 400(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edi, %eax + movl %r8d, %edi + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 384(%rsp) + fldt 384(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 392(%rsp), %eax + movl %eax, %edx + andl $32767, %edx + movl %r8d, 416(%rsp) + movl %edx, %r10d + fstpt 400(%rsp) + fldt 400(%rsp) + jmp ..B3.88 +..B3.87: + fldt 384(%rsp) + movl %eax, %r10d + fldt 400(%rsp) + andl $32767, %r10d +..B3.88: + fldt 288(%rsp) + movl %ecx, %r11d + andl $32767, %r11d + fld %st(2) + movl %r8d, 80(%rsp) + cmpl %r11d, %r10d + fadd %st(1), %st + jg ..B3.93 +..B3.89: + jne ..B3.94 +..B3.90: + movl 388(%rsp), %r10d + movl 292(%rsp), %r11d + cmpl %r11d, %r10d + ja ..B3.93 +..B3.91: + jne ..B3.94 +..B3.92: + movl 384(%rsp), %r10d + cmpl 288(%rsp), %r10d + jbe ..B3.94 +..B3.93: + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 304(%rsp) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B3.95 +..B3.94: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 304(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) +..B3.95: + fldt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 64(%rsp) + jmp ..B3.102 +..B3.96: + movl 388(%rsp), %r13d +..B3.97: + testl %r13d, %r13d + jne ..B3.99 +..B3.178: + cmpl $0, 384(%rsp) +..B3.98: + je ..B3.100 +..B3.99: + lea -16517(%r8,%r9), %r10d + lea -16383(%rdi,%rdx), %r11d + cmpl %r11d, %r10d + jl ..B3.101 +..B3.100: + movaps 288(%rsp), %xmm0 + movaps 304(%rsp), %xmm1 + movaps 320(%rsp), %xmm2 + movaps %xmm0, 48(%rsp) + movaps %xmm1, 64(%rsp) + movaps %xmm2, 80(%rsp) + jmp ..B3.102 +..B3.101: + movaps 384(%rsp), %xmm0 + movaps 400(%rsp), %xmm1 + movaps 416(%rsp), %xmm2 + movaps %xmm0, 48(%rsp) + movaps %xmm1, 64(%rsp) + movaps %xmm2, 80(%rsp) +..B3.102: + cmpl $8383, %edx + jl ..B3.106 +..B3.103: + cmpl $24383, %edx + jg ..B3.106 +..B3.104: + cmpl $8383, %r9d + jl ..B3.106 +..B3.105: + cmpl $24383, %r9d + jle ..B3.109 +..B3.106: + lea 384(%rsp), %rdi +..___tag_value_imcatanhl.118: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.119: +..B3.107: + lea 288(%rsp), %rdi +..___tag_value_imcatanhl.120: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.121: +..B3.108: + movzwl 296(%rsp), %ecx + movl %ecx, %eax + andl $32767, %eax + movl 320(%rsp), %r8d + movl 416(%rsp), %edi + lea (%r8,%rax), %esi + lea -134(%r8,%rax), %ebx + movzwl 392(%rsp), %eax + movl %eax, %edx + andl $32767, %edx +..B3.109: + lea (%rdi,%rdx), %r9d + cmpl %r9d, %ebx + jge ..B3.126 +..B3.110: + movl 388(%rsp), %r10d + lea 134(%rsi), %ebx + cmpl %ebx, %r9d + jge ..B3.127 +..B3.111: + testl %r10d, %r10d + jne ..B3.113 +..B3.112: + cmpl $0, 384(%rsp) + je ..B3.128 +..B3.113: + cmpl $0, 292(%rsp) + jne ..B3.115 +..B3.114: + cmpl $0, 288(%rsp) + je ..B3.127 +..B3.115: + cmpl %r8d, %edi + je ..B3.117 +..B3.116: + fldt 32(%rsp) + subl %r8d, %edi + fstpt (%rsp) + addl $16383, %edi + fldt 384(%rsp) + andl $32767, %edi + fldt 400(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edi, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r8d, 416(%rsp) + fxch %st(2) + fstpt 384(%rsp) + fldt 384(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 400(%rsp) + fldt 400(%rsp) + fxch %st(1) + fstpt 32(%rsp) + movzwl 392(%rsp), %eax + jmp ..B3.118 +..B3.117: + fldt 384(%rsp) + fstpt 32(%rsp) + fldt 400(%rsp) +..B3.118: + fldt 288(%rsp) + andl $32767, %eax + fldt 32(%rsp) + andl $32767, %ecx + movl %r8d, 128(%rsp) + cmpl %ecx, %eax + fsub %st(1), %st + jg ..B3.123 +..B3.119: + jne ..B3.124 +..B3.120: + movl 388(%rsp), %eax + movl 292(%rsp), %edx + cmpl %edx, %eax + ja ..B3.123 +..B3.121: + jne ..B3.124 +..B3.122: + movl 384(%rsp), %eax + cmpl 288(%rsp), %eax + jbe ..B3.124 +..B3.123: + fldt 32(%rsp) + fsub %st(1), %st + fsubp %st, %st(2) + fldt 304(%rsp) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B3.125 +..B3.124: + fldt 32(%rsp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fldt 304(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) +..B3.125: + fldt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 96(%rsp) + fldt 96(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 112(%rsp) + jmp ..B3.132 +..B3.126: + movl 388(%rsp), %r10d +..B3.127: + testl %r10d, %r10d + jne ..B3.129 +..B3.177: + cmpl $0, 384(%rsp) +..B3.128: + je ..B3.130 +..B3.129: + addl $-16517, %esi + lea -16383(%rdi,%rdx), %eax + cmpl %eax, %esi + jl ..B3.131 +..B3.130: + fldt 288(%rsp) + fchs + movl %r8d, 128(%rsp) + fstpt 96(%rsp) + fldt 304(%rsp) + fchs + fstpt 112(%rsp) + jmp ..B3.132 +..B3.131: + movaps 384(%rsp), %xmm0 + movaps 400(%rsp), %xmm1 + movaps 416(%rsp), %xmm2 + movaps %xmm0, 96(%rsp) + movaps %xmm1, 112(%rsp) + movaps %xmm2, 128(%rsp) +..B3.132: + lea 144(%rsp), %rdi + lea 336(%rsp), %rsi + lea 48(%rsp), %rdx +..___tag_value_imcatanhl.122: + call __libm_atan2l_k80@PLT +..___tag_value_imcatanhl.123: +..B3.133: + lea 192(%rsp), %rdi + lea 336(%rsp), %rsi + lea 96(%rsp), %rdx +..___tag_value_imcatanhl.124: + call __libm_atan2l_k80@PLT +..___tag_value_imcatanhl.125: +..B3.134: + movzwl 152(%rsp), %ebx + movl %ebx, %r10d + andl $32767, %r10d + cmpl $8383, %r10d + jl ..B3.138 +..B3.135: + cmpl $24383, %r10d + jg ..B3.138 +..B3.136: + movzwl 200(%rsp), %esi + movl %esi, %r9d + andl $32767, %r9d + cmpl $8383, %r9d + jl ..B3.138 +..B3.137: + cmpl $24383, %r9d + jle ..B3.141 +..B3.138: + lea 144(%rsp), %rdi +..___tag_value_imcatanhl.126: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.127: +..B3.139: + lea 192(%rsp), %rdi +..___tag_value_imcatanhl.128: + call __libm_normalizel_k80@PLT +..___tag_value_imcatanhl.129: +..B3.140: + movzwl 152(%rsp), %ebx + movl %ebx, %r10d + movzwl 200(%rsp), %esi + movl %esi, %r9d + andl $32767, %r10d + andl $32767, %r9d +..B3.141: + movl 224(%rsp), %edi + movl 176(%rsp), %eax + lea -134(%rdi,%r9), %edx + lea (%r10,%rax), %ecx + cmpl %edx, %ecx + jle ..B3.158 +..B3.142: + movl 148(%rsp), %r8d + lea 134(%rdi,%r9), %edx + cmpl %edx, %ecx + jge ..B3.159 +..B3.143: + testl %r8d, %r8d + jne ..B3.145 +..B3.144: + cmpl $0, 144(%rsp) + je ..B3.160 +..B3.145: + cmpl $0, 196(%rsp) + jne ..B3.147 +..B3.146: + cmpl $0, 192(%rsp) + je ..B3.159 +..B3.147: + cmpl %edi, %eax + je ..B3.149 +..B3.148: + fldt 32(%rsp) + subl %edi, %eax + fstpt (%rsp) + addl $16383, %eax + fldt 144(%rsp) + andl $32767, %eax + fldt 160(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edi, 176(%rsp) + fxch %st(2) + fstpt 144(%rsp) + fldt 144(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + movzwl 152(%rsp), %ebx + jmp ..B3.150 +..B3.149: + fldt 144(%rsp) + fldt 160(%rsp) +..B3.150: + fldt 192(%rsp) + andl $32767, %ebx + andl $32767, %esi + fld %st(2) + movl %edi, 272(%rsp) + cmpl %esi, %ebx + fadd %st(1), %st + jg ..B3.155 +..B3.151: + jne ..B3.156 +..B3.152: + movl 148(%rsp), %eax + movl 196(%rsp), %edx + cmpl %edx, %eax + ja ..B3.155 +..B3.153: + jne ..B3.156 +..B3.154: + movl 144(%rsp), %eax + cmpl 192(%rsp), %eax + jbe ..B3.156 +..B3.155: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 208(%rsp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B3.157 +..B3.156: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 208(%rsp) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) +..B3.157: + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + jmp ..B3.167 +..B3.158: + movl 148(%rsp), %r8d +..B3.159: + testl %r8d, %r8d + jne ..B3.161 +..B3.181: + cmpl $0, 144(%rsp) +..B3.160: + je ..B3.162 +..B3.161: + lea -16517(%rdi,%r9), %edx + lea -16383(%rax,%r10), %ecx + cmpl %ecx, %edx + jl ..B3.163 +..B3.162: + fldt 192(%rsp) + fldt 208(%rsp) + movaps 192(%rsp), %xmm0 + movaps 208(%rsp), %xmm1 + movaps 224(%rsp), %xmm2 + movaps %xmm0, 240(%rsp) + movaps %xmm1, 256(%rsp) + movaps %xmm2, 272(%rsp) + jmp ..B3.167 +..B3.163: + fldt 144(%rsp) + movl %eax, %edi + fldt 160(%rsp) + movaps 144(%rsp), %xmm0 + movaps 160(%rsp), %xmm1 + movaps 176(%rsp), %xmm2 + movaps %xmm0, 240(%rsp) + movaps %xmm1, 256(%rsp) + movaps %xmm2, 272(%rsp) + jmp ..B3.167 +..B3.164: + je ..B3.171 +..B3.165: + incl 368(%rsp) + lea 240(%rsp), %rdi + lea 336(%rsp), %rsi + lea 576(%rsp), %rdx +..___tag_value_imcatanhl.130: + call __libm_atan2l_k80@PLT +..___tag_value_imcatanhl.131: +..B3.166: + fldt 240(%rsp) + fldt 256(%rsp) + movl 272(%rsp), %edi +..B3.167: + fldt 16(%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 240(%rsp) + fldt 240(%rsp) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 256(%rsp) + fldt 256(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 688 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_imcatanhl.133: + call __libm_scalbl_k80@PLT +..___tag_value_imcatanhl.134: +..B3.176: + addq $32, %rsp + .cfi_def_cfa_offset 656 +..B3.168: + movq 624(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B3.170 +..B3.169: + addq $632, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 656 + .cfi_offset 3, -24 + .cfi_offset 13, -16 +..B3.170: + fstp %st(0) + call __stack_chk_fail@PLT +..B3.171: + lea 96+_CONSTANTS(%rip), %rdx + movl 532(%rsp), %eax + cmpl 4(%rdx), %eax + jb ..B3.72 +..B3.172: + jne ..B3.165 +..B3.173: + movl 528(%rsp), %eax + cmpl (%rdx), %eax + jb ..B3.72 + jmp ..B3.165 + .align 16,0x90 + .cfi_endproc + .type imcatanhl,@function + .size imcatanhl,.-imcatanhl + .data +# -- End imcatanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.17: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,16 + .align 16 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 32768 + .word 16415 + .word 0 + .word 0 + .word 0 + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,112 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/catanl.S b/external/sgx_libm/intel64/catanl.S new file mode 100644 index 0000000000..aa1e9a3b48 --- /dev/null +++ b/external/sgx_libm/intel64/catanl.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "catanl.c" + .text +..TXTST0: +# -- Begin catanl + .text + .align 16,0x90 + .globl catanl +catanl: +# parameter 1: 144 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_catanl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + subq $128, %rsp + .cfi_def_cfa_offset 144 + xorb %r13b, %r13b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 112(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 96(%rsp) +..B1.2: + fnstcw 2(%rsp) +..B1.3: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.5: + fldcw (%rsp) +..B1.6: + movb $1, %r13b +..B1.7: + fldt 160(%rsp) + movzwl 168(%rsp), %eax + andl $32767, %eax + fstpt 80(%rsp) + cmpl $32767, %eax + fldt 144(%rsp) + fstpt 96(%rsp) + jl ..B1.9 +..B1.8: + movq $0x8000000000000000, %rax + cmpq 160(%rsp), %rax + jne ..B1.10 +..B1.9: + movb 169(%rsp), %al + notb %al + movb 89(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 89(%rsp) +..B1.10: + addq $-32, %rsp + .cfi_def_cfa_offset 176 + movq %rsp, %rdi + movq 112(%rsp), %rax + movq 120(%rsp), %rdx + movq 128(%rsp), %rcx + movq 136(%rsp), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %rsi, 24(%rdi) + call catanhl@PLT +..B1.22: + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 144 + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 24(%rsp), %eax + andl $32767, %eax + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + cmpl $32767, %eax + fstpt 48(%rsp) + fstpt 64(%rsp) + jl ..B1.12 +..B1.11: + movq $0x8000000000000000, %rax + cmpq 16(%rsp), %rax + jne ..B1.13 +..B1.12: + movb 25(%rsp), %al + notb %al + movb 73(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 73(%rsp) +..B1.13: + testb %r13b, %r13b + je ..B1.15 +..B1.14: + fldcw 2(%rsp) +..B1.15: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.19 +..B1.16: + fldt 48(%rsp) + fldt 64(%rsp) + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.18 +..B1.17: + addq $128, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 +..B1.18: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.19: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type catanl,@function + .size catanl,.-catanl + .data +# -- End catanl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cbrt_gen.S b/external/sgx_libm/intel64/cbrt_gen.S new file mode 100644 index 0000000000..d562bb378f --- /dev/null +++ b/external/sgx_libm/intel64/cbrt_gen.S @@ -0,0 +1,737 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrt_gen.c" + .text +..TXTST0: +# -- Begin cbrt + .text + .align 16,0x90 + .globl cbrt +cbrt: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cbrt.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + movq %xmm0, %xmm7 + movl $524032, %edx + movsd EXP_MSK3(%rip), %xmm5 + movsd EXP_MSK2(%rip), %xmm3 + psrlq $44, %xmm7 + pextrw $0, %xmm7, %ecx + movd %xmm7, %eax + movsd EXP_MASK(%rip), %xmm1 + movsd SIG_MASK(%rip), %xmm2 + andl $248, %ecx + lea rcp_table(%rip), %r8 + movsd (%rcx,%r8), %xmm4 + movq %rax, %r9 + andl %eax, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_0.0.1 + cmpl $524032, %edx + je .L_2TAG_PACKET_1.0.1 + shrl $8, %edx + shrq $8, %r9 + andpd %xmm0, %xmm2 + andpd %xmm5, %xmm0 + orpd %xmm2, %xmm3 + orpd %xmm0, %xmm1 + movapd coeff_table(%rip), %xmm5 + movl $5462, %eax + movapd 16+coeff_table(%rip), %xmm6 + mull %edx + movq %r9, %rdx + andq $2047, %r9 + shrl $14, %eax + andl $2048, %edx + subq %rax, %r9 + subq %rax, %r9 + subq %rax, %r9 + shlq $8, %r9 + addl $682, %eax + orl %edx, %eax + movd %eax, %xmm7 + addq %r9, %rcx + psllq $52, %xmm7 +.L_2TAG_PACKET_2.0.1: + movapd 32+coeff_table(%rip), %xmm2 + movapd 48+coeff_table(%rip), %xmm0 + subsd %xmm3, %xmm1 + movq %xmm7, %xmm3 + lea cbrt_table(%rip), %r8 + mulsd (%rcx,%r8), %xmm7 + mulsd %xmm4, %xmm1 + lea D_table(%rip), %r8 + mulsd (%rcx,%r8), %xmm3 + movapd %xmm1, %xmm4 + unpcklpd %xmm1, %xmm1 + mulpd %xmm1, %xmm5 + mulpd %xmm1, %xmm6 + mulpd %xmm1, %xmm1 + addpd %xmm5, %xmm2 + addpd %xmm6, %xmm0 + mulpd %xmm1, %xmm2 + mulpd %xmm1, %xmm1 + mulsd %xmm7, %xmm4 + addpd %xmm2, %xmm0 + mulsd %xmm0, %xmm1 + unpckhpd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm3, %xmm0 + addsd %xmm7, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + mulsd SCALE63(%rip), %xmm0 + movq %xmm0, %xmm7 + movl $524032, %edx + psrlq $44, %xmm7 + pextrw $0, %xmm7, %ecx + movd %xmm7, %eax + andl $248, %ecx + lea rcp_table(%rip), %r8 + movsd (%rcx,%r8), %xmm4 + movq %rax, %r9 + andl %eax, %edx + shrl $8, %edx + shrq $8, %r9 + cmpl $0, %edx + je .L_2TAG_PACKET_3.0.1 + andpd %xmm0, %xmm2 + andpd %xmm5, %xmm0 + orpd %xmm2, %xmm3 + orpd %xmm0, %xmm1 + movapd coeff_table(%rip), %xmm5 + movl $5462, %eax + movapd 16+coeff_table(%rip), %xmm6 + mull %edx + movq %r9, %rdx + andq $2047, %r9 + shrl $14, %eax + andl $2048, %edx + subq %rax, %r9 + subq %rax, %r9 + subq %rax, %r9 + shlq $8, %r9 + addl $661, %eax + orl %edx, %eax + movd %eax, %xmm7 + addq %r9, %rcx + psllq $52, %xmm7 + jmp .L_2TAG_PACKET_2.0.1 +.L_2TAG_PACKET_3.0.1: + cmpq $0, %r9 + jne .L_2TAG_PACKET_4.0.1 + xorpd %xmm0, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_4.0.1: + movsd ZERON(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + movl 4(%rsp), %eax + movl (%rsp), %edx + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $2146435072, %ecx + ja .L_2TAG_PACKET_5.0.1 + cmpl $0, %edx + jne .L_2TAG_PACKET_5.0.1 + cmpl $2146435072, %eax + jne .L_2TAG_PACKET_6.0.1 + movsd INF(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_6.0.1: + movsd NEG_INF(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_5.0.1: + movsd (%rsp), %xmm0 + addsd %xmm0, %xmm0 + movq %xmm0, 8(%rsp) +.L_2TAG_PACKET_7.0.1: +..B1.4: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cbrt,@function + .size cbrt,.-cbrt + .data +# -- End cbrt + .section .rodata, "a" + .align 16 + .align 16 +coeff_table: + .long 1553778919 + .long 3213899486 + .long 3534952507 + .long 3215266280 + .long 1646371399 + .long 3214412045 + .long 477218588 + .long 3216798151 + .long 3582521621 + .long 1066628362 + .long 1007461464 + .long 1068473053 + .long 889629714 + .long 1067378449 + .long 1431655765 + .long 1070945621 + .type coeff_table,@object + .size coeff_table,64 + .align 4 +EXP_MSK3: + .long 4294967295 + .long 1048575 + .type EXP_MSK3,@object + .size EXP_MSK3,8 + .align 4 +EXP_MSK2: + .long 0 + .long 3220193280 + .type EXP_MSK2,@object + .size EXP_MSK2,8 + .align 4 +EXP_MASK: + .long 0 + .long 3220176896 + .type EXP_MASK,@object + .size EXP_MASK,8 + .align 4 +SIG_MASK: + .long 0 + .long 1032192 + .type SIG_MASK,@object + .size SIG_MASK,8 + .align 4 +rcp_table: + .long 528611360 + .long 3220144632 + .long 2884679527 + .long 3220082993 + .long 1991868891 + .long 3220024928 + .long 2298714891 + .long 3219970134 + .long 58835168 + .long 3219918343 + .long 3035110223 + .long 3219869313 + .long 1617585086 + .long 3219822831 + .long 2500867033 + .long 3219778702 + .long 4241943008 + .long 3219736752 + .long 258732970 + .long 3219696825 + .long 404232216 + .long 3219658776 + .long 2172167368 + .long 3219622476 + .long 1544257904 + .long 3219587808 + .long 377579543 + .long 3219554664 + .long 1616385542 + .long 3219522945 + .long 813783277 + .long 3219492562 + .long 3940743189 + .long 3219463431 + .long 2689777499 + .long 3219435478 + .long 1700977147 + .long 3219408632 + .long 3169102082 + .long 3219382828 + .long 327235604 + .long 3219358008 + .long 1244336319 + .long 3219334115 + .long 1300311200 + .long 3219311099 + .long 3095471925 + .long 3219288912 + .long 2166487928 + .long 3219267511 + .long 2913108253 + .long 3219246854 + .long 293672978 + .long 3219226904 + .long 288737297 + .long 3219207624 + .long 1810275472 + .long 3219188981 + .long 174592167 + .long 3219170945 + .long 3539053052 + .long 3219153485 + .long 2164392968 + .long 3219136576 + .type rcp_table,@object + .size rcp_table,256 + .align 4 +cbrt_table: + .long 572345495 + .long 1072698681 + .long 1998204467 + .long 1072709382 + .long 3861501553 + .long 1072719872 + .long 2268192434 + .long 1072730162 + .long 2981979308 + .long 1072740260 + .long 270859143 + .long 1072750176 + .long 2958651392 + .long 1072759916 + .long 313113243 + .long 1072769490 + .long 919449400 + .long 1072778903 + .long 2809328903 + .long 1072788162 + .long 2222981587 + .long 1072797274 + .long 2352530781 + .long 1072806244 + .long 594152517 + .long 1072815078 + .long 1555767199 + .long 1072823780 + .long 4282421314 + .long 1072832355 + .long 2355578597 + .long 1072840809 + .long 1162590619 + .long 1072849145 + .long 797864051 + .long 1072857367 + .long 431273680 + .long 1072865479 + .long 2669831148 + .long 1072873484 + .long 733477752 + .long 1072881387 + .long 4280220604 + .long 1072889189 + .long 801961634 + .long 1072896896 + .long 2915370760 + .long 1072904508 + .long 1159613482 + .long 1072912030 + .long 2689944798 + .long 1072919463 + .long 1248687822 + .long 1072926811 + .long 2967951030 + .long 1072934075 + .long 630170432 + .long 1072941259 + .long 3760898254 + .long 1072948363 + .long 0 + .long 1072955392 + .long 2370273294 + .long 1072962345 + .long 1261754802 + .long 1072972640 + .long 546334065 + .long 1072986123 + .long 1054893830 + .long 1072999340 + .long 1571187597 + .long 1073012304 + .long 1107975175 + .long 1073025027 + .long 3606909377 + .long 1073037519 + .long 1113616747 + .long 1073049792 + .long 4154744632 + .long 1073061853 + .long 3358931423 + .long 1073073713 + .long 4060702372 + .long 1073085379 + .long 747576176 + .long 1073096860 + .long 3023138255 + .long 1073108161 + .long 1419988548 + .long 1073119291 + .long 1914185305 + .long 1073130255 + .long 294389948 + .long 1073141060 + .long 3761802570 + .long 1073151710 + .long 978281566 + .long 1073162213 + .long 823148820 + .long 1073172572 + .long 2420954441 + .long 1073182792 + .long 3815449908 + .long 1073192878 + .long 2046058587 + .long 1073202835 + .long 1807524753 + .long 1073212666 + .long 2628681401 + .long 1073222375 + .long 3225667357 + .long 1073231966 + .long 1555307421 + .long 1073241443 + .long 3454043099 + .long 1073250808 + .long 1208137896 + .long 1073260066 + .long 3659916772 + .long 1073269218 + .long 1886261264 + .long 1073278269 + .long 3593647839 + .long 1073287220 + .long 3086012205 + .long 1073296075 + .long 2769796922 + .long 1073304836 + .long 888716057 + .long 1073317807 + .long 2201465623 + .long 1073334794 + .long 164369365 + .long 1073351447 + .long 3462666733 + .long 1073367780 + .long 2773905457 + .long 1073383810 + .long 1342879088 + .long 1073399550 + .long 2543933975 + .long 1073415012 + .long 1684477781 + .long 1073430209 + .long 3532178543 + .long 1073445151 + .long 1147747300 + .long 1073459850 + .long 1928031793 + .long 1073474314 + .long 2079717015 + .long 1073488553 + .long 4016765315 + .long 1073502575 + .long 3670431139 + .long 1073516389 + .long 3549227225 + .long 1073530002 + .long 11637607 + .long 1073543422 + .long 588220169 + .long 1073556654 + .long 2635407503 + .long 1073569705 + .long 2042029317 + .long 1073582582 + .long 1925128962 + .long 1073595290 + .long 4136375664 + .long 1073607834 + .long 759964600 + .long 1073620221 + .long 4257606771 + .long 1073632453 + .long 297278907 + .long 1073644538 + .long 3655053093 + .long 1073656477 + .long 2442253172 + .long 1073668277 + .long 1111876799 + .long 1073679941 + .long 3330973139 + .long 1073691472 + .long 3438879452 + .long 1073702875 + .long 3671565478 + .long 1073714153 + .long 1317849547 + .long 1073725310 + .long 1642364115 + .long 1073736348 + .type cbrt_table,@object + .size cbrt_table,768 + .align 4 +D_table: + .long 4050900474 + .long 1014427190 + .long 1157977860 + .long 1016444461 + .long 1374568199 + .long 1017271387 + .long 2809163288 + .long 1016882676 + .long 3742377377 + .long 1013168191 + .long 3101606597 + .long 1017541672 + .long 65224358 + .long 1017217597 + .long 2691591250 + .long 1017266643 + .long 4020758549 + .long 1017689313 + .long 1316310992 + .long 1018030788 + .long 1031537856 + .long 1014090882 + .long 3261395239 + .long 1016413641 + .long 886424999 + .long 1016313335 + .long 3114776834 + .long 1014195875 + .long 1681120620 + .long 1017825416 + .long 1329600273 + .long 1016625740 + .long 465474623 + .long 1017097119 + .long 4251633980 + .long 1017169077 + .long 1986990133 + .long 1017710645 + .long 752958613 + .long 1017159641 + .long 2216216792 + .long 1018020163 + .long 4282860129 + .long 1015924861 + .long 1557627859 + .long 1016039538 + .long 3889219754 + .long 1018086237 + .long 3684996408 + .long 1017353275 + .long 723532103 + .long 1017717141 + .long 2951149676 + .long 1012528470 + .long 831890937 + .long 1017830553 + .long 1031212645 + .long 1017387331 + .long 2741737450 + .long 1017604974 + .long 2863311531 + .long 1003776682 + .long 4276736099 + .long 1013153088 + .long 4111778382 + .long 1015673686 + .long 1728065769 + .long 1016413986 + .long 2708718031 + .long 1018078833 + .long 1069335005 + .long 1015291224 + .long 700037144 + .long 1016482032 + .long 2904566452 + .long 1017226861 + .long 4074156649 + .long 1017622651 + .long 25019565 + .long 1015245366 + .long 3601952608 + .long 1015771755 + .long 3267129373 + .long 1017904664 + .long 503203103 + .long 1014921629 + .long 2122011730 + .long 1018027866 + .long 3927295461 + .long 1014189456 + .long 2790625147 + .long 1016024251 + .long 1330460186 + .long 1016940346 + .long 4033568463 + .long 1015538390 + .long 3695818227 + .long 1017509621 + .long 257573361 + .long 1017208868 + .long 3227697852 + .long 1017337964 + .long 234118548 + .long 1017169577 + .long 4009025803 + .long 1017278524 + .long 1948343394 + .long 1017749310 + .long 678398162 + .long 1018144239 + .long 3083864863 + .long 1016669086 + .long 2415453452 + .long 1017890370 + .long 175467344 + .long 1017330033 + .long 3197359580 + .long 1010339928 + .long 2071276951 + .long 1015941358 + .long 268372543 + .long 1016737773 + .long 938132959 + .long 1017389108 + .long 1816750559 + .long 1017337448 + .long 4119203749 + .long 1017152174 + .long 2578653878 + .long 1013108497 + .long 2470331096 + .long 1014678606 + .long 123855735 + .long 1016553320 + .long 1265650889 + .long 1014782687 + .long 3414398172 + .long 1017182638 + .long 1040773369 + .long 1016158401 + .long 3483628886 + .long 1016886550 + .long 4140499405 + .long 1016191425 + .long 3893477850 + .long 1016964495 + .long 3935319771 + .long 1009634717 + .long 2978982660 + .long 1015027112 + .long 2452709923 + .long 1017990229 + .long 3190365712 + .long 1015835149 + .long 4237588139 + .long 1015832925 + .long 2610678389 + .long 1017962711 + .long 2127316774 + .long 1017405770 + .long 824267502 + .long 1017959463 + .long 2165924042 + .long 1017912225 + .long 2774007076 + .long 1013257418 + .long 4123916326 + .long 1017582284 + .long 1976417958 + .long 1016959909 + .long 4092806412 + .long 1017711279 + .long 119251817 + .long 1015363631 + .long 3475418768 + .long 1017675415 + .long 1972580503 + .long 1015470684 + .long 815541017 + .long 1017517969 + .long 2429917451 + .long 1017397776 + .long 4062888482 + .long 1016749897 + .long 68284153 + .long 1017925678 + .long 2207779246 + .long 1016320298 + .long 1183466520 + .long 1017408657 + .long 143326427 + .long 1017060403 + .type D_table,@object + .size D_table,768 + .align 4 +SCALE63: + .long 0 + .long 1138753536 + .type SCALE63,@object + .size SCALE63,8 + .align 4 +ZERON: + .long 0 + .long 2147483648 + .type ZERON,@object + .size ZERON,8 + .align 4 +INF: + .long 0 + .long 2146435072 + .type INF,@object + .size INF,8 + .align 4 +NEG_INF: + .long 0 + .long 4293918720 + .type NEG_INF,@object + .size NEG_INF,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cbrtf_gen.S b/external/sgx_libm/intel64/cbrtf_gen.S new file mode 100644 index 0000000000..773a6cb2ea --- /dev/null +++ b/external/sgx_libm/intel64/cbrtf_gen.S @@ -0,0 +1,494 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrtf_gen.c" + .text +..TXTST0: +# -- Begin cbrtf + .text + .align 16,0x90 + .globl cbrtf +cbrtf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cbrtf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movss %xmm0, 8(%rsp) +..B1.2: + movl $8388607, %edx + movd %edx, %xmm5 + movl $-1081999360, %eax + movd %eax, %xmm3 + movl $-1082130432, %eax + movd %eax, %xmm1 + movl $8257536, %edx + movd %edx, %xmm2 + pextrw $1, %xmm0, %ecx + movl %ecx, %eax + andl $124, %ecx + lea rcp_table(%rip), %r8 + movss (%rcx,%r8), %xmm4 + shrl $7, %eax + movl $255, %edx + andl %eax, %edx + movq %rax, %r9 + cmpl $0, %edx + je .L_2TAG_PACKET_0.0.1 + cmpl $255, %edx + je .L_2TAG_PACKET_1.0.1 + andps %xmm0, %xmm2 + andps %xmm5, %xmm0 + orps %xmm2, %xmm3 + orps %xmm0, %xmm1 + movss coeff_table(%rip), %xmm5 + movss 4+coeff_table(%rip), %xmm6 + movl %edx, %eax + addl %eax, %eax + addl %eax, %eax + addl %edx, %eax + movl %eax, %edx + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %edx + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %edx, %eax + movq %r9, %rdx + andq $255, %r9 + subq $1, %r9 + shrl $12, %eax + andl $256, %edx + subq %rax, %r9 + subq %rax, %r9 + subq %rax, %r9 + shlq $7, %r9 + addl $85, %eax + orl %edx, %eax + movd %eax, %xmm7 + addq %r9, %rcx + psllq $23, %xmm7 +.L_2TAG_PACKET_2.0.1: + movss 8+coeff_table(%rip), %xmm2 + movss 12+coeff_table(%rip), %xmm0 + subss %xmm3, %xmm1 + movaps %xmm7, %xmm3 + lea cbrtf_table(%rip), %r8 + mulss (%rcx,%r8), %xmm7 + mulss %xmm4, %xmm1 + lea D_table(%rip), %r8 + mulss (%rcx,%r8), %xmm3 + movss %xmm1, %xmm4 + mulss %xmm1, %xmm5 + mulss %xmm1, %xmm6 + mulss %xmm1, %xmm1 + addss %xmm5, %xmm2 + addss %xmm6, %xmm0 + mulss %xmm1, %xmm2 + mulss %xmm7, %xmm4 + addss %xmm2, %xmm0 + mulss %xmm4, %xmm0 + addss %xmm3, %xmm0 + addss %xmm7, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + movq %xmm0, %xmm7 + movd %xmm0, %eax + movq %rax, %r9 + shll $9, %eax + movl $23, %ecx + shrq $23, %r9 +.L_2TAG_PACKET_3.0.1: + cmpl $-2147483648, %eax + jae .L_2TAG_PACKET_4.0.1 + shll $1, %eax + addl $1, %edx + loop .L_2TAG_PACKET_3.0.1 + cmpl $0, %eax + je .L_2TAG_PACKET_5.0.1 +.L_2TAG_PACKET_4.0.1: + movl %edx, %ecx + incl %ecx + movd %ecx, %xmm7 + orq %rdx, %r9 + psllq %xmm7, %xmm0 + shrl $24, %eax + andl $124, %eax + lea rcp_table(%rip), %r8 + movsd (%r8,%rax), %xmm4 + movl %eax, %ecx + andps %xmm0, %xmm2 + andps %xmm5, %xmm0 + orps %xmm2, %xmm3 + orps %xmm0, %xmm1 + movss coeff_table(%rip), %xmm5 + movl $1366, %eax + movss 4+coeff_table(%rip), %xmm6 + mull %edx + movq %r9, %rdx + andq $255, %r9 + addq $1, %r9 + shrl $12, %eax + andl $256, %edx + subq %rax, %r9 + subq %rax, %r9 + subq %rax, %r9 + cmpq $0, %r9 + je .L_2TAG_PACKET_6.0.1 + incl %eax + subq $3, %r9 + negq %r9 +.L_2TAG_PACKET_6.0.1: + shlq $7, %r9 + addq %r9, %rcx + movq $85, %r9 + subq %rax, %r9 + orq %r9, %rdx + movd %edx, %xmm7 + psllq $23, %xmm7 + jmp .L_2TAG_PACKET_2.0.1 +.L_2TAG_PACKET_5.0.1: + cmpq $0, %r9 + jne .L_2TAG_PACKET_7.0.1 + xorps %xmm0, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_7.0.1: + movss 4+ZERON(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + movl 8(%rsp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $2139095040, %ecx + ja .L_2TAG_PACKET_8.0.1 + cmpl $2139095040, %eax + jne .L_2TAG_PACKET_9.0.1 + movss INFS(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_9.0.1: + movss NEG_INFS(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_8.0.1: + movss 8(%rsp), %xmm0 + addss %xmm0, %xmm0 + movss %xmm0, (%rsp) +.L_2TAG_PACKET_10.0.1: +..B1.4: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cbrtf,@function + .size cbrtf,.-cbrtf + .data +# -- End cbrtf + .section .rodata, "a" + .align 4 + .align 4 +rcp_table: + .long 3212578753 + .long 3212085645 + .long 3211621124 + .long 3211182772 + .long 3210768440 + .long 3210376206 + .long 3210004347 + .long 3209651317 + .long 3209315720 + .long 3208996296 + .long 3208691905 + .long 3208401508 + .long 3208124163 + .long 3207859009 + .long 3207605259 + .long 3207362194 + .long 3207129151 + .long 3206905525 + .long 3206690755 + .long 3206484326 + .long 3206285761 + .long 3206094618 + .long 3205910490 + .long 3205732998 + .long 3205561788 + .long 3205396533 + .long 3205236929 + .long 3205082689 + .long 3204933547 + .long 3204789256 + .long 3204649583 + .long 3204514308 + .type rcp_table,@object + .size rcp_table,128 + .align 4 +coeff_table: + .long 3173551943 + .long 3185806905 + .long 1031591658 + .long 1051372203 + .type coeff_table,@object + .size coeff_table,16 + .align 4 +cbrtf_table: + .long 1065396681 + .long 1065482291 + .long 1065566215 + .long 1065648532 + .long 1065729317 + .long 1065808640 + .long 1065886565 + .long 1065963152 + .long 1066038457 + .long 1066112533 + .long 1066185428 + .long 1066257188 + .long 1066327857 + .long 1066397474 + .long 1066466079 + .long 1066533708 + .long 1066600394 + .long 1066666169 + .long 1066731064 + .long 1066795108 + .long 1066858329 + .long 1066920751 + .long 1066982401 + .long 1067043301 + .long 1067103474 + .long 1067162941 + .long 1067221722 + .long 1067279837 + .long 1067337305 + .long 1067394143 + .long 1067450368 + .long 1067505996 + .long 1067588354 + .long 1067696217 + .long 1067801953 + .long 1067905666 + .long 1068007450 + .long 1068107390 + .long 1068205570 + .long 1068302063 + .long 1068396942 + .long 1068490271 + .long 1068582113 + .long 1068672525 + .long 1068761562 + .long 1068849275 + .long 1068935712 + .long 1069020919 + .long 1069104937 + .long 1069187809 + .long 1069269572 + .long 1069350263 + .long 1069429915 + .long 1069508563 + .long 1069586236 + .long 1069662966 + .long 1069738778 + .long 1069813702 + .long 1069887762 + .long 1069960982 + .long 1070033387 + .long 1070104998 + .long 1070175837 + .long 1070245925 + .long 1070349689 + .long 1070485588 + .long 1070618808 + .long 1070749478 + .long 1070877717 + .long 1071003634 + .long 1071127332 + .long 1071248907 + .long 1071368446 + .long 1071486034 + .long 1071601747 + .long 1071715659 + .long 1071827839 + .long 1071938350 + .long 1072047254 + .long 1072154608 + .long 1072260465 + .long 1072364876 + .long 1072467891 + .long 1072569555 + .long 1072669911 + .long 1072769001 + .long 1072866863 + .long 1072963536 + .long 1073059054 + .long 1073153452 + .long 1073246762 + .long 1073339014 + .long 1073430238 + .long 1073520462 + .long 1073609714 + .long 1073698019 + .type cbrtf_table,@object + .size cbrtf_table,384 + .align 4 +D_table: + .long 839340838 + .long 867750258 + .long 851786446 + .long 853949398 + .long 864938789 + .long 864102364 + .long 864209792 + .long 865422805 + .long 867593594 + .long 854482593 + .long 848298042 + .long 860064854 + .long 844792593 + .long 870701309 + .long 872023170 + .long 860255342 + .long 849966899 + .long 863561479 + .long 869115319 + .long 871961375 + .long 859537336 + .long 871954398 + .long 863817578 + .long 861687921 + .long 849594757 + .long 816486846 + .long 858183533 + .long 864500406 + .long 850523240 + .long 808125243 + .long 514020693 + .long 861173761 + .long 859000219 + .long 823158129 + .long 871826232 + .long 871183196 + .long 839030530 + .long 867690638 + .long 840440923 + .long 868033274 + .long 855856030 + .long 865094453 + .long 860418487 + .long 866225006 + .long 866458226 + .long 865124659 + .long 864837702 + .long 811742505 + .long 869432099 + .long 864584201 + .long 864183978 + .long 844810573 + .long 869245699 + .long 859556409 + .long 870675446 + .long 814190139 + .long 870686941 + .long 861800510 + .long 855649163 + .long 869347119 + .long 864252033 + .long 867276215 + .long 868189817 + .long 849541095 + .long 866633177 + .long 843967686 + .long 857522493 + .long 862339487 + .long 850054662 + .long 864048556 + .long 868027089 + .long 848093931 + .long 865355299 + .long 848111485 + .long 865557362 + .long 870297525 + .long 863416216 + .long 869675693 + .long 865888071 + .long 825332584 + .long 843309506 + .long 870885636 + .long 869119784 + .long 865466648 + .long 867459244 + .long 861192764 + .long 871247716 + .long 864927982 + .long 869195129 + .long 864849564 + .long 840005936 + .long 852579258 + .long 860852782 + .long 869711141 + .long 862506141 + .long 837959274 + .type D_table,@object + .size D_table,384 + .align 4 +ZERON: + .long 0 + .long 2147483648 + .type ZERON,@object + .size ZERON,8 + .align 4 +INFS: + .long 2139095040 + .type INFS,@object + .size INFS,4 + .align 4 +NEG_INFS: + .long 4286578688 + .type NEG_INFS,@object + .size NEG_INFS,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cbrtl.S b/external/sgx_libm/intel64/cbrtl.S new file mode 100644 index 0000000000..73ebac73a9 --- /dev/null +++ b/external/sgx_libm/intel64/cbrtl.S @@ -0,0 +1,379 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrtl.c" + .text +..TXTST0: +# -- Begin cbrtl + .text + .align 16,0x90 + .globl cbrtl +cbrtl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cbrtl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %r8b, %r8b +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 56(%rsp), %ecx + movl %ecx, %edi + andl $32767, %edi + movzwl 34(%rsp), %r9d + cmpl $32767, %edi + je ..B1.20 +..B1.4: + movb 57(%rsp), %al + movl %r9d, %edx + andb $-128, %al + andl $768, %edx + shrb $7, %al + xorl %esi, %esi + movzbl %al, %eax + cmpl $768, %edx + je ..B1.8 +..B1.5: + orl $-64768, %r9d + movw %r9w, 32(%rsp) +..B1.6: + fldcw 32(%rsp) +..B1.7: + movzwl 56(%rsp), %ecx + movl %ecx, %edi + movb $1, %r8b + andl $32767, %edi +..B1.8: + testl %edi, %edi + jne ..B1.14 +..B1.9: + cmpq $0, 48(%rsp) + jne ..B1.13 +..B1.10: + lea _zeros(%rip), %rdx + testb %r8b, %r8b + movsd (%rdx,%rax,8), %xmm0 + je ..B1.12 +..B1.11: + fldcw 34(%rsp) +..B1.12: + movsd %xmm0, (%rsp) + fldl (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.13: + fldt 48(%rsp) + movl $-25, %esi + lea _TWO_75(%rip), %rdx + fmull (%rdx) + fstpt 48(%rsp) + movzwl 56(%rsp), %ecx + movl %ecx, %edi + andl $32767, %edi +..B1.14: + fldt .L_2il0floatpacket.0(%rip) + lea ones(%rip), %r9 + andl $-32768, %ecx + orl $-49153, %ecx + movw %cx, 56(%rsp) + fldl (%r9,%rax,8) + lea 96+_P(%rip), %r9 + movl 52(%rsp), %ecx + shrl $23, %ecx + movzbl %cl, %eax + lea _TWO_32H(%rip), %rcx + movq __libm_rcp_table_256@GOTPCREL(%rip), %r11 + imull $21845, %edi, %edx + fstpt 16(%rsp) + fldt 16(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + flds (%r11,%rax,4) + addl $21845, %edx + fld %st(0) + lea 32+_P(%rip), %r11 + fldl (%rcx) + lea 80+_P(%rip), %rcx + fld %st(0) + shrl $16, %edx + fadd %st(4), %st + shlq $4, %rax + lea (%rdx,%rdx), %r10d + subl %r10d, %edi + lea 64+_P(%rip), %r10 + fsubp %st, %st(1) + fmul %st, %st(1) + lea 10922(%rsi,%rdx), %esi + fxch %st(1) + fsub %st(4), %st + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r9) + lea 48+_P(%rip), %r9 + fmul %st(2), %st + fldt (%r10) + lea 16+_P(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + lea _P(%rip), %r11 + faddp %st, %st(1) + fmul %st(2), %st + fmul %st(1), %st + fldt (%rcx) + fmul %st(3), %st + fldt (%r9) + movzwl 24(%rsp), %ecx + faddp %st, %st(1) + fmul %st(3), %st + andl $-32768, %ecx + fldt (%r10) + orl %esi, %ecx + movw %cx, 24(%rsp) + subl %edx, %edi + movq __libm_cbrtl_table_256@GOTPCREL(%rip), %rdx + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt (%r11) + fmulp %st, %st(1) + faddp %st, %st(1) + fadd %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fldl 8(%rdx,%rax) + fldl (%rdx,%rax) + fldt 16(%rsp) + jne ..B1.16 +..B1.15: + fldt (%rsp) + fmulp %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.17 +..B1.16: + fldt (%rsp) + lea SH(%rip), %rax + movslq %edi, %rdi + fxch %st(3) + fmull -8(%rax,%rdi,8) + fldl 24(%rax,%rdi,8) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(1) + fmull 8(%rax,%rdi,8) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.17: + testb %r8b, %r8b + je ..B1.19 +..B1.18: + fldcw 34(%rsp) +..B1.19: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.20: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.26 +..B1.21: + orl $-64768, %r9d + movw %r9w, 32(%rsp) +..B1.22: + fldcw 32(%rsp) +..B1.23: + fldt 48(%rsp) + fstpt (%rsp) +..B1.24: + fldcw 34(%rsp) +..B1.25: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.26: + fldt 48(%rsp) + fstpt (%rsp) + jmp ..B1.25 + .align 16,0x90 + .cfi_endproc + .type cbrtl,@function + .size cbrtl,.-cbrtl + .data +# -- End cbrtl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +SH: + .long 0xf98d728b,0x3ff428a2 + .long 0xa53d6e3d,0x3ff965fe + .long 0xf8000000,0x3ff428a2 + .long 0xa4000000,0x3ff965fe + .long 0xae223ddb,0x3e38d728 + .long 0xc82b059a,0x3e33d6e3 + .type SH,@object + .size SH,48 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_P: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58320 + .word 36408 + .word 14563 + .word 58254 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 50474 + .word 25890 + .word 59872 + .word 64726 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 45217 + .word 37017 + .word 18069 + .word 43151 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 45059 + .word 7616 + .word 35240 + .word 63288 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 54522 + .word 17175 + .word 48475 + .word 49224 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 568 + .word 55426 + .word 44619 + .word 39848 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,112 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cbrtl_table.S b/external/sgx_libm/intel64/cbrtl_table.S new file mode 100644 index 0000000000..a5fa423338 --- /dev/null +++ b/external/sgx_libm/intel64/cbrtl_table.S @@ -0,0 +1,559 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cbrtl_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_cbrtl_table_256 +__libm_cbrtl_table_256: + .long 0x8e000000,0x3ff002ab + .long 0x20d8688c,0x3e2230dd + .long 0x08000000,0x3ff00808 + .long 0xeff25f12,0x3e3610f3 + .long 0xba000000,0x3ff00d6b + .long 0x3efe3543,0xbe0b4bfa + .long 0xb2000000,0x3ff012d6 + .long 0x2c9e7759,0xbe32d173 + .long 0x4e000000,0x3ff0179a + .long 0x013f2daf,0x3e1eca95 + .long 0x1a000000,0x3ff01d13 + .long 0x1a1a641f,0xbe35afd8 + .long 0x5a000000,0x3ff02293 + .long 0xa40f870c,0x3e3acf85 + .long 0xc6000000,0x3ff02769 + .long 0x8b30b2ed,0xbe1bd4a4 + .long 0x3c000000,0x3ff02cf8 + .long 0xc2b35d57,0xbe10fe10 + .long 0x2e000000,0x3ff031db + .long 0x9aefd6bc,0x3e1dc088 + .long 0x1a000000,0x3ff03778 + .long 0x26cf8b86,0xbe3983d8 + .long 0xcc000000,0x3ff03c67 + .long 0xa0938ea4,0x3e33f7ce + .long 0x8a000000,0x3ff0415d + .long 0x1f4527e6,0x3e1271e1 + .long 0x1e000000,0x3ff04710 + .long 0xe014332a,0x3e2e39c2 + .long 0xf4000000,0x3ff04c12 + .long 0x4801f107,0x3e28aa39 + .long 0xfc000000,0x3ff0511b + .long 0x5e2d9f07,0x3dbd36bd + .long 0x42000000,0x3ff0562b + .long 0xc47ab24f,0x3df8a6e2 + .long 0xd4000000,0x3ff05b40 + .long 0x24da1d13,0x3e249ec6 + .long 0xc2000000,0x3ff0605c + .long 0x31b189b7,0xbe227295 + .long 0x16000000,0x3ff0657f + .long 0x7872e1cd,0x3e17f761 + .long 0xe2000000,0x3ff06aa7 + .long 0xc4a6c979,0xbe18ff8e + .long 0x32000000,0x3ff06fd7 + .long 0x37586fc9,0xbe22bc1f + .long 0x1e000000,0x3ff0744e + .long 0xda6466ae,0x3e213213 + .long 0xb0000000,0x3ff07989 + .long 0xd1b04779,0xbe181829 + .long 0xf0000000,0x3ff07ecb + .long 0x52cf55c8,0xbe2d5de3 + .long 0xea000000,0x3ff08414 + .long 0xa790ab31,0x3e3e5ef6 + .long 0x0a000000,0x3ff088a2 + .long 0x7bee6b1f,0xbe33c01d + .long 0xb2000000,0x3ff08df7 + .long 0xed26e53e,0x3e0b930b + .long 0xc4000000,0x3ff0928f + .long 0x35afee34,0xbe2f72c3 + .long 0x4e000000,0x3ff097f2 + .long 0x1166e9a4,0x3e256094 + .long 0x82000000,0x3ff09c95 + .long 0x5ae9d19c,0xbe01eed4 + .long 0xe8000000,0x3ff0a13d + .long 0x82f9b502,0x3e22e1bc + .long 0xac000000,0x3ff0a6b3 + .long 0xdecb71aa,0xbe13744b + .long 0x7c000000,0x3ff0ab67 + .long 0x79520489,0xbe34918f + .long 0x9e000000,0x3ff0b020 + .long 0xf330a139,0x3df882be + .long 0x20000000,0x3ff0b4df + .long 0xc3236255,0x3e1c8694 + .long 0xe6000000,0x3ff0ba6e + .long 0x119c7384,0xbdd954af + .long 0x30000000,0x3ff0bf39 + .long 0x17946a4f,0x3e17e600 + .long 0xfc000000,0x3ff0c408 + .long 0xa96efefe,0x3dfcfd4a + .long 0x54000000,0x3ff0c8de + .long 0xc29018c1,0x3e137bfa + .long 0x44000000,0x3ff0cdb9 + .long 0x6b55ea13,0x3e075409 + .long 0xd8000000,0x3ff0d299 + .long 0x17222364,0xbe2c80ba + .long 0x1a000000,0x3ff0d780 + .long 0xf030bcdb,0xbe36c2d9 + .long 0xae000000,0x3ff0db99 + .long 0x583eb4fd,0x3e23f39e + .long 0x7a000000,0x3ff0e08a + .long 0x1bc25b4a,0xbe2ee94c + .long 0x14000000,0x3ff0e581 + .long 0x2f4f4e2c,0xbe2785bf + .long 0x88000000,0x3ff0ea7d + .long 0xd8bcbdfc,0x3e3525a2 + .long 0xe6000000,0x3ff0ef7f + .long 0xed67b448,0x3e359433 + .long 0x16000000,0x3ff0f3b1 + .long 0xc931fbd5,0x3e2bf870 + .long 0x6a000000,0x3ff0f8be + .long 0xe78cbbad,0xbe32480c + .long 0xca000000,0x3ff0fcf8 + .long 0x795e6dd9,0x3e1f7d67 + .long 0x3a000000,0x3ff10211 + .long 0xfbf1714f,0x3e239cff + .long 0xce000000,0x3ff1072f + .long 0x55d6f69a,0xbe272643 + .long 0xac000000,0x3ff10b78 + .long 0xfdfa2d3b,0xbe286878 + .long 0xdc000000,0x3ff10fc5 + .long 0xd49627b5,0x3e1c95db + .long 0x0c000000,0x3ff114f5 + .long 0xf6a23fbe,0xbe2e06fe + .long 0xda000000,0x3ff1194b + .long 0x8f075abc,0x3e34ceb2 + .long 0xac000000,0x3ff11e86 + .long 0x90dc17c3,0x3e066bd5 + .long 0x40000000,0x3ff122e7 + .long 0xc04b5d49,0x3e359eb9 + .long 0x54000000,0x3ff1274c + .long 0xaf65cf99,0x3df316d4 + .long 0xec000000,0x3ff12bb5 + .long 0x7163f782,0x3e1b91b5 + .long 0x74000000,0x3ff13107 + .long 0xb1d8a38e,0xbe171e82 + .long 0x1c000000,0x3ff1357b + .long 0x142a679f,0xbe1645ad + .long 0x64000000,0x3ff139f3 + .long 0x03011ac3,0xbe119734 + .long 0x54000000,0x3ff13e70 + .long 0xceefd26a,0x3e12c753 + .long 0xf6000000,0x3ff142f1 + .long 0x1ae3077b,0xbdff336e + .long 0x50000000,0x3ff14778 + .long 0xa313efdd,0x3e3167c3 + .long 0x6e000000,0x3ff14c03 + .long 0xe0d315a6,0x3e23d347 + .long 0x56000000,0x3ff15093 + .long 0x8ec79515,0x3e34284e + .long 0x14000000,0x3ff15528 + .long 0x6ca0e852,0xbdfd2648 + .long 0xae000000,0x3ff159c1 + .long 0x33a7b5b1,0xbe21074d + .long 0x2c000000,0x3ff15e60 + .long 0x6aaf8c8a,0x3e311566 + .long 0x9c000000,0x3ff16303 + .long 0xdfa56cef,0xbe04190c + .long 0x02000000,0x3ff167ac + .long 0x96f8f747,0x3e30bf5f + .long 0x6c000000,0x3ff16c59 + .long 0x67e1e977,0x3dddd97d + .long 0xfc000000,0x3ff1701a + .long 0xf643cd8e,0xbe32877d + .long 0x80000000,0x3ff174d1 + .long 0x618d0ab4,0xbe318a71 + .long 0x1e000000,0x3ff1798d + .long 0xe66a5be3,0x3e373f3e + .long 0xe6000000,0x3ff17e4d + .long 0xca1da90a,0x3e0c534f + .long 0x0e000000,0x3ff1821f + .long 0xe06a8431,0xbe0ec5e5 + .long 0x32000000,0x3ff186e9 + .long 0xbb5373b7,0x3e06cc6a + .long 0x98000000,0x3ff18bb8 + .long 0x80c817c3,0x3e23ddc1 + .long 0x88000000,0x3ff18f95 + .long 0x70817aed,0xbe25cef4 + .long 0x7e000000,0x3ff1946e + .long 0x71612988,0x3e0b7bf2 + .long 0x22000000,0x3ff19853 + .long 0xdad7b32a,0xbe3008d5 + .long 0xc8000000,0x3ff19d35 + .long 0x558f59ee,0x3e3d2925 + .long 0x3c000000,0x3ff1a122 + .long 0x97916e24,0xbe112012 + .long 0xba000000,0x3ff1a60e + .long 0xf6235d3b,0xbe361be1 + .long 0x14000000,0x3ff1aa03 + .long 0xefaa3b2e,0x3e33a9bc + .long 0x8a000000,0x3ff1aef9 + .long 0x95d61bf1,0xbe3045d7 + .long 0xec000000,0x3ff1b2f5 + .long 0xe5b6bd1c,0x3e1a939c + .long 0xea000000,0x3ff1b6f5 + .long 0x00756ed3,0x3e118b3c + .long 0x02000000,0x3ff1bbfb + .long 0x34057364,0xbe20e5cf + .long 0x30000000,0x3ff1c003 + .long 0x701907b3,0xbe0e1837 + .long 0x0c000000,0x3ff1c40f + .long 0x7c6221b9,0xbe282207 + .long 0x9a000000,0x3ff1c81e + .long 0x71d8c073,0xbe09f360 + .long 0x4a000000,0x3ff1cd37 + .long 0x436616b2,0xbe3261a0 + .long 0x40000000,0x3ff1d14f + .long 0xc7c5e4df,0x3df7af5c + .long 0xfe000000,0x3ff1d56a + .long 0x5ae36062,0xbdfc61a1 + .long 0x88000000,0x3ff1d98a + .long 0xed667c98,0x3e167fd8 + .long 0xe6000000,0x3ff1ddad + .long 0xa010e825,0xbe16ada9 + .long 0x1c000000,0x3ff1e1d5 + .long 0x012f4beb,0xbdbb777c + .long 0x92000000,0x3ff1e70b + .long 0xe05d5c18,0x3e275a5a + .long 0x88000000,0x3ff1eb3b + .long 0x87963143,0x3e1f6ec9 + .long 0x6c000000,0x3ff1ef6f + .long 0xc77f5502,0xbdf400a5 + .long 0x44000000,0x3ff1f3a7 + .long 0x83209a84,0xbe2057a6 + .long 0x14000000,0x3ff1f7e3 + .long 0xcdb4bd2e,0x3e3b8696 + .long 0xea000000,0x3ff1fc22 + .long 0x7dac9b38,0xbe29872a + .long 0xc4000000,0x3ff20066 + .long 0x7e34701c,0x3e22a9a1 + .long 0xae000000,0x3ff204ae + .long 0xae177d59,0x3e2257cd + .long 0x4c000000,0x3ff207e7 + .long 0x6fe6d0dd,0xbe119fb7 + .long 0x60000000,0x3ff20c36 + .long 0x22ab7e20,0xbe18a6a1 + .long 0x94000000,0x3ff21089 + .long 0xca9c3288,0x3e2c8440 + .long 0xf2000000,0x3ff214e0 + .long 0x8575ebf1,0x3e200f9a + .long 0x80000000,0x3ff2193c + .long 0x219c164a,0xbe2140a7 + .long 0x44000000,0x3ff21d9c + .long 0x2238e180,0xbe326ebd + .long 0x44000000,0x3ff22200 + .long 0x0f5fa626,0xbe084ae9 + .long 0x10000000,0x3ff2254e + .long 0x20e924cc,0x3e34737d + .long 0x90000000,0x3ff229b9 + .long 0x7241c459,0xbe233bae + .long 0x60000000,0x3ff22e29 + .long 0xecaa31e6,0xbe2cc059 + .long 0x14000000,0x3ff23180 + .long 0x7a5a0dea,0x3e2bcde5 + .long 0x84000000,0x3ff235f7 + .long 0x52b90575,0x3e333da0 + .long 0x5a000000,0x3ff23a73 + .long 0x1b60c92e,0x3e3a7d2b + .long 0x24000000,0x3ff23dd3 + .long 0xb235ec84,0x3df512e9 + .long 0xc0000000,0x3ff24256 + .long 0x1f3855f6,0xbe1a9d64 + .long 0xd6000000,0x3ff246de + .long 0xfe758c34,0x3e12b491 + .long 0xde000000,0x3ff24a47 + .long 0x607a2edb,0xbe320de4 + .long 0xde000000,0x3ff24ed7 + .long 0xbc58ecd4,0x3dd8f375 + .long 0xde000000,0x3ff25246 + .long 0xda99c7ed,0xbe1ee42e + .long 0xe2000000,0x3ff256de + .long 0x88f4f655,0xbe220405 + .long 0xec000000,0x3ff25a53 + .long 0xc2b1fe7f,0x3e0eec7d + .long 0x0c000000,0x3ff25ef4 + .long 0xb6841168,0xbe1523a2 + .long 0x34000000,0x3ff2626f + .long 0x7056af50,0x3e200ef9 + .long 0x8a000000,0x3ff26717 + .long 0x8197860c,0xbe3643a3 + .long 0xe2000000,0x3ff26a98 + .long 0x52183874,0x3e204b1a + .long 0x84000000,0x3ff26f49 + .long 0x89899f96,0x3e2ce41f + .long 0x22000000,0x3ff272d1 + .long 0x2eba11d7,0x3e33edcf + .long 0x2e000000,0x3ff2778a + .long 0x9b69a0ac,0xbdd15cbf + .long 0x26000000,0x3ff27b18 + .long 0x4c9cfc18,0xbe384c83 + .long 0xd8000000,0x3ff27ea8 + .long 0x00ebd8b6,0x3e32abcc + .long 0x16000000,0x3ff2836e + .long 0xf0c27bf5,0xbe334f0d + .long 0x3e000000,0x3ff28705 + .long 0x2c84c19b,0x3e19ba08 + .long 0x34000000,0x3ff28a9f + .long 0x765ba98f,0xbe351348 + .long 0xd6000000,0x3ff28f70 + .long 0x0bb50259,0x3e25fd61 + .long 0x5c000000,0x3ff29311 + .long 0x1f0ba391,0x3e36468e + .long 0xbc000000,0x3ff296b4 + .long 0x5eb0d555,0xbe1b4b50 + .long 0xf4000000,0x3ff29a5a + .long 0x1684aafd,0x3e322e1b + .long 0x10000000,0x3ff29f3d + .long 0x7f3902f7,0xbe1143a0 + .long 0x04000000,0x3ff2a2ea + .long 0x9d87f711,0xbe296bf0 + .long 0xe0000000,0x3ff2a699 + .long 0xd317cd41,0xbe267680 + .long 0xa8000000,0x3ff2aa4c + .long 0x895632cb,0x3de71246 + .long 0x60000000,0x3ff2ae02 + .long 0x70ae3e69,0x3e383f37 + .long 0x48000000,0x3ff2b2f9 + .long 0x183dd905,0x3e019525 + .long 0xee000000,0x3ff2b6b5 + .long 0xb11ed34f,0xbde2956c + .long 0x92000000,0x3ff2ba75 + .long 0xebcee2d4,0x3e139d57 + .long 0x3a000000,0x3ff2be38 + .long 0x25efe1d2,0xbe24080b + .long 0xe8000000,0x3ff2c1fd + .long 0xca843d11,0xbe22f3d1 + .long 0xa0000000,0x3ff2c5c6 + .long 0x27157d0b,0x3e25d6d0 + .long 0x6a000000,0x3ff2c992 + .long 0x47c03cbd,0xbe1f901f + .long 0x46000000,0x3ff2cd61 + .long 0xc7d41505,0x3e0c9c6b + .long 0x3a000000,0x3ff2d133 + .long 0x4c9cbf49,0x3e335b1a + .long 0x4e000000,0x3ff2d508 + .long 0xf0d67754,0xbe31f5cc + .long 0x80000000,0x3ff2d8e0 + .long 0x08d6ec2a,0xbe14dddd + .long 0xd8000000,0x3ff2dcbb + .long 0xd1a31600,0x3df4f684 + .long 0x5a000000,0x3ff2e09a + .long 0xe7cb28ec,0x3e23d67d + .long 0x0c000000,0x3ff2e47c + .long 0x64fad19f,0xbe0416e4 + .long 0xf0000000,0x3ff2e860 + .long 0xc1845328,0x3e15f191 + .long 0x0e000000,0x3ff2ec49 + .long 0x0e8212a2,0xbe3407e4 + .long 0x66000000,0x3ff2f034 + .long 0xa6af14fb,0xbe119cdf + .long 0x00000000,0x3ff2f423 + .long 0xdd2ff4b2,0xbdd785b8 + .long 0xe0000000,0x3ff2f814 + .long 0x3c8bc168,0x3e0f9d26 + .long 0x0c000000,0x3ff2fc0a + .long 0x7f285f7f,0xbe25e721 + .long 0x54000000,0x3ff2feaf + .long 0xe4707431,0xbde3d3dc + .long 0x06000000,0x3ff302aa + .long 0x54e59df9,0x3e1b2c8a + .long 0x12000000,0x3ff306a8 + .long 0x5bf8bf35,0xbe35f560 + .long 0x78000000,0x3ff30aa9 + .long 0x1bf7ce44,0xbe201d62 + .long 0x40000000,0x3ff30eae + .long 0x268d3880,0xbda201ac + .long 0x6e000000,0x3ff312b6 + .long 0x78463451,0x3e323ba0 + .long 0x74000000,0x3ff31568 + .long 0x431ff6b5,0x3e27f197 + .long 0x5c000000,0x3ff31976 + .long 0x1d86063e,0xbe3cd285 + .long 0xb4000000,0x3ff31d87 + .long 0xde58cb2b,0xbe038490 + .long 0x86000000,0x3ff3219c + .long 0x0d0ecee4,0x3e2b6d7a + .long 0x04000000,0x3ff32457 + .long 0x67a045ac,0x3e081609 + .long 0xae000000,0x3ff32871 + .long 0x218aae81,0xbe2e422a + .long 0xde000000,0x3ff32c8f + .long 0x77d29102,0xbe27b381 + .long 0xa0000000,0x3ff32f50 + .long 0x1b3eff6b,0x3e21691f + .long 0xbe000000,0x3ff33374 + .long 0xd026a2c6,0x3e04f8ad + .long 0x72000000,0x3ff3379c + .long 0x4d48535f,0xbe22ae68 + .long 0x94000000,0x3ff33a63 + .long 0x1f2825ca,0x3df10fe6 + .long 0x4c000000,0x3ff33e91 + .long 0x0279faec,0x3e2a71d3 + .long 0xaa000000,0x3ff342c2 + .long 0x78d2f376,0xbe04bba3 + .long 0x46000000,0x3ff34590 + .long 0x998a41e9,0xbe03e672 + .long 0xc0000000,0x3ff349c7 + .long 0x36ef8407,0x3e3019b2 + .long 0xee000000,0x3ff34e02 + .long 0x645bac29,0x3e35fca4 + .long 0x20000000,0x3ff350d7 + .long 0x07bfe20f,0xbe25ac45 + .long 0x86000000,0x3ff35518 + .long 0x5aa1ebf5,0xbe2e6547 + .long 0xe0000000,0x3ff357f0 + .long 0xee89ceb5,0xbe287b40 + .long 0x8c000000,0x3ff35c38 + .long 0xa4e8d2ef,0x3e17e02f + .long 0x1c000000,0x3ff35f15 + .long 0xd982cb35,0xbe1b64a3 + .long 0x22000000,0x3ff36363 + .long 0x51a0e2b8,0xbe398839 + .long 0xfc000000,0x3ff367b4 + .long 0x5db6b242,0xbe243ecf + .long 0x5c000000,0x3ff36a98 + .long 0x04aa635d,0x3e2322a4 + .long 0xaa000000,0x3ff36ef0 + .long 0xdffe6c15,0xbe09399e + .long 0x5e000000,0x3ff371d8 + .long 0x25a11d1c,0xbe330e55 + .long 0xce000000,0x3ff374c1 + .long 0x3129afdf,0xbe268d7b + .long 0x3e000000,0x3ff37923 + .long 0xb97189dc,0xbe26657a + .long 0x10000000,0x3ff37c11 + .long 0xea29a16b,0xbe1fb083 + .long 0x1c000000,0x3ff38079 + .long 0x95fa7d47,0xbe340007 + .long 0x5a000000,0x3ff3836b + .long 0x5dc9ac54,0x3e10d40e + .long 0x12000000,0x3ff387da + .long 0x5012ad99,0x3e10b74e + .long 0xca000000,0x3ff38ad0 + .long 0xf7bd2128,0x3e2b0108 + .long 0x40000000,0x3ff38f46 + .long 0x9cc0ea9d,0x3e35e485 + .long 0x7e000000,0x3ff39241 + .long 0x770980a5,0x3e2ea300 + .long 0x90000000,0x3ff3953e + .long 0xd4c7a782,0xbe344ce9 + .long 0x96000000,0x3ff399bd + .long 0x940f9584,0xbe33e2fe + .long 0x3a000000,0x3ff39cbf + .long 0x24087e1a,0x3e2194f5 + .long 0xba000000,0x3ff39fc2 + .long 0x89c83cca,0xbe231d00 + .long 0x72000000,0x3ff3a44b + .long 0x3f2ced31,0x3e307ed8 + .long 0x98000000,0x3ff3a753 + .long 0x3dad14f7,0x3e34644c + .long 0xa0000000,0x3ff3aa5d + .long 0x44bf6650,0xbe198a0f + .long 0x32000000,0x3ff3aef0 + .long 0x83ce161a,0xbe13523e + .long 0xf2000000,0x3ff3b1fe + .long 0x3e4fb0ba,0xbe2b016e + .long 0x98000000,0x3ff3b50f + .long 0x5a266eb9,0xbe00c90d + .long 0x28000000,0x3ff3b9ac + .long 0x5d6435a9,0x3df6946b + .long 0x9a000000,0x3ff3bcc1 + .long 0xb51ea777,0x3deb71b8 + .long 0xfa000000,0x3ff3bfd8 + .long 0xddbd1e72,0x3e23310e + .long 0x4c000000,0x3ff3c2f2 + .long 0x3b61a362,0xbe036033 + .long 0xee000000,0x3ff3c79b + .long 0xfc551ad6,0xbe125411 + .long 0x22000000,0x3ff3caba + .long 0xf4f97f1b,0x3df6c6c6 + .long 0x4e000000,0x3ff3cdda + .long 0x34b9c5a5,0x3e265154 + .long 0x76000000,0x3ff3d0fc + .long 0x63686af4,0xbe11e3d1 + .long 0x6a000000,0x3ff3d5b3 + .long 0x41549461,0x3e22cde8 + .long 0x8e000000,0x3ff3d8da + .long 0x77ad6645,0xbe270a08 + .long 0xb2000000,0x3ff3dc03 + .long 0x15410840,0x3e008be3 + .long 0xdc000000,0x3ff3df2e + .long 0xcbeff11b,0xbe23e35d + .long 0x0c000000,0x3ff3e25c + .long 0x4f6d956b,0xbe26e298 + .long 0x44000000,0x3ff3e58b + .long 0xccfac644,0x3dfe9b4c + .long 0xee000000,0x3ff3ea55 + .long 0x67939d69,0x3e31da2e + .long 0x48000000,0x3ff3ed8a + .long 0x801a7764,0x3e1351ce + .long 0xb4000000,0x3ff3f0c0 + .long 0x501a20c7,0xbe3857a0 + .long 0x30000000,0x3ff3f3f9 + .long 0x57940f51,0xbdd234a1 + .long 0xc4000000,0x3ff3f733 + .long 0x3f2233b4,0xbe2ac2d6 + .long 0x6e000000,0x3ff3fa70 + .long 0xedca8a34,0x3e18e528 + .long 0x34000000,0x3ff3fdaf + .long 0x08b5b935,0x3de3efe5 + .long 0x16000000,0x3ff400f0 + .long 0x3ba01202,0x3e204ec9 + .long 0x64000000,0x3ff405d5 + .long 0x619a3fdd,0x3e3888e9 + .long 0x9c000000,0x3ff4091b + .long 0x5d7bbc67,0xbe35c660 + .long 0xf4000000,0x3ff40c63 + .long 0x371a5b37,0x3e312962 + .long 0x78000000,0x3ff40fae + .long 0xfd4427e8,0xbe266865 + .long 0x24000000,0x3ff412fb + .long 0xe4fe1e06,0xbe095508 + .long 0xfe000000,0x3ff41649 + .long 0x7f425eed,0xbe2d87f6 + .long 0x04000000,0x3ff4199b + .long 0xed161ccb,0x3e3a37a5 + .long 0x40000000,0x3ff41cee + .long 0xf32e9c13,0x3dd0ac84 + .long 0xb0000000,0x3ff42043 + .long 0x6f5637aa,0xbe33e54f + .long 0x56000000,0x3ff4239b + .long 0xb5063313,0xbe393f2e + .long 0x34000000,0x3ff426f5 + .long 0xbfa6486b,0xbe1a1603 + .type __libm_cbrtl_table_256,@object + .size __libm_cbrtl_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/ccos.S b/external/sgx_libm/intel64/ccos.S new file mode 100644 index 0000000000..ad95ef6f5c --- /dev/null +++ b/external/sgx_libm/intel64/ccos.S @@ -0,0 +1,147 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccos.c" + .text +..TXTST0: +# -- Begin ccos + .text + .align 16,0x90 + .globl ccos +ccos: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ccos.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movsd %xmm1, 24(%rsp) + movzwl 30(%rsp), %eax + andl $32752, %eax + movsd %xmm0, 16(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.5 +..B1.3: + testl $1048575, 28(%rsp) + jne ..B1.7 +..B1.4: + cmpl $0, 24(%rsp) + jne ..B1.7 +..B1.5: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.6: + movb 31(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm1 + movhpd 8(%rsp), %xmm1 +..B1.7: + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + call ccosh@PLT +..B1.10: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ccos,@function + .size ccos,.-ccos + .data +# -- End ccos + .text +# -- Begin ccosf + .text + .align 16,0x90 + .globl ccosf +ccosf: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_ccosf.6: +..L7: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) + movzwl 14(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.4 +..B2.3: + testl $8388607, 12(%rsp) + jne ..B2.6 +..B2.4: + movsd %xmm0, (%rsp) +..B2.5: + movb 15(%rsp), %al + notb %al + movb 3(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 3(%rsp) + movsd (%rsp), %xmm0 +..B2.6: + call ccoshf@PLT +..B2.9: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ccosf,@function + .size ccosf,.-ccosf + .data +# -- End ccosf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ccosh.S b/external/sgx_libm/intel64/ccosh.S new file mode 100644 index 0000000000..1cede1de9a --- /dev/null +++ b/external/sgx_libm/intel64/ccosh.S @@ -0,0 +1,566 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccosh.c" + .text +..TXTST0: +# -- Begin ccoshf + .text + .align 16,0x90 + .globl ccoshf +ccoshf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ccoshf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_ccoshf.4: + call ccosh@PLT +..___tag_value_ccoshf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movl $8388608, (%rsp) + movss (%rsp), %xmm1 + movss (%rsp), %xmm0 + mulss %xmm0, %xmm1 + movsd 4(%rsp), %xmm0 + movss %xmm1, (%rsp) +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ccoshf,@function + .size ccoshf,.-ccoshf + .data +# -- End ccoshf + .text +# -- Begin ccosh + .text + .align 16,0x90 + .globl ccosh +ccosh: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_ccosh.8: +..L9: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + movq %fs:40, %rax + subq $112, %rsp + .cfi_def_cfa_offset 144 + movsd %xmm0, 48(%rsp) + xorq %rsp, %rax + movzwl 54(%rsp), %r12d + andl $32752, %r12d + shrl $4, %r12d + movsd %xmm1, 56(%rsp) + cmpl $2047, %r12d + movq %rax, 96(%rsp) + jge ..B2.23 +..B2.2: + testl %r12d, %r12d + jle ..B2.46 +..B2.3: + movzwl 62(%rsp), %ebp + andl $32752, %ebp + shrl $4, %ebp + cmpl $2047, %ebp + jge ..B2.24 +..B2.4: + testl %ebp, %ebp + jle ..B2.44 +..B2.5: + cmpl $1034, %r12d + jl ..B2.11 +..B2.6: + lea _CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 24(%rsp) + movsd 56(%rsp), %xmm0 + movsd %xmm0, 16(%rsp) + call __libm_sse2_sincos@PLT +..B2.59: + movaps %xmm0, %xmm2 + testl %ebp, %ebp + movsd 24(%rsp), %xmm0 + mulsd %xmm0, %xmm1 + mulsd 48(%rsp), %xmm0 + movsd %xmm0, 24(%rsp) + movsd %xmm1, (%rsp) + movsd %xmm0, 8(%rsp) + jle ..B2.8 +..B2.7: + mulsd %xmm2, %xmm0 + movsd %xmm0, 24(%rsp) + jmp ..B2.9 +..B2.8: + movsd 8(%rsp), %xmm0 + mulsd 16(%rsp), %xmm0 + movsd %xmm0, 24(%rsp) +..B2.9: + movsd %xmm0, 8(%rsp) + movq 96(%rsp), %rax + xorq %rsp, %rax + movsd (%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.43 +..B2.10: + movsd 24(%rsp), %xmm1 + addq $112, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 6, -32 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B2.11: + movsd 48(%rsp), %xmm0 + lea 64(%rsp), %rdi +..___tag_value_ccosh.28: + call __libm_cosh_k64@PLT +..___tag_value_ccosh.29: +..B2.60: + movl %eax, %r13d +..B2.12: + movsd 64(%rsp), %xmm0 + movsd 72(%rsp), %xmm4 + movaps %xmm0, %xmm5 + movsd .L_2il0floatpacket.13(%rip), %xmm3 + addsd %xmm4, %xmm5 + mulsd %xmm5, %xmm3 + movaps %xmm5, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm3, %xmm2 + subsd %xmm1, %xmm4 + subsd %xmm5, %xmm2 + movzwl 54(%rsp), %eax + subsd %xmm2, %xmm3 + andl $32752, %eax + subsd %xmm3, %xmm5 + movsd %xmm3, 64(%rsp) + cmpl $13168, %eax + addsd %xmm4, %xmm5 + movsd %xmm5, 72(%rsp) + jge ..B2.14 +..B2.13: + lea 16+_CONSTANTS(%rip), %r12 + lea 40(%rsp), %rdx + movsd 8(%rdx), %xmm0 + pxor %xmm5, %xmm5 + mulsd (%r12), %xmm0 + movsd %xmm0, -8(%rdx) + movzwl -2(%rdx), %eax + movl %eax, %r12d + andl $32752, %r12d + andl $-32753, %eax + shrl $4, %r12d + orl $-49168, %eax + movw %ax, -2(%rdx) + addl $-1279, %r12d + jmp ..B2.16 +..B2.14: + movsd 48(%rsp), %xmm0 + lea 32(%rsp), %rdi +..___tag_value_ccosh.30: + call __libm_sinh_k64@PLT +..___tag_value_ccosh.31: +..B2.61: + movl %eax, %r12d +..B2.15: + lea 40(%rsp), %rdx + movsd (%rdx), %xmm5 +..B2.16: + movsd 32(%rsp), %xmm0 + movaps %xmm5, %xmm4 + movsd .L_2il0floatpacket.13(%rip), %xmm3 + lea 16(%rsp), %rdi + addsd %xmm0, %xmm4 + mulsd %xmm4, %xmm3 + movaps %xmm4, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm3, %xmm2 + lea 80(%rsp), %rsi + movsd -24(%rsi), %xmm0 + subsd %xmm4, %xmm2 + subsd %xmm1, %xmm5 + subsd %xmm2, %xmm3 + movsd %xmm3, -48(%rsi) + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + movsd %xmm5, (%rdx) +..___tag_value_ccosh.32: + call __libm_sincos_k64@PLT +..___tag_value_ccosh.33: +..B2.17: + movsd 80(%rsp), %xmm0 + lea 8+_CONSTANTS(%rip), %rax + movsd 88(%rsp), %xmm4 + movaps %xmm0, %xmm3 + movsd .L_2il0floatpacket.13(%rip), %xmm6 + addsd %xmm4, %xmm3 + mulsd %xmm3, %xmm6 + movaps %xmm3, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm6, %xmm2 + subsd %xmm1, %xmm4 + subsd %xmm3, %xmm2 + movsd (%rax), %xmm5 + subsd %xmm2, %xmm6 + movzwl 62(%rsp), %edx + subsd %xmm6, %xmm3 + addsd %xmm5, %xmm6 + addsd %xmm3, %xmm4 + andl $32752, %edx + movsd %xmm4, 88(%rsp) + cmpl $13168, %edx + movsd %xmm6, 80(%rsp) + jl ..B2.19 +..B2.18: + xorl %ebp, %ebp + lea 24(%rsp), %rdx + movsd (%rdx), %xmm5 + jmp ..B2.20 +..B2.19: + lea 16+_CONSTANTS(%rip), %rbp + lea 24(%rsp), %rdx + movsd 32(%rdx), %xmm0 + pxor %xmm5, %xmm5 + mulsd (%rbp), %xmm0 + movsd %xmm0, -8(%rdx) + movzwl -2(%rdx), %eax + movl %eax, %ebp + andl $32752, %ebp + andl $-32753, %eax + shrl $4, %ebp + orl $-49168, %eax + movw %ax, -2(%rdx) + addl $-1279, %ebp +..B2.20: + movsd 16(%rsp), %xmm0 + movaps %xmm5, %xmm4 + movsd .L_2il0floatpacket.13(%rip), %xmm3 + lea 64(%rsp), %rsi + movl %r13d, %edi + lea (%rsp), %rcx + addsd %xmm0, %xmm4 + mulsd %xmm4, %xmm3 + movaps %xmm4, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm3, %xmm2 + subsd %xmm1, %xmm5 + subsd %xmm4, %xmm2 + subsd %xmm2, %xmm3 + movsd %xmm3, 16(%rcx) + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + movsd %xmm5, (%rdx) + lea 80(%rsp), %rdx +..___tag_value_ccosh.34: + call __libm_mul_k64@PLT +..___tag_value_ccosh.35: +..B2.21: + addl %r12d, %ebp + lea 32(%rsp), %rsi + movl %ebp, %edi + lea 16(%rsp), %rdx + lea 8(%rsp), %rcx +..___tag_value_ccosh.36: + call __libm_mul_k64@PLT +..___tag_value_ccosh.37: +..B2.22: + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.41 +..B2.23: + movzwl 62(%rsp), %ebp + andl $32752, %ebp + shrl $4, %ebp +..B2.24: + testl %ebp, %ebp + jne ..B2.33 +..B2.25: + testl $1048575, 60(%rsp) + jne ..B2.33 +..B2.26: + cmpl $0, 56(%rsp) + jne ..B2.33 +..B2.27: + movsd 48(%rsp), %xmm0 + call cosh@PLT +..B2.62: + cmpl $2047, %r12d + movhpd 56(%rsp), %xmm0 + jl ..B2.31 +..B2.29: + testl $1048575, 52(%rsp) + jne ..B2.41 +..B2.30: + cmpl $0, 48(%rsp) + jne ..B2.41 +..B2.31: + movsd %xmm0, (%rsp) + movhpd %xmm0, 8(%rsp) +..B2.32: + movb 15(%rsp), %dl + movb %dl, %cl + movb 55(%rsp), %al + andb $127, %cl + shrb $7, %dl + shrb $7, %al + movsd (%rsp), %xmm0 + xorb %al, %dl + shlb $7, %dl + orb %dl, %cl + movb %cl, 15(%rsp) + movhpd 8(%rsp), %xmm0 + jmp ..B2.41 +..B2.33: + cmpl $2047, %ebp + jge ..B2.36 +..B2.34: + movsd 48(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + call cosh@PLT +..B2.64: + movsd %xmm0, 40(%rsp) + movsd 56(%rsp), %xmm0 + movsd %xmm0, 16(%rsp) + call __libm_sse2_sincos@PLT +..B2.63: + movsd %xmm0, 24(%rsp) + testl %ebp, %ebp + movsd 40(%rsp), %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%rsp) + jle ..B2.49 +..B2.35: + movsd 32(%rsp), %xmm0 + call sinh@PLT +..B2.65: + mulsd 24(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.41 +..B2.36: + cmpl $2047, %r12d + jge ..B2.38 +..B2.37: + movsd 56(%rsp), %xmm0 + call cos@PLT + jmp ..B2.67 +..B2.38: + movsd 48(%rsp), %xmm0 + call cosh@PLT +..B2.67: + movsd %xmm0, (%rsp) +..B2.39: + testl %r12d, %r12d + jle ..B2.51 +..B2.40: + movsd 56(%rsp), %xmm0 + call sin@PLT +..B2.68: + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 +..B2.41: + movq 96(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.43 +..B2.42: + movaps %xmm0, %xmm1 + unpckhpd %xmm0, %xmm1 + addq $112, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 6, -32 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B2.43: + call __stack_chk_fail@PLT +..B2.44: + testl $1048575, 60(%rsp) + jne ..B2.5 +..B2.45: + cmpl $0, 56(%rsp) + jne ..B2.5 + jmp ..B2.24 +..B2.46: + testl $1048575, 52(%rsp) + jne ..B2.3 +..B2.47: + cmpl $0, 48(%rsp) + jne ..B2.3 + jmp ..B2.23 +..B2.49: + movsd 32(%rsp), %xmm0 + call sinh@PLT +..B2.69: + mulsd 16(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.41 +..B2.51: + testl $1048575, 52(%rsp) + jne ..B2.40 +..B2.52: + cmpl $0, 48(%rsp) + jne ..B2.40 +..B2.53: + testl $1048575, 60(%rsp) + jne ..B2.56 +..B2.54: + cmpl $0, 56(%rsp) + jne ..B2.56 +..B2.55: + movb 55(%rsp), %dl + lea ones(%rip), %rcx + movb 63(%rsp), %al + andb $-128, %dl + andb $-128, %al + pxor %xmm0, %xmm0 + shrb $7, %dl + shrb $7, %al + xorb %al, %dl + movzbl %dl, %ebp + mulsd (%rcx,%rbp,8), %xmm0 + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.41 +..B2.56: + movq $0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.41 + .align 16,0x90 + .cfi_endproc + .type ccosh,@function + .size ccosh,.-ccosh + .data +# -- End ccosh + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.13: + .long 0x02000000,0x41a00000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +.L_2il0floatpacket.12: + .long 0x00800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +_CONSTANTS: + .long 0 + .long 2145386496 + .long 0 + .long 1048576 + .long 0 + .long 1341128704 + .type _CONSTANTS,@object + .size _CONSTANTS,24 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ccoshl.S b/external/sgx_libm/intel64/ccoshl.S new file mode 100644 index 0000000000..811a47f254 --- /dev/null +++ b/external/sgx_libm/intel64/ccoshl.S @@ -0,0 +1,742 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccoshl.c" + .text +..TXTST0: +# -- Begin ccoshl + .text + .align 16,0x90 + .globl ccoshl +ccoshl: +# parameter 1: 336 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ccoshl.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $296, %rsp + .cfi_def_cfa_offset 336 + xorb %bl, %bl + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 288(%rsp) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 256(%rsp) + fldt 256(%rsp) + fstpt 272(%rsp) +..B1.2: + fnstcw 114(%rsp) +..B1.3: + movzwl 114(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 112(%rsp) +..B1.5: + fldcw 112(%rsp) +..B1.6: + movb $1, %bl +..B1.7: + movzwl 344(%rsp), %ebp + andl $32767, %ebp + cmpl $32767, %ebp + jge ..B1.33 +..B1.8: + testl %ebp, %ebp + jle ..B1.57 +..B1.9: + movzwl 360(%rsp), %r14d + andl $32767, %r14d + cmpl $32767, %r14d + jge ..B1.33 +..B1.10: + testl %r14d, %r14d + jle ..B1.55 +..B1.11: + cmpl $16398, %ebp + jl ..B1.20 +..B1.12: + fldt 352(%rsp) + lea _CONSTANTS(%rip), %rax + fstpt (%rsp) + fldt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstpt (%rsp) + fldt (%rax) + fmul %st(0), %st + fstpt 32(%rsp) + call cosl@PLT +..B1.65: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fmul %st, %st(1) + testl %r14d, %r14d + fxch %st(1) + fstpt 256(%rsp) + fldt 336(%rsp) + fmulp %st, %st(1) + jle ..B1.14 +..B1.13: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 16(%rsp) + fstpt (%rsp) + fstpt 32(%rsp) + call sinl@PLT +..B1.66: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fmulp %st, %st(1) + jmp ..B1.15 +..B1.14: + fldt (%rsp) + fmulp %st, %st(1) +..B1.15: + fstpt 272(%rsp) + testb %bl, %bl + je ..B1.17 +..B1.16: + fldcw 114(%rsp) +..B1.17: + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.54 +..B1.18: + fldt 256(%rsp) + fldt 272(%rsp) + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.53 +..B1.19: + addq $296, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.20: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + lea 176(%rsp), %rdi + fstpt (%rsp) +..___tag_value_ccoshl.31: + call __libm_coshl_k80@PLT +..___tag_value_ccoshl.32: +..B1.67: + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.21: + fldt 176(%rsp) + lea 48+_CONSTANTS(%rip), %r15 + fldt .L_2il0floatpacket.9(%rip) + movzwl 344(%rsp), %eax + andl $32767, %eax + fldt (%r15) + cmpl $16183, %eax + fadd %st, %st(3) + fxch %st(3) + fstpt (%rsp) + fldt 160(%rsp) + fld %st(0) + movl (%rsp), %r15d + fadd %st(3), %st + fmul %st, %st(2) + fld %st(0) + fsubr %st(3), %st + fsubrp %st, %st(3) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(3) + fsubrp %st, %st(1) + faddp %st, %st(1) + jge ..B1.23 +..B1.22: + fstp %st(1) + fldt 336(%rsp) + lea 32+_CONSTANTS(%rip), %r14 + fldt 96(%rsp) + lea 208(%rsp), %rdx + fstpt (%rdx) + fldt (%r14) + fmulp %st, %st(1) + fstpt -16(%rdx) + movzwl -8(%rdx), %eax + movl %eax, %r14d + andl $-32768, %eax + andl $32767, %r14d + orl $-49153, %eax + addl $-16639, %r14d + movw %ax, -8(%rdx) + jmp ..B1.25 +..B1.23: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + lea 208(%rsp), %rdi + fstpt (%rsp) + fxch %st(1) + fstpt 16(%rsp) + fstpt -128(%rdi) +..___tag_value_ccoshl.35: + call __libm_sinhl_k80@PLT +..___tag_value_ccoshl.36: +..B1.68: + fldt 80(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.24: + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + lea 208(%rsp), %rdx + movl (%rsp), %r14d +..B1.25: + fldt 192(%rsp) + fld %st(0) + fldt (%rdx) + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.9(%rip) + fmul %st(3), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 368(%rsp) + fstpt (%rsp) + lea 240(%rsp), %rdi + fxch %st(1) + fstpt 80(%rsp) + fstpt 96(%rsp) +..___tag_value_ccoshl.39: + call __libm_cosl_k80@PLT +..___tag_value_ccoshl.40: +..B1.69: + fldt 96(%rsp) + fldt 80(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.26: + fldt 224(%rsp) + lea 16+_CONSTANTS(%rip), %rax + fld %st(0) + fldt 240(%rsp) + movzwl 360(%rsp), %edx + fadd %st, %st(1) + fld %st(1) + andl $32767, %edx + cmpl $16183, %edx + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.9(%rip) + fmul %st(3), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st(4), %st + fxch %st(1) + fmulp %st, %st(4) + fldt (%rax) + faddp %st, %st(1) + jge ..B1.28 +..B1.27: + fldt 352(%rsp) + lea 32+_CONSTANTS(%rip), %rbp + fldt 96(%rsp) + fstpt 144(%rsp) + fldt (%rbp) + fmulp %st, %st(1) + fstpt 128(%rsp) + movzwl 136(%rsp), %eax + movl %eax, %ebp + andl $-32768, %eax + andl $32767, %ebp + orl $-49153, %eax + addl $-16639, %ebp + movw %ax, 136(%rsp) + fldt 128(%rsp) + jmp ..B1.30 +..B1.28: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 368(%rsp) + lea 144(%rsp), %rdi + fstpt (%rsp) + fxch %st(3) + fstpt 16(%rsp) + fstpt -64(%rdi) + fxch %st(1) + fstpt -112(%rdi) + fstpt -48(%rdi) +..___tag_value_ccoshl.43: + call __libm_sinl_k80@PLT +..___tag_value_ccoshl.44: +..B1.70: + fldt 96(%rsp) + fldt 32(%rsp) + fldt 80(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.29: + fldt 128(%rsp) + xorl %ebp, %ebp + fmul %st(5), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fldt 144(%rsp) + fmulp %st, %st(6) + fxch %st(5) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 144(%rsp) + fxch %st(4) + fxch %st(1) + fxch %st(2) + fxch %st(1) +..B1.30: + fldt 96(%rsp) + fld %st(1) + movl %r15d, %edi + fadd %st(1), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.9(%rip) + fmul %st(3), %st + fsub %st, %st(1) + fsubp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(5), %st + fldt 32(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + fld %st(0) + fmul %st(4), %st + fstpt (%rsp) + fmulp %st, %st(6) + faddp %st, %st(5) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 16(%rsp) + fxch %st(1) + fstpt 48(%rsp) + fstpt 112(%rsp) +..___tag_value_ccoshl.47: + call __libm_scalbl_k80@PLT +..___tag_value_ccoshl.48: +..B1.71: + fldt 112(%rsp) + fldt 48(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B1.31: + fldt (%rsp) + fld %st(2) + fmul %st(2), %st + addl %ebp, %r14d + fxch %st(4) + fstpt 256(%rsp) + movl %r14d, %edi + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + fld %st(0) + fmul %st(2), %st + fstpt (%rsp) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_ccoshl.51: + call __libm_scalbl_k80@PLT +..___tag_value_ccoshl.52: +..B1.72: + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B1.32: + fstpt 272(%rsp) + jmp ..B1.48 +..B1.33: + movq 352(%rsp), %r14 + testq %r14, %r14 + jne ..B1.37 +..B1.34: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + fstpt (%rsp) + call coshl@PLT +..B1.73: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + cmpl $32767, %ebp + fstpt 272(%rsp) + fstpt 256(%rsp) + jl ..B1.36 +..B1.35: + movq $0x8000000000000000, %rax + cmpq 336(%rsp), %rax + jne ..B1.48 +..B1.36: + movb 281(%rsp), %dl + movb %dl, %cl + movb 345(%rsp), %al + andb $127, %cl + shrb $7, %dl + shrb $7, %al + xorb %al, %dl + shlb $7, %dl + orb %dl, %cl + movb %cl, 281(%rsp) + jmp ..B1.48 +..B1.37: + movzwl 360(%rsp), %r15d + andl $32767, %r15d + cmpl $32767, %r15d + jge ..B1.40 +..B1.38: + fldt 336(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstpt (%rsp) + call coshl@PLT +..B1.75: + fstpt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstpt (%rsp) + call cosl@PLT +..B1.74: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt (%rsp) + testl %r15d, %r15d + fmulp %st, %st(1) + fstpt 256(%rsp) + jle ..B1.59 +..B1.39: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 48(%rsp) + fstpt (%rsp) + call sinhl@PLT +..B1.77: + fstpt 16(%rsp) + fldt 32(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.76: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt (%rsp) + fmulp %st, %st(1) + fstpt 272(%rsp) + jmp ..B1.48 +..B1.40: + cmpl $32767, %ebp + jge ..B1.42 +..B1.41: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 368(%rsp) + fstpt (%rsp) + call cosl@PLT + jmp ..B1.79 + .cfi_def_cfa_offset 336 +..B1.42: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + fstpt (%rsp) + call coshl@PLT +..B1.79: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fstpt 256(%rsp) +..B1.43: + cmpl $0, 340(%rsp) + jne ..B1.45 +..B1.44: + cmpl $0, 336(%rsp) + je ..B1.46 +..B1.45: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 368(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.80: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fstpt 272(%rsp) + jmp ..B1.48 +..B1.46: + movq $0x8000000000000000, %rax + cmpq %rax, %r14 + je ..B1.62 +..B1.47: + fldt 96(%rsp) + fstpt 272(%rsp) +..B1.48: + testb %bl, %bl + je ..B1.50 +..B1.49: + fldcw 114(%rsp) +..B1.50: + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.54 +..B1.51: + fldt 256(%rsp) + fldt 272(%rsp) + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.53 +..B1.52: + addq $296, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.53: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.54: + call __stack_chk_fail@PLT +..B1.55: + cmpl $0, 356(%rsp) + jne ..B1.11 +..B1.56: + cmpl $0, 352(%rsp) + jne ..B1.11 + jmp ..B1.33 +..B1.57: + cmpl $0, 340(%rsp) + jne ..B1.9 +..B1.58: + cmpl $0, 336(%rsp) + jne ..B1.9 + jmp ..B1.33 +..B1.59: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 48(%rsp) + fstpt (%rsp) + call sinhl@PLT +..B1.81: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt 16(%rsp) + fmulp %st, %st(1) + fstpt 272(%rsp) + jmp ..B1.48 +..B1.62: + movb 345(%rsp), %dl + lea ones(%rip), %rcx + movb 361(%rsp), %al + andb $-128, %dl + andb $-128, %al + pxor %xmm0, %xmm0 + shrb $7, %dl + shrb $7, %al + xorb %al, %dl + movzbl %dl, %ebp + mulsd (%rcx,%rbp,8), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 272(%rsp) + jmp ..B1.48 + .align 16,0x90 + .cfi_endproc + .type ccoshl,@function + .size ccoshl,.-ccoshl + .data +# -- End ccoshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,64 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ccosl.S b/external/sgx_libm/intel64/ccosl.S new file mode 100644 index 0000000000..7d2f5dc8c0 --- /dev/null +++ b/external/sgx_libm/intel64/ccosl.S @@ -0,0 +1,175 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ccosl.c" + .text +..TXTST0: +# -- Begin ccosl + .text + .align 16,0x90 + .globl ccosl +ccosl: +# parameter 1: 112 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ccosl.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + subq $96, %rsp + .cfi_def_cfa_offset 112 + xorb %bl, %bl + fldt .L_2il0floatpacket.5(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 80(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 64(%rsp) +..B1.2: + fnstcw 2(%rsp) +..B1.3: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.5: + fldcw (%rsp) +..B1.6: + movb $1, %bl +..B1.7: + fldt 112(%rsp) + movzwl 136(%rsp), %eax + andl $32767, %eax + fstpt 64(%rsp) + cmpl $32767, %eax + fldt 128(%rsp) + fstpt 48(%rsp) + jl ..B1.9 +..B1.8: + movq $0x8000000000000000, %rax + cmpq 128(%rsp), %rax + jne ..B1.10 +..B1.9: + movb 137(%rsp), %al + notb %al + movb 57(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 57(%rsp) +..B1.10: + addq $-32, %rsp + .cfi_def_cfa_offset 144 + movq %rsp, %rdi + movq 80(%rsp), %rax + movq 88(%rsp), %rdx + movq 96(%rsp), %rcx + movq 104(%rsp), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %rsi, 24(%rdi) + call ccoshl@PLT +..B1.19: + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 112 + fxch %st(1) + fstpt 16(%rsp) + testb %bl, %bl + fstpt 32(%rsp) + je ..B1.12 +..B1.11: + fldcw 2(%rsp) +..B1.12: + movq 80(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.16 +..B1.13: + fldt 16(%rsp) + fldt 32(%rsp) + movq 80(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.15 +..B1.14: + addq $96, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 112 + .cfi_offset 3, -16 +..B1.15: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.16: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type ccosl,@function + .size ccosl,.-ccosl + .data +# -- End ccosl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ceil_gen.S b/external/sgx_libm/intel64/ceil_gen.S new file mode 100644 index 0000000000..83fec73e5e --- /dev/null +++ b/external/sgx_libm/intel64/ceil_gen.S @@ -0,0 +1,167 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ceil_gen.c" + .text +..TXTST0: +# -- Begin ceil + .text + .align 16,0x90 + .globl ceil +ceil: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ceil.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %edi + andl $2147483647, %edi + lea -1072693248(%rdi), %edx + cmpl $54525952, %edx + jae ..B1.12 +..B1.2: + movl %edi, %ecx + shrl $20, %ecx + cmpl $22020096, %edx + jae ..B1.8 +..B1.3: + negl %ecx + movl $-1, %esi + addl $19, %ecx + shll %cl, %esi + movl %esi, %edx + andl %esi, %eax + notl %edx + andl %edx, %edi + orl -8(%rsp), %edi + movl $0, -8(%rsp) + testl $-2147483648, %eax + jne ..B1.6 +..B1.4: + testl %edi, %edi + je ..B1.6 +..B1.5: + subl %esi, %eax + movl %eax, -4(%rsp) + jmp ..B1.11 +..B1.6: + movl %eax, -4(%rsp) + jmp ..B1.11 +..B1.8: + negl %ecx + movl $-1, %esi + addl $19, %ecx + shll %cl, %esi + movl %esi, %ecx + notl %ecx + movl -8(%rsp), %edx + andl %edx, %ecx + andl %esi, %edx + movl %edx, -8(%rsp) + testl $-2147483648, %eax + jne ..B1.11 +..B1.9: + testl %ecx, %ecx + je ..B1.11 +..B1.10: + movl -4(%rsp), %eax + shlq $32, %rax + movslq %esi, %rsi + orq %rdx, %rax + subq %rsi, %rax + movq %rax, -8(%rsp) +..B1.11: + movsd -8(%rsp), %xmm0 + ret +..B1.12: + testl $-2147483648, %edx + je ..B1.17 +..B1.13: + movl -8(%rsp), %edx + orl %edx, %edi + jne ..B1.15 +..B1.14: + movsd -8(%rsp), %xmm0 + ret +..B1.15: + lea _pone_nzero(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 +..B1.16: + ret +..B1.17: + movsd -8(%rsp), %xmm0 + cmpl $1073741824, %edx + jb ..B1.20 +..B1.19: + lea _ones(%rip), %rax + mulsd (%rax), %xmm0 +..B1.20: + ret + .align 16,0x90 + .cfi_endproc + .type ceil,@function + .size ceil,.-ceil + .data +# -- End ceil + .section .rodata, "a" + .align 4 + .align 4 +_pone_nzero: + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ceilf_gen.S b/external/sgx_libm/intel64/ceilf_gen.S new file mode 100644 index 0000000000..e513e9c8d8 --- /dev/null +++ b/external/sgx_libm/intel64/ceilf_gen.S @@ -0,0 +1,141 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ceilf_gen.c" + .text +..TXTST0: +# -- Begin ceilf + .text + .align 16,0x90 + .globl ceilf +ceilf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ceilf.1: +..L2: + + movaps %xmm0, %xmm2 + movss %xmm2, -16(%rsp) + movzwl -14(%rsp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $149, %eax + jge ..B1.8 +..B1.2: + cmpl $127, %eax + jl ..B1.4 +..B1.3: + movss .L_2il0floatpacket.0(%rip), %xmm1 + movaps %xmm1, %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, -24(%rsp) + movss -24(%rsp), %xmm3 + movss .L_2il0floatpacket.2(%rip), %xmm0 + subss %xmm1, %xmm3 + comiss %xmm3, %xmm2 + addss %xmm3, %xmm0 + ja ..L3 + movaps %xmm3, %xmm0 +..L3: + ret +..B1.4: + testl %eax, %eax + jne ..B1.7 +..B1.5: + testl $8388607, -16(%rsp) + jne ..B1.7 +..B1.6: + movss -16(%rsp), %xmm0 + ret +..B1.7: + movb -13(%rsp), %dl + lea _pone_nzero(%rip), %rcx + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + movl -16(%rsp), %eax + movl %eax, -24(%rsp) + movss (%rcx,%rsi,4), %xmm0 + ret +..B1.8: + cmpl $150, %eax + jge ..B1.6 +..B1.9: + movss -16(%rsp), %xmm1 + movss .L_2il0floatpacket.1(%rip), %xmm0 + testb $1, -16(%rsp) + addss %xmm1, %xmm0 + jne ..L4 + movaps %xmm1, %xmm0 +..L4: + ret + .align 16,0x90 + .cfi_endproc + .type ceilf,@function + .size ceilf,.-ceilf + .data +# -- End ceilf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4b400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x3f000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x3f800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +_pone_nzero: + .long 1065353216 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ceill.S b/external/sgx_libm/intel64/ceill.S new file mode 100644 index 0000000000..2de08c36ec --- /dev/null +++ b/external/sgx_libm/intel64/ceill.S @@ -0,0 +1,257 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ceill.c" + .text +..TXTST0: +# -- Begin ceill + .text + .align 16,0x90 + .globl ceill +ceill: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ceill.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %cl, %cl +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 56(%rsp), %eax + andl $32767, %eax + cmpl $16445, %eax + jge ..B1.20 +..B1.4: + cmpl $16383, %eax + jl ..B1.15 +..B1.5: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.7: + fldcw 24(%rsp) +..B1.8: + movb $1, %cl +..B1.9: + fldt 48(%rsp) + lea _TWO_63H(%rip), %rax + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 8(%rsp) + fldt 8(%rsp) + fcomip %st(1), %st + fstp %st(0) + jae ..B1.12 + jp ..B1.12 +..B1.10: + fldt 8(%rsp) + lea _ones(%rip), %rax + faddl (%rax) + fstpt 8(%rsp) +..B1.12: + testb %cl, %cl + je ..B1.14 +..B1.13: + fldcw 26(%rsp) +..B1.14: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.15: + testl %eax, %eax + jne ..B1.19 +..B1.16: + cmpq $0, 48(%rsp) + jne ..B1.18 +..B1.17: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.18: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rsp) +..B1.19: + movb 57(%rsp), %al + lea _pone_nzero(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.20: + cmpl $16446, %eax + jge ..B1.29 +..B1.21: + testb $1, 48(%rsp) + je ..B1.28 +..B1.22: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.35 +..B1.23: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.24: + fldcw 24(%rsp) +..B1.25: + fldt 48(%rsp) + lea _halfs(%rip), %rax + faddl (%rax) + fstpt 8(%rsp) +..B1.26: + fldcw 26(%rsp) +..B1.27: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.28: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.29: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.30: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.31: + fldcw 24(%rsp) +..B1.32: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) +..B1.33: + fldcw 26(%rsp) +..B1.34: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.35: + fldt 48(%rsp) + lea _halfs(%rip), %rax + faddl (%rax) + fstpt 8(%rsp) + jmp ..B1.27 +..B1.36: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) + jmp ..B1.34 + .align 16,0x90 + .cfi_endproc + .type ceill,@function + .size ceill,.-ceill + .data +# -- End ceill + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_pone_nzero: + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,16 + .align 4 +_halfs: + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type _halfs,@object + .size _halfs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cexp.S b/external/sgx_libm/intel64/cexp.S new file mode 100644 index 0000000000..136caab307 --- /dev/null +++ b/external/sgx_libm/intel64/cexp.S @@ -0,0 +1,2052 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cexp.c" + .text +..TXTST0: +# -- Begin cexp + .text + .align 16,0x90 + .globl cexp +cexp: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cexp.1: +..L2: + +..B1.2: + movq %rsp, %rax + subq $280, %rsp + .cfi_def_cfa_offset 288 + movq %rax, 184(%rsp) + movq %xmm0, 160(%rsp) + movq %xmm1, 168(%rsp) + movq %rbx, 192(%rsp) + movq 160(%rsp), %xmm0 + movq 168(%rsp), %xmm5 + movdqa %xmm0, %xmm7 + lea cexp_table(%rip), %r8 + movdqa (%r8), %xmm1 + shufps $85, %xmm5, %xmm7 + movdqa 16(%r8), %xmm2 + pand %xmm1, %xmm7 + pcmpgtd %xmm7, %xmm2 + movmskps %xmm2, %edx + cmpl $5, %edx + unpcklpd %xmm0, %xmm0 + jne .L_2TAG_PACKET_0.0.1 +.L_2TAG_PACKET_1.0.1: + movapd 32(%r8), %xmm1 + movapd 48(%r8), %xmm6 + movapd 64(%r8), %xmm2 + movapd 80(%r8), %xmm3 + mulpd %xmm0, %xmm1 + unpcklpd %xmm5, %xmm5 + addpd %xmm6, %xmm1 + movapd 96(%r8), %xmm7 + movd %xmm1, %edx + subpd %xmm6, %xmm1 + movq $63, %rax + mulpd %xmm5, %xmm7 + mulpd %xmm1, %xmm2 + movapd 112(%r8), %xmm4 + andq %rdx, %rax + mulpd %xmm1, %xmm3 + movapd 128(%r8), %xmm1 + subpd %xmm2, %xmm0 + cvtsd2si %xmm7, %ecx + lea (,%rax,8), %rax + subpd %xmm3, %xmm0 + addpd %xmm6, %xmm7 + movapd 4512(%r8,%rax,2), %xmm2 + mulpd %xmm0, %xmm4 + addl $1865216, %ecx + movapd %xmm0, %xmm3 + subpd %xmm6, %xmm7 + mulpd %xmm0, %xmm0 + movapd 144(%r8), %xmm6 + andq $63, %rcx + addpd %xmm4, %xmm1 + mulsd %xmm0, %xmm0 + movapd 160(%r8), %xmm4 + addsd %xmm2, %xmm3 + lea (,%rcx,8), %rcx + unpckhpd %xmm2, %xmm2 + mulpd %xmm1, %xmm0 + movapd %xmm5, %xmm1 + lea 416(%r8,%rcx,8), %rcx + addsd %xmm0, %xmm3 + mulpd %xmm7, %xmm4 + unpckhpd %xmm0, %xmm0 + mulpd %xmm7, %xmm6 + subpd %xmm4, %xmm5 + mulpd 176(%r8), %xmm7 + subpd %xmm4, %xmm1 + addsd %xmm3, %xmm0 + movapd 192(%r8), %xmm3 + unpcklpd %xmm0, %xmm0 + movapd %xmm1, %xmm4 + subpd %xmm6, %xmm1 + mulpd %xmm2, %xmm0 + mulpd %xmm5, %xmm3 + movapd %xmm2, (%rsp) + movapd %xmm0, 16(%rsp) + movapd 16(%rcx), %xmm0 + subpd %xmm6, %xmm5 + movapd 208(%r8), %xmm2 + subpd %xmm1, %xmm4 + mulpd %xmm5, %xmm3 + mulpd %xmm5, %xmm5 + subpd %xmm6, %xmm4 + mulpd %xmm1, %xmm0 + movapd (%rcx), %xmm6 + subpd %xmm4, %xmm7 + movapd 48(%rcx), %xmm4 + addpd %xmm4, %xmm6 + subpd %xmm6, %xmm0 + mulpd %xmm0, %xmm7 + movapd 16(%rcx), %xmm0 + mulpd %xmm1, %xmm6 + mulpd %xmm5, %xmm2 + mulpd %xmm1, %xmm4 + mulpd %xmm5, %xmm6 + mulpd %xmm5, %xmm0 + mulpd %xmm5, %xmm5 + addpd 224(%r8), %xmm3 + mulpd (%rcx), %xmm1 + addpd 240(%r8), %xmm2 + mulpd %xmm5, %xmm3 + movapd %xmm4, %xmm5 + addpd 16(%rcx), %xmm4 + addpd %xmm3, %xmm2 + movsd %xmm2, %xmm3 + unpckhpd %xmm2, %xmm2 + andl $-64, %edx + unpcklpd %xmm3, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm3, %xmm6 + movapd %xmm1, %xmm0 + addpd %xmm4, %xmm1 + movapd 16(%rcx), %xmm3 + subpd %xmm4, %xmm3 + subpd %xmm1, %xmm4 + addpd 32(%rcx), %xmm7 + addpd %xmm5, %xmm3 + movapd (%rsp), %xmm5 + addpd %xmm0, %xmm4 + addpd %xmm3, %xmm7 + movapd 16(%rsp), %xmm3 + movd %edx, %xmm0 + addpd %xmm4, %xmm7 + movapd %xmm1, %xmm4 + addpd %xmm6, %xmm7 + movapd 256(%r8), %xmm6 + pshufd $17, %xmm0, %xmm0 + addpd %xmm2, %xmm7 +.L_2TAG_PACKET_2.0.1: + movapd %xmm5, %xmm2 + addpd %xmm3, %xmm5 + addpd %xmm7, %xmm1 + andpd %xmm6, %xmm5 + andpd %xmm1, %xmm6 + pand 272(%r8), %xmm1 + subpd %xmm5, %xmm2 + subpd %xmm6, %xmm4 + addpd %xmm3, %xmm2 + movdqa 288(%r8), %xmm3 + addpd %xmm7, %xmm4 + por 304(%r8), %xmm6 + psubd %xmm1, %xmm3 + movapd 320(%r8), %xmm7 + psrld $14, %xmm1 + mulpd %xmm3, %xmm4 + paddd %xmm1, %xmm0 + paddd %xmm0, %xmm7 + movapd %xmm2, %xmm1 + pcmpgtd 320(%r8), %xmm7 + mulpd %xmm4, %xmm2 + movmskps %xmm7, %eax + cmpl $10, %eax + jne .L_2TAG_PACKET_3.0.1 + mulpd %xmm5, %xmm4 + pslld $14, %xmm0 + mulpd %xmm6, %xmm1 + addpd %xmm4, %xmm2 + mulpd %xmm5, %xmm6 + addpd %xmm1, %xmm2 + addpd %xmm6, %xmm2 + mulpd %xmm2, %xmm0 + movq %xmm0, %xmm1 + pshufd $14, %xmm0, %xmm0 + movq 192(%rsp), %rbx + movq 184(%rsp), %rsp + ret +.L_2TAG_PACKET_3.0.1: + psrad $6, %xmm0 + psubd 336(%r8), %xmm0 + pshufd $245, %xmm0, %xmm2 + psrad $32, %xmm0 + pand 400(%r8), %xmm0 + pand 384(%r8), %xmm2 + por %xmm2, %xmm0 + movdqa %xmm0, 64(%rsp) + movq %xmm5, 112(%rsp) + movq %xmm1, 120(%rsp) + movhpd %xmm6, 128(%rsp) + movhpd %xmm4, 136(%rsp) + movq %xmm6, 144(%rsp) + movq %xmm4, 152(%rsp) + movq 72(%rsp), %rdi + lea 128(%rsp), %rsi + lea 112(%rsp), %rdx + lea 96(%rsp), %rcx + call __libm_mul_k64@PLT + movq 64(%rsp), %rdi + lea 144(%rsp), %rsi + lea 112(%rsp), %rdx + lea 104(%rsp), %rcx + call __libm_mul_k64@PLT + movq 96(%rsp), %xmm0 + movq 104(%rsp), %xmm1 + movq 192(%rsp), %rbx + movq 184(%rsp), %rsp + ret +.L_2TAG_PACKET_0.0.1: + pextrw $1, %xmm7, %eax + testl $3, %edx + jne .L_2TAG_PACKET_4.0.1 + movapd 352(%r8), %xmm1 + cmpl $32752, %eax + jae .L_2TAG_PACKET_5.0.1 + cmpltpd %xmm0, %xmm1 + movmskpd %xmm1, %edx + cmpl $1, %edx + jne .L_2TAG_PACKET_5.0.1 + jmp .L_2TAG_PACKET_6.0.1 +.L_2TAG_PACKET_4.0.1: + testl $2, %edx + je .L_2TAG_PACKET_6.0.1 + xorpd %xmm0, %xmm0 +.L_2TAG_PACKET_6.0.1: + movdqa %xmm5, %xmm1 + testl $12, %edx + psllq $1, %xmm1 + je .L_2TAG_PACKET_5.0.1 + pxor %xmm2, %xmm2 + pextrw $3, %xmm5, %ecx + testl $8, %edx + pcmpeqd %xmm2, %xmm1 + je .L_2TAG_PACKET_1.0.1 + movmskps %xmm1, %eax + xorl %edx, %edx + movapd 368(%r8), %xmm6 + andl $3, %eax + movapd 304(%r8), %xmm4 + andl $32752, %ecx + cmpl $864, %ecx + jl .L_2TAG_PACKET_5.0.1 + testl $32752, %ecx + jne .L_2TAG_PACKET_7.0.1 + cmpl $3, %eax + je .L_2TAG_PACKET_5.0.1 + andpd %xmm5, %xmm6 + orpd %xmm4, %xmm5 + orpd %xmm4, %xmm6 + movl $-65408, %edx + subsd %xmm6, %xmm5 +.L_2TAG_PACKET_7.0.1: + movsd %xmm5, %xmm4 + movapd 32(%r8), %xmm3 + movapd 48(%r8), %xmm6 + movapd 64(%r8), %xmm5 + movapd 80(%r8), %xmm1 + mulpd %xmm0, %xmm3 + addpd %xmm6, %xmm3 + movd %xmm3, %ecx + subpd %xmm6, %xmm3 + movq $63, %rax + mulpd %xmm3, %xmm5 + movd %edx, %xmm6 + movapd 112(%r8), %xmm7 + andq %rcx, %rax + mulpd %xmm3, %xmm1 + movapd 128(%r8), %xmm3 + subpd %xmm5, %xmm0 + lea (,%rax,8), %rax + subpd %xmm1, %xmm0 + movapd 4512(%r8,%rax,2), %xmm5 + mulpd %xmm0, %xmm7 + movapd %xmm0, %xmm1 + mulpd %xmm0, %xmm0 + andl $-64, %ecx + addpd %xmm7, %xmm3 + pshufd $243, %xmm6, %xmm6 + mulsd %xmm0, %xmm0 + addsd %xmm5, %xmm1 + unpckhpd %xmm5, %xmm5 + mulpd %xmm0, %xmm3 + xorpd %xmm7, %xmm7 + addsd %xmm3, %xmm1 + movd %ecx, %xmm0 + unpckhpd %xmm3, %xmm3 + addsd %xmm1, %xmm3 + pshufd $17, %xmm0, %xmm0 + unpcklpd %xmm3, %xmm3 + paddd %xmm6, %xmm0 + mulpd %xmm5, %xmm3 + movapd 256(%r8), %xmm6 + movapd %xmm4, %xmm1 + jmp .L_2TAG_PACKET_2.0.1 +.L_2TAG_PACKET_5.0.1: + movq 160(%rsp), %xmm0 + movq 168(%rsp), %xmm1 + call __libm_internal_cexp + movq 192(%rsp), %rbx + movq 184(%rsp), %rsp + ret + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type cexp,@function + .size cexp,.-cexp + .data +# -- End cexp + .text +# -- Begin __libm_internal_cexp + .text + .align 16,0x90 +__libm_internal_cexp: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value___libm_internal_cexp.6: +..L7: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + movq %fs:40, %rax + subq $120, %rsp + .cfi_def_cfa_offset 144 + movsd %xmm0, 40(%rsp) + xorq %rsp, %rax + movzwl 46(%rsp), %ebp + andl $32752, %ebp + shrl $4, %ebp + movsd %xmm1, 48(%rsp) + cmpl $2047, %ebp + movq %rax, 112(%rsp) + jge ..B2.13 +..B2.2: + testl %ebp, %ebp + jle ..B2.41 +..B2.3: + movzwl 54(%rsp), %ebx + andl $32752, %ebx + shrl $4, %ebx + cmpl $2047, %ebx + jge ..B2.14 +..B2.4: + testl %ebx, %ebx + jle ..B2.39 +..B2.5: + cmpl $1034, %ebp + jl ..B2.8 +..B2.6: + movb 47(%rsp), %al + lea _CONSTANTS(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movq (%rdx,%rcx,8), %rbx + movq %rbx, 56(%rsp) + movsd 56(%rsp), %xmm0 + movsd 56(%rsp), %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, 56(%rsp) + movsd 56(%rsp), %xmm2 + movsd 48(%rsp), %xmm0 + movsd %xmm2, (%rsp) + call cos@PLT +..B2.51: + movsd (%rsp), %xmm1 + mulsd %xmm0, %xmm1 + movzwl 54(%rsp), %eax + testl $32752, %eax + movsd %xmm1, 24(%rsp) + jle ..B2.38 +..B2.7: + movsd 56(%rsp), %xmm0 + movsd %xmm0, (%rsp) + movsd 48(%rsp), %xmm0 + call sin@PLT +..B2.52: + movsd (%rsp), %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, 32(%rsp) + jmp ..B2.29 +..B2.8: + movsd 40(%rsp), %xmm0 + lea 16(%rsp), %rdi + lea 64(%rsp), %rsi +..___tag_value___libm_internal_cexp.13: + call __libm_exp_k64@PLT +..___tag_value___libm_internal_cexp.14: +..B2.9: + movsd 48(%rsp), %xmm0 + lea 96(%rsp), %rdi + lea 80(%rsp), %rsi +..___tag_value___libm_internal_cexp.15: + call __libm_sincos_k64@PLT +..___tag_value___libm_internal_cexp.16: +..B2.10: + movl 16(%rsp), %edi + lea 64(%rsp), %rsi + lea 80(%rsp), %rdx + lea (%rsp), %rcx +..___tag_value___libm_internal_cexp.17: + call __libm_mul_k64@PLT +..___tag_value___libm_internal_cexp.18: +..B2.11: + movq (%rsp), %rax + lea 64(%rsp), %rsi + movl -48(%rsi), %edi + lea 96(%rsp), %rdx + movq %rax, -72(%rdx) + lea 8(%rsp), %rcx +..___tag_value___libm_internal_cexp.19: + call __libm_mul_k64@PLT +..___tag_value___libm_internal_cexp.20: +..B2.12: + movq 8(%rsp), %rax + movq %rax, 32(%rsp) + jmp ..B2.29 +..B2.13: + movzwl 54(%rsp), %ebx + andl $32752, %ebx + shrl $4, %ebx +..B2.14: + testl %ebx, %ebx + jne ..B2.18 +..B2.15: + testl $1048575, 52(%rsp) + jne ..B2.18 +..B2.16: + cmpl $0, 48(%rsp) + jne ..B2.18 +..B2.17: + movsd 40(%rsp), %xmm0 + call exp@PLT +..B2.53: + movq 48(%rsp), %rax + movsd %xmm0, 24(%rsp) + movq %rax, 32(%rsp) + jmp ..B2.29 +..B2.18: + cmpl $2047, %ebx + jge ..B2.21 +..B2.19: + movsd 40(%rsp), %xmm0 + call exp@PLT +..B2.55: + movsd %xmm0, 8(%rsp) + movsd 48(%rsp), %xmm0 + movsd %xmm0, (%rsp) + call __libm_sse2_sincos@PLT +..B2.54: + mulsd 8(%rsp), %xmm1 + movaps %xmm0, %xmm2 + movsd %xmm1, 24(%rsp) + testl %ebx, %ebx + jle ..B2.44 +..B2.20: + movsd 8(%rsp), %xmm0 + mulsd %xmm2, %xmm0 + movsd %xmm0, 32(%rsp) + jmp ..B2.29 +..B2.21: + cmpl $2047, %ebp + jge ..B2.23 +..B2.22: + movsd 48(%rsp), %xmm0 + call sin@PLT +..B2.56: + movsd %xmm0, 24(%rsp) + movsd %xmm0, 32(%rsp) + jmp ..B2.29 +..B2.23: + testl $1048575, 44(%rsp) + jne ..B2.25 +..B2.24: + cmpl $0, 40(%rsp) + je ..B2.26 +..B2.25: + movsd 40(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd 48(%rsp), %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm0, 24(%rsp) + movsd %xmm1, 32(%rsp) + jmp ..B2.29 +..B2.26: + testb $-128, 47(%rsp) + je ..B2.28 +..B2.27: + movsd 48(%rsp), %xmm0 + lea zeros(%rip), %rax + mulsd %xmm0, %xmm0 + movq (%rax), %rdx + movsd %xmm0, 48(%rsp) + movq %rdx, 24(%rsp) + movq %rdx, 32(%rsp) + jmp ..B2.29 +..B2.28: + movsd 40(%rsp), %xmm0 + call exp@PLT +..B2.58: + movsd %xmm0, 24(%rsp) + movsd 48(%rsp), %xmm0 + call sin@PLT +..B2.57: + movsd %xmm0, 32(%rsp) +..B2.29: + movzwl 30(%rsp), %eax + testl $32752, %eax + jne ..B2.32 +..B2.30: + testl $1048575, 28(%rsp) + jne ..B2.35 +..B2.31: + cmpl $0, 24(%rsp) + jne ..B2.35 +..B2.32: + movzwl 38(%rsp), %eax + testl $32752, %eax + jne ..B2.36 +..B2.33: + testl $1048575, 36(%rsp) + jne ..B2.35 +..B2.34: + cmpl $0, 32(%rsp) + je ..B2.36 +..B2.35: + lea _DBL_MIN_NORMAL(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 56(%rsp) +..B2.36: + movq 112(%rsp), %rax + xorq %rsp, %rax + movsd 24(%rsp), %xmm0 + movsd 32(%rsp), %xmm1 + cmpq %fs:40, %rax + jne ..B2.48 +..B2.37: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B2.38: + movsd 56(%rsp), %xmm0 + mulsd 48(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + jmp ..B2.29 +..B2.39: + testl $1048575, 52(%rsp) + jne ..B2.5 +..B2.40: + cmpl $0, 48(%rsp) + jne ..B2.5 + jmp ..B2.14 +..B2.41: + testl $1048575, 44(%rsp) + jne ..B2.3 +..B2.42: + cmpl $0, 40(%rsp) + jne ..B2.3 + jmp ..B2.13 +..B2.44: + testl %ebp, %ebp + jne ..B2.47 +..B2.45: + testl $1048575, 44(%rsp) + jne ..B2.47 +..B2.46: + cmpl $0, 40(%rsp) + je ..B2.20 +..B2.47: + movsd (%rsp), %xmm0 + mulsd 8(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + jmp ..B2.29 +..B2.48: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __libm_internal_cexp,@function + .size __libm_internal_cexp,.-__libm_internal_cexp + .data +# -- End __libm_internal_cexp + .section .rodata, "a" + .align 16 + .align 16 +cexp_table: + .long 2147483647 + .long 2147483647 + .long 2147483647 + .long 2147483647 + .long 1082607888 + .long 810549248 + .long 1089863680 + .long 808452095 + .long 1697350398 + .long 1079448903 + .long 1697350398 + .long 1079448903 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 4277796864 + .long 1065758274 + .long 4277796864 + .long 1065758274 + .long 3164486458 + .long 1025308570 + .long 3164486458 + .long 1025308570 + .long 1841940611 + .long 1076125488 + .long 1841940611 + .long 1076125488 + .long 2983266533 + .long 1065422964 + .long 1432790106 + .long 1069897045 + .long 653061504 + .long 1067799895 + .long 4294959483 + .long 1071644671 + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .long 1413480448 + .long 1069097467 + .long 1413480448 + .long 1069097467 + .long 771977331 + .long 996350346 + .long 771977331 + .long 996350346 + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 0 + .long 2145386496 + .long 0 + .long 2145386496 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 2147352640 + .long 0 + .long 2147352640 + .long 0 + .long 1023 + .long 0 + .long 1023 + .long 3576508498 + .long 3230091536 + .long 565433817 + .long 1083619556 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 4294967295 + .long 0 + .long 4294967295 + .long 0 + .long 0 + .long 4294967295 + .long 0 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 3217031168 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 3220176896 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 1069547520 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 1071644672 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 1072693248 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 1069547520 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 235107661 + .long 1018002367 + .long 1048019040 + .long 1072704666 + .long 896005651 + .long 1015861842 + .long 3541402996 + .long 1072716208 + .long 1642514529 + .long 1012987726 + .long 410360776 + .long 1072727877 + .long 1568897900 + .long 1016568486 + .long 1828292879 + .long 1072739672 + .long 1882168529 + .long 1010744893 + .long 852742562 + .long 1072751596 + .long 509852888 + .long 1017336174 + .long 3490863952 + .long 1072763649 + .long 653277307 + .long 1017431380 + .long 2930322911 + .long 1072775834 + .long 1649557430 + .long 1017729363 + .long 1014845818 + .long 1072788152 + .long 1058231231 + .long 1015777676 + .long 3949972341 + .long 1072800603 + .long 1044000607 + .long 1016786167 + .long 828946858 + .long 1072813191 + .long 1151779725 + .long 1015705409 + .long 2288159958 + .long 1072825915 + .long 3819481236 + .long 1016499965 + .long 1853186616 + .long 1072838778 + .long 2552227826 + .long 1015039787 + .long 1709341917 + .long 1072851781 + .long 1829350193 + .long 1015216097 + .long 4112506593 + .long 1072864925 + .long 1913391795 + .long 1015756674 + .long 2799960843 + .long 1072878213 + .long 1303423926 + .long 1015238005 + .long 171030293 + .long 1072891646 + .long 1574172746 + .long 1016061241 + .long 2992903935 + .long 1072905224 + .long 3424156969 + .long 1017196428 + .long 926591434 + .long 1072918951 + .long 1938513547 + .long 1017631273 + .long 887463926 + .long 1072932827 + .long 2804567149 + .long 1015390024 + .long 1276261410 + .long 1072946854 + .long 631083525 + .long 1017690182 + .long 569847337 + .long 1072961034 + .long 1623370770 + .long 1011049453 + .long 1617004845 + .long 1072975368 + .long 3667985273 + .long 1013894369 + .long 3049340112 + .long 1072989858 + .long 3145379760 + .long 1014403278 + .long 3577096743 + .long 1073004506 + .long 2603100681 + .long 1017152460 + .long 1990012070 + .long 1073019314 + .long 3249202951 + .long 1017448880 + .long 1453150081 + .long 1073034283 + .long 419288974 + .long 1016280325 + .long 917841882 + .long 1073049415 + .long 3793507337 + .long 1016095713 + .long 3712504873 + .long 1073064711 + .long 728023093 + .long 1016345318 + .long 363667784 + .long 1073080175 + .long 2582678538 + .long 1017123460 + .long 2956612996 + .long 1073095806 + .long 7592966 + .long 1016721543 + .long 2186617380 + .long 1073111608 + .long 228611441 + .long 1016696141 + .long 1719614412 + .long 1073127582 + .long 2261665670 + .long 1017457593 + .long 1013258798 + .long 1073143730 + .long 544148907 + .long 1017323666 + .long 3907805043 + .long 1073160053 + .long 2383914918 + .long 1017143586 + .long 1447192520 + .long 1073176555 + .long 1176412038 + .long 1017267372 + .long 1944781190 + .long 1073193236 + .long 2882956373 + .long 1013312481 + .long 919555682 + .long 1073210099 + .long 3154077648 + .long 1016528543 + .long 2571947538 + .long 1073227145 + .long 348651999 + .long 1016405780 + .long 2604962540 + .long 1073244377 + .long 3253791412 + .long 1015920431 + .long 1110089947 + .long 1073261797 + .long 1509121860 + .long 1014756995 + .long 2568320822 + .long 1073279406 + .long 2617649212 + .long 1017340090 + .long 2966275556 + .long 1073297207 + .long 553214634 + .long 1016457425 + .long 2682146383 + .long 1073315202 + .long 730975783 + .long 1014083580 + .long 2191782032 + .long 1073333393 + .long 1486499517 + .long 1016818996 + .long 2069751140 + .long 1073351782 + .long 2595788928 + .long 1016407932 + .long 2990417244 + .long 1073370371 + .long 1853053619 + .long 1015310724 + .long 1434058175 + .long 1073389163 + .long 2462790535 + .long 1015814775 + .long 2572866477 + .long 1073408159 + .long 3693944214 + .long 1017259110 + .long 3092190714 + .long 1073427362 + .long 2979333550 + .long 1017188654 + .long 4076559942 + .long 1073446774 + .long 174054861 + .long 1014300631 + .long 2420883922 + .long 1073466398 + .long 816778419 + .long 1014197934 + .long 3716502172 + .long 1073486235 + .long 3507050924 + .long 1015341199 + .long 777507147 + .long 1073506289 + .long 1821514088 + .long 1013410604 + .long 3706687593 + .long 1073526560 + .long 920623539 + .long 1016295433 + .long 1242007931 + .long 1073547053 + .long 2789017511 + .long 1014276997 + .long 3707479175 + .long 1073567768 + .long 3586233004 + .long 1015962192 + .long 64696965 + .long 1073588710 + .long 474650514 + .long 1016642419 + .long 863738718 + .long 1073609879 + .long 1614448851 + .long 1014281732 + .long 3884662774 + .long 1073631278 + .long 2450082086 + .long 1016164135 + .long 2728693977 + .long 1073652911 + .long 1101668360 + .long 1015989180 + .long 3999357479 + .long 1073674779 + .long 835814894 + .long 1015702697 + .long 1533953344 + .long 1073696886 + .long 1301400989 + .long 1014466875 + .long 2174652632 + .long 1073719233 + .type cexp_table,@object + .size cexp_table,5536 + .align 16 +_CONSTANTS: + .long 0 + .long 2145386496 + .long 0 + .long 1048576 + .type _CONSTANTS,@object + .size _CONSTANTS,16 + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .align 8 +zeros: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .type zeros,@object + .size zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cexpf.S b/external/sgx_libm/intel64/cexpf.S new file mode 100644 index 0000000000..91d33bc631 --- /dev/null +++ b/external/sgx_libm/intel64/cexpf.S @@ -0,0 +1,1892 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cexpf.c" + .text +..TXTST0: +# -- Begin cexpf + .text + .align 16,0x90 + .globl cexpf +cexpf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cexpf.1: +..L2: + +..B1.2: + movq %rsp, %rax + subq $216, %rsp + .cfi_def_cfa_offset 224 + movq %rax, 120(%rsp) + movss %xmm0, 96(%rsp) + pshufd $1, %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + movq %rbx, 128(%rsp) + cvtss2sd 104(%rsp), %xmm0 + cvtss2sd 96(%rsp), %xmm7 + lea cexpf_table(%rip), %r8 + movl 104(%rsp), %ecx + andl $2147483647, %ecx + subl $1, %ecx + cmpl $1202716671, %ecx + movl 96(%rsp), %eax + jae .L_2TAG_PACKET_0.0.1 + movq %xmm7, 72(%rsp) + mulsd 5136(%r8), %xmm7 + andl $2147483647, %eax + unpcklpd %xmm0, %xmm0 + movapd 5280(%r8), %xmm1 + cmpl $1132462080, %eax + addsd 5120(%r8), %xmm7 + jg .L_2TAG_PACKET_1.0.1 + mulpd %xmm0, %xmm1 + cvtsd2si %xmm1, %edx + addpd 5296(%r8), %xmm1 + movapd 5312(%r8), %xmm3 + subpd 5296(%r8), %xmm1 + movd %xmm7, %ecx + movq %xmm7, %xmm4 + movapd 5328(%r8), %xmm2 + andq $127, %rcx + movq (%r8,%rcx,8), %xmm5 + mulpd %xmm1, %xmm3 + addl $1865216, %edx + andq $63, %rdx + lea 1024(%r8), %rax + shlq $6, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + paddd 5200(%r8), %xmm4 + subpd %xmm3, %xmm0 + psllq $45, %xmm4 + mulpd 5344(%r8), %xmm1 + pand 5216(%r8), %xmm4 + movapd %xmm0, %xmm3 + subpd %xmm2, %xmm0 + movapd 5248(%r8), %xmm6 + orpd %xmm5, %xmm4 + movapd 16(%rax), %xmm5 + subpd %xmm0, %xmm3 + movapd %xmm0, 48(%rsp) + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subpd %xmm3, %xmm1 + movq %xmm4, 64(%rsp) + subsd 5120(%r8), %xmm7 + movapd 48(%rax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm5 + mulpd %xmm5, %xmm1 + movapd 16(%rax), %xmm5 + mulpd 48(%rsp), %xmm2 + movq 72(%rsp), %xmm4 + mulsd 5152(%r8), %xmm7 + mulpd %xmm0, %xmm6 + mulpd 48(%rsp), %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm5 + subsd %xmm7, %xmm4 + movq 5168(%r8), %xmm7 + mulpd %xmm0, %xmm0 + movapd %xmm5, 16(%rsp) + movapd 5264(%r8), %xmm5 + mulsd %xmm4, %xmm7 + addpd 5232(%r8), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, 32(%rsp) + addpd 16(%rax), %xmm3 + addsd 5184(%r8), %xmm7 + addpd %xmm5, %xmm6 + movapd (%rax), %xmm0 + movsd %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulsd %xmm4, %xmm7 + mulpd 16(%rsp), %xmm6 + mulpd 48(%rsp), %xmm0 + mulpd %xmm5, %xmm2 + mulsd %xmm4, %xmm7 + movapd %xmm0, (%rsp) + addpd %xmm3, %xmm0 + movapd 16(%rax), %xmm5 + addsd %xmm4, %xmm7 + subpd %xmm3, %xmm5 + subpd %xmm0, %xmm3 + addpd 32(%rax), %xmm1 + mulsd 64(%rsp), %xmm7 + addpd 32(%rsp), %xmm5 + addpd (%rsp), %xmm3 + addpd %xmm5, %xmm1 + addpd %xmm3, %xmm1 + addsd 64(%rsp), %xmm7 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + addpd %xmm0, %xmm1 + movsd %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + mulsd %xmm7, %xmm0 + mulsd %xmm7, %xmm1 + cvtsd2ss %xmm0, %xmm0 + cvtsd2ss %xmm1, %xmm1 + movd %xmm0, %edx + movd %xmm1, %eax + movd %xmm0, %ecx + andl $2139095040, %ecx + je .L_2TAG_PACKET_2.0.1 + movd %xmm1, %ecx + andl $2139095040, %ecx + je .L_2TAG_PACKET_2.0.1 + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_2.0.1: + movss _FLT_MIN_NORMAL(%rip), %xmm0 + mulss %xmm0, %xmm0 + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_0.0.1: + cmpl $-1, %ecx + je .L_2TAG_PACKET_3.0.1 + cmpl $2139095039, %ecx + jg .L_2TAG_PACKET_4.0.1 + je .L_2TAG_PACKET_5.0.1 + cvtss2sd 104(%rsp), %xmm0 + lea 80(%rsp), %rdi + lea 88(%rsp), %rsi + call sincos@PLT + cvtss2sd 96(%rsp), %xmm0 + call exp@PLT + movq %xmm0, %xmm1 + mulsd 88(%rsp), %xmm0 + mulsd 80(%rsp), %xmm1 + cvtsd2ss %xmm0, %xmm0 + cvtsd2ss %xmm1, %xmm1 + movd %xmm0, %eax + movd %xmm1, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_5.0.1: + movl $2147483647, %ecx + movss 104(%rsp), %xmm1 + movss 96(%rsp), %xmm0 + andl %eax, %ecx + cmpl $2139095040, %ecx + jg .L_2TAG_PACKET_6.0.1 + je .L_2TAG_PACKET_7.0.1 + subss %xmm1, %xmm1 + movd %xmm1, %edx + movl %edx, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_7.0.1: + cmpl $2139095040, %eax + je .L_2TAG_PACKET_8.0.1 + movl $0, %eax + movl $0, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_8.0.1: + subss %xmm1, %xmm1 + movl $2139095040, %eax + movd %xmm1, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_6.0.1: + mulss %xmm0, %xmm0 + movd %xmm0, %eax + movl %eax, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_4.0.1: + movl $2147483647, %ecx + movss 104(%rsp), %xmm1 + andl %eax, %ecx + movss 96(%rsp), %xmm0 + cmpl $2139095040, %ecx + mulss %xmm1, %xmm1 + jg .L_2TAG_PACKET_9.0.1 + je .L_2TAG_PACKET_10.0.1 + movd %xmm1, %eax + movl %eax, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_10.0.1: + cmpl $2139095040, %eax + je .L_2TAG_PACKET_11.0.1 + movl $0, %eax + movl $0, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_11.0.1: + movl $2139095040, %eax + movd %xmm1, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_9.0.1: + mulss %xmm0, %xmm0 + movd %xmm0, %eax + movd %xmm1, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_3.0.1: + movl $2147483647, %ecx + andl %eax, %ecx + je .L_2TAG_PACKET_12.0.1 + cmpl $2139095040, %ecx + jg .L_2TAG_PACKET_13.0.1 + je .L_2TAG_PACKET_14.0.1 + cmpl $1124073472, %ecx + jg .L_2TAG_PACKET_15.0.1 + movq %xmm7, %xmm0 + mulsd 5136(%r8), %xmm7 + addsd 5120(%r8), %xmm7 + movd %xmm7, %ecx + movq %xmm7, %xmm4 + andq $127, %rcx + movq (%r8,%rcx,8), %xmm5 + paddd 5200(%r8), %xmm4 + subsd 5120(%r8), %xmm7 + mulsd 5152(%r8), %xmm7 + subsd %xmm7, %xmm0 + movq 5168(%r8), %xmm7 + mulsd %xmm0, %xmm7 + addsd 5184(%r8), %xmm7 + psllq $45, %xmm4 + mulsd %xmm0, %xmm7 + pand 5216(%r8), %xmm4 + mulsd %xmm0, %xmm7 + orpd %xmm5, %xmm4 + addsd %xmm0, %xmm7 + mulsd %xmm4, %xmm7 + addsd %xmm4, %xmm7 + cvtsd2ss %xmm7, %xmm7 + movd %xmm7, %eax + movl 104(%rsp), %edx + andl $-2147483648, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_12.0.1: + movl 104(%rsp), %edx + movl $1065353216, %eax + andl $-2147483648, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_15.0.1: + movl $2139095039, %ecx + testl $-2147483648, %eax + movl $8388608, %eax + cmovz %ecx, %eax + movl 104(%rsp), %edx + andl $2147483647, %eax + andl $-2147483648, %edx + movd %eax, %xmm0 + mulss %xmm0, %xmm0 + movd %xmm0, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_14.0.1: + movl $2139095040, %ecx + andl $-2147483648, %eax + movl 104(%rsp), %edx + cmovz %ecx, %eax + andl $-2147483648, %edx + andl $2147483647, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_13.0.1: + movss 96(%rsp), %xmm0 + movl 104(%rsp), %edx + addss %xmm0, %xmm0 + movd %xmm0, %eax + andl $-2147483648, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_1.0.1: + cmpl $2139095040, %eax + movl 96(%rsp), %ecx + jg .L_2TAG_PACKET_16.0.1 + movl $8388608, %eax + movl $2139095039, %edx + testl $-2147483648, %ecx + cmovz %edx, %eax + movl $0, %edx + cmpl $-8388608, %ecx + cmove %edx, %eax + cmpl $2139095040, %ecx + cmove %ecx, %eax + movd %eax, %xmm7 + mulss %xmm7, %xmm7 + mulpd %xmm0, %xmm1 + cvtsd2si %xmm1, %edx + addpd 5296(%r8), %xmm1 + movapd 5312(%r8), %xmm3 + subpd 5296(%r8), %xmm1 + movapd 5328(%r8), %xmm2 + mulpd %xmm1, %xmm3 + addl $1865216, %edx + andq $63, %rdx + lea 1024(%r8), %rax + shlq $6, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subpd %xmm3, %xmm0 + mulpd 5344(%r8), %xmm1 + movapd %xmm0, %xmm3 + subpd %xmm2, %xmm0 + movapd 5248(%r8), %xmm6 + movapd 16(%rax), %xmm5 + subpd %xmm0, %xmm3 + movapd %xmm0, 48(%rsp) + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subpd %xmm3, %xmm1 + movapd 48(%rax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm5 + mulpd %xmm5, %xmm1 + movapd 16(%rax), %xmm5 + mulpd 48(%rsp), %xmm2 + mulpd %xmm0, %xmm6 + mulpd 48(%rsp), %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + movapd %xmm5, 16(%rsp) + movapd 5264(%r8), %xmm5 + addpd 5232(%r8), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, 32(%rsp) + addpd 16(%rax), %xmm3 + addpd %xmm5, %xmm6 + movapd (%rax), %xmm0 + movsd %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulpd 16(%rsp), %xmm6 + mulpd 48(%rsp), %xmm0 + mulpd %xmm5, %xmm2 + movapd %xmm0, (%rsp) + addpd %xmm3, %xmm0 + movapd 16(%rax), %xmm5 + subpd %xmm3, %xmm5 + subpd %xmm0, %xmm3 + addpd 32(%rax), %xmm1 + addpd 32(%rsp), %xmm5 + addpd (%rsp), %xmm3 + addpd %xmm5, %xmm1 + addpd %xmm3, %xmm1 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + addpd %xmm0, %xmm1 + movsd %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + cvtsd2ss %xmm0, %xmm0 + cvtsd2ss %xmm1, %xmm1 + mulss %xmm7, %xmm0 + mulss %xmm7, %xmm1 + movd %xmm0, %edx + movd %xmm1, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret +.L_2TAG_PACKET_16.0.1: + movss 96(%rsp), %xmm0 + mulss %xmm0, %xmm0 + movd %xmm0, %eax + movl %eax, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 128(%rsp), %rbx + movq 120(%rsp), %rsp + ret + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type cexpf,@function + .size cexpf,.-cexpf + .data +# -- End cexpf + .section .rodata, "a" + .align 16 + .align 16 +cexpf_table: + .long 0 + .long 0 + .long 2851812149 + .long 5693 + .long 1048019041 + .long 11418 + .long 3899555717 + .long 17173 + .long 3541402996 + .long 22960 + .long 702412510 + .long 28779 + .long 410360776 + .long 34629 + .long 3402036099 + .long 40510 + .long 1828292879 + .long 46424 + .long 728909815 + .long 52370 + .long 852742562 + .long 58348 + .long 2952712987 + .long 64358 + .long 3490863953 + .long 70401 + .long 3228316108 + .long 76477 + .long 2930322912 + .long 82586 + .long 3366293073 + .long 88728 + .long 1014845819 + .long 94904 + .long 948735466 + .long 101113 + .long 3949972341 + .long 107355 + .long 2214878420 + .long 113632 + .long 828946858 + .long 119943 + .long 586995997 + .long 126288 + .long 2288159958 + .long 132667 + .long 2440944790 + .long 139081 + .long 1853186616 + .long 145530 + .long 1337108031 + .long 152014 + .long 1709341917 + .long 158533 + .long 3790955393 + .long 165087 + .long 4112506593 + .long 171677 + .long 3504003472 + .long 178303 + .long 2799960843 + .long 184965 + .long 2839424854 + .long 191663 + .long 171030293 + .long 198398 + .long 4232894513 + .long 205168 + .long 2992903935 + .long 211976 + .long 1603444721 + .long 218821 + .long 926591435 + .long 225703 + .long 1829099622 + .long 232622 + .long 887463927 + .long 239579 + .long 3272845541 + .long 246573 + .long 1276261410 + .long 253606 + .long 78413852 + .long 260677 + .long 569847338 + .long 267786 + .long 3645941911 + .long 274933 + .long 1617004845 + .long 282120 + .long 3978100823 + .long 289345 + .long 3049340112 + .long 296610 + .long 4040676318 + .long 303914 + .long 3577096743 + .long 311258 + .long 2583551245 + .long 318642 + .long 1990012071 + .long 326066 + .long 2731501122 + .long 333530 + .long 1453150082 + .long 341035 + .long 3395129871 + .long 348580 + .long 917841882 + .long 356167 + .long 3566716925 + .long 363794 + .long 3712504873 + .long 371463 + .long 2321106615 + .long 379174 + .long 363667784 + .long 386927 + .long 3111574537 + .long 394721 + .long 2956612997 + .long 402558 + .long 885834528 + .long 410438 + .long 2186617381 + .long 418360 + .long 3561793907 + .long 426325 + .long 1719614413 + .long 434334 + .long 1963711167 + .long 442386 + .long 1013258799 + .long 450482 + .long 4182873220 + .long 458621 + .long 3907805044 + .long 466805 + .long 1218806132 + .long 475034 + .long 1447192521 + .long 483307 + .long 1339972927 + .long 491625 + .long 1944781191 + .long 499988 + .long 19972402 + .long 508397 + .long 919555682 + .long 516851 + .long 1413356050 + .long 525351 + .long 2571947539 + .long 533897 + .long 1176749997 + .long 542490 + .long 2604962541 + .long 551129 + .long 3649726105 + .long 559815 + .long 1110089947 + .long 568549 + .long 380978316 + .long 577330 + .long 2568320822 + .long 586158 + .long 194117574 + .long 595035 + .long 2966275557 + .long 603959 + .long 3418903055 + .long 612932 + .long 2682146384 + .long 621954 + .long 1892288442 + .long 631025 + .long 2191782032 + .long 640145 + .long 434316067 + .long 649315 + .long 2069751141 + .long 658534 + .long 3964284211 + .long 667803 + .long 2990417245 + .long 677123 + .long 321958744 + .long 686494 + .long 1434058175 + .long 695915 + .long 3218338682 + .long 705387 + .long 2572866477 + .long 714911 + .long 697153126 + .long 724487 + .long 3092190715 + .long 734114 + .long 2380618042 + .long 743794 + .long 4076559943 + .long 753526 + .long 815859274 + .long 763312 + .long 2420883922 + .long 773150 + .long 1540824585 + .long 783042 + .long 3716502172 + .long 792987 + .long 1610600570 + .long 802987 + .long 777507147 + .long 813041 + .long 2483480501 + .long 823149 + .long 3706687593 + .long 833312 + .long 1432208378 + .long 843531 + .long 1242007932 + .long 853805 + .long 135105010 + .long 864135 + .long 3707479175 + .long 874520 + .long 382305176 + .long 884963 + .long 64696965 + .long 895462 + .long 4076975200 + .long 906017 + .long 863738719 + .long 916631 + .long 351641897 + .long 927302 + .long 3884662774 + .long 938030 + .long 4224142467 + .long 948817 + .long 2728693978 + .long 959663 + .long 764307441 + .long 970568 + .long 3999357479 + .long 981531 + .long 929806999 + .long 992555 + .long 1533953344 + .long 1003638 + .long 2912730644 + .long 1014781 + .long 2174652632 + .long 1025985 + .long 730821105 + .long 1037250 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 3217031168 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 3220176896 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 1069547520 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 1071644672 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 1072693248 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 1069547520 + .long 0 + .long 1127743488 + .long 0 + .long 0 + .long 1697350398 + .long 1080497479 + .long 0 + .long 0 + .long 4277811695 + .long 1064709698 + .long 0 + .long 0 + .long 3082479990 + .long 1069897045 + .long 0 + .long 0 + .long 4294966960 + .long 1071644671 + .long 0 + .long 0 + .long 130944 + .long 0 + .long 130944 + .long 0 + .long 0 + .long 2146435072 + .long 0 + .long 2146435072 + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .long 1841940611 + .long 1076125488 + .long 1841940611 + .long 1076125488 + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .long 1413480448 + .long 1069097467 + .long 1413480448 + .long 1069097467 + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .long 771977331 + .long 996350346 + .long 771977331 + .long 996350346 + .type cexpf_table,@object + .size cexpf_table,5360 + .align 16 +_FLT_MIN_NORMAL: + .long 8388608 + .long 8388608 + .type _FLT_MIN_NORMAL,@object + .size _FLT_MIN_NORMAL,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cexpl.S b/external/sgx_libm/intel64/cexpl.S new file mode 100644 index 0000000000..c27329832d --- /dev/null +++ b/external/sgx_libm/intel64/cexpl.S @@ -0,0 +1,649 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cexpl.c" + .text +..TXTST0: +# -- Begin cexpl + .text + .align 16,0x90 + .globl cexpl +cexpl: +# parameter 1: 320 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cexpl.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + subq $288, %rsp + .cfi_def_cfa_offset 320 + xorb %r15b, %r15b + fldt .L_2il0floatpacket.7(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 272(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 240(%rsp) + fldt 240(%rsp) + fstpt 256(%rsp) +..B1.2: + fnstcw 98(%rsp) +..B1.3: + movzwl 98(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 96(%rsp) +..B1.5: + fldcw 96(%rsp) +..B1.6: + movb $1, %r15b +..B1.7: + movzwl 328(%rsp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.31 +..B1.8: + testl %edx, %edx + jle ..B1.54 +..B1.9: + movzwl 344(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.31 +..B1.10: + testl %eax, %eax + jle ..B1.52 +..B1.11: + fldt 320(%rsp) + lea 176(%rsp), %rdi + fstpt 32(%rdi) + lea 208(%rsp), %rsi + fldt -128(%rsi) + fstpt 16(%rsi) +..___tag_value_cexpl.10: + call __libm_expl_k80@PLT +..___tag_value_cexpl.11: +..B1.62: + fstpt 64(%rsp) +..B1.12: + movzwl 184(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.51 +..B1.13: + testl %eax, %eax + je ..B1.22 +..B1.14: + fldt 64(%rsp) + lea 48+_CONSTANTS(%rip), %rax + fldt 176(%rsp) + fldt 192(%rsp) + fldt .L_2il0floatpacket.8(%rip) + fldt (%rax) + faddp %st, %st(4) + fxch %st(3) + fstpt (%rsp) + fld %st(1) + movl (%rsp), %r14d + fadd %st(1), %st + fld %st(0) + fmulp %st, %st(4) + fld %st(3) + fsub %st(1), %st + fsubrp %st, %st(4) + fxch %st(3) + fstpt 32(%rsp) + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fxch %st(2) + fsubr %st(3), %st + fsubrp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 352(%rsp) + fstpt (%rsp) + lea 160(%rsp), %rdi + fstpt -96(%rdi) +..___tag_value_cexpl.13: + call __libm_cosl_k80@PLT +..___tag_value_cexpl.14: +..B1.63: + fldt 64(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 320 +..B1.15: + fldt 144(%rsp) + lea 16+_CONSTANTS(%rip), %rax + fld %st(0) + fldt 160(%rsp) + movzwl 344(%rsp), %edx + fadd %st, %st(1) + andl $32767, %edx + fxch %st(1) + fsub %st, %st(2) + cmpl $16183, %edx + fxch %st(2) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.8(%rip) + fldt (%rax) + fxch %st(1) + fmul %st(3), %st + fld %st(0) + fsub %st(4), %st + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(3) + jge ..B1.17 +..B1.16: + fldt 336(%rsp) + lea 32+_CONSTANTS(%rip), %rbx + fldt 80(%rsp) + fstpt 128(%rsp) + fldt (%rbx) + fmulp %st, %st(1) + fstpt 112(%rsp) + movzwl 120(%rsp), %eax + movl %eax, %ebx + andl $-32768, %eax + andl $32767, %ebx + orl $-49153, %eax + addl $-16639, %ebx + movw %ax, 120(%rsp) + fldt 112(%rsp) + jmp ..B1.19 +..B1.17: + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + lea 128(%rsp), %rdi + fstpt (%rsp) + fxch %st(2) + fstpt 16(%rsp) + fxch %st(1) + fstpt -96(%rdi) + fstpt -64(%rdi) +..___tag_value_cexpl.17: + call __libm_sinl_k80@PLT +..___tag_value_cexpl.18: +..B1.64: + fldt 64(%rsp) + fldt 32(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 320 +..B1.18: + fldt 112(%rsp) + xorl %ebx, %ebx + fmul %st(4), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fldt 128(%rsp) + fmulp %st, %st(5) + fxch %st(4) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 128(%rsp) + fxch %st(3) +..B1.19: + fldt 80(%rsp) + fld %st(1) + movl %r14d, %edi + fadd %st(1), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fldt 32(%rsp) + fldt .L_2il0floatpacket.8(%rip) + addq $-32, %rsp + .cfi_def_cfa_offset 352 + fmul %st(3), %st + fld %st(0) + fsub %st(4), %st + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(4) + fmul %st(6), %st + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fxch %st(3) + fmul %st, %st(5) + fxch %st(5) + fstpt (%rsp) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + fstpt 80(%rsp) +..___tag_value_cexpl.21: + call __libm_scalbl_k80@PLT +..___tag_value_cexpl.22: +..B1.65: + fldt 80(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 320 +..B1.20: + fxch %st(3) + fstpt 240(%rsp) + fld %st(1) + fmul %st(3), %st + addl %ebx, %r14d + fxch %st(1) + fmul %st, %st(2) + fldt 32(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 352 + fld %st(0) + movl %r14d, %edi + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_cexpl.25: + call __libm_scalbl_k80@PLT +..___tag_value_cexpl.26: +..B1.66: + addq $32, %rsp + .cfi_def_cfa_offset 320 +..B1.21: + fstpt 256(%rsp) + jmp ..B1.44 +..B1.22: + lea 16+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) +..B1.23: + fldt 16(%rsp) + fstpt 176(%rsp) + fldt 336(%rsp) + fstpt (%rsp) + fldt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fstpt (%rsp) + call cosl@PLT +..B1.67: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fldt 16(%rsp) + fmulp %st, %st(1) + movzwl 344(%rsp), %eax + testl $32767, %eax + fstpt 240(%rsp) + jle ..B1.25 +..B1.24: + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 16(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.68: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fldt 16(%rsp) + fmulp %st, %st(1) + fstpt 256(%rsp) + jmp ..B1.26 +..B1.25: + fldt (%rsp) + fldt 16(%rsp) + fmulp %st, %st(1) + fstpt 256(%rsp) +..B1.26: + testb %r15b, %r15b + je ..B1.28 +..B1.27: + fldt 64(%rsp) + fstpt (%rsp) +..B1.69: + fldcw 98(%rsp) +..B1.28: + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.50 +..B1.29: + fldt 240(%rsp) + fldt 256(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.49 +..B1.30: + addq $288, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 320 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.31: + cmpq $0, 336(%rsp) + jne ..B1.33 +..B1.32: + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 336(%rsp) + fstpt (%rsp) + call expl@PLT +..B1.70: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fldt 336(%rsp) + fstpt 256(%rsp) + fstpt 240(%rsp) + jmp ..B1.44 +..B1.33: + movzwl 344(%rsp), %ebx + andl $32767, %ebx + cmpl $32767, %ebx + jge ..B1.36 +..B1.34: + fldt 320(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fstpt (%rsp) + call expl@PLT +..B1.72: + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 320 + fldt 336(%rsp) + fstpt (%rsp) + fldt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fstpt (%rsp) + call cosl@PLT +..B1.71: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fldt 16(%rsp) + testl %ebx, %ebx + fmulp %st, %st(1) + fstpt 240(%rsp) + jle ..B1.56 +..B1.35: + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 16(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.73: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fldt 16(%rsp) + fmulp %st, %st(1) + fstpt 256(%rsp) + jmp ..B1.44 +..B1.36: + cmpl $32767, %edx + jge ..B1.38 +..B1.37: + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.74: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fstpt 240(%rsp) + fldt 240(%rsp) + fstpt 256(%rsp) + jmp ..B1.44 +..B1.38: + cmpl $-2147483648, 324(%rsp) + jne ..B1.40 +..B1.39: + cmpl $0, 320(%rsp) + je ..B1.41 +..B1.40: + fldt 320(%rsp) + fmul %st(0), %st + fstpt 240(%rsp) + fldt 240(%rsp) + fldt 336(%rsp) + fmulp %st, %st(1) + fstpt 256(%rsp) + jmp ..B1.44 +..B1.41: + testb $-128, 329(%rsp) + je ..B1.43 +..B1.42: + fldt 336(%rsp) + fmul %st(0), %st + fstpt 336(%rsp) + fldt 80(%rsp) + fstpt 240(%rsp) + fldt 240(%rsp) + fstpt 256(%rsp) + jmp ..B1.44 +..B1.43: + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 336(%rsp) + fstpt (%rsp) + call expl@PLT +..B1.76: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fstpt 240(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.75: + addq $16, %rsp + .cfi_def_cfa_offset 320 + fstpt 256(%rsp) +..B1.44: + testb %r15b, %r15b + je ..B1.46 +..B1.45: + fldcw 98(%rsp) +..B1.46: + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.50 +..B1.47: + fldt 240(%rsp) + fldt 256(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.49 +..B1.48: + addq $288, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 320 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.49: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.50: + call __stack_chk_fail@PLT +..B1.51: + lea _CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) + jmp ..B1.23 +..B1.52: + cmpl $0, 340(%rsp) + jne ..B1.11 +..B1.53: + cmpl $0, 336(%rsp) + jne ..B1.11 + jmp ..B1.31 +..B1.54: + cmpl $0, 324(%rsp) + jne ..B1.9 +..B1.55: + cmpl $0, 320(%rsp) + jne ..B1.9 + jmp ..B1.31 +..B1.56: + cmpq $0, 320(%rsp) + je ..B1.35 +..B1.57: + fldt (%rsp) + fldt 16(%rsp) + fmulp %st, %st(1) + fstpt 256(%rsp) + jmp ..B1.44 + .align 16,0x90 + .cfi_endproc + .type cexpl,@function + .size cexpl,.-cexpl + .data +# -- End cexpl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,64 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cimag.S b/external/sgx_libm/intel64/cimag.S new file mode 100644 index 0000000000..ba2d45e4e8 --- /dev/null +++ b/external/sgx_libm/intel64/cimag.S @@ -0,0 +1,65 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cimag.c" + .text +..TXTST0: +# -- Begin cimag + .text + .align 16,0x90 + .globl cimag +cimag: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cimag.1: +..L2: + + movaps %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type cimag,@function + .size cimag,.-cimag + .data +# -- End cimag + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cimagf.S b/external/sgx_libm/intel64/cimagf.S new file mode 100644 index 0000000000..ea0a8cb710 --- /dev/null +++ b/external/sgx_libm/intel64/cimagf.S @@ -0,0 +1,66 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cimagf.c" + .text +..TXTST0: +# -- Begin cimagf + .text + .align 16,0x90 + .globl cimagf +cimagf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cimagf.1: +..L2: + + movsd %xmm0, -8(%rsp) + movss -4(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type cimagf,@function + .size cimagf,.-cimagf + .data +# -- End cimagf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cimagl.S b/external/sgx_libm/intel64/cimagl.S new file mode 100644 index 0000000000..9a42707a5b --- /dev/null +++ b/external/sgx_libm/intel64/cimagl.S @@ -0,0 +1,65 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cimagl.c" + .text +..TXTST0: +# -- Begin cimagl + .text + .align 16,0x90 + .globl cimagl +cimagl: +# parameter 1: 8 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cimagl.1: +..L2: + + fldt 24(%rsp) + ret + .align 16,0x90 + .cfi_endproc + .type cimagl,@function + .size cimagl,.-cimagl + .data +# -- End cimagl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/clog.S b/external/sgx_libm/intel64/clog.S new file mode 100644 index 0000000000..6d06c0a0c6 --- /dev/null +++ b/external/sgx_libm/intel64/clog.S @@ -0,0 +1,615 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clog.c" + .text +..TXTST0: +# -- Begin clog + .text + .align 16,0x90 + .globl clog +clog: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_clog.1: +..L2: + + movq %fs:40, %rax + subq $120, %rsp + .cfi_def_cfa_offset 128 + movsd %xmm0, 40(%rsp) + xorq %rsp, %rax + movsd %xmm1, 48(%rsp) + movzwl 46(%rsp), %edx + andl $32752, %edx + movq %rax, 104(%rsp) + movzwl 54(%rsp), %eax + andl $32752, %eax + shrl $4, %edx + shrl $4, %eax + cmpl $2047, %edx + jge ..B1.26 +..B1.2: + cmpl $2047, %eax + jge ..B1.62 +..B1.3: + movsd 40(%rsp), %xmm14 + movaps %xmm14, %xmm7 + pxor %xmm2, %xmm2 + movsd 48(%rsp), %xmm1 + andps .L_2il0floatpacket.10(%rip), %xmm7 + movaps %xmm1, %xmm6 + andps .L_2il0floatpacket.10(%rip), %xmm6 + ucomisd %xmm2, %xmm7 + jp ..B1.4 + je ..B1.40 +..B1.4: + comisd %xmm7, %xmm6 + jbe ..B1.6 +..B1.5: + movaps %xmm7, %xmm2 + movsd %xmm7, 32(%rsp) + movaps %xmm6, %xmm7 + movsd %xmm6, (%rsp) + movaps %xmm2, %xmm6 + movsd %xmm2, 8(%rsp) + jmp ..B1.7 +..B1.6: + movsd %xmm6, 8(%rsp) + movsd %xmm7, (%rsp) +..B1.7: + lea 8+_CONSTANTS(%rip), %rax + comisd (%rax), %xmm7 + jb ..B1.19 +..B1.8: + lea 16+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm2 + comisd %xmm7, %xmm2 + jb ..B1.19 +..B1.9: + lea 40+_CONSTANTS(%rip), %rdx + lea _CONSTANTS(%rip), %rax + movaps %xmm7, %xmm5 + mulsd %xmm7, %xmm5 + comisd (%rdx), %xmm6 + movsd .L_2il0floatpacket.11(%rip), %xmm2 + movsd (%rax), %xmm4 + jbe ..B1.12 +..B1.10: + movaps %xmm6, %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm3, %xmm5 + subsd %xmm2, %xmm5 + andps .L_2il0floatpacket.10(%rip), %xmm5 + comisd %xmm5, %xmm4 + ja ..B1.13 + jmp ..B1.18 +..B1.12: + subsd %xmm2, %xmm5 + andps .L_2il0floatpacket.10(%rip), %xmm5 + comisd %xmm5, %xmm4 + jbe ..B1.18 +..B1.13: + movzwl 14(%rsp), %eax + andl $32752, %eax + cmpl $14608, %eax + jl ..B1.15 +..B1.14: + movsd .L_2il0floatpacket.8(%rip), %xmm13 + lea 56+_Q1(%rip), %rax + movsd .L_2il0floatpacket.8(%rip), %xmm10 + lea 48+_Q1(%rip), %rdx + movsd (%rsp), %xmm11 + lea 40+_Q1(%rip), %rcx + movsd .L_2il0floatpacket.9(%rip), %xmm4 + lea 32+_Q1(%rip), %rsi + movsd (%rax), %xmm6 + lea 24+_Q1(%rip), %rdi + lea 16+_Q1(%rip), %r8 + lea 8+_Q1(%rip), %r9 + lea _Q1(%rip), %r10 + mulsd %xmm7, %xmm13 + movaps %xmm13, %xmm15 + subsd %xmm7, %xmm15 + movsd %xmm15, 16(%rsp) + movsd 16(%rsp), %xmm12 + subsd %xmm12, %xmm13 + movsd 8(%rsp), %xmm12 + mulsd %xmm12, %xmm10 + subsd %xmm13, %xmm11 + movaps %xmm10, %xmm9 + movaps %xmm13, %xmm5 + mulsd %xmm13, %xmm5 + subsd %xmm12, %xmm9 + mulsd %xmm4, %xmm13 + movsd %xmm9, 16(%rsp) + movaps %xmm5, %xmm7 + movsd 16(%rsp), %xmm9 + mulsd %xmm11, %xmm13 + subsd %xmm9, %xmm10 + mulsd %xmm11, %xmm11 + subsd %xmm10, %xmm12 + movaps %xmm10, %xmm9 + mulsd %xmm10, %xmm9 + mulsd %xmm4, %xmm10 + addsd %xmm9, %xmm7 + mulsd %xmm12, %xmm10 + mulsd %xmm12, %xmm12 + movaps %xmm7, %xmm4 + subsd %xmm2, %xmm7 + subsd %xmm5, %xmm4 + movsd %xmm4, 16(%rsp) + movaps %xmm7, %xmm8 + movsd 16(%rsp), %xmm4 + subsd %xmm4, %xmm9 + addsd %xmm9, %xmm8 + movaps %xmm8, %xmm4 + movaps %xmm8, %xmm2 + movaps %xmm8, %xmm5 + subsd %xmm7, %xmm4 + addsd %xmm13, %xmm2 + movsd %xmm4, 16(%rsp) + movaps %xmm2, %xmm3 + movsd 16(%rsp), %xmm4 + movaps %xmm2, %xmm15 + subsd %xmm4, %xmm5 + addsd %xmm10, %xmm3 + subsd %xmm8, %xmm15 + movsd %xmm5, 24(%rsp) + subsd %xmm15, %xmm13 + movsd 16(%rsp), %xmm4 + subsd %xmm4, %xmm9 + movsd 24(%rsp), %xmm4 + subsd %xmm4, %xmm7 + movaps %xmm3, %xmm4 + addsd %xmm7, %xmm9 + addsd %xmm11, %xmm4 + movaps %xmm4, %xmm5 + addsd %xmm12, %xmm5 + mulsd %xmm5, %xmm6 + movaps %xmm5, %xmm7 + mulsd %xmm5, %xmm7 + addsd (%rdx), %xmm6 + mulsd %xmm5, %xmm6 + addsd (%rcx), %xmm6 + mulsd %xmm5, %xmm6 + addsd (%rsi), %xmm6 + mulsd %xmm5, %xmm6 + addsd (%rdi), %xmm6 + mulsd %xmm5, %xmm6 + addsd (%r8), %xmm6 + mulsd %xmm5, %xmm6 + addsd (%r9), %xmm6 + mulsd %xmm5, %xmm6 + addsd (%r10), %xmm6 + mulsd %xmm7, %xmm6 + movaps %xmm2, %xmm7 + subsd %xmm15, %xmm7 + movsd %xmm7, 16(%rsp) + movsd 16(%rsp), %xmm7 + subsd %xmm7, %xmm8 + movaps %xmm3, %xmm7 + addsd %xmm8, %xmm13 + movaps %xmm3, %xmm8 + subsd %xmm2, %xmm8 + addsd %xmm13, %xmm9 + subsd %xmm8, %xmm7 + subsd %xmm8, %xmm10 + movsd %xmm7, 16(%rsp) + movsd 16(%rsp), %xmm7 + subsd %xmm7, %xmm2 + movaps %xmm4, %xmm7 + subsd %xmm3, %xmm7 + addsd %xmm2, %xmm10 + subsd %xmm7, %xmm11 + addsd %xmm10, %xmm9 + movaps %xmm4, %xmm2 + subsd %xmm7, %xmm2 + movsd %xmm2, 16(%rsp) + movsd 16(%rsp), %xmm2 + subsd %xmm2, %xmm3 + movaps %xmm5, %xmm2 + addsd %xmm3, %xmm11 + movaps %xmm5, %xmm3 + subsd %xmm4, %xmm3 + addsd %xmm11, %xmm9 + subsd %xmm3, %xmm2 + subsd %xmm3, %xmm12 + movsd %xmm2, 16(%rsp) + movsd 16(%rsp), %xmm2 + subsd %xmm2, %xmm4 + addsd %xmm4, %xmm12 + addsd %xmm12, %xmm9 + addsd %xmm6, %xmm9 + addsd %xmm9, %xmm5 + mulsd .L_2il0floatpacket.7(%rip), %xmm5 + movsd %xmm5, 32(%rsp) + movsd %xmm5, 56(%rsp) + jmp ..B1.22 +..B1.15: + movzwl 6(%rsp), %eax + andl $32752, %eax + cmpl $16368, %eax + je ..B1.31 +..B1.16: + movsd %xmm5, 32(%rsp) +..B1.17: + movsd .L_2il0floatpacket.8(%rip), %xmm5 + lea 56+_Q1(%rip), %rax + movsd (%rsp), %xmm11 + lea 48+_Q1(%rip), %rdx + lea 40+_Q1(%rip), %rcx + lea 32+_Q1(%rip), %rsi + lea 24+_Q1(%rip), %rdi + lea 16+_Q1(%rip), %r8 + movsd (%rax), %xmm13 + lea 8+_Q1(%rip), %r9 + lea _Q1(%rip), %r10 + mulsd %xmm7, %xmm5 + movaps %xmm5, %xmm3 + subsd %xmm7, %xmm3 + movsd %xmm3, 16(%rsp) + movsd 16(%rsp), %xmm4 + subsd %xmm4, %xmm5 + movaps %xmm5, %xmm8 + subsd %xmm5, %xmm11 + mulsd %xmm5, %xmm8 + subsd %xmm2, %xmm8 + movsd .L_2il0floatpacket.9(%rip), %xmm2 + mulsd %xmm5, %xmm2 + mulsd %xmm11, %xmm2 + movaps %xmm8, %xmm15 + mulsd %xmm11, %xmm11 + movaps %xmm2, %xmm3 + addsd %xmm11, %xmm3 + movaps %xmm3, %xmm6 + addsd %xmm3, %xmm15 + subsd %xmm2, %xmm6 + mulsd %xmm15, %xmm13 + movaps %xmm15, %xmm9 + movaps %xmm15, %xmm12 + movsd %xmm6, 16(%rsp) + subsd %xmm8, %xmm9 + mulsd %xmm15, %xmm12 + addsd (%rdx), %xmm13 + mulsd %xmm15, %xmm13 + movsd 16(%rsp), %xmm7 + movsd %xmm9, 16(%rsp) + subsd %xmm7, %xmm11 + addsd (%rcx), %xmm13 + mulsd %xmm15, %xmm13 + movsd 16(%rsp), %xmm10 + addsd (%rsi), %xmm13 + subsd %xmm10, %xmm3 + mulsd %xmm15, %xmm13 + addsd %xmm11, %xmm3 + addsd (%rdi), %xmm13 + mulsd %xmm15, %xmm13 + addsd (%r8), %xmm13 + mulsd %xmm15, %xmm13 + addsd (%r9), %xmm13 + mulsd %xmm15, %xmm13 + addsd (%r10), %xmm13 + mulsd %xmm12, %xmm13 + addsd %xmm13, %xmm3 + addsd %xmm15, %xmm3 + mulsd .L_2il0floatpacket.7(%rip), %xmm3 + movsd %xmm3, 56(%rsp) + jmp ..B1.22 +..B1.18: + movsd %xmm5, 32(%rsp) +..B1.19: + movaps %xmm14, %xmm0 + lea 72(%rsp), %rdi +..___tag_value_clog.4: + call __libm_hypot2_k64@PLT +..___tag_value_clog.5: +..B1.20: + lea 24+_CONSTANTS(%rip), %rax + lea 32+_CONSTANTS(%rip), %rdx + lea 88(%rsp), %rdi + movsd (%rax), %xmm1 + mulsd %xmm0, %xmm1 + movsd (%rdx), %xmm2 + mulsd %xmm0, %xmm2 + movsd %xmm1, -80(%rdi) + movsd -16(%rdi), %xmm0 + movsd -8(%rdi), %xmm1 + movsd %xmm2, (%rsp) +..___tag_value_clog.6: + call __libm_log_k64@PLT +..___tag_value_clog.7: +..B1.21: + movsd .L_2il0floatpacket.7(%rip), %xmm0 + movsd 88(%rsp), %xmm5 + mulsd %xmm0, %xmm5 + movsd 8(%rsp), %xmm1 + movaps %xmm1, %xmm6 + movsd 96(%rsp), %xmm4 + addsd %xmm5, %xmm6 + mulsd %xmm0, %xmm4 + movaps %xmm6, %xmm2 + movsd 40(%rsp), %xmm14 + subsd %xmm1, %xmm2 + movsd %xmm2, 16(%rsp) + movsd 16(%rsp), %xmm3 + movsd 48(%rsp), %xmm1 + subsd %xmm3, %xmm5 + addsd %xmm4, %xmm5 + addsd (%rsp), %xmm5 + addsd %xmm5, %xmm6 + movsd %xmm6, 32(%rsp) + movsd %xmm6, 56(%rsp) +..B1.22: + movaps %xmm1, %xmm0 + movaps %xmm14, %xmm1 + call atan2@PLT +..B1.60: + movsd %xmm0, 64(%rsp) + movzwl 70(%rsp), %eax + testl $32752, %eax + jne ..B1.29 +..B1.23: + testl $1048575, 68(%rsp) + jne ..B1.25 +..B1.24: + cmpl $0, 64(%rsp) + je ..B1.29 +..B1.25: + lea 56+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 16(%rsp) + movsd 16(%rsp), %xmm1 + addsd 64(%rsp), %xmm1 + movsd %xmm1, 64(%rsp) + jmp ..B1.29 +..B1.26: + je ..B1.50 +..B1.27: + cmpl $2047, %eax + je ..B1.43 +..B1.28: + lea 48+_CONSTANTS(%rip), %rax + movsd 48(%rsp), %xmm0 + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm1 + movsd %xmm1, 56(%rsp) + movsd 40(%rsp), %xmm1 + call atan2@PLT +..B1.61: + movsd %xmm0, 64(%rsp) +..B1.29: + movq 104(%rsp), %rax + xorq %rsp, %rax + movsd 56(%rsp), %xmm0 + movsd 64(%rsp), %xmm1 + cmpq %fs:40, %rax + jne ..B1.42 +..B1.30: + addq $120, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 128 +..B1.31: + testl $1048575, 4(%rsp) + jne ..B1.16 +..B1.33: + cmpl $0, (%rsp) + jne ..B1.16 +..B1.35: + movsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm6, %xmm2 + mulsd %xmm2, %xmm6 + movsd %xmm6, 32(%rsp) + movzwl 38(%rsp), %eax + testl $32752, %eax + jne ..B1.39 +..B1.36: + testl $1048575, 36(%rsp) + jne ..B1.38 +..B1.37: + cmpl $0, 32(%rsp) + je ..B1.39 +..B1.38: + lea 56+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm2 + mulsd %xmm2, %xmm2 + movsd %xmm2, 16(%rsp) + movsd 16(%rsp), %xmm6 + addsd 32(%rsp), %xmm6 + movsd %xmm6, 32(%rsp) +..B1.39: + movsd %xmm6, 56(%rsp) + jmp ..B1.22 +..B1.40: + ucomisd %xmm2, %xmm6 + jne ..B1.4 + jp ..B1.4 +..B1.41: + movsd .L_2il0floatpacket.6(%rip), %xmm3 + divsd %xmm2, %xmm3 + movsd %xmm6, 8(%rsp) + movsd %xmm7, (%rsp) + movsd %xmm3, 56(%rsp) + jmp ..B1.22 +..B1.42: + call __stack_chk_fail@PLT +..B1.43: + testl $1048575, 52(%rsp) + jne ..B1.45 +..B1.44: + cmpl $0, 48(%rsp) + je ..B1.28 +..B1.45: + movsd 48(%rsp), %xmm0 + cmpl $2047, %edx + mulsd %xmm0, %xmm0 + movsd %xmm0, 64(%rsp) + je ..B1.47 +..B1.46: + movsd %xmm0, 56(%rsp) + jmp ..B1.29 +..B1.47: + testl $1048575, 44(%rsp) + jne ..B1.46 +..B1.48: + cmpl $0, 40(%rsp) + jne ..B1.46 +..B1.49: + movsd 40(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 56(%rsp) + jmp ..B1.29 +..B1.50: + testl $1048575, 44(%rsp) + jne ..B1.52 +..B1.51: + cmpl $0, 40(%rsp) + je ..B1.27 +..B1.52: + movsd 40(%rsp), %xmm1 + cmpl $2047, %eax + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, 64(%rsp) + je ..B1.54 +..B1.53: + movsd 48(%rsp), %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, 56(%rsp) + jmp ..B1.29 +..B1.54: + testl $1048575, 52(%rsp) + jne ..B1.53 +..B1.55: + cmpl $0, 48(%rsp) + jne ..B1.53 +..B1.56: + movsd 48(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 56(%rsp) + jmp ..B1.29 +..B1.62: + cmpl $2047, %edx + je ..B1.50 + jmp ..B1.27 + .align 16,0x90 + .cfi_endproc + .type clog,@function + .size clog,.-clog + .data +# -- End clog + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.10: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +_CONSTANTS: + .long 0 + .long 1065353216 + .long 1818952144 + .long 1072073202 + .long 133565931 + .long 1072697336 + .long 4277796864 + .long 1071001154 + .long 3164486458 + .long 1030551450 + .long 0 + .long 592445440 + .long 0 + .long 2146435072 + .long 0 + .long 1048576 + .type _CONSTANTS,@object + .size _CONSTANTS,64 + .align 16 +_Q1: + .long 0 + .long 3219128320 + .long 1431655765 + .long 1070945621 + .long 193 + .long 3218079744 + .long 2576980913 + .long 1070176665 + .long 1408920289 + .long 3217380693 + .long 2428535925 + .long 1069697316 + .long 1830244366 + .long 3217031283 + .long 3038314627 + .long 1069314732 + .type _Q1,@object + .size _Q1,64 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x02000000,0x41a00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/clog10.S b/external/sgx_libm/intel64/clog10.S new file mode 100644 index 0000000000..a8ed1a4402 --- /dev/null +++ b/external/sgx_libm/intel64/clog10.S @@ -0,0 +1,789 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clog10.c" + .text +..TXTST0: +# -- Begin clog10f + .text + .align 16,0x90 + .globl clog10f +clog10f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_clog10f.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_clog10f.4: + call clog10@PLT +..___tag_value_clog10f.5: +..B1.5: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type clog10f,@function + .size clog10f,.-clog10f + .data +# -- End clog10f + .text +# -- Begin clog10 + .text + .align 16,0x90 + .globl clog10 +clog10: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_clog10.8: +..L9: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + movq %fs:40, %rax + subq $128, %rsp + .cfi_def_cfa_offset 160 + movsd %xmm0, 16(%rsp) + xorq %rsp, %rax + movsd %xmm1, 24(%rsp) + movzwl 22(%rsp), %edx + andl $32752, %edx + movq %rax, 112(%rsp) + movzwl 30(%rsp), %eax + andl $32752, %eax + shrl $4, %edx + shrl $4, %eax + cmpl $2047, %edx + jge ..B2.26 +..B2.2: + cmpl $2047, %eax + jge ..B2.62 +..B2.3: + testl %edx, %edx + jne ..B2.9 +..B2.4: + testl $1048575, 20(%rsp) + jne ..B2.9 +..B2.5: + cmpl $0, 16(%rsp) + jne ..B2.9 +..B2.6: + testl %eax, %eax + jne ..B2.9 +..B2.7: + testl $1048575, 28(%rsp) + jne ..B2.9 +..B2.8: + cmpl $0, 24(%rsp) + je ..B2.25 +..B2.9: + movsd 16(%rsp), %xmm0 + lea 24(%rsp), %r15 + movsd (%r15), %xmm1 + movaps %xmm0, %xmm12 + movaps %xmm1, %xmm11 + andps .L_2il0floatpacket.10(%rip), %xmm11 + andps .L_2il0floatpacket.10(%rip), %xmm12 + movaps %xmm11, %xmm6 + movaps %xmm12, %xmm7 + movaps %xmm6, %xmm2 + comisd %xmm12, %xmm11 + jbe ..B2.11 +..B2.10: + movaps %xmm7, %xmm6 + movaps %xmm2, %xmm12 + movaps %xmm11, %xmm7 + movaps %xmm6, %xmm11 +..B2.11: + lea 8+_CONSTANTS(%rip), %rax + comisd (%rax), %xmm12 + jb ..B2.22 +..B2.12: + lea 16+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm2 + comisd %xmm12, %xmm2 + jb ..B2.22 +..B2.13: + lea 24+_CONSTANTS(%rip), %rdx + lea _CONSTANTS(%rip), %rax + movaps %xmm12, %xmm5 + mulsd %xmm12, %xmm5 + comisd (%rdx), %xmm11 + movsd .L_2il0floatpacket.11(%rip), %xmm2 + movsd (%rax), %xmm4 + jbe ..B2.16 +..B2.14: + movaps %xmm11, %xmm3 + mulsd %xmm11, %xmm3 + addsd %xmm3, %xmm5 + subsd %xmm2, %xmm5 + andps .L_2il0floatpacket.10(%rip), %xmm5 + comisd %xmm5, %xmm4 + ja ..B2.17 + jmp ..B2.22 +..B2.16: + subsd %xmm2, %xmm5 + andps .L_2il0floatpacket.10(%rip), %xmm5 + comisd %xmm5, %xmm4 + jbe ..B2.22 +..B2.17: + movsd %xmm6, 8(%rsp) +..B2.18: + movzwl 14(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + cmpl $913, %edx + jl ..B2.20 +..B2.19: + movsd .L_2il0floatpacket.7(%rip), %xmm9 + movaps %xmm12, %xmm10 + mulsd %xmm9, %xmm10 + movaps %xmm11, %xmm8 + mulsd %xmm9, %xmm8 + movaps %xmm10, %xmm13 + movaps %xmm8, %xmm14 + movsd .L_2il0floatpacket.9(%rip), %xmm15 + lea 32+_Q1(%rip), %rbx + lea 56+_Q1(%rip), %rax + subsd %xmm12, %xmm13 + subsd %xmm11, %xmm14 + subsd %xmm13, %xmm10 + subsd %xmm14, %xmm8 + subsd %xmm10, %xmm12 + subsd %xmm8, %xmm11 + movaps %xmm10, %xmm4 + movaps %xmm8, %xmm7 + mulsd %xmm10, %xmm4 + lea 48+_Q1(%rip), %rdx + mulsd %xmm8, %xmm7 + mulsd %xmm15, %xmm10 + mulsd %xmm15, %xmm8 + mulsd %xmm12, %xmm10 + mulsd %xmm11, %xmm8 + mulsd %xmm12, %xmm12 + mulsd %xmm11, %xmm11 + movaps %xmm4, %xmm1 + lea 88(%rsp), %r14 + lea 40+_Q1(%rip), %rcx + addsd %xmm7, %xmm1 + movaps %xmm1, %xmm5 + subsd %xmm2, %xmm1 + subsd %xmm4, %xmm5 + movaps %xmm1, %xmm6 + subsd %xmm5, %xmm7 + movsd (%rax), %xmm5 + addsd %xmm7, %xmm6 + movaps %xmm6, %xmm3 + movaps %xmm6, %xmm2 + lea 24+_Q1(%rip), %rsi + subsd %xmm1, %xmm3 + lea 16+_Q1(%rip), %rdi + subsd %xmm3, %xmm2 + subsd %xmm3, %xmm7 + subsd %xmm2, %xmm1 + lea 8+_Q1(%rip), %r8 + addsd %xmm1, %xmm7 + movaps %xmm6, %xmm1 + lea _Q1(%rip), %r9 + lea 48+_CONSTANTS(%rip), %r10 + addsd %xmm10, %xmm1 + movaps %xmm1, %xmm2 + movaps %xmm1, %xmm14 + lea 56+_CONSTANTS(%rip), %r11 + addsd %xmm8, %xmm2 + subsd %xmm6, %xmm14 + movaps %xmm2, %xmm3 + subsd %xmm14, %xmm10 + addsd %xmm12, %xmm3 + movaps %xmm3, %xmm4 + addsd %xmm11, %xmm4 + mulsd %xmm4, %xmm5 + movaps %xmm4, %xmm13 + mulsd %xmm4, %xmm13 + mulsd %xmm4, %xmm9 + addsd (%rdx), %xmm5 + mulsd %xmm4, %xmm5 + addsd (%rcx), %xmm5 + mulsd %xmm4, %xmm5 + addsd (%rbx), %xmm5 + mulsd %xmm4, %xmm5 + lea 104(%rsp), %rbx + addsd (%rsi), %xmm5 + mulsd %xmm4, %xmm5 + addsd (%rdi), %xmm5 + mulsd %xmm4, %xmm5 + addsd (%r8), %xmm5 + mulsd %xmm4, %xmm5 + addsd (%r9), %xmm5 + mulsd %xmm13, %xmm5 + movaps %xmm1, %xmm13 + subsd %xmm14, %xmm13 + subsd %xmm13, %xmm6 + addsd %xmm6, %xmm10 + movaps %xmm2, %xmm6 + subsd %xmm1, %xmm6 + addsd %xmm10, %xmm7 + subsd %xmm6, %xmm8 + movaps %xmm2, %xmm10 + subsd %xmm6, %xmm10 + subsd %xmm10, %xmm1 + addsd %xmm1, %xmm8 + movaps %xmm3, %xmm1 + addsd %xmm8, %xmm7 + movaps %xmm3, %xmm8 + subsd %xmm2, %xmm8 + subsd %xmm8, %xmm1 + subsd %xmm8, %xmm12 + subsd %xmm1, %xmm2 + movaps %xmm4, %xmm1 + addsd %xmm2, %xmm12 + addsd %xmm12, %xmm7 + movaps %xmm4, %xmm12 + subsd %xmm3, %xmm12 + subsd %xmm12, %xmm1 + subsd %xmm12, %xmm11 + subsd %xmm1, %xmm3 + movsd (%r10), %xmm1 + addsd %xmm3, %xmm11 + movaps %xmm1, %xmm3 + addsd %xmm11, %xmm7 + movaps %xmm9, %xmm11 + addsd %xmm7, %xmm5 + subsd %xmm4, %xmm11 + subsd %xmm11, %xmm9 + mulsd %xmm9, %xmm3 + subsd %xmm9, %xmm4 + addsd %xmm5, %xmm4 + movsd (%r11), %xmm5 + mulsd %xmm5, %xmm9 + movaps %xmm5, %xmm2 + mulsd %xmm4, %xmm2 + mulsd %xmm1, %xmm4 + addsd %xmm9, %xmm2 + pxor %xmm1, %xmm1 + addsd %xmm4, %xmm2 + addsd %xmm2, %xmm3 + mulsd .L_2il0floatpacket.6(%rip), %xmm3 + movsd %xmm3, -72(%rbx) + jmp ..B2.29 +..B2.20: + movsd %xmm7, (%rsp) + movzwl 6(%rsp), %eax + andl $32752, %eax + cmpl $16368, %eax + je ..B2.35 +..B2.21: + movsd .L_2il0floatpacket.7(%rip), %xmm8 + movaps %xmm12, %xmm3 + mulsd %xmm8, %xmm3 + lea 56+_Q1(%rip), %rax + movaps %xmm3, %xmm1 + lea 32+_Q1(%rip), %rbx + movsd (%rax), %xmm7 + lea 88(%rsp), %r14 + lea 48+_Q1(%rip), %rdx + subsd %xmm12, %xmm1 + lea 40+_Q1(%rip), %rcx + subsd %xmm1, %xmm3 + movaps %xmm3, %xmm5 + subsd %xmm3, %xmm12 + mulsd %xmm3, %xmm5 + lea 24+_Q1(%rip), %rsi + subsd %xmm2, %xmm5 + movsd .L_2il0floatpacket.9(%rip), %xmm2 + movaps %xmm5, %xmm14 + mulsd %xmm3, %xmm2 + lea 16+_Q1(%rip), %rdi + mulsd %xmm12, %xmm2 + lea 8+_Q1(%rip), %r8 + mulsd %xmm12, %xmm12 + movaps %xmm2, %xmm10 + lea _Q1(%rip), %r9 + lea 48+_CONSTANTS(%rip), %r10 + addsd %xmm12, %xmm10 + movaps %xmm10, %xmm4 + addsd %xmm10, %xmm14 + subsd %xmm2, %xmm4 + mulsd %xmm14, %xmm7 + subsd %xmm4, %xmm12 + mulsd %xmm14, %xmm8 + addsd (%rdx), %xmm7 + mulsd %xmm14, %xmm7 + movaps %xmm14, %xmm6 + subsd %xmm5, %xmm6 + addsd (%rcx), %xmm7 + subsd %xmm6, %xmm10 + mulsd %xmm14, %xmm7 + addsd %xmm12, %xmm10 + addsd (%rbx), %xmm7 + mulsd %xmm14, %xmm7 + movaps %xmm14, %xmm12 + mulsd %xmm14, %xmm12 + addsd (%rsi), %xmm7 + mulsd %xmm14, %xmm7 + movaps %xmm8, %xmm9 + subsd %xmm14, %xmm9 + addsd (%rdi), %xmm7 + subsd %xmm9, %xmm8 + mulsd %xmm14, %xmm7 + lea 56+_CONSTANTS(%rip), %r11 + addsd (%r8), %xmm7 + mulsd %xmm14, %xmm7 + subsd %xmm8, %xmm14 + movsd (%r10), %xmm13 + lea 104(%rsp), %rbx + movsd (%r11), %xmm11 + movaps %xmm13, %xmm1 + movaps %xmm11, %xmm15 + addsd (%r9), %xmm7 + mulsd %xmm8, %xmm1 + mulsd %xmm11, %xmm8 + mulsd %xmm12, %xmm7 + addsd %xmm7, %xmm10 + addsd %xmm10, %xmm14 + mulsd %xmm14, %xmm15 + mulsd %xmm13, %xmm14 + addsd %xmm8, %xmm15 + addsd %xmm14, %xmm15 + addsd %xmm15, %xmm1 + mulsd .L_2il0floatpacket.6(%rip), %xmm1 + movsd %xmm1, -72(%rbx) + pxor %xmm1, %xmm1 + jmp ..B2.29 +..B2.22: + lea 48(%rsp), %rdi +..___tag_value_clog10.17: + call __libm_hypot2_k64@PLT +..___tag_value_clog10.18: +..B2.23: + lea 72+_CONSTANTS(%rip), %rax + lea 80+_CONSTANTS(%rip), %rdx + mulsd .L_2il0floatpacket.6(%rip), %xmm0 + lea 64(%rsp), %rdi + movsd (%rax), %xmm1 + mulsd %xmm0, %xmm1 + movsd (%rdx), %xmm2 + mulsd %xmm0, %xmm2 + movsd %xmm1, -56(%rdi) + movsd -16(%rdi), %xmm0 + movsd -8(%rdi), %xmm1 + movsd %xmm2, (%rsp) +..___tag_value_clog10.19: + call __libm_log_k64@PLT +..___tag_value_clog10.20: +..B2.24: + movsd 64(%rsp), %xmm6 + lea 88(%rsp), %r14 + movsd .L_2il0floatpacket.6(%rip), %xmm0 + lea 104(%rsp), %rbx + mulsd %xmm0, %xmm6 + lea 48+_CONSTANTS(%rip), %rax + movsd .L_2il0floatpacket.7(%rip), %xmm4 + lea 56+_CONSTANTS(%rip), %rdx + movsd -32(%rbx), %xmm2 + movsd (%rax), %xmm5 + movsd -96(%rbx), %xmm9 + mulsd %xmm6, %xmm4 + movaps %xmm9, %xmm10 + mulsd %xmm0, %xmm2 + movaps %xmm4, %xmm1 + movsd (%rdx), %xmm3 + subsd %xmm6, %xmm1 + movaps %xmm3, %xmm8 + subsd %xmm1, %xmm4 + movaps %xmm4, %xmm7 + pxor %xmm1, %xmm1 + mulsd %xmm5, %xmm7 + subsd %xmm4, %xmm6 + mulsd %xmm3, %xmm4 + addsd %xmm2, %xmm6 + addsd %xmm7, %xmm10 + mulsd %xmm6, %xmm8 + subsd %xmm10, %xmm9 + mulsd %xmm5, %xmm6 + addsd %xmm4, %xmm8 + addsd %xmm7, %xmm9 + addsd %xmm6, %xmm8 + movsd -88(%rbx), %xmm0 + addsd %xmm8, %xmm9 + addsd (%rsp), %xmm9 + addsd %xmm9, %xmm10 + movsd %xmm10, -72(%rbx) + jmp ..B2.29 +..B2.25: + movsd .L_2il0floatpacket.8(%rip), %xmm0 + lea 24(%rsp), %r15 + pxor %xmm1, %xmm1 + lea 88(%rsp), %r14 + divsd %xmm1, %xmm0 + movsd %xmm0, -56(%r14) + lea 104(%rsp), %rbx + movsd -88(%rbx), %xmm0 + jmp ..B2.29 +..B2.26: + je ..B2.51 +..B2.27: + cmpl $2047, %eax + je ..B2.44 +..B2.28: + lea 32+_CONSTANTS(%rip), %rax + lea 24(%rsp), %r15 + pxor %xmm1, %xmm1 + lea 88(%rsp), %r14 + lea 104(%rsp), %rbx + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -72(%rbx) + movsd -88(%rbx), %xmm0 +..B2.29: + movq (%r15), %rax + lea (%rsp), %rdi + movq %rax, 80(%rdi) + lea 80(%rsp), %rsi + movsd %xmm1, (%r14) + lea 96(%rsp), %rdx + movsd %xmm0, (%rdx) + movsd %xmm1, (%rbx) +..___tag_value_clog10.21: + call __libm_atan2_k64@PLT +..___tag_value_clog10.22: +..B2.61: + movl %eax, %edi +..B2.30: + movzwl 6(%rsp), %eax + andl $32752, %eax + cmpl $32752, %eax + jl ..B2.32 +..B2.31: + movq (%rsp), %rax + movq %rax, 40(%rsp) + jmp ..B2.33 +..B2.32: + movsd (%rsp), %xmm2 + lea 48+_CONSTANTS(%rip), %rax + movsd .L_2il0floatpacket.7(%rip), %xmm1 + lea 56+_CONSTANTS(%rip), %rcx + mulsd %xmm2, %xmm1 + movaps %xmm1, %xmm0 + movq (%rax), %rdx + subsd %xmm2, %xmm0 + movq (%rcx), %rsi + lea 40(%rsp), %rcx + movq %rdx, 56(%rcx) + lea 96(%rsp), %rdx + movq %rsi, (%rbx) + lea 80(%rsp), %rsi + subsd %xmm0, %xmm1 + movsd %xmm1, -16(%rdx) + subsd %xmm1, %xmm2 + addsd -88(%rdx), %xmm2 + movsd %xmm2, (%r14) +..___tag_value_clog10.23: + call __libm_mul_k64@PLT +..___tag_value_clog10.24: +..B2.33: + movq 112(%rsp), %rax + xorq %rsp, %rax + movsd 32(%rsp), %xmm0 + movsd 40(%rsp), %xmm1 + cmpq %fs:40, %rax + jne ..B2.43 +..B2.34: + addq $128, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B2.35: + testl $1048575, 4(%rsp) + jne ..B2.21 +..B2.36: + cmpl $0, (%rsp) + jne ..B2.21 +..B2.37: + testl %edx, %edx + jne ..B2.41 +..B2.38: + testl $1048575, 12(%rsp) + jne ..B2.41 +..B2.39: + cmpl $0, 8(%rsp) + jne ..B2.41 +..B2.40: + lea 88(%rsp), %r14 + pxor %xmm1, %xmm1 + lea 104(%rsp), %rbx + movsd %xmm1, -72(%rbx) + jmp ..B2.29 +..B2.41: + lea 64+_CONSTANTS(%rip), %r14 + lea 48+_CONSTANTS(%rip), %r8 + movsd .L_2il0floatpacket.7(%rip), %xmm5 + lea 56+_CONSTANTS(%rip), %r10 + movaps %xmm5, %xmm2 + lea 80(%rsp), %rsi + lea 96(%rsp), %rdx + mulsd (%r14), %xmm11 + lea 88(%rsp), %r14 + movsd %xmm11, -88(%rdx) + lea 32(%rsp), %rcx + movzwl -82(%rdx), %eax + movl %eax, %ebx + andl $-32753, %eax + andl $32752, %ebx + orl $-49168, %eax + movw %ax, -82(%rdx) + movsd -88(%rdx), %xmm1 + mulsd %xmm1, %xmm2 + movaps %xmm2, %xmm0 + shrl $4, %ebx + subsd %xmm1, %xmm0 + movq (%r8), %r9 + lea -2447(%rbx,%rbx), %edi + movq (%r10), %r11 + lea 104(%rsp), %rbx + movq %r9, (%rdx) + subsd %xmm0, %xmm2 + movaps %xmm2, %xmm6 + subsd %xmm2, %xmm1 + mulsd %xmm2, %xmm6 + mulsd %xmm1, %xmm2 + mulsd %xmm6, %xmm5 + mulsd .L_2il0floatpacket.9(%rip), %xmm2 + movaps %xmm5, %xmm3 + movaps %xmm1, %xmm4 + mulsd %xmm1, %xmm4 + subsd %xmm6, %xmm3 + movq %r11, (%rbx) + subsd %xmm3, %xmm5 + addsd %xmm2, %xmm4 + subsd %xmm5, %xmm6 + movsd %xmm5, -16(%rdx) + addsd %xmm4, %xmm6 + movsd %xmm6, (%r14) +..___tag_value_clog10.36: + call __libm_mul_k64@PLT +..___tag_value_clog10.37: +..B2.42: + movsd 16(%rsp), %xmm0 + pxor %xmm1, %xmm1 + jmp ..B2.29 +..B2.43: + call __stack_chk_fail@PLT +..B2.44: + testl $1048575, 28(%rsp) + jne ..B2.46 +..B2.45: + cmpl $0, 24(%rsp) + je ..B2.28 +..B2.46: + cmpl $2047, %edx + jne ..B2.57 +..B2.48: + testl $1048575, 20(%rsp) + jne ..B2.57 +..B2.49: + cmpl $0, 16(%rsp) + jne ..B2.57 +..B2.50: + movsd 16(%rsp), %xmm0 + lea 24(%rsp), %r15 + movaps %xmm0, %xmm1 + lea 88(%rsp), %r14 + mulsd %xmm0, %xmm1 + lea 104(%rsp), %rbx + movsd %xmm1, -72(%rbx) + pxor %xmm1, %xmm1 + jmp ..B2.29 +..B2.51: + testl $1048575, 20(%rsp) + jne ..B2.53 +..B2.52: + cmpl $0, 16(%rsp) + je ..B2.27 +..B2.53: + cmpl $2047, %eax + je ..B2.55 +..B2.54: + movsd 16(%rsp), %xmm0 + lea 24(%rsp), %r15 + movsd (%r15), %xmm1 + lea 88(%rsp), %r14 + mulsd %xmm0, %xmm1 + lea 104(%rsp), %rbx + movsd %xmm1, -72(%rbx) + pxor %xmm1, %xmm1 + jmp ..B2.29 +..B2.55: + testl $1048575, 28(%rsp) + jne ..B2.54 +..B2.56: + cmpl $0, 24(%rsp) + jne ..B2.54 +..B2.57: + lea 24(%rsp), %r15 + movsd (%r15), %xmm0 + lea 88(%rsp), %r14 + mulsd %xmm0, %xmm0 + pxor %xmm1, %xmm1 + movsd %xmm0, -56(%r14) + lea 104(%rsp), %rbx + movsd -88(%rbx), %xmm0 + jmp ..B2.29 +..B2.62: + cmpl $2047, %edx + je ..B2.51 + jmp ..B2.27 + .align 16,0x90 + .cfi_endproc + .type clog10,@function + .size clog10,.-clog10 + .data +# -- End clog10 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.10: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +_CONSTANTS: + .long 0 + .long 1065353216 + .long 1818952144 + .long 1072073202 + .long 133565931 + .long 1072697336 + .long 0 + .long 592445440 + .long 0 + .long 2146435072 + .long 0 + .long 1048576 + .long 402653184 + .long 1071369083 + .long 2389363364 + .long 3190212823 + .long 0 + .long 1282408448 + .long 1342177280 + .long 1070810131 + .long 3730980389 + .long 1040445247 + .type _CONSTANTS,@object + .size _CONSTANTS,88 + .space 8, 0x00 # pad + .align 16 +_Q1: + .long 0 + .long 3219128320 + .long 1431655765 + .long 1070945621 + .long 193 + .long 3218079744 + .long 2576980913 + .long 1070176665 + .long 1408920289 + .long 3217380693 + .long 2428535925 + .long 1069697316 + .long 1830244366 + .long 3217031283 + .long 3038314627 + .long 1069314732 + .type _Q1,@object + .size _Q1,64 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x02000000,0x41a00000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/clog10l.S b/external/sgx_libm/intel64/clog10l.S new file mode 100644 index 0000000000..0b9d3a6fe5 --- /dev/null +++ b/external/sgx_libm/intel64/clog10l.S @@ -0,0 +1,1000 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clog10l.c" + .text +..TXTST0: +# -- Begin clog10l + .text + .align 16,0x90 + .globl clog10l +clog10l: +# parameter 1: 352 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_clog10l.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + subq $312, %rsp + .cfi_def_cfa_offset 352 + xorb %r12b, %r12b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 304(%rsp) + fstpt 272(%rsp) + fldt 272(%rsp) + fstpt 288(%rsp) +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.5: + fldcw 80(%rsp) +..B1.6: + movb $1, %r12b +..B1.7: + movzwl 360(%rsp), %edx + andl $32767, %edx + movzwl 376(%rsp), %eax + andl $32767, %eax + cmpl $32767, %edx + jge ..B1.46 +..B1.8: + cmpl $32767, %eax + jge ..B1.82 +..B1.9: + testl %edx, %edx + jne ..B1.15 +..B1.10: + cmpl $0, 356(%rsp) + jne ..B1.15 +..B1.11: + cmpl $0, 352(%rsp) + jne ..B1.15 +..B1.12: + testl %eax, %eax + jne ..B1.15 +..B1.13: + cmpl $0, 372(%rsp) + jne ..B1.15 +..B1.14: + cmpl $0, 368(%rsp) + je ..B1.45 +..B1.15: + fldt 352(%rsp) + lea 368(%rsp), %rbx + fld %st(0) + fabs + fstpt 16(%rsp) + fldt 16(%rsp) + fldt (%rbx) + fld %st(0) + fabs + fstpt (%rsp) + fldt (%rsp) + movzwl 24(%rsp), %eax + movzwl 8(%rsp), %edx + andl $32767, %eax + andl $32767, %edx + cmpl %edx, %eax + jl ..B1.20 +..B1.16: + jne ..B1.21 +..B1.17: + movl 20(%rsp), %edx + movl 4(%rsp), %ecx + cmpl %ecx, %edx + jb ..B1.20 +..B1.18: + jne ..B1.21 +..B1.19: + movl 16(%rsp), %edx + cmpl (%rsp), %edx + jae ..B1.21 +..B1.20: + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 24(%rsp), %eax + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + andl $32767, %eax +..B1.21: + cmpl $16382, %eax + jg ..B1.26 +..B1.22: + jne ..B1.42 +..B1.23: + lea 16+_CONSTANTS(%rip), %rcx + movl 20(%rsp), %edx + cmpl 4(%rcx), %edx + ja ..B1.26 +..B1.24: + jne ..B1.42 +..B1.25: + movl (%rcx), %edx + cmpl 16(%rsp), %edx + ja ..B1.42 +..B1.26: + cmpl $16383, %eax + jl ..B1.31 +..B1.27: + jne ..B1.42 +..B1.28: + lea 32+_CONSTANTS(%rip), %rcx + movl 20(%rsp), %edx + cmpl 4(%rcx), %edx + jb ..B1.31 +..B1.29: + jne ..B1.42 +..B1.30: + movl 16(%rsp), %edx + cmpl (%rcx), %edx + ja ..B1.42 +..B1.31: + movzwl 8(%rsp), %esi + andl $32767, %esi + cmpl $8256, %esi + jg ..B1.36 +..B1.32: + jne ..B1.37 +..B1.33: + lea 48+_CONSTANTS(%rip), %rcx + movl 4(%rsp), %edx + cmpl 4(%rcx), %edx + ja ..B1.36 +..B1.34: + jne ..B1.37 +..B1.35: + movl (%rsp), %edx + cmpl (%rcx), %edx + jbe ..B1.37 +..B1.36: + fld %st(2) + lea _CONSTANTS(%rip), %rdx + fmul %st(3), %st + fld %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.10(%rip) + fsubr %st, %st(1) + fxch %st(1) + fabs + fldt (%rdx) + fcomip %st(1), %st + fstp %st(0) + ja ..B1.38 + jmp ..B1.83 +..B1.37: + fldt .L_2il0floatpacket.10(%rip) + fld %st(3) + fmul %st(4), %st + lea _CONSTANTS(%rip), %rdx + fsub %st(1), %st + fabs + fldt (%rdx) + fcomip %st(1), %st + fstp %st(0) + jbe ..B1.83 +..B1.38: + fstp %st(2) + cmpl $16183, %esi + jl ..B1.40 +..B1.39: + fldt .L_2il0floatpacket.9(%rip) + fld %st(3) + fmul %st(1), %st + lea 16+_Q1(%rip), %rax + fxch %st(5) + fstpt (%rsp) + fld %st(3) + lea _Q1(%rip), %rdx + fsubr %st(5), %st + lea 96+_CONSTANTS(%rip), %r15 + fsubrp %st, %st(5) + fld %st(4) + lea 112+_CONSTANTS(%rip), %r13 + fmul %st(5), %st + fld %st(2) + fmulp %st, %st(2) + fxch %st(4) + fsub %st(5), %st + fld %st(2) + fsubr %st(2), %st + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.13(%rip) + fmul %st, %st(1) + fxch %st(1) + fmul %st(4), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(4) + fmul %st(0), %st + fstpt 48(%rsp) + fld %st(5) + fadd %st(3), %st + fsub %st, %st(6) + fxch %st(6) + fsubrp %st, %st(3) + fmulp %st, %st(6) + fmul %st, %st(5) + fxch %st(3) + fsubrp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fld %st(0) + fsub %st(5), %st + fsubr %st, %st(2) + fld %st(1) + fsubp %st, %st(1) + fsubrp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(5), %st + fld %st(0) + faddp %st, %st(3) + fld %st(2) + fxch %st(4) + fmul %st(0), %st + fstpt 16(%rsp) + fldt 16(%rsp) + faddp %st, %st(4) + fxch %st(3) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + faddp %st, %st(1) + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fmulp %st, %st(1) + fld %st(4) + fsub %st(6), %st + fsubr %st, %st(7) + fsubr %st(5), %st + fsubrp %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fld %st(1) + fsub %st(3), %st + fldt 32(%rsp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(3), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fld %st(3) + fldt 64(%rsp) + fld %st(0) + fsub %st(3), %st + fldt 16(%rsp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(4) + fsub %st(2), %st + fldt 48(%rsp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(6), %st + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.9(%rip) + fld %st(0) + fmul %st(4), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt (%r15) + fld %st(0) + fmul %st(3), %st + fldt (%r13) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.11(%rip) + fmulp %st, %st(2) + fxch %st(1) + fstpt 272(%rsp) + fldt (%rsp) + jmp ..B1.49 +..B1.40: + cmpl $16383, %eax + je ..B1.56 +..B1.41: + fstp %st(0) + fldt .L_2il0floatpacket.9(%rip) + fld %st(2) + fmul %st(1), %st + fld %st(3) + lea 16+_Q1(%rip), %rax + fsubr %st(1), %st + lea _Q1(%rip), %rdx + fsubrp %st, %st(1) + fld %st(0) + lea 96+_CONSTANTS(%rip), %r15 + lea 112+_CONSTANTS(%rip), %r13 + fmul %st(1), %st + fsubp %st, %st(3) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.13(%rip) + fmulp %st, %st(1) + fmul %st(3), %st + fld %st(0) + fld %st(3) + fxch %st(5) + fmul %st(0), %st + fadd %st, %st(1) + fxch %st(1) + fadd %st, %st(5) + fxch %st(4) + fsubr %st(5), %st + fxch %st(2) + fsubr %st(4), %st + fsubrp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fmul %st(3), %st + fldt (%rax) + fmul %st(4), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fmul %st(3), %st + fld %st(3) + fsubr %st(1), %st + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt (%r15) + fld %st(0) + fmul %st(3), %st + fldt (%r13) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.11(%rip) + fmulp %st, %st(2) + fxch %st(1) + fstpt 272(%rsp) + fxch %st(1) + jmp ..B1.49 +..B1.42: + fstp %st(0) + fstp %st(1) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + lea 64(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_clog10l.13: + call __libm_hypot2l_k80@PLT +..___tag_value_clog10l.14: +..B1.78: + addq $32, %rsp + .cfi_def_cfa_offset 352 +..B1.43: + fldt .L_2il0floatpacket.11(%rip) + lea 160+_CONSTANTS(%rip), %rax + lea 176+_CONSTANTS(%rip), %rdx + fmulp %st, %st(1) + fldt (%rax) + fmul %st(1), %st + fstpt 16(%rsp) + fldt (%rdx) + fmulp %st, %st(1) + fstpt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fldt 64(%rsp) + lea 128(%rsp), %rdi + fstpt (%rsp) + fldt -48(%rdi) + fstpt 16(%rsp) +..___tag_value_clog10l.17: + call __libm_logl_k80@PLT +..___tag_value_clog10l.18: +..B1.79: + addq $32, %rsp + .cfi_def_cfa_offset 352 +..B1.44: + fldt .L_2il0floatpacket.11(%rip) + lea 96+_CONSTANTS(%rip), %r15 + fldt 96(%rsp) + lea 112+_CONSTANTS(%rip), %r13 + fxch %st(2) + fmulp %st, %st(1) + fmul %st, %st(1) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.9(%rip) + fld %st(0) + fmul %st(3), %st + fld %st(0) + fsub %st(4), %st + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt (%r15) + fld %st(0) + fmul %st(3), %st + fldt (%r13) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 16(%rsp) + fld %st(0) + fadd %st(4), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldt (%rsp) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 272(%rsp) + fldt 352(%rsp) + jmp ..B1.49 +..B1.45: + fldt .L_2il0floatpacket.9(%rip) + lea 368(%rsp), %rbx + movsd .L_2il0floatpacket.12(%rip), %xmm1 + pxor %xmm0, %xmm0 + divsd %xmm0, %xmm1 + movsd %xmm1, (%rsp) + lea 96+_CONSTANTS(%rip), %r15 + fldl (%rsp) + lea 112+_CONSTANTS(%rip), %r13 + fstpt 272(%rsp) + fldt -16(%rbx) + jmp ..B1.49 +..B1.46: + je ..B1.70 +..B1.47: + cmpl $32767, %eax + je ..B1.64 +..B1.48: + fldt .L_2il0floatpacket.9(%rip) + lea 368(%rsp), %rbx + lea 64+_CONSTANTS(%rip), %rax + lea 96+_CONSTANTS(%rip), %r15 + lea 112+_CONSTANTS(%rip), %r13 + fldt (%rax) + fmul %st(0), %st + fstpt 272(%rsp) + fldt -16(%rbx) +..B1.49: + fldt .L_2il0floatpacket.8(%rip) + lea 224(%rsp), %rdi + xorl %eax, %eax + lea 176(%rsp), %rsi + movl %eax, -16(%rsi) + lea 128(%rsp), %rdx + fstpt 16(%rdx) + fldt 16(%rdx) + fxch %st(1) + fstpt (%rdx) + movl %eax, 80(%rdx) + fstpt 64(%rdx) + fstpt -112(%rdx) + fldt (%rbx) + fstpt 48(%rdx) +..___tag_value_clog10l.20: + call __libm_atan2l_k80@PLT +..___tag_value_clog10l.21: +..B1.50: + fldt 16(%rsp) + fldt 224(%rsp) + fmul %st, %st(1) + fld %st(0) + movl 256(%rsp), %edi + fsubr %st(2), %st + fsubrp %st, %st(2) + fsub %st(1), %st + fldt 240(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + faddp %st, %st(1) + fldt (%r15) + fld %st(0) + fmul %st(3), %st + fstpt (%rsp) + fldt (%r13) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_clog10l.23: + call __libm_scalbl_k80@PLT +..___tag_value_clog10l.24: +..B1.80: + addq $32, %rsp + .cfi_def_cfa_offset 352 +..B1.51: + fstpt 288(%rsp) + testb %r12b, %r12b + je ..B1.53 +..B1.52: + fldcw 82(%rsp) +..B1.53: + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.63 +..B1.54: + fldt 272(%rsp) + fldt 288(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.62 +..B1.55: + addq $312, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 352 + .cfi_offset 3, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 15, -32 +..B1.56: + cmpl $-2147483648, 20(%rsp) + jne ..B1.41 +..B1.57: + cmpl $0, 16(%rsp) + jne ..B1.41 +..B1.58: + fstp %st(2) + fstp %st(0) + cmpq $0, (%rsp) + jne ..B1.60 +..B1.59: + fstp %st(0) + fldt .L_2il0floatpacket.8(%rip) + lea 96+_CONSTANTS(%rip), %r15 + fstpt 272(%rsp) + lea 112+_CONSTANTS(%rip), %r13 + fldt .L_2il0floatpacket.9(%rip) + fxch %st(1) + jmp ..B1.49 +..B1.60: + fstp %st(1) + fldt .L_2il0floatpacket.13(%rip) + lea 144+_CONSTANTS(%rip), %r13 + fldt (%r13) + lea 112+_CONSTANTS(%rip), %r13 + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt .L_2il0floatpacket.9(%rip) + movzwl 8(%rsp), %eax + movl %eax, %r15d + andl $-32768, %eax + fld %st(0) + orl $-49153, %eax + fld %st(1) + movw %ax, 8(%rsp) + andl $32767, %r15d + fldt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fmul %st, %st(2) + fld %st(0) + fsubr %st(3), %st + fsubrp %st, %st(3) + fld %st(2) + lea -33167(%r15,%r15), %edi + fmul %st(3), %st + lea 96+_CONSTANTS(%rip), %r15 + fmul %st, %st(2) + fld %st(2) + fsub %st(1), %st + fsubrp %st, %st(3) + fsub %st(2), %st + fxch %st(1) + fsub %st(3), %st + fmul %st, %st(3) + fxch %st(5) + fmulp %st, %st(3) + fld %st(4) + fmulp %st, %st(5) + fxch %st(2) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldt (%r15) + fld %st(0) + fmul %st(4), %st + fstpt (%rsp) + fldt (%r13) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 48(%rsp) +..___tag_value_clog10l.41: + call __libm_scalbl_k80@PLT +..___tag_value_clog10l.42: +..B1.81: + fldt 48(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 352 +..B1.61: + fxch %st(1) + fstpt 272(%rsp) + fldt 352(%rsp) + jmp ..B1.49 +..B1.62: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.63: + call __stack_chk_fail@PLT +..B1.64: + cmpl $-2147483648, 372(%rsp) + jne ..B1.66 +..B1.65: + cmpl $0, 368(%rsp) + je ..B1.48 +..B1.66: + cmpl $32767, %edx + je ..B1.68 +..B1.67: + fldt .L_2il0floatpacket.9(%rip) + lea 368(%rsp), %rbx + fldt (%rbx) + lea 96+_CONSTANTS(%rip), %r15 + fmul %st(0), %st + lea 112+_CONSTANTS(%rip), %r13 + fstpt 272(%rsp) + fldt -16(%rbx) + jmp ..B1.49 +..B1.68: + movq $0x8000000000000000, %rax + cmpq 352(%rsp), %rax + jne ..B1.67 +..B1.69: + fldt 352(%rsp) + lea 368(%rsp), %rbx + fld %st(0) + lea 96+_CONSTANTS(%rip), %r15 + fmul %st(1), %st + lea 112+_CONSTANTS(%rip), %r13 + fstpt 272(%rsp) + fldt .L_2il0floatpacket.9(%rip) + fxch %st(1) + jmp ..B1.49 +..B1.70: + cmpl $-2147483648, 356(%rsp) + jne ..B1.72 +..B1.71: + cmpl $0, 352(%rsp) + je ..B1.47 +..B1.72: + cmpl $32767, %eax + je ..B1.74 +..B1.73: + fldt 352(%rsp) + lea 368(%rsp), %rbx + fldt (%rbx) + lea 96+_CONSTANTS(%rip), %r15 + fmul %st(1), %st + lea 112+_CONSTANTS(%rip), %r13 + fstpt 272(%rsp) + fldt .L_2il0floatpacket.9(%rip) + fxch %st(1) + jmp ..B1.49 +..B1.74: + movq $0x8000000000000000, %rax + cmpq 368(%rsp), %rax + jne ..B1.73 +..B1.75: + fldt .L_2il0floatpacket.9(%rip) + lea 368(%rsp), %rbx + fldt (%rbx) + lea 96+_CONSTANTS(%rip), %r15 + fmul %st(0), %st + lea 112+_CONSTANTS(%rip), %r13 + fstpt 272(%rsp) + fldt -16(%rbx) + jmp ..B1.49 +..B1.82: + cmpl $32767, %edx + je ..B1.70 + jmp ..B1.47 +..B1.83: + fstp %st(0) + jmp ..B1.42 + .align 16,0x90 + .cfi_endproc + .type clog10l,@function + .size clog10l,.-clog10l + .data +# -- End clog10l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,16 + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 37342 + .word 47265 + .word 62214 + .word 46340 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 65535 + .word 31 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8256 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55465 + .word 56923 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 43711 + .word 54638 + .word 50772 + .word 56481 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16583 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39557 + .word 39456 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 51839 + .word 3796 + .word 3310 + .word 34305 + .word 49112 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,192 + .align 2 +_Q1: + .word 3134 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 49331 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/clogf.S b/external/sgx_libm/intel64/clogf.S new file mode 100644 index 0000000000..70d2a0e0c4 --- /dev/null +++ b/external/sgx_libm/intel64/clogf.S @@ -0,0 +1,2614 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clogf.c" + .text +..TXTST0: +# -- Begin clogf + .text + .align 16,0x90 + .globl clogf +clogf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_clogf.1: +..L2: + +..B1.2: + movq %rsp, %rax + subq $168, %rsp + .cfi_def_cfa_offset 176 + movq %rax, 72(%rsp) + movss %xmm0, 48(%rsp) + pshufd $1, %xmm0, %xmm1 + movss %xmm1, 56(%rsp) + movq %rbx, 80(%rsp) + lea clogf_table(%rip), %r8 + movl 56(%rsp), %edx + movl 48(%rsp), %ecx + movl $-2147483648, %eax + andl %edx, %eax + andl $2139095040, %edx + subl $8388608, %edx + cvtss2sd 56(%rsp), %xmm0 + cvtss2sd 48(%rsp), %xmm1 + cmpl $2130706432, %edx + jae .L_2TAG_PACKET_0.0.1 + movl %ecx, %edx + andl $-2147483648, %ecx + andl $2139095040, %edx + subl $8388608, %edx + movsd %xmm0, 40(%rsp) + movsd %xmm1, 32(%rsp) + cmpl $2130706432, %edx + jae .L_2TAG_PACKET_1.0.1 + movapd %xmm0, %xmm3 + divsd %xmm1, %xmm0 + movsd 6656(%r8), %xmm2 + mulsd %xmm1, %xmm1 + mulsd %xmm3, %xmm3 + addsd %xmm3, %xmm1 + movsd %xmm1, 16(%rsp) + andpd %xmm1, %xmm2 + pextrw $3, %xmm1, %edx + subsd 6784(%r8), %xmm1 + andpd 6672(%r8), %xmm1 + cmpltsd 6576(%r8), %xmm1 + movmskpd %xmm1, %ebx + orpd 6784(%r8), %xmm2 + andpd 6672(%r8), %xmm0 + testl $1, %ebx + jne .L_2TAG_PACKET_2.0.1 +.L_2TAG_PACKET_3.0.1: + xorl %ecx, %eax + movl 20(%rsp), %ebx + sarl $4, %edx + andq $1044480, %rbx + movsd 6800(%r8), %xmm3 + xorpd %xmm4, %xmm4 + subl $1023, %edx + xorpd %xmm7, %xmm7 + sarl $31, %ecx + movl %edx, (%rsp) + movd %ecx, %xmm6 + pshufd $0, %xmm6, %xmm6 + andpd 6832(%r8), %xmm6 + andpd %xmm0, %xmm3 + pextrw $3, %xmm0, %edx + shrq $9, %rbx + movsd %xmm0, %xmm1 + subl $16288, %edx + cmpl $1119, %edx + ja .L_2TAG_PACKET_4.0.1 + movl $16464, %ecx + pinsrw $3, %ecx, %xmm4 + shrl $16, %eax + orpd 6816(%r8), %xmm3 + movsd %xmm4, %xmm7 + mulsd (%r8,%rbx), %xmm2 + cmpsd $6, %xmm3, %xmm4 + movsd 6784(%r8), %xmm5 + minsd %xmm7, %xmm3 + andpd %xmm4, %xmm0 + mulsd %xmm3, %xmm1 + andpd %xmm4, %xmm5 + subsd %xmm3, %xmm0 + subsd 6784(%r8), %xmm2 + addsd %xmm5, %xmm1 + movq 6704(%r8), %xmm5 + divsd %xmm1, %xmm0 + cvtsi2sd (%rsp), %xmm1 + movl $176, %ecx + cmpl $176, %edx + cmova %ecx, %edx + addl $1, %edx + andq $-1, %rdx + movsd 6944(%r8), %xmm4 + pinsrw $3, %eax, %xmm7 + addsd 5152(%r8,%rdx,8), %xmm6 + xorpd %xmm7, %xmm6 + mulsd %xmm2, %xmm5 + addsd 6696(%r8), %xmm5 + mulsd %xmm2, %xmm5 + addsd 6688(%r8), %xmm5 + mulsd %xmm2, %xmm5 + xorpd %xmm0, %xmm7 + mulsd 6664(%r8), %xmm1 + mulsd %xmm0, %xmm0 + mulsd %xmm7, %xmm4 + addsd %xmm6, %xmm7 + mulsd %xmm4, %xmm0 + addsd 2048(%r8,%rbx), %xmm1 + addsd %xmm7, %xmm0 + addsd %xmm1, %xmm5 + mulsd 6960(%r8), %xmm5 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm5, %xmm5 + movd %xmm0, %edx + movd %xmm5, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_4.0.1: + addl $944, %edx + cmpl $2063, %edx + ja .L_2TAG_PACKET_5.0.1 + movq 6848(%r8), %xmm3 + shrl $16, %eax + movsd 6856(%r8), %xmm4 + mulsd (%r8,%rbx), %xmm2 + pinsrw $3, %eax, %xmm7 + mulsd %xmm1, %xmm1 + subsd 6784(%r8), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm3 + movsd %xmm1, %xmm5 + mulsd %xmm1, %xmm1 + addsd %xmm6, %xmm0 + cvtsi2sd (%rsp), %xmm6 + mulsd %xmm5, %xmm4 + mulsd %xmm3, %xmm1 + movq 6704(%r8), %xmm3 + mulsd %xmm2, %xmm3 + addsd 6696(%r8), %xmm3 + mulsd %xmm2, %xmm3 + mulsd 6664(%r8), %xmm6 + addsd 6688(%r8), %xmm3 + addsd 2048(%r8,%rbx), %xmm6 + mulsd %xmm2, %xmm3 + addsd %xmm4, %xmm1 + addsd %xmm6, %xmm3 + addsd %xmm1, %xmm0 + xorpd %xmm7, %xmm0 + mulsd 6960(%r8), %xmm3 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_5.0.1: + addl $15344, %edx + cmpl $17392, %edx + mulsd (%r8,%rbx), %xmm2 + subsd 6784(%r8), %xmm2 + jae .L_2TAG_PACKET_6.0.1 + shrl $16, %eax + pinsrw $3, %eax, %xmm7 + addsd %xmm6, %xmm0 + cvtsi2sd (%rsp), %xmm6 + movq 6704(%r8), %xmm3 + mulsd %xmm2, %xmm3 + pextrw $3, %xmm0, %edx + addsd 6696(%r8), %xmm3 + xorpd %xmm7, %xmm0 + andl $32752, %edx + mulsd %xmm2, %xmm3 + mulsd 6664(%r8), %xmm6 + addsd 6688(%r8), %xmm3 + movl $1065353217, %eax + movl $8388608, %ecx + addsd 2048(%r8,%rbx), %xmm6 + mulsd %xmm2, %xmm3 + cmpl $14352, %edx + cmovb %ecx, %eax + movd %eax, %xmm1 + addsd %xmm6, %xmm3 + mulss %xmm1, %xmm1 + mulsd 6960(%r8), %xmm3 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_6.0.1: + movss 6912(%r8), %xmm4 + movss 6916(%r8), %xmm1 + cvtsi2sd (%rsp), %xmm6 + shrl $16, %eax + andl $32768, %ecx + movq 6704(%r8), %xmm3 + mulsd %xmm2, %xmm3 + addsd 6696(%r8), %xmm3 + xorl %ecx, %eax + mulsd %xmm2, %xmm3 + xorps %xmm0, %xmm0 + mulsd 6664(%r8), %xmm6 + addsd 6688(%r8), %xmm3 + pinsrw $1, %eax, %xmm0 + addsd 2048(%r8,%rbx), %xmm6 + mulsd %xmm2, %xmm3 + orps %xmm0, %xmm4 + addsd %xmm6, %xmm3 + orps %xmm1, %xmm0 + mulsd 6960(%r8), %xmm3 + cvtsd2ss %xmm3, %xmm3 + addss %xmm4, %xmm0 + movd %xmm0, %edx + movd %xmm3, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_2.0.1: + movsd 32(%rsp), %xmm5 + mulsd %xmm5, %xmm5 + movq 16(%rsp), %xmm1 + movq 16(%rsp), %xmm6 + movq 16(%rsp), %xmm2 + subsd %xmm5, %xmm1 + subsd %xmm1, %xmm6 + subsd %xmm1, %xmm3 + subsd %xmm6, %xmm5 + addsd %xmm3, %xmm5 + xorl %ecx, %eax + movsd 6800(%r8), %xmm3 + xorpd %xmm4, %xmm4 + xorpd %xmm7, %xmm7 + sarl $31, %ecx + movd %ecx, %xmm6 + pshufd $0, %xmm6, %xmm6 + andpd 6832(%r8), %xmm6 + subsd 6784(%r8), %xmm2 + andpd %xmm0, %xmm3 + pextrw $3, %xmm0, %edx + movsd %xmm0, %xmm1 + addsd %xmm5, %xmm2 + subl $16288, %edx + cmpl $1119, %edx + ja .L_2TAG_PACKET_7.0.1 + movl $16464, %ecx + pinsrw $3, %ecx, %xmm4 + shrl $16, %eax + orpd 6816(%r8), %xmm3 + movsd %xmm4, %xmm7 + cmpsd $6, %xmm3, %xmm4 + movsd 6784(%r8), %xmm5 + minsd %xmm7, %xmm3 + andpd %xmm4, %xmm0 + mulsd %xmm3, %xmm1 + andpd %xmm4, %xmm5 + subsd %xmm3, %xmm0 + movq 6752(%r8), %xmm3 + addsd %xmm5, %xmm1 + divsd %xmm1, %xmm0 + mulsd %xmm2, %xmm3 + movl $176, %ecx + cmpl $176, %edx + cmova %ecx, %edx + addl $1, %edx + andl $-1, %edx + movsd 6944(%r8), %xmm4 + addsd 6744(%r8), %xmm3 + pinsrw $3, %eax, %xmm7 + addsd 5152(%r8,%rdx,8), %xmm6 + mulsd %xmm2, %xmm3 + xorpd %xmm7, %xmm6 + addsd 6736(%r8), %xmm3 + xorpd %xmm0, %xmm7 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm0 + addsd 6728(%r8), %xmm3 + mulsd %xmm7, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm6, %xmm7 + addsd 6720(%r8), %xmm3 + mulsd %xmm4, %xmm0 + mulsd %xmm2, %xmm3 + addsd %xmm7, %xmm0 + cvtsd2ss %xmm3, %xmm3 + cvtpd2ps %xmm0, %xmm0 + movd %xmm3, %eax + movd %xmm0, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_7.0.1: + addl $944, %edx + cmpl $2063, %edx + ja .L_2TAG_PACKET_8.0.1 + movq 6848(%r8), %xmm3 + shrl $16, %eax + movsd 6856(%r8), %xmm4 + pinsrw $3, %eax, %xmm7 + mulsd %xmm1, %xmm1 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm3 + movsd %xmm1, %xmm5 + mulsd %xmm1, %xmm1 + addsd %xmm6, %xmm0 + movq 6752(%r8), %xmm6 + mulsd %xmm2, %xmm6 + addsd 6744(%r8), %xmm6 + mulsd %xmm5, %xmm4 + mulsd %xmm2, %xmm6 + addsd 6736(%r8), %xmm6 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm6 + addsd 6728(%r8), %xmm6 + addsd %xmm4, %xmm1 + mulsd %xmm2, %xmm6 + addsd %xmm1, %xmm0 + addsd 6720(%r8), %xmm6 + xorpd %xmm7, %xmm0 + mulsd %xmm2, %xmm6 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm6, %xmm6 + movd %xmm0, %edx + movd %xmm6, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_8.0.1: + addl $15344, %edx + cmpl $17392, %edx + jae .L_2TAG_PACKET_9.0.1 + movq 6752(%r8), %xmm3 + mulsd %xmm2, %xmm3 + shrl $16, %eax + addsd 6744(%r8), %xmm3 + pinsrw $3, %eax, %xmm7 + mulsd %xmm2, %xmm3 + addsd %xmm6, %xmm0 + addsd 6736(%r8), %xmm3 + pextrw $3, %xmm0, %edx + mulsd %xmm2, %xmm3 + xorpd %xmm7, %xmm0 + addsd 6728(%r8), %xmm3 + andl $32752, %edx + movl $1065353217, %eax + movl $8388608, %ecx + mulsd %xmm2, %xmm3 + cmpl $14352, %edx + cmovb %ecx, %eax + movd %eax, %xmm1 + addsd 6720(%r8), %xmm3 + mulss %xmm1, %xmm1 + mulsd %xmm2, %xmm3 + cvtpd2ps %xmm0, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_9.0.1: + movss 6912(%r8), %xmm4 + movq 6752(%r8), %xmm3 + mulsd %xmm2, %xmm3 + movss 6916(%r8), %xmm1 + addsd 6744(%r8), %xmm3 + shrl $16, %eax + mulsd %xmm2, %xmm3 + andl $32768, %ecx + addsd 6736(%r8), %xmm3 + xorl %ecx, %eax + mulsd %xmm2, %xmm3 + xorps %xmm0, %xmm0 + addsd 6728(%r8), %xmm3 + pinsrw $1, %eax, %xmm0 + mulsd %xmm2, %xmm3 + orps %xmm0, %xmm4 + addsd 6720(%r8), %xmm3 + orps %xmm1, %xmm0 + mulsd %xmm2, %xmm3 + addss %xmm4, %xmm0 + cvtsd2ss %xmm3, %xmm3 + movd %xmm0, %edx + movd %xmm3, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_0.0.1: + andl $-2147483648, %ecx +.L_2TAG_PACKET_1.0.1: + movsd %xmm0, 40(%rsp) + movsd %xmm1, 32(%rsp) + movl 56(%rsp), %edx + andl $2147483647, %edx + je .L_2TAG_PACKET_10.0.1 + andl $2139095040, %edx + jne .L_2TAG_PACKET_10.0.1 + movss 56(%rsp), %xmm0 + orps 6864(%r8), %xmm0 + cvtss2sd %xmm0, %xmm0 + movsd 6896(%r8), %xmm2 + andpd %xmm0, %xmm2 + orpd 6880(%r8), %xmm2 + subsd %xmm2, %xmm0 + movsd %xmm0, 40(%rsp) +.L_2TAG_PACKET_10.0.1: + movl 48(%rsp), %edx + andl $2147483647, %edx + je .L_2TAG_PACKET_11.0.1 + andl $2139095040, %edx + jne .L_2TAG_PACKET_11.0.1 + movss 48(%rsp), %xmm1 + orps 6864(%r8), %xmm1 + cvtss2sd %xmm1, %xmm1 + movsd 6896(%r8), %xmm2 + andpd %xmm1, %xmm2 + orpd 6880(%r8), %xmm2 + subsd %xmm2, %xmm1 + movsd %xmm1, 32(%rsp) +.L_2TAG_PACKET_11.0.1: + movsd 40(%rsp), %xmm0 + movsd 32(%rsp), %xmm1 + pextrw $3, %xmm0, %edx + andl $32752, %edx + subl $16, %edx + cmpl $32736, %edx + jae .L_2TAG_PACKET_12.0.1 + pextrw $3, %xmm1, %edx + andl $32752, %edx + subl $16, %edx + cmpl $32736, %edx + jae .L_2TAG_PACKET_13.0.1 + movq %xmm0, %xmm3 + divsd %xmm1, %xmm0 + movq 6656(%r8), %xmm2 + mulsd %xmm1, %xmm1 + mulsd %xmm3, %xmm3 + addsd %xmm3, %xmm1 + movq %xmm1, 16(%rsp) + pand %xmm1, %xmm2 + pextrw $3, %xmm1, %edx + subsd 6784(%r8), %xmm1 + pand 6672(%r8), %xmm1 + cmpltsd 6576(%r8), %xmm1 + movmskpd %xmm1, %ebx + por 6784(%r8), %xmm2 + testl $1, %ebx + psllq $1, %xmm0 + psrlq $1, %xmm0 + jne .L_2TAG_PACKET_2.0.1 + jmp .L_2TAG_PACKET_3.0.1 +.L_2TAG_PACKET_12.0.1: + addl $16, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_14.0.1 + movsd %xmm0, %xmm2 + psllq $12, %xmm2 + xorpd %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + je .L_2TAG_PACKET_15.0.1 + movss 56(%rsp), %xmm0 + movl 48(%rsp), %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + mulss %xmm0, %xmm0 + jg .L_2TAG_PACKET_16.0.1 + je .L_2TAG_PACKET_17.0.1 + movd %xmm0, %edx + movd %xmm0, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_17.0.1: + movd %xmm0, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_16.0.1: + movss 48(%rsp), %xmm1 + mulss %xmm0, %xmm0 + mulss %xmm1, %xmm1 + movd %xmm0, %edx + movd %xmm1, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_14.0.1: + pextrw $3, %xmm1, %edx + andl $32752, %edx + cmpl $32752, %edx + jne .L_2TAG_PACKET_18.0.1 + movsd %xmm1, %xmm2 + psllq $12, %xmm2 + xorpd %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + jne .L_2TAG_PACKET_19.0.1 +.L_2TAG_PACKET_18.0.1: + cmpl $0, %ecx + jne .L_2TAG_PACKET_20.0.1 + movl %eax, %edx + movl 48(%rsp), %eax + cmpl $0, %eax + je .L_2TAG_PACKET_21.0.1 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_22.0.1 + movl 48(%rsp), %eax + movl %edx, 8(%rsp) + andl $2147483647, %eax + movl %eax, 4(%rsp) + jmp .L_2TAG_PACKET_23.0.1 +.L_2TAG_PACKET_20.0.1: + movss 6920(%r8), %xmm2 + movss 6924(%r8), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl 48(%rsp), %eax + cmpl $-2147483648, %eax + je .L_2TAG_PACKET_21.0.1 + cmpl $-8388608, %eax + je .L_2TAG_PACKET_22.0.1 + movl 48(%rsp), %eax + movl %edx, 8(%rsp) + andl $2147483647, %eax + movl %eax, 4(%rsp) + jmp .L_2TAG_PACKET_23.0.1 +.L_2TAG_PACKET_21.0.1: + pxor %xmm1, %xmm1 + movss 6648(%r8), %xmm0 + divss %xmm1, %xmm0 + movl $-8388608, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_22.0.1: + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_15.0.1: + pextrw $3, %xmm1, %edx + andl $32752, %edx + cmpl $32752, %edx + je .L_2TAG_PACKET_24.0.1 + movss 6912(%r8), %xmm2 + movss 6916(%r8), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_24.0.1: + movsd %xmm1, %xmm2 + psllq $12, %xmm2 + xorpd %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + jne .L_2TAG_PACKET_25.0.1 + cmpl $0, %ecx + je .L_2TAG_PACKET_26.0.1 + movss 6912(%r8), %xmm2 + movss 6916(%r8), %xmm3 + movss 6928(%r8), %xmm4 + movss 6932(%r8), %xmm5 + addss %xmm3, %xmm2 + addss %xmm5, %xmm4 + addss %xmm4, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_26.0.1: + movss 6928(%r8), %xmm4 + movss 6932(%r8), %xmm5 + addss %xmm5, %xmm4 + movd %xmm4, %edx + orl %eax, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_13.0.1: + addl $16, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_27.0.1 + movsd %xmm1, %xmm2 + psllq $12, %xmm2 + xorps %xmm3, %xmm3 + pcmpeqd %xmm3, %xmm2 + psrlq $16, %xmm2 + movd %xmm2, %edx + cmpl $-1, %edx + jne .L_2TAG_PACKET_19.0.1 + cmpl $0, %ecx + jne .L_2TAG_PACKET_28.0.1 + movl %eax, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_28.0.1: + movss 6920(%r8), %xmm2 + movss 6924(%r8), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_27.0.1: + movss 6912(%r8), %xmm2 + movss 6916(%r8), %xmm3 + addss %xmm3, %xmm2 + movd %xmm2, %edx + orl %eax, %edx + movl 56(%rsp), %eax + movl %edx, 8(%rsp) + andl $2147483647, %eax + movl %eax, 4(%rsp) + jmp .L_2TAG_PACKET_23.0.1 +.L_2TAG_PACKET_19.0.1: + addsd %xmm1, %xmm1 + cvtpd2ps %xmm1, %xmm0 + movd %xmm0, %edx + movl %edx, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_25.0.1: + addsd %xmm1, %xmm1 + cvtpd2ps %xmm1, %xmm0 + movd %xmm0, %edx + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_23.0.1: + movss 4(%rsp), %xmm0 + movsd 6624(%r8), %xmm1 + movsd 6632(%r8), %xmm3 + pextrw $1, %xmm0, %eax + movaps %xmm0, %xmm4 + psllq $29, %xmm0 + andpd %xmm0, %xmm1 + orpd %xmm3, %xmm1 + movsd 6592(%r8), %xmm5 + movsd 6600(%r8), %xmm6 + movsd 6608(%r8), %xmm2 + movl %eax, %edx + movl $32639, %ecx + subl %edx, %ecx + subl $128, %edx + orl %ecx, %edx + cmpl $32768, %edx + jae .L_2TAG_PACKET_29.0.1 + movl $16191, %ecx +.L_2TAG_PACKET_30.0.1: + movd %ecx, %xmm0 + movsd 4624(%r8), %xmm3 + andl $127, %eax + addl $1, %eax + andq $254, %rax + addq %rax, %rax + addq %rax, %rax + movsd 4624(%r8,%rax), %xmm7 + psrlq $16, %xmm4 + psubd %xmm0, %xmm4 + psrad $7, %xmm4 + cvtdq2pd %xmm4, %xmm4 + movsd 4096(%r8,%rax), %xmm0 + mulsd %xmm7, %xmm1 + subsd %xmm3, %xmm1 + movsd %xmm1, %xmm7 + mulsd %xmm1, %xmm5 + movsd %xmm1, %xmm3 + mulsd %xmm1, %xmm1 + addsd %xmm6, %xmm5 + mulsd 6664(%r8), %xmm4 + mulsd %xmm1, %xmm7 + mulsd %xmm1, %xmm2 + addsd %xmm3, %xmm2 + mulsd %xmm5, %xmm7 + addsd %xmm4, %xmm0 + addsd %xmm7, %xmm2 + addsd %xmm2, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + movl 8(%rsp), %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 80(%rsp), %rbx + movq 72(%rsp), %rsp + ret +.L_2TAG_PACKET_29.0.1: + movl 4(%rsp), %edx + mulss 6640(%r8), %xmm4 + movsd 6624(%r8), %xmm1 + pextrw $1, %xmm4, %eax + cvtps2pd %xmm4, %xmm0 + andpd %xmm0, %xmm1 + orpd %xmm3, %xmm1 + movl $24383, %ecx + jmp .L_2TAG_PACKET_30.0.1 + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type clogf,@function + .size clogf,.-clogf + .data +# -- End clogf + .section .rodata, "a" + .align 16 + .align 16 +clogf_table: + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .long 1440057502 + .long 1063257089 + .long 341338964 + .long 1064833554 + .long 4184355568 + .long 1065621801 + .long 2227658503 + .long 1066152307 + .long 449262470 + .long 1066510009 + .long 1570422842 + .long 1066777242 + .long 121841140 + .long 1067045544 + .long 630691842 + .long 1067281191 + .long 2711485097 + .long 1067500943 + .long 2026622491 + .long 1067619660 + .long 766078039 + .long 1067755853 + .long 4074027864 + .long 1067875476 + .long 3056660584 + .long 1067995528 + .long 3195252556 + .long 1068133258 + .long 116861598 + .long 1068254238 + .long 325086471 + .long 1068375655 + .long 296456961 + .long 1068497513 + .long 2623383041 + .long 1068559379 + .long 1681725707 + .long 1068620754 + .long 2231263004 + .long 1068682354 + .long 2815553124 + .long 1068744181 + .long 2057310944 + .long 1068806237 + .long 2095798018 + .long 1068859611 + .long 2302040698 + .long 1068922096 + .long 745232013 + .long 1068984815 + .long 659581512 + .long 1069047769 + .long 1566132617 + .long 1069101918 + .long 550036981 + .long 1069165314 + .long 2887419564 + .long 1069219844 + .long 1990183441 + .long 1069283688 + .long 3220050856 + .long 1069338605 + .long 1669613218 + .long 1069393703 + .long 2145455994 + .long 1069458213 + .long 4275830246 + .long 1069513705 + .long 1392453108 + .long 1069558451 + .long 1469915213 + .long 1069586382 + .long 2183652476 + .long 1069619086 + .long 2109656884 + .long 1069647220 + .long 636640577 + .long 1069675449 + .long 510517079 + .long 1069703773 + .long 210141498 + .long 1069732193 + .long 2537624622 + .long 1069760709 + .long 1733817001 + .long 1069789323 + .long 137854980 + .long 1069813243 + .long 3905576828 + .long 1069842036 + .long 4131810788 + .long 1069870929 + .long 3760956694 + .long 1069899922 + .long 1473082581 + .long 1069929016 + .long 926113142 + .long 1069953338 + .long 3669742467 + .long 1069982617 + .long 3711755290 + .long 1070007095 + .long 311386407 + .long 1070036564 + .long 705364525 + .long 1070066136 + .long 1973375279 + .long 1070090859 + .long 3589645072 + .long 1070115655 + .long 2425772059 + .long 1070145508 + .long 1074899574 + .long 1070170467 + .long 118003300 + .long 1070200516 + .long 691310403 + .long 1070225639 + .long 3273036717 + .long 1070250837 + .long 1226436560 + .long 1070276112 + .long 2481153995 + .long 1070306542 + .long 3227997535 + .long 1070331985 + .long 1421812646 + .long 1070357506 + .long 3386588242 + .long 1070383104 + .long 2580043380 + .long 1070408781 + .long 1068692560 + .long 1070434537 + .long 938143489 + .long 1070460372 + .long 4293333010 + .long 1070486286 + .long 373864817 + .long 1070512282 + .long 4208958430 + .long 1070538357 + .long 783121462 + .long 1070564515 + .long 870975437 + .long 1070590754 + .long 3338886172 + .long 1070606585 + .long 3772343130 + .long 1070619787 + .long 2408245143 + .long 1070630379 + .long 3811383569 + .long 1070643656 + .long 1622638721 + .long 1070656976 + .long 1290798655 + .long 1070670338 + .long 2457529556 + .long 1070681058 + .long 2398194399 + .long 1070694497 + .long 3190801979 + .long 1070707979 + .long 3352241197 + .long 1070718796 + .long 1829681364 + .long 1070732357 + .long 2568927817 + .long 1070743237 + .long 2676427515 + .long 1070756877 + .long 2882402820 + .long 1070767821 + .long 44944622 + .long 1070781542 + .long 2957945300 + .long 1070792550 + .long 1261787704 + .long 1070806352 + .long 1589923677 + .long 1070817426 + .long 3274931829 + .long 1070828529 + .long 1999843716 + .long 1070842450 + .long 1673619518 + .long 1070853620 + .long 601221319 + .long 1070864820 + .long 3763576649 + .long 1070876049 + .long 1974923437 + .long 1070890129 + .long 1096100617 + .long 1070901427 + .long 2424897952 + .long 1070912755 + .long 2376202600 + .long 1070924114 + .long 1665651958 + .long 1070935504 + .long 1014729354 + .long 1070946925 + .long 722545241 + .long 1070961245 + .long 1800682930 + .long 1070972736 + .long 1029453230 + .long 1070984259 + .long 3450874911 + .long 1070995813 + .long 1228255906 + .long 1071007400 + .long 3711032981 + .long 1071019018 + .long 3075102917 + .long 1071030669 + .long 92696812 + .long 1071042353 + .long 3897749690 + .long 1071051136 + .long 1907922160 + .long 1071062877 + .long 4023807324 + .long 1071074650 + .long 2452345726 + .long 1071086457 + .long 2292128226 + .long 1071098297 + .long 58635942 + .long 1071110171 + .long 864186929 + .long 1071122078 + .long 3555691467 + .long 1071131030 + .long 2003684347 + .long 1071142997 + .long 1479703759 + .long 1071154998 + .long 2537208015 + .long 1071164021 + .long 3699909861 + .long 1071176082 + .long 3934098706 + .long 1071188178 + .long 3885764182 + .long 1071197273 + .long 1357790931 + .long 1071209431 + .long 295956059 + .long 1071221624 + .long 4080877676 + .long 1071230791 + .long 202970280 + .long 1071243047 + .long 3977575845 + .long 1071252261 + .long 35977849 + .long 1071264580 + .long 1585496963 + .long 1071273842 + .long 375247257 + .long 1071286224 + .long 1812199574 + .long 1071295534 + .long 1876912769 + .long 1071307980 + .long 1051846544 + .long 1071317339 + .long 979589448 + .long 1071329850 + .long 71706889 + .long 1071339258 + .long 2790898835 + .long 1071351834 + .long 4013797733 + .long 1071361291 + .long 2541231151 + .long 1071370770 + .long 921733145 + .long 1071383442 + .long 508375805 + .long 1071392971 + .long 3091669954 + .long 1071402521 + .long 3343209673 + .long 1071415289 + .long 1693047557 + .long 1071424891 + .long 173861808 + .long 1071434515 + .long 3515822703 + .long 1071444160 + .long 1974837761 + .long 1071457056 + .long 1189018219 + .long 1071466754 + .long 2441946573 + .long 1071476474 + .long 1887102255 + .long 1071486217 + .long 4271031636 + .long 1071495982 + .long 876995759 + .long 1071509039 + .long 438773454 + .long 1071518858 + .long 172621632 + .long 1071528700 + .long 544035182 + .long 1071538565 + .long 2021801298 + .long 1071548453 + .long 783063308 + .long 1071558365 + .long 1598254051 + .long 1071568300 + .long 651258553 + .long 1071578259 + .long 2719315456 + .long 1071588241 + .long 3993180461 + .long 1071598247 + .long 667093936 + .long 1071608278 + .long 1823716217 + .long 1071618332 + .long 3664357648 + .long 1071628410 + .long 2393914686 + .long 1071638513 + .long 1405419566 + .long 1071646656 + .long 563652001 + .long 1071651732 + .long 1074554091 + .long 1071656820 + .long 3195405229 + .long 1071661920 + .long 2890399284 + .long 1071667033 + .long 420597586 + .long 1071672159 + .long 87278952 + .long 1071675583 + .long 1753119502 + .long 1071680729 + .long 1959759897 + .long 1071685888 + .long 975389815 + .long 1071691060 + .long 3365155278 + .long 1071696244 + .long 811309190 + .long 1071701442 + .long 1269811480 + .long 1071704914 + .long 1108583542 + .long 1071710133 + .long 1034517919 + .long 1071715365 + .long 1327340287 + .long 1071720610 + .long 1388251237 + .long 1071724114 + .long 1488234797 + .long 1071729381 + .long 2711385691 + .long 1071734661 + .long 952179194 + .long 1071738189 + .long 3255685427 + .long 1071743491 + .long 3159039803 + .long 1071748807 + .long 951558972 + .long 1071752359 + .long 3234424125 + .long 1071757697 + .long 3904573547 + .long 1071763049 + .long 2648729924 + .long 1071766625 + .long 2729250212 + .long 1071772000 + .long 2000712574 + .long 1071777389 + .long 3125257108 + .long 1071780989 + .long 3160324803 + .long 1071786401 + .long 2216316974 + .long 1071790017 + .long 3875016090 + .long 1071795452 + .long 1439520610 + .long 1071799084 + .long 1298103361 + .long 1071804543 + .long 2217517956 + .long 1071810016 + .long 1191753587 + .long 1071813673 + .long 1728773900 + .long 1071819170 + .long 747445441 + .long 1071822843 + .long 1670772213 + .long 1071826522 + .long 1471209283 + .long 1071832053 + .long 3287905877 + .long 1071835748 + .long 594038131 + .long 1071841304 + .long 3920147917 + .long 1071845015 + .long 3957142762 + .long 1071850595 + .long 826988438 + .long 1071854324 + .long 242509008 + .long 1071859929 + .long 4173610350 + .long 1071863673 + .long 2518313625 + .long 1071867425 + .long 2671523434 + .long 1071873065 + .long 387544807 + .long 1071876834 + .long 1470497767 + .long 1071880609 + .long 4269259217 + .long 1071886284 + .long 1345663925 + .long 1071890077 + .long 2159323299 + .long 1071893876 + .long 957937516 + .long 1071899588 + .long 2994656967 + .long 1071903404 + .long 556124819 + .long 1071907228 + .long 1631098658 + .long 1071912976 + .long 1368257861 + .long 1071916817 + .long 1309849279 + .long 1071920665 + .long 1567156841 + .long 1071924520 + .long 1179420986 + .long 1071930316 + .long 569448444 + .long 1071934189 + .long 669557459 + .long 1071938069 + .long 1593834700 + .long 1071941956 + .long 3166083125 + .long 1071947800 + .long 211641815 + .long 1071951706 + .long 2780675719 + .long 1071955618 + .long 2400234567 + .long 1071959538 + .long 3482927192 + .long 1071963465 + .long 1852089988 + .long 1071967400 + .long 1020849000 + .long 1071973316 + .long 1718090839 + .long 1071977269 + .long 121152472 + .long 1071981230 + .long 646346839 + .long 1071985198 + .long 3415709705 + .long 1071989173 + .long 4257004898 + .long 1071993156 + .long 3293664199 + .long 1071997147 + .long 649825382 + .long 1072001146 + .long 248887552 + .long 1072007158 + .long 2541522737 + .long 1072011175 + .long 3593780107 + .long 1072015200 + .long 3533041935 + .long 1072019233 + .long 2487426809 + .long 1072023274 + .long 585795318 + .long 1072027323 + .long 2252723088 + .long 1072031379 + .long 3323604690 + .long 1072035443 + .long 3929561382 + .long 1072039515 + .long 4202479723 + .long 1072043595 + .long 4275017539 + .long 1072047683 + .long 0 + .long 0 + .long 2969299638 + .long 1066385576 + .long 242759278 + .long 1067418267 + .long 4130528649 + .long 1067938904 + .long 3222363743 + .long 1068436016 + .long 2518406343 + .long 1068712407 + .long 2330290349 + .long 1068953810 + .long 977983493 + .long 1069191789 + .long 1848308976 + .long 1069426439 + .long 2094042057 + .long 1069602686 + .long 4162844547 + .long 1069716818 + .long 1825274911 + .long 1069829419 + .long 1890030541 + .long 1069940528 + .long 34658761 + .long 1070050185 + .long 2633258952 + .long 1070158426 + .long 1317059912 + .long 1070265289 + .long 3348798148 + .long 1070370807 + .long 1848308976 + .long 1070475015 + .long 1834892534 + .long 1070577944 + .long 3799224489 + .long 1070637860 + .long 2880153273 + .long 1070688092 + .long 4224678190 + .long 1070737729 + .long 3135315492 + .long 1070786786 + .long 1432962655 + .long 1070835276 + .long 3256639515 + .long 1070883211 + .long 2267936667 + .long 1070930605 + .long 3210218142 + .long 1070977469 + .long 513480033 + .long 1071023816 + .long 4139503392 + .long 1071069655 + .long 998420681 + .long 1071115000 + .long 2260812359 + .long 1071159859 + .long 471930696 + .long 1071204244 + .long 288677044 + .long 3218237794 + .long 1666870396 + .long 3218194329 + .long 2183652263 + .long 3218151310 + .long 1615681869 + .long 3218108728 + .long 1823715893 + .long 3218053404 + .long 4293333700 + .long 3217969934 + .long 4066729029 + .long 3217887287 + .long 943445964 + .long 3217805447 + .long 1015733272 + .long 3217724397 + .long 3707174790 + .long 3217644122 + .long 1699848676 + .long 3217564609 + .long 2339728692 + .long 3217485842 + .long 1800683248 + .long 3217407808 + .long 2201203741 + .long 3217330493 + .long 2954203727 + .long 3217253884 + .long 709476838 + .long 3217177969 + .long 2183652973 + .long 3217102734 + .long 970708496 + .long 3217025169 + .long 1669614391 + .long 3216877351 + .long 2376949106 + .long 3216730824 + .long 1566133827 + .long 3216585566 + .long 183157569 + .long 3216441555 + .long 1562411141 + .long 3216298769 + .long 2756121236 + .long 3216157188 + .long 3047046473 + .long 3216016792 + .long 3453858674 + .long 3215772531 + .long 346008798 + .long 3215496362 + .long 3559775130 + .long 3215222446 + .long 2313636156 + .long 3214950749 + .long 684243850 + .long 3214428453 + .long 1486053291 + .long 3213893718 + .long 1971906393 + .long 3212840981 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 528611360 + .long 1072660984 + .long 4034666248 + .long 1072629697 + .long 2884679527 + .long 1072599345 + .long 505290270 + .long 1072569886 + .long 1991868891 + .long 1072541280 + .long 490853405 + .long 1072513492 + .long 2298714891 + .long 1072486486 + .long 477218588 + .long 1072460231 + .long 58835168 + .long 1072434695 + .long 348240592 + .long 1072409849 + .long 3035110223 + .long 1072385665 + .long 3164712744 + .long 1072362118 + .long 1617585086 + .long 1072339183 + .long 440509466 + .long 1072316836 + .long 2500867033 + .long 1072295054 + .long 2576980378 + .long 1072273817 + .long 4241943008 + .long 1072253104 + .long 2409371898 + .long 1072232897 + .long 258732970 + .long 1072213177 + .long 409044504 + .long 1072193926 + .long 404232216 + .long 1072175128 + .long 1098712564 + .long 1072156767 + .long 2172167368 + .long 1072138828 + .long 1952257862 + .long 1072121297 + .long 1544257904 + .long 1072104160 + .long 381774871 + .long 1072087404 + .long 377579543 + .long 1072071016 + .long 1493901668 + .long 1072054984 + .long 1616385542 + .long 1072039297 + .long 731058263 + .long 1072023944 + .long 813783277 + .long 1072008914 + .long 1431655765 + .long 1071994197 + .long 3940743189 + .long 1071979783 + .long 2804876601 + .long 1071965664 + .long 2689777499 + .long 1071951830 + .long 1202590843 + .long 1071938273 + .long 1700977147 + .long 1071924984 + .long 336860180 + .long 1071911956 + .long 3169102082 + .long 1071899180 + .long 330382100 + .long 1071886651 + .long 327235604 + .long 1071874360 + .long 4213930177 + .long 1071862300 + .long 1244336319 + .long 1071850467 + .long 3181457256 + .long 1071838852 + .long 1300311200 + .long 1071827451 + .long 702812830 + .long 1071816257 + .long 3095471925 + .long 1071805264 + .long 2454267026 + .long 1071794468 + .long 2166487928 + .long 1071783863 + .long 2109808496 + .long 1071773444 + .long 2913108253 + .long 1071763206 + .long 1629125526 + .long 1071753145 + .long 293672978 + .long 1071743256 + .long 1601513229 + .long 1071733534 + .long 288737297 + .long 1071723976 + .long 286331153 + .long 1071714577 + .long 1810275472 + .long 1071705333 + .long 1337776699 + .long 1071696241 + .long 174592167 + .long 1071687297 + .long 138547332 + .long 1071678497 + .long 3539053052 + .long 1071669837 + .long 272696336 + .long 1071661316 + .long 2164392968 + .long 1071652928 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3819695742 + .long 1067482761 + .long 2998791009 + .long 1067548225 + .long 3339424991 + .long 1067613680 + .long 2710002256 + .long 1067679126 + .long 3275701428 + .long 1067744562 + .long 2908636881 + .long 1067809988 + .long 3777889398 + .long 1067875403 + .long 3759667419 + .long 1067940807 + .long 732369940 + .long 1068006200 + .long 1166616461 + .long 1068071580 + .long 2945472892 + .long 1068136947 + .long 3954480976 + .long 1068202301 + .long 2081752829 + .long 1068267642 + .long 3807999788 + .long 1068332968 + .long 2731789884 + .long 1068398280 + .long 1044477961 + .long 1068463577 + .long 1486930287 + .long 1068530218 + .long 2293016881 + .long 1068595466 + .long 201518157 + .long 1068660680 + .long 4054234584 + .long 1068725856 + .long 1246477213 + .long 1068790995 + .long 678186699 + .long 1068856093 + .long 2690594995 + .long 1068921148 + .long 3362611517 + .long 1068986159 + .long 3102162111 + .long 1069051124 + .long 2352611067 + .long 1069116041 + .long 1594134794 + .long 1069180908 + .long 1345079306 + .long 1069245723 + .long 2163300970 + .long 1069310484 + .long 352522716 + .long 1069375190 + .long 848541647 + .long 1069439838 + .long 40647312 + .long 1069504427 + .long 2216766270 + .long 1069574357 + .long 1090914384 + .long 1069638757 + .long 387601244 + .long 1069703022 + .long 3991640484 + .long 1069767144 + .long 3322489502 + .long 1069831118 + .long 3121698570 + .long 1069894936 + .long 4289964660 + .long 1069958591 + .long 3903312386 + .long 1070022077 + .long 3818449864 + .long 1070085387 + .long 2097480306 + .long 1070148515 + .long 1611694502 + .long 1070211454 + .long 1464694796 + .long 1070274198 + .long 1299612775 + .long 1070336741 + .long 1310544789 + .long 1070399077 + .long 2253168030 + .long 1070461200 + .long 1159567373 + .long 1070523105 + .long 1359373750 + .long 1070605818 + .long 908341706 + .long 1070667034 + .long 1743027350 + .long 1070727765 + .long 2055355646 + .long 1070787992 + .long 690426164 + .long 1070847697 + .long 1483247847 + .long 1070906862 + .long 392040270 + .long 1070965472 + .long 2673846014 + .long 1071023511 + .long 1384215810 + .long 1071080967 + .long 3101660631 + .long 1071137826 + .long 2094057058 + .long 1071194078 + .long 1712750594 + .long 1071249712 + .long 1411515787 + .long 1071304719 + .long 931538085 + .long 1071359091 + .long 179139065 + .long 1071412821 + .long 3387721259 + .long 1071465902 + .long 2132236852 + .long 1071544299 + .long 1942070284 + .long 1071645596 + .long 1532707802 + .long 1071695380 + .long 2294184979 + .long 1071743834 + .long 3805060714 + .long 1071790961 + .long 2215037898 + .long 1071836770 + .long 483661594 + .long 1071881273 + .long 1534679894 + .long 1071924486 + .long 1538714628 + .long 1071966430 + .long 527642555 + .long 1072007128 + .long 291339150 + .long 1072046605 + .long 2450210201 + .long 1072084888 + .long 2411367951 + .long 1072122007 + .long 681549971 + .long 1072157992 + .long 1466745541 + .long 1072192873 + .long 2845622366 + .long 1072226682 + .long 2838871438 + .long 1072275456 + .long 4200275274 + .long 1072337034 + .long 3034733530 + .long 1072394897 + .long 3207412993 + .long 1072449290 + .long 624461478 + .long 1072500450 + .long 767665908 + .long 1072548600 + .long 1110773639 + .long 1072593952 + .long 1940828530 + .long 1072636704 + .long 1911329388 + .long 1072677041 + .long 1764715788 + .long 1072704191 + .long 3332979233 + .long 1072722195 + .long 1321870254 + .long 1072739231 + .long 3657429030 + .long 1072755365 + .long 4197624557 + .long 1072770661 + .long 1512059493 + .long 1072785177 + .long 453379037 + .long 1072798965 + .long 1942345162 + .long 1072818388 + .long 4210176273 + .long 1072842164 + .long 4185644010 + .long 1072863795 + .long 679688788 + .long 1072883543 + .long 29432865 + .long 1072901630 + .long 4070721092 + .long 1072918247 + .long 2252468843 + .long 1072933561 + .long 2929724825 + .long 1072947712 + .long 1377513368 + .long 1072960824 + .long 1031632908 + .long 1072973003 + .long 2516508130 + .long 1072984342 + .long 3792452178 + .long 1072994923 + .long 3147791459 + .long 1073004818 + .long 999189752 + .long 1073014090 + .long 711011011 + .long 1073022794 + .long 15640363 + .long 1073030980 + .long 1218463589 + .long 1073042382 + .long 2538470555 + .long 1073056144 + .long 1229720947 + .long 1073068489 + .long 3115427016 + .long 1073079621 + .long 4030612557 + .long 1073089709 + .long 2728521257 + .long 1073098892 + .long 1118696283 + .long 1073107285 + .long 2682711255 + .long 1073114984 + .long 2073898081 + .long 1073122072 + .long 1403700297 + .long 1073128618 + .long 2502685617 + .long 1073134681 + .long 1531926851 + .long 1073140313 + .long 3572814411 + .long 1073145557 + .long 1695536111 + .long 1073150453 + .long 2363057203 + .long 1073155033 + .long 2873365682 + .long 1073159327 + .long 1053384691 + .long 1073165288 + .long 3270542712 + .long 1073172451 + .long 1353631484 + .long 1073178850 + .long 3511218460 + .long 1073184599 + .long 4121259284 + .long 1073189793 + .long 1193862106 + .long 1073194509 + .long 3861949790 + .long 1073198808 + .long 1486904578 + .long 1073202745 + .long 2879153715 + .long 1073206362 + .long 385353253 + .long 1073209698 + .long 1125865839 + .long 1073212783 + .long 1221361475 + .long 1073215645 + .long 2077323573 + .long 1073218307 + .long 215611373 + .long 1073220790 + .long 2347419265 + .long 1073223110 + .long 1379112765 + .long 1073225284 + .long 3891198463 + .long 1073228298 + .long 3395914051 + .long 1073231917 + .long 2799919478 + .long 1073235146 + .long 1138673476 + .long 1073238045 + .long 3408855940 + .long 1073240661 + .long 2044858738 + .long 1073243035 + .long 2578795176 + .long 1073245198 + .long 4196285314 + .long 1073247177 + .long 224877747 + .long 1073248996 + .long 3271386490 + .long 1073250671 + .long 813635989 + .long 1073252221 + .long 369829519 + .long 1073253658 + .long 1187679052 + .long 1073254994 + .long 4232586098 + .long 1073256239 + .long 426690558 + .long 1073257404 + .long 1624065902 + .long 1073258494 + .long 84029729 + .long 1073260006 + .long 700437654 + .long 1073261820 + .long 1437260555 + .long 1073263438 + .long 2813372195 + .long 1073264890 + .long 1607849324 + .long 1073266201 + .long 1011572952 + .long 1073267390 + .long 2039290225 + .long 1073268473 + .long 2435855138 + .long 1073269464 + .long 3389310384 + .long 1073270374 + .long 2790682322 + .long 1073271213 + .long 960266323 + .long 1073271989 + .long 1766929455 + .long 1073272708 + .long 627058932 + .long 1073273377 + .long 2388650377 + .long 1073274000 + .long 422252385 + .long 1073274583 + .long 2848853896 + .long 1073275128 + .long 1413754136 + .long 1073291771 + .long 3951369912 + .long 1067366481 + .long 3951369912 + .long 3214850129 + .long 0 + .long 3218079744 + .long 1431655765 + .long 1070945621 + .long 0 + .long 3219128320 + .long 0 + .long 0 + .long 4294967295 + .long 1048575 + .long 0 + .long 1072693248 + .long 1602224128 + .long 1602224128 + .long 1065353216 + .long 1065353216 + .long 4294967295 + .long 1048575 + .long 4277811695 + .long 1072049730 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 0 + .long 1072693248 + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .long 0 + .long 0 + .long 12982 + .long 1071644672 + .long 3503368358 + .long 3218079743 + .long 300625100 + .long 1069897045 + .long 3513684914 + .long 3217031970 + .long 1735899863 + .long 1069129695 + .long 0 + .long 0 + .long 2147483647 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 2147418112 + .long 0 + .long 2147418112 + .long 0 + .long 32768 + .long 0 + .long 32768 + .long 1413754136 + .long 3221823995 + .long 0 + .long 0 + .long 2576980378 + .long 1070176665 + .long 1431655765 + .long 3218429269 + .long 8388608 + .long 0 + .long 0 + .long 0 + .long 0 + .long 940572672 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 1070141402 + .long 866263400 + .long 1078530010 + .long 874652008 + .long 1061752794 + .long 857874792 + .long 0 + .long 0 + .long 1431655765 + .long 3218429269 + .long 0 + .long 0 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type clogf_table,@object + .size clogf_table,6976 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/clogl.S b/external/sgx_libm/intel64/clogl.S new file mode 100644 index 0000000000..8f4023dcf6 --- /dev/null +++ b/external/sgx_libm/intel64/clogl.S @@ -0,0 +1,783 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "clogl.c" + .text +..TXTST0: +# -- Begin clogl + .text + .align 16,0x90 + .globl clogl +clogl: +# parameter 1: 192 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_clogl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + subq $176, %rsp + .cfi_def_cfa_offset 192 + xorb %r13b, %r13b + fldt .L_2il0floatpacket.6(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 160(%rsp) + fstpt 128(%rsp) + fldt 128(%rsp) + fstpt 144(%rsp) +..B1.2: + fnstcw 114(%rsp) +..B1.3: + movzwl 114(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 112(%rsp) +..B1.5: + fldcw 112(%rsp) +..B1.6: + movb $1, %r13b +..B1.7: + movzwl 200(%rsp), %edx + andl $32767, %edx + movzwl 216(%rsp), %eax + andl $32767, %eax + cmpl $32767, %edx + jge ..B1.47 +..B1.8: + cmpl $32767, %eax + jge ..B1.88 +..B1.9: + testl %edx, %edx + jne ..B1.15 +..B1.10: + cmpl $0, 196(%rsp) + jne ..B1.15 +..B1.11: + cmpl $0, 192(%rsp) + jne ..B1.15 +..B1.12: + testl %eax, %eax + jne ..B1.15 +..B1.13: + cmpl $0, 212(%rsp) + jne ..B1.15 +..B1.14: + cmpl $0, 208(%rsp) + je ..B1.46 +..B1.15: + fldt 192(%rsp) + fld %st(0) + fabs + fstpt (%rsp) + fldt (%rsp) + fldt 208(%rsp) + fld %st(0) + fabs + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 8(%rsp), %eax + movzwl 24(%rsp), %edx + andl $32767, %eax + andl $32767, %edx + cmpl %edx, %eax + jl ..B1.20 +..B1.16: + jne ..B1.21 +..B1.17: + movl 4(%rsp), %edx + movl 20(%rsp), %ecx + cmpl %ecx, %edx + jb ..B1.20 +..B1.18: + jne ..B1.21 +..B1.19: + movl (%rsp), %edx + cmpl 16(%rsp), %edx + jae ..B1.21 +..B1.20: + fstpt (%rsp) + fldt (%rsp) + movzwl 8(%rsp), %eax + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + andl $32767, %eax +..B1.21: + cmpl $16382, %eax + jg ..B1.26 +..B1.22: + jne ..B1.43 +..B1.23: + lea 16+_CONSTANTS(%rip), %rcx + movl 4(%rsp), %edx + cmpl 4(%rcx), %edx + ja ..B1.26 +..B1.24: + jne ..B1.43 +..B1.25: + movl (%rcx), %edx + cmpl (%rsp), %edx + ja ..B1.43 +..B1.26: + cmpl $16383, %eax + jl ..B1.31 +..B1.27: + jne ..B1.43 +..B1.28: + lea 32+_CONSTANTS(%rip), %rcx + movl 4(%rsp), %edx + cmpl 4(%rcx), %edx + jb ..B1.31 +..B1.29: + jne ..B1.43 +..B1.30: + movl (%rsp), %edx + cmpl (%rcx), %edx + ja ..B1.43 +..B1.31: + movzwl 24(%rsp), %esi + andl $32767, %esi + cmpl $8256, %esi + jg ..B1.36 +..B1.32: + jne ..B1.37 +..B1.33: + lea 80+_CONSTANTS(%rip), %rcx + movl 20(%rsp), %edx + cmpl 4(%rcx), %edx + ja ..B1.36 +..B1.34: + jne ..B1.37 +..B1.35: + movl 16(%rsp), %edx + cmpl (%rcx), %edx + jbe ..B1.37 +..B1.36: + fld %st(2) + lea _CONSTANTS(%rip), %rdx + fmul %st(3), %st + fld %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fldt .L_2il0floatpacket.7(%rip) + fsubr %st, %st(1) + fxch %st(1) + fabs + fldt (%rdx) + fcomip %st(1), %st + ja ..B1.38 + jmp ..B1.89 +..B1.37: + fldt .L_2il0floatpacket.7(%rip) + fld %st(3) + fmul %st(4), %st + lea _CONSTANTS(%rip), %rdx + fsub %st(1), %st + fabs + fldt (%rdx) + fcomip %st(1), %st + jbe ..B1.89 +..B1.38: + cmpl $16183, %esi + jl ..B1.40 +..B1.39: + fstp %st(0) + fldt .L_2il0floatpacket.11(%rip) + fld %st(4) + fxch %st(6) + fstpt 16(%rsp) + lea 16+_Q1(%rip), %rax + fxch %st(3) + fstpt (%rsp) + lea _Q1(%rip), %rdx + fldt .L_2il0floatpacket.10(%rip) + fmul %st(4), %st + fsub %st, %st(5) + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fld %st(2) + fxch %st(5) + fsub %st(6), %st + fxch %st(4) + fmul %st, %st(6) + fxch %st(4) + fmul %st, %st(6) + fmul %st(0), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fldt .L_2il0floatpacket.10(%rip) + fmul %st(4), %st + fsub %st, %st(6) + fsubp %st, %st(6) + fld %st(5) + fmul %st(6), %st + fxch %st(4) + fsub %st(6), %st + fxch %st(5) + fmulp %st, %st(6) + fxch %st(4) + fmul %st, %st(5) + fxch %st(5) + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(5) + fmul %st(0), %st + fstpt 64(%rsp) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fsub %st(2), %st + fsubr %st, %st(3) + fld %st(1) + fsubp %st, %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(5), %st + fld %st(0) + faddp %st, %st(5) + fld %st(4) + faddp %st, %st(4) + fxch %st(3) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt 64(%rsp) + faddp %st, %st(1) + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fmulp %st, %st(1) + fld %st(4) + fsub %st(3), %st + fsubr %st, %st(7) + fsubr %st(5), %st + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(6) + fxch %st(5) + faddp %st, %st(2) + fld %st(3) + fsub %st(3), %st + fldt 48(%rsp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(5), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 80(%rsp) + fld %st(0) + fsub %st(4), %st + fldt 32(%rsp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(5) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fld %st(3) + fsub %st(3), %st + fldt 64(%rsp) + fsub %st(1), %st + fxch %st(1) + fsubr %st(5), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.9(%rip) + fmulp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 128(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fldt 32(%rsp) + fstpt (%rsp) + fldt 48(%rsp) + fstpt 16(%rsp) + call atan2l@PLT + jmp ..B1.86 + .cfi_def_cfa_offset 192 +..B1.40: + cmpl $16383, %eax + je ..B1.55 +..B1.41: + fstp %st(2) + fxch %st(1) + fstpt 96(%rsp) +..B1.42: + fldt .L_2il0floatpacket.10(%rip) + lea 16+_Q1(%rip), %rax + fmul %st(3), %st + fld %st(3) + lea _Q1(%rip), %rdx + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fsubp %st, %st(2) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.11(%rip) + fmulp %st, %st(1) + fmul %st(3), %st + fld %st(0) + fxch %st(4) + fmul %st(0), %st + fadd %st, %st(4) + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(1) + fld %st(1) + fadd %st(4), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(4) + faddp %st, %st(3) + fld %st(0) + fmul %st(1), %st + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fldt .L_2il0floatpacket.9(%rip) + fmulp %st, %st(2) + fxch %st(1) + fstpt 128(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT + jmp ..B1.86 + .cfi_def_cfa_offset 192 +..B1.43: + fstp %st(2) + fstp %st(1) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + lea 64(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_clogl.11: + call __libm_hypot2l_k80@PLT +..___tag_value_clogl.12: +..B1.82: + addq $32, %rsp + .cfi_def_cfa_offset 192 +..B1.44: + lea 48+_CONSTANTS(%rip), %rax + lea 64+_CONSTANTS(%rip), %rdx + fldt (%rax) + fmul %st(1), %st + fstpt 16(%rsp) + fldt (%rdx) + fmulp %st, %st(1) + fstpt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fldt 64(%rsp) + lea 96(%rsp), %rdi + fstpt (%rsp) + fldt -16(%rdi) + fstpt 16(%rsp) +..___tag_value_clogl.15: + call __libm_logl_k80@PLT +..___tag_value_clogl.16: +..B1.83: + addq $32, %rsp + .cfi_def_cfa_offset 192 +..B1.45: + fldt .L_2il0floatpacket.9(%rip) + fmulp %st, %st(1) + fldt 64(%rsp) + fmul %st(1), %st + fldt 80(%rsp) + fmulp %st, %st(2) + fldt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt (%rsp) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 128(%rsp) + fldt 208(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fldt 224(%rsp) + fstpt 16(%rsp) + call atan2l@PLT + jmp ..B1.86 + .cfi_def_cfa_offset 192 +..B1.46: + fldt 208(%rsp) + movsd .L_2il0floatpacket.8(%rip), %xmm1 + pxor %xmm0, %xmm0 + divsd %xmm0, %xmm1 + movsd %xmm1, (%rsp) + fldl (%rsp) + fstpt 128(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fldt 224(%rsp) + fstpt 16(%rsp) + call atan2l@PLT + jmp ..B1.86 + .cfi_def_cfa_offset 192 +..B1.47: + je ..B1.72 +..B1.48: + cmpl $32767, %eax + je ..B1.66 +..B1.49: + fldt 208(%rsp) + lea 96+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 128(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fldt 224(%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B1.86: + addq $32, %rsp + .cfi_def_cfa_offset 192 + fstpt 144(%rsp) +..B1.50: + testb %r13b, %r13b + je ..B1.52 +..B1.51: + fldcw 114(%rsp) +..B1.52: + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.65 +..B1.53: + fldt 128(%rsp) + fldt 144(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.54: + addq $176, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 192 + .cfi_offset 13, -16 +..B1.55: + cmpl $-2147483648, 4(%rsp) + jne ..B1.41 +..B1.57: + cmpl $0, (%rsp) + jne ..B1.41 +..B1.59: + fstp %st(0) + fstp %st(0) + fstp %st(2) + fldt .L_2il0floatpacket.9(%rip) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + movzwl 104(%rsp), %eax + testl $32767, %eax + jne ..B1.63 +..B1.60: + cmpl $0, 100(%rsp) + jne ..B1.62 +..B1.61: + cmpl $0, 96(%rsp) + je ..B1.63 +..B1.62: + lea 112+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st(0), %st + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) +..B1.63: + fstpt 128(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT + jmp ..B1.86 + .cfi_def_cfa_offset 192 +..B1.64: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.65: + call __stack_chk_fail@PLT +..B1.66: + cmpl $-2147483648, 212(%rsp) + jne ..B1.68 +..B1.67: + cmpl $0, 208(%rsp) + je ..B1.49 +..B1.68: + fldt 208(%rsp) + cmpl $32767, %edx + fmul %st(0), %st + fstpt 144(%rsp) + fldt 144(%rsp) + je ..B1.70 +..B1.69: + fstpt 128(%rsp) + jmp ..B1.50 +..B1.70: + movq $0x8000000000000000, %rax + cmpq 192(%rsp), %rax + jne ..B1.69 +..B1.71: + fstp %st(0) + fldt 192(%rsp) + fmul %st(0), %st + fstpt 128(%rsp) + jmp ..B1.50 +..B1.72: + cmpl $-2147483648, 196(%rsp) + jne ..B1.74 +..B1.73: + cmpl $0, 192(%rsp) + je ..B1.48 +..B1.74: + fldt 192(%rsp) + cmpl $32767, %eax + fld %st(0) + fmul %st(1), %st + fstpt 144(%rsp) + je ..B1.76 +..B1.75: + fldt 208(%rsp) + fmulp %st, %st(1) + fstpt 128(%rsp) + jmp ..B1.50 +..B1.76: + movq $0x8000000000000000, %rax + cmpq 208(%rsp), %rax + jne ..B1.75 +..B1.77: + fstp %st(0) + fldt 208(%rsp) + fmul %st(0), %st + fstpt 128(%rsp) + jmp ..B1.50 +..B1.88: + cmpl $32767, %edx + je ..B1.72 + jmp ..B1.48 +..B1.89: + fstp %st(0) + fstp %st(0) + jmp ..B1.43 + .align 16,0x90 + .cfi_endproc + .type clogl,@function + .size clogl,.-clogl + .data +# -- End clogl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,16 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 37342 + .word 47265 + .word 62214 + .word 46340 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 65535 + .word 31 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53710 + .word 6135 + .word 45426 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 505 + .word 55756 + .word 58609 + .word 48341 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8256 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,128 + .align 2 +_Q1: + .word 3134 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 49331 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/complex_real.S b/external/sgx_libm/intel64/complex_real.S new file mode 100644 index 0000000000..b6eb61712d --- /dev/null +++ b/external/sgx_libm/intel64/complex_real.S @@ -0,0 +1,322 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "complex_real.c" + .text +..TXTST0: +# -- Begin __libm_internal_isinf + .text + .align 16,0x90 + .globl __libm_internal_isinf +__libm_internal_isinf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___libm_internal_isinf.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + jne ..B1.4 +..B1.2: + cmpl $0, -8(%rsp) + jne ..B1.4 +..B1.3: + movl $1, %eax + ret +..B1.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isinf,@function + .size __libm_internal_isinf,.-__libm_internal_isinf + .data +# -- End __libm_internal_isinf + .text +# -- Begin __libm_internal_ispinf + .text + .align 16,0x90 + .globl __libm_internal_ispinf +__libm_internal_ispinf: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value___libm_internal_ispinf.4: +..L5: + + movsd %xmm0, -8(%rsp) + cmpl $2146435072, -4(%rsp) + jne ..B2.4 +..B2.2: + cmpl $0, -8(%rsp) + jne ..B2.4 +..B2.3: + movl $1, %eax + ret +..B2.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_ispinf,@function + .size __libm_internal_ispinf,.-__libm_internal_ispinf + .data +# -- End __libm_internal_ispinf + .text +# -- Begin __libm_internal_isninf + .text + .align 16,0x90 + .globl __libm_internal_isninf +__libm_internal_isninf: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___libm_internal_isninf.7: +..L8: + + movsd %xmm0, -8(%rsp) + cmpl $-1048576, -4(%rsp) + jne ..B3.4 +..B3.2: + cmpl $0, -8(%rsp) + jne ..B3.4 +..B3.3: + movl $1, %eax + ret +..B3.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isninf,@function + .size __libm_internal_isninf,.-__libm_internal_isninf + .data +# -- End __libm_internal_isninf + .text +# -- Begin __libm_internal_isnan + .text + .align 16,0x90 + .globl __libm_internal_isnan +__libm_internal_isnan: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value___libm_internal_isnan.10: +..L11: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + movl %edx, %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + jne ..B4.5 +..B4.2: + testl $1048575, %edx + jne ..B4.4 +..B4.3: + cmpl $0, -8(%rsp) + je ..B4.5 +..B4.4: + movl $1, %eax + ret +..B4.5: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isnan,@function + .size __libm_internal_isnan,.-__libm_internal_isnan + .data +# -- End __libm_internal_isnan + .text +# -- Begin __libm_internal_isposzero + .text + .align 16,0x90 + .globl __libm_internal_isposzero +__libm_internal_isposzero: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___libm_internal_isposzero.13: +..L14: + + movsd %xmm0, -8(%rsp) + cmpl $0, -4(%rsp) + jne ..B5.4 +..B5.2: + cmpl $0, -8(%rsp) + jne ..B5.4 +..B5.3: + movl $1, %eax + ret +..B5.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isposzero,@function + .size __libm_internal_isposzero,.-__libm_internal_isposzero + .data +# -- End __libm_internal_isposzero + .text +# -- Begin __libm_internal_iszero + .text + .align 16,0x90 + .globl __libm_internal_iszero +__libm_internal_iszero: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value___libm_internal_iszero.16: +..L17: + + movsd %xmm0, -8(%rsp) + testl $2147483647, -4(%rsp) + jne ..B6.4 +..B6.2: + cmpl $0, -8(%rsp) + jne ..B6.4 +..B6.3: + movl $1, %eax + ret +..B6.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_iszero,@function + .size __libm_internal_iszero,.-__libm_internal_iszero + .data +# -- End __libm_internal_iszero + .text +# -- Begin __libm_internal_isnegzero + .text + .align 16,0x90 + .globl __libm_internal_isnegzero +__libm_internal_isnegzero: +# parameter 1: %xmm0 +..B7.1: + .cfi_startproc +..___tag_value___libm_internal_isnegzero.19: +..L20: + + movsd %xmm0, -8(%rsp) + cmpl $-2147483648, -4(%rsp) + jne ..B7.4 +..B7.2: + cmpl $0, -8(%rsp) + jne ..B7.4 +..B7.3: + movl $1, %eax + ret +..B7.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isnegzero,@function + .size __libm_internal_isnegzero,.-__libm_internal_isnegzero + .data +# -- End __libm_internal_isnegzero + .text +# -- Begin __libm_internal_isnzfinite + .text + .align 16,0x90 + .globl __libm_internal_isnzfinite +__libm_internal_isnzfinite: +# parameter 1: %xmm0 +..B8.1: + .cfi_startproc +..___tag_value___libm_internal_isnzfinite.22: +..L23: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + movl %edx, %eax + andl $2146435072, %eax + cmpl $2146435072, %eax + jae ..B8.4 +..B8.2: + andl $2147483647, %edx + orl -8(%rsp), %edx + je ..B8.4 +..B8.3: + movl $1, %eax + ret +..B8.4: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isnzfinite,@function + .size __libm_internal_isnzfinite,.-__libm_internal_isnzfinite + .data +# -- End __libm_internal_isnzfinite + .text +# -- Begin __libm_internal_isfinite + .text + .align 16,0x90 + .globl __libm_internal_isfinite +__libm_internal_isfinite: +# parameter 1: %xmm0 +..B9.1: + .cfi_startproc +..___tag_value___libm_internal_isfinite.25: +..L26: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2146435072, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __libm_internal_isfinite,@function + .size __libm_internal_isfinite,.-__libm_internal_isfinite + .data +# -- End __libm_internal_isfinite + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/conj.S b/external/sgx_libm/intel64/conj.S new file mode 100644 index 0000000000..91bc92551e --- /dev/null +++ b/external/sgx_libm/intel64/conj.S @@ -0,0 +1,72 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "conj.c" + .text +..TXTST0: +# -- Begin conj + .text + .align 16,0x90 + .globl conj +conj: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_conj.1: +..L2: + + xorps .L_2il0floatpacket.0(%rip), %xmm1 + ret + .align 16,0x90 + .cfi_endproc + .type conj,@function + .size conj,.-conj + .data +# -- End conj + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/conjf.S b/external/sgx_libm/intel64/conjf.S new file mode 100644 index 0000000000..eb0710b0fc --- /dev/null +++ b/external/sgx_libm/intel64/conjf.S @@ -0,0 +1,78 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "conjf.c" + .text +..TXTST0: +# -- Begin conjf + .text + .align 16,0x90 + .globl conjf +conjf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_conjf.1: +..L2: + + movsd %xmm0, -8(%rsp) + pxor %xmm2, %xmm2 + movss -4(%rsp), %xmm1 + xorps .L_2il0floatpacket.0(%rip), %xmm1 + movss -8(%rsp), %xmm0 + movss %xmm1, %xmm2 + unpcklps %xmm2, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type conjf,@function + .size conjf,.-conjf + .data +# -- End conjf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .long 0x80000000,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/conjl.S b/external/sgx_libm/intel64/conjl.S new file mode 100644 index 0000000000..a5a6ee7cdc --- /dev/null +++ b/external/sgx_libm/intel64/conjl.S @@ -0,0 +1,97 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "conjl.c" + .text +..TXTST0: +# -- Begin conjl + .text + .align 16,0x90 + .globl conjl +conjl: +# parameter 1: 16 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_conjl.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + fldt 16(%rsp) + fldt 32(%rsp) + movq %fs:40, %rax + fchs + xorq %rsp, %rax + movq %rax, (%rsp) + fxch %st(1) + movq (%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B1.4 +..B1.2: + movq (%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.4 +..B1.3: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B1.4: + fstp %st(0) + fstp %st(0) + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type conjl,@function + .size conjl,.-conjl + .data +# -- End conjl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/copysign_gen.S b/external/sgx_libm/intel64/copysign_gen.S new file mode 100644 index 0000000000..c3a9c73236 --- /dev/null +++ b/external/sgx_libm/intel64/copysign_gen.S @@ -0,0 +1,89 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "copysign_gen.c" + .text +..TXTST0: +# -- Begin copysign + .text + .align 16,0x90 + .globl copysign +copysign: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_copysign.1: +..L2: + + lea _ones(%rip), %rax + movsd %xmm1, -24(%rsp) + movl -20(%rsp), %edx + andl $-2147483648, %edx + mulsd (%rax), %xmm0 + movsd (%rax), %xmm2 + mulsd %xmm2, %xmm1 + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %ecx + andl $2147483647, %ecx + orl %edx, %ecx + movl %ecx, -4(%rsp) + movsd %xmm1, -16(%rsp) + movsd -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type copysign,@function + .size copysign,.-copysign + .data +# -- End copysign + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/copysignf_gen.S b/external/sgx_libm/intel64/copysignf_gen.S new file mode 100644 index 0000000000..7626c5bb8e --- /dev/null +++ b/external/sgx_libm/intel64/copysignf_gen.S @@ -0,0 +1,73 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "copysignf_gen.c" + .text +..TXTST0: +# -- Begin copysignf + .text + .align 16,0x90 + .globl copysignf +copysignf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_copysignf.1: +..L2: + + movd %xmm1, %eax + movd %xmm0, %edx + movl %eax, -8(%rsp) + andl $2147483647, %edx + andl $-2147483648, %eax + orl %eax, %edx + movl %edx, -4(%rsp) + movss -4(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type copysignf,@function + .size copysignf,.-copysignf + .data +# -- End copysignf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/copysignl.S b/external/sgx_libm/intel64/copysignl.S new file mode 100644 index 0000000000..74375e80b6 --- /dev/null +++ b/external/sgx_libm/intel64/copysignl.S @@ -0,0 +1,119 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "copysignl.c" + .text +..TXTST0: +# -- Begin copysignl + .text + .align 16,0x90 + .globl copysignl +copysignl: +# parameter 1: 64 + %rsp +# parameter 2: 80 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_copysignl.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %sil, %sil + fldt 64(%rsp) + fstpt (%rsp) +..B1.2: + fnstcw 50(%rsp) +..B1.3: + movzwl 50(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 48(%rsp) +..B1.5: + fldcw 48(%rsp) +..B1.6: + movb $1, %sil +..B1.7: + fldt 80(%rsp) + lea _ones(%rip), %rax + fldt (%rsp) + movb 89(%rsp), %dl + andb $-128, %dl + fldl (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt 32(%rsp) + fmulp %st, %st(1) + movb 41(%rsp), %cl + andb $127, %cl + orb %dl, %cl + fstpt 16(%rsp) + testb %sil, %sil + movb %cl, 41(%rsp) + je ..B1.9 +..B1.8: + fldcw 50(%rsp) +..B1.9: + fldt 32(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type copysignl,@function + .size copysignl,.-copysignl + .data +# -- End copysignl + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cos_gen.S b/external/sgx_libm/intel64/cos_gen.S new file mode 100644 index 0000000000..80d3955cf1 --- /dev/null +++ b/external/sgx_libm/intel64/cos_gen.S @@ -0,0 +1,1132 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cos_gen.c" + .text +..TXTST0: +# -- Begin cos + .text + .align 16,0x90 + .globl cos +cos: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cos.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) +..B1.2: + pextrw $3, %xmm0, %eax + andw $32767, %ax + subw $12336, %ax + cmpw $4293, %ax + ja .L_2TAG_PACKET_0.0.1 + movsd PI32INV(%rip), %xmm1 + mulsd %xmm0, %xmm1 + movapd ONEHALF(%rip), %xmm5 + movsd SIGN_MASK(%rip), %xmm4 + andpd %xmm0, %xmm4 + orps %xmm4, %xmm5 + addpd %xmm5, %xmm1 + cvttsd2si %xmm1, %edx + cvtsi2sd %edx, %xmm1 + movapd P_2(%rip), %xmm2 + movsd P_1(%rip), %xmm3 + mulsd %xmm1, %xmm3 + unpcklpd %xmm1, %xmm1 + addq $1865232, %rdx + movsd %xmm0, %xmm4 + andq $63, %rdx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shlq $5, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subsd %xmm3, %xmm0 + mulsd P_3(%rip), %xmm1 + subsd %xmm3, %xmm4 + movsd 8(%rax), %xmm7 + unpcklpd %xmm0, %xmm0 + movsd %xmm4, %xmm3 + subsd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + movapd SC_2(%rip), %xmm6 + mulsd %xmm4, %xmm7 + subsd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subsd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subsd %xmm3, %xmm1 + movsd 24(%rax), %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm7 + mulsd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulsd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulsd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movsd %xmm3, %xmm0 + addsd 8(%rax), %xmm3 + mulpd %xmm7, %xmm1 + movsd %xmm4, %xmm7 + addsd %xmm3, %xmm4 + addpd %xmm5, %xmm6 + movsd 8(%rax), %xmm5 + subsd %xmm3, %xmm5 + subsd %xmm4, %xmm3 + addsd 16(%rax), %xmm1 + mulpd %xmm2, %xmm6 + addsd %xmm5, %xmm0 + addsd %xmm7, %xmm3 + addsd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + addsd %xmm6, %xmm0 + unpckhpd %xmm6, %xmm6 + addsd %xmm6, %xmm0 + addsd %xmm4, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + jg .L_2TAG_PACKET_1.0.1 + pextrw $3, %xmm0, %eax + andw $32767, %ax + pinsrw $3, %eax, %xmm0 + movsd ONE(%rip), %xmm1 + subsd %xmm0, %xmm1 + movsd %xmm1, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_2.0.1 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + subl $16224, %ecx + shrl $7, %ecx + andl $65532, %ecx + lea PI_INV_TABLE(%rip), %r11 + addq %r11, %rcx + movd %xmm0, %rax + movl 20(%rcx), %r10d + movl 24(%rcx), %r8d + movl %eax, %edx + shrq $21, %rax + orl $-2147483648, %eax + shrl $11, %eax + movl %r10d, %r9d + imulq %rdx, %r10 + imulq %rax, %r9 + imulq %rax, %r8 + movl 16(%rcx), %esi + movl 12(%rcx), %edi + movl %r10d, %r11d + shrq $32, %r10 + addq %r10, %r9 + addq %r8, %r11 + movl %r11d, %r8d + shrq $32, %r11 + addq %r11, %r9 + movl %esi, %r10d + imulq %rdx, %rsi + imulq %rax, %r10 + movl %edi, %r11d + imulq %rdx, %rdi + movl %esi, %ebx + shrq $32, %rsi + addq %rbx, %r9 + movl %r9d, %ebx + shrq $32, %r9 + addq %rsi, %r10 + addq %r9, %r10 + shlq $32, %rbx + orq %rbx, %r8 + imulq %rax, %r11 + movl 8(%rcx), %r9d + movl 4(%rcx), %esi + movl %edi, %ebx + shrq $32, %rdi + addq %rbx, %r10 + movl %r10d, %ebx + shrq $32, %r10 + addq %rdi, %r11 + addq %r10, %r11 + movq %r9, %rdi + imulq %rdx, %r9 + imulq %rax, %rdi + movl %r9d, %r10d + shrq $32, %r9 + addq %r10, %r11 + movl %r11d, %r10d + shrq $32, %r11 + addq %r9, %rdi + addq %r11, %rdi + movq %rsi, %r9 + imulq %rdx, %rsi + imulq %rax, %r9 + shlq $32, %r10 + orq %rbx, %r10 + movl (%rcx), %eax + movl %esi, %r11d + shrq $32, %rsi + addq %r11, %rdi + movl %edi, %r11d + shrq $32, %rdi + addq %rsi, %r9 + addq %rdi, %r9 + imulq %rax, %rdx + pextrw $3, %xmm0, %ebx + lea PI_INV_TABLE(%rip), %rdi + subq %rdi, %rcx + addl %ecx, %ecx + addl %ecx, %ecx + addl %ecx, %ecx + addl $19, %ecx + movl $32768, %esi + andl %ebx, %esi + shrl $4, %ebx + andl $2047, %ebx + subl $1023, %ebx + subl %ebx, %ecx + addq %rdx, %r9 + movl %ecx, %edx + addl $32, %edx + cmpl $1, %ecx + jl .L_2TAG_PACKET_3.0.1 + negl %ecx + addl $29, %ecx + shll %cl, %r9d + movl %r9d, %edi + andl $536870911, %r9d + testl $268435456, %r9d + jne .L_2TAG_PACKET_4.0.1 + shrl %cl, %r9d + movl $0, %ebx + shlq $32, %r9 + orq %r11, %r9 +.L_2TAG_PACKET_5.0.1: +.L_2TAG_PACKET_6.0.1: + cmpq $0, %r9 + je .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_8.0.1: + bsr %r9, %r11 + movl $29, %ecx + subl %r11d, %ecx + jle .L_2TAG_PACKET_9.0.1 + shlq %cl, %r9 + movq %r10, %rax + shlq %cl, %r10 + addl %ecx, %edx + negl %ecx + addl $64, %ecx + shrq %cl, %rax + shrq %cl, %r8 + orq %rax, %r9 + orq %r8, %r10 +.L_2TAG_PACKET_10.0.1: + cvtsi2sdq %r9, %xmm0 + shrq $1, %r10 + cvtsi2sdq %r10, %xmm3 + xorpd %xmm4, %xmm4 + shll $4, %edx + negl %edx + addl $16368, %edx + orl %esi, %edx + xorl %ebx, %edx + pinsrw $3, %edx, %xmm4 + movsd PI_4(%rip), %xmm2 + movsd 8+PI_4(%rip), %xmm6 + xorpd %xmm5, %xmm5 + subl $1008, %edx + pinsrw $3, %edx, %xmm5 + mulsd %xmm4, %xmm0 + shll $16, %esi + sarl $31, %esi + mulsd %xmm5, %xmm3 + movsd %xmm0, %xmm1 + mulsd %xmm2, %xmm0 + shrl $29, %edi + addsd %xmm3, %xmm1 + mulsd %xmm2, %xmm3 + addl %esi, %edi + xorl %esi, %edi + mulsd %xmm1, %xmm6 + movl %edi, %eax + addsd %xmm3, %xmm6 + movsd %xmm0, %xmm2 + addsd %xmm6, %xmm0 + subsd %xmm0, %xmm2 + addsd %xmm2, %xmm6 +.L_2TAG_PACKET_11.0.1: + movsd PI32INV(%rip), %xmm1 + mulsd %xmm0, %xmm1 + movq ONEHALF(%rip), %xmm5 + movq SIGN_MASK(%rip), %xmm4 + andpd %xmm0, %xmm4 + orps %xmm4, %xmm5 + addpd %xmm5, %xmm1 + cvttsd2si %xmm1, %rdx + cvtsi2sdq %rdx, %xmm1 + movsd P_1(%rip), %xmm3 + movapd P_2(%rip), %xmm2 + mulsd %xmm1, %xmm3 + unpcklpd %xmm1, %xmm1 + shll $3, %eax + addl $1865232, %edx + movsd %xmm0, %xmm4 + addl %eax, %edx + andl $63, %edx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shll $5, %edx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subsd %xmm3, %xmm0 + mulsd P_3(%rip), %xmm1 + subsd %xmm3, %xmm4 + movsd 8(%rax), %xmm7 + unpcklpd %xmm0, %xmm0 + movsd %xmm4, %xmm3 + subsd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + mulsd %xmm4, %xmm7 + subsd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subsd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subsd %xmm3, %xmm1 + movsd 24(%rax), %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm7 + subsd %xmm6, %xmm1 + movapd SC_2(%rip), %xmm6 + mulsd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulsd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulsd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movsd %xmm3, %xmm0 + addsd 8(%rax), %xmm3 + mulpd %xmm7, %xmm1 + movsd %xmm4, %xmm7 + addsd %xmm3, %xmm4 + addpd %xmm5, %xmm6 + movsd 8(%rax), %xmm5 + subsd %xmm3, %xmm5 + subsd %xmm4, %xmm3 + addsd 16(%rax), %xmm1 + mulpd %xmm2, %xmm6 + addsd %xmm0, %xmm5 + addsd %xmm7, %xmm3 + addsd %xmm5, %xmm1 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + unpckhpd %xmm6, %xmm6 + movsd %xmm4, %xmm0 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_7.0.1: + addl $64, %edx + movq %r10, %r9 + movq %r8, %r10 + movq $0, %r8 + cmpq $0, %r9 + jne .L_2TAG_PACKET_8.0.1 + addl $64, %edx + movq %r10, %r9 + movq %r8, %r10 + cmpq $0, %r9 + jne .L_2TAG_PACKET_8.0.1 + xorpd %xmm0, %xmm0 + xorpd %xmm6, %xmm6 + jmp .L_2TAG_PACKET_11.0.1 +.L_2TAG_PACKET_9.0.1: + je .L_2TAG_PACKET_10.0.1 + negl %ecx + shrq %cl, %r10 + movq %r9, %rax + shrq %cl, %r9 + subl %ecx, %edx + negl %ecx + addl $64, %ecx + shlq %cl, %rax + orq %rax, %r10 + jmp .L_2TAG_PACKET_10.0.1 +.L_2TAG_PACKET_3.0.1: + negl %ecx + shlq $32, %r9 + orq %r11, %r9 + shlq %cl, %r9 + movq %r9, %rdi + testl $-2147483648, %r9d + jne .L_2TAG_PACKET_12.0.1 + shrl %cl, %r9d + movl $0, %ebx + shrq $3, %rdi + jmp .L_2TAG_PACKET_6.0.1 +.L_2TAG_PACKET_4.0.1: + shrl %cl, %r9d + movl $536870912, %ebx + shrl %cl, %ebx + shlq $32, %r9 + orq %r11, %r9 + shlq $32, %rbx + addl $536870912, %edi + movq $0, %rcx + movq $0, %r11 + subq %r8, %rcx + sbbq %r10, %r11 + sbbq %r9, %rbx + movq %rcx, %r8 + movq %r11, %r10 + movq %rbx, %r9 + movl $32768, %ebx + jmp .L_2TAG_PACKET_5.0.1 +.L_2TAG_PACKET_12.0.1: + shrl %cl, %r9d + movq $0x100000000, %rbx + shrq %cl, %rbx + movq $0, %rcx + movq $0, %r11 + subq %r8, %rcx + sbbq %r10, %r11 + sbbq %r9, %rbx + movq %rcx, %r8 + movq %r11, %r10 + movq %rbx, %r9 + movl $32768, %ebx + shrq $3, %rdi + addl $536870912, %edi + jmp .L_2TAG_PACKET_6.0.1 +.L_2TAG_PACKET_2.0.1: + movsd 8(%rsp), %xmm0 + mulsd NEG_ZERO(%rip), %xmm0 + movsd %xmm0, (%rsp) +.L_2TAG_PACKET_13.0.1: +..B1.4: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cos,@function + .size cos,.-cos + .data +# -- End cos + .section .rodata, "a" + .align 16 + .align 16 +ONEHALF: + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .type ONEHALF,@object + .size ONEHALF,16 + .align 16 +P_2: + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .type P_2,@object + .size P_2,16 + .align 16 +SC_4: + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .type SC_4,@object + .size SC_4,16 + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 1072693248 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1071644672 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 1071644672 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1070596096 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 1070596096 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1069547520 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 3217031168 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 3218079744 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 3218079744 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 3219128320 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 3220176896 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3219128320 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 3219128320 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3218079744 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 3218079744 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 1069547520 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 1070596096 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 1070596096 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 1071644672 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 1072693248 + .type Ctable,@object + .size Ctable,2048 + .align 16 +SC_2: + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .type SC_2,@object + .size SC_2,16 + .align 16 +SC_3: + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .type SC_3,@object + .size SC_3,16 + .align 16 +SC_1: + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .type SC_1,@object + .size SC_1,16 + .align 16 +PI_INV_TABLE: + .long 0 + .long 0 + .long 2734261102 + .long 1313084713 + .long 4230436817 + .long 4113882560 + .long 3680671129 + .long 1011060801 + .long 4266746795 + .long 3736847713 + .long 3072618042 + .long 1112396512 + .long 105459434 + .long 164729372 + .long 4263373596 + .long 2972297022 + .long 3900847605 + .long 784024708 + .long 3919343654 + .long 3026157121 + .long 965858873 + .long 2203269620 + .long 2625920907 + .long 3187222587 + .long 536385535 + .long 3724908559 + .long 4012839307 + .long 1510632735 + .long 1832287951 + .long 667617719 + .long 1330003814 + .long 2657085997 + .long 1965537991 + .long 3957715323 + .long 1023883767 + .long 2320667370 + .long 1811636145 + .long 529358088 + .long 1443049542 + .long 4235946923 + .long 4040145953 + .type PI_INV_TABLE,@object + .size PI_INV_TABLE,164 + .space 12, 0x00 # pad + .align 16 +PI_4: + .long 1073741824 + .long 1072243195 + .long 407279769 + .long 1046758445 + .type PI_4,@object + .size PI_4,16 + .align 8 +PI32INV: + .long 1841940611 + .long 1076125488 + .type PI32INV,@object + .size PI32INV,8 + .align 8 +SIGN_MASK: + .long 0 + .long 2147483648 + .type SIGN_MASK,@object + .size SIGN_MASK,8 + .align 8 +P_1: + .long 1413480448 + .long 1069097467 + .type P_1,@object + .size P_1,8 + .align 8 +P_3: + .long 771977331 + .long 996350346 + .type P_3,@object + .size P_3,8 + .align 8 +ONE: + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,8 + .align 8 +NEG_ZERO: + .long 0 + .long 2147483648 + .type NEG_ZERO,@object + .size NEG_ZERO,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cosdl.S b/external/sgx_libm/intel64/cosdl.S new file mode 100644 index 0000000000..2c71db4d52 --- /dev/null +++ b/external/sgx_libm/intel64/cosdl.S @@ -0,0 +1,692 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosdl.c" + .text +..TXTST0: +# -- Begin cosdl + .text + .align 16,0x90 + .globl cosdl +cosdl: +# parameter 1: 144 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cosdl.1: +..L2: + + subq $136, %rsp + .cfi_def_cfa_offset 144 + xorb %r8b, %r8b +..B1.2: + fnstcw 122(%rsp) +..B1.3: + movzwl 122(%rsp), %edx + movl %edx, %eax + andl $3840, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + andl $-3841, %edx + orl $-64768, %edx + movw %dx, 120(%rsp) +..B1.5: + fldcw 120(%rsp) +..B1.6: + movb $1, %r8b +..B1.7: + fldt 144(%rsp) + lea ones(%rip), %rdi + movzwl 152(%rsp), %eax + movl %eax, %esi + shrl $15, %eax + andl $32767, %esi + cmpl $32767, %esi + fmuls (%rdi,%rax,4) + fstpt 144(%rsp) + fldt 144(%rsp) + je ..B1.26 +..B1.8: + fldt .L_2il0floatpacket.0(%rip) + fucomip %st(1), %st + jp ..B1.9 + je ..B1.25 +..B1.9: + cmpl $10783, %esi + jge ..B1.11 +..B1.10: + fldt .L_2il0floatpacket.1(%rip) + fsubp %st, %st(1) + fstpt 104(%rsp) + jmp ..B1.21 +..B1.11: + cmpl $16446, %esi + jge ..B1.16 +..B1.12: + fldt .L_2il0floatpacket.2(%rip) + lea _Rcp90(%rip), %rax + fldt .L_2il0floatpacket.3(%rip) + fldt .L_2il0floatpacket.0(%rip) + fldt (%rax) + fmulp %st, %st(4) + fxch %st(2) + fadd %st, %st(3) + fxch %st(3) + fstpt 80(%rsp) + fldt 80(%rsp) + movl 80(%rsp), %ecx + fsubp %st, %st(3) + fmulp %st, %st(2) + incl %ecx + fldt 144(%rsp) + movl %ecx, %edx + andl $2, %edx + fsubp %st, %st(2) + shrl $1, %edx + movss (%rdi,%rdx,4), %xmm0 + fucomip %st(1), %st + jp ..B1.13 + je ..B1.24 +..B1.13: + fldt .L_2il0floatpacket.4(%rip) + lea _TWO_53H(%rip), %rax + fmul %st(1), %st + fld %st(1) + movss %xmm0, (%rsp) + testb $1, %cl + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(2) + fsub %st(2), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(3) + fld %st(1) + fld %st(4) + fldl (%rax) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fld %st(5) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fstpt 64(%rsp) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + flds (%rsp) + fstps 96(%rsp) + je ..B1.15 +..B1.14: + fstp %st(6) + fstp %st(2) + fld %st(2) + lea 112+_cosdl_poly_coeff(%rip), %rax + fmul %st(3), %st + lea 80+_cosdl_poly_coeff(%rip), %rdx + fmul %st, %st(1) + fld %st(2) + fmul %st(5), %st + fxch %st(4) + fstpt (%rsp) + fldt (%rsp) + fld %st(3) + lea 96+_cosdl_poly_coeff(%rip), %rsi + lea 48+_cosdl_poly_coeff(%rip), %rcx + lea 64+_cosdl_poly_coeff(%rip), %rdi + lea 32+_cosdl_poly_coeff(%rip), %r9 + lea 24+_cosdl_mp_poly_coeff(%rip), %r10 + lea 8+_cosdl_mp_poly_coeff(%rip), %r11 + fmul %st(7), %st + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(5) + fld %st(1) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(3) + fldt (%rax) + fmul %st(5), %st + fldt (%rdx) + lea 16+_cosdl_mp_poly_coeff(%rip), %rax + lea _cosdl_mp_poly_coeff(%rip), %rdx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + fmul %st(6), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r9) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fldl (%r10) + fmulp %st, %st(5) + faddp %st, %st(4) + fldl (%r11) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl (%rax) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldl (%rdx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%rsp) + fmulp %st, %st(2) + fld %st(1) + fldt 16(%rsp) + fmulp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + flds 96(%rsp) + fld %st(0) + fldt .L_2il0floatpacket.1(%rip) + fadd %st(4), %st + fmul %st, %st(1) + fldt .L_2il0floatpacket.1(%rip) + fsubp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 104(%rsp) + jmp ..B1.21 +..B1.15: + fld %st(6) + lea 128+_sindl_poly_coeff(%rip), %rax + fmul %st(2), %st + lea 96+_sindl_poly_coeff(%rip), %rdx + fstpt 32(%rsp) + fld %st(4) + fmul %st(4), %st + lea 64+_sindl_poly_coeff(%rip), %rcx + fmul %st, %st(3) + lea 32+_sindl_poly_coeff(%rip), %rsi + fxch %st(6) + fmul %st(7), %st + fxch %st(2) + fstpt 16(%rsp) + lea 112+_sindl_poly_coeff(%rip), %rdi + fxch %st(3) + fstpt (%rsp) + lea 80+_sindl_poly_coeff(%rip), %r9 + fldt 64(%rsp) + lea 48+_sindl_poly_coeff(%rip), %r10 + lea 24+_sindl_mp_poly_coeff(%rip), %r11 + fmul %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(4) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + lea 8+_sindl_mp_poly_coeff(%rip), %rax + lea 16+_sindl_mp_poly_coeff(%rip), %rdx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea _sindl_mp_poly_coeff(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fldt 16(%rsp) + fmulp %st, %st(1) + fldt (%rdi) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fmul %st, %st(1) + fldl (%r11) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl (%rax) + fmulp %st, %st(4) + faddp %st, %st(3) + fldl (%rdx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldl (%rcx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%rsp) + fmulp %st, %st(2) + fld %st(1) + fldt 48(%rsp) + fmulp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + flds 96(%rsp) + fld %st(0) + fmulp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 104(%rsp) + jmp ..B1.21 +..B1.16: + fstp %st(0) + lea -16446(%rsi), %ecx + cmpl $14, %ecx + jle ..B1.18 +..B1.17: + addl $-16449, %esi + movl $715827883, %eax + imull %esi + movl %esi, %ecx + sarl $1, %edx + sarl $31, %ecx + subl %ecx, %edx + lea (,%rdx,8), %r9d + lea (%r9,%rdx,4), %r10d + subl %r10d, %esi + lea 3(%rsi), %ecx +..B1.18: + movl 148(%rsp), %r11d + movl %r11d, %esi + shll $8, %esi + movl $381774871, %eax + movl %esi, %r9d + andl $-16777216, %r11d + shrl $3, %r9d + movl %r11d, %r10d + mull %r9d + shrl $19, %r11d + shrl $2, %edx + imull $-360, %edx, %eax + addl %eax, %esi + movl $381774871, %eax + mull %r11d + shrl $16, %r10d + movl $381774871, %eax + shrl $2, %edx + imull $-360, %edx, %r11d + addl %r11d, %r10d + movl 144(%rsp), %r9d + addl %r10d, %esi + movl %r9d, %r10d + shrl $3, %r10d + mull %r10d + shrl $2, %edx + imull $-360, %edx, %eax + addl %eax, %r9d + movl $-1240768329, %eax + addl %r9d, %esi + shll %cl, %esi + imull %esi + movl %esi, %ecx + addl %esi, %edx + sarl $8, %edx + sarl $31, %ecx + subl %ecx, %edx + movl $1, %ecx + imull $-360, %edx, %eax + lea (%rsi,%rax), %edx + cmpl $179, %edx + lea -180(%rsi,%rax), %eax + movl $3, %esi + cmovg %eax, %edx + cmovg %esi, %ecx + cmpl $89, %edx + jle ..B1.20 +..B1.19: + incl %ecx + addl $-90, %edx +..B1.20: + movl %ecx, %eax + andl $2, %ecx + andl $1, %eax + addl %eax, %eax + movq __libm_sindl_cosdl_table@GOTPCREL(%rip), %rsi + shrl $1, %ecx + lea (%rax,%rdx,4), %edx + movslq %edx, %rdx + fldl (%rsi,%rdx,8) + faddl 8(%rsi,%rdx,8) + fmuls (%rdi,%rcx,4) + fstpt 104(%rsp) +..B1.21: + testb %r8b, %r8b + je ..B1.23 +..B1.22: + fldcw 122(%rsp) +..B1.23: + fldt 104(%rsp) + addq $136, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 +..B1.24: + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + testb $1, %cl + movss %xmm0, (%rsp) + flds (%rsp) + fcmove %st(1), %st + fstp %st(1) + fstpt 104(%rsp) + jmp ..B1.21 +..B1.25: + fstp %st(0) + fldt .L_2il0floatpacket.1(%rip) + fstpt 104(%rsp) + jmp ..B1.21 +..B1.26: + fldt .L_2il0floatpacket.0(%rip) + fmulp %st, %st(1) + fstpt 104(%rsp) + jmp ..B1.21 + .align 16,0x90 + .cfi_endproc + .type cosdl,@function + .size cosdl,.-cosdl + .data +# -- End cosdl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3e,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x05,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +_cosdl_poly_coeff: + .word 52350 + .word 41213 + .word 3800 + .word 40885 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 28613 + .word 7908 + .word 35668 + .word 34008 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 19927 + .word 58728 + .word 49885 + .word 45261 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 32884 + .word 22035 + .word 23267 + .word 64541 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 36401 + .word 51897 + .word 8309 + .word 57265 + .word 49070 + .word 0 + .word 0 + .word 0 + .word 34286 + .word 2728 + .word 41564 + .word 34642 + .word 16284 + .word 0 + .word 0 + .word 0 + .word 63248 + .word 18030 + .word 35596 + .word 60796 + .word 49032 + .word 0 + .word 0 + .word 0 + .word 52149 + .word 21294 + .word 63985 + .word 40123 + .word 16245 + .word 0 + .word 0 + .word 0 + .type _cosdl_poly_coeff,@object + .size _cosdl_poly_coeff,128 + .align 16 +_cosdl_mp_poly_coeff: + .long 3675529145 + .long 3206805153 + .long 2134983071 + .long 3151100167 + .long 1787026573 + .long 1043372817 + .long 205083639 + .long 988746860 + .type _cosdl_mp_poly_coeff,@object + .size _cosdl_mp_poly_coeff,32 + .align 16 +_sindl_poly_coeff: + .word 51374 + .word 38121 + .word 13586 + .word 36602 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 50116 + .word 41339 + .word 4204 + .word 60892 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 33704 + .word 2155 + .word 42839 + .word 60780 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 21250 + .word 19076 + .word 27901 + .word 57780 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 9076 + .word 49244 + .word 613 + .word 64083 + .word 16311 + .word 0 + .word 0 + .word 0 + .word 40572 + .word 30418 + .word 36251 + .word 46520 + .word 49061 + .word 0 + .word 0 + .word 0 + .word 3227 + .word 25505 + .word 5540 + .word 47626 + .word 16274 + .word 0 + .word 0 + .word 0 + .word 60933 + .word 3300 + .word 57416 + .word 36218 + .word 49023 + .word 0 + .word 0 + .word 0 + .word 45811 + .word 42646 + .word 37125 + .word 42185 + .word 16235 + .word 0 + .word 0 + .word 0 + .type _sindl_poly_coeff,@object + .size _sindl_poly_coeff,144 + .align 16 +_sindl_mp_poly_coeff: + .long 2723323193 + .long 1066524486 + .long 2863989530 + .long 1008058840 + .long 227815288 + .long 3199056770 + .long 3752327299 + .long 3142458725 + .type _sindl_mp_poly_coeff,@object + .size _sindl_mp_poly_coeff,32 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_Rcp90: + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _Rcp90,@object + .size _Rcp90,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cosf_gen.S b/external/sgx_libm/intel64/cosf_gen.S new file mode 100644 index 0000000000..5e2789015c --- /dev/null +++ b/external/sgx_libm/intel64/cosf_gen.S @@ -0,0 +1,543 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosf_gen.c" + .text +..TXTST0: +# -- Begin cosf + .text + .align 16,0x90 + .globl cosf +cosf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cosf.1: +..L2: + +..B1.2: + subq $32, %rsp + .cfi_def_cfa_offset 40 + stmxcsr 8(%rsp) + cmpl $-24577, 8(%rsp) + jne .L_2TAG_PACKET_0.0.1 +.L_2TAG_PACKET_1.0.1: + pshuflw $68, %xmm0, %xmm1 + movd %xmm0, %ecx + cvtps2pd %xmm1, %xmm1 + movq $0x40445f306e000000, %rax + movd %rax, %xmm2 + movl $2147483647, %r10d + movl $1241513983, %r8d + andl %ecx, %r10d + subl %r10d, %r8d + subl $964689920, %r10d + orl %r10d, %r8d + jl .L_2TAG_PACKET_2.0.1 + movq $0x4338000000000000, %r11 + movd %r11, %xmm4 + mulsd %xmm1, %xmm2 + movq $0xbe5b1bbead603d8b, %rdx + movd %rdx, %xmm3 + movapd %xmm2, %xmm5 + addsd %xmm4, %xmm2 + movd %xmm2, %r9d + subsd %xmm4, %xmm2 + mulsd %xmm3, %xmm1 +.L_2TAG_PACKET_3.0.1: + lea Ctable(%rip), %r10 + movl $384, %eax + movq $0x40c37423899a1558, %rdx + movd %rdx, %xmm4 + subsd %xmm2, %xmm5 + addl %r9d, %r9d + movl %r9d, %r8d + sarb $7, %r9b + andl %r8d, %eax + addb %r9b, %r8b + xorb %r9b, %r8b + addsd %xmm5, %xmm1 + andl $254, %r8d + movsd (%r10,%r8,8), %xmm3 + movq $0x40a9f02f6222c720, %r11 + movd %r11, %xmm0 + movapd %xmm1, %xmm2 + unpcklpd %xmm1, %xmm2 + mulsd %xmm1, %xmm1 + movsd 8(%r10,%r8,8), %xmm5 + movl %eax, %r9d + andl $256, %r9d + shlq $55, %r9 + mulsd %xmm2, %xmm3 + movd %r9, %xmm2 + subsd %xmm1, %xmm0 + addl $128, %eax + andl $256, %eax + shlq $55, %rax + subsd %xmm1, %xmm4 + movd %rax, %xmm1 + xorpd %xmm2, %xmm4 + mulsd %xmm5, %xmm0 + mulsd %xmm4, %xmm3 + xorpd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + movl 8(%rsp), %eax + andl $-24577, %eax + cmpl 8(%rsp), %eax + je .L_2TAG_PACKET_4.0.1 + stmxcsr 16(%rsp) + movl 8(%rsp), %eax + andl $24576, %eax + orl %eax, 16(%rsp) + ldmxcsr 16(%rsp) +.L_2TAG_PACKET_4.0.1: + cvtpd2ps %xmm0, %xmm0 + addq $32, %rsp + ret +.L_2TAG_PACKET_2.0.1: + andl $2147483647, %ecx + cmpl $1040187392, %ecx + ja .L_2TAG_PACKET_5.0.1 + movl $1065353216, %eax + movd %rax, %xmm0 + cmpl $0, %ecx + je .L_2TAG_PACKET_6.0.1 + movl $805306368, %eax + movd %rax, %xmm1 + subss %xmm1, %xmm0 +.L_2TAG_PACKET_6.0.1: + movl 8(%rsp), %eax + andl $-24577, %eax + cmpl 8(%rsp), %eax + jne .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_8.0.1: + addq $32, %rsp + ret +.L_2TAG_PACKET_5.0.1: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_9.0.1 + shrl $23, %r10d + subl $27, %r10d + andl $65528, %r10d + lea Pitable(%rip), %rax + movsd (%rax,%r10,2), %xmm3 + movsd 8(%rax,%r10,2), %xmm5 + movq $0xffffffffff000000, %r9 + movd %r9, %xmm2 + movq $0x4338000000000000, %r11 + movd %r11, %xmm4 + andpd %xmm3, %xmm2 + psllq $40, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + movapd %xmm2, %xmm0 + addsd %xmm3, %xmm2 + movapd %xmm2, %xmm5 + subsd %xmm2, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm0, %xmm3 + movd %xmm2, %r9d + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_3.0.1 +.L_2TAG_PACKET_9.0.1: + subss %xmm0, %xmm0 + movl 8(%rsp), %eax + andl $-24577, %eax + cmpl 8(%rsp), %eax + jne .L_2TAG_PACKET_7.0.1 + jmp .L_2TAG_PACKET_8.0.1 +.L_2TAG_PACKET_0.0.1: + movl 8(%rsp), %eax + andl $-24577, %eax + movl %eax, 16(%rsp) + ldmxcsr 16(%rsp) + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_7.0.1: + stmxcsr 16(%rsp) + movl 8(%rsp), %eax + andl $24576, %eax + orl %eax, 16(%rsp) + ldmxcsr 16(%rsp) + jmp .L_2TAG_PACKET_8.0.1 + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type cosf,@function + .size cosf,.-cosf + .data +# -- End cosf + .section .rodata, "a" + .align 16 + .align 16 +Ctable: + .long 0 + .long 0 + .long 3384690142 + .long 1060355388 + .long 918535681 + .long 3195026356 + .long 735532773 + .long 1060354999 + .long 3431923622 + .long 3196074611 + .long 2385983684 + .long 1060353830 + .long 3670374716 + .long 3196605580 + .long 2769466396 + .long 1060351883 + .long 3087185898 + .long 3197121906 + .long 2627920248 + .long 1060349159 + .long 624330694 + .long 3197386271 + .long 418831766 + .long 1060345660 + .long 1991825541 + .long 3197649836 + .long 900924147 + .long 1060341387 + .long 3917367244 + .long 3197912443 + .long 2243801771 + .long 1060336343 + .long 2803392399 + .long 3198165367 + .long 316258674 + .long 1060330532 + .long 2429158325 + .long 3198295476 + .long 1563320407 + .long 1060323956 + .long 1382541649 + .long 3198424870 + .long 1522351063 + .long 1060316620 + .long 4207787592 + .long 3198553470 + .long 1992674941 + .long 1060308528 + .long 321119318 + .long 3198681201 + .long 2434209605 + .long 1060299685 + .long 2865853451 + .long 3198807983 + .long 4249822861 + .long 1060290096 + .long 1666812989 + .long 3198933742 + .long 2181617495 + .long 1060279768 + .long 2082609563 + .long 3199058401 + .long 1475857720 + .long 1060268706 + .long 3726787968 + .long 3199181885 + .long 687004205 + .long 1060256917 + .long 2478530408 + .long 3199254748 + .long 250409509 + .long 1060244408 + .long 3681356269 + .long 3199315204 + .long 2463945945 + .long 1060231186 + .long 1535093810 + .long 3199374963 + .long 2878576948 + .long 1060217260 + .long 350661592 + .long 3199433988 + .long 3162654741 + .long 1060202638 + .long 2042383238 + .long 3199492243 + .long 2490283769 + .long 1060187329 + .long 1925003623 + .long 3199549694 + .long 1813501338 + .long 1060171342 + .long 1689375324 + .long 3199606306 + .long 3838419993 + .long 1060154686 + .long 902054988 + .long 3199662045 + .long 115411415 + .long 1060137373 + .long 1388494065 + .long 3199716877 + .long 1077921708 + .long 1060119411 + .long 3024934267 + .long 3199770769 + .long 3311502568 + .long 1060091288 + .long 3823857331 + .long 3199823689 + .long 1148832537 + .long 1060052839 + .long 17970311 + .long 3199875606 + .long 652328457 + .long 1060013161 + .long 3322544997 + .long 3199926486 + .long 1395127179 + .long 1059972278 + .long 2361617751 + .long 3199976301 + .long 1772140623 + .long 1059930215 + .long 1401987205 + .long 3200025020 + .long 3231311734 + .long 1059886997 + .long 3250975870 + .long 3200072613 + .long 1618129506 + .long 1059842651 + .long 742418353 + .long 3200119053 + .long 4288148241 + .long 1059797202 + .long 2580634211 + .long 3200164310 + .long 4268074870 + .long 1059750679 + .long 3348027550 + .long 3200208358 + .long 1659779181 + .long 1059703110 + .long 755484892 + .long 3200251171 + .long 3567792879 + .long 1059654522 + .long 2993330 + .long 3200273337 + .long 2550341159 + .long 1059604946 + .long 488211833 + .long 3200293469 + .long 2313428161 + .long 1059554411 + .long 3436142021 + .long 3200312945 + .long 453708735 + .long 1059502948 + .long 1407782048 + .long 3200331755 + .long 1264637048 + .long 1059450587 + .long 1575056534 + .long 3200349886 + .long 2771364651 + .long 1059397360 + .long 4275292648 + .long 3200367327 + .long 944109265 + .long 1059343300 + .long 3039475318 + .long 3200384069 + .long 2500108843 + .long 1059288438 + .long 1799297257 + .long 3200400101 + .long 3344537919 + .long 1059232808 + .long 2028347177 + .long 3200415413 + .long 1369913724 + .long 1059176444 + .long 2767093429 + .long 3200429996 + .long 664370609 + .long 1059119379 + .long 646746141 + .long 3200443842 + .long 1372808103 + .long 1059061535 + .long 2796885356 + .long 3200456941 + .long 941816458 + .long 1058944809 + .long 1097233945 + .long 3200469287 + .long 1373383079 + .long 1058826890 + .long 2262842797 + .long 3200480871 + .long 2796081240 + .long 1058707849 + .long 2093526290 + .long 3200491687 + .long 3945677176 + .long 1058587758 + .long 2671784286 + .long 3200501728 + .long 1979618421 + .long 1058466690 + .long 3789723003 + .long 3200510988 + .long 879820317 + .long 1058344717 + .long 2964703016 + .long 3200519462 + .long 2674059679 + .long 1058221912 + .long 4043704933 + .long 3200527144 + .long 2950925715 + .long 1058098350 + .long 36665700 + .long 3200534031 + .long 2811721921 + .long 1057935027 + .long 3193221610 + .long 3200540116 + .long 3297207428 + .long 1057685321 + .long 2063766514 + .long 3200545398 + .long 544295963 + .long 1057434550 + .long 163641427 + .long 3200549873 + .long 3381119115 + .long 1057182863 + .long 3096463640 + .long 3200553537 + .long 3054827835 + .long 1056896220 + .long 1381230637 + .long 3200556390 + .long 3419039295 + .long 1056390099 + .long 522802171 + .long 3200558429 + .long 1693671239 + .long 1055850091 + .long 3836476539 + .long 3200559652 + .long 1466910230 + .long 1054802127 + .long 3861233235 + .long 3200560060 + .long 0 + .long 0 + .type Ctable,@object + .size Ctable,1040 + .align 16 +Pitable: + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1916669064 + .long 1072155675 + .long 660066805 + .long 1024797180 + .long 3829231700 + .long 1062745828 + .long 2884172442 + .long 1017445907 + .long 540874025 + .long 1055617650 + .long 4198409884 + .long 1011844330 + .long 2839315448 + .long 1046639136 + .long 4204424928 + .long 1000582120 + .long 1329339431 + .long 1038229673 + .long 1295478839 + .long 993391741 + .long 658191860 + .long 1024797180 + .long 3691886121 + .long 979325773 + .long 1966800710 + .long 1020436418 + .long 1882642597 + .long 977095991 + .long 2100977488 + .long 1012908661 + .long 1840335565 + .long 967470816 + .long 4198093645 + .long 1000582120 + .long 3307942521 + .long 957055414 + .long 2839123165 + .long 996851343 + .long 1387472776 + .long 952638316 + .long 2788761024 + .long 988712873 + .long 3005712498 + .long 944467026 + .long 3694676832 + .long 979325773 + .long 1326507024 + .long 934847846 + .long 221775557 + .long 970149340 + .long 1133527550 + .long 924162364 + .type Pitable,@object + .size Pitable,240 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cosh_gen.S b/external/sgx_libm/intel64/cosh_gen.S new file mode 100644 index 0000000000..f9fc5f4384 --- /dev/null +++ b/external/sgx_libm/intel64/cosh_gen.S @@ -0,0 +1,409 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosh_gen.c" + .text +..TXTST0: +# -- Begin cosh + .text + .align 16,0x90 + .globl cosh +cosh: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cosh.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + andl $2147483647, %eax + cmpl $1077338037, %eax + jae ..B1.8 +..B1.2: + cmpl $1065646817, %eax + jae ..B1.7 +..B1.3: + movsd .L_2il0floatpacket.12(%rip), %xmm4 + cmpl $1012924416, %eax + jae ..B1.5 +..B1.4: + andps .L_2il0floatpacket.11(%rip), %xmm0 + addsd %xmm4, %xmm0 + movsd %xmm0, -24(%rsp) + ret +..B1.5: + movsd -8(%rsp), %xmm1 + mulsd %xmm1, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + movsd .L_2il0floatpacket.9(%rip), %xmm0 + mulsd %xmm2, %xmm0 + movsd .L_2il0floatpacket.10(%rip), %xmm3 + mulsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.8(%rip), %xmm0 + mulsd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + addsd %xmm4, %xmm0 +..B1.6: + ret +..B1.7: + movsd -8(%rsp), %xmm1 + lea _TWO_52(%rip), %rax + andps .L_2il0floatpacket.11(%rip), %xmm1 + lea _ptwo_32p1(%rip), %rcx + movsd .L_2il0floatpacket.0(%rip), %xmm2 + lea _ntwo_32p1(%rip), %rsi + mulsd %xmm1, %xmm2 + lea _two_32(%rip), %rdi + movsd .L_2il0floatpacket.1(%rip), %xmm3 + movsd %xmm1, -8(%rsp) + movsd .L_2il0floatpacket.2(%rip), %xmm4 + movsd (%rcx), %xmm6 + movsd (%rsi), %xmm7 + movsd .L_2il0floatpacket.4(%rip), %xmm13 + movsd .L_2il0floatpacket.6(%rip), %xmm14 + movsd .L_2il0floatpacket.3(%rip), %xmm8 + movsd .L_2il0floatpacket.3(%rip), %xmm9 + movq __libm_exp_table_128@GOTPCREL(%rip), %r10 + addsd (%rax), %xmm2 + movsd %xmm2, -24(%rsp) + movsd -24(%rsp), %xmm5 + movl -24(%rsp), %r9d + movl %r9d, %edx + shll $25, %edx + subsd (%rax), %xmm5 + mulsd %xmm5, %xmm3 + mulsd %xmm4, %xmm5 + subsd %xmm3, %xmm1 + movaps %xmm1, %xmm10 + sarl $25, %edx + subsd %xmm5, %xmm10 + movaps %xmm10, %xmm11 + movaps %xmm10, %xmm15 + movslq %edx, %rdx + subsd %xmm10, %xmm1 + addsd %xmm10, %xmm6 + subsd %xmm10, %xmm7 + subsd %xmm5, %xmm1 + movsd %xmm6, -40(%rsp) + subl %edx, %r9d + movsd %xmm7, -32(%rsp) + pxor %xmm5, %xmm5 + movsd -40(%rsp), %xmm2 + addsd %xmm1, %xmm11 + subsd (%rdi), %xmm2 + movaps %xmm11, %xmm12 + addsd %xmm2, %xmm8 + mulsd %xmm11, %xmm12 + subsd %xmm8, %xmm15 + mulsd %xmm12, %xmm13 + mulsd %xmm12, %xmm14 + addsd %xmm1, %xmm15 + addsd .L_2il0floatpacket.5(%rip), %xmm13 + addsd .L_2il0floatpacket.7(%rip), %xmm14 + mulsd %xmm12, %xmm13 + mulsd %xmm12, %xmm14 + mulsd %xmm11, %xmm13 + addsd .L_2il0floatpacket.8(%rip), %xmm14 + addsd %xmm13, %xmm15 + mulsd %xmm12, %xmm14 + movsd -32(%rsp), %xmm0 + addsd %xmm14, %xmm15 + addsd (%rdi), %xmm0 + shlq $4, %rdx + addsd %xmm0, %xmm9 + movsd 1032(%r10,%rdx), %xmm8 + addsd %xmm9, %xmm10 + movaps %xmm8, %xmm4 + addsd %xmm10, %xmm1 + mulsd %xmm15, %xmm4 + addsd %xmm2, %xmm15 + mulsd %xmm8, %xmm2 + mulsd 1024(%r10,%rdx), %xmm15 + xorps .L_2il0floatpacket.13(%rip), %xmm1 + negq %rdx + shrl $7, %r9d + subsd %xmm13, %xmm1 + addsd %xmm15, %xmm4 + addsd %xmm14, %xmm1 + movsd 1032(%r10,%rdx), %xmm15 + movaps %xmm15, %xmm3 + mulsd %xmm1, %xmm3 + addsd %xmm0, %xmm1 + mulsd %xmm15, %xmm0 + mulsd 1024(%r10,%rdx), %xmm1 + shll $23, %r9d + addsd %xmm1, %xmm3 + pxor %xmm1, %xmm1 + lea 1056964608(%r9), %r8d + negl %r9d + addl $1056964608, %r9d + movl %r9d, -12(%rsp) + movl %r8d, -16(%rsp) + cvtss2sd -12(%rsp), %xmm5 + cvtss2sd -16(%rsp), %xmm1 + mulsd %xmm5, %xmm3 + mulsd %xmm0, %xmm5 + mulsd %xmm1, %xmm4 + mulsd %xmm2, %xmm1 + addsd %xmm3, %xmm4 + movaps %xmm5, %xmm0 + addsd %xmm1, %xmm0 + subsd %xmm0, %xmm1 + addsd %xmm1, %xmm5 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm0 + ret +..B1.8: + cmpl $1082536910, %eax + jb ..B1.14 +..B1.9: + jne ..B1.11 +..B1.10: + cmpl $-1883637635, -8(%rsp) + jbe ..B1.14 +..B1.11: + cmpl $2146435072, %eax + jb ..B1.15 +..B1.12: + movsd -8(%rsp), %xmm0 + mulsd %xmm0, %xmm0 +..B1.13: + ret +..B1.14: + movsd -8(%rsp), %xmm12 + lea _TWO_52(%rip), %rax + andps .L_2il0floatpacket.11(%rip), %xmm12 + lea _ptwo_32p1(%rip), %rdx + movsd .L_2il0floatpacket.0(%rip), %xmm0 + lea _two_32(%rip), %rcx + mulsd %xmm12, %xmm0 + lea _TWO_512(%rip), %r9 + movsd .L_2il0floatpacket.1(%rip), %xmm1 + movsd %xmm12, -8(%rsp) + movsd .L_2il0floatpacket.2(%rip), %xmm2 + movsd .L_2il0floatpacket.6(%rip), %xmm11 + movsd .L_2il0floatpacket.4(%rip), %xmm8 + movsd (%rdx), %xmm4 + movsd .L_2il0floatpacket.3(%rip), %xmm5 + movsd .L_2il0floatpacket.8(%rip), %xmm10 + movq __libm_exp_table_128@GOTPCREL(%rip), %r8 + movl $0, -16(%rsp) + addsd (%rax), %xmm0 + movsd %xmm0, -24(%rsp) + movsd -24(%rsp), %xmm3 + movl -24(%rsp), %esi + movl %esi, %edi + shll $25, %edi + subsd (%rax), %xmm3 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm3 + subsd %xmm1, %xmm12 + movaps %xmm12, %xmm6 + sarl $25, %edi + subsd %xmm3, %xmm6 + movaps %xmm6, %xmm7 + subl %edi, %esi + movslq %edi, %rdi + subsd %xmm6, %xmm12 + addsd %xmm6, %xmm4 + subsd %xmm3, %xmm12 + movsd %xmm4, -24(%rsp) + addsd %xmm12, %xmm7 + movaps %xmm7, %xmm9 + mulsd %xmm7, %xmm9 + mulsd %xmm9, %xmm11 + mulsd %xmm9, %xmm8 + mulsd %xmm9, %xmm10 + addsd .L_2il0floatpacket.7(%rip), %xmm11 + addsd .L_2il0floatpacket.5(%rip), %xmm8 + mulsd %xmm9, %xmm11 + mulsd %xmm7, %xmm8 + movsd -24(%rsp), %xmm0 + addsd %xmm8, %xmm11 + subsd (%rcx), %xmm0 + mulsd %xmm9, %xmm11 + addsd %xmm0, %xmm5 + addsd %xmm10, %xmm11 + subsd %xmm5, %xmm6 + shlq $4, %rdi + addsd %xmm6, %xmm12 + movsd 1032(%r8,%rdi), %xmm13 + addsd %xmm11, %xmm12 + movaps %xmm13, %xmm14 + mulsd %xmm12, %xmm14 + addsd %xmm0, %xmm12 + mulsd %xmm13, %xmm0 + mulsd 1024(%r8,%rdi), %xmm12 + shrl $7, %esi + addsd %xmm12, %xmm14 + shll $20, %esi + addsd %xmm14, %xmm0 + addl $534773760, %esi + movl %esi, -12(%rsp) + mulsd -16(%rsp), %xmm0 + mulsd (%r9), %xmm0 + ret +..B1.15: + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type cosh,@function + .size cosh,.-cosh + .data +# -- End cosh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.11: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,16 + .align 16 +.L_2il0floatpacket.13: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x6a3d464e,0x3f56c171 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x5554a6cf,0x3fa55555 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 4 +_TWO_52: + .long 0 + .long 1127219200 + .type _TWO_52,@object + .size _TWO_52,8 + .align 4 +_ptwo_32p1: + .long 1048576 + .long 1106247680 + .type _ptwo_32p1,@object + .size _ptwo_32p1,8 + .align 4 +_ntwo_32p1: + .long 4292870144 + .long 3253731327 + .type _ntwo_32p1,@object + .size _ntwo_32p1,8 + .align 4 +_two_32: + .long 0 + .long 1106247680 + .type _two_32,@object + .size _two_32,8 + .align 4 +_TWO_512: + .long 0 + .long 1609564160 + .type _TWO_512,@object + .size _TWO_512,8 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/coshf_gen.S b/external/sgx_libm/intel64/coshf_gen.S new file mode 100644 index 0000000000..3b0a1333f8 --- /dev/null +++ b/external/sgx_libm/intel64/coshf_gen.S @@ -0,0 +1,323 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "coshf_gen.c" + .text +..TXTST0: +# -- Begin coshf + .text + .align 16,0x90 + .globl coshf +coshf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_coshf.1: +..L2: + + movd %xmm0, %eax + movss %xmm0, -8(%rsp) + andl $2147483647, %eax + cmpl $1107296256, %eax + jae ..B1.10 +..B1.2: + cmpl $1056964608, %eax + jae ..B1.9 +..B1.3: + cmpl $1031798784, %eax + jae ..B1.8 +..B1.4: + cmpl $838860800, %eax + jae ..B1.6 +..B1.5: + andps .L_2il0floatpacket.15(%rip), %xmm0 + addss .L_2il0floatpacket.16(%rip), %xmm0 + movss %xmm0, -16(%rsp) + ret +..B1.6: + pxor %xmm0, %xmm0 + cvtss2sd -8(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd .L_2il0floatpacket.13(%rip), %xmm1 + mulsd %xmm0, %xmm1 + addsd .L_2il0floatpacket.14(%rip), %xmm1 + mulsd %xmm0, %xmm1 + pxor %xmm0, %xmm0 + addsd .L_2il0floatpacket.17(%rip), %xmm1 + cvtsd2ss %xmm1, %xmm0 +..B1.7: + ret +..B1.8: + pxor %xmm1, %xmm1 + cvtss2sd -8(%rsp), %xmm1 + mulsd %xmm1, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.8(%rip), %xmm3 + movsd .L_2il0floatpacket.10(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.9(%rip), %xmm3 + addsd .L_2il0floatpacket.11(%rip), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.17(%rip), %xmm3 + cvtsd2ss %xmm3, %xmm3 + movaps %xmm3, %xmm0 + ret +..B1.9: + pxor %xmm3, %xmm3 + pxor %xmm4, %xmm4 + cvtss2sd -8(%rsp), %xmm3 + andps .L_2il0floatpacket.18(%rip), %xmm3 + pxor %xmm6, %xmm6 + movsd .L_2il0floatpacket.0(%rip), %xmm0 + mulsd %xmm3, %xmm0 + movsd .L_2il0floatpacket.4(%rip), %xmm7 + movsd .L_2il0floatpacket.6(%rip), %xmm5 + movq __libm_expf_table_64@GOTPCREL(%rip), %rsi + addsd .L_2il0floatpacket.1(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movl -16(%rsp), %ecx + movl %ecx, %eax + shll $26, %eax + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + sarl $26, %eax + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm7 + mulsd %xmm2, %xmm5 + addsd .L_2il0floatpacket.5(%rip), %xmm7 + addsd .L_2il0floatpacket.7(%rip), %xmm5 + mulsd %xmm2, %xmm7 + mulsd %xmm3, %xmm5 + addsd .L_2il0floatpacket.17(%rip), %xmm7 + movslq %eax, %rax + movaps %xmm7, %xmm0 + subl %eax, %ecx + addsd %xmm5, %xmm0 + subsd %xmm5, %xmm7 + shrl $6, %ecx + shlq $3, %rax + shll $23, %ecx + mulsd 256(%rsi,%rax), %xmm0 + negq %rax + mulsd 256(%rsi,%rax), %xmm7 + lea 1056964608(%rcx), %edx + negl %ecx + addl $1056964608, %ecx + movl %edx, -24(%rsp) + movl %ecx, -20(%rsp) + cvtss2sd -24(%rsp), %xmm4 + cvtss2sd -20(%rsp), %xmm6 + mulsd %xmm4, %xmm0 + mulsd %xmm6, %xmm7 + addsd %xmm7, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.10: + cmpl $1119016188, %eax + jbe ..B1.14 +..B1.11: + cmpl $2139095040, %eax + jb ..B1.15 +..B1.12: + movss -8(%rsp), %xmm0 + mulss %xmm0, %xmm0 +..B1.13: + ret +..B1.14: + pxor %xmm3, %xmm3 + cvtss2sd -8(%rsp), %xmm3 + andps .L_2il0floatpacket.18(%rip), %xmm3 + movsd .L_2il0floatpacket.0(%rip), %xmm0 + mulsd %xmm3, %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movq __libm_expf_table_64@GOTPCREL(%rip), %rcx + movl $0, -24(%rsp) + addsd .L_2il0floatpacket.1(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + movl -16(%rsp), %eax + movl %eax, %edx + shll $26, %edx + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + sarl $26, %edx + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + subl %edx, %eax + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm3, %xmm4 + movslq %edx, %rdx + addsd %xmm4, %xmm0 + shrl $6, %eax + addsd .L_2il0floatpacket.17(%rip), %xmm0 + mulsd 256(%rcx,%rdx,8), %xmm0 + shll $20, %eax + addl $1071644672, %eax + movl %eax, -20(%rsp) + mulsd -24(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.15: + movss .L_2il0floatpacket.12(%rip), %xmm0 + mulss %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type coshf,@function + .size coshf,.-coshf + .data +# -- End coshf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.15: + .long 0x7fffffff,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.18: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40571547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x41680000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.3: + .long 0xfefa39ef,0xbf862e42 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xeb78fa85,0x3fa56420 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x008d6118,0x3fe00000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xda752d4f,0x3fc55550 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xffffe7c6,0x3fefffff + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0xdcf5905b,0x3efa3001 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x72601504,0x3fa55555 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x7543543e,0x3f56c143 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0xffe2f097,0x3fdfffff + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x6e6d0908,0x3fa55666 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0xf3327c54,0x3fdfffff + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +.L_2il0floatpacket.17: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,8 + .align 4 +.L_2il0floatpacket.2: + .long 0x4b400000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.12: + .long 0x71800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +.L_2il0floatpacket.16: + .long 0x3f800000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/coshl.S b/external/sgx_libm/intel64/coshl.S new file mode 100644 index 0000000000..7876f73447 --- /dev/null +++ b/external/sgx_libm/intel64/coshl.S @@ -0,0 +1,897 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "coshl.c" + .text +..TXTST0: +# -- Begin coshl + .text + .align 16,0x90 + .globl coshl +coshl: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_coshl.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %cl, %cl +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movzwl 104(%rsp), %esi + andl $32767, %esi + cmpl $16396, %esi + jge ..B1.52 +..B1.4: + cmpl $16382, %esi + jge ..B1.39 +..B1.5: + movzwl 82(%rsp), %edx + cmpl $16378, %esi + jge ..B1.32 +..B1.6: + cmpl $16372, %esi + jge ..B1.25 +..B1.7: + cmpl $16365, %esi + jge ..B1.18 +..B1.8: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.9: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.10: + fldcw 80(%rsp) +..B1.11: + movzwl 104(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.12: + fldt 96(%rsp) + cmpl $16308, %esi + fstpt (%rsp) + jge ..B1.14 +..B1.13: + fldt .L_2il0floatpacket.0(%rip) + fldt (%rsp) + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.14: + fldt (%rsp) + lea _Q3(%rip), %rax + fldt .L_2il0floatpacket.0(%rip) + fldt (%rax) + fmul %st(2), %st + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) +..B1.15: + testb %cl, %cl + je ..B1.17 +..B1.16: + fldcw 82(%rsp) +..B1.17: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.18: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.22 +..B1.19: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.20: + fldcw 80(%rsp) +..B1.21: + movb $1, %cl +..B1.22: + fldt 96(%rsp) + lea 16+_Q2(%rip), %rax + fmul %st(0), %st + lea _Q2(%rip), %rdx + fldt (%rax) + testb %cl, %cl + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 82(%rsp) +..B1.24: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.25: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.26: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.27: + fldcw 80(%rsp) +..B1.28: + movb $1, %cl +..B1.29: + fldt 96(%rsp) + lea 48+_Q1(%rip), %rax + fmul %st(0), %st + lea 32+_Q1(%rip), %rsi + fld %st(0) + lea 16+_Q1(%rip), %rdx + fmul %st(1), %st + lea _Q1(%rip), %rdi + fldt (%rax) + testb %cl, %cl + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.31 +..B1.30: + fldcw 82(%rsp) +..B1.31: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.32: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.33: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.34: + fldcw 80(%rsp) +..B1.35: + movb $1, %cl +..B1.36: + fldt 96(%rsp) + lea _TWO_48H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 96+_Q(%rip), %rdx + fmul %st(3), %st + lea 64+_Q(%rip), %rsi + fld %st(0) + lea 112+_Q(%rip), %r8 + fmul %st(1), %st + lea 32+_Q(%rip), %rdi + fldl (%rax) + lea 80+_Q(%rip), %r9 + lea 48+_Q(%rip), %r10 + lea 16+_Q(%rip), %r11 + lea 144+_Q(%rip), %rax + testb %cl, %cl + fadd %st, %st(4) + fsubr %st, %st(4) + fld %st(4) + fxch %st(4) + fsub %st(5), %st + fmul %st, %st(4) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + fldt (%rdx) + lea 128+_Q(%rip), %rdx + fmul %st(4), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r8) + fmul %st(5), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt (%r11) + faddp %st, %st(5) + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(2) + fldt (%rax) + fld %st(0) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(4) + fmul %st, %st(1) + fldt (%rdx) + fmul %st, %st(1) + fld %st(1) + fadd %st(3), %st + fadd %st(6), %st + fsub %st, %st(6) + fxch %st(2) + fsub %st(6), %st + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + je ..B1.75 +..B1.37: + fstpt 16(%rsp) +..B1.73: + fldcw 82(%rsp) + jmp ..B1.38 +..B1.75: + fstp %st(0) +..B1.38: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.39: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.40: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.41: + fldcw 80(%rsp) +..B1.42: + movb $1, %cl +..B1.43: + fldt 96(%rsp) + lea ones(%rip), %rax + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rdi + movb 105(%rsp), %dl + lea _TWO_32(%rip), %r8 + andb $-128, %dl + lea _TWO_32P(%rip), %r9 + shrb $7, %dl + lea 64+_P(%rip), %r10 + fstpt 64(%rsp) + fldl (%rdi) + fldt .L_2il0floatpacket.1(%rip) + fldt .L_2il0floatpacket.2(%rip) + fldt .L_2il0floatpacket.3(%rip) + fldl (%r9) + movzbl %dl, %esi + lea 32+_P(%rip), %r11 + lea 48+_P(%rip), %rdi + fxch %st(5) + fmull (%rax,%rsi,8) + lea _P(%rip), %rsi + fmul %st, %st(3) + fxch %st(3) + fadd %st(4), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(4) + fxch %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fsubp %st, %st(1) + fld %st(0) + movl 16(%rsp), %edx + fsub %st(2), %st + fmul %st, %st(3) + fldl (%r8) + lea 16+_P(%rip), %r8 + fmul %st, %st(1) + movsbq %dl, %rax + fxch %st(1) + fsubrp %st, %st(4) + movzwl 104(%rsp), %r9d + subl %eax, %edx + andl $32767, %r9d + fxch %st(1) + fsub %st(3), %st + shrl $8, %edx + fsubp %st, %st(2) + fld %st(2) + cmpl $16387, %r9d + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fldt (%r10) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + jle ..B1.47 +..B1.44: + addl $16350, %edx + faddp %st, %st(2) + movzwl 72(%rsp), %esi + andl $32767, %edx + andl $-32768, %esi + shlq $4, %rax + orl %edx, %esi + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + testb %cl, %cl + movw %si, 72(%rsp) + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(4) + fmul %st, %st(4) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fldt 64(%rsp) + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.46 +..B1.45: + fldt .L_2il0floatpacket.0(%rip) + fstpt 48(%rsp) +..B1.74: + fldcw 82(%rsp) +..B1.46: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.47: + je ..B1.63 +..B1.48: + fstp %st(1) + fldt .L_2il0floatpacket.0(%rip) + fstpt 48(%rsp) +..B1.49: + movzwl 56(%rsp), %r8d + lea 16382(%rdx), %esi + negl %edx + andl $-32768, %r8d + addl $16382, %edx + fld %st(0) + andl $32767, %edx + andl $32767, %esi + shlq $4, %rax + orl %edx, %r8d + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + fadd %st(2), %st + fxch %st(2) + fsubrp %st, %st(1) + fld %st(2) + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + negq %rax + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 72(%rsp), %edi + fadd %st(1), %st + fmulp %st, %st(4) + fld %st(4) + fmul %st(1), %st + andl $-32768, %edi + faddp %st, %st(4) + fldl 2056(%rdx,%rax) + orl %esi, %edi + fldl 2048(%rdx,%rax) + testb %cl, %cl + fld %st(0) + movw %di, 72(%rsp) + fadd %st(2), %st + fmulp %st, %st(5) + fld %st(6) + fmul %st(2), %st + movw %r8w, 56(%rsp) + fsubrp %st, %st(5) + fxch %st(4) + fstpt 32(%rsp) + fxch %st(3) + fmul %st, %st(5) + fldt 16(%rsp) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fsub %st(5), %st + fsubr %st, %st(4) + fxch %st(5) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 32(%rsp) + faddp %st, %st(2) + fldt 64(%rsp) + fmul %st, %st(1) + fmulp %st, %st(3) + fldt 48(%rsp) + fmul %st, %st(4) + fld %st(4) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.51 +..B1.50: + fldcw 82(%rsp) +..B1.51: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.52: + je ..B1.68 +..B1.53: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.57 +..B1.54: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.55: + fldcw 80(%rsp) +..B1.56: + movzwl 104(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.57: + cmpl $32767, %esi + jne ..B1.59 +..B1.58: + fldt 96(%rsp) + lea ones(%rip), %rdx + movb 105(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %esi + fmull (%rdx,%rsi,8) + fstpt (%rsp) + jmp ..B1.60 +..B1.59: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) +..B1.60: + testb %cl, %cl + je ..B1.62 +..B1.61: + fldcw 82(%rsp) +..B1.62: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.63: + movl 100(%rsp), %esi + cmpl $-782985146, %esi + ja ..B1.44 +..B1.64: + jne ..B1.67 +..B1.65: + cmpl $1501741449, 96(%rsp) + ja ..B1.44 +..B1.66: + fstp %st(1) + fldt .L_2il0floatpacket.0(%rip) + fstpt 48(%rsp) + jmp ..B1.49 +..B1.67: + fstp %st(1) + fldt .L_2il0floatpacket.0(%rip) + fstpt 48(%rsp) + jmp ..B1.49 +..B1.68: + movl 100(%rsp), %eax + cmpl $-1317741120, %eax + jb ..B1.4 +..B1.69: + jne ..B1.53 +..B1.70: + cmpl $833536233, 96(%rsp) + jbe ..B1.4 + jmp ..B1.53 + .align 16,0x90 + .cfi_endproc + .type coshl,@function + .size coshl,.-coshl + .data +# -- End coshl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 2 +_Q3: + .word 21845 + .word 213 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 62430 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 22894 + .word 21845 + .word 43733 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 65531 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 7054 + .word 43693 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 25016 + .word 58228 + .word 24755 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 57397 + .word 35800 + .word 53031 + .word 53262 + .word 16367 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 18360 + .word 43637 + .word 28980 + .word 40373 + .word 49076 + .word 0 + .word 0 + .word 0 + .word 16302 + .word 43691 + .word 43690 + .word 43690 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 46125 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 29965 + .word 3335 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 54950 + .word 46751 + .word 32187 + .word 37874 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 30733 + .word 25775 + .word 51110 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 49850 + .word 450 + .word 9929 + .word 51659 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 2776 + .word 45191 + .word 37201 + .word 55334 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,160 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cosl.S b/external/sgx_libm/intel64/cosl.S new file mode 100644 index 0000000000..98af90ff8f --- /dev/null +++ b/external/sgx_libm/intel64/cosl.S @@ -0,0 +1,1008 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cosl.c" + .text +..TXTST0: +# -- Begin cosl + .text + .align 16,0x90 + .globl cosl +cosl: +# parameter 1: 176 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cosl.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + subq $152, %rsp + .cfi_def_cfa_offset 176 + xorb %bpl, %bpl + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 136(%rsp) +..B1.2: + fnstcw 114(%rsp) +..B1.3: + movzwl 184(%rsp), %edx + andl $32767, %edx + movzwl 114(%rsp), %ecx + cmpl $32767, %edx + je ..B1.72 +..B1.4: + cmpl $16378, %edx + jge ..B1.48 +..B1.5: + cmpl $16372, %edx + jge ..B1.40 +..B1.6: + cmpl $16364, %edx + jge ..B1.32 +..B1.7: + cmpl $16308, %edx + jge ..B1.24 +..B1.8: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.9: + orl $-64768, %ecx + movw %cx, 112(%rsp) +..B1.10: + fldcw 112(%rsp) +..B1.11: + movzwl 184(%rsp), %edx + movb $1, %bpl + andl $32767, %edx +..B1.12: + testl %edx, %edx + jne ..B1.18 +..B1.13: + cmpl $0, 180(%rsp) + jne ..B1.15 +..B1.14: + cmpl $0, 176(%rsp) + je ..B1.19 +..B1.88: + cmpl $0, 180(%rsp) +..B1.15: + jne ..B1.17 +..B1.16: + cmpl $0, 176(%rsp) + je ..B1.18 +..B1.17: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rsp) +..B1.18: + lea _small_value_80(%rip), %rax + lea _ones(%rip), %rdx + fldt (%rax) + fsubrl (%rdx) + fstpt 8(%rsp) + jmp ..B1.20 +..B1.19: + lea _ones(%rip), %rax + fldl (%rax) + fstpt 8(%rsp) +..B1.20: + testb %bpl, %bpl + je ..B1.22 +..B1.21: + fldcw 114(%rsp) +..B1.22: + movq 136(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.23: + fldt 8(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.24: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.28 +..B1.25: + orl $-64768, %ecx + movw %cx, 112(%rsp) +..B1.26: + fldcw 112(%rsp) +..B1.27: + movb $1, %bpl +..B1.28: + fldt 176(%rsp) + lea _CP3(%rip), %rax + lea _ones(%rip), %rdx + testb %bpl, %bpl + fldt (%rax) + fmul %st(1), %st + fmulp %st, %st(1) + faddl (%rdx) + fstpt 8(%rsp) + je ..B1.30 +..B1.29: + fldcw 114(%rsp) +..B1.30: + movq 136(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.31: + fldt 8(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.32: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.33: + orl $-64768, %ecx + movw %cx, 112(%rsp) +..B1.34: + fldcw 112(%rsp) +..B1.35: + movb $1, %bpl +..B1.36: + fldt 176(%rsp) + lea 16+_CP2(%rip), %rax + fmul %st(0), %st + lea _CP2(%rip), %rdx + fldt (%rax) + lea _ones(%rip), %rcx + fmul %st(1), %st + testb %bpl, %bpl + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddl (%rcx) + fstpt 8(%rsp) + je ..B1.38 +..B1.37: + fldcw 114(%rsp) +..B1.38: + movq 136(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.39: + fldt 8(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.40: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.44 +..B1.41: + orl $-64768, %ecx + movw %cx, 112(%rsp) +..B1.42: + fldcw 112(%rsp) +..B1.43: + movb $1, %bpl +..B1.44: + fldt 176(%rsp) + lea 48+_CP1(%rip), %rax + fmul %st(0), %st + lea 32+_CP1(%rip), %rcx + fld %st(0) + lea 16+_CP1(%rip), %rdx + fmul %st(1), %st + lea _CP1(%rip), %rbx + fldt (%rax) + lea _ones(%rip), %rsi + fmul %st(1), %st + testb %bpl, %bpl + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmulp %st, %st(2) + fldt (%rbx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddl (%rsi) + fstpt 8(%rsp) + je ..B1.46 +..B1.45: + fldcw 114(%rsp) +..B1.46: + movq 136(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.47: + fldt 8(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.48: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.52 +..B1.49: + orl $-64768, %ecx + movw %cx, 112(%rsp) +..B1.50: + fldcw 112(%rsp) +..B1.51: + movzwl 184(%rsp), %edx + movb $1, %bpl + andl $32767, %edx +..B1.52: + cmpl $16382, %edx + jge ..B1.54 +..B1.53: + fldt 176(%rsp) + xorl %ecx, %ecx + movb 185(%rsp), %bl + xorl %esi, %esi + andb $-128, %bl + lea _TWO_52H(%rip), %rdx + shrb $7, %bl + fldl (%rdx) + movzbl %bl, %eax + lea _ones(%rip), %rbx + fxch %st(1) + fmull (%rbx,%rax,8) + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fxch %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fxch %st(1) + fxch %st(2) + fxch %st(1) + jmp ..B1.57 +..B1.54: + je ..B1.69 +..B1.55: + fldt 176(%rsp) + xorl %edi, %edi + movb 185(%rsp), %bl + andb $-128, %bl + shrb $7, %bl + movzbl %bl, %eax + lea _ones(%rip), %rbx + fmull (%rbx,%rax,8) + fstpt 176(%rsp) + fldt 176(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + lea 136(%rsp), %rsi + fstpt (%rsp) +..___tag_value_cosl.41: + call __libm_reduce_pi04l@PLT +..___tag_value_cosl.42: +..B1.87: + movl %eax, %esi + addq $16, %rsp + .cfi_def_cfa_offset 176 +..B1.56: + fldl 120(%rsp) + lea 3(%rsi), %ecx + lea _TWO_52H(%rip), %rax + fld %st(0) + movsd 120(%rsp), %xmm0 + shrl $2, %ecx + andl $1, %ecx + mulsd (%rax), %xmm0 + movsd %xmm0, 24(%rsp) + fldl 24(%rsp) + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fldl 128(%rsp) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st +..B1.57: + fld %st(1) + lea _TWO_53H(%rip), %rax + fmul %st(3), %st + fld %st(3) + fmul %st(2), %st + incl %esi + faddp %st, %st(1) + fstpt 88(%rsp) + fldt 88(%rsp) + fld %st(2) + fmul %st(3), %st + testl $2, %esi + fld %st(0) + fadd %st(2), %st + fstpt 40(%rsp) + fldt 40(%rsp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 72(%rsp) + fldt 72(%rsp) + fld %st(1) + fmul %st(2), %st + fld %st(0) + faddp %st, %st(2) + fldl (%rax) + fstpt 56(%rsp) + fldl (%rbx,%rcx,8) + fstpl 104(%rsp) + je ..B1.59 +..B1.58: + lea 112+_SP(%rip), %rax + lea 80+_SP(%rip), %rdx + lea 48+_SP(%rip), %rcx + lea 128+_SP(%rip), %rsi + fxch %st(4) + fstpt 8(%rsp) + lea 16+_SP(%rip), %rbx + lea 96+_SP(%rip), %rdi + lea 64+_SP(%rip), %r8 + fldt (%rax) + lea 32+_SP(%rip), %r9 + lea _SP(%rip), %r10 + lea 160+_SP(%rip), %r11 + lea 144+_SP(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r10) + faddp %st, %st(2) + fldt 40(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 72(%rsp) + fldt 88(%rsp) + fldt (%r11) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(5) + fldt (%rax) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fld %st(4) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fadd %st, %st(1) + fld %st(4) + fldt 56(%rsp) + fmul %st(3), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt 8(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldl 104(%rsp) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 24(%rsp) + jmp ..B1.60 +..B1.59: + fstp %st(3) + fstp %st(4) + fstp %st(2) + lea 112+_CP(%rip), %rax + lea 80+_CP(%rip), %rdx + lea 128+_CP(%rip), %rdi + lea 96+_CP(%rip), %r8 + lea 48+_CP(%rip), %rcx + lea 64+_CP(%rip), %r9 + lea 16+_CP(%rip), %rsi + lea 32+_CP(%rip), %r10 + fldt (%rax) + lea _CP(%rip), %r11 + lea 160+_CP(%rip), %rax + fmul %st(3), %st + fldt (%rdx) + lea 144+_CP(%rip), %rdx + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + fmul %st(4), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt (%r11) + faddp %st, %st(4) + fldt 40(%rsp) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt 72(%rsp) + fldt 88(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rdx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fldt 56(%rsp) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldl (%rbx) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldl 104(%rsp) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 24(%rsp) +..B1.60: + testb %bpl, %bpl + je ..B1.62 +..B1.61: + fldcw 114(%rsp) +..B1.62: + movq 136(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.63: + fldt 24(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.64: + call __stack_chk_fail@PLT +..B1.69: + movl 180(%rsp), %eax + cmpl $-921707870, %eax + jb ..B1.53 +..B1.70: + jne ..B1.55 +..B1.71: + cmpl $560513589, 176(%rsp) + jbe ..B1.53 + jmp ..B1.55 +..B1.72: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.76 +..B1.73: + orl $-64768, %ecx + movw %cx, 112(%rsp) +..B1.74: + fldcw 112(%rsp) +..B1.75: + movb $1, %bpl +..B1.76: + cmpl $-2147483648, 180(%rsp) + jne ..B1.79 +..B1.77: + cmpl $0, 176(%rsp) + jne ..B1.79 +..B1.78: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 24(%rsp) + fldl 24(%rsp) + fstpt 8(%rsp) + jmp ..B1.80 +..B1.79: + fldt 176(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) +..B1.80: + testb %bpl, %bpl + je ..B1.82 +..B1.81: + fldcw 114(%rsp) +..B1.82: + movq 136(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.64 +..B1.83: + fldt 8(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cosl,@function + .size cosl,.-cosl + .data +# -- End cosl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_CP3: + .word 0 + .word 65450 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _CP3,@object + .size _CP3,16 + .align 2 +_CP2: + .word 63855 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 18238 + .word 17476 + .word 43656 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP2,@object + .size _CP2,32 + .align 2 +_CP1: + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 47533 + .word 43689 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 14131 + .word 49466 + .word 24756 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 37142 + .word 18013 + .word 35855 + .word 53259 + .word 16367 + .word 0 + .word 0 + .word 0 + .type _CP1,@object + .size _CP1,64 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP,@object + .size _SP,176 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 0 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP,@object + .size _CP,176 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cpow.S b/external/sgx_libm/intel64/cpow.S new file mode 100644 index 0000000000..80151b7eaa --- /dev/null +++ b/external/sgx_libm/intel64/cpow.S @@ -0,0 +1,931 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cpow.c" + .text +..TXTST0: +# -- Begin cpowf + .text + .align 16,0x90 + .globl cpowf +cpowf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_cpowf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + movaps %xmm1, %xmm3 + cvtps2pd %xmm0, %xmm1 + cvtps2pd %xmm3, %xmm3 + movaps %xmm1, %xmm0 + movaps %xmm3, %xmm2 + unpckhpd %xmm1, %xmm1 + unpckhpd %xmm3, %xmm3 +..___tag_value_cpowf.4: + call cpow@PLT +..___tag_value_cpowf.5: +..B1.5: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type cpowf,@function + .size cpowf,.-cpowf + .data +# -- End cpowf + .text +# -- Begin cpow + .text + .align 16,0x90 + .globl cpow +cpow: +# parameter 1: %xmm0 +# parameter 2: %xmm2 +..B2.1: + .cfi_startproc +..___tag_value_cpow.8: +..L9: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + xorb %r14b, %r14b + subq $328, %rsp + .cfi_def_cfa_offset 352 + movsd %xmm1, 312(%rsp) + movsd %xmm0, 304(%rsp) + movsd %xmm2, 288(%rsp) + movsd %xmm3, 296(%rsp) +..B2.2: + fnstcw 10(%rsp) +..B2.3: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.7 +..B2.4: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B2.5: + fldcw 8(%rsp) +..B2.6: + movb $1, %r14b +..B2.7: + movsd 304(%rsp), %xmm0 +..___tag_value_cpow.15: + call __libm_internal_isnzfinite@PLT +..___tag_value_cpow.16: +..B2.8: + testl %eax, %eax + jne ..B2.29 +..B2.9: + lea ZEROA(%rip), %r13 + movsd 312(%rsp), %xmm3 + movsd (%r13), %xmm2 + ucomisd %xmm2, %xmm3 + jp ..B2.10 + je ..B2.25 +..B2.10: + movsd 288(%rsp), %xmm1 + ucomisd %xmm2, %xmm1 + jp ..B2.11 + je ..B2.23 +..B2.11: + ucomisd %xmm2, %xmm3 + jp ..B2.12 + je ..B2.18 +..B2.12: + movsd 296(%rsp), %xmm0 + ucomisd %xmm2, %xmm0 + jp ..B2.13 + je ..B2.17 +..B2.13: + fldl 304(%rsp) + fstpt 48(%rsp) + fldl 312(%rsp) + fstpt 64(%rsp) + fldt 48(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt 64(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fstpt (%rsp) + call logl@PLT +..B2.46: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 160(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2dl@PLT +..B2.45: + fldt .L_2il0floatpacket.2(%rip) + addq $32, %rsp + .cfi_def_cfa_offset 352 + fxch %st(1) + fstpt 80(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + call expl@PLT +..B2.44: + addq $16, %rsp + .cfi_def_cfa_offset 352 + lea _LD_PI_DIV_180(%rip), %rax + fstpt 208(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) + call expl@PLT +..B2.43: + fldt .L_2il0floatpacket.2(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 352 + fxch %st(1) + fstpt 224(%rsp) + fldt 208(%rsp) + fldt 224(%rsp) + fdivrp %st, %st(1) + fstpt 96(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + call cosl@PLT +..B2.42: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 176(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosdl@PLT +..B2.41: + fldt .L_2il0floatpacket.2(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 352 + fxch %st(1) + fstpt 112(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fxch %st(1) + fmull 312(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sinl@PLT +..B2.40: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 192(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sindl@PLT +..B2.39: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 128(%rsp) + fldt 176(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 192(%rsp) + fldt 128(%rsp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt 240(%rsp) + fldt 192(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 128(%rsp) + fldt 176(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 256(%rsp) + fldt 240(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 272(%rsp) + fldt 256(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 280(%rsp) +..B2.14: + testb %r14b, %r14b + je ..B2.16 +..B2.15: + fldcw 10(%rsp) +..B2.16: + movsd 272(%rsp), %xmm0 + movsd 280(%rsp), %xmm1 + addq $328, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 352 + .cfi_offset 13, -16 + .cfi_offset 14, -24 +..B2.17: + fldl 304(%rsp) + fstpt 48(%rsp) + fldl 312(%rsp) + fstpt 64(%rsp) + fldt 48(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt 64(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + movsd .L_2il0floatpacket.1(%rip), %xmm0 + faddp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + mulsd 320(%rsp), %xmm0 + fstpt (%rsp) + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt 16(%rsp) + call powl@PLT +..B2.50: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 96(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2dl@PLT +..B2.49: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosdl@PLT +..B2.48: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 176(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sindl@PLT +..B2.47: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 192(%rsp) + fldt 96(%rsp) + fldt 176(%rsp) + fmulp %st, %st(1) + fstpl 272(%rsp) + fldt 96(%rsp) + fldt 192(%rsp) + fmulp %st, %st(1) + fstpl 280(%rsp) + jmp ..B2.14 +..B2.18: + movsd 304(%rsp), %xmm0 + comisd %xmm2, %xmm0 + jbe ..B2.20 +..B2.19: + addq $-32, %rsp + .cfi_def_cfa_offset 384 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt (%rsp) + movsd %xmm1, 32(%rsp) + fldl 32(%rsp) + fstpt 16(%rsp) + call powl@PLT +..B2.54: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 96(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 320(%rsp) + fstpt (%rsp) + call logl@PLT +..B2.53: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 32(%rsp) + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosl@PLT +..B2.52: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 176(%rsp) + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sinl@PLT +..B2.51: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 192(%rsp) + fldt 176(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 272(%rsp) + fldt 192(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 280(%rsp) + jmp ..B2.14 +..B2.20: + comisd %xmm0, %xmm2 + jbe ..B2.22 +..B2.21: + fldl 312(%rsp) + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fchs + fstpt 16(%rsp) + fstpt 64(%rsp) + fldt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fstpt (%rsp) + call logl@PLT +..B2.62: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 160(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2dl@PLT +..B2.61: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 80(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call expl@PLT +..B2.60: + addq $16, %rsp + .cfi_def_cfa_offset 352 + lea _LD_PI_DIV_180(%rip), %rax + fstpt 208(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) + call expl@PLT +..B2.59: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 224(%rsp) + fldt 208(%rsp) + fldt 224(%rsp) + fdivrp %st, %st(1) + fstpt 96(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosl@PLT +..B2.58: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 176(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosdl@PLT +..B2.57: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 112(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sinl@PLT +..B2.56: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 192(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sindl@PLT +..B2.55: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 128(%rsp) + fldt 176(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 192(%rsp) + fldt 128(%rsp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt 240(%rsp) + fldt 192(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 128(%rsp) + fldt 176(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 256(%rsp) + fldt 240(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 272(%rsp) + fldt 256(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 280(%rsp) + jmp ..B2.14 +..B2.22: + movq 304(%rsp), %rax + movq 312(%rsp), %rdx + movq %rax, 272(%rsp) + movq %rdx, 280(%rsp) + jmp ..B2.14 +..B2.23: + movsd 296(%rsp), %xmm0 + ucomisd %xmm2, %xmm0 + jne ..B2.11 + jp ..B2.11 +..B2.24: + fldl 304(%rsp) + fstpt 48(%rsp) + fldl 312(%rsp) + fstpt 64(%rsp) + fldt 48(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt 64(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fstpt (%rsp) + call logl@PLT +..B2.65: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 160(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2l@PLT +..B2.64: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 80(%rsp) + fldt 160(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + faddp %st, %st(1) + fstpt (%rsp) + call sinl@PLT +..B2.63: + addq $16, %rsp + .cfi_def_cfa_offset 352 + movq $0x3ff0000000000000, %rax + fstpl (%rsp) + movsd (%rsp), %xmm1 + movsd (%r13), %xmm0 + movsd .L_2il0floatpacket.0(%rip), %xmm2 + andps %xmm2, %xmm1 + andnps %xmm0, %xmm2 + orps %xmm1, %xmm2 + movq %rax, 272(%rsp) + movsd %xmm2, 280(%rsp) + jmp ..B2.14 +..B2.25: + movsd 296(%rsp), %xmm0 + ucomisd %xmm2, %xmm0 + jne ..B2.10 + jp ..B2.10 +..B2.26: + movsd 304(%rsp), %xmm0 + comisd %xmm0, %xmm2 + jbe ..B2.28 +..B2.27: + fldl 312(%rsp) + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fchs + fstpt 16(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2dl@PLT +..B2.69: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 80(%rsp) + fldt 16(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fstpt (%rsp) + fldl 320(%rsp) + fstpt 16(%rsp) + call powl@PLT +..B2.68: + addq $32, %rsp + .cfi_def_cfa_offset 352 + fstpt 96(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosdl@PLT +..B2.67: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 112(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sindl@PLT +..B2.66: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 128(%rsp) + fldt 96(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fstpl 272(%rsp) + fldt 96(%rsp) + fldt 128(%rsp) + fmulp %st, %st(1) + fstpl 280(%rsp) + jmp ..B2.14 +..B2.28: + movsd 288(%rsp), %xmm1 + movsd %xmm3, (%rsp) + call pow@PLT +..B2.70: + movsd (%rsp), %xmm3 + movsd %xmm0, 272(%rsp) + movsd %xmm3, 280(%rsp) + jmp ..B2.14 +..B2.29: + movsd 312(%rsp), %xmm0 +..___tag_value_cpow.87: + call __libm_internal_isnzfinite@PLT +..___tag_value_cpow.88: +..B2.30: + testl %eax, %eax + je ..B2.9 +..B2.31: + movsd 288(%rsp), %xmm0 +..___tag_value_cpow.89: + call __libm_internal_isnzfinite@PLT +..___tag_value_cpow.90: +..B2.32: + testl %eax, %eax + je ..B2.9 +..B2.33: + movsd 296(%rsp), %xmm0 +..___tag_value_cpow.91: + call __libm_internal_isnzfinite@PLT +..___tag_value_cpow.92: +..B2.34: + testl %eax, %eax + je ..B2.9 +..B2.35: + fldl 304(%rsp) + fstpt 48(%rsp) + fldl 312(%rsp) + fstpt 64(%rsp) + fldt 48(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt 64(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fstpt (%rsp) + call logl@PLT +..B2.81: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 160(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 384 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) + call atan2dl@PLT +..B2.80: + fldt .L_2il0floatpacket.2(%rip) + addq $32, %rsp + .cfi_def_cfa_offset 352 + fxch %st(1) + fstpt 80(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + call expl@PLT +..B2.79: + addq $16, %rsp + .cfi_def_cfa_offset 352 + lea _LD_PI_DIV_180(%rip), %rax + fstpt 208(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) + call expl@PLT +..B2.78: + fldt .L_2il0floatpacket.2(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 352 + fxch %st(1) + fstpt 224(%rsp) + fldt 208(%rsp) + fldt 224(%rsp) + fdivrp %st, %st(1) + fstpt 96(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 312(%rsp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + call cosl@PLT +..B2.77: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 176(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call cosdl@PLT +..B2.76: + fldt .L_2il0floatpacket.2(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 352 + fxch %st(1) + fstpt 112(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fxch %st(1) + fmull 312(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sinl@PLT +..B2.75: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 192(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 368 + fldl 304(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + call sindl@PLT +..B2.74: + addq $16, %rsp + .cfi_def_cfa_offset 352 + fstpt 128(%rsp) + fldt 176(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 192(%rsp) + fldt 128(%rsp) + fmulp %st, %st(1) + fsubrp %st, %st(1) + fstpt 240(%rsp) + fldt 192(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fldt 128(%rsp) + fldt 176(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 256(%rsp) + fldt 240(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 272(%rsp) + fldt 256(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpl 280(%rsp) + jmp ..B2.14 + .align 16,0x90 + .cfi_endproc + .type cpow,@function + .size cpow,.-cpow + .data +# -- End cpow + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +ZEROA: + .long 0 + .long 0 + .type ZEROA,@object + .size ZEROA,8 + .space 8, 0x00 # pad + .align 16 +_LD_PI_DIV_180: + .word 51374 + .word 38121 + .word 13586 + .word 36602 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _LD_PI_DIV_180,@object + .size _LD_PI_DIV_180,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x80000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cpowl.S b/external/sgx_libm/intel64/cpowl.S new file mode 100644 index 0000000000..875f0ba939 --- /dev/null +++ b/external/sgx_libm/intel64/cpowl.S @@ -0,0 +1,137 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cpowl.c" + .text +..TXTST0: +# -- Begin cpowl + .text + .align 16,0x90 + .globl cpowl +cpowl: +# parameter 1: 48 + %rsp +# parameter 2: 80 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cpowl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 32(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 80 + movq %rsp, %r8 + movq 80(%rsp), %rdx + movq 88(%rsp), %rcx + movq 96(%rsp), %rsi + movq 104(%rsp), %rdi + movq %rdx, (%r8) + movq %rcx, 8(%r8) + movq %rsi, 16(%r8) + movq %rdi, 24(%r8) + call clogl@PLT +..B1.9: + fxch %st(1) + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 48 + fldt 80(%rsp) + fld %st(0) + fmul %st(2), %st + fxch %st(1) + fmul %st(3), %st + fldt 96(%rsp) + fld %st(0) + fmulp %st, %st(5) + fxch %st(4) + fsubrp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 80 + movq %rsp, %rdi + movq 32(%rsp), %rax + movq 40(%rsp), %rdx + movq 48(%rsp), %rcx + movq 56(%rsp), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %rsi, 24(%rdi) + call cexpl@PLT +..B1.8: + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 48 + movq 32(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.4 +..B1.2: + movq 32(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.4 +..B1.3: + addq $40, %rsp + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 48 +..B1.4: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type cpowl,@function + .size cpowl,.-cpowl + .data +# -- End cpowl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cproj.S b/external/sgx_libm/intel64/cproj.S new file mode 100644 index 0000000000..f2fe33a5fe --- /dev/null +++ b/external/sgx_libm/intel64/cproj.S @@ -0,0 +1,132 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cproj.c" + .text +..TXTST0: +# -- Begin cproj + .text + .align 16,0x90 + .globl cproj +cproj: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cproj.1: +..L2: + + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %eax + andl $32752, %eax + movsd %xmm1, -16(%rsp) + cmpl $32752, %eax + je ..B1.10 +..B1.2: + movzwl -10(%rsp), %eax + andl $32752, %eax + cmpl $32752, %eax + jne ..B1.9 +..B1.3: + testl $1048575, -12(%rsp) + jne ..B1.9 +..B1.4: + cmpl $0, -16(%rsp) + jne ..B1.9 +..B1.5: + lea DBL_PINFA(%rip), %rax + testb $-128, -9(%rsp) + movq (%rax), %rdx + movq %rdx, -40(%rsp) + je ..B1.7 +..B1.6: + lea DBL_NZEROA(%rip), %rax + movq (%rax), %rdx + movq %rdx, -32(%rsp) + jmp ..B1.8 +..B1.7: + lea DBL_PZEROA(%rip), %rax + movq (%rax), %rdx + movq %rdx, -32(%rsp) +..B1.8: + movsd -40(%rsp), %xmm0 + movsd -32(%rsp), %xmm1 + ret +..B1.9: + movsd -24(%rsp), %xmm0 + movsd -16(%rsp), %xmm1 + ret +..B1.10: + testl $1048575, -20(%rsp) + jne ..B1.2 +..B1.11: + cmpl $0, -24(%rsp) + je ..B1.5 + jmp ..B1.2 + .align 16,0x90 + .cfi_endproc + .type cproj,@function + .size cproj,.-cproj + .data +# -- End cproj + .section .rodata, "a" + .align 16 + .align 16 +DBL_PINFA: + .long 0 + .long 2146435072 + .type DBL_PINFA,@object + .size DBL_PINFA,8 + .space 8, 0x00 # pad + .align 16 +DBL_NZEROA: + .long 0 + .long 2147483648 + .type DBL_NZEROA,@object + .size DBL_NZEROA,8 + .space 8, 0x00 # pad + .align 16 +DBL_PZEROA: + .long 0 + .long 0 + .type DBL_PZEROA,@object + .size DBL_PZEROA,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cprojf.S b/external/sgx_libm/intel64/cprojf.S new file mode 100644 index 0000000000..734fbc8cce --- /dev/null +++ b/external/sgx_libm/intel64/cprojf.S @@ -0,0 +1,107 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cprojf.c" + .text +..TXTST0: +# -- Begin cprojf + .text + .align 16,0x90 + .globl cprojf +cprojf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_cprojf.1: +..L2: + + movsd %xmm0, -16(%rsp) + movzwl -14(%rsp), %eax + andl $32640, %eax + cmpl $32640, %eax + je ..B1.9 +..B1.2: + movzwl -10(%rsp), %eax + andl $32640, %eax + cmpl $32640, %eax + jne ..B1.8 +..B1.3: + testl $8388607, -12(%rsp) + jne ..B1.8 +..B1.4: + movl $2139095040, -24(%rsp) + testb $-128, -9(%rsp) + je ..B1.6 +..B1.5: + movl $-2147483648, -20(%rsp) + jmp ..B1.7 +..B1.6: + movl $0, -20(%rsp) +..B1.7: + movsd -24(%rsp), %xmm0 + ret +..B1.8: + movsd -16(%rsp), %xmm0 + ret +..B1.9: + testl $8388607, -16(%rsp) + je ..B1.4 + jmp ..B1.2 + .align 16,0x90 + .cfi_endproc + .type cprojf,@function + .size cprojf,.-cprojf + .data +# -- End cprojf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.5: + .long 0x7f800000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,4 + .align 4 +.L_2il0floatpacket.6: + .long 0x80000000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/cprojl.S b/external/sgx_libm/intel64/cprojl.S new file mode 100644 index 0000000000..a212664b1b --- /dev/null +++ b/external/sgx_libm/intel64/cprojl.S @@ -0,0 +1,152 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "cprojl.c" + .text +..TXTST0: +# -- Begin cprojl + .text + .align 16,0x90 + .globl cprojl +cprojl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_cprojl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movzwl 56(%rsp), %edx + andl $32767, %edx + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 32(%rsp) + cmpl $32767, %edx + je ..B1.12 +..B1.2: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.9 +..B1.3: + fldt 48(%rsp) + fstpt (%rsp) + fldt 64(%rsp) + fstpt 16(%rsp) +..B1.4: + movq 32(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.8 +..B1.5: + fldt (%rsp) + fldt 16(%rsp) + movq 32(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.7 +..B1.6: + addq $40, %rsp + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 48 +..B1.7: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.8: + call __stack_chk_fail@PLT +..B1.9: + movq $0x8000000000000000, %rax + cmpq 64(%rsp), %rax + jne ..B1.3 +..B1.10: + fldt .L_2il0floatpacket.7(%rip) + fstpt 16(%rsp) + fldt .L_2il0floatpacket.7(%rip) + fstpt (%rsp) +..B1.11: + fldt .L_2il0floatpacket.8(%rip) + movb 9+.L_2il0floatpacket.7(%rip), %cl + movb 73(%rsp), %dl + andb $127, %cl + andb $-128, %dl + movzwl 8+.L_2il0floatpacket.8(%rip), %eax + orb %dl, %cl + fstpt (%rsp) + orl $-32769, %eax + fldt .L_2il0floatpacket.7(%rip) + fstpt 16(%rsp) + movw %ax, 8(%rsp) + movb %cl, 25(%rsp) + jmp ..B1.4 +..B1.12: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.2 +..B1.13: + fldt .L_2il0floatpacket.7(%rip) + fstpt 16(%rsp) + fldt .L_2il0floatpacket.7(%rip) + fstpt (%rsp) + jmp ..B1.11 + .align 16,0x90 + .cfi_endproc + .type cprojl,@function + .size cprojl,.-cprojl + .data +# -- End cprojl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/creal.S b/external/sgx_libm/intel64/creal.S new file mode 100644 index 0000000000..fd45e1b9c9 --- /dev/null +++ b/external/sgx_libm/intel64/creal.S @@ -0,0 +1,64 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "creal.c" + .text +..TXTST0: +# -- Begin creal + .text + .align 16,0x90 + .globl creal +creal: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_creal.1: +..L2: + + ret + .align 16,0x90 + .cfi_endproc + .type creal,@function + .size creal,.-creal + .data +# -- End creal + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/crealf.S b/external/sgx_libm/intel64/crealf.S new file mode 100644 index 0000000000..96dd08ff3f --- /dev/null +++ b/external/sgx_libm/intel64/crealf.S @@ -0,0 +1,66 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "crealf.c" + .text +..TXTST0: +# -- Begin crealf + .text + .align 16,0x90 + .globl crealf +crealf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_crealf.1: +..L2: + + movsd %xmm0, -8(%rsp) + movss -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type crealf,@function + .size crealf,.-crealf + .data +# -- End crealf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/creall.S b/external/sgx_libm/intel64/creall.S new file mode 100644 index 0000000000..7ae974ad56 --- /dev/null +++ b/external/sgx_libm/intel64/creall.S @@ -0,0 +1,65 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "creall.c" + .text +..TXTST0: +# -- Begin creall + .text + .align 16,0x90 + .globl creall +creall: +# parameter 1: 8 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_creall.1: +..L2: + + fldt 8(%rsp) + ret + .align 16,0x90 + .cfi_endproc + .type creall,@function + .size creall,.-creall + .data +# -- End creall + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csin.S b/external/sgx_libm/intel64/csin.S new file mode 100644 index 0000000000..78cd00ed8d --- /dev/null +++ b/external/sgx_libm/intel64/csin.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csin.c" + .text +..TXTST0: +# -- Begin csin + .text + .align 16,0x90 + .globl csin +csin: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_csin.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movsd %xmm1, 24(%rsp) + movzwl 30(%rsp), %eax + andl $32752, %eax + movsd %xmm0, 16(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.5 +..B1.3: + testl $1048575, 28(%rsp) + jne ..B1.7 +..B1.4: + cmpl $0, 24(%rsp) + jne ..B1.7 +..B1.5: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.6: + movb 31(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm1 + movhpd 8(%rsp), %xmm1 +..B1.7: + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + call csinh@PLT +..B1.16: + movsd %xmm0, 16(%rsp) + movzwl 22(%rsp), %eax + andl $32752, %eax + movsd %xmm1, 24(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.11 +..B1.9: + testl $1048575, 20(%rsp) + jne ..B1.13 +..B1.10: + cmpl $0, 16(%rsp) + jne ..B1.13 +..B1.11: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.12: + movb 23(%rsp), %al + notb %al + movb 15(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movsd (%rsp), %xmm1 + movb %dl, 15(%rsp) + movhpd 8(%rsp), %xmm1 +..B1.13: + movaps %xmm1, %xmm2 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm2 + movaps %xmm2, %xmm1 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type csin,@function + .size csin,.-csin + .data +# -- End csin + .text +# -- Begin csinf + .text + .align 16,0x90 + .globl csinf +csinf: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_csinf.6: +..L7: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) + movzwl 14(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.4 +..B2.3: + testl $8388607, 12(%rsp) + jne ..B2.6 +..B2.4: + movsd %xmm0, (%rsp) +..B2.5: + movb 15(%rsp), %al + notb %al + movb 3(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 3(%rsp) + movsd (%rsp), %xmm0 +..B2.6: + call csinhf@PLT +..B2.14: + movsd %xmm0, 8(%rsp) + movzwl 10(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.9 +..B2.8: + testl $8388607, 8(%rsp) + jne ..B2.11 +..B2.9: + movsd %xmm0, (%rsp) +..B2.10: + movb 11(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm0 +..B2.11: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type csinf,@function + .size csinf,.-csinf + .data +# -- End csinf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csinh.S b/external/sgx_libm/intel64/csinh.S new file mode 100644 index 0000000000..0c5a8e4b5a --- /dev/null +++ b/external/sgx_libm/intel64/csinh.S @@ -0,0 +1,522 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinh.c" + .text +..TXTST0: +# -- Begin csinhf + .text + .align 16,0x90 + .globl csinhf +csinhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_csinhf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_csinhf.4: + call csinh@PLT +..___tag_value_csinhf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movl $8388608, (%rsp) + movss (%rsp), %xmm1 + movss (%rsp), %xmm0 + mulss %xmm0, %xmm1 + movsd 4(%rsp), %xmm0 + movss %xmm1, (%rsp) +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type csinhf,@function + .size csinhf,.-csinhf + .data +# -- End csinhf + .text +# -- Begin csinh + .text + .align 16,0x90 + .globl csinh +csinh: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_csinh.8: +..L9: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + movq %fs:40, %rax + subq $112, %rsp + .cfi_def_cfa_offset 144 + movsd %xmm0, 48(%rsp) + xorq %rsp, %rax + movzwl 54(%rsp), %r14d + andl $32752, %r14d + shrl $4, %r14d + movsd %xmm1, 56(%rsp) + cmpl $2047, %r14d + movq %rax, 96(%rsp) + jge ..B2.23 +..B2.2: + testl %r14d, %r14d + jle ..B2.42 +..B2.3: + movzwl 62(%rsp), %r13d + andl $32752, %r13d + shrl $4, %r13d + cmpl $2047, %r13d + jge ..B2.24 +..B2.4: + testl %r13d, %r13d + jle ..B2.40 +..B2.5: + cmpl $1034, %r14d + jl ..B2.11 +..B2.6: + lea _CONSTANTS(%rip), %rax + movsd 48(%rsp), %xmm1 + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm1 + movsd %xmm0, 32(%rsp) + movsd 56(%rsp), %xmm0 + movsd %xmm1, 24(%rsp) + movsd %xmm0, 16(%rsp) + call __libm_sse2_sincos@PLT +..B2.52: + movaps %xmm0, %xmm2 + testl %r13d, %r13d + movsd 24(%rsp), %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%rsp) + jle ..B2.8 +..B2.7: + movsd 32(%rsp), %xmm0 + mulsd %xmm2, %xmm0 + movsd %xmm0, 32(%rsp) + jmp ..B2.9 +..B2.8: + movsd 32(%rsp), %xmm0 + mulsd 16(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) +..B2.9: + movsd %xmm0, 8(%rsp) + movq 96(%rsp), %rax + xorq %rsp, %rax + movsd (%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.39 +..B2.10: + movsd 32(%rsp), %xmm1 + addq $112, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B2.11: + movsd 48(%rsp), %xmm0 + lea 64(%rsp), %rdi +..___tag_value_csinh.28: + call __libm_cosh_k64@PLT +..___tag_value_csinh.29: +..B2.53: + movl %eax, %r15d +..B2.12: + movsd 64(%rsp), %xmm0 + movsd 72(%rsp), %xmm4 + movaps %xmm0, %xmm5 + movsd .L_2il0floatpacket.11(%rip), %xmm3 + addsd %xmm4, %xmm5 + mulsd %xmm5, %xmm3 + movaps %xmm5, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm3, %xmm2 + subsd %xmm1, %xmm4 + subsd %xmm5, %xmm2 + movzwl 54(%rsp), %eax + subsd %xmm2, %xmm3 + andl $32752, %eax + subsd %xmm3, %xmm5 + movsd %xmm3, 64(%rsp) + cmpl $13168, %eax + addsd %xmm4, %xmm5 + movsd %xmm5, 72(%rsp) + jge ..B2.14 +..B2.13: + lea 16+_CONSTANTS(%rip), %r14 + lea 40(%rsp), %rdx + movsd 8(%rdx), %xmm0 + pxor %xmm5, %xmm5 + mulsd (%r14), %xmm0 + movsd %xmm0, -8(%rdx) + movzwl -2(%rdx), %eax + movl %eax, %r14d + andl $32752, %r14d + andl $-32753, %eax + shrl $4, %r14d + orl $-49168, %eax + movw %ax, -2(%rdx) + addl $-1279, %r14d + jmp ..B2.16 +..B2.14: + movsd 48(%rsp), %xmm0 + lea 32(%rsp), %rdi +..___tag_value_csinh.30: + call __libm_sinh_k64@PLT +..___tag_value_csinh.31: +..B2.54: + movl %eax, %r14d +..B2.15: + lea 40(%rsp), %rdx + movsd (%rdx), %xmm5 +..B2.16: + movsd 32(%rsp), %xmm0 + movaps %xmm5, %xmm4 + movsd .L_2il0floatpacket.11(%rip), %xmm3 + lea 16(%rsp), %rdi + addsd %xmm0, %xmm4 + mulsd %xmm4, %xmm3 + movaps %xmm4, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm3, %xmm2 + lea 80(%rsp), %rsi + movsd -24(%rsi), %xmm0 + subsd %xmm4, %xmm2 + subsd %xmm1, %xmm5 + subsd %xmm2, %xmm3 + movsd %xmm3, -48(%rsi) + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + movsd %xmm5, (%rdx) +..___tag_value_csinh.32: + call __libm_sincos_k64@PLT +..___tag_value_csinh.33: +..B2.17: + movsd 80(%rsp), %xmm0 + lea 8+_CONSTANTS(%rip), %rax + movsd 88(%rsp), %xmm4 + movaps %xmm0, %xmm3 + movsd .L_2il0floatpacket.11(%rip), %xmm6 + addsd %xmm4, %xmm3 + mulsd %xmm3, %xmm6 + movaps %xmm3, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm6, %xmm2 + subsd %xmm1, %xmm4 + subsd %xmm3, %xmm2 + movsd (%rax), %xmm5 + subsd %xmm2, %xmm6 + movzwl 62(%rsp), %edx + subsd %xmm6, %xmm3 + addsd %xmm5, %xmm6 + addsd %xmm3, %xmm4 + andl $32752, %edx + movsd %xmm4, 88(%rsp) + cmpl $13168, %edx + movsd %xmm6, 80(%rsp) + jl ..B2.19 +..B2.18: + xorl %r13d, %r13d + lea 24(%rsp), %rdx + movsd (%rdx), %xmm5 + jmp ..B2.20 +..B2.19: + lea 16+_CONSTANTS(%rip), %r13 + lea 24(%rsp), %rdx + movsd 32(%rdx), %xmm0 + pxor %xmm5, %xmm5 + mulsd (%r13), %xmm0 + movsd %xmm0, -8(%rdx) + movzwl -2(%rdx), %eax + movl %eax, %r13d + andl $32752, %r13d + andl $-32753, %eax + shrl $4, %r13d + orl $-49168, %eax + movw %ax, -2(%rdx) + addl $-1279, %r13d +..B2.20: + movsd 16(%rsp), %xmm0 + movaps %xmm5, %xmm4 + movsd .L_2il0floatpacket.11(%rip), %xmm3 + lea 32(%rsp), %rsi + movl %r14d, %edi + lea (%rsp), %rcx + addsd %xmm0, %xmm4 + mulsd %xmm4, %xmm3 + movaps %xmm4, %xmm1 + subsd %xmm0, %xmm1 + movaps %xmm3, %xmm2 + subsd %xmm1, %xmm5 + subsd %xmm4, %xmm2 + subsd %xmm2, %xmm3 + movsd %xmm3, 16(%rcx) + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + movsd %xmm5, (%rdx) + lea 80(%rsp), %rdx +..___tag_value_csinh.34: + call __libm_mul_k64@PLT +..___tag_value_csinh.35: +..B2.21: + addl %r15d, %r13d + lea 64(%rsp), %rsi + movl %r13d, %edi + lea 16(%rsp), %rdx + lea 8(%rsp), %rcx +..___tag_value_csinh.36: + call __libm_mul_k64@PLT +..___tag_value_csinh.37: +..B2.22: + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.37 +..B2.23: + movzwl 62(%rsp), %r13d + andl $32752, %r13d + shrl $4, %r13d +..B2.24: + testl %r13d, %r13d + jne ..B2.28 +..B2.25: + testl $1048575, 60(%rsp) + jne ..B2.28 +..B2.26: + cmpl $0, 56(%rsp) + jne ..B2.28 +..B2.27: + movsd 48(%rsp), %xmm0 + call sinh@PLT +..B2.55: + movhpd 56(%rsp), %xmm0 + movsd %xmm0, (%rsp) + movhpd %xmm0, 8(%rsp) + jmp ..B2.37 +..B2.28: + cmpl $2047, %r13d + jge ..B2.31 +..B2.29: + movsd 48(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + call sinh@PLT +..B2.57: + movsd %xmm0, 40(%rsp) + movsd 56(%rsp), %xmm0 + movsd %xmm0, 16(%rsp) + call __libm_sse2_sincos@PLT +..B2.56: + movsd %xmm0, 24(%rsp) + testl %r13d, %r13d + movsd 40(%rsp), %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%rsp) + jle ..B2.45 +..B2.30: + movsd 32(%rsp), %xmm0 + call cosh@PLT +..B2.58: + mulsd 24(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.37 +..B2.31: + movsd 56(%rsp), %xmm0 + call sin@PLT +..B2.59: + movsd %xmm0, 8(%rsp) + cmpl $2047, %r14d + je ..B2.35 +..B2.32: + testl %r14d, %r14d + jne ..B2.36 +..B2.33: + testl $1048575, 52(%rsp) + jne ..B2.36 +..B2.34: + cmpl $0, 48(%rsp) + jne ..B2.36 +..B2.35: + movsd 48(%rsp), %xmm0 + call sinh@PLT +..B2.60: + movsd %xmm0, (%rsp) + movhpd 8(%rsp), %xmm0 + jmp ..B2.37 +..B2.36: + movsd 48(%rsp), %xmm2 + mulsd %xmm0, %xmm2 + movaps %xmm2, %xmm0 + movhpd 8(%rsp), %xmm0 + movsd %xmm2, (%rsp) +..B2.37: + movq 96(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.39 +..B2.38: + movaps %xmm0, %xmm1 + unpckhpd %xmm0, %xmm1 + addq $112, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B2.39: + call __stack_chk_fail@PLT +..B2.40: + testl $1048575, 60(%rsp) + jne ..B2.5 +..B2.41: + cmpl $0, 56(%rsp) + jne ..B2.5 + jmp ..B2.24 +..B2.42: + testl $1048575, 52(%rsp) + jne ..B2.3 +..B2.43: + cmpl $0, 48(%rsp) + jne ..B2.3 + jmp ..B2.23 +..B2.45: + testl %r14d, %r14d + jne ..B2.48 +..B2.46: + testl $1048575, 52(%rsp) + jne ..B2.48 +..B2.47: + cmpl $0, 48(%rsp) + je ..B2.30 +..B2.48: + movsd 32(%rsp), %xmm0 + call cosh@PLT +..B2.61: + mulsd 16(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + movsd (%rsp), %xmm0 + movhpd 8(%rsp), %xmm0 + jmp ..B2.37 + .align 16,0x90 + .cfi_endproc + .type csinh,@function + .size csinh,.-csinh + .data +# -- End csinh + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.11: + .long 0x02000000,0x41a00000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 4 +.L_2il0floatpacket.10: + .long 0x00800000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +_CONSTANTS: + .long 0 + .long 2145386496 + .long 0 + .long 1048576 + .long 0 + .long 1341128704 + .type _CONSTANTS,@object + .size _CONSTANTS,24 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csinhl.S b/external/sgx_libm/intel64/csinhl.S new file mode 100644 index 0000000000..0dd65ade4a --- /dev/null +++ b/external/sgx_libm/intel64/csinhl.S @@ -0,0 +1,694 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinhl.c" + .text +..TXTST0: +# -- Begin csinhl + .text + .align 16,0x90 + .globl csinhl +csinhl: +# parameter 1: 336 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_csinhl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + subq $296, %rsp + .cfi_def_cfa_offset 336 + xorb %r15b, %r15b + fldt .L_2il0floatpacket.6(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 288(%rsp) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 256(%rsp) + fldt 256(%rsp) + fstpt 272(%rsp) +..B1.2: + fnstcw 114(%rsp) +..B1.3: + movzwl 114(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 112(%rsp) +..B1.5: + fldcw 112(%rsp) +..B1.6: + movb $1, %r15b +..B1.7: + movzwl 344(%rsp), %r13d + andl $32767, %r13d + cmpl $32767, %r13d + jge ..B1.33 +..B1.8: + testl %r13d, %r13d + jle ..B1.51 +..B1.9: + movzwl 360(%rsp), %ebx + andl $32767, %ebx + cmpl $32767, %ebx + jge ..B1.33 +..B1.10: + testl %ebx, %ebx + jle ..B1.49 +..B1.11: + cmpl $16398, %r13d + jl ..B1.20 +..B1.12: + fldt 336(%rsp) + lea _CONSTANTS(%rip), %rax + fldt 352(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt (%rax) + fmul %st(0), %st + fmul %st, %st(2) + fxch %st(2) + fstpt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstpt (%rsp) + fstpt 48(%rsp) + call cosl@PLT +..B1.59: + fldt 48(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt (%rsp) + testl %ebx, %ebx + fmulp %st, %st(2) + fxch %st(1) + fstpt 256(%rsp) + jle ..B1.14 +..B1.13: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 48(%rsp) + call sinl@PLT +..B1.60: + fldt 48(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fmulp %st, %st(1) + jmp ..B1.15 +..B1.14: + fldt 16(%rsp) + fmulp %st, %st(1) +..B1.15: + fstpt 272(%rsp) + testb %r15b, %r15b + je ..B1.17 +..B1.16: + fldcw 114(%rsp) +..B1.17: + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.48 +..B1.18: + fldt 256(%rsp) + fldt 272(%rsp) + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.47 +..B1.19: + addq $296, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.20: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + lea 176(%rsp), %rdi + fstpt (%rsp) +..___tag_value_csinhl.31: + call __libm_coshl_k80@PLT +..___tag_value_csinhl.32: +..B1.61: + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.21: + fldt 176(%rsp) + lea 48+_CONSTANTS(%rip), %r14 + fldt .L_2il0floatpacket.7(%rip) + movzwl 344(%rsp), %eax + andl $32767, %eax + fldt (%r14) + cmpl $16183, %eax + fadd %st, %st(3) + fxch %st(3) + fstpt (%rsp) + fldt 160(%rsp) + fld %st(0) + movl (%rsp), %r14d + fadd %st(3), %st + fmul %st, %st(2) + fld %st(0) + fsubr %st(3), %st + fsubrp %st, %st(3) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(1) + fsubr %st(2), %st + fsubrp %st, %st(3) + fsubrp %st, %st(1) + faddp %st, %st(1) + jge ..B1.23 +..B1.22: + fstp %st(1) + fldt 336(%rsp) + lea 32+_CONSTANTS(%rip), %r13 + fldt 96(%rsp) + lea 208(%rsp), %rdx + fstpt (%rdx) + fldt (%r13) + fmulp %st, %st(1) + fstpt -16(%rdx) + movzwl -8(%rdx), %eax + movl %eax, %r13d + andl $-32768, %eax + andl $32767, %r13d + orl $-49153, %eax + addl $-16639, %r13d + movw %ax, -8(%rdx) + jmp ..B1.25 +..B1.23: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + lea 208(%rsp), %rdi + fstpt (%rsp) + fxch %st(1) + fstpt 16(%rsp) + fstpt 64(%rsp) +..___tag_value_csinhl.35: + call __libm_sinhl_k80@PLT +..___tag_value_csinhl.36: +..B1.62: + fldt 64(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.24: + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + lea 208(%rsp), %rdx + movl (%rsp), %r13d +..B1.25: + fldt 192(%rsp) + fld %st(0) + fldt (%rdx) + fadd %st, %st(1) + fld %st(1) + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.7(%rip) + fmul %st(3), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 368(%rsp) + fstpt (%rsp) + lea 240(%rsp), %rdi + fstpt 96(%rsp) + fstpt 64(%rsp) +..___tag_value_csinhl.39: + call __libm_cosl_k80@PLT +..___tag_value_csinhl.40: +..B1.63: + fldt 64(%rsp) + fldt 96(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.26: + fldt 224(%rsp) + lea 16+_CONSTANTS(%rip), %rax + fld %st(0) + fldt 240(%rsp) + movzwl 360(%rsp), %edx + fadd %st, %st(1) + fld %st(1) + andl $32767, %edx + cmpl $16183, %edx + fxch %st(2) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(1) + fldt .L_2il0floatpacket.7(%rip) + fmul %st(3), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmul %st(4), %st + fxch %st(1) + fmulp %st, %st(4) + fldt (%rax) + faddp %st, %st(1) + jge ..B1.28 +..B1.27: + fldt 352(%rsp) + lea 32+_CONSTANTS(%rip), %rbx + fldt 96(%rsp) + fstpt 144(%rsp) + fldt (%rbx) + fmulp %st, %st(1) + fstpt 128(%rsp) + movzwl 136(%rsp), %eax + movl %eax, %ebx + andl $-32768, %eax + andl $32767, %ebx + orl $-49153, %eax + addl $-16639, %ebx + movw %ax, 136(%rsp) + fldt 128(%rsp) + jmp ..B1.30 +..B1.28: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 368(%rsp) + lea 144(%rsp), %rdi + fstpt (%rsp) + fxch %st(3) + fstpt 16(%rsp) + fstpt -48(%rdi) + fxch %st(1) + fstpt -112(%rdi) + fstpt -80(%rdi) +..___tag_value_csinhl.43: + call __libm_sinl_k80@PLT +..___tag_value_csinhl.44: +..B1.64: + fldt 64(%rsp) + fldt 32(%rsp) + fldt 96(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B1.29: + fldt 128(%rsp) + xorl %ebx, %ebx + fmul %st(5), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fldt 144(%rsp) + fmulp %st, %st(6) + fxch %st(5) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 144(%rsp) + fxch %st(4) + fxch %st(2) + fxch %st(1) + fxch %st(2) +..B1.30: + fldt 96(%rsp) + fld %st(1) + movl %r13d, %edi + fadd %st(1), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.7(%rip) + fmul %st(3), %st + fsub %st, %st(1) + fsubp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(5), %st + fldt 64(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + fld %st(0) + fmul %st(4), %st + fstpt (%rsp) + fmulp %st, %st(6) + faddp %st, %st(5) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 16(%rsp) + fxch %st(1) + fstpt 48(%rsp) + fstpt 80(%rsp) +..___tag_value_csinhl.47: + call __libm_scalbl_k80@PLT +..___tag_value_csinhl.48: +..B1.65: + fldt 80(%rsp) + fldt 48(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B1.31: + fldt (%rsp) + fld %st(2) + fmul %st(2), %st + addl %ebx, %r14d + fxch %st(4) + fstpt 256(%rsp) + movl %r14d, %edi + fldt 32(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + fld %st(0) + fmul %st(2), %st + fstpt (%rsp) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_csinhl.51: + call __libm_scalbl_k80@PLT +..___tag_value_csinhl.52: +..B1.66: + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B1.32: + fstpt 272(%rsp) + jmp ..B1.42 +..B1.33: + cmpq $0, 352(%rsp) + jne ..B1.35 +..B1.34: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + fstpt (%rsp) + call sinhl@PLT +..B1.67: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + fstpt 272(%rsp) + fstpt 256(%rsp) + jmp ..B1.42 +..B1.35: + movzwl 360(%rsp), %ebx + andl $32767, %ebx + cmpl $32767, %ebx + jge ..B1.38 +..B1.36: + fldt 336(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstpt (%rsp) + call sinhl@PLT +..B1.69: + fstpt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt 352(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstpt (%rsp) + call cosl@PLT +..B1.68: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt (%rsp) + testl %ebx, %ebx + fmulp %st, %st(1) + fstpt 256(%rsp) + jle ..B1.53 +..B1.37: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 48(%rsp) + fstpt (%rsp) + call coshl@PLT +..B1.71: + fstpt 16(%rsp) + fldt 32(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.70: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt (%rsp) + fmulp %st, %st(1) + fstpt 272(%rsp) + jmp ..B1.42 +..B1.38: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 368(%rsp) + fstpt (%rsp) + call sinl@PLT +..B1.72: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fstpt 272(%rsp) + fldt 272(%rsp) + cmpl $32767, %r13d + je ..B1.40 +..B1.39: + cmpq $0, 336(%rsp) + jne ..B1.41 +..B1.40: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 352(%rsp) + fstpt (%rsp) + call sinhl@PLT +..B1.73: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fstpt 256(%rsp) + jmp ..B1.42 +..B1.41: + fldt 336(%rsp) + fmulp %st, %st(1) + fstpt 256(%rsp) +..B1.42: + testb %r15b, %r15b + je ..B1.44 +..B1.43: + fldcw 114(%rsp) +..B1.44: + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.48 +..B1.45: + fldt 256(%rsp) + fldt 272(%rsp) + movq 288(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.47 +..B1.46: + addq $296, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.47: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.48: + call __stack_chk_fail@PLT +..B1.49: + cmpl $0, 356(%rsp) + jne ..B1.11 +..B1.50: + cmpl $0, 352(%rsp) + jne ..B1.11 + jmp ..B1.33 +..B1.51: + cmpl $0, 340(%rsp) + jne ..B1.9 +..B1.52: + cmpl $0, 336(%rsp) + jne ..B1.9 + jmp ..B1.33 +..B1.53: + cmpq $0, 336(%rsp) + je ..B1.37 +..B1.54: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fldt 48(%rsp) + fstpt (%rsp) + call coshl@PLT +..B1.74: + addq $16, %rsp + .cfi_def_cfa_offset 336 + fldt 16(%rsp) + fmulp %st, %st(1) + fstpt 272(%rsp) + jmp ..B1.42 + .align 16,0x90 + .cfi_endproc + .type csinhl,@function + .size csinhl,.-csinhl + .data +# -- End csinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,64 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csinl.S b/external/sgx_libm/intel64/csinl.S new file mode 100644 index 0000000000..0df60bdf60 --- /dev/null +++ b/external/sgx_libm/intel64/csinl.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csinl.c" + .text +..TXTST0: +# -- Begin csinl + .text + .align 16,0x90 + .globl csinl +csinl: +# parameter 1: 144 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_csinl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + subq $128, %rsp + .cfi_def_cfa_offset 144 + xorb %r13b, %r13b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 112(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 96(%rsp) +..B1.2: + fnstcw 2(%rsp) +..B1.3: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.5: + fldcw (%rsp) +..B1.6: + movb $1, %r13b +..B1.7: + fldt 160(%rsp) + movzwl 168(%rsp), %eax + andl $32767, %eax + fstpt 80(%rsp) + cmpl $32767, %eax + fldt 144(%rsp) + fstpt 96(%rsp) + jl ..B1.9 +..B1.8: + movq $0x8000000000000000, %rax + cmpq 160(%rsp), %rax + jne ..B1.10 +..B1.9: + movb 169(%rsp), %al + notb %al + movb 89(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 89(%rsp) +..B1.10: + addq $-32, %rsp + .cfi_def_cfa_offset 176 + movq %rsp, %rdi + movq 112(%rsp), %rax + movq 120(%rsp), %rdx + movq 128(%rsp), %rcx + movq 136(%rsp), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %rsi, 24(%rdi) + call csinhl@PLT +..B1.22: + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 144 + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 24(%rsp), %eax + andl $32767, %eax + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + cmpl $32767, %eax + fstpt 48(%rsp) + fstpt 64(%rsp) + jl ..B1.12 +..B1.11: + movq $0x8000000000000000, %rax + cmpq 16(%rsp), %rax + jne ..B1.13 +..B1.12: + movb 25(%rsp), %al + notb %al + movb 73(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 73(%rsp) +..B1.13: + testb %r13b, %r13b + je ..B1.15 +..B1.14: + fldcw 2(%rsp) +..B1.15: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.19 +..B1.16: + fldt 48(%rsp) + fldt 64(%rsp) + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.18 +..B1.17: + addq $128, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 +..B1.18: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.19: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type csinl,@function + .size csinl,.-csinl + .data +# -- End csinl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csqrt.S b/external/sgx_libm/intel64/csqrt.S new file mode 100644 index 0000000000..f1a247a36f --- /dev/null +++ b/external/sgx_libm/intel64/csqrt.S @@ -0,0 +1,696 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csqrt.c" + .text +..TXTST0: +# -- Begin csqrt + .text + .align 16,0x90 + .globl csqrt +csqrt: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_csqrt.1: +..L2: + +..B1.2: + movq %rsp, %rax + subq $152, %rsp + .cfi_def_cfa_offset 160 + movq %rax, 56(%rsp) + movq %xmm0, 32(%rsp) + movq %xmm1, 40(%rsp) + movq %rbx, 64(%rsp) + movq 32(%rsp), %xmm0 + movq 40(%rsp), %xmm1 + lea csqrt_table(%rip), %r8 + movq (%r8), %xmm2 + movq (%r8), %xmm3 + movq 144(%r8), %xmm7 + pand %xmm0, %xmm2 + pand %xmm1, %xmm3 + pand 16(%r8), %xmm0 + pand 16(%r8), %xmm1 + movq %xmm2, %xmm4 + movq %xmm3, %xmm5 + movl 36(%rsp), %eax + movl 44(%rsp), %ebx + andl $2147483647, %eax + andl $2147483647, %ebx + subl $591396864, %eax + movq %xmm0, 8(%rsp) + subl $591396864, %ebx + cmpl $1017118720, %eax + movq %xmm1, 16(%rsp) + jae .L_2TAG_PACKET_0.0.1 + cmpl $1017118720, %ebx + jae .L_2TAG_PACKET_0.0.1 + addl $591396864, %eax + addl $591396864, %ebx + movl %eax, %edx + subl %ebx, %edx + cmpl $60817408, %edx + jg .L_2TAG_PACKET_1.0.1 + cmpl $-60817408, %edx + jl .L_2TAG_PACKET_2.0.1 +.L_2TAG_PACKET_3.0.1: + subsd %xmm2, %xmm0 + subsd %xmm3, %xmm1 + mulsd %xmm2, %xmm2 + mulsd %xmm3, %xmm3 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm5 + movq %xmm2, %xmm6 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + movq %xmm7, 24(%rsp) + movq %xmm2, %xmm7 + addsd %xmm3, %xmm2 + addsd %xmm4, %xmm0 + subsd %xmm2, %xmm7 + addsd %xmm5, %xmm1 + movq %xmm2, (%rsp) + addsd %xmm7, %xmm2 + addsd %xmm7, %xmm3 + movq (%rsp), %xmm7 + addsd %xmm4, %xmm0 + subsd %xmm2, %xmm6 + addsd %xmm5, %xmm1 + movq (%rsp), %xmm5 + movq %xmm0, %xmm2 + movq %xmm0, %xmm4 + addsd %xmm3, %xmm6 + addsd %xmm1, %xmm0 + subsd %xmm0, %xmm2 + movq %xmm0, %xmm3 + addsd %xmm2, %xmm0 + addsd %xmm2, %xmm1 + pshufd $221, %xmm7, %xmm2 + subsd %xmm0, %xmm4 + movq 32(%r8), %xmm0 + addsd %xmm4, %xmm1 + pand %xmm7, %xmm0 + addsd %xmm3, %xmm7 + addsd %xmm6, %xmm1 + subsd %xmm7, %xmm5 + subsd %xmm0, %xmm7 + movq %xmm0, %xmm4 + addsd %xmm5, %xmm3 + movq %xmm0, %xmm5 + addsd %xmm7, %xmm1 + movq %xmm0, %xmm7 + psrlq $29, %xmm0 + addsd %xmm3, %xmm1 + pand 48(%r8), %xmm0 + movq 152(%r8), %xmm3 + pxor 64(%r8), %xmm0 + addsd %xmm1, %xmm4 + paddd 80(%r8), %xmm0 + psubd 96(%r8), %xmm2 + rsqrtss %xmm0, %xmm0 + pand 112(%r8), %xmm2 + psrld $3, %xmm0 + psrld $1, %xmm2 + paddd 128(%r8), %xmm0 + psubd %xmm2, %xmm0 + psllq $32, %xmm0 + movq %xmm0, %xmm2 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm7 + mulsd %xmm1, %xmm0 + subsd 144(%r8), %xmm7 + addsd %xmm0, %xmm7 + movq 160(%r8), %xmm0 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm0 + addsd 168(%r8), %xmm3 + addsd 176(%r8), %xmm0 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm0 + addsd 184(%r8), %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm0, %xmm3 + movq 8(%rsp), %xmm0 + mulsd %xmm2, %xmm3 + mulsd %xmm4, %xmm3 + movq 8(%rsp), %xmm4 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + movq %xmm5, %xmm2 + addsd 8(%rsp), %xmm5 + movq 32(%r8), %xmm7 + addsd %xmm3, %xmm1 + subsd %xmm5, %xmm4 + movq %xmm5, %xmm3 + addsd %xmm4, %xmm5 + addsd %xmm2, %xmm4 + subsd %xmm5, %xmm0 + addsd %xmm0, %xmm4 + movq 208(%r8), %xmm0 + addsd %xmm1, %xmm4 + movq %xmm3, %xmm1 + movq %xmm3, %xmm2 + addsd %xmm4, %xmm3 + subsd %xmm3, %xmm1 + mulsd %xmm3, %xmm0 + pand %xmm0, %xmm7 + addsd %xmm1, %xmm3 + addsd %xmm4, %xmm1 + movq %xmm7, %xmm4 + subsd %xmm2, %xmm3 + movq %xmm7, %xmm5 + pshufd $221, %xmm0, %xmm2 + subsd %xmm7, %xmm0 + subsd %xmm3, %xmm1 + mulsd 208(%r8), %xmm1 + addsd %xmm0, %xmm1 + movq %xmm7, %xmm0 + psrlq $29, %xmm7 + movq 152(%r8), %xmm3 + pand 48(%r8), %xmm7 + psubd 96(%r8), %xmm2 + pxor 64(%r8), %xmm7 + addsd %xmm1, %xmm4 + paddd 80(%r8), %xmm7 + rsqrtss %xmm7, %xmm7 + psrld $3, %xmm7 + pand 112(%r8), %xmm2 + psrld $1, %xmm2 + paddd 128(%r8), %xmm7 + psubd %xmm2, %xmm7 + psllq $32, %xmm7 + movq %xmm7, %xmm2 + mulsd %xmm7, %xmm7 + mulsd %xmm7, %xmm0 + mulsd %xmm1, %xmm7 + subsd 144(%r8), %xmm0 + addsd %xmm7, %xmm0 + movq 160(%r8), %xmm7 + movq %xmm0, %xmm6 + mulsd %xmm0, %xmm0 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm7 + addsd 168(%r8), %xmm3 + addsd 176(%r8), %xmm7 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm7 + addsd 184(%r8), %xmm3 + mulsd %xmm6, %xmm3 + movq 16(%rsp), %xmm6 + addsd %xmm7, %xmm3 + mulsd 208(%r8), %xmm6 + mulsd %xmm2, %xmm3 + mulsd %xmm3, %xmm4 + pxor %xmm7, %xmm7 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + cmpnlesd 32(%rsp), %xmm7 + addsd %xmm4, %xmm1 + movq 32(%r8), %xmm4 + pand %xmm6, %xmm4 + subsd %xmm4, %xmm6 + addsd %xmm5, %xmm1 + movq %xmm2, %xmm5 + mulsd %xmm4, %xmm2 + mulsd %xmm3, %xmm4 + movq %xmm1, %xmm0 + pand %xmm7, %xmm0 + mulsd %xmm6, %xmm3 + mulsd %xmm5, %xmm6 + movq 40(%rsp), %xmm5 + addsd %xmm4, %xmm3 + addsd %xmm3, %xmm6 + addsd %xmm6, %xmm2 + movq %xmm7, %xmm6 + pandn %xmm2, %xmm6 + pand %xmm7, %xmm2 + pandn %xmm1, %xmm7 + pand 192(%r8), %xmm5 + por %xmm0, %xmm6 + por %xmm7, %xmm2 + por %xmm5, %xmm6 + movq 24(%rsp), %xmm0 + movq 24(%rsp), %xmm1 + mulsd %xmm2, %xmm0 + mulsd %xmm6, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_0.0.1: + addl $591396864, %eax + addl $591396864, %ebx + cmpl $2146435072, %eax + jge .L_2TAG_PACKET_4.0.1 + cmpl $2146435072, %ebx + jge .L_2TAG_PACKET_5.0.1 + movl 32(%rsp), %edx + orl %eax, %edx + movl 40(%rsp), %edx + je .L_2TAG_PACKET_6.0.1 + orl %ebx, %edx + je .L_2TAG_PACKET_7.0.1 + movl %eax, %edx + subl %ebx, %edx + cmpl $60817408, %edx + jg .L_2TAG_PACKET_1.0.1 + cmpl $-60817408, %edx + jl .L_2TAG_PACKET_2.0.1 + cmpl $1072693248, %eax + jl .L_2TAG_PACKET_8.0.1 + mulsd 216(%r8), %xmm0 + mulsd 216(%r8), %xmm1 + movq 224(%r8), %xmm7 + movq 32(%r8), %xmm2 + movq 32(%r8), %xmm3 + pand %xmm0, %xmm2 + pand %xmm1, %xmm3 + movq %xmm2, %xmm4 + movq %xmm3, %xmm5 + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + jmp .L_2TAG_PACKET_3.0.1 +.L_2TAG_PACKET_8.0.1: + mulsd 232(%r8), %xmm0 + mulsd 232(%r8), %xmm1 + movq 240(%r8), %xmm7 + movq 32(%r8), %xmm2 + movq 32(%r8), %xmm3 + pand %xmm0, %xmm2 + pand %xmm1, %xmm3 + movq %xmm2, %xmm4 + movq %xmm3, %xmm5 + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + jmp .L_2TAG_PACKET_3.0.1 +.L_2TAG_PACKET_2.0.1: +.L_2TAG_PACKET_6.0.1: + cmpl $2097152, %ebx + jl .L_2TAG_PACKET_9.0.1 + mulsd 208(%r8), %xmm1 + sqrtsd %xmm1, %xmm0 + movsd 40(%rsp), %xmm1 + pand 192(%r8), %xmm1 + por %xmm0, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_9.0.1: + mulsd 248(%r8), %xmm1 + sqrtsd %xmm1, %xmm0 + movsd 40(%rsp), %xmm1 + pand 192(%r8), %xmm1 + mulsd 256(%r8), %xmm0 + por %xmm0, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_7.0.1: + sqrtsd %xmm0, %xmm0 + movl 36(%rsp), %eax + cmpl $0, %eax + jl .L_2TAG_PACKET_10.0.1 + movsd 40(%rsp), %xmm1 + pand 192(%r8), %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_10.0.1: + movsd 40(%rsp), %xmm1 + pand 192(%r8), %xmm1 + por %xmm0, %xmm1 + pxor %xmm0, %xmm0 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_1.0.1: + cmpl $57671680, %ebx + movsd %xmm0, %xmm4 + subsd %xmm2, %xmm0 + movq %xmm2, %xmm5 + movq %xmm2, %xmm7 + pshufd $221, %xmm2, %xmm1 + jl .L_2TAG_PACKET_11.0.1 + mulsd 288(%r8), %xmm2 + mulsd 288(%r8), %xmm0 + mulsd 288(%r8), %xmm4 + movsd %xmm2, %xmm5 + movsd %xmm2, %xmm7 + pshufd $221, %xmm2, %xmm1 + shrl $21, %eax + shrl $20, %ebx + psrlq $29, %xmm2 + pand 48(%r8), %xmm2 + pxor 64(%r8), %xmm2 + paddd 80(%r8), %xmm2 + rsqrtss %xmm2, %xmm2 + subl $511, %eax + subl $1023, %ebx + psubd 96(%r8), %xmm1 + psrld $3, %xmm2 + pand 112(%r8), %xmm1 + psrld $1, %xmm1 + paddd 128(%r8), %xmm2 + psubd %xmm1, %xmm2 + subl %eax, %ebx + psllq $32, %xmm2 + movq %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + mulsd %xmm2, %xmm7 + mulsd %xmm0, %xmm2 + subsd 144(%r8), %xmm7 + cmpl $-1020, %ebx + addsd %xmm2, %xmm7 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + movq 152(%r8), %xmm3 + movq 160(%r8), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 168(%r8), %xmm3 + addsd 176(%r8), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 184(%r8), %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm2, %xmm3 + mulsd %xmm1, %xmm3 + mulsd %xmm3, %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm4, %xmm0 + mulsd 304(%r8), %xmm5 + mulsd 304(%r8), %xmm0 + mulsd 296(%r8), %xmm1 + mulsd 296(%r8), %xmm3 + jl .L_2TAG_PACKET_12.0.1 + movsd 16(%rsp), %xmm2 + addsd %xmm5, %xmm0 + mulsd 208(%r8), %xmm1 + mulsd 208(%r8), %xmm3 + movq 32(%r8), %xmm4 + pand %xmm2, %xmm4 + subsd %xmm4, %xmm2 + movq %xmm1, %xmm5 + mulsd %xmm4, %xmm1 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + mulsd %xmm5, %xmm2 + addsd %xmm4, %xmm3 + addsd %xmm3, %xmm2 + addsd %xmm2, %xmm1 +.L_2TAG_PACKET_13.0.1: + movsd 40(%rsp), %xmm3 + pand 192(%r8), %xmm3 + movl 36(%rsp), %eax + cmpl $0, %eax + jl .L_2TAG_PACKET_14.0.1 + por %xmm3, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_14.0.1: + por %xmm0, %xmm3 + movq %xmm1, %xmm0 + movq %xmm3, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_11.0.1: + psrlq $29, %xmm2 + pand 48(%r8), %xmm2 + pxor 64(%r8), %xmm2 + paddd 80(%r8), %xmm2 + rsqrtss %xmm2, %xmm2 + psubd 96(%r8), %xmm1 + psrld $3, %xmm2 + pand 112(%r8), %xmm1 + psrld $1, %xmm1 + paddd 128(%r8), %xmm2 + psubd %xmm1, %xmm2 + psllq $32, %xmm2 + movq %xmm2, %xmm1 + mulsd %xmm2, %xmm2 + mulsd %xmm2, %xmm7 + mulsd %xmm0, %xmm2 + subsd 144(%r8), %xmm7 + addsd %xmm2, %xmm7 + movq %xmm7, %xmm6 + mulsd %xmm7, %xmm7 + movq 152(%r8), %xmm3 + movq 160(%r8), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 168(%r8), %xmm3 + addsd 176(%r8), %xmm2 + mulsd %xmm7, %xmm3 + mulsd %xmm7, %xmm2 + addsd 184(%r8), %xmm3 + mulsd %xmm6, %xmm3 + addsd %xmm2, %xmm3 + mulsd %xmm1, %xmm3 + mulsd %xmm3, %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm4, %xmm0 +.L_2TAG_PACKET_12.0.1: + addsd %xmm5, %xmm0 + movq 16(%rsp), %xmm2 + mulsd 264(%r8), %xmm2 + mulsd 248(%r8), %xmm2 + movq 32(%r8), %xmm4 + pand %xmm2, %xmm4 + subsd %xmm4, %xmm2 + movq %xmm1, %xmm5 + mulsd %xmm4, %xmm1 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + mulsd %xmm5, %xmm2 + addsd %xmm4, %xmm3 + addsd %xmm3, %xmm2 + movq %xmm1, %xmm3 + addsd %xmm2, %xmm1 + pextrw $3, %xmm1, %eax + mulsd 272(%r8), %xmm1 + mulsd 280(%r8), %xmm1 + cmpl $19216, %eax + jge .L_2TAG_PACKET_13.0.1 + movq 272(%r8), %xmm5 + mulsd %xmm5, %xmm5 + cmpl $19056, %eax + jle .L_2TAG_PACKET_13.0.1 + movq 32(%r8), %xmm1 + pand %xmm3, %xmm1 + subsd %xmm1, %xmm3 + addsd %xmm3, %xmm2 + mulsd 272(%r8), %xmm1 + mulsd 272(%r8), %xmm2 + mulsd 280(%r8), %xmm1 + mulsd 280(%r8), %xmm2 + addsd %xmm2, %xmm1 + jmp .L_2TAG_PACKET_13.0.1 +.L_2TAG_PACKET_5.0.1: +.L_2TAG_PACKET_15.0.1: + movq 144(%r8), %xmm0 + addsd 40(%rsp), %xmm0 + movq %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_4.0.1: + movsd 32(%rsp), %xmm1 + mulsd %xmm1, %xmm1 + cmpl $2146435072, %ebx + jl .L_2TAG_PACKET_16.0.1 + movl 40(%rsp), %ebx + jg .L_2TAG_PACKET_17.0.1 + andl %ebx, %ebx + jne .L_2TAG_PACKET_17.0.1 + jmp .L_2TAG_PACKET_15.0.1 +.L_2TAG_PACKET_17.0.1: + movq 144(%r8), %xmm0 + addsd 40(%rsp), %xmm0 + cmpl $2146435072, %eax + movl 32(%rsp), %ebx + jg .L_2TAG_PACKET_18.0.1 + andl %ebx, %ebx + movl 36(%rsp), %ebx + jne .L_2TAG_PACKET_18.0.1 + cmpl $2146435072, %ebx + je .L_2TAG_PACKET_19.0.1 + mulsd %xmm1, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_18.0.1: +.L_2TAG_PACKET_19.0.1: + movq 32(%rsp), %xmm0 + movq 40(%rsp), %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_16.0.1: + cmpl $2146435072, %eax + movl 32(%rsp), %eax + jg .L_2TAG_PACKET_20.0.1 + andl %eax, %eax + jne .L_2TAG_PACKET_20.0.1 + pxor %xmm2, %xmm2 + movl 36(%rsp), %eax + movq 40(%rsp), %xmm3 + testl $-2147483648, %eax + pand 192(%r8), %xmm3 + jne .L_2TAG_PACKET_21.0.1 + por %xmm3, %xmm2 + movq %xmm1, %xmm0 + movq %xmm2, %xmm1 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_21.0.1: + por %xmm3, %xmm1 + movq %xmm2, %xmm0 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret +.L_2TAG_PACKET_20.0.1: + movq %xmm1, %xmm0 + movq 64(%rsp), %rbx + movq 56(%rsp), %rsp + ret + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type csqrt,@function + .size csqrt,.-csqrt + .data +# -- End csqrt + .section .rodata, "a" + .align 16 + .align 16 +csqrt_table: + .long 4160749568 + .long 2147483647 + .long 4160749568 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4160749568 + .long 4294967295 + .long 4160749568 + .long 4294967295 + .long 16777215 + .long 16777215 + .long 16777215 + .long 16777215 + .long 8388608 + .long 8388608 + .long 8388608 + .long 8388608 + .long 1065353216 + .long 1065353216 + .long 1065353216 + .long 1065353216 + .long 1048576 + .long 1048576 + .long 1048576 + .long 1048576 + .long 4292870144 + .long 4292870144 + .long 4292870144 + .long 4292870144 + .long 1475346432 + .long 1475346432 + .long 1475346432 + .long 1475346432 + .long 0 + .long 1072693248 + .long 0 + .long 3218046976 + .long 0 + .long 1070694400 + .long 0 + .long 3218341888 + .long 0 + .long 1071120384 + .long 0 + .long 3219128320 + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .long 0 + .long 1071644672 + .long 0 + .long 533725184 + .long 0 + .long 1342177280 + .long 0 + .long 1722810368 + .long 0 + .long 747634688 + .long 0 + .long 1281359872 + .long 0 + .long 967835648 + .long 0 + .long 2121269248 + .long 0 + .long 24117248 + .long 0 + .long 862978048 + .long 0 + .long 1062207488 + .long 0 + .long 1067450368 + .long 0 + .long 1077936128 + .type csqrt_table,@object + .size csqrt_table,312 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csqrtf.S b/external/sgx_libm/intel64/csqrtf.S new file mode 100644 index 0000000000..150d2044d7 --- /dev/null +++ b/external/sgx_libm/intel64/csqrtf.S @@ -0,0 +1,386 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csqrtf.c" + .text +..TXTST0: +# -- Begin csqrtf + .text + .align 16,0x90 + .globl csqrtf +csqrtf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_csqrtf.1: +..L2: + +..B1.2: + movq %rsp, %rax + subq $120, %rsp + .cfi_def_cfa_offset 128 + movq %rax, 24(%rsp) + movss %xmm0, (%rsp) + pshufd $1, %xmm0, %xmm1 + movss %xmm1, 8(%rsp) + movq %rbx, 32(%rsp) + movd (%rsp), %xmm0 + movd 8(%rsp), %xmm1 + movl (%rsp), %eax + movl 8(%rsp), %ecx + unpcklps %xmm1, %xmm0 + movl %ecx, %edx + lea csqrtf_table(%rip), %r8 + andl $2139095040, %eax + andl $2139095040, %ecx + subl $8388608, %eax + subl $8388608, %ecx + andl $2139095040, %eax + andl $2139095040, %ecx + subl $2130706432, %eax + subl $2130706432, %ecx + testl %ecx, %eax + jns .L_2TAG_PACKET_0.0.1 + cvtps2pd %xmm0, %xmm0 + pxor %xmm4, %xmm4 + movl $16, %eax + movapd %xmm0, %xmm1 + unpckhpd %xmm1, %xmm1 + movapd %xmm0, %xmm7 + mulsd %xmm0, %xmm0 + movapd %xmm7, %xmm6 + mulsd %xmm1, %xmm1 + pinsrw $3, %eax, %xmm4 + addsd %xmm1, %xmm0 + andpd (%r8), %xmm7 + sqrtsd %xmm0, %xmm0 + addsd %xmm7, %xmm0 + psubd %xmm4, %xmm0 + movsd %xmm0, %xmm7 + movdqa %xmm0, %xmm1 + pand 16(%r8), %xmm0 + movdqa %xmm1, %xmm2 + paddd 32(%r8), %xmm0 + psrld $1, %xmm1 + psrlq $29, %xmm0 + pand 48(%r8), %xmm1 + rsqrtss %xmm0, %xmm0 + psubd 64(%r8), %xmm1 + psllq $29, %xmm0 + movapd 80(%r8), %xmm3 + psubd %xmm1, %xmm0 + movapd 96(%r8), %xmm1 + mulsd %xmm0, %xmm2 + movapd 48(%r8), %xmm4 + mulsd %xmm0, %xmm2 + subsd %xmm4, %xmm2 + mulsd %xmm2, %xmm3 + addsd %xmm1, %xmm3 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm3 + addsd %xmm3, %xmm0 + mulpd 112(%r8), %xmm7 + unpcklpd %xmm0, %xmm0 +.L_2TAG_PACKET_1.0.1: + pextrw $3, %xmm6, %eax + mulpd %xmm7, %xmm0 + andl $-2147483648, %edx + cvtpd2ps %xmm0, %xmm1 + testl $32768, %eax + pshufd $17, %xmm1, %xmm2 + je .L_2TAG_PACKET_2.0.1 + movd %xmm1, %ecx + movd %xmm2, %eax + orl %ecx, %edx + testl $2139095040, %eax + jmp .L_2TAG_PACKET_3.0.1 +.L_2TAG_PACKET_2.0.1: + movd %xmm2, %ecx + movd %xmm1, %eax + orl %ecx, %edx + testl $2139095040, %ecx +.L_2TAG_PACKET_3.0.1: + je .L_2TAG_PACKET_4.0.1 + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_4.0.1: + testl $2147483647, 8(%rsp) + jne .L_2TAG_PACKET_5.0.1 + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_5.0.1: + pshufd $14, %xmm0, %xmm0 + mulsd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm0 + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_0.0.1: + movdqa %xmm0, %xmm2 + movdqa 128(%r8), %xmm4 + pshufd $80, %xmm0, %xmm0 + pxor %xmm5, %xmm5 + movdqa %xmm2, %xmm3 + pand 144(%r8), %xmm0 + pshufd $115, %xmm2, %xmm2 + pcmpeqd %xmm4, %xmm0 + movdqa %xmm2, %xmm6 + movmskps %xmm0, %eax + pand %xmm2, %xmm4 + testl %eax, %eax + jne .L_2TAG_PACKET_6.0.1 + pxor %xmm0, %xmm0 +.L_2TAG_PACKET_7.0.1: + pand (%r8), %xmm2 + pcmpeqd %xmm5, %xmm4 + movdqa %xmm4, %xmm3 + pand 160(%r8), %xmm4 + psrlq $3, %xmm2 + pand 176(%r8), %xmm3 + por %xmm4, %xmm2 + paddd 192(%r8), %xmm3 + subpd %xmm4, %xmm2 + paddd %xmm3, %xmm2 + pandn %xmm2, %xmm0 + pxor %xmm4, %xmm4 + movl $16, %eax + movapd %xmm0, %xmm1 + unpckhpd %xmm1, %xmm1 + movapd %xmm0, %xmm7 + mulsd %xmm0, %xmm0 + mulsd %xmm1, %xmm1 + pinsrw $3, %eax, %xmm4 + addsd %xmm1, %xmm0 + sqrtsd %xmm0, %xmm0 + addsd %xmm7, %xmm0 + psubd %xmm4, %xmm0 + movsd %xmm0, %xmm7 + sqrtsd %xmm0, %xmm1 + movapd 48(%r8), %xmm0 + divsd %xmm1, %xmm0 + mulpd 112(%r8), %xmm7 + unpcklpd %xmm0, %xmm0 + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_6.0.1: + cmpl $5, %eax + je .L_2TAG_PACKET_8.0.1 + testl $10, %eax + jne .L_2TAG_PACKET_9.0.1 + pshufd $160, %xmm0, %xmm0 + jmp .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_8.0.1: + xorl %eax, %eax + andl $-2147483648, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_9.0.1: + movl %edx, %ecx + andl $2147483647, %ecx + movd %xmm3, %eax + cmpl $2139095040, %ecx + je .L_2TAG_PACKET_10.0.1 + ja .L_2TAG_PACKET_11.0.1 + andl $-2147483648, %edx + cmpl $-8388608, %eax + je .L_2TAG_PACKET_12.0.1 + cmpl $2139095040, %eax + jne .L_2TAG_PACKET_13.0.1 + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_12.0.1: + xorl %eax, %eax + orl $2139095040, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_11.0.1: + cmpl $2139095040, %eax + je .L_2TAG_PACKET_14.0.1 + cmpl $-8388608, %eax + je .L_2TAG_PACKET_15.0.1 +.L_2TAG_PACKET_13.0.1: + mulss %xmm3, %xmm1 + movss (%rsp), %xmm0 + mulss 8(%rsp), %xmm0 + movd %xmm1, %eax + movl %eax, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_14.0.1: + movss 8(%rsp), %xmm0 + mulss %xmm0, %xmm0 + orl $4194304, %edx + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_15.0.1: + movss 8(%rsp), %xmm0 + mulss %xmm0, %xmm0 + movl %edx, %eax + movl $2139095040, %edx + orl $4194304, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret +.L_2TAG_PACKET_10.0.1: + movss (%rsp), %xmm0 + mulss 208(%r8), %xmm0 + movl $2139095040, %eax + shlq $32, %rdx + orq %rdx, %rax + shrq $32, %rdx + movd %rax, %xmm0 + movq 32(%rsp), %rbx + movq 24(%rsp), %rsp + ret + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type csqrtf,@function + .size csqrtf,.-csqrtf + .data +# -- End csqrtf + .section .rodata, "a" + .align 16 + .align 16 +csqrtf_table: + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2097151 + .long 4294967295 + .long 2097151 + .long 0 + .long 132120576 + .long 0 + .long 132120576 + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .long 0 + .long 1475346432 + .long 0 + .long 1475346432 + .long 2148429837 + .long 1071120401 + .long 2148429837 + .long 1071120401 + .long 195330 + .long 3219128325 + .long 195330 + .long 3219128325 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 0 + .long 2139095040 + .long 0 + .long 2139095040 + .long 2147483647 + .long 2139095040 + .long 2147483647 + .long 2139095040 + .long 0 + .long 133169152 + .long 0 + .long 133169152 + .long 0 + .long 4162846720 + .long 0 + .long 4162846720 + .long 0 + .long 939524096 + .long 0 + .long 939524096 + .long 1065353216 + .long 1065353216 + .long 1065353216 + .long 1065353216 + .type csqrtf_table,@object + .size csqrtf_table,224 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/csqrtl.S b/external/sgx_libm/intel64/csqrtl.S new file mode 100644 index 0000000000..1f9e0675d8 --- /dev/null +++ b/external/sgx_libm/intel64/csqrtl.S @@ -0,0 +1,714 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "csqrtl.c" + .text +..TXTST0: +# -- Begin csqrtl + .text + .align 16,0x90 + .globl csqrtl +csqrtl: +# parameter 1: 288 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_csqrtl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + subq $256, %rsp + .cfi_def_cfa_offset 288 + xorb %r12b, %r12b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 240(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 208(%rsp) + fldt 208(%rsp) + fstpt 224(%rsp) +..B1.2: + fnstcw 66(%rsp) +..B1.3: + movzwl 66(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 64(%rsp) +..B1.5: + fldcw 64(%rsp) +..B1.6: + movb $1, %r12b +..B1.7: + movzwl 296(%rsp), %eax + movl %eax, %ebp + andl $32767, %ebp + cmpl $32767, %ebp + jge ..B1.30 +..B1.8: + cmpl $0, 292(%rsp) + jne ..B1.10 +..B1.9: + cmpl $0, 288(%rsp) + je ..B1.30 +..B1.10: + movzwl 312(%rsp), %edx + movl %edx, %ebx + andl $32767, %ebx + cmpl $32767, %ebx + jge ..B1.46 +..B1.11: + cmpl $0, 308(%rsp) + jne ..B1.13 +..B1.12: + cmpl $0, 304(%rsp) + je ..B1.32 +..B1.13: + fldt 288(%rsp) + testl %ebp, %ebp + jle ..B1.55 +..B1.14: + andl $-32768, %eax + addl $-16383, %ebp + fstpt 176(%rsp) + fldt 176(%rsp) + orl $-49153, %eax + movw %ax, 184(%rsp) +..B1.15: + fldt 304(%rsp) + testl %ebx, %ebx + movb $63, 185(%rsp) + jle ..B1.54 +..B1.16: + andl $-32768, %edx + addl $-16383, %ebx + fstpt 80(%rsp) + fldt 80(%rsp) + orl $-49153, %edx + movw %dx, 88(%rsp) +..B1.17: + fldt 48(%rsp) + movb $63, 89(%rsp) + fstpt 96(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 320 + lea 144(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_csqrtl.11: + call __libm_hypot2l_k80@PLT +..___tag_value_csqrtl.12: +..B1.69: + addq $32, %rsp + .cfi_def_cfa_offset 288 +..B1.18: + fldt 128(%rsp) + lea 32+_CONSTANTS(%rip), %rax + lea t32(%rip), %rdx + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fldt 112(%rsp) + fld %st(0) + fsqrt + fldt (%rdx) + fstpt (%rsp) + fldt (%rsp) + fmul %st(1), %st + fld %st(0) + movl 16(%rsp), %esi + fsubr %st(2), %st + sarl $1, %esi + faddp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fld %st(2) + fxch %st(2) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt .L_2il0floatpacket.9(%rip) + fmulp %st, %st(2) + fdivr %st, %st(1) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 144(%rsp) + fldt 144(%rsp) + fsubr %st, %st(1) + movzwl 152(%rsp), %eax + fxch %st(1) + faddp %st, %st(2) + andl $32767, %eax + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + lea -16464(%rax,%rsi), %ecx + cmpl %ecx, %ebp + jle ..B1.22 +..B1.19: + lea -16302(%rax,%rsi), %eax + cmpl %eax, %ebp + jge ..B1.21 +..B1.20: + subl %esi, %ebp + fld %st(1) + addl $16383, %ebp + fld %st(2) + movzwl 184(%rsp), %eax + andl $32767, %ebp + andl $-32768, %eax + orl %ebp, %eax + movl %esi, %ebp + movw %ax, 184(%rsp) + fldt 176(%rsp) + fadd %st, %st(2) + fld %st(2) + fxch %st(2) + fsubr %st(3), %st + fsubr %st, %st(2) + fxch %st(2) + fsubrp %st, %st(5) + fsubp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%rsp) + jmp ..B1.23 +..B1.21: + fstp %st(0) + fstp %st(0) + fldt 176(%rsp) + jmp ..B1.23 +..B1.22: + fstpt 48(%rsp) + movl %esi, %ebp +..B1.23: + fldt 48(%rsp) + lea 1(%rbp), %eax + fldt (%rsp) + andl $1, %eax + subl %eax, %ebp + lea onetwo(%rip), %rdx + shlq $4, %rax + decl %ebp + sarl $1, %ebp + movl %ebp, %edi + fldt (%rax,%rdx) + fmul %st, %st(3) + fld %st(3) + fsqrt + fmul %st, %st(2) + fld %st(2) + fsubr %st(1), %st + faddp %st, %st(3) + fld %st(2) + fsubr %st(1), %st + fxch %st(2) + fmulp %st, %st(4) + fld %st(2) + fmul %st(3), %st + fld %st(1) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(4) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(3) + fsubrp %st, %st(5) + fxch %st(2) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldt .L_2il0floatpacket.9(%rip) + fmulp %st, %st(3) + fdivr %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 320 + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fstpt (%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 64(%rsp) +..___tag_value_csqrtl.15: + call __libm_scalbl_k80@PLT +..___tag_value_csqrtl.16: +..B1.70: + fldt 64(%rsp) + fxch %st(1) + fstpt 80(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 288 +..B1.24: + fldt 80(%rsp) + subl %ebp, %ebx + fldt 16(%rsp) + movl %ebx, %edi + fld %st(0) + fdivr %st(2), %st + fmul %st, %st(3) + fld %st(1) + fldt (%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + fsubr %st(4), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(4), %st + fxch %st(2) + fmul %st(5), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fld %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + fsubrp %st, %st(3) + fldt 96(%rsp) + faddp %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fldt 16(%rsp) + fdivrp %st, %st(2) + addq $-32, %rsp + .cfi_def_cfa_offset 320 + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.9(%rip) + fmul %st, %st(2) + fxch %st(2) + fstpt (%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_csqrtl.19: + call __libm_scalbl_k80@PLT +..___tag_value_csqrtl.20: +..B1.71: + addq $32, %rsp + .cfi_def_cfa_offset 288 +..B1.25: + testb $-128, 297(%rsp) + jne ..B1.27 +..B1.26: + fldt 48(%rsp) + lea 224(%rsp), %rbx + fstpt -16(%rbx) + jmp ..B1.28 +..B1.27: + fldt 48(%rsp) + lea 224(%rsp), %rbx + fxch %st(1) + fstpt -16(%rbx) +..B1.28: + movb 313(%rsp), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fmulp %st, %st(1) + fstpt (%rbx) + jmp ..B1.49 +..B1.30: + movzwl 312(%rsp), %ebx + andl $32767, %ebx +..B1.31: + cmpl $32767, %ebx + jge ..B1.46 +..B1.32: + movq 288(%rsp), %rax + testq %rax, %rax + jne ..B1.39 +..B1.33: + cmpl $0, 308(%rsp) + jne ..B1.35 +..B1.34: + cmpl $0, 304(%rsp) + je ..B1.39 +..B1.35: + fldt 304(%rsp) + lea ones(%rip), %rdx + movb 313(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + cmpl $2, %ebx + fldl (%rdx,%rcx,8) + jl ..B1.37 +..B1.36: + lea halfs(%rip), %rax + fldl (%rax,%rcx,8) + fmulp %st, %st(2) + fxch %st(1) + fsqrt + jmp ..B1.38 +..B1.37: + lea _CONSTANTS(%rip), %rax + lea 64+_CONSTANTS(%rip), %rdx + fldt (%rax) + fmulp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fsqrt + fldt (%rdx) + fmulp %st, %st(1) +..B1.38: + fstpt 208(%rsp) + fldt 208(%rsp) + fmulp %st, %st(1) + fstpt 224(%rsp) + jmp ..B1.49 +..B1.39: + cmpl $32767, %ebp + jge ..B1.44 +..B1.40: + fldt 288(%rsp) + lea ones(%rip), %rcx + movb 297(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + fmull (%rcx,%rdx,8) + fstpt 176(%rsp) + fldt 176(%rsp) + fsqrt + jne ..B1.42 +..B1.41: + fstpt 208(%rsp) + lea 224(%rsp), %rbx + jmp ..B1.43 +..B1.42: + fldt 48(%rsp) + lea 224(%rsp), %rbx + fstpt -16(%rbx) + fstpt 48(%rsp) +..B1.43: + fldt 48(%rsp) + movb 313(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + fmull (%rcx,%rdx,8) + fstpt (%rbx) + jmp ..B1.49 +..B1.44: + movq $0x8000000000000000, %rdx + cmpq %rdx, %rax + je ..B1.40 +..B1.45: + fldt 288(%rsp) + fmul %st(0), %st + fstpt 208(%rsp) + fldt 208(%rsp) + fstpt 224(%rsp) + jmp ..B1.49 +..B1.46: + je ..B1.62 +..B1.47: + cmpl $32767, %ebp + je ..B1.58 +..B1.48: + fldt 288(%rsp) + fld %st(0) + fldt 304(%rsp) + fmul %st, %st(1) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt 208(%rsp) + fmulp %st, %st(1) + fstpt 224(%rsp) +..B1.49: + testb %r12b, %r12b + je ..B1.51 +..B1.50: + fldcw 66(%rsp) +..B1.51: + movq 240(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.57 +..B1.52: + fldt 208(%rsp) + fldt 224(%rsp) + movq 240(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.56 +..B1.53: + addq $256, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 288 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.54: + lea 16+_CONSTANTS(%rip), %rbx + fldt (%rbx) + fmul %st(1), %st + fstpt 80(%rsp) + movzwl 88(%rsp), %eax + movl %eax, %ebx + andl $-32768, %eax + andl $32767, %ebx + orl $-49153, %eax + addl $-16639, %ebx + movw %ax, 88(%rsp) + jmp ..B1.17 +..B1.55: + lea 16+_CONSTANTS(%rip), %rbp + fldt (%rbp) + fmul %st(1), %st + fstpt 176(%rsp) + movzwl 184(%rsp), %eax + movl %eax, %ebp + andl $-32768, %eax + andl $32767, %ebp + orl $-49153, %eax + addl $-16639, %ebp + movw %ax, 184(%rsp) + jmp ..B1.15 +..B1.56: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.57: + call __stack_chk_fail@PLT +..B1.58: + movq $0x8000000000000000, %rax + cmpq 288(%rsp), %rax + jne ..B1.48 +..B1.59: + fldt 288(%rsp) + fmul %st(0), %st + fldt 304(%rsp) + fmul %st(0), %st + testb $-128, 297(%rsp) + jne ..B1.61 +..B1.60: + fxch %st(1) + fstpt 208(%rsp) + fstpt 224(%rsp) + jmp ..B1.49 +..B1.61: + fstpt 208(%rsp) + fstpt 224(%rsp) + jmp ..B1.49 +..B1.62: + movq $0x8000000000000000, %rax + cmpq 304(%rsp), %rax + jne ..B1.47 +..B1.63: + fldt 304(%rsp) + lea ones(%rip), %rdx + movb 313(%rsp), %al + andb $-128, %al + shrb $7, %al + fmul %st(0), %st + fstpt 208(%rsp) + fldt 208(%rsp) + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fmulp %st, %st(1) + fstpt 224(%rsp) + jmp ..B1.49 + .align 16,0x90 + .cfi_endproc + .type csqrtl,@function + .size csqrtl,.-csqrtl + .data +# -- End csqrtl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 16 +t32: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t32,@object + .size t32,32 + .align 16 +onetwo: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type onetwo,@object + .size onetwo,32 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +halfs: + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbfe00000 + .type halfs,@object + .size halfs,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16127 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,80 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ctan.S b/external/sgx_libm/intel64/ctan.S new file mode 100644 index 0000000000..aa3748e947 --- /dev/null +++ b/external/sgx_libm/intel64/ctan.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctan.c" + .text +..TXTST0: +# -- Begin ctan + .text + .align 16,0x90 + .globl ctan +ctan: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ctan.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movsd %xmm1, 24(%rsp) + movzwl 30(%rsp), %eax + andl $32752, %eax + movsd %xmm0, 16(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.5 +..B1.3: + testl $1048575, 28(%rsp) + jne ..B1.7 +..B1.4: + cmpl $0, 24(%rsp) + jne ..B1.7 +..B1.5: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.6: + movb 31(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm1 + movhpd 8(%rsp), %xmm1 +..B1.7: + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + call ctanh@PLT +..B1.16: + movsd %xmm0, 16(%rsp) + movzwl 22(%rsp), %eax + andl $32752, %eax + movsd %xmm1, 24(%rsp) + cmpl $32752, %eax + unpcklpd %xmm0, %xmm1 + jl ..B1.11 +..B1.9: + testl $1048575, 20(%rsp) + jne ..B1.13 +..B1.10: + cmpl $0, 16(%rsp) + jne ..B1.13 +..B1.11: + movsd %xmm1, (%rsp) + movhpd %xmm1, 8(%rsp) +..B1.12: + movb 23(%rsp), %al + notb %al + movb 15(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movsd (%rsp), %xmm1 + movb %dl, 15(%rsp) + movhpd 8(%rsp), %xmm1 +..B1.13: + movaps %xmm1, %xmm2 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm2 + movaps %xmm2, %xmm1 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ctan,@function + .size ctan,.-ctan + .data +# -- End ctan + .text +# -- Begin ctanf + .text + .align 16,0x90 + .globl ctanf +ctanf: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_ctanf.6: +..L7: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) + movzwl 14(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.4 +..B2.3: + testl $8388607, 12(%rsp) + jne ..B2.6 +..B2.4: + movsd %xmm0, (%rsp) +..B2.5: + movb 15(%rsp), %al + notb %al + movb 3(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 3(%rsp) + movsd (%rsp), %xmm0 +..B2.6: + call ctanhf@PLT +..B2.14: + movsd %xmm0, 8(%rsp) + movzwl 10(%rsp), %eax + andl $32640, %eax + movss 12(%rsp), %xmm0 + cmpl $32640, %eax + movss 8(%rsp), %xmm1 + unpcklps %xmm1, %xmm0 + jl ..B2.9 +..B2.8: + testl $8388607, 8(%rsp) + jne ..B2.11 +..B2.9: + movsd %xmm0, (%rsp) +..B2.10: + movb 11(%rsp), %al + notb %al + movb 7(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 7(%rsp) + movsd (%rsp), %xmm0 +..B2.11: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ctanf,@function + .size ctanf,.-ctanf + .data +# -- End ctanf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ctanh.S b/external/sgx_libm/intel64/ctanh.S new file mode 100644 index 0000000000..091b6f0793 --- /dev/null +++ b/external/sgx_libm/intel64/ctanh.S @@ -0,0 +1,771 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanh.c" + .text +..TXTST0: +# -- Begin ctanhf + .text + .align 16,0x90 + .globl ctanhf +ctanhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ctanhf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + cvtps2pd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 +..___tag_value_ctanhf.4: + call ctanh@PLT +..___tag_value_ctanhf.5: +..B1.10: + unpcklpd %xmm1, %xmm0 +..B1.2: + cvtpd2ps %xmm0, %xmm0 + movsd %xmm0, 4(%rsp) + movzwl 6(%rsp), %eax + testl $32640, %eax + jne ..B1.4 +..B1.3: + testl $8388607, 4(%rsp) + jne ..B1.6 +..B1.4: + movzwl 10(%rsp), %eax + testl $32640, %eax + jne ..B1.7 +..B1.5: + testl $8388607, 8(%rsp) + je ..B1.7 +..B1.6: + movl $8388608, (%rsp) + movss (%rsp), %xmm1 + movss (%rsp), %xmm0 + mulss %xmm0, %xmm1 + movsd 4(%rsp), %xmm0 + movss %xmm1, (%rsp) +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ctanhf,@function + .size ctanhf,.-ctanhf + .data +# -- End ctanhf + .text +# -- Begin ctanh + .text + .align 16,0x90 + .globl ctanh +ctanh: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_ctanh.8: +..L9: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + movq %fs:40, %rax + subq $160, %rsp + .cfi_def_cfa_offset 192 + movsd %xmm0, 40(%rsp) + xorq %rsp, %rax + movzwl 46(%rsp), %r12d + andl $32752, %r12d + shrl $4, %r12d + movsd %xmm1, 48(%rsp) + cmpl $2047, %r12d + movq %rax, 152(%rsp) + jge ..B2.33 +..B2.2: + testl %r12d, %r12d + jle ..B2.61 +..B2.3: + movzwl 54(%rsp), %edi + movl %edi, %ebx + andl $32752, %ebx + shrl $4, %ebx + cmpl $2047, %ebx + jge ..B2.34 +..B2.4: + cmpl $1032, %r12d + jl ..B2.8 +..B2.5: + movb 47(%rsp), %dl + lea _DBL_MIN_NORMAL(%rip), %rax + andb $-128, %dl + lea ones(%rip), %rcx + shrb $7, %dl + movsd (%rax), %xmm1 + movzbl %dl, %esi + testl %ebx, %ebx + movsd (%rcx,%rsi,8), %xmm0 + subsd %xmm1, %xmm0 + movsd %xmm0, 24(%rsp) + jle ..B2.57 +..B2.6: + movsd %xmm1, 16(%rsp) + testl $32752, %edi + movsd 16(%rsp), %xmm1 + movsd 16(%rsp), %xmm0 + mulsd %xmm0, %xmm1 + movsd %xmm1, 16(%rsp) + movsd 16(%rsp), %xmm0 + jle ..B2.56 +..B2.7: + movsd 48(%rsp), %xmm0 + call tan@PLT +..B2.71: + lea 32(%rsp), %rax + pxor %xmm1, %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, (%rax) + movsd -8(%rax), %xmm0 + movhpd (%rax), %xmm0 + jmp ..B2.54 +..B2.8: + movsd 40(%rsp), %xmm0 + lea 104(%rsp), %rdi +..___tag_value_ctanh.17: + call __libm_cosh_k64@PLT +..___tag_value_ctanh.18: +..B2.72: + movl %eax, %ebx +..B2.9: + movsd 104(%rsp), %xmm2 + movsd 112(%rsp), %xmm3 + movaps %xmm2, %xmm4 + movzwl 46(%rsp), %eax + addsd %xmm3, %xmm4 + movaps %xmm4, %xmm1 + andl $32752, %eax + cmpl $13168, %eax + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm2 + movsd .L_2il0floatpacket.13(%rip), %xmm3 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + subsd %xmm4, %xmm0 + subsd %xmm0, %xmm1 + movsd %xmm1, 104(%rsp) + subsd %xmm1, %xmm4 + addsd %xmm2, %xmm4 + movsd %xmm4, 112(%rsp) + jge ..B2.11 +..B2.10: + lea 16+_CONSTANTS(%rip), %r12 + lea 80(%rsp), %r14 + movsd -40(%r14), %xmm0 + mulsd (%r12), %xmm0 + movsd %xmm0, -8(%r14) + movzwl -2(%r14), %eax + movl %eax, %r12d + andl $32752, %r12d + andl $-32753, %eax + shrl $4, %r12d + orl $-49168, %eax + movw %ax, -2(%r14) + addl $-1279, %r12d + pxor %xmm0, %xmm0 + jmp ..B2.13 +..B2.11: + movsd 40(%rsp), %xmm0 + lea 72(%rsp), %rdi +..___tag_value_ctanh.19: + call __libm_sinh_k64@PLT +..___tag_value_ctanh.20: +..B2.73: + movsd .L_2il0floatpacket.13(%rip), %xmm3 + movl %eax, %r12d +..B2.12: + lea 80(%rsp), %r14 + movsd (%r14), %xmm0 +..B2.13: + movsd 72(%rsp), %xmm4 + movaps %xmm0, %xmm5 + movaps %xmm3, %xmm2 + lea 56(%rsp), %rdi + addsd %xmm4, %xmm5 + mulsd %xmm5, %xmm2 + subsd %xmm5, %xmm4 + movaps %xmm2, %xmm1 + lea 88(%rsp), %rsi + subsd %xmm5, %xmm1 + addsd %xmm0, %xmm4 + subsd %xmm1, %xmm2 + movsd -40(%rsi), %xmm0 + subsd %xmm2, %xmm5 + movsd %xmm2, -16(%rsi) + addsd %xmm4, %xmm5 + movsd %xmm5, (%r14) +..___tag_value_ctanh.21: + call __libm_sincos_k64@PLT +..___tag_value_ctanh.22: +..B2.14: + movsd 88(%rsp), %xmm4 + lea 8+_CONSTANTS(%rip), %rax + movsd 96(%rsp), %xmm2 + movaps %xmm4, %xmm1 + movsd .L_2il0floatpacket.13(%rip), %xmm3 + addl %r12d, %ebx + movsd 112(%rsp), %xmm6 + movaps %xmm3, %xmm10 + movsd (%r14), %xmm13 + movaps %xmm6, %xmm11 + mulsd %xmm13, %xmm11 + addsd %xmm2, %xmm1 + movsd 104(%rsp), %xmm7 + lea (%r12,%r12), %r14d + movaps %xmm7, %xmm8 + subsd %xmm1, %xmm4 + mulsd %xmm13, %xmm7 + addsd %xmm2, %xmm4 + movaps %xmm3, %xmm2 + mulsd %xmm1, %xmm2 + movaps %xmm2, %xmm0 + movsd (%rax), %xmm5 + subsd %xmm1, %xmm0 + movsd %xmm5, 8(%rsp) + subsd %xmm0, %xmm2 + movsd 72(%rsp), %xmm0 + subsd %xmm2, %xmm1 + mulsd %xmm0, %xmm6 + addsd %xmm5, %xmm2 + mulsd %xmm0, %xmm8 + addsd %xmm4, %xmm1 + addsd %xmm6, %xmm11 + movaps %xmm8, %xmm12 + movaps %xmm0, %xmm5 + mulsd %xmm0, %xmm5 + addsd %xmm7, %xmm11 + mulsd %xmm13, %xmm0 + mulsd %xmm13, %xmm13 + addsd %xmm11, %xmm12 + addsd %xmm0, %xmm0 + mulsd %xmm12, %xmm10 + subsd %xmm12, %xmm8 + addsd %xmm13, %xmm0 + addsd %xmm8, %xmm11 + movaps %xmm10, %xmm9 + movaps %xmm2, %xmm6 + movsd %xmm5, 120(%rsp) + subsd %xmm12, %xmm9 + mulsd %xmm2, %xmm6 + subsd %xmm9, %xmm10 + movzwl 126(%rsp), %edx + subsd %xmm10, %xmm12 + andl $32752, %edx + addsd %xmm11, %xmm12 + shrl $4, %edx + movsd %xmm2, 88(%rsp) + mulsd %xmm1, %xmm2 + movsd %xmm6, 24(%rsp) + lea (%rdx,%r12,2), %eax + movzwl 30(%rsp), %edx + addsd %xmm2, %xmm2 + andl $32752, %edx + shrl $4, %edx + movsd %xmm1, 96(%rsp) + mulsd %xmm1, %xmm1 + movsd %xmm10, 136(%rsp) + lea -112(%rdx), %ecx + movsd %xmm12, 144(%rsp) + cmpl %ecx, %eax + movsd %xmm0, 128(%rsp) + addsd %xmm1, %xmm2 + jg ..B2.16 +..B2.15: + movsd %xmm2, 32(%rsp) + xorl %r14d, %r14d + jmp ..B2.22 +..B2.16: + addl $112, %edx + cmpl %edx, %eax + jge ..B2.21 +..B2.17: + movl %r14d, %eax + negl %eax + movsd .L_2il0floatpacket.14(%rip), %xmm1 + addl $1023, %eax + movsd %xmm1, (%rsp) + andl $2047, %eax + movzwl 6(%rsp), %edx + movaps %xmm5, %xmm1 + shll $4, %eax + andl $-32753, %edx + orl %eax, %edx + movw %dx, 6(%rsp) + movsd (%rsp), %xmm4 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm2 + comisd %xmm6, %xmm5 + addsd %xmm6, %xmm1 + movsd %xmm6, 24(%rsp) + movsd %xmm2, 32(%rsp) + jbe ..B2.19 +..B2.18: + subsd %xmm1, %xmm5 + addsd %xmm6, %xmm5 + addsd %xmm2, %xmm5 + addsd %xmm0, %xmm5 + jmp ..B2.20 +..B2.19: + subsd %xmm1, %xmm6 + addsd %xmm5, %xmm6 + addsd %xmm0, %xmm6 + addsd %xmm2, %xmm6 + movaps %xmm6, %xmm5 +..B2.20: + movaps %xmm5, %xmm6 + addsd %xmm1, %xmm6 + subsd %xmm6, %xmm1 + addsd %xmm1, %xmm5 + movaps %xmm5, %xmm2 + jmp ..B2.22 +..B2.21: + movsd %xmm2, 32(%rsp) + movaps %xmm5, %xmm6 + movaps %xmm0, %xmm2 +..B2.22: + movaps %xmm6, %xmm0 + movaps %xmm3, %xmm5 + movsd .L_2il0floatpacket.14(%rip), %xmm1 + movaps %xmm3, %xmm7 + movsd .L_2il0floatpacket.14(%rip), %xmm8 + negl %r14d + addl %r14d, %ebx + lea 136(%rsp), %rsi + movl %ebx, %edi + lea 120(%rsp), %rdx + addsd %xmm2, %xmm0 + mulsd %xmm0, %xmm5 + subsd %xmm0, %xmm6 + addsd %xmm2, %xmm6 + movaps %xmm5, %xmm2 + subsd %xmm0, %xmm2 + subsd %xmm2, %xmm5 + divsd %xmm5, %xmm1 + mulsd %xmm1, %xmm7 + subsd %xmm5, %xmm0 + movaps %xmm7, %xmm4 + lea 24(%rsp), %rcx + subsd %xmm1, %xmm4 + addsd %xmm0, %xmm6 + subsd %xmm4, %xmm7 + mulsd %xmm7, %xmm5 + mulsd %xmm7, %xmm6 + subsd %xmm5, %xmm8 + movsd %xmm7, (%rdx) + subsd %xmm6, %xmm8 + movsd .L_2il0floatpacket.14(%rip), %xmm6 + addsd %xmm8, %xmm6 + mulsd %xmm6, %xmm8 + mulsd %xmm7, %xmm8 + movsd %xmm8, 8(%rdx) +..___tag_value_ctanh.23: + call __libm_mul_k64@PLT +..___tag_value_ctanh.24: +..B2.23: + movzwl 54(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + movsd .L_2il0floatpacket.13(%rip), %xmm3 + testl %eax, %eax + jne ..B2.28 +..B2.24: + testl $1048575, 52(%rsp) + jne ..B2.28 +..B2.25: + cmpl $0, 48(%rsp) + jne ..B2.28 +..B2.26: + movq 48(%rsp), %rax + movq %rax, 32(%rsp) + movq 152(%rsp), %rdx + xorq %rsp, %rdx + movsd 48(%rsp), %xmm1 + movsd 24(%rsp), %xmm0 + cmpq %fs:40, %rdx + jne ..B2.60 +..B2.27: + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -32 + .cfi_offset 12, -16 + .cfi_offset 14, -24 +..B2.28: + cmpl $823, %eax + jl ..B2.30 +..B2.29: + xorl %ecx, %ecx + lea 64(%rsp), %rax + movsd (%rax), %xmm0 + jmp ..B2.31 +..B2.30: + lea 16+_CONSTANTS(%rip), %rax + movsd 48(%rsp), %xmm0 + mulsd (%rax), %xmm0 + lea 64(%rsp), %rax + movsd %xmm0, -8(%rax) + movzwl -2(%rax), %edx + movl %edx, %ecx + andl $32752, %ecx + andl $-32753, %edx + shrl $4, %ecx + orl $-49168, %edx + movw %dx, -2(%rax) + addl $-1279, %ecx + pxor %xmm0, %xmm0 +..B2.31: + movsd 56(%rsp), %xmm1 + movaps %xmm0, %xmm6 + movaps %xmm3, %xmm2 + addl %ecx, %r14d + movsd 8(%rsp), %xmm4 + lea 136(%rsp), %rsi + movsd -40(%rsi), %xmm5 + lea 120(%rsp), %rdx + movsd -32(%rdx), %xmm7 + lea 32(%rsp), %rcx + movl %r14d, %edi + addsd %xmm1, %xmm6 + mulsd %xmm6, %xmm2 + subsd %xmm6, %xmm1 + addsd %xmm0, %xmm1 + movaps %xmm2, %xmm0 + subsd %xmm6, %xmm0 + subsd %xmm0, %xmm2 + subsd %xmm2, %xmm6 + addsd %xmm2, %xmm4 + addsd %xmm1, %xmm6 + movaps %xmm6, %xmm8 + movaps %xmm4, %xmm10 + mulsd %xmm5, %xmm8 + mulsd %xmm4, %xmm5 + mulsd %xmm7, %xmm10 + mulsd %xmm6, %xmm7 + addsd %xmm5, %xmm8 + movaps %xmm10, %xmm11 + addsd %xmm7, %xmm8 + movsd %xmm6, (%rax) + addsd %xmm8, %xmm11 + mulsd %xmm11, %xmm3 + subsd %xmm11, %xmm10 + movaps %xmm3, %xmm9 + addsd %xmm8, %xmm10 + subsd %xmm11, %xmm9 + movsd %xmm4, -64(%rdx) + subsd %xmm9, %xmm3 + movsd %xmm3, 16(%rdx) + subsd %xmm3, %xmm11 + addsd %xmm10, %xmm11 + movsd %xmm11, 24(%rdx) +..___tag_value_ctanh.36: + call __libm_mul_k64@PLT +..___tag_value_ctanh.37: +..B2.32: + movsd 24(%rsp), %xmm0 + movhpd 32(%rsp), %xmm0 + jmp ..B2.54 +..B2.33: + movzwl 54(%rsp), %ebx + andl $32752, %ebx + shrl $4, %ebx +..B2.34: + testl %ebx, %ebx + jne ..B2.37 +..B2.35: + testl $1048575, 52(%rsp) + jne ..B2.37 +..B2.36: + cmpl $0, 48(%rsp) + je ..B2.39 +..B2.37: + cmpl $2047, %ebx + jge ..B2.45 +..B2.38: + cmpl $2047, %r12d + je ..B2.65 +..B2.39: + movsd 40(%rsp), %xmm0 + call tanh@PLT +..B2.74: + movsd %xmm0, 24(%rsp) + testl %r12d, %r12d + jne ..B2.42 +..B2.40: + testl $1048575, 44(%rsp) + jne ..B2.42 +..B2.41: + cmpl $0, 40(%rsp) + je ..B2.44 +..B2.42: + testl %ebx, %ebx + jle ..B2.64 +..B2.43: + movsd 48(%rsp), %xmm0 + call tan@PLT +..B2.75: + pxor %xmm1, %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, 32(%rsp) + movsd 24(%rsp), %xmm0 + movhpd 32(%rsp), %xmm0 + jmp ..B2.54 +..B2.44: + movsd 48(%rsp), %xmm0 + call tan@PLT +..B2.76: + movsd %xmm0, 32(%rsp) + movsd 24(%rsp), %xmm0 + movhpd 32(%rsp), %xmm0 + jmp ..B2.54 +..B2.45: + cmpl $2047, %r12d + jge ..B2.47 +..B2.46: + movsd 48(%rsp), %xmm0 + call tan@PLT +..B2.77: + movsd %xmm0, 32(%rsp) + movsd %xmm0, 24(%rsp) + movhpd 32(%rsp), %xmm0 + jmp ..B2.54 +..B2.47: + testl $1048575, 44(%rsp) + jne ..B2.49 +..B2.48: + cmpl $0, 40(%rsp) + je ..B2.50 +..B2.49: + movsd 40(%rsp), %xmm0 + call tanh@PLT +..B2.78: + movsd 48(%rsp), %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, 32(%rsp) + movsd %xmm0, 24(%rsp) + movhpd 32(%rsp), %xmm0 + jmp ..B2.54 +..B2.50: + testl $1048575, 52(%rsp) + jne ..B2.52 +..B2.51: + cmpl $0, 48(%rsp) + je ..B2.53 +..B2.52: + movsd 48(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 48(%rsp) + movsd 40(%rsp), %xmm0 + call tanh@PLT +..B2.79: + lea zeros(%rip), %rax + movhpd (%rax), %xmm0 + movsd %xmm0, 24(%rsp) + movhpd %xmm0, 32(%rsp) + jmp ..B2.54 +..B2.53: + movsd 40(%rsp), %xmm0 + call tanh@PLT +..B2.80: + movb 55(%rsp), %dl + lea zeros(%rip), %rax + andb $-128, %dl + lea ones(%rip), %rcx + shrb $7, %dl + movsd (%rax), %xmm1 + movzbl %dl, %ebx + mulsd (%rcx,%rbx,8), %xmm1 + unpcklpd %xmm1, %xmm0 + movsd %xmm0, 24(%rsp) + movhpd %xmm0, 32(%rsp) +..B2.54: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.60 +..B2.55: + movaps %xmm0, %xmm1 + unpckhpd %xmm0, %xmm1 + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -32 + .cfi_offset 12, -16 + .cfi_offset 14, -24 +..B2.56: + movb 55(%rsp), %dl + lea 32(%rsp), %rax + movsd %xmm0, (%rax) + andb $-128, %dl + movb 7(%rax), %cl + andb $127, %cl + orb %dl, %cl + movsd -8(%rax), %xmm0 + movb %cl, 7(%rax) + movhpd (%rax), %xmm0 + jmp ..B2.54 +..B2.57: + testl $1048575, 52(%rsp) + jne ..B2.6 +..B2.58: + cmpl $0, 48(%rsp) + jne ..B2.6 +..B2.59: + pxor %xmm0, %xmm0 + jmp ..B2.56 +..B2.60: + call __stack_chk_fail@PLT +..B2.61: + testl $1048575, 44(%rsp) + jne ..B2.3 +..B2.62: + cmpl $0, 40(%rsp) + jne ..B2.3 + jmp ..B2.33 +..B2.64: + pxor %xmm0, %xmm0 + mulsd 48(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + movsd 24(%rsp), %xmm0 + movhpd 32(%rsp), %xmm0 + jmp ..B2.54 +..B2.65: + testl $1048575, 44(%rsp) + jne ..B2.45 +..B2.66: + cmpl $0, 40(%rsp) + jne ..B2.45 +..B2.67: + movsd 40(%rsp), %xmm0 + call tanh@PLT +..B2.81: + movsd %xmm0, 24(%rsp) + jmp ..B2.42 + .align 16,0x90 + .cfi_endproc + .type ctanh,@function + .size ctanh,.-ctanh + .data +# -- End ctanh + .section .rodata, "a" + .align 16 + .align 16 +_DBL_MIN_NORMAL: + .long 0 + .long 1048576 + .type _DBL_MIN_NORMAL,@object + .size _DBL_MIN_NORMAL,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x02000000,0x41a00000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +zeros: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .type zeros,@object + .size zeros,16 + .align 4 +.L_2il0floatpacket.12: + .long 0x00800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +_CONSTANTS: + .long 0 + .long 2145386496 + .long 0 + .long 1048576 + .long 0 + .long 1341128704 + .type _CONSTANTS,@object + .size _CONSTANTS,24 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ctanhl.S b/external/sgx_libm/intel64/ctanhl.S new file mode 100644 index 0000000000..ae3c9322f2 --- /dev/null +++ b/external/sgx_libm/intel64/ctanhl.S @@ -0,0 +1,1012 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanhl.c" + .text +..TXTST0: +# -- Begin ctanhl + .text + .align 16,0x90 + .globl ctanhl +ctanhl: +# parameter 1: 448 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ctanhl.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $408, %rsp + .cfi_def_cfa_offset 448 + xorb %r15b, %r15b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 400(%rsp) + fstpt 208(%rsp) + fldt 208(%rsp) + fstpt 368(%rsp) + fldt 368(%rsp) + fstpt 384(%rsp) +..B1.2: + fnstcw 226(%rsp) +..B1.3: + movzwl 226(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 224(%rsp) +..B1.5: + fldcw 224(%rsp) +..B1.6: + movb $1, %r15b +..B1.7: + movzwl 456(%rsp), %edx + andl $32767, %edx + cmpl $32767, %edx + jge ..B1.52 +..B1.8: + movzwl 472(%rsp), %ebp + andl $32767, %ebp + cmpl $32767, %ebp + jge ..B1.52 +..B1.9: + cmpl $0, 452(%rsp) + jne ..B1.11 +..B1.10: + cmpl $0, 448(%rsp) + je ..B1.52 +..B1.11: + cmpl $16396, %edx + jl ..B1.23 +..B1.12: + movb 457(%rsp), %dl + lea _CONSTANTS(%rip), %rax + andb $-128, %dl + lea ones(%rip), %rcx + shrb $7, %dl + fldt (%rax) + movzbl %dl, %ebx + cmpl $0, 468(%rsp) + fldl (%rcx,%rbx,8) + fsub %st(1), %st + fstpt 368(%rsp) + jne ..B1.14 +..B1.13: + cmpl $0, 464(%rsp) + je ..B1.15 +..B1.14: + fmul %st(0), %st + fstpt 384(%rsp) + jmp ..B1.16 +..B1.15: + fstp %st(0) + fldt 208(%rsp) + fstpt 384(%rsp) +..B1.16: + testl %ebp, %ebp + jle ..B1.76 +..B1.17: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 480(%rsp) + fstpt (%rsp) + call tanl@PLT +..B1.85: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fstpt 192(%rsp) + movb 393(%rsp), %dl + movb 201(%rsp), %al + andb $127, %dl + andb $-128, %al + orb %al, %dl +..B1.18: + movb %dl, 393(%rsp) + testb %r15b, %r15b + je ..B1.20 +..B1.19: + fldcw 226(%rsp) +..B1.20: + movq 400(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.75 +..B1.21: + fldt 368(%rsp) + fldt 384(%rsp) + movq 400(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.74 +..B1.22: + addq $408, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 448 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.23: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 464(%rsp) + lea 288(%rsp), %rdi + fstpt (%rsp) +..___tag_value_ctanhl.29: + call __libm_coshl_k80@PLT +..___tag_value_ctanhl.30: +..B1.86: + addq $16, %rsp + .cfi_def_cfa_offset 448 +..B1.24: + fldt 288(%rsp) + lea 32+_CONSTANTS(%rip), %r14 + movzwl 456(%rsp), %eax + andl $32767, %eax + cmpl $16183, %eax + fldt (%r14) + fstpt 32(%rsp) + fldt 32(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt 272(%rsp) + fld %st(0) + movl (%rsp), %r14d + fadd %st(2), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + jge ..B1.26 +..B1.25: + fldt 448(%rsp) + lea 16+_CONSTANTS(%rip), %rbp + fldt 208(%rsp) + lea 256(%rsp), %rdx + fstpt (%rdx) + fldt (%rbp) + fmulp %st, %st(1) + fstpt -16(%rdx) + movzwl -8(%rdx), %eax + movl %eax, %ebp + andl $-32768, %eax + andl $32767, %ebp + orl $-49153, %eax + addl $-16639, %ebp + movw %ax, -8(%rdx) + jmp ..B1.28 +..B1.26: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 464(%rsp) + lea 256(%rsp), %rdi + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value_ctanhl.33: + call __libm_sinhl_k80@PLT +..___tag_value_ctanhl.34: +..B1.87: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 448 +..B1.27: + fldt 32(%rsp) + lea 256(%rsp), %rdx + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + movl (%rsp), %ebp +..B1.28: + fldt 240(%rsp) + fld %st(0) + fldt (%rdx) + fadd %st, %st(1) + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fsubp %st, %st(2) + fsubp %st, %st(1) + fldt 480(%rsp) + fstpt (%rsp) + lea 320(%rsp), %rdi + fxch %st(1) + fstpt 32(%rsp) + fstpt 112(%rsp) +..___tag_value_ctanhl.37: + call __libm_cosl_k80@PLT +..___tag_value_ctanhl.38: +..B1.88: + fldt 112(%rsp) + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 448 +..B1.29: + fldt 304(%rsp) + lea _CONSTANTS(%rip), %rax + fld %st(0) + lea t33(%rip), %rdx + fldt 320(%rsp) + addl %ebp, %r14d + fadd %st, %st(1) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fxch %st(1) + fmul %st(4), %st + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + fstpt 128(%rsp) + fldt 128(%rsp) + fldt (%rax) + movzwl 168(%rsp), %eax + faddp %st, %st(4) + fxch %st(3) + fstpt 112(%rsp) + fldt 112(%rsp) + andl $32767, %eax + fstpt 144(%rsp) + fld %st(0) + fldt 160(%rsp) + addl %ebp, %eax + fld %st(0) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt (%rdx) + fmul %st, %st(3) + fld %st(0) + fmul %st(2), %st + movzwl 152(%rsp), %edx + fsub %st, %st(3) + andl $32767, %edx + fsubp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fadd %st(5), %st + fxch %st(1) + fstpt (%rsp) + fld %st(3) + lea 64(%rdx), %ecx + cmpl %ecx, %eax + fsubr %st(3), %st + fsubrp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fldt 80(%rsp) + faddp %st, %st(4) + fld %st(3) + fmul %st(3), %st + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fsubp %st, %st(2) + fsubp %st, %st(1) + fstpt 64(%rsp) + fldt 112(%rsp) + jge ..B1.35 +..B1.30: + addl $-64, %edx + cmpl %edx, %eax + jle ..B1.34 +..B1.31: + fstpt 112(%rsp) + lea (%rbp,%rbp), %ebx + movzwl 120(%rsp), %eax + movl %eax, %edx + movzwl 136(%rsp), %ecx + subl %ebp, %eax + andl $32767, %ecx + andl $-32768, %edx + andl $32767, %eax + subl %ebp, %ecx + orl %eax, %edx + fxch %st(1) + fstpt 160(%rsp) + testl %ecx, %ecx + movw %dx, 120(%rsp) + jle ..B1.33 +..B1.32: + fldt 112(%rsp) + movzwl 168(%rsp), %eax + movl %eax, %edx + subl %ebp, %eax + andl $-32768, %edx + andl $32767, %eax + orl %eax, %edx + movw %dx, 168(%rsp) + jmp ..B1.38 +..B1.33: + fldt 112(%rsp) + jmp ..B1.38 +..B1.34: + fstp %st(1) + fldt 208(%rsp) + fstpt 112(%rsp) + fldt 112(%rsp) + fstpt 160(%rsp) +..B1.36: + fldt .L_2il0floatpacket.8(%rip) + fxch %st(1) + fstpt 16(%rsp) + xorl %ebx, %ebx + jmp ..B1.38 +..B1.35: + fldt 208(%rsp) + fstpt 112(%rsp) + fldt 112(%rsp) + fstpt 160(%rsp) + fldt 160(%rsp) + jl ..B1.100 +..B1.37: + fstp %st(3) + fstp %st(0) + lea (%rbp,%rbp), %ebx + fxch %st(1) +..B1.38: + addq $-32, %rsp + .cfi_def_cfa_offset 480 + fldt 48(%rsp) + lea 368(%rsp), %rdi + fstpt (%rsp) + fstpt 16(%rsp) + fstpt 128(%rsp) +..___tag_value_ctanhl.41: + call __libm_hypot2l_k80@PLT +..___tag_value_ctanhl.42: +..B1.89: + fldt 128(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 448 +..B1.39: + fldt 32(%rsp) + lea t32(%rip), %rbp + movzwl 8+.L_2il0floatpacket.9(%rip), %eax + movl %eax, %ecx + andl $-32768, %ecx + subl %ebx, %r14d + movl %r14d, %edi + faddp %st, %st(2) + fxch %st(1) + fstpt 176(%rsp) + fldt .L_2il0floatpacket.9(%rip) + movl 176(%rsp), %edx + addl %eax, %edx + andl $32767, %edx + fstpt 192(%rsp) + orl %edx, %ecx + fldt 336(%rsp) + fldt 352(%rsp) + fldt 16(%rsp) + fldt 160(%rsp) + fldt .L_2il0floatpacket.10(%rip) + fmul %st, %st(2) + fxch %st(5) + fmulp %st, %st(2) + fldt 112(%rsp) + movw %cx, 200(%rsp) + fmulp %st, %st(5) + fmulp %st, %st(4) + fldt 192(%rsp) + fmul %st, %st(3) + fld %st(3) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fstpt 352(%rsp) + fldt 352(%rsp) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 336(%rsp) + fldt 336(%rsp) + fldt 48(%rsp) + fld %st(0) + fdiv %st(2), %st + fmul %st, %st(3) + fldt (%rbp) + fld %st(0) + fmul %st(2), %st + fld %st(0) + fsubr %st(3), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(3), %st + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fmul %st(5), %st + fsubr %st, %st(7) + faddp %st, %st(7) + fld %st(6) + fsubrp %st, %st(5) + fld %st(0) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(7) + fld %st(6) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(7) + faddp %st, %st(2) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(4) + fsubrp %st, %st(1) + fsubp %st, %st(1) + fldt 64(%rsp) + faddp %st, %st(1) + fsubp %st, %st(1) + fld %st(1) + fldt 96(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 480 + fdivrp %st, %st(2) + fadd %st(1), %st + fstpt (%rsp) + fldt (%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_ctanhl.45: + call __libm_scalbl_k80@PLT +..___tag_value_ctanhl.46: +..B1.90: + addq $32, %rsp + .cfi_def_cfa_offset 448 +..B1.40: + fstpt 368(%rsp) + cmpq $0, 464(%rsp) + jne ..B1.46 +..B1.41: + fldt 464(%rsp) + testb %r15b, %r15b + fstpt 384(%rsp) + je ..B1.43 +..B1.42: + fldcw 226(%rsp) +..B1.43: + movq 400(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.75 +..B1.44: + fldt 368(%rsp) + fldt 384(%rsp) + movq 400(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.74 +..B1.45: + addq $408, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 448 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.46: + movzwl 472(%rsp), %eax + andl $32767, %eax + cmpl $16183, %eax + jge ..B1.48 +..B1.47: + fldt 464(%rsp) + lea 16+_CONSTANTS(%rip), %rax + fldt 208(%rsp) + fstpt 32(%rsp) + fldt (%rax) + fmulp %st, %st(1) + fstpt 16(%rsp) + movzwl 24(%rsp), %edx + movl %edx, %edi + andl $-32768, %edx + andl $32767, %edi + orl $-49153, %edx + addl $-16639, %edi + movw %dx, 24(%rsp) + fldt 16(%rsp) + jmp ..B1.50 +..B1.48: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 480(%rsp) + lea 32(%rsp), %rdi + fstpt (%rsp) +..___tag_value_ctanhl.63: + call __libm_sinl_k80@PLT +..___tag_value_ctanhl.64: +..B1.91: + addq $16, %rsp + .cfi_def_cfa_offset 448 +..B1.49: + fldt 16(%rsp) + xorl %edi, %edi + fmul %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fldt 32(%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 208(%rsp) + fldt 208(%rsp) + fstpt 32(%rsp) +..B1.50: + fldt 208(%rsp) + fld %st(1) + subl %ebx, %edi + fadd %st(1), %st + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fldt (%rsp) + fld %st(0) + fmul %st(4), %st + fsub %st, %st(2) + fsubp %st, %st(2) + fld %st(1) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fldt 144(%rsp) + fmul %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fsubrp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fsubr %st, %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fldt 128(%rsp) + faddp %st, %st(2) + fld %st(1) + fmul %st(5), %st + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsub %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + fstpt 160(%rsp) + fldt 336(%rsp) + fld %st(0) + fdivr %st(2), %st + fld %st(1) + fldt 80(%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + fsubr %st(4), %st + faddp %st, %st(1) + fld %st(0) + fsubr %st(4), %st + fxch %st(2) + fmul %st(5), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fsubr %st, %st(4) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fsubrp %st, %st(3) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 352(%rsp) + fmul %st(3), %st + fsubrp %st, %st(2) + fldt 336(%rsp) + fdivrp %st, %st(2) + addq $-32, %rsp + .cfi_def_cfa_offset 480 + fadd %st(1), %st + fstpt (%rsp) + fldt (%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value_ctanhl.67: + call __libm_scalbl_k80@PLT +..___tag_value_ctanhl.68: +..B1.92: + addq $32, %rsp + .cfi_def_cfa_offset 448 +..B1.51: + fstpt 384(%rsp) + jmp ..B1.69 +..B1.52: + cmpq $0, 464(%rsp) + jne ..B1.54 +..B1.53: + movq 448(%rsp), %rbx + jmp ..B1.56 +..B1.54: + movzwl 472(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jge ..B1.60 +..B1.55: + movq 448(%rsp), %rbx + cmpl $32767, %edx + je ..B1.80 +..B1.56: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 464(%rsp) + fstpt (%rsp) + call tanhl@PLT +..B1.93: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fstpt 368(%rsp) + testq %rbx, %rbx + jne ..B1.58 +..B1.57: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 480(%rsp) + fstpt (%rsp) + call tanl@PLT +..B1.94: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fstpt 384(%rsp) + jmp ..B1.69 +..B1.58: + movzwl 472(%rsp), %eax + testl $32767, %eax + jle ..B1.79 +..B1.59: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 480(%rsp) + fstpt (%rsp) + call tanl@PLT +..B1.95: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fldt 208(%rsp) + fmulp %st, %st(1) + fstpt 384(%rsp) + jmp ..B1.69 +..B1.60: + cmpl $32767, %edx + jge ..B1.62 +..B1.61: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 480(%rsp) + fstpt (%rsp) + call tanl@PLT +..B1.96: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fstpt 368(%rsp) + fldt 368(%rsp) + fstpt 384(%rsp) + jmp ..B1.69 +..B1.62: + cmpl $-2147483648, 452(%rsp) + jne ..B1.64 +..B1.63: + cmpl $0, 448(%rsp) + je ..B1.65 +..B1.64: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 464(%rsp) + fstpt (%rsp) + call tanhl@PLT +..B1.97: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fldt 464(%rsp) + fmul %st(1), %st + fstpt 384(%rsp) + fstpt 368(%rsp) + jmp ..B1.69 +..B1.65: + cmpl $-2147483648, 468(%rsp) + jne ..B1.67 +..B1.66: + cmpl $0, 464(%rsp) + je ..B1.68 +..B1.67: + fldt 464(%rsp) + fmul %st(0), %st + fstpt 464(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 464(%rsp) + fstpt (%rsp) + call tanhl@PLT +..B1.98: + addq $16, %rsp + .cfi_def_cfa_offset 448 + fldt 208(%rsp) + fstpt 384(%rsp) + fstpt 368(%rsp) + jmp ..B1.69 +..B1.68: + addq $-16, %rsp + .cfi_def_cfa_offset 464 + fldt 464(%rsp) + fstpt (%rsp) + call tanhl@PLT +..B1.99: + addq $16, %rsp + .cfi_def_cfa_offset 448 + lea ones(%rip), %rdx + movb 473(%rsp), %al + pxor %xmm0, %xmm0 + andb $-128, %al + fstpt 368(%rsp) + shrb $7, %al + movzbl %al, %ecx + mulsd (%rdx,%rcx,8), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 384(%rsp) +..B1.69: + testb %r15b, %r15b + je ..B1.71 +..B1.70: + fldcw 226(%rsp) +..B1.71: + movq 400(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.75 +..B1.72: + fldt 368(%rsp) + fldt 384(%rsp) + movq 400(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.74 +..B1.73: + addq $408, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 448 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.74: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.75: + call __stack_chk_fail@PLT +..B1.76: + movb 393(%rsp), %dl + movb 473(%rsp), %al + andb $127, %dl + andb $-128, %al + orb %al, %dl + jmp ..B1.18 +..B1.79: + fldt 464(%rsp) + fldt 208(%rsp) + fmulp %st, %st(1) + fstpt 384(%rsp) + jmp ..B1.69 +..B1.80: + movq $0x8000000000000000, %rax + cmpq %rax, %rbx + je ..B1.56 + jmp ..B1.60 +..B1.100: + fstp %st(0) + fstp %st(1) + jmp ..B1.36 + .align 16,0x90 + .cfi_endproc + .type ctanhl,@function + .size ctanhl,.-ctanhl + .data +# -- End ctanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +t33: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t33,@object + .size t33,32 + .align 16 +t32: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t32,@object + .size t32,32 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ctanl.S b/external/sgx_libm/intel64/ctanl.S new file mode 100644 index 0000000000..d8053d5b13 --- /dev/null +++ b/external/sgx_libm/intel64/ctanl.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ctanl.c" + .text +..TXTST0: +# -- Begin ctanl + .text + .align 16,0x90 + .globl ctanl +ctanl: +# parameter 1: 144 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ctanl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + subq $128, %rsp + .cfi_def_cfa_offset 144 + xorb %r13b, %r13b + fldt .L_2il0floatpacket.8(%rip) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 112(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 96(%rsp) +..B1.2: + fnstcw 2(%rsp) +..B1.3: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.5: + fldcw (%rsp) +..B1.6: + movb $1, %r13b +..B1.7: + fldt 160(%rsp) + movzwl 168(%rsp), %eax + andl $32767, %eax + fstpt 80(%rsp) + cmpl $32767, %eax + fldt 144(%rsp) + fstpt 96(%rsp) + jl ..B1.9 +..B1.8: + movq $0x8000000000000000, %rax + cmpq 160(%rsp), %rax + jne ..B1.10 +..B1.9: + movb 169(%rsp), %al + notb %al + movb 89(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 89(%rsp) +..B1.10: + addq $-32, %rsp + .cfi_def_cfa_offset 176 + movq %rsp, %rdi + movq 112(%rsp), %rax + movq 120(%rsp), %rdx + movq 128(%rsp), %rcx + movq 136(%rsp), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %rsi, 24(%rdi) + call ctanhl@PLT +..B1.22: + fxch %st(1) + addq $32, %rsp + .cfi_def_cfa_offset 144 + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 24(%rsp), %eax + andl $32767, %eax + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + cmpl $32767, %eax + fstpt 48(%rsp) + fstpt 64(%rsp) + jl ..B1.12 +..B1.11: + movq $0x8000000000000000, %rax + cmpq 16(%rsp), %rax + jne ..B1.13 +..B1.12: + movb 25(%rsp), %al + notb %al + movb 73(%rsp), %dl + andb $-128, %al + andb $127, %dl + orb %al, %dl + movb %dl, 73(%rsp) +..B1.13: + testb %r13b, %r13b + je ..B1.15 +..B1.14: + fldcw 2(%rsp) +..B1.15: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.19 +..B1.16: + fldt 48(%rsp) + fldt 64(%rsp) + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.18 +..B1.17: + addq $128, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + fxch %st(1) + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 +..B1.18: + fstp %st(1) + fstp %st(0) + call __stack_chk_fail@PLT +..B1.19: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type ctanl,@function + .size ctanl,.-ctanl + .data +# -- End ctanl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/dpml_ux_bessel.S b/external/sgx_libm/intel64/dpml_ux_bessel.S new file mode 100644 index 0000000000..8720bdd8d5 --- /dev/null +++ b/external/sgx_libm/intel64/dpml_ux_bessel.S @@ -0,0 +1,8227 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_bessel.c" + .text +..TXTST0: +# -- Begin __dpml_ux_bessel__ + .text + .align 16,0x90 +__dpml_ux_bessel__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B1.1: + .cfi_startproc +..___tag_value___dpml_ux_bessel__.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $136, %rsp + .cfi_def_cfa_offset 192 + movq %rsi, %r13 + movq %fs:40, %rax + movq %rcx, %r14 + xorq %rsp, %rax + movq %rdx, %r15 + movq %rax, 120(%rsp) + movq %rdi, %rbp + cmpq $2, %r13 + jge ..B1.53 +..B1.2: + lea __bessel_x_table(%rip), %r10 + lea (%r13,%r15), %rbx + lea (%rbx,%rbx,2), %r11 + movl 4(%rbp), %ecx + cmpl $5, %ecx + movq 8(%rbp), %rax + jg ..B1.8 +..B1.3: + je ..B1.50 +..B1.4: + movq %r10, %rbx + addq 19552(%r10,%r11,8), %rbx + testl %ecx, %ecx + jl ..B1.23 +..B1.5: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B1.6 +..B1.7: + movq 8(%rbx), %r10 + sarq $32, %r10 + andq $1023, %r10 + addq %r10, %rbx +..B1.6: + cmpq (%rbx), %rax + jbe ..B1.23 + jmp ..B1.7 +..B1.8: + xorl %edi, %edi + movq %rbp, %rsi + movl $2, %edx + lea 96(%rsp), %rcx +..___tag_value___dpml_ux_bessel__.16: + call __dpml_divide__@PLT +..___tag_value___dpml_ux_bessel__.17: +..B1.9: + testq %r13, %r13 + jne ..B1.11 +..B1.10: + movl $10, %ebx + lea 18168+__bessel_x_table(%rip), %rsi + lea 18504+__bessel_x_table(%rip), %r12 + jmp ..B1.12 +..B1.11: + movl $9, %ebx + lea 18872+__bessel_x_table(%rip), %rsi + lea 19208+__bessel_x_table(%rip), %r12 +..B1.12: + movl $9, %edx + lea 96(%rsp), %rdi + movq $0x1000000000000044, %rcx + lea (%rsp), %r8 +..___tag_value___dpml_ux_bessel__.18: + call __dpml_evaluate_rational__@PLT +..___tag_value___dpml_ux_bessel__.19: +..B1.13: + movq %r12, %rsi + lea 96(%rsp), %rdi + movq %rbx, %rdx + movl $70, %ecx + lea 24(%rsp), %r8 +..___tag_value___dpml_ux_bessel__.20: + call __dpml_evaluate_rational__@PLT +..___tag_value___dpml_ux_bessel__.21: +..B1.14: + movq %rbp, %rdi + lea (%r13,%r13), %rsi + negq %rsi + movl $3, %edx + incq %rsi + lea 48(%rsp), %rcx + subq %r15, %rsi +..___tag_value___dpml_ux_bessel__.22: + call __dpml_ux_sincos@PLT +..___tag_value___dpml_ux_bessel__.23: +..B1.15: + lea (%rsp), %rdi + movq %rdi, %rdx + lea 48(%rsp), %rsi +..___tag_value___dpml_ux_bessel__.24: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_bessel__.25: +..B1.16: + lea 24(%rsp), %rdi + movq %rdi, %rdx + lea 72(%rsp), %rsi +..___tag_value___dpml_ux_bessel__.26: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_bessel__.27: +..B1.17: + xorl %edx, %edx + movl $1, %eax + testq %r13, %r13 + lea (%rsp), %rdi + cmove %rax, %rdx + lea 24(%rsp), %rsi + movq %rdi, %rcx +..___tag_value___dpml_ux_bessel__.28: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_bessel__.29: +..B1.18: + movl $1, %esi + lea 96(%rsp), %rdi + lea 24(%rsp), %rdx +..___tag_value___dpml_ux_bessel__.30: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___dpml_ux_bessel__.31: +..B1.19: + movq %r14, %rdx + lea (%rsp), %rdi + lea 24(%rsp), %rsi +..___tag_value___dpml_ux_bessel__.32: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_bessel__.33: +..B1.20: + movq 120(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.47 +..B1.21: + addq $136, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.23: + movq 8(%rbx), %r12 + testq $8388608, %r12 + jne ..B1.25 +..B1.24: + movq %rbp, %r15 + jmp ..B1.28 +..B1.25: + movq 16(%rbx), %rax + movq %rbp, %rdi + movq %rax, 32(%rsp) + lea 24(%rsp), %rsi + movq 24(%rbx), %r10 + movl $1, %edx + movq %r10, 16(%rsi) + lea (%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___dpml_ux_bessel__.54: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_bessel__.55: +..B1.26: + movq 32(%rbx), %rax + lea (%rsp), %rdi + movq %rax, 32(%rdi) + lea 24(%rsp), %rsi + movq 40(%rbx), %r10 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r10, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___dpml_ux_bessel__.56: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_bessel__.57: +..B1.27: + lea (%rsp), %r15 +..B1.28: + movq %r12, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r12 + je ..B1.30 +..B1.29: + movq %r12, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r12, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + movq %r14, %r9 +..___tag_value___dpml_ux_bessel__.58: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___dpml_ux_bessel__.59: + jmp ..B1.31 +..B1.30: + movq %r15, %rdi + movq %rbx, %rsi + movq %r12, %rcx + movq %r14, %r8 +..___tag_value___dpml_ux_bessel__.60: + call __dpml_evaluate_rational__@PLT +..___tag_value___dpml_ux_bessel__.61: +..B1.31: + movq %r12, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B1.33 +..B1.32: + decq %rdx + lea 24(%r14), %rsi + movq %r14, %rdi + movq %r14, %rcx +..___tag_value___dpml_ux_bessel__.62: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_bessel__.63: +..B1.33: + testq $4194304, %r12 + je ..B1.35 +..B1.34: + movq %r15, %rdi + movq %r14, %rsi + movq %r14, %rdx +..___tag_value___dpml_ux_bessel__.64: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_bessel__.65: +..B1.35: + testq $8192, %r12 + je ..B1.37 +..B1.36: + movslq (%r14), %rax + btcq $31, %rax + movl %eax, (%r14) +..B1.37: + testq $2097152, %r12 + je ..B1.45 +..B1.38: + cmpq %rbp, %r15 + jne ..B1.40 +..B1.39: + sarq $58, %r12 + subl %r12d, 4(%rbp) +..B1.40: + cmpq $1, %r13 + je ..B1.48 +..B1.41: + movq %rbp, %rdi + lea 19664+__bessel_x_table(%rip), %rsi + lea (%rsp), %rdx +..___tag_value___dpml_ux_bessel__.66: + call __dpml_ux_log__@PLT +..___tag_value___dpml_ux_bessel__.67: +..B1.42: + movq %rbp, %rdi + movq %r13, %rsi + xorl %edx, %edx + lea 24(%rsp), %rcx +..___tag_value___dpml_ux_bessel__.68: + call __dpml_ux_bessel__ +..___tag_value___dpml_ux_bessel__.69: +..B1.43: + lea (%rsp), %rsi + movq %rsi, %rdx + lea 24(%rsp), %rdi +..___tag_value___dpml_ux_bessel__.70: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_bessel__.71: +..B1.44: + movq %r14, %rsi + lea (%rsp), %rdi + movl $1, %edx + movq %r14, %rcx +..___tag_value___dpml_ux_bessel__.72: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_bessel__.73: +..B1.45: + movq 120(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + je ..B1.21 +..B1.47: + call __stack_chk_fail@PLT +..B1.48: + lea 19640+__bessel_x_table(%rip), %rdi + movq %rbp, %rsi + movl $2, %edx + lea 24(%rsp), %rcx +..___tag_value___dpml_ux_bessel__.74: + call __dpml_divide__@PLT +..___tag_value___dpml_ux_bessel__.75: +..B1.49: + movq %r14, %rdi + lea 24(%rsp), %rsi + xorl %edx, %edx + movq %r14, %rcx +..___tag_value___dpml_ux_bessel__.76: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_bessel__.77: + jmp ..B1.41 +..B1.50: + cmpq 19544(%r10,%r11,8), %rax + ja ..B1.8 +..B1.51: + movq %r10, %rbx + addq 19552(%r10,%r11,8), %rbx + jmp ..B1.5 +..B1.53: + movq %rbp, %rdi + movq %r13, %rsi + movq %r15, %rdx + movq %r14, %rcx +..___tag_value___dpml_ux_bessel__.78: + call __dpml_ux_large_order_bessel__ +..___tag_value___dpml_ux_bessel__.79: +..B1.54: + movq 120(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.47 + jmp ..B1.21 + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_bessel__,@function + .size __dpml_ux_bessel__,.-__dpml_ux_bessel__ + .data +# -- End __dpml_ux_bessel__ + .text +# -- Begin __dpml_ux_large_order_bessel__ + .text + .align 16,0x90 +__dpml_ux_large_order_bessel__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B2.1: + .cfi_startproc +..___tag_value___dpml_ux_large_order_bessel__.81: +..L82: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $184, %rsp + .cfi_def_cfa_offset 240 + movq %rdi, %r13 + movq %rcx, %rbx + movq %rdx, %r15 + movq %rsi, %rbp + xorl %edi, %edi + movq %r13, %rsi + movl $2, %edx + movq %fs:40, %rax + lea 120(%rsp), %rcx + xorq %rsp, %rax + movq %rax, 48(%rcx) +..___tag_value___dpml_ux_large_order_bessel__.96: + call __dpml_divide__@PLT +..___tag_value___dpml_ux_large_order_bessel__.97: +..B2.2: + movl $2, %esi + lea 48(%rsp), %rax + movq %rax, %rdi + lea 72(%rsp), %r14 + movq %rax, -8(%rax) + lea 96(%rsp), %r12 + movq %rbp, 8(%rax) +..___tag_value___dpml_ux_large_order_bessel__.98: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_large_order_bessel__.99: +..B2.57: + movq %rax, %rcx +..B2.3: + movl 4(%r13), %r10d + negq %rcx + movslq %r10d, %r8 + addq $64, %rcx + negq %r8 + pxor %xmm0, %xmm0 + addq %rcx, %r8 + pxor %xmm1, %xmm1 + cvtsi2sdq %r8, %xmm0 + cvtsi2sdq %rcx, %xmm1 + subsd .L_2il0floatpacket.97(%rip), %xmm0 + subsd .L_2il0floatpacket.98(%rip), %xmm1 + pxor %xmm2, %xmm2 + movq %rcx, %rax + cvtsi2sdq %rbp, %xmm2 + mulsd .L_2il0floatpacket.96(%rip), %xmm1 + mulsd %xmm0, %xmm2 + negq %rax + subsd %xmm1, %xmm2 + incq %rax + pxor %xmm1, %xmm1 + cvtsi2sdq %rax, %xmm1 + cmpq $2, %r15 + subsd %xmm2, %xmm1 + je ..B2.53 +..B2.4: + movsd .L_2il0floatpacket.100(%rip), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B2.8 +..B2.5: + movl $-65536, %edx + xorl %eax, %eax +..B2.6: + movl %eax, (%rbx) + movq $0x8000000000000000, %rax + movl %edx, 4(%rbx) + movq %rax, 8(%rbx) + movq $0, 16(%rbx) + movq 168(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B2.32 +..B2.7: + addq $184, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.8: + negq %rcx + movq 8(%r13), %r9 + movq %r9, %rax + shrq %cl, %rax + testq %r8, %r8 + jle ..B2.38 +..B2.9: + shrq $1, %r9 + pxor %xmm0, %xmm0 + cvtsi2ssq %r9, %xmm0 + movss %xmm0, 32(%rsp) + pxor %xmm0, %xmm0 + cvtsi2ssq %rbp, %xmm0 + movss %xmm0, 16(%rsp) + movl %r10d, (%rsp) +..___tag_value___dpml_ux_large_order_bessel__.120: + call log2f@PLT +..___tag_value___dpml_ux_large_order_bessel__.121: +..B2.58: + movl (%rsp), %r10d + movss %xmm0, 8(%rsp) +..B2.10: + movss .L_2il0floatpacket.101(%rip), %xmm0 + mulss 8(%rsp), %xmm0 + movss .L_2il0floatpacket.108(%rip), %xmm1 + movl %r10d, (%rsp) + addss .L_2il0floatpacket.102(%rip), %xmm0 + addss 16(%rsp), %xmm1 + addss %xmm0, %xmm1 + movss 32(%rsp), %xmm0 + movss %xmm1, 24(%rsp) +..___tag_value___dpml_ux_large_order_bessel__.122: + call log2f@PLT +..___tag_value___dpml_ux_large_order_bessel__.123: +..B2.59: + movl (%rsp), %r10d + movss %xmm0, 32(%rsp) +..B2.11: + addl $-64, %r10d + pxor %xmm0, %xmm0 + cvtsi2ss %r10d, %xmm0 + movss 32(%rsp), %xmm3 + pxor %xmm1, %xmm1 + pxor %xmm4, %xmm4 + addss %xmm0, %xmm3 + cvtss2sd 16(%rsp), %xmm4 + addss .L_2il0floatpacket.103(%rip), %xmm3 + movss %xmm3, 32(%rsp) + cvtss2sd %xmm3, %xmm1 + subss 8(%rsp), %xmm3 + movsd .L_2il0floatpacket.96(%rip), %xmm2 + cvtss2sd %xmm3, %xmm3 + mulsd %xmm2, %xmm1 + addsd %xmm2, %xmm4 + movsd .L_2il0floatpacket.104(%rip), %xmm5 + mulsd %xmm3, %xmm4 + subsd %xmm1, %xmm5 + movss 24(%rsp), %xmm0 + subsd %xmm4, %xmm5 + cvtsd2ss %xmm5, %xmm5 + movss %xmm5, (%rsp) +..___tag_value___dpml_ux_large_order_bessel__.124: + call log2f@PLT +..___tag_value___dpml_ux_large_order_bessel__.125: +..B2.12: + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + cvtss2sd %xmm0, %xmm2 + cvtss2sd (%rsp), %xmm1 + subss 32(%rsp), %xmm0 + mulsd .L_2il0floatpacket.105(%rip), %xmm2 + cvtss2sd %xmm0, %xmm0 + addsd %xmm1, %xmm2 + divsd %xmm0, %xmm2 + cvtsd2ss %xmm2, %xmm2 + movss 24(%rsp), %xmm0 + movsd %xmm1, 16(%rsp) + addss %xmm2, %xmm0 + cvtss2sd %xmm0, %xmm0 + mulsd .L_2il0floatpacket.96(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 8(%rsp) +..___tag_value___dpml_ux_large_order_bessel__.126: + call log2f@PLT +..___tag_value___dpml_ux_large_order_bessel__.127: +..B2.61: + movsd 16(%rsp), %xmm1 +..B2.13: + pxor %xmm2, %xmm2 + cvtss2sd %xmm0, %xmm2 + subss 32(%rsp), %xmm0 + mulsd .L_2il0floatpacket.105(%rip), %xmm2 + cvtss2sd %xmm0, %xmm0 + addsd %xmm1, %xmm2 + divsd %xmm0, %xmm2 + cvtsd2ss %xmm2, %xmm2 + movss 8(%rsp), %xmm0 + movsd %xmm1, 16(%rsp) + addss %xmm2, %xmm0 + cvtss2sd %xmm0, %xmm0 + mulsd .L_2il0floatpacket.96(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, (%rsp) +..___tag_value___dpml_ux_large_order_bessel__.128: + call log2f@PLT +..___tag_value___dpml_ux_large_order_bessel__.129: +..B2.62: + movsd 16(%rsp), %xmm1 + movaps %xmm0, %xmm3 +..B2.14: + pxor %xmm2, %xmm2 + movq $0x8000000000000000, %r13 + cvtss2sd %xmm3, %xmm2 + subss 32(%rsp), %xmm3 + movsd .L_2il0floatpacket.105(%rip), %xmm0 + xorl %r8d, %r8d + mulsd %xmm2, %xmm0 + xorl %r9d, %r9d + cvtss2sd %xmm3, %xmm3 + addsd %xmm0, %xmm1 + divsd %xmm3, %xmm1 + cvtsd2ss %xmm1, %xmm1 + movss (%rsp), %xmm4 + movsd .L_2il0floatpacket.96(%rip), %xmm5 + addss %xmm1, %xmm4 + cvtss2sd %xmm4, %xmm4 + mulsd %xmm4, %xmm5 + cvtsd2ss %xmm5, %xmm5 + cvtss2sd %xmm5, %xmm5 + movsd .L_2il0floatpacket.109(%rip), %xmm7 + movaps %xmm7, %xmm6 + addsd .L_2il0floatpacket.106(%rip), %xmm5 + comisd %xmm7, %xmm5 + cmplesd %xmm5, %xmm6 + movaps %xmm5, %xmm8 + movd %xmm6, %r15 + subsd %xmm7, %xmm8 + jae ..L130 + movaps %xmm5, %xmm8 +..L130: + cvttsd2si %xmm8, %rax + andq %r13, %r15 + addq %r15, %rax + lea 1(%rbp), %r15 + cmpq %r15, %rax + movl %r8d, 48(%rsp) + cmova %rax, %r15 + movl $-262144, 52(%rsp) + testq $1, %r15 + movq %r9, 56(%rsp) + movq %r9, 64(%rsp) + movl %r8d, 72(%rsp) + movl $1, 76(%rsp) + movq %r13, 80(%rsp) + movq %r9, 88(%rsp) + movl %r8d, 8(%rsp) + je ..B2.16 +..B2.15: + movl $-262144, 12(%rsp) + movq %r9, 16(%rsp) + movq %r9, 24(%rsp) + jmp ..B2.17 +..B2.16: + movl $1, 12(%rsp) + movq %r13, 16(%rsp) + movq $0, 24(%rsp) +..B2.17: + movl $2, %esi + lea 144(%rsp), %rdi + lea (%r15,%r15), %rax + movq %rax, 8(%rdi) +..___tag_value___dpml_ux_large_order_bessel__.131: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_large_order_bessel__.132: +..B2.18: + movl 148(%rsp), %ecx + movq %r13, %rax + addl $62, %ecx + shrq %cl, %rax + movq %rbp, (%rsp) + movq %rax, %r13 + movq 40(%rsp), %rbp +..B2.19: + movq %r12, %rdx + lea 120(%rsp), %rdi + lea 144(%rsp), %rsi +..___tag_value___dpml_ux_large_order_bessel__.133: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_large_order_bessel__.134: +..B2.20: + movq %r14, %rdi + movq %r12, %rsi + movq %r12, %rdx +..___tag_value___dpml_ux_large_order_bessel__.135: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_large_order_bessel__.136: +..B2.21: + movq %r12, %rdi + xorl %esi, %esi +..___tag_value___dpml_ux_large_order_bessel__.137: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_large_order_bessel__.138: +..B2.22: + movq %rbp, %rdi + xorl %esi, %esi +..___tag_value___dpml_ux_large_order_bessel__.139: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_large_order_bessel__.140: +..B2.23: + movq %r12, %rdi + movq %rbp, %rsi + movl $1, %edx + movq %r12, %rcx +..___tag_value___dpml_ux_large_order_bessel__.141: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_large_order_bessel__.142: +..B2.24: + decq %r15 + je ..B2.33 +..B2.25: + cmpq (%rsp), %r15 + jne ..B2.27 +..B2.26: + movl (%r12), %r8d + movl 4(%r12), %r9d + movq 8(%r12), %r10 + movq 16(%r12), %r11 + movl %r8d, (%rbx) + movl %r9d, 4(%rbx) + movq %r10, 8(%rbx) + movq %r11, 16(%rbx) +..B2.27: + testq $1, %r15 + jne ..B2.29 +..B2.28: + movq %r12, %rsi + lea 8(%rsp), %rdi + xorl %edx, %edx + movq %rdi, %rcx +..___tag_value___dpml_ux_large_order_bessel__.143: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_large_order_bessel__.144: +..B2.29: + movq %rbp, %r8 + movq %r14, %rbp + movq %r12, %r14 + movq %r8, %r12 + movq 152(%rsp), %r8 + movq $0x8000000000000000, %r9 + subq %r13, %r8 + cmpq %r9, %r8 + jae ..B2.31 +..B2.30: + decl 148(%rsp) + addq %r8, %r8 + addq %r13, %r13 +..B2.31: + movq %r8, 152(%rsp) + jmp ..B2.19 +..B2.32: + call __stack_chk_fail@PLT +..B2.33: + movq %r12, %rdi + lea 8(%rsp), %rsi + xorl %edx, %edx + movq %rsi, %rcx + incl 4(%rsi) +..___tag_value___dpml_ux_large_order_bessel__.145: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_large_order_bessel__.146: +..B2.34: + movq %rbx, %rdi + lea 8(%rsp), %rsi + movl $2, %edx + movq %rbx, %rcx +..___tag_value___dpml_ux_large_order_bessel__.147: + call __dpml_divide__@PLT +..___tag_value___dpml_ux_large_order_bessel__.148: +..B2.35: + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.32 + jmp ..B2.7 +..B2.38: + jne ..B2.40 +..B2.39: + cmpq %rbp, %rax + jb ..B2.9 +..B2.40: + movq %r13, %rdi + xorl %esi, %esi + movq %r15, %rdx + lea 48(%rsp), %rcx +..___tag_value___dpml_ux_large_order_bessel__.149: + call __dpml_ux_bessel__ +..___tag_value___dpml_ux_large_order_bessel__.150: +..B2.41: + movq %r13, %rdi + movl $1, %esi + movq %r15, %rdx + movq %r14, %rcx +..___tag_value___dpml_ux_large_order_bessel__.151: + call __dpml_ux_bessel__ +..___tag_value___dpml_ux_large_order_bessel__.152: +..B2.42: + movq $0x8000000000000000, %r15 + decq %rbp + movq %rbx, (%rsp) + movq %r15, %r13 + movl $0, 144(%rsp) + movl $2, 148(%rsp) + movq %r15, 152(%rsp) + movq $0, 160(%rsp) + movq 40(%rsp), %rbx +..B2.43: + movq %r12, %rdx + lea 120(%rsp), %rdi + lea 144(%rsp), %rsi +..___tag_value___dpml_ux_large_order_bessel__.153: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_large_order_bessel__.154: +..B2.44: + movq %r14, %rdi + movq %r12, %rsi + movq %r12, %rdx +..___tag_value___dpml_ux_large_order_bessel__.155: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_large_order_bessel__.156: +..B2.45: + movq %r12, %rdi + movq %rbx, %rsi + movl $1, %edx + movq %r12, %rcx +..___tag_value___dpml_ux_large_order_bessel__.157: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_large_order_bessel__.158: +..B2.46: + decq %rbp + testq %rbp, %rbp + jle ..B2.50 +..B2.47: + movq %rbx, %rax + movq %r14, %rbx + movq %r12, %r14 + movq %rax, %r12 + movq 152(%rsp), %rax + addq %r13, %rax + cmpq %r13, %rax + jae ..B2.49 +..B2.48: + shrq $1, %rax + incl 148(%rsp) + addq %r15, %rax + shrq $1, %r13 +..B2.49: + movq %rax, 152(%rsp) + jmp ..B2.43 +..B2.50: + movq (%rsp), %rbx + movl (%r12), %eax + movl 4(%r12), %ebp + movq 8(%r12), %r8 + movq 16(%r12), %rdx + movl %eax, (%rbx) + movl %ebp, 4(%rbx) + movq %r8, 8(%rbx) + movq %rdx, 16(%rbx) + movq 168(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + jne ..B2.32 + jmp ..B2.7 +..B2.53: + comisd .L_2il0floatpacket.99(%rip), %xmm2 + jbe ..B2.40 +..B2.54: + movl $65536, %edx + movq $0x080000000, %rax + jmp ..B2.6 + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_large_order_bessel__,@function + .size __dpml_ux_large_order_bessel__,.-__dpml_ux_large_order_bessel__ + .data +# -- End __dpml_ux_large_order_bessel__ + .text +# -- Begin __j0q + .text + .align 16,0x90 + .globl __j0q +__j0q: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___j0q.160: +..L161: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + subq $368, %rsp + .cfi_def_cfa_offset 400 + xorl %esi, %esi + lea __bessel_x_table(%rip), %rcx + lea 48(%rsp), %rdi + movq %fs:40, %rax + lea 304(%rsp), %rdx + xorq %rsp, %rax + lea 336(%rsp), %r8 + movaps %xmm0, (%rdi) + lea (%rsp), %r9 + movq %rax, 48(%rdx) + movq $1, -40(%rdi) + movq $0, (%r9) +..___tag_value___j0q.169: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___j0q.170: +..B3.2: + testq %rax, %rax + jl ..B3.20 +..B3.4: + movl 308(%rsp), %ecx + lea 19544+__bessel_x_table(%rip), %rdi + movq 312(%rsp), %rax + cmpl $5, %ecx + movl $0, 304(%rsp) + jg ..B3.10 +..B3.5: + je ..B3.44 +..B3.6: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + testl %ecx, %ecx + jl ..B3.23 +..B3.7: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B3.8 +..B3.9: + movq 8(%rbx), %rcx + sarq $32, %rcx + andq $1023, %rcx + addq %rcx, %rbx +..B3.8: + cmpq (%rbx), %rax + jbe ..B3.23 + jmp ..B3.9 +..B3.10: + xorl %edi, %edi + lea 304(%rsp), %rsi + movl $2, %edx + lea 160(%rsp), %rcx +..___tag_value___j0q.171: + call __dpml_divide__@PLT +..___tag_value___j0q.172: +..B3.11: + lea 18168+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $9, %edx + movq $0x1000000000000044, %rcx + lea 64(%rsp), %r8 +..___tag_value___j0q.173: + call __dpml_evaluate_rational__@PLT +..___tag_value___j0q.174: +..B3.12: + lea 18504+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $10, %edx + movl $70, %ecx + lea 88(%rsp), %r8 +..___tag_value___j0q.175: + call __dpml_evaluate_rational__@PLT +..___tag_value___j0q.176: +..B3.13: + movl $1, %esi + lea 304(%rsp), %rdi + movl $3, %edx + lea 112(%rsp), %rcx +..___tag_value___j0q.177: + call __dpml_ux_sincos@PLT +..___tag_value___j0q.178: +..B3.14: + lea 64(%rsp), %rdi + movq %rdi, %rdx + lea 112(%rsp), %rsi +..___tag_value___j0q.179: + call __dpml_multiply__@PLT +..___tag_value___j0q.180: +..B3.15: + lea 88(%rsp), %rdi + movq %rdi, %rdx + lea 136(%rsp), %rsi +..___tag_value___j0q.181: + call __dpml_multiply__@PLT +..___tag_value___j0q.182: +..B3.16: + movl $1, %edx + lea 64(%rsp), %rdi + movq %rdi, %rcx + lea 88(%rsp), %rsi +..___tag_value___j0q.183: + call __dpml_addsub__@PLT +..___tag_value___j0q.184: +..B3.17: + movl $1, %esi + lea 160(%rsp), %rdi + lea 88(%rsp), %rdx +..___tag_value___j0q.185: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___j0q.186: +..B3.18: + lea 64(%rsp), %rdi + lea 88(%rsp), %rsi + lea 256(%rsp), %rdx +..___tag_value___j0q.187: + call __dpml_multiply__@PLT +..___tag_value___j0q.188: +..B3.19: + xorl %edx, %edx + lea 256(%rsp), %rdi + xorl %ecx, %ecx + lea 336(%rsp), %rsi + lea (%rsp), %r8 +..___tag_value___j0q.189: + call __dpml_pack__@PLT +..___tag_value___j0q.190: +..B3.20: + movq 352(%rsp), %rax + xorq %rsp, %rax + movaps 336(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B3.46 +..B3.21: + addq $368, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 400 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B3.23: + movq 8(%rbx), %r14 + testq $8388608, %r14 + jne ..B3.25 +..B3.24: + lea 304(%rsp), %r15 + jmp ..B3.28 +..B3.25: + movq 16(%rbx), %rax + lea 304(%rsp), %rdi + movq %rax, -88(%rdi) + lea 208(%rsp), %rsi + movq 24(%rbx), %r8 + movl $1, %edx + movq %r8, 16(%rsi) + lea 184(%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___j0q.202: + call __dpml_addsub__@PLT +..___tag_value___j0q.203: +..B3.26: + movq 32(%rbx), %rax + lea 184(%rsp), %rdi + movq %rax, 32(%rdi) + lea 208(%rsp), %rsi + movq 40(%rbx), %r8 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r8, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___j0q.204: + call __dpml_addsub__@PLT +..___tag_value___j0q.205: +..B3.27: + lea 184(%rsp), %r15 +..B3.28: + movq %r14, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r14 + je ..B3.30 +..B3.29: + movq %r14, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r14, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + lea 256(%rsp), %r9 +..___tag_value___j0q.206: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___j0q.207: + jmp ..B3.31 +..B3.30: + movq %r15, %rdi + movq %rbx, %rsi + movq %r14, %rcx + lea 256(%rsp), %r8 +..___tag_value___j0q.208: + call __dpml_evaluate_rational__@PLT +..___tag_value___j0q.209: +..B3.31: + movq %r14, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B3.33 +..B3.32: + decq %rdx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 280(%rsp), %rsi +..___tag_value___j0q.210: + call __dpml_addsub__@PLT +..___tag_value___j0q.211: +..B3.33: + testq $4194304, %r14 + je ..B3.35 +..B3.34: + movq %r15, %rdi + lea 256(%rsp), %rsi + movq %rsi, %rdx +..___tag_value___j0q.212: + call __dpml_multiply__@PLT +..___tag_value___j0q.213: +..B3.35: + testq $8192, %r14 + je ..B3.37 +..B3.36: + movslq 256(%rsp), %rax + btcq $31, %rax + movl %eax, 256(%rsp) +..B3.37: + testq $2097152, %r14 + je ..B3.19 +..B3.38: + lea 304(%rsp), %rax + cmpq %rax, %r15 + jne ..B3.40 +..B3.39: + sarq $58, %r14 + subl %r14d, 308(%rsp) +..B3.40: + lea 19664+__bessel_x_table(%rip), %rsi + lea 304(%rsp), %rdi + lea 184(%rsp), %rdx +..___tag_value___j0q.214: + call __dpml_ux_log__@PLT +..___tag_value___j0q.215: +..B3.41: + xorl %esi, %esi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 208(%rsp), %rcx +..___tag_value___j0q.216: + call __dpml_ux_bessel__ +..___tag_value___j0q.217: +..B3.42: + lea 184(%rsp), %rsi + movq %rsi, %rdx + lea 208(%rsp), %rdi +..___tag_value___j0q.218: + call __dpml_multiply__@PLT +..___tag_value___j0q.219: +..B3.43: + movl $1, %edx + lea 256(%rsp), %rsi + movq %rsi, %rcx + lea 184(%rsp), %rdi +..___tag_value___j0q.220: + call __dpml_addsub__@PLT +..___tag_value___j0q.221: + jmp ..B3.19 +..B3.44: + cmpq (%rdi), %rax + ja ..B3.10 +..B3.45: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + jmp ..B3.7 +..B3.46: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __j0q,@function + .size __j0q,.-__j0q + .data +# -- End __j0q + .text +# -- Begin __j1q + .text + .align 16,0x90 + .globl __j1q +__j1q: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value___j1q.223: +..L224: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $360, %rsp + .cfi_def_cfa_offset 400 + xorl %esi, %esi + movaps %xmm0, 48(%rsp) + lea 48(%rsp), %rdi + movq 8(%rdi), %rbp + lea 304(%rsp), %rdx + shrq $32, %rbp + lea 8+__bessel_x_table(%rip), %rcx + movq %fs:40, %rax + lea 336(%rsp), %r8 + xorq %rsp, %rax + lea (%rsp), %r9 + movq %rax, 48(%rdx) + andl $-2147483648, %ebp + movq $1, -40(%rdi) + movq $0, (%r9) +..___tag_value___j1q.234: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___j1q.235: +..B4.2: + testq %rax, %rax + jge ..B4.4 +..B4.3: + movq $0x7fff000000000000, %rax + movslq %ebp, %rbp + movq %rax, %rdx + movq 344(%rsp), %rcx + andq %rcx, %rdx + shlq $32, %rbp + orq %rcx, %rbp + cmpq %rdx, %rax + cmovne %rbp, %rcx + movq %rcx, 344(%rsp) + jmp ..B4.20 +..B4.4: + movl 308(%rsp), %ecx + lea 19568+__bessel_x_table(%rip), %rdi + movq 312(%rsp), %rax + cmpl $5, %ecx + movl $0, 304(%rsp) + jg ..B4.10 +..B4.5: + je ..B4.46 +..B4.6: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + testl %ecx, %ecx + jl ..B4.23 +..B4.7: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B4.8 +..B4.9: + movq 8(%rbx), %rcx + sarq $32, %rcx + andq $1023, %rcx + addq %rcx, %rbx +..B4.8: + cmpq (%rbx), %rax + jbe ..B4.23 + jmp ..B4.9 +..B4.10: + xorl %edi, %edi + lea 304(%rsp), %rsi + movl $2, %edx + lea 160(%rsp), %rcx +..___tag_value___j1q.236: + call __dpml_divide__@PLT +..___tag_value___j1q.237: +..B4.11: + lea 18872+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $9, %edx + movq $0x1000000000000044, %rcx + lea 64(%rsp), %r8 +..___tag_value___j1q.238: + call __dpml_evaluate_rational__@PLT +..___tag_value___j1q.239: +..B4.12: + lea 19208+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $9, %edx + movl $70, %ecx + lea 88(%rsp), %r8 +..___tag_value___j1q.240: + call __dpml_evaluate_rational__@PLT +..___tag_value___j1q.241: +..B4.13: + movq $-1, %rsi + lea 304(%rsp), %rdi + movl $3, %edx + lea 112(%rsp), %rcx +..___tag_value___j1q.242: + call __dpml_ux_sincos@PLT +..___tag_value___j1q.243: +..B4.14: + lea 64(%rsp), %rdi + movq %rdi, %rdx + lea 112(%rsp), %rsi +..___tag_value___j1q.244: + call __dpml_multiply__@PLT +..___tag_value___j1q.245: +..B4.15: + lea 88(%rsp), %rdi + movq %rdi, %rdx + lea 136(%rsp), %rsi +..___tag_value___j1q.246: + call __dpml_multiply__@PLT +..___tag_value___j1q.247: +..B4.16: + xorl %edx, %edx + lea 64(%rsp), %rdi + movq %rdi, %rcx + lea 88(%rsp), %rsi +..___tag_value___j1q.248: + call __dpml_addsub__@PLT +..___tag_value___j1q.249: +..B4.17: + movl $1, %esi + lea 160(%rsp), %rdi + lea 88(%rsp), %rdx +..___tag_value___j1q.250: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___j1q.251: +..B4.18: + lea 64(%rsp), %rdi + lea 88(%rsp), %rsi + lea 256(%rsp), %rdx +..___tag_value___j1q.252: + call __dpml_multiply__@PLT +..___tag_value___j1q.253: +..B4.19: + movl $8, %eax + xorl %ecx, %ecx + xorl %ebp, 256(%rsp) + cmovne %eax, %ecx + movl $513, %ebx + lea __bessel_error_codes(%rip), %r8 + shrq %cl, %rbx + lea 256(%rsp), %rdi + movzbl %bl, %ebp + lea 336(%rsp), %rsi + movq (%r8), %rcx + movq (%r8,%rbp,8), %rdx + lea (%rsp), %r8 +..___tag_value___j1q.254: + call __dpml_pack__@PLT +..___tag_value___j1q.255: +..B4.20: + movq 352(%rsp), %rax + xorq %rsp, %rax + movaps 336(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B4.48 +..B4.21: + addq $360, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 400 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 15, -24 +..B4.23: + movq 8(%rbx), %r12 + testq $8388608, %r12 + jne ..B4.25 +..B4.24: + lea 304(%rsp), %r15 + jmp ..B4.28 +..B4.25: + movq 16(%rbx), %rax + lea 304(%rsp), %rdi + movq %rax, -88(%rdi) + lea 208(%rsp), %rsi + movq 24(%rbx), %r8 + movl $1, %edx + movq %r8, 16(%rsi) + lea 184(%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___j1q.270: + call __dpml_addsub__@PLT +..___tag_value___j1q.271: +..B4.26: + movq 32(%rbx), %rax + lea 184(%rsp), %rdi + movq %rax, 32(%rdi) + lea 208(%rsp), %rsi + movq 40(%rbx), %r8 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r8, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___j1q.272: + call __dpml_addsub__@PLT +..___tag_value___j1q.273: +..B4.27: + lea 184(%rsp), %r15 +..B4.28: + movq %r12, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r12 + je ..B4.30 +..B4.29: + movq %r12, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r12, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + lea 256(%rsp), %r9 +..___tag_value___j1q.274: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___j1q.275: + jmp ..B4.31 +..B4.30: + movq %r15, %rdi + movq %rbx, %rsi + movq %r12, %rcx + lea 256(%rsp), %r8 +..___tag_value___j1q.276: + call __dpml_evaluate_rational__@PLT +..___tag_value___j1q.277: +..B4.31: + movq %r12, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B4.33 +..B4.32: + decq %rdx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 280(%rsp), %rsi +..___tag_value___j1q.278: + call __dpml_addsub__@PLT +..___tag_value___j1q.279: +..B4.33: + testq $4194304, %r12 + je ..B4.35 +..B4.34: + movq %r15, %rdi + lea 256(%rsp), %rsi + movq %rsi, %rdx +..___tag_value___j1q.280: + call __dpml_multiply__@PLT +..___tag_value___j1q.281: +..B4.35: + testq $8192, %r12 + je ..B4.37 +..B4.36: + movslq 256(%rsp), %rax + btcq $31, %rax + movl %eax, 256(%rsp) +..B4.37: + testq $2097152, %r12 + je ..B4.19 +..B4.38: + lea 304(%rsp), %rax + cmpq %rax, %r15 + jne ..B4.40 +..B4.39: + sarq $58, %r12 + subl %r12d, 308(%rsp) +..B4.40: + lea 19640+__bessel_x_table(%rip), %rdi + lea 304(%rsp), %rsi + movl $2, %edx + lea 208(%rsp), %rcx +..___tag_value___j1q.282: + call __dpml_divide__@PLT +..___tag_value___j1q.283: +..B4.41: + xorl %edx, %edx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 208(%rsp), %rsi +..___tag_value___j1q.284: + call __dpml_addsub__@PLT +..___tag_value___j1q.285: +..B4.42: + lea 19664+__bessel_x_table(%rip), %rsi + lea 304(%rsp), %rdi + lea 184(%rsp), %rdx +..___tag_value___j1q.286: + call __dpml_ux_log__@PLT +..___tag_value___j1q.287: +..B4.43: + movl $1, %esi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 208(%rsp), %rcx +..___tag_value___j1q.288: + call __dpml_ux_bessel__ +..___tag_value___j1q.289: +..B4.44: + lea 184(%rsp), %rsi + movq %rsi, %rdx + lea 208(%rsp), %rdi +..___tag_value___j1q.290: + call __dpml_multiply__@PLT +..___tag_value___j1q.291: +..B4.45: + movl $1, %edx + lea 256(%rsp), %rsi + movq %rsi, %rcx + lea 184(%rsp), %rdi +..___tag_value___j1q.292: + call __dpml_addsub__@PLT +..___tag_value___j1q.293: + jmp ..B4.19 +..B4.46: + cmpq (%rdi), %rax + ja ..B4.10 +..B4.47: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + jmp ..B4.7 +..B4.48: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __j1q,@function + .size __j1q,.-__j1q + .data +# -- End __j1q + .text +# -- Begin __jnq + .text + .align 16,0x90 + .globl __jnq +__jnq: +# parameter 1: %edi +# parameter 2: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___jnq.295: +..L296: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $368, %rsp + .cfi_def_cfa_offset 416 + movq $0x8000000000000000, %rbp + movaps %xmm0, 48(%rsp) + andq 56(%rsp), %rbp + movslq %edi, %r13 + shrq $32, %rbp + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 352(%rsp) + testq %r13, %r13 + movq $1, 8(%rsp) + movq $0, (%rsp) + jge ..B5.3 +..B5.2: + negq %r13 + xorl $-2147483648, %ebp +..B5.3: + xorl %r12d, %r12d + testq $1, %r13 + lea 48(%rsp), %rdi + cmove %r12d, %ebp + movl $2, %eax + cmpq $2, %r13 + lea __bessel_x_table(%rip), %r12 + cmovle %r13, %rax + xorl %esi, %esi + lea 304(%rsp), %rdx + andl $-2147483648, %ebp + lea 336(%rsp), %r8 + lea (%rsp), %r9 + lea (%r12,%rax,8), %rcx +..___tag_value___jnq.308: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___jnq.309: +..B5.4: + testq %rax, %rax + jge ..B5.6 +..B5.5: + movq $0x7fff000000000000, %rax + movslq %ebp, %rbp + movq %rax, %rdx + movq 344(%rsp), %rcx + andq %rcx, %rdx + shlq $32, %rbp + orq %rcx, %rbp + cmpq %rdx, %rax + cmovne %rbp, %rcx + movq %rcx, 344(%rsp) + jmp ..B5.26 +..B5.6: + movl $0, 304(%rsp) + cmpq $2, %r13 + jge ..B5.56 +..B5.7: + movl 308(%rsp), %ecx + lea (%r13,%r13,2), %r8 + movq 312(%rsp), %rax + cmpl $5, %ecx + jg ..B5.13 +..B5.8: + je ..B5.53 +..B5.9: + movq %r12, %rbx + addq 19552(%r12,%r8,8), %rbx + testl %ecx, %ecx + jl ..B5.29 +..B5.10: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B5.11 +..B5.12: + movq 8(%rbx), %rcx + sarq $32, %rcx + andq $1023, %rcx + addq %rcx, %rbx +..B5.11: + cmpq (%rbx), %rax + jbe ..B5.29 + jmp ..B5.12 +..B5.13: + xorl %edi, %edi + lea 304(%rsp), %rsi + movl $2, %edx + lea 160(%rsp), %rcx +..___tag_value___jnq.310: + call __dpml_divide__@PLT +..___tag_value___jnq.311: +..B5.14: + testq %r13, %r13 + jne ..B5.16 +..B5.15: + movl $10, %r12d + lea 18168+__bessel_x_table(%rip), %rsi + lea 18504+__bessel_x_table(%rip), %rbx + jmp ..B5.17 +..B5.16: + movl $9, %r12d + lea 18872+__bessel_x_table(%rip), %rsi + lea 19208+__bessel_x_table(%rip), %rbx +..B5.17: + movl $9, %edx + lea 160(%rsp), %rdi + movq $0x1000000000000044, %rcx + lea 64(%rsp), %r8 +..___tag_value___jnq.312: + call __dpml_evaluate_rational__@PLT +..___tag_value___jnq.313: +..B5.18: + movq %rbx, %rsi + lea 160(%rsp), %rdi + movq %r12, %rdx + movl $70, %ecx + lea 88(%rsp), %r8 +..___tag_value___jnq.314: + call __dpml_evaluate_rational__@PLT +..___tag_value___jnq.315: +..B5.19: + movl $3, %edx + lea (%r13,%r13), %rsi + negq %rsi + lea 304(%rsp), %rdi + incq %rsi + lea 112(%rsp), %rcx +..___tag_value___jnq.316: + call __dpml_ux_sincos@PLT +..___tag_value___jnq.317: +..B5.20: + lea 64(%rsp), %rdi + movq %rdi, %rdx + lea 112(%rsp), %rsi +..___tag_value___jnq.318: + call __dpml_multiply__@PLT +..___tag_value___jnq.319: +..B5.21: + lea 88(%rsp), %rdi + movq %rdi, %rdx + lea 136(%rsp), %rsi +..___tag_value___jnq.320: + call __dpml_multiply__@PLT +..___tag_value___jnq.321: +..B5.22: + movl $1, %eax + xorl %edx, %edx + testq %r13, %r13 + lea 64(%rsp), %rdi + cmove %rax, %rdx + lea 88(%rsp), %rsi + movq %rdi, %rcx +..___tag_value___jnq.322: + call __dpml_addsub__@PLT +..___tag_value___jnq.323: +..B5.23: + movl $1, %esi + lea 160(%rsp), %rdi + lea 88(%rsp), %rdx +..___tag_value___jnq.324: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___jnq.325: +..B5.24: + lea 64(%rsp), %rdi + lea 88(%rsp), %rsi + lea 256(%rsp), %rdx +..___tag_value___jnq.326: + call __dpml_multiply__@PLT +..___tag_value___jnq.327: +..B5.25: + xorl %ecx, %ecx + movl $8, %eax + xorl %ebp, 256(%rsp) + cmovne %eax, %ecx + movl $1027, %ebx + lea __bessel_error_codes(%rip), %r8 + shrq %cl, %rbx + lea 256(%rsp), %rdi + movzbl %bl, %ebp + lea 336(%rsp), %rsi + movq (%r8), %rcx + movq (%r8,%rbp,8), %rdx + lea (%rsp), %r8 +..___tag_value___jnq.328: + call __dpml_pack__@PLT +..___tag_value___jnq.329: +..B5.26: + movq 352(%rsp), %rax + xorq %rsp, %rax + movaps 336(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B5.55 +..B5.27: + addq $368, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 416 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 15, -32 +..B5.29: + movq 8(%rbx), %r12 + testq $8388608, %r12 + jne ..B5.31 +..B5.30: + lea 304(%rsp), %r15 + jmp ..B5.34 +..B5.31: + movq 16(%rbx), %rax + lea 304(%rsp), %rdi + movq %rax, -88(%rdi) + lea 208(%rsp), %rsi + movq 24(%rbx), %r8 + movl $1, %edx + movq %r8, 16(%rsi) + lea 184(%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___jnq.347: + call __dpml_addsub__@PLT +..___tag_value___jnq.348: +..B5.32: + movq 32(%rbx), %rax + lea 184(%rsp), %rdi + movq %rax, 32(%rdi) + lea 208(%rsp), %rsi + movq 40(%rbx), %r8 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r8, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___jnq.349: + call __dpml_addsub__@PLT +..___tag_value___jnq.350: +..B5.33: + lea 184(%rsp), %r15 +..B5.34: + movq %r12, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r12 + je ..B5.36 +..B5.35: + movq %r12, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r12, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + lea 256(%rsp), %r9 +..___tag_value___jnq.351: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___jnq.352: + jmp ..B5.37 +..B5.36: + movq %r15, %rdi + movq %rbx, %rsi + movq %r12, %rcx + lea 256(%rsp), %r8 +..___tag_value___jnq.353: + call __dpml_evaluate_rational__@PLT +..___tag_value___jnq.354: +..B5.37: + movq %r12, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B5.39 +..B5.38: + decq %rdx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 280(%rsp), %rsi +..___tag_value___jnq.355: + call __dpml_addsub__@PLT +..___tag_value___jnq.356: +..B5.39: + testq $4194304, %r12 + je ..B5.41 +..B5.40: + movq %r15, %rdi + lea 256(%rsp), %rsi + movq %rsi, %rdx +..___tag_value___jnq.357: + call __dpml_multiply__@PLT +..___tag_value___jnq.358: +..B5.41: + testq $8192, %r12 + je ..B5.43 +..B5.42: + movslq 256(%rsp), %rax + btcq $31, %rax + movl %eax, 256(%rsp) +..B5.43: + testq $2097152, %r12 + je ..B5.25 +..B5.44: + lea 304(%rsp), %rax + cmpq %rax, %r15 + jne ..B5.46 +..B5.45: + sarq $58, %r12 + subl %r12d, 308(%rsp) +..B5.46: + cmpq $1, %r13 + je ..B5.51 +..B5.47: + lea 19664+__bessel_x_table(%rip), %rsi + lea 304(%rsp), %rdi + lea 184(%rsp), %rdx +..___tag_value___jnq.359: + call __dpml_ux_log__@PLT +..___tag_value___jnq.360: +..B5.48: + movq %r13, %rsi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 208(%rsp), %rcx +..___tag_value___jnq.361: + call __dpml_ux_bessel__ +..___tag_value___jnq.362: +..B5.49: + lea 184(%rsp), %rsi + movq %rsi, %rdx + lea 208(%rsp), %rdi +..___tag_value___jnq.363: + call __dpml_multiply__@PLT +..___tag_value___jnq.364: +..B5.50: + movl $1, %edx + lea 256(%rsp), %rsi + movq %rsi, %rcx + lea 184(%rsp), %rdi +..___tag_value___jnq.365: + call __dpml_addsub__@PLT +..___tag_value___jnq.366: + jmp ..B5.25 +..B5.51: + lea 19640+__bessel_x_table(%rip), %rdi + lea 304(%rsp), %rsi + movl $2, %edx + lea 208(%rsp), %rcx +..___tag_value___jnq.367: + call __dpml_divide__@PLT +..___tag_value___jnq.368: +..B5.52: + xorl %edx, %edx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 208(%rsp), %rsi +..___tag_value___jnq.369: + call __dpml_addsub__@PLT +..___tag_value___jnq.370: + jmp ..B5.47 +..B5.53: + cmpq 19544(%r12,%r8,8), %rax + ja ..B5.13 +..B5.54: + movq %r12, %rbx + addq 19552(%r12,%r8,8), %rbx + jmp ..B5.10 +..B5.55: + call __stack_chk_fail@PLT +..B5.56: + movq %r13, %rsi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 256(%rsp), %rcx +..___tag_value___jnq.371: + call __dpml_ux_large_order_bessel__ +..___tag_value___jnq.372: + jmp ..B5.25 + .align 16,0x90 + .cfi_endproc + .type __jnq,@function + .size __jnq,.-__jnq + .data +# -- End __jnq + .text +# -- Begin __y0q + .text + .align 16,0x90 + .globl __y0q +__y0q: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value___y0q.374: +..L375: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + subq $368, %rsp + .cfi_def_cfa_offset 400 + xorl %esi, %esi + lea 40+__bessel_x_table(%rip), %rcx + lea 48(%rsp), %rdi + movq %fs:40, %rax + lea 304(%rsp), %rdx + xorq %rsp, %rax + lea 336(%rsp), %r8 + movaps %xmm0, (%rdi) + lea (%rsp), %r9 + movq %rax, 48(%rdx) + movq $1, -40(%rdi) + movq $0, (%r9) +..___tag_value___y0q.383: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___y0q.384: +..B6.2: + testq %rax, %rax + jl ..B6.20 +..B6.4: + movl 308(%rsp), %ecx + lea 19592+__bessel_x_table(%rip), %rdi + movq 312(%rsp), %rax + cmpl $5, %ecx + movl $0, 304(%rsp) + jg ..B6.10 +..B6.5: + je ..B6.44 +..B6.6: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + testl %ecx, %ecx + jl ..B6.23 +..B6.7: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B6.8 +..B6.9: + movq 8(%rbx), %rcx + sarq $32, %rcx + andq $1023, %rcx + addq %rcx, %rbx +..B6.8: + cmpq (%rbx), %rax + jbe ..B6.23 + jmp ..B6.9 +..B6.10: + xorl %edi, %edi + lea 304(%rsp), %rsi + movl $2, %edx + lea 160(%rsp), %rcx +..___tag_value___y0q.385: + call __dpml_divide__@PLT +..___tag_value___y0q.386: +..B6.11: + lea 18168+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $9, %edx + movq $0x1000000000000044, %rcx + lea 64(%rsp), %r8 +..___tag_value___y0q.387: + call __dpml_evaluate_rational__@PLT +..___tag_value___y0q.388: +..B6.12: + lea 18504+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $10, %edx + movl $70, %ecx + lea 88(%rsp), %r8 +..___tag_value___y0q.389: + call __dpml_evaluate_rational__@PLT +..___tag_value___y0q.390: +..B6.13: + movq $-1, %rsi + lea 304(%rsp), %rdi + movl $3, %edx + lea 112(%rsp), %rcx +..___tag_value___y0q.391: + call __dpml_ux_sincos@PLT +..___tag_value___y0q.392: +..B6.14: + lea 64(%rsp), %rdi + movq %rdi, %rdx + lea 112(%rsp), %rsi +..___tag_value___y0q.393: + call __dpml_multiply__@PLT +..___tag_value___y0q.394: +..B6.15: + lea 88(%rsp), %rdi + movq %rdi, %rdx + lea 136(%rsp), %rsi +..___tag_value___y0q.395: + call __dpml_multiply__@PLT +..___tag_value___y0q.396: +..B6.16: + movl $1, %edx + lea 64(%rsp), %rdi + movq %rdi, %rcx + lea 88(%rsp), %rsi +..___tag_value___y0q.397: + call __dpml_addsub__@PLT +..___tag_value___y0q.398: +..B6.17: + movl $1, %esi + lea 160(%rsp), %rdi + lea 88(%rsp), %rdx +..___tag_value___y0q.399: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___y0q.400: +..B6.18: + lea 64(%rsp), %rdi + lea 88(%rsp), %rsi + lea 256(%rsp), %rdx +..___tag_value___y0q.401: + call __dpml_multiply__@PLT +..___tag_value___y0q.402: +..B6.19: + xorl %edx, %edx + lea 256(%rsp), %rdi + xorl %ecx, %ecx + lea 336(%rsp), %rsi + lea (%rsp), %r8 +..___tag_value___y0q.403: + call __dpml_pack__@PLT +..___tag_value___y0q.404: +..B6.20: + movq 352(%rsp), %rax + xorq %rsp, %rax + movaps 336(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B6.46 +..B6.21: + addq $368, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 400 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B6.23: + movq 8(%rbx), %r14 + testq $8388608, %r14 + jne ..B6.25 +..B6.24: + lea 304(%rsp), %r15 + jmp ..B6.28 +..B6.25: + movq 16(%rbx), %rax + lea 304(%rsp), %rdi + movq %rax, -88(%rdi) + lea 208(%rsp), %rsi + movq 24(%rbx), %r8 + movl $1, %edx + movq %r8, 16(%rsi) + lea 184(%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___y0q.416: + call __dpml_addsub__@PLT +..___tag_value___y0q.417: +..B6.26: + movq 32(%rbx), %rax + lea 184(%rsp), %rdi + movq %rax, 32(%rdi) + lea 208(%rsp), %rsi + movq 40(%rbx), %r8 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r8, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___y0q.418: + call __dpml_addsub__@PLT +..___tag_value___y0q.419: +..B6.27: + lea 184(%rsp), %r15 +..B6.28: + movq %r14, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r14 + je ..B6.30 +..B6.29: + movq %r14, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r14, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + lea 256(%rsp), %r9 +..___tag_value___y0q.420: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___y0q.421: + jmp ..B6.31 +..B6.30: + movq %r15, %rdi + movq %rbx, %rsi + movq %r14, %rcx + lea 256(%rsp), %r8 +..___tag_value___y0q.422: + call __dpml_evaluate_rational__@PLT +..___tag_value___y0q.423: +..B6.31: + movq %r14, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B6.33 +..B6.32: + decq %rdx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 280(%rsp), %rsi +..___tag_value___y0q.424: + call __dpml_addsub__@PLT +..___tag_value___y0q.425: +..B6.33: + testq $4194304, %r14 + je ..B6.35 +..B6.34: + movq %r15, %rdi + lea 256(%rsp), %rsi + movq %rsi, %rdx +..___tag_value___y0q.426: + call __dpml_multiply__@PLT +..___tag_value___y0q.427: +..B6.35: + testq $8192, %r14 + je ..B6.37 +..B6.36: + movslq 256(%rsp), %rax + btcq $31, %rax + movl %eax, 256(%rsp) +..B6.37: + testq $2097152, %r14 + je ..B6.19 +..B6.38: + lea 304(%rsp), %rax + cmpq %rax, %r15 + jne ..B6.40 +..B6.39: + sarq $58, %r14 + subl %r14d, 308(%rsp) +..B6.40: + lea 19664+__bessel_x_table(%rip), %rsi + lea 304(%rsp), %rdi + lea 184(%rsp), %rdx +..___tag_value___y0q.428: + call __dpml_ux_log__@PLT +..___tag_value___y0q.429: +..B6.41: + xorl %esi, %esi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 208(%rsp), %rcx +..___tag_value___y0q.430: + call __dpml_ux_bessel__ +..___tag_value___y0q.431: +..B6.42: + lea 184(%rsp), %rsi + movq %rsi, %rdx + lea 208(%rsp), %rdi +..___tag_value___y0q.432: + call __dpml_multiply__@PLT +..___tag_value___y0q.433: +..B6.43: + movl $1, %edx + lea 256(%rsp), %rsi + movq %rsi, %rcx + lea 184(%rsp), %rdi +..___tag_value___y0q.434: + call __dpml_addsub__@PLT +..___tag_value___y0q.435: + jmp ..B6.19 +..B6.44: + cmpq (%rdi), %rax + ja ..B6.10 +..B6.45: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + jmp ..B6.7 +..B6.46: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __y0q,@function + .size __y0q,.-__y0q + .data +# -- End __y0q + .text +# -- Begin __y1q + .text + .align 16,0x90 + .globl __y1q +__y1q: +# parameter 1: %xmm0 +..B7.1: + .cfi_startproc +..___tag_value___y1q.437: +..L438: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $360, %rsp + .cfi_def_cfa_offset 400 + xorl %esi, %esi + movaps %xmm0, 48(%rsp) + lea 48(%rsp), %rdi + movq 8(%rdi), %rbp + lea 304(%rsp), %rdx + shrq $32, %rbp + lea 48+__bessel_x_table(%rip), %rcx + movq %fs:40, %rax + lea 336(%rsp), %r8 + xorq %rsp, %rax + lea (%rsp), %r9 + movq %rax, 48(%rdx) + andl $-2147483648, %ebp + movq $1, -40(%rdi) + movq $0, (%r9) +..___tag_value___y1q.448: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___y1q.449: +..B7.2: + testq %rax, %rax + jge ..B7.4 +..B7.3: + movq $0x7fff000000000000, %rax + movslq %ebp, %rbp + movq %rax, %rdx + movq 344(%rsp), %rcx + andq %rcx, %rdx + shlq $32, %rbp + orq %rcx, %rbp + cmpq %rdx, %rax + cmovne %rbp, %rcx + movq %rcx, 344(%rsp) + jmp ..B7.20 +..B7.4: + movl 308(%rsp), %ecx + lea 19616+__bessel_x_table(%rip), %rdi + movq 312(%rsp), %rax + cmpl $5, %ecx + movl $0, 304(%rsp) + jg ..B7.10 +..B7.5: + je ..B7.46 +..B7.6: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + testl %ecx, %ecx + jl ..B7.23 +..B7.7: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B7.8 +..B7.9: + movq 8(%rbx), %rcx + sarq $32, %rcx + andq $1023, %rcx + addq %rcx, %rbx +..B7.8: + cmpq (%rbx), %rax + jbe ..B7.23 + jmp ..B7.9 +..B7.10: + xorl %edi, %edi + lea 304(%rsp), %rsi + movl $2, %edx + lea 160(%rsp), %rcx +..___tag_value___y1q.450: + call __dpml_divide__@PLT +..___tag_value___y1q.451: +..B7.11: + lea 18872+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $9, %edx + movq $0x1000000000000044, %rcx + lea 64(%rsp), %r8 +..___tag_value___y1q.452: + call __dpml_evaluate_rational__@PLT +..___tag_value___y1q.453: +..B7.12: + lea 19208+__bessel_x_table(%rip), %rsi + lea 160(%rsp), %rdi + movl $9, %edx + movl $70, %ecx + lea 88(%rsp), %r8 +..___tag_value___y1q.454: + call __dpml_evaluate_rational__@PLT +..___tag_value___y1q.455: +..B7.13: + movq $-3, %rsi + lea 304(%rsp), %rdi + movl $3, %edx + lea 112(%rsp), %rcx +..___tag_value___y1q.456: + call __dpml_ux_sincos@PLT +..___tag_value___y1q.457: +..B7.14: + lea 64(%rsp), %rdi + movq %rdi, %rdx + lea 112(%rsp), %rsi +..___tag_value___y1q.458: + call __dpml_multiply__@PLT +..___tag_value___y1q.459: +..B7.15: + lea 88(%rsp), %rdi + movq %rdi, %rdx + lea 136(%rsp), %rsi +..___tag_value___y1q.460: + call __dpml_multiply__@PLT +..___tag_value___y1q.461: +..B7.16: + xorl %edx, %edx + lea 64(%rsp), %rdi + movq %rdi, %rcx + lea 88(%rsp), %rsi +..___tag_value___y1q.462: + call __dpml_addsub__@PLT +..___tag_value___y1q.463: +..B7.17: + movl $1, %esi + lea 160(%rsp), %rdi + lea 88(%rsp), %rdx +..___tag_value___y1q.464: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___y1q.465: +..B7.18: + lea 64(%rsp), %rdi + lea 88(%rsp), %rsi + lea 256(%rsp), %rdx +..___tag_value___y1q.466: + call __dpml_multiply__@PLT +..___tag_value___y1q.467: +..B7.19: + movl $24, %eax + movl $16, %ecx + xorl %ebp, 256(%rsp) + cmovne %eax, %ecx + movl $83886080, %ebx + lea __bessel_error_codes(%rip), %rbp + shrq %cl, %rbx + lea 256(%rsp), %rdi + movzbl %bl, %r8d + lea 336(%rsp), %rsi + movq (%rbp), %rdx + movq (%rbp,%r8,8), %rcx + lea (%rsp), %r8 +..___tag_value___y1q.468: + call __dpml_pack__@PLT +..___tag_value___y1q.469: +..B7.20: + movq 352(%rsp), %rax + xorq %rsp, %rax + movaps 336(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B7.48 +..B7.21: + addq $360, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 400 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 15, -24 +..B7.23: + movq 8(%rbx), %r12 + testq $8388608, %r12 + jne ..B7.25 +..B7.24: + lea 304(%rsp), %r15 + jmp ..B7.28 +..B7.25: + movq 16(%rbx), %rax + lea 304(%rsp), %rdi + movq %rax, -88(%rdi) + lea 208(%rsp), %rsi + movq 24(%rbx), %r8 + movl $1, %edx + movq %r8, 16(%rsi) + lea 184(%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___y1q.484: + call __dpml_addsub__@PLT +..___tag_value___y1q.485: +..B7.26: + movq 32(%rbx), %rax + lea 184(%rsp), %rdi + movq %rax, 32(%rdi) + lea 208(%rsp), %rsi + movq 40(%rbx), %r8 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r8, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___y1q.486: + call __dpml_addsub__@PLT +..___tag_value___y1q.487: +..B7.27: + lea 184(%rsp), %r15 +..B7.28: + movq %r12, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r12 + je ..B7.30 +..B7.29: + movq %r12, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r12, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + lea 256(%rsp), %r9 +..___tag_value___y1q.488: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___y1q.489: + jmp ..B7.31 +..B7.30: + movq %r15, %rdi + movq %rbx, %rsi + movq %r12, %rcx + lea 256(%rsp), %r8 +..___tag_value___y1q.490: + call __dpml_evaluate_rational__@PLT +..___tag_value___y1q.491: +..B7.31: + movq %r12, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B7.33 +..B7.32: + decq %rdx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 280(%rsp), %rsi +..___tag_value___y1q.492: + call __dpml_addsub__@PLT +..___tag_value___y1q.493: +..B7.33: + testq $4194304, %r12 + je ..B7.35 +..B7.34: + movq %r15, %rdi + lea 256(%rsp), %rsi + movq %rsi, %rdx +..___tag_value___y1q.494: + call __dpml_multiply__@PLT +..___tag_value___y1q.495: +..B7.35: + testq $8192, %r12 + je ..B7.37 +..B7.36: + movslq 256(%rsp), %rax + btcq $31, %rax + movl %eax, 256(%rsp) +..B7.37: + testq $2097152, %r12 + je ..B7.19 +..B7.38: + lea 304(%rsp), %rax + cmpq %rax, %r15 + jne ..B7.40 +..B7.39: + sarq $58, %r12 + subl %r12d, 308(%rsp) +..B7.40: + lea 19640+__bessel_x_table(%rip), %rdi + lea 304(%rsp), %rsi + movl $2, %edx + lea 208(%rsp), %rcx +..___tag_value___y1q.496: + call __dpml_divide__@PLT +..___tag_value___y1q.497: +..B7.41: + xorl %edx, %edx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 208(%rsp), %rsi +..___tag_value___y1q.498: + call __dpml_addsub__@PLT +..___tag_value___y1q.499: +..B7.42: + lea 19664+__bessel_x_table(%rip), %rsi + lea 304(%rsp), %rdi + lea 184(%rsp), %rdx +..___tag_value___y1q.500: + call __dpml_ux_log__@PLT +..___tag_value___y1q.501: +..B7.43: + movl $1, %esi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 208(%rsp), %rcx +..___tag_value___y1q.502: + call __dpml_ux_bessel__ +..___tag_value___y1q.503: +..B7.44: + lea 184(%rsp), %rsi + movq %rsi, %rdx + lea 208(%rsp), %rdi +..___tag_value___y1q.504: + call __dpml_multiply__@PLT +..___tag_value___y1q.505: +..B7.45: + movl $1, %edx + lea 256(%rsp), %rsi + movq %rsi, %rcx + lea 184(%rsp), %rdi +..___tag_value___y1q.506: + call __dpml_addsub__@PLT +..___tag_value___y1q.507: + jmp ..B7.19 +..B7.46: + cmpq (%rdi), %rax + ja ..B7.10 +..B7.47: + lea __bessel_x_table(%rip), %rbx + addq 8(%rdi), %rbx + jmp ..B7.7 +..B7.48: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __y1q,@function + .size __y1q,.-__y1q + .data +# -- End __y1q + .text +# -- Begin __ynq + .text + .align 16,0x90 + .globl __ynq +__ynq: +# parameter 1: %edi +# parameter 2: %xmm0 +..B8.1: + .cfi_startproc +..___tag_value___ynq.509: +..L510: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $368, %rsp + .cfi_def_cfa_offset 416 + movq $0x8000000000000000, %rdx + movaps %xmm0, 48(%rsp) + andq 56(%rsp), %rdx + movslq %edi, %r14 + shrq $32, %rdx + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 352(%rsp) + lea 40+__bessel_x_table(%rip), %rax + testq %r14, %r14 + movq $1, 8(%rsp) + movq $0, (%rsp) + jge ..B8.3 +..B8.2: + negq %r14 + xorl $-2147483648, %edx +..B8.3: + xorl %ebp, %ebp + testq $1, %r14 + lea 48(%rsp), %rdi + cmovne %edx, %ebp + movl $2, %ebx + cmpq $2, %r14 + lea 304(%rsp), %rdx + cmovle %r14, %rbx + xorl %esi, %esi + lea 336(%rsp), %r8 + andl $-2147483648, %ebp + lea (%rsp), %r9 + lea (%rax,%rbx,8), %rcx +..___tag_value___ynq.522: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___ynq.523: +..B8.4: + testq %rax, %rax + jge ..B8.6 +..B8.5: + movq $0x7fff000000000000, %rax + movslq %ebp, %rbp + movq %rax, %rdx + movq 344(%rsp), %rcx + andq %rcx, %rdx + shlq $32, %rbp + orq %rcx, %rbp + cmpq %rdx, %rax + cmovne %rbp, %rcx + movq %rcx, 344(%rsp) + jmp ..B8.26 +..B8.6: + movl $0, 304(%rsp) + cmpq $2, %r14 + jge ..B8.56 +..B8.7: + movl 308(%rsp), %ecx + lea (%r14,%r14,2), %r9 + movq 312(%rsp), %rax + lea __bessel_x_table(%rip), %r8 + cmpl $5, %ecx + jg ..B8.13 +..B8.8: + je ..B8.53 +..B8.9: + movq %r8, %rbx + addq 19600(%r8,%r9,8), %rbx + testl %ecx, %ecx + jl ..B8.29 +..B8.10: + negl %ecx + addl $5, %ecx + shrq %cl, %rax + jmp ..B8.11 +..B8.12: + movq 8(%rbx), %rcx + sarq $32, %rcx + andq $1023, %rcx + addq %rcx, %rbx +..B8.11: + cmpq (%rbx), %rax + jbe ..B8.29 + jmp ..B8.12 +..B8.13: + xorl %edi, %edi + lea 304(%rsp), %rsi + movl $2, %edx + lea 160(%rsp), %rcx +..___tag_value___ynq.524: + call __dpml_divide__@PLT +..___tag_value___ynq.525: +..B8.14: + testq %r14, %r14 + jne ..B8.16 +..B8.15: + movl $10, %r13d + lea 18168+__bessel_x_table(%rip), %rsi + lea 18504+__bessel_x_table(%rip), %rbx + jmp ..B8.17 +..B8.16: + movl $9, %r13d + lea 18872+__bessel_x_table(%rip), %rsi + lea 19208+__bessel_x_table(%rip), %rbx +..B8.17: + movl $9, %edx + lea 160(%rsp), %rdi + movq $0x1000000000000044, %rcx + lea 64(%rsp), %r8 +..___tag_value___ynq.526: + call __dpml_evaluate_rational__@PLT +..___tag_value___ynq.527: +..B8.18: + movq %rbx, %rsi + lea 160(%rsp), %rdi + movq %r13, %rdx + movl $70, %ecx + lea 88(%rsp), %r8 +..___tag_value___ynq.528: + call __dpml_evaluate_rational__@PLT +..___tag_value___ynq.529: +..B8.19: + movl $3, %edx + lea (%r14,%r14), %rsi + negq %rsi + lea 304(%rsp), %rdi + decq %rsi + lea 112(%rsp), %rcx +..___tag_value___ynq.530: + call __dpml_ux_sincos@PLT +..___tag_value___ynq.531: +..B8.20: + lea 64(%rsp), %rdi + movq %rdi, %rdx + lea 112(%rsp), %rsi +..___tag_value___ynq.532: + call __dpml_multiply__@PLT +..___tag_value___ynq.533: +..B8.21: + lea 88(%rsp), %rdi + movq %rdi, %rdx + lea 136(%rsp), %rsi +..___tag_value___ynq.534: + call __dpml_multiply__@PLT +..___tag_value___ynq.535: +..B8.22: + movl $1, %eax + xorl %edx, %edx + testq %r14, %r14 + lea 64(%rsp), %rdi + cmove %rax, %rdx + lea 88(%rsp), %rsi + movq %rdi, %rcx +..___tag_value___ynq.536: + call __dpml_addsub__@PLT +..___tag_value___ynq.537: +..B8.23: + movl $1, %esi + lea 160(%rsp), %rdi + lea 88(%rsp), %rdx +..___tag_value___ynq.538: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___ynq.539: +..B8.24: + lea 64(%rsp), %rdi + lea 88(%rsp), %rsi + lea 256(%rsp), %rdx +..___tag_value___ynq.540: + call __dpml_multiply__@PLT +..___tag_value___ynq.541: +..B8.25: + movl $24, %eax + movl $16, %ecx + xorl %ebp, 256(%rsp) + cmovne %eax, %ecx + movl $117833728, %ebx + lea __bessel_error_codes(%rip), %rbp + shrq %cl, %rbx + lea 256(%rsp), %rdi + movzbl %bl, %r8d + lea 336(%rsp), %rsi + movq (%rbp), %rdx + movq (%rbp,%r8,8), %rcx + lea (%rsp), %r8 +..___tag_value___ynq.542: + call __dpml_pack__@PLT +..___tag_value___ynq.543: +..B8.26: + movq 352(%rsp), %rax + xorq %rsp, %rax + movaps 336(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B8.55 +..B8.27: + addq $368, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 416 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B8.29: + movq 8(%rbx), %r13 + testq $8388608, %r13 + jne ..B8.31 +..B8.30: + lea 304(%rsp), %r15 + jmp ..B8.34 +..B8.31: + movq 16(%rbx), %rax + lea 304(%rsp), %rdi + movq %rax, -88(%rdi) + lea 208(%rsp), %rsi + movq 24(%rbx), %r8 + movl $1, %edx + movq %r8, 16(%rsi) + lea 184(%rsp), %rcx + movl $0, 24(%rcx) + movl 40(%rbx), %r15d + andl $7, %r15d + movl %r15d, 28(%rcx) +..___tag_value___ynq.561: + call __dpml_addsub__@PLT +..___tag_value___ynq.562: +..B8.32: + movq 32(%rbx), %rax + lea 184(%rsp), %rdi + movq %rax, 32(%rdi) + lea 208(%rsp), %rsi + movq 40(%rbx), %r8 + movl $1, %edx + movq %rdi, %rcx + addl $-128, %r15d + movq %r8, 16(%rsi) + movl %r15d, 4(%rsi) +..___tag_value___ynq.563: + call __dpml_addsub__@PLT +..___tag_value___ynq.564: +..B8.33: + lea 184(%rsp), %r15 +..B8.34: + movq %r13, %rdx + addq $48, %rbx + sarq $14, %rdx + andq $127, %rdx + testq $16777216, %r13 + je ..B8.36 +..B8.35: + movq %r13, %rcx + movl $1, %eax + shrq $7, %rcx + movq %r13, %r8 + andq $127, %r8 + movq %r15, %rdi + shlq %cl, %rax + movq %rdx, %rsi + decq %rax + movq %rbx, %rdx + movq %rax, %rcx + lea 256(%rsp), %r9 +..___tag_value___ynq.565: + call __dpml_evaluate_packed_poly__@PLT +..___tag_value___ynq.566: + jmp ..B8.37 +..B8.36: + movq %r15, %rdi + movq %rbx, %rsi + movq %r13, %rcx + lea 256(%rsp), %r8 +..___tag_value___ynq.567: + call __dpml_evaluate_rational__@PLT +..___tag_value___ynq.568: +..B8.37: + movq %r13, %rdx + sarq $11, %rdx + andq $3, %rdx + je ..B8.39 +..B8.38: + decq %rdx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 280(%rsp), %rsi +..___tag_value___ynq.569: + call __dpml_addsub__@PLT +..___tag_value___ynq.570: +..B8.39: + testq $4194304, %r13 + je ..B8.41 +..B8.40: + movq %r15, %rdi + lea 256(%rsp), %rsi + movq %rsi, %rdx +..___tag_value___ynq.571: + call __dpml_multiply__@PLT +..___tag_value___ynq.572: +..B8.41: + testq $8192, %r13 + je ..B8.43 +..B8.42: + movslq 256(%rsp), %rax + btcq $31, %rax + movl %eax, 256(%rsp) +..B8.43: + testq $2097152, %r13 + je ..B8.25 +..B8.44: + lea 304(%rsp), %rax + cmpq %rax, %r15 + jne ..B8.46 +..B8.45: + sarq $58, %r13 + subl %r13d, 308(%rsp) +..B8.46: + cmpq $1, %r14 + je ..B8.51 +..B8.47: + lea 19664+__bessel_x_table(%rip), %rsi + lea 304(%rsp), %rdi + lea 184(%rsp), %rdx +..___tag_value___ynq.573: + call __dpml_ux_log__@PLT +..___tag_value___ynq.574: +..B8.48: + movq %r14, %rsi + lea 304(%rsp), %rdi + xorl %edx, %edx + lea 208(%rsp), %rcx +..___tag_value___ynq.575: + call __dpml_ux_bessel__ +..___tag_value___ynq.576: +..B8.49: + lea 184(%rsp), %rsi + movq %rsi, %rdx + lea 208(%rsp), %rdi +..___tag_value___ynq.577: + call __dpml_multiply__@PLT +..___tag_value___ynq.578: +..B8.50: + movl $1, %edx + lea 256(%rsp), %rsi + movq %rsi, %rcx + lea 184(%rsp), %rdi +..___tag_value___ynq.579: + call __dpml_addsub__@PLT +..___tag_value___ynq.580: + jmp ..B8.25 +..B8.51: + lea 19640+__bessel_x_table(%rip), %rdi + lea 304(%rsp), %rsi + movl $2, %edx + lea 208(%rsp), %rcx +..___tag_value___ynq.581: + call __dpml_divide__@PLT +..___tag_value___ynq.582: +..B8.52: + xorl %edx, %edx + lea 256(%rsp), %rdi + movq %rdi, %rcx + lea 208(%rsp), %rsi +..___tag_value___ynq.583: + call __dpml_addsub__@PLT +..___tag_value___ynq.584: + jmp ..B8.47 +..B8.53: + cmpq 19592(%r8,%r9,8), %rax + ja ..B8.13 +..B8.54: + movq %r8, %rbx + addq 19600(%r8,%r9,8), %rbx + jmp ..B8.10 +..B8.55: + call __stack_chk_fail@PLT +..B8.56: + movq %r14, %rsi + lea 304(%rsp), %rdi + movl $2, %edx + lea 256(%rsp), %rcx +..___tag_value___ynq.585: + call __dpml_ux_large_order_bessel__ +..___tag_value___ynq.586: + jmp ..B8.25 + .align 16,0x90 + .cfi_endproc + .type __ynq,@function + .size __ynq,.-__ynq + .data +# -- End __ynq + .section .rodata, "a" + .align 16 + .align 16 +__bessel_x_table: + .long 4527112 + .long 882002208 + .long 4527112 + .long 609222656 + .long 4527112 + .long 340787200 + .long 0 + .long 0 + .long 2 + .long 0 + .long 2162758664 + .long 1056696334 + .long 15799304 + .long 796782607 + .long 2163807240 + .long 536868879 + .long 0 + .long 0 + .long 136 + .long 0 + .long 137 + .long 0 + .long 138 + .long 0 + .long 139 + .long 0 + .long 141 + .long 0 + .long 142 + .long 0 + .long 2943289511 + .long 514282869 + .long 12841452 + .long 4160750144 + .long 3101294049 + .long 2582161780 + .long 1312087176 + .long 1489306811 + .long 19644348 + .long 45583118 + .long 2057404378 + .long 3169098683 + .long 3035415578 + .long 893843444 + .long 337 + .long 0 + .long 1783633315 + .long 1777532950 + .long 15440 + .long 0 + .long 1098024042 + .long 3019602458 + .long 814258 + .long 0 + .long 225592541 + .long 3983311110 + .long 37212291 + .long 0 + .long 2852953733 + .long 2839658485 + .long 1458597808 + .long 0 + .long 4135355606 + .long 2153351721 + .long 1172250754 + .long 11 + .long 1418543880 + .long 1134849789 + .long 691229967 + .long 312 + .long 221999422 + .long 2942275987 + .long 892175906 + .long 7082 + .long 183528404 + .long 1091137495 + .long 33669418 + .long 128779 + .long 2062842702 + .long 3593466159 + .long 2350547321 + .long 1825862 + .long 3242024385 + .long 1732973365 + .long 1193716022 + .long 19485117 + .long 1037993584 + .long 3230003709 + .long 1091314384 + .long 149320065 + .long 865418991 + .long 2685299556 + .long 265703573 + .long 769292094 + .long 699915261 + .long 300027119 + .long 1754654657 + .long 2412548808 + .long 1339780591 + .long 830077839 + .long 3026944889 + .long 3889644321 + .long 4103150545 + .long 428322165 + .long 2828272473 + .long 2229721522 + .long 2 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 367384380 + .long 4326353 + .long 2148 + .long 0 + .long 3463681883 + .long 689773508 + .long 115915 + .long 0 + .long 1865635225 + .long 1707083401 + .long 5659280 + .long 0 + .long 57566505 + .long 2904667094 + .long 238211523 + .long 0 + .long 2506436672 + .long 4038967033 + .long 4242689712 + .long 1 + .long 900230770 + .long 2061385255 + .long 3485051853 + .long 59 + .long 3028033191 + .long 3312441247 + .long 2225862006 + .long 1485 + .long 2615755381 + .long 2826778077 + .long 1673380806 + .long 29835 + .long 355106258 + .long 2404984212 + .long 1016211595 + .long 472327 + .long 1503440334 + .long 2187913929 + .long 749248049 + .long 5704462 + .long 3147631426 + .long 2675016444 + .long 3447985920 + .long 50328354 + .long 3866449770 + .long 2131485908 + .long 579515915 + .long 305317757 + .long 1140039843 + .long 2720631446 + .long 456203296 + .long 1162742504 + .long 3233022265 + .long 2052397230 + .long 3523447208 + .long 2379802096 + .long 4168515076 + .long 4109278998 + .long 173166154 + .long 1854372776 + .long 2 + .long 0 + .long 1759813577 + .long 941616103 + .long 12816876 + .long 4227858976 + .long 1634871482 + .long 2963569369 + .long 683137648 + .long 2191944453 + .long 1580116130 + .long 3956925442 + .long 2076563715 + .long 714524096 + .long 1425042529 + .long 556010 + .long 0 + .long 0 + .long 2705967279 + .long 111702325 + .long 0 + .long 0 + .long 3713308765 + .long 3252247564 + .long 4 + .long 0 + .long 2100681787 + .long 1255672466 + .long 747 + .long 0 + .long 3619987580 + .long 2926178414 + .long 99420 + .long 0 + .long 2512861058 + .long 4217543322 + .long 11034432 + .long 0 + .long 2336326559 + .long 4282922616 + .long 1003296232 + .long 0 + .long 961767164 + .long 880412311 + .long 74952366 + .long 17 + .long 651638352 + .long 3978983768 + .long 3866178891 + .long 965 + .long 1596163871 + .long 1924711161 + .long 2529806704 + .long 41195 + .long 4143448985 + .long 965000726 + .long 2579935101 + .long 1257069 + .long 3252814079 + .long 2428688082 + .long 440599394 + .long 25575240 + .long 2037391762 + .long 3718324471 + .long 2593618161 + .long 310260222 + .long 3513168611 + .long 3970741434 + .long 128123702 + .long 1820672813 + .long 3402733470 + .long 3892867495 + .long 1270945360 + .long 2922852432 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1986947947 + .long 53265381 + .long 0 + .long 0 + .long 3270284272 + .long 1932314788 + .long 2 + .long 0 + .long 4084347788 + .long 3083682757 + .long 409 + .long 0 + .long 2552809164 + .long 4060325593 + .long 58254 + .long 0 + .long 3829133869 + .long 1310009699 + .long 6940915 + .long 0 + .long 3083277873 + .long 3078742755 + .long 680947971 + .long 0 + .long 3385783917 + .long 3611832980 + .long 2295622592 + .long 12 + .long 3171596108 + .long 2891115348 + .long 838843771 + .long 777 + .long 3771422218 + .long 1148182025 + .long 434950258 + .long 36482 + .long 393135174 + .long 80483983 + .long 3817092537 + .long 1235511 + .long 594123027 + .long 65162621 + .long 1218473398 + .long 28145623 + .long 3536617861 + .long 375824456 + .long 425129817 + .long 385237492 + .long 633237591 + .long 649365651 + .long 313906709 + .long 2545942344 + .long 873029334 + .long 423671385 + .long 1111949612 + .long 4235958077 + .long 4294967293 + .long 0 + .long 4159743234 + .long 1365459778 + .long 12825068 + .long 4227858976 + .long 1727418030 + .long 2322967398 + .long 1034782148 + .long 1761143608 + .long 748103118 + .long 681764742 + .long 1945985884 + .long 1037518188 + .long 2731139269 + .long 559058 + .long 0 + .long 0 + .long 3638286185 + .long 115784543 + .long 0 + .long 0 + .long 484918398 + .long 4013875548 + .long 4 + .long 0 + .long 868380236 + .long 106340102 + .long 775 + .long 0 + .long 3771022282 + .long 1666157217 + .long 103048 + .long 0 + .long 470645992 + .long 2100027425 + .long 11422638 + .long 0 + .long 1279250702 + .long 1788924811 + .long 1036227271 + .long 0 + .long 3067063928 + .long 3886781995 + .long 2181909072 + .long 17 + .long 103786080 + .long 119465851 + .long 1602069376 + .long 987 + .long 314091048 + .long 4120514941 + .long 1703984391 + .long 41665 + .long 3153492716 + .long 1769936992 + .long 3277791366 + .long 1248908 + .long 2480865882 + .long 357555572 + .long 1426486202 + .long 24641724 + .long 925215435 + .long 3875415602 + .long 2242310174 + .long 283170307 + .long 1206749920 + .long 1745236754 + .long 421850802 + .long 1512988987 + .long 554528472 + .long 4124376878 + .long 999726568 + .long 2331757501 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 844883384 + .long 48877615 + .long 0 + .long 0 + .long 613626429 + .long 1016694622 + .long 2 + .long 0 + .long 733791182 + .long 4037492605 + .long 370 + .long 0 + .long 2511602797 + .long 962949943 + .long 52209 + .long 0 + .long 2469661725 + .long 4226370589 + .long 6143972 + .long 0 + .long 2060721069 + .long 3581658067 + .long 593539814 + .long 0 + .long 2839602819 + .long 4222464368 + .long 3064291281 + .long 10 + .long 592311022 + .long 275206449 + .long 2221002398 + .long 647 + .long 3453980290 + .long 1100410175 + .long 2256369516 + .long 29367 + .long 965726650 + .long 341239821 + .long 1020304938 + .long 947922 + .long 2152956293 + .long 1358966229 + .long 796742083 + .long 20128900 + .long 2203770174 + .long 4010517667 + .long 1001215390 + .long 247246889 + .long 118635824 + .long 336180557 + .long 907042493 + .long 1379503488 + .long 1731363265 + .long 2376282645 + .long 3253758107 + .long 2155609720 + .long 4294967293 + .long 0 + .long 1133938837 + .long 1788275660 + .long 12816876 + .long 4227858976 + .long 328577348 + .long 3165265924 + .long 1527252342 + .long 1339392541 + .long 2394531985 + .long 243403399 + .long 1651082908 + .long 3768234999 + .long 1764410062 + .long 1127868 + .long 0 + .long 0 + .long 380965293 + .long 236501030 + .long 0 + .long 0 + .long 4057780011 + .long 296466121 + .long 10 + .long 0 + .long 1915520970 + .long 2413700929 + .long 1578 + .long 0 + .long 2515416277 + .long 1400529095 + .long 209346 + .long 0 + .long 1507502659 + .long 119133009 + .long 23121417 + .long 0 + .long 822245729 + .long 2123535665 + .long 2086838594 + .long 0 + .long 2761614169 + .long 2187408238 + .long 28089432 + .long 35 + .long 552668793 + .long 2572470762 + .long 825632309 + .long 1954 + .long 1089676525 + .long 4007660420 + .long 2284740089 + .long 81273 + .long 3790860620 + .long 4250011568 + .long 3911718864 + .long 2386138 + .long 1569325755 + .long 1413720016 + .long 751491568 + .long 45731817 + .long 955105128 + .long 1250521740 + .long 2097840313 + .long 506337017 + .long 1624392615 + .long 4258574603 + .long 3379569620 + .long 2624122564 + .long 4107144163 + .long 2368467334 + .long 1634973330 + .long 3993629493 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 818934838 + .long 89458952 + .long 0 + .long 0 + .long 1917175450 + .long 275918876 + .long 4 + .long 0 + .long 745599157 + .long 3172395316 + .long 667 + .long 0 + .long 2952822384 + .long 492051402 + .long 92937 + .long 0 + .long 2206545778 + .long 108664272 + .long 10789849 + .long 0 + .long 3593487476 + .long 2223761325 + .long 1025213015 + .long 0 + .long 4186460497 + .long 2115107000 + .long 546575231 + .long 18 + .long 4222869425 + .long 1697786641 + .long 1644425336 + .long 1067 + .long 2279245768 + .long 3297743944 + .long 144043411 + .long 46814 + .long 528690514 + .long 2305832912 + .long 3885610801 + .long 1446642 + .long 3948180674 + .long 1400240622 + .long 2848238597 + .long 29038477 + .long 365799999 + .long 3493109055 + .long 720503959 + .long 333431672 + .long 4157886487 + .long 4286999543 + .long 464978815 + .long 1767352013 + .long 3339500879 + .long 5789261 + .long 740497786 + .long 2709489262 + .long 4294967292 + .long 0 + .long 675685466 + .long 2210650544 + .long 12825068 + .long 4227858976 + .long 2475592912 + .long 4007987703 + .long 795233231 + .long 3544111414 + .long 3119445785 + .long 4019086602 + .long 1815298636 + .long 3651400695 + .long 250417896 + .long 1132895 + .long 0 + .long 0 + .long 1599660003 + .long 238893558 + .long 0 + .long 0 + .long 4178878964 + .long 640014589 + .long 10 + .long 0 + .long 3652653430 + .long 1664916825 + .long 1586 + .long 0 + .long 506609104 + .long 279824532 + .long 209578 + .long 0 + .long 3394823516 + .long 2710891899 + .long 23032181 + .long 0 + .long 1068742364 + .long 3396859346 + .long 2065409978 + .long 0 + .long 1532264156 + .long 1783373111 + .long 1537162281 + .long 34 + .long 3404313527 + .long 645034109 + .long 1238696626 + .long 1897 + .long 2815751506 + .long 1216048877 + .long 2381163022 + .long 77819 + .long 681356606 + .long 1742374831 + .long 1470157118 + .long 2245756 + .long 3583839604 + .long 3430133311 + .long 3428750273 + .long 42198880 + .long 2624104293 + .long 3836925937 + .long 2616934709 + .long 458497922 + .long 4091889117 + .long 2154475757 + .long 1334377092 + .long 2344404304 + .long 3811467832 + .long 4225344580 + .long 3014131639 + .long 3548440700 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2101683395 + .long 163038220 + .long 0 + .long 0 + .long 1150331703 + .long 1497034637 + .long 7 + .long 0 + .long 1295008257 + .long 2962522183 + .long 1195 + .long 0 + .long 193789761 + .long 1257830278 + .long 164530 + .long 0 + .long 3810960890 + .long 1878269909 + .long 18845080 + .long 0 + .long 2863024615 + .long 258783337 + .long 1761897164 + .long 0 + .long 2435461135 + .long 4254653612 + .long 2378780257 + .long 30 + .long 3635296493 + .long 4161741958 + .long 2074908190 + .long 1757 + .long 3250897880 + .long 2210089015 + .long 2132559608 + .long 74948 + .long 2166588251 + .long 3427170173 + .long 756319997 + .long 2241223 + .long 107629526 + .long 2814783011 + .long 580266263 + .long 43402774 + .long 2488417593 + .long 4037868436 + .long 2684236844 + .long 482393505 + .long 1636043988 + .long 2549915956 + .long 1055410979 + .long 2500896928 + .long 2063349270 + .long 3231350804 + .long 4156853657 + .long 3802515847 + .long 4294967291 + .long 0 + .long 191176124 + .long 2632795962 + .long 12816876 + .long 4227858976 + .long 1355787731 + .long 2425457148 + .long 539364904 + .long 1079897623 + .long 897043330 + .long 2066037045 + .long 1494461853 + .long 2159441332 + .long 2366379069 + .long 1131867 + .long 0 + .long 0 + .long 161545432 + .long 239220328 + .long 0 + .long 0 + .long 762722372 + .long 576200370 + .long 10 + .long 0 + .long 3468035492 + .long 1642011913 + .long 1578 + .long 0 + .long 4253764606 + .long 2733292311 + .long 207600 + .long 0 + .long 2811470101 + .long 3269311219 + .long 22691285 + .long 0 + .long 1825255966 + .long 1189284970 + .long 2021353589 + .long 0 + .long 717526141 + .long 2244953537 + .long 1522450794 + .long 33 + .long 693565287 + .long 2333767130 + .long 715945548 + .long 1824 + .long 2985180089 + .long 935432992 + .long 3298648348 + .long 73985 + .long 1392357808 + .long 2627674694 + .long 3107871798 + .long 2108973 + .long 3903806984 + .long 3473675411 + .long 4215247699 + .long 39146099 + .long 2236383345 + .long 2775867013 + .long 1051360344 + .long 420899965 + .long 715332657 + .long 3204539120 + .long 3177676604 + .long 2136936117 + .long 1567224951 + .long 2092241552 + .long 1304170706 + .long 3225156278 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3855812151 + .long 148081926 + .long 0 + .long 0 + .long 1028065361 + .long 2668697612 + .long 6 + .long 0 + .long 728439685 + .long 892227407 + .long 1067 + .long 0 + .long 615906957 + .long 1950415562 + .long 145255 + .long 0 + .long 3284206690 + .long 4202823521 + .long 16428718 + .long 0 + .long 1576659798 + .long 3860187404 + .long 1513740564 + .long 0 + .long 1223428711 + .long 1000755308 + .long 3492805977 + .long 25 + .long 1363712775 + .long 563079876 + .long 2891886022 + .long 1456 + .long 1912616499 + .long 4019273916 + .long 1170042322 + .long 60815 + .long 2578791056 + .long 3763338518 + .long 4013988507 + .long 1778302 + .long 596369036 + .long 4167829437 + .long 495223280 + .long 33706721 + .long 3069656582 + .long 1025646758 + .long 2029385299 + .long 368055588 + .long 4229256156 + .long 252497843 + .long 655863054 + .long 1886199584 + .long 3468886839 + .long 4222796798 + .long 2935312587 + .long 2855531945 + .long 4294967291 + .long 0 + .long 2797952740 + .long 3054806814 + .long 12825068 + .long 4227858976 + .long 2679935261 + .long 2846977675 + .long 1518593598 + .long 771365947 + .long 2901840529 + .long 102047653 + .long 404923885 + .long 709259131 + .long 475240934 + .long 1125214 + .long 0 + .long 0 + .long 1836195777 + .long 237921320 + .long 0 + .long 0 + .long 620715017 + .long 203920416 + .long 10 + .long 0 + .long 2730396855 + .long 4074598327 + .long 1558 + .long 0 + .long 149951721 + .long 1542475780 + .long 204126 + .long 0 + .long 895086698 + .long 26046181 + .long 22194201 + .long 0 + .long 1052098554 + .long 3499556639 + .long 1964976743 + .long 0 + .long 3912081837 + .long 3256319751 + .long 845978380 + .long 32 + .long 2103533506 + .long 1288917748 + .long 344362072 + .long 1747 + .long 586607141 + .long 2789855780 + .long 789521480 + .long 70264 + .long 1029756229 + .long 2597195099 + .long 1036923741 + .long 1985929 + .long 570319344 + .long 1441637551 + .long 3714173380 + .long 36574571 + .long 1955754200 + .long 3807195269 + .long 90410504 + .long 390763661 + .long 2874958444 + .long 3633243115 + .long 2931863300 + .long 1975635819 + .long 32243731 + .long 2591757144 + .long 3895319176 + .long 2976685396 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3502958424 + .long 134252990 + .long 0 + .long 0 + .long 2150545646 + .long 4111632521 + .long 5 + .long 0 + .long 2999463670 + .long 3120574364 + .long 951 + .long 0 + .long 681502082 + .long 4195687681 + .long 128253 + .long 0 + .long 442998991 + .long 979480158 + .long 14344565 + .long 0 + .long 151969242 + .long 4070078334 + .long 1305331397 + .long 0 + .long 1826390155 + .long 1249420678 + .long 4104872299 + .long 21 + .long 1355768955 + .long 3758834208 + .long 3412700795 + .long 1220 + .long 1644384830 + .long 2135273975 + .long 2887874099 + .long 50190 + .long 1150050798 + .long 2243957583 + .long 2798432622 + .long 1445747 + .long 3460890697 + .long 2393108922 + .long 2317365582 + .long 27037249 + .long 135336093 + .long 93459488 + .long 4047224670 + .long 292116325 + .long 2632066877 + .long 2478679361 + .long 3592211274 + .long 1486901023 + .long 4259160346 + .long 2383522946 + .long 1229950112 + .long 2245322564 + .long 4294967291 + .long 0 + .long 4131724546 + .long 247119503 + .long 229390 + .long 4227858728 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1920268374 + .long 676671 + .long 0 + .long 0 + .long 2648589321 + .long 145893005 + .long 0 + .long 0 + .long 86363579 + .long 792199897 + .long 6 + .long 0 + .long 3569661012 + .long 3338031321 + .long 964 + .long 0 + .long 3537357668 + .long 2546852361 + .long 127350 + .long 0 + .long 1674639321 + .long 989707703 + .long 14008565 + .long 0 + .long 633069455 + .long 3178427980 + .long 1260770870 + .long 0 + .long 2929308222 + .long 1214878390 + .long 581189477 + .long 21 + .long 3037977477 + .long 3608983388 + .long 2481839655 + .long 1183 + .long 1571270935 + .long 1253493999 + .long 1158050441 + .long 49710 + .long 2588063047 + .long 3245086386 + .long 381774870 + .long 1491308 + .long 2638540175 + .long 477218587 + .long 3340530119 + .long 29826161 + .long 1326835123 + .long 1431655765 + .long 1431655765 + .long 357913941 + .long 4293747565 + .long 4294967295 + .long 4294967295 + .long 2147483647 + .long 4294964933 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 0 + .long 0 + .long 105434711 + .long 715574136 + .long 12825068 + .long 4227858976 + .long 2071479615 + .long 4114262957 + .long 3040350773 + .long 3578447305 + .long 1647168078 + .long 978698920 + .long 1144287138 + .long 3827795094 + .long 3787403973 + .long 562609 + .long 0 + .long 0 + .long 1649578671 + .long 117913179 + .long 0 + .long 0 + .long 3082368152 + .long 40122077 + .long 5 + .long 0 + .long 602895375 + .long 3952322020 + .long 783 + .long 0 + .long 3838465116 + .long 2181233212 + .long 103846 + .long 0 + .long 851468155 + .long 4001763569 + .long 11469451 + .long 0 + .long 3659498813 + .long 523695164 + .long 1037041443 + .long 0 + .long 2978199351 + .long 773277203 + .long 2051066178 + .long 17 + .long 4092624060 + .long 3930860161 + .long 3294762475 + .long 984 + .long 1105652893 + .long 1066438988 + .long 3642064414 + .long 41652 + .long 2196971596 + .long 2146191353 + .long 3442355222 + .long 1259557 + .long 3918894073 + .long 188553237 + .long 818155667 + .long 25403502 + .long 852571760 + .long 3121326526 + .long 2509267963 + .long 306918409 + .long 2896427178 + .long 2552665716 + .long 2229539464 + .long 1835168886 + .long 1453277625 + .long 518768794 + .long 1711011538 + .long 3459676865 + .long 0 + .long 0 + .long 2062472710 + .long 69166 + .long 0 + .long 0 + .long 673615662 + .long 23833985 + .long 0 + .long 0 + .long 630248642 + .long 363685088 + .long 1 + .long 0 + .long 288759411 + .long 2697305718 + .long 181 + .long 0 + .long 2130785052 + .long 823708847 + .long 25870 + .long 0 + .long 1430316470 + .long 3023974030 + .long 3089586 + .long 0 + .long 3827036731 + .long 3302510044 + .long 304068797 + .long 0 + .long 3738696708 + .long 3274114857 + .long 2670490624 + .long 5 + .long 287265850 + .long 4109473262 + .long 3360573366 + .long 350 + .long 38249035 + .long 2812769293 + .long 2052670485 + .long 16622 + .long 3926290357 + .long 206759826 + .long 2443135158 + .long 571444 + .long 1809246839 + .long 3759763742 + .long 1694050886 + .long 13356266 + .long 1847069514 + .long 3357213528 + .long 2594247192 + .long 192045418 + .long 1427481913 + .long 3504276391 + .long 3430325004 + .long 1423790384 + .long 900295939 + .long 3843660490 + .long 2372410664 + .long 3611630842 + .long 4294967294 + .long 0 + .long 774013863 + .long 1145724988 + .long 12816876 + .long 4227858976 + .long 2744287014 + .long 3766464413 + .long 1053213460 + .long 3969062622 + .long 1083456455 + .long 3049621789 + .long 3365086587 + .long 561540346 + .long 2996396832 + .long 575091 + .long 0 + .long 0 + .long 42660608 + .long 117761546 + .long 0 + .long 0 + .long 3056183536 + .long 25400137 + .long 5 + .long 0 + .long 3539354956 + .long 964064098 + .long 784 + .long 0 + .long 1133846550 + .long 3354628177 + .long 103987 + .long 0 + .long 837408368 + .long 1875825334 + .long 11493772 + .long 0 + .long 4020356818 + .long 15105701 + .long 1039623118 + .long 0 + .long 2432213228 + .long 4116600081 + .long 2213395342 + .long 17 + .long 346536517 + .long 2329406249 + .long 1562759336 + .long 985 + .long 1904777685 + .long 777730941 + .long 3468653957 + .long 41521 + .long 2565172885 + .long 3392131685 + .long 216627896 + .long 1245806 + .long 777484384 + .long 1373172746 + .long 529073424 + .long 24734325 + .long 1189796029 + .long 1140288371 + .long 1770133260 + .long 289389693 + .long 2194668596 + .long 3631308278 + .long 3147219318 + .long 1613893367 + .long 344927104 + .long 1168140252 + .long 980702046 + .long 2577974684 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1881749350 + .long 46062706 + .long 0 + .long 0 + .long 2009952654 + .long 475434148 + .long 2 + .long 0 + .long 3595153284 + .long 3894518978 + .long 350 + .long 0 + .long 1401741016 + .long 800557075 + .long 49546 + .long 0 + .long 1250374609 + .long 1417939249 + .long 5854570 + .long 0 + .long 3066837935 + .long 3745800702 + .long 568662855 + .long 0 + .long 4187727968 + .long 1730013373 + .long 1461665574 + .long 10 + .long 3341641980 + .long 2588791038 + .long 1829968615 + .long 631 + .long 888818201 + .long 3523374130 + .long 852659386 + .long 29067 + .long 3905449900 + .long 720793762 + .long 1836357526 + .long 959598 + .long 711023215 + .long 2187868163 + .long 363719992 + .long 21124528 + .long 3782390642 + .long 1386816912 + .long 3690959132 + .long 275994811 + .long 3562870039 + .long 2887822114 + .long 2407074109 + .long 1720896075 + .long 723327461 + .long 1298307143 + .long 454424891 + .long 2939711024 + .long 4294967293 + .long 0 + .long 4220957082 + .long 1571153381 + .long 12825068 + .long 4227858976 + .long 4024519172 + .long 2730919557 + .long 1456036120 + .long 3256132268 + .long 2931624203 + .long 1339507405 + .long 1357793012 + .long 1094045067 + .long 1129712150 + .long 1138961 + .long 0 + .long 0 + .long 2372829177 + .long 237557530 + .long 0 + .long 0 + .long 534122416 + .long 423932365 + .long 10 + .long 0 + .long 4247263216 + .long 4283734547 + .long 1580 + .long 0 + .long 2387955306 + .long 607897802 + .long 209396 + .long 0 + .long 2812500241 + .long 994269493 + .long 23101510 + .long 0 + .long 3000333735 + .long 388858992 + .long 2083539857 + .long 0 + .long 1161363350 + .long 3153424268 + .long 4076649817 + .long 34 + .long 1819801357 + .long 1812729011 + .long 330148996 + .long 1953 + .long 3163500019 + .long 3864465446 + .long 4064814974 + .long 81467 + .long 3858761013 + .long 3692736596 + .long 1902533809 + .long 2406436 + .long 3293643408 + .long 375345917 + .long 2826147377 + .long 46631566 + .long 4164807482 + .long 4162856869 + .long 2610851470 + .long 525451848 + .long 2048614181 + .long 1569367797 + .long 3543942876 + .long 2777034414 + .long 3312093651 + .long 708453697 + .long 1978042629 + .long 4289897122 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2071065822 + .long 86614531 + .long 0 + .long 0 + .long 2391713785 + .long 4060239028 + .long 3 + .long 0 + .long 4029056008 + .long 1846783416 + .long 650 + .long 0 + .long 161647879 + .long 3413412248 + .long 90917 + .long 0 + .long 436274283 + .long 2466277660 + .long 10613189 + .long 0 + .long 671943584 + .long 553150431 + .long 1015563947 + .long 0 + .long 1753238306 + .long 1517906611 + .long 532738342 + .long 18 + .long 618689867 + .long 596492050 + .long 2460930076 + .long 1080 + .long 414131426 + .long 1367052230 + .long 3308909536 + .long 48209 + .long 4126473295 + .long 3381931776 + .long 1805298000 + .long 1525871 + .long 636148702 + .long 2186154781 + .long 2942928489 + .long 31683165 + .long 999999630 + .long 4126401816 + .long 259460410 + .long 380946890 + .long 231980038 + .long 363549591 + .long 883055596 + .long 2118559672 + .long 3622330114 + .long 1609129610 + .long 63100786 + .long 3373399958 + .long 4294967292 + .long 0 + .long 1588683414 + .long 1994957096 + .long 12816876 + .long 4227858976 + .long 2267877675 + .long 3576551320 + .long 1765045200 + .long 3464483214 + .long 1351689592 + .long 3801296041 + .long 352384788 + .long 331703635 + .long 605298272 + .long 1136492 + .long 0 + .long 0 + .long 2681104739 + .long 238950871 + .long 0 + .long 0 + .long 3149807504 + .long 621710226 + .long 10 + .long 0 + .long 2595166296 + .long 121246070 + .long 1585 + .long 0 + .long 2215012362 + .long 2482367452 + .long 209363 + .long 0 + .long 470943915 + .long 668008525 + .long 23014074 + .long 0 + .long 3763658407 + .long 3343124614 + .long 2065508072 + .long 0 + .long 249623666 + .long 2390602642 + .long 1795904366 + .long 34 + .long 1346725057 + .long 2927659279 + .long 1029310809 + .long 1906 + .long 3831989490 + .long 3024162362 + .long 457912312 + .long 78555 + .long 1623643704 + .long 979247650 + .long 4029398248 + .long 2282874 + .long 2791098952 + .long 2391841680 + .long 2696257895 + .long 43306505 + .long 262637107 + .long 3763159487 + .long 2938992385 + .long 475778611 + .long 3299175406 + .long 3677201670 + .long 2349553020 + .long 2458659840 + .long 206020084 + .long 2363120772 + .long 2638136209 + .long 3751386051 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3034634732 + .long 80259059 + .long 0 + .long 0 + .long 2987375659 + .long 2703374687 + .long 3 + .long 0 + .long 1215607278 + .long 4163686255 + .long 592 + .long 0 + .long 781938720 + .long 2086477677 + .long 82005 + .long 0 + .long 3556471813 + .long 3031971904 + .long 9451560 + .long 0 + .long 2005655437 + .long 2494233436 + .long 890598760 + .long 0 + .long 1167836918 + .long 114850616 + .long 2568442225 + .long 15 + .long 2351511177 + .long 1547877599 + .long 2724662709 + .long 908 + .long 1583056039 + .long 1830443712 + .long 1719394286 + .long 39382 + .long 1124627201 + .long 674092017 + .long 1868383046 + .long 1202161 + .long 4262245498 + .long 1815295967 + .long 3756878985 + .long 23872494 + .long 1013133814 + .long 1390137141 + .long 1845508344 + .long 272711216 + .long 2632746813 + .long 493954138 + .long 4257964097 + .long 1450886530 + .long 1659393003 + .long 4235627183 + .long 3605632322 + .long 2252460395 + .long 4294967292 + .long 0 + .long 1932081087 + .long 2418003218 + .long 12825068 + .long 4227858976 + .long 675685466 + .long 2210650544 + .long 2635457388 + .long 3001216681 + .long 2383987892 + .long 1958452314 + .long 200318573 + .long 1670080688 + .long 1772035109 + .long 1132935 + .long 0 + .long 0 + .long 2224132738 + .long 239067824 + .long 0 + .long 0 + .long 2504702558 + .long 548466910 + .long 10 + .long 0 + .long 120798343 + .long 3554901277 + .long 1577 + .long 0 + .long 2434954499 + .long 1660365081 + .long 207659 + .long 0 + .long 2744534538 + .long 1767005024 + .long 22722744 + .long 0 + .long 1354085614 + .long 573653951 + .long 2027648348 + .long 0 + .long 2302238895 + .long 940817979 + .long 2333007942 + .long 33 + .long 4044378246 + .long 2424318367 + .long 54614345 + .long 1841 + .long 3277428544 + .long 937510890 + .long 2353849014 + .long 75024 + .long 4005612974 + .long 1580435742 + .long 1601652905 + .long 2151432 + .long 3782038889 + .long 2892349902 + .long 3709353570 + .long 40211969 + .long 2209533886 + .long 1632935844 + .long 1972351296 + .long 435469920 + .long 2489865929 + .long 3249608891 + .long 2176055770 + .long 2225282526 + .long 4163770951 + .long 1426482641 + .long 75146285 + .long 3375249381 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2220915002 + .long 147504303 + .long 0 + .long 0 + .long 3383683424 + .long 2662024159 + .long 6 + .long 0 + .long 4203741875 + .long 3065385408 + .long 1071 + .long 0 + .long 94574798 + .long 3694012699 + .long 146649 + .long 0 + .long 548197575 + .long 3705365680 + .long 16693691 + .long 0 + .long 2971661595 + .long 3995690294 + .long 1550219778 + .long 0 + .long 3364157924 + .long 536970539 + .long 2951498969 + .long 26 + .long 3606982515 + .long 2998613798 + .long 1572386296 + .long 1523 + .long 54159713 + .long 2382254602 + .long 1960159626 + .long 64476 + .long 164299812 + .long 2501105432 + .long 2657580848 + .long 1915496 + .long 4191466314 + .long 1475491836 + .long 409725690 + .long 36942237 + .long 2000214888 + .long 3808326374 + .long 4191271566 + .long 410491162 + .long 3021924263 + .long 3759042010 + .long 567945948 + .long 2137524835 + .long 2922089864 + .long 3203830329 + .long 752382353 + .long 3278805360 + .long 4294967291 + .long 0 + .long 223335381 + .long 2840633637 + .long 12816876 + .long 4227858976 + .long 191176124 + .long 2632795962 + .long 792829484 + .long 4194095148 + .long 1561179743 + .long 586327156 + .long 2807878837 + .long 3545818423 + .long 1415596998 + .long 1125924 + .long 0 + .long 0 + .long 2335397241 + .long 237899312 + .long 0 + .long 0 + .long 898966976 + .long 220219689 + .long 10 + .long 0 + .long 3140042207 + .long 3171383055 + .long 1560 + .long 0 + .long 2021920923 + .long 1061467961 + .long 204590 + .long 0 + .long 1780915469 + .long 3394528573 + .long 22279398 + .long 0 + .long 2938289575 + .long 3726010345 + .long 1976658045 + .long 0 + .long 1742882295 + .long 3191343047 + .long 2047550512 + .long 32 + .long 3647296052 + .long 2253947992 + .long 1300129447 + .long 1768 + .long 2864334604 + .long 1571083743 + .long 2473956825 + .long 71411 + .long 902177211 + .long 1309134586 + .long 1494319522 + .long 2027873 + .long 1978202312 + .long 2898857432 + .long 1838265108 + .long 37534288 + .long 440015974 + .long 4230775195 + .long 1255344562 + .long 402981746 + .long 1205443830 + .long 4140044432 + .long 3282462476 + .long 2046231097 + .long 2809323527 + .long 1074462473 + .long 1051546203 + .long 3093465233 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1994591040 + .long 134874738 + .long 0 + .long 0 + .long 1154796671 + .long 33466848 + .long 6 + .long 0 + .long 944609558 + .long 611410016 + .long 964 + .long 0 + .long 3394269576 + .long 3253723903 + .long 130617 + .long 0 + .long 1604599336 + .long 2571734283 + .long 14700043 + .long 0 + .long 2720136884 + .long 1760790051 + .long 1347449133 + .long 0 + .long 3340661604 + .long 3195040324 + .long 3680379603 + .long 22 + .long 3451695816 + .long 2081337828 + .long 1427065647 + .long 1283 + .long 2755833528 + .long 3578899323 + .long 1127406403 + .long 53342 + .long 2103438216 + .long 2925829331 + .long 133275521 + .long 1554875 + .long 3003940918 + .long 1302060887 + .long 2008749614 + .long 29436400 + .long 4279932662 + .long 1473928468 + .long 533396292 + .long 321840330 + .long 3248261436 + .long 2035472962 + .long 372258839 + .long 1655927148 + .long 3127294521 + .long 3128066919 + .long 2865156314 + .long 2523236171 + .long 4294967291 + .long 0 + .long 1890690921 + .long 3263011055 + .long 12825068 + .long 4227858976 + .long 2797952740 + .long 3054806814 + .long 1894667006 + .long 214237447 + .long 1296756846 + .long 4060330468 + .long 1098085821 + .long 3604642180 + .long 1726893371 + .long 1115219 + .long 0 + .long 0 + .long 494710856 + .long 235638241 + .long 0 + .long 0 + .long 1193585816 + .long 3981686648 + .long 9 + .long 0 + .long 143797405 + .long 762868814 + .long 1536 + .long 0 + .long 898881458 + .long 2220674218 + .long 200569 + .long 0 + .long 271788931 + .long 1836576498 + .long 21741122 + .long 0 + .long 3732597210 + .long 2567748600 + .long 1918751890 + .long 0 + .long 3683010637 + .long 2674911154 + .long 1453366689 + .long 31 + .long 3314792629 + .long 3590832641 + .long 792084225 + .long 1695 + .long 710884882 + .long 1421882797 + .long 453673326 + .long 67984 + .long 4289998525 + .long 1545801705 + .long 2082770245 + .long 1917055 + .long 1427259630 + .long 3087470940 + .long 1747456958 + .long 35251400 + .long 2597591904 + .long 3049486553 + .long 2056710479 + .long 376393410 + .long 2213091204 + .long 2641098163 + .long 3971809407 + .long 1903717223 + .long 3244722564 + .long 177715146 + .long 3090222263 + .long 2872209565 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 4193727727 + .long 246007177 + .long 0 + .long 0 + .long 768822418 + .long 3782320021 + .long 10 + .long 0 + .long 2196079823 + .long 201893182 + .long 1732 + .long 0 + .long 1661061158 + .long 4260475543 + .long 232537 + .long 0 + .long 3959757821 + .long 1648015928 + .long 25908825 + .long 0 + .long 2136418328 + .long 2790862444 + .long 2348699355 + .long 0 + .long 14984150 + .long 3359899422 + .long 1557173094 + .long 39 + .long 2579163115 + .long 4209094591 + .long 2975956643 + .long 2181 + .long 809874233 + .long 1287653529 + .long 1784169535 + .long 89477 + .long 836980350 + .long 209256478 + .long 3015626027 + .long 2573945 + .long 2016221741 + .long 1745099515 + .long 1018088912 + .long 48139690 + .long 3329474215 + .long 1010710723 + .long 642962579 + .long 521003091 + .long 801578433 + .long 3224757113 + .long 3341503980 + .long 2660978634 + .long 2199935228 + .long 4052003304 + .long 2221814426 + .long 4038241008 + .long 4294967290 + .long 0 + .long 3178730751 + .long 116147812 + .long 14854636 + .long 416 + .long 416371481 + .long 2823641499 + .long 2506915568 + .long 4124207639 + .long 950494682 + .long 256731865 + .long 619428904 + .long 3037288495 + .long 4208811624 + .long 884105690 + .long 0 + .long 0 + .long 3410106176 + .long 4245208708 + .long 126 + .long 0 + .long 3116091236 + .long 3070791485 + .long 44137 + .long 0 + .long 1379902983 + .long 2256834745 + .long 12232777 + .long 0 + .long 2097914520 + .long 545273602 + .long 2619411277 + .long 0 + .long 215423817 + .long 3507318412 + .long 256238311 + .long 97 + .long 3668117219 + .long 4022295396 + .long 2420542464 + .long 10890 + .long 3822143167 + .long 3930114069 + .long 1325150521 + .long 798528 + .long 3699121161 + .long 791807715 + .long 67391017 + .long 33958538 + .long 3257898816 + .long 678025854 + .long 1894699409 + .long 674718922 + .long 1201340557 + .long 2594901103 + .long 3933905415 + .long 3704843775 + .long 4294967294 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 982743186 + .long 1840382683 + .long 8 + .long 0 + .long 2770471380 + .long 1232287742 + .long 3186 + .long 0 + .long 2689925901 + .long 4291161637 + .long 993651 + .long 0 + .long 1865452386 + .long 278667130 + .long 243198017 + .long 0 + .long 941914362 + .long 1579381843 + .long 2208801237 + .long 10 + .long 4030005343 + .long 1439537596 + .long 2913266490 + .long 1415 + .long 897709932 + .long 2611261457 + .long 3831192043 + .long 129715 + .long 2599986828 + .long 562288571 + .long 873738186 + .long 7347842 + .long 1676792497 + .long 2643238970 + .long 1059645264 + .long 218261805 + .long 3968061936 + .long 1814410518 + .long 4215318874 + .long 2360677848 + .long 4294967294 + .long 0 + .long 1965065697 + .long 125333813 + .long 29671681 + .long 368 + .long 2696892906 + .long 3837883846 + .long 4163818448 + .long 2636579655 + .long 352076257 + .long 2995873374 + .long 2356022824 + .long 2864685933 + .long 507647155 + .long 87534215 + .long 364999993 + .long 2297262027 + .long 3804603314 + .long 421232362 + .long 623004025 + .long 2436698064 + .long 857209363 + .long 4104727312 + .long 1300779075 + .long 2300222395 + .long 3549420260 + .long 815695431 + .long 3490474032 + .long 2175015012 + .long 273829883 + .long 837019448 + .long 1150859439 + .long 4129001094 + .long 166114890 + .long 262582295 + .long 2200440235 + .long 3934411649 + .long 4260765987 + .long 1496016656 + .long 613554758 + .long 3765455772 + .long 1537995402 + .long 3112915065 + .long 3831973801 + .long 3621881222 + .long 371259347 + .long 563988192 + .long 2577068580 + .long 3504039397 + .long 3892719810 + .long 2774136061 + .long 761863973 + .long 3413069278 + .long 932429307 + .long 3533847854 + .long 670352073 + .long 3351189942 + .long 332608650 + .long 3102655069 + .long 2958547113 + .long 3322177573 + .long 146996155 + .long 3411645617 + .long 2215850181 + .long 3332037184 + .long 590982538 + .long 2197714658 + .long 1764878165 + .long 3390200984 + .long 952267699 + .long 417090737 + .long 3487943763 + .long 3519763458 + .long 1338819266 + .long 2605877443 + .long 347561299 + .long 3761505334 + .long 3379093939 + .long 2405540353 + .long 1506019226 + .long 3884741458 + .long 2785505456 + .long 3086386584 + .long 2046080941 + .long 3789068741 + .long 1518238185 + .long 1088338119 + .long 1804079185 + .long 4226925859 + .long 2303172266 + .long 2741263628 + .long 633622237 + .long 3777083586 + .long 3757196004 + .long 294895316 + .long 27640459 + .long 432 + .long 2828420652 + .long 3361833042 + .long 1412248364 + .long 2211183849 + .long 0 + .long 3547577142 + .long 1 + .long 0 + .long 2851890648 + .long 450899591 + .long 287024625 + .long 4159553752 + .long 3788600515 + .long 2561792324 + .long 3962766183 + .long 3512577319 + .long 2861699545 + .long 2196522185 + .long 1554209519 + .long 4198958626 + .long 3194489346 + .long 2786967510 + .long 3304318871 + .long 3344542374 + .long 4105608152 + .long 867728568 + .long 2708443992 + .long 3505223656 + .long 1032912387 + .long 3711167273 + .long 1214238009 + .long 2611213035 + .long 3368625691 + .long 5584441 + .long 2611408711 + .long 2384597091 + .long 1152098306 + .long 3591611965 + .long 2962228819 + .long 3281323244 + .long 3071980506 + .long 3920864562 + .long 3855393805 + .long 2582452787 + .long 3343479107 + .long 1168797990 + .long 3053975971 + .long 3222544278 + .long 3909139483 + .long 1083468961 + .long 2101774947 + .long 2160722632 + .long 2110801092 + .long 4019214560 + .long 1350065479 + .long 2376260138 + .long 42240602 + .long 3769900699 + .long 2854857645 + .long 2686999005 + .long 4198697477 + .long 4081736268 + .long 2846299562 + .long 2478988733 + .long 427675101 + .long 2445602520 + .long 4233423029 + .long 2355264427 + .long 1558515652 + .long 2279564152 + .long 62666641 + .long 3298296210 + .long 1417642332 + .long 61859471 + .long 2115062510 + .long 2696409612 + .long 326492679 + .long 2534854374 + .long 1679925266 + .long 2160906787 + .long 3251033635 + .long 2671487866 + .long 2862247032 + .long 3574405396 + .long 3009660033 + .long 339349497 + .long 3007548001 + .long 2840034127 + .long 2252903388 + .long 1330394071 + .long 2157393054 + .long 2200692478 + .long 621144332 + .long 3987984878 + .long 1728372573 + .long 3841939891 + .long 2649374871 + .long 2008708732 + .long 1354882191 + .long 2904204888 + .long 3398077461 + .long 3906455313 + .long 2501808239 + .long 2340852904 + .long 257973487 + .long 728759453 + .long 30163463 + .long 848 + .long 3266633231 + .long 4249524844 + .long 2065907802 + .long 2501410748 + .long 2077120351 + .long 1559182036 + .long 2148606178 + .long 4119882265 + .long 315045067 + .long 14812806 + .long 1274331647 + .long 3156365682 + .long 238086315 + .long 2517423111 + .long 2041601736 + .long 2711078025 + .long 3652406632 + .long 753691269 + .long 2734041400 + .long 3820625006 + .long 2380832782 + .long 158270193 + .long 2340065183 + .long 2273321385 + .long 393890025 + .long 2894667190 + .long 1573700686 + .long 4092887025 + .long 464562897 + .long 303515614 + .long 3848216904 + .long 3328255744 + .long 1036006886 + .long 2121885428 + .long 3704818897 + .long 3211297370 + .long 1325824312 + .long 3493125121 + .long 3338748802 + .long 3232443331 + .long 3112594497 + .long 3307298736 + .long 2809691794 + .long 3731360010 + .long 3573632495 + .long 2312925567 + .long 629450595 + .long 3622381915 + .long 989010185 + .long 3398558103 + .long 4153621291 + .long 3607201927 + .long 2629100272 + .long 1953994464 + .long 1943384301 + .long 2759420002 + .long 2305022315 + .long 2391039855 + .long 612094863 + .long 3951603967 + .long 1340433416 + .long 3334026995 + .long 1491763737 + .long 4186248678 + .long 4198464715 + .long 87224683 + .long 4220145159 + .long 3881216024 + .long 2007772778 + .long 1722917095 + .long 2388984076 + .long 3799859053 + .long 732951595 + .long 3919415462 + .long 528829945 + .long 3610037081 + .long 3992395594 + .long 4037851002 + .long 1844118200 + .long 3714769074 + .long 3432638667 + .long 3108186388 + .long 746542694 + .long 3818486016 + .long 557823754 + .long 2427510280 + .long 3516120961 + .long 3892142094 + .long 1703329579 + .long 996501429 + .long 4081661750 + .long 3974028169 + .long 480847786 + .long 3006112619 + .long 1403431905 + .long 4065364793 + .long 1900483787 + .long 2649330773 + .long 651669812 + .long 4162988739 + .long 1619173352 + .long 1864819711 + .long 1131374484 + .long 4267744761 + .long 1834860043 + .long 2423625113 + .long 288099716 + .long 2190363742 + .long 2708503338 + .long 4126097102 + .long 3654529011 + .long 2251412339 + .long 3753107947 + .long 3496449780 + .long 2610603179 + .long 2317533940 + .long 3862344650 + .long 1030964414 + .long 451338797 + .long 2389337002 + .long 2524196363 + .long 569491811 + .long 2946926522 + .long 2467527406 + .long 196512138 + .long 497579000 + .long 2195809742 + .long 2552928386 + .long 1662952651 + .long 780129586 + .long 2880189481 + .long 2646511583 + .long 1545658730 + .long 789982365 + .long 191310475 + .long 2749424166 + .long 1470909419 + .long 1234100077 + .long 2044585165 + .long 2862876216 + .long 928663178 + .long 2102054363 + .long 3690288476 + .long 2988326180 + .long 2216922123 + .long 2305139484 + .long 4174545259 + .long 3130608048 + .long 1755153610 + .long 918723953 + .long 2738745609 + .long 3294047809 + .long 721728203 + .long 1773737866 + .long 4101484425 + .long 3433511350 + .long 1857351114 + .long 2879235855 + .long 1363799643 + .long 3536910801 + .long 4061718601 + .long 908917583 + .long 3005712244 + .long 4215915540 + .long 243897838 + .long 7660553 + .long 2731769662 + .long 2727825412 + .long 1695068807 + .long 2615038300 + .long 234665196 + .long 3149409338 + .long 2025012071 + .long 1264893574 + .long 1155162898 + .long 2643506208 + .long 3781832745 + .long 2126832235 + .long 1395780981 + .long 2754722035 + .long 4274723882 + .long 199777100 + .long 1853759306 + .long 3583381494 + .long 3072425958 + .long 993425135 + .long 3004341385 + .long 3435215656 + .long 3198694093 + .long 620059688 + .long 2085750463 + .long 2400804391 + .long 1026440073 + .long 2116228661 + .long 3422860059 + .long 3767238370 + .long 376557070 + .long 669608662 + .long 2826299222 + .long 4021726431 + .long 97861608 + .long 623049618 + .long 457143492 + .long 3494791496 + .long 647336461 + .long 20390326 + .long 156262610 + .long 3457815221 + .long 2242302115 + .long 1153736377 + .long 29917573 + .long 608 + .long 956831540 + .long 3804294695 + .long 1233656524 + .long 1169011973 + .long 3512247603 + .long 731707668 + .long 3804813427 + .long 3532496868 + .long 3861713254 + .long 3920998321 + .long 3249242362 + .long 2983748142 + .long 4254521127 + .long 3419828215 + .long 3612752470 + .long 3427243214 + .long 1865130836 + .long 1528519591 + .long 3104638828 + .long 2778394947 + .long 2428343797 + .long 2183879732 + .long 1050296790 + .long 3773933110 + .long 3652345540 + .long 2906583603 + .long 1426288469 + .long 3900013225 + .long 3885984869 + .long 2566242072 + .long 2597085889 + .long 3387828672 + .long 3402407620 + .long 2004411987 + .long 1378225957 + .long 3062031935 + .long 3648787989 + .long 92338370 + .long 4236899602 + .long 2817389734 + .long 1952242004 + .long 2304097414 + .long 127945474 + .long 2582972800 + .long 4281889637 + .long 2697225196 + .long 2199799063 + .long 2368525439 + .long 2882311446 + .long 2124741744 + .long 2454581530 + .long 2175676414 + .long 1363442533 + .long 235950345 + .long 3278607019 + .long 3991475143 + .long 2338347060 + .long 892652237 + .long 3886541672 + .long 3654822706 + .long 2206999749 + .long 359442761 + .long 1344250324 + .long 3448127457 + .long 2316542980 + .long 3829127353 + .long 220674587 + .long 3338303659 + .long 280815351 + .long 3269930602 + .long 4246425196 + .long 2475208849 + .long 3336161088 + .long 2206265573 + .long 1212344344 + .long 2473891454 + .long 491190659 + .long 2156317952 + .long 2981239741 + .long 2515194909 + .long 3609278228 + .long 1234146757 + .long 1026744012 + .long 2624029530 + .long 2704274272 + .long 1975162568 + .long 3276945619 + .long 2578639571 + .long 1034382165 + .long 2590969465 + .long 713762072 + .long 2201806508 + .long 4228198051 + .long 3980119693 + .long 4056525840 + .long 3097891989 + .long 2284336932 + .long 1932639591 + .long 1092540108 + .long 4171705026 + .long 1025654624 + .long 2806138305 + .long 3009647326 + .long 4248184906 + .long 1890367717 + .long 2289438980 + .long 2899757860 + .long 2719293081 + .long 2021534083 + .long 143536689 + .long 3592569555 + .long 2232683115 + .long 1092535430 + .long 1236892532 + .long 4153044331 + .long 2589276857 + .long 3416977538 + .long 1252322112 + .long 2546684106 + .long 3041465242 + .long 1082461383 + .long 209063033 + .long 689512483 + .long 3233542783 + .long 2486702483 + .long 195380297 + .long 3370408231 + .long 2473507057 + .long 2649928714 + .long 3477888857 + .long 4011137876 + .long 2392519727 + .long 735960098 + .long 892635115 + .long 2839435691 + .long 3648562506 + .long 4276128797 + .long 1399354710 + .long 1604489874 + .long 3300188966 + .long 3618086195 + .long 2363035047 + .long 3798645379 + .long 2910302351 + .long 2872403096 + .long 1995870309 + .long 1272108261 + .long 2577818883 + .long 1355290640 + .long 1576944867 + .long 29835783 + .long 528 + .long 602586217 + .long 2744039853 + .long 1836018387 + .long 1812008391 + .long 2257334696 + .long 1529386301 + .long 1071982020 + .long 1483132946 + .long 4031485769 + .long 2132222880 + .long 3196630878 + .long 2436179952 + .long 499786504 + .long 1744292863 + .long 2290711216 + .long 2504292584 + .long 1896329063 + .long 3237324739 + .long 2330780121 + .long 3744707929 + .long 1734827082 + .long 3296507779 + .long 823995655 + .long 3906271181 + .long 1416288288 + .long 2226659999 + .long 3321781362 + .long 3715853563 + .long 2544842791 + .long 504837419 + .long 2958966103 + .long 2231720942 + .long 750175301 + .long 4084077163 + .long 2549224941 + .long 3250807824 + .long 1369606438 + .long 3223323496 + .long 2083589876 + .long 3384767572 + .long 4248382916 + .long 4144081438 + .long 3229998485 + .long 3165770641 + .long 3223334087 + .long 2485373121 + .long 3818931504 + .long 3388848075 + .long 1252536709 + .long 1652370242 + .long 2624409840 + .long 2964694704 + .long 823791654 + .long 1167018965 + .long 2939238153 + .long 2953436515 + .long 884228550 + .long 292276865 + .long 734484637 + .long 2205305082 + .long 1913113287 + .long 3765099297 + .long 3745471985 + .long 4167966771 + .long 2931697765 + .long 3673300473 + .long 2182221826 + .long 2649024091 + .long 1975627272 + .long 3727134676 + .long 3712743943 + .long 2356773214 + .long 1995177638 + .long 1132588444 + .long 1959425557 + .long 2466886350 + .long 1844669961 + .long 3530525712 + .long 760398624 + .long 4132176514 + .long 1979460773 + .long 796554174 + .long 3170959411 + .long 3438043671 + .long 1989653354 + .long 84033345 + .long 407935807 + .long 2705661215 + .long 1743925380 + .long 3102969454 + .long 3987162576 + .long 3388329870 + .long 1765097355 + .long 2209606903 + .long 1187505799 + .long 2507493218 + .long 161532103 + .long 2079767141 + .long 2713931831 + .long 2181209439 + .long 3726577836 + .long 2678974047 + .long 4042300458 + .long 3044993725 + .long 569618662 + .long 2942019385 + .long 2267421895 + .long 3217189858 + .long 2072134893 + .long 690975306 + .long 3699981379 + .long 4279355559 + .long 3941553639 + .long 955448001 + .long 4102577460 + .long 2173892384 + .long 1871059570 + .long 2340022155 + .long 2864020166 + .long 2805153080 + .long 3271562790 + .long 928990650 + .long 4206766333 + .long 3357221519 + .long 685259147 + .long 3780305127 + .long 2513405378 + .long 4289834595 + .long 2048010913 + .long 1999500835 + .long 12816876 + .long 4227858976 + .long 255479044 + .long 3586592293 + .long 3058876998 + .long 264515361 + .long 3124897887 + .long 2490659405 + .long 1648870444 + .long 499533912 + .long 41235212 + .long 1135645 + .long 0 + .long 0 + .long 1870875844 + .long 237807939 + .long 0 + .long 0 + .long 1220251845 + .long 534075739 + .long 10 + .long 0 + .long 1566916386 + .long 2806728368 + .long 1584 + .long 0 + .long 359612094 + .long 1988210364 + .long 209791 + .long 0 + .long 4018390684 + .long 3143652161 + .long 23114812 + .long 0 + .long 1385310342 + .long 3191552623 + .long 2079730388 + .long 0 + .long 391712962 + .long 3496232483 + .long 3188676879 + .long 34 + .long 712670475 + .long 2384468018 + .long 3612170541 + .long 1928 + .long 2944407817 + .long 162857838 + .long 3871824152 + .long 79642 + .long 1897150183 + .long 2209645725 + .long 1648691441 + .long 2316814 + .long 4189666301 + .long 2103634775 + .long 2832836870 + .long 43914735 + .long 100148761 + .long 3544145710 + .long 882453749 + .long 480946030 + .long 743895637 + .long 1440146064 + .long 1167801510 + .long 2472892869 + .long 2527288726 + .long 3429197137 + .long 3389012105 + .long 3751366970 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3328931461 + .long 85211143 + .long 0 + .long 0 + .long 1806098240 + .long 3730920547 + .long 3 + .long 0 + .long 1452363271 + .long 241457122 + .long 632 + .long 0 + .long 2408523024 + .long 2523801313 + .long 87488 + .long 0 + .long 2245774023 + .long 1447128763 + .long 10087333 + .long 0 + .long 741575833 + .long 1516712297 + .long 950654827 + .long 0 + .long 188657751 + .long 2834063720 + .long 2756671478 + .long 16 + .long 1878890455 + .long 1600190830 + .long 298103694 + .long 968 + .long 2704961479 + .long 3096990934 + .long 62735862 + .long 41831 + .long 4224033960 + .long 872206772 + .long 3368762420 + .long 1269793 + .long 1493275548 + .long 4226875193 + .long 156115358 + .long 24976936 + .long 3675413693 + .long 3939858976 + .long 1188049005 + .long 281407884 + .long 4246420658 + .long 2584806369 + .long 1500891563 + .long 1472264476 + .long 3550606718 + .long 2355970614 + .long 848338822 + .long 2246143015 + .long 4294967292 + .long 0 + .long 4176598204 + .long 2421744458 + .long 12825068 + .long 4227858976 + .long 26255947 + .long 2214716320 + .long 3008850950 + .long 1148166722 + .long 3688411584 + .long 3263035913 + .long 28940749 + .long 823708345 + .long 2778463383 + .long 1133123 + .long 0 + .long 0 + .long 3375994644 + .long 239287696 + .long 0 + .long 0 + .long 1307882943 + .long 652616536 + .long 10 + .long 0 + .long 1617272991 + .long 332362201 + .long 1584 + .long 0 + .long 1120342694 + .long 786793736 + .long 208818 + .long 0 + .long 1754116211 + .long 4140995168 + .long 22886713 + .long 0 + .long 1065416575 + .long 2365212708 + .long 2045489262 + .long 0 + .long 4094841 + .long 1336050951 + .long 3805124179 + .long 33 + .long 2857461896 + .long 1181810454 + .long 3505581240 + .long 1861 + .long 317401726 + .long 1588400515 + .long 2236524720 + .long 75909 + .long 1498310037 + .long 3569634182 + .long 656796315 + .long 2175950 + .long 1147851401 + .long 3112077225 + .long 3624068591 + .long 40608505 + .long 3302439284 + .long 1412013598 + .long 1600554036 + .long 438608161 + .long 1138396370 + .long 2245711018 + .long 3467973442 + .long 2233633025 + .long 867533488 + .long 947112014 + .long 1198607031 + .long 3375241932 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1112979214 + .long 155431282 + .long 0 + .long 0 + .long 751906521 + .long 4198567473 + .long 6 + .long 0 + .long 1613582890 + .long 3858662071 + .long 1129 + .long 0 + .long 750469660 + .long 730914801 + .long 154615 + .long 0 + .long 3704035494 + .long 424802513 + .long 17595297 + .long 0 + .long 3547752153 + .long 653012047 + .long 1632696395 + .long 0 + .long 3895749118 + .long 1312132433 + .long 283540480 + .long 28 + .long 69337464 + .long 2039495909 + .long 480366968 + .long 1598 + .long 3999973752 + .long 512131576 + .long 3264765906 + .long 67376 + .long 1470627556 + .long 3527817596 + .long 506357093 + .long 1990112 + .long 1150644769 + .long 1706533685 + .long 1646793404 + .long 38078290 + .long 2272838918 + .long 315551185 + .long 931114118 + .long 418976801 + .long 799519248 + .long 833405850 + .long 3700723307 + .long 2157812839 + .long 1885423178 + .long 2894024424 + .long 986247108 + .long 3272778907 + .long 4294967291 + .long 0 + .long 205941362 + .long 2843814473 + .long 12816876 + .long 4227858976 + .long 4284396776 + .long 2636211962 + .long 2729248679 + .long 228940808 + .long 2721630221 + .long 4033427380 + .long 3518215373 + .long 3318265016 + .long 1583232401 + .long 1129188 + .long 0 + .long 0 + .long 2240090200 + .long 238747566 + .long 0 + .long 0 + .long 2182354368 + .long 422793662 + .long 10 + .long 0 + .long 2344384525 + .long 3611967473 + .long 1569 + .long 0 + .long 2363261376 + .long 55742926 + .long 206011 + .long 0 + .long 2169713945 + .long 2081106389 + .long 22457193 + .long 0 + .long 808249952 + .long 3928968053 + .long 1994189663 + .long 0 + .long 2498399120 + .long 610170797 + .long 3374767919 + .long 32 + .long 2499128949 + .long 806866088 + .long 2667994898 + .long 1785 + .long 1293127093 + .long 1533235693 + .long 3364558966 + .long 72094 + .long 3484449920 + .long 4142457389 + .long 393414345 + .long 2045553 + .long 1815566734 + .long 3205349654 + .long 1699048752 + .long 37804868 + .long 885836718 + .long 797019709 + .long 3601921623 + .long 405043970 + .long 1414187968 + .long 4238799387 + .long 2244838147 + .long 2051616278 + .long 2091776204 + .long 3735546130 + .long 1436809887 + .long 3093461814 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 194035164 + .long 141017056 + .long 0 + .long 0 + .long 3307569967 + .long 1206991859 + .long 6 + .long 0 + .long 3663448937 + .long 3391377880 + .long 1007 + .long 0 + .long 4126701083 + .long 2994857527 + .long 136467 + .long 0 + .long 1667733955 + .long 4058943102 + .long 15345719 + .long 0 + .long 2611265876 + .long 3831769830 + .long 1404776386 + .long 0 + .long 209321266 + .long 573187068 + .long 3359330694 + .long 23 + .long 1677262110 + .long 637572110 + .long 2122511782 + .long 1331 + .long 3496561941 + .long 3652813901 + .long 3559168047 + .long 55128 + .long 1750715127 + .long 4228815409 + .long 1050316 + .long 1598795 + .long 1840387030 + .long 2463042611 + .long 3094434052 + .long 30079053 + .long 2629602118 + .long 2049759618 + .long 945167723 + .long 326505049 + .long 3298129216 + .long 3410065465 + .long 1686243051 + .long 1666911635 + .long 3383305094 + .long 1693255217 + .long 2403972032 + .long 2519963779 + .long 4294967291 + .long 0 + .long 3238416553 + .long 3265778049 + .long 12825068 + .long 4227858976 + .long 3177200532 + .long 3057752043 + .long 1963397648 + .long 3926923754 + .long 1015831100 + .long 3054277238 + .long 214260357 + .long 3388682645 + .long 329260597 + .long 1120080 + .long 0 + .long 0 + .long 1129382972 + .long 236791308 + .long 0 + .long 0 + .long 200550114 + .long 4225205647 + .long 9 + .long 0 + .long 3987740840 + .long 662463985 + .long 1546 + .long 0 + .long 3625695977 + .long 942803776 + .long 202014 + .long 0 + .long 4082097994 + .long 2934588234 + .long 21910543 + .long 0 + .long 2081364333 + .long 826431917 + .long 1934499234 + .long 0 + .long 1761358361 + .long 1915853684 + .long 2581201468 + .long 31 + .long 1458338458 + .long 480335293 + .long 641318311 + .long 1709 + .long 2934587087 + .long 1935466844 + .long 4209158963 + .long 68508 + .long 2290297886 + .long 2520183995 + .long 2347470795 + .long 1930078 + .long 1214972608 + .long 3678131539 + .long 56536087 + .long 35444212 + .long 1624218450 + .long 2947499939 + .long 75007111 + .long 377830189 + .long 794554122 + .long 1484978356 + .long 1550658172 + .long 1907426674 + .long 1950966402 + .long 3741059307 + .long 468440577 + .long 2872207806 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2513119405 + .long 255601926 + .long 0 + .long 0 + .long 1340053149 + .long 1293535308 + .long 11 + .long 0 + .long 2520596056 + .long 243966073 + .long 1798 + .long 0 + .long 1240269441 + .long 1692289976 + .long 241208 + .long 0 + .long 486505533 + .long 4176826391 + .long 26843964 + .long 0 + .long 1085031321 + .long 2229862700 + .long 2429583838 + .long 0 + .long 3607912919 + .long 1284443184 + .long 2708483256 + .long 40 + .long 4286170020 + .long 2109173108 + .long 2872722597 + .long 2245 + .long 3765965368 + .long 2873757161 + .long 2280026745 + .long 91776 + .long 975034122 + .long 907445528 + .long 4183785771 + .long 2628820 + .long 2401876752 + .long 1790794470 + .long 4120636181 + .long 48923208 + .long 3456079977 + .long 3312351896 + .long 2533182876 + .long 526592659 + .long 300202939 + .long 3214183676 + .long 2700781633 + .long 2674019932 + .long 3409370037 + .long 142796896 + .long 590138558 + .long 4034348900 + .long 4294967290 + .long 0 + .long 2441521498 + .long 242594037 + .long 2326542 + .long 4227858728 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 292802143 + .long 2930268 + .long 0 + .long 0 + .long 535415153 + .long 618901269 + .long 0 + .long 0 + .long 1086559041 + .long 2797303288 + .long 25 + .long 0 + .long 4140762130 + .long 803311064 + .long 3903 + .long 0 + .long 3260682281 + .long 805348165 + .long 501094 + .long 0 + .long 946699523 + .long 2655018074 + .long 53417808 + .long 0 + .long 3184188054 + .long 357148693 + .long 343191017 + .long 1 + .long 2991785955 + .long 1885266767 + .long 2475080337 + .long 74 + .long 3202232014 + .long 1390745085 + .long 1906741299 + .long 3974 + .long 2460394114 + .long 145617371 + .long 1237048646 + .long 157131 + .long 2499420999 + .long 890518540 + .long 2984098479 + .long 4365826 + .long 4044160094 + .long 3502963765 + .long 4084883256 + .long 78771967 + .long 1855836510 + .long 1773383726 + .long 696038818 + .long 812348145 + .long 1371130586 + .long 4224739114 + .long 2913286396 + .long 3734813411 + .long 3022964429 + .long 4251306649 + .long 3856945722 + .long 3368235169 + .long 4294967295 + .long 0 + .long 3259021111 + .long 321006842 + .long 29835651 + .long 528 + .long 4287764257 + .long 2359162534 + .long 538435925 + .long 1893177075 + .long 2620595140 + .long 1125567552 + .long 2991073306 + .long 2159239491 + .long 623213113 + .long 2440954329 + .long 3454983919 + .long 2690441248 + .long 1981777827 + .long 3070641374 + .long 600396448 + .long 3989904562 + .long 503111015 + .long 2398913263 + .long 3729609173 + .long 2560895207 + .long 4264522276 + .long 1827510236 + .long 1453587439 + .long 2856034995 + .long 3530335573 + .long 2910390539 + .long 3830755809 + .long 3395214488 + .long 581887236 + .long 170861812 + .long 3783767784 + .long 3801720292 + .long 3874334995 + .long 3776894534 + .long 3941576344 + .long 4151651145 + .long 672178724 + .long 1876155966 + .long 2300153670 + .long 2280168405 + .long 2930820789 + .long 310363638 + .long 2337608734 + .long 2504022121 + .long 679615860 + .long 1866145491 + .long 925134179 + .long 2749395452 + .long 4164495461 + .long 1691717726 + .long 3504269286 + .long 3018609133 + .long 4091749652 + .long 2913918638 + .long 75440378 + .long 3313861766 + .long 2260863989 + .long 1783565696 + .long 3478989690 + .long 3637556251 + .long 386210930 + .long 165743778 + .long 2898550894 + .long 3992273458 + .long 138300613 + .long 2474605972 + .long 1444508693 + .long 2190379430 + .long 3716173044 + .long 211495398 + .long 2076026756 + .long 2402948622 + .long 884026613 + .long 3273453185 + .long 2774793032 + .long 2635331838 + .long 862601524 + .long 3461868441 + .long 1569319307 + .long 2889017487 + .long 2379289701 + .long 4014175908 + .long 4105967090 + .long 3165345439 + .long 4280005796 + .long 3658970897 + .long 1734788832 + .long 3465258574 + .long 1142155173 + .long 2128929843 + .long 1454912392 + .long 3791483352 + .long 1572825138 + .long 4100167805 + .long 2209491991 + .long 4149468636 + .long 1302034421 + .long 2240019943 + .long 2903825538 + .long 2241250238 + .long 1470684676 + .long 2909933371 + .long 1614391894 + .long 2346034557 + .long 3663942245 + .long 150553254 + .long 581996432 + .long 2853498413 + .long 2851485478 + .long 1062112106 + .long 2360862824 + .long 4080591848 + .long 3037166561 + .long 3942859811 + .long 2491765597 + .long 2637624859 + .long 3670749589 + .long 1175994297 + .long 2568760650 + .long 2257943156 + .long 4233645441 + .long 2769385451 + .long 3183971100 + .long 4072128784 + .long 1432427446 + .long 3380851706 + .long 2013943478 + .long 2236760609 + .long 4221662466 + .long 494326959 + .long 27640328 + .long 432 + .long 4152930537 + .long 3261335210 + .long 1647304022 + .long 2421513631 + .long 0 + .long 2182303040 + .long 2 + .long 0 + .long 2440707372 + .long 2648025301 + .long 1920343642 + .long 4033309261 + .long 228472035 + .long 951557190 + .long 1587559315 + .long 2974493459 + .long 2596925677 + .long 961292909 + .long 2340517507 + .long 4069972126 + .long 3800775586 + .long 2435894136 + .long 1723862257 + .long 2750240234 + .long 1983413582 + .long 438211295 + .long 1298530652 + .long 3389699362 + .long 2457352961 + .long 2834143237 + .long 3251433817 + .long 4162244914 + .long 2624345295 + .long 2198133979 + .long 1723202388 + .long 2299670239 + .long 3808420354 + .long 1821904843 + .long 3390094422 + .long 2531701946 + .long 1851152974 + .long 2701629785 + .long 1724191120 + .long 2482272915 + .long 648872229 + .long 865545185 + .long 2559674717 + .long 2406027884 + .long 910915727 + .long 2144582723 + .long 1642929274 + .long 4137212570 + .long 2336042754 + .long 239465408 + .long 3865561517 + .long 3439416156 + .long 2422534192 + .long 3569472253 + .long 2978472155 + .long 2559905612 + .long 2875291331 + .long 4046158321 + .long 3949085588 + .long 3503570860 + .long 2128927569 + .long 1225899162 + .long 2147335523 + .long 2230618794 + .long 2283389284 + .long 1333752198 + .long 1465231956 + .long 2336128911 + .long 2753251442 + .long 2966939997 + .long 2922138241 + .long 2536578790 + .long 2666112773 + .long 3385813147 + .long 623901210 + .long 3462131994 + .long 668414005 + .long 3701008851 + .long 3126176950 + .long 3345113301 + .long 358440900 + .long 3717742396 + .long 3947881290 + .long 3263003015 + .long 2610140914 + .long 3090322344 + .long 447998310 + .long 4170300383 + .long 397141160 + .long 2942373728 + .long 3824192808 + .long 2641349034 + .long 2658982609 + .long 4233303079 + .long 2524818000 + .long 3312990274 + .long 228893295 + .long 2515147602 + .long 3476745001 + .long 2698739548 + .long 2970265182 + .long 931672352 + .long 30032391 + .long 720 + .long 1031893951 + .long 2915037812 + .long 3514686481 + .long 3480585297 + .long 183393903 + .long 2624056858 + .long 28546027 + .long 1683875686 + .long 92539635 + .long 470440642 + .long 3104544566 + .long 2542111380 + .long 2423082850 + .long 4223302981 + .long 1880783390 + .long 3172707188 + .long 2733291596 + .long 4028584963 + .long 3133521808 + .long 2155982074 + .long 1545518760 + .long 2360167907 + .long 1514977624 + .long 3361750727 + .long 1775829359 + .long 1268098089 + .long 293245362 + .long 2922889930 + .long 4260567272 + .long 2130738070 + .long 78442230 + .long 3811451694 + .long 3185114409 + .long 1528069252 + .long 1469017227 + .long 3009687218 + .long 817620842 + .long 541098266 + .long 3429120157 + .long 3247469802 + .long 1386496969 + .long 2684347079 + .long 284179228 + .long 4184596161 + .long 3638765322 + .long 371021313 + .long 2606681771 + .long 2672602875 + .long 1153440841 + .long 681666828 + .long 2588485140 + .long 3667250000 + .long 2323000426 + .long 796579017 + .long 4170606170 + .long 2503045697 + .long 3134166249 + .long 3700272898 + .long 3134839549 + .long 3388945252 + .long 703661802 + .long 1462722757 + .long 1341451622 + .long 2296227379 + .long 443948971 + .long 1838486354 + .long 1829780795 + .long 3113397699 + .long 3423557800 + .long 3677683794 + .long 2988390605 + .long 4220311422 + .long 2364782699 + .long 377168398 + .long 988912816 + .long 2859792771 + .long 2272449576 + .long 2425114493 + .long 3394168911 + .long 3875037301 + .long 2614813611 + .long 1136311064 + .long 3219605340 + .long 2624778863 + .long 2109052744 + .long 2469309985 + .long 1975730813 + .long 3554907757 + .long 1295201579 + .long 391105893 + .long 1554957189 + .long 2406549547 + .long 576394664 + .long 1543244524 + .long 1882413337 + .long 3257006239 + .long 1017054059 + .long 1977139902 + .long 2097363325 + .long 2203699043 + .long 1908366122 + .long 67963273 + .long 641406479 + .long 2982177629 + .long 3746196521 + .long 1016392834 + .long 2077695946 + .long 4016838075 + .long 2069372298 + .long 3280381472 + .long 2122130600 + .long 2685921991 + .long 1883255817 + .long 3264982359 + .long 4098768927 + .long 3758603957 + .long 3506210954 + .long 1836307129 + .long 2822017765 + .long 2764063917 + .long 2012804049 + .long 1836928984 + .long 1054120456 + .long 2619585574 + .long 1055724672 + .long 2194227394 + .long 2447214543 + .long 2687690031 + .long 1327427687 + .long 1655178620 + .long 3028234167 + .long 3556180690 + .long 2927424394 + .long 229520228 + .long 65594667 + .long 3227047264 + .long 1689555076 + .long 4247943379 + .long 172770419 + .long 3675678736 + .long 657796043 + .long 288113065 + .long 2256116365 + .long 2460956283 + .long 2381283399 + .long 3352776929 + .long 3687288864 + .long 3224422563 + .long 672976042 + .long 857803139 + .long 2956970725 + .long 3269238901 + .long 2326138918 + .long 3946484787 + .long 3349422960 + .long 2579382025 + .long 3310332749 + .long 822582390 + .long 2446752418 + .long 2381540812 + .long 4287345289 + .long 449373617 + .long 1629474989 + .long 2287047921 + .long 3156879118 + .long 2932312680 + .long 4059116599 + .long 3501115759 + .long 2653478600 + .long 1047527497 + .long 2387670671 + .long 2153577515 + .long 4278907533 + .long 1522300626 + .long 2248985742 + .long 2923309751 + .long 2050095503 + .long 1358740372 + .long 29884806 + .long 576 + .long 189636935 + .long 2307472755 + .long 73850715 + .long 2629855449 + .long 3883672823 + .long 618265067 + .long 3875053116 + .long 3917969758 + .long 1449807750 + .long 2492768441 + .long 781111022 + .long 3190435238 + .long 1482976409 + .long 3746699123 + .long 673296220 + .long 2543135664 + .long 1097012132 + .long 2731166546 + .long 2691838079 + .long 3591085575 + .long 4108503415 + .long 2072634685 + .long 3936623385 + .long 2185856579 + .long 1923690262 + .long 3646023575 + .long 4216469600 + .long 2465929342 + .long 431460727 + .long 596938224 + .long 2153081083 + .long 2604407262 + .long 2280668022 + .long 3134357508 + .long 2589033740 + .long 2773504679 + .long 2807242375 + .long 2817121462 + .long 2773778968 + .long 2997091783 + .long 1733040470 + .long 818736373 + .long 2513276750 + .long 3273702286 + .long 3677662487 + .long 322072717 + .long 1865747051 + .long 3233516951 + .long 2915555540 + .long 937584400 + .long 659945040 + .long 2820584615 + .long 2133192181 + .long 2691571362 + .long 4196086611 + .long 2727659532 + .long 896759672 + .long 1769906504 + .long 3035342266 + .long 2750209132 + .long 1576632880 + .long 1478621509 + .long 1238707153 + .long 3507491969 + .long 126298229 + .long 3524093915 + .long 2681332129 + .long 2656870434 + .long 2282193125 + .long 2123250942 + .long 2537777848 + .long 2313555892 + .long 2236573588 + .long 3014805274 + .long 1599407648 + .long 4251279069 + .long 1359728578 + .long 2438133930 + .long 1558056398 + .long 2562927734 + .long 3023480919 + .long 1448378982 + .long 1701562892 + .long 2340149056 + .long 1506041285 + .long 779806113 + .long 4234929211 + .long 2470659521 + .long 3801687606 + .long 3749889093 + .long 4112153792 + .long 4129315601 + .long 3087235106 + .long 3558690450 + .long 4001893244 + .long 3474539130 + .long 508945001 + .long 2957303106 + .long 3788800591 + .long 2700334225 + .long 1697795651 + .long 4047812965 + .long 4036703836 + .long 3519182687 + .long 4240516712 + .long 1475971627 + .long 1575184661 + .long 2515949915 + .long 1673437412 + .long 2377231640 + .long 3395057130 + .long 2344040799 + .long 1065264411 + .long 1317525997 + .long 664446688 + .long 3082671496 + .long 1521403251 + .long 50174553 + .long 2566979079 + .long 3666263822 + .long 3888565980 + .long 425393181 + .long 383974 + .long 2211658859 + .long 3190477332 + .long 1452652764 + .long 881590408 + .long 2658571543 + .long 2768922591 + .long 607349007 + .long 1340513656 + .long 2982866930 + .long 2042743989 + .long 2907958666 + .long 2030930082 + .long 2170145182 + .long 1493033626 + .long 3329402172 + .long 1968890141 + .long 2331822590 + .long 2408886146 + .long 1783184274 + .long 12825068 + .long 4227858976 + .long 2710581281 + .long 3153889734 + .long 3238022506 + .long 4176533952 + .long 1531340198 + .long 4025201404 + .long 2485789300 + .long 650490227 + .long 2321085797 + .long 625172 + .long 0 + .long 0 + .long 1069281709 + .long 251624587 + .long 0 + .long 0 + .long 4197074614 + .long 91585281 + .long 10 + .long 0 + .long 2135656897 + .long 267376913 + .long 1588 + .long 0 + .long 3403656332 + .long 967418652 + .long 209472 + .long 0 + .long 463318414 + .long 1993660658 + .long 23089564 + .long 0 + .long 1930917064 + .long 2053446879 + .long 2077215423 + .long 0 + .long 657157488 + .long 2477268698 + .long 3166180846 + .long 34 + .long 1532275274 + .long 3903843069 + .long 3017665745 + .long 1932 + .long 3296114418 + .long 3153699036 + .long 1621212020 + .long 80134 + .long 1258014930 + .long 2176092298 + .long 1175504463 + .long 2347208 + .long 1382073311 + .long 570037013 + .long 1129603108 + .long 44970025 + .long 2202866424 + .long 1579426883 + .long 3017508354 + .long 499448209 + .long 4088025423 + .long 891205158 + .long 1193661411 + .long 2604580528 + .long 2532457727 + .long 3946349630 + .long 1951385266 + .long 3993662730 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2589520468 + .long 104644116 + .long 0 + .long 0 + .long 3884787564 + .long 2761065855 + .long 3 + .long 0 + .long 3187602994 + .long 4135562377 + .long 626 + .long 0 + .long 1724989792 + .long 1713856870 + .long 86304 + .long 0 + .long 2484708115 + .long 4089533751 + .long 10036248 + .long 0 + .long 275209371 + .long 2697520380 + .long 952228456 + .long 0 + .long 3236472558 + .long 1226316501 + .long 3598685087 + .long 16 + .long 3284813591 + .long 1063192554 + .long 3944393543 + .long 991 + .long 1278466978 + .long 2628971736 + .long 1168074903 + .long 43599 + .long 848711725 + .long 2087159795 + .long 759297680 + .long 1353656 + .long 1425592604 + .long 1129358307 + .long 2754552431 + .long 27432831 + .long 3204498819 + .long 300826889 + .long 3605445756 + .long 320203780 + .long 1698536723 + .long 3065896691 + .long 309908814 + .long 1734061231 + .long 3912468499 + .long 396401915 + .long 3674073704 + .long 2719285114 + .long 4294967292 + .long 0 + .long 3981914375 + .long 2206547233 + .long 12816876 + .long 4227858976 + .long 4096021827 + .long 3999001670 + .long 1063371522 + .long 3989528078 + .long 874562813 + .long 2447814409 + .long 1858302676 + .long 4162682718 + .long 1605953959 + .long 1135435 + .long 0 + .long 0 + .long 2549031326 + .long 239160205 + .long 0 + .long 0 + .long 454697744 + .long 620180210 + .long 10 + .long 0 + .long 2436299213 + .long 3355768607 + .long 1582 + .long 0 + .long 351390256 + .long 799610387 + .long 208707 + .long 0 + .long 25800287 + .long 698915934 + .long 22891066 + .long 0 + .long 4130988338 + .long 676217935 + .long 2048657779 + .long 0 + .long 2657270905 + .long 3829767903 + .long 59128891 + .long 34 + .long 1037582638 + .long 2935003680 + .long 713523288 + .long 1875 + .long 901580945 + .long 1268517119 + .long 2358220346 + .long 76826 + .long 1912766477 + .long 222206216 + .long 632792841 + .long 2216812 + .long 4065471431 + .long 1410808044 + .long 2022595908 + .long 41710361 + .long 438075994 + .long 598703158 + .long 1085011105 + .long 454516776 + .long 604410846 + .long 4058435110 + .long 2236814241 + .long 2333657313 + .long 2448294355 + .long 2704068860 + .long 1114425723 + .long 3548452336 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3769919769 + .long 153956907 + .long 0 + .long 0 + .long 646070119 + .long 4028818701 + .long 6 + .long 0 + .long 2588679469 + .long 1052177761 + .long 1128 + .long 0 + .long 2209274989 + .long 523514771 + .long 155204 + .long 0 + .long 2126396778 + .long 3565792859 + .long 17775584 + .long 0 + .long 2013180833 + .long 1908602229 + .long 1662519428 + .long 0 + .long 3793993839 + .long 1441646378 + .long 3693455390 + .long 28 + .long 3379423244 + .long 3965194379 + .long 1988414356 + .long 1663 + .long 1712981619 + .long 805217952 + .long 1789525478 + .long 71195 + .long 1327601011 + .long 2853644807 + .long 2041759317 + .long 2141557 + .long 944030315 + .long 2463564559 + .long 1071870408 + .long 41839542 + .long 3377497270 + .long 1387686562 + .long 1015294515 + .long 470457582 + .long 3802633795 + .long 4019363939 + .long 1055805497 + .long 2472026772 + .long 1903142729 + .long 1756051618 + .long 411357926 + .long 3811072860 + .long 4294967291 + .long 0 + .long 2342180209 + .long 2629357739 + .long 12825068 + .long 4227858976 + .long 4176598204 + .long 2421744458 + .long 608412369 + .long 593975024 + .long 2402997778 + .long 853372562 + .long 4106233885 + .long 999432807 + .long 1956711771 + .long 1129902 + .long 0 + .long 0 + .long 3668311682 + .long 238634701 + .long 0 + .long 0 + .long 1969498866 + .long 413457374 + .long 10 + .long 0 + .long 2816017558 + .long 1616523229 + .long 1570 + .long 0 + .long 3757647515 + .long 3035182130 + .long 206269 + .long 0 + .long 2187487164 + .long 1784472528 + .long 22516356 + .long 0 + .long 559031239 + .long 1740008181 + .long 2003371129 + .long 0 + .long 661394403 + .long 1757559962 + .long 108872688 + .long 33 + .long 2108184885 + .long 2675738113 + .long 243072689 + .long 1805 + .long 1896660970 + .long 944386947 + .long 1395829566 + .long 73206 + .long 2645692570 + .long 1073605584 + .long 391090218 + .long 2088195 + .long 3576186609 + .long 249080280 + .long 1318613440 + .long 38820429 + .long 1698387538 + .long 1714182690 + .long 2486672428 + .long 418377280 + .long 786186663 + .long 550325920 + .long 34733209 + .long 2130294753 + .long 123703415 + .long 1830333669 + .long 555170427 + .long 3225161241 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 372615672 + .long 141112893 + .long 0 + .long 0 + .long 3315900643 + .long 1327290262 + .long 6 + .long 0 + .long 3811139837 + .long 3724885846 + .long 1016 + .long 0 + .long 989130504 + .long 3252199933 + .long 138436 + .long 0 + .long 1221640456 + .long 1442402103 + .long 15666709 + .long 0 + .long 4152936768 + .long 1813348380 + .long 1445091735 + .long 0 + .long 4193896088 + .long 3387134533 + .long 2948009907 + .long 24 + .long 2262704738 + .long 1989650954 + .long 3803792063 + .long 1396 + .long 2783464578 + .long 434957745 + .long 1316597970 + .long 58551 + .long 1368551733 + .long 528983851 + .long 2424303193 + .long 1721511 + .long 2488297655 + .long 3464245304 + .long 3652031881 + .long 32861225 + .long 3506409524 + .long 3965838759 + .long 4041530878 + .long 361842100 + .long 1191665382 + .long 3299555859 + .long 1239122770 + .long 1871471448 + .long 3889602930 + .long 4175372373 + .long 3489971328 + .long 2859914059 + .long 4294967291 + .long 0 + .long 4097644266 + .long 3051847358 + .long 12816876 + .long 4227858976 + .long 205941362 + .long 2843814473 + .long 1373054629 + .long 908624394 + .long 572230967 + .long 3772158671 + .long 2295107357 + .long 875890232 + .long 1676909203 + .long 1121011 + .long 0 + .long 0 + .long 3140758008 + .long 236890113 + .long 0 + .long 0 + .long 78883718 + .long 4270561461 + .long 9 + .long 0 + .long 653004353 + .long 1003106748 + .long 1549 + .long 0 + .long 1997655276 + .long 2810156938 + .long 202673 + .long 0 + .long 816790074 + .long 126500350 + .long 22018895 + .long 0 + .long 483718758 + .long 1693602023 + .long 1948244742 + .long 0 + .long 1719888843 + .long 3024114415 + .long 3912173698 + .long 31 + .long 857585795 + .long 2024050081 + .long 2152155389 + .long 1731 + .long 2161391665 + .long 4153338473 + .long 3453597175 + .long 69665 + .long 690916841 + .long 3408680089 + .long 1481878010 + .long 1970802 + .long 4244781337 + .long 1956485181 + .long 3004849658 + .long 36347304 + .long 3508046261 + .long 2375922782 + .long 3796433011 + .long 389053187 + .long 1871421647 + .long 319248902 + .long 2844007792 + .long 1971197416 + .long 814256252 + .long 534724998 + .long 4096580698 + .long 2976687819 + .long 4294967295 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1862921762 + .long 128829141 + .long 0 + .long 0 + .long 2226943868 + .long 3083060057 + .long 5 + .long 0 + .long 3790004556 + .long 3473372331 + .long 913 + .long 0 + .long 1912405170 + .long 4207391429 + .long 123223 + .long 0 + .long 2818206388 + .long 546560525 + .long 13795947 + .long 0 + .long 926024359 + .long 466562391 + .long 1257280106 + .long 0 + .long 3443963035 + .long 4102181261 + .long 824629355 + .long 21 + .long 1095781235 + .long 2590304783 + .long 3003378070 + .long 1181 + .long 3706684271 + .long 2607807817 + .long 1026954074 + .long 48765 + .long 2542600140 + .long 2410120938 + .long 1491060906 + .long 1411271 + .long 1675138874 + .long 3651173547 + .long 1198416212 + .long 26539599 + .long 842200953 + .long 401492709 + .long 2211503215 + .long 288538794 + .long 1943642431 + .long 940486719 + .long 4288006473 + .long 1478519853 + .long 2666730960 + .long 3798148012 + .long 941219805 + .long 2247821888 + .long 4294967291 + .long 0 + .long 3590128009 + .long 612654688 + .long 716769122 + .long 2 + .long 1828204245 + .long 1775926740 + .long 862431319 + .long 1672 + .long 437955120 + .long 677313132 + .long 3681074436 + .long 185717 + .long 2884200252 + .long 2090641138 + .long 3992138721 + .long 6428191 + .long 3221531446 + .long 2371910721 + .long 4237081542 + .long 91796659 + .long 3709028830 + .long 1986863955 + .long 2283696654 + .long 618613015 + .long 1322699753 + .long 485003501 + .long 4170891366 + .long 2092077992 + .long 1956040154 + .long 1117518145 + .long 962574367 + .long 3571830532 + .long 3307700780 + .long 4011234461 + .long 1774218710 + .long 2881343143 + .long 391584861 + .long 529954976 + .long 2825691418 + .long 856722023 + .long 0 + .long 0 + .long 3298396499 + .long 2495110602 + .long 2303999958 + .long 1 + .long 2542348583 + .long 3627482097 + .long 3224340298 + .long 1074 + .long 967783320 + .long 1406672934 + .long 4087851085 + .long 117404 + .long 4177416572 + .long 3106181469 + .long 261241013 + .long 4043478 + .long 202539330 + .long 3294545774 + .long 2496277142 + .long 57629426 + .long 720582238 + .long 1814713548 + .long 3091376339 + .long 388014697 + .long 146526450 + .long 4271301162 + .long 2338306966 + .long 1311627297 + .long 2070656804 + .long 1921999658 + .long 2258254113 + .long 2238807899 + .long 242296837 + .long 3253310178 + .long 207686852 + .long 1805761504 + .long 0 + .long 0 + .long 0 + .long 536870912 + .long 3 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3266800725 + .long 2413762801 + .long 3330613244 + .long 98 + .long 1201359419 + .long 2714872150 + .long 3208385380 + .long 20210 + .long 1956238602 + .long 4223228119 + .long 2784422263 + .long 1028397 + .long 3439473030 + .long 2410851869 + .long 3292470576 + .long 20253447 + .long 1686397776 + .long 592553810 + .long 969547707 + .long 185741930 + .long 3468583933 + .long 1250725515 + .long 2117116206 + .long 869064170 + .long 3909100790 + .long 1843251452 + .long 3871208694 + .long 2155104570 + .long 4148130288 + .long 2464912491 + .long 1300300682 + .long 2809133898 + .long 4014582188 + .long 344247779 + .long 2796123058 + .long 1784697576 + .long 195792426 + .long 264977488 + .long 3560329357 + .long 428361011 + .long 4294967290 + .long 0 + .long 258978617 + .long 1401350217 + .long 414758348 + .long 0 + .long 3858563520 + .long 693344438 + .long 929988021 + .long 164 + .long 3412169140 + .long 2002911005 + .long 1900957617 + .long 27838 + .long 201299732 + .long 2653786175 + .long 836100553 + .long 1342443 + .long 112595646 + .long 24843945 + .long 2773043450 + .long 25894040 + .long 839565763 + .long 2401088019 + .long 1862800896 + .long 235227666 + .long 241900887 + .long 2111181527 + .long 559246656 + .long 1095314964 + .long 1679323588 + .long 170716610 + .long 3844392689 + .long 2709031418 + .long 2888224069 + .long 91827283 + .long 2484028115 + .long 3525834755 + .long 3046356865 + .long 465368430 + .long 2789327597 + .long 2238015503 + .long 0 + .long 0 + .long 0 + .long 536870912 + .long 3 + .long 0 + .long 1629800756 + .long 211083125 + .long 74954925 + .long 0 + .long 1545370875 + .long 1864504884 + .long 4276848488 + .long 99 + .long 535444102 + .long 452832597 + .long 341934841 + .long 25395 + .long 995111971 + .long 3604718273 + .long 313159131 + .long 1483348 + .long 467529526 + .long 927033629 + .long 3631579950 + .long 30995691 + .long 2550211567 + .long 3003753623 + .long 1495846756 + .long 281435025 + .long 1095077789 + .long 2892497672 + .long 2221613791 + .long 1215372727 + .long 1191801615 + .long 1667552124 + .long 2428434537 + .long 2551716115 + .long 1201465291 + .long 1874197394 + .long 578557072 + .long 2461680298 + .long 391584923 + .long 529954976 + .long 2825691418 + .long 856722023 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 677405811 + .long 113109491 + .long 129649144 + .long 114 + .long 3825428504 + .long 3691782001 + .long 3484121609 + .long 31057 + .long 2790365057 + .long 1503600960 + .long 2128362517 + .long 1842108 + .long 1815120706 + .long 3864377339 + .long 1520525307 + .long 38689413 + .long 2352056310 + .long 3376817110 + .long 3997253088 + .long 352036787 + .long 1198120374 + .long 2050750776 + .long 3970142361 + .long 1521787235 + .long 3363842978 + .long 1133863107 + .long 832963017 + .long 3196692150 + .long 3821983599 + .long 1263968260 + .long 873004851 + .long 3084767199 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 2 + .long 0 + .long 2651322308 + .long 3386393833 + .long 2831116449 + .long 5 + .long 4289850283 + .long 2368640529 + .long 3021143330 + .long 3284 + .long 1866387201 + .long 153493322 + .long 2018528397 + .long 295326 + .long 712913332 + .long 628654228 + .long 3881360594 + .long 8668773 + .long 2507640802 + .long 239249479 + .long 2566710297 + .long 108181087 + .long 2758175823 + .long 567857163 + .long 2134567225 + .long 650389544 + .long 3640757112 + .long 2804269303 + .long 645858985 + .long 1991928169 + .long 804414238 + .long 2280600022 + .long 3914463340 + .long 3114948090 + .long 1937917503 + .long 2252804771 + .long 1940556944 + .long 2322010631 + .long 293688586 + .long 2544949880 + .long 3193010387 + .long 642541517 + .long 4294967291 + .long 0 + .long 453133727 + .long 877370797 + .long 1558279443 + .long 6 + .long 2547899573 + .long 3360184680 + .long 1178296802 + .long 2954 + .long 1755214995 + .long 2061159704 + .long 3531983056 + .long 253712 + .long 543505238 + .long 128612626 + .long 629116815 + .long 7334610 + .long 100838038 + .long 3022980312 + .long 2298747174 + .long 90954203 + .long 3014766307 + .long 96539771 + .long 3590315363 + .long 545180116 + .long 2964798914 + .long 2705356255 + .long 3013291713 + .long 1667101568 + .long 3407956254 + .long 2146783552 + .long 2206958848 + .long 2604739160 + .long 1922050233 + .long 3165283613 + .long 2563978608 + .long 1940712607 + .long 0 + .long 0 + .long 0 + .long 536870912 + .long 3 + .long 0 + .long 2797952740 + .long 3054806814 + .long 120 + .long 0 + .long 18168 + .long 0 + .long 1890690921 + .long 3263011055 + .long 3960 + .long 0 + .long 18872 + .long 0 + .long 3238416553 + .long 3265778049 + .long 8064 + .long 0 + .long 18168 + .long 0 + .long 4097644266 + .long 3051847358 + .long 13440 + .long 0 + .long 18872 + .long 0 + .long 0 + .long 0 + .long 1313084713 + .long 2734261102 + .long 4113882560 + .long 4230436817 + .long 0 + .long 4294967295 + .long 4105493977 + .long 3790490747 + .long 2885543867 + .long 1813033052 + .long 0 + .long 0 + .type __bessel_x_table,@object + .size __bessel_x_table,19696 + .align 8 +.L_2il0floatpacket.96: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.96,@object + .size .L_2il0floatpacket.96,8 + .align 8 +.L_2il0floatpacket.97: + .long 0x5a31a4be,0x3ff71547 + .type .L_2il0floatpacket.97,@object + .size .L_2il0floatpacket.97,8 + .align 8 +.L_2il0floatpacket.98: + .long 0x9a49f2dc,0x400d3643 + .type .L_2il0floatpacket.98,@object + .size .L_2il0floatpacket.98,8 + .align 8 +.L_2il0floatpacket.99: + .long 0x00000000,0x40d00000 + .type .L_2il0floatpacket.99,@object + .size .L_2il0floatpacket.99,8 + .align 8 +.L_2il0floatpacket.100: + .long 0x00000000,0xc0d01b80 + .type .L_2il0floatpacket.100,@object + .size .L_2il0floatpacket.100,8 + .align 8 +.L_2il0floatpacket.104: + .long 0x20000000,0x405cdc55 + .type .L_2il0floatpacket.104,@object + .size .L_2il0floatpacket.104,8 + .align 8 +.L_2il0floatpacket.105: + .long 0x00000000,0x40140000 + .type .L_2il0floatpacket.105,@object + .size .L_2il0floatpacket.105,8 + .align 8 +.L_2il0floatpacket.106: + .long 0xe0000000,0x3fefffff + .type .L_2il0floatpacket.106,@object + .size .L_2il0floatpacket.106,8 + .align 8 +.L_2il0floatpacket.109: + .long 0x00000000,0x43e00000 + .type .L_2il0floatpacket.109,@object + .size .L_2il0floatpacket.109,8 + .align 8 +__bessel_error_codes: + .long 0x00000000,0x00000000 + .long 0x00000081,0x00000000 + .long 0x00000082,0x00000000 + .long 0x00000083,0x00000000 + .long 0x00000084,0x00000000 + .long 0x0000008c,0x00000000 + .long 0x00000090,0x00000000 + .long 0x0000008f,0x00000000 + .type __bessel_error_codes,@object + .size __bessel_error_codes,64 + .align 4 +.L_2il0floatpacket.101: + .long 0x410f95e2 + .type .L_2il0floatpacket.101,@object + .size .L_2il0floatpacket.101,4 + .align 4 +.L_2il0floatpacket.102: + .long 0x41a3dd91 + .type .L_2il0floatpacket.102,@object + .size .L_2il0floatpacket.102,4 + .align 4 +.L_2il0floatpacket.103: + .long 0x3fb8aa3b + .type .L_2il0floatpacket.103,@object + .size .L_2il0floatpacket.103,4 + .align 4 +.L_2il0floatpacket.107: + .long 0x5f000000 + .type .L_2il0floatpacket.107,@object + .size .L_2il0floatpacket.107,4 + .align 4 +.L_2il0floatpacket.108: + .long 0x3f800000 + .type .L_2il0floatpacket.108,@object + .size .L_2il0floatpacket.108,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/dpml_ux_log.S b/external/sgx_libm/intel64/dpml_ux_log.S new file mode 100644 index 0000000000..52001a5598 --- /dev/null +++ b/external/sgx_libm/intel64/dpml_ux_log.S @@ -0,0 +1,356 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_log.c" + .text +..TXTST0: +# -- Begin __dpml_ux_log_poly__ + .text + .align 16,0x90 + .globl __dpml_ux_log_poly__ +__dpml_ux_log_poly__: +# parameter 1: %rdi +# parameter 2: %rsi +..B1.1: + .cfi_startproc +..___tag_value___dpml_ux_log_poly__.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + movq %rsi, %r13 + lea 128+__log_x_table(%rip), %rsi + movl $17, %edx + movl $6, %ecx + movq %r13, %r8 +..___tag_value___dpml_ux_log_poly__.5: + call __dpml_evaluate_rational__@PLT +..___tag_value___dpml_ux_log_poly__.6: +..B1.2: + movq %r13, %rdi + lea 472+__log_x_table(%rip), %rsi + movq %r13, %rdx + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + jmp __dpml_multiply__@PLT + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_log_poly__,@function + .size __dpml_ux_log_poly__,.-__dpml_ux_log_poly__ + .data +# -- End __dpml_ux_log_poly__ + .text +# -- Begin __dpml_ux_log__ + .text + .align 16,0x90 + .globl __dpml_ux_log__ +__dpml_ux_log__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B2.1: + .cfi_startproc +..___tag_value___dpml_ux_log__.10: +..L11: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + subq $56, %rsp + .cfi_def_cfa_offset 96 + movq %rdi, %r13 + lea 112+__log_x_table(%rip), %r8 + movq %rdx, %r15 + movq %rsi, %r14 + lea 424+__log_x_table(%rip), %rsi + movl $6, %edx + lea (%rsp), %rcx + movl 4(%r13), %r10d + movq (%r8), %r9 + cmpq 8(%r13), %r9 + movq %fs:40, %rax + lea -1(%r10), %ebx + adcl $0, %ebx + xorq %rsp, %rax + movq %rax, 48(%rcx) + subl %ebx, %r10d + movl %r10d, 4(%r13) +..___tag_value___dpml_ux_log__.21: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_log__.22: +..B2.2: + movl $2, %edx + lea 24(%rsp), %rdi + movq %r15, %rcx + lea (%rsp), %rsi + addl %ebx, 4(%r13) +..___tag_value___dpml_ux_log__.23: + call __dpml_divide__@PLT +..___tag_value___dpml_ux_log__.24: +..B2.3: + movq %r15, %rdi + lea 128+__log_x_table(%rip), %rsi + movl $17, %edx + movl $6, %ecx + lea (%rsp), %r8 +..___tag_value___dpml_ux_log__.25: + call __dpml_evaluate_rational__@PLT +..___tag_value___dpml_ux_log__.26: +..B2.4: + movq %r15, %rdi + movl $1, %esi + movslq %ebx, %rbx + movq %rbx, 8(%r15) +..___tag_value___dpml_ux_log__.27: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_log__.28: +..B2.5: + movq %r15, %rdi + lea (%rsp), %rsi + movl $8, %edx + movq %r15, %rcx +..___tag_value___dpml_ux_log__.29: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_log__.30: +..B2.6: + testq %r14, %r14 + je ..B2.8 +..B2.7: + movq %r15, %rdi + movq %r14, %rsi + movq %r15, %rdx +..___tag_value___dpml_ux_log__.31: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_log__.32: +..B2.8: + xorl %edx, %edx + movl $1, %eax + xorl %ecx, %ecx + cmpl $-262144, 28(%rsp) + movq 48(%rsp), %rbx + cmovne %eax, %ecx + testq %r14, %r14 + cmovne %eax, %edx + xorq %rsp, %rbx + orl %edx, %ecx + cmpq %fs:40, %rbx + jne ..B2.10 +..B2.9: + movq %rcx, %rax + addq $56, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B2.10: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_log__,@function + .size __dpml_ux_log__,.-__dpml_ux_log__ + .data +# -- End __dpml_ux_log__ + .section .rodata, "a" + .align 16 + .align 16 +__log_x_table: + .long 1088750600 + .long 519758862 + .long 58 + .long 0 + .long 59 + .long 0 + .long 60 + .long 0 + .long 1088750600 + .long 519758862 + .long 61 + .long 0 + .long 62 + .long 0 + .long 63 + .long 0 + .long 1088750600 + .long 519758862 + .long 64 + .long 0 + .long 65 + .long 0 + .long 66 + .long 0 + .long 15008776 + .long 336609536 + .long 58 + .long 0 + .long 4192101508 + .long 3037000499 + .long 4243534402 + .long 1518500249 + .long 1261892956 + .long 1305769775 + .long 706307789 + .long 114052365 + .long 2125978754 + .long 1401519948 + .long 2628436525 + .long 90640697 + .long 1075745124 + .long 4046945230 + .long 850547722 + .long 100185346 + .long 3858047057 + .long 2069326047 + .long 3415016796 + .long 106820841 + .long 196219186 + .long 3461778520 + .long 1283971156 + .long 114747264 + .long 133398994 + .long 3894487089 + .long 1548005786 + .long 123926548 + .long 4002430868 + .long 3905024888 + .long 1104860464 + .long 134702783 + .long 1396868873 + .long 2152947579 + .long 2102985887 + .long 147531619 + .long 361329122 + .long 2531697111 + .long 2794113080 + .long 163061263 + .long 2117398987 + .long 2352680084 + .long 3122626672 + .long 182244941 + .long 299366278 + .long 2801833386 + .long 1248329477 + .long 206544267 + .long 99864504 + .long 1693623838 + .long 1770762254 + .long 238320308 + .long 959885721 + .long 1462617677 + .long 2483170600 + .long 281651273 + .long 2353710846 + .long 1786830293 + .long 2080549112 + .long 344240445 + .long 2781107612 + .long 1683788319 + .long 2061424959 + .long 442594858 + .long 2924123738 + .long 1498310185 + .long 3744988402 + .long 619632801 + .long 2019498699 + .long 1065527877 + .long 1946680041 + .long 1032721336 + .long 1763524233 + .long 3196583632 + .long 1545072827 + .long 3098164009 + .long 2 + .long 0 + .long 0 + .long 1 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3520035243 + .long 2977044471 + .long 66254511 + .long 3387143064 + .long 0 + .long 4294967295 + .long 4224710552 + .long 2585827972 + .long 192713080 + .long 2408143276 + .long 0 + .long 0 + .type __log_x_table,@object + .size __log_x_table,528 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/dpml_ux_ops.S b/external/sgx_libm/intel64/dpml_ux_ops.S new file mode 100644 index 0000000000..378c5da3fc --- /dev/null +++ b/external/sgx_libm/intel64/dpml_ux_ops.S @@ -0,0 +1,1405 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_ops.c" + .text +..TXTST0: +# -- Begin __dpml_unpack2__ + .text + .align 16,0x90 + .globl __dpml_unpack2__ +__dpml_unpack2__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +# parameter 7: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value___dpml_unpack2__.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + pushq %rsi + .cfi_def_cfa_offset 64 + movq %r9, %r12 + movq %r8, %r13 + movq %rcx, %rbp + movq %rsi, %r14 + xorl %esi, %esi + movq %r13, %rcx + movq %r12, %r8 + movq 64(%rsp), %r9 + movq %rdi, %r15 +..___tag_value___dpml_unpack2__.16: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___dpml_unpack2__.17: +..B1.10: + movq %rax, %rbx +..B1.2: + testq %rbx, %rbx + jl ..B1.4 +..B1.3: + testq %r14, %r14 + jne ..B1.5 +..B1.4: + movq %rbx, %rax + popq %rcx + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.5: + movq 8(%r13), %r10 + lea (,%rbx,4), %rcx + movq %r15, %rdi + movq %r14, %rsi + sarq %cl, %r10 + movq %rbp, %rdx + andq $15, %r10 + movq %r12, %r8 + movq 64(%rsp), %r9 + lea (%r13,%r10,8), %rcx +..___tag_value___dpml_unpack2__.38: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___dpml_unpack2__.39: +..B1.6: + shlq $4, %rbx + orq %rax, %rbx + movq %rbx, %rax + popq %rcx + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_unpack2__,@function + .size __dpml_unpack2__,.-__dpml_unpack2__ + .data +# -- End __dpml_unpack2__ + .text +# -- Begin __dpml_unpack_x_or_y__ + .text + .align 16,0x90 + .globl __dpml_unpack_x_or_y__ +__dpml_unpack_x_or_y__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +..B2.1: + .cfi_startproc +..___tag_value___dpml_unpack_x_or_y__.54: +..L55: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $104, %rsp + .cfi_def_cfa_offset 160 + movq %rsi, %r12 + movl $1, %r10d + xorl %r13d, %r13d + testq %r12, %r12 + movq %r8, %rbp + cmovne %r10d, %r13d + movq %rdi, %r8 + movq %rcx, %rbx + testq %r13, %r13 + movq $0x8000000000000000, %r11 + movq %fs:40, %rax + jne ..L69 + movq %r8, %rsi +..L69: + xorq %rsp, %rax + movq %rax, 96(%rsp) + movq 8(%rsi), %rax + movq %rax, %r10 + andq %rax, %r11 + shlq $15, %r10 + btsq $63, %r10 + movq (%rsi), %r14 + movq %r14, %rcx + movq %rsi, 24(%r9,%r13,8) + movq %r14, %r15 + shrq $49, %rcx + shrq $32, %r11 + lea (%r10,%r10), %rsi + orq %r14, %rsi + movq $0x1000000000000, %r14 + orq %rcx, %r10 + movq $0xffff000000000000, %rcx + movl %r11d, (%rdx) + movq %rax, %r11 + shrq $48, %r11 + andq $32767, %r11 + lea (%r14,%rax), %rdi + movq %rax, %r14 + addq %rax, %rcx + addq $-16382, %r11 + shlq $15, %r15 + shrq $63, %r14 + movq %r15, 16(%rdx) + movl $4, %r15d + xorq %rcx, %rdi + jl ..B2.33 +..B2.2: + movq %r10, 8(%rdx) + movl %r11d, 4(%rdx) +..B2.3: + addq %r14, %r15 + movl $1, %r10d + movl %r15d, %ecx + shll %cl, %r10d + movq (%r9), %rdx + shlq $10, %rdx + movslq %r10d, %r10 + orq %r10, %rdx + movq %rdx, (%r9) + testq %r15, %r15 + jne ..B2.5 +..B2.4: + movl $2139095040, 28(%rsp) + movss 28(%rsp), %xmm1 + movss 28(%rsp), %xmm0 + subss %xmm0, %xmm1 + movss %xmm1, 28(%rsp) +..B2.5: + movq (%rbx), %r11 + lea (%r15,%r15,2), %rcx + addq %rcx, %rcx + movq %r11, %rdi + sarq $60, %r11 + sarq %cl, %rdi + movq %rdi, %rdx + sarq $3, %rdi + andq $7, %rdx + andq $7, %rdi + je ..B2.26 +..B2.6: + movl %r10d, %esi + andl $240, %esi + cmpq %r13, %rdx + jg ..B2.8 +..B2.7: + testq %rdx, %rdx + movl %esi, %ebx + cmove %r8, %r12 + jmp ..B2.9 +..B2.8: + andq $15, %r11 + addq %rdx, %r11 + movq -8(%rbx,%r11,8), %rdx + movl $1, %ebx + movl %edx, %ecx + movq %rdx, %r12 + shlq $4, %r12 + shll %cl, %ebx + addq __x_constants__@GOTPCREL(%rip), %r12 + andl $240, %ebx +..B2.9: + cmpq $7, %rdi + je ..B2.30 +..B2.10: + cmpq $0, 8(%r9) + je ..B2.13 +..B2.11: + orl %esi, %ebx + je ..B2.13 +..B2.12: + movl $1182793727, 24(%rsp) + movss 24(%rsp), %xmm1 + movss 24(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss %xmm1, 24(%rsp) +..B2.13: + movq 8(%r12), %rbx + cmpq $1, %rdi + je ..B2.29 +..B2.14: + cmpq $3, %rdi + je ..B2.19 +..B2.15: + cmpq $4, %rdi + jne ..B2.17 +..B2.16: + movq $0x7fffffffffffffff, %rcx + andq %rcx, %rbx + jmp ..B2.20 +..B2.17: + cmpq $5, %rdi + jne ..B2.20 +..B2.18: + movq $0x7fffffffffffffff, %rcx + andq %rbx, %rcx + movq $0x8000000000000000, %rbx + andq 8(%r8), %rbx + orq %rcx, %rbx + jmp ..B2.20 +..B2.19: + movq $0x8000000000000000, %rcx + xorq %rcx, %rbx +..B2.20: + movq %rbx, 8(%rbp) + testl $192, %r10d + movq (%r12), %rcx + movq %rcx, (%rbp) + je ..B2.24 +..B2.21: + cmpq %r13, %rdx + jg ..B2.24 +..B2.22: + cmpq $0, 8(%r9) + je ..B2.24 +..B2.23: + movl $8388608, 20(%rsp) + movss 20(%rsp), %xmm0 + cvtss2sd %xmm0, %xmm0 + mulsd .L_2il0floatpacket.7(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 20(%rsp) +..B2.24: + movq 96(%rsp), %rcx + movq $0x8000000000000000, %rdx + xorq %rsp, %rcx + orq %rdx, %r15 + cmpq %fs:40, %rcx + jne ..B2.28 +..B2.25: + movq %r15, %rax + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.26: + movq 96(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B2.28 +..B2.27: + movq %r15, %rax + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.28: + call __stack_chk_fail@PLT +..B2.29: + movq $0x800000000000, %rcx + orq %rcx, %rbx + jmp ..B2.20 +..B2.30: + andq $-2013265921, %rdx + lea 32(%rsp), %rdi + movq (%rbp), %rcx + orq $268435456, %rdx + movq 8(%rbp), %rbx + movq %rcx, 32(%rdi) + movq %rbx, 40(%rdi) + movq %rdx, (%rdi) +..___tag_value___dpml_unpack_x_or_y__.110: + call __dpml_exception@PLT +..___tag_value___dpml_unpack_x_or_y__.111: +..B2.31: + movq (%rax), %rdx + movq %rdx, (%rbp) + movq 8(%rax), %rcx + movq %rcx, 8(%rbp) + jmp ..B2.24 +..B2.33: + xorq %rax, %rcx + jl ..B2.35 +..B2.34: + shrq $47, %rax + xorl %r15d, %r15d + andq $1, %rax + testq %rsi, %rsi + movq %r10, 8(%rdx) + movl %r11d, 4(%rdx) + movl $2, %edx + cmove %rdx, %r15 + cmovne %rax, %r14 + jmp ..B2.3 +..B2.35: + testq %rsi, %rsi + jne ..B2.37 +..B2.36: + movq %r10, 8(%rdx) + movl $8, %r15d + movl %r11d, 4(%rdx) + jmp ..B2.3 +..B2.37: + movq $0x8000000000000000, %rax + movq %rdx, %rdi + xorl %esi, %esi + addq %rax, %r10 + incl %r11d + movq %r10, 8(%rdx) + movl %r11d, 4(%rdx) + movq %r8, (%rsp) + movq %r9, 8(%rsp) +..___tag_value___dpml_unpack_x_or_y__.112: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_unpack_x_or_y__.113: +..B2.38: + movl $2048, 16(%rsp) + movl $6, %r15d + movss 16(%rsp), %xmm1 + movss 16(%rsp), %xmm0 + movq 8(%rsp), %r9 + addss %xmm0, %xmm1 + movq (%rsp), %r8 + movss %xmm1, 16(%rsp) + jmp ..B2.3 + .align 16,0x90 + .cfi_endproc + .type __dpml_unpack_x_or_y__,@function + .size __dpml_unpack_x_or_y__,.-__dpml_unpack_x_or_y__ + .data +# -- End __dpml_unpack_x_or_y__ + .text +# -- Begin __dpml_pack__ + .text + .align 16,0x90 + .globl __dpml_pack__ +__dpml_pack__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +..B3.1: + .cfi_startproc +..___tag_value___dpml_pack__.115: +..L116: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $120, %rsp + .cfi_def_cfa_offset 176 + movq %rsi, %r14 + xorl %esi, %esi + movq %r8, %r15 + movq %fs:40, %rax + movq %rcx, %r13 + xorq %rsp, %rax + movq %rdx, %r12 + movq %rax, 104(%rsp) + movq %rdi, %rbp +..___tag_value___dpml_pack__.130: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_pack__.131: +..B3.2: + movslq 4(%rbp), %rax + cmpq $-262144, %rax + je ..B3.28 +..B3.3: + movq %rax, %rdx + negq %rdx + movq %rdx, %rbx + addq $-16381, %rbx + jle ..B3.9 +..B3.4: + movl (%rbp), %r9d + lea -16381(%rax,%rdx), %rax + movq %rbp, %rsi + lea 80(%rsp), %rdi + xorl %edx, %edx + movq %rbp, %rcx + movq $0x8000000000000000, %r8 + movq %r8, 8(%rdi) + movq $0, 16(%rdi) + movl %eax, 4(%rdi) + movl %r9d, (%rdi) +..___tag_value___dpml_pack__.132: + call __dpml_addsub__@PLT +..___tag_value___dpml_pack__.133: +..B3.5: + movq $-16382, %rax + cmpq $113, %rbx + jle ..B3.9 +..B3.6: + cmpq $245763, %rbx + je ..B3.8 +..B3.7: + movq $-16383, %rax + cmpq $49155, %rbx + jle ..B3.9 +..B3.8: + decq %rax +..B3.9: + movq 16(%rbp), %r8 + xorl %edx, %edx + addq $16384, %r8 + xorl %r9d, %r9d + cmpq $16384, %r8 + lea 1(%rax), %r10 + movq 8(%rbp), %rcx + movq $0x1000000000000, %r11 + setb %dl + addq %rdx, %rcx + cmpq %rdx, %rcx + movq %rcx, %rbx + setb %r9b + shrq $15, %rcx + testl %r9d, %r9d + cmovne %r10, %rax + cmovne %r11, %rcx + shrq $15, %r8 + shlq $49, %rbx + orq %rbx, %r8 + movq %r8, (%r14) + lea 16381(%rax), %rdx + movq %rdx, %rbx + shlq $48, %rbx + addq %rcx, %rbx + movslq (%rbp), %rcx + shlq $32, %rcx + orq %rcx, %rbx + cmpq $32766, %rdx + jae ..B3.14 +..B3.10: + movq %rbx, 8(%r14) + cmpq $0, 8(%r15) + je ..B3.12 +..B3.11: + movl $1182793727, (%rsp) + movss (%rsp), %xmm1 + movss (%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss %xmm1, (%rsp) +..B3.12: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B3.24 +..B3.13: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.14: + testq %rax, %rax + cmovl %r12, %r13 + addq $16382, %rax + testl %eax, %eax + jg ..B3.20 +..B3.15: + jl ..B3.26 +..B3.16: + movq %rbx, 8(%r14) + cmpq $0, 8(%r15) + jne ..B3.19 +..B3.17: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B3.24 +..B3.18: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.19: + movq $0x8000000000000000, %rax + orq %rax, %r13 + jmp ..B3.21 +..B3.20: + movq %rbx, 8(%r14) +..B3.21: + andq $-2013265921, %r13 + lea 16(%rsp), %rdi + movq (%r14), %rax + orq $268435456, %r13 + movq 8(%r14), %rdx + movq %rax, 32(%rdi) + movq %rdx, 40(%rdi) + movq %r13, (%rdi) +..___tag_value___dpml_pack__.174: + call __dpml_exception@PLT +..___tag_value___dpml_pack__.175: +..B3.33: + movq %rax, %rdx +..B3.22: + movq (%rdx), %rax + movq %rax, (%r14) + movq 8(%rdx), %rdx + movq %rdx, 8(%r14) + movq 104(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + jne ..B3.24 +..B3.23: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.24: + call __stack_chk_fail@PLT +..B3.26: + movq %rcx, 8(%r14) + jmp ..B3.21 +..B3.28: + movslq (%rbp), %rax + shlq $32, %rax + movq $0, (%r14) + movq %rax, 8(%r14) + movq 104(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B3.24 + jmp ..B3.13 + .align 16,0x90 + .cfi_endproc + .type __dpml_pack__,@function + .size __dpml_pack__,.-__dpml_pack__ + .data +# -- End __dpml_pack__ + .text +# -- Begin __dpml_evaluate_packed_poly__ + .text + .align 16,0x90 + .globl __dpml_evaluate_packed_poly__ +__dpml_evaluate_packed_poly__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +..B4.1: + .cfi_startproc +..___tag_value___dpml_evaluate_packed_poly__.197: +..L198: + + subq $104, %rsp + .cfi_def_cfa_offset 112 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 88(%rsp) + movq %rcx, %rax + movq 8(%rdx), %r11 + notq %rax + movq (%rdx), %r10 + movq %r11, 8(%r9) + movq %r10, %r11 + andq %rax, %r11 + movq %r11, 16(%r9) + movq %r10, %r11 + shrq $1, %r10 + andq $1, %r11 + andq %rcx, %r10 + shlq $31, %r11 + subq %r8, %r10 + movl %r11d, (%r9) + decq %rsi + movl %r10d, 4(%r9) + js ..B4.8 +..B4.2: + xorl %r10d, %r10d + movl %r10d, 68(%rsp) + movl %r10d, 64(%rsp) + movq %rdi, 56(%rsp) + movq %rcx, 48(%rsp) + movq %r12, 40(%rsp) + .cfi_offset 12, -72 + movq %r9, %r12 + movq %r13, 32(%rsp) + .cfi_offset 13, -80 + movq %rax, %r13 + movq %r14, 24(%rsp) + .cfi_offset 14, -88 + movq %r8, %r14 + movq %r15, 16(%rsp) + .cfi_offset 15, -96 + movq %rdx, %r15 + movq %rbx, 8(%rsp) + movq %rbp, (%rsp) + .cfi_offset 3, -104 + .cfi_offset 6, -112 + movq %rsi, %rbp +..B4.3: + movq %r12, %rsi + movq %r12, %rdx + movq 56(%rsp), %rdi +..___tag_value___dpml_evaluate_packed_poly__.206: + call __dpml_multiply__@PLT +..___tag_value___dpml_evaluate_packed_poly__.207: +..B4.4: + movq %r12, %rdi + xorl %esi, %esi +..___tag_value___dpml_evaluate_packed_poly__.208: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_evaluate_packed_poly__.209: +..B4.5: + addq $16, %r15 + movq %r13, %r10 + movq %r12, %rdi + lea 64(%rsp), %rsi + movq %r12, %rcx + movq 8(%r15), %rbx + movq %rbx, 8(%rsi) + movq (%r15), %rbx + andq %rbx, %r10 + movq %rbx, %rdx + shrq $1, %rbx + andq $1, %rdx + andq -16(%rsi), %rbx + subq %r14, %rbx + movq %r10, 16(%rsi) +..___tag_value___dpml_evaluate_packed_poly__.210: + call __dpml_addsub__@PLT +..___tag_value___dpml_evaluate_packed_poly__.211: +..B4.6: + addl %ebx, 4(%r12) + decq %rbp + jns ..B4.3 +..B4.7: + movq 40(%rsp), %r12 + .cfi_restore 12 + movq 32(%rsp), %r13 + .cfi_restore 13 + movq 24(%rsp), %r14 + .cfi_restore 14 + movq 16(%rsp), %r15 + .cfi_restore 15 + movq 8(%rsp), %rbx + .cfi_restore 3 + movq (%rsp), %rbp + .cfi_restore 6 +..B4.8: + movq 88(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B4.10 +..B4.9: + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B4.10: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __dpml_evaluate_packed_poly__,@function + .size __dpml_evaluate_packed_poly__,.-__dpml_evaluate_packed_poly__ + .data +# -- End __dpml_evaluate_packed_poly__ + .text +# -- Begin __dpml_addsub__ + .text + .align 16,0x90 + .globl __dpml_addsub__ +__dpml_addsub__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B5.1: + .cfi_startproc +..___tag_value___dpml_addsub__.221: +..L222: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $40, %rsp + .cfi_def_cfa_offset 80 + movq %rdi, %r9 + movq %rdx, %r15 + movq %rsi, %rax + movq %r15, %rbx + movq %rcx, %r8 + movq %r15, %rcx + xorl %ebp, %ebp + movl (%r9), %edx + andq $4, %rcx + movslq %edx, %rdi + movslq (%rax), %r11 + cmovne %ebp, %edx + shlq $31, %rbx + xorq %rbx, %rdi + xorq %r11, %rdi + testq %rcx, %rcx + movl 4(%r9), %esi + cmovne %rbx, %rdi + movslq %esi, %rbx + sarq $31, %rdi + movq %rbx, %rcx + movq %fs:40, %r10 + andq $1, %rdi + xorq %rsp, %r10 + movq %r10, 32(%rsp) + movslq 4(%rax), %r10 + subq %r10, %rcx + jge ..B5.3 +..B5.2: + negq %rcx + movq %r9, %rbp + addq %rcx, %rbx + movq %rax, %r9 + movl %ebx, %esi + movq %rdi, %rbx + shlq $31, %rbx + movq %rbp, %rax + movslq %edx, %rdx + movl $-2147483648, %ebp + xorq %rbx, %rdx +..B5.3: + movq 16(%rax), %rbx + movl $2, %r11d + movq 8(%rax), %rax +..B5.4: + movq %rcx, %r10 + negq %r10 + addq $64, %r10 + testq %r10, %r10 + jg ..B5.11 +..B5.5: + movq %r10, %rcx + movq %rax, %rbx + negq %rcx + xorl %eax, %eax + decq %r11 + jne ..B5.4 +..B5.6: + movq 8(%r9), %rcx + testq $2, %r15 + movq %rcx, 8(%r8) + movl 4(%r9), %eax + movq 16(%r9), %rbx + movl %eax, 4(%r8) + movq %rbx, 16(%r8) + movl %edx, (%r8) + je ..B5.8 +..B5.7: + movq 8(%r9), %rcx + xorl %ebp, %edx + movq %rcx, 32(%r8) + movl 4(%r9), %eax + movq 16(%r9), %rbx + movl %eax, 28(%r8) + movq %rbx, 40(%r8) + movl %edx, 24(%r8) +..B5.8: + movq 32(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B5.10 +..B5.9: + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B5.10: + call __stack_chk_fail@PLT +..B5.11: + testq %rcx, %rcx + je ..B5.13 +..B5.12: + movl %ecx, %r11d + movl %r11d, %ecx + shrq %cl, %rbx + movl %r10d, %ecx + movq %rax, %r10 + shlq %cl, %r10 + movl %r11d, %ecx + shrq %cl, %rax + orq %r10, %rbx +..B5.13: + movq %r8, %r14 + movq %r12, 8(%rsp) + .cfi_offset 12, -72 + movq %rdi, %r12 + movq %r13, (%rsp) + .cfi_offset 13, -80 + movq %r9, %r13 + jmp ..B5.14 +..B5.22: + negq %r12 + xorq $2, %r15 + movl 4(%r13), %esi + incq %r12 + addq $24, %r14 + xorl %ebp, %edx +..B5.14: + movq 16(%r13), %r11 + testq %r12, %r12 + movq 8(%r13), %rdi + jne ..B5.17 +..B5.15: + xorl %ecx, %ecx + lea (%r11,%rbx), %r10 + cmpq %r11, %r10 + movl %ecx, %r11d + setb %r11b + xorl %r9d, %r9d + andq $15, %r15 + movl %r11d, %r8d + lea (%rax,%r8), %r11 + cmpq %r8, %r11 + setb %r9b + addq %rdi, %r11 + cmpq %rdi, %r11 + setb %cl + addl %ecx, %r9d + je ..B5.19 +..B5.16: + movq %r11, %rcx + incl %esi + shrq $1, %r10 + shlq $63, %rcx + shrq $1, %r11 + orq %rcx, %r10 + btsq $63, %r11 + jmp ..B5.19 +..B5.17: + xorl %ecx, %ecx + xorl %r10d, %r10d + cmpq %r11, %rbx + seta %r10b + xorl %r9d, %r9d + addq $-8, %r15 + movl %r10d, %r8d + movq %r11, %r10 + subq %rbx, %r10 + lea (%rax,%r8), %r11 + cmpq %r8, %r11 + setb %r9b + negq %r11 + addq %rdi, %r11 + cmpq %r11, %rdi + setb %cl + addl %ecx, %r9d + je ..B5.19 +..B5.18: + movq $-1, %rcx + xorl %edi, %edi + negq %r10 + movslq %edx, %rdx + cmovne %rcx, %rdi + btcq $31, %rdx + negq %r11 + movl $-2147483648, %ebp + addq %rdi, %r11 +..B5.19: + movq %r11, 8(%r14) + testq $16, %r15 + movq %r10, 16(%r14) + movl %esi, 4(%r14) + movl %edx, (%r14) + je ..B5.21 +..B5.20: + movq %r14, %rdi + xorl %esi, %esi + movl %edx, 16(%rsp) + movq %rax, 24(%rsp) +..___tag_value___dpml_addsub__.248: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_addsub__.249: +..B5.28: + movq 24(%rsp), %rax + movl 16(%rsp), %edx +..B5.21: + testq $2, %r15 + jne ..B5.22 +..B5.23: + movq 32(%rsp), %rax + xorq %rsp, %rax + movq 8(%rsp), %r12 + .cfi_restore 12 + movq (%rsp), %r13 + .cfi_restore 13 + cmpq %fs:40, %rax + jne ..B5.10 + jmp ..B5.9 + .align 16,0x90 + .cfi_endproc + .type __dpml_addsub__,@function + .size __dpml_addsub__,.-__dpml_addsub__ + .data +# -- End __dpml_addsub__ + .text +# -- Begin __dpml_ffs_and_shift__ + .text + .align 16,0x90 + .globl __dpml_ffs_and_shift__ +__dpml_ffs_and_shift__: +# parameter 1: %rdi +# parameter 2: %rsi +..B6.1: + .cfi_startproc +..___tag_value___dpml_ffs_and_shift__.253: +..L254: + + pushq %rsi + .cfi_def_cfa_offset 16 + movq %rdi, %r9 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, (%rsp) + testq %rsi, %rsi + movq 8(%r9), %r8 + jne ..B6.4 +..B6.2: + movslq 4(%r9), %rdi + testq %r8, %r8 + jl ..B6.12 +..B6.3: + movq 16(%r9), %rsi + jmp ..B6.7 +..B6.4: + xorl %ecx, %ecx + movl $64, %edi + cmpq $1, %rsi + jne ..B6.6 +..B6.5: + movq %r8, %rdx + movl $-2147483648, %eax + negq %rdx + testq %r8, %r8 + cmovl %eax, %ecx + cmovl %rdx, %r8 +..B6.6: + movq %r8, 8(%r9) + xorl %esi, %esi + movq $0, 16(%r9) + movl %ecx, (%r9) +..B6.7: + movl $2, %edx + xorl %eax, %eax +..B6.8: + testq %r8, %r8 + jne ..B6.16 +..B6.9: + addq $64, %rax + movq %rsi, %r8 + xorl %esi, %esi + decq %rdx + jne ..B6.8 +..B6.10: + movl $-262144, 4(%r9) + movq (%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B6.14 +..B6.11: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B6.12: + movq (%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B6.14 +..B6.13: + xorl %eax, %eax + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B6.14: + call __stack_chk_fail@PLT +..B6.16: + jl ..B6.21 +..B6.17: + movq %r8, %rcx + shrq $58, %rcx + andq $30, %rcx + je ..B6.19 +..B6.18: + movl $21932, %edx + shrl %cl, %edx + andl $3, %edx + incq %rdx + jmp ..B6.20 +..B6.19: + movq %r8, %rdx + pxor %xmm0, %xmm0 + andq $-256, %rdx + cmove %r8, %rdx + cvtsi2sdq %rdx, %xmm0 + testq %rdx, %rdx + jge ..B6.26 +..B6.27: + movq %rdx, %rcx + pxor %xmm0, %xmm0 + shrq $1, %rdx + andq $1, %rcx + orq %rdx, %rcx + cvtsi2sdq %rcx, %xmm0 + addsd %xmm0, %xmm0 +..B6.26: + movd %xmm0, %rdx + sarq $52, %rdx + negq %rdx + addq $1086, %rdx +..B6.20: + movl %edx, %ecx + movq %rsi, %r10 + shlq %cl, %r8 + movq %rdx, %rcx + negq %rcx + addq %rdx, %rax + shrq %cl, %r10 + movl %edx, %ecx + orq %r10, %r8 + shlq %cl, %rsi +..B6.21: + subq %rax, %rdi + movq %r8, 8(%r9) + movq %rsi, 16(%r9) + movl %edi, 4(%r9) + movq (%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B6.14 + jmp ..B6.11 + .align 16,0x90 + .cfi_endproc + .type __dpml_ffs_and_shift__,@function + .size __dpml_ffs_and_shift__,.-__dpml_ffs_and_shift__ + .data +# -- End __dpml_ffs_and_shift__ + .section .rodata, "a" + .align 16 + .align 16 + .globl __x_constants__ +__x_constants__: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1073610752 + .long 0 + .long 0 + .long 0 + .long 1073676288 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 3306619320 + .long 2221509004 + .long 3041149649 + .long 1073648159 + .long 3306619320 + .long 2221509004 + .long 3041149649 + .long 1073779231 + .long 2479964490 + .long 592389929 + .long 3354604061 + .long 1073753495 + .long 3306619320 + .long 2221509004 + .long 3041149649 + .long 1073713695 + .long 0 + .long 0 + .long 0 + .long 1074030592 + .long 0 + .long 0 + .long 0 + .long 1074096128 + .long 0 + .long 0 + .long 0 + .long 1074138624 + .long 0 + .long 0 + .long 0 + .long 1074161664 + .long 0 + .long 0 + .long 0 + .long 2147418112 + .type __x_constants__,@object + .size __x_constants__,208 + .align 8 +.L_2il0floatpacket.7: + .long 0x00000000,0x3e600000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/dpml_ux_ops_64.S b/external/sgx_libm/intel64/dpml_ux_ops_64.S new file mode 100644 index 0000000000..60b2b7994d --- /dev/null +++ b/external/sgx_libm/intel64/dpml_ux_ops_64.S @@ -0,0 +1,1964 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_ops_64.c" + .text +..TXTST0: +# -- Begin __dpml_extended_multiply__ + .text + .align 16,0x90 + .globl __dpml_extended_multiply__ +__dpml_extended_multiply__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B1.1: + .cfi_startproc +..___tag_value___dpml_extended_multiply__.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + movq %rdi, %r15 + movq 16(%rsi), %r14 + movq %r14, %r10 + movl %r14d, %r9d + movq %rcx, %r8 + movq %r9, %r13 + movq 16(%r15), %rax + movq %rax, %rbp + movl %eax, %ebx + movq %rax, %rdi + shrq $32, %rbp + imulq %rbx, %r13 + imulq %r14, %rdi + movq %r9, -8(%rsp) + imulq %rbp, %r9 + shrq $32, %r13 + shrq $32, %r10 + addq %r9, %r13 + movq %rbx, %r9 + imulq %r10, %r9 + addq %r13, %r9 + movq %r9, %rcx + cmpq %r13, %r9 + movq %rbp, %r9 + movl $0, %r13d + movq 8(%r15), %r12 + setb %r13b + imulq %r10, %r9 + imulq %r12, %r14 + movq 8(%rsi), %r11 + imulq %r11, %rax + shrq $32, %rcx + shlq $32, %r13 + addq %r13, %rcx + addq %r9, %rcx + movl (%r15), %r9d + addq %r14, %rcx + movq %rdi, 16(%r8) + xorl (%rsi), %r9d + cmpq %r14, %rcx + movl 4(%rsi), %esi + movq %r12, %r14 + movl 4(%r15), %edi + movl %r9d, (%rdx) + movl %r9d, (%r8) + movl $0, %r9d + setb %r9b + addq %rax, %rcx + movq %rcx, 8(%r8) + cmpq %rax, %rcx + movl %r11d, %ecx + lea (%rdi,%rsi), %r13d + movl %r13d, 4(%rdx) + lea -128(%rdi,%rsi), %r15d + movl %r15d, 4(%r8) + movq %rcx, %r15 + movq %rcx, %r13 + movl $0, %eax + setb %al + imulq %rbx, %r15 + imulq %r11, %r14 + imulq %rbp, %r13 + shrq $32, %r11 + imulq %r11, %rbx + imulq %r11, %rbp + shrq $32, %r15 + addq %r13, %r15 + addq %r15, %rbx + cmpq %r15, %rbx + movq %rbx, %r8 + movl $0, %ebx + setb %bl + shrq $32, %r8 + shlq $32, %rbx + addq %rbx, %r8 + addq %rbp, %r8 + movq -8(%rsp), %rbp + movq %rbp, %rdi + movl %r12d, %r15d + shrq $32, %r12 + movq %r15, %rsi + imulq %r15, %rdi + imulq %r12, %rbp + imulq %r10, %rsi + imulq %r12, %r10 + addq %rax, %r9 + xorl %eax, %eax + shrq $32, %rdi + addq %r14, %r9 + addq %rbp, %rdi + cmpq %r14, %r9 + movl $0, %r14d + setb %r14b + addq %rdi, %rsi + cmpq %rdi, %rsi + movq %rsi, %r13 + setb %al + addq %r8, %r9 + shrq $32, %r13 + shlq $32, %rax + addq %rax, %r13 + movq %rcx, %rax + imulq %r15, %rax + imulq %r12, %rcx + imulq %r11, %r15 + imulq %r11, %r12 + shrq $32, %rax + addq %r10, %r13 + addq %rcx, %rax + xorl %r10d, %r10d + cmpq %r8, %r9 + setb %r10b + xorl %r11d, %r11d + addq %rax, %r15 + cmpq %rax, %r15 + movq %r15, %rcx + movl $0, %r15d + setb %r15b + addq %r13, %r9 + cmpq %r13, %r9 + setb %r11b + shrq $32, %rcx + addq %r10, %r14 + shlq $32, %r15 + addq %r15, %rcx + addq %r12, %rcx + addq %r11, %r14 + addq %r14, %rcx + movq %r9, 16(%rdx) + movq %rcx, 8(%rdx) + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_extended_multiply__,@function + .size __dpml_extended_multiply__,.-__dpml_extended_multiply__ + .data +# -- End __dpml_extended_multiply__ + .text +# -- Begin __dpml_evaluate_rational__ + .text + .align 16,0x90 + .globl __dpml_evaluate_rational__ +__dpml_evaluate_rational__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +..B2.1: + .cfi_startproc +..___tag_value___dpml_evaluate_rational__.28: +..L29: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $88, %rsp + .cfi_def_cfa_offset 144 + movq %rdi, %r13 + movq %rcx, %rbx + movq %r8, %r14 + movq %rbx, %r9 + movq %rsi, %r15 + movq %rdx, 32(%rsp) + movq %rbx, %rbp + sarq $58, %r9 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 72(%rsp) + addl %r9d, 4(%r13) + testq $68, %rbx + jne ..B2.3 +..B2.2: + movl $136, %eax + xorl %ebp, %ebp + cmpl $0, (%r13) + movq %r13, %r12 + cmovne %rax, %rbp + xorq %rbx, %rbp + jmp ..B2.4 +..B2.3: + movq %r13, %rdi + lea 48(%rsp), %r12 + movq %r13, %rsi + movq %r12, %rdx +..___tag_value___dpml_evaluate_rational__.43: + call __dpml_multiply__@PLT +..___tag_value___dpml_evaluate_rational__.44: +..B2.4: + movq %r12, %rdi + xorl %esi, %esi +..___tag_value___dpml_evaluate_rational__.45: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_evaluate_rational__.46: +..B2.5: + movq 32(%rsp), %r9 + movq %r9, %r8 + negq %r8 + movslq 4(%r12), %rax + imulq %rax, %r8 + shlq $4, %r9 + movq %r8, 24(%rsp) + testq $512, %rbx + movq %r9, 40(%rsp) + je ..B2.7 +..B2.6: + testq $1024, %rbx + je ..B2.8 +..B2.7: + xorl %eax, %eax + jmp ..B2.9 +..B2.8: + movl $1, %eax +..B2.9: + testq $15, %rbx + lea (%rax,%rax,2), %rax + lea (,%rax,8), %r9 + lea (%r14,%rax,8), %r8 + je ..B2.16 +..B2.10: + testq $8, %rbp + lea __eval_neg_poly(%rip), %r11 + lea __eval_pos_poly(%rip), %r10 + movq %rbx, %rax + cmovne %r11, %r10 + negq %r9 + andq $240, %rax + cmove %r14, %r8 + addq %r14, %r9 + addq $24, %r9 + cmpq %r11, %r10 + jne ..B2.12 +..B2.11: + movq %r12, %rdi + movq %r15, %rdx + movq 24(%rsp), %rsi + movq 32(%rsp), %rcx + movq %r8, (%rsp) + movq %rax, 8(%rsp) + movq %r9, 16(%rsp) +..___tag_value___dpml_evaluate_rational__.47: + call __eval_neg_poly +..___tag_value___dpml_evaluate_rational__.48: + jmp ..B2.36 +..B2.12: + movq %r12, %rdi + movq %r15, %rdx + movq 24(%rsp), %rsi + movq 32(%rsp), %rcx + movq %r8, (%rsp) + movq %rax, 8(%rsp) + movq %r9, 16(%rsp) +..___tag_value___dpml_evaluate_rational__.49: + call __eval_pos_poly +..___tag_value___dpml_evaluate_rational__.50: +..B2.36: + movq 16(%rsp), %r9 + movq 8(%rsp), %rax + movq (%rsp), %r8 +..B2.13: + testq $2, %rbx + je ..B2.15 +..B2.14: + movq %r13, %rdi + movq %r8, %rsi + movq %r8, %rdx + movq %r8, (%rsp) + movq %rax, 8(%rsp) + movq %r9, 16(%rsp) +..___tag_value___dpml_evaluate_rational__.51: + call __dpml_multiply__@PLT +..___tag_value___dpml_evaluate_rational__.52: +..B2.35: + movq 16(%rsp), %r9 + movq 8(%rsp), %rax + movq (%rsp), %r8 +..B2.15: + movq 40(%rsp), %r10 + lea 24(%r15,%r10), %r15 + movl -8(%r15), %r11d + addl %r11d, 4(%r8) + jmp ..B2.17 +..B2.16: + movq 40(%rsp), %r10 + orq $256, %rbx + testq $1024, %rbx + movq %rbx, %rax + movq %r14, %r9 + lea 24(%r15,%r10), %r11 + cmovne %r11, %r15 + andq $240, %rax +..B2.17: + testq %rax, %rax + je ..B2.26 +..B2.18: + testq $128, %rbp + lea __eval_neg_poly(%rip), %rbp + lea __eval_pos_poly(%rip), %rax + cmovne %rbp, %rax + cmpq %rbp, %rax + jne ..B2.20 +..B2.19: + movq %r12, %rdi + movq %r15, %rdx + movq %r9, %r8 + movq 24(%rsp), %rsi + movq 32(%rsp), %rcx + movq %r9, 16(%rsp) +..___tag_value___dpml_evaluate_rational__.53: + call __eval_neg_poly +..___tag_value___dpml_evaluate_rational__.54: + jmp ..B2.39 +..B2.20: + movq %r12, %rdi + movq %r15, %rdx + movq %r9, %r8 + movq 24(%rsp), %rsi + movq 32(%rsp), %rcx + movq %r9, 16(%rsp) +..___tag_value___dpml_evaluate_rational__.55: + call __eval_pos_poly +..___tag_value___dpml_evaluate_rational__.56: +..B2.39: + movq 16(%rsp), %r9 +..B2.21: + testq $32, %rbx + je ..B2.23 +..B2.22: + movq %r13, %rdi + movq %r9, %rsi + movq %r9, %rdx + movq %r9, 16(%rsp) +..___tag_value___dpml_evaluate_rational__.57: + call __dpml_multiply__@PLT +..___tag_value___dpml_evaluate_rational__.58: +..B2.38: + movq 16(%rsp), %r9 +..B2.23: + movq 40(%rsp), %rax + movl 16(%rax,%r15), %ebp + addl %ebp, 4(%r9) + testq $1024, %rbx + je ..B2.27 +..B2.24: + movq 72(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.31 +..B2.25: + addq $88, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.26: + orq $256, %rbx +..B2.27: + testq $256, %rbx + jne ..B2.29 +..B2.28: + movq %r14, %rdi + lea 24(%r14), %rsi + movl $2, %edx + movq %r14, %rcx +..___tag_value___dpml_evaluate_rational__.79: + call __dpml_divide__@PLT +..___tag_value___dpml_evaluate_rational__.80: +..B2.29: + movq 72(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.31 +..B2.30: + addq $88, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.31: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __dpml_evaluate_rational__,@function + .size __dpml_evaluate_rational__,.-__dpml_evaluate_rational__ + .data +# -- End __dpml_evaluate_rational__ + .text +# -- Begin __eval_neg_poly + .text + .align 16,0x90 +__eval_neg_poly: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +..B3.1: + .cfi_startproc +..___tag_value___eval_neg_poly.102: +..L103: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + movq %rsi, %r12 + xorl %r10d, %r10d + cmpq $128, %r12 + movq %rcx, %rax + movl $1, %ecx + movslq 4(%rdi), %r11 + movq %rdx, %r13 + movq 8(%rdi), %r14 + movq 16(%rdi), %rdx + movq %r11, %rdi + cmovl %ecx, %r10d + xorl %ebx, %ebx + negq %rdi + xorl %r9d, %r9d + testl %r10d, %r10d + jne ..B3.5 +..B3.3: + addq %r11, %r12 + addq $16, %r13 + decq %rax + cmpq $128, %r12 + jge ..B3.3 +..B3.5: + xorl %ebp, %ebp + cmpq $64, %r12 + cmovge %ebp, %ecx + testl %ecx, %ecx + jne ..B3.12 +..B3.7: + movl %r12d, %ecx + decq %rax + addq %r11, %r12 + movq 8(%r13), %r9 + addq $16, %r13 + shrq %cl, %r9 + cmpq $64, %r12 + jl ..B3.12 +..B3.8: + testq %r9, %r9 + je ..B3.7 +..B3.9: + movq %r14, %rbp + xorl %r15d, %r15d + movl %r14d, %esi + shrq $32, %rbp + movq %r8, -72(%rsp) +..B3.10: + movl %r9d, %r10d + movq %rsi, %r8 + imulq %r10, %r8 + imulq %rbp, %r10 + shrq $32, %r9 + movq %rsi, %rcx + imulq %r9, %rcx + imulq %rbp, %r9 + shrq $32, %r8 + decq %rax + addq %r10, %r8 + addq %r8, %rcx + cmpq %r8, %rcx + movl %r15d, %r8d + movq %rcx, %r10 + movl %r12d, %ecx + setb %r8b + addq %r11, %r12 + shrq $32, %r10 + shlq $32, %r8 + addq %r8, %r10 + addq %r9, %r10 + movq 8(%r13), %r9 + addq $16, %r13 + shrq %cl, %r9 + subq %r10, %r9 + cmpq $64, %r12 + jge ..B3.10 +..B3.11: + movq -72(%rsp), %r8 +..B3.12: + movq %r12, %r10 + negq %r10 + testq %r12, %r12 + je ..B3.19 +..B3.13: + movq %r14, %rsi + movl %r14d, %ebp + shrq $32, %rsi + movq %r14, -16(%rsp) + xorl %r14d, %r14d + movq %r8, -72(%rsp) +..B3.14: + movl %r9d, %ebx + movq %rbp, %rcx + imulq %rbx, %rcx + imulq %rsi, %rbx + shrq $32, %r9 + movq %rbp, %r15 + imulq %r9, %r15 + imulq %rsi, %r9 + shrq $32, %rcx + decq %rax + addq %rbx, %rcx + movl %r14d, %ebx + addq %rcx, %r15 + cmpq %rcx, %r15 + movq %r15, %r8 + movl %r12d, %ecx + setb %bl + shrq $32, %r8 + shlq $32, %rbx + addq %rbx, %r8 + movq 8(%r13), %rbx + addq %r9, %r8 + movq (%r13), %r15 + movq %rbx, %r9 + shrq %cl, %r15 + movl %r10d, %ecx + shlq %cl, %r9 + movl %r12d, %ecx + orq %r9, %r15 + addq %rdi, %r10 + movq %r15, %r9 + addq $16, %r13 + subq %r8, %r9 + movl %r14d, %r8d + cmpq %r15, %r9 + seta %r8b + shrq %cl, %rbx + subq %r8, %rbx + addq %r11, %r12 + je ..B3.24 +..B3.15: + testq %rbx, %rbx + je ..B3.14 +..B3.16: + movq %rdx, %rcx + movl %edx, %r15d + shrq $32, %rcx + movq %rdx, -8(%rsp) + movq %rcx, -48(%rsp) + movq %r15, -40(%rsp) + movq %rsi, -32(%rsp) + movq %rdi, -56(%rsp) + movq %r11, -64(%rsp) +..B3.17: + movl %r12d, %ecx + decq %rax + movq 8(%r13), %r14 + movq %r14, %r11 + movq (%r13), %rdx + addq $16, %r13 + shrq %cl, %rdx + movl %r10d, %ecx + shlq %cl, %r11 + movl %r12d, %ecx + orq %r11, %rdx + movq -40(%rsp), %r11 + movq %r11, %r8 + movl %ebx, %esi + movq -48(%rsp), %r15 + shrq %cl, %r14 + movq %r15, %rcx + imulq %rsi, %r8 + imulq %rsi, %rcx + shrq $32, %r8 + movq -16(%rsp), %rdi + addq %rcx, %r8 + imulq %rbx, %rdi + shrq $32, %rbx + movq %r11, %rcx + imulq %rbx, %rcx + imulq %rbx, %r15 + addq %r8, %rcx + negq %rdi + cmpq %r8, %rcx + movl $0, %r8d + movq %rcx, %r11 + movl %r8d, %ecx + setb %cl + addq %rdx, %rdi + cmpq %rdx, %rdi + movq %rax, -24(%rsp) + movl %r8d, %edx + movl %r9d, %eax + seta %dl + shrq $32, %r11 + shlq $32, %rcx + addq %rcx, %r11 + addq %r15, %r11 + movq %rbp, %r15 + imulq %rax, %r15 + movq -32(%rsp), %rcx + negq %r11 + imulq %rcx, %rax + shrq $32, %r15 + addq %rdi, %r11 + shrq $32, %r9 + addq %rax, %r15 + movq %rbp, %rax + imulq %r9, %rax + imulq %rcx, %r9 + addq %r15, %rax + cmpq %r15, %rax + movl %r8d, %r15d + setb %r15b + subq %rdx, %r14 + movq %rax, %rdx + shrq $32, %rdx + shlq $32, %r15 + addq %r15, %rdx + xorl %r15d, %r15d + addq %r9, %rdx + xorl %r9d, %r9d + cmpq %rdi, %r11 + movq %rbp, %rdi + seta %r9b + imulq %rsi, %rdi + imulq %rcx, %rsi + shrq $32, %rdi + addq %rsi, %rdi + movq %rbp, %rsi + imulq %rbx, %rsi + imulq %rcx, %rbx + addq %rdi, %rsi + subq %r9, %r14 + movq %r11, %r9 + cmpq %rdi, %rsi + movq %rsi, %rax + setb %r15b + subq %rdx, %r9 + cmpq %r11, %r9 + seta %r8b + shrq $32, %rax + shlq $32, %r15 + addq %r15, %rax + subq %r8, %r14 + addq %rbx, %rax + movq %r14, %rbx + addq -56(%rsp), %r10 + subq %rax, %rbx + movq -24(%rsp), %rax + addq -64(%rsp), %r12 + jne ..B3.17 +..B3.18: + movq -8(%rsp), %rdx + movq -16(%rsp), %r14 + movq -72(%rsp), %r8 +..B3.19: + testq %rax, %rax + js ..B3.23 +..B3.20: + movl %edx, %r12d + movq %r14, %r10 + shrq $32, %rdx + movl %r14d, %r11d + shrq $32, %r10 + movq %rdx, -8(%rsp) + movq %r14, -16(%rsp) + movq %r8, -72(%rsp) +..B3.21: + movl %ebx, %ecx + movq %r12, %r8 + movq -8(%rsp), %r15 + movq %r15, %rdi + imulq %rcx, %r8 + imulq %rcx, %rdi + movq -16(%rsp), %rdx + movq %r12, %rbp + imulq %rbx, %rdx + shrq $32, %rbx + negq %rdx + imulq %rbx, %rbp + imulq %rbx, %r15 + shrq $32, %r8 + addq %rdi, %r8 + addq %r8, %rbp + movq %rbp, %rdi + cmpq %r8, %rbp + movl $0, %ebp + movl %ebp, %r8d + setb %r8b + movq (%r13), %r14 + addq %r14, %rdx + shrq $32, %rdi + shlq $32, %r8 + addq %r8, %rdi + xorl %r8d, %r8d + cmpq %r14, %rdx + movq %r11, %r14 + seta %r8b + addq %r15, %rdi + movl %r9d, %r15d + negq %rdi + addq %rdx, %rdi + imulq %r15, %r14 + imulq %r10, %r15 + movq 8(%r13), %rsi + addq $16, %r13 + shrq $32, %r9 + subq %r8, %rsi + movq %r11, %r8 + imulq %r9, %r8 + imulq %r10, %r9 + shrq $32, %r14 + addq %r15, %r14 + addq %r14, %r8 + cmpq %r14, %r8 + movl %ebp, %r14d + movq %r8, %r15 + setb %r14b + shrq $32, %r15 + shlq $32, %r14 + addq %r14, %r15 + xorl %r14d, %r14d + addq %r9, %r15 + xorl %r9d, %r9d + cmpq %rdx, %rdi + movq %r11, %rdx + seta %r9b + imulq %rcx, %rdx + imulq %r10, %rcx + shrq $32, %rdx + addq %rcx, %rdx + movq %r11, %rcx + imulq %rbx, %rcx + imulq %r10, %rbx + addq %rdx, %rcx + subq %r9, %rsi + movq %rdi, %r9 + cmpq %rdx, %rcx + movq %rcx, %r8 + setb %r14b + subq %r15, %r9 + cmpq %rdi, %r9 + seta %bpl + shrq $32, %r8 + shlq $32, %r14 + addq %r14, %r8 + subq %rbp, %rsi + addq %rbx, %r8 + movq %rsi, %rbx + subq %r8, %rbx + decq %rax + jns ..B3.21 +..B3.22: + movq -72(%rsp), %r8 +..B3.23: + xorl %eax, %eax + movq %rbx, 8(%r8) + movq %r9, 16(%r8) + movl %eax, 4(%r8) + movl %eax, (%r8) + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 56 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.24: + movq -16(%rsp), %r14 + movq -72(%rsp), %r8 + jmp ..B3.19 + .align 16,0x90 + .cfi_endproc + .type __eval_neg_poly,@function + .size __eval_neg_poly,.-__eval_neg_poly + .data +# -- End __eval_neg_poly + .text +# -- Begin __dpml_divide__ + .text + .align 16,0x90 + .globl __dpml_divide__ +__dpml_divide__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B4.1: + .cfi_startproc +..___tag_value___dpml_divide__.136: +..L137: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $56, %rsp + .cfi_def_cfa_offset 112 + movq %rsi, %rbp + testq %rbp, %rbp + lea __ux_one__(%rip), %r8 + movq %rdi, %rbx + movq %rcx, %r15 + jne ..L151 + movq %r8, %rbp +..L151: + testq %rbx, %rbx + movq %rdx, %r12 + movq %fs:40, %rax + jne ..L152 + movq %r8, %rbx +..L152: + xorq %rsp, %rax + movq %rax, 48(%rsp) + cmpq %r8, %rbp + movq 8(%rbp), %r13 + movq 16(%rbp), %r14 + je ..B4.12 +..B4.2: + testq %r13, %r13 + jl ..B4.5 +..B4.3: + movq %rbp, %rdi + xorl %esi, %esi +..___tag_value___dpml_divide__.153: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_divide__.154: +..B4.4: + movq 8(%rbp), %r13 + movq 16(%rbp), %r14 +..B4.5: + lea 16(%rsp), %rdi +..___tag_value___dpml_divide__.155: + call fegetenv@PLT +..___tag_value___dpml_divide__.156: +..B4.6: + movq %r13, %rcx + pxor %xmm0, %xmm0 + shrq $1, %rcx + movq $0x3fffffffff, %rax + cvtsi2sdq %rcx, %xmm0 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + movq %r13, %r9 + divsd %xmm0, %xmm3 + andq %rax, %r9 + movq %r14, %r8 + shlq $15, %r9 + movq $0xffffffc000000000, %rdx + shrq $49, %r8 + movq %r13, %rsi + movl (%rbx), %r10d + orq %r8, %r9 + movl 4(%rbx), %r8d + andq %rdx, %rsi + xorl (%rbp), %r10d + pxor %xmm1, %xmm1 + subl 4(%rbp), %r8d + pxor %xmm2, %xmm2 + cvttsd2si %xmm3, %rbp + cvtsi2sdq %r9, %xmm2 + shrq $1, %rsi + addq $-1280, %rbp + cvtsi2sdq %rsi, %xmm1 + movq 8(%rbx), %rsi + pxor %xmm7, %xmm7 + movq 16(%rbx), %rcx + movq $0xfffffff000000000, %rbx + andq %rbx, %rbp + andq %rsi, %rax + cvtsi2sdq %rbp, %xmm7 + movsd .L_2il0floatpacket.1(%rip), %xmm5 + movq %rcx, %r11 + mulsd %xmm5, %xmm2 + pxor %xmm6, %xmm6 + mulsd %xmm7, %xmm1 + mulsd %xmm7, %xmm2 + movsd .L_2il0floatpacket.0(%rip), %xmm0 + movq %rsi, %rdi + shlq $15, %rax + andq %rsi, %rdx + shrq $49, %r11 + pxor %xmm8, %xmm8 + orq %r11, %rax + pxor %xmm9, %xmm9 + cvtsi2sdq %rax, %xmm6 + subsd %xmm1, %xmm0 + mulsd %xmm6, %xmm5 + subsd %xmm2, %xmm0 + movsd .L_2il0floatpacket.2(%rip), %xmm4 + mulsd %xmm3, %xmm4 + shrq $11, %rdi + shlq $10, %rdi + shrq $1, %rdx + cvtsi2sdq %rdi, %xmm8 + cvtsi2sdq %rdx, %xmm9 + mulsd %xmm4, %xmm0 + movsd .L_2il0floatpacket.3(%rip), %xmm10 + xorl %edi, %edi + mulsd %xmm7, %xmm10 + mulsd %xmm0, %xmm8 + mulsd %xmm10, %xmm9 + mulsd %xmm5, %xmm10 + mulsd .L_2il0floatpacket.4(%rip), %xmm9 + addsd %xmm8, %xmm10 + cvttsd2si %xmm9, %rdx + cvttsd2si %xmm10, %rbx + movq %rdx, %rax + lea (%rbx,%rdx,4), %rdx + cmpq %rbx, %rdx + movl %r10d, (%r15) + setb %dil + xorl %ebx, %ebx + shrq $62, %rax + addq %rdi, %rax + cmpq $1, %r12 + je ..B4.8 +..B4.7: + movsd .L_2il0floatpacket.5(%rip), %xmm1 + movq %r14, %r9 + mulsd %xmm0, %xmm1 + xorl %r11d, %r11d + movq %r15, (%rsp) + movq %rax, %r12 + cvttsd2si %xmm1, %r15 + movl %edx, %ebx + lea (%r15,%rbp,4), %r15 + testq %r15, %r15 + movq %rbx, %rdi + movl %r8d, 8(%rsp) + movq $-1, %r8 + movl %r14d, %ebp + cmove %r8, %r15 + shrq $32, %r9 + movq %rdx, %r8 + imulq %rbp, %rdi + movq %rbx, %r10 + negq %r12 + shrq $32, %r8 + andq %r12, %r14 + imulq %r9, %r10 + imulq %r8, %rbp + imulq %r8, %r9 + shrq $32, %rdi + andq %r13, %r12 + addq %r10, %rdi + addq %rdi, %rbp + cmpq %rdi, %rbp + movq %rbp, %r10 + movl %r13d, %ebp + movq %rbx, %rdi + setb %r11b + shrq $32, %r10 + shlq $32, %r11 + addq %r11, %r10 + movq %r13, %r11 + addq %r9, %r10 + movq %r13, %r9 + shrq $32, %r9 + addq %r10, %r14 + imulq %rbp, %rdi + imulq %r9, %rbx + imulq %r8, %rbp + imulq %rdx, %r11 + imulq %r8, %r9 + shrq $32, %rdi + xorl %r8d, %r8d + addq %rbx, %rdi + addq %rdi, %rbp + cmpq %rdi, %rbp + movq %rbp, %rbx + movl $0, %ebp + setb %bpl + cmpq %r10, %r14 + setb %r8b + xorl %r10d, %r10d + addq %r11, %r14 + shrq $32, %rbx + shlq $32, %rbp + addq %rbp, %rbx + xorl %ebp, %ebp + addq %r9, %rbx + xorl %r9d, %r9d + cmpq %r11, %r14 + setb %r9b + xorl %r11d, %r11d + addq %rbx, %r12 + cmpq %rbx, %r12 + setb %r11b + xorl %ebx, %ebx + addq %r9, %r8 + addq %r8, %r12 + xorl %r9d, %r9d + cmpq %r8, %r12 + setb %bl + cmpq %r14, %rcx + setb %r10b + addq %rbx, %r11 + xorl %ebx, %ebx + cmpq %r12, %rsi + setb %bl + negq %r12 + addq %rsi, %r12 + negq %r11 + cmpq %r10, %r12 + setb %bpl + subq %rbx, %r11 + movl $1, %ebx + cmpq %r12, %r10 + movl $0, %r12d + cmovne %ebx, %r12d + subq %rbp, %r11 + orq %r11, %r12 + cmove %r13, %r11 + negq %r14 + addq %rcx, %r14 + xorq %r11, %r13 + subq %r13, %r14 + movl %r15d, %r13d + movl %r14d, %edi + movq %r13, %r8 + shrq $32, %r14 + imulq %rdi, %r8 + imulq %r14, %r13 + shrq $32, %r15 + imulq %r15, %rdi + imulq %r15, %r14 + shrq $32, %r8 + addq %r13, %r8 + addq %r8, %rdi + cmpq %r8, %rdi + movq %rdi, %r13 + movl 8(%rsp), %r8d + setb %r9b + orq %rcx, %rsi + movl $0, %ecx + cmove %ecx, %ebx + xorl %esi, %esi + shrq $32, %r13 + shlq $32, %r9 + addq %r9, %r13 + addq %r14, %r13 + movq %r13, %r14 + shrq $63, %r14 + addq %r14, %r12 + addq %r12, %rdx + cmpq %r12, %rdx + setb %sil + sarq $63, %r12 + addq %r12, %rax + movq (%rsp), %r15 + lea (%rbx,%r13,2), %rbx + addq %rsi, %rax +..B4.8: + movq %rax, %rsi + movl %eax, %ecx + movq %rdx, %rbp + andq %rax, %rdx + shrq %cl, %rbp + movl %eax, %ecx + shlq $63, %rsi + lea 16(%rsp), %rdi + shlq $63, %rdx + orq %rbp, %rsi + shrq %cl, %rbx + movslq %r8d, %r8 + orq %rbx, %rdx + addq %rax, %r8 + movq %rsi, 8(%r15) + movq %rdx, 16(%r15) + movl %r8d, 4(%r15) +..___tag_value___dpml_divide__.157: + call fesetenv@PLT +..___tag_value___dpml_divide__.158: +..B4.9: + movq 48(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B4.11 +..B4.10: + addq $56, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B4.11: + call __stack_chk_fail@PLT +..B4.12: + movq 8(%rbx), %rcx + movq %rcx, 8(%r15) + movl (%rbx), %eax + movl 4(%rbx), %edx + movq 16(%rbx), %rbx + movl %eax, (%r15) + movl %edx, 4(%r15) + movq %rbx, 16(%r15) + movq 48(%rsp), %rbp + xorq %rsp, %rbp + cmpq %fs:40, %rbp + jne ..B4.11 + jmp ..B4.10 + .align 16,0x90 + .cfi_endproc + .type __dpml_divide__,@function + .size __dpml_divide__,.-__dpml_divide__ + .data +# -- End __dpml_divide__ + .text +# -- Begin __dpml_multiply__ + .text + .align 16,0x90 + .globl __dpml_multiply__ +__dpml_multiply__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B5.1: + .cfi_startproc +..___tag_value___dpml_multiply__.180: +..L181: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + movq %rdi, %r15 + movq 8(%rsi), %r9 + movq %rdx, %r11 + movl %r9d, %ecx + movq %rcx, %r13 + movq %rcx, %rax + movq 16(%r15), %rdi + movl %edi, %r14d + movq 8(%r15), %r8 + movq %r8, %r10 + shrq $32, %rdi + imulq %r14, %r13 + imulq %r9, %r10 + imulq %rdi, %rax + shrq $32, %r9 + imulq %r9, %r14 + imulq %r9, %rdi + shrq $32, %r13 + addq %rax, %r13 + addq %r13, %r14 + cmpq %r13, %r14 + movq %r14, %rax + movl $0, %r14d + setb %r14b + shrq $32, %rax + shlq $32, %r14 + addq %r14, %rax + addq %rdi, %rax + movl (%r15), %edi + addq %rax, %r10 + movq 16(%rsi), %rdx + xorl (%rsi), %edi + movl 4(%r15), %r15d + movl %edx, %r13d + movl %edi, (%r11) + movq %r13, %rdi + addl 4(%rsi), %r15d + movl %r8d, %esi + shrq $32, %r8 + movq %rsi, %r14 + imulq %rsi, %rdi + imulq %r8, %r13 + shrq $32, %rdx + imulq %rdx, %r14 + imulq %r8, %rdx + shrq $32, %rdi + addq %r13, %rdi + xorl %r13d, %r13d + addq %rdi, %r14 + cmpq %rdi, %r14 + movl %r15d, 4(%r11) + movq %r14, %r15 + setb %r13b + xorl %r14d, %r14d + cmpq %rax, %r10 + setb %r14b + shrq $32, %r15 + shlq $32, %r13 + addq %r13, %r15 + addq %rdx, %r15 + movq %rcx, %rdx + imulq %rsi, %rdx + imulq %r8, %rcx + imulq %r9, %rsi + imulq %r9, %r8 + shrq $32, %rdx + addq %r15, %r10 + addq %rcx, %rdx + xorl %ecx, %ecx + addq %rdx, %rsi + cmpq %rdx, %rsi + movq %rsi, %r13 + setb %cl + shrq $32, %r13 + shlq $32, %rcx + addq %rcx, %r13 + addq %r8, %r13 + xorl %r8d, %r8d + cmpq %r15, %r10 + setb %r8b + addq %r14, %r8 + addq %r8, %r13 + movq %r10, 16(%r11) + movq %r13, 8(%r11) + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_multiply__,@function + .size __dpml_multiply__,.-__dpml_multiply__ + .data +# -- End __dpml_multiply__ + .text +# -- Begin __eval_pos_poly + .text + .align 16,0x90 +__eval_pos_poly: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +..B6.1: + .cfi_startproc +..___tag_value___eval_pos_poly.195: +..L196: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + movq %rsi, %r11 + movq 16(%rdi), %r9 + cmpq $128, %r11 + movq %r9, -32(%rsp) + movl $0, %r9d + movq %rcx, %rax + movl $1, %ecx + movslq 4(%rdi), %rbp + cmovl %ecx, %r9d + xorl %ebx, %ebx + xorl %esi, %esi + movq %rbp, -64(%rsp) + negq %rbp + movq 8(%rdi), %r10 + testl %r9d, %r9d + jne ..B6.5 +..B6.2: + movq -64(%rsp), %rdi +..B6.3: + addq %rdi, %r11 + addq $16, %rdx + decq %rax + cmpq $128, %r11 + jge ..B6.3 +..B6.5: + xorl %edi, %edi + cmpq $64, %r11 + cmovge %edi, %ecx + testl %ecx, %ecx + jne ..B6.12 +..B6.6: + movq -64(%rsp), %rdi +..B6.7: + movl %r11d, %ecx + decq %rax + addq %rdi, %r11 + movq 8(%rdx), %rsi + addq $16, %rdx + shrq %cl, %rsi + cmpq $64, %r11 + jl ..B6.12 +..B6.8: + testq %rsi, %rsi + je ..B6.7 +..B6.9: + movq %r10, %r9 + xorl %r12d, %r12d + movl %r10d, %ebx + shrq $32, %r9 + movq -64(%rsp), %r13 +..B6.10: + movl %esi, %edi + movq %rbx, %r15 + imulq %rdi, %r15 + imulq %r9, %rdi + shrq $32, %rsi + movq %rbx, %r14 + imulq %rsi, %r14 + imulq %r9, %rsi + shrq $32, %r15 + movl %r12d, %ecx + addq %rdi, %r15 + decq %rax + addq %r15, %r14 + cmpq %r15, %r14 + movq %r14, %rdi + setb %cl + shrq $32, %rdi + shlq $32, %rcx + addq %rcx, %rdi + movl %r11d, %ecx + addq %rsi, %rdi + addq %r13, %r11 + movq 8(%rdx), %rsi + addq $16, %rdx + shrq %cl, %rsi + addq %rdi, %rsi + cmpq $64, %r11 + jge ..B6.10 +..B6.11: + xorl %ebx, %ebx + cmpq %rdi, %rsi + setb %bl +..B6.12: + movq %r11, %r9 + xorl %edi, %edi + negq %r9 + testq %r11, %r11 + je ..B6.38 +..B6.13: + testq %rbx, %rbx + jne ..B6.18 +..B6.14: + movq %r10, %rbx + xorl %r13d, %r13d + movq %r8, -56(%rsp) + movl %r10d, %r15d + shrq $32, %rbx + movq %r10, -40(%rsp) + movq -64(%rsp), %r8 +..B6.15: + movl %esi, %r12d + movq %r15, %r14 + imulq %r12, %r14 + imulq %rbx, %r12 + shrq $32, %rsi + movq %r15, %rcx + imulq %rsi, %rcx + imulq %rbx, %rsi + shrq $32, %r14 + decq %rax + addq %r12, %r14 + movl %r13d, %r12d + addq %r14, %rcx + cmpq %r14, %rcx + movq %rcx, %r10 + movl %r11d, %ecx + setb %r12b + shrq $32, %r10 + shlq $32, %r12 + addq %r12, %r10 + movq 8(%rdx), %r12 + addq %rsi, %r10 + movq (%rdx), %rsi + movq %r12, %r14 + shrq %cl, %rsi + movl %r9d, %ecx + shlq %cl, %r14 + movl %r11d, %ecx + orq %r14, %rsi + addq %rbp, %r9 + addq %r10, %rsi + addq $16, %rdx + cmpq %r10, %rsi + movl %r13d, %r10d + setb %r10b + shrq %cl, %r12 + addq %r10, %r12 + addq %r8, %r11 + je ..B6.32 +..B6.16: + testq %r12, %r12 + je ..B6.15 +..B6.17: + movq -40(%rsp), %r10 + movq %r12, %rbx + movq -56(%rsp), %r8 +..B6.18: + testq %rax, %rax + jge ..B6.33 +..B6.19: + movq %rbx, 8(%r8) + movq %rsi, 16(%r8) + movl %edi, 4(%r8) + movl $0, (%r8) + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 56 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B6.38: + movl %edi, -48(%rsp) + movq %r10, -40(%rsp) + movq %r8, -56(%rsp) +..B6.21: + testq %rax, %rax + jl ..B6.30 +..B6.22: + movl %ebx, %edi + decq %rax + movq -32(%rsp), %rcx + movq %rdi, %r15 + movl %ecx, %r13d + movq %rdi, %r11 + movq -40(%rsp), %rbp + movq %rbp, %r9 + shrq $32, %rcx + imulq %r13, %r15 + imulq %rbx, %r9 + imulq %rcx, %r11 + shrq $32, %rbx + movq %r13, -24(%rsp) + imulq %rbx, %r13 + shrq $32, %r15 + addq %r11, %r15 + xorl %r11d, %r11d + addq %r15, %r13 + xorl %r14d, %r14d + movq %r13, %r8 + cmpq %r15, %r13 + movq %rcx, %r13 + setb %r14b + imulq %rbx, %r13 + shrq $32, %r8 + shlq $32, %r14 + movq (%rdx), %r12 + addq %r14, %r8 + movq %rax, -16(%rsp) + addq %r9, %r12 + movl %esi, %eax + addq %r13, %r8 + xorl %r13d, %r13d + cmpq %r9, %r12 + movq %rax, %r14 + movl %ebp, %r9d + setb %r13b + addq %r8, %r12 + shrq $32, %rbp + imulq %r9, %r14 + imulq %rbp, %rax + shrq $32, %r14 + shrq $32, %rsi + addq %rax, %r14 + movq %r9, %rax + imulq %rsi, %rax + imulq %rbp, %rsi + addq %r14, %rax + cmpq %r14, %rax + movl %r11d, %r14d + movq %rax, %r15 + setb %r14b + shrq $32, %r15 + shlq $32, %r14 + addq %r14, %r15 + xorl %r14d, %r14d + addq %rsi, %r15 + xorl %esi, %esi + cmpq %r8, %r12 + movq %rdi, %r8 + setb %sil + imulq %r9, %r8 + imulq %rbp, %rdi + shrq $32, %r8 + addq %rdi, %r8 + movq %r9, %rdi + imulq %rbx, %rdi + imulq %rbp, %rbx + addq %r8, %rdi + cmpq %r8, %rdi + movq %rdi, %rax + setb %r14b + xorl %edi, %edi + shrq $32, %rax + addq %rsi, %r13 + shlq $32, %r14 + lea (%r12,%r15), %rsi + addq %r14, %rax + addq %rbx, %rax + xorl %ebx, %ebx + cmpq %r15, %rsi + setb %bl + addq %r13, %rbx + movq 8(%rdx), %r10 + addq $16, %rdx + addq %rbx, %r10 + cmpq %rbx, %r10 + setb %dil + lea (%r10,%rax), %rbx + cmpq %rax, %rbx + movq -16(%rsp), %rax + setb %r11b + addl %r11d, %edi + je ..B6.21 +..B6.23: + movq %rbx, %rdi + movl $1, %r11d + shrq $1, %rsi + shlq $63, %rdi + shrq $1, %rbx + orq %rdi, %rsi + incl -48(%rsp) + btsq $63, %rbx + testq %rax, %rax + js ..B6.30 +..B6.39: + movq %rcx, -72(%rsp) +..B6.26: + movl %r11d, %ecx + decq %rax + movq (%rdx), %r15 + shrq %cl, %r15 + movq %r11, %rcx + negq %rcx + movq 8(%rdx), %r12 + movq %r12, %r13 + movq -72(%rsp), %r10 + movq %r10, %r8 + shlq %cl, %r13 + addq $16, %rdx + movl %r11d, %ecx + orq %r13, %r15 + shrq %cl, %r12 + movq -24(%rsp), %rcx + movq %rcx, %r14 + movl %ebx, %r13d + imulq %r13, %r14 + imulq %r13, %r8 + movq -40(%rsp), %rdi + imulq %rbx, %rdi + shrq $32, %rbx + addq %rdi, %r15 + imulq %rbx, %rcx + imulq %rbx, %r10 + shrq $32, %r14 + addq %r8, %r14 + addq %r14, %rcx + cmpq %r14, %rcx + movl $0, %r14d + movq %rcx, %r8 + movl %r14d, %ecx + setb %cl + shrq $32, %r8 + shlq $32, %rcx + addq %rcx, %r8 + movq %rax, -16(%rsp) + addq %r10, %r8 + movl %esi, %eax + xorl %r10d, %r10d + cmpq %rdi, %r15 + movq %r9, %rdi + setb %r10b + addq %r8, %r15 + imulq %rax, %rdi + imulq %rbp, %rax + shrq $32, %rdi + shrq $32, %rsi + addq %rax, %rdi + movq %r9, %rax + imulq %rsi, %rax + imulq %rbp, %rsi + addq %rdi, %rax + cmpq %rdi, %rax + movl %r14d, %edi + movq %rax, %rcx + setb %dil + shrq $32, %rcx + shlq $32, %rdi + addq %rdi, %rcx + movq %r9, %rdi + imulq %r13, %rdi + imulq %rbp, %r13 + shrq $32, %rdi + addq %rsi, %rcx + addq %r13, %rdi + movq %r9, %r13 + imulq %rbx, %r13 + imulq %rbp, %rbx + xorl %esi, %esi + cmpq %r8, %r15 + setb %sil + xorl %r8d, %r8d + addq %rdi, %r13 + cmpq %rdi, %r13 + movq %r13, %rax + setb %r8b + shrq $32, %rax + addq %rsi, %r10 + shlq $32, %r8 + lea (%r15,%rcx), %rsi + addq %r8, %rax + xorl %r15d, %r15d + addq %rbx, %rax + xorl %ebx, %ebx + cmpq %rcx, %rsi + setb %bl + addq %r10, %rbx + addq %rbx, %r12 + cmpq %rbx, %r12 + setb %r15b + addq -64(%rsp), %r11 + lea (%r12,%rax), %rbx + cmpq %rax, %rbx + movq -16(%rsp), %rax + setb %r14b + addl %r14d, %r15d + je ..B6.28 +..B6.27: + movq %rbx, %rcx + incq %r11 + shrq $1, %rsi + shlq $63, %rcx + shrq $1, %rbx + orq %rcx, %rsi + incl -48(%rsp) + btsq $63, %rbx +..B6.28: + testq %r11, %r11 + je ..B6.21 +..B6.29: + testq %rax, %rax + jns ..B6.26 +..B6.30: + movl -48(%rsp), %edi + movq -56(%rsp), %r8 + jmp ..B6.19 +..B6.32: + movq -40(%rsp), %r10 + movq %r12, %rbx + movq -56(%rsp), %r8 + jmp ..B6.38 +..B6.33: + movq -32(%rsp), %rcx + movq %r10, %rbp + movl %ecx, %r15d + movl %r10d, %r9d + shrq $32, %rbp + shrq $32, %rcx + movq %r15, -24(%rsp) + movl %edi, -48(%rsp) + movq %r10, -40(%rsp) + movq %r8, -56(%rsp) + jmp ..B6.39 + .align 16,0x90 + .cfi_endproc + .type __eval_pos_poly,@function + .size __eval_pos_poly,.-__eval_pos_poly + .data +# -- End __eval_pos_poly + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x47b00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3ef00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x34700000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x3c300000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0x3fd00000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x00000000,0x43d00000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +__ux_one__: + .long 0 + .long 1 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .type __ux_one__,@object + .size __ux_one__,24 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/dpml_ux_sqrt.S b/external/sgx_libm/intel64/dpml_ux_sqrt.S new file mode 100644 index 0000000000..7ad9063da0 --- /dev/null +++ b/external/sgx_libm/intel64/dpml_ux_sqrt.S @@ -0,0 +1,686 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_sqrt.c" + .text +..TXTST0: +# -- Begin __dpml_ux_sqrt_evaluation__ + .text + .align 16,0x90 + .globl __dpml_ux_sqrt_evaluation__ +__dpml_ux_sqrt_evaluation__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B1.1: + .cfi_startproc +..___tag_value___dpml_ux_sqrt_evaluation__.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $104, %rsp + .cfi_def_cfa_offset 160 + movq %rdi, %rbx + movq %fs:40, %rax + lea (%rsp), %rdi + xorq %rsp, %rax + movq %rdx, %r12 + movq %rax, 88(%rdi) + movq %rsi, %rbp +..___tag_value___dpml_ux_sqrt_evaluation__.16: + call fegetenv@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.17: +..B1.2: + movq 8(%rbx), %r8 + movq %r8, %r10 + shrq $11, %r10 + movq $0x3fd0000000000000, %r9 + movl 4(%rbx), %eax + addq %r9, %r10 + movl %eax, %r9d + movq %r8, %r13 + andl $1, %r9d + movq %r8, %r15 + addl %r9d, %eax + pxor %xmm2, %xmm2 + shrq $56, %r8 + pxor %xmm4, %xmm4 + movq %r10, 80(%rsp) + pxor %xmm7, %xmm7 + movq __sqrt_t_table@GOTPCREL(%rip), %r10 + lea 40(%r9), %r14d + shll $7, %r9d + movl %r14d, %ecx + xorq %r9, %r8 + negl %ecx + shlq $4, %r8 + pxor %xmm6, %xmm6 + shlq %cl, %r13 + movl %r14d, %ecx + movsd 80(%rsp), %xmm1 + lea 56(%rsp), %rdx + movq 16(%rbx), %r11 + movaps %xmm1, %xmm0 + cvtss2sd 4(%r10,%r8), %xmm2 + cvtss2sd (%r10,%r8), %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm2 + mulsd %xmm0, %xmm4 + addsd 8(%r10,%r8), %xmm2 + shrq %cl, %r11 + movl %r14d, %ecx + shrq %cl, %r15 + orq %r11, %r13 + shrq $11, %r13 + lea 128+__sqrt_x_table(%rip), %r11 + cvtsi2sdq %r15, %xmm7 + cvtsi2sdq %r13, %xmm6 + addsd %xmm2, %xmm4 + mulsd (%r11), %xmm7 + lea 136+__sqrt_x_table(%rip), %r13 + lea 96+__sqrt_x_table(%rip), %r8 + movaps %xmm7, %xmm8 + lea 152+__sqrt_x_table(%rip), %r15 + lea 104+__sqrt_x_table(%rip), %r14 + lea 32(%rsp), %rdi + movsd .L_2il0floatpacket.21(%rip), %xmm12 + movq %rbx, %rsi + mulsd (%r13), %xmm6 + mulsd (%r8), %xmm4 + addsd %xmm6, %xmm8 + movaps %xmm8, %xmm3 + lea 144+__sqrt_x_table(%rip), %r8 + mulsd %xmm4, %xmm3 + cvtsd2ss %xmm4, %xmm4 + cvtsd2ss %xmm3, %xmm3 + cvtss2sd %xmm4, %xmm4 + cvtss2sd %xmm3, %xmm3 + mulsd %xmm4, %xmm7 + mulsd %xmm4, %xmm6 + subsd %xmm3, %xmm7 + movsd (%r15), %xmm10 + movaps %xmm4, %xmm9 + mulsd %xmm8, %xmm10 + movaps %xmm3, %xmm5 + addsd %xmm6, %xmm7 + mulsd %xmm4, %xmm9 + mulsd %xmm4, %xmm5 + mulsd %xmm4, %xmm7 + mulsd %xmm9, %xmm10 + movsd (%r14), %xmm11 + movsd (%r8), %xmm15 + lea 112+__sqrt_x_table(%rip), %r8 + sarl $1, %eax + subsd %xmm5, %xmm11 + subsd %xmm10, %xmm15 + subsd %xmm7, %xmm11 + mulsd %xmm4, %xmm15 + movsd (%r8), %xmm13 + lea 120+__sqrt_x_table(%rip), %r8 + mulsd %xmm4, %xmm13 + negl %eax + mulsd %xmm11, %xmm15 + comisd %xmm12, %xmm13 + mulsd (%r8), %xmm15 + movaps %xmm13, %xmm14 + cvttsd2si %xmm15, %r9 + subsd %xmm12, %xmm14 + jae ..L18 + movaps %xmm13, %xmm14 +..L18: + cvttsd2si %xmm14, %r10 + movq %r9, %r8 + incl %eax + shlq $39, %r10 + sarq $12, %r8 + sarq $11, %r9 + addq %r8, %r10 + andq $1, %r9 + movq $0x4000000000000000, %r8 + addq %r9, %r10 + andq %r10, %r8 + testq %r10, %r10 + movl $0, -24(%rdx) + movl %eax, -20(%rdx) + movq $0, -8(%rdx) + lea -1(,%r8,2), %r8 + cmovns %r8, %r10 + movq %r10, -16(%rdx) +..___tag_value___dpml_ux_sqrt_evaluation__.19: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.20: +..B1.3: + movq %r12, %rdx + lea 32(%rsp), %rdi + lea 56(%rsp), %rsi +..___tag_value___dpml_ux_sqrt_evaluation__.21: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.22: +..B1.4: + lea 160+__sqrt_x_table(%rip), %rdi + movq %r12, %rsi + movl $9, %edx + movq %r12, %rcx +..___tag_value___dpml_ux_sqrt_evaluation__.23: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.24: +..B1.5: + testq $1, %rbp + lea 32(%rsp), %rsi + movq %r12, %rdi + lea 56(%rsp), %rax + cmovne %rax, %rsi + movq %r12, %rdx +..___tag_value___dpml_ux_sqrt_evaluation__.25: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.26: +..B1.6: + decl 4(%r12) + lea (%rsp), %rdi +..___tag_value___dpml_ux_sqrt_evaluation__.27: + call fesetenv@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.28: +..B1.7: + xorl %r15d, %r15d + testq $2, %rbp + jne ..B1.11 +..B1.8: + movq 88(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B1.10 +..B1.9: + movq %r15, %rax + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.10: + call __stack_chk_fail@PLT +..B1.11: + movq %r12, %rdi + xorl %esi, %esi +..___tag_value___dpml_ux_sqrt_evaluation__.49: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.50: +..B1.12: + movq 16(%r12), %r14 + lea 8(%r14), %r8 + testq $16368, %r8 + jne ..B1.8 +..B1.13: + andq $-32768, %r14 + movq %r12, %rdi + movq %r12, %rsi + lea 56(%rsp), %rdx + lea 32(%rsp), %rcx + lea 16384(%r14), %r13 + movq %r13, 16(%r12) +..___tag_value___dpml_ux_sqrt_evaluation__.51: + call __dpml_extended_multiply__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.52: +..B1.14: + movq %rbx, %rdi + lea 56(%rsp), %rsi + movl $1, %edx + movq %rsi, %rcx +..___tag_value___dpml_ux_sqrt_evaluation__.53: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.54: +..B1.15: + movl $1, %edx + lea 56(%rsp), %rdi + movq %rdi, %rcx + lea 32(%rsp), %rsi +..___tag_value___dpml_ux_sqrt_evaluation__.55: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.56: +..B1.16: + movl 56(%rsp), %r8d + testl %r8d, %r8d + cmove %r13, %r14 + testq $4, %rbp + movq %r14, 16(%r12) + je ..B1.8 +..B1.17: + movl 4(%r12), %ebx + xorl %edx, %edx + addl $-113, %ebx + lea 56(%rsp), %rdi + subl %ebx, 4(%rdi) + movl $1, %ebx + testl %r8d, %r8d + movq %r12, %rsi + cmove %ebx, %edx + movq %rdi, %rcx + orl $8, %edx +..___tag_value___dpml_ux_sqrt_evaluation__.57: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_sqrt_evaluation__.58: +..B1.18: + xorl %r15d, %r15d + cmpq $8192, 72(%rsp) + cmove %ebx, %r15d + jmp ..B1.8 + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_sqrt_evaluation__,@function + .size __dpml_ux_sqrt_evaluation__,.-__dpml_ux_sqrt_evaluation__ + .data +# -- End __dpml_ux_sqrt_evaluation__ + .text +# -- Begin __sqrtq + .text + .align 16,0x90 + .globl __sqrtq +__sqrtq: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value___sqrtq.60: +..L61: + + subq $136, %rsp + .cfi_def_cfa_offset 144 + xorl %esi, %esi + lea __sqrt_x_table(%rip), %rcx + lea 48(%rsp), %rdi + movq %fs:40, %rax + lea 88(%rsp), %rdx + xorq %rsp, %rax + lea 112(%rsp), %r8 + movaps %xmm0, -40(%rdx) + lea (%rsp), %r9 + movq %rax, 40(%rdx) + movq $1, -80(%rdx) + movq $0, (%r9) +..___tag_value___sqrtq.63: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___sqrtq.64: +..B2.2: + testq %rax, %rax + jl ..B2.5 +..B2.3: + movl $7, %esi + lea 88(%rsp), %rdi + lea 64(%rsp), %rdx +..___tag_value___sqrtq.65: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___sqrtq.66: +..B2.4: + movl $1, %edx + xorl %ecx, %ecx + testq %rax, %rax + lea 64(%rsp), %rdi + cmove %edx, %ecx + xorl %edx, %edx + lea 112(%rsp), %rsi + movq %rcx, -104(%rsi) + xorl %ecx, %ecx + lea (%rsp), %r8 +..___tag_value___sqrtq.67: + call __dpml_pack__@PLT +..___tag_value___sqrtq.68: +..B2.5: + movq 128(%rsp), %rax + xorq %rsp, %rax + movaps 112(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.7 +..B2.6: + addq $136, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 +..B2.7: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __sqrtq,@function + .size __sqrtq,.-__sqrtq + .data +# -- End __sqrtq + .text +# -- Begin __rsqrtq + .text + .align 16,0x90 + .globl __rsqrtq +__rsqrtq: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___rsqrtq.72: +..L73: + + subq $136, %rsp + .cfi_def_cfa_offset 144 + xorl %esi, %esi + lea 8+__sqrt_x_table(%rip), %rcx + lea 48(%rsp), %rdi + movq %fs:40, %rax + lea 88(%rsp), %rdx + xorq %rsp, %rax + lea 112(%rsp), %r8 + movaps %xmm0, -40(%rdx) + lea (%rsp), %r9 + movq %rax, 40(%rdx) + movq $1, -80(%rdx) + movq $0, (%r9) +..___tag_value___rsqrtq.75: + call __dpml_unpack_x_or_y__@PLT +..___tag_value___rsqrtq.76: +..B3.2: + testq %rax, %rax + jl ..B3.5 +..B3.3: + xorl %esi, %esi + lea 88(%rsp), %rdi + lea 64(%rsp), %rdx +..___tag_value___rsqrtq.77: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___rsqrtq.78: +..B3.4: + movl $1, %edx + xorl %ecx, %ecx + testq %rax, %rax + lea 64(%rsp), %rdi + cmove %edx, %ecx + xorl %edx, %edx + lea 112(%rsp), %rsi + movq %rcx, -104(%rsi) + xorl %ecx, %ecx + lea (%rsp), %r8 +..___tag_value___rsqrtq.79: + call __dpml_pack__@PLT +..___tag_value___rsqrtq.80: +..B3.5: + movq 128(%rsp), %rax + xorq %rsp, %rax + movaps 112(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B3.7 +..B3.6: + addq $136, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 +..B3.7: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __rsqrtq,@function + .size __rsqrtq,.-__rsqrtq + .data +# -- End __rsqrtq + .text +# -- Begin __dpml_ux_hypot__ + .text + .align 16,0x90 + .globl __dpml_ux_hypot__ +__dpml_ux_hypot__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B4.1: + .cfi_startproc +..___tag_value___dpml_ux_hypot__.84: +..L85: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + subq $88, %rsp + .cfi_def_cfa_offset 112 + movq %rdx, %r12 + movq %rsi, %rbp + movq %rdi, %rsi + movq %fs:40, %rax + lea (%rsp), %rdx + xorq %rsp, %rax + movq %rax, 72(%rdx) +..___tag_value___dpml_ux_hypot__.91: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_hypot__.92: +..B4.2: + movq %rbp, %rdi + movq %rbp, %rsi + lea 24(%rsp), %rdx +..___tag_value___dpml_ux_hypot__.93: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_hypot__.94: +..B4.3: + xorl %edx, %edx + lea (%rsp), %rdi + lea 24(%rsp), %rsi + lea 48(%rsp), %rcx +..___tag_value___dpml_ux_hypot__.95: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_hypot__.96: +..B4.4: + xorl %esi, %esi + lea 48(%rsp), %rdi +..___tag_value___dpml_ux_hypot__.97: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_hypot__.98: +..B4.5: + movl $7, %esi + lea 48(%rsp), %rdi + movq %r12, %rdx +..___tag_value___dpml_ux_hypot__.99: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___dpml_ux_hypot__.100: +..B4.6: + testq %rax, %rax + je ..B4.18 +..B4.7: + movl 4(%rsp), %ecx + lea (%rsp), %rbp + subl 28(%rbp), %ecx + movslq %ecx, %rcx + testq %rcx, %rcx + jns ..B4.9 +..B4.8: + negq %rcx + lea 24(%rsp), %rbp +..B4.9: + cmpq $128, %rcx + jle ..B4.11 +..B4.10: + xorl %eax, %eax + jmp ..B4.18 +..B4.11: + movl $1, %edx +..B4.12: + movq 8(%rbp,%rdx,8), %rax + testq %rax, %rax + jne ..B4.10 +..B4.13: + cmpq $64, %rcx + jl ..B4.16 +..B4.14: + addq $-64, %rcx + decq %rdx + jns ..B4.12 +..B4.16: + movq %rax, %rdx + movl $1, %ebp + shrq %cl, %rdx + xorl %esi, %esi + shlq %cl, %rdx + cmpq %rdx, %rax + cmove %ebp, %esi + movl %esi, %eax +..B4.18: + movq 72(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B4.20 +..B4.19: + addq $88, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 + .cfi_offset 6, -24 + .cfi_offset 12, -16 +..B4.20: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_hypot__,@function + .size __dpml_ux_hypot__,.-__dpml_ux_hypot__ + .data +# -- End __dpml_ux_hypot__ + .section .rodata, "a" + .align 16 + .align 16 +__sqrt_x_table: + .long 1088750600 + .long 605086734 + .long 1088766984 + .long 519758862 + .long 112 + .long 0 + .long 113 + .long 0 + .long 114 + .long 0 + .long 0 + .long 0 + .long 0 + .long 268435456 + .long 858997845 + .long 34 + .long 1636176969 + .long 409044504 + .long 1099306057 + .long 404751376 + .long 545392672 + .long 404783624 + .long 142938632 + .long 302522498 + .long 1719614413 + .long 1073127582 + .long 0 + .long 1072693248 + .long 0 + .long 1097859072 + .long 0 + .long 1151336448 + .long 0 + .long 1047527424 + .long 0 + .long 991952896 + .long 0 + .long 1072431104 + .long 0 + .long 1071120384 + .long 0 + .long 2 + .long 0 + .long 3221225472 + .long 0 + .long 0 + .long 0 + .long 0 + .type __sqrt_x_table,@object + .size __sqrt_x_table,192 + .align 8 +.L_2il0floatpacket.21: + .long 0x00000000,0x43e00000 + .type .L_2il0floatpacket.21,@object + .size .L_2il0floatpacket.21,8 + .align 4 +.L_2il0floatpacket.20: + .long 0x5f000000 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/dpml_ux_trig.S b/external/sgx_libm/intel64/dpml_ux_trig.S new file mode 100644 index 0000000000..6871597d29 --- /dev/null +++ b/external/sgx_libm/intel64/dpml_ux_trig.S @@ -0,0 +1,2192 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "dpml_ux_trig.c" + .text +..TXTST0: +# -- Begin __dpml_ux_radian_reduce__ + .text + .align 16,0x90 +__dpml_ux_radian_reduce__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B1.1: + .cfi_startproc +..___tag_value___dpml_ux_radian_reduce__.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $120, %rsp + .cfi_def_cfa_offset 176 + movq 8(%rdi), %rax + movq 16(%rdi), %rcx + movl (%rdi), %r8d + movq %rdx, 48(%rsp) + movq %rsi, %rdx + movslq 4(%rdi), %rsi + testq %rsi, %rsi + movq %rax, 80(%rsp) + movq %rcx, 104(%rsp) + movl %r8d, 40(%rsp) + jl ..B1.21 +..B1.2: + addq $8, %rsi + movq %rsi, %rbx + sarq $6, %rbx + movq __four_over_pi@GOTPCREL(%rip), %rax + movq %rbx, 56(%rsp) + lea (%rax,%rbx,8), %rbp + movq 32(%rbp), %rcx + movq (%rbp), %rbx + movq 8(%rbp), %r11 + movq 16(%rbp), %rdi + movq 24(%rbp), %rax + addq $40, %rbp + movq %rcx, 8(%rsp) + andq $63, %rsi + movq %rbp, (%rsp) + je ..B1.4 +..B1.3: + movq %rsi, %rbp + movl %esi, %ecx + negq %rbp + movq %r11, %r8 + movq %rbp, 56(%rsp) + movq %rdi, %r9 + shlq %cl, %rbx + movl %ebp, %ecx + shrq %cl, %r8 + movl %esi, %ecx + shlq %cl, %r11 + movl %ebp, %ecx + shrq %cl, %r9 + movl %esi, %ecx + shlq %cl, %rdi + movl %ebp, %ecx + movq %rax, %r10 + orq %r8, %rbx + shrq %cl, %r10 + movl %esi, %ecx + shlq %cl, %rax + movl %ebp, %ecx + movq 8(%rsp), %r12 + orq %r9, %r11 + shrq %cl, %r12 + orq %r10, %rdi + orq %r12, %rax +..B1.4: + movq %rdx, 32(%rsp) + xorl %r13d, %r13d + movl %eax, %edx + movq 104(%rsp), %r10 + movq %r10, %r8 + movl %r10d, %ebp + movq %rdx, %r15 + movq %rbx, 24(%rsp) + movq %rax, %rbx + shrq $32, %r8 + movq %rdx, %r12 + imulq %rbp, %r15 + imulq %r8, %r12 + shrq $32, %rbx + movq %rbp, %r9 + imulq %rbx, %r9 + movq %rsi, 112(%rsp) + movq %r10, %rsi + imulq %rax, %rsi + shrq $32, %r15 + movq %r8, %r14 + addq %r12, %r15 + addq %r15, %r9 + cmpq %r15, %r9 + movq %r9, %r12 + movq 80(%rsp), %r9 + setb %r13b + shrq $32, %r12 + shlq $32, %r13 + movq %rsi, 16(%rsp) + addq %r13, %r12 + movl %r9d, %ecx + movq %r9, %rsi + movq %rdx, %r13 + movq %rcx, %r15 + shrq $32, %rsi + imulq %rcx, %r13 + imulq %rsi, %rdx + imulq %rbx, %r15 + imulq %rbx, %r14 + imulq %r9, %rax + imulq %rsi, %rbx + shrq $32, %r13 + addq %r14, %r12 + addq %rdx, %r13 + addq %rax, %r12 + addq %r13, %r15 + cmpq %r13, %r15 + movq %r15, %rdx + movl $0, %r15d + setb %r15b + cmpq %rax, %r12 + movl $0, %eax + setb %al + shrq $32, %rdx + shlq $32, %r15 + addq %r15, %rdx + movq %r10, %r15 + addq %rbx, %rdx + addq %rax, %rdx + movq %rdi, %rbx + movl %edi, %eax + movq %rax, %r14 + movq %rax, %r13 + imulq %rbp, %r14 + imulq %r8, %r13 + imulq %rdi, %r15 + imulq %r9, %rdi + shrq $32, %rbx + addq %r15, %r12 + movq %rbp, 88(%rsp) + imulq %rbx, %rbp + shrq $32, %r14 + addq %r13, %r14 + addq %r14, %rbp + cmpq %r14, %rbp + movl $0, %r14d + movq %rbp, %r13 + movq %r8, %rbp + setb %r14b + cmpq %r15, %r12 + movl $0, %r15d + movq %rcx, 64(%rsp) + setb %r15b + imulq %rbx, %rbp + shrq $32, %r13 + shlq $32, %r14 + addq %r14, %r13 + movq %rax, %r14 + imulq %rcx, %r14 + imulq %rsi, %rax + imulq %rbx, %rcx + imulq %rsi, %rbx + addq %rbp, %r13 + addq %r15, %rdx + xorl %ebp, %ebp + cmpq %r15, %rdx + movq %rsi, 72(%rsp) + setb %bpl + xorl %esi, %esi + addq %r13, %rdx + cmpq %r13, %rdx + movl $0, %r13d + setb %r13b + addq %rdi, %rdx + shrq $32, %r14 + addq %rax, %r14 + addq %r14, %rcx + addq %r13, %rbp + xorl %r13d, %r13d + cmpq %r14, %rcx + movq %rcx, %r15 + setb %r13b + cmpq %rdi, %rdx + movl $0, %edi + setb %dil + movq %r10, %r14 + shrq $32, %r15 + shlq $32, %r13 + addq %r13, %r15 + movq %r11, %r13 + addq %rbx, %r15 + addq %rdi, %r15 + addq %rbp, %r15 + movl %r11d, %ebp + movq %rbp, %rbx + movq 88(%rsp), %rax + imulq %rax, %rbx + imulq %r8, %rbp + imulq %r11, %r14 + imulq %r9, %r11 + shrq $32, %r13 + addq %r14, %rdx + imulq %r13, %rax + imulq %r8, %r13 + shrq $32, %rbx + addq %r15, %r11 + addq %rbp, %rbx + xorl %ebp, %ebp + addq %rbx, %rax + cmpq %rbx, %rax + movq %rax, %rdi + movq 32(%rsp), %rbx + movq %rbx, %rcx + setb %sil + cmpq %r14, %rdx + setb %bpl + negq %rcx + shrq $32, %rdi + shlq $32, %rsi + addq %rsi, %rdi + addq %r13, %rdi + addq %rdi, %rbp + addq %r11, %rbp + movq 24(%rsp), %r11 + imulq %r10, %r11 + cmpl $0, 40(%rsp) + movq %r8, 96(%rsp) + cmovne %rcx, %rbx + addq %r11, %rbp + shlq $61, %rbx + addq %rbx, %rbp + movq 16(%rsp), %r8 + xorl %ebx, %ebx + movq (%rsp), %r10 + movq 8(%rsp), %r11 + jmp ..B1.5 +..B1.9: + movq $0xe000000000000000, %rsi + addq $64, %rbx + andq %rbp, %rsi + movq $0x1fffffffffffffff, %rbp + andq %rdx, %rbp + movq %r12, %rdx + orq %rsi, %rbp + movq %r8, %r12 + movq %rcx, %r8 +..B1.5: + movq $0x40000000000000, %rcx + movq $0x3f80000000000000, %rdi + lea (%rcx,%rbp), %rsi + testq %rdi, %rsi + jne ..B1.10 +..B1.6: + movq %r11, %r9 + movq 112(%rsp), %rsi + movl %esi, %ecx + movq %r9, %r14 + movq (%r10), %r11 + movq %r11, %rdi + shlq %cl, %r14 + addq $8, %r10 + movq 56(%rsp), %rcx + movq 88(%rsp), %rax + movq %rax, %r15 + shrq %cl, %rdi + orq %rdi, %r14 + testq %rsi, %rsi + movq 96(%rsp), %r13 + cmovne %r14, %r9 + movq %r13, %r14 + movl %r9d, %esi + movq %r9, %rdi + imulq %rsi, %r15 + imulq %rsi, %r14 + shrq $32, %rdi + imulq %rdi, %rax + imulq %rdi, %r13 + shrq $32, %r15 + addq %r14, %r15 + addq %r15, %rax + cmpq %r15, %rax + movl $0, %r15d + movq %rax, %r14 + setb %r15b + shrq $32, %r14 + shlq $32, %r15 + addq %r15, %r14 + addq %r13, %r14 + movq 64(%rsp), %r13 + movq %r13, %rax + imulq %rsi, %rax + movq 72(%rsp), %r15 + addq %r14, %r8 + imulq %r15, %rsi + shrq $32, %rax + cmpq %r14, %r8 + movq 104(%rsp), %rcx + movl $0, %r14d + setb %r14b + addq %rsi, %rax + movq %r13, %rsi + imulq %rdi, %rsi + imulq %r9, %rcx + imulq 80(%rsp), %r9 + imulq %r15, %rdi + addq %rax, %rsi + addq %r14, %r12 + movq %rsi, %r13 + cmpq %r14, %r12 + movl $0, %r14d + setb %r14b + cmpq %rax, %rsi + movl $0, %esi + setb %sil + addq %r9, %r8 + cmpq %r9, %r8 + movl $0, %r9d + setb %r9b + shrq $32, %r13 + shlq $32, %rsi + addq %rsi, %r13 + addq %r9, %r12 + addq %rdi, %r13 + xorl %esi, %esi + cmpq %r9, %r12 + setb %sil + addq %r13, %r12 + cmpq %r13, %r12 + movl $0, %r13d + setb %r13b + addl %r14d, %esi + addl %r13d, %esi + je ..B1.8 +..B1.7: + incq %rdx + lea 1(%rbp), %rsi + cmove %rsi, %rbp +..B1.8: + movq %rdx, %r9 + movq %rbp, %rsi + shrq $55, %r9 + shlq $9, %rsi + orq %rsi, %r9 + movq %r9, %rdi + sarq $63, %rdi + cmpq %r9, %rdi + je ..B1.9 +..B1.10: + movq %r8, 16(%rsp) +..B1.11: + lea (,%rbp,4), %rcx + sarq $2, %rcx + movq %rcx, %rsi + subq %rcx, %rbp + sarq $63, %rsi + movq %rcx, %rdi + cmpq %rsi, %rcx + jne ..B1.13 +..B1.12: + movq %rdx, %rcx + movq %r12, %rdx + movq %r8, %r12 + addq $64, %rbx +..B1.13: + movl $-2147483648, %r10d + xorl %esi, %esi + testq %rdi, %rdi + cmovge %esi, %r10d + testl %r10d, %r10d + je ..B1.15 +..B1.14: + notq %r12 + movl $1, %edi + incq %r12 + notq %rdx + cmove %edi, %esi + xorl %r8d, %r8d + notq %rcx + addq %rsi, %rdx + cmove %edi, %r8d + addq %r8, %rcx +..B1.15: + movq %rbp, %r8 + xorl %esi, %esi + movq 48(%rsp), %rdi + negq %r8 + movl 40(%rsp), %r9d + testl %r9d, %r9d + movl $3, 4(%rdi) + cmovne %r8, %rbp + xorl %r9d, %r10d + movl %r10d, (%rdi) + movq %rcx, 8(%rdi) + movq %rdx, 16(%rdi) +..___tag_value___dpml_ux_radian_reduce__.16: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_radian_reduce__.17: +..B1.16: + movq 48(%rsp), %rdx + movslq 4(%rdx), %rsi + movq %rsi, %rcx + addq $-3, %rcx + je ..B1.18 +..B1.17: + shrq %cl, %r12 + orq %r12, 16(%rdx) +..B1.18: + movq %rdx, %rdi + subq %rbx, %rsi + movq %rdi, %rdx + movl %esi, 4(%rdi) + lea 1008+__trig_x_table(%rip), %rsi +..___tag_value___dpml_ux_radian_reduce__.18: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_radian_reduce__.19: +..B1.19: + shrq $62, %rbp + movq %rbp, %rax + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.21: + movl %r8d, %ecx + sarl $31, %ecx + movslq %ecx, %rcx + addq %rdx, %rcx + movq %rcx, %rbx + andq $1, %rbx + addq %rbx, %rcx + movq %rcx, %rbx + sarq $1, %rbx + subq %rcx, %rdx + je ..B1.23 +..B1.22: + shrq $63, %rdx + lea 1008+__trig_x_table(%rip), %rsi + movq 48(%rsp), %rcx +..___tag_value___dpml_ux_radian_reduce__.40: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_radian_reduce__.41: + jmp ..B1.24 +..B1.23: + movq 48(%rsp), %rcx + movl %r8d, %edx + movl %esi, 4(%rcx) + movq %rax, %rsi + movq %rsi, 8(%rcx) + movq 16(%rdi), %rdi + movl %edx, (%rcx) + movq %rdi, 16(%rcx) +..B1.24: + movq %rbx, %rax + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_radian_reduce__,@function + .size __dpml_ux_radian_reduce__,.-__dpml_ux_radian_reduce__ + .data +# -- End __dpml_ux_radian_reduce__ + .text +# -- Begin __dpml_ux_degree_reduce__ + .text + .align 16,0x90 +__dpml_ux_degree_reduce__: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B2.1: + .cfi_startproc +..___tag_value___dpml_ux_degree_reduce__.56: +..L57: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $48, %rsp + .cfi_def_cfa_offset 96 + movq %rdi, %rbp + movq %rdx, %r13 + movq %rsi, %rbx + movl 4(%rbp), %r14d + cmpl $142, %r14d + movl (%rbp), %r15d + jle ..B2.3 +..B2.2: + lea 264+__trig_x_table(%rip), %rax + movslq %r14d, %r8 + addq $32641, %r8 + movl %r8d, %ecx + movq (%rax), %r9 + movq %rcx, %r10 + movl %r9d, %esi + shrq $32, %r9 + imulq %rsi, %r10 + imulq %r9, %rcx + shrq $32, %r8 + imulq %r8, %rsi + imulq %r8, %r9 + shrq $32, %r10 + addq %rcx, %r10 + addq %rsi, %r10 + shrq $32, %r10 + addq %r9, %r10 + lea (,%r10,8), %r11d + lea (%r11,%r10,4), %eax + negl %eax + lea 32772(%r14,%rax), %r14d + movl %r14d, 4(%rbp) +..B2.3: + cmpl $16, %r14d + jl ..B2.25 +..B2.4: + movslq %r14d, %r14 + xorl %r8d, %r8d + lea -15(%r14), %rsi + movq %rsi, %rcx + andq $63, %rcx + sarq $6, %rsi + subq %rcx, %r14 + testq %rcx, %rcx + je ..B2.6 +..B2.5: + movq 16(%rbp), %rax + movq %rax, %r8 + movq %rcx, %r9 + shlq %cl, %r8 + negq %r9 + movq %r8, 16(%rbp) + movq 8(%rbp), %r8 + movq %r8, %r10 + shlq %cl, %r10 + movl %r9d, %ecx + shrq %cl, %rax + movl %r9d, %ecx + orq %rax, %r10 + movq %r10, 8(%rbp) + shrq %cl, %r8 +..B2.6: + movq %r8, (%rbp) + lea (%rbp,%rsi,8), %rdi + movq 8(%rdi), %rcx + movq %rcx, %r9 + shrq $52, %r9 + xorl %r11d, %r11d + testq %rsi, %rsi + jl ..B2.19 +..B2.7: + xorl %eax, %eax + lea 1(%rsi), %rdx + movq %rdx, %rcx + movl $1, %r8d + shrq $63, %rcx + xorl %r10d, %r10d + lea 1(%rsi,%rcx), %rcx + sarq $1, %rcx + testq %rcx, %rcx + jbe ..B2.15 +..B2.8: + movq (%rbp,%rsi,8), %r8 + movq %r8, (%rsp) + movq $0xfffffffffffffff, %r8 + movq $0, 8(%rsp) + movl %r15d, 32(%rsp) + movq %r13, 16(%rsp) + movq %rbp, 24(%rsp) + movq %rcx, %rbp + movq %r12, 40(%rsp) + .cfi_offset 12, -56 + movq (%rsp), %r15 + movq 8(%rsp), %r13 +..B2.9: + movq %r8, %r12 + andq %r15, %r12 + shrq $60, %r15 + addq %r15, %r12 + addq %r9, %r12 + movq $0, (%rdi,%r13) + addq $4, %r11 + movq -8(%rdi,%r13), %r15 + je ..B2.11 +..B2.10: + movl %r11d, %ecx + movq %r15, %r9 + negq %r11 + addq $12, %r11 + shlq %cl, %r9 + movl %r11d, %ecx + andq $4095, %r9 + negq %r11 + shrq %cl, %r15 + addq %r9, %r12 +..B2.11: + movq %r8, %r9 + incq %rax + andq %r15, %r9 + addq $4, %r11 + shrq $60, %r15 + addq $-16, %r10 + addq %r15, %r9 + addq %r12, %r9 + movq $0, -8(%rdi,%r13) + cmpq %rbp, %rax + jae ..B2.14 +..B2.12: + movq (%r10,%rdi), %r15 + movq %r10, %r13 + testq %r11, %r11 + je ..B2.9 +..B2.13: + movl %r11d, %ecx + movq %r15, %r12 + negq %r11 + addq $12, %r11 + shlq %cl, %r12 + movl %r11d, %ecx + andq $4095, %r12 + negq %r11 + shrq %cl, %r15 + addq %r12, %r9 + jmp ..B2.9 +..B2.14: + movl 32(%rsp), %r15d + lea 1(,%rax,2), %r8 + movq 24(%rsp), %rbp + movq 16(%rsp), %r13 + movq 40(%rsp), %r12 + .cfi_restore 12 +..B2.15: + lea -1(%r8), %rax + cmpq %rax, %rdx + jbe ..B2.45 +..B2.16: + subq %r8, %rsi + testq %r11, %r11 + movq 8(%rbp,%rsi,8), %rax + je ..B2.18 +..B2.17: + movl %r11d, %ecx + movq %rax, %r8 + negq %r11 + addq $12, %r11 + shlq %cl, %r8 + movl %r11d, %ecx + andq $4095, %r8 + shrq %cl, %rax + addq %r8, %r9 +..B2.18: + movq $0xfffffffffffffff, %rcx + andq %rax, %rcx + shrq $60, %rax + movq $0, 8(%rbp,%rsi,8) + addq %rax, %rcx + addq %rcx, %r9 + movq 8(%rdi), %rcx +..B2.19: + movq %r9, %rax + shrq $12, %rax + testq %rax, %rax + je ..B2.23 +..B2.21: + andq $4095, %r9 + addq %rax, %r9 + movq %r9, %rax + shrq $12, %rax + testq %rax, %rax + jne ..B2.21 +..B2.23: + movq $0xfffffffffffff, %rax + xorl %esi, %esi + shlq $52, %r9 + andq %rcx, %rax + orq %r9, %rax + movq %rax, 8(%rdi) + movq %rbp, %rdi + movl %r14d, 4(%rbp) +..___tag_value___dpml_ux_degree_reduce__.71: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_degree_reduce__.72: +..B2.24: + subq %rax, %r14 +..B2.25: + movslq %r14d, %r14 + movl $0, (%rbp) + addq $-5, %r14 + movq 8(%rbp), %r8 + jle ..B2.27 +..B2.26: + lea 256+__trig_x_table(%rip), %rsi + movq %r8, %rax + movl %r8d, %ecx + xorl %r11d, %r11d + movq %rcx, %r10 + shrq $32, %rax + movq (%rsi), %rdx + movl %edx, %r9d + shrq $32, %rdx + imulq %r9, %r10 + imulq %rdx, %rcx + imulq %rax, %r9 + imulq %rax, %rdx + shrq $32, %r10 + addq %rcx, %r10 + addq %r10, %r9 + cmpq %r10, %r9 + movq %r9, %rsi + setb %r11b + shrq $32, %rsi + shlq $32, %r11 + addq %r11, %rsi + addq %rdx, %rsi + jmp ..B2.28 +..B2.27: + movl $1, %r14d + xorl %esi, %esi +..B2.28: + negq %r14 + movq %rbx, %rax + andq $1, %rax + incq %rax + shrq $1, %rbx + lea 63(%r14), %rcx + shlq %cl, %rax + addq %rsi, %rax + movl %r14d, %ecx + movl $1, %esi + shlq %cl, %rsi + movl %r14d, %ecx + decq %rsi + notq %rsi + andq %rsi, %rax + movq %r8, %rsi + movq %rax, %r10 + andq $3, %r8 + shrq %cl, %r10 + movq $0x0b4000000, %rcx + movl %eax, %r11d + movq %r10, %r9 + imulq %rcx, %r11 + shrq $32, %rax + negq %r9 + imulq %rax, %rcx + shrq $2, %rsi + testl %r15d, %r15d + cmovne %r9, %r10 + shrq $32, %r11 + addq %r10, %rbx + subq %r11, %rsi + subq %rcx, %rsi + lea (,%rsi,4), %rax + orq %rax, %r8 + testq %rsi, %rsi + jns ..B2.30 +..B2.29: + movq 16(%rbp), %rax + movl $1, %ecx + xorl %esi, %esi + testq %rax, %rax + cmovne %ecx, %esi + movq %rax, %r9 + movslq %r15d, %r15 + negq %r9 + btcq $31, %r15 + addq %rsi, %r8 + movq %r9, 16(%rbp) + negq %r8 +..B2.30: + movq %rbp, %rdi + xorl %esi, %esi + movq %r8, 8(%rbp) +..___tag_value___dpml_ux_degree_reduce__.73: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_degree_reduce__.74: +..B2.31: + shlq $3, %rbx + movq 8(%rbp), %rsi + shrl $3, %ebx + movl 4(%rbp), %ecx + testq %rsi, %rsi + jne ..B2.34 +..B2.32: + movq $0x2000000000000000, %rcx + orq %rcx, %rbx + testq $2, %rbx + je ..B2.43 +..B2.33: + movslq (%rbp), %rcx + btcq $31, %rcx + movl %ecx, (%rbp) + jmp ..B2.43 +..B2.34: + cmpl $5, %ecx + jl ..B2.42 +..B2.35: + cmpq $0, 16(%rbp) + jne ..B2.42 +..B2.36: + negl %ecx + movq %rsi, %r9 + shrq %cl, %r9 + movq %r9, %r8 + shlq %cl, %r8 + cmpq %r8, %rsi + jne ..B2.42 +..B2.37: + cmpq $30, %r9 + jne ..B2.41 +..B2.38: + testq $1, %rbx + jne ..B2.42 +..B2.39: + movq $0x4000000000000000, %rcx + xorl %r15d, (%rbp) + orq %rcx, %rbx + jmp ..B2.43 +..B2.41: + movq $0x8000000000000000, %rcx + orq %rbx, %rcx + cmpq $45, %r9 + cmove %rcx, %rbx +..B2.42: + xorl %r15d, (%rbp) +..B2.43: + movq %rbp, %rdi + lea 216+__trig_x_table(%rip), %rsi + movq %r13, %rdx +..___tag_value___dpml_ux_degree_reduce__.75: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_degree_reduce__.76: +..B2.44: + movq %rbx, %rax + addq $48, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B2.45: + movq 8(%rdi), %rcx + jmp ..B2.19 + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_degree_reduce__,@function + .size __dpml_ux_degree_reduce__,.-__dpml_ux_degree_reduce__ + .data +# -- End __dpml_ux_degree_reduce__ + .text +# -- Begin __dpml_ux_sincos + .text + .align 16,0x90 + .globl __dpml_ux_sincos +__dpml_ux_sincos: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B3.1: + .cfi_startproc +..___tag_value___dpml_ux_sincos.95: +..L96: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $136, %rsp + .cfi_def_cfa_offset 192 + movq %rdx, %r15 + testq $16, %r15 + lea __dpml_ux_degree_reduce__(%rip), %r10 + lea __dpml_ux_radian_reduce__(%rip), %r9 + movq %rcx, %r12 + cmovne %r10, %r9 + movq %rsi, %rbp + movq %fs:40, %rax + movq %rdi, %r13 + xorq %rsp, %rax + movq %rax, 128(%rsp) + cmpq %r10, %r9 + jne ..B3.54 +..B3.2: + movl 4(%r13), %ebx + cmpl $142, %ebx + movl (%r13), %r14d + jle ..B3.4 +..B3.3: + lea 264+__trig_x_table(%rip), %rax + movslq %ebx, %r9 + addq $32641, %r9 + movl %r9d, %ecx + movq (%rax), %r10 + movq %rcx, %r11 + movl %r10d, %esi + shrq $32, %r10 + imulq %rsi, %r11 + imulq %r10, %rcx + shrq $32, %r9 + imulq %r9, %rsi + imulq %r9, %r10 + shrq $32, %r11 + addq %rcx, %r11 + addq %rsi, %r11 + shrq $32, %r11 + addq %r10, %r11 + lea (,%r11,8), %eax + lea (%rax,%r11,4), %eax + negl %eax + lea 32772(%rbx,%rax), %ebx + movl %ebx, 4(%r13) +..B3.4: + cmpl $16, %ebx + jl ..B3.26 +..B3.5: + movslq %ebx, %rbx + xorl %r9d, %r9d + lea -15(%rbx), %rax + movq %rax, %rcx + andq $63, %rcx + sarq $6, %rax + subq %rcx, %rbx + testq %rcx, %rcx + je ..B3.7 +..B3.6: + movq 16(%r13), %rsi + movq %rsi, %r9 + movq %rcx, %r10 + shlq %cl, %r9 + negq %r10 + movq %r9, 16(%r13) + movq 8(%r13), %r9 + movq %r9, %r11 + shlq %cl, %r11 + movl %r10d, %ecx + shrq %cl, %rsi + movl %r10d, %ecx + orq %rsi, %r11 + movq %r11, 8(%r13) + shrq %cl, %r9 +..B3.7: + movq %r9, (%r13) + lea (%r13,%rax,8), %r8 + movq 8(%r8), %rcx + movq %rcx, %rsi + shrq $52, %rsi + xorl %edx, %edx + testq %rax, %rax + jl ..B3.20 +..B3.8: + xorl %r10d, %r10d + lea 1(%rax), %rdi + movq %rdi, %rcx + movl $1, %r9d + shrq $63, %rcx + xorl %r11d, %r11d + lea 1(%rax,%rcx), %rcx + sarq $1, %rcx + testq %rcx, %rcx + jbe ..B3.16 +..B3.9: + movq (%r13,%rax,8), %r9 + movq %r9, (%rsp) + movq $0xfffffffffffffff, %r9 + movq $0, 8(%rsp) + movl %r14d, 24(%rsp) + movq %r13, 32(%rsp) + movq %rbx, 16(%rsp) + movq %rcx, %rbx + movq %r12, 40(%rsp) + movq (%rsp), %r14 + movq 8(%rsp), %r13 +..B3.10: + movq %r9, %r12 + andq %r14, %r12 + shrq $60, %r14 + addq %r14, %r12 + addq %rsi, %r12 + movq $0, (%r8,%r13) + addq $4, %rdx + movq -8(%r8,%r13), %r14 + je ..B3.12 +..B3.11: + movl %edx, %ecx + movq %r14, %rsi + negq %rdx + addq $12, %rdx + shlq %cl, %rsi + movl %edx, %ecx + andq $4095, %rsi + negq %rdx + shrq %cl, %r14 + addq %rsi, %r12 +..B3.12: + movq %r9, %rsi + incq %r10 + andq %r14, %rsi + addq $4, %rdx + shrq $60, %r14 + addq $-16, %r11 + addq %r14, %rsi + addq %r12, %rsi + movq $0, -8(%r8,%r13) + cmpq %rbx, %r10 + jae ..B3.15 +..B3.13: + movq (%r11,%r8), %r14 + movq %r11, %r13 + testq %rdx, %rdx + je ..B3.10 +..B3.14: + movl %edx, %ecx + movq %r14, %r12 + negq %rdx + addq $12, %rdx + shlq %cl, %r12 + movl %edx, %ecx + andq $4095, %r12 + negq %rdx + shrq %cl, %r14 + addq %r12, %rsi + jmp ..B3.10 +..B3.15: + movq 16(%rsp), %rbx + lea 1(,%r10,2), %r9 + movl 24(%rsp), %r14d + movq 32(%rsp), %r13 + movq 40(%rsp), %r12 +..B3.16: + lea -1(%r9), %rcx + cmpq %rcx, %rdi + jbe ..B3.69 +..B3.17: + subq %r9, %rax + testq %rdx, %rdx + movq 8(%r13,%rax,8), %r9 + je ..B3.19 +..B3.18: + movl %edx, %ecx + movq %r9, %r10 + negq %rdx + addq $12, %rdx + shlq %cl, %r10 + movl %edx, %ecx + andq $4095, %r10 + shrq %cl, %r9 + addq %r10, %rsi +..B3.19: + movq $0xfffffffffffffff, %rcx + andq %r9, %rcx + shrq $60, %r9 + movq $0, 8(%r13,%rax,8) + addq %r9, %rcx + addq %rcx, %rsi + movq 8(%r8), %rcx +..B3.20: + movq %rsi, %rax + shrq $12, %rax + testq %rax, %rax + je ..B3.24 +..B3.22: + andq $4095, %rsi + addq %rax, %rsi + movq %rsi, %rax + shrq $12, %rax + testq %rax, %rax + jne ..B3.22 +..B3.24: + movq $0xfffffffffffff, %rax + movq %r13, %rdi + shlq $52, %rsi + andq %rcx, %rax + orq %rsi, %rax + xorl %esi, %esi + movq %rax, 8(%r8) + movl %ebx, 4(%r13) +..___tag_value___dpml_ux_sincos.110: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_sincos.111: +..B3.25: + subq %rax, %rbx +..B3.26: + movslq %ebx, %rbx + movl $0, (%r13) + addq $-5, %rbx + movq 8(%r13), %r9 + jle ..B3.28 +..B3.27: + lea 256+__trig_x_table(%rip), %rsi + movq %r9, %rax + movl %r9d, %ecx + movq %rcx, %r11 + shrq $32, %rax + movq (%rsi), %rdx + movl %edx, %r10d + shrq $32, %rdx + imulq %r10, %r11 + imulq %rdx, %rcx + imulq %rax, %r10 + imulq %rax, %rdx + shrq $32, %r11 + addq %rcx, %r11 + xorl %ecx, %ecx + addq %r11, %r10 + cmpq %r11, %r10 + movq %r10, %rsi + setb %cl + shrq $32, %rsi + shlq $32, %rcx + addq %rcx, %rsi + addq %rdx, %rsi + jmp ..B3.29 +..B3.28: + movl $1, %ebx + xorl %esi, %esi +..B3.29: + negq %rbx + movq %rbp, %rax + andq $1, %rax + incq %rax + shrq $1, %rbp + lea 63(%rbx), %rcx + shlq %cl, %rax + addq %rsi, %rax + movl %ebx, %ecx + movl $1, %esi + shlq %cl, %rsi + movl %ebx, %ecx + decq %rsi + notq %rsi + andq %rsi, %rax + movq $0x0b4000000, %rsi + movq %rax, %r11 + shrq %cl, %r11 + movl %eax, %ecx + movq %r11, %r10 + imulq %rsi, %rcx + shrq $32, %rax + negq %r10 + imulq %rax, %rsi + testl %r14d, %r14d + cmovne %r10, %r11 + movq %r9, %r10 + shrq $2, %r10 + andq $3, %r9 + shrq $32, %rcx + addq %r11, %rbp + subq %rcx, %r10 + subq %rsi, %r10 + lea (,%r10,4), %rax + orq %rax, %r9 + testq %r10, %r10 + jns ..B3.31 +..B3.30: + movq 16(%r13), %rax + movl $1, %ecx + xorl %esi, %esi + testq %rax, %rax + cmovne %ecx, %esi + movq %rax, %r10 + movslq %r14d, %r14 + negq %r10 + btcq $31, %r14 + addq %rsi, %r9 + movq %r10, 16(%r13) + negq %r9 +..B3.31: + movq %r13, %rdi + xorl %esi, %esi + movq %r9, 8(%r13) +..___tag_value___dpml_ux_sincos.112: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_sincos.113: +..B3.32: + shlq $3, %rbp + movq 8(%r13), %rax + shrl $3, %ebp + movl 4(%r13), %ecx + movl %ebp, %ebx + testq %rax, %rax + jne ..B3.35 +..B3.33: + movq $0x2000000000000000, %rax + orq %rax, %rbx + testq $2, %rbx + je ..B3.44 +..B3.34: + movslq (%r13), %rax + btcq $31, %rax + movl %eax, (%r13) + jmp ..B3.44 +..B3.35: + cmpl $5, %ecx + jl ..B3.43 +..B3.36: + cmpq $0, 16(%r13) + jne ..B3.43 +..B3.37: + negl %ecx + movq %rax, %rsi + shrq %cl, %rsi + movq %rsi, %rdx + shlq %cl, %rdx + cmpq %rdx, %rax + jne ..B3.43 +..B3.38: + cmpq $30, %rsi + jne ..B3.42 +..B3.39: + testq $1, %rbx + jne ..B3.43 +..B3.40: + movq $0x4000000000000000, %rax + xorl %r14d, (%r13) + orq %rax, %rbx + jmp ..B3.44 +..B3.42: + movq $0x8000000000000000, %rax + orq %rbx, %rax + cmpq $45, %rsi + cmove %rax, %rbx +..B3.43: + xorl %r14d, (%r13) +..B3.44: + movq %r13, %rdi + lea 216+__trig_x_table(%rip), %rsi + lea (%rsp), %rdx +..___tag_value___dpml_ux_sincos.114: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_sincos.115: +..B3.46: + andq $-17, %r15 + movl $3, %ecx + movl $1, %eax + cmpq $3, %r15 + movq %rbx, %rdx + cmove %rax, %rcx + xorl %r13d, %r13d + movl $1, %esi + sarq $61, %rdx + testq %rcx, %rdx + movq %rbx, %rcx + cmove %esi, %r13d + andq $1, %rcx + cmpq $3, %r15 + je ..B3.68 +..B3.47: + movl $1216, %edx + testq %rcx, %rcx + movl $1038, %ecx + cmovne %rdx, %rcx +..B3.48: + lea 272+__trig_x_table(%rip), %rsi + lea (%rsp), %rdi + movl $13, %edx + movq %r12, %r8 +..___tag_value___dpml_ux_sincos.116: + call __dpml_evaluate_rational__@PLT +..___tag_value___dpml_ux_sincos.117: +..B3.49: + testq $2, %rbx + je ..B3.51 +..B3.50: + movslq (%r12), %rdx + btcq $31, %rdx + movl %edx, (%r12) +..B3.51: + cmpq $3, %r15 + je ..B3.64 +..B3.52: + movq 128(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B3.63 +..B3.53: + movq %r13, %rax + addq $136, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.54: + movq 8(%r13), %r11 + movq 16(%r13), %rax + movl (%r13), %ecx + movq %r11, 88(%rsp) + movslq 4(%r13), %r11 + testq %r11, %r11 + movq %rax, 112(%rsp) + movl %ecx, 56(%rsp) + jl ..B3.81 +..B3.55: + addq $8, %r11 + movq %r11, %rsi + sarq $6, %rsi + movq __four_over_pi@GOTPCREL(%rip), %rax + movq %rsi, 64(%rsp) + lea (%rax,%rsi,8), %r10 + movq 32(%r10), %rcx + movq (%r10), %r9 + movq 8(%r10), %rsi + movq 16(%r10), %rax + movq 24(%r10), %rdi + addq $40, %r10 + movq %rcx, 8(%rsp) + andq $63, %r11 + movq %r10, (%rsp) + je ..B3.57 +..B3.56: + movq %r11, %r10 + movl %r11d, %ecx + negq %r10 + movq %rsi, %r13 + movq %r10, 64(%rsp) + movq %rax, %r14 + shlq %cl, %r9 + movl %r10d, %ecx + shrq %cl, %r13 + movl %r11d, %ecx + shlq %cl, %rsi + movl %r10d, %ecx + shrq %cl, %r14 + movl %r11d, %ecx + shlq %cl, %rax + orq %r13, %r9 + movl %r10d, %ecx + movq %rdi, %r13 + shrq %cl, %r13 + movl %r11d, %ecx + shlq %cl, %rdi + movl %r10d, %ecx + orq %r13, %rax + orq %r14, %rsi + movq 8(%rsp), %r13 + shrq %cl, %r13 + orq %r13, %rdi +..B3.57: + movl %edi, %edx + movq %r11, 120(%rsp) + movq %rdx, %r13 + movq 112(%rsp), %r11 + movq %r11, %r8 + movq %r9, 24(%rsp) + movq %r11, %r9 + movq %r15, 16(%rsp) + movq %rdx, %r15 + movl %r11d, %ebx + movq %rbp, 32(%rsp) + movq %rdi, %rbp + shrq $32, %r9 + movq %rbx, %r10 + imulq %rbx, %r15 + imulq %r9, %r13 + imulq %rdi, %r8 + shrq $32, %rbp + movq %r9, %r14 + imulq %rbp, %r10 + imulq %rbp, %r14 + shrq $32, %r15 + addq %r13, %r15 + addq %r15, %r10 + cmpq %r15, %r10 + movq %r10, %r13 + movq %r12, 40(%rsp) + movl $0, %r12d + setb %r12b + shrq $32, %r13 + shlq $32, %r12 + movq 88(%rsp), %r10 + addq %r12, %r13 + movq %r8, 48(%rsp) + movq %r10, %r8 + movl %r10d, %ecx + movq %rdx, %r12 + shrq $32, %r8 + movq %rcx, %r15 + imulq %rcx, %r12 + imulq %r8, %rdx + imulq %rbp, %r15 + imulq %r10, %rdi + imulq %r8, %rbp + shrq $32, %r12 + addq %r14, %r13 + addq %rdx, %r12 + addq %rdi, %r13 + addq %r12, %r15 + cmpq %r12, %r15 + movq %r15, %rdx + movl $0, %r15d + setb %r15b + cmpq %rdi, %r13 + movl $0, %edi + setb %dil + shrq $32, %rdx + shlq $32, %r15 + addq %r15, %rdx + movq %r11, %r15 + addq %rbp, %rdx + addq %rdi, %rdx + movq %rax, %rbp + movl %eax, %edi + movq %rdi, %r14 + movq %rdi, %r12 + imulq %rbx, %r14 + imulq %r9, %r12 + imulq %rax, %r15 + imulq %r10, %rax + shrq $32, %rbp + addq %r15, %r13 + movq %rbx, 96(%rsp) + imulq %rbp, %rbx + shrq $32, %r14 + addq %r12, %r14 + addq %r14, %rbx + cmpq %r14, %rbx + movl $0, %r14d + movq %rbx, %r12 + movq %r9, %rbx + setb %r14b + cmpq %r15, %r13 + movl $0, %r15d + movq %rcx, 72(%rsp) + setb %r15b + imulq %rbp, %rbx + shrq $32, %r12 + shlq $32, %r14 + addq %r14, %r12 + movq %rdi, %r14 + imulq %rcx, %r14 + imulq %r8, %rdi + imulq %rbp, %rcx + imulq %r8, %rbp + addq %rbx, %r12 + addq %r15, %rdx + xorl %ebx, %ebx + cmpq %r15, %rdx + movq %r9, 104(%rsp) + setb %bl + addq %r12, %rdx + cmpq %r12, %rdx + movl $0, %r12d + setb %r12b + addq %rax, %rdx + shrq $32, %r14 + addq %rdi, %r14 + xorl %edi, %edi + addq %r14, %rcx + addq %r12, %rbx + xorl %r12d, %r12d + cmpq %r14, %rcx + movq %rcx, %r15 + setb %r12b + cmpq %rax, %rdx + movl $0, %eax + setb %al + movq %r11, %r14 + shrq $32, %r15 + shlq $32, %r12 + addq %r12, %r15 + movq %rsi, %r12 + addq %rbp, %r15 + addq %rax, %r15 + addq %rbx, %r15 + movl %esi, %ebx + movq %rbx, %rbp + movq 96(%rsp), %rcx + imulq %rcx, %rbp + imulq %r9, %rbx + imulq %rsi, %r14 + imulq %r10, %rsi + shrq $32, %r12 + addq %r14, %rdx + imulq %r12, %rcx + imulq %r9, %r12 + shrq $32, %rbp + addq %r15, %rsi + addq %rbx, %rbp + xorl %ebx, %ebx + addq %rbp, %rcx + cmpq %rbp, %rcx + movq %rcx, %rax + movq 32(%rsp), %rcx + setb %dil + cmpq %r14, %rdx + setb %bl + xorl %r14d, %r14d + shrq $32, %rax + shlq $32, %rdi + addq %rdi, %rax + addq %r12, %rax + addq %rax, %rbx + movq %rcx, %rax + addq %rsi, %rbx + negq %rax + movq 24(%rsp), %rsi + imulq %r11, %rsi + cmpl $0, 56(%rsp) + movq %r8, 80(%rsp) + cmovne %rax, %rcx + addq %rsi, %rbx + shlq $61, %rcx + movq 120(%rsp), %r11 + addq %rcx, %rbx + movq 48(%rsp), %r10 + movq (%rsp), %r8 + movq 8(%rsp), %r9 + jmp ..B3.58 +..B3.62: + movq $0xe000000000000000, %rax + addq $64, %r14 + andq %rbx, %rax + movq $0x1fffffffffffffff, %rbx + andq %rdx, %rbx + movq %r13, %rdx + orq %rax, %rbx + movq %r10, %r13 + movq %rcx, %r10 +..B3.58: + movq $0x40000000000000, %rax + movq $0x3f80000000000000, %rsi + lea (%rax,%rbx), %rcx + testq %rsi, %rcx + jne ..B3.70 +..B3.59: + movq %r9, %rdi + movq 120(%rsp), %rax + movl %eax, %ecx + movq %rdi, %r12 + movq (%r8), %r9 + movq %r9, %rsi + shlq %cl, %r12 + addq $8, %r8 + movq 64(%rsp), %rcx + movq 96(%rsp), %rbp + movq %rbp, %r15 + shrq %cl, %rsi + orq %rsi, %r12 + testq %rax, %rax + movq 104(%rsp), %r11 + cmovne %r12, %rdi + movq %r11, %r12 + movl %edi, %eax + movq %rdi, %rsi + imulq %rax, %r15 + imulq %rax, %r12 + shrq $32, %rsi + imulq %rsi, %rbp + imulq %rsi, %r11 + shrq $32, %r15 + addq %r12, %r15 + addq %r15, %rbp + cmpq %r15, %rbp + movl $0, %r15d + movq %rbp, %r12 + setb %r15b + shrq $32, %r12 + shlq $32, %r15 + addq %r15, %r12 + addq %r11, %r12 + movq 72(%rsp), %r11 + movq %r11, %rbp + imulq %rax, %rbp + movq 80(%rsp), %r15 + addq %r12, %r10 + imulq %r15, %rax + shrq $32, %rbp + cmpq %r12, %r10 + movq 112(%rsp), %rcx + movl $0, %r12d + setb %r12b + addq %rax, %rbp + movq %r11, %rax + imulq %rsi, %rax + imulq %rdi, %rcx + imulq 88(%rsp), %rdi + imulq %r15, %rsi + addq %rbp, %rax + addq %r12, %r13 + movq %rax, %r11 + cmpq %r12, %r13 + movl $0, %r12d + setb %r12b + cmpq %rbp, %rax + movl $0, %eax + setb %al + addq %rdi, %r10 + cmpq %rdi, %r10 + movl $0, %edi + setb %dil + shrq $32, %r11 + shlq $32, %rax + addq %rax, %r11 + addq %rdi, %r13 + addq %rsi, %r11 + xorl %eax, %eax + cmpq %rdi, %r13 + setb %al + addq %r11, %r13 + cmpq %r11, %r13 + movl $0, %r11d + setb %r11b + addl %r12d, %eax + addl %r11d, %eax + je ..B3.61 +..B3.60: + incq %rdx + lea 1(%rbx), %rax + cmove %rax, %rbx +..B3.61: + movq %rdx, %rdi + movq %rbx, %rax + shrq $55, %rdi + shlq $9, %rax + orq %rax, %rdi + movq %rdi, %rsi + sarq $63, %rsi + cmpq %rdi, %rsi + jne ..B3.70 + jmp ..B3.62 +..B3.63: + call __stack_chk_fail@PLT +..B3.64: + cmpq $0, 32(%r12) + jne ..B3.66 +..B3.65: + movl $0, 24(%r12) + jmp ..B3.52 +..B3.66: + incq %rbx + testq $2, %rbx + je ..B3.52 +..B3.67: + movslq 24(%r12), %rdx + btcq $31, %rdx + movl %edx, 24(%r12) + jmp ..B3.52 +..B3.68: + shlq $9, %rcx + orq $462, %rcx + jmp ..B3.48 +..B3.69: + movq 8(%r8), %rcx + jmp ..B3.20 +..B3.70: + movq 16(%rsp), %r15 + movq 40(%rsp), %r12 +..B3.71: + lea (,%rbx,4), %rcx + sarq $2, %rcx + movq %rcx, %rax + subq %rcx, %rbx + sarq $63, %rax + movq %rcx, %rsi + cmpq %rax, %rcx + jne ..B3.73 +..B3.72: + movq %rdx, %rcx + movq %r13, %rdx + movq %r10, %r13 + addq $64, %r14 +..B3.73: + movl $-2147483648, %eax + testq %rsi, %rsi + movl $0, %esi + cmovge %esi, %eax + testl %eax, %eax + je ..B3.75 +..B3.74: + notq %r13 + movl $1, %edi + incq %r13 + notq %rdx + cmove %edi, %esi + xorl %r9d, %r9d + notq %rcx + addq %rsi, %rdx + cmove %edi, %r9d + addq %r9, %rcx +..B3.75: + movq %rbx, %r9 + lea (%rsp), %rdi + movl 56(%rdi), %r10d + negq %r9 + testl %r10d, %r10d + movl $3, 4(%rdi) + movq %rcx, 8(%rdi) + cmovne %r9, %rbx + xorl %esi, %esi + xorl %r10d, %eax + movl %eax, (%rdi) + movq %rdx, 16(%rdi) +..___tag_value___dpml_ux_sincos.138: + call __dpml_ffs_and_shift__@PLT +..___tag_value___dpml_ux_sincos.139: +..B3.76: + movslq 4(%rsp), %rax + movq %rax, %rcx + addq $-3, %rcx + je ..B3.78 +..B3.77: + shrq %cl, %r13 + orq %r13, 16(%rsp) +..B3.78: + lea 1008+__trig_x_table(%rip), %rsi + lea (%rsp), %rdi + movq %rdi, %rdx + subq %r14, %rax + movl %eax, 4(%rdi) +..___tag_value___dpml_ux_sincos.140: + call __dpml_multiply__@PLT +..___tag_value___dpml_ux_sincos.141: +..B3.79: + shrq $62, %rbx + jmp ..B3.46 +..B3.81: + movl %ecx, %eax + sarl $31, %eax + movslq %eax, %rax + addq %rbp, %rax + movq %rax, %rcx + andq $1, %rcx + addq %rcx, %rax + movq %rax, %rbx + sarq $1, %rbx + subq %rax, %rbp + je ..B3.83 +..B3.82: + shrq $63, %rbp + movq %r13, %rdi + lea 1008+__trig_x_table(%rip), %rsi + movq %rbp, %rdx + lea (%rsp), %rcx +..___tag_value___dpml_ux_sincos.142: + call __dpml_addsub__@PLT +..___tag_value___dpml_ux_sincos.143: + jmp ..B3.46 +..B3.83: + movl 56(%rsp), %eax + movq 88(%rsp), %rdx + movq 112(%rsp), %rcx + movl %eax, (%rsp) + movl %r11d, 4(%rsp) + movq %rdx, 8(%rsp) + movq %rcx, 16(%rsp) + jmp ..B3.46 + .align 16,0x90 + .cfi_endproc + .type __dpml_ux_sincos,@function + .size __dpml_ux_sincos,.-__dpml_ux_sincos + .data +# -- End __dpml_ux_sincos + .section .rodata, "a" + .align 16 + .align 16 +__trig_x_table: + .long 15442952 + .long 1678786816 + .long 15709192 + .long 1414612240 + .long 15975432 + .long 1141915904 + .long 16241672 + .long 873463808 + .long 16507912 + .long 609305872 + .long 16774152 + .long 336592896 + .long 2 + .long 0 + .long 103 + .long 0 + .long 22 + .long 0 + .long 104 + .long 0 + .long 107 + .long 0 + .long 23 + .long 0 + .long 105 + .long 0 + .long 15176712 + .long 336609536 + .long 115 + .long 0 + .long 15176712 + .long 336592896 + .long 118 + .long 0 + .long 15176712 + .long 519700480 + .long 28 + .long 0 + .long 29 + .long 0 + .long 30 + .long 0 + .long 15176712 + .long 528281504 + .long 34 + .long 0 + .long 32 + .long 0 + .long 33 + .long 0 + .long 35 + .long 0 + .long 36 + .long 0 + .long 0 + .long 4294967291 + .long 2498349230 + .long 2398762258 + .long 2491794649 + .long 247854702 + .long 0 + .long 0 + .long 0 + .long 1073676288 + .long 95443718 + .long 1527099483 + .long 1431655766 + .long 357913941 + .long 2657305954 + .long 3 + .long 0 + .long 0 + .long 3705764381 + .long 2553 + .long 0 + .long 0 + .long 138031221 + .long 1532340 + .long 0 + .long 0 + .long 2983678984 + .long 775364077 + .long 0 + .long 0 + .long 20739419 + .long 3530365445 + .long 75 + .long 0 + .long 674366505 + .long 499172021 + .long 25931 + .long 0 + .long 1191312077 + .long 2630803580 + .long 7053263 + .long 0 + .long 2382099329 + .long 2712937970 + .long 1481185358 + .long 0 + .long 2412211635 + .long 2311528398 + .long 3431649258 + .long 53 + .long 3364759590 + .long 865053377 + .long 3819263687 + .long 5917 + .long 1745256079 + .long 2154301056 + .long 109078534 + .long 426088 + .long 286331142 + .long 286331153 + .long 286331153 + .long 17895697 + .long 1431655765 + .long 1431655765 + .long 1431655765 + .long 357913941 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 2851833826 + .long 97 + .long 0 + .long 0 + .long 1768459388 + .long 63846 + .long 0 + .long 0 + .long 2009193996 + .long 35243820 + .long 0 + .long 0 + .long 1368406537 + .long 3397743743 + .long 3 + .long 0 + .long 3946395699 + .long 2652434014 + .long 1440 + .long 0 + .long 2553743692 + .long 4190957063 + .long 440828 + .long 0 + .long 595011843 + .long 807348040 + .long 105798954 + .long 0 + .long 883371940 + .long 908455249 + .long 2075540478 + .long 4 + .long 761938407 + .long 3951975904 + .long 3388403475 + .long 591 + .long 217841633 + .long 3490513104 + .long 13634816 + .long 53261 + .long 3626846480 + .long 2195205506 + .long 763549741 + .long 2982616 + .long 1431655403 + .long 1431655765 + .long 1431655765 + .long 89478485 + .long 4294967292 + .long 4294967295 + .long 4294967295 + .long 1073741823 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2877741414 + .long 48456580 + .long 4555740 + .long 0 + .long 3312728015 + .long 4268104823 + .long 3744444631 + .long 1 + .long 6483522 + .long 3858350617 + .long 1187701358 + .long 879 + .long 3780777519 + .long 2626127639 + .long 2801410624 + .long 158172 + .long 3864078256 + .long 3316933375 + .long 1275824684 + .long 11667904 + .long 1744149096 + .long 2725495384 + .long 3617949641 + .long 318163395 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 3422290646 + .long 426546810 + .long 43450 + .long 0 + .long 3479121894 + .long 3493673009 + .long 236644653 + .long 0 + .long 4247003031 + .long 1084451344 + .long 1285072157 + .long 46 + .long 1927283714 + .long 2972340862 + .long 2243521359 + .long 13184 + .long 739625925 + .long 4125699428 + .long 1446479475 + .long 1522115 + .long 2250255868 + .long 2030226330 + .long 3149913922 + .long 70000510 + .long 312493331 + .long 1293839619 + .long 2186293876 + .long 1033991278 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 0 + .long 0 + .long 560513588 + .long 3373259426 + .long 2161908945 + .long 3301335691 + .long 0 + .long 0 + .type __trig_x_table,@object + .size __trig_x_table,1040 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/erf.S b/external/sgx_libm/intel64/erf.S new file mode 100644 index 0000000000..029f5b98ec --- /dev/null +++ b/external/sgx_libm/intel64/erf.S @@ -0,0 +1,1390 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erf.c" + .text +..TXTST0: +# -- Begin erf + .text + .align 16,0x90 + .globl erf +erf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_erf.1: +..L2: + + movsd %xmm0, -8(%rsp) + movb -1(%rsp), %cl + movb %cl, %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + lea _vmldErfHATab(%rip), %rax + movzwl -2(%rsp), %esi + andl $32752, %esi + shrl $4, %esi + movsd 3632(%rax,%rdx,8), %xmm5 + cmpl $2047, %esi + je ..B1.17 +..B1.2: + movsd %xmm0, -8(%rsp) + andb $127, %cl + movb %cl, -1(%rsp) + cmpl $983, %esi + movsd -8(%rsp), %xmm4 + jl ..B1.9 +..B1.3: + lea 3664+_vmldErfHATab(%rip), %rdx + comisd (%rdx), %xmm4 + jb ..B1.8 +..B1.4: + lea 3672+_vmldErfHATab(%rip), %rdx + movsd (%rdx), %xmm0 + comisd %xmm4, %xmm0 + jbe ..B1.6 +..B1.5: + movl -4(%rsp), %edx + shll $20, %esi + andl $1048575, %edx + orl %edx, %esi + addl $-1069547520, %esi + sarl $18, %esi + lea (%rsi,%rsi,4), %ecx + lea 3616+_vmldErfHATab(%rip), %rsi + shll $2, %ecx + movslq %ecx, %rcx + movsd (%rsi), %xmm1 + movaps %xmm1, %xmm6 + movsd (%rax,%rcx,8), %xmm3 + mulsd %xmm3, %xmm4 + movsd 152(%rax,%rcx,8), %xmm2 + movsd 48(%rax,%rcx,8), %xmm11 + movsd 56(%rax,%rcx,8), %xmm12 + addsd 8(%rax,%rcx,8), %xmm4 + mulsd %xmm4, %xmm2 + mulsd %xmm4, %xmm6 + addsd 144(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + movsd %xmm6, -24(%rsp) + movsd -24(%rsp), %xmm7 + movsd 32(%rax,%rcx,8), %xmm6 + subsd %xmm4, %xmm7 + addsd 136(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + movsd %xmm7, -16(%rsp) + movsd -24(%rsp), %xmm9 + movsd -16(%rsp), %xmm8 + addsd 128(%rax,%rcx,8), %xmm2 + subsd %xmm8, %xmm9 + mulsd %xmm4, %xmm2 + movsd %xmm9, -24(%rsp) + movsd -24(%rsp), %xmm10 + addsd 120(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 112(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 104(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 96(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 88(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 80(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 72(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + addsd 64(%rax,%rcx,8), %xmm2 + mulsd %xmm4, %xmm2 + mulsd %xmm4, %xmm2 + mulsd %xmm4, %xmm2 + subsd %xmm10, %xmm4 + movsd %xmm4, -16(%rsp) + movsd -24(%rsp), %xmm4 + movsd -16(%rsp), %xmm0 + movaps %xmm4, %xmm3 + movaps %xmm0, %xmm13 + mulsd %xmm11, %xmm3 + mulsd %xmm12, %xmm13 + mulsd %xmm0, %xmm11 + mulsd %xmm4, %xmm12 + addsd %xmm11, %xmm13 + movaps %xmm3, %xmm14 + addsd %xmm12, %xmm13 + addsd %xmm6, %xmm14 + movsd %xmm13, -24(%rsp) + movsd -24(%rsp), %xmm7 + movsd %xmm14, -24(%rsp) + movsd -24(%rsp), %xmm15 + subsd %xmm15, %xmm6 + addsd %xmm3, %xmm6 + movsd %xmm6, -16(%rsp) + movsd -24(%rsp), %xmm11 + mulsd %xmm11, %xmm1 + movsd -16(%rsp), %xmm14 + movsd %xmm1, -24(%rsp) + addsd %xmm7, %xmm14 + movsd -24(%rsp), %xmm1 + subsd %xmm11, %xmm1 + addsd 40(%rax,%rcx,8), %xmm14 + movsd %xmm1, -16(%rsp) + movaps %xmm0, %xmm1 + movsd -24(%rsp), %xmm9 + movsd -16(%rsp), %xmm8 + subsd %xmm8, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -24(%rsp), %xmm10 + subsd %xmm10, %xmm11 + movsd %xmm11, -16(%rsp) + movsd -24(%rsp), %xmm13 + movsd -16(%rsp), %xmm12 + movaps %xmm13, %xmm3 + mulsd %xmm0, %xmm13 + addsd %xmm12, %xmm14 + mulsd %xmm4, %xmm3 + mulsd %xmm14, %xmm1 + mulsd %xmm14, %xmm4 + addsd %xmm13, %xmm1 + movaps %xmm3, %xmm0 + addsd %xmm4, %xmm1 + movsd %xmm1, -24(%rsp) + movsd 16(%rax,%rcx,8), %xmm1 + movsd -24(%rsp), %xmm15 + addsd %xmm1, %xmm0 + movsd %xmm0, -24(%rsp) + movsd -24(%rsp), %xmm4 + subsd %xmm4, %xmm1 + addsd %xmm3, %xmm1 + movsd %xmm1, -16(%rsp) + movsd -24(%rsp), %xmm1 + movsd -16(%rsp), %xmm0 + addsd %xmm15, %xmm0 + addsd 24(%rax,%rcx,8), %xmm0 + addsd %xmm0, %xmm2 + movsd %xmm2, -24(%rsp) + movsd -24(%rsp), %xmm0 + addsd %xmm1, %xmm0 + mulsd %xmm5, %xmm0 + ret +..B1.6: + lea 3632+_vmldErfHATab(%rip), %rax + lea 3608+_vmldErfHATab(%rip), %rdx + movsd (%rax), %xmm0 + addsd (%rdx), %xmm0 + mulsd %xmm5, %xmm0 +..B1.7: + ret +..B1.8: + movaps %xmm4, %xmm6 + lea 3592+_vmldErfHATab(%rip), %rax + mulsd %xmm4, %xmm6 + lea 3584+_vmldErfHATab(%rip), %rdx + movsd (%rax), %xmm3 + lea 3576+_vmldErfHATab(%rip), %rcx + mulsd %xmm6, %xmm3 + movaps %xmm4, %xmm12 + mulsd %xmm6, %xmm12 + addsd (%rdx), %xmm3 + mulsd %xmm6, %xmm3 + lea 3616+_vmldErfHATab(%rip), %r10 + lea 3568+_vmldErfHATab(%rip), %rsi + lea 3560+_vmldErfHATab(%rip), %rdi + movsd (%r10), %xmm7 + lea 3544+_vmldErfHATab(%rip), %r8 + mulsd %xmm12, %xmm7 + addsd (%rcx), %xmm3 + mulsd %xmm6, %xmm3 + lea 3552+_vmldErfHATab(%rip), %r9 + movsd %xmm7, -24(%rsp) + lea 3528+_vmldErfHATab(%rip), %r11 + movsd -24(%rsp), %xmm8 + lea 3536+_vmldErfHATab(%rip), %rax + movsd (%r8), %xmm14 + subsd %xmm12, %xmm8 + addsd (%rsi), %xmm3 + mulsd %xmm6, %xmm3 + movaps %xmm14, %xmm2 + movsd %xmm8, -16(%rsp) + movsd -24(%rsp), %xmm10 + movsd -16(%rsp), %xmm9 + movsd (%r9), %xmm15 + subsd %xmm9, %xmm10 + addsd (%rdi), %xmm3 + mulsd %xmm6, %xmm3 + movaps %xmm4, %xmm6 + mulsd (%r10), %xmm6 + mulsd %xmm12, %xmm3 + movsd %xmm10, -24(%rsp) + movsd -24(%rsp), %xmm11 + subsd %xmm11, %xmm12 + movsd %xmm12, -16(%rsp) + movsd -24(%rsp), %xmm0 + movsd -16(%rsp), %xmm13 + movaps %xmm13, %xmm1 + mulsd %xmm15, %xmm1 + mulsd %xmm13, %xmm14 + mulsd %xmm0, %xmm2 + mulsd %xmm15, %xmm0 + addsd %xmm14, %xmm1 + addsd %xmm0, %xmm1 + movsd %xmm1, -24(%rsp) + movsd -24(%rsp), %xmm1 + movsd %xmm6, -24(%rsp) + movsd -24(%rsp), %xmm7 + movsd (%r11), %xmm6 + movaps %xmm6, %xmm0 + subsd -8(%rsp), %xmm7 + movsd %xmm7, -16(%rsp) + movsd -24(%rsp), %xmm9 + movsd -16(%rsp), %xmm8 + movsd (%rax), %xmm7 + subsd %xmm8, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -24(%rsp), %xmm10 + subsd %xmm10, %xmm4 + movaps %xmm2, %xmm10 + addsd %xmm3, %xmm10 + movsd %xmm4, -16(%rsp) + movsd -24(%rsp), %xmm8 + movsd -16(%rsp), %xmm4 + movaps %xmm4, %xmm9 + mulsd %xmm7, %xmm9 + mulsd %xmm4, %xmm6 + mulsd %xmm8, %xmm0 + mulsd %xmm7, %xmm8 + addsd %xmm6, %xmm9 + addsd %xmm8, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -24(%rsp), %xmm12 + movsd %xmm10, -24(%rsp) + movsd -24(%rsp), %xmm4 + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm2 + movsd %xmm2, -16(%rsp) + movsd -24(%rsp), %xmm3 + movsd -16(%rsp), %xmm11 + addsd %xmm1, %xmm11 + movaps %xmm0, %xmm1 + addsd %xmm3, %xmm1 + addsd %xmm11, %xmm12 + movsd %xmm1, -24(%rsp) + movsd -24(%rsp), %xmm2 + subsd %xmm2, %xmm0 + addsd %xmm3, %xmm0 + movsd %xmm0, -16(%rsp) + movsd -24(%rsp), %xmm0 + movsd -16(%rsp), %xmm13 + addsd %xmm12, %xmm13 + addsd %xmm13, %xmm0 + mulsd %xmm5, %xmm0 + ret +..B1.9: + lea 3624+_vmldErfHATab(%rip), %rax + ucomisd (%rax), %xmm4 + jp ..B1.10 + je ..B1.7 +..B1.10: + testl %esi, %esi + jne ..B1.16 +..B1.11: + lea 3656+_vmldErfHATab(%rip), %rax + comisd (%rax), %xmm4 + jae ..B1.16 +..B1.12: + lea 3600+_vmldErfHATab(%rip), %rax + lea 3648+_vmldErfHATab(%rip), %rdx + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + comisd (%rdx), %xmm4 + jb ..B1.14 +..B1.13: + lea 3616+_vmldErfHATab(%rip), %rax + movaps %xmm0, %xmm1 + lea 3536+_vmldErfHATab(%rip), %rcx + lea 3528+_vmldErfHATab(%rip), %rdx + lea 3608+_vmldErfHATab(%rip), %rsi + movsd (%rax), %xmm10 + movsd (%rdx), %xmm8 + mulsd %xmm10, %xmm1 + movsd %xmm1, -24(%rsp) + movsd -24(%rsp), %xmm2 + subsd %xmm0, %xmm2 + movsd %xmm2, -16(%rsp) + movsd -24(%rsp), %xmm4 + movsd -16(%rsp), %xmm3 + subsd %xmm3, %xmm4 + movsd %xmm4, -24(%rsp) + movsd -24(%rsp), %xmm5 + subsd %xmm5, %xmm0 + movsd %xmm0, -16(%rsp) + movsd -24(%rsp), %xmm6 + movsd -16(%rsp), %xmm7 + movaps %xmm6, %xmm15 + movsd (%rcx), %xmm0 + movaps %xmm7, %xmm9 + mulsd %xmm0, %xmm9 + mulsd %xmm0, %xmm6 + mulsd %xmm8, %xmm15 + mulsd %xmm7, %xmm8 + addsd %xmm6, %xmm9 + mulsd %xmm15, %xmm10 + addsd %xmm8, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -24(%rsp), %xmm0 + movsd %xmm10, -24(%rsp) + movsd -24(%rsp), %xmm11 + subsd %xmm15, %xmm11 + movsd %xmm11, -16(%rsp) + movsd -24(%rsp), %xmm13 + movsd -16(%rsp), %xmm12 + subsd %xmm12, %xmm13 + movsd %xmm13, -24(%rsp) + movsd -24(%rsp), %xmm14 + subsd %xmm14, %xmm15 + movsd %xmm15, -16(%rsp) + movsd -24(%rsp), %xmm11 + movsd -16(%rsp), %xmm10 + mulsd (%rsi), %xmm11 + addsd %xmm10, %xmm0 + mulsd (%rsi), %xmm0 + movsd %xmm11, -24(%rsp) + movsd %xmm0, -16(%rsp) + movsd -24(%rsp), %xmm2 + movsd -16(%rsp), %xmm1 + addsd %xmm1, %xmm2 + jmp ..B1.15 +..B1.14: + lea 3520+_vmldErfHATab(%rip), %rax + lea 3608+_vmldErfHATab(%rip), %rdx + movsd (%rax), %xmm2 + mulsd %xmm0, %xmm2 + mulsd (%rdx), %xmm2 +..B1.15: + movaps %xmm2, %xmm0 + ret +..B1.16: + lea 3600+_vmldErfHATab(%rip), %rax + lea 3616+_vmldErfHATab(%rip), %rdx + lea 3528+_vmldErfHATab(%rip), %rcx + lea 3536+_vmldErfHATab(%rip), %rsi + lea 3608+_vmldErfHATab(%rip), %rdi + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd (%rdx), %xmm2 + mulsd %xmm0, %xmm2 + movsd %xmm2, -24(%rsp) + movsd -24(%rsp), %xmm3 + movsd (%rcx), %xmm10 + subsd %xmm0, %xmm3 + movsd %xmm3, -16(%rsp) + movsd -24(%rsp), %xmm5 + movsd -16(%rsp), %xmm4 + movsd (%rsi), %xmm7 + subsd %xmm4, %xmm5 + movsd %xmm5, -24(%rsp) + movsd -24(%rsp), %xmm6 + subsd %xmm6, %xmm0 + movsd %xmm0, -16(%rsp) + movaps %xmm10, %xmm0 + movsd -24(%rsp), %xmm8 + movsd -16(%rsp), %xmm9 + movaps %xmm9, %xmm11 + mulsd %xmm8, %xmm0 + mulsd %xmm7, %xmm11 + mulsd %xmm7, %xmm8 + mulsd %xmm9, %xmm10 + addsd %xmm8, %xmm11 + addsd %xmm10, %xmm11 + movsd %xmm11, -24(%rsp) + movsd -24(%rsp), %xmm12 + addsd %xmm12, %xmm0 + mulsd (%rdi), %xmm0 + ret +..B1.17: + testl $1048575, -4(%rsp) + jne ..B1.20 +..B1.18: + cmpl $0, -8(%rsp) + jne ..B1.20 +..B1.19: + lea 3632+_vmldErfHATab(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm5, %xmm0 + ret +..B1.20: + movsd -8(%rsp), %xmm0 + addsd %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type erf,@function + .size erf,.-erf + .data +# -- End erf + .section .rodata, "a" + .align 8 + .align 8 +_vmldErfHATab: + .long 0 + .long 1077936128 + .long 0 + .long 3222405120 + .long 3270920536 + .long 1069821311 + .long 1057270100 + .long 1014821379 + .long 337483220 + .long 1067561815 + .long 2929153520 + .long 1012421262 + .long 4026531840 + .long 3206801857 + .long 1030462481 + .long 3179971874 + .long 1486349066 + .long 3202788052 + .long 134277178 + .long 1047766669 + .long 1212351331 + .long 1042946157 + .long 1104268445 + .long 3183073920 + .long 2950952656 + .long 3177697379 + .long 1025949206 + .long 1022984782 + .long 1815731286 + .long 1017231760 + .long 3033581736 + .long 3157533247 + .long 2954897717 + .long 3151375491 + .long 1303182986 + .long 996834239 + .long 795652555 + .long 990371394 + .long 2343572077 + .long 3130906588 + .long 0 + .long 1077936128 + .long 0 + .long 3222667264 + .long 266066941 + .long 1070109953 + .long 2023669004 + .long 1013041695 + .long 3705654820 + .long 1067550541 + .long 3566009421 + .long 1011293070 + .long 134217728 + .long 3207076363 + .long 3355205190 + .long 3180252909 + .long 2219056158 + .long 3202743700 + .long 3264865953 + .long 1048027271 + .long 3807428681 + .long 1042858920 + .long 3066569234 + .long 3183403162 + .long 1059612996 + .long 3177583001 + .long 1631410288 + .long 1023296102 + .long 1209224421 + .long 1017119299 + .long 3957039910 + .long 3157768207 + .long 2748118263 + .long 3151198590 + .long 1787505922 + .long 997129044 + .long 167794763 + .long 990139564 + .long 2444798020 + .long 3131135431 + .long 0 + .long 1077936128 + .long 0 + .long 3222929408 + .long 3508744758 + .long 1070395510 + .long 3777053507 + .long 1014792775 + .long 2239870848 + .long 1067537158 + .long 80412370 + .long 1012585610 + .long 2550136832 + .long 3207341802 + .long 731471944 + .long 3177077062 + .long 620528720 + .long 3202691430 + .long 3841836855 + .long 1048273069 + .long 190893310 + .long 1042756870 + .long 3560172648 + .long 3183591033 + .long 3053707503 + .long 3177450205 + .long 2206487565 + .long 1023491751 + .long 3218422968 + .long 1016860737 + .long 598928797 + .long 3157970519 + .long 2475988840 + .long 3150996363 + .long 1159941103 + .long 997284625 + .long 3398924683 + .long 989876643 + .long 798935564 + .long 3131261061 + .long 0 + .long 1077936128 + .long 0 + .long 3223191552 + .long 1770174791 + .long 1070636781 + .long 4205036945 + .long 1015375813 + .long 2413196824 + .long 1067521741 + .long 2601975064 + .long 1005834579 + .long 2952790016 + .long 3207595360 + .long 3658041887 + .long 3181077562 + .long 4169926782 + .long 3202631738 + .long 2555230105 + .long 1048501852 + .long 2080004756 + .long 1042641364 + .long 4228979116 + .long 3183726688 + .long 3050753797 + .long 3177301266 + .long 157144205 + .long 1023611097 + .long 477563032 + .long 1016572798 + .long 1180941066 + .long 3158136250 + .long 103748847 + .long 3150576732 + .long 855028858 + .long 997378869 + .long 3717241463 + .long 989324501 + .long 2285599851 + .long 3131350893 + .long 0 + .long 1076887552 + .long 0 + .long 3222405120 + .long 2340732634 + .long 1070844330 + .long 1402414124 + .long 1012108932 + .long 4199089954 + .long 1068543572 + .long 2559319735 + .long 1013022575 + .long 2550136832 + .long 3209872415 + .long 1842851526 + .long 3180929664 + .long 3057689090 + .long 3205675264 + .long 4009292523 + .long 1052886727 + .long 2015516814 + .long 1047689133 + .long 520582071 + .long 3190189211 + .long 3416096878 + .long 3184261095 + .long 1113028140 + .long 1032138739 + .long 3929660173 + .long 1025537235 + .long 1947345592 + .long 3168795649 + .long 1874355335 + .long 3161325647 + .long 790309391 + .long 1010046575 + .long 3732702576 + .long 1001648133 + .long 3279395584 + .long 3146093738 + .long 0 + .long 1076887552 + .long 0 + .long 3222667264 + .long 1155126243 + .long 1071112537 + .long 4058417554 + .long 1015654408 + .long 4091643817 + .long 1068501692 + .long 992009585 + .long 1011189456 + .long 3355443200 + .long 3210088131 + .long 577555187 + .long 3183302762 + .long 3137228493 + .long 3205518745 + .long 1652609564 + .long 1053053423 + .long 3828684380 + .long 1047267014 + .long 859309674 + .long 3190350551 + .long 1723732682 + .long 3183536714 + .long 3655321812 + .long 1032243418 + .long 1849688920 + .long 1023985400 + .long 3853991388 + .long 3168837843 + .long 3217410018 + .long 1007305761 + .long 15852099 + .long 1010050248 + .long 1197806868 + .long 3148971557 + .long 1066481688 + .long 3146043461 + .long 0 + .long 1076887552 + .long 0 + .long 3222929408 + .long 3259520439 + .long 1071369470 + .long 2827660931 + .long 1015400118 + .long 2387383117 + .long 1068408154 + .long 3928547609 + .long 1012504486 + .long 2415919104 + .long 3210272729 + .long 2041761256 + .long 3182227901 + .long 2378546067 + .long 3205191821 + .long 2022373860 + .long 1053172536 + .long 1539712272 + .long 1046637816 + .long 2866781005 + .long 3190430666 + .long 1973204487 + .long 3181753511 + .long 471306766 + .long 1032252941 + .long 3917954587 + .long 3170909470 + .long 1575996247 + .long 3168793506 + .long 2080089276 + .long 1013809777 + .long 3478556236 + .long 1009933722 + .long 556567750 + .long 3150565473 + .long 3617504985 + .long 3145850711 + .long 0 + .long 1076887552 + .long 0 + .long 3223191552 + .long 2839711645 + .long 1071613690 + .long 2970658322 + .long 1014602120 + .long 3815538168 + .long 1068301377 + .long 1215242252 + .long 1012502501 + .long 3221225472 + .long 3210423421 + .long 1694424286 + .long 3182745304 + .long 2482618577 + .long 3204819422 + .long 1490180077 + .long 1053241721 + .long 716537363 + .long 1045509088 + .long 3220326238 + .long 3190429019 + .long 1649943177 + .long 1034362954 + .long 149820908 + .long 1032171009 + .long 2913777793 + .long 3172667222 + .long 2916685335 + .long 3168553958 + .long 3423621657 + .long 1014717380 + .long 3520470914 + .long 1009649189 + .long 1724012134 + .long 3151216830 + .long 973445297 + .long 3145359701 + .long 0 + .long 1075838976 + .long 0 + .long 3222405120 + .long 2293685631 + .long 1071799178 + .long 995883061 + .long 1015632714 + .long 3793057312 + .long 1069174900 + .long 303272667 + .long 1011854732 + .long 2013265920 + .long 3212679811 + .long 2434603502 + .long 3185139859 + .long 492809813 + .long 3207185437 + .long 3249638684 + .long 1057446891 + .long 3644008036 + .long 3197518090 + .long 2427527080 + .long 3196575624 + .long 382948573 + .long 1043637576 + .long 3944285033 + .long 1040289590 + .long 3216947186 + .long 3183007329 + .long 3738834740 + .long 3178455694 + .long 3578811002 + .long 1026832616 + .long 2077607461 + .long 1021301705 + .long 1329130827 + .long 3165226306 + .long 2937198399 + .long 3158390279 + .long 0 + .long 1075838976 + .long 0 + .long 3222667264 + .long 1026243227 + .long 1071999268 + .long 19842292 + .long 1014558455 + .long 615820035 + .long 1068925439 + .long 3077235950 + .long 1013851225 + .long 3489660928 + .long 3212767934 + .long 727482074 + .long 3183723353 + .long 1434284591 + .long 3204072020 + .long 1546025314 + .long 1057305153 + .long 3311043419 + .long 3199555764 + .long 1534557980 + .long 3196172205 + .long 1003545269 + .long 1044455453 + .long 982041524 + .long 1039309150 + .long 1046902208 + .long 3183487308 + .long 1293621534 + .long 3176225124 + .long 3225792447 + .long 1026964909 + .long 3923689281 + .long 3166944983 + .long 2903296563 + .long 3165127275 + .long 3175926173 + .long 1011691029 + .long 0 + .long 1075838976 + .long 0 + .long 3222929408 + .long 4209868920 + .long 1072167835 + .long 1271589702 + .long 1014394097 + .long 3991103290 + .long 1068673244 + .long 1964927110 + .long 1013592604 + .long 0 + .long 3212726887 + .long 4238629777 + .long 3183774781 + .long 1807339610 + .long 1059053689 + .long 35311788 + .long 1057028643 + .long 3165087585 + .long 3200229918 + .long 3586452917 + .long 3195213126 + .long 1777317359 + .long 1044610644 + .long 1848687836 + .long 1033934742 + .long 31916095 + .long 3183379115 + .long 185553482 + .long 1029904423 + .long 882484870 + .long 1026631250 + .long 3164391940 + .long 3169115287 + .long 3325423896 + .long 3164355775 + .long 3234707527 + .long 1012695165 + .long 0 + .long 1075838976 + .long 0 + .long 3223191552 + .long 2708123311 + .long 1072305489 + .long 1189046596 + .long 1013601674 + .long 1868283783 + .long 1068367010 + .long 1099775820 + .long 1012435153 + .long 1207959552 + .long 3212582104 + .long 3523250270 + .long 3180953827 + .long 1977223559 + .long 1059998873 + .long 469007091 + .long 1056393187 + .long 17425450 + .long 3200373232 + .long 391965510 + .long 3192157780 + .long 3314858537 + .long 1044490263 + .long 3600399866 + .long 3186407596 + .long 3215068466 + .long 3182787442 + .long 3697861179 + .long 1030898835 + .long 2771081374 + .long 1025463657 + .long 4146920243 + .long 3169520105 + .long 3077194481 + .long 3160459915 + .long 1463264555 + .long 1012730022 + .long 0 + .long 1074790400 + .long 0 + .long 3222405120 + .long 673836129 + .long 1072459181 + .long 1403851199 + .long 1016899858 + .long 3166402837 + .long 1068785305 + .long 375843704 + .long 1012382807 + .long 4026531840 + .long 3214338668 + .long 3760928269 + .long 3186707360 + .long 4037675931 + .long 1063570236 + .long 828875333 + .long 1058841864 + .long 1595734612 + .long 3205457361 + .long 3240025461 + .long 1053807046 + .long 2217213834 + .long 1050913991 + .long 1140208334 + .long 3195581500 + .long 1536578125 + .long 3189218053 + .long 1785608939 + .long 1041425703 + .long 3818468589 + .long 3183948101 + .long 4224809191 + .long 3181546992 + .long 1254902324 + .long 1030336836 + .long 2610385435 + .long 1025933392 + .long 0 + .long 1074790400 + .long 0 + .long 3222667264 + .long 3283395580 + .long 1072584552 + .long 1619691918 + .long 1013495334 + .long 1548049162 + .long 1067830873 + .long 1866614584 + .long 1009528830 + .long 3623878656 + .long 3213753274 + .long 3080383738 + .long 3186326900 + .long 2195737703 + .long 1063532365 + .long 1389581926 + .long 3206495117 + .long 1284275250 + .long 3204405036 + .long 1388678495 + .long 1054257519 + .long 2607787780 + .long 3195486202 + .long 1954028197 + .long 3195106308 + .long 1000142209 + .long 1043978813 + .long 4289390618 + .long 1039480054 + .long 1829994710 + .long 3184933148 + .long 1801900516 + .long 1031672376 + .long 994367613 + .long 1030081754 + .long 1886321575 + .long 3173571539 + .long 0 + .long 1074790400 + .long 0 + .long 3222929408 + .long 996654454 + .long 1072648041 + .long 2055905835 + .long 1016797060 + .long 2025629493 + .long 1066703316 + .long 3207138551 + .long 1007886082 + .long 2684354560 + .long 3212885244 + .long 3640404479 + .long 3184577086 + .long 3785526942 + .long 1063085617 + .long 914780829 + .long 3207165120 + .long 198538566 + .long 3200351555 + .long 743164606 + .long 1053656447 + .long 257739447 + .long 3197719723 + .long 4013344053 + .long 3192054846 + .long 2448984831 + .long 1043799255 + .long 301239699 + .long 3187102807 + .long 4198692195 + .long 3183507635 + .long 252775780 + .long 1033310081 + .long 3936202859 + .long 3174119617 + .long 2832995703 + .long 3173394688 + .long 0 + .long 1074790400 + .long 0 + .long 3223191552 + .long 4009021290 + .long 1072676449 + .long 2313960863 + .long 1015111149 + .long 939498435 + .long 1065430251 + .long 2354454115 + .long 1009400884 + .long 2147483648 + .long 3211794972 + .long 482970327 + .long 3184656008 + .long 3337941139 + .long 1062290385 + .long 1376485817 + .long 3206914838 + .long 3849340321 + .long 1055357361 + .long 3350371102 + .long 1051775129 + .long 2861188266 + .long 3197382603 + .long 2109605468 + .long 1045917685 + .long 3237589551 + .long 1041743271 + .long 485240880 + .long 3187249602 + .long 3692998039 + .long 1035162550 + .long 2284233074 + .long 1031989748 + .long 2141078118 + .long 3176508222 + .long 2775821538 + .long 1021961626 + .long 0 + .long 1073741824 + .long 0 + .long 3222405120 + .long 1979914676 + .long 1072690180 + .long 3909090605 + .long 1014961349 + .long 2850023777 + .long 1064124739 + .long 2716929087 + .long 1007836215 + .long 134217728 + .long 3211818166 + .long 661707185 + .long 3185457101 + .long 511854090 + .long 1063665398 + .long 846761866 + .long 3209923224 + .long 2075885217 + .long 1060492209 + .long 3563065698 + .long 3204958944 + .long 791923268 + .long 3201693745 + .long 905515084 + .long 1053843502 + .long 2412959807 + .long 3198694704 + .long 3378187023 + .long 3192392758 + .long 389556620 + .long 1046549597 + .long 4094604040 + .long 3191327001 + .long 2261901381 + .long 3186206862 + .long 3040498429 + .long 1038898667 + .long 0 + .long 1073741824 + .long 0 + .long 3222667264 + .long 4211364825 + .long 1072693036 + .long 2280492610 + .long 1015654639 + .long 3441679161 + .long 1060320780 + .long 631077559 + .long 1005402779 + .long 2550136832 + .long 3208276561 + .long 952708928 + .long 3179317867 + .long 1724702579 + .long 1060543732 + .long 1940663234 + .long 3207246018 + .long 1617314154 + .long 1058444121 + .long 3218201639 + .long 3204130645 + .long 1677675407 + .long 1054157666 + .long 983365761 + .long 3197588855 + .long 3697581654 + .long 3196234675 + .long 2384146406 + .long 1047319959 + .long 271521235 + .long 3191905541 + .long 1276705943 + .long 3186754722 + .long 2179097654 + .long 1039567487 + .long 301655052 + .long 3184379693 + .long 0 + .long 1073741824 + .long 0 + .long 3222929408 + .long 4193680981 + .long 1072693238 + .long 4060240663 + .long 1015946834 + .long 2365640378 + .long 1055824734 + .long 3526748952 + .long 995134091 + .long 3489660928 + .long 3203980860 + .long 2590051195 + .long 3175384383 + .long 2654771569 + .long 1056549448 + .long 4010094511 + .long 3203581909 + .long 3526856597 + .long 1055166628 + .long 1319720904 + .long 3201385798 + .long 499971761 + .long 1052133367 + .long 2524150070 + .long 3197462343 + .long 3595721810 + .long 1047211062 + .long 32165415 + .long 3189999948 + .long 131183479 + .long 3189246514 + .long 3500428453 + .long 1040184954 + .long 4217742894 + .long 3184647883 + .long 1659999320 + .long 3176152785 + .long 0 + .long 1073741824 + .long 0 + .long 3223191552 + .long 3270603235 + .long 1072693247 + .long 789463291 + .long 1015570140 + .long 3808393842 + .long 1050514289 + .long 2326429486 + .long 994919830 + .long 3221225472 + .long 3198925370 + .long 1345776679 + .long 3171106320 + .long 2968647484 + .long 1051768487 + .long 2248759888 + .long 3199010549 + .long 3387299329 + .long 1050887019 + .long 1430298481 + .long 3197384059 + .long 1348250416 + .long 1048645854 + .long 4055449617 + .long 3194443371 + .long 1237453215 + .long 1045012312 + .long 3542750561 + .long 3190150798 + .long 2477123228 + .long 1039795927 + .long 1515061420 + .long 3182966354 + .long 468112447 + .long 3181397693 + .long 3085255916 + .long 1032264152 + .long 0 + .long 1072693248 + .long 0 + .long 3222405120 + .long 4293196336 + .long 1072693247 + .long 2846765772 + .long 1013778335 + .long 708045282 + .long 1042226741 + .long 3617872673 + .long 984839576 + .long 3758096384 + .long 3191963901 + .long 3393404685 + .long 3164431480 + .long 678234459 + .long 1046059910 + .long 3154637626 + .long 3194706316 + .long 2318517263 + .long 1047966141 + .long 3341209390 + .long 3195954445 + .long 800124789 + .long 1048630880 + .long 2824228362 + .long 3196018487 + .long 785851381 + .long 1048106191 + .long 4129204204 + .long 3195061111 + .long 3370612561 + .long 1046690463 + .long 1422845730 + .long 3193098259 + .long 1920503482 + .long 1044382253 + .long 2798351277 + .long 3189961775 + .long 2515384124 + .long 1072782465 + .long 4217971979 + .long 3222778785 + .long 4294967193 + .long 1072693247 + .long 1248116507 + .long 1015814019 + .long 955504597 + .long 1027630151 + .long 942964606 + .long 972301410 + .long 268435456 + .long 3177488267 + .long 3130289062 + .long 3150952764 + .long 4292327811 + .long 1031864837 + .long 2929831361 + .long 3180636976 + .long 1961758009 + .long 1034139815 + .long 5545144 + .long 3182345703 + .long 485665603 + .long 1035212938 + .long 2600921430 + .long 3182853574 + .long 3983926904 + .long 1035334367 + .long 3203204633 + .long 3182602207 + .long 3287855196 + .long 1034606778 + .long 3286302033 + .long 3181514701 + .long 1856488612 + .long 1033626459 + .long 4001991753 + .long 3180127602 + .long 1346542445 + .long 1072827863 + .long 1342177280 + .long 1072827863 + .long 1147899556 + .long 1041278683 + .long 1744830464 + .long 3218608756 + .long 902814497 + .long 3190299599 + .long 436480833 + .long 1069343474 + .long 824474678 + .long 3214639822 + .long 3302084921 + .long 1064658364 + .long 3780041965 + .long 3209429686 + .long 3655817560 + .long 1059021901 + .long 0 + .long 1282408448 + .long 0 + .long 862978048 + .long 33554432 + .long 1101004800 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 0 + .long 256 + .long 1222277045 + .long 929276 + .long 0 + .long 1069547520 + .long 2378786344 + .long 1075294132 + .type _vmldErfHATab,@object + .size _vmldErfHATab,3680 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/erfc.S b/external/sgx_libm/intel64/erfc.S new file mode 100644 index 0000000000..1169a8ac3d --- /dev/null +++ b/external/sgx_libm/intel64/erfc.S @@ -0,0 +1,2064 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfc.c" + .text +..TXTST0: +# -- Begin erfc + .text + .align 16,0x90 + .globl erfc +erfc: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_erfc.1: +..L2: + + movaps %xmm0, %xmm1 + movsd %xmm1, -8(%rsp) + movzwl -2(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + je ..B1.18 +..B1.2: + cmpl $953, %eax + jl ..B1.16 +..B1.3: + lea 5016+_vmldErfcHATab(%rip), %rax + movb -1(%rsp), %dil + comisd (%rax), %xmm1 + jbe ..B1.15 +..B1.4: + lea 4992+_vmldErfcHATab(%rip), %rax + movsd (%rax), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B1.25 +..B1.5: + lea 4968+_vmldErfcHATab(%rip), %rcx + movb %dil, %sil + movsd %xmm1, -48(%rsp) + andb $127, %sil + movb %sil, -41(%rsp) + movsd -48(%rsp), %xmm3 + movsd (%rcx), %xmm2 + movaps %xmm3, %xmm7 + addsd %xmm2, %xmm7 + mulsd %xmm7, %xmm7 + mulsd %xmm7, %xmm7 + movsd %xmm7, -16(%rsp) + movzwl -10(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + lea -1023(%rdx), %esi + lea -3069(%rdx,%rdx,2), %ecx + lea _vmldErfcHATab(%rip), %rdx + lea (,%rcx,8), %eax + lea 1(,%rcx,8), %r9d + lea 23(,%rcx,8), %r10d + movsd (%rdx,%rax,8), %xmm12 + lea 22(,%rcx,8), %r11d + mulsd %xmm3, %xmm12 + lea 21(,%rcx,8), %eax + movsd (%rdx,%r9,8), %xmm4 + movaps %xmm12, %xmm6 + addsd %xmm12, %xmm4 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm5 + subsd %xmm5, %xmm6 + movsd %xmm6, -32(%rsp) + movsd -40(%rsp), %xmm9 + movsd -32(%rsp), %xmm8 + addsd %xmm8, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -32(%rsp), %xmm10 + addsd (%rdx,%r9,8), %xmm10 + movsd %xmm10, -32(%rsp) + lea 20(,%rcx,8), %r9d + movsd -24(%rsp), %xmm11 + subsd %xmm11, %xmm12 + movsd (%rdx,%r10,8), %xmm11 + movsd %xmm12, -24(%rsp) + lea 19(,%rcx,8), %r10d + movsd -32(%rsp), %xmm14 + movsd -24(%rsp), %xmm13 + addsd %xmm13, %xmm14 + movsd %xmm14, -24(%rsp) + movsd -40(%rsp), %xmm5 + mulsd %xmm5, %xmm11 + movaps %xmm5, %xmm0 + movaps %xmm5, %xmm15 + addsd (%rdx,%r11,8), %xmm11 + mulsd %xmm5, %xmm15 + mulsd %xmm5, %xmm11 + mulsd %xmm15, %xmm15 + addsd (%rdx,%rax,8), %xmm11 + mulsd %xmm5, %xmm11 + lea 18(,%rcx,8), %eax + movsd -24(%rsp), %xmm6 + lea 16(,%rcx,8), %r11d + movsd %xmm15, -16(%rsp) + addsd (%rdx,%r9,8), %xmm11 + mulsd %xmm5, %xmm11 + lea 17(,%rcx,8), %r9d + addsd (%rdx,%r10,8), %xmm11 + mulsd %xmm5, %xmm11 + lea 12(,%rcx,8), %r10d + movsd (%rdx,%r10,8), %xmm10 + lea 8(,%rcx,8), %r10d + movaps %xmm10, %xmm8 + addsd (%rdx,%rax,8), %xmm11 + mulsd %xmm5, %xmm11 + lea 15(,%rcx,8), %eax + addsd (%rdx,%r9,8), %xmm11 + mulsd %xmm5, %xmm11 + lea 14(,%rcx,8), %r9d + addsd (%rdx,%r11,8), %xmm11 + mulsd %xmm5, %xmm11 + lea 10(,%rcx,8), %r11d + addsd (%rdx,%rax,8), %xmm11 + lea 4944+_vmldErfcHATab(%rip), %rax + movsd (%rax), %xmm7 + mulsd %xmm7, %xmm0 + mulsd %xmm5, %xmm11 + movsd %xmm0, -40(%rsp) + movsd -40(%rsp), %xmm1 + subsd %xmm5, %xmm1 + addsd (%rdx,%r9,8), %xmm11 + movsd %xmm1, -32(%rsp) + lea 13(,%rcx,8), %r9d + movsd -40(%rsp), %xmm3 + movsd -32(%rsp), %xmm15 + mulsd %xmm5, %xmm11 + subsd %xmm15, %xmm3 + movsd %xmm3, -40(%rsp) + addsd %xmm11, %xmm8 + movsd -40(%rsp), %xmm4 + movsd (%rdx,%r11,8), %xmm15 + lea 6(,%rcx,8), %r11d + subsd %xmm4, %xmm5 + movsd %xmm5, -32(%rsp) + movsd -40(%rsp), %xmm0 + movsd -32(%rsp), %xmm1 + movsd %xmm8, -40(%rsp) + addsd %xmm6, %xmm1 + movsd -40(%rsp), %xmm9 + subsd %xmm9, %xmm10 + addsd %xmm10, %xmm11 + movsd %xmm11, -32(%rsp) + movsd -40(%rsp), %xmm3 + movaps %xmm3, %xmm12 + mulsd %xmm7, %xmm12 + movsd -32(%rsp), %xmm4 + movsd %xmm12, -40(%rsp) + movsd -40(%rsp), %xmm13 + subsd %xmm3, %xmm13 + addsd (%rdx,%r9,8), %xmm4 + movsd %xmm13, -32(%rsp) + lea 11(,%rcx,8), %r9d + movsd -40(%rsp), %xmm12 + movsd -32(%rsp), %xmm14 + subsd %xmm14, %xmm12 + movsd %xmm12, -40(%rsp) + movsd -40(%rsp), %xmm13 + subsd %xmm13, %xmm3 + movsd %xmm3, -32(%rsp) + movsd -40(%rsp), %xmm5 + movsd -32(%rsp), %xmm6 + movaps %xmm5, %xmm11 + mulsd %xmm1, %xmm5 + addsd %xmm4, %xmm6 + mulsd %xmm0, %xmm11 + movaps %xmm6, %xmm8 + movaps %xmm11, %xmm9 + mulsd %xmm1, %xmm8 + addsd %xmm15, %xmm9 + mulsd %xmm0, %xmm6 + addsd %xmm5, %xmm8 + addsd %xmm6, %xmm8 + movsd %xmm8, -40(%rsp) + movsd -40(%rsp), %xmm14 + movsd %xmm9, -40(%rsp) + movsd -40(%rsp), %xmm10 + subsd %xmm10, %xmm15 + addsd %xmm11, %xmm15 + movsd %xmm15, -32(%rsp) + movsd -40(%rsp), %xmm8 + movaps %xmm8, %xmm3 + mulsd %xmm7, %xmm3 + movsd -32(%rsp), %xmm11 + movsd %xmm3, -40(%rsp) + movaps %xmm0, %xmm3 + movsd -40(%rsp), %xmm4 + addsd %xmm14, %xmm11 + subsd %xmm8, %xmm4 + addsd (%rdx,%r9,8), %xmm11 + movsd %xmm4, -32(%rsp) + lea 9(,%rcx,8), %r9d + movsd -40(%rsp), %xmm5 + movsd -32(%rsp), %xmm14 + movsd (%rdx,%r10,8), %xmm4 + lea 4(,%rcx,8), %r10d + subsd %xmm14, %xmm5 + movsd %xmm5, -40(%rsp) + movsd -40(%rsp), %xmm6 + subsd %xmm6, %xmm8 + movsd %xmm8, -32(%rsp) + movsd -40(%rsp), %xmm10 + movsd -32(%rsp), %xmm9 + mulsd %xmm10, %xmm3 + addsd %xmm9, %xmm11 + mulsd %xmm1, %xmm10 + movaps %xmm11, %xmm12 + movaps %xmm3, %xmm13 + mulsd %xmm1, %xmm12 + addsd %xmm4, %xmm13 + mulsd %xmm0, %xmm11 + addsd %xmm10, %xmm12 + addsd %xmm11, %xmm12 + movsd %xmm12, -40(%rsp) + movsd -40(%rsp), %xmm5 + movsd %xmm13, -40(%rsp) + movsd -40(%rsp), %xmm15 + subsd %xmm15, %xmm4 + addsd %xmm3, %xmm4 + movsd %xmm4, -32(%rsp) + movsd -40(%rsp), %xmm12 + movaps %xmm12, %xmm6 + mulsd %xmm7, %xmm6 + movsd -32(%rsp), %xmm3 + movsd %xmm6, -40(%rsp) + movaps %xmm0, %xmm6 + movsd -40(%rsp), %xmm8 + addsd %xmm5, %xmm3 + subsd %xmm12, %xmm8 + addsd (%rdx,%r9,8), %xmm3 + movsd %xmm8, -32(%rsp) + lea 7(,%rcx,8), %r9d + movsd -40(%rsp), %xmm10 + movsd -32(%rsp), %xmm9 + movsd (%rdx,%r11,8), %xmm8 + lea 2(,%rcx,8), %r11d + subsd %xmm9, %xmm10 + movsd %xmm10, -40(%rsp) + movsd -40(%rsp), %xmm11 + subsd %xmm11, %xmm12 + movsd %xmm12, -32(%rsp) + movsd -40(%rsp), %xmm14 + movsd -32(%rsp), %xmm13 + mulsd %xmm14, %xmm6 + addsd %xmm13, %xmm3 + mulsd %xmm1, %xmm14 + movaps %xmm3, %xmm4 + movaps %xmm6, %xmm5 + mulsd %xmm1, %xmm4 + addsd %xmm8, %xmm5 + mulsd %xmm0, %xmm3 + addsd %xmm14, %xmm4 + addsd %xmm3, %xmm4 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm3 + movsd %xmm5, -40(%rsp) + movsd -40(%rsp), %xmm15 + subsd %xmm15, %xmm8 + addsd %xmm6, %xmm8 + movsd %xmm8, -32(%rsp) + movaps %xmm0, %xmm8 + movsd -40(%rsp), %xmm12 + movaps %xmm12, %xmm9 + mulsd %xmm7, %xmm9 + movsd -32(%rsp), %xmm6 + movsd %xmm9, -40(%rsp) + addsd %xmm3, %xmm6 + movsd -40(%rsp), %xmm10 + movsd (%rdx,%r10,8), %xmm9 + subsd %xmm12, %xmm10 + addsd (%rdx,%r9,8), %xmm6 + movsd %xmm10, -32(%rsp) + lea 5(,%rcx,8), %r9d + movsd -40(%rsp), %xmm11 + movsd -32(%rsp), %xmm4 + subsd %xmm4, %xmm11 + movsd %xmm11, -40(%rsp) + movsd -40(%rsp), %xmm5 + subsd %xmm5, %xmm12 + movsd %xmm12, -32(%rsp) + movsd -40(%rsp), %xmm3 + movsd -32(%rsp), %xmm13 + mulsd %xmm3, %xmm8 + addsd %xmm13, %xmm6 + mulsd %xmm1, %xmm3 + movaps %xmm6, %xmm4 + movaps %xmm8, %xmm5 + mulsd %xmm1, %xmm4 + addsd %xmm9, %xmm5 + mulsd %xmm0, %xmm6 + addsd %xmm3, %xmm4 + addsd %xmm6, %xmm4 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm15 + movsd %xmm5, -40(%rsp) + movsd -40(%rsp), %xmm14 + subsd %xmm14, %xmm9 + addsd %xmm8, %xmm9 + movsd %xmm9, -32(%rsp) + movsd -40(%rsp), %xmm4 + movaps %xmm4, %xmm10 + mulsd %xmm7, %xmm10 + movsd -32(%rsp), %xmm8 + movsd %xmm10, -40(%rsp) + movaps %xmm0, %xmm10 + movsd -40(%rsp), %xmm11 + addsd %xmm15, %xmm8 + subsd %xmm4, %xmm11 + addsd (%rdx,%r9,8), %xmm8 + movsd %xmm11, -32(%rsp) + movsd -40(%rsp), %xmm12 + movsd -32(%rsp), %xmm15 + subsd %xmm15, %xmm12 + movsd %xmm12, -40(%rsp) + movsd -40(%rsp), %xmm3 + subsd %xmm3, %xmm4 + movsd (%rdx,%r11,8), %xmm3 + movsd %xmm4, -32(%rsp) + movsd -40(%rsp), %xmm6 + movsd -32(%rsp), %xmm5 + mulsd %xmm6, %xmm10 + addsd %xmm5, %xmm8 + movaps %xmm8, %xmm9 + mulsd %xmm1, %xmm9 + mulsd %xmm6, %xmm1 + mulsd %xmm8, %xmm0 + addsd %xmm1, %xmm9 + addsd %xmm0, %xmm9 + movaps %xmm10, %xmm0 + addsd %xmm3, %xmm0 + movsd %xmm9, -40(%rsp) + movsd -40(%rsp), %xmm4 + movsd %xmm0, -40(%rsp) + movsd -40(%rsp), %xmm1 + subsd %xmm1, %xmm3 + addsd %xmm10, %xmm3 + movsd %xmm3, -32(%rsp) + movsd -40(%rsp), %xmm6 + movsd -32(%rsp), %xmm5 + addsd %xmm4, %xmm5 +..B1.28: + movaps %xmm6, %xmm1 + lea 3(,%rcx,8), %ecx + movsd (%rdx,%rcx,8), %xmm0 + cmpl $6, %esi + addsd %xmm0, %xmm5 + addsd %xmm5, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm3 + subsd %xmm3, %xmm6 + addsd %xmm5, %xmm6 + movsd %xmm6, -32(%rsp) + movsd -40(%rsp), %xmm1 + movsd -32(%rsp), %xmm0 + jae ..B1.7 +..B1.6: + movsd %xmm2, -48(%rsp) + jmp ..B1.8 +..B1.7: + movaps %xmm7, %xmm8 + lea 4976+_vmldErfcHATab(%rip), %r8 + mulsd %xmm1, %xmm8 + lea 4920+_vmldErfcHATab(%rip), %rcx + movsd %xmm8, -40(%rsp) + lea 4936+_vmldErfcHATab(%rip), %rsi + movsd -40(%rsp), %xmm9 + lea 4904+_vmldErfcHATab(%rip), %r9 + movsd -8(%rsp), %xmm4 + lea 4912+_vmldErfcHATab(%rip), %r10 + movaps %xmm4, %xmm14 + lea 3872+_vmldErfcHATab(%rip), %r11 + mulsd (%rax), %xmm14 + subsd %xmm1, %xmm9 + movsd %xmm9, -32(%rsp) + movsd -40(%rsp), %xmm11 + movsd -32(%rsp), %xmm10 + subsd %xmm10, %xmm11 + movsd %xmm11, -40(%rsp) + movsd -40(%rsp), %xmm12 + movsd (%rcx), %xmm11 + lea 3864+_vmldErfcHATab(%rip), %rcx + subsd %xmm12, %xmm1 + movsd (%r9), %xmm12 + movsd %xmm1, -32(%rsp) + lea 3848+_vmldErfcHATab(%rip), %r9 + movsd -40(%rsp), %xmm6 + movsd -32(%rsp), %xmm13 + movsd %xmm14, -40(%rsp) + addsd %xmm13, %xmm0 + movsd -40(%rsp), %xmm15 + subsd -8(%rsp), %xmm15 + movsd %xmm15, -32(%rsp) + movsd -40(%rsp), %xmm1 + movsd -32(%rsp), %xmm2 + subsd %xmm2, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm3 + subsd %xmm3, %xmm4 + movsd %xmm4, -32(%rsp) + movsd -40(%rsp), %xmm8 + movaps %xmm8, %xmm5 + mulsd %xmm8, %xmm5 + movsd -32(%rsp), %xmm9 + mulsd %xmm9, %xmm8 + mulsd %xmm9, %xmm9 + movsd (%r8), %xmm4 + addsd %xmm8, %xmm9 + mulsd %xmm4, %xmm5 + addsd %xmm8, %xmm9 + mulsd %xmm5, %xmm11 + movsd %xmm9, -40(%rsp) + movsd -40(%rsp), %xmm10 + mulsd %xmm10, %xmm4 + addsd (%rsi), %xmm11 + movsd %xmm11, -56(%rsp) + movsd -56(%rsp), %xmm3 + movl -56(%rsp), %r8d + movl %r8d, %eax + andl $63, %eax + subsd (%rsi), %xmm3 + mulsd %xmm3, %xmm12 + lea 3856+_vmldErfcHATab(%rip), %rsi + xorps .L_2il0floatpacket.166(%rip), %xmm3 + subsd %xmm12, %xmm5 + mulsd (%r10), %xmm3 + movaps %xmm5, %xmm13 + movaps %xmm5, %xmm2 + lea 3840+_vmldErfcHATab(%rip), %r10 + addsd %xmm3, %xmm13 + movsd %xmm13, -40(%rsp) + movsd -40(%rsp), %xmm14 + shrl $6, %r8d + subsd %xmm14, %xmm2 + movsd %xmm2, -32(%rsp) + addl $1023, %r8d + movsd -40(%rsp), %xmm1 + movsd -32(%rsp), %xmm15 + addsd %xmm15, %xmm1 + movsd %xmm1, -24(%rsp) + movsd -32(%rsp), %xmm2 + addsd %xmm2, %xmm3 + movsd %xmm3, -32(%rsp) + movsd -24(%rsp), %xmm8 + subsd %xmm8, %xmm5 + movsd %xmm5, -24(%rsp) + movsd -32(%rsp), %xmm2 + movsd -24(%rsp), %xmm5 + addsd %xmm5, %xmm2 + movsd %xmm2, -24(%rsp) + movsd -40(%rsp), %xmm12 + movaps %xmm12, %xmm1 + movaps %xmm12, %xmm8 + movsd -24(%rsp), %xmm3 + addsd %xmm4, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm5 + subsd %xmm5, %xmm8 + movsd (%r11), %xmm5 + movsd %xmm8, -32(%rsp) + movaps %xmm7, %xmm8 + movsd -40(%rsp), %xmm10 + lea 485(%rax,%rax), %r11d + movsd -32(%rsp), %xmm9 + lea 486(%rax,%rax), %eax + addsd %xmm9, %xmm10 + movsd %xmm10, -24(%rsp) + movsd -32(%rsp), %xmm11 + addsd %xmm11, %xmm4 + movsd %xmm4, -32(%rsp) + movsd -24(%rsp), %xmm4 + subsd %xmm4, %xmm12 + movsd %xmm12, -24(%rsp) + movsd -32(%rsp), %xmm14 + movsd -24(%rsp), %xmm13 + addsd %xmm13, %xmm14 + movsd %xmm14, -24(%rsp) + movsd -40(%rsp), %xmm4 + mulsd %xmm4, %xmm5 + movaps %xmm4, %xmm2 + movsd -24(%rsp), %xmm15 + addsd (%rcx), %xmm5 + movl %r8d, %ecx + addsd %xmm15, %xmm3 + mulsd %xmm4, %xmm5 + andl $2047, %ecx + addsd (%rsi), %xmm5 + mulsd %xmm4, %xmm5 + shll $4, %ecx + addsd (%r9), %xmm5 + mulsd %xmm4, %xmm5 + addsd (%r10), %xmm5 + mulsd %xmm4, %xmm5 + mulsd %xmm4, %xmm5 + addsd %xmm5, %xmm2 + movsd %xmm2, -32(%rsp) + movsd -32(%rsp), %xmm1 + subsd %xmm1, %xmm5 + addsd %xmm4, %xmm5 + movsd %xmm5, -24(%rsp) + movsd -32(%rsp), %xmm13 + mulsd %xmm13, %xmm8 + movsd -24(%rsp), %xmm1 + movsd %xmm8, -40(%rsp) + movsd -40(%rsp), %xmm9 + movsd (%rdx,%r11,8), %xmm5 + subsd %xmm13, %xmm9 + movsd %xmm9, -32(%rsp) + movsd -40(%rsp), %xmm11 + movsd -32(%rsp), %xmm10 + subsd %xmm10, %xmm11 + movsd %xmm11, -40(%rsp) + movsd -40(%rsp), %xmm12 + subsd %xmm12, %xmm13 + movaps %xmm5, %xmm12 + movsd %xmm13, -32(%rsp) + movsd -40(%rsp), %xmm2 + movsd -32(%rsp), %xmm14 + mulsd %xmm2, %xmm12 + addsd %xmm14, %xmm1 + movaps %xmm12, %xmm8 + addsd %xmm3, %xmm1 + movsd (%rdx,%rax,8), %xmm3 + movaps %xmm3, %xmm4 + mulsd %xmm1, %xmm4 + mulsd %xmm5, %xmm1 + addsd %xmm12, %xmm5 + mulsd %xmm3, %xmm2 + addsd %xmm1, %xmm4 + addsd %xmm2, %xmm4 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm2 + movsd %xmm5, -40(%rsp) + movsd -40(%rsp), %xmm1 + subsd %xmm1, %xmm8 + movaps %xmm7, %xmm1 + movsd %xmm8, -32(%rsp) + movsd -40(%rsp), %xmm9 + movsd -32(%rsp), %xmm3 + addsd %xmm3, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -32(%rsp), %xmm10 + addsd (%rdx,%r11,8), %xmm10 + movsd %xmm10, -32(%rsp) + movsd -24(%rsp), %xmm11 + subsd %xmm11, %xmm12 + movsd %xmm12, -24(%rsp) + movsd -32(%rsp), %xmm14 + movsd -24(%rsp), %xmm13 + addsd %xmm13, %xmm14 + movsd %xmm14, -24(%rsp) + movsd -40(%rsp), %xmm8 + mulsd %xmm8, %xmm1 + movsd -24(%rsp), %xmm15 + movsd %xmm1, -40(%rsp) + movaps %xmm6, %xmm1 + movsd -40(%rsp), %xmm3 + subsd %xmm8, %xmm3 + addsd (%rdx,%rax,8), %xmm15 + movsd %xmm3, -32(%rsp) + addsd %xmm15, %xmm2 + movsd -40(%rsp), %xmm4 + lea 4952+_vmldErfcHATab(%rip), %rdx + movsd -32(%rsp), %xmm15 + subsd %xmm15, %xmm4 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm5 + movq (%rdx), %rax + subsd %xmm5, %xmm8 + movsd %xmm8, -32(%rsp) + movsd -40(%rsp), %xmm10 + movsd -32(%rsp), %xmm9 + mulsd %xmm10, %xmm1 + addsd %xmm9, %xmm2 + mulsd %xmm0, %xmm10 + movaps %xmm2, %xmm11 + mulsd %xmm0, %xmm11 + mulsd %xmm6, %xmm2 + movq %rax, -48(%rsp) + addsd %xmm2, %xmm11 + shrq $48, %rax + addsd %xmm10, %xmm11 + andl $-32753, %eax + movsd %xmm11, -40(%rsp) + orl %ecx, %eax + movsd -40(%rsp), %xmm0 + movw %ax, -42(%rsp) +..B1.8: + andb $-128, %dil + cmpb $-128, %dil + je ..B1.17 +..B1.9: + lea 5008+_vmldErfcHATab(%rip), %rax + movsd -8(%rsp), %xmm3 + movsd (%rax), %xmm2 + comisd %xmm3, %xmm2 + jbe ..B1.11 +..B1.10: + addsd %xmm1, %xmm0 + mulsd -48(%rsp), %xmm0 + ret +..B1.11: + lea 4952+_vmldErfcHATab(%rip), %rax + addl $200, %r8d + andl $2047, %r8d + lea 5000+_vmldErfcHATab(%rip), %rcx + shll $4, %r8d + movq (%rax), %rdx + movq %rdx, -48(%rsp) + shrq $48, %rdx + andl $-32753, %edx + orl %r8d, %edx + movw %dx, -42(%rsp) + movsd -48(%rsp), %xmm2 + mulsd %xmm2, %xmm1 + comisd (%rcx), %xmm3 + mulsd %xmm2, %xmm0 + jbe ..B1.13 +..B1.12: + lea 4928+_vmldErfcHATab(%rip), %rax + addsd %xmm1, %xmm0 + mulsd (%rax), %xmm0 + movaps %xmm0, %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm2 + addsd %xmm2, %xmm0 + ret +..B1.13: + movaps %xmm0, %xmm2 + lea 4928+_vmldErfcHATab(%rip), %rax + addsd %xmm1, %xmm2 + movsd %xmm2, -40(%rsp) + movsd -40(%rsp), %xmm3 + subsd %xmm3, %xmm1 + addsd %xmm0, %xmm1 + movsd %xmm1, -32(%rsp) + movsd -40(%rsp), %xmm5 + mulsd %xmm5, %xmm7 + movsd -32(%rsp), %xmm9 + movsd %xmm7, -40(%rsp) + movsd -40(%rsp), %xmm0 + subsd %xmm5, %xmm0 + movsd %xmm0, -32(%rsp) + movsd -40(%rsp), %xmm1 + movsd -32(%rsp), %xmm7 + subsd %xmm7, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm4 + subsd %xmm4, %xmm5 + movsd %xmm5, -32(%rsp) + movsd -40(%rsp), %xmm8 + movsd -32(%rsp), %xmm6 + mulsd (%rax), %xmm8 + addsd %xmm6, %xmm9 + mulsd (%rax), %xmm9 + movsd %xmm8, -40(%rsp) + movsd %xmm9, -32(%rsp) + movsd -40(%rsp), %xmm0 + movsd -32(%rsp), %xmm10 + addsd %xmm10, %xmm0 +..B1.14: + ret +..B1.15: + lea 4984+_vmldErfcHATab(%rip), %rax + lea 4928+_vmldErfcHATab(%rip), %rdx + movsd (%rax), %xmm0 + subsd (%rdx), %xmm0 + ret +..B1.16: + lea 4968+_vmldErfcHATab(%rip), %rax + movsd (%rax), %xmm0 + addsd -8(%rsp), %xmm0 + ret +..B1.17: + movsd -48(%rsp), %xmm2 + lea 4984+_vmldErfcHATab(%rip), %rax + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm0 + movsd (%rax), %xmm5 + xorps .L_2il0floatpacket.166(%rip), %xmm1 + movaps %xmm5, %xmm3 + xorps .L_2il0floatpacket.166(%rip), %xmm0 + addsd %xmm1, %xmm3 + movsd %xmm3, -40(%rsp) + movsd -40(%rsp), %xmm4 + subsd %xmm4, %xmm5 + addsd %xmm1, %xmm5 + movsd %xmm5, -32(%rsp) + movsd -40(%rsp), %xmm11 + movaps %xmm11, %xmm1 + movaps %xmm11, %xmm7 + movsd -32(%rsp), %xmm14 + addsd %xmm0, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm6 + subsd %xmm6, %xmm7 + movsd %xmm7, -32(%rsp) + movsd -40(%rsp), %xmm9 + movsd -32(%rsp), %xmm8 + addsd %xmm8, %xmm9 + movsd %xmm9, -24(%rsp) + movsd -32(%rsp), %xmm10 + addsd %xmm10, %xmm0 + movsd %xmm0, -32(%rsp) + movsd -24(%rsp), %xmm0 + subsd %xmm0, %xmm11 + movsd %xmm11, -24(%rsp) + movsd -32(%rsp), %xmm13 + movsd -24(%rsp), %xmm12 + addsd %xmm12, %xmm13 + movsd %xmm13, -24(%rsp) + movsd -40(%rsp), %xmm15 + movsd -24(%rsp), %xmm0 + addsd %xmm14, %xmm0 + addsd %xmm15, %xmm0 + ret +..B1.18: + testl $1048575, -4(%rsp) + jne ..B1.23 +..B1.19: + cmpl $0, -8(%rsp) + jne ..B1.23 +..B1.20: + movb -1(%rsp), %al + andb $-128, %al + cmpb $-128, %al + je ..B1.24 +..B1.21: + lea 4952+_vmldErfcHATab(%rip), %rax + movsd (%rax), %xmm0 +..B1.22: + ret +..B1.23: + movsd -8(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + ret +..B1.24: + lea 4984+_vmldErfcHATab(%rip), %rax + movsd (%rax), %xmm0 + ret +..B1.25: + lea 4960+_vmldErfcHATab(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type erfc,@function + .size erfc,.-erfc + .data +# -- End erfc + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.166: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.166,@object + .size .L_2il0floatpacket.166,16 + .align 8 +_vmldErfcHATab: + .long 0 + .long 1074790400 + .long 0 + .long 3219128320 + .long 2536042781 + .long 1072398983 + .long 1399772821 + .long 1016356498 + .long 2716363190 + .long 3218196015 + .long 2515012741 + .long 3161253520 + .long 2716363190 + .long 1065469487 + .long 2240747611 + .long 1008526987 + .long 3687592758 + .long 1064760658 + .long 803907102 + .long 1004882786 + .long 3448634865 + .long 3207698121 + .long 750050903 + .long 3152352039 + .long 601957364 + .long 3206196134 + .long 1555639211 + .long 3149699171 + .long 1774552010 + .long 1054291178 + .long 3884532135 + .long 1052283480 + .long 3233761315 + .long 3195467393 + .long 1379327181 + .long 3193076019 + .long 242623580 + .long 1041378609 + .long 2275269623 + .long 1038572401 + .long 254615366 + .long 3181902490 + .long 2447494219 + .long 3178851847 + .long 604424981 + .long 1027296749 + .long 50341065 + .long 1024134801 + .long 0 + .long 1073741824 + .long 0 + .long 3219390464 + .long 1599080160 + .long 1071977136 + .long 688395245 + .long 1016124311 + .long 3971924631 + .long 3219152851 + .long 3564228032 + .long 3163583509 + .long 3891163965 + .long 1068791752 + .long 3480798202 + .long 1012474408 + .long 1621928818 + .long 1067553147 + .long 4020082186 + .long 1012007724 + .long 685042962 + .long 3213042343 + .long 3489060295 + .long 3153732341 + .long 2848795668 + .long 3210759248 + .long 3762448119 + .long 3156070926 + .long 1324211555 + .long 1061670518 + .long 1476477459 + .long 1058441900 + .long 2515812913 + .long 3204852392 + .long 3304760842 + .long 3200696323 + .long 716797578 + .long 1052801360 + .long 2283992921 + .long 1047370885 + .long 2268754290 + .long 3195296397 + .long 1012519479 + .long 3185657836 + .long 944669356 + .long 1042638534 + .long 1931303816 + .long 3183131001 + .long 0 + .long 1072693248 + .long 0 + .long 3219390464 + .long 1180573078 + .long 1071127762 + .long 4113175178 + .long 1014965748 + .long 2484292509 + .long 3219680918 + .long 959898156 + .long 3163955503 + .long 957881989 + .long 1071548988 + .long 442195505 + .long 1012747532 + .long 35029730 + .long 1068269829 + .long 976783580 + .long 1012161104 + .long 2319046290 + .long 3217462844 + .long 10747389 + .long 3161497233 + .long 3758081287 + .long 1067192898 + .long 1126055042 + .long 1009745370 + .long 1760060230 + .long 1067789094 + .long 3251266701 + .long 3213655257 + .long 2806967453 + .long 3212534516 + .long 1864685761 + .long 1064158132 + .long 3738348856 + .long 1061687624 + .long 790737257 + .long 3209050005 + .long 1943644508 + .long 3204796481 + .long 2914584687 + .long 1058674792 + .long 2574038108 + .long 3201168805 + .long 1252008665 + .long 3203024355 + .long 0 + .long 1071644672 + .long 0 + .long 3219390464 + .long 866709712 + .long 1068743889 + .long 2877058776 + .long 1013060082 + .long 4210332368 + .long 3219015250 + .long 1459199107 + .long 3163298467 + .long 3688727889 + .long 1072884723 + .long 2792291460 + .long 1014241070 + .long 855534605 + .long 3220533712 + .long 759913640 + .long 3163946628 + .long 2131284961 + .long 1069103746 + .long 2597396527 + .long 1013374934 + .long 989201780 + .long 1073227786 + .long 3318708226 + .long 1013855758 + .long 699280746 + .long 3220558000 + .long 993015799 + .long 3218982987 + .long 1559561232 + .long 1073166816 + .long 680189340 + .long 3219046342 + .long 3200850606 + .long 3220010182 + .long 1492278808 + .long 1071125031 + .long 4108347350 + .long 3218518333 + .long 2186414716 + .long 3220448795 + .long 2803204773 + .long 3219471098 + .long 1021304598 + .long 3216041452 + .long 0 + .long 1072693248 + .long 0 + .long 3220701184 + .long 2395493008 + .long 1067539114 + .long 2347713276 + .long 1010696759 + .long 649597580 + .long 3216929335 + .long 3715599898 + .long 3160841752 + .long 1561014649 + .long 1069995433 + .long 3047088181 + .long 1014230941 + .long 735510274 + .long 3217146528 + .long 1352249772 + .long 3161795800 + .long 1629994682 + .long 1067898281 + .long 867814168 + .long 1012540688 + .long 3242132826 + .long 1066299959 + .long 1473115860 + .long 1010684527 + .long 1350993397 + .long 3214133819 + .long 212467593 + .long 1064529314 + .long 1581296174 + .long 1063476333 + .long 1019617056 + .long 3210475870 + .long 326531339 + .long 1058667915 + .long 2560102974 + .long 1060207995 + .long 1059830545 + .long 3205421344 + .long 73331091 + .long 1053435953 + .long 3519680827 + .long 1056963274 + .long 287235298 + .long 1054771565 + .long 0 + .long 1072693248 + .long 0 + .long 3220701184 + .long 2395492868 + .long 1067539114 + .long 3682704431 + .long 1012674156 + .long 649602216 + .long 3216929335 + .long 3411089016 + .long 3161142609 + .long 1560943486 + .long 1069995433 + .long 373233254 + .long 1014373936 + .long 736848572 + .long 3217146528 + .long 1866442275 + .long 3160326248 + .long 1560943474 + .long 1067898281 + .long 3576330307 + .long 1009307384 + .long 649623715 + .long 1066299959 + .long 725533065 + .long 1006865126 + .long 1925526991 + .long 3214133821 + .long 2782059224 + .long 1064529267 + .long 3902564706 + .long 1063475940 + .long 2706862450 + .long 3210478464 + .long 1817950372 + .long 1058560819 + .long 1279984267 + .long 1060154640 + .long 1456324877 + .long 3205782300 + .long 3219859931 + .long 3203609651 + .long 1354896425 + .long 1055916872 + .long 153053737 + .long 3200605489 + .long 0 + .long 1070596096 + .long 0 + .long 3219390464 + .long 4088869944 + .long 1070267315 + .long 2176293176 + .long 1014815941 + .long 2130816332 + .long 3218278509 + .long 1120272801 + .long 3163324298 + .long 2812844367 + .long 1071221080 + .long 3953643227 + .long 1013638927 + .long 1988706352 + .long 3219153696 + .long 4268394231 + .long 3159871631 + .long 1288160248 + .long 1071920576 + .long 2922427679 + .long 1016153595 + .long 2977979581 + .long 3219655118 + .long 3750808263 + .long 3157405326 + .long 985562119 + .long 1072408739 + .long 2519169024 + .long 3220102519 + .long 68429100 + .long 1072741226 + .long 3577866702 + .long 3220290005 + .long 2564607388 + .long 1072813459 + .long 2939200104 + .long 3220467302 + .long 4218579581 + .long 1071794210 + .long 1377164546 + .long 3221614222 + .long 2324734477 + .long 3221337613 + .long 1839603542 + .long 3222378369 + .long 0 + .long 1071644672 + .long 0 + .long 3220701184 + .long 2099420460 + .long 1070000514 + .long 2802853043 + .long 1014611496 + .long 1293201774 + .long 3216758446 + .long 754100791 + .long 3161260779 + .long 446218444 + .long 1068516350 + .long 4119686598 + .long 1008896294 + .long 464017249 + .long 3215087878 + .long 960597079 + .long 3159504610 + .long 785622302 + .long 1066666444 + .long 3339954945 + .long 1008950591 + .long 2636124640 + .long 3213180396 + .long 2995891561 + .long 3157221870 + .long 742584182 + .long 1064691513 + .long 2101069570 + .long 3211133521 + .long 2181624698 + .long 1062573543 + .long 880779555 + .long 3208950245 + .long 3229614298 + .long 1060332156 + .long 2776250631 + .long 3206681158 + .long 1726624674 + .long 1057845172 + .long 2932756839 + .long 3204700218 + .long 968482455 + .long 3200538336 + .long 839487434 + .long 3203407115 + .long 0 + .long 1071644672 + .long 0 + .long 3220701184 + .long 2099420460 + .long 1070000514 + .long 3971839787 + .long 1014611494 + .long 1293201774 + .long 3216758446 + .long 1164040504 + .long 3161242013 + .long 446218443 + .long 1068516350 + .long 752423430 + .long 1013624741 + .long 464016831 + .long 3215087878 + .long 1037460728 + .long 3159893622 + .long 785625671 + .long 1066666444 + .long 2777520670 + .long 1010462846 + .long 2633474472 + .long 3213180396 + .long 224500896 + .long 3158129422 + .long 768707698 + .long 1064691513 + .long 3292721506 + .long 3211133520 + .long 578140564 + .long 1062573549 + .long 2030948072 + .long 3208950024 + .long 703221627 + .long 1060333354 + .long 3302679767 + .long 3206661604 + .long 1902201635 + .long 1057974954 + .long 4048348141 + .long 3204024333 + .long 436255103 + .long 1054912980 + .long 2856127569 + .long 3199800416 + .long 0 + .long 1069547520 + .long 0 + .long 3219390464 + .long 2660514860 + .long 1069307683 + .long 3910050887 + .long 1010798723 + .long 1232972210 + .long 3217414211 + .long 3319476861 + .long 3162069233 + .long 728349866 + .long 1070632184 + .long 2957516014 + .long 1014996223 + .long 2614894425 + .long 3218648001 + .long 3908389506 + .long 3161696982 + .long 2191212410 + .long 1071782386 + .long 2431020086 + .long 1016759180 + .long 3218723210 + .long 3219794568 + .long 3000611168 + .long 3164060285 + .long 3635880648 + .long 1072866249 + .long 536114836 + .long 3220846078 + .long 772319782 + .long 1073876386 + .long 455323837 + .long 3221871435 + .long 2867783196 + .long 1074413781 + .long 2591697711 + .long 3223680483 + .long 3707131585 + .long 3224082365 + .long 1191412344 + .long 3226597368 + .long 26961465 + .long 3227158611 + .long 3399174677 + .long 3227576866 + .long 0 + .long 1070596096 + .long 0 + .long 3220701184 + .long 2223626006 + .long 1069006900 + .long 1459366060 + .long 1012973801 + .long 1839010552 + .long 3215906806 + .long 2068820260 + .long 3160057563 + .long 1249919926 + .long 1067698038 + .long 962503917 + .long 1012536115 + .long 2100991944 + .long 3214479466 + .long 3825857555 + .long 3158728160 + .long 2359368913 + .long 1066362061 + .long 743880428 + .long 1009085061 + .long 1096261871 + .long 3213062353 + .long 3975107283 + .long 3156829710 + .long 3079668469 + .long 1064816845 + .long 1037052812 + .long 3211583355 + .long 3759245614 + .long 1063340491 + .long 3200735738 + .long 3210008934 + .long 4161299971 + .long 1061559762 + .long 2934206128 + .long 3208900975 + .long 3971101203 + .long 3206549768 + .long 353687358 + .long 3209069242 + .long 3047695518 + .long 3208432442 + .long 3851119497 + .long 3207872727 + .long 0 + .long 1070596096 + .long 0 + .long 3220701184 + .long 2223626017 + .long 1069006900 + .long 1388676355 + .long 1012705760 + .long 1839008253 + .long 3215906806 + .long 815236617 + .long 3160082992 + .long 1250030689 + .long 1067698038 + .long 1288166708 + .long 1012882161 + .long 2094505532 + .long 3214479466 + .long 311037013 + .long 3156914212 + .long 2617751546 + .long 1066362061 + .long 2536920761 + .long 1010241475 + .long 1679260317 + .long 3213062352 + .long 3392965897 + .long 3157018830 + .long 1054244789 + .long 1064816864 + .long 3966408696 + .long 3211583052 + .long 1854848819 + .long 1063342388 + .long 3813743082 + .long 3209990587 + .long 395181184 + .long 1061696008 + .long 2456810233 + .long 3208392808 + .long 4089464644 + .long 1060125482 + .long 3698050549 + .long 3206684252 + .long 1112347086 + .long 1058131030 + .long 218099662 + .long 3203798608 + .long 0 + .long 1068498944 + .long 0 + .long 3219390464 + .long 525966855 + .long 1068285571 + .long 2606587153 + .long 1012297682 + .long 2443413391 + .long 3216426332 + .long 691043050 + .long 3159699549 + .long 1829248673 + .long 1069675485 + .long 797308607 + .long 1013894531 + .long 2897861001 + .long 3217829064 + .long 3729653017 + .long 3162035037 + .long 3517114205 + .long 1070988945 + .long 2096268315 + .long 1015157641 + .long 733746641 + .long 3219206769 + .long 2776288224 + .long 3161354348 + .long 312049674 + .long 1072253264 + .long 1779010374 + .long 3220866352 + .long 3398525311 + .long 3220286121 + .long 3932053403 + .long 3224771363 + .long 2526572080 + .long 3226863609 + .long 1052531014 + .long 3228950632 + .long 1237705257 + .long 3230476352 + .long 1818683855 + .long 3231504084 + .long 2771211543 + .long 3231812491 + .long 1784201120 + .long 3231087810 + .long 0 + .long 1069547520 + .long 0 + .long 3220701184 + .long 3317774106 + .long 1067973958 + .long 2923167300 + .long 1012645752 + .long 3241173892 + .long 3214918775 + .long 39491139 + .long 3156995939 + .long 285395131 + .long 1066727038 + .long 2541426776 + .long 1010932663 + .long 1226100891 + .long 3213595410 + .long 1495613600 + .long 3157951728 + .long 3870275689 + .long 1065488829 + .long 965710822 + .long 1009822465 + .long 3492316846 + .long 3212293408 + .long 2517483522 + .long 3156957513 + .long 1374076994 + .long 1064156941 + .long 372497316 + .long 3211297712 + .long 3813845480 + .long 3208055775 + .long 3900585526 + .long 3212419165 + .long 1960133516 + .long 3213181643 + .long 148017317 + .long 3214056684 + .long 3471465381 + .long 3214242476 + .long 65590178 + .long 3214048451 + .long 3138884841 + .long 3213067513 + .long 2557226666 + .long 3211122744 + .long 0 + .long 1069547520 + .long 0 + .long 3220701184 + .long 3319825997 + .long 1067973958 + .long 153387004 + .long 1010340046 + .long 3027068505 + .long 3214918775 + .long 2440895001 + .long 3158659807 + .long 1195164920 + .long 1066727039 + .long 1739223825 + .long 1010932951 + .long 3681176633 + .long 3213595373 + .long 2468586085 + .long 3156977493 + .long 2873291842 + .long 1065489208 + .long 1357898154 + .long 1010449195 + .long 449207067 + .long 3212287634 + .long 1843054170 + .long 3156472137 + .long 1688975421 + .long 1064223666 + .long 2606145257 + .long 3210999965 + .long 2843228885 + .long 1062852799 + .long 3218505005 + .long 3209735220 + .long 2000171025 + .long 1061515619 + .long 2480760959 + .long 3208347934 + .long 1915328357 + .long 1060202094 + .long 619623839 + .long 3207101805 + .long 3877388623 + .long 1057814602 + .long 1403207699 + .long 3206847388 + .long 0 + .long 1069547520 + .long 0 + .long 3220701184 + .long 3319825996 + .long 1067973958 + .long 2025830981 + .long 1009198696 + .long 3027068262 + .long 3214918775 + .long 462574407 + .long 3158874537 + .long 1195152753 + .long 1066727039 + .long 2026642833 + .long 1010473176 + .long 3680441114 + .long 3213595373 + .long 1280116659 + .long 3154901898 + .long 2858263562 + .long 1065489208 + .long 3653419668 + .long 1010119659 + .long 8491235 + .long 3212287634 + .long 2006410862 + .long 3152308929 + .long 669193667 + .long 1064223664 + .long 261358851 + .long 3210999947 + .long 3798337047 + .long 1062852562 + .long 3252853818 + .long 3209734051 + .long 2986380320 + .long 1061506613 + .long 2271475836 + .long 3208293716 + .long 4121652893 + .long 1060072878 + .long 1033391529 + .long 3206544683 + .long 472144880 + .long 1057491226 + .long 2996742642 + .long 3202556481 + .long 0 + .long 1067450368 + .long 0 + .long 3219390464 + .long 2310440956 + .long 1067243964 + .long 1910839802 + .long 1011085066 + .long 3231655782 + .long 3215394280 + .long 67697416 + .long 3158533143 + .long 747798972 + .long 1068652953 + .long 3842674820 + .long 1013874752 + .long 2960203073 + .long 3216848639 + .long 2643975567 + .long 3156914699 + .long 3514791177 + .long 1070021174 + .long 3133960404 + .long 1013937886 + .long 2900718461 + .long 3218240252 + .long 1762535320 + .long 3161495508 + .long 3933388189 + .long 1071460247 + .long 1623401109 + .long 3219631106 + .long 2243580782 + .long 1072656900 + .long 3113530625 + .long 3221833507 + .long 4278270359 + .long 3222733868 + .long 4152511010 + .long 3225895261 + .long 1448809675 + .long 3227655974 + .long 2046900051 + .long 3229157102 + .long 4134264961 + .long 3229841799 + .long 2742521525 + .long 3229722239 + .long 0 + .long 1068498944 + .long 0 + .long 3220701184 + .long 2295541704 + .long 1066929438 + .long 3837869256 + .long 1002512271 + .long 2403525199 + .long 3213885862 + .long 3057254264 + .long 3152556454 + .long 1273180940 + .long 1065699684 + .long 307148135 + .long 1007267775 + .long 4108180605 + .long 3212593363 + .long 867507169 + .long 3154906335 + .long 2406587489 + .long 1064486498 + .long 3600962311 + .long 1007048784 + .long 641070000 + .long 3211323670 + .long 942137894 + .long 3155422437 + .long 471088535 + .long 1063286275 + .long 3784803533 + .long 3210106468 + .long 2056014570 + .long 1061725436 + .long 975828111 + .long 3209750570 + .long 3879370210 + .long 3209336425 + .long 2803950026 + .long 3211135338 + .long 606260247 + .long 3211577897 + .long 1881144158 + .long 3211825519 + .long 670638336 + .long 3211103480 + .long 2138776162 + .long 3209709388 + .long 0 + .long 1068498944 + .long 0 + .long 3220701184 + .long 2295580191 + .long 1066929438 + .long 3681200523 + .long 1011869447 + .long 2400932937 + .long 3213885862 + .long 1282261590 + .long 3155177332 + .long 1435460813 + .long 1065699684 + .long 338806164 + .long 1009895735 + .long 2137816334 + .long 3212593362 + .long 2795067653 + .long 3156177866 + .long 4261873090 + .long 1064486517 + .long 3264144757 + .long 1007933656 + .long 2173718924 + .long 3211323291 + .long 3810711629 + .long 3155704795 + .long 2446322575 + .long 1063289064 + .long 2077064354 + .long 3210074792 + .long 504970137 + .long 1062005301 + .long 3765139549 + .long 3208846522 + .long 2079001974 + .long 1060716176 + .long 875759584 + .long 3207637152 + .long 4108525622 + .long 1059452531 + .long 4049318739 + .long 3206336314 + .long 3770858801 + .long 1058237468 + .long 2722340464 + .long 3205374723 + .long 0 + .long 1068498944 + .long 0 + .long 3220701184 + .long 2295580191 + .long 1066929438 + .long 2149023882 + .long 1011305144 + .long 2400932909 + .long 3213885862 + .long 1064137805 + .long 3156227957 + .long 1435458098 + .long 1065699684 + .long 4263810407 + .long 1007587847 + .long 2137652297 + .long 3212593362 + .long 1479815673 + .long 3155856170 + .long 4258425849 + .long 1064486517 + .long 3605379165 + .long 1009762642 + .long 2066788283 + .long 3211323291 + .long 3198576201 + .long 3153399561 + .long 1179383574 + .long 1063289064 + .long 140008546 + .long 3210074787 + .long 2930072161 + .long 1062005221 + .long 1129148062 + .long 3208846064 + .long 3175174977 + .long 1060711976 + .long 382350984 + .long 3207621985 + .long 3891461581 + .long 1059368087 + .long 1514607567 + .long 3205983602 + .long 292029317 + .long 1057267187 + .long 906505364 + .long 3202625257 + .long 0 + .long 1071644672 + .long 1431652600 + .long 1069897045 + .long 1431670732 + .long 1067799893 + .long 984555731 + .long 1065423122 + .long 472530941 + .long 1062650218 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 939524096 + .long 1072704666 + .long 2209988083 + .long 1046076929 + .long 3489660928 + .long 1072716208 + .long 2715237930 + .long 1044950059 + .long 402653184 + .long 1072727877 + .long 36755401 + .long 1042114290 + .long 1744830464 + .long 1072739672 + .long 1032479461 + .long 1045685796 + .long 805306368 + .long 1072751596 + .long 269498903 + .long 1044815501 + .long 3489660928 + .long 1072763649 + .long 2766913307 + .long 1039293264 + .long 2818572288 + .long 1072775834 + .long 2127365126 + .long 1046127799 + .long 939524096 + .long 1072788152 + .long 3950214642 + .long 1045558597 + .long 3892314112 + .long 1072800603 + .long 2850403528 + .long 1045134939 + .long 805306368 + .long 1072813191 + .long 2810207104 + .long 1043762074 + .long 2281701376 + .long 1072825915 + .long 2397289153 + .long 1041802037 + .long 1744830464 + .long 1072838778 + .long 3785033707 + .long 1046074760 + .long 1610612736 + .long 1072851781 + .long 1955981725 + .long 1045924339 + .long 4026531840 + .long 1072864925 + .long 2226165573 + .long 1045725051 + .long 2684354560 + .long 1072878213 + .long 754984053 + .long 1046188044 + .long 134217728 + .long 1072891646 + .long 2842642093 + .long 1044483512 + .long 2952790016 + .long 1072905224 + .long 4200916017 + .long 1044586679 + .long 805306368 + .long 1072918951 + .long 714887508 + .long 1046276775 + .long 805306368 + .long 1072932827 + .long 3685248805 + .long 1045665407 + .long 1207959552 + .long 1072946854 + .long 2295779401 + .long 1045448912 + .long 536870912 + .long 1072961034 + .long 2676240988 + .long 1044345570 + .long 1610612736 + .long 1072975368 + .long 1086643152 + .long 1041785419 + .long 2952790016 + .long 1072989858 + .long 1078920847 + .long 1045890291 + .long 3489660928 + .long 1073004506 + .long 2624917087 + .long 1045747880 + .long 1879048192 + .long 1073019314 + .long 2595540835 + .long 1046115506 + .long 1342177280 + .long 1073034283 + .long 125577743 + .long 1046115646 + .long 805306368 + .long 1073049415 + .long 1771811520 + .long 1046140063 + .long 3623878656 + .long 1073064711 + .long 2774738112 + .long 1045766480 + .long 268435456 + .long 1073080175 + .long 565866387 + .long 1045869701 + .long 2952790016 + .long 1073095806 + .long 1492679939 + .long 1041050306 + .long 2147483648 + .long 1073111608 + .long 612974287 + .long 1044556049 + .long 1610612736 + .long 1073127582 + .long 843197631 + .long 1046084847 + .long 939524096 + .long 1073143730 + .long 3150480267 + .long 1045533800 + .long 3892314112 + .long 1073160053 + .long 2074373662 + .long 1043172334 + .long 1342177280 + .long 1073176555 + .long 587053675 + .long 1046022559 + .long 1879048192 + .long 1073193236 + .long 918464641 + .long 1045387276 + .long 805306368 + .long 1073210099 + .long 2285990923 + .long 1046166841 + .long 2550136832 + .long 1073227145 + .long 682424459 + .long 1043647713 + .long 2550136832 + .long 1073244377 + .long 1678188781 + .long 1045046423 + .long 1073741824 + .long 1073261797 + .long 3671932459 + .long 1044468998 + .long 2550136832 + .long 1073279406 + .long 1656324724 + .long 1043421043 + .long 2952790016 + .long 1073297207 + .long 2659845000 + .long 1042921660 + .long 2550136832 + .long 1073315202 + .long 1043233352 + .long 1046444345 + .long 2147483648 + .long 1073333393 + .long 2162418230 + .long 1044717444 + .long 2013265920 + .long 1073351782 + .long 630511316 + .long 1045098283 + .long 2952790016 + .long 1073370371 + .long 3831108133 + .long 1044508970 + .long 1342177280 + .long 1073389163 + .long 4245662865 + .long 1045817334 + .long 2550136832 + .long 1073408159 + .long 3588780877 + .long 1043705146 + .long 3087007744 + .long 1073427362 + .long 3182425146 + .long 1041483134 + .long 4026531840 + .long 1073446774 + .long 928333188 + .long 1044896498 + .long 2415919104 + .long 1073466398 + .long 2300504125 + .long 1041428596 + .long 3623878656 + .long 1073486235 + .long 1887994668 + .long 1045828938 + .long 671088640 + .long 1073506289 + .long 757630176 + .long 1046044485 + .long 3623878656 + .long 1073526560 + .long 2756972335 + .long 1045675585 + .long 1207959552 + .long 1073547053 + .long 3697834264 + .long 1044397131 + .long 3623878656 + .long 1073567768 + .long 479684631 + .long 1045687954 + .long 0 + .long 1073588710 + .long 730095629 + .long 1045354900 + .long 805306368 + .long 1073609879 + .long 4123739734 + .long 1045159130 + .long 3758096384 + .long 1073631278 + .long 3634164812 + .long 1046359295 + .long 2684354560 + .long 1073652911 + .long 3425467293 + .long 1044718726 + .long 3892314112 + .long 1073674779 + .long 2648473416 + .long 1046054248 + .long 1476395008 + .long 1073696886 + .long 54164518 + .long 1045131818 + .long 2147483648 + .long 1073719233 + .long 2196310654 + .long 1043982605 + .long 4277796864 + .long 1065758274 + .long 3164486458 + .long 1025308570 + .long 1697350398 + .long 1079448903 + .long 0 + .long 862978048 + .long 0 + .long 1127743488 + .long 33554432 + .long 1101004800 + .long 0 + .long 0 + .long 1 + .long 1048576 + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 0 + .long 1073741824 + .long 1105497085 + .long 1077623260 + .long 261899793 + .long 1077588746 + .long 4235085970 + .long 1077578514 + .long 2406803786 + .long 3222762575 + .type _vmldErfcHATab,@object + .size _vmldErfcHATab,5024 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/erfcf.S b/external/sgx_libm/intel64/erfcf.S new file mode 100644 index 0000000000..b6655001b7 --- /dev/null +++ b/external/sgx_libm/intel64/erfcf.S @@ -0,0 +1,705 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfcf.c" + .text +..TXTST0: +# -- Begin erfcf + .text + .align 16,0x90 + .globl erfcf +erfcf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_erfcf.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + subq $32, %rsp + .cfi_def_cfa_offset 48 + movd %xmm0, %r14d + movss %xmm0, 16(%rsp) + movl %r14d, %ecx + andl $2147483647, %ecx + shrl $31, %r14d + cmpl $2139095040, %ecx + jae ..B1.24 +..B1.2: + movl %r14d, %eax + lea range(%rip), %rdx + cmpl (%rdx,%rax,4), %ecx + jae ..B1.21 +..B1.3: + cmpl $1081081856, %ecx + jae ..B1.15 +..B1.4: + cmpl $1073741824, %ecx + jae ..B1.11 +..B1.5: + cmpl $1056964608, %ecx + jae ..B1.10 +..B1.6: + cmpl $847249408, %ecx + jae ..B1.8 +..B1.7: + movss .L_2il0floatpacket.3(%rip), %xmm4 + subss %xmm0, %xmm4 + jmp ..B1.9 +..B1.8: + cvtss2sd %xmm0, %xmm0 + movaps %xmm0, %xmm1 + lea 40+_A(%rip), %rax + lea 48+_A(%rip), %rsi + lea 24+_A(%rip), %rdx + lea 32+_A(%rip), %rdi + lea 8+_A(%rip), %rcx + lea 16+_A(%rip), %r8 + lea _A(%rip), %r9 + movsd (%rax), %xmm4 + movsd (%rsi), %xmm3 + mulsd %xmm0, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd (%rdx), %xmm4 + addsd (%rdi), %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm3 + addsd (%rcx), %xmm4 + addsd (%r8), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm4 + addsd (%r9), %xmm3 + addsd .L_2il0floatpacket.4(%rip), %xmm4 + mulsd %xmm0, %xmm3 + addsd %xmm3, %xmm4 + cvtsd2ss %xmm4, %xmm4 +..B1.9: + movaps %xmm4, %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.10: + pxor %xmm1, %xmm1 + lea 48+_AP(%rip), %rdx + cvtss2sd 16(%rsp), %xmm1 + andps .L_2il0floatpacket.5(%rip), %xmm1 + lea 32+_AP(%rip), %rcx + movsd (%rdx), %xmm6 + lea 16+_AP(%rip), %rsi + lea _AP(%rip), %rdi + lea 56+_AP(%rip), %r8 + lea 48+_AQ(%rip), %r14 + lea 40+_AP(%rip), %r9 + lea 32+_AQ(%rip), %rdx + lea 24+_AP(%rip), %r10 + lea 8+_AP(%rip), %r11 + pxor %xmm5, %xmm5 + movsd (%r8), %xmm2 + lea 40+_AQ(%rip), %r8 + movsd (%r14), %xmm4 + lea _erfc1(%rip), %r14 + subsd .L_2il0floatpacket.4(%rip), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + mulsd %xmm0, %xmm6 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm4 + addsd (%rcx), %xmm6 + addsd (%r9), %xmm2 + addsd (%rdx), %xmm4 + mulsd %xmm0, %xmm6 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm4 + addsd (%rsi), %xmm6 + addsd (%r10), %xmm2 + mulsd %xmm0, %xmm6 + mulsd %xmm0, %xmm2 + addsd (%rdi), %xmm6 + addsd (%r11), %xmm2 + lea 56+_AQ(%rip), %rdi + lea 24+_AQ(%rip), %r9 + lea 16+_AQ(%rip), %rcx + lea 8+_AQ(%rip), %r10 + lea _AQ(%rip), %rsi + lea _ones(%rip), %r11 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm4 + cvtss2sd (%r11,%rax,4), %xmm5 + addsd %xmm2, %xmm6 + mulsd %xmm0, %xmm4 + movsd (%rdi), %xmm3 + mulsd %xmm0, %xmm3 + addsd (%rsi), %xmm4 + addsd (%r8), %xmm3 + mulsd %xmm0, %xmm3 + addsd (%r9), %xmm3 + mulsd %xmm0, %xmm3 + addsd (%r10), %xmm3 + mulsd %xmm1, %xmm3 + addsd %xmm3, %xmm4 + divsd %xmm4, %xmm6 + mulsd %xmm5, %xmm6 + addsd (%r14,%rax,8), %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.11: + pxor %xmm1, %xmm1 + testl %r14d, %r14d + cvtss2sd 16(%rsp), %xmm1 + andps .L_2il0floatpacket.5(%rip), %xmm1 + addsd .L_2il0floatpacket.2(%rip), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + je ..B1.13 +..B1.12: + lea 48+_BP1(%rip), %rdx + lea 32+_BP1(%rip), %rcx + lea 16+_BP1(%rip), %rsi + lea 40+_BP1(%rip), %r8 + lea 48+_BQ1(%rip), %r11 + lea 32+_BQ1(%rip), %r14 + lea _BP1(%rip), %rdi + lea 24+_BP1(%rip), %r9 + movsd (%rdx), %xmm5 + lea 16+_BQ1(%rip), %rdx + movsd (%r8), %xmm2 + lea 8+_BP1(%rip), %r10 + movsd (%r11), %xmm4 + lea 8+_BQ1(%rip), %r8 + mulsd %xmm0, %xmm5 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd (%rcx), %xmm5 + addsd (%r14), %xmm4 + addsd (%r9), %xmm2 + mulsd %xmm0, %xmm5 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd (%rsi), %xmm5 + addsd (%rdx), %xmm4 + addsd (%r10), %xmm2 + mulsd %xmm0, %xmm5 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + addsd (%rdi), %xmm5 + lea 40+_BQ1(%rip), %rsi + lea 24+_BQ1(%rip), %rdi + lea _BQ1(%rip), %rcx + movsd (%rsi), %xmm3 + mulsd %xmm0, %xmm3 + addsd (%rcx), %xmm4 + addsd (%rdi), %xmm3 + mulsd %xmm0, %xmm3 + addsd (%r8), %xmm3 + mulsd %xmm1, %xmm3 + jmp ..B1.14 +..B1.13: + lea 80+_BP2(%rip), %rdx + lea 64+_BP2(%rip), %rcx + lea 88+_BP2(%rip), %r10 + lea 48+_BP2(%rip), %rsi + lea 72+_BP2(%rip), %r11 + lea 32+_BP2(%rip), %rdi + lea 56+_BP2(%rip), %r14 + lea 16+_BP2(%rip), %r8 + movsd (%rdx), %xmm5 + lea 40+_BP2(%rip), %rdx + mulsd %xmm0, %xmm5 + lea _BP2(%rip), %r9 + movsd (%r10), %xmm2 + lea 16+_BQ2(%rip), %r10 + mulsd %xmm0, %xmm2 + addsd (%rcx), %xmm5 + mulsd %xmm0, %xmm5 + addsd (%r11), %xmm2 + mulsd %xmm0, %xmm2 + addsd (%rsi), %xmm5 + mulsd %xmm0, %xmm5 + addsd (%r14), %xmm2 + lea 56+_BQ2(%rip), %r14 + addsd (%rdi), %xmm5 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm5 + addsd (%rdx), %xmm2 + addsd (%r8), %xmm5 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm5 + lea 64+_BQ2(%rip), %rdi + lea 48+_BQ2(%rip), %r8 + movsd (%r14), %xmm3 + lea 40+_BQ2(%rip), %rdx + lea 24+_BP2(%rip), %rcx + lea 8+_BP2(%rip), %rsi + mulsd %xmm0, %xmm3 + addsd (%r9), %xmm5 + addsd (%rcx), %xmm2 + addsd (%rdx), %xmm3 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm3 + addsd (%rsi), %xmm2 + movsd (%rdi), %xmm4 + lea 32+_BQ2(%rip), %r9 + lea 24+_BQ2(%rip), %rcx + lea 8+_BQ2(%rip), %rsi + lea _BQ2(%rip), %r11 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm3 + addsd (%r8), %xmm4 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm4 + addsd (%rsi), %xmm3 + addsd (%r9), %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm0, %xmm4 + addsd (%r10), %xmm4 + mulsd %xmm0, %xmm4 + addsd (%r11), %xmm4 +..B1.14: + lea _ones(%rip), %rdx + pxor %xmm0, %xmm0 + lea _erfc4(%rip), %rcx + addsd %xmm2, %xmm5 + addsd %xmm3, %xmm4 + cvtss2sd (%rdx,%rax,4), %xmm0 + divsd %xmm4, %xmm5 + mulsd %xmm0, %xmm5 + addsd (%rcx,%rax,8), %xmm5 + cvtsd2ss %xmm5, %xmm5 + movaps %xmm5, %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.15: + pxor %xmm0, %xmm0 + cvtss2sd 16(%rsp), %xmm0 + andps .L_2il0floatpacket.5(%rip), %xmm0 + movsd .L_2il0floatpacket.4(%rip), %xmm1 + divsd %xmm0, %xmm1 + mulsd %xmm0, %xmm0 + xorps .L_2il0floatpacket.6(%rip), %xmm0 + movsd %xmm1, 8(%rsp) +..___tag_value_erfcf.21: + call __libm_exp_k32@PLT +..___tag_value_erfcf.22: +..B1.32: + movaps %xmm0, %xmm4 +..B1.16: + movsd 8(%rsp), %xmm0 + lea 56+__R1(%rip), %rax + mulsd %xmm0, %xmm4 + lea 48+__R1(%rip), %rdi + mulsd %xmm0, %xmm0 + movaps %xmm0, %xmm1 + lea 40+__R1(%rip), %rdx + mulsd %xmm0, %xmm1 + lea 32+__R1(%rip), %r8 + movsd (%rax), %xmm3 + lea 24+__R1(%rip), %rcx + mulsd %xmm1, %xmm3 + lea 16+__R1(%rip), %r9 + movsd (%rdi), %xmm2 + lea 8+__R1(%rip), %rsi + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm3 + mulsd %xmm1, %xmm3 + addsd (%r8), %xmm2 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm3 + mulsd %xmm1, %xmm3 + addsd (%r9), %xmm2 + mulsd %xmm1, %xmm2 + addsd (%rsi), %xmm3 + lea __R1(%rip), %r10 + testl %r14d, %r14d + mulsd %xmm0, %xmm3 + addsd (%r10), %xmm2 + addsd %xmm2, %xmm3 + mulsd %xmm3, %xmm4 + cvtsd2ss %xmm4, %xmm4 + jne ..B1.20 +..B1.17: + movd %xmm4, %eax + movss %xmm4, 4(%rsp) + cmpl $8388608, %eax + jl ..B1.28 +..B1.19: + movaps %xmm4, %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.20: + movss .L_2il0floatpacket.0(%rip), %xmm0 + subss %xmm4, %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.21: + testl %r14d, %r14d + je ..B1.29 +..B1.22: + movss .L_2il0floatpacket.0(%rip), %xmm0 +..B1.23: + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.24: + jne ..B1.26 +..B1.25: + lea zero_two(%rip), %rax + movss (%rax,%r14,4), %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.26: + movss 16(%rsp), %xmm0 +..B1.27: + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 14, -16 +..B1.28: + movss .L_2il0floatpacket.1(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + movss 4(%rsp), %xmm4 + jmp ..B1.19 +..B1.29: + movss .L_2il0floatpacket.1(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, 4(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type erfcf,@function + .size erfcf,.-erfcf + .data +# -- End erfcf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.5: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +.L_2il0floatpacket.6: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0xc0000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x40000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x0d800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x3f800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +range: + .long 1092825907 + .long 1081791557 + .type range,@object + .size range,8 + .align 4 +_A: + .long 1346541978 + .long 3220311511 + .long 1794662342 + .long 1071125108 + .long 250944106 + .long 3216827122 + .long 215131671 + .long 1067156170 + .long 548330146 + .long 3212141823 + .long 76350191 + .long 1061937114 + .long 2772654316 + .long 3206307213 + .type _A,@object + .size _A,56 + .align 4 +_AP: + .long 4064916629 + .long 3190878451 + .long 2877165718 + .long 3218164236 + .long 2764139057 + .long 1068232842 + .long 168293639 + .long 3215329394 + .long 881203975 + .long 3215292554 + .long 342818617 + .long 1065638313 + .long 817546319 + .long 3212004140 + .long 1510911299 + .long 3202390104 + .type _AP,@object + .size _AP,64 + .align 4 +_AQ: + .long 1883560946 + .long 1071960885 + .long 853592313 + .long 1071685196 + .long 191605458 + .long 1071250674 + .long 2183121159 + .long 1070390698 + .long 3347411101 + .long 1068928985 + .long 273856425 + .long 1067608207 + .long 671820230 + .long 1065177551 + .long 2414119437 + .long 1063328696 + .type _AQ,@object + .size _AQ,64 + .align 4 +_erfc1: + .long 1879048192 + .long 1069818465 + .long 3523215360 + .long 1073576883 + .type _erfc1,@object + .size _erfc1,16 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_BP1: + .long 4019088381 + .long 1060143686 + .long 4231883845 + .long 3209038463 + .long 1510730124 + .long 1061755778 + .long 2929202078 + .long 3208591153 + .long 1409179897 + .long 1059475758 + .long 439372548 + .long 3204538649 + .long 3357266387 + .long 1053229132 + .type _BP1,@object + .size _BP1,56 + .align 4 +_BQ1: + .long 3444570556 + .long 1068208773 + .long 4145425017 + .long 1069029647 + .long 1145740212 + .long 1069192522 + .long 2413502193 + .long 1068797491 + .long 2712383784 + .long 1068007659 + .long 3941762314 + .long 1066743858 + .long 3272105283 + .long 1065447630 + .type _BQ1,@object + .size _BQ1,56 + .align 4 +_BP2: + .long 3138848853 + .long 1062211012 + .long 544119287 + .long 3211644465 + .long 2662071917 + .long 1064935492 + .long 2106254088 + .long 3212505578 + .long 377059754 + .long 1064517936 + .long 3523110848 + .long 3210978388 + .long 64932799 + .long 1062023575 + .long 2232373525 + .long 3207568747 + .long 3004568351 + .long 1057518327 + .long 1553969795 + .long 3201939481 + .long 865068135 + .long 1050709866 + .long 348213498 + .long 3193161330 + .type _BP2,@object + .size _BP2,96 + .align 4 +_BQ2: + .long 2220299070 + .long 1070256111 + .long 1607355279 + .long 1069737707 + .long 3222185356 + .long 1069664669 + .long 1988590515 + .long 1068489586 + .long 2612211906 + .long 1067468794 + .long 3802943557 + .long 1065572613 + .long 4286646379 + .long 1063895282 + .long 45248763 + .long 1061257684 + .long 3494068347 + .long 1058887001 + .type _BQ2,@object + .size _BQ2,72 + .align 4 +_erfc4: + .long 0 + .long 1045463040 + .long 4225761280 + .long 1073741823 + .type _erfc4,@object + .size _erfc4,16 + .align 4 +__R1: + .long 1340517714 + .long 1071779287 + .long 1760660317 + .long 3218214358 + .long 3277598851 + .long 1071322187 + .long 1776282588 + .long 3220235438 + .long 2229586924 + .long 1074588991 + .long 2042215417 + .long 3224150558 + .long 1374528972 + .long 1078534706 + .long 1825320511 + .long 3227067102 + .type __R1,@object + .size __R1,64 + .align 4 +zero_two: + .long 0x00000000 + .long 0x40000000 + .type zero_two,@object + .size zero_two,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/erfcl.S b/external/sgx_libm/intel64/erfcl.S new file mode 100644 index 0000000000..c744e4c648 --- /dev/null +++ b/external/sgx_libm/intel64/erfcl.S @@ -0,0 +1,4944 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfcl.c" + .text +..TXTST0: +# -- Begin erfcl + .text + .align 16,0x90 + .globl erfcl +erfcl: +# parameter 1: 208 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_erfcl.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + subq $168, %rsp + .cfi_def_cfa_offset 208 + xorb %r15b, %r15b + fldt 208(%rsp) + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 160(%rsp) + fstpt 64(%rsp) +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.5: + fldcw 80(%rsp) +..B1.6: + movb $1, %r15b +..B1.7: + movl 216(%rsp), %eax + movl %eax, %r14d + shrl $15, %r14d + andl $32767, %eax + andl $1, %r14d + cmpl $32767, %eax + je ..B1.56 +..B1.8: + fldt 208(%rsp) + lea _zeros(%rip), %rax + fldl (%rax) + fucomip %st(1), %st + jp ..B1.9 + je ..B1.51 +..B1.9: + lea _erfcl_RT1(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + ja ..B1.15 + jp ..B1.15 +..B1.10: + lea 16+_erfcl_RT1(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + jb ..B1.15 +..B1.11: + fstp %st(0) + lea _Epsilon(%rip), %rax + lea _ones(%rip), %rdx + testb %r15b, %r15b + fldt (%rax) + fsubrl (%rdx) + fstpt 16(%rsp) + je ..B1.13 +..B1.12: + fldcw 82(%rsp) +..B1.13: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.14: + addq $168, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.15: + lea 8+_erfcl_ASYMPT(%rip), %rax + fldl (%rax) + fcomip %st(1), %st + jb ..B1.46 +..B1.16: + lea _erfcl_ASYMPT(%rip), %rax + fldl (%rax) + fcomip %st(1), %st + fstp %st(0) + jp ..B1.17 + jbe ..B1.21 +..B1.17: + fldt .L_2il0floatpacket.0(%rip) + lea _Epsilon(%rip), %rax + testb %r15b, %r15b + fldt (%rax) + fsubrp %st, %st(1) + fstpt 16(%rsp) + je ..B1.19 +..B1.18: + fldcw 82(%rsp) +..B1.19: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.20: + addq $168, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.21: + fldt .L_2il0floatpacket.1(%rip) + lea _ones(%rip), %r13 + andl $32767, 72(%rsp) + lea 128(%rsp), %rdi + fldt -64(%rdi) + lea 96(%rsp), %rsi + fmul %st, %st(1) + fld %st(0) + fld %st(1) + fsub %st(3), %st + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fchs + fstpt (%rsi) + fld %st(1) + fsub %st(3), %st + fmul %st, %st(3) + fxch %st(3) + fchs + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + fstpt 16(%rsi) + fldl (%r13) + fstpt -80(%rsi) + fldt -80(%rsi) + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fstpt -64(%rsi) + movl -56(%rsi), %r13d + andl $32767, %r13d + addq $-16383, %r13 + movl %r13d, %ebx + shll $4, %ebx + movslq %ebx, %rbx + shlq $4, %rbx +..___tag_value_erfcl.40: + call __libm_expl_k80@PLT +..___tag_value_erfcl.41: +..B1.78: + fldt 16(%rsp) +..B1.22: + lea _TWO_63H(%rip), %rax + fldl (%rax) + faddp %st, %st(2) + fxch %st(1) + fstpt 48(%rsp) + movl 48(%rsp), %edx + cmpl $-16300, %edx + fstpt 48(%rsp) + fldt 48(%rsp) + jle ..B1.24 +..B1.23: + fldt 128(%rsp) + addl $16383, %edx + movzwl 56(%rsp), %eax + andl $32767, %edx + andl $-32768, %eax + orl %edx, %eax + movw %ax, 56(%rsp) + lea 144(%rsp), %rax + fldt (%rax) + jmp ..B1.25 +..B1.24: + fldt 128(%rsp) + lea _TWO_POW_M400(%rip), %rsi + movzwl 56(%rsp), %eax + movl %eax, %ecx + andl $-32768, %ecx + fldl (%rsi) + lea 400(%rax,%rdx), %edx + andl $32767, %edx + lea 144(%rsp), %rax + orl %edx, %ecx + movw %cx, -88(%rax) + fmul %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) +..B1.25: + fldt .L_2il0floatpacket.1(%rip) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt (%rax) + fldt (%rax) + lea _erfcl_CHDX(%rip), %rax + fxch %st(1) + fstpt 128(%rsp) + fldt 64(%rsp) + fldt (%rax) + fcomip %st(1), %st + jbe ..B1.27 +..B1.26: + lea _erfcl_DX(%rip), %rax + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fsub %st(1), %st + fadd %st(2), %st + jmp ..B1.28 +..B1.27: + lea 8+_erfcl_DX(%rip), %rax + fld %st(0) + fld %st(1) + fldl (%rax) + fadd %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(1) +..B1.28: + fldt .L_2il0floatpacket.1(%rip) + fld %st(2) + shlq $4, %r13 + lea _erfcl_C(%rip), %rax + lea _erfcl_Q(%rip), %rdx + lea _erfcl_S(%rip), %rcx + testl %r14d, %r14d + fadd %st(2), %st + fdivr %st(6), %st + fmul %st, %st(1) + fxch %st(5) + fstpt 32(%rsp) + fld %st(0) + fadd %st(5), %st + fsubp %st, %st(1) + fsubr %st, %st(4) + fld %st(2) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(4) + fmul %st(2), %st + fld %st(1) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fsub %st(1), %st + fldt .L_2il0floatpacket.0(%rip) + fsub %st(1), %st + fsubp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(2) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(4) + fmul %st(1), %st + fld %st(2) + fmul %st(4), %st + fxch %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(4) + faddp %st, %st(3) + fld %st(0) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldt (%r13,%rax) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fldt 224(%rdx,%rbx) + fmul %st(1), %st + fldt 192(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 160(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 128(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 64(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 32(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx,%rbx) + faddp %st, %st(1) + fldt 240(%rdx,%rbx) + fmul %st(2), %st + fldt 208(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 176(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 144(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 112(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 80(%rdx,%rbx) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48(%rdx,%rbx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 16(%rdx,%rbx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(3) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fldt .L_2il0floatpacket.1(%rip) + fldt (%r13,%rcx) + fmul %st, %st(3) + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(3) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(2) + faddp %st, %st(4) + fldt 16(%rsp) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(5), %st + fldt 32(%rsp) + fmul %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(2) + fld %st(3) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(6), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 48(%rsp) + je ..B1.30 +..B1.29: + fldt .L_2il0floatpacket.0(%rip) + fxch %st(1) + fmul %st, %st(2) + fmulp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fsub %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + fsub %st(2), %st + fsub %st(3), %st + faddp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + jmp ..B1.33 +..B1.30: + fld %st(1) + fadd %st(3), %st + fmul %st(1), %st + fstpt 16(%rsp) + movzwl 24(%rsp), %eax + testl $32767, %eax + jne ..B1.33 +..B1.31: + movzwl 22(%rsp), %eax + testl %eax, %eax + jbe ..B1.33 +..B1.32: + fldt .L_2il0floatpacket.1(%rip) + fmul %st(2), %st + fld %st(2) + fsubr %st(1), %st + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + fadd %st(3), %st + fmul %st(1), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 16(%rsp) +..B1.33: + fstp %st(0) + fstp %st(1) + fstp %st(0) + fldt 208(%rsp) + lea _erfcl_UNDERFLOW_INT(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + jp ..B1.34 + jbe ..B1.41 +..B1.34: + testb %r15b, %r15b + je ..B1.36 +..B1.35: + fldcw 82(%rsp) +..B1.36: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.37: + addq $168, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.38: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.41: + lea _small_value_80(%rip), %rax + testb %r15b, %r15b + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + je ..B1.43 +..B1.42: + fldcw 82(%rsp) +..B1.43: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 + jmp ..B1.14 +..B1.46: + fstp %st(0) + lea _Epsilon(%rip), %rax + testb %r15b, %r15b + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) + je ..B1.48 +..B1.47: + fldcw 82(%rsp) +..B1.48: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 + jmp ..B1.14 +..B1.51: + fstp %st(0) + lea _ones(%rip), %rax + testb %r15b, %r15b + fldl (%rax) + fstpt 16(%rsp) + je ..B1.53 +..B1.52: + fldcw 82(%rsp) +..B1.53: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 + jmp ..B1.14 +..B1.56: + movl 212(%rsp), %eax + testl %r14d, %r14d + jne ..B1.63 +..B1.57: + cmpl $-2147483648, %eax + jne ..B1.69 +..B1.58: + cmpl $0, 208(%rsp) + jne ..B1.69 +..B1.59: + lea _zeros(%rip), %rax + testb %r15b, %r15b + fldl (%rax) + fstpt 16(%rsp) + je ..B1.61 +..B1.60: + fldcw 82(%rsp) +..B1.61: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.62: + addq $168, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.63: + cmpl $-2147483648, %eax + jne ..B1.69 +..B1.64: + cmpl $0, 208(%rsp) + jne ..B1.69 +..B1.65: + fldt .L_2il0floatpacket.0(%rip) + testb %r15b, %r15b + fstpt 16(%rsp) + je ..B1.67 +..B1.66: + fldcw 82(%rsp) +..B1.67: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.68: + addq $168, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -40 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.69: + fldt 208(%rsp) + lea _ones(%rip), %rax + testb %r15b, %r15b + fmull (%rax) + fstpt 16(%rsp) + je ..B1.71 +..B1.70: + fldcw 82(%rsp) +..B1.71: + fldt 16(%rsp) + movq 160(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.38 +..B1.72: + addq $168, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type erfcl,@function + .size erfcl,.-erfcl + .data +# -- End erfcl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_erfcl_ASYMPT: + .long 0 + .long 3222929408 + .long 0 + .long 1079689216 + .type _erfcl_ASYMPT,@object + .size _erfcl_ASYMPT,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_POW_M400: + .long 0 + .long 653262848 + .type _TWO_POW_M400,@object + .size _TWO_POW_M400,8 + .align 4 +_erfcl_DX: + .long 0 + .long 1072431104 + .long 0 + .long 1071906816 + .type _erfcl_DX,@object + .size _erfcl_DX,16 + .align 2 +_erfcl_RT1: + .word 21820 + .word 42875 + .word 50317 + .word 58079 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 21820 + .word 42875 + .word 50317 + .word 58079 + .word 16317 + .word 0 + .word 0 + .word 0 + .type _erfcl_RT1,@object + .size _erfcl_RT1,32 + .align 2 +_Epsilon: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _Epsilon,@object + .size _Epsilon,16 + .align 2 +_erfcl_CHDX: + .word 54762 + .word 44346 + .word 63893 + .word 44681 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _erfcl_CHDX,@object + .size _erfcl_CHDX,16 + .align 2 +_erfcl_C: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50944 + .word 39545 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61184 + .word 35913 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 55108 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 38967 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58112 + .word 52540 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 34340 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 43938 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 55351 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 34462 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 42532 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 52130 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 63543 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 38558 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 46628 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 56226 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63488 + .word 33819 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 40606 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 48676 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 58274 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63488 + .word 34843 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 41630 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 49700 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 59298 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63488 + .word 35355 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 42142 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 50212 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32256 + .word 54690 + .word 16389 + .word 0 + .word 0 + .word 0 + .type _erfcl_C,@object + .size _erfcl_C,448 + .align 2 +_erfcl_Q: + .word 13465 + .word 63964 + .word 23888 + .word 38962 + .word 49066 + .word 0 + .word 0 + .word 0 + .word 56793 + .word 9364 + .word 2074 + .word 60725 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 38094 + .word 52495 + .word 21659 + .word 37955 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 56255 + .word 60659 + .word 19352 + .word 51197 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 38745 + .word 34996 + .word 58130 + .word 47148 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 27061 + .word 31727 + .word 37700 + .word 35458 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 30316 + .word 60982 + .word 15920 + .word 46457 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 52759 + .word 48094 + .word 27926 + .word 54790 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 31704 + .word 15513 + .word 33742 + .word 59335 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 10280 + .word 12123 + .word 40636 + .word 59798 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 55231 + .word 62106 + .word 54809 + .word 56625 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 36666 + .word 22902 + .word 8427 + .word 50746 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 46592 + .word 43726 + .word 50753 + .word 43230 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 64491 + .word 43284 + .word 59259 + .word 34800 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 61229 + .word 19548 + .word 49801 + .word 49926 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 1687 + .word 39069 + .word 16746 + .word 48555 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 55359 + .word 55853 + .word 34963 + .word 33408 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 24851 + .word 44488 + .word 55772 + .word 44700 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 44447 + .word 58130 + .word 38723 + .word 40258 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 1500 + .word 15080 + .word 64595 + .word 34359 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 52078 + .word 14763 + .word 48694 + .word 63117 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 4694 + .word 53159 + .word 65475 + .word 45416 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 37430 + .word 32424 + .word 1930 + .word 56261 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 33679 + .word 45771 + .word 8173 + .word 62515 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 49757 + .word 3681 + .word 5948 + .word 63753 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 9193 + .word 10955 + .word 22026 + .word 60547 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 55541 + .word 20458 + .word 54828 + .word 54096 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 47142 + .word 16345 + .word 20299 + .word 45812 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 29126 + .word 37494 + .word 48225 + .word 36984 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 15107 + .word 34726 + .word 44130 + .word 57191 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 57806 + .word 26620 + .word 53230 + .word 42777 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 45097 + .word 47803 + .word 25447 + .word 61330 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 40016 + .word 15109 + .word 58793 + .word 33461 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 6456 + .word 21547 + .word 27586 + .word 56453 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 5294 + .word 26959 + .word 24309 + .word 57122 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 9256 + .word 20178 + .word 27285 + .word 56054 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 11974 + .word 6713 + .word 58610 + .word 53898 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 56155 + .word 5104 + .word 43351 + .word 37953 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 31236 + .word 18492 + .word 31580 + .word 45205 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 20337 + .word 4737 + .word 24808 + .word 48018 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43780 + .word 34731 + .word 45426 + .word 46730 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 61467 + .word 48142 + .word 38368 + .word 42346 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 39936 + .word 34435 + .word 51154 + .word 36121 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 41171 + .word 26385 + .word 45942 + .word 58461 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 31471 + .word 18426 + .word 18937 + .word 45145 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 23734 + .word 23053 + .word 7429 + .word 33424 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 28624 + .word 21549 + .word 30360 + .word 48021 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 9108 + .word 57175 + .word 16609 + .word 33031 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 44968 + .word 30293 + .word 53704 + .word 38182 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 63279 + .word 65139 + .word 8683 + .word 42110 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 43283 + .word 52727 + .word 26719 + .word 56933 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 18528 + .word 63869 + .word 40120 + .word 60712 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 28913 + .word 42968 + .word 213 + .word 43569 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 2240 + .word 11347 + .word 26371 + .word 51717 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 7147 + .word 20723 + .word 31050 + .word 54241 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 49648 + .word 51324 + .word 11444 + .word 51872 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 8690 + .word 5809 + .word 9903 + .word 46065 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 1296 + .word 54160 + .word 11620 + .word 38443 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 251 + .word 19098 + .word 34161 + .word 60807 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 46412 + .word 5592 + .word 55877 + .word 45861 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 5959 + .word 21591 + .word 50019 + .word 33145 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 2025 + .word 457 + .word 9244 + .word 46095 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 54038 + .word 55252 + .word 55370 + .word 62518 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 47036 + .word 16304 + .word 12880 + .word 40628 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 18241 + .word 19196 + .word 21406 + .word 57530 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 21199 + .word 5012 + .word 49009 + .word 34179 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 54990 + .word 53386 + .word 65270 + .word 33668 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 28726 + .word 33993 + .word 32251 + .word 45542 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 13837 + .word 35230 + .word 52966 + .word 64362 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 39173 + .word 47380 + .word 34462 + .word 36139 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 39489 + .word 64902 + .word 49120 + .word 35472 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 21714 + .word 58783 + .word 27254 + .word 63315 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 7367 + .word 49518 + .word 65112 + .word 52470 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 43556 + .word 37199 + .word 28377 + .word 40908 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 37864 + .word 51941 + .word 23210 + .word 60543 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 51520 + .word 41236 + .word 58920 + .word 42796 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 27066 + .word 4055 + .word 50549 + .word 58076 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 8077 + .word 7791 + .word 5643 + .word 37977 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 56642 + .word 7120 + .word 1392 + .word 48650 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 33215 + .word 4176 + .word 55081 + .word 59653 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 38962 + .word 43845 + .word 18883 + .word 41782 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 9405 + .word 19610 + .word 41716 + .word 40526 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 22463 + .word 33011 + .word 2834 + .word 59404 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 23962 + .word 42196 + .word 52880 + .word 56044 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 56651 + .word 1819 + .word 25970 + .word 41984 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 36494 + .word 8013 + .word 55275 + .word 45183 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 29601 + .word 10973 + .word 29140 + .word 41460 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 33142 + .word 6988 + .word 53485 + .word 34321 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 42305 + .word 46215 + .word 46985 + .word 52653 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 32750 + .word 12648 + .word 9511 + .word 38000 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 28037 + .word 7223 + .word 39341 + .word 52115 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 43511 + .word 40096 + .word 33119 + .word 34189 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 41081 + .word 59110 + .word 54072 + .word 43128 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 52022 + .word 40239 + .word 12039 + .word 52524 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 9970 + .word 11940 + .word 19019 + .word 62959 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 8444 + .word 14648 + .word 8577 + .word 36069 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 47055 + .word 6244 + .word 23935 + .word 45569 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 17962 + .word 25012 + .word 42920 + .word 38222 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 32361 + .word 55573 + .word 62116 + .word 40518 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 23469 + .word 12285 + .word 11074 + .word 41169 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 29710 + .word 22026 + .word 53610 + .word 45713 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 19101 + .word 51375 + .word 37915 + .word 49464 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 1487 + .word 25012 + .word 26269 + .word 42849 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 24702 + .word 7300 + .word 26639 + .word 32851 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 5625 + .word 62032 + .word 62646 + .word 46360 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 16670 + .word 28857 + .word 9900 + .word 61429 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 46530 + .word 36341 + .word 10884 + .word 38667 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 26979 + .word 7608 + .word 53990 + .word 46612 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 13306 + .word 33772 + .word 42194 + .word 54094 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 5215 + .word 26849 + .word 40637 + .word 60704 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 22157 + .word 10775 + .word 9954 + .word 33697 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 62485 + .word 60905 + .word 33942 + .word 35703 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 47033 + .word 9473 + .word 12114 + .word 36373 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 18718 + .word 57887 + .word 63790 + .word 64802 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 60436 + .word 32137 + .word 16772 + .word 44812 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 22870 + .word 68 + .word 14788 + .word 47045 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 13858 + .word 11038 + .word 51083 + .word 33832 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 24411 + .word 53664 + .word 52423 + .word 44992 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 23130 + .word 50537 + .word 29298 + .word 38364 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 59445 + .word 25072 + .word 42634 + .word 55036 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 27750 + .word 60051 + .word 51021 + .word 35697 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 41673 + .word 42346 + .word 29154 + .word 43180 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 24646 + .word 17588 + .word 60780 + .word 49501 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 30636 + .word 48402 + .word 41439 + .word 54315 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 53530 + .word 51574 + .word 33266 + .word 57402 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 24832 + .word 32214 + .word 6566 + .word 58730 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 57338 + .word 52017 + .word 53845 + .word 59748 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 1236 + .word 12983 + .word 25321 + .word 57902 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 42696 + .word 11590 + .word 13704 + .word 47288 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 20112 + .word 35255 + .word 63039 + .word 51665 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 20272 + .word 45351 + .word 26440 + .word 36407 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 23351 + .word 42139 + .word 19582 + .word 38935 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 65431 + .word 27369 + .word 16464 + .word 36140 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 53584 + .word 5561 + .word 32961 + .word 55717 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 39374 + .word 7231 + .word 45599 + .word 56117 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 1294 + .word 6051 + .word 44462 + .word 39418 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 34729 + .word 52585 + .word 9627 + .word 47645 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 17858 + .word 59905 + .word 65371 + .word 52695 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 43933 + .word 27878 + .word 22295 + .word 54792 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 57164 + .word 8466 + .word 41536 + .word 54342 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 62613 + .word 13809 + .word 4914 + .word 51847 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 51382 + .word 5505 + .word 45058 + .word 47893 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 20574 + .word 54447 + .word 25989 + .word 44189 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 20867 + .word 50041 + .word 5177 + .word 38746 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 51710 + .word 33997 + .word 26466 + .word 39335 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 35180 + .word 39426 + .word 44580 + .word 39632 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 39102 + .word 49560 + .word 46254 + .word 52105 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 49858 + .word 3610 + .word 18403 + .word 60348 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 63577 + .word 52764 + .word 23423 + .word 53731 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 17746 + .word 20210 + .word 17254 + .word 46087 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 57780 + .word 38655 + .word 62917 + .word 51922 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 56818 + .word 27103 + .word 46800 + .word 44610 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 42772 + .word 47939 + .word 39429 + .word 53363 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 7127 + .word 43872 + .word 47188 + .word 55109 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 35603 + .word 15923 + .word 26337 + .word 52288 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 15540 + .word 23148 + .word 44469 + .word 46826 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 38573 + .word 44351 + .word 49528 + .word 40134 + .word 49120 + .word 0 + .word 0 + .word 0 + .word 46922 + .word 10206 + .word 58026 + .word 33232 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 48893 + .word 37264 + .word 47364 + .word 55135 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 34563 + .word 54412 + .word 19025 + .word 43320 + .word 16345 + .word 0 + .word 0 + .word 0 + .word 50485 + .word 58441 + .word 18478 + .word 53939 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 57295 + .word 1543 + .word 39725 + .word 59283 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 61902 + .word 50672 + .word 60234 + .word 34832 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 47445 + .word 686 + .word 22678 + .word 38214 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 38808 + .word 16930 + .word 17219 + .word 37683 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 15851 + .word 55325 + .word 43407 + .word 60214 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 1143 + .word 605 + .word 3834 + .word 44087 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 37926 + .word 51721 + .word 32650 + .word 51423 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 719 + .word 37404 + .word 19156 + .word 44137 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 35866 + .word 56877 + .word 40751 + .word 46818 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 17240 + .word 30023 + .word 36586 + .word 42015 + .word 49121 + .word 0 + .word 0 + .word 0 + .word 54230 + .word 7254 + .word 30602 + .word 34461 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 8012 + .word 12609 + .word 22719 + .word 53286 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 30585 + .word 22802 + .word 38382 + .word 39498 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 49910 + .word 61459 + .word 13066 + .word 58648 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 4234 + .word 29117 + .word 43487 + .word 41014 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 15283 + .word 31 + .word 53183 + .word 37265 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 38704 + .word 430 + .word 57551 + .word 43591 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 53647 + .word 31489 + .word 59377 + .word 44715 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 58843 + .word 40196 + .word 27184 + .word 44045 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 21712 + .word 17792 + .word 22495 + .word 41091 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 4064 + .word 22340 + .word 38581 + .word 35349 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 24218 + .word 42337 + .word 60128 + .word 52640 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 20378 + .word 19984 + .word 2299 + .word 54122 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 31249 + .word 59274 + .word 16273 + .word 55107 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 52834 + .word 54517 + .word 12431 + .word 49909 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 54832 + .word 24393 + .word 30353 + .word 51256 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 65180 + .word 60129 + .word 24669 + .word 41244 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 6591 + .word 13357 + .word 31681 + .word 59287 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 26454 + .word 14700 + .word 42966 + .word 39875 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 2956 + .word 33652 + .word 3414 + .word 53265 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 52370 + .word 22181 + .word 28024 + .word 33144 + .word 16337 + .word 0 + .word 0 + .word 0 + .word 13170 + .word 827 + .word 21750 + .word 47190 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 46086 + .word 34614 + .word 16391 + .word 63371 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 23901 + .word 55438 + .word 56964 + .word 55951 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 6825 + .word 37234 + .word 16184 + .word 48173 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 100 + .word 15349 + .word 44285 + .word 40213 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 46705 + .word 62401 + .word 15619 + .word 64493 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 5832 + .word 45818 + .word 5603 + .word 48870 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 26154 + .word 11509 + .word 12905 + .word 33853 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 57899 + .word 64916 + .word 17522 + .word 39399 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 11797 + .word 62659 + .word 15787 + .word 52982 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 4387 + .word 49305 + .word 27685 + .word 41688 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 8893 + .word 53993 + .word 6961 + .word 62732 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 6561 + .word 49840 + .word 37854 + .word 49392 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 22913 + .word 52496 + .word 16836 + .word 64532 + .word 16337 + .word 0 + .word 0 + .word 0 + .word 61478 + .word 12903 + .word 22917 + .word 40137 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 20254 + .word 5653 + .word 41280 + .word 45163 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 9250 + .word 21583 + .word 29887 + .word 42398 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 21296 + .word 56033 + .word 20302 + .word 45697 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 2595 + .word 14223 + .word 9373 + .word 34428 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 43880 + .word 13192 + .word 17465 + .word 51046 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 10750 + .word 52386 + .word 15061 + .word 37140 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 43380 + .word 26688 + .word 4603 + .word 52842 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 57923 + .word 50589 + .word 40806 + .word 36546 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 41550 + .word 43340 + .word 52700 + .word 48703 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 2829 + .word 50954 + .word 33981 + .word 61546 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 53540 + .word 53334 + .word 26985 + .word 35726 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 1383 + .word 41626 + .word 39002 + .word 35204 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 4988 + .word 17152 + .word 47624 + .word 42298 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 13081 + .word 59676 + .word 51281 + .word 43278 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 20576 + .word 9083 + .word 44900 + .word 60572 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 5241 + .word 64752 + .word 26216 + .word 43285 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 54740 + .word 4493 + .word 22744 + .word 47855 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 40170 + .word 38190 + .word 50840 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 64000 + .word 51124 + .word 38392 + .word 32771 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 6193 + .word 27449 + .word 18043 + .word 41906 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 55083 + .word 10857 + .word 24850 + .word 53024 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 39204 + .word 24043 + .word 43883 + .word 33151 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 16615 + .word 33399 + .word 37109 + .word 40897 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 45005 + .word 13768 + .word 23576 + .word 49662 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 19875 + .word 47904 + .word 27295 + .word 59169 + .word 49120 + .word 0 + .word 0 + .word 0 + .word 50767 + .word 38341 + .word 26349 + .word 34421 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 61460 + .word 9200 + .word 49063 + .word 38824 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 17698 + .word 13464 + .word 19312 + .word 41938 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 14145 + .word 49711 + .word 41841 + .word 42410 + .word 49105 + .word 0 + .word 0 + .word 0 + .word 52259 + .word 38890 + .word 11861 + .word 38197 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 37928 + .word 15208 + .word 58116 + .word 52459 + .word 49096 + .word 0 + .word 0 + .word 0 + .word 32955 + .word 48671 + .word 55988 + .word 42873 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 10284 + .word 13591 + .word 10015 + .word 45425 + .word 16321 + .word 0 + .word 0 + .word 0 + .word 60165 + .word 7231 + .word 29309 + .word 47020 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 2826 + .word 34241 + .word 10052 + .word 46822 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 38150 + .word 11520 + .word 57874 + .word 50634 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 13154 + .word 32010 + .word 59285 + .word 54374 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 3630 + .word 36258 + .word 15737 + .word 57945 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 33484 + .word 32040 + .word 11194 + .word 61229 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 29890 + .word 19177 + .word 6587 + .word 64088 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 47912 + .word 33375 + .word 45262 + .word 33179 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 35727 + .word 49010 + .word 4249 + .word 33927 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 48287 + .word 11774 + .word 34966 + .word 34177 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 59219 + .word 12218 + .word 14591 + .word 33807 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 45587 + .word 38263 + .word 60150 + .word 65351 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 64248 + .word 19753 + .word 11467 + .word 61248 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 8987 + .word 4417 + .word 35296 + .word 54967 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 58348 + .word 59855 + .word 58179 + .word 46574 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 838 + .word 40288 + .word 16803 + .word 34203 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 19985 + .word 64792 + .word 35689 + .word 34160 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 63242 + .word 24737 + .word 37564 + .word 33357 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 21080 + .word 30395 + .word 32053 + .word 60879 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 31967 + .word 27284 + .word 22818 + .word 55292 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 25886 + .word 29922 + .word 20917 + .word 49964 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 16415 + .word 22145 + .word 37135 + .word 44903 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 60061 + .word 56529 + .word 59607 + .word 40115 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 61716 + .word 63444 + .word 60667 + .word 35604 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 44658 + .word 58531 + .word 9530 + .word 62744 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 62260 + .word 39586 + .word 42345 + .word 54833 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 28253 + .word 12485 + .word 44364 + .word 47473 + .word 16336 + .word 0 + .word 0 + .word 0 + .word 12640 + .word 24607 + .word 1626 + .word 40656 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 34428 + .word 36370 + .word 1024 + .word 34362 + .word 16328 + .word 0 + .word 0 + .word 0 + .word 29040 + .word 20316 + .word 63988 + .word 57186 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 56625 + .word 35023 + .word 4494 + .word 47694 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 12074 + .word 64589 + .word 55447 + .word 37930 + .word 49083 + .word 0 + .word 0 + .word 0 + .word 50967 + .word 1382 + .word 5204 + .word 52101 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 3284 + .word 33134 + .word 2262 + .word 47439 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 46363 + .word 11691 + .word 13356 + .word 36476 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 3419 + .word 29155 + .word 56063 + .word 55913 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 46070 + .word 27060 + .word 45787 + .word 42709 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 48455 + .word 49617 + .word 63339 + .word 65012 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 11309 + .word 38321 + .word 50476 + .word 49291 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 63177 + .word 54179 + .word 19446 + .word 37218 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 17008 + .word 20702 + .word 63396 + .word 55953 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 58916 + .word 21526 + .word 44533 + .word 41856 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 4054 + .word 60910 + .word 64524 + .word 62288 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 572 + .word 56463 + .word 6651 + .word 46074 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 294 + .word 32916 + .word 12940 + .word 33845 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 61241 + .word 23461 + .word 12133 + .word 49362 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 43813 + .word 54697 + .word 47595 + .word 36628 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 7023 + .word 63196 + .word 1211 + .word 52552 + .word 49079 + .word 0 + .word 0 + .word 0 + .word 49710 + .word 23216 + .word 57316 + .word 57937 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 16917 + .word 54685 + .word 15559 + .word 33684 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 19402 + .word 20755 + .word 35177 + .word 43607 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 18988 + .word 7708 + .word 26373 + .word 56330 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 31678 + .word 36048 + .word 15370 + .word 36299 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 62053 + .word 9463 + .word 59420 + .word 46669 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 43189 + .word 37083 + .word 47017 + .word 59851 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 56431 + .word 23594 + .word 54456 + .word 38275 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 57207 + .word 5358 + .word 61057 + .word 48816 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 55955 + .word 61547 + .word 7096 + .word 62073 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 38324 + .word 43297 + .word 2038 + .word 39337 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 48019 + .word 63539 + .word 58854 + .word 49683 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 38415 + .word 45891 + .word 48038 + .word 62495 + .word 16321 + .word 0 + .word 0 + .word 0 + .word 6285 + .word 58141 + .word 38062 + .word 39153 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 8535 + .word 47970 + .word 20521 + .word 50223 + .word 16312 + .word 0 + .word 0 + .word 0 + .word 3599 + .word 31205 + .word 53376 + .word 62523 + .word 49075 + .word 0 + .word 0 + .word 0 + .word 53390 + .word 39428 + .word 31508 + .word 33365 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 24907 + .word 1998 + .word 17203 + .word 47787 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 65154 + .word 44054 + .word 55771 + .word 52050 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 59345 + .word 56252 + .word 17241 + .word 56609 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 21068 + .word 33081 + .word 36502 + .word 61470 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 5838 + .word 32265 + .word 27141 + .word 33320 + .word 49121 + .word 0 + .word 0 + .word 0 + .word 13157 + .word 36097 + .word 56398 + .word 36061 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 34641 + .word 3406 + .word 61161 + .word 38959 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 36822 + .word 2107 + .word 7812 + .word 42013 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 57689 + .word 7026 + .word 46609 + .word 45217 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 65442 + .word 46672 + .word 32230 + .word 48567 + .word 16328 + .word 0 + .word 0 + .word 0 + .word 38794 + .word 56166 + .word 59740 + .word 52052 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 7020 + .word 42539 + .word 58408 + .word 55641 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 5792 + .word 16154 + .word 40642 + .word 59348 + .word 49081 + .word 0 + .word 0 + .word 0 + .word 45758 + .word 39239 + .word 10684 + .word 64996 + .word 16308 + .word 0 + .word 0 + .word 0 + .word 17135 + .word 25280 + .word 14240 + .word 34593 + .word 49072 + .word 0 + .word 0 + .word 0 + .word 22956 + .word 27174 + .word 6236 + .word 35739 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 41448 + .word 9608 + .word 15061 + .word 33872 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 35041 + .word 22115 + .word 31787 + .word 62060 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 47943 + .word 57954 + .word 5630 + .word 56794 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 12256 + .word 51468 + .word 48243 + .word 51918 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 16861 + .word 555 + .word 19712 + .word 47409 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 14521 + .word 28998 + .word 64476 + .word 43241 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 42742 + .word 52364 + .word 18112 + .word 39394 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 11937 + .word 57143 + .word 59317 + .word 35844 + .word 16336 + .word 0 + .word 0 + .word 0 + .word 54775 + .word 41142 + .word 37066 + .word 65147 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 52047 + .word 20166 + .word 2989 + .word 59124 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 63890 + .word 14576 + .word 19973 + .word 53583 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 51017 + .word 21644 + .word 32682 + .word 48474 + .word 16315 + .word 0 + .word 0 + .word 0 + .word 14951 + .word 9527 + .word 54932 + .word 43797 + .word 49078 + .word 0 + .word 0 + .word 0 + .word 19956 + .word 63323 + .word 21590 + .word 40697 + .word 16305 + .word 0 + .word 0 + .word 0 + .word 13287 + .word 59412 + .word 52293 + .word 36781 + .word 49068 + .word 0 + .word 0 + .word 0 + .word 20654 + .word 3963 + .word 37243 + .word 46202 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 14259 + .word 41161 + .word 56379 + .word 47991 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 29552 + .word 20159 + .word 19967 + .word 36969 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 36671 + .word 37033 + .word 31146 + .word 56915 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 40096 + .word 16159 + .word 8745 + .word 43779 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 31426 + .word 40251 + .word 6629 + .word 33649 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 62460 + .word 14572 + .word 46922 + .word 51685 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 21330 + .word 50824 + .word 20752 + .word 39663 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 59043 + .word 6300 + .word 36178 + .word 60824 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 11117 + .word 55297 + .word 15596 + .word 46598 + .word 49096 + .word 0 + .word 0 + .word 0 + .word 52972 + .word 24185 + .word 7857 + .word 35668 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 48165 + .word 35957 + .word 4973 + .word 54554 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 40559 + .word 40135 + .word 50657 + .word 41665 + .word 16312 + .word 0 + .word 0 + .word 0 + .word 22209 + .word 12399 + .word 38770 + .word 63599 + .word 49074 + .word 0 + .word 0 + .word 0 + .word 21134 + .word 56966 + .word 28654 + .word 49967 + .word 16301 + .word 0 + .word 0 + .word 0 + .word 55252 + .word 38724 + .word 60696 + .word 38196 + .word 49064 + .word 0 + .word 0 + .word 0 + .word 50324 + .word 38050 + .word 41691 + .word 52128 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 57576 + .word 19017 + .word 35093 + .word 33984 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 45261 + .word 53464 + .word 26203 + .word 44021 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 59506 + .word 58350 + .word 50456 + .word 56993 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 39656 + .word 29013 + .word 30706 + .word 36875 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 15950 + .word 25278 + .word 29858 + .word 47692 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 44951 + .word 52254 + .word 26639 + .word 61649 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 14884 + .word 15288 + .word 36355 + .word 39823 + .word 49105 + .word 0 + .word 0 + .word 0 + .word 33589 + .word 37339 + .word 42662 + .word 51420 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 59837 + .word 52901 + .word 27833 + .word 33178 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 23530 + .word 8792 + .word 46326 + .word 42790 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 22918 + .word 41993 + .word 30280 + .word 55154 + .word 49082 + .word 0 + .word 0 + .word 0 + .word 22935 + .word 40180 + .word 10208 + .word 35510 + .word 16309 + .word 0 + .word 0 + .word 0 + .word 24655 + .word 6092 + .word 5569 + .word 45708 + .word 49071 + .word 0 + .word 0 + .word 0 + .word 1836 + .word 9946 + .word 17030 + .word 60600 + .word 16297 + .word 0 + .word 0 + .word 0 + .word 58034 + .word 64044 + .word 12732 + .word 39095 + .word 49060 + .word 0 + .word 0 + .word 0 + .word 54043 + .word 4884 + .word 4993 + .word 50896 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 52175 + .word 36282 + .word 1403 + .word 48115 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 8979 + .word 278 + .word 60581 + .word 52397 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 62427 + .word 36042 + .word 64958 + .word 57041 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 22617 + .word 56486 + .word 29933 + .word 62075 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 6668 + .word 34800 + .word 16726 + .word 33764 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 58438 + .word 34332 + .word 45904 + .word 36716 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 64514 + .word 12491 + .word 17770 + .word 39912 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 38781 + .word 4147 + .word 20350 + .word 43369 + .word 16329 + .word 0 + .word 0 + .word 0 + .word 11653 + .word 23288 + .word 23101 + .word 47107 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 24538 + .word 52112 + .word 19258 + .word 51147 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 55081 + .word 11864 + .word 2795 + .word 55511 + .word 49079 + .word 0 + .word 0 + .word 0 + .word 30359 + .word 7516 + .word 42523 + .word 60199 + .word 16305 + .word 0 + .word 0 + .word 0 + .word 51632 + .word 54516 + .word 60788 + .word 65273 + .word 49067 + .word 0 + .word 0 + .word 0 + .word 8259 + .word 26817 + .word 16640 + .word 36463 + .word 16294 + .word 0 + .word 0 + .word 0 + .word 25358 + .word 21633 + .word 63088 + .word 39650 + .word 49056 + .word 0 + .word 0 + .word 0 + .word 37940 + .word 45084 + .word 22741 + .word 53976 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 56905 + .word 35663 + .word 13071 + .word 34053 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 6338 + .word 45524 + .word 29128 + .word 62353 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 53870 + .word 55231 + .word 26051 + .word 57072 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 25356 + .word 27338 + .word 39402 + .word 52225 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 53832 + .word 61470 + .word 21273 + .word 47778 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 58577 + .word 63695 + .word 35460 + .word 43698 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 4520 + .word 44723 + .word 47409 + .word 39956 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 1812 + .word 29018 + .word 42821 + .word 36525 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 59061 + .word 29228 + .word 16191 + .word 33380 + .word 49089 + .word 0 + .word 0 + .word 0 + .word 39396 + .word 18010 + .word 60638 + .word 60994 + .word 16314 + .word 0 + .word 0 + .word 0 + .word 49088 + .word 9900 + .word 51011 + .word 55711 + .word 49076 + .word 0 + .word 0 + .word 0 + .word 37150 + .word 50516 + .word 56492 + .word 50852 + .word 16302 + .word 0 + .word 0 + .word 0 + .word 28484 + .word 40361 + .word 52896 + .word 46416 + .word 49064 + .word 0 + .word 0 + .word 0 + .word 62255 + .word 31126 + .word 18737 + .word 43665 + .word 16290 + .word 0 + .word 0 + .word 0 + .word 12057 + .word 58357 + .word 2287 + .word 39984 + .word 49052 + .word 0 + .word 0 + .word 0 + .word 10303 + .word 34822 + .word 30753 + .word 42638 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 35383 + .word 38620 + .word 16953 + .word 48193 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 33393 + .word 6703 + .word 23267 + .word 37093 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 15343 + .word 55882 + .word 8818 + .word 57090 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 43704 + .word 64267 + .word 56511 + .word 43925 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 4607 + .word 47760 + .word 9543 + .word 33791 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 56389 + .word 24814 + .word 13621 + .word 51980 + .word 16337 + .word 0 + .word 0 + .word 0 + .word 53957 + .word 28278 + .word 52920 + .word 39972 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 44558 + .word 56829 + .word 64035 + .word 61466 + .word 16324 + .word 0 + .word 0 + .word 0 + .word 38720 + .word 53021 + .word 48635 + .word 47250 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 44746 + .word 16730 + .word 48948 + .word 36315 + .word 16312 + .word 0 + .word 0 + .word 0 + .word 35899 + .word 1861 + .word 5901 + .word 55812 + .word 49073 + .word 0 + .word 0 + .word 0 + .word 22074 + .word 38313 + .word 14608 + .word 42863 + .word 16299 + .word 0 + .word 0 + .word 0 + .word 55515 + .word 23576 + .word 64018 + .word 32920 + .word 49061 + .word 0 + .word 0 + .word 0 + .word 12839 + .word 2194 + .word 19804 + .word 52126 + .word 16286 + .word 0 + .word 0 + .word 0 + .word 11439 + .word 41150 + .word 15351 + .word 40172 + .word 49048 + .word 0 + .word 0 + .word 0 + .word 29431 + .word 9874 + .word 45662 + .word 49530 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 65266 + .word 58931 + .word 1289 + .word 34097 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 37900 + .word 52013 + .word 19533 + .word 44126 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 56648 + .word 29183 + .word 44293 + .word 57098 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 6159 + .word 2813 + .word 55364 + .word 36937 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 43479 + .word 31839 + .word 13895 + .word 47785 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 5187 + .word 20139 + .word 24873 + .word 61810 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 122 + .word 12763 + .word 63612 + .word 39970 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 44050 + .word 14658 + .word 36451 + .word 51689 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 25644 + .word 4873 + .word 38936 + .word 33417 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 47798 + .word 57836 + .word 54492 + .word 43203 + .word 16309 + .word 0 + .word 0 + .word 0 + .word 13594 + .word 52300 + .word 36178 + .word 55848 + .word 49070 + .word 0 + .word 0 + .word 0 + .word 62324 + .word 37045 + .word 44215 + .word 36078 + .word 16296 + .word 0 + .word 0 + .word 0 + .word 9408 + .word 55695 + .word 35369 + .word 46620 + .word 49057 + .word 0 + .word 0 + .word 0 + .word 55933 + .word 58459 + .word 63135 + .word 62102 + .word 16282 + .word 0 + .word 0 + .word 0 + .word 9035 + .word 28599 + .word 9663 + .word 40267 + .word 49044 + .word 0 + .word 0 + .word 0 + .word 64440 + .word 9942 + .word 11459 + .word 51063 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 54621 + .word 1381 + .word 54593 + .word 57593 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 57672 + .word 22144 + .word 48770 + .word 34240 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 41335 + .word 40315 + .word 35384 + .word 40709 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 44154 + .word 2667 + .word 29983 + .word 48395 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 11933 + .word 28752 + .word 33333 + .word 57526 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 28038 + .word 64578 + .word 40018 + .word 34186 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 37517 + .word 65009 + .word 17291 + .word 40628 + .word 49096 + .word 0 + .word 0 + .word 0 + .word 55118 + .word 35846 + .word 36301 + .word 48278 + .word 16321 + .word 0 + .word 0 + .word 0 + .word 8485 + .word 24440 + .word 14912 + .word 57363 + .word 49082 + .word 0 + .word 0 + .word 0 + .word 32377 + .word 28880 + .word 65211 + .word 34074 + .word 16308 + .word 0 + .word 0 + .word 0 + .word 34616 + .word 16831 + .word 8616 + .word 40478 + .word 49069 + .word 0 + .word 0 + .word 0 + .word 8999 + .word 50919 + .word 12017 + .word 48079 + .word 16294 + .word 0 + .word 0 + .word 0 + .word 35787 + .word 61739 + .word 12812 + .word 57101 + .word 49055 + .word 0 + .word 0 + .word 0 + .word 44504 + .word 58876 + .word 42861 + .word 33904 + .word 16281 + .word 0 + .word 0 + .word 0 + .word 47876 + .word 27247 + .word 49503 + .word 40257 + .word 49042 + .word 0 + .word 0 + .word 0 + .type _erfcl_Q,@object + .size _erfcl_Q,7168 + .align 2 +_erfcl_S: + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56559 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55197 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45662 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45290 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44607 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43781 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42924 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42104 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41357 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40696 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40122 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39629 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39210 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38855 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38556 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38304 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38091 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37913 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37763 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37637 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37531 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37442 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37368 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37305 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37252 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37208 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37189 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _erfcl_S,@object + .size _erfcl_S,448 + .align 2 +_erfcl_UNDERFLOW_INT: + .word 42217 + .word 46880 + .word 24677 + .word 54546 + .word 16389 + .word 0 + .word 0 + .word 0 + .type _erfcl_UNDERFLOW_INT,@object + .size _erfcl_UNDERFLOW_INT,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/erff.S b/external/sgx_libm/intel64/erff.S new file mode 100644 index 0000000000..07752ac1c5 --- /dev/null +++ b/external/sgx_libm/intel64/erff.S @@ -0,0 +1,254 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erff.c" + .text +..TXTST0: +# -- Begin erff + .text + .align 16,0x90 + .globl erff +erff: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_erff.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -16(%rsp) + movl %edx, %eax + andl $2147483647, %edx + andl $-2147483648, %eax + orl $1065353216, %eax + movl %eax, -24(%rsp) + cmpl $2139095040, %edx + movss -24(%rsp), %xmm0 + jge ..B1.8 +..B1.2: + cmpl $1081791744, %edx + jge ..B1.7 +..B1.3: + cmpl $1065353216, %edx + jl ..B1.5 +..B1.4: + movl %edx, %eax + andl $8388607, %edx + orl $1065353216, %edx + pxor %xmm4, %xmm4 + movl %edx, -24(%rsp) + lea _dbA(%rip), %rsi + shrl $23, %eax + cvtss2sd -24(%rsp), %xmm4 + cvtss2sd %xmm0, %xmm0 + subsd .L_2il0floatpacket.0(%rip), %xmm4 + movaps %xmm4, %xmm3 + lea -1016(,%rax,8), %edx + mulsd %xmm4, %xmm3 + lea -508(%rdx,%rax,4), %ecx + movslq %ecx, %rcx + movaps %xmm3, %xmm7 + mulsd %xmm3, %xmm7 + movsd 152(%rsi,%rcx,8), %xmm6 + mulsd %xmm4, %xmm6 + movsd 120(%rsi,%rcx,8), %xmm8 + mulsd %xmm4, %xmm8 + addsd 144(%rsi,%rcx,8), %xmm6 + movsd 136(%rsi,%rcx,8), %xmm5 + mulsd %xmm3, %xmm6 + addsd 112(%rsi,%rcx,8), %xmm8 + mulsd %xmm4, %xmm5 + mulsd %xmm3, %xmm8 + addsd %xmm5, %xmm6 + movsd 88(%rsi,%rcx,8), %xmm9 + movsd 104(%rsi,%rcx,8), %xmm2 + mulsd %xmm4, %xmm9 + addsd 128(%rsi,%rcx,8), %xmm6 + mulsd %xmm4, %xmm2 + mulsd %xmm7, %xmm6 + addsd 80(%rsi,%rcx,8), %xmm9 + addsd %xmm2, %xmm8 + mulsd %xmm3, %xmm9 + addsd 96(%rsi,%rcx,8), %xmm8 + movsd 72(%rsi,%rcx,8), %xmm1 + addsd %xmm6, %xmm8 + mulsd %xmm4, %xmm1 + mulsd %xmm7, %xmm8 + addsd %xmm1, %xmm9 + addsd 64(%rsi,%rcx,8), %xmm9 + addsd %xmm8, %xmm9 + mulsd %xmm0, %xmm9 + cvtsd2ss %xmm9, %xmm9 + jmp ..B1.6 +..B1.5: + pxor %xmm3, %xmm3 + lea 56+_dbA(%rip), %rdi + lea 48+_dbA(%rip), %rax + lea 40+_dbA(%rip), %r8 + lea 32+_dbA(%rip), %rdx + lea 24+_dbA(%rip), %r9 + lea 16+_dbA(%rip), %rcx + lea 8+_dbA(%rip), %r10 + movsd (%rdi), %xmm2 + lea _dbA(%rip), %rsi + movsd (%rax), %xmm9 + cvtss2sd -16(%rsp), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm9 + addsd (%r8), %xmm2 + addsd (%rdx), %xmm9 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm9 + addsd (%r9), %xmm2 + addsd (%rcx), %xmm9 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm9 + addsd (%r10), %xmm2 + addsd (%rsi), %xmm9 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm9 + mulsd %xmm3, %xmm9 + cvtsd2ss %xmm9, %xmm9 +..B1.6: + movaps %xmm9, %xmm0 + ret +..B1.7: + cvtss2sd %xmm0, %xmm0 + lea 256+_dbA(%rip), %rax + mulsd (%rax), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.8: + movss -16(%rsp), %xmm1 + addss %xmm1, %xmm1 + je ..L3 + movaps %xmm1, %xmm0 +..L3: + ret + .align 16,0x90 + .cfi_endproc + .type erff,@function + .size erff,.-erff + .data +# -- End erff + .section .rodata, "a" + .align 16 + .align 16 +_dbA: + .long 1346373606 + .long 1072827863 + .long 1710987328 + .long 3218608756 + .long 2039146822 + .long 1069343472 + .long 2052989911 + .long 3214639770 + .long 3741021613 + .long 1064657550 + .long 2828932584 + .long 3209415657 + .long 556515485 + .long 1058898537 + .long 1493771156 + .long 3202627648 + .long 1460823802 + .long 1072622165 + .long 647757120 + .long 1069445687 + .long 1478820123 + .long 3217479081 + .long 827266439 + .long 1069662880 + .long 4153551678 + .long 3215381932 + .long 3249389370 + .long 3213783616 + .long 3875823656 + .long 1066650297 + .long 2479749796 + .long 3212012677 + .long 4079794357 + .long 3210967401 + .long 3292960271 + .long 1062989018 + .long 1338933997 + .long 3204757561 + .long 4209598023 + .long 3207545998 + .long 2886434981 + .long 1072693201 + .long 1721637260 + .long 1060257935 + .long 960688093 + .long 3210436681 + .long 1128797080 + .long 1064950642 + .long 798939459 + .long 3213958757 + .long 937205111 + .long 1067493282 + .long 3504975339 + .long 3215465534 + .long 3388113641 + .long 1068080152 + .long 9542307 + .long 3215088353 + .long 1310184383 + .long 1065080747 + .long 3264801679 + .long 1066837484 + .long 3394984936 + .long 3214223095 + .long 4294967295 + .long 1072693247 + .type _dbA,@object + .size _dbA,264 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3ff80000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/erfl.S b/external/sgx_libm/intel64/erfl.S new file mode 100644 index 0000000000..22d826349b --- /dev/null +++ b/external/sgx_libm/intel64/erfl.S @@ -0,0 +1,2357 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "erfl.c" + .text +..TXTST0: +# -- Begin erfl + .text + .align 16,0x90 + .globl erfl +erfl: +# parameter 1: 80 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_erfl.1: +..L2: + + subq $72, %rsp + .cfi_def_cfa_offset 80 + xorb %dl, %dl +..B1.2: + fnstcw 58(%rsp) +..B1.3: + movzwl 58(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %ecx + movw %cx, 56(%rsp) +..B1.5: + fldcw 56(%rsp) +..B1.6: + movb $1, %dl +..B1.7: + movb 89(%rsp), %cl + lea ones(%rip), %rsi + andb $-128, %cl + shrb $7, %cl + movzbl %cl, %edi + movzwl 88(%rsp), %eax + andl $32767, %eax + movzwl 86(%rsp), %r8d + movss (%rsi,%rdi,4), %xmm0 + movl %eax, %esi + shll $16, %esi + orl %r8d, %esi + cmpl $32767, %eax + je ..B1.32 +..B1.8: + cmpl $1073860832, %esi + jge ..B1.26 +..B1.9: + fldt 80(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt .L_2il0floatpacket.0(%rip) + fucomip %st(1), %st + fstp %st(0) + jp ..B1.10 + je ..B1.29 +..B1.10: + cmpl $16343, %eax + jle ..B1.18 +..B1.11: + cmpl $16380, %eax + jge ..B1.15 +..B1.12: + fldt 32(%rsp) + lea 128+_ldbA(%rip), %rcx + fld %st(0) + lea 112+_ldbA(%rip), %rsi + fmul %st(1), %st + lea _TWO_32H(%rip), %rax + lea 96+_ldbA(%rip), %rdi + fld %st(1) + lea 80+_ldbA(%rip), %r8 + lea 64+_ldbA(%rip), %r9 + lea 48+_ldbA(%rip), %r10 + lea 32+_ldbA(%rip), %r11 + fld %st(2) + testb %dl, %dl + fldl (%rax) + lea 16+_ldbA(%rip), %rax + fmul %st(4), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fsub %st(1), %st + fldt (%rcx) + fmul %st(3), %st + fldt (%rsi) + lea _ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%rax) + fmul %st(4), %st + fxch %st(3) + fmulp %st, %st(4) + fldt (%rcx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + je ..B1.14 +..B1.13: + fldcw 58(%rsp) +..B1.14: + fldt 32(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.15: + fldt 32(%rsp) + lea -1073793024(%rsi), %eax + shrl $16, %esi + movl $6, %ecx + movss %xmm0, 48(%rsp) + lea erfRRTable(%rip), %r8 + fmuls 48(%rsp) + addq $-16380, %rsi + cmpl $47103, %eax + lea _ldbA(%rip), %r11 + lea _TWO_32H(%rip), %r10 + cmovbe %rcx, %rsi + movq %rsi, %r9 + movl %esi, %edi + shlq $4, %r9 + shll $5, %edi + subl %esi, %edi + subl %esi, %edi + fmull (%r9,%r8) + movslq %edi, %rdi + faddl 8(%r8,%r9) + shlq $4, %rdi + fstpt 32(%rsp) + fldt 32(%rsp) + testb %dl, %dl + fldt 608(%r11,%rdi) + fmul %st(1), %st + fldt 592(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 576(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 560(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 544(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 528(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 512(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 496(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 480(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 464(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 448(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 432(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 416(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 400(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 384(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 368(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 352(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt 336(%r11,%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fld %st(1) + fldt 320(%r11,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 304(%r11,%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fldt 288(%r11,%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fld %st(2) + fldt 272(%r11,%rdi) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldl (%r10) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fld %st(0) + fxch %st(3) + fsub %st(4), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(6), %st + fmul %st(2), %st + faddp %st, %st(3) + fld %st(3) + fmul %st(1), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + fsub %st(4), %st + faddp %st, %st(2) + fldt 176(%r11,%rdi) + fld %st(0) + fmul %st(6), %st + fstpt 16(%rsp) + fmul %st(1), %st + fldt 192(%r11,%rdi) + fmul %st(7), %st + faddp %st, %st(1) + fldt 240(%r11,%rdi) + fmul %st, %st(6) + fmulp %st, %st(2) + fldt 256(%r11,%rdi) + fmulp %st, %st(7) + fxch %st(6) + faddp %st, %st(1) + fldt 208(%r11,%rdi) + fld %st(0) + fadd %st(6), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(6) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 224(%r11,%rdi) + faddp %st, %st(1) + fld %st(4) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fmul %st(4), %st + fxch %st(3) + fsubr %st, %st(5) + fxch %st(1) + faddp %st, %st(5) + fxch %st(3) + fmul %st(4), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 144(%r11,%rdi) + fld %st(0) + fldt 16(%rsp) + fadd %st, %st(1) + fld %st(1) + fadd %st(5), %st + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(5) + faddp %st, %st(2) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fldt 32(%rsp) + fld %st(0) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fldt (%rsp) + fmulp %st, %st(1) + fldt 160(%r11,%rdi) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fmuls 48(%rsp) + fstpt (%rsp) + je ..B1.17 +..B1.16: + fldcw 58(%rsp) +..B1.17: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.18: + fldt 32(%rsp) + lea _TWO5600(%rip), %rcx + lea _TWO_32H(%rip), %rdi + lea _ldbA(%rip), %r8 + lea 16+_ldbA(%rip), %r9 + testl %eax, %eax + fldt (%rcx) + fmul %st, %st(1) + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%rdi) + fld %st(0) + fmul %st(2), %st + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(1) + fld %st(0) + fsubr %st(3), %st + fldt (%r8) + fmul %st, %st(2) + fmulp %st, %st(1) + fldt (%r9) + fmulp %st, %st(4) + faddp %st, %st(3) + jne ..B1.22 +..B1.19: + testl $65520, %esi + je ..B1.22 +..B1.20: + fldt 32(%rsp) + lea _DenoBND(%rip), %rax + movss %xmm0, 48(%rsp) + flds 48(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fmul %st(5), %st + fcomip %st(1), %st + fstp %st(0) + jbe ..B1.22 +..B1.21: + fstp %st(3) + fld %st(2) + lea 16+_TWO5600(%rip), %rax + fadd %st(2), %st + fmul %st, %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fldt (%rax) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.23 +..B1.22: + fstp %st(1) + fstp %st(2) + lea 16+_TWO5600(%rip), %rax + faddp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.23: + testb %dl, %dl + je ..B1.25 +..B1.24: + fldcw 58(%rsp) +..B1.25: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.26: + lea _Epsilon(%rip), %rax + testb %dl, %dl + movss %xmm0, 48(%rsp) + flds 48(%rsp) + fldt (%rax) + fmul %st(1), %st + fsubrp %st, %st(1) + fstpt (%rsp) + je ..B1.28 +..B1.27: + fldcw 58(%rsp) +..B1.28: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.29: + testb %dl, %dl + je ..B1.31 +..B1.30: + fldcw 58(%rsp) + fldt 80(%rsp) + fstpt 32(%rsp) +..B1.31: + fldt 32(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.32: + fldt 80(%rsp) + movq $0x8000000000000000, %rax + movss %xmm0, 48(%rsp) + fadd %st(0), %st + flds 48(%rsp) + cmpq 80(%rsp), %rax + fcmovne %st(1), %st + fstp %st(1) + fstpt (%rsp) + testb %dl, %dl + je ..B1.34 +..B1.33: + fldcw 58(%rsp) +..B1.34: + fldt (%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type erfl,@function + .size erfl,.-erfl + .data +# -- End erfl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +_ldbA: + .word 0 + .word 0 + .word 47746 + .word 36974 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 30720 + .word 36515 + .word 17515 + .word 42715 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 13842 + .word 7119 + .word 41816 + .word 49299 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 3215 + .word 8543 + .word 37072 + .word 59159 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 33545 + .word 17489 + .word 29065 + .word 56342 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 23161 + .word 4543 + .word 59015 + .word 43821 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 15198 + .word 65095 + .word 55656 + .word 57366 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 11319 + .word 61676 + .word 11803 + .word 64720 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 23735 + .word 16978 + .word 56014 + .word 63664 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61888 + .word 54818 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 10044 + .word 28505 + .word 55013 + .word 60780 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27524 + .word 35697 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 61965 + .word 13477 + .word 25391 + .word 40556 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8518 + .word 53546 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 60180 + .word 52984 + .word 38086 + .word 60834 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60744 + .word 44249 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 63138 + .word 9916 + .word 20408 + .word 61684 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 50506 + .word 17424 + .word 9343 + .word 52291 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 50365 + .word 34444 + .word 5016 + .word 49178 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 17941 + .word 44182 + .word 56946 + .word 34035 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 41364 + .word 35872 + .word 36905 + .word 43189 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 47342 + .word 2906 + .word 40861 + .word 33222 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 48408 + .word 44394 + .word 43316 + .word 61646 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 52639 + .word 32949 + .word 29686 + .word 51873 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 13354 + .word 8312 + .word 46883 + .word 36813 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 10783 + .word 42642 + .word 20549 + .word 33739 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 42435 + .word 44080 + .word 27835 + .word 37640 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 55413 + .word 51626 + .word 37570 + .word 37609 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 62471 + .word 35756 + .word 61962 + .word 33520 + .word 49089 + .word 0 + .word 0 + .word 0 + .word 40388 + .word 48302 + .word 32466 + .word 36673 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 21782 + .word 37556 + .word 26897 + .word 52597 + .word 16311 + .word 0 + .word 0 + .word 0 + .word 35272 + .word 16771 + .word 34830 + .word 63430 + .word 49075 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26972 + .word 52968 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 34629 + .word 50944 + .word 29785 + .word 56844 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26328 + .word 64248 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 5285 + .word 428 + .word 53188 + .word 60110 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19746 + .word 48186 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 3964 + .word 321 + .word 7123 + .word 45083 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25230 + .word 61571 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 57803 + .word 48946 + .word 59164 + .word 36732 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 46948 + .word 32819 + .word 54758 + .word 43668 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 16614 + .word 63709 + .word 23635 + .word 47684 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 5734 + .word 50071 + .word 41702 + .word 52540 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 1767 + .word 50346 + .word 34241 + .word 45792 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 21673 + .word 57712 + .word 23306 + .word 47181 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 30917 + .word 34592 + .word 23220 + .word 33297 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 55246 + .word 63001 + .word 17535 + .word 33707 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 5457 + .word 35457 + .word 53300 + .word 62645 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 9460 + .word 62267 + .word 29700 + .word 39878 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 54791 + .word 30369 + .word 50586 + .word 36074 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 2078 + .word 44475 + .word 65531 + .word 40136 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 65081 + .word 909 + .word 65384 + .word 51785 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 42502 + .word 52825 + .word 47801 + .word 35033 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 56809 + .word 22568 + .word 24289 + .word 58056 + .word 49096 + .word 0 + .word 0 + .word 0 + .word 53182 + .word 10272 + .word 7761 + .word 53779 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 48071 + .word 2665 + .word 17237 + .word 54209 + .word 16321 + .word 0 + .word 0 + .word 0 + .word 49513 + .word 25795 + .word 55780 + .word 36409 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19372 + .word 46606 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 22905 + .word 34398 + .word 64354 + .word 59506 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8556 + .word 42135 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 15826 + .word 39989 + .word 27742 + .word 58791 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45602 + .word 63202 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 61021 + .word 62759 + .word 37190 + .word 44093 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11408 + .word 56180 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 10545 + .word 4814 + .word 18495 + .word 39194 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 49818 + .word 2604 + .word 44885 + .word 39501 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 35457 + .word 26400 + .word 3144 + .word 55829 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 1168 + .word 22940 + .word 48307 + .word 56355 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 60825 + .word 56496 + .word 32133 + .word 38661 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 41837 + .word 62246 + .word 39292 + .word 38617 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 61718 + .word 27283 + .word 11883 + .word 33288 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 51738 + .word 39830 + .word 42849 + .word 49937 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 45393 + .word 52381 + .word 54757 + .word 41874 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 45169 + .word 44591 + .word 30009 + .word 57007 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 11552 + .word 4380 + .word 40671 + .word 40665 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 28211 + .word 31057 + .word 64947 + .word 47497 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 61755 + .word 33819 + .word 30246 + .word 61557 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 57599 + .word 65445 + .word 31608 + .word 55873 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 21063 + .word 33239 + .word 23242 + .word 34595 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 24566 + .word 16137 + .word 47167 + .word 52509 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 20857 + .word 62758 + .word 44126 + .word 43729 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 26678 + .word 64201 + .word 37761 + .word 41436 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 15315 + .word 3435 + .word 56025 + .word 62814 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 19814 + .word 59948 + .word 14740 + .word 56311 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 36977 + .word 22840 + .word 9289 + .word 39778 + .word 49096 + .word 0 + .word 0 + .word 0 + .word 62085 + .word 64048 + .word 54574 + .word 65118 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 28752 + .word 34202 + .word 22833 + .word 38817 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43704 + .word 63314 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 17048 + .word 17271 + .word 64911 + .word 39894 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47414 + .word 62353 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 53119 + .word 3173 + .word 58504 + .word 64362 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19176 + .word 46765 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 36591 + .word 64385 + .word 59980 + .word 41399 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 352 + .word 36373 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 63217 + .word 55085 + .word 16723 + .word 42154 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 62758 + .word 20699 + .word 19176 + .word 46765 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 18142 + .word 49445 + .word 47413 + .word 62353 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 54343 + .word 9201 + .word 60310 + .word 40529 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 62797 + .word 60885 + .word 40240 + .word 39787 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 7512 + .word 45008 + .word 10012 + .word 39639 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 20359 + .word 48234 + .word 1564 + .word 57372 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 11764 + .word 26683 + .word 64145 + .word 49882 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 32393 + .word 50330 + .word 31801 + .word 34151 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 5247 + .word 4806 + .word 33577 + .word 41709 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 43823 + .word 34097 + .word 44124 + .word 38558 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 65526 + .word 14942 + .word 25531 + .word 60526 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 38557 + .word 7794 + .word 42920 + .word 40918 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 31363 + .word 35665 + .word 11710 + .word 52655 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 33312 + .word 35439 + .word 34687 + .word 46194 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 21144 + .word 58026 + .word 60687 + .word 57306 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 20701 + .word 12315 + .word 12846 + .word 54836 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 45362 + .word 30760 + .word 28723 + .word 42182 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 16353 + .word 46602 + .word 41748 + .word 42697 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 20735 + .word 3347 + .word 26735 + .word 62816 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 13205 + .word 16964 + .word 38504 + .word 48289 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 28004 + .word 15789 + .word 31604 + .word 37913 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 17923 + .word 56666 + .word 63953 + .word 36481 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36194 + .word 65534 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 12232 + .word 62525 + .word 48597 + .word 39676 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29918 + .word 37380 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 48638 + .word 64479 + .word 2811 + .word 58988 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44876 + .word 56070 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 64093 + .word 3811 + .word 8439 + .word 45892 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42382 + .word 52955 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 7924 + .word 29399 + .word 61525 + .word 36582 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 46606 + .word 18426 + .word 11663 + .word 35044 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 15382 + .word 23178 + .word 43683 + .word 34109 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 6438 + .word 10314 + .word 6872 + .word 49529 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 64583 + .word 11206 + .word 41955 + .word 52421 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 13495 + .word 31464 + .word 61723 + .word 36178 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 28427 + .word 18799 + .word 40522 + .word 59729 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 47510 + .word 26829 + .word 39947 + .word 33535 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 64666 + .word 11700 + .word 15653 + .word 46358 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 6475 + .word 64324 + .word 16618 + .word 52067 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 31765 + .word 32664 + .word 9436 + .word 33916 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 38078 + .word 37286 + .word 55507 + .word 62195 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 16438 + .word 19728 + .word 54394 + .word 45557 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 34868 + .word 45266 + .word 60847 + .word 41133 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 6929 + .word 9316 + .word 56077 + .word 32933 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 60039 + .word 42217 + .word 20756 + .word 52409 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 38571 + .word 57934 + .word 18985 + .word 61369 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 44492 + .word 40353 + .word 2663 + .word 35859 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 54254 + .word 26892 + .word 54523 + .word 56697 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 63636 + .word 38694 + .word 30824 + .word 51163 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 56107 + .word 41638 + .word 48577 + .word 57632 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 13301 + .word 46198 + .word 34221 + .word 52080 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 6730 + .word 19704 + .word 41453 + .word 49062 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 32541 + .word 25746 + .word 20185 + .word 50811 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40118 + .word 38623 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 63899 + .word 60569 + .word 18971 + .word 35021 + .word 49068 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35006 + .word 57940 + .word 49105 + .word 0 + .word 0 + .word 0 + .word 31190 + .word 18012 + .word 64261 + .word 44050 + .word 16305 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44288 + .word 57137 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 30741 + .word 21478 + .word 2085 + .word 43126 + .word 49077 + .word 0 + .word 0 + .word 0 + .word 43184 + .word 28511 + .word 48193 + .word 41628 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 38069 + .word 12322 + .word 59848 + .word 47812 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 14423 + .word 51984 + .word 32740 + .word 45128 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 4208 + .word 46602 + .word 27709 + .word 35782 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 36873 + .word 25112 + .word 30428 + .word 48402 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 10843 + .word 45056 + .word 322 + .word 58525 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 34740 + .word 5397 + .word 19459 + .word 63343 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 43258 + .word 62838 + .word 12965 + .word 52557 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 52181 + .word 57107 + .word 24596 + .word 44275 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 8033 + .word 61170 + .word 58452 + .word 55638 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 18754 + .word 55045 + .word 40463 + .word 41822 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 31326 + .word 56708 + .word 50347 + .word 42397 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 54840 + .word 45764 + .word 11355 + .word 33431 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 56285 + .word 35328 + .word 49599 + .word 58875 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 42904 + .word 46324 + .word 60880 + .word 56231 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 42754 + .word 64912 + .word 63809 + .word 36632 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 28983 + .word 59630 + .word 18663 + .word 33292 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 56135 + .word 38086 + .word 60740 + .word 37575 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 11769 + .word 21615 + .word 56585 + .word 54481 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 64055 + .word 1299 + .word 36942 + .word 50744 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 6073 + .word 42872 + .word 14757 + .word 53598 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 7021 + .word 43375 + .word 58781 + .word 46458 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64268 + .word 65535 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 36579 + .word 26545 + .word 24435 + .word 50138 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14458 + .word 38069 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 15998 + .word 59065 + .word 36918 + .word 41001 + .word 16328 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15150 + .word 34500 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 33246 + .word 7128 + .word 23211 + .word 39186 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36820 + .word 40101 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 45920 + .word 25716 + .word 39121 + .word 51060 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 52724 + .word 56956 + .word 1384 + .word 33467 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 16783 + .word 11603 + .word 62021 + .word 42511 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 34064 + .word 49622 + .word 4121 + .word 42444 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 14084 + .word 4161 + .word 1985 + .word 33838 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 65189 + .word 58247 + .word 7682 + .word 43141 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 15983 + .word 3226 + .word 43602 + .word 43186 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 7235 + .word 9522 + .word 4836 + .word 63885 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 33104 + .word 49991 + .word 48728 + .word 55353 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 10837 + .word 43216 + .word 47090 + .word 42202 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 11340 + .word 13469 + .word 16673 + .word 42993 + .word 49128 + .word 0 + .word 0 + .word 0 + .word 19848 + .word 42271 + .word 35005 + .word 38963 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 38280 + .word 23060 + .word 26803 + .word 65491 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 3155 + .word 63825 + .word 24453 + .word 53521 + .word 49121 + .word 0 + .word 0 + .word 0 + .word 8736 + .word 25576 + .word 59728 + .word 40305 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 21836 + .word 54867 + .word 10689 + .word 53743 + .word 49120 + .word 0 + .word 0 + .word 0 + .word 35590 + .word 40641 + .word 40511 + .word 35834 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 42959 + .word 52506 + .word 48660 + .word 55474 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 62734 + .word 58818 + .word 9020 + .word 51302 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 59117 + .word 1762 + .word 19420 + .word 58690 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 54865 + .word 3647 + .word 6267 + .word 65292 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 35287 + .word 43939 + .word 50577 + .word 38705 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 78 + .word 46283 + .word 25201 + .word 34088 + .word 16338 + .word 0 + .word 0 + .word 0 + .type _ldbA,@object + .size _ldbA,3504 + .align 16 +erfRRTable: + .long 0x00000000,0x40200000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x40100000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x40000000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3fe00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3fd00000 + .long 0x00000000,0xbff80000 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xc00d0000 + .type erfRRTable,@object + .size erfRRTable,112 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_TWO5600: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 21983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 10783 + .word 0 + .word 0 + .word 0 + .type _TWO5600,@object + .size _TWO5600,32 + .align 2 +_DenoBND: + .word 43678 + .word 54205 + .word 57926 + .word 29039 + .word 0 + .word 0 + .word 0 + .word 0 + .type _DenoBND,@object + .size _DenoBND,16 + .align 2 +_Epsilon: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16313 + .word 0 + .word 0 + .word 0 + .type _Epsilon,@object + .size _Epsilon,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/exp10_gen.S b/external/sgx_libm/intel64/exp10_gen.S new file mode 100644 index 0000000000..9f149e5cf6 --- /dev/null +++ b/external/sgx_libm/intel64/exp10_gen.S @@ -0,0 +1,427 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp10_gen.c" + .text +..TXTST0: +# -- Begin exp10 + .text + .align 16,0x90 + .globl exp10 +exp10: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_exp10.1: +..L2: + + movsd %xmm0, -40(%rsp) + movl -36(%rsp), %esi + movl %esi, %edi + movl %esi, %edx + andl $2147483647, %edi + shrl $31, %edx + cmpl $1012924416, %edi + jb ..B1.24 +..B1.2: + lea _range(%rip), %rcx + cmpl 4(%rcx,%rdx,8), %edi + jb ..B1.5 +..B1.3: + jne ..B1.16 +..B1.4: + movl -40(%rsp), %eax + cmpl (%rcx,%rdx,8), %eax + ja ..B1.16 +..B1.5: + addl $-1072693248, %esi + cmpl $4587520, %esi + ja ..B1.8 +..B1.6: + lea _TWO_52H(%rip), %rax + movsd -40(%rsp), %xmm0 + movaps %xmm0, %xmm1 + movsd (%rax), %xmm2 + addsd (%rax), %xmm1 + movsd %xmm1, -32(%rsp) + movsd -32(%rsp), %xmm1 + movslq -32(%rsp), %rcx + subsd %xmm2, %xmm1 + ucomisd %xmm0, %xmm1 + jp ..B1.7 + je ..B1.26 +..B1.7: + movsd %xmm1, -24(%rsp) + jmp ..B1.9 +..B1.8: + lea _TWO_52H(%rip), %rax + movsd -40(%rsp), %xmm0 + movsd (%rax), %xmm2 +..B1.9: + movaps %xmm0, %xmm1 + lea _TWO_32H(%rip), %rcx + mulsd .L_2il0floatpacket.0(%rip), %xmm1 + lea SC2_BIAS(%rip), %rdi + movsd .L_2il0floatpacket.2(%rip), %xmm3 + addsd %xmm2, %xmm1 + movsd %xmm1, -32(%rsp) + movsd -32(%rsp), %xmm6 + movsd (%rcx), %xmm5 + subsd %xmm2, %xmm6 + movsd .L_2il0floatpacket.1(%rip), %xmm2 + mulsd %xmm6, %xmm2 + mulsd %xmm3, %xmm6 + subsd %xmm2, %xmm0 + movaps %xmm0, %xmm4 + movl -32(%rsp), %eax + movl %eax, %r9d + movsd .L_2il0floatpacket.4(%rip), %xmm12 + movl %eax, %esi + movsd .L_2il0floatpacket.8(%rip), %xmm2 + subsd %xmm6, %xmm4 + movsd .L_2il0floatpacket.3(%rip), %xmm8 + addsd %xmm5, %xmm4 + movsd %xmm4, -32(%rsp) + movsd -32(%rsp), %xmm9 + movsd .L_2il0floatpacket.12(%rip), %xmm7 + subsd %xmm5, %xmm9 + shll $25, %r9d + subsd %xmm9, %xmm0 + sarl $25, %r9d + subsd %xmm6, %xmm0 + movaps %xmm0, %xmm11 + subl %r9d, %esi + mulsd %xmm8, %xmm0 + addsd %xmm9, %xmm11 + mulsd %xmm8, %xmm9 + movaps %xmm11, %xmm10 + addsd %xmm9, %xmm7 + mulsd %xmm11, %xmm10 + mulsd %xmm10, %xmm12 + mulsd %xmm10, %xmm2 + addsd .L_2il0floatpacket.5(%rip), %xmm12 + addsd .L_2il0floatpacket.9(%rip), %xmm2 + mulsd %xmm10, %xmm12 + mulsd %xmm10, %xmm2 + addsd .L_2il0floatpacket.6(%rip), %xmm12 + addsd .L_2il0floatpacket.10(%rip), %xmm2 + mulsd %xmm10, %xmm12 + mulsd %xmm10, %xmm2 + addsd %xmm0, %xmm12 + addsd .L_2il0floatpacket.11(%rip), %xmm2 + movsd %xmm7, -24(%rsp) + movl $0, -24(%rsp) + movsd -24(%rsp), %xmm1 + movsd .L_2il0floatpacket.7(%rip), %xmm0 + mulsd %xmm11, %xmm2 + addsd %xmm1, %xmm0 + movslq %r9d, %r9 + subsd %xmm0, %xmm9 + shlq $4, %r9 + addsd %xmm9, %xmm12 + movq __libm_exp_table_128@GOTPCREL(%rip), %r10 + addsd %xmm12, %xmm2 + shrl $7, %esi + movsd 1032(%r10,%r9), %xmm4 + movslq (%rdi,%rdx,4), %r8 + movaps %xmm4, %xmm0 + addq %rsi, %r8 + shlq $52, %r8 + movq %r8, -16(%rsp) + cmpl $-130815, %eax + movsd 1024(%r10,%r9), %xmm3 + mulsd %xmm2, %xmm0 + mulsd %xmm1, %xmm4 + jle ..B1.11 +..B1.10: + lea _SC2(%rip), %rax + addsd %xmm1, %xmm2 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm0 + addsd %xmm4, %xmm0 + mulsd -16(%rsp), %xmm0 + mulsd (%rax,%rdx,8), %xmm0 + movsd %xmm0, -40(%rsp) + ret +..B1.11: + lea _SC2(%rip), %rax + addsd %xmm1, %xmm2 + mulsd %xmm2, %xmm3 + movaps %xmm4, %xmm1 + movsd (%rax,%rdx,8), %xmm2 + addsd %xmm3, %xmm0 + addsd %xmm0, %xmm1 + movsd %xmm1, -24(%rsp) + movl $0, -24(%rsp) + movsd -24(%rsp), %xmm3 + movsd -16(%rsp), %xmm1 + subsd %xmm3, %xmm4 + addsd %xmm0, %xmm4 + movaps %xmm3, %xmm0 + addsd %xmm4, %xmm0 + mulsd %xmm1, %xmm0 + mulsd %xmm2, %xmm0 + movsd %xmm0, -40(%rsp) + movl -36(%rsp), %eax + cmpl $1048576, %eax + jge ..B1.15 +..B1.12: + testl %eax, %eax + jle ..B1.14 +..B1.13: + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm4 + addsd %xmm4, %xmm3 + movsd %xmm3, -40(%rsp) +..B1.14: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -32(%rsp) + movsd -40(%rsp), %xmm0 +..B1.15: + ret +..B1.16: + cmpl $2146435072, %edi + jae ..B1.20 +..B1.17: + testl $-2147483648, %esi + je ..B1.25 +..B1.18: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -40(%rsp) +..B1.19: + ret +..B1.20: + addl $-2146435072, %edi + orl -40(%rsp), %edi + jne ..B1.22 +..B1.21: + lea _inf_zero(%rip), %rax + movsd (%rax,%rdx,8), %xmm0 + ret +..B1.22: + movsd -40(%rsp), %xmm0 + addsd %xmm0, %xmm0 +..B1.23: + ret +..B1.24: + movsd .L_2il0floatpacket.12(%rip), %xmm0 + addsd -40(%rsp), %xmm0 + ret +..B1.25: + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -40(%rsp) + ret +..B1.26: + lea exact_values(%rip), %rax + movsd (%rax,%rcx,8), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type exp10,@function + .size exp10,.-exp10 + .data +# -- End exp10 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x0979a371,0x407a934f + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f634413 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x7fbcc47c,0x3e0427de + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x40026bb1 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xd9d41e9c,0x3fca7ed8 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x09fd8b95,0x3ff2bd76 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xc73cea69,0x40053524 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x25f8c2cc,0x3fb16e4f + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0xfd1d41fe,0x3fe1429f + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x91de2ca4,0x40004705 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0xa2b05ba9,0x3eb776aa + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +exact_values: + .long 0x00000000,0x00000000 + .long 0x00000000,0x40240000 + .long 0x00000000,0x40590000 + .long 0x00000000,0x408f4000 + .long 0x00000000,0x40c38800 + .long 0x00000000,0x40f86a00 + .long 0x00000000,0x412e8480 + .long 0x00000000,0x416312d0 + .long 0x00000000,0x4197d784 + .long 0x00000000,0x41cdcd65 + .long 0x20000000,0x4202a05f + .long 0xe8000000,0x42374876 + .long 0xa2000000,0x426d1a94 + .long 0xe5400000,0x42a2309c + .long 0x1e900000,0x42d6bcc4 + .long 0x26340000,0x430c6bf5 + .long 0x37e08000,0x4341c379 + .long 0x85d8a000,0x43763457 + .long 0x674ec800,0x43abc16d + .long 0x60913d00,0x43e158e4 + .long 0x78b58c40,0x4415af1d + .long 0xd6e2ef50,0x444b1ae4 + .long 0x064dd592,0x4480f0cf + .type exact_values,@object + .size exact_values,184 + .align 4 +_range: + .long 1352628734 + .long 1081295891 + .long 1189309266 + .long 1081358775 + .type _range,@object + .size _range,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +SC2_BIAS: + .long 511 + .long 1535 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_SC2: + .long 0 + .long 1609564160 + .long 0 + .long 535822336 + .type _SC2,@object + .size _SC2,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_inf_zero: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zero,@object + .size _inf_zero,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End + + .globl pow10 + .equ pow10, exp10 + diff --git a/external/sgx_libm/intel64/exp10f_gen.S b/external/sgx_libm/intel64/exp10f_gen.S new file mode 100644 index 0000000000..d1a435e2c7 --- /dev/null +++ b/external/sgx_libm/intel64/exp10f_gen.S @@ -0,0 +1,260 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp10f_gen.c" + .text +..TXTST0: +# -- Begin exp10f + .text + .align 16,0x90 + .globl exp10f +exp10f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_exp10f.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %esi + movl %edx, %ecx + andl $2147483647, %esi + shrl $31, %ecx + cmpl $8388608, %esi + jb ..B1.17 +..B1.2: + movl %ecx, %edi + lea range(%rip), %rax + cmpl (%rax,%rdi,4), %esi + ja ..B1.8 +..B1.3: + movss .L_2il0floatpacket.0(%rip), %xmm1 + cmpl $1065353216, %edx + jl ..B1.7 +..B1.4: + movl %esi, %ecx + shrl $23, %ecx + addl $10, %ecx + shll %cl, %esi + testl %esi, %esi + jne ..B1.7 +..B1.5: + addss %xmm1, %xmm0 + movss %xmm0, -16(%rsp) + movl -16(%rsp), %eax + shll $10, %eax + sarl $10, %eax + cmpl $10, %eax + jg ..B1.7 +..B1.6: + movslq %eax, %rax + lea exact_values(%rip), %rdx + movss (%rdx,%rax,4), %xmm0 + ret +..B1.7: + pxor %xmm3, %xmm3 + movq $0x3ff0000000000000, %rcx + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm0 + mulsd .L_2il0floatpacket.1(%rip), %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movq __libm_expf_table_64@GOTPCREL(%rip), %rsi + addsd .L_2il0floatpacket.2(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm2 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + subss %xmm1, %xmm2 + cvtss2sd %xmm2, %xmm2 + mulsd .L_2il0floatpacket.3(%rip), %xmm2 + movl -16(%rsp), %edx + addsd %xmm2, %xmm3 + movaps %xmm3, %xmm1 + andl $4194303, %edx + mulsd %xmm3, %xmm1 + movl %edx, %eax + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm3, %xmm4 + shll $26, %eax + addsd %xmm4, %xmm0 + sarl $26, %eax + movslq %eax, %rax + subl %eax, %edx + shrl $6, %edx + movsd 256(%rsi,%rax,8), %xmm5 + mulsd %xmm5, %xmm0 + shlq $52, %rdx + addsd %xmm5, %xmm0 + addq %rcx, %rdx + movq %rdx, -24(%rsp) + mulsd -24(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.8: + cmpl $2139095040, %esi + jae ..B1.13 +..B1.9: + testl %ecx, %ecx + je ..B1.11 +..B1.10: + movss .L_2il0floatpacket.8(%rip), %xmm0 + mulss %xmm0, %xmm0 + ret +..B1.11: + movss .L_2il0floatpacket.9(%rip), %xmm0 + mulss %xmm0, %xmm0 +..B1.12: + ret +..B1.13: + jne ..B1.15 +..B1.14: + lea _inf_zero(%rip), %rax + movss (%rax,%rdi,4), %xmm0 + ret +..B1.15: + movss -8(%rsp), %xmm0 +..B1.16: + ret +..B1.17: + movss .L_2il0floatpacket.10(%rip), %xmm0 + addss -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type exp10f,@function + .size exp10f,.-exp10f + .data +# -- End exp10f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.1: + .long 0x0979a371,0x406a934f + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x41680000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x509f79ff,0xbf734413 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xe2724acf,0x3ff2d784 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0xcd26a2f3,0x40053524 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xd3f4b8ec,0x400046f7 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xbbb47127,0x40026bb1 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x4b400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.8: + .long 0x0d800000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +.L_2il0floatpacket.9: + .long 0x71800000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,4 + .align 4 +.L_2il0floatpacket.10: + .long 0x3f800000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +range: + .long 1109008539 + .long 1110823542 + .type range,@object + .size range,8 + .align 4 +exact_values: + .long 0x00000000 + .long 0x41200000 + .long 0x42c80000 + .long 0x447a0000 + .long 0x461c4000 + .long 0x47c35000 + .long 0x49742400 + .long 0x4b189680 + .long 0x4cbebc20 + .long 0x4e6e6b28 + .long 0x501502f9 + .type exact_values,@object + .size exact_values,44 + .align 4 +_inf_zero: + .long 2139095040 + .long 0 + .type _inf_zero,@object + .size _inf_zero,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End + + .globl pow10f + .equ pow10f, exp10f + diff --git a/external/sgx_libm/intel64/exp10l.S b/external/sgx_libm/intel64/exp10l.S new file mode 100644 index 0000000000..5b3c4075ef --- /dev/null +++ b/external/sgx_libm/intel64/exp10l.S @@ -0,0 +1,1282 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp10l.c" + .text +..TXTST0: +# -- Begin exp10l + .text + .align 16,0x90 + .globl exp10l +exp10l: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_exp10l.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %dil, %dil +..B1.2: + fnstcw 86(%rsp) +..B1.3: + movzwl 104(%rsp), %esi + movl %esi, %eax + movzbl 105(%rsp), %ecx + andl $32767, %eax + shrl $7, %ecx + shll $15, %ecx + orl %eax, %ecx + shll $16, %ecx + movzwl 102(%rsp), %edx + orl %edx, %ecx + addl $-1073709056, %ecx + cmpl $284672, %ecx + ja ..B1.6 +..B1.4: + fldt 96(%rsp) + lea _TWO_23H(%rip), %rax + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fxch %st(1) + fstps 80(%rsp) + movss 80(%rsp), %xmm0 + movss %xmm0, 16(%rsp) + flds 16(%rsp) + fsubp %st, %st(1) + fucomip %st(1), %st + fstp %st(0) + jp ..B1.5 + je ..B1.79 +..B1.5: + movl %esi, %eax + andl $32767, %eax +..B1.6: + cmpl $16388, %eax + jge ..B1.45 +..B1.7: + movzwl 86(%rsp), %edx + cmpl $16375, %eax + jge ..B1.38 +..B1.8: + cmpl $16368, %eax + jge ..B1.31 +..B1.9: + cmpl $16357, %eax + jge ..B1.24 +..B1.10: + cmpl $16316, %eax + jge ..B1.17 +..B1.11: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.73 +..B1.12: + orl $-64768, %edx + movw %dx, 84(%rsp) +..B1.13: + fldcw 84(%rsp) +..B1.14: + fldt .L_2il0floatpacket.3(%rip) + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.15: + fldcw 86(%rsp) +..B1.16: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.17: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.21 +..B1.18: + orl $-64768, %edx + movw %dx, 84(%rsp) +..B1.19: + fldcw 84(%rsp) +..B1.20: + movb $1, %dil +..B1.21: + fldt 96(%rsp) + lea 16+_Q2(%rip), %rax + fldt .L_2il0floatpacket.3(%rip) + lea _Q2(%rip), %rdx + testb %dil, %dil + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.23 +..B1.22: + fldcw 86(%rsp) +..B1.23: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.24: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.28 +..B1.25: + orl $-64768, %edx + movw %dx, 84(%rsp) +..B1.26: + fldcw 84(%rsp) +..B1.27: + movb $1, %dil +..B1.28: + fldt 96(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rdx + fmul %st(1), %st + lea 16+_Q1(%rip), %rcx + fldt (%rax) + lea _Q1(%rip), %rsi + fmul %st(1), %st + testb %dil, %dil + fldt (%rdx) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.3(%rip) + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.30 +..B1.29: + fldcw 86(%rsp) +..B1.30: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.31: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.35 +..B1.32: + orl $-64768, %edx + movw %dx, 84(%rsp) +..B1.33: + fldcw 84(%rsp) +..B1.34: + movb $1, %dil +..B1.35: + fldt 96(%rsp) + lea 112+_Q0(%rip), %rdx + fld %st(0) + lea 96+_Q0(%rip), %rcx + fmul %st(1), %st + lea 80+_Q0(%rip), %rsi + lea 64+_Q0(%rip), %r8 + lea 48+_Q0(%rip), %r9 + lea 32+_Q0(%rip), %r10 + lea _TWO_48H(%rip), %rax + lea 16+_Q0(%rip), %r11 + fld %st(1) + fld %st(2) + testb %dil, %dil + fldt (%rdx) + lea 128+_Q0(%rip), %rdx + fmul %st(3), %st + fldl (%rax) + lea _Q0(%rip), %rax + fadd %st, %st(3) + fsubr %st(3), %st + fsubr %st, %st(2) + fldt (%rcx) + fmul %st(5), %st + fldt (%rsi) + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + fldt (%r8) + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + fldt (%r9) + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + fldt (%r10) + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(5) + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fldt (%rdx) + fmul %st, %st(4) + fmulp %st, %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.3(%rip) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + je ..B1.85 +..B1.36: + fstpt 48(%rsp) +..B1.82: + fldcw 86(%rsp) + jmp ..B1.37 +..B1.85: + fstp %st(0) +..B1.37: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.38: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.42 +..B1.39: + orl $-64768, %edx + movw %dx, 84(%rsp) +..B1.40: + fldcw 84(%rsp) +..B1.41: + movb $1, %dil +..B1.42: + fldt 96(%rsp) + lea _TWO_63H(%rip), %rdx + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_48H(%rip), %rcx + fmul %st(1), %st + lea 80+_P(%rip), %r8 + fldl (%rdx) + lea 48+_P(%rip), %r10 + lea 64+_P(%rip), %r9 + lea 32+_P(%rip), %r11 + lea 16+_P(%rip), %rdx + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + movl 48(%rsp), %esi + fsubrp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.2(%rip) + fmulp %st, %st(2) + movsbq %sil, %rax + fsub %st(1), %st + fldl (%rcx) + lea _P(%rip), %rcx + subl %eax, %esi + fadd %st, %st(1) + shrl $8, %esi + fsubr %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + shll $23, %esi + fxch %st(3) + fsubrp %st, %st(4) + addl $1065353216, %esi + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt (%r8) + fmul %st(1), %st + fldt (%r9) + fmul %st(2), %st + fldt (%r10) + movl %esi, 32(%rsp) + lea 96+_P(%rip), %rsi + shlq $4, %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + testb %dil, %dil + fldt (%r11) + movq __libm_expl_table_256@GOTPCREL(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt (%rsi) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(2) + fldl 2056(%r8,%rax) + fldl 2048(%r8,%rax) + fld %st(0) + fmul %st(5), %st + fxch %st(4) + fadd %st, %st(5) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmul %st(3), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmuls 32(%rsp) + fstpt 16(%rsp) + je ..B1.86 +..B1.43: + fstpt 48(%rsp) +..B1.83: + fldcw 86(%rsp) + jmp ..B1.44 +..B1.86: + fstp %st(0) +..B1.44: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.45: + movb 105(%rsp), %dl + lea _ranges(%rip), %r8 + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + movq %rsi, %rcx + shlq $4, %rcx + movzwl 8(%rcx,%r8), %edx + andl $32767, %edx + cmpl %edx, %eax + jl ..B1.50 +..B1.46: + jne ..B1.62 +..B1.47: + movl 100(%rsp), %edx + cmpl 4(%rcx,%r8), %edx + jb ..B1.50 +..B1.48: + jne ..B1.62 +..B1.49: + movl 96(%rsp), %edx + cmpl (%rcx,%r8), %edx + jae ..B1.62 +..B1.50: + movzwl 86(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.54 +..B1.51: + orl $-64768, %edx + movw %dx, 84(%rsp) +..B1.52: + fldcw 84(%rsp) +..B1.53: + movb $1, %dil +..B1.54: + fldt .L_2il0floatpacket.3(%rip) + lea _TWO_63H(%rip), %r8 + fstpt 64(%rsp) + lea _TWO_48H(%rip), %r9 + fldt 96(%rsp) + lea SC2_BIAS(%rip), %r10 + fldt .L_2il0floatpacket.0(%rip) + fmul %st(1), %st + fldl (%r8) + movzwl 8+.L_2il0floatpacket.3(%rip), %r8d + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + andl $-32768, %r8d + movl 48(%rsp), %edx + fsubp %st, %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + movsbq %dl, %rax + fsubr %st(2), %st + fld %st(0) + movl %eax, %r11d + fldt .L_2il0floatpacket.2(%rip) + negl %r11d + fmulp %st, %st(3) + addl %edx, %r11d + shrl $8, %r11d + addl $4196735, %edx + addl (%r10,%rsi,4), %r11d + lea 80+_P(%rip), %rsi + andl $32767, %r11d + lea 16+_P(%rip), %r10 + orl %r11d, %r8d + lea _P(%rip), %r11 + movw %r8w, 72(%rsp) + lea 48+_P(%rip), %r8 + shlq $4, %rax + fsub %st(2), %st + fldl (%r9) + lea 32+_P(%rip), %r9 + cmpl $3070, %edx + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + fsubrp %st, %st(2) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt (%rsi) + lea 64+_P(%rip), %rsi + fmul %st(1), %st + fldt (%rsi) + lea 96+_P(%rip), %rsi + fmul %st(2), %st + fldt (%r8) + movq __libm_expl_table_256@GOTPCREL(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fldt (%r11) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt (%rsi) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(2) + fldl 2048(%r8,%rax) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(1) + fmul %st, %st(3) + faddp %st, %st(3) + fmull 2056(%r8,%rax) + faddp %st, %st(1) + faddl 2056(%r8,%rax) + ja ..B1.57 +..B1.55: + lea _exp10but(%rip), %rax + fldt (%rax) + fcomip %st(3), %st + jbe ..B1.57 +..B1.56: + fstp %st(2) + fld %st(0) + lea _TWO_12H(%rip), %rax + lea _SC2(%rip), %rdx + fadd %st(2), %st + fldl (%rax) + fmul %st(1), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt (%rcx,%rdx) + fldt 64(%rsp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B1.58 +..B1.57: + fstp %st(2) + fldt 64(%rsp) + fxch %st(2) + faddp %st, %st(1) + lea _SC2(%rip), %rax + fmulp %st, %st(1) + fldt (%rcx,%rax) + fmulp %st, %st(1) + fstpt 32(%rsp) +..B1.58: + fldt 32(%rsp) + lea _minnorm(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + ja ..B1.74 +..B1.59: + testb %dil, %dil + je ..B1.61 +..B1.60: + fldt 16(%rsp) + fstpt 48(%rsp) +..B1.84: + fldcw 86(%rsp) +..B1.61: + fldt 32(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.62: + movzwl 86(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.66 +..B1.63: + orl $-64768, %ecx + movw %cx, 84(%rsp) +..B1.64: + fldcw 84(%rsp) +..B1.65: + movzwl 104(%rsp), %eax + movb $1, %dil + andl $32767, %eax +..B1.66: + cmpl $32767, %eax + je ..B1.75 +..B1.67: + testq %rsi, %rsi + je ..B1.69 +..B1.68: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) + jmp ..B1.70 +..B1.69: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) +..B1.70: + testb %dil, %dil + je ..B1.72 +..B1.71: + fldcw 86(%rsp) +..B1.72: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.73: + fldt .L_2il0floatpacket.3(%rip) + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.16 +..B1.74: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.59 +..B1.75: + cmpl $-2147483648, 100(%rsp) + jne ..B1.78 +..B1.76: + cmpl $0, 96(%rsp) + jne ..B1.78 +..B1.77: + lea _inf_zeros(%rip), %rax + fldl (%rax,%rsi,8) + fstpt 16(%rsp) + jmp ..B1.70 +..B1.78: + fldt 96(%rsp) + fstpt 16(%rsp) + jmp ..B1.70 +..B1.79: + movl 80(%rsp), %eax + lea _exact_values(%rip), %rdx + andl $4194303, %eax + shlq $4, %rax + fldt -16(%rdx,%rax) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type exp10l,@function + .size exp10l,.-exp10l + .data +# -- End exp10l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x88,0x1b,0xcd,0x4b,0x78,0x9a,0xd4,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x85,0x9a,0x20,0x9a,0xf5,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0xc8,0xd4,0x0e,0xee,0x0c,0x01,0x86,0xd0,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 4 +_TWO_23H: + .long 0 + .long 1097334784 + .type _TWO_23H,@object + .size _TWO_23H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +SC2_BIAS: + .long 8191 + .long 24575 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .align 2 +_Q2: + .word 45097 + .word 43688 + .word 36317 + .word 37725 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 18666 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 44055 + .word 43688 + .word 36317 + .word 37725 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 17466 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 8942 + .word 31610 + .word 11407 + .word 33336 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 11423 + .word 35775 + .word 45136 + .word 38379 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q0: + .word 11092 + .word 42962 + .word 43694 + .word 58436 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 17467 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 8985 + .word 61797 + .word 11406 + .word 33336 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 8830 + .word 60614 + .word 45135 + .word 38379 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 62265 + .word 59600 + .word 65512 + .word 35348 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 36045 + .word 15298 + .word 47170 + .word 54262 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 33342 + .word 6003 + .word 33899 + .word 35698 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 20958 + .word 58269 + .word 28628 + .word 41099 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37726 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _Q0,@object + .size _Q0,144 + .align 2 +_P: + .word 405 + .word 44055 + .word 43688 + .word 36317 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 17467 + .word 59219 + .word 9785 + .word 43433 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 7929 + .word 61789 + .word 11406 + .word 33336 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 36964 + .word 60605 + .word 45135 + .word 38379 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 55739 + .word 36897 + .word 684 + .word 35349 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 13923 + .word 51509 + .word 48217 + .word 54262 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37725 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,112 + .align 2 +_ranges: + .word 63385 + .word 64463 + .word 39556 + .word 39456 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 55376 + .word 5815 + .word 21149 + .word 39608 + .word 16395 + .word 0 + .word 0 + .word 0 + .type _ranges,@object + .size _ranges,32 + .align 2 +_exp10but: + .word 6424 + .word 10152 + .word 51584 + .word 39451 + .word 49163 + .word 0 + .word 0 + .word 0 + .type _exp10but,@object + .size _exp10but,16 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _SC2,@object + .size _SC2,32 + .align 2 +_minnorm: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _minnorm,@object + .size _minnorm,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_exact_values: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40000 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50000 + .word 16399 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62500 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39062 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8192 + .word 48828 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10240 + .word 61035 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63744 + .word 38146 + .word 16416 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46912 + .word 47683 + .word 16419 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42256 + .word 59604 + .word 16422 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59178 + .word 37252 + .word 16426 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8436 + .word 46566 + .word 16429 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 43313 + .word 58207 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1024 + .word 51647 + .word 36379 + .word 16436 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50432 + .word 48174 + .word 45474 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30272 + .word 27450 + .word 56843 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35304 + .word 8964 + .word 35527 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44130 + .word 60357 + .word 44408 + .word 16449 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6010 + .word 9911 + .word 55511 + .word 16452 + .word 0 + .word 0 + .word 0 + .word 36864 + .word 28332 + .word 30770 + .word 34694 + .word 16456 + .word 0 + .word 0 + .word 0 + .word 46080 + .word 2647 + .word 5695 + .word 43368 + .word 16459 + .word 0 + .word 0 + .word 0 + .word 41216 + .word 52461 + .word 7118 + .word 54210 + .word 16462 + .word 0 + .word 0 + .word 0 + .word 33952 + .word 16404 + .word 20833 + .word 33881 + .word 16466 + .word 0 + .word 0 + .word 0 + .word 42440 + .word 36889 + .word 42425 + .word 42351 + .word 16469 + .word 0 + .word 0 + .word 0 + .word 3898 + .word 62496 + .word 36647 + .word 52939 + .word 16472 + .word 0 + .word 0 + .word 0 + .type _exact_values,@object + .size _exact_values,432 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End + + .globl pow10l + .equ pow10l, exp10l + diff --git a/external/sgx_libm/intel64/exp2_gen.S b/external/sgx_libm/intel64/exp2_gen.S new file mode 100644 index 0000000000..17707759ca --- /dev/null +++ b/external/sgx_libm/intel64/exp2_gen.S @@ -0,0 +1,517 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp2_gen.c" + .text +..TXTST0: +# -- Begin exp2 + .text + .align 16,0x90 + .globl exp2 +exp2: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_exp2.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %sil, %sil + movsd %xmm0, 40(%rsp) +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movl 44(%rsp), %edx + movl %edx, %eax + andl $2147483647, %eax + lea -1072693248(%rax), %ecx + cmpl $10483712, %ecx + ja ..B1.9 +..B1.4: + movl %eax, %ecx + movl $1048575, %edi + shrl $20, %ecx + incl %ecx + shrl %cl, %edi + andl %eax, %edi + orl 40(%rsp), %edi + jne ..B1.9 +..B1.5: + lea _TWO_52H(%rip), %rcx + movsd 40(%rsp), %xmm0 + addsd (%rcx), %xmm0 + movsd %xmm0, 16(%rsp) + movl 16(%rsp), %ecx + cmpl $-1074, %ecx + jl ..B1.9 +..B1.6: + lea 1023(%rcx), %eax + testl %eax, %eax + jle ..B1.37 +..B1.7: + movslq %eax, %rax + shlq $52, %rax + movq %rax, 8(%rsp) +..B1.8: + movsd 8(%rsp), %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.9: + cmpl $1079984128, %eax + jae ..B1.14 +..B1.10: + cmpl $1012924416, %eax + jae ..B1.12 +..B1.11: + movsd .L_2il0floatpacket.11(%rip), %xmm0 + addsd 40(%rsp), %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + movsd 40(%rsp), %xmm0 + pxor %xmm13, %xmm13 + lea _TWO_52H(%rip), %rax + lea _two_32p1(%rip), %rdx + movsd .L_2il0floatpacket.4(%rip), %xmm9 + lea _two_32(%rip), %rcx + movsd .L_2il0floatpacket.7(%rip), %xmm10 + movsd .L_2il0floatpacket.2(%rip), %xmm4 + movsd (%rax), %xmm1 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd (%rdx), %xmm2 + addsd %xmm1, %xmm0 + movsd %xmm0, 16(%rsp) + movsd 16(%rsp), %xmm8 + movl 16(%rsp), %esi + movl %esi, %edi + movsd .L_2il0floatpacket.3(%rip), %xmm3 + subsd %xmm1, %xmm8 + mulsd .L_2il0floatpacket.1(%rip), %xmm8 + shll $25, %edi + addsd 40(%rsp), %xmm8 + movaps %xmm8, %xmm7 + movaps %xmm8, %xmm5 + mulsd %xmm8, %xmm7 + mulsd %xmm7, %xmm9 + mulsd %xmm7, %xmm10 + addsd .L_2il0floatpacket.5(%rip), %xmm9 + addsd .L_2il0floatpacket.8(%rip), %xmm10 + mulsd %xmm7, %xmm9 + mulsd %xmm7, %xmm10 + addsd .L_2il0floatpacket.6(%rip), %xmm9 + addsd .L_2il0floatpacket.9(%rip), %xmm10 + mulsd %xmm7, %xmm9 + mulsd %xmm7, %xmm10 + movsd %xmm8, (%rsp) + movl $0, (%rsp) + movsd (%rsp), %xmm6 + sarl $25, %edi + subsd %xmm6, %xmm5 + mulsd %xmm4, %xmm6 + addsd .L_2il0floatpacket.10(%rip), %xmm10 + mulsd %xmm4, %xmm5 + addsd %xmm6, %xmm2 + mulsd %xmm8, %xmm10 + addsd %xmm5, %xmm9 + movsd %xmm2, 16(%rsp) + subl %edi, %esi + movsd 16(%rsp), %xmm11 + movslq %edi, %rdi + subsd (%rcx), %xmm11 + shlq $4, %rdi + addsd %xmm11, %xmm3 + movq __libm_exp_table_128@GOTPCREL(%rip), %r8 + subsd %xmm3, %xmm6 + movsd 1032(%r8,%rdi), %xmm12 + addsd %xmm6, %xmm9 + movaps %xmm12, %xmm0 + addsd %xmm9, %xmm10 + mulsd %xmm11, %xmm12 + mulsd %xmm10, %xmm0 + addsd %xmm11, %xmm10 + mulsd 1024(%r8,%rdi), %xmm10 + shrl $7, %esi + addsd %xmm10, %xmm0 + shll $23, %esi + addsd %xmm12, %xmm0 + addl $1065353216, %esi + movl %esi, 24(%rsp) + cvtss2sd 24(%rsp), %xmm13 + mulsd %xmm13, %xmm0 + movsd %xmm11, (%rsp) + movsd %xmm0, 8(%rsp) +..B1.13: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.14: + lea _range(%rip), %r8 + movl %edx, %ecx + shrl $31, %ecx + cmpl 4(%r8,%rcx,8), %eax + jb ..B1.17 +..B1.15: + jne ..B1.28 +..B1.16: + movl 40(%rsp), %edi + cmpl (%r8,%rcx,8), %edi + ja ..B1.28 +..B1.17: + movsd 40(%rsp), %xmm0 + lea _TWO_52H(%rip), %rdi + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + lea _two_32p1(%rip), %r9 + movsd (%rdi), %xmm1 + lea _two_32(%rip), %r10 + movsd .L_2il0floatpacket.4(%rip), %xmm9 + lea SC2_BIAS(%rip), %r11 + movsd .L_2il0floatpacket.2(%rip), %xmm4 + addsd %xmm1, %xmm0 + movsd %xmm0, 16(%rsp) + movsd 16(%rsp), %xmm8 + movsd (%r9), %xmm2 + subsd %xmm1, %xmm8 + mulsd .L_2il0floatpacket.1(%rip), %xmm8 + movsd .L_2il0floatpacket.7(%rip), %xmm1 + movl 16(%rsp), %edx + movl %edx, %eax + movsd .L_2il0floatpacket.3(%rip), %xmm3 + movl %edx, %r8d + shll $25, %eax + addsd 40(%rsp), %xmm8 + movaps %xmm8, %xmm7 + movaps %xmm8, %xmm5 + mulsd %xmm8, %xmm7 + mulsd %xmm7, %xmm9 + mulsd %xmm7, %xmm1 + addsd .L_2il0floatpacket.5(%rip), %xmm9 + addsd .L_2il0floatpacket.8(%rip), %xmm1 + mulsd %xmm7, %xmm9 + mulsd %xmm7, %xmm1 + addsd .L_2il0floatpacket.6(%rip), %xmm9 + addsd .L_2il0floatpacket.9(%rip), %xmm1 + mulsd %xmm7, %xmm9 + mulsd %xmm7, %xmm1 + movsd %xmm8, (%rsp) + movl $0, (%rsp) + movsd (%rsp), %xmm6 + sarl $25, %eax + subsd %xmm6, %xmm5 + mulsd %xmm4, %xmm6 + addsd .L_2il0floatpacket.10(%rip), %xmm1 + mulsd %xmm4, %xmm5 + addsd %xmm6, %xmm2 + mulsd %xmm8, %xmm1 + addsd %xmm5, %xmm9 + movsd %xmm2, 16(%rsp) + subl %eax, %r8d + movsd 16(%rsp), %xmm11 + movsd %xmm6, (%rsp) + movslq %eax, %rax + subsd (%r10), %xmm11 + shlq $4, %rax + addsd %xmm11, %xmm3 + movq __libm_exp_table_128@GOTPCREL(%rip), %r9 + subsd %xmm3, %xmm6 + movsd 1032(%r9,%rax), %xmm2 + addsd %xmm6, %xmm9 + shrl $7, %r8d + addsd %xmm9, %xmm1 + movaps %xmm1, %xmm10 + mulsd %xmm2, %xmm1 + addsd %xmm11, %xmm10 + mulsd %xmm11, %xmm2 + mulsd 1024(%r9,%rax), %xmm10 + movslq (%r11,%rcx,4), %rdi + addsd %xmm10, %xmm1 + addq %r8, %rdi + movaps %xmm1, %xmm0 + shlq $52, %rdi + addsd %xmm2, %xmm0 + movq %rdi, 24(%rsp) + cmpl $-130815, %edx + jg ..B1.26 +..B1.18: + movsd %xmm0, (%rsp) + andl $-4096, (%rsp) + movsd (%rsp), %xmm0 + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + subsd %xmm0, %xmm2 + cmpl $768, %eax + addsd %xmm1, %xmm2 + je ..B1.22 +..B1.19: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.20: + fldcw 32(%rsp) +..B1.21: + movsd (%rsp), %xmm0 + movb $1, %sil +..B1.22: + fldl 24(%rsp) + lea _SC2(%rip), %rax + movsd %xmm0, (%rsp) + testb %sil, %sil + fldl (%rsp) + movsd %xmm2, (%rsp) + fldl (%rsp) + faddp %st, %st(1) + fmulp %st, %st(1) + fmull (%rax,%rcx,8) + fstpl 8(%rsp) + je ..B1.24 +..B1.23: + fldcw 34(%rsp) +..B1.24: + cmpl $1048576, 12(%rsp) + jl ..B1.8 +..B1.25: + movsd 8(%rsp), %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.26: + movsd 24(%rsp), %xmm1 + lea _SC2(%rip), %rax + mulsd %xmm1, %xmm0 + mulsd (%rax,%rcx,8), %xmm0 + movsd %xmm0, 8(%rsp) +..B1.27: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.28: + cmpl $2146435072, %eax + jae ..B1.33 +..B1.29: + testl $-2147483648, %edx + je ..B1.31 +..B1.30: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, 8(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.31: + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, 8(%rsp) +..B1.32: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.33: + addl $-2146435072, %eax + orl 40(%rsp), %eax + jne ..B1.35 +..B1.34: + lea _inf_zero(%rip), %rax + movsd (%rax,%rcx,8), %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.35: + movsd 40(%rsp), %xmm0 + addsd %xmm0, %xmm0 +..B1.36: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.37: + addl $1074, %ecx + movl $1, %eax + shlq %cl, %rax + movq %rax, 8(%rsp) + jmp ..B1.8 + .align 16,0x90 + .cfi_endproc + .type exp2,@function + .size exp2,.-exp2 + .data +# -- End exp2 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40600000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0xbf800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3fe62e42 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xac59a345,0x3f24308c + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x6fba31d1,0x3f83b2ab + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xff82c58f,0x3fcebfbd + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x00cb0678,0x3ef0097a + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0xe87ed439,0x3f55d87f + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0xd704a0c3,0x3fac6b08 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x3de6af28,0x3e9fdf47 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_two_32p1: + .long 1048576 + .long 1106247680 + .type _two_32p1,@object + .size _two_32p1,8 + .align 4 +_two_32: + .long 0 + .long 1106247680 + .type _two_32,@object + .size _two_32,8 + .align 4 +_range: + .long 4294967295 + .long 1083179007 + .long 4294967295 + .long 1083232255 + .type _range,@object + .size _range,16 + .align 4 +SC2_BIAS: + .long 511 + .long 1535 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_SC2: + .long 0 + .long 1609564160 + .long 0 + .long 535822336 + .type _SC2,@object + .size _SC2,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_inf_zero: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zero,@object + .size _inf_zero,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/exp2f_gen.S b/external/sgx_libm/intel64/exp2f_gen.S new file mode 100644 index 0000000000..a33b058d9f --- /dev/null +++ b/external/sgx_libm/intel64/exp2f_gen.S @@ -0,0 +1,306 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp2f_gen.c" + .text +..TXTST0: +# -- Begin exp2f + .text + .align 16,0x90 + .globl exp2f +exp2f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_exp2f.1: +..L2: + + movaps %xmm0, %xmm1 + movd %xmm1, %esi + movss %xmm1, -8(%rsp) + andl $2147483647, %esi + lea -1065353216(%rsi), %eax + cmpl $58589184, %eax + ja ..B1.7 +..B1.2: + movl %esi, %ecx + movl %esi, %eax + shrl $23, %ecx + addl $10, %ecx + shll %cl, %eax + testl %eax, %eax + jne ..B1.7 +..B1.3: + movss .L_2il0floatpacket.0(%rip), %xmm0 + addss %xmm0, %xmm1 + movss %xmm1, -12(%rsp) + movl -12(%rsp), %ecx + shll $10, %ecx + sarl $10, %ecx + cmpl $-149, %ecx + jl ..B1.7 +..B1.4: + movl %ecx, %eax + addl $127, %eax + jle ..B1.23 +..B1.5: + shll $23, %eax + movl %eax, -16(%rsp) +..B1.6: + movss -16(%rsp), %xmm0 + ret +..B1.7: + cmpl $1123680256, %esi + jae ..B1.12 +..B1.8: + cmpl $830472192, %esi + jae ..B1.10 +..B1.9: + movss .L_2il0floatpacket.10(%rip), %xmm0 + addss -8(%rsp), %xmm0 + movss %xmm0, -12(%rsp) + ret +..B1.10: + pxor %xmm3, %xmm3 + pxor %xmm6, %xmm6 + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm0 + mulsd .L_2il0floatpacket.1(%rip), %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movq __libm_expf_table_64@GOTPCREL(%rip), %rcx + addsd .L_2il0floatpacket.2(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -12(%rsp) + movss -12(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + movl -12(%rsp), %edx + movl %edx, %eax + shll $26, %eax + subss .L_2il0floatpacket.0(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + sarl $26, %eax + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm3, %xmm4 + movslq %eax, %rax + addsd %xmm4, %xmm0 + movsd 256(%rcx,%rax,8), %xmm5 + subl %eax, %edx + mulsd %xmm5, %xmm0 + shrl $6, %edx + addsd %xmm5, %xmm0 + shll $23, %edx + addl $1065353216, %edx + movl %edx, -24(%rsp) + cvtss2sd -24(%rsp), %xmm6 + mulsd %xmm6, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) +..B1.11: + ret +..B1.12: + lea range(%rip), %rdx + movl -8(%rsp), %eax + shrl $31, %eax + cmpl (%rdx,%rax,4), %esi + ja ..B1.14 +..B1.13: + pxor %xmm3, %xmm3 + movq $0x3ff0000000000000, %rcx + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm0 + mulsd .L_2il0floatpacket.1(%rip), %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movq __libm_expf_table_64@GOTPCREL(%rip), %rsi + addsd .L_2il0floatpacket.2(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -12(%rsp) + movss -12(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + movl -12(%rsp), %edx + andl $4194303, %edx + subss .L_2il0floatpacket.0(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + movl %edx, %eax + shll $26, %eax + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm3, %xmm4 + sarl $26, %eax + addsd %xmm4, %xmm0 + movslq %eax, %rax + subl %eax, %edx + shrl $6, %edx + movsd 256(%rsi,%rax,8), %xmm5 + mulsd %xmm5, %xmm0 + shlq $52, %rdx + addsd %xmm5, %xmm0 + addq %rcx, %rdx + movq %rdx, -24(%rsp) + mulsd -24(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + ret +..B1.14: + cmpl $2139095040, %esi + jae ..B1.19 +..B1.15: + testq %rax, %rax + je ..B1.17 +..B1.16: + movss .L_2il0floatpacket.8(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + ret +..B1.17: + movss .L_2il0floatpacket.9(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) +..B1.18: + ret +..B1.19: + jne ..B1.21 +..B1.20: + lea _inf_zero(%rip), %rdx + movss (%rdx,%rax,4), %xmm0 + ret +..B1.21: + movss -8(%rsp), %xmm0 + addss %xmm0, %xmm0 +..B1.22: + ret +..B1.23: + addl $149, %ecx + movl $1, %eax + shll %cl, %eax + movl %eax, -16(%rsp) + jmp ..B1.6 + .align 16,0x90 + .cfi_endproc + .type exp2f,@function + .size exp2f,.-exp2f + .data +# -- End exp2f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x40500000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x41680000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbf900000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x3e46f43a,0x3f83ce0f + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x081585e7,0x3fcebfbe + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xd93cf576,0x3fac6af0 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xfef9277b,0x3fe62e42 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x4b400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.8: + .long 0x0d800000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +.L_2il0floatpacket.9: + .long 0x71800000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,4 + .align 4 +.L_2il0floatpacket.10: + .long 0x3f800000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,4 + .align 4 +range: + .long 1124073471 + .long 1126039552 + .type range,@object + .size range,8 + .align 4 +_inf_zero: + .long 2139095040 + .long 0 + .type _inf_zero,@object + .size _inf_zero,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/exp2l.S b/external/sgx_libm/intel64/exp2l.S new file mode 100644 index 0000000000..4bd828bf77 --- /dev/null +++ b/external/sgx_libm/intel64/exp2l.S @@ -0,0 +1,683 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp2l.c" + .text +..TXTST0: +# -- Begin exp2l + .text + .align 16,0x90 + .globl exp2l +exp2l: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_exp2l.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %r8b, %r8b +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movb 105(%rsp), %cl + lea _ranges(%rip), %rdx + andb $-128, %cl + shrb $7, %cl + movzbl %cl, %edi + movq %rdi, %rsi + shlq $4, %rsi + movzwl 104(%rsp), %ecx + andl $32767, %ecx + movzwl 8(%rsi,%rdx), %eax + andl $32767, %eax + cmpl %eax, %ecx + jl ..B1.8 +..B1.4: + jne ..B1.39 +..B1.5: + movl 100(%rsp), %eax + cmpl 4(%rsi,%rdx), %eax + jb ..B1.8 +..B1.6: + jne ..B1.39 +..B1.7: + movl 96(%rsp), %eax + cmpl (%rsi,%rdx), %eax + jae ..B1.39 +..B1.8: + movzwl 82(%rsp), %edx + cmpl $16369, %ecx + jge ..B1.19 +..B1.9: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.13 +..B1.10: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.11: + fldcw 80(%rsp) +..B1.12: + movzwl 104(%rsp), %ecx + movb $1, %r8b + andl $32767, %ecx +..B1.13: + fldt 96(%rsp) + cmpl $16316, %ecx + fstpt 16(%rsp) + jge ..B1.15 +..B1.14: + fldt .L_2il0floatpacket.0(%rip) + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.16 +..B1.15: + fldt 16(%rsp) + lea 48+_P1(%rip), %rax + fld %st(0) + lea 32+_P1(%rip), %rcx + lea 16+_P1(%rip), %rdx + lea _P1(%rip), %rsi + fmul %st(1), %st + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.16: + testb %r8b, %r8b + je ..B1.18 +..B1.17: + fldcw 82(%rsp) +..B1.18: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.19: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.23 +..B1.20: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.21: + fldcw 80(%rsp) +..B1.22: + movzwl 104(%rsp), %ecx + movb $1, %r8b + andl $32767, %ecx +..B1.23: + fldt .L_2il0floatpacket.0(%rip) + cmpl $16383, %ecx + fstpt 64(%rsp) + jl ..B1.30 +..B1.24: + fldt 96(%rsp) + lea _TWO_63H(%rip), %rax + cmpl $0, 96(%rsp) + fldl (%rax) + jne ..B1.31 +..B1.25: + negl %ecx + movl $-1, %eax + addl $30, %ecx + shll %cl, %eax + testl %eax, 100(%rsp) + jne ..B1.31 +..B1.26: + fld %st(1) + fadd %st(1), %st + fstpt 48(%rsp) + movl 48(%rsp), %eax + cmpl $-16382, %eax + jl ..B1.31 +..B1.27: + fstp %st(0) + fstp %st(0) + addl $16383, %eax + movzwl 8+.L_2il0floatpacket.0(%rip), %edx + andl $32767, %eax + andl $-32768, %edx + orl %eax, %edx + movw %dx, 72(%rsp) + testb %r8b, %r8b + je ..B1.29 +..B1.28: + fldcw 82(%rsp) +..B1.29: + fldt 64(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.30: + fldt 96(%rsp) + lea _TWO_63H(%rip), %rax + fldl (%rax) +..B1.31: + fldt .L_2il0floatpacket.1(%rip) + lea _TWO_48H(%rip), %rcx + fmul %st(2), %st + lea SC2_BIAS(%rip), %r9 + movzwl 72(%rsp), %r11d + fadd %st(1), %st + fstpt 48(%rsp) + fldt 48(%rsp) + andl $-32768, %r11d + movl 48(%rsp), %edx + fsubp %st, %st(1) + fldt .L_2il0floatpacket.2(%rip) + fmulp %st, %st(1) + movsbq %dl, %rax + fsubr %st(1), %st + fldl (%rcx) + movl %eax, %r10d + fld %st(0) + negl %r10d + addl %edx, %r10d + lea 48+_P(%rip), %rcx + shrl $8, %r10d + addl $4196735, %edx + addl (%r9,%rdi,4), %r10d + lea 80+_P(%rip), %rdi + lea 64+_P(%rip), %r9 + andl $32767, %r10d + orl %r10d, %r11d + lea 32+_P(%rip), %r10 + movw %r11w, 72(%rsp) + lea _P(%rip), %r11 + shlq $4, %rax + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + cmpl $3070, %edx + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fldt (%rdi) + lea 16+_P(%rip), %rdi + fmul %st(1), %st + fldt (%rcx) + lea 96+_P(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + movq __libm_expl_table_256@GOTPCREL(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r11) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt (%rcx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(1) + fldl 2048(%rdi,%rax) + fld %st(0) + fmul %st(3), %st + fxch %st(2) + fadd %st, %st(3) + fmul %st(1), %st + faddp %st, %st(1) + fxch %st(2) + fmull 2056(%rdi,%rax) + faddp %st, %st(1) + faddl 2056(%rdi,%rax) + ja ..B1.34 +..B1.32: + lea _exp2but(%rip), %rax + fldt (%rax) + fcomip %st(3), %st + jbe ..B1.34 +..B1.33: + fstp %st(2) + fld %st(0) + lea _TWO_12H(%rip), %rax + lea _SC2(%rip), %rdx + fadd %st(2), %st + fldl (%rax) + fmul %st(1), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt (%rsi,%rdx) + fldt 64(%rsp) + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B1.35 +..B1.34: + fstp %st(2) + fldt 64(%rsp) + fxch %st(2) + faddp %st, %st(1) + lea _SC2(%rip), %rax + fmulp %st, %st(1) + fldt (%rsi,%rax) + fmulp %st, %st(1) + fstpt 32(%rsp) +..B1.35: + fldt 32(%rsp) + lea _minnorm(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + ja ..B1.48 +..B1.36: + testb %r8b, %r8b + je ..B1.38 +..B1.37: + fldt 16(%rsp) + fstpt 48(%rsp) +..B1.58: + fldcw 82(%rsp) +..B1.38: + fldt 32(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.39: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.40: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.41: + fldcw 80(%rsp) +..B1.42: + movzwl 104(%rsp), %ecx + movb $1, %r8b + andl $32767, %ecx +..B1.43: + cmpl $32767, %ecx + je ..B1.49 +..B1.44: + testq %rdi, %rdi + je ..B1.46 +..B1.45: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.46: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st +..B1.47: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.48: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.36 +..B1.49: + cmpl $-2147483648, 100(%rsp) + jne ..B1.52 +..B1.50: + cmpl $0, 96(%rsp) + jne ..B1.52 +..B1.51: + lea _inf_zeros(%rip), %rax + fldl (%rax,%rdi,8) + fstpt 16(%rsp) + jmp ..B1.53 +..B1.52: + fldt 96(%rsp) + fstpt 16(%rsp) +..B1.53: + testb %r8b, %r8b + je ..B1.55 +..B1.54: + fldcw 82(%rsp) +..B1.55: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type exp2l,@function + .size exp2l,.-exp2l + .data +# -- End exp2l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf7,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +SC2_BIAS: + .long 8191 + .long 24575 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .align 2 +_ranges: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16397 + .word 0 + .word 0 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 32894 + .word 16397 + .word 0 + .word 0 + .word 0 + .type _ranges,@object + .size _ranges,32 + .align 2 +_P1: + .word 31148 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30019 + .word 5676 + .word 61436 + .word 62973 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 31705 + .word 37440 + .word 18104 + .word 58200 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 59309 + .word 6415 + .word 23422 + .word 40341 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,64 + .align 2 +_P: + .word 12039 + .word 52575 + .word 36475 + .word 49086 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 30020 + .word 5676 + .word 61436 + .word 62973 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 64966 + .word 9463 + .word 18104 + .word 58200 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 46891 + .word 53866 + .word 23421 + .word 40341 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 12114 + .word 63546 + .word 699 + .word 44740 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 63250 + .word 29232 + .word 35994 + .word 41348 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45426 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,112 + .align 2 +_exp2but: + .word 0 + .word 0 + .word 0 + .word 65528 + .word 49164 + .word 0 + .word 0 + .word 0 + .type _exp2but,@object + .size _exp2but,16 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _SC2,@object + .size _SC2,32 + .align 2 +_minnorm: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _minnorm,@object + .size _minnorm,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/exp_gen.S b/external/sgx_libm/intel64/exp_gen.S new file mode 100644 index 0000000000..f79846d22c --- /dev/null +++ b/external/sgx_libm/intel64/exp_gen.S @@ -0,0 +1,604 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp_gen.c" + .text +..TXTST0: +# -- Begin exp + .text + .align 16,0x90 + .globl exp +exp: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_exp.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) +..B1.2: + unpcklpd %xmm0, %xmm0 + movapd cv(%rip), %xmm1 + movapd Shifter(%rip), %xmm6 + movapd 16+cv(%rip), %xmm2 + movapd 32+cv(%rip), %xmm3 + pextrw $3, %xmm0, %eax + andl $32767, %eax + movl $16527, %edx + subl %eax, %edx + subl $15504, %eax + orl %eax, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_0.0.2 + lea Tbl_addr(%rip), %r8 + mulpd %xmm0, %xmm1 + addpd %xmm6, %xmm1 + movapd %xmm1, %xmm7 + subpd %xmm6, %xmm1 + mulpd %xmm1, %xmm2 + movapd 64+cv(%rip), %xmm4 + mulpd %xmm1, %xmm3 + movapd 80+cv(%rip), %xmm5 + subpd %xmm2, %xmm0 + movd %xmm7, %eax + movl %eax, %ecx + andl $63, %ecx + shll $4, %ecx + sarl $6, %eax + movl %eax, %edx + movdqa mmask(%rip), %xmm6 + pand %xmm6, %xmm7 + movdqa bias(%rip), %xmm6 + paddq %xmm6, %xmm7 + psllq $46, %xmm7 + subpd %xmm3, %xmm0 + movapd (%rcx,%r8), %xmm2 + mulpd %xmm0, %xmm4 + movapd %xmm0, %xmm6 + movapd %xmm0, %xmm1 + mulpd %xmm6, %xmm6 + mulpd %xmm6, %xmm0 + addpd %xmm4, %xmm5 + mulsd %xmm6, %xmm0 + mulpd 48+cv(%rip), %xmm6 + addsd %xmm2, %xmm1 + unpckhpd %xmm2, %xmm2 + mulpd %xmm5, %xmm0 + addsd %xmm0, %xmm1 + orpd %xmm7, %xmm2 + unpckhpd %xmm0, %xmm0 + addsd %xmm1, %xmm0 + addsd %xmm6, %xmm0 + addl $894, %edx + cmpl $1916, %edx + ja .L_2TAG_PACKET_1.0.2 + mulsd %xmm2, %xmm0 + addsd %xmm2, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_1.0.2: + xorpd %xmm3, %xmm3 + movapd ALLONES(%rip), %xmm4 + movl $-1022, %edx + subl %eax, %edx + movd %edx, %xmm5 + psllq %xmm5, %xmm4 + movl %eax, %ecx + sarl $1, %eax + pinsrw $3, %eax, %xmm3 + movapd ebias(%rip), %xmm6 + psllq $4, %xmm3 + psubd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + cmpl $52, %edx + jg .L_2TAG_PACKET_2.0.2 + andpd %xmm2, %xmm4 + paddd %xmm6, %xmm3 + subsd %xmm4, %xmm2 + addsd %xmm2, %xmm0 + cmpl $1023, %ecx + jge .L_2TAG_PACKET_3.0.2 + pextrw $3, %xmm0, %ecx + andl $32768, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_4.0.2 + movapd %xmm0, %xmm6 + addsd %xmm4, %xmm0 + mulsd %xmm3, %xmm0 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $0, %ecx + je .L_2TAG_PACKET_5.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm4 + movsd %xmm6, %xmm0 + pxor %xmm4, %xmm6 + psrad $31, %xmm6 + pshufd $85, %xmm6, %xmm6 + psllq $1, %xmm0 + psrlq $1, %xmm0 + pxor %xmm6, %xmm0 + psrlq $63, %xmm6 + paddq %xmm6, %xmm0 + paddq %xmm4, %xmm0 + movl $15, (%rsp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_4.0.2: + addsd %xmm4, %xmm0 + mulsd %xmm3, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_3.0.2: + addsd %xmm4, %xmm0 + mulsd %xmm3, %xmm0 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + cmpl $32752, %ecx + jnb .L_2TAG_PACKET_7.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_2.0.2: + paddd %xmm6, %xmm3 + addpd %xmm2, %xmm0 + mulsd %xmm3, %xmm0 + movl $15, (%rsp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_8.0.2: + cmpl $2146435072, %eax + jae .L_2TAG_PACKET_9.0.2 + movl 12(%rsp), %eax + cmpl $-2147483648, %eax + jae .L_2TAG_PACKET_10.0.2 + movsd XMAX(%rip), %xmm0 + mulsd %xmm0, %xmm0 +.L_2TAG_PACKET_7.0.2: + movl $14, (%rsp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_10.0.2: + movsd XMIN(%rip), %xmm0 + mulsd %xmm0, %xmm0 + movl $15, (%rsp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_9.0.2: + movl 8(%rsp), %edx + cmpl $2146435072, %eax + ja .L_2TAG_PACKET_11.0.2 + cmpl $0, %edx + jne .L_2TAG_PACKET_11.0.2 + movl 12(%rsp), %eax + cmpl $2146435072, %eax + jne .L_2TAG_PACKET_12.0.2 + movsd INF(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_12.0.2: + movsd ZERO(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_11.0.2: + movsd 8(%rsp), %xmm0 + addsd %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movl 12(%rsp), %eax + andl $2147483647, %eax + cmpl $1083179008, %eax + jae .L_2TAG_PACKET_8.0.2 + movsd 8(%rsp), %xmm0 + addsd ONE_val(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_6.0.2: + movsd %xmm0, 16(%rsp) +..B1.3: + movq 16(%rsp), %xmm0 +.L_2TAG_PACKET_13.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type exp,@function + .size exp,.-exp + .data +# -- End exp + .section .rodata, "a" + .align 16 + .align 16 +cv: + .long 1697350398 + .long 1079448903 + .long 1697350398 + .long 1079448903 + .long 4277796864 + .long 1065758274 + .long 4277796864 + .long 1065758274 + .long 3164486458 + .long 1025308570 + .long 3164486458 + .long 1025308570 + .long 4294967294 + .long 1071644671 + .long 4294967294 + .long 1071644671 + .long 3811088480 + .long 1062650204 + .long 1432067621 + .long 1067799893 + .long 3230715663 + .long 1065423125 + .long 1431604129 + .long 1069897045 + .type cv,@object + .size cv,96 + .align 16 +Shifter: + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .type Shifter,@object + .size Shifter,16 + .align 16 +Tbl_addr: + .long 0 + .long 0 + .long 0 + .long 0 + .long 235107661 + .long 1018002367 + .long 1048019040 + .long 11418 + .long 896005651 + .long 1015861842 + .long 3541402996 + .long 22960 + .long 1642514529 + .long 1012987726 + .long 410360776 + .long 34629 + .long 1568897900 + .long 1016568486 + .long 1828292879 + .long 46424 + .long 1882168529 + .long 1010744893 + .long 852742562 + .long 58348 + .long 509852888 + .long 1017336174 + .long 3490863952 + .long 70401 + .long 653277307 + .long 1017431380 + .long 2930322911 + .long 82586 + .long 1649557430 + .long 1017729363 + .long 1014845818 + .long 94904 + .long 1058231231 + .long 1015777676 + .long 3949972341 + .long 107355 + .long 1044000607 + .long 1016786167 + .long 828946858 + .long 119943 + .long 1151779725 + .long 1015705409 + .long 2288159958 + .long 132667 + .long 3819481236 + .long 1016499965 + .long 1853186616 + .long 145530 + .long 2552227826 + .long 1015039787 + .long 1709341917 + .long 158533 + .long 1829350193 + .long 1015216097 + .long 4112506593 + .long 171677 + .long 1913391795 + .long 1015756674 + .long 2799960843 + .long 184965 + .long 1303423926 + .long 1015238005 + .long 171030293 + .long 198398 + .long 1574172746 + .long 1016061241 + .long 2992903935 + .long 211976 + .long 3424156969 + .long 1017196428 + .long 926591434 + .long 225703 + .long 1938513547 + .long 1017631273 + .long 887463926 + .long 239579 + .long 2804567149 + .long 1015390024 + .long 1276261410 + .long 253606 + .long 631083525 + .long 1017690182 + .long 569847337 + .long 267786 + .long 1623370770 + .long 1011049453 + .long 1617004845 + .long 282120 + .long 3667985273 + .long 1013894369 + .long 3049340112 + .long 296610 + .long 3145379760 + .long 1014403278 + .long 3577096743 + .long 311258 + .long 2603100681 + .long 1017152460 + .long 1990012070 + .long 326066 + .long 3249202951 + .long 1017448880 + .long 1453150081 + .long 341035 + .long 419288974 + .long 1016280325 + .long 917841882 + .long 356167 + .long 3793507337 + .long 1016095713 + .long 3712504873 + .long 371463 + .long 728023093 + .long 1016345318 + .long 363667784 + .long 386927 + .long 2582678538 + .long 1017123460 + .long 2956612996 + .long 402558 + .long 7592966 + .long 1016721543 + .long 2186617380 + .long 418360 + .long 228611441 + .long 1016696141 + .long 1719614412 + .long 434334 + .long 2261665670 + .long 1017457593 + .long 1013258798 + .long 450482 + .long 544148907 + .long 1017323666 + .long 3907805043 + .long 466805 + .long 2383914918 + .long 1017143586 + .long 1447192520 + .long 483307 + .long 1176412038 + .long 1017267372 + .long 1944781190 + .long 499988 + .long 2882956373 + .long 1013312481 + .long 919555682 + .long 516851 + .long 3154077648 + .long 1016528543 + .long 2571947538 + .long 533897 + .long 348651999 + .long 1016405780 + .long 2604962540 + .long 551129 + .long 3253791412 + .long 1015920431 + .long 1110089947 + .long 568549 + .long 1509121860 + .long 1014756995 + .long 2568320822 + .long 586158 + .long 2617649212 + .long 1017340090 + .long 2966275556 + .long 603959 + .long 553214634 + .long 1016457425 + .long 2682146383 + .long 621954 + .long 730975783 + .long 1014083580 + .long 2191782032 + .long 640145 + .long 1486499517 + .long 1016818996 + .long 2069751140 + .long 658534 + .long 2595788928 + .long 1016407932 + .long 2990417244 + .long 677123 + .long 1853053619 + .long 1015310724 + .long 1434058175 + .long 695915 + .long 2462790535 + .long 1015814775 + .long 2572866477 + .long 714911 + .long 3693944214 + .long 1017259110 + .long 3092190714 + .long 734114 + .long 2979333550 + .long 1017188654 + .long 4076559942 + .long 753526 + .long 174054861 + .long 1014300631 + .long 2420883922 + .long 773150 + .long 816778419 + .long 1014197934 + .long 3716502172 + .long 792987 + .long 3507050924 + .long 1015341199 + .long 777507147 + .long 813041 + .long 1821514088 + .long 1013410604 + .long 3706687593 + .long 833312 + .long 920623539 + .long 1016295433 + .long 1242007931 + .long 853805 + .long 2789017511 + .long 1014276997 + .long 3707479175 + .long 874520 + .long 3586233004 + .long 1015962192 + .long 64696965 + .long 895462 + .long 474650514 + .long 1016642419 + .long 863738718 + .long 916631 + .long 1614448851 + .long 1014281732 + .long 3884662774 + .long 938030 + .long 2450082086 + .long 1016164135 + .long 2728693977 + .long 959663 + .long 1101668360 + .long 1015989180 + .long 3999357479 + .long 981531 + .long 835814894 + .long 1015702697 + .long 1533953344 + .long 1003638 + .long 1301400989 + .long 1014466875 + .long 2174652632 + .long 1025985 + .type Tbl_addr,@object + .size Tbl_addr,1024 + .align 16 +mmask: + .long 4294967232 + .long 0 + .long 4294967232 + .long 0 + .type mmask,@object + .size mmask,16 + .align 16 +bias: + .long 65472 + .long 0 + .long 65472 + .long 0 + .type bias,@object + .size bias,16 + .align 16 +ALLONES: + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .type ALLONES,@object + .size ALLONES,16 + .align 16 +ebias: + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .type ebias,@object + .size ebias,16 + .align 4 +XMAX: + .long 4294967295 + .long 2146435071 + .type XMAX,@object + .size XMAX,8 + .align 4 +XMIN: + .long 0 + .long 1048576 + .type XMIN,@object + .size XMIN,8 + .align 4 +INF: + .long 0 + .long 2146435072 + .type INF,@object + .size INF,8 + .align 4 +ZERO: + .long 0 + .long 0 + .type ZERO,@object + .size ZERO,8 + .align 4 +ONE_val: + .long 0 + .long 1072693248 + .type ONE_val,@object + .size ONE_val,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/exp_table.S b/external/sgx_libm/intel64/exp_table.S new file mode 100644 index 0000000000..54de6cac65 --- /dev/null +++ b/external/sgx_libm/intel64/exp_table.S @@ -0,0 +1,515 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "exp_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_exp_hi_table_64 +__libm_exp_hi_table_64: + .long 0x667f3c00,0x3fe6a09e + .long 0x3c651a40,0x3fe6dfb2 + .long 0xe8ec5f80,0x3fe71f75 + .long 0x56426800,0x3fe75feb + .long 0x73eb01c0,0x3fe7a114 + .long 0x36cf4e80,0x3fe7e2f3 + .long 0x994cce20,0x3fe82589 + .long 0x9b449300,0x3fe868d9 + .long 0x422aa0e0,0x3fe8ace5 + .long 0x99157740,0x3fe8f1ae + .long 0xb0cdc600,0x3fe93737 + .long 0x9fde4e60,0x3fe97d82 + .long 0x82a3f0a0,0x3fe9c491 + .long 0x7b5de580,0x3fea0c66 + .long 0xb23e2560,0x3fea5503 + .long 0x5579fdc0,0x3fea9e6b + .long 0x995ad3c0,0x3feae89f + .long 0xb84f1600,0x3feb33a2 + .long 0xf2fb5e60,0x3feb7f76 + .long 0x904bc1e0,0x3febcc1e + .long 0xdd8552a0,0x3fec199b + .long 0x2e57d150,0x3fec67f1 + .long 0xdcef9070,0x3fecb720 + .long 0x4a078980,0x3fed072d + .long 0xdcfba490,0x3fed5818 + .long 0x03db3290,0x3feda9e6 + .long 0x337b9b60,0x3fedfc97 + .long 0xe78b3ff8,0x3fee502e + .long 0xa2a490e0,0x3feea4af + .long 0xee615a28,0x3feefa1b + .long 0x5b6e4544,0x3fef5076 + .long 0x819e90da,0x3fefa7c1 + .long 0x00000000,0x3ff00000 + .long 0x3e778060,0x3ff02c9a + .long 0xd3158574,0x3ff059b0 + .long 0x18759bc8,0x3ff08745 + .long 0x6cf9890c,0x3ff0b558 + .long 0x32d3d1a0,0x3ff0e3ec + .long 0xd0125b50,0x3ff11301 + .long 0xaea92dd8,0x3ff1429a + .long 0x3c7d5178,0x3ff172b8 + .long 0xeb6fcb70,0x3ff1a35b + .long 0x3168b9a8,0x3ff1d487 + .long 0x88628cd0,0x3ff2063b + .long 0x6e756230,0x3ff2387a + .long 0x65e27cd0,0x3ff26b45 + .long 0xf51fdee0,0x3ff29e9d + .long 0xa6e40300,0x3ff2d285 + .long 0x0a31b710,0x3ff306fe + .long 0xb26416f0,0x3ff33c08 + .long 0x373aa9c0,0x3ff371a7 + .long 0x34e59ff0,0x3ff3a7db + .long 0x4c123420,0x3ff3dea6 + .long 0x21f72e20,0x3ff4160a + .long 0x60618920,0x3ff44e08 + .long 0xb5c13cc0,0x3ff486a2 + .long 0xd5362a20,0x3ff4bfda + .long 0x769d2ca0,0x3ff4f9b2 + .long 0x569d4f80,0x3ff5342b + .long 0x36b527c0,0x3ff56f47 + .long 0xdd485420,0x3ff5ab07 + .long 0x15ad2140,0x3ff5e76f + .long 0xb03a5580,0x3ff6247e + .long 0x82552220,0x3ff66238 + .long 0x667f3bc0,0x3ff6a09e + .type __libm_exp_hi_table_64,@object + .size __libm_exp_hi_table_64,520 + .align 8 + .globl __libm_exp_mi_table_64 +__libm_exp_mi_table_64: + .long 0x33018800,0xbfd2bec3 + .long 0x8735cb80,0xbfd2409b + .long 0x2e274100,0xbfd1c114 + .long 0x537b3000,0xbfd14029 + .long 0x1829fc80,0xbfd0bdd7 + .long 0x92616300,0xbfd03a19 + .long 0x9accc780,0xbfcf69d9 + .long 0x92edb400,0xbfce5c99 + .long 0xf7557c80,0xbfcd4c6a + .long 0x9baa2300,0xbfcc3945 + .long 0x3cc8e800,0xbfcb2321 + .long 0x8086c680,0xbfca09f5 + .long 0xf5703d80,0xbfc8edb9 + .long 0x12886a00,0xbfc7ce66 + .long 0x37076a80,0xbfc6abf1 + .long 0xaa180900,0xbfc58652 + .long 0x9a94b100,0xbfc45d81 + .long 0x1ec3a800,0xbfc33175 + .long 0x34128680,0xbfc20224 + .long 0xbed0f880,0xbfc0cf85 + .long 0x13d56b00,0xbfbf3321 + .long 0x8d417580,0xbfbcc076 + .long 0x18837c80,0xbfba46f9 + .long 0xafc3b400,0xbfb7c695 + .long 0x1822db80,0xbfb53f39 + .long 0xe1266b80,0xbfb2b0cf + .long 0x64232500,0xbfb01b46 + .long 0x874c0080,0xbfaafd11 + .long 0xd5b6f200,0xbfa5b505 + .long 0x19ea5d80,0xbfa05e41 + .long 0x92375780,0xbf95f134 + .long 0x985bc980,0xbf860f9f + .long 0x00000000,0x00000000 + .long 0x3bc03000,0x3f864d1f + .long 0xc5615d00,0x3f966c34 + .long 0x0eb37900,0x3fa0e8a3 + .long 0x9f312180,0x3fa6ab0d + .long 0x5a7a3400,0x3fac7d86 + .long 0x0125b500,0x3fb1301d + .long 0xea92dd80,0x3fb429aa + .long 0xc7d51780,0x3fb72b83 + .long 0xb6fcb700,0x3fba35be + .long 0x168b9a80,0x3fbd4873 + .long 0x43146680,0x3fc031dc + .long 0x73ab1180,0x3fc1c3d3 + .long 0x2f13e680,0x3fc35a2b + .long 0xa8fef700,0x3fc4f4ef + .long 0x37201800,0x3fc6942d + .long 0x518db880,0x3fc837f0 + .long 0x9320b780,0x3fc9e045 + .long 0xb9d54e00,0x3fcb8d39 + .long 0xa72cff80,0x3fcd3ed9 + .long 0x6091a100,0x3fcef532 + .long 0x87dcb880,0x3fd05828 + .long 0x81862480,0x3fd13821 + .long 0xd704f300,0x3fd21a8a + .long 0x54d8a880,0x3fd2ff6b + .long 0xda74b280,0x3fd3e6c9 + .long 0x5a753e00,0x3fd4d0ad + .long 0xdad49f00,0x3fd5bd1c + .long 0x75215080,0x3fd6ac1f + .long 0x56b48500,0x3fd79dbc + .long 0xc0e95600,0x3fd891fa + .long 0x09548880,0x3fd988e2 + .long 0x99fcef00,0x3fda8279 + .type __libm_exp_mi_table_64,@object + .size __libm_exp_mi_table_64,520 + .align 8 + .globl __libm_exp_lo_table_64 +__libm_exp_lo_table_64: + .long 0x682764c9,0xbcf9b7ba + .long 0x1d341e44,0xbce10ddf + .long 0x1e1a21ea,0xbcd845b9 + .long 0xb2ae62dc,0xbcfba048 + .long 0x77ee0499,0xbcfc9415 + .long 0xfd45ea87,0xbcedefa2 + .long 0xeea0a997,0xbcdaea60 + .long 0xe26f53db,0xbce37f1b + .long 0xea979b4e,0xbcc29160 + .long 0xb17471a2,0xbcd3a8cf + .long 0xe3c0dabf,0xbceb0baf + .long 0x6df06e17,0xbce07461 + .long 0x729f1c1b,0xbcdfc707 + .long 0x25747355,0xbceb4d65 + .long 0xdb71a83c,0xbcbba5ed + .long 0x78840167,0xbc97829b + .long 0xcb2e88ce,0xbce2a178 + .long 0xbc6109ae,0xbcc42500 + .long 0x4f7e54ac,0xbce91558 + .long 0xbe174986,0xbcdbb708 + .long 0xa76afb72,0xbcbeeef9 + .long 0x200b7c35,0xbcc2d77b + .long 0xd0b85ad9,0xbccbabf0 + .long 0x743797aa,0xbcc1cbc3 + .long 0xf4a29324,0xbcd1b44b + .long 0xfcb49256,0xbcd51ee7 + .long 0x53c612d7,0xbca46973 + .long 0xcfeac66e,0xbcad8c2e + .long 0x3179c289,0xbcc9e9c2 + .long 0xbcada4a8,0xbc911c05 + .long 0xda44ebcf,0xbcbcc583 + .long 0x818b4d9c,0xbcad16f5 + .long 0x00000000,0x00000000 + .long 0x95949ef4,0x3cadcdef + .long 0xa475b465,0x3c8d73e2 + .long 0x4bb284ff,0x3c6186be + .long 0xc95b8c21,0x3ccb14c5 + .long 0x1727c57b,0x3cc0103a + .long 0xe35db263,0x3ca49d77 + .long 0x0650ec96,0x3cdecd04 + .long 0xe4628759,0x3cc6e6fb + .long 0x63da4b47,0x3cd4f2da + .long 0xc0144c88,0x3cc3c02d + .long 0xac0a5425,0x3cd8ee3b + .long 0xf5b6382c,0x3ce0cd83 + .long 0xce6503a7,0x3cea4af4 + .long 0x15f5a24b,0x3cb2c25d + .long 0x3aa6da0f,0x3ce68012 + .long 0x56918c17,0x3cd4b7a3 + .long 0x0c21b2cd,0x3cee9939 + .long 0xaa05e8a9,0x3ce54e28 + .long 0x24a67828,0x3cdba86f + .long 0x911f09ec,0x3cc1ada0 + .long 0x4b71e7b7,0x3ce3f086 + .long 0xde813be0,0x3cea0626 + .long 0xa3b69063,0x3cf013c1 + .long 0x5ebfb10c,0x3cdc750e + .long 0x62da6a82,0x3cdab4cf + .long 0x3c49d86a,0x3cbdf0a8 + .long 0xb004764f,0x3cfa66ec + .long 0x602a323d,0x3ce2b192 + .long 0xc9840733,0x3ce0dd37 + .long 0xe81bf4b7,0x3cd2c7c3 + .long 0x678a6e3d,0x3cd2449f + .long 0x5f626cdd,0x3ce92116 + .type __libm_exp_lo_table_64,@object + .size __libm_exp_lo_table_64,520 + .align 8 + .globl __libm_exp_table_128 +__libm_exp_table_128: + .long 0x908b2fb1,0x3def3bcc + .long 0x66600000,0x3fe6a09e + .long 0xdaed5330,0x3dd7b57d + .long 0x75000000,0x3fe6c012 + .long 0xc8838b30,0x3dc468bb + .long 0x3c600000,0x3fe6dfb2 + .long 0xcf87e1b5,0x3de19483 + .long 0xf9400000,0x3fe6ff7d + .long 0xba46e1e6,0x3dd8bee7 + .long 0xe8e00000,0x3fe71f75 + .long 0xf572693a,0x3dc605ce + .long 0x48a00000,0x3fe73f9a + .long 0xfb74d51a,0x3db33e45 + .long 0x56400000,0x3fe75feb + .long 0x619ae028,0x3dee5d3f + .long 0x4fc00000,0x3fe78069 + .long 0xafaa2048,0x3dd6030d + .long 0x73e00000,0x3fe7a114 + .long 0x7c493344,0x3de0c132 + .long 0x01200000,0x3fe7c1ed + .long 0x20ba0574,0x3dde9cc4 + .long 0x36c00000,0x3fe7e2f3 + .long 0xb60de676,0x3dee1a11 + .long 0x54200000,0x3fe80427 + .long 0x159f115f,0x3dd99c25 + .long 0x99400000,0x3fe82589 + .long 0x7297b5cc,0x3dbe3d66 + .long 0x46200000,0x3fe8471a + .long 0x03907643,0x3dc24bb2 + .long 0x9b400000,0x3fe868d9 + .long 0xcca6179c,0x3dd4cd32 + .long 0xd9800000,0x3fe88ac7 + .long 0xb74f8ab4,0x3dd541b6 + .long 0x42200000,0x3fe8ace5 + .long 0xef2aa1cd,0x3de5448b + .long 0x16a00000,0x3fe8cf32 + .long 0x2b982746,0x3de57736 + .long 0x99000000,0x3fe8f1ae + .long 0x88a61b47,0x3de1ffc5 + .long 0x0b800000,0x3fe9145b + .long 0xe8a0387e,0x3ddb8bc9 + .long 0xb0c00000,0x3fe93737 + .long 0xd36906d3,0x3dd0a41d + .long 0xcbc00000,0x3fe95a44 + .long 0x8b9e9210,0x3dee4e4f + .long 0x9fc00000,0x3fe97d82 + .long 0x74621372,0x3dd40f73 + .long 0x70c00000,0x3fe9a0f1 + .long 0xe3e23584,0x3dbf8480 + .long 0x82a00000,0x3fe9c491 + .long 0xc12653c7,0x3db91918 + .long 0x19e00000,0x3fe9e863 + .long 0xb29ada8c,0x3dede564 + .long 0x7b400000,0x3fea0c66 + .long 0xb182e3ef,0x3dd45a66 + .long 0xec400000,0x3fea309b + .long 0x8b424492,0x3dee255c + .long 0xb2200000,0x3fea5503 + .long 0x6f2dfb2b,0x3de0b358 + .long 0x13200000,0x3fea799e + .long 0x43eb243c,0x3de9fdbf + .long 0x55600000,0x3fea9e6b + .long 0xc0db966a,0x3de3f379 + .long 0xbfc00000,0x3feac36b + .long 0x5e8734d1,0x3dead3ad + .long 0x99400000,0x3feae89f + .long 0x2108559c,0x3ddb6ccb + .long 0x29800000,0x3feb0e07 + .long 0xed7fa1cf,0x3dde2bf5 + .long 0xb8400000,0x3feb33a2 + .long 0x38e20444,0x3dc564e6 + .long 0x8de00000,0x3feb5972 + .long 0xeaa7b082,0x3deb5e46 + .long 0xf2e00000,0x3feb7f76 + .long 0x40cb3c6b,0x3da06498 + .long 0x30a00000,0x3feba5b0 + .long 0x48f741e9,0x3dd783a4 + .long 0x90400000,0x3febcc1e + .long 0x8408d702,0x3de71e08 + .long 0x5bc00000,0x3febf2c2 + .long 0x88832c4b,0x3dc54a70 + .long 0xdd800000,0x3fec199b + .long 0x6d14df82,0x3defd07a + .long 0x5fe00000,0x3fec40ab + .long 0x4a2137fd,0x3de7d14b + .long 0x2e400000,0x3fec67f1 + .long 0x46b2f122,0x3dcb9ed4 + .long 0x94000000,0x3fec8f6d + .long 0x2a0797a4,0x3ddf20d2 + .long 0xdce00000,0x3fecb720 + .long 0xc44f8959,0x3dedc3f9 + .long 0x55400000,0x3fecdf0b + .long 0x343c8bc8,0x3dce25ee + .long 0x4a000000,0x3fed072d + .long 0x15bc2473,0x3ddb13e3 + .long 0x08000000,0x3fed2f87 + .long 0x25da05af,0x3deba487 + .long 0xdce00000,0x3fed5818 + .long 0x7709f3a1,0x3dd3072f + .long 0x16c00000,0x3fed80e3 + .long 0x708c01a6,0x3deb3285 + .long 0x03c00000,0x3feda9e6 + .long 0xb695de3c,0x3dab4604 + .long 0xf3000000,0x3fedd321 + .long 0xb968cac4,0x3deb9b5e + .long 0x33600000,0x3fedfc97 + .long 0xa12761fa,0x3de5a128 + .long 0x14e00000,0x3fee2646 + .long 0x4e7a2603,0x3dd67fec + .long 0xe7800000,0x3fee502e + .long 0x2d522ca1,0x3dcd320d + .long 0xfbc00000,0x3fee7a51 + .long 0x163dce86,0x3dc24366 + .long 0xa2a00000,0x3feea4af + .long 0x1b60625f,0x3ddccfe1 + .long 0x2d800000,0x3feecf48 + .long 0x71fd21a9,0x3da5a277 + .long 0xee600000,0x3feefa1b + .long 0x9d0d2df8,0x3dd7752e + .long 0x37600000,0x3fef252b + .long 0xce9f096f,0x3ddc8a80 + .long 0x5b600000,0x3fef5076 + .long 0x8913b4c0,0x3decbe13 + .long 0xad800000,0x3fef7bfd + .long 0x2e90a7e7,0x3dee90d8 + .long 0x81800000,0x3fefa7c1 + .long 0x12eb7496,0x3ddee3e2 + .long 0x2b800000,0x3fefd3c2 + .long 0x00000000,0x00000000 + .long 0x00000000,0x3ff00000 + .long 0x6d84a66b,0x3dfb3335 + .long 0xa9e00000,0x3ff0163d + .long 0xee6f7cad,0x3df78060 + .long 0x3e600000,0x3ff02c9a + .long 0x7ae71f34,0x3decff09 + .long 0xe8600000,0x3ff04315 + .long 0x3ae7c549,0x3df58574 + .long 0xd3000000,0x3ff059b0 + .long 0xc6dc403b,0x3dfdf6dd + .long 0x29c00000,0x3ff0706b + .long 0x08c35f26,0x3df59bc8 + .long 0x18600000,0x3ff08745 + .long 0x14878183,0x3ddbce0d + .long 0xcac00000,0x3ff09e3e + .long 0x6298b92b,0x3df9890f + .long 0x6ce00000,0x3ff0b558 + .long 0x407b705c,0x3df247f7 + .long 0x2b600000,0x3ff0cc92 + .long 0x020742e5,0x3df3d1a2 + .long 0x32c00000,0x3ff0e3ec + .long 0xf232091e,0x3dfed31a + .long 0xafe00000,0x3ff0fb66 + .long 0xa4ebbf1b,0x3df25b50 + .long 0xd0000000,0x3ff11301 + .long 0xf72575a6,0x3de86397 + .long 0xc0600000,0x3ff12abd + .long 0x66820328,0x3de25bbf + .long 0xaea00000,0x3ff1429a + .long 0x920355cf,0x3dd63944 + .long 0xc8a00000,0x3ff15a98 + .long 0xdcdf7c8c,0x3dfd517a + .long 0x3c600000,0x3ff172b8 + .long 0x777ee173,0x3de91bd3 + .long 0x38800000,0x3ff18af9 + .long 0x796d31ed,0x3def96ea + .long 0xeb600000,0x3ff1a35b + .long 0x6ac79cad,0x3dd1734e + .long 0x84000000,0x3ff1bbe0 + .long 0xf00b7005,0x3de17354 + .long 0x31600000,0x3ff1d487 + .long 0xb8819ff6,0x3dfcd91c + .long 0x22e00000,0x3ff1ed50 + .long 0xdc775815,0x3dc466b1 + .long 0x88600000,0x3ff2063b + .long 0x2552fd29,0x3dfddc96 + .long 0x91600000,0x3ff21f49 + .long 0x66c1fadb,0x3df56238 + .long 0x6e600000,0x3ff2387a + .long 0x3582ab7e,0x3df2a63f + .long 0x4fa00000,0x3ff251ce + .long 0x2bd33994,0x3dc3e6e9 + .long 0x65e00000,0x3ff26b45 + .long 0x96cf15cf,0x3df56380 + .long 0xe1e00000,0x3ff284df + .long 0x2c25d15f,0x3dffdee1 + .long 0xf5000000,0x3ff29e9d + .long 0xfddea465,0x3dfad98f + .long 0xd0c00000,0x3ff2b87f + .long 0x0024754e,0x3dd00c2d + .long 0xa6e00000,0x3ff2d285 + .long 0x11ca0f46,0x3dfe2f56 + .long 0xa9200000,0x3ff2ecaf + .long 0x2de8d5a4,0x3df1b715 + .long 0x0a200000,0x3ff306fe + .long 0x6a739e38,0x3de9b062 + .long 0xfc400000,0x3ff32170 + .long 0x32721843,0x3dd05bfd + .long 0xb2600000,0x3ff33c08 + .long 0xc9462347,0x3df29ff0 + .long 0x5f800000,0x3ff356c5 + .long 0xa7145503,0x3dfaa9ca + .long 0x37200000,0x3ff371a7 + .long 0x16a72c36,0x3dd76196 + .long 0x6d000000,0x3ff38cae + .long 0xa86f24a6,0x3dd67fdb + .long 0x34e00000,0x3ff3a7db + .long 0x84001f23,0x3df3a8e4 + .long 0xc3000000,0x3ff3c32d + .long 0x35b41224,0x3df23422 + .long 0x4c000000,0x3ff3dea6 + .long 0x417ee035,0x3de90037 + .long 0x04a00000,0x3ff3fa45 + .long 0xf84325b9,0x3df72e29 + .long 0x21e00000,0x3ff4160a + .long 0xdc704439,0x3df0a896 + .long 0xd9400000,0x3ff431f5 + .long 0x3136f40a,0x3db892d0 + .long 0x60600000,0x3ff44e08 + .long 0x72512f46,0x3dfd0057 + .long 0xed000000,0x3ff46a41 + .long 0x3c1a3b69,0x3db3cd01 + .long 0xb5c00000,0x3ff486a2 + .long 0x672d8bcf,0x3df7d3de + .long 0xf0c00000,0x3ff4a32a + .long 0x1d4397b0,0x3df62a27 + .long 0xd5200000,0x3ff4bfda + .long 0x63b36ef2,0x3dfddd0d + .long 0x99e00000,0x3ff4dcb2 + .long 0xad33d8b7,0x3dfd2ca6 + .long 0x76800000,0x3ff4f9b2 + .long 0x8225ea59,0x3deecc83 + .long 0xa2c00000,0x3ff516da + .long 0xdf0a83c5,0x3dfd4f81 + .long 0x56800000,0x3ff5342b + .long 0xc52ec620,0x3dfd920e + .long 0xca400000,0x3ff551a4 + .long 0x66ecb004,0x3df527da + .long 0x36a00000,0x3ff56f47 + .long 0x252bc2b7,0x3df7c7fd + .long 0xd4800000,0x3ff58d12 + .long 0xb192602a,0x3de0a852 + .long 0xdd400000,0x3ff5ab07 + .long 0x01c4b1b8,0x3df946b7 + .long 0x8a400000,0x3ff5c926 + .long 0xdd37c984,0x3dea4290 + .long 0x15a00000,0x3ff5e76f + .long 0xb076f593,0x3df6dc08 + .long 0xb9600000,0x3ff605e1 + .long 0xb1f0fa07,0x3dfa5584 + .long 0xb0200000,0x3ff6247e + .long 0x8edf0e2a,0x3de9863f + .long 0x34c00000,0x3ff64346 + .long 0x9127d9e3,0x3df52224 + .long 0x82400000,0x3ff66238 + .long 0x1038ae45,0x3de952e6 + .long 0xd4400000,0x3ff68155 + .long 0x908b2fb1,0x3dff3bcc + .long 0x66600000,0x3ff6a09e + .type __libm_exp_table_128,@object + .size __libm_exp_table_128,2064 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/expf_gen.S b/external/sgx_libm/intel64/expf_gen.S new file mode 100644 index 0000000000..cad669ec94 --- /dev/null +++ b/external/sgx_libm/intel64/expf_gen.S @@ -0,0 +1,721 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expf_gen.c" + .text +..TXTST0: +# -- Begin expf + .text + .align 16,0x90 + .globl expf +expf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_expf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 +..B1.2: + movss LOW_FLOAT_MASK(%rip), %xmm1 + movq log2e(%rip), %xmm3 + movq $0x4338000000000000, %rax + movd %rax, %xmm4 + andps %xmm0, %xmm1 + movd %xmm0, %ecx + cvtps2pd %xmm1, %xmm1 + andl $2147483647, %ecx + subl $830472192, %ecx + cmpl $288180587, %ecx + jae .L_2TAG_PACKET_0.0.2 + movq c2(%rip), %xmm6 + mulsd %xmm1, %xmm3 + movq %xmm4, %xmm2 + addsd %xmm3, %xmm4 + movq 8+c2(%rip), %xmm5 + movd %xmm4, %eax + subsd %xmm4, %xmm2 + movq $0x3ff0000000000000, %rdx + movd %rdx, %xmm1 + lea Th(%rip), %r11 + xorpd %xmm7, %xmm7 + movl %eax, %ecx + andl $255, %eax + movq (%r11,%rax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm7 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm7, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + addl $830472192, %ecx + cmpl $830472192, %ecx + jb .L_2TAG_PACKET_1.0.2 + cmpl $1124073472, %ecx + jae .L_2TAG_PACKET_2.0.2 + movq c2(%rip), %xmm6 + mulsd %xmm1, %xmm3 + movq %xmm4, %xmm2 + xorpd %xmm1, %xmm1 + addsd %xmm3, %xmm4 + movq 8+c2(%rip), %xmm5 + movd %xmm4, %eax + subsd %xmm4, %xmm2 + movl $16368, %edx + pinsrw $3, %edx, %xmm1 + lea Th(%rip), %r11 + xorpd %xmm7, %xmm7 + movl %eax, %ecx + andl $255, %eax + movq (%r11,%rax,8), %xmm0 + addsd %xmm2, %xmm3 + sarl $4, %ecx + andl $-16, %ecx + pinsrw $3, %ecx, %xmm7 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm1, %xmm5 + paddd %xmm7, %xmm0 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm0 + cvtpd2ps %xmm0, %xmm0 + movd %xmm0, %eax + cmpl $8388608, %eax + jb .L_2TAG_PACKET_3.0.2 + cmpl $2139095040, %eax + je .L_2TAG_PACKET_4.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_2.0.2: + movd %xmm0, %edx + cmpl $2139095040, %ecx + jae .L_2TAG_PACKET_5.0.2 + testl $-2147483648, %edx + je .L_2TAG_PACKET_4.0.2 + movl $8388608, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 +.L_2TAG_PACKET_3.0.2: + movl $17, (%rsp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_4.0.2: + movl $2130706432, %eax + movd %eax, %xmm0 + mulss %xmm0, %xmm0 + movl $16, (%rsp) + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_1.0.2: + movl $1065353216, %eax + movd %eax, %xmm1 + addss %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + cmpl $-8388608, %edx + je .L_2TAG_PACKET_7.0.2 + addss %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_7.0.2: + xorps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_6.0.2: + movss %xmm0, 4(%rsp) +..B1.3: + movss 4(%rsp), %xmm0 +.L_2TAG_PACKET_8.0.2: +..B1.5: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type expf,@function + .size expf,.-expf + .data +# -- End expf + .section .rodata, "a" + .align 16 + .align 16 +LOW_FLOAT_MASK: + .long 4294967295 + .type LOW_FLOAT_MASK,@object + .size LOW_FLOAT_MASK,4 + .space 4, 0x00 # pad + .align 8 +log2e: + .long 1697350398 + .long 1081546055 + .type log2e,@object + .size log2e,8 + .align 8 +c2: + .long 4286760334 + .long 1053736893 + .long 4277826245 + .long 1063661122 + .type c2,@object + .size c2,16 + .align 8 +Th: + .long 0 + .long 1072693248 + .long 4200250559 + .long 1072696090 + .long 2851812149 + .long 1072698941 + .long 339411585 + .long 1072701800 + .long 1048019041 + .long 1072704666 + .long 772914124 + .long 1072707540 + .long 3899555717 + .long 1072710421 + .long 1928746161 + .long 1072713311 + .long 3541402996 + .long 1072716208 + .long 238821257 + .long 1072719114 + .long 702412510 + .long 1072722027 + .long 728934454 + .long 1072724948 + .long 410360776 + .long 1072727877 + .long 4133881824 + .long 1072730813 + .long 3402036099 + .long 1072733758 + .long 2602514713 + .long 1072736711 + .long 1828292879 + .long 1072739672 + .long 1172597893 + .long 1072742641 + .long 728909815 + .long 1072745618 + .long 590962156 + .long 1072748603 + .long 852742562 + .long 1072751596 + .long 1608493509 + .long 1072754597 + .long 2952712987 + .long 1072757606 + .long 685187902 + .long 1072760624 + .long 3490863953 + .long 1072763649 + .long 2875075254 + .long 1072766683 + .long 3228316108 + .long 1072769725 + .long 351405227 + .long 1072772776 + .long 2930322912 + .long 1072775834 + .long 2471440686 + .long 1072778901 + .long 3366293073 + .long 1072781976 + .long 1416741826 + .long 1072785060 + .long 1014845819 + .long 1072788152 + .long 2257959872 + .long 1072791252 + .long 948735466 + .long 1072794361 + .long 1480023343 + .long 1072797478 + .long 3949972341 + .long 1072800603 + .long 4162030108 + .long 1072803737 + .long 2214878420 + .long 1072806880 + .long 2502433899 + .long 1072810031 + .long 828946858 + .long 1072813191 + .long 1588871207 + .long 1072816359 + .long 586995997 + .long 1072819536 + .long 2218315341 + .long 1072822721 + .long 2288159958 + .long 1072825915 + .long 897099801 + .long 1072829118 + .long 2440944790 + .long 1072832329 + .long 2725843665 + .long 1072835549 + .long 1853186616 + .long 1072838778 + .long 4219606026 + .long 1072842015 + .long 1337108031 + .long 1072845262 + .long 1897844341 + .long 1072848517 + .long 1709341917 + .long 1072851781 + .long 874372905 + .long 1072855054 + .long 3790955393 + .long 1072858335 + .long 1972484976 + .long 1072861626 + .long 4112506593 + .long 1072864925 + .long 1724976915 + .long 1072868234 + .long 3504003472 + .long 1072871551 + .long 964107055 + .long 1072874878 + .long 2799960843 + .long 1072878213 + .long 526652809 + .long 1072881558 + .long 2839424854 + .long 1072884911 + .long 1253935211 + .long 1072888274 + .long 171030293 + .long 1072891646 + .long 3991843581 + .long 1072895026 + .long 4232894513 + .long 1072898416 + .long 1000925746 + .long 1072901816 + .long 2992903935 + .long 1072905224 + .long 1726216749 + .long 1072908642 + .long 1603444721 + .long 1072912069 + .long 2732492859 + .long 1072915505 + .long 926591435 + .long 1072918951 + .long 589198666 + .long 1072922406 + .long 1829099622 + .long 1072925870 + .long 460407023 + .long 1072929344 + .long 887463927 + .long 1072932827 + .long 3219942644 + .long 1072936319 + .long 3272845541 + .long 1072939821 + .long 1156440435 + .long 1072943333 + .long 1276261410 + .long 1072946854 + .long 3743175029 + .long 1072950384 + .long 78413852 + .long 1072953925 + .long 3278348324 + .long 1072957474 + .long 569847338 + .long 1072961034 + .long 654919306 + .long 1072964603 + .long 3645941911 + .long 1072968181 + .long 1065662932 + .long 1072971770 + .long 1617004845 + .long 1072975368 + .long 1118294578 + .long 1072978976 + .long 3978100823 + .long 1072982593 + .long 1720398391 + .long 1072986221 + .long 3049340112 + .long 1072989858 + .long 3784486610 + .long 1072993505 + .long 4040676318 + .long 1072997162 + .long 3933059031 + .long 1073000829 + .long 3577096743 + .long 1073004506 + .long 3088564500 + .long 1073008193 + .long 2583551245 + .long 1073011890 + .long 2178460671 + .long 1073015597 + .long 1990012071 + .long 1073019314 + .long 2135241198 + .long 1073023041 + .long 2731501122 + .long 1073026778 + .long 3896463087 + .long 1073030525 + .long 1453150082 + .long 1073034283 + .long 4109806887 + .long 1073038050 + .long 3395129871 + .long 1073041828 + .long 3723038930 + .long 1073045616 + .long 917841882 + .long 1073049415 + .long 3689071823 + .long 1073053223 + .long 3566716925 + .long 1073057042 + .long 671025100 + .long 1073060872 + .long 3712504873 + .long 1073064711 + .long 4222122499 + .long 1073068561 + .long 2321106615 + .long 1073072422 + .long 2425981843 + .long 1073076293 + .long 363667784 + .long 1073080175 + .long 551349105 + .long 1073084067 + .long 3111574537 + .long 1073087969 + .long 3872257780 + .long 1073091882 + .long 2956612997 + .long 1073095806 + .long 488188413 + .long 1073099741 + .long 885834528 + .long 1073103686 + .long 4273770423 + .long 1073107641 + .long 2186617381 + .long 1073111608 + .long 3339203574 + .long 1073115585 + .long 3561793907 + .long 1073119573 + .long 2979960120 + .long 1073123572 + .long 1719614413 + .long 1073127582 + .long 4201977662 + .long 1073131602 + .long 1963711167 + .long 1073135634 + .long 3721688645 + .long 1073139676 + .long 1013258799 + .long 1073143730 + .long 2555984613 + .long 1073147794 + .long 4182873220 + .long 1073151869 + .long 1727278727 + .long 1073155956 + .long 3907805044 + .long 1073160053 + .long 2263535754 + .long 1073164162 + .long 1218806132 + .long 1073168282 + .long 903334909 + .long 1073172413 + .long 1447192521 + .long 1073176555 + .long 2980802057 + .long 1073180708 + .long 1339972927 + .long 1073184873 + .long 950803702 + .long 1073189049 + .long 1944781191 + .long 1073193236 + .long 158781403 + .long 1073197435 + .long 19972402 + .long 1073201645 + .long 1660913392 + .long 1073205866 + .long 919555682 + .long 1073210099 + .long 2224145553 + .long 1073214343 + .long 1413356050 + .long 1073218599 + .long 2916157145 + .long 1073222866 + .long 2571947539 + .long 1073227145 + .long 515457527 + .long 1073231436 + .long 1176749997 + .long 1073235738 + .long 396319521 + .long 1073240052 + .long 2604962541 + .long 1073244377 + .long 3643909174 + .long 1073248714 + .long 3649726105 + .long 1073253063 + .long 2759350287 + .long 1073257424 + .long 1110089947 + .long 1073261797 + .long 3134592888 + .long 1073266181 + .long 380978316 + .long 1073270578 + .long 1577608921 + .long 1073274986 + .long 2568320822 + .long 1073279406 + .long 3492293770 + .long 1073283838 + .long 194117574 + .long 1073288283 + .long 1403662306 + .long 1073292739 + .long 2966275557 + .long 1073297207 + .long 727685349 + .long 1073301688 + .long 3418903055 + .long 1073306180 + .long 2591453363 + .long 1073310685 + .long 2682146384 + .long 1073315202 + .long 3833209506 + .long 1073319731 + .long 1892288442 + .long 1073324273 + .long 1297350157 + .long 1073328827 + .long 2191782032 + .long 1073333393 + .long 424392917 + .long 1073337972 + .long 434316067 + .long 1073342563 + .long 2366108318 + .long 1073347166 + .long 2069751141 + .long 1073351782 + .long 3985553595 + .long 1073356410 + .long 3964284211 + .long 1073361051 + .long 2152073944 + .long 1073365705 + .long 2990417245 + .long 1073370371 + .long 2331271250 + .long 1073375050 + .long 321958744 + .long 1073379742 + .long 1405169241 + .long 1073384446 + .long 1434058175 + .long 1073389163 + .long 557149882 + .long 1073393893 + .long 3218338682 + .long 1073398635 + .long 977020788 + .long 1073403391 + .long 2572866477 + .long 1073408159 + .long 3861050111 + .long 1073412940 + .long 697153126 + .long 1073417735 + .long 1822067026 + .long 1073422542 + .long 3092190715 + .long 1073427362 + .long 364333489 + .long 1073432196 + .long 2380618042 + .long 1073437042 + .long 703710506 + .long 1073441902 + .long 4076559943 + .long 1073446774 + .long 4062661092 + .long 1073451660 + .long 815859274 + .long 1073456560 + .long 3080351519 + .long 1073461472 + .long 2420883922 + .long 1073466398 + .long 3287523847 + .long 1073471337 + .long 1540824585 + .long 1073476290 + .long 1631695677 + .long 1073481256 + .long 3716502172 + .long 1073486235 + .long 3657065772 + .long 1073491228 + .long 1610600570 + .long 1073496235 + .long 2029714210 + .long 1073501255 + .long 777507147 + .long 1073506289 + .long 2307442995 + .long 1073511336 + .long 2483480501 + .long 1073516397 + .long 1464976603 + .long 1073521472 + .long 3706687593 + .long 1073526560 + .long 778901109 + .long 1073531663 + .long 1432208378 + .long 1073536779 + .long 1532734324 + .long 1073541909 + .long 1242007932 + .long 1073547053 + .long 721996136 + .long 1073552211 + .long 135105010 + .long 1073557383 + .long 3939148246 + .long 1073562568 + .long 3707479175 + .long 1073567768 + .long 3898795731 + .long 1073572982 + .long 382305176 + .long 1073578211 + .long 1912561781 + .long 1073583453 + .long 64696965 + .long 1073588710 + .long 3594158869 + .long 1073593980 + .long 4076975200 + .long 1073599265 + .long 1679558232 + .long 1073604565 + .long 863738719 + .long 1073609879 + .long 1796832535 + .long 1073615207 + .long 351641897 + .long 1073620550 + .long 991358482 + .long 1073625907 + .long 3884662774 + .long 1073631278 + .long 610758006 + .long 1073636665 + .long 4224142467 + .long 1073642065 + .long 2009970496 + .long 1073647481 + .long 2728693978 + .long 1073652911 + .long 2256325230 + .long 1073658356 + .long 764307441 + .long 1073663816 + .long 2719515920 + .long 1073669290 + .long 3999357479 + .long 1073674779 + .long 481706282 + .long 1073680284 + .long 929806999 + .long 1073685803 + .long 1222472308 + .long 1073691337 + .long 1533953344 + .long 1073696886 + .long 2038973688 + .long 1073702450 + .long 2912730644 + .long 1073708029 + .long 35929225 + .long 1073713624 + .long 2174652632 + .long 1073719233 + .long 915592468 + .long 1073724858 + .long 730821105 + .long 1073730498 + .long 1797923801 + .long 1073736153 + .type Th,@object + .size Th,2048 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/expf_table.S b/external/sgx_libm/intel64/expf_table.S new file mode 100644 index 0000000000..dc6538a147 --- /dev/null +++ b/external/sgx_libm/intel64/expf_table.S @@ -0,0 +1,112 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expf_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_expf_table_64 +__libm_expf_table_64: + .long 0x667f3bcd,0x3fe6a09e + .long 0x3c651a2f,0x3fe6dfb2 + .long 0xe8ec5f74,0x3fe71f75 + .long 0x564267c9,0x3fe75feb + .long 0x73eb0187,0x3fe7a114 + .long 0x36cf4e62,0x3fe7e2f3 + .long 0x994cce13,0x3fe82589 + .long 0x9b4492ed,0x3fe868d9 + .long 0x422aa0db,0x3fe8ace5 + .long 0x99157736,0x3fe8f1ae + .long 0xb0cdc5e5,0x3fe93737 + .long 0x9fde4e50,0x3fe97d82 + .long 0x82a3f090,0x3fe9c491 + .long 0x7b5de565,0x3fea0c66 + .long 0xb23e255d,0x3fea5503 + .long 0x5579fdbf,0x3fea9e6b + .long 0x995ad3ad,0x3feae89f + .long 0xb84f15fb,0x3feb33a2 + .long 0xf2fb5e47,0x3feb7f76 + .long 0x904bc1d2,0x3febcc1e + .long 0xdd85529c,0x3fec199b + .long 0x2e57d14b,0x3fec67f1 + .long 0xdcef9069,0x3fecb720 + .long 0x4a07897c,0x3fed072d + .long 0xdcfba487,0x3fed5818 + .long 0x03db3285,0x3feda9e6 + .long 0x337b9b5f,0x3fedfc97 + .long 0xe78b3ff6,0x3fee502e + .long 0xa2a490da,0x3feea4af + .long 0xee615a27,0x3feefa1b + .long 0x5b6e4540,0x3fef5076 + .long 0x819e90d8,0x3fefa7c1 + .long 0x00000000,0x3ff00000 + .long 0x3e778061,0x3ff02c9a + .long 0xd3158574,0x3ff059b0 + .long 0x18759bc8,0x3ff08745 + .long 0x6cf9890f,0x3ff0b558 + .long 0x32d3d1a2,0x3ff0e3ec + .long 0xd0125b51,0x3ff11301 + .long 0xaea92de0,0x3ff1429a + .long 0x3c7d517b,0x3ff172b8 + .long 0xeb6fcb75,0x3ff1a35b + .long 0x3168b9aa,0x3ff1d487 + .long 0x88628cd6,0x3ff2063b + .long 0x6e756238,0x3ff2387a + .long 0x65e27cdd,0x3ff26b45 + .long 0xf51fdee1,0x3ff29e9d + .long 0xa6e4030b,0x3ff2d285 + .long 0x0a31b715,0x3ff306fe + .long 0xb26416ff,0x3ff33c08 + .long 0x373aa9cb,0x3ff371a7 + .long 0x34e59ff7,0x3ff3a7db + .long 0x4c123422,0x3ff3dea6 + .long 0x21f72e2a,0x3ff4160a + .long 0x6061892d,0x3ff44e08 + .long 0xb5c13cd0,0x3ff486a2 + .long 0xd5362a27,0x3ff4bfda + .long 0x769d2ca7,0x3ff4f9b2 + .long 0x569d4f82,0x3ff5342b + .long 0x36b527da,0x3ff56f47 + .long 0xdd485429,0x3ff5ab07 + .long 0x15ad2148,0x3ff5e76f + .long 0xb03a5585,0x3ff6247e + .long 0x82552225,0x3ff66238 + .long 0x667f3bcd,0x3ff6a09e + .type __libm_expf_table_64,@object + .size __libm_expf_table_64,520 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/expl.S b/external/sgx_libm/intel64/expl.S new file mode 100644 index 0000000000..fbd0ff76a7 --- /dev/null +++ b/external/sgx_libm/intel64/expl.S @@ -0,0 +1,599 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expl.c" + .text +..TXTST0: +# -- Begin expl + .text + .align 16,0x90 + .globl expl +expl: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_expl.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %dil, %dil +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movb 105(%rsp), %al + lea _ranges(%rip), %r8 + andb $-128, %al + shrb $7, %al + movzbl %al, %esi + movq %rsi, %rcx + shlq $4, %rcx + movzwl 104(%rsp), %eax + andl $32767, %eax + movzwl 8(%rcx,%r8), %edx + andl $32767, %edx + cmpl %edx, %eax + jl ..B1.8 +..B1.4: + jne ..B1.31 +..B1.5: + movl 100(%rsp), %edx + cmpl 4(%rcx,%r8), %edx + jb ..B1.8 +..B1.6: + jne ..B1.31 +..B1.7: + movl 96(%rsp), %edx + cmpl (%rcx,%r8), %edx + jae ..B1.31 +..B1.8: + movzwl 82(%rsp), %r8d + cmpl $16363, %eax + jge ..B1.19 +..B1.9: + movl %r8d, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.13 +..B1.10: + orl $-64768, %r8d + movw %r8w, 80(%rsp) +..B1.11: + fldcw 80(%rsp) +..B1.12: + movzwl 104(%rsp), %eax + movb $1, %dil + andl $32767, %eax +..B1.13: + fldt 96(%rsp) + cmpl $16316, %eax + fstpt 16(%rsp) + jge ..B1.15 +..B1.14: + fldt .L_2il0floatpacket.0(%rip) + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.16 +..B1.15: + fldt 16(%rsp) + lea 16+_P1(%rip), %rax + fldt .L_2il0floatpacket.0(%rip) + lea _P1(%rip), %rdx + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(2), %st + fmul %st(2), %st + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.16: + testb %dil, %dil + je ..B1.18 +..B1.17: + fldcw 82(%rsp) +..B1.18: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.19: + movl %r8d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.23 +..B1.20: + orl $-64768, %r8d + movw %r8w, 80(%rsp) +..B1.21: + fldcw 80(%rsp) +..B1.22: + movb $1, %dil +..B1.23: + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %r8 + fstpt 48(%rsp) + lea _TWO_32H(%rip), %r9 + fldt 96(%rsp) + lea SC2_BIAS(%rip), %r10 + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + fldl (%r8) + movzwl 8+.L_2il0floatpacket.0(%rip), %r8d + fadd %st, %st(1) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + andl $-32768, %r8d + movl 64(%rsp), %edx + fsubp %st, %st(1) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(1), %st + movsbq %dl, %rax + fsubr %st(2), %st + fld %st(0) + movl %eax, %r11d + fldt .L_2il0floatpacket.3(%rip) + negl %r11d + fmulp %st, %st(3) + addl %edx, %r11d + shrl $8, %r11d + addl $4196735, %edx + addl (%r10,%rsi,4), %r11d + lea 64+_P(%rip), %rsi + andl $32767, %r11d + lea 16+_P(%rip), %r10 + orl %r11d, %r8d + fsub %st(2), %st + fldl (%r9) + lea 48+_P(%rip), %r9 + movw %r8w, 56(%rsp) + lea _P(%rip), %r8 + shlq $4, %rax + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + cmpl $3070, %edx + movq __libm_expl_table_256@GOTPCREL(%rip), %r11 + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt (%rsi) + lea 32+_P(%rip), %rsi + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fldl 2048(%r11,%rax) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fxch %st(1) + fmull 2056(%r11,%rax) + faddp %st, %st(2) + faddl 2056(%r11,%rax) + faddp %st, %st(1) + ja ..B1.26 +..B1.24: + lea _expbut(%rip), %rax + fldt (%rax) + fcomip %st(3), %st + jbe ..B1.26 +..B1.25: + fstp %st(2) + fld %st(0) + lea _TWO_12H(%rip), %rax + lea _SC2(%rip), %rdx + fadd %st(2), %st + fldl (%rax) + fmul %st(1), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fldt (%rcx,%rdx) + fldt 48(%rsp) + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B1.27 +..B1.26: + fstp %st(2) + lea _SC2(%rip), %rax + faddp %st, %st(1) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt (%rcx,%rax) + fmulp %st, %st(1) + fstpt 32(%rsp) +..B1.27: + fldt 32(%rsp) + lea _minnorm(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + ja ..B1.42 +..B1.28: + testb %dil, %dil + je ..B1.30 +..B1.29: + fldt 16(%rsp) + fstpt 64(%rsp) +..B1.49: + fldcw 82(%rsp) +..B1.30: + fldt 32(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.31: + movzwl 82(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.35 +..B1.32: + orl $-64768, %ecx + movw %cx, 80(%rsp) +..B1.33: + fldcw 80(%rsp) +..B1.34: + movzwl 104(%rsp), %eax + movb $1, %dil + andl $32767, %eax +..B1.35: + cmpl $32767, %eax + je ..B1.43 +..B1.36: + testq %rsi, %rsi + je ..B1.38 +..B1.37: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) + jmp ..B1.39 +..B1.38: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) +..B1.39: + testb %dil, %dil + je ..B1.41 +..B1.40: + fldcw 82(%rsp) +..B1.41: + fldt 16(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.42: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.28 +..B1.43: + cmpl $-2147483648, 100(%rsp) + jne ..B1.46 +..B1.44: + cmpl $0, 96(%rsp) + jne ..B1.46 +..B1.45: + lea _inf_zeros(%rip), %rax + fldl (%rax,%rsi,8) + fstpt 16(%rsp) + jmp ..B1.39 +..B1.46: + fldt 96(%rsp) + fstpt 16(%rsp) + jmp ..B1.39 + .align 16,0x90 + .cfi_endproc + .type expl,@function + .size expl,.-expl + .data +# -- End expl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +SC2_BIAS: + .long 8191 + .long 24575 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .align 2 +_ranges: + .word 31148 + .word 53711 + .word 6135 + .word 45426 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 488 + .word 27074 + .word 50247 + .word 45600 + .word 16396 + .word 0 + .word 0 + .word 0 + .type _ranges,@object + .size _ranges,32 + .align 2 +_P1: + .word 43691 + .word 10 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30584 + .word 43703 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,32 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_expbut: + .word 60207 + .word 4624 + .word 35943 + .word 45420 + .word 49164 + .word 0 + .word 0 + .word 0 + .type _expbut,@object + .size _expbut,16 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _SC2,@object + .size _SC2,32 + .align 2 +_minnorm: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _minnorm,@object + .size _minnorm,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/expl_table.S b/external/sgx_libm/intel64/expl_table.S new file mode 100644 index 0000000000..e01307b984 --- /dev/null +++ b/external/sgx_libm/intel64/expl_table.S @@ -0,0 +1,561 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expl_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_expl_table_256 +__libm_expl_table_256: + .long 0x66800000,0x3fe6a09e + .long 0xee9a09d9,0xbd98866d + .long 0xfa800000,0x3fe6b052 + .long 0xcb8e15a7,0xbdd5d183 + .long 0x75000000,0x3fe6c012 + .long 0xdaed5330,0x3dd7b57d + .long 0xde000000,0x3fe6cfdc + .long 0x470aac92,0xbdf5c4dd + .long 0x3c400000,0x3fe6dfb2 + .long 0x79107166,0x3df28d17 + .long 0x98400000,0x3fe6ef92 + .long 0xbd1a2d88,0x3de93ae4 + .long 0xf9400000,0x3fe6ff7d + .long 0xcf87e1b5,0x3de19483 + .long 0x67000000,0x3fe70f74 + .long 0xf314dd96,0xbdd7a2f1 + .long 0xe9000000,0x3fe71f75 + .long 0x22dc8f0d,0xbde3a08c + .long 0x87000000,0x3fe72f82 + .long 0x482a80b3,0xbde52f76 + .long 0x48c00000,0x3fe73f9a + .long 0x42a365b2,0xbdea7e8c + .long 0x35c00000,0x3fe74fbd + .long 0x411ff586,0x3de7cbfd + .long 0x56400000,0x3fe75feb + .long 0xfb74d51a,0x3db33e45 + .long 0xb1c00000,0x3fe77024 + .long 0x921e23a6,0xbde491f6 + .long 0x4fc00000,0x3fe78069 + .long 0x619ae028,0x3dee5d3f + .long 0x38c00000,0x3fe790b9 + .long 0xb2d95e75,0xbde3e309 + .long 0x74000000,0x3fe7a114 + .long 0x282aefdc,0xbde4fe79 + .long 0x09800000,0x3fe7b17b + .long 0xdf5dac23,0xbdd2604a + .long 0x01000000,0x3fe7c1ed + .long 0x3e2499a2,0x3df86099 + .long 0x63000000,0x3fe7d26a + .long 0x4224048d,0xbd8e43ee + .long 0x36c00000,0x3fe7e2f3 + .long 0x20ba0574,0x3dde9cc4 + .long 0x84800000,0x3fe7f387 + .long 0xdf01dc61,0x3de1c490 + .long 0x54400000,0x3fe80427 + .long 0x9f21989b,0xbdae5ee4 + .long 0xae000000,0x3fe814d2 + .long 0x573791e6,0xbdf77c93 + .long 0x99400000,0x3fe82589 + .long 0x159f115f,0x3dd99c25 + .long 0x1e800000,0x3fe8364c + .long 0xb3373464,0x3dfca0fb + .long 0x46400000,0x3fe8471a + .long 0x31ad0947,0xbdec3853 + .long 0x17800000,0x3fe857f4 + .long 0xf9162dc2,0x3def5b20 + .long 0x9b400000,0x3fe868d9 + .long 0x03907643,0x3dc24bb2 + .long 0xd9400000,0x3fe879ca + .long 0xa8b4a0b5,0xbddcb793 + .long 0xd9800000,0x3fe88ac7 + .long 0xcca6179c,0x3dd4cd32 + .long 0xa4800000,0x3fe89bd0 + .long 0x2ac6abb9,0xbdce9fc2 + .long 0x42400000,0x3fe8ace5 + .long 0xa4583aa6,0xbde55f24 + .long 0xbac00000,0x3fe8be05 + .long 0x7b2d7bf1,0x3de61778 + .long 0x16c00000,0x3fe8cf32 + .long 0x21aabc66,0xbdd576e8 + .long 0x5e400000,0x3fe8e06a + .long 0xae2294e0,0xbdfbcc93 + .long 0x99000000,0x3fe8f1ae + .long 0x2b982746,0x3de57736 + .long 0xd0000000,0x3fe902fe + .long 0x2b25950c,0x3df41645 + .long 0x0b800000,0x3fe9145b + .long 0x88a61b47,0x3de1ffc5 + .long 0x53800000,0x3fe925c3 + .long 0xecbaa05a,0x3df517f0 + .long 0xb0c00000,0x3fe93737 + .long 0xe8a0387e,0x3ddb8bc9 + .long 0x2b400000,0x3fe948b8 + .long 0xc478530d,0x3def98e4 + .long 0xcbc00000,0x3fe95a44 + .long 0xd36906d3,0x3dd0a41d + .long 0x9a400000,0x3fe96bdd + .long 0x7c8b4d30,0x3dfb3859 + .long 0x9fc00000,0x3fe97d82 + .long 0x8b9e9210,0x3dee4e4f + .long 0xe4800000,0x3fe98f33 + .long 0x8d509577,0xbdc77577 + .long 0x70c00000,0x3fe9a0f1 + .long 0x74621372,0x3dd40f73 + .long 0x4d400000,0x3fe9b2bb + .long 0x889ec6c8,0x3de3fe0c + .long 0x82800000,0x3fe9c491 + .long 0x0e3e2358,0x3df1f848 + .long 0x19400000,0x3fe9d674 + .long 0x574a0ae1,0x3dd771a9 + .long 0x19c00000,0x3fe9e863 + .long 0x8c12653c,0x3df19191 + .long 0x8d000000,0x3fe9fa5e + .long 0x5ab18aa8,0x3dcfca77 + .long 0x7b400000,0x3fea0c66 + .long 0xb29ada8c,0x3dede564 + .long 0xed800000,0x3fea1e7a + .long 0xe330c774,0x3ddd7176 + .long 0xec400000,0x3fea309b + .long 0xb182e3ef,0x3dd45a66 + .long 0x80400000,0x3fea42c9 + .long 0x5587fa76,0x3dc82b5e + .long 0xb2400000,0x3fea5503 + .long 0x4bdbb6e3,0xbdadaa37 + .long 0x8b000000,0x3fea674a + .long 0xeaf0a9d0,0xbdd73f5b + .long 0x13400000,0x3fea799e + .long 0x21a409aa,0xbdde994f + .long 0x53c00000,0x3fea8bfe + .long 0xc1e61351,0x3da2e58a + .long 0x55400000,0x3fea9e6b + .long 0xa1f5921e,0x3dfcfedf + .long 0x21400000,0x3feab0e5 + .long 0x9d8f3894,0xbdd5228b + .long 0xbfc00000,0x3feac36b + .long 0xc0db966a,0x3de3f379 + .long 0x3a400000,0x3fead5ff + .long 0x0218892a,0xbdbec45d + .long 0x99800000,0x3feae89f + .long 0x50bc6597,0xbdf29629 + .long 0xe6400000,0x3feafb4c + .long 0x52cbf03d,0xbded0d01 + .long 0x29800000,0x3feb0e07 + .long 0x2108559c,0x3ddb6ccb + .long 0x6c800000,0x3feb20ce + .long 0x53740928,0x3dea8952 + .long 0xb8800000,0x3feb33a2 + .long 0x84a0178c,0xbdf87502 + .long 0x15c00000,0x3feb4684 + .long 0x3eec7bd4,0xbdd16c9e + .long 0x8e000000,0x3feb5972 + .long 0x71c77eef,0xbdeaa6c6 + .long 0x2a000000,0x3feb6c6e + .long 0x6ab8656c,0xbddc75ab + .long 0xf3000000,0x3feb7f76 + .long 0x55613df9,0xbdc286e4 + .long 0xf2400000,0x3feb928c + .long 0x6dc85953,0xbde8b61c + .long 0x30c00000,0x3feba5b0 + .long 0x7bf34c39,0xbdeef9b6 + .long 0xb7c00000,0x3febb8e0 + .long 0x80fa968e,0xbdf2c870 + .long 0x90400000,0x3febcc1e + .long 0x48f741e9,0x3dd783a4 + .long 0xc4000000,0x3febdf69 + .long 0x0384c46c,0xbdd8bbf2 + .long 0x5c000000,0x3febf2c2 + .long 0xbdfb947f,0xbdf470fb + .long 0x61400000,0x3fec0628 + .long 0x4eb4abc1,0x3dab33cc + .long 0xdd800000,0x3fec199b + .long 0x88832c4b,0x3dc54a70 + .long 0xd9c00000,0x3fec2d1c + .long 0xd235d3d0,0x3dfd3295 + .long 0x60000000,0x3fec40ab + .long 0x75903ef8,0xbd77c2c9 + .long 0x79000000,0x3fec5447 + .long 0xed0f8db7,0xbdc41376 + .long 0x2e400000,0x3fec67f1 + .long 0x4a2137fd,0x3de7d14b + .long 0x89c00000,0x3fec7ba8 + .long 0x9e76bbbe,0xbdfb9b66 + .long 0x94000000,0x3fec8f6d + .long 0x46b2f122,0x3dcb9ed4 + .long 0x57400000,0x3feca340 + .long 0xd01a825e,0x3de1c4da + .long 0xdd000000,0x3fecb720 + .long 0xeafc342e,0xbde06f96 + .long 0x2e800000,0x3feccb0f + .long 0x1d220f86,0xbde2e98b + .long 0x55400000,0x3fecdf0b + .long 0xc44f8959,0x3dedc3f9 + .long 0x5b800000,0x3fecf315 + .long 0x3411d371,0xbdf22a46 + .long 0x4a000000,0x3fed072d + .long 0x343c8bc8,0x3dce25ee + .long 0x2b000000,0x3fed1b53 + .long 0xaab1b10d,0x3dd192d0 + .long 0x08000000,0x3fed2f87 + .long 0x15bc2473,0x3ddb13e3 + .long 0xeac00000,0x3fed43c8 + .long 0x9eda9dfb,0x3dd543ac + .long 0xdd000000,0x3fed5818 + .long 0x6897e945,0xbdc16de3 + .long 0xe8400000,0x3fed6c76 + .long 0x83fd0f49,0x3df17369 + .long 0x16c00000,0x3fed80e3 + .long 0x7709f3a1,0x3dd3072f + .long 0x72000000,0x3fed955d + .long 0xfd692233,0xbd93f152 + .long 0x04000000,0x3feda9e6 + .long 0x47b9ff2d,0xbdf266bd + .long 0xd6400000,0x3fedbe7c + .long 0xb76f1927,0xbdc5f3ad + .long 0xf3000000,0x3fedd321 + .long 0xb695de3c,0x3dab4604 + .long 0x64000000,0x3fede7d5 + .long 0x8d6ab5c6,0x3dec0657 + .long 0x33800000,0x3fedfc97 + .long 0x1a5cd4f2,0xbdc19285 + .long 0x6b000000,0x3fee1167 + .long 0xed4ad643,0x3de97d16 + .long 0x15000000,0x3fee2646 + .long 0xbdb13c0c,0xbdd4bdae + .long 0x3b000000,0x3fee3b33 + .long 0x982d6f38,0x3de6ee11 + .long 0xe7c00000,0x3fee502e + .long 0xec61767f,0xbdfa6004 + .long 0x24800000,0x3fee6539 + .long 0x2c7ff0ea,0xbde8928a + .long 0xfbc00000,0x3fee7a51 + .long 0x2d522ca1,0x3dcd320d + .long 0x77c00000,0x3fee8f79 + .long 0x77bb5bfa,0x3ddb6e7f + .long 0xa2c00000,0x3feea4af + .long 0x7a708c5e,0xbdeb6f26 + .long 0x86800000,0x3feeb9f4 + .long 0x6f9a1bae,0xbdb9ac8d + .long 0x2d800000,0x3feecf48 + .long 0x1b60625f,0x3ddccfe1 + .long 0xa2000000,0x3feee4aa + .long 0x471a3692,0x3de88510 + .long 0xee400000,0x3feefa1b + .long 0xbb8fe90d,0x3df0ad13 + .long 0x1cc00000,0x3fef0f9c + .long 0x99100329,0xbdd37dac + .long 0x37800000,0x3fef252b + .long 0xb1796904,0xbde44568 + .long 0x48c00000,0x3fef3ac9 + .long 0xe6a5a5c1,0x3ded7273 + .long 0x5b800000,0x3fef5076 + .long 0x98b07b49,0xbde1babf + .long 0x79800000,0x3fef6632 + .long 0xfd1bd9aa,0x3dd089f0 + .long 0xadc00000,0x3fef7bfd + .long 0x3b7625a0,0xbdf1a0f6 + .long 0x02400000,0x3fef91d8 + .long 0x08975454,0xbdebc377 + .long 0x81c00000,0x3fefa7c1 + .long 0xe8b7ac0c,0xbdf0b793 + .long 0x36800000,0x3fefbdba + .long 0xe6988ceb,0x3de2d513 + .long 0x2b800000,0x3fefd3c2 + .long 0x12eb7496,0x3ddee3e2 + .long 0x6b400000,0x3fefe9d9 + .long 0xeb59fc8c,0xbde5dc26 + .long 0x00000000,0x3ff00000 + .long 0x00000000,0x00000000 + .long 0xfa600000,0x3ff00b1a + .long 0xa7b5953b,0xbdd50d04 + .long 0xaa000000,0x3ff0163d + .long 0x49ed6654,0xbdd3332a + .long 0x14400000,0x3ff02168 + .long 0x95f9887e,0xbdd3f5fc + .long 0x3e800000,0x3ff02c9a + .long 0x232106a7,0xbde0ff3e + .long 0x2e200000,0x3ff037d4 + .long 0xea97ee11,0xbdec8867 + .long 0xe8800000,0x3ff04315 + .long 0x428c7066,0xbdf1807b + .long 0x73000000,0x3ff04e5f + .long 0xacf21b15,0xbde3569d + .long 0xd3200000,0x3ff059b0 + .long 0x8a30756e,0xbde4f517 + .long 0x0e400000,0x3ff0650a + .long 0xb96f6af3,0xbdcf03ba + .long 0x29e00000,0x3ff0706b + .long 0xc91dfe2b,0xbdc04911 + .long 0x2b800000,0x3ff07bd4 + .long 0xb3732eaf,0xbdeaaf93 + .long 0x18800000,0x3ff08745 + .long 0xee7941b4,0xbde4c86f + .long 0xf6600000,0x3ff092bd + .long 0x97f9c7ff,0x3dd81f7e + .long 0xcac00000,0x3ff09e3e + .long 0x14878183,0x3ddbce0d + .long 0x9b200000,0x3ff0a9c7 + .long 0x8ba4de31,0xbda8dcda + .long 0x6d000000,0x3ff0b558 + .long 0x759d1b52,0xbdd9dbc2 + .long 0x45e00000,0x3ff0c0f1 + .long 0x4f98906d,0x3dd1b215 + .long 0x2b600000,0x3ff0cc92 + .long 0x407b705c,0x3df247f7 + .long 0x23400000,0x3ff0d83b + .long 0xbc14de44,0xbdda8851 + .long 0x32e00000,0x3ff0e3ec + .long 0xfbf17a36,0xbde85cbb + .long 0x5fe00000,0x3ff0efa5 + .long 0x9db9bc54,0xbd958ed4 + .long 0xb0000000,0x3ff0fb66 + .long 0xdcdf6e22,0xbdb2ce50 + .long 0x28c00000,0x3ff10730 + .long 0x3a8dd62d,0x3df7233e + .long 0xd0200000,0x3ff11301 + .long 0xb62881ca,0xbdeb495e + .long 0xab600000,0x3ff11edb + .long 0x29153dc1,0xbdbd54a7 + .long 0xc0600000,0x3ff12abd + .long 0xf72575a6,0x3de86397 + .long 0x14e00000,0x3ff136a8 + .long 0xf477b823,0x3df204aa + .long 0xaea00000,0x3ff1429a + .long 0x66820328,0x3de25bbf + .long 0x93600000,0x3ff14e95 + .long 0x3723d073,0xbdf0ced2 + .long 0xc8a00000,0x3ff15a98 + .long 0x920355cf,0x3dd63944 + .long 0x54600000,0x3ff166a4 + .long 0x063c8ee1,0x3df1c3c2 + .long 0x3c800000,0x3ff172b8 + .long 0x19041b9d,0xbdc57429 + .long 0x86a00000,0x3ff17ed4 + .long 0xdec3803b,0xbde4887f + .long 0x38800000,0x3ff18af9 + .long 0x777ee173,0x3de91bd3 + .long 0x58400000,0x3ff19726 + .long 0x5aa913d0,0xbde145a1 + .long 0xeb600000,0x3ff1a35b + .long 0x796d31ed,0x3def96ea + .long 0xf8200000,0x3ff1af99 + .long 0x4203d2da,0xbde8ebc7 + .long 0x84000000,0x3ff1bbe0 + .long 0x6ac79cad,0x3dd1734e + .long 0x95200000,0x3ff1c82f + .long 0x804bbc01,0x3de038d6 + .long 0x31800000,0x3ff1d487 + .long 0x87fa47fd,0xbdf74655 + .long 0x5ec00000,0x3ff1e0e7 + .long 0xb7eec044,0xbde77fb2 + .long 0x23000000,0x3ff1ed50 + .long 0x3bf3004f,0xbdc9371a + .long 0x84400000,0x3ff1f9c1 + .long 0xbf524a09,0xbddcc6cd + .long 0x88600000,0x3ff2063b + .long 0xdc775815,0x3dc466b1 + .long 0x35600000,0x3ff212be + .long 0x4d64b4b4,0x3df8a819 + .long 0x91800000,0x3ff21f49 + .long 0xd56816b7,0xbdc11b4e + .long 0xa2800000,0x3ff22bdd + .long 0x16582554,0xbddbb4bb + .long 0x6e800000,0x3ff2387a + .long 0x327c0a4a,0xbde53b8f + .long 0xfba00000,0x3ff2451f + .long 0xca6066de,0xbdfdebf5 + .long 0x4fc00000,0x3ff251ce + .long 0x94faa904,0xbdeab381 + .long 0x71200000,0x3ff25e85 + .long 0x07976d4f,0xbdb318ab + .long 0x65e00000,0x3ff26b45 + .long 0x2bd33994,0x3dc3e6e9 + .long 0x34200000,0x3ff2780e + .long 0x3f307f41,0xbdc106b4 + .long 0xe1e00000,0x3ff284df + .long 0x96cf15cf,0x3df56380 + .long 0x75800000,0x3ff291ba + .long 0xda671baf,0x3df1bb6f + .long 0xf5200000,0x3ff29e9d + .long 0xed175053,0xbd808f69 + .long 0x66c00000,0x3ff2ab8a + .long 0x9aa2f39c,0x3df10f12 + .long 0xd0e00000,0x3ff2b87f + .long 0x08856e6b,0xbdd499c0 + .long 0x39600000,0x3ff2c57e + .long 0xabfae964,0x3df71b2e + .long 0xa7000000,0x3ff2d285 + .long 0xbff6e2ad,0xbdfbfcf4 + .long 0x1f600000,0x3ff2df96 + .long 0xd16cffbc,0x3dd05625 + .long 0xa9400000,0x3ff2ecaf + .long 0xe35f0ba3,0xbdbd0a9e + .long 0x4ac00000,0x3ff2f9d2 + .long 0x54f1554d,0xbdc3bca8 + .long 0x0a200000,0x3ff306fe + .long 0x2de8d5a4,0x3df1b715 + .long 0xee000000,0x3ff31432 + .long 0xcd4cb818,0xbdf14d02 + .long 0xfc400000,0x3ff32170 + .long 0x6a739e38,0x3de9b062 + .long 0x3ba00000,0x3ff32eb8 + .long 0x1dd0be1a,0x3de1d463 + .long 0xb2600000,0x3ff33c08 + .long 0x32721843,0x3dd05bfd + .long 0x66e00000,0x3ff34962 + .long 0xca58a6cf,0x3dcfd166 + .long 0x5fa00000,0x3ff356c5 + .long 0x6d73b971,0xbdeac01e + .long 0xa2e00000,0x3ff36431 + .long 0x8628940e,0xbdb77c53 + .long 0x37400000,0x3ff371a7 + .long 0x63aeabf4,0xbdd558d5 + .long 0x23200000,0x3ff37f26 + .long 0x7d72a7b4,0xbdb8ab66 + .long 0x6d000000,0x3ff38cae + .long 0x16a72c36,0x3dd76196 + .long 0x1b800000,0x3ff39a40 + .long 0xcd4d2fe4,0xbded7e22 + .long 0x34e00000,0x3ff3a7db + .long 0xa86f24a6,0x3dd67fdb + .long 0xc0000000,0x3ff3b57f + .long 0xaace6476,0xbdf3930b + .long 0xc3200000,0x3ff3c32d + .long 0xf7ffc1bb,0xbde8ae36 + .long 0x44e00000,0x3ff3d0e5 + .long 0x3fd1a118,0x3debc2e6 + .long 0x4c200000,0x3ff3dea6 + .long 0x9497dbb8,0xbdeb97bb + .long 0xdf200000,0x3ff3ec70 + .long 0xaf6637b9,0xbdcd7459 + .long 0x04a00000,0x3ff3fa45 + .long 0x417ee035,0x3de90037 + .long 0xc3600000,0x3ff40822 + .long 0xdeefc5b8,0x3dde8090 + .long 0x22000000,0x3ff4160a + .long 0x0f79b48e,0xbde1a3ac + .long 0x27000000,0x3ff423fb + .long 0x3dce91fa,0x3de28d13 + .long 0xd9600000,0x3ff431f5 + .long 0x471f778d,0xbdeeaed2 + .long 0x3f800000,0x3ff43ffa + .long 0xc405f4b8,0x3dd2e750 + .long 0x60600000,0x3ff44e08 + .long 0x3136f40a,0x3db892d0 + .long 0x42a00000,0x3ff45c20 + .long 0xcf37ccfa,0x3ddf48c7 + .long 0xed200000,0x3ff46a41 + .long 0x6d7685d3,0xbdc7fd44 + .long 0x66800000,0x3ff4786d + .long 0x1ef87896,0x3de6646d + .long 0xb5c00000,0x3ff486a2 + .long 0x3c1a3b69,0x3db3cd01 + .long 0xe1a00000,0x3ff494e1 + .long 0x4eca2579,0xbdeaa25c + .long 0xf0e00000,0x3ff4a32a + .long 0x31a4e861,0xbde05843 + .long 0xea800000,0x3ff4b17d + .long 0x224b70fe,0xbdf24829 + .long 0xd5400000,0x3ff4bfda + .long 0xc578d0a0,0xbde3abb1 + .long 0xb8000000,0x3ff4ce41 + .long 0x4178a5a4,0x3df7c114 + .long 0x9a000000,0x3ff4dcb2 + .long 0xe2648873,0xbdc11794 + .long 0x81e00000,0x3ff4eb2d + .long 0x5257d2e6,0xbddd5005 + .long 0x76a00000,0x3ff4f9b2 + .long 0x96613a4b,0xbdc69aca + .long 0x7f400000,0x3ff50841 + .long 0x68926d27,0x3dd4c7b8 + .long 0xa2c00000,0x3ff516da + .long 0x8225ea59,0x3deecc83 + .long 0xe8400000,0x3ff5257d + .long 0x9331a87e,0xbda62223 + .long 0x56a00000,0x3ff5342b + .long 0x07abe1db,0xbdc583f1 + .long 0xf4e00000,0x3ff542e2 + .long 0x2f24da32,0x3df6ad27 + .long 0xca600000,0x3ff551a4 + .long 0xd689ceff,0xbdc36f89 + .long 0xde000000,0x3ff56070 + .long 0x43edb85a,0xbdf6ef2e + .long 0x36800000,0x3ff56f47 + .long 0x33765802,0x3e0a93ed + .long 0xdbc00000,0x3ff57e27 + .long 0x5e8ce6eb,0x3e016267 + .long 0xd4800000,0x3ff58d12 + .long 0x252bc2b7,0x3df7c7fd + .long 0x28000000,0x3ff59c08 + .long 0xf1677234,0xbdaf068b + .long 0xdd400000,0x3ff5ab07 + .long 0xb192602a,0x3de0a852 + .long 0xfb800000,0x3ff5ba11 + .long 0x4910bd68,0x3e043d01 + .long 0x8a400000,0x3ff5c926 + .long 0x01c4b1b8,0x3df946b7 + .long 0x90800000,0x3ff5d845 + .long 0x8ca5615d,0x3df98b92 + .long 0x15800000,0x3ff5e76f + .long 0x374df261,0x3e0690a4 + .long 0x20c00000,0x3ff5f6a3 + .long 0xcc2a4438,0x3dfceb70 + .long 0xb9800000,0x3ff605e1 + .long 0x9f1214db,0xbde247ee + .long 0xe6c00000,0x3ff6152a + .long 0xf259f256,0x3debede8 + .long 0xb0400000,0x3ff6247e + .long 0x383c17e4,0xbdd6a9ed + .long 0x1d000000,0x3ff633dd + .long 0x611c42fb,0x3df929fd + .long 0x34c00000,0x3ff64346 + .long 0x8edf0e2a,0x3de9863f + .long 0xfec00000,0x3ff652b9 + .long 0x5c7ab935,0xbdcb824b + .long 0x82400000,0x3ff66238 + .long 0x9127d9e3,0x3df52224 + .long 0xc7000000,0x3ff671c1 + .long 0x85e3369e,0x3de067eb + .long 0xd4400000,0x3ff68155 + .long 0x1038ae45,0x3de952e6 + .long 0xb1c00000,0x3ff690f4 + .long 0xe7fb4265,0xbe00b563 + .long 0x66800000,0x3ff6a09e + .long 0xee9a09d9,0xbda8866d + .type __libm_expl_table_256,@object + .size __libm_expl_table_256,4112 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/expm1_gen.S b/external/sgx_libm/intel64/expm1_gen.S new file mode 100644 index 0000000000..bc4160aadc --- /dev/null +++ b/external/sgx_libm/intel64/expm1_gen.S @@ -0,0 +1,387 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expm1_gen.c" + .text +..TXTST0: +# -- Begin expm1 + .text + .align 16,0x90 + .globl expm1 +expm1: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_expm1.1: +..L2: + + lea _range(%rip), %rsi + movsd %xmm0, -24(%rsp) + movl -20(%rsp), %edx + movl %edx, %eax + shrl $31, %edx + andl $2147483647, %eax + cmpl 4(%rsi,%rdx,8), %eax + jb ..B1.4 +..B1.2: + jne ..B1.20 +..B1.3: + movl -24(%rsp), %ecx + cmpl (%rsi,%rdx,8), %ecx + ja ..B1.20 +..B1.4: + cmpl $1064304640, %eax + jae ..B1.13 +..B1.5: + cmpl $1012924416, %eax + jae ..B1.12 +..B1.6: + cmpl $1048576, %eax + jb ..B1.8 +..B1.7: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + addsd -24(%rsp), %xmm0 + ret +..B1.8: + movl -24(%rsp), %edx + orl %edx, %eax + je ..B1.10 +..B1.9: + lea _small_value_64(%rip), %rax + movsd -24(%rsp), %xmm0 + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm1 + movsd %xmm1, -16(%rsp) + addsd %xmm1, %xmm0 + ret +..B1.10: + movsd -24(%rsp), %xmm0 +..B1.11: + ret +..B1.12: + movsd -24(%rsp), %xmm0 + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movsd .L_2il0floatpacket.4(%rip), %xmm4 + movsd .L_2il0floatpacket.6(%rip), %xmm1 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm1 + addsd .L_2il0floatpacket.5(%rip), %xmm4 + addsd .L_2il0floatpacket.7(%rip), %xmm1 + mulsd %xmm3, %xmm4 + mulsd %xmm0, %xmm1 + movsd .L_2il0floatpacket.8(%rip), %xmm2 + addsd %xmm1, %xmm4 + movsd %xmm3, -8(%rsp) + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm4 + addsd %xmm4, %xmm0 + ret +..B1.13: + movsd -24(%rsp), %xmm1 + lea _TWO_52H(%rip), %rcx + movaps %xmm1, %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd (%rcx), %xmm2 + movsd .L_2il0floatpacket.1(%rip), %xmm3 + addsd %xmm2, %xmm0 + movsd %xmm0, -16(%rsp) + movsd -16(%rsp), %xmm5 + movsd .L_2il0floatpacket.2(%rip), %xmm4 + subsd %xmm2, %xmm5 + mulsd %xmm5, %xmm3 + mulsd %xmm4, %xmm5 + subsd %xmm3, %xmm1 + movaps %xmm1, %xmm8 + movsd .L_2il0floatpacket.9(%rip), %xmm6 + subsd %xmm5, %xmm8 + movsd .L_2il0floatpacket.3(%rip), %xmm7 + movaps %xmm8, %xmm9 + movl -16(%rsp), %esi + movl %esi, %edi + shll $25, %edi + addsd %xmm8, %xmm6 + subsd %xmm8, %xmm1 + movsd %xmm6, -8(%rsp) + subsd %xmm5, %xmm1 + movl $0, -8(%rsp) + addsd %xmm1, %xmm9 + movsd -8(%rsp), %xmm6 + sarl $25, %edi + addsd %xmm6, %xmm7 + subl %edi, %esi + subsd %xmm7, %xmm8 + movslq %edi, %rdi + addsd %xmm8, %xmm1 + shrl $7, %esi + shlq $4, %rdi + movq __libm_exp_table_128@GOTPCREL(%rip), %r8 + cmpl $1078204908, -20(%rsp) + jle ..B1.15 +..B1.14: + movaps %xmm9, %xmm3 + lea SC2_BIAS(%rip), %rax + movsd .L_2il0floatpacket.4(%rip), %xmm4 + movsd .L_2il0floatpacket.6(%rip), %xmm0 + movsd .L_2il0floatpacket.8(%rip), %xmm2 + mulsd %xmm9, %xmm3 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm0 + addsd .L_2il0floatpacket.5(%rip), %xmm4 + addsd .L_2il0floatpacket.7(%rip), %xmm0 + mulsd %xmm3, %xmm4 + mulsd %xmm9, %xmm0 + movsd 1032(%r8,%rdi), %xmm5 + addsd %xmm0, %xmm4 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + movslq (%rax,%rdx,4), %rcx + addsd %xmm3, %xmm4 + addq %rsi, %rcx + addsd %xmm4, %xmm1 + movaps %xmm1, %xmm0 + addsd %xmm6, %xmm1 + mulsd %xmm5, %xmm0 + mulsd %xmm6, %xmm5 + mulsd 1024(%r8,%rdi), %xmm1 + shlq $52, %rcx + addsd %xmm1, %xmm0 + movq %rcx, -24(%rsp) + addsd %xmm5, %xmm0 + mulsd -24(%rsp), %xmm0 + lea _SC2(%rip), %rsi + mulsd (%rsi,%rdx,8), %xmm0 + ret +..B1.15: + movaps %xmm9, %xmm3 + movq $0x3ff0000000000000, %rdx + mulsd %xmm9, %xmm3 + addl $-1078081678, %eax + movsd .L_2il0floatpacket.4(%rip), %xmm4 + movsd .L_2il0floatpacket.6(%rip), %xmm0 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm0 + addsd .L_2il0floatpacket.5(%rip), %xmm4 + addsd .L_2il0floatpacket.7(%rip), %xmm0 + mulsd %xmm3, %xmm4 + mulsd %xmm9, %xmm0 + movsd .L_2il0floatpacket.8(%rip), %xmm2 + addsd %xmm0, %xmm4 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm3 + movsd 1032(%r8,%rdi), %xmm5 + addsd %xmm3, %xmm4 + shlq $52, %rsi + addsd %xmm4, %xmm1 + movaps %xmm1, %xmm0 + addq %rdx, %rsi + mulsd %xmm5, %xmm0 + addsd %xmm6, %xmm1 + mulsd %xmm6, %xmm5 + mulsd 1024(%r8,%rdi), %xmm1 + movq %rsi, -24(%rsp) + cmpl $216675, %eax + addsd %xmm1, %xmm0 + movsd -24(%rsp), %xmm1 + mulsd %xmm1, %xmm5 + mulsd %xmm1, %xmm0 + ja ..B1.17 +..B1.16: + movsd .L_2il0floatpacket.9(%rip), %xmm1 + subsd %xmm1, %xmm0 + jmp ..B1.18 +..B1.17: + movsd .L_2il0floatpacket.9(%rip), %xmm1 + movaps %xmm5, %xmm2 + movaps %xmm1, %xmm3 + subsd %xmm1, %xmm5 + movsd %xmm5, -8(%rsp) + addsd %xmm5, %xmm3 + subsd %xmm2, %xmm3 + subsd %xmm3, %xmm0 +..B1.18: + addsd %xmm5, %xmm0 +..B1.19: + ret +..B1.20: + cmpl $2146435072, %eax + jae ..B1.24 +..B1.21: + testq %rdx, %rdx + je ..B1.28 +..B1.22: + lea _small_value_64(%rip), %rax + movsd .L_2il0floatpacket.3(%rip), %xmm0 + addsd (%rax), %xmm0 +..B1.23: + ret +..B1.24: + addl $-2146435072, %eax + orl -24(%rsp), %eax + jne ..B1.26 +..B1.25: + lea _inf_none(%rip), %rax + movsd (%rax,%rdx,8), %xmm0 + ret +..B1.26: + movsd -24(%rsp), %xmm0 +..B1.27: + ret +..B1.28: + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type expm1,@function + .size expm1,.-expm1 + .data +# -- End expm1 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 4 +_range: + .long 4277811695 + .long 1082535490 + .long 2669343409 + .long 1078159482 + .type _range,@object + .size _range,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +SC2_BIAS: + .long 511 + .long 1535 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_SC2: + .long 0 + .long 1609564160 + .long 0 + .long 535822336 + .type _SC2,@object + .size _SC2,16 + .align 4 +_inf_none: + .long 0 + .long 2146435072 + .long 0 + .long 3220176896 + .type _inf_none,@object + .size _inf_none,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/expm1f_gen.S b/external/sgx_libm/intel64/expm1f_gen.S new file mode 100644 index 0000000000..dabc16b0b7 --- /dev/null +++ b/external/sgx_libm/intel64/expm1f_gen.S @@ -0,0 +1,348 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expm1f_gen.c" + .text +..TXTST0: +# -- Begin expm1f + .text + .align 16,0x90 + .globl expm1f +expm1f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_expm1f.1: +..L2: + + movd %xmm0, %eax + movss %xmm0, -8(%rsp) + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $1118652779, %ecx + jae ..B1.12 +..B1.2: + cmpl $1040187392, %ecx + jae ..B1.11 +..B1.3: + cmpl $838860800, %ecx + jae ..B1.10 +..B1.4: + cmpl $8388608, %ecx + jb ..B1.6 +..B1.5: + movss .L_2il0floatpacket.15(%rip), %xmm1 + mulss %xmm1, %xmm1 + addss %xmm1, %xmm0 + ret +..B1.6: + testl %ecx, %ecx + je ..B1.8 +..B1.7: + movss .L_2il0floatpacket.15(%rip), %xmm0 + pxor %xmm2, %xmm2 + mulss %xmm0, %xmm0 + pxor %xmm1, %xmm1 + cvtss2sd -8(%rsp), %xmm2 + cvtss2sd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm1 + addsd %xmm0, %xmm2 + pxor %xmm0, %xmm0 + movss %xmm1, -16(%rsp) + cvtsd2ss %xmm2, %xmm0 + ret +..B1.8: + movss -8(%rsp), %xmm0 +..B1.9: + ret +..B1.10: + movss -8(%rsp), %xmm1 + movaps %xmm1, %xmm0 + mulss %xmm1, %xmm0 + cvtss2sd %xmm1, %xmm1 + cvtss2sd %xmm0, %xmm0 + movsd .L_2il0floatpacket.9(%rip), %xmm3 + mulsd %xmm0, %xmm3 + movsd .L_2il0floatpacket.12(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.10(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.13(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.11(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd .L_2il0floatpacket.14(%rip), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm0, %xmm2 + addsd %xmm2, %xmm3 + addsd %xmm1, %xmm3 + cvtsd2ss %xmm3, %xmm3 + movaps %xmm3, %xmm0 + ret +..B1.11: + pxor %xmm3, %xmm3 + pxor %xmm6, %xmm6 + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movq __libm_expf_table_64@GOTPCREL(%rip), %rcx + addsd .L_2il0floatpacket.1(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + movl -16(%rsp), %edx + movl %edx, %eax + shll $26, %eax + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + sarl $26, %eax + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm3, %xmm4 + movslq %eax, %rax + addsd %xmm4, %xmm0 + movsd 256(%rcx,%rax,8), %xmm5 + subl %eax, %edx + mulsd %xmm5, %xmm0 + shrl $6, %edx + addsd %xmm5, %xmm0 + shll $23, %edx + addl $1065353216, %edx + movl %edx, -24(%rsp) + cvtss2sd -24(%rsp), %xmm6 + mulsd %xmm6, %xmm0 + addsd .L_2il0floatpacket.8(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.12: + lea range(%rip), %rdx + shrl $31, %eax + cmpl (%rdx,%rax,4), %ecx + jb ..B1.21 +..B1.13: + cmpl $2139095040, %ecx + jae ..B1.17 +..B1.14: + testq %rax, %rax + je ..B1.22 +..B1.15: + movss .L_2il0floatpacket.16(%rip), %xmm0 +..B1.16: + ret +..B1.17: + jne ..B1.19 +..B1.18: + lea _inf_none(%rip), %rdx + movss (%rdx,%rax,4), %xmm0 + ret +..B1.19: + movss -8(%rsp), %xmm0 +..B1.20: + ret +..B1.21: + pxor %xmm3, %xmm3 + movq $0x3ff0000000000000, %rcx + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movq __libm_expf_table_64@GOTPCREL(%rip), %rsi + addsd .L_2il0floatpacket.1(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + movl -16(%rsp), %edx + andl $4194303, %edx + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + movl %edx, %eax + shll $26, %eax + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm3, %xmm4 + sarl $26, %eax + addsd %xmm4, %xmm0 + movslq %eax, %rax + subl %eax, %edx + shrl $6, %edx + movsd 256(%rsi,%rax,8), %xmm5 + mulsd %xmm5, %xmm0 + shlq $52, %rdx + addsd %xmm5, %xmm0 + addq %rcx, %rdx + movq %rdx, -24(%rsp) + mulsd -24(%rsp), %xmm0 + addsd .L_2il0floatpacket.8(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.22: + movss .L_2il0floatpacket.17(%rip), %xmm0 + mulss %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type expm1f,@function + .size expm1f,.-expm1f + .data +# -- End expm1f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40571547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x41680000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.3: + .long 0xfefa39ef,0xbf862e42 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xeb78fa85,0x3fa56420 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x008d6118,0x3fe00000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xda752d4f,0x3fc55550 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xffffe7c6,0x3fefffff + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0xd2809cf8,0x3f2a04e1 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0xeb5ecfe9,0x3f811110 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x55579a3a,0x3fc55555 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x9843cb2c,0x3f56c445 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x27a9b288,0x3fa55555 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x00016df6,0x3fe00000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 4 +.L_2il0floatpacket.2: + .long 0x4b400000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.15: + .long 0x0d800000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,4 + .align 4 +.L_2il0floatpacket.16: + .long 0xbf800000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,4 + .align 4 +.L_2il0floatpacket.17: + .long 0x71800000 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,4 + .align 4 +range: + .long 1118925336 + .long 1107296256 + .type range,@object + .size range,8 + .align 4 +_inf_none: + .long 2139095040 + .long 3212836864 + .type _inf_none,@object + .size _inf_none,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/expm1l.S b/external/sgx_libm/intel64/expm1l.S new file mode 100644 index 0000000000..c56ed2c280 --- /dev/null +++ b/external/sgx_libm/intel64/expm1l.S @@ -0,0 +1,1156 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "expm1l.c" + .text +..TXTST0: +# -- Begin expm1l + .text + .align 16,0x90 + .globl expm1l +expm1l: +# parameter 1: 160 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_expm1l.1: +..L2: + + subq $152, %rsp + .cfi_def_cfa_offset 160 + xorb %dil, %dil +..B1.2: + fnstcw 146(%rsp) +..B1.3: + movb 169(%rsp), %cl + lea _ranges(%rip), %r8 + andb $-128, %cl + shrb $7, %cl + movzbl %cl, %esi + movq %rsi, %rdx + shlq $4, %rdx + movzwl 168(%rsp), %ecx + andl $32767, %ecx + movzwl 8(%rdx,%r8), %eax + andl $32767, %eax + cmpl %eax, %ecx + jl ..B1.8 +..B1.4: + jne ..B1.63 +..B1.5: + movl 164(%rsp), %eax + cmpl 4(%rdx,%r8), %eax + jb ..B1.8 +..B1.6: + jne ..B1.63 +..B1.7: + movl 160(%rsp), %eax + cmpl (%rdx,%r8), %eax + jae ..B1.63 +..B1.8: + cmpl $16381, %ecx + jge ..B1.49 +..B1.9: + movzwl 146(%rsp), %edx + cmpl $16370, %ecx + jge ..B1.42 +..B1.10: + cmpl $16359, %ecx + jge ..B1.35 +..B1.11: + cmpl $16345, %ecx + jge ..B1.28 +..B1.12: + cmpl $16308, %ecx + jge ..B1.22 +..B1.13: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.17 +..B1.14: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.15: + fldcw 144(%rsp) +..B1.16: + movzwl 168(%rsp), %ecx + movb $1, %dil + andl $32767, %ecx +..B1.17: + testl %ecx, %ecx + jle ..B1.73 +..B1.18: + fldt 160(%rsp) + lea _TWO_75(%rip), %rax + lea ones(%rip), %rdx + lea 8+_TWO_75(%rip), %rcx + fldl (%rax) + fmul %st(1), %st + fxch %st(1) + fmull (%rdx,%rsi,8) + faddp %st, %st(1) + fmull (%rcx) + fstpt 16(%rsp) +..B1.19: + testb %dil, %dil + je ..B1.21 +..B1.20: + fldcw 146(%rsp) +..B1.21: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.22: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.77 +..B1.23: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.24: + fldcw 144(%rsp) +..B1.25: + fldt 160(%rsp) + lea _Q3(%rip), %rax + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.26: + fldcw 146(%rsp) +..B1.27: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.28: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.32 +..B1.29: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.30: + fldcw 144(%rsp) +..B1.31: + movb $1, %dil +..B1.32: + fldt 160(%rsp) + lea 16+_Q2(%rip), %rax + lea _Q2(%rip), %rdx + testb %dil, %dil + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fldt (%rdx) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.34 +..B1.33: + fldcw 146(%rsp) +..B1.34: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.35: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.39 +..B1.36: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.37: + fldcw 144(%rsp) +..B1.38: + movb $1, %dil +..B1.39: + fldt 160(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rcx + fmul %st(1), %st + lea 16+_Q1(%rip), %rdx + fldt (%rax) + lea _Q1(%rip), %rsi + fmul %st(1), %st + testb %dil, %dil + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.41 +..B1.40: + fldcw 146(%rsp) +..B1.41: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.42: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.46 +..B1.43: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.44: + fldcw 144(%rsp) +..B1.45: + movb $1, %dil +..B1.46: + fldt 160(%rsp) + lea _TWO_54H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 208+_Q(%rip), %r8 + lea 240+_Q(%rip), %rcx + lea 176+_Q(%rip), %r9 + fld %st(3) + lea 224+_Q(%rip), %rsi + fldl (%rax) + lea 144+_Q(%rip), %r10 + fmul %st(5), %st + lea 112+_Q(%rip), %r11 + lea 80+_Q(%rip), %rax + lea 256+_Q(%rip), %rdx + testb %dil, %dil + fadd %st, %st(4) + fxch %st(4) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(4) + fld %st(3) + fld %st(4) + fmul %st(5), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(4) + fsub %st(5), %st + fmul %st, %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(4), %st + fxch %st(5) + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fstpt 96(%rsp) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt (%rdx) + lea 48+_Q(%rip), %rdx + fmul %st, %st(2) + fldt (%rcx) + lea 16+_Q(%rip), %rcx + fstpt 112(%rsp) + fldt (%rsi) + lea 192+_Q(%rip), %rsi + fstpt 128(%rsp) + fldt (%r8) + lea 160+_Q(%rip), %r8 + fmul %st(4), %st + fldt (%r9) + lea 128+_Q(%rip), %r9 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + lea 96+_Q(%rip), %r10 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r11) + lea 64+_Q(%rip), %r11 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rax) + lea 32+_Q(%rip), %rax + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rdx) + lea _Q(%rip), %rdx + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rsi) + fmul %st(5), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt (%rdx) + faddp %st, %st(5) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldt 112(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldt 128(%rsp) + fld %st(0) + fldt 64(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fxch %st(4) + fmul %st(5), %st + fldt 96(%rsp) + fmulp %st, %st(4) + fldt 80(%rsp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt 48(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(3) + fxch %st(3) + fstpt 160(%rsp) + fldt 160(%rsp) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + je ..B1.48 +..B1.47: + fldt 16(%rsp) + fstpt 48(%rsp) +..B1.85: + fldcw 146(%rsp) +..B1.48: + fldt 32(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.49: + movzwl 146(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.53 +..B1.50: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.51: + fldcw 144(%rsp) +..B1.52: + movzwl 168(%rsp), %ecx + movb $1, %dil + andl $32767, %ecx +..B1.53: + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rax + fstpt 32(%rsp) + lea _TWO_32H(%rip), %r8 + fldt 160(%rsp) + cmpl $16396, %ecx + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + fldl (%rax) + movzwl 8+.L_2il0floatpacket.0(%rip), %r9d + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(1), %st + movl 48(%rsp), %eax + fsubrp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.3(%rip) + fmulp %st, %st(2) + movsbq %al, %rdx + fsub %st(1), %st + fldl (%r8) + fadd %st, %st(1) + fsubr %st(1), %st + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + jge ..B1.60 +..B1.54: + fld %st(1) + subl %edx, %eax + shrl $8, %eax + andl $-32768, %r9d + addl $16383, %eax + lea 32+_P(%rip), %r8 + andl $32767, %eax + lea 48+_P(%rip), %r10 + orl %eax, %r9d + lea 64+_P(%rip), %rax + movw %r9w, 40(%rsp) + lea _P(%rip), %r9 + lea 16+_P(%rip), %r11 + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt (%rax) + fmul %st(1), %st + fldt (%r8) + shlq $4, %rdx + faddp %st, %st(1) + fmul %st(1), %st + testq %rsi, %rsi + fldt (%r9) + movq __libm_expl_table_256@GOTPCREL(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(3) + fldl 2048(%rax,%rdx) + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fadd %st, %st(4) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(4) + fmull 2056(%rax,%rdx) + faddp %st, %st(3) + fldt 32(%rsp) + fmul %st, %st(4) + fxch %st(1) + faddl 2056(%rax,%rdx) + faddp %st, %st(3) + fmulp %st, %st(2) + je ..B1.56 +..B1.55: + fldt .L_2il0floatpacket.4(%rip) + fadd %st(3), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fldt .L_2il0floatpacket.0(%rip) + faddp %st, %st(1) + fsubp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + jmp ..B1.57 +..B1.56: + movzbl 169(%rsp), %edx + xorl %esi, %esi + shrl $7, %edx + lea zero_one(%rip), %r8 + shll $15, %edx + orl %ecx, %edx + shll $16, %edx + movzwl 166(%rsp), %eax + orl %eax, %edx + cmpl $1074049228, %edx + setb %sil + fldl (%r8,%rsi,8) + xorl $1, %esi + fsubrp %st, %st(3) + fxch %st(2) + fstpt 16(%rsp) + fsubl (%r8,%rsi,8) +..B1.57: + fldt 16(%rsp) + testb %dil, %dil + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.88 +..B1.58: + fstpt 48(%rsp) +..B1.86: + fldcw 146(%rsp) + jmp ..B1.59 +..B1.88: + fstp %st(0) +..B1.59: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.60: + fld %st(1) + subl %edx, %eax + shrl $8, %eax + lea 32+_P(%rip), %rsi + addl $8191, %eax + lea _P(%rip), %r8 + movzwl 40(%rsp), %ecx + andl $32767, %eax + andl $-32768, %ecx + lea 48+_P(%rip), %r9 + orl %eax, %ecx + lea 64+_P(%rip), %rax + lea 16+_P(%rip), %r10 + fadd %st(3), %st + fld %st(0) + fmul %st(1), %st + fldt (%rax) + lea _SC2(%rip), %rax + fmul %st(1), %st + fldt (%rsi) + shlq $4, %rdx + faddp %st, %st(1) + fmul %st(1), %st + testb %dil, %dil + fldt (%r8) + movq __libm_expl_table_256@GOTPCREL(%rip), %r11 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + fmul %st(2), %st + fldt (%r10) + movw %cx, 40(%rsp) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(3) + fldl 2056(%r11,%rdx) + fldl 2048(%r11,%rdx) + fld %st(0) + fmul %st(5), %st + fxch %st(4) + fadd %st, %st(5) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt 16(%rsp) + je ..B1.89 +..B1.61: + fstpt 48(%rsp) +..B1.87: + fldcw 146(%rsp) + jmp ..B1.62 +..B1.89: + fstp %st(0) +..B1.62: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.63: + movzwl 146(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.67 +..B1.64: + orl $-64768, %edx + movw %dx, 144(%rsp) +..B1.65: + fldcw 144(%rsp) +..B1.66: + movzwl 168(%rsp), %ecx + movb $1, %dil + andl $32767, %ecx +..B1.67: + cmpl $32767, %ecx + je ..B1.79 +..B1.68: + testq %rsi, %rsi + je ..B1.78 +..B1.69: + fldt .L_2il0floatpacket.4(%rip) + lea _small_value_80(%rip), %rax + fldt (%rax) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.70: + testb %dil, %dil + je ..B1.72 +..B1.71: + fldcw 146(%rsp) +..B1.72: + fldt 16(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 +..B1.73: + cmpl $0, 164(%rsp) + jne ..B1.75 +..B1.74: + cmpl $0, 160(%rsp) + je ..B1.76 +..B1.75: + fldt 160(%rsp) + lea _TWO_75(%rip), %rdx + lea ones(%rip), %rcx + lea _small_value_80(%rip), %rax + fldl (%rdx) + fmul %st(1), %st + fxch %st(1) + fmull (%rcx,%rsi,8) + lea 8+_TWO_75(%rip), %rsi + faddp %st, %st(1) + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + fmull (%rsi) + fstpt 16(%rsp) + jmp ..B1.19 +..B1.76: + fldt 160(%rsp) + fstpt 16(%rsp) + jmp ..B1.19 +..B1.77: + fldt 160(%rsp) + lea _Q3(%rip), %rax + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.27 +..B1.78: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 16(%rsp) + jmp ..B1.70 +..B1.79: + cmpl $-2147483648, 164(%rsp) + jne ..B1.82 +..B1.80: + cmpl $0, 160(%rsp) + jne ..B1.82 +..B1.81: + lea _inf_none(%rip), %rax + fldl (%rax,%rsi,8) + fstpt 16(%rsp) + jmp ..B1.70 +..B1.82: + fldt 160(%rsp) + fstpt 16(%rsp) + jmp ..B1.70 + .align 16,0x90 + .cfi_endproc + .type expm1l,@function + .size expm1l,.-expm1l + .data +# -- End expm1l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +zero_one: + .long 0x00000000,0x00000000 + .long 0x00000000,0x3ff00000 + .type zero_one,@object + .size zero_one,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_54H: + .long 0 + .long 1129840640 + .type _TWO_54H,@object + .size _TWO_54H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_inf_none: + .long 0 + .long 2146435072 + .long 0 + .long 3220176896 + .type _inf_none,@object + .size _inf_none,16 + .align 2 +_ranges: + .word 31148 + .word 53711 + .word 6135 + .word 45426 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16389 + .word 0 + .word 0 + .word 0 + .type _ranges,@object + .size _ranges,32 + .align 2 +_Q3: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 2731 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 46967 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 65530 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 43687 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 52365 + .word 52428 + .word 43692 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56491 + .word 10318 + .word 34954 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 39683 + .word 36691 + .word 42743 + .word 55145 + .word 16297 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 43690 + .word 43690 + .word 43690 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 46686 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 53372 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 5395 + .word 3321 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 7401 + .word 46642 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 52768 + .word 7506 + .word 32188 + .word 37874 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 23003 + .word 12485 + .word 11072 + .word 55090 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 3702 + .word 18929 + .word 50035 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 2630 + .word 23096 + .word 11140 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 46660 + .word 62794 + .word 49270 + .word 51706 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 61237 + .word 7998 + .word 19059 + .word 55154 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43648 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43648 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,272 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_SC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .type _SC2,@object + .size _SC2,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fabs.S b/external/sgx_libm/intel64/fabs.S new file mode 100644 index 0000000000..e285d5fceb --- /dev/null +++ b/external/sgx_libm/intel64/fabs.S @@ -0,0 +1,85 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fabs.c" + .text +..TXTST0: +# -- Begin fabs + .text + .align 16,0x90 + .globl fabs +fabs: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_fabs.1: +..L2: + +..B1.2: + movq MASK(%rip), %xmm1 + movq ONE(%rip), %xmm2 + andpd %xmm1, %xmm0 + mulsd %xmm2, %xmm0 + ret +..B1.3: + .align 16,0x90 + .cfi_endproc + .type fabs,@function + .size fabs,.-fabs + .data +# -- End fabs + .section .rodata, "a" + .align 16 + .align 16 +MASK: + .long 4294967295 + .long 2147483647 + .type MASK,@object + .size MASK,8 + .space 8, 0x00 # pad + .align 16 +ONE: + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fabsf.S b/external/sgx_libm/intel64/fabsf.S new file mode 100644 index 0000000000..9c6b491937 --- /dev/null +++ b/external/sgx_libm/intel64/fabsf.S @@ -0,0 +1,82 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fabsf.c" + .text +..TXTST0: +# -- Begin fabsf + .text + .align 16,0x90 + .globl fabsf +fabsf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_fabsf.1: +..L2: + +..B1.2: + movd MASK(%rip), %xmm1 + movd ONE(%rip), %xmm2 + andps %xmm1, %xmm0 + mulss %xmm2, %xmm0 + ret +..B1.3: + .align 16,0x90 + .cfi_endproc + .type fabsf,@function + .size fabsf,.-fabsf + .data +# -- End fabsf + .section .rodata, "a" + .align 16 + .align 16 +MASK: + .long 2147483647 + .type MASK,@object + .size MASK,4 + .align 4 +ONE: + .long 1065353216 + .type ONE,@object + .size ONE,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fabsl.S b/external/sgx_libm/intel64/fabsl.S new file mode 100644 index 0000000000..4a4614c636 --- /dev/null +++ b/external/sgx_libm/intel64/fabsl.S @@ -0,0 +1,127 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fabsl.c" + .text +..TXTST0: +# -- Begin fabsl + .text + .align 16,0x90 + .globl fabsl +fabsl: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_fabsl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + xorb %sil, %sil +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.5: + fldcw 16(%rsp) +..B1.6: + movb $1, %sil +..B1.7: + movzwl 40(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.12 +..B1.8: + fldt 32(%rsp) + lea ones(%rip), %rdx + movb 41(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fmull (%rdx,%rcx,8) + fstpt (%rsp) +..B1.9: + testb %sil, %sil + je ..B1.11 +..B1.10: + fldcw 18(%rsp) +..B1.11: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.12: + cmpl $-2147483648, 36(%rsp) + jne ..B1.14 +..B1.13: + cmpl $0, 32(%rsp) + je ..B1.8 +..B1.14: + fldt 32(%rsp) + movb 41(%rsp), %al + fstpt (%rsp) + andb $127, %al + movb %al, 9(%rsp) + jmp ..B1.9 + .align 16,0x90 + .cfi_endproc + .type fabsl,@function + .size fabsl,.-fabsl + .data +# -- End fabsl + .section .rodata, "a" + .align 8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fdim_gen.S b/external/sgx_libm/intel64/fdim_gen.S new file mode 100644 index 0000000000..edab127872 --- /dev/null +++ b/external/sgx_libm/intel64/fdim_gen.S @@ -0,0 +1,148 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fdim_gen.c" + .text +..TXTST0: +# -- Begin fdim + .text + .align 16,0x90 + .globl fdim +fdim: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fdim.1: +..L2: + + movsd %xmm0, -16(%rsp) + movsd %xmm1, -8(%rsp) + movzwl -10(%rsp), %edx + andl $32752, %edx + movzwl -2(%rsp), %eax + andl $32752, %eax + shrl $4, %edx + shrl $4, %eax + cmpl $2047, %edx + je ..B1.14 +..B1.2: + cmpl $2047, %eax + je ..B1.11 +..B1.3: + movsd -16(%rsp), %xmm0 + movsd -8(%rsp), %xmm2 + comisd %xmm2, %xmm0 + jbe ..B1.10 +..B1.4: + cmpl $2047, %edx + je ..B1.8 +..B1.5: + cmpl $2047, %eax + je ..B1.8 +..B1.6: + cmpl $2046, %edx + je ..B1.9 +..B1.7: + cmpl $2046, %eax + je ..B1.9 +..B1.8: + subsd %xmm2, %xmm0 + ret +..B1.9: + movsd .L_2il0floatpacket.0(%rip), %xmm1 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm2 + subsd %xmm2, %xmm0 + movsd %xmm0, -24(%rsp) + movsd -24(%rsp), %xmm0 + mulsd .L_2il0floatpacket.1(%rip), %xmm0 + ret +..B1.10: + lea _zeros(%rip), %rax + movsd (%rax), %xmm0 + ret +..B1.11: + testl $1048575, -4(%rsp) + jne ..B1.13 +..B1.12: + cmpl $0, -8(%rsp) + je ..B1.3 +..B1.13: + movsd -8(%rsp), %xmm0 + ret +..B1.14: + testl $1048575, -12(%rsp) + jne ..B1.16 +..B1.15: + cmpl $0, -16(%rsp) + je ..B1.2 +..B1.16: + movsd -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type fdim,@function + .size fdim,.-fdim + .data +# -- End fdim + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fdimf_gen.S b/external/sgx_libm/intel64/fdimf_gen.S new file mode 100644 index 0000000000..f352c8467e --- /dev/null +++ b/external/sgx_libm/intel64/fdimf_gen.S @@ -0,0 +1,133 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fdimf_gen.c" + .text +..TXTST0: +# -- Begin fdimf + .text + .align 16,0x90 + .globl fdimf +fdimf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fdimf.1: +..L2: + + movss %xmm0, -16(%rsp) + movss %xmm1, -8(%rsp) + movzwl -14(%rsp), %edx + andl $32640, %edx + movzwl -6(%rsp), %eax + andl $32640, %eax + shrl $7, %edx + shrl $7, %eax + cmpl $255, %edx + je ..B1.13 +..B1.2: + cmpl $255, %eax + je ..B1.11 +..B1.3: + movss -16(%rsp), %xmm0 + movss -8(%rsp), %xmm2 + comiss %xmm2, %xmm0 + jbe ..B1.10 +..B1.4: + cmpl $255, %edx + je ..B1.8 +..B1.5: + cmpl $255, %eax + je ..B1.8 +..B1.6: + cmpl $254, %edx + je ..B1.9 +..B1.7: + cmpl $254, %eax + je ..B1.9 +..B1.8: + subss %xmm2, %xmm0 + ret +..B1.9: + movss .L_2il0floatpacket.0(%rip), %xmm1 + mulss %xmm1, %xmm0 + mulss %xmm1, %xmm2 + subss %xmm2, %xmm0 + movss %xmm0, -24(%rsp) + movss -24(%rsp), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + ret +..B1.10: + pxor %xmm0, %xmm0 + ret +..B1.11: + testl $8388607, -8(%rsp) + je ..B1.3 +..B1.12: + movss -8(%rsp), %xmm0 + ret +..B1.13: + testl $8388607, -16(%rsp) + je ..B1.2 +..B1.14: + movss -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type fdimf,@function + .size fdimf,.-fdimf + .data +# -- End fdimf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x3f000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x40000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fdiml.S b/external/sgx_libm/intel64/fdiml.S new file mode 100644 index 0000000000..da480d2d04 --- /dev/null +++ b/external/sgx_libm/intel64/fdiml.S @@ -0,0 +1,291 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fdiml.c" + .text +..TXTST0: +# -- Begin fdiml + .text + .align 16,0x90 + .globl fdiml +fdiml: +# parameter 1: 32 + %rsp +# parameter 2: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_fdiml.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + xorb %al, %al +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 40(%rsp), %edi + andl $32767, %edi + movzwl 56(%rsp), %esi + andl $32767, %esi + cmpl $32767, %edi + je ..B1.38 +..B1.4: + cmpl $32767, %esi + je ..B1.29 +..B1.5: + movzwl 18(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.9 +..B1.6: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.7: + fldcw 16(%rsp) +..B1.8: + movb $1, %al +..B1.9: + fldt 48(%rsp) + lea _zeros(%rip), %rdx + fldl (%rdx) + fstpt (%rsp) + fldt 32(%rsp) + fcomi %st(1), %st + jbe ..B1.42 +..B1.10: + cmpl $32767, %edi + je ..B1.14 +..B1.11: + cmpl $32767, %esi + je ..B1.14 +..B1.12: + cmpl $32766, %edi + je ..B1.26 +..B1.13: + cmpl $32766, %esi + je ..B1.18 +..B1.14: + fsubp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.42: + fstp %st(0) + fstp %st(0) +..B1.15: + testb %al, %al + je ..B1.17 +..B1.16: + fldcw 18(%rsp) +..B1.17: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.18: + testl %edi, %edi + jne ..B1.22 +..B1.19: + cmpl $0, 36(%rsp) + jne ..B1.21 +..B1.20: + cmpl $0, 32(%rsp) + je ..B1.22 +..B1.21: + lea _ranges(%rip), %rdx + fsubp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rdx) + fucomip %st(1), %st + fstp %st(0) + jne ..B1.15 + jp ..B1.15 + jmp ..B1.24 +..B1.22: + fldt .L_2il0floatpacket.0(%rip) + lea 16+_ranges(%rip), %rdx + fmul %st, %st(1) + fmulp %st, %st(2) + fsubp %st, %st(1) + fldt (%rdx) + fcomip %st(1), %st + jp ..B1.23 + jbe ..B1.25 +..B1.23: + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.24: + lea _large_value_80(%rip), %rdx + fldt (%rdx) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.15 +..B1.25: + fstp %st(0) + lea _large_value_80(%rip), %rdx + fldt (%rdx) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.15 +..B1.26: + testl %esi, %esi + jne ..B1.22 +..B1.27: + cmpl $0, 52(%rsp) + jne ..B1.21 +..B1.28: + cmpl $0, 48(%rsp) + jne ..B1.21 + jmp ..B1.22 +..B1.29: + cmpl $-2147483648, 52(%rsp) + jne ..B1.31 +..B1.30: + cmpl $0, 48(%rsp) + je ..B1.5 +..B1.31: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.32: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.33: + fldcw 16(%rsp) +..B1.34: + fldt 32(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.35: + fldcw 18(%rsp) +..B1.36: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.37: + fldt 32(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.36 +..B1.38: + cmpl $-2147483648, 36(%rsp) + jne ..B1.31 +..B1.39: + cmpl $0, 32(%rsp) + je ..B1.4 + jmp ..B1.31 + .align 16,0x90 + .cfi_endproc + .type fdiml,@function + .size fdiml,.-fdiml + .data +# -- End fdiml + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_ranges: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .type _ranges,@object + .size _ranges,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/feclearexcept.S b/external/sgx_libm/intel64/feclearexcept.S new file mode 100644 index 0000000000..4d8dec30e9 --- /dev/null +++ b/external/sgx_libm/intel64/feclearexcept.S @@ -0,0 +1,98 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feclearexcept.c" + .text +..TXTST0: +# -- Begin feclearexcept + .text + .align 16,0x90 + .globl feclearexcept +feclearexcept: +# parameter 1: %edi +..B1.1: + .cfi_startproc +..___tag_value_feclearexcept.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 40(%rsp) + andl $63, %edi + je ..B1.9 +..B1.2: + stmxcsr (%rsp) +..B1.3: + notl %edi + andl %edi, (%rsp) +..B1.4: + ldmxcsr (%rsp) +..B1.5: + fnstenv 4(%rsp) +..B1.6: + andw %di, 8(%rsp) +..B1.7: + fnclex +..B1.8: + fldenv 4(%rsp) +..B1.9: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.11 +..B1.10: + xorl %eax, %eax + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.11: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type feclearexcept,@function + .size feclearexcept,.-feclearexcept + .data +# -- End feclearexcept + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fedisableexcept.S b/external/sgx_libm/intel64/fedisableexcept.S new file mode 100644 index 0000000000..90d6b05291 --- /dev/null +++ b/external/sgx_libm/intel64/fedisableexcept.S @@ -0,0 +1,105 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fedisableexcept.c" + .text +..TXTST0: +# -- Begin fedisableexcept + .text + .align 16,0x90 + .globl fedisableexcept +fedisableexcept: +# parameter 1: %edi +..B1.1: + .cfi_startproc +..___tag_value_fedisableexcept.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + andl $63, %edi + xorq %rsp, %rax + movq %rax, 40(%rsp) +..B1.2: + stmxcsr 4(%rsp) +..B1.3: + testl %edi, %edi + je ..B1.10 +..B1.4: + movl %edi, %eax + shll $7, %eax + orl 4(%rsp), %eax + movl %eax, (%rsp) +..B1.5: + fnstenv 8(%rsp) +..B1.6: + orw %di, 8(%rsp) +..B1.7: + fnclex +..B1.8: + fldenv 8(%rsp) +..B1.9: + ldmxcsr (%rsp) +..B1.10: + movl 4(%rsp), %eax + shrl $7, %eax + movq 40(%rsp), %rdx + notl %eax + xorq %rsp, %rdx + andl $63, %eax + cmpq %fs:40, %rdx + jne ..B1.12 +..B1.11: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type fedisableexcept,@function + .size fedisableexcept,.-fedisableexcept + .data +# -- End fedisableexcept + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/feenableexcept.S b/external/sgx_libm/intel64/feenableexcept.S new file mode 100644 index 0000000000..54e7fa2572 --- /dev/null +++ b/external/sgx_libm/intel64/feenableexcept.S @@ -0,0 +1,107 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feenableexcept.c" + .text +..TXTST0: +# -- Begin feenableexcept + .text + .align 16,0x90 + .globl feenableexcept +feenableexcept: +# parameter 1: %edi +..B1.1: + .cfi_startproc +..___tag_value_feenableexcept.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + andl $63, %edi + xorq %rsp, %rax + movq %rax, 40(%rsp) +..B1.2: + stmxcsr 4(%rsp) +..B1.3: + testl %edi, %edi + je ..B1.10 +..B1.4: + movl %edi, %eax + shll $7, %eax + notl %eax + andl 4(%rsp), %eax + movl %eax, (%rsp) +..B1.5: + fnstenv 8(%rsp) +..B1.6: + notl %edi + andw %di, 8(%rsp) +..B1.7: + fnclex +..B1.8: + fldenv 8(%rsp) +..B1.9: + ldmxcsr (%rsp) +..B1.10: + movl 4(%rsp), %eax + shrl $7, %eax + movq 40(%rsp), %rdx + notl %eax + xorq %rsp, %rdx + andl $63, %eax + cmpq %fs:40, %rdx + jne ..B1.12 +..B1.11: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type feenableexcept,@function + .size feenableexcept,.-feenableexcept + .data +# -- End feenableexcept + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fegetexcept.S b/external/sgx_libm/intel64/fegetexcept.S new file mode 100644 index 0000000000..3fa4440273 --- /dev/null +++ b/external/sgx_libm/intel64/fegetexcept.S @@ -0,0 +1,74 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetexcept.c" + .text +..TXTST0: +# -- Begin fegetexcept + .text + .align 16,0x90 + .globl fegetexcept +fegetexcept: +..B1.1: + .cfi_startproc +..___tag_value_fegetexcept.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 +..B1.2: + stmxcsr (%rsp) +..B1.3: + movl (%rsp), %eax + shrl $7, %eax + notl %eax + andl $63, %eax + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fegetexcept,@function + .size fegetexcept,.-fegetexcept + .data +# -- End fegetexcept + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fegetexceptflag.S b/external/sgx_libm/intel64/fegetexceptflag.S new file mode 100644 index 0000000000..d5d2bae756 --- /dev/null +++ b/external/sgx_libm/intel64/fegetexceptflag.S @@ -0,0 +1,81 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetexceptflag.c" + .text +..TXTST0: +# -- Begin fegetexceptflag + .text + .align 16,0x90 + .globl fegetexceptflag +fegetexceptflag: +# parameter 1: %rdi +# parameter 2: %esi +..B1.1: + .cfi_startproc +..___tag_value_fegetexceptflag.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + andl $63, %esi +..B1.2: + stmxcsr (%rsp) +..B1.3: + fnstsw 4(%rsp) +..B1.4: + movzwl 4(%rsp), %eax + orl (%rsp), %eax + andl %eax, %esi + movl %eax, (%rsp) + xorl %eax, %eax + movw %si, (%rdi) + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fegetexceptflag,@function + .size fegetexceptflag,.-fegetexceptflag + .data +# -- End fegetexceptflag + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fegetround.S b/external/sgx_libm/intel64/fegetround.S new file mode 100644 index 0000000000..8a77f3d6a4 --- /dev/null +++ b/external/sgx_libm/intel64/fegetround.S @@ -0,0 +1,73 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fegetround.c" + .text +..TXTST0: +# -- Begin fegetround + .text + .align 16,0x90 + .globl fegetround +fegetround: +..B1.1: + .cfi_startproc +..___tag_value_fegetround.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 +..B1.2: + stmxcsr (%rsp) +..B1.3: + movl (%rsp), %eax + shrl $3, %eax + andl $3072, %eax + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fegetround,@function + .size fegetround,.-fegetround + .data +# -- End fegetround + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/feholdexcept.S b/external/sgx_libm/intel64/feholdexcept.S new file mode 100644 index 0000000000..0075d09749 --- /dev/null +++ b/external/sgx_libm/intel64/feholdexcept.S @@ -0,0 +1,110 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feholdexcept.c" + .text +..TXTST0: +# -- Begin feholdexcept + .text + .align 16,0x90 + .globl feholdexcept +feholdexcept: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value_feholdexcept.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 40(%rsp) +..B1.2: + fnstenv 4(%rsp) +..B1.3: + movzwl 8(%rsp), %eax + movzwl 4(%rsp), %edx + movw %ax, 4(%rdi) + movw %dx, (%rdi) +..B1.4: + stmxcsr (%rsp) +..B1.5: + movl (%rsp), %eax + movzwl 8(%rsp), %edx + movzwl 4(%rsp), %ecx + andl $-64, %edx + orl $63, %ecx + movl %eax, 28(%rdi) + movw %dx, 8(%rsp) + movw %cx, 4(%rsp) +..B1.6: + fnclex +..B1.7: + fldenv 4(%rsp) +..B1.8: + movl (%rsp), %eax + andl $-64, %eax + orl $8064, %eax + movl %eax, (%rsp) +..B1.9: + ldmxcsr (%rsp) +..B1.10: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.12 +..B1.11: + xorl %eax, %eax + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type feholdexcept,@function + .size feholdexcept,.-feholdexcept + .data +# -- End feholdexcept + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/feraiseexcept.S b/external/sgx_libm/intel64/feraiseexcept.S new file mode 100644 index 0000000000..adc7c2b293 --- /dev/null +++ b/external/sgx_libm/intel64/feraiseexcept.S @@ -0,0 +1,159 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feraiseexcept.c" + .text +..TXTST0: +# -- Begin feraiseexcept + .text + .align 16,0x90 + .globl feraiseexcept +feraiseexcept: +# parameter 1: %edi +..B1.1: + .cfi_startproc +..___tag_value_feraiseexcept.1: +..L2: + + testl $1, %edi + je ..B1.3 +..B1.2: + lea d_zero(%rip), %rax + movsd (%rax), %xmm0 + divsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) +..B1.3: + testl $4, %edi + je ..B1.5 +..B1.4: + movq p_one(%rip), %rax + movq p_zero(%rip), %rdx + movsd (%rax), %xmm0 + divsd (%rdx), %xmm0 + movsd %xmm0, -8(%rsp) +..B1.5: + testl $2, %edi + je ..B1.7 +..B1.6: + lea d_tiny(%rip), %rax + movsd (%rax), %xmm0 + addsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) +..B1.7: + testl $8, %edi + je ..B1.9 +..B1.8: + lea d_huge(%rip), %rax + movsd (%rax), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) +..B1.9: + testl $16, %edi + je ..B1.11 +..B1.10: + lea d_norm(%rip), %rax + movsd (%rax), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) +..B1.11: + testl $32, %edi + je ..B1.13 +..B1.12: + movq p_one(%rip), %rax + movq p_norm(%rip), %rdx + movsd (%rax), %xmm0 + addsd (%rdx), %xmm0 + movsd %xmm0, -8(%rsp) +..B1.13: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type feraiseexcept,@function + .size feraiseexcept,.-feraiseexcept + .data +# -- End feraiseexcept + .section .rodata, "a" + .align 8 + .align 8 +d_zero: + .long 0x00000000,0x00000000 + .type d_zero,@object + .size d_zero,8 + .align 8 +d_one: + .long 0x00000000,0x3ff00000 + .type d_one,@object + .size d_one,8 + .align 8 +d_tiny: + .long 0xffffffff,0x000fffff + .type d_tiny,@object + .size d_tiny,8 + .align 8 +d_huge: + .long 0xffffffff,0x7fefffff + .type d_huge,@object + .size d_huge,8 + .align 8 +d_norm: + .long 0x00000000,0x00100000 + .type d_norm,@object + .size d_norm,8 + .section .data.rel.ro.local, "aw",@progbits + .align 8 + .align 8 +p_one: + .quad d_one + .type p_one,@object + .size p_one,8 + .align 8 +p_zero: + .quad d_zero + .type p_zero,@object + .size p_zero,8 + .align 8 +p_norm: + .quad d_norm + .type p_norm,@object + .size p_norm,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fesetenv.S b/external/sgx_libm/intel64/fesetenv.S new file mode 100644 index 0000000000..34d7de7f65 --- /dev/null +++ b/external/sgx_libm/intel64/fesetenv.S @@ -0,0 +1,119 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fesetenv.c" + .text +..TXTST0: +# -- Begin fesetenv + .text + .align 16,0x90 + .globl fesetenv +fesetenv: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value_fesetenv.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 40(%rsp) +..B1.2: + fnstenv 4(%rsp) +..B1.3: + movzwl 4(%rsp), %eax + movzwl 8(%rsp), %edx + andl $-3136, %eax + andl $-64, %edx + movw %ax, 4(%rsp) + movw %dx, 8(%rsp) +..B1.4: + stmxcsr (%rsp) +..B1.5: + movl (%rsp), %eax + andl $-32704, %eax + cmpq $-1, %rdi + je ..B1.13 +..B1.6: + movzwl (%rdi), %edx + movzwl 4(%rdi), %ecx + andl $3135, %edx + movl 28(%rdi), %eax + andl $63, %ecx + movl %eax, (%rsp) + orw %dx, 4(%rsp) + orw %cx, 8(%rsp) +..B1.7: + fnclex +..B1.8: + fldenv 4(%rsp) +..B1.9: + ldmxcsr (%rsp) +..B1.10: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.12 +..B1.11: + xorl %eax, %eax + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + call __stack_chk_fail@PLT +..B1.13: + orl $8064, %eax + movl %eax, (%rsp) + movzwl 4(%rsp), %eax + orl $63, %eax + movw %ax, 4(%rsp) + jmp ..B1.7 + .align 16,0x90 + .cfi_endproc + .type fesetenv,@function + .size fesetenv,.-fesetenv + .data +# -- End fesetenv + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fesetexceptflag.S b/external/sgx_libm/intel64/fesetexceptflag.S new file mode 100644 index 0000000000..2c49d08b29 --- /dev/null +++ b/external/sgx_libm/intel64/fesetexceptflag.S @@ -0,0 +1,110 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fesetexceptflag.c" + .text +..TXTST0: +# -- Begin fesetexceptflag + .text + .align 16,0x90 + .globl fesetexceptflag +fesetexceptflag: +# parameter 1: %rdi +# parameter 2: %esi +..B1.1: + .cfi_startproc +..___tag_value_fesetexceptflag.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 40(%rsp) + andl $63, %esi + je ..B1.9 +..B1.2: + stmxcsr (%rsp) +..B1.3: + movl %esi, %ecx + notl %ecx + movl (%rsp), %edx + movzwl (%rdi), %eax + andl %ecx, %edx + andl %esi, %eax + orl %eax, %edx + movl %edx, (%rsp) +..B1.4: + ldmxcsr (%rsp) +..B1.5: + fnstenv 4(%rsp) +..B1.6: + movzwl 8(%rsp), %eax + andl %ecx, %eax + movzwl (%rdi), %ecx + andl %esi, %ecx + orl %ecx, %eax + movw %ax, 8(%rsp) +..B1.7: + fnclex +..B1.8: + fldenv 4(%rsp) +..B1.9: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.11 +..B1.10: + xorl %eax, %eax + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.11: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type fesetexceptflag,@function + .size fesetexceptflag,.-fesetexceptflag + .data +# -- End fesetexceptflag + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fesetround.S b/external/sgx_libm/intel64/fesetround.S new file mode 100644 index 0000000000..4e0665258c --- /dev/null +++ b/external/sgx_libm/intel64/fesetround.S @@ -0,0 +1,115 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fesetround.c" + .text +..TXTST0: +# -- Begin fesetround + .text + .align 16,0x90 + .globl fesetround +fesetround: +# parameter 1: %edi +..B1.1: + .cfi_startproc +..___tag_value_fesetround.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 40(%rsp) + testl $-3073, %edi + jne ..B1.11 +..B1.2: + stmxcsr (%rsp) +..B1.3: + movl (%rsp), %edx + lea (,%rdi,8), %eax + andl $-24577, %edx + orl %eax, %edx + movl %edx, (%rsp) +..B1.4: + ldmxcsr (%rsp) +..B1.5: + fnstenv 4(%rsp) +..B1.6: + movzwl 4(%rsp), %eax + andl $-3073, %eax + orl %edi, %eax + movw %ax, 4(%rsp) +..B1.7: + fnclex +..B1.8: + fldenv 4(%rsp) +..B1.9: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.13 +..B1.10: + xorl %eax, %eax + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.11: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.13 +..B1.12: + movl $1, %eax + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.13: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type fesetround,@function + .size fesetround,.-fesetround + .data +# -- End fesetround + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fetestexcept.S b/external/sgx_libm/intel64/fetestexcept.S new file mode 100644 index 0000000000..37631aa293 --- /dev/null +++ b/external/sgx_libm/intel64/fetestexcept.S @@ -0,0 +1,85 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fetestexcept.c" + .text +..TXTST0: +# -- Begin fetestexcept + .text + .align 16,0x90 + .globl fetestexcept +fetestexcept: +# parameter 1: %edi +..B1.1: + .cfi_startproc +..___tag_value_fetestexcept.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + andl $63, %edi + je ..B1.5 +..B1.2: + stmxcsr (%rsp) +..B1.3: + fnstsw 4(%rsp) +..B1.4: + movzwl 4(%rsp), %eax + orl (%rsp), %eax + movl %eax, (%rsp) + andl %edi, %eax + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B1.5: + xorl %eax, %eax + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fetestexcept,@function + .size fetestexcept,.-fetestexcept + .data +# -- End fetestexcept + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/feupdateenv.S b/external/sgx_libm/intel64/feupdateenv.S new file mode 100644 index 0000000000..6d0471e58c --- /dev/null +++ b/external/sgx_libm/intel64/feupdateenv.S @@ -0,0 +1,99 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "feupdateenv.c" + .text +..TXTST0: +# -- Begin feupdateenv + .text + .align 16,0x90 + .globl feupdateenv +feupdateenv: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value_feupdateenv.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %rsi + .cfi_def_cfa_offset 32 + movq %rdi, %r12 + movl $63, %edi +..___tag_value_feupdateenv.8: + call fetestexcept@PLT +..___tag_value_feupdateenv.9: +..B1.7: + movl %eax, %r13d +..B1.2: + movq %r12, %rdi +..___tag_value_feupdateenv.10: + call fesetenv@PLT +..___tag_value_feupdateenv.11: +..B1.3: + movl %r13d, %edi +..___tag_value_feupdateenv.12: + call feraiseexcept@PLT +..___tag_value_feupdateenv.13: +..B1.4: + xorl %eax, %eax + popq %rcx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type feupdateenv,@function + .size feupdateenv,.-feupdateenv + .data +# -- End feupdateenv + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/floor_gen.S b/external/sgx_libm/intel64/floor_gen.S new file mode 100644 index 0000000000..daa3faa589 --- /dev/null +++ b/external/sgx_libm/intel64/floor_gen.S @@ -0,0 +1,167 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "floor_gen.c" + .text +..TXTST0: +# -- Begin floor + .text + .align 16,0x90 + .globl floor +floor: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_floor.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %edi + andl $2147483647, %edi + lea -1072693248(%rdi), %edx + cmpl $54525952, %edx + jae ..B1.12 +..B1.2: + movl %edi, %ecx + shrl $20, %ecx + cmpl $22020096, %edx + jae ..B1.8 +..B1.3: + negl %ecx + movl $-1, %esi + addl $19, %ecx + shll %cl, %esi + movl %esi, %edx + andl %esi, %eax + notl %edx + andl %edx, %edi + orl -8(%rsp), %edi + movl $0, -8(%rsp) + testl $-2147483648, %eax + je ..B1.6 +..B1.4: + testl %edi, %edi + je ..B1.6 +..B1.5: + subl %esi, %eax + movl %eax, -4(%rsp) + jmp ..B1.11 +..B1.6: + movl %eax, -4(%rsp) + jmp ..B1.11 +..B1.8: + negl %ecx + movl $-1, %esi + addl $19, %ecx + shll %cl, %esi + movl %esi, %ecx + notl %ecx + movl -8(%rsp), %edx + andl %edx, %ecx + andl %esi, %edx + movl %edx, -8(%rsp) + testl $-2147483648, %eax + je ..B1.11 +..B1.9: + testl %ecx, %ecx + je ..B1.11 +..B1.10: + movl -4(%rsp), %eax + shlq $32, %rax + movslq %esi, %rsi + orq %rdx, %rax + subq %rsi, %rax + movq %rax, -8(%rsp) +..B1.11: + movsd -8(%rsp), %xmm0 + ret +..B1.12: + testl $-2147483648, %edx + je ..B1.17 +..B1.13: + movl -8(%rsp), %edx + orl %edx, %edi + jne ..B1.15 +..B1.14: + movsd -8(%rsp), %xmm0 + ret +..B1.15: + lea _pzero_none(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 +..B1.16: + ret +..B1.17: + movsd -8(%rsp), %xmm0 + cmpl $1073741824, %edx + jb ..B1.20 +..B1.19: + lea _ones(%rip), %rax + mulsd (%rax), %xmm0 +..B1.20: + ret + .align 16,0x90 + .cfi_endproc + .type floor,@function + .size floor,.-floor + .data +# -- End floor + .section .rodata, "a" + .align 4 + .align 4 +_pzero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _pzero_none,@object + .size _pzero_none,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/floorf_gen.S b/external/sgx_libm/intel64/floorf_gen.S new file mode 100644 index 0000000000..1a7ad62bab --- /dev/null +++ b/external/sgx_libm/intel64/floorf_gen.S @@ -0,0 +1,141 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "floorf_gen.c" + .text +..TXTST0: +# -- Begin floorf + .text + .align 16,0x90 + .globl floorf +floorf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_floorf.1: +..L2: + + movaps %xmm0, %xmm2 + movss %xmm2, -16(%rsp) + movzwl -14(%rsp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $149, %eax + jge ..B1.8 +..B1.2: + cmpl $127, %eax + jl ..B1.4 +..B1.3: + movss .L_2il0floatpacket.0(%rip), %xmm1 + movaps %xmm1, %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, -24(%rsp) + movss -24(%rsp), %xmm3 + movss .L_2il0floatpacket.1(%rip), %xmm0 + subss %xmm1, %xmm3 + comiss %xmm2, %xmm3 + addss %xmm3, %xmm0 + ja ..L3 + movaps %xmm3, %xmm0 +..L3: + ret +..B1.4: + testl %eax, %eax + jne ..B1.7 +..B1.5: + testl $8388607, -16(%rsp) + jne ..B1.7 +..B1.6: + movss -16(%rsp), %xmm0 + ret +..B1.7: + movb -13(%rsp), %dl + lea _pzero_none(%rip), %rcx + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + movl -16(%rsp), %eax + movl %eax, -24(%rsp) + movss (%rcx,%rsi,4), %xmm0 + ret +..B1.8: + cmpl $150, %eax + jge ..B1.6 +..B1.9: + movss -16(%rsp), %xmm1 + movss .L_2il0floatpacket.2(%rip), %xmm0 + testb $1, -16(%rsp) + addss %xmm1, %xmm0 + jne ..L4 + movaps %xmm1, %xmm0 +..L4: + ret + .align 16,0x90 + .cfi_endproc + .type floorf,@function + .size floorf,.-floorf + .data +# -- End floorf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4b400000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0xbf800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0xbf000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +_pzero_none: + .long 0 + .long 3212836864 + .type _pzero_none,@object + .size _pzero_none,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/floorl.S b/external/sgx_libm/intel64/floorl.S new file mode 100644 index 0000000000..5f739d46df --- /dev/null +++ b/external/sgx_libm/intel64/floorl.S @@ -0,0 +1,256 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "floorl.c" + .text +..TXTST0: +# -- Begin floorl + .text + .align 16,0x90 + .globl floorl +floorl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_floorl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %cl, %cl +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 56(%rsp), %eax + andl $32767, %eax + cmpl $16445, %eax + jge ..B1.20 +..B1.4: + cmpl $16383, %eax + jl ..B1.15 +..B1.5: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.7: + fldcw 24(%rsp) +..B1.8: + movb $1, %cl +..B1.9: + fldt 48(%rsp) + lea _TWO_63H(%rip), %rax + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 8(%rsp) + fldt 8(%rsp) + fcomip %st(1), %st + fstp %st(0) + jbe ..B1.12 +..B1.10: + fldt 8(%rsp) + lea 8+_ones(%rip), %rax + faddl (%rax) + fstpt 8(%rsp) +..B1.12: + testb %cl, %cl + je ..B1.14 +..B1.13: + fldcw 26(%rsp) +..B1.14: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.15: + testl %eax, %eax + jne ..B1.19 +..B1.16: + cmpq $0, 48(%rsp) + jne ..B1.18 +..B1.17: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.18: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rsp) +..B1.19: + movb 57(%rsp), %al + lea _pzero_none(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.20: + cmpl $16446, %eax + jge ..B1.29 +..B1.21: + testb $1, 48(%rsp) + je ..B1.28 +..B1.22: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.35 +..B1.23: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.24: + fldcw 24(%rsp) +..B1.25: + fldt 48(%rsp) + lea 8+_halfs(%rip), %rax + faddl (%rax) + fstpt 8(%rsp) +..B1.26: + fldcw 26(%rsp) +..B1.27: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.28: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.29: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.30: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.31: + fldcw 24(%rsp) +..B1.32: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) +..B1.33: + fldcw 26(%rsp) +..B1.34: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.35: + fldt 48(%rsp) + lea 8+_halfs(%rip), %rax + faddl (%rax) + fstpt 8(%rsp) + jmp ..B1.27 +..B1.36: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) + jmp ..B1.34 + .align 16,0x90 + .cfi_endproc + .type floorl,@function + .size floorl,.-floorl + .data +# -- End floorl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_pzero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _pzero_none,@object + .size _pzero_none,16 + .align 4 +_halfs: + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type _halfs,@object + .size _halfs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fma_gen.S b/external/sgx_libm/intel64/fma_gen.S new file mode 100644 index 0000000000..51110ae806 --- /dev/null +++ b/external/sgx_libm/intel64/fma_gen.S @@ -0,0 +1,1644 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fma_gen.c" + .text +..TXTST0: +# -- Begin fma + .text + + .globl fma +fma: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +# parameter 3: %xmm2 +..B1.1: + .cfi_startproc +..___tag_value_fma.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + movq %rsp, %rbp + .cfi_def_cfa 6, 16 + .cfi_offset 6, -16 + subq $272, %rsp + movsd %xmm0, -80(%rbp) + movsd %xmm1, -72(%rbp) + movsd %xmm2, -64(%rbp) +..B1.2: + stmxcsr -272(%rbp) +..B1.3: + movl -272(%rbp), %eax + andl $24576, %eax + movl %eax, -268(%rbp) + lea -80(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $2147483647, %eax + movl %eax, -264(%rbp) + lea -80(%rbp), %rax + movl (%rax), %eax + movl %eax, -260(%rbp) + lea -72(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $2147483647, %eax + movl %eax, -256(%rbp) + lea -72(%rbp), %rax + movl (%rax), %eax + movl %eax, -252(%rbp) + lea -64(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $2147483647, %eax + movl %eax, -248(%rbp) + lea -64(%rbp), %rax + movl (%rax), %eax + movl %eax, -244(%rbp) + movl -260(%rbp), %eax + orl -264(%rbp), %eax + je ..B1.11 +..B1.4: + movl -264(%rbp), %eax + cmpl $2146435072, %eax + jae ..B1.11 +..B1.5: + movl $-1072693248, %eax + addl -264(%rbp), %eax + orl -260(%rbp), %eax + je ..B1.11 +..B1.6: + movl -252(%rbp), %eax + orl -256(%rbp), %eax + je ..B1.11 +..B1.7: + movl -256(%rbp), %eax + cmpl $2146435072, %eax + jae ..B1.11 +..B1.8: + movl $-1072693248, %eax + addl -256(%rbp), %eax + orl -252(%rbp), %eax + je ..B1.11 +..B1.9: + movl -244(%rbp), %eax + orl -248(%rbp), %eax + je ..B1.11 +..B1.10: + movl -248(%rbp), %eax + cmpl $2146435072, %eax + jb ..B1.28 +..B1.11: + movl -264(%rbp), %eax + cmpl $2146435072, %eax + ja ..B1.14 +..B1.12: + movl -264(%rbp), %eax + cmpl $2146435072, %eax + jne ..B1.15 +..B1.13: + movl -260(%rbp), %eax + testl %eax, %eax + je ..B1.15 +..B1.14: + movsd -80(%rbp), %xmm0 + lea _ones(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.15: + movl -256(%rbp), %eax + cmpl $2146435072, %eax + ja ..B1.18 +..B1.16: + movl -256(%rbp), %eax + cmpl $2146435072, %eax + jne ..B1.19 +..B1.17: + movl -252(%rbp), %eax + testl %eax, %eax + je ..B1.19 +..B1.18: + movsd -72(%rbp), %xmm0 + lea _ones(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.19: + movl -248(%rbp), %eax + cmpl $2146435072, %eax + ja ..B1.22 +..B1.20: + movl -248(%rbp), %eax + cmpl $2146435072, %eax + jne ..B1.23 +..B1.21: + movl -244(%rbp), %eax + testl %eax, %eax + je ..B1.23 +..B1.22: + movsd -64(%rbp), %xmm0 + lea _ones(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.23: + movl -264(%rbp), %eax + cmpl $2146435072, %eax + jae ..B1.27 +..B1.24: + movl -256(%rbp), %eax + cmpl $2146435072, %eax + jae ..B1.27 +..B1.25: + movl -248(%rbp), %eax + cmpl $2146435072, %eax + jb ..B1.27 +..B1.26: + movsd -64(%rbp), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.27: + movsd -80(%rbp), %xmm0 + movsd -72(%rbp), %xmm1 + mulsd %xmm1, %xmm0 + movsd -64(%rbp), %xmm1 + addsd %xmm1, %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.28: + movl -264(%rbp), %eax + cmpl $1048576, %eax + jae ..B1.30 +..B1.29: + lea -80(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + shrl $31, %eax + movl %eax, -240(%rbp) + lea -80(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + orl $1072693248, %eax + lea -80(%rbp), %rdx + addq $4, %rdx + movl %eax, (%rdx) + movl -240(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _ones(%rip), %rdx + addq %rax, %rdx + movsd -80(%rbp), %xmm0 + movsd (%rdx), %xmm1 + subsd %xmm1, %xmm0 + movsd %xmm0, -80(%rbp) + lea -80(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $2147483647, %eax + movl %eax, -264(%rbp) + lea -80(%rbp), %rax + movl (%rax), %eax + movl %eax, -260(%rbp) + movl -264(%rbp), %eax + shrl $20, %eax + addl $-1022, %eax + movl %eax, -236(%rbp) + jmp ..B1.31 +..B1.30: + movl -264(%rbp), %eax + shrl $20, %eax + movl %eax, -236(%rbp) +..B1.31: + movl -256(%rbp), %eax + cmpl $1048576, %eax + jae ..B1.33 +..B1.32: + lea -72(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + shrl $31, %eax + movl %eax, -232(%rbp) + lea -72(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + orl $1072693248, %eax + lea -72(%rbp), %rdx + addq $4, %rdx + movl %eax, (%rdx) + movl -232(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _ones(%rip), %rdx + addq %rax, %rdx + movsd -72(%rbp), %xmm0 + movsd (%rdx), %xmm1 + subsd %xmm1, %xmm0 + movsd %xmm0, -72(%rbp) + lea -72(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $2147483647, %eax + movl %eax, -256(%rbp) + lea -72(%rbp), %rax + movl (%rax), %eax + movl %eax, -252(%rbp) + movl -256(%rbp), %eax + shrl $20, %eax + addl $-1022, %eax + movl %eax, -228(%rbp) + jmp ..B1.34 +..B1.33: + movl -256(%rbp), %eax + shrl $20, %eax + movl %eax, -228(%rbp) +..B1.34: + movl -248(%rbp), %eax + cmpl $1048576, %eax + jae ..B1.36 +..B1.35: + lea -64(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + shrl $31, %eax + movl %eax, -224(%rbp) + lea -64(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + orl $1072693248, %eax + lea -64(%rbp), %rdx + addq $4, %rdx + movl %eax, (%rdx) + movl -224(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _ones(%rip), %rdx + addq %rax, %rdx + movsd -64(%rbp), %xmm0 + movsd (%rdx), %xmm1 + subsd %xmm1, %xmm0 + movsd %xmm0, -64(%rbp) + lea -64(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $2147483647, %eax + movl %eax, -248(%rbp) + lea -64(%rbp), %rax + movl (%rax), %eax + movl %eax, -244(%rbp) + movl -248(%rbp), %eax + shrl $20, %eax + addl $-1022, %eax + movl %eax, -220(%rbp) + jmp ..B1.37 +..B1.36: + movl -248(%rbp), %eax + shrl $20, %eax + movl %eax, -220(%rbp) +..B1.37: + movl -264(%rbp), %eax + andl $1048575, %eax + orl $1048576, %eax + movl %eax, -216(%rbp) + movl -256(%rbp), %eax + andl $1048575, %eax + orl $1048576, %eax + movl %eax, -212(%rbp) + movl -248(%rbp), %eax + andl $1048575, %eax + orl $1048576, %eax + movl %eax, -208(%rbp) + lea -80(%rbp), %rax + addq $4, %rax + lea -72(%rbp), %rdx + addq $4, %rdx + movl (%rdx), %edx + xorl (%rax), %edx + andl $-2147483648, %edx + movl %edx, -204(%rbp) + movl -228(%rbp), %eax + addl -236(%rbp), %eax + addl $-1023, %eax + movl %eax, -200(%rbp) + movl -252(%rbp), %eax + movl -260(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -56(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -196(%rbp) + movl -56(%rbp), %eax + movl %eax, -192(%rbp) + movl -252(%rbp), %eax + movl -216(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -48(%rbp) + movq -48(%rbp), %rax + shrq $32, %rax + movl %eax, -188(%rbp) + movl -48(%rbp), %eax + movl %eax, -184(%rbp) + movl -212(%rbp), %eax + movl -260(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -40(%rbp) + movq -40(%rbp), %rax + shrq $32, %rax + movl %eax, -180(%rbp) + movl -40(%rbp), %eax + movl %eax, -176(%rbp) + movl -212(%rbp), %eax + movl -216(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -32(%rbp) + movq -32(%rbp), %rax + shrq $32, %rax + movl %eax, -172(%rbp) + movl -32(%rbp), %eax + movl %eax, -168(%rbp) + movl -192(%rbp), %eax + movl %eax, -164(%rbp) + movl -196(%rbp), %eax + movq %rax, -24(%rbp) + movl -184(%rbp), %eax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -176(%rbp), %eax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -160(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -156(%rbp) + movl -168(%rbp), %eax + movq %rax, -24(%rbp) + movl -188(%rbp), %eax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -180(%rbp), %eax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -156(%rbp), %eax + movslq %eax, %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -152(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -156(%rbp) + movl -156(%rbp), %eax + addl -172(%rbp), %eax + movl %eax, -148(%rbp) + movl -148(%rbp), %eax + testl $512, %eax + je ..B1.39 +..B1.38: + movl -148(%rbp), %eax + shll $11, %eax + movl -152(%rbp), %edx + shrl $21, %edx + orl %edx, %eax + movl %eax, -148(%rbp) + movl -152(%rbp), %eax + shll $11, %eax + movl -160(%rbp), %edx + shrl $21, %edx + orl %edx, %eax + movl %eax, -152(%rbp) + movl -160(%rbp), %eax + shll $11, %eax + movl -164(%rbp), %edx + shrl $21, %edx + orl %edx, %eax + movl %eax, -160(%rbp) + shll $11, -164(%rbp) + movl $1, %eax + addl -200(%rbp), %eax + movl %eax, -200(%rbp) + jmp ..B1.40 +..B1.39: + movl -148(%rbp), %eax + shll $12, %eax + movl -152(%rbp), %edx + shrl $20, %edx + orl %edx, %eax + movl %eax, -148(%rbp) + movl -152(%rbp), %eax + shll $12, %eax + movl -160(%rbp), %edx + shrl $20, %edx + orl %edx, %eax + movl %eax, -152(%rbp) + movl -160(%rbp), %eax + shll $12, %eax + movl -164(%rbp), %edx + shrl $20, %edx + orl %edx, %eax + movl %eax, -160(%rbp) + shll $12, -164(%rbp) +..B1.40: + movl -200(%rbp), %eax + movl -220(%rbp), %edx + cmpl %edx, %eax + jg ..B1.45 +..B1.41: + movl -200(%rbp), %eax + movl -220(%rbp), %edx + cmpl %edx, %eax + jne ..B1.46 +..B1.42: + movl -148(%rbp), %eax + movl -208(%rbp), %edx + cmpl %edx, %eax + ja ..B1.45 +..B1.43: + movl -148(%rbp), %eax + movl -208(%rbp), %edx + cmpl %edx, %eax + jne ..B1.46 +..B1.44: + movl -152(%rbp), %eax + movl -244(%rbp), %edx + cmpl %edx, %eax + jb ..B1.46 +..B1.45: + movl -220(%rbp), %eax + negl %eax + addl -200(%rbp), %eax + movl %eax, -144(%rbp) + movl -208(%rbp), %eax + movl %eax, -140(%rbp) + movl -244(%rbp), %eax + movl %eax, -136(%rbp) + movl $0, %eax + movl %eax, -132(%rbp) + movl %eax, -128(%rbp) + lea -64(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $-2147483648, %eax + movl %eax, -224(%rbp) + jmp ..B1.47 +..B1.46: + movl -200(%rbp), %eax + negl %eax + addl -220(%rbp), %eax + movl %eax, -144(%rbp) + movl -220(%rbp), %eax + movl %eax, -200(%rbp) + movl -148(%rbp), %eax + movl %eax, -140(%rbp) + movl -152(%rbp), %eax + movl %eax, -136(%rbp) + movl -160(%rbp), %eax + movl %eax, -128(%rbp) + movl -164(%rbp), %eax + movl %eax, -132(%rbp) + movl -208(%rbp), %eax + movl %eax, -148(%rbp) + movl -244(%rbp), %eax + movl %eax, -152(%rbp) + movl $0, %eax + movl %eax, -164(%rbp) + movl %eax, -160(%rbp) + movl -204(%rbp), %eax + movl %eax, -224(%rbp) + lea -64(%rbp), %rax + addq $4, %rax + movl (%rax), %eax + andl $-2147483648, %eax + movl %eax, -204(%rbp) +..B1.47: + movl $0, -124(%rbp) + movl -144(%rbp), %eax + testl %eax, %eax + je ..B1.57 +..B1.48: + movl -144(%rbp), %eax + cmpl $32, %eax + jge ..B1.50 +..B1.49: + movl -144(%rbp), %eax + negl %eax + addl $32, %eax + movl %eax, -120(%rbp) + movl -144(%rbp), %eax + movl %eax, -116(%rbp) + movl $-1, %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -112(%rbp) + movl -132(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl %eax, -124(%rbp) + movl -128(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -132(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -132(%rbp) + movl -136(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -128(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -128(%rbp) + movl -140(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -136(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -136(%rbp) + movl -116(%rbp), %eax + movl %eax, %ecx + shrl %cl, -140(%rbp) + jmp ..B1.57 +..B1.50: + movl -144(%rbp), %eax + cmpl $64, %eax + jge ..B1.52 +..B1.51: + movl -144(%rbp), %eax + negl %eax + addl $64, %eax + movl %eax, -120(%rbp) + movl $-32, %eax + addl -144(%rbp), %eax + movl %eax, -116(%rbp) + movl $-1, %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -112(%rbp) + movl -128(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -132(%rbp), %edx + movl $1, %ecx + testl %edx, %edx + cmovne %ecx, %edx + orl %edx, %eax + movl %eax, -124(%rbp) + movl -136(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -128(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -132(%rbp) + movl -140(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -136(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -128(%rbp) + movl -140(%rbp), %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -136(%rbp) + movl $0, -140(%rbp) + jmp ..B1.57 +..B1.52: + movl -144(%rbp), %eax + cmpl $96, %eax + jge ..B1.54 +..B1.53: + movl -144(%rbp), %eax + negl %eax + addl $96, %eax + movl %eax, -120(%rbp) + movl $-64, %eax + addl -144(%rbp), %eax + movl %eax, -116(%rbp) + movl $-1, %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -112(%rbp) + movl -136(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -132(%rbp), %edx + orl -128(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -140(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -136(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -132(%rbp) + movl -140(%rbp), %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -128(%rbp) + movl $0, %eax + movl %eax, -136(%rbp) + movl %eax, -140(%rbp) + jmp ..B1.57 +..B1.54: + movl -144(%rbp), %eax + cmpl $128, %eax + jge ..B1.56 +..B1.55: + movl -144(%rbp), %eax + negl %eax + addl $128, %eax + movl %eax, -120(%rbp) + movl $-96, %eax + addl -144(%rbp), %eax + movl %eax, -116(%rbp) + movl $-1, %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -112(%rbp) + movl -140(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -128(%rbp), %edx + orl -136(%rbp), %edx + orl -132(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -140(%rbp), %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -132(%rbp) + movl $0, -128(%rbp) + movl $0, %eax + movl %eax, -136(%rbp) + movl %eax, -140(%rbp) + jmp ..B1.57 +..B1.56: + movl -136(%rbp), %eax + orl -140(%rbp), %eax + orl -128(%rbp), %eax + orl -132(%rbp), %eax + movl $1, %eax + movl $0, %edx + cmovne %eax, %edx + movl %edx, -124(%rbp) + movl $0, -132(%rbp) + movl $0, -128(%rbp) + movl $0, %eax + movl %eax, -136(%rbp) + movl %eax, -140(%rbp) +..B1.57: + movl -204(%rbp), %eax + movl -224(%rbp), %edx + cmpl %edx, %eax + jne ..B1.64 +..B1.58: + movl -164(%rbp), %eax + movl %eax, -108(%rbp) + movl -132(%rbp), %eax + addl -164(%rbp), %eax + movl %eax, -164(%rbp) + movl -164(%rbp), %eax + movl -108(%rbp), %edx + cmpl %edx, %eax + jb ..B1.60 +..B1.59: + movl $0, -156(%rbp) + jmp ..B1.61 +..B1.60: + movl $1, -156(%rbp) +..B1.61: + movl -160(%rbp), %eax + movq %rax, -24(%rbp) + movl -128(%rbp), %eax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -156(%rbp), %eax + movslq %eax, %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -160(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -156(%rbp) + movl -152(%rbp), %eax + movq %rax, -24(%rbp) + movl -136(%rbp), %eax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -156(%rbp), %eax + movslq %eax, %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -152(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -156(%rbp) + movl -140(%rbp), %eax + addl -148(%rbp), %eax + movl %eax, -148(%rbp) + movl -156(%rbp), %eax + addl -148(%rbp), %eax + movl %eax, -148(%rbp) + movl -148(%rbp), %eax + testl $2097152, %eax + je ..B1.63 +..B1.62: + movl -152(%rbp), %eax + shll $31, %eax + movl -164(%rbp), %edx + orl -160(%rbp), %edx + orl -124(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -148(%rbp), %eax + shll $31, %eax + movl -152(%rbp), %edx + shrl $1, %edx + orl %edx, %eax + movl %eax, -100(%rbp) + movl -148(%rbp), %eax + shrl $1, %eax + andl $1048575, %eax + movl %eax, -96(%rbp) + movl $1, %eax + addl -200(%rbp), %eax + movl %eax, -200(%rbp) + jmp ..B1.90 +..B1.63: + movl -160(%rbp), %eax + movl -124(%rbp), %edx + orl -164(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -152(%rbp), %eax + movl %eax, -100(%rbp) + movl -148(%rbp), %eax + andl $1048575, %eax + movl %eax, -96(%rbp) + jmp ..B1.90 +..B1.64: + movl -124(%rbp), %eax + negl %eax + movl %eax, -124(%rbp) + movl -124(%rbp), %eax + testl %eax, %eax + jne ..B1.66 +..B1.65: + movl $0, -104(%rbp) + jmp ..B1.67 +..B1.66: + movl $1, -104(%rbp) +..B1.67: + movl -164(%rbp), %eax + movq %rax, -24(%rbp) + movl -132(%rbp), %eax + negq %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -104(%rbp), %eax + movslq %eax, %rax + negq %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -164(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -104(%rbp) + movl -160(%rbp), %eax + movq %rax, -24(%rbp) + movl -128(%rbp), %eax + negq %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -104(%rbp), %eax + movslq %eax, %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -160(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -104(%rbp) + movl -152(%rbp), %eax + movq %rax, -24(%rbp) + movl -136(%rbp), %eax + negq %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -104(%rbp), %eax + movslq %eax, %rax + addq -24(%rbp), %rax + movq %rax, -24(%rbp) + movl -24(%rbp), %eax + movl %eax, -152(%rbp) + movq -24(%rbp), %rax + shrq $32, %rax + movl %eax, -104(%rbp) + movl -140(%rbp), %eax + negl %eax + addl -148(%rbp), %eax + movl %eax, -148(%rbp) + movl -104(%rbp), %eax + addl -148(%rbp), %eax + movl %eax, -148(%rbp) + movl -148(%rbp), %eax + testl %eax, %eax + je ..B1.69 +..B1.68: + movl -148(%rbp), %eax + shll $11, %eax + movl %eax, -108(%rbp) + movl $0, -144(%rbp) + jmp ..B1.78 +..B1.69: + movl -152(%rbp), %eax + testl %eax, %eax + je ..B1.71 +..B1.70: + movl -152(%rbp), %eax + movl %eax, -108(%rbp) + movl $21, -144(%rbp) + jmp ..B1.78 +..B1.71: + movl -160(%rbp), %eax + testl %eax, %eax + je ..B1.73 +..B1.72: + movl -160(%rbp), %eax + movl %eax, -108(%rbp) + movl $53, -144(%rbp) + jmp ..B1.78 +..B1.73: + movl -164(%rbp), %eax + testl %eax, %eax + je ..B1.75 +..B1.74: + movl -164(%rbp), %eax + movl %eax, -108(%rbp) + movl $85, -144(%rbp) + jmp ..B1.78 +..B1.75: + movl -124(%rbp), %eax + testl %eax, %eax + je ..B1.77 +..B1.76: + movl -124(%rbp), %eax + movl %eax, -108(%rbp) + movl $117, -144(%rbp) + jmp ..B1.78 +..B1.77: + movl -268(%rbp), %eax + movl $1, %edx + movl $0, %ecx + cmpl $8192, %eax + cmove %edx, %ecx + movslq %ecx, %rcx + shlq $3, %rcx + lea _zeros(%rip), %rax + addq %rcx, %rax + movsd (%rax), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.78: + movl -108(%rbp), %eax + testl $-2147483648, %eax + jne ..B1.80 +..B1.79: + shll $1, -108(%rbp) + movl $1, %eax + addl -144(%rbp), %eax + movl %eax, -144(%rbp) + jmp ..B1.78 +..B1.80: + movl -144(%rbp), %eax + cmpl $32, %eax + jge ..B1.82 +..B1.81: + movl -144(%rbp), %eax + movl %eax, -120(%rbp) + movl -144(%rbp), %eax + negl %eax + addl $32, %eax + movl %eax, -116(%rbp) + movl $1, %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -92(%rbp) + movl -160(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -124(%rbp), %edx + orl -164(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -152(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -160(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + movl %eax, -100(%rbp) + movl -148(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -152(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + andl $1048575, %eax + movl %eax, -96(%rbp) + jmp ..B1.89 +..B1.82: + movl -144(%rbp), %eax + cmpl $64, %eax + jge ..B1.84 +..B1.83: + movl $-32, %eax + addl -144(%rbp), %eax + movl %eax, -120(%rbp) + movl -144(%rbp), %eax + negl %eax + addl $64, %eax + movl %eax, -116(%rbp) + movl $1, %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -92(%rbp) + movl -164(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -124(%rbp), %edx + movl $1, %ecx + testl %edx, %edx + cmovne %ecx, %edx + orl %edx, %eax + movl %eax, -124(%rbp) + movl -160(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -164(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + movl %eax, -100(%rbp) + movl -152(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -160(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + andl $1048575, %eax + movl %eax, -96(%rbp) + jmp ..B1.89 +..B1.84: + movl -144(%rbp), %eax + cmpl $96, %eax + jge ..B1.86 +..B1.85: + movl $-64, %eax + addl -144(%rbp), %eax + movl %eax, -120(%rbp) + movl -144(%rbp), %eax + negl %eax + addl $96, %eax + movl %eax, -116(%rbp) + movl $1, %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -92(%rbp) + movl -120(%rbp), %eax + movl %eax, %ecx + shll %cl, -124(%rbp) + movl -164(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -124(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + movl %eax, -100(%rbp) + movl -160(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -164(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + andl $1048575, %eax + movl %eax, -96(%rbp) + jmp ..B1.89 +..B1.86: + movl -144(%rbp), %eax + cmpl $128, %eax + jge ..B1.88 +..B1.87: + movl $-96, %eax + addl -144(%rbp), %eax + movl %eax, -120(%rbp) + movl -144(%rbp), %eax + negl %eax + addl $128, %eax + movl %eax, -116(%rbp) + movl $1, %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -92(%rbp) + movl $0, -124(%rbp) + movl -124(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl %eax, -100(%rbp) + movl -164(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -124(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + andl -92(%rbp), %edx + orl %edx, %eax + andl $1048575, %eax + movl %eax, -96(%rbp) + jmp ..B1.89 +..B1.88: + movl $-128, %eax + addl -144(%rbp), %eax + movl %eax, -120(%rbp) + movl $0, %eax + movl %eax, -100(%rbp) + movl %eax, -124(%rbp) + movl -124(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl $1048575, %eax + movl %eax, -96(%rbp) +..B1.89: + movl -144(%rbp), %eax + negl %eax + addl -200(%rbp), %eax + movl %eax, -200(%rbp) +..B1.90: + movl $-1, %eax + addl -200(%rbp), %eax + cmpl $2046, %eax + jb ..B1.98 +..B1.91: + movl -200(%rbp), %eax + cmpl $2047, %eax + jl ..B1.93 +..B1.92: + shrl $31, -204(%rbp) + movl -204(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _large_value_64(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) + movsd %xmm0, -8(%rbp) + movsd -8(%rbp), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.93: + orl $1048576, -96(%rbp) + movl -200(%rbp), %eax + negl %eax + incl %eax + movl %eax, -144(%rbp) + movl -144(%rbp), %eax + cmpl $32, %eax + jge ..B1.95 +..B1.94: + movl -144(%rbp), %eax + negl %eax + addl $32, %eax + movl %eax, -120(%rbp) + movl -144(%rbp), %eax + movl %eax, -116(%rbp) + movl $-1, %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -112(%rbp) + movl -100(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -124(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl -124(%rbp), %edx + movl -120(%rbp), %ecx + shll %cl, %edx + movl -112(%rbp), %ecx + testl %ecx, %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -96(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -100(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -100(%rbp) + movl -116(%rbp), %eax + movl %eax, %ecx + shrl %cl, -96(%rbp) + jmp ..B1.99 +..B1.95: + movl -144(%rbp), %eax + cmpl $53, %eax + jg ..B1.97 +..B1.96: + movl -144(%rbp), %eax + negl %eax + addl $64, %eax + movl %eax, -120(%rbp) + movl $-32, %eax + addl -144(%rbp), %eax + movl %eax, -116(%rbp) + movl $-1, %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -112(%rbp) + movl -96(%rbp), %eax + movl -120(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -112(%rbp), %eax + movl -100(%rbp), %edx + movl -116(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl -100(%rbp), %edx + movl -120(%rbp), %ecx + shll %cl, %edx + andl -112(%rbp), %edx + orl -124(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -124(%rbp) + movl -96(%rbp), %eax + movl -116(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -100(%rbp) + movl $0, -96(%rbp) + jmp ..B1.99 +..B1.97: + movl $1, -124(%rbp) + movl $0, %eax + movl %eax, -100(%rbp) + movl %eax, -96(%rbp) + jmp ..B1.99 +..B1.98: + movl -200(%rbp), %eax + shll $20, %eax + orl -96(%rbp), %eax + movl %eax, -96(%rbp) +..B1.99: + movl -124(%rbp), %eax + testl %eax, %eax + je ..B1.136 +..B1.100: + lea _ones(%rip), %rax + lea _small_value_64(%rip), %rdx + movsd (%rax), %xmm0 + movsd (%rdx), %xmm1 + addsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) + movl -268(%rbp), %eax + movl %eax, -88(%rbp) + testl %eax, %eax + je ..B1.104 +..B1.101: + movl -88(%rbp), %eax + cmpl $24576, %eax + je ..B1.108 +..B1.102: + movl -88(%rbp), %eax + cmpl $16384, %eax + je ..B1.112 +..B1.103: + movl -88(%rbp), %eax + cmpl $8192, %eax + je ..B1.124 + jmp ..B1.136 +..B1.104: + movl -124(%rbp), %eax + testl $-2147483648, %eax + je ..B1.108 +..B1.105: + movl -100(%rbp), %eax + andl $1, %eax + movl -124(%rbp), %edx + andl $2147483647, %edx + orl %edx, %eax + je ..B1.108 +..B1.106: + movl $1, %eax + addl -100(%rbp), %eax + movl %eax, -100(%rbp) + movl $1, %eax + movl $0, %edx + cmove %eax, %edx + addl -96(%rbp), %edx + movl %edx, -96(%rbp) + movl -96(%rbp), %eax + cmpl $2146435072, %eax + jb ..B1.108 +..B1.107: + shrl $31, -204(%rbp) + movl -204(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _large_value_64(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) + movsd %xmm0, -8(%rbp) + movsd -8(%rbp), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.108: + movl -96(%rbp), %eax + cmpl $1048576, %eax + jb ..B1.111 +..B1.109: + movl $-1048576, %eax + addl -96(%rbp), %eax + orl -100(%rbp), %eax + jne ..B1.136 +..B1.110: + movl -124(%rbp), %eax + cmpl $-2147483648, %eax + jne ..B1.136 +..B1.111: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) + jmp ..B1.136 +..B1.112: + movl -204(%rbp), %eax + testl %eax, %eax + je ..B1.114 +..B1.113: + movl -96(%rbp), %eax + cmpl $1048576, %eax + jb ..B1.120 +..B1.114: + movl -204(%rbp), %eax + testl %eax, %eax + jne ..B1.121 +..B1.115: + movl -96(%rbp), %eax + cmpl $1048575, %eax + jb ..B1.120 +..B1.116: + movl -96(%rbp), %eax + cmpl $1048575, %eax + jne ..B1.121 +..B1.117: + movl -100(%rbp), %eax + cmpl $-1, %eax + jb ..B1.120 +..B1.118: + movl -100(%rbp), %eax + cmpl $-1, %eax + jne ..B1.121 +..B1.119: + movl -124(%rbp), %eax + cmpl $-2147483648, %eax + jae ..B1.121 +..B1.120: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) +..B1.121: + movl -204(%rbp), %eax + testl %eax, %eax + jne ..B1.136 +..B1.122: + movl $1, %eax + addl -100(%rbp), %eax + movl %eax, -100(%rbp) + movl $1, %eax + movl $0, %edx + cmove %eax, %edx + addl -96(%rbp), %edx + movl %edx, -96(%rbp) + movl -96(%rbp), %eax + cmpl $2146435072, %eax + jb ..B1.136 +..B1.123: + shrl $31, -204(%rbp) + movl -204(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _large_value_64(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) + movsd %xmm0, -8(%rbp) + movsd -8(%rbp), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.124: + movl -204(%rbp), %eax + testl %eax, %eax + jne ..B1.126 +..B1.125: + movl -96(%rbp), %eax + cmpl $1048576, %eax + jb ..B1.132 +..B1.126: + movl -204(%rbp), %eax + testl %eax, %eax + je ..B1.133 +..B1.127: + movl -96(%rbp), %eax + cmpl $1048575, %eax + jb ..B1.132 +..B1.128: + movl -96(%rbp), %eax + cmpl $1048575, %eax + jne ..B1.133 +..B1.129: + movl -100(%rbp), %eax + cmpl $-1, %eax + jb ..B1.132 +..B1.130: + movl -100(%rbp), %eax + cmpl $-1, %eax + jne ..B1.133 +..B1.131: + movl -124(%rbp), %eax + cmpl $-2147483648, %eax + jae ..B1.133 +..B1.132: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) +..B1.133: + movl -204(%rbp), %eax + testl %eax, %eax + je ..B1.136 +..B1.134: + movl $1, %eax + addl -100(%rbp), %eax + movl %eax, -100(%rbp) + movl $1, %eax + movl $0, %edx + cmove %eax, %edx + addl -96(%rbp), %edx + movl %edx, -96(%rbp) + movl -96(%rbp), %eax + cmpl $2146435072, %eax + jb ..B1.136 +..B1.135: + shrl $31, -204(%rbp) + movl -204(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _large_value_64(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, -16(%rbp) + movsd %xmm0, -8(%rbp) + movsd -8(%rbp), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.136: + movl -96(%rbp), %eax + orl -204(%rbp), %eax + lea -8(%rbp), %rdx + addq $4, %rdx + movl %eax, (%rdx) + lea -8(%rbp), %rax + movl -100(%rbp), %edx + movl %edx, (%rax) + movsd -8(%rbp), %xmm0 + leave + .cfi_restore 6 + ret + .cfi_endproc + .type fma,@function + .size fma,.-fma + .data +# -- End fma + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmaf_gen.S b/external/sgx_libm/intel64/fmaf_gen.S new file mode 100644 index 0000000000..a51bcef8cb --- /dev/null +++ b/external/sgx_libm/intel64/fmaf_gen.S @@ -0,0 +1,683 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmaf_gen.c" + .text +..TXTST0: +# -- Begin fmaf + .text + .align 16,0x90 + .globl fmaf +fmaf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +# parameter 3: %xmm2 +..B1.1: + .cfi_startproc +..___tag_value_fmaf.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $40, %rsp + .cfi_def_cfa_offset 80 + movss %xmm0, 8(%rsp) + movss %xmm1, 16(%rsp) + movss %xmm2, 24(%rsp) +..B1.2: + stmxcsr 12(%rsp) +..B1.3: + movl 16(%rsp), %r8d + movl %r8d, %ebp + movl 24(%rsp), %r11d + movl %r11d, %r10d + movl 8(%rsp), %esi + movl %esi, %ebx + movzwl 12(%rsp), %edi + andl $2147483647, %ebp + andl $24576, %edi + andl $2147483647, %r10d + andl $2147483647, %ebx + je ..B1.86 +..B1.4: + cmpl $2139095040, %ebx + jae ..B1.86 +..B1.5: + cmpl $1065353216, %ebx + je ..B1.86 +..B1.6: + testl %ebp, %ebp + je ..B1.86 +..B1.7: + cmpl $2139095040, %ebp + jae ..B1.86 +..B1.8: + cmpl $1065353216, %ebp + je ..B1.86 +..B1.9: + testl %r10d, %r10d + je ..B1.86 +..B1.10: + cmpl $2139095040, %r10d + jae ..B1.86 +..B1.11: + cmpl $8388608, %ebx + jae ..B1.13 +..B1.12: + movl %esi, %eax + orl $1065353216, %esi + movl %esi, 8(%rsp) + lea _ones(%rip), %rsi + shrl $31, %eax + movss 8(%rsp), %xmm0 + subss (%rsi,%rax,4), %xmm0 + movd %xmm0, %esi + movss %xmm0, 8(%rsp) + movl %esi, %ebx + andl $2147483647, %ebx + movl %ebx, %ecx + shrl $23, %ecx + addl $-126, %ecx + jmp ..B1.14 +..B1.13: + movl %ebx, %ecx + shrl $23, %ecx +..B1.14: + cmpl $8388608, %ebp + jae ..B1.16 +..B1.15: + movl %r8d, %eax + orl $1065353216, %r8d + movl %r8d, 16(%rsp) + lea _ones(%rip), %r8 + shrl $31, %eax + movss 16(%rsp), %xmm0 + subss (%r8,%rax,4), %xmm0 + movd %xmm0, %r8d + movss %xmm0, 16(%rsp) + movl %r8d, %ebp + andl $2147483647, %ebp + movl %ebp, %edx + shrl $23, %edx + addl $-126, %edx + jmp ..B1.17 +..B1.16: + movl %ebp, %edx + shrl $23, %edx +..B1.17: + cmpl $8388608, %r10d + jae ..B1.19 +..B1.18: + movl %r11d, %eax + orl $1065353216, %r11d + movl %r11d, 24(%rsp) + lea _ones(%rip), %r11 + shrl $31, %eax + movss 24(%rsp), %xmm0 + subss (%r11,%rax,4), %xmm0 + movd %xmm0, %r11d + movss %xmm0, 24(%rsp) + movl %r11d, %r10d + andl $2147483647, %r10d + movl %r10d, %eax + shrl $23, %eax + addl $-126, %eax + jmp ..B1.20 +..B1.19: + movl %r10d, %eax + shrl $23, %eax +..B1.20: + lea -127(%rcx,%rdx), %r9d + andq $8388607, %rbx + andq $8388607, %rbp + orq $8388608, %rbx + orq $8388608, %rbp + andl $8388607, %r10d + imulq %rbp, %rbx + movq %rbx, %rdx + xorl %r8d, %esi + shrq $32, %rdx + orl $8388608, %r10d + andl $-2147483648, %esi + movl %ebx, %ebp + testl $32768, %edx + je ..B1.22 +..B1.21: + shrq $24, %rbx + incl %r9d + shll $8, %ebp + jmp ..B1.23 +..B1.22: + shrq $23, %rbx + shll $9, %ebp +..B1.23: + cmpl %eax, %r9d + jg ..B1.26 +..B1.24: + jne ..B1.27 +..B1.25: + cmpl %r10d, %ebx + jb ..B1.27 +..B1.26: + movl %r9d, %r8d + xorl %edx, %edx + subl %eax, %r8d + movl %r10d, %eax + movl %r11d, %r10d + andl $-2147483648, %r10d + jmp ..B1.28 +..B1.27: + movl %eax, %r8d + movl %ebp, %edx + subl %r9d, %r8d + movl %eax, %r9d + movl %ebx, %eax + movl %r10d, %ebx + movl %esi, %r10d + movl %r11d, %esi + xorl %ebp, %ebp + andl $-2147483648, %esi +..B1.28: + xorl %r14d, %r14d + testl %r8d, %r8d + je ..B1.95 +..B1.29: + cmpl $32, %r8d + jge ..B1.31 +..B1.30: + movl %r8d, %r15d + movl %r8d, %ecx + negl %r15d + movl $-1, %r11d + shrl %cl, %r11d + movl %r15d, %ecx + movl %edx, %r14d + notl %r11d + shll %cl, %r14d + movl %r15d, %ecx + movl %eax, %r15d + shll %cl, %r15d + movl %r8d, %ecx + shrl %cl, %edx + andl %r11d, %r15d + movl %r8d, %ecx + orl %r15d, %edx + shrl %cl, %eax + movl $1, %r11d + jmp ..B1.34 +..B1.31: + cmpl $64, %r8d + jge ..B1.33 +..B1.32: + movl %r8d, %r14d + movl %r8d, %ecx + negl %r14d + movl $-1, %r11d + shrl %cl, %r11d + movl %r14d, %ecx + movl %eax, %r14d + notl %r11d + shll %cl, %r14d + movl %r8d, %ecx + andl %r11d, %r14d + movl $1, %r11d + testl %edx, %edx + cmovne %r11d, %edx + orl %edx, %r14d + movl %eax, %edx + shrl %cl, %edx + xorl %eax, %eax + jmp ..B1.34 +..B1.33: + movl $1, %r11d + orl %eax, %edx + cmovne %r11d, %r14d + xorl %edx, %edx + xorl %eax, %eax + jmp ..B1.34 +..B1.95: + movl $1, %r11d +..B1.34: + cmpl %r10d, %esi + jne ..B1.38 +..B1.35: + addl %ebp, %edx + addl %eax, %ebx + cmpl %ebp, %edx + movl $0, %ebp + setb %bpl + addl %ebp, %ebx + testl $16777216, %ebx + je ..B1.37 +..B1.36: + orl %r14d, %edx + movl %ebx, %eax + movl $0, %edx + cmovne %r11d, %edx + incl %r9d + shll $31, %eax + shrl $1, %ebx + orl %edx, %eax + andl $8388607, %ebx + jmp ..B1.54 +..B1.37: + testl %r14d, %r14d + movl %edx, %eax + cmovne %r11d, %r14d + andl $8388607, %ebx + orl %r14d, %eax + jmp ..B1.54 +..B1.38: + xorl %r8d, %r8d + negl %r14d + cmovne %r11d, %r8d + negl %edx + addl %ebp, %edx + subl %eax, %ebx + subl %r8d, %edx + cmpl %ebp, %edx + movl $0, %ebp + seta %bpl + subl %ebp, %ebx + je ..B1.40 +..B1.39: + movl %ebx, %eax + xorl %ebp, %ebp + shll $8, %eax + jmp ..B1.44 +..B1.40: + testl %edx, %edx + je ..B1.42 +..B1.41: + movl %edx, %eax + movl $24, %ebp + jmp ..B1.44 +..B1.42: + testl %r14d, %r14d + je ..B1.85 +..B1.43: + movl %r14d, %eax + movl $56, %ebp +..B1.44: + testl $-2147483648, %eax + jne ..B1.48 +..B1.46: + addl %eax, %eax + incl %ebp + testl $-2147483648, %eax + je ..B1.46 +..B1.48: + cmpl $32, %ebp + jge ..B1.50 +..B1.49: + movl %ebp, %eax + movl %ebp, %ecx + negl %eax + movl %edx, %r10d + shll %cl, %ebx + movl %eax, %ecx + shrl %cl, %r10d + movl %ebp, %ecx + movl %r11d, %r8d + testl %r14d, %r14d + cmovne %r11d, %r14d + shll %cl, %r8d + movl %ebp, %ecx + decl %r8d + shll %cl, %edx + andl %r8d, %r10d + orl %r10d, %ebx + movl %edx, %eax + andl $8388607, %ebx + orl %r14d, %eax + jmp ..B1.53 +..B1.50: + cmpl $64, %ebp + jge ..B1.52 +..B1.51: + movl %ebp, %eax + movl %ebp, %ecx + negl %eax + movl %r14d, %r8d + shll %cl, %edx + movl %eax, %ecx + shrl %cl, %r8d + movl %ebp, %ecx + movl %r11d, %ebx + movl %r14d, %eax + shll %cl, %ebx + movl %ebp, %ecx + decl %ebx + andl %ebx, %r8d + orl %r8d, %edx + movl %edx, %ebx + shll %cl, %eax + andl $8388607, %ebx + jmp ..B1.53 +..B1.52: + movl %ebp, %ecx + xorl %eax, %eax + shll %cl, %r14d + movl %r14d, %ebx + andl $8388607, %ebx +..B1.53: + subl %ebp, %r9d +..B1.54: + lea -1(%r9), %edx + cmpl $254, %edx + jb ..B1.60 +..B1.55: + cmpl $255, %r9d + jge ..B1.90 +..B1.56: + negl %r9d + incl %r9d + cmpl $24, %r9d + jg ..B1.58 +..B1.57: + movl %r9d, %edx + movl %r9d, %ecx + negl %edx + movl $-1, %ebp + orl $8388608, %ebx + testl %eax, %eax + movl %ebx, %r8d + cmovne %r11d, %eax + shrl %cl, %ebp + movl %edx, %ecx + shll %cl, %r8d + notl %ebp + andl %ebp, %r8d + movl %r9d, %ecx + shrl %cl, %ebx + orl %r8d, %eax + jmp ..B1.61 +..B1.58: + movl %r11d, %eax + xorl %ebx, %ebx + jmp ..B1.62 +..B1.60: + shll $23, %r9d + orl %r9d, %ebx +..B1.61: + testl %eax, %eax + je ..B1.84 +..B1.62: + movl $1065353216, (%rsp) + testl %edi, %edi + je ..B1.87 +..B1.63: + cmpl $24576, %edi + je ..B1.80 +..B1.64: + cmpl $16384, %edi + jne ..B1.72 +..B1.65: + testl %esi, %esi + je ..B1.67 +..B1.66: + cmpl $8388608, %ebx + jb ..B1.70 + jmp ..B1.84 +..B1.67: + cmpl $8388607, %ebx + jb ..B1.70 +..B1.68: + jne ..B1.71 +..B1.69: + cmpl $-2147483648, %eax + jae ..B1.71 +..B1.70: + movss .L_2il0floatpacket.1(%rip), %xmm0 + testl %esi, %esi + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + jne ..B1.84 +..B1.71: + incl %ebx + cmpl $2139095040, %ebx + jae ..B1.90 + jmp ..B1.84 +..B1.72: + cmpl $8192, %edi + jne ..B1.84 +..B1.73: + testl %esi, %esi + jne ..B1.75 +..B1.74: + cmpl $8388608, %ebx + jb ..B1.78 + jmp ..B1.84 +..B1.75: + cmpl $8388607, %ebx + jb ..B1.78 +..B1.76: + jne ..B1.79 +..B1.77: + cmpl $-2147483648, %eax + jae ..B1.79 +..B1.78: + movss .L_2il0floatpacket.1(%rip), %xmm0 + testl %esi, %esi + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) + je ..B1.84 +..B1.79: + incl %ebx + cmpl $2139095040, %ebx + jae ..B1.90 + jmp ..B1.84 +..B1.80: + cmpl $8388608, %ebx + jb ..B1.83 +..B1.81: + jne ..B1.84 +..B1.82: + cmpl $-2147483648, %eax + jne ..B1.84 +..B1.83: + movss .L_2il0floatpacket.1(%rip), %xmm0 + mulss %xmm0, %xmm0 + movss %xmm0, (%rsp) +..B1.84: + orl %ebx, %esi + movl %esi, 4(%rsp) + movss 4(%rsp), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.85: + xorl %edx, %edx + cmpl $8192, %edi + lea _zeros(%rip), %rcx + sete %dl + movss (%rcx,%rdx,4), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.86: + movss 8(%rsp), %xmm0 + mulss 16(%rsp), %xmm0 + addss 24(%rsp), %xmm0 + movss %xmm0, 4(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.87: + testl $-2147483648, %eax + je ..B1.80 +..B1.88: + movl %ebx, %ecx + movl %eax, %edx + andl $1, %ecx + andl $2147483647, %edx + orl %edx, %ecx + je ..B1.80 +..B1.89: + incl %ebx + cmpl $2139095040, %ebx + jb ..B1.80 +..B1.90: + lea _large_value_32(%rip), %rax + shrl $31, %esi + movss (%rax,%rsi,4), %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, (%rsp) + movss %xmm0, 4(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fmaf,@function + .size fmaf,.-fmaf + .data +# -- End fmaf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x71800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x0d800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x3f800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmal.S b/external/sgx_libm/intel64/fmal.S new file mode 100644 index 0000000000..6f18fb06bb --- /dev/null +++ b/external/sgx_libm/intel64/fmal.S @@ -0,0 +1,2062 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmal.c" + .text +..TXTST0: +# -- Begin fmal + .text + + .globl fmal +fmal: +# parameter 1: 16 + %rbp +# parameter 2: 32 + %rbp +# parameter 3: 48 + %rbp +..B1.1: + .cfi_startproc +..___tag_value_fmal.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + movq %rsp, %rbp + .cfi_def_cfa 6, 16 + .cfi_offset 6, -16 + subq $336, %rsp + lea 16(%rbp), %rax + movq %rax, -128(%rbp) + lea 32(%rbp), %rax + movq %rax, -120(%rbp) + lea 48(%rbp), %rax + movq %rax, -112(%rbp) + lea -32(%rbp), %rax + movq %rax, -104(%rbp) + movl $0, -328(%rbp) +..B1.2: + fnstcw -336(%rbp) +..B1.3: + fnstcw -334(%rbp) +..B1.4: + movzwl -334(%rbp), %eax + movzwl %ax, %eax + andl $3072, %eax + movl %eax, -324(%rbp) + movq -128(%rbp), %rax + movzbl 9(%rax), %eax + movzbl %al, %eax + andl $128, %eax + shrl $7, %eax + movl %eax, -320(%rbp) + movq -128(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $32767, %eax + movl %eax, -316(%rbp) + movq -120(%rbp), %rax + movzbl 9(%rax), %eax + movzbl %al, %eax + andl $128, %eax + shrl $7, %eax + movl %eax, -312(%rbp) + movq -120(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $32767, %eax + movl %eax, -308(%rbp) + movq -112(%rbp), %rax + movzbl 9(%rax), %eax + movzbl %al, %eax + andl $128, %eax + shrl $7, %eax + movl %eax, -304(%rbp) + movq -112(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $32767, %eax + movl %eax, -300(%rbp) + movl -316(%rbp), %eax + cmpl $32767, %eax + je ..B1.22 +..B1.5: + movl -316(%rbp), %eax + testl %eax, %eax + jne ..B1.8 +..B1.6: + movq -128(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.8 +..B1.7: + movq -128(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.22 +..B1.8: + movl -316(%rbp), %eax + cmpl $16383, %eax + jne ..B1.11 +..B1.9: + movq -128(%rbp), %rax + movl 4(%rax), %eax + cmpl $-2147483648, %eax + jne ..B1.11 +..B1.10: + movq -128(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.22 +..B1.11: + movl -308(%rbp), %eax + cmpl $32767, %eax + je ..B1.22 +..B1.12: + movl -308(%rbp), %eax + testl %eax, %eax + jne ..B1.15 +..B1.13: + movq -120(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.15 +..B1.14: + movq -120(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.22 +..B1.15: + movl -308(%rbp), %eax + cmpl $16383, %eax + jne ..B1.18 +..B1.16: + movq -120(%rbp), %rax + movl 4(%rax), %eax + cmpl $-2147483648, %eax + jne ..B1.18 +..B1.17: + movq -120(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.22 +..B1.18: + movl -300(%rbp), %eax + cmpl $32767, %eax + je ..B1.22 +..B1.19: + movl -300(%rbp), %eax + testl %eax, %eax + jne ..B1.87 +..B1.20: + movq -112(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.87 +..B1.21: + movq -112(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + jne ..B1.87 +..B1.22: + movl -316(%rbp), %eax + testl %eax, %eax + jne ..B1.25 +..B1.23: + movq -128(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.31 +..B1.24: + movq -128(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + jne ..B1.31 +..B1.25: + movl -308(%rbp), %eax + testl %eax, %eax + jne ..B1.28 +..B1.26: + movq -120(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.31 +..B1.27: + movq -120(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + jne ..B1.31 +..B1.28: + movl -300(%rbp), %eax + testl %eax, %eax + jne ..B1.32 +..B1.29: + movq -112(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.31 +..B1.30: + movq -112(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.32 +..B1.31: + lea _smallest_value_64(%rip), %rax + movsd (%rax), %xmm0 + movsd %xmm0, -96(%rbp) +..B1.32: + movl -316(%rbp), %eax + cmpl $32767, %eax + jne ..B1.43 +..B1.33: + movq -128(%rbp), %rax + movl 4(%rax), %eax + cmpl $-2147483648, %eax + jne ..B1.35 +..B1.34: + movq -128(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.43 +..B1.35: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.39 +..B1.36: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $-769, %eax + orl $768, %eax + movw %ax, -332(%rbp) +..B1.37: + fldcw -332(%rbp) +..B1.38: + movl $1, -328(%rbp) +..B1.39: + fldt 16(%rbp) + fldt 32(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + fldt -32(%rbp) + fldt 48(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + movl -328(%rbp), %eax + testl %eax, %eax + je ..B1.42 +..B1.40: + fldcw -336(%rbp) +..B1.41: + movl $0, -328(%rbp) +..B1.42: + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.43: + movl -308(%rbp), %eax + cmpl $32767, %eax + jne ..B1.54 +..B1.44: + movq -120(%rbp), %rax + movl 4(%rax), %eax + cmpl $-2147483648, %eax + jne ..B1.46 +..B1.45: + movq -120(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.54 +..B1.46: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.50 +..B1.47: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $-769, %eax + orl $768, %eax + movw %ax, -332(%rbp) +..B1.48: + fldcw -332(%rbp) +..B1.49: + movl $1, -328(%rbp) +..B1.50: + fldt 32(%rbp) + fldt 48(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + fldt -32(%rbp) + fldt 16(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + movl -328(%rbp), %eax + testl %eax, %eax + je ..B1.53 +..B1.51: + fldcw -336(%rbp) +..B1.52: + movl $0, -328(%rbp) +..B1.53: + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.54: + movl -300(%rbp), %eax + cmpl $32767, %eax + jne ..B1.65 +..B1.55: + movq -112(%rbp), %rax + movl 4(%rax), %eax + cmpl $-2147483648, %eax + jne ..B1.57 +..B1.56: + movq -112(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.65 +..B1.57: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.61 +..B1.58: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $-769, %eax + orl $768, %eax + movw %ax, -332(%rbp) +..B1.59: + fldcw -332(%rbp) +..B1.60: + movl $1, -328(%rbp) +..B1.61: + fldt 48(%rbp) + fldt 16(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + fldt -32(%rbp) + fldt 32(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + movl -328(%rbp), %eax + testl %eax, %eax + je ..B1.64 +..B1.62: + fldcw -336(%rbp) +..B1.63: + movl $0, -328(%rbp) +..B1.64: + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.65: + movl -316(%rbp), %eax + cmpl $32767, %eax + jge ..B1.69 +..B1.66: + movl -308(%rbp), %eax + cmpl $32767, %eax + jge ..B1.69 +..B1.67: + movl -300(%rbp), %eax + cmpl $32767, %eax + jne ..B1.69 +..B1.68: + fldt 48(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.69: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.73 +..B1.70: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $-769, %eax + orl $768, %eax + movw %ax, -332(%rbp) +..B1.71: + fldcw -332(%rbp) +..B1.72: + movl $1, -328(%rbp) +..B1.73: + fldt 16(%rbp) + fldt 32(%rbp) + fmulp %st, %st(1) + fstpt -32(%rbp) + movq -128(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.76 +..B1.74: + movq -128(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.76 +..B1.75: + movq -128(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.82 +..B1.76: + movq -120(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.79 +..B1.77: + movq -120(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.79 +..B1.78: + movq -120(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.82 +..B1.79: + movq -104(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.82 +..B1.80: + movq -104(%rbp), %rax + movl 4(%rax), %eax + testl %eax, %eax + jne ..B1.82 +..B1.81: + movq -104(%rbp), %rax + movl (%rax), %eax + testl %eax, %eax + je ..B1.83 +..B1.82: + fldt -32(%rbp) + fldt 48(%rbp) + faddp %st, %st(1) + fstpt -32(%rbp) +..B1.83: + movl -328(%rbp), %eax + testl %eax, %eax + je ..B1.86 +..B1.84: + fldcw -336(%rbp) +..B1.85: + movl $0, -328(%rbp) +..B1.86: + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.87: + movq -128(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + je ..B1.90 +..B1.88: + movq -120(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + je ..B1.90 +..B1.89: + movq -112(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.103 +..B1.90: + lea _smallest_value_64(%rip), %rax + movsd (%rax), %xmm0 + movsd %xmm0, -96(%rbp) + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.94 +..B1.91: + movzwl -336(%rbp), %eax + movzwl %ax, %eax + andl $-769, %eax + orl $768, %eax + movw %ax, -332(%rbp) +..B1.92: + fldcw -332(%rbp) +..B1.93: + movl $1, -328(%rbp) +..B1.94: + movq -128(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.96 +..B1.95: + movq -128(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $-32768, %eax + orl $16383, %eax + movq -128(%rbp), %rdx + movw %ax, 8(%rdx) + movq -128(%rbp), %rax + movl 4(%rax), %eax + orl $-2147483648, %eax + movq -128(%rbp), %rdx + movl %eax, 4(%rdx) + movl -320(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _ones(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + movsd %xmm0, -48(%rbp) + fldl -48(%rbp) + fldt 16(%rbp) + fsubp %st, %st(1) + fstpt 16(%rbp) + movq -128(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $32767, %eax + addl $-16382, %eax + movl %eax, -316(%rbp) +..B1.96: + movq -120(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.98 +..B1.97: + movq -120(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $-32768, %eax + orl $16383, %eax + movq -120(%rbp), %rdx + movw %ax, 8(%rdx) + movq -120(%rbp), %rax + movl 4(%rax), %eax + orl $-2147483648, %eax + movq -120(%rbp), %rdx + movl %eax, 4(%rdx) + movl -312(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _ones(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + movsd %xmm0, -48(%rbp) + fldl -48(%rbp) + fldt 32(%rbp) + fsubp %st, %st(1) + fstpt 32(%rbp) + movq -120(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $32767, %eax + addl $-16382, %eax + movl %eax, -308(%rbp) +..B1.98: + movq -112(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + testl $32767, %eax + jne ..B1.100 +..B1.99: + movq -112(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $-32768, %eax + orl $16383, %eax + movq -112(%rbp), %rdx + movw %ax, 8(%rdx) + movq -112(%rbp), %rax + movl 4(%rax), %eax + orl $-2147483648, %eax + movq -112(%rbp), %rdx + movl %eax, 4(%rdx) + movl -304(%rbp), %eax + movslq %eax, %rax + shlq $3, %rax + lea _ones(%rip), %rdx + addq %rax, %rdx + movsd (%rdx), %xmm0 + movsd %xmm0, -48(%rbp) + fldl -48(%rbp) + fldt 48(%rbp) + fsubp %st, %st(1) + fstpt 48(%rbp) + movq -112(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $32767, %eax + addl $-16382, %eax + movl %eax, -300(%rbp) +..B1.100: + movl -328(%rbp), %eax + testl %eax, %eax + je ..B1.103 +..B1.101: + fldcw -336(%rbp) +..B1.102: + movl $0, -328(%rbp) +..B1.103: + movq -128(%rbp), %rax + movl 4(%rax), %eax + movl %eax, -296(%rbp) + movq -128(%rbp), %rax + movl (%rax), %eax + movl %eax, -292(%rbp) + movq -120(%rbp), %rax + movl 4(%rax), %eax + movl %eax, -288(%rbp) + movq -120(%rbp), %rax + movl (%rax), %eax + movl %eax, -284(%rbp) + movq -112(%rbp), %rax + movl 4(%rax), %eax + movl %eax, -280(%rbp) + movq -112(%rbp), %rax + movl (%rax), %eax + movl %eax, -276(%rbp) + movl -312(%rbp), %eax + xorl -320(%rbp), %eax + movl %eax, -272(%rbp) + movl -308(%rbp), %eax + addl -316(%rbp), %eax + addl $-16383, %eax + movl %eax, -268(%rbp) + movl -284(%rbp), %eax + movl -292(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -88(%rbp) + movq -88(%rbp), %rax + shrq $32, %rax + movl %eax, -264(%rbp) + movl -88(%rbp), %eax + movl %eax, -260(%rbp) + movl -284(%rbp), %eax + movl -296(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -80(%rbp) + movq -80(%rbp), %rax + shrq $32, %rax + movl %eax, -256(%rbp) + movl -80(%rbp), %eax + movl %eax, -252(%rbp) + movl -288(%rbp), %eax + movl -292(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -72(%rbp) + movq -72(%rbp), %rax + shrq $32, %rax + movl %eax, -248(%rbp) + movl -72(%rbp), %eax + movl %eax, -244(%rbp) + movl -288(%rbp), %eax + movl -296(%rbp), %edx + imulq %rax, %rdx + movq %rdx, -64(%rbp) + movq -64(%rbp), %rax + shrq $32, %rax + movl %eax, -240(%rbp) + movl -64(%rbp), %eax + movl %eax, -236(%rbp) + movl -260(%rbp), %eax + movl %eax, -232(%rbp) + movl -264(%rbp), %eax + movq %rax, -56(%rbp) + movl -252(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -244(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -228(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -224(%rbp) + movl -236(%rbp), %eax + movq %rax, -56(%rbp) + movl -256(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -248(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -224(%rbp), %eax + movslq %eax, %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -220(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -224(%rbp) + movl -224(%rbp), %eax + addl -240(%rbp), %eax + movl %eax, -216(%rbp) + movl -216(%rbp), %eax + testl $-2147483648, %eax + je ..B1.105 +..B1.104: + movl $1, %eax + addl -268(%rbp), %eax + movl %eax, -268(%rbp) + jmp ..B1.106 +..B1.105: + movl -216(%rbp), %eax + shll $1, %eax + movl -220(%rbp), %edx + shrl $31, %edx + orl %edx, %eax + movl %eax, -216(%rbp) + movl -220(%rbp), %eax + shll $1, %eax + movl -228(%rbp), %edx + shrl $31, %edx + orl %edx, %eax + movl %eax, -220(%rbp) + movl -228(%rbp), %eax + shll $1, %eax + movl -232(%rbp), %edx + shrl $31, %edx + orl %edx, %eax + movl %eax, -228(%rbp) + shll $1, -232(%rbp) +..B1.106: + movl -268(%rbp), %eax + movl -300(%rbp), %edx + cmpl %edx, %eax + jg ..B1.111 +..B1.107: + movl -268(%rbp), %eax + movl -300(%rbp), %edx + cmpl %edx, %eax + jne ..B1.112 +..B1.108: + movl -216(%rbp), %eax + movl -280(%rbp), %edx + cmpl %edx, %eax + ja ..B1.111 +..B1.109: + movl -216(%rbp), %eax + movl -280(%rbp), %edx + cmpl %edx, %eax + jne ..B1.112 +..B1.110: + movl -220(%rbp), %eax + movl -276(%rbp), %edx + cmpl %edx, %eax + jb ..B1.112 +..B1.111: + movl -300(%rbp), %eax + negl %eax + addl -268(%rbp), %eax + movl %eax, -212(%rbp) + movl -280(%rbp), %eax + movl %eax, -208(%rbp) + movl -276(%rbp), %eax + movl %eax, -204(%rbp) + movl $0, %eax + movl %eax, -200(%rbp) + movl %eax, -196(%rbp) + jmp ..B1.113 +..B1.112: + movl -268(%rbp), %eax + negl %eax + addl -300(%rbp), %eax + movl %eax, -212(%rbp) + movl -300(%rbp), %eax + movl %eax, -268(%rbp) + movl -216(%rbp), %eax + movl %eax, -208(%rbp) + movl -220(%rbp), %eax + movl %eax, -204(%rbp) + movl -228(%rbp), %eax + movl %eax, -196(%rbp) + movl -232(%rbp), %eax + movl %eax, -200(%rbp) + movl -280(%rbp), %eax + movl %eax, -216(%rbp) + movl -276(%rbp), %eax + movl %eax, -220(%rbp) + movl $0, %eax + movl %eax, -232(%rbp) + movl %eax, -228(%rbp) + movl -272(%rbp), %eax + movl %eax, -304(%rbp) + movq -112(%rbp), %rax + movzbl 9(%rax), %eax + movzbl %al, %eax + andl $128, %eax + shrl $7, %eax + movl %eax, -272(%rbp) +..B1.113: + movl $0, -192(%rbp) + movl -212(%rbp), %eax + testl %eax, %eax + je ..B1.123 +..B1.114: + movl -212(%rbp), %eax + cmpl $32, %eax + jge ..B1.116 +..B1.115: + movl -212(%rbp), %eax + negl %eax + addl $32, %eax + movl %eax, -188(%rbp) + movl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -200(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl %eax, -192(%rbp) + movl -196(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -200(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -200(%rbp) + movl -204(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -196(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -196(%rbp) + movl -208(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -204(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -204(%rbp) + movl -184(%rbp), %eax + movl %eax, %ecx + shrl %cl, -208(%rbp) + jmp ..B1.123 +..B1.116: + movl -212(%rbp), %eax + cmpl $64, %eax + jge ..B1.118 +..B1.117: + movl -212(%rbp), %eax + negl %eax + addl $64, %eax + movl %eax, -188(%rbp) + movl $-32, %eax + addl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -196(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -200(%rbp), %edx + movl $1, %ecx + testl %edx, %edx + cmovne %ecx, %edx + orl %edx, %eax + movl %eax, -192(%rbp) + movl -204(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -196(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -200(%rbp) + movl -208(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -204(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -196(%rbp) + movl -208(%rbp), %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -204(%rbp) + movl $0, -208(%rbp) + jmp ..B1.123 +..B1.118: + movl -212(%rbp), %eax + cmpl $96, %eax + jge ..B1.120 +..B1.119: + movl -212(%rbp), %eax + negl %eax + addl $96, %eax + movl %eax, -188(%rbp) + movl $-64, %eax + addl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -204(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -200(%rbp), %edx + orl -196(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl -208(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -204(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -200(%rbp) + movl -208(%rbp), %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -196(%rbp) + movl $0, %eax + movl %eax, -204(%rbp) + movl %eax, -208(%rbp) + jmp ..B1.123 +..B1.120: + movl -212(%rbp), %eax + cmpl $128, %eax + jge ..B1.122 +..B1.121: + movl -212(%rbp), %eax + negl %eax + addl $128, %eax + movl %eax, -188(%rbp) + movl $-96, %eax + addl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -208(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -196(%rbp), %edx + orl -204(%rbp), %edx + orl -200(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl -208(%rbp), %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -200(%rbp) + movl $0, -196(%rbp) + movl $0, %eax + movl %eax, -204(%rbp) + movl %eax, -208(%rbp) + jmp ..B1.123 +..B1.122: + movl -204(%rbp), %eax + orl -208(%rbp), %eax + orl -196(%rbp), %eax + orl -200(%rbp), %eax + movl $1, %eax + movl $0, %edx + cmovne %eax, %edx + movl %edx, -192(%rbp) + movl $0, -200(%rbp) + movl $0, -196(%rbp) + movl $0, %eax + movl %eax, -204(%rbp) + movl %eax, -208(%rbp) +..B1.123: + movl -272(%rbp), %eax + movl -304(%rbp), %edx + cmpl %edx, %eax + jne ..B1.130 +..B1.124: + movl -232(%rbp), %eax + movl %eax, -176(%rbp) + movl -200(%rbp), %eax + addl -232(%rbp), %eax + movl %eax, -232(%rbp) + movl -232(%rbp), %eax + movl -176(%rbp), %edx + cmpl %edx, %eax + jb ..B1.126 +..B1.125: + movl $0, -224(%rbp) + jmp ..B1.127 +..B1.126: + movl $1, -224(%rbp) +..B1.127: + movl -228(%rbp), %eax + movq %rax, -56(%rbp) + movl -196(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -224(%rbp), %eax + movslq %eax, %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -228(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -224(%rbp) + movl -220(%rbp), %eax + movq %rax, -56(%rbp) + movl -204(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -224(%rbp), %eax + movslq %eax, %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -220(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -224(%rbp) + movl -216(%rbp), %eax + movq %rax, -56(%rbp) + movl -208(%rbp), %eax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -224(%rbp), %eax + movslq %eax, %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -216(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -224(%rbp) + movl -224(%rbp), %eax + testl %eax, %eax + je ..B1.129 +..B1.128: + movl -220(%rbp), %eax + shll $31, %eax + movl -232(%rbp), %edx + orl -228(%rbp), %edx + orl -192(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl -216(%rbp), %eax + shll $31, %eax + movl -220(%rbp), %edx + shrl $1, %edx + orl %edx, %eax + movl %eax, -168(%rbp) + movl -216(%rbp), %eax + shrl $1, %eax + orl $-2147483648, %eax + movl %eax, -164(%rbp) + movl $1, %eax + addl -268(%rbp), %eax + movl %eax, -268(%rbp) + jmp ..B1.156 +..B1.129: + movl -228(%rbp), %eax + movl -192(%rbp), %edx + orl -232(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl -220(%rbp), %eax + movl %eax, -168(%rbp) + movl -216(%rbp), %eax + movl %eax, -164(%rbp) + jmp ..B1.156 +..B1.130: + movl -192(%rbp), %eax + negl %eax + movl %eax, -192(%rbp) + movl -192(%rbp), %eax + testl %eax, %eax + jne ..B1.132 +..B1.131: + movl $0, -172(%rbp) + jmp ..B1.133 +..B1.132: + movl $1, -172(%rbp) +..B1.133: + movl -232(%rbp), %eax + movq %rax, -56(%rbp) + movl -200(%rbp), %eax + negq %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -172(%rbp), %eax + movslq %eax, %rax + negq %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -232(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -172(%rbp) + movl -228(%rbp), %eax + movq %rax, -56(%rbp) + movl -196(%rbp), %eax + negq %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -172(%rbp), %eax + movslq %eax, %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -228(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -172(%rbp) + movl -220(%rbp), %eax + movq %rax, -56(%rbp) + movl -204(%rbp), %eax + negq %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -172(%rbp), %eax + movslq %eax, %rax + addq -56(%rbp), %rax + movq %rax, -56(%rbp) + movl -56(%rbp), %eax + movl %eax, -220(%rbp) + movq -56(%rbp), %rax + shrq $32, %rax + movl %eax, -172(%rbp) + movl -208(%rbp), %eax + negl %eax + addl -216(%rbp), %eax + movl %eax, -216(%rbp) + movl -172(%rbp), %eax + addl -216(%rbp), %eax + movl %eax, -216(%rbp) + movl -216(%rbp), %eax + testl %eax, %eax + je ..B1.135 +..B1.134: + movl -216(%rbp), %eax + movl %eax, -176(%rbp) + movl $0, -212(%rbp) + jmp ..B1.144 +..B1.135: + movl -220(%rbp), %eax + testl %eax, %eax + je ..B1.137 +..B1.136: + movl -220(%rbp), %eax + movl %eax, -176(%rbp) + movl $32, -212(%rbp) + jmp ..B1.144 +..B1.137: + movl -228(%rbp), %eax + testl %eax, %eax + je ..B1.139 +..B1.138: + movl -228(%rbp), %eax + movl %eax, -176(%rbp) + movl $64, -212(%rbp) + jmp ..B1.144 +..B1.139: + movl -232(%rbp), %eax + testl %eax, %eax + je ..B1.141 +..B1.140: + movl -232(%rbp), %eax + movl %eax, -176(%rbp) + movl $96, -212(%rbp) + jmp ..B1.144 +..B1.141: + movl -192(%rbp), %eax + testl %eax, %eax + je ..B1.143 +..B1.142: + movl -192(%rbp), %eax + movl %eax, -176(%rbp) + movl $128, -212(%rbp) + jmp ..B1.144 +..B1.143: + movl -324(%rbp), %eax + movl $1, %edx + movl $0, %ecx + cmpl $1024, %eax + cmove %edx, %ecx + movslq %ecx, %rcx + shlq $3, %rcx + lea _zeros(%rip), %rax + addq %rcx, %rax + movsd (%rax), %xmm0 + movsd %xmm0, -48(%rbp) + fldl -48(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.144: + movl -176(%rbp), %eax + testl $-2147483648, %eax + jne ..B1.146 +..B1.145: + shll $1, -176(%rbp) + movl $1, %eax + addl -212(%rbp), %eax + movl %eax, -212(%rbp) + jmp ..B1.144 +..B1.146: + movl -212(%rbp), %eax + cmpl $32, %eax + jge ..B1.148 +..B1.147: + movl -212(%rbp), %eax + movl %eax, -188(%rbp) + movl -212(%rbp), %eax + negl %eax + addl $32, %eax + movl %eax, -184(%rbp) + movl $1, %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -160(%rbp) + movl -228(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -192(%rbp), %edx + orl -232(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl -220(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -228(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -168(%rbp) + movl -216(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -220(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -164(%rbp) + jmp ..B1.155 +..B1.148: + movl -212(%rbp), %eax + cmpl $64, %eax + jge ..B1.150 +..B1.149: + movl $-32, %eax + addl -212(%rbp), %eax + movl %eax, -188(%rbp) + movl -212(%rbp), %eax + negl %eax + addl $64, %eax + movl %eax, -184(%rbp) + movl $1, %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -160(%rbp) + movl -232(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -192(%rbp), %edx + movl $1, %ecx + testl %edx, %edx + cmovne %ecx, %edx + orl %edx, %eax + movl %eax, -192(%rbp) + movl -228(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -232(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -168(%rbp) + movl -220(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -228(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -164(%rbp) + jmp ..B1.155 +..B1.150: + movl -212(%rbp), %eax + cmpl $96, %eax + jge ..B1.152 +..B1.151: + movl $-64, %eax + addl -212(%rbp), %eax + movl %eax, -188(%rbp) + movl -212(%rbp), %eax + negl %eax + addl $96, %eax + movl %eax, -184(%rbp) + movl $1, %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -160(%rbp) + movl -188(%rbp), %eax + movl %eax, %ecx + shll %cl, -192(%rbp) + movl -232(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -192(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -168(%rbp) + movl -228(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -232(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -164(%rbp) + jmp ..B1.155 +..B1.152: + movl -212(%rbp), %eax + cmpl $128, %eax + jge ..B1.154 +..B1.153: + movl $-96, %eax + addl -212(%rbp), %eax + movl %eax, -188(%rbp) + movl -212(%rbp), %eax + negl %eax + addl $128, %eax + movl %eax, -184(%rbp) + movl $1, %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + decl %eax + movl %eax, -160(%rbp) + movl $0, -192(%rbp) + movl -192(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl %eax, -168(%rbp) + movl -232(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl -192(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + andl -160(%rbp), %edx + orl %edx, %eax + movl %eax, -164(%rbp) + jmp ..B1.155 +..B1.154: + movl $-128, %eax + addl -212(%rbp), %eax + movl %eax, -188(%rbp) + movl $0, %eax + movl %eax, -168(%rbp) + movl %eax, -192(%rbp) + movl -192(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + movl %eax, -164(%rbp) +..B1.155: + movl -212(%rbp), %eax + negl %eax + addl -268(%rbp), %eax + movl %eax, -268(%rbp) +..B1.156: + movl $-1, %eax + addl -268(%rbp), %eax + cmpl $32766, %eax + jb ..B1.167 +..B1.157: + movl -268(%rbp), %eax + cmpl $32767, %eax + jl ..B1.159 +..B1.158: + movl -272(%rbp), %eax + movslq %eax, %rax + shlq $4, %rax + lea _large_value_80(%rip), %rdx + addq %rax, %rdx + fldt (%rdx) + lea _large_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) + fldt -16(%rbp) + fstpt -32(%rbp) + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.159: + movl -268(%rbp), %eax + negl %eax + incl %eax + movl %eax, -212(%rbp) + movl -212(%rbp), %eax + cmpl $32, %eax + jge ..B1.161 +..B1.160: + movl -212(%rbp), %eax + negl %eax + addl $32, %eax + movl %eax, -188(%rbp) + movl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -168(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -192(%rbp), %edx + movl $1, %ecx + testl %edx, %edx + cmovne %ecx, %edx + orl %edx, %eax + movl %eax, -192(%rbp) + movl -164(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -168(%rbp), %edx + movl -184(%rbp), %ecx + shrl %cl, %edx + orl %edx, %eax + movl %eax, -168(%rbp) + movl -184(%rbp), %eax + movl %eax, %ecx + shrl %cl, -164(%rbp) + jmp ..B1.166 +..B1.161: + movl -212(%rbp), %eax + cmpl $64, %eax + jge ..B1.163 +..B1.162: + movl -212(%rbp), %eax + negl %eax + addl $64, %eax + movl %eax, -188(%rbp) + movl $-32, %eax + addl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -164(%rbp), %eax + movl -188(%rbp), %edx + movl %edx, %ecx + shll %cl, %eax + andl -180(%rbp), %eax + movl -192(%rbp), %edx + orl -168(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl -164(%rbp), %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl %eax, -168(%rbp) + movl $0, -164(%rbp) + jmp ..B1.166 +..B1.163: + movl -212(%rbp), %eax + cmpl $96, %eax + jge ..B1.165 +..B1.164: + movl -212(%rbp), %eax + negl %eax + addl $96, %eax + movl %eax, -188(%rbp) + movl $-64, %eax + addl -212(%rbp), %eax + movl %eax, -184(%rbp) + movl $-1, %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + notl %eax + movl %eax, -180(%rbp) + movl -164(%rbp), %eax + movl -184(%rbp), %edx + movl %edx, %ecx + shrl %cl, %eax + movl -164(%rbp), %edx + movl -188(%rbp), %ecx + shll %cl, %edx + andl -180(%rbp), %edx + orl -168(%rbp), %edx + orl -192(%rbp), %edx + movl $1, %edx + movl $0, %ecx + cmovne %edx, %ecx + orl %ecx, %eax + movl %eax, -192(%rbp) + movl $0, %eax + movl %eax, -168(%rbp) + movl %eax, -164(%rbp) + jmp ..B1.166 +..B1.165: + movl $1, -192(%rbp) + movl $0, %eax + movl %eax, -168(%rbp) + movl %eax, -164(%rbp) +..B1.166: + movl $0, -268(%rbp) +..B1.167: + movl -192(%rbp), %eax + testl %eax, %eax + je ..B1.222 +..B1.168: + lea _ones(%rip), %rax + movsd (%rax), %xmm0 + movsd %xmm0, -48(%rbp) + fldl -48(%rbp) + lea _small_value_80(%rip), %rax + fldt (%rax) + faddp %st, %st(1) + fstpt -16(%rbp) + movl -324(%rbp), %eax + movl %eax, -156(%rbp) + testl %eax, %eax + je ..B1.172 +..B1.169: + movl -156(%rbp), %eax + cmpl $3072, %eax + je ..B1.182 +..B1.170: + movl -156(%rbp), %eax + cmpl $2048, %eax + je ..B1.186 +..B1.171: + movl -156(%rbp), %eax + cmpl $1024, %eax + je ..B1.204 + jmp ..B1.222 +..B1.172: + movl -192(%rbp), %eax + testl $-2147483648, %eax + je ..B1.182 +..B1.173: + movl -168(%rbp), %eax + andl $1, %eax + movl -192(%rbp), %edx + andl $2147483647, %edx + orl %edx, %eax + je ..B1.182 +..B1.174: + movl $1, %eax + addl -168(%rbp), %eax + movl %eax, -168(%rbp) + jne ..B1.180 +..B1.175: + movl $1, %eax + addl -164(%rbp), %eax + movl %eax, -152(%rbp) + movl %eax, -164(%rbp) + movl -268(%rbp), %eax + testl %eax, %eax + je ..B1.177 +..B1.176: + movl $0, -148(%rbp) + jmp ..B1.178 +..B1.177: + movl $-2147483648, -148(%rbp) +..B1.178: + movl -148(%rbp), %eax + movl -152(%rbp), %edx + cmpl %eax, %edx + jne ..B1.180 +..B1.179: + orl $-2147483648, -164(%rbp) + movl $1, %eax + addl -268(%rbp), %eax + movl %eax, -268(%rbp) +..B1.180: + movl -268(%rbp), %eax + cmpl $32767, %eax + jl ..B1.182 +..B1.181: + movl -272(%rbp), %eax + movslq %eax, %rax + shlq $4, %rax + lea _large_value_80(%rip), %rdx + addq %rax, %rdx + fldt (%rdx) + lea _large_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) + fldt -16(%rbp) + fstpt -32(%rbp) + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.182: + movl -268(%rbp), %eax + testl %eax, %eax + je ..B1.185 +..B1.183: + movl $-1, %eax + addl -268(%rbp), %eax + movl $-2147483648, %edx + negl %edx + addl -164(%rbp), %edx + orl %edx, %eax + orl -168(%rbp), %eax + jne ..B1.222 +..B1.184: + movl -192(%rbp), %eax + cmpl $-2147483648, %eax + jne ..B1.222 +..B1.185: + lea _small_value_80(%rip), %rax + fldt (%rax) + lea _small_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) + jmp ..B1.222 +..B1.186: + movl -268(%rbp), %eax + testl %eax, %eax + jne ..B1.195 +..B1.187: + movl -272(%rbp), %eax + testl %eax, %eax + jne ..B1.194 +..B1.188: + movl -272(%rbp), %eax + testl %eax, %eax + jne ..B1.195 +..B1.189: + movl -164(%rbp), %eax + cmpl $2147483647, %eax + jb ..B1.194 +..B1.190: + movl -164(%rbp), %eax + cmpl $2147483647, %eax + jne ..B1.195 +..B1.191: + movl -168(%rbp), %eax + cmpl $-1, %eax + jb ..B1.194 +..B1.192: + movl -168(%rbp), %eax + cmpl $-1, %eax + jne ..B1.195 +..B1.193: + movl -192(%rbp), %eax + cmpl $-2147483648, %eax + jae ..B1.195 +..B1.194: + lea _small_value_80(%rip), %rax + fldt (%rax) + lea _small_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) +..B1.195: + movl -272(%rbp), %eax + testl %eax, %eax + jne ..B1.222 +..B1.196: + movl $1, %eax + addl -168(%rbp), %eax + movl %eax, -168(%rbp) + jne ..B1.202 +..B1.197: + movl $1, %eax + addl -164(%rbp), %eax + movl %eax, -144(%rbp) + movl %eax, -164(%rbp) + movl -268(%rbp), %eax + testl %eax, %eax + je ..B1.199 +..B1.198: + movl $0, -140(%rbp) + jmp ..B1.200 +..B1.199: + movl $-2147483648, -140(%rbp) +..B1.200: + movl -140(%rbp), %eax + movl -144(%rbp), %edx + cmpl %eax, %edx + jne ..B1.202 +..B1.201: + orl $-2147483648, -164(%rbp) + movl $1, %eax + addl -268(%rbp), %eax + movl %eax, -268(%rbp) +..B1.202: + movl -268(%rbp), %eax + cmpl $32767, %eax + jl ..B1.222 +..B1.203: + movl -272(%rbp), %eax + movslq %eax, %rax + shlq $4, %rax + lea _large_value_80(%rip), %rdx + addq %rax, %rdx + fldt (%rdx) + lea _large_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) + fldt -16(%rbp) + fstpt -32(%rbp) + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.204: + movl -268(%rbp), %eax + testl %eax, %eax + jne ..B1.213 +..B1.205: + movl -272(%rbp), %eax + testl %eax, %eax + je ..B1.212 +..B1.206: + movl -272(%rbp), %eax + testl %eax, %eax + je ..B1.213 +..B1.207: + movl -164(%rbp), %eax + cmpl $2147483647, %eax + jb ..B1.212 +..B1.208: + movl -164(%rbp), %eax + cmpl $2147483647, %eax + jne ..B1.213 +..B1.209: + movl -168(%rbp), %eax + cmpl $-1, %eax + jb ..B1.212 +..B1.210: + movl -168(%rbp), %eax + cmpl $-1, %eax + jne ..B1.213 +..B1.211: + movl -192(%rbp), %eax + cmpl $-2147483648, %eax + jae ..B1.213 +..B1.212: + lea _small_value_80(%rip), %rax + fldt (%rax) + lea _small_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) +..B1.213: + movl -272(%rbp), %eax + testl %eax, %eax + je ..B1.222 +..B1.214: + movl $1, %eax + addl -168(%rbp), %eax + movl %eax, -168(%rbp) + jne ..B1.220 +..B1.215: + movl $1, %eax + addl -164(%rbp), %eax + movl %eax, -136(%rbp) + movl %eax, -164(%rbp) + movl -268(%rbp), %eax + testl %eax, %eax + je ..B1.217 +..B1.216: + movl $0, -132(%rbp) + jmp ..B1.218 +..B1.217: + movl $-2147483648, -132(%rbp) +..B1.218: + movl -132(%rbp), %eax + movl -136(%rbp), %edx + cmpl %eax, %edx + jne ..B1.220 +..B1.219: + orl $-2147483648, -164(%rbp) + movl $1, %eax + addl -268(%rbp), %eax + movl %eax, -268(%rbp) +..B1.220: + movl -268(%rbp), %eax + cmpl $32767, %eax + jl ..B1.222 +..B1.221: + movl -272(%rbp), %eax + movslq %eax, %rax + shlq $4, %rax + lea _large_value_80(%rip), %rdx + addq %rax, %rdx + fldt (%rdx) + lea _large_value_80(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt -16(%rbp) + fldt -16(%rbp) + fstpt -32(%rbp) + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_offset 6, -16 +..B1.222: + movq -104(%rbp), %rax + movzbl 9(%rax), %eax + movzbl %al, %eax + andl $-129, %eax + movl -272(%rbp), %edx + andl $1, %edx + shll $7, %edx + orl %edx, %eax + movq -104(%rbp), %rdx + movb %al, 9(%rdx) + movq -104(%rbp), %rax + movzwl 8(%rax), %eax + movzwl %ax, %eax + andl $-32768, %eax + movl -268(%rbp), %edx + andl $32767, %edx + orl %edx, %eax + movq -104(%rbp), %rdx + movw %ax, 8(%rdx) + movq -104(%rbp), %rax + movl -164(%rbp), %edx + movl %edx, 4(%rax) + movq -104(%rbp), %rax + movl -168(%rbp), %edx + movl %edx, (%rax) + fldt -32(%rbp) + leave + .cfi_restore 6 + ret + .cfi_endproc + .type fmal,@function + .size fmal,.-fmal + .data +# -- End fmal + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmax_gen.S b/external/sgx_libm/intel64/fmax_gen.S new file mode 100644 index 0000000000..b4d21d2e2d --- /dev/null +++ b/external/sgx_libm/intel64/fmax_gen.S @@ -0,0 +1,97 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmax_gen.c" + .text +..TXTST0: +# -- Begin fmax + .text + .align 16,0x90 + .globl fmax +fmax: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fmax.1: +..L2: + + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %eax + andl $32752, %eax + movsd %xmm1, -16(%rsp) + cmpl $32752, %eax + je ..B1.7 +..B1.2: + movzwl -10(%rsp), %eax + andl $32752, %eax + cmpl $32752, %eax + jne ..B1.6 +..B1.3: + testl $1048575, -12(%rsp) + jne ..B1.5 +..B1.4: + cmpl $0, -16(%rsp) + je ..B1.6 +..B1.5: + movsd -24(%rsp), %xmm0 + ret +..B1.6: + movsd -24(%rsp), %xmm0 + maxsd -16(%rsp), %xmm0 + ret +..B1.7: + testl $1048575, -20(%rsp) + jne ..B1.9 +..B1.8: + cmpl $0, -24(%rsp) + je ..B1.2 +..B1.9: + movsd -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type fmax,@function + .size fmax,.-fmax + .data +# -- End fmax + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmaxf_gen.S b/external/sgx_libm/intel64/fmaxf_gen.S new file mode 100644 index 0000000000..11343026f0 --- /dev/null +++ b/external/sgx_libm/intel64/fmaxf_gen.S @@ -0,0 +1,91 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmaxf_gen.c" + .text +..TXTST0: +# -- Begin fmaxf + .text + .align 16,0x90 + .globl fmaxf +fmaxf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fmaxf.1: +..L2: + + movss %xmm0, -24(%rsp) + movzwl -22(%rsp), %eax + andl $32640, %eax + movss %xmm1, -16(%rsp) + cmpl $32640, %eax + je ..B1.6 +..B1.2: + movzwl -14(%rsp), %eax + andl $32640, %eax + cmpl $32640, %eax + jne ..B1.5 +..B1.3: + testl $8388607, -16(%rsp) + je ..B1.5 +..B1.4: + movss -24(%rsp), %xmm0 + ret +..B1.5: + movss -24(%rsp), %xmm0 + maxss -16(%rsp), %xmm0 + ret +..B1.6: + testl $8388607, -24(%rsp) + je ..B1.2 +..B1.7: + movss -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type fmaxf,@function + .size fmaxf,.-fmaxf + .data +# -- End fmaxf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmaxl.S b/external/sgx_libm/intel64/fmaxl.S new file mode 100644 index 0000000000..ee873d884e --- /dev/null +++ b/external/sgx_libm/intel64/fmaxl.S @@ -0,0 +1,203 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmaxl.c" + .text +..TXTST0: +# -- Begin fmaxl + .text + .align 16,0x90 + .globl fmaxl +fmaxl: +# parameter 1: 48 + %rsp +# parameter 2: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_fmaxl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %sil, %sil +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 56(%rsp), %ecx + movl %ecx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.34 +..B1.4: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.17 +..B1.5: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.7: + fldcw 32(%rsp) +..B1.8: + movb $1, %sil +..B1.9: + fldt 48(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt 64(%rsp) + fxch %st(1) + fcomip %st(1), %st + jbe ..B1.11 +..B1.10: + fstp %st(0) + jmp ..B1.13 +..B1.11: + fldt 16(%rsp) + fucomip %st(1), %st + jp ..B1.12 + je ..B1.16 +..B1.12: + fstpt 16(%rsp) +..B1.13: + testb %sil, %sil + je ..B1.15 +..B1.14: + fldcw 34(%rsp) +..B1.15: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.16: + testb $-128, 73(%rsp) + jne ..B1.10 + jmp ..B1.12 +..B1.17: + cmpl $-2147483648, 68(%rsp) + jne ..B1.19 +..B1.18: + cmpl $0, 64(%rsp) + je ..B1.5 +..B1.19: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.33 +..B1.20: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.21: + fldcw 32(%rsp) +..B1.22: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.23: + fldcw 34(%rsp) + movzwl 56(%rsp), %ecx +..B1.24: + andl $32767, %ecx + cmpl $32767, %ecx + jne ..B1.27 +..B1.25: + cmpl $-2147483648, 52(%rsp) + jne ..B1.28 +..B1.26: + cmpl $0, 48(%rsp) + jne ..B1.28 +..B1.27: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.28: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.31 +..B1.29: + cmpl $-2147483648, 68(%rsp) + jne ..B1.32 +..B1.30: + cmpl $0, 64(%rsp) + jne ..B1.32 +..B1.31: + fldt 64(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.32: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.33: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.24 +..B1.34: + cmpl $-2147483648, 52(%rsp) + jne ..B1.19 +..B1.35: + cmpl $0, 48(%rsp) + je ..B1.4 + jmp ..B1.19 + .align 16,0x90 + .cfi_endproc + .type fmaxl,@function + .size fmaxl,.-fmaxl + .data +# -- End fmaxl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmin_gen.S b/external/sgx_libm/intel64/fmin_gen.S new file mode 100644 index 0000000000..4afa69faad --- /dev/null +++ b/external/sgx_libm/intel64/fmin_gen.S @@ -0,0 +1,97 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmin_gen.c" + .text +..TXTST0: +# -- Begin fmin + .text + .align 16,0x90 + .globl fmin +fmin: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fmin.1: +..L2: + + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %eax + andl $32752, %eax + movsd %xmm1, -16(%rsp) + cmpl $32752, %eax + je ..B1.7 +..B1.2: + movzwl -10(%rsp), %eax + andl $32752, %eax + cmpl $32752, %eax + jne ..B1.6 +..B1.3: + testl $1048575, -12(%rsp) + jne ..B1.5 +..B1.4: + cmpl $0, -16(%rsp) + je ..B1.6 +..B1.5: + movsd -24(%rsp), %xmm0 + ret +..B1.6: + movsd -24(%rsp), %xmm0 + minsd -16(%rsp), %xmm0 + ret +..B1.7: + testl $1048575, -20(%rsp) + jne ..B1.9 +..B1.8: + cmpl $0, -24(%rsp) + je ..B1.2 +..B1.9: + movsd -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type fmin,@function + .size fmin,.-fmin + .data +# -- End fmin + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fminf_gen.S b/external/sgx_libm/intel64/fminf_gen.S new file mode 100644 index 0000000000..2126ac6dae --- /dev/null +++ b/external/sgx_libm/intel64/fminf_gen.S @@ -0,0 +1,91 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fminf_gen.c" + .text +..TXTST0: +# -- Begin fminf + .text + .align 16,0x90 + .globl fminf +fminf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fminf.1: +..L2: + + movss %xmm0, -24(%rsp) + movzwl -22(%rsp), %eax + andl $32640, %eax + movss %xmm1, -16(%rsp) + cmpl $32640, %eax + je ..B1.6 +..B1.2: + movzwl -14(%rsp), %eax + andl $32640, %eax + cmpl $32640, %eax + jne ..B1.5 +..B1.3: + testl $8388607, -16(%rsp) + je ..B1.5 +..B1.4: + movss -24(%rsp), %xmm0 + ret +..B1.5: + movss -24(%rsp), %xmm0 + minss -16(%rsp), %xmm0 + ret +..B1.6: + testl $8388607, -24(%rsp) + je ..B1.2 +..B1.7: + movss -16(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type fminf,@function + .size fminf,.-fminf + .data +# -- End fminf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fminl.S b/external/sgx_libm/intel64/fminl.S new file mode 100644 index 0000000000..122e39e01c --- /dev/null +++ b/external/sgx_libm/intel64/fminl.S @@ -0,0 +1,187 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fminl.c" + .text +..TXTST0: +# -- Begin fminl + .text + .align 16,0x90 + .globl fminl +fminl: +# parameter 1: 48 + %rsp +# parameter 2: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_fminl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %sil, %sil +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 56(%rsp), %ecx + movl %ecx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.29 +..B1.4: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.12 +..B1.5: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.7: + fldcw 32(%rsp) +..B1.8: + movb $1, %sil +..B1.9: + fldt 48(%rsp) + fldt 64(%rsp) + fcomi %st(1), %st + fcmovnbe %st(1), %st + fstp %st(1) + fstpt 16(%rsp) + testb %sil, %sil + je ..B1.11 +..B1.10: + fldcw 34(%rsp) +..B1.11: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.12: + cmpl $-2147483648, 68(%rsp) + jne ..B1.14 +..B1.13: + cmpl $0, 64(%rsp) + je ..B1.5 +..B1.14: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.28 +..B1.15: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.16: + fldcw 32(%rsp) +..B1.17: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.18: + fldcw 34(%rsp) + movzwl 56(%rsp), %ecx +..B1.19: + andl $32767, %ecx + cmpl $32767, %ecx + jne ..B1.22 +..B1.20: + cmpl $-2147483648, 52(%rsp) + jne ..B1.23 +..B1.21: + cmpl $0, 48(%rsp) + jne ..B1.23 +..B1.22: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.23: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.26 +..B1.24: + cmpl $-2147483648, 68(%rsp) + jne ..B1.27 +..B1.25: + cmpl $0, 64(%rsp) + jne ..B1.27 +..B1.26: + fldt 64(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.27: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.28: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.19 +..B1.29: + cmpl $-2147483648, 52(%rsp) + jne ..B1.14 +..B1.30: + cmpl $0, 48(%rsp) + je ..B1.4 + jmp ..B1.14 + .align 16,0x90 + .cfi_endproc + .type fminl,@function + .size fminl,.-fminl + .data +# -- End fminl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmod_gen.S b/external/sgx_libm/intel64/fmod_gen.S new file mode 100644 index 0000000000..2a5a27cbec --- /dev/null +++ b/external/sgx_libm/intel64/fmod_gen.S @@ -0,0 +1,212 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmod_gen.c" + .text +..TXTST0: +# -- Begin fmod + .text + .align 16,0x90 + .globl fmod +fmod: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fmod.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movq $0x8000000000000000, %rsi + movd %xmm1, %rcx + movq $0x7fffffffffffffff, %rdi + movd %xmm0, %rax + movsd %xmm0, 16(%rsp) + movsd %xmm1, 24(%rsp) + btrq $63, %rcx + movq $0x3ff0000000000000, %rdx + andq %rax, %rsi + andq %rax, %rdi + cmpq %rdx, %rcx + jne ..B1.30 +..B1.2: + cmpq %rcx, %rdi + ja ..B1.7 +..B1.3: + jne ..B1.6 +..B1.4: + pxor %xmm1, %xmm1 + mulsd %xmm1, %xmm0 +..B1.6: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.7: + movq $0x4330000000000000, %rax + cmpq %rax, %rdi + jae ..B1.9 +..B1.8: + negq %rcx + addq %rdi, %rcx + shrq $52, %rcx + negq %rcx + addq $52, %rcx + movsd 16(%rsp), %xmm0 + shrq %cl, %rdi + shlq %cl, %rdi + orq %rsi, %rdi + movq %rdi, (%rsp) + subsd (%rsp), %xmm0 + movd %xmm0, %rax + orq %rsi, %rax + movq %rax, (%rsp) + movsd (%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.9: + movq $0x7ff0000000000000, %rax + cmpq %rax, %rdi + jae ..B1.11 +..B1.10: + pxor %xmm0, %xmm0 + mulsd 16(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.30: + movq $0x7ff0000000000000, %rax + cmpq %rax, %rdi +..B1.11: + ja ..B1.25 +..B1.12: + cmpq %rax, %rcx + ja ..B1.24 +..B1.13: + testq %rcx, %rcx + je ..B1.23 +..B1.14: + cmpq %rax, %rdi + je ..B1.23 +..B1.15: + cmpq %rax, %rcx + je ..B1.22 +..B1.16: + cmpq %rcx, %rdi + jb ..B1.21 +..B1.17: + je ..B1.27 +..B1.18: + movq %rdi, (%rsp) +..B1.19: + fldl 24(%rsp) + fldl 16(%rsp) +.L_2TAG_PACKET_0.0.2: + fprem + fstsw %ax + andw $1024, %ax + jne .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstpl 8(%rsp) +..B1.20: + movsd 8(%rsp), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.21: + movsd 16(%rsp), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.22: + movsd 16(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.23: + pxor %xmm0, %xmm0 + pxor %xmm1, %xmm1 + divsd %xmm1, %xmm0 + movsd %xmm0, 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.24: + movsd 24(%rsp), %xmm0 + mulsd 16(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.25: + movsd 16(%rsp), %xmm0 + mulsd 24(%rsp), %xmm0 + movsd %xmm0, 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.27: + pxor %xmm0, %xmm0 + mulsd 16(%rsp), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fmod,@function + .size fmod,.-fmod + .data +# -- End fmod + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmodf_gen.S b/external/sgx_libm/intel64/fmodf_gen.S new file mode 100644 index 0000000000..43c0192674 --- /dev/null +++ b/external/sgx_libm/intel64/fmodf_gen.S @@ -0,0 +1,74 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmodf_gen.c" + .text +..TXTST0: +# -- Begin fmodf + .text + .align 16,0x90 + .globl fmodf +fmodf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_fmodf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + cvtss2sd %xmm0, %xmm0 + cvtss2sd %xmm1, %xmm1 + call fmod@PLT +..B1.4: + cvtsd2ss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fmodf,@function + .size fmodf,.-fmodf + .data +# -- End fmodf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fmodl.S b/external/sgx_libm/intel64/fmodl.S new file mode 100644 index 0000000000..03f1fe9287 --- /dev/null +++ b/external/sgx_libm/intel64/fmodl.S @@ -0,0 +1,308 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fmodl.c" + .text +..TXTST0: +# -- Begin fmodl + .text + .align 16,0x90 + .globl fmodl +fmodl: +# parameter 1: 80 + %rsp +# parameter 2: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_fmodl.1: +..L2: + + subq $72, %rsp + .cfi_def_cfa_offset 80 + xorb %dl, %dl + fldt 80(%rsp) + fstpt 32(%rsp) + fldt 96(%rsp) + fstpt 48(%rsp) +..B1.2: + fnstcw 66(%rsp) +..B1.3: + movzwl 104(%rsp), %ecx + andl $32767, %ecx + jne ..B1.6 +..B1.4: + cmpl $0, 100(%rsp) + jne ..B1.6 +..B1.5: + cmpl $0, 96(%rsp) + je ..B1.42 +..B1.6: + movzwl 88(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.40 +..B1.7: + cmpl $32767, %ecx + je ..B1.17 +..B1.8: + movzwl 66(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.9: + orl $-64768, %ecx + movw %cx, 64(%rsp) +..B1.10: + fldcw 64(%rsp) +..B1.11: + movb $1, %dl +..B1.12: + fldt 48(%rsp) + fldt 32(%rsp) + movq $1024, %rcx +.L_2TAG_PACKET_0.0.2: + fprem + fstsw %ax + andq %rcx, %rax + cmpq $1024, %rax + je .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstpt 16(%rsp) +..B1.13: + testb %dl, %dl + je ..B1.15 +..B1.14: + fldcw 66(%rsp) +..B1.15: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.17: + movq $0x8000000000000000, %rax + cmpq 96(%rsp), %rax + je ..B1.25 +..B1.18: + movzwl 66(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.24 +..B1.19: + orl $-64768, %edx + movw %dx, 64(%rsp) +..B1.20: + fldcw 64(%rsp) +..B1.21: + fldt 80(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) +..B1.22: + fldcw 66(%rsp) +..B1.23: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.24: + fldt 80(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.23 +..B1.25: + cmpl $32767, %esi + je ..B1.31 +..B1.26: + testl %esi, %esi + jne ..B1.30 +..B1.27: + cmpl $0, 84(%rsp) + jne ..B1.29 +..B1.28: + cmpl $0, 80(%rsp) + je ..B1.30 +..B1.29: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 8(%rsp) +..B1.30: + fldt 80(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.31: + cmpl $-2147483648, 84(%rsp) + jne ..B1.30 +..B1.32: + cmpl $0, 80(%rsp) + jne ..B1.30 +..B1.33: + movzwl 66(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.34: + orl $-64768, %ecx + movw %cx, 64(%rsp) +..B1.35: + fldcw 64(%rsp) +..B1.36: + movb $1, %dl +..B1.37: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) + je ..B1.39 +..B1.38: + fldcw 66(%rsp) +..B1.39: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.40: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + jne ..B1.18 +..B1.41: + cmpl $32767, %ecx + je ..B1.17 + jmp ..B1.25 +..B1.42: + movzwl 66(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.46 +..B1.43: + orl $-64768, %ecx + movw %cx, 64(%rsp) +..B1.44: + fldcw 64(%rsp) +..B1.45: + movb $1, %dl +..B1.46: + movzwl 88(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.49 +..B1.47: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + je ..B1.49 +..B1.48: + fldt 80(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) + jmp ..B1.50 +..B1.49: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) +..B1.50: + testb %dl, %dl + je ..B1.52 +..B1.51: + fldcw 66(%rsp) +..B1.52: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fmodl,@function + .size fmodl,.-fmodl + .data +# -- End fmodl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/fpclassify.S b/external/sgx_libm/intel64/fpclassify.S new file mode 100644 index 0000000000..fe51fc3393 --- /dev/null +++ b/external/sgx_libm/intel64/fpclassify.S @@ -0,0 +1,423 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "fpclassify.c" + .text +..TXTST0: +# -- Begin __fpclassifyd + .text + .align 16,0x90 + .globl __fpclassifyd +__fpclassifyd: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___fpclassifyd.1: +..L2: + + movd %xmm0, %rcx + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + btrq $63, %rcx + andl $2147483647, %eax + cmpl $2146435072, %eax + jb ..B1.3 +..B1.2: + movq $0x7ff0000000000000, %rdx + xorl %eax, %eax + cmpq %rcx, %rdx + setae %al + ret +..B1.3: + cmpl $1048576, %eax + jae ..B1.5 +..B1.4: + movl $3, %edx + movl $2, %eax + testq %rcx, %rcx + cmovne %edx, %eax + ret +..B1.5: + movl $4, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __fpclassifyd,@function + .size __fpclassifyd,.-__fpclassifyd + .data +# -- End __fpclassifyd + .text +# -- Begin fpclassifyd + .text + .align 16,0x90 + .globl fpclassifyd +fpclassifyd: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_fpclassifyd.4: +..L5: + + movd %xmm0, %rcx + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + btrq $63, %rcx + andl $2147483647, %eax + cmpl $2146435072, %eax + jb ..B2.3 +..B2.2: + movq $0x7ff0000000000000, %rdx + xorl %eax, %eax + cmpq %rcx, %rdx + setae %al + ret +..B2.3: + cmpl $1048576, %eax + jae ..B2.5 +..B2.4: + movl $3, %edx + movl $2, %eax + testq %rcx, %rcx + cmovne %edx, %eax + ret +..B2.5: + movl $4, %eax + ret + .align 16,0x90 + .cfi_endproc + .type fpclassifyd,@function + .size fpclassifyd,.-fpclassifyd + .data +# -- End fpclassifyd + .text +# -- Begin __fpclassify + .text + .align 16,0x90 + .globl __fpclassify +__fpclassify: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___fpclassify.7: +..L8: + + movd %xmm0, %rcx + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + btrq $63, %rcx + andl $2147483647, %eax + cmpl $2146435072, %eax + jb ..B3.3 +..B3.2: + movq $0x7ff0000000000000, %rdx + xorl %eax, %eax + cmpq %rcx, %rdx + setae %al + ret +..B3.3: + cmpl $1048576, %eax + jae ..B3.5 +..B3.4: + movl $3, %edx + movl $2, %eax + testq %rcx, %rcx + cmovne %edx, %eax + ret +..B3.5: + movl $4, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __fpclassify,@function + .size __fpclassify,.-__fpclassify + .data +# -- End __fpclassify + .text +# -- Begin fpclassify + .text + .align 16,0x90 + .globl fpclassify +fpclassify: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value_fpclassify.10: +..L11: + + movd %xmm0, %rcx + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + btrq $63, %rcx + andl $2147483647, %eax + cmpl $2146435072, %eax + jb ..B4.3 +..B4.2: + movq $0x7ff0000000000000, %rdx + xorl %eax, %eax + cmpq %rcx, %rdx + setae %al + ret +..B4.3: + cmpl $1048576, %eax + jae ..B4.5 +..B4.4: + movl $3, %edx + movl $2, %eax + testq %rcx, %rcx + cmovne %edx, %eax + ret +..B4.5: + movl $4, %eax + ret + .align 16,0x90 + .cfi_endproc + .type fpclassify,@function + .size fpclassify,.-fpclassify + .data +# -- End fpclassify + .text +# -- Begin __fpclassifyf + .text + .align 16,0x90 + .globl __fpclassifyf +__fpclassifyf: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___fpclassifyf.13: +..L14: + + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jb ..B5.3 +..B5.2: + movl $0, %eax + setbe %al + ret +..B5.3: + cmpl $8388608, %edx + jae ..B5.5 +..B5.4: + movl $3, %ecx + movl $2, %eax + testl %edx, %edx + cmovne %ecx, %eax + ret +..B5.5: + movl $4, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __fpclassifyf,@function + .size __fpclassifyf,.-__fpclassifyf + .data +# -- End __fpclassifyf + .text +# -- Begin fpclassifyf + .text + .align 16,0x90 + .globl fpclassifyf +fpclassifyf: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value_fpclassifyf.16: +..L17: + + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jb ..B6.3 +..B6.2: + movl $0, %eax + setbe %al + ret +..B6.3: + cmpl $8388608, %edx + jae ..B6.5 +..B6.4: + movl $3, %ecx + movl $2, %eax + testl %edx, %edx + cmovne %ecx, %eax + ret +..B6.5: + movl $4, %eax + ret + .align 16,0x90 + .cfi_endproc + .type fpclassifyf,@function + .size fpclassifyf,.-fpclassifyf + .data +# -- End fpclassifyf + .text +# -- Begin __fpclassifyl + .text + .align 16,0x90 + .globl __fpclassifyl +__fpclassifyl: +# parameter 1: 8 + %rsp +..B7.1: + .cfi_startproc +..___tag_value___fpclassifyl.19: +..L20: + + movzwl 16(%rsp), %ecx + andl $32767, %ecx + movl 12(%rsp), %esi + movl %ecx, %eax + movl %esi, %edx + shll $16, %eax + shrl $16, %edx + orl %edx, %eax + cmpl $2147418112, %eax + jb ..B7.5 +..B7.2: + cmpl $32767, %ecx + je ..B7.12 +..B7.3: + xorl %eax, %eax +..B7.4: + ret +..B7.5: + cmpl $65536, %eax + jae ..B7.11 +..B7.6: + testl %esi, %esi + jne ..B7.8 +..B7.7: + cmpl $0, 8(%rsp) + je ..B7.9 +..B7.8: + movl $3, %eax + ret +..B7.9: + movl $2, %eax +..B7.10: + ret +..B7.11: + andl $32768, %eax + shrl $15, %eax + addl $3, %eax + ret +..B7.12: + cmpl $-2147483648, %esi + jne ..B7.3 +..B7.13: + cmpl $0, 8(%rsp) + jne ..B7.3 +..B7.14: + movl $1, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __fpclassifyl,@function + .size __fpclassifyl,.-__fpclassifyl + .data +# -- End __fpclassifyl + .text +# -- Begin fpclassifyl + .text + .align 16,0x90 + .globl fpclassifyl +fpclassifyl: +# parameter 1: 8 + %rsp +..B8.1: + .cfi_startproc +..___tag_value_fpclassifyl.22: +..L23: + + movzwl 16(%rsp), %ecx + andl $32767, %ecx + movl 12(%rsp), %esi + movl %ecx, %eax + movl %esi, %edx + shll $16, %eax + shrl $16, %edx + orl %edx, %eax + cmpl $2147418112, %eax + jb ..B8.5 +..B8.2: + cmpl $32767, %ecx + je ..B8.12 +..B8.3: + xorl %eax, %eax +..B8.4: + ret +..B8.5: + cmpl $65536, %eax + jae ..B8.11 +..B8.6: + testl %esi, %esi + jne ..B8.8 +..B8.7: + cmpl $0, 8(%rsp) + je ..B8.9 +..B8.8: + movl $3, %eax + ret +..B8.9: + movl $2, %eax +..B8.10: + ret +..B8.11: + andl $32768, %eax + shrl $15, %eax + addl $3, %eax + ret +..B8.12: + cmpl $-2147483648, %esi + jne ..B8.3 +..B8.13: + cmpl $0, 8(%rsp) + jne ..B8.3 +..B8.14: + movl $1, %eax + ret + .align 16,0x90 + .cfi_endproc + .type fpclassifyl,@function + .size fpclassifyl,.-fpclassifyl + .data +# -- End fpclassifyl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/frexp_gen.S b/external/sgx_libm/intel64/frexp_gen.S new file mode 100644 index 0000000000..42177750cb --- /dev/null +++ b/external/sgx_libm/intel64/frexp_gen.S @@ -0,0 +1,115 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "frexp_gen.c" + .text +..TXTST0: +# -- Begin frexp + .text + .align 16,0x90 + .globl frexp +frexp: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_frexp.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %edx + andl $2147483647, %edx + lea -1048576(%rdx), %ecx + cmpl $2145386496, %ecx + jb ..B1.6 +..B1.2: + testl %ecx, %ecx + jge ..B1.5 +..B1.3: + movl -8(%rsp), %eax + orl %eax, %edx + je ..B1.5 +..B1.4: + lea _TWO_55(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + movl %edx, %ecx + andl $2147483647, %ecx + andl $-2146435073, %edx + shrl $20, %ecx + orl $1071644672, %edx + movl %edx, -4(%rsp) + addl $-1077, %ecx + movl %ecx, (%rdi) + movsd -8(%rsp), %xmm0 + ret +..B1.5: + movl $0, (%rdi) + movsd -8(%rsp), %xmm0 + ret +..B1.6: + andl $-2146435073, %eax + shrl $20, %ecx + orl $1071644672, %eax + movl %eax, -4(%rsp) + addl $-1021, %ecx + movl %ecx, (%rdi) + movsd -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type frexp,@function + .size frexp,.-frexp + .data +# -- End frexp + .section .rodata, "a" + .align 4 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .type _TWO_55,@object + .size _TWO_55,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/frexpf.S b/external/sgx_libm/intel64/frexpf.S new file mode 100644 index 0000000000..58d2539b42 --- /dev/null +++ b/external/sgx_libm/intel64/frexpf.S @@ -0,0 +1,114 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "frexpf.c" + .text +..TXTST0: +# -- Begin frexpf + .text + .align 16,0x90 + .globl frexpf +frexpf: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_frexpf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %eax + andl $2147483647, %eax + lea -8388608(%rax), %ecx + cmpl $2130706432, %ecx + jb ..B1.5 +..B1.2: + decl %eax + cmpl $2139095039, %eax + jae ..B1.6 +..B1.3: + movl %edx, -20(%rsp) + orl $1056964608, %edx + movl %edx, -24(%rsp) + andl $-2147483648, %edx + orl $1056964608, %edx + movl %edx, -16(%rsp) + movss -24(%rsp), %xmm2 + movss -20(%rsp), %xmm1 + movss -20(%rsp), %xmm0 + subss -16(%rsp), %xmm2 + addss %xmm0, %xmm1 + movd %xmm2, %eax + movss %xmm1, -20(%rsp) + movl %eax, %edx + andl $-2139095041, %eax + andl $2139095040, %edx + orl $1056964608, %eax + shrl $23, %edx + movl %eax, -24(%rsp) + addl $-251, %edx + movl %edx, (%rdi) + movss -24(%rsp), %xmm0 +..B1.4: + ret +..B1.5: + andl $-2139095041, %edx + shrl $23, %ecx + orl $1056964608, %edx + movl %edx, -24(%rsp) + addl $-125, %ecx + movl %ecx, (%rdi) + movss -24(%rsp), %xmm0 + ret +..B1.6: + movss -8(%rsp), %xmm0 + movl $0, (%rdi) + addss %xmm0, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type frexpf,@function + .size frexpf,.-frexpf + .data +# -- End frexpf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/frexpl.S b/external/sgx_libm/intel64/frexpl.S new file mode 100644 index 0000000000..45c09e0930 --- /dev/null +++ b/external/sgx_libm/intel64/frexpl.S @@ -0,0 +1,174 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "frexpl.c" + .text +..TXTST0: +# -- Begin frexpl + .text + .align 16,0x90 + .globl frexpl +frexpl: +# parameter 1: 32 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_frexpl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 40(%rsp), %edx + movl %edx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.15 +..B1.4: + testl %eax, %eax + jne ..B1.13 +..B1.5: + cmpq $0, 32(%rsp) + je ..B1.12 +..B1.6: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.14 +..B1.7: + orl $-64768, %edx + movl $0, (%rdi) + movw %dx, 16(%rsp) +..B1.8: + fldcw 16(%rsp) +..B1.9: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) +..B1.10: + fldcw 18(%rsp) +..B1.11: + movzwl 40(%rsp), %edx + movl %edx, %eax + andl $-32768, %edx + andl $32767, %eax + orl $-49154, %edx + addl $-16457, %eax + movw %dx, 40(%rsp) + fldt 32(%rsp) + movl %eax, (%rdi) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.12: + fldt 32(%rsp) + movl $0, (%rdi) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.13: + andl $-32768, %edx + addl $-16382, %eax + orl $-49154, %edx + movw %dx, 40(%rsp) + fldt 32(%rsp) + movl %eax, (%rdi) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.14: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) + jmp ..B1.11 +..B1.15: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + movl $0, (%rdi) + cmpl $768, %eax + je ..B1.21 +..B1.16: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.17: + fldcw 16(%rsp) +..B1.18: + fldt 32(%rsp) + fstpt (%rsp) +..B1.19: + fldcw 18(%rsp) +..B1.20: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.21: + fldt 32(%rsp) + fstpt (%rsp) + jmp ..B1.20 + .align 16,0x90 + .cfi_endproc + .type frexpl,@function + .size frexpl,.-frexpl + .data +# -- End frexpl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/hypot_gen.S b/external/sgx_libm/intel64/hypot_gen.S new file mode 100644 index 0000000000..d1b9a11db6 --- /dev/null +++ b/external/sgx_libm/intel64/hypot_gen.S @@ -0,0 +1,143 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "hypot_gen.c" + .text +..TXTST0: +# -- Begin hypot + .text + .align 16,0x90 + .globl hypot +hypot: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_hypot.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %cl, %cl + movsd %xmm0, 8(%rsp) + movsd %xmm1, 16(%rsp) +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.5: + fldcw 32(%rsp) +..B1.6: + movb $1, %cl +..B1.7: + fldl 8(%rsp) + fmull 8(%rsp) + fldl 16(%rsp) + fmull 16(%rsp) + faddp + fsqrt + fstpl 24(%rsp) +..B1.8: + testb %cl, %cl + je ..B1.10 +..B1.9: + fldcw 34(%rsp) +..B1.10: + movq $0x7ff0000000000000, %rcx + movq 24(%rsp), %rax + cmpq %rcx, %rax + jb ..B1.19 +..B1.11: + movq 8(%rsp), %rdx + movq 16(%rsp), %rsi + btrq $63, %rdx + btrq $63, %rsi + cmpq %rcx, %rax + je ..B1.17 +..B1.12: + cmpq %rcx, %rdx + jne ..B1.14 +..B1.13: + movq %rdx, (%rsp) + movsd (%rsp), %xmm0 + movsd %xmm0, 24(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.14: + cmpq %rcx, %rsi + jne ..B1.17 +..B1.15: + movq %rsi, (%rsp) + movsd (%rsp), %xmm0 + movsd %xmm0, 24(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.17: + movsd 24(%rsp), %xmm0 +..B1.18: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.19: + movsd 24(%rsp), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type hypot,@function + .size hypot,.-hypot + .data +# -- End hypot + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/hypotf_gen.S b/external/sgx_libm/intel64/hypotf_gen.S new file mode 100644 index 0000000000..6a1b3d8b1c --- /dev/null +++ b/external/sgx_libm/intel64/hypotf_gen.S @@ -0,0 +1,100 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "hypotf_gen.c" + .text +..TXTST0: +# -- Begin hypotf + .text + .align 16,0x90 + .globl hypotf +hypotf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_hypotf.1: +..L2: + + movaps %xmm1, %xmm3 + movaps %xmm0, %xmm1 + pxor %xmm0, %xmm0 + pxor %xmm2, %xmm2 + cvtss2sd %xmm1, %xmm0 + cvtss2sd %xmm3, %xmm2 + mulsd %xmm0, %xmm0 + mulsd %xmm2, %xmm2 + addsd %xmm2, %xmm0 + sqrtsd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movd %xmm0, %eax + cmpl $2139095040, %eax + jb ..B1.8 +..B1.2: + movd %xmm1, %edx + movd %xmm3, %ecx + andl $2147483647, %edx + andl $2147483647, %ecx + cmpl $2139095040, %eax + je ..B1.8 +..B1.4: + cmpl $2139095040, %edx + jne ..B1.6 +..B1.5: + movl %edx, -8(%rsp) + movss -8(%rsp), %xmm0 + ret +..B1.6: + cmpl $2139095040, %ecx + jne ..B1.8 +..B1.7: + movl %ecx, -8(%rsp) + movss -8(%rsp), %xmm0 +..B1.8: + ret + .align 16,0x90 + .cfi_endproc + .type hypotf,@function + .size hypotf,.-hypotf + .data +# -- End hypotf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/hypotl.S b/external/sgx_libm/intel64/hypotl.S new file mode 100644 index 0000000000..4e5f91abcc --- /dev/null +++ b/external/sgx_libm/intel64/hypotl.S @@ -0,0 +1,849 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "hypotl.c" + .text +..TXTST0: +# -- Begin hypotl + .text + .align 16,0x90 + .globl hypotl +hypotl: +# parameter 1: 32 + %rsp +# parameter 2: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_hypotl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + xorb %sil, %sil +..B1.2: + fnstcw 18(%rsp) +..B1.3: + andb $127, 41(%rsp) + andb $127, 57(%rsp) + movzwl 40(%rsp), %edx + andl $32767, %edx + movzwl 56(%rsp), %eax + andl $32767, %eax + cmpl $32767, %edx + je ..B1.67 +..B1.4: + cmpl $32767, %eax + je ..B1.67 +..B1.5: + movl %edx, %ecx + subl %eax, %ecx + lea 64(%rcx), %edi + cmpl $128, %edi + ja ..B1.25 +..B1.6: + lea (%rdx,%rax), %edi + cmpl $18376, %edi + jge ..B1.35 +..B1.7: + testl %edx, %edx + jne ..B1.12 +..B1.8: + cmpq $0, 32(%rsp) + jne ..B1.12 +..B1.9: + testl %eax, %eax + jne ..B1.12 +..B1.10: + cmpq $0, 48(%rsp) + jne ..B1.12 +..B1.11: + lea _zeros(%rip), %rax + fldl (%rax) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.12: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.16 +..B1.13: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.14: + fldcw 16(%rsp) +..B1.15: + movb $1, %sil +..B1.16: + fldt 32(%rsp) + lea _scales(%rip), %rax + fldt 48(%rsp) + lea 4(%rcx), %edx + cmpl $8, %edx + fldt (%rax) + fmul %st, %st(2) + fmulp %st, %st(1) + ja ..B1.20 +..B1.17: + lea _TWO_48H(%rip), %rax + fld %st(1) + fld %st(2) + fld %st(3) + fld %st(3) + lea _TWO_32H(%rip), %rdx + fxch %st(5) + fcomi %st(4), %st + fldl (%rax) + fmul %st, %st(4) + fxch %st(3) + fadd %st(4), %st + fsubp %st, %st(4) + fld %st(3) + fld %st(5) + fxch %st(4) + fmul %st(6), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fxch %st(3) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(4) + fsubr %st, %st(7) + fxch %st(3) + fmul %st(7), %st + fxch %st(2) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + fld %st(0) + fxch %st(3) + fmul %st(0), %st + fadd %st, %st(3) + fldl (%rdx) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + jbe ..B1.19 +..B1.18: + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + jmp ..B1.22 +..B1.19: + fxch %st(2) + fsubr %st(4), %st + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(2) + jmp ..B1.22 +..B1.20: + lea _TWO_48H(%rip), %rax + lea _TWO_32H(%rip), %rdx + testl %ecx, %ecx + fldl (%rax) + fldl (%rdx) + jle ..B1.34 +..B1.21: + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(0), %st + fxch %st(2) + fxch %st(1) + fxch %st(2) +..B1.22: + fld %st(0) + lea 16+_scales(%rip), %rax + testb %sil, %sil + fadd %st(2), %st + fsqrt + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(2) + fld %st(3) + fxch %st(1) + fsub %st(4), %st + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fadd %st(2), %st + fdivrp %st, %st(1) + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 18(%rsp) +..B1.24: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.25: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.26: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.27: + fldcw 16(%rsp) +..B1.28: + movb $1, %sil +..B1.29: + fldt 32(%rsp) + lea 16+_ranges(%rip), %rax + fldt 48(%rsp) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + jae ..B1.31 + jp ..B1.31 +..B1.30: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) +..B1.31: + testb %sil, %sil + je ..B1.33 +..B1.32: + fldcw 18(%rsp) +..B1.33: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.34: + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(3) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + jmp ..B1.22 +..B1.35: + movzwl 18(%rsp), %edx + cmpl $47156, %edi + jle ..B1.51 +..B1.36: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.40 +..B1.37: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.38: + fldcw 16(%rsp) +..B1.39: + movb $1, %sil +..B1.40: + fldt 32(%rsp) + lea 16+_scales(%rip), %rax + fldt 48(%rsp) + lea 4(%rcx), %edx + cmpl $8, %edx + fldt (%rax) + fmul %st, %st(2) + fmulp %st, %st(1) + ja ..B1.44 +..B1.41: + lea _TWO_48H(%rip), %rax + fld %st(1) + fld %st(2) + fld %st(3) + fld %st(3) + lea _TWO_32H(%rip), %rdx + fxch %st(5) + fcomi %st(4), %st + fldl (%rax) + fmul %st, %st(4) + fxch %st(3) + fadd %st(4), %st + fsubp %st, %st(4) + fld %st(3) + fld %st(5) + fxch %st(4) + fmul %st(6), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fxch %st(3) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(4) + fsubr %st, %st(7) + fxch %st(3) + fmul %st(7), %st + fxch %st(2) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + fld %st(0) + fxch %st(3) + fmul %st(0), %st + fadd %st, %st(3) + fldl (%rdx) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + jbe ..B1.43 +..B1.42: + fxch %st(1) + fsubr %st(4), %st + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + jmp ..B1.46 +..B1.43: + fxch %st(2) + fsubr %st(4), %st + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(2) + jmp ..B1.46 +..B1.44: + lea _TWO_48H(%rip), %rax + lea _TWO_32H(%rip), %rdx + testl %ecx, %ecx + fldl (%rax) + fldl (%rdx) + jle ..B1.65 +..B1.45: + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(0), %st + fxch %st(2) + fxch %st(1) + fxch %st(2) +..B1.46: + fldt .L_2il0floatpacket.0(%rip) + fld %st(1) + lea _ranges(%rip), %rax + fadd %st(3), %st + fsqrt + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(3) + fld %st(4) + fxch %st(1) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(3) + fadd %st(3), %st + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + jp ..B1.47 + jbe ..B1.64 +..B1.47: + fldt (%rsp) + lea _scales(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.48: + testb %sil, %sil + je ..B1.50 +..B1.49: + fldcw 18(%rsp) +..B1.50: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.51: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.55 +..B1.52: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.53: + fldcw 16(%rsp) +..B1.54: + movb $1, %sil +..B1.55: + lea 4(%rcx), %eax + cmpl $8, %eax + ja ..B1.59 +..B1.56: + fldt 32(%rsp) + lea _TWO_48H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea _TWO_32H(%rip), %rdx + fldt 48(%rsp) + fld %st(0) + fxch %st(5) + fcomi %st(1), %st + fldl (%rax) + fmul %st, %st(5) + fxch %st(4) + fadd %st(5), %st + fsubp %st, %st(5) + fld %st(4) + fld %st(2) + fxch %st(3) + fmul %st, %st(5) + fxch %st(3) + fadd %st(5), %st + fsubp %st, %st(5) + fld %st(4) + fxch %st(4) + fsub %st(6), %st + fmul %st, %st(1) + fxch %st(5) + fsubr %st, %st(7) + fxch %st(4) + fmul %st(7), %st + fxch %st(2) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fmul %st(0), %st + fld %st(0) + fxch %st(2) + fmul %st(0), %st + fadd %st, %st(2) + fldl (%rdx) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + jbe ..B1.58 +..B1.57: + fxch %st(1) + fsubr %st(3), %st + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + fxch %st(1) + jmp ..B1.61 +..B1.58: + fxch %st(2) + fsubr %st(3), %st + fsubrp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + fxch %st(1) + jmp ..B1.61 +..B1.59: + fldt 32(%rsp) + lea _TWO_48H(%rip), %rax + fldt 48(%rsp) + lea _TWO_32H(%rip), %rdx + testl %ecx, %ecx + fldl (%rax) + fldl (%rdx) + jle ..B1.66 +..B1.60: + fxch %st(1) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(4) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(5) + faddp %st, %st(4) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(0), %st + fxch %st(2) + fxch %st(1) + fxch %st(2) +..B1.61: + fldt .L_2il0floatpacket.0(%rip) + fld %st(1) + testb %sil, %sil + fadd %st(3), %st + fsqrt + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fsubp %st, %st(5) + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(3) + fld %st(4) + fxch %st(1) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(3) + fadd %st(3), %st + fdivrp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.63 +..B1.62: + fldcw 18(%rsp) +..B1.63: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.64: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.48 +..B1.65: + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(3) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + jmp ..B1.46 +..B1.66: + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fld %st(3) + fsub %st(2), %st + fmul %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + jmp ..B1.61 +..B1.67: + movzwl 18(%rsp), %edi + movl %edi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.71 +..B1.68: + orl $-64768, %edi + movw %di, 16(%rsp) +..B1.69: + fldcw 16(%rsp) +..B1.70: + movb $1, %sil +..B1.71: + cmpl $32767, %edx + je ..B1.87 +..B1.72: + cmpl $32767, %eax + je ..B1.85 +..B1.73: + fldt 32(%rsp) + fldt 48(%rsp) + faddp %st, %st(1) + fstpt (%rsp) +..B1.74: + testb %sil, %sil + je ..B1.76 +..B1.75: + fldcw 18(%rsp) +..B1.76: + cmpl $32767, %edx + je ..B1.82 +..B1.77: + cmpl $32767, %eax + jne ..B1.81 +..B1.78: + cmpl $-2147483648, 52(%rsp) + jne ..B1.81 +..B1.79: + cmpl $0, 48(%rsp) + jne ..B1.81 +..B1.80: + fldt 48(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.81: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.82: + cmpl $-2147483648, 36(%rsp) + jne ..B1.77 +..B1.83: + cmpl $0, 32(%rsp) + jne ..B1.77 +..B1.84: + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.85: + movq $0x8000000000000000, %rcx + cmpq 48(%rsp), %rcx + je ..B1.73 +..B1.86: + fldt 32(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.74 +..B1.87: + movq $0x8000000000000000, %rcx + cmpq 32(%rsp), %rcx + jne ..B1.86 + jmp ..B1.72 + .align 16,0x90 + .cfi_endproc + .type hypotl,@function + .size hypotl,.-hypotl + .data +# -- End hypotl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_scales: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24653 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8113 + .word 0 + .word 0 + .word 0 + .type _scales,@object + .size _scales,32 + .align 2 +_ranges: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24497 + .word 0 + .word 0 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 32766 + .word 0 + .word 0 + .word 0 + .type _ranges,@object + .size _ranges,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ilogb_gen.S b/external/sgx_libm/intel64/ilogb_gen.S new file mode 100644 index 0000000000..8bd3be4b36 --- /dev/null +++ b/external/sgx_libm/intel64/ilogb_gen.S @@ -0,0 +1,134 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ilogb_gen.c" + .text +..TXTST0: +# -- Begin ilogb + .text + .align 16,0x90 + .globl ilogb +ilogb: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ilogb.1: +..L2: + + movsd %xmm0, -16(%rsp) + movl -12(%rsp), %ecx + andl $2147483647, %ecx + lea -1048576(%rcx), %eax + cmpl $2145386496, %eax + jb ..B1.4 +..B1.2: + testl %eax, %eax + jl ..B1.5 +..B1.3: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + addl $-2146435072, %ecx + orl -16(%rsp), %ecx + movl $2147483647, %ecx + movsd (%rax), %xmm0 + movl $-2147483648, %eax + mulsd (%rdx), %xmm0 + cmove %ecx, %eax + movsd %xmm0, -24(%rsp) + ret +..B1.4: + shrl $20, %eax + addl $-1022, %eax + ret +..B1.5: + movl -16(%rsp), %eax + orl %eax, %ecx + je ..B1.7 +..B1.6: + lea _TWO_55(%rip), %rax + movsd -16(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -16(%rsp) + movl -12(%rsp), %eax + andl $2147483647, %eax + shrl $20, %eax + addl $-1078, %eax + ret +..B1.7: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + movl $-2147483648, %eax + mulsd (%rdx), %xmm0 + movsd %xmm0, -24(%rsp) + ret + .align 16,0x90 + .cfi_endproc + .type ilogb,@function + .size ilogb,.-ilogb + .data +# -- End ilogb + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .type _TWO_55,@object + .size _TWO_55,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ilogbf.S b/external/sgx_libm/intel64/ilogbf.S new file mode 100644 index 0000000000..be18f3b22b --- /dev/null +++ b/external/sgx_libm/intel64/ilogbf.S @@ -0,0 +1,116 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ilogbf.c" + .text +..TXTST0: +# -- Begin ilogbf + .text + .align 16,0x90 + .globl ilogbf +ilogbf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ilogbf.1: +..L2: + + movd %xmm0, %ecx + movss %xmm0, -16(%rsp) + andl $2147483647, %ecx + addl $-8388608, %ecx + cmpl $2130706432, %ecx + jb ..B1.4 +..B1.2: + testl %ecx, %ecx + jl ..B1.5 +..B1.3: + movl $2147483647, %edx + movl $-2147483648, %eax + cmpl $2130706432, %ecx + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 + cmove %edx, %eax + movss %xmm0, -24(%rsp) + ret +..B1.4: + shrl $23, %ecx + addl $-126, %ecx + movl %ecx, %eax + ret +..B1.5: + cmpl $-8388608, %ecx + je ..B1.7 +..B1.6: + movss -16(%rsp), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + movd %xmm0, %eax + movss %xmm0, -16(%rsp) + andl $2147483647, %eax + shrl $23, %eax + addl $-152, %eax + ret +..B1.7: + movl $-2147483648, %eax + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, -24(%rsp) + ret + .align 16,0x90 + .cfi_endproc + .type ilogbf,@function + .size ilogbf,.-ilogbf + .data +# -- End ilogbf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x7f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ilogbl.S b/external/sgx_libm/intel64/ilogbl.S new file mode 100644 index 0000000000..0b9cff62e4 --- /dev/null +++ b/external/sgx_libm/intel64/ilogbl.S @@ -0,0 +1,200 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ilogbl.c" + .text +..TXTST0: +# -- Begin ilogbl + .text + .align 16,0x90 + .globl ilogbl +ilogbl: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ilogbl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 10(%rsp) +..B1.3: + movzwl 40(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.19 +..B1.4: + testl %eax, %eax + jne ..B1.12 +..B1.5: + movzwl 10(%rsp), %edx + cmpq $0, 32(%rsp) + je ..B1.14 +..B1.6: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.13 +..B1.7: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.8: + fldcw 8(%rsp) +..B1.9: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) +..B1.10: + fldcw 10(%rsp) +..B1.11: + movzwl 40(%rsp), %eax + andl $32767, %eax + addl $-16458, %eax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.12: + addl $-16383, %eax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.13: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) + jmp ..B1.11 +..B1.14: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.18 +..B1.15: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.16: + fldcw 8(%rsp) +..B1.17: + fldcw 10(%rsp) +..B1.18: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + movl $-2147483648, %eax + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.19: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + cmpl $-2147483648, 36(%rsp) + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + jne ..B1.22 +..B1.20: + cmpl $0, 32(%rsp) + jne ..B1.22 +..B1.21: + movl $2147483647, %eax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.22: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.26 +..B1.23: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.24: + fldcw 8(%rsp) +..B1.25: + fldcw 10(%rsp) +..B1.26: + movl $-2147483648, %eax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ilogbl,@function + .size ilogbl,.-ilogbl + .data +# -- End ilogbl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/intel_quad_exception.S b/external/sgx_libm/intel64/intel_quad_exception.S new file mode 100644 index 0000000000..d68df25de4 --- /dev/null +++ b/external/sgx_libm/intel64/intel_quad_exception.S @@ -0,0 +1,1993 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "intel_quad_exception.c" + .text +..TXTST0: +# -- Begin __dpml_exception + .text + .align 16,0x90 + .globl __dpml_exception +__dpml_exception: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value___dpml_exception.1: +..L2: + + movq $0x7fffffffffffffff, %rdx + movq (%rdi), %rsi + andq %rsi, %rdx + testq %rsi, %rsi + lea 7+__dpml_response_table(%rip), %rax + lea 6+__dpml_response_table(%rip), %rcx + lea 32(%rdi), %r11 + cmovl %rdx, %rsi + movq $0xffffffff07ffffff, %rdx + andq %rsi, %rdx + movq %rsi, %r9 + shrq $27, %r9 + movq __dpml_globals_table@GOTPCREL(%rip), %r10 + movzbl (%rax,%rdx,8), %r8d + shlq $5, %r8 + movzbl (%rcx,%rdx,8), %esi + addq $-4, %rdx + lea (%r8,%r9,8), %rcx + addq %r10, %rcx + cmpl $4, %esi + cmove %r11, %rcx + cmpq $171, %rdx + ja ..B1.69 +..B1.2: + movl %edx, %r8d + lea .2.9_2.switchtab.1(%rip), %rdx + movzbl (%rdx,%r8), %edx + lea ..1.1_0.TAG.12.0.1(%rip), %rax + addq %rdx, %rax + jmp *%rax +..1.1_0.TAG.12.0.1: +..1.1_0.TAG.9.0.1: +..1.1_0.TAG.11.0.1: +..1.1_0.TAG.8.0.1: +..B1.59: + xorl %esi, %esi + lea 32(%rdi), %rcx + jmp ..B1.70 +..1.1_0.TAG.171.0.1: +..1.1_0.TAG.170.0.1: +..1.1_0.TAG.145.0.1: +..1.1_0.TAG.144.0.1: +..1.1_0.TAG.140.0.1: +..1.1_0.TAG.139.0.1: +..1.1_0.TAG.138.0.1: +..1.1_0.TAG.136.0.1: +..1.1_0.TAG.135.0.1: +..1.1_0.TAG.133.0.1: +..1.1_0.TAG.128.0.1: +..1.1_0.TAG.127.0.1: +..1.1_0.TAG.126.0.1: +..1.1_0.TAG.125.0.1: +..1.1_0.TAG.116.0.1: +..1.1_0.TAG.115.0.1: +..1.1_0.TAG.114.0.1: +..1.1_0.TAG.112.0.1: +..1.1_0.TAG.111.0.1: +..1.1_0.TAG.104.0.1: +..1.1_0.TAG.103.0.1: +..1.1_0.TAG.102.0.1: +..1.1_0.TAG.101.0.1: +..1.1_0.TAG.100.0.1: +..1.1_0.TAG.99.0.1: +..1.1_0.TAG.98.0.1: +..1.1_0.TAG.97.0.1: +..1.1_0.TAG.79.0.1: +..1.1_0.TAG.76.0.1: +..1.1_0.TAG.67.0.1: +..1.1_0.TAG.64.0.1: +..1.1_0.TAG.62.0.1: +..1.1_0.TAG.61.0.1: +..1.1_0.TAG.59.0.1: +..1.1_0.TAG.58.0.1: +..1.1_0.TAG.56.0.1: +..1.1_0.TAG.55.0.1: +..1.1_0.TAG.34.0.1: +..1.1_0.TAG.33.0.1: +..1.1_0.TAG.32.0.1: +..1.1_0.TAG.31.0.1: +..1.1_0.TAG.30.0.1: +..1.1_0.TAG.29.0.1: +..1.1_0.TAG.28.0.1: +..1.1_0.TAG.26.0.1: +..1.1_0.TAG.25.0.1: +..1.1_0.TAG.24.0.1: +..1.1_0.TAG.23.0.1: +..1.1_0.TAG.22.0.1: +..1.1_0.TAG.19.0.1: +..1.1_0.TAG.18.0.1: +..1.1_0.TAG.13.0.1: +..1.1_0.TAG.10.0.1: +..1.1_0.TAG.7.0.1: +..1.1_0.TAG.6.0.1: +..1.1_0.TAG.4.0.1: +..1.1_0.TAG.3.0.1: +..1.1_0.TAG.2.0.1: +..1.1_0.SWBASE.0.1: +..1.1_0.TAG.0.0.1: +..B1.69: + cmpl $4, %esi + ja ..B1.81 +..B1.70: + lea .2.9_2.switchtab.2(%rip), %rdx + movzbl (%rdx,%rsi), %edx + lea ..1.1_1.TAG.4.0.1(%rip), %rax + addq %rdx, %rax + jmp *%rax +..1.1_1.TAG.4.0.1: +..B1.72: + movl $8388608, -16(%rsp) + movss -16(%rsp), %xmm0 + cvtss2sd %xmm0, %xmm0 + mulsd .L_2il0floatpacket.2(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + jmp ..B1.81 +..1.1_1.TAG.3.0.1: +..B1.74: + movl $2130706432, -20(%rsp) + movss -20(%rsp), %xmm1 + movss -20(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss %xmm1, -20(%rsp) + jmp ..B1.81 +..1.1_1.TAG.2.0.1: +..B1.76: + movl $0, -8(%rsp) +..B1.77: + movss -8(%rsp), %xmm0 + cvtss2sd %xmm0, %xmm0 + movsd .L_2il0floatpacket.3(%rip), %xmm1 + divsd %xmm0, %xmm1 + cvtsd2ss %xmm1, %xmm1 + movss %xmm1, -8(%rsp) + jmp ..B1.81 +..1.1_1.TAG.1.0.1: +..B1.79: + movl $2139095040, -24(%rsp) + movss -24(%rsp), %xmm1 + movss -24(%rsp), %xmm0 + subss %xmm0, %xmm1 + movss %xmm1, -24(%rsp) +..1.1_1.TAG.0.0.1: +..B1.81: + movq %rcx, %rax + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_exception,@function + .size __dpml_exception,.-__dpml_exception + .section .rodata, "a" + .align 8 + .align 1 +.2.9_2.switchtab.1: + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.12.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .byte ..1.1_0.TAG.171.0.1 - ..1.1_0.TAG.12.0.1 + .align 1 +.2.9_2.switchtab.2: + .byte ..1.1_1.TAG.0.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.1.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.2.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.3.0.1 - ..1.1_1.TAG.4.0.1 + .byte ..1.1_1.TAG.4.0.1 - ..1.1_1.TAG.4.0.1 + .data +# -- End __dpml_exception + .text +# -- Begin __dpml_intel_atan_fixup + .text + .align 16,0x90 + .globl __dpml_intel_atan_fixup +__dpml_intel_atan_fixup: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B2.1: + .cfi_startproc +..___tag_value___dpml_intel_atan_fixup.4: +..L5: + + movq %rcx, %r9 + movq %rdx, %rcx + movq %rdi, %rdx + btrq $63, %rdx + movl $4, %r10d + movq %rdx, %rax + movq %rdx, %r11 + sarq $4, %r11 + andq $15, %rax + testq %r9, %r9 + cmovne %r11, %rdx + cmove %r10, %rax + xorb %dil, %dil + lea (%rdx,%rdx,4), %r9 + lea -22(%rax,%r9,2), %rax + cmpq $77, %rax + ja ..B2.56 +..B2.2: + movl %eax, %eax + lea .2.10_2.switchtab.4(%rip), %rdx + movzwl (%rdx,%rax,2), %edx + lea ..1.2_0.TAG.77.0.2(%rip), %rax + addq %rdx, %rax + jmp *%rax +..1.2_0.TAG.77.0.2: +..B2.4: + movl $5, %eax + movl $11, %r8d + movb $3, %dil + testq %rcx, %rcx + cmovne %rax, %r8 + jne ..B2.51 + jmp ..B2.52 +..1.2_0.TAG.76.0.2: +..B2.6: + movq __x_constants__@GOTPCREL(%rip), %r8 + movq 8(%r8), %rax + jmp ..B2.54 +..1.2_0.TAG.75.0.2: +..1.2_0.TAG.73.0.2: +..1.2_0.TAG.71.0.2: +..1.2_0.TAG.65.0.2: +..1.2_0.TAG.63.0.2: +..1.2_0.TAG.61.0.2: +..1.2_0.TAG.57.0.2: +..1.2_0.TAG.56.0.2: +..1.2_0.TAG.51.0.2: +..1.2_0.TAG.47.0.2: +..1.2_0.TAG.46.0.2: +..1.2_0.TAG.41.0.2: +..1.2_0.TAG.37.0.2: +..1.2_0.TAG.36.0.2: +..1.2_0.TAG.31.0.2: +..1.2_0.TAG.27.0.2: +..1.2_0.TAG.26.0.2: +..1.2_0.TAG.21.0.2: +..1.2_0.TAG.17.0.2: +..1.2_0.TAG.16.0.2: +..1.2_0.TAG.15.0.2: +..1.2_0.TAG.14.0.2: +..1.2_0.TAG.13.0.2: +..1.2_0.TAG.12.0.2: +..1.2_0.TAG.7.0.2: +..1.2_0.TAG.6.0.2: +..1.2_0.TAG.5.0.2: +..1.2_0.TAG.4.0.2: +..1.2_0.TAG.3.0.2: +..1.2_0.TAG.2.0.2: +..B2.7: + testq %rcx, %rcx + jne ..B2.51 + jmp ..B2.52 +..1.2_0.TAG.67.0.2: +..B2.11: + movl $5, %eax + movl $11, %r8d + movb $2, %dil + testq %rcx, %rcx + cmovne %rax, %r8 + jne ..B2.51 + jmp ..B2.52 +..1.2_0.TAG.66.0.2: +..B2.13: + movq __x_constants__@GOTPCREL(%rip), %r8 + movq 8(%r8), %rax + jmp ..B2.55 +..1.2_0.TAG.11.0.2: +..B2.36: + movl $6, %eax + movl $10, %r8d + movb $3, %dil + testq %rcx, %rcx + cmovne %rax, %r8 + jne ..B2.51 + jmp ..B2.52 +..1.2_0.TAG.10.0.2: +..B2.38: + movl $8, %r8d + movb $3, %dil + testq %rcx, %rcx + cmovne %r10, %r8 + jne ..B2.51 + jmp ..B2.52 +..1.2_0.TAG.1.0.2: +..B2.47: + movl $6, %eax + movl $10, %r8d + movb $2, %dil + testq %rcx, %rcx + cmovne %rax, %r8 + jne ..B2.51 + jmp ..B2.52 +..1.2_0.TAG.0.0.2: +..B2.49: + movl $8, %r8d + movb $2, %dil + testq %rcx, %rcx + cmovne %r10, %r8 +..B2.50: + je ..B2.52 +..B2.51: + movl $1182793727, -8(%rsp) + movss -8(%rsp), %xmm1 + movss -8(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss %xmm1, -8(%rsp) +..B2.52: + testb %dil, %dil + je ..B2.56 +..B2.53: + shlq $4, %r8 + movq __x_constants__@GOTPCREL(%rip), %rax + addq %rax, %r8 + cmpb $3, %dil + movq 8(%r8), %rax + jne ..B2.55 +..B2.54: + btcq $63, %rax +..B2.55: + movq %rax, 8(%rsi) + movq (%r8), %rax + movq %rax, (%rsi) + ret +..1.2_0.SWBASE.0.2: +..B2.56: + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_intel_atan_fixup,@function + .size __dpml_intel_atan_fixup,.-__dpml_intel_atan_fixup + .section .rodata, "a" + .space 1, 0x00 # pad + .align 2 +.2.10_2.switchtab.4: + .word ..1.2_0.TAG.0.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.1.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.10.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.11.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.66.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.67.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.SWBASE.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.75.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.76.0.2 - ..1.2_0.TAG.77.0.2 + .word ..1.2_0.TAG.77.0.2 - ..1.2_0.TAG.77.0.2 + .data +# -- End __dpml_intel_atan_fixup + .text +# -- Begin __dpml_intel_pow_fixup + .text + .align 16,0x90 + .globl __dpml_intel_pow_fixup +__dpml_intel_pow_fixup: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +# parameter 7: 96 + %rsp +..B3.1: + .cfi_startproc +..___tag_value___dpml_intel_pow_fixup.7: +..L8: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $48, %rsp + .cfi_def_cfa_offset 96 + movq %rdi, %r12 + movq %rcx, %r11 + movq %r12, %rcx + sarq $4, %rcx + movq %r12, %r10 + andq $15, %rcx + andq $15, %r10 + movq %r9, %rbx + movq %rsi, %rbp + testq %r12, %r12 + lea (%rcx,%rcx,4), %rcx + lea (%r10,%rcx,2), %r9 + jl ..B3.20 +..B3.2: + movq $0x8000000000000000, %r14 + movl $1, %r15d + xorl %ecx, %ecx + cmpq 8(%r11), %r14 + cmove %r15d, %ecx + xorl %eax, %eax + cmpq $0, 16(%r11) + cmove %r15d, %eax + andl %eax, %ecx + cmpq $94, %r9 + je ..B3.19 +..B3.3: + lea -42(%r9), %rax + cmpq $1, %rax + jbe ..B3.13 +..B3.4: + lea -52(%r9), %rax + cmpq $1, %rax + jbe ..B3.13 +..B3.5: + lea -34(%r9), %rcx + cmpq $1, %rcx + ja ..B3.7 +..B3.6: + xorl %ebx, %ebx + cmpq $5, %r10 + movq $0x7fff000000000000, %rdi + movq __x_constants__@GOTPCREL(%rip), %rdx + cmove %rbx, %rdi + movq 96(%rsp), %r10 + cmpq $3, %r10 + cmove %r14, %rbx + orq %r14, %r12 + movq (%rdx), %rcx + xorq %rbx, %rdi + movq %rcx, (%rbp) + movq %rdi, 8(%rbp) + jmp ..B3.16 +..B3.7: + cmpq $44, %r9 + jne ..B3.16 +..B3.8: + movq __x_constants__@GOTPCREL(%rip), %r9 + movq 8(%r8), %rcx + cmpq 24(%r9), %rcx + jne ..B3.16 +..B3.9: + movq (%r8), %rcx + cmpq 16(%r9), %rcx + jne ..B3.16 +..B3.10: + movq %r11, %rdi + movl $7, %esi + movq %rbx, %rdx +..___tag_value___dpml_intel_pow_fixup.20: + call __dpml_ux_sqrt_evaluation__@PLT +..___tag_value___dpml_intel_pow_fixup.21: +..B3.11: + xorl %r9d, %r9d + testq %rax, %rax + movq %rbx, %rdi + cmove %r15d, %r9d + xorl %edx, %edx + movq %rbp, %rsi + xorl %ecx, %ecx + lea (%rsp), %r8 + movq %r9, 8(%r8) +..___tag_value___dpml_intel_pow_fixup.22: + call __dpml_pack__@PLT +..___tag_value___dpml_intel_pow_fixup.23: + jmp ..B3.15 +..B3.13: + movq __x_constants__@GOTPCREL(%rip), %rdx + movq 32(%rdx), %rbx + movq 40(%rdx), %r8 + movl 4(%r11), %edx + cmpl $1, %edx + movq %rbx, (%rbp) + je ..B3.17 +..B3.14: + testl %edx, %edx + movl $0, %edx + movq $0x7fff000000000000, %rcx + cmovle %r15d, %edx + xorl %ebx, %ebx + cmpq $2, %r10 + movl $0, %r10d + cmove %r15d, %r10d + cmpl %edx, %r10d + cmovne %rcx, %rbx + movq %rbx, 8(%rbp) +..B3.15: + orq %r14, %r12 +..B3.16: + movq %r12, %rax + addq $48, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B3.17: + testl %ecx, %ecx + je ..B3.14 +..B3.18: + movq %r8, 8(%rbp) + jmp ..B3.15 +..B3.19: + movq 96(%rsp), %rcx + xorl %ebx, %ebx + cmpq $3, %rcx + cmove %r14, %rbx + orq %r14, %r12 + movq %rbx, 8(%rbp) + movq (%rdx), %rdx + movq %rdx, (%rbp) + jmp ..B3.16 +..B3.20: + cmpq $95, %r9 + je ..B3.32 +..B3.21: + lea -40(%r9), %rcx + cmpq $1, %rcx + jbe ..B3.29 +..B3.22: + lea -80(%r9), %rcx + cmpq $1, %rcx + jbe ..B3.28 +..B3.23: + lea -90(%r9), %rcx + cmpq $1, %rcx + jbe ..B3.28 +..B3.24: + addq $-46, %r9 + cmpq $1, %r9 + ja ..B3.16 +..B3.25: + movq __x_constants__@GOTPCREL(%rip), %rbx + movq 8(%rdx), %rcx + cmpq 40(%rbx), %rcx + jne ..B3.27 +..B3.26: + movq (%rdx), %rdx + cmpq 32(%rbx), %rdx + je ..B3.16 +..B3.27: + movl $1182793727, 40(%rsp) + movss 40(%rsp), %xmm1 + movss 40(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss %xmm1, 40(%rsp) + jmp ..B3.16 +..B3.28: + movq 8(%r8), %rdx + btsq $47, %rdx + movq %rdx, 8(%rbp) + movq (%r8), %rcx + movq %rcx, (%rbp) + jmp ..B3.16 +..B3.29: + movq __x_constants__@GOTPCREL(%rip), %rcx + movq 40(%rcx), %rbx + cmpq 8(%rdx), %rbx + jne ..B3.28 +..B3.30: + movq 32(%rcx), %rcx + cmpq (%rdx), %rcx + jne ..B3.28 +..B3.31: + movq %rbx, 8(%rbp) + movq %rcx, (%rbp) + jmp ..B3.16 +..B3.32: + movq 96(%rsp), %rdx + testq %rdx, %rdx + je ..B3.16 +..B3.33: + movq 96(%rsp), %rdx + testq $2, %rdx + je ..B3.16 +..B3.34: + movq 8(%rbp), %rdx + btcq $63, %rdx + movq %rdx, 8(%rbp) + jmp ..B3.16 + .align 16,0x90 + .cfi_endproc + .type __dpml_intel_pow_fixup,@function + .size __dpml_intel_pow_fixup,.-__dpml_intel_pow_fixup + .data +# -- End __dpml_intel_pow_fixup + .text +# -- Begin __dpml_d_intel_order_fixup + .text + .align 16,0x90 + .globl __dpml_d_intel_order_fixup +__dpml_d_intel_order_fixup: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value___dpml_d_intel_order_fixup.42: +..L43: + + ret + .align 16,0x90 + .cfi_endproc + .type __dpml_d_intel_order_fixup,@function + .size __dpml_d_intel_order_fixup,.-__dpml_d_intel_order_fixup + .data +# -- End __dpml_d_intel_order_fixup + .section .rodata, "a" + .space 2, 0x00 # pad + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3e600000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 4 +__dpml_response_table: + .long 0 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 1 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 2 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 3 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 3 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 4 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 4 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 6 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 7 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 8 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 8 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 8 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 9 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 9 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 9 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 10 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 10 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 10 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 11 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 11 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 39 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 39 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 12 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 13 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 14 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 33 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 33 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 33 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 33 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 33 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 33 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 34 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 34 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 34 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 34 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 34 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 34 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 34 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 34 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 16 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 16 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 16 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 16 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 17 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 17 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 17 + .byte 0 + .byte 12 + .byte 0 + .byte 12 + .long 38 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 38 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 38 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 47 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 47 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 47 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 47 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 47 + .byte 0 + .byte 8 + .byte 0 + .byte 8 + .long 47 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 47 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 47 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 37 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 18 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 18 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 18 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 19 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 19 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 19 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 20 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 20 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 20 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 45 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 45 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 21 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 21 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 21 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 40 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 40 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 40 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 40 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 22 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 22 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 22 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 22 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 22 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 22 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 22 + .byte 0 + .byte 11 + .byte 0 + .byte 11 + .long 22 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 22 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 22 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 22 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 22 + .byte 0 + .byte 8 + .byte 0 + .byte 8 + .long 22 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 22 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 22 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 41 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 41 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 41 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 41 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 41 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 41 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 41 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 48 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 48 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 23 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 23 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 23 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 24 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 31 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 32 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 32 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 25 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 25 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 26 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 26 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 26 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 27 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 63 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 63 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 28 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 29 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 29 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 29 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 29 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 29 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 30 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 30 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 35 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 36 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 36 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 49 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 50 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 51 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 50 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 50 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 51 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 51 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 42 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 43 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 44 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 42 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 42 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 43 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 43 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 43 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 44 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 44 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 44 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 44 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 46 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 46 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 46 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 46 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 46 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 53 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 78 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .long 64 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 64 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 64 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 64 + .byte 0 + .byte 1 + .byte 0 + .byte 1 + .long 66 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 66 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 66 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 67 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 67 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 67 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 65 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 65 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 65 + .byte 0 + .byte 7 + .byte 0 + .byte 7 + .long 65 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 65 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 65 + .byte 2 + .byte 6 + .byte 2 + .byte 8 + .long 65 + .byte 2 + .byte 5 + .byte 2 + .byte 7 + .long 68 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 69 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 70 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 71 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 72 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 72 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 72 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 73 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 73 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 73 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 73 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 74 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 74 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 77 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 77 + .byte 4 + .byte 2 + .byte 4 + .byte 2 + .long 77 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .long 77 + .byte 3 + .byte 6 + .byte 3 + .byte 8 + .long 77 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 77 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .long 79 + .byte 4 + .byte 1 + .byte 4 + .byte 1 + .long 79 + .byte 3 + .byte 5 + .byte 3 + .byte 7 + .type __dpml_response_table,@object + .size __dpml_response_table,1520 + .align 4 + .globl __dpml_globals_table +__dpml_globals_table: + .long 4290772992 + .long 0 + .long 0 + .long 4294443008 + .long 0 + .long 0 + .long 0 + .long 4294934528 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 2147483648 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1 + .long 0 + .long 1 + .long 0 + .long 1 + .long 0 + .long 0 + .long 0 + .long 2147483649 + .long 0 + .long 1 + .long 2147483648 + .long 1 + .long 0 + .long 0 + .long 2147483648 + .long 2139095039 + .long 0 + .long 4294967295 + .long 2146435071 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 2147418111 + .long 4286578687 + .long 0 + .long 4294967295 + .long 4293918719 + .long 4294967295 + .long 4294967295 + .long 4294967295 + .long 4294901759 + .long 2139095040 + .long 0 + .long 0 + .long 2146435072 + .long 0 + .long 0 + .long 0 + .long 2147418112 + .long 4286578688 + .long 0 + .long 0 + .long 4293918720 + .long 0 + .long 0 + .long 0 + .long 4294901760 + .long 872415232 + .long 0 + .long 0 + .long 1018167296 + .long 0 + .long 0 + .long 0 + .long 1066336256 + .long 3019898880 + .long 0 + .long 0 + .long 3165650944 + .long 0 + .long 0 + .long 0 + .long 3213819904 + .long 1065353216 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 1073676288 + .long 3212836864 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 3221159936 + .type __dpml_globals_table,@object + .size __dpml_globals_table,416 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/isfinite.S b/external/sgx_libm/intel64/isfinite.S new file mode 100644 index 0000000000..c1b5e34cac --- /dev/null +++ b/external/sgx_libm/intel64/isfinite.S @@ -0,0 +1,449 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isfinite.c" + .text +..TXTST0: +# -- Begin isfinitel + .text + .align 16,0x90 + .globl isfinitel +isfinitel: +# parameter 1: 8 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_isfinitel.1: +..L2: + + xorl %eax, %eax + movzwl 16(%rsp), %ecx + shll $16, %ecx + movzwl 14(%rsp), %edx + orl %edx, %ecx + andl $2147483647, %ecx + cmpl $2147418112, %ecx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isfinitel,@function + .size isfinitel,.-isfinitel + .data +# -- End isfinitel + .text +# -- Begin __isfinitel + .text + .align 16,0x90 + .globl __isfinitel +__isfinitel: +# parameter 1: 8 + %rsp +..B2.1: + .cfi_startproc +..___tag_value___isfinitel.4: +..L5: + + xorl %eax, %eax + movzwl 16(%rsp), %ecx + shll $16, %ecx + movzwl 14(%rsp), %edx + orl %edx, %ecx + andl $2147483647, %ecx + cmpl $2147418112, %ecx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isfinitel,@function + .size __isfinitel,.-__isfinitel + .data +# -- End __isfinitel + .text +# -- Begin isfinitef + .text + .align 16,0x90 + .globl isfinitef +isfinitef: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value_isfinitef.7: +..L8: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isfinitef,@function + .size isfinitef,.-isfinitef + .data +# -- End isfinitef + .text +# -- Begin __isfinitef + .text + .align 16,0x90 + .globl __isfinitef +__isfinitef: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value___isfinitef.10: +..L11: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isfinitef,@function + .size __isfinitef,.-__isfinitef + .data +# -- End __isfinitef + .text +# -- Begin isfinite + .text + .align 16,0x90 + .globl isfinite +isfinite: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value_isfinite.13: +..L14: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isfinite,@function + .size isfinite,.-isfinite + .data +# -- End isfinite + .text +# -- Begin __isfinite + .text + .align 16,0x90 + .globl __isfinite +__isfinite: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value___isfinite.16: +..L17: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isfinite,@function + .size __isfinite,.-__isfinite + .data +# -- End __isfinite + .text +# -- Begin isfinited + .text + .align 16,0x90 + .globl isfinited +isfinited: +# parameter 1: %xmm0 +..B7.1: + .cfi_startproc +..___tag_value_isfinited.19: +..L20: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isfinited,@function + .size isfinited,.-isfinited + .data +# -- End isfinited + .text +# -- Begin __isfinited + .text + .align 16,0x90 + .globl __isfinited +__isfinited: +# parameter 1: %xmm0 +..B8.1: + .cfi_startproc +..___tag_value___isfinited.22: +..L23: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isfinited,@function + .size __isfinited,.-__isfinited + .data +# -- End __isfinited + .text +# -- Begin finitel + .text + .align 16,0x90 + .globl finitel +finitel: +# parameter 1: 8 + %rsp +..B9.1: + .cfi_startproc +..___tag_value_finitel.25: +..L26: + + xorl %eax, %eax + movzwl 16(%rsp), %ecx + shll $16, %ecx + movzwl 14(%rsp), %edx + orl %edx, %ecx + andl $2147483647, %ecx + cmpl $2147418112, %ecx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type finitel,@function + .size finitel,.-finitel + .data +# -- End finitel + .text +# -- Begin __finitel + .text + .align 16,0x90 + .globl __finitel +__finitel: +# parameter 1: 8 + %rsp +..B10.1: + .cfi_startproc +..___tag_value___finitel.28: +..L29: + + xorl %eax, %eax + movzwl 16(%rsp), %ecx + shll $16, %ecx + movzwl 14(%rsp), %edx + orl %edx, %ecx + andl $2147483647, %ecx + cmpl $2147418112, %ecx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __finitel,@function + .size __finitel,.-__finitel + .data +# -- End __finitel + .text +# -- Begin finitef + .text + .align 16,0x90 + .globl finitef +finitef: +# parameter 1: %xmm0 +..B11.1: + .cfi_startproc +..___tag_value_finitef.31: +..L32: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type finitef,@function + .size finitef,.-finitef + .data +# -- End finitef + .text +# -- Begin __finitef + .text + .align 16,0x90 + .globl __finitef +__finitef: +# parameter 1: %xmm0 +..B12.1: + .cfi_startproc +..___tag_value___finitef.34: +..L35: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __finitef,@function + .size __finitef,.-__finitef + .data +# -- End __finitef + .text +# -- Begin finite + .text + .align 16,0x90 + .globl finite +finite: +# parameter 1: %xmm0 +..B13.1: + .cfi_startproc +..___tag_value_finite.37: +..L38: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type finite,@function + .size finite,.-finite + .data +# -- End finite + .text +# -- Begin __finite + .text + .align 16,0x90 + .globl __finite +__finite: +# parameter 1: %xmm0 +..B14.1: + .cfi_startproc +..___tag_value___finite.40: +..L41: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __finite,@function + .size __finite,.-__finite + .data +# -- End __finite + .text +# -- Begin finited + .text + .align 16,0x90 + .globl finited +finited: +# parameter 1: %xmm0 +..B15.1: + .cfi_startproc +..___tag_value_finited.43: +..L44: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type finited,@function + .size finited,.-finited + .data +# -- End finited + .text +# -- Begin __finited + .text + .align 16,0x90 + .globl __finited +__finited: +# parameter 1: %xmm0 +..B16.1: + .cfi_startproc +..___tag_value___finited.46: +..L47: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __finited,@function + .size __finited,.-__finited + .data +# -- End __finited + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/isinf.S b/external/sgx_libm/intel64/isinf.S new file mode 100644 index 0000000000..f2a6d0c7a4 --- /dev/null +++ b/external/sgx_libm/intel64/isinf.S @@ -0,0 +1,309 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isinf.c" + .text +..TXTST0: +# -- Begin __isinfd + .text + .align 16,0x90 + .globl __isinfd +__isinfd: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___isinfd.1: +..L2: + + movq $0x7ff0000000000000, %rax + movd %xmm0, %rcx + cmpq %rax, %rcx + jne ..B1.3 +..B1.2: + movl $1, %eax + ret +..B1.3: + movq $0xfff0000000000000, %rdx + movl $-1, %esi + xorl %eax, %eax + cmpq %rcx, %rdx + cmove %esi, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __isinfd,@function + .size __isinfd,.-__isinfd + .data +# -- End __isinfd + .text +# -- Begin isinfd + .text + .align 16,0x90 + .globl isinfd +isinfd: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_isinfd.4: +..L5: + + movq $0x7ff0000000000000, %rax + movd %xmm0, %rcx + cmpq %rax, %rcx + jne ..B2.3 +..B2.2: + movl $1, %eax + ret +..B2.3: + movq $0xfff0000000000000, %rdx + movl $-1, %esi + xorl %eax, %eax + cmpq %rcx, %rdx + cmove %esi, %eax + ret + .align 16,0x90 + .cfi_endproc + .type isinfd,@function + .size isinfd,.-isinfd + .data +# -- End isinfd + .text +# -- Begin __isinf + .text + .align 16,0x90 + .globl __isinf +__isinf: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___isinf.7: +..L8: + + movq $0x7ff0000000000000, %rax + movd %xmm0, %rcx + cmpq %rax, %rcx + jne ..B3.3 +..B3.2: + movl $1, %eax + ret +..B3.3: + movq $0xfff0000000000000, %rdx + movl $-1, %esi + xorl %eax, %eax + cmpq %rcx, %rdx + cmove %esi, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __isinf,@function + .size __isinf,.-__isinf + .data +# -- End __isinf + .text +# -- Begin isinf + .text + .align 16,0x90 + .globl isinf +isinf: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value_isinf.10: +..L11: + + movq $0x7ff0000000000000, %rax + movd %xmm0, %rcx + cmpq %rax, %rcx + jne ..B4.3 +..B4.2: + movl $1, %eax + ret +..B4.3: + movq $0xfff0000000000000, %rdx + movl $-1, %esi + xorl %eax, %eax + cmpq %rcx, %rdx + cmove %esi, %eax + ret + .align 16,0x90 + .cfi_endproc + .type isinf,@function + .size isinf,.-isinf + .data +# -- End isinf + .text +# -- Begin __isinff + .text + .align 16,0x90 + .globl __isinff +__isinff: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___isinff.13: +..L14: + + movd %xmm0, %edx + cmpl $2139095040, %edx + jne ..B5.3 +..B5.2: + movl $1, %eax + ret +..B5.3: + movl $-1, %ecx + xorl %eax, %eax + cmpl $-8388608, %edx + cmove %ecx, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __isinff,@function + .size __isinff,.-__isinff + .data +# -- End __isinff + .text +# -- Begin isinff + .text + .align 16,0x90 + .globl isinff +isinff: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value_isinff.16: +..L17: + + movd %xmm0, %edx + cmpl $2139095040, %edx + jne ..B6.3 +..B6.2: + movl $1, %eax + ret +..B6.3: + movl $-1, %ecx + xorl %eax, %eax + cmpl $-8388608, %edx + cmove %ecx, %eax + ret + .align 16,0x90 + .cfi_endproc + .type isinff,@function + .size isinff,.-isinff + .data +# -- End isinff + .text +# -- Begin __isinfl + .text + .align 16,0x90 + .globl __isinfl +__isinfl: +# parameter 1: 8 + %rsp +..B7.1: + .cfi_startproc +..___tag_value___isinfl.19: +..L20: + + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B7.5 +..B7.2: + cmpl $-2147483648, 12(%rsp) + jne ..B7.5 +..B7.3: + cmpl $0, 8(%rsp) + jne ..B7.5 +..B7.4: + movzbl 17(%rsp), %eax + notl %eax + andl $128, %eax + shrl $6, %eax + decl %eax + ret +..B7.5: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __isinfl,@function + .size __isinfl,.-__isinfl + .data +# -- End __isinfl + .text +# -- Begin isinfl + .text + .align 16,0x90 + .globl isinfl +isinfl: +# parameter 1: 8 + %rsp +..B8.1: + .cfi_startproc +..___tag_value_isinfl.22: +..L23: + + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B8.5 +..B8.2: + cmpl $-2147483648, 12(%rsp) + jne ..B8.5 +..B8.3: + cmpl $0, 8(%rsp) + jne ..B8.5 +..B8.4: + movzbl 17(%rsp), %eax + notl %eax + andl $128, %eax + shrl $6, %eax + decl %eax + ret +..B8.5: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type isinfl,@function + .size isinfl,.-isinfl + .data +# -- End isinfl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/isnan.S b/external/sgx_libm/intel64/isnan.S new file mode 100644 index 0000000000..31d0f2eda5 --- /dev/null +++ b/external/sgx_libm/intel64/isnan.S @@ -0,0 +1,259 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isnan.c" + .text +..TXTST0: +# -- Begin __isnand + .text + .align 16,0x90 + .globl __isnand +__isnand: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___isnand.1: +..L2: + + movq $0x7ff0000000000000, %rdx + movd %xmm0, %rcx + xorl %eax, %eax + btrq $63, %rcx + cmpq %rcx, %rdx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnand,@function + .size __isnand,.-__isnand + .data +# -- End __isnand + .text +# -- Begin isnand + .text + .align 16,0x90 + .globl isnand +isnand: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_isnand.4: +..L5: + + movq $0x7ff0000000000000, %rdx + movd %xmm0, %rcx + xorl %eax, %eax + btrq $63, %rcx + cmpq %rcx, %rdx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isnand,@function + .size isnand,.-isnand + .data +# -- End isnand + .text +# -- Begin __isnan + .text + .align 16,0x90 + .globl __isnan +__isnan: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___isnan.7: +..L8: + + movq $0x7ff0000000000000, %rdx + movd %xmm0, %rcx + xorl %eax, %eax + btrq $63, %rcx + cmpq %rcx, %rdx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnan,@function + .size __isnan,.-__isnan + .data +# -- End __isnan + .text +# -- Begin isnan + .text + .align 16,0x90 + .globl isnan +isnan: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value_isnan.10: +..L11: + + movq $0x7ff0000000000000, %rdx + movd %xmm0, %rcx + xorl %eax, %eax + btrq $63, %rcx + cmpq %rcx, %rdx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isnan,@function + .size isnan,.-isnan + .data +# -- End isnan + .text +# -- Begin __isnanf + .text + .align 16,0x90 + .globl __isnanf +__isnanf: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___isnanf.13: +..L14: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + seta %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnanf,@function + .size __isnanf,.-__isnanf + .data +# -- End __isnanf + .text +# -- Begin isnanf + .text + .align 16,0x90 + .globl isnanf +isnanf: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value_isnanf.16: +..L17: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + seta %al + ret + .align 16,0x90 + .cfi_endproc + .type isnanf,@function + .size isnanf,.-isnanf + .data +# -- End isnanf + .text +# -- Begin __isnanl + .text + .align 16,0x90 + .globl __isnanl +__isnanl: +# parameter 1: 8 + %rsp +..B7.1: + .cfi_startproc +..___tag_value___isnanl.19: +..L20: + + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B7.4 +..B7.2: + xorl %eax, %eax +..B7.3: + ret +..B7.4: + movq $0x8000000000000000, %rdx + movl $1, %ecx + xorl %eax, %eax + cmpq 8(%rsp), %rdx + cmovne %ecx, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __isnanl,@function + .size __isnanl,.-__isnanl + .data +# -- End __isnanl + .text +# -- Begin isnanl + .text + .align 16,0x90 + .globl isnanl +isnanl: +# parameter 1: 8 + %rsp +..B8.1: + .cfi_startproc +..___tag_value_isnanl.22: +..L23: + + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B8.4 +..B8.2: + xorl %eax, %eax +..B8.3: + ret +..B8.4: + movq $0x8000000000000000, %rdx + movl $1, %ecx + xorl %eax, %eax + cmpq 8(%rsp), %rdx + cmovne %ecx, %eax + ret + .align 16,0x90 + .cfi_endproc + .type isnanl,@function + .size isnanl,.-isnanl + .data +# -- End isnanl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/isnormal.S b/external/sgx_libm/intel64/isnormal.S new file mode 100644 index 0000000000..2794501d32 --- /dev/null +++ b/external/sgx_libm/intel64/isnormal.S @@ -0,0 +1,273 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "isnormal.c" + .text +..TXTST0: +# -- Begin __isnormald + .text + .align 16,0x90 + .globl __isnormald +__isnormald: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___isnormald.1: +..L2: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + addl $-1048576, %edx + cmpl $2145386496, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnormald,@function + .size __isnormald,.-__isnormald + .data +# -- End __isnormald + .text +# -- Begin isnormald + .text + .align 16,0x90 + .globl isnormald +isnormald: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_isnormald.4: +..L5: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + addl $-1048576, %edx + cmpl $2145386496, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isnormald,@function + .size isnormald,.-isnormald + .data +# -- End isnormald + .text +# -- Begin __isnormal + .text + .align 16,0x90 + .globl __isnormal +__isnormal: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___isnormal.7: +..L8: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + addl $-1048576, %edx + cmpl $2145386496, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnormal,@function + .size __isnormal,.-__isnormal + .data +# -- End __isnormal + .text +# -- Begin isnormal + .text + .align 16,0x90 + .globl isnormal +isnormal: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value_isnormal.10: +..L11: + + xorl %eax, %eax + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $2147483647, %edx + addl $-1048576, %edx + cmpl $2145386496, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isnormal,@function + .size isnormal,.-isnormal + .data +# -- End isnormal + .text +# -- Begin __isnormalf + .text + .align 16,0x90 + .globl __isnormalf +__isnormalf: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___isnormalf.13: +..L14: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + addl $-8388608, %edx + cmpl $2130706432, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnormalf,@function + .size __isnormalf,.-__isnormalf + .data +# -- End __isnormalf + .text +# -- Begin isnormalf + .text + .align 16,0x90 + .globl isnormalf +isnormalf: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value_isnormalf.16: +..L17: + + xorl %eax, %eax + movd %xmm0, %edx + andl $2147483647, %edx + addl $-8388608, %edx + cmpl $2130706432, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isnormalf,@function + .size isnormalf,.-isnormalf + .data +# -- End isnormalf + .text +# -- Begin __isnormall + .text + .align 16,0x90 + .globl __isnormall +__isnormall: +# parameter 1: 8 + %rsp +..B7.1: + .cfi_startproc +..___tag_value___isnormall.19: +..L20: + + movzwl 16(%rsp), %edx + shll $16, %edx + movzwl 14(%rsp), %eax + orl %eax, %edx + andl $2147483647, %edx + cmpl $4096, %edx + jb ..B7.4 +..B7.2: + testl $32768, %edx + jne ..B7.4 +..B7.3: + xorl %eax, %eax + ret +..B7.4: + addl $-65536, %edx + xorl %eax, %eax + cmpl $2147352576, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type __isnormall,@function + .size __isnormall,.-__isnormall + .data +# -- End __isnormall + .text +# -- Begin isnormall + .text + .align 16,0x90 + .globl isnormall +isnormall: +# parameter 1: 8 + %rsp +..B8.1: + .cfi_startproc +..___tag_value_isnormall.22: +..L23: + + movzwl 16(%rsp), %edx + shll $16, %edx + movzwl 14(%rsp), %eax + orl %eax, %edx + andl $2147483647, %edx + cmpl $4096, %edx + jb ..B8.4 +..B8.2: + testl $32768, %edx + jne ..B8.4 +..B8.3: + xorl %eax, %eax + ret +..B8.4: + addl $-65536, %edx + xorl %eax, %eax + cmpl $2147352576, %edx + setb %al + ret + .align 16,0x90 + .cfi_endproc + .type isnormall,@function + .size isnormall,.-isnormall + .data +# -- End isnormall + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/j0.S b/external/sgx_libm/intel64/j0.S new file mode 100644 index 0000000000..f8ebda2d7a --- /dev/null +++ b/external/sgx_libm/intel64/j0.S @@ -0,0 +1,2957 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j0.c" + .text +..TXTST0: +# -- Begin j0 + .text + .align 16,0x90 + .globl j0 +j0: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_j0.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + subq $32, %rsp + .cfi_def_cfa_offset 48 + xorb %bl, %bl + movsd %xmm0, 8(%rsp) +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movl 12(%rsp), %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + jge ..B1.14 +..B1.4: + cmpl $1012924416, %eax + jl ..B1.13 +..B1.5: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.7: + fldcw 16(%rsp) +..B1.8: + movb $1, %bl +..B1.9: + addq $-16, %rsp + .cfi_def_cfa_offset 64 + movsd 24(%rsp), %xmm0 + andps .L_2il0floatpacket.0(%rip), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) +..___tag_value_j0.7: + call __j0l@PLT +..___tag_value_j0.8: +..B1.20: + addq $16, %rsp + .cfi_def_cfa_offset 48 +..B1.10: + fstpl (%rsp) + testb %bl, %bl + movsd (%rsp), %xmm0 + je ..B1.12 +..B1.11: + fldcw 18(%rsp) +..B1.12: + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 3, -16 +..B1.13: + lea _ones(%rip), %rax + movsd 8(%rsp), %xmm1 + andps .L_2il0floatpacket.0(%rip), %xmm1 + movsd (%rax), %xmm0 + subsd %xmm1, %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 3, -16 +..B1.14: + andl $-2146435073, %eax + orl 8(%rsp), %eax + je ..B1.16 +..B1.15: + lea _ones(%rip), %rax + movsd (%rax), %xmm0 + mulsd 8(%rsp), %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 3, -16 +..B1.16: + lea _zeros(%rip), %rax + movsd (%rax), %xmm0 +..B1.17: + addq $32, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type j0,@function + .size j0,.-j0 + .data +# -- End j0 + .text +# -- Begin __j0l + .text + .align 16,0x90 + .globl __j0l +__j0l: +# parameter 1: 96 + %rsp +..B2.1: + .cfi_startproc +..___tag_value___j0l.29: +..L30: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + lea 176+_S(%rip), %rax + fldt 96(%rsp) + fldt (%rax) + fcomip %st(1), %st + jb ..B2.9 +..B2.2: + lea _S(%rip), %rcx + fldt (%rcx) + fcomip %st(1), %st + jbe ..B2.4 +..B2.3: + lea _Z(%rip), %rax + lea _P1(%rip), %rdx + lea 16+_P1(%rip), %rcx + lea 32+_P1(%rip), %rsi + lea 48+_P1(%rip), %rdi + lea 64+_P1(%rip), %r8 + lea 80+_P1(%rip), %r9 + lea 96+_P1(%rip), %r10 + fldt (%rax) + lea 112+_P1(%rip), %r11 + lea 128+_P1(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 144+_P1(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 160+_P1(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 176+_P1(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 192+_P1(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 208+_P1(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 224+_P1(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 240+_P1(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 256+_P1(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 272+_P1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 288+_P1(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 304+_P1(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 320+_P1(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rcx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(1) + faddp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.4: + movl $1, %edx + movl $16, %eax +..B2.5: + fldt (%rax,%rcx) + fcomip %st(1), %st + ja ..B2.8 + jp ..B2.8 +..B2.6: + incq %rdx + addq $16, %rax + cmpq $11, %rdx + jl ..B2.5 +..B2.7: + movq %rdx, %rax + shlq $4, %rax +..B2.8: + lea _Z(%rip), %rcx + fldt (%rax,%rcx) + lea (%rdx,%rdx,4), %rax + shlq $6, %rax + fsubrp %st, %st(1) + fld %st(0) + lea _P(%rip), %rdx + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt -320(%rax,%rdx) + fmul %st(1), %st + fldt -304(%rax,%rdx) + fmul %st(2), %st + fldt -288(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -272(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -256(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -240(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -224(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -208(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -192(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -176(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -160(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -144(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -128(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -112(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -96(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -80(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -64(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -48(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -32(%rax,%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -16(%rax,%rdx) + faddp %st, %st(1) + faddp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.9: + lea _ones(%rip), %rax + lea _val_36_0L(%rip), %rdx + lea _PP(%rip), %rcx + lea _QP(%rip), %rsi + lea 16+_PP(%rip), %rdi + lea 16+_QP(%rip), %r8 + lea 32+_PP(%rip), %r9 + lea 32+_QP(%rip), %r10 + fldl (%rax) + lea 48+_PP(%rip), %r11 + fdiv %st(1), %st + lea 48+_QP(%rip), %rax + fxch %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rdx) + lea 64+_PP(%rip), %rdx + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + fxch %st(2) + fstpt (%rsp) + fldt (%rcx) + lea 64+_QP(%rip), %rcx + fmul %st(1), %st + fldt (%rsi) + lea 80+_PP(%rip), %rsi + fmul %st(2), %st + fldt (%rdi) + lea 80+_QP(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 96+_PP(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 96+_QP(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 112+_PP(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 112+_QP(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_PP(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 128+_QP(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 144+_PP(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 144+_QP(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 80(%rsp), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + movl $-1, %edx + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rcx) + faddp %st, %st(1) + fstpt -48(%rdi) + fldt (%rsi) + lea 64(%rsp), %rsi + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -16(%rsi) +..___tag_value___j0l.37: + call __libm_sincos_pi4l@PLT +..___tag_value___j0l.38: +..B2.18: + fldt 112(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 96 +..B2.10: + fldt 48(%rsp) + lea _val_0_03L(%rip), %rax + fmulp %st, %st(1) + fldt 64(%rsp) + fmulp %st, %st(2) + fsub %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt (%rax) + fmulp %st, %st(1) + fcomip %st(1), %st + fstp %st(0) + jae ..B2.12 + jp ..B2.12 +..B2.11: + fstp %st(1) + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.12: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B2.20: + addq $16, %rsp + .cfi_def_cfa_offset 96 + movaps (%rsp), %xmm0 +..___tag_value___j0l.44: + call __j0q@PLT +..___tag_value___j0l.45: +..B2.13: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B2.21: + fstpl 8(%rsp) + movsd 8(%rsp), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) +..B2.14: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __j0l,@function + .size __j0l,.-__j0l + .data +# -- End __j0l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_S: + .word 17728 + .word 31608 + .word 43949 + .word 62778 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 32551 + .word 41874 + .word 44957 + .word 57471 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 18949 + .word 61409 + .word 34437 + .word 41670 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 4396 + .word 34605 + .word 55192 + .word 54573 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 9307 + .word 10310 + .word 55728 + .word 33731 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 7613 + .word 2917 + .word 18234 + .word 40173 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 24292 + .word 42693 + .word 42782 + .word 46612 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 12570 + .word 29960 + .word 47214 + .word 53050 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 24415 + .word 36838 + .word 59299 + .word 59487 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 32322 + .word 22879 + .word 15219 + .word 32962 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 56404 + .word 12107 + .word 18542 + .word 36180 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 18639 + .word 44635 + .word 10526 + .word 39398 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _S,@object + .size _S,192 + .align 2 +_Z: + .word 64993 + .word 47321 + .word 43380 + .word 39400 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 10427 + .word 24946 + .word 31449 + .word 45220 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 20142 + .word 26358 + .word 43878 + .word 35445 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 45380 + .word 5013 + .word 8196 + .word 48298 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 36049 + .word 37774 + .word 2551 + .word 61157 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 44499 + .word 20687 + .word 35324 + .word 37009 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 37149 + .word 40892 + .word 28299 + .word 43441 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 59921 + .word 2742 + .word 56472 + .word 49873 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 35749 + .word 60152 + .word 42287 + .word 56306 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 36553 + .word 24054 + .word 44174 + .word 62739 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 12707 + .word 13183 + .word 28829 + .word 34586 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 24309 + .word 45263 + .word 7124 + .word 37803 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _Z,@object + .size _Z,192 + .align 2 +_P1: + .word 41974 + .word 50359 + .word 55 + .word 49432 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 46729 + .word 24287 + .word 10077 + .word 43682 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 54556 + .word 53463 + .word 26566 + .word 47408 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 61625 + .word 30678 + .word 34691 + .word 56786 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 32205 + .word 55323 + .word 47622 + .word 59679 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 29650 + .word 64976 + .word 4011 + .word 64391 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 31057 + .word 21065 + .word 6935 + .word 59041 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 36662 + .word 39842 + .word 13910 + .word 57058 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 21879 + .word 21964 + .word 7382 + .word 44566 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 35904 + .word 38403 + .word 56995 + .word 38056 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 18301 + .word 44371 + .word 51380 + .word 49148 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 24372 + .word 2933 + .word 6164 + .word 36455 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 49391 + .word 5716 + .word 15337 + .word 37270 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 25965 + .word 16194 + .word 56568 + .word 46953 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 45667 + .word 13925 + .word 5584 + .word 35484 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 49022 + .word 26773 + .word 37576 + .word 36812 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 36832 + .word 53763 + .word 58864 + .word 36312 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 33543 + .word 46187 + .word 17185 + .word 59351 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 40102 + .word 5284 + .word 63312 + .word 56590 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 857 + .word 43156 + .word 55730 + .word 34022 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 52121 + .word 9280 + .word 35775 + .word 47190 + .word 16318 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,336 + .align 2 +_P: + .word 25701 + .word 56152 + .word 43593 + .word 44746 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 48832 + .word 40943 + .word 62738 + .word 40407 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 27954 + .word 18691 + .word 56371 + .word 61331 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 59673 + .word 34431 + .word 10026 + .word 51320 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 19628 + .word 6656 + .word 43961 + .word 34852 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 10797 + .word 38877 + .word 18617 + .word 49740 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 55276 + .word 31862 + .word 41256 + .word 61817 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 56169 + .word 58452 + .word 6548 + .word 36482 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 22526 + .word 12680 + .word 38609 + .word 41195 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 35707 + .word 29316 + .word 48923 + .word 38609 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 54924 + .word 17159 + .word 27854 + .word 39283 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 7410 + .word 20104 + .word 60324 + .word 54971 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 42961 + .word 8606 + .word 41997 + .word 49951 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 20439 + .word 51893 + .word 4000 + .word 47026 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 59638 + .word 54459 + .word 36852 + .word 37873 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 53889 + .word 4789 + .word 65352 + .word 38847 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 1714 + .word 3910 + .word 34394 + .word 55562 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 303 + .word 16967 + .word 38717 + .word 64635 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 5713 + .word 19393 + .word 12368 + .word 44599 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 21960 + .word 14969 + .word 53843 + .word 43675 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 52500 + .word 174 + .word 33388 + .word 44907 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 36805 + .word 62602 + .word 43329 + .word 35133 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 27761 + .word 25841 + .word 3607 + .word 63286 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 6612 + .word 54609 + .word 58140 + .word 43860 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 37993 + .word 17870 + .word 56109 + .word 35856 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 61675 + .word 27140 + .word 56422 + .word 41440 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 56971 + .word 52432 + .word 57814 + .word 63191 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 25412 + .word 37118 + .word 3118 + .word 58735 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 38291 + .word 36319 + .word 26004 + .word 41665 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 50251 + .word 22788 + .word 9163 + .word 59245 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 15018 + .word 28 + .word 26139 + .word 39028 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 33331 + .word 48247 + .word 16919 + .word 39314 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 9684 + .word 33609 + .word 24106 + .word 48128 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 51011 + .word 47822 + .word 659 + .word 60363 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 37534 + .word 11575 + .word 45084 + .word 34566 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 45912 + .word 27680 + .word 6912 + .word 42099 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 56715 + .word 12873 + .word 49782 + .word 46172 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 26728 + .word 49648 + .word 65144 + .word 32891 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 40426 + .word 15254 + .word 52157 + .word 35579 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 38384 + .word 45177 + .word 47511 + .word 58357 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 58158 + .word 44133 + .word 45474 + .word 44841 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 25822 + .word 50828 + .word 25446 + .word 60617 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 15324 + .word 12408 + .word 38243 + .word 63699 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 14774 + .word 16677 + .word 5572 + .word 37105 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 22149 + .word 54660 + .word 59654 + .word 35846 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 11697 + .word 52785 + .word 2274 + .word 34156 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 53627 + .word 64285 + .word 10253 + .word 62534 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 24801 + .word 65406 + .word 2005 + .word 46814 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 32190 + .word 19121 + .word 50201 + .word 40636 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 54751 + .word 12899 + .word 38715 + .word 45207 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 43490 + .word 42082 + .word 27556 + .word 37283 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 22028 + .word 56865 + .word 50900 + .word 56715 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 16346 + .word 12991 + .word 64075 + .word 44659 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 52492 + .word 22409 + .word 7105 + .word 40702 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 6702 + .word 59476 + .word 47051 + .word 61808 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 62316 + .word 14189 + .word 19866 + .word 53935 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 9195 + .word 51568 + .word 61124 + .word 40040 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 6439 + .word 11299 + .word 34414 + .word 41343 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 46739 + .word 24947 + .word 62261 + .word 60937 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 58365 + .word 23430 + .word 12962 + .word 38007 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 58251 + .word 41189 + .word 49383 + .word 44339 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 48598 + .word 60621 + .word 33089 + .word 52046 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 15609 + .word 33598 + .word 37151 + .word 63031 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 47302 + .word 16218 + .word 41542 + .word 62539 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 57122 + .word 24762 + .word 37625 + .word 35182 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 14554 + .word 11813 + .word 4690 + .word 56239 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 54525 + .word 1724 + .word 15173 + .word 60713 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 63047 + .word 59633 + .word 16097 + .word 37474 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 47674 + .word 64044 + .word 50935 + .word 38909 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 10733 + .word 57181 + .word 7346 + .word 35019 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 60139 + .word 34186 + .word 61790 + .word 35089 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 42252 + .word 41404 + .word 34184 + .word 42385 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 1522 + .word 6058 + .word 55347 + .word 41209 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 8896 + .word 65510 + .word 60684 + .word 58885 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 5547 + .word 57306 + .word 64532 + .word 55968 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 14723 + .word 16104 + .word 43168 + .word 38160 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 64145 + .word 20360 + .word 50512 + .word 35772 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 36202 + .word 63428 + .word 51591 + .word 58021 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 65464 + .word 45991 + .word 59516 + .word 54144 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24568 + .word 20436 + .word 61634 + .word 37862 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 45319 + .word 25104 + .word 37206 + .word 43484 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 21849 + .word 55910 + .word 13070 + .word 44688 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 3252 + .word 24429 + .word 41684 + .word 61678 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 18877 + .word 5474 + .word 3532 + .word 52835 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 29000 + .word 47276 + .word 64838 + .word 34154 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 20967 + .word 63980 + .word 13404 + .word 46613 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 52562 + .word 53463 + .word 21966 + .word 58373 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 9777 + .word 2939 + .word 17549 + .word 60815 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 26283 + .word 15936 + .word 57935 + .word 36992 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 53769 + .word 29752 + .word 63351 + .word 55571 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 39733 + .word 64164 + .word 46820 + .word 32952 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 176 + .word 24001 + .word 47175 + .word 32916 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 42514 + .word 53223 + .word 40190 + .word 38228 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 32337 + .word 51109 + .word 43299 + .word 44928 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 59799 + .word 62803 + .word 25577 + .word 51379 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 14970 + .word 20015 + .word 15936 + .word 57562 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 65161 + .word 31438 + .word 7531 + .word 65214 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 20513 + .word 44789 + .word 62889 + .word 43571 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 4307 + .word 19900 + .word 64182 + .word 49211 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 23601 + .word 8473 + .word 7427 + .word 49494 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 7362 + .word 8526 + .word 7254 + .word 42403 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 35188 + .word 37258 + .word 23196 + .word 38516 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 28716 + .word 28394 + .word 59353 + .word 59952 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 5380 + .word 17306 + .word 43095 + .word 44938 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 62603 + .word 29353 + .word 43042 + .word 32969 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 14219 + .word 29360 + .word 8286 + .word 39065 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 51755 + .word 8774 + .word 37073 + .word 55906 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 56892 + .word 44416 + .word 43797 + .word 50190 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 61329 + .word 48733 + .word 6023 + .word 35132 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 7541 + .word 9021 + .word 40244 + .word 45179 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 26533 + .word 29344 + .word 18926 + .word 62060 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 30572 + .word 2598 + .word 8389 + .word 52807 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 51943 + .word 22643 + .word 23287 + .word 35717 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 64388 + .word 35284 + .word 47919 + .word 35658 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 29632 + .word 11036 + .word 42088 + .word 47700 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 31422 + .word 44089 + .word 40511 + .word 45376 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 24082 + .word 23937 + .word 40663 + .word 60291 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 35871 + .word 18767 + .word 59204 + .word 34260 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 55945 + .word 59437 + .word 40276 + .word 45420 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 36087 + .word 44447 + .word 31316 + .word 65259 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 33015 + .word 55199 + .word 13485 + .word 41205 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 28040 + .word 38678 + .word 23200 + .word 33402 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 24126 + .word 8131 + .word 32863 + .word 58069 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 35392 + .word 16287 + .word 64004 + .word 38564 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 24419 + .word 65021 + .word 26451 + .word 63502 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 50428 + .word 39809 + .word 46675 + .word 33151 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 43497 + .word 65182 + .word 62592 + .word 53510 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 13653 + .word 47792 + .word 51483 + .word 42124 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 51670 + .word 53417 + .word 2690 + .word 33418 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 18048 + .word 20017 + .word 2806 + .word 37530 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 28377 + .word 1564 + .word 33730 + .word 58682 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 50365 + .word 41139 + .word 10086 + .word 43478 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 61280 + .word 6173 + .word 58518 + .word 33596 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 37780 + .word 41188 + .word 55897 + .word 58318 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 54954 + .word 62311 + .word 27470 + .word 44684 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 57442 + .word 38159 + .word 64608 + .word 36945 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 24087 + .word 55434 + .word 11948 + .word 56328 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 3958 + .word 29640 + .word 49133 + .word 55700 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 27700 + .word 45302 + .word 5983 + .word 42389 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 40427 + .word 54367 + .word 12482 + .word 37240 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 59852 + .word 29007 + .word 23004 + .word 39969 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 34211 + .word 57602 + .word 36659 + .word 58360 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 44442 + .word 16364 + .word 9911 + .word 56161 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 28102 + .word 25155 + .word 37530 + .word 33414 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 6555 + .word 37232 + .word 8513 + .word 61132 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 19389 + .word 63961 + .word 54328 + .word 56964 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 46901 + .word 14299 + .word 54235 + .word 51269 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 21562 + .word 53008 + .word 37762 + .word 35900 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 39053 + .word 49830 + .word 37166 + .word 63741 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 45681 + .word 41863 + .word 1807 + .word 63504 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 32524 + .word 20075 + .word 31047 + .word 55727 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 19491 + .word 55333 + .word 6932 + .word 36559 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 44244 + .word 33552 + .word 34722 + .word 63577 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 16901 + .word 42071 + .word 41001 + .word 48810 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 62438 + .word 12223 + .word 44142 + .word 42160 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 23223 + .word 6493 + .word 11343 + .word 61664 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 62523 + .word 30008 + .word 29610 + .word 53050 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 14947 + .word 31100 + .word 26993 + .word 46432 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 54892 + .word 55125 + .word 25696 + .word 39893 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 64089 + .word 10154 + .word 50994 + .word 64131 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 25208 + .word 35455 + .word 35497 + .word 38745 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 22601 + .word 23897 + .word 16529 + .word 51375 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 39957 + .word 27913 + .word 24611 + .word 54302 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 45382 + .word 20134 + .word 36574 + .word 58452 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 42298 + .word 30543 + .word 37555 + .word 58890 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 22768 + .word 53677 + .word 2298 + .word 49504 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 58111 + .word 6687 + .word 35097 + .word 49208 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 10603 + .word 28285 + .word 57192 + .word 62022 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 32868 + .word 54034 + .word 283 + .word 60966 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 45349 + .word 58038 + .word 8163 + .word 54564 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 55920 + .word 35455 + .word 60237 + .word 53133 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 60123 + .word 63321 + .word 17152 + .word 62548 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 39317 + .word 30736 + .word 60380 + .word 60458 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 49393 + .word 44945 + .word 51803 + .word 41616 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 20738 + .word 26362 + .word 9659 + .word 40012 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 60223 + .word 27976 + .word 18717 + .word 52467 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 54339 + .word 42843 + .word 18062 + .word 50282 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 34001 + .word 60559 + .word 43103 + .word 39476 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 26526 + .word 28531 + .word 16125 + .word 37792 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 6095 + .word 56607 + .word 38079 + .word 40348 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 15971 + .word 7192 + .word 49983 + .word 37562 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 50443 + .word 47213 + .word 11879 + .word 45566 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 11802 + .word 10368 + .word 62578 + .word 52530 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 31461 + .word 32590 + .word 25910 + .word 51580 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 23034 + .word 4503 + .word 56149 + .word 56800 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 23084 + .word 49532 + .word 8891 + .word 43466 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 52278 + .word 51985 + .word 56128 + .word 47325 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 64046 + .word 3409 + .word 24460 + .word 54209 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 21815 + .word 55080 + .word 59949 + .word 58476 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 52803 + .word 16320 + .word 8321 + .word 47500 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 52718 + .word 62993 + .word 9405 + .word 50844 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 54524 + .word 45491 + .word 53115 + .word 54272 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 17147 + .word 2195 + .word 64554 + .word 57739 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 25716 + .word 30593 + .word 61559 + .word 36022 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 34582 + .word 27844 + .word 9712 + .word 38156 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 11089 + .word 32571 + .word 7121 + .word 45346 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 19256 + .word 10500 + .word 41195 + .word 47904 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 34688 + .word 57357 + .word 16578 + .word 34099 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 33812 + .word 7938 + .word 37351 + .word 35991 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 39461 + .word 41125 + .word 38968 + .word 43650 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 44025 + .word 18687 + .word 5475 + .word 36436 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 23695 + .word 42035 + .word 32968 + .word 40701 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 38927 + .word 50812 + .word 3019 + .word 50863 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 61445 + .word 40975 + .word 17938 + .word 45887 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 29652 + .word 52899 + .word 3582 + .word 54866 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 20058 + .word 59066 + .word 2994 + .word 38517 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 39274 + .word 56137 + .word 36322 + .word 45609 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 15638 + .word 5070 + .word 53701 + .word 47866 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 51166 + .word 27629 + .word 45907 + .word 56238 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 29387 + .word 28474 + .word 13265 + .word 41814 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 6001 + .word 55757 + .word 63641 + .word 48808 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 65207 + .word 5152 + .word 25385 + .word 47657 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 16879 + .word 18288 + .word 49778 + .word 55345 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 63014 + .word 23411 + .word 42365 + .word 63147 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 41060 + .word 50204 + .word 58630 + .word 36532 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 38440 + .word 64136 + .word 63792 + .word 39699 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 22495 + .word 32960 + .word 60573 + .word 45833 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 59007 + .word 19608 + .word 21801 + .word 59681 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 39231 + .word 52779 + .word 63106 + .word 34425 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 40257 + .word 55273 + .word 33242 + .word 51859 + .word 16320 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,3520 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,16 + .align 2 +_PP: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP,@object + .size _PP,160 + .align 2 +_QP: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .word 0 + .word 0 + .type _QP,@object + .size _QP,160 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,16 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _tonpi,@object + .size _tonpi,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/j0f.S b/external/sgx_libm/intel64/j0f.S new file mode 100644 index 0000000000..69420f75c2 --- /dev/null +++ b/external/sgx_libm/intel64/j0f.S @@ -0,0 +1,596 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j0f.c" + .text +..TXTST0: +# -- Begin j0f + .text + .align 16,0x90 + .globl j0f +j0f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_j0f.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movd %xmm0, %edx + movss %xmm0, 48(%rsp) + andl $2147483647, %edx + cmpl $2139095040, %edx + jae ..B1.18 +..B1.2: + cmpl $1099154394, %edx + jae ..B1.19 +..B1.3: + cmpl $1081424556, %edx + jae ..B1.14 +..B1.4: + cmpl $1048576000, %edx + jae ..B1.13 +..B1.5: + cmpl $998244352, %edx + jae ..B1.12 +..B1.6: + cmpl $947912704, %edx + jae ..B1.11 +..B1.7: + movss .L_2il0floatpacket.0(%rip), %xmm1 + cmpl $838860800, %edx + jae ..B1.9 +..B1.8: + andps .L_2il0floatpacket.1(%rip), %xmm0 + subss %xmm0, %xmm1 + jmp ..B1.10 +..B1.9: + mulss %xmm0, %xmm0 + subss %xmm0, %xmm1 +..B1.10: + movaps %xmm1, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.11: + pxor %xmm0, %xmm0 + lea 8+_Q3(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + lea _Q3(%rip), %rdx + movsd (%rax), %xmm1 + mulsd %xmm0, %xmm1 + addsd (%rdx), %xmm1 + mulsd %xmm0, %xmm1 + addsd .L_2il0floatpacket.2(%rip), %xmm1 + cvtsd2ss %xmm1, %xmm1 + movaps %xmm1, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + pxor %xmm1, %xmm1 + lea 24+_Q2(%rip), %rax + cvtss2sd 48(%rsp), %xmm1 + mulsd %xmm1, %xmm1 + lea 16+_Q2(%rip), %rcx + movaps %xmm1, %xmm0 + lea 8+_Q2(%rip), %rdx + mulsd %xmm1, %xmm0 + lea _Q2(%rip), %rsi + movsd (%rax), %xmm3 + movsd (%rcx), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm0, %xmm2 + addsd (%rdx), %xmm3 + addsd (%rsi), %xmm2 + mulsd %xmm0, %xmm3 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm3 + addsd .L_2il0floatpacket.2(%rip), %xmm3 + cvtsd2ss %xmm3, %xmm3 + movaps %xmm3, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.13: + pxor %xmm1, %xmm1 + lea 112+_Q1(%rip), %rax + cvtss2sd 48(%rsp), %xmm1 + andps .L_2il0floatpacket.3(%rip), %xmm1 + lea 104+_Q1(%rip), %rdx + lea 72+_Q1(%rip), %rcx + lea 88+_Q1(%rip), %rdi + lea 96+_Q1(%rip), %r11 + lea 56+_Q1(%rip), %r8 + lea 40+_Q1(%rip), %rsi + lea 24+_Q1(%rip), %r9 + movsd (%rdx), %xmm6 + lea 32+_Q1(%rip), %rdx + movsd (%rdi), %xmm0 + lea 16+_Q1(%rip), %rdi + movsd (%r11), %xmm5 + lea 8+_Q1(%rip), %r10 + subsd (%rax), %xmm1 + lea 64+_Q1(%rip), %rax + movaps %xmm1, %xmm3 + mulsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd (%rcx), %xmm6 + addsd (%r8), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm6 + addsd (%r9), %xmm0 + addsd (%rdx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm0 + mulsd %xmm2, %xmm5 + addsd %xmm0, %xmm6 + lea 80+_Q1(%rip), %rcx + lea 48+_Q1(%rip), %rsi + lea _Q1(%rip), %r8 + addsd (%r10), %xmm6 + movsd (%rcx), %xmm4 + mulsd %xmm2, %xmm4 + mulsd %xmm1, %xmm6 + addsd (%rsi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rdi), %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + addsd (%r8), %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.14: + cmpl $1092798087, %edx + jae ..B1.16 +..B1.15: + cmpl $1088454576, %edx + lea _P1(%rip), %rcx + lea _P2(%rip), %rax + jb ..B1.17 + movq %rax, %rcx + jmp ..B1.17 +..B1.16: + cmpl $1096101336, %edx + lea _P3(%rip), %rcx + lea _P4(%rip), %rax + jb ..L12 + movq %rax, %rcx +..L12: +..B1.17: + pxor %xmm3, %xmm3 + cvtss2sd 48(%rsp), %xmm3 + andps .L_2il0floatpacket.3(%rip), %xmm3 + movsd 96(%rcx), %xmm6 + movsd 80(%rcx), %xmm0 + movsd 88(%rcx), %xmm5 + movsd 72(%rcx), %xmm4 + subsd 104(%rcx), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd 64(%rcx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 48(%rcx), %xmm0 + addsd 56(%rcx), %xmm5 + mulsd %xmm2, %xmm6 + addsd 40(%rcx), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd 32(%rcx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 16(%rcx), %xmm0 + addsd 24(%rcx), %xmm5 + mulsd %xmm2, %xmm6 + addsd 8(%rcx), %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + mulsd %xmm3, %xmm4 + addsd %xmm0, %xmm6 + mulsd %xmm3, %xmm5 + addsd (%rcx), %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.18: + pxor %xmm0, %xmm0 + jbe ..L15 + movss 48(%rsp), %xmm0 +..L15: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.19: + pxor %xmm0, %xmm0 + lea _val_16_0(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + andps .L_2il0floatpacket.3(%rip), %xmm0 + lea (%rsp), %rdi + movsd .L_2il0floatpacket.2(%rip), %xmm1 + lea 8(%rsp), %rsi + divsd %xmm0, %xmm1 + movsd (%rax), %xmm2 + movl $-1, %edx + mulsd %xmm1, %xmm2 + movsd %xmm2, 8(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm2, 24(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm1, 16(%rsi) + movsd %xmm2, 32(%rsi) +..___tag_value_j0f.18: + call __libm_sincos_k32@PLT +..___tag_value_j0f.19: +..B1.20: + lea 40+_QP(%rip), %r10 + lea 40+_PP(%rip), %rdx + movsd 40(%rsp), %xmm2 + lea 24+_QP(%rip), %r11 + lea 24+_PP(%rip), %rcx + lea 32+_PP(%rip), %rdi + lea _tonpi(%rip), %rax + lea 16+_PP(%rip), %r8 + movsd (%r10), %xmm5 + lea 8+_PP(%rip), %rsi + movsd (%rdx), %xmm6 + lea 32+_QP(%rip), %rdx + mulsd %xmm2, %xmm5 + lea _PP(%rip), %r9 + mulsd %xmm2, %xmm6 + addsd (%r11), %xmm5 + addsd (%rcx), %xmm6 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm6 + movsd (%rdx), %xmm4 + lea 16+_QP(%rip), %rcx + mulsd %xmm2, %xmm4 + addsd (%rsi), %xmm6 + movsd (%rdi), %xmm1 + lea _QP(%rip), %rsi + mulsd %xmm2, %xmm1 + addsd (%rcx), %xmm4 + movsd (%rax), %xmm0 + lea 8+_QP(%rip), %rax + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm1 + mulsd 24(%rsp), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm1 + addsd (%rsi), %xmm4 + sqrtsd %xmm0, %xmm0 + addsd (%r9), %xmm1 + movsd 32(%rsp), %xmm3 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm1, %xmm6 + mulsd 16(%rsp), %xmm5 + mulsd 8(%rsp), %xmm6 + mulsd (%rsp), %xmm5 + subsd %xmm5, %xmm6 + mulsd %xmm6, %xmm0 + cvtsd2ss %xmm0, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type j0f,@function + .size j0f,.-j0f + .data +# -- End j0f + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x7fffffff,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.3: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x3f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +_Q3: + .long 4294966841 + .long 3218079743 + .long 477219499 + .long 1066401791 + .type _Q3,@object + .size _Q3,16 + .align 4 +_Q2: + .long 4294967005 + .long 3218079743 + .long 4292583532 + .long 1066401791 + .long 2963922746 + .long 3208409541 + .long 1698509326 + .long 1054632110 + .type _Q2,@object + .size _Q2,32 + .align 4 +_Q1: + .long 569392270 + .long 3163659129 + .long 911539783 + .long 3219168475 + .long 3927550863 + .long 1069261278 + .long 1680954783 + .long 1068301032 + .long 3247602706 + .long 3212950300 + .long 1528576945 + .long 3210869138 + .long 2120930432 + .long 1060197251 + .long 3147753376 + .long 1057418557 + .long 3445667889 + .long 3201446637 + .long 160313185 + .long 3198274950 + .long 2157358765 + .long 1047004568 + .long 1405517519 + .long 1043512506 + .long 3055202941 + .long 3187001715 + .long 562966967 + .long 3183555197 + .long 781654848 + .long 1073954069 + .type _Q1,@object + .size _Q1,120 + .align 4 +_P1: + .long 2556390964 + .long 3162487616 + .long 168113101 + .long 1070974694 + .long 3865632959 + .long 3214905202 + .long 3384884860 + .long 3215663440 + .long 3461368592 + .long 1064499199 + .long 2947775703 + .long 1063419441 + .long 1964351934 + .long 3207001659 + .long 1081690493 + .long 3204998104 + .long 2315304668 + .long 1053480462 + .long 3655541446 + .long 1050880364 + .long 988219424 + .long 3194139699 + .long 2647984383 + .long 3191029766 + .long 3459760917 + .long 1038956170 + .long 1529622085 + .long 1075188879 + .type _P1,@object + .size _P1,112 + .align 4 +_P2: + .long 2989381656 + .long 3164006638 + .long 2007135498 + .long 3218169721 + .long 3461465629 + .long 1066405759 + .long 1292000183 + .long 1067879320 + .long 1048188593 + .long 3211038307 + .long 2811900586 + .long 3210797269 + .long 275024305 + .long 1058896216 + .long 2179928921 + .long 1057456107 + .long 2316750355 + .long 3200463196 + .long 1626245786 + .long 3198355713 + .long 2429961783 + .long 1046264853 + .long 3081665457 + .long 1043557342 + .long 3760684269 + .long 3186121773 + .long 1825365706 + .long 1075924661 + .type _P2,@object + .size _P2,112 + .align 4 +_P3: + .long 915277891 + .long 3163740397 + .long 1721892699 + .long 1070448958 + .long 3433548142 + .long 3213111280 + .long 3603643349 + .long 3215166749 + .long 2193444562 + .long 1062884841 + .long 1036402988 + .long 1063136790 + .long 2039602830 + .long 3205750717 + .long 2039806946 + .long 3204828766 + .long 3757243411 + .long 1052487712 + .long 2819184679 + .long 1050816211 + .long 1638789445 + .long 3193302656 + .long 96077275 + .long 3191008024 + .long 34207204 + .long 1038327735 + .long 8549046 + .long 1076335940 + .type _P3,@object + .size _P3,112 + .align 4 +_P4: + .long 4010378302 + .long 3164933090 + .long 260862994 + .long 3217715229 + .long 793353311 + .long 1065112761 + .long 2823013001 + .long 1067546520 + .long 4006575139 + .long 3209863700 + .long 3390737311 + .long 3210433566 + .long 1793352299 + .long 1057800372 + .long 3528876835 + .long 1057234714 + .long 2505438989 + .long 3199512871 + .long 2785865938 + .long 3198229698 + .long 565130724 + .long 1045495083 + .long 410977742 + .long 1043470609 + .long 4266013081 + .long 3185543354 + .long 1056076242 + .long 1076747425 + .type _P4,@object + .size _P4,112 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_QP: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP,@object + .size _QP,48 + .align 4 +_PP: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP,@object + .size _PP,48 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/j0l.S b/external/sgx_libm/intel64/j0l.S new file mode 100644 index 0000000000..d2ea20c856 --- /dev/null +++ b/external/sgx_libm/intel64/j0l.S @@ -0,0 +1,86 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j0l.c" + .text +..TXTST0: +# -- Begin j0l + .text + .align 16,0x90 + .globl j0l +j0l: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_j0l.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 48 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B1.6: + addq $16, %rsp + .cfi_def_cfa_offset 32 + movaps (%rsp), %xmm0 +..___tag_value_j0l.6: + call __j0q@PLT +..___tag_value_j0l.7: +..B1.2: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type j0l,@function + .size j0l,.-j0l + .data +# -- End j0l + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/j1.S b/external/sgx_libm/intel64/j1.S new file mode 100644 index 0000000000..b335b1562b --- /dev/null +++ b/external/sgx_libm/intel64/j1.S @@ -0,0 +1,3028 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j1.c" + .text +..TXTST0: +# -- Begin j1 + .text + .align 16,0x90 + .globl j1 +j1: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_j1.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + subq $40, %rsp + .cfi_def_cfa_offset 64 + xorb %r13b, %r13b + movsd %xmm0, 24(%rsp) +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movl 28(%rsp), %r12d + movl %r12d, %edx + andl $2147483647, %edx + shrl $31, %r12d + cmpl $2146435072, %edx + jge ..B1.20 +..B1.4: + cmpl $1012924416, %edx + jge ..B1.12 +..B1.5: + cmpl $1048576, %edx + jle ..B1.7 +..B1.6: + movl %r12d, %r12d + lea _small_value_64(%rip), %rax + movsd 24(%rsp), %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd (%rax,%r12,8), %xmm1 + mulsd (%rax), %xmm1 + subsd %xmm1, %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.7: + movl 24(%rsp), %eax + je ..B1.24 +..B1.8: + orl %eax, %edx + je ..B1.10 +..B1.9: + movl %r12d, %r12d + lea _small_value_64(%rip), %rax + movsd (%rax,%r12,8), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, (%rsp) + movsd 24(%rsp), %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd (%rsp), %xmm1 + subsd %xmm1, %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.10: + movsd 24(%rsp), %xmm0 +..B1.11: + addq $40, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.12: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.16 +..B1.13: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.14: + fldcw 16(%rsp) +..B1.15: + movb $1, %r13b +..B1.16: + addq $-16, %rsp + .cfi_def_cfa_offset 80 + movsd 40(%rsp), %xmm0 + andps .L_2il0floatpacket.1(%rip), %xmm0 + movsd %xmm0, 24(%rsp) + fldl 24(%rsp) + fstpt (%rsp) +..___tag_value_j1.33: + call __j1l@PLT +..___tag_value_j1.34: +..B1.27: + addq $16, %rsp + .cfi_def_cfa_offset 64 +..B1.17: + fstpl 8(%rsp) + testb %r13b, %r13b + movsd 8(%rsp), %xmm1 + je ..B1.19 +..B1.18: + fldcw 18(%rsp) +..B1.19: + movaps %xmm1, %xmm0 + testl %r12d, %r12d + xorps .L_2il0floatpacket.2(%rip), %xmm0 + jne ..L36 + movaps %xmm1, %xmm0 +..L36: + addq $40, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.20: + andl $-2146435073, %edx + orl 24(%rsp), %edx + je ..B1.22 +..B1.21: + lea _ones(%rip), %rax + movsd (%rax), %xmm0 + mulsd 24(%rsp), %xmm0 + addq $40, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.22: + lea _zeros(%rip), %rax + movsd (%rax,%r12,8), %xmm0 +..B1.23: + addq $40, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.24: + testl %eax, %eax + jne ..B1.6 + jmp ..B1.8 + .align 16,0x90 + .cfi_endproc + .type j1,@function + .size j1,.-j1 + .data +# -- End j1 + .text +# -- Begin __j1l + .text + .align 16,0x90 + .globl __j1l +__j1l: +# parameter 1: 96 + %rsp +..B2.1: + .cfi_startproc +..___tag_value___j1l.62: +..L63: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + lea 176+_S(%rip), %rax + fldt 96(%rsp) + fldt (%rax) + fcomip %st(1), %st + jbe ..B2.9 +..B2.2: + lea _S(%rip), %rcx + fldt (%rcx) + fcomip %st(1), %st + jbe ..B2.4 +..B2.3: + fld %st(0) + lea _P1(%rip), %rax + fmul %st(1), %st + lea 16+_P1(%rip), %rdx + fld %st(0) + lea 32+_P1(%rip), %rcx + fmul %st(1), %st + lea 48+_P1(%rip), %rsi + fstpt 64(%rsp) + lea 64+_P1(%rip), %rdi + lea 80+_P1(%rip), %r8 + lea 96+_P1(%rip), %r9 + lea 112+_P1(%rip), %r10 + lea 128+_P1(%rip), %r11 + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%rax) + lea 144+_P1(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + lea 160+_P1(%rip), %rdx + fmul %st(2), %st + fldt (%rcx) + lea 176+_P1(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 192+_P1(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 208+_P1(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 224+_P1(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 240+_P1(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 256+_P1(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 272+_P1(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 288+_P1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.4: + movb $1, %dl + movl $16, %eax +..B2.5: + fldt (%rax,%rcx) + fcomip %st(1), %st + ja ..B2.8 + jp ..B2.8 +..B2.6: + incb %dl + addq $16, %rax + cmpb $11, %dl + jl ..B2.5 +..B2.8: + decb %dl + movzbl %dl, %ecx + lea _Z(%rip), %rax + movq %rcx, %rdx + lea _P(%rip), %rdi + shlq $4, %rdx + lea (%rcx,%rcx,4), %rsi + shlq $6, %rsi + fldt (%rax,%rdx) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%rsi,%rdi) + fmul %st(1), %st + fldt 16(%rsi,%rdi) + fmul %st(2), %st + fldt 32(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 48(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 64(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 80(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 96(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 112(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 128(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 144(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 160(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 176(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 192(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 208(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 224(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 240(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 256(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 272(%rsi,%rdi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 288(%rsi,%rdi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 304(%rsi,%rdi) + faddp %st, %st(1) + faddp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.9: + lea _ones(%rip), %rax + lea _val_36_0L(%rip), %rdx + lea _PP(%rip), %rcx + lea _QP(%rip), %rsi + lea 16+_PP(%rip), %rdi + lea 16+_QP(%rip), %r8 + lea 32+_PP(%rip), %r9 + lea 32+_QP(%rip), %r10 + fldl (%rax) + lea 48+_PP(%rip), %r11 + fdiv %st(1), %st + lea 48+_QP(%rip), %rax + fxch %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rdx) + lea 64+_PP(%rip), %rdx + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + fxch %st(2) + fstpt (%rsp) + fldt (%rcx) + lea 64+_QP(%rip), %rcx + fmul %st(1), %st + fldt (%rsi) + lea 80+_PP(%rip), %rsi + fmul %st(2), %st + fldt (%rdi) + lea 80+_QP(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 96+_PP(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 96+_QP(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 112+_PP(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 112+_QP(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_PP(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 128+_QP(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 144+_PP(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 144+_QP(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 64(%rsp), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + movl $-3, %edx + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rcx) + faddp %st, %st(1) + fstpt -32(%rdi) + fldt (%rsi) + lea 80(%rsp), %rsi + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -32(%rsi) +..___tag_value___j1l.70: + call __libm_sincos_pi4l@PLT +..___tag_value___j1l.71: +..B2.18: + fldt 112(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 96 +..B2.10: + fldt 64(%rsp) + lea _val_0_03L(%rip), %rax + fmulp %st, %st(1) + fldt 48(%rsp) + fmulp %st, %st(2) + fsub %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt (%rax) + fmulp %st, %st(1) + fcomip %st(1), %st + fstp %st(0) + jae ..B2.12 + jp ..B2.12 +..B2.11: + fstp %st(1) + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B2.12: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B2.20: + addq $16, %rsp + .cfi_def_cfa_offset 96 + movaps (%rsp), %xmm0 +..___tag_value___j1l.77: + call __j1q@PLT +..___tag_value___j1l.78: +..B2.13: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B2.21: + fstpl 8(%rsp) + movsd 8(%rsp), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) +..B2.14: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __j1l,@function + .size __j1l,.-__j1l + .data +# -- End __j1l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_S: + .word 64993 + .word 47321 + .word 43380 + .word 39400 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 10427 + .word 24946 + .word 31449 + .word 45220 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 20142 + .word 26358 + .word 43878 + .word 35445 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 45380 + .word 5013 + .word 8196 + .word 48298 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 36049 + .word 37774 + .word 2551 + .word 61157 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 44499 + .word 20687 + .word 35324 + .word 37009 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 37149 + .word 40892 + .word 28299 + .word 43441 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 59921 + .word 2742 + .word 56472 + .word 49873 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 35749 + .word 60152 + .word 42287 + .word 56306 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 36553 + .word 24054 + .word 44174 + .word 62739 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 12707 + .word 13183 + .word 28829 + .word 34586 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 24309 + .word 45263 + .word 7124 + .word 37803 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _S,@object + .size _S,192 + .align 2 +_P1: + .word 26041 + .word 45178 + .word 34801 + .word 41495 + .word 49090 + .word 0 + .word 0 + .word 0 + .word 65370 + .word 9956 + .word 39004 + .word 61276 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 9622 + .word 32383 + .word 51277 + .word 45692 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 53955 + .word 64596 + .word 5222 + .word 35592 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 34986 + .word 10535 + .word 24469 + .word 42796 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 2569 + .word 3934 + .word 58827 + .word 40937 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 16535 + .word 14264 + .word 30755 + .word 37884 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 39497 + .word 52694 + .word 37205 + .word 63078 + .word 49104 + .word 0 + .word 0 + .word 0 + .word 50010 + .word 60332 + .word 8210 + .word 49710 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 10498 + .word 63852 + .word 64151 + .word 35274 + .word 49105 + .word 0 + .word 0 + .word 0 + .word 55591 + .word 43795 + .word 24807 + .word 46603 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 15642 + .word 32907 + .word 52420 + .word 55914 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 53151 + .word 24867 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 37497 + .word 10412 + .word 6022 + .word 55715 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 14397 + .word 43702 + .word 43690 + .word 43690 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 57427 + .word 55015 + .word 8445 + .word 53508 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 64958 + .word 65535 + .word 65535 + .word 65535 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 64696 + .word 39566 + .word 31598 + .word 54025 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,304 + .align 2 +_Z: + .word 17728 + .word 31608 + .word 43949 + .word 62778 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 32551 + .word 41874 + .word 44957 + .word 57471 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 18949 + .word 61409 + .word 34437 + .word 41670 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 4396 + .word 34605 + .word 55192 + .word 54573 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 9307 + .word 10310 + .word 55728 + .word 33731 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 7613 + .word 2917 + .word 18234 + .word 40173 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 24292 + .word 42693 + .word 42782 + .word 46612 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 12570 + .word 29960 + .word 47214 + .word 53050 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 24415 + .word 36838 + .word 59299 + .word 59487 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 32322 + .word 22879 + .word 15219 + .word 32962 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 56404 + .word 12107 + .word 18542 + .word 36180 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _Z,@object + .size _Z,176 + .align 2 +_P: + .word 43464 + .word 52019 + .word 16370 + .word 39301 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 45212 + .word 20213 + .word 4367 + .word 36322 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 62182 + .word 43016 + .word 65056 + .word 63104 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 45004 + .word 1793 + .word 2432 + .word 46043 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 10697 + .word 46113 + .word 34013 + .word 35792 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 9065 + .word 41098 + .word 5532 + .word 44900 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 26003 + .word 49876 + .word 4534 + .word 63025 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 42133 + .word 20669 + .word 62629 + .word 33244 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 10663 + .word 14825 + .word 55564 + .word 41652 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 21046 + .word 62601 + .word 18713 + .word 35715 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 28431 + .word 25084 + .word 11881 + .word 39361 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 40049 + .word 63841 + .word 60004 + .word 52172 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 992 + .word 25066 + .word 14104 + .word 49616 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 44948 + .word 43537 + .word 5801 + .word 46886 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 65381 + .word 44162 + .word 41036 + .word 37465 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 14125 + .word 39149 + .word 41569 + .word 43450 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 9425 + .word 2504 + .word 59629 + .word 56004 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 7469 + .word 36200 + .word 7418 + .word 55109 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 63186 + .word 26107 + .word 31425 + .word 52790 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 52143 + .word 25611 + .word 44594 + .word 35227 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 35717 + .word 29166 + .word 20585 + .word 41467 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 2832 + .word 5439 + .word 21266 + .word 33717 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 5378 + .word 24417 + .word 51356 + .word 63335 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 48412 + .word 30659 + .word 29190 + .word 42335 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 9054 + .word 19776 + .word 30431 + .word 35870 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 1836 + .word 17934 + .word 4966 + .word 40411 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 4836 + .word 40500 + .word 17629 + .word 63063 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 23076 + .word 41820 + .word 25860 + .word 58134 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 39832 + .word 57656 + .word 52920 + .word 41521 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 22342 + .word 1014 + .word 59094 + .word 59974 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 25371 + .word 16474 + .word 28775 + .word 38931 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 48127 + .word 54624 + .word 55306 + .word 41258 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 60537 + .word 50282 + .word 14991 + .word 48309 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 15691 + .word 57338 + .word 50654 + .word 33690 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 40468 + .word 19472 + .word 58347 + .word 35325 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 2985 + .word 7922 + .word 38039 + .word 52517 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 33464 + .word 30509 + .word 7663 + .word 49252 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 63790 + .word 6933 + .word 28208 + .word 44856 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 21342 + .word 14964 + .word 50588 + .word 39336 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 56226 + .word 19816 + .word 23757 + .word 47758 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 41064 + .word 34118 + .word 40187 + .word 42472 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 9004 + .word 37522 + .word 42571 + .word 60097 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 40290 + .word 31235 + .word 60424 + .word 63498 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 59943 + .word 36153 + .word 34778 + .word 37099 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 23867 + .word 38881 + .word 17085 + .word 35787 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 43845 + .word 22338 + .word 8742 + .word 34578 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 21920 + .word 9728 + .word 29300 + .word 62498 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 43241 + .word 30911 + .word 50314 + .word 48209 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 5869 + .word 26658 + .word 63775 + .word 40733 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 50245 + .word 25343 + .word 31579 + .word 47683 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 51932 + .word 37189 + .word 37317 + .word 37600 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 35305 + .word 45319 + .word 11991 + .word 61881 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 43727 + .word 7380 + .word 41898 + .word 45538 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 55996 + .word 31666 + .word 20048 + .word 46502 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 20142 + .word 56563 + .word 4676 + .word 64142 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 42758 + .word 26948 + .word 20336 + .word 64653 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 18102 + .word 54076 + .word 11950 + .word 42374 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 55144 + .word 962 + .word 65430 + .word 51473 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 35076 + .word 30182 + .word 41634 + .word 65458 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 45599 + .word 55541 + .word 39885 + .word 63330 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 11397 + .word 64373 + .word 55097 + .word 42716 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 7278 + .word 1186 + .word 16759 + .word 52647 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 55821 + .word 1941 + .word 7835 + .word 62966 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 43692 + .word 51803 + .word 23893 + .word 63855 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 7306 + .word 740 + .word 42177 + .word 35243 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 20304 + .word 26112 + .word 14593 + .word 58152 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 44429 + .word 26104 + .word 43204 + .word 60999 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 43100 + .word 25366 + .word 26069 + .word 39382 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 53318 + .word 3475 + .word 36258 + .word 39277 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 61289 + .word 34432 + .word 35705 + .word 37567 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 47881 + .word 43207 + .word 60352 + .word 35669 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 3664 + .word 62231 + .word 63343 + .word 46625 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 41733 + .word 11611 + .word 33384 + .word 42291 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 22414 + .word 28668 + .word 61827 + .word 33289 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 39839 + .word 31083 + .word 29085 + .word 58078 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 45039 + .word 64406 + .word 35589 + .word 44277 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 21856 + .word 35851 + .word 11264 + .word 37516 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 38193 + .word 55017 + .word 53611 + .word 34369 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 50065 + .word 40254 + .word 39875 + .word 57241 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 21434 + .word 36257 + .word 28860 + .word 44273 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 24899 + .word 55058 + .word 27384 + .word 42408 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 23952 + .word 61552 + .word 63266 + .word 45785 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 20309 + .word 44505 + .word 41003 + .word 61821 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 9759 + .word 19768 + .word 52219 + .word 54624 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 3188 + .word 41981 + .word 52169 + .word 34347 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 7467 + .word 53297 + .word 24491 + .word 48747 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 26956 + .word 25629 + .word 26154 + .word 58912 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 2746 + .word 62708 + .word 29606 + .word 64476 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 23526 + .word 40632 + .word 17955 + .word 37512 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 58003 + .word 45489 + .word 17648 + .word 59859 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 12684 + .word 55359 + .word 8573 + .word 33616 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 29881 + .word 6055 + .word 26438 + .word 36076 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 37160 + .word 17925 + .word 32887 + .word 39269 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 52986 + .word 52867 + .word 51415 + .word 50108 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 29602 + .word 44157 + .word 62211 + .word 53157 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 14158 + .word 17332 + .word 5318 + .word 65232 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 63939 + .word 33203 + .word 7646 + .word 33955 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 29120 + .word 11480 + .word 39280 + .word 50030 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 42029 + .word 1146 + .word 14309 + .word 51502 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 13934 + .word 45324 + .word 64176 + .word 62054 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 407 + .word 40447 + .word 21497 + .word 41724 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 29047 + .word 47840 + .word 58616 + .word 39773 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 45982 + .word 37340 + .word 60343 + .word 60272 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 61708 + .word 5158 + .word 50916 + .word 46783 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 15241 + .word 33011 + .word 52635 + .word 33255 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 27136 + .word 17183 + .word 21500 + .word 41066 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 41313 + .word 44818 + .word 44575 + .word 56585 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 1149 + .word 8286 + .word 16932 + .word 53342 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 29145 + .word 29789 + .word 51640 + .word 35705 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 48645 + .word 17912 + .word 55357 + .word 48589 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 34105 + .word 33794 + .word 2760 + .word 63371 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 30589 + .word 55184 + .word 63547 + .word 57492 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 36766 + .word 25700 + .word 37915 + .word 36654 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 54115 + .word 65102 + .word 9808 + .word 39287 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 15191 + .word 22168 + .word 7058 + .word 49192 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 21631 + .word 11360 + .word 58072 + .word 50534 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 52725 + .word 34636 + .word 1139 + .word 62446 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 53409 + .word 43718 + .word 34635 + .word 38501 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 21083 + .word 16045 + .word 34961 + .word 47202 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 38780 + .word 63942 + .word 22964 + .word 35475 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 58574 + .word 20162 + .word 19964 + .word 40809 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 36576 + .word 45489 + .word 13327 + .word 34648 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 40869 + .word 46352 + .word 6352 + .word 58511 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 38766 + .word 2767 + .word 13055 + .word 40283 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 11002 + .word 40490 + .word 24288 + .word 64180 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 21330 + .word 2672 + .word 53484 + .word 34906 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 11637 + .word 63948 + .word 58709 + .word 54245 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 16451 + .word 23295 + .word 46139 + .word 44738 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 40013 + .word 16865 + .word 3459 + .word 33992 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 28055 + .word 62424 + .word 59084 + .word 40217 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 37015 + .word 7577 + .word 64481 + .word 59907 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 8219 + .word 9822 + .word 27279 + .word 47011 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 859 + .word 2558 + .word 12826 + .word 34425 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 34289 + .word 12934 + .word 665 + .word 63599 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 15142 + .word 54455 + .word 30227 + .word 45946 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 13599 + .word 50987 + .word 20426 + .word 40603 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 224 + .word 55674 + .word 54991 + .word 58096 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 12803 + .word 33902 + .word 43760 + .word 61618 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 3255 + .word 47153 + .word 28829 + .word 43826 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 57503 + .word 42370 + .word 48259 + .word 34977 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 28464 + .word 31222 + .word 4873 + .word 39771 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 7076 + .word 4355 + .word 19850 + .word 60674 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 58695 + .word 18024 + .word 41082 + .word 56674 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 1100 + .word 13540 + .word 64577 + .word 34943 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 25873 + .word 27686 + .word 11323 + .word 61856 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 12188 + .word 35264 + .word 2250 + .word 59962 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 59387 + .word 26772 + .word 9493 + .word 52010 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 50361 + .word 26279 + .word 61391 + .word 38047 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 40446 + .word 22175 + .word 52931 + .word 64839 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 16288 + .word 22519 + .word 41833 + .word 33884 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 22795 + .word 59507 + .word 36930 + .word 56848 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 9090 + .word 34727 + .word 62738 + .word 39279 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 6548 + .word 61899 + .word 57259 + .word 65037 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 20477 + .word 44577 + .word 947 + .word 52780 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 9901 + .word 21929 + .word 34492 + .word 43241 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 52812 + .word 31464 + .word 11463 + .word 33533 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 16273 + .word 3725 + .word 28705 + .word 54534 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 28551 + .word 65013 + .word 38971 + .word 50753 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 55907 + .word 45101 + .word 33737 + .word 41084 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 43426 + .word 25495 + .word 20291 + .word 49461 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 1975 + .word 51775 + .word 24779 + .word 38683 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 29807 + .word 50650 + .word 32397 + .word 53456 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 5564 + .word 52273 + .word 7778 + .word 54851 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 7750 + .word 4868 + .word 38403 + .word 61120 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 15407 + .word 2698 + .word 46605 + .word 59622 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 137 + .word 48802 + .word 34590 + .word 52040 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 61391 + .word 58349 + .word 18865 + .word 49927 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 11732 + .word 37228 + .word 55154 + .word 32778 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 21770 + .word 7395 + .word 32621 + .word 61994 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 14091 + .word 47411 + .word 37523 + .word 57988 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 50358 + .word 51525 + .word 37270 + .word 54151 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 22903 + .word 22329 + .word 47941 + .word 33412 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 47512 + .word 65334 + .word 39843 + .word 61750 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 35590 + .word 32984 + .word 45077 + .word 44683 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 56839 + .word 21073 + .word 60125 + .word 40948 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 16525 + .word 17598 + .word 3587 + .word 56588 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 56933 + .word 2767 + .word 44815 + .word 51549 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 35966 + .word 59943 + .word 1117 + .word 42745 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 40172 + .word 7271 + .word 14707 + .word 38800 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 8476 + .word 4419 + .word 45780 + .word 62512 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 49137 + .word 16671 + .word 19871 + .word 37593 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 63934 + .word 59521 + .word 24158 + .word 47409 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 31258 + .word 33926 + .word 28141 + .word 53090 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 17384 + .word 36966 + .word 994 + .word 53889 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 55527 + .word 7910 + .word 53076 + .word 57518 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 18447 + .word 54969 + .word 49626 + .word 45611 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 13282 + .word 62682 + .word 5627 + .word 48010 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 7550 + .word 10759 + .word 6881 + .word 57138 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 65344 + .word 23540 + .word 39388 + .word 59430 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 2956 + .word 21512 + .word 45255 + .word 50285 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 29054 + .word 47408 + .word 36565 + .word 51766 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 19154 + .word 63758 + .word 53467 + .word 57697 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 22082 + .word 2480 + .word 53967 + .word 58888 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 52243 + .word 32283 + .word 44909 + .word 38447 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 7267 + .word 45206 + .word 61308 + .word 38976 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 10717 + .word 24270 + .word 52189 + .word 48572 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 40118 + .word 3643 + .word 65534 + .word 49002 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 44194 + .word 5661 + .word 50617 + .word 36641 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 26911 + .word 20494 + .word 63331 + .word 36858 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 20013 + .word 62028 + .word 17108 + .word 33468 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 9949 + .word 25572 + .word 4049 + .word 36529 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 39945 + .word 24442 + .word 45585 + .word 42322 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 59756 + .word 52868 + .word 48949 + .word 51417 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 35066 + .word 41141 + .word 44695 + .word 47881 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 42453 + .word 21162 + .word 44569 + .word 55557 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 30136 + .word 39390 + .word 37319 + .word 40338 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 60101 + .word 48639 + .word 6972 + .word 46254 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 56660 + .word 41165 + .word 63413 + .word 50313 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 13109 + .word 12767 + .word 29074 + .word 57119 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 2453 + .word 26502 + .word 15952 + .word 44109 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 44844 + .word 50072 + .word 22431 + .word 49646 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 33416 + .word 16999 + .word 40271 + .word 50445 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 26560 + .word 32264 + .word 54945 + .word 56373 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 58100 + .word 55846 + .word 35515 + .word 33528 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 44190 + .word 42353 + .word 4741 + .word 37259 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 47772 + .word 5308 + .word 50468 + .word 42281 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 53822 + .word 6159 + .word 32580 + .word 46797 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 5509 + .word 51700 + .word 62457 + .word 63728 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 52274 + .word 35926 + .word 43999 + .word 35182 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 33647 + .word 41025 + .word 45844 + .word 37383 + .word 16317 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,3520 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,16 + .align 2 +_PP: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 0 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP,@object + .size _PP,160 + .align 2 +_QP: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _QP,@object + .size _QP,160 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,16 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _tonpi,@object + .size _tonpi,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/j1f.S b/external/sgx_libm/intel64/j1f.S new file mode 100644 index 0000000000..2508345690 --- /dev/null +++ b/external/sgx_libm/intel64/j1f.S @@ -0,0 +1,733 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j1f.c" + .text +..TXTST0: +# -- Begin j1f + .text + .align 16,0x90 + .globl j1f +j1f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_j1f.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + subq $64, %rsp + .cfi_def_cfa_offset 80 + movd %xmm0, %r13d + movss %xmm0, 56(%rsp) + movl %r13d, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jae ..B1.24 +..B1.2: + cmpl $1099993482, %edx + jae ..B1.22 +..B1.3: + cmpl $1075439785, %edx + jae ..B1.16 +..B1.4: + cmpl $1048576000, %edx + jae ..B1.15 +..B1.5: + cmpl $998244352, %edx + jae ..B1.14 +..B1.6: + cmpl $838860800, %edx + jae ..B1.13 +..B1.7: + shrl $31, %r13d + cmpl $8388608, %edx + jbe ..B1.9 +..B1.8: + movl %r13d, %r13d + lea _small_value_32(%rip), %rax + movss .L_2il0floatpacket.0(%rip), %xmm1 + mulss %xmm1, %xmm0 + movss (%rax,%r13,4), %xmm2 + mulss .L_2il0floatpacket.1(%rip), %xmm2 + subss %xmm2, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.9: + testl %edx, %edx + je ..B1.11 +..B1.10: + lea _small_value_32(%rip), %rax + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + movss (%rax,%r13,4), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + cvtss2sd %xmm0, %xmm2 + movss 56(%rsp), %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 + cvtsd2ss %xmm2, %xmm1 + cvtss2sd %xmm0, %xmm0 + movss %xmm1, (%rsp) + subsd %xmm2, %xmm0 + cvtsd2ss %xmm0, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.11: + movss 56(%rsp), %xmm0 +..B1.12: + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.13: + movss 56(%rsp), %xmm0 + lea 8+_Q2(%rip), %rax + mulss .L_2il0floatpacket.0(%rip), %xmm0 + lea _Q2(%rip), %rdx + cvtss2sd %xmm0, %xmm0 + movaps %xmm0, %xmm1 + mulsd %xmm0, %xmm1 + movsd (%rax), %xmm2 + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm0, %xmm2 + addsd %xmm0, %xmm2 + cvtsd2ss %xmm2, %xmm2 + movaps %xmm2, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.14: + movss 56(%rsp), %xmm0 + lea 24+_Q2(%rip), %rax + mulss .L_2il0floatpacket.0(%rip), %xmm0 + lea 16+_Q2(%rip), %rcx + cvtss2sd %xmm0, %xmm0 + movaps %xmm0, %xmm2 + lea 8+_Q2(%rip), %rdx + mulsd %xmm0, %xmm2 + lea _Q2(%rip), %rsi + movaps %xmm2, %xmm1 + mulsd %xmm2, %xmm1 + movsd (%rax), %xmm4 + movsd (%rcx), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm1, %xmm3 + addsd (%rdx), %xmm4 + addsd (%rsi), %xmm3 + mulsd %xmm1, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm4 + mulsd %xmm0, %xmm4 + addsd %xmm0, %xmm4 + cvtsd2ss %xmm4, %xmm4 + movaps %xmm4, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.15: + pxor %xmm3, %xmm3 + lea 80+_Q1(%rip), %r9 + cvtss2sd 56(%rsp), %xmm3 + andps .L_2il0floatpacket.2(%rip), %xmm3 + testl $-2147483648, %r13d + movaps %xmm3, %xmm1 + lea 88+_Q1(%rip), %rax + mulsd %xmm3, %xmm1 + lea 72+_Q1(%rip), %rsi + movaps %xmm1, %xmm2 + lea 64+_Q1(%rip), %r13 + mulsd %xmm1, %xmm2 + lea 48+_Q1(%rip), %r10 + movsd (%r9), %xmm5 + lea 56+_Q1(%rip), %rdx + mulsd %xmm2, %xmm5 + lea 40+_Q1(%rip), %rdi + movsd (%rax), %xmm6 + lea 32+_Q1(%rip), %rax + movsd (%rsi), %xmm0 + lea 16+_Q1(%rip), %r11 + movsd (%r13), %xmm4 + lea 24+_Q1(%rip), %rcx + mulsd %xmm2, %xmm6 + addsd (%r10), %xmm5 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd (%rdx), %xmm6 + mulsd %xmm2, %xmm5 + addsd (%rdi), %xmm0 + addsd (%rax), %xmm4 + mulsd %xmm2, %xmm6 + addsd (%r11), %xmm5 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd (%rcx), %xmm6 + mulsd %xmm1, %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm5 + lea 8+_Q1(%rip), %r8 + lea _Q1(%rip), %rdx + addsd (%r8), %xmm0 + addsd (%rdx), %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm3, %xmm4 + addsd %xmm0, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + movaps %xmm6, %xmm0 + xorps .L_2il0floatpacket.3(%rip), %xmm0 + jne ..L31 + movaps %xmm6, %xmm0 +..L31: + cvtsd2ss %xmm0, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.16: + pxor %xmm3, %xmm3 + andl $-2147483648, %r13d + cvtss2sd 56(%rsp), %xmm3 + andps .L_2il0floatpacket.2(%rip), %xmm3 + cmpl $1097786634, %edx + jae ..B1.20 +..B1.17: + cmpl $1091204523, %edx + jae ..B1.19 +..B1.18: + cmpl $1085318267, %edx + lea _P1(%rip), %rcx + lea _P2(%rip), %rax + jb ..B1.21 + movq %rax, %rcx + jmp ..B1.21 +..B1.19: + cmpl $1094494752, %edx + lea _P3(%rip), %rcx + lea _P4(%rip), %rax + jb ..B1.21 + movq %rax, %rcx + jmp ..B1.21 +..B1.20: + lea _P5(%rip), %rcx +..B1.21: + testl %r13d, %r13d + movsd 96(%rcx), %xmm6 + movsd 80(%rcx), %xmm0 + movsd 88(%rcx), %xmm5 + movsd 72(%rcx), %xmm4 + subsd 104(%rcx), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd 64(%rcx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 48(%rcx), %xmm0 + addsd 56(%rcx), %xmm5 + mulsd %xmm2, %xmm6 + addsd 40(%rcx), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd 32(%rcx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 16(%rcx), %xmm0 + addsd 24(%rcx), %xmm5 + mulsd %xmm2, %xmm6 + addsd 8(%rcx), %xmm4 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + mulsd %xmm3, %xmm4 + addsd %xmm0, %xmm6 + mulsd %xmm3, %xmm5 + addsd (%rcx), %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + movaps %xmm6, %xmm0 + xorps .L_2il0floatpacket.3(%rip), %xmm0 + jne ..L37 + movaps %xmm6, %xmm0 +..L37: + cvtsd2ss %xmm0, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.22: + pxor %xmm0, %xmm0 + lea _val_16_0(%rip), %rax + cvtss2sd 56(%rsp), %xmm0 + andps .L_2il0floatpacket.2(%rip), %xmm0 + lea 8(%rsp), %rdi + movsd .L_2il0floatpacket.4(%rip), %xmm1 + lea 16(%rsp), %rsi + divsd %xmm0, %xmm1 + movsd (%rax), %xmm2 + movl $-3, %edx + mulsd %xmm1, %xmm2 + andl $-2147483648, %r13d + movsd %xmm2, 8(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm2, 24(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm1, 16(%rsi) + movsd %xmm2, 32(%rsi) +..___tag_value_j1f.43: + call __libm_sincos_k32@PLT +..___tag_value_j1f.44: +..B1.23: + lea 40+_QP(%rip), %r10 + lea 40+_PP(%rip), %rdx + movsd 48(%rsp), %xmm2 + lea 24+_QP(%rip), %r11 + lea 24+_PP(%rip), %rcx + lea 32+_PP(%rip), %rdi + lea _tonpi(%rip), %rax + lea 16+_PP(%rip), %r8 + movsd (%r10), %xmm5 + lea 8+_PP(%rip), %rsi + movsd (%rdx), %xmm6 + lea 32+_QP(%rip), %rdx + mulsd %xmm2, %xmm5 + lea _PP(%rip), %r9 + mulsd %xmm2, %xmm6 + addsd (%r11), %xmm5 + addsd (%rcx), %xmm6 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm6 + movsd (%rdx), %xmm4 + lea 16+_QP(%rip), %rcx + mulsd %xmm2, %xmm4 + addsd (%rsi), %xmm6 + movsd (%rdi), %xmm1 + lea _QP(%rip), %rsi + mulsd %xmm2, %xmm1 + addsd (%rcx), %xmm4 + movsd (%rax), %xmm0 + lea 8+_QP(%rip), %rax + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm1 + mulsd 32(%rsp), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm1 + addsd (%rsi), %xmm4 + sqrtsd %xmm0, %xmm0 + addsd (%r9), %xmm1 + movsd 40(%rsp), %xmm3 + testl %r13d, %r13d + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm1, %xmm6 + mulsd 24(%rsp), %xmm5 + mulsd 16(%rsp), %xmm6 + mulsd 8(%rsp), %xmm5 + subsd %xmm5, %xmm6 + mulsd %xmm6, %xmm0 + movaps %xmm0, %xmm2 + xorps .L_2il0floatpacket.3(%rip), %xmm2 + jne ..L45 + movaps %xmm0, %xmm2 +..L45: + cvtsd2ss %xmm2, %xmm2 + movaps %xmm2, %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.24: + ja ..B1.26 +..B1.25: + lea _zeros(%rip), %rax + shrl $31, %r13d + movss (%rax,%r13,4), %xmm0 + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 +..B1.26: + movss 56(%rsp), %xmm0 +..B1.27: + addq $64, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type j1f,@function + .size j1f,.-j1f + .data +# -- End j1f + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x3f000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x0d800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_Q2: + .long 4294942533 + .long 3219128319 + .long 1380922587 + .long 1068848469 + .long 4229217063 + .long 3212603831 + .long 2485211372 + .long 1060546867 + .type _Q2,@object + .size _Q2,32 + .align 4 +_Q1: + .long 4294875887 + .long 1071644671 + .long 4170968197 + .long 1038133990 + .long 82133904 + .long 3215982592 + .long 2332230043 + .long 1043853917 + .long 2564340116 + .long 1063605580 + .long 220691470 + .long 1046506888 + .long 254563561 + .long 3205265147 + .long 694808779 + .long 1046622203 + .long 4019568744 + .long 1051070668 + .long 1556554770 + .long 1044540217 + .long 1786312313 + .long 3191946521 + .long 1750363188 + .long 1039907362 + .type _Q1,@object + .size _Q1,96 + .align 4 +_P1: + .long 3288017007 + .long 3163666881 + .long 1479173198 + .long 3218720463 + .long 2681037136 + .long 1068165283 + .long 482223942 + .long 1068193949 + .long 1641242500 + .long 3212130132 + .long 3602486439 + .long 3210890035 + .long 1295520927 + .long 1059513544 + .long 2893642677 + .long 1057503730 + .long 2144568350 + .long 3200875225 + .long 914896231 + .long 3198366754 + .long 1774974526 + .long 1046581392 + .long 3090631217 + .long 1043566169 + .long 3310618599 + .long 3186783429 + .long 1974431497 + .long 1074702165 + .type _P1,@object + .size _P1,112 + .align 4 +_P2: + .long 216484910 + .long 1015040375 + .long 3011708428 + .long 1070806296 + .long 3332724636 + .long 3214272269 + .long 3160644008 + .long 3215461507 + .long 2925435221 + .long 1063888050 + .long 725350898 + .long 1063337916 + .long 297499451 + .long 3206574940 + .long 3278099830 + .long 3204945545 + .long 2222993240 + .long 1053042193 + .long 2059286351 + .long 1050869046 + .long 306569625 + .long 3193793299 + .long 95256688 + .long 3191038309 + .long 616794992 + .long 1039029534 + .long 4088689232 + .long 1075580917 + .type _P2,@object + .size _P2,112 + .align 4 +_P3: + .long 1314465059 + .long 1017127215 + .long 1413823668 + .long 3218077268 + .long 4087546795 + .long 1065951807 + .long 3559351807 + .long 1067757765 + .long 338531188 + .long 3210711466 + .long 2516776276 + .long 3210695105 + .long 1548953411 + .long 1058452686 + .long 3819184955 + .long 1057373236 + .long 1262833741 + .long 3200137243 + .long 325214128 + .long 3198310046 + .long 1253465703 + .long 1045913252 + .long 3453826356 + .long 1043528319 + .long 2667154656 + .long 3186140571 + .long 3502111785 + .long 1076123856 + .type _P3,@object + .size _P3,112 + .align 4 +_P4: + .long 1657852450 + .long 3163577804 + .long 2020212262 + .long 1070330675 + .long 774106997 + .long 3212888122 + .long 2119717923 + .long 3215085957 + .long 2098754573 + .long 1062575793 + .long 2137093530 + .long 1063017421 + .long 2437037263 + .long 3205513537 + .long 2698759453 + .long 3204752976 + .long 1998212634 + .long 1052165362 + .long 2817762251 + .long 1050764623 + .long 357372240 + .long 3193071576 + .long 3891599306 + .long 3190966182 + .long 2865549426 + .long 1038348895 + .long 4077970850 + .long 1076536762 + .type _P4,@object + .size _P4,112 + .align 4 +_P5: + .long 1537387514 + .long 3166104464 + .long 4237757176 + .long 3217630662 + .long 789391682 + .long 1064857043 + .long 3122547501 + .long 1067488355 + .long 3303098147 + .long 3209681410 + .long 2944525948 + .long 3210343613 + .long 1468487066 + .long 1057519518 + .long 285546763 + .long 1057172625 + .long 830693909 + .long 3199311383 + .long 1284260698 + .long 3198182585 + .long 1823688212 + .long 1045254801 + .long 1962790020 + .long 1043427779 + .long 1867031598 + .long 3185590079 + .long 906299589 + .long 1076918395 + .type _P5,@object + .size _P5,112 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_QP: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP,@object + .size _QP,48 + .align 4 +_PP: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP,@object + .size _PP,48 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/j1l.S b/external/sgx_libm/intel64/j1l.S new file mode 100644 index 0000000000..936d12f68b --- /dev/null +++ b/external/sgx_libm/intel64/j1l.S @@ -0,0 +1,86 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "j1l.c" + .text +..TXTST0: +# -- Begin j1l + .text + .align 16,0x90 + .globl j1l +j1l: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_j1l.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 48 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B1.6: + addq $16, %rsp + .cfi_def_cfa_offset 32 + movaps (%rsp), %xmm0 +..___tag_value_j1l.6: + call __j1q@PLT +..___tag_value_j1l.7: +..B1.2: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type j1l,@function + .size j1l,.-j1l + .data +# -- End j1l + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/jn.S b/external/sgx_libm/intel64/jn.S new file mode 100644 index 0000000000..05c0135d90 --- /dev/null +++ b/external/sgx_libm/intel64/jn.S @@ -0,0 +1,1714 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "jn.c" + .text +..TXTST0: +# -- Begin jn + .text + .align 16,0x90 + .globl jn +jn: +# parameter 1: %edi +# parameter 2: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_jn.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + subq $208, %rsp + .cfi_def_cfa_offset 240 + movl %edi, %ebx + movsd %xmm0, (%rsp) + movl $1, %r14d + xorb %r15b, %r15b +..B1.2: + fnstcw 194(%rsp) +..B1.3: + movzwl 6(%rsp), %eax + andl $32752, %eax + cmpl $32752, %eax + je ..B1.74 +..B1.4: + testl %ebx, %ebx + je ..B1.55 +..B1.5: + lea _zeros(%rip), %rsi + movsd (%rsp), %xmm2 + movsd (%rsi), %xmm0 + ucomisd %xmm0, %xmm2 + jp ..B1.6 + je ..B1.79 +..B1.6: + testl %ebx, %ebx + jge ..B1.8 +..B1.7: + movl %ebx, %eax + negl %ebx + notl %eax + andl $1, %eax + lea -1(%rax,%rax), %r14d +..B1.8: + comisd %xmm2, %xmm0 + jbe ..B1.10 +..B1.9: + movl %r14d, %eax + negl %eax + testb $1, %bl + xorps .L_2il0floatpacket.1(%rip), %xmm2 + movsd %xmm2, (%rsp) + cmovne %eax, %r14d +..B1.10: + cmpl $1, %ebx + je ..B1.78 +..B1.11: + movl %ebx, %ecx + sarl $5, %ecx + cmpl $160, %ecx + jg ..B1.13 +..B1.12: + movslq %ecx, %rcx + lea XZERO(%rip), %rax + movsd (%rax,%rcx,8), %xmm1 + jmp ..B1.14 +..B1.13: + pxor %xmm1, %xmm1 + lea -640(,%rcx,4), %eax + lea (,%rax,8), %ecx + subl %eax, %ecx + cvtsi2sd %ecx, %xmm1 + addsd .L_2il0floatpacket.0(%rip), %xmm1 +..B1.14: + comisd %xmm2, %xmm1 + ja ..B1.83 +..B1.15: + movzwl 194(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.19 +..B1.16: + orl $-64768, %ecx + movw %cx, 192(%rsp) +..B1.17: + fldcw 192(%rsp) +..B1.18: + movsd (%rsp), %xmm2 + movb $1, %r15b +..B1.19: + movsd %xmm2, 80(%rsp) + cmpl $1753, %ebx + fldl 80(%rsp) + movl %ebx, 80(%rsp) + fildl 80(%rsp) + jg ..B1.32 +..B1.20: + fldt val_0_4(%rip) + fmul %st(1), %st + fcomip %st(2), %st + jbe ..B1.32 +..B1.21: + fstp %st(0) + lea _val_2_0L(%rip), %rax + lea _val_1_0L(%rip), %rcx + testl %ebx, %ebx + fldt (%rax) + fdivrp %st, %st(1) + fldt (%rcx) + movl $0, %ecx + fld %st(0) + movl %ecx, %eax + fld %st(0) + fld %st(2) + fld %st(3) + jle ..B1.25 +..B1.23: + incl %ecx + fmul %st(5), %st + cmpl %ebx, %ecx + jb ..B1.23 +..B1.25: + movl %eax, %ecx + testl %ebx, %ebx + jle ..B1.28 +..B1.27: + incl %ecx + fxch %st(1) + fmul %st(3), %st + fxch %st(3) + fadd %st(4), %st + cmpl %ebx, %ecx + fxch %st(3) + fxch %st(1) + jb ..B1.27 +..B1.28: + fstp %st(3) +..B1.29: + fxch %st(4) + fmul %st(0), %st + fchs +..B1.30: + incl %eax + incl %ebx + movl %eax, %ecx + fld %st(3) + imull %ebx, %ecx + fxch %st(1) + fmul %st, %st(2) + movl %ecx, 80(%rsp) + fildl 80(%rsp) + fdivrp %st, %st(3) + fxch %st(2) + fadd %st, %st(4) + fxch %st(1) + fucomip %st(4), %st + fxch %st(1) + jne ..B1.30 + jp ..B1.30 +..B1.31: + fstp %st(0) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(2) + fdivrp %st, %st(1) + fxch %st(1) + fstpt 32(%rsp) + jmp ..B1.45 +..B1.32: + fcomi %st(1), %st + ja ..B1.51 +..B1.33: + lea _val_20_0L(%rip), %rax + lea _val_1000_0L(%rip), %rcx + fldt (%rax) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fcomip %st(2), %st + ja ..B1.57 +..B1.34: + lea _val_4_0L(%rip), %rax + fld %st(0) + lea _val_1_0L(%rip), %rdi + lea _val_8_0L(%rip), %rsi + lea _val_2_0L(%rip), %r8 + lea _val_3_0L(%rip), %r9 + lea _val_5_0L(%rip), %r10 + movl $-1, %ecx + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fldt (%rax) + xorb %al, %al + fstpt 144(%rsp) + fldt 144(%rsp) + fmulp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fldt (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + fldt (%rdi) + fld %st(0) + fsubrp %st, %st(3) + fxch %st(1) + fdivrp %st, %st(2) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 80(%rsp) + fldt (%r8) + fstpt 128(%rsp) + fldt 128(%rsp) + fstpt 32(%rsp) + fldt (%r9) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt (%r10) + fstpt (%rsp) + fldt (%rsp) + fldt 96(%rsp) + fldt 32(%rsp) + fldt 16(%rsp) +..B1.35: + fldt 160(%rsp) + fld %st(3) + fmul %st(4), %st + testl %ecx, %ecx + fxch %st(4) + fstpt 96(%rsp) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt 176(%rsp) + fsub %st, %st(4) + fxch %st(3) + fdivrp %st, %st(4) + fxch %st(6) + fmulp %st, %st(3) + fld %st(3) + fmul %st(4), %st + fsubrp %st, %st(2) + fdivrp %st, %st(1) + fmul %st(1), %st + fldt 96(%rsp) + fldt 32(%rsp) + jle ..B1.37 +..B1.36: + fxch %st(3) + faddp %st, %st(6) + fldt 48(%rsp) + fadd %st(2), %st + fstpt 48(%rsp) + jmp ..B1.38 +..B1.37: + fxch %st(3) + fsubrp %st, %st(6) + fldt 48(%rsp) + fsub %st(2), %st + fstpt 48(%rsp) +..B1.38: + fldt 128(%rsp) + fadd %st, %st(3) + faddp %st, %st(5) + fldt 144(%rsp) + fadd %st, %st(1) + faddp %st, %st(4) + fld %st(1) + fdiv %st(6), %st + fabs + fldt 80(%rsp) + fcomip %st(1), %st + jbe ..B1.40 +..B1.39: + fstpt 80(%rsp) + movb $1, %al + jmp ..B1.41 +..B1.40: + fstp %st(0) + testb %al, %al + jne ..B1.56 +..B1.41: + fldt (%rsp) + negl %ecx + fucomip %st(6), %st + fxch %st(2) + fxch %st(1) + fxch %st(5) + jne ..B1.35 + jp ..B1.35 +..B1.42: + fstp %st(4) + fstp %st(1) + fstp %st(0) + fstp %st(0) + fldt 64(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) + fldt 112(%rsp) +..B1.43: + addl %ebx, %ebx + addq $-16, %rsp + .cfi_def_cfa_offset 256 + negl %ebx + lea 16(%rsp), %rdi + decl %ebx + lea 48(%rsp), %rsi + movl %ebx, %edx + fstpt (%rsp) + fldt (%rsp) + fstpt 80(%rsi) +..___tag_value_jn.11: + call __libm_sincos_pi4l@PLT +..___tag_value_jn.12: +..B1.82: + fldt 128(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 240 +..B1.44: + fldt 16(%rsp) + lea _tonpi(%rip), %rax + fldt (%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fdivp %st, %st(3) + fxch %st(2) + fsqrt + fldt 32(%rsp) + fmulp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fmulp %st, %st(1) +..B1.45: + testl %r14d, %r14d + jl ..B1.47 +..B1.46: + fstpt (%rsp) + jmp ..B1.48 +..B1.47: + fchs + fstpt (%rsp) +..B1.48: + testb %r15b, %r15b + je ..B1.50 +..B1.49: + fldcw 194(%rsp) +..B1.50: + fldt (%rsp) + fstpl 16(%rsp) + movsd 16(%rsp), %xmm0 + addq $208, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.51: + fstp %st(0) + fld %st(0) + lea (%rbx,%rbx), %esi + movl %esi, 80(%rsp) + lea _val_1_0L(%rip), %rcx + lea _val_2_0L(%rip), %rdi + lea _val_0_0L(%rip), %rax + fmul %st(1), %st + fchs + fstpt 64(%rsp) + fld %st(0) + fxch %st(1) + fstpt 112(%rsp) + fldt (%rax) + fldt (%rcx) + fstpt 32(%rsp) + fldt 32(%rsp) + fld %st(0) + fxch %st(1) + fstpt 16(%rsp) + fildl 80(%rsp) + fstpt (%rsp) + fldt (%rsp) + fldt (%rdi) + fstpt 48(%rsp) + fldt (%rsp) + jmp ..B1.52 +..B1.53: + fstp %st(3) + fxch %st(1) + fxch %st(2) + fxch %st(4) + fxch %st(3) + fxch %st(1) +..B1.52: + fldt 48(%rsp) + faddp %st, %st(1) + fld %st(4) + fmul %st(1), %st + fld %st(2) + fmul %st(2), %st + fldt 64(%rsp) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(2) + fldt 32(%rsp) + fmulp %st, %st(6) + faddp %st, %st(5) + fld %st(0) + fxch %st(1) + fdiv %st(5), %st + fucomi %st(4), %st + fxch %st(3) + fstpt 32(%rsp) + jne ..B1.53 + jp ..B1.53 + jmp ..B1.67 +..B1.55: + movsd (%rsp), %xmm0 + call j0@PLT +..B1.83: + addq $208, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.56: + fstp %st(4) + fstp %st(3) + fstp %st(0) + fstp %st(0) + fldt 64(%rsp) + fstpt (%rsp) + fxch %st(1) + fstpt 16(%rsp) + fstpt 32(%rsp) + fldt 112(%rsp) + jmp ..B1.43 +..B1.57: + fstp %st(0) + lea _val_36_0L(%rip), %rax + fldt (%rax) + fcomi %st(1), %st + jbe ..B1.61 +..B1.58: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 256 + fstpt (%rsp) + fldt (%rsp) + fstpt 128(%rsp) +..___tag_value_jn.37: + call __j0l@PLT +..___tag_value_jn.38: +..B1.84: + fldt 128(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 240 +..B1.59: + fxch %st(1) + fstpt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 256 + fstpt (%rsp) + fldt (%rsp) + fstpt 128(%rsp) +..___tag_value_jn.41: + call __j1l@PLT +..___tag_value_jn.42: +..B1.85: + fldt 128(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 240 +..B1.60: + fxch %st(1) + jmp ..B1.63 +..B1.61: + lea _ones(%rip), %rax + lea _PP0(%rip), %rcx + lea 16+_PP0(%rip), %r9 + lea _PP1(%rip), %r8 + lea 16+_PP1(%rip), %r10 + lea 32+_PP0(%rip), %r11 + lea 48+_PP1(%rip), %rsi + lea 64+_PP0(%rip), %rdi + fldl (%rax) + lea 32+_PP1(%rip), %rax + fdiv %st(2), %st + movl $-1, %edx + fmul %st, %st(1) + fld %st(1) + fmul %st(2), %st + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(1) + fstpt (%rsp) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rcx) + lea 48+_PP0(%rip), %rcx + fmul %st(2), %st + fldt (%r8) + lea 64+_PP1(%rip), %r8 + fmul %st(3), %st + fldt (%r9) + lea 80+_PP0(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r10) + lea 80+_PP1(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + lea 96+_PP0(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 96+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 112+_PP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 112+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 128+_PP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 128+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 144+_PP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 144+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 256 + lea 112(%rsp), %rdi + lea 96(%rsp), %rsi + fxch %st(3) + fstpt (%rsp) + fldt (%rsp) + fstpt 32(%rsi) + fldt (%rax) + lea _QP0(%rip), %rax + faddp %st, %st(3) + fxch %st(2) + fstpt -32(%rsi) + fldt (%rax) + lea _QP1(%rip), %rax + fmul %st(1), %st + fldt (%rax) + lea 16+_QP0(%rip), %rax + fmul %st(2), %st + fldt (%rax) + lea 16+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 32+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 32+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 48+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 48+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 64+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 64+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 80+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 80+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 96+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 96+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 112+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 112+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 144+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rax) + lea 144+_QP1(%rip), %rax + faddp %st, %st(1) + fmul %st(2), %st + fstpt -48(%rsi) + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -16(%rsi) +..___tag_value_jn.45: + call __libm_sincos_pi4l@PLT +..___tag_value_jn.46: +..B1.86: + fldt 128(%rsp) + fldt 80(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 240 +..B1.62: + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt 80(%rsp) + fldt 16(%rsp) + fmul %st(1), %st + fxch %st(5) + fmulp %st, %st(1) + fldt (%rax) + fmulp %st, %st(2) + fxch %st(1) + fsqrt + fldt 96(%rsp) + fmul %st, %st(3) + fxch %st(3) + fsubrp %st, %st(5) + fmul %st, %st(4) + fxch %st(4) + fstpt 32(%rsp) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) +..B1.63: + lea _val_2_0L(%rip), %rax + cmpl $1, %ebx + fldt (%rax) + movl $0, %eax + fld %st(0) + jle ..B1.91 +..B1.64: + fldt 32(%rsp) + decl %ebx +..B1.65: + fld %st(1) + incl %eax + fdiv %st(5), %st + cmpl %ebx, %eax + fmul %st(4), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(2) + fsubp %st, %st(1) + fld %st(3) + jae ..B1.66 +..B1.92: + fstp %st(4) + fxch %st(3) + jmp ..B1.65 +..B1.66: + fstp %st(5) + fstp %st(4) + fstp %st(0) + fstp %st(0) + fstpt 32(%rsp) + jmp ..B1.45 +..B1.67: + fstp %st(2) + fstp %st(4) + fstp %st(0) + fstp %st(1) + fstp %st(1) + fldt 48(%rsp) + decl %ebx + fldt 16(%rsp) + xorl %eax, %eax + movl %ebx, 80(%rsp) + fld %st(0) + fxch %st(1) + fdiv %st, %st(3) + fildl 80(%rsp) + fmul %st(3), %st + fldt 112(%rsp) + fdivr %st, %st(3) +..B1.68: + fld %st(5) + incl %eax + fmul %st(2), %st + fxch %st(2) + fsub %st(5), %st + fxch %st(1) + fmul %st, %st(3) + cmpl %ebx, %eax + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fld %st(5) + fld %st(1) + jge ..B1.69 +..B1.93: + fstp %st(7) + fstp %st(1) + fxch %st(2) + jmp ..B1.68 +..B1.69: + fstp %st(0) + fstp %st(4) + fstp %st(4) + fstp %st(0) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(1) + fabs + fxch %st(1) + fabs + fcomip %st(1), %st + fstp %st(0) + fxch %st(1) + fstpt (%rsp) + jae ..B1.72 + jp ..B1.72 +..B1.70: + addq $-16, %rsp + .cfi_def_cfa_offset 256 + fstpt (%rsp) +..___tag_value_jn.49: + call __j1l@PLT +..___tag_value_jn.50: +..B1.87: + addq $16, %rsp + .cfi_def_cfa_offset 240 +..B1.71: + fldt (%rsp) + fdivrp %st, %st(1) + jmp ..B1.45 +..B1.72: + addq $-16, %rsp + .cfi_def_cfa_offset 256 + fstpt (%rsp) +..___tag_value_jn.53: + call __j0l@PLT +..___tag_value_jn.54: +..B1.88: + addq $16, %rsp + .cfi_def_cfa_offset 240 +..B1.73: + fldt 32(%rsp) + fdivrp %st, %st(1) + jmp ..B1.45 +..B1.74: + testl $1048575, 4(%rsp) + jne ..B1.77 +..B1.75: + cmpl $0, (%rsp) + jne ..B1.77 +..B1.76: + movzbl 7(%rsp), %ecx + movl %ebx, %eax + andl $128, %ecx + lea _zeros(%rip), %rdx + shrl $7, %ecx + shrl $31, %eax + xorl %eax, %ecx + andl %ebx, %ecx + movsd (%rdx,%rcx,8), %xmm0 + addq $208, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.77: + movsd (%rsp), %xmm0 + addq $208, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.78: + movaps %xmm2, %xmm0 + call j1@PLT +..B1.89: + movaps %xmm0, %xmm1 + testl %r14d, %r14d + xorps .L_2il0floatpacket.1(%rip), %xmm1 + jge ..L78 + movaps %xmm1, %xmm0 +..L78: + addq $208, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.79: + movzbl 7(%rsp), %ecx + movl %ebx, %eax + andl $128, %ecx + shrl $7, %ecx + shrl $31, %eax + xorl %eax, %ecx + andl %ebx, %ecx + movsd (%rsi,%rcx,8), %xmm0 + addq $208, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 240 + .cfi_offset 3, -32 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.91: + fstp %st(3) + fstp %st(2) + fstp %st(1) + jmp ..B1.45 + .align 16,0x90 + .cfi_endproc + .type jn,@function + .size jn,.-jn + .data +# -- End jn + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +val_0_4: + .byte 0x00,0xd0,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xfd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type val_0_4,@object + .size val_0_4,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40add600 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +XZERO: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x33333333,0x3fd33333 + .long 0x66666666,0x3ff66666 + .long 0x00000000,0x400c0000 + .long 0x00000000,0x401c0000 + .long 0x00000000,0x40280000 + .long 0xcccccccd,0x40324ccc + .long 0x00000000,0x403a0000 + .long 0x00000000,0x40418000 + .long 0x9999999a,0x40469999 + .long 0x00000000,0x404c4000 + .long 0x33333333,0x40513333 + .long 0x00000000,0x40548000 + .long 0x00000000,0x40580000 + .long 0x33333333,0x405bb333 + .long 0xcccccccd,0x405f8ccc + .long 0xcccccccd,0x4061cccc + .long 0x33333333,0x4063e333 + .long 0xcccccccd,0x40660ccc + .long 0x33333333,0x40684333 + .long 0xcccccccd,0x406a8ccc + .long 0x33333333,0x406ce333 + .long 0x66666666,0x406f4666 + .long 0x9999999a,0x4070d999 + .long 0x00000000,0x40721800 + .long 0x9999999a,0x40735999 + .long 0x9999999a,0x4074a199 + .long 0x66666666,0x4075ee66 + .long 0x00000000,0x40774000 + .long 0xcccccccd,0x407894cc + .long 0x66666666,0x4079ee66 + .long 0x33333333,0x407b4b33 + .long 0x33333333,0x407cab33 + .long 0x00000000,0x407e1000 + .long 0x66666666,0x407f7666 + .long 0xcccccccd,0x408070cc + .long 0x33333333,0x40812733 + .long 0x33333333,0x4081df33 + .long 0xcccccccd,0x408298cc + .long 0x33333333,0x40835333 + .long 0x33333333,0x40840f33 + .long 0xcccccccd,0x4084cccc + .long 0x66666666,0x40858a66 + .long 0x66666666,0x40864a66 + .long 0x66666666,0x40870a66 + .long 0x00000000,0x4087cc00 + .long 0x66666666,0x40888e66 + .long 0x9999999a,0x40895199 + .long 0x9999999a,0x408a1599 + .long 0x33333333,0x408adb33 + .long 0xcccccccd,0x408ba0cc + .long 0x00000000,0x408c6000 + .long 0x00000000,0x408d2800 + .long 0x00000000,0x408df000 + .long 0x00000000,0x408ec000 + .long 0x00000000,0x408f8800 + .long 0x00000000,0x40902800 + .long 0x00000000,0x40909000 + .long 0x00000000,0x4090f400 + .long 0x00000000,0x40915c00 + .long 0x00000000,0x4091c000 + .long 0x00000000,0x40922800 + .long 0x00000000,0x40929000 + .long 0x00000000,0x4092f800 + .long 0x00000000,0x40935c00 + .long 0x00000000,0x4093c400 + .long 0x00000000,0x40943000 + .long 0x00000000,0x40949800 + .long 0x00000000,0x40950000 + .long 0x00000000,0x40956800 + .long 0x00000000,0x4095d000 + .long 0x00000000,0x40963c00 + .long 0x00000000,0x4096a400 + .long 0x00000000,0x40971000 + .long 0x00000000,0x40977800 + .long 0x00000000,0x4097e400 + .long 0x00000000,0x40984c00 + .long 0x00000000,0x4098b800 + .long 0x00000000,0x40992400 + .long 0x00000000,0x40999000 + .long 0x00000000,0x4099f800 + .long 0x00000000,0x409a6400 + .long 0x00000000,0x409ad000 + .long 0x00000000,0x409b3c00 + .long 0x00000000,0x409ba800 + .long 0x00000000,0x409c1400 + .long 0x00000000,0x409c8000 + .long 0x00000000,0x409cec00 + .long 0x00000000,0x409d5c00 + .long 0x00000000,0x409dc800 + .long 0x00000000,0x409e3400 + .long 0x00000000,0x409ea000 + .long 0x00000000,0x409f1000 + .long 0x00000000,0x409f7c00 + .long 0x00000000,0x409fe800 + .long 0x00000000,0x40a02c00 + .long 0x00000000,0x40a06200 + .long 0x00000000,0x40a09a00 + .long 0x00000000,0x40a0d000 + .long 0x00000000,0x40a10800 + .long 0x00000000,0x40a13e00 + .long 0x00000000,0x40a17600 + .long 0x00000000,0x40a1ae00 + .long 0x00000000,0x40a1e400 + .long 0x00000000,0x40a21c00 + .long 0x00000000,0x40a25400 + .long 0x00000000,0x40a28c00 + .long 0x00000000,0x40a2c200 + .long 0x00000000,0x40a2fa00 + .long 0x00000000,0x40a33200 + .long 0x00000000,0x40a36a00 + .long 0x00000000,0x40a3a200 + .long 0x00000000,0x40a3da00 + .long 0x00000000,0x40a41200 + .long 0x00000000,0x40a44a00 + .long 0x00000000,0x40a48200 + .long 0x00000000,0x40a4ba00 + .long 0x00000000,0x40a4f200 + .long 0x00000000,0x40a52a00 + .long 0x00000000,0x40a56200 + .long 0x00000000,0x40a59a00 + .long 0x00000000,0x40a5d200 + .long 0x00000000,0x40a60a00 + .long 0x00000000,0x40a64400 + .long 0x00000000,0x40a67c00 + .long 0x00000000,0x40a6b400 + .long 0x00000000,0x40a6ec00 + .long 0x00000000,0x40a72600 + .long 0x00000000,0x40a75e00 + .long 0x00000000,0x40a79600 + .long 0x00000000,0x40a7d000 + .long 0x00000000,0x40a80800 + .long 0x00000000,0x40a84000 + .long 0x00000000,0x40a87a00 + .long 0x00000000,0x40a8b200 + .long 0x00000000,0x40a8ec00 + .long 0x00000000,0x40a92400 + .long 0x00000000,0x40a95c00 + .long 0x00000000,0x40a99600 + .long 0x00000000,0x40a9ce00 + .long 0x00000000,0x40aa0800 + .long 0x00000000,0x40aa4200 + .long 0x00000000,0x40aa7a00 + .long 0x00000000,0x40aab400 + .long 0x00000000,0x40aaec00 + .long 0x00000000,0x40ab2600 + .long 0x00000000,0x40ab6000 + .long 0x00000000,0x40ab9800 + .long 0x00000000,0x40abd200 + .long 0x00000000,0x40ac0a00 + .long 0x00000000,0x40ac4400 + .long 0x00000000,0x40ac7e00 + .long 0x00000000,0x40acb800 + .long 0x00000000,0x40acf000 + .long 0x00000000,0x40ad2a00 + .long 0x00000000,0x40ad6400 + .long 0x00000000,0x40ad9e00 + .long 0x00000000,0x40add600 + .type XZERO,@object + .size XZERO,1288 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_val_2_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _val_2_0L,@object + .size _val_2_0L,16 + .align 2 +_val_1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _val_1_0L,@object + .size _val_1_0L,16 + .align 2 +_val_20_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16387 + .word 0 + .word 0 + .word 0 + .type _val_20_0L,@object + .size _val_20_0L,16 + .align 2 +_val_1000_0L: + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .word 0 + .word 0 + .type _val_1000_0L,@object + .size _val_1000_0L,16 + .align 2 +_val_4_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16385 + .word 0 + .word 0 + .word 0 + .type _val_4_0L,@object + .size _val_4_0L,16 + .align 2 +_val_8_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16386 + .word 0 + .word 0 + .word 0 + .type _val_8_0L,@object + .size _val_8_0L,16 + .align 2 +_val_3_0L: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _val_3_0L,@object + .size _val_3_0L,16 + .align 2 +_val_5_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16385 + .word 0 + .word 0 + .word 0 + .type _val_5_0L,@object + .size _val_5_0L,16 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _tonpi,@object + .size _tonpi,16 + .align 2 +_val_0_0L: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _val_0_0L,@object + .size _val_0_0L,16 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,16 + .align 2 +_PP0: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP0,@object + .size _PP0,160 + .align 2 +_PP1: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 0 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP1,@object + .size _PP1,160 + .align 2 +_QP0: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .word 0 + .word 0 + .type _QP0,@object + .size _QP0,160 + .align 2 +_QP1: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _QP1,@object + .size _QP1,160 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/jnf.S b/external/sgx_libm/intel64/jnf.S new file mode 100644 index 0000000000..3638f57366 --- /dev/null +++ b/external/sgx_libm/intel64/jnf.S @@ -0,0 +1,1156 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "jnf.c" + .text +..TXTST0: +# -- Begin jnf + .text + .align 16,0x90 + .globl jnf +jnf: +# parameter 1: %edi +# parameter 2: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_jnf.1: +..L2: + + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + subq $72, %rsp + .cfi_def_cfa_offset 96 + movl %edi, %r14d + movd %xmm0, %r15d + movss %xmm0, (%rsp) + movl %r15d, %ecx + andl $2147483647, %ecx + cmpl $2139095040, %ecx + jae ..B1.41 +..B1.2: + testl %r14d, %r14d + je ..B1.40 +..B1.3: + xorl %r14d, %r15d + shrl $31, %r15d + andl %r14d, %r15d + testl %ecx, %ecx + je ..B1.39 +..B1.4: + movl %r14d, %eax + cltd + xorl %edx, %r14d + subl %edx, %r14d + andps .L_2il0floatpacket.1(%rip), %xmm0 + cmpl $1, %r14d + movss %xmm0, (%rsp) + je ..B1.58 +..B1.5: + movl %r14d, %esi + sarl $3, %esi + cmpl $320, %esi + jg ..B1.7 +..B1.6: + movslq %esi, %rsi + lea function_zeros(%rip), %rcx + movss (%rcx,%rsi,4), %xmm2 + jmp ..B1.8 +..B1.7: + pxor %xmm2, %xmm2 + lea -320(%rsi), %ecx + lea -2560(,%rsi,8), %esi + subl %ecx, %esi + cvtsi2ss %esi, %xmm2 + addss .L_2il0floatpacket.0(%rip), %xmm2 +..B1.8: + comiss %xmm0, %xmm2 + ja ..B1.38 +..B1.9: + pxor %xmm1, %xmm1 + pxor %xmm3, %xmm3 + cvtss2sd %xmm0, %xmm1 + cvtsi2sd %r14d, %xmm3 + cmpl $170, %r14d + jg ..B1.22 +..B1.10: + lea _val_0_6(%rip), %rcx + movsd (%rcx), %xmm2 + mulsd %xmm3, %xmm2 + comisd %xmm1, %xmm2 + jb ..B1.22 +..B1.11: + lea _val_2_0(%rip), %rcx + testl %r14d, %r14d + movsd .L_2il0floatpacket.2(%rip), %xmm4 + movaps %xmm4, %xmm3 + movaps %xmm4, %xmm0 + movaps %xmm4, %xmm2 + divsd (%rcx), %xmm1 + movl $0, %ecx + jle ..B1.15 +..B1.13: + incl %ecx + mulsd %xmm1, %xmm0 + cmpl %r14d, %ecx + jb ..B1.13 +..B1.14: + testl %r14d, %r14d +..B1.15: + movl $0, %ecx + jle ..B1.19 +..B1.17: + incl %ecx + mulsd %xmm2, %xmm3 + addsd %xmm4, %xmm2 + cmpl %r14d, %ecx + jb ..B1.17 +..B1.19: + mulsd %xmm1, %xmm1 + lea _TWO_19H(%rip), %rsi + movsd %xmm4, 16(%rsp) + xorl %ecx, %ecx + movsd %xmm4, 56(%rsp) + xorps .L_2il0floatpacket.4(%rip), %xmm1 + movsd (%rsi), %xmm2 + .align 16,0x90 +..B1.20: + incl %ecx + incl %r14d + movl %ecx, %esi + movaps %xmm4, %xmm8 + imull %r14d, %esi + pxor %xmm4, %xmm4 + movsd 16(%rsp), %xmm5 + movaps %xmm2, %xmm7 + movsd 56(%rsp), %xmm6 + mulsd %xmm1, %xmm5 + cvtsi2sd %esi, %xmm4 + divsd %xmm4, %xmm5 + movsd %xmm5, 16(%rsp) + addsd %xmm5, %xmm6 + mulsd %xmm6, %xmm7 + movsd %xmm6, 56(%rsp) + addsd %xmm7, %xmm6 + movsd %xmm6, 64(%rsp) + movsd 64(%rsp), %xmm4 + subsd %xmm7, %xmm4 + ucomisd %xmm4, %xmm8 + jne ..B1.20 + jp ..B1.20 +..B1.21: + mulsd 56(%rsp), %xmm0 + divsd %xmm3, %xmm0 + jmp ..B1.34 +..B1.22: + comisd %xmm1, %xmm3 + ja ..B1.35 +..B1.23: + pxor %xmm2, %xmm2 + lea (%r14,%r14,4), %ecx + lea 1000(,%rcx,4), %esi + cvtsi2sd %esi, %xmm2 + comisd %xmm1, %xmm2 + ja ..B1.47 +..B1.24: + lea _val_4_0(%rip), %rcx + movaps %xmm3, %xmm10 + lea _val_8_0(%rip), %rdi + lea _val_2_0(%rip), %r8 + movsd .L_2il0floatpacket.2(%rip), %xmm12 + lea _val_3_0(%rip), %r9 + lea _val_5_0(%rip), %r10 + movl $-1, %esi + movsd (%rcx), %xmm11 + movaps %xmm12, %xmm2 + movsd (%rdi), %xmm8 + movaps %xmm12, %xmm9 + movsd (%r8), %xmm7 + xorb %cl, %cl + mulsd %xmm11, %xmm10 + movaps %xmm7, %xmm6 + mulsd %xmm1, %xmm8 + mulsd %xmm3, %xmm10 + movaps %xmm10, %xmm13 + movsd (%r9), %xmm5 + subsd %xmm12, %xmm13 + divsd %xmm8, %xmm13 + movsd %xmm13, 16(%rsp) + movaps %xmm5, %xmm4 + movsd (%r10), %xmm3 +..B1.25: + movaps %xmm4, %xmm14 + movaps %xmm6, %xmm15 + mulsd %xmm4, %xmm14 + testl %esi, %esi + mulsd %xmm8, %xmm15 + movsd %xmm2, 56(%rsp) + movaps %xmm10, %xmm2 + subsd %xmm14, %xmm2 + movaps %xmm3, %xmm14 + mulsd %xmm3, %xmm14 + divsd %xmm15, %xmm2 + movaps %xmm10, %xmm15 + mulsd 16(%rsp), %xmm2 + subsd %xmm14, %xmm15 + movaps %xmm8, %xmm14 + mulsd %xmm5, %xmm14 + divsd %xmm14, %xmm15 + mulsd %xmm2, %xmm15 + jle ..B1.46 +..B1.26: + addsd %xmm2, %xmm12 + addsd %xmm15, %xmm13 +..B1.27: + movsd %xmm15, 16(%rsp) + addsd %xmm7, %xmm6 + divsd %xmm12, %xmm15 + andps .L_2il0floatpacket.3(%rip), %xmm15 + addsd %xmm7, %xmm5 + addsd %xmm11, %xmm4 + addsd %xmm11, %xmm3 + comisd %xmm15, %xmm9 + jbe ..B1.29 +..B1.28: + movaps %xmm15, %xmm9 + movb $1, %cl + jmp ..B1.30 +..B1.29: + testb %cl, %cl + jne ..B1.32 +..B1.30: + lea _TWO_19H(%rip), %rdi + movaps %xmm12, %xmm2 + negl %esi + movsd (%rdi), %xmm14 + mulsd %xmm12, %xmm14 + addsd %xmm14, %xmm2 + movsd %xmm2, 64(%rsp) + movsd 64(%rsp), %xmm2 + subsd %xmm14, %xmm2 + ucomisd 56(%rsp), %xmm2 + jne ..B1.25 + jp ..B1.25 +..B1.32: + addl %r14d, %r14d + lea 56(%rsp), %rdi + negl %r14d + lea 16(%rsp), %rsi + decl %r14d + movaps %xmm1, %xmm0 + movl %r14d, %edx + movsd %xmm13, (%rsp) + movsd %xmm12, -8(%rsi) + movsd %xmm1, 32(%rsi) +..___tag_value_jnf.8: + call __libm_sincos_k32@PLT +..___tag_value_jnf.9: +..B1.33: + lea _tonpi(%rip), %rax + movsd 48(%rsp), %xmm1 + movsd 8(%rsp), %xmm12 + movsd (%rsp), %xmm13 + movsd (%rax), %xmm0 + divsd %xmm1, %xmm0 + sqrtsd %xmm0, %xmm0 + mulsd 16(%rsp), %xmm12 + mulsd 56(%rsp), %xmm13 + subsd %xmm13, %xmm12 + mulsd %xmm12, %xmm0 +..B1.34: + movaps %xmm0, %xmm1 + testl %r15d, %r15d + xorps .L_2il0floatpacket.4(%rip), %xmm1 + jne ..L10 + movaps %xmm0, %xmm1 +..L10: + cvtsd2ss %xmm1, %xmm1 + movaps %xmm1, %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.35: + pxor %xmm8, %xmm8 + lea (%r14,%r14), %esi + cvtsi2sd %esi, %xmm8 + movaps %xmm1, %xmm7 + xorl %ecx, %ecx + mulsd %xmm1, %xmm7 + lea _val_2_0(%rip), %rdi + lea _TWO_19H(%rip), %r8 + pxor %xmm11, %xmm11 + movsd .L_2il0floatpacket.2(%rip), %xmm3 + movaps %xmm1, %xmm9 + movq %rcx, 56(%rsp) + movaps %xmm3, %xmm10 + xorps .L_2il0floatpacket.4(%rip), %xmm7 + movaps %xmm8, %xmm6 + movsd %xmm3, 16(%rsp) + movsd (%rdi), %xmm4 + movsd (%r8), %xmm5 + jmp ..B1.36 +..B1.37: + movsd %xmm12, 56(%rsp) + movsd %xmm12, 16(%rsp) +..B1.36: + movaps %xmm9, %xmm2 + movaps %xmm8, %xmm12 + mulsd %xmm7, %xmm11 + addsd %xmm4, %xmm6 + mulsd %xmm7, %xmm10 + mulsd %xmm6, %xmm2 + mulsd %xmm6, %xmm12 + addsd %xmm11, %xmm2 + addsd %xmm10, %xmm12 + movaps %xmm9, %xmm11 + movaps %xmm2, %xmm9 + divsd %xmm12, %xmm2 + movaps %xmm5, %xmm14 + movaps %xmm8, %xmm10 + mulsd %xmm2, %xmm14 + movaps %xmm12, %xmm8 + movaps %xmm14, %xmm13 + movsd 16(%rsp), %xmm15 + addsd %xmm2, %xmm13 + movsd %xmm13, 64(%rsp) + movsd 64(%rsp), %xmm12 + subsd %xmm14, %xmm12 + ucomisd %xmm12, %xmm15 + jne ..B1.37 + jp ..B1.37 + jmp ..B1.55 +..B1.38: + pxor %xmm0, %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.39: + lea _zeros(%rip), %rax + movss (%rax,%r15,4), %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.40: + movss (%rsp), %xmm0 + call j0f@PLT +..B1.61: + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.41: + ja ..B1.43 +..B1.42: + lea _zeros(%rip), %rax + xorl %r14d, %r15d + shrl $31, %r15d + andl %r14d, %r15d + movss (%rax,%r15,4), %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.43: + movss (%rsp), %xmm0 +..B1.44: + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 14, -16 + .cfi_offset 15, -24 +..B1.46: + subsd %xmm2, %xmm12 + subsd %xmm15, %xmm13 + jmp ..B1.27 +..B1.47: + lea _val_17_0(%rip), %rcx + movsd (%rcx), %xmm2 + comisd %xmm1, %xmm2 + jbe ..B1.49 +..B1.48: + movaps %xmm1, %xmm0 + movsd %xmm1, 48(%rsp) + call j0@PLT +..B1.63: + movsd 48(%rsp), %xmm1 + movaps %xmm0, %xmm2 + movaps %xmm1, %xmm0 + movsd %xmm2, (%rsp) + call j1@PLT +..B1.62: + movsd 48(%rsp), %xmm1 + movsd (%rsp), %xmm2 + jmp ..B1.51 +..B1.49: + movsd .L_2il0floatpacket.2(%rip), %xmm2 + lea _val_16_0(%rip), %rcx + divsd %xmm1, %xmm2 + movsd (%rcx), %xmm8 + movaps %xmm1, %xmm0 + mulsd %xmm2, %xmm8 + lea (%rsp), %rdi + movaps %xmm8, %xmm6 + lea 8(%rsp), %rsi + mulsd %xmm8, %xmm6 + movl $-1, %edx + movaps %xmm6, %xmm7 + mulsd %xmm6, %xmm7 + movq $0, 48(%rsi) + movsd %xmm2, 8(%rsi) + movsd %xmm6, 16(%rsi) + movsd %xmm7, 24(%rsi) + movsd %xmm8, 32(%rsi) + movsd %xmm1, 40(%rsi) +..___tag_value_jnf.59: + call __libm_sincos_k32@PLT +..___tag_value_jnf.60: +..B1.50: + lea 40+_PP1(%rip), %r11 + lea 40+_PP0(%rip), %rcx + movsd 32(%rsp), %xmm7 + lea 24+_PP0(%rip), %rsi + lea 8+_PP0(%rip), %rdi + lea 32+_PP0(%rip), %r8 + movsd 24(%rsp), %xmm6 + lea 16+_PP0(%rip), %r9 + movsd (%r11), %xmm10 + lea _PP0(%rip), %r10 + movsd (%rcx), %xmm2 + lea 24+_PP1(%rip), %rcx + movsd (%r8), %xmm3 + movsd 40(%rsp), %xmm8 + mulsd %xmm7, %xmm10 + mulsd %xmm7, %xmm2 + mulsd %xmm7, %xmm3 + addsd (%rcx), %xmm10 + addsd (%rsi), %xmm2 + addsd (%r9), %xmm3 + mulsd %xmm7, %xmm10 + mulsd %xmm7, %xmm2 + mulsd %xmm7, %xmm3 + addsd (%rdi), %xmm2 + addsd (%r10), %xmm3 + mulsd %xmm6, %xmm2 + lea 8+_PP1(%rip), %rcx + addsd %xmm3, %xmm2 + addsd (%rcx), %xmm10 + lea 32+_PP1(%rip), %rcx + mulsd %xmm6, %xmm10 + movsd (%rcx), %xmm4 + lea 16+_PP1(%rip), %rcx + mulsd %xmm7, %xmm4 + movsd 48(%rsp), %xmm1 + addsd (%rcx), %xmm4 + lea _PP1(%rip), %rcx + mulsd %xmm7, %xmm4 + addsd (%rcx), %xmm4 + lea 40+_QP0(%rip), %rcx + movsd (%rcx), %xmm9 + lea 24+_QP0(%rip), %rcx + mulsd %xmm7, %xmm9 + addsd %xmm4, %xmm10 + addsd (%rcx), %xmm9 + lea 8+_QP0(%rip), %rcx + mulsd %xmm7, %xmm9 + addsd (%rcx), %xmm9 + lea 32+_QP0(%rip), %rcx + movsd (%rcx), %xmm5 + lea 16+_QP0(%rip), %rcx + mulsd %xmm7, %xmm5 + mulsd %xmm6, %xmm9 + addsd (%rcx), %xmm5 + mulsd %xmm8, %xmm9 + mulsd %xmm7, %xmm5 + lea _QP0(%rip), %rcx + addsd (%rcx), %xmm5 + lea 40+_QP1(%rip), %rcx + movsd (%rcx), %xmm11 + lea 24+_QP1(%rip), %rcx + mulsd %xmm7, %xmm11 + mulsd %xmm8, %xmm5 + addsd (%rcx), %xmm11 + addsd %xmm5, %xmm9 + mulsd %xmm7, %xmm11 + lea 8+_QP1(%rip), %rcx + addsd (%rcx), %xmm11 + lea 32+_QP1(%rip), %rcx + mulsd %xmm6, %xmm11 + movsd (%rcx), %xmm6 + lea 16+_QP1(%rip), %rcx + mulsd %xmm7, %xmm6 + mulsd %xmm8, %xmm11 + addsd (%rcx), %xmm6 + mulsd %xmm7, %xmm6 + lea _QP1(%rip), %rcx + movsd 8(%rsp), %xmm7 + mulsd %xmm7, %xmm2 + addsd (%rcx), %xmm6 + lea _tonpi(%rip), %rcx + mulsd %xmm8, %xmm6 + movsd (%rcx), %xmm0 + addsd %xmm6, %xmm11 + mulsd 16(%rsp), %xmm0 + mulsd %xmm11, %xmm7 + sqrtsd %xmm0, %xmm0 + movsd (%rsp), %xmm8 + mulsd %xmm8, %xmm9 + mulsd %xmm10, %xmm8 + subsd %xmm9, %xmm2 + addsd %xmm7, %xmm8 + mulsd %xmm0, %xmm2 + mulsd %xmm8, %xmm0 +..B1.51: + lea _val_2_0(%rip), %rcx + cmpl $1, %r14d + movsd (%rcx), %xmm3 + movl $0, %ecx + divsd %xmm1, %xmm3 + jle ..B1.34 +..B1.52: + decl %r14d +..B1.53: + incl %ecx + pxor %xmm1, %xmm1 + cvtsi2sd %ecx, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm0, %xmm4 + mulsd %xmm0, %xmm1 + cmpl %r14d, %ecx + movaps %xmm1, %xmm0 + subsd %xmm2, %xmm0 + movaps %xmm4, %xmm2 + jb ..B1.53 + jmp ..B1.34 +..B1.55: + movaps %xmm3, %xmm6 + lea -2(%r14,%r14), %ecx + divsd %xmm2, %xmm6 + pxor %xmm5, %xmm5 + movaps %xmm3, %xmm2 + cvtsi2sd %ecx, %xmm5 + divsd %xmm1, %xmm2 + xorl %ecx, %ecx + decl %r14d +..B1.56: + movaps %xmm6, %xmm7 + incl %ecx + mulsd %xmm5, %xmm7 + subsd %xmm4, %xmm5 + mulsd %xmm1, %xmm3 + cmpl %r14d, %ecx + subsd %xmm3, %xmm7 + mulsd %xmm2, %xmm7 + movaps %xmm6, %xmm3 + movaps %xmm7, %xmm6 + jl ..B1.56 +..B1.57: + movaps %xmm1, %xmm0 + movsd %xmm7, (%rsp) + call j0@PLT +..B1.64: + divsd (%rsp), %xmm0 + jmp ..B1.34 +..B1.58: + call j1f@PLT +..B1.65: + movaps %xmm0, %xmm1 + testl %r15d, %r15d + xorps .L_2il0floatpacket.5(%rip), %xmm1 + je ..L61 + movaps %xmm1, %xmm0 +..L61: + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type jnf,@function + .size jnf,.-jnf + .data +# -- End jnf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x7fffffff,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.3: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .long 0x80000000,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x450ea000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +function_zeros: + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x3f000000 + .long 0x3fcccccd + .long 0x40600000 + .long 0x40c33333 + .long 0x4111999a + .long 0x414b3333 + .long 0x4184cccd + .long 0x41a66666 + .long 0x41ca6666 + .long 0x41f0cccd + .long 0x420c0000 + .long 0x42206666 + .long 0x4235999a + .long 0x424b3333 + .long 0x42613333 + .long 0x42780000 + .long 0x42876666 + .long 0x42930000 + .long 0x429ecccd + .long 0x42aacccd + .long 0x42b6cccd + .long 0x42c30000 + .long 0x42cf6666 + .long 0x42dbcccd + .long 0x42e86666 + .long 0x42f50000 + .long 0x4300e666 + .long 0x43074ccd + .long 0x430db333 + .long 0x43143333 + .long 0x431ab333 + .long 0x43214ccd + .long 0x4327e666 + .long 0x432e8000 + .long 0x4335199a + .long 0x433bcccd + .long 0x43428000 + .long 0x43493333 + .long 0x43500000 + .long 0x43560000 + .long 0x435d0000 + .long 0x43640000 + .long 0x436b0000 + .long 0x43720000 + .long 0x43780000 + .long 0x437f0000 + .long 0x43830000 + .long 0x43868000 + .long 0x438a0000 + .long 0x438d8000 + .long 0x43910000 + .long 0x43948000 + .long 0x43980000 + .long 0x439b8000 + .long 0x439f0000 + .long 0x43a28000 + .long 0x43a60000 + .long 0x43a98000 + .long 0x43ad0000 + .long 0x43b08000 + .long 0x43b40000 + .long 0x43b78000 + .long 0x43bb0000 + .long 0x43bf0000 + .long 0x43c28000 + .long 0x43c60000 + .long 0x43c98000 + .long 0x43cd0000 + .long 0x43d08000 + .long 0x43d40000 + .long 0x43d80000 + .long 0x43db8000 + .long 0x43df0000 + .long 0x43e28000 + .long 0x43e60000 + .long 0x43ea0000 + .long 0x43ed8000 + .long 0x43f10000 + .long 0x43f48000 + .long 0x43f88000 + .long 0x43fc0000 + .long 0x43ff8000 + .long 0x44018000 + .long 0x44038000 + .long 0x44054000 + .long 0x44070000 + .long 0x44090000 + .long 0x440ac000 + .long 0x440c8000 + .long 0x440e4000 + .long 0x44104000 + .long 0x44120000 + .long 0x4413c000 + .long 0x4415c000 + .long 0x44178000 + .long 0x44194000 + .long 0x441b4000 + .long 0x441d0000 + .long 0x441ec000 + .long 0x4420c000 + .long 0x44228000 + .long 0x44244000 + .long 0x44264000 + .long 0x44280000 + .long 0x442a0000 + .long 0x442bc000 + .long 0x442d8000 + .long 0x442f8000 + .long 0x44314000 + .long 0x44334000 + .long 0x44350000 + .long 0x4436c000 + .long 0x4438c000 + .long 0x443a8000 + .long 0x443c8000 + .long 0x443e4000 + .long 0x44400000 + .long 0x44420000 + .long 0x4443c000 + .long 0x4445c000 + .long 0x44478000 + .long 0x44498000 + .long 0x444b4000 + .long 0x444d0000 + .long 0x444f0000 + .long 0x4450c000 + .long 0x4452c000 + .long 0x44548000 + .long 0x44568000 + .long 0x44584000 + .long 0x445a4000 + .long 0x445c0000 + .long 0x445e0000 + .long 0x445fc000 + .long 0x4461c000 + .long 0x44638000 + .long 0x44658000 + .long 0x44674000 + .long 0x44694000 + .long 0x446b0000 + .long 0x446cc000 + .long 0x446ec000 + .long 0x44708000 + .long 0x44728000 + .long 0x44744000 + .long 0x44764000 + .long 0x44784000 + .long 0x447a0000 + .long 0x447c0000 + .long 0x447dc000 + .long 0x447fc000 + .long 0x4480c000 + .long 0x4481c000 + .long 0x4482a000 + .long 0x4483a000 + .long 0x44848000 + .long 0x44858000 + .long 0x44866000 + .long 0x44876000 + .long 0x44884000 + .long 0x44894000 + .long 0x448a2000 + .long 0x448b2000 + .long 0x448c0000 + .long 0x448d0000 + .long 0x448e0000 + .long 0x448ee000 + .long 0x448fe000 + .long 0x4490c000 + .long 0x4491c000 + .long 0x4492a000 + .long 0x4493a000 + .long 0x44948000 + .long 0x44958000 + .long 0x44968000 + .long 0x44976000 + .long 0x44986000 + .long 0x44994000 + .long 0x449a4000 + .long 0x449b2000 + .long 0x449c2000 + .long 0x449d2000 + .long 0x449e0000 + .long 0x449f0000 + .long 0x449fe000 + .long 0x44a0e000 + .long 0x44a1c000 + .long 0x44a2c000 + .long 0x44a3c000 + .long 0x44a4a000 + .long 0x44a5a000 + .long 0x44a68000 + .long 0x44a78000 + .long 0x44a88000 + .long 0x44a96000 + .long 0x44aa6000 + .long 0x44ab4000 + .long 0x44ac4000 + .long 0x44ad4000 + .long 0x44ae2000 + .long 0x44af2000 + .long 0x44b00000 + .long 0x44b10000 + .long 0x44b20000 + .long 0x44b2e000 + .long 0x44b3e000 + .long 0x44b4c000 + .long 0x44b5c000 + .long 0x44b6c000 + .long 0x44b7a000 + .long 0x44b8a000 + .long 0x44b9a000 + .long 0x44ba8000 + .long 0x44bb8000 + .long 0x44bc6000 + .long 0x44bd6000 + .long 0x44be6000 + .long 0x44bf4000 + .long 0x44c04000 + .long 0x44c14000 + .long 0x44c22000 + .long 0x44c32000 + .long 0x44c40000 + .long 0x44c50000 + .long 0x44c60000 + .long 0x44c6e000 + .long 0x44c7e000 + .long 0x44c8e000 + .long 0x44c9c000 + .long 0x44cac000 + .long 0x44cba000 + .long 0x44cca000 + .long 0x44cda000 + .long 0x44ce8000 + .long 0x44cf8000 + .long 0x44d08000 + .long 0x44d16000 + .long 0x44d26000 + .long 0x44d36000 + .long 0x44d44000 + .long 0x44d54000 + .long 0x44d64000 + .long 0x44d72000 + .long 0x44d82000 + .long 0x44d92000 + .long 0x44da0000 + .long 0x44db0000 + .long 0x44dc0000 + .long 0x44dce000 + .long 0x44dde000 + .long 0x44dec000 + .long 0x44dfc000 + .long 0x44e0c000 + .long 0x44e1a000 + .long 0x44e2a000 + .long 0x44e3a000 + .long 0x44e48000 + .long 0x44e58000 + .long 0x44e68000 + .long 0x44e76000 + .long 0x44e86000 + .long 0x44e96000 + .long 0x44ea4000 + .long 0x44eb4000 + .long 0x44ec4000 + .long 0x44ed4000 + .long 0x44ee2000 + .long 0x44ef2000 + .long 0x44f02000 + .long 0x44f10000 + .long 0x44f20000 + .long 0x44f30000 + .long 0x44f3e000 + .long 0x44f4e000 + .long 0x44f5e000 + .long 0x44f6c000 + .long 0x44f7c000 + .long 0x44f8c000 + .long 0x44f9a000 + .long 0x44faa000 + .long 0x44fba000 + .long 0x44fc8000 + .long 0x44fd8000 + .long 0x44fe8000 + .long 0x44ff6000 + .long 0x45003000 + .long 0x4500b000 + .long 0x45013000 + .long 0x4501a000 + .long 0x45022000 + .long 0x4502a000 + .long 0x45031000 + .long 0x45039000 + .long 0x45041000 + .long 0x45048000 + .long 0x45050000 + .long 0x45058000 + .long 0x4505f000 + .long 0x45067000 + .long 0x4506f000 + .long 0x45077000 + .long 0x4507e000 + .long 0x45086000 + .long 0x4508e000 + .long 0x45095000 + .long 0x4509d000 + .long 0x450a5000 + .long 0x450ac000 + .long 0x450b4000 + .long 0x450bc000 + .long 0x450c4000 + .long 0x450cb000 + .long 0x450d3000 + .long 0x450db000 + .long 0x450e2000 + .long 0x450ea000 + .type function_zeros,@object + .size function_zeros,1284 + .align 4 +_val_0_6: + .long 858993459 + .long 1071854387 + .type _val_0_6,@object + .size _val_0_6,8 + .align 4 +_val_2_0: + .long 0 + .long 1073741824 + .type _val_2_0,@object + .size _val_2_0,8 + .align 4 +_TWO_19H: + .long 0 + .long 1093140480 + .type _TWO_19H,@object + .size _TWO_19H,8 + .align 4 +_val_4_0: + .long 0 + .long 1074790400 + .type _val_4_0,@object + .size _val_4_0,8 + .align 4 +_val_8_0: + .long 0 + .long 1075838976 + .type _val_8_0,@object + .size _val_8_0,8 + .align 4 +_val_3_0: + .long 0 + .long 1074266112 + .type _val_3_0,@object + .size _val_3_0,8 + .align 4 +_val_5_0: + .long 0 + .long 1075052544 + .type _val_5_0,@object + .size _val_5_0,8 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_val_17_0: + .long 0 + .long 1076953088 + .type _val_17_0,@object + .size _val_17_0,8 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_PP1: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP1,@object + .size _PP1,48 + .align 4 +_PP0: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP0,@object + .size _PP0,48 + .align 4 +_QP0: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP0,@object + .size _QP0,48 + .align 4 +_QP1: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP1,@object + .size _QP1,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/jnl.S b/external/sgx_libm/intel64/jnl.S new file mode 100644 index 0000000000..57e13b0eec --- /dev/null +++ b/external/sgx_libm/intel64/jnl.S @@ -0,0 +1,95 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "jnl.c" + .text +..TXTST0: +# -- Begin jnl + .text + .align 16,0x90 + .globl jnl +jnl: +# parameter 1: %edi +# parameter 2: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_jnl.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + movl %edi, %ebp + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 48 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B1.6: + addq $16, %rsp + .cfi_def_cfa_offset 32 + movl %ebp, %edi + movaps (%rsp), %xmm0 +..___tag_value_jnl.8: + call __jnq@PLT +..___tag_value_jnl.9: +..B1.2: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B1.7: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type jnl,@function + .size jnl,.-jnl + .data +# -- End jnl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/l2q.S b/external/sgx_libm/intel64/l2q.S new file mode 100644 index 0000000000..a238bae0f1 --- /dev/null +++ b/external/sgx_libm/intel64/l2q.S @@ -0,0 +1,106 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "l2q.c" + .text +..TXTST0: +# -- Begin __ltoq + .text + .align 16,0x90 + .globl __ltoq +__ltoq: +# parameter 1: %rdi +# parameter 2: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value___ltoq.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 16(%rsp) +..B1.3: + movzwl 16(%rsp), %eax + orl $-64768, %eax + movw %ax, 18(%rsp) +..B1.4: + fldcw 18(%rsp) +..B1.5: + fldt 32(%rsp) + lea __l_one(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.6: + fldcw 16(%rsp) +..B1.7: + movq (%rsp), %rsi + movq %rsi, %rax + shrq $15, %rsi + movq $0xffffffffffff, %rdx + movl 8(%rsp), %ecx + andq %rdx, %rsi + shlq $48, %rcx + shlq $49, %rax + orq %rcx, %rsi + movq %rax, (%rdi) + movq %rsi, 8(%rdi) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __ltoq,@function + .size __ltoq,.-__ltoq + .data +# -- End __ltoq + .section .rodata, "a" + .align 4 + .align 4 +__l_one: + .long 0 + .long 2147483648 + .long 16383 + .type __l_one,@object + .size __l_one,12 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ldexp_gen.S b/external/sgx_libm/intel64/ldexp_gen.S new file mode 100644 index 0000000000..2be804be25 --- /dev/null +++ b/external/sgx_libm/intel64/ldexp_gen.S @@ -0,0 +1,194 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ldexp_gen.c" + .text +..TXTST0: +# -- Begin ldexp + .text + .align 16,0x90 + .globl ldexp +ldexp: +# parameter 1: %xmm0 +# parameter 2: %edi +..B1.1: + .cfi_startproc +..___tag_value_ldexp.1: +..L2: + + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %esi + movl %esi, %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + je ..B1.17 +..B1.2: + xorb %r8b, %r8b + testl %ecx, %ecx + jne ..B1.7 +..B1.3: + testl $1048575, -4(%rsp) + jne ..B1.6 +..B1.4: + cmpl $0, -8(%rsp) + jne ..B1.6 +..B1.5: + movsd -8(%rsp), %xmm0 + ret +..B1.6: + lea _TWO_55(%rip), %rax + movb $1, %r8b + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %esi + movl %esi, %ecx + andl $32752, %ecx + shrl $4, %ecx + addl $-55, %ecx +..B1.7: + movl $65536, %eax + cmpl $65536, %edi + cmovg %eax, %edi + movl $-65536, %edx + cmpl $-65536, %edi + cmovle %edx, %edi + lea (%rcx,%rdi), %eax + testl %eax, %eax + jle ..B1.12 +..B1.8: + cmpl $2047, %eax + jge ..B1.11 +..B1.9: + andl $2047, %eax + andl $-32753, %esi + shll $4, %eax + orl %eax, %esi + movw %si, -2(%rsp) + movsd -8(%rsp), %xmm0 +..B1.10: + ret +..B1.11: + movb -1(%rsp), %al + lea _large_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.12: + cmpl $-52, %eax + jl ..B1.16 +..B1.13: + lea 8+_TWO_55(%rip), %rdx + lea 55(%rcx,%rdi), %eax + andl $2047, %eax + andl $-32753, %esi + shll $4, %eax + orl %eax, %esi + movw %si, -2(%rsp) + testb %r8b, %r8b + movsd -8(%rsp), %xmm0 + mulsd (%rdx), %xmm0 + je ..B1.15 +..B1.14: + testl %edi, %edi + jl ..B1.10 +..B1.15: + ret +..B1.16: + movb -1(%rsp), %al + lea _small_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.17: + lea _ones(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type ldexp,@function + .size ldexp,.-ldexp + .data +# -- End ldexp + .section .rodata, "a" + .align 4 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .type _TWO_55,@object + .size _TWO_55,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ldexpf.S b/external/sgx_libm/intel64/ldexpf.S new file mode 100644 index 0000000000..cc0d200317 --- /dev/null +++ b/external/sgx_libm/intel64/ldexpf.S @@ -0,0 +1,185 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ldexpf.c" + .text +..TXTST0: +# -- Begin ldexpf + .text + .align 16,0x90 + .globl ldexpf +ldexpf: +# parameter 1: %xmm0 +# parameter 2: %edi +..B1.1: + .cfi_startproc +..___tag_value_ldexpf.1: +..L2: + + movl %edi, %r8d + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %eax + movl %eax, %esi + andl $32640, %esi + shrl $7, %esi + cmpl $255, %esi + je ..B1.9 +..B1.2: + xorb %dil, %dil + testl %esi, %esi + jne ..B1.5 +..B1.3: + testl $8388607, -8(%rsp) + je ..B1.9 +..B1.4: + movss -8(%rsp), %xmm0 + movb $1, %dil + mulss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %eax + movl %eax, %esi + andl $32640, %esi + shrl $7, %esi + addl $-25, %esi +..B1.5: + movl $65536, %edx + cmpl $65536, %r8d + cmovg %edx, %r8d + movl $-65536, %ecx + cmpl $-65536, %r8d + cmovle %ecx, %r8d + lea (%rsi,%r8), %edx + testl %edx, %edx + jle ..B1.11 +..B1.6: + cmpl $255, %edx + jge ..B1.10 +..B1.7: + movzbl %dl, %edx + andl $-32641, %eax + shll $7, %edx + orl %edx, %eax + movw %ax, -6(%rsp) + movss -8(%rsp), %xmm0 +..B1.8: + ret +..B1.9: + movss -8(%rsp), %xmm0 + ret +..B1.10: + movb -5(%rsp), %al + lea _large_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + ret +..B1.11: + cmpl $-23, %edx + jl ..B1.15 +..B1.12: + andl $-32641, %eax + lea 25(%rsi,%r8), %edx + movzbl %dl, %edx + shll $7, %edx + orl %edx, %eax + movw %ax, -6(%rsp) + testb %dil, %dil + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.3(%rip), %xmm0 + je ..B1.14 +..B1.13: + testl %r8d, %r8d + jl ..B1.8 +..B1.14: + ret +..B1.15: + movb -5(%rsp), %al + lea _small_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.2(%rip), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type ldexpf,@function + .size ldexpf,.-ldexpf + .data +# -- End ldexpf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x0d800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x33000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ldexpl.S b/external/sgx_libm/intel64/ldexpl.S new file mode 100644 index 0000000000..60cbda83a4 --- /dev/null +++ b/external/sgx_libm/intel64/ldexpl.S @@ -0,0 +1,321 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ldexpl.c" + .text +..TXTST0: +# -- Begin ldexpl + .text + .align 16,0x90 + .globl ldexpl +ldexpl: +# parameter 1: 32 + %rsp +# parameter 2: %edi +..B1.1: + .cfi_startproc +..___tag_value_ldexpl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 40(%rsp), %r8d + movl %r8d, %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.39 +..B1.4: + testl %esi, %esi + jne ..B1.12 +..B1.5: + cmpq $0, 32(%rsp) + je ..B1.15 +..B1.6: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.7: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.8: + fldcw 16(%rsp) +..B1.9: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) +..B1.10: + fldcw 18(%rsp) +..B1.11: + movzwl 40(%rsp), %r8d + movl %r8d, %esi + andl $32767, %esi + addl $-75, %esi +..B1.12: + movl $65536, %edx + cmpl $65536, %edi + cmovg %edx, %edi + movl $-65536, %ecx + xorb %al, %al + cmpl $-65536, %edi + cmovle %ecx, %edi + lea (%rsi,%rdi), %edx + testl %edx, %edx + jle ..B1.23 +..B1.13: + cmpl $32767, %edx + jge ..B1.16 +..B1.14: + andl $-32768, %r8d + andl $32767, %edx + orl %edx, %r8d + movw %r8w, 40(%rsp) + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.15: + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.16: + movzwl 18(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.17: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.18: + fldcw 16(%rsp) +..B1.19: + movb $1, %al +..B1.20: + movb 41(%rsp), %dl + lea _large_value_80(%rip), %rsi + andb $-128, %dl + shrb $7, %dl + fldt (%rsi) + movzbl %dl, %ecx + shlq $4, %rcx + testb %al, %al + fldt (%rsi,%rcx) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.22 +..B1.21: + fldcw 18(%rsp) +..B1.22: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.23: + cmpl $-63, %edx + jl ..B1.31 +..B1.24: + andl $-32768, %r8d + lea 75(%rsi,%rdi), %eax + andl $32767, %eax + orl %eax, %r8d + movzwl 18(%rsp), %eax + movl %eax, %edx + andl $768, %edx + movw %r8w, 40(%rsp) + cmpl $768, %edx + je ..B1.30 +..B1.25: + orl $-64768, %eax + movw %ax, 16(%rsp) +..B1.26: + fldcw 16(%rsp) +..B1.27: + fldt 32(%rsp) + lea 8+_TWO_75(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.28: + fldcw 18(%rsp) +..B1.29: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.30: + fldt 32(%rsp) + lea 8+_TWO_75(%rip), %rax + fmull (%rax) + fstpt (%rsp) + jmp ..B1.29 +..B1.31: + movzwl 18(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.35 +..B1.32: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.33: + fldcw 16(%rsp) +..B1.34: + movb $1, %al +..B1.35: + movb 41(%rsp), %dl + lea _small_value_80(%rip), %rsi + andb $-128, %dl + shrb $7, %dl + fldt (%rsi) + movzbl %dl, %ecx + shlq $4, %rcx + testb %al, %al + fldt (%rsi,%rcx) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.37 +..B1.36: + fldcw 18(%rsp) +..B1.37: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.38: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) + jmp ..B1.11 +..B1.39: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.40: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.41: + fldcw 16(%rsp) +..B1.42: + fldt 32(%rsp) + fstpt (%rsp) +..B1.43: + fldcw 18(%rsp) +..B1.44: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.45: + fldt 32(%rsp) + fstpt (%rsp) + jmp ..B1.44 + .align 16,0x90 + .cfi_endproc + .type ldexpl,@function + .size ldexpl,.-ldexpl + .data +# -- End ldexpl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lgamma.S b/external/sgx_libm/intel64/lgamma.S new file mode 100644 index 0000000000..8ab4cfddb1 --- /dev/null +++ b/external/sgx_libm/intel64/lgamma.S @@ -0,0 +1,7348 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lgamma.c" + .text +..TXTST0: +# -- Begin lgamma + .text + .align 16,0x90 + .globl lgamma +lgamma: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_lgamma.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + lea (%rsp), %rdi +..___tag_value_lgamma.4: + call __libm_lgamma +..___tag_value_lgamma.5: +..B1.2: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lgamma,@function + .size lgamma,.-lgamma + .data +# -- End lgamma + .text +# -- Begin __libm_lgamma + .text + .align 16,0x90 +__libm_lgamma: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B2.1: + .cfi_startproc +..___tag_value___libm_lgamma.8: +..L9: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $152, %rsp + .cfi_def_cfa_offset 208 + xorb %r12b, %r12b + movsd %xmm0, 32(%rsp) + movq %rdi, %r15 + movb 39(%rsp), %cl + xorb %bpl, %bpl + andb $-128, %cl + shrb $7, %cl + movzwl 38(%rsp), %r14d + andl $32752, %r14d + shrl $4, %r14d + movl %r14d, %r13d + movl 36(%rsp), %edx + shll $20, %r13d + andl $1048575, %edx + movq %fs:40, %rax + orl %edx, %r13d + xorq %rsp, %rax + movq %rax, 144(%rsp) + movb %cl, (%rsp) +..B2.2: + fnstcw 138(%rsp) +..B2.3: +..___tag_value___libm_lgamma.23: + call fegetround@PLT +..___tag_value___libm_lgamma.24: +..B2.205: + movl %eax, %ebx +..B2.4: + testl %ebx, %ebx + je ..B2.6 +..B2.5: + xorl %edi, %edi + movb $1, %r12b +..___tag_value___libm_lgamma.25: + call fesetround@PLT +..___tag_value___libm_lgamma.26: +..B2.6: + movzwl 138(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.10 +..B2.7: + orl $-64768, %edx + movw %dx, 136(%rsp) +..B2.8: + fldcw 136(%rsp) +..B2.9: + movb $1, %bpl +..B2.10: + cmpl $2047, %r14d + jne ..B2.17 +..B2.11: + movl $1, (%r15) + testb %bpl, %bpl + je ..B2.13 +..B2.12: + fldcw 138(%rsp) +..B2.13: + testb %r12b, %r12b + je ..B2.15 +..B2.14: + movl %ebx, %edi +..___tag_value___libm_lgamma.27: + call fesetround@PLT +..___tag_value___libm_lgamma.28: +..B2.15: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 32(%rsp), %xmm0 + mulsd %xmm0, %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.16: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.17: + testl %r14d, %r14d + jne ..B2.22 +..B2.18: + testl $1048575, 36(%rsp) + jne ..B2.22 +..B2.19: + cmpl $0, 32(%rsp) + je ..B2.98 +..B2.22: + movl $1, (%r15) +..B2.23: + movb (%rsp), %al + testb %al, %al + je ..B2.124 +..B2.24: + movsd 32(%rsp), %xmm0 + call nearbyint@PLT +..B2.206: + movsd %xmm0, 128(%rsp) + movsd 128(%rsp), %xmm1 + movsd 32(%rsp), %xmm0 + ucomisd %xmm1, %xmm0 + jp ..B2.25 + je ..B2.117 +..B2.25: + comisd .L_2il0floatpacket.0(%rip), %xmm0 + jbe ..B2.29 +..B2.26: + call ceil@PLT +..B2.207: + movsd %xmm0, 128(%rsp) + movsd 128(%rsp), %xmm1 + addsd .L_2il0floatpacket.0(%rip), %xmm1 + movsd %xmm1, 128(%rsp) + testb $1, 128(%rsp) + jne ..B2.28 +..B2.27: + movl $-1, (%r15) + movsd 32(%rsp), %xmm0 + jmp ..B2.29 +..B2.28: + movsd 32(%rsp), %xmm0 +..B2.29: + cmpl $1073741824, %r13d + jae ..B2.41 +..B2.30: + fldt .L_2il0floatpacket.1(%rip) + movsd %xmm0, 88(%rsp) + fld %st(0) + fldl 88(%rsp) + fcomi %st(2), %st + jae ..B2.109 + jp ..B2.109 +..B2.32: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B2.33 + jb ..B2.32 +..B2.33: + fstp %st(2) + fstpt 96(%rsp) +..B2.34: + andb $127, 105(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fldt 112(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) + call logl@PLT +..B2.209: + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fxch %st(1) + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value___libm_lgamma.52: + call lgamma_pos +..___tag_value___libm_lgamma.53: +..B2.208: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + testb %r12b, %r12b + je ..B2.37 +..B2.35: + fstp %st(0) + movl %ebx, %edi + fstpt (%rsp) +..___tag_value___libm_lgamma.55: + call fesetround@PLT +..___tag_value___libm_lgamma.56: +..B2.36: + fldt (%rsp) + fldt 96(%rsp) +..B2.37: + testb %bpl, %bpl + fsubrp %st, %st(1) + fstpl 128(%rsp) + je ..B2.39 +..B2.38: + fldcw 138(%rsp) +..B2.39: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.40: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.41: + cmpl $1076756480, %r13d + jae ..B2.71 +..B2.42: + fldt .L_2il0floatpacket.4(%rip) + movaps %xmm0, %xmm5 + lea _TWO_52H(%rip), %rax + addsd .L_2il0floatpacket.3(%rip), %xmm0 + movsd %xmm0, 80(%rsp) + movsd 80(%rsp), %xmm0 + movsd (%rax), %xmm1 + subsd %xmm0, %xmm1 + movsd %xmm1, 128(%rsp) + movsd 128(%rsp), %xmm2 + movl 128(%rsp), %ecx + subsd (%rax), %xmm2 + lea _LRIB(%rip), %rax + movsd %xmm2, 128(%rsp) + lea 1(%rcx), %edx + movsd 128(%rsp), %xmm3 + movsd %xmm3, 88(%rsp) + fldl 88(%rsp) + movsd 80(%rsp), %xmm4 + movsd %xmm4, 88(%rsp) + fldl 88(%rsp) + faddp %st, %st(1) + fxch %st(1) + fcomip %st(1), %st + fstp %st(0) + cmova %edx, %ecx + lea (%rcx,%rcx,2), %edx + movslq %edx, %rsi + comisd (%rax,%rsi,8), %xmm5 + jbe ..B2.51 +..B2.43: + movsd 16(%rax,%rsi,8), %xmm0 + comisd %xmm5, %xmm0 + jbe ..B2.51 +..B2.44: + movsd %xmm5, 88(%rsp) + fldl 88(%rsp) + movslq %ecx, %rcx + fsubl 8(%rax,%rsi,8) + fld %st(0) + lea _LRP16(%rip), %rax + fmul %st(1), %st + lea _LRP(%rip), %rsi + fldl (%rax,%rcx,8) + shll $3, %edx + fmul %st(1), %st + testb %r12b, %r12b + movslq %edx, %rdx + fldt 64(%rsi,%rdx,8) + fldt 32(%rsi,%rdx,8) + fldt (%rsi,%rdx,8) + fldt 48(%rsi,%rdx,8) + fldt 16(%rsi,%rdx,8) + fxch %st(5) + faddl 152(%rsi,%rdx,8) + fmul %st(6), %st + faddl 136(%rsi,%rdx,8) + fmul %st(6), %st + faddl 120(%rsi,%rdx,8) + fmul %st(6), %st + faddl 104(%rsi,%rdx,8) + fmul %st(6), %st + faddl 88(%rsi,%rdx,8) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl 160(%rsi,%rdx,8) + fmul %st(4), %st + faddl 144(%rsi,%rdx,8) + fmul %st(4), %st + faddl 128(%rsi,%rdx,8) + fmul %st(4), %st + faddl 112(%rsi,%rdx,8) + fmul %st(4), %st + faddl 96(%rsi,%rdx,8) + fmul %st(4), %st + faddl 80(%rsi,%rdx,8) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + je ..B2.47 +..B2.45: + fstp %st(0) + movl %ebx, %edi +..___tag_value___libm_lgamma.77: + call fesetround@PLT +..___tag_value___libm_lgamma.78: +..B2.46: + fldt 96(%rsp) +..B2.47: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstpl 128(%rsp) + je ..B2.49 +..B2.48: + fldcw 138(%rsp) +..B2.49: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.50: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.51: + lea _RRIB(%rip), %rax + comisd (%rax,%rsi,8), %xmm5 + jbe ..B2.60 +..B2.52: + movsd 16(%rax,%rsi,8), %xmm0 + comisd %xmm5, %xmm0 + jbe ..B2.60 +..B2.53: + movsd %xmm5, 88(%rsp) + lea _RRP(%rip), %rdx + fldl 88(%rsp) + fsubl 8(%rax,%rsi,8) + fld %st(0) + lea (%rcx,%rcx,4), %eax + shll $2, %eax + movslq %eax, %rax + testb %r12b, %r12b + fmul %st(1), %st + fldl 72(%rdx,%rax,8) + fmul %st(1), %st + fldt 32(%rdx,%rax,8) + fldt (%rdx,%rax,8) + fldl 64(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 120(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 112(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 88(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 80(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 136(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 128(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 104(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 96(%rdx,%rax,8) + fmul %st(4), %st + fxch %st(3) + faddl 152(%rdx,%rax,8) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt 48(%rdx,%rax,8) + fldt 16(%rdx,%rax,8) + fxch %st(3) + faddl 144(%rdx,%rax,8) + fmul %st(4), %st + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B2.56 +..B2.54: + fstp %st(0) + movl %ebx, %edi +..___tag_value___libm_lgamma.99: + call fesetround@PLT +..___tag_value___libm_lgamma.100: +..B2.55: + fldt 96(%rsp) +..B2.56: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstpl 128(%rsp) + je ..B2.58 +..B2.57: + fldcw 138(%rsp) +..B2.58: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.59: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.60: + fldt .L_2il0floatpacket.1(%rip) + movsd %xmm5, 88(%rsp) + fld %st(0) + fldl 88(%rsp) + fstpt (%rsp) + fldt (%rsp) + fcomip %st(2), %st + jae ..B2.113 + jp ..B2.113 +..B2.61: + fldt (%rsp) +..B2.62: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B2.63 + jb ..B2.62 +..B2.63: + fstp %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 96(%rsp) +..B2.64: + andb $127, 105(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fldt 112(%rsp) + fstpt (%rsp) + call logl@PLT +..B2.211: + addq $16, %rsp + .cfi_def_cfa_offset 208 + fstpt 96(%rsp) + fldt 96(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fldt 16(%rsp) + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value___libm_lgamma.124: + call lgamma_pos +..___tag_value___libm_lgamma.125: +..B2.210: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + testb %r12b, %r12b + je ..B2.67 +..B2.65: + fstp %st(0) + movl %ebx, %edi + fstpt (%rsp) +..___tag_value___libm_lgamma.127: + call fesetround@PLT +..___tag_value___libm_lgamma.128: +..B2.66: + fldt (%rsp) + fldt 96(%rsp) +..B2.67: + testb %bpl, %bpl + fsubrp %st, %st(1) + fstpl 128(%rsp) + je ..B2.69 +..B2.68: + fldcw 138(%rsp) +..B2.69: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.70: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.71: + cmpl $1076953088, %r13d + jae ..B2.82 +..B2.72: + fldt .L_2il0floatpacket.1(%rip) + movsd %xmm0, 88(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fldl 88(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(1), %st + fldt .L_2il0floatpacket.4(%rip) + fstpt 48(%rsp) + fldt 48(%rsp) + jae ..B2.223 + jp ..B2.223 +..B2.73: + fldt 16(%rsp) + fstp %st(1) +..B2.74: + fldt .L_2il0floatpacket.4(%rip) + fstp %st(0) + fld %st(0) + fxch %st(1) + fldt .L_2il0floatpacket.5(%rip) + fmul %st(1), %st + fadd %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(2) + fld %st(0) + fsub %st(2), %st + fxch %st(1) + fadd %st(3), %st + fcomi %st(3), %st + fldt 32(%rsp) + fld %st(0) + fldt 48(%rsp) + fldt .L_2il0floatpacket.5(%rip) + fmul %st(3), %st + fadd %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(3) + fmul %st(1), %st + fld %st(5) + fmul %st(3), %st + fxch %st(2) + fmulp %st, %st(6) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fsubp %st, %st(2) + fxch %st(2) + fsubp %st, %st(1) + fstpt 48(%rsp) + jp ..B2.75 + jb ..B2.74 +..B2.75: + fstp %st(1) + fstpt 16(%rsp) +..B2.76: + andb $127, 41(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fldt 48(%rsp) + fstpt (%rsp) + call logl@PLT +..B2.213: + fstpt 16(%rsp) + fldt 32(%rsp) + fstpt (%rsp) +..___tag_value___libm_lgamma.150: + call lgamma_pos +..___tag_value___libm_lgamma.151: +..B2.212: + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + testb %r12b, %r12b + je ..B2.78 +..B2.77: + movl %ebx, %edi +..___tag_value___libm_lgamma.153: + call fesetround@PLT +..___tag_value___libm_lgamma.154: +..B2.78: + fldt (%rsp) + testb %bpl, %bpl + fldt 16(%rsp) + fsubp %st, %st(1) + fstpl 128(%rsp) + je ..B2.80 +..B2.79: + fldcw 138(%rsp) +..B2.80: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.81: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.82: + movsd %xmm0, 88(%rsp) + cmpl $1082130432, %r13d + fldl 88(%rsp) + jb ..B2.90 +..B2.83: + fldt .L_2il0floatpacket.2(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + fsubr %st(1), %st + fld %st(1) + fchs + fldt (%rax) + fstpt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fldt (%rsp) + fstpt 32(%rsp) + fstpt 48(%rsp) + fstpt 64(%rsp) + call logl@PLT +..B2.214: + fldt 64(%rsp) + lea _TWO_52H(%rip), %rsi + fldt 48(%rsp) + lea _S26(%rip), %r8 + fmulp %st, %st(2) + lea _S22(%rip), %r9 + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + fldt (%rsp) + lea _S18(%rip), %r10 + movq (%rsi), %rcx + lea _S14(%rip), %r11 + movq %rcx, 128(%rsp) + lea _S10(%rip), %r13 + movsd 128(%rsp), %xmm0 + lea _W4(%rip), %rax + movsd %xmm0, 88(%rsp) + lea _W2(%rip), %rdx + lea _S06(%rip), %r14 + lea _S02(%rip), %r15 + testb %r12b, %r12b + fsubrp %st, %st(3) + fxch %st(1) + fsubr %st, %st(2) + fldt .L_2il0floatpacket.1(%rip) + fdiv %st(1), %st + fld %st(0) + fmul %st(1), %st + fmull (%rax) + lea _S28(%rip), %rax + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(3) + fldl 88(%rsp) + fsubp %st, %st(1) + fstpl 128(%rsp) + fldl (%r8) + fldt (%r13) + fldt (%r14) + fldt (%r15) + movsd 128(%rsp), %xmm1 + subsd (%rsi), %xmm1 + movsd %xmm1, 128(%rsp) + movsd 128(%rsp), %xmm2 + movsd %xmm2, 88(%rsp) + fxch %st(4) + fsubl 88(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(4) + faddl (%r9) + fmul %st(4), %st + faddl (%r10) + fmul %st(4), %st + faddl (%r11) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(3) + fmulp %st, %st(2) + fldl (%rax) + lea _S24(%rip), %rax + fmul %st(1), %st + faddl (%rax) + lea _S20(%rip), %rax + fmul %st(1), %st + faddl (%rax) + lea _S16(%rip), %rax + fmul %st(1), %st + faddl (%rax) + lea _S12(%rip), %rax + fmul %st(1), %st + fldt (%rax) + lea _S08(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea _S04(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + je ..B2.86 +..B2.84: + fstp %st(0) + movl %ebx, %edi + fstpt 32(%rsp) +..___tag_value___libm_lgamma.177: + call fesetround@PLT +..___tag_value___libm_lgamma.178: +..B2.85: + fldt 32(%rsp) + fldt 96(%rsp) +..B2.86: + andb $127, 73(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fldt 80(%rsp) + fstpt (%rsp) + fsubrp %st, %st(1) + fstpt 48(%rsp) + call logl@PLT +..B2.215: + fldt 48(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + testb %bpl, %bpl + fsubp %st, %st(1) + fstpl 128(%rsp) + je ..B2.88 +..B2.87: + fldcw 138(%rsp) +..B2.88: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.89: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.90: + lea _TWO_52H(%rip), %rdx + movq (%rdx), %rax + movq %rax, 128(%rsp) + movsd 128(%rsp), %xmm0 + movsd %xmm0, 88(%rsp) + fldl 88(%rsp) + fsub %st(1), %st + fstpl 128(%rsp) + fchs + movsd 128(%rsp), %xmm1 + subsd (%rdx), %xmm1 + movsd %xmm1, 128(%rsp) + movsd 128(%rsp), %xmm2 + movsd %xmm2, 88(%rsp) + fldl 88(%rsp) + fsubr %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fstpt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + call logl@PLT +..B2.217: + fchs + movsd 48(%rsp), %xmm0 + xorps .L_2il0floatpacket.7(%rip), %xmm0 + movsd %xmm0, 104(%rsp) + fldl 104(%rsp) + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value___libm_lgamma.202: + call lgamma_pos +..___tag_value___libm_lgamma.203: +..B2.216: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + fldt (%rsp) + lea _S26(%rip), %rax + lea _S22(%rip), %rdx + lea _S18(%rip), %rcx + lea _S14(%rip), %rsi + lea _S10(%rip), %r8 + lea _S06(%rip), %r9 + lea _S02(%rip), %r10 + lea _S28(%rip), %r11 + lea _S24(%rip), %r13 + lea _S20(%rip), %r14 + lea _S16(%rip), %r15 + testb %r12b, %r12b + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fmul %st(2), %st + fldl (%rax) + lea _S12(%rip), %rax + fmul %st(1), %st + fldt (%r8) + fldt (%r9) + fldt (%r10) + fldt (%rax) + lea _S08(%rip), %rax + fxch %st(4) + faddl (%rdx) + fmul %st(5), %st + faddl (%rcx) + fmul %st(5), %st + faddl (%rsi) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(4) + fldl (%r11) + fmul %st(2), %st + fldt (%rax) + lea _S04(%rip), %rax + fxch %st(1) + faddl (%r13) + fmul %st(3), %st + fldt (%rax) + fxch %st(1) + faddl (%r14) + fmul %st(4), %st + faddl (%r15) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + je ..B2.93 +..B2.91: + fstp %st(0) + movl %ebx, %edi + fstpt 16(%rsp) +..___tag_value___libm_lgamma.205: + call fesetround@PLT +..___tag_value___libm_lgamma.206: +..B2.92: + fldt 16(%rsp) + fldt 96(%rsp) +..B2.93: + andb $127, 73(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fldt 80(%rsp) + fstpt (%rsp) + fsubrp %st, %st(1) + fstpt 32(%rsp) + call logl@PLT +..B2.218: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + testb %bpl, %bpl + fsubp %st, %st(1) + fstpl 128(%rsp) + je ..B2.95 +..B2.94: + fldcw 138(%rsp) +..B2.95: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.96: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.97: + call __stack_chk_fail@PLT +..B2.98: + movb (%rsp), %al + testb %al, %al + je ..B2.100 +..B2.99: + movl $-1, (%r15) + jmp ..B2.101 +..B2.100: + movl $1, (%r15) +..B2.101: + testb %r12b, %r12b + je ..B2.103 +..B2.102: + movl %ebx, %edi +..___tag_value___libm_lgamma.229: + call fesetround@PLT +..___tag_value___libm_lgamma.230: +..B2.103: + movss .L_2il0floatpacket.8(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + cvtss2sd %xmm1, %xmm1 + movsd %xmm1, 128(%rsp) + je ..B2.105 +..B2.104: + fldcw 138(%rsp) +..B2.105: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 + jmp ..B2.16 +..B2.109: + fstp %st(1) + fxch %st(1) + fstpt 96(%rsp) + jmp ..B2.34 +..B2.113: + fstp %st(0) + fstpt 96(%rsp) + jmp ..B2.64 +..B2.117: + testb %r12b, %r12b + je ..B2.119 +..B2.118: + movl %ebx, %edi +..___tag_value___libm_lgamma.231: + call fesetround@PLT +..___tag_value___libm_lgamma.232: +..B2.119: + movss .L_2il0floatpacket.8(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + cvtss2sd %xmm1, %xmm1 + movsd %xmm1, 128(%rsp) + je ..B2.121 +..B2.120: + fldcw 138(%rsp) +..B2.121: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 + jmp ..B2.16 +..B2.124: + movzwl 38(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2037, %eax + jg ..B2.196 +..B2.125: + je ..B2.193 +..B2.126: + movsd 32(%rsp), %xmm0 + ucomisd .L_2il0floatpacket.9(%rip), %xmm0 + jp ..B2.127 + je ..B2.186 +..B2.127: + cmpl $1032, %r14d + jb ..B2.134 +..B2.128: + fldt .L_2il0floatpacket.2(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movsd %xmm0, 88(%rsp) + fldl 88(%rsp) + fstl 32(%rsp) + fsub %st, %st(1) + fxch %st(1) + fstpt (%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fstpt (%rsp) + fldt (%rax) + fstpt 32(%rsp) + call logl@PLT +..B2.219: + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 208 + fldt (%rsp) + lea _W4(%rip), %rax + fldl 32(%rsp) + lea _W2(%rip), %rdx + fxch %st(3) + fmulp %st, %st(1) + testb %r12b, %r12b + faddp %st, %st(1) + fsub %st(1), %st + fldt .L_2il0floatpacket.1(%rip) + fdivp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fmull (%rax) + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + je ..B2.130 +..B2.129: + movl %ebx, %edi + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_lgamma.235: + call fesetround@PLT +..___tag_value___libm_lgamma.236: +..B2.222: + fldt 16(%rsp) + fldt (%rsp) +..B2.130: + testb %bpl, %bpl + faddp %st, %st(1) + fstpl 128(%rsp) + je ..B2.132 +..B2.131: + fldcw 138(%rsp) +..B2.132: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.133: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.134: + cmpl $1025, %r14d + jb ..B2.141 +..B2.135: + lea _A(%rip), %rdx + lea -1025(%r14), %eax + movslq %eax, %rax + lea _B(%rip), %rcx + movsd %xmm0, 88(%rsp) + lea -3075(%r14,%r14,2), %r13d + fldl 88(%rsp) + lea _C5(%rip), %r14 + shll $3, %r13d + movslq %r13d, %r13 + fsubl (%rdx,%rax,8) + fmull (%rcx,%rax,8) + shlq $4, %r13 + fld %st(0) + fmul %st(1), %st + testb %r12b, %r12b + fldt 16(%r13,%r14) + fmul %st(2), %st + fadd %st(1), %st + fldt (%r13,%r14) + faddp %st, %st(1) + fldt 48(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 32(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 80(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 64(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 112(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 96(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 144(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 128(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 176(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 160(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 208(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 192(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 240(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 224(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 272(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 256(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 304(%r13,%r14) + fmul %st(3), %st + fadd %st(2), %st + fldt 288(%r13,%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 336(%r13,%r14) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 320(%r13,%r14) + faddp %st, %st(1) + fmul %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fstpt 96(%rsp) + je ..B2.137 +..B2.136: + movl %ebx, %edi +..___tag_value___libm_lgamma.257: + call fesetround@PLT +..___tag_value___libm_lgamma.258: +..B2.137: + fldt 352(%r13,%r14) + testb %bpl, %bpl + fldt (%rsp) + fmulp %st, %st(1) + fstpl 128(%rsp) + je ..B2.139 +..B2.138: + fldcw 138(%rsp) +..B2.139: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.140: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.141: + cmpl $1073872896, %r13d + jb ..B2.148 +..B2.142: + lea 48+_C4(%rip), %rcx + lea 16+_C4(%rip), %rax + movsd %xmm0, 88(%rsp) + lea 80+_C4(%rip), %r8 + fldl 88(%rsp) + lea 32+_C4(%rip), %rsi + fld %st(0) + lea 112+_C4(%rip), %r10 + fmul %st(1), %st + lea _C4(%rip), %rdx + lea 64+_C4(%rip), %r9 + lea 144+_C4(%rip), %r13 + lea 96+_C4(%rip), %r11 + lea 176+_C4(%rip), %r15 + lea 128+_C4(%rip), %r14 + testb %r12b, %r12b + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt (%rax) + lea 160+_C4(%rip), %rax + fmul %st(1), %st + fadd %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fldt (%rcx) + fmul %st(2), %st + fadd %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r8) + fmul %st(2), %st + fadd %st(3), %st + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r10) + fmul %st(2), %st + fadd %st(3), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r13) + fmul %st(2), %st + fadd %st(3), %st + fldt (%r14) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r15) + fmul %st(2), %st + fadd %st(3), %st + fldt (%rax) + lea 208+_C4(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rax) + lea 192+_C4(%rip), %rax + fmul %st(2), %st + fadd %st(3), %st + fldt (%rax) + lea 240+_C4(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rax) + lea 224+_C4(%rip), %rax + fmul %st(2), %st + fadd %st(3), %st + fldt (%rax) + lea 272+_C4(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rax) + lea 256+_C4(%rip), %rax + fmul %st(2), %st + fadd %st(3), %st + fldt (%rax) + lea 304+_C4(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rax) + lea 288+_C4(%rip), %rax + fmul %st(2), %st + fadd %st(3), %st + fldt (%rax) + lea 336+_C4(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rax) + lea 320+_C4(%rip), %rax + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt (%rax) + lea 352+_C4(%rip), %rax + faddp %st, %st(2) + fmul %st(1), %st + fxch %st(1) + fstpt 96(%rsp) + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B2.144 +..B2.143: + movl %ebx, %edi +..___tag_value___libm_lgamma.279: + call fesetround@PLT +..___tag_value___libm_lgamma.280: +..B2.144: + fldt .L_2il0floatpacket.6(%rip) + testb %bpl, %bpl + fldt 16(%rsp) + fsubp %st, %st(1) + fldt (%rsp) + fmulp %st, %st(1) + fstpl 128(%rsp) + je ..B2.146 +..B2.145: + fldcw 138(%rsp) +..B2.146: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.147: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.148: + cmpl $1073479680, %r13d + jb ..B2.156 +..B2.149: + fldt .L_2il0floatpacket.6(%rip) + lea 168+_C3(%rip), %rax + movsd %xmm0, 88(%rsp) + lea 152+_C3(%rip), %rdx + fldl 88(%rsp) + lea 136+_C3(%rip), %rcx + lea 120+_C3(%rip), %rsi + lea 104+_C3(%rip), %r8 + lea 88+_C3(%rip), %r9 + lea 64+_C3(%rip), %r10 + lea 160+_C3(%rip), %r14 + lea 144+_C3(%rip), %r15 + lea 32+_C3(%rip), %r11 + lea _C3(%rip), %r13 + testb %r12b, %r12b + fsubp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl (%rax) + lea 128+_C3(%rip), %rax + fmul %st(1), %st + fldt (%r10) + fldt (%r11) + fldt (%r13) + fxch %st(3) + faddl (%rdx) + fmul %st(4), %st + faddl (%rcx) + fmul %st(4), %st + faddl (%rsi) + fmul %st(4), %st + faddl (%r8) + fmul %st(4), %st + faddl (%r9) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl (%r14) + fmul %st(2), %st + faddl (%r15) + fmul %st(2), %st + faddl (%rax) + lea 112+_C3(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 96+_C3(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 80+_C3(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 48+_C3(%rip), %rax + fmul %st(2), %st + fldt (%rax) + lea 16+_C3(%rip), %rax + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + je ..B2.152 +..B2.150: + fstp %st(0) + movl %ebx, %edi +..___tag_value___libm_lgamma.301: + call fesetround@PLT +..___tag_value___libm_lgamma.302: +..B2.151: + fldt 96(%rsp) +..B2.152: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstpl 128(%rsp) + je ..B2.154 +..B2.153: + fldcw 138(%rsp) +..B2.154: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.155: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.156: + movsd %xmm0, 88(%rsp) + cmpl $1072955392, %r13d + fldl 88(%rsp) + jb ..B2.164 +..B2.157: + lea _LM(%rip), %rax + lea 184+_LGAMMA_C2(%rip), %rdx + lea 168+_LGAMMA_C2(%rip), %rcx + lea 152+_LGAMMA_C2(%rip), %rsi + lea 136+_LGAMMA_C2(%rip), %r8 + lea 120+_LGAMMA_C2(%rip), %r9 + lea 104+_LGAMMA_C2(%rip), %r10 + lea 80+_LGAMMA_C2(%rip), %r11 + fldt (%rax) + lea 176+_LGAMMA_C2(%rip), %r15 + lea 160+_LGAMMA_C2(%rip), %rax + lea 48+_LGAMMA_C2(%rip), %r13 + lea 16+_LGAMMA_C2(%rip), %r14 + testb %r12b, %r12b + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl (%rdx) + fmul %st(1), %st + fldt (%r11) + fldt (%r13) + fldt (%r14) + fxch %st(3) + faddl (%rcx) + fmul %st(4), %st + faddl (%rsi) + fmul %st(4), %st + faddl (%r8) + fmul %st(4), %st + faddl (%r9) + fmul %st(4), %st + faddl (%r10) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl (%r15) + fmul %st(2), %st + faddl (%rax) + lea 144+_LGAMMA_C2(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 128+_LGAMMA_C2(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 112+_LGAMMA_C2(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 96+_LGAMMA_C2(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 64+_LGAMMA_C2(%rip), %rax + fmul %st(2), %st + fldt (%rax) + lea 32+_LGAMMA_C2(%rip), %rax + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rax) + lea _LGAMMA_C2(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + je ..B2.160 +..B2.158: + fstp %st(0) + movl %ebx, %edi +..___tag_value___libm_lgamma.323: + call fesetround@PLT +..___tag_value___libm_lgamma.324: +..B2.159: + fldt 96(%rsp) +..B2.160: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstpl 128(%rsp) + je ..B2.162 +..B2.161: + fldcw 138(%rsp) +..B2.162: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.163: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.164: + cmpl $1072431104, %r13d + jb ..B2.172 +..B2.165: + fldt .L_2il0floatpacket.1(%rip) + lea 168+_C1(%rip), %rax + lea 152+_C1(%rip), %rdx + lea 136+_C1(%rip), %rcx + lea 120+_C1(%rip), %rsi + lea 160+_C1(%rip), %r14 + lea 144+_C1(%rip), %r15 + lea 104+_C1(%rip), %r8 + lea 88+_C1(%rip), %r9 + lea 64+_C1(%rip), %r10 + lea 32+_C1(%rip), %r11 + lea _C1(%rip), %r13 + testb %r12b, %r12b + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl (%rax) + lea 128+_C1(%rip), %rax + fmul %st(1), %st + fldt (%r10) + fldt (%r11) + fldt (%r13) + fldl (%r14) + fmul %st(5), %st + fxch %st(4) + faddl (%rdx) + fmul %st(5), %st + fxch %st(4) + faddl (%r15) + fmul %st(5), %st + fxch %st(4) + faddl (%rcx) + fmul %st(5), %st + fxch %st(4) + faddl (%rax) + fmul %st(5), %st + fxch %st(4) + faddl (%rsi) + fmul %st(5), %st + lea 112+_C1(%rip), %rax + fxch %st(4) + faddl (%rax) + fmul %st(5), %st + fxch %st(4) + faddl (%r8) + fmul %st(5), %st + lea 96+_C1(%rip), %rax + fxch %st(4) + faddl (%rax) + fmul %st(5), %st + fxch %st(4) + faddl (%r9) + fmul %st(5), %st + lea 80+_C1(%rip), %rax + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(2) + faddl (%rax) + lea 48+_C1(%rip), %rax + fmul %st(1), %st + fldt (%rax) + lea 16+_C1(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B2.168 +..B2.166: + fstp %st(0) + movl %ebx, %edi +..___tag_value___libm_lgamma.345: + call fesetround@PLT +..___tag_value___libm_lgamma.346: +..B2.167: + fldt 96(%rsp) +..B2.168: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstpl 128(%rsp) + je ..B2.170 +..B2.169: + fldcw 138(%rsp) +..B2.170: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.171: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.172: + fldt .L_2il0floatpacket.1(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 224 + fadd %st(1), %st + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value___libm_lgamma.368: + call lgamma_pos +..___tag_value___libm_lgamma.369: +..B2.221: + fldt 32(%rsp) + fxch %st(1) + fstpt 16(%rsp) + fstpt (%rsp) + call logl@PLT +..B2.220: + addq $16, %rsp + .cfi_def_cfa_offset 208 + fstpt 96(%rsp) + fldt 96(%rsp) + testb %r12b, %r12b + je ..B2.175 +..B2.173: + fstp %st(0) + movl %ebx, %edi +..___tag_value___libm_lgamma.371: + call fesetround@PLT +..___tag_value___libm_lgamma.372: +..B2.174: + fldt 96(%rsp) +..B2.175: + fldt (%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstpl 128(%rsp) + je ..B2.177 +..B2.176: + fldcw 138(%rsp) +..B2.177: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 +..B2.178: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.186: + testb %bpl, %bpl + je ..B2.188 +..B2.187: + fldcw 138(%rsp) +..B2.188: + testb %r12b, %r12b + je ..B2.190 +..B2.189: + movl %ebx, %edi +..___tag_value___libm_lgamma.393: + call fesetround@PLT +..___tag_value___libm_lgamma.394: +..B2.190: + movq 144(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.97 +..B2.191: + pxor %xmm0, %xmm0 + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.193: + movl 36(%rsp), %eax + andl $1048575, %eax + cmpl $480473, %eax + jg ..B2.196 +..B2.194: + jne ..B2.126 +..B2.195: + cmpl $663441831, 32(%rsp) + jbe ..B2.126 +..B2.196: + testb %r12b, %r12b + je ..B2.198 +..B2.197: + movl %ebx, %edi +..___tag_value___libm_lgamma.415: + call fesetround@PLT +..___tag_value___libm_lgamma.416: +..B2.198: + lea _PBIG(%rip), %rax + testb %bpl, %bpl + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 128(%rsp) + je ..B2.200 +..B2.199: + fldcw 138(%rsp) +..B2.200: + movq 144(%rsp), %rax + xorq %rsp, %rax + movsd 128(%rsp), %xmm0 + cmpq %fs:40, %rax + jne ..B2.97 + jmp ..B2.16 +..B2.223: + fstp %st(1) + fstp %st(0) + jmp ..B2.76 + .align 16,0x90 + .cfi_endproc + .type __libm_lgamma,@function + .size __libm_lgamma,.-__libm_lgamma + .data +# -- End __libm_lgamma + .text +# -- Begin lgamma_pos + .text + .align 16,0x90 +lgamma_pos: +# parameter 1: 8 + %rsp +..B3.1: + .cfi_startproc +..___tag_value_lgamma_pos.418: +..L419: + + fldt 8(%rsp) + fstl -8(%rsp) + fldt .L_2il0floatpacket.4(%rip) + movzwl -2(%rsp), %ecx + andl $32752, %ecx + shrl $4, %ecx + movl -4(%rsp), %eax + shll $20, %ecx + andl $1048575, %eax + orl %eax, %ecx + cmpl $1074790400, %ecx + jb ..B3.3 +..B3.2: + fstp %st(0) + addl $-1074790400, %ecx + lea _A(%rip), %rax + sarl $20, %ecx + lea _B(%rip), %rdx + movslq %ecx, %rcx + lea _C5(%rip), %rdi + lea (%rcx,%rcx,2), %esi + shll $3, %esi + movslq %esi, %rsi + fldl (%rax,%rcx,8) + shlq $4, %rsi + fsubrp %st, %st(1) + fmull (%rdx,%rcx,8) + fld %st(0) + fmul %st(1), %st + fldt 16(%rdi,%rsi) + fmul %st(2), %st + fadd %st(1), %st + fldt 48(%rdi,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 32(%rdi,%rsi) + faddp %st, %st(1) + fldt 80(%rdi,%rsi) + fmul %st(4), %st + fadd %st(3), %st + fldt 64(%rdi,%rsi) + faddp %st, %st(1) + fldt 112(%rdi,%rsi) + fmul %st(5), %st + fadd %st(4), %st + fldt 144(%rdi,%rsi) + fmul %st(6), %st + fadd %st(5), %st + fldt (%rsi,%rdi) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fldt 96(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 128(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 176(%rdi,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 160(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 208(%rdi,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 192(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 240(%rdi,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 224(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 272(%rdi,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 256(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 304(%rdi,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 288(%rdi,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 336(%rdi,%rsi) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 320(%rdi,%rsi) + fadd %st, %st(1) + fxch %st(1) + fmulp %st, %st(2) + fldt 352(%rdi,%rsi) + fmulp %st, %st(2) + fxch %st(1) + jmp ..B3.11 +..B3.3: + cmpl $1073872896, %ecx + jb ..B3.5 +..B3.4: + fstp %st(0) + lea 48+_C4(%rip), %rcx + lea 16+_C4(%rip), %rax + fld %st(0) + lea 80+_C4(%rip), %rdi + fmul %st(1), %st + lea 32+_C4(%rip), %rsi + fldt (%rax) + lea 112+_C4(%rip), %r9 + fmul %st(2), %st + lea _C4(%rip), %rdx + lea 64+_C4(%rip), %r8 + lea 144+_C4(%rip), %r11 + lea 96+_C4(%rip), %r10 + lea 128+_C4(%rip), %rax + fadd %st(1), %st + fldt (%rdx) + lea 176+_C4(%rip), %rdx + faddp %st, %st(1) + fldt (%rcx) + lea 160+_C4(%rip), %rcx + fmul %st(3), %st + fadd %st(2), %st + fldt (%rsi) + lea 208+_C4(%rip), %rsi + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rdi) + lea 192+_C4(%rip), %rdi + fmul %st(3), %st + fadd %st(2), %st + fldt (%r8) + lea 240+_C4(%rip), %r8 + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r9) + lea 224+_C4(%rip), %r9 + fmul %st(3), %st + fadd %st(2), %st + fldt (%r10) + lea 272+_C4(%rip), %r10 + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r11) + lea 256+_C4(%rip), %r11 + fmul %st(3), %st + fadd %st(2), %st + fldt (%rax) + lea 304+_C4(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rdx) + lea 288+_C4(%rip), %rdx + fmul %st(3), %st + fadd %st(2), %st + fldt (%rcx) + lea 336+_C4(%rip), %rcx + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rsi) + lea 320+_C4(%rip), %rsi + fmul %st(3), %st + fadd %st(2), %st + fldt (%rdi) + lea 352+_C4(%rip), %rdi + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r8) + fmul %st(3), %st + fadd %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r10) + fmul %st(3), %st + fadd %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rax) + fmul %st(3), %st + fadd %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rcx) + fmul %st(3), %st + faddp %st, %st(2) + fldt (%rsi) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt (%rdi) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.6(%rip) + fsubrp %st, %st(2) + fmul %st(1), %st + jmp ..B3.11 +..B3.5: + cmpl $1073479680, %ecx + jb ..B3.7 +..B3.6: + fstp %st(0) + fldt .L_2il0floatpacket.6(%rip) + lea 160+_C3(%rip), %rax + lea 144+_C3(%rip), %rdx + lea 128+_C3(%rip), %rcx + lea 112+_C3(%rip), %rsi + lea 96+_C3(%rip), %rdi + lea 80+_C3(%rip), %r8 + lea 48+_C3(%rip), %r9 + lea 168+_C3(%rip), %r11 + fsubrp %st, %st(1) + fld %st(0) + lea 16+_C3(%rip), %r10 + fmul %st(1), %st + fldl (%rax) + lea 152+_C3(%rip), %rax + fmul %st(1), %st + fldt (%r9) + lea 32+_C3(%rip), %r9 + fldt (%r10) + lea _C3(%rip), %r10 + fxch %st(2) + faddl (%rdx) + lea 136+_C3(%rip), %rdx + fmul %st(3), %st + fldt (%r9) + fldt (%r10) + fxch %st(2) + faddl (%rcx) + lea 120+_C3(%rip), %rcx + fmul %st(5), %st + faddl (%rsi) + lea 104+_C3(%rip), %rsi + fmul %st(5), %st + faddl (%rdi) + lea 88+_C3(%rip), %rdi + fmul %st(5), %st + faddl (%r8) + lea 64+_C3(%rip), %r8 + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldl (%r11) + fmul %st(4), %st + fldt (%r8) + fxch %st(1) + faddl (%rax) + fmul %st(5), %st + faddl (%rdx) + fmul %st(5), %st + faddl (%rcx) + fmul %st(5), %st + faddl (%rsi) + fmul %st(5), %st + faddl (%rdi) + fmul %st(5), %st + faddp %st, %st(1) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + jmp ..B3.11 +..B3.7: + cmpl $1072955392, %ecx + jb ..B3.9 +..B3.8: + fstp %st(0) + lea _LM(%rip), %rax + lea 176+_LGAMMA_C2(%rip), %rdx + lea 160+_LGAMMA_C2(%rip), %rcx + lea 144+_LGAMMA_C2(%rip), %rsi + lea 128+_LGAMMA_C2(%rip), %rdi + lea 112+_LGAMMA_C2(%rip), %r8 + lea 96+_LGAMMA_C2(%rip), %r9 + lea 64+_LGAMMA_C2(%rip), %r10 + fldt (%rax) + lea 32+_LGAMMA_C2(%rip), %r11 + lea _LGAMMA_C2(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl (%rdx) + lea 184+_LGAMMA_C2(%rip), %rdx + fmul %st(1), %st + fldt (%r10) + lea 80+_LGAMMA_C2(%rip), %r10 + fldt (%r11) + lea 48+_LGAMMA_C2(%rip), %r11 + fldt (%rax) + lea 16+_LGAMMA_C2(%rip), %rax + fxch %st(3) + faddl (%rcx) + lea 168+_LGAMMA_C2(%rip), %rcx + fmul %st(4), %st + fldt (%r10) + fldt (%r11) + fxch %st(2) + faddl (%rsi) + lea 152+_LGAMMA_C2(%rip), %rsi + fmul %st(6), %st + faddl (%rdi) + lea 136+_LGAMMA_C2(%rip), %rdi + fmul %st(6), %st + faddl (%r8) + lea 120+_LGAMMA_C2(%rip), %r8 + fmul %st(6), %st + faddl (%r9) + lea 104+_LGAMMA_C2(%rip), %r9 + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(3) + fldl (%rdx) + fmul %st(4), %st + faddl (%rcx) + fmul %st(4), %st + faddl (%rsi) + fmul %st(4), %st + faddl (%rdi) + fmul %st(4), %st + faddl (%r8) + fmul %st(4), %st + faddl (%r9) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + jmp ..B3.11 +..B3.9: + cmpl $1072431104, %ecx + jb ..B3.11 +..B3.10: + fstp %st(0) + fldt .L_2il0floatpacket.1(%rip) + lea 160+_C1(%rip), %rax + lea 144+_C1(%rip), %rdx + lea 128+_C1(%rip), %rcx + lea 112+_C1(%rip), %rsi + lea 96+_C1(%rip), %rdi + lea 80+_C1(%rip), %r8 + lea 48+_C1(%rip), %r9 + lea 168+_C1(%rip), %r11 + fsubrp %st, %st(1) + fld %st(0) + lea 16+_C1(%rip), %r10 + fmul %st(1), %st + fldl (%rax) + lea 152+_C1(%rip), %rax + fmul %st(1), %st + fldt (%r9) + lea 32+_C1(%rip), %r9 + fldt (%r10) + lea _C1(%rip), %r10 + fxch %st(2) + faddl (%rdx) + lea 136+_C1(%rip), %rdx + fmul %st(3), %st + fldt (%r9) + fldt (%r10) + fxch %st(2) + faddl (%rcx) + lea 120+_C1(%rip), %rcx + fmul %st(5), %st + faddl (%rsi) + lea 104+_C1(%rip), %rsi + fmul %st(5), %st + faddl (%rdi) + lea 88+_C1(%rip), %rdi + fmul %st(5), %st + faddl (%r8) + lea 64+_C1(%rip), %r8 + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldl (%r11) + fmul %st(4), %st + fldt (%r8) + fxch %st(1) + faddl (%rax) + fmul %st(5), %st + faddl (%rdx) + fmul %st(5), %st + faddl (%rcx) + fmul %st(5), %st + faddl (%rsi) + fmul %st(5), %st + faddl (%rdi) + fmul %st(5), %st + faddp %st, %st(1) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) +..B3.11: + fstp %st(1) + ret + .align 16,0x90 + .cfi_endproc + .type lgamma_pos,@function + .size lgamma_pos,.-lgamma_pos + .data +# -- End lgamma_pos + .text +# -- Begin gamma + .text + .align 16,0x90 + .globl gamma +gamma: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value_gamma.421: +..L422: + + pushq %rsi + .cfi_def_cfa_offset 16 + lea (%rsp), %rdi +..___tag_value_gamma.424: + call __libm_lgamma +..___tag_value_gamma.425: +..B4.2: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type gamma,@function + .size gamma,.-gamma + .data +# -- End gamma + .text +# -- Begin lgamma_r + .text + .align 16,0x90 + .globl lgamma_r +lgamma_r: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B5.1: + .cfi_startproc +..___tag_value_lgamma_r.428: +..L429: + + pushq %rsi + .cfi_def_cfa_offset 16 +..___tag_value_lgamma_r.431: + call __libm_lgamma +..___tag_value_lgamma_r.432: +..B5.2: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lgamma_r,@function + .size lgamma_r,.-lgamma_r + .data +# -- End lgamma_r + .text +# -- Begin gamma_r + .text + .align 16,0x90 + .globl gamma_r +gamma_r: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B6.1: + .cfi_startproc +..___tag_value_gamma_r.435: +..L436: + + pushq %rsi + .cfi_def_cfa_offset 16 +..___tag_value_gamma_r.438: + call __libm_lgamma +..___tag_value_gamma_r.439: +..B6.2: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type gamma_r,@function + .size gamma_r,.-gamma_r + .data +# -- End gamma_r + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 16 +.L_2il0floatpacket.7: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 16 +_LRIB: + .long 3639930760 + .long 3221638968 + .long 169597185 + .long 3221617473 + .long 994230906 + .long 3221595977 + .long 249193764 + .long 3222253755 + .long 1417424869 + .long 3222250609 + .long 2585655974 + .long 3222247463 + .long 679699934 + .long 3222534303 + .long 2054089469 + .long 3222533975 + .long 3428479004 + .long 3222533647 + .long 1666697798 + .long 3222798023 + .long 4119983117 + .long 3222797970 + .long 2278301140 + .long 3222797918 + .long 753528318 + .long 3223060435 + .long 4151019248 + .long 3223060427 + .long 3253542882 + .long 3223060420 + .long 1221915992 + .long 3223322618 + .long 2139183567 + .long 3223322617 + .long 3056451142 + .long 3223322616 + .long 2968798493 + .long 3223453695 + .long 2743618512 + .long 3223453695 + .long 2518438531 + .long 3223453695 + .long 4156721779 + .long 3223584767 + .long 4139833280 + .long 3223584767 + .long 4122944781 + .long 3223584767 + .long 4282834537 + .long 3223715839 + .long 4280864212 + .long 3223715839 + .long 4278893887 + .long 3223715839 + .long 4293918703 + .long 3223846911 + .long 4293792039 + .long 3223846911 + .long 4293665375 + .long 3223846911 + .long 4294888151 + .long 3223977983 + .long 4294876892 + .long 3223977983 + .long 4294865633 + .long 3223977983 + .long 4294961261 + .long 3224109055 + .long 4294960839 + .long 3224109055 + .long 4294960417 + .long 3224109055 + .long 4294966894 + .long 3224240127 + .long 4294966866 + .long 3224240127 + .long 4294966838 + .long 3224240127 + .type _LRIB,@object + .size _LRIB,312 + .space 8, 0x00 # pad + .align 16 +_LRP16: + .long 2378050348 + .long 1101969305 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .type _LRP16,@object + .size _LRP16,104 + .space 8, 0x00 # pad + .align 16 +_LRP: + .word 17751 + .word 54196 + .word 10629 + .word 51164 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 41133 + .word 9612 + .word 27976 + .word 62729 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 42459 + .word 13010 + .word 63969 + .word 39219 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 65437 + .word 25696 + .word 54808 + .word 41154 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 58026 + .word 20377 + .word 22118 + .word 64130 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 35937 + .word 22559 + .word 22660 + .word 49256 + .word 8259 + .word 31940 + .word 14143 + .word 16516 + .word 36722 + .word 48879 + .word 8761 + .word 49313 + .word 17702 + .word 59215 + .word 47717 + .word 16573 + .word 13453 + .word 50588 + .word 11555 + .word 49370 + .word 8896 + .word 4195 + .word 22549 + .word 16631 + .word 8306 + .word 47544 + .word 1832 + .word 49429 + .word 60153 + .word 61869 + .word 6523 + .word 16691 + .word 63612 + .word 2764 + .word 26286 + .word 49489 + .word 63356 + .word 31621 + .word 64278 + .word 16751 + .word 24055 + .word 64192 + .word 21464 + .word 49552 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49769 + .word 49242 + .word 6580 + .word 61152 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 7708 + .word 25266 + .word 60595 + .word 42444 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 45975 + .word 8629 + .word 62832 + .word 64438 + .word 16390 + .word 0 + .word 0 + .word 0 + .word 39855 + .word 22905 + .word 44266 + .word 59689 + .word 49162 + .word 0 + .word 0 + .word 0 + .word 10240 + .word 41089 + .word 5368 + .word 62588 + .word 16398 + .word 0 + .word 0 + .word 0 + .word 3194 + .word 32877 + .word 5879 + .word 49457 + .word 40173 + .word 43959 + .word 59635 + .word 16755 + .word 53371 + .word 1664 + .word 56254 + .word 49591 + .word 34510 + .word 44659 + .word 12150 + .word 16893 + .word 33872 + .word 42862 + .word 8799 + .word 49730 + .word 10662 + .word 44157 + .word 53571 + .word 17030 + .word 55074 + .word 58798 + .word 65525 + .word 49868 + .word 1276 + .word 34610 + .word 36363 + .word 17170 + .word 7041 + .word 29575 + .word 61144 + .word 50007 + .word 19121 + .word 53977 + .word 34010 + .word 17312 + .word 54457 + .word 12310 + .word 48419 + .word 50149 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55737 + .word 12115 + .word 42602 + .word 40775 + .word 16337 + .word 0 + .word 0 + .word 0 + .word 42581 + .word 53029 + .word 20983 + .word 59666 + .word 49157 + .word 0 + .word 0 + .word 0 + .word 24816 + .word 20947 + .word 58172 + .word 55961 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 3130 + .word 13042 + .word 49143 + .word 34463 + .word 49170 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 24697 + .word 14253 + .word 47765 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 32693 + .word 5691 + .word 15709 + .word 49649 + .word 20491 + .word 21402 + .word 35932 + .word 16986 + .word 44071 + .word 16276 + .word 1675 + .word 49861 + .word 13758 + .word 14468 + .word 65445 + .word 17200 + .word 60394 + .word 3375 + .word 60434 + .word 50075 + .word 49748 + .word 2796 + .word 14419 + .word 17415 + .word 61579 + .word 22133 + .word 33066 + .word 50291 + .word 25055 + .word 28661 + .word 31699 + .word 17632 + .word 55823 + .word 18661 + .word 6347 + .word 50508 + .word 58142 + .word 19935 + .word 64799 + .word 17849 + .word 41216 + .word 59562 + .word 42287 + .word 50726 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16006 + .word 65034 + .word 42959 + .word 34185 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 40843 + .word 53953 + .word 46369 + .word 45839 + .word 49160 + .word 0 + .word 0 + .word 0 + .word 54179 + .word 42767 + .word 58812 + .word 64462 + .word 16400 + .word 0 + .word 0 + .word 0 + .word 50676 + .word 3143 + .word 1093 + .word 60276 + .word 49177 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56865 + .word 38982 + .word 63406 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 65273 + .word 45226 + .word 24230 + .word 49857 + .word 23450 + .word 59950 + .word 19796 + .word 17236 + .word 4038 + .word 16755 + .word 26702 + .word 50152 + .word 24087 + .word 51196 + .word 62539 + .word 17533 + .word 25486 + .word 58858 + .word 44079 + .word 50450 + .word 31845 + .word 29909 + .word 37453 + .word 17831 + .word 19699 + .word 12384 + .word 3664 + .word 50750 + .word 26808 + .word 47918 + .word 18611 + .word 18131 + .word 25376 + .word 13791 + .word 62285 + .word 51048 + .word 64886 + .word 33542 + .word 28786 + .word 18433 + .word 54686 + .word 5814 + .word 3500 + .word 51351 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33175 + .word 51870 + .word 55516 + .word 61254 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 3685 + .word 30034 + .word 48430 + .word 40287 + .word 49163 + .word 0 + .word 0 + .word 0 + .word 3323 + .word 33320 + .word 53546 + .word 49572 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 19902 + .word 19517 + .word 60782 + .word 40648 + .word 49186 + .word 0 + .word 0 + .word 0 + .word 28672 + .word 31090 + .word 60187 + .word 37497 + .word 16430 + .word 0 + .word 0 + .word 0 + .word 4362 + .word 57115 + .word 1063 + .word 50082 + .word 17298 + .word 34206 + .word 30558 + .word 17506 + .word 19701 + .word 2977 + .word 30695 + .word 50467 + .word 45209 + .word 25144 + .word 62418 + .word 17892 + .word 6287 + .word 3260 + .word 59477 + .word 50854 + .word 26251 + .word 62311 + .word 23506 + .word 18281 + .word 50215 + .word 3065 + .word 23294 + .word 51244 + .word 519 + .word 28602 + .word 60080 + .word 18671 + .word 56824 + .word 33188 + .word 7096 + .word 51634 + .word 27357 + .word 50961 + .word 5574 + .word 19062 + .word 7770 + .word 52374 + .word 38304 + .word 52025 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33559 + .word 2783 + .word 4720 + .word 38214 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 65291 + .word 24589 + .word 47090 + .word 40315 + .word 49166 + .word 0 + .word 0 + .word 0 + .word 7930 + .word 21505 + .word 15205 + .word 49607 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 61775 + .word 9936 + .word 17817 + .word 40691 + .word 49195 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 37628 + .word 658 + .word 37550 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 14352 + .word 33815 + .word 3114 + .word 50322 + .word 43816 + .word 13363 + .word 33081 + .word 17794 + .word 62601 + .word 27719 + .word 33798 + .word 50803 + .word 1036 + .word 16074 + .word 700 + .word 18277 + .word 33117 + .word 56648 + .word 64173 + .word 51286 + .word 17251 + .word 52492 + .word 29265 + .word 18761 + .word 11155 + .word 27451 + .word 30367 + .word 51772 + .word 7487 + .word 7247 + .word 2371 + .word 19248 + .word 14759 + .word 9929 + .word 13587 + .word 52258 + .word 11730 + .word 26190 + .word 56262 + .word 19733 + .word 56923 + .word 11047 + .word 18072 + .word 52745 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37589 + .word 36570 + .word 62298 + .word 45320 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 17708 + .word 57749 + .word 28642 + .word 45359 + .word 49169 + .word 0 + .word 0 + .word 0 + .word 40067 + .word 38581 + .word 2689 + .word 62790 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 36505 + .word 63458 + .word 34596 + .word 57945 + .word 49204 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 38946 + .word 9029 + .word 60159 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 61014 + .word 7077 + .word 17362 + .word 50576 + .word 11572 + .word 44638 + .word 49972 + .word 18098 + .word 64171 + .word 46242 + .word 17172 + .word 51158 + .word 7607 + .word 1130 + .word 63213 + .word 18682 + .word 20847 + .word 56361 + .word 38627 + .word 51744 + .word 49497 + .word 58620 + .word 43800 + .word 19268 + .word 63056 + .word 11021 + .word 657 + .word 52330 + .word 42127 + .word 49291 + .word 30722 + .word 19856 + .word 13674 + .word 31481 + .word 1908 + .word 52917 + .word 60194 + .word 12516 + .word 3868 + .word 20445 + .word 3386 + .word 31577 + .word 62924 + .word 53506 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44838 + .word 25647 + .word 6736 + .word 62345 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 31560 + .word 12645 + .word 60726 + .word 56699 + .word 49172 + .word 0 + .word 0 + .word 0 + .word 56942 + .word 25011 + .word 17364 + .word 49055 + .word 16425 + .word 0 + .word 0 + .word 0 + .word 3371 + .word 3119 + .word 24466 + .word 56588 + .word 49214 + .word 0 + .word 0 + .word 0 + .word 14336 + .word 15684 + .word 2636 + .word 36719 + .word 16468 + .word 0 + .word 0 + .word 0 + .word 47554 + .word 44810 + .word 53673 + .word 50840 + .word 53371 + .word 50832 + .word 58584 + .word 18417 + .word 46548 + .word 9025 + .word 35353 + .word 51530 + .word 2727 + .word 25780 + .word 5967 + .word 19108 + .word 27113 + .word 1073 + .word 59097 + .word 52222 + .word 11834 + .word 38905 + .word 4058 + .word 19800 + .word 56017 + .word 55971 + .word 60637 + .word 52914 + .word 5287 + .word 8439 + .word 65517 + .word 20493 + .word 37028 + .word 58958 + .word 62480 + .word 53607 + .word 57582 + .word 43721 + .word 1738 + .word 21188 + .word 9819 + .word 37368 + .word 17165 + .word 54304 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13429 + .word 7444 + .word 20593 + .word 34837 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 49742 + .word 37689 + .word 16091 + .word 38981 + .word 49176 + .word 0 + .word 0 + .word 0 + .word 46524 + .word 21314 + .word 39987 + .word 46372 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 14081 + .word 37459 + .word 64348 + .word 36776 + .word 49225 + .word 0 + .word 0 + .word 0 + .word 30720 + .word 57650 + .word 51740 + .word 32812 + .word 16482 + .word 0 + .word 0 + .word 0 + .word 13868 + .word 61714 + .word 32487 + .word 51118 + .word 53288 + .word 8914 + .word 15189 + .word 18750 + .word 25547 + .word 51031 + .word 54157 + .word 51918 + .word 4587 + .word 22569 + .word 2868 + .word 19552 + .word 4628 + .word 56702 + .word 63256 + .word 52720 + .word 60585 + .word 38579 + .word 10763 + .word 20354 + .word 20343 + .word 32825 + .word 42223 + .word 53523 + .word 15259 + .word 21287 + .word 25207 + .word 21157 + .word 19232 + .word 27853 + .word 30722 + .word 54327 + .word 6202 + .word 34921 + .word 46892 + .word 21963 + .word 54314 + .word 63337 + .word 3818 + .word 55135 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12932 + .word 7413 + .word 50416 + .word 52775 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 49070 + .word 42612 + .word 57119 + .word 58471 + .word 49179 + .word 0 + .word 0 + .word 0 + .word 37517 + .word 48554 + .word 12217 + .word 52169 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 3686 + .word 14060 + .word 10284 + .word 62061 + .word 49235 + .word 0 + .word 0 + .word 0 + .word 12288 + .word 36186 + .word 45004 + .word 41528 + .word 16496 + .word 0 + .word 0 + .word 0 + .word 36572 + .word 10708 + .word 62070 + .word 51404 + .word 43863 + .word 23526 + .word 34237 + .word 19093 + .word 49453 + .word 49937 + .word 30100 + .word 52320 + .word 42622 + .word 48103 + .word 45810 + .word 20009 + .word 63343 + .word 18283 + .word 24986 + .word 53236 + .word 211 + .word 7406 + .word 23986 + .word 20928 + .word 55487 + .word 58939 + .word 35978 + .word 54154 + .word 20786 + .word 29108 + .word 45903 + .word 21845 + .word 43676 + .word 27033 + .word 56912 + .word 55073 + .word 56762 + .word 13326 + .word 51569 + .word 22766 + .word 11195 + .word 61166 + .word 50980 + .word 55993 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8176 + .word 5164 + .word 64154 + .word 36090 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 19140 + .word 63711 + .word 39190 + .word 47508 + .word 49183 + .word 0 + .word 0 + .word 0 + .word 61957 + .word 29915 + .word 7046 + .word 34440 + .word 16447 + .word 0 + .word 0 + .word 0 + .word 29909 + .word 15770 + .word 39264 + .word 33288 + .word 49247 + .word 0 + .word 0 + .word 0 + .word 38912 + .word 2108 + .word 35420 + .word 36197 + .word 16511 + .word 0 + .word 0 + .word 0 + .word 63755 + .word 16362 + .word 32791 + .word 51700 + .word 7043 + .word 34288 + .word 50374 + .word 19448 + .word 36869 + .word 13569 + .word 51161 + .word 52734 + .word 30422 + .word 39536 + .word 34368 + .word 20483 + .word 2356 + .word 27571 + .word 10627 + .word 53769 + .word 24204 + .word 35273 + .word 27312 + .word 21520 + .word 8451 + .word 46569 + .word 41820 + .word 54805 + .word 23553 + .word 63476 + .word 47626 + .word 22556 + .word 30024 + .word 47627 + .word 14141 + .word 55843 + .word 22061 + .word 10635 + .word 17534 + .word 23595 + .word 50593 + .word 17237 + .word 38322 + .word 56882 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26357 + .word 41545 + .word 7157 + .word 37888 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 28550 + .word 47270 + .word 51275 + .word 41572 + .word 49187 + .word 0 + .word 0 + .word 0 + .word 7474 + .word 4460 + .word 27226 + .word 52743 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 18816 + .word 51641 + .word 26417 + .word 44610 + .word 49258 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 61733 + .word 61279 + .word 42447 + .word 16526 + .word 0 + .word 0 + .word 0 + .word 45407 + .word 18829 + .word 2399 + .word 52005 + .word 35928 + .word 2098 + .word 15792 + .word 19814 + .word 23614 + .word 62930 + .word 12196 + .word 53160 + .word 7674 + .word 56712 + .word 55660 + .word 20970 + .word 53358 + .word 2019 + .word 18277 + .word 54318 + .word 57563 + .word 186 + .word 18788 + .word 22129 + .word 38957 + .word 32276 + .word 61462 + .word 55475 + .word 46995 + .word 58305 + .word 12150 + .word 23287 + .word 60702 + .word 18274 + .word 9955 + .word 56635 + .word 40407 + .word 43665 + .word 14520 + .word 24448 + .word 50736 + .word 28578 + .word 16181 + .word 57795 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5404 + .word 12511 + .word 60447 + .word 38763 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 42770 + .word 34093 + .word 51209 + .word 39016 + .word 49191 + .word 0 + .word 0 + .word 0 + .word 6888 + .word 59302 + .word 12508 + .word 46457 + .word 16462 + .word 0 + .word 0 + .word 0 + .word 49565 + .word 60790 + .word 42341 + .word 36877 + .word 49270 + .word 0 + .word 0 + .word 0 + .word 28672 + .word 39351 + .word 39031 + .word 32932 + .word 16542 + .word 0 + .word 0 + .word 0 + .word 35933 + .word 37102 + .word 41613 + .word 52318 + .word 59745 + .word 3284 + .word 26050 + .word 20190 + .word 16458 + .word 62792 + .word 1547 + .word 53599 + .word 38519 + .word 37566 + .word 10560 + .word 21472 + .word 36560 + .word 62869 + .word 6875 + .word 54881 + .word 58623 + .word 15626 + .word 21634 + .word 22754 + .word 22503 + .word 3380 + .word 55147 + .word 56163 + .word 21679 + .word 23644 + .word 42908 + .word 24037 + .word 43760 + .word 1032 + .word 52442 + .word 57447 + .word 14782 + .word 45605 + .word 45261 + .word 25322 + .word 22271 + .word 11633 + .word 47287 + .word 58733 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _LRP,@object + .size _LRP,2496 + .align 16 +_RRIB: + .long 4234632914 + .long 3221491298 + .long 2516645996 + .long 3221465084 + .long 798659078 + .long 3221438870 + .long 2133702104 + .long 3221835523 + .long 3164494255 + .long 3221825037 + .long 4195286406 + .long 3221814551 + .long 816546054 + .long 3222285677 + .long 2019136897 + .long 3222284366 + .long 3221727740 + .long 3222283055 + .long 2093868532 + .long 3222538608 + .long 1475393241 + .long 3222538346 + .long 856917950 + .long 3222538084 + .long 2471449286 + .long 3222798751 + .long 629767309 + .long 3222798699 + .long 3083052628 + .long 3222798646 + .long 862741805 + .long 3223060539 + .long 4260232735 + .long 3223060531 + .long 3362756369 + .long 3223060524 + .long 3046734174 + .long 3223322627 + .long 1076409337 + .long 3223322627 + .long 3401051796 + .long 3223322626 + .long 1762435764 + .long 3223453696 + .long 1551329531 + .long 3223453696 + .long 1340223298 + .long 3223453696 + .long 175962963 + .long 3223584768 + .long 155133815 + .long 3223584768 + .long 134304667 + .long 3223584768 + .long 16073407 + .long 3223715840 + .long 14103082 + .long 3223715840 + .long 12132757 + .long 3223715840 + .long 1330068 + .long 3223846912 + .long 1175257 + .long 3223846912 + .long 1020446 + .long 3223846912 + .long 101663 + .long 3223977984 + .long 90404 + .long 3223977984 + .long 79145 + .long 3223977984 + .long 7020 + .long 3224109056 + .long 6457 + .long 3224109056 + .long 5894 + .long 3224109056 + .type _RRIB,@object + .size _RRIB,312 + .space 8, 0x00 # pad + .align 16 +_RRP: + .word 26273 + .word 65347 + .word 56168 + .word 33169 + .word 16329 + .word 0 + .word 0 + .word 0 + .word 899 + .word 31387 + .word 19253 + .word 49663 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58984 + .word 6058 + .word 23936 + .word 39799 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 62168 + .word 21442 + .word 12332 + .word 46245 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 32619 + .word 37054 + .word 53131 + .word 16575 + .word 61379 + .word 13125 + .word 14178 + .word 16562 + .word 10270 + .word 45115 + .word 37615 + .word 16506 + .word 38745 + .word 51073 + .word 34560 + .word 16498 + .word 53490 + .word 20212 + .word 2544 + .word 16440 + .word 38291 + .word 26669 + .word 54063 + .word 16440 + .word 45779 + .word 11956 + .word 18019 + .word 16540 + .word 18677 + .word 64033 + .word 42794 + .word 16529 + .word 35035 + .word 51098 + .word 10618 + .word 16473 + .word 64107 + .word 31719 + .word 36522 + .word 16468 + .word 8831 + .word 57419 + .word 13215 + .word 16407 + .word 40450 + .word 31904 + .word 29069 + .word 16417 + .word 3821 + .word 29651 + .word 12061 + .word 62640 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 3177 + .word 32099 + .word 13049 + .word 63749 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 10153 + .word 35464 + .word 38075 + .word 52902 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 20859 + .word 27364 + .word 47250 + .word 57481 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 12411 + .word 3381 + .word 24721 + .word 16978 + .word 33723 + .word 48761 + .word 26869 + .word 16934 + .word 60995 + .word 48715 + .word 17741 + .word 16804 + .word 43031 + .word 16238 + .word 40105 + .word 16761 + .word 3889 + .word 41280 + .word 47482 + .word 16635 + .word 43797 + .word 63405 + .word 37827 + .word 16594 + .word 62186 + .word 39109 + .word 61647 + .word 16889 + .word 62356 + .word 27755 + .word 9779 + .word 16848 + .word 54712 + .word 4438 + .word 22518 + .word 16720 + .word 46932 + .word 1372 + .word 7843 + .word 16677 + .word 64555 + .word 14297 + .word 39523 + .word 16553 + .word 24913 + .word 15735 + .word 26400 + .word 16514 + .word 23128 + .word 31275 + .word 33489 + .word 52246 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 56543 + .word 37040 + .word 59300 + .word 54866 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 35342 + .word 2554 + .word 44652 + .word 41504 + .word 16391 + .word 0 + .word 0 + .word 0 + .word 60438 + .word 21728 + .word 35033 + .word 43725 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 2425 + .word 35124 + .word 13908 + .word 17426 + .word 60985 + .word 47869 + .word 25665 + .word 17352 + .word 21213 + .word 45459 + .word 26876 + .word 17133 + .word 52591 + .word 14597 + .word 24526 + .word 17060 + .word 20426 + .word 18941 + .word 5374 + .word 16845 + .word 38724 + .word 49064 + .word 24125 + .word 16773 + .word 29994 + .word 36366 + .word 21088 + .word 17279 + .word 13269 + .word 25406 + .word 24800 + .word 17205 + .word 56893 + .word 35190 + .word 33689 + .word 16988 + .word 18235 + .word 52539 + .word 13276 + .word 16916 + .word 8454 + .word 46451 + .word 9758 + .word 16704 + .word 59084 + .word 57882 + .word 27928 + .word 16633 + .word 38110 + .word 57460 + .word 5118 + .word 49980 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 32056 + .word 19825 + .word 28737 + .word 63161 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 37650 + .word 4479 + .word 6518 + .word 59238 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 47963 + .word 64405 + .word 49841 + .word 37534 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 53082 + .word 25478 + .word 58397 + .word 17968 + .word 35980 + .word 11362 + .word 59289 + .word 17858 + .word 37178 + .word 29007 + .word 44012 + .word 17530 + .word 40762 + .word 17715 + .word 56491 + .word 17422 + .word 58318 + .word 3223 + .word 43216 + .word 17097 + .word 46157 + .word 23530 + .word 32141 + .word 16991 + .word 63138 + .word 35190 + .word 24151 + .word 17748 + .word 9862 + .word 36309 + .word 14376 + .word 17639 + .word 38034 + .word 65220 + .word 2337 + .word 17314 + .word 16819 + .word 31850 + .word 22525 + .word 17205 + .word 7604 + .word 29558 + .word 57367 + .word 16883 + .word 27719 + .word 62170 + .word 8797 + .word 16778 + .word 19348 + .word 65423 + .word 37299 + .word 53534 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 8233 + .word 55180 + .word 9457 + .word 46319 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 43066 + .word 26574 + .word 6722 + .word 65137 + .word 16400 + .word 0 + .word 0 + .word 0 + .word 4285 + .word 7102 + .word 7454 + .word 61224 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 1453 + .word 4915 + .word 61926 + .word 18584 + .word 43088 + .word 28644 + .word 50480 + .word 18434 + .word 16532 + .word 18100 + .word 54137 + .word 17983 + .word 49885 + .word 46980 + .word 54409 + .word 17832 + .word 24326 + .word 38273 + .word 20489 + .word 17385 + .word 28149 + .word 12270 + .word 61982 + .word 17236 + .word 4581 + .word 37632 + .word 45525 + .word 18282 + .word 46626 + .word 30655 + .word 34430 + .word 18132 + .word 63429 + .word 60638 + .word 37201 + .word 17683 + .word 18031 + .word 50879 + .word 14891 + .word 17535 + .word 64064 + .word 1811 + .word 54229 + .word 17089 + .word 27163 + .word 21077 + .word 40059 + .word 16943 + .word 43177 + .word 42972 + .word 46613 + .word 45511 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 51480 + .word 49923 + .word 15697 + .word 40352 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 9513 + .word 31676 + .word 11989 + .word 49652 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 30527 + .word 7034 + .word 38319 + .word 40746 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 7022 + .word 27009 + .word 58741 + .word 19257 + .word 64033 + .word 16049 + .word 22023 + .word 19062 + .word 45243 + .word 42262 + .word 39716 + .word 18476 + .word 50731 + .word 20793 + .word 36853 + .word 18281 + .word 36100 + .word 48270 + .word 37858 + .word 17699 + .word 42104 + .word 28941 + .word 36380 + .word 17506 + .word 23499 + .word 6717 + .word 19492 + .word 18866 + .word 55911 + .word 14060 + .word 7353 + .word 18672 + .word 26519 + .word 16988 + .word 4787 + .word 18087 + .word 28065 + .word 5309 + .word 5697 + .word 17893 + .word 40193 + .word 22022 + .word 5795 + .word 17314 + .word 8456 + .word 42078 + .word 24130 + .word 17122 + .word 59016 + .word 62162 + .word 39673 + .word 39540 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 38154 + .word 49049 + .word 18422 + .word 40324 + .word 16398 + .word 0 + .word 0 + .word 0 + .word 42164 + .word 50610 + .word 50330 + .word 49617 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 25875 + .word 59750 + .word 15469 + .word 40704 + .word 16427 + .word 0 + .word 0 + .word 0 + .word 34173 + .word 58862 + .word 54392 + .word 19977 + .word 59819 + .word 8454 + .word 18296 + .word 19734 + .word 30024 + .word 20882 + .word 32589 + .word 19004 + .word 29754 + .word 31085 + .word 31060 + .word 18761 + .word 52191 + .word 27376 + .word 34749 + .word 18035 + .word 4562 + .word 4929 + .word 33854 + .word 17794 + .word 25001 + .word 9100 + .word 13901 + .word 19490 + .word 47424 + .word 1290 + .word 2840 + .word 19248 + .word 22386 + .word 25633 + .word 77 + .word 18519 + .word 15514 + .word 17548 + .word 1870 + .word 18277 + .word 63012 + .word 41083 + .word 3742 + .word 17554 + .word 48968 + .word 51531 + .word 22462 + .word 17314 + .word 41404 + .word 42732 + .word 62757 + .word 38778 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 7009 + .word 42712 + .word 36892 + .word 45360 + .word 16401 + .word 0 + .word 0 + .word 0 + .word 39847 + .word 2109 + .word 39294 + .word 62791 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 32179 + .word 43914 + .word 44915 + .word 57947 + .word 16436 + .word 0 + .word 0 + .word 0 + .word 27779 + .word 16034 + .word 51140 + .word 20738 + .word 17003 + .word 57008 + .word 53620 + .word 20444 + .word 23469 + .word 38349 + .word 865 + .word 19562 + .word 25226 + .word 11109 + .word 43957 + .word 19268 + .word 36845 + .word 29881 + .word 17299 + .word 18390 + .word 19837 + .word 16116 + .word 50064 + .word 18098 + .word 57862 + .word 29290 + .word 2992 + .word 20149 + .word 46818 + .word 59090 + .word 31382 + .word 19856 + .word 61466 + .word 30954 + .word 38749 + .word 18976 + .word 30984 + .word 39998 + .word 63388 + .word 18682 + .word 41543 + .word 16681 + .word 17428 + .word 17808 + .word 20643 + .word 64049 + .word 24643 + .word 17517 + .word 52468 + .word 15578 + .word 48717 + .word 44571 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 54595 + .word 6191 + .word 4821 + .word 56700 + .word 16404 + .word 0 + .word 0 + .word 0 + .word 50514 + .word 10282 + .word 25695 + .word 49055 + .word 16425 + .word 0 + .word 0 + .word 0 + .word 13176 + .word 11594 + .word 38881 + .word 56588 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 28019 + .word 59660 + .word 42453 + .word 21536 + .word 50810 + .word 20541 + .word 28938 + .word 21188 + .word 53928 + .word 47752 + .word 60679 + .word 20146 + .word 24270 + .word 60826 + .word 4097 + .word 19800 + .word 57327 + .word 59875 + .word 35368 + .word 18762 + .word 31038 + .word 58486 + .word 58593 + .word 18417 + .word 41074 + .word 26743 + .word 60755 + .word 20839 + .word 49334 + .word 8669 + .word 63919 + .word 20493 + .word 20472 + .word 19395 + .word 59120 + .word 19454 + .word 27230 + .word 61299 + .word 5980 + .word 19108 + .word 60536 + .word 14479 + .word 53684 + .word 18072 + .word 24589 + .word 24698 + .word 60903 + .word 17729 + .word 24724 + .word 11272 + .word 24781 + .word 60135 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 54850 + .word 34200 + .word 16766 + .word 38981 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 58717 + .word 18738 + .word 40849 + .word 46372 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 11614 + .word 63671 + .word 65373 + .word 36776 + .word 16457 + .word 0 + .word 0 + .word 0 + .word 54464 + .word 24503 + .word 3823 + .word 22367 + .word 6780 + .word 11041 + .word 46896 + .word 21963 + .word 31922 + .word 33372 + .word 42225 + .word 20755 + .word 24666 + .word 18144 + .word 10765 + .word 20354 + .word 1690 + .word 51390 + .word 54159 + .word 19150 + .word 40728 + .word 53860 + .word 15190 + .word 18750 + .word 62163 + .word 16835 + .word 30725 + .word 21559 + .word 49586 + .word 46435 + .word 25209 + .word 21157 + .word 392 + .word 18629 + .word 63258 + .word 19952 + .word 57023 + .word 35208 + .word 2869 + .word 19552 + .word 15849 + .word 23514 + .word 32489 + .word 18350 + .word 45455 + .word 56342 + .word 1433 + .word 17952 + .word 26203 + .word 24931 + .word 14914 + .word 64372 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 32494 + .word 4334 + .word 57160 + .word 58471 + .word 16411 + .word 0 + .word 0 + .word 0 + .word 38313 + .word 48554 + .word 12217 + .word 52169 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 13841 + .word 14060 + .word 10284 + .word 62061 + .word 16467 + .word 0 + .word 0 + .word 0 + .word 27928 + .word 25887 + .word 22600 + .word 23226 + .word 25867 + .word 43031 + .word 24792 + .word 22767 + .word 61361 + .word 28179 + .word 36008 + .word 21386 + .word 1901 + .word 19713 + .word 23997 + .word 20928 + .word 53849 + .word 49977 + .word 30100 + .word 19552 + .word 12987 + .word 23545 + .word 34237 + .word 19093 + .word 36035 + .word 18526 + .word 55738 + .word 22305 + .word 4173 + .word 53170 + .word 44844 + .word 21845 + .word 20134 + .word 6065 + .word 24986 + .word 20468 + .word 63684 + .word 40633 + .word 45810 + .word 20009 + .word 28281 + .word 10708 + .word 62070 + .word 18636 + .word 42557 + .word 63889 + .word 18197 + .word 18180 + .word 24464 + .word 43564 + .word 52277 + .word 36083 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 8651 + .word 37688 + .word 39193 + .word 47508 + .word 16415 + .word 0 + .word 0 + .word 0 + .word 61957 + .word 29915 + .word 7046 + .word 34440 + .word 16447 + .word 0 + .word 0 + .word 0 + .word 29909 + .word 15770 + .word 39264 + .word 33288 + .word 16479 + .word 0 + .word 0 + .word 0 + .word 16042 + .word 19253 + .word 38322 + .word 24114 + .word 28448 + .word 10617 + .word 17534 + .word 23595 + .word 64229 + .word 46570 + .word 41820 + .word 22037 + .word 23727 + .word 35273 + .word 27312 + .word 21520 + .word 36874 + .word 13569 + .word 51161 + .word 19966 + .word 7043 + .word 34288 + .word 50374 + .word 19448 + .word 38316 + .word 47529 + .word 14141 + .word 23075 + .word 12297 + .word 63477 + .word 47626 + .word 22556 + .word 1229 + .word 27571 + .word 10627 + .word 21001 + .word 30426 + .word 39536 + .word 34368 + .word 20483 + .word 63755 + .word 16362 + .word 32791 + .word 18932 + .word 1939 + .word 19329 + .word 44209 + .word 18417 + .word 1291 + .word 6677 + .word 4999 + .word 37888 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 36671 + .word 58224 + .word 51275 + .word 41572 + .word 16419 + .word 0 + .word 0 + .word 0 + .word 7476 + .word 4460 + .word 27226 + .word 52743 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 18838 + .word 51641 + .word 26417 + .word 44610 + .word 16490 + .word 0 + .word 0 + .word 0 + .word 10710 + .word 48640 + .word 32083 + .word 25027 + .word 33620 + .word 55766 + .word 26236 + .word 24448 + .word 24667 + .word 39142 + .word 61464 + .word 22707 + .word 56170 + .word 8470 + .word 18789 + .word 22129 + .word 23296 + .word 62931 + .word 12196 + .word 20392 + .word 57231 + .word 2098 + .word 15792 + .word 19814 + .word 1704 + .word 49608 + .word 9547 + .word 23867 + .word 46419 + .word 24648 + .word 11891 + .word 23287 + .word 19376 + .word 1296 + .word 18277 + .word 21550 + .word 46223 + .word 56399 + .word 55660 + .word 20970 + .word 45364 + .word 18829 + .word 2399 + .word 19237 + .word 9387 + .word 60414 + .word 47613 + .word 18660 + .type _RRP,@object + .size _RRP,2080 + .align 16 +_LN_SQRT_TWO_PI: + .word 42293 + .word 9717 + .word 36419 + .word 60223 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _LN_SQRT_TWO_PI,@object + .size _LN_SQRT_TWO_PI,16 + .align 16 +_S10: + .word 26777 + .word 63736 + .word 61426 + .word 52480 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _S10,@object + .size _S10,16 + .align 16 +_W2: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _W2,@object + .size _W2,16 + .align 16 +_S06: + .word 26251 + .word 64205 + .word 25991 + .word 44448 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _S06,@object + .size _S06,16 + .align 16 +_S02: + .word 39072 + .word 38974 + .word 13074 + .word 53901 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _S02,@object + .size _S02,16 + .align 16 +_S12: + .word 13864 + .word 61389 + .word 41932 + .word 43701 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _S12,@object + .size _S12,16 + .align 16 +_S08: + .word 6565 + .word 12686 + .word 39772 + .word 32901 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _S08,@object + .size _S08,16 + .align 16 +_S04: + .word 60211 + .word 16071 + .word 37206 + .word 35465 + .word 49150 + .word 0 + .word 0 + .word 0 + .type _S04,@object + .size _S04,16 + .align 16 +_A: + .long 0 + .long 1074790400 + .long 0 + .long 1075838976 + .long 0 + .long 1076887552 + .long 0 + .long 1077936128 + .long 0 + .long 1078984704 + .long 0 + .long 1080033280 + .long 0 + .long 1081081856 + .type _A,@object + .size _A,56 + .space 8, 0x00 # pad + .align 16 +_B: + .long 0 + .long 1070596096 + .long 0 + .long 1069547520 + .long 0 + .long 1068498944 + .long 0 + .long 1067450368 + .long 0 + .long 1066401792 + .long 0 + .long 1065353216 + .long 0 + .long 1064304640 + .type _B,@object + .size _B,56 + .space 8, 0x00 # pad + .align 16 +_C5: + .word 65250 + .word 31226 + .word 64195 + .word 51294 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 2062 + .word 11523 + .word 15490 + .word 40735 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 32754 + .word 31980 + .word 31403 + .word 49421 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 43174 + .word 39951 + .word 44282 + .word 37916 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 17740 + .word 24638 + .word 31711 + .word 45907 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 40119 + .word 37337 + .word 13155 + .word 65076 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 17604 + .word 23486 + .word 20029 + .word 41172 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 33185 + .word 5727 + .word 44714 + .word 50187 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 59315 + .word 25153 + .word 8859 + .word 35740 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 56975 + .word 59828 + .word 57702 + .word 65082 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 44451 + .word 24185 + .word 18874 + .word 60288 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 63603 + .word 63450 + .word 63770 + .word 55108 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 29224 + .word 39171 + .word 38378 + .word 49676 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 11522 + .word 59843 + .word 6225 + .word 34695 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 52920 + .word 16467 + .word 35974 + .word 40266 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 32911 + .word 20526 + .word 49212 + .word 40083 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 50633 + .word 19120 + .word 5716 + .word 64631 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 27278 + .word 20509 + .word 60679 + .word 63371 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 47711 + .word 23018 + .word 38994 + .word 51179 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 57200 + .word 35818 + .word 16826 + .word 37630 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 2413 + .word 19605 + .word 64315 + .word 49218 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 41670 + .word 6403 + .word 34702 + .word 40993 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 6011 + .word 2134 + .word 32659 + .word 52266 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42605 + .word 32107 + .word 35187 + .word 43545 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 3574 + .word 60450 + .word 45882 + .word 53610 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 2808 + .word 20835 + .word 5027 + .word 56256 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 3021 + .word 28181 + .word 33636 + .word 39028 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 14493 + .word 33433 + .word 18281 + .word 35725 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 39323 + .word 51299 + .word 2596 + .word 32961 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 28336 + .word 24032 + .word 53553 + .word 44237 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 52853 + .word 63658 + .word 36534 + .word 41882 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 47917 + .word 51227 + .word 19034 + .word 54081 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 51044 + .word 31166 + .word 18963 + .word 37856 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 35962 + .word 40199 + .word 871 + .word 65049 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 39889 + .word 54182 + .word 40011 + .word 55797 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 29169 + .word 47361 + .word 8730 + .word 38268 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 39706 + .word 37143 + .word 20168 + .word 33289 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 16433 + .word 42895 + .word 21426 + .word 43820 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 1625 + .word 9463 + .word 65082 + .word 51468 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 58247 + .word 1594 + .word 2790 + .word 48648 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 20868 + .word 31765 + .word 34026 + .word 33401 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 23737 + .word 4448 + .word 39427 + .word 52225 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 3456 + .word 40222 + .word 65015 + .word 38939 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 35551 + .word 41260 + .word 40325 + .word 54131 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 8973 + .word 47485 + .word 2472 + .word 41842 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 43053 + .word 31703 + .word 19755 + .word 33274 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36731 + .word 27611 + .word 11212 + .word 55816 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 63893 + .word 30149 + .word 45246 + .word 60594 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 47198 + .word 37666 + .word 57801 + .word 61119 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 25856 + .word 56265 + .word 35798 + .word 40402 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 6470 + .word 34102 + .word 54471 + .word 38654 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 9295 + .word 39366 + .word 17179 + .word 34081 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 45822 + .word 31766 + .word 42784 + .word 47587 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 5059 + .word 11140 + .word 37473 + .word 43359 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58055 + .word 60744 + .word 5900 + .word 57832 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 38212 + .word 45613 + .word 58947 + .word 40054 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 7938 + .word 56610 + .word 27106 + .word 34591 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 32824 + .word 16764 + .word 60057 + .word 56720 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 10908 + .word 30532 + .word 62164 + .word 40510 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 63750 + .word 13029 + .word 27501 + .word 34026 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 33477 + .word 11068 + .word 13144 + .word 46215 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 42530 + .word 57434 + .word 58521 + .word 52671 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 18986 + .word 9605 + .word 39740 + .word 51163 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 28928 + .word 13634 + .word 42974 + .word 34196 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 35215 + .word 30142 + .word 47225 + .word 54824 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 28719 + .word 4316 + .word 52012 + .word 39873 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 4508 + .word 8703 + .word 27075 + .word 56773 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 26288 + .word 30246 + .word 8808 + .word 42848 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 44455 + .word 3575 + .word 25942 + .word 45691 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2794 + .word 62330 + .word 8461 + .word 63853 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 21479 + .word 44765 + .word 7865 + .word 64840 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 31874 + .word 33681 + .word 56423 + .word 65041 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 21473 + .word 44172 + .word 64358 + .word 41494 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 32222 + .word 10523 + .word 55592 + .word 40956 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 21434 + .word 30837 + .word 63797 + .word 34911 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 39649 + .word 32992 + .word 36682 + .word 50257 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 13095 + .word 39473 + .word 7384 + .word 44359 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 31843 + .word 64809 + .word 59872 + .word 60895 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 8672 + .word 5021 + .word 16314 + .word 40945 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 39714 + .word 18801 + .word 4723 + .word 36324 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 614 + .word 42734 + .word 5731 + .word 57950 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 64434 + .word 24821 + .word 2679 + .word 42435 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 12194 + .word 23846 + .word 20957 + .word 34750 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 10830 + .word 21930 + .word 2400 + .word 48308 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 22166 + .word 52453 + .word 43476 + .word 53777 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 47257 + .word 46311 + .word 24367 + .word 53391 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 54217 + .word 40926 + .word 61378 + .word 34907 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 63951 + .word 56465 + .word 60729 + .word 57145 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 26614 + .word 13946 + .word 18662 + .word 40698 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 1838 + .word 12847 + .word 15941 + .word 59142 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 4759 + .word 49273 + .word 38799 + .word 43731 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 26568 + .word 56798 + .word 57629 + .word 34217 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25804 + .word 39657 + .word 51638 + .word 34652 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 2771 + .word 24731 + .word 11874 + .word 33806 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 19474 + .word 34269 + .word 14010 + .word 33912 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 56824 + .word 53459 + .word 23053 + .word 42279 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 18742 + .word 13031 + .word 52011 + .word 42483 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 5937 + .word 64580 + .word 50859 + .word 35501 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 23055 + .word 38603 + .word 6524 + .word 51938 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 3664 + .word 27625 + .word 50793 + .word 45121 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 52489 + .word 3557 + .word 32438 + .word 62735 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 894 + .word 16203 + .word 51477 + .word 42152 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 34963 + .word 47118 + .word 6430 + .word 37322 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 26422 + .word 42936 + .word 42081 + .word 58310 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 13130 + .word 21399 + .word 54693 + .word 43505 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 30323 + .word 50910 + .word 30337 + .word 35076 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 38115 + .word 10576 + .word 10000 + .word 49442 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 37599 + .word 18432 + .word 63354 + .word 54317 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 58822 + .word 42699 + .word 64187 + .word 54575 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 64288 + .word 61574 + .word 23831 + .word 35266 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 11805 + .word 33285 + .word 40274 + .word 58365 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 20167 + .word 739 + .word 36989 + .word 41119 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 62447 + .word 46690 + .word 58491 + .word 60379 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 1463 + .word 47000 + .word 35484 + .word 44185 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 64817 + .word 40328 + .word 40776 + .word 61320 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60250 + .word 42976 + .word 52322 + .word 36598 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 26918 + .word 53639 + .word 1629 + .word 34777 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 192 + .word 43979 + .word 65472 + .word 34978 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 52261 + .word 56023 + .word 49807 + .word 42881 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 1627 + .word 46939 + .word 43260 + .word 43630 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 60557 + .word 13735 + .word 20430 + .word 35946 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 37731 + .word 15708 + .word 47147 + .word 53188 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 21753 + .word 29315 + .word 41089 + .word 45691 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 6001 + .word 56966 + .word 64901 + .word 64096 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 60203 + .word 9392 + .word 60017 + .word 43055 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 63698 + .word 8838 + .word 668 + .word 38058 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 63354 + .word 11979 + .word 38628 + .word 58569 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 14495 + .word 23154 + .word 18917 + .word 44293 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 21391 + .word 34042 + .word 43308 + .word 35313 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 19364 + .word 56057 + .word 34969 + .word 50274 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 24688 + .word 56191 + .word 53239 + .word 54710 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 29387 + .word 5660 + .word 12964 + .word 55444 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 35686 + .word 64227 + .word 46433 + .word 35526 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 36666 + .word 59843 + .word 47733 + .word 59258 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 36678 + .word 17293 + .word 20572 + .word 41425 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 18431 + .word 63251 + .word 49151 + .word 61285 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 60545 + .word 37455 + .word 56348 + .word 44514 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 37261 + .word 1613 + .word 29792 + .word 57954 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15271 + .word 17124 + .word 50042 + .word 38057 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 7933 + .word 60764 + .word 31972 + .word 35498 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 36698 + .word 903 + .word 21735 + .word 35834 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 61921 + .word 64342 + .word 37428 + .word 43367 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 25723 + .word 57108 + .word 17005 + .word 44538 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 55361 + .word 30601 + .word 552 + .word 36302 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 60144 + .word 14680 + .word 32635 + .word 54172 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 56958 + .word 12456 + .word 10479 + .word 46147 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 483 + .word 34108 + .word 14727 + .word 65164 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 43794 + .word 49057 + .word 50532 + .word 43789 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 12225 + .word 29228 + .word 35085 + .word 38633 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 54219 + .word 64754 + .word 11030 + .word 58760 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 52932 + .word 63137 + .word 8758 + .word 44908 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 27270 + .word 37632 + .word 62601 + .word 35495 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 53773 + .word 63879 + .word 47305 + .word 50923 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 29965 + .word 53650 + .word 14162 + .word 55014 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 10444 + .word 24307 + .word 52989 + .word 56120 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 12949 + .word 6021 + .word 2059 + .word 35728 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 41140 + .word 26313 + .word 26076 + .word 59954 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 53675 + .word 12584 + .word 54309 + .word 41661 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 28849 + .word 13964 + .word 11627 + .word 61991 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 33057 + .word 63851 + .word 41026 + .word 44769 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 61939 + .word 60366 + .word 37868 + .word 56319 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _C5,@object + .size _C5,2688 + .align 16 +_C4: + .word 39764 + .word 13333 + .word 46799 + .word 55432 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 6306 + .word 35111 + .word 59607 + .word 63624 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 40772 + .word 10749 + .word 40067 + .word 48311 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 17977 + .word 41258 + .word 10043 + .word 63023 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 17757 + .word 54940 + .word 38650 + .word 52104 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 36152 + .word 14316 + .word 50442 + .word 43322 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 48990 + .word 25502 + .word 42020 + .word 58640 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 57431 + .word 49505 + .word 17362 + .word 46284 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 34483 + .word 2420 + .word 54299 + .word 50782 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 37575 + .word 3091 + .word 26415 + .word 50860 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 5185 + .word 25440 + .word 63351 + .word 37946 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 37934 + .word 12918 + .word 47534 + .word 41618 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 59537 + .word 51974 + .word 16286 + .word 51369 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 31611 + .word 51820 + .word 58572 + .word 58708 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 57757 + .word 54077 + .word 23114 + .word 64558 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 63584 + .word 48263 + .word 62815 + .word 37616 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 281 + .word 14439 + .word 46939 + .word 38182 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 63169 + .word 10307 + .word 53265 + .word 44896 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 22654 + .word 54923 + .word 22649 + .word 42855 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 37607 + .word 64061 + .word 25856 + .word 50581 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 47296 + .word 11647 + .word 64103 + .word 45853 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 30544 + .word 55384 + .word 11467 + .word 54194 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 39553 + .word 55407 + .word 30581 + .word 33698 + .word 49111 + .word 0 + .word 0 + .word 0 + .type _C4,@object + .size _C4,368 + .align 16 +_C3: + .word 28854 + .word 1182 + .word 12345 + .word 55415 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 12848 + .word 12413 + .word 26149 + .word 42266 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 13313 + .word 43952 + .word 210 + .word 35312 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 13187 + .word 60452 + .word 5475 + .word 43161 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 20972 + .word 51120 + .word 32272 + .word 61954 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 22296 + .word 60123 + .word 44502 + .word 16231 + .word 21517 + .word 49855 + .word 35525 + .word 48979 + .word 44698 + .word 63620 + .word 45930 + .word 16192 + .word 34147 + .word 51190 + .word 16340 + .word 48941 + .word 42301 + .word 55313 + .word 4730 + .word 16154 + .word 35999 + .word 24973 + .word 36325 + .word 48903 + .word 63277 + .word 55760 + .word 33014 + .word 16117 + .word 6314 + .word 46281 + .word 52205 + .word 48867 + .word 12513 + .word 17037 + .word 21130 + .word 16082 + .word 49946 + .word 1999 + .word 4813 + .word 48833 + .word 595 + .word 34534 + .word 265 + .word 16049 + .word 36690 + .word 64093 + .word 7546 + .word 48800 + .type _C3,@object + .size _C3,176 + .align 16 +_LM: + .word 64512 + .word 46577 + .word 49946 + .word 47894 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _LM,@object + .size _LM,16 + .align 16 +_LGAMMA_C2: + .word 3599 + .word 7250 + .word 52710 + .word 63693 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 31159 + .word 473 + .word 17060 + .word 35466 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 23705 + .word 29125 + .word 24135 + .word 63417 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 8259 + .word 13793 + .word 15470 + .word 38689 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 1592 + .word 43035 + .word 5286 + .word 33882 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 34241 + .word 35161 + .word 18170 + .word 34381 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 17215 + .word 38817 + .word 26343 + .word 16274 + .word 43407 + .word 38166 + .word 8095 + .word 49029 + .word 9256 + .word 10755 + .word 64736 + .word 16248 + .word 19293 + .word 8064 + .word 12058 + .word 49006 + .word 55284 + .word 28504 + .word 33554 + .word 16226 + .word 50892 + .word 40251 + .word 63876 + .word 48982 + .word 34903 + .word 32886 + .word 50950 + .word 16204 + .word 5270 + .word 55866 + .word 9779 + .word 48962 + .word 8284 + .word 46907 + .word 3681 + .word 16183 + .word 12968 + .word 35363 + .word 2442 + .word 48942 + .word 52637 + .word 49970 + .word 50463 + .word 16163 + .word 28134 + .word 34361 + .word 26628 + .word 48914 + .type _LGAMMA_C2,@object + .size _LGAMMA_C2,192 + .align 16 +_C1: + .word 51111 + .word 32176 + .word 26595 + .word 37828 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 38980 + .word 38974 + .word 13074 + .word 53901 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30416 + .word 21910 + .word 43743 + .word 52518 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 47709 + .word 16075 + .word 37206 + .word 35465 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 15719 + .word 21694 + .word 57533 + .word 54364 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 13628 + .word 45309 + .word 46092 + .word 16325 + .word 18814 + .word 7557 + .word 28730 + .word 49090 + .word 30522 + .word 27866 + .word 4275 + .word 16320 + .word 35905 + .word 26356 + .word 32871 + .word 49084 + .word 38506 + .word 60969 + .word 40989 + .word 16313 + .word 18199 + .word 53198 + .word 18595 + .word 49079 + .word 21817 + .word 41319 + .word 22094 + .word 16309 + .word 3261 + .word 2506 + .word 46646 + .word 49075 + .word 41261 + .word 44393 + .word 26269 + .word 16306 + .word 45347 + .word 5923 + .word 3109 + .word 49073 + .word 3843 + .word 55608 + .word 31192 + .word 16299 + .word 33944 + .word 58380 + .word 1271 + .word 49050 + .type _C1,@object + .size _C1,176 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xc3300000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x40080000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 4 +.L_2il0floatpacket.8: + .long 0x3f800000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_S26: + .long 1826776023 + .long 1070820717 + .type _S26,@object + .size _S26,8 + .align 4 +_S22: + .long 342869935 + .long 3214497781 + .type _S22,@object + .size _S22,8 + .align 4 +_S18: + .long 1060196486 + .long 3216761200 + .type _S18,@object + .size _S18,8 + .align 4 +_S14: + .long 3265047626 + .long 3217180894 + .type _S14,@object + .size _S14,8 + .align 4 +_W4: + .long 381774871 + .long 3211182444 + .type _W4,@object + .size _W4,8 + .align 4 +_S28: + .long 2468013457 + .long 3218873328 + .type _S28,@object + .size _S28,8 + .align 4 +_S24: + .long 3872164012 + .long 3218225849 + .type _S24,@object + .size _S24,8 + .align 4 +_S20: + .long 1339685656 + .long 3216855407 + .type _S20,@object + .size _S20,8 + .align 4 +_S16: + .long 618803264 + .long 3217033139 + .type _S16,@object + .size _S16,8 + .align 4 +_PBIG: + .long 4294967295 + .long 2146435071 + .type _PBIG,@object + .size _PBIG,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lgammaf.S b/external/sgx_libm/intel64/lgammaf.S new file mode 100644 index 0000000000..dadd3618b9 --- /dev/null +++ b/external/sgx_libm/intel64/lgammaf.S @@ -0,0 +1,6068 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lgammaf.c" + .text +..TXTST0: +# -- Begin lgammaf + .text + .align 16,0x90 + .globl lgammaf +lgammaf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_lgammaf.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $120, %rsp + .cfi_def_cfa_offset 176 + xorb %r12b, %r12b + movss %xmm0, 112(%rsp) + xorb %bpl, %bpl + movzwl 114(%rsp), %r15d + andl $32640, %r15d + movd %xmm0, %eax + shrl $7, %r15d + andl $8388607, %eax + movl %r15d, %r14d + shll $23, %r14d + movb 115(%rsp), %r13b + orl %eax, %r14d + andb $-128, %r13b +..B1.2: + fnstcw 110(%rsp) +..B1.3: +..___tag_value_lgammaf.16: + call fegetround@PLT +..___tag_value_lgammaf.17: +..B1.156: + movl %eax, %ebx +..B1.4: + testl %ebx, %ebx + je ..B1.6 +..B1.5: + xorl %edi, %edi + movb $1, %r12b +..___tag_value_lgammaf.18: + call fesetround@PLT +..___tag_value_lgammaf.19: +..B1.6: + movzwl 110(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.10 +..B1.7: + orl $-64768, %edx + movw %dx, 108(%rsp) +..B1.8: + fldcw 108(%rsp) +..B1.9: + movb $1, %bpl +..B1.10: + cmpl $255, %r15d + jne ..B1.16 +..B1.11: + testb %bpl, %bpl + je ..B1.13 +..B1.12: + fldcw 110(%rsp) +..B1.13: + testb %r12b, %r12b + je ..B1.15 +..B1.14: + movl %ebx, %edi +..___tag_value_lgammaf.20: + call fesetround@PLT +..___tag_value_lgammaf.21: +..B1.15: + movss 112(%rsp), %xmm0 + mulss %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.16: + testl %r14d, %r14d + je ..B1.149 +..B1.17: + testb %r13b, %r13b + jne ..B1.74 +..B1.18: + cmpl $2084876174, %r14d + jae ..B1.136 +..B1.19: + movss 112(%rsp), %xmm0 + ucomiss .L_2il0floatpacket.6(%rip), %xmm0 + jp ..B1.20 + je ..B1.131 +..B1.20: + cmpl $1174405120, %r14d + jb ..B1.26 +..B1.21: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm0, 56(%rsp) + pxor %xmm0, %xmm0 + flds 56(%rsp) + cvtss2sd 56(%rsp), %xmm0 + fsub %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fstps 32(%rsp) + fldt (%rax) + fstpt 16(%rsp) + call log@PLT +..B1.157: + fldt (%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fmull 56(%rsp) + fstpt (%rsp) + je ..B1.23 +..B1.22: + movl %ebx, %edi +..___tag_value_lgammaf.42: + call fesetround@PLT +..___tag_value_lgammaf.43: +..B1.23: + fldt (%rsp) + testb %bpl, %bpl + fldt 16(%rsp) + faddp %st, %st(1) + fsubs 32(%rsp) + fstps 104(%rsp) + je ..B1.124 +..B1.24: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.26: + cmpl $1082130432, %r14d + jb ..B1.33 +..B1.27: + addl $-1082130432, %r14d + lea _A(%rip), %rax + sarl $23, %r14d + lea _B(%rip), %rdx + movslq %r14d, %r14 + lea _C5(%rip), %r8 + movss %xmm0, 56(%rsp) + lea (,%r14,8), %ecx + flds 56(%rsp) + lea (%r14,%r14,2), %esi + movslq %ecx, %rcx + lea _C5_0(%rip), %r9 + movslq %esi, %rsi + testb %r12b, %r12b + fsubs (%rax,%r14,4) + fmuls (%rdx,%r14,4) + fld %st(0) + fmul %st(1), %st + fldl 8(%r8,%rcx,8) + fmul %st(1), %st + fldl (%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 40(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 32(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 8(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl (%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 56(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 48(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 24(%r8,%rcx,8) + fmulp %st, %st(3) + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(2) + faddl 16(%r8,%rcx,8) + fmulp %st, %st(1) + faddl 16(%r9,%rsi,8) + fstpt (%rsp) + je ..B1.30 +..B1.28: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.44: + call fesetround@PLT +..___tag_value_lgammaf.45: +..B1.29: + fldt 80(%rsp) +..B1.30: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.31: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.33: + ucomiss .L_2il0floatpacket.4(%rip), %xmm0 + jp ..B1.34 + je ..B1.126 +..B1.34: + movss %xmm0, 56(%rsp) + cmpl $1073741824, %r14d + flds 56(%rsp) + jbe ..B1.40 +..B1.35: + fldt .L_2il0floatpacket.5(%rip) + fld %st(1) + lea _C4(%rip), %r9 + lea 8+_C4(%rip), %rax + fmul %st(2), %st + lea 32+_C4(%rip), %r10 + fldl (%rax) + lea 40+_C4(%rip), %rdx + fmul %st(1), %st + lea 64+_C4(%rip), %r11 + fldl (%r9) + lea 72+_C4(%rip), %rcx + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + lea 48+_C4(%rip), %r13 + lea 56+_C4(%rip), %rsi + fmul %st(2), %st + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + lea 16+_C4(%rip), %r14 + lea 24+_C4(%rip), %r8 + fmul %st(2), %st + fxch %st(1) + faddl (%r13) + fmul %st(2), %st + fxch %st(1) + faddl (%r8) + lea 80+_C4(%rip), %r15 + testb %r12b, %r12b + fmul %st(4), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(3) + fsubrp %st, %st(4) + faddl (%r14) + fmulp %st, %st(1) + faddl (%r15) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.37 +..B1.36: + movl %ebx, %edi +..___tag_value_lgammaf.46: + call fesetround@PLT +..___tag_value_lgammaf.47: +..B1.37: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B1.124 +..B1.38: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.40: + cmpl $1071644672, %r14d + jb ..B1.47 +..B1.41: + fld %st(0) + lea 16+_C3(%rip), %rax + fmul %st(1), %st + lea 48+_C3(%rip), %rdx + fldl (%rax) + lea 32+_C3(%rip), %rcx + fmul %st(1), %st + lea 64+_C3(%rip), %rsi + lea 8+_C3(%rip), %r8 + lea 40+_C3(%rip), %r9 + lea 24+_C3(%rip), %r10 + lea 56+_C3(%rip), %r11 + lea _C3(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B1.44 +..B1.42: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.48: + call fesetround@PLT +..___tag_value_lgammaf.49: +..B1.43: + fldt 80(%rsp) +..B1.44: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.45: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.47: + cmpl $1069547520, %r14d + jb ..B1.54 +..B1.48: + fld %st(0) + lea 16+_LGAMMAF_C2(%rip), %rax + fmul %st(1), %st + lea 48+_LGAMMAF_C2(%rip), %rdx + fldl (%rax) + lea 32+_LGAMMAF_C2(%rip), %rcx + fmul %st(1), %st + lea 64+_LGAMMAF_C2(%rip), %rsi + lea 8+_LGAMMAF_C2(%rip), %r8 + lea 40+_LGAMMAF_C2(%rip), %r9 + lea 24+_LGAMMAF_C2(%rip), %r10 + lea 56+_LGAMMAF_C2(%rip), %r11 + lea _LGAMMAF_C2(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B1.51 +..B1.49: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.50: + call fesetround@PLT +..___tag_value_lgammaf.51: +..B1.50: + fldt 80(%rsp) +..B1.51: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.52: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.54: + cmpl $1067450368, %r14d + jb ..B1.61 +..B1.55: + lea _LM(%rip), %rax + lea 16+_C1(%rip), %rdx + lea 48+_C1(%rip), %rcx + lea 32+_C1(%rip), %rsi + lea 64+_C1(%rip), %r8 + lea 8+_C1(%rip), %r9 + lea 40+_C1(%rip), %r10 + lea 24+_C1(%rip), %r11 + fldl (%rdx) + lea 56+_C1(%rip), %r13 + lea _C1(%rip), %r14 + testb %r12b, %r12b + fxch %st(1) + fsubl (%rax) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(2) + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmulp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmul %st(2), %st + faddl (%r13) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r14) + fstpt (%rsp) + je ..B1.58 +..B1.56: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.52: + call fesetround@PLT +..___tag_value_lgammaf.53: +..B1.57: + fldt 80(%rsp) +..B1.58: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.59: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.61: + cmpl $1065353216, %r14d + jb ..B1.68 +..B1.62: + fld %st(0) + lea 16+_C0(%rip), %rax + fmul %st(1), %st + lea 48+_C0(%rip), %rdx + fldl (%rax) + lea 32+_C0(%rip), %rcx + fmul %st(1), %st + lea 64+_C0(%rip), %rsi + lea 8+_C0(%rip), %r8 + lea 40+_C0(%rip), %r9 + lea 24+_C0(%rip), %r10 + lea 56+_C0(%rip), %r11 + lea _C0(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B1.65 +..B1.63: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.54: + call fesetround@PLT +..___tag_value_lgammaf.55: +..B1.64: + fldt 80(%rsp) +..B1.65: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.66: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.68: + fldt .L_2il0floatpacket.0(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fadd %st(1), %st + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value_lgammaf.57: + call lgammaf_pos +..___tag_value_lgammaf.58: +..B1.159: + fldt 32(%rsp) + fxch %st(1) + fstpt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B1.158: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + je ..B1.71 +..B1.69: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.60: + call fesetround@PLT +..___tag_value_lgammaf.61: +..B1.70: + fldt 80(%rsp) +..B1.71: + fldt (%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.72: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.74: + movss 112(%rsp), %xmm0 + call nearbyintf@PLT +..B1.160: + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm1 + movss 112(%rsp), %xmm4 + ucomiss %xmm1, %xmm4 + jp ..B1.75 + je ..B1.144 +..B1.75: + cmpl $1073741824, %r14d + jae ..B1.86 +..B1.76: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm4, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B1.141 + jp ..B1.141 +..B1.77: + fldt 16(%rsp) +..B1.78: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B1.79 + jb ..B1.78 +..B1.79: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B1.80: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B1.162: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_lgammaf.63: + call lgammaf_pos +..___tag_value_lgammaf.64: +..B1.161: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B1.83 +..B1.81: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.66: + call fesetround@PLT +..___tag_value_lgammaf.67: +..B1.82: + fldt 80(%rsp) +..B1.83: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.84: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.86: + cmpl $1082130432, %r14d + jae ..B1.103 +..B1.87: + movss .L_2il0floatpacket.2(%rip), %xmm0 + lea _LRIB(%rip), %rdx + movss .L_2il0floatpacket.3(%rip), %xmm2 + subss %xmm4, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm1 + addss %xmm2, %xmm1 + movss %xmm1, 104(%rsp) + pxor %xmm1, %xmm1 + cvtss2sd %xmm4, %xmm1 + movl 104(%rsp), %ecx + andl $1, %ecx + movss 104(%rsp), %xmm3 + subss %xmm2, %xmm3 + movss %xmm3, 104(%rsp) + lea (%rcx,%rcx,2), %eax + comisd (%rdx,%rax,8), %xmm1 + jbe ..B1.90 +..B1.88: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B1.90 +..B1.89: + movss %xmm4, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _LRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B1.98 +..B1.90: + lea _RRIB(%rip), %rdx + comisd (%rdx,%rax,8), %xmm1 + jbe ..B1.93 +..B1.91: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B1.93 +..B1.92: + movss %xmm4, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _RRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B1.98 +..B1.93: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm4, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt (%rsp) + fldt (%rsp) + fcomip %st(2), %st + jae ..B1.142 + jp ..B1.142 +..B1.94: + fldt (%rsp) +..B1.95: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B1.96 + jb ..B1.95 +..B1.96: + fstp %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 80(%rsp) +..B1.97: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B1.164: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstl 16(%rsp) + fstpt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 16(%rsp) + fstpt (%rsp) +..___tag_value_lgammaf.69: + call lgammaf_pos +..___tag_value_lgammaf.70: +..B1.163: + addq $16, %rsp + .cfi_def_cfa_offset 176 + fsubl 16(%rsp) + fstpt (%rsp) +..B1.98: + testb %r12b, %r12b + je ..B1.100 +..B1.99: + movl %ebx, %edi +..___tag_value_lgammaf.72: + call fesetround@PLT +..___tag_value_lgammaf.73: +..B1.100: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B1.124 +..B1.101: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.103: + cmpl $1091567616, %r14d + jae ..B1.114 +..B1.104: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm4, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B1.143 + jp ..B1.143 +..B1.105: + fldt 16(%rsp) +..B1.106: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B1.107 + jb ..B1.106 +..B1.107: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B1.108: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B1.166: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_lgammaf.75: + call lgammaf_pos +..___tag_value_lgammaf.76: +..B1.165: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B1.111 +..B1.109: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf.78: + call fesetround@PLT +..___tag_value_lgammaf.79: +..B1.110: + fldt 80(%rsp) +..B1.111: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.112: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.114: + cmpl $1174405120, %r14d + jb ..B1.120 +..B1.115: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm4, 56(%rsp) + flds 56(%rsp) + fsts (%rsp) + fsub %st, %st(1) + fxch %st(1) + fstpt 8(%rsp) + fchs + fstl 96(%rsp) + movsd 96(%rsp), %xmm0 + fstpt 40(%rsp) + fldt (%rax) + fstpt 24(%rsp) + call log@PLT +..B1.168: + fldt 8(%rsp) + lea _S16(%rip), %rax + fldt 24(%rsp) + lea _S14(%rip), %rdx + fldt 40(%rsp) + lea _S12(%rip), %rcx + movss .L_2il0floatpacket.3(%rip), %xmm2 + lea _S10(%rip), %rsi + fldl (%rax) + lea _S08(%rip), %r8 + movss %xmm2, 104(%rsp) + lea _S06(%rip), %r9 + movss 104(%rsp), %xmm1 + lea _S04(%rip), %r10 + movsd %xmm0, 56(%rsp) + lea _S02(%rip), %r11 + fxch %st(3) + fmull 56(%rsp) + subss 112(%rsp), %xmm1 + fsubp %st, %st(2) + movss %xmm1, 104(%rsp) + movss 104(%rsp), %xmm3 + fxch %st(1) + fsubs (%rsp) + subss %xmm2, %xmm3 + movss %xmm3, 104(%rsp) + movss 104(%rsp), %xmm4 + movss %xmm4, 56(%rsp) + fxch %st(1) + fsubs 56(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fmul %st, %st(2) + andb $127, 73(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + fxch %st(2) + faddl (%rdx) + fmul %st(2), %st + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + call log@PLT +..B1.167: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + je ..B1.117 +..B1.116: + movl %ebx, %edi + fstpl (%rsp) +..___tag_value_lgammaf.80: + call fesetround@PLT +..___tag_value_lgammaf.81: +..B1.172: + fldl (%rsp) +..B1.117: + fldt 8(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.118: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.120: + flds 112(%rsp) + movss .L_2il0floatpacket.3(%rip), %xmm1 + fchs + movaps %xmm1, %xmm0 + fstl 96(%rsp) + subss %xmm4, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm2 + movsd 96(%rsp), %xmm0 + subss %xmm1, %xmm2 + movss %xmm2, 104(%rsp) + movss 104(%rsp), %xmm3 + movss %xmm3, 56(%rsp) + fstpt 40(%rsp) + fldt 40(%rsp) + flds 56(%rsp) + fsubrp %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fstpt 24(%rsp) + call log@PLT +..B1.171: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fchs + fldt 56(%rsp) + fstpt (%rsp) + fstpt 24(%rsp) +..___tag_value_lgammaf.83: + call lgammaf_pos +..___tag_value_lgammaf.84: +..B1.170: + fldt 24(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fldt 24(%rsp) + lea _S14(%rip), %rax + fld %st(0) + lea _S16(%rip), %r8 + fmul %st(1), %st + lea _S10(%rip), %rdx + fxch %st(3) + fsubrp %st, %st(2) + fldl (%rax) + lea _S12(%rip), %r9 + fmul %st(3), %st + lea _S06(%rip), %rcx + fldl (%r8) + lea _S08(%rip), %r10 + fmul %st(4), %st + fxch %st(1) + faddl (%rdx) + fmul %st(4), %st + fxch %st(1) + faddl (%r9) + fmul %st(4), %st + fxch %st(1) + faddl (%rcx) + fmul %st(4), %st + fxch %st(1) + faddl (%r10) + fmul %st(4), %st + lea _S02(%rip), %rsi + fxch %st(1) + faddl (%rsi) + lea _S04(%rip), %r11 + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(3) + andb $127, 73(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B1.169: + fldt 8(%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + je ..B1.122 +..B1.121: + movl %ebx, %edi + fstpl (%rsp) + fstpt 8(%rsp) +..___tag_value_lgammaf.86: + call fesetround@PLT +..___tag_value_lgammaf.87: +..B1.173: + fldt 8(%rsp) + fldl (%rsp) +..B1.122: + testb %bpl, %bpl + fsubrp %st, %st(1) + fstps 104(%rsp) + je ..B1.124 +..B1.123: + fldcw 110(%rsp) +..B1.124: + movss 104(%rsp), %xmm0 +..B1.125: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.126: + testb %bpl, %bpl + je ..B1.128 +..B1.127: + fldcw 110(%rsp) +..B1.128: + testb %r12b, %r12b + je ..B1.130 +..B1.129: + movl %ebx, %edi +..___tag_value_lgammaf.108: + call fesetround@PLT +..___tag_value_lgammaf.109: +..B1.130: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.131: + testb %bpl, %bpl + je ..B1.133 +..B1.132: + fldcw 110(%rsp) +..B1.133: + testb %r12b, %r12b + je ..B1.135 +..B1.134: + movl %ebx, %edi +..___tag_value_lgammaf.130: + call fesetround@PLT +..___tag_value_lgammaf.131: +..B1.135: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.136: + testb %r12b, %r12b + je ..B1.138 +..B1.137: + movl %ebx, %edi +..___tag_value_lgammaf.152: + call fesetround@PLT +..___tag_value_lgammaf.153: +..B1.138: + lea _PBIG(%rip), %rax + testb %bpl, %bpl + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 104(%rsp) + je ..B1.124 +..B1.139: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.141: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B1.80 +..B1.142: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B1.97 +..B1.143: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B1.108 +..B1.144: + testb %r12b, %r12b + je ..B1.146 +..B1.145: + movl %ebx, %edi +..___tag_value_lgammaf.154: + call fesetround@PLT +..___tag_value_lgammaf.155: +..B1.146: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B1.124 +..B1.147: + fldcw 110(%rsp) + jmp ..B1.124 +..B1.149: + testb %r12b, %r12b + je ..B1.151 +..B1.150: + movl %ebx, %edi +..___tag_value_lgammaf.156: + call fesetround@PLT +..___tag_value_lgammaf.157: +..B1.151: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B1.124 +..B1.152: + fldcw 110(%rsp) + jmp ..B1.124 + .align 16,0x90 + .cfi_endproc + .type lgammaf,@function + .size lgammaf,.-lgammaf + .data +# -- End lgammaf + .text +# -- Begin lgammaf_pos + .text + .align 16,0x90 +lgammaf_pos: +# parameter 1: 8 + %rsp +..B2.1: + .cfi_startproc +..___tag_value_lgammaf_pos.159: +..L160: + + fldt 8(%rsp) + fstl -8(%rsp) + fldt .L_2il0floatpacket.7(%rip) + movzwl -2(%rsp), %ecx + andl $32752, %ecx + shrl $4, %ecx + movl -4(%rsp), %eax + shll $20, %ecx + andl $1048575, %eax + orl %eax, %ecx + cmpl $1074790400, %ecx + jb ..B2.3 +..B2.2: + fstp %st(0) + addl $-1074790400, %ecx + lea _A(%rip), %rax + sarl $20, %ecx + lea _B(%rip), %rdx + movslq %ecx, %rcx + lea _C5(%rip), %r9 + lea _C5_0(%rip), %r8 + lea (,%rcx,8), %esi + movslq %esi, %rsi + lea (%rcx,%rcx,2), %edi + movslq %edi, %rdi + flds (%rax,%rcx,4) + fsubrp %st, %st(1) + fmuls (%rdx,%rcx,4) + fld %st(0) + fmul %st(1), %st + fldl (%r9,%rsi,8) + fmul %st(1), %st + fldl 8(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 32(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 40(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl (%r8,%rdi,8) + fmul %st(2), %st + fxch %st(1) + faddl 8(%r8,%rdi,8) + fmul %st(2), %st + fxch %st(1) + faddl 48(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 56(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 16(%r9,%rsi,8) + fmulp %st, %st(2) + faddl 24(%r9,%rsi,8) + fmulp %st, %st(2) + faddl 16(%r8,%rdi,8) + faddp %st, %st(1) + ret +..B2.3: + cmpl $1073741824, %ecx + jne ..B2.5 +..B2.4: + fstp %st(1) + ret +..B2.5: + jbe ..B2.7 +..B2.6: + fstp %st(0) + fldt .L_2il0floatpacket.5(%rip) + fld %st(1) + lea _C4(%rip), %rax + lea 32+_C4(%rip), %rdx + fmul %st(2), %st + lea 8+_C4(%rip), %r9 + fldl (%rax) + lea 40+_C4(%rip), %r10 + lea 64+_C4(%rip), %rcx + lea 72+_C4(%rip), %r11 + lea 48+_C4(%rip), %rsi + lea 56+_C4(%rip), %rax + lea 16+_C4(%rip), %rdi + lea 80+_C4(%rip), %r8 + fmul %st(1), %st + fldl (%r9) + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + fmul %st(2), %st + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + fmul %st(2), %st + fxch %st(1) + faddl (%rax) + fmul %st(2), %st + fxch %st(1) + faddl (%rdi) + lea 24+_C4(%rip), %rdx + fmulp %st, %st(2) + faddl (%rdx) + fmul %st(3), %st + fxch %st(1) + faddl (%r8) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fmulp %st, %st(1) + ret +..B2.7: + cmpl $1073479680, %ecx + jb ..B2.9 +..B2.8: + fstp %st(0) + fld %st(0) + lea 8+_C3(%rip), %rax + lea 16+_C3(%rip), %r8 + lea 40+_C3(%rip), %rdx + lea 48+_C3(%rip), %r9 + lea 24+_C3(%rip), %rcx + lea 32+_C3(%rip), %r10 + lea 56+_C3(%rip), %rsi + lea 64+_C3(%rip), %r11 + lea _C3(%rip), %rdi + fmul %st(1), %st + fldl (%rax) + fmul %st(1), %st + fldl (%r8) + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r9) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(2) + faddl (%rdi) + faddp %st, %st(1) + ret +..B2.9: + cmpl $1073217536, %ecx + jb ..B2.11 +..B2.10: + fstp %st(0) + fld %st(0) + lea 8+_LGAMMAF_C2(%rip), %rax + lea 16+_LGAMMAF_C2(%rip), %r8 + lea 40+_LGAMMAF_C2(%rip), %rdx + lea 48+_LGAMMAF_C2(%rip), %r9 + lea 24+_LGAMMAF_C2(%rip), %rcx + lea 32+_LGAMMAF_C2(%rip), %r10 + lea 56+_LGAMMAF_C2(%rip), %rsi + lea 64+_LGAMMAF_C2(%rip), %r11 + lea _LGAMMAF_C2(%rip), %rdi + fmul %st(1), %st + fldl (%rax) + fmul %st(1), %st + fldl (%r8) + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r9) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(2) + faddl (%rdi) + faddp %st, %st(1) + ret +..B2.11: + cmpl $1072955392, %ecx + jb ..B2.13 +..B2.12: + fstp %st(0) + lea _LM(%rip), %rax + lea 8+_C1(%rip), %rdx + lea 16+_C1(%rip), %r9 + lea 40+_C1(%rip), %rcx + lea 48+_C1(%rip), %r10 + lea 24+_C1(%rip), %rsi + lea 32+_C1(%rip), %r11 + lea 56+_C1(%rip), %rdi + fldl (%rax) + lea 64+_C1(%rip), %rax + lea _C1(%rip), %r8 + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldl (%rdx) + fmul %st(1), %st + fldl (%r9) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + fmul %st(2), %st + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + fxch %st(1) + faddl (%rdi) + fmulp %st, %st(2) + faddl (%rax) + fmulp %st, %st(2) + faddl (%r8) + faddp %st, %st(1) + ret +..B2.13: + cmpl $1072693248, %ecx + jb ..B2.4 +..B2.14: + fstp %st(0) + fld %st(0) + lea 8+_C0(%rip), %rax + lea 16+_C0(%rip), %r8 + lea 40+_C0(%rip), %rdx + lea 48+_C0(%rip), %r9 + lea 24+_C0(%rip), %rcx + lea 32+_C0(%rip), %r10 + lea 56+_C0(%rip), %rsi + lea 64+_C0(%rip), %r11 + lea _C0(%rip), %rdi + fmul %st(1), %st + fldl (%rax) + fmul %st(1), %st + fldl (%r8) + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r9) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(2) + faddl (%rdi) + faddp %st, %st(1) +..B2.15: + ret + .align 16,0x90 + .cfi_endproc + .type lgammaf_pos,@function + .size lgammaf_pos,.-lgammaf_pos + .data +# -- End lgammaf_pos + .text +# -- Begin gammaf + .text + .align 16,0x90 + .globl gammaf +gammaf: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value_gammaf.162: +..L163: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $120, %rsp + .cfi_def_cfa_offset 176 + xorb %r12b, %r12b + movss %xmm0, 112(%rsp) + xorb %bpl, %bpl + movzwl 114(%rsp), %r15d + andl $32640, %r15d + movd %xmm0, %eax + shrl $7, %r15d + andl $8388607, %eax + movl %r15d, %r14d + shll $23, %r14d + movb 115(%rsp), %r13b + orl %eax, %r14d + andb $-128, %r13b +..B3.2: + fnstcw 110(%rsp) +..B3.3: +..___tag_value_gammaf.177: + call fegetround@PLT +..___tag_value_gammaf.178: +..B3.156: + movl %eax, %ebx +..B3.4: + testl %ebx, %ebx + je ..B3.6 +..B3.5: + xorl %edi, %edi + movb $1, %r12b +..___tag_value_gammaf.179: + call fesetround@PLT +..___tag_value_gammaf.180: +..B3.6: + movzwl 110(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B3.10 +..B3.7: + orl $-64768, %edx + movw %dx, 108(%rsp) +..B3.8: + fldcw 108(%rsp) +..B3.9: + movb $1, %bpl +..B3.10: + cmpl $255, %r15d + jne ..B3.16 +..B3.11: + testb %bpl, %bpl + je ..B3.13 +..B3.12: + fldcw 110(%rsp) +..B3.13: + testb %r12b, %r12b + je ..B3.15 +..B3.14: + movl %ebx, %edi +..___tag_value_gammaf.181: + call fesetround@PLT +..___tag_value_gammaf.182: +..B3.15: + movss 112(%rsp), %xmm0 + mulss %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.16: + testl %r14d, %r14d + je ..B3.149 +..B3.17: + testb %r13b, %r13b + jne ..B3.74 +..B3.18: + cmpl $2084876174, %r14d + jae ..B3.136 +..B3.19: + movss 112(%rsp), %xmm0 + ucomiss .L_2il0floatpacket.6(%rip), %xmm0 + jp ..B3.20 + je ..B3.131 +..B3.20: + cmpl $1174405120, %r14d + jb ..B3.26 +..B3.21: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm0, 56(%rsp) + pxor %xmm0, %xmm0 + flds 56(%rsp) + cvtss2sd 56(%rsp), %xmm0 + fsub %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fstps 32(%rsp) + fldt (%rax) + fstpt 16(%rsp) + call log@PLT +..B3.157: + fldt (%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fmull 56(%rsp) + fstpt (%rsp) + je ..B3.23 +..B3.22: + movl %ebx, %edi +..___tag_value_gammaf.203: + call fesetround@PLT +..___tag_value_gammaf.204: +..B3.23: + fldt (%rsp) + testb %bpl, %bpl + fldt 16(%rsp) + faddp %st, %st(1) + fsubs 32(%rsp) + fstps 104(%rsp) + je ..B3.124 +..B3.24: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.26: + cmpl $1082130432, %r14d + jb ..B3.33 +..B3.27: + addl $-1082130432, %r14d + lea _A(%rip), %rax + sarl $23, %r14d + lea _B(%rip), %rdx + movslq %r14d, %r14 + lea _C5(%rip), %r8 + movss %xmm0, 56(%rsp) + lea (,%r14,8), %ecx + flds 56(%rsp) + lea (%r14,%r14,2), %esi + movslq %ecx, %rcx + lea _C5_0(%rip), %r9 + movslq %esi, %rsi + testb %r12b, %r12b + fsubs (%rax,%r14,4) + fmuls (%rdx,%r14,4) + fld %st(0) + fmul %st(1), %st + fldl 8(%r8,%rcx,8) + fmul %st(1), %st + fldl (%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 40(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 32(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 8(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl (%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 56(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 48(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 24(%r8,%rcx,8) + fmulp %st, %st(3) + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(2) + faddl 16(%r8,%rcx,8) + fmulp %st, %st(1) + faddl 16(%r9,%rsi,8) + fstpt (%rsp) + je ..B3.30 +..B3.28: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.205: + call fesetround@PLT +..___tag_value_gammaf.206: +..B3.29: + fldt 80(%rsp) +..B3.30: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.31: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.33: + ucomiss .L_2il0floatpacket.4(%rip), %xmm0 + jp ..B3.34 + je ..B3.126 +..B3.34: + movss %xmm0, 56(%rsp) + cmpl $1073741824, %r14d + flds 56(%rsp) + jbe ..B3.40 +..B3.35: + fldt .L_2il0floatpacket.5(%rip) + fld %st(1) + lea _C4(%rip), %r9 + lea 8+_C4(%rip), %rax + fmul %st(2), %st + lea 32+_C4(%rip), %r10 + fldl (%rax) + lea 40+_C4(%rip), %rdx + fmul %st(1), %st + lea 64+_C4(%rip), %r11 + fldl (%r9) + lea 72+_C4(%rip), %rcx + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + lea 48+_C4(%rip), %r13 + lea 56+_C4(%rip), %rsi + fmul %st(2), %st + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + lea 16+_C4(%rip), %r14 + lea 24+_C4(%rip), %r8 + fmul %st(2), %st + fxch %st(1) + faddl (%r13) + fmul %st(2), %st + fxch %st(1) + faddl (%r8) + lea 80+_C4(%rip), %r15 + testb %r12b, %r12b + fmul %st(4), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(3) + fsubrp %st, %st(4) + faddl (%r14) + fmulp %st, %st(1) + faddl (%r15) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B3.37 +..B3.36: + movl %ebx, %edi +..___tag_value_gammaf.207: + call fesetround@PLT +..___tag_value_gammaf.208: +..B3.37: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B3.124 +..B3.38: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.40: + cmpl $1071644672, %r14d + jb ..B3.47 +..B3.41: + fld %st(0) + lea 16+_C3(%rip), %rax + fmul %st(1), %st + lea 48+_C3(%rip), %rdx + fldl (%rax) + lea 32+_C3(%rip), %rcx + fmul %st(1), %st + lea 64+_C3(%rip), %rsi + lea 8+_C3(%rip), %r8 + lea 40+_C3(%rip), %r9 + lea 24+_C3(%rip), %r10 + lea 56+_C3(%rip), %r11 + lea _C3(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B3.44 +..B3.42: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.209: + call fesetround@PLT +..___tag_value_gammaf.210: +..B3.43: + fldt 80(%rsp) +..B3.44: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.45: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.47: + cmpl $1069547520, %r14d + jb ..B3.54 +..B3.48: + fld %st(0) + lea 16+_LGAMMAF_C2(%rip), %rax + fmul %st(1), %st + lea 48+_LGAMMAF_C2(%rip), %rdx + fldl (%rax) + lea 32+_LGAMMAF_C2(%rip), %rcx + fmul %st(1), %st + lea 64+_LGAMMAF_C2(%rip), %rsi + lea 8+_LGAMMAF_C2(%rip), %r8 + lea 40+_LGAMMAF_C2(%rip), %r9 + lea 24+_LGAMMAF_C2(%rip), %r10 + lea 56+_LGAMMAF_C2(%rip), %r11 + lea _LGAMMAF_C2(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B3.51 +..B3.49: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.211: + call fesetround@PLT +..___tag_value_gammaf.212: +..B3.50: + fldt 80(%rsp) +..B3.51: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.52: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.54: + cmpl $1067450368, %r14d + jb ..B3.61 +..B3.55: + lea _LM(%rip), %rax + lea 16+_C1(%rip), %rdx + lea 48+_C1(%rip), %rcx + lea 32+_C1(%rip), %rsi + lea 64+_C1(%rip), %r8 + lea 8+_C1(%rip), %r9 + lea 40+_C1(%rip), %r10 + lea 24+_C1(%rip), %r11 + fldl (%rdx) + lea 56+_C1(%rip), %r13 + lea _C1(%rip), %r14 + testb %r12b, %r12b + fxch %st(1) + fsubl (%rax) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(2) + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmulp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmul %st(2), %st + faddl (%r13) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r14) + fstpt (%rsp) + je ..B3.58 +..B3.56: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.213: + call fesetround@PLT +..___tag_value_gammaf.214: +..B3.57: + fldt 80(%rsp) +..B3.58: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.59: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.61: + cmpl $1065353216, %r14d + jb ..B3.68 +..B3.62: + fld %st(0) + lea 16+_C0(%rip), %rax + fmul %st(1), %st + lea 48+_C0(%rip), %rdx + fldl (%rax) + lea 32+_C0(%rip), %rcx + fmul %st(1), %st + lea 64+_C0(%rip), %rsi + lea 8+_C0(%rip), %r8 + lea 40+_C0(%rip), %r9 + lea 24+_C0(%rip), %r10 + lea 56+_C0(%rip), %r11 + lea _C0(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B3.65 +..B3.63: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.215: + call fesetround@PLT +..___tag_value_gammaf.216: +..B3.64: + fldt 80(%rsp) +..B3.65: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.66: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.68: + fldt .L_2il0floatpacket.0(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fadd %st(1), %st + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value_gammaf.218: + call lgammaf_pos +..___tag_value_gammaf.219: +..B3.159: + fldt 32(%rsp) + fxch %st(1) + fstpt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B3.158: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + je ..B3.71 +..B3.69: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.221: + call fesetround@PLT +..___tag_value_gammaf.222: +..B3.70: + fldt 80(%rsp) +..B3.71: + fldt (%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.72: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.74: + movss 112(%rsp), %xmm0 + call nearbyintf@PLT +..B3.160: + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm1 + movss 112(%rsp), %xmm4 + ucomiss %xmm1, %xmm4 + jp ..B3.75 + je ..B3.144 +..B3.75: + cmpl $1073741824, %r14d + jae ..B3.86 +..B3.76: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm4, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B3.141 + jp ..B3.141 +..B3.77: + fldt 16(%rsp) +..B3.78: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B3.79 + jb ..B3.78 +..B3.79: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B3.80: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B3.162: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_gammaf.224: + call lgammaf_pos +..___tag_value_gammaf.225: +..B3.161: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B3.83 +..B3.81: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.227: + call fesetround@PLT +..___tag_value_gammaf.228: +..B3.82: + fldt 80(%rsp) +..B3.83: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.84: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.86: + cmpl $1082130432, %r14d + jae ..B3.103 +..B3.87: + movss .L_2il0floatpacket.2(%rip), %xmm0 + lea _LRIB(%rip), %rdx + movss .L_2il0floatpacket.3(%rip), %xmm2 + subss %xmm4, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm1 + addss %xmm2, %xmm1 + movss %xmm1, 104(%rsp) + pxor %xmm1, %xmm1 + cvtss2sd %xmm4, %xmm1 + movl 104(%rsp), %ecx + andl $1, %ecx + movss 104(%rsp), %xmm3 + subss %xmm2, %xmm3 + movss %xmm3, 104(%rsp) + lea (%rcx,%rcx,2), %eax + comisd (%rdx,%rax,8), %xmm1 + jbe ..B3.90 +..B3.88: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B3.90 +..B3.89: + movss %xmm4, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _LRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B3.98 +..B3.90: + lea _RRIB(%rip), %rdx + comisd (%rdx,%rax,8), %xmm1 + jbe ..B3.93 +..B3.91: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B3.93 +..B3.92: + movss %xmm4, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _RRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B3.98 +..B3.93: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm4, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt (%rsp) + fldt (%rsp) + fcomip %st(2), %st + jae ..B3.142 + jp ..B3.142 +..B3.94: + fldt (%rsp) +..B3.95: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B3.96 + jb ..B3.95 +..B3.96: + fstp %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 80(%rsp) +..B3.97: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B3.164: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstl 16(%rsp) + fstpt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 16(%rsp) + fstpt (%rsp) +..___tag_value_gammaf.230: + call lgammaf_pos +..___tag_value_gammaf.231: +..B3.163: + addq $16, %rsp + .cfi_def_cfa_offset 176 + fsubl 16(%rsp) + fstpt (%rsp) +..B3.98: + testb %r12b, %r12b + je ..B3.100 +..B3.99: + movl %ebx, %edi +..___tag_value_gammaf.233: + call fesetround@PLT +..___tag_value_gammaf.234: +..B3.100: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B3.124 +..B3.101: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.103: + cmpl $1091567616, %r14d + jae ..B3.114 +..B3.104: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm4, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B3.143 + jp ..B3.143 +..B3.105: + fldt 16(%rsp) +..B3.106: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B3.107 + jb ..B3.106 +..B3.107: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B3.108: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B3.166: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_gammaf.236: + call lgammaf_pos +..___tag_value_gammaf.237: +..B3.165: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B3.111 +..B3.109: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf.239: + call fesetround@PLT +..___tag_value_gammaf.240: +..B3.110: + fldt 80(%rsp) +..B3.111: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.112: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.114: + cmpl $1174405120, %r14d + jb ..B3.120 +..B3.115: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm4, 56(%rsp) + flds 56(%rsp) + fsts (%rsp) + fsub %st, %st(1) + fxch %st(1) + fstpt 8(%rsp) + fchs + fstl 96(%rsp) + movsd 96(%rsp), %xmm0 + fstpt 40(%rsp) + fldt (%rax) + fstpt 24(%rsp) + call log@PLT +..B3.168: + fldt 8(%rsp) + lea _S16(%rip), %rax + fldt 24(%rsp) + lea _S14(%rip), %rdx + fldt 40(%rsp) + lea _S12(%rip), %rcx + movss .L_2il0floatpacket.3(%rip), %xmm2 + lea _S10(%rip), %rsi + fldl (%rax) + lea _S08(%rip), %r8 + movss %xmm2, 104(%rsp) + lea _S06(%rip), %r9 + movss 104(%rsp), %xmm1 + lea _S04(%rip), %r10 + movsd %xmm0, 56(%rsp) + lea _S02(%rip), %r11 + fxch %st(3) + fmull 56(%rsp) + subss 112(%rsp), %xmm1 + fsubp %st, %st(2) + movss %xmm1, 104(%rsp) + movss 104(%rsp), %xmm3 + fxch %st(1) + fsubs (%rsp) + subss %xmm2, %xmm3 + movss %xmm3, 104(%rsp) + movss 104(%rsp), %xmm4 + movss %xmm4, 56(%rsp) + fxch %st(1) + fsubs 56(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fmul %st, %st(2) + andb $127, 73(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + fxch %st(2) + faddl (%rdx) + fmul %st(2), %st + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + call log@PLT +..B3.167: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + je ..B3.117 +..B3.116: + movl %ebx, %edi + fstpl (%rsp) +..___tag_value_gammaf.241: + call fesetround@PLT +..___tag_value_gammaf.242: +..B3.172: + fldl (%rsp) +..B3.117: + fldt 8(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.118: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.120: + flds 112(%rsp) + movss .L_2il0floatpacket.3(%rip), %xmm1 + fchs + movaps %xmm1, %xmm0 + fstl 96(%rsp) + subss %xmm4, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm2 + movsd 96(%rsp), %xmm0 + subss %xmm1, %xmm2 + movss %xmm2, 104(%rsp) + movss 104(%rsp), %xmm3 + movss %xmm3, 56(%rsp) + fstpt 40(%rsp) + fldt 40(%rsp) + flds 56(%rsp) + fsubrp %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fstpt 24(%rsp) + call log@PLT +..B3.171: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fchs + fldt 56(%rsp) + fstpt (%rsp) + fstpt 24(%rsp) +..___tag_value_gammaf.244: + call lgammaf_pos +..___tag_value_gammaf.245: +..B3.170: + fldt 24(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fldt 24(%rsp) + lea _S14(%rip), %rax + fld %st(0) + lea _S16(%rip), %r8 + fmul %st(1), %st + lea _S10(%rip), %rdx + fxch %st(3) + fsubrp %st, %st(2) + fldl (%rax) + lea _S12(%rip), %r9 + fmul %st(3), %st + lea _S06(%rip), %rcx + fldl (%r8) + lea _S08(%rip), %r10 + fmul %st(4), %st + fxch %st(1) + faddl (%rdx) + fmul %st(4), %st + fxch %st(1) + faddl (%r9) + fmul %st(4), %st + fxch %st(1) + faddl (%rcx) + fmul %st(4), %st + fxch %st(1) + faddl (%r10) + fmul %st(4), %st + lea _S02(%rip), %rsi + fxch %st(1) + faddl (%rsi) + lea _S04(%rip), %r11 + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(3) + andb $127, 73(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B3.169: + fldt 8(%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + je ..B3.122 +..B3.121: + movl %ebx, %edi + fstpl (%rsp) + fstpt 8(%rsp) +..___tag_value_gammaf.247: + call fesetround@PLT +..___tag_value_gammaf.248: +..B3.173: + fldt 8(%rsp) + fldl (%rsp) +..B3.122: + testb %bpl, %bpl + fsubrp %st, %st(1) + fstps 104(%rsp) + je ..B3.124 +..B3.123: + fldcw 110(%rsp) +..B3.124: + movss 104(%rsp), %xmm0 +..B3.125: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.126: + testb %bpl, %bpl + je ..B3.128 +..B3.127: + fldcw 110(%rsp) +..B3.128: + testb %r12b, %r12b + je ..B3.130 +..B3.129: + movl %ebx, %edi +..___tag_value_gammaf.269: + call fesetround@PLT +..___tag_value_gammaf.270: +..B3.130: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.131: + testb %bpl, %bpl + je ..B3.133 +..B3.132: + fldcw 110(%rsp) +..B3.133: + testb %r12b, %r12b + je ..B3.135 +..B3.134: + movl %ebx, %edi +..___tag_value_gammaf.291: + call fesetround@PLT +..___tag_value_gammaf.292: +..B3.135: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B3.136: + testb %r12b, %r12b + je ..B3.138 +..B3.137: + movl %ebx, %edi +..___tag_value_gammaf.313: + call fesetround@PLT +..___tag_value_gammaf.314: +..B3.138: + lea _PBIG(%rip), %rax + testb %bpl, %bpl + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 104(%rsp) + je ..B3.124 +..B3.139: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.141: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B3.80 +..B3.142: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B3.97 +..B3.143: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B3.108 +..B3.144: + testb %r12b, %r12b + je ..B3.146 +..B3.145: + movl %ebx, %edi +..___tag_value_gammaf.315: + call fesetround@PLT +..___tag_value_gammaf.316: +..B3.146: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B3.124 +..B3.147: + fldcw 110(%rsp) + jmp ..B3.124 +..B3.149: + testb %r12b, %r12b + je ..B3.151 +..B3.150: + movl %ebx, %edi +..___tag_value_gammaf.317: + call fesetround@PLT +..___tag_value_gammaf.318: +..B3.151: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B3.124 +..B3.152: + fldcw 110(%rsp) + jmp ..B3.124 + .align 16,0x90 + .cfi_endproc + .type gammaf,@function + .size gammaf,.-gammaf + .data +# -- End gammaf + .text +# -- Begin lgammaf_r + .text + .align 16,0x90 + .globl lgammaf_r +lgammaf_r: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B4.1: + .cfi_startproc +..___tag_value_lgammaf_r.320: +..L321: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $120, %rsp + .cfi_def_cfa_offset 176 + xorb %r12b, %r12b + movss %xmm0, 112(%rsp) + movq %rdi, %r15 + movb 115(%rsp), %dl + xorb %bpl, %bpl + andb $-128, %dl + shrb $7, %dl + movd %xmm0, %eax + movzwl 114(%rsp), %r14d + andl $8388607, %eax + andl $32640, %r14d + shrl $7, %r14d + movl %r14d, %r13d + shll $23, %r13d + movb %dl, (%rsp) + orl %eax, %r13d +..B4.2: + fnstcw 110(%rsp) +..B4.3: +..___tag_value_lgammaf_r.335: + call fegetround@PLT +..___tag_value_lgammaf_r.336: +..B4.162: + movl %eax, %ebx +..B4.4: + testl %ebx, %ebx + je ..B4.6 +..B4.5: + xorl %edi, %edi + movb $1, %r12b +..___tag_value_lgammaf_r.337: + call fesetround@PLT +..___tag_value_lgammaf_r.338: +..B4.6: + movzwl 110(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B4.10 +..B4.7: + orl $-64768, %edx + movw %dx, 108(%rsp) +..B4.8: + fldcw 108(%rsp) +..B4.9: + movb $1, %bpl +..B4.10: + cmpl $255, %r14d + jne ..B4.16 +..B4.11: + movl $1, (%r15) + testb %bpl, %bpl + je ..B4.13 +..B4.12: + fldcw 110(%rsp) +..B4.13: + testb %r12b, %r12b + je ..B4.15 +..B4.14: + movl %ebx, %edi +..___tag_value_lgammaf_r.339: + call fesetround@PLT +..___tag_value_lgammaf_r.340: +..B4.15: + movss 112(%rsp), %xmm0 + mulss %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B4.16: + testl %r13d, %r13d + je ..B4.152 +..B4.17: + movb (%rsp), %al + testb %al, %al + movl $1, (%r15) + jne ..B4.74 +..B4.18: + cmpl $2084876174, %r13d + jae ..B4.139 +..B4.19: + movss 112(%rsp), %xmm0 + ucomiss .L_2il0floatpacket.6(%rip), %xmm0 + jp ..B4.20 + je ..B4.134 +..B4.20: + cmpl $1174405120, %r13d + jb ..B4.26 +..B4.21: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm0, 56(%rsp) + pxor %xmm0, %xmm0 + flds 56(%rsp) + cvtss2sd 56(%rsp), %xmm0 + fsub %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fstps 32(%rsp) + fldt (%rax) + fstpt 16(%rsp) + call log@PLT +..B4.163: + fldt (%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fmull 56(%rsp) + fstpt (%rsp) + je ..B4.23 +..B4.22: + movl %ebx, %edi +..___tag_value_lgammaf_r.361: + call fesetround@PLT +..___tag_value_lgammaf_r.362: +..B4.23: + fldt (%rsp) + testb %bpl, %bpl + fldt 16(%rsp) + faddp %st, %st(1) + fsubs 32(%rsp) + fstps 104(%rsp) + je ..B4.127 +..B4.24: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.26: + cmpl $1082130432, %r13d + jb ..B4.33 +..B4.27: + addl $-1082130432, %r13d + lea _A(%rip), %rax + sarl $23, %r13d + lea _B(%rip), %rdx + movslq %r13d, %r13 + lea _C5(%rip), %r8 + movss %xmm0, 56(%rsp) + lea (,%r13,8), %ecx + flds 56(%rsp) + lea (%r13,%r13,2), %esi + movslq %ecx, %rcx + lea _C5_0(%rip), %r9 + movslq %esi, %rsi + testb %r12b, %r12b + fsubs (%rax,%r13,4) + fmuls (%rdx,%r13,4) + fld %st(0) + fmul %st(1), %st + fldl 8(%r8,%rcx,8) + fmul %st(1), %st + fldl (%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 40(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 32(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 8(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl (%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 56(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 48(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 24(%r8,%rcx,8) + fmulp %st, %st(3) + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(2) + faddl 16(%r8,%rcx,8) + fmulp %st, %st(1) + faddl 16(%r9,%rsi,8) + fstpt (%rsp) + je ..B4.30 +..B4.28: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.363: + call fesetround@PLT +..___tag_value_lgammaf_r.364: +..B4.29: + fldt 80(%rsp) +..B4.30: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.31: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.33: + ucomiss .L_2il0floatpacket.4(%rip), %xmm0 + jp ..B4.34 + je ..B4.129 +..B4.34: + movss %xmm0, 56(%rsp) + cmpl $1073741824, %r13d + flds 56(%rsp) + jbe ..B4.40 +..B4.35: + fldt .L_2il0floatpacket.5(%rip) + fld %st(1) + lea _C4(%rip), %r9 + lea 8+_C4(%rip), %rax + fmul %st(2), %st + lea 32+_C4(%rip), %r10 + fldl (%rax) + lea 40+_C4(%rip), %rdx + fmul %st(1), %st + lea 64+_C4(%rip), %r11 + fldl (%r9) + lea 72+_C4(%rip), %rcx + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + lea 48+_C4(%rip), %r13 + lea 56+_C4(%rip), %rsi + fmul %st(2), %st + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + lea 16+_C4(%rip), %r14 + lea 24+_C4(%rip), %r8 + fmul %st(2), %st + fxch %st(1) + faddl (%r13) + fmul %st(2), %st + fxch %st(1) + faddl (%r8) + lea 80+_C4(%rip), %r15 + testb %r12b, %r12b + fmul %st(4), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(3) + fsubrp %st, %st(4) + faddl (%r14) + fmulp %st, %st(1) + faddl (%r15) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B4.37 +..B4.36: + movl %ebx, %edi +..___tag_value_lgammaf_r.365: + call fesetround@PLT +..___tag_value_lgammaf_r.366: +..B4.37: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B4.127 +..B4.38: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.40: + cmpl $1071644672, %r13d + jb ..B4.47 +..B4.41: + fld %st(0) + lea 16+_C3(%rip), %rax + fmul %st(1), %st + lea 48+_C3(%rip), %rdx + fldl (%rax) + lea 32+_C3(%rip), %rcx + fmul %st(1), %st + lea 64+_C3(%rip), %rsi + lea 8+_C3(%rip), %r8 + lea 40+_C3(%rip), %r9 + lea 24+_C3(%rip), %r10 + lea 56+_C3(%rip), %r11 + lea _C3(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B4.44 +..B4.42: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.367: + call fesetround@PLT +..___tag_value_lgammaf_r.368: +..B4.43: + fldt 80(%rsp) +..B4.44: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.45: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.47: + cmpl $1069547520, %r13d + jb ..B4.54 +..B4.48: + fld %st(0) + lea 16+_LGAMMAF_C2(%rip), %rax + fmul %st(1), %st + lea 48+_LGAMMAF_C2(%rip), %rdx + fldl (%rax) + lea 32+_LGAMMAF_C2(%rip), %rcx + fmul %st(1), %st + lea 64+_LGAMMAF_C2(%rip), %rsi + lea 8+_LGAMMAF_C2(%rip), %r8 + lea 40+_LGAMMAF_C2(%rip), %r9 + lea 24+_LGAMMAF_C2(%rip), %r10 + lea 56+_LGAMMAF_C2(%rip), %r11 + lea _LGAMMAF_C2(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B4.51 +..B4.49: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.369: + call fesetround@PLT +..___tag_value_lgammaf_r.370: +..B4.50: + fldt 80(%rsp) +..B4.51: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.52: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.54: + cmpl $1067450368, %r13d + jb ..B4.61 +..B4.55: + lea _LM(%rip), %rax + lea 16+_C1(%rip), %rdx + lea 48+_C1(%rip), %rcx + lea 32+_C1(%rip), %rsi + lea 64+_C1(%rip), %r8 + lea 8+_C1(%rip), %r9 + lea 40+_C1(%rip), %r10 + lea 24+_C1(%rip), %r11 + fldl (%rdx) + lea 56+_C1(%rip), %r13 + lea _C1(%rip), %r14 + testb %r12b, %r12b + fxch %st(1) + fsubl (%rax) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(2) + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmulp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmul %st(2), %st + faddl (%r13) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r14) + fstpt (%rsp) + je ..B4.58 +..B4.56: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.371: + call fesetround@PLT +..___tag_value_lgammaf_r.372: +..B4.57: + fldt 80(%rsp) +..B4.58: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.59: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.61: + cmpl $1065353216, %r13d + jb ..B4.68 +..B4.62: + fld %st(0) + lea 16+_C0(%rip), %rax + fmul %st(1), %st + lea 48+_C0(%rip), %rdx + fldl (%rax) + lea 32+_C0(%rip), %rcx + fmul %st(1), %st + lea 64+_C0(%rip), %rsi + lea 8+_C0(%rip), %r8 + lea 40+_C0(%rip), %r9 + lea 24+_C0(%rip), %r10 + lea 56+_C0(%rip), %r11 + lea _C0(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B4.65 +..B4.63: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.373: + call fesetround@PLT +..___tag_value_lgammaf_r.374: +..B4.64: + fldt 80(%rsp) +..B4.65: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.66: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.68: + fldt .L_2il0floatpacket.0(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fadd %st(1), %st + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value_lgammaf_r.376: + call lgammaf_pos +..___tag_value_lgammaf_r.377: +..B4.165: + fldt 32(%rsp) + fxch %st(1) + fstpt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B4.164: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + je ..B4.71 +..B4.69: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.379: + call fesetround@PLT +..___tag_value_lgammaf_r.380: +..B4.70: + fldt 80(%rsp) +..B4.71: + fldt (%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.72: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.74: + movss 112(%rsp), %xmm0 + call nearbyintf@PLT +..B4.166: + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm1 + movss 112(%rsp), %xmm2 + ucomiss %xmm1, %xmm2 + jp ..B4.75 + je ..B4.147 +..B4.75: + comiss .L_2il0floatpacket.8(%rip), %xmm2 + jbe ..B4.78 +..B4.76: + movaps %xmm2, %xmm0 + movss %xmm2, (%rsp) + call ceilf@PLT +..B4.167: + cvttss2si %xmm0, %eax + movss (%rsp), %xmm2 + testb $1, %al + jne ..B4.78 +..B4.77: + movl $-1, (%r15) +..B4.78: + cmpl $1073741824, %r13d + jae ..B4.89 +..B4.79: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm2, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B4.144 + jp ..B4.144 +..B4.80: + fldt 16(%rsp) +..B4.81: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B4.82 + jb ..B4.81 +..B4.82: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B4.83: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B4.169: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_lgammaf_r.382: + call lgammaf_pos +..___tag_value_lgammaf_r.383: +..B4.168: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B4.86 +..B4.84: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.385: + call fesetround@PLT +..___tag_value_lgammaf_r.386: +..B4.85: + fldt 80(%rsp) +..B4.86: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.87: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.89: + cmpl $1082130432, %r13d + jae ..B4.106 +..B4.90: + movss .L_2il0floatpacket.2(%rip), %xmm1 + lea _LRIB(%rip), %rdx + subss %xmm2, %xmm1 + movss .L_2il0floatpacket.3(%rip), %xmm2 + movss %xmm1, 104(%rsp) + pxor %xmm1, %xmm1 + movss 104(%rsp), %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm3 + movl 104(%rsp), %ecx + subss %xmm2, %xmm3 + movss 112(%rsp), %xmm2 + andl $1, %ecx + cvtss2sd %xmm2, %xmm1 + movss %xmm3, 104(%rsp) + lea (%rcx,%rcx,2), %eax + comisd (%rdx,%rax,8), %xmm1 + jbe ..B4.93 +..B4.91: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B4.93 +..B4.92: + movss %xmm2, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _LRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B4.101 +..B4.93: + lea _RRIB(%rip), %rdx + comisd (%rdx,%rax,8), %xmm1 + jbe ..B4.96 +..B4.94: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B4.96 +..B4.95: + movss %xmm2, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _RRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B4.101 +..B4.96: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm2, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt (%rsp) + fldt (%rsp) + fcomip %st(2), %st + jae ..B4.145 + jp ..B4.145 +..B4.97: + fldt (%rsp) +..B4.98: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B4.99 + jb ..B4.98 +..B4.99: + fstp %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 80(%rsp) +..B4.100: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B4.171: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstl 16(%rsp) + fstpt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 16(%rsp) + fstpt (%rsp) +..___tag_value_lgammaf_r.388: + call lgammaf_pos +..___tag_value_lgammaf_r.389: +..B4.170: + addq $16, %rsp + .cfi_def_cfa_offset 176 + fsubl 16(%rsp) + fstpt (%rsp) +..B4.101: + testb %r12b, %r12b + je ..B4.103 +..B4.102: + movl %ebx, %edi +..___tag_value_lgammaf_r.391: + call fesetround@PLT +..___tag_value_lgammaf_r.392: +..B4.103: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B4.127 +..B4.104: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.106: + cmpl $1091567616, %r13d + jae ..B4.117 +..B4.107: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm2, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B4.146 + jp ..B4.146 +..B4.108: + fldt 16(%rsp) +..B4.109: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B4.110 + jb ..B4.109 +..B4.110: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B4.111: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B4.173: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_lgammaf_r.394: + call lgammaf_pos +..___tag_value_lgammaf_r.395: +..B4.172: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B4.114 +..B4.112: + fstp %st(0) + movl %ebx, %edi +..___tag_value_lgammaf_r.397: + call fesetround@PLT +..___tag_value_lgammaf_r.398: +..B4.113: + fldt 80(%rsp) +..B4.114: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.115: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.117: + cmpl $1174405120, %r13d + jb ..B4.123 +..B4.118: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm2, 56(%rsp) + flds 56(%rsp) + fsts (%rsp) + fsub %st, %st(1) + fxch %st(1) + fstpt 8(%rsp) + fchs + fstl 96(%rsp) + movsd 96(%rsp), %xmm0 + fstpt 40(%rsp) + fldt (%rax) + fstpt 24(%rsp) + call log@PLT +..B4.175: + fldt 8(%rsp) + lea _S16(%rip), %rax + fldt 24(%rsp) + lea _S14(%rip), %rdx + fldt 40(%rsp) + lea _S12(%rip), %rcx + movss .L_2il0floatpacket.3(%rip), %xmm2 + lea _S10(%rip), %rsi + fldl (%rax) + lea _S08(%rip), %r8 + movss %xmm2, 104(%rsp) + lea _S06(%rip), %r9 + movss 104(%rsp), %xmm1 + lea _S04(%rip), %r10 + movsd %xmm0, 56(%rsp) + lea _S02(%rip), %r11 + fxch %st(3) + fmull 56(%rsp) + subss 112(%rsp), %xmm1 + fsubp %st, %st(2) + movss %xmm1, 104(%rsp) + movss 104(%rsp), %xmm3 + fxch %st(1) + fsubs (%rsp) + subss %xmm2, %xmm3 + movss %xmm3, 104(%rsp) + movss 104(%rsp), %xmm4 + movss %xmm4, 56(%rsp) + fxch %st(1) + fsubs 56(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fmul %st, %st(2) + andb $127, 73(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + fxch %st(2) + faddl (%rdx) + fmul %st(2), %st + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + call log@PLT +..B4.174: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + je ..B4.120 +..B4.119: + movl %ebx, %edi + fstpl (%rsp) +..___tag_value_lgammaf_r.399: + call fesetround@PLT +..___tag_value_lgammaf_r.400: +..B4.179: + fldl (%rsp) +..B4.120: + fldt 8(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.121: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.123: + flds 112(%rsp) + movss .L_2il0floatpacket.3(%rip), %xmm3 + fchs + movaps %xmm3, %xmm1 + fstl 96(%rsp) + subss %xmm2, %xmm1 + movss %xmm1, 104(%rsp) + movss 104(%rsp), %xmm0 + fstpt 40(%rsp) + fldt 40(%rsp) + subss %xmm3, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm2 + movss %xmm2, 56(%rsp) + flds 56(%rsp) + movsd 96(%rsp), %xmm0 + fsubrp %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fstpt 24(%rsp) + call log@PLT +..B4.178: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fchs + fldt 56(%rsp) + fstpt (%rsp) + fstpt 24(%rsp) +..___tag_value_lgammaf_r.402: + call lgammaf_pos +..___tag_value_lgammaf_r.403: +..B4.177: + fldt 24(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fldt 24(%rsp) + lea _S14(%rip), %rax + fld %st(0) + lea _S16(%rip), %r8 + fmul %st(1), %st + lea _S10(%rip), %rdx + fxch %st(3) + fsubrp %st, %st(2) + fldl (%rax) + lea _S12(%rip), %r9 + fmul %st(3), %st + lea _S06(%rip), %rcx + fldl (%r8) + lea _S08(%rip), %r10 + fmul %st(4), %st + fxch %st(1) + faddl (%rdx) + fmul %st(4), %st + fxch %st(1) + faddl (%r9) + fmul %st(4), %st + fxch %st(1) + faddl (%rcx) + fmul %st(4), %st + fxch %st(1) + faddl (%r10) + fmul %st(4), %st + lea _S02(%rip), %rsi + fxch %st(1) + faddl (%rsi) + lea _S04(%rip), %r11 + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(3) + andb $127, 73(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B4.176: + fldt 8(%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + je ..B4.125 +..B4.124: + movl %ebx, %edi + fstpl (%rsp) + fstpt 8(%rsp) +..___tag_value_lgammaf_r.405: + call fesetround@PLT +..___tag_value_lgammaf_r.406: +..B4.180: + fldt 8(%rsp) + fldl (%rsp) +..B4.125: + testb %bpl, %bpl + fsubrp %st, %st(1) + fstps 104(%rsp) + je ..B4.127 +..B4.126: + fldcw 110(%rsp) +..B4.127: + movss 104(%rsp), %xmm0 +..B4.128: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B4.129: + testb %bpl, %bpl + je ..B4.131 +..B4.130: + fldcw 110(%rsp) +..B4.131: + testb %r12b, %r12b + je ..B4.133 +..B4.132: + movl %ebx, %edi +..___tag_value_lgammaf_r.427: + call fesetround@PLT +..___tag_value_lgammaf_r.428: +..B4.133: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B4.134: + testb %bpl, %bpl + je ..B4.136 +..B4.135: + fldcw 110(%rsp) +..B4.136: + testb %r12b, %r12b + je ..B4.138 +..B4.137: + movl %ebx, %edi +..___tag_value_lgammaf_r.449: + call fesetround@PLT +..___tag_value_lgammaf_r.450: +..B4.138: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B4.139: + testb %r12b, %r12b + je ..B4.141 +..B4.140: + movl %ebx, %edi +..___tag_value_lgammaf_r.471: + call fesetround@PLT +..___tag_value_lgammaf_r.472: +..B4.141: + lea _PBIG(%rip), %rax + testb %bpl, %bpl + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 104(%rsp) + je ..B4.127 +..B4.142: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.144: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B4.83 +..B4.145: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B4.100 +..B4.146: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B4.111 +..B4.147: + testb %r12b, %r12b + je ..B4.149 +..B4.148: + movl %ebx, %edi +..___tag_value_lgammaf_r.473: + call fesetround@PLT +..___tag_value_lgammaf_r.474: +..B4.149: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B4.127 +..B4.150: + fldcw 110(%rsp) + jmp ..B4.127 +..B4.152: + movb (%rsp), %al + testb %al, %al + je ..B4.154 +..B4.153: + movl $-1, (%r15) + jmp ..B4.155 +..B4.154: + movl $1, (%r15) +..B4.155: + testb %r12b, %r12b + je ..B4.157 +..B4.156: + movl %ebx, %edi +..___tag_value_lgammaf_r.475: + call fesetround@PLT +..___tag_value_lgammaf_r.476: +..B4.157: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B4.127 +..B4.158: + fldcw 110(%rsp) + jmp ..B4.127 + .align 16,0x90 + .cfi_endproc + .type lgammaf_r,@function + .size lgammaf_r,.-lgammaf_r + .data +# -- End lgammaf_r + .text +# -- Begin gammaf_r + .text + .align 16,0x90 + .globl gammaf_r +gammaf_r: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B5.1: + .cfi_startproc +..___tag_value_gammaf_r.478: +..L479: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $120, %rsp + .cfi_def_cfa_offset 176 + xorb %r12b, %r12b + movss %xmm0, 112(%rsp) + movq %rdi, %r15 + movb 115(%rsp), %dl + xorb %bpl, %bpl + andb $-128, %dl + shrb $7, %dl + movd %xmm0, %eax + movzwl 114(%rsp), %r14d + andl $8388607, %eax + andl $32640, %r14d + shrl $7, %r14d + movl %r14d, %r13d + shll $23, %r13d + movb %dl, (%rsp) + orl %eax, %r13d +..B5.2: + fnstcw 110(%rsp) +..B5.3: +..___tag_value_gammaf_r.493: + call fegetround@PLT +..___tag_value_gammaf_r.494: +..B5.162: + movl %eax, %ebx +..B5.4: + testl %ebx, %ebx + je ..B5.6 +..B5.5: + xorl %edi, %edi + movb $1, %r12b +..___tag_value_gammaf_r.495: + call fesetround@PLT +..___tag_value_gammaf_r.496: +..B5.6: + movzwl 110(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B5.10 +..B5.7: + orl $-64768, %edx + movw %dx, 108(%rsp) +..B5.8: + fldcw 108(%rsp) +..B5.9: + movb $1, %bpl +..B5.10: + cmpl $255, %r14d + jne ..B5.16 +..B5.11: + movl $1, (%r15) + testb %bpl, %bpl + je ..B5.13 +..B5.12: + fldcw 110(%rsp) +..B5.13: + testb %r12b, %r12b + je ..B5.15 +..B5.14: + movl %ebx, %edi +..___tag_value_gammaf_r.497: + call fesetround@PLT +..___tag_value_gammaf_r.498: +..B5.15: + movss 112(%rsp), %xmm0 + mulss %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B5.16: + testl %r13d, %r13d + je ..B5.152 +..B5.17: + movb (%rsp), %al + testb %al, %al + movl $1, (%r15) + jne ..B5.74 +..B5.18: + cmpl $2084876174, %r13d + jae ..B5.139 +..B5.19: + movss 112(%rsp), %xmm0 + ucomiss .L_2il0floatpacket.6(%rip), %xmm0 + jp ..B5.20 + je ..B5.134 +..B5.20: + cmpl $1174405120, %r13d + jb ..B5.26 +..B5.21: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm0, 56(%rsp) + pxor %xmm0, %xmm0 + flds 56(%rsp) + cvtss2sd 56(%rsp), %xmm0 + fsub %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fstps 32(%rsp) + fldt (%rax) + fstpt 16(%rsp) + call log@PLT +..B5.163: + fldt (%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fmull 56(%rsp) + fstpt (%rsp) + je ..B5.23 +..B5.22: + movl %ebx, %edi +..___tag_value_gammaf_r.519: + call fesetround@PLT +..___tag_value_gammaf_r.520: +..B5.23: + fldt (%rsp) + testb %bpl, %bpl + fldt 16(%rsp) + faddp %st, %st(1) + fsubs 32(%rsp) + fstps 104(%rsp) + je ..B5.127 +..B5.24: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.26: + cmpl $1082130432, %r13d + jb ..B5.33 +..B5.27: + addl $-1082130432, %r13d + lea _A(%rip), %rax + sarl $23, %r13d + lea _B(%rip), %rdx + movslq %r13d, %r13 + lea _C5(%rip), %r8 + movss %xmm0, 56(%rsp) + lea (,%r13,8), %ecx + flds 56(%rsp) + lea (%r13,%r13,2), %esi + movslq %ecx, %rcx + lea _C5_0(%rip), %r9 + movslq %esi, %rsi + testb %r12b, %r12b + fsubs (%rax,%r13,4) + fmuls (%rdx,%r13,4) + fld %st(0) + fmul %st(1), %st + fldl 8(%r8,%rcx,8) + fmul %st(1), %st + fldl (%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 40(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 32(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 8(%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl (%r9,%rsi,8) + fmul %st(2), %st + fxch %st(1) + faddl 56(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 48(%r8,%rcx,8) + fmul %st(2), %st + fxch %st(1) + faddl 24(%r8,%rcx,8) + fmulp %st, %st(3) + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(2) + faddl 16(%r8,%rcx,8) + fmulp %st, %st(1) + faddl 16(%r9,%rsi,8) + fstpt (%rsp) + je ..B5.30 +..B5.28: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.521: + call fesetround@PLT +..___tag_value_gammaf_r.522: +..B5.29: + fldt 80(%rsp) +..B5.30: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.31: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.33: + ucomiss .L_2il0floatpacket.4(%rip), %xmm0 + jp ..B5.34 + je ..B5.129 +..B5.34: + movss %xmm0, 56(%rsp) + cmpl $1073741824, %r13d + flds 56(%rsp) + jbe ..B5.40 +..B5.35: + fldt .L_2il0floatpacket.5(%rip) + fld %st(1) + lea _C4(%rip), %r9 + lea 8+_C4(%rip), %rax + fmul %st(2), %st + lea 32+_C4(%rip), %r10 + fldl (%rax) + lea 40+_C4(%rip), %rdx + fmul %st(1), %st + lea 64+_C4(%rip), %r11 + fldl (%r9) + lea 72+_C4(%rip), %rcx + fmul %st(2), %st + fxch %st(1) + faddl (%rdx) + fmul %st(2), %st + fxch %st(1) + faddl (%r10) + fmul %st(2), %st + fxch %st(1) + faddl (%rcx) + lea 48+_C4(%rip), %r13 + lea 56+_C4(%rip), %rsi + fmul %st(2), %st + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + fxch %st(1) + faddl (%rsi) + lea 16+_C4(%rip), %r14 + lea 24+_C4(%rip), %r8 + fmul %st(2), %st + fxch %st(1) + faddl (%r13) + fmul %st(2), %st + fxch %st(1) + faddl (%r8) + lea 80+_C4(%rip), %r15 + testb %r12b, %r12b + fmul %st(4), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fxch %st(3) + fsubrp %st, %st(4) + faddl (%r14) + fmulp %st, %st(1) + faddl (%r15) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B5.37 +..B5.36: + movl %ebx, %edi +..___tag_value_gammaf_r.523: + call fesetround@PLT +..___tag_value_gammaf_r.524: +..B5.37: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B5.127 +..B5.38: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.40: + cmpl $1071644672, %r13d + jb ..B5.47 +..B5.41: + fld %st(0) + lea 16+_C3(%rip), %rax + fmul %st(1), %st + lea 48+_C3(%rip), %rdx + fldl (%rax) + lea 32+_C3(%rip), %rcx + fmul %st(1), %st + lea 64+_C3(%rip), %rsi + lea 8+_C3(%rip), %r8 + lea 40+_C3(%rip), %r9 + lea 24+_C3(%rip), %r10 + lea 56+_C3(%rip), %r11 + lea _C3(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B5.44 +..B5.42: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.525: + call fesetround@PLT +..___tag_value_gammaf_r.526: +..B5.43: + fldt 80(%rsp) +..B5.44: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.45: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.47: + cmpl $1069547520, %r13d + jb ..B5.54 +..B5.48: + fld %st(0) + lea 16+_LGAMMAF_C2(%rip), %rax + fmul %st(1), %st + lea 48+_LGAMMAF_C2(%rip), %rdx + fldl (%rax) + lea 32+_LGAMMAF_C2(%rip), %rcx + fmul %st(1), %st + lea 64+_LGAMMAF_C2(%rip), %rsi + lea 8+_LGAMMAF_C2(%rip), %r8 + lea 40+_LGAMMAF_C2(%rip), %r9 + lea 24+_LGAMMAF_C2(%rip), %r10 + lea 56+_LGAMMAF_C2(%rip), %r11 + lea _LGAMMAF_C2(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B5.51 +..B5.49: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.527: + call fesetround@PLT +..___tag_value_gammaf_r.528: +..B5.50: + fldt 80(%rsp) +..B5.51: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.52: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.54: + cmpl $1067450368, %r13d + jb ..B5.61 +..B5.55: + lea _LM(%rip), %rax + lea 16+_C1(%rip), %rdx + lea 48+_C1(%rip), %rcx + lea 32+_C1(%rip), %rsi + lea 64+_C1(%rip), %r8 + lea 8+_C1(%rip), %r9 + lea 40+_C1(%rip), %r10 + lea 24+_C1(%rip), %r11 + fldl (%rdx) + lea 56+_C1(%rip), %r13 + lea _C1(%rip), %r14 + testb %r12b, %r12b + fxch %st(1) + fsubl (%rax) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(2) + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmulp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmul %st(2), %st + faddl (%r13) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r14) + fstpt (%rsp) + je ..B5.58 +..B5.56: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.529: + call fesetround@PLT +..___tag_value_gammaf_r.530: +..B5.57: + fldt 80(%rsp) +..B5.58: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.59: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.61: + cmpl $1065353216, %r13d + jb ..B5.68 +..B5.62: + fld %st(0) + lea 16+_C0(%rip), %rax + fmul %st(1), %st + lea 48+_C0(%rip), %rdx + fldl (%rax) + lea 32+_C0(%rip), %rcx + fmul %st(1), %st + lea 64+_C0(%rip), %rsi + lea 8+_C0(%rip), %r8 + lea 40+_C0(%rip), %r9 + lea 24+_C0(%rip), %r10 + lea 56+_C0(%rip), %r11 + lea _C0(%rip), %r13 + testb %r12b, %r12b + faddl (%rdx) + fmul %st(1), %st + faddl (%rcx) + fmul %st(1), %st + faddl (%rsi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + faddl (%r13) + fstpt (%rsp) + je ..B5.65 +..B5.63: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.531: + call fesetround@PLT +..___tag_value_gammaf_r.532: +..B5.64: + fldt 80(%rsp) +..B5.65: + fldt (%rsp) + testb %bpl, %bpl + faddp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.66: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.68: + fldt .L_2il0floatpacket.0(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fadd %st(1), %st + fstpt (%rsp) + fstpt 32(%rsp) +..___tag_value_gammaf_r.534: + call lgammaf_pos +..___tag_value_gammaf_r.535: +..B5.165: + fldt 32(%rsp) + fxch %st(1) + fstpt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B5.164: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + je ..B5.71 +..B5.69: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.537: + call fesetround@PLT +..___tag_value_gammaf_r.538: +..B5.70: + fldt 80(%rsp) +..B5.71: + fldt (%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.72: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.74: + movss 112(%rsp), %xmm0 + call nearbyintf@PLT +..B5.166: + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm1 + movss 112(%rsp), %xmm2 + ucomiss %xmm1, %xmm2 + jp ..B5.75 + je ..B5.147 +..B5.75: + comiss .L_2il0floatpacket.8(%rip), %xmm2 + jbe ..B5.78 +..B5.76: + movaps %xmm2, %xmm0 + movss %xmm2, (%rsp) + call ceilf@PLT +..B5.167: + cvttss2si %xmm0, %eax + movss (%rsp), %xmm2 + testb $1, %al + jne ..B5.78 +..B5.77: + movl $-1, (%r15) +..B5.78: + cmpl $1073741824, %r13d + jae ..B5.89 +..B5.79: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm2, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B5.144 + jp ..B5.144 +..B5.80: + fldt 16(%rsp) +..B5.81: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B5.82 + jb ..B5.81 +..B5.82: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B5.83: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B5.169: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_gammaf_r.540: + call lgammaf_pos +..___tag_value_gammaf_r.541: +..B5.168: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B5.86 +..B5.84: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.543: + call fesetround@PLT +..___tag_value_gammaf_r.544: +..B5.85: + fldt 80(%rsp) +..B5.86: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.87: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.89: + cmpl $1082130432, %r13d + jae ..B5.106 +..B5.90: + movss .L_2il0floatpacket.2(%rip), %xmm1 + lea _LRIB(%rip), %rdx + subss %xmm2, %xmm1 + movss .L_2il0floatpacket.3(%rip), %xmm2 + movss %xmm1, 104(%rsp) + pxor %xmm1, %xmm1 + movss 104(%rsp), %xmm0 + addss %xmm2, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm3 + movl 104(%rsp), %ecx + subss %xmm2, %xmm3 + movss 112(%rsp), %xmm2 + andl $1, %ecx + cvtss2sd %xmm2, %xmm1 + movss %xmm3, 104(%rsp) + lea (%rcx,%rcx,2), %eax + comisd (%rdx,%rax,8), %xmm1 + jbe ..B5.93 +..B5.91: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B5.93 +..B5.92: + movss %xmm2, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _LRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B5.101 +..B5.93: + lea _RRIB(%rip), %rdx + comisd (%rdx,%rax,8), %xmm1 + jbe ..B5.96 +..B5.94: + movsd 16(%rdx,%rax,8), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B5.96 +..B5.95: + movss %xmm2, 56(%rsp) + flds 56(%rsp) + shll $2, %ecx + fsubl 8(%rdx,%rax,8) + lea _RRP(%rip), %rax + fldl (%rax,%rcx,8) + fmul %st(1), %st + faddl 8(%rax,%rcx,8) + fmul %st(1), %st + faddl 16(%rax,%rcx,8) + fmulp %st, %st(1) + faddl 24(%rax,%rcx,8) + fstpt (%rsp) + jmp ..B5.101 +..B5.96: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm2, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt (%rsp) + fldt (%rsp) + fcomip %st(2), %st + jae ..B5.145 + jp ..B5.145 +..B5.97: + fldt (%rsp) +..B5.98: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B5.99 + jb ..B5.98 +..B5.99: + fstp %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 80(%rsp) +..B5.100: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B5.171: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstl 16(%rsp) + fstpt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 16(%rsp) + fstpt (%rsp) +..___tag_value_gammaf_r.546: + call lgammaf_pos +..___tag_value_gammaf_r.547: +..B5.170: + addq $16, %rsp + .cfi_def_cfa_offset 176 + fsubl 16(%rsp) + fstpt (%rsp) +..B5.101: + testb %r12b, %r12b + je ..B5.103 +..B5.102: + movl %ebx, %edi +..___tag_value_gammaf_r.549: + call fesetround@PLT +..___tag_value_gammaf_r.550: +..B5.103: + fldt (%rsp) + testb %bpl, %bpl + fstps 104(%rsp) + je ..B5.127 +..B5.104: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.106: + cmpl $1091567616, %r13d + jae ..B5.117 +..B5.107: + fldt .L_2il0floatpacket.0(%rip) + movss %xmm2, 56(%rsp) + fld %st(0) + flds 56(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fcomip %st(2), %st + jae ..B5.146 + jp ..B5.146 +..B5.108: + fldt 16(%rsp) +..B5.109: + fmul %st, %st(1) + fadd %st(2), %st + fcomi %st(2), %st + jp ..B5.110 + jb ..B5.109 +..B5.110: + fstp %st(2) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..B5.111: + andb $127, 89(%rsp) + fldt 80(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B5.173: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fldt 32(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value_gammaf_r.552: + call lgammaf_pos +..___tag_value_gammaf_r.553: +..B5.172: + fldt 16(%rsp) + fxch %st(1) + fstpt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + testb %r12b, %r12b + je ..B5.114 +..B5.112: + fstp %st(0) + movl %ebx, %edi +..___tag_value_gammaf_r.555: + call fesetround@PLT +..___tag_value_gammaf_r.556: +..B5.113: + fldt 80(%rsp) +..B5.114: + fldt 16(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.115: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.117: + cmpl $1174405120, %r13d + jb ..B5.123 +..B5.118: + fldt .L_2il0floatpacket.1(%rip) + lea _LN_SQRT_TWO_PI(%rip), %rax + movss %xmm2, 56(%rsp) + flds 56(%rsp) + fsts (%rsp) + fsub %st, %st(1) + fxch %st(1) + fstpt 8(%rsp) + fchs + fstl 96(%rsp) + movsd 96(%rsp), %xmm0 + fstpt 40(%rsp) + fldt (%rax) + fstpt 24(%rsp) + call log@PLT +..B5.175: + fldt 8(%rsp) + lea _S16(%rip), %rax + fldt 24(%rsp) + lea _S14(%rip), %rdx + fldt 40(%rsp) + lea _S12(%rip), %rcx + movss .L_2il0floatpacket.3(%rip), %xmm2 + lea _S10(%rip), %rsi + fldl (%rax) + lea _S08(%rip), %r8 + movss %xmm2, 104(%rsp) + lea _S06(%rip), %r9 + movss 104(%rsp), %xmm1 + lea _S04(%rip), %r10 + movsd %xmm0, 56(%rsp) + lea _S02(%rip), %r11 + fxch %st(3) + fmull 56(%rsp) + subss 112(%rsp), %xmm1 + fsubp %st, %st(2) + movss %xmm1, 104(%rsp) + movss 104(%rsp), %xmm3 + fxch %st(1) + fsubs (%rsp) + subss %xmm2, %xmm3 + movss %xmm3, 104(%rsp) + movss 104(%rsp), %xmm4 + movss %xmm4, 56(%rsp) + fxch %st(1) + fsubs 56(%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fmul %st, %st(2) + andb $127, 73(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + fxch %st(2) + faddl (%rdx) + fmul %st(2), %st + faddl (%rcx) + fmul %st(2), %st + faddl (%rsi) + fmul %st(2), %st + faddl (%r8) + fmul %st(2), %st + faddl (%r9) + fmul %st(2), %st + faddl (%r10) + fmul %st(2), %st + faddl (%r11) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + call log@PLT +..B5.174: + movsd %xmm0, 56(%rsp) + testb %r12b, %r12b + fldl 56(%rsp) + je ..B5.120 +..B5.119: + movl %ebx, %edi + fstpl (%rsp) +..___tag_value_gammaf_r.557: + call fesetround@PLT +..___tag_value_gammaf_r.558: +..B5.179: + fldl (%rsp) +..B5.120: + fldt 8(%rsp) + testb %bpl, %bpl + fsubp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.121: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.123: + flds 112(%rsp) + movss .L_2il0floatpacket.3(%rip), %xmm3 + fchs + movaps %xmm3, %xmm1 + fstl 96(%rsp) + subss %xmm2, %xmm1 + movss %xmm1, 104(%rsp) + movss 104(%rsp), %xmm0 + fstpt 40(%rsp) + fldt 40(%rsp) + subss %xmm3, %xmm0 + movss %xmm0, 104(%rsp) + movss 104(%rsp), %xmm2 + movss %xmm2, 56(%rsp) + flds 56(%rsp) + movsd 96(%rsp), %xmm0 + fsubrp %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fmul %st(0), %st + fstpt 24(%rsp) + call log@PLT +..B5.178: + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 192 + fchs + fldt 56(%rsp) + fstpt (%rsp) + fstpt 24(%rsp) +..___tag_value_gammaf_r.560: + call lgammaf_pos +..___tag_value_gammaf_r.561: +..B5.177: + fldt 24(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 176 + fldt 24(%rsp) + lea _S14(%rip), %rax + fld %st(0) + lea _S16(%rip), %r8 + fmul %st(1), %st + lea _S10(%rip), %rdx + fxch %st(3) + fsubrp %st, %st(2) + fldl (%rax) + lea _S12(%rip), %r9 + fmul %st(3), %st + lea _S06(%rip), %rcx + fldl (%r8) + lea _S08(%rip), %r10 + fmul %st(4), %st + fxch %st(1) + faddl (%rdx) + fmul %st(4), %st + fxch %st(1) + faddl (%r9) + fmul %st(4), %st + fxch %st(1) + faddl (%rcx) + fmul %st(4), %st + fxch %st(1) + faddl (%r10) + fmul %st(4), %st + lea _S02(%rip), %rsi + fxch %st(1) + faddl (%rsi) + lea _S04(%rip), %r11 + fmulp %st, %st(2) + faddl (%r11) + fmulp %st, %st(3) + andb $127, 73(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(1) + fstpt 8(%rsp) + fldt 64(%rsp) + fstpl 96(%rsp) + movsd 96(%rsp), %xmm0 + call log@PLT +..B5.176: + fldt 8(%rsp) + testb %r12b, %r12b + movsd %xmm0, 56(%rsp) + fldl 56(%rsp) + je ..B5.125 +..B5.124: + movl %ebx, %edi + fstpl (%rsp) + fstpt 8(%rsp) +..___tag_value_gammaf_r.563: + call fesetround@PLT +..___tag_value_gammaf_r.564: +..B5.180: + fldt 8(%rsp) + fldl (%rsp) +..B5.125: + testb %bpl, %bpl + fsubrp %st, %st(1) + fstps 104(%rsp) + je ..B5.127 +..B5.126: + fldcw 110(%rsp) +..B5.127: + movss 104(%rsp), %xmm0 +..B5.128: + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B5.129: + testb %bpl, %bpl + je ..B5.131 +..B5.130: + fldcw 110(%rsp) +..B5.131: + testb %r12b, %r12b + je ..B5.133 +..B5.132: + movl %ebx, %edi +..___tag_value_gammaf_r.585: + call fesetround@PLT +..___tag_value_gammaf_r.586: +..B5.133: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B5.134: + testb %bpl, %bpl + je ..B5.136 +..B5.135: + fldcw 110(%rsp) +..B5.136: + testb %r12b, %r12b + je ..B5.138 +..B5.137: + movl %ebx, %edi +..___tag_value_gammaf_r.607: + call fesetround@PLT +..___tag_value_gammaf_r.608: +..B5.138: + pxor %xmm0, %xmm0 + addq $120, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 176 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B5.139: + testb %r12b, %r12b + je ..B5.141 +..B5.140: + movl %ebx, %edi +..___tag_value_gammaf_r.629: + call fesetround@PLT +..___tag_value_gammaf_r.630: +..B5.141: + lea _PBIG(%rip), %rax + testb %bpl, %bpl + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 104(%rsp) + je ..B5.127 +..B5.142: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.144: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B5.83 +..B5.145: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B5.100 +..B5.146: + fstp %st(0) + fstpt 80(%rsp) + jmp ..B5.111 +..B5.147: + testb %r12b, %r12b + je ..B5.149 +..B5.148: + movl %ebx, %edi +..___tag_value_gammaf_r.631: + call fesetround@PLT +..___tag_value_gammaf_r.632: +..B5.149: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B5.127 +..B5.150: + fldcw 110(%rsp) + jmp ..B5.127 +..B5.152: + movb (%rsp), %al + testb %al, %al + je ..B5.154 +..B5.153: + movl $-1, (%r15) + jmp ..B5.155 +..B5.154: + movl $1, (%r15) +..B5.155: + testb %r12b, %r12b + je ..B5.157 +..B5.156: + movl %ebx, %edi +..___tag_value_gammaf_r.633: + call fesetround@PLT +..___tag_value_gammaf_r.634: +..B5.157: + movss .L_2il0floatpacket.6(%rip), %xmm1 + testb %bpl, %bpl + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, 104(%rsp) + je ..B5.127 +..B5.158: + fldcw 110(%rsp) + jmp ..B5.127 + .align 16,0x90 + .cfi_endproc + .type gammaf_r,@function + .size gammaf_r,.-gammaf_r + .data +# -- End gammaf_r + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +_LN_SQRT_TWO_PI: + .word 42293 + .word 9717 + .word 36419 + .word 60223 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _LN_SQRT_TWO_PI,@object + .size _LN_SQRT_TWO_PI,16 + .align 16 +_A: + .long 1082130432 + .long 1090519040 + .long 1098907648 + .long 1107296256 + .long 1115684864 + .long 1124073472 + .long 1132462080 + .long 1140850688 + .long 1149239296 + .long 1157627904 + .long 1166016512 + .type _A,@object + .size _A,44 + .space 4, 0x00 # pad + .align 16 +_B: + .long 1048576000 + .long 1040187392 + .long 1031798784 + .long 1023410176 + .long 1015021568 + .long 1006632960 + .long 998244352 + .long 989855744 + .long 981467136 + .long 973078528 + .long 964689920 + .type _B,@object + .size _B,44 + .space 4, 0x00 # pad + .align 16 +_C5: + .long 2219950285 + .long 1064025046 + .long 657069815 + .long 3214307011 + .long 2744833897 + .long 1073883684 + .long 3746154693 + .long 1075058958 + .long 24044097 + .long 1068577021 + .long 1852002888 + .long 3217117620 + .long 426096126 + .long 1071550305 + .long 3945160253 + .long 3219869968 + .long 889741930 + .long 1064529657 + .long 2918550257 + .long 3214927323 + .long 3306758232 + .long 1074858655 + .long 2801363753 + .long 1076895752 + .long 216130741 + .long 1069082446 + .long 2022127190 + .long 3217667546 + .long 4043317980 + .long 1072274701 + .long 948933764 + .long 3220711872 + .long 1837011561 + .long 1065353117 + .long 614133169 + .long 3215620106 + .long 128884864 + .long 1075872424 + .long 1749057555 + .long 1078324632 + .long 1278187959 + .long 1069867493 + .long 1878987920 + .long 3218464301 + .long 2508500615 + .long 1073176520 + .long 3716705454 + .long 3221664954 + .long 1971591775 + .long 1066198339 + .long 3489274850 + .long 3216507307 + .long 2978044890 + .long 1076904104 + .long 399657850 + .long 1079744937 + .long 2176842243 + .long 1070795947 + .long 1642919051 + .long 3219397359 + .long 325839939 + .long 1074155724 + .long 1189620011 + .long 3222667808 + .long 583706808 + .long 1067149757 + .long 1974968851 + .long 3217478792 + .long 3433705325 + .long 1077944360 + .long 3946626575 + .long 1081121452 + .long 1495561758 + .long 1071787114 + .long 4062466621 + .long 3220390645 + .long 1556755231 + .long 1075170624 + .long 75679593 + .long 3223694033 + .long 3504606470 + .long 1068150172 + .long 1348305099 + .long 3218489288 + .long 3580634696 + .long 1078988808 + .long 1259291510 + .long 1082352761 + .long 652214916 + .long 1072807425 + .long 4143445962 + .long 3221412067 + .long 2123749472 + .long 1076202613 + .long 4248403985 + .long 3224731560 + .long 1507106795 + .long 1069174188 + .long 3519298167 + .long 3219518582 + .long 3633366982 + .long 1080035328 + .long 2867629808 + .long 1083583554 + .long 3975256969 + .long 1073841792 + .long 2533063588 + .long 3222447083 + .long 3711656185 + .long 1077242956 + .long 3206083648 + .long 3225774644 + .long 4129446490 + .long 1070209876 + .long 3121668168 + .long 3220557159 + .long 3645659330 + .long 1081082878 + .long 1254870306 + .long 1084814091 + .long 1589013900 + .long 1074883091 + .long 485315198 + .long 3223488795 + .long 402512060 + .long 1078287430 + .long 1922980292 + .long 3226820482 + .long 157052617 + .long 1071251449 + .long 2992469705 + .long 3221600396 + .long 1492808525 + .long 1082130942 + .long 3131814131 + .long 1086044499 + .long 2683002247 + .long 1075927855 + .long 2649378904 + .long 3224533843 + .long 3018380877 + .long 1079333956 + .long 653917322 + .long 3227867691 + .long 2713966257 + .long 1072296037 + .long 4209563533 + .long 3222646006 + .long 943575735 + .long 1083179262 + .long 512478091 + .long 1087274844 + .long 3856346814 + .long 1076974372 + .long 1324813592 + .long 3225580569 + .long 1409229319 + .long 1080381507 + .long 3787450294 + .long 3228915583 + .long 3333539597 + .long 1073342203 + .long 2943809629 + .long 3223692845 + .long 794946536 + .long 1084227710 + .long 1068889795 + .long 1088463522 + .long 3231716378 + .long 1078021787 + .long 4072054083 + .long 3226628144 + .long 1998042203 + .long 1081429569 + .long 1148344549 + .long 3229963818 + .type _C5,@object + .size _C5,704 + .align 16 +_C5_0: + .long 2415979356 + .long 1070304454 + .long 2697119297 + .long 3218348439 + .long 4195263586 + .long 1073523467 + .long 3725211212 + .long 1070931684 + .long 2560716363 + .long 3219131775 + .long 4079479268 + .long 1075907809 + .long 1732432466 + .long 1071796064 + .long 3508892908 + .long 3219947991 + .long 2788858919 + .long 1077667382 + .long 2647999156 + .long 1072759450 + .long 547175205 + .long 3220886396 + .long 4254853098 + .long 1079215590 + .long 2099688739 + .long 1073767129 + .long 1386213411 + .long 3221881825 + .long 1373988558 + .long 1080631372 + .long 3012547841 + .long 1074795638 + .long 3012018428 + .long 3222904295 + .long 3968063321 + .long 1082046682 + .long 2372211290 + .long 1075829504 + .long 1852200321 + .long 3223939920 + .long 822603622 + .long 1083320025 + .long 2940107565 + .long 1076868074 + .long 1118670349 + .long 3224982033 + .long 4034033966 + .long 1084551076 + .long 3328910691 + .long 1077911588 + .long 4065388177 + .long 3226027369 + .long 3374537656 + .long 1085781831 + .long 3604631852 + .long 1078957575 + .long 786281660 + .long 3227074315 + .long 3320933858 + .long 1087012393 + .long 4128496013 + .long 1080004805 + .long 820316847 + .long 3228122065 + .long 596318476 + .long 1088242837 + .type _C5_0,@object + .size _C5_0,264 + .space 8, 0x00 # pad + .align 16 +_C4: + .long 951661919 + .long 3199388794 + .long 406044492 + .long 1057185581 + .long 2144499589 + .long 3220511658 + .long 1533861631 + .long 1073519965 + .long 4190848711 + .long 3208779382 + .long 4195628742 + .long 1064581106 + .long 501584638 + .long 3218581252 + .long 4276665641 + .long 1072296199 + .long 2679252139 + .long 3214810152 + .long 1146917984 + .long 1069511714 + .long 3597634954 + .long 3220184694 + .type _C4,@object + .size _C4,88 + .space 8, 0x00 # pad + .align 16 +_C3: + .long 953601802 + .long 1073782987 + .long 53392282 + .long 1061851682 + .long 2280564131 + .long 3213671573 + .long 126074441 + .long 1073190208 + .long 1099663909 + .long 3221770684 + .long 2017365083 + .long 1069271442 + .long 1709742889 + .long 3219105406 + .long 4029656968 + .long 1074967560 + .long 3888843833 + .long 3222480972 + .type _C3,@object + .size _C3,72 + .space 8, 0x00 # pad + .align 16 +_LGAMMAF_C2: + .long 4192182476 + .long 1073863432 + .long 3945858175 + .long 1063638439 + .long 2616885214 + .long 3215216300 + .long 3886441432 + .long 1074077679 + .long 3758761250 + .long 3222447567 + .long 984616456 + .long 1070653784 + .long 2508733349 + .long 3220210863 + .long 2272977058 + .long 1075337602 + .long 3074119607 + .long 3222665277 + .type _LGAMMAF_C2,@object + .size _LGAMMAF_C2,72 + .space 8, 0x00 # pad + .align 16 +_LM: + .long 1666629183 + .long 1073177304 + .type _LM,@object + .size _LM,8 + .space 8, 0x00 # pad + .align 16 +_C1: + .long 3166931522 + .long 3216972217 + .long 900077338 + .long 1065586189 + .long 3591574455 + .long 3213040571 + .long 425993680 + .long 1068534592 + .long 2772351024 + .long 3217220647 + .long 3693139651 + .long 1066567133 + .long 2619486276 + .long 3214985484 + .long 3371509884 + .long 1071576875 + .long 2931564028 + .long 1032391485 + .type _C1,@object + .size _C1,72 + .space 8, 0x00 # pad + .align 16 +_C0: + .long 561403216 + .long 1074066324 + .long 3155481408 + .long 1068272863 + .long 4228834524 + .long 3219267730 + .long 2107372888 + .long 1076349696 + .long 3392182390 + .long 3224133636 + .long 3282054928 + .long 1074040136 + .long 4253763640 + .long 3223020498 + .long 1528000942 + .long 1076400076 + .long 4059292707 + .long 3223275314 + .type _C0,@object + .size _C0,72 + .space 8, 0x00 # pad + .align 16 +_LRIB: + .long 2838661661 + .long 3221617475 + .long 169597185 + .long 3221617473 + .long 1795500005 + .long 3221617470 + .long 3503748181 + .long 3222250619 + .long 1417424869 + .long 3222250609 + .long 2147483648 + .long 3222250589 + .type _LRIB,@object + .size _LRIB,48 + .align 16 +_LRP: + .long 3272807679 + .long 3224639578 + .long 1009311715 + .long 1076045439 + .long 2835657108 + .long 3221135661 + .long 817526409 + .long 1017707397 + .long 2658191496 + .long 3232572725 + .long 2929834182 + .long 1081046750 + .long 2523682372 + .long 3224680861 + .long 915934040 + .long 3166559235 + .type _LRP,@object + .size _LRP,64 + .align 16 +_RRIB: + .long 890743176 + .long 3221465087 + .long 2516645996 + .long 3221465084 + .long 4142548816 + .long 3221465081 + .long 1538591435 + .long 3221825040 + .long 3164494255 + .long 3221825037 + .long 495429779 + .long 3221825035 + .type _RRIB,@object + .size _RRIB,48 + .align 16 +_RRP: + .long 93164946 + .long 1073124518 + .long 2953029931 + .long 1075015403 + .long 1722766176 + .long 1073233897 + .long 1830807661 + .long 1016083003 + .long 308861496 + .long 1079775543 + .long 2541562915 + .long 1077531858 + .long 1596959842 + .long 1075781798 + .long 3819862626 + .long 1021220357 + .type _RRP,@object + .size _RRP,64 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 4 +.L_2il0floatpacket.2: + .long 0xc0200000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x4b400000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0x40000000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +.L_2il0floatpacket.6: + .long 0x3f800000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,4 + .align 4 +_S16: + .long 2760304672 + .long 3218442033 + .type _S16,@object + .size _S16,8 + .align 4 +_S14: + .long 3264091561 + .long 3215213868 + .type _S14,@object + .size _S14,8 + .align 4 +_S12: + .long 1381164920 + .long 3217582605 + .type _S12,@object + .size _S12,8 + .align 4 +_S10: + .long 3387828299 + .long 3217636872 + .type _S10,@object + .size _S10,8 + .align 4 +_S08: + .long 3786959951 + .long 3218084854 + .type _S08,@object + .size _S08,8 + .align 4 +_S06: + .long 2675586079 + .long 3218453489 + .type _S06,@object + .size _S06,8 + .align 4 +_S04: + .long 1432133341 + .long 3219214642 + .type _S04,@object + .size _S04,8 + .align 4 +_S02: + .long 1648889397 + .long 3220853158 + .type _S02,@object + .size _S02,8 + .align 4 +_PBIG: + .long 2139095039 + .long 2139095039 + .type _PBIG,@object + .size _PBIG,8 + .align 4 +.L_2il0floatpacket.8: + .long 0xcb400000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lgammal.S b/external/sgx_libm/intel64/lgammal.S new file mode 100644 index 0000000000..156681889b --- /dev/null +++ b/external/sgx_libm/intel64/lgammal.S @@ -0,0 +1,9424 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lgammal.c" + .text +..TXTST0: +# -- Begin lgammal + .text + .align 16,0x90 + .globl lgammal +lgammal: +# parameter 1: 16 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_lgammal.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + fldt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 32 + lea 16(%rsp), %rdi + fstpt (%rsp) +..___tag_value_lgammal.5: + call __libm_lgammal +..___tag_value_lgammal.6: +..B1.2: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lgammal,@function + .size lgammal,.-lgammal + .data +# -- End lgammal + .text +# -- Begin __libm_lgammal + .text + .align 16,0x90 +__libm_lgammal: +# parameter 1: 336 + %rsp +# parameter 2: %rdi +..B2.1: + .cfi_startproc +..___tag_value___libm_lgammal.9: +..L10: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $280, %rsp + .cfi_def_cfa_offset 336 + movq %rdi, %rbp + movq %fs:40, %rax + xorl %r12d, %r12d + xorq %rsp, %rax + xorb %r14b, %r14b + movq %rax, 272(%rsp) +..B2.2: + fnstcw 194(%rsp) +..B2.3: +..___tag_value___libm_lgammal.24: + call fegetround@PLT +..___tag_value___libm_lgammal.25: +..B2.275: + movl %eax, %r13d +..B2.4: + testl %r13d, %r13d + je ..B2.6 +..B2.5: + xorl %edi, %edi + movl $1, %r12d +..___tag_value___libm_lgammal.26: + call fesetround@PLT +..___tag_value___libm_lgammal.27: +..B2.6: + movzwl 194(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B2.10 +..B2.7: + orl $-64768, %edx + movw %dx, 192(%rsp) +..B2.8: + fldcw 192(%rsp) +..B2.9: + movb $1, %r14b +..B2.10: + movzbl 345(%rsp), %ecx + lea ones(%rip), %rax + movl %ecx, %r15d + andl $128, %r15d + shrl $7, %r15d + movzwl 344(%rsp), %ebx + movss (%rax,%r15,4), %xmm0 + andl $32767, %ebx + shll $15, %r15d + orl %ebx, %r15d + shll $16, %r15d + movzwl 342(%rsp), %edx + orl %edx, %r15d + cmpl $32767, %ebx + je ..B2.259 +..B2.11: + fldt 336(%rsp) + fldt .L_2il0floatpacket.0(%rip) + fucomi %st(1), %st + jp ..B2.12 + je ..B2.252 +..B2.12: + lea _OFW_BOUND(%rip), %rax + fldt (%rax) + fcomip %st(2), %st + jb ..B2.244 +..B2.13: + fldt .L_2il0floatpacket.1(%rip) + fucomip %st(2), %st + jp ..B2.14 + je ..B2.235 +..B2.14: + fldt .L_2il0floatpacket.2(%rip) + fucomip %st(2), %st + jp ..B2.15 + je ..B2.235 +..B2.15: + testl %r15d, %r15d + jl ..B2.227 +..B2.16: + cmpl $16382, %ebx + jl ..B2.163 +..B2.17: + cmpl $16463, %ebx + jge ..B2.156 +..B2.18: + fldt .L_2il0floatpacket.4(%rip) + fcomip %st(2), %st + jbe ..B2.146 +..B2.19: + fldt .L_2il0floatpacket.5(%rip) + fcomip %st(2), %st + jae ..B2.113 + jp ..B2.113 +..B2.20: + movl %r15d, %eax + andl $2147483647, %eax + cmpl $1073659904, %eax + jl ..B2.104 +..B2.21: + fcomi %st(1), %st + jae ..B2.24 + jp ..B2.24 +..B2.22: + fldt .L_2il0floatpacket.10(%rip) + fcomip %st(2), %st + jbe ..B2.24 +..B2.23: + fstp %st(0) + fldt .L_2il0floatpacket.11(%rip) + movl $1, (%rbp) + jmp ..B2.27 +..B2.24: + fldt .L_2il0floatpacket.11(%rip) + fcomi %st(2), %st + jae ..B2.37 + jp ..B2.37 +..B2.25: + fldt .L_2il0floatpacket.12(%rip) + fcomip %st(3), %st + jbe ..B2.37 +..B2.26: + fstp %st(1) + movl $1, (%rbp) +..B2.27: + lea 2800+_ldbA(%rip), %rdx + lea 480+_dbA(%rip), %rcx + fcomip %st(1), %st + jae ..B2.29 + jp ..B2.29 +..B2.28: + fldt .L_2il0floatpacket.2(%rip) + lea 656+_dbA(%rip), %rcx + lea 2912+_ldbA(%rip), %rdx + fsubrp %st, %st(1) + jmp ..B2.30 +..B2.29: + fldt .L_2il0floatpacket.1(%rip) + fsubp %st, %st(1) +..B2.30: + fldl 88(%rcx) + lea _TWO_32H(%rip), %rax + fmul %st(1), %st + fld %st(1) + fld %st(2) + testl %r12d, %r12d + fldl (%rax) + fmul %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(3) + fsub %st(2), %st + fldt (%rdx) + fxch %st(4) + faddl 104(%rcx) + fmul %st(5), %st + fldt 48(%rdx) + fldt 16(%rdx) + fxch %st(2) + faddl 96(%rcx) + fmul %st(7), %st + faddl 80(%rcx) + fmul %st(7), %st + faddl 152(%rcx) + fmul %st(7), %st + faddl 120(%rcx) + fmul %st(7), %st + faddl 112(%rcx) + fmul %st(7), %st + faddl 136(%rcx) + fmul %st(7), %st + faddl 128(%rcx) + fmul %st(7), %st + faddl 40(%rcx) + fmul %st(7), %st + faddl 32(%rcx) + fmul %st(7), %st + faddl 56(%rcx) + fmul %st(7), %st + faddl 48(%rcx) + fmul %st(7), %st + faddl 144(%rcx) + fmul %st(7), %st + faddp %st, %st(6) + fxch %st(5) + fmul %st(6), %st + faddp %st, %st(5) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fldt 64(%rdx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 32(%rdx) + faddp %st, %st(1) + fmul %st(4), %st + fldt 80(%rdx) + faddp %st, %st(1) + fmul %st(4), %st + fld %st(1) + fldt 96(%rdx) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + fmul %st(6), %st + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fldl (%rcx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(3) + fmul %st(2), %st + fxch %st(1) + faddl 72(%rcx) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(1) + fldl 16(%rcx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl 168(%rcx) + faddp %st, %st(2) + fld %st(3) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(1) + fldl 64(%rcx) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl 8(%rcx) + faddp %st, %st(2) + fld %st(3) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(1) + fldl 160(%rcx) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddl 24(%rcx) + faddp %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubp %st, %st(3) + fxch %st(2) + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + fxch %st(1) + je ..B2.33 +..B2.31: + fstp %st(1) + fstp %st(0) + movl %r13d, %edi +..___tag_value___libm_lgammal.28: + call fesetround@PLT +..___tag_value___libm_lgammal.29: +..B2.32: + fldt (%rsp) + fldt 16(%rsp) +..B2.33: + testb %r14b, %r14b + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.35 +..B2.34: + fldcw 194(%rsp) +..B2.35: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.36: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.37: + fstp %st(0) + fcomi %st(1), %st + jae ..B2.46 + jp ..B2.46 +..B2.38: + fldt .L_2il0floatpacket.2(%rip) + fcomip %st(2), %st + jbe ..B2.46 +..B2.39: + fstp %st(0) + lea 3024+_ldbA(%rip), %rax + addq $-16, %rsp + .cfi_def_cfa_offset 352 + lea 3040+_ldbA(%rip), %rdi + lea 832+_dbA(%rip), %rsi + movl $1, (%rbp) + lea 16(%rsp), %rdx + fldt (%rax) + fsubrp %st, %st(1) + fstpt (%rsp) +..___tag_value___libm_lgammal.51: + call __libm_p25 +..___tag_value___libm_lgammal.52: +..B2.276: + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B2.40: + testl %r12d, %r12d + je ..B2.42 +..B2.41: + movl %r13d, %edi +..___tag_value___libm_lgammal.54: + call fesetround@PLT +..___tag_value___libm_lgammal.55: +..B2.42: + fldt (%rsp) + testb %r14b, %r14b + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.44 +..B2.43: + fldcw 194(%rsp) +..B2.44: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.45: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.46: + fcomi %st(1), %st + jbe ..B2.95 +..B2.47: + fldt .L_2il0floatpacket.14(%rip) + fcomi %st(2), %st + jae ..B2.56 + jp ..B2.56 +..B2.48: + fstp %st(0) + fldt .L_2il0floatpacket.15(%rip) + fcomi %st(2), %st + jbe ..B2.56 +..B2.49: + fstp %st(1) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + lea 3424+_ldbA(%rip), %rdi + lea 1360+_dbA(%rip), %rsi + lea 16(%rsp), %rdx + movl $-1, (%rbp) + fsubrp %st, %st(1) + fstpt (%rsp) +..___tag_value___libm_lgammal.77: + call __libm_p25 +..___tag_value___libm_lgammal.78: +..B2.277: + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B2.50: + testl %r12d, %r12d + je ..B2.52 +..B2.51: + movl %r13d, %edi +..___tag_value___libm_lgammal.80: + call fesetround@PLT +..___tag_value___libm_lgammal.81: +..B2.52: + fldt (%rsp) + testb %r14b, %r14b + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.54 +..B2.53: + fldcw 194(%rsp) +..B2.54: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.55: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.56: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstp %st(0) + fstpt (%rsp) + fldt (%rsp) + fstpt 64(%rsp) + call nearbyintl@PLT +..B2.278: + fldt 64(%rsp) + fldt .L_2il0floatpacket.0(%rip) + addq $16, %rsp + .cfi_def_cfa_offset 336 + fxch %st(2) + fucomi %st(1), %st + jp ..B2.57 + je ..B2.191 +..B2.57: + fldt .L_2il0floatpacket.17(%rip) + fcomip %st(2), %st + ja ..B2.69 + jp ..B2.69 +..B2.58: + fldt .L_2il0floatpacket.18(%rip) + fcomip %st(2), %st + jb ..B2.69 +..B2.59: + fstp %st(0) + fldt .L_2il0floatpacket.19(%rip) + fcomip %st(1), %st + jae ..B2.61 + jp ..B2.61 +..B2.60: + movl $-1, (%rbp) + jmp ..B2.62 +..B2.61: + movl $1, (%rbp) +..B2.62: + fldt .L_2il0floatpacket.1(%rip) + lea ones(%rip), %rdx + faddp %st, %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fld %st(0) + movb 105(%rsp), %al + andb $-128, %al + shrb $7, %al + fmul %st(1), %st + fstpt 128(%rsp) + fld %st(0) + fchs + movzbl %al, %ecx + fstpt 16(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + lea 240(%rsp), %rdi + fmuls (%rdx,%rcx,4) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_lgammal.105: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.106: +..B2.279: + fstp %st(0) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.63: + fldt 96(%rsp) + lea 1560+_dbA(%rip), %rax + fldt 16(%rsp) + lea 1552+_dbA(%rip), %rdx + lea 1544+_dbA(%rip), %rcx + lea 1536+_dbA(%rip), %rbx + lea 3600+_ldbA(%rip), %rbp + lea 3584+_ldbA(%rip), %rsi + fldl (%rax) + lea 1568+_dbA(%rip), %r10 + fmul %st(2), %st + lea 1576+_dbA(%rip), %r11 + fldt (%rbp) + lea 1584+_dbA(%rip), %r15 + fldt (%rsi) + lea 1592+_dbA(%rip), %rax + lea 3568+_ldbA(%rip), %r8 + lea 3552+_ldbA(%rip), %r9 + testl %r12d, %r12d + fxch %st(2) + faddl (%rdx) + fmul %st(4), %st + fldt (%r8) + fldt (%r9) + fxch %st(2) + faddl (%rcx) + fmul %st(6), %st + faddl (%rbx) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fldl (%r10) + fmul %st(1), %st + fldt 128(%rsp) + fxch %st(1) + faddl (%r11) + fmul %st(2), %st + faddl (%r15) + fmul %st(2), %st + faddl (%rax) + lea 1600+_dbA(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 1608+_dbA(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 1616+_dbA(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 1624+_dbA(%rip), %rax + fmul %st(2), %st + faddl (%rax) + lea 3664+_ldbA(%rip), %rax + fmul %st(2), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 240(%rsp) + fldt 240(%rsp) + faddp %st, %st(2) + fldt (%rax) + lea 3648+_ldbA(%rip), %rax + fmul %st(1), %st + fldt (%rax) + lea 3632+_ldbA(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea 3616+_ldbA(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(1) + fsubp %st, %st(1) + fstpt (%rsp) + je ..B2.65 +..B2.64: + movl %r13d, %edi +..___tag_value___libm_lgammal.108: + call fesetround@PLT +..___tag_value___libm_lgammal.109: +..B2.65: + fldt 224(%rsp) + testb %r14b, %r14b + fldt (%rsp) + fsubp %st, %st(1) + fldt 208(%rsp) + fsubrp %st, %st(1) + fstpt 176(%rsp) + je ..B2.67 +..B2.66: + fldcw 194(%rsp) +..B2.67: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.68: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.69: + fnstcw (%rsp) + movzwl (%rsp), %eax + orl $3072, %eax + movl %eax, 8(%rsp) + fldcw 8(%rsp) + fistl 16(%rsp) + fldcw (%rsp) + fld %st(1) + lea 848+_ldbA(%rip), %r8 + movl 16(%rsp), %edx + fsubp %st, %st(1) + negl %edx + lea -2(%rdx), %eax + andl $1, %edx + jne ..B2.72 +..B2.70: + fcomi %st(2), %st + jae ..B2.73 + jp ..B2.73 +..B2.71: + movl $-1, (%rbp) + jmp ..B2.74 +..B2.72: + jne ..B2.188 +..B2.73: + movl $1, (%rbp) +..B2.74: + fldt .L_2il0floatpacket.20(%rip) + xorl %edx, %edx + fxch %st(2) + fcomi %st(2), %st + fxch %st(2) + fstp %st(0) + cmova %edx, %eax + movl $17, %ecx + xorl %ebp, %ebp + lea 1424+_ldbA(%rip), %rdx + fcomi %st(2), %st + cmova %ecx, %ebp + addl %ebp, %eax + movslq %eax, %rsi + shlq $4, %rsi + fldt (%rsi,%r8) + lea (%rax,%rax), %r8d + movslq %r8d, %r8 + fsubr %st(2), %st + shlq $4, %r8 + fldt (%r8,%rdx) + fcomip %st(3), %st + jae ..B2.84 + jp ..B2.84 +..B2.75: + fldt 16(%r8,%rdx) + fcomip %st(3), %st + jbe ..B2.84 +..B2.77: + fstp %st(3) + fstp %st(1) + lea _ldbA(%rip), %rbx + lea (%rax,%rax,2), %ecx + movslq %ecx, %rcx + lea (%rax,%rax,4), %eax + shll $2, %eax + lea _dbA(%rip), %rbp + shlq $4, %rcx + addq $-16, %rsp + .cfi_def_cfa_offset 352 + movslq %eax, %rax + lea 256(%rsp), %rdx + fxch %st(1) + fstpt (%rsp) + lea 4480(%rbx,%rcx), %rdi + fstpt 16(%rsp) + lea 2432(%rbp,%rax,8), %rsi +..___tag_value___libm_lgammal.131: + call __libm_p19root +..___tag_value___libm_lgammal.132: +..B2.280: + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B2.78: + testl %r12d, %r12d + je ..B2.80 +..B2.79: + movl %r13d, %edi + fstpt (%rsp) +..___tag_value___libm_lgammal.134: + call fesetround@PLT +..___tag_value___libm_lgammal.135: +..B2.305: + fldt (%rsp) +..B2.80: + fldt 240(%rsp) + testb %r14b, %r14b + fldt 256(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.311 +..B2.81: + fstpt 96(%rsp) +..B2.281: + fldcw 194(%rsp) + jmp ..B2.82 +..B2.311: + fstp %st(0) +..B2.82: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.83: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.84: + fstp %st(0) + fstpt 96(%rsp) +..B2.85: + lea -16382(%rbx), %eax + cmpl $2, %eax + jne ..B2.87 +..B2.86: + fldt .L_2il0floatpacket.21(%rip) + addl $-16380, %ebx + fcomip %st(1), %st + cmova %ebx, %eax +..B2.87: + fldt .L_2il0floatpacket.19(%rip) + lea (%rax,%rax,4), %edx + fmul %st, %st(1) + lea (%rdx,%rdx), %eax + fstp %st(2) + fstpt 80(%rsp) + lea _dbA(%rip), %rsi + fldt .L_2il0floatpacket.16(%rip) + lea _ldbA(%rip), %rbx + movzwl 88(%rsp), %ecx + lea _TWO_32H(%rip), %rbp + andl $-32768, %ecx + orl $-49153, %ecx + movw %cx, 88(%rsp) + fldt 80(%rsp) + shll $2, %edx + fsubp %st, %st(1) + movslq %edx, %rdx + movslq %eax, %rax + shlq $4, %rax + fstpt 80(%rsp) + fldt 80(%rsp) + fldl 1784(%rsi,%rdx,8) + fmul %st(1), %st + fldt 3824(%rbx,%rax) + fldt 3808(%rbx,%rax) + fldt 3792(%rbx,%rax) + fldt 3776(%rbx,%rax) + fldt 3760(%rbx,%rax) + fxch %st(5) + faddl 1776(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1768(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1760(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1752(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1744(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1736(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1728(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1720(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1712(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1704(%rsi,%rdx,8) + fmul %st(6), %st + faddl 1696(%rsi,%rdx,8) + fmul %st(6), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + fldt 3744(%rbx,%rax) + faddp %st, %st(1) + fmul %st(1), %st + fldt 3728(%rbx,%rax) + faddp %st, %st(1) + fmul %st(1), %st + fld %st(1) + fldt 3712(%rbx,%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt 3696(%rbx,%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 3680(%rbx,%rax) + faddp %st, %st(1) + fldl (%rbp) + fld %st(0) + fmul %st(4), %st + fadd %st, %st(3) + fsubrp %st, %st(3) + fxch %st(2) + fstpt 160(%rsp) + fldt 160(%rsp) + fld %st(2) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(2), %st + fxch %st(1) + fsubr %st, %st(3) + fld %st(3) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(6) + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(2) + fldl 1632(%rsi,%rdx,8) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(4) + fmul %st(2), %st + fxch %st(1) + faddl 1640(%rsi,%rdx,8) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fmul %st(4), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(2) + fldl 1680(%rsi,%rdx,8) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(4) + fmul %st(2), %st + fxch %st(1) + faddl 1688(%rsi,%rdx,8) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fmul %st(4), %st + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(2) + fldl 1664(%rsi,%rdx,8) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fxch %st(1) + faddl 1672(%rsi,%rdx,8) + faddp %st, %st(3) + fld %st(4) + fmul %st(2), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fadd %st, %st(1) + fxch %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldl 1648(%rsi,%rdx,8) + fld %st(0) + fadd %st(4), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fxch %st(3) + faddl 1656(%rsi,%rdx,8) + faddp %st, %st(1) + fstpt (%rsp) + fldt 336(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + fmulp %st, %st(3) + lea 272(%rsp), %rdi + fxch %st(2) + fstpt (%rsp) + fstpt 16(%rsp) + fstpt 64(%rsp) +..___tag_value___libm_lgammal.157: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.158: +..B2.282: + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + fldt 64(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.88: + fldt 96(%rsp) + lea ones(%rip), %rdx + movb 105(%rsp), %al + addq $-32, %rsp + .cfi_def_cfa_offset 368 + andb $-128, %al + lea 240(%rsp), %rdi + shrb $7, %al + movzbl %al, %ecx + fmuls (%rdx,%rcx,4) + fstpt (%rsp) + fldt (%rsp) + fxch %st(2) + fstpt 16(%rsp) + fxch %st(1) + fstpt 80(%rsp) + fstpt 64(%rsp) +..___tag_value___libm_lgammal.161: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.162: +..B2.283: + fstp %st(0) + fldt 64(%rsp) + fldt 80(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.89: + fld %st(0) + lea 544+_ldbA(%rip), %rcx + fmul %st(2), %st + fld %st(1) + lea 528+_ldbA(%rip), %rbx + lea 512+_ldbA(%rip), %rbp + lea 496+_ldbA(%rip), %rsi + lea 480+_ldbA(%rip), %r8 + lea 464+_ldbA(%rip), %r9 + lea 448+_ldbA(%rip), %r10 + lea 432+_ldbA(%rip), %r11 + lea 416+_ldbA(%rip), %r15 + lea 304+_ldbA(%rip), %rax + lea 48+_dbA(%rip), %rdx + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(1) + fsub %st(1), %st + fxch %st(2) + fmul %st(0), %st + fldt (%rcx) + lea 400+_ldbA(%rip), %rcx + fmul %st(1), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r15) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 384+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 368+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 352+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 336+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fld %st(2) + fmul %st(3), %st + fldt (%rcx) + lea 320+_ldbA(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rax) + lea 64+_dbA(%rip), %rax + faddp %st, %st(2) + fld %st(0) + fldt .L_2il0floatpacket.2(%rip) + fmulp %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fld %st(5) + fmul %st(3), %st + fxch %st(5) + fmul %st(0), %st + faddp %st, %st(1) + fld %st(5) + fmul %st(2), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fld %st(3) + fadd %st(6), %st + fsubp %st, %st(6) + fmul %st(5), %st + fxch %st(2) + fsub %st(4), %st + faddp %st, %st(1) + fld %st(3) + fxch %st(3) + fsub %st(5), %st + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fmul %st(4), %st + faddp %st, %st(2) + fldl (%rax) + fld %st(0) + lea 72+_dbA(%rip), %rax + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(6) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fld %st(4) + fxch %st(2) + faddl (%rax) + lea 56+_dbA(%rip), %rax + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(3) + fmul %st(3), %st + fxch %st(3) + fmul %st(5), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fldl (%rdx) + fld %st(0) + lea ones(%rip), %rdx + fadd %st(3), %st + fmul %st, %st(6) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(6), %st + fsubp %st, %st(6) + fxch %st(2) + fsub %st(5), %st + fld %st(3) + fmul %st(6), %st + fstpt 64(%rsp) + fxch %st(4) + fmul %st, %st(5) + fxch %st(2) + faddl (%rax) + faddp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 80(%rsp) + fldt 16(%rsp) + fld %st(0) + fld %st(1) + fld %st(2) + fldt (%rsp) + fadd %st, %st(1) + fxch %st(1) + fstpt 128(%rsp) + fldt 128(%rsp) + fldt 240(%rsp) + fld %st(0) + fxch %st(1) + fadd %st, %st(5) + movb 137(%rsp), %al + fxch %st(4) + fsub %st(5), %st + andb $-128, %al + fadd %st(4), %st + shrb $7, %al + fadd %st(3), %st + fxch %st(4) + fsub %st(5), %st + movzbl %al, %eax + faddp %st, %st(6) + fxch %st(1) + fmuls (%rdx,%rax,4) + fldt 256(%rsp) + fadd %st, %st(2) + fxch %st(2) + fstpt 144(%rsp) + fldt 144(%rsp) + fxch %st(2) + fadd %st, %st(6) + movb 153(%rsp), %al + fxch %st(3) + faddp %st, %st(6) + fxch %st(2) + faddp %st, %st(3) + fldt 208(%rsp) + andb $-128, %al + fld %st(0) + fldt 64(%rsp) + shrb $7, %al + fadd %st, %st(1) + fxch %st(1) + fchs + fadd %st, %st(2) + movzbl %al, %eax + fxch %st(2) + fchs + fsubp %st, %st(1) + fld %st(1) + fsub %st(6), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(3) + fmuls (%rdx,%rax,4) + fxch %st(4) + fcomip %st(4), %st + fxch %st(3) + fstp %st(0) + fxch %st(5) + fcmovnbe %st(3), %st + fstp %st(3) + fld %st(4) + fldt 224(%rsp) + fsubrp %st, %st(3) + fld %st(4) + fadd %st(4), %st + fstpt 144(%rsp) + fldt 144(%rsp) + fldt 80(%rsp) + fsubrp %st, %st(4) + fxch %st(1) + fadd %st(3), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fld %st(6) + movb 137(%rsp), %al + fsub %st(3), %st + andb $-128, %al + fsub %st(6), %st + shrb $7, %al + fadd %st(4), %st + movzbl %al, %eax + fsub %st(5), %st + fxch %st(3) + faddp %st, %st(6) + fxch %st(5) + fchs + faddp %st, %st(6) + fxch %st(3) + fsubrp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fxch %st(2) + fmuls (%rdx,%rax,4) + movb 153(%rsp), %al + andb $-128, %al + shrb $7, %al + fstpt 128(%rsp) + fldt 128(%rsp) + movzbl %al, %eax + fxch %st(1) + fmuls (%rdx,%rax,4) + fxch %st(1) + fcomip %st(1), %st + fxch %st(2) + fcmovnbe %st(1), %st + fstp %st(1) + fstpt 32(%rsp) + testl %r12d, %r12d + je ..B2.91 +..B2.90: + movl %r13d, %edi + fstpt (%rsp) +..___tag_value___libm_lgammal.164: + call fesetround@PLT +..___tag_value___libm_lgammal.165: +..B2.303: + fldt (%rsp) +..B2.91: + fldt 32(%rsp) + testb %r14b, %r14b + fldt 48(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.312 +..B2.92: + fstpt 144(%rsp) +..B2.284: + fldcw 194(%rsp) + jmp ..B2.93 +..B2.312: + fstp %st(0) +..B2.93: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.94: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.95: + fstp %st(0) + fldt .L_2il0floatpacket.13(%rip) + lea 3168+_ldbA(%rip), %rdi + movl $1, (%rbp) + lea 1008+_dbA(%rip), %rsi + fmul %st, %st(1) + cmpl $16385, %ebx + jne ..B2.97 +..B2.96: + fmul %st, %st(1) + lea 1184+_dbA(%rip), %rsi + lea 3296+_ldbA(%rip), %rdi +..B2.97: + fstp %st(0) + fldt .L_2il0floatpacket.16(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fsubrp %st, %st(1) + fstpt (%rsp) + lea 16(%rsp), %rdx +..___tag_value___libm_lgammal.187: + call __libm_p25 +..___tag_value___libm_lgammal.188: +..B2.285: + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B2.98: + testl %r12d, %r12d + je ..B2.100 +..B2.99: + movl %r13d, %edi +..___tag_value___libm_lgammal.190: + call fesetround@PLT +..___tag_value___libm_lgammal.191: +..B2.100: + fldt (%rsp) + testb %r14b, %r14b + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.102 +..B2.101: + fldcw 194(%rsp) +..B2.102: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.103: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.104: + fstp %st(0) + fldt .L_2il0floatpacket.8(%rip) + lea 2544+_ldbA(%rip), %rdi + lea 128+_dbA(%rip), %rsi + testl %r15d, %r15d + fsubr %st(1), %st + jl ..B2.200 +..B2.105: + fstp %st(1) + movl $1, (%rbp) +..B2.106: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + lea 16(%rsp), %rdx + fstpt (%rsp) +..___tag_value___libm_lgammal.213: + call __libm_p25 +..___tag_value___libm_lgammal.214: +..B2.286: + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B2.107: + testl %r12d, %r12d + je ..B2.109 +..B2.108: + movl %r13d, %edi +..___tag_value___libm_lgammal.216: + call fesetround@PLT +..___tag_value___libm_lgammal.217: +..B2.109: + fldt (%rsp) + testb %r14b, %r14b + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.111 +..B2.110: + fldcw 194(%rsp) +..B2.111: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.112: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.113: + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fstp %st(0) + fstpt (%rsp) + fldt (%rsp) + movss %xmm0, 48(%rsp) + fstpt 64(%rsp) + call nearbyintl@PLT +..B2.287: + fldt 64(%rsp) + fld %st(0) + movss 48(%rsp), %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 336 + fsub %st(2), %st + fldt .L_2il0floatpacket.0(%rip) + fucomi %st(1), %st + jp ..B2.114 + je ..B2.209 +..B2.114: + fldt .L_2il0floatpacket.9(%rip) + fcomip %st(3), %st + jae ..B2.131 + jp ..B2.131 +..B2.115: + fxch %st(3) + fnstcw (%rsp) + movzwl (%rsp), %eax + orl $3072, %eax + movl %eax, 8(%rsp) + fldcw 8(%rsp) + fistl 16(%rsp) + fldcw (%rsp) + lea 848+_ldbA(%rip), %rbx + movl 16(%rsp), %r8d + movl %r8d, %edx + negl %edx + lea -2(%rdx), %eax + addl $15, %edx + fxch %st(1) + fcomi %st(3), %st + cmova %edx, %eax + lea 1424+_ldbA(%rip), %rdx + movslq %eax, %rcx + shlq $4, %rcx + lea (%rax,%rax), %esi + movslq %esi, %rsi + fldt (%rcx,%rbx) + shlq $4, %rsi + fsubr %st(3), %st + fldt (%rsi,%rdx) + fcomip %st(4), %st + jae ..B2.129 + jp ..B2.129 +..B2.116: + fldt 16(%rsi,%rdx) + fcomip %st(4), %st + jbe ..B2.129 +..B2.117: + fstp %st(2) + fstp %st(2) + negl %r8d + andl $1, %r8d + jne ..B2.120 +..B2.118: + fxch %st(2) + fcomi %st(1), %st + fxch %st(2) + jbe ..B2.121 +..B2.119: + fstp %st(2) + movl $-1, (%rbp) + jmp ..B2.122 +..B2.120: + jne ..B2.202 +..B2.121: + fstp %st(2) + movl $1, (%rbp) +..B2.122: + lea _ldbA(%rip), %rbx + lea (%rax,%rax,2), %ecx + movslq %ecx, %rcx + lea (%rax,%rax,4), %eax + shll $2, %eax + lea _dbA(%rip), %rbp + shlq $4, %rcx + addq $-16, %rsp + .cfi_def_cfa_offset 352 + movslq %eax, %rax + lea 256(%rsp), %rdx + fxch %st(1) + fstpt (%rsp) + lea 4480(%rbx,%rcx), %rdi + fstpt 16(%rsp) + lea 2432(%rbp,%rax,8), %rsi +..___tag_value___libm_lgammal.241: + call __libm_p19root +..___tag_value___libm_lgammal.242: +..B2.288: + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 336 +..B2.123: + testl %r12d, %r12d + je ..B2.125 +..B2.124: + movl %r13d, %edi + fstpt (%rsp) +..___tag_value___libm_lgammal.244: + call fesetround@PLT +..___tag_value___libm_lgammal.245: +..B2.307: + fldt (%rsp) +..B2.125: + fldt 240(%rsp) + testb %r14b, %r14b + fldt 256(%rsp) + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.313 +..B2.126: + fstpt 96(%rsp) +..B2.289: + fldcw 194(%rsp) + jmp ..B2.127 +..B2.313: + fstp %st(0) +..B2.127: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.128: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.129: + fstp %st(0) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(1) + fxch %st(3) + fxch %st(1) + jmp ..B2.132 +..B2.131: + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) +..B2.132: + fldt .L_2il0floatpacket.13(%rip) + addq $-16, %rsp + .cfi_def_cfa_offset 352 + fmulp %st, %st(4) + fstp %st(1) + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + fstpt 32(%rsp) + fxch %st(1) + fstpt 16(%rsp) + movss %xmm0, 48(%rsp) + fstpt 64(%rsp) + call nearbyintl@PLT +..B2.290: + fldt 64(%rsp) + fldt 16(%rsp) + fldt 32(%rsp) + fldt .L_2il0floatpacket.0(%rip) + movss 48(%rsp), %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 336 + fxch %st(4) + fucomip %st(1), %st + fstp %st(0) + jp ..B2.133 + je ..B2.206 +..B2.133: + fcomip %st(2), %st + jbe ..B2.135 +..B2.134: + movl $-1, (%rbp) + jmp ..B2.136 +..B2.135: + movl $1, (%rbp) +..B2.136: + movss %xmm0, (%rsp) + fxch %st(1) + flds (%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + lea 272(%rsp), %rdi + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_lgammal.269: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.270: +..B2.291: + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.137: + fldt 240(%rsp) + lea _TWO_32H(%rip), %rax + fldt 256(%rsp) + fstp %st(2) + lea 560+_ldbA(%rip), %rdx + fldt 80(%rsp) + fld %st(0) + fld %st(1) + fldl (%rax) + lea 80+_dbA(%rip), %rax + fstpt 16(%rsp) + fldt 16(%rsp) + fmul %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + fld %st(2) + fsub %st(1), %st + fldt .L_2il0floatpacket.13(%rip) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmul %st(7), %st + fstpt 48(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fsubrp %st, %st(6) + fxch %st(3) + fmul %st(5), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fld %st(5) + fadd %st(1), %st + fstpt 144(%rsp) + fldt 144(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(5) + fxch %st(6) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fld %st(5) + fmul %st(2), %st + fxch %st(4) + fmul %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fld %st(3) + fadd %st(3), %st + fstpt (%rsp) + fldt (%rsp) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(4) + faddp %st, %st(2) + fldt 48(%rsp) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) + fldt .L_2il0floatpacket.7(%rip) + fcomip %st(1), %st + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + jbe ..B2.139 +..B2.138: + lea 704+_ldbA(%rip), %rdx + lea 96+_dbA(%rip), %rax +..B2.139: + fldt .L_2il0floatpacket.1(%rip) + fld %st(3) + fstp %st(2) + movb 105(%rsp), %cl + lea ones(%rip), %rbx + andb $-128, %cl + fxch %st(1) + fadd %st(2), %st + shrb $7, %cl + fdivr %st(1), %st + fld %st(3) + fldt 16(%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movzbl %cl, %ebp + fadd %st(4), %st + fsubp %st, %st(1) + fmul %st, %st(6) + fxch %st(4) + fsubrp %st, %st(6) + fxch %st(2) + fsub %st(3), %st + fld %st(0) + fadd %st(4), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fmulp %st, %st(4) + fxch %st(3) + fsubrp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fmul %st(0), %st + fldt 128(%rdx) + fmul %st(1), %st + fldt 112(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 80(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 64(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 32(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 16(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + lea 120+_dbA(%rip), %rdx + faddp %st, %st(1) + fmulp %st, %st(1) + fldl (%rax) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(5) + fld %st(0) + fadd %st(6), %st + fsubp %st, %st(6) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(5), %st + fstpt 240(%rsp) + fldt 240(%rsp) + fxch %st(2) + fsub %st(5), %st + fxch %st(4) + fmul %st, %st(5) + fxch %st(1) + faddl 8(%rax) + lea 112+_dbA(%rip), %rax + faddp %st, %st(4) + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 256(%rsp) + fldt 256(%rsp) + fldl (%rax) + fld %st(0) + fadd %st(3), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(2) + fldt 96(%rsp) + fmuls (%rbx,%rbp,4) + fxch %st(2) + faddl (%rdx) + faddp %st, %st(1) + fstpt 48(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + lea 240(%rsp), %rdi + fstpt (%rsp) + fldt (%rsp) + fldt .L_2il0floatpacket.0(%rip) + fstpt 16(%rsp) + fstpt -128(%rdi) +..___tag_value___libm_lgammal.273: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.274: +..B2.292: + fstp %st(0) + fldt 112(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.140: + fldt 16(%rsp) + lea 544+_ldbA(%rip), %rcx + fld %st(1) + lea 528+_ldbA(%rip), %rbx + lea 512+_ldbA(%rip), %rbp + lea 496+_ldbA(%rip), %rsi + fmul %st(1), %st + fld %st(2) + lea 480+_ldbA(%rip), %r8 + lea 464+_ldbA(%rip), %r9 + lea 448+_ldbA(%rip), %r10 + lea 432+_ldbA(%rip), %r11 + lea 416+_ldbA(%rip), %r15 + lea 304+_ldbA(%rip), %rax + lea 48+_dbA(%rip), %rdx + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(2) + fsub %st(1), %st + fxch %st(3) + fmul %st(0), %st + fldt (%rcx) + lea 400+_ldbA(%rip), %rcx + fmul %st(1), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r15) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 384+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 368+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 352+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 336+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + lea 320+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(1), %st + fld %st(3) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fld %st(2) + fmul %st(3), %st + fmul %st, %st(2) + fldt (%rax) + lea 64+_dbA(%rip), %rax + faddp %st, %st(2) + fldt .L_2il0floatpacket.2(%rip) + fmulp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fld %st(4) + fmul %st(2), %st + fxch %st(6) + fmul %st(0), %st + faddp %st, %st(1) + fld %st(3) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fld %st(2) + fadd %st(7), %st + fsubp %st, %st(7) + fmul %st(6), %st + fxch %st(3) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fxch %st(2) + fsub %st(6), %st + fmul %st, %st(2) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(2) + fmul %st(5), %st + faddp %st, %st(1) + fldl (%rax) + fld %st(0) + lea 72+_dbA(%rip), %rax + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(5) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(3) + fld %st(4) + fxch %st(2) + faddl (%rax) + lea 56+_dbA(%rip), %rax + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmul %st(2), %st + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fldl (%rdx) + fld %st(0) + lea ones(%rip), %rdx + fadd %st(2), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(1) + fsub %st(4), %st + fld %st(3) + fmul %st(5), %st + fxch %st(5) + fmul %st(6), %st + fxch %st(2) + faddl (%rax) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 64(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%rsp) + fldt 208(%rsp) + fld %st(0) + fchs + fldt (%rsp) + fld %st(0) + fadd %st(3), %st + fstpt 176(%rsp) + fldt 176(%rsp) + fld %st(1) + movb 185(%rsp), %al + fsub %st(1), %st + andb $-128, %al + fadd %st(4), %st + shrb $7, %al + fxch %st(1) + fsubr %st, %st(4) + fxch %st(2) + fadd %st, %st(4) + fcomip %st(3), %st + fxch %st(2) + fstp %st(0) + fldt 32(%rsp) + movzbl %al, %eax + fadd %st, %st(2) + fldt 224(%rsp) + fadd %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + faddp %st, %st(2) + fxch %st(2) + fcmovnbe %st(1), %st + fstp %st(1) + fld %st(1) + fadd %st(3), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fld %st(2) + fsub %st(1), %st + fadd %st(4), %st + fadd %st(2), %st + flds (%rdx,%rax,4) + fmul %st(4), %st + movb 169(%rsp), %al + andb $-128, %al + shrb $7, %al + fstpt 128(%rsp) + fldt 128(%rsp) + fldt 64(%rsp) + fadd %st, %st(2) + movzbl %al, %eax + flds (%rdx,%rax,4) + fmul %st(7), %st + fxch %st(2) + fcomip %st(2), %st + fxch %st(1) + fstpt 112(%rsp) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fcmovbe %st(1), %st + fstp %st(1) + fstpt 96(%rsp) + testl %r12d, %r12d + je ..B2.142 +..B2.141: + movl %r13d, %edi +..___tag_value___libm_lgammal.276: + call fesetround@PLT +..___tag_value___libm_lgammal.277: +..B2.142: + fldt 80(%rsp) + testb %r14b, %r14b + fldt 96(%rsp) + faddp %st, %st(1) + fchs + fstpt 176(%rsp) + je ..B2.144 +..B2.143: + fldt 112(%rsp) + fstpt 144(%rsp) +..B2.293: + fldcw 194(%rsp) +..B2.144: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.145: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.146: + addq $-32, %rsp + .cfi_def_cfa_offset 368 + movl $1, (%rbp) + lea 272(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_lgammal.299: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.300: +..B2.294: + fstp %st(0) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.147: + fldt 336(%rsp) + lea _TWO_32H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 560+_ldbA(%rip), %rdx + fldt 240(%rsp) + fldl (%rax) + lea 80+_dbA(%rip), %rax + fmul %st, %st(4) + fxch %st(3) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fstpt 32(%rsp) + fldt 32(%rsp) + fsubr %st, %st(1) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt .L_2il0floatpacket.6(%rip) + fmul %st(4), %st + fldt .L_2il0floatpacket.6(%rip) + fldt 256(%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt 80(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fsubrp %st, %st(6) + fxch %st(2) + fmul %st(5), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(5) + fadd %st(1), %st + fstpt (%rsp) + fldt (%rsp) + fsubp %st, %st(1) + fmul %st, %st(3) + fsubr %st, %st(5) + fxch %st(2) + faddp %st, %st(5) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(2) + fmulp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 80(%rsp) + faddp %st, %st(1) + fldt .L_2il0floatpacket.7(%rip) + fcomip %st(2), %st + jbe ..B2.149 +..B2.148: + lea 704+_ldbA(%rip), %rdx + lea 96+_dbA(%rip), %rax +..B2.149: + fldt 48(%rsp) + testl %r12d, %r12d + fstpt 48(%rsp) + fstpt 80(%rsp) + fldt 32(%rsp) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fldt 64(%rsp) + fld %st(0) + fldt .L_2il0floatpacket.1(%rip) + fdiv %st, %st(3) + fxch %st(1) + fmul %st(3), %st + fld %st(0) + fadd %st(4), %st + fsubp %st, %st(1) + fsubr %st, %st(3) + fld %st(3) + fadd %st(1), %st + fmul %st, %st(6) + fld %st(5) + fmul %st(5), %st + faddp %st, %st(7) + fxch %st(1) + fmul %st, %st(5) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fmul %st(0), %st + fldt 128(%rdx) + fmul %st(1), %st + fldt 112(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 80(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 64(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 32(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt 16(%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + lea 120+_dbA(%rip), %rdx + faddp %st, %st(1) + fmulp %st, %st(1) + fldl (%rax) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(1) + fsub %st(4), %st + fld %st(3) + fmul %st(5), %st + fstpt 240(%rsp) + fldt 240(%rsp) + fxch %st(3) + fmul %st, %st(5) + fxch %st(2) + faddl 8(%rax) + lea 112+_dbA(%rip), %rax + faddp %st, %st(1) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 256(%rsp) + fldt 256(%rsp) + fldl (%rax) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt 48(%rsp) + fxch %st(1) + faddl (%rdx) + faddp %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt 80(%rsp) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 48(%rsp) + je ..B2.152 +..B2.150: + movl %r13d, %edi + fstpt 176(%rsp) +..___tag_value___libm_lgammal.302: + call fesetround@PLT +..___tag_value___libm_lgammal.303: +..B2.151: + fldt 176(%rsp) +..B2.152: + fldt 48(%rsp) + testb %r14b, %r14b + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.154 +..B2.153: + fldt 32(%rsp) + fstpt 160(%rsp) + fldt (%rsp) + fstpt 144(%rsp) + fldt 16(%rsp) + fstpt 128(%rsp) +..B2.295: + fldcw 194(%rsp) +..B2.154: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.155: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.156: + addq $-32, %rsp + .cfi_def_cfa_offset 368 + movl $1, (%rbp) + lea 272(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_lgammal.325: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.326: +..B2.296: + fstp %st(0) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.157: + fldt 336(%rsp) + lea 16+_TWO5600(%rip), %rax + fldt 240(%rsp) + lea _TWO_32H(%rip), %rdx + fldt .L_2il0floatpacket.1(%rip) + testl %r12d, %r12d + fsubrp %st, %st(1) + fstpt 240(%rsp) + fldt 240(%rsp) + fldt (%rax) + fmulp %st, %st(2) + fld %st(1) + fxch %st(2) + fstpt 336(%rsp) + fldt 336(%rsp) + fldl (%rdx) + fld %st(0) + fmul %st(2), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fsubr %st(2), %st + fxch %st(1) + fmul %st(3), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fld %st(3) + fadd %st(1), %st + fld %st(0) + fsubp %st, %st(2) + fld %st(1) + fmul %st(6), %st + fstpt 64(%rsp) + fxch %st(1) + fsubr %st, %st(4) + fmulp %st, %st(2) + fxch %st(4) + fstpt 48(%rsp) + fldt 256(%rsp) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + je ..B2.159 +..B2.158: + movl %r13d, %edi + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_lgammal.328: + call fesetround@PLT +..___tag_value___libm_lgammal.329: +..B2.304: + fldt 16(%rsp) + fldt (%rsp) +..B2.159: + fldt 64(%rsp) + lea _TWO5600(%rip), %rax + testb %r14b, %r14b + faddp %st, %st(1) + fldt (%rax) + fmulp %st, %st(1) + fstpt 176(%rsp) + je ..B2.314 +..B2.160: + fldt 48(%rsp) + fstpt 160(%rsp) + fstpt 144(%rsp) + fldt 32(%rsp) + fstpt 128(%rsp) +..B2.297: + fldcw 194(%rsp) + jmp ..B2.161 +..B2.314: + fstp %st(0) +..B2.161: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.162: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.163: + fldt .L_2il0floatpacket.3(%rip) + fcomip %st(2), %st + jbe ..B2.165 +..B2.164: + movl $-1, (%rbp) + jmp ..B2.166 +..B2.165: + movl $1, (%rbp) +..B2.166: + movss %xmm0, (%rsp) + flds (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 368 + fmulp %st, %st(2) + lea 272(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fxch %st(1) + fstpt 16(%rsp) + fstpt 80(%rsp) +..___tag_value___libm_lgammal.351: + call __libm_logl_k80@PLT +..___tag_value___libm_lgammal.352: +..B2.298: + fstp %st(0) + fldt 80(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 336 +..B2.167: + cmpl $16313, %ebx + jge ..B2.174 +..B2.168: + fldt 240(%rsp) + testl %r12d, %r12d + fldt 256(%rsp) + faddp %st, %st(1) + fchs + fstpt 176(%rsp) + je ..B2.170 +..B2.169: + movl %r13d, %edi + fstpt 48(%rsp) +..___tag_value___libm_lgammal.354: + call fesetround@PLT +..___tag_value___libm_lgammal.355: +..B2.310: + fldt 48(%rsp) +..B2.170: + testb %r14b, %r14b + je ..B2.315 +..B2.171: + fstpt 80(%rsp) +..B2.299: + fldcw 194(%rsp) + jmp ..B2.172 +..B2.315: + fstp %st(0) +..B2.172: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.173: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.174: + lea 288+_ldbA(%rip), %rax + lea 272+_ldbA(%rip), %rdx + lea 256+_ldbA(%rip), %rcx + lea 240+_ldbA(%rip), %rbx + lea 224+_ldbA(%rip), %rbp + lea 208+_ldbA(%rip), %rsi + lea 192+_ldbA(%rip), %r8 + lea 176+_ldbA(%rip), %r9 + fldt (%rax) + lea 160+_ldbA(%rip), %r10 + fmul %st(1), %st + lea 144+_ldbA(%rip), %r11 + lea 128+_ldbA(%rip), %rax + testl %r15d, %r15d + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rdx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rcx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rbx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rbp) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rsi) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r8) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r9) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r10) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r11) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + lea 112+_ldbA(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + lea 96+_ldbA(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + lea 80+_ldbA(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + lea 64+_ldbA(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + lea 48+_ldbA(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + lea 32+_ldbA(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fld %st(0) + fldt (%rax) + lea 16+_ldbA(%rip), %rax + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt (%rax) + lea _ldbA(%rip), %rax + faddp %st, %st(3) + fmul %st, %st(2) + fld %st(0) + fldt (%rax) + lea _TWO_32H(%rip), %rax + faddp %st, %st(4) + fld %st(3) + fldl (%rax) + lea 32+_dbA(%rip), %rax + fld %st(0) + fmul %st(6), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st, %st(2) + fxch %st(2) + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(2) + fsub %st(4), %st + fld %st(5) + fsub %st(2), %st + fmul %st(5), %st + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fxch %st(1) + fmul %st(4), %st + fldl (%rax) + lea 40+_dbA(%rip), %rax + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(3) + fmul %st(2), %st + fxch %st(1) + faddl (%rax) + lea 16+_dbA(%rip), %rax + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fld %st(2) + fmul %st(6), %st + fxch %st(3) + fmul %st(7), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(1) + fldl (%rax) + fld %st(0) + lea 24+_dbA(%rip), %rax + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(3) + fmul %st(3), %st + fxch %st(1) + faddl (%rax) + lea _dbA(%rip), %rax + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fmul %st(6), %st + fxch %st(2) + fmul %st(7), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(1) + fldl (%rax) + fld %st(0) + lea 8+_dbA(%rip), %rax + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl (%rax) + faddp %st, %st(2) + fld %st(3) + fmul %st(3), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fmul %st(6), %st + fxch %st(2) + fmul %st(7), %st + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(6) + faddp %st, %st(5) + fldt 240(%rsp) + jl ..B2.220 +..B2.175: + fstp %st(2) + fstp %st(2) + fldt 256(%rsp) + fld %st(2) + testl %r12d, %r12d + fsub %st(2), %st + fadd %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fxch %st(2) + je ..B2.178 +..B2.176: + movl %r13d, %edi + fstpt 176(%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) +..___tag_value___libm_lgammal.376: + call fesetround@PLT +..___tag_value___libm_lgammal.377: +..B2.177: + fldt 32(%rsp) + fldt 16(%rsp) + fldt 176(%rsp) +..B2.178: + testb %r14b, %r14b + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.316 +..B2.179: + fldt 48(%rsp) + fstpt 144(%rsp) + fstpt 160(%rsp) + fldt 64(%rsp) + fstpt 128(%rsp) +..B2.300: + fldcw 194(%rsp) + jmp ..B2.180 +..B2.316: + fstp %st(0) +..B2.180: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 +..B2.181: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.182: + fstp %st(0) + call __stack_chk_fail@PLT +..B2.188: + fcomi %st(2), %st + ja ..B2.71 + jmp ..B2.73 +..B2.191: + fstp %st(0) + fstp %st(1) + fstp %st(0) + movl $1, (%rbp) + testl %r12d, %r12d + je ..B2.193 +..B2.192: + movl %r13d, %edi +..___tag_value___libm_lgammal.398: + call fesetround@PLT +..___tag_value___libm_lgammal.399: +..B2.193: + movss .L_2il0floatpacket.22(%rip), %xmm1 + testb %r14b, %r14b + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, (%rsp) + flds (%rsp) + fstpt 176(%rsp) + je ..B2.195 +..B2.194: + fldcw 194(%rsp) +..B2.195: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.200: + fstp %st(0) + fldt .L_2il0floatpacket.8(%rip) + lea 304+_dbA(%rip), %rsi + movl $-1, (%rbp) + lea 2672+_ldbA(%rip), %rdi + faddp %st, %st(1) + jmp ..B2.106 +..B2.202: + fxch %st(2) + fcomip %st(1), %st + jae ..B2.204 + jp ..B2.204 +..B2.203: + movl $-1, (%rbp) + jmp ..B2.122 +..B2.204: + movl $1, (%rbp) + jmp ..B2.122 +..B2.206: + fcomip %st(2), %st + jae ..B2.135 + jp ..B2.135 + jmp ..B2.134 +..B2.209: + fstp %st(3) + fstp %st(2) + fstp %st(0) + movl $1, (%rbp) + testl %r12d, %r12d + je ..B2.211 +..B2.210: + movl %r13d, %edi + fstpt (%rsp) +..___tag_value___libm_lgammal.400: + call fesetround@PLT +..___tag_value___libm_lgammal.401: +..B2.306: + fldt (%rsp) +..B2.211: + movss .L_2il0floatpacket.22(%rip), %xmm1 + testb %r14b, %r14b + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, (%rsp) + flds (%rsp) + fstpt 176(%rsp) + je ..B2.317 +..B2.212: + fstpt 96(%rsp) +..B2.301: + fldcw 194(%rsp) + jmp ..B2.213 +..B2.317: + fstp %st(0) +..B2.213: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.220: + lea 544+_ldbA(%rip), %rcx + lea 528+_ldbA(%rip), %rbx + fxch %st(5) + fstpt (%rsp) + fld %st(2) + lea 512+_ldbA(%rip), %rbp + lea 496+_ldbA(%rip), %rsi + lea 480+_ldbA(%rip), %r8 + lea 464+_ldbA(%rip), %r9 + lea 448+_ldbA(%rip), %r10 + lea 432+_ldbA(%rip), %r11 + lea 416+_ldbA(%rip), %r15 + lea 304+_ldbA(%rip), %rax + lea 48+_dbA(%rip), %rdx + testl %r12d, %r12d + fsub %st(4), %st + fxch %st(3) + fmul %st(0), %st + fxch %st(5) + fstpt 16(%rsp) + fxch %st(3) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt (%rcx) + lea 400+_ldbA(%rip), %rcx + fmul %st(5), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rbp) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r15) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + lea 384+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + lea 368+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + lea 352+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + lea 336+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + lea 320+_ldbA(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt (%rax) + lea 64+_dbA(%rip), %rax + faddp %st, %st(5) + fld %st(4) + fld %st(1) + fmul %st(2), %st + fldt .L_2il0floatpacket.2(%rip) + fmulp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fld %st(3) + fmul %st(3), %st + fxch %st(5) + fmul %st(0), %st + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubp %st, %st(5) + fld %st(4) + fxch %st(3) + fsub %st(5), %st + faddp %st, %st(1) + fld %st(3) + fmul %st(7), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fsubr %st, %st(6) + fmul %st(1), %st + fld %st(4) + fmul %st(7), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fldl (%rax) + fld %st(0) + lea 72+_dbA(%rip), %rax + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fxch %st(1) + faddl (%rax) + lea 56+_dbA(%rip), %rax + faddp %st, %st(2) + fld %st(3) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(3) + fmul %st(1), %st + fxch %st(1) + fmul %st(6), %st + fld %st(4) + fmul %st(3), %st + faddp %st, %st(1) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(2) + fldl (%rdx) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddl (%rax) + faddp %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fsub %st(2), %st + faddp %st, %st(1) + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fld %st(1) + fldt 16(%rsp) + fadd %st, %st(1) + fxch %st(1) + fchs + fadd %st, %st(1) + fxch %st(1) + fchs + fsubp %st, %st(3) + fldt 256(%rsp) + fsubrp %st, %st(3) + fldt (%rsp) + fsubrp %st, %st(3) + fld %st(0) + fsub %st(4), %st + fsub %st, %st(1) + fxch %st(1) + fchs + fsubp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fsubrp %st, %st(2) + fldt 32(%rsp) + fxch %st(2) + je ..B2.222 +..B2.221: + movl %r13d, %edi + fstpt (%rsp) + fstpt 16(%rsp) + fstpt 32(%rsp) +..___tag_value___libm_lgammal.402: + call fesetround@PLT +..___tag_value___libm_lgammal.403: +..B2.308: + fldt 32(%rsp) + fldt 16(%rsp) + fldt (%rsp) +..B2.222: + testb %r14b, %r14b + faddp %st, %st(1) + fstpt 176(%rsp) + je ..B2.318 +..B2.223: + fldt 48(%rsp) + fstpt 144(%rsp) + fstpt 160(%rsp) + fldt 64(%rsp) + fstpt 128(%rsp) +..B2.302: + fldcw 194(%rsp) + jmp ..B2.224 +..B2.318: + fstp %st(0) +..B2.224: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.227: + cmpl $16446, %ebx + jle ..B2.16 +..B2.228: + fstp %st(0) + fstp %st(0) + movl $1, (%rbp) + testl %r12d, %r12d + je ..B2.230 +..B2.229: + movl %r13d, %edi +..___tag_value___libm_lgammal.404: + call fesetround@PLT +..___tag_value___libm_lgammal.405: +..B2.230: + movss .L_2il0floatpacket.22(%rip), %xmm1 + testb %r14b, %r14b + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + movss %xmm1, (%rsp) + flds (%rsp) + fstpt 176(%rsp) + je ..B2.232 +..B2.231: + fldcw 194(%rsp) +..B2.232: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.235: + fstp %st(1) + movl $1, (%rbp) +..B2.236: + testl %r12d, %r12d + je ..B2.238 +..B2.237: + movl %r13d, %edi + fstp %st(0) +..___tag_value___libm_lgammal.406: + call fesetround@PLT +..___tag_value___libm_lgammal.407: +..B2.309: + fldt .L_2il0floatpacket.0(%rip) +..B2.238: + fstpt 176(%rsp) + testb %r14b, %r14b + je ..B2.240 +..B2.239: + fldcw 194(%rsp) +..B2.240: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.244: + fstp %st(0) + movl $1, (%rbp) + testl %r12d, %r12d + je ..B2.247 +..B2.245: + fstp %st(0) + movl %r13d, %edi +..___tag_value___libm_lgammal.408: + call fesetround@PLT +..___tag_value___libm_lgammal.409: +..B2.246: + fldt 336(%rsp) +..B2.247: + fld %st(0) + testb %r14b, %r14b + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 176(%rsp) + je ..B2.249 +..B2.248: + fldcw 194(%rsp) +..B2.249: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.252: + fstp %st(0) + fstp %st(0) + testl %r12d, %r12d + je ..B2.254 +..B2.253: + movl %r13d, %edi + movl $1, (%rbp) +..___tag_value___libm_lgammal.410: + call fesetround@PLT +..___tag_value___libm_lgammal.411: + movzbl 345(%rsp), %ecx +..B2.254: + movss .L_2il0floatpacket.22(%rip), %xmm1 + andl $128, %ecx + pxor %xmm0, %xmm0 + divss %xmm0, %xmm1 + shrl $7, %ecx + addl %ecx, %ecx + movss %xmm1, (%rsp) + negl %ecx + flds (%rsp) + incl %ecx + fstpt 176(%rsp) + testb %r14b, %r14b + movl %ecx, (%rbp) + je ..B2.256 +..B2.255: + fldcw 194(%rsp) +..B2.256: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.259: + movq $0x8000000000000000, %rax + cmpq 336(%rsp), %rax + je ..B2.270 +..B2.260: + movl $0, (%rbp) + testl %r12d, %r12d + je ..B2.262 +..B2.261: + movl %r13d, %edi +..___tag_value___libm_lgammal.412: + call fesetround@PLT +..___tag_value___libm_lgammal.413: +..B2.262: + fldt 336(%rsp) + fadd %st(0), %st + fstpt 176(%rsp) +..B2.263: + testl %r12d, %r12d + je ..B2.265 +..B2.264: + movl %r13d, %edi +..___tag_value___libm_lgammal.414: + call fesetround@PLT +..___tag_value___libm_lgammal.415: +..B2.265: + testb %r14b, %r14b + je ..B2.267 +..B2.266: + fldcw 194(%rsp) +..B2.267: + fldt 176(%rsp) + movq 272(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.182 + jmp ..B2.36 +..B2.270: + movl $1, (%rbp) + testl %r12d, %r12d + je ..B2.272 +..B2.271: + movl %r13d, %edi +..___tag_value___libm_lgammal.416: + call fesetround@PLT +..___tag_value___libm_lgammal.417: +..B2.272: + fldt 336(%rsp) + fmul %st(0), %st + fstpt 176(%rsp) + jmp ..B2.263 + .align 16,0x90 + .cfi_endproc + .type __libm_lgammal,@function + .size __libm_lgammal,.-__libm_lgammal + .data +# -- End __libm_lgammal + .text +# -- Begin __libm_p25 + .text + .align 16,0x90 +__libm_p25: +# parameter 1: 8 + %rsp +# parameter 2: %rdi +# parameter 3: %rsi +# parameter 4: %rdx +..B3.1: + .cfi_startproc +..___tag_value___libm_p25.419: +..L420: + + lea _TWO_32H(%rip), %rax + fldt 8(%rsp) + fld %st(0) + fld %st(1) + fldl 56(%rsi) + fmul %st(3), %st + fldl (%rax) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(3) + fsub %st(3), %st + fldt 64(%rdi) + fxch %st(2) + faddl 48(%rsi) + fmul %st(5), %st + fldt (%rdi) + fldt 80(%rdi) + fxch %st(2) + faddl 152(%rsi) + fmul %st(7), %st + faddl 144(%rsi) + fmul %st(7), %st + faddl 168(%rsi) + fmul %st(7), %st + faddl 160(%rsi) + fmul %st(7), %st + faddl 104(%rsi) + fmul %st(7), %st + faddl 96(%rsi) + fmul %st(7), %st + faddl 120(%rsi) + fmul %st(7), %st + faddl 112(%rsi) + fmul %st(7), %st + faddl 136(%rsi) + fmul %st(7), %st + faddl 128(%rsi) + fmul %st(7), %st + faddl 40(%rsi) + fmul %st(7), %st + faddl 32(%rsi) + fmul %st(7), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt 16(%rdi) + faddp %st, %st(1) + fmul %st(4), %st + fldt 32(%rdi) + fldt 96(%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(1) + fmul %st(4), %st + fldt 112(%rdi) + faddp %st, %st(1) + fmul %st(4), %st + fld %st(2) + fldt 48(%rdi) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + fmul %st(6), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fldl (%rsi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(4) + fmul %st(2), %st + fxch %st(1) + faddl 88(%rsi) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fmul %st(5), %st + fld %st(4) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 64(%rsi) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(4) + fmul %st(3), %st + fxch %st(1) + faddl 72(%rsi) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fld %st(4) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(1) + fldl 16(%rsi) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(4) + fmul %st, %st(5) + fsubr %st, %st(2) + fmulp %st, %st(3) + fxch %st(3) + faddl 24(%rsi) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fldl 80(%rsi) + fld %st(0) + fadd %st(2), %st + fstpt (%rdx) + fldt (%rdx) + fsubrp %st, %st(1) + faddp %st, %st(1) + faddl 8(%rsi) + faddp %st, %st(1) + fstpt 16(%rdx) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_p25,@function + .size __libm_p25,.-__libm_p25 + .data +# -- End __libm_p25 + .text +# -- Begin __libm_p19root + .text + .align 16,0x90 +__libm_p19root: +# parameter 1: 8 + %rsp +# parameter 2: %rdi +# parameter 3: %rsi +# parameter 4: %rdx +..B4.1: + .cfi_startproc +..___tag_value___libm_p19root.422: +..L423: + + lea _TWO_32H(%rip), %rax + fldt 8(%rsp) + lea ones(%rip), %r10 + fld %st(0) + fld %st(1) + fldl 152(%rsi) + fmul %st(3), %st + fldl (%rax) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(3) + fsub %st(3), %st + fldt 32(%rdi) + fxch %st(2) + faddl 144(%rsi) + fmul %st(5), %st + fldt 16(%rdi) + fldt (%rdi) + fxch %st(2) + faddl 136(%rsi) + fmul %st(7), %st + faddl 128(%rsi) + fmul %st(7), %st + faddl 120(%rsi) + fmul %st(7), %st + faddl 112(%rsi) + fmul %st(7), %st + faddl 104(%rsi) + fmul %st(7), %st + faddl 96(%rsi) + fmul %st(7), %st + faddl 88(%rsi) + fmul %st(7), %st + faddl 80(%rsi) + fmul %st(7), %st + faddl 72(%rsi) + fmul %st(7), %st + faddl 64(%rsi) + fmul %st(7), %st + faddl 56(%rsi) + fmul %st(7), %st + faddl 48(%rsi) + fmul %st(7), %st + faddp %st, %st(4) + fxch %st(3) + fmul %st(6), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fld %st(1) + fld %st(3) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + fmul %st(6), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldl 32(%rsi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(4) + fmul %st(2), %st + fxch %st(1) + faddl 40(%rsi) + faddp %st, %st(4) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fmul %st(5), %st + fld %st(4) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldl 16(%rsi) + fld %st(0) + fadd %st(3), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fsubp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fxch %st(2) + fsub %st(4), %st + fxch %st(4) + fmulp %st, %st(5) + faddl 24(%rsi) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt -40(%rsp) + fldt -40(%rsp) + fldl (%rsi) + fld %st(0) + fldl 8(%rsi) + movb -31(%rsp), %cl + fadd %st, %st(1) + fxch %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + andb $-128, %cl + movb -15(%rsp), %r9b + andb $-128, %r9b + shrb $7, %r9b + shrb $7, %cl + movzbl %r9b, %r11d + movzbl %cl, %r8d + flds (%r10,%r11,4) + fmulp %st, %st(1) + fld %st(2) + fadd %st(5), %st + fstpt (%rdx) + fldt (%rdx) + flds (%r10,%r8,4) + fmulp %st, %st(5) + fxch %st(4) + fcomi %st(1), %st + fxch %st(1) + fstp %st(0) + fld %st(3) + fsubr %st(5), %st + fadd %st(3), %st + fadd %st(6), %st + fadd %st(2), %st + fxch %st(1) + fstpt -40(%rsp) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fcmovnbe %st(1), %st + fstp %st(1) + fstpt 16(%rdx) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_p19root,@function + .size __libm_p19root,.-__libm_p19root + .data +# -- End __libm_p19root + .text +# -- Begin gammal + .text + .align 16,0x90 + .globl gammal +gammal: +# parameter 1: 16 + %rsp +..B5.1: + .cfi_startproc +..___tag_value_gammal.425: +..L426: + + pushq %rsi + .cfi_def_cfa_offset 16 + fldt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 32 + lea 16(%rsp), %rdi + fstpt (%rsp) +..___tag_value_gammal.429: + call __libm_lgammal +..___tag_value_gammal.430: +..B5.2: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type gammal,@function + .size gammal,.-gammal + .data +# -- End gammal + .text +# -- Begin lgammal_r + .text + .align 16,0x90 + .globl lgammal_r +lgammal_r: +# parameter 1: 8 + %rsp +# parameter 2: %rdi +..B6.1: + .cfi_startproc +..___tag_value_lgammal_r.433: +..L434: + + fldt 8(%rsp) + fstpt 8(%rsp) + jmp __libm_lgammal + .align 16,0x90 + .cfi_endproc + .type lgammal_r,@function + .size lgammal_r,.-lgammal_r + .data +# -- End lgammal_r + .text +# -- Begin gammal_r + .text + .align 16,0x90 + .globl gammal_r +gammal_r: +# parameter 1: 8 + %rsp +# parameter 2: %rdi +..B7.1: + .cfi_startproc +..___tag_value_gammal_r.436: +..L437: + + fldt 8(%rsp) + fstpt 8(%rsp) + jmp __libm_lgammal + .align 16,0x90 + .cfi_endproc + .type gammal_r,@function + .size gammal_r,.-gammal_r + .data +# -- End gammal_r + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x03,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc8,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,16 + .align 16 +.L_2il0floatpacket.12: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,16 + .align 16 +.L_2il0floatpacket.13: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 16 +.L_2il0floatpacket.14: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xa6,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 16 +.L_2il0floatpacket.15: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 16 +.L_2il0floatpacket.16: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,16 + .align 16 +.L_2il0floatpacket.17: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x81,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,16 + .align 16 +.L_2il0floatpacket.18: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,16 + .align 16 +.L_2il0floatpacket.19: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,16 + .align 16 +.L_2il0floatpacket.20: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,16 + .align 16 +.L_2il0floatpacket.21: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.21,@object + .size .L_2il0floatpacket.21,16 + .align 16 +_ldbA: + .word 48403 + .word 16065 + .word 37206 + .word 35465 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 32498 + .word 21186 + .word 57533 + .word 54364 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 48455 + .word 64043 + .word 25991 + .word 44448 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 36906 + .word 8596 + .word 53485 + .word 37761 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 16786 + .word 63789 + .word 39740 + .word 32901 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 43334 + .word 50722 + .word 13591 + .word 58371 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 51242 + .word 42271 + .word 52839 + .word 52480 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 22272 + .word 27707 + .word 58025 + .word 47684 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 48537 + .word 42093 + .word 143 + .word 43693 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 5437 + .word 23105 + .word 19142 + .word 40288 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 43105 + .word 25781 + .word 60600 + .word 37244 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 64996 + .word 46896 + .word 33038 + .word 34212 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 8055 + .word 35794 + .word 25027 + .word 61223 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 26586 + .word 4739 + .word 1082 + .word 51475 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 65450 + .word 65402 + .word 39793 + .word 38562 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 18875 + .word 24550 + .word 64026 + .word 48031 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 3811 + .word 11690 + .word 33485 + .word 45433 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 21488 + .word 64404 + .word 56511 + .word 56861 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 64157 + .word 44249 + .word 62935 + .word 34811 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 1503 + .word 1560 + .word 25992 + .word 44448 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 53495 + .word 49976 + .word 39767 + .word 32901 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 21693 + .word 55175 + .word 61890 + .word 52480 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 18005 + .word 14879 + .word 27421 + .word 43701 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 4785 + .word 48109 + .word 28463 + .word 37451 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 17404 + .word 30303 + .word 36440 + .word 32768 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 19413 + .word 44833 + .word 30216 + .word 58252 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 61231 + .word 61633 + .word 10791 + .word 52455 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 18500 + .word 21868 + .word 57423 + .word 47400 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 24302 + .word 39700 + .word 47161 + .word 45652 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 48514 + .word 20900 + .word 46081 + .word 58518 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 11885 + .word 12460 + .word 35625 + .word 41968 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41690 + .word 14982 + .word 21018 + .word 53469 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 2894 + .word 27339 + .word 226 + .word 41728 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 26025 + .word 18501 + .word 20978 + .word 46979 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 53900 + .word 55553 + .word 17653 + .word 38916 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 53261 + .word 3328 + .word 208 + .word 53261 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 39946 + .word 2496 + .word 49308 + .word 39945 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 6840 + .word 51193 + .word 61784 + .word 56488 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 58384 + .word 51683 + .word 34508 + .word 64341 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 53773 + .word 3360 + .word 8402 + .word 53773 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 48865 + .word 31388 + .word 13912 + .word 61972 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 65489 + .word 61491 + .word 45504 + .word 47092 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 53102 + .word 49401 + .word 14344 + .word 45627 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 2166 + .word 2831 + .word 24758 + .word 46603 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 9580 + .word 21681 + .word 206 + .word 53261 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 30177 + .word 46479 + .word 48966 + .word 39945 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 52333 + .word 51482 + .word 18491 + .word 56488 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 40942 + .word 14796 + .word 26057 + .word 64313 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 50177 + .word 16139 + .word 15070 + .word 53362 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 2931 + .word 59423 + .word 29748 + .word 57837 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 12931 + .word 12185 + .word 50840 + .word 32873 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 60991 + .word 64091 + .word 63067 + .word 49777 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 24747 + .word 1987 + .word 58544 + .word 40255 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 31726 + .word 62157 + .word 28132 + .word 51504 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 1560 + .word 52396 + .word 29634 + .word 33090 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 51301 + .word 34230 + .word 21183 + .word 41027 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 26476 + .word 19428 + .word 22828 + .word 49163 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 62911 + .word 28656 + .word 40943 + .word 57345 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 51702 + .word 17823 + .word 6657 + .word 32768 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 55405 + .word 47943 + .word 739 + .word 36864 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 47506 + .word 63803 + .word 73 + .word 40960 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 21270 + .word 47505 + .word 6 + .word 45056 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 51059 + .word 36726 + .word 0 + .word 49152 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 8970 + .word 2825 + .word 0 + .word 53248 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 52133 + .word 201 + .word 0 + .word 57344 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 29690 + .word 13 + .word 0 + .word 61440 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 27552 + .word 0 + .word 0 + .word 32768 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 1621 + .word 0 + .word 0 + .word 34816 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 90 + .word 0 + .word 0 + .word 36864 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 5 + .word 0 + .word 0 + .word 38912 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 1630 + .word 57032 + .word 2128 + .word 45018 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 10332 + .word 57727 + .word 35491 + .word 64803 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 59042 + .word 30551 + .word 48083 + .word 40890 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 27388 + .word 36768 + .word 38828 + .word 49140 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 32744 + .word 23607 + .word 24507 + .word 57342 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 30841 + .word 2766 + .word 52220 + .word 65535 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 33024 + .word 16990 + .word 64796 + .word 36863 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 64973 + .word 1725 + .word 65462 + .word 40959 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 40731 + .word 18030 + .word 65529 + .word 45055 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 14452 + .word 28809 + .word 65535 + .word 49151 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 56566 + .word 62710 + .word 65535 + .word 53247 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 13403 + .word 65334 + .word 65535 + .word 57343 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 35846 + .word 65522 + .word 65535 + .word 61439 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 10432 + .word 65535 + .word 65535 + .word 65535 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 63915 + .word 65535 + .word 65535 + .word 34815 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 65446 + .word 65535 + .word 65535 + .word 36863 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 65531 + .word 65535 + .word 65535 + .word 38911 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38912 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 47937 + .word 50671 + .word 32821 + .word 51896 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 8469 + .word 62640 + .word 24113 + .word 51168 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 23666 + .word 39283 + .word 12728 + .word 33144 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 1338 + .word 16824 + .word 25401 + .word 33044 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 38006 + .word 50858 + .word 35636 + .word 41038 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 6523 + .word 10616 + .word 46244 + .word 41017 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 30889 + .word 22666 + .word 15710 + .word 49165 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 22694 + .word 63464 + .word 47653 + .word 49161 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 7860 + .word 665 + .word 58690 + .word 57345 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 35199 + .word 5838 + .word 25732 + .word 57345 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 27551 + .word 53562 + .word 7766 + .word 32768 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 34954 + .word 15277 + .word 5706 + .word 32768 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 10026 + .word 1321 + .word 863 + .word 36864 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 38128 + .word 3645 + .word 634 + .word 36864 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 22656 + .word 19824 + .word 86 + .word 40960 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 3271 + .word 26602 + .word 63 + .word 40960 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 57583 + .word 55422 + .word 7 + .word 45056 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 8869 + .word 50081 + .word 5 + .word 45056 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 59569 + .word 42847 + .word 0 + .word 49152 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 6316 + .word 31480 + .word 0 + .word 49152 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 65078 + .word 3295 + .word 0 + .word 53248 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 35775 + .word 2421 + .word 0 + .word 53248 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 28054 + .word 235 + .word 0 + .word 57344 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 63410 + .word 172 + .word 0 + .word 57344 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 45561 + .word 15 + .word 0 + .word 61440 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 34811 + .word 11 + .word 0 + .word 61440 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 32144 + .word 0 + .word 0 + .word 32768 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 23616 + .word 0 + .word 0 + .word 32768 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 1891 + .word 0 + .word 0 + .word 34816 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 1389 + .word 0 + .word 0 + .word 34816 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 105 + .word 0 + .word 0 + .word 36864 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 77 + .word 0 + .word 0 + .word 36864 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 6 + .word 0 + .word 0 + .word 38912 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 5 + .word 0 + .word 0 + .word 38912 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 30094 + .word 17612 + .word 34825 + .word 45621 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 27787 + .word 64487 + .word 61865 + .word 44498 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 45180 + .word 62215 + .word 30788 + .word 64910 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 56909 + .word 5419 + .word 21954 + .word 64678 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 26983 + .word 61012 + .word 55414 + .word 40900 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 17042 + .word 26812 + .word 58543 + .word 40878 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 17649 + .word 49100 + .word 16895 + .word 49142 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 47753 + .word 6644 + .word 42105 + .word 49138 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 56665 + .word 15855 + .word 40064 + .word 57342 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 9214 + .word 11959 + .word 6291 + .word 57342 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 44995 + .word 64071 + .word 54163 + .word 65535 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 35553 + .word 53091 + .word 49943 + .word 65535 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 39205 + .word 16423 + .word 64904 + .word 36863 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 61074 + .word 52942 + .word 64669 + .word 36863 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 11000 + .word 54094 + .word 65472 + .word 40959 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 41911 + .word 24986 + .word 65449 + .word 40959 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 33350 + .word 16833 + .word 65530 + .word 45055 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 41532 + .word 8229 + .word 65528 + .word 45055 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 52046 + .word 34170 + .word 65535 + .word 49151 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 9080 + .word 22531 + .word 65535 + .word 49151 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 19128 + .word 63123 + .word 65535 + .word 53247 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 61194 + .word 62227 + .word 65535 + .word 53247 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 43497 + .word 65363 + .word 65535 + .word 57343 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 46501 + .word 65299 + .word 65535 + .word 57343 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 33483 + .word 65524 + .word 65535 + .word 61439 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 16207 + .word 65520 + .word 65535 + .word 61439 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 18477 + .word 65535 + .word 65535 + .word 65535 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 1013 + .word 65535 + .word 65535 + .word 65535 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 64152 + .word 65535 + .word 65535 + .word 34815 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 63638 + .word 65535 + .word 65535 + .word 34815 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 65459 + .word 65535 + .word 65535 + .word 36863 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 65431 + .word 65535 + .word 65535 + .word 36863 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 65532 + .word 65535 + .word 65535 + .word 38911 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 65531 + .word 65535 + .word 65535 + .word 38911 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 16368 + .word 23276 + .word 14028 + .word 45039 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 59281 + .word 7220 + .word 1358 + .word 44002 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 209 + .word 31529 + .word 17251 + .word 45971 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 22774 + .word 54591 + .word 46864 + .word 55119 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 36309 + .word 6992 + .word 45734 + .word 65508 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 57509 + .word 44567 + .word 44472 + .word 62561 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 24352 + .word 36914 + .word 35595 + .word 62910 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 36298 + .word 16311 + .word 10079 + .word 34683 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 8745 + .word 24487 + .word 32401 + .word 58540 + .word 16393 + .word 0 + .word 0 + .word 0 + .word 64710 + .word 25493 + .word 17440 + .word 41602 + .word 16391 + .word 0 + .word 0 + .word 0 + .word 9540 + .word 49275 + .word 24345 + .word 64260 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 32123 + .word 43450 + .word 42726 + .word 58824 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 56179 + .word 18517 + .word 55467 + .word 35137 + .word 49163 + .word 0 + .word 0 + .word 0 + .word 59411 + .word 7122 + .word 11027 + .word 48002 + .word 49160 + .word 0 + .word 0 + .word 0 + .word 11599 + .word 47165 + .word 19459 + .word 34091 + .word 49158 + .word 0 + .word 0 + .word 0 + .word 3871 + .word 11740 + .word 51838 + .word 51028 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 54329 + .word 49239 + .word 6514 + .word 47686 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 32133 + .word 56 + .word 14391 + .word 58371 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 29265 + .word 29887 + .word 53486 + .word 37761 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 40734 + .word 56364 + .word 61890 + .word 52480 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 62017 + .word 50151 + .word 39767 + .word 32901 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 62465 + .word 1557 + .word 25992 + .word 44448 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 46350 + .word 21258 + .word 57533 + .word 54364 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 28472 + .word 57318 + .word 11755 + .word 48239 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 64030 + .word 27012 + .word 42555 + .word 59902 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 15295 + .word 64624 + .word 11797 + .word 40022 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 40088 + .word 48672 + .word 55416 + .word 53395 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 32150 + .word 7351 + .word 22467 + .word 34203 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 32397 + .word 56161 + .word 46934 + .word 48494 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 35896 + .word 51119 + .word 32272 + .word 61954 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 64369 + .word 46577 + .word 49946 + .word 47894 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 13507 + .word 11243 + .word 36867 + .word 37912 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 13500 + .word 7397 + .word 345 + .word 51175 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 36308 + .word 1299 + .word 15549 + .word 37687 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 1494 + .word 43036 + .word 5286 + .word 33882 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 51612 + .word 44256 + .word 49203 + .word 47051 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 24103 + .word 45476 + .word 53751 + .word 61816 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 18204 + .word 4207 + .word 64680 + .word 43260 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 39634 + .word 35210 + .word 18170 + .word 34381 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 30073 + .word 2874 + .word 60159 + .word 61890 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 21923 + .word 37483 + .word 63587 + .word 45930 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 17610 + .word 34235 + .word 25953 + .word 38432 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 27391 + .word 45200 + .word 21903 + .word 41572 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 8472 + .word 18376 + .word 37439 + .word 36904 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 15138 + .word 28105 + .word 43771 + .word 52749 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 19597 + .word 13484 + .word 38971 + .word 41168 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 3303 + .word 60299 + .word 50447 + .word 38102 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 47075 + .word 52558 + .word 55475 + .word 37762 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 52173 + .word 35461 + .word 11437 + .word 59897 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 36076 + .word 14373 + .word 35326 + .word 54659 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 59562 + .word 13882 + .word 310 + .word 33073 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 21162 + .word 13390 + .word 51910 + .word 43836 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 25864 + .word 5553 + .word 52105 + .word 33196 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 50214 + .word 4354 + .word 50978 + .word 55906 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 22538 + .word 16515 + .word 54348 + .word 57115 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 25669 + .word 8964 + .word 45428 + .word 52429 + .word 16390 + .word 0 + .word 0 + .word 0 + .word 42066 + .word 12451 + .word 5346 + .word 32773 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 59247 + .word 49506 + .word 42126 + .word 43753 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 41212 + .word 16190 + .word 63627 + .word 33236 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 43030 + .word 44942 + .word 52710 + .word 59310 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 4241 + .word 60350 + .word 9519 + .word 55057 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 13201 + .word 63684 + .word 48400 + .word 58952 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 43405 + .word 43520 + .word 7800 + .word 38026 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 51109 + .word 32176 + .word 26595 + .word 37828 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 39193 + .word 38974 + .word 13074 + .word 53901 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 18403 + .word 21914 + .word 43743 + .word 52518 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 11905 + .word 16066 + .word 37206 + .word 35465 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 39192 + .word 38974 + .word 13074 + .word 53901 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 16822 + .word 16066 + .word 37206 + .word 35465 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 12453 + .word 1560 + .word 25992 + .word 44448 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 46918 + .word 49948 + .word 39767 + .word 32901 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 993 + .word 37711 + .word 1229 + .word 53967 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 22241 + .word 58002 + .word 54887 + .word 56142 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 8639 + .word 23392 + .word 41786 + .word 61781 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 824 + .word 14446 + .word 39837 + .word 35166 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 4398 + .word 47415 + .word 48788 + .word 40961 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 53320 + .word 18702 + .word 33902 + .word 48514 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 47965 + .word 49933 + .word 53838 + .word 58200 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 46987 + .word 9286 + .word 62309 + .word 35268 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 6461 + .word 640 + .word 17377 + .word 43104 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 30338 + .word 25067 + .word 12218 + .word 53050 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 3327 + .word 27408 + .word 8301 + .word 61564 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 59387 + .word 42287 + .word 60059 + .word 60716 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 13826 + .word 21215 + .word 7405 + .word 64741 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 26137 + .word 29234 + .word 53880 + .word 36165 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 10231 + .word 52926 + .word 36203 + .word 41655 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 23407 + .word 27273 + .word 49305 + .word 49005 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 11641 + .word 23288 + .word 44339 + .word 58553 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 25249 + .word 6483 + .word 6272 + .word 35397 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 42921 + .word 12425 + .word 13798 + .word 43198 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 50188 + .word 64017 + .word 41333 + .word 53119 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 25097 + .word 45200 + .word 21903 + .word 41572 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 10972 + .word 60304 + .word 50447 + .word 38102 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 15639 + .word 33828 + .word 25953 + .word 38432 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 37131 + .word 35786 + .word 38971 + .word 41168 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 11219 + .word 39714 + .word 63573 + .word 45930 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 59109 + .word 9738 + .word 44211 + .word 52749 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 51163 + .word 1079 + .word 49343 + .word 61890 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 19090 + .word 15031 + .word 12079 + .word 36906 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 6956 + .word 155 + .word 44549 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 54475 + .word 22231 + .word 8036 + .word 54711 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 43885 + .word 13882 + .word 310 + .word 33073 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 49382 + .word 16501 + .word 54348 + .word 57115 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 54884 + .word 14552 + .word 35326 + .word 54659 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 24455 + .word 7515 + .word 50978 + .word 55906 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 57687 + .word 611 + .word 11437 + .word 59897 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 26110 + .word 1729 + .word 52102 + .word 33196 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 49827 + .word 25553 + .word 55506 + .word 37762 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 45356 + .word 51283 + .word 52132 + .word 43836 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 37526 + .word 52421 + .word 6331 + .word 51720 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 23504 + .word 7355 + .word 4713 + .word 61833 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 28030 + .word 45200 + .word 21903 + .word 41572 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 64882 + .word 60298 + .word 50447 + .word 38102 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 36628 + .word 34230 + .word 25953 + .word 38432 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 2186 + .word 13495 + .word 38971 + .word 41168 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 42048 + .word 38474 + .word 63587 + .word 45930 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 44984 + .word 21655 + .word 43771 + .word 52749 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 10340 + .word 31180 + .word 60154 + .word 61890 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 29368 + .word 33685 + .word 37418 + .word 36904 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 632 + .word 28858 + .word 25336 + .word 44574 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 47657 + .word 7722 + .word 28520 + .word 54386 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 48861 + .word 21442 + .word 12332 + .word 46245 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 55836 + .word 1266 + .word 27621 + .word 35724 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 19864 + .word 22843 + .word 65282 + .word 47516 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 55755 + .word 27362 + .word 47250 + .word 57481 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 27703 + .word 47960 + .word 491 + .word 37689 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 41421 + .word 53711 + .word 6590 + .word 52435 + .word 16394 + .word 0 + .word 0 + .word 0 + .word 57789 + .word 21731 + .word 35033 + .word 43725 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 55298 + .word 55134 + .word 50960 + .word 52072 + .word 16399 + .word 0 + .word 0 + .word 0 + .word 30636 + .word 39282 + .word 62891 + .word 33072 + .word 16404 + .word 0 + .word 0 + .word 0 + .word 7959 + .word 64403 + .word 49841 + .word 37534 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 5854 + .word 54131 + .word 61334 + .word 53522 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 5803 + .word 45364 + .word 48027 + .word 40704 + .word 16415 + .word 0 + .word 0 + .word 0 + .word 1370 + .word 7138 + .word 7454 + .word 61224 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 57336 + .word 44117 + .word 55954 + .word 64739 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 54670 + .word 41483 + .word 43064 + .word 36510 + .word 16428 + .word 0 + .word 0 + .word 0 + .word 42312 + .word 7696 + .word 38319 + .word 40746 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 12302 + .word 62594 + .word 5410 + .word 37618 + .word 16430 + .word 0 + .word 0 + .word 0 + .word 9293 + .word 14879 + .word 6832 + .word 37045 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 2958 + .word 50542 + .word 15469 + .word 40704 + .word 16427 + .word 0 + .word 0 + .word 0 + .word 42649 + .word 12819 + .word 63050 + .word 37565 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 6063 + .word 43732 + .word 62723 + .word 36980 + .word 16457 + .word 0 + .word 0 + .word 0 + .word 22453 + .word 18298 + .word 44915 + .word 57947 + .word 16436 + .word 0 + .word 0 + .word 0 + .word 20554 + .word 96 + .word 8145 + .word 60162 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 27743 + .word 60960 + .word 41480 + .word 33312 + .word 16473 + .word 0 + .word 0 + .word 0 + .word 22238 + .word 6527 + .word 38867 + .word 56588 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 38516 + .word 42313 + .word 15095 + .word 36719 + .word 16468 + .word 0 + .word 0 + .word 0 + .word 36587 + .word 28039 + .word 41391 + .word 50829 + .word 16489 + .word 0 + .word 0 + .word 0 + .word 29867 + .word 13204 + .word 65176 + .word 36776 + .word 16457 + .word 0 + .word 0 + .word 0 + .word 31042 + .word 28858 + .word 52725 + .word 32812 + .word 16482 + .word 0 + .word 0 + .word 0 + .word 10384 + .word 4515 + .word 18607 + .word 62455 + .word 16506 + .word 0 + .word 0 + .word 0 + .word 9765 + .word 184 + .word 10999 + .word 62061 + .word 16467 + .word 0 + .word 0 + .word 0 + .word 31509 + .word 19231 + .word 45642 + .word 41528 + .word 16496 + .word 0 + .word 0 + .word 0 + .word 9807 + .word 42010 + .word 46528 + .word 59283 + .word 16524 + .word 0 + .word 0 + .word 0 + .word 34508 + .word 54054 + .word 11762 + .word 33288 + .word 16479 + .word 0 + .word 0 + .word 0 + .word 35651 + .word 17126 + .word 61083 + .word 36196 + .word 16511 + .word 0 + .word 0 + .word 0 + .word 61937 + .word 2245 + .word 55342 + .word 41983 + .word 16543 + .word 0 + .word 0 + .word 0 + .word 55800 + .word 52004 + .word 63053 + .word 44600 + .word 16490 + .word 0 + .word 0 + .word 0 + .word 1794 + .word 6965 + .word 62764 + .word 42435 + .word 16526 + .word 0 + .word 0 + .word 0 + .word 31259 + .word 48342 + .word 51287 + .word 43067 + .word 16562 + .word 0 + .word 0 + .word 0 + .word 51054 + .word 24828 + .word 3408 + .word 36750 + .word 16502 + .word 0 + .word 0 + .word 0 + .word 10851 + .word 65289 + .word 49628 + .word 32780 + .word 16542 + .word 0 + .word 0 + .word 0 + .word 55922 + .word 53580 + .word 2985 + .word 62379 + .word 16581 + .word 0 + .word 0 + .word 0 + .word 3514 + .word 59781 + .word 19773 + .word 36749 + .word 16514 + .word 0 + .word 0 + .word 0 + .word 6233 + .word 41678 + .word 56685 + .word 32779 + .word 16558 + .word 0 + .word 0 + .word 0 + .word 7397 + .word 40156 + .word 60492 + .word 62376 + .word 16601 + .word 0 + .word 0 + .word 0 + .word 64764 + .word 30182 + .word 28471 + .word 44055 + .word 16526 + .word 0 + .word 0 + .word 0 + .word 47394 + .word 43518 + .word 20307 + .word 41745 + .word 16574 + .word 0 + .word 0 + .word 0 + .word 48961 + .word 13130 + .word 26792 + .word 42193 + .word 16622 + .word 0 + .word 0 + .word 0 + .word 13149 + .word 49204 + .word 39329 + .word 62843 + .word 16538 + .word 0 + .word 0 + .word 0 + .word 63753 + .word 8765 + .word 38452 + .word 33516 + .word 16591 + .word 0 + .word 0 + .word 0 + .word 60000 + .word 22498 + .word 28021 + .word 38134 + .word 16643 + .word 0 + .word 0 + .word 0 + .word 10643 + .word 26389 + .word 15903 + .word 44739 + .word 16551 + .word 0 + .word 0 + .word 0 + .word 24943 + .word 57881 + .word 5976 + .word 53687 + .word 16607 + .word 0 + .word 0 + .word 0 + .word 62568 + .word 44908 + .word 48389 + .word 34359 + .word 16664 + .word 0 + .word 0 + .word 0 + .word 36352 + .word 25695 + .word 54808 + .word 41154 + .word 49155 + .word 0 + .word 0 + .word 0 + .word 53950 + .word 20364 + .word 22118 + .word 64130 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 29016 + .word 1013 + .word 8897 + .word 49860 + .word 49158 + .word 0 + .word 0 + .word 0 + .word 48790 + .word 22905 + .word 44266 + .word 59689 + .word 49162 + .word 0 + .word 0 + .word 0 + .word 10097 + .word 41173 + .word 5368 + .word 62588 + .word 16398 + .word 0 + .word 0 + .word 0 + .word 18460 + .word 26935 + .word 48131 + .word 34999 + .word 49171 + .word 0 + .word 0 + .word 0 + .word 39812 + .word 13033 + .word 49143 + .word 34463 + .word 49170 + .word 0 + .word 0 + .word 0 + .word 11756 + .word 24889 + .word 14253 + .word 47765 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 27397 + .word 56992 + .word 59569 + .word 35306 + .word 49183 + .word 0 + .word 0 + .word 0 + .word 1499 + .word 3328 + .word 1093 + .word 60276 + .word 49177 + .word 0 + .word 0 + .word 0 + .word 54443 + .word 57316 + .word 38982 + .word 63406 + .word 16418 + .word 0 + .word 0 + .word 0 + .word 46810 + .word 23189 + .word 13701 + .word 35573 + .word 49196 + .word 0 + .word 0 + .word 0 + .word 40551 + .word 19489 + .word 60782 + .word 40648 + .word 49186 + .word 0 + .word 0 + .word 0 + .word 16371 + .word 31130 + .word 60187 + .word 37497 + .word 16430 + .word 0 + .word 0 + .word 0 + .word 56271 + .word 55717 + .word 16120 + .word 36897 + .word 49210 + .word 0 + .word 0 + .word 0 + .word 11488 + .word 11046 + .word 17817 + .word 40691 + .word 49195 + .word 0 + .word 0 + .word 0 + .word 54617 + .word 39007 + .word 658 + .word 37550 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 32140 + .word 49295 + .word 21536 + .word 36961 + .word 49225 + .word 0 + .word 0 + .word 0 + .word 5702 + .word 58081 + .word 34597 + .word 57945 + .word 49204 + .word 0 + .word 0 + .word 0 + .word 48280 + .word 56894 + .word 9030 + .word 60159 + .word 16454 + .word 0 + .word 0 + .word 0 + .word 61535 + .word 4768 + .word 37086 + .word 33310 + .word 49241 + .word 0 + .word 0 + .word 0 + .word 53564 + .word 21787 + .word 24446 + .word 56588 + .word 49214 + .word 0 + .word 0 + .word 0 + .word 35771 + .word 11952 + .word 2619 + .word 36719 + .word 16468 + .word 0 + .word 0 + .word 0 + .word 47624 + .word 53808 + .word 19802 + .word 50829 + .word 49257 + .word 0 + .word 0 + .word 0 + .word 42706 + .word 15946 + .word 64291 + .word 36776 + .word 49225 + .word 0 + .word 0 + .word 0 + .word 8317 + .word 44716 + .word 51672 + .word 32812 + .word 16482 + .word 0 + .word 0 + .word 0 + .word 31251 + .word 20899 + .word 16102 + .word 62455 + .word 49274 + .word 0 + .word 0 + .word 0 + .word 2105 + .word 17517 + .word 10872 + .word 62061 + .word 49235 + .word 0 + .word 0 + .word 0 + .word 60728 + .word 14335 + .word 45529 + .word 41528 + .word 16496 + .word 0 + .word 0 + .word 0 + .word 1336 + .word 56903 + .word 46326 + .word 59283 + .word 49292 + .word 0 + .word 0 + .word 0 + .word 34501 + .word 54054 + .word 11762 + .word 33288 + .word 49247 + .word 0 + .word 0 + .word 0 + .word 35638 + .word 17126 + .word 61083 + .word 36196 + .word 16511 + .word 0 + .word 0 + .word 0 + .word 12489 + .word 2246 + .word 55342 + .word 41983 + .word 49311 + .word 0 + .word 0 + .word 0 + .word 55790 + .word 52004 + .word 63053 + .word 44600 + .word 49258 + .word 0 + .word 0 + .word 0 + .word 1778 + .word 6965 + .word 62764 + .word 42435 + .word 16526 + .word 0 + .word 0 + .word 0 + .word 47762 + .word 48342 + .word 51287 + .word 43067 + .word 49330 + .word 0 + .word 0 + .word 0 + .word 51047 + .word 24828 + .word 3408 + .word 36750 + .word 49270 + .word 0 + .word 0 + .word 0 + .word 10839 + .word 65289 + .word 49628 + .word 32780 + .word 16542 + .word 0 + .word 0 + .word 0 + .word 14289 + .word 53581 + .word 2985 + .word 62379 + .word 49349 + .word 0 + .word 0 + .word 0 + .word 3506 + .word 59781 + .word 19773 + .word 36749 + .word 49282 + .word 0 + .word 0 + .word 0 + .word 6220 + .word 41678 + .word 56685 + .word 32779 + .word 16558 + .word 0 + .word 0 + .word 0 + .word 31299 + .word 40156 + .word 60492 + .word 62376 + .word 49369 + .word 0 + .word 0 + .word 0 + .word 64754 + .word 30182 + .word 28471 + .word 44055 + .word 49294 + .word 0 + .word 0 + .word 0 + .word 47368 + .word 43518 + .word 20307 + .word 41745 + .word 16574 + .word 0 + .word 0 + .word 0 + .word 65114 + .word 13130 + .word 26792 + .word 42193 + .word 49390 + .word 0 + .word 0 + .word 0 + .word 13136 + .word 49204 + .word 39329 + .word 62843 + .word 49306 + .word 0 + .word 0 + .word 0 + .word 63757 + .word 8765 + .word 38452 + .word 33516 + .word 16591 + .word 0 + .word 0 + .word 0 + .word 9085 + .word 22499 + .word 28021 + .word 38134 + .word 49411 + .word 0 + .word 0 + .word 0 + .word 10631 + .word 26389 + .word 15903 + .word 44739 + .word 49319 + .word 0 + .word 0 + .word 0 + .word 24915 + .word 57881 + .word 5976 + .word 53687 + .word 16607 + .word 0 + .word 0 + .word 0 + .word 16910 + .word 44909 + .word 48389 + .word 34359 + .word 49432 + .word 0 + .word 0 + .word 0 + .type _ldbA,@object + .size _ldbA,6160 + .align 16 +_dbA: + .long 4235179544 + .long 3219290252 + .long 3295226828 + .long 3164508998 + .long 1649608659 + .long 1072320934 + .long 3173846476 + .long 1014071527 + .long 1542107862 + .long 3218711765 + .long 2540989727 + .long 3163202496 + .long 1649608660 + .long 3220853158 + .long 859914669 + .long 1017880115 + .long 717740104 + .long 3219214642 + .long 2376945980 + .long 3162254827 + .long 1431655765 + .long 1068848469 + .long 1431655765 + .long 1012225365 + .long 1431655765 + .long 1068848469 + .long 42583435 + .long 1011709190 + .long 3362045620 + .long 1072523249 + .long 4064281872 + .long 1016386130 + .long 4002465326 + .long 3220678216 + .long 1750589542 + .long 1014054706 + .long 2343010478 + .long 3220651595 + .long 2022209519 + .long 3165213628 + .long 3582788241 + .long 1077376220 + .long 3584976419 + .long 3225506388 + .long 2237448112 + .long 1085305363 + .long 634573353 + .long 3233318238 + .long 2248101888 + .long 1073427871 + .long 1861873466 + .long 1016835790 + .long 2560862412 + .long 1071060948 + .long 30404090 + .long 3163588833 + .long 1673151062 + .long 1081107801 + .long 641486499 + .long 3229145757 + .long 2847476088 + .long 1079825078 + .long 4109693297 + .long 3227890617 + .long 80699903 + .long 1078574114 + .long 2114691410 + .long 3226679074 + .long 1354791574 + .long 1083527322 + .long 1238563653 + .long 3231741049 + .long 2909836308 + .long 1082322123 + .long 2961745666 + .long 3230453807 + .long 4254370204 + .long 3222569838 + .long 2523116623 + .long 1016608103 + .long 3036354677 + .long 3220338375 + .long 4197032384 + .long 3163739097 + .long 618767413 + .long 1086658447 + .long 4224046954 + .long 3235503748 + .long 918515347 + .long 1104466354 + .long 1558545744 + .long 3253448772 + .long 3598672851 + .long 1075147148 + .long 1862579612 + .long 1019557195 + .long 814211565 + .long 1073042505 + .long 3816489657 + .long 3166119701 + .long 1438601496 + .long 1094947899 + .long 3932640262 + .long 3243813893 + .long 1025077628 + .long 1092155011 + .long 4084583552 + .long 3241103782 + .long 2491631644 + .long 1089473568 + .long 3212116569 + .long 3238261210 + .long 764386880 + .long 1100022671 + .long 1839771210 + .long 3248755462 + .long 3990369246 + .long 1097905463 + .long 1112302030 + .long 3246751353 + .long 717740104 + .long 1070682418 + .long 230143214 + .long 1014072542 + .long 1542107862 + .long 1071228117 + .long 2869986399 + .long 1017025354 + .long 2620920409 + .long 1068568872 + .long 3005931917 + .long 1068498895 + .long 3773030413 + .long 1068741081 + .long 221735135 + .long 1068648815 + .long 1649608659 + .long 1072320934 + .long 2259103138 + .long 1014410184 + .long 1798481678 + .long 1068036068 + .long 1435858614 + .long 1066348979 + .long 2798813559 + .long 1068114295 + .long 1711004053 + .long 1067747678 + .long 2010902109 + .long 1068166444 + .long 2474987820 + .long 1068059813 + .long 780818753 + .long 1068375890 + .long 4117616766 + .long 1068267614 + .long 1604677386 + .long 1068848813 + .long 1854392195 + .long 1067982657 + .long 4235179544 + .long 1071806604 + .long 2606438347 + .long 1015960145 + .long 2893907075 + .long 1066734370 + .long 2294698909 + .long 1014073149 + .long 441808390 + .long 3216064000 + .long 1880662273 + .long 1012321168 + .long 3253204732 + .long 3200326446 + .long 3649195207 + .long 1051723342 + .long 1676415034 + .long 3202599881 + .long 856428669 + .long 1053972858 + .long 3299217318 + .long 1070900044 + .long 4151699616 + .long 1010498715 + .long 1123572530 + .long 1044951237 + .long 3942090667 + .long 3191111442 + .long 179320158 + .long 3191607973 + .long 648955671 + .long 3189543958 + .long 338963396 + .long 3195730567 + .long 729244107 + .long 1047109933 + .long 491939632 + .long 3198035439 + .long 2441649049 + .long 1049392674 + .long 4000663347 + .long 1056276700 + .long 3497022620 + .long 3193423889 + .long 119575502 + .long 1071320806 + .long 3893526980 + .long 3160417465 + .long 2378611747 + .long 3217220647 + .long 3721041488 + .long 3160948136 + .long 212213087 + .long 1003805565 + .long 3707885569 + .long 946762142 + .long 954325311 + .long 1061996326 + .long 2572405945 + .long 3208784108 + .long 2047107390 + .long 1053958905 + .long 2157300588 + .long 3201555925 + .long 3371055275 + .long 1071576875 + .long 1069844800 + .long 1015429887 + .long 3166931521 + .long 3216972217 + .long 3220968514 + .long 3161728497 + .long 4141120019 + .long 1057975373 + .long 3048513049 + .long 3204734413 + .long 1172170140 + .long 1059250739 + .long 2600146741 + .long 3206041877 + .long 2751605624 + .long 1060573214 + .long 1663282963 + .long 3207426590 + .long 3895324829 + .long 1055298027 + .long 157415216 + .long 3202171477 + .long 3734613381 + .long 1056602430 + .long 277770430 + .long 3203481600 + .long 3198889327 + .long 3217706325 + .long 2705408501 + .long 1014676637 + .long 59787751 + .long 1073579891 + .long 1470716836 + .long 1013369721 + .long 2045320829 + .long 1061536716 + .long 93552279 + .long 3208285776 + .long 1578930691 + .long 1053381091 + .long 2541023 + .long 3199217833 + .long 2303467340 + .long 1072252569 + .long 567354353 + .long 1016170573 + .long 4277811695 + .long 1072049730 + .long 3950020367 + .long 3160819724 + .long 2523318625 + .long 1057215902 + .long 2302510246 + .long 3203993877 + .long 298082853 + .long 1058616118 + .long 2097322096 + .long 3205466603 + .long 1798601470 + .long 1060132265 + .long 1407285416 + .long 3206822737 + .long 4077669298 + .long 1054450862 + .long 2333929458 + .long 3201533971 + .long 2747507284 + .long 1055881541 + .long 2839080721 + .long 3202576178 + .long 3383958356 + .long 3218498155 + .long 613656875 + .long 1017795528 + .long 173059452 + .long 1075530818 + .long 704088483 + .long 1015836313 + .long 669591746 + .long 1061765380 + .long 2029568326 + .long 3208524070 + .long 4157429832 + .long 1054150757 + .long 704852271 + .long 3201323640 + .long 846452204 + .long 1073165719 + .long 1707052239 + .long 1015225852 + .long 1011120585 + .long 1074996836 + .long 2354399398 + .long 3161432137 + .long 954697072 + .long 1057288366 + .long 1270411324 + .long 3204047380 + .long 711769130 + .long 1058758297 + .long 1128721 + .long 3205559284 + .long 179011054 + .long 1060257504 + .long 4204770871 + .long 3206955261 + .long 3137275514 + .long 1053955134 + .long 762311517 + .long 3199983289 + .long 728345252 + .long 1056011172 + .long 1369631397 + .long 3202845593 + .long 3569027386 + .long 3214047105 + .long 3629871173 + .long 3159432582 + .long 2480864277 + .long 1072801415 + .long 765976303 + .long 1016615598 + .long 759560957 + .long 1082479958 + .long 4267700141 + .long 3214355674 + .long 519344805 + .long 3246817843 + .long 220815467 + .long 3246677566 + .long 585197945 + .long 1074992152 + .long 3068616556 + .long 1020233496 + .long 4125953813 + .long 3215772665 + .long 1932096513 + .long 3151829739 + .long 891522464 + .long 1087323966 + .long 2489260670 + .long 3237524288 + .long 198576582 + .long 1086294508 + .long 1118764770 + .long 3231025522 + .long 4028480604 + .long 1084377135 + .long 1979567970 + .long 3223360994 + .long 4063308394 + .long 3244561236 + .long 4166146281 + .long 3246077527 + .long 2664161993 + .long 3240072782 + .long 259025260 + .long 3242645417 + .long 378360574 + .long 1070238620 + .long 2959696752 + .long 1069921292 + .long 573154909 + .long 1069707436 + .long 4044344316 + .long 1069551882 + .long 477218588 + .long 1069314503 + .long 0 + .long 3217031168 + .long 2454267026 + .long 1069697316 + .long 1431655765 + .long 3217380693 + .long 2576980378 + .long 1070176665 + .long 0 + .long 3218079744 + .long 1431655765 + .long 1070945621 + .long 0 + .long 3219128320 + .long 2759451285 + .long 3216787420 + .long 439852373 + .long 3160440428 + .long 925239789 + .long 1070204188 + .long 1052235825 + .long 1014694615 + .long 2825585883 + .long 3219218351 + .long 1250510261 + .long 3158266606 + .long 4280873151 + .long 1070880196 + .long 3382653115 + .long 1014364358 + .long 3432120556 + .long 1060112640 + .long 1689864936 + .long 3206804514 + .long 2559966835 + .long 1058598642 + .long 1675881979 + .long 3205446725 + .long 3157807190 + .long 1057195995 + .long 83437824 + .long 3203930944 + .long 714759041 + .long 1055696489 + .long 94115283 + .long 3202310560 + .long 231342353 + .long 1053665780 + .long 2283895727 + .long 3199602663 + .long 2514471110 + .long 1050042839 + .long 1783553765 + .long 3194406773 + .long 2977985131 + .long 3217141333 + .long 1199854581 + .long 3162366396 + .long 2962538897 + .long 3216960405 + .long 4143040985 + .long 3159573871 + .long 1505583242 + .long 1067626192 + .long 1685935487 + .long 1007379916 + .long 1307717362 + .long 1071507942 + .long 2592844004 + .long 1015649171 + .long 799685378 + .long 1060113448 + .long 3181808512 + .long 3206805166 + .long 237118685 + .long 1058600582 + .long 1021521704 + .long 3205452843 + .long 562863096 + .long 1057199158 + .long 124222188 + .long 3203968611 + .long 666083857 + .long 1055962453 + .long 2573104645 + .long 3202709164 + .long 3241565485 + .long 1053885149 + .long 1335355988 + .long 3200533016 + .long 1040080838 + .long 1054134824 + .long 2847172487 + .long 3201012249 + .long 3198889327 + .long 3217706325 + .long 1543330549 + .long 3160864782 + .long 4277811695 + .long 1072049730 + .long 993295933 + .long 1014676638 + .long 59787751 + .long 1073579891 + .long 130295530 + .long 1013369744 + .long 2303467340 + .long 1072252569 + .long 3943765603 + .long 1016170278 + .long 3608922566 + .long 1060045649 + .long 1453569939 + .long 3207287740 + .long 3338057825 + .long 3206066477 + .long 3038862383 + .long 3208900206 + .long 2094875998 + .long 3209983096 + .long 1016858122 + .long 3211012944 + .long 2854570659 + .long 3211659217 + .long 1144696552 + .long 3211904901 + .long 2176258130 + .long 3211749311 + .long 3478125247 + .long 3210994876 + .long 2355567962 + .long 3209692799 + .long 3598755244 + .long 3207186288 + .long 3383958356 + .long 3218498155 + .long 141035778 + .long 3162876606 + .long 1011120585 + .long 1074996836 + .long 1865540452 + .long 1017795522 + .long 173059452 + .long 1075530818 + .long 1582816653 + .long 1015838421 + .long 846452204 + .long 1073165719 + .long 2382960778 + .long 1015259319 + .long 3627221817 + .long 1060257525 + .long 782594551 + .long 3206955283 + .long 1981242537 + .long 1058758037 + .long 1755079229 + .long 3205559658 + .long 2436997517 + .long 1057278666 + .long 3384076381 + .long 3204067450 + .long 2476719666 + .long 1056224805 + .long 337705071 + .long 3201230508 + .long 776493412 + .long 3197801902 + .long 2139883963 + .long 3204685556 + .long 1475852201 + .long 3204789337 + .long 945638604 + .long 3203947238 + .long 3198889327 + .long 3217706325 + .long 4282828456 + .long 3160832800 + .long 4277811695 + .long 1072049730 + .long 993624082 + .long 1014676638 + .long 59787751 + .long 1073579891 + .long 1881378167 + .long 1013369744 + .long 2303467340 + .long 1072252569 + .long 2285482445 + .long 1016170301 + .long 2583886559 + .long 1060132251 + .long 2972085422 + .long 3206822622 + .long 1867851267 + .long 1058615355 + .long 680445507 + .long 3205461644 + .long 1455562209 + .long 1057201491 + .long 2171135678 + .long 3203931082 + .long 973516116 + .long 1055683749 + .long 442346719 + .long 3202274605 + .long 3339219778 + .long 1053603010 + .long 4261370927 + .long 3199529466 + .long 1389725956 + .long 1049937931 + .long 3421055527 + .long 3194266408 + .long 3440444171 + .long 3149749917 + .long 2683862484 + .long 3093774621 + .long 1722766174 + .long 1073233897 + .long 1535800986 + .long 1017782563 + .long 2952983900 + .long 1075015403 + .long 1613333390 + .long 1019450778 + .long 1747624399 + .long 1077465903 + .long 1323746741 + .long 1077414384 + .long 2170768622 + .long 1079283370 + .long 3681271869 + .long 1079585146 + .long 2395326938 + .long 1081247483 + .long 1534348539 + .long 1081774816 + .long 339892429 + .long 1083288020 + .long 3528406654 + .long 1083985153 + .long 2588043907 + .long 1085376283 + .long 2346296707 + .long 1086214596 + .long 207705063 + .long 1087509517 + .long 2560418979 + .long 1088486188 + .long 2868926017 + .long 1088759609 + .long 1843351610 + .long 1091968574 + .long 2991121454 + .long 1008150290 + .long 2149211495 + .long 952864023 + .long 1596959828 + .long 1075781798 + .long 2172289614 + .long 1019977377 + .long 2540785903 + .long 1077531858 + .long 1236674410 + .long 1020936929 + .long 4153228343 + .long 1087542211 + .long 2696338690 + .long 1090238842 + .long 878599865 + .long 1092951715 + .long 1553131440 + .long 1095784438 + .long 1380037893 + .long 1098488966 + .long 2667481451 + .long 1101284640 + .long 2282526011 + .long 1104162081 + .long 2355356013 + .long 1106903006 + .long 2198000318 + .long 1109722332 + .long 415847444 + .long 1112609215 + .long 1244368631 + .long 1115409383 + .long 1504872183 + .long 1118250351 + .long 1483597343 + .long 1121215185 + .long 2372686104 + .long 1123791138 + .long 2950620603 + .long 1012416763 + .long 1854687498 + .long 952811571 + .long 4103214658 + .long 1077594716 + .long 2773032534 + .long 1020189917 + .long 3447799694 + .long 1081361429 + .long 400789830 + .long 1023147708 + .long 3214535591 + .long 1099259453 + .long 1237622722 + .long 1103959294 + .long 3800166525 + .long 1108620252 + .long 3349752687 + .long 1113359257 + .long 1736707866 + .long 1118068670 + .long 1604218008 + .long 1122855127 + .long 472376766 + .long 1127573289 + .long 2849635624 + .long 1132420823 + .long 1552594705 + .long 1137123494 + .long 3251899291 + .long 1141973158 + .long 523050174 + .long 1146711894 + .long 2820496385 + .long 1151553661 + .long 507113183 + .long 1156515491 + .long 3382661695 + .long 1160984436 + .long 1797993220 + .long 1014085677 + .long 1007534641 + .long 957814894 + .long 136949250 + .long 1079957294 + .long 360284395 + .long 1016466469 + .long 784478107 + .long 1086123203 + .long 2737766812 + .long 1029538613 + .long 1541190179 + .long 1113554317 + .long 209153222 + .long 1120512208 + .long 2353533988 + .long 1127569405 + .long 445988592 + .long 1134692642 + .long 3579939511 + .long 1141824664 + .long 1580626808 + .long 1148890066 + .long 214151816 + .long 1156005346 + .long 2068712408 + .long 1163158821 + .long 839406419 + .long 1170342165 + .long 3247543387 + .long 1177546316 + .long 4025420415 + .long 1184654254 + .long 956971024 + .long 1191825477 + .long 2268897124 + .long 1199100768 + .long 3197790250 + .long 1206020453 + .long 2712668744 + .long 1014362371 + .long 420246125 + .long 958137372 + .long 2654663338 + .long 1082564068 + .long 4161996347 + .long 1025251297 + .long 1213005072 + .long 1091554851 + .long 789699257 + .long 1035400076 + .long 800710857 + .long 1129640478 + .long 2496483081 + .long 1139363849 + .long 599798751 + .long 1149188652 + .long 1701185240 + .long 1158910290 + .long 2369516264 + .long 1168692319 + .long 283492325 + .long 1178587937 + .long 3183141054 + .long 1188335795 + .long 3641040163 + .long 1198179274 + .long 561697907 + .long 1208059224 + .long 1909654917 + .long 1217858291 + .long 2831089635 + .long 1227776627 + .long 2923368563 + .long 1237613769 + .long 3277782853 + .long 1247623400 + .long 2305379544 + .long 1257247294 + .long 2173558120 + .long 3167899773 + .long 3928519072 + .long 3112134976 + .long 2855828427 + .long 1085518855 + .long 2402042833 + .long 1029906467 + .long 3668949703 + .long 1097350789 + .long 1498999354 + .long 1041534216 + .long 1894732623 + .long 1147309596 + .long 3157447236 + .long 1159959522 + .long 1106557451 + .long 1172641345 + .long 2830063624 + .long 1185354419 + .long 1827524850 + .long 1198100435 + .long 3148494391 + .long 1210882790 + .long 408406249 + .long 1223697282 + .long 1409028207 + .long 1236424336 + .long 3586220107 + .long 1249179206 + .long 1522157876 + .long 1261965775 + .long 1820647987 + .long 1274787293 + .long 141517691 + .long 1287671841 + .long 1169226569 + .long 1300517027 + .long 1216765362 + .long 1313047128 + .long 1448028998 + .long 1021264728 + .long 3859033985 + .long 964258238 + .long 4275468065 + .long 1088663688 + .long 2839015045 + .long 1031960699 + .long 2471825140 + .long 1103641144 + .long 2116308392 + .long 1045704405 + .long 320063693 + .long 1166181438 + .long 1786259137 + .long 1181976509 + .long 2022503488 + .long 1197803342 + .long 3654410397 + .long 1213661261 + .long 3612544687 + .long 1229551918 + .long 2586390227 + .long 1245478664 + .long 4037720966 + .long 1261441627 + .long 425603198 + .long 1277313397 + .long 2335359117 + .long 1293212748 + .long 663099774 + .long 1309143515 + .long 3275152075 + .long 1325108897 + .long 3939307299 + .long 1341142935 + .long 2389223216 + .long 1357131850 + .long 3001851795 + .long 1372807567 + .long 2843660044 + .long 1027797837 + .long 4081430736 + .long 972886614 + .long 59873159 + .long 1091970578 + .long 89491691 + .long 1036070212 + .long 800587417 + .long 1110354163 + .long 1316695415 + .long 1054362062 + .long 1053415956 + .long 1186120592 + .long 1951112295 + .long 1205224339 + .long 3452306653 + .long 1224406940 + .long 3087408826 + .long 1243649885 + .long 3141065505 + .long 1262791580 + .long 1611223017 + .long 1282016047 + .long 2457220276 + .long 1301315843 + .long 567478369 + .long 1320490698 + .long 744018712 + .long 1339759601 + .long 3767838035 + .long 1359052970 + .long 2731826519 + .long 1378265330 + .long 2965944329 + .long 1397620918 + .long 3792836018 + .long 1416954415 + .long 4140163483 + .long 1435938859 + .long 3803251356 + .long 1031449026 + .long 1468351707 + .long 974519095 + .long 1510773204 + .long 1095479170 + .long 3459876679 + .long 1039900066 + .long 2329980675 + .long 1117254636 + .long 1442547585 + .long 1060380811 + .long 3793321184 + .long 1207035105 + .long 3851928555 + .long 1229621800 + .long 221632261 + .long 1252267869 + .long 2942953492 + .long 1274996464 + .long 3017520070 + .long 1297616871 + .long 239470767 + .long 1320348902 + .long 1043025700 + .long 1343095998 + .long 252688637 + .long 1365768517 + .long 3880214591 + .long 1388528317 + .long 3579258508 + .long 1411323545 + .long 4034496078 + .long 1434003397 + .long 4007330572 + .long 1456787727 + .long 4167750282 + .long 1479686237 + .long 1263363363 + .long 1502124177 + .long 1204128515 + .long 3180787222 + .long 711751003 + .long 3124411148 + .long 655669005 + .long 1099106472 + .long 1779452985 + .long 1041271036 + .long 3714137145 + .long 1124508819 + .long 3422050113 + .long 1068643358 + .long 2129754319 + .long 1228815190 + .long 1696310114 + .long 1255068559 + .long 1933048134 + .long 1281362741 + .long 1387613391 + .long 1307637530 + .long 3120180336 + .long 1333930483 + .long 2543548174 + .long 1360241860 + .long 1743952085 + .long 1386572739 + .long 830746048 + .long 1412924879 + .long 3823372438 + .long 1439300663 + .long 3126160514 + .long 1465701841 + .long 3650788872 + .long 1492126330 + .long 1753940109 + .long 1518485640 + .long 4158688957 + .long 1544943454 + .long 2419002512 + .long 1571054314 + .long 1387068573 + .long 1036196119 + .long 693317055 + .long 975620966 + .long 85037501 + .long 1102875900 + .long 2766547698 + .long 1047046221 + .long 692715848 + .long 1132034342 + .long 4084350207 + .long 1074738271 + .long 3670967869 + .long 1251313085 + .long 877136010 + .long 1281389973 + .long 2367669872 + .long 1311355635 + .long 127681551 + .long 1341415835 + .long 294488793 + .long 1371561390 + .long 2268228308 + .long 1401588863 + .long 1971903155 + .long 1431680659 + .long 3068569563 + .long 1461838328 + .long 2810042085 + .long 1491968471 + .long 1803405805 + .long 1522051425 + .long 2718559511 + .long 1552192554 + .long 1282364655 + .long 1582403523 + .long 2077022624 + .long 1612690417 + .long 3574791831 + .long 1642467624 + .long 1679930357 + .long 3189181796 + .long 2680901783 + .long 3131938295 + .long 3217922759 + .long 1106719372 + .long 512421297 + .long 1047804811 + .long 767402551 + .long 1139855610 + .long 1780644693 + .long 1084244525 + .long 2568107092 + .long 1274594461 + .long 3742446639 + .long 1308542877 + .long 2828203709 + .long 1342408213 + .long 1035153137 + .long 1376332101 + .long 135830143 + .long 1410361976 + .long 3493601403 + .long 1444258562 + .long 2859691870 + .long 1478279541 + .long 289914903 + .long 1512259079 + .long 388251426 + .long 1546250265 + .long 3047966471 + .long 1580303536 + .long 3861742472 + .long 1614266653 + .long 1260166508 + .long 1648392316 + .long 904399223 + .long 1682450578 + .long 3334685854 + .long 1716212562 + .long 883499133 + .long 1045834798 + .long 1040153219 + .long 987496666 + .long 789418155 + .long 1110723643 + .long 2045920566 + .long 1052287721 + .long 682953991 + .long 1147781119 + .long 96584340 + .long 1092099645 + .long 666163210 + .long 1298545479 + .long 1527740296 + .long 1336421526 + .long 43027861 + .long 1374344588 + .long 1893757912 + .long 1412317817 + .long 3310921752 + .long 1450264132 + .long 1086815150 + .long 1488186400 + .long 2822587825 + .long 1526147814 + .long 1629445394 + .long 1564156239 + .long 2622810410 + .long 1602221540 + .long 2876661682 + .long 1640163607 + .long 151499969 + .long 1678143447 + .long 3591180187 + .long 1716205976 + .long 126024331 + .long 1754364017 + .long 3251093187 + .long 1792100966 + .long 2455853998 + .long 3194846833 + .long 2105329433 + .long 3137419111 + .long 1677091468 + .long 1114834807 + .long 3103559369 + .long 1057563919 + .long 156965555 + .long 1155965375 + .long 1332523955 + .long 1098438055 + .long 2734085455 + .long 1323184128 + .long 3116950081 + .long 1365165587 + .long 2683234966 + .long 1407189808 + .long 2373753488 + .long 1449192848 + .long 1367022160 + .long 1491213979 + .long 3828829922 + .long 1533253445 + .long 649201501 + .long 1575312310 + .long 1349232455 + .long 1617392311 + .long 2871919995 + .long 1659495809 + .long 3481654166 + .long 1701624529 + .long 3617101938 + .long 1743779051 + .long 431481593 + .long 1785867563 + .long 121308995 + .long 1828052659 + .long 357611834 + .long 1869892289 + .long 294133886 + .long 3202139689 + .long 3712546231 + .long 3146198591 + .long 3880935161 + .long 1119029102 + .long 59549724 + .long 1063684005 + .long 3647913141 + .long 1164353962 + .long 4227156178 + .long 1109331949 + .long 3682674216 + .long 1348349871 + .long 2807072537 + .long 1394525619 + .long 2124002856 + .long 1440744183 + .long 2605559380 + .long 1486941516 + .long 2185296140 + .long 1533156938 + .long 3364132884 + .long 1579390693 + .long 3636842097 + .long 1625643843 + .long 1564856349 + .long 1671918127 + .long 282911834 + .long 1718215904 + .long 224295158 + .long 1764538898 + .long 1397797422 + .long 1810887684 + .long 130160665 + .long 1857170584 + .long 3494254532 + .long 1903549984 + .long 2087544159 + .long 1949584056 + .long 2070009724 + .long 3207114478 + .long 3313155961 + .long 3151739743 + .long 1799064076 + .long 1123301109 + .long 3318052585 + .long 1067728611 + .long 1398608221 + .long 1172933154 + .long 3195587656 + .long 1117275768 + .long 3966862011 + .long 1374007527 + .long 3094801078 + .long 1424457063 + .long 201966774 + .long 1474951107 + .long 1216746698 + .long 1525492144 + .long 4169038329 + .long 1576047750 + .long 2574869838 + .long 1626540825 + .long 3353136223 + .long 1677069826 + .long 246421124 + .long 1727641760 + .long 3497001028 + .long 1778265406 + .long 1014877316 + .long 1828833334 + .long 2620327651 + .long 1879376562 + .long 1343179361 + .long 1929994932 + .long 3499694378 + .long 1980775534 + .long 852481763 + .long 2031094897 + .long 858300611 + .long 1060903333 + .long 1069421656 + .long 1004554972 + .long 381774873 + .long 1127661932 + .long 2890562600 + .long 1072008419 + .long 3230239600 + .long 1181757061 + .long 1093463150 + .long 1126994478 + .long 2041459920 + .long 1400246667 + .long 1834149192 + .long 1455089424 + .long 3431867819 + .long 1509997896 + .long 673297555 + .long 1564813682 + .long 2939272129 + .long 1619727956 + .long 2561583193 + .long 1674674892 + .long 1592460776 + .long 1729549373 + .long 4229377564 + .long 1784543364 + .long 3147274091 + .long 1839450750 + .long 199676655 + .long 1894400365 + .long 515597810 + .long 1949398723 + .long 2826001657 + .long 2004337665 + .long 1832191040 + .long 2059473164 + .long 486033509 + .long 2114113687 + .long 2615285763 + .long 3215685247 + .long 3139164341 + .long 3160067829 + .long 2576980377 + .long 1132042649 + .long 2136544456 + .long 1076438044 + .long 1202590842 + .long 1190427361 + .long 3058408830 + .long 1135356281 + .long 2163381214 + .long 1426480799 + .long 2353327718 + .long 1485745575 + .long 3794661129 + .long 1544911246 + .long 3594844771 + .long 1604225727 + .long 3801864141 + .long 1663434111 + .long 1474426882 + .long 1722809436 + .long 2103181697 + .long 1782019277 + .long 1306699518 + .long 1841386098 + .long 2394149058 + .long 1900657427 + .long 2802357954 + .long 1959997432 + .long 4190579671 + .long 2019374921 + .long 1589399104 + .long 2078657782 + .long 459261522 + .long 2137266825 + .long 4294967295 + .long 2146435071 + .long 158971950 + .long 3154658393 + .long 3459173435 + .long 3099360488 + .long 2835657100 + .long 3221135661 + .long 3134582638 + .long 3163662002 + .long 1009146449 + .long 1076045439 + .long 2177907437 + .long 1020724564 + .long 2093419253 + .long 1082406719 + .long 3184966549 + .long 3231785529 + .long 3799028631 + .long 1086175845 + .long 81768581 + .long 3235523877 + .long 1017495356 + .long 1089951767 + .long 1546026610 + .long 3239380678 + .long 980092412 + .long 1093867758 + .long 4064795288 + .long 3243341671 + .long 3027586419 + .long 1097863735 + .long 1002816472 + .long 3247290528 + .long 985745927 + .long 1101758613 + .long 1714999460 + .long 3251222455 + .long 808706777 + .long 1105883774 + .long 2540867906 + .long 3255308994 + .long 1548702939 + .long 3157340334 + .long 1276328330 + .long 3102548777 + .long 2523682374 + .long 3224680861 + .long 1002691513 + .long 3168986622 + .long 2919511741 + .long 1081046750 + .long 3737147325 + .long 1024759629 + .long 2879373926 + .long 1098115315 + .long 103788827 + .long 3250052030 + .long 3732555687 + .long 1107111798 + .long 3845853773 + .long 3259114079 + .long 3808164400 + .long 1116131626 + .long 1738785984 + .long 3268214722 + .long 581652 + .long 1125291233 + .long 3382894442 + .long 3277322952 + .long 2879368705 + .long 1134502288 + .long 2391566275 + .long 3286518813 + .long 274553400 + .long 1143638273 + .long 512789562 + .long 3295790146 + .long 3583864087 + .long 1152986324 + .long 2337425402 + .long 3304798727 + .long 1854575809 + .long 3159867196 + .long 1765059742 + .long 3103980390 + .long 1056564255 + .long 3227329098 + .long 957604928 + .long 3170301297 + .long 1737111893 + .long 1086018364 + .long 3821479224 + .long 1030262355 + .long 1397067068 + .long 1113230428 + .long 1054232731 + .long 3267692171 + .long 1978243918 + .long 1127284645 + .long 3722409577 + .long 3281775634 + .long 1918858489 + .long 1141323813 + .long 3391721543 + .long 3295903979 + .long 2607178807 + .long 1155564765 + .long 3212344015 + .long 3310103974 + .long 3369531970 + .long 1169698149 + .long 335451402 + .long 3324302881 + .long 431247382 + .long 1183973580 + .long 3717434926 + .long 3338657222 + .long 1904523769 + .long 1198380992 + .long 8765522 + .long 3352646819 + .long 2089515505 + .long 1016996008 + .long 1260660699 + .long 961055715 + .long 2755288594 + .long 3230032374 + .long 651647436 + .long 3174928677 + .long 3079991920 + .long 1091533276 + .long 3443268597 + .long 1035583207 + .long 3925746702 + .long 1129598292 + .long 1087270140 + .long 3286788174 + .long 494941268 + .long 1149105228 + .long 1413067450 + .long 3306335280 + .long 2943951130 + .long 1168609830 + .long 1917094202 + .long 3325955583 + .long 3282582259 + .long 1188254230 + .long 205065768 + .long 3345548222 + .long 3975827413 + .long 1207978573 + .long 608024766 + .long 3365228477 + .long 514952666 + .long 1227617187 + .long 1683103546 + .long 3384985256 + .long 3324939681 + .long 1247457575 + .long 4078451799 + .long 3404527118 + .long 3100987862 + .long 1019853288 + .long 2384335067 + .long 962691388 + .long 2781784351 + .long 3233000439 + .long 1271614660 + .long 3176489869 + .long 626016822 + .long 1097348250 + .long 3842822006 + .long 1040353260 + .long 2239739676 + .long 1147303774 + .long 189136319 + .long 3307436007 + .long 2396687400 + .long 1172632530 + .long 1908223243 + .long 3332827221 + .long 2121588596 + .long 1198087089 + .long 3983173167 + .long 3358350016 + .long 2487337699 + .long 1223686165 + .long 3249965797 + .long 3383895554 + .long 3887284480 + .long 1249163916 + .long 138948171 + .long 3409430498 + .long 1463100005 + .long 1274763805 + .long 34738943 + .long 3435142323 + .long 2889101777 + .long 1300502035 + .long 2665757401 + .long 3460504734 + .long 987318156 + .long 3170486179 + .long 252831213 + .long 3113594951 + .long 4266405771 + .long 3236147062 + .long 52757777 + .long 3180182741 + .long 1823142101 + .long 1103640807 + .long 3806357955 + .long 1046313461 + .long 875359927 + .long 1166180665 + .long 1815208659 + .long 3329459206 + .long 1303129141 + .long 1197802172 + .long 4280462790 + .long 3361143469 + .long 626701262 + .long 1229550147 + .long 2303856491 + .long 3392960132 + .long 2759522360 + .long 1261440286 + .long 145515022 + .long 3424795397 + .long 2201193688 + .long 1293210725 + .long 2057332964 + .long 3456624552 + .long 3539517099 + .long 1325105434 + .long 1364231459 + .long 3488625947 + .long 3421843712 + .long 1357133388 + .long 200896422 + .long 3520281853 + .long 951171540 + .long 1026768452 + .long 3090769089 + .long 971487574 + .long 4234403032 + .long 3239454189 + .long 1460268972 + .long 3184474466 + .long 1346899734 + .long 1110354113 + .long 145456861 + .long 1052864217 + .long 2924701438 + .long 1186120500 + .long 3023147446 + .long 3352707860 + .long 1486479387 + .long 1224406765 + .long 1193997181 + .long 3391133412 + .long 2679629000 + .long 1262791412 + .long 2670450976 + .long 3429499462 + .long 1831795719 + .long 1301315682 + .long 3473315319 + .long 3467974125 + .long 2616420704 + .long 1339759302 + .long 1949536880 + .long 3506536322 + .long 2518396463 + .long 1378264708 + .long 142869669 + .long 3545106524 + .long 804820494 + .long 1416958345 + .long 2985125801 + .long 3583414179 + .long 2729716642 + .long 3174389784 + .long 1779261930 + .long 3115790859 + .long 2784196366 + .long 3242962813 + .long 2825451289 + .long 3185986297 + .long 2032114899 + .long 1117254632 + .long 1505002334 + .long 1059738942 + .long 3277658686 + .long 1207035096 + .long 498115686 + .long 3377105433 + .long 1711172328 + .long 1252267855 + .long 261417437 + .long 3422480089 + .long 1133240684 + .long 1297616851 + .long 1456800292 + .long 3467832532 + .long 2145797446 + .long 1343095967 + .long 2516644728 + .long 3513252141 + .long 725820954 + .long 1388528302 + .long 3986994814 + .long 3558807006 + .long 1955265405 + .long 1434003000 + .long 122646123 + .long 3604272992 + .long 1491943337 + .long 1479689885 + .long 1036478018 + .long 3649599135 + .long 523859850 + .long 3181400160 + .long 3846079041 + .long 3121433884 + .long 3639230521 + .long 3246590119 + .long 2638130497 + .long 3191278647 + .long 2154057324 + .long 1124508819 + .long 3236410824 + .long 1069265219 + .long 175871336 + .long 1228815189 + .long 2852522281 + .long 3402552205 + .long 1806384070 + .long 1281362740 + .long 423509286 + .long 3455121177 + .long 1160294737 + .long 1333930482 + .long 3543120866 + .long 3507725506 + .long 1036273485 + .long 1386572737 + .long 2942188771 + .long 3560408527 + .long 2777944578 + .long 1439300670 + .long 2738100981 + .long 3613185349 + .long 527942274 + .long 1492126097 + .long 1294011372 + .long 3665970729 + .long 3274455694 + .long 1544947882 + .long 1889769429 + .long 3718530789 + .long 136073262 + .long 1038797747 + .long 502134597 + .long 982165232 + .long 4211775762 + .long 3250359547 + .long 1347037926 + .long 3194312374 + .long 543769047 + .long 1132034342 + .long 1153606166 + .long 1076402838 + .long 3293430877 + .long 1251313085 + .long 540290119 + .long 3428873621 + .long 1766589444 + .long 1311355635 + .long 3887512491 + .long 3488899482 + .long 4113271272 + .long 1371561389 + .long 1216453194 + .long 3549072511 + .long 761821280 + .long 1431680659 + .long 3412859739 + .long 3609321978 + .long 1736216465 + .long 1491968482 + .long 1379671921 + .long 3669534956 + .long 871564305 + .long 1552192257 + .long 3755076681 + .long 3729888559 + .long 465380849 + .long 1612696812 + .long 1801521440 + .long 3789943511 + .long 926050541 + .long 3187761455 + .long 2363428923 + .long 3130505121 + .long 3212464044 + .long 3254203020 + .long 1767044225 + .long 3196691034 + .long 767402551 + .long 1139855610 + .long 3251527812 + .long 1084244526 + .long 2568107110 + .long 1274594461 + .long 3742439917 + .long 3456026525 + .long 2828194370 + .long 1342408213 + .long 1036563767 + .long 3523815749 + .long 138125806 + .long 1410361976 + .long 3332253618 + .long 3591742210 + .long 2265969007 + .long 1478279541 + .long 2044799860 + .long 3659742729 + .long 3159788672 + .long 1546250274 + .long 3040087996 + .long 3727787101 + .long 3566786041 + .long 1614266310 + .long 3445702274 + .long 3795877266 + .long 1647738551 + .long 1682455451 + .long 820553625 + .long 3863686600 + .long 2466985759 + .long 1045839115 + .long 2115301394 + .long 988248469 + .long 789067623 + .long 3258207291 + .long 2594430310 + .long 3200300918 + .long 682953991 + .long 1147781119 + .long 334308353 + .long 1092099647 + .long 666163226 + .long 1298545479 + .long 1527735017 + .long 3483905174 + .long 43015025 + .long 1374344588 + .long 1895454381 + .long 3559801465 + .long 3313337462 + .long 1450264132 + .long 938251762 + .long 3635670048 + .long 2344246077 + .long 1526147814 + .long 3329926839 + .long 3711639890 + .long 2189826955 + .long 1602221552 + .long 307911546 + .long 3787647166 + .long 4271816317 + .long 1678143122 + .long 3455709496 + .long 3863691777 + .long 509127304 + .long 1754367541 + .long 2246034954 + .long 3939578533 + .long 309332673 + .long 3194846686 + .long 4050026421 + .long 3139306075 + .long 1677069013 + .long 3262318455 + .long 407665306 + .long 3207206552 + .long 156965555 + .long 1155965375 + .long 2320115828 + .long 1098438062 + .long 2734085477 + .long 1323184128 + .long 3116943360 + .long 3512649235 + .long 2683227306 + .long 1407189808 + .long 2374702532 + .long 3596676496 + .long 1369556142 + .long 1491213979 + .long 3682738445 + .long 3680737093 + .long 208207094 + .long 1575312310 + .long 1070212038 + .long 3764875962 + .long 1332751409 + .long 1659495819 + .long 2960239586 + .long 3849108041 + .long 1328259946 + .long 1743778590 + .long 2152673987 + .long 3933352648 + .long 2459568424 + .long 1828057070 + .long 1053026559 + .long 4017368800 + .long 4272716315 + .long 3202139688 + .long 2347479448 + .long 3145750572 + .long 3880933726 + .long 3266512750 + .long 1526392126 + .long 3209922805 + .long 3647913141 + .long 1164353962 + .long 3796124307 + .long 1109331951 + .long 3682674239 + .long 1348349871 + .long 2807065817 + .long 3542009267 + .long 2123995152 + .long 1440744183 + .long 2606508288 + .long 3634425164 + .long 2187838465 + .long 1533156938 + .long 3218070138 + .long 3726874341 + .long 3194985081 + .long 1625643843 + .long 1282672122 + .long 3819401778 + .long 3085269549 + .long 1718215913 + .long 4171823927 + .long 3912022409 + .long 2286527342 + .long 1810887222 + .long 4263058773 + .long 4004655668 + .long 276869381 + .long 1903554397 + .long 2981609009 + .long 4097060567 + .long 2069415824 + .long 3207114478 + .long 3815897610 + .long 3150201997 + .long 1799063985 + .long 3270784757 + .long 609928762 + .long 3210962773 + .long 1398608221 + .long 1172933154 + .long 2839394180 + .long 1117275773 + .long 3966862031 + .long 1374007527 + .long 3094795956 + .long 3571940711 + .long 201952387 + .long 1474951107 + .long 1218377639 + .long 3672975792 + .long 4171572408 + .long 1576047750 + .long 2433360787 + .long 3774024473 + .long 2872117748 + .long 1677069826 + .long 1125668053 + .long 3875125411 + .long 1838424462 + .long 1778265418 + .long 1923560800 + .long 3976316898 + .long 2192672438 + .long 1879376253 + .long 2795231406 + .long 4077480577 + .long 3134618972 + .long 1980778833 + .long 2542206299 + .long 4178570441 + .long 858317418 + .long 1060903333 + .long 3120786235 + .long 1004681431 + .long 381774867 + .long 3275145580 + .long 1575769843 + .long 3219836452 + .long 3230239600 + .long 1181757061 + .long 1694309796 + .long 1126994475 + .long 2041459926 + .long 1400246667 + .long 1834143305 + .long 3602573072 + .long 3431862699 + .long 1509997896 + .long 674489055 + .long 3712297330 + .long 2942256815 + .long 1619727956 + .long 2430104127 + .long 3822158540 + .long 1181772448 + .long 1729549373 + .long 3316918483 + .long 3932027016 + .long 2290692518 + .long 1839450757 + .long 717742192 + .long 4041883887 + .long 2723262413 + .long 1949398481 + .long 726994291 + .long 4151823214 + .long 2316520017 + .long 2059476550 + .long 3506192554 + .long 4261590717 + .long 2615285756 + .long 3215685247 + .long 3456994573 + .long 3158988097 + .long 2576980377 + .long 3279526297 + .long 457772008 + .long 3222963352 + .long 1202590842 + .long 1190427361 + .long 3150210795 + .long 1135356295 + .long 2163381170 + .long 1426480799 + .long 2353315751 + .long 3633229223 + .long 3794716365 + .long 1544911246 + .long 3598226895 + .long 3751709375 + .long 3778743776 + .long 1663434111 + .long 1038551128 + .long 3870293084 + .long 2177305923 + .long 1782019278 + .long 316150431 + .long 3988869748 + .long 3666573938 + .long 1900657340 + .long 1225202613 + .long 4107481261 + .long 4106613245 + .long 2019377222 + .long 3685171119 + .long 4226128894 + .long 3001847201 + .long 2137308914 + .long 4294967295 + .long 4293918719 + .type _dbA,@object + .size _dbA,8032 + .space 672, 0x00 # pad + .align 4 +.L_2il0floatpacket.22: + .long 0x3f800000 + .type .L_2il0floatpacket.22,@object + .size .L_2il0floatpacket.22,4 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_OFW_BOUND: + .word 60404 + .word 65533 + .word 19595 + .word 47317 + .word 32753 + .word 0 + .word 0 + .word 0 + .type _OFW_BOUND,@object + .size _OFW_BOUND,16 + .align 2 +_TWO5600: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 21983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 10783 + .word 0 + .word 0 + .word 0 + .type _TWO5600,@object + .size _TWO5600,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_atan2_k64.S b/external/sgx_libm/intel64/libm_atan2_k64.S new file mode 100644 index 0000000000..a4710fc4a5 --- /dev/null +++ b/external/sgx_libm/intel64/libm_atan2_k64.S @@ -0,0 +1,1434 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_atan2_k64.c" + .text +..TXTST0: +# -- Begin __libm_atan2_k64 + .text + .align 16,0x90 + .globl __libm_atan2_k64 +__libm_atan2_k64: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B1.1: + .cfi_startproc +..___tag_value___libm_atan2_k64.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + movq %rsi, %r9 + movq %rdx, %rax + movzwl 6(%r9), %r11d + andl $32752, %r11d + movb 7(%r9), %sil + movb 7(%rax), %dl + andb $-128, %sil + movzwl 6(%rax), %r10d + andb $-128, %dl + andl $32752, %r10d + shrl $4, %r11d + shrb $7, %sil + shrb $7, %dl + shrl $4, %r10d + cmpl $2047, %r11d + jge ..B1.34 +..B1.2: + cmpl $2047, %r10d + jge ..B1.35 +..B1.3: + testl %r11d, %r11d + jne ..B1.6 +..B1.4: + testl $1048575, 4(%r9) + jne ..B1.6 +..B1.5: + cmpl $0, (%r9) + je ..B1.29 +..B1.6: + testl %r10d, %r10d + jne ..B1.9 +..B1.7: + testl $1048575, 4(%rax) + jne ..B1.9 +..B1.8: + cmpl $0, (%rax) + je ..B1.27 +..B1.9: + movzbl %sil, %r8d + lea _dAtan2Tab(%rip), %rcx + movsd (%r9), %xmm4 + testl %r11d, %r11d + movsd 8(%r9), %xmm6 + movzbl %dl, %r9d + movsd 1904(%rcx,%r8,8), %xmm9 + movsd (%rax), %xmm3 + mulsd %xmm9, %xmm4 + movaps %xmm3, %xmm2 + mulsd %xmm9, %xmm6 + movsd 8(%rax), %xmm9 + movsd 1904(%rcx,%r9,8), %xmm0 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm9 + jle ..B1.47 +..B1.10: + lea 1888+_dAtan2Tab(%rip), %rax + lea -1023(%r11), %r9d + movl %r9d, %r13d + negl %r13d + addl $1023, %r13d + movq (%rax), %r8 + andl $2047, %r13d + movq %r8, -32(%rsp) + shrq $48, %r8 + shll $4, %r13d + andl $-32753, %r8d + movsd %xmm4, -24(%rsp) + orl %r13d, %r8d + movw %r8w, -26(%rsp) + movzwl -18(%rsp), %eax + andl $-32753, %eax + movsd -32(%rsp), %xmm0 + orl $-49168, %eax + movw %ax, -18(%rsp) + mulsd %xmm0, %xmm6 +..B1.11: + testl %r10d, %r10d + jle ..B1.46 +..B1.12: + lea 1888+_dAtan2Tab(%rip), %rax + lea -1023(%r10), %r8d + movsd %xmm2, -16(%rsp) + movq (%rax), %r13 + movl %r8d, %eax + negl %eax + addl $1023, %eax + movq %r13, -32(%rsp) + andl $2047, %eax + shrq $48, %r13 + shll $4, %eax + andl $-32753, %r13d + orl %eax, %r13d + movw %r13w, -26(%rsp) + movzwl -10(%rsp), %eax + andl $-32753, %eax + movsd -32(%rsp), %xmm0 + orl $-49168, %eax + movw %ax, -10(%rsp) + mulsd %xmm0, %xmm9 +..B1.13: + movl %r9d, %eax + subl %r8d, %eax + cmpl $-54, %eax + jle ..B1.24 +..B1.14: + cmpl $54, %eax + jge ..B1.21 +..B1.15: + testb %dl, %dl + jne ..B1.17 +..B1.16: + lea 1992+_dAtan2Tab(%rip), %rax + movsd (%rax), %xmm12 + movaps %xmm12, %xmm13 + jmp ..B1.18 +..B1.17: + lea 1952+_dAtan2Tab(%rip), %rax + lea 1960+_dAtan2Tab(%rip), %r10 + movsd (%rax), %xmm12 + movsd (%r10), %xmm13 +..B1.18: + negl %r9d + lea 1888+_dAtan2Tab(%rip), %rax + movsd -16(%rsp), %xmm8 + lea 1880+_dAtan2Tab(%rip), %r11 + movzwl 6(%rax), %r10d + lea 1023(%r8,%r9), %r8d + andl $2047, %r8d + andl $-32753, %r10d + movsd (%rax), %xmm10 + lea 2016+_dAtan2Tab(%rip), %r9 + shll $4, %r8d + movaps %xmm10, %xmm1 + movsd %xmm10, -64(%rsp) + orl %r8d, %r10d + movw %r10w, -58(%rsp) + movsd -64(%rsp), %xmm4 + mulsd %xmm4, %xmm8 + mulsd %xmm4, %xmm9 + movsd -24(%rsp), %xmm4 + movsd (%r9), %xmm11 + movaps %xmm4, %xmm5 + mulsd %xmm11, %xmm5 + movaps %xmm4, %xmm7 + movaps %xmm5, %xmm3 + subsd %xmm4, %xmm3 + subsd %xmm3, %xmm5 + movaps %xmm11, %xmm3 + mulsd %xmm8, %xmm3 + subsd %xmm5, %xmm7 + movaps %xmm3, %xmm2 + addsd %xmm6, %xmm7 + subsd %xmm8, %xmm2 + subsd %xmm2, %xmm3 + movaps %xmm8, %xmm2 + divsd %xmm3, %xmm1 + movaps %xmm1, %xmm15 + movaps %xmm3, %xmm0 + mulsd %xmm11, %xmm15 + subsd %xmm3, %xmm2 + movaps %xmm15, %xmm14 + addsd %xmm9, %xmm2 + subsd %xmm1, %xmm14 + subsd %xmm14, %xmm15 + movaps %xmm10, %xmm14 + mulsd %xmm15, %xmm0 + movaps %xmm15, %xmm1 + mulsd %xmm2, %xmm1 + subsd %xmm0, %xmm14 + subsd %xmm1, %xmm14 + movaps %xmm15, %xmm1 + mulsd %xmm5, %xmm1 + movaps %xmm14, %xmm0 + addsd %xmm10, %xmm0 + mulsd %xmm0, %xmm14 + movaps %xmm7, %xmm0 + mulsd %xmm15, %xmm14 + mulsd %xmm7, %xmm15 + mulsd %xmm14, %xmm0 + mulsd %xmm5, %xmm14 + addsd %xmm14, %xmm0 + addsd %xmm15, %xmm0 + movaps %xmm0, %xmm14 + addsd %xmm1, %xmm14 + comisd (%r11), %xmm14 + subsd %xmm14, %xmm1 + addsd %xmm0, %xmm1 + jb ..B1.20 +..B1.19: + movsd %xmm14, -64(%rsp) + lea 1984+_dAtan2Tab(%rip), %r9 + movl -60(%rsp), %r8d + lea 1872+_dAtan2Tab(%rip), %r10 + andl $-524288, %r8d + lea 1864+_dAtan2Tab(%rip), %r11 + orl $262144, %r8d + lea 1856+_dAtan2Tab(%rip), %r13 + movl $0, -64(%rsp) + movl %r8d, -60(%rsp) + lea 1848+_dAtan2Tab(%rip), %r8 + movsd -64(%rsp), %xmm1 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm5 + mulsd %xmm1, %xmm7 + movsd (%r9), %xmm0 + movaps %xmm11, %xmm1 + mulsd %xmm0, %xmm3 + lea 1840+_dAtan2Tab(%rip), %r9 + mulsd %xmm2, %xmm0 + movsd %xmm14, -40(%rsp) + movaps %xmm3, %xmm14 + movaps %xmm4, %xmm2 + addsd %xmm0, %xmm14 + movl -36(%rsp), %eax + subsd %xmm14, %xmm3 + andl $2147483647, %eax + addsd %xmm3, %xmm0 + movaps %xmm14, %xmm3 + addl $-1069547520, %eax + sarl $18, %eax + addsd %xmm4, %xmm3 + andl $-2, %eax + subsd %xmm3, %xmm2 + movslq %eax, %rax + addsd %xmm2, %xmm14 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm4 + addsd %xmm4, %xmm14 + movaps %xmm3, %xmm4 + mulsd %xmm11, %xmm4 + addsd %xmm14, %xmm6 + movaps %xmm4, %xmm15 + addsd %xmm0, %xmm6 + subsd %xmm3, %xmm15 + movaps %xmm5, %xmm0 + subsd %xmm15, %xmm4 + addsd %xmm7, %xmm0 + subsd %xmm4, %xmm3 + subsd %xmm0, %xmm5 + addsd %xmm6, %xmm3 + addsd %xmm5, %xmm7 + movaps %xmm0, %xmm5 + movaps %xmm8, %xmm6 + addsd %xmm8, %xmm5 + subsd %xmm5, %xmm6 + addsd %xmm6, %xmm0 + addsd %xmm5, %xmm6 + subsd %xmm6, %xmm8 + addsd %xmm8, %xmm0 + addsd %xmm0, %xmm9 + movaps %xmm5, %xmm0 + mulsd %xmm11, %xmm0 + addsd %xmm7, %xmm9 + movaps %xmm0, %xmm7 + subsd %xmm5, %xmm7 + subsd %xmm7, %xmm0 + movsd (%r10), %xmm7 + lea 1832+_dAtan2Tab(%rip), %r10 + subsd %xmm0, %xmm5 + addsd %xmm9, %xmm5 + movaps %xmm10, %xmm9 + divsd %xmm0, %xmm9 + mulsd %xmm9, %xmm1 + movaps %xmm1, %xmm8 + subsd %xmm9, %xmm8 + movaps %xmm10, %xmm9 + subsd %xmm8, %xmm1 + movaps %xmm12, %xmm8 + mulsd %xmm1, %xmm0 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm5 + mulsd %xmm4, %xmm2 + subsd %xmm0, %xmm9 + subsd %xmm5, %xmm9 + movaps %xmm2, %xmm5 + addsd %xmm9, %xmm10 + mulsd %xmm10, %xmm9 + movaps %xmm3, %xmm10 + mulsd %xmm1, %xmm9 + mulsd %xmm3, %xmm1 + mulsd %xmm9, %xmm10 + mulsd %xmm9, %xmm4 + addsd %xmm4, %xmm10 + addsd %xmm1, %xmm10 + addsd %xmm10, %xmm5 + movaps %xmm5, %xmm3 + movaps %xmm5, %xmm15 + mulsd %xmm5, %xmm3 + subsd %xmm5, %xmm2 + mulsd %xmm11, %xmm15 + mulsd %xmm3, %xmm7 + addsd %xmm2, %xmm10 + movaps %xmm15, %xmm4 + addsd (%r11), %xmm7 + subsd %xmm5, %xmm4 + mulsd %xmm3, %xmm7 + subsd %xmm4, %xmm15 + addsd (%r13), %xmm7 + subsd %xmm15, %xmm5 + mulsd %xmm3, %xmm7 + addsd %xmm5, %xmm10 + addsd (%r8), %xmm7 + mulsd %xmm3, %xmm7 + lea 1824+_dAtan2Tab(%rip), %r11 + movaps %xmm10, %xmm0 + addsd (%r9), %xmm7 + mulsd %xmm3, %xmm7 + movsd (%rcx,%rax,8), %xmm4 + addsd (%r10), %xmm7 + mulsd %xmm3, %xmm7 + addsd (%r11), %xmm7 + mulsd %xmm3, %xmm7 + mulsd %xmm7, %xmm11 + movaps %xmm11, %xmm6 + subsd %xmm7, %xmm6 + subsd %xmm6, %xmm11 + movaps %xmm11, %xmm14 + subsd %xmm11, %xmm7 + mulsd %xmm15, %xmm14 + mulsd %xmm10, %xmm11 + mulsd %xmm7, %xmm0 + mulsd %xmm15, %xmm7 + addsd %xmm11, %xmm0 + movaps %xmm14, %xmm2 + movaps %xmm14, %xmm11 + addsd %xmm15, %xmm2 + addsd %xmm7, %xmm0 + subsd %xmm2, %xmm11 + movaps %xmm2, %xmm3 + movaps %xmm2, %xmm1 + addsd %xmm11, %xmm15 + addsd %xmm2, %xmm11 + addsd %xmm4, %xmm3 + subsd %xmm11, %xmm14 + subsd %xmm3, %xmm1 + addsd %xmm14, %xmm15 + addsd %xmm1, %xmm4 + addsd %xmm3, %xmm1 + addsd %xmm15, %xmm10 + subsd %xmm1, %xmm2 + addsd %xmm0, %xmm10 + addsd %xmm2, %xmm4 + movsd %xmm3, -56(%rsp) + addsd %xmm10, %xmm4 + addsd 8(%rcx,%rax,8), %xmm4 + movb %dl, %cl + shlb $7, %cl + movsd %xmm4, -48(%rsp) + movb -49(%rsp), %al + andb $127, %al + orb %cl, %al + movb %al, -49(%rsp) + movsd -56(%rsp), %xmm7 + movaps %xmm7, %xmm5 + addsd %xmm7, %xmm8 + movb -41(%rsp), %r8b + movb %r8b, %r9b + shrb $7, %r8b + subsd %xmm8, %xmm5 + movaps %xmm8, %xmm6 + addsd %xmm5, %xmm12 + addsd %xmm5, %xmm6 + xorb %r8b, %dl + andb $127, %r9b + shlb $7, %dl + subsd %xmm6, %xmm7 + movsd %xmm8, -56(%rsp) + addsd %xmm7, %xmm12 + orb %dl, %r9b + movb %r9b, -41(%rsp) + movsd -48(%rsp), %xmm9 + movb -49(%rsp), %dl + movb %dl, %al + shrb $7, %dl + addsd %xmm12, %xmm9 + movsd %xmm12, -32(%rsp) + addsd %xmm13, %xmm9 + movsd %xmm9, -48(%rsp) + xorb %sil, %dl + movb -41(%rsp), %cl + movb %cl, %r8b + shrb $7, %cl + andb $127, %al + shlb $7, %dl + xorb %sil, %cl + andb $127, %r8b + shlb $7, %cl + orb %dl, %al + orb %cl, %r8b + movb %al, -49(%rsp) + movb %r8b, -41(%rsp) + movq -56(%rsp), %rsi + movq -48(%rsp), %rax + movq %rsi, (%rdi) + movq %rax, 8(%rdi) + xorl %eax, %eax + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.20: + movaps %xmm14, %xmm0 + lea 1872+_dAtan2Tab(%rip), %rax + mulsd %xmm14, %xmm0 + lea 1864+_dAtan2Tab(%rip), %rcx + movsd (%rax), %xmm3 + lea 1856+_dAtan2Tab(%rip), %r8 + mulsd %xmm0, %xmm3 + lea 1848+_dAtan2Tab(%rip), %r9 + lea 1840+_dAtan2Tab(%rip), %r10 + addsd (%rcx), %xmm3 + mulsd %xmm0, %xmm3 + lea 1832+_dAtan2Tab(%rip), %r11 + movaps %xmm11, %xmm6 + movb %dl, %al + mulsd %xmm14, %xmm6 + addsd (%r8), %xmm3 + shlb $7, %al + mulsd %xmm0, %xmm3 + movaps %xmm6, %xmm2 + subsd %xmm14, %xmm2 + addsd (%r9), %xmm3 + subsd %xmm2, %xmm6 + mulsd %xmm0, %xmm3 + subsd %xmm6, %xmm14 + addsd (%r10), %xmm3 + addsd %xmm14, %xmm1 + mulsd %xmm0, %xmm3 + lea 1824+_dAtan2Tab(%rip), %r13 + addsd (%r11), %xmm3 + mulsd %xmm0, %xmm3 + movaps %xmm6, %xmm5 + movaps %xmm12, %xmm9 + addsd (%r13), %xmm3 + mulsd %xmm0, %xmm3 + mulsd %xmm3, %xmm11 + movaps %xmm11, %xmm14 + subsd %xmm3, %xmm14 + subsd %xmm14, %xmm11 + movaps %xmm11, %xmm4 + subsd %xmm11, %xmm3 + mulsd %xmm6, %xmm4 + mulsd %xmm1, %xmm11 + addsd %xmm4, %xmm5 + movaps %xmm3, %xmm7 + mulsd %xmm1, %xmm7 + mulsd %xmm6, %xmm3 + addsd %xmm11, %xmm7 + movaps %xmm4, %xmm11 + addsd %xmm3, %xmm7 + subsd %xmm5, %xmm11 + movsd %xmm5, -56(%rsp) + addsd %xmm11, %xmm6 + addsd %xmm5, %xmm11 + movb -49(%rsp), %cl + subsd %xmm11, %xmm4 + andb $127, %cl + addsd %xmm4, %xmm6 + orb %al, %cl + addsd %xmm6, %xmm1 + movb %cl, -49(%rsp) + addsd %xmm7, %xmm1 + movsd -56(%rsp), %xmm8 + movaps %xmm8, %xmm10 + addsd %xmm8, %xmm9 + movsd %xmm1, -48(%rsp) + movaps %xmm9, %xmm1 + movb -41(%rsp), %r8b + movb %r8b, %r9b + shrb $7, %r8b + subsd %xmm9, %xmm10 + movsd %xmm9, -56(%rsp) + addsd %xmm10, %xmm1 + addsd %xmm12, %xmm10 + subsd %xmm1, %xmm8 + xorb %r8b, %dl + andb $127, %r9b + shlb $7, %dl + addsd %xmm8, %xmm10 + movsd %xmm10, -32(%rsp) + orb %dl, %r9b + movb %r9b, -41(%rsp) + movsd -48(%rsp), %xmm12 + movb -49(%rsp), %dl + movb %dl, %al + shrb $7, %dl + addsd %xmm10, %xmm12 + addsd %xmm13, %xmm12 + movsd %xmm12, -48(%rsp) + xorb %sil, %dl + movb -41(%rsp), %cl + movb %cl, %r8b + shrb $7, %cl + andb $127, %al + shlb $7, %dl + xorb %sil, %cl + andb $127, %r8b + shlb $7, %cl + orb %dl, %al + orb %cl, %r8b + movb %al, -49(%rsp) + movb %r8b, -41(%rsp) + movq -56(%rsp), %rsi + movq -48(%rsp), %rax + movq %rsi, (%rdi) + movq %rax, 8(%rdi) + xorl %eax, %eax + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.21: + subl %r10d, %r11d + cmpl $74, %r11d + jge ..B1.23 +..B1.22: + divsd %xmm4, %xmm3 + lea 1944+_dAtan2Tab(%rip), %rax + lea 1936+_dAtan2Tab(%rip), %rdx + movsd %xmm3, -32(%rsp) + movsd (%rax), %xmm0 + xorl %eax, %eax + movq (%rdx), %rcx + subsd %xmm3, %xmm0 + movq %rcx, (%rdi) + shrq $56, %rcx + movsd %xmm0, 8(%rdi) + movb 15(%rdi), %r9b + movb %cl, %r8b + shrb $7, %cl + movb %r9b, %r10b + shrb $7, %r9b + xorb %sil, %cl + xorb %sil, %r9b + shlb $7, %cl + andb $127, %r8b + shlb $7, %r9b + andb $127, %r10b + orb %cl, %r8b + orb %r9b, %r10b + movb %r8b, 7(%rdi) + movb %r10b, 15(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.23: + lea 1936+_dAtan2Tab(%rip), %rax + lea 1944+_dAtan2Tab(%rip), %rdx + movq (%rax), %rcx + xorl %eax, %eax + movq (%rdx), %r9 + movq %rcx, (%rdi) + movq %r9, 8(%rdi) + shrq $56, %rcx + shrq $56, %r9 + movb %cl, %r8b + shrb $7, %cl + movb %r9b, %r10b + shrb $7, %r9b + xorb %sil, %cl + xorb %sil, %r9b + shlb $7, %cl + andb $127, %r8b + shlb $7, %r9b + andb $127, %r10b + orb %cl, %r8b + orb %r9b, %r10b + movb %r8b, 7(%rdi) + movb %r10b, 15(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.24: + testb %dl, %dl + jne ..B1.26 +..B1.25: + lea 2016+_dAtan2Tab(%rip), %rdx + lea 1888+_dAtan2Tab(%rip), %rcx + movsd -24(%rsp), %xmm8 + movaps %xmm8, %xmm7 + movsd -16(%rsp), %xmm3 + movsd (%rdx), %xmm10 + movaps %xmm3, %xmm2 + mulsd %xmm10, %xmm7 + mulsd %xmm10, %xmm2 + movaps %xmm7, %xmm0 + movsd (%rcx), %xmm4 + subsd %xmm8, %xmm0 + movaps %xmm4, %xmm5 + subsd %xmm0, %xmm7 + subsd %xmm7, %xmm8 + addsd %xmm6, %xmm8 + movaps %xmm2, %xmm6 + subsd %xmm3, %xmm6 + movaps %xmm8, %xmm11 + subsd %xmm6, %xmm2 + subsd %xmm2, %xmm3 + addsd %xmm9, %xmm3 + movaps %xmm4, %xmm9 + divsd %xmm2, %xmm9 + mulsd %xmm9, %xmm10 + movaps %xmm10, %xmm1 + subsd %xmm9, %xmm1 + subsd %xmm1, %xmm10 + mulsd %xmm10, %xmm2 + movaps %xmm10, %xmm13 + mulsd %xmm10, %xmm3 + mulsd %xmm7, %xmm13 + subsd %xmm2, %xmm5 + movsd %xmm10, -56(%rsp) + subsd %xmm3, %xmm5 + addsd %xmm5, %xmm4 + mulsd %xmm4, %xmm5 + mulsd %xmm10, %xmm5 + mulsd %xmm8, %xmm10 + mulsd %xmm5, %xmm11 + mulsd %xmm5, %xmm7 + movsd %xmm5, -48(%rsp) + addsd %xmm7, %xmm11 + addsd %xmm10, %xmm11 + movaps %xmm11, %xmm12 + addsd %xmm13, %xmm12 + movsd %xmm12, (%rdi) + subsd %xmm12, %xmm13 + movsd %xmm13, -32(%rsp) + addsd %xmm11, %xmm13 + movsd %xmm13, 8(%rdi) + movb 7(%rdi), %r8b + movb %r8b, %r9b + movb 15(%rdi), %r10b + movb %r10b, %r11b + shrb $7, %r8b + andb $127, %r9b + shrb $7, %r10b + movsd %xmm12, -40(%rsp) + xorb %sil, %r8b + xorb %sil, %r10b + shlb $7, %r8b + andb $127, %r11b + shlb $7, %r10b + orb %r8b, %r9b + orb %r10b, %r11b + movb %r9b, 7(%rdi) + movb %r11b, 15(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.26: + lea 1952+_dAtan2Tab(%rip), %rax + lea 1960+_dAtan2Tab(%rip), %rdx + movq (%rax), %rcx + xorl %eax, %eax + movq (%rdx), %r9 + movq %rcx, (%rdi) + movq %r9, 8(%rdi) + shrq $56, %rcx + shrq $56, %r9 + movb %cl, %r8b + shrb $7, %cl + movb %r9b, %r10b + shrb $7, %r9b + xorb %sil, %cl + xorb %sil, %r9b + shlb $7, %cl + andb $127, %r8b + shlb $7, %r9b + andb $127, %r10b + orb %cl, %r8b + orb %r9b, %r10b + movb %r8b, 7(%rdi) + movb %r10b, 15(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.27: + testl %r11d, %r11d + jne ..B1.23 +..B1.28: + testl $1048575, 4(%r9) + jne ..B1.23 + jmp ..B1.57 +..B1.29: + jne ..B1.23 +..B1.31: + testb %dl, %dl + jne ..B1.26 +..B1.32: + lea 1992+_dAtan2Tab(%rip), %rax + movq (%rax), %rdx + xorl %eax, %eax + movq %rdx, (%rdi) + movq %rdx, 8(%rdi) + shrq $56, %rdx + movb %dl, %cl + shrb $7, %dl + andb $127, %cl + xorb %sil, %dl + shlb $7, %dl + orb %dl, %cl + movb %cl, 7(%rdi) + movb %cl, 15(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.34: + je ..B1.51 +..B1.56: + cmpl $2047, %r10d +..B1.35: + je ..B1.48 +..B1.36: + jl ..B1.23 +..B1.38: + cmpl $2047, %r11d + jge ..B1.42 +..B1.39: + testb %dl, %dl + je ..B1.32 + jmp ..B1.26 +..B1.42: + testb %dl, %dl + jne ..B1.44 +..B1.43: + lea 1920+_dAtan2Tab(%rip), %rax + lea 1928+_dAtan2Tab(%rip), %rdx + movq (%rax), %rcx + xorl %eax, %eax + movq (%rdx), %r9 + movq %rcx, (%rdi) + movq %r9, 8(%rdi) + shrq $56, %rcx + shrq $56, %r9 + movb %cl, %r8b + shrb $7, %cl + movb %r9b, %r10b + shrb $7, %r9b + xorb %sil, %cl + xorb %sil, %r9b + shlb $7, %cl + andb $127, %r8b + shlb $7, %r9b + andb $127, %r10b + orb %cl, %r8b + orb %r9b, %r10b + movb %r8b, 7(%rdi) + movb %r10b, 15(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.44: + lea 1968+_dAtan2Tab(%rip), %rax + lea 1976+_dAtan2Tab(%rip), %rdx + movq (%rax), %rcx + xorl %eax, %eax + movq (%rdx), %r9 + movq %rcx, (%rdi) + movq %r9, 8(%rdi) + shrq $56, %rcx + shrq $56, %r9 + movb %cl, %r8b + shrb $7, %cl + movb %r9b, %r10b + shrb $7, %r9b + xorb %sil, %cl + xorb %sil, %r9b + shlb $7, %cl + andb $127, %r8b + shlb $7, %r9b + andb $127, %r10b + orb %cl, %r8b + orb %r9b, %r10b + movb %r8b, 7(%rdi) + movb %r10b, 15(%rdi) +..B1.45: + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.46: + lea 2000+_dAtan2Tab(%rip), %rax + movl $-1022, %r8d + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm9 + movsd %xmm2, -16(%rsp) + jmp ..B1.13 +..B1.47: + lea 2000+_dAtan2Tab(%rip), %rax + movaps %xmm4, %xmm0 + movl $-1022, %r9d + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm6 + movsd %xmm0, -24(%rsp) + jmp ..B1.11 +..B1.48: + testl $1048575, 4(%rax) + jne ..B1.50 +..B1.49: + cmpl $0, (%rax) + je ..B1.38 +..B1.50: + movsd (%r9), %xmm0 + addsd (%rax), %xmm0 + lea 1992+_dAtan2Tab(%rip), %rax + movq (%rax), %rdx + xorl %eax, %eax + movsd %xmm0, (%rdi) + movq %rdx, 8(%rdi) + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 +..B1.51: + testl $1048575, 4(%r9) + jne ..B1.50 +..B1.52: + cmpl $0, (%r9) + jne ..B1.50 +..B1.55: + cmpl $2047, %r10d + je ..B1.48 + jmp ..B1.36 +..B1.57: + cmpl $0, (%r9) + jne ..B1.23 + jmp ..B1.31 + .align 16,0x90 + .cfi_endproc + .type __libm_atan2_k64,@function + .size __libm_atan2_k64,.-__libm_atan2_k64 + .data +# -- End __libm_atan2_k64 + .section .rodata, "a" + .align 16 + .align 16 +_dAtan2Tab: + .long 3892314112 + .long 1069799150 + .long 2332892550 + .long 1039715405 + .long 1342177280 + .long 1070305495 + .long 270726690 + .long 1041535749 + .long 939524096 + .long 1070817911 + .long 2253973841 + .long 3188654726 + .long 3221225472 + .long 1071277294 + .long 3853927037 + .long 1043226911 + .long 2818572288 + .long 1071767563 + .long 2677759107 + .long 1044314101 + .long 3355443200 + .long 1072103591 + .long 1636578514 + .long 3191094734 + .long 1476395008 + .long 1072475260 + .long 1864703685 + .long 3188646936 + .long 805306368 + .long 1072747407 + .long 192551812 + .long 3192726267 + .long 2013265920 + .long 1072892781 + .long 2240369452 + .long 1043768538 + .long 0 + .long 1072999953 + .long 3665168337 + .long 3192705970 + .long 402653184 + .long 1073084787 + .long 1227953434 + .long 3192313277 + .long 2013265920 + .long 1073142981 + .long 3853283127 + .long 1045277487 + .long 805306368 + .long 1073187261 + .long 1676192264 + .long 3192868861 + .long 134217728 + .long 1073217000 + .long 4290763938 + .long 1042034855 + .long 671088640 + .long 1073239386 + .long 994303084 + .long 3189643768 + .long 402653184 + .long 1073254338 + .long 1878067156 + .long 1042652475 + .long 1610612736 + .long 1073265562 + .long 670314820 + .long 1045138554 + .long 3221225472 + .long 1073273048 + .long 691126919 + .long 3189987794 + .long 3489660928 + .long 1073278664 + .long 1618990832 + .long 3188194509 + .long 1207959552 + .long 1073282409 + .long 2198872939 + .long 1044806069 + .long 3489660928 + .long 1073285217 + .long 2633982383 + .long 1042307894 + .long 939524096 + .long 1073287090 + .long 1059367786 + .long 3189114230 + .long 2281701376 + .long 1073288494 + .long 3158525533 + .long 1044484961 + .long 3221225472 + .long 1073289430 + .long 286581777 + .long 1044893263 + .long 4026531840 + .long 1073290132 + .long 2000245215 + .long 3191647611 + .long 134217728 + .long 1073290601 + .long 4205071590 + .long 1045035927 + .long 536870912 + .long 1073290952 + .long 2334392229 + .long 1043447393 + .long 805306368 + .long 1073291186 + .long 2281458177 + .long 3188885569 + .long 3087007744 + .long 1073291361 + .long 691611507 + .long 1044733832 + .long 3221225472 + .long 1073291478 + .long 1816229550 + .long 1044363390 + .long 2281701376 + .long 1073291566 + .long 1993843750 + .long 3189837440 + .long 134217728 + .long 1073291625 + .long 3654754496 + .long 1044970837 + .long 4026531840 + .long 1073291668 + .long 3224300229 + .long 3191935390 + .long 805306368 + .long 1073291698 + .long 2988777976 + .long 3188950659 + .long 536870912 + .long 1073291720 + .long 1030371341 + .long 1043402665 + .long 3221225472 + .long 1073291734 + .long 1524463765 + .long 1044361356 + .long 3087007744 + .long 1073291745 + .long 2754295320 + .long 1044731036 + .long 134217728 + .long 1073291753 + .long 3099629057 + .long 1044970710 + .long 2281701376 + .long 1073291758 + .long 962914160 + .long 3189838838 + .long 805306368 + .long 1073291762 + .long 3543908206 + .long 3188950786 + .long 4026531840 + .long 1073291764 + .long 1849909620 + .long 3191935434 + .long 3221225472 + .long 1073291766 + .long 1641333636 + .long 1044361352 + .long 536870912 + .long 1073291768 + .long 1373968792 + .long 1043402654 + .long 134217728 + .long 1073291769 + .long 2033191599 + .long 1044970710 + .long 3087007744 + .long 1073291769 + .long 4117947437 + .long 1044731035 + .long 805306368 + .long 1073291770 + .long 315378368 + .long 3188950787 + .long 2281701376 + .long 1073291770 + .long 2428571750 + .long 3189838838 + .long 3221225472 + .long 1073291770 + .long 1608007466 + .long 1044361352 + .long 4026531840 + .long 1073291770 + .long 1895711420 + .long 3191935434 + .long 134217728 + .long 1073291771 + .long 2031108713 + .long 1044970710 + .long 536870912 + .long 1073291771 + .long 1362518342 + .long 1043402654 + .long 805306368 + .long 1073291771 + .long 317461253 + .long 3188950787 + .long 939524096 + .long 1073291771 + .long 4117231784 + .long 1044731035 + .long 1073741824 + .long 1073291771 + .long 1607942376 + .long 1044361352 + .long 1207959552 + .long 1073291771 + .long 2428929577 + .long 3189838838 + .long 1207959552 + .long 1073291771 + .long 2031104645 + .long 1044970710 + .long 1342177280 + .long 1073291771 + .long 1895722602 + .long 3191935434 + .long 1342177280 + .long 1073291771 + .long 317465322 + .long 3188950787 + .long 1342177280 + .long 1073291771 + .long 1362515546 + .long 1043402654 + .long 1342177280 + .long 1073291771 + .long 1607942248 + .long 1044361352 + .long 1342177280 + .long 1073291771 + .long 4117231610 + .long 1044731035 + .long 1342177280 + .long 1073291771 + .long 2031104637 + .long 1044970710 + .long 1342177280 + .long 1073291771 + .long 1540251232 + .long 1045150466 + .long 1342177280 + .long 1073291771 + .long 2644671394 + .long 1045270303 + .long 1342177280 + .long 1073291771 + .long 2399244691 + .long 1045360181 + .long 1342177280 + .long 1073291771 + .long 803971124 + .long 1045420100 + .long 1476395008 + .long 1073291771 + .long 3613709523 + .long 3192879152 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192849193 + .long 1476395008 + .long 1073291771 + .long 177735686 + .long 3192826724 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192811744 + .long 1476395008 + .long 1073291771 + .long 2754716064 + .long 3192800509 + .long 1476395008 + .long 1073291771 + .long 3490996172 + .long 3192793019 + .long 1476395008 + .long 1073291771 + .long 1895722605 + .long 3192787402 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192783657 + .long 1476395008 + .long 1073291771 + .long 3613709523 + .long 3192780848 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192778976 + .long 1476395008 + .long 1073291771 + .long 177735686 + .long 3192777572 + .long 1476395008 + .long 1073291771 + .long 3490996172 + .long 3192776635 + .long 1476395008 + .long 1073291771 + .long 2754716064 + .long 3192775933 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192775465 + .long 1476395008 + .long 1073291771 + .long 1895722605 + .long 3192775114 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192774880 + .long 1476395008 + .long 1073291771 + .long 3613709523 + .long 3192774704 + .long 1476395008 + .long 1073291771 + .long 3490996172 + .long 3192774587 + .long 1476395008 + .long 1073291771 + .long 177735686 + .long 3192774500 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192774441 + .long 1476395008 + .long 1073291771 + .long 2754716064 + .long 3192774397 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192774368 + .long 1476395008 + .long 1073291771 + .long 1895722605 + .long 3192774346 + .long 1476395008 + .long 1073291771 + .long 3490996172 + .long 3192774331 + .long 1476395008 + .long 1073291771 + .long 3613709523 + .long 3192774320 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192774313 + .long 1476395008 + .long 1073291771 + .long 177735686 + .long 3192774308 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192774304 + .long 1476395008 + .long 1073291771 + .long 2754716064 + .long 3192774301 + .long 1476395008 + .long 1073291771 + .long 3490996172 + .long 3192774299 + .long 1476395008 + .long 1073291771 + .long 1895722605 + .long 3192774298 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192774297 + .long 1476395008 + .long 1073291771 + .long 3613709523 + .long 3192774296 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192774296 + .long 1476395008 + .long 1073291771 + .long 177735686 + .long 3192774296 + .long 1476395008 + .long 1073291771 + .long 3490996172 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 2754716064 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 2263862659 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1895722605 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1650295902 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1466225875 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1343512524 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1251477510 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1190120835 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1144103328 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1113424990 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1090416237 + .long 3192774295 + .long 1476395008 + .long 1073291771 + .long 1075077068 + .long 3192774295 + .long 1431655765 + .long 3218429269 + .long 2576978363 + .long 1070176665 + .long 2453154343 + .long 3217180964 + .long 4189149139 + .long 1069314502 + .long 1775019125 + .long 3216459198 + .long 273199057 + .long 1068739452 + .long 874748308 + .long 3215993277 + .long 0 + .long 1069547520 + .long 0 + .long 1072693248 + .long 0 + .long 1073741824 + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 1413754136 + .long 1072243195 + .long 856972295 + .long 1015129638 + .long 1413754136 + .long 1073291771 + .long 856972295 + .long 1016178214 + .long 1413754136 + .long 1074340347 + .long 856972295 + .long 1017226790 + .long 2134057426 + .long 1073928572 + .long 1285458442 + .long 1016756537 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 2144337920 + .long 0 + .long 1048576 + .long 33554432 + .long 1101004800 + .type _dAtan2Tab,@object + .size _dAtan2Tab,2024 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_atan2l_k80.S b/external/sgx_libm/intel64/libm_atan2l_k80.S new file mode 100644 index 0000000000..65952a4d34 --- /dev/null +++ b/external/sgx_libm/intel64/libm_atan2l_k80.S @@ -0,0 +1,1835 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_atan2l_k80.c" + .text +..TXTST0: +# -- Begin __libm_atan2l_k80 + .text + .align 16,0x90 + .globl __libm_atan2l_k80 +__libm_atan2l_k80: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +..B1.1: + .cfi_startproc +..___tag_value___libm_atan2l_k80.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $224, %rsp + .cfi_def_cfa_offset 272 + movq %rdi, %r15 + movb 9(%rsi), %cl + andb $-128, %cl + shrb $7, %cl + movzbl 9(%rdx), %r14d + movzwl 8(%rsi), %ebp + andl $128, %r14d + andl $32767, %ebp + movq %fs:40, %rax + movzbl %cl, %ebx + xorq %rsp, %rax + movzwl 8(%rdx), %ecx + shrl $7, %r14d + andl $32767, %ecx + movq %rax, 208(%rsp) + cmpl $32767, %ebp + je ..B1.104 +..B1.2: + cmpl $32767, %ecx + je ..B1.92 +..B1.3: + cmpq $0, (%rsi) + jne ..B1.11 +..B1.4: + cmpq $0, (%rdx) + jne ..B1.8 +..B1.5: + movl $0, 32(%r15) + testl %r14d, %r14d + je ..B1.7 +..B1.6: + shlq $4, %rbx + lea _pilo_00l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_00l(%rip), %rax + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.13 +..B1.7: + shlq $4, %rbx + lea zeros(%rip), %rax + lea ones(%rip), %rdx + fldt (%rax) + fstpt 16(%r15) + fldt 16(%r15) + fldt (%rdx,%rbx) + fmulp %st, %st(1) + fstpt (%r15) + jmp ..B1.13 +..B1.8: + movl $0, 32(%r15) + testl %r14d, %r14d + je ..B1.10 +..B1.9: + shlq $4, %rbx + lea _pilo_00l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_00l(%rip), %rax + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.13 +..B1.10: + shlq $4, %rbx + lea zeros(%rip), %rax + lea ones(%rip), %rdx + fldt (%rax) + fstpt 16(%r15) + fldt 16(%r15) + fldt (%rdx,%rbx) + fmulp %st, %st(1) + fstpt (%r15) + jmp ..B1.13 +..B1.11: + cmpq $0, (%rdx) + jne ..B1.15 +..B1.12: + shlq $4, %rbx + lea _pilo_02l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_02l(%rip), %rax + movl $0, 32(%r15) + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) +..B1.13: + movq 208(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.84 +..B1.14: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.15: + movq (%rdx), %rax + lea 112(%rsp), %rbp + movq 8(%rdx), %rcx + movq %rbp, %rdi + movq 16(%rdx), %r8 + movq 24(%rdx), %r9 + movq 32(%rdx), %r10 + movq 40(%rdx), %rdx + movq %rax, (%rbp) + movq %rcx, 8(%rbp) + movq %rdx, 40(%rbp) + movq (%rsi), %r11 + movq 8(%rsi), %r13 + movq 16(%rsi), %rax + movq 24(%rsi), %rdx + movq 32(%rsi), %rcx + movq 40(%rsi), %rsi + movq %r8, 16(%rbp) + movq %r9, 24(%rbp) + movq %r10, 32(%rbp) + movq %r11, 48(%rbp) + movq %r13, 56(%rbp) + movq %rax, 64(%rbp) + movq %rdx, 72(%rbp) + movq %rcx, 80(%rbp) + movq %rsi, 88(%rbp) +..___tag_value___libm_atan2l_k80.31: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.32: +..B1.16: + lea 160(%rsp), %rdi +..___tag_value___libm_atan2l_k80.33: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.34: +..B1.17: + fldt 112(%rsp) + movq %rbx, %rdx + fld %st(0) + lea ones(%rip), %r13 + fldt 128(%rsp) + movl %r14d, %eax + fadd %st, %st(1) + shlq $4, %rax + fxch %st(1) + fsub %st, %st(2) + shlq $4, %rdx + fxch %st(2) + fsubrp %st, %st(1) + fldt 160(%rsp) + fld %st(0) + fldt 176(%rsp) + movl 144(%rsp), %ecx + fadd %st, %st(1) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fldt (%rax,%r13) + fmul %st, %st(4) + fmulp %st, %st(3) + fldt (%rdx,%r13) + movl 192(%rsp), %eax + cmpl %eax, %ecx + fmul %st, %st(2) + fmul %st, %st(1) + jg ..B1.20 +..B1.18: + jne ..B1.70 +..B1.19: + fxch %st(4) + fcomi %st(2), %st + fxch %st(4) + jbe ..B1.70 +..B1.20: + lea 12(%rax), %edx + cmpl %edx, %ecx + jle ..B1.65 +..B1.21: + lea 75(%rax), %edx + cmpl %edx, %ecx + jle ..B1.38 +..B1.22: + testl %r14d, %r14d + je ..B1.24 +..B1.23: + fstp %st(0) + fstp %st(2) + fstp %st(1) + fstp %st(0) + fstp %st(0) + shlq $4, %rbx + lea _pilo_00l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_00l(%rip), %rax + movl $0, 32(%r15) + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.36 +..B1.24: + fxch %st(2) + fstpt 160(%rsp) + fldt 160(%rsp) + movzwl 168(%rsp), %edx + andl $32767, %edx + fxch %st(4) + fstpt 112(%rsp) + fldt 112(%rsp) + cmpl $8383, %edx + jge ..B1.26 +..B1.25: + fstp %st(4) + fstp %st(3) + fxch %st(2) + fstpt 176(%rsp) + fstpt 128(%rsp) + jmp ..B1.32 +..B1.26: + cmpl $24383, %edx + jg ..B1.25 +..B1.28: + movzwl 120(%rsp), %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B1.25 +..B1.30: + cmpl $24383, %edx + fxch %st(3) + fxch %st(2) + fxch %st(4) + fxch %st(1) + jle ..B1.35 +..B1.31: + fstp %st(1) + fstp %st(2) + fxch %st(1) + fstpt 176(%rsp) + fstpt 128(%rsp) +..B1.32: + fstpt 64(%rsp) + lea 160(%rsp), %rdi +..___tag_value___libm_atan2l_k80.35: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.36: +..B1.33: + fldt 64(%rsp) + movq %rbp, %rdi + fstpt 64(%rsp) +..___tag_value___libm_atan2l_k80.37: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.38: +..B1.34: + fldt 64(%rsp) + fldt 112(%rsp) + fldt 128(%rsp) + fldt 160(%rsp) + fldt 176(%rsp) + movl 144(%rsp), %ecx + movl 192(%rsp), %eax +..B1.35: + fld %st(1) + subl %ecx, %eax + fdiv %st(4), %st + lea _small_value_80(%rip), %rdx + movl %eax, 32(%r15) + lea t32(%rip), %rax + fstpt 16(%rsp) + fldt 16(%rsp) + fxch %st(5) + fstpt 64(%rsp) + fxch %st(3) + fstpt (%rsp) + fldt (%rsp) + fldt (%rax) + fld %st(0) + fmul %st(6), %st + fld %st(0) + fsubr %st(7), %st + faddp %st, %st(1) + fld %st(0) + fsubrp %st, %st(7) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsub %st(1), %st + faddp %st, %st(1) + fsubr %st, %st(2) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(7), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(6) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(0) + fldt (%rsp) + fdivrp %st, %st(3) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 64(%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt (%r15) + fmulp %st, %st(1) + fstpt 16(%r15) + fldt (%r13) + fldt (%rdx) + faddp %st, %st(1) + fstpt 32(%rsp) +..B1.36: + movq 208(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.84 +..B1.37: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.38: + fldt (%r13) + subl %ecx, %eax + movzwl 8(%r13), %ebx + movl %ebx, %edx + addl $16383, %eax + andl $-32768, %edx + andl $32767, %eax + xorl %ecx, %ecx + fstpt 96(%rsp) + fldt 96(%rsp) + orl %eax, %edx + movw %dx, 104(%rsp) + xorl %edx, %edx + fxch %st(5) + fstpt 112(%rsp) + fldt 112(%rsp) + xorl %esi, %esi + fxch %st(5) + fstpt 48(%rsp) + fldt 96(%rsp) + fmul %st, %st(3) + fxch %st(3) + fstpt 160(%rsp) + fldt 160(%rsp) + movzwl 168(%rsp), %eax + andl $32767, %eax + fxch %st(3) + fmulp %st, %st(2) + testl %r14d, %r14d + je ..B1.52 +..B1.39: + cmpl $8383, %eax + jge ..B1.41 +..B1.40: + fstp %st(2) + fstp %st(3) + movl %edx, 192(%rsp) + movl %edx, 144(%rsp) + fxch %st(2) + fstpt 176(%rsp) + fstpt 128(%rsp) + jmp ..B1.47 +..B1.41: + cmpl $24383, %eax + jg ..B1.40 +..B1.43: + movzwl 120(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.40 +..B1.45: + cmpl $24383, %eax + fxch %st(4) + fxch %st(3) + fxch %st(2) + fxch %st(1) + jle ..B1.50 +..B1.46: + fstp %st(1) + fstp %st(2) + movl %edx, 192(%rsp) + movl %edx, 144(%rsp) + fxch %st(1) + fstpt 176(%rsp) + fstpt 128(%rsp) +..B1.47: + fstpt 64(%rsp) + lea 160(%rsp), %rdi +..___tag_value___libm_atan2l_k80.56: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.57: +..B1.48: + fldt 64(%rsp) + movq %rbp, %rdi + fstpt 64(%rsp) +..___tag_value___libm_atan2l_k80.58: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.59: +..B1.49: + fldt 64(%rsp) + fldt 112(%rsp) + fldt 128(%rsp) + fldt 160(%rsp) + fldt 176(%rsp) + movl 144(%rsp), %ecx + movl 192(%rsp), %esi +..B1.50: + fld %st(1) + lea t32(%rip), %rax + fdiv %st(4), %st + subl %ecx, %esi + fstpt 16(%rsp) + fldt 16(%rsp) + addl $16383, %esi + fxch %st(5) + fstpt 64(%rsp) + andl $-32768, %ebx + fxch %st(3) + fstpt (%rsp) + fldt (%rsp) + andl $32767, %esi + fldt (%rax) + orl %esi, %ebx + fld %st(0) + lea 48+_P(%rip), %rdx + fmul %st(6), %st + lea 16+_P(%rip), %rcx + fld %st(0) + lea _P(%rip), %rbp + movq __libm_atanl_table_128@GOTPCREL(%rip), %rsi + fsubr %st(7), %st + faddp %st, %st(1) + fld %st(0) + fsubrp %st, %st(7) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsub %st(1), %st + faddp %st, %st(1) + fsubr %st, %st(2) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(7), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(6) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fldt (%rsp) + fdivrp %st, %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + fstpt 96(%rsp) + fldt (%rdx) + fldt (%rcx) + fldt (%rbp) + movw %bx, 104(%rsp) + lea 32+_P(%rip), %rbx + fldt 96(%rsp) + fmulp %st, %st(4) + fld %st(3) + fmul %st(4), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(4) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt (%rbx) + fmulp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fldl 8192(%rsi) + fldl 8200(%rsi) + movl $0, 32(%r15) + fsubp %st, %st(2) + fldt 64(%rsp) + fmul %st, %st(1) + fld %st(1) + fxch %st(1) + fmulp %st, %st(3) + fadd %st(2), %st + fstpt (%r15) + fldt (%r15) + fsubp %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%r15) + movq 208(%rsp), %rdi + xorq %rsp, %rdi + cmpq %fs:40, %rdi + jne ..B1.84 +..B1.51: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.52: + cmpl $8383, %eax + jge ..B1.54 +..B1.53: + fstp %st(2) + fstp %st(3) + movl %edx, 192(%rsp) + movl %edx, 144(%rsp) + fxch %st(2) + fstpt 176(%rsp) + fstpt 128(%rsp) + jmp ..B1.60 +..B1.54: + cmpl $24383, %eax + jg ..B1.53 +..B1.56: + movzwl 120(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.53 +..B1.58: + cmpl $24383, %eax + fxch %st(4) + fxch %st(3) + fxch %st(2) + fxch %st(1) + jle ..B1.63 +..B1.59: + fstp %st(1) + fstp %st(2) + movl %edx, 192(%rsp) + movl %edx, 144(%rsp) + fxch %st(1) + fstpt 176(%rsp) + fstpt 128(%rsp) +..B1.60: + fstpt 64(%rsp) + lea 160(%rsp), %rdi +..___tag_value___libm_atan2l_k80.77: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.78: +..B1.61: + fldt 64(%rsp) + movq %rbp, %rdi + fstpt 64(%rsp) +..___tag_value___libm_atan2l_k80.79: + call __libm_normalizel_k80@PLT +..___tag_value___libm_atan2l_k80.80: +..B1.62: + fldt 64(%rsp) + fldt 112(%rsp) + fldt 128(%rsp) + fldt 160(%rsp) + fldt 176(%rsp) + movl 144(%rsp), %ecx + movl 192(%rsp), %esi +..B1.63: + fld %st(1) + lea t32(%rip), %rax + fdiv %st(4), %st + subl %ecx, %esi + fstpt 16(%rsp) + fldt 16(%rsp) + addl $16383, %esi + fxch %st(5) + fstpt 64(%rsp) + andl $-32768, %ebx + fxch %st(3) + fstpt (%rsp) + fldt (%rsp) + andl $32767, %esi + fldt (%rax) + orl %esi, %ebx + fld %st(0) + lea 48+_P(%rip), %rdx + fmul %st(6), %st + lea 16+_P(%rip), %rcx + fld %st(0) + lea _P(%rip), %rbp + movl $0, 32(%r15) + fsubr %st(7), %st + faddp %st, %st(1) + fld %st(0) + fsubrp %st, %st(7) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fsub %st(1), %st + faddp %st, %st(1) + fsubr %st, %st(2) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fmul %st(7), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(6) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(5) + fsubrp %st, %st(1) + fsubp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fldt (%rsp) + fdivrp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt 48(%rsp) + fstpt 96(%rsp) + fldt (%rdx) + fldt (%rcx) + fldt (%rbp) + movw %bx, 104(%rsp) + lea 32+_P(%rip), %rbx + fldt 96(%rsp) + fmul %st, %st(4) + fmul %st, %st(4) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + fmul %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(1) + fmul %st, %st(6) + fmulp %st, %st(6) + fxch %st(4) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt (%rbx) + fmulp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(2) + fldt 64(%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt (%r15) + fmulp %st, %st(1) + fstpt 16(%r15) + movq 208(%rsp), %rsi + xorq %rsp, %rsi + cmpq %fs:40, %rsi + jne ..B1.84 +..B1.64: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.65: + fldt (%r13) + subl %ecx, %eax + addl $16383, %eax + lea _TWO_63H(%rip), %rcx + movzwl 8(%r13), %edx + andl $32767, %eax + andl $-32768, %edx + lea _TWO_48H(%rip), %rbx + fstpt 96(%rsp) + fldt 96(%rsp) + orl %eax, %edx + movw %dx, 104(%rsp) + fld %st(5) + fxch %st(1) + fstpt (%rsp) + lea 16+ones(%rip), %rbp + fxch %st(1) + fstpt 64(%rsp) + lea 48+_P(%rip), %rsi + fxch %st(4) + fstpt 112(%rsp) + fldt 112(%rsp) + lea 32+_P(%rip), %r8 + fxch %st(3) + fstpt 128(%rsp) + fldt 128(%rsp) + lea 16+_P(%rip), %rdi + fldt 96(%rsp) + lea _P(%rip), %r9 + fmul %st, %st(3) + xorl %eax, %eax + fxch %st(3) + fstpt 160(%rsp) + fldt 160(%rsp) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fldt .L_2il0floatpacket.11(%rip) + fmul %st(3), %st + fdiv %st(4), %st + fldt .L_2il0floatpacket.12(%rip) + movl %eax, 144(%rsp) + movl %eax, 192(%rsp) + fxch %st(1) + faddl (%rcx) + fstpt 80(%rsp) + fldt 80(%rsp) + fldl (%rbx) + movslq 80(%rsp), %rdx + shlq $4, %rdx + fxch %st(1) + fsubl (%rcx) + fmulp %st, %st(2) + fld %st(5) + fmul %st(1), %st + testl %r14d, %r14d + fadd %st, %st(7) + fxch %st(7) + fstpt 80(%rsp) + fldt 80(%rsp) + fsubp %st, %st(7) + fxch %st(5) + fsub %st(6), %st + faddp %st, %st(3) + fld %st(4) + fmul %st(4), %st + fld %st(0) + fadd %st(5), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fmul %st(1), %st + fadd %st(3), %st + fld %st(2) + fmul %st(2), %st + fadd %st(7), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + fsubrp %st, %st(5) + fxch %st(3) + fmulp %st, %st(6) + fxch %st(5) + fsubrp %st, %st(1) + fld %st(4) + fadd %st(2), %st + fldt (%rsp) + fdivp %st, %st(1) + fmul %st, %st(4) + fld %st(4) + fadd %st(1), %st + fstpt 80(%rsp) + fxch %st(4) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(2) + fmul %st(4), %st + fldt 80(%rsp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(5), %st + fld %st(6) + fmul %st(1), %st + faddp %st, %st(2) + fxch %st(3) + fmul %st, %st(6) + fldt (%rbp) + faddp %st, %st(7) + fxch %st(1) + faddp %st, %st(6) + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + fsubrp %st, %st(1) + fld %st(3) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fld %st(1) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(2) + fmul %st(3), %st + fxch %st(2) + fadd %st(3), %st + fld %st(1) + fmul %st(1), %st + faddp %st, %st(3) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fldt (%rsi) + fmul %st(1), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + fmulp %st, %st(2) + fldt (%r9) + faddp %st, %st(2) + fxch %st(4) + fmulp %st, %st(1) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 64(%rsp) + je ..B1.67 +..B1.66: + negq %rdx + fld %st(2) + movq __libm_atanl_table_128@GOTPCREL(%rip), %rax + fldl 8192(%rax,%rdx) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fxch %st(3) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl 8200(%rax,%rdx) + fsubp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.68 +..B1.67: + movq __libm_atanl_table_128@GOTPCREL(%rip), %rax + fld %st(2) + fldl (%rdx,%rax) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(3) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl 8(%rdx,%rax) + faddp %st, %st(3) + faddp %st, %st(2) +..B1.68: + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + movl $0, 32(%r15) + fadd %st, %st(1) + fxch %st(1) + fstpt (%r15) + fldt (%r15) + fsubp %st, %st(2) + fsubp %st, %st(1) + fstpt 16(%r15) + movq 208(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.84 +..B1.69: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.70: + lea 12(%rcx), %edx + cmpl %edx, %eax + jle ..B1.79 +..B1.71: + fstp %st(3) + fstp %st(0) + lea 75(%rcx), %edx + cmpl %edx, %eax + jg ..B1.77 +..B1.72: + fldt (%r13) + subl %ecx, %eax + addl $16383, %eax + lea 32+_P(%rip), %rbx + movzwl 8(%r13), %edx + andl $32767, %eax + andl $-32768, %edx + lea 16+_P(%rip), %rcx + fstpt 96(%rsp) + orl %eax, %edx + movw %dx, 104(%rsp) + lea 48+_P(%rip), %rax + fldt 96(%rsp) + lea _P(%rip), %rbp + fmulp %st, %st(1) + testl %r14d, %r14d + fdivrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fmul %st(1), %st + fldt (%rax) + fmul %st(1), %st + fldt (%rcx) + movq __libm_atanl_table_128@GOTPCREL(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rbx) + fmulp %st, %st(2) + fldt (%rbp) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(2) + fldl 4096(%rsi) + fmul %st(1), %st + fldl 4104(%rsi) + movl $0, 32(%r15) + je ..B1.74 +..B1.73: + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + jmp ..B1.75 +..B1.74: + fsubp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) +..B1.75: + fld %st(0) + fadd %st(2), %st + fstpt (%r15) + fldt (%r15) + fsubp %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%r15) + movq 208(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.84 +..B1.76: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.77: + fstp %st(1) + fstp %st(0) + fstp %st(0) + shlq $4, %rbx + lea _pilo_02l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_02l(%rip), %rax + movl $0, 32(%r15) + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + movq 208(%rsp), %rbx + xorq %rsp, %rbx + cmpq %fs:40, %rbx + jne ..B1.84 +..B1.78: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.79: + fldt (%r13) + subl %ecx, %eax + addl $16383, %eax + lea _TWO_63H(%rip), %rcx + movzwl 8(%r13), %edx + andl $32767, %eax + andl $-32768, %edx + lea _TWO_48H(%rip), %rbx + fstpt 96(%rsp) + fldt 96(%rsp) + orl %eax, %edx + movw %dx, 104(%rsp) + fld %st(5) + fxch %st(2) + fstpt 64(%rsp) + lea 16+ones(%rip), %rbp + fstpt (%rsp) + lea 48+_P(%rip), %rsi + fxch %st(4) + fstpt 112(%rsp) + fldt 112(%rsp) + lea 16+_P(%rip), %rdi + fxch %st(3) + fstpt 128(%rsp) + fldt 128(%rsp) + lea 32+_P(%rip), %r8 + fldt 96(%rsp) + lea _P(%rip), %r9 + fmul %st, %st(3) + xorl %eax, %eax + fxch %st(3) + fstpt 160(%rsp) + fldt 160(%rsp) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fldt .L_2il0floatpacket.11(%rip) + fmul %st(4), %st + fdiv %st(3), %st + fldt .L_2il0floatpacket.12(%rip) + movl %eax, 144(%rsp) + movl %eax, 192(%rsp) + fxch %st(1) + faddl (%rcx) + fstpt 80(%rsp) + fld %st(4) + fldt 80(%rsp) + movslq 80(%rsp), %rdx + shlq $4, %rdx + fsubl (%rcx) + fmulp %st, %st(2) + testl %r14d, %r14d + fldl (%rbx) + fmul %st, %st(7) + fxch %st(1) + fadd %st(7), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fsubp %st, %st(7) + fxch %st(5) + fsub %st(6), %st + faddp %st, %st(3) + fld %st(4) + fmul %st(4), %st + fld %st(0) + fadd %st(5), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fld %st(5) + fmul %st(1), %st + fadd %st(2), %st + fstpt 16(%rsp) + fld %st(2) + fmul %st(1), %st + fadd %st(4), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fsubrp %st, %st(6) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + fldt 16(%rsp) + fadd %st(2), %st + fldt (%rsp) + fdivp %st, %st(1) + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fstpt 80(%rsp) + fxch %st(3) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(2) + fmul %st(3), %st + fldt 80(%rsp) + fsubp %st, %st(3) + fld %st(2) + fsubr %st(4), %st + fldt 16(%rsp) + fmul %st(1), %st + faddp %st, %st(2) + fldt 16(%rsp) + fmul %st(4), %st + fldt (%rbp) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fsubp %st, %st(3) + fld %st(1) + fmul %st(1), %st + fxch %st(1) + fadd %st(4), %st + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fld %st(2) + fxch %st(4) + fmulp %st, %st(2) + fmul %st(1), %st + fld %st(2) + fadd %st(2), %st + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fld %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fldt (%rsi) + fmul %st(1), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + fmulp %st, %st(2) + fldt (%r9) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 64(%rsp) + je ..B1.81 +..B1.80: + movq __libm_atanl_table_128@GOTPCREL(%rip), %rax + fld %st(2) + fldl 4096(%rax,%rdx) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(3) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl 4104(%rax,%rdx) + faddp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.82 +..B1.81: + negq %rdx + fld %st(2) + movq __libm_atanl_table_128@GOTPCREL(%rip), %rax + fldl 4096(%rax,%rdx) + fsub %st, %st(1) + fsub %st(1), %st + fsubp %st, %st(4) + fxch %st(3) + fstpt 96(%rsp) + fldt 96(%rsp) + fldl 4104(%rax,%rdx) + fsubp %st, %st(3) + faddp %st, %st(2) +..B1.82: + fmul %st, %st(2) + fld %st(2) + fxch %st(2) + fmulp %st, %st(1) + movl $0, 32(%r15) + fadd %st, %st(1) + fxch %st(1) + fstpt (%r15) + fldt (%r15) + fsubp %st, %st(2) + fsubp %st, %st(1) + fstpt 16(%r15) + movq 208(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.84 +..B1.83: + addq $224, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 272 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.84: + call __stack_chk_fail@PLT +..B1.92: + movq $0x8000000000000000, %rax + cmpq (%rdx), %rax + je ..B1.97 +..B1.93: + fldt (%rdx) + lea zeros(%rip), %rax + fldt (%rsi) + movl $0, 32(%r15) + fmulp %st, %st(1) + fstpt (%r15) + fldt (%rax) + fstpt 16(%r15) +..B1.94: + movq 208(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.84 + jmp ..B1.14 +..B1.97: + movl $0, 32(%r15) + cmpl $32767, %ebp + je ..B1.101 +..B1.98: + testl %r14d, %r14d + je ..B1.100 +..B1.99: + shlq $4, %rbx + lea _pilo_00l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_00l(%rip), %rax + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.94 +..B1.100: + shlq $4, %rbx + lea zeros(%rip), %rax + lea ones(%rip), %rdx + fldt (%rax) + fstpt 16(%r15) + fldt 16(%r15) + fldt (%rdx,%rbx) + fmulp %st, %st(1) + fstpt (%r15) + jmp ..B1.94 +..B1.101: + shlq $4, %rbx + testl %r14d, %r14d + je ..B1.103 +..B1.102: + lea _pilo_34l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_34l(%rip), %rax + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.94 +..B1.103: + lea _pilo_04l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_04l(%rip), %rax + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.94 +..B1.104: + movq $0x8000000000000000, %rax + cmpq (%rsi), %rax + jne ..B1.93 +..B1.105: + cmpl $32767, %ecx + je ..B1.92 +..B1.106: + shlq $4, %rbx + lea _pilo_02l(%rip), %rdx + lea _small_value_80(%rip), %rcx + lea _pi_02l(%rip), %rax + movl $0, 32(%r15) + fldt (%rbx,%rdx) + fldt (%rbx,%rax) + fstpt (%r15) + fldt (%rbx,%rcx) + fsubrp %st, %st(1) + fstpt 16(%r15) + jmp ..B1.94 + .align 16,0x90 + .cfi_endproc + .type __libm_atan2l_k80,@function + .size __libm_atan2l_k80,.-__libm_atan2l_k80 + .data +# -- End __libm_atan2l_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x06,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,16 + .align 16 +.L_2il0floatpacket.12: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf8,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,16 + .align 16 +zeros: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type zeros,@object + .size zeros,32 + .align 16 +ones: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type ones,@object + .size ones,32 + .align 16 +t32: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t32,@object + .size t32,32 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 2 +_pilo_00l: + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 16318 + .word 0 + .word 0 + .word 0 + .type _pilo_00l,@object + .size _pilo_00l,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_pi_00l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49152 + .word 0 + .word 0 + .word 0 + .type _pi_00l,@object + .size _pi_00l,32 + .align 2 +_pilo_02l: + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 16317 + .word 0 + .word 0 + .word 0 + .type _pilo_02l,@object + .size _pilo_02l,32 + .align 2 +_pi_02l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _pi_02l,@object + .size _pi_02l,32 + .align 2 +_P: + .word 43664 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 43235 + .word 52379 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59507 + .word 38278 + .word 9340 + .word 37449 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 9132 + .word 55602 + .word 8665 + .word 58245 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,64 + .align 2 +_pilo_34l: + .word 54470 + .word 48821 + .word 27694 + .word 55510 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 54470 + .word 48821 + .word 27694 + .word 55510 + .word 16319 + .word 0 + .word 0 + .word 0 + .type _pilo_34l,@object + .size _pilo_34l,32 + .align 2 +_pi_34l: + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 37288 + .word 39182 + .word 58361 + .word 38603 + .word 49152 + .word 0 + .word 0 + .word 0 + .type _pi_34l,@object + .size _pi_34l,32 + .align 2 +_pilo_04l: + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 16316 + .word 0 + .word 0 + .word 0 + .type _pilo_04l,@object + .size _pilo_04l,32 + .align 2 +_pi_04l: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 49150 + .word 0 + .word 0 + .word 0 + .type _pi_04l,@object + .size _pi_04l,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_cosh_k64.S b/external/sgx_libm/intel64/libm_cosh_k64.S new file mode 100644 index 0000000000..2926b29694 --- /dev/null +++ b/external/sgx_libm/intel64/libm_cosh_k64.S @@ -0,0 +1,341 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_cosh_k64.c" + .text +..TXTST0: +# -- Begin __libm_cosh_k64 + .text + .align 16,0x90 + .globl __libm_cosh_k64 +__libm_cosh_k64: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_cosh_k64.1: +..L2: + + movsd %xmm0, -32(%rsp) + movzwl -26(%rsp), %eax + andl $32752, %eax + cmpl $16720, %eax + jge ..B1.12 +..B1.2: + movl -28(%rsp), %edx + andl $2147483647, %edx + cmpl $1065646817, %edx + jae ..B1.7 +..B1.3: + cmpl $1012924416, %edx + jae ..B1.5 +..B1.4: + movq $0x3ff0000000000000, %rax + movq %rax, (%rdi) + movq $0, 8(%rdi) + jmp ..B1.6 +..B1.5: + movsd -32(%rsp), %xmm0 + movq $0x3ff0000000000000, %rax + mulsd %xmm0, %xmm0 + movaps %xmm0, %xmm1 + mulsd %xmm0, %xmm1 + movsd .L_2il0floatpacket.3(%rip), %xmm3 + mulsd %xmm1, %xmm3 + movsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm1, %xmm2 + addsd .L_2il0floatpacket.4(%rip), %xmm3 + mulsd %xmm0, %xmm3 + movsd %xmm0, -40(%rsp) + addsd %xmm2, %xmm3 + movq %rax, (%rdi) + movsd %xmm3, 8(%rdi) +..B1.6: + xorl %eax, %eax + ret +..B1.7: + movsd -32(%rsp), %xmm2 + lea _TWO_52(%rip), %rax + andps .L_2il0floatpacket.12(%rip), %xmm2 + movsd .L_2il0floatpacket.0(%rip), %xmm4 + mulsd %xmm2, %xmm4 + movsd (%rax), %xmm0 + movsd .L_2il0floatpacket.1(%rip), %xmm1 + addsd %xmm0, %xmm4 + movsd %xmm4, -40(%rsp) + subsd %xmm0, %xmm4 + mulsd %xmm4, %xmm1 + movsd %xmm2, -32(%rsp) + subsd %xmm1, %xmm2 + movsd .L_2il0floatpacket.2(%rip), %xmm3 + movaps %xmm2, %xmm6 + mulsd %xmm3, %xmm4 + movl -40(%rsp), %eax + movl %eax, %r8d + shll $25, %r8d + subsd %xmm4, %xmm6 + sarl $25, %r8d + subsd %xmm6, %xmm2 + subl %r8d, %eax + subsd %xmm4, %xmm2 + movsd .L_2il0floatpacket.11(%rip), %xmm1 + movaps %xmm2, %xmm0 + sarl $7, %eax + addsd %xmm6, %xmm0 + addsd %xmm6, %xmm1 + movzwl 6+.L_2il0floatpacket.11(%rip), %esi + cmpl $1077338037, %edx + jae ..B1.9 +..B1.8: + movaps %xmm0, %xmm7 + xorl %edx, %edx + mulsd %xmm0, %xmm7 + movaps %xmm6, %xmm9 + movsd .L_2il0floatpacket.7(%rip), %xmm8 + movl %eax, %ecx + mulsd %xmm7, %xmm8 + negl %ecx + movsd .L_2il0floatpacket.11(%rip), %xmm3 + addl $1023, %ecx + movsd %xmm1, -32(%rsp) + subl %eax, %ecx + movl %edx, -32(%rsp) + andl $2047, %ecx + movsd -32(%rsp), %xmm10 + andl $-32753, %esi + movsd .L_2il0floatpacket.6(%rip), %xmm4 + decl %eax + movsd .L_2il0floatpacket.6(%rip), %xmm5 + subsd %xmm6, %xmm3 + addsd .L_2il0floatpacket.8(%rip), %xmm8 + addsd %xmm10, %xmm4 + mulsd %xmm7, %xmm8 + subsd %xmm4, %xmm9 + mulsd %xmm0, %xmm8 + addsd %xmm2, %xmm9 + movsd .L_2il0floatpacket.9(%rip), %xmm0 + addsd %xmm8, %xmm9 + mulsd %xmm7, %xmm0 + movsd %xmm3, -24(%rsp) + movl %edx, -24(%rsp) + movsd -24(%rsp), %xmm1 + movslq %r8d, %r8 + addsd .L_2il0floatpacket.10(%rip), %xmm0 + addsd %xmm1, %xmm5 + mulsd %xmm7, %xmm0 + addsd %xmm5, %xmm6 + addsd .L_2il0floatpacket.4(%rip), %xmm0 + addsd %xmm6, %xmm2 + mulsd %xmm7, %xmm0 + xorps .L_2il0floatpacket.13(%rip), %xmm2 + addsd %xmm0, %xmm9 + subsd %xmm8, %xmm2 + movaps %xmm9, %xmm15 + addsd %xmm10, %xmm9 + addsd %xmm0, %xmm2 + movsd .L_2il0floatpacket.11(%rip), %xmm6 + movaps %xmm2, %xmm12 + shll $4, %ecx + addsd %xmm1, %xmm2 + shlq $4, %r8 + orl %ecx, %esi + movsd %xmm6, -16(%rsp) + movw %si, -10(%rsp) + movq __libm_exp_table_128@GOTPCREL(%rip), %rsi + movsd 1032(%r8,%rsi), %xmm13 + mulsd 1024(%r8,%rsi), %xmm9 + negq %r8 + mulsd %xmm13, %xmm15 + mulsd 1024(%rsi,%r8), %xmm2 + mulsd %xmm10, %xmm13 + addsd %xmm9, %xmm15 + movsd 1032(%rsi,%r8), %xmm11 + movaps %xmm13, %xmm14 + mulsd %xmm11, %xmm12 + mulsd %xmm11, %xmm1 + addsd %xmm2, %xmm12 + movsd -16(%rsp), %xmm2 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm12 + addsd %xmm1, %xmm14 + addsd %xmm12, %xmm15 + subsd %xmm14, %xmm13 + movsd %xmm1, -24(%rsp) + addsd %xmm1, %xmm13 + movsd %xmm14, -40(%rsp) + addsd %xmm13, %xmm15 + movsd %xmm13, -32(%rsp) + movsd %xmm14, (%rdi) + movsd %xmm15, 8(%rdi) + ret +..B1.9: + movsd %xmm1, -40(%rsp) + movaps %xmm0, %xmm4 + movl $0, -40(%rsp) + decl %eax + movsd -40(%rsp), %xmm7 + movsd .L_2il0floatpacket.6(%rip), %xmm1 + mulsd %xmm0, %xmm4 + addsd %xmm7, %xmm1 + movsd .L_2il0floatpacket.9(%rip), %xmm5 + subsd %xmm1, %xmm6 + mulsd %xmm4, %xmm5 + addsd %xmm6, %xmm2 + addsd .L_2il0floatpacket.10(%rip), %xmm5 + movsd .L_2il0floatpacket.7(%rip), %xmm6 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm5 + addsd .L_2il0floatpacket.8(%rip), %xmm6 + mulsd %xmm6, %xmm0 + movsd .L_2il0floatpacket.4(%rip), %xmm3 + addsd %xmm0, %xmm5 + mulsd %xmm4, %xmm5 + mulsd %xmm3, %xmm4 + movslq %r8d, %r8 + addsd %xmm4, %xmm5 + shlq $4, %r8 + addsd %xmm5, %xmm2 + movaps %xmm2, %xmm8 + addsd %xmm7, %xmm2 + movq __libm_exp_table_128@GOTPCREL(%rip), %rdx + movsd 1032(%r8,%rdx), %xmm0 + mulsd 1024(%r8,%rdx), %xmm2 + mulsd %xmm0, %xmm8 + mulsd %xmm0, %xmm7 + addsd %xmm2, %xmm8 + movsd %xmm7, -40(%rsp) + movsd %xmm7, (%rdi) + movsd %xmm8, 8(%rdi) +..B1.10: + ret +..B1.12: + xorl %eax, %eax + movq %rax, (%rdi) + movq %rax, 8(%rdi) +..B1.13: + xorl %eax, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __libm_cosh_k64,@function + .size __libm_cosh_k64,.-__libm_cosh_k64 + .data +# -- End __libm_cosh_k64 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.12: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,16 + .align 16 +.L_2il0floatpacket.13: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x6a3d464e,0x3f56c171 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x5554a6cf,0x3fa55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 4 +_TWO_52: + .long 0 + .long 1127219200 + .type _TWO_52,@object + .size _TWO_52,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_coshl_k80.S b/external/sgx_libm/intel64/libm_coshl_k80.S new file mode 100644 index 0000000000..6f542ee182 --- /dev/null +++ b/external/sgx_libm/intel64/libm_coshl_k80.S @@ -0,0 +1,748 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_coshl_k80.c" + .text +..TXTST0: +# -- Begin __libm_coshl_k80 + .text + .align 16,0x90 + .globl __libm_coshl_k80 +__libm_coshl_k80: +# parameter 1: 8 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_coshl_k80.1: +..L2: + + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $16405, %eax + jge ..B1.20 +..B1.2: + cmpl $16382, %eax + jge ..B1.13 +..B1.3: + cmpl $16378, %eax + jge ..B1.11 +..B1.4: + fldt .L_2il0floatpacket.1(%rip) + cmpl $16372, %eax + jge ..B1.10 +..B1.5: + cmpl $16365, %eax + jge ..B1.9 +..B1.6: + fstpt (%rdi) + cmpl $16308, %eax + jge ..B1.8 +..B1.7: + fldt .L_2il0floatpacket.0(%rip) + fstpt 16(%rdi) + fldt 16(%rdi) + ret +..B1.8: + fldt 8(%rsp) + lea _Q3(%rip), %rax + fldt (%rax) + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.9: + fldt 8(%rsp) + lea 16+_Q2(%rip), %rax + lea _Q2(%rip), %rdx + fmul %st(0), %st + fxch %st(1) + fstpt (%rdi) + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.10: + fldt 8(%rsp) + lea 48+_Q1(%rip), %rax + lea 32+_Q1(%rip), %rcx + lea 16+_Q1(%rip), %rdx + lea _Q1(%rip), %rsi + fmul %st(0), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt (%rdi) + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + fmulp %st, %st(3) + fldt (%rsi) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.11: + fldt 8(%rsp) + lea _TWO_48H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 96+_Q(%rip), %rdx + fmul %st(3), %st + lea 64+_Q(%rip), %rcx + fld %st(0) + lea 112+_Q(%rip), %r8 + lea 32+_Q(%rip), %rsi + lea 80+_Q(%rip), %r9 + lea 48+_Q(%rip), %r10 + lea 16+_Q(%rip), %r11 + fmul %st(1), %st + fldl (%rax) + lea 144+_Q(%rip), %rax + fadd %st, %st(4) + fxch %st(4) + fstpt -24(%rsp) + fldt -24(%rsp) + fsub %st(4), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(1) + fmul %st(4), %st + fxch %st(6) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(5) + fxch %st(2) + fmul %st(0), %st + fldt (%rdx) + lea 128+_Q(%rip), %rdx + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r8) + fmul %st(4), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(4) + fld %st(5) + fldt (%r11) + faddp %st, %st(5) + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldt (%rax) + fld %st(0) + fmul %st(7), %st + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fmul %st(1), %st + fmul %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(2) + fldt (%rdx) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(2) + fmulp %st, %st(4) + fld %st(1) + fadd %st(4), %st + fadd %st(3), %st + fstpt -24(%rsp) + fldt -24(%rsp) + fsubp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.1(%rip) + faddp %st, %st(1) + fstpt (%rdi) + fldt .L_2il0floatpacket.0(%rip) +..B1.12: + ret +..B1.13: + fldt 8(%rsp) + lea _KLN2(%rip), %rsi + movb 17(%rsp), %cl + lea _TWO_63H(%rip), %rax + andb $-128, %cl + lea _LN2K(%rip), %r8 + shrb $7, %cl + lea 16+_LN2K(%rip), %r9 + fldt (%rsi) + fldl (%rax) + fldt (%r8) + fldt (%r9) + movzbl %cl, %edx + lea ones(%rip), %rcx + lea _TWO_32P(%rip), %r10 + lea _TWO_32(%rip), %r11 + lea 64+_P(%rip), %rsi + lea 32+_P(%rip), %r8 + lea _P(%rip), %r9 + fxch %st(4) + fmull (%rcx,%rdx,8) + fmul %st, %st(3) + fxch %st(2) + fadd %st, %st(3) + fxch %st(3) + fstpt -24(%rsp) + fxch %st(1) + fstpt 8(%rsp) + fldt 8(%rsp) + fldt -24(%rsp) + movl -24(%rsp), %edx + fsubp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + movsbq %dl, %rax + fsubrp %st, %st(1) + fld %st(0) + subl %eax, %edx + fxch %st(3) + fmulp %st, %st(2) + sarl $8, %edx + fxch %st(1) + fsubr %st, %st(2) + fldl (%r10) + lea 48+_P(%rip), %r10 + fmul %st(3), %st + fldl (%r11) + lea 16+_P(%rip), %r11 + fmulp %st, %st(4) + fsubp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fsubp %st, %st(1) + fadd %st, %st(1) + fld %st(1) + fmul %st(2), %st + fldt (%rsi) + fmul %st(1), %st + fldt (%r8) + movzwl 16(%rsp), %esi + faddp %st, %st(1) + fmul %st(1), %st + andl $32767, %esi + fldt (%r9) + cmpl $16387, %esi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + jg ..B1.19 +..B1.14: + jne ..B1.18 +..B1.15: + movl 12(%rsp), %esi + cmpl $-782985146, %esi + ja ..B1.19 +..B1.16: + jne ..B1.18 +..B1.17: + cmpl $1501741449, 8(%rsp) + ja ..B1.19 +..B1.18: + fldt .L_2il0floatpacket.1(%rip) + movl %edx, %r8d + negl %r8d + lea -1(%rdx), %esi + addl $16383, %r8d + shlq $4, %rax + subl %edx, %r8d + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + andl $32767, %r8d + fstpt -40(%rsp) + fld %st(1) + movzwl 8+.L_2il0floatpacket.1(%rip), %r9d + fadd %st(1), %st + fxch %st(1) + fsubrp %st, %st(2) + fld %st(2) + andl $-32768, %r9d + fldl 2056(%rdx,%rax) + orl %r8d, %r9d + fldl 2048(%rdx,%rax) + negq %rax + fstpt -72(%rsp) + fldt -72(%rsp) + movw %r9w, -32(%rsp) + fadd %st(1), %st + fmulp %st, %st(3) + fld %st(4) + fmul %st(1), %st + movl %esi, -8(%rsp) + faddp %st, %st(3) + fldl 2056(%rdx,%rax) + fmul %st, %st(2) + fldl 2048(%rdx,%rax) + fld %st(0) + movb 17(%rsp), %al + fadd %st(2), %st + fmulp %st, %st(6) + andb $-128, %al + shrb $7, %al + fxch %st(3) + fsubrp %st, %st(5) + fxch %st(4) + fstpt -56(%rsp) + fld %st(4) + fxch %st(2) + fmul %st, %st(5) + fldt -72(%rsp) + fmul %st, %st(3) + fld %st(0) + movzbl %al, %r10d + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fsub %st(5), %st + fsubr %st, %st(3) + fxch %st(5) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(0) + fldt -56(%rsp) + faddp %st, %st(4) + fldt -40(%rsp) + fmul %st, %st(5) + fxch %st(1) + fadd %st(5), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldl (%rcx,%r10,8) + fmul %st, %st(1) + fxch %st(1) + fstpt (%rdi) + fmulp %st, %st(1) + fstpt 16(%rdi) + fildl -8(%rsp) + ret +..B1.19: + shlq $4, %rax + decl %edx + movl %edx, -8(%rsp) + faddp %st, %st(1) + fildl -8(%rsp) + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + movb 17(%rsp), %al + faddp %st, %st(4) + fmul %st, %st(4) + fld %st(0) + andb $-128, %al + shrb $7, %al + fadd %st(5), %st + fsubr %st, %st(1) + movzbl %al, %esi + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fldl (%rcx,%rsi,8) + fmul %st, %st(3) + fxch %st(3) + fstpt (%rdi) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rdi) + ret +..B1.20: + cmpl $32767, %eax + je ..B1.23 +..B1.21: + fldt .L_2il0floatpacket.0(%rip) + lea _infs(%rip), %rax + fstpt 16(%rdi) + fldt (%rax) + fstpt (%rdi) + fldt (%rdi) +..B1.22: + ret +..B1.23: + fldt 8(%rsp) + fmul %st(0), %st + fstpt (%rdi) + fldt (%rdi) + fldt .L_2il0floatpacket.0(%rip) + fstpt 16(%rdi) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_coshl_k80,@function + .size __libm_coshl_k80,.-__libm_coshl_k80 + .data +# -- End __libm_coshl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 2 +_Q3: + .word 21845 + .word 213 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 62430 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 22894 + .word 21845 + .word 43733 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 65531 + .word 65535 + .word 65535 + .word 65535 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 7054 + .word 43693 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 25016 + .word 58228 + .word 24755 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 57397 + .word 35800 + .word 53031 + .word 53262 + .word 16367 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 18360 + .word 43637 + .word 28980 + .word 40373 + .word 49076 + .word 0 + .word 0 + .word 0 + .word 16302 + .word 43691 + .word 43690 + .word 43690 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 46125 + .word 2912 + .word 24758 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 29965 + .word 3335 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 54950 + .word 46751 + .word 32187 + .word 37874 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 30733 + .word 25775 + .word 51110 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 49850 + .word 450 + .word 9929 + .word 51659 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 2776 + .word 45191 + .word 37201 + .word 55334 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,160 + .align 2 +_KLN2: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16391 + .word 0 + .word 0 + .word 0 + .type _KLN2,@object + .size _KLN2,16 + .align 2 +_LN2K: + .word 0 + .word 0 + .word 6134 + .word 45426 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 55756 + .word 58609 + .word 48341 + .word 59623 + .word 16343 + .word 0 + .word 0 + .word 0 + .type _LN2K,@object + .size _LN2K,32 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_infs: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .type _infs,@object + .size _infs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_cosl_k80.S b/external/sgx_libm/intel64/libm_cosl_k80.S new file mode 100644 index 0000000000..f1b0501958 --- /dev/null +++ b/external/sgx_libm/intel64/libm_cosl_k80.S @@ -0,0 +1,848 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_cosl_k80.c" + .text +..TXTST0: +# -- Begin __libm_cosl_k80 + .text + .align 16,0x90 + .globl __libm_cosl_k80 +__libm_cosl_k80: +# parameter 1: 144 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_cosl_k80.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + subq $120, %rsp + .cfi_def_cfa_offset 144 + movq %rdi, %rbp + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 112(%rsp) + movzwl 152(%rsp), %eax + andl $32767, %eax + cmpl $16378, %eax + jge ..B1.18 +..B1.2: + cmpl $16372, %eax + jge ..B1.16 +..B1.3: + cmpl $16364, %eax + jge ..B1.14 +..B1.4: + cmpl $16308, %eax + jge ..B1.12 +..B1.5: + testl %eax, %eax + jne ..B1.8 +..B1.6: + cmpl $0, 148(%rsp) + jne ..B1.8 +..B1.7: + cmpl $0, 144(%rsp) + je ..B1.9 +..B1.8: + lea _ones(%rip), %rax + lea _small_value_80(%rip), %rdx + lea _zeros(%rip), %rcx + fldl (%rax) + fldt (%rdx) + fsubr %st(1), %st + fstpt (%rbp) + fldl (%rcx) + fstpt 16(%rbp) + jmp ..B1.10 +..B1.9: + lea _ones(%rip), %rax + lea _zeros(%rip), %rdx + fldl (%rax) + fstpt (%rbp) + fldt (%rbp) + fldl (%rdx) + fstpt 16(%rbp) +..B1.10: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.28 +..B1.11: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.12: + fldt 144(%rsp) + lea _CP3(%rip), %rdx + lea _ones(%rip), %rax + fldt (%rdx) + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 16(%rbp) + fldl (%rax) + fstpt (%rbp) + fldt (%rbp) + movq 112(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + jne ..B1.28 +..B1.13: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.14: + fldt 144(%rsp) + lea 16+_CP2(%rip), %rdx + fmul %st(0), %st + lea _CP2(%rip), %rcx + fldt (%rdx) + lea _ones(%rip), %rax + fmul %st(1), %st + fldl (%rax) + fstpt (%rbp) + fldt (%rbp) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbp) + movq 112(%rsp), %rbx + xorq %rsp, %rbx + cmpq %fs:40, %rbx + jne ..B1.28 +..B1.15: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.16: + fldt 144(%rsp) + lea 48+_CP1(%rip), %rdx + fmul %st(0), %st + lea 32+_CP1(%rip), %rbx + fld %st(0) + lea 16+_CP1(%rip), %rcx + fmul %st(1), %st + lea _CP1(%rip), %rsi + fldt (%rdx) + lea _ones(%rip), %rax + fmul %st(1), %st + fldl (%rax) + fstpt (%rbp) + fldt (%rbp) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rbx) + fmulp %st, %st(3) + fldt (%rsi) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rbp) + movq 112(%rsp), %rbp + xorq %rsp, %rbp + cmpq %fs:40, %rbp + jne ..B1.28 +..B1.17: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.18: + cmpl $16382, %eax + jge ..B1.20 +..B1.19: + fldt 144(%rsp) + xorl %ecx, %ecx + movb 153(%rsp), %bl + xorl %esi, %esi + andb $-128, %bl + lea _TWO_52H(%rip), %rdx + shrb $7, %bl + fldl (%rdx) + movzbl %bl, %eax + lea _ones(%rip), %rbx + fxch %st(1) + fmull (%rbx,%rax,8) + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fstpt 16(%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + jmp ..B1.23 +..B1.20: + je ..B1.33 +..B1.21: + fldt 144(%rsp) + xorl %edi, %edi + movb 153(%rsp), %bl + andb $-128, %bl + shrb $7, %bl + movzbl %bl, %eax + lea _ones(%rip), %rbx + fmull (%rbx,%rax,8) + fstpt 144(%rsp) + fldt 144(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 160 + lea 112(%rsp), %rsi + fstpt (%rsp) +..___tag_value___libm_cosl_k80.41: + call __libm_reduce_pi04l@PLT +..___tag_value___libm_cosl_k80.42: +..B1.38: + movl %eax, %esi + addq $16, %rsp + .cfi_def_cfa_offset 144 +..B1.22: + fldl 96(%rsp) + lea 3(%rsi), %ecx + lea _TWO_52H(%rip), %rax + fld %st(0) + fldl 104(%rsp) + movsd 96(%rsp), %xmm0 + shrl $2, %ecx + mulsd (%rax), %xmm0 + andl $1, %ecx + movsd %xmm0, (%rsp) + fldl (%rsp) + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + faddp %st, %st(1) +..B1.23: + fldt 16(%rsp) + fld %st(2) + fmul %st(1), %st + lea _TWO_53H(%rip), %rax + fxch %st(1) + fmul %st(2), %st + incl %esi + faddp %st, %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fld %st(2) + fmul %st(3), %st + testl $2, %esi + fld %st(0) + fadd %st(2), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fld %st(1) + fmul %st(2), %st + fld %st(0) + faddp %st, %st(2) + fldl (%rax) + fstpt 48(%rsp) + fldl (%rbx,%rcx,8) + je ..B1.25 +..B1.24: + lea 112+_SP(%rip), %rax + lea 80+_SP(%rip), %rdx + fstpt (%rsp) + lea 48+_SP(%rip), %rcx + lea 128+_SP(%rip), %rdi + lea 16+_SP(%rip), %rsi + lea 96+_SP(%rip), %r8 + lea 64+_SP(%rip), %r9 + fldt (%rax) + lea 32+_SP(%rip), %r10 + lea _SP(%rip), %r11 + lea 160+_SP(%rip), %rax + fmul %st(2), %st + fldt (%rdx) + lea 144+_SP(%rip), %rdx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r11) + faddp %st, %st(3) + fldt 32(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 64(%rsp) + fldt 80(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rdx) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fldt 48(%rsp) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(2) + fld %st(2) + fldt 16(%rsp) + fld %st(0) + fmul %st(3), %st + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + fmul %st(3), %st + fadd %st, %st(1) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt (%rbp) + fmulp %st, %st(1) + fstpt 16(%rbp) + fldl (%rbx) + jmp ..B1.26 +..B1.25: + fstp %st(4) + fstp %st(4) + lea 112+_CP(%rip), %rax + lea 80+_CP(%rip), %rdx + lea 48+_CP(%rip), %rcx + lea 16+_CP(%rip), %rsi + lea 128+_CP(%rip), %rdi + lea 96+_CP(%rip), %r8 + lea 64+_CP(%rip), %r9 + lea 32+_CP(%rip), %r10 + fldt (%rax) + lea _CP(%rip), %r11 + lea 160+_CP(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + lea 144+_CP(%rip), %rdx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r11) + faddp %st, %st(2) + fldt 32(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 64(%rsp) + fldt 80(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(5) + fldt (%rdx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fld %st(4) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fadd %st, %st(1) + fldt 48(%rsp) + fmul %st(2), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldl (%rbx) + fadd %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + fstpt (%rbp) + fmulp %st, %st(1) + fstpt 16(%rbp) +..B1.26: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.28 +..B1.27: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.28: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.33: + movl 148(%rsp), %eax + cmpl $-921707870, %eax + jb ..B1.19 +..B1.34: + jne ..B1.21 +..B1.35: + cmpl $560513589, 144(%rsp) + jbe ..B1.19 + jmp ..B1.21 + .align 16,0x90 + .cfi_endproc + .type __libm_cosl_k80,@function + .size __libm_cosl_k80,.-__libm_cosl_k80 + .data +# -- End __libm_cosl_k80 + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_CP3: + .word 0 + .word 65450 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _CP3,@object + .size _CP3,16 + .align 2 +_CP2: + .word 63855 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 18238 + .word 17476 + .word 43656 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP2,@object + .size _CP2,32 + .align 2 +_CP1: + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 47533 + .word 43689 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 14131 + .word 49466 + .word 24756 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 37142 + .word 18013 + .word 35855 + .word 53259 + .word 16367 + .word 0 + .word 0 + .word 0 + .type _CP1,@object + .size _CP1,64 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP,@object + .size _SP,176 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 0 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP,@object + .size _CP,176 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_exp_k32.S b/external/sgx_libm/intel64/libm_exp_k32.S new file mode 100644 index 0000000000..3fd3808323 --- /dev/null +++ b/external/sgx_libm/intel64/libm_exp_k32.S @@ -0,0 +1,220 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_exp_k32.c" + .text +..TXTST0: +# -- Begin __libm_exp_k32 + .text + .align 16,0x90 + .globl __libm_exp_k32 +__libm_exp_k32: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___libm_exp_k32.1: +..L2: + + movsd %xmm0, -16(%rsp) + movl -12(%rsp), %eax + movl %eax, %edx + andl $2147483647, %edx + shrl $31, %eax + cmpl $1012924416, %edx + jb ..B1.3 +..B1.2: + movsd .L_2il0floatpacket.0(%rip), %xmm1 + lea _TWO_52H(%rip), %rdx + movsd .L_2il0floatpacket.1(%rip), %xmm3 + lea SC2_BIAS(%rip), %rsi + movsd .L_2il0floatpacket.2(%rip), %xmm4 + lea _SC2(%rip), %r10 + movsd .L_2il0floatpacket.4(%rip), %xmm13 + movsd (%rdx), %xmm2 + movsd .L_2il0floatpacket.6(%rip), %xmm10 + mulsd %xmm0, %xmm1 + movsd .L_2il0floatpacket.9(%rip), %xmm6 + addsd %xmm2, %xmm1 + movsd %xmm1, -40(%rsp) + movsd -40(%rsp), %xmm5 + movsd .L_2il0floatpacket.3(%rip), %xmm7 + subsd %xmm2, %xmm5 + mulsd %xmm5, %xmm3 + mulsd %xmm4, %xmm5 + subsd %xmm3, %xmm0 + movaps %xmm0, %xmm8 + movsd %xmm0, -16(%rsp) + subsd %xmm5, %xmm8 + movaps %xmm8, %xmm9 + subsd %xmm8, %xmm0 + addsd %xmm8, %xmm6 + subsd %xmm5, %xmm0 + movsd %xmm6, -32(%rsp) + addsd %xmm0, %xmm9 + movaps %xmm9, %xmm11 + mulsd %xmm9, %xmm11 + mulsd %xmm11, %xmm13 + mulsd %xmm11, %xmm10 + addsd .L_2il0floatpacket.5(%rip), %xmm13 + addsd .L_2il0floatpacket.7(%rip), %xmm10 + mulsd %xmm11, %xmm13 + mulsd %xmm9, %xmm10 + movl $0, -32(%rsp) + addsd %xmm10, %xmm13 + movsd -32(%rsp), %xmm14 + movsd .L_2il0floatpacket.8(%rip), %xmm12 + addsd %xmm14, %xmm7 + mulsd %xmm11, %xmm13 + mulsd %xmm11, %xmm12 + subsd %xmm7, %xmm8 + addsd %xmm12, %xmm13 + addsd %xmm8, %xmm0 + movl -40(%rsp), %ecx + movl %ecx, %r8d + shll $25, %r8d + addsd %xmm13, %xmm0 + sarl $25, %r8d + subl %r8d, %ecx + movslq %r8d, %r8 + shlq $4, %r8 + movq __libm_exp_table_128@GOTPCREL(%rip), %r9 + shrl $7, %ecx + movslq (%rsi,%rax,4), %rdi + movsd 1032(%r9,%r8), %xmm15 + addq %rcx, %rdi + movaps %xmm15, %xmm1 + mulsd %xmm0, %xmm1 + addsd %xmm14, %xmm0 + mulsd %xmm14, %xmm15 + mulsd 1024(%r9,%r8), %xmm0 + shlq $52, %rdi + addsd %xmm0, %xmm1 + movq %rdi, -24(%rsp) + addsd %xmm15, %xmm1 + mulsd -24(%rsp), %xmm1 + mulsd (%r10,%rax,8), %xmm1 + jmp ..B1.4 +..B1.3: + movsd .L_2il0floatpacket.9(%rip), %xmm1 + addsd -16(%rsp), %xmm1 +..B1.4: + movaps %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type __libm_exp_k32,@function + .size __libm_exp_k32,.-__libm_exp_k32 + .data +# -- End __libm_exp_k32 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +SC2_BIAS: + .long 511 + .long 1535 + .type SC2_BIAS,@object + .size SC2_BIAS,8 + .align 4 +_SC2: + .long 0 + .long 1609564160 + .long 0 + .long 535822336 + .type _SC2,@object + .size _SC2,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_exp_k64.S b/external/sgx_libm/intel64/libm_exp_k64.S new file mode 100644 index 0000000000..6069cf9943 --- /dev/null +++ b/external/sgx_libm/intel64/libm_exp_k64.S @@ -0,0 +1,260 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_exp_k64.c" + .text +..TXTST0: +# -- Begin __libm_exp_k64 + .text + .align 16,0x90 + .globl __libm_exp_k64 +__libm_exp_k64: +# parameter 1: %xmm0 +# parameter 2: %rdi +# parameter 3: %rsi +..B1.1: + .cfi_startproc +..___tag_value___libm_exp_k64.1: +..L2: + + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %eax + andl $32752, %eax + movb -1(%rsp), %dl + andb $-128, %dl + shrl $4, %eax + shrb $7, %dl + cmpl $2047, %eax + je ..B1.10 +..B1.2: + cmpl $966, %eax + jge ..B1.6 +..B1.3: + movl $0, (%rdi) + cmpl $917, %eax + jge ..B1.5 +..B1.4: + movq $0x3ff0000000000000, %rax + movq %rax, (%rsi) + movq $0, 8(%rsi) + ret +..B1.5: + movsd .L_2il0floatpacket.9(%rip), %xmm0 + movsd -8(%rsp), %xmm2 + movaps %xmm0, %xmm1 + addsd %xmm2, %xmm1 + movsd %xmm1, (%rsi) + subsd %xmm0, %xmm1 + movsd %xmm1, -24(%rsp) + subsd %xmm1, %xmm2 + movsd %xmm2, 8(%rsi) + ret +..B1.6: + cmpl $1035, %eax + jge ..B1.8 +..B1.7: + movsd -8(%rsp), %xmm0 + lea _TWO_52H(%rip), %rax + movsd .L_2il0floatpacket.0(%rip), %xmm4 + movsd .L_2il0floatpacket.1(%rip), %xmm2 + movsd .L_2il0floatpacket.2(%rip), %xmm3 + mulsd %xmm0, %xmm4 + movsd (%rax), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm12 + addsd %xmm1, %xmm4 + movsd %xmm4, -24(%rsp) + subsd %xmm1, %xmm4 + mulsd %xmm4, %xmm2 + mulsd %xmm3, %xmm4 + subsd %xmm2, %xmm0 + movaps %xmm0, %xmm7 + movsd %xmm0, -8(%rsp) + subsd %xmm4, %xmm7 + movaps %xmm7, %xmm8 + subsd %xmm7, %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm9 + subsd %xmm4, %xmm0 + movsd .L_2il0floatpacket.9(%rip), %xmm5 + addsd %xmm0, %xmm8 + addsd %xmm7, %xmm5 + movaps %xmm8, %xmm10 + mulsd %xmm8, %xmm10 + mulsd %xmm10, %xmm12 + mulsd %xmm10, %xmm9 + addsd .L_2il0floatpacket.5(%rip), %xmm12 + addsd .L_2il0floatpacket.7(%rip), %xmm9 + mulsd %xmm10, %xmm12 + mulsd %xmm8, %xmm9 + movsd %xmm5, -16(%rsp) + addsd %xmm9, %xmm12 + movl $0, -16(%rsp) + movsd -16(%rsp), %xmm14 + movsd .L_2il0floatpacket.3(%rip), %xmm6 + movsd .L_2il0floatpacket.8(%rip), %xmm11 + addsd %xmm14, %xmm6 + mulsd %xmm10, %xmm12 + mulsd %xmm10, %xmm11 + subsd %xmm6, %xmm7 + addsd %xmm11, %xmm12 + addsd %xmm7, %xmm0 + movl -24(%rsp), %r8d + movl %r8d, %edx + shll $25, %edx + addsd %xmm12, %xmm0 + sarl $25, %edx + subl %edx, %r8d + movslq %edx, %rdx + shlq $4, %rdx + movq __libm_exp_table_128@GOTPCREL(%rip), %rcx + sarl $7, %r8d + movsd 1032(%rcx,%rdx), %xmm1 + movaps %xmm1, %xmm13 + mulsd %xmm0, %xmm1 + addsd %xmm14, %xmm0 + mulsd %xmm14, %xmm13 + movsd 1024(%rcx,%rdx), %xmm15 + mulsd %xmm0, %xmm15 + movl %r8d, (%rdi) + addsd %xmm15, %xmm1 + movsd %xmm13, (%rsi) + movsd %xmm1, 8(%rsi) + ret +..B1.8: + movzbl %dl, %edx + lea _inf_zeros(%rip), %rax + movl $0, (%rdi) + movq $0, 8(%rsi) + movq (%rax,%rdx,8), %rcx + movq %rcx, (%rsi) +..B1.9: + ret +..B1.10: + testl $1048575, -4(%rsp) + jne ..B1.13 +..B1.11: + cmpl $0, -8(%rsp) + jne ..B1.13 +..B1.12: + movzbl %dl, %edx + lea _inf_zeros(%rip), %rax + movsd (%rax,%rdx,8), %xmm0 + jmp ..B1.14 +..B1.13: + movsd -8(%rsp), %xmm0 +..B1.14: + movl $0, (%rdi) + movsd %xmm0, (%rsi) + movq $0, 8(%rsi) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_exp_k64,@function + .size __libm_exp_k64,.-__libm_exp_k64 + .data +# -- End __libm_exp_k64 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_inf_zeros: + .long 0 + .long 2146435072 + .long 0 + .long 0 + .type _inf_zeros,@object + .size _inf_zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_expl_k80.S b/external/sgx_libm/intel64/libm_expl_k80.S new file mode 100644 index 0000000000..5b62cc0fb1 --- /dev/null +++ b/external/sgx_libm/intel64/libm_expl_k80.S @@ -0,0 +1,395 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_expl_k80.c" + .text +..TXTST0: +# -- Begin __libm_expl_k80 + .text + .align 16,0x90 + .globl __libm_expl_k80 +__libm_expl_k80: +# parameter 1: %rdi +# parameter 2: %rsi +..B1.1: + .cfi_startproc +..___tag_value___libm_expl_k80.1: +..L2: + + fldt (%rsi) + movb 9(%rsi), %dl + movzwl 8(%rsi), %eax + andb $-128, %dl + andl $32767, %eax + shrb $7, %dl + fstpt -24(%rsp) + fldt -24(%rsp) + fldt 16(%rsi) + cmpl $32767, %eax + je ..B1.11 +..B1.2: + cmpl $16358, %eax + jge ..B1.7 +..B1.3: + cmpl $16183, %eax + jge ..B1.5 +..B1.4: + fstp %st(1) + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + fstpt (%rdi) + fldt .L_2il0floatpacket.1(%rip) + fstpt 16(%rdi) + fldt 16(%rdi) + ret +..B1.5: + fldt .L_2il0floatpacket.0(%rip) + lea 16+_P1(%rip), %rax + lea _P1(%rip), %rdx + fldt (%rax) + fmul %st(3), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(3), %st + fmul %st(3), %st + faddp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fadd %st(3), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.1(%rip) +..B1.6: + ret +..B1.7: + cmpl $16405, %eax + jge ..B1.9 +..B1.8: + fldt -24(%rsp) + lea _KLN2(%rip), %rdx + lea _TWO_63H(%rip), %rcx + lea _LN2K(%rip), %r8 + lea 16+_LN2K(%rip), %r9 + lea 64+_P(%rip), %r10 + lea 32+_P(%rip), %r11 + fldt (%rdx) + lea _P(%rip), %rdx + fmulp %st, %st(3) + fldt (%rcx) + lea 48+_P(%rip), %rcx + fadd %st, %st(3) + fxch %st(3) + fstpt -56(%rsp) + fldt -56(%rsp) + movl -56(%rsp), %esi + fsubp %st, %st(3) + fldt (%r8) + fmul %st(3), %st + fstpt -56(%rsp) + fxch %st(2) + fchs + fldt -56(%rsp) + movsbq %sil, %rax + fsubrp %st, %st(3) + fldt (%r9) + subl %eax, %esi + fmulp %st, %st(1) + fstpt -56(%rsp) + fldt -56(%rsp) + sarl $8, %esi + fadd %st(2), %st + fld %st(0) + movl %esi, -40(%rsp) + fsub %st(3), %st + fld %st(1) + lea 16+_P(%rip), %rsi + shlq $4, %rax + fsub %st(1), %st + movq __libm_expl_table_256@GOTPCREL(%rip), %r8 + fsubrp %st, %st(4) + fildl -40(%rsp) + fldt -56(%rsp) + fsubp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fld %st(2) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fld %st(3) + fsub %st(2), %st + fchs + fld %st(0) + fsubr %st(3), %st + fsubrp %st, %st(5) + fsubrp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldl 2056(%r8,%rax) + fldl 2048(%r8,%rax) + fld %st(0) + fmul %st(4), %st + fxch %st(3) + fadd %st, %st(4) + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rdi) + ret +..B1.9: + fstp %st(1) + fstp %st(0) + fldt .L_2il0floatpacket.1(%rip) + lea _inf_zeros(%rip), %rax + movzbl %dl, %edx + fstpt 16(%rdi) + shlq $4, %rdx + fldt (%rax,%rdx) + fstpt (%rdi) + fldt (%rdi) +..B1.10: + ret +..B1.11: + fstp %st(0) + cmpl $-2147483648, -20(%rsp) + jne ..B1.15 +..B1.12: + cmpl $0, -24(%rsp) + jne ..B1.15 +..B1.13: + fstp %st(0) + movzbl %dl, %edx + lea _inf_zeros(%rip), %rax + shlq $4, %rdx + fldt (%rax,%rdx) +..B1.15: + fldt .L_2il0floatpacket.1(%rip) + fstpt 16(%rdi) + fstpt (%rdi) + fldt (%rdi) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_expl_k80,@function + .size __libm_expl_k80,.-__libm_expl_k80 + .data +# -- End __libm_expl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 2 +_P1: + .word 43691 + .word 10 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30584 + .word 43703 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,32 + .align 2 +_KLN2: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16391 + .word 0 + .word 0 + .word 0 + .type _KLN2,@object + .size _KLN2,16 + .align 2 +_TWO_63H: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16446 + .word 0 + .word 0 + .word 0 + .type _TWO_63H,@object + .size _TWO_63H,16 + .align 2 +_LN2K: + .word 0 + .word 0 + .word 6134 + .word 45426 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 55756 + .word 58609 + .word 48341 + .word 59623 + .word 16343 + .word 0 + .word 0 + .word 0 + .type _LN2K,@object + .size _LN2K,32 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_inf_zeros: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _inf_zeros,@object + .size _inf_zeros,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_fegetenv.S b/external/sgx_libm/intel64/libm_fegetenv.S new file mode 100644 index 0000000000..69dc3ea79f --- /dev/null +++ b/external/sgx_libm/intel64/libm_fegetenv.S @@ -0,0 +1,85 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_fegetenv.c" + .text +..TXTST0: +# -- Begin fegetenv + .text + .align 16,0x90 + .globl fegetenv +fegetenv: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value_fegetenv.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movq %rdi, (%rsp) +..B1.2: + stmxcsr 8(%rsp) +..B1.3: + movq (%rsp), %rdx + movl 8(%rsp), %eax + movl %eax, 28(%rdx) +..B1.4: + movq (%rsp), %rax +..B1.5: + fnstenv (%rax) +..B1.6: + fnclex +..B1.7: + fldenv (%rax) +..B1.8: + xorl %eax, %eax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type fegetenv,@function + .size fegetenv,.-fegetenv + .data +# -- End fegetenv + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_hypot2_k64.S b/external/sgx_libm/intel64/libm_hypot2_k64.S new file mode 100644 index 0000000000..2217a31551 --- /dev/null +++ b/external/sgx_libm/intel64/libm_hypot2_k64.S @@ -0,0 +1,320 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_hypot2_k64.c" + .text +..TXTST0: +# -- Begin __libm_hypot2_k64 + .text + .align 16,0x90 + .globl __libm_hypot2_k64 +__libm_hypot2_k64: +# parameter 1: %rdi +# parameter 2: %xmm0 +# parameter 3: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value___libm_hypot2_k64.1: +..L2: + + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %eax + testl $32752, %eax + movsd %xmm1, -16(%rsp) + jne ..B1.8 +..B1.2: + testl $1048575, -20(%rsp) + jne ..B1.8 +..B1.3: + cmpl $0, -24(%rsp) + jne ..B1.8 +..B1.4: + movzwl -10(%rsp), %eax + testl $32752, %eax + jne ..B1.8 +..B1.5: + testl $1048575, -12(%rsp) + jne ..B1.8 +..B1.6: + cmpl $0, -16(%rsp) + jne ..B1.8 +..B1.7: + movq -24(%rsp), %rax + movq -16(%rsp), %rdx + pxor %xmm0, %xmm0 + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + ret +..B1.8: + movsd -24(%rsp), %xmm0 + movsd -16(%rsp), %xmm2 + andps .L_2il0floatpacket.6(%rip), %xmm0 + andps .L_2il0floatpacket.6(%rip), %xmm2 + comisd %xmm2, %xmm0 + jbe ..B1.10 +..B1.9: + movsd %xmm0, -8(%rsp) + movaps %xmm0, %xmm1 + jmp ..B1.11 +..B1.10: + movsd %xmm2, -8(%rsp) + movaps %xmm2, %xmm1 + movaps %xmm0, %xmm2 +..B1.11: + movsd %xmm2, -16(%rsp) + movzwl -10(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + testl %eax, %eax + je ..B1.13 +..B1.12: + addl $-1023, %eax + jmp ..B1.17 +..B1.13: + testl $1048575, -12(%rsp) + jne ..B1.16 +..B1.14: + cmpl $0, -16(%rsp) + jne ..B1.16 +..B1.15: + movl $-10000, %eax + jmp ..B1.17 +..B1.16: + lea 48+_CONSTANTS(%rip), %rax + movaps %xmm2, %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + addl $-2046, %eax +..B1.17: + movzwl -2(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + testl %edx, %edx + je ..B1.19 +..B1.18: + addl $-1023, %edx + jmp ..B1.20 +..B1.19: + lea 48+_CONSTANTS(%rip), %rax + movaps %xmm1, %xmm0 + addl $-2046, %edx + mulsd (%rax), %xmm0 + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %eax + andl $32752, %eax + shrl $4, %eax +..B1.20: + addl $-56, %edx + cmpl %edx, %eax + lea _CONSTANTS(%rip), %rax + pxor %xmm0, %xmm0 + jg ..L3 + movaps %xmm0, %xmm2 +..L3: + comisd (%rax), %xmm1 + jb ..B1.22 +..B1.21: + lea 40+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + movsd %xmm1, -8(%rsp) + movsd %xmm2, -16(%rsp) + movsd .L_2il0floatpacket.0(%rip), %xmm0 + jmp ..B1.28 +..B1.22: + lea 8+_CONSTANTS(%rip), %rax + comisd (%rax), %xmm1 + jb ..B1.24 +..B1.23: + lea 40+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + movsd %xmm1, -8(%rsp) + movsd %xmm2, -16(%rsp) + movsd .L_2il0floatpacket.3(%rip), %xmm0 + jmp ..B1.28 +..B1.24: + lea 16+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm3 + comisd %xmm1, %xmm3 + jb ..B1.26 +..B1.25: + lea 32+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + movsd %xmm1, -8(%rsp) + movsd %xmm2, -16(%rsp) + movsd .L_2il0floatpacket.4(%rip), %xmm0 + jmp ..B1.28 +..B1.26: + lea 24+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm3 + comisd %xmm1, %xmm3 + jb ..B1.28 +..B1.27: + lea 32+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm2 + movsd %xmm1, -8(%rsp) + movsd %xmm2, -16(%rsp) + movsd .L_2il0floatpacket.5(%rip), %xmm0 +..B1.28: + movsd .L_2il0floatpacket.1(%rip), %xmm9 + mulsd %xmm1, %xmm9 + movaps %xmm9, %xmm3 + movsd .L_2il0floatpacket.1(%rip), %xmm14 + subsd %xmm1, %xmm3 + mulsd %xmm2, %xmm14 + subsd %xmm3, %xmm9 + movsd .L_2il0floatpacket.2(%rip), %xmm5 + movaps %xmm9, %xmm6 + mulsd %xmm9, %xmm6 + subsd %xmm9, %xmm1 + mulsd %xmm5, %xmm9 + movaps %xmm14, %xmm4 + movaps %xmm6, %xmm8 + mulsd %xmm1, %xmm9 + subsd %xmm2, %xmm4 + mulsd %xmm1, %xmm1 + subsd %xmm4, %xmm14 + addsd %xmm9, %xmm8 + subsd %xmm14, %xmm2 + movaps %xmm14, %xmm12 + movaps %xmm8, %xmm7 + mulsd %xmm14, %xmm12 + subsd %xmm6, %xmm7 + mulsd %xmm5, %xmm14 + subsd %xmm7, %xmm9 + mulsd %xmm2, %xmm14 + mulsd %xmm2, %xmm2 + addsd %xmm1, %xmm9 + movaps %xmm8, %xmm10 + addsd %xmm12, %xmm10 + movaps %xmm10, %xmm13 + movaps %xmm10, %xmm1 + addsd %xmm14, %xmm13 + subsd %xmm8, %xmm1 + movaps %xmm13, %xmm11 + subsd %xmm1, %xmm12 + subsd %xmm10, %xmm11 + addsd %xmm9, %xmm12 + subsd %xmm11, %xmm14 + movsd %xmm13, (%rdi) + addsd %xmm12, %xmm14 + addsd %xmm2, %xmm14 + movsd %xmm14, 8(%rdi) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_hypot2_k64,@function + .size __libm_hypot2_k64,.-__libm_hypot2_k64 + .data +# -- End __libm_hypot2_k64 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.6: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40a00800 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x02000000,0x41a00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x40900800 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0xc0a00800 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x00000000,0xc0900800 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 4 +_CONSTANTS: + .long 0 + .long 1727004672 + .long 4294967295 + .long 1608515583 + .long 4294967295 + .long 481296383 + .long 0 + .long 651165696 + .long 0 + .long 1610612736 + .long 0 + .long 534773760 + .long 0 + .long 2145386496 + .long 0 + .long 1126170624 + .type _CONSTANTS,@object + .size _CONSTANTS,64 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_hypot2l_k80.S b/external/sgx_libm/intel64/libm_hypot2l_k80.S new file mode 100644 index 0000000000..46053cd7bb --- /dev/null +++ b/external/sgx_libm/intel64/libm_hypot2l_k80.S @@ -0,0 +1,496 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_hypot2l_k80.c" + .text +..TXTST0: +# -- Begin __libm_hypot2l_k80 + .text + .align 16,0x90 + .globl __libm_hypot2l_k80 +__libm_hypot2l_k80: +# parameter 1: %rdi +# parameter 2: 8 + %rsp +# parameter 3: 24 + %rsp +..B1.1: + .cfi_startproc +..___tag_value___libm_hypot2l_k80.1: +..L2: + + movzwl 16(%rsp), %eax + testl $32767, %eax + jne ..B1.6 +..B1.2: + cmpq $0, 8(%rsp) + jne ..B1.6 +..B1.3: + movzwl 32(%rsp), %eax + testl $32767, %eax + jne ..B1.6 +..B1.4: + cmpq $0, 24(%rsp) + jne ..B1.6 +..B1.5: + fldt 8(%rsp) + fstpt (%rdi) + fldt 24(%rsp) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.6: + fldt 8(%rsp) + fabs + fstpt -56(%rsp) + fldt -56(%rsp) + fldt 24(%rsp) + fabs + fstpt -24(%rsp) + fldt -24(%rsp) + movzwl -48(%rsp), %ecx + movzwl -16(%rsp), %esi + andl $32767, %ecx + andl $32767, %esi + cmpl %esi, %ecx + jg ..B1.11 +..B1.7: + jne ..B1.12 +..B1.8: + movl -52(%rsp), %eax + movl -20(%rsp), %edx + cmpl %edx, %eax + ja ..B1.57 +..B1.9: + jne ..B1.56 +..B1.10: + movl -56(%rsp), %eax + cmpl -24(%rsp), %eax + jbe ..B1.56 +..B1.57: + cmpl %esi, %ecx +..B1.11: + fxch %st(1) + fstpt -40(%rsp) + fldt -40(%rsp) + fld %st(0) + fxch %st(2) + fxch %st(1) + fxch %st(2) + jl ..B1.18 + jmp ..B1.14 +..B1.12: + fstpt -40(%rsp) + fldt -40(%rsp) + fld %st(0) +..B1.13: + jl ..B1.18 +..B1.14: + jne ..B1.19 +..B1.15: + movl -52(%rsp), %eax + movl -20(%rsp), %edx + cmpl %edx, %eax + jb ..B1.18 +..B1.16: + jne ..B1.19 +..B1.17: + movl -56(%rsp), %eax + cmpl -24(%rsp), %eax + jae ..B1.19 +..B1.18: + fstp %st(1) + fxch %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + jmp ..B1.20 +..B1.19: + fstp %st(2) + fstpt -24(%rsp) + fldt -24(%rsp) +..B1.20: + movswl -16(%rsp), %ecx + testl %ecx, %ecx + je ..B1.22 +..B1.21: + addl $-16383, %ecx + jmp ..B1.26 +..B1.22: + movzwl -16(%rsp), %eax + testl $32767, %eax + jne ..B1.25 +..B1.23: + cmpq $0, -24(%rsp) + jne ..B1.25 +..B1.24: + movl $-16526, %ecx + jmp ..B1.26 +..B1.25: + lea 96+_CONSTANTS(%rip), %rax + lea 112+_CONSTANTS(%rip), %rdx + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + fmulp %st, %st(1) + fstpt -56(%rsp) + movswl -48(%rsp), %ecx + addl $-32828, %ecx +..B1.26: + movswl -32(%rsp), %eax + testl %eax, %eax + je ..B1.28 +..B1.27: + addl $-16383, %eax + jmp ..B1.29 +..B1.28: + lea 96+_CONSTANTS(%rip), %rax + lea 112+_CONSTANTS(%rip), %rdx + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + fmulp %st, %st(1) + fstpt -56(%rsp) + movswl -48(%rsp), %eax + addl $-32828, %eax +..B1.29: + fldt .L_2il0floatpacket.0(%rip) + addl $-67, %eax + cmpl %eax, %ecx + movzwl -32(%rsp), %eax + jg ..L3 + fst %st(1) +..L3: + andl $32767, %eax + cmpl $24709, %eax + jg ..B1.34 +..B1.30: + jne ..B1.35 +..B1.31: + lea _CONSTANTS(%rip), %rcx + movl -36(%rsp), %edx + cmpl 4(%rcx), %edx + ja ..B1.34 +..B1.32: + jne ..B1.35 +..B1.33: + movl -40(%rsp), %edx + cmpl (%rcx), %edx + jb ..B1.35 +..B1.34: + fstp %st(0) + lea 80+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st, %st(2) + fmul %st, %st(2) + fxch %st(2) + fstpt -40(%rsp) + fldt -40(%rsp) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + fldt .L_2il0floatpacket.1(%rip) + jmp ..B1.53 +..B1.35: + cmpl $24573, %eax + jg ..B1.40 +..B1.36: + jne ..B1.41 +..B1.37: + lea 16+_CONSTANTS(%rip), %rcx + movl -36(%rsp), %edx + cmpl 4(%rcx), %edx + ja ..B1.40 +..B1.38: + jne ..B1.41 +..B1.39: + movl -40(%rsp), %edx + cmpl (%rcx), %edx + jb ..B1.41 +..B1.40: + fstp %st(0) + lea 80+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt -40(%rsp) + fldt -40(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + fldt .L_2il0floatpacket.4(%rip) + jmp ..B1.53 +..B1.41: + cmpl $8127, %eax + jl ..B1.46 +..B1.42: + jne ..B1.47 +..B1.43: + lea 32+_CONSTANTS(%rip), %rcx + movl -36(%rsp), %edx + cmpl 4(%rcx), %edx + jb ..B1.46 +..B1.44: + jne ..B1.47 +..B1.45: + movl -40(%rsp), %edx + cmpl (%rcx), %edx + ja ..B1.47 +..B1.46: + fstp %st(0) + lea 64+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st, %st(2) + fmul %st, %st(2) + fxch %st(2) + fstpt -40(%rsp) + fldt -40(%rsp) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(2) + fxch %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + fldt .L_2il0floatpacket.5(%rip) + jmp ..B1.53 +..B1.47: + cmpl $8323, %eax + jl ..B1.52 +..B1.48: + jne ..B1.53 +..B1.49: + lea 48+_CONSTANTS(%rip), %rdx + movl -36(%rsp), %eax + cmpl 4(%rdx), %eax + jb ..B1.52 +..B1.50: + jne ..B1.53 +..B1.51: + movl -40(%rsp), %eax + cmpl (%rdx), %eax + ja ..B1.53 +..B1.52: + fstp %st(0) + lea 64+_CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt -40(%rsp) + fldt -40(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + fldt .L_2il0floatpacket.6(%rip) +..B1.53: + fldt .L_2il0floatpacket.2(%rip) + fmul %st(3), %st + fld %st(3) + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(3) + fxch %st(2) + fsubr %st, %st(5) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(5), %st + fsub %st, %st(3) + fsubp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(5) + fldt .L_2il0floatpacket.3(%rip) + fmul %st, %st(2) + fxch %st(2) + fmul %st(7), %st + fxch %st(2) + fmulp %st, %st(1) + fmul %st(5), %st + fld %st(2) + fadd %st(2), %st + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(2) + fxch %st(6) + fmul %st(0), %st + faddp %st, %st(1) + fld %st(1) + fadd %st(3), %st + fld %st(0) + fadd %st(7), %st + fstpt (%rdi) + fldt (%rdi) + fxch %st(1) + fsub %st, %st(3) + fxch %st(3) + fsubrp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fxch %st(4) + fmul %st(0), %st + fxch %st(4) + fsubp %st, %st(1) + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rdi) + ret +..B1.56: + cmpl %esi, %ecx + jmp ..B1.12 + .align 16,0x90 + .cfi_endproc + .type __libm_hypot2l_k80,@function + .size __libm_hypot2l_k80,.-__libm_hypot2l_k80 + .data +# -- End __libm_hypot2l_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0e,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0d,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0e,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x0d,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24709 + .word 0 + .word 0 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 24573 + .word 0 + .word 0 + .word 0 + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 8127 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8323 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24576 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8190 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16445 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,128 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_log1pl_k80.S b/external/sgx_libm/intel64/libm_log1pl_k80.S new file mode 100644 index 0000000000..0f91f7acfd --- /dev/null +++ b/external/sgx_libm/intel64/libm_log1pl_k80.S @@ -0,0 +1,2003 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_log1pl_k80.c" + .text +..TXTST0: +# -- Begin __libm_log1p_k80 + .text + .align 16,0x90 + .globl __libm_log1p_k80 +__libm_log1p_k80: +# parameter 1: %rdi +# parameter 2: %rsi +..B1.1: + .cfi_startproc +..___tag_value___libm_log1p_k80.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + subq $120, %rsp + .cfi_def_cfa_offset 144 + movq %rsi, %r14 + movq %fs:40, %rax + movq %rdi, %r13 + xorq %rsp, %rax + movq %rax, 112(%rsp) + movzwl 8(%r14), %edx + andl $32767, %edx + movl 32(%r14), %ecx + lea (%rcx,%rdx), %eax + cmpl $16511, %eax + jge ..B1.9 +..B1.2: + cmpl $16255, %eax + jle ..B1.8 +..B1.3: + addl $-8383, %edx + cmpl $16000, %edx + jbe ..B1.6 +..B1.4: + movq %r14, %rdi +..___tag_value___libm_log1p_k80.8: + call __libm_normalizel_k80@PLT +..___tag_value___libm_log1p_k80.9: +..B1.5: + movl 32(%r14), %ecx +..B1.6: + fldt (%r14) + addl $16383, %ecx + fldt 16(%r14) + andl $32767, %ecx + andb $127, 9(%rsp) + lea 80(%rsp), %rdi + movzwl -72(%rdi), %eax + lea 48(%rsp), %rsi + andl $-32768, %eax + orl %ecx, %eax + movw %ax, -40(%rsi) + movl $-2147483648, -44(%rsi) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt (%rsi) + fmulp %st, %st(1) + fstpt 16(%rsi) +..___tag_value___libm_log1p_k80.10: + call __libm_log1pl_k80@PLT +..___tag_value___libm_log1p_k80.11: +..B1.7: + fldt 80(%rsp) + fmul %st(1), %st + movl $0, 32(%r13) + fstpt (%r13) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpt 16(%r13) + jmp ..B1.19 +..B1.8: + movq (%r14), %rax + movq %rax, (%r13) + movq 8(%r14), %rdx + movq %rdx, 8(%r13) + movq 16(%r14), %rcx + movq %rcx, 16(%r13) + movq 24(%r14), %rsi + movq %rsi, 24(%r13) + movq 32(%r14), %r8 + movq %r8, 32(%r13) + movq 40(%r14), %rdi + movq %rdi, 40(%r13) + jmp ..B1.19 +..B1.9: + movq %r14, %rdi +..___tag_value___libm_log1p_k80.12: + call __libm_normalizel_k80@PLT +..___tag_value___libm_log1p_k80.13: +..B1.10: + fildl 32(%r14) + fstpt (%rsp) + fldt (%r14) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt 16(%r14) + fstpt 64(%rsp) + fldt 64(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 176 + lea 112(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_log1p_k80.15: + call __libm_logl_k80@PLT +..___tag_value___libm_log1p_k80.16: +..B1.25: + addq $32, %rsp + .cfi_def_cfa_offset 144 +..B1.11: + fldt 80(%rsp) + lea _LN2_K80(%rip), %rax + lea 16+_LN2_K80(%rip), %rdx + fmul %st(1), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fldt 96(%rsp) + fmulp %st, %st(2) + movzwl 88(%rsp), %esi + andl $32767, %esi + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt (%rax) + fldt (%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(0) + movzwl 24(%rsp), %ecx + fadd %st(4), %st + fldt (%rdx) + andl $32767, %ecx + fmulp %st, %st(3) + cmpl %esi, %ecx + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + movl $0, 32(%r13) + jg ..B1.16 +..B1.12: + jne ..B1.17 +..B1.13: + movl 20(%rsp), %eax + movl 84(%rsp), %edx + cmpl %edx, %eax + ja ..B1.16 +..B1.14: + jne ..B1.17 +..B1.15: + movl 16(%rsp), %eax + cmpl 80(%rsp), %eax + jbe ..B1.17 +..B1.16: + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.18 +..B1.17: + fxch %st(2) + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) +..B1.18: + fld %st(1) + fadd %st(1), %st + fstpt (%r13) + fldt (%r13) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%r13) +..B1.19: + movq 112(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.21 +..B1.20: + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 13, -16 + .cfi_offset 14, -24 +..B1.21: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __libm_log1p_k80,@function + .size __libm_log1p_k80,.-__libm_log1p_k80 + .data +# -- End __libm_log1p_k80 + .text +# -- Begin __libm_log1pl_k80 + .text + .align 16,0x90 + .globl __libm_log1pl_k80 +__libm_log1pl_k80: +# parameter 1: %rdi +# parameter 2: %rsi +..B2.1: + .cfi_startproc +..___tag_value___libm_log1pl_k80.27: +..L28: + + subq $440, %rsp + .cfi_def_cfa_offset 448 + movq %rsi, %rax + movq %fs:40, %rdx + movq %rdi, %r9 + xorq %rsp, %rdx + lea zeros(%rip), %r8 + movq %rdx, 432(%rsp) + fldt (%rax) + fld %st(0) + fldt 16(%rax) + fadd %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fsub %st, %st(2) + movzbl 9(%rsp), %edi + fxch %st(2) + fsubrp %st, %st(1) + fldt (%r8) + andl $128, %edi + shrl $7, %edi + movl %edi, %edx + movzwl 8(%rsp), %esi + shll $15, %edx + andl $32767, %esi + movl 4(%rsp), %r10d + orl %esi, %edx + movl %r10d, %ecx + shll $16, %edx + shrl $16, %ecx + orl %ecx, %edx + fstpt 16(%r9) + fldt 16(%r9) + cmpl $32767, %esi + je ..B2.115 +..B2.2: + cmpl $-1073774592, %edx + jae ..B2.101 +..B2.3: + fstp %st(1) + fstpt (%r9) + fldt (%r9) +..B2.4: + cmpl $16375, %esi + jge ..B2.52 +..B2.5: + fstp %st(0) + cmpl $16363, %esi + jge ..B2.30 +..B2.6: + fstp %st(0) + cmpl $16298, %esi + jge ..B2.8 +..B2.7: + fldt (%rax) + fstpt (%r9) + fldt 16(%rax) + lea ones(%rip), %rax + fstpt 16(%r9) + fldt (%rax) + jmp ..B2.104 +..B2.8: + fldt (%rax) + lea t32(%rip), %rdx + fld %st(0) + fld %st(1) + lea 32+_S(%rip), %rcx + lea _S(%rip), %rsi + lea 16+_S(%rip), %rdi + lea 64+_S(%rip), %r8 + fldt (%rdx) + fmul %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(2) + fld %st(1) + fld %st(3) + fsub %st(3), %st + fmul %st, %st(1) + fxch %st(1) + fadd %st(0), %st + fld %st(0) + fld %st(4) + fmul %st(5), %st + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(2) + fld %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(5) + fxch %st(4) + fstpt 16(%rsp) + fldt 16(%rsp) + fxch %st(5) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(3) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt 16(%rax) + fmulp %st, %st(5) + fxch %st(4) + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(5) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fldt (%rcx) + fld %st(0) + fmul %st(2), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fxch %st(1) + fmul %st(3), %st + fstpt (%rsp) + fldt (%rsp) + fstpt 320(%rsp) + fld %st(1) + fsub %st(6), %st + faddp %st, %st(6) + fld %st(1) + fsub %st(6), %st + fxch %st(1) + fstpt 304(%rsp) + fxch %st(6) + fmulp %st, %st(2) + fld %st(2) + fmul %st(5), %st + fxch %st(3) + fmul %st(6), %st + fxch %st(4) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(4) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldt 16(%rax) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt (%rsi) + fld %st(0) + fld %st(1) + fldt 16(%rsp) + fld %st(0) + fmul %st(4), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + fxch %st(1) + fmul %st(6), %st + fsubr %st, %st(4) + faddp %st, %st(4) + fxch %st(3) + fstpt 80(%rsp) + fldt 80(%rsp) + fld %st(5) + fsub %st(1), %st + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(2) + fmul %st(4), %st + fldt (%rdi) + fmul %st(6), %st + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 336(%rsp) + fldt 336(%rsp) + fsubr %st, %st(1) + movzwl 344(%rsp), %r10d + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + andl $32767, %r10d + fstpt 352(%rsp) + fldt 32(%rsp) + fld %st(0) + fxch %st(1) + fmul %st(3), %st + fldt 80(%rsp) + fmul %st, %st(2) + fldt 48(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fld %st(1) + fldt (%rax) + fmul %st, %st(5) + fldt 16(%rax) + fmulp %st, %st(7) + fxch %st(6) + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fldt (%r8) + fmul %st, %st(4) + fxch %st(4) + fstpt 368(%rsp) + fldt 368(%rsp) + fadd %st, %st(1) + fxch %st(4) + fmulp %st, %st(3) + movzwl 376(%rsp), %r11d + andl $32767, %r11d + fxch %st(2) + fstpt 384(%rsp) + fldt 384(%rsp) + cmpl %r11d, %r10d + fldt 64(%rsp) + fldt 96(%rsp) + jg ..B2.13 +..B2.9: + jne ..B2.14 +..B2.10: + movl 340(%rsp), %edx + movl 372(%rsp), %ecx + cmpl %ecx, %edx + ja ..B2.13 +..B2.11: + jne ..B2.14 +..B2.12: + movl 336(%rsp), %edx + cmpl 368(%rsp), %edx + jbe ..B2.14 +..B2.13: + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(5) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + jmp ..B2.15 +..B2.14: + fxch %st(4) + fsubr %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) +..B2.15: + fld %st(2) + movzwl 312(%rsp), %edx + fadd %st(1), %st + fstpt 400(%rsp) + fldt 400(%rsp) + andl $32767, %edx + movzwl 408(%rsp), %ecx + fld %st(2) + andl $32767, %ecx + fadd %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + cmpl %ecx, %edx + fxch %st(2) + faddp %st, %st(4) + fxch %st(3) + fstpt 416(%rsp) + fldt 416(%rsp) + jg ..B2.20 +..B2.16: + jne ..B2.21 +..B2.17: + movl 308(%rsp), %edx + movl 404(%rsp), %ecx + cmpl %ecx, %edx + ja ..B2.20 +..B2.18: + jne ..B2.21 +..B2.19: + movl 304(%rsp), %edx + cmpl 400(%rsp), %edx + jbe ..B2.21 +..B2.20: + fldt (%rsp) + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.22 +..B2.21: + fldt (%rsp) + fxch %st(2) + fsub %st(4), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) +..B2.22: + fld %st(0) + movzwl 8(%rax), %edx + fadd %st(2), %st + fstpt 272(%rsp) + fldt 272(%rsp) + andl $32767, %edx + movzwl 280(%rsp), %ecx + fsubr %st, %st(2) + andl $32767, %ecx + fxch %st(2) + faddp %st, %st(1) + fstpt 288(%rsp) + fldt 288(%rsp) + cmpl %ecx, %edx + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 16(%r9) + fldt 16(%r9) + jg ..B2.27 +..B2.23: + jne ..B2.28 +..B2.24: + movl 276(%rsp), %edx + cmpl 4(%rax), %edx + jb ..B2.27 +..B2.25: + jne ..B2.28 +..B2.26: + movl (%rax), %edx + cmpl 272(%rsp), %edx + jbe ..B2.28 +..B2.27: + fldt (%rax) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rax) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + jmp ..B2.29 +..B2.28: + fldt (%rax) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 16(%rax) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) +..B2.29: + fld %st(1) + lea ones(%rip), %rax + fadd %st(1), %st + fstpt (%r9) + fldt (%r9) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%r9) + fldt (%rax) + jmp ..B2.104 +..B2.30: + fldt (%rax) + lea t32(%rip), %rdx + fld %st(0) + fld %st(1) + fld %st(2) + lea _S(%rip), %rcx + fxch %st(4) + fstpt 48(%rsp) + lea 16+_S(%rip), %rsi + fldt (%rdx) + lea 32+_S(%rip), %rdi + fmul %st, %st(2) + lea 176+_S(%rip), %r10 + lea 64+_S(%rip), %r8 + lea 160+_S(%rip), %r11 + lea 144+_S(%rip), %rdx + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(2) + fld %st(1) + fld %st(2) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(5) + fxch %st(1) + fmul %st(5), %st + fadd %st(0), %st + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(5) + fmul %st(6), %st + faddp %st, %st(4) + fld %st(4) + fxch %st(3) + fstpt 64(%rsp) + fldt 64(%rsp) + fxch %st(2) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt 16(%rax) + fmulp %st, %st(4) + fxch %st(3) + fadd %st(0), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fld %st(3) + fmul %st(3), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fxch %st(4) + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(1) + fsub %st(3), %st + fmul %st, %st(4) + fxch %st(3) + fmul %st(7), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(5), %st + fsubr %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(4) + fld %st(4) + fmulp %st, %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fldt 16(%rax) + fldt 64(%rsp) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fmul %st, %st(3) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fld %st(1) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fld %st(1) + fsub %st(1), %st + fldt 80(%rsp) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(3) + fmul %st(7), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fldt 16(%rax) + fmul %st(3), %st + faddp %st, %st(5) + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fstpt 128(%rsp) + fldt 128(%rsp) + faddp %st, %st(3) + fldt 48(%rsp) + fmulp %st, %st(3) + fxch %st(2) + fstpt (%rsp) + fldt (%rcx) + lea 128+_S(%rip), %rcx + fld %st(0) + fld %st(1) + fxch %st(2) + fmul %st, %st(3) + fldt 64(%rsp) + fmulp %st, %st(1) + fsubr %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fmul %st(5), %st + fxch %st(2) + fmul %st, %st(5) + fldt 112(%rsp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(4) + fldt 16(%rsp) + fldt (%rsi) + lea 112+_S(%rip), %rsi + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fstpt 336(%rsp) + fldt 336(%rsp) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fstpt 352(%rsp) + fldt 352(%rsp) + fldt (%rdi) + lea 96+_S(%rip), %rdi + fmul %st, %st(2) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 320(%rsp) + fldt 96(%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 304(%rsp) + fldt 304(%rsp) + fldt (%r8) + lea 80+_S(%rip), %r8 + fldt 32(%rsp) + fmul %st(1), %st + fstpt 368(%rsp) + fldt 368(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt 128(%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 384(%rsp) + fldt 384(%rsp) + fldt (%r10) + fldt 48(%rsp) + fmul %st, %st(1) + fldt (%r11) + movzwl 344(%rsp), %r10d + faddp %st, %st(2) + fmul %st, %st(1) + andl $32767, %r10d + fldt (%rdx) + movzwl 376(%rsp), %edx + faddp %st, %st(2) + fmul %st, %st(1) + andl $32767, %edx + fldt (%rcx) + cmpl %edx, %r10d + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rsi) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdi) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt (%r8) + faddp %st, %st(1) + fld %st(5) + faddp %st, %st(3) + fldt (%rsp) + fmulp %st, %st(1) + fstpt (%rsp) + fldt (%rax) + jg ..B2.35 +..B2.31: + jne ..B2.36 +..B2.32: + movl 340(%rsp), %edx + movl 372(%rsp), %ecx + cmpl %ecx, %edx + ja ..B2.35 +..B2.33: + jne ..B2.36 +..B2.34: + movl 336(%rsp), %edx + cmpl 368(%rsp), %edx + jbe ..B2.36 +..B2.35: + fldt 32(%rsp) + fxch %st(3) + fsubr %st, %st(6) + fxch %st(3) + faddp %st, %st(6) + fxch %st(1) + faddp %st, %st(5) + fxch %st(3) + faddp %st, %st(4) + jmp ..B2.37 +..B2.36: + fldt 32(%rsp) + fsub %st(3), %st + faddp %st, %st(6) + fxch %st(4) + faddp %st, %st(5) + faddp %st, %st(4) +..B2.37: + fld %st(3) + movzwl 312(%rsp), %edx + fadd %st(1), %st + fstpt 400(%rsp) + fldt 400(%rsp) + andl $32767, %edx + movzwl 408(%rsp), %ecx + fsubr %st, %st(1) + andl $32767, %ecx + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) + fstpt 416(%rsp) + fldt 416(%rsp) + fld %st(1) + cmpl %ecx, %edx + fadd %st(4), %st + jg ..B2.42 +..B2.38: + jne ..B2.43 +..B2.39: + movl 308(%rsp), %edx + movl 404(%rsp), %ecx + cmpl %ecx, %edx + ja ..B2.42 +..B2.40: + jne ..B2.43 +..B2.41: + movl 304(%rsp), %edx + cmpl 400(%rsp), %edx + jbe ..B2.43 +..B2.42: + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 16(%rsp) + faddp %st, %st(1) + fxch %st(2) + jmp ..B2.44 +..B2.43: + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fldt 16(%rsp) + faddp %st, %st(4) + faddp %st, %st(3) +..B2.44: + fld %st(2) + movzwl 8(%rax), %edx + fadd %st(1), %st + fstpt 272(%rsp) + fldt 272(%rsp) + andl $32767, %edx + movzwl 280(%rsp), %ecx + fsubr %st, %st(1) + andl $32767, %ecx + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + fstpt 288(%rsp) + fldt 288(%rsp) + cmpl %ecx, %edx + fxch %st(1) + fadd %st(2), %st + fstpt 16(%r9) + fldt 16(%r9) + jg ..B2.49 +..B2.45: + jne ..B2.50 +..B2.46: + movl 276(%rsp), %edx + cmpl 4(%rax), %edx + jb ..B2.49 +..B2.47: + jne ..B2.50 +..B2.48: + movl (%rax), %edx + cmpl 272(%rsp), %edx + jbe ..B2.50 +..B2.49: + fldt (%rax) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rax) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + jmp ..B2.51 +..B2.50: + fldt (%rax) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 16(%rax) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) +..B2.51: + fld %st(1) + lea ones(%rip), %rax + fadd %st(1), %st + fstpt (%r9) + fldt (%r9) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt (%rsp) + faddp %st, %st(1) + fstpt 16(%r9) + fldt (%rax) + jmp ..B2.104 +..B2.52: + fstp %st(1) + fldt (%rax) + lea ones(%rip), %r8 + movzwl 8(%rax), %edx + fld %st(0) + andl $32767, %edx + fldt (%r8) + movzwl 8(%r8), %edi + movl %edi, %esi + andl $32767, %esi + fadd %st, %st(1) + cmpl %esi, %edx + jg ..B2.57 +..B2.53: + jne ..B2.58 +..B2.54: + movl 4(%rax), %edx + cmpl 4(%r8), %edx + ja ..B2.57 +..B2.55: + jne ..B2.58 +..B2.56: + movl (%rax), %edx + cmpl (%r8), %edx + jbe ..B2.58 +..B2.57: + fldt 16(%rax) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + fadd %st, %st(3) + fxch %st(3) + fadd %st(4), %st + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.59 +..B2.58: + fldt 16(%rax) + fld %st(1) + fsub %st(3), %st + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fadd %st(3), %st +..B2.59: + fld %st(0) + movq __libm_rcp_table_256@GOTPCREL(%rip), %r10 + fadd %st(2), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubr %st, %st(2) + movzwl 120(%rsp), %ecx + fxch %st(2) + faddp %st, %st(1) + movl 116(%rsp), %eax + andl $32767, %ecx + shrl $23, %eax + movzbl %al, %eax + fstpt 128(%rsp) + fldt 128(%rsp) + lea -16383(%rcx), %edx + cmpl $16383, %edx + flds (%r10,%rax,4) + jge ..B2.61 +..B2.60: + movl %edx, %r10d + andl $-32768, %edi + negl %r10d + addl $16383, %r10d + andl $32767, %r10d + fxch %st(3) + fstpt (%rsp) + fldt (%rsp) + orl %r10d, %edi + movw %di, 8(%rsp) + fldt (%rsp) + fxch %st(1) + fxch %st(4) + fxch %st(1) + jmp ..B2.62 +..B2.61: + lea _CONSTANTS(%rip), %rdi + fldt (%rdi) +..B2.62: + movzwl 136(%rsp), %edi + andl $32767, %edi + addl $128, %edi + fmul %st, %st(3) + cmpl %edi, %ecx + jge ..B2.64 +..B2.63: + fmulp %st, %st(2) + fxch %st(1) + jmp ..B2.65 +..B2.64: + fstp %st(0) + fstp %st(1) + fld %st(3) +..B2.65: + movl %edx, 96(%rsp) + lea _LN2(%rip), %rdx + fildl 96(%rsp) + lea 16+_LN2(%rip), %rcx + fxch %st(4) + fstpt 64(%rsp) + shlq $4, %rax + movq __libm_logl_table_256@GOTPCREL(%rip), %rdi + fstpt 80(%rsp) + fld %st(1) + fldt (%rdx) + fmul %st(4), %st + fldt (%rcx) + fmulp %st, %st(5) + fld %st(3) + fxch %st(1) + faddl (%rax,%rdi) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 240(%rsp) + fld %st(3) + fxch %st(4) + fmul %st(6), %st + fxch %st(5) + faddl 8(%rdi,%rax) + lea t32(%rip), %rax + fstpt (%rsp) + fld %st(2) + fldt (%rax) + fmul %st, %st(3) + fxch %st(3) + fsubr %st, %st(5) + faddp %st, %st(5) + fxch %st(1) + fsub %st(4), %st + fxch %st(1) + fmul %st(2), %st + fxch %st(2) + fstpt 32(%rsp) + fld %st(2) + fsub %st(2), %st + faddp %st, %st(2) + fld %st(2) + fsub %st(2), %st + fld %st(4) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(5) + fxch %st(3) + faddp %st, %st(5) + fld %st(4) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 80(%rsp) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubr %st, %st(1) + movzwl 120(%rsp), %r10d + fxch %st(1) + faddp %st, %st(2) + andl $32767, %r10d + fxch %st(1) + fstpt 128(%rsp) + fldt 128(%rsp) + cmpl %esi, %r10d + fldt 64(%rsp) + fld %st(0) + fsubr %st(3), %st + fstpt 48(%rsp) + jg ..B2.70 +..B2.66: + jne ..B2.71 +..B2.67: + movl 116(%rsp), %eax + cmpl 4(%r8), %eax + ja ..B2.70 +..B2.68: + jne ..B2.71 +..B2.69: + movl 112(%rsp), %eax + cmpl (%r8), %eax + jbe ..B2.71 +..B2.70: + fldt 48(%rsp) + fsubrp %st, %st(3) + fsubr %st, %st(2) + fxch %st(3) + fsubrp %st, %st(2) + faddp %st, %st(1) + jmp ..B2.72 +..B2.71: + fldt 48(%rsp) + fadd %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) +..B2.72: + fldt 48(%rsp) + lea _S(%rip), %rax + fld %st(0) + lea 16+_S(%rip), %rdx + lea 32+_S(%rip), %rcx + lea 64+_S(%rip), %rsi + lea 176+_S(%rip), %rdi + lea 160+_S(%rip), %r8 + lea 144+_S(%rip), %r10 + lea 128+_S(%rip), %r11 + fadd %st(2), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 144(%rsp) + fxch %st(2) + fstpt 64(%rsp) + fld %st(0) + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(1) + fstpt 256(%rsp) + fldt 256(%rsp) + fldt 32(%rsp) + fld %st(0) + fmul %st(2), %st + fsubr %st, %st(4) + faddp %st, %st(4) + fld %st(3) + fld %st(2) + fsub %st(5), %st + fmul %st, %st(1) + fxch %st(1) + fadd %st(0), %st + fld %st(0) + fld %st(6) + fmul %st(7), %st + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(2) + fld %st(2) + fmul %st(3), %st + faddp %st, %st(2) + fld %st(5) + fmul %st(5), %st + fadd %st(0), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fmul %st, %st(4) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fld %st(1) + fsub %st(4), %st + faddp %st, %st(4) + fxch %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fld %st(6) + fmul %st(4), %st + fxch %st(1) + fsub %st(4), %st + fxch %st(3) + fmul %st, %st(4) + fxch %st(7) + fstpt 160(%rsp) + fldt 160(%rsp) + fmul %st(3), %st + faddp %st, %st(4) + fld %st(3) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fxch %st(2) + fmul %st(6), %st + faddp %st, %st(2) + fld %st(3) + fmulp %st, %st(1) + fld %st(4) + fldt 176(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fstpt 192(%rsp) + fldt 192(%rsp) + fldt 32(%rsp) + fldt 160(%rsp) + fxch %st(1) + fmul %st(2), %st + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fstpt 208(%rsp) + fldt 208(%rsp) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fmul %st(7), %st + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(1) + fld %st(2) + fmulp %st, %st(4) + fldt 192(%rsp) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fstpt 224(%rsp) + fldt 224(%rsp) + faddp %st, %st(2) + fldt 144(%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 80(%rsp) + fldt (%rax) + lea 112+_S(%rip), %rax + fld %st(0) + fld %st(1) + fxch %st(2) + fmul %st, %st(3) + fldt 32(%rsp) + fmulp %st, %st(1) + fsubr %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fmul %st(5), %st + fxch %st(2) + fmul %st, %st(5) + fldt 208(%rsp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(4) + fldt 96(%rsp) + fldt (%rdx) + lea 96+_S(%rip), %rdx + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fstpt 336(%rsp) + fldt 336(%rsp) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fstpt 352(%rsp) + fldt 352(%rsp) + fldt (%rcx) + lea 80+_S(%rip), %rcx + fmul %st, %st(2) + fxch %st(2) + fstpt 96(%rsp) + fldt 96(%rsp) + fstpt 320(%rsp) + fldt 176(%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 304(%rsp) + fldt 304(%rsp) + fldt (%rsi) + fldt 112(%rsp) + fmul %st(1), %st + fstpt 368(%rsp) + fldt 368(%rsp) + movzwl 344(%rsp), %esi + andl $32767, %esi + fstpt 112(%rsp) + fldt 112(%rsp) + fldt 224(%rsp) + fmulp %st, %st(2) + fxch %st(1) + fstpt 384(%rsp) + fldt 384(%rsp) + fldt (%rdi) + fldt 144(%rsp) + fmul %st, %st(1) + fldt (%r8) + movzwl 376(%rsp), %edi + faddp %st, %st(2) + fmul %st, %st(1) + andl $32767, %edi + fldt (%r10) + cmpl %edi, %esi + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r11) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdx) + faddp %st, %st(2) + fmulp %st, %st(1) + fldt (%rcx) + faddp %st, %st(1) + fldt 80(%rsp) + fmulp %st, %st(1) + fstpt 80(%rsp) + fld %st(4) + faddp %st, %st(2) + fldt 64(%rsp) + fldt 128(%rsp) + jg ..B2.77 +..B2.73: + jne ..B2.78 +..B2.74: + movl 340(%rsp), %eax + movl 372(%rsp), %edx + cmpl %edx, %eax + ja ..B2.77 +..B2.75: + jne ..B2.78 +..B2.76: + movl 336(%rsp), %eax + cmpl 368(%rsp), %eax + jbe ..B2.78 +..B2.77: + fldt 112(%rsp) + fxch %st(4) + fsubr %st, %st(7) + fxch %st(4) + faddp %st, %st(7) + fxch %st(2) + faddp %st, %st(6) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fxch %st(4) + jmp ..B2.79 +..B2.78: + fldt 112(%rsp) + fsub %st(4), %st + faddp %st, %st(7) + fxch %st(5) + faddp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) +..B2.79: + fld %st(0) + movzwl 312(%rsp), %eax + fadd %st(2), %st + fstpt 400(%rsp) + fldt 400(%rsp) + andl $32767, %eax + movzwl 408(%rsp), %edx + fld %st(3) + andl $32767, %edx + fadd %st(1), %st + fxch %st(1) + fsubr %st, %st(3) + cmpl %edx, %eax + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 416(%rsp) + fldt 416(%rsp) + jg ..B2.84 +..B2.80: + jne ..B2.85 +..B2.81: + movl 308(%rsp), %eax + movl 404(%rsp), %edx + cmpl %edx, %eax + ja ..B2.84 +..B2.82: + jne ..B2.85 +..B2.83: + movl 304(%rsp), %eax + cmpl 400(%rsp), %eax + jbe ..B2.85 +..B2.84: + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 96(%rsp) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.86 +..B2.85: + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fldt 96(%rsp) + faddp %st, %st(2) + faddp %st, %st(1) +..B2.86: + fld %st(0) + movzwl 264(%rsp), %eax + fadd %st(2), %st + fstpt 272(%rsp) + fldt 272(%rsp) + andl $32767, %eax + movzwl 280(%rsp), %edx + fld %st(3) + andl $32767, %edx + fadd %st(1), %st + fxch %st(1) + fsubr %st, %st(3) + cmpl %edx, %eax + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 288(%rsp) + fldt 288(%rsp) + jg ..B2.91 +..B2.87: + jne ..B2.92 +..B2.88: + movl 260(%rsp), %eax + movl 276(%rsp), %edx + cmpl %edx, %eax + ja ..B2.91 +..B2.89: + jne ..B2.92 +..B2.90: + movl 256(%rsp), %eax + cmpl 272(%rsp), %eax + jbe ..B2.92 +..B2.91: + fldt 48(%rsp) + fxch %st(2) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.93 +..B2.92: + fldt 48(%rsp) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) +..B2.93: + fldt 80(%rsp) + fld %st(1) + movzwl 248(%rsp), %edx + fadd %st(3), %st + fstpt 32(%rsp) + fldt 32(%rsp) + andl $32767, %edx + movzwl 40(%rsp), %eax + fsubr %st, %st(3) + andl $32767, %eax + fxch %st(2) + faddp %st, %st(3) + cmpl %edx, %eax + faddp %st, %st(2) + fldt 16(%rsp) + fadd %st(1), %st + jg ..B2.98 +..B2.94: + jne ..B2.99 +..B2.95: + movl 36(%rsp), %eax + movl 244(%rsp), %edx + cmpl %edx, %eax + ja ..B2.98 +..B2.96: + jne ..B2.99 +..B2.97: + movl 32(%rsp), %eax + cmpl 240(%rsp), %eax + jbe ..B2.99 +..B2.98: + fldt 16(%rsp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt (%rsp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + jmp ..B2.100 +..B2.99: + fldt 16(%rsp) + fsub %st(1), %st + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt (%rsp) + faddp %st, %st(1) +..B2.100: + fld %st(0) + fadd %st(2), %st + fstpt (%r9) + fldt (%r9) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%r9) + jmp ..B2.104 +..B2.101: + cmpl $1, %edi + je ..B2.108 +..B2.122: + fstp %st(1) +..B2.102: + lea 16+ones(%rip), %rax + fldt (%rax) + fxch %st(2) + fucomip %st(2), %st + jp ..B2.103 + je ..B2.107 +..B2.103: + fstp %st(1) + lea _infs(%rip), %rax + lea ones(%rip), %rdx + fldl (%rax) + fmulp %st, %st(1) + fstpt (%r9) + fldt (%rdx) +..B2.104: + movq 432(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.106 +..B2.105: + addq $440, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 448 +..B2.106: + fstp %st(0) + call __stack_chk_fail@PLT +..B2.107: + fdivrp %st, %st(1) + lea ones(%rip), %rax + fstpt (%r9) + fldt (%rax) + jmp ..B2.104 +..B2.108: + cmpl $16383, %esi + jne ..B2.122 +..B2.109: + movq $0x8000000000000000, %rdx + cmpq (%rsp), %rdx + jne ..B2.122 +..B2.110: + fxch %st(1) + fstpt (%rsp) + testb $-128, 9(%rsp) + jne ..B2.102 +..B2.111: + cmpl $0, 4(%rsp) + jne ..B2.114 +..B2.113: + cmpl $0, (%rsp) + je ..B2.102 +..B2.114: + fstpt (%r9) + fldt (%r9) + jmp ..B2.4 +..B2.115: + fstp %st(1) + testl %edi, %edi + je ..B2.119 +..B2.116: + cmpl $-2147483648, %r10d + jne ..B2.119 +..B2.117: + cmpl $0, (%rsp) + jne ..B2.119 +..B2.118: + fstp %st(1) + lea _infs(%rip), %rax + lea ones(%rip), %rdx + fldl (%rax) + fmulp %st, %st(1) + fstpt (%r9) + fldt (%rdx) + jmp ..B2.104 +..B2.119: + fstp %st(0) + lea ones(%rip), %rax + fldt (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt (%r9) + jmp ..B2.104 + .align 16,0x90 + .cfi_endproc + .type __libm_log1pl_k80,@function + .size __libm_log1pl_k80,.-__libm_log1pl_k80 + .data +# -- End __libm_log1pl_k80 + .section .rodata, "a" + .align 16 + .align 16 +zeros: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type zeros,@object + .size zeros,32 + .align 16 +ones: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type ones,@object + .size ones,32 + .align 16 +t32: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t32,@object + .size t32,32 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_LN2_K80: + .word 0 + .word 0 + .word 6136 + .word 45426 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 12704 + .word 55409 + .word 6480 + .word 47298 + .word 49116 + .word 0 + .word 0 + .word 0 + .type _LN2_K80,@object + .size _LN2_K80,32 + .align 2 +_S: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 52429 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 37449 + .word 18724 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 52429 + .word 52428 + .word 52428 + .word 52428 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 11916 + .word 59578 + .word 35746 + .word 47662 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _S,@object + .size _S,192 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,16 + .align 2 +_LN2: + .word 0 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 2022 + .word 26416 + .word 37831 + .word 62295 + .word 16333 + .word 0 + .word 0 + .word 0 + .type _LN2,@object + .size _LN2,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_log_k32.S b/external/sgx_libm/intel64/libm_log_k32.S new file mode 100644 index 0000000000..f6a4e7083c --- /dev/null +++ b/external/sgx_libm/intel64/libm_log_k32.S @@ -0,0 +1,164 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_log_k32.c" + .text +..TXTST0: +# -- Begin __libm_log_k32 + .text + .align 16,0x90 + .globl __libm_log_k32 +__libm_log_k32: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___libm_log_k32.1: +..L2: + + movsd %xmm0, -24(%rsp) + movl -20(%rsp), %ecx + movl %ecx, %eax + andl $2146435072, %eax + negl %eax + lea -1072676864(%rcx), %edx + addl $2145386496, %eax + movl %eax, -12(%rsp) + cmpl $24576, %edx + movl $0, -16(%rsp) + movsd .L_2il0floatpacket.0(%rip), %xmm1 + jae ..B1.3 +..B1.2: + lea 32+_Q(%rip), %rax + addsd %xmm1, %xmm0 + movaps %xmm0, %xmm2 + lea 24+_Q(%rip), %rcx + movsd (%rax), %xmm3 + lea 16+_Q(%rip), %rdx + lea 8+_Q(%rip), %rsi + lea _Q(%rip), %rdi + movsd %xmm0, -24(%rsp) + movsd (%rcx), %xmm1 + mulsd %xmm0, %xmm2 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm1 + addsd (%rdx), %xmm3 + addsd (%rsi), %xmm1 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm1 + addsd %xmm1, %xmm3 + addsd (%rdi), %xmm3 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm0 + ret +..B1.3: + movl %ecx, %esi + pxor %xmm0, %xmm0 + shrl $12, %ecx + lea 8+_P(%rip), %rax + movzbl %cl, %r9d + lea _P(%rip), %rdx + movq __libm_rcp_table_256@GOTPCREL(%rip), %rcx + lea _LN2(%rip), %rdi + movsd -24(%rsp), %xmm2 + shrl $20, %esi + addl $-1023, %esi + cvtss2sd (%rcx,%r9,4), %xmm0 + mulsd -16(%rsp), %xmm2 + mulsd %xmm0, %xmm2 + movsd (%rax), %xmm0 + addsd %xmm1, %xmm2 + mulsd %xmm2, %xmm0 + pxor %xmm1, %xmm1 + cvtsi2sd %esi, %xmm1 + addsd (%rdx), %xmm0 + mulsd (%rdi), %xmm1 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm0 + movq __libm_logf_table_256@GOTPCREL(%rip), %r8 + addsd %xmm2, %xmm0 + addsd (%r8,%r9,8), %xmm1 + movsd %xmm2, -24(%rsp) + addsd %xmm1, %xmm0 +..B1.4: + ret + .align 16,0x90 + .cfi_endproc + .type __libm_log_k32,@function + .size __libm_log_k32,.-__libm_log_k32 + .data +# -- End __libm_log_k32 + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 4 +_Q: + .long 4294868184 + .long 3219128319 + .long 1443356411 + .long 1070945621 + .long 823147527 + .long 3218079745 + .long 748089218 + .long 1070176642 + .long 1053536005 + .long 3217353219 + .type _Q,@object + .size _Q,40 + .align 4 +_P: + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .type _P,@object + .size _P,16 + .align 4 +_LN2: + .long 4277811695 + .long 1072049730 + .type _LN2,@object + .size _LN2,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_log_k64.S b/external/sgx_libm/intel64/libm_log_k64.S new file mode 100644 index 0000000000..2e67ca75b5 --- /dev/null +++ b/external/sgx_libm/intel64/libm_log_k64.S @@ -0,0 +1,632 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_log_k64.c" + .text +..TXTST0: +# -- Begin __libm_log_k64 + .text + .align 16,0x90 + .globl __libm_log_k64 +__libm_log_k64: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +# parameter 3: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_log_k64.1: +..L2: + + movaps %xmm1, %xmm6 + movsd %xmm0, -24(%rsp) + movzwl -18(%rsp), %esi + andl $32752, %esi + shrl $4, %esi + cmpl $2047, %esi + jge ..B1.12 +..B1.2: + testl %esi, %esi + jne ..B1.6 +..B1.3: + testl $1048575, -20(%rsp) + jne ..B1.6 +..B1.4: + cmpl $0, -24(%rsp) + jne ..B1.6 +..B1.5: + lea 1640+_libm_log_k64_table(%rip), %rax + lea 1624+_libm_log_k64_table(%rip), %rcx + movq (%rax), %rdx + movq (%rcx), %rsi + movq %rdx, (%rdi) + movq %rsi, 8(%rdi) + ret +..B1.6: + testb $-128, -17(%rsp) + jne ..B1.11 +..B1.7: + movsd -24(%rsp), %xmm4 + testl %esi, %esi + jne ..B1.9 +..B1.8: + lea 1656+_libm_log_k64_table(%rip), %rax + pxor %xmm9, %xmm9 + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm6 + movsd %xmm4, -24(%rsp) + movzwl -18(%rsp), %esi + andl $32752, %esi + shrl $4, %esi + addl $-1076, %esi + cvtsi2sd %esi, %xmm9 + jmp ..B1.10 +..B1.9: + addl $-1023, %esi + pxor %xmm9, %xmm9 + cvtsi2sd %esi, %xmm9 +..B1.10: + lea 1616+_libm_log_k64_table(%rip), %rcx + negl %esi + addl $1023, %esi + lea 1664+_libm_log_k64_table(%rip), %rax + andl $2047, %esi + lea _libm_log_k64_table(%rip), %r11 + shll $4, %esi + lea 1672+_libm_log_k64_table(%rip), %rdx + movzwl 6(%rcx), %r8d + movsd (%rcx), %xmm5 + andl $-32753, %r8d + movsd %xmm5, -16(%rsp) + orl %esi, %r8d + movw %r8w, -10(%rsp) + lea 1680+_libm_log_k64_table(%rip), %rsi + movsd (%rax), %xmm7 + lea 1688+_libm_log_k64_table(%rip), %rax + movsd -16(%rsp), %xmm1 + lea 1600+_libm_log_k64_table(%rip), %rcx + movsd (%rdx), %xmm0 + lea 1608+_libm_log_k64_table(%rip), %rdx + movsd (%rsi), %xmm2 + lea 1592+_libm_log_k64_table(%rip), %rsi + movsd (%rax), %xmm3 + lea 1584+_libm_log_k64_table(%rip), %r8 + movaps %xmm3, %xmm8 + lea 1560+_libm_log_k64_table(%rip), %rax + mulsd %xmm1, %xmm4 + mulsd %xmm1, %xmm6 + mulsd %xmm9, %xmm7 + addsd %xmm4, %xmm8 + mulsd %xmm0, %xmm9 + addsd %xmm4, %xmm2 + subsd %xmm3, %xmm8 + movsd %xmm2, -8(%rsp) + subsd %xmm8, %xmm4 + movl -8(%rsp), %r9d + addsd %xmm4, %xmm6 + andl $127, %r9d + movsd %xmm8, -24(%rsp) + movsd (%rdx), %xmm4 + lea (%r9,%r9,2), %r10d + lea 1576+_libm_log_k64_table(%rip), %r9 + movsd (%r11,%r10,8), %xmm10 + mulsd %xmm10, %xmm8 + addsd 8(%r11,%r10,8), %xmm7 + addsd 16(%r11,%r10,8), %xmm9 + mulsd %xmm6, %xmm10 + subsd %xmm5, %xmm8 + movaps %xmm8, %xmm6 + lea 1568+_libm_log_k64_table(%rip), %r11 + addsd %xmm10, %xmm6 + addsd %xmm9, %xmm10 + addsd %xmm7, %xmm8 + mulsd %xmm6, %xmm4 + movsd %xmm8, (%rdi) + addsd (%rcx), %xmm4 + mulsd %xmm6, %xmm4 + addsd (%rsi), %xmm4 + mulsd %xmm6, %xmm4 + addsd (%r8), %xmm4 + mulsd %xmm6, %xmm4 + addsd (%r9), %xmm4 + mulsd %xmm6, %xmm4 + addsd (%r11), %xmm4 + mulsd %xmm6, %xmm4 + mulsd %xmm6, %xmm6 + addsd (%rax), %xmm4 + mulsd %xmm4, %xmm6 + addsd %xmm6, %xmm10 + movsd %xmm10, 8(%rdi) + ret +..B1.11: + lea 1648+_libm_log_k64_table(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rdi) + movq %rdx, 8(%rdi) + ret +..B1.12: + lea 1632+_libm_log_k64_table(%rip), %rax + lea 1624+_libm_log_k64_table(%rip), %rdx + movsd -24(%rsp), %xmm0 + movq (%rdx), %rcx + movq %rcx, 8(%rdi) + addsd (%rax), %xmm0 + movsd %xmm0, (%rdi) +..B1.13: + ret + .align 16,0x90 + .cfi_endproc + .type __libm_log_k64,@function + .size __libm_log_k64,.-__libm_log_k64 + .data +# -- End __libm_log_k64 + .section .rodata, "a" + .align 16 + .align 16 +_libm_log_k64_table: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072660480 + .long 1486880768 + .long 1066410070 + .long 1813744607 + .long 3179892593 + .long 0 + .long 1072629760 + .long 377487360 + .long 1067416219 + .long 919019713 + .long 3179241129 + .long 0 + .long 1072599040 + .long 1513619456 + .long 1067944025 + .long 874573033 + .long 3178512940 + .long 0 + .long 1072570368 + .long 3221749760 + .long 1068427825 + .long 4181665006 + .long 3177478212 + .long 0 + .long 1072541696 + .long 4162322432 + .long 1068708823 + .long 627020255 + .long 1028629941 + .long 0 + .long 1072513024 + .long 183107584 + .long 1068957907 + .long 2376703469 + .long 1030233118 + .long 0 + .long 1072486400 + .long 1053425664 + .long 1069192557 + .long 696277142 + .long 1030474863 + .long 0 + .long 1072459776 + .long 3996123136 + .long 1069430535 + .long 2630798680 + .long 1028792016 + .long 0 + .long 1072435200 + .long 3452764160 + .long 1069600382 + .long 624954044 + .long 3177101741 + .long 0 + .long 1072409600 + .long 207650816 + .long 1069717971 + .long 3272735636 + .long 3175176575 + .long 0 + .long 1072386048 + .long 2647228416 + .long 1069827627 + .long 3594228712 + .long 1029303785 + .long 0 + .long 1072362496 + .long 2712010752 + .long 1069938736 + .long 3653242769 + .long 3176839013 + .long 0 + .long 1072338944 + .long 374439936 + .long 1070051337 + .long 4072775574 + .long 3176577495 + .long 0 + .long 1072316416 + .long 3707174912 + .long 1070160474 + .long 1486946159 + .long 1023930920 + .long 0 + .long 1072294912 + .long 1443954688 + .long 1070265993 + .long 293532967 + .long 3176278277 + .long 0 + .long 1072273408 + .long 127762432 + .long 1070372856 + .long 3404145447 + .long 3177023955 + .long 0 + .long 1072252928 + .long 2053832704 + .long 1070475911 + .long 1575076358 + .long 1029048544 + .long 0 + .long 1072232448 + .long 3194093568 + .long 1070580248 + .long 1864169120 + .long 1026866084 + .long 0 + .long 1072212992 + .long 3917201408 + .long 1070638340 + .long 2362145246 + .long 3175606197 + .long 0 + .long 1072193536 + .long 3417112576 + .long 1070689116 + .long 70087871 + .long 3174183577 + .long 0 + .long 1072175104 + .long 4226777088 + .long 1070737793 + .long 1620410586 + .long 3174700065 + .long 0 + .long 1072156672 + .long 3168870400 + .long 1070787042 + .long 311238082 + .long 1025781772 + .long 0 + .long 1072139264 + .long 2150580224 + .long 1070834092 + .long 1664262457 + .long 3175299224 + .long 0 + .long 1072120832 + .long 4095672320 + .long 1070884491 + .long 1657121015 + .long 3174674199 + .long 0 + .long 1072104448 + .long 2595577856 + .long 1070929805 + .long 2014006823 + .long 3175423830 + .long 0 + .long 1072087040 + .long 3747176448 + .long 1070978493 + .long 144991708 + .long 3171552042 + .long 0 + .long 1072070656 + .long 1050435584 + .long 1071024840 + .long 3386227432 + .long 1027876916 + .long 0 + .long 1072055296 + .long 255516672 + .long 1071068760 + .long 2637594316 + .long 1028049573 + .long 0 + .long 1072038912 + .long 1640783872 + .long 1071116120 + .long 893247007 + .long 1028452162 + .long 0 + .long 1072023552 + .long 2940411904 + .long 1071161011 + .long 813240633 + .long 1027664048 + .long 0 + .long 1072009216 + .long 882917376 + .long 1071203348 + .long 2376597551 + .long 3175828767 + .long 0 + .long 1071993856 + .long 213966848 + .long 1071249188 + .long 2977204125 + .long 1028350609 + .long 0 + .long 1071979520 + .long 2921504768 + .long 1071292428 + .long 523218347 + .long 1028007004 + .long 0 + .long 1071965184 + .long 3186655232 + .long 1071336119 + .long 2352907891 + .long 1026967097 + .long 0 + .long 1071951872 + .long 2653364224 + .long 1071377101 + .long 2453418583 + .long 3174349512 + .long 0 + .long 1071938560 + .long 3759783936 + .long 1071418487 + .long 3685870403 + .long 3175415611 + .long 0 + .long 1071925248 + .long 2468364288 + .long 1071460286 + .long 1578908842 + .long 3175510517 + .long 0 + .long 1071911936 + .long 81903616 + .long 1071502506 + .long 770710269 + .long 1026742353 + .long 0 + .long 1071899648 + .long 2799321088 + .long 1071541858 + .long 3822266185 + .long 1028434427 + .long 0 + .long 1071886336 + .long 2142265344 + .long 1071584911 + .long 175901806 + .long 3173871540 + .long 0 + .long 1071874048 + .long 2944024576 + .long 1071625048 + .long 2747360403 + .long 1027672159 + .long 0 + .long 1071862784 + .long 3434301440 + .long 1071653426 + .long 4194662196 + .long 3173893003 + .long 0 + .long 1071850496 + .long 1547755520 + .long 1071673870 + .long 4248764681 + .long 3172759087 + .long 0 + .long 1071839232 + .long 4246986752 + .long 1071692786 + .long 2840205638 + .long 3174430911 + .long 0 + .long 1071826944 + .long 3418390528 + .long 1071713619 + .long 3041880823 + .long 1025440860 + .long 0 + .long 1071816704 + .long 4143093760 + .long 1071731139 + .long 2727587401 + .long 3173965207 + .long 0 + .long 1071805440 + .long 3121326080 + .long 1071750582 + .long 3173887692 + .long 3174190163 + .long 0 + .long 1071794176 + .long 1852893184 + .long 1071770207 + .long 3951060252 + .long 1027348295 + .long 0 + .long 1071783936 + .long 3636379648 + .long 1071788208 + .long 1684924001 + .long 3174777086 + .long 0 + .long 1071773696 + .long 516505600 + .long 1071806366 + .long 429181199 + .long 3173211033 + .long 0 + .long 1071763456 + .long 4186185728 + .long 1071824681 + .long 2044904577 + .long 3174967132 + .long 0 + .long 1071753216 + .long 877596672 + .long 1071843159 + .long 1396318105 + .long 3173959727 + .long 0 + .long 1071742976 + .long 2912784384 + .long 1071861800 + .long 448136789 + .long 3174814192 + .long 0 + .long 1071733760 + .long 3722825728 + .long 1071878720 + .long 714165913 + .long 3173439560 + .long 0 + .long 1071723520 + .long 2522374144 + .long 1071897682 + .long 3227240353 + .long 3173394323 + .long 0 + .long 1071714304 + .long 4165410816 + .long 1071914895 + .long 1365684961 + .long 3174365060 + .long 0 + .long 1071705088 + .long 3477135360 + .long 1071932251 + .long 368482985 + .long 3174140821 + .long 0 + .long 1071695872 + .long 2079455232 + .long 1071949752 + .long 1320576317 + .long 1026822714 + .long 0 + .long 1071687680 + .long 851795968 + .long 1071965432 + .long 3702467026 + .long 1025224125 + .long 0 + .long 1071678464 + .long 647743488 + .long 1071983213 + .long 772992109 + .long 3174038459 + .long 0 + .long 1071670272 + .long 26537984 + .long 1071999146 + .long 2360214276 + .long 3174861275 + .long 0 + .long 1071661056 + .long 1547061248 + .long 1072017216 + .long 2886781435 + .long 1026423395 + .long 0 + .long 1071652864 + .long 2854492160 + .long 1072033410 + .long 215631550 + .long 1025638968 + .long 0 + .long 1071644672 + .long 4277811200 + .long 1072049730 + .long 2479318832 + .long 1026487127 + .long 0 + .long 3219128320 + .long 1431655955 + .long 1070945621 + .long 610 + .long 3218079744 + .long 2545118337 + .long 1070176665 + .long 1378399119 + .long 3217380693 + .long 612435357 + .long 1069697472 + .long 94536557 + .long 3217031348 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .long 0 + .long 4294443008 + .long 0 + .long 1128267776 + .long 4277811200 + .long 1072049730 + .long 2479318832 + .long 1026487127 + .long 64 + .long 1120927744 + .long 0 + .long 1094713344 + .type _libm_log_k64_table,@object + .size _libm_log_k64_table,1696 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_logl.S b/external/sgx_libm/intel64/libm_logl.S new file mode 100644 index 0000000000..f2b01ecfb2 --- /dev/null +++ b/external/sgx_libm/intel64/libm_logl.S @@ -0,0 +1,778 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_logl.c" + .text +..TXTST0: +# -- Begin __libm_logl + .text + .align 16,0x90 + .globl __libm_logl +__libm_logl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value___libm_logl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %sil, %sil +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzbl 57(%rsp), %r8d + andl $128, %r8d + shrl $7, %r8d + movzwl 56(%rsp), %eax + movl %eax, %edx + movl %r8d, %edi + andl $32767, %edx + shll $15, %edi + orl %edx, %edi + shll $16, %edi + movzwl 54(%rsp), %ecx + orl %ecx, %edi + cmpl $2147450880, %edi + jae ..B1.31 +..B1.4: + lea -1073674240(%rdi), %ecx + cmpl $36864, %ecx + ja ..B1.21 +..B1.5: + addl $-1073676287, %edi + cmpl $32769, %edi + ja ..B1.14 +..B1.6: + cmpl $16383, %edx + je ..B1.40 +..B1.7: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.11 +..B1.8: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.9: + fldcw 32(%rsp) +..B1.10: + movb $1, %sil +..B1.11: + fldt 48(%rsp) + lea 8+_ones(%rip), %rax + lea 48+_Q1(%rip), %rdx + lea 16+_Q1(%rip), %rcx + lea 32+_Q1(%rip), %rdi + lea _Q1(%rip), %r8 + testb %sil, %sil + faddl (%rax) + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%rdx) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fmul %st(1), %st + fldt (%rdi) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.13 +..B1.12: + fldcw 34(%rsp) +..B1.13: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.14: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.18 +..B1.15: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.16: + fldcw 32(%rsp) +..B1.17: + movb $1, %sil +..B1.18: + fldt 48(%rsp) + lea 8+_ones(%rip), %rax + lea _TWO_52H(%rip), %rdx + lea 208+_Q2(%rip), %rcx + lea 176+_Q2(%rip), %rdi + lea 144+_Q2(%rip), %r8 + lea 112+_Q2(%rip), %r9 + lea 80+_Q2(%rip), %r10 + lea 48+_Q2(%rip), %r11 + testb %sil, %sil + fldl (%rdx) + lea 192+_Q2(%rip), %rdx + fldt (%rcx) + lea 160+_Q2(%rip), %rcx + fldt (%rdi) + lea 128+_Q2(%rip), %rdi + fxch %st(3) + faddl (%rax) + lea 16+_Q2(%rip), %rax + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fld %st(1) + fsub %st(4), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fmul %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fld %st(0) + fld %st(4) + fmul %st(5), %st + fadd %st, %st(1) + fxch %st(1) + fmul %st, %st(4) + fxch %st(6) + faddp %st, %st(4) + fxch %st(3) + fmul %st(5), %st + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r8) + lea 96+_Q2(%rip), %r8 + faddp %st, %st(3) + fxch %st(2) + fmul %st(5), %st + fldt (%r9) + lea 64+_Q2(%rip), %r9 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r10) + lea 32+_Q2(%rip), %r10 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r11) + lea _Q2(%rip), %r11 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rax) + lea 240+_Q2(%rip), %rax + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rdx) + lea 224+_Q2(%rip), %rdx + fmul %st(6), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(6) + fldt (%r11) + faddp %st, %st(6) + fxch %st(2) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldt (%rax) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(1) + fld %st(1) + fldt (%rdx) + fld %st(0) + fmul %st(4), %st + faddp %st, %st(3) + fldt 16(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fxch %st(2) + fadd %st, %st(4) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.20 +..B1.19: + fldcw 34(%rsp) +..B1.20: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.21: + movzwl 34(%rsp), %edi + movl %edi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.25 +..B1.22: + orl $-64768, %edi + movw %di, 32(%rsp) +..B1.23: + fldcw 32(%rsp) +..B1.24: + movzwl 56(%rsp), %eax + movl %eax, %edx + movb $1, %sil + andl $32767, %edx +..B1.25: + movl $-16383, %ecx + testl %edx, %edx + jne ..B1.28 +..B1.26: + fldt 48(%rsp) + lea _TWO_75(%rip), %rcx + lea _zeros(%rip), %rax + fmull (%rcx) + movl $-16458, %ecx + fstpt 48(%rsp) + fldt 48(%rsp) + fldl (%rax) + movsd (%rax), %xmm0 + fucomip %st(1), %st + fstp %st(0) + jp ..B1.27 + je ..B1.42 +..B1.27: + movzwl 56(%rsp), %eax + movl %eax, %edx + andl $32767, %edx +..B1.28: + lea _TWO_32H(%rip), %rdi + andl $-32768, %eax + orl $-49153, %eax + addl %edx, %ecx + movw %ax, 56(%rsp) + lea 8+_ones(%rip), %r9 + fldt 48(%rsp) + lea 48+_P(%rip), %r10 + fld %st(0) + lea 16+_P(%rip), %r11 + fldl (%rdi) + lea _P(%rip), %rdi + movl 52(%rsp), %edx + fadd %st, %st(1) + shrl $23, %edx + fsubrp %st, %st(1) + movzbl %dl, %eax + lea 64+_P(%rip), %rdx + movq __libm_rcp_table_256@GOTPCREL(%rip), %r8 + fsubr %st, %st(1) + flds (%r8,%rax,4) + fmul %st, %st(1) + fmulp %st, %st(2) + faddl (%r9) + fld %st(0) + movl %ecx, 16(%rsp) + lea 80+_P(%rip), %rcx + shlq $4, %rax + fadd %st(2), %st + fld %st(0) + testb %sil, %sil + fmul %st(1), %st + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fildl 16(%rsp) + fldt (%rcx) + lea 32+_P(%rip), %rcx + fmul %st(3), %st + fldt (%r10) + movq __libm_logl_table_256@GOTPCREL(%rip), %r8 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(3), %st + fmulp %st, %st(2) + fldt (%rdx) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fmul %st(1), %st + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(2) + faddl 8(%r8,%rax) + faddp %st, %st(3) + faddl (%rax,%r8) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.30 +..B1.29: + fldcw 34(%rsp) +..B1.30: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.31: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.35 +..B1.32: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.33: + fldcw 32(%rsp) +..B1.34: + movzbl 57(%rsp), %r8d + movb $1, %sil + andl $128, %r8d + shrl $7, %r8d +..B1.35: + testl %r8d, %r8d + jne ..B1.45 +..B1.36: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.37: + testb %sil, %sil + je ..B1.39 +..B1.38: + fldcw 34(%rsp) +..B1.39: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.40: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.7 +..B1.41: + lea _zeros(%rip), %rax + fldl (%rax) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.42: + lea 8+_ones(%rip), %rax + testb %sil, %sil + movsd (%rax), %xmm1 + divsd %xmm0, %xmm1 + je ..B1.44 +..B1.43: + fldcw 34(%rsp) +..B1.44: + movsd %xmm1, 16(%rsp) + fldl 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.45: + movzwl 56(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.47 +..B1.46: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.36 + jmp ..B1.50 +..B1.47: + testl %eax, %eax + jne ..B1.50 +..B1.48: + cmpq $0, 48(%rsp) + jne ..B1.50 +..B1.49: + lea 8+_ones(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + divsd (%rdx), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + jmp ..B1.37 +..B1.50: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + jmp ..B1.37 + .align 16,0x90 + .cfi_endproc + .type __libm_logl,@function + .size __libm_logl,.-__libm_logl + .data +# -- End __libm_logl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q1: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 5458 + .word 43692 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 44682 + .word 49156 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 63914 + .word 24446 + .word 52434 + .word 52426 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q2: + .word 58950 + .word 11767 + .word 59949 + .word 40744 + .word 49076 + .word 0 + .word 0 + .word 0 + .word 44486 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 65514 + .word 65535 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 49718 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 36693 + .word 43691 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41156 + .word 18852 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 14101 + .word 65290 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 21744 + .word 48151 + .word 14557 + .word 58254 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 57454 + .word 983 + .word 52353 + .word 52428 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 54021 + .word 59409 + .word 39452 + .word 47662 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 35608 + .word 4659 + .word 11214 + .word 43692 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 35524 + .word 31332 + .word 8749 + .word 40326 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 54832 + .word 20873 + .word 17674 + .word 36915 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 48567 + .word 9481 + .word 46911 + .word 55870 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,256 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,96 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_logl_k80.S b/external/sgx_libm/intel64/libm_logl_k80.S new file mode 100644 index 0000000000..bbc390e8e7 --- /dev/null +++ b/external/sgx_libm/intel64/libm_logl_k80.S @@ -0,0 +1,966 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_logl_k80.c" + .text +..TXTST0: +# -- Begin __libm_log_k80 + .text + .align 16,0x90 + .globl __libm_log_k80 +__libm_log_k80: +# parameter 1: %rdi +# parameter 2: %rsi +..B1.1: + .cfi_startproc +..___tag_value___libm_log_k80.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + subq $88, %rsp + .cfi_def_cfa_offset 112 + movq %rsi, %r12 + movq %rdi, %r13 + movq %r12, %rdi + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 80(%rsp) +..___tag_value___libm_log_k80.8: + call __libm_normalizel_k80@PLT +..___tag_value___libm_log_k80.9: +..B1.2: + fldt (%r12) + fldt 16(%r12) + movl 32(%r12), %eax + cmpl $-1, %eax + je ..B1.15 +..B1.3: + movl %eax, 16(%rsp) + fildl 16(%rsp) + fstpt (%rsp) +..B1.4: + addq $-32, %rsp + .cfi_def_cfa_offset 144 + lea 48(%rsp), %rdi + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_log_k80.11: + call __libm_logl_k80@PLT +..___tag_value___libm_log_k80.12: +..B1.18: + addq $32, %rsp + .cfi_def_cfa_offset 112 +..B1.5: + fldt 16(%rsp) + lea _LN2_K80(%rip), %rax + lea 16+_LN2_K80(%rip), %rdx + fmul %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fldt 32(%rsp) + fmulp %st, %st(2) + movzwl 24(%rsp), %esi + andl $32767, %esi + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt (%rax) + fldt (%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fld %st(0) + movzwl 56(%rsp), %ecx + fadd %st(4), %st + fldt (%rdx) + andl $32767, %ecx + fmulp %st, %st(3) + cmpl %esi, %ecx + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + movl $0, 32(%r13) + jg ..B1.10 +..B1.6: + jne ..B1.11 +..B1.7: + movl 52(%rsp), %eax + movl 20(%rsp), %edx + cmpl %edx, %eax + ja ..B1.10 +..B1.8: + jne ..B1.11 +..B1.9: + movl 48(%rsp), %eax + cmpl 16(%rsp), %eax + jbe ..B1.11 +..B1.10: + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.12 +..B1.11: + fxch %st(2) + fsubr %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) +..B1.12: + fld %st(1) + fadd %st(1), %st + fstpt (%r13) + fldt (%r13) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%r13) + movq 80(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.14 +..B1.13: + addq $88, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.14: + call __stack_chk_fail@PLT +..B1.15: + lea _zeros(%rip), %rax + lea halfs(%rip), %rdx + fldl (%rax) + fstpt (%rsp) + fldt (%rdx) + fmul %st, %st(2) + fmulp %st, %st(1) + jmp ..B1.4 + .align 16,0x90 + .cfi_endproc + .type __libm_log_k80,@function + .size __libm_log_k80,.-__libm_log_k80 + .data +# -- End __libm_log_k80 + .text +# -- Begin __libm_logl_k80 + .text + .align 16,0x90 + .globl __libm_logl_k80 +__libm_logl_k80: +# parameter 1: 8 + %rsp +# parameter 2: 24 + %rsp +# parameter 3: %rdi +..B2.1: + .cfi_startproc +..___tag_value___libm_logl_k80.23: +..L24: + + fldt 8(%rsp) + movzbl 17(%rsp), %r9d + andl $128, %r9d + shrl $7, %r9d + movzwl 16(%rsp), %ecx + movl %ecx, %eax + movl %r9d, %r8d + andl $32767, %eax + shll $15, %r8d + movl 12(%rsp), %edx + orl %eax, %r8d + movl %edx, %esi + shll $16, %r8d + shrl $16, %esi + orl %esi, %r8d + fstpt -24(%rsp) + fldt -24(%rsp) + cmpl $2147450880, %r8d + fldt 24(%rsp) + jae ..B2.14 +..B2.2: + lea -1073674240(%r8), %esi + cmpl $36864, %esi + ja ..B2.8 +..B2.3: + addl $-1073676287, %r8d + cmpl $32769, %r8d + ja ..B2.7 +..B2.4: + lea _ones(%rip), %rax + fldl (%rax) + fucomi %st(2), %st + jne ..B2.6 + jp ..B2.6 +..B2.5: + lea _zeros(%rip), %rax + fldl (%rax) + fucomi %st(2), %st + jp ..B2.27 + je ..B2.23 +..B2.27: + fstp %st(0) +..B2.6: + fld %st(2) + lea 48+_Q1(%rip), %rax + lea 16+_Q1(%rip), %rdx + lea 32+_Q1(%rip), %rcx + lea _Q1(%rip), %rsi + fsub %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubrp %st, %st(4) + faddp %st, %st(3) + fld %st(1) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsub %st, %st(4) + fxch %st(4) + fsubrp %st, %st(3) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(2), %st + fmulp %st, %st(1) + fldt (%rcx) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(3) + fadd %st(1), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 16(%rdi) + ret +..B2.7: + lea 8+_ones(%rip), %rax + fld %st(1) + lea _TWO_52H(%rip), %rdx + lea 208+_Q2(%rip), %rcx + lea 176+_Q2(%rip), %rsi + lea 144+_Q2(%rip), %r8 + lea 112+_Q2(%rip), %r9 + lea 80+_Q2(%rip), %r10 + fldl (%rax) + lea 48+_Q2(%rip), %r11 + lea 16+_Q2(%rip), %rax + fadd %st, %st(1) + fld %st(1) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fstpt -24(%rsp) + fldt -24(%rsp) + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fldl (%rdx) + fmul %st(4), %st + lea 192+_Q2(%rip), %rdx + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fld %st(1) + fmul %st(2), %st + fxch %st(2) + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fstpt -56(%rsp) + fldt -56(%rsp) + fmul %st, %st(2) + fmul %st(4), %st + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fldt (%rcx) + fmul %st(1), %st + lea 160+_Q2(%rip), %rcx + fldt (%rsi) + lea 128+_Q2(%rip), %rsi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + lea 96+_Q2(%rip), %r8 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + lea 64+_Q2(%rip), %r9 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + lea 32+_Q2(%rip), %r10 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + lea _Q2(%rip), %r11 + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea 240+_Q2(%rip), %rax + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + lea 224+_Q2(%rip), %rdx + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r11) + faddp %st, %st(2) + fxch %st(5) + fmulp %st, %st(1) + faddp %st, %st(4) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fmulp %st, %st(1) + fld %st(1) + fldt (%rdx) + fld %st(0) + fmul %st(4), %st + faddp %st, %st(3) + fldt -56(%rsp) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fxch %st(1) + fmul %st(4), %st + fxch %st(2) + fadd %st, %st(4) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rdi) + lea _ones(%rip), %rdi + fldl (%rdi) + ret +..B2.8: + lea _zeros(%rip), %r8 + movl $-16383, %esi + testl %eax, %eax + fldl (%r8) + movsd (%r8), %xmm0 + jne ..B2.11 +..B2.9: + lea _TWO_75(%rip), %rax + movl $-16458, %esi + fldl (%rax) + fmul %st, %st(3) + fxch %st(3) + fucomi %st(1), %st + fxch %st(3) + fmulp %st, %st(2) + jp ..B2.10 + je ..B2.24 +..B2.10: + fxch %st(2) + fstpt -24(%rsp) + fldt -24(%rsp) + movzwl -16(%rsp), %ecx + movl %ecx, %eax + movl -20(%rsp), %edx + andl $32767, %eax + fxch %st(2) +..B2.11: + fstp %st(2) + addl %eax, %esi + fucomi %st(1), %st + fxch %st(1) + fstp %st(0) + jp ..B2.12 + je ..B2.13 +..B2.12: + fstpt -56(%rsp) + movzwl -48(%rsp), %r8d + movl %r8d, %r9d + subl %eax, %r8d + andl $-32768, %r9d + addl $16383, %r8d + andl $32767, %r8d + orl %r8d, %r9d + movw %r9w, -48(%rsp) + fldt -56(%rsp) +..B2.13: + shrl $23, %edx + andl $-32768, %ecx + movzbl %dl, %eax + lea _TWO_32H(%rip), %rdx + orl $-49153, %ecx + lea 8+_ones(%rip), %r8 + movw %cx, -16(%rsp) + lea 48+_P(%rip), %r9 + fldt -24(%rsp) + lea 16+_P(%rip), %r10 + fld %st(0) + lea 64+_P(%rip), %r11 + fldl (%rdx) + lea 32+_P(%rip), %rdx + movq __libm_rcp_table_256@GOTPCREL(%rip), %rcx + fadd %st, %st(1) + movl %esi, -40(%rsp) + lea 80+_P(%rip), %rsi + fsubrp %st, %st(1) + fsubr %st, %st(1) + flds (%rcx,%rax,4) + fmul %st, %st(1) + fmul %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + fstpt -56(%rsp) + fldt -56(%rsp) + lea _P(%rip), %rcx + shlq $4, %rax + faddp %st, %st(1) + fldl (%r8) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + fildl -40(%rsp) + fldt (%rsi) + fmul %st(3), %st + fldt (%r9) + movq __libm_logl_table_256@GOTPCREL(%rip), %rsi + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(3), %st + fmulp %st, %st(2) + fldt (%r11) + fmul %st(3), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(1), %st + fldt .L_2il0floatpacket.3(%rip) + fmulp %st, %st(2) + faddl 8(%rsi,%rax) + faddp %st, %st(2) + faddl (%rax,%rsi) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rdi) + lea _ones(%rip), %rdi + fldl (%rdi) + ret +..B2.14: + fstp %st(0) + testl %r9d, %r9d + jne ..B2.16 +..B2.15: + lea _ones(%rip), %rax + lea _zeros(%rip), %rdx + fldl (%rax) + fmul %st, %st(1) + movsd (%rdx), %xmm1 + fxch %st(1) + jmp ..B2.21 +..B2.16: + cmpl $32767, %eax + je ..B2.22 +..B2.17: + fstp %st(0) + testl %eax, %eax + jne ..B2.20 +..B2.18: + cmpq $0, -24(%rsp) + jne ..B2.20 +..B2.19: + lea _zeros(%rip), %rax + lea 8+_ones(%rip), %rdx + lea _ones(%rip), %rcx + movsd (%rax), %xmm1 + fldl (%rcx) + movsd (%rdx), %xmm0 + divsd %xmm1, %xmm0 + movsd %xmm0, -40(%rsp) + fldl -40(%rsp) + jmp ..B2.21 +..B2.20: + lea _zeros(%rip), %rax + lea _infs(%rip), %rdx + lea _ones(%rip), %rcx + movsd (%rax), %xmm1 + fldl (%rcx) + movsd (%rdx), %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, -40(%rsp) + fldl -40(%rsp) +..B2.21: + movsd %xmm1, -40(%rsp) + fstpt (%rdi) + fldl -40(%rsp) + fstpt 16(%rdi) + ret +..B2.22: + movq $0x8000000000000000, %rax + cmpq -24(%rsp), %rax + jne ..B2.15 + jmp ..B2.28 +..B2.23: + fstp %st(1) + fstp %st(2) + fstp %st(0) + fstpt (%rdi) + fldt (%rdi) + fld %st(0) + fxch %st(1) + fstpt 16(%rdi) + ret +..B2.24: + fstp %st(2) + fstp %st(0) + lea 8+_ones(%rip), %rax + lea _ones(%rip), %rdx + fstpt 16(%rdi) + movsd (%rax), %xmm1 + divsd %xmm0, %xmm1 + movsd %xmm1, -40(%rsp) + fldl -40(%rsp) + fstpt (%rdi) + fldl (%rdx) + ret +..B2.28: + fstp %st(0) + jmp ..B2.20 + .align 16,0x90 + .cfi_endproc + .type __libm_logl_k80,@function + .size __libm_logl_k80,.-__libm_logl_k80 + .data +# -- End __libm_logl_k80 + .section .rodata, "a" + .align 16 + .align 16 +halfs: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type halfs,@object + .size halfs,32 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_LN2_K80: + .word 0 + .word 0 + .word 6136 + .word 45426 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 12704 + .word 55409 + .word 6480 + .word 47298 + .word 49116 + .word 0 + .word 0 + .word 0 + .type _LN2_K80,@object + .size _LN2_K80,32 + .align 2 +_Q1: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 5458 + .word 43692 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 44682 + .word 49156 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 63914 + .word 24446 + .word 52434 + .word 52426 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q2: + .word 58950 + .word 11767 + .word 59949 + .word 40744 + .word 49076 + .word 0 + .word 0 + .word 0 + .word 44486 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 65514 + .word 65535 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 49718 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 36693 + .word 43691 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41156 + .word 18852 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 14101 + .word 65290 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 21744 + .word 48151 + .word 14557 + .word 58254 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 57454 + .word 983 + .word 52353 + .word 52428 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 54021 + .word 59409 + .word 39452 + .word 47662 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 35608 + .word 4659 + .word 11214 + .word 43692 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 35524 + .word 31332 + .word 8749 + .word 40326 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 54832 + .word 20873 + .word 17674 + .word 36915 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 48567 + .word 9481 + .word 46911 + .word 55870 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,256 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,96 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_mul_k64.S b/external/sgx_libm/intel64/libm_mul_k64.S new file mode 100644 index 0000000000..fd242c56a3 --- /dev/null +++ b/external/sgx_libm/intel64/libm_mul_k64.S @@ -0,0 +1,320 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_mul_k64.c" + .text +..TXTST0: +# -- Begin __libm_mul_k64 + .text + .align 16,0x90 + .globl __libm_mul_k64 +__libm_mul_k64: +# parameter 1: %edi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +..B1.1: + .cfi_startproc +..___tag_value___libm_mul_k64.1: +..L2: + + movq %rdx, %rax + movzwl 6(%rsi), %edx + andl $32752, %edx + shrl $4, %edx + movsd (%rsi), %xmm3 + cmpl $2047, %edx + movsd 8(%rsi), %xmm7 + movsd (%rax), %xmm2 + movsd 8(%rax), %xmm4 + je ..B1.12 +..B1.2: + testl %edx, %edx + jne ..B1.7 +..B1.3: + testl $1048575, 4(%rsi) + jne ..B1.7 +..B1.4: + cmpl $0, (%rsi) + je ..B1.12 +..B1.7: + movsd %xmm2, -24(%rsp) +..B1.8: + movzwl -18(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $2047, %eax + je ..B1.12 +..B1.9: + testl %eax, %eax + jne ..B1.13 +..B1.10: + testl $1048575, -20(%rsp) + jne ..B1.13 +..B1.11: + cmpl $0, -24(%rsp) + jne ..B1.13 +..B1.12: + mulsd %xmm2, %xmm3 + movsd %xmm3, (%rcx) + ret +..B1.13: + testl %edx, %edx + jne ..B1.15 +..B1.14: + lea _CONSTANTS(%rip), %rdx + movaps %xmm3, %xmm1 + addl $-1023, %edi + movsd (%rdx), %xmm0 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm7 + jmp ..B1.16 +..B1.15: + lea 32+_CONSTANTS(%rip), %rsi + movl %edx, %r9d + negl %r9d + movaps %xmm3, %xmm1 + addl $-2, %r9d + lea -1023(%rdi,%rdx), %edi + andl $2047, %r9d + movq (%rsi), %r8 + movq %r8, -24(%rsp) + shrq $48, %r8 + shll $4, %r9d + andl $-32753, %r8d + orl %r9d, %r8d + movw %r8w, -18(%rsp) + movsd -24(%rsp), %xmm0 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm7 +..B1.16: + testl %eax, %eax + jne ..B1.18 +..B1.17: + lea _CONSTANTS(%rip), %rax + movaps %xmm2, %xmm8 + addl $-1023, %edi + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm8 + mulsd %xmm0, %xmm4 + jmp ..B1.19 +..B1.18: + lea 32+_CONSTANTS(%rip), %rdx + movl %eax, %r8d + negl %r8d + movaps %xmm2, %xmm8 + addl $-2, %r8d + lea -1023(%rdi,%rax), %edi + andl $2047, %r8d + movq (%rdx), %rsi + movq %rsi, -24(%rsp) + shrq $48, %rsi + shll $4, %r8d + andl $-32753, %esi + orl %r8d, %esi + movw %si, -18(%rsp) + movsd -24(%rsp), %xmm0 + mulsd %xmm0, %xmm8 + mulsd %xmm0, %xmm4 +..B1.19: + movaps %xmm7, %xmm0 + lea 16+_CONSTANTS(%rip), %rax + movaps %xmm4, %xmm10 + addsd %xmm1, %xmm0 + addsd %xmm8, %xmm10 + movaps %xmm0, %xmm5 + movaps %xmm0, %xmm9 + movaps %xmm10, %xmm11 + subsd %xmm1, %xmm5 + movsd (%rax), %xmm1 + subsd %xmm5, %xmm7 + mulsd %xmm1, %xmm9 + mulsd %xmm1, %xmm11 + movaps %xmm9, %xmm6 + subsd %xmm0, %xmm6 + subsd %xmm6, %xmm9 + movaps %xmm9, %xmm5 + subsd %xmm9, %xmm0 + addsd %xmm7, %xmm0 + movaps %xmm10, %xmm7 + subsd %xmm8, %xmm7 + movaps %xmm11, %xmm8 + movaps %xmm0, %xmm6 + subsd %xmm10, %xmm8 + subsd %xmm7, %xmm4 + subsd %xmm8, %xmm11 + mulsd %xmm11, %xmm0 + subsd %xmm11, %xmm10 + mulsd %xmm11, %xmm5 + addsd %xmm4, %xmm10 + mulsd %xmm10, %xmm6 + movaps %xmm5, %xmm4 + mulsd %xmm9, %xmm10 + addsd %xmm10, %xmm6 + addsd %xmm0, %xmm6 + addsd %xmm6, %xmm4 + movsd %xmm4, -16(%rsp) + movzwl -10(%rsp), %edx + movl %edx, %esi + andl $32752, %esi + shrl $4, %esi + lea (%rdi,%rsi), %eax + cmpl $2047, %eax + jl ..B1.21 +..B1.20: + lea _CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm3, %xmm0 + mulsd %xmm2, %xmm0 + movsd %xmm0, (%rcx) + ret +..B1.21: + testl %eax, %eax + jle ..B1.23 +..B1.22: + andl $2047, %eax + andl $-32753, %edx + shll $4, %eax + orl %eax, %edx + movw %dx, -10(%rsp) + movq -16(%rsp), %rax + movq %rax, (%rcx) + ret +..B1.23: + cmpl $-9, %eax + jl ..B1.25 +..B1.24: + lea 8+_CONSTANTS(%rip), %rax + lea 32+_CONSTANTS(%rip), %rsi + lea 24+_CONSTANTS(%rip), %rdx + addl $1423, %edi + andl $2047, %edi + shll $4, %edi + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movq (%rsi), %r8 + addsd %xmm0, %xmm5 + movaps %xmm5, %xmm4 + movq %r8, -24(%rsp) + addsd %xmm6, %xmm4 + mulsd %xmm4, %xmm1 + movaps %xmm4, %xmm2 + subsd %xmm5, %xmm2 + movaps %xmm1, %xmm5 + subsd %xmm2, %xmm6 + subsd %xmm4, %xmm5 + shrq $48, %r8 + subsd %xmm5, %xmm1 + andl $-32753, %r8d + subsd %xmm1, %xmm4 + orl %edi, %r8d + addsd %xmm6, %xmm4 + movsd (%rdx), %xmm6 + mulsd %xmm6, %xmm1 + mulsd %xmm6, %xmm4 + movw %r8w, -18(%rsp) + movsd -24(%rsp), %xmm3 + mulsd %xmm3, %xmm1 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm1 + movsd %xmm1, (%rcx) + ret +..B1.25: + cmpl $-62, %eax + jle ..B1.27 +..B1.26: + lea 32+_CONSTANTS(%rip), %rax + lea 1022(%rdi,%rsi), %esi + lea 8+_CONSTANTS(%rip), %rdi + andl $-32753, %edx + orl $16, %edx + andl $2047, %esi + movw %dx, -10(%rsp) + movq (%rax), %rdx + movsd (%rdi), %xmm0 + mulsd %xmm0, %xmm0 + movq %rdx, -24(%rsp) + shrq $48, %rdx + shll $4, %esi + andl $-32753, %edx + orl %esi, %edx + movw %dx, -18(%rsp) + movsd -16(%rsp), %xmm1 + addsd -24(%rsp), %xmm0 + mulsd %xmm0, %xmm1 + movsd %xmm0, -24(%rsp) + movsd %xmm1, -16(%rsp) + movsd %xmm1, (%rcx) + ret +..B1.27: + lea 8+_CONSTANTS(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + mulsd %xmm3, %xmm0 + mulsd %xmm2, %xmm0 + movsd %xmm0, (%rcx) +..B1.28: + ret + .align 16,0x90 + .cfi_endproc + .type __libm_mul_k64,@function + .size __libm_mul_k64,.-__libm_mul_k64 + .data +# -- End __libm_mul_k64 + .section .rodata, "a" + .align 16 + .align 16 +_CONSTANTS: + .long 0 + .long 2145386496 + .long 0 + .long 1048576 + .long 33554432 + .long 1101004800 + .long 0 + .long 653262848 + .long 0 + .long 1072693248 + .type _CONSTANTS,@object + .size _CONSTANTS,40 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_normalizel_k80.S b/external/sgx_libm/intel64/libm_normalizel_k80.S new file mode 100644 index 0000000000..c2071f0bac --- /dev/null +++ b/external/sgx_libm/intel64/libm_normalizel_k80.S @@ -0,0 +1,163 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_normalizel_k80.c" + .text +..TXTST0: +# -- Begin __libm_normalizel_k80 + .text + .align 16,0x90 + .globl __libm_normalizel_k80 +__libm_normalizel_k80: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_normalizel_k80.1: +..L2: + + cmpl $0, 4(%rdi) + jne ..B1.3 +..B1.2: + cmpl $0, (%rdi) + je ..B1.14 +..B1.3: + movzwl 8(%rdi), %eax + movl %eax, %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.14 +..B1.4: + testl %esi, %esi + jle ..B1.16 +..B1.5: + andl $-32768, %eax + addl $-16383, %esi + orl $-49153, %eax +..B1.6: + movw %ax, 8(%rdi) + cmpl $0, 20(%rdi) + jne ..B1.8 +..B1.7: + cmpl $0, 16(%rdi) + je ..B1.13 +..B1.8: + movzwl 24(%rdi), %edx + movl %edx, %ecx + andl $32767, %ecx + jle ..B1.15 +..B1.9: + andl $-32768, %edx + addl $-16383, %ecx + orl $-49153, %edx +..B1.10: + lea -256(%rsi), %eax + cmpl %eax, %ecx + jle ..B1.12 +..B1.11: + subl %esi, %ecx + andl $-32768, %edx + addl $16383, %ecx + andl $32767, %ecx + orl %ecx, %edx + movw %dx, 24(%rdi) + jmp ..B1.13 +..B1.12: + lea zeros(%rip), %rax + fldt (%rax) + fstpt 16(%rdi) +..B1.13: + addl %esi, 32(%rdi) +..B1.14: + ret +..B1.15: + fldt 16(%rdi) + lea _CONSTANTS(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt 16(%rdi) + movzwl 24(%rdi), %edx + movl %edx, %ecx + andl $32767, %ecx + andl $-32768, %edx + addl $-16639, %ecx + orl $-49153, %edx + jmp ..B1.10 +..B1.16: + fldt (%rdi) + lea _CONSTANTS(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fstpt (%rdi) + movzwl 8(%rdi), %eax + movl %eax, %esi + andl $32767, %esi + andl $-32768, %eax + addl $-16639, %esi + orl $-49153, %eax + jmp ..B1.6 + .align 16,0x90 + .cfi_endproc + .type __libm_normalizel_k80,@function + .size __libm_normalizel_k80,.-__libm_normalizel_k80 + .data +# -- End __libm_normalizel_k80 + .section .rodata, "a" + .align 16 + .align 16 +zeros: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type zeros,@object + .size zeros,32 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16639 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_recacoshl_k80.S b/external/sgx_libm/intel64/libm_recacoshl_k80.S new file mode 100644 index 0000000000..d23b01b76b --- /dev/null +++ b/external/sgx_libm/intel64/libm_recacoshl_k80.S @@ -0,0 +1,1655 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_recacoshl_k80.c" + .text +..TXTST0: +# -- Begin __libm_recacoshl_k80 + .text + .align 16,0x90 + .globl __libm_recacoshl_k80 +__libm_recacoshl_k80: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +# parameter 7: 688 + %rsp +# parameter 8: 696 + %rsp +# parameter 9: 704 + %rsp +# parameter 10: 712 + %rsp +..B1.1: + .cfi_startproc +..___tag_value___libm_recacoshl_k80.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r15 + .cfi_def_cfa_offset 24 + .cfi_offset 15, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + subq $656, %rsp + .cfi_def_cfa_offset 688 + movq %r9, %rbp + movzwl 8(%rdi), %r10d + movq %r8, %r15 + andl $32767, %r10d + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 640(%rsp) + cmpl $16383, %r10d + movq 704(%rsp), %r13 + jl ..B1.31 +..B1.2: + movzwl 8(%r13), %r9d + movl %r9d, %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.6 +..B1.3: + cmpl $24383, %eax + jg ..B1.6 +..B1.4: + movzwl 8(%r15), %r10d + movl %r10d, %r11d + andl $32767, %r11d + cmpl $8383, %r11d + jl ..B1.6 +..B1.5: + cmpl $24383, %r11d + jle ..B1.9 +..B1.6: + movq %r13, %rdi +..___tag_value___libm_recacoshl_k80.10: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.11: +..B1.7: + movq %r15, %rdi +..___tag_value___libm_recacoshl_k80.12: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.13: +..B1.8: + movzwl 8(%r13), %r9d + movl %r9d, %eax + movzwl 8(%r15), %r10d + movl %r10d, %r11d + andl $32767, %eax + andl $32767, %r11d +..B1.9: + movl 32(%r15), %edx + movl 32(%r13), %ecx + lea -134(%rdx,%r11), %esi + lea (%rax,%rcx), %r8d + cmpl %r8d, %esi + jge ..B1.26 +..B1.10: + lea 134(%rdx,%r11), %esi + cmpl %esi, %r8d + jge ..B1.26 +..B1.11: + cmpl $0, 4(%r13) + jne ..B1.13 +..B1.12: + cmpl $0, (%r13) + je ..B1.26 +..B1.13: + cmpl $0, 4(%r15) + jne ..B1.15 +..B1.14: + cmpl $0, (%r15) + je ..B1.26 +..B1.15: + cmpl %edx, %ecx + je ..B1.17 +..B1.16: + fldt (%r13) + subl %edx, %ecx + fldt 16(%r13) + addl $16383, %ecx + andb $127, 9(%rsp) + andl $32767, %ecx + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%r13) + fxch %st(2) + fstpt (%r13) + fldt (%r13) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r13) + fldt 16(%r13) + movl 32(%r15), %edx + movzwl 8(%r15), %r10d + movzwl 8(%r13), %r9d + jmp ..B1.18 +..B1.17: + fldt (%r13) + fldt 16(%r13) +..B1.18: + fldt (%r15) + andl $32767, %r9d + andl $32767, %r10d + fld %st(2) + movl %edx, 96(%rsp) + cmpl %r10d, %r9d + fadd %st(1), %st + jg ..B1.23 +..B1.19: + jne ..B1.24 +..B1.20: + movl 4(%r13), %eax + cmpl 4(%r15), %eax + ja ..B1.23 +..B1.21: + jne ..B1.24 +..B1.22: + movl (%r13), %eax + cmpl (%r15), %eax + jbe ..B1.24 +..B1.23: + fldt 16(%r15) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B1.25 +..B1.24: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%r15) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) +..B1.25: + fld %st(0) + fadd %st(2), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 80(%rsp) + jmp ..B1.30 +..B1.26: + cmpq $0, (%r13) + je ..B1.28 +..B1.27: + lea -16517(%rdx,%r11), %edx + lea -16383(%rcx,%rax), %eax + cmpl %eax, %edx + jl ..B1.29 +..B1.28: + movq (%r15), %rax + movq 8(%r15), %rdx + movq 16(%r15), %rcx + movq 24(%r15), %rsi + movq 32(%r15), %r8 + movq 40(%r15), %r9 + movq %rax, 64(%rsp) + movq %rdx, 72(%rsp) + movq %rcx, 80(%rsp) + movq %rsi, 88(%rsp) + movq %r8, 96(%rsp) + movq %r9, 104(%rsp) + jmp ..B1.30 +..B1.29: + movq (%r13), %rax + movq 8(%r13), %rdx + movq 16(%r13), %rcx + movq 24(%r13), %rsi + movq 32(%r13), %r8 + movq 40(%r13), %r9 + movq %rax, 64(%rsp) + movq %rdx, 72(%rsp) + movq %rcx, 80(%rsp) + movq %rsi, 88(%rsp) + movq %r8, 96(%rsp) + movq %r9, 104(%rsp) +..B1.30: + lea ones(%rip), %rax + lea zeros(%rip), %rdx + movl $0, 144(%rsp) + fldt (%rax) + fstpt 112(%rsp) + fldt 112(%rsp) + fldt (%rdx) + fstpt 128(%rsp) + fldt 128(%rsp) + jmp ..B1.59 +..B1.31: + movq 688(%rsp), %r9 + movq (%r9), %rax + movq 8(%r9), %rdx + movq 16(%r9), %rcx + movq 24(%r9), %rsi + movq 32(%r9), %r8 + movq 40(%r9), %r10 + movzwl 8(%r13), %r9d + movq %rax, 64(%rsp) + movl %r9d, %eax + andl $32767, %eax + movq %rdx, 72(%rsp) + cmpl $8383, %eax + movq %rcx, 80(%rsp) + movq %rsi, 88(%rsp) + movq %r8, 96(%rsp) + movq %r10, 104(%rsp) + jl ..B1.35 +..B1.32: + cmpl $24383, %eax + jg ..B1.35 +..B1.33: + movzwl 8(%r15), %r10d + movl %r10d, %r11d + andl $32767, %r11d + cmpl $8383, %r11d + jl ..B1.35 +..B1.34: + cmpl $24383, %r11d + jle ..B1.38 +..B1.35: + movq %r13, %rdi +..___tag_value___libm_recacoshl_k80.14: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.15: +..B1.36: + movq %r15, %rdi +..___tag_value___libm_recacoshl_k80.16: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.17: +..B1.37: + movzwl 8(%r13), %r9d + movl %r9d, %eax + movzwl 8(%r15), %r10d + movl %r10d, %r11d + andl $32767, %eax + andl $32767, %r11d +..B1.38: + movl 32(%r15), %edx + movl 32(%r13), %ecx + lea -134(%rdx,%r11), %esi + lea (%rax,%rcx), %r8d + cmpl %r8d, %esi + jge ..B1.55 +..B1.39: + lea 134(%rdx,%r11), %esi + cmpl %esi, %r8d + jge ..B1.55 +..B1.40: + cmpl $0, 4(%r13) + jne ..B1.42 +..B1.41: + cmpl $0, (%r13) + je ..B1.55 +..B1.42: + cmpl $0, 4(%r15) + jne ..B1.44 +..B1.43: + cmpl $0, (%r15) + je ..B1.55 +..B1.44: + cmpl %edx, %ecx + je ..B1.46 +..B1.45: + fldt (%r13) + subl %edx, %ecx + fldt 16(%r13) + addl $16383, %ecx + andb $127, 9(%rsp) + andl $32767, %ecx + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%r13) + fxch %st(2) + fstpt (%r13) + fldt (%r13) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r13) + fldt 16(%r13) + movl 32(%r15), %edx + movzwl 8(%r15), %r10d + movzwl 8(%r13), %r9d + jmp ..B1.47 +..B1.46: + fldt (%r13) + fldt 16(%r13) +..B1.47: + fldt (%r15) + andl $32767, %r9d + andl $32767, %r10d + fld %st(2) + movl %edx, 144(%rsp) + cmpl %r10d, %r9d + fsub %st(1), %st + jg ..B1.52 +..B1.48: + jne ..B1.53 +..B1.49: + movl 4(%r13), %eax + cmpl 4(%r15), %eax + ja ..B1.52 +..B1.50: + jne ..B1.53 +..B1.51: + movl (%r13), %eax + cmpl (%r15), %eax + jbe ..B1.53 +..B1.52: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 16(%r15) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B1.54 +..B1.53: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%r15) + fsubrp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) +..B1.54: + fld %st(1) + lea ones(%rip), %rax + lea zeros(%rip), %rdx + fadd %st(1), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 128(%rsp) + fldt (%rax) + fldt (%rdx) + jmp ..B1.59 +..B1.55: + cmpq $0, (%r13) + je ..B1.57 +..B1.56: + lea -16517(%rdx,%r11), %esi + lea -16383(%rcx,%rax), %eax + cmpl %eax, %esi + jl ..B1.58 +..B1.57: + fldt (%r15) + lea ones(%rip), %rax + movl %edx, 144(%rsp) + lea zeros(%rip), %rdx + fchs + fstpt 112(%rsp) + fldt 16(%r15) + fchs + fstpt 128(%rsp) + fldt (%rax) + fldt (%rdx) + jmp ..B1.59 +..B1.58: + lea ones(%rip), %r10 + lea zeros(%rip), %r11 + movq (%r13), %rax + movq 8(%r13), %rdx + movq 16(%r13), %rcx + fldt (%r10) + fldt (%r11) + movq 24(%r13), %rsi + movq 32(%r13), %r8 + movq 40(%r13), %r9 + movq %rax, 112(%rsp) + movq %rdx, 120(%rsp) + movq %rcx, 128(%rsp) + movq %rsi, 136(%rsp) + movq %r8, 144(%rsp) + movq %r9, 152(%rsp) +..B1.59: + movq 712(%rsp), %r13 + fxch %st(1) + fadd %st(0), %st + movzwl 8(%r13), %r8d + movl %r8d, %r11d + andl $32767, %r11d + movl $0, 288(%rsp) + cmpl $8383, %r11d + fstpt 256(%rsp) + fstpt 272(%rsp) + jl ..B1.63 +..B1.60: + cmpl $24383, %r11d + jg ..B1.63 +..B1.61: + movzwl 264(%rsp), %edx + movl %edx, %r10d + andl $32767, %r10d + cmpl $8383, %r10d + jl ..B1.63 +..B1.62: + cmpl $24383, %r10d + jle ..B1.66 +..B1.63: + movq %r13, %rdi +..___tag_value___libm_recacoshl_k80.18: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.19: +..B1.64: + lea 256(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.20: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.21: +..B1.65: + movzwl 8(%r13), %r8d + movl %r8d, %r11d + movzwl 264(%rsp), %edx + movl %edx, %r10d + andl $32767, %r11d + andl $32767, %r10d +..B1.66: + movl 288(%rsp), %r9d + movl 32(%r13), %eax + lea -134(%r9,%r10), %ecx + lea (%r11,%rax), %esi + cmpl %ecx, %esi + jle ..B1.83 +..B1.67: + lea 134(%r9,%r10), %ecx + cmpl %ecx, %esi + jge ..B1.83 +..B1.68: + cmpl $0, 4(%r13) + jne ..B1.70 +..B1.69: + cmpl $0, (%r13) + je ..B1.83 +..B1.70: + cmpl $0, 260(%rsp) + jne ..B1.72 +..B1.71: + cmpl $0, 256(%rsp) + je ..B1.83 +..B1.72: + cmpl %r9d, %eax + je ..B1.74 +..B1.73: + fldt (%r13) + subl %r9d, %eax + fldt 16(%r13) + addl $16383, %eax + andb $127, 9(%rsp) + andl $32767, %eax + movzwl 8(%rsp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + movw %cx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r9d, 32(%r13) + fxch %st(2) + fstpt (%r13) + fldt (%r13) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r13) + fldt 16(%r13) + movzwl 8(%r13), %r8d + jmp ..B1.75 +..B1.74: + fldt (%r13) + fldt 16(%r13) +..B1.75: + fldt 256(%rsp) + movl %edx, %eax + andl $32767, %r8d + andl $32767, %eax + fld %st(2) + cmpl %eax, %r8d + movl %r9d, 192(%rsp) + fadd %st(1), %st + jg ..B1.80 +..B1.76: + andl $32767, %edx + cmpl %edx, %r8d + jne ..B1.81 +..B1.77: + movl 4(%r13), %eax + cmpl 260(%rsp), %eax + ja ..B1.80 +..B1.78: + jne ..B1.81 +..B1.79: + movl (%r13), %eax + cmpl 256(%rsp), %eax + jbe ..B1.81 +..B1.80: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 272(%rsp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.82 +..B1.81: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 272(%rsp) + faddp %st, %st(1) +..B1.82: + fld %st(0) + fadd %st(2), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 176(%rsp) + jmp ..B1.87 +..B1.83: + cmpq $0, (%r13) + je ..B1.85 +..B1.84: + lea -16517(%r9,%r10), %edx + lea -16383(%rax,%r11), %eax + cmpl %eax, %edx + jl ..B1.86 +..B1.85: + movaps 256(%rsp), %xmm0 + movaps 272(%rsp), %xmm1 + movaps 288(%rsp), %xmm2 + movaps %xmm0, 160(%rsp) + movaps %xmm1, 176(%rsp) + movaps %xmm2, 192(%rsp) + jmp ..B1.87 +..B1.86: + movq (%r13), %rax + movq 8(%r13), %rdx + movq 16(%r13), %rcx + movq 24(%r13), %rsi + movq 32(%r13), %r8 + movq 40(%r13), %r9 + movq %rax, 160(%rsp) + movq %rdx, 168(%rsp) + movq %rcx, 176(%rsp) + movq %rsi, 184(%rsp) + movq %r8, 192(%rsp) + movq %r9, 200(%rsp) +..B1.87: + movzwl 168(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.91 +..B1.88: + cmpl $24383, %eax + jg ..B1.91 +..B1.89: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.91 +..B1.90: + cmpl $24383, %eax + jle ..B1.93 +..B1.91: + lea 160(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.22: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.23: +..B1.92: + lea 64(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.24: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.25: +..B1.93: + fldt 160(%rsp) + lea t32(%rip), %rdx + fld %st(0) + fld %st(1) + fldt 64(%rsp) + fld %st(0) + fldt (%rdx) + fld %st(0) + fmul %st(6), %st + movq 696(%rsp), %r13 + fsubr %st, %st(5) + movzwl 8(%r13), %esi + movl %esi, %r11d + movl 192(%rsp), %eax + andl $32767, %r11d + addl 96(%rsp), %eax + faddp %st, %st(5) + fld %st(4) + fld %st(3) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + cmpl $8383, %r11d + fmul %st(4), %st + movl %eax, 240(%rsp) + fsubr %st, %st(3) + faddp %st, %st(3) + fmul %st(2), %st + fxch %st(4) + fsub %st(5), %st + fxch %st(1) + fsub %st(2), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 80(%rsp) + fmulp %st, %st(4) + fldt 176(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 208(%rsp) + fldt 208(%rsp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 224(%rsp) + fstpt 32(%rsp) + jl ..B1.97 +..B1.94: + cmpl $24383, %r11d + jg ..B1.97 +..B1.95: + movzwl 8(%rbp), %r8d + movl %r8d, %r10d + andl $32767, %r10d + cmpl $8383, %r10d + jl ..B1.97 +..B1.96: + cmpl $24383, %r10d + jle ..B1.100 +..B1.97: + movq %r13, %rdi +..___tag_value___libm_recacoshl_k80.26: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.27: +..B1.98: + movq %rbp, %rdi +..___tag_value___libm_recacoshl_k80.28: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.29: +..B1.99: + movzwl 8(%r13), %esi + movl %esi, %r11d + movzwl 8(%rbp), %r8d + movl %r8d, %r10d + andl $32767, %r11d + andl $32767, %r10d +..B1.100: + movl 32(%rbp), %r9d + movl 32(%r13), %eax + lea -134(%r9,%r10), %edx + lea (%r11,%rax), %ecx + cmpl %edx, %ecx + jle ..B1.117 +..B1.101: + lea 134(%r9,%r10), %edx + cmpl %edx, %ecx + jge ..B1.117 +..B1.102: + cmpl $0, 4(%r13) + jne ..B1.104 +..B1.103: + cmpl $0, (%r13) + je ..B1.117 +..B1.104: + cmpl $0, 4(%rbp) + jne ..B1.106 +..B1.105: + cmpl $0, (%rbp) + je ..B1.117 +..B1.106: + cmpl %r9d, %eax + je ..B1.108 +..B1.107: + fldt 32(%rsp) + subl %r9d, %eax + fstpt (%rsp) + addl $16383, %eax + fldt (%r13) + andl $32767, %eax + fldt 16(%r13) + andb $127, 9(%rsp) + movzwl 8(%rsp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r9d, 32(%r13) + fxch %st(2) + fstpt (%r13) + fldt (%r13) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r13) + fldt 16(%r13) + movl 32(%rbp), %r9d + movzwl 8(%rbp), %r8d + movzwl 8(%r13), %esi + jmp ..B1.109 +..B1.108: + fldt (%r13) + fldt 16(%r13) +..B1.109: + fldt (%rbp) + andl $32767, %esi + andl $32767, %r8d + fld %st(2) + movl %r9d, 336(%rsp) + cmpl %r8d, %esi + fadd %st(1), %st + jg ..B1.114 +..B1.110: + jne ..B1.115 +..B1.111: + movl 4(%r13), %eax + cmpl 4(%rbp), %eax + ja ..B1.114 +..B1.112: + jne ..B1.115 +..B1.113: + movl (%r13), %eax + cmpl (%rbp), %eax + jbe ..B1.115 +..B1.114: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 16(%rbp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.116 +..B1.115: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 16(%rbp) + faddp %st, %st(1) +..B1.116: + fld %st(0) + fadd %st(2), %st + fstpt 304(%rsp) + fldt 304(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 320(%rsp) + jmp ..B1.121 +..B1.117: + cmpq $0, (%r13) + je ..B1.119 +..B1.118: + lea -16517(%r9,%r10), %edx + lea -16383(%rax,%r11), %eax + cmpl %eax, %edx + jl ..B1.120 +..B1.119: + movq (%rbp), %rax + movq 8(%rbp), %rdx + movq 16(%rbp), %rcx + movq 24(%rbp), %rsi + movq 32(%rbp), %r8 + movq 40(%rbp), %rbp + movq %rax, 304(%rsp) + movq %rdx, 312(%rsp) + movq %rcx, 320(%rsp) + movq %rsi, 328(%rsp) + movq %r8, 336(%rsp) + movq %rbp, 344(%rsp) + jmp ..B1.121 +..B1.120: + movq (%r13), %rax + movq 8(%r13), %rdx + movq 16(%r13), %rcx + movq 24(%r13), %rbp + movq 32(%r13), %rsi + movq 40(%r13), %rdi + movq %rax, 304(%rsp) + movq %rdx, 312(%rsp) + movq %rcx, 320(%rsp) + movq %rbp, 328(%rsp) + movq %rsi, 336(%rsp) + movq %rdi, 344(%rsp) +..B1.121: + movzwl 312(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.125 +..B1.122: + cmpl $24383, %eax + jg ..B1.125 +..B1.123: + movzwl 120(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.125 +..B1.124: + cmpl $24383, %eax + jle ..B1.127 +..B1.125: + lea 304(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.30: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.31: +..B1.126: + lea 112(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.32: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.33: +..B1.127: + fldt 304(%rsp) + fld %st(0) + fld %st(1) + fldt 16(%rsp) + fld %st(0) + fmul %st(4), %st + movl 336(%rsp), %ecx + fsubr %st, %st(3) + movzwl 216(%rsp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + addl 144(%rsp), %ecx + fxch %st(2) + fsub %st(3), %st + fldt 112(%rsp) + cmpl $8383, %eax + fmul %st, %st(2) + fld %st(0) + movl %ecx, 384(%rsp) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 128(%rsp) + fmulp %st, %st(4) + fldt 320(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 352(%rsp) + fldt 352(%rsp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 368(%rsp) + fldt 368(%rsp) + jl ..B1.131 +..B1.128: + cmpl $24383, %eax + jg ..B1.131 +..B1.129: + movzwl 360(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.131 +..B1.130: + cmpl $24383, %eax + jle ..B1.134 +..B1.131: + fstp %st(1) + fstp %st(0) + lea 208(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.34: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.35: +..B1.132: + lea 352(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.36: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.37: +..B1.133: + fldt 352(%rsp) + fldt 368(%rsp) + movl 384(%rsp), %ecx +..B1.134: + fldt 208(%rsp) + fld %st(2) + fdivr %st(1), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(4) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt 16(%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movl 240(%rsp), %edx + fsubr %st(4), %st + subl %ecx, %edx + faddp %st, %st(1) + fld %st(0) + decl %edx + movl %edx, 432(%rsp) + fsubr %st(4), %st + fxch %st(2) + fmul %st(3), %st + fsubr %st, %st(7) + faddp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fld %st(2) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(6) + faddp %st, %st(5) + fsubrp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fldt 224(%rsp) + faddp %st, %st(1) + fsubp %st, %st(1) + fldt 48(%rsp) + fdivrp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 400(%rsp) + fldt 400(%rsp) + fsubrp %st, %st(2) + movzwl 408(%rsp), %esi + movl %esi, %eax + andl $32767, %eax + fadd %st, %st(1) + fxch %st(1) + fstpt 416(%rsp) + cmpl $8383, %eax + fstpt 32(%rsp) + jl ..B1.138 +..B1.135: + cmpl $24383, %eax + jg ..B1.138 +..B1.136: + movzwl 264(%rsp), %edi + movl %edi, %r9d + andl $32767, %r9d + cmpl $8383, %r9d + jl ..B1.138 +..B1.137: + cmpl $24383, %r9d + jle ..B1.141 +..B1.138: + lea 400(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.38: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.39: +..B1.139: + lea 256(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.40: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.41: +..B1.140: + movzwl 264(%rsp), %edi + movl %edi, %r9d + movzwl 408(%rsp), %esi + movl %esi, %eax + movl 432(%rsp), %edx + andl $32767, %r9d + andl $32767, %eax +..B1.141: + movl 288(%rsp), %r8d + lea (%rdx,%rax), %ebp + lea -134(%r8,%r9), %ecx + cmpl %ecx, %ebp + jle ..B1.158 +..B1.142: + lea 134(%r8,%r9), %ecx + cmpl %ecx, %ebp + jge ..B1.158 +..B1.143: + cmpl $0, 404(%rsp) + jne ..B1.145 +..B1.144: + cmpl $0, 400(%rsp) + je ..B1.158 +..B1.145: + cmpl $0, 260(%rsp) + jne ..B1.147 +..B1.146: + cmpl $0, 256(%rsp) + je ..B1.158 +..B1.147: + cmpl %r8d, %edx + je ..B1.149 +..B1.148: + fldt 32(%rsp) + subl %r8d, %edx + fstpt (%rsp) + addl $16383, %edx + fldt 400(%rsp) + andl $32767, %edx + fldt 416(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edx, %eax + movl %r8d, %edx + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 400(%rsp) + fldt 400(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 408(%rsp), %esi + movl %esi, %eax + andl $32767, %eax + movl %r8d, 432(%rsp) + movl %eax, %ecx + fstpt 416(%rsp) + fldt 416(%rsp) + jmp ..B1.150 +..B1.149: + fldt 400(%rsp) + movl %esi, %ecx + fldt 416(%rsp) + andl $32767, %ecx +..B1.150: + fldt 256(%rsp) + movl %edi, %ebp + andl $32767, %ebp + fld %st(2) + movl %r8d, 480(%rsp) + cmpl %ebp, %ecx + fadd %st(1), %st + jg ..B1.155 +..B1.151: + andl $32767, %esi + andl $32767, %edi + cmpl %edi, %esi + jne ..B1.156 +..B1.152: + movl 404(%rsp), %ecx + cmpl 260(%rsp), %ecx + ja ..B1.155 +..B1.153: + jne ..B1.156 +..B1.154: + movl 400(%rsp), %ecx + cmpl 256(%rsp), %ecx + jbe ..B1.156 +..B1.155: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 272(%rsp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.157 +..B1.156: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 272(%rsp) + faddp %st, %st(1) +..B1.157: + fld %st(0) + fadd %st(2), %st + fstpt 448(%rsp) + fldt 448(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 464(%rsp) + jmp ..B1.162 +..B1.158: + cmpq $0, 400(%rsp) + je ..B1.160 +..B1.159: + lea -16517(%r8,%r9), %ecx + lea -16383(%rdx,%rax), %ebp + cmpl %ebp, %ecx + jl ..B1.161 +..B1.160: + movaps 256(%rsp), %xmm0 + movaps 272(%rsp), %xmm1 + movaps 288(%rsp), %xmm2 + movaps %xmm0, 448(%rsp) + movaps %xmm1, 464(%rsp) + movaps %xmm2, 480(%rsp) + jmp ..B1.162 +..B1.161: + movaps 400(%rsp), %xmm0 + movaps 416(%rsp), %xmm1 + movaps 432(%rsp), %xmm2 + movaps %xmm0, 448(%rsp) + movaps %xmm1, 464(%rsp) + movaps %xmm2, 480(%rsp) +..B1.162: + cmpl $8383, %eax + jl ..B1.166 +..B1.163: + cmpl $24383, %eax + jg ..B1.166 +..B1.164: + movzwl 456(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.166 +..B1.165: + cmpl $24383, %eax + jle ..B1.169 +..B1.166: + lea 400(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.42: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.43: +..B1.167: + lea 448(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.44: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.45: +..B1.168: + movl 432(%rsp), %edx +..B1.169: + fldt 400(%rsp) + fld %st(0) + fld %st(1) + fldt 16(%rsp) + fld %st(0) + fmul %st(4), %st + addl 480(%rsp), %edx + fsubr %st, %st(3) + movl %edx, 528(%rsp) + faddp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fldt 448(%rsp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 464(%rsp) + fmulp %st, %st(4) + fldt 416(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 496(%rsp) + fldt 496(%rsp) + fsubr %st, %st(1) + movzwl 504(%rsp), %eax + fxch %st(1) + faddp %st, %st(2) + andl $32767, %eax + fxch %st(1) + fstpt 512(%rsp) + fldt 512(%rsp) + cmpl $383, %eax + fxch %st(1) + fstpt 32(%rsp) + jl ..B1.171 +..B1.170: + cmpl $32383, %eax + jle ..B1.173 +..B1.171: + fstp %st(0) + lea 496(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.46: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.47: +..B1.172: + fldt 496(%rsp) + fstpt 32(%rsp) + fldt 512(%rsp) + movl 528(%rsp), %edx +..B1.173: + testb $1, %dl + jne ..B1.208 +..B1.174: + lea halfs(%rip), %rax + fldt (%rax) +..B1.175: + fldt 32(%rsp) + fld %st(0) + fsqrt + fldt 16(%rsp) + fmul %st(1), %st + fld %st(0) + movzwl 408(%rsp), %ebp + movl %ebp, %r9d + andl $32767, %r9d + fsubr %st(2), %st + sarl $1, %edx + faddp %st, %st(1) + fld %st(0) + cmpl $8383, %r9d + movl %edx, 576(%rsp) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fmulp %st, %st(1) + fdiv %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt 544(%rsp) + fldt 544(%rsp) + fsubrp %st, %st(2) + fadd %st, %st(1) + fxch %st(1) + fstpt 560(%rsp) + fstpt 32(%rsp) + jl ..B1.179 +..B1.176: + cmpl $24383, %r9d + jg ..B1.179 +..B1.177: + movzwl 552(%rsp), %esi + movl %esi, %edi + andl $32767, %edi + cmpl $8383, %edi + jl ..B1.179 +..B1.178: + cmpl $24383, %edi + jle ..B1.182 +..B1.179: + lea 400(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.48: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.49: +..B1.180: + lea 544(%rsp), %rdi +..___tag_value___libm_recacoshl_k80.50: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacoshl_k80.51: +..B1.181: + movzwl 408(%rsp), %ebp + movl %ebp, %r9d + movzwl 552(%rsp), %esi + movl %esi, %edi + movl 576(%rsp), %edx + andl $32767, %r9d + andl $32767, %edi +..B1.182: + movl 432(%rsp), %r8d + lea -134(%rdx,%rdi), %eax + lea (%r9,%r8), %ecx + cmpl %eax, %ecx + jle ..B1.199 +..B1.183: + lea 134(%rdx,%rdi), %eax + cmpl %eax, %ecx + jge ..B1.199 +..B1.184: + cmpl $0, 404(%rsp) + jne ..B1.186 +..B1.185: + cmpl $0, 400(%rsp) + je ..B1.199 +..B1.186: + cmpl $0, 548(%rsp) + jne ..B1.188 +..B1.187: + cmpl $0, 544(%rsp) + je ..B1.199 +..B1.188: + cmpl %edx, %r8d + je ..B1.190 +..B1.189: + fldt 32(%rsp) + subl %edx, %r8d + fstpt (%rsp) + addl $16383, %r8d + fldt 400(%rsp) + andl $32767, %r8d + fldt 416(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %r8d, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 400(%rsp) + fldt 400(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movl %edx, 432(%rsp) + fstpt 416(%rsp) + fldt 416(%rsp) + movzwl 408(%rsp), %ebp + jmp ..B1.191 +..B1.190: + fldt 400(%rsp) + fldt 416(%rsp) +..B1.191: + fldt 544(%rsp) + movl %ebp, %eax + movl %edx, 48(%rsp) + movl %esi, %edx + andl $32767, %eax + andl $32767, %edx + fld %st(2) + cmpl %edx, %eax + fadd %st(1), %st + jg ..B1.196 +..B1.192: + andl $32767, %ebp + andl $32767, %esi + cmpl %esi, %ebp + jne ..B1.197 +..B1.193: + movl 404(%rsp), %eax + cmpl 548(%rsp), %eax + ja ..B1.196 +..B1.194: + jne ..B1.197 +..B1.195: + movl 400(%rsp), %eax + cmpl 544(%rsp), %eax + jbe ..B1.197 +..B1.196: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 560(%rsp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B1.198 +..B1.197: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 560(%rsp) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) +..B1.198: + fld %st(0) + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B1.203 +..B1.199: + cmpq $0, 400(%rsp) + je ..B1.201 +..B1.200: + lea -16517(%rdx,%rdi), %eax + lea -16383(%r8,%r9), %edx + cmpl %edx, %eax + jl ..B1.202 +..B1.201: + movaps 544(%rsp), %xmm0 + movaps 560(%rsp), %xmm1 + movaps 576(%rsp), %xmm2 + movaps %xmm0, 16(%rsp) + movaps %xmm1, 32(%rsp) + movaps %xmm2, 48(%rsp) + jmp ..B1.203 +..B1.202: + movaps 400(%rsp), %xmm0 + movaps 416(%rsp), %xmm1 + movaps 432(%rsp), %xmm2 + movaps %xmm0, 16(%rsp) + movaps %xmm1, 32(%rsp) + movaps %xmm2, 48(%rsp) +..B1.203: + lea 592(%rsp), %rdi + lea 16(%rsp), %rsi +..___tag_value___libm_recacoshl_k80.52: + call __libm_log1p_k80@PLT +..___tag_value___libm_recacoshl_k80.53: +..B1.204: + addq $-32, %rsp + .cfi_def_cfa_offset 720 + fldt 624(%rsp) + movl 656(%rsp), %edi + fstpt (%rsp) + fldt 640(%rsp) + fstpt 16(%rsp) +..___tag_value___libm_recacoshl_k80.55: + call __libm_scalbl_k80@PLT +..___tag_value___libm_recacoshl_k80.56: +..B1.211: + addq $32, %rsp + .cfi_def_cfa_offset 688 +..B1.205: + movq 640(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.207 +..B1.206: + addq $656, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 688 + .cfi_offset 6, -32 + .cfi_offset 13, -16 + .cfi_offset 15, -24 +..B1.207: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.208: + fldt 32(%rsp) + incl %edx + lea halfs(%rip), %rax + movl %edx, 528(%rsp) + fldt (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fstpt 512(%rsp) + fldt 512(%rsp) + fxch %st(1) + fstpt 496(%rsp) + fxch %st(1) + jmp ..B1.175 + .align 16,0x90 + .cfi_endproc + .type __libm_recacoshl_k80,@function + .size __libm_recacoshl_k80,.-__libm_recacoshl_k80 + .data +# -- End __libm_recacoshl_k80 + .section .rodata, "a" + .align 16 + .align 16 +ones: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type ones,@object + .size ones,32 + .align 16 +zeros: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type zeros,@object + .size zeros,32 + .align 16 +t32: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t32,@object + .size t32,32 + .align 16 +halfs: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type halfs,@object + .size halfs,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_recacosl_recasinl_k80.S b/external/sgx_libm/intel64/libm_recacosl_recasinl_k80.S new file mode 100644 index 0000000000..233a1e1097 --- /dev/null +++ b/external/sgx_libm/intel64/libm_recacosl_recasinl_k80.S @@ -0,0 +1,5813 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_recacosl_recasinl_k80.c" + .text +..TXTST0: +# -- Begin __libm_carctrigprepare_k80 + .text + .align 16,0x90 + .globl __libm_carctrigprepare_k80 +__libm_carctrigprepare_k80: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +# parameter 7: 320 + %rsp +# parameter 8: 328 + %rsp +# parameter 9: 336 + %rsp +# parameter 10: 344 + %rsp +..B1.1: + .cfi_startproc +..___tag_value___libm_carctrigprepare_k80.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $272, %rsp + .cfi_def_cfa_offset 320 + lea ones(%rip), %r10 + movq %rdx, %rbp + lea zeros(%rip), %r11 + movq %fs:40, %rax + movq %rcx, %r13 + xorq %rsp, %rax + movq %r9, %r14 + fldt (%r10) + movq %r8, %r12 + fldt (%r11) + movq %rsi, %rbx + movq (%rdi), %r10 + movq %rax, 256(%rsp) + xorl %eax, %eax + movq %r10, (%rbp) + movq 8(%rdi), %rdx + movb 9(%rdi), %cl + movq %rbp, %rdi + movq %rdx, 8(%rbp) + andb $127, %cl + movl %eax, 96(%rsp) + fstpt (%rsp) + fldt (%rsp) + fxch %st(1) + fstpt 64(%rsp) + fstpt 80(%rsp) + fldt 80(%rsp) + movl %eax, 32(%rbp) + movb %cl, 9(%rbp) + fstpt 16(%rbp) +..___tag_value___libm_carctrigprepare_k80.14: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.15: +..B1.2: + fldt (%rsp) + movq %r13, %rdi + movq (%rbx), %rax + movq %rax, (%r13) + movq 8(%rbx), %rdx + movb 9(%rbx), %cl + movq %rdx, 8(%r13) + andb $127, %cl + movl $0, 32(%r13) + movb %cl, 9(%r13) + fstpt 16(%r13) +..___tag_value___libm_carctrigprepare_k80.16: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.17: +..B1.3: + fldt (%r13) + lea t32(%rip), %rdx + fld %st(0) + fld %st(1) + fld %st(2) + fldt 16(%r13) + fmulp %st, %st(4) + movq 320(%rsp), %rbx + fxch %st(3) + fadd %st(0), %st + fldt (%rdx) + fmul %st, %st(3) + movl 32(%r13), %eax + fxch %st(2) + fsub %st(3), %st + addl %eax, %eax + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(3) + fsubr %st, %st(4) + fmul %st(4), %st + movl %eax, 32(%rbx) + fadd %st(0), %st + fxch %st(4) + fmul %st(0), %st + fxch %st(2) + fstpt 16(%rsp) + fld %st(3) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt (%rbx) + fldt (%rbx) + fsubrp %st, %st(1) + movzwl 8(%rbp), %edx + movl %edx, %eax + andl $32767, %eax + fadd %st(1), %st + fstpt 16(%rbx) + cmpl $8383, %eax + fstpt 32(%rsp) + jl ..B1.7 +..B1.4: + cmpl $24383, %eax + jg ..B1.7 +..B1.5: + movzwl 72(%rsp), %esi + movl %esi, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B1.7 +..B1.6: + cmpl $24383, %r8d + jle ..B1.10 +..B1.7: + movq %rbp, %rdi +..___tag_value___libm_carctrigprepare_k80.18: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.19: +..B1.8: + lea 64(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.20: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.21: +..B1.9: + movzwl 8(%rbp), %edx + movl %edx, %eax + movzwl 72(%rsp), %esi + movl %esi, %r8d + andl $32767, %eax + andl $32767, %r8d +..B1.10: + movl 32(%rbp), %ecx + movl 96(%rsp), %r9d + lea (%rax,%rcx), %r13d + lea -134(%r9,%r8), %r11d + cmpl %r13d, %r11d + lea (%r8,%r9), %r10d + jge ..B1.27 +..B1.11: + lea 134(%r9,%r8), %edi + cmpl %edi, %r13d + jge ..B1.27 +..B1.12: + cmpl $0, 4(%rbp) + jne ..B1.14 +..B1.13: + cmpl $0, (%rbp) + je ..B1.27 +..B1.14: + cmpl $0, 68(%rsp) + jne ..B1.16 +..B1.15: + cmpl $0, 64(%rsp) + je ..B1.27 +..B1.16: + cmpl %r9d, %ecx + je ..B1.18 +..B1.17: + fldt 32(%rsp) + subl %r9d, %ecx + fstpt (%rsp) + addl $16383, %ecx + fldt (%rbp) + andl $32767, %ecx + fldt 16(%rbp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r9d, 32(%rbp) + fxch %st(2) + fstpt (%rbp) + fldt (%rbp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbp) + fstpt 32(%rsp) + movzwl 8(%rbp), %edx + jmp ..B1.19 +..B1.18: + fldt (%rbp) + fstpt 32(%rsp) +..B1.19: + fldt 64(%rsp) + movl %esi, %eax + fldt 32(%rsp) + andl $32767, %edx + andl $32767, %eax + movl %r9d, 32(%r14) + cmpl %eax, %edx + fadd %st(1), %st + fstpt 16(%r14) + fldt 16(%r14) + jg ..B1.24 +..B1.20: + movl %esi, %eax + andl $32767, %eax + cmpl %eax, %edx + jne ..B1.25 +..B1.21: + movl 4(%rbp), %eax + cmpl 68(%rsp), %eax + ja ..B1.24 +..B1.22: + jne ..B1.25 +..B1.23: + movl (%rbp), %eax + cmpl 64(%rsp), %eax + jbe ..B1.25 +..B1.24: + fldt 32(%rsp) + fsub %st(1), %st + faddp %st, %st(2) + fldt 80(%rsp) + faddp %st, %st(2) + fldt 16(%rbp) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) + jmp ..B1.26 +..B1.25: + fldt 32(%rsp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 80(%rsp) + fldt 16(%rbp) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) +..B1.26: + fldt 32(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt (%r14) + fldt (%r14) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%r14) + jmp ..B1.31 +..B1.27: + cmpq $0, (%rbp) + je ..B1.29 +..B1.28: + lea -16517(%r9,%r8), %edx + lea -16383(%rcx,%rax), %eax + cmpl %eax, %edx + jl ..B1.30 +..B1.29: + movq 64(%rsp), %rax + movq %rax, (%r14) + movq 96(%rsp), %rax + movq %rax, 32(%r14) + movq 72(%rsp), %rdx + movq 80(%rsp), %rcx + movq 88(%rsp), %r13 + movq 104(%rsp), %rax + movq %rdx, 8(%r14) + movq %rcx, 16(%r14) + movq %r13, 24(%r14) + movq %rax, 40(%r14) + jmp ..B1.31 +..B1.30: + movq (%rbp), %rax + movq %rax, (%r14) + movq 8(%rbp), %rdx + movq %rdx, 8(%r14) + movq 16(%rbp), %rcx + movq %rcx, 16(%r14) + movq 24(%rbp), %r13 + movq %r13, 24(%r14) + movq 32(%rbp), %rax + movq %rax, 32(%r14) + movq 40(%rbp), %rax + movq %rax, 40(%r14) +..B1.31: + movzwl 8(%rbp), %edx + movl %edx, %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.35 +..B1.32: + cmpl $24383, %eax + jg ..B1.35 +..B1.33: + cmpl $8383, %r8d + jl ..B1.35 +..B1.34: + cmpl $24383, %r8d + jle ..B1.38 +..B1.35: + movq %rbp, %rdi +..___tag_value___libm_carctrigprepare_k80.22: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.23: +..B1.36: + lea 64(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.24: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.25: +..B1.37: + movzwl 72(%rsp), %esi + movl %esi, %ecx + andl $32767, %ecx + movl 96(%rsp), %r9d + movzwl 8(%rbp), %edx + movl %edx, %eax + andl $32767, %eax + lea (%r9,%rcx), %r10d + lea -134(%r9,%rcx), %r11d +..B1.38: + movl 32(%rbp), %r13d + lea (%rax,%r13), %ecx + cmpl %ecx, %r11d + jge ..B1.55 +..B1.39: + lea 134(%r10), %r8d + cmpl %r8d, %ecx + jge ..B1.55 +..B1.40: + cmpl $0, 4(%rbp) + jne ..B1.42 +..B1.41: + cmpl $0, (%rbp) + je ..B1.55 +..B1.42: + cmpl $0, 68(%rsp) + jne ..B1.44 +..B1.43: + cmpl $0, 64(%rsp) + je ..B1.55 +..B1.44: + cmpl %r9d, %r13d + je ..B1.46 +..B1.45: + fldt 32(%rsp) + subl %r9d, %r13d + fstpt (%rsp) + addl $16383, %r13d + fldt (%rbp) + andl $32767, %r13d + fldt 16(%rbp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %r13d, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r9d, 32(%rbp) + fxch %st(2) + fstpt (%rbp) + fldt (%rbp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbp) + movzwl 8(%rbp), %edx + jmp ..B1.47 +..B1.46: + fldt (%rbp) +..B1.47: + fldt 64(%rsp) + fld %st(1) + movl %esi, %eax + andl $32767, %edx + andl $32767, %eax + fadd %st(1), %st + movl %r9d, 32(%r14) + cmpl %eax, %edx + fstpt 16(%r14) + fldt 16(%r14) + jg ..B1.52 +..B1.48: + andl $32767, %esi + cmpl %esi, %edx + jne ..B1.53 +..B1.49: + movl 4(%rbp), %eax + cmpl 68(%rsp), %eax + ja ..B1.52 +..B1.50: + jne ..B1.53 +..B1.51: + movl (%rbp), %eax + cmpl 64(%rsp), %eax + jbe ..B1.53 +..B1.52: + fldt 80(%rsp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 16(%rbp) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.54 +..B1.53: + fldt 16(%rbp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 80(%rsp) + faddp %st, %st(1) +..B1.54: + fld %st(0) + fadd %st(2), %st + fstpt (%r14) + fldt (%r14) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%r14) + jmp ..B1.59 +..B1.55: + cmpq $0, (%rbp) + je ..B1.57 +..B1.56: + addl $-16517, %r10d + lea -16383(%r13,%rax), %eax + cmpl %eax, %r10d + jl ..B1.58 +..B1.57: + movq 64(%rsp), %rax + movq 72(%rsp), %rdx + movq 80(%rsp), %rcx + movq 88(%rsp), %rsi + movq 96(%rsp), %r8 + movq 104(%rsp), %r9 + movq %rax, (%r14) + movq %rdx, 8(%r14) + movq %rcx, 16(%r14) + movq %rsi, 24(%r14) + movq %r8, 32(%r14) + movq %r9, 40(%r14) + jmp ..B1.59 +..B1.58: + movq (%rbp), %rax + movq %rax, (%r14) + movq 8(%rbp), %rdx + movq %rdx, 8(%r14) + movq 16(%rbp), %rcx + movq %rcx, 16(%r14) + movq 24(%rbp), %rsi + movq %rsi, 24(%r14) + movq 32(%rbp), %r8 + movq %r8, 32(%r14) + movq 40(%rbp), %r9 + movq %r9, 40(%r14) +..B1.59: + movzwl 8(%r14), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.61 +..B1.60: + cmpl $24383, %eax + jle ..B1.63 +..B1.61: + movq %r14, %rdi +..___tag_value___libm_carctrigprepare_k80.26: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.27: +..B1.62: + movq %r14, %rdi +..___tag_value___libm_carctrigprepare_k80.28: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.29: +..B1.63: + fldt (%r14) + fld %st(0) + fld %st(1) + fldt 16(%r14) + fldt 16(%rsp) + movl 32(%r14), %eax + fmul %st(4), %st + addl %eax, %eax + movl %eax, 144(%rsp) + fsubr %st, %st(3) + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(1) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubrp %st, %st(2) + movzwl 120(%rsp), %esi + movl %esi, %r11d + andl $32767, %r11d + fadd %st, %st(1) + fxch %st(1) + fstpt 128(%rsp) + cmpl $8383, %r11d + fstpt 32(%rsp) + jl ..B1.67 +..B1.64: + cmpl $24383, %r11d + jg ..B1.67 +..B1.65: + movzwl 8(%rbx), %r8d + movl %r8d, %r10d + andl $32767, %r10d + cmpl $8383, %r10d + jl ..B1.67 +..B1.66: + cmpl $24383, %r10d + jle ..B1.70 +..B1.67: + lea 112(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.30: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.31: +..B1.68: + movq %rbx, %rdi +..___tag_value___libm_carctrigprepare_k80.32: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.33: +..B1.69: + movzwl 120(%rsp), %esi + movl %esi, %r11d + movzwl 8(%rbx), %r8d + movl %r8d, %r10d + movl 144(%rsp), %eax + andl $32767, %r11d + andl $32767, %r10d +..B1.70: + movl 32(%rbx), %r9d + lea (%rax,%r11), %ecx + lea -134(%r9,%r10), %edx + cmpl %edx, %ecx + jle ..B1.87 +..B1.71: + lea 134(%r9,%r10), %edx + cmpl %edx, %ecx + jge ..B1.87 +..B1.72: + cmpl $0, 116(%rsp) + jne ..B1.74 +..B1.73: + cmpl $0, 112(%rsp) + je ..B1.87 +..B1.74: + cmpl $0, 4(%rbx) + jne ..B1.76 +..B1.75: + cmpl $0, (%rbx) + je ..B1.87 +..B1.76: + cmpl %r9d, %eax + je ..B1.78 +..B1.77: + fldt 32(%rsp) + subl %r9d, %eax + fstpt (%rsp) + addl $16383, %eax + fldt 112(%rsp) + andl $32767, %eax + fldt 128(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %edx + andl $-32768, %edx + orl %eax, %edx + movw %dx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movl %r9d, 144(%rsp) + fstpt 128(%rsp) + fldt 128(%rsp) + movzwl 120(%rsp), %esi + jmp ..B1.79 +..B1.78: + fldt 112(%rsp) + fldt 128(%rsp) +..B1.79: + fldt (%rbx) + movl %esi, %eax + andl $32767, %r8d + andl $32767, %eax + fld %st(2) + cmpl %r8d, %eax + movl %r9d, 192(%rsp) + fadd %st(1), %st + jg ..B1.84 +..B1.80: + andl $32767, %esi + cmpl %r8d, %esi + jne ..B1.85 +..B1.81: + movl 4(%rbx), %eax + cmpl 116(%rsp), %eax + jb ..B1.84 +..B1.82: + jne ..B1.85 +..B1.83: + movl 112(%rsp), %eax + cmpl (%rbx), %eax + jbe ..B1.85 +..B1.84: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 16(%rbx) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.86 +..B1.85: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 16(%rbx) + faddp %st, %st(1) +..B1.86: + fld %st(0) + fadd %st(2), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 176(%rsp) + jmp ..B1.91 +..B1.87: + cmpq $0, 112(%rsp) + je ..B1.89 +..B1.88: + lea -16517(%r9,%r10), %edx + lea -16383(%rax,%r11), %eax + cmpl %eax, %edx + jl ..B1.90 +..B1.89: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rsi + movq 32(%rbx), %r8 + movq 40(%rbx), %r9 + movq %rax, 160(%rsp) + movq %rdx, 168(%rsp) + movq %rcx, 176(%rsp) + movq %rsi, 184(%rsp) + movq %r8, 192(%rsp) + movq %r9, 200(%rsp) + jmp ..B1.91 +..B1.90: + movaps 112(%rsp), %xmm0 + movaps 128(%rsp), %xmm1 + movaps 144(%rsp), %xmm2 + movaps %xmm0, 160(%rsp) + movaps %xmm1, 176(%rsp) + movaps %xmm2, 192(%rsp) +..B1.91: + movzwl 168(%rsp), %eax + andl $32767, %eax + cmpl $383, %eax + jl ..B1.93 +..B1.92: + cmpl $32383, %eax + jle ..B1.94 +..B1.93: + lea 160(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.34: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.35: +..B1.94: + movl 192(%rsp), %edx + testb $1, %dl + jne ..B1.193 +..B1.95: + fldt 160(%rsp) + lea halfs(%rip), %rax + fstpt 48(%rsp) + fldt 176(%rsp) + fldt (%rax) + fstpt 32(%rsp) +..B1.96: + fldt 48(%rsp) + fld %st(0) + fsqrt + fldt 16(%rsp) + movq 328(%rsp), %r13 + fmul %st(1), %st + fld %st(0) + sarl $1, %edx + fsubr %st(2), %st + movl %edx, 32(%r13) + faddp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fmulp %st, %st(1) + fdiv %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt (%r13) + fldt (%r13) + fsubrp %st, %st(2) + movzwl 8(%rbp), %r9d + movl %r9d, %r11d + andl $32767, %r11d + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%r13) + cmpl $8383, %r11d + fstpt 48(%rsp) + jl ..B1.100 +..B1.97: + cmpl $24383, %r11d + jg ..B1.100 +..B1.98: + movzwl 72(%rsp), %ecx + movl %ecx, %r10d + andl $32767, %r10d + cmpl $8383, %r10d + jl ..B1.100 +..B1.99: + cmpl $24383, %r10d + jle ..B1.103 +..B1.100: + movq %rbp, %rdi +..___tag_value___libm_carctrigprepare_k80.36: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.37: +..B1.101: + lea 64(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.38: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.39: +..B1.102: + movzwl 8(%rbp), %r9d + movl %r9d, %r11d + movzwl 72(%rsp), %ecx + movl %ecx, %r10d + andl $32767, %r11d + andl $32767, %r10d +..B1.103: + movl 32(%rbp), %eax + movl 96(%rsp), %edx + lea (%r11,%rax), %r8d + lea -134(%rdx,%r10), %esi + cmpl %esi, %r8d + jle ..B1.120 +..B1.104: + lea 134(%rdx,%r10), %esi + cmpl %esi, %r8d + jge ..B1.120 +..B1.105: + cmpl $0, 4(%rbp) + jne ..B1.107 +..B1.106: + cmpl $0, (%rbp) + je ..B1.120 +..B1.107: + cmpl $0, 68(%rsp) + jne ..B1.109 +..B1.108: + cmpl $0, 64(%rsp) + je ..B1.120 +..B1.109: + cmpl %edx, %eax + je ..B1.111 +..B1.110: + fldt 48(%rsp) + subl %edx, %eax + fstpt (%rsp) + addl $16383, %eax + fldt (%rbp) + andl $32767, %eax + fldt 16(%rbp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %esi + andl $-32768, %esi + orl %eax, %esi + movw %si, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%rbp) + fxch %st(2) + fstpt (%rbp) + fldt (%rbp) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbp) + movzwl 8(%rbp), %r9d + jmp ..B1.112 +..B1.111: + fldt (%rbp) +..B1.112: + fldt 64(%rsp) + fld %st(1) + movl %ecx, %eax + andl $32767, %r9d + andl $32767, %eax + fsub %st(1), %st + movl %edx, 32(%r12) + cmpl %eax, %r9d + fstpt 16(%r12) + fldt 16(%r12) + jg ..B1.117 +..B1.113: + andl $32767, %ecx + cmpl %ecx, %r9d + jne ..B1.118 +..B1.114: + movl 4(%rbp), %eax + cmpl 68(%rsp), %eax + ja ..B1.117 +..B1.115: + jne ..B1.118 +..B1.116: + movl (%rbp), %eax + cmpl 64(%rsp), %eax + jbe ..B1.118 +..B1.117: + fldt 16(%rbp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt 80(%rsp) + fsubrp %st, %st(3) + faddp %st, %st(2) + jmp ..B1.119 +..B1.118: + fldt 80(%rsp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fldt 16(%rbp) + faddp %st, %st(3) + fsubrp %st, %st(2) +..B1.119: + fld %st(1) + fadd %st(1), %st + fstpt (%r12) + fldt (%r12) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%r12) + jmp ..B1.124 +..B1.120: + cmpq $0, (%rbp) + je ..B1.122 +..B1.121: + lea -16517(%rdx,%r10), %ecx + lea -16383(%rax,%r11), %eax + cmpl %eax, %ecx + jl ..B1.123 +..B1.122: + fldt 64(%rsp) + fchs + movl %edx, 32(%r12) + fstpt (%r12) + fldt 80(%rsp) + fchs + fstpt 16(%r12) + jmp ..B1.124 +..B1.123: + movq (%rbp), %rax + movq %rax, (%r12) + movq 8(%rbp), %rdx + movq %rdx, 8(%r12) + movq 16(%rbp), %rcx + movq %rcx, 16(%r12) + movq 24(%rbp), %rsi + movq %rsi, 24(%r12) + movq 32(%rbp), %r8 + movq %r8, 32(%r12) + movq 40(%rbp), %rbp + movq %rbp, 40(%r12) +..B1.124: + movzwl 8(%r12), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B1.126 +..B1.125: + cmpl $24383, %eax + jle ..B1.128 +..B1.126: + movq %r12, %rdi +..___tag_value___libm_carctrigprepare_k80.40: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.41: +..B1.127: + movq %r12, %rdi +..___tag_value___libm_carctrigprepare_k80.42: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.43: +..B1.128: + fldt (%r12) + fld %st(0) + fld %st(1) + fldt 16(%r12) + fldt 16(%rsp) + movl 32(%r12), %r9d + fmul %st(4), %st + addl %r9d, %r9d + movl %r9d, 144(%rsp) + fsubr %st, %st(3) + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(1) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + fadd %st(0), %st + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubrp %st, %st(2) + movzwl 120(%rsp), %ecx + movl %ecx, %r10d + andl $32767, %r10d + fadd %st, %st(1) + fxch %st(1) + fstpt 128(%rsp) + cmpl $8383, %r10d + fstpt 48(%rsp) + jl ..B1.132 +..B1.129: + cmpl $24383, %r10d + jg ..B1.132 +..B1.130: + movzwl 8(%rbx), %ebp + movl %ebp, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B1.132 +..B1.131: + cmpl $24383, %r8d + jle ..B1.135 +..B1.132: + lea 112(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.44: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.45: +..B1.133: + movq %rbx, %rdi +..___tag_value___libm_carctrigprepare_k80.46: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.47: +..B1.134: + movzwl 120(%rsp), %ecx + movl %ecx, %r10d + movzwl 8(%rbx), %ebp + movl %ebp, %r8d + movl 144(%rsp), %r9d + andl $32767, %r10d + andl $32767, %r8d +..B1.135: + movl 32(%rbx), %esi + lea (%r9,%r10), %edx + lea -134(%rsi,%r8), %eax + cmpl %eax, %edx + jle ..B1.152 +..B1.136: + lea 134(%rsi,%r8), %eax + cmpl %eax, %edx + jge ..B1.152 +..B1.137: + cmpl $0, 116(%rsp) + jne ..B1.139 +..B1.138: + cmpl $0, 112(%rsp) + je ..B1.152 +..B1.139: + cmpl $0, 4(%rbx) + jne ..B1.141 +..B1.140: + cmpl $0, (%rbx) + je ..B1.152 +..B1.141: + cmpl %esi, %r9d + je ..B1.143 +..B1.142: + fldt 48(%rsp) + subl %esi, %r9d + fstpt (%rsp) + addl $16383, %r9d + fldt 112(%rsp) + andl $32767, %r9d + fldt 128(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %r9d, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movl %esi, 144(%rsp) + fstpt 128(%rsp) + fldt 128(%rsp) + movzwl 120(%rsp), %ecx + jmp ..B1.144 +..B1.143: + fldt 112(%rsp) + fldt 128(%rsp) +..B1.144: + fldt (%rbx) + movl %ecx, %eax + andl $32767, %ebp + andl $32767, %eax + fld %st(2) + cmpl %ebp, %eax + movl %esi, 240(%rsp) + fadd %st(1), %st + jg ..B1.149 +..B1.145: + andl $32767, %ecx + cmpl %ebp, %ecx + jne ..B1.150 +..B1.146: + movl 4(%rbx), %eax + cmpl 116(%rsp), %eax + jb ..B1.149 +..B1.147: + jne ..B1.150 +..B1.148: + movl 112(%rsp), %eax + cmpl (%rbx), %eax + jbe ..B1.150 +..B1.149: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 16(%rbx) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.151 +..B1.150: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 16(%rbx) + faddp %st, %st(1) +..B1.151: + fld %st(0) + fadd %st(2), %st + fstpt 208(%rsp) + fldt 208(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 224(%rsp) + jmp ..B1.156 +..B1.152: + cmpq $0, 112(%rsp) + je ..B1.154 +..B1.153: + lea -16517(%rsi,%r8), %eax + lea -16383(%r9,%r10), %edx + cmpl %edx, %eax + jl ..B1.155 +..B1.154: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 208(%rsp) + movq %rdx, 216(%rsp) + movq %rcx, 224(%rsp) + movq %rbp, 232(%rsp) + movq %rsi, 240(%rsp) + movq %rbx, 248(%rsp) + jmp ..B1.156 +..B1.155: + movaps 112(%rsp), %xmm0 + movaps 128(%rsp), %xmm1 + movaps 144(%rsp), %xmm2 + movaps %xmm0, 208(%rsp) + movaps %xmm1, 224(%rsp) + movaps %xmm2, 240(%rsp) +..B1.156: + movzwl 216(%rsp), %eax + andl $32767, %eax + cmpl $383, %eax + jl ..B1.158 +..B1.157: + cmpl $32383, %eax + jle ..B1.159 +..B1.158: + lea 208(%rsp), %rdi +..___tag_value___libm_carctrigprepare_k80.48: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.49: +..B1.159: + movl 240(%rsp), %r11d + testl $1, %r11d + jne ..B1.192 +..B1.160: + fldt 208(%rsp) + fstpt 48(%rsp) + fldt 224(%rsp) +..B1.161: + fldt 48(%rsp) + fld %st(0) + fsqrt + fldt 16(%rsp) + fmul %st(1), %st + fld %st(0) + movq 336(%rsp), %rbx + fsubr %st(2), %st + sarl $1, %r11d + faddp %st, %st(1) + fld %st(0) + movl %r11d, 32(%rbx) + fsubr %st(2), %st + fld %st(1) + fmul %st(2), %st + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fmulp %st, %st(1) + fdiv %st(1), %st + fld %st(0) + fadd %st(2), %st + fstpt (%rbx) + fldt (%rbx) + fsubrp %st, %st(2) + movzwl 8(%r13), %ebp + movl %ebp, %r10d + andl $32767, %r10d + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rbx) + cmpl $8383, %r10d + fstpt 48(%rsp) + jl ..B1.165 +..B1.162: + cmpl $24383, %r10d + jg ..B1.165 +..B1.163: + movzwl 8(%rbx), %esi + movl %esi, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B1.165 +..B1.164: + cmpl $24383, %r8d + jle ..B1.168 +..B1.165: + movq %r13, %rdi +..___tag_value___libm_carctrigprepare_k80.50: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.51: +..B1.166: + movq %rbx, %rdi +..___tag_value___libm_carctrigprepare_k80.52: + call __libm_normalizel_k80@PLT +..___tag_value___libm_carctrigprepare_k80.53: +..B1.167: + movzwl 8(%r13), %ebp + movl %ebp, %r10d + movzwl 8(%rbx), %esi + movl %esi, %r8d + movl 32(%rbx), %r11d + andl $32767, %r10d + andl $32767, %r8d +..B1.168: + movl 32(%r13), %r9d + lea -134(%r11,%r8), %edx + movq 344(%rsp), %rax + lea (%r10,%r9), %ecx + cmpl %edx, %ecx + jle ..B1.185 +..B1.169: + lea 134(%r11,%r8), %edx + cmpl %edx, %ecx + jge ..B1.185 +..B1.170: + cmpl $0, 4(%r13) + jne ..B1.172 +..B1.171: + cmpl $0, (%r13) + je ..B1.185 +..B1.172: + cmpl $0, 4(%rbx) + jne ..B1.174 +..B1.173: + cmpl $0, (%rbx) + je ..B1.185 +..B1.174: + cmpl %r11d, %r9d + je ..B1.176 +..B1.175: + fldt 48(%rsp) + subl %r11d, %r9d + fstpt (%rsp) + addl $16383, %r9d + fldt (%r13) + andl $32767, %r9d + fldt 16(%r13) + andb $127, 9(%rsp) + movzwl 8(%rsp), %edx + andl $-32768, %edx + orl %r9d, %edx + movw %dx, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %r11d, 32(%r13) + fxch %st(2) + fstpt (%r13) + fldt (%r13) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r13) + movl 32(%rbx), %r11d + movzwl 8(%rbx), %esi + movzwl 8(%r13), %ebp + jmp ..B1.177 +..B1.176: + fldt (%r13) +..B1.177: + fldt (%rbx) + fld %st(1) + andl $32767, %ebp + andl $32767, %esi + movl %r11d, 32(%rax) + cmpl %esi, %ebp + fadd %st(1), %st + fstpt 16(%rax) + fldt 16(%rax) + jg ..B1.182 +..B1.178: + jne ..B1.183 +..B1.179: + movl 4(%r13), %edx + cmpl 4(%rbx), %edx + ja ..B1.182 +..B1.180: + jne ..B1.183 +..B1.181: + movl (%r13), %edx + cmpl (%rbx), %edx + jbe ..B1.183 +..B1.182: + fldt 16(%rbx) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 16(%r13) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B1.184 +..B1.183: + fldt 16(%r13) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 16(%rbx) + faddp %st, %st(1) + fstpt (%rsp) + fldt (%rsp) +..B1.184: + fld %st(0) + fadd %st(2), %st + fstpt (%rax) + fldt (%rax) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rax) + jmp ..B1.189 +..B1.185: + cmpq $0, (%r13) + je ..B1.187 +..B1.186: + lea -16517(%r11,%r8), %edx + lea -16383(%r9,%r10), %ecx + cmpl %ecx, %edx + jl ..B1.188 +..B1.187: + movq (%rbx), %rdx + movq %rdx, (%rax) + movq 8(%rbx), %rcx + movq %rcx, 8(%rax) + movq 16(%rbx), %rbp + movq %rbp, 16(%rax) + movq 24(%rbx), %rsi + movq %rsi, 24(%rax) + movq 32(%rbx), %r8 + movq %r8, 32(%rax) + movq 40(%rbx), %rbx + movq %rbx, 40(%rax) + jmp ..B1.189 +..B1.188: + movq (%r13), %rdx + movq %rdx, (%rax) + movq 8(%r13), %rcx + movq %rcx, 8(%rax) + movq 16(%r13), %rbx + movq %rbx, 16(%rax) + movq 24(%r13), %rbp + movq %rbp, 24(%rax) + movq 32(%r13), %rsi + movq %rsi, 32(%rax) + movq 40(%r13), %rdi + movq %rdi, 40(%rax) +..B1.189: + movq 256(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.191 +..B1.190: + addq $272, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 320 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.191: + call __stack_chk_fail@PLT +..B1.192: + fldt 208(%rsp) + incl %r11d + fldt 32(%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 208(%rsp) + fldt 224(%rsp) + fmulp %st, %st(1) + movl %r11d, 240(%rsp) + fstpt 224(%rsp) + fldt 224(%rsp) + jmp ..B1.161 +..B1.193: + fldt 160(%rsp) + incl %edx + lea halfs(%rip), %rax + movl %edx, 192(%rsp) + fldt (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fstpt 160(%rsp) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt 176(%rsp) + fmulp %st, %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + jmp ..B1.96 + .align 16,0x90 + .cfi_endproc + .type __libm_carctrigprepare_k80,@function + .size __libm_carctrigprepare_k80,.-__libm_carctrigprepare_k80 + .data +# -- End __libm_carctrigprepare_k80 + .text +# -- Begin __libm_recacosl_k80 + .text + .align 16,0x90 + .globl __libm_recacosl_k80 +__libm_recacosl_k80: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +# parameter 7: 864 + %rsp +# parameter 8: 872 + %rsp +# parameter 9: 880 + %rsp +# parameter 10: 888 + %rsp +..B2.1: + .cfi_startproc +..___tag_value___libm_recacosl_k80.72: +..L73: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $808, %rsp + .cfi_def_cfa_offset 864 + movq %rdx, %r12 + movq %fs:40, %rax + movq %r9, %r15 + xorq %rsp, %rax + movq %r8, %rbp + movq %rax, 800(%rsp) + movq %rdi, %r14 + movzwl 8(%r12), %eax + andl $32767, %eax + movq 888(%rsp), %r13 + cmpl $8383, %eax + jl ..B2.5 +..B2.2: + cmpl $24383, %eax + jg ..B2.5 +..B2.3: + movzwl 8(%r13), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.5 +..B2.4: + cmpl $24383, %eax + jle ..B2.7 +..B2.5: + movq %r12, %rdi +..___tag_value___libm_recacosl_k80.87: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.88: +..B2.6: + movq %r13, %rdi +..___tag_value___libm_recacosl_k80.89: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.90: +..B2.7: + fldt (%r12) + lea t32(%rip), %rax + fld %st(0) + fldt (%r13) + fdivr %st, %st(1) + fld %st(0) + fld %st(1) + fldt (%rax) + fld %st(0) + fmul %st(5), %st + fld %st(0) + movl 32(%r12), %ebx + fsubr %st(6), %st + subl 32(%r13), %ebx + faddp %st, %st(1) + fld %st(0) + lea 1(%rbx), %edx + movl %edx, 784(%rsp) + fsubr %st(6), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(4) + fld %st(4) + fsub %st(4), %st + fxch %st(3) + fstpt 48(%rsp) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fldt 16(%r12) + faddp %st, %st(3) + fldt 16(%r13) + fmul %st(2), %st + fsubrp %st, %st(3) + fdivrp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 752(%rsp) + fldt 752(%rsp) + fsubrp %st, %st(1) + movzwl 760(%rsp), %ecx + fadd %st(1), %st + andl $32767, %ecx + fstpt 768(%rsp) + fstpt 16(%rsp) + lea 1(%rcx,%rbx), %esi + cmpl $16382, %esi + jl ..B2.192 +..B2.8: + movzwl 8(%r14), %eax + andl $32767, %eax + movq 880(%rsp), %rbx + cmpl $16383, %eax + jl ..B2.37 +..B2.9: + movq 864(%rsp), %r9 + movq (%r9), %rax + movq 8(%r9), %rdx + movq 16(%r9), %rcx + movq 24(%r9), %rsi + movq 32(%r9), %r8 + movq 40(%r9), %r10 + movzwl 8(%rbx), %r9d + movq %rax, 416(%rsp) + movl %r9d, %eax + andl $32767, %eax + movq %rdx, 424(%rsp) + cmpl $8383, %eax + movq %rcx, 432(%rsp) + movq %rsi, 440(%rsp) + movq %r8, 448(%rsp) + movq %r10, 456(%rsp) + jl ..B2.13 +..B2.10: + cmpl $24383, %eax + jg ..B2.13 +..B2.11: + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %r11d + cmpl $8383, %r11d + jl ..B2.13 +..B2.12: + cmpl $24383, %r11d + jle ..B2.16 +..B2.13: + movq %rbx, %rdi +..___tag_value___libm_recacosl_k80.91: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.92: +..B2.14: + movq %rbp, %rdi +..___tag_value___libm_recacosl_k80.93: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.94: +..B2.15: + movzwl 8(%rbx), %r9d + movl %r9d, %eax + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %eax + andl $32767, %r11d +..B2.16: + movl 32(%rbp), %edx + movl 32(%rbx), %ecx + lea -134(%rdx,%r11), %esi + lea (%rax,%rcx), %r8d + cmpl %r8d, %esi + jge ..B2.33 +..B2.17: + lea 134(%rdx,%r11), %esi + cmpl %esi, %r8d + jge ..B2.33 +..B2.18: + cmpl $0, 4(%rbx) + jne ..B2.20 +..B2.19: + cmpl $0, (%rbx) + je ..B2.33 +..B2.20: + cmpl $0, 4(%rbp) + jne ..B2.22 +..B2.21: + cmpl $0, (%rbp) + je ..B2.33 +..B2.22: + cmpl %edx, %ecx + je ..B2.24 +..B2.23: + fldt 16(%rsp) + subl %edx, %ecx + fstpt (%rsp) + addl $16383, %ecx + fldt (%rbx) + andl $32767, %ecx + fldt 16(%rbx) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%rbx) + fxch %st(2) + fstpt (%rbx) + fldt (%rbx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbx) + fldt 16(%rbx) + fxch %st(1) + fstpt 16(%rsp) + movl 32(%rbp), %edx + movzwl 8(%rbp), %r10d + movzwl 8(%rbx), %r9d + jmp ..B2.25 +..B2.24: + fldt (%rbx) + fstpt 16(%rsp) + fldt 16(%rbx) +..B2.25: + fldt (%rbp) + andl $32767, %r9d + fldt 16(%rsp) + andl $32767, %r10d + movl %edx, 496(%rsp) + cmpl %r10d, %r9d + fadd %st(1), %st + jg ..B2.30 +..B2.26: + jne ..B2.31 +..B2.27: + movl 4(%rbx), %eax + cmpl 4(%rbp), %eax + ja ..B2.30 +..B2.28: + jne ..B2.31 +..B2.29: + movl (%rbx), %eax + cmpl (%rbp), %eax + jbe ..B2.31 +..B2.30: + fldt 16(%rsp) + fsub %st(1), %st + faddp %st, %st(2) + fldt 16(%rbp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B2.32 +..B2.31: + fldt 16(%rsp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 16(%rbp) + faddp %st, %st(1) + fstpt 16(%rsp) +..B2.32: + fldt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 464(%rsp) + fldt 464(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 480(%rsp) + jmp ..B2.65 +..B2.33: + cmpq $0, (%rbx) + je ..B2.35 +..B2.34: + lea -16517(%rdx,%r11), %edx + lea -16383(%rcx,%rax), %eax + cmpl %eax, %edx + jl ..B2.36 +..B2.35: + movq (%rbp), %rax + movq 8(%rbp), %rdx + movq 16(%rbp), %rcx + movq 24(%rbp), %rbx + movq 32(%rbp), %rsi + movq 40(%rbp), %rbp + movq %rax, 464(%rsp) + movq %rdx, 472(%rsp) + movq %rcx, 480(%rsp) + movq %rbx, 488(%rsp) + movq %rsi, 496(%rsp) + movq %rbp, 504(%rsp) + jmp ..B2.65 +..B2.36: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 464(%rsp) + movq %rdx, 472(%rsp) + movq %rcx, 480(%rsp) + movq %rbp, 488(%rsp) + movq %rsi, 496(%rsp) + movq %rbx, 504(%rsp) + jmp ..B2.65 +..B2.37: + lea ones(%rip), %rax + lea zeros(%rip), %rdx + movzwl 8(%rbx), %r9d + movl $0, 496(%rsp) + fldt (%rax) + movl %r9d, %eax + andl $32767, %eax + fstpt 464(%rsp) + cmpl $8383, %eax + fldt (%rdx) + fstpt 480(%rsp) + jl ..B2.41 +..B2.38: + cmpl $24383, %eax + jg ..B2.41 +..B2.39: + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %r11d + cmpl $8383, %r11d + jl ..B2.41 +..B2.40: + cmpl $24383, %r11d + jle ..B2.44 +..B2.41: + movq %rbx, %rdi +..___tag_value___libm_recacosl_k80.95: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.96: +..B2.42: + movq %rbp, %rdi +..___tag_value___libm_recacosl_k80.97: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.98: +..B2.43: + movzwl 8(%rbx), %r9d + movl %r9d, %eax + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %eax + andl $32767, %r11d +..B2.44: + movl 32(%rbp), %edx + movl 32(%rbx), %ecx + lea -134(%rdx,%r11), %esi + lea (%rax,%rcx), %r8d + cmpl %r8d, %esi + jge ..B2.61 +..B2.45: + lea 134(%rdx,%r11), %esi + cmpl %esi, %r8d + jge ..B2.61 +..B2.46: + cmpl $0, 4(%rbx) + jne ..B2.48 +..B2.47: + cmpl $0, (%rbx) + je ..B2.61 +..B2.48: + cmpl $0, 4(%rbp) + jne ..B2.50 +..B2.49: + cmpl $0, (%rbp) + je ..B2.61 +..B2.50: + cmpl %edx, %ecx + je ..B2.52 +..B2.51: + fldt 16(%rsp) + subl %edx, %ecx + fstpt (%rsp) + addl $16383, %ecx + fldt (%rbx) + andl $32767, %ecx + fldt 16(%rbx) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%rbx) + fxch %st(2) + fstpt (%rbx) + fldt (%rbx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbx) + fldt 16(%rbx) + fstpt 16(%rsp) + movl 32(%rbp), %edx + movzwl 8(%rbp), %r10d + movzwl 8(%rbx), %r9d + jmp ..B2.53 +..B2.52: + fldt (%rbx) + fldt 16(%rbx) + fstpt 16(%rsp) +..B2.53: + fldt (%rbp) + andl $32767, %r9d + andl $32767, %r10d + fld %st(1) + movl %edx, 448(%rsp) + cmpl %r10d, %r9d + fsub %st(1), %st + jg ..B2.58 +..B2.54: + jne ..B2.59 +..B2.55: + movl 4(%rbx), %eax + cmpl 4(%rbp), %eax + ja ..B2.58 +..B2.56: + jne ..B2.59 +..B2.57: + movl (%rbx), %eax + cmpl (%rbp), %eax + jbe ..B2.59 +..B2.58: + fldt 16(%rsp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt 16(%rbp) + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + jmp ..B2.60 +..B2.59: + fldt 16(%rbp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fldt 16(%rsp) + faddp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) +..B2.60: + fldt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 432(%rsp) + jmp ..B2.65 +..B2.61: + cmpq $0, (%rbx) + je ..B2.63 +..B2.62: + lea -16517(%rdx,%r11), %esi + lea -16383(%rcx,%rax), %eax + cmpl %eax, %esi + jl ..B2.64 +..B2.63: + fldt (%rbp) + fchs + movl %edx, 448(%rsp) + fstpt 416(%rsp) + fldt 16(%rbp) + fchs + fstpt 432(%rsp) + jmp ..B2.65 +..B2.64: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 416(%rsp) + movq %rdx, 424(%rsp) + movq %rcx, 432(%rsp) + movq %rbp, 440(%rsp) + movq %rsi, 448(%rsp) + movq %rbx, 456(%rsp) +..B2.65: + movzwl 8(%r12), %ebp + movl %ebp, %r9d + andl $32767, %r9d + movl 32(%r12), %edx + incl %edx + movl %edx, 32(%r12) + cmpl $8383, %r9d + jl ..B2.69 +..B2.66: + cmpl $24383, %r9d + jg ..B2.69 +..B2.67: + movzwl 8(%r13), %eax + movl %eax, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B2.69 +..B2.68: + cmpl $24383, %r8d + jle ..B2.72 +..B2.69: + movq %r12, %rdi +..___tag_value___libm_recacosl_k80.99: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.100: +..B2.70: + movq %r13, %rdi +..___tag_value___libm_recacosl_k80.101: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.102: +..B2.71: + movzwl 8(%r12), %ebp + movl %ebp, %r9d + movzwl 8(%r13), %eax + movl %eax, %r8d + movl 32(%r12), %edx + andl $32767, %r9d + andl $32767, %r8d +..B2.72: + movl 32(%r13), %esi + lea (%rdx,%r9), %ebx + lea -134(%rsi,%r8), %ecx + cmpl %ecx, %ebx + jle ..B2.89 +..B2.73: + lea 134(%rsi,%r8), %ecx + cmpl %ecx, %ebx + jge ..B2.89 +..B2.74: + cmpl $0, 4(%r12) + jne ..B2.76 +..B2.75: + cmpl $0, (%r12) + je ..B2.89 +..B2.76: + cmpl $0, 4(%r13) + jne ..B2.78 +..B2.77: + cmpl $0, (%r13) + je ..B2.89 +..B2.78: + cmpl %esi, %edx + je ..B2.80 +..B2.79: + fldt 16(%rsp) + subl %esi, %edx + fstpt (%rsp) + addl $16383, %edx + fldt (%r12) + andl $32767, %edx + fldt 16(%r12) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edx, %eax + movl %esi, %edx + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %esi, 32(%r12) + fxch %st(2) + fstpt (%r12) + fldt (%r12) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r12) + fldt 16(%r12) + movl 32(%r13), %esi + movzwl 8(%r13), %eax + movzwl 8(%r12), %ebp + jmp ..B2.81 +..B2.80: + fldt (%r12) + fldt 16(%r12) +..B2.81: + fldt (%r13) + movl %eax, %ecx + andl $32767, %ebp + andl $32767, %ecx + fld %st(2) + cmpl %ecx, %ebp + movl %esi, 544(%rsp) + fadd %st(1), %st + jg ..B2.86 +..B2.82: + jne ..B2.87 +..B2.83: + movl 4(%r12), %ecx + cmpl 4(%r13), %ecx + ja ..B2.86 +..B2.84: + jne ..B2.87 +..B2.85: + movl (%r12), %ecx + cmpl (%r13), %ecx + jbe ..B2.87 +..B2.86: + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 16(%r13) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + jmp ..B2.88 +..B2.87: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%r13) + faddp %st, %st(2) +..B2.88: + fld %st(1) + fadd %st(1), %st + fstpt 512(%rsp) + fldt 512(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 528(%rsp) + jmp ..B2.93 +..B2.89: + cmpq $0, (%r12) + je ..B2.91 +..B2.90: + lea -16517(%rsi,%r8), %ecx + lea -16383(%rdx,%r9), %ebx + cmpl %ebx, %ecx + jl ..B2.92 +..B2.91: + movq (%r13), %rcx + movq 8(%r13), %rbx + movq 16(%r13), %rbp + movq 24(%r13), %rsi + movq 32(%r13), %r8 + movq 40(%r13), %r9 + movq %rcx, 512(%rsp) + movq %rbx, 520(%rsp) + movq %rbp, 528(%rsp) + movq %rsi, 536(%rsp) + movq %r8, 544(%rsp) + movq %r9, 552(%rsp) + jmp ..B2.93 +..B2.92: + movq (%r12), %rcx + movq 8(%r12), %rbx + movq 16(%r12), %rbp + movq 24(%r12), %rsi + movq 32(%r12), %r8 + movq 40(%r12), %r9 + movq %rcx, 512(%rsp) + movq %rbx, 520(%rsp) + movq %rbp, 528(%rsp) + movq %rsi, 536(%rsp) + movq %r8, 544(%rsp) + movq %r9, 552(%rsp) +..B2.93: + decl %edx + movl %edx, 32(%r12) + movzwl 520(%rsp), %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B2.97 +..B2.94: + cmpl $24383, %edx + jg ..B2.97 +..B2.95: + movzwl 424(%rsp), %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B2.97 +..B2.96: + cmpl $24383, %edx + jle ..B2.99 +..B2.97: + lea 512(%rsp), %rdi +..___tag_value___libm_recacosl_k80.103: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.104: +..B2.98: + lea 416(%rsp), %rdi +..___tag_value___libm_recacosl_k80.105: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.106: + movzwl 8(%r13), %eax +..B2.99: + fldt 512(%rsp) + andl $32767, %eax + fld %st(0) + fld %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(4), %st + movl 544(%rsp), %edx + fsubr %st, %st(3) + addl 448(%rsp), %edx + faddp %st, %st(3) + fld %st(2) + cmpl $8383, %eax + movl %edx, 592(%rsp) + fxch %st(2) + fsub %st(3), %st + fldt 416(%rsp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 432(%rsp) + fmulp %st, %st(4) + fldt 528(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 560(%rsp) + fldt 560(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 576(%rsp) + jl ..B2.103 +..B2.100: + cmpl $24383, %eax + jg ..B2.103 +..B2.101: + movzwl 472(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.103 +..B2.102: + cmpl $24383, %eax + jle ..B2.105 +..B2.103: + movq %r13, %rdi +..___tag_value___libm_recacosl_k80.107: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.108: +..B2.104: + lea 464(%rsp), %rdi +..___tag_value___libm_recacosl_k80.109: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.110: +..B2.105: + fldt (%r13) + fld %st(0) + fld %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(4), %st + movq 872(%rsp), %rbx + fsubr %st, %st(3) + movzwl 8(%rbx), %ecx + movl %ecx, %r10d + movl 496(%rsp), %eax + andl $32767, %r10d + addl 32(%r13), %eax + faddp %st, %st(3) + fld %st(2) + cmpl $8383, %r10d + movl %eax, 640(%rsp) + fxch %st(2) + fsub %st(3), %st + fldt 464(%rsp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 480(%rsp) + fmulp %st, %st(4) + fldt 16(%r13) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 608(%rsp) + fldt 608(%rsp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 624(%rsp) + fstpt 16(%rsp) + jl ..B2.109 +..B2.106: + cmpl $24383, %r10d + jg ..B2.109 +..B2.107: + movzwl 8(%r15), %ebp + movl %ebp, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B2.109 +..B2.108: + cmpl $24383, %r8d + jle ..B2.112 +..B2.109: + movq %rbx, %rdi +..___tag_value___libm_recacosl_k80.111: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.112: +..B2.110: + movq %r15, %rdi +..___tag_value___libm_recacosl_k80.113: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.114: +..B2.111: + movzwl 8(%rbx), %ecx + movl %ecx, %r10d + movzwl 8(%r15), %ebp + movl %ebp, %r8d + andl $32767, %r10d + andl $32767, %r8d +..B2.112: + movl 32(%r15), %esi + movl 32(%rbx), %r9d + lea -134(%rsi,%r8), %eax + lea (%r10,%r9), %edx + cmpl %eax, %edx + jle ..B2.129 +..B2.113: + lea 134(%rsi,%r8), %eax + cmpl %eax, %edx + jge ..B2.129 +..B2.114: + cmpl $0, 4(%rbx) + jne ..B2.116 +..B2.115: + cmpl $0, (%rbx) + je ..B2.129 +..B2.116: + cmpl $0, 4(%r15) + jne ..B2.118 +..B2.117: + cmpl $0, (%r15) + je ..B2.129 +..B2.118: + cmpl %esi, %r9d + je ..B2.120 +..B2.119: + fldt 16(%rsp) + subl %esi, %r9d + fstpt (%rsp) + addl $16383, %r9d + fldt (%rbx) + andl $32767, %r9d + fldt 16(%rbx) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %r9d, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %esi, 32(%rbx) + fxch %st(2) + fstpt (%rbx) + fldt (%rbx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbx) + fldt 16(%rbx) + movl 32(%r15), %esi + movzwl 8(%r15), %ebp + movzwl 8(%rbx), %ecx + jmp ..B2.121 +..B2.120: + fldt (%rbx) + fldt 16(%rbx) +..B2.121: + fldt (%r15) + andl $32767, %ecx + andl $32767, %ebp + fld %st(2) + movl %esi, 688(%rsp) + cmpl %ebp, %ecx + fadd %st(1), %st + jg ..B2.126 +..B2.122: + jne ..B2.127 +..B2.123: + movl 4(%rbx), %eax + cmpl 4(%r15), %eax + ja ..B2.126 +..B2.124: + jne ..B2.127 +..B2.125: + movl (%rbx), %eax + cmpl (%r15), %eax + jbe ..B2.127 +..B2.126: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 16(%r15) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B2.128 +..B2.127: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 16(%r15) + faddp %st, %st(1) +..B2.128: + fld %st(0) + fadd %st(2), %st + fstpt 656(%rsp) + fldt 656(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 672(%rsp) + jmp ..B2.133 +..B2.129: + cmpq $0, (%rbx) + je ..B2.131 +..B2.130: + lea -16517(%rsi,%r8), %eax + lea -16383(%r9,%r10), %edx + cmpl %edx, %eax + jl ..B2.132 +..B2.131: + movq (%r15), %rax + movq 8(%r15), %rdx + movq 16(%r15), %rcx + movq 24(%r15), %rbx + movq 32(%r15), %rbp + movq 40(%r15), %rsi + movq %rax, 656(%rsp) + movq %rdx, 664(%rsp) + movq %rcx, 672(%rsp) + movq %rbx, 680(%rsp) + movq %rbp, 688(%rsp) + movq %rsi, 696(%rsp) + jmp ..B2.133 +..B2.132: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 656(%rsp) + movq %rdx, 664(%rsp) + movq %rcx, 672(%rsp) + movq %rbp, 680(%rsp) + movq %rsi, 688(%rsp) + movq %rbx, 696(%rsp) +..B2.133: + movzwl 616(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.137 +..B2.134: + cmpl $24383, %eax + jg ..B2.137 +..B2.135: + movzwl 664(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.137 +..B2.136: + cmpl $24383, %eax + jle ..B2.139 +..B2.137: + lea 608(%rsp), %rdi +..___tag_value___libm_recacosl_k80.115: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.116: +..B2.138: + lea 656(%rsp), %rdi +..___tag_value___libm_recacosl_k80.117: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.118: +..B2.139: + fldt 608(%rsp) + fld %st(0) + fld %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(4), %st + movl 640(%rsp), %edx + fsubr %st, %st(3) + movzwl 568(%rsp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + addl 688(%rsp), %edx + fxch %st(2) + fsub %st(3), %st + fldt 656(%rsp) + cmpl $8383, %eax + fmul %st, %st(2) + fld %st(0) + movl %edx, 736(%rsp) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 672(%rsp) + fmulp %st, %st(4) + fldt 624(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 704(%rsp) + fldt 704(%rsp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 720(%rsp) + fldt 720(%rsp) + jl ..B2.143 +..B2.140: + cmpl $24383, %eax + jg ..B2.143 +..B2.141: + movzwl 712(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B2.143 +..B2.142: + cmpl $24383, %eax + jle ..B2.146 +..B2.143: + fstp %st(1) + fstp %st(0) + lea 560(%rsp), %rdi +..___tag_value___libm_recacosl_k80.119: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.120: +..B2.144: + lea 704(%rsp), %rdi +..___tag_value___libm_recacosl_k80.121: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.122: +..B2.145: + fldt 704(%rsp) + fldt 720(%rsp) + movl 736(%rsp), %edx +..B2.146: + fldt 560(%rsp) + fld %st(2) + fdivr %st(1), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(4) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt 48(%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movl 592(%rsp), %ecx + fsubr %st(4), %st + subl %edx, %ecx + faddp %st, %st(1) + fld %st(0) + testb $-128, 9(%r14) + fsubr %st(4), %st + fxch %st(2) + fmul %st(3), %st + fsubr %st, %st(7) + faddp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fld %st(2) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fxch %st(4) + fsubrp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fldt 576(%rsp) + faddp %st, %st(1) + fsubp %st, %st(1) + fldt 32(%rsp) + fdivrp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fstpt 16(%rsp) + jne ..B2.155 +..B2.147: + fstpt 320(%rsp) + fldt 320(%rsp) + decl %ecx + movzwl 328(%rsp), %eax + andl $32767, %eax + movl %ecx, 352(%rsp) + cmpl $383, %eax + fxch %st(1) + fstpt 336(%rsp) + fldt 336(%rsp) + jl ..B2.149 +..B2.148: + cmpl $32383, %eax + jle ..B2.151 +..B2.149: + fstp %st(0) + fstp %st(0) + lea 320(%rsp), %rdi +..___tag_value___libm_recacosl_k80.123: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.124: +..B2.150: + fldt 320(%rsp) + fldt 336(%rsp) + movl 352(%rsp), %ecx +..B2.151: + testb $1, %cl + jne ..B2.226 +..B2.152: + lea halfs(%rip), %rax + fldt (%rax) +..B2.153: + fldt 48(%rsp) + fld %st(3) + fsqrt + lea 224(%rsp), %rdi + fmul %st, %st(1) + lea 368(%rsp), %rsi + fld %st(1) + sarl $1, %ecx + fsubr %st(1), %st + movl %ecx, 32(%rsi) + faddp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + fdivr %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt (%rsi) + fldt (%rsi) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsi) +..___tag_value___libm_recacosl_k80.125: + call asinpoly +..___tag_value___libm_recacosl_k80.126: +..B2.154: + fldt 224(%rsp) + fldt 240(%rsp) + movl 256(%rsp), %edi + incl %edi + movl %edi, 256(%rsp) + jmp ..B2.223 +..B2.155: + fstpt 128(%rsp) + fldt 128(%rsp) + decl %ecx + movzwl 136(%rsp), %eax + andl $32767, %eax + movl %ecx, 160(%rsp) + cmpl $383, %eax + fxch %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + jl ..B2.157 +..B2.156: + cmpl $32383, %eax + jle ..B2.159 +..B2.157: + fstp %st(0) + fstp %st(0) + lea 128(%rsp), %rdi +..___tag_value___libm_recacosl_k80.127: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.128: +..B2.158: + fldt 128(%rsp) + fldt 144(%rsp) + movl 160(%rsp), %ecx +..B2.159: + testb $1, %cl + jne ..B2.227 +..B2.160: + lea halfs(%rip), %rax + fldt (%rax) +..B2.161: + fldt 48(%rsp) + fld %st(3) + fsqrt + lea 80(%rsp), %rdi + fmul %st, %st(1) + lea 176(%rsp), %rsi + fld %st(1) + sarl $1, %ecx + fsubr %st(1), %st + movl %ecx, 32(%rsi) + faddp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + fdivr %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt (%rsi) + fldt (%rsi) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsi) +..___tag_value___libm_recacosl_k80.129: + call asinpoly +..___tag_value___libm_recacosl_k80.130: +..B2.162: + lea 16+_PIO2_K80(%rip), %rax + lea 32+_PIO2_K80(%rip), %rdx + movl 112(%rsp), %edi + movl $1, %ebp + incl %edi + movl %edi, 112(%rsp) + fldt (%rax) + movzwl 8(%rax), %esi + andl $32767, %esi + movl $1, 304(%rsp) + cmpl $8383, %esi + fstpt 272(%rsp) + fldt (%rdx) + fstpt 288(%rsp) + jl ..B2.166 +..B2.163: + cmpl $24383, %esi + jg ..B2.166 +..B2.164: + movzwl 88(%rsp), %ebx + andl $32767, %ebx + cmpl $8383, %ebx + jl ..B2.166 +..B2.165: + cmpl $24383, %ebx + jle ..B2.169 +..B2.166: + lea 272(%rsp), %rdi +..___tag_value___libm_recacosl_k80.131: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.132: +..B2.167: + lea 80(%rsp), %rdi +..___tag_value___libm_recacosl_k80.133: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.134: +..B2.168: + movzwl 280(%rsp), %esi + movzwl 88(%rsp), %ebx + andl $32767, %esi + movl 112(%rsp), %edi + andl $32767, %ebx + movl 304(%rsp), %ebp +..B2.169: + lea (%rbp,%rsi), %edx + lea -134(%rdi,%rbx), %eax + cmpl %eax, %edx + jle ..B2.186 +..B2.170: + movl 276(%rsp), %ecx + lea 134(%rdi,%rbx), %eax + cmpl %eax, %edx + jge ..B2.187 +..B2.171: + testl %ecx, %ecx + jne ..B2.173 +..B2.172: + cmpl $0, 272(%rsp) + je ..B2.188 +..B2.173: + movl 84(%rsp), %edx + testl %edx, %edx + jne ..B2.175 +..B2.174: + cmpl $0, 80(%rsp) + je ..B2.187 +..B2.175: + cmpl %edi, %ebp + je ..B2.177 +..B2.176: + fldt 16(%rsp) + subl %edi, %ebp + fstpt (%rsp) + addl $16383, %ebp + fldt 272(%rsp) + andl $32767, %ebp + fldt 288(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ebp, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 272(%rsp) + fldt 272(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 280(%rsp), %esi + movl %edi, 304(%rsp) + andl $32767, %esi + fstpt 288(%rsp) + fldt 288(%rsp) + jmp ..B2.178 +..B2.177: + fldt 272(%rsp) + fldt 288(%rsp) +..B2.178: + fldt 80(%rsp) + fld %st(2) + movl %edi, 256(%rsp) + cmpl %ebx, %esi + fsub %st(1), %st + jg ..B2.183 +..B2.179: + jne ..B2.184 +..B2.180: + movl 276(%rsp), %eax + cmpl %edx, %eax + ja ..B2.183 +..B2.181: + jne ..B2.184 +..B2.182: + movl 272(%rsp), %eax + cmpl 80(%rsp), %eax + jbe ..B2.184 +..B2.183: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 96(%rsp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B2.185 +..B2.184: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 96(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) +..B2.185: + fld %st(0) + fadd %st(2), %st + fstpt 224(%rsp) + fldt 224(%rsp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 240(%rsp) + fldt 240(%rsp) + jmp ..B2.223 +..B2.186: + movl 276(%rsp), %ecx +..B2.187: + testl %ecx, %ecx + jne ..B2.189 +..B2.232: + cmpl $0, 272(%rsp) +..B2.188: + je ..B2.190 +..B2.189: + lea -16517(%rdi,%rbx), %eax + lea -16383(%rbp,%rsi), %edx + cmpl %edx, %eax + jl ..B2.191 +..B2.190: + fldt 80(%rsp) + fchs + movl %edi, 256(%rsp) + fstpt 224(%rsp) + fldt 224(%rsp) + fldt 96(%rsp) + fchs + fstpt 240(%rsp) + fldt 240(%rsp) + jmp ..B2.223 +..B2.191: + fldt 272(%rsp) + fldt 288(%rsp) + movaps 272(%rsp), %xmm0 + movaps 288(%rsp), %xmm1 + movaps 304(%rsp), %xmm2 + movl 304(%rsp), %edi + movaps %xmm0, 224(%rsp) + movaps %xmm1, 240(%rsp) + movaps %xmm2, 256(%rsp) + jmp ..B2.223 +..B2.192: + lea 16+_PIO2_K80(%rip), %rax + lea 32+_PIO2_K80(%rip), %rdx + movl $0, 64(%rsp) + lea 80(%rsp), %rdi + lea 752(%rsp), %rsi + fldt (%rax) + fstpt -48(%rdi) + fldt (%rdx) + fstpt -32(%rdi) +..___tag_value___libm_recacosl_k80.135: + call asinpoly +..___tag_value___libm_recacosl_k80.136: +..B2.193: + fldt 80(%rsp) + lea ones(%rip), %rcx + fldt 96(%rsp) + movb 9(%r14), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + shlq $4, %rdx + movzwl 40(%rsp), %ebp + andl $32767, %ebp + cmpl $8383, %ebp + fldt (%rdx,%rcx) + fmul %st, %st(2) + fxch %st(2) + fstpt 80(%rsp) + fmulp %st, %st(1) + fstpt 96(%rsp) + jl ..B2.197 +..B2.194: + cmpl $24383, %ebp + jg ..B2.197 +..B2.195: + movzwl 88(%rsp), %ebx + andl $32767, %ebx + cmpl $8383, %ebx + jl ..B2.197 +..B2.196: + cmpl $24383, %ebx + jle ..B2.200 +..B2.197: + lea 32(%rsp), %rdi +..___tag_value___libm_recacosl_k80.137: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.138: +..B2.198: + lea 80(%rsp), %rdi +..___tag_value___libm_recacosl_k80.139: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recacosl_k80.140: +..B2.199: + movzwl 88(%rsp), %ebx + movzwl 40(%rsp), %ebp + andl $32767, %ebx + andl $32767, %ebp +..B2.200: + movl 112(%rsp), %edi + movl 64(%rsp), %esi + lea -134(%rdi,%rbx), %eax + lea (%rbp,%rsi), %edx + cmpl %eax, %edx + jle ..B2.217 +..B2.201: + movl 36(%rsp), %ecx + lea 134(%rdi,%rbx), %eax + cmpl %eax, %edx + jge ..B2.218 +..B2.202: + testl %ecx, %ecx + jne ..B2.204 +..B2.203: + cmpl $0, 32(%rsp) + je ..B2.219 +..B2.204: + movl 84(%rsp), %edx + testl %edx, %edx + jne ..B2.206 +..B2.205: + cmpl $0, 80(%rsp) + je ..B2.218 +..B2.206: + cmpl %edi, %esi + je ..B2.208 +..B2.207: + fldt 16(%rsp) + subl %edi, %esi + fstpt (%rsp) + addl $16383, %esi + fldt 32(%rsp) + andl $32767, %esi + fldt 48(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %esi, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 40(%rsp), %ebp + movl %edi, 64(%rsp) + andl $32767, %ebp + fstpt 48(%rsp) + fldt 48(%rsp) + jmp ..B2.209 +..B2.208: + fldt 32(%rsp) + fldt 48(%rsp) +..B2.209: + fldt 80(%rsp) + fld %st(2) + movl %edi, 256(%rsp) + cmpl %ebx, %ebp + fsub %st(1), %st + jg ..B2.214 +..B2.210: + jne ..B2.215 +..B2.211: + movl 36(%rsp), %eax + cmpl %edx, %eax + ja ..B2.214 +..B2.212: + jne ..B2.215 +..B2.213: + movl 32(%rsp), %eax + cmpl 80(%rsp), %eax + jbe ..B2.215 +..B2.214: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 96(%rsp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B2.216 +..B2.215: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 96(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) +..B2.216: + fld %st(0) + fadd %st(2), %st + fstpt 224(%rsp) + fldt 224(%rsp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 240(%rsp) + fldt 240(%rsp) + jmp ..B2.223 +..B2.217: + movl 36(%rsp), %ecx +..B2.218: + testl %ecx, %ecx + jne ..B2.220 +..B2.233: + cmpl $0, 32(%rsp) +..B2.219: + je ..B2.190 +..B2.220: + lea -16517(%rdi,%rbx), %eax + lea -16383(%rsi,%rbp), %edx + cmpl %edx, %eax + jge ..B2.190 +..B2.222: + fldt 32(%rsp) + movl %esi, %edi + fldt 48(%rsp) + movaps 32(%rsp), %xmm0 + movaps 48(%rsp), %xmm1 + movaps 64(%rsp), %xmm2 + movaps %xmm0, 224(%rsp) + movaps %xmm1, 240(%rsp) + movaps %xmm2, 256(%rsp) +..B2.223: + addq $-32, %rsp + .cfi_def_cfa_offset 896 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_recacosl_k80.142: + call __libm_scalbl_k80@PLT +..___tag_value___libm_recacosl_k80.143: +..B2.231: + addq $32, %rsp + .cfi_def_cfa_offset 864 +..B2.224: + movq 800(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B2.228 +..B2.225: + addq $808, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 864 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.226: + lea halfs(%rip), %rax + incl %ecx + movl %ecx, 352(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt 320(%rsp) + fldt 320(%rsp) + fxch %st(1) + fmul %st(2), %st + fstpt 336(%rsp) + fldt 336(%rsp) + fxch %st(1) + fxch %st(2) + jmp ..B2.153 +..B2.227: + lea halfs(%rip), %rax + incl %ecx + movl %ecx, 160(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt 128(%rsp) + fldt 128(%rsp) + fxch %st(1) + fmul %st(2), %st + fstpt 144(%rsp) + fldt 144(%rsp) + fxch %st(1) + fxch %st(2) + jmp ..B2.161 +..B2.228: + fstp %st(0) + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __libm_recacosl_k80,@function + .size __libm_recacosl_k80,.-__libm_recacosl_k80 + .data +# -- End __libm_recacosl_k80 + .text +# -- Begin asinpoly + .text + .align 16,0x90 +asinpoly: +# parameter 1: %rdi +# parameter 2: %rsi +..B3.1: + .cfi_startproc +..___tag_value_asinpoly.166: +..L167: + + subq $184, %rsp + .cfi_def_cfa_offset 192 + lea ones(%rip), %rax + movl 32(%rsi), %r8d + movzwl 8(%rsi), %ecx + andl $32767, %ecx + fldt (%rax) + lea 16383(%r8), %edx + movzwl 8(%rax), %eax + andl $32767, %edx + andl $-32768, %eax + addl %ecx, %r8d + orl %edx, %eax + fstpt 112(%rsp) + cmpl $16343, %r8d + jl ..B3.38 +..B3.2: + fldt (%rsi) + lea 240+_ASIN_POLY(%rip), %rdx + fldt 16(%rsi) + lea 208+_ASIN_POLY(%rip), %rcx + movw %ax, 120(%rsp) + lea 272+_ASIN_POLY(%rip), %rax + fldt 112(%rsp) + lea 176+_ASIN_POLY(%rip), %rsi + fmul %st, %st(2) + lea 144+_ASIN_POLY(%rip), %r8 + fld %st(2) + lea 112+_ASIN_POLY(%rip), %r9 + fmul %st(3), %st + lea 80+_ASIN_POLY(%rip), %r10 + fld %st(0) + lea 256+_ASIN_POLY(%rip), %r11 + fmul %st(1), %st + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fxch %st(3) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + fldt (%rax) + lea 224+_ASIN_POLY(%rip), %rax + fmul %st(2), %st + fldt (%rdx) + lea 192+_ASIN_POLY(%rip), %rdx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 160+_ASIN_POLY(%rip), %rcx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 128+_ASIN_POLY(%rip), %rsi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + lea 96+_ASIN_POLY(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + lea 64+_ASIN_POLY(%rip), %r9 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + lea t32(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdx) + lea 48+_ASIN_POLY(%rip), %rdx + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r9) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + fld %st(1) + fldt (%r10) + fstpt 48(%rsp) + fldt 48(%rsp) + fmul %st(3), %st + movzwl 168(%rsp), %eax + fsubr %st, %st(1) + andl $32767, %eax + faddp %st, %st(1) + fld %st(0) + cmpl $16377, %eax + fsubr %st(3), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fld %st(1) + fmul %st(2), %st + fxch %st(5) + fmulp %st, %st(4) + fxch %st(3) + fadd %st(0), %st + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fmul %st(3), %st + fadd %st(0), %st + fld %st(0) + fadd %st(5), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(6) + fxch %st(2) + faddp %st, %st(6) + fxch %st(4) + fmul %st(0), %st + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt (%rdx) + fld %st(0) + fadd %st(2), %st + jg ..B3.7 +..B3.3: + jne ..B3.8 +..B3.4: + movl 164(%rsp), %eax + cmpl 4(%rdx), %eax + ja ..B3.7 +..B3.5: + jne ..B3.8 +..B3.6: + movl 160(%rsp), %eax + cmpl (%rdx), %eax + jbe ..B3.8 +..B3.7: + lea 336+_ASIN_POLY(%rip), %rdx + fsubr %st, %st(2) + lea zeros(%rip), %rax + fxch %st(1) + faddp %st, %st(2) + fldt (%rax) + fldt (%rdx) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + jmp ..B3.9 +..B3.8: + lea zeros(%rip), %rax + fsubr %st, %st(1) + lea 336+_ASIN_POLY(%rip), %rdx + fxch %st(2) + faddp %st, %st(1) + fldt (%rax) + faddp %st, %st(1) + fldt (%rdx) + faddp %st, %st(1) +..B3.9: + fldt 64(%rsp) + lea 32+_ASIN_POLY(%rip), %rdx + fld %st(0) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fsubr %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fxch %st(3) + fmul %st, %st(5) + fldt 48(%rsp) + fld %st(0) + fmul %st(6), %st + fsubr %st, %st(5) + faddp %st, %st(5) + fxch %st(2) + fsub %st(4), %st + fld %st(1) + fmulp %st, %st(3) + fxch %st(2) + fsubr %st, %st(3) + faddp %st, %st(3) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubr %st, %st(2) + fxch %st(2) + fstpt 128(%rsp) + fldt 128(%rsp) + fld %st(3) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(4) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fldt 96(%rsp) + fmulp %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fldt 128(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubr %st, %st(2) + movzwl 168(%rsp), %eax + fxch %st(1) + faddp %st, %st(2) + fldt (%rdx) + andl $32767, %eax + fld %st(0) + cmpl $16378, %eax + fadd %st(2), %st + jg ..B3.14 +..B3.10: + jne ..B3.15 +..B3.11: + movl 164(%rsp), %eax + cmpl 4(%rdx), %eax + ja ..B3.14 +..B3.12: + jne ..B3.15 +..B3.13: + movl 160(%rsp), %eax + cmpl (%rdx), %eax + jbe ..B3.15 +..B3.14: + lea 320+_ASIN_POLY(%rip), %rax + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + jmp ..B3.16 +..B3.15: + lea 320+_ASIN_POLY(%rip), %rax + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt (%rax) + faddp %st, %st(2) +..B3.16: + fldt 112(%rsp) + lea 16+_ASIN_POLY(%rip), %rdx + fld %st(0) + fld %st(3) + fadd %st(3), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fsubr %st, %st(5) + fxch %st(6) + faddp %st, %st(5) + fldt 48(%rsp) + fmul %st(6), %st + fsubr %st, %st(1) + faddp %st, %st(1) + fmul %st, %st(2) + fsubr %st, %st(1) + fxch %st(1) + fmul %st, %st(3) + fldt 128(%rsp) + fmul %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 96(%rsp) + fmulp %st, %st(5) + fldt 64(%rsp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubr %st, %st(1) + movzwl 168(%rsp), %eax + fxch %st(2) + faddp %st, %st(1) + fldt (%rdx) + andl $32767, %eax + fld %st(0) + cmpl $16379, %eax + fadd %st(3), %st + jg ..B3.21 +..B3.17: + jne ..B3.22 +..B3.18: + movl 164(%rsp), %eax + cmpl 4(%rdx), %eax + ja ..B3.21 +..B3.19: + jne ..B3.22 +..B3.20: + movl 160(%rsp), %eax + cmpl (%rdx), %eax + jbe ..B3.22 +..B3.21: + lea 304+_ASIN_POLY(%rip), %rax + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt (%rax) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + jmp ..B3.23 +..B3.22: + lea 304+_ASIN_POLY(%rip), %rax + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt (%rax) + faddp %st, %st(1) +..B3.23: + fldt 112(%rsp) + lea _ASIN_POLY(%rip), %rdx + fld %st(0) + fld %st(2) + fadd %st(4), %st + fld %st(0) + fld %st(1) + fxch %st(2) + fsubr %st, %st(6) + fxch %st(5) + faddp %st, %st(6) + fldt 48(%rsp) + fmul %st(5), %st + fsubr %st, %st(1) + faddp %st, %st(1) + fmul %st, %st(2) + fsubr %st, %st(1) + fxch %st(1) + fmul %st, %st(3) + fldt 128(%rsp) + fmul %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 96(%rsp) + fmulp %st, %st(3) + fldt 64(%rsp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubr %st, %st(2) + movzwl 168(%rsp), %eax + fxch %st(1) + faddp %st, %st(2) + fldt (%rdx) + andl $32767, %eax + fld %st(0) + cmpl $16380, %eax + fadd %st(2), %st + jg ..B3.28 +..B3.24: + jne ..B3.29 +..B3.25: + movl 164(%rsp), %eax + cmpl 4(%rdx), %eax + ja ..B3.28 +..B3.26: + jne ..B3.29 +..B3.27: + movl 160(%rsp), %eax + cmpl (%rdx), %eax + jbe ..B3.29 +..B3.28: + lea 288+_ASIN_POLY(%rip), %rax + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + jmp ..B3.30 +..B3.29: + lea 288+_ASIN_POLY(%rip), %rax + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt (%rax) + faddp %st, %st(2) +..B3.30: + fldt 48(%rsp) + fld %st(2) + movzwl 152(%rsp), %edx + fadd %st(2), %st + fmul %st, %st(1) + fld %st(0) + andl $32767, %edx + fsub %st(2), %st + faddp %st, %st(2) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(2) + fsub %st(1), %st + fldt 112(%rsp) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fmul %st(2), %st + fldt 128(%rsp) + fmul %st, %st(4) + fxch %st(1) + faddp %st, %st(4) + fld %st(3) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fmulp %st, %st(2) + faddp %st, %st(1) + fld %st(1) + fldt 96(%rsp) + fmulp %st, %st(5) + fldt 64(%rsp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(2) + fldt 48(%rsp) + fmul %st(4), %st + fsubr %st, %st(1) + faddp %st, %st(1) + fsubr %st, %st(1) + fldt (%rsp) + fld %st(0) + fmul %st(2), %st + fxch %st(1) + fmul %st(3), %st + fldt 32(%rsp) + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(0) + fldt 16(%rsp) + fmulp %st, %st(5) + fldt 80(%rsp) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fadd %st(3), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubr %st, %st(1) + movzwl 168(%rsp), %eax + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fadd %st(2), %st + andl $32767, %eax + cmpl %edx, %eax + jg ..B3.35 +..B3.31: + jne ..B3.36 +..B3.32: + movl 164(%rsp), %eax + movl 148(%rsp), %edx + cmpl %edx, %eax + ja ..B3.35 +..B3.33: + jne ..B3.36 +..B3.34: + movl 160(%rsp), %eax + cmpl 144(%rsp), %eax + jbe ..B3.36 +..B3.35: + fldt 80(%rsp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 16(%rsp) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + jmp ..B3.37 +..B3.36: + fldt 80(%rsp) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + faddp %st, %st(2) +..B3.37: + fld %st(1) + movl $0, 32(%rdi) + fadd %st(1), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rdi) + addq $184, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 +..B3.38: + movq (%rsi), %rax + movq 8(%rsi), %rdx + movq 16(%rsi), %rcx + movq 24(%rsi), %r8 + movq 32(%rsi), %r9 + movq 40(%rsi), %rsi + movq %rax, (%rdi) + movq %rdx, 8(%rdi) + movq %rcx, 16(%rdi) + movq %r8, 24(%rdi) + movq %r9, 32(%rdi) + movq %rsi, 40(%rdi) +..B3.39: + addq $184, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type asinpoly,@function + .size asinpoly,.-asinpoly + .data +# -- End asinpoly + .text +# -- Begin __libm_recasinl_k80 + .text + .align 16,0x90 + .globl __libm_recasinl_k80 +__libm_recasinl_k80: +# parameter 1: %rdi +# parameter 2: %rsi +# parameter 3: %rdx +# parameter 4: %rcx +# parameter 5: %r8 +# parameter 6: %r9 +# parameter 7: 704 + %rsp +# parameter 8: 712 + %rsp +# parameter 9: 720 + %rsp +# parameter 10: 728 + %rsp +..B4.1: + .cfi_startproc +..___tag_value___libm_recasinl_k80.173: +..L174: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $648, %rsp + .cfi_def_cfa_offset 704 + movq %rdx, %r12 + movq %fs:40, %rax + movq %r9, %r14 + xorq %rsp, %rax + movq %r8, %rbp + movq %rax, 640(%rsp) + movq %rdi, %r15 + movzwl 8(%r12), %eax + andl $32767, %eax + movq 728(%rsp), %r13 + cmpl $8383, %eax + jl ..B4.5 +..B4.2: + cmpl $24383, %eax + jg ..B4.5 +..B4.3: + movzwl 8(%r13), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.5 +..B4.4: + cmpl $24383, %eax + jle ..B4.7 +..B4.5: + movq %r12, %rdi +..___tag_value___libm_recasinl_k80.188: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.189: +..B4.6: + movq %r13, %rdi +..___tag_value___libm_recasinl_k80.190: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.191: +..B4.7: + fldt (%r12) + lea t32(%rip), %rax + fld %st(0) + fldt (%r13) + fdivr %st, %st(1) + fld %st(0) + fld %st(1) + fldt (%rax) + fld %st(0) + fmul %st(5), %st + fld %st(0) + movl 32(%r12), %ebx + fsubr %st(6), %st + subl 32(%r13), %ebx + faddp %st, %st(1) + fld %st(0) + lea 1(%rbx), %edx + movl %edx, 624(%rsp) + fsubr %st(6), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(3) + fsub %st(4), %st + faddp %st, %st(4) + fld %st(4) + fsub %st(4), %st + fxch %st(3) + fstpt 48(%rsp) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fxch %st(1) + fsubrp %st, %st(4) + fsubrp %st, %st(3) + fldt 16(%r12) + faddp %st, %st(3) + fldt 16(%r13) + fmul %st(2), %st + fsubrp %st, %st(3) + fdivrp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 592(%rsp) + fldt 592(%rsp) + fsubrp %st, %st(1) + movzwl 600(%rsp), %ecx + fadd %st(1), %st + andl $32767, %ecx + fstpt 608(%rsp) + fstpt 16(%rsp) + lea 1(%rcx,%rbx), %esi + cmpl $16382, %esi + jl ..B4.183 +..B4.8: + movzwl 8(%r15), %eax + andl $32767, %eax + movq 720(%rsp), %rbx + cmpl $16383, %eax + jl ..B4.37 +..B4.9: + movq 704(%rsp), %r9 + movq (%r9), %rax + movq 8(%r9), %rdx + movq 16(%r9), %rcx + movq 24(%r9), %rsi + movq 32(%r9), %r8 + movq 40(%r9), %r10 + movzwl 8(%rbx), %r9d + movq %rax, 64(%rsp) + movl %r9d, %eax + andl $32767, %eax + movq %rdx, 72(%rsp) + cmpl $8383, %eax + movq %rcx, 80(%rsp) + movq %rsi, 88(%rsp) + movq %r8, 96(%rsp) + movq %r10, 104(%rsp) + jl ..B4.13 +..B4.10: + cmpl $24383, %eax + jg ..B4.13 +..B4.11: + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %r11d + cmpl $8383, %r11d + jl ..B4.13 +..B4.12: + cmpl $24383, %r11d + jle ..B4.16 +..B4.13: + movq %rbx, %rdi +..___tag_value___libm_recasinl_k80.192: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.193: +..B4.14: + movq %rbp, %rdi +..___tag_value___libm_recasinl_k80.194: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.195: +..B4.15: + movzwl 8(%rbx), %r9d + movl %r9d, %eax + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %eax + andl $32767, %r11d +..B4.16: + movl 32(%rbp), %edx + movl 32(%rbx), %ecx + lea -134(%rdx,%r11), %esi + lea (%rax,%rcx), %r8d + cmpl %r8d, %esi + jge ..B4.33 +..B4.17: + lea 134(%rdx,%r11), %esi + cmpl %esi, %r8d + jge ..B4.33 +..B4.18: + cmpl $0, 4(%rbx) + jne ..B4.20 +..B4.19: + cmpl $0, (%rbx) + je ..B4.33 +..B4.20: + cmpl $0, 4(%rbp) + jne ..B4.22 +..B4.21: + cmpl $0, (%rbp) + je ..B4.33 +..B4.22: + cmpl %edx, %ecx + je ..B4.24 +..B4.23: + fldt 16(%rsp) + subl %edx, %ecx + fstpt (%rsp) + addl $16383, %ecx + fldt (%rbx) + andl $32767, %ecx + fldt 16(%rbx) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%rbx) + fxch %st(2) + fstpt (%rbx) + fldt (%rbx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbx) + fldt 16(%rbx) + fxch %st(1) + fstpt 16(%rsp) + movl 32(%rbp), %edx + movzwl 8(%rbp), %r10d + movzwl 8(%rbx), %r9d + jmp ..B4.25 +..B4.24: + fldt (%rbx) + fstpt 16(%rsp) + fldt 16(%rbx) +..B4.25: + fldt (%rbp) + andl $32767, %r9d + fldt 16(%rsp) + andl $32767, %r10d + movl %edx, 144(%rsp) + cmpl %r10d, %r9d + fadd %st(1), %st + jg ..B4.30 +..B4.26: + jne ..B4.31 +..B4.27: + movl 4(%rbx), %eax + cmpl 4(%rbp), %eax + ja ..B4.30 +..B4.28: + jne ..B4.31 +..B4.29: + movl (%rbx), %eax + cmpl (%rbp), %eax + jbe ..B4.31 +..B4.30: + fldt 16(%rsp) + fsub %st(1), %st + faddp %st, %st(2) + fldt 16(%rbp) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B4.32 +..B4.31: + fldt 16(%rsp) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 16(%rbp) + faddp %st, %st(1) + fstpt 16(%rsp) +..B4.32: + fldt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 128(%rsp) + jmp ..B4.65 +..B4.33: + cmpq $0, (%rbx) + je ..B4.35 +..B4.34: + lea -16517(%rdx,%r11), %edx + lea -16383(%rcx,%rax), %eax + cmpl %eax, %edx + jl ..B4.36 +..B4.35: + movq (%rbp), %rax + movq 8(%rbp), %rdx + movq 16(%rbp), %rcx + movq 24(%rbp), %rbx + movq 32(%rbp), %rsi + movq 40(%rbp), %rbp + movq %rax, 112(%rsp) + movq %rdx, 120(%rsp) + movq %rcx, 128(%rsp) + movq %rbx, 136(%rsp) + movq %rsi, 144(%rsp) + movq %rbp, 152(%rsp) + jmp ..B4.65 +..B4.36: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 112(%rsp) + movq %rdx, 120(%rsp) + movq %rcx, 128(%rsp) + movq %rbp, 136(%rsp) + movq %rsi, 144(%rsp) + movq %rbx, 152(%rsp) + jmp ..B4.65 +..B4.37: + lea ones(%rip), %rax + lea zeros(%rip), %rdx + movzwl 8(%rbx), %r9d + movl $0, 144(%rsp) + fldt (%rax) + movl %r9d, %eax + andl $32767, %eax + fstpt 112(%rsp) + cmpl $8383, %eax + fldt (%rdx) + fstpt 128(%rsp) + jl ..B4.41 +..B4.38: + cmpl $24383, %eax + jg ..B4.41 +..B4.39: + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %r11d + cmpl $8383, %r11d + jl ..B4.41 +..B4.40: + cmpl $24383, %r11d + jle ..B4.44 +..B4.41: + movq %rbx, %rdi +..___tag_value___libm_recasinl_k80.196: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.197: +..B4.42: + movq %rbp, %rdi +..___tag_value___libm_recasinl_k80.198: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.199: +..B4.43: + movzwl 8(%rbx), %r9d + movl %r9d, %eax + movzwl 8(%rbp), %r10d + movl %r10d, %r11d + andl $32767, %eax + andl $32767, %r11d +..B4.44: + movl 32(%rbp), %edx + movl 32(%rbx), %ecx + lea -134(%rdx,%r11), %esi + lea (%rax,%rcx), %r8d + cmpl %r8d, %esi + jge ..B4.61 +..B4.45: + lea 134(%rdx,%r11), %esi + cmpl %esi, %r8d + jge ..B4.61 +..B4.46: + cmpl $0, 4(%rbx) + jne ..B4.48 +..B4.47: + cmpl $0, (%rbx) + je ..B4.61 +..B4.48: + cmpl $0, 4(%rbp) + jne ..B4.50 +..B4.49: + cmpl $0, (%rbp) + je ..B4.61 +..B4.50: + cmpl %edx, %ecx + je ..B4.52 +..B4.51: + fldt 16(%rsp) + subl %edx, %ecx + fstpt (%rsp) + addl $16383, %ecx + fldt (%rbx) + andl $32767, %ecx + fldt 16(%rbx) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %edx, 32(%rbx) + fxch %st(2) + fstpt (%rbx) + fldt (%rbx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbx) + fldt 16(%rbx) + fstpt 16(%rsp) + movl 32(%rbp), %edx + movzwl 8(%rbp), %r10d + movzwl 8(%rbx), %r9d + jmp ..B4.53 +..B4.52: + fldt (%rbx) + fldt 16(%rbx) + fstpt 16(%rsp) +..B4.53: + fldt (%rbp) + andl $32767, %r9d + andl $32767, %r10d + fld %st(1) + movl %edx, 96(%rsp) + cmpl %r10d, %r9d + fsub %st(1), %st + jg ..B4.58 +..B4.54: + jne ..B4.59 +..B4.55: + movl 4(%rbx), %eax + cmpl 4(%rbp), %eax + ja ..B4.58 +..B4.56: + jne ..B4.59 +..B4.57: + movl (%rbx), %eax + cmpl (%rbp), %eax + jbe ..B4.59 +..B4.58: + fldt 16(%rsp) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt 16(%rbp) + fsubrp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + jmp ..B4.60 +..B4.59: + fldt 16(%rbp) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fsubrp %st, %st(3) + fldt 16(%rsp) + faddp %st, %st(3) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) +..B4.60: + fldt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 80(%rsp) + jmp ..B4.65 +..B4.61: + cmpq $0, (%rbx) + je ..B4.63 +..B4.62: + lea -16517(%rdx,%r11), %esi + lea -16383(%rcx,%rax), %eax + cmpl %eax, %esi + jl ..B4.64 +..B4.63: + fldt (%rbp) + fchs + movl %edx, 96(%rsp) + fstpt 64(%rsp) + fldt 16(%rbp) + fchs + fstpt 80(%rsp) + jmp ..B4.65 +..B4.64: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 64(%rsp) + movq %rdx, 72(%rsp) + movq %rcx, 80(%rsp) + movq %rbp, 88(%rsp) + movq %rsi, 96(%rsp) + movq %rbx, 104(%rsp) +..B4.65: + movzwl 8(%r12), %ebp + movl %ebp, %r9d + andl $32767, %r9d + movl 32(%r12), %edx + incl %edx + movl %edx, 32(%r12) + cmpl $8383, %r9d + jl ..B4.69 +..B4.66: + cmpl $24383, %r9d + jg ..B4.69 +..B4.67: + movzwl 8(%r13), %eax + movl %eax, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B4.69 +..B4.68: + cmpl $24383, %r8d + jle ..B4.72 +..B4.69: + movq %r12, %rdi +..___tag_value___libm_recasinl_k80.200: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.201: +..B4.70: + movq %r13, %rdi +..___tag_value___libm_recasinl_k80.202: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.203: +..B4.71: + movzwl 8(%r12), %ebp + movl %ebp, %r9d + movzwl 8(%r13), %eax + movl %eax, %r8d + movl 32(%r12), %edx + andl $32767, %r9d + andl $32767, %r8d +..B4.72: + movl 32(%r13), %esi + lea (%rdx,%r9), %ebx + lea -134(%rsi,%r8), %ecx + cmpl %ecx, %ebx + jle ..B4.89 +..B4.73: + lea 134(%rsi,%r8), %ecx + cmpl %ecx, %ebx + jge ..B4.89 +..B4.74: + cmpl $0, 4(%r12) + jne ..B4.76 +..B4.75: + cmpl $0, (%r12) + je ..B4.89 +..B4.76: + cmpl $0, 4(%r13) + jne ..B4.78 +..B4.77: + cmpl $0, (%r13) + je ..B4.89 +..B4.78: + cmpl %esi, %edx + je ..B4.80 +..B4.79: + fldt 16(%rsp) + subl %esi, %edx + fstpt (%rsp) + addl $16383, %edx + fldt (%r12) + andl $32767, %edx + fldt 16(%r12) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %edx, %eax + movl %esi, %edx + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %esi, 32(%r12) + fxch %st(2) + fstpt (%r12) + fldt (%r12) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%r12) + fldt 16(%r12) + movl 32(%r13), %esi + movzwl 8(%r13), %eax + movzwl 8(%r12), %ebp + jmp ..B4.81 +..B4.80: + fldt (%r12) + fldt 16(%r12) +..B4.81: + fldt (%r13) + movl %eax, %ecx + andl $32767, %ebp + andl $32767, %ecx + fld %st(2) + cmpl %ecx, %ebp + movl %esi, 192(%rsp) + fadd %st(1), %st + jg ..B4.86 +..B4.82: + jne ..B4.87 +..B4.83: + movl 4(%r12), %ecx + cmpl 4(%r13), %ecx + ja ..B4.86 +..B4.84: + jne ..B4.87 +..B4.85: + movl (%r12), %ecx + cmpl (%r13), %ecx + jbe ..B4.87 +..B4.86: + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt 16(%r13) + faddp %st, %st(1) + faddp %st, %st(1) + fxch %st(1) + jmp ..B4.88 +..B4.87: + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 16(%r13) + faddp %st, %st(2) +..B4.88: + fld %st(1) + fadd %st(1), %st + fstpt 160(%rsp) + fldt 160(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 176(%rsp) + jmp ..B4.93 +..B4.89: + cmpq $0, (%r12) + je ..B4.91 +..B4.90: + lea -16517(%rsi,%r8), %ecx + lea -16383(%rdx,%r9), %ebx + cmpl %ebx, %ecx + jl ..B4.92 +..B4.91: + movq (%r13), %rcx + movq 8(%r13), %rbx + movq 16(%r13), %rbp + movq 24(%r13), %rsi + movq 32(%r13), %r8 + movq 40(%r13), %r9 + movq %rcx, 160(%rsp) + movq %rbx, 168(%rsp) + movq %rbp, 176(%rsp) + movq %rsi, 184(%rsp) + movq %r8, 192(%rsp) + movq %r9, 200(%rsp) + jmp ..B4.93 +..B4.92: + movq (%r12), %rcx + movq 8(%r12), %rbx + movq 16(%r12), %rbp + movq 24(%r12), %rsi + movq 32(%r12), %r8 + movq 40(%r12), %r9 + movq %rcx, 160(%rsp) + movq %rbx, 168(%rsp) + movq %rbp, 176(%rsp) + movq %rsi, 184(%rsp) + movq %r8, 192(%rsp) + movq %r9, 200(%rsp) +..B4.93: + decl %edx + movl %edx, 32(%r12) + movzwl 168(%rsp), %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B4.97 +..B4.94: + cmpl $24383, %edx + jg ..B4.97 +..B4.95: + movzwl 72(%rsp), %edx + andl $32767, %edx + cmpl $8383, %edx + jl ..B4.97 +..B4.96: + cmpl $24383, %edx + jle ..B4.99 +..B4.97: + lea 160(%rsp), %rdi +..___tag_value___libm_recasinl_k80.204: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.205: +..B4.98: + lea 64(%rsp), %rdi +..___tag_value___libm_recasinl_k80.206: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.207: + movzwl 8(%r13), %eax +..B4.99: + fldt 160(%rsp) + andl $32767, %eax + fld %st(0) + fld %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(4), %st + movl 192(%rsp), %edx + fsubr %st, %st(3) + addl 96(%rsp), %edx + faddp %st, %st(3) + fld %st(2) + cmpl $8383, %eax + movl %edx, 240(%rsp) + fxch %st(2) + fsub %st(3), %st + fldt 64(%rsp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 80(%rsp) + fmulp %st, %st(4) + fldt 176(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 208(%rsp) + fldt 208(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 224(%rsp) + jl ..B4.103 +..B4.100: + cmpl $24383, %eax + jg ..B4.103 +..B4.101: + movzwl 120(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.103 +..B4.102: + cmpl $24383, %eax + jle ..B4.105 +..B4.103: + movq %r13, %rdi +..___tag_value___libm_recasinl_k80.208: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.209: +..B4.104: + lea 112(%rsp), %rdi +..___tag_value___libm_recasinl_k80.210: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.211: +..B4.105: + fldt (%r13) + fld %st(0) + fld %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(4), %st + movq 712(%rsp), %rbx + fsubr %st, %st(3) + movzwl 8(%rbx), %ecx + movl %ecx, %r10d + movl 144(%rsp), %eax + andl $32767, %r10d + addl 32(%r13), %eax + faddp %st, %st(3) + fld %st(2) + cmpl $8383, %r10d + movl %eax, 288(%rsp) + fxch %st(2) + fsub %st(3), %st + fldt 112(%rsp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 128(%rsp) + fmulp %st, %st(4) + fldt 16(%r13) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 256(%rsp) + fldt 256(%rsp) + fsubrp %st, %st(1) + fadd %st(1), %st + fstpt 272(%rsp) + fstpt 16(%rsp) + jl ..B4.109 +..B4.106: + cmpl $24383, %r10d + jg ..B4.109 +..B4.107: + movzwl 8(%r14), %ebp + movl %ebp, %r8d + andl $32767, %r8d + cmpl $8383, %r8d + jl ..B4.109 +..B4.108: + cmpl $24383, %r8d + jle ..B4.112 +..B4.109: + movq %rbx, %rdi +..___tag_value___libm_recasinl_k80.212: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.213: +..B4.110: + movq %r14, %rdi +..___tag_value___libm_recasinl_k80.214: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.215: +..B4.111: + movzwl 8(%rbx), %ecx + movl %ecx, %r10d + movzwl 8(%r14), %ebp + movl %ebp, %r8d + andl $32767, %r10d + andl $32767, %r8d +..B4.112: + movl 32(%r14), %esi + movl 32(%rbx), %r9d + lea -134(%rsi,%r8), %eax + lea (%r10,%r9), %edx + cmpl %eax, %edx + jle ..B4.129 +..B4.113: + lea 134(%rsi,%r8), %eax + cmpl %eax, %edx + jge ..B4.129 +..B4.114: + cmpl $0, 4(%rbx) + jne ..B4.116 +..B4.115: + cmpl $0, (%rbx) + je ..B4.129 +..B4.116: + cmpl $0, 4(%r14) + jne ..B4.118 +..B4.117: + cmpl $0, (%r14) + je ..B4.129 +..B4.118: + cmpl %esi, %r9d + je ..B4.120 +..B4.119: + fldt 16(%rsp) + subl %esi, %r9d + fstpt (%rsp) + addl $16383, %r9d + fldt (%rbx) + andl $32767, %r9d + fldt 16(%rbx) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %r9d, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + movl %esi, 32(%rbx) + fxch %st(2) + fstpt (%rbx) + fldt (%rbx) + fxch %st(2) + fmulp %st, %st(1) + fstpt 16(%rbx) + fldt 16(%rbx) + movl 32(%r14), %esi + movzwl 8(%r14), %ebp + movzwl 8(%rbx), %ecx + jmp ..B4.121 +..B4.120: + fldt (%rbx) + fldt 16(%rbx) +..B4.121: + fldt (%r14) + andl $32767, %ecx + andl $32767, %ebp + fld %st(2) + movl %esi, 336(%rsp) + cmpl %ebp, %ecx + fadd %st(1), %st + jg ..B4.126 +..B4.122: + jne ..B4.127 +..B4.123: + movl 4(%rbx), %eax + cmpl 4(%r14), %eax + ja ..B4.126 +..B4.124: + jne ..B4.127 +..B4.125: + movl (%rbx), %eax + cmpl (%r14), %eax + jbe ..B4.127 +..B4.126: + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fldt 16(%r14) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B4.128 +..B4.127: + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 16(%r14) + faddp %st, %st(1) +..B4.128: + fld %st(0) + fadd %st(2), %st + fstpt 304(%rsp) + fldt 304(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpt 320(%rsp) + jmp ..B4.133 +..B4.129: + cmpq $0, (%rbx) + je ..B4.131 +..B4.130: + lea -16517(%rsi,%r8), %eax + lea -16383(%r9,%r10), %edx + cmpl %edx, %eax + jl ..B4.132 +..B4.131: + movq (%r14), %rax + movq 8(%r14), %rdx + movq 16(%r14), %rcx + movq 24(%r14), %rbx + movq 32(%r14), %rbp + movq 40(%r14), %rsi + movq %rax, 304(%rsp) + movq %rdx, 312(%rsp) + movq %rcx, 320(%rsp) + movq %rbx, 328(%rsp) + movq %rbp, 336(%rsp) + movq %rsi, 344(%rsp) + jmp ..B4.133 +..B4.132: + movq (%rbx), %rax + movq 8(%rbx), %rdx + movq 16(%rbx), %rcx + movq 24(%rbx), %rbp + movq 32(%rbx), %rsi + movq 40(%rbx), %rbx + movq %rax, 304(%rsp) + movq %rdx, 312(%rsp) + movq %rcx, 320(%rsp) + movq %rbp, 328(%rsp) + movq %rsi, 336(%rsp) + movq %rbx, 344(%rsp) +..B4.133: + movzwl 264(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.137 +..B4.134: + cmpl $24383, %eax + jg ..B4.137 +..B4.135: + movzwl 312(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.137 +..B4.136: + cmpl $24383, %eax + jle ..B4.139 +..B4.137: + lea 256(%rsp), %rdi +..___tag_value___libm_recasinl_k80.216: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.217: +..B4.138: + lea 304(%rsp), %rdi +..___tag_value___libm_recasinl_k80.218: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.219: +..B4.139: + fldt 256(%rsp) + fld %st(0) + fld %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(4), %st + movl 288(%rsp), %edx + fsubr %st, %st(3) + movzwl 216(%rsp), %eax + faddp %st, %st(3) + fld %st(2) + andl $32767, %eax + addl 336(%rsp), %edx + fxch %st(2) + fsub %st(3), %st + fldt 304(%rsp) + cmpl $8383, %eax + fmul %st, %st(2) + fld %st(0) + movl %edx, 384(%rsp) + fsub %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st, %st(3) + fld %st(2) + fsub %st(1), %st + fmul %st, %st(5) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(5) + fld %st(4) + fadd %st(4), %st + fsub %st, %st(4) + fxch %st(4) + fchs + faddp %st, %st(5) + fmulp %st, %st(1) + faddp %st, %st(3) + fldt 320(%rsp) + fmulp %st, %st(4) + fldt 272(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 352(%rsp) + fldt 352(%rsp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 368(%rsp) + fldt 368(%rsp) + jl ..B4.143 +..B4.140: + cmpl $24383, %eax + jg ..B4.143 +..B4.141: + movzwl 360(%rsp), %eax + andl $32767, %eax + cmpl $8383, %eax + jl ..B4.143 +..B4.142: + cmpl $24383, %eax + jle ..B4.146 +..B4.143: + fstp %st(1) + fstp %st(0) + lea 208(%rsp), %rdi +..___tag_value___libm_recasinl_k80.220: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.221: +..B4.144: + lea 352(%rsp), %rdi +..___tag_value___libm_recasinl_k80.222: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.223: +..B4.145: + fldt 352(%rsp) + fldt 368(%rsp) + movl 384(%rsp), %edx +..B4.146: + fldt 208(%rsp) + fld %st(2) + fdivr %st(1), %st + fmul %st, %st(2) + fld %st(3) + fxch %st(4) + fstpt 32(%rsp) + fldt 32(%rsp) + fldt 48(%rsp) + fld %st(0) + fmul %st(3), %st + fld %st(0) + movl 240(%rsp), %ecx + fsubr %st(4), %st + subl %edx, %ecx + faddp %st, %st(1) + fld %st(0) + decl %ecx + movl %ecx, 432(%rsp) + fsubr %st(4), %st + fxch %st(2) + fmul %st(3), %st + fsubr %st, %st(7) + faddp %st, %st(7) + fxch %st(2) + fsub %st(6), %st + fld %st(2) + fmul %st(7), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(1) + fmul %st, %st(3) + fxch %st(7) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(1) + fxch %st(4) + fsubrp %st, %st(2) + fxch %st(3) + fsubrp %st, %st(1) + fldt 224(%rsp) + faddp %st, %st(1) + fsubp %st, %st(1) + fldt 32(%rsp) + fdivrp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 400(%rsp) + fldt 400(%rsp) + fsubr %st, %st(2) + movzwl 408(%rsp), %eax + fxch %st(1) + fadd %st, %st(2) + andl $32767, %eax + fxch %st(2) + fstpt 416(%rsp) + fldt 416(%rsp) + cmpl $383, %eax + fxch %st(2) + fstpt 16(%rsp) + fxch %st(1) + jl ..B4.148 +..B4.147: + cmpl $32383, %eax + jle ..B4.150 +..B4.148: + fstp %st(0) + fstp %st(0) + lea 400(%rsp), %rdi +..___tag_value___libm_recasinl_k80.224: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.225: +..B4.149: + fldt 400(%rsp) + fldt 416(%rsp) + movl 432(%rsp), %ecx +..B4.150: + testb $1, %cl + jne ..B4.188 +..B4.151: + lea halfs(%rip), %rax + fldt (%rax) +..B4.152: + fldt 48(%rsp) + fld %st(3) + fsqrt + lea 448(%rsp), %rdi + fmul %st, %st(1) + lea 496(%rsp), %rsi + fld %st(1) + sarl $1, %ecx + fsubr %st(1), %st + movl %ecx, 32(%rsi) + faddp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + fadd %st(0), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + fmul %st(0), %st + faddp %st, %st(1) + fxch %st(2) + fsubrp %st, %st(5) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + fdivr %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt (%rsi) + fldt (%rsi) + fsubrp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rsi) +..___tag_value___libm_recasinl_k80.226: + call asinpoly +..___tag_value___libm_recasinl_k80.227: +..B4.153: + lea 16+_PIO2_K80(%rip), %rax + lea 32+_PIO2_K80(%rip), %rdx + movl 480(%rsp), %edi + xorl %ebp, %ebp + incl %edi + movl %edi, 480(%rsp) + fldt (%rax) + movzwl 8(%rax), %esi + andl $32767, %esi + movl $0, 576(%rsp) + cmpl $8383, %esi + fstpt 544(%rsp) + fldt (%rdx) + fstpt 560(%rsp) + jl ..B4.157 +..B4.154: + cmpl $24383, %esi + jg ..B4.157 +..B4.155: + movzwl 456(%rsp), %ebx + andl $32767, %ebx + cmpl $8383, %ebx + jl ..B4.157 +..B4.156: + cmpl $24383, %ebx + jle ..B4.160 +..B4.157: + lea 544(%rsp), %rdi +..___tag_value___libm_recasinl_k80.228: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.229: +..B4.158: + lea 448(%rsp), %rdi +..___tag_value___libm_recasinl_k80.230: + call __libm_normalizel_k80@PLT +..___tag_value___libm_recasinl_k80.231: +..B4.159: + movzwl 552(%rsp), %esi + movzwl 456(%rsp), %ebx + andl $32767, %esi + movl 480(%rsp), %edi + andl $32767, %ebx + movl 576(%rsp), %ebp +..B4.160: + lea (%rbp,%rsi), %edx + lea -134(%rdi,%rbx), %eax + cmpl %eax, %edx + jle ..B4.177 +..B4.161: + movl 548(%rsp), %ecx + lea 134(%rdi,%rbx), %eax + cmpl %eax, %edx + jge ..B4.178 +..B4.162: + testl %ecx, %ecx + jne ..B4.164 +..B4.163: + cmpl $0, 544(%rsp) + je ..B4.179 +..B4.164: + movl 452(%rsp), %edx + testl %edx, %edx + jne ..B4.166 +..B4.165: + cmpl $0, 448(%rsp) + je ..B4.178 +..B4.166: + cmpl %edi, %ebp + je ..B4.168 +..B4.167: + fldt 16(%rsp) + subl %edi, %ebp + fstpt (%rsp) + addl $16383, %ebp + fldt 544(%rsp) + andl $32767, %ebp + fldt 560(%rsp) + andb $127, 9(%rsp) + movzwl 8(%rsp), %eax + andl $-32768, %eax + orl %ebp, %eax + movw %ax, 8(%rsp) + movl $-2147483648, 4(%rsp) + movl $0, (%rsp) + fldt (%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt 544(%rsp) + fldt 544(%rsp) + fxch %st(2) + fmulp %st, %st(1) + movzwl 552(%rsp), %esi + movl %edi, 576(%rsp) + andl $32767, %esi + fstpt 560(%rsp) + fldt 560(%rsp) + jmp ..B4.169 +..B4.168: + fldt 544(%rsp) + fldt 560(%rsp) +..B4.169: + fldt 448(%rsp) + fld %st(2) + movl %edi, 48(%rsp) + cmpl %ebx, %esi + fsub %st(1), %st + jg ..B4.174 +..B4.170: + jne ..B4.175 +..B4.171: + movl 548(%rsp), %eax + cmpl %edx, %eax + ja ..B4.174 +..B4.172: + jne ..B4.175 +..B4.173: + movl 544(%rsp), %eax + cmpl 448(%rsp), %eax + jbe ..B4.175 +..B4.174: + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fldt 464(%rsp) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + jmp ..B4.176 +..B4.175: + fadd %st, %st(1) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fldt 464(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) +..B4.176: + fld %st(0) + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + jmp ..B4.185 +..B4.177: + movl 548(%rsp), %ecx +..B4.178: + testl %ecx, %ecx + jne ..B4.180 +..B4.193: + cmpl $0, 544(%rsp) +..B4.179: + je ..B4.181 +..B4.180: + lea -16517(%rdi,%rbx), %eax + lea -16383(%rbp,%rsi), %edx + cmpl %edx, %eax + jl ..B4.182 +..B4.181: + fldt 448(%rsp) + fchs + movl %edi, 48(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt 464(%rsp) + fchs + fstpt 32(%rsp) + fldt 32(%rsp) + jmp ..B4.185 +..B4.182: + fldt 544(%rsp) + fldt 560(%rsp) + movaps 544(%rsp), %xmm0 + movaps 560(%rsp), %xmm1 + movaps 576(%rsp), %xmm2 + movl 576(%rsp), %edi + movaps %xmm0, 16(%rsp) + movaps %xmm1, 32(%rsp) + movaps %xmm2, 48(%rsp) + jmp ..B4.185 +..B4.183: + lea 16(%rsp), %rdi + lea 592(%rsp), %rsi +..___tag_value___libm_recasinl_k80.232: + call asinpoly +..___tag_value___libm_recasinl_k80.233: +..B4.184: + fldt 16(%rsp) + fldt 32(%rsp) + movl 48(%rsp), %edi +..B4.185: + addq $-32, %rsp + .cfi_def_cfa_offset 736 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_recasinl_k80.235: + call __libm_scalbl_k80@PLT +..___tag_value___libm_recasinl_k80.236: +..B4.192: + addq $32, %rsp + .cfi_def_cfa_offset 704 +..B4.186: + movb 9(%r15), %al + lea ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + shlq $4, %rcx + movq 640(%rsp), %rbx + xorq %rsp, %rbx + cmpq %fs:40, %rbx + fldt (%rdx,%rcx) + fmulp %st, %st(1) + jne ..B4.189 +..B4.187: + addq $648, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 704 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B4.188: + lea halfs(%rip), %rax + incl %ecx + movl %ecx, 432(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + fstpt 400(%rsp) + fldt 400(%rsp) + fxch %st(1) + fmul %st(2), %st + fstpt 416(%rsp) + fldt 416(%rsp) + fxch %st(1) + fxch %st(2) + jmp ..B4.152 +..B4.189: + fstp %st(0) + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __libm_recasinl_k80,@function + .size __libm_recasinl_k80,.-__libm_recasinl_k80 + .data +# -- End __libm_recasinl_k80 + .section .rodata, "a" + .align 16 + .align 16 +ones: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type ones,@object + .size ones,32 + .align 16 +zeros: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type zeros,@object + .size zeros,32 + .align 16 +t32: + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x1f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type t32,@object + .size t32,32 + .align 16 +halfs: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type halfs,@object + .size halfs,32 + .align 2 +_PIO2_K80: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 36027 + .word 64655 + .word 30161 + .word 60646 + .word 49085 + .word 0 + .word 0 + .word 0 + .type _PIO2_K80,@object + .size _PIO2_K80,48 + .align 2 +_ASIN_POLY: + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39322 + .word 39321 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28087 + .word 46811 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36409 + .word 63715 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 62186 + .word 9163 + .word 53620 + .word 46917 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 11943 + .word 18321 + .word 25215 + .word 36391 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 12527 + .word 63486 + .word 51909 + .word 58572 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 16437 + .word 53165 + .word 60799 + .word 48451 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 39560 + .word 816 + .word 43435 + .word 40940 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 47763 + .word 38463 + .word 31161 + .word 35220 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 61035 + .word 37666 + .word 58653 + .word 60832 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 4110 + .word 2419 + .word 35453 + .word 57515 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 3126 + .word 47859 + .word 6163 + .word 61068 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 56145 + .word 58008 + .word 18829 + .word 55579 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 17944 + .word 24712 + .word 25688 + .word 38195 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 27414 + .word 34244 + .word 64801 + .word 51841 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 63442 + .word 25896 + .word 35822 + .word 55851 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 37640 + .word 1996 + .word 32075 + .word 42748 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 39460 + .word 64770 + .word 43690 + .word 43690 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 48327 + .word 21484 + .word 52058 + .word 52428 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 52692 + .word 45548 + .word 47571 + .word 37453 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 9214 + .word 45875 + .word 56244 + .word 56360 + .word 49110 + .word 0 + .word 0 + .word 0 + .type _ASIN_POLY,@object + .size _ASIN_POLY,352 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_reduce_pi04d.S b/external/sgx_libm/intel64/libm_reduce_pi04d.S new file mode 100644 index 0000000000..a30dabaca8 --- /dev/null +++ b/external/sgx_libm/intel64/libm_reduce_pi04d.S @@ -0,0 +1,313 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_reduce_pi04d.c" + .text +..TXTST0: +# -- Begin __libm_reduce_pi04d + .text + .align 16,0x90 + .globl __libm_reduce_pi04d +__libm_reduce_pi04d: +# parameter 1: %xmm0 +# parameter 2: %rdi +# parameter 3: %esi +..B1.1: + .cfi_startproc +..___tag_value___libm_reduce_pi04d.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movl %esi, %r8d + movsd %xmm0, (%rsp) + xorb %sil, %sil +..B1.2: + fnstcw 10(%rsp) +..B1.3: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.5: + fldcw 8(%rsp) +..B1.6: + movb $1, %sil +..B1.7: + movzwl 6(%rsp), %r10d + movl %r10d, %ecx + andl $32752, %ecx + movl $1374389535, %eax + shrl $4, %ecx + andl $-32753, %r10d + lea -1052(%rcx), %r11d + imull %r11d + sarl $31, %r11d + lea -200(%rcx), %r9d + sarl $3, %edx + andl $2047, %r9d + subl %r11d, %edx + imull $-25, %edx, %eax + shll $4, %r9d + lea -1052(%rax,%rcx), %ecx + orl %r9d, %r10d + movw %r10w, 6(%rsp) + movsd (%rsp), %xmm2 + andl $-134217728, (%rsp) + movsd (%rsp), %xmm1 + cmpl $17, %ecx + subsd %xmm1, %xmm2 + jl ..B1.9 +..B1.8: + movslq %edx, %rdx + lea _DP(%rip), %r9 + movsd (%r9,%rdx,8), %xmm7 + movsd 8(%r9,%rdx,8), %xmm0 + incl %edx + mulsd %xmm2, %xmm7 + mulsd %xmm1, %xmm0 + addsd %xmm0, %xmm7 + movsd %xmm7, (%rsp) + andl $-1048576, (%rsp) + subsd (%rsp), %xmm7 + jmp ..B1.10 +..B1.9: + lea _DP(%rip), %r9 + pxor %xmm7, %xmm7 +..B1.10: + movslq %edx, %rdx + movaps %xmm1, %xmm3 + movaps %xmm1, %xmm5 + lea zero_none(%rip), %r11 + movaps %xmm1, %xmm9 + movaps %xmm1, %xmm11 + movaps %xmm1, %xmm13 + movsd (%r9,%rdx,8), %xmm4 + movsd 8(%r9,%rdx,8), %xmm0 + mulsd %xmm2, %xmm4 + mulsd %xmm0, %xmm3 + mulsd %xmm2, %xmm0 + addsd %xmm3, %xmm4 + movsd 16(%r9,%rdx,8), %xmm8 + addsd %xmm4, %xmm7 + mulsd %xmm8, %xmm5 + mulsd %xmm2, %xmm8 + addsd %xmm5, %xmm0 + movaps %xmm7, %xmm6 + movsd 24(%r9,%rdx,8), %xmm10 + addsd %xmm0, %xmm6 + movsd %xmm6, (%rsp) + movzwl 6(%rsp), %ecx + shrl $4, %ecx + movd %xmm6, %r10 + negl %ecx + movsd 32(%r9,%rdx,8), %xmm12 + movsd 40(%r9,%rdx,8), %xmm14 + addl $51, %ecx + sarq %cl, %r10 + movl %r10d, %eax + shlq %cl, %r10 + addl %r8d, %eax + movq %r10, (%rsp) + movl %eax, %r8d + andl $1, %r8d + subsd (%rsp), %xmm7 + mulsd %xmm12, %xmm9 + mulsd %xmm2, %xmm12 + mulsd %xmm14, %xmm11 + addsd (%r11,%r8,8), %xmm7 + mulsd %xmm2, %xmm14 + addsd %xmm7, %xmm0 + addsd %xmm11, %xmm12 + movaps %xmm1, %xmm7 + testb %sil, %sil + mulsd %xmm10, %xmm7 + mulsd %xmm2, %xmm10 + addsd %xmm7, %xmm8 + addsd %xmm9, %xmm10 + addsd %xmm8, %xmm0 + movsd 48(%r9,%rdx,8), %xmm15 + addsd %xmm10, %xmm0 + mulsd %xmm15, %xmm13 + mulsd %xmm15, %xmm2 + addsd %xmm12, %xmm0 + addsd %xmm13, %xmm14 + movsd 56(%r9,%rdx,8), %xmm3 + addsd %xmm14, %xmm0 + mulsd %xmm3, %xmm1 + addsd %xmm1, %xmm2 + addsd %xmm2, %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd %xmm0, (%rdi) + je ..B1.12 +..B1.11: + fldcw 10(%rsp) +..B1.12: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __libm_reduce_pi04d,@function + .size __libm_reduce_pi04d,.-__libm_reduce_pi04d + .data +# -- End __libm_reduce_pi04d + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.0: + .long 0x54442d18,0x3fe921fb + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +zero_none: + .long 0x00000000,0x00000000 + .long 0x00000000,0xbff00000 + .type zero_none,@object + .size zero_none,16 + .align 4 +_DP: + .long 0 + .long 0 + .long 1610612736 + .long 1282694960 + .long 0 + .long 1256952721 + .long 536870912 + .long 1229269500 + .long 3221225472 + .long 1202544455 + .long 0 + .long 1176818551 + .long 2147483648 + .long 1148939346 + .long 536870912 + .long 1124701124 + .long 3758096384 + .long 1099498527 + .long 3758096384 + .long 1071929578 + .long 1342177280 + .long 1046982385 + .long 805306368 + .long 1020320658 + .long 2147483648 + .long 993817732 + .long 0 + .long 968598976 + .long 2684354560 + .long 942220475 + .long 2415919104 + .long 915426956 + .long 0 + .long 885849629 + .long 536870912 + .long 863855510 + .long 1610612736 + .long 836031391 + .long 4026531840 + .long 810828058 + .long 1073741824 + .long 784674491 + .long 1610612736 + .long 757207974 + .long 3489660928 + .long 732020890 + .long 0 + .long 703061904 + .long 1610612736 + .long 679713053 + .long 2147483648 + .long 652001705 + .long 1073741824 + .long 626850382 + .long 2147483648 + .long 597786158 + .long 805306368 + .long 575535400 + .long 536870912 + .long 548814833 + .long 268435456 + .long 523239288 + .long 3758096384 + .long 495550718 + .long 2952790016 + .long 469954840 + .long 1073741824 + .long 442925723 + .long 1073741824 + .long 416247094 + .long 3758096384 + .long 392128403 + .long 2147483648 + .long 364254062 + .long 3221225472 + .long 339643518 + .long 2684354560 + .long 313162111 + .long 805306368 + .long 286354345 + .long 2952790016 + .long 260811902 + .long 1610612736 + .long 234667567 + .long 3758096384 + .long 207520668 + .long 1073741824 + .long 182175017 + .long 4026531840 + .long 155380331 + .long 805306368 + .long 129417058 + .long 536870912 + .long 103691636 + .long 0 + .long 73760972 + .long 3221225472 + .long 48348958 + .type _DP,@object + .size _DP,392 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_reduce_pi04l.S b/external/sgx_libm/intel64/libm_reduce_pi04l.S new file mode 100644 index 0000000000..b7c70a722c --- /dev/null +++ b/external/sgx_libm/intel64/libm_reduce_pi04l.S @@ -0,0 +1,4808 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_reduce_pi04l.c" + .text +..TXTST0: +# -- Begin __libm_reduce_pi04l + .text + .align 16,0x90 + .globl __libm_reduce_pi04l +__libm_reduce_pi04l: +# parameter 1: 8 + %rsp +# parameter 2: %edi +# parameter 3: %rsi +..B1.1: + .cfi_startproc +..___tag_value___libm_reduce_pi04l.1: +..L2: + + movzwl 16(%rsp), %r8d + andl $32767, %r8d + cmpl $16413, %r8d + jge ..B1.8 +..B1.2: + fldt 8(%rsp) + lea __4onpi_d(%rip), %rax + fldl (%rax) + fmul %st(1), %st + fstpt -24(%rsp) + movzwl -16(%rsp), %ecx + negl %ecx + addl $30, %ecx + movl -20(%rsp), %eax + shrl %cl, %eax + testl %edi, %edi + jne ..B1.4 +..B1.3: + lea 1(%rax), %ecx + andl $-2, %ecx + jmp ..B1.5 +..B1.4: + movl %eax, %ecx + addl %edi, %eax + movl %eax, %edx + andl $1, %edx + addl %edx, %ecx +..B1.5: + lea _TWO_32H(%rip), %rdx + cmpl $16400, %r8d + movl %ecx, -40(%rsp) + fildl -40(%rsp) + fldl (%rdx) + jge ..B1.7 +..B1.6: + lea _pi04_3d(%rip), %rdx + lea 8+_pi04_3d(%rip), %rcx + lea 16+_pi04_3d(%rip), %rdi + fldl (%rdx) + fmul %st(2), %st + fsubrp %st, %st(3) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl (%rcx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl (%rdi) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.15 +..B1.7: + lea _pi04_5d(%rip), %rdx + lea 8+_pi04_5d(%rip), %rcx + lea 16+_pi04_5d(%rip), %rdi + lea 24+_pi04_5d(%rip), %r8 + lea 32+_pi04_5d(%rip), %r9 + fldl (%rdx) + fmul %st(2), %st + fsubrp %st, %st(3) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl (%rcx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fldl (%rdi) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl (%r8) + fmul %st(2), %st + fld %st(0) + fsubr %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fldl (%r9) + fmulp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + jmp ..B1.15 +..B1.8: + fldt 8(%rsp) + lea -16417(%r8), %r9d + movl $-2078209981, %eax + lea _SCALE(%rip), %rcx + imull %r9d + fmull (%rcx) + sarl $31, %r9d + lea -16417(%rdx,%r8), %edx + sarl $4, %edx + subl %r9d, %edx + movl %edx, %r10d + shll $5, %r10d + negl %r10d + addl %edx, %r10d + fstpt 8(%rsp) + fldt 8(%rsp) + movl $0, 8(%rsp) + fldt 8(%rsp) + lea -16417(%r10,%r8), %r8d + cmpl $17, %r8d + fsubr %st, %st(1) + jl ..B1.10 +..B1.9: + movslq %edx, %rax + incl %edx + shlq $4, %rax + lea __4onpi_31l(%rip), %r8 + fldt (%rax,%r8) + fmul %st(2), %st + fldt 16(%r8,%rax) + fmul %st(2), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt -24(%rsp) + andl $-16777216, -24(%rsp) + fldt -24(%rsp) + fsubrp %st, %st(1) + jmp ..B1.11 +..B1.10: + lea _zeros(%rip), %rax + lea __4onpi_31l(%rip), %r8 + fldl (%rax) + fld %st(0) +..B1.11: + movslq %edx, %rdx + fld %st(0) + shlq $4, %rdx + fld %st(3) + fldt (%rdx,%r8) + fmul %st(6), %st + fadd %st, %st(2) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fldt 16(%rdx,%r8) + fmul %st, %st(2) + fld %st(2) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fadd %st(3), %st + fxch %st(2) + fmul %st(5), %st + fadd %st, %st(2) + fld %st(4) + fldt 32(%rdx,%r8) + fmul %st, %st(1) + fxch %st(1) + fadd %st, %st(4) + fxch %st(4) + fstpt -24(%rsp) + movzwl -16(%rsp), %r9d + andl $32767, %r9d + cmpl $16415, %r9d + jge ..B1.13 +..B1.12: + negl %r9d + addl $30, %r9d + movl %r9d, %ecx + movl -20(%rsp), %eax + shrl %cl, %eax + movl %r9d, %ecx + shll %cl, %eax + movl %r9d, %ecx + movl %eax, -20(%rsp) + movl $0, -24(%rsp) + shrl %cl, %eax + jmp ..B1.14 +..B1.13: + negl %r9d + addl $30, %r9d + movl %r9d, %ecx + movl -24(%rsp), %r10d + shrl %cl, %r10d + movl %r9d, %ecx + shll %cl, %r10d + movl %r9d, %ecx + negl %ecx + movl -20(%rsp), %eax + shll %cl, %eax + movl %r9d, %ecx + movl %r10d, -24(%rsp) + shrl %cl, %r10d + orl %r10d, %eax +..B1.14: + fldt -24(%rsp) + addl %edi, %eax + lea zero_none(%rip), %rdi + fsubrp %st, %st(3) + fmul %st(6), %st + fld %st(4) + movl %eax, %ecx + andl $1, %ecx + fadd %st(3), %st + lea 8+_pi04_2d(%rip), %r9 + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fldl (%rdi,%rcx,8) + faddp %st, %st(3) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(4) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(3) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fldt 48(%rdx,%r8) + fmul %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fxch %st(1) + fmul %st(4), %st + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(2) + fld %st(3) + fldt 64(%rdx,%r8) + fmul %st, %st(2) + fld %st(2) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fld %st(4) + fxch %st(3) + fmul %st(6), %st + fldt 80(%rdx,%r8) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(4) + fxch %st(2) + fmul %st(5), %st + fldt 96(%rdx,%r8) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(4) + fldt 112(%r8,%rdx) + lea _TWO_32H(%rip), %rdx + lea _pi04_2d(%rip), %r8 + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(2) + fadd %st(2), %st + fldl (%rdx) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldl (%r8) + fld %st(0) + fmul %st(2), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + fmull (%r9) + faddp %st, %st(1) +..B1.15: + fld %st(1) + lea _TWO_12H(%rip), %rdx + fadd %st(1), %st + fstpt -24(%rsp) + fldt -24(%rsp) + fldl (%rdx) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstl (%rsi) + fsubrp %st, %st(2) + faddp %st, %st(1) + fstpl 8(%rsi) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_reduce_pi04l,@function + .size __libm_reduce_pi04l,.-__libm_reduce_pi04l + .data +# -- End __libm_reduce_pi04l + .section .rodata, "a" + .align 8 + .align 8 +zero_none: + .long 0x00000000,0x00000000 + .long 0x00000000,0xbff00000 + .type zero_none,@object + .size zero_none,16 + .align 4 +__4onpi_d: + .long 1841940611 + .long 1072979760 + .type __4onpi_d,@object + .size __4onpi_d,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_pi04_3d: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _pi04_3d,@object + .size _pi04_3d,24 + .align 4 +_pi04_5d: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _pi04_5d,@object + .size _pi04_5d,40 + .align 4 +_SCALE: + .long 0 + .long 845152256 + .type _SCALE,@object + .size _SCALE,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_pi04_2d: + .long 1413480448 + .long 1072243195 + .long 442655537 + .long 1036039265 + .type _pi04_2d,@object + .size _pi04_2d,16 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 2 +__4onpi_31l: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33646 + .word 41721 + .word 16600 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10832 + .word 40072 + .word 16567 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44008 + .word 65043 + .word 16537 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28384 + .word 64154 + .word 16505 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38272 + .word 56162 + .word 16472 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7298 + .word 51682 + .word 16445 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45504 + .word 65320 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61204 + .word 44922 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18652 + .word 50030 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14144 + .word 59657 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37450 + .word 47105 + .word 16290 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14898 + .word 56641 + .word 16259 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34680 + .word 34623 + .word 16226 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4760 + .word 45515 + .word 16196 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41480 + .word 40187 + .word 16166 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47852 + .word 55252 + .word 16134 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54072 + .word 35081 + .word 16103 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26808 + .word 57421 + .word 16071 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20068 + .word 57232 + .word 16042 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49576 + .word 60188 + .word 16009 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10016 + .word 52861 + .word 15978 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30648 + .word 35825 + .word 15947 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60542 + .word 58528 + .word 15918 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65468 + .word 61743 + .word 15887 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64960 + .word 45825 + .word 15851 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50604 + .word 38792 + .word 15825 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18394 + .word 33435 + .word 15794 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55780 + .word 42703 + .word 15763 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 63841 + .word 15731 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63080 + .word 62563 + .word 15700 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20840 + .word 62207 + .word 15669 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30094 + .word 59983 + .word 15639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61818 + .word 60389 + .word 15608 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40186 + .word 40579 + .word 15577 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42170 + .word 58004 + .word 15546 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55276 + .word 39678 + .word 15514 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44672 + .word 36806 + .word 15481 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13060 + .word 34144 + .word 15452 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28016 + .word 57231 + .word 15419 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16112 + .word 44995 + .word 15390 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53464 + .word 33387 + .word 15358 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7296 + .word 60751 + .word 15325 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29452 + .word 45231 + .word 15297 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26208 + .word 49689 + .word 15266 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37900 + .word 44002 + .word 15235 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57340 + .word 33800 + .word 15204 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27544 + .word 50178 + .word 15173 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6168 + .word 40132 + .word 15142 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21392 + .word 43702 + .word 15109 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45168 + .word 54372 + .word 15081 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8986 + .word 40688 + .word 15050 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1648 + .word 53745 + .word 15018 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30520 + .word 55795 + .word 14986 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43060 + .word 32914 + .word 14956 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46172 + .word 52771 + .word 14925 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 45285 + .word 14893 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53590 + .word 44868 + .word 14864 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40786 + .word 35970 + .word 14833 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33436 + .word 65411 + .word 14801 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32006 + .word 61382 + .word 14771 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37856 + .word 45239 + .word 14738 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60894 + .word 49555 + .word 14709 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48064 + .word 53065 + .word 14674 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48624 + .word 54844 + .word 14647 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7988 + .word 40762 + .word 14616 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16270 + .word 58745 + .word 14585 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37064 + .word 50168 + .word 14553 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18624 + .word 63736 + .word 14519 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60758 + .word 44966 + .word 14492 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33304 + .word 47465 + .word 14461 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6226 + .word 60503 + .word 14430 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26380 + .word 54900 + .word 14398 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44352 + .word 49860 + .word 14368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11904 + .word 42646 + .word 14337 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 50279 + .word 14300 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15474 + .word 50606 + .word 14275 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45062 + .word 44137 + .word 14244 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 36063 + .word 14210 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40658 + .word 53854 + .word 14182 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28652 + .word 43690 + .word 14151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24640 + .word 64348 + .word 14118 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30284 + .word 41980 + .word 14088 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45652 + .word 38222 + .word 14057 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15900 + .word 62940 + .word 14026 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31494 + .word 50741 + .word 13996 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43194 + .word 55096 + .word 13965 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1740 + .word 45646 + .word 13933 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28936 + .word 44150 + .word 13903 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8996 + .word 42955 + .word 13872 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44096 + .word 61205 + .word 13839 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44614 + .word 54550 + .word 13810 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24926 + .word 57347 + .word 13779 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3312 + .word 61415 + .word 13745 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64336 + .word 63884 + .word 13717 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2748 + .word 62259 + .word 13685 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56672 + .word 51775 + .word 13653 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32438 + .word 55423 + .word 13624 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17652 + .word 45713 + .word 13593 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65408 + .word 51586 + .word 13558 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40416 + .word 55736 + .word 13531 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52546 + .word 37734 + .word 13500 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48880 + .word 64238 + .word 13469 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56004 + .word 46833 + .word 13437 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61760 + .word 38110 + .word 13405 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41496 + .word 35659 + .word 13374 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25472 + .word 41269 + .word 13342 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45444 + .word 36018 + .word 13314 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6510 + .word 56417 + .word 13283 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3072 + .word 56837 + .word 13252 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61338 + .word 48440 + .word 13221 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49568 + .word 57088 + .word 13189 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4240 + .word 39283 + .word 13157 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18562 + .word 33537 + .word 13128 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31422 + .word 44487 + .word 13097 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31930 + .word 60459 + .word 13066 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42272 + .word 36641 + .word 13033 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28940 + .word 36150 + .word 13004 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21010 + .word 50925 + .word 12973 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29448 + .word 64886 + .word 12941 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20500 + .word 54600 + .word 12911 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54258 + .word 46233 + .word 12880 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32628 + .word 42502 + .word 12848 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61608 + .word 55072 + .word 12818 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6236 + .word 57871 + .word 12786 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42408 + .word 34616 + .word 12756 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56692 + .word 51963 + .word 12724 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39094 + .word 48526 + .word 12694 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59870 + .word 38783 + .word 12663 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26560 + .word 33165 + .word 12632 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58666 + .word 37666 + .word 12601 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58728 + .word 39788 + .word 12569 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9048 + .word 43530 + .word 12538 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58496 + .word 57659 + .word 12505 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12324 + .word 37025 + .word 12477 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38432 + .word 55856 + .word 12445 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35210 + .word 45960 + .word 12415 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45644 + .word 51345 + .word 12384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32854 + .word 63883 + .word 12353 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29348 + .word 41450 + .word 12321 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27384 + .word 38024 + .word 12289 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57356 + .word 57291 + .word 12260 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61164 + .word 51521 + .word 12228 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 59151 + .word 12196 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36704 + .word 39943 + .word 12165 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45864 + .word 50151 + .word 12136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37892 + .word 63687 + .word 12104 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14560 + .word 51615 + .word 12073 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38776 + .word 55684 + .word 12041 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59136 + .word 53570 + .word 12010 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55556 + .word 37955 + .word 11981 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54458 + .word 44670 + .word 11950 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36446 + .word 34084 + .word 11919 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46416 + .word 51693 + .word 11886 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21432 + .word 34376 + .word 11857 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56036 + .word 34809 + .word 11826 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10562 + .word 55654 + .word 11795 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20264 + .word 53052 + .word 11763 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64064 + .word 50415 + .word 11729 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17444 + .word 48295 + .word 11701 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11874 + .word 52677 + .word 11671 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60808 + .word 39275 + .word 11640 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31792 + .word 55677 + .word 11606 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60710 + .word 49006 + .word 11578 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10520 + .word 37403 + .word 11546 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20004 + .word 59470 + .word 11515 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28096 + .word 37612 + .word 11485 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20268 + .word 44280 + .word 11453 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50740 + .word 61588 + .word 11422 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 58835 + .word 11390 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8576 + .word 42496 + .word 11355 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33920 + .word 54912 + .word 11324 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35620 + .word 54843 + .word 11298 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 736 + .word 43591 + .word 11264 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39632 + .word 61060 + .word 11235 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63452 + .word 63129 + .word 11206 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56798 + .word 58512 + .word 11175 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 46333 + .word 11141 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37300 + .word 36598 + .word 11112 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41952 + .word 41639 + .word 11079 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52452 + .word 33459 + .word 11050 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58558 + .word 33287 + .word 11020 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7570 + .word 43843 + .word 10989 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59416 + .word 63990 + .word 10957 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65298 + .word 47744 + .word 10927 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21076 + .word 34089 + .word 10896 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7048 + .word 57394 + .word 10865 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12872 + .word 55405 + .word 10832 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12608 + .word 51669 + .word 10798 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5350 + .word 48455 + .word 10772 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23568 + .word 58692 + .word 10740 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40784 + .word 37046 + .word 10708 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38992 + .word 43861 + .word 10678 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10064 + .word 40199 + .word 10648 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26368 + .word 35771 + .word 10611 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23994 + .word 60721 + .word 10586 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25052 + .word 34302 + .word 10554 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39842 + .word 54964 + .word 10524 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11568 + .word 58277 + .word 10491 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26160 + .word 46438 + .word 10461 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23252 + .word 43049 + .word 10431 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35288 + .word 58000 + .word 10400 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14614 + .word 50216 + .word 10369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1168 + .word 48804 + .word 10336 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60934 + .word 33006 + .word 10307 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 62247 + .word 10272 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59968 + .word 43121 + .word 10240 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25560 + .word 39974 + .word 10212 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1978 + .word 49353 + .word 10183 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16290 + .word 38807 + .word 10152 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8646 + .word 65226 + .word 10121 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56896 + .word 34317 + .word 10088 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40136 + .word 39118 + .word 10057 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14200 + .word 41756 + .word 10026 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59256 + .word 63202 + .word 9995 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 22968 + .word 63553 + .word 9965 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 736 + .word 44292 + .word 9933 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23186 + .word 37760 + .word 9904 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51008 + .word 34950 + .word 9869 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1664 + .word 64248 + .word 9836 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 35199 + .word 9811 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34656 + .word 63747 + .word 9780 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44330 + .word 49864 + .word 9749 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11654 + .word 35567 + .word 9718 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7924 + .word 58919 + .word 9686 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2532 + .word 32800 + .word 9655 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30024 + .word 53799 + .word 9624 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30172 + .word 64347 + .word 9593 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60036 + .word 51382 + .word 9562 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58576 + .word 33093 + .word 9531 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13888 + .word 38760 + .word 9500 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9322 + .word 52460 + .word 9470 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20944 + .word 41077 + .word 9437 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17976 + .word 41861 + .word 9407 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55176 + .word 55158 + .word 9377 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4976 + .word 35223 + .word 9346 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7816 + .word 39783 + .word 9314 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27656 + .word 55669 + .word 9284 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64944 + .word 53184 + .word 9250 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12544 + .word 49190 + .word 9222 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50612 + .word 44644 + .word 9190 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8832 + .word 63111 + .word 9155 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11744 + .word 36870 + .word 9129 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9404 + .word 63025 + .word 9098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47316 + .word 43381 + .word 9067 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55716 + .word 47433 + .word 9035 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46414 + .word 48441 + .word 9005 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19116 + .word 39506 + .word 8974 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48060 + .word 53381 + .word 8943 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57112 + .word 50739 + .word 8911 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5840 + .word 60581 + .word 8879 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62112 + .word 57199 + .word 8846 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35908 + .word 59499 + .word 8818 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13760 + .word 48116 + .word 8787 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3136 + .word 56059 + .word 8752 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37596 + .word 39221 + .word 8726 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3232 + .word 48550 + .word 8691 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 22872 + .word 42749 + .word 8662 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41948 + .word 40319 + .word 8633 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31196 + .word 64693 + .word 8601 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62052 + .word 52923 + .word 8571 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2750 + .word 33544 + .word 8540 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12462 + .word 46179 + .word 8509 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25128 + .word 45120 + .word 8476 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51634 + .word 62523 + .word 8447 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15758 + .word 42163 + .word 8416 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34022 + .word 36267 + .word 8385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41252 + .word 39796 + .word 8353 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49782 + .word 54423 + .word 8323 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25428 + .word 42086 + .word 8291 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34388 + .word 44810 + .word 8260 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7456 + .word 64092 + .word 8228 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48336 + .word 62448 + .word 8196 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60912 + .word 61622 + .word 8167 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17852 + .word 37250 + .word 8137 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57940 + .word 56453 + .word 8106 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47256 + .word 59825 + .word 8074 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3774 + .word 59120 + .word 8044 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43448 + .word 62852 + .word 8012 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4840 + .word 57195 + .word 7982 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40862 + .word 52565 + .word 7951 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1440 + .word 60474 + .word 7919 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55520 + .word 38648 + .word 7889 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15316 + .word 52422 + .word 7857 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18704 + .word 47227 + .word 7827 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48892 + .word 54283 + .word 7795 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12670 + .word 41990 + .word 7765 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27570 + .word 49842 + .word 7734 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47230 + .word 47992 + .word 7703 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41020 + .word 56253 + .word 7671 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23404 + .word 58312 + .word 7641 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35176 + .word 51854 + .word 7610 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49188 + .word 59051 + .word 7578 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16656 + .word 54507 + .word 7546 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41320 + .word 48565 + .word 7517 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 302 + .word 42490 + .word 7486 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26680 + .word 39967 + .word 7454 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41304 + .word 43638 + .word 7424 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2314 + .word 48533 + .word 7393 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63294 + .word 35693 + .word 7362 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24538 + .word 48319 + .word 7331 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56296 + .word 47263 + .word 7300 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 38599 + .word 7268 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6594 + .word 62116 + .word 7238 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47104 + .word 63573 + .word 7198 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34812 + .word 34303 + .word 7176 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5144 + .word 33695 + .word 7145 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24966 + .word 55768 + .word 7114 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62720 + .word 43946 + .word 7078 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31542 + .word 56062 + .word 7052 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62356 + .word 59096 + .word 7020 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28412 + .word 40533 + .word 6990 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24080 + .word 50467 + .word 6958 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33296 + .word 46841 + .word 6925 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39600 + .word 38627 + .word 6897 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14436 + .word 37607 + .word 6865 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39032 + .word 56421 + .word 6833 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64032 + .word 54987 + .word 6804 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27648 + .word 42212 + .word 6768 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43840 + .word 46107 + .word 6739 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17316 + .word 36574 + .word 6711 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8928 + .word 37652 + .word 6677 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24944 + .word 47433 + .word 6648 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 57430 + .word 6616 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39848 + .word 43340 + .word 6585 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64160 + .word 43542 + .word 6555 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35226 + .word 63015 + .word 6525 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40736 + .word 64368 + .word 6493 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42168 + .word 49526 + .word 6462 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45596 + .word 34243 + .word 6432 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20690 + .word 39705 + .word 6401 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54448 + .word 46856 + .word 6368 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64392 + .word 62736 + .word 6337 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12780 + .word 56461 + .word 6307 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15360 + .word 49145 + .word 6277 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20512 + .word 49931 + .word 6242 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54512 + .word 55820 + .word 6212 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8402 + .word 39333 + .word 6184 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34094 + .word 53593 + .word 6153 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31960 + .word 38817 + .word 6121 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16954 + .word 39291 + .word 6091 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49600 + .word 48765 + .word 6056 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59580 + .word 56541 + .word 6029 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35624 + .word 44550 + .word 5998 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4142 + .word 47316 + .word 5967 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43520 + .word 43612 + .word 5935 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20976 + .word 40896 + .word 5902 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63576 + .word 57729 + .word 5874 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37288 + .word 33122 + .word 5843 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24384 + .word 52079 + .word 5809 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47952 + .word 58719 + .word 5779 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44242 + .word 55445 + .word 5750 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61232 + .word 38847 + .word 5716 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 46039 + .word 5683 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13396 + .word 42933 + .word 5657 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 43305 + .word 5622 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40708 + .word 35319 + .word 5595 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44408 + .word 55685 + .word 5564 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42090 + .word 44607 + .word 5533 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25504 + .word 53466 + .word 5500 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24208 + .word 33149 + .word 5470 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5268 + .word 45375 + .word 5440 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 144 + .word 40000 + .word 5409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56688 + .word 52358 + .word 5376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25848 + .word 56175 + .word 5345 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57900 + .word 44055 + .word 5315 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24800 + .word 43437 + .word 5283 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17984 + .word 54872 + .word 5249 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25744 + .word 41345 + .word 5223 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7668 + .word 43682 + .word 5191 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47434 + .word 36705 + .word 5161 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20888 + .word 40323 + .word 5129 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3962 + .word 43032 + .word 5099 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50270 + .word 49260 + .word 5068 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20160 + .word 64041 + .word 5032 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25624 + .word 36013 + .word 5004 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48328 + .word 59345 + .word 4975 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51508 + .word 63920 + .word 4943 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27872 + .word 39135 + .word 4913 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13590 + .word 58857 + .word 4882 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50880 + .word 61323 + .word 4847 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44802 + .word 37181 + .word 4820 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53808 + .word 57813 + .word 4789 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64424 + .word 49714 + .word 4757 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31652 + .word 44011 + .word 4727 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28252 + .word 50834 + .word 4696 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30370 + .word 38742 + .word 4665 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57728 + .word 58403 + .word 4628 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35900 + .word 37112 + .word 4603 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40764 + .word 40914 + .word 4572 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 46910 + .word 4541 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17854 + .word 35030 + .word 4510 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4378 + .word 35776 + .word 4479 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57962 + .word 55295 + .word 4448 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 56717 + .word 4415 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37744 + .word 49416 + .word 4384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38484 + .word 35759 + .word 4355 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55020 + .word 54969 + .word 4324 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9188 + .word 55223 + .word 4292 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6822 + .word 43079 + .word 4262 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48870 + .word 40943 + .word 4231 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9936 + .word 42731 + .word 4198 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23430 + .word 43136 + .word 4169 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4700 + .word 55665 + .word 4137 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8056 + .word 40216 + .word 4106 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3716 + .word 45403 + .word 4075 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53440 + .word 49488 + .word 4044 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41776 + .word 50188 + .word 4013 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20994 + .word 64556 + .word 3983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16252 + .word 60661 + .word 3951 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61252 + .word 65021 + .word 3920 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16236 + .word 43803 + .word 3889 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63064 + .word 35308 + .word 3857 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49096 + .word 39848 + .word 3828 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15680 + .word 48673 + .word 3797 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48068 + .word 50957 + .word 3766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20824 + .word 56086 + .word 3734 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46504 + .word 43224 + .word 3704 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52428 + .word 46094 + .word 3672 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17548 + .word 52066 + .word 3642 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61738 + .word 35565 + .word 3611 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31184 + .word 50588 + .word 3579 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1716 + .word 52681 + .word 3549 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44656 + .word 43385 + .word 3518 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12668 + .word 43259 + .word 3486 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24544 + .word 35408 + .word 3453 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28854 + .word 65018 + .word 3425 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5696 + .word 40391 + .word 3393 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39580 + .word 56400 + .word 3363 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20428 + .word 39579 + .word 3332 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32328 + .word 36727 + .word 3301 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34020 + .word 54457 + .word 3270 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34016 + .word 48400 + .word 3238 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6922 + .word 51417 + .word 3208 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27208 + .word 64641 + .word 3176 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1802 + .word 48886 + .word 3146 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35440 + .word 61590 + .word 3115 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60610 + .word 51604 + .word 3084 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5440 + .word 38199 + .word 3050 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6914 + .word 43867 + .word 3022 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24000 + .word 45256 + .word 2989 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51496 + .word 57396 + .word 2959 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11538 + .word 46256 + .word 2929 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36802 + .word 48020 + .word 2898 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57910 + .word 57903 + .word 2867 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47484 + .word 48798 + .word 2835 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57766 + .word 57709 + .word 2805 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54064 + .word 47856 + .word 2774 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49340 + .word 48080 + .word 2743 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36454 + .word 56731 + .word 2712 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51548 + .word 63385 + .word 2681 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56000 + .word 48716 + .word 2645 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44992 + .word 50040 + .word 2615 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43136 + .word 58177 + .word 2585 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49730 + .word 33270 + .word 2557 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29808 + .word 51063 + .word 2526 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25276 + .word 46724 + .word 2494 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17324 + .word 35928 + .word 2463 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52284 + .word 63916 + .word 2433 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5414 + .word 46704 + .word 2402 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51710 + .word 57168 + .word 2371 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27366 + .word 49253 + .word 2340 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45332 + .word 53033 + .word 2309 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54152 + .word 37418 + .word 2276 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53076 + .word 47398 + .word 2247 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14374 + .word 59477 + .word 2216 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59336 + .word 33435 + .word 2184 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21612 + .word 43267 + .word 2154 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34664 + .word 39372 + .word 2121 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 172 + .word 62761 + .word 2091 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9816 + .word 40715 + .word 2060 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65116 + .word 40481 + .word 2030 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28066 + .word 39184 + .word 1999 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37408 + .word 63923 + .word 1968 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15760 + .word 42305 + .word 1937 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 59340 + .word 1905 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43258 + .word 59402 + .word 1875 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19988 + .word 50087 + .word 1844 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63456 + .word 47833 + .word 1810 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65184 + .word 61426 + .word 1781 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52982 + .word 48456 + .word 1751 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30020 + .word 62809 + .word 1719 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9096 + .word 63061 + .word 1688 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59648 + .word 44374 + .word 1654 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11456 + .word 33847 + .word 1625 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12392 + .word 50500 + .word 1595 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 59196 + .word 1563 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61008 + .word 40265 + .word 1532 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37842 + .word 33270 + .word 1503 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37916 + .word 44543 + .word 1471 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11490 + .word 36421 + .word 1441 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19040 + .word 38397 + .word 1409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31224 + .word 47162 + .word 1379 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52056 + .word 41461 + .word 1347 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10810 + .word 56374 + .word 1317 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5358 + .word 35086 + .word 1286 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36640 + .word 50226 + .word 1251 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33856 + .word 45597 + .word 1222 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21552 + .word 63128 + .word 1191 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1198 + .word 35616 + .word 1162 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1232 + .word 59506 + .word 1131 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51086 + .word 34963 + .word 1100 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3960 + .word 39061 + .word 1067 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4564 + .word 57134 + .word 1037 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59468 + .word 35285 + .word 1007 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63422 + .word 35431 + .word 976 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38352 + .word 51462 + .word 945 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25806 + .word 55660 + .word 914 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38842 + .word 41327 + .word 883 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17980 + .word 50458 + .word 852 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61194 + .word 59710 + .word 821 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21098 + .word 42086 + .word 790 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16704 + .word 43341 + .word 757 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46316 + .word 52840 + .word 728 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20386 + .word 33936 + .word 697 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20064 + .word 51864 + .word 664 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2268 + .word 57500 + .word 634 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11152 + .word 51171 + .word 604 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23164 + .word 63727 + .word 572 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20514 + .word 40280 + .word 542 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21818 + .word 57922 + .word 511 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32366 + .word 46413 + .word 480 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53972 + .word 43148 + .word 449 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30134 + .word 65133 + .word 418 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15282 + .word 61516 + .word 387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49872 + .word 49222 + .word 355 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9484 + .word 63958 + .word 325 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47028 + .word 35341 + .word 294 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6770 + .word 58613 + .word 263 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33372 + .word 43448 + .word 232 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27792 + .word 51629 + .word 198 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19712 + .word 53691 + .word 170 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42144 + .word 60929 + .word 135 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35240 + .word 48799 + .word 107 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 910 + .word 51212 + .word 77 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65062 + .word 33668 + .word 46 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52624 + .word 51799 + .word 14 + .word 0 + .word 0 + .word 0 + .type __4onpi_31l,@object + .size __4onpi_31l,8592 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_reduce_pio2.S b/external/sgx_libm/intel64/libm_reduce_pio2.S new file mode 100644 index 0000000000..644bf3a434 --- /dev/null +++ b/external/sgx_libm/intel64/libm_reduce_pio2.S @@ -0,0 +1,543 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_reduce_pio2.c" + .text +..TXTST0: +# -- Begin __libm_reduce_pio2d + .text + .align 16,0x90 + .globl __libm_reduce_pio2d +__libm_reduce_pio2d: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_reduce_pio2d.1: +..L2: + + movq %rdi, %r9 + movsd %xmm0, -8(%rsp) + movzbl -1(%rsp), %eax + movl %eax, %r8d + andl $127, %eax + andl $128, %r8d + movb %al, -1(%rsp) + movzwl -2(%rsp), %eax + movl %eax, %edx + andl $32752, %edx + shrl $4, %edx + shrl $7, %r8d + cmpl $1053, %edx + jge ..B1.9 +..B1.2: + lea _PI04_INV(%rip), %rax + movsd -8(%rsp), %xmm0 + movsd (%rax), %xmm1 + mulsd %xmm0, %xmm1 + movsd %xmm1, -16(%rsp) + movzwl -10(%rsp), %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $1023, %ecx + jl ..B1.4 +..B1.3: + movl -12(%rsp), %esi + negl %ecx + orl $-1048576, %esi + addl $30, %ecx + movl -16(%rsp), %eax + shll $11, %esi + shrl $21, %eax + orl %eax, %esi + shrl %cl, %esi + jmp ..B1.5 +..B1.4: + xorl %esi, %esi +..B1.5: + movl %esi, %ecx + lea (%r8,%r8), %eax + andl $1, %ecx + negl %eax + addl %esi, %ecx + incl %esi + shrl $1, %esi + incl %eax + imull %esi, %eax + pxor %xmm7, %xmm7 + cvtsi2sd %ecx, %xmm7 + andl $3, %eax + cmpl $1046, %edx + jge ..B1.7 +..B1.6: + lea _PI04_29x4(%rip), %rdx + lea 8+_PI04_29x4(%rip), %rcx + lea 16+_PI04_29x4(%rip), %rsi + lea 24+_PI04_29x4(%rip), %rdi + movsd (%rdx), %xmm1 + mulsd %xmm7, %xmm1 + movsd (%rcx), %xmm2 + subsd %xmm1, %xmm0 + mulsd %xmm7, %xmm2 + movaps %xmm0, %xmm4 + movsd (%rsi), %xmm3 + subsd %xmm2, %xmm4 + mulsd %xmm7, %xmm3 + subsd %xmm4, %xmm0 + movsd (%rdi), %xmm5 + subsd %xmm2, %xmm0 + mulsd %xmm5, %xmm7 + movaps %xmm4, %xmm2 + subsd %xmm3, %xmm2 + subsd %xmm2, %xmm4 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm0 + subsd %xmm7, %xmm0 + jmp ..B1.8 +..B1.7: + lea _PI04_21x5(%rip), %rdx + lea 8+_PI04_21x5(%rip), %rcx + lea 16+_PI04_21x5(%rip), %rsi + lea 24+_PI04_21x5(%rip), %rdi + lea 32+_PI04_21x5(%rip), %r10 + movsd (%rdx), %xmm1 + movsd (%rcx), %xmm2 + mulsd %xmm7, %xmm1 + mulsd %xmm7, %xmm2 + subsd %xmm1, %xmm0 + movaps %xmm0, %xmm4 + movsd (%rsi), %xmm3 + subsd %xmm2, %xmm4 + mulsd %xmm7, %xmm3 + subsd %xmm4, %xmm0 + movaps %xmm4, %xmm8 + subsd %xmm2, %xmm0 + subsd %xmm3, %xmm8 + movaps %xmm8, %xmm5 + subsd %xmm8, %xmm4 + movsd (%r10), %xmm6 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm0 + addsd %xmm0, %xmm5 + movaps %xmm5, %xmm2 + subsd %xmm5, %xmm8 + addsd %xmm0, %xmm8 + movsd (%rdi), %xmm0 + mulsd %xmm7, %xmm0 + mulsd %xmm6, %xmm7 + subsd %xmm0, %xmm2 + subsd %xmm2, %xmm5 + subsd %xmm0, %xmm5 + addsd %xmm5, %xmm8 + subsd %xmm7, %xmm8 + movaps %xmm8, %xmm0 +..B1.8: + movl %r8d, %r8d + lea _ones(%rip), %rdx + movsd (%rdx,%r8,8), %xmm1 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm0 + movaps %xmm2, %xmm3 + addsd %xmm0, %xmm3 + movsd %xmm3, (%r9) + subsd %xmm3, %xmm2 + addsd %xmm0, %xmm2 + movsd %xmm2, 8(%r9) + ret +..B1.9: + andl $-32753, %eax + lea -200(%rdx), %r10d + andl $2047, %r10d + shll $4, %r10d + orl %r10d, %eax + movw %ax, -2(%rsp) + lea -1052(%rdx), %eax + imull $83886, %eax, %edi + movsd -8(%rsp), %xmm2 + movsd %xmm2, -24(%rsp) + sarl $21, %edi + movslq %edi, %rdi + imull $-25, %edi, %esi + movl -8(%rsp), %r11d + lea -1052(%rsi,%rdx), %ecx + andl $-134217728, %r11d + lea _DP(%rip), %rsi + movl %r11d, -24(%rsp) + negl %ecx + movsd -24(%rsp), %xmm1 + addl $38, %ecx + movaps %xmm1, %xmm3 + movq $-1, %rdx + movsd (%rsi,%rdi,8), %xmm0 + movaps %xmm1, %xmm7 + movsd 8(%rsi,%rdi,8), %xmm5 + movaps %xmm1, %xmm14 + mulsd %xmm5, %xmm3 + subsd %xmm1, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + movaps %xmm0, %xmm6 + shlq %cl, %rdx + addsd %xmm3, %xmm6 + movaps %xmm6, %xmm4 + subsd %xmm6, %xmm0 + movsd 16(%rsi,%rdi,8), %xmm12 + addsd %xmm3, %xmm0 + mulsd %xmm12, %xmm7 + mulsd %xmm2, %xmm12 + addsd %xmm0, %xmm4 + movd %xmm4, %r10 + movsd 24(%rsi,%rdi,8), %xmm3 + mulsd %xmm3, %xmm14 + mulsd %xmm2, %xmm3 + andq %rdx, %r10 + movq %r10, -16(%rsp) + subsd -16(%rsp), %xmm6 + movaps %xmm6, %xmm8 + addsd %xmm5, %xmm8 + movaps %xmm8, %xmm10 + subsd %xmm8, %xmm6 + addsd %xmm7, %xmm10 + addsd %xmm5, %xmm6 + subsd %xmm10, %xmm8 + addsd %xmm6, %xmm0 + addsd %xmm7, %xmm8 + movaps %xmm10, %xmm9 + movaps %xmm1, %xmm5 + movsd 32(%rsi,%rdi,8), %xmm7 + addsd %xmm8, %xmm0 + mulsd %xmm7, %xmm5 + mulsd %xmm2, %xmm7 + addsd %xmm0, %xmm9 + movaps %xmm0, %xmm13 + addsd %xmm12, %xmm9 + addsd %xmm14, %xmm9 + movsd %xmm9, -16(%rsp) + movzwl -10(%rsp), %ecx + shrl $4, %ecx + movd %xmm9, %rax + negl %ecx + movaps %xmm1, %xmm9 + addl $51, %ecx + sarq %cl, %rax + movl %eax, %edx + shlq %cl, %rax + movl %edx, %r11d + movq %rax, -16(%rsp) + lea _zero_none(%rip), %rax + andl $1, %r11d + incl %edx + shrl $1, %edx + lea _PI04_25x2(%rip), %rcx + subsd -16(%rsp), %xmm10 + movsd (%rax,%r11,8), %xmm11 + lea (%r8,%r8), %eax + negl %eax + addsd %xmm10, %xmm13 + incl %eax + subsd %xmm13, %xmm10 + imull %edx, %eax + addsd %xmm11, %xmm13 + addsd %xmm10, %xmm0 + movaps %xmm13, %xmm15 + movaps %xmm1, %xmm11 + lea _TWO_26H(%rip), %rdx + andl $3, %eax + addsd %xmm12, %xmm15 + movaps %xmm15, %xmm4 + subsd %xmm15, %xmm13 + addsd %xmm14, %xmm4 + addsd %xmm12, %xmm13 + subsd %xmm4, %xmm15 + addsd %xmm13, %xmm0 + addsd %xmm14, %xmm15 + movaps %xmm4, %xmm6 + movaps %xmm1, %xmm14 + movsd 40(%rsi,%rdi,8), %xmm12 + addsd %xmm3, %xmm6 + mulsd %xmm12, %xmm9 + addsd %xmm15, %xmm0 + mulsd %xmm2, %xmm12 + subsd %xmm6, %xmm4 + movaps %xmm6, %xmm8 + addsd %xmm3, %xmm4 + addsd %xmm5, %xmm8 + addsd %xmm4, %xmm0 + subsd %xmm8, %xmm6 + movaps %xmm8, %xmm10 + addsd %xmm5, %xmm6 + addsd %xmm7, %xmm10 + addsd %xmm6, %xmm0 + subsd %xmm10, %xmm8 + movsd 48(%rsi,%rdi,8), %xmm3 + movaps %xmm10, %xmm13 + mulsd %xmm3, %xmm11 + addsd %xmm9, %xmm13 + addsd %xmm7, %xmm8 + mulsd %xmm2, %xmm3 + addsd %xmm11, %xmm12 + subsd %xmm13, %xmm10 + addsd %xmm8, %xmm0 + addsd %xmm9, %xmm10 + movsd 56(%rsi,%rdi,8), %xmm15 + movaps %xmm13, %xmm4 + mulsd %xmm15, %xmm14 + addsd %xmm12, %xmm4 + addsd %xmm10, %xmm0 + mulsd %xmm15, %xmm2 + addsd %xmm14, %xmm3 + subsd %xmm4, %xmm13 + movaps %xmm4, %xmm5 + addsd %xmm12, %xmm13 + addsd %xmm3, %xmm5 + addsd %xmm13, %xmm0 + subsd %xmm5, %xmm4 + addsd %xmm3, %xmm4 + movsd 64(%rsi,%rdi,8), %xmm3 + mulsd %xmm3, %xmm1 + addsd %xmm4, %xmm0 + addsd %xmm1, %xmm2 + movaps %xmm2, %xmm3 + lea 8+_PI04_25x2(%rip), %rsi + movsd (%rdx), %xmm1 + lea _ones(%rip), %rdx + addsd %xmm5, %xmm3 + mulsd %xmm3, %xmm1 + addsd %xmm1, %xmm3 + subsd %xmm1, %xmm3 + subsd %xmm3, %xmm5 + addsd %xmm2, %xmm5 + movsd (%rcx), %xmm2 + addsd %xmm5, %xmm0 + movaps %xmm0, %xmm1 + addsd %xmm3, %xmm0 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm3 + mulsd (%rsi), %xmm0 + addsd %xmm0, %xmm1 + movaps %xmm1, %xmm0 + addsd %xmm3, %xmm0 + subsd %xmm0, %xmm3 + addsd %xmm1, %xmm3 + movsd (%rdx,%r8,8), %xmm1 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm3 + movsd %xmm0, (%r9) + movsd %xmm3, 8(%r9) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_reduce_pio2d,@function + .size __libm_reduce_pio2d,.-__libm_reduce_pio2d + .data +# -- End __libm_reduce_pio2d + .section .rodata, "a" + .align 16 + .align 16 +_PI04_INV: + .long 1841940611 + .long 1072979760 + .type _PI04_INV,@object + .size _PI04_INV,8 + .space 8, 0x00 # pad + .align 16 +_PI04_29x4: + .long 1409286144 + .long 1072243195 + .long 301989888 + .long 1040255814 + .long 1006632960 + .long 3156637299 + .long 2207917344 + .long 979464219 + .type _PI04_29x4,@object + .size _PI04_29x4,32 + .align 16 +_PI04_21x5: + .long 0 + .long 1072243194 + .long 0 + .long 1051018307 + .long 0 + .long 3174514122 + .long 0 + .long 3153310618 + .long 3773204808 + .long 981752838 + .type _PI04_21x5,@object + .size _PI04_21x5,40 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_DP: + .long 0 + .long 0 + .long 1610612736 + .long 1282694960 + .long 0 + .long 1256952721 + .long 536870912 + .long 1229269500 + .long 3221225472 + .long 1202544455 + .long 0 + .long 1176818551 + .long 2147483648 + .long 1148939346 + .long 536870912 + .long 1124701124 + .long 3758096384 + .long 1099498527 + .long 3758096384 + .long 1071929578 + .long 1342177280 + .long 1046982385 + .long 805306368 + .long 1020320658 + .long 2147483648 + .long 993817732 + .long 0 + .long 968598976 + .long 2684354560 + .long 942220475 + .long 2415919104 + .long 915426956 + .long 0 + .long 885849629 + .long 536870912 + .long 863855510 + .long 1610612736 + .long 836031391 + .long 4026531840 + .long 810828058 + .long 1073741824 + .long 784674491 + .long 1610612736 + .long 757207974 + .long 3489660928 + .long 732020890 + .long 0 + .long 703061904 + .long 1610612736 + .long 679713053 + .long 2147483648 + .long 652001705 + .long 1073741824 + .long 626850382 + .long 2147483648 + .long 597786158 + .long 805306368 + .long 575535400 + .long 536870912 + .long 548814833 + .long 268435456 + .long 523239288 + .long 3758096384 + .long 495550718 + .long 2952790016 + .long 469954840 + .long 1073741824 + .long 442925723 + .long 1073741824 + .long 416247094 + .long 3758096384 + .long 392128403 + .long 2147483648 + .long 364254062 + .long 3221225472 + .long 339643518 + .long 2684354560 + .long 313162111 + .long 805306368 + .long 286354345 + .long 2952790016 + .long 260811902 + .long 1610612736 + .long 234667567 + .long 3758096384 + .long 207520668 + .long 1073741824 + .long 182175017 + .long 4026531840 + .long 155380331 + .long 805306368 + .long 129417058 + .long 536870912 + .long 103691636 + .long 0 + .long 73760972 + .long 3221225472 + .long 48348958 + .long 536870912 + .long 23784188 + .type _DP,@object + .size _DP,400 + .align 16 +_zero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _zero_none,@object + .size _zero_none,16 + .align 16 +_PI04_25x2: + .long 1073741824 + .long 1072243195 + .long 407279769 + .long 1046758445 + .type _PI04_25x2,@object + .size _PI04_25x2,16 + .align 16 +_TWO_26H: + .long 0 + .long 1100480512 + .type _TWO_26H,@object + .size _TWO_26H,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_scalbl_k80.S b/external/sgx_libm/intel64/libm_scalbl_k80.S new file mode 100644 index 0000000000..b06884bd1c --- /dev/null +++ b/external/sgx_libm/intel64/libm_scalbl_k80.S @@ -0,0 +1,247 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_scalbl_k80.c" + .text +..TXTST0: +# -- Begin __libm_scalbl_k80 + .text + .align 16,0x90 + .globl __libm_scalbl_k80 +__libm_scalbl_k80: +# parameter 1: 8 + %rsp +# parameter 2: 24 + %rsp +# parameter 3: %edi +..B1.1: + .cfi_startproc +..___tag_value___libm_scalbl_k80.1: +..L2: + + fldt 24(%rsp) + fldt 8(%rsp) + fld %st(0) + cmpq $0, 8(%rsp) + fadd %st(2), %st + jne ..B1.3 +..B1.2: + fstp %st(2) + fstp %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + ret +..B1.3: + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.2 +..B1.4: + fstpt -24(%rsp) + fldt -24(%rsp) + movzwl -16(%rsp), %ecx + movl %ecx, %eax + andl $32767, %eax + lea -1(%rdi,%rax), %edx + cmpl $32765, %edx + lea (%rdi,%rax), %esi + ja ..B1.6 +..B1.5: + fstp %st(1) + fstp %st(1) + fstp %st(0) + andl $-32768, %ecx + andl $32767, %esi + orl %esi, %ecx + movw %cx, -16(%rsp) + fldt -24(%rsp) + ret +..B1.6: + cmpl $32766, %esi + jle ..B1.8 +..B1.7: + fstp %st(2) + fstp %st(1) + lea _CONSTANTS(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fmulp %st, %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + ret +..B1.8: + lea 16+_CONSTANTS(%rip), %rax + cmpl $-63, %esi + fldt (%rax) + jge ..B1.10 +..B1.9: + fstp %st(3) + fstp %st(0) + fxch %st(1) + fmul %st(0), %st + fmulp %st, %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + ret +..B1.10: + cmpl $-19, %esi + jge ..B1.12 +..B1.11: + fstp %st(2) + fstp %st(2) + fldt .L_2il0floatpacket.0(%rip) + movzwl 8+.L_2il0floatpacket.0(%rip), %eax + andl $-32768, %eax + fstpt -56(%rsp) + fmul %st(0), %st + faddp %st, %st(1) + fstpt -24(%rsp) + movzwl -16(%rsp), %edx + lea 256(%rdi,%rdx), %edi + andl $-32768, %edx + andl $32767, %edi + orl $-49409, %edx + orl %edi, %eax + movw %ax, -48(%rsp) + fldt -56(%rsp) + movw %dx, -16(%rsp) + fldt -24(%rsp) + fmulp %st, %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) + ret +..B1.12: + fstp %st(1) + fmul %st(0), %st + lea 32+_CONSTANTS(%rip), %rcx + movzwl 8+.L_2il0floatpacket.0(%rip), %r8d + faddp %st, %st(1) + fldt .L_2il0floatpacket.1(%rip) + andl $-32768, %r8d + fmul %st(1), %st + fld %st(0) + fsub %st(2), %st + fsubrp %st, %st(1) + fstpt -40(%rsp) + fldt -40(%rsp) + fsubrp %st, %st(1) + movzwl -32(%rsp), %esi + faddp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + lea -16383(%rsi), %eax + negl %eax + movl %esi, %edx + addl $16383, %eax + lea -32512(%rdi,%rsi), %edi + andl $32767, %eax + andl $-32768, %edx + fstpt -56(%rsp) + orl %eax, %r8d + fldt (%rcx) + andl $32767, %edi + fmulp %st, %st(1) + orl $-49409, %edx + movw %r8w, -48(%rsp) + andl $-32768, %r8d + fldt -56(%rsp) + orl %edi, %r8d + fmulp %st, %st(1) + movw %dx, -32(%rsp) + fldt -40(%rsp) + movw %r8w, -48(%rsp) + fldt -56(%rsp) + fmul %st, %st(1) + fxch %st(1) + fstpt -40(%rsp) + fldt -40(%rsp) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt -24(%rsp) + fldt -24(%rsp) +..B1.13: + ret + .align 16,0x90 + .cfi_endproc + .type __libm_scalbl_k80,@function + .size __libm_scalbl_k80,.-__libm_scalbl_k80 + .data +# -- End __libm_scalbl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 2 +_CONSTANTS: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16127 + .word 0 + .word 0 + .word 0 + .type _CONSTANTS,@object + .size _CONSTANTS,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_sincos_k32.S b/external/sgx_libm/intel64/libm_sincos_k32.S new file mode 100644 index 0000000000..2816a3e943 --- /dev/null +++ b/external/sgx_libm/intel64/libm_sincos_k32.S @@ -0,0 +1,366 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sincos_k32.c" + .text +..TXTST0: +# -- Begin __libm_sincos_k32 + .text + .align 16,0x90 + .globl __libm_sincos_k32 +__libm_sincos_k32: +# parameter 1: %xmm0 +# parameter 2: %rdi +# parameter 3: %rsi +# parameter 4: %edx +..B1.1: + .cfi_startproc +..___tag_value___libm_sincos_k32.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + subq $16, %rsp + .cfi_def_cfa_offset 48 + lea iones(%rip), %rax + movsd %xmm0, 8(%rsp) + movl %edx, %ecx + movl 12(%rsp), %r12d + movl %r12d, %r10d + shrl $31, %r12d + andl $2147483647, %r10d + imull (%rax,%r12,4), %ecx + movq %rsi, %rbp + andps .L_2il0floatpacket.2(%rip), %xmm0 + movq %rdi, %rbx + cmpl $1103101952, %r10d + jae ..B1.9 +..B1.2: + cmpl $1073283072, %r10d + ja ..B1.6 +..B1.3: + incl %ecx + movl %ecx, %edx + andl $2, %edx + je ..B1.5 +..B1.4: + subsd .L_2il0floatpacket.0(%rip), %xmm0 + movsd %xmm0, 8(%rsp) + jmp ..B1.11 +..B1.5: + movsd %xmm0, 8(%rsp) + jmp ..B1.11 +..B1.6: + lea _INV_PI04(%rip), %rax + lea _TWO_52H(%rip), %rdx + pxor %xmm2, %xmm2 + pxor %xmm5, %xmm5 + movsd %xmm0, 8(%rsp) + movsd (%rax), %xmm3 + mulsd %xmm0, %xmm3 + movsd (%rdx), %xmm1 + addsd %xmm3, %xmm1 + movsd %xmm1, (%rsp) + movl (%rsp), %r9d + cvtsi2sd %r9d, %xmm2 + cmpltsd %xmm2, %xmm3 + movd %xmm3, %edi + negl %edi + subl %edi, %r9d + addl %r9d, %ecx + movl %ecx, %r8d + andl $1, %r8d + addl %r8d, %r9d + addl %r8d, %ecx + cvtsi2sd %r9d, %xmm5 + cmpl $1090519040, %r10d + jae ..B1.8 +..B1.7: + lea _DP2(%rip), %rax + lea 8+_DP2(%rip), %rdx + lea 16+_DP2(%rip), %rdi + movsd (%rax), %xmm1 + mulsd %xmm5, %xmm1 + movsd (%rdx), %xmm2 + movl %ecx, %edx + mulsd %xmm5, %xmm2 + subsd %xmm1, %xmm0 + movsd (%rdi), %xmm3 + andl $2, %edx + mulsd %xmm3, %xmm5 + subsd %xmm2, %xmm0 + subsd %xmm5, %xmm0 + movsd %xmm0, 8(%rsp) + jmp ..B1.11 +..B1.8: + lea _DP3(%rip), %rax + lea 8+_DP3(%rip), %rdx + movsd 8(%rsp), %xmm0 + lea 16+_DP3(%rip), %rdi + lea 24+_DP3(%rip), %r8 + movsd (%rax), %xmm1 + movsd (%rdx), %xmm2 + movl %ecx, %edx + mulsd %xmm5, %xmm1 + andl $2, %edx + mulsd %xmm5, %xmm2 + subsd %xmm1, %xmm0 + movsd (%rdi), %xmm3 + subsd %xmm2, %xmm0 + mulsd %xmm5, %xmm3 + movsd (%r8), %xmm4 + subsd %xmm3, %xmm0 + mulsd %xmm4, %xmm5 + subsd %xmm5, %xmm0 + movsd %xmm0, 8(%rsp) + jmp ..B1.11 +..B1.9: + movl %ecx, %esi + lea 8(%rsp), %rdi + movsd %xmm0, (%rdi) +..___tag_value___libm_sincos_k32.10: + call __libm_reduce_pi04d@PLT +..___tag_value___libm_sincos_k32.11: +..B1.17: + movl %eax, %ecx +..B1.10: + incl %ecx + movl %ecx, %edx + movsd 8(%rsp), %xmm0 + andl $2, %edx +..B1.11: + movaps %xmm0, %xmm2 + lea 24+_CP(%rip), %rsi + mulsd %xmm0, %xmm2 + lea 8+_CP(%rip), %rdi + movaps %xmm2, %xmm1 + lea 24+_SP(%rip), %r8 + mulsd %xmm2, %xmm1 + lea 32+_CP(%rip), %r10 + movsd (%rsi), %xmm6 + lea 32+_SP(%rip), %rsi + mulsd %xmm1, %xmm6 + lea 8+_SP(%rip), %r9 + movsd (%rsi), %xmm4 + lea 16+_CP(%rip), %r11 + mulsd %xmm1, %xmm4 + addsd (%rdi), %xmm6 + lea 16+_SP(%rip), %rdi + lea 2(%rcx), %eax + movsd (%r8), %xmm5 + lea _SP(%rip), %r8 + movsd (%r10), %xmm3 + mulsd %xmm1, %xmm5 + addsd (%rdi), %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm6 + addsd (%r9), %xmm5 + mulsd %xmm1, %xmm4 + addsd (%r11), %xmm3 + addsd .L_2il0floatpacket.1(%rip), %xmm6 + mulsd %xmm1, %xmm5 + addsd (%r8), %xmm4 + mulsd %xmm1, %xmm3 + mulsd %xmm0, %xmm5 + mulsd %xmm2, %xmm4 + addsd %xmm0, %xmm5 + mulsd %xmm0, %xmm4 + shrl $2, %ecx + addsd %xmm4, %xmm5 + andl $1, %ecx + xorq %rcx, %r12 + lea _CP(%rip), %rcx + shrl $2, %eax + andl $1, %eax + testl %edx, %edx + addsd (%rcx), %xmm3 + lea ones(%rip), %rcx + mulsd %xmm2, %xmm3 + movsd (%rcx,%r12,8), %xmm0 + addsd %xmm3, %xmm6 + je ..B1.13 +..B1.12: + mulsd %xmm0, %xmm6 + movsd (%rcx,%rax,8), %xmm0 + mulsd %xmm0, %xmm5 + movsd %xmm6, (%rbx) + movsd %xmm5, (%rbp) + addq $16, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.13: + mulsd %xmm5, %xmm0 + movsd %xmm0, (%rbx) + movsd (%rcx,%rax,8), %xmm0 + mulsd %xmm0, %xmm6 + movsd %xmm6, (%rbp) +..B1.14: + addq $16, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __libm_sincos_k32,@function + .size __libm_sincos_k32,.-__libm_sincos_k32 + .data +# -- End __libm_sincos_k32 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x54442d18,0x3fe921fb + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_INV_PI04: + .long 1841940611 + .long 1072979760 + .type _INV_PI04,@object + .size _INV_PI04,8 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_DP2: + .long 1413742592 + .long 1072243195 + .long 1279262720 + .long 1031179299 + .long 1880851354 + .long 996723793 + .type _DP2,@object + .size _DP2,24 + .align 4 +_DP3: + .long 1073741824 + .long 1072243195 + .long 0 + .long 1046758445 + .long 2147483648 + .long 1021855384 + .long 1880851354 + .long 996723793 + .type _DP3,@object + .size _DP3,32 + .align 4 +_CP: + .long 4294960802 + .long 3219128319 + .long 1427442001 + .long 1067799893 + .long 2926645240 + .long 3210133867 + .long 2571283200 + .long 1056571689 + .long 2069816734 + .long 3197257552 + .type _CP,@object + .size _CP,40 + .align 4 +_SP: + .long 1431654765 + .long 3217380693 + .long 285032968 + .long 1065423121 + .long 3653044354 + .long 3207201183 + .long 2777006020 + .long 1053236634 + .long 43514947 + .long 3193610888 + .type _SP,@object + .size _SP,40 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_sincos_k64.S b/external/sgx_libm/intel64/libm_sincos_k64.S new file mode 100644 index 0000000000..c86f6c9625 --- /dev/null +++ b/external/sgx_libm/intel64/libm_sincos_k64.S @@ -0,0 +1,846 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sincos_k64.c" + .text +..TXTST0: +# -- Begin __libm_sincos_k64 + .text + .align 16,0x90 + .globl __libm_sincos_k64 +__libm_sincos_k64: +# parameter 1: %xmm0 +# parameter 2: %rdi +# parameter 3: %rsi +..B1.1: + .cfi_startproc +..___tag_value___libm_sincos_k64.1: +..L2: + + pushq %r15 + .cfi_def_cfa_offset 16 + .cfi_offset 15, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + subq $56, %rsp + .cfi_def_cfa_offset 80 + movq %rsi, %r15 + movsd %xmm0, (%rsp) + movq %rdi, %rbx + movzwl 6(%rsp), %edx + movq %fs:40, %rax + andl $32752, %edx + movsd (%rsp), %xmm0 + xorq %rsp, %rax + movq %rax, 48(%rsp) + movb 7(%rsp), %al + andb $127, %al + movsd %xmm0, 8(%rsp) + cmpl $32752, %edx + je ..B1.13 +..B1.2: + movb %al, 15(%rsp) + movzwl 14(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $771, %eax + jl ..B1.9 +..B1.3: + cmpl $1040, %eax + jge ..B1.5 +..B1.4: + lea 2176+sincos_table(%rip), %rax + movsd (%rax), %xmm1 + xorl %eax, %eax + movsd %xmm1, 40(%rsp) + jmp ..B1.7 +..B1.5: + lea 32(%rsp), %rdi +..___tag_value___libm_sincos_k64.8: + call __libm_reduce_pio2d@PLT +..___tag_value___libm_sincos_k64.9: +..B1.6: + movsd 32(%rsp), %xmm0 + movsd 40(%rsp), %xmm1 +..B1.7: + lea 2048+sincos_table(%rip), %rcx + lea 2056+sincos_table(%rip), %rsi + lea 2064+sincos_table(%rip), %r8 + lea 2072+sincos_table(%rip), %r9 + lea 2112+sincos_table(%rip), %r11 + lea 2080+sincos_table(%rip), %r10 + shll $4, %eax + movsd (%rcx), %xmm13 + lea 2104+sincos_table(%rip), %rcx + mulsd %xmm0, %xmm13 + movsd (%r8), %xmm11 + lea 2144+sincos_table(%rip), %r8 + movsd (%r9), %xmm12 + lea 2136+sincos_table(%rip), %r9 + movsd (%r11), %xmm15 + lea 2120+sincos_table(%rip), %r11 + addsd (%rsi), %xmm13 + movsd %xmm13, (%rsp) + movl (%rsp), %edi + subsd (%rsi), %xmm13 + lea 2096+sincos_table(%rip), %rsi + mulsd %xmm13, %xmm11 + lea (%rdi,%rax), %edx + mulsd %xmm13, %xmm12 + mulsd (%r10), %xmm13 + subsd %xmm11, %xmm0 + movaps %xmm0, %xmm10 + lea 2128+sincos_table(%rip), %r10 + movsd (%r8), %xmm11 + lea 16(%rdi,%rax), %eax + lea 2088+sincos_table(%rip), %rdi + andl $63, %edx + shll $2, %edx + andl $63, %eax + shll $2, %eax + subsd %xmm12, %xmm10 + movaps %xmm10, %xmm14 + subsd %xmm10, %xmm0 + mulsd %xmm10, %xmm14 + subsd %xmm12, %xmm0 + mulsd %xmm14, %xmm11 + mulsd %xmm14, %xmm15 + subsd %xmm13, %xmm0 + addsd (%r9), %xmm11 + addsd (%rcx), %xmm15 + addsd %xmm1, %xmm0 + mulsd %xmm14, %xmm11 + mulsd %xmm14, %xmm15 + addsd (%r10), %xmm11 + addsd (%rsi), %xmm15 + mulsd %xmm14, %xmm11 + mulsd %xmm14, %xmm15 + addsd (%r11), %xmm11 + addsd (%rdi), %xmm15 + mulsd %xmm14, %xmm11 + mulsd %xmm14, %xmm15 + lea sincos_table(%rip), %rcx + movaps %xmm10, %xmm12 + mulsd %xmm10, %xmm15 + movsd 8(%rcx,%rdx,8), %xmm2 + movaps %xmm2, %xmm1 + mulsd %xmm11, %xmm1 + mulsd %xmm2, %xmm12 + movsd (%rcx,%rdx,8), %xmm9 + movsd (%rcx,%rax,8), %xmm6 + movaps %xmm9, %xmm8 + movsd 24(%rcx,%rdx,8), %xmm4 + movaps %xmm6, %xmm3 + movsd 24(%rcx,%rax,8), %xmm5 + addsd %xmm4, %xmm8 + mulsd %xmm10, %xmm4 + addsd %xmm5, %xmm3 + mulsd %xmm10, %xmm5 + mulsd %xmm10, %xmm9 + mulsd %xmm10, %xmm6 + movsd %xmm1, 16(%rsp) + movaps %xmm4, %xmm13 + movsd 8(%rcx,%rax,8), %xmm1 + movaps %xmm5, %xmm14 + mulsd %xmm1, %xmm10 + addsd %xmm2, %xmm13 + addsd %xmm1, %xmm14 + mulsd %xmm1, %xmm11 + subsd %xmm13, %xmm2 + subsd %xmm14, %xmm1 + addsd %xmm4, %xmm2 + addsd %xmm5, %xmm1 + movaps %xmm8, %xmm7 + subsd %xmm12, %xmm8 + mulsd %xmm15, %xmm7 + mulsd %xmm3, %xmm15 + subsd %xmm10, %xmm3 + mulsd %xmm0, %xmm8 + mulsd %xmm3, %xmm0 + addsd 16(%rcx,%rdx,8), %xmm8 + addsd 16(%rcx,%rax,8), %xmm0 + addsd %xmm2, %xmm8 + addsd %xmm1, %xmm0 + movsd %xmm11, 24(%rsp) + movaps %xmm13, %xmm11 + movsd %xmm15, 8(%rsp) + movaps %xmm14, %xmm15 + addsd %xmm9, %xmm11 + addsd %xmm6, %xmm15 + subsd %xmm11, %xmm13 + subsd %xmm15, %xmm14 + addsd %xmm13, %xmm9 + addsd %xmm14, %xmm6 + addsd %xmm9, %xmm8 + addsd %xmm6, %xmm0 + addsd %xmm7, %xmm8 + addsd 8(%rsp), %xmm0 + addsd 16(%rsp), %xmm8 + addsd 24(%rsp), %xmm0 + movsd %xmm11, (%rbx) + movsd %xmm8, 8(%rbx) + movsd %xmm15, (%r15) + movsd %xmm0, 8(%r15) + movq 48(%rsp), %rbx + xorq %rsp, %rbx + cmpq %fs:40, %rbx + jne ..B1.11 +..B1.8: + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -24 + .cfi_offset 15, -16 +..B1.9: + xorl %eax, %eax + movsd %xmm0, (%rbx) + movq %rax, 8(%rbx) + movq $0x3ff0000000000000, %rbx + movq %rbx, (%r15) + movq %rax, 8(%r15) + movq 48(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + jne ..B1.11 +..B1.10: + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -24 + .cfi_offset 15, -16 +..B1.11: + call __stack_chk_fail@PLT +..B1.13: + lea 2176+sincos_table(%rip), %rax + xorl %edx, %edx + movq %rdx, 8(%rbx) + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + movsd %xmm0, (%rbx) + movsd %xmm0, (%r15) + movq %rdx, 8(%r15) + movq 48(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + jne ..B1.11 + jmp ..B1.8 + .align 16,0x90 + .cfi_endproc + .type __libm_sincos_k64,@function + .size __libm_sincos_k64,.-__libm_sincos_k64 + .data +# -- End __libm_sincos_k64 + .section .rodata, "a" + .align 16 + .align 16 +sincos_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 1072693248 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1071644672 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 1071644672 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1070596096 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 1070596096 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1069547520 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 3217031168 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 3218079744 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 3218079744 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 3219128320 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 3220176896 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3219128320 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 3219128320 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3218079744 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 3218079744 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3217031168 + .long 0 + .long 2147483648 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 1069547520 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 1070596096 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 1070596096 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 1071644672 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 1072693248 + .long 1841940611 + .long 1076125488 + .long 0 + .long 1127743488 + .long 1413480448 + .long 1069097467 + .long 442499072 + .long 1032893537 + .long 771977331 + .long 996350346 + .long 1431655765 + .long 3217380693 + .long 286331153 + .long 1065423121 + .long 436314138 + .long 3207201184 + .long 2773927732 + .long 1053236707 + .long 0 + .long 3219128320 + .long 1431655765 + .long 1067799893 + .long 381774871 + .long 3210133868 + .long 436314138 + .long 1056571808 + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 2146435072 + .type sincos_table,@object + .size sincos_table,2192 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_sinh_k64.S b/external/sgx_libm/intel64/libm_sinh_k64.S new file mode 100644 index 0000000000..a3e2e60c2d --- /dev/null +++ b/external/sgx_libm/intel64/libm_sinh_k64.S @@ -0,0 +1,394 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sinh_k64.c" + .text +..TXTST0: +# -- Begin __libm_sinh_k64 + .text + .align 16,0x90 + .globl __libm_sinh_k64 +__libm_sinh_k64: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_sinh_k64.1: +..L2: + + movaps %xmm0, %xmm3 + movsd %xmm3, -32(%rsp) + movzwl -26(%rsp), %eax + andl $32752, %eax + shrl $4, %eax + cmpl $1045, %eax + jge ..B1.11 +..B1.2: + movl -28(%rsp), %edx + movl %edx, %ecx + andl $2147483647, %ecx + cmpl $1066695393, %ecx + jae ..B1.7 +..B1.3: + cmpl $1012924416, %ecx + jae ..B1.5 +..B1.4: + movsd %xmm3, (%rdi) + movq $0, 8(%rdi) + jmp ..B1.6 +..B1.5: + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.3(%rip), %xmm4 + movsd .L_2il0floatpacket.5(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.4(%rip), %xmm4 + addsd .L_2il0floatpacket.6(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + movsd %xmm1, -40(%rsp) + addsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + movsd %xmm3, (%rdi) + movsd %xmm4, 8(%rdi) +..B1.6: + xorl %eax, %eax + ret +..B1.7: + movsd -32(%rsp), %xmm2 + lea _TWO_52(%rip), %rax + andps .L_2il0floatpacket.13(%rip), %xmm2 + movsd .L_2il0floatpacket.0(%rip), %xmm4 + mulsd %xmm2, %xmm4 + movsd (%rax), %xmm0 + movsd .L_2il0floatpacket.1(%rip), %xmm1 + addsd %xmm0, %xmm4 + movsd %xmm4, -40(%rsp) + subsd %xmm0, %xmm4 + mulsd %xmm4, %xmm1 + movsd %xmm2, -32(%rsp) + subsd %xmm1, %xmm2 + movsd .L_2il0floatpacket.2(%rip), %xmm3 + movaps %xmm2, %xmm6 + mulsd %xmm3, %xmm4 + movl -40(%rsp), %eax + movl %eax, %r10d + shll $25, %r10d + subsd %xmm4, %xmm6 + sarl $25, %r10d + subsd %xmm6, %xmm2 + subl %r10d, %eax + subsd %xmm4, %xmm2 + movsd .L_2il0floatpacket.15(%rip), %xmm1 + movaps %xmm2, %xmm0 + sarl $7, %eax + addsd %xmm6, %xmm0 + addsd %xmm6, %xmm1 + cmpl $1077338037, %ecx + jae ..B1.9 +..B1.8: + movaps %xmm0, %xmm7 + xorl %ecx, %ecx + mulsd %xmm0, %xmm7 + movaps %xmm6, %xmm9 + movsd .L_2il0floatpacket.8(%rip), %xmm8 + movl %eax, %esi + mulsd %xmm7, %xmm8 + negl %esi + movsd .L_2il0floatpacket.15(%rip), %xmm3 + addl $1023, %esi + movsd %xmm1, -32(%rsp) + subl %eax, %esi + movl %ecx, -32(%rsp) + andl $2047, %esi + movsd -32(%rsp), %xmm10 + decl %eax + movsd .L_2il0floatpacket.7(%rip), %xmm4 + subsd %xmm6, %xmm3 + addsd .L_2il0floatpacket.9(%rip), %xmm8 + addsd %xmm10, %xmm4 + mulsd %xmm7, %xmm8 + subsd %xmm4, %xmm9 + mulsd %xmm0, %xmm8 + addsd %xmm2, %xmm9 + movsd .L_2il0floatpacket.10(%rip), %xmm0 + addsd %xmm8, %xmm9 + mulsd %xmm7, %xmm0 + movsd %xmm3, -24(%rsp) + lea ones(%rip), %r11 + movl %ecx, -24(%rsp) + movsd -24(%rsp), %xmm1 + movsd .L_2il0floatpacket.7(%rip), %xmm5 + movslq %r10d, %r10 + addsd .L_2il0floatpacket.11(%rip), %xmm0 + addsd %xmm1, %xmm5 + mulsd %xmm7, %xmm0 + addsd %xmm5, %xmm6 + addsd .L_2il0floatpacket.12(%rip), %xmm0 + addsd %xmm6, %xmm2 + mulsd %xmm7, %xmm0 + xorps .L_2il0floatpacket.14(%rip), %xmm2 + addsd %xmm0, %xmm9 + subsd %xmm8, %xmm2 + shlq $4, %r10 + addsd %xmm0, %xmm2 + movaps %xmm9, %xmm0 + movaps %xmm2, %xmm12 + movq __libm_exp_table_128@GOTPCREL(%rip), %r9 + addsd %xmm10, %xmm9 + addsd %xmm1, %xmm2 + mulsd 1024(%r10,%r9), %xmm9 + movsd 1032(%r10,%r9), %xmm13 + negq %r10 + movzwl 6+.L_2il0floatpacket.15(%rip), %r8d + movsd .L_2il0floatpacket.15(%rip), %xmm6 + andl $-32753, %r8d + shll $4, %esi + movsd 1032(%r9,%r10), %xmm11 + orl %esi, %r8d + mulsd 1024(%r9,%r10), %xmm2 + mulsd %xmm11, %xmm12 + mulsd %xmm11, %xmm1 + mulsd %xmm13, %xmm0 + addsd %xmm2, %xmm12 + mulsd %xmm10, %xmm13 + addsd %xmm9, %xmm0 + movsd %xmm6, -16(%rsp) + movaps %xmm13, %xmm14 + movw %r8w, -10(%rsp) + movsd -16(%rsp), %xmm2 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm12 + subsd %xmm1, %xmm14 + subsd %xmm12, %xmm0 + subsd %xmm14, %xmm13 + shrl $31, %edx + subsd %xmm1, %xmm13 + movsd (%r11,%rdx,8), %xmm15 + addsd %xmm13, %xmm0 + movsd %xmm14, -40(%rsp) + mulsd %xmm15, %xmm14 + mulsd %xmm15, %xmm0 + movsd %xmm1, -24(%rsp) + movsd %xmm13, -32(%rsp) + movsd %xmm14, (%rdi) + movsd %xmm0, 8(%rdi) + ret +..B1.9: + movsd %xmm1, -40(%rsp) + movaps %xmm0, %xmm4 + movl $0, -40(%rsp) + decl %eax + movsd -40(%rsp), %xmm7 + lea ones(%rip), %rsi + movsd .L_2il0floatpacket.7(%rip), %xmm1 + movsd .L_2il0floatpacket.10(%rip), %xmm5 + addsd %xmm7, %xmm1 + mulsd %xmm0, %xmm4 + subsd %xmm1, %xmm6 + mulsd %xmm4, %xmm5 + addsd %xmm6, %xmm2 + addsd .L_2il0floatpacket.11(%rip), %xmm5 + movsd .L_2il0floatpacket.8(%rip), %xmm6 + mulsd %xmm4, %xmm6 + mulsd %xmm4, %xmm5 + addsd .L_2il0floatpacket.9(%rip), %xmm6 + mulsd %xmm6, %xmm0 + movsd .L_2il0floatpacket.12(%rip), %xmm3 + addsd %xmm0, %xmm5 + mulsd %xmm4, %xmm5 + mulsd %xmm3, %xmm4 + movslq %r10d, %r10 + addsd %xmm4, %xmm5 + shlq $4, %r10 + addsd %xmm5, %xmm2 + movaps %xmm2, %xmm8 + addsd %xmm7, %xmm2 + movq __libm_exp_table_128@GOTPCREL(%rip), %rcx + shrl $31, %edx + movsd 1032(%r10,%rcx), %xmm0 + mulsd 1024(%r10,%rcx), %xmm2 + mulsd %xmm0, %xmm8 + mulsd %xmm0, %xmm7 + addsd %xmm2, %xmm8 + movsd (%rsi,%rdx,8), %xmm2 + movsd %xmm7, -40(%rsp) + mulsd %xmm2, %xmm7 + mulsd %xmm8, %xmm2 + movsd %xmm7, (%rdi) + movsd %xmm2, 8(%rdi) +..B1.10: + ret +..B1.11: + movb -25(%rsp), %dl + andb $-128, %dl + shrb $7, %dl + cmpl $2047, %eax + je ..B1.14 +..B1.12: + movzbl %dl, %edx + lea infs(%rip), %rax + pxor %xmm0, %xmm0 + movq $0, 8(%rdi) + movl (%rax,%rdx,4), %ecx + cvtsi2sdq %rcx, %xmm0 + movsd %xmm0, (%rdi) +..B1.13: + xorl %eax, %eax + ret +..B1.14: + movq -32(%rsp), %rax + movq %rax, (%rdi) + movq $0, 8(%rdi) + jmp ..B1.13 + .align 16,0x90 + .cfi_endproc + .type __libm_sinh_k64,@function + .size __libm_sinh_k64,.-__libm_sinh_k64 + .data +# -- End __libm_sinh_k64 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.13: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,16 + .align 16 +.L_2il0floatpacket.14: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0xb9ff12f0,0x3ec71e39 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x111111c1,0x3f811111 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x1940cd88,0x3f2a01a0 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x55555555,0x3fc55555 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.15: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_52: + .long 0 + .long 1127219200 + .type _TWO_52,@object + .size _TWO_52,8 + .align 4 +infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type infs,@object + .size infs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_sinhl_k80.S b/external/sgx_libm/intel64/libm_sinhl_k80.S new file mode 100644 index 0000000000..f307983252 --- /dev/null +++ b/external/sgx_libm/intel64/libm_sinhl_k80.S @@ -0,0 +1,745 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sinhl_k80.c" + .text +..TXTST0: +# -- Begin __libm_sinhl_k80 + .text + .align 16,0x90 + .globl __libm_sinhl_k80 +__libm_sinhl_k80: +# parameter 1: 8 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_sinhl_k80.1: +..L2: + + movzwl 16(%rsp), %eax + andl $32767, %eax + cmpl $16405, %eax + jge ..B1.20 +..B1.2: + cmpl $16382, %eax + jge ..B1.13 +..B1.3: + fldt 8(%rsp) + cmpl $16378, %eax + jge ..B1.11 +..B1.4: + cmpl $16373, %eax + jge ..B1.10 +..B1.5: + cmpl $16366, %eax + jge ..B1.9 +..B1.6: + fstpt (%rdi) + fldt (%rdi) + cmpl $16308, %eax + jge ..B1.8 +..B1.7: + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + fstpt 16(%rdi) + fldt 16(%rdi) + ret +..B1.8: + lea _Q3(%rip), %rax + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.9: + fld %st(0) + lea 16+_Q2(%rip), %rax + lea _Q2(%rip), %rdx + fmul %st(1), %st + fxch %st(1) + fstpt (%rdi) + fldt (%rdi) + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.10: + fld %st(0) + lea 48+_Q1(%rip), %rax + lea 32+_Q1(%rip), %rcx + lea 16+_Q1(%rip), %rdx + lea _Q1(%rip), %rsi + fmul %st(1), %st + fld %st(0) + fmul %st(1), %st + fxch %st(2) + fstpt (%rdi) + fldt (%rdi) + fldt (%rax) + fmul %st(3), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + fmulp %st, %st(4) + fldt (%rsi) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) + ret +..B1.11: + lea _TWO_48H(%rip), %rax + fld %st(0) + fmul %st(1), %st + lea 112+_Q(%rip), %rdx + fld %st(0) + lea 80+_Q(%rip), %rcx + lea 48+_Q(%rip), %rsi + lea 96+_Q(%rip), %r9 + lea 16+_Q(%rip), %r8 + lea 64+_Q(%rip), %r10 + lea 32+_Q(%rip), %r11 + fmul %st(1), %st + fld %st(2) + fxch %st(3) + fstpt -88(%rsp) + fldt -88(%rsp) + fldl (%rax) + lea _Q(%rip), %rax + fadd %st, %st(4) + fxch %st(4) + fstpt -24(%rsp) + fldt -24(%rsp) + fsubp %st, %st(4) + fld %st(3) + fld %st(1) + fsub %st(5), %st + fmul %st, %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fxch %st(4) + fstpt -72(%rsp) + fldt -72(%rsp) + fmul %st(0), %st + fldt (%rdx) + lea 128+_Q(%rip), %rdx + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r9) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt (%rax) + faddp %st, %st(4) + fxch %st(4) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(0) + fldt (%rdx) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + fxch %st(4) + fmulp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fldt -88(%rsp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldt -72(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt (%rdi) + fldt (%rdi) + fsubrp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 16(%rdi) + fldt .L_2il0floatpacket.0(%rip) +..B1.12: + ret +..B1.13: + fldt 8(%rsp) + lea ones(%rip), %rax + movb 17(%rsp), %dl + lea _KLN2(%rip), %r8 + andb $-128, %dl + lea _TWO_63H(%rip), %rsi + shrb $7, %dl + lea _LN2K(%rip), %r9 + fldt (%r8) + fldl (%rsi) + fldt (%r9) + movzbl %dl, %ecx + lea 16+_LN2K(%rip), %r10 + lea _TWO_32P(%rip), %r11 + lea 64+_P(%rip), %rsi + lea 32+_P(%rip), %r8 + lea _P(%rip), %r9 + fldl (%rax,%rcx,8) + lea _TWO_32(%rip), %rcx + fmul %st, %st(4) + fxch %st(3) + fmul %st(4), %st + fadd %st(2), %st + fstpt -24(%rsp) + fxch %st(3) + fstpt 8(%rsp) + fldt 8(%rsp) + fldt -24(%rsp) + movl -24(%rsp), %edx + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + movsbq %dl, %rax + fxch %st(3) + fsubrp %st, %st(1) + fld %st(0) + subl %eax, %edx + fldt (%r10) + lea 48+_P(%rip), %r10 + fmulp %st, %st(4) + sarl $8, %edx + fsub %st(3), %st + fldl (%r11) + lea 16+_P(%rip), %r11 + fmul %st(1), %st + fldl (%rcx) + fmulp %st, %st(2) + movzwl 16(%rsp), %ecx + fsubp %st, %st(1) + fld %st(0) + andl $32767, %ecx + cmpl $16387, %ecx + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + fsubrp %st, %st(2) + fadd %st(1), %st + fld %st(0) + fmul %st(1), %st + fldt (%rsi) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + jg ..B1.19 +..B1.14: + jne ..B1.18 +..B1.15: + movl 12(%rsp), %ecx + cmpl $-782985146, %ecx + ja ..B1.19 +..B1.16: + jne ..B1.18 +..B1.17: + cmpl $1501741449, 8(%rsp) + ja ..B1.19 +..B1.18: + fldt .L_2il0floatpacket.1(%rip) + movl %edx, %esi + negl %esi + lea -1(%rdx), %ecx + addl $16383, %esi + shlq $4, %rax + subl %edx, %esi + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + andl $32767, %esi + fstpt -40(%rsp) + fld %st(0) + movzwl 8+.L_2il0floatpacket.1(%rip), %r8d + fadd %st(2), %st + fxch %st(2) + fsubrp %st, %st(1) + fxch %st(2) + fstpt -88(%rsp) + fld %st(2) + fldl 2056(%rdx,%rax) + andl $-32768, %r8d + fldl 2048(%rdx,%rax) + negq %rax + fstpt -72(%rsp) + fldt -72(%rsp) + orl %esi, %r8d + movw %r8w, -32(%rsp) + fadd %st(1), %st + fmulp %st, %st(3) + fld %st(4) + fmul %st(1), %st + movl %ecx, -8(%rsp) + faddp %st, %st(3) + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + fld %st(0) + fadd %st(2), %st + fmulp %st, %st(6) + fld %st(6) + fmul %st(2), %st + fsubrp %st, %st(6) + fxch %st(5) + fstpt -56(%rsp) + fxch %st(4) + fmul %st, %st(5) + fldt -72(%rsp) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fsub %st(5), %st + fsubr %st, %st(3) + fxch %st(5) + fsubrp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(0) + fldt -56(%rsp) + faddp %st, %st(4) + fldt -40(%rsp) + fmul %st, %st(5) + fxch %st(1) + fsub %st(5), %st + fsubr %st, %st(2) + fxch %st(5) + fsubrp %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(1) + fldt -88(%rsp) + fmul %st, %st(2) + fxch %st(2) + fstpt (%rdi) + fmulp %st, %st(1) + fstpt 16(%rdi) + fildl -8(%rsp) + ret +..B1.19: + shlq $4, %rax + decl %edx + movl %edx, -8(%rsp) + faddp %st, %st(1) + fildl -8(%rsp) + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(6), %st + fmul %st(2), %st + faddp %st, %st(4) + fmul %st, %st(5) + fld %st(0) + fadd %st(6), %st + fsubr %st, %st(1) + fxch %st(6) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + fstpt (%rdi) + fmulp %st, %st(2) + fxch %st(1) + fstpt 16(%rdi) + ret +..B1.20: + movb 17(%rsp), %dl + andb $-128, %dl + shrb $7, %dl + cmpl $32767, %eax + je ..B1.23 +..B1.21: + fldt .L_2il0floatpacket.0(%rip) + movzbl %dl, %eax + lea _infs(%rip), %rdx + shlq $4, %rax + fstpt 16(%rdi) + fldt (%rdx,%rax) + fstpt (%rdi) + fldt (%rdx) +..B1.22: + ret +..B1.23: + fldt 8(%rsp) + fstpt (%rdi) + fldt (%rdi) + fmul %st(0), %st + fldt .L_2il0floatpacket.0(%rip) + fstpt 16(%rdi) + ret + .align 16,0x90 + .cfi_endproc + .type __libm_sinhl_k80,@function + .size __libm_sinhl_k80,.-__libm_sinhl_k80 + .data +# -- End __libm_sinhl_k80 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 2 +_Q3: + .word 21845 + .word 44373 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 29491 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 1838 + .word 3745 + .word 35050 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 56472 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 6470 + .word 8609 + .word 207 + .word 53261 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 51515 + .word 9159 + .word 10794 + .word 47344 + .word 16364 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 43620 + .word 43690 + .word 43690 + .word 43690 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 52382 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 44665 + .word 46658 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 15678 + .word 35942 + .word 11071 + .word 55090 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 10412 + .word 23121 + .word 12507 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 37213 + .word 41879 + .word 65084 + .word 55102 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 1721 + .word 42148 + .word 19309 + .word 52099 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,144 + .align 2 +_KLN2: + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 16391 + .word 0 + .word 0 + .word 0 + .type _KLN2,@object + .size _KLN2,16 + .align 2 +_LN2K: + .word 0 + .word 0 + .word 6134 + .word 45426 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 55756 + .word 58609 + .word 48341 + .word 59623 + .word 16343 + .word 0 + .word 0 + .word 0 + .type _LN2K,@object + .size _LN2K,32 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_infs: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32767 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 65535 + .word 0 + .word 0 + .word 0 + .type _infs,@object + .size _infs,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_sinl_k80.S b/external/sgx_libm/intel64/libm_sinl_k80.S new file mode 100644 index 0000000000..23cbd838a2 --- /dev/null +++ b/external/sgx_libm/intel64/libm_sinl_k80.S @@ -0,0 +1,830 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sinl_k80.c" + .text +..TXTST0: +# -- Begin __libm_sinl_k80 + .text + .align 16,0x90 + .globl __libm_sinl_k80 +__libm_sinl_k80: +# parameter 1: 160 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_sinl_k80.1: +..L2: + + pushq %r15 + .cfi_def_cfa_offset 16 + .cfi_offset 15, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + subq $128, %rsp + .cfi_def_cfa_offset 160 + movq %rdi, %r15 + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 120(%rsp) + movzwl 168(%rsp), %eax + andl $32767, %eax + cmpl $16378, %eax + jge ..B1.13 +..B1.2: + fldt 160(%rsp) + cmpl $16372, %eax + jge ..B1.11 +..B1.3: + cmpl $16364, %eax + jge ..B1.9 +..B1.4: + fstpt (%r15) + fldt (%r15) + cmpl $16308, %eax + jge ..B1.6 +..B1.5: + fstp %st(0) + lea _zeros(%rip), %rax + lea _ones(%rip), %rdx + fldl (%rax) + fstpt 16(%r15) + fldl (%rdx) + jmp ..B1.7 +..B1.6: + lea _SP3(%rip), %rax + lea _ones(%rip), %rdx + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmulp %st, %st(1) + fstpt 16(%r15) + fldl (%rdx) +..B1.7: + movq 120(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.23 +..B1.8: + addq $128, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 15, -16 +..B1.9: + fld %st(0) + lea 16+_SP2(%rip), %rax + fmul %st(1), %st + lea _SP2(%rip), %rdx + lea _ones(%rip), %rcx + fxch %st(1) + fstpt (%r15) + fldt (%r15) + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + movsd (%rcx), %xmm0 + faddp %st, %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + fstpt 16(%r15) + movq 120(%rsp), %rbx + xorq %rsp, %rbx + cmpq %fs:40, %rbx + jne ..B1.24 +..B1.10: + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + addq $128, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 15, -16 +..B1.11: + fld %st(0) + lea 48+_SP1(%rip), %rax + fmul %st(1), %st + lea 32+_SP1(%rip), %rcx + fld %st(0) + lea 16+_SP1(%rip), %rdx + fmul %st(1), %st + lea _SP1(%rip), %rbx + lea _ones(%rip), %rbp + fxch %st(2) + fstpt (%r15) + fldt (%r15) + fldt (%rax) + fmul %st(3), %st + fldt (%rdx) + movsd (%rbp), %xmm0 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + fmulp %st, %st(4) + fldt (%rbx) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%r15) + movq 120(%rsp), %rsi + xorq %rsp, %rsi + cmpq %fs:40, %rsi + jne ..B1.24 +..B1.12: + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + addq $128, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 15, -16 +..B1.13: + cmpl $16382, %eax + jge ..B1.15 +..B1.14: + fldt 160(%rsp) + xorl %ecx, %ecx + movb 169(%rsp), %bl + lea _ones(%rip), %rbp + andb $-128, %bl + lea _TWO_52H(%rip), %rax + shrb $7, %bl + fldl (%rax) + movzbl %bl, %ebx + fxch %st(1) + fmull (%rbp,%rbx,8) + fmul %st, %st(1) + fld %st(1) + fadd %st(1), %st + fstpt (%rsp) + fstpt 24(%rsp) + fldt 24(%rsp) + fstpt 160(%rsp) + fldt 160(%rsp) + fldt (%rsp) + fsubp %st, %st(2) + fld %st(1) + fsubrp %st, %st(1) + fxch %st(1) + jmp ..B1.18 +..B1.15: + je ..B1.27 +..B1.16: + fldt 160(%rsp) + lea _ones(%rip), %rbp + movb 169(%rsp), %al + xorl %edi, %edi + andb $-128, %al + shrb $7, %al + movzbl %al, %ebx + fmull (%rbp,%rbx,8) + fstpt 160(%rsp) + fldt 160(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 176 + lea 120(%rsp), %rsi + fstpt (%rsp) +..___tag_value___libm_sinl_k80.44: + call __libm_reduce_pi04l@PLT +..___tag_value___libm_sinl_k80.45: +..B1.32: + movl %eax, %ecx + addq $16, %rsp + .cfi_def_cfa_offset 160 +..B1.17: + fldl 104(%rsp) + lea 1(%rcx), %eax + lea _TWO_52H(%rip), %rdx + fld %st(0) + movsd 104(%rsp), %xmm0 + sarl $2, %eax + movslq %eax, %rax + mulsd (%rdx), %xmm0 + xorq %rax, %rbx + movsd %xmm0, 16(%rsp) + andq $1, %rbx + fldl 16(%rsp) + fadd %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fldl 112(%rsp) + faddp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fstpt 24(%rsp) +..B1.18: + fldt 24(%rsp) + fld %st(1) + fmul %st(3), %st + fld %st(3) + fmulp %st, %st(2) + lea _TWO_53H(%rip), %rax + incl %ecx + testb $2, %cl + faddp %st, %st(1) + fstpt 40(%rsp) + fldt 40(%rsp) + fld %st(1) + fmul %st(2), %st + fld %st(0) + fadd %st(2), %st + fstpt 72(%rsp) + fldt 72(%rsp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 56(%rsp) + fldt 56(%rsp) + fxch %st(1) + fstpt 88(%rsp) + fldt 88(%rsp) + fmul %st(0), %st + fld %st(0) + faddp %st, %st(2) + fldl (%rax) + je ..B1.20 +..B1.19: + fstp %st(4) + fstp %st(2) + lea 112+_CP(%rip), %rax + lea 80+_CP(%rip), %rdx + lea 128+_CP(%rip), %rdi + lea 96+_CP(%rip), %r8 + lea 48+_CP(%rip), %rcx + lea 64+_CP(%rip), %r9 + lea 16+_CP(%rip), %rsi + lea 32+_CP(%rip), %r10 + fldt (%rax) + lea _CP(%rip), %r11 + lea 160+_CP(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + lea 144+_CP(%rip), %rdx + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r11) + faddp %st, %st(2) + fldt 72(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 56(%rsp) + fldt 40(%rsp) + fldt 88(%rsp) + fldt (%rax) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(4) + fldt (%rdx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fadd %st(1), %st + fmul %st, %st(3) + fadd %st(3), %st + fstpt (%rsp) + fldt (%rsp) + fsubp %st, %st(3) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(1) + fld %st(1) + fldl (%rbp) + fld %st(0) + fxch %st(1) + fadd %st, %st(2) + fxch %st(1) + fsub %st(2), %st + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fldl (%rbp,%rbx,8) + fmul %st, %st(1) + fxch %st(1) + fstpt (%r15) + fmulp %st, %st(2) + fxch %st(1) + fstpt 16(%r15) + jmp ..B1.21 +..B1.20: + lea 112+_SP(%rip), %rax + lea 80+_SP(%rip), %rdx + lea 48+_SP(%rip), %rcx + lea 128+_SP(%rip), %rdi + lea 16+_SP(%rip), %rsi + lea 96+_SP(%rip), %r8 + lea 64+_SP(%rip), %r9 + lea 32+_SP(%rip), %r10 + fldt (%rax) + lea _SP(%rip), %r11 + lea 160+_SP(%rip), %rax + fmul %st(3), %st + fldt (%rdx) + lea 144+_SP(%rip), %rdx + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + fmul %st(4), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt (%r11) + faddp %st, %st(4) + fldt 72(%rsp) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt 56(%rsp) + fldt 40(%rsp) + fldt (%rax) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(3) + fldt (%rdx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fldt 88(%rsp) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fmul %st, %st(1) + fadd %st(1), %st + fstpt (%rsp) + fldt (%rsp) + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(3) + fmul %st(1), %st + fxch %st(1) + fmul %st(3), %st + fldt 24(%rsp) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldl (%rbp,%rbx,8) + fmul %st, %st(1) + fxch %st(1) + fstpt (%r15) + fmulp %st, %st(1) + fstpt 16(%r15) + fldl (%rbp) +..B1.21: + movq 120(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.23 +..B1.22: + addq $128, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 15, -16 +..B1.23: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.24: + call __stack_chk_fail@PLT +..B1.27: + movl 164(%rsp), %eax + cmpl $-921707870, %eax + jb ..B1.14 +..B1.28: + jne ..B1.16 +..B1.29: + cmpl $560513589, 160(%rsp) + jbe ..B1.14 + jmp ..B1.16 + .align 16,0x90 + .cfi_endproc + .type __libm_sinl_k80,@function + .size __libm_sinl_k80,.-__libm_sinl_k80 + .data +# -- End __libm_sinl_k80 + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_SP3: + .word 17476 + .word 43656 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _SP3,@object + .size _SP3,16 + .align 2 +_SP2: + .word 43210 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 1587 + .word 57422 + .word 34932 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP2,@object + .size _SP2,32 + .align 2 +_SP1: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 12518 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43088 + .word 7396 + .word 207 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 55827 + .word 48618 + .word 3602 + .word 47342 + .word 16364 + .word 0 + .word 0 + .word 0 + .type _SP1,@object + .size _SP1,64 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 0 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP,@object + .size _CP,176 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP,@object + .size _SP,176 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_sse2_sincos.S b/external/sgx_libm/intel64/libm_sse2_sincos.S new file mode 100644 index 0000000000..19101b10f4 --- /dev/null +++ b/external/sgx_libm/intel64/libm_sse2_sincos.S @@ -0,0 +1,1406 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_sse2_sincos.c" + .text +..TXTST0: +# -- Begin __libm_sse2_sincos + .text + .align 16,0x90 + .globl __libm_sse2_sincos +__libm_sse2_sincos: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___libm_sse2_sincos.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movq %fs:40, %rax + xorq %rsp, %rax + movsd %xmm0, (%rsp) + movq %rax, 40(%rsp) +..B1.2: + pextrw $3, %xmm0, %eax + andw $32767, %ax + subw $12336, %ax + cmpw $4293, %ax + ja .L_2TAG_PACKET_0.0.1 + unpcklpd %xmm0, %xmm0 + movapd PI32INV(%rip), %xmm1 + mulpd %xmm0, %xmm1 + movapd SHIFTER(%rip), %xmm2 + cvtsd2si %xmm1, %edx + addpd %xmm2, %xmm1 + movapd P_1(%rip), %xmm3 + subpd %xmm2, %xmm1 + movapd P_2(%rip), %xmm2 + mulpd %xmm1, %xmm3 + addq $1865216, %rdx + movapd %xmm0, %xmm4 + andq $63, %rdx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shlq $6, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subpd %xmm3, %xmm0 + mulpd P_3(%rip), %xmm1 + subpd %xmm3, %xmm4 + movapd 16(%rax), %xmm7 + movapd %xmm4, %xmm3 + subpd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + movapd SC_2(%rip), %xmm6 + mulpd %xmm4, %xmm7 + subpd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subpd %xmm3, %xmm1 + movapd 48(%rax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm7 + mulpd %xmm7, %xmm1 + movapd 16(%rax), %xmm7 + mulpd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulpd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm7 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulpd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addpd 16(%rax), %xmm3 + addpd %xmm5, %xmm6 + movq %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulpd %xmm7, %xmm6 + mulpd %xmm5, %xmm2 + movapd %xmm4, %xmm7 + addpd %xmm3, %xmm4 + movapd 16(%rax), %xmm5 + subpd %xmm3, %xmm5 + subpd %xmm4, %xmm3 + addpd 32(%rax), %xmm1 + addpd %xmm0, %xmm5 + addpd %xmm7, %xmm3 + addpd %xmm5, %xmm1 + addpd %xmm3, %xmm1 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + addpd %xmm4, %xmm1 + movq %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + jmp ..B1.7 +.L_2TAG_PACKET_0.0.1: + jg .L_2TAG_PACKET_1.0.1 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orw $32768, %ax + pinsrw $3, %eax, %xmm1 + addsd ONE(%rip), %xmm1 + cmpw $32784, %ax + jge .L_2TAG_PACKET_2.0.1 + mulsd ALL_ONES(%rip), %xmm0 + jmp ..B1.7 +.L_2TAG_PACKET_2.0.1: + movq TWO_POW_55(%rip), %xmm3 + mulsd %xmm0, %xmm3 + subsd %xmm3, %xmm0 + mulsd TWO_POW_M55(%rip), %xmm0 + jmp ..B1.7 +.L_2TAG_PACKET_1.0.1: + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_3.0.1 +..B1.3: + movsd (%rsp), %xmm0 + lea 24(%rsp), %rdi +..___tag_value___libm_sse2_sincos.4: + call __libm_reduce_pio2d@PLT +..___tag_value___libm_sse2_sincos.5: +..B1.4: + movl %eax, 16(%rsp) +..B1.5: + movq 24(%rsp), %xmm0 + movq 32(%rsp), %xmm6 + unpcklpd %xmm0, %xmm0 + unpcklpd %xmm6, %xmm6 + movapd PI32INV(%rip), %xmm1 + mulpd %xmm0, %xmm1 + movapd SHIFTER(%rip), %xmm2 + cvtsd2si %xmm1, %edx + addpd %xmm2, %xmm1 + movapd P_1(%rip), %xmm3 + subpd %xmm2, %xmm1 + movapd P_2(%rip), %xmm2 + mulpd %xmm1, %xmm3 + movl 16(%rsp), %eax + shlq $4, %rax + addq $1865216, %rdx + movapd %xmm0, %xmm4 + addq %rax, %rdx + andq $63, %rdx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shlq $6, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subpd %xmm3, %xmm0 + mulpd P_3(%rip), %xmm1 + subpd %xmm3, %xmm4 + movapd 16(%rax), %xmm7 + movapd %xmm4, %xmm3 + subpd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + mulpd %xmm4, %xmm7 + subpd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subpd %xmm3, %xmm1 + movapd 48(%rax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm7 + subpd %xmm6, %xmm1 + movapd SC_2(%rip), %xmm6 + mulpd %xmm7, %xmm1 + movapd 16(%rax), %xmm7 + mulpd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulpd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm7 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulpd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addpd 16(%rax), %xmm3 + addpd %xmm5, %xmm6 + movq %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulpd %xmm7, %xmm6 + mulpd %xmm5, %xmm2 + movapd %xmm4, %xmm7 + addpd %xmm3, %xmm4 + movapd 16(%rax), %xmm5 + subpd %xmm3, %xmm5 + subpd %xmm4, %xmm3 + addpd 32(%rax), %xmm1 + addpd %xmm0, %xmm5 + addpd %xmm7, %xmm3 + addpd %xmm5, %xmm1 + addpd %xmm3, %xmm1 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + addpd %xmm4, %xmm1 + movq %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + jmp ..B1.7 +.L_2TAG_PACKET_3.0.1: + movq (%rsp), %xmm0 + pxor %xmm1, %xmm1 + mulsd %xmm1, %xmm0 + movq %xmm0, %xmm1 + movq %xmm0, 8(%rsp) + jmp ..B1.7 +.L_2TAG_PACKET_4.0.1: +..B1.7: + movq 40(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.9 +..B1.8: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.9: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __libm_sse2_sincos,@function + .size __libm_sse2_sincos,.-__libm_sse2_sincos + .data +# -- End __libm_sse2_sincos + .section .rodata, "a" + .align 16 + .align 16 +PI32INV: + .long 1841940611 + .long 1076125488 + .long 1841940611 + .long 1076125488 + .type PI32INV,@object + .size PI32INV,16 + .align 16 +SHIFTER: + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .type SHIFTER,@object + .size SHIFTER,16 + .align 16 +P_1: + .long 1413480448 + .long 1069097467 + .long 1413480448 + .long 1069097467 + .type P_1,@object + .size P_1,16 + .align 16 +P_2: + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .type P_2,@object + .size P_2,16 + .align 16 +SC_4: + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .type SC_4,@object + .size SC_4,16 + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 3217031168 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 3220176896 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 1069547520 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 1071644672 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 1072693248 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 1069547520 + .type Ctable,@object + .size Ctable,4096 + .space 512, 0x00 # pad + .align 16 +P_3: + .long 771977331 + .long 996350346 + .long 771977331 + .long 996350346 + .type P_3,@object + .size P_3,16 + .align 16 +SC_2: + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .type SC_2,@object + .size SC_2,16 + .align 16 +SC_3: + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .type SC_3,@object + .size SC_3,16 + .align 16 +SC_1: + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .type SC_1,@object + .size SC_1,16 + .align 16 +TWO_POW_55: + .long 0 + .long 1130364928 + .type TWO_POW_55,@object + .size TWO_POW_55,8 + .align 8 +ONE: + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,8 + .align 8 +ALL_ONES: + .long 4294967295 + .long 1072693247 + .type ALL_ONES,@object + .size ALL_ONES,8 + .align 8 +TWO_POW_M55: + .long 0 + .long 3162505216 + .type TWO_POW_M55,@object + .size TWO_POW_M55,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/libm_strtoull.S b/external/sgx_libm/intel64/libm_strtoull.S new file mode 100644 index 0000000000..7ac4bbcccd --- /dev/null +++ b/external/sgx_libm/intel64/libm_strtoull.S @@ -0,0 +1,1006 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "libm_strtoull.c" + .text +..TXTST0: +# -- Begin __libm_conv_strtoull + .text + .align 16,0x90 + .globl __libm_conv_strtoull +__libm_conv_strtoull: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value___libm_conv_strtoull.1: +..L2: + + movq %rdi, %rdx + xorl %esi, %esi + testq %rdi, %rdi + je ..B1.7 +..B1.2: + movsbl (%rdi), %eax + testl %eax, %eax + je ..B1.7 +..B1.4: + incq %rdx + incl %esi + cmpb $0, (%rdx) + jne ..B1.4 +..B1.5: + testl %esi, %esi + je ..B1.7 +..B1.6: + lea -48(%rax), %ecx + cmpl $9, %ecx + jbe ..B1.8 +..B1.7: + xorl %eax, %eax + jmp ..B1.21 +..B1.8: + cmpl $48, %eax + je ..B1.23 +..B1.9: + movl $1, %ecx + cmpl $1, %esi + jle ..B1.14 +..B1.10: + movslq %esi, %rax +..B1.11: + movsbl (%rcx,%rdi), %r8d + addl $-48, %r8d + cmpl $9, %r8d + ja ..B1.7 +..B1.12: + incq %rcx + cmpq %rax, %rcx + jl ..B1.11 +..B1.14: + movl $64, %ecx + cmpl $64, %esi + cmovb %esi, %ecx + xorl %eax, %eax + testl %esi, %esi + jle ..B1.21 +..B1.15: + movl %ecx, %r9d + xorl %r10d, %r10d + shrl $1, %r9d + movl $1, %edi + xorl %r8d, %r8d + xorl %r11d, %r11d + testl %r9d, %r9d + jbe ..B1.19 +..B1.16: + movq %r12, -8(%rsp) + xorl %edi, %edi + lea _C_MUL_10_POW_I(%rip), %rsi + .cfi_offset 12, -16 +..B1.17: + movb -1(%r11,%rdx), %r12b + incl %r8d + addb $-48, %r12b + movsbq %r12b, %r12 + lea (%rsi,%r12,8), %r12 + addq (%r12,%r10), %rax + movb -2(%r11,%rdx), %r12b + addq $-2, %r11 + addb $-48, %r12b + movsbq %r12b, %r12 + lea (%rsi,%r12,8), %r12 + addq 80(%r12,%r10), %rdi + addq $160, %r10 + cmpl %r9d, %r8d + jb ..B1.17 +..B1.18: + movq -8(%rsp), %r12 + .cfi_restore 12 + addq %rdi, %rax + lea 1(%r8,%r8), %edi +..B1.19: + lea -1(%rdi), %esi + cmpl %esi, %ecx + jbe ..B1.21 +..B1.20: + movslq %edi, %rdi + lea _C_MUL_10_POW_I(%rip), %r8 + subq %rdi, %rdx + lea (%rdi,%rdi,4), %rcx + movb (%rdx), %dl + addb $-48, %dl + movsbq %dl, %rsi + shlq $4, %rcx + lea (%rcx,%rsi,8), %r9 + addq -80(%r8,%r9), %rax +..B1.21: + ret +..B1.23: + cmpl $3, %esi + jl ..B1.25 +..B1.24: + movsbl 1(%rdi), %eax + andl $-33, %eax + cmpl $88, %eax + je ..B1.38 +..B1.25: + movl $1, %ecx + cmpl $1, %esi + jle ..B1.30 +..B1.26: + movslq %esi, %rax +..B1.27: + movsbl (%rcx,%rdi), %r8d + addl $-48, %r8d + cmpl $7, %r8d + ja ..B1.7 +..B1.28: + incq %rcx + cmpq %rax, %rcx + jl ..B1.27 +..B1.30: + decl %esi + movl $22, %r8d + cmpl $22, %esi + cmovb %esi, %r8d + xorl %eax, %eax + testl %esi, %esi + jle ..B1.21 +..B1.31: + movl %r8d, %edi + xorl %esi, %esi + shrl $1, %edi + xorl %r9d, %r9d + movl $1, %r11d + xorl %r10d, %r10d + testl %edi, %edi + jbe ..B1.35 +..B1.32: + movq %r12, -8(%rsp) + xorl %r11d, %r11d + .cfi_offset 12, -16 +..B1.33: + movslq %r9d, %r9 + movl %r10d, %ecx + incl %esi + movb -1(%r9,%rdx), %r12b + addb $-48, %r12b + movsbq %r12b, %r12 + shlq %cl, %r12 + lea 3(%r10), %ecx + addq %r12, %rax + addl $6, %r10d + movb -2(%r9,%rdx), %r12b + addl $-2, %r9d + addb $-48, %r12b + movsbq %r12b, %r12 + shlq %cl, %r12 + addq %r12, %r11 + cmpl %edi, %esi + jb ..B1.33 +..B1.34: + movq -8(%rsp), %r12 + .cfi_restore 12 + addq %r11, %rax + lea 1(%rsi,%rsi), %r11d +..B1.35: + lea -1(%r11), %ecx + cmpl %ecx, %r8d + jbe ..B1.21 +..B1.36: + movslq %r11d, %r11 + subq %r11, %rdx + lea 61(%r11,%r11,2), %ecx + movb (%rdx), %dl + addb $-48, %dl + movsbq %dl, %rsi + shlq %cl, %rsi + addq %rsi, %rax + jmp ..B1.21 +..B1.38: + movslq %esi, %rax + xorl %ecx, %ecx + addq $-2, %rax +..B1.39: + movsbl 2(%rcx,%rdi), %r9d + lea -48(%r9), %r8d + cmpl $9, %r8d + jbe ..B1.42 +..B1.40: + lea -97(%r9), %r8d + cmpl $5, %r8d + jbe ..B1.42 +..B1.41: + addl $-65, %r9d + cmpl $5, %r9d + ja ..B1.7 +..B1.42: + incq %rcx + cmpq %rax, %rcx + jb ..B1.39 +..B1.43: + addl $-2, %esi + movl $16, %r9d + cmpl $16, %esi + cmovb %esi, %r9d + xorl %eax, %eax + testl %esi, %esi + jle ..B1.21 +..B1.44: + movl %r9d, %r8d + xorl %r10d, %r10d + shrl $1, %r8d + movl $1, %ecx + xorl %r11d, %r11d + testl %r8d, %r8d + jbe ..B1.54 +..B1.45: + movq %r12, -8(%rsp) + .cfi_offset 12, -16 +..B1.46: + movslq %r11d, %rsi + movsbl -1(%rsi,%rdx), %edi + lea -48(%rdi), %ecx + cmpl $9, %ecx + ja ..B1.48 +..B1.47: + movsbq %cl, %rdi + jmp ..B1.49 +..B1.48: + lea -97(%rdi), %ecx + lea -87(%rdi), %r12d + addl $-55, %edi + cmpl $5, %ecx + movsbq %r12b, %r12 + movsbq %dil, %rdi + cmovbe %r12, %rdi +..B1.49: + lea (,%r10,8), %ecx + shlq %cl, %rdi + movsbl -2(%rsi,%rdx), %ecx + addq %rdi, %rax + lea -48(%rcx), %esi + cmpl $9, %esi + ja ..B1.51 +..B1.50: + movsbq %sil, %rsi + jmp ..B1.52 +..B1.51: + lea -97(%rcx), %edi + lea -87(%rcx), %esi + addl $-55, %ecx + cmpl $5, %edi + movsbq %sil, %r12 + movsbq %cl, %rsi + cmovbe %r12, %rsi +..B1.52: + addl $-2, %r11d + lea 4(,%r10,8), %ecx + shlq %cl, %rsi + incl %r10d + addq %rsi, %rax + cmpl %r8d, %r10d + jb ..B1.46 +..B1.53: + movq -8(%rsp), %r12 + .cfi_restore 12 + lea 1(%r10,%r10), %ecx +..B1.54: + lea -1(%rcx), %esi + cmpl %esi, %r9d + jbe ..B1.21 +..B1.55: + movslq %ecx, %rcx + subq %rcx, %rdx + movsbl (%rdx), %esi + lea -48(%rsi), %edx + cmpl $9, %edx + ja ..B1.57 +..B1.56: + movsbq %dl, %rdx + jmp ..B1.58 +..B1.57: + lea -97(%rsi), %edi + lea -87(%rsi), %edx + addl $-55, %esi + cmpl $5, %edi + movsbq %dl, %r8 + movsbq %sil, %rdx + cmovbe %r8, %rdx +..B1.58: + lea 60(,%rcx,4), %ecx + shlq %cl, %rdx + addq %rdx, %rax + jmp ..B1.21 + .align 16,0x90 + .cfi_endproc + .type __libm_conv_strtoull,@function + .size __libm_conv_strtoull,.-__libm_conv_strtoull + .data +# -- End __libm_conv_strtoull + .section .rodata, "a" + .align 8 + .align 8 +_C_MUL_10_POW_I: + .long 0x00000000,0x00000000 + .long 0x00000001,0x00000000 + .long 0x00000002,0x00000000 + .long 0x00000003,0x00000000 + .long 0x00000004,0x00000000 + .long 0x00000005,0x00000000 + .long 0x00000006,0x00000000 + .long 0x00000007,0x00000000 + .long 0x00000008,0x00000000 + .long 0x00000009,0x00000000 + .long 0x00000000,0x00000000 + .long 0x0000000a,0x00000000 + .long 0x00000014,0x00000000 + .long 0x0000001e,0x00000000 + .long 0x00000028,0x00000000 + .long 0x00000032,0x00000000 + .long 0x0000003c,0x00000000 + .long 0x00000046,0x00000000 + .long 0x00000050,0x00000000 + .long 0x0000005a,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000064,0x00000000 + .long 0x000000c8,0x00000000 + .long 0x0000012c,0x00000000 + .long 0x00000190,0x00000000 + .long 0x000001f4,0x00000000 + .long 0x00000258,0x00000000 + .long 0x000002bc,0x00000000 + .long 0x00000320,0x00000000 + .long 0x00000384,0x00000000 + .long 0x00000000,0x00000000 + .long 0x000003e8,0x00000000 + .long 0x000007d0,0x00000000 + .long 0x00000bb8,0x00000000 + .long 0x00000fa0,0x00000000 + .long 0x00001388,0x00000000 + .long 0x00001770,0x00000000 + .long 0x00001b58,0x00000000 + .long 0x00001f40,0x00000000 + .long 0x00002328,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00002710,0x00000000 + .long 0x00004e20,0x00000000 + .long 0x00007530,0x00000000 + .long 0x00009c40,0x00000000 + .long 0x0000c350,0x00000000 + .long 0x0000ea60,0x00000000 + .long 0x00011170,0x00000000 + .long 0x00013880,0x00000000 + .long 0x00015f90,0x00000000 + .long 0x00000000,0x00000000 + .long 0x000186a0,0x00000000 + .long 0x00030d40,0x00000000 + .long 0x000493e0,0x00000000 + .long 0x00061a80,0x00000000 + .long 0x0007a120,0x00000000 + .long 0x000927c0,0x00000000 + .long 0x000aae60,0x00000000 + .long 0x000c3500,0x00000000 + .long 0x000dbba0,0x00000000 + .long 0x00000000,0x00000000 + .long 0x000f4240,0x00000000 + .long 0x001e8480,0x00000000 + .long 0x002dc6c0,0x00000000 + .long 0x003d0900,0x00000000 + .long 0x004c4b40,0x00000000 + .long 0x005b8d80,0x00000000 + .long 0x006acfc0,0x00000000 + .long 0x007a1200,0x00000000 + .long 0x00895440,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00989680,0x00000000 + .long 0x01312d00,0x00000000 + .long 0x01c9c380,0x00000000 + .long 0x02625a00,0x00000000 + .long 0x02faf080,0x00000000 + .long 0x03938700,0x00000000 + .long 0x042c1d80,0x00000000 + .long 0x04c4b400,0x00000000 + .long 0x055d4a80,0x00000000 + .long 0x00000000,0x00000000 + .long 0x05f5e100,0x00000000 + .long 0x0bebc200,0x00000000 + .long 0x11e1a300,0x00000000 + .long 0x17d78400,0x00000000 + .long 0x1dcd6500,0x00000000 + .long 0x23c34600,0x00000000 + .long 0x29b92700,0x00000000 + .long 0x2faf0800,0x00000000 + .long 0x35a4e900,0x00000000 + .long 0x00000000,0x00000000 + .long 0x3b9aca00,0x00000000 + .long 0x77359400,0x00000000 + .long 0xb2d05e00,0x00000000 + .long 0xee6b2800,0x00000000 + .long 0x2a05f200,0x00000001 + .long 0x65a0bc00,0x00000001 + .long 0xa13b8600,0x00000001 + .long 0xdcd65000,0x00000001 + .long 0x18711a00,0x00000002 + .long 0x00000000,0x00000000 + .long 0x540be400,0x00000002 + .long 0xa817c800,0x00000004 + .long 0xfc23ac00,0x00000006 + .long 0x502f9000,0x00000009 + .long 0xa43b7400,0x0000000b + .long 0xf8475800,0x0000000d + .long 0x4c533c00,0x00000010 + .long 0xa05f2000,0x00000012 + .long 0xf46b0400,0x00000014 + .long 0x00000000,0x00000000 + .long 0x4876e800,0x00000017 + .long 0x90edd000,0x0000002e + .long 0xd964b800,0x00000045 + .long 0x21dba000,0x0000005d + .long 0x6a528800,0x00000074 + .long 0xb2c97000,0x0000008b + .long 0xfb405800,0x000000a2 + .long 0x43b74000,0x000000ba + .long 0x8c2e2800,0x000000d1 + .long 0x00000000,0x00000000 + .long 0xd4a51000,0x000000e8 + .long 0xa94a2000,0x000001d1 + .long 0x7def3000,0x000002ba + .long 0x52944000,0x000003a3 + .long 0x27395000,0x0000048c + .long 0xfbde6000,0x00000574 + .long 0xd0837000,0x0000065d + .long 0xa5288000,0x00000746 + .long 0x79cd9000,0x0000082f + .long 0x00000000,0x00000000 + .long 0x4e72a000,0x00000918 + .long 0x9ce54000,0x00001230 + .long 0xeb57e000,0x00001b48 + .long 0x39ca8000,0x00002461 + .long 0x883d2000,0x00002d79 + .long 0xd6afc000,0x00003691 + .long 0x25226000,0x00003faa + .long 0x73950000,0x000048c2 + .long 0xc207a000,0x000051da + .long 0x00000000,0x00000000 + .long 0x107a4000,0x00005af3 + .long 0x20f48000,0x0000b5e6 + .long 0x316ec000,0x000110d9 + .long 0x41e90000,0x00016bcc + .long 0x52634000,0x0001c6bf + .long 0x62dd8000,0x000221b2 + .long 0x7357c000,0x00027ca5 + .long 0x83d20000,0x0002d798 + .long 0x944c4000,0x0003328b + .long 0x00000000,0x00000000 + .long 0xa4c68000,0x00038d7e + .long 0x498d0000,0x00071afd + .long 0xee538000,0x000aa87b + .long 0x931a0000,0x000e35fa + .long 0x37e08000,0x0011c379 + .long 0xdca70000,0x001550f7 + .long 0x816d8000,0x0018de76 + .long 0x26340000,0x001c6bf5 + .long 0xcafa8000,0x001ff973 + .long 0x00000000,0x00000000 + .long 0x6fc10000,0x002386f2 + .long 0xdf820000,0x00470de4 + .long 0x4f430000,0x006a94d7 + .long 0xbf040000,0x008e1bc9 + .long 0x2ec50000,0x00b1a2bc + .long 0x9e860000,0x00d529ae + .long 0x0e470000,0x00f8b0a1 + .long 0x7e080000,0x011c3793 + .long 0xedc90000,0x013fbe85 + .long 0x00000000,0x00000000 + .long 0x5d8a0000,0x01634578 + .long 0xbb140000,0x02c68af0 + .long 0x189e0000,0x0429d069 + .long 0x76280000,0x058d15e1 + .long 0xd3b20000,0x06f05b59 + .long 0x313c0000,0x0853a0d2 + .long 0x8ec60000,0x09b6e64a + .long 0xec500000,0x0b1a2bc2 + .long 0x49da0000,0x0c7d713b + .long 0x00000000,0x00000000 + .long 0xa7640000,0x0de0b6b3 + .long 0x4ec80000,0x1bc16d67 + .long 0xf62c0000,0x29a2241a + .long 0x9d900000,0x3782dace + .long 0x44f40000,0x45639182 + .long 0xec580000,0x53444835 + .long 0x93bc0000,0x6124fee9 + .long 0x3b200000,0x6f05b59d + .long 0xe2840000,0x7ce66c50 + .long 0x00000000,0x00000000 + .long 0x89e80000,0x8ac72304 + .long 0x13d00000,0x158e4609 + .long 0x9db80000,0xa055690d + .long 0x27a00000,0x2b1c8c12 + .long 0xb1880000,0xb5e3af16 + .long 0x3b700000,0x40aad21b + .long 0xc5580000,0xcb71f51f + .long 0x4f400000,0x56391824 + .long 0xd9280000,0xe1003b28 + .long 0x00000000,0x00000000 + .long 0x63100000,0x6bc75e2d + .long 0xc6200000,0xd78ebc5a + .long 0x29300000,0x43561a88 + .long 0x8c400000,0xaf1d78b5 + .long 0xef500000,0x1ae4d6e2 + .long 0x52600000,0x86ac3510 + .long 0xb5700000,0xf273933d + .long 0x18800000,0x5e3af16b + .long 0x7b900000,0xca024f98 + .long 0x00000000,0x00000000 + .long 0xdea00000,0x35c9adc5 + .long 0xbd400000,0x6b935b8b + .long 0x9be00000,0xa15d0951 + .long 0x7a800000,0xd726b717 + .long 0x59200000,0x0cf064dd + .long 0x37c00000,0x42ba12a3 + .long 0x16600000,0x7883c069 + .long 0xf5000000,0xae4d6e2e + .long 0xd3a00000,0xe4171bf4 + .long 0x00000000,0x00000000 + .long 0xb2400000,0x19e0c9ba + .long 0x64800000,0x33c19375 + .long 0x16c00000,0x4da25d30 + .long 0xc9000000,0x678326ea + .long 0x7b400000,0x8163f0a5 + .long 0x2d800000,0x9b44ba60 + .long 0xdfc00000,0xb525841a + .long 0x92000000,0xcf064dd5 + .long 0x44400000,0xe8e71790 + .long 0x00000000,0x00000000 + .long 0xf6800000,0x02c7e14a + .long 0xed000000,0x058fc295 + .long 0xe3800000,0x0857a3e0 + .long 0xda000000,0x0b1f852b + .long 0xd0800000,0x0de76676 + .long 0xc7000000,0x10af47c1 + .long 0xbd800000,0x1377290c + .long 0xb4000000,0x163f0a57 + .long 0xaa800000,0x1906eba2 + .long 0x00000000,0x00000000 + .long 0xa1000000,0x1bcecced + .long 0x42000000,0x379d99db + .long 0xe3000000,0x536c66c8 + .long 0x84000000,0x6f3b33b6 + .long 0x25000000,0x8b0a00a4 + .long 0xc6000000,0xa6d8cd91 + .long 0x67000000,0xc2a79a7f + .long 0x08000000,0xde76676d + .long 0xa9000000,0xfa45345a + .long 0x00000000,0x00000000 + .long 0x4a000000,0x16140148 + .long 0x94000000,0x2c280290 + .long 0xde000000,0x423c03d8 + .long 0x28000000,0x58500521 + .long 0x72000000,0x6e640669 + .long 0xbc000000,0x847807b1 + .long 0x06000000,0x9a8c08fa + .long 0x50000000,0xb0a00a42 + .long 0x9a000000,0xc6b40b8a + .long 0x00000000,0x00000000 + .long 0xe4000000,0xdcc80cd2 + .long 0xc8000000,0xb99019a5 + .long 0xac000000,0x96582678 + .long 0x90000000,0x7320334b + .long 0x74000000,0x4fe8401e + .long 0x58000000,0x2cb04cf1 + .long 0x3c000000,0x097859c4 + .long 0x20000000,0xe6406697 + .long 0x04000000,0xc308736a + .long 0x00000000,0x00000000 + .long 0xe8000000,0x9fd0803c + .long 0xd0000000,0x3fa10079 + .long 0xb8000000,0xdf7180b6 + .long 0xa0000000,0x7f4200f3 + .long 0x88000000,0x1f128130 + .long 0x70000000,0xbee3016d + .long 0x58000000,0x5eb381aa + .long 0x40000000,0xfe8401e7 + .long 0x28000000,0x9e548224 + .long 0x00000000,0x00000000 + .long 0x10000000,0x3e250261 + .long 0x20000000,0x7c4a04c2 + .long 0x30000000,0xba6f0723 + .long 0x40000000,0xf8940984 + .long 0x50000000,0x36b90be5 + .long 0x60000000,0x74de0e46 + .long 0x70000000,0xb30310a7 + .long 0x80000000,0xf1281308 + .long 0x90000000,0x2f4d1569 + .long 0x00000000,0x00000000 + .long 0xa0000000,0x6d7217ca + .long 0x40000000,0xdae42f95 + .long 0xe0000000,0x4856475f + .long 0x80000000,0xb5c85f2a + .long 0x20000000,0x233a76f5 + .long 0xc0000000,0x90ac8ebf + .long 0x60000000,0xfe1ea68a + .long 0x00000000,0x6b90be55 + .long 0xa0000000,0xd902d61f + .long 0x00000000,0x00000000 + .long 0x40000000,0x4674edea + .long 0x80000000,0x8ce9dbd4 + .long 0xc0000000,0xd35ec9be + .long 0x00000000,0x19d3b7a9 + .long 0x40000000,0x6048a593 + .long 0x80000000,0xa6bd937d + .long 0xc0000000,0xed328167 + .long 0x00000000,0x33a76f52 + .long 0x40000000,0x7a1c5d3c + .long 0x00000000,0x00000000 + .long 0x80000000,0xc0914b26 + .long 0x00000000,0x8122964d + .long 0x80000000,0x41b3e173 + .long 0x00000000,0x02452c9a + .long 0x80000000,0xc2d677c0 + .long 0x00000000,0x8367c2e7 + .long 0x80000000,0x43f90e0d + .long 0x00000000,0x048a5934 + .long 0x80000000,0xc51ba45a + .long 0x00000000,0x00000000 + .long 0x00000000,0x85acef81 + .long 0x00000000,0x0b59df02 + .long 0x00000000,0x9106ce83 + .long 0x00000000,0x16b3be04 + .long 0x00000000,0x9c60ad85 + .long 0x00000000,0x220d9d06 + .long 0x00000000,0xa7ba8c87 + .long 0x00000000,0x2d677c08 + .long 0x00000000,0xb3146b89 + .long 0x00000000,0x00000000 + .long 0x00000000,0x38c15b0a + .long 0x00000000,0x7182b614 + .long 0x00000000,0xaa44111e + .long 0x00000000,0xe3056c28 + .long 0x00000000,0x1bc6c732 + .long 0x00000000,0x5488223c + .long 0x00000000,0x8d497d46 + .long 0x00000000,0xc60ad850 + .long 0x00000000,0xfecc335a + .long 0x00000000,0x00000000 + .long 0x00000000,0x378d8e64 + .long 0x00000000,0x6f1b1cc8 + .long 0x00000000,0xa6a8ab2c + .long 0x00000000,0xde363990 + .long 0x00000000,0x15c3c7f4 + .long 0x00000000,0x4d515658 + .long 0x00000000,0x84dee4bc + .long 0x00000000,0xbc6c7320 + .long 0x00000000,0xf3fa0184 + .long 0x00000000,0x00000000 + .long 0x00000000,0x2b878fe8 + .long 0x00000000,0x570f1fd0 + .long 0x00000000,0x8296afb8 + .long 0x00000000,0xae1e3fa0 + .long 0x00000000,0xd9a5cf88 + .long 0x00000000,0x052d5f70 + .long 0x00000000,0x30b4ef58 + .long 0x00000000,0x5c3c7f40 + .long 0x00000000,0x87c40f28 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb34b9f10 + .long 0x00000000,0x66973e20 + .long 0x00000000,0x19e2dd30 + .long 0x00000000,0xcd2e7c40 + .long 0x00000000,0x807a1b50 + .long 0x00000000,0x33c5ba60 + .long 0x00000000,0xe7115970 + .long 0x00000000,0x9a5cf880 + .long 0x00000000,0x4da89790 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00f436a0 + .long 0x00000000,0x01e86d40 + .long 0x00000000,0x02dca3e0 + .long 0x00000000,0x03d0da80 + .long 0x00000000,0x04c51120 + .long 0x00000000,0x05b947c0 + .long 0x00000000,0x06ad7e60 + .long 0x00000000,0x07a1b500 + .long 0x00000000,0x0895eba0 + .long 0x00000000,0x00000000 + .long 0x00000000,0x098a2240 + .long 0x00000000,0x13144480 + .long 0x00000000,0x1c9e66c0 + .long 0x00000000,0x26288900 + .long 0x00000000,0x2fb2ab40 + .long 0x00000000,0x393ccd80 + .long 0x00000000,0x42c6efc0 + .long 0x00000000,0x4c511200 + .long 0x00000000,0x55db3440 + .long 0x00000000,0x00000000 + .long 0x00000000,0x5f655680 + .long 0x00000000,0xbecaad00 + .long 0x00000000,0x1e300380 + .long 0x00000000,0x7d955a00 + .long 0x00000000,0xdcfab080 + .long 0x00000000,0x3c600700 + .long 0x00000000,0x9bc55d80 + .long 0x00000000,0xfb2ab400 + .long 0x00000000,0x5a900a80 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb9f56100 + .long 0x00000000,0x73eac200 + .long 0x00000000,0x2de02300 + .long 0x00000000,0xe7d58400 + .long 0x00000000,0xa1cae500 + .long 0x00000000,0x5bc04600 + .long 0x00000000,0x15b5a700 + .long 0x00000000,0xcfab0800 + .long 0x00000000,0x89a06900 + .long 0x00000000,0x00000000 + .long 0x00000000,0x4395ca00 + .long 0x00000000,0x872b9400 + .long 0x00000000,0xcac15e00 + .long 0x00000000,0x0e572800 + .long 0x00000000,0x51ecf200 + .long 0x00000000,0x9582bc00 + .long 0x00000000,0xd9188600 + .long 0x00000000,0x1cae5000 + .long 0x00000000,0x60441a00 + .long 0x00000000,0x00000000 + .long 0x00000000,0xa3d9e400 + .long 0x00000000,0x47b3c800 + .long 0x00000000,0xeb8dac00 + .long 0x00000000,0x8f679000 + .long 0x00000000,0x33417400 + .long 0x00000000,0xd71b5800 + .long 0x00000000,0x7af53c00 + .long 0x00000000,0x1ecf2000 + .long 0x00000000,0xc2a90400 + .long 0x00000000,0x00000000 + .long 0x00000000,0x6682e800 + .long 0x00000000,0xcd05d000 + .long 0x00000000,0x3388b800 + .long 0x00000000,0x9a0ba000 + .long 0x00000000,0x008e8800 + .long 0x00000000,0x67117000 + .long 0x00000000,0xcd945800 + .long 0x00000000,0x34174000 + .long 0x00000000,0x9a9a2800 + .long 0x00000000,0x00000000 + .long 0x00000000,0x011d1000 + .long 0x00000000,0x023a2000 + .long 0x00000000,0x03573000 + .long 0x00000000,0x04744000 + .long 0x00000000,0x05915000 + .long 0x00000000,0x06ae6000 + .long 0x00000000,0x07cb7000 + .long 0x00000000,0x08e88000 + .long 0x00000000,0x0a059000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x0b22a000 + .long 0x00000000,0x16454000 + .long 0x00000000,0x2167e000 + .long 0x00000000,0x2c8a8000 + .long 0x00000000,0x37ad2000 + .long 0x00000000,0x42cfc000 + .long 0x00000000,0x4df26000 + .long 0x00000000,0x59150000 + .long 0x00000000,0x6437a000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x6f5a4000 + .long 0x00000000,0xdeb48000 + .long 0x00000000,0x4e0ec000 + .long 0x00000000,0xbd690000 + .long 0x00000000,0x2cc34000 + .long 0x00000000,0x9c1d8000 + .long 0x00000000,0x0b77c000 + .long 0x00000000,0x7ad20000 + .long 0x00000000,0xea2c4000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x59868000 + .long 0x00000000,0xb30d0000 + .long 0x00000000,0x0c938000 + .long 0x00000000,0x661a0000 + .long 0x00000000,0xbfa08000 + .long 0x00000000,0x19270000 + .long 0x00000000,0x72ad8000 + .long 0x00000000,0xcc340000 + .long 0x00000000,0x25ba8000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x7f410000 + .long 0x00000000,0xfe820000 + .long 0x00000000,0x7dc30000 + .long 0x00000000,0xfd040000 + .long 0x00000000,0x7c450000 + .long 0x00000000,0xfb860000 + .long 0x00000000,0x7ac70000 + .long 0x00000000,0xfa080000 + .long 0x00000000,0x79490000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xf88a0000 + .long 0x00000000,0xf1140000 + .long 0x00000000,0xe99e0000 + .long 0x00000000,0xe2280000 + .long 0x00000000,0xdab20000 + .long 0x00000000,0xd33c0000 + .long 0x00000000,0xcbc60000 + .long 0x00000000,0xc4500000 + .long 0x00000000,0xbcda0000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb5640000 + .long 0x00000000,0x6ac80000 + .long 0x00000000,0x202c0000 + .long 0x00000000,0xd5900000 + .long 0x00000000,0x8af40000 + .long 0x00000000,0x40580000 + .long 0x00000000,0xf5bc0000 + .long 0x00000000,0xab200000 + .long 0x00000000,0x60840000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x15e80000 + .long 0x00000000,0x2bd00000 + .long 0x00000000,0x41b80000 + .long 0x00000000,0x57a00000 + .long 0x00000000,0x6d880000 + .long 0x00000000,0x83700000 + .long 0x00000000,0x99580000 + .long 0x00000000,0xaf400000 + .long 0x00000000,0xc5280000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xdb100000 + .long 0x00000000,0xb6200000 + .long 0x00000000,0x91300000 + .long 0x00000000,0x6c400000 + .long 0x00000000,0x47500000 + .long 0x00000000,0x22600000 + .long 0x00000000,0xfd700000 + .long 0x00000000,0xd8800000 + .long 0x00000000,0xb3900000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x8ea00000 + .long 0x00000000,0x1d400000 + .long 0x00000000,0xabe00000 + .long 0x00000000,0x3a800000 + .long 0x00000000,0xc9200000 + .long 0x00000000,0x57c00000 + .long 0x00000000,0xe6600000 + .long 0x00000000,0x75000000 + .long 0x00000000,0x03a00000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x92400000 + .long 0x00000000,0x24800000 + .long 0x00000000,0xb6c00000 + .long 0x00000000,0x49000000 + .long 0x00000000,0xdb400000 + .long 0x00000000,0x6d800000 + .long 0x00000000,0xffc00000 + .long 0x00000000,0x92000000 + .long 0x00000000,0x24400000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xb6800000 + .long 0x00000000,0x6d000000 + .long 0x00000000,0x23800000 + .long 0x00000000,0xda000000 + .long 0x00000000,0x90800000 + .long 0x00000000,0x47000000 + .long 0x00000000,0xfd800000 + .long 0x00000000,0xb4000000 + .long 0x00000000,0x6a800000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x21000000 + .long 0x00000000,0x42000000 + .long 0x00000000,0x63000000 + .long 0x00000000,0x84000000 + .long 0x00000000,0xa5000000 + .long 0x00000000,0xc6000000 + .long 0x00000000,0xe7000000 + .long 0x00000000,0x08000000 + .long 0x00000000,0x29000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x4a000000 + .long 0x00000000,0x94000000 + .long 0x00000000,0xde000000 + .long 0x00000000,0x28000000 + .long 0x00000000,0x72000000 + .long 0x00000000,0xbc000000 + .long 0x00000000,0x06000000 + .long 0x00000000,0x50000000 + .long 0x00000000,0x9a000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xe4000000 + .long 0x00000000,0xc8000000 + .long 0x00000000,0xac000000 + .long 0x00000000,0x90000000 + .long 0x00000000,0x74000000 + .long 0x00000000,0x58000000 + .long 0x00000000,0x3c000000 + .long 0x00000000,0x20000000 + .long 0x00000000,0x04000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xe8000000 + .long 0x00000000,0xd0000000 + .long 0x00000000,0xb8000000 + .long 0x00000000,0xa0000000 + .long 0x00000000,0x88000000 + .long 0x00000000,0x70000000 + .long 0x00000000,0x58000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x28000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x10000000 + .long 0x00000000,0x20000000 + .long 0x00000000,0x30000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x50000000 + .long 0x00000000,0x60000000 + .long 0x00000000,0x70000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x90000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xa0000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0xe0000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x20000000 + .long 0x00000000,0xc0000000 + .long 0x00000000,0x60000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0xa0000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0xc0000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0xc0000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x40000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x80000000 + .type _C_MUL_10_POW_I,@object + .size _C_MUL_10_POW_I,5120 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/llrint_gen.S b/external/sgx_libm/intel64/llrint_gen.S new file mode 100644 index 0000000000..521d61705a --- /dev/null +++ b/external/sgx_libm/intel64/llrint_gen.S @@ -0,0 +1,88 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llrint_gen.c" + .text +..TXTST0: +# -- Begin llrint + .text + .align 16,0x90 + .globl llrint +llrint: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_llrint.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + movq %rsp, %rbp + .cfi_def_cfa 6, 16 + .cfi_offset 6, -16 + subq $16, %rsp + movq $0, -16(%rbp) + movl $0, -8(%rbp) +..B1.2: + pushq %rax + xorpd %xmm1, %xmm1 + stmxcsr -8(%rbp) + andl $-2, -8(%rbp) + ldmxcsr -8(%rbp) + cvtsd2si %xmm0, %rax + addsd %xmm0, %xmm1 + movq %rax, -16(%rbp) + stmxcsr -8(%rbp) + popq %rax +..B1.3: + movq -16(%rbp), %rax + movq %rbp, %rsp + popq %rbp + .cfi_restore 6 + ret + .align 16,0x90 + .cfi_endproc + .type llrint,@function + .size llrint,.-llrint + .data +# -- End llrint + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/llrintf_gen.S b/external/sgx_libm/intel64/llrintf_gen.S new file mode 100644 index 0000000000..88e55452d0 --- /dev/null +++ b/external/sgx_libm/intel64/llrintf_gen.S @@ -0,0 +1,88 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llrintf_gen.c" + .text +..TXTST0: +# -- Begin llrintf + .text + .align 16,0x90 + .globl llrintf +llrintf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_llrintf.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + movq %rsp, %rbp + .cfi_def_cfa 6, 16 + .cfi_offset 6, -16 + subq $16, %rsp + movq $0, -16(%rbp) + movl $0, -8(%rbp) +..B1.2: + pushq %rax + xorpd %xmm1, %xmm1 + stmxcsr -8(%rbp) + andl $-2, -8(%rbp) + ldmxcsr -8(%rbp) + cvtss2si %xmm0, %rax + addss %xmm0, %xmm1 + movq %rax, -16(%rbp) + stmxcsr -8(%rbp) + popq %rax +..B1.3: + movq -16(%rbp), %rax + movq %rbp, %rsp + popq %rbp + .cfi_restore 6 + ret + .align 16,0x90 + .cfi_endproc + .type llrintf,@function + .size llrintf,.-llrintf + .data +# -- End llrintf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/llrintl.S b/external/sgx_libm/intel64/llrintl.S new file mode 100644 index 0000000000..b2e5f8e7a3 --- /dev/null +++ b/external/sgx_libm/intel64/llrintl.S @@ -0,0 +1,314 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llrintl.c" + .text +..TXTST0: +# -- Begin llrintl + .text + .align 16,0x90 + .globl llrintl +llrintl: +# parameter 1: 80 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_llrintl.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + subq $56, %rsp + .cfi_def_cfa_offset 80 + fldt 80(%rsp) + movzbl 89(%rsp), %edi + movzwl 88(%rsp), %r8d + andl $128, %edi + andl $32767, %r8d + shrl $7, %edi + fstpt 32(%rsp) + cmpl $16445, %r8d + jge ..B1.8 +..B1.2: + testl %r8d, %r8d + jne ..B1.6 +..B1.3: + cmpl $0, 84(%rsp) + jne ..B1.5 +..B1.4: + cmpl $0, 80(%rsp) + je ..B1.6 +..B1.5: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 8(%rsp) +..B1.6: + fldt 32(%rsp) + fistpq 16(%rsp) +..B1.7: + movq 16(%rsp), %rax + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.8: + cmpl $16447, %r8d + jge ..B1.21 +..B1.9: + movl %edi, %esi + movq $0x7fffffffffffffff, %rax + addq %rax, %rsi + cmpl $16446, %r8d + jge ..B1.16 +..B1.10: + fnstcw 4(%rsp) +..B1.11: + movl 80(%rsp), %ebx + movl %ebx, %ebp + movzwl 4(%rsp), %r11d + andl $1, %ebp + movl 84(%rsp), %ecx + andl $3072, %r11d + jne ..B1.13 +..B1.12: + movl %ebx, %eax + andl $3, %ebx + movl %ecx, %edx + movl $1, %r9d + cmpl $3, %ebx + movl $0, %ebx + cmovne %ebx, %r9d + shrl $1, %edx + shll $31, %ecx + shrl $1, %eax + orl %eax, %ecx + shlq $32, %rdx + orq %rcx, %rdx + addq %r9, %rdx + jmp ..B1.17 +..B1.13: + movl $1, %eax + xorl %edx, %edx + cmpl $3072, %r11d + cmove %eax, %edx + xorl %r10d, %r10d + cmpl $2048, %r11d + movl %eax, %r9d + cmove %eax, %r10d + testl %edi, %edi + cmove %edi, %r9d + andl %r9d, %r10d + xorl %r9d, %r9d + cmpl $1024, %r11d + cmove %eax, %r9d + xorl %r11d, %r11d + testl %edi, %edi + cmovne %r11d, %eax + orl %r10d, %edx + andl %eax, %r9d + orl %r9d, %edx + je ..B1.15 +..B1.14: + movl %ecx, %edx + shrl $1, %edx + shll $31, %ecx + shrl $1, %ebx + orl %ebx, %ecx + shlq $32, %rdx + orq %rcx, %rdx + jmp ..B1.17 +..B1.15: + movl %ecx, %edx + movl %ebx, %eax + shrl $1, %edx + shll $31, %ecx + shrl $1, %eax + orl %eax, %ecx + shlq $32, %rdx + orq %rcx, %rdx + andq $1, %rbx + addq %rbx, %rdx + jmp ..B1.17 +..B1.16: + movl 84(%rsp), %edx + xorl %ebp, %ebp + shlq $32, %rdx + movl 80(%rsp), %eax + orq %rax, %rdx +..B1.17: + movq %rdx, %rax + xorl %ecx, %ecx + negq %rax + testl %edi, %edi + cmove %rdx, %rax + cmpq %rdx, %rax + setae %cl + cmpq %rsi, %rdx + movl $0, %edx + setbe %dl + testl %edx, %ecx + je ..B1.21 +..B1.18: + testl %ebp, %ebp + je ..B1.20 +..B1.19: + lea _ones(%rip), %rdx + lea _small_value_64(%rip), %rcx + movq %rax, 16(%rsp) + movsd (%rdx), %xmm0 + addsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) +..B1.20: + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.21: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movq $0x8000000000000000, %rcx + cmpl $32767, %r8d + movq %rcx, 16(%rsp) + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 8(%rsp) + jne ..B1.24 +..B1.22: + cmpl $-2147483648, 84(%rsp) + jne ..B1.29 +..B1.23: + cmpl $0, 80(%rsp) + jne ..B1.29 +..B1.24: + fnstcw 2(%rsp) +..B1.25: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.26: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.27: + fldcw (%rsp) +..B1.28: + fldcw 2(%rsp) +..B1.29: + movq 16(%rsp), %rax + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type llrintl,@function + .size llrintl,.-llrintl + .data +# -- End llrintl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/llround_gen.S b/external/sgx_libm/intel64/llround_gen.S new file mode 100644 index 0000000000..9a4fc739ac --- /dev/null +++ b/external/sgx_libm/intel64/llround_gen.S @@ -0,0 +1,138 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llround_gen.c" + .text +..TXTST0: +# -- Begin llround + .text + .align 16,0x90 + .globl llround +llround: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_llround.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) + movq $0, 8(%rsp) + movl $0, 16(%rsp) +..B1.2: + stmxcsr 16(%rsp) + movsd (%rsp), %xmm1 + xorpd %xmm2, %xmm2 + andl $-2, 16(%rsp) + ldmxcsr 16(%rsp) + cvtsd2si %xmm1, %rax + addsd %xmm1, %xmm2 + movq %rax, 8(%rsp) + stmxcsr 16(%rsp) +..B1.3: + testb $1, 16(%rsp) + jne ..B1.6 +..B1.4: + pxor %xmm2, %xmm2 + movq 8(%rsp), %rax + cvtsi2sdq %rax, %xmm2 + movsd (%rsp), %xmm1 + movaps %xmm1, %xmm0 + subsd %xmm2, %xmm0 + andps .L_2il0floatpacket.1(%rip), %xmm0 + ucomisd .L_2il0floatpacket.0(%rip), %xmm0 + jp ..B1.5 + je ..B1.7 +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.6: + movq 8(%rsp), %rax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.7: + pxor %xmm0, %xmm0 + comisd %xmm0, %xmm1 + jbe ..B1.10 +..B1.8: + comisd %xmm2, %xmm1 + jbe ..B1.5 +..B1.9: + incq %rax + movq %rax, 8(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.10: + comisd %xmm1, %xmm2 + jbe ..B1.5 +..B1.11: + decq %rax + movq %rax, 8(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type llround,@function + .size llround,.-llround + .data +# -- End llround + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/llroundf_gen.S b/external/sgx_libm/intel64/llroundf_gen.S new file mode 100644 index 0000000000..9cf1b3a981 --- /dev/null +++ b/external/sgx_libm/intel64/llroundf_gen.S @@ -0,0 +1,138 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llroundf_gen.c" + .text +..TXTST0: +# -- Begin llroundf + .text + .align 16,0x90 + .globl llroundf +llroundf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_llroundf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movss %xmm0, 16(%rsp) + movq $0, (%rsp) + movl $0, 8(%rsp) +..B1.2: + stmxcsr 8(%rsp) + movsd 16(%rsp), %xmm1 + xorpd %xmm2, %xmm2 + andl $-2, 8(%rsp) + ldmxcsr 8(%rsp) + cvtss2si %xmm1, %rax + addss %xmm1, %xmm2 + movq %rax, (%rsp) + stmxcsr 8(%rsp) +..B1.3: + testb $1, 8(%rsp) + jne ..B1.6 +..B1.4: + pxor %xmm2, %xmm2 + movq (%rsp), %rax + cvtsi2ssq %rax, %xmm2 + movss 16(%rsp), %xmm1 + movaps %xmm1, %xmm0 + subss %xmm2, %xmm0 + andps .L_2il0floatpacket.1(%rip), %xmm0 + ucomiss .L_2il0floatpacket.0(%rip), %xmm0 + jp ..B1.5 + je ..B1.7 +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.6: + movq (%rsp), %rax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.7: + pxor %xmm0, %xmm0 + comiss %xmm0, %xmm1 + jbe ..B1.10 +..B1.8: + comiss %xmm2, %xmm1 + jbe ..B1.5 +..B1.9: + incq %rax + movq %rax, (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.10: + comiss %xmm1, %xmm2 + jbe ..B1.5 +..B1.11: + decq %rax + movq %rax, (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type llroundf,@function + .size llroundf,.-llroundf + .data +# -- End llroundf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x7fffffff,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +.L_2il0floatpacket.0: + .long 0x3f000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/llroundl.S b/external/sgx_libm/intel64/llroundl.S new file mode 100644 index 0000000000..5b390da096 --- /dev/null +++ b/external/sgx_libm/intel64/llroundl.S @@ -0,0 +1,236 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "llroundl.c" + .text +..TXTST0: +# -- Begin llroundl + .text + .align 16,0x90 + .globl llroundl +llroundl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_llroundl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %dl, %dl +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movb 57(%rsp), %r8b + lea _range(%rip), %rdi + andb $-128, %r8b + shrb $7, %r8b + movzbl %r8b, %eax + movq %rax, %rsi + shlq $4, %rsi + movzwl 56(%rsp), %r9d + andl $32767, %r9d + movzwl 8(%rsi,%rdi), %ecx + andl $32767, %ecx + cmpl %ecx, %r9d + jl ..B1.8 +..B1.4: + jne ..B1.16 +..B1.5: + movl 52(%rsp), %ecx + cmpl 4(%rsi,%rdi), %ecx + jb ..B1.8 +..B1.6: + jne ..B1.16 +..B1.7: + movl 48(%rsp), %ecx + cmpl (%rsi,%rdi), %ecx + ja ..B1.16 +..B1.8: + cmpl $16383, %r9d + jl ..B1.10 +..B1.9: + movl %r9d, %edi + negl %edi + movl 52(%rsp), %r10d + movl %r10d, %eax + movl 48(%rsp), %edx + movl %edx, %esi + shlq $32, %r10 + lea 29(%rdi), %ecx + shrl %cl, %eax + addl $62, %edi + shrl %cl, %esi + cmpl $16414, %r9d + movl %edi, %ecx + cmovl %eax, %esi + orq %rdx, %r10 + andl $1, %esi + shrq %cl, %r10 + addq %rsi, %r10 + movq %r10, %r9 + negq %r9 + testb %r8b, %r8b + cmovne %r9, %r10 + movq %r10, %rax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.10: + cmpl $16382, %r9d + je ..B1.23 +..B1.11: + testl %r9d, %r9d + jne ..B1.15 +..B1.12: + cmpl $0, 52(%rsp) + jne ..B1.14 +..B1.13: + cmpl $0, 48(%rsp) + je ..B1.15 +..B1.14: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rsp) +..B1.15: + xorl %eax, %eax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.16: + movzwl 34(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.20 +..B1.17: + orl $-64768, %ecx + movw %cx, 32(%rsp) +..B1.18: + fldcw 32(%rsp) +..B1.19: + movb $1, %dl +..B1.20: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + je ..B1.22 +..B1.21: + fldcw 34(%rsp) +..B1.22: + movq $0x8000000000000000, %rax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.23: + lea iones(%rip), %rdx + movslq (%rdx,%rax,4), %rax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type llroundl,@function + .size llroundl,.-llroundl + .data +# -- End llroundl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 2 +_range: + .word 65534 + .word 65535 + .word 65535 + .word 65535 + .word 16445 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49214 + .word 0 + .word 0 + .word 0 + .type _range,@object + .size _range,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log10_gen.S b/external/sgx_libm/intel64/log10_gen.S new file mode 100644 index 0000000000..24aa936736 --- /dev/null +++ b/external/sgx_libm/intel64/log10_gen.S @@ -0,0 +1,784 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10_gen.c" + .text +..TXTST0: +# -- Begin log10 + .text + .align 16,0x90 + .globl log10 +log10: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log10.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movl $1054736384, %ecx + movd %ecx, %xmm7 + xorpd %xmm3, %xmm3 + movl $30704, %edx + pinsrw $3, %edx, %xmm3 + movq %xmm0, %xmm1 + movl $32768, %edx + movd %edx, %xmm4 + movapd HIGHSIGMASK(%rip), %xmm5 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $16352, %ecx + psrlq $27, %xmm0 + movq LOG10_E(%rip), %xmm2 + psrld $2, %xmm0 + rcpps %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + mulss %xmm7, %xmm0 + orpd %xmm3, %xmm1 + lea L_tbl(%rip), %r11 + andpd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + subsd %xmm5, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm6, %xmm0 + andl $32752, %eax + subl %ecx, %eax + cvtsi2sd %eax, %xmm7 + mulpd %xmm0, %xmm5 + mulsd %xmm0, %xmm1 + movq log2(%rip), %xmm6 + movapd coeff(%rip), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd -1504(%r11,%rdx), %xmm0 + movapd 16+coeff(%rip), %xmm4 + addsd %xmm5, %xmm1 + movapd 32+coeff(%rip), %xmm2 + mulsd %xmm7, %xmm6 + pshufd $68, %xmm1, %xmm5 + mulsd 8+log2(%rip), %xmm7 + mulsd %xmm1, %xmm3 + addsd %xmm6, %xmm0 + mulpd %xmm5, %xmm4 + movq 8+LOG10_E(%rip), %xmm6 + mulpd %xmm5, %xmm5 + addpd %xmm2, %xmm4 + mulpd %xmm5, %xmm3 + pshufd $228, %xmm0, %xmm2 + addsd %xmm1, %xmm0 + mulsd %xmm1, %xmm4 + subsd %xmm0, %xmm2 + mulsd %xmm1, %xmm6 + addsd %xmm2, %xmm1 + pshufd $238, %xmm0, %xmm2 + mulsd %xmm5, %xmm5 + addsd %xmm2, %xmm7 + addsd %xmm6, %xmm1 + addpd %xmm3, %xmm4 + addsd %xmm7, %xmm1 + mulpd %xmm5, %xmm4 + addsd %xmm4, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movq (%rsp), %xmm0 + movq (%rsp), %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_2.0.2 + cmpl $16, %eax + jb .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + addsd %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + ja .L_2TAG_PACKET_4.0.2 + cmpl $0, %edx + ja .L_2TAG_PACKET_4.0.2 + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_3.0.2: + xorpd %xmm1, %xmm1 + addsd %xmm0, %xmm1 + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.2 + xorpd %xmm1, %xmm1 + movl $18416, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $18416, %ecx + psrlq $27, %xmm0 + movq LOG10_E(%rip), %xmm2 + psrld $2, %xmm0 + rcpps %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_5.0.2 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.2 +.L_2TAG_PACKET_6.0.2: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + movl $9, 16(%rsp) + jmp .L_2TAG_PACKET_8.0.2 +.L_2TAG_PACKET_7.0.2: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $8, 16(%rsp) +.L_2TAG_PACKET_8.0.2: + movq %xmm0, 8(%rsp) +..B1.3: + movq 8(%rsp), %xmm0 +.L_2TAG_PACKET_9.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type log10,@function + .size log10,.-log10 + .data +# -- End log10 + .section .rodata, "a" + .align 16 + .align 16 +HIGHSIGMASK: + .long 4160749568 + .long 4294967295 + .long 0 + .long 4294959104 + .type HIGHSIGMASK,@object + .size HIGHSIGMASK,16 + .align 16 +LOG10_E: + .long 0 + .long 1071366144 + .long 3207479560 + .long 1062894188 + .type LOG10_E,@object + .size LOG10_E,16 + .align 16 +L_tbl: + .long 1352628224 + .long 1070810131 + .long 521319256 + .long 1025503025 + .long 2150839296 + .long 1070801944 + .long 3329350096 + .long 3170190015 + .long 1360613376 + .long 1070793794 + .long 2024059075 + .long 1024991594 + .long 1875350528 + .long 1070785680 + .long 2163882141 + .long 3163564137 + .long 2312126464 + .long 1070777602 + .long 1975711076 + .long 1023674196 + .long 1306336256 + .long 1070769560 + .long 3524899523 + .long 3170508164 + .long 1806334976 + .long 1070761553 + .long 4254777025 + .long 1025238739 + .long 2483193856 + .long 1070753581 + .long 3800671317 + .long 3172916830 + .long 2025350144 + .long 1070745644 + .long 1731514745 + .long 1025501083 + .long 3433285632 + .long 1070737741 + .long 2551857336 + .long 3169662186 + .long 1134317568 + .long 1070729873 + .long 3426297655 + .long 3172637891 + .long 2457152512 + .long 1070722038 + .long 63549415 + .long 1025415416 + .long 1861803008 + .long 1070714237 + .long 1910171636 + .long 1023977580 + .long 2414140416 + .long 1070706469 + .long 4002514337 + .long 3170841618 + .long 2900726784 + .long 1070698734 + .long 3268064083 + .long 1022459609 + .long 2123517952 + .long 1070691032 + .long 1767031218 + .long 1022448156 + .long 3194569728 + .long 1070683362 + .long 3402332618 + .long 3171671160 + .long 650882048 + .long 1070675725 + .long 4146023905 + .long 3171023038 + .long 1928988672 + .long 1070668119 + .long 1438617867 + .long 1016360491 + .long 1594908672 + .long 1070660545 + .long 971389377 + .long 1024763979 + .long 2818746368 + .long 1070653002 + .long 3555925341 + .long 3172434821 + .long 194584576 + .long 1070645491 + .long 943919215 + .long 3172950063 + .long 1215096832 + .long 1070638010 + .long 2283358588 + .long 1022335098 + .long 501519360 + .long 1070630560 + .long 480904295 + .long 1024437959 + .long 1278266368 + .long 1070623140 + .long 2755806066 + .long 3172342012 + .long 2487812096 + .long 1070615750 + .long 2489653202 + .long 3172481099 + .long 3085451264 + .long 1070608390 + .long 3759184951 + .long 3172574892 + .long 2039090176 + .long 1070601060 + .long 1361176676 + .long 3172355319 + .long 953057280 + .long 1070591423 + .long 1176587546 + .long 3166422018 + .long 3370524672 + .long 1070576879 + .long 3669570051 + .long 1025376630 + .long 749742080 + .long 1070562394 + .long 707700964 + .long 3170814058 + .long 4008353792 + .long 1070547965 + .long 3247327652 + .long 1022431400 + .long 2612455424 + .long 1070533594 + .long 2453457344 + .long 3172322969 + .long 3230920704 + .long 1070519279 + .long 1296781801 + .long 1025115335 + .long 3965253632 + .long 1070505020 + .long 373075289 + .long 1017938528 + .long 2593157120 + .long 1070476669 + .long 1068054086 + .long 1021616576 + .long 925962240 + .long 1070448537 + .long 850121213 + .long 1023928989 + .long 1732556800 + .long 1070420620 + .long 1305206740 + .long 3172665570 + .long 3815630848 + .long 1070392915 + .long 192642943 + .long 3172699907 + .long 2001758208 + .long 1070365420 + .long 2820786683 + .long 1024704867 + .long 16746496 + .long 1070338131 + .long 1399573110 + .long 3171372773 + .long 1886492672 + .long 1070311044 + .long 3621428075 + .long 3172974358 + .long 3338196992 + .long 1070284157 + .long 3793882035 + .long 1025124701 + .long 381769728 + .long 1070257468 + .long 3877933342 + .long 3170195490 + .long 2186491904 + .long 1070230972 + .long 1838687089 + .long 1017927292 + .long 1008330752 + .long 1070204668 + .long 2228321664 + .long 1025352196 + .long 2247065600 + .long 1070178552 + .long 1413900906 + .long 3170902532 + .long 2964070400 + .long 1070152622 + .long 3590454629 + .long 1025016844 + .long 465154048 + .long 1070126876 + .long 2079688550 + .long 3172268183 + .long 883615744 + .long 1070101310 + .long 989244452 + .long 3171900485 + .long 1993768960 + .long 1070075922 + .long 1124327841 + .long 3172964992 + .long 1794471936 + .long 1070050710 + .long 1140575046 + .long 1022673726 + .long 2797932544 + .long 1070025671 + .long 1894836933 + .long 3172544059 + .long 3433797632 + .long 1070000803 + .long 3221831166 + .long 3171921685 + .long 2338371584 + .long 1069976104 + .long 3732461053 + .long 3164513518 + .long 2644013056 + .long 1069951571 + .long 2519460462 + .long 3172548740 + .long 3383814144 + .long 1069927202 + .long 2290997657 + .long 1025499649 + .long 3781380096 + .long 1069902995 + .long 380479405 + .long 1025184136 + .long 3245785088 + .long 1069878948 + .long 1096398261 + .long 3169885192 + .long 1366712320 + .long 1069855059 + .long 2218343715 + .long 3170281628 + .long 2204717056 + .long 1069831325 + .long 2668334011 + .long 1025264524 + .long 1401772032 + .long 1069807745 + .long 4103993159 + .long 1022925721 + .long 3356721152 + .long 1069784316 + .long 3573790772 + .long 3172186527 + .long 4041148416 + .long 1069761037 + .long 4027691910 + .long 3171276990 + .long 3880151040 + .long 1069737906 + .long 4087118786 + .long 3172710734 + .long 3453364224 + .long 1069714921 + .long 99014299 + .long 3172003077 + .long 3491092480 + .long 1069692080 + .long 3801836701 + .long 3172989287 + .long 575580160 + .long 1069669382 + .long 1920406012 + .long 3170874125 + .long 22282240 + .long 1069646824 + .long 964193370 + .long 1019363159 + .long 2991429632 + .long 1069624404 + .long 3372589890 + .long 1023425053 + .long 2189645824 + .long 1069602122 + .long 2610503872 + .long 1023652442 + .long 3341467648 + .long 1069579975 + .long 1190292004 + .long 1022425665 + .long 3711293440 + .long 1069557962 + .long 1104795356 + .long 1023625829 + .long 1380401152 + .long 1069524644 + .long 1156998217 + .long 1025100499 + .long 765710336 + .long 1069481144 + .long 1736649113 + .long 1024999439 + .long 849412096 + .long 1069437902 + .long 2618178330 + .long 3170853629 + .long 1433104384 + .long 1069394915 + .long 43477267 + .long 3170378811 + .long 2548596736 + .long 1069352180 + .long 3967367063 + .long 1025246584 + .long 157577216 + .long 1069309695 + .long 100402533 + .long 3172825502 + .long 3326238720 + .long 1069267455 + .long 1176892909 + .long 1025464099 + .long 4155494400 + .long 1069225459 + .long 3713707617 + .long 3172630046 + .long 3545804800 + .long 1069183704 + .long 857007315 + .long 1024965777 + .long 2602520576 + .long 1069142187 + .long 2588758347 + .long 1022463131 + .long 2631196672 + .long 1069100905 + .long 2118424235 + .long 1022490989 + .long 838135808 + .long 1069059856 + .long 4117002727 + .long 1024874520 + .long 3210903552 + .long 1069019036 + .long 650070125 + .long 3172012966 + .long 3039211520 + .long 1068978444 + .long 438055812 + .long 1017743757 + .long 2385633280 + .long 1068938077 + .long 3011990369 + .long 3171312044 + .long 3491618816 + .long 1068897932 + .long 712813818 + .long 3172720400 + .long 183644160 + .long 1068858008 + .long 4287006742 + .long 1022379728 + .long 3639214080 + .long 1068818300 + .long 353762279 + .long 3172980009 + .long 3728416768 + .long 1068778808 + .long 1851367730 + .long 1025486574 + .long 3370094592 + .long 1068739529 + .long 4046594913 + .long 3172567047 + .long 1348407296 + .long 1068700461 + .long 143189675 + .long 1025397632 + .long 899403776 + .long 1068661601 + .long 3753687842 + .long 3170772772 + .long 1117708288 + .long 1068622947 + .long 1857340812 + .long 3170782678 + .long 1248276480 + .long 1068584497 + .long 1289858203 + .long 1025222289 + .long 683237376 + .long 1068546249 + .long 2356679608 + .long 3171629170 + .long 3253764096 + .long 1068508200 + .long 3267136556 + .long 1018554987 + .long 94478336 + .long 1068441756 + .long 1927868814 + .long 3169378180 + .long 3233144832 + .long 1068366445 + .long 2682188854 + .long 1023964004 + .long 2940297216 + .long 1068291522 + .long 275301289 + .long 1023944679 + .long 3677708288 + .long 1068216982 + .long 302658771 + .long 1024465567 + .long 1576968192 + .long 1068142822 + .long 3672035940 + .long 3172254610 + .long 1614069760 + .long 1068069037 + .long 480052905 + .long 3172692062 + .long 424435712 + .long 1067995624 + .long 2207869657 + .long 3170965436 + .long 3477782528 + .long 1067922578 + .long 2980661858 + .long 3164990018 + .long 3598401536 + .long 1067849897 + .long 1974393034 + .long 3171357083 + .long 2435235840 + .long 1067777577 + .long 1385289011 + .long 1024615823 + .long 1867333632 + .long 1067705614 + .long 3442236633 + .long 1025334384 + .long 3999301632 + .long 1067634004 + .long 3506472073 + .long 1025132546 + .long 2566971392 + .long 1067562745 + .long 1425757592 + .long 3172358463 + .long 112943104 + .long 1067491833 + .long 1693407156 + .long 3172426603 + .long 3079929856 + .long 1067392159 + .long 3999942455 + .long 1018549369 + .long 2443837440 + .long 1067251701 + .long 974534460 + .long 1023963412 + .long 359366656 + .long 1067111917 + .long 2204915018 + .long 1013514416 + .long 3564519424 + .long 1066972799 + .long 3977441659 + .long 3170879860 + .long 2011086848 + .long 1066834343 + .long 590145514 + .long 1025390011 + .long 3216982016 + .long 1066696541 + .long 3629120110 + .long 1024330313 + .long 2194128896 + .long 1066559388 + .long 2367098512 + .long 3172260338 + .long 2916220928 + .long 1066422877 + .long 2262431886 + .long 1021229446 + .long 2263941120 + .long 1066172214 + .long 3118507287 + .long 1021484970 + .long 3076292608 + .long 1065901726 + .long 1411737803 + .long 3172957147 + .long 1186136064 + .long 1065632488 + .long 3109349337 + .long 1025397383 + .long 3085303808 + .long 1065364487 + .long 584715031 + .long 3172596519 + .long 1821048832 + .long 1064842211 + .long 2182246895 + .long 3172536214 + .long 697368576 + .long 1064311094 + .long 3157561765 + .long 3172716357 + .long 894042112 + .long 1063260131 + .long 3237958154 + .long 3172587292 + .long 0 + .long 0 + .long 0 + .long 0 + .type L_tbl,@object + .size L_tbl,2064 + .align 16 +log2: + .long 1352628224 + .long 1066615827 + .long 521319256 + .long 1021308721 + .type log2,@object + .size log2,16 + .align 16 +coeff: + .long 3248877870 + .long 1077250164 + .long 1691676429 + .long 3221787401 + .long 945132465 + .long 3223701783 + .long 3700831335 + .long 1073506818 + .long 2141010593 + .long 1075227551 + .long 3698831637 + .long 3220339442 + .type coeff,@object + .size coeff,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log10f_gen.S b/external/sgx_libm/intel64/log10f_gen.S new file mode 100644 index 0000000000..7bf4ceb71f --- /dev/null +++ b/external/sgx_libm/intel64/log10f_gen.S @@ -0,0 +1,285 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10f_gen.c" + .text +..TXTST0: +# -- Begin log10f + .text + .align 16,0x90 + .globl log10f +log10f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log10f.1: +..L2: + + movd %xmm0, %edi + movss %xmm0, -8(%rsp) + cmpl $2139095040, %edi + jae ..B1.14 +..B1.2: + lea -1065222144(%rdi), %eax + cmpl $196608, %eax + jae ..B1.7 +..B1.3: + cmpl $1065353216, %edi + jne ..B1.5 +..B1.4: + pxor %xmm3, %xmm3 + jmp ..B1.6 +..B1.5: + movss -8(%rsp), %xmm0 + lea 40+_Q(%rip), %rax + lea 32+_Q(%rip), %rsi + addss .L_2il0floatpacket.0(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + movaps %xmm0, %xmm1 + lea 24+_Q(%rip), %rdx + movsd (%rax), %xmm3 + lea 16+_Q(%rip), %rdi + movsd (%rsi), %xmm2 + lea 8+_Q(%rip), %rcx + lea _Q(%rip), %r8 + mulsd %xmm0, %xmm1 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm3 + addsd (%rdi), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm3 + addsd (%r8), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm0, %xmm2 + addsd %xmm2, %xmm3 + cvtsd2ss %xmm3, %xmm3 +..B1.6: + movaps %xmm3, %xmm0 + ret +..B1.7: + movl %edi, %eax + movl %edi, %esi + shrl $23, %eax + andl $8388607, %esi + addl $-127, %eax + movl %esi, -8(%rsp) + cmpl $8388608, %edi + jae ..B1.10 +..B1.8: + testl %edi, %edi + je ..B1.22 +..B1.9: + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + movd %xmm0, %esi + movss %xmm0, -8(%rsp) + movl %esi, %eax + movl %esi, %edi + shrl $23, %eax + addl $-152, %eax +..B1.10: + imull $21846, %eax, %edx + sarl $15, %edx + cmpl $34, %eax + ja ..B1.13 +..B1.11: + andl $-2, %edx + lea _exact_values(%rip), %rcx + movslq %edx, %rdx + cmpl (%rcx,%rdx,4), %edi + jne ..B1.13 +..B1.12: + movss 4(%rcx,%rdx,4), %xmm0 + ret +..B1.13: + shrl $15, %edi + orl $1065353216, %esi + movzbl %dil, %r8d + pxor %xmm2, %xmm2 + movl %esi, -8(%rsp) + pxor %xmm0, %xmm0 + movq __libm_rcp_table_256@GOTPCREL(%rip), %rsi + lea 16+_P(%rip), %rdx + cvtss2sd -8(%rsp), %xmm2 + cvtss2sd (%rsi,%r8,4), %xmm0 + mulsd %xmm0, %xmm2 + lea 8+_P(%rip), %rcx + movsd (%rdx), %xmm0 + lea _P(%rip), %r9 + movq __libm_logf_table_256@GOTPCREL(%rip), %rdi + pxor %xmm3, %xmm3 + cvtsi2sd %eax, %xmm3 + addsd .L_2il0floatpacket.2(%rip), %xmm2 + mulsd %xmm2, %xmm0 + lea _LOG102(%rip), %rax + mulsd (%rax), %xmm3 + addsd (%rcx), %xmm0 + mulsd %xmm2, %xmm0 + movsd (%rdi,%r8,8), %xmm1 + mulsd %xmm2, %xmm0 + addsd %xmm1, %xmm2 + mulsd (%r9), %xmm2 + addsd %xmm2, %xmm0 + addsd %xmm3, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.14: + movl %edi, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.20 +..B1.15: + testl $-2147483648, %edi + je ..B1.20 +..B1.16: + testl %eax, %eax + jne ..B1.18 +..B1.17: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret +..B1.18: + movss .L_2il0floatpacket.3(%rip), %xmm1 + pxor %xmm0, %xmm0 + mulss %xmm1, %xmm0 +..B1.19: + ret +..B1.20: + movss -8(%rsp), %xmm0 + ret +..B1.22: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type log10f,@function + .size log10f,.-log10f + .data +# -- End log10f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x7f800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_Q: + .long 354870542 + .long 1071369083 + .long 354784454 + .long 3217804155 + .long 1678399179 + .long 1069713319 + .long 656012052 + .long 3216755581 + .long 509767151 + .long 1068907598 + .long 3001134819 + .long 3216124527 + .type _Q,@object + .size _Q,48 + .align 4 +_exact_values: + .long 4294967295 + .long 4294967295 + .long 1092616192 + .long 1065353216 + .long 1120403456 + .long 1073741824 + .long 1148846080 + .long 1077936128 + .long 1176256512 + .long 1082130432 + .long 1203982336 + .long 1084227584 + .long 1232348160 + .long 1086324736 + .long 1259902592 + .long 1088421888 + .long 1287568416 + .long 1090519040 + .long 1315859240 + .long 1091567616 + .long 4294967295 + .long 4294967295 + .long 1343554297 + .long 1092616192 + .type _exact_values,@object + .size _exact_values,96 + .align 4 +_P: + .long 354870542 + .long 1071369083 + .long 1669757279 + .long 3217804158 + .long 3421439185 + .long 1069713323 + .type _P,@object + .size _P,24 + .align 4 +_LOG102: + .long 1352628735 + .long 1070810131 + .type _LOG102,@object + .size _LOG102,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log10l.S b/external/sgx_libm/intel64/log10l.S new file mode 100644 index 0000000000..d8604ea777 --- /dev/null +++ b/external/sgx_libm/intel64/log10l.S @@ -0,0 +1,1052 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10l.c" + .text +..TXTST0: +# -- Begin log10l + .text + .align 16,0x90 + .globl log10l +log10l: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_log10l.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %r8b, %r8b +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzbl 57(%rsp), %r9d + andl $128, %r9d + shrl $7, %r9d + movzwl 56(%rsp), %esi + movl %esi, %edi + movl %r9d, %edx + andl $32767, %edi + shll $15, %edx + movl 52(%rsp), %ecx + orl %edi, %edx + movl %ecx, %eax + shll $16, %edx + shrl $16, %eax + orl %eax, %edx + cmpl $2147450880, %edx + jae ..B1.29 +..B1.4: + addl $-1073676224, %edx + cmpl $32863, %edx + ja ..B1.13 +..B1.5: + cmpl $16383, %edi + je ..B1.38 +..B1.6: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.10 +..B1.7: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.8: + fldcw 24(%rsp) +..B1.9: + movb $1, %r8b +..B1.10: + fldt 48(%rsp) + lea 8+_ones(%rip), %rax + lea 112+_P(%rip), %rcx + lea 80+_P(%rip), %rsi + lea 48+_P(%rip), %rdi + lea 96+_P(%rip), %r10 + lea _TWO_32H(%rip), %rdx + lea 64+_P(%rip), %r11 + lea 16+_P(%rip), %r9 + testb %r8b, %r8b + fldt (%rcx) + lea 128+_P(%rip), %rcx + fldt (%rsi) + fldl (%rdx) + lea _P(%rip), %rdx + fldt (%rdi) + fxch %st(4) + faddl (%rax) + lea 32+_P(%rip), %rax + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fld %st(1) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(1) + fsub %st(3), %st + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r10) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt (%rdx) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt (%rcx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.12 +..B1.11: + fldcw 26(%rsp) +..B1.12: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.13: + cmpl $16383, %edi + jl ..B1.19 +..B1.14: + cmpl $16471, %edi + jge ..B1.19 +..B1.15: + movl $1431655766, %eax + lea -16383(%rdi), %r9d + imull %r9d + sarl $31, %r9d + subl %r9d, %edx + lea _exact_values(%rip), %r9 + addl %edx, %edx + movslq %edx, %rdx + shlq $4, %rdx + movzwl 8(%rdx,%r9), %r10d + andl $32767, %r10d + cmpl %r10d, %edi + jne ..B1.19 +..B1.16: + cmpl 4(%rdx,%r9), %ecx + jne ..B1.19 +..B1.17: + movl 48(%rsp), %eax + cmpl (%rdx,%r9), %eax + jne ..B1.19 +..B1.18: + fldt 16(%r9,%rdx) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.19: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.23 +..B1.20: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.21: + fldcw 24(%rsp) +..B1.22: + movzwl 56(%rsp), %esi + movl %esi, %edi + movb $1, %r8b + andl $32767, %edi +..B1.23: + movl $-16383, %eax + testl %edi, %edi + jne ..B1.26 +..B1.24: + fldt 48(%rsp) + lea _TWO_75(%rip), %rax + lea _zeros(%rip), %rdx + fmull (%rax) + movl $-16458, %eax + fstpt 48(%rsp) + fldt 48(%rsp) + fldl (%rdx) + movsd (%rdx), %xmm0 + fucomip %st(1), %st + fstp %st(0) + jp ..B1.25 + je ..B1.40 +..B1.25: + movzwl 56(%rsp), %esi + movl %esi, %edi + andl $32767, %edi +..B1.26: + lea _TWO_32H(%rip), %rcx + andl $-32768, %esi + orl $-49153, %esi + addl %eax, %edi + movw %si, 56(%rsp) + lea 8+_ones(%rip), %r9 + fldt 48(%rsp) + lea 112+_P(%rip), %r10 + fld %st(0) + lea 80+_P(%rip), %r11 + fldl (%rcx) + lea 16+_P(%rip), %rcx + movl 52(%rsp), %edx + fadd %st, %st(1) + shrl $23, %edx + fsubrp %st, %st(1) + movzbl %dl, %eax + lea 48+_P(%rip), %rdx + movq __libm_rcp_table_256@GOTPCREL(%rip), %rsi + fsubr %st, %st(1) + flds (%rsi,%rax,4) + lea 96+_P(%rip), %rsi + fmul %st, %st(1) + fmulp %st, %st(2) + faddl (%r9) + fld %st(0) + lea 64+_P(%rip), %r9 + movl %edi, 16(%rsp) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r10) + lea 32+_P(%rip), %r10 + fmul %st(2), %st + fldt (%r11) + lea _P(%rip), %r11 + shlq $4, %rax + faddp %st, %st(1) + fmul %st(2), %st + testb %r8b, %r8b + fldt (%rdx) + lea 128+_P(%rip), %rdx + movq __libm_log10l_table_256@GOTPCREL(%rip), %rdi + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r11) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%rdx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(1) + fildl 16(%rsp) + fldt .L_2il0floatpacket.0(%rip) + fmul %st(1), %st + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(2) + faddl 8(%rdi,%rax) + faddp %st, %st(3) + faddl (%rax,%rdi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.28 +..B1.27: + fldcw 26(%rsp) +..B1.28: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.29: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.33 +..B1.30: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.31: + fldcw 24(%rsp) +..B1.32: + movzbl 57(%rsp), %r9d + movb $1, %r8b + andl $128, %r9d + shrl $7, %r9d +..B1.33: + testl %r9d, %r9d + jne ..B1.43 +..B1.34: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.35: + testb %r8b, %r8b + je ..B1.37 +..B1.36: + fldcw 26(%rsp) +..B1.37: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.38: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.6 +..B1.39: + lea _zeros(%rip), %rax + fldl (%rax) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.40: + lea 8+_ones(%rip), %rax + testb %r8b, %r8b + movsd (%rax), %xmm1 + divsd %xmm0, %xmm1 + je ..B1.42 +..B1.41: + fldcw 26(%rsp) +..B1.42: + movsd %xmm1, 16(%rsp) + fldl 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.43: + movzwl 56(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.45 +..B1.44: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.34 + jmp ..B1.48 +..B1.45: + testl %eax, %eax + jne ..B1.48 +..B1.46: + cmpq $0, 48(%rsp) + jne ..B1.48 +..B1.47: + lea 8+_ones(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + divsd (%rdx), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + jmp ..B1.35 +..B1.48: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + jmp ..B1.35 + .align 16,0x90 + .cfi_endproc + .type log10l,@function + .size log10l,.-log10l + .data +# -- End log10l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xc8,0xd4,0x0e,0xee,0x0c,0x01,0x86,0xd8,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x85,0x9a,0x20,0x9a,0xfd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_P: + .word 23339 + .word 38197 + .word 10353 + .word 43319 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 29077 + .word 14120 + .word 55465 + .word 56923 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 63176 + .word 31258 + .word 15131 + .word 37949 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 29577 + .word 14120 + .word 55465 + .word 56923 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 61319 + .word 34328 + .word 5050 + .word 45539 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 52415 + .word 26390 + .word 15131 + .word 37949 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 16765 + .word 7621 + .word 20590 + .word 65056 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 14162 + .word 11829 + .word 26041 + .word 56924 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 56923 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,144 + .align 2 +_exact_values: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40000 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50000 + .word 16399 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62500 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39062 + .word 16406 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8192 + .word 48828 + .word 16409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10240 + .word 61035 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63744 + .word 38146 + .word 16416 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46912 + .word 47683 + .word 16419 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45056 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42256 + .word 59604 + .word 16422 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59178 + .word 37252 + .word 16426 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53248 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8436 + .word 46566 + .word 16429 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57344 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 43313 + .word 58207 + .word 16432 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61440 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1024 + .word 51647 + .word 36379 + .word 16436 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50432 + .word 48174 + .word 45474 + .word 16439 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30272 + .word 27450 + .word 56843 + .word 16442 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35304 + .word 8964 + .word 35527 + .word 16446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38912 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44130 + .word 60357 + .word 44408 + .word 16449 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6010 + .word 9911 + .word 55511 + .word 16452 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 36864 + .word 28332 + .word 30770 + .word 34694 + .word 16456 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45056 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 46080 + .word 2647 + .word 5695 + .word 43368 + .word 16459 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47104 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 41216 + .word 52461 + .word 7118 + .word 54210 + .word 16462 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 33952 + .word 16404 + .word 20833 + .word 33881 + .word 16466 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51200 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 42440 + .word 36889 + .word 42425 + .word 42351 + .word 16469 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53248 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 3898 + .word 62496 + .word 36647 + .word 52939 + .word 16472 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 16387 + .word 0 + .word 0 + .word 0 + .type _exact_values,@object + .size _exact_values,960 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log10l_table.S b/external/sgx_libm/intel64/log10l_table.S new file mode 100644 index 0000000000..4574b6e180 --- /dev/null +++ b/external/sgx_libm/intel64/log10l_table.S @@ -0,0 +1,559 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log10l_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_log10l_table_256 +__libm_log10l_table_256: + .long 0x45bfc000,0x3f4bd270 + .long 0xeb5a6902,0x3cc024b0 + .long 0x793a4000,0x3f64e84e + .long 0xbdc59429,0x3ccd29dc + .long 0x5ab86000,0x3f717508 + .long 0xf6df9894,0xbc6f70c9 + .long 0x9d914000,0x3f787cff + .long 0xeb029384,0x3cde94f0 + .long 0x72b8c000,0x3f7ea9d3 + .long 0x75a2920a,0xbd001bfa + .long 0x95daa000,0x3f82df9d + .long 0x77634a76,0xbcf3c705 + .long 0x72d64000,0x3f866df1 + .long 0x93609ef4,0xbcf1a833 + .long 0xef5ec000,0x3f898d79 + .long 0x7a519e99,0x3d16f7e1 + .long 0xf3f94000,0x3f8d22ad + .long 0xa10c1504,0x3d079c92 + .long 0x1d30c000,0x3f902423 + .long 0x2dcf9263,0x3cecc021 + .long 0x98898000,0x3f91f23a + .long 0x21ad4280,0xbce5b1e0 + .long 0x7b818000,0x3f93881a + .long 0x9c5111b1,0x3d0f3cbd + .long 0x1e75a000,0x3f951f6e + .long 0xaf539251,0xbcdcad0e + .long 0xe7adc000,0x3f96f2bc + .long 0x7385f0a6,0x3cf6d084 + .long 0x2cdf4000,0x3f988d36 + .long 0x41385083,0xbd04c3af + .long 0xaf014000,0x3f9a292b + .long 0x3724b270,0xbd2b3f0c + .long 0x3117c000,0x3f9bc6a0 + .long 0x667331b5,0x3d25cb86 + .long 0x7de3c000,0x3f9d6596 + .long 0x31612f8e,0xbd14f74b + .long 0x67fc4000,0x3f9f0611 + .long 0x143b6bad,0xbd0c30f3 + .long 0xe4f78000,0x3fa05409 + .long 0x5b985713,0x3ce9bb8e + .long 0x432ea000,0x3fa125d0 + .long 0x68a0dc47,0x3cf06e09 + .long 0x440d2000,0x3fa1f85d + .long 0x507c1dd7,0x3d133627 + .long 0x57496000,0x3fa2ad75 + .long 0x7f319445,0x3ce7c850 + .long 0x2a00e000,0x3fa38177 + .long 0x9d2bb1a5,0x3d080fdc + .long 0xe165a000,0x3fa45643 + .long 0xf742c845,0x3d0c2a9f + .long 0x03446000,0x3fa52bdd + .long 0x5036c404,0x3d25b862 + .long 0x6b7ec000,0x3fa5e396 + .long 0x23196824,0xbd36b572 + .long 0x47c5c000,0x3fa6baaf + .long 0x6d3e4a28,0xbd1b7614 + .long 0xe8c4c000,0x3fa773b3 + .long 0xf794b354,0x3d39e3f5 + .long 0xebee8000,0x3fa84c51 + .long 0x2cb6638b,0x3d1a2aaa + .long 0x786fc000,0x3fa906a6 + .long 0xdfffb059,0x3cecab9f + .long 0xabf00000,0x3fa9c197 + .long 0x3d6e4566,0x3d1badcf + .long 0x71218000,0x3faa9c78 + .long 0xcb03a47d,0x3d21f757 + .long 0x9c8d4000,0x3fab58c0 + .long 0x3b0fe4fe,0x3d31be11 + .long 0xbcdd4000,0x3fac15a8 + .long 0xb6d13ff4,0x3d3dbf2d + .long 0xe2c28000,0x3facd331 + .long 0x77fafd44,0x3d267bed + .long 0xd766c000,0x3fadb11e + .long 0x23c3e44c,0xbd240bcd + .long 0x9346c000,0x3fae7008 + .long 0xd4c5edca,0xbd2619d1 + .long 0xc6754000,0x3faf2f96 + .long 0xb182cded,0x3d15dbd8 + .long 0x8d450000,0x3fafefca + .long 0xcc1beb8a,0x3d2fd5cf + .long 0x83764000,0x3fb05852 + .long 0x779b9fcf,0x3cf77c3e + .long 0xaac7c000,0x3fb0b913 + .long 0xbc7f44a6,0x3d33a6ff + .long 0x4f258000,0x3fb11a29 + .long 0xb8d25b3a,0xbd360a72 + .long 0xa2698000,0x3fb16b51 + .long 0x7904e2d7,0xbd376f39 + .long 0xadacc000,0x3fb1cd03 + .long 0x084a2298,0x3d217bee + .long 0xdd776000,0x3fb22f0b + .long 0xa204f9bf,0xbd3a0ad1 + .long 0xca38e000,0x3fb2916a + .long 0xffeb8381,0xbd2c3074 + .long 0x0df76000,0x3fb2f421 + .long 0x0d443b33,0x3d18f3ef + .long 0xc3c48000,0x3fb346a6 + .long 0x15025ea7,0x3d306599 + .long 0xbc606000,0x3fb3a9fe + .long 0xa7db519f,0xbd27eca8 + .long 0x10a3c000,0x3fb3fd0c + .long 0xb6f7db46,0xbd35abc5 + .long 0xd3540000,0x3fb46107 + .long 0x813a4964,0x3d25039a + .long 0xd1696000,0x3fb4c55d + .long 0x64286476,0x3d1ff9d8 + .long 0x330c0000,0x3fb51940 + .long 0x2c505825,0x3ca5ed92 + .long 0x0ee70000,0x3fb56d62 + .long 0x06e88a06,0x3d315e58 + .long 0xcf260000,0x3fb5d2ab + .long 0xd90fb16b,0x3d378d89 + .long 0xa5dec000,0x3fb6275a + .long 0x405920cd,0xbcdfa0db + .long 0xaf26c000,0x3fb68d4e + .long 0x1d3da9e2,0x3d37ee53 + .long 0x5c54c000,0x3fb6e28c + .long 0x9d9b5afe,0xbd3d72f7 + .long 0x9665c000,0x3fb7380b + .long 0xb00e89cf,0xbd20707b + .long 0xc2790000,0x3fb78dcc + .long 0x9a7343d9,0xbd37a4ff + .long 0x2cf28000,0x3fb7f50c + .long 0xfacefdb0,0xbd45431c + .long 0xd5eb0000,0x3fb84b5f + .long 0x2b4f09ce,0xbd302851 + .long 0xbab2c000,0x3fb8a1f6 + .long 0x11e41a3e,0xbd2bb389 + .long 0x44558000,0x3fb8f8d1 + .long 0xbf96339c,0xbd1083fd + .long 0xdcd64000,0x3fb94fef + .long 0xe07d5241,0xbd4136f4 + .long 0xef314000,0x3fb9a752 + .long 0xa5e3191a,0x3d40a49e + .long 0xe7614000,0x3fb9fefa + .long 0xa1f54e0a,0xbd40902f + .long 0x325f4000,0x3fba56e8 + .long 0xec5e03cc,0x3d3c86ee + .long 0x3e298000,0x3fbaaf1b + .long 0xcb09696b,0xbd1130fe + .long 0x79c34000,0x3fbb0794 + .long 0x628b8546,0x3d495642 + .long 0x553b0000,0x3fbb6054 + .long 0xa20d3394,0x3d32f77b + .long 0x41ab8000,0x3fbbb95b + .long 0x61433066,0xbd418d39 + .long 0xb1400000,0x3fbc12a9 + .long 0xd5882f66,0xbd3f86c6 + .long 0x17380000,0x3fbc6c40 + .long 0x219900ae,0x3d45f518 + .long 0xba424000,0x3fbcb41f + .long 0x6665a718,0x3d443661 + .long 0xce734000,0x3fbd0e38 + .long 0xd0afc15d,0xbd1b04a7 + .long 0x21940000,0x3fbd689b + .long 0x80039681,0xbd2d9a08 + .long 0x2b1d0000,0x3fbdc347 + .long 0xd102c576,0x3d442ff9 + .long 0x300d8000,0x3fbe0c06 + .long 0xe391d6b6,0xbd46ba4d + .long 0x190e4000,0x3fbe6738 + .long 0x23d01c6b,0xbd1ad0ad + .long 0x0d208000,0x3fbec2b5 + .long 0xb6656ff4,0x3d2b355d + .long 0x2b938000,0x3fbf0c1c + .long 0x4980111b,0xbd37d822 + .long 0x6c9cc000,0x3fbf6821 + .long 0xd0891bcc,0x3d1c9a3b + .long 0x38184000,0x3fbfb1f6 + .long 0x16ca77f0,0x3d36f3d3 + .long 0xaf4ce000,0x3fc00742 + .long 0xee8b5696,0x3d27e0ee + .long 0x90650000,0x3fc02c64 + .long 0xe445f2fd,0x3d42d27a + .long 0xe63e2000,0x3fc05af1 + .long 0xa16f7336,0xbd4c4b92 + .long 0xea724000,0x3fc0804b + .long 0xb736f965,0xbd255d7c + .long 0xd6712000,0x3fc0af1f + .long 0x009609f5,0xbd35b214 + .long 0xa8806000,0x3fc0d4b2 + .long 0xc4dfdce2,0xbd2800b0 + .long 0xf136a000,0x3fc0fa5e + .long 0x2043a891,0x3ceb0a92 + .long 0x4fb3e000,0x3fc1299a + .long 0x26f70b35,0x3d182c63 + .long 0x6253c000,0x3fc14f80 + .long 0x44ac2d9f,0x3d1f65c1 + .long 0x5d158000,0x3fc17580 + .long 0x33b79054,0x3d2f04d6 + .long 0x637cc000,0x3fc19b9a + .long 0xe16cee25,0xbd4d6b79 + .long 0xc26ee000,0x3fc1cb5f + .long 0x6b51c369,0xbd0e934a + .long 0xe65f2000,0x3fc1f1b4 + .long 0x70fcf287,0x3d264160 + .long 0x8b5dc000,0x3fc21824 + .long 0xa3811df5,0x3d1f2866 + .long 0xd62ae000,0x3fc23eae + .long 0x75f6e51d,0xbd1c4ef6 + .long 0xebd34000,0x3fc26553 + .long 0xcd48326e,0xbd308652 + .long 0xf1b12000,0x3fc28c13 + .long 0xdfe3a7af,0xbd2c0024 + .long 0x14382000,0x3fc2bcaa + .long 0x21480e44,0xbd38f4c6 + .long 0x40b78000,0x3fc2e3a7 + .long 0x60689912,0x3cbd2885 + .long 0xd8f34000,0x3fc30abf + .long 0x508d5aa5,0xbd3893a6 + .long 0x03984000,0x3fc331f4 + .long 0xe9a3a8db,0x3d409691 + .long 0xe7a60000,0x3fc35943 + .long 0x43d5764a,0x3d2a3e8e + .long 0xac6e8000,0x3fc380af + .long 0x4d90e64e,0xbd1fc4d9 + .long 0x7997c000,0x3fc3a837 + .long 0xab2a4593,0xbd286816 + .long 0x771ca000,0x3fc3cfdb + .long 0x16e57a0f,0xbd2493c7 + .long 0x0d39a000,0x3fc3eda9 + .long 0x2ae78433,0x3d277ad1 + .long 0xc0950000,0x3fc4157e + .long 0xa37f5324,0x3d27333a + .long 0x13fb2000,0x3fc43d71 + .long 0xb82461da,0xbd4b3f09 + .long 0x30ad2000,0x3fc46580 + .long 0x72bdc442,0xbd198b79 + .long 0x40464000,0x3fc48dac + .long 0xc1788616,0xbd2c28bc + .long 0x6cbbc000,0x3fc4b5f5 + .long 0xef1ba41e,0xbd2e5a23 + .long 0xe05e6000,0x3fc4de5b + .long 0x8b90e0a0,0x3d4582b8 + .long 0x07770000,0x3fc4fcbc + .long 0x794dd932,0xbd13d6f8 + .long 0x1e926000,0x3fc52556 + .long 0x9b81384c,0xbd322350 + .long 0xf3198000,0x3fc54e0d + .long 0x2cd70aca,0x3d30ca92 + .long 0x7112c000,0x3fc56cab + .long 0x2a6e4407,0xbd10ed4c + .long 0xba734000,0x3fc59597 + .long 0x187e8930,0x3d4b1553 + .long 0x3a508000,0x3fc5bea2 + .long 0x1e386e4d,0xbd402641 + .long 0x08de4000,0x3fc5dd7e + .long 0x0b3f247b,0xbd2f4535 + .long 0xd3f90000,0x3fc606bd + .long 0x7c6ff8cd,0x3d51aaa0 + .long 0x518a4000,0x3fc6301c + .long 0x4d6761d0,0x3d401ece + .long 0x70618000,0x3fc64f37 + .long 0xa791b8a6,0x3d322b46 + .long 0x14c20000,0x3fc678cc + .long 0x7917b19f,0xbd4d287f + .long 0x05ed4000,0x3fc69810 + .long 0xcb5870e8,0xbd46b8cb + .long 0x5f9bc000,0x3fc6c1db + .long 0x986fe812,0xbd3994b8 + .long 0x8ecd0000,0x3fc6e148 + .long 0x4fa56719,0x3d54407b + .long 0x2e7e4000,0x3fc70b4b + .long 0xc215a307,0x3d0b8ea3 + .long 0x09144000,0x3fc72ae2 + .long 0x8e443b8a,0x3d55fc4a + .long 0x81bd8000,0x3fc7551c + .long 0xaffc42e9,0x3d3b9ef2 + .long 0x76cc4000,0x3fc774dd + .long 0x8d3f5094,0x3d1ded36 + .long 0x5db00000,0x3fc79f50 + .long 0xdd7a0df9,0x3d3d105d + .long 0xde098000,0x3fc7bf3b + .long 0xf47b93c9,0x3d4f301f + .long 0xcac44000,0x3fc7e9e7 + .long 0x64ca2675,0xbd300eff + .long 0x49030000,0x3fc809fe + .long 0xa2382d7a,0xbd57f954 + .long 0x57998000,0x3fc82a27 + .long 0xa5427ebe,0xbd51a131 + .long 0xc6260000,0x3fc85525 + .long 0x18660d2c,0xbd4f67be + .long 0x79834000,0x3fc8757a + .long 0xe73d6696,0xbd53bc75 + .long 0x058d8000,0x3fc895e2 + .long 0x37dbd0a7,0x3d3c0532 + .long 0x37698000,0x3fc8c134 + .long 0x6534d35a,0xbd55670a + .long 0x12ef0000,0x3fc8e1c8 + .long 0x21fe7581,0x3d595f21 + .long 0x11218000,0x3fc9026f + .long 0xaefa5f2f,0x3d47e805 + .long 0x48888000,0x3fc92329 + .long 0xfa5a2c46,0x3d301501 + .long 0x4b834000,0x3fc94eea + .long 0x142e461b,0xbd361a29 + .long 0xb63a0000,0x3fc96fd1 + .long 0xe74e02a0,0xbd1fb7d8 + .long 0xa6620000,0x3fc990cc + .long 0x8c78b1e9,0x3d54d5fa + .long 0x33334000,0x3fc9b1db + .long 0xf104deb4,0x3d3085fd + .long 0x740e4000,0x3fc9d2fd + .long 0x4be3a88f,0x3d530348 + .long 0xeedc8000,0x3fc9ff49 + .long 0xe2bda395,0x3d5aa98b + .long 0x84fc0000,0x3fca209a + .long 0xb83b532a,0xbd580433 + .long 0x1e440000,0x3fca41ff + .long 0xada9a5e4,0xbd3fa98d + .long 0xd2cec000,0x3fca6377 + .long 0xe131e3b9,0xbd564407 + .long 0xbae0c000,0x3fca8504 + .long 0x018eb699,0x3d49f5f5 + .long 0xeeec0000,0x3fcaa6a5 + .long 0x1db03170,0xbd401d1e + .long 0x878d8000,0x3fcac85b + .long 0x09bf0cc9,0xbd2e1c0b + .long 0x9d900000,0x3fcaea25 + .long 0x1d013253,0xbd27d321 + .long 0x49eb4000,0x3fcb0c04 + .long 0x85567deb,0x3d36d506 + .long 0xa5c50000,0x3fcb2df7 + .long 0xe6dd603b,0x3d14c9cc + .long 0xca710000,0x3fcb4fff + .long 0x81ec1ae1,0xbd4b2ea2 + .long 0xd1714000,0x3fcb721c + .long 0xf660b9da,0x3d47e295 + .long 0xd4780000,0x3fcb944e + .long 0xa337b6c0,0xbd558993 + .long 0xed658000,0x3fcbb695 + .long 0x5395b891,0xbd51c199 + .long 0x364ac000,0x3fcbd8f2 + .long 0xa0feae19,0x3d560784 + .long 0xc96a0000,0x3fcbfb63 + .long 0xd6eafbe6,0xbd36014a + .long 0xc134c000,0x3fcc1dea + .long 0x84f72786,0x3d44e96e + .long 0x384f4000,0x3fcc4087 + .long 0x3f7c716e,0x3d3f006e + .long 0x498f0000,0x3fcc6339 + .long 0x93e69cea,0x3d33c317 + .long 0x0ffc0000,0x3fcc8601 + .long 0x7e3ccfb7,0x3d2dae5f + .long 0x065c4000,0x3fcc9d3d + .long 0xa7bafd57,0x3d4b4180 + .long 0x375b8000,0x3fccc029 + .long 0xfa45fc85,0x3d503cf7 + .long 0x6697c000,0x3fcce32b + .long 0xcc5fc3d0,0xbd5a2df8 + .long 0xafd54000,0x3fcd0643 + .long 0xf7c24bc7,0xbd55fdc6 + .long 0x2f0e0000,0x3fcd2972 + .long 0xc812d894,0xbd45bacd + .long 0x00710000,0x3fcd4cb7 + .long 0x2cb52790,0xbd0bc64a + .long 0xab3f8000,0x3fcd6446 + .long 0x8139913c,0x3d392b7b + .long 0xef71c000,0x3fcd87b0 + .long 0x822c4d80,0x3d4b449e + .long 0xd1fe8000,0x3fcdab31 + .long 0x4f09d1d4,0x3d49a698 + .long 0x6fdc8000,0x3fcdcec9 + .long 0x4231d353,0x3d311dde + .long 0x88764000,0x3fcde690 + .long 0x8e8f9b14,0xbd350c11 + .long 0x4a25c000,0x3fce0a4e + .long 0x1868dfd1,0x3d0ffb66 + .long 0x15754000,0x3fce2e23 + .long 0x6ad712e4,0x3d4e32b0 + .long 0x22d18000,0x3fce4613 + .long 0x75f8b410,0xbd4b758b + .long 0x95c78000,0x3fce6a0e + .long 0x94c67dc7,0xbd2e13dc + .long 0x6243c000,0x3fce8e21 + .long 0xf23f1279,0x3d4d600d + .long 0xf26e0000,0x3fcea63a + .long 0x668806d4,0x3cef1bb1 + .long 0xed160000,0x3fceca74 + .long 0xfe665305,0xbd4f489c + .long 0x92ccc000,0x3fceeec6 + .long 0x1d627f70,0x3d4259f1 + .long 0x36b8c000,0x3fcf070a + .long 0x714687e0,0x3d49c0c3 + .long 0x93e34000,0x3fcf2b83 + .long 0x5715356c,0x3d345a59 + .long 0xef53c000,0x3fcf5014 + .long 0xb6f783a8,0xbd5ad2b5 + .long 0x3af18000,0x3fcf6883 + .long 0x4bcc6e04,0x3d58bfdb + .long 0xd9f3c000,0x3fcf8d3c + .long 0xf63ab05d,0x3d58276d + .long 0x1add8000,0x3fcfa5c6 + .long 0x9beccf8d,0x3d43e926 + .long 0x567e8000,0x3fcfcaa8 + .long 0x362fdd81,0x3d5d3cfe + .long 0xc8744000,0x3fcfe34c + .long 0xc008381c,0xbd113e5f + .long 0xfd74e000,0x3fd0042b + .long 0x617c00f4,0x3d551936 + .long 0xf6a18000,0x3fd016bd + .long 0x52b01c58,0x3cd77bf6 + .long 0x2f906000,0x3fd02326 + .long 0x9269b5c5,0x3d53227c + .long 0xed8d4000,0x3fd035cc + .long 0x46d0dd58,0xbd4abd7e + .long 0x0e86a000,0x3fd04243 + .long 0x07af3e66,0xbcb117c1 + .long 0xc842c000,0x3fd04ebe + .long 0xa51b431d,0xbd4a401d + .long 0xe84fc000,0x3fd06182 + .long 0x4e2f0b29,0x3d54abd9 + .long 0xb609c000,0x3fd06e0c + .long 0xcd12a34d,0x3d538308 + .long 0x0bec8000,0x3fd080e6 + .long 0x7faf9c27,0x3d4e24d8 + .long 0x0d896000,0x3fd08d7e + .long 0xf5dd9bd9,0xbd58cad1 + .long 0xc96a2000,0x3fd0a06c + .long 0xb30ebd03,0x3cf56aec + .long 0x1f3b2000,0x3fd0ad13 + .long 0xf6264d3a,0x3d5c5508 + .long 0x71e78000,0x3fd0c017 + .long 0x801d3fff,0xbd440944 + .long 0x3cad8000,0x3fd0cccc + .long 0x8fd76450,0xbd50b4df + .long 0xd91a4000,0x3fd0d986 + .long 0xeca91a49,0xbd46ae31 + .long 0xb8860000,0x3fd0eca9 + .long 0x0cf1281c,0x3d5a2d53 + .long 0xf87fe000,0x3fd0f972 + .long 0x0e3b7b78,0x3d53d583 + .long 0x1cf0e000,0x3fd10642 + .long 0x36cc41d7,0x3d37dcbc + .long 0xebe28000,0x3fd11983 + .long 0x56ee7372,0x3d453935 + .long 0xe35b8000,0x3fd12661 + .long 0xf97392ab,0xbd3e990a + .long 0xd277a000,0x3fd13345 + .long 0xd681ef76,0xbd2625f2 + .long 0xf5974000,0x3fd146a6 + .long 0x4e1038a4,0xbd57c5c5 + .long 0xe81ea000,0x3fd15399 + .long 0xd5972106,0x3d407ab6 + .long 0xe5d3a000,0x3fd16092 + .long 0x74a3a2b7,0x3d434c04 + .long 0xc3b7a000,0x3fd17413 + .long 0xadcb10c6,0x3d46bb42 + .long 0xf629e000,0x3fd1811b + .long 0xc5305a70,0xbd420a8b + .long 0x47b46000,0x3fd18e2a + .long 0x61f0b069,0x3d3a17c8 + .long 0xbe1a4000,0x3fd19b3e + .long 0x9d0c4bc2,0x3d306106 + .long 0x017cc000,0x3fd1aee9 + .long 0xf7f8b601,0xbd475f35 + .long 0xed714000,0x3fd1bc0c + .long 0x4ef21e21,0xbd463c17 + .long 0x12abc000,0x3fd1c937 + .long 0x61c2e7a5,0x3d3ffdc5 + .long 0x77148000,0x3fd1d667 + .long 0xa4cb0170,0xbd260af0 + .long 0xd1286000,0x3fd1ea3b + .long 0xc64da380,0x3d4c38dc + .long 0xed934000,0x3fd1f77b + .long 0x11c5ddf7,0xbd53b3e4 + .long 0x5e1b0000,0x3fd204c2 + .long 0x7b28110e,0x3d28fa35 + .long 0x28ce8000,0x3fd2120f + .long 0x0bc856ad,0xbd564e99 + .long 0x53c4a000,0x3fd21f62 + .long 0xe0bb0bd9,0xbd52ff6c + .long 0xe51d6000,0x3fd22cbb + .long 0x9c33f19c,0x3d0531fc + .long 0x4c976000,0x3fd240ce + .long 0x4672ee85,0xbd4777b4 + .long 0xf8ece000,0x3fd24e37 + .long 0x8e29bedb,0xbd3461fa + .long 0x215b0000,0x3fd25ba8 + .long 0x2d8bf07a,0xbd4007bf + .long 0xcc2a0000,0x3fd2691e + .long 0xd592a8b0,0xbd4f7b1a + .long 0xffab4000,0x3fd2769b + .long 0x75f34cfe,0xbd520002 + .long 0xc2394000,0x3fd2841f + .long 0xf75ce6c1,0x3d52c96f + .long 0x1a384000,0x3fd291aa + .long 0x73fd8960,0x3d42f012 + .long 0x0e154000,0x3fd29f3b + .long 0xa111a5a3,0x3d584ad4 + .long 0xee47a000,0x3fd2b3a0 + .long 0x875f458c,0xbd2044f7 + .long 0x842c0000,0x3fd2c142 + .long 0xb02650df,0x3d43cbc1 + .long 0xccb7c000,0x3fd2ceea + .long 0xb6dc5d61,0xbd249ad3 + .long 0xce830000,0x3fd2dc99 + .long 0xfe13a4e3,0xbd0beb52 + .long 0x902fc000,0x3fd2ea4f + .long 0x4d1def58,0x3d57d999 + .long 0x186a2000,0x3fd2f80c + .long 0xb0baac1f,0x3d37f290 + .long 0x6de7c000,0x3fd305cf + .long 0x4343671c,0xbd4e1284 + .long 0x97684000,0x3fd31399 + .long 0x31df7b15,0xbd28c485 + .long 0x9bb5a000,0x3fd3216a + .long 0xc8a62d99,0xbd1838f8 + .long 0x81a3c000,0x3fd32f42 + .long 0x7ce7627b,0x3d4dfd72 + .long 0x50110000,0x3fd33d21 + .long 0x0c6b638c,0x3d023363 + .type __libm_log10l_table_256,@object + .size __libm_log10l_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/log1p_gen.S b/external/sgx_libm/intel64/log1p_gen.S new file mode 100644 index 0000000000..ce83de9783 --- /dev/null +++ b/external/sgx_libm/intel64/log1p_gen.S @@ -0,0 +1,574 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log1p_gen.c" + .text +..TXTST0: +# -- Begin log1p + .text + .align 16,0x90 + .globl log1p +log1p: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log1p.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edi + movl %edi, %edx + andl $2147483647, %edx + cmpl $2146435072, %edx + jae ..B1.24 +..B1.2: + cmpl $-1074790400, %edi + jae ..B1.20 +..B1.3: + cmpl $1068646400, %edx + jae ..B1.16 +..B1.4: + cmpl $1066401792, %edx + jae ..B1.15 +..B1.5: + cmpl $1059061760, %edx + jae ..B1.14 +..B1.6: + cmpl $1012924416, %edx + jae ..B1.13 +..B1.7: + cmpl $1048576, %edx + jb ..B1.9 +..B1.8: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm1 + subsd %xmm1, %xmm0 + ret +..B1.9: + movl -8(%rsp), %eax + orl %eax, %edx + je ..B1.11 +..B1.10: + lea _small_value_64(%rip), %rax + movsd -8(%rsp), %xmm0 + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm1 + movsd %xmm1, -40(%rsp) + subsd %xmm1, %xmm0 + ret +..B1.11: + movsd -8(%rsp), %xmm0 +..B1.12: + ret +..B1.13: + movsd -8(%rsp), %xmm3 + lea 24+_Q3(%rip), %rax + movaps %xmm3, %xmm1 + lea 16+_Q3(%rip), %rcx + mulsd %xmm3, %xmm1 + lea 8+_Q3(%rip), %rdx + movsd (%rax), %xmm0 + lea _Q3(%rip), %rsi + movsd (%rcx), %xmm2 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm0 + addsd (%rsi), %xmm2 + mulsd %xmm1, %xmm0 + mulsd %xmm3, %xmm2 + movsd %xmm1, -16(%rsp) + addsd %xmm2, %xmm0 + mulsd %xmm3, %xmm0 + addsd %xmm3, %xmm0 + ret +..B1.14: + movsd -8(%rsp), %xmm3 + lea 56+_Q2(%rip), %rdx + movaps %xmm3, %xmm5 + lea 64+_Q2(%rip), %r8 + mulsd %xmm3, %xmm5 + lea 40+_Q2(%rip), %rcx + movsd (%rdx), %xmm6 + lea 48+_Q2(%rip), %r9 + movsd (%r8), %xmm4 + lea 24+_Q2(%rip), %rsi + mulsd %xmm5, %xmm6 + lea 32+_Q2(%rip), %r10 + mulsd %xmm5, %xmm4 + addsd (%rcx), %xmm6 + addsd (%r9), %xmm4 + mulsd %xmm5, %xmm6 + mulsd %xmm5, %xmm4 + addsd (%rsi), %xmm6 + addsd (%r10), %xmm4 + mulsd %xmm5, %xmm6 + mulsd %xmm5, %xmm4 + xorl %eax, %eax + movaps %xmm3, %xmm10 + movl %eax, -8(%rsp) + lea 8+_Q2(%rip), %rdi + movsd -8(%rsp), %xmm0 + lea 16+_Q2(%rip), %r11 + movaps %xmm0, %xmm1 + movaps %xmm0, %xmm7 + mulsd %xmm0, %xmm7 + subsd %xmm0, %xmm10 + addsd (%rdi), %xmm6 + addsd (%r11), %xmm4 + addsd %xmm10, %xmm1 + mulsd %xmm3, %xmm6 + mulsd %xmm5, %xmm4 + mulsd %xmm10, %xmm1 + addsd %xmm4, %xmm6 + movaps %xmm0, %xmm2 + mulsd %xmm10, %xmm2 + mulsd %xmm5, %xmm6 + addsd %xmm1, %xmm2 + addsd %xmm6, %xmm10 + movsd %xmm7, -16(%rsp) + movl %eax, -16(%rsp) + lea _Q2(%rip), %rax + movsd -16(%rsp), %xmm8 + subsd %xmm8, %xmm7 + movsd (%rax), %xmm9 + addsd %xmm2, %xmm7 + mulsd %xmm9, %xmm7 + mulsd %xmm8, %xmm9 + addsd %xmm7, %xmm10 + addsd %xmm9, %xmm0 + movsd %xmm0, -8(%rsp) + addsd %xmm10, %xmm0 + movsd %xmm10, -24(%rsp) + ret +..B1.15: + movsd -8(%rsp), %xmm12 + lea 96+_Q1(%rip), %rcx + movaps %xmm12, %xmm1 + lea 88+_Q1(%rip), %r11 + mulsd %xmm12, %xmm1 + lea _TWO_32P(%rip), %rdx + movsd (%rcx), %xmm2 + lea 80+_Q1(%rip), %rsi + movsd (%r11), %xmm7 + lea 64+_Q1(%rip), %rdi + mulsd %xmm1, %xmm2 + lea 56+_Q1(%rip), %rcx + mulsd %xmm1, %xmm7 + addsd (%rsi), %xmm2 + movsd (%rdx), %xmm4 + lea 72+_Q1(%rip), %rdx + mulsd %xmm1, %xmm2 + lea 48+_Q1(%rip), %r8 + addsd (%rdx), %xmm7 + addsd (%rdi), %xmm2 + mulsd %xmm1, %xmm7 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm7 + addsd (%r8), %xmm2 + mulsd %xmm1, %xmm7 + mulsd %xmm1, %xmm2 + lea 40+_Q1(%rip), %rsi + lea 32+_Q1(%rip), %r9 + lea 24+_Q1(%rip), %rdi + lea _TWO_32(%rip), %rax + movaps %xmm12, %xmm0 + movaps %xmm12, %xmm6 + mulsd %xmm4, %xmm0 + lea 16+_Q1(%rip), %r10 + addsd (%rsi), %xmm7 + mulsd (%rax), %xmm6 + addsd (%r9), %xmm2 + mulsd %xmm1, %xmm7 + mulsd %xmm1, %xmm2 + addsd (%rdi), %xmm7 + addsd (%r10), %xmm2 + mulsd %xmm1, %xmm7 + mulsd %xmm1, %xmm2 + lea 8+_Q1(%rip), %r8 + lea 112+_Q1(%rip), %r9 + movsd %xmm0, -40(%rsp) + movaps %xmm12, %xmm3 + movsd -40(%rsp), %xmm5 + lea 104+_Q1(%rip), %r10 + movaps %xmm4, %xmm9 + subsd %xmm6, %xmm5 + addsd (%r8), %xmm7 + subsd %xmm5, %xmm3 + mulsd %xmm12, %xmm7 + mulsd %xmm3, %xmm12 + addsd %xmm7, %xmm2 + movsd (%r9), %xmm11 + movaps %xmm5, %xmm15 + movaps %xmm11, %xmm8 + mulsd %xmm5, %xmm11 + mulsd %xmm3, %xmm8 + mulsd %xmm3, %xmm15 + addsd (%r10), %xmm11 + addsd %xmm8, %xmm2 + addsd %xmm12, %xmm15 + movaps %xmm11, %xmm10 + movaps %xmm15, %xmm14 + movsd (%rax), %xmm13 + addsd %xmm2, %xmm10 + mulsd %xmm10, %xmm9 + mulsd %xmm13, %xmm10 + movsd %xmm9, -40(%rsp) + movsd -40(%rsp), %xmm0 + movsd %xmm5, -8(%rsp) + subsd %xmm10, %xmm0 + movaps %xmm5, %xmm10 + subsd %xmm0, %xmm11 + mulsd %xmm5, %xmm10 + addsd %xmm11, %xmm2 + addsd %xmm10, %xmm14 + mulsd %xmm1, %xmm2 + mulsd %xmm14, %xmm4 + mulsd %xmm13, %xmm14 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm4 + movsd %xmm3, -24(%rsp) + subsd %xmm14, %xmm4 + movsd %xmm1, -16(%rsp) + subsd %xmm4, %xmm10 + addsd %xmm15, %xmm10 + mulsd %xmm0, %xmm10 + mulsd %xmm4, %xmm0 + addsd %xmm2, %xmm10 + addsd %xmm5, %xmm0 + addsd %xmm3, %xmm10 + movsd %xmm0, -32(%rsp) + addsd %xmm10, %xmm0 + ret +..B1.16: + cmpl $1130364928, %edx + jae ..B1.18 +..B1.17: + lea _ones(%rip), %rcx + pxor %xmm1, %xmm1 + movsd -8(%rsp), %xmm7 + xorl %esi, %esi + movq __libm_rcp_table_256@GOTPCREL(%rip), %rdi + lea 8+_ones(%rip), %r8 + movl %esi, -8(%rsp) + lea _TWO_32(%rip), %r9 + movsd (%rcx), %xmm0 + movsd -8(%rsp), %xmm5 + addsd %xmm7, %xmm0 + subsd %xmm5, %xmm7 + movsd %xmm0, -32(%rsp) + movl -28(%rsp), %eax + movl %eax, %edx + andl $2146435072, %edx + movl %eax, %ecx + negl %edx + shrl $12, %eax + addl $2145386496, %edx + movl %edx, -28(%rsp) + movzbl %al, %edx + movl %esi, -32(%rsp) + movsd (%r8), %xmm2 + movsd (%r9), %xmm3 + cvtss2sd (%rdi,%rdx,4), %xmm1 + mulsd -32(%rsp), %xmm1 + mulsd %xmm1, %xmm5 + addsd %xmm1, %xmm2 + mulsd %xmm1, %xmm7 + addsd %xmm2, %xmm5 + movaps %xmm5, %xmm4 + movsd %xmm5, -16(%rsp) + addsd %xmm7, %xmm4 + movsd %xmm4, -8(%rsp) + addsd %xmm3, %xmm4 + movsd %xmm4, -40(%rsp) + movsd -40(%rsp), %xmm6 + shrl $20, %ecx + subsd (%r9), %xmm6 + movsd %xmm7, -24(%rsp) + addl $-1023, %ecx + movsd %xmm2, -32(%rsp) + subsd %xmm6, %xmm5 + addsd %xmm5, %xmm7 + jmp ..B1.19 +..B1.18: + movl %edx, %ecx + pxor %xmm0, %xmm0 + shrl $12, %edx + andl $1048575, %edi + movzbl %dl, %edx + orl $1072693248, %edi + movq __libm_rcp_table_256@GOTPCREL(%rip), %rax + lea 8+_ones(%rip), %r8 + movl %edi, -4(%rsp) + shlq $32, %rdi + movl -8(%rsp), %esi + orq %rsi, %rdi + cvtss2sd (%rax,%rdx,4), %xmm0 + movq %rdi, -24(%rsp) + movl $0, -8(%rsp) + movsd -8(%rsp), %xmm6 + movsd -24(%rsp), %xmm7 + shrl $20, %ecx + subsd %xmm6, %xmm7 + mulsd %xmm0, %xmm6 + mulsd %xmm0, %xmm7 + addsd (%r8), %xmm6 + movsd %xmm0, -32(%rsp) + addl $-1023, %ecx +..B1.19: + movaps %xmm6, %xmm0 + lea 32+_P(%rip), %rsi + lea 24+_P(%rip), %r9 + lea 16+_P(%rip), %rdi + lea 8+_P(%rip), %r10 + lea _P(%rip), %r8 + lea 8+_LN2(%rip), %r11 + addsd %xmm7, %xmm0 + movaps %xmm0, %xmm1 + mulsd %xmm0, %xmm1 + movsd (%rsi), %xmm3 + mulsd %xmm1, %xmm3 + movsd (%r9), %xmm2 + mulsd %xmm1, %xmm2 + addsd (%rdi), %xmm3 + mulsd %xmm1, %xmm3 + addsd (%r10), %xmm2 + mulsd %xmm0, %xmm2 + addsd (%r8), %xmm3 + pxor %xmm0, %xmm0 + cvtsi2sd %ecx, %xmm0 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + lea _LN2(%rip), %rcx + addsd %xmm2, %xmm3 + movsd (%rcx), %xmm4 + addsd %xmm3, %xmm7 + mulsd %xmm0, %xmm4 + movsd (%r11), %xmm5 + mulsd %xmm5, %xmm0 + shlq $4, %rdx + movq __libm_log_table_256@GOTPCREL(%rip), %rax + movsd %xmm1, -16(%rsp) + addsd (%rax,%rdx), %xmm4 + addsd 8(%rax,%rdx), %xmm0 + addsd %xmm4, %xmm7 + addsd %xmm6, %xmm0 + movsd %xmm0, -8(%rsp) + addsd %xmm7, %xmm0 + movsd %xmm7, -24(%rsp) + ret +..B1.20: + lea _zeros(%rip), %rax + addl $-1072693248, %edx + orl -8(%rsp), %edx + movsd (%rax), %xmm1 + jne ..B1.22 +..B1.21: + lea 8+_ones(%rip), %rax + movsd (%rax), %xmm0 + divsd %xmm1, %xmm0 + ret +..B1.22: + lea _infs(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm1, %xmm0 +..B1.23: + ret +..B1.24: + addl $1048576, %edi + orl -8(%rsp), %edi + je ..B1.27 +..B1.25: + lea _ones(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 +..B1.26: + ret +..B1.27: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type log1p,@function + .size log1p,.-log1p + .data +# -- End log1p + .section .rodata, "a" + .align 4 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_Q3: + .long 0 + .long 3219128320 + .long 1431655765 + .long 1070945621 + .long 55924054 + .long 3218079744 + .long 2711205044 + .long 1070176665 + .type _Q3,@object + .size _Q3,32 + .align 4 +_Q2: + .long 0 + .long 3219128320 + .long 1431655765 + .long 1070945621 + .long 4294967292 + .long 3218079743 + .long 2577017633 + .long 1070176665 + .long 1431726806 + .long 3217380693 + .long 2027016470 + .long 1069697316 + .long 3108735575 + .long 3217031167 + .long 1449976333 + .long 1069315434 + .long 60833854 + .long 3216612762 + .type _Q2,@object + .size _Q2,72 + .align 4 +_Q1: + .long 3234281536 + .long 3150348867 + .long 1430600241 + .long 1047876949 + .long 4294967294 + .long 3218079743 + .long 2576981961 + .long 1070176665 + .long 1431660017 + .long 3217380693 + .long 2452398325 + .long 1069697316 + .long 4287730462 + .long 3217031167 + .long 2576343554 + .long 1069314503 + .long 1474253516 + .long 3216611738 + .long 2720006255 + .long 1068975428 + .long 1874652295 + .long 3216331940 + .long 2893691300 + .long 1068761010 + .long 1325424864 + .long 3216153938 + .long 0 + .long 3219128320 + .long 0 + .long 1070945621 + .type _Q1,@object + .size _Q1,120 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_P: + .long 0 + .long 3219128320 + .long 1431621855 + .long 1070945621 + .long 4294842013 + .long 3218079743 + .long 1289448124 + .long 1070176674 + .long 2077359316 + .long 3217380703 + .type _P,@object + .size _P,40 + .align 4 +_LN2: + .long 897137782 + .long 1038760431 + .long 4276092928 + .long 1072049730 + .type _LN2,@object + .size _LN2,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log1pf_gen.S b/external/sgx_libm/intel64/log1pf_gen.S new file mode 100644 index 0000000000..9eace98e22 --- /dev/null +++ b/external/sgx_libm/intel64/log1pf_gen.S @@ -0,0 +1,163 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log1pf_gen.c" + .text +..TXTST0: +# -- Begin log1pf + .text + .align 16,0x90 + .globl log1pf +log1pf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log1pf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + pxor %xmm2, %xmm2 + cvtss2sd %xmm0, %xmm2 + movd %xmm0, %eax + movaps %xmm2, %xmm1 + andl $2147483647, %eax + cmpl $2139095040, %eax + andps .L_2il0floatpacket.6(%rip), %xmm1 + ja ..B1.9 +..B1.2: + movsd .L_2il0floatpacket.0(%rip), %xmm0 + comisd %xmm2, %xmm0 + jb ..B1.5 +..B1.3: + ucomisd %xmm0, %xmm2 + jp ..B1.4 + je ..B1.10 +..B1.4: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.3(%rip), %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B1.5: + comisd .L_2il0floatpacket.1(%rip), %xmm1 + jb ..B1.7 +..B1.6: + movsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd %xmm2, %xmm0 + call log@PLT +..B1.13: + cvtsd2ss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B1.7: + movaps %xmm2, %xmm1 + pxor %xmm0, %xmm0 + mulsd %xmm2, %xmm1 + mulsd .L_2il0floatpacket.4(%rip), %xmm1 + subsd %xmm1, %xmm2 + cvtsd2ss %xmm2, %xmm0 +..B1.8: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B1.9: + addss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 16 +..B1.10: + movss .L_2il0floatpacket.2(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type log1pf,@function + .size log1pf,.-log1pf + .data +# -- End log1pf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.6: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3e300000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 4 +.L_2il0floatpacket.2: + .long 0xbf800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x7f800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log1pl.S b/external/sgx_libm/intel64/log1pl.S new file mode 100644 index 0000000000..4cfbf09a90 --- /dev/null +++ b/external/sgx_libm/intel64/log1pl.S @@ -0,0 +1,1027 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log1pl.c" + .text +..TXTST0: +# -- Begin log1pl + .text + .align 16,0x90 + .globl log1pl +log1pl: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_log1pl.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %cl, %cl +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movzbl 105(%rsp), %r8d + andl $128, %r8d + shrl $7, %r8d + movl %r8d, %edi + movzwl 104(%rsp), %esi + shll $15, %edi + andl $32767, %esi + orl %esi, %edi + shll $16, %edi + movzwl 102(%rsp), %eax + orl %eax, %edi + movzwl 82(%rsp), %eax + cmpl $32767, %esi + je ..B1.71 +..B1.4: + cmpl $-1073774592, %edi + jae ..B1.57 +..B1.5: + cmpl $16379, %esi + jge ..B1.47 +..B1.6: + cmpl $16369, %esi + jge ..B1.40 +..B1.7: + cmpl $16358, %esi + jge ..B1.33 +..B1.8: + cmpl $16345, %esi + jge ..B1.26 +..B1.9: + cmpl $16308, %esi + jge ..B1.19 +..B1.10: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.14 +..B1.11: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.12: + fldcw 80(%rsp) +..B1.13: + movzwl 104(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.14: + testl %esi, %esi + jle ..B1.67 +..B1.15: + fldt 96(%rsp) + lea _TWO_75(%rip), %rax + movb 105(%rsp), %dl + lea _ones(%rip), %rsi + andb $-128, %dl + lea 8+_TWO_75(%rip), %r8 + shrb $7, %dl + fldl (%rax) + fmul %st(1), %st + movzbl %dl, %edi + fxch %st(1) + fmull (%rsi,%rdi,8) + fsubrp %st, %st(1) + fmull (%r8) + fstpt (%rsp) +..B1.16: + testb %cl, %cl + je ..B1.18 +..B1.17: + fldcw 82(%rsp) +..B1.18: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.19: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.23 +..B1.20: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.21: + fldcw 80(%rsp) +..B1.22: + movb $1, %cl +..B1.23: + fldt 96(%rsp) + lea _Q3(%rip), %rax + lea _TWO_75(%rip), %rdx + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fadd %st(1), %st + fstpt (%rsp) + fldl (%rdx) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.25 +..B1.24: + fldcw 82(%rsp) +..B1.25: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.26: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.30 +..B1.27: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.28: + fldcw 80(%rsp) +..B1.29: + movb $1, %cl +..B1.30: + fldt 96(%rsp) + lea 16+_Q2(%rip), %rax + lea _Q2(%rip), %rdx + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.32 +..B1.31: + fldcw 82(%rsp) +..B1.32: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.33: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.37 +..B1.34: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.35: + fldcw 80(%rsp) +..B1.36: + movb $1, %cl +..B1.37: + fldt 96(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rsi + fmul %st(1), %st + lea 16+_Q1(%rip), %rdx + fldt (%rax) + lea _Q1(%rip), %rdi + fmul %st(1), %st + testb %cl, %cl + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.39 +..B1.38: + fldcw 82(%rsp) +..B1.39: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.40: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.44 +..B1.41: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.42: + fldcw 80(%rsp) +..B1.43: + movb $1, %cl +..B1.44: + fldt 96(%rsp) + lea _TWO_52H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 208+_Q(%rip), %rdi + lea 176+_Q(%rip), %r8 + lea 144+_Q(%rip), %r9 + fldl (%rax) + lea 112+_Q(%rip), %r10 + fmul %st(4), %st + lea 80+_Q(%rip), %r11 + lea 48+_Q(%rip), %rax + lea 224+_Q(%rip), %rsi + lea 240+_Q(%rip), %rdx + testb %cl, %cl + fadd %st, %st(3) + fsubrp %st, %st(3) + fld %st(2) + fxch %st(2) + fsub %st(3), %st + fmul %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fxch %st(3) + fstpt 32(%rsp) + fldt 32(%rsp) + fmul %st(0), %st + fstpt 64(%rsp) + fldt 64(%rsp) + faddp %st, %st(3) + fstpt 48(%rsp) + fldt (%rdx) + lea 16+_Q(%rip), %rdx + fmul %st, %st(1) + fldt (%rsi) + lea 192+_Q(%rip), %rsi + fldt (%rdi) + lea 160+_Q(%rip), %rdi + fmul %st(4), %st + fldt (%r8) + lea 128+_Q(%rip), %r8 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r9) + lea 96+_Q(%rip), %r9 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + lea 64+_Q(%rip), %r10 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r11) + lea 32+_Q(%rip), %r11 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rax) + lea _Q(%rip), %rax + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rsi) + fmul %st(5), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(5) + fld %st(1) + fldt (%rax) + faddp %st, %st(6) + fxch %st(5) + fmul %st(6), %st + faddp %st, %st(1) + faddp %st, %st(3) + fldt 48(%rsp) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(4) + fldt 64(%rsp) + fmulp %st, %st(1) + fldt 32(%rsp) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fmul %st(1), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.46 +..B1.45: + fldcw 82(%rsp) +..B1.46: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.47: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.51 +..B1.48: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.49: + fldcw 80(%rsp) +..B1.50: + movzbl 105(%rsp), %r8d + movb $1, %cl + andl $128, %r8d + shrl $7, %r8d +..B1.51: + lea ranges(%rip), %rax + cmpl (%rax,%r8,4), %edi + jae ..B1.53 +..B1.52: + fldt 96(%rsp) + xorl %edi, %edi + movzwl 104(%rsp), %eax + lea _shifters(%rip), %rsi + andl $32767, %eax + fld %st(0) + addl $-16415, %eax + lea zero_one(%rip), %r8 + lea _ones(%rip), %r9 + setl %dil + fldl (%r9) + fstpt (%rsp) + fldl (%rsi,%rdi,8) + fmul %st(2), %st + movzwl 8(%rsp), %r11d + fadd %st, %st(1) + andl $-32768, %r11d + fsubrp %st, %st(1) + movq __libm_rcp_table_256@GOTPCREL(%rip), %rsi + fsubr %st, %st(1) + faddl (%r8,%rdi,8) + xorl $1, %edi + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(1) + faddl (%r8,%rdi,8) + fadd %st, %st(1) + fxch %st(1) + fstpt 96(%rsp) + movzwl 104(%rsp), %edx + andl $32767, %edx + movl %edx, %r10d + addl $-16383, %edx + negl %r10d + movl 100(%rsp), %eax + addl $-2, %r10d + shrl $23, %eax + andl $32767, %r10d + movzbl %al, %eax + orl %r10d, %r11d + movw %r11w, 8(%rsp) + fldt (%rsp) + fmuls (%rsi,%rax,4) + jmp ..B1.54 +..B1.53: + fldt 96(%rsp) + lea zero_one(%rip), %rdx + lea _TWO_32H(%rip), %rdi + faddl (%rdx,%r8,8) + fstpt 96(%rsp) + fldl (%rdi) + movzwl 104(%rsp), %eax + movl %eax, %edx + andl $-32768, %eax + andl $32767, %edx + orl $-49153, %eax + addl $-16383, %edx + movw %ax, 104(%rsp) + fldt 96(%rsp) + fld %st(0) + movl 100(%rsp), %esi + fadd %st(2), %st + shrl $23, %esi + fsubp %st, %st(2) + movzbl %sil, %eax + fsub %st(1), %st + movq __libm_rcp_table_256@GOTPCREL(%rip), %r8 + fxch %st(1) + fstpt 32(%rsp) + flds (%r8,%rax,4) +..B1.54: + fldt 32(%rsp) + lea 8+_ones(%rip), %rsi + fmul %st(1), %st + lea 48+_P(%rip), %rdi + fxch %st(2) + fmulp %st, %st(1) + fxch %st(1) + faddl (%rsi) + fld %st(0) + lea 16+_P(%rip), %r8 + movl %edx, 48(%rsp) + lea 80+_P(%rip), %rdx + lea 64+_P(%rip), %r9 + lea 32+_P(%rip), %r10 + lea _P(%rip), %r11 + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fildl 48(%rsp) + fldt (%rdx) + fmul %st(3), %st + fldt (%rdi) + shlq $4, %rax + faddp %st, %st(1) + fmul %st(3), %st + testb %cl, %cl + fldt (%r8) + movq __libm_logl_table_256@GOTPCREL(%rip), %rdx + faddp %st, %st(1) + fmul %st(3), %st + fmulp %st, %st(2) + fldt (%r9) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fldt .L_2il0floatpacket.0(%rip) + fmul %st(1), %st + fldt .L_2il0floatpacket.1(%rip) + fmulp %st, %st(2) + faddl 8(%rdx,%rax) + faddp %st, %st(3) + faddl (%rax,%rdx) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + je ..B1.56 +..B1.55: + fldcw 82(%rsp) +..B1.56: + fldt 32(%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.57: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.61 +..B1.58: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.59: + fldcw 80(%rsp) +..B1.60: + movb $1, %cl +..B1.61: + fldt 96(%rsp) + lea 8+_ones(%rip), %rdx + lea _zeros(%rip), %rax + fldl (%rdx) + movsd (%rdx), %xmm0 + movsd (%rax), %xmm1 + fucomip %st(1), %st + fstp %st(0) + jp ..B1.62 + je ..B1.63 +..B1.62: + lea _infs(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm1, %xmm0 + movsd %xmm0, 48(%rsp) + fldl 48(%rsp) + fstpt (%rsp) + jmp ..B1.64 +..B1.63: + divsd %xmm1, %xmm0 + movsd %xmm0, 48(%rsp) + fldl 48(%rsp) + fstpt (%rsp) +..B1.64: + testb %cl, %cl + je ..B1.66 +..B1.65: + fldcw 82(%rsp) +..B1.66: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.67: + cmpl $0, 100(%rsp) + jne ..B1.69 +..B1.68: + cmpl $0, 96(%rsp) + je ..B1.70 +..B1.69: + fldt 96(%rsp) + lea _TWO_75(%rip), %rdx + movb 105(%rsp), %sil + lea _ones(%rip), %rdi + andb $-128, %sil + lea _small_value_80(%rip), %rax + lea 8+_TWO_75(%rip), %r9 + fldl (%rdx) + shrb $7, %sil + fmul %st(1), %st + fldt (%rax) + fmul %st(0), %st + movzbl %sil, %r8d + fstpt 16(%rsp) + fxch %st(1) + fmull (%rdi,%r8,8) + fsubrp %st, %st(1) + fmull (%r9) + fstpt (%rsp) + jmp ..B1.16 +..B1.70: + fldt 96(%rsp) + fstpt (%rsp) + jmp ..B1.16 +..B1.71: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.75 +..B1.72: + orl $-64768, %eax + movw %ax, 80(%rsp) +..B1.73: + fldcw 80(%rsp) +..B1.74: + movzbl 105(%rsp), %r8d + movb $1, %cl + andl $128, %r8d + shrl $7, %r8d +..B1.75: + testl %r8d, %r8d + je ..B1.78 +..B1.76: + cmpl $-2147483648, 100(%rsp) + jne ..B1.78 +..B1.77: + cmpl $0, 96(%rsp) + je ..B1.82 +..B1.78: + fldt 96(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.79: + testb %cl, %cl + je ..B1.81 +..B1.80: + fldcw 82(%rsp) +..B1.81: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.82: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 48(%rsp) + fldl 48(%rsp) + fstpt (%rsp) + jmp ..B1.79 + .align 16,0x90 + .cfi_endproc + .type log1pl,@function + .size log1pl,.-log1pl + .data +# -- End log1pl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xdc,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +zero_one: + .long 0x00000000,0x00000000 + .long 0x00000000,0x3ff00000 + .type zero_one,@object + .size zero_one,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +ranges: + .long 1078558720 + .long 3221127168 + .type ranges,@object + .size ranges,8 + .align 4 +_shifters: + .long 0 + .long 1098383360 + .long 0 + .long 1123549184 + .type _shifters,@object + .size _shifters,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_Q3: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 4096 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 53521 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 65509 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 43631 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 43690 + .word 6 + .word 32768 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 60885 + .word 52536 + .word 52444 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 14363 + .word 62279 + .word 27629 + .word 62293 + .word 49080 + .word 0 + .word 0 + .word 0 + .word 44555 + .word 43690 + .word 43690 + .word 43690 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 64968 + .word 65535 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 50395 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 39590 + .word 43714 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 15749 + .word 18782 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 61040 + .word 7204 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 10454 + .word 61175 + .word 14561 + .word 58254 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 57771 + .word 22430 + .word 52985 + .word 52428 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 7036 + .word 15828 + .word 36565 + .word 47662 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 17194 + .word 46991 + .word 54030 + .word 43687 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 63541 + .word 11931 + .word 21910 + .word 40326 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 36457 + .word 1697 + .word 61895 + .word 37932 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 65454 + .word 16107 + .word 6024 + .word 35469 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,256 + .align 2 +_P: + .word 65 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 44010 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 58670 + .word 61414 + .word 65535 + .word 65535 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24905 + .word 46201 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 57053 + .word 27587 + .word 64478 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 41508 + .word 48914 + .word 32459 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,96 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log2_gen.S b/external/sgx_libm/intel64/log2_gen.S new file mode 100644 index 0000000000..e1907d9c6f --- /dev/null +++ b/external/sgx_libm/intel64/log2_gen.S @@ -0,0 +1,774 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2_gen.c" + .text +..TXTST0: +# -- Begin log2 + .text + .align 16,0x90 + .globl log2 +log2: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log2.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movl $1069088768, %ecx + movd %rcx, %xmm7 + movapd HIGHSIGMASK(%rip), %xmm5 + movq $0x77f0000000000000, %rdx + movd %rdx, %xmm3 + movl $32768, %r9d + movd %r9, %xmm4 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $16352, %ecx + psrlq $27, %xmm0 + movq LOG2_E(%rip), %xmm2 + psrld $2, %xmm0 + rcpps %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + mulss %xmm7, %xmm0 + orpd %xmm3, %xmm1 + lea L_tbl(%rip), %r11 + andpd %xmm1, %xmm5 + paddd %xmm4, %xmm0 + subsd %xmm5, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm6, %xmm0 + andl $32752, %eax + subl %ecx, %eax + sarl $4, %eax + cvtsi2sd %eax, %xmm7 + mulpd %xmm0, %xmm5 + mulsd %xmm0, %xmm1 + movapd coeff(%rip), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd -912(%r11,%rdx), %xmm0 + movapd 16+coeff(%rip), %xmm4 + addsd %xmm5, %xmm1 + movapd 32+coeff(%rip), %xmm2 + movq $0xbf5dabe1161bb241, %r8 + movd %r8, %xmm6 + movapd %xmm1, %xmm5 + unpcklpd %xmm1, %xmm5 + mulsd %xmm1, %xmm3 + addsd %xmm7, %xmm0 + mulpd %xmm5, %xmm4 + mulpd %xmm5, %xmm5 + addpd %xmm2, %xmm4 + mulpd %xmm5, %xmm3 + movapd %xmm0, %xmm7 + unpcklpd %xmm0, %xmm7 + addsd %xmm1, %xmm0 + mulsd %xmm1, %xmm4 + subsd %xmm0, %xmm7 + mulsd %xmm1, %xmm6 + pshufd $238, %xmm0, %xmm2 + addsd %xmm7, %xmm1 + mulsd %xmm5, %xmm5 + addpd %xmm3, %xmm4 + addsd %xmm6, %xmm2 + mulpd %xmm5, %xmm4 + addsd %xmm2, %xmm1 + addsd %xmm4, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movq (%rsp), %xmm0 + movq (%rsp), %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_2.0.2 + cmpl $16, %eax + jb .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + addsd %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + ja .L_2TAG_PACKET_4.0.2 + cmpl $0, %edx + ja .L_2TAG_PACKET_4.0.2 + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_2.0.2: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_5.0.2 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.2 +.L_2TAG_PACKET_6.0.2: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + movl $171, 16(%rsp) + mulsd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_8.0.2 +.L_2TAG_PACKET_7.0.2: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $170, 16(%rsp) + jmp .L_2TAG_PACKET_8.0.2 +.L_2TAG_PACKET_3.0.2: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.2 + xorpd %xmm1, %xmm1 + movl $18416, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + xorpd %xmm2, %xmm2 + movl $16368, %eax + pinsrw $3, %eax, %xmm2 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $18416, %ecx + psrlq $27, %xmm0 + movq LOG2_E(%rip), %xmm2 + psrld $2, %xmm0 + rcpps %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $78, %xmm5, %xmm6 + psrlq $12, %xmm1 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_8.0.2: + movq %xmm0, 8(%rsp) +..B1.3: + movq 8(%rsp), %xmm0 +.L_2TAG_PACKET_9.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type log2,@function + .size log2,.-log2 + .data +# -- End log2 + .section .rodata, "a" + .align 16 + .align 16 +HIGHSIGMASK: + .long 4160749568 + .long 4294967295 + .long 0 + .long 4294959104 + .type HIGHSIGMASK,@object + .size HIGHSIGMASK,16 + .align 16 +LOG2_E: + .long 0 + .long 1073160192 + .long 370913857 + .long 3210587105 + .type LOG2_E,@object + .size LOG2_E,16 + .align 16 +L_tbl: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 3065110528 + .long 1072676937 + .long 969155058 + .long 1027421928 + .long 3789631488 + .long 1072660714 + .long 1061361078 + .long 1026032326 + .long 2461925376 + .long 1072644578 + .long 1624763829 + .long 3175910818 + .long 3729080320 + .long 1072628527 + .long 1845599454 + .long 1028591843 + .long 3710689280 + .long 1072612561 + .long 3776236642 + .long 1025648432 + .long 2882404352 + .long 1072596679 + .long 3683226528 + .long 3174591570 + .long 1779716096 + .long 1072580880 + .long 1916484889 + .long 3173934989 + .long 996708352 + .long 1072565163 + .long 716999656 + .long 3175673444 + .long 1184837632 + .long 1072549527 + .long 1973599317 + .long 3174949482 + .long 3051761664 + .long 1072533971 + .long 1437348984 + .long 1028530411 + .long 3065225216 + .long 1072518495 + .long 1219343899 + .long 1028525753 + .long 2041864192 + .long 1072503098 + .long 388496599 + .long 3175919551 + .long 851140608 + .long 1072487779 + .long 2822909360 + .long 3173772990 + .long 414302208 + .long 1072472537 + .long 1306322068 + .long 1026235748 + .long 1703325696 + .long 1072457371 + .long 1651655805 + .long 3174368281 + .long 1444937728 + .long 1072442281 + .long 1145646243 + .long 3175573309 + .long 709566464 + .long 1072427266 + .long 3608295147 + .long 3168585112 + .long 615415808 + .long 1072412325 + .long 2957847316 + .long 1027961637 + .long 2327523328 + .long 1072397457 + .long 3266875511 + .long 3175163169 + .long 2761863168 + .long 1072382662 + .long 3329930550 + .long 1027790656 + .long 3174416384 + .long 1072367939 + .long 3349298596 + .long 3172501429 + .long 570335232 + .long 1072353288 + .long 905028281 + .long 3175970581 + .long 588005376 + .long 1072338707 + .long 40558280 + .long 1022275054 + .long 318357504 + .long 1072324196 + .long 3000963593 + .long 3175644723 + .long 1188933632 + .long 1072309754 + .long 1152643439 + .long 3171407768 + .long 373186560 + .long 1072295381 + .long 3440409283 + .long 3174861647 + .long 3674587136 + .long 1072281075 + .long 1985407462 + .long 1026124611 + .long 4051050496 + .long 1072266837 + .long 2734481544 + .long 1026856954 + .long 3089022976 + .long 1072252666 + .long 3365453112 + .long 1028135364 + .long 2412838912 + .long 1072238561 + .long 1203709499 + .long 3175656792 + .long 3683999744 + .long 1072224521 + .long 4237943120 + .long 3176014210 + .long 10571776 + .long 1072210547 + .long 1358548904 + .long 3174161579 + .long 1716314112 + .long 1072196636 + .long 1192519078 + .long 3175777045 + .long 1980272640 + .long 1072182789 + .long 1567013979 + .long 3174472130 + .long 2605957120 + .long 1072169005 + .long 1671600287 + .long 1028158963 + .long 1135812608 + .long 1072155284 + .long 1547709291 + .long 3174179085 + .long 3735490560 + .long 1072141624 + .long 2225392115 + .long 1027056729 + .long 3718443008 + .long 1072128026 + .long 3797315894 + .long 3175978381 + .long 3020144640 + .long 1072114489 + .long 569231379 + .long 3176080301 + .long 3607605248 + .long 1072101012 + .long 2931542967 + .long 1028585043 + .long 3183849472 + .long 1072087595 + .long 1779595699 + .long 1025078612 + .long 3777277952 + .long 1072074237 + .long 3836888569 + .long 3176101128 + .long 3151212544 + .long 1072060938 + .long 4204238866 + .long 1027628024 + .long 3393323008 + .long 1072047697 + .long 3590952967 + .long 1024914744 + .long 2325151744 + .long 1072034514 + .long 2081953065 + .long 1024436445 + .long 2091569152 + .long 1072021388 + .long 1869579321 + .long 3176039801 + .long 570331136 + .long 1072008319 + .long 1169272038 + .long 1028145343 + .long 4256530432 + .long 1071995305 + .long 3897289024 + .long 3171837174 + .long 2492289024 + .long 1071982348 + .long 3892405903 + .long 3175484647 + .long 1826058240 + .long 1071969446 + .long 4079999923 + .long 3175326622 + .long 242364416 + .long 1071956599 + .long 850820968 + .long 3175983841 + .long 46260224 + .long 1071943806 + .long 2164938638 + .long 1028426857 + .long 3567947776 + .long 1071931066 + .long 2011723452 + .long 1028083988 + .long 277430272 + .long 1071918381 + .long 2531435800 + .long 3169601318 + .long 1143848960 + .long 1071905748 + .long 294923185 + .long 1023738369 + .long 4275343360 + .long 1071893167 + .long 2459435756 + .long 1028412742 + .long 3508592640 + .long 1071880639 + .long 503755275 + .long 3173140530 + .long 1293312000 + .long 1071868163 + .long 3333822795 + .long 1026993594 + .long 101961728 + .long 1071855738 + .long 2904005851 + .long 1027338469 + .long 2429362176 + .long 1071843363 + .long 1235892196 + .long 3175679811 + .long 2202386432 + .long 1071831039 + .long 2295142960 + .long 1028565357 + .long 1959501824 + .long 1071818765 + .long 254808788 + .long 1028157588 + .long 4260454400 + .long 1071806540 + .long 1281464327 + .long 3173548784 + .long 3096002560 + .long 1071794365 + .long 2126040068 + .long 3168834094 + .long 1067458560 + .long 1071782239 + .long 957416402 + .long 3171516564 + .long 796413952 + .long 1071770161 + .long 3663270514 + .long 1026937343 + .long 629456896 + .long 1071758131 + .long 2081311685 + .long 1026861414 + .long 3227787264 + .long 1071746148 + .long 325239760 + .long 3175812466 + .long 2681995264 + .long 1071734213 + .long 692600417 + .long 1028316258 + .long 1691656192 + .long 1071722325 + .long 2854288619 + .long 3174069820 + .long 2975059968 + .long 1071710483 + .long 2357806657 + .long 3175896595 + .long 1853362176 + .long 1071686938 + .long 182026883 + .long 3174676055 + .long 4247105536 + .long 1071663574 + .long 1264810745 + .long 1026738550 + .long 671424512 + .long 1071636109 + .long 321222784 + .long 1028039985 + .long 4092968960 + .long 1071590092 + .long 3658154599 + .long 3175856095 + .long 193347584 + .long 1071544424 + .long 723354347 + .long 3173824323 + .long 985587712 + .long 1071499097 + .long 2344377442 + .long 1027857554 + .long 1801297920 + .long 1071454107 + .long 2398211919 + .long 3175430015 + .long 2750758912 + .long 1071409449 + .long 223148174 + .long 1028267694 + .long 118882304 + .long 1071365119 + .long 1958423088 + .long 1026816298 + .long 3531350016 + .long 1071321110 + .long 875023512 + .long 1027316085 + .long 1581752320 + .long 1071277420 + .long 345754833 + .long 1027657950 + .long 473587712 + .long 1071234043 + .long 3024467474 + .long 3175496105 + .long 2533163008 + .long 1071190974 + .long 3279280870 + .long 3173991880 + .long 1902854144 + .long 1071148210 + .long 3170372974 + .long 3174359141 + .long 1709547520 + .long 1071105746 + .long 3312617382 + .long 3175326532 + .long 1168744448 + .long 1071063578 + .long 2799128425 + .long 1027228825 + .long 4163903488 + .long 1071021701 + .long 1285964057 + .long 3176060221 + .long 2056257536 + .long 1070980113 + .long 2706516695 + .long 1028650734 + .long 3739770880 + .long 1070938808 + .long 246392277 + .long 3174722093 + .long 1271734272 + .long 1070897784 + .long 3679462403 + .long 3174159366 + .long 4223328256 + .long 1070857035 + .long 2433294629 + .long 1027980203 + .long 1015963648 + .long 1070816560 + .long 4253198713 + .long 1026847814 + .long 1862295552 + .long 1070776353 + .long 1509191037 + .long 3173682029 + .long 103178240 + .long 1070736412 + .long 3582688163 + .long 3173089500 + .long 2264358912 + .long 1070696732 + .long 1779381280 + .long 1025292403 + .long 2278850560 + .long 1070657311 + .long 3240888728 + .long 1027177644 + .long 2954207232 + .long 1070618145 + .long 3564986365 + .long 1024870970 + .long 1865613312 + .long 1070562367 + .long 3892585078 + .long 1027946215 + .long 3434348544 + .long 1070485036 + .long 3011363162 + .long 3175199985 + .long 671449088 + .long 1070408197 + .long 1145012811 + .long 1026506981 + .long 1327038464 + .long 1070331842 + .long 227553652 + .long 1028331265 + .long 766836736 + .long 1070255966 + .long 518075456 + .long 3175312400 + .long 3434479616 + .long 1070180562 + .long 1452680450 + .long 3174267422 + .long 1364688896 + .long 1070105626 + .long 2571031723 + .long 3174222501 + .long 4236263424 + .long 1070031150 + .long 3514507731 + .long 3175326685 + .long 706019328 + .long 1069957131 + .long 2980398698 + .long 1026808442 + .long 1347502080 + .long 1069883561 + .long 1818423398 + .long 3175271900 + .long 4280483840 + .long 1069810435 + .long 3925170731 + .long 3175415416 + .long 3750608896 + .long 1069737749 + .long 710015584 + .long 3170118559 + .long 3004235776 + .long 1069665497 + .long 3823542833 + .long 3174354681 + .long 1393737728 + .long 1069593674 + .long 4238122296 + .long 1028475778 + .long 1621164032 + .long 1069497029 + .long 2232087921 + .long 3175937870 + .long 2762080256 + .long 1069355067 + .long 3580752115 + .long 3175802838 + .long 2914779136 + .long 1069213933 + .long 1251526596 + .long 1028548772 + .long 3808428032 + .long 1069073617 + .long 1491573749 + .long 1025131695 + .long 3589865472 + .long 1068934110 + .long 2320751647 + .long 3175285520 + .long 1102381056 + .long 1068795403 + .long 2369472545 + .long 3174735692 + .long 164790272 + .long 1068657486 + .long 3958705468 + .long 1027545055 + .long 966098944 + .long 1068520350 + .long 91754714 + .long 3174161762 + .long 100794368 + .long 1068269030 + .long 3205869737 + .long 3173509296 + .long 2079653888 + .long 1067997831 + .long 930310477 + .long 1028614386 + .long 3471048704 + .long 1067728143 + .long 1091811766 + .long 1028000848 + .long 1092419584 + .long 1067459950 + .long 629649056 + .long 3175844743 + .long 3079012352 + .long 1066936100 + .long 3939938999 + .long 3172112142 + .long 3666608128 + .long 1066405591 + .long 4185504407 + .long 3175959388 + .long 526647296 + .long 1065354156 + .long 1469727419 + .long 3173760470 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type L_tbl,@object + .size L_tbl,2064 + .align 16 +coeff: + .long 1367832035 + .long 1066403058 + .long 2677381210 + .long 3216320731 + .long 3610762001 + .long 3214607116 + .long 1215221452 + .long 1069835102 + .long 2894285243 + .long 1067936923 + .long 3011779882 + .long 3218479542 + .type coeff,@object + .size coeff,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log2f_gen.S b/external/sgx_libm/intel64/log2f_gen.S new file mode 100644 index 0000000000..7da6f101d8 --- /dev/null +++ b/external/sgx_libm/intel64/log2f_gen.S @@ -0,0 +1,243 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2f_gen.c" + .text +..TXTST0: +# -- Begin log2f + .text + .align 16,0x90 + .globl log2f +log2f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log2f.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + cmpl $2139095040, %edx + jae ..B1.14 +..B1.2: + lea -1065222144(%rdx), %eax + cmpl $196608, %eax + jae ..B1.7 +..B1.3: + cmpl $1065353216, %edx + jne ..B1.5 +..B1.4: + pxor %xmm3, %xmm3 + jmp ..B1.6 +..B1.5: + movss -8(%rsp), %xmm0 + lea 40+_Q(%rip), %rax + lea 32+_Q(%rip), %rsi + addss .L_2il0floatpacket.0(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + movaps %xmm0, %xmm1 + lea 24+_Q(%rip), %rdx + movsd (%rax), %xmm3 + lea 16+_Q(%rip), %rdi + movsd (%rsi), %xmm2 + lea 8+_Q(%rip), %rcx + lea _Q(%rip), %r8 + mulsd %xmm0, %xmm1 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + addsd (%rdx), %xmm3 + addsd (%rdi), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm1, %xmm2 + addsd (%rcx), %xmm3 + addsd (%r8), %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm0, %xmm2 + addsd %xmm2, %xmm3 + cvtsd2ss %xmm3, %xmm3 +..B1.6: + movaps %xmm3, %xmm0 + ret +..B1.7: + movl %edx, %r9d + movl %edx, %eax + shrl $23, %r9d + andl $8388607, %eax + addl $-127, %r9d + movl %eax, -8(%rsp) + cmpl $8388608, %edx + jae ..B1.10 +..B1.8: + testl %edx, %edx + je ..B1.22 +..B1.9: + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + movd %xmm0, %eax + movss %xmm0, -8(%rsp) + movl %eax, %r9d + movl %eax, %edx + shrl $23, %r9d + addl $-152, %r9d +..B1.10: + testl $8388607, %edx + jne ..B1.12 +..B1.11: + pxor %xmm0, %xmm0 + cvtsi2ss %r9d, %xmm0 + ret +..B1.12: + shrl $15, %edx + orl $1065353216, %eax + movzbl %dl, %edi + pxor %xmm2, %xmm2 + movl %eax, -8(%rsp) + pxor %xmm0, %xmm0 + movq __libm_rcp_table_256@GOTPCREL(%rip), %rax + lea 16+_P(%rip), %rdx + lea 8+_P(%rip), %rcx + lea _P(%rip), %r8 + movq __libm_logf_table_256@GOTPCREL(%rip), %rsi + pxor %xmm3, %xmm3 + cvtss2sd -8(%rsp), %xmm2 + cvtss2sd (%rax,%rdi,4), %xmm0 + cvtsi2sd %r9d, %xmm3 + mulsd %xmm0, %xmm2 + movsd (%rdx), %xmm0 + movsd (%rsi,%rdi,8), %xmm1 + addsd .L_2il0floatpacket.2(%rip), %xmm2 + mulsd %xmm2, %xmm0 + addsd (%rcx), %xmm0 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm0 + addsd %xmm1, %xmm2 + mulsd (%r8), %xmm2 + addsd %xmm2, %xmm0 + addsd %xmm3, %xmm0 + cvtsd2ss %xmm0, %xmm0 +..B1.13: + ret +..B1.14: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.20 +..B1.15: + testl $-2147483648, %edx + je ..B1.20 +..B1.16: + testl %eax, %eax + jne ..B1.18 +..B1.17: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret +..B1.18: + movss .L_2il0floatpacket.3(%rip), %xmm1 + pxor %xmm0, %xmm0 + mulss %xmm1, %xmm0 +..B1.19: + ret +..B1.20: + movss -8(%rsp), %xmm0 + ret +..B1.22: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type log2f,@function + .size log2f,.-log2f + .data +# -- End log2f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x7f800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_Q: + .long 1697350398 + .long 1073157447 + .long 1697278904 + .long 3219592519 + .long 3711670093 + .long 1071564553 + .long 491294680 + .long 3218543945 + .long 1795286032 + .long 1070757723 + .long 557036084 + .long 3217959989 + .type _Q,@object + .size _Q,48 + .align 4 +_P: + .long 1697350398 + .long 1073157447 + .long 605117704 + .long 3219592522 + .long 782203563 + .long 1071564561 + .type _P,@object + .size _P,24 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log2l.S b/external/sgx_libm/intel64/log2l.S new file mode 100644 index 0000000000..a068414a1a --- /dev/null +++ b/external/sgx_libm/intel64/log2l.S @@ -0,0 +1,541 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2l.c" + .text +..TXTST0: +# -- Begin log2l + .text + .align 16,0x90 + .globl log2l +log2l: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_log2l.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %sil, %sil +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzbl 57(%rsp), %r8d + andl $128, %r8d + shrl $7, %r8d + movzwl 56(%rsp), %eax + movl %eax, %edx + movl %r8d, %edi + andl $32767, %edx + shll $15, %edi + orl %edx, %edi + shll $16, %edi + movzwl 54(%rsp), %ecx + orl %ecx, %edi + cmpl $2147450880, %edi + jae ..B1.28 +..B1.4: + addl $-1073676224, %edi + cmpl $32863, %edi + ja ..B1.13 +..B1.5: + cmpl $16383, %edx + je ..B1.37 +..B1.6: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.10 +..B1.7: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.8: + fldcw 24(%rsp) +..B1.9: + movb $1, %sil +..B1.10: + fldt 48(%rsp) + lea 8+_ones(%rip), %rax + lea 112+_P(%rip), %rcx + lea 80+_P(%rip), %rdi + lea 48+_P(%rip), %r8 + lea 96+_P(%rip), %r10 + lea _TWO_32H(%rip), %rdx + lea 64+_P(%rip), %r11 + lea 16+_P(%rip), %r9 + testb %sil, %sil + fldt (%rcx) + lea 128+_P(%rip), %rcx + fldt (%rdi) + fldl (%rdx) + lea _P(%rip), %rdx + fldt (%r8) + fxch %st(4) + faddl (%rax) + lea 32+_P(%rip), %rax + fld %st(0) + fmul %st(1), %st + fmul %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(2) + fmul %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fld %st(1) + fxch %st(2) + fmul %st, %st(3) + fxch %st(2) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(1) + fsub %st(3), %st + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r10) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt (%rdx) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fldt (%rcx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.12 +..B1.11: + fldcw 26(%rsp) +..B1.12: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.13: + movzwl 26(%rsp), %edi + movl %edi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.17 +..B1.14: + orl $-64768, %edi + movw %di, 24(%rsp) +..B1.15: + fldcw 24(%rsp) +..B1.16: + movzwl 56(%rsp), %eax + movl %eax, %edx + movb $1, %sil + andl $32767, %edx +..B1.17: + movl $-16383, %ecx + testl %edx, %edx + jne ..B1.20 +..B1.18: + fldt 48(%rsp) + lea _TWO_75(%rip), %rcx + lea _zeros(%rip), %rax + fmull (%rcx) + movl $-16458, %ecx + fstpt 48(%rsp) + fldt 48(%rsp) + fldl (%rax) + movsd (%rax), %xmm0 + fucomip %st(1), %st + fstp %st(0) + jp ..B1.19 + je ..B1.39 +..B1.19: + movzwl 56(%rsp), %eax + movl %eax, %edx + andl $32767, %edx +..B1.20: + movl 52(%rsp), %edi + cmpl $-2147483648, %edi + jne ..B1.25 +..B1.21: + cmpl $0, 48(%rsp) + jne ..B1.25 +..B1.22: + addl %edx, %ecx + movl %ecx, 16(%rsp) + testb %sil, %sil + fildl 16(%rsp) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 26(%rsp) +..B1.24: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.25: + addl %edx, %ecx + lea _TWO_32H(%rip), %rdx + andl $-32768, %eax + lea 8+_ones(%rip), %r8 + orl $-49153, %eax + lea 112+_P(%rip), %r9 + movw %ax, 56(%rsp) + lea 80+_P(%rip), %r10 + fldt 48(%rsp) + lea 48+_P(%rip), %r11 + fld %st(0) + fldl (%rdx) + lea 16+_P(%rip), %rdx + shrl $23, %edi + fadd %st, %st(1) + movzbl %dil, %eax + fsubrp %st, %st(1) + movq __libm_rcp_table_256@GOTPCREL(%rip), %rdi + fsubr %st, %st(1) + flds (%rdi,%rax,4) + lea 96+_P(%rip), %rdi + fmul %st, %st(1) + fmulp %st, %st(2) + faddl (%r8) + fld %st(0) + lea 64+_P(%rip), %r8 + movl %ecx, 16(%rsp) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r9) + lea 32+_P(%rip), %r9 + fmul %st(2), %st + fldt (%r10) + lea _P(%rip), %r10 + shlq $4, %rax + faddp %st, %st(1) + fmul %st(2), %st + testb %sil, %sil + fldt (%r11) + lea 128+_P(%rip), %r11 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdx) + movq __libm_log2l_table_256@GOTPCREL(%rip), %rdx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r10) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt (%r11) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(2) + fmulp %st, %st(1) + fildl 16(%rsp) + fxch %st(2) + faddl 8(%rdx,%rax) + fxch %st(2) + faddl (%rax,%rdx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.27 +..B1.26: + fldcw 26(%rsp) +..B1.27: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.28: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.32 +..B1.29: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.30: + fldcw 24(%rsp) +..B1.31: + movzbl 57(%rsp), %r8d + movb $1, %sil + andl $128, %r8d + shrl $7, %r8d +..B1.32: + testl %r8d, %r8d + jne ..B1.42 +..B1.33: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.34: + testb %sil, %sil + je ..B1.36 +..B1.35: + fldcw 26(%rsp) +..B1.36: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.37: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.6 +..B1.38: + lea _zeros(%rip), %rax + fldl (%rax) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.39: + lea 8+_ones(%rip), %rax + testb %sil, %sil + movsd (%rax), %xmm1 + divsd %xmm0, %xmm1 + je ..B1.41 +..B1.40: + fldcw 26(%rsp) +..B1.41: + movsd %xmm1, 16(%rsp) + fldl 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.42: + movzwl 56(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + jne ..B1.44 +..B1.43: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.33 + jmp ..B1.47 +..B1.44: + testl %eax, %eax + jne ..B1.47 +..B1.45: + cmpq $0, 48(%rsp) + jne ..B1.47 +..B1.46: + lea 8+_ones(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + divsd (%rdx), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + jmp ..B1.34 +..B1.47: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 16(%rsp) + fldl 16(%rsp) + fstpt (%rsp) + jmp ..B1.34 + .align 16,0x90 + .cfi_endproc + .type log2l,@function + .size log2l,.-log2l + .data +# -- End log2l + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_P: + .word 17354 + .word 24031 + .word 3064 + .word 38062 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 61628 + .word 23575 + .word 15145 + .word 47274 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 60493 + .word 53279 + .word 20193 + .word 63032 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 62043 + .word 23575 + .word 15145 + .word 47274 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 33329 + .word 29325 + .word 25223 + .word 37819 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 5068 + .word 45194 + .word 20193 + .word 63032 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 43239 + .word 63403 + .word 6517 + .word 54028 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 25259 + .word 45714 + .word 45135 + .word 47274 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14848 + .word 47274 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,144 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log2l_table.S b/external/sgx_libm/intel64/log2l_table.S new file mode 100644 index 0000000000..d85ec17901 --- /dev/null +++ b/external/sgx_libm/intel64/log2l_table.S @@ -0,0 +1,559 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log2l_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_log2l_table_256 +__libm_log2l_table_256: + .long 0xa42e4000,0x3f671b0e + .long 0x1dbbd1a5,0x3cefda26 + .long 0x8eaec000,0x3f815cfe + .long 0xac00d0eb,0x3cf06028 + .long 0x0c5d0000,0x3f8cfee7 + .long 0x6dfa58c3,0xbd0a2394 + .long 0x62192000,0x3f94564a + .long 0x88333d4e,0x3d0068bc + .long 0xace34000,0x3f997723 + .long 0xac9ac44a,0x3d1765d0 + .long 0xc69b8000,0x3f9f5923 + .long 0xcfb08e1d,0xbd25afb7 + .long 0xa085c000,0x3fa2a094 + .long 0xa481e15f,0x3d2692b8 + .long 0x1776a000,0x3fa53894 + .long 0x36a2459e,0x3d201dc0 + .long 0x9b914000,0x3fa8324c + .long 0x2b15e585,0x3d178efe + .long 0xce080000,0x3faacf54 + .long 0x8e2d6a53,0xbd340b58 + .long 0x58dac000,0x3fadced9 + .long 0xd3ddb87a,0x3d2c119c + .long 0xfbca8000,0x3fb0387e + .long 0x16f872eb,0x3d1a7682 + .long 0x06748000,0x3fb18ac6 + .long 0xdff59ce4,0xbd18ff0d + .long 0x3e136000,0x3fb30edd + .long 0x15f8f5c1,0xbd29e679 + .long 0x59364000,0x3fb463c1 + .long 0x07b8e917,0x3d193671 + .long 0x3c3f8000,0x3fb5b9e1 + .long 0x4ce80f25,0x3d410e4a + .long 0x3259c000,0x3fb7113f + .long 0x637425fc,0x3d403cdb + .long 0x8d1b0000,0x3fb869dd + .long 0x3dfca47b,0x3d401a71 + .long 0xa49d0000,0x3fb9c3be + .long 0x8c6c8e73,0x3d4909ed + .long 0xd7960000,0x3fbb1ee4 + .long 0xf4540d3e,0x3d370159 + .long 0x8b70c000,0x3fbc7b52 + .long 0x0d939dcf,0x3d48e27d + .long 0x2c678000,0x3fbdd90a + .long 0x04d3d5b4,0xbd312b9c + .long 0x976c4000,0x3fbf05d4 + .long 0xcd9838ba,0xbd3fd7bc + .long 0xbaee8000,0x3fc032fb + .long 0x7d1edf2f,0xbd429af3 + .long 0xa9f32000,0x3fc0e3b5 + .long 0xeeb39e80,0x3d3094fb + .long 0x5c7d2000,0x3fc19519 + .long 0xa7453897,0xbd3b4aad + .long 0xc2ab2000,0x3fc22dad + .long 0xd23af327,0x3d4496d2 + .long 0x231e0000,0x3fc2e050 + .long 0xa377c7ec,0xbd350520 + .long 0x9c2b2000,0x3fc379f7 + .long 0xa3793dbe,0x3d256aea + .long 0x2ba1c000,0x3fc42ddd + .long 0xac74b87f,0xbd36ad5b + .long 0x9e680000,0x3fc4c89b + .long 0x02de76ad,0x3d2fd2e8 + .long 0x29ffc000,0x3fc563dc + .long 0x78df21ad,0xbd434df3 + .long 0x5f5d8000,0x3fc619a2 + .long 0xaf108e66,0xbd29cc54 + .long 0xbf368000,0x3fc6b5ff + .long 0x175a06f6,0xbd337788 + .long 0xf6610000,0x3fc752e1 + .long 0x902c7d37,0xbd2ca90f + .long 0xe7540000,0x3fc7f049 + .long 0xec326af7,0xbd483153 + .long 0x0abfc000,0x3fc8a898 + .long 0xab240e90,0xbd166ccc + .long 0xcca64000,0x3fc94724 + .long 0x82d7bfe5,0x3d47be4d + .long 0x24970000,0x3fc9e63a + .long 0xca6bec19,0x3d4f45ea + .long 0xfeb20000,0x3fca85d8 + .long 0xd08dc20f,0x3d17b6aa + .long 0x497d8000,0x3fcb2602 + .long 0x90cb67ba,0xbd565d39 + .long 0xf5ee4000,0x3fcbc6b6 + .long 0xcabaa043,0xbd51b254 + .long 0xf770c000,0x3fcc67f7 + .long 0xab00c050,0xbd49821f + .long 0xb2234000,0x3fcceec4 + .long 0xdad67ab8,0x3d3f73bc + .long 0x7ad10000,0x3fcd9109 + .long 0x370c6558,0x3d5cc12e + .long 0x57f3c000,0x3fce33dd + .long 0x4a928ccd,0x3d433481 + .long 0x46bc8000,0x3fced741 + .long 0x984a7cdc,0xbd23bfd7 + .long 0x46ff0000,0x3fcf7b36 + .long 0x48e15c73,0xbd32f9b5 + .long 0xa943e000,0x3fd00223 + .long 0x00388584,0xbd2f3862 + .long 0x74bf0000,0x3fd054a4 + .long 0xf7113597,0x3d4d6efe + .long 0x9b926000,0x3fd0999d + .long 0xa7e48c00,0xbd397bf5 + .long 0x6d3b4000,0x3fd0eca6 + .long 0xcb31a070,0xbd5a7f50 + .long 0x2e85c000,0x3fd13ffa + .long 0xc54ae907,0xbd471577 + .long 0x44fa0000,0x3fd185a4 + .long 0x6fa317ed,0x3d44f66d + .long 0x12f28000,0x3fd1cb83 + .long 0xce4e50d0,0xbd1010cf + .long 0x441ce000,0x3fd21fa1 + .long 0xf89df349,0x3d379e4a + .long 0x26e60000,0x3fd265f5 + .long 0x84a6a593,0x3d2e59ad + .long 0xc34be000,0x3fd2baa0 + .long 0xcd51a1bf,0x3d1ebefe + .long 0x45de2000,0x3fd3016b + .long 0xec0723df,0x3d1ce045 + .long 0x38aa2000,0x3fd3486c + .long 0xaa5dfd69,0x3d434f09 + .long 0xefaa8000,0x3fd38fa3 + .long 0x91962d0f,0x3d2313fc + .long 0xc0816000,0x3fd3e562 + .long 0xfa64765f,0x3d440340 + .long 0x1f53c000,0x3fd42d14 + .long 0x167aead5,0xbd4374da + .long 0x543f2000,0x3fd474fd + .long 0x400ce06e,0x3d216293 + .long 0xb6810000,0x3fd4bd1e + .long 0x8d05e4fa,0xbd5ab857 + .long 0x9e236000,0x3fd50578 + .long 0xbbaffd12,0xbd542eea + .long 0x64004000,0x3fd54e0b + .long 0x92de8d74,0xbd323e74 + .long 0x61c40000,0x3fd596d7 + .long 0xb5eabc35,0xbd6f07ff + .long 0xf1eec000,0x3fd5dfdc + .long 0xd2926f16,0xbd51f1bb + .long 0x6fd94000,0x3fd6291c + .long 0xdc0e627c,0xbd4ac899 + .long 0x37b58000,0x3fd67296 + .long 0xd82f9efc,0x3d541782 + .long 0xa6930000,0x3fd6bc4a + .long 0x46b4eaee,0xbd5f036d + .long 0x1a5fc000,0x3fd7063a + .long 0x0e43a37f,0xbd461b8d + .long 0xf1ed0000,0x3fd75064 + .long 0xec06848a,0x3d3c558f + .long 0x8cf10000,0x3fd79acb + .long 0x9ea019ad,0x3d2c7d46 + .long 0x1e438000,0x3fd7d67c + .long 0x2119c4e9,0x3d672dc9 + .long 0x4068c000,0x3fd8214f + .long 0x8322d649,0xbd505944 + .long 0x36dec000,0x3fd86c5f + .long 0x982b6522,0xbd5c2445 + .long 0x64dd8000,0x3fd8b7ac + .long 0x3c24b943,0xbcf8cd4c + .long 0x7a0c8000,0x3fd8f416 + .long 0x1882631a,0xbd506e0d + .long 0xd5e1c000,0x3fd93fd2 + .long 0x37daf317,0xbd0c6d2c + .long 0x84298000,0x3fd98bcd + .long 0x1c4482c6,0xbd56ba65 + .long 0x33e70000,0x3fd9c8c3 + .long 0x2b947c14,0xbd565ac6 + .long 0x14298000,0x3fda152f + .long 0x0e65d2ce,0x3d1b3d7b + .long 0xd95fc000,0x3fda527f + .long 0xad63ae87,0x3d58ff36 + .long 0x3edec000,0x3fda9f5e + .long 0x112e6c5e,0xbd38668d + .long 0x2b574000,0x3fdadd0b + .long 0x1a609aaa,0x3d55a69a + .long 0x6f520000,0x3fdb2a5d + .long 0xfdf426cf,0xbcff5369 + .long 0x99b00000,0x3fdb6867 + .long 0x84b3fb1a,0x3d47c5c7 + .long 0x1b888000,0x3fdbb62f + .long 0xef0b8928,0xbd29427b + .long 0x9f664000,0x3fdbf497 + .long 0x3da6863a,0x3d63342a + .long 0x6e83c000,0x3fdc332a + .long 0xb6303c0d,0xbd6315fe + .long 0xc2d44000,0x3fdc819d + .long 0x95d8ac46,0x3d5fe438 + .long 0x8e19c000,0x3fdcc090 + .long 0x870d5301,0xbd4085c5 + .long 0x611b0000,0x3fdcffae + .long 0xb8e97d14,0xbd676a4e + .long 0x76d44000,0x3fdd3ef7 + .long 0x378ff59d,0xbcc81e2b + .long 0x02710000,0x3fdd8e50 + .long 0x99a48379,0x3d128679 + .long 0x486cc000,0x3fddcdfb + .long 0x57e20e48,0xbd397d70 + .long 0x94244000,0x3fde0dd2 + .long 0x4e05d479,0x3d5fe3e2 + .long 0x22a28000,0x3fde4dd6 + .long 0x3522eadc,0x3d407f39 + .long 0x31710000,0x3fde8e06 + .long 0xd1f94399,0x3d54efc5 + .long 0xfe9ac000,0x3fdece62 + .long 0x793f3b67,0xbd63755a + .long 0x4a154000,0x3fdf1f16 + .long 0x1e0f6657,0xbd3d990d + .long 0xa9064000,0x3fdf5fd8 + .long 0x0109b0f1,0xbd1cb6f7 + .long 0x937e8000,0x3fdfa0c8 + .long 0xcacac36e,0xbd2515e1 + .long 0x49bb8000,0x3fdfe1e6 + .long 0x293a746b,0xbd5cca93 + .long 0x06416000,0x3fe01199 + .long 0xd8721fec,0xbd594c3a + .long 0x0e91e000,0x3fe03256 + .long 0x3e307cbb,0x3d467783 + .long 0x5ebce000,0x3fe0532a + .long 0xa9a9f37a,0xbd576c46 + .long 0x17f60000,0x3fe07416 + .long 0xbbaf9ab0,0xbd3ebdb1 + .long 0x53f38000,0x3fe08cd6 + .long 0x7d0732d6,0x3d5072ba + .long 0x55c12000,0x3fe0adeb + .long 0x502d528c,0xbd5f89ea + .long 0x1d5d2000,0x3fe0cf18 + .long 0x656576a5,0xbd317e70 + .long 0xcd0ac000,0x3fe0f05c + .long 0xc4d028f0,0x3d5dae75 + .long 0x87578000,0x3fe111b9 + .long 0xfb8eb2af,0x3d51553a + .long 0x6f1bc000,0x3fe1332e + .long 0x1e351573,0x3d5ee62e + .long 0xa77c2000,0x3fe154bb + .long 0x96dcbe61,0x3d1109e5 + .long 0x9bfa2000,0x3fe16df5 + .long 0x0adf6a55,0xbd693ea9 + .long 0xb6e2c000,0x3fe18fad + .long 0x517ae88c,0x3d63c19b + .long 0x849ae000,0x3fe1b17e + .long 0xff1e8ea2,0xbd3ecf4d + .long 0x6a0de000,0x3fe1caeb + .long 0x854dfeca,0x3d5027e9 + .long 0xc8310000,0x3fe1ece7 + .long 0x7a9fc25e,0xbd6136da + .long 0x3dae0000,0x3fe20efd + .long 0xa02e61be,0x3d2df373 + .long 0xe375e000,0x3fe2289d + .long 0xc27a8169,0xbd4bfa6f + .long 0x9b6a8000,0x3fe24adf + .long 0x14538362,0xbd601f94 + .long 0xd1aea000,0x3fe26d3a + .long 0xb5d13c0f,0x3d6cfc3a + .long 0x0c276000,0x3fe28710 + .long 0xcec1b4ea,0x3d61f3e3 + .long 0x3b3c0000,0x3fe2a998 + .long 0xcb3fff52,0x3d6b2840 + .long 0x5c842000,0x3fe2c38f + .long 0xdfa568f7,0x3d10bad7 + .long 0xfac06000,0x3fe2e644 + .long 0xbe206bcc,0xbd60284e + .long 0x5c482000,0x3fe3005e + .long 0x50757c6c,0x3d4411d0 + .long 0xe1d88000,0x3fe32341 + .long 0x4bed16a8,0x3d5370c2 + .long 0xde748000,0x3fe33d7d + .long 0x4a603b86,0xbd57fbb4 + .long 0xc5650000,0x3fe3608f + .long 0x14f8ca8f,0x3d3a63aa + .long 0xb9548000,0x3fe37aee + .long 0xc4484d2e,0xbd52b278 + .long 0x7d9a8000,0x3fe39e2f + .long 0xf9f603ee,0xbd627a85 + .long 0xc68fa000,0x3fe3b8b1 + .long 0x9336b66e,0x3d4bb4b6 + .long 0xe613e000,0x3fe3dc21 + .long 0xe04a7773,0xbd60c6e3 + .long 0xe33ba000,0x3fe3f6c7 + .long 0xfc271317,0x3d325d25 + .long 0x4b1fe000,0x3fe4117d + .long 0xf19c5879,0xbd47fe42 + .long 0xefeec000,0x3fe43531 + .long 0x74b82e7e,0xbd52f11d + .long 0x969d0000,0x3fe4500b + .long 0xbb075298,0x3d65b869 + .long 0xe41a2000,0x3fe46af4 + .long 0x4d994a2a,0xbd182943 + .long 0x19316000,0x3fe48eef + .long 0x3956fa5e,0x3d6990d4 + .long 0x333d4000,0x3fe4a9fd + .long 0xe1bd6277,0x3d67e24a + .long 0x318c0000,0x3fe4c51b + .long 0x2a8a4d7a,0xbd5f91de + .long 0x26d38000,0x3fe4e049 + .long 0xdd409e96,0xbd320665 + .long 0x63f64000,0x3fe5049f + .long 0x7b11231a,0x3d5b76a8 + .long 0xe3022000,0x3fe51ff2 + .long 0xa00b120a,0xbd56879f + .long 0x98572000,0x3fe53b56 + .long 0xfa5c51d1,0x3d673642 + .long 0x973dc000,0x3fe556ca + .long 0x459db47f,0xbd53cd8a + .long 0xf3200000,0x3fe5724e + .long 0x9385d649,0x3d591597 + .long 0x03a5c000,0x3fe59719 + .long 0x449e2590,0xbd31bb71 + .long 0xda198000,0x3fe5b2c3 + .long 0x492bf6ff,0xbd5b8afe + .long 0x4f3e4000,0x3fe5ce7f + .long 0x4f9a9e0c,0x3d76ae3f + .long 0x77184000,0x3fe5ea4b + .long 0x06727b86,0x3d65cd66 + .long 0x65cf0000,0x3fe60628 + .long 0x2f6664db,0x3d5e3c54 + .long 0x2faf4000,0x3fe62216 + .long 0x60c37437,0xbd773ea5 + .long 0xe929c000,0x3fe63e14 + .long 0xcd9d28e6,0x3d346549 + .long 0xa6d5c000,0x3fe65a24 + .long 0xc074b84d,0x3d5de792 + .long 0x7d6f8000,0x3fe67645 + .long 0x3180227e,0x3d45bfa4 + .long 0x81d94000,0x3fe69277 + .long 0x137a3d8c,0xbd5aaf6f + .long 0xc91b8000,0x3fe6aeba + .long 0x459f4910,0xbd2c3a4f + .long 0x6865c000,0x3fe6cb0f + .long 0xdb502403,0x3d51d406 + .long 0x750e8000,0x3fe6e775 + .long 0x54ae8096,0x3d57aac5 + .long 0x0493c000,0x3fe703ed + .long 0xd0d1a7f0,0xbd4c2657 + .long 0x2c9b0000,0x3fe72076 + .long 0xf1ec6bfa,0x3d6cb070 + .long 0x02f2c000,0x3fe73d11 + .long 0x28f88499,0x3d130454 + .long 0x9d914000,0x3fe759bd + .long 0x84b0b58b,0x3d5ed855 + .long 0x12968000,0x3fe7767c + .long 0x12e0b4f3,0xbd46eb96 + .long 0x784b4000,0x3fe7934c + .long 0x9cb23d17,0x3d6f0113 + .long 0xe522c000,0x3fe7b02e + .long 0xa5258bb7,0x3d77f7ed + .long 0x92280000,0x3fe7c37a + .long 0x818d34cf,0xbd6804b7 + .long 0x3d39c000,0x3fe7e07b + .long 0xf457de07,0x3d650290 + .long 0x2c1b4000,0x3fe7fd8e + .long 0xb343a140,0x3d2a15a5 + .long 0x75dc0000,0x3fe81ab3 + .long 0x2ec63274,0x3d584b7a + .long 0x31b7c000,0x3fe837eb + .long 0x22b56634,0x3d6c362e + .long 0x7716c000,0x3fe85535 + .long 0xa24036e1,0xbd7707b5 + .long 0xa808c000,0x3fe868c6 + .long 0xdc0e40d3,0xbd5bd2ae + .long 0x0713c000,0x3fe88630 + .long 0x6f909cf3,0xbd6203b8 + .long 0x2ee78000,0x3fe8a3ac + .long 0xbd315db9,0xbd5c935d + .long 0x3791c000,0x3fe8c13b + .long 0x11e2bd73,0x3d5dffed + .long 0x70e24000,0x3fe8d4fa + .long 0x8994b162,0xbd3b912d + .long 0x2639c000,0x3fe8f2a9 + .long 0x1cc06b22,0xbd677406 + .long 0xfd704000,0x3fe9106a + .long 0x6f31880a,0xbd1b76a4 + .long 0x3a284000,0x3fe9244c + .long 0x7db199c6,0xbd72bd2d + .long 0x2b878000,0x3fe9422e + .long 0x1eceebf4,0x3d607320 + .long 0x81210000,0x3fe96023 + .long 0x2956f019,0x3d6518a1 + .long 0x3737c000,0x3fe97427 + .long 0x71deb637,0x3d61e54d + .long 0x16b18000,0x3fe9923d + .long 0xebd2e82c,0x3d5028ed + .long 0x9e1bc000,0x3fe9b066 + .long 0xc89c6f2d,0xbd210f7a + .long 0x45f2c000,0x3fe9c48d + .long 0xe6a10cca,0xbd55b5da + .long 0xc93fc000,0x3fe9e2d7 + .long 0x6045b96c,0xbd74e31c + .long 0x39988000,0x3fea0136 + .long 0xd9459b34,0x3d3d25cf + .long 0x4e0bc000,0x3fea1580 + .long 0xd0364be2,0x3d744421 + .long 0x2ea54000,0x3fea3400 + .long 0x3388b97b,0x3d5c79a4 + .long 0xa67f8000,0x3fea4860 + .long 0xa2e241fc,0xbd5eddce + .long 0x414dc000,0x3fea6702 + .long 0xcc538261,0xbd43167c + .long 0x4e2e0000,0x3fea7b79 + .long 0xf16ff990,0xbd43cf0f + .long 0xee1c0000,0x3fea9a3c + .long 0xe3084679,0x3cf6c31d + .long 0x1be18000,0x3feab915 + .long 0x2c022617,0xbd672292 + .long 0xb33ac000,0x3feacdb0 + .long 0xb1410c94,0xbd4b23e5 + .long 0x60094000,0x3feaecab + .long 0x0ae3394c,0x3d50556b + .long 0x107c4000,0x3feb015e + .long 0xed2b2eb2,0xbd5d0db1 + .long 0x0cb28000,0x3feb161a + .long 0xd90df0b9,0x3d5353b3 + .long 0x8761c000,0x3feb3545 + .long 0x2b834fe3,0x3d647978 + .long 0xe5b20000,0x3feb4a18 + .long 0x2a855a1a,0x3d402327 + .long 0x9b240000,0x3feb6967 + .long 0x3726f484,0xbd7b3b86 + .long 0x90874000,0x3feb7e52 + .long 0x09b9625e,0x3d2d2152 + .long 0xd0b8c000,0x3feb9dc4 + .long 0x29c44115,0xbd46be4a + .long 0x92ddc000,0x3febb2c7 + .long 0xd690403e,0xbd28b7fc + .long 0xaeddc000,0x3febd25d + .long 0xb0f92e32,0x3d46a10e + .long 0x742ac000,0x3febe778 + .long 0x7ecf463f,0xbd6ad6fb + .long 0xe3b98000,0x3febfc9c + .long 0x1185e784,0xbd42cbe5 + .long 0xbdb50000,0x3fec1c65 + .long 0x6951096d,0x3d3e742a + .long 0x7dd04000,0x3fec31a2 + .long 0xcbdb5d9e,0xbd7a5b21 + .long 0x076cc000,0x3fec46e9 + .long 0x86f88587,0xbd3ddb78 + .long 0x43730000,0x3fec66e5 + .long 0xbaa5a734,0x3d523bf0 + .long 0x6c790000,0x3fec7c44 + .long 0xf67dd7ae,0xbd7c7a0d + .long 0x7ed84000,0x3fec91ad + .long 0x6188e18f,0x3d722f0b + .long 0xc4194000,0x3fecb1dd + .long 0x4bba7e1c,0x3d77b6c1 + .long 0xc6410000,0x3fecc75f + .long 0xb0c280a9,0x3d64f1b9 + .long 0xd2374000,0x3fecdceb + .long 0x391924a7,0xbd49ad57 + .long 0xcb184000,0x3fecfd50 + .long 0x6ab58d83,0xbd6078ca + .long 0x18c18000,0x3fed12f6 + .long 0xeb119dc6,0xbd6fe599 + .long 0x914e4000,0x3fed28a5 + .long 0x26c0de13,0xbd6fb0e6 + .long 0x3e504000,0x3fed3e5f + .long 0x9ace87f7,0xbd506b11 + .long 0xf93fc000,0x3fed5f08 + .long 0x4f2d37b7,0xbd73bb6d + .long 0x539dc000,0x3fed74dc + .long 0xb806844c,0x3d727a5f + .long 0x045b0000,0x3fed8aba + .long 0xf65ddbc9,0x3d2c7a4f + .long 0x15464000,0x3feda0a2 + .long 0x0af75927,0x3d74c8da + .long 0xb896c000,0x3fedc191 + .long 0x5363737e,0xbd6cdb50 + .long 0xe53dc000,0x3fedd793 + .long 0xa1dc7b13,0xbd76ffa3 + .long 0x94d7c000,0x3fededa0 + .long 0x1919aabd,0x3d6747e2 + .long 0xd174c000,0x3fee03b7 + .long 0x2f683f98,0xbd514fc4 + .long 0xa531c000,0x3fee19d9 + .long 0x3a87769f,0x3d7728dc + .long 0x1a3c0000,0x3fee3006 + .long 0x768a06ef,0xbd7a0e7d + .long 0xce9f8000,0x3fee515c + .long 0x518e12cc,0xbd65f71b + .long 0x03cb4000,0x3fee67a4 + .long 0xfaf8e258,0x3d75735c + .long 0xfe538000,0x3fee7df5 + .long 0xf6a2b592,0x3d55669d + .long 0xc8a70000,0x3fee9452 + .long 0xec9f90f7,0x3d60278c + .long 0x6d444000,0x3feeaaba + .long 0x2268e3e2,0x3d799543 + .long 0xf6b98000,0x3feec12c + .long 0x09d2dc10,0xbd468988 + .long 0x6fa38000,0x3feed7aa + .long 0x51433cdb,0xbd7387ac + .long 0xe2aec000,0x3feeee32 + .long 0x4fd75f61,0x3d597da2 + .long 0x3bbf4000,0x3fef1014 + .long 0x68ea48c7,0x3d71983c + .long 0x4f39c000,0x3fef26b8 + .long 0x4efa434d,0xbd72177b + .long 0x82ae0000,0x3fef3d67 + .long 0xf9197819,0x3d6fbc2b + .long 0xe1110000,0x3fef5421 + .long 0xa92b420d,0x3d69402d + .long 0x75670000,0x3fef6ae7 + .long 0x00c52b20,0xbd67cf2e + .long 0x4ac44000,0x3fef81b8 + .long 0x10fed627,0x3d2f2407 + .long 0x6c4e4000,0x3fef9894 + .long 0xd2088b22,0x3d61d346 + .long 0xe53ac000,0x3fefaf7b + .long 0xf5920222,0x3d69b7dc + .long 0xc0d04000,0x3fefc66e + .long 0xdbf33c61,0x3d6314d8 + .long 0x0a660000,0x3fefdd6d + .long 0x088b0624,0x3d603dc6 + .long 0xcd644000,0x3feff476 + .long 0xf02b035e,0x3d6e05d5 + .type __libm_log2l_table_256,@object + .size __libm_log2l_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/log_gen.S b/external/sgx_libm/intel64/log_gen.S new file mode 100644 index 0000000000..1a11f6b3d2 --- /dev/null +++ b/external/sgx_libm/intel64/log_gen.S @@ -0,0 +1,758 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log_gen.c" + .text +..TXTST0: +# -- Begin log + .text + .align 16,0x90 + .globl log +log: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_log.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + movq $0x3ff0000000000000, %rax + movd %rax, %xmm2 + movq $0x77f0000000000000, %rdx + movd %rdx, %xmm3 + movl $32768, %ecx + movd %rcx, %xmm4 + movq $0xffffe00000000000, %r8 + movd %r8, %xmm5 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + movl $16352, %ecx + psrlq $27, %xmm0 + lea L_tbl(%rip), %r11 + psrld $2, %xmm0 + rcpps %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $228, %xmm5, %xmm6 + psrlq $12, %xmm1 + subl $16, %eax + cmpl $32736, %eax + jae .L_2TAG_PACKET_0.0.2 +.L_2TAG_PACKET_1.0.2: + paddd %xmm4, %xmm0 + orpd %xmm3, %xmm1 + movd %xmm0, %edx + psllq $29, %xmm0 + andpd %xmm1, %xmm5 + andpd %xmm6, %xmm0 + subsd %xmm5, %xmm1 + mulpd %xmm0, %xmm5 + andl $32752, %eax + subl %ecx, %eax + cvtsi2sd %eax, %xmm7 + mulsd %xmm0, %xmm1 + movq log2(%rip), %xmm6 + movapd coeff(%rip), %xmm3 + subsd %xmm2, %xmm5 + andl $16711680, %edx + shrl $12, %edx + movapd (%r11,%rdx), %xmm0 + movapd 16+coeff(%rip), %xmm4 + addsd %xmm5, %xmm1 + movapd 32+coeff(%rip), %xmm2 + mulsd %xmm7, %xmm6 + movapd %xmm1, %xmm5 + unpcklpd %xmm1, %xmm5 + mulsd 8+log2(%rip), %xmm7 + mulsd %xmm1, %xmm3 + addsd %xmm6, %xmm0 + mulpd %xmm5, %xmm4 + mulpd %xmm5, %xmm5 + movapd %xmm0, %xmm6 + unpcklpd %xmm0, %xmm6 + addsd %xmm1, %xmm0 + addpd %xmm2, %xmm4 + mulpd %xmm5, %xmm3 + subsd %xmm0, %xmm6 + mulsd %xmm1, %xmm4 + pshufd $238, %xmm0, %xmm2 + addsd %xmm6, %xmm1 + mulsd %xmm5, %xmm5 + addsd %xmm2, %xmm7 + addpd %xmm3, %xmm4 + addsd %xmm7, %xmm1 + mulpd %xmm5, %xmm4 + addsd %xmm4, %xmm1 + pshufd $238, %xmm4, %xmm5 + addsd %xmm5, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movq (%rsp), %xmm0 + movq (%rsp), %xmm1 + addl $16, %eax + cmpl $32768, %eax + jae .L_2TAG_PACKET_2.0.2 + cmpl $16, %eax + jb .L_2TAG_PACKET_3.0.2 +.L_2TAG_PACKET_4.0.2: + addsd %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + ja .L_2TAG_PACKET_4.0.2 + cmpl $0, %edx + ja .L_2TAG_PACKET_4.0.2 + jmp .L_2TAG_PACKET_6.0.2 +.L_2TAG_PACKET_3.0.2: + xorpd %xmm1, %xmm1 + addsd %xmm0, %xmm1 + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.2 + xorpd %xmm1, %xmm1 + movl $18416, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orpd %xmm2, %xmm0 + psrlq $27, %xmm0 + movl $18416, %ecx + psrld $2, %xmm0 + rcpps %xmm0, %xmm0 + psllq $12, %xmm1 + pshufd $228, %xmm5, %xmm6 + psrlq $12, %xmm1 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_2.0.2: + movd %xmm1, %edx + psrlq $32, %xmm1 + movd %xmm1, %ecx + addl %ecx, %ecx + cmpl $-2097152, %ecx + jae .L_2TAG_PACKET_5.0.2 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_7.0.2 +.L_2TAG_PACKET_6.0.2: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $32752, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm0 + movl $3, 16(%rsp) + jmp .L_2TAG_PACKET_8.0.2 +.L_2TAG_PACKET_7.0.2: + xorpd %xmm1, %xmm1 + xorpd %xmm0, %xmm0 + movl $49136, %eax + pinsrw $3, %eax, %xmm0 + divsd %xmm1, %xmm0 + movl $2, 16(%rsp) +.L_2TAG_PACKET_8.0.2: + movq %xmm0, 8(%rsp) +..B1.3: + movq 8(%rsp), %xmm0 +.L_2TAG_PACKET_9.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type log,@function + .size log,.-log + .data +# -- End log + .section .rodata, "a" + .align 16 + .align 16 +L_tbl: + .long 4277811200 + .long 1072049730 + .long 2479318832 + .long 1026487127 + .long 2854492160 + .long 1072033410 + .long 215631550 + .long 1025638968 + .long 1547061248 + .long 1072017216 + .long 2886781435 + .long 1026423395 + .long 649825280 + .long 1072001146 + .long 4281533405 + .long 1024038923 + .long 646346752 + .long 1071985198 + .long 1562735921 + .long 1023790276 + .long 2203734016 + .long 1071969370 + .long 1838397691 + .long 3173936209 + .long 1872169984 + .long 1071953661 + .long 3981202460 + .long 1022325013 + .long 669557760 + .long 1071938069 + .long 4182597802 + .long 3173174122 + .long 4076413952 + .long 1071922591 + .long 1209029111 + .long 3170736207 + .long 556125184 + .long 1071907228 + .long 821086028 + .long 3173437049 + .long 204914688 + .long 1071891976 + .long 2097025986 + .long 3171071798 + .long 387545088 + .long 1071876834 + .long 3142936996 + .long 3173092218 + .long 2912783360 + .long 1071861800 + .long 2502420140 + .long 1024505919 + .long 1144260608 + .long 1071846874 + .long 3315658140 + .long 3173469843 + .long 1471209472 + .long 1071832053 + .long 129621009 + .long 3172443877 + .long 1829683200 + .long 1071817336 + .long 3885467693 + .long 1025535275 + .long 288676864 + .long 1071802722 + .long 86139472 + .long 3171639793 + .long 3636378624 + .long 1071788208 + .long 1850238587 + .long 1024654342 + .long 1606817792 + .long 1071773795 + .long 3388899795 + .long 3173675586 + .long 1236164608 + .long 1071759480 + .long 3983599207 + .long 1020046558 + .long 1089616896 + .long 1071745262 + .long 4171974224 + .long 1024773198 + .long 4143093760 + .long 1071731139 + .long 2727587401 + .long 3173965207 + .long 600267776 + .long 1071717112 + .long 3147685042 + .long 3173353031 + .long 2249313280 + .long 1071703177 + .long 125835074 + .long 1025255832 + .long 3805303808 + .long 1071689334 + .long 2289991207 + .long 1025460331 + .long 87278592 + .long 1071675583 + .long 1106114045 + .long 1025933602 + .long 3195405312 + .long 1071661920 + .long 3885316576 + .long 3171206239 + .long 3853649920 + .long 1071648346 + .long 2977069852 + .long 3171236771 + .long 2944026624 + .long 1071625048 + .long 1008093493 + .long 1023444474 + .long 3993180160 + .long 1071598247 + .long 1862355595 + .long 1024642533 + .long 1454641152 + .long 1071571617 + .long 1514603089 + .long 1026500596 + .long 3286085632 + .long 1071545154 + .long 1400028424 + .long 3173279056 + .long 438773760 + .long 1071518858 + .long 120727864 + .long 3172148914 + .long 1212979200 + .long 1071492725 + .long 1625055594 + .long 3172901933 + .long 1189017600 + .long 1071466754 + .long 3920062376 + .long 1025727407 + .long 403064832 + .long 1071440943 + .long 1053271728 + .long 3171391427 + .long 3343210496 + .long 1071415289 + .long 3243395502 + .long 3173627613 + .long 1765777408 + .long 1071389792 + .long 2145968512 + .long 1026354304 + .long 461430784 + .long 1071364449 + .long 4094322285 + .long 1026021467 + .long 71706624 + .long 1071339258 + .long 763632021 + .long 1024496933 + .long 1380503552 + .long 1071314217 + .long 1383547992 + .long 3173088453 + .long 1015732224 + .long 1071289325 + .long 3198646877 + .long 1025390322 + .long 35977216 + .long 1071264580 + .long 2141026805 + .long 1025754693 + .long 3927306240 + .long 1071239979 + .long 282116272 + .long 3173394334 + .long 1125341184 + .long 1071215523 + .long 2768427504 + .long 3172279059 + .long 1666971648 + .long 1071191208 + .long 786837629 + .long 3172427445 + .long 2827694080 + .long 1071167033 + .long 3857122416 + .long 3173014241 + .long 2003683328 + .long 1071142997 + .long 859010954 + .long 1026545007 + .long 1004017664 + .long 1071119098 + .long 3356644970 + .long 3173458064 + .long 1753020416 + .long 1071095334 + .long 788338552 + .long 1026157693 + .long 1992718336 + .long 1071071704 + .long 1239179443 + .long 1026394889 + .long 3870234624 + .long 1071048206 + .long 2082614663 + .long 1024926053 + .long 1050437632 + .long 1071024840 + .long 660007840 + .long 1025548499 + .long 188395520 + .long 1071001603 + .long 3878792704 + .long 3173889571 + .long 3747176448 + .long 1070978493 + .long 144991708 + .long 3171552042 + .long 1405669376 + .long 1070955511 + .long 3999088879 + .long 1025486317 + .long 121151488 + .long 1070932654 + .long 2170865497 + .long 1026473584 + .long 2652319744 + .long 1070909920 + .long 453695652 + .long 3173916809 + .long 3262236672 + .long 1070887309 + .long 157800053 + .long 3173984206 + .long 601221120 + .long 1070864820 + .long 3968917661 + .long 1023992886 + .long 1999843328 + .long 1070842450 + .long 3053895004 + .long 1024998228 + .long 1992167424 + .long 1070820199 + .long 2968614856 + .long 1024552653 + .long 3788726272 + .long 1070798065 + .long 3542170808 + .long 3173573242 + .long 2094829568 + .long 1070776048 + .long 1246758132 + .long 1026202874 + .long 288675840 + .long 1070754146 + .long 3747328950 + .long 1026331585 + .long 1829681152 + .long 1070732357 + .long 3125197546 + .long 1024100318 + .long 1666869248 + .long 1070710681 + .long 1363656119 + .long 1026336493 + .long 3417110528 + .long 1070689116 + .long 4154791553 + .long 1026267853 + .long 2183653376 + .long 1070667662 + .long 1671819292 + .long 3173785870 + .long 1734434816 + .long 1070646317 + .long 373091049 + .long 1025972363 + .long 1615681536 + .long 1070625080 + .long 384650897 + .long 1022926043 + .long 1445382144 + .long 1070603950 + .long 344320330 + .long 3172397196 + .long 1823715328 + .long 1070569756 + .long 3389841200 + .long 1025231852 + .long 3839688704 + .long 1070527917 + .long 1706790417 + .long 3167363349 + .long 4293332992 + .long 1070486286 + .long 1614935088 + .long 1019351591 + .long 2966720512 + .long 1070444861 + .long 4145393717 + .long 3173711658 + .long 4066729984 + .long 1070403639 + .long 1974925028 + .long 3171437182 + .long 3337621504 + .long 1070362619 + .long 3314953170 + .long 3169971314 + .long 943448064 + .long 1070321799 + .long 1498682038 + .long 3173862340 + .long 1465634816 + .long 1070281176 + .long 1319952810 + .long 3171693965 + .long 1015734272 + .long 1070240749 + .long 1347821929 + .long 3173544515 + .long 118001664 + .long 1070200516 + .long 1751482746 + .long 1026134093 + .long 3707174912 + .long 1070160474 + .long 1486946159 + .long 1023930920 + .long 3946381312 + .long 1070120623 + .long 2867408081 + .long 3171368276 + .long 1699848192 + .long 1070080961 + .long 2590187139 + .long 1025379803 + .long 2235846656 + .long 1070041485 + .long 1888568069 + .long 3172754960 + .long 2339729408 + .long 1070002194 + .long 3852214753 + .long 3173323149 + .long 3196850176 + .long 1069963086 + .long 742141560 + .long 1025101707 + .long 1800683520 + .long 1069924160 + .long 3949500444 + .long 3172102179 + .long 3835801600 + .long 1069885413 + .long 3848895943 + .long 1025913832 + .long 2201202688 + .long 1069846845 + .long 1425913464 + .long 1025868665 + .long 2778279936 + .long 1069808453 + .long 2120889677 + .long 3173831128 + .long 2954203136 + .long 1069770236 + .long 592147081 + .long 1019621288 + .long 210141184 + .long 1069732193 + .long 3414275233 + .long 1023647084 + .long 709476352 + .long 1069694321 + .long 2413027164 + .long 1024462115 + .long 2116284416 + .long 1069656619 + .long 1144559924 + .long 1026336654 + .long 2183651328 + .long 1069619086 + .long 3459057650 + .long 1025634168 + .long 3047047168 + .long 1069581720 + .long 1879674924 + .long 3173508573 + .long 970711040 + .long 1069541521 + .long 1335954173 + .long 3173332182 + .long 2198478848 + .long 1069467449 + .long 2951103968 + .long 3173892200 + .long 1669611520 + .long 1069393703 + .long 531044147 + .long 1025149248 + .long 29114368 + .long 1069320280 + .long 3327831251 + .long 1025918673 + .long 2376949760 + .long 1069247176 + .long 737634533 + .long 3172176000 + .long 1085390848 + .long 1069174390 + .long 3108243400 + .long 3171828406 + .long 1566130176 + .long 1069101918 + .long 985483226 + .long 1025708380 + .long 792780800 + .long 1069029758 + .long 4184866295 + .long 1024426204 + .long 183156736 + .long 1068957907 + .long 2845699378 + .long 1022107277 + .long 1301782528 + .long 1068886362 + .long 1012735262 + .long 3173804294 + .long 1562411008 + .long 1068815121 + .long 2197086703 + .long 3170187813 + .long 2815549440 + .long 1068744181 + .long 2782613207 + .long 1026345054 + .long 2756124672 + .long 1068673540 + .long 2929486205 + .long 3173037800 + .long 3511050240 + .long 1068603195 + .long 1443733147 + .long 3173331549 + .long 3047047168 + .long 1068533144 + .long 1879674924 + .long 3172459997 + .long 3221667840 + .long 1068427825 + .long 1338588027 + .long 3171815742 + .long 3453861888 + .long 1068288883 + .long 1205348359 + .long 3172624626 + .long 3506110464 + .long 1068150514 + .long 893105198 + .long 1025571866 + .long 346013696 + .long 1068012714 + .long 3495569021 + .long 3172563349 + .long 4074029056 + .long 1067875476 + .long 3961106338 + .long 3171065595 + .long 3559784448 + .long 1067738798 + .long 1975385384 + .long 3173783155 + .long 797769728 + .long 1067602675 + .long 3760305787 + .long 1026047642 + .long 2313633792 + .long 1067467101 + .long 1559353171 + .long 1023480256 + .long 3960766464 + .long 1067213778 + .long 1067365107 + .long 1025865926 + .long 684261376 + .long 1066944805 + .long 844762164 + .long 3173687482 + .long 630718464 + .long 1066676905 + .long 2458269694 + .long 1024033081 + .long 1486061568 + .long 1066410070 + .long 115537874 + .long 3173243995 + .long 2743664640 + .long 1065886792 + .long 3665098304 + .long 3173471607 + .long 1971912704 + .long 1065357333 + .long 2577214440 + .long 3171993451 + .long 1498939392 + .long 1064306693 + .long 3409036923 + .long 1025599151 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type L_tbl,@object + .size L_tbl,2064 + .align 16 +log2: + .long 4277811200 + .long 1067855426 + .long 2479318832 + .long 1022292823 + .type log2,@object + .size log2,16 + .align 16 +coeff: + .long 2454267026 + .long 1069697316 + .long 0 + .long 3218079744 + .long 1030730101 + .long 3217380702 + .long 1431655765 + .long 1070945621 + .long 2576980378 + .long 1070176665 + .long 0 + .long 3219128320 + .type coeff,@object + .size coeff,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/log_table.S b/external/sgx_libm/intel64/log_table.S new file mode 100644 index 0000000000..eebf30a349 --- /dev/null +++ b/external/sgx_libm/intel64/log_table.S @@ -0,0 +1,559 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "log_table.c" + .section .rodata, "a" + .align 32 + .align 32 + .globl __libm_log_table_256 +__libm_log_table_256: + .long 0x2779c19c,0x3e057562 + .long 0x00000000,0x3f600401 + .long 0x540e0a5d,0x3df4586b + .long 0x00000000,0x3f781212 + .long 0x5df1d574,0x3e3f2d06 + .long 0x00000000,0x3f841929 + .long 0xe0cc0310,0x3e3098eb + .long 0x00000000,0x3f8c3173 + .long 0x861d36aa,0x3e1ac733 + .long 0x00000000,0x3f91a6b9 + .long 0x0e5dc270,0x3e3766b0 + .long 0x00000000,0x3f95ba9a + .long 0xcf80538b,0x3dfd0c97 + .long 0x00000000,0x3f99d2a8 + .long 0x01095e5d,0x3e22cbcc + .long 0x00000000,0x3f9d6b27 + .long 0x5531753a,0x3e5433bf + .long 0x00000000,0x3fa0c58f + .long 0x86a4cae2,0x3e4e32f3 + .long 0x00000000,0x3fa2954c + .long 0x2b382296,0x3e36d4b6 + .long 0x00000000,0x3fa4a94d + .long 0x6b08209f,0x3e5e5a97 + .long 0x00000000,0x3fa67c94 + .long 0x0d02a20b,0x3e56c61e + .long 0x00000000,0x3fa85188 + .long 0xe988d46e,0x3e57ce75 + .long 0x00000000,0x3faa6b8a + .long 0x78fa4c28,0x3e0bdcaa + .long 0x00000000,0x3fac441e + .long 0x069e5bd9,0x3e23606d + .long 0x00000000,0x3fae1e67 + .long 0x008c9838,0x3e21ab93 + .long 0x00000000,0x3faffa69 + .long 0xc0123f2a,0x3e638bb4 + .long 0x00000000,0x3fb0ec13 + .long 0x42c9365e,0x3e590f46 + .long 0x00000000,0x3fb1dbd2 + .long 0xe38bd0cb,0x3e609fcb + .long 0x00000000,0x3fb2cc72 + .long 0xcc85ea5e,0x3e64fa3d + .long 0x00000000,0x3fb3bdf5 + .long 0xb814e378,0x3e5ea804 + .long 0x00000000,0x3fb4b05d + .long 0xc07f6cbe,0x3e5f3ad5 + .long 0x00000000,0x3fb580db + .long 0x4f332994,0x3e6126cb + .long 0x00000000,0x3fb674f0 + .long 0x46bb18e7,0x3e4635ab + .long 0x00000000,0x3fb769ef + .long 0x23f3f334,0x3e43a835 + .long 0x00000000,0x3fb85fd9 + .long 0x622b8758,0x3e575652 + .long 0x00000000,0x3fb9335e + .long 0xfa6531cd,0x3e406472 + .long 0x00000000,0x3fba2b02 + .long 0xd57cb81c,0x3e658350 + .long 0x00000000,0x3fbb0004 + .long 0x843191b0,0x3e5da7f2 + .long 0x00000000,0x3fbbf968 + .long 0x750465fd,0x3e67fdc2 + .long 0x00000000,0x3fbccfed + .long 0xa89401fa,0x3e58e111 + .long 0x00000000,0x3fbda727 + .long 0xde61a8fd,0x3e5ff843 + .long 0x00000000,0x3fbea325 + .long 0xbcbe8b53,0x3e6fdb7f + .long 0x00000000,0x3fbf7be9 + .long 0x7ce635d5,0x3e64bfc9 + .long 0x00000000,0x3fc02ab3 + .long 0x133742da,0x3e65e748 + .long 0x00000000,0x3fc097ce + .long 0x8f7bc671,0x3e7044fc + .long 0x00000000,0x3fc1178e + .long 0xcce888b8,0x3e6f6fb3 + .long 0x00000000,0x3fc18574 + .long 0xa08b164f,0x3e52f92e + .long 0x00000000,0x3fc1f3b9 + .long 0x56b4e87b,0x3e4e6ddf + .long 0x00000000,0x3fc2625d + .long 0x73ad9970,0x3e390d02 + .long 0x00000000,0x3fc2d161 + .long 0x85c23082,0x3e72e822 + .long 0x00000000,0x3fc340c5 + .long 0xaa42e1ae,0x3e69d5fc + .long 0x00000000,0x3fc3b08b + .long 0x06ed14f1,0x3e306f00 + .long 0x00000000,0x3fc40dfb + .long 0xef836a49,0x3e7d194b + .long 0x00000000,0x3fc47e74 + .long 0xbc83d21d,0x3e7ec8cd + .long 0x00000000,0x3fc4ef51 + .long 0xa2c28034,0x3e7c0574 + .long 0x00000000,0x3fc56092 + .long 0x3530a5ba,0x3e65f35d + .long 0x00000000,0x3fc5d238 + .long 0xbb20ab0e,0x3e5b99ae + .long 0x00000000,0x3fc6313a + .long 0x706cb199,0x3e7b577a + .long 0x00000000,0x3fc6a399 + .long 0x8350bc53,0x3e7ba79c + .long 0x00000000,0x3fc70337 + .long 0x274badf2,0x3e428f61 + .long 0x00000000,0x3fc77654 + .long 0x16849fa4,0x3e550581 + .long 0x00000000,0x3fc7e9d8 + .long 0x4baffaa4,0x3e6d67d4 + .long 0x00000000,0x3fc84a6b + .long 0x61fae141,0x3e7abeb4 + .long 0x00000000,0x3fc8ab47 + .long 0x0369cf31,0x3e7212cb + .long 0x00000000,0x3fc91fe4 + .long 0x9d5bb3d2,0x3e60046a + .long 0x00000000,0x3fc98163 + .long 0x904d6866,0x3e2c2259 + .long 0x00000000,0x3fc9f6c4 + .long 0xa19f5411,0x3e549a47 + .long 0x00000000,0x3fca58e7 + .long 0x759a5351,0x3e7862d2 + .long 0x00000000,0x3fcabb55 + .long 0xf400c4b3,0x3e62467b + .long 0x00000000,0x3fcb1e10 + .long 0xf9503717,0x3e727c6c + .long 0x00000000,0x3fcb94ee + .long 0xabdf1b3f,0x3e780cea + .long 0x00000000,0x3fcbf851 + .long 0xe97aab9f,0x3e652fc8 + .long 0x00000000,0x3fcc5c02 + .long 0x8a4a9e8b,0x3e793b67 + .long 0x00000000,0x3fccc000 + .long 0xce7d8064,0x3e73390a + .long 0x00000000,0x3fcd244d + .long 0x2835ff73,0x3e5fd97a + .long 0x00000000,0x3fcd88e9 + .long 0x804954d6,0x3e5bf577 + .long 0x00000000,0x3fcdedd4 + .long 0x024244ec,0x3e7ffce2 + .long 0x00000000,0x3fce530e + .long 0x7137ba40,0x3e4648b9 + .long 0x00000000,0x3fceb89a + .long 0x7bcea6d1,0x3e7f5bf3 + .long 0x00000000,0x3fcf1e75 + .long 0x1abc74cf,0x3e5756be + .long 0x00000000,0x3fcf84a3 + .long 0xe6831bc0,0x3e59f503 + .long 0x00000000,0x3fcfeb22 + .long 0x83851858,0x3e88e06b + .long 0x00000000,0x3fd028f9 + .long 0x6b43c71e,0x3e8c1b2c + .long 0x00000000,0x3fd05c8b + .long 0xf2ea89fa,0x3e81f15c + .long 0x00000000,0x3fd085eb + .long 0x2224e892,0x3e8c65a3 + .long 0x00000000,0x3fd0b9c8 + .long 0x20336a5b,0x3e782de0 + .long 0x00000000,0x3fd0edd0 + .long 0x8fdd9770,0x3e733c01 + .long 0x00000000,0x3fd12202 + .long 0x9a817c85,0x3e824f5d + .long 0x00000000,0x3fd14be2 + .long 0x5be801bd,0x3e81de31 + .long 0x00000000,0x3fd18061 + .long 0xc766b993,0x3e87c5f8 + .long 0x00000000,0x3fd1b50b + .long 0x85a1f823,0x3e88f9e4 + .long 0x00000000,0x3fd1df4c + .long 0x350fbd75,0x3e7b43ae + .long 0x00000000,0x3fd21445 + .long 0x4920ddbb,0x3e8323d7 + .long 0x00000000,0x3fd23ec5 + .long 0x5f6600ba,0x3e83f0e1 + .long 0x00000000,0x3fd2740d + .long 0x4073b3be,0x3e8579bf + .long 0x00000000,0x3fd29ecd + .long 0x72f2232b,0x3e256e67 + .long 0x00000000,0x3fd2d466 + .long 0x3a896d5f,0x3e8609d5 + .long 0x00000000,0x3fd2ff66 + .long 0x8ddf913a,0x3e72cd56 + .long 0x00000000,0x3fd33550 + .long 0xd7253e69,0x3e77b113 + .long 0x00000000,0x3fd36092 + .long 0xce9e941f,0x3e88666f + .long 0x00000000,0x3fd38bf1 + .long 0x60ed52d8,0x3e7dcccc + .long 0x00000000,0x3fd3c252 + .long 0x0f983d68,0x3e78f05a + .long 0x00000000,0x3fd3edf4 + .long 0x6390dbb2,0x3e61eaf4 + .long 0x00000000,0x3fd419b4 + .long 0xe916a76d,0x3e8c0a73 + .long 0x00000000,0x3fd44591 + .long 0x2b59a2e0,0x3e7d6dbc + .long 0x00000000,0x3fd47c91 + .long 0xc24fc7a2,0x3e70554a + .long 0x00000000,0x3fd4a8b3 + .long 0x33faf275,0x3e821120 + .long 0x00000000,0x3fd4d4f3 + .long 0x2cfac6d3,0x3e81b43f + .long 0x00000000,0x3fd50152 + .long 0x3d98a28d,0x3e78d1f5 + .long 0x00000000,0x3fd52dd0 + .long 0x44e3b5b4,0x3e6e3dc5 + .long 0x00000000,0x3fd55a6d + .long 0x2c814b0b,0x3e658895 + .long 0x00000000,0x3fd5925d + .long 0x6c7ee0a5,0x3e7ad50f + .long 0x00000000,0x3fd5bf40 + .long 0xd6e34245,0x3e6eae1a + .long 0x00000000,0x3fd5ec43 + .long 0x83dd4a7f,0x3e89b605 + .long 0x00000000,0x3fd61965 + .long 0xa87b925b,0x3e724d6c + .long 0x00000000,0x3fd646a8 + .long 0xd28ed1d3,0x3e8ba63b + .long 0x00000000,0x3fd6740a + .long 0x18a4a613,0x3e86e94b + .long 0x00000000,0x3fd6a18d + .long 0xb0b244a7,0x3e3619c3 + .long 0x00000000,0x3fd6cf31 + .long 0x173b6f5e,0x3e8d0a5e + .long 0x00000000,0x3fd6f180 + .long 0x3be91c4c,0x3e7c6e25 + .long 0x00000000,0x3fd71f5d + .long 0xab8359ed,0x3e8dfacd + .long 0x00000000,0x3fd74d5a + .long 0x6fb93ec4,0x3e82457a + .long 0x00000000,0x3fd77b79 + .long 0x3c4bbc8b,0x3e8113e3 + .long 0x00000000,0x3fd7a9b9 + .long 0x31fa7741,0x3e2bf5b5 + .long 0x00000000,0x3fd7d81b + .long 0x186f4789,0x3e69c139 + .long 0x00000000,0x3fd8069e + .long 0x7956aae8,0x3e8a7df1 + .long 0x00000000,0x3fd82996 + .long 0xfeab799a,0x3e7ddb72 + .long 0x00000000,0x3fd85855 + .long 0x33b8ef04,0x3e760c9f + .long 0x00000000,0x3fd88736 + .long 0x19dccb10,0x3e82e757 + .long 0x00000000,0x3fd8aa75 + .long 0x9c910289,0x3e8b9104 + .long 0x00000000,0x3fd8d992 + .long 0xa230be1d,0x3e8d4fb2 + .long 0x00000000,0x3fd908d2 + .long 0xcac1703a,0x3e8cf381 + .long 0x00000000,0x3fd92c59 + .long 0xb4a553e7,0x3e743b8f + .long 0x00000000,0x3fd95bd7 + .long 0x5b5274b7,0x3e51a3ee + .long 0x00000000,0x3fd98b78 + .long 0x0d70a52d,0x3e8e67a8 + .long 0x00000000,0x3fd9af47 + .long 0x4f0d2c7f,0x3e483229 + .long 0x00000000,0x3fd9df27 + .long 0xb48f7d3d,0x3e8da29f + .long 0x00000000,0x3fda0325 + .long 0xc6457f9d,0x3e2127d3 + .long 0x00000000,0x3fda3344 + .long 0xe0b95e88,0x3e77a030 + .long 0x00000000,0x3fda5772 + .long 0x991f7846,0x3e565dd1 + .long 0x00000000,0x3fda87d0 + .long 0x256f237b,0x3e7b00fe + .long 0x00000000,0x3fdaac2e + .long 0xa0437713,0x3e7bf7da + .long 0x00000000,0x3fdadccc + .long 0xc8192dd8,0x3e6f58f3 + .long 0x00000000,0x3fdb015b + .long 0xa41f8565,0x3e6d31ac + .long 0x00000000,0x3fdb323a + .long 0x25494b61,0x3e3118a4 + .long 0x00000000,0x3fdb56fa + .long 0x92694e9d,0x3e84cb37 + .long 0x00000000,0x3fdb881a + .long 0x2c99792a,0x3e8de7b6 + .long 0x00000000,0x3fdbad0b + .long 0x85ec7449,0x3e82ef03 + .long 0x00000000,0x3fdbd212 + .long 0x0c4250d7,0x3e6b7844 + .long 0x00000000,0x3fdc0392 + .long 0xfce511d5,0x3e5e4d32 + .long 0x00000000,0x3fdc28cb + .long 0x78348ca5,0x3e8708e4 + .long 0x00000000,0x3fdc4e19 + .long 0x992488fb,0x3e88e8aa + .long 0x00000000,0x3fdc7ff9 + .long 0xc144344b,0x3e793a76 + .long 0x00000000,0x3fdca57b + .long 0x5f7d6efe,0x3e44b9d7 + .long 0x00000000,0x3fdccb13 + .long 0x4de9f3e0,0x3e8a31e6 + .long 0x00000000,0x3fdcf0c0 + .long 0x80488966,0x3e7d6d68 + .long 0x00000000,0x3fdd2320 + .long 0x9add7f4d,0x3e71b7be + .long 0x00000000,0x3fdd4902 + .long 0xb9ac5131,0x3e8231a4 + .long 0x00000000,0x3fdd6efa + .long 0x4bdc3bac,0x3e7c1eb9 + .long 0x00000000,0x3fdd9509 + .long 0xaa85604a,0x3e8fd258 + .long 0x00000000,0x3fddbb2e + .long 0x57753a10,0x3e6a22f2 + .long 0x00000000,0x3fddee2f + .long 0xcd94df8d,0x3e5a2726 + .long 0x00000000,0x3fde148a + .long 0x7ff6aa8c,0x3e4493fe + .long 0x00000000,0x3fde3afc + .long 0xb6cae4c0,0x3e6036a8 + .long 0x00000000,0x3fde6185 + .long 0x546c92af,0x3e7e208f + .long 0x00000000,0x3fde8825 + .long 0x8619d6bd,0x3e67564c + .long 0x00000000,0x3fdeaedd + .long 0xf8b97910,0x3e77d0da + .long 0x00000000,0x3fded5ac + .long 0x5c542068,0x3e6368b5 + .long 0x00000000,0x3fdefc93 + .long 0xbff8880b,0x3e8442ae + .long 0x00000000,0x3fdf2391 + .long 0x259bcade,0x3e8dc063 + .long 0x00000000,0x3fdf4aa7 + .long 0xd802b8c4,0x3e63e185 + .long 0x00000000,0x3fdf71d6 + .long 0xde5f6650,0x3e7b2cec + .long 0x00000000,0x3fdf991c + .long 0x21ff49a1,0x3e8b4d35 + .long 0x00000000,0x3fdfc07a + .long 0xa7c2b8c5,0x3e81d607 + .long 0x00000000,0x3fdfe7f1 + .long 0x0b9d6ee5,0x3e84f140 + .long 0x00000000,0x3fe007c0 + .long 0xd0756a93,0x3e70cc52 + .long 0x00000000,0x3fe01b94 + .long 0x3aad0772,0x3e800319 + .long 0x00000000,0x3fe02f74 + .long 0x759dd00c,0x3e97cec0 + .long 0x00000000,0x3fe04360 + .long 0xc67418f8,0x3e9588ff + .long 0x00000000,0x3fe05759 + .long 0x51e8da67,0x3e6911cf + .long 0x00000000,0x3fe06b5f + .long 0xa048907b,0x3e44cf15 + .long 0x00000000,0x3fe078bf + .long 0xc39803ff,0x3e8a1f9e + .long 0x00000000,0x3fe08cd9 + .long 0x06525ba1,0x3e8d33e4 + .long 0x00000000,0x3fe0a100 + .long 0x3b46098d,0x3e7d11a2 + .long 0x00000000,0x3fe0b534 + .long 0x39b814fa,0x3e991286 + .long 0x00000000,0x3fe0c974 + .long 0x432f7532,0x3e782dcc + .long 0x00000000,0x3fe0ddc2 + .long 0x4618affd,0x3e82ebf2 + .long 0x00000000,0x3fe0eb52 + .long 0x1d77bbef,0x3e8084e9 + .long 0x00000000,0x3fe0ffb5 + .long 0xcfaf1c2c,0x3e7ed4be + .long 0x00000000,0x3fe11425 + .long 0xbfce7a70,0x3e83c766 + .long 0x00000000,0x3fe128a2 + .long 0x1930b4c4,0x3e84afc2 + .long 0x00000000,0x3fe13652 + .long 0x4b441313,0x3e862d2a + .long 0x00000000,0x3fe14ae5 + .long 0xcb6b7c9c,0x3e94338e + .long 0x00000000,0x3fe15f85 + .long 0xfd3aea12,0x3e7c608c + .long 0x00000000,0x3fe16d4d + .long 0x266a0b45,0x3e9841ba + .long 0x00000000,0x3fe18203 + .long 0xe75899eb,0x3e978963 + .long 0x00000000,0x3fe196c7 + .long 0x9e2b1260,0x3e7c5bd1 + .long 0x00000000,0x3fe1a4a7 + .long 0xa79bc2a5,0x3e98192c + .long 0x00000000,0x3fe1b981 + .long 0x0d5eb986,0x3e9d1762 + .long 0x00000000,0x3fe1ce69 + .long 0x28836a17,0x3e93bc0d + .long 0x00000000,0x3fe1dc61 + .long 0xb47416ca,0x3e9455a1 + .long 0x00000000,0x3fe1f160 + .long 0xdf997414,0x3e8dd01c + .long 0x00000000,0x3fe2066d + .long 0x72755e61,0x3e9748f4 + .long 0x00000000,0x3fe2147d + .long 0x586cc870,0x3e978bd7 + .long 0x00000000,0x3fe229a1 + .long 0x05ced5b8,0x3e90834a + .long 0x00000000,0x3fe237c1 + .long 0xb34d2934,0x3e9cdf01 + .long 0x00000000,0x3fe24cfc + .long 0xd891ba01,0x3e857355 + .long 0x00000000,0x3fe25b2c + .long 0x103a61e4,0x3e8357df + .long 0x00000000,0x3fe2707f + .long 0x7071361a,0x3e908594 + .long 0x00000000,0x3fe285e0 + .long 0xdcc2f0a7,0x3e81c22d + .long 0x00000000,0x3fe29429 + .long 0xc30f37c8,0x3e89c2bf + .long 0x00000000,0x3fe2a9a2 + .long 0x604c3ff4,0x3e76468e + .long 0x00000000,0x3fe2b7fb + .long 0x7d42bf88,0x3e88e57d + .long 0x00000000,0x3fe2c65a + .long 0xd0b235f1,0x3e85ec37 + .long 0x00000000,0x3fe2dbf5 + .long 0xca965170,0x3e987f2e + .long 0x00000000,0x3fe2ea64 + .long 0xb996d64e,0x3e71b426 + .long 0x00000000,0x3fe30018 + .long 0xb998ef97,0x3e9d3516 + .long 0x00000000,0x3fe30e97 + .long 0x9d3de3b9,0x3e9d7ba6 + .long 0x00000000,0x3fe32463 + .long 0xcad27856,0x3e78a56b + .long 0x00000000,0x3fe332f4 + .long 0x9f9e227c,0x3e5ce8c9 + .long 0x00000000,0x3fe348d9 + .long 0xadb2d775,0x3e9f1887 + .long 0x00000000,0x3fe35779 + .long 0x53263e64,0x3e92c34d + .long 0x00000000,0x3fe36621 + .long 0xcd4571cb,0x3e93e786 + .long 0x00000000,0x3fe37c29 + .long 0xe748544b,0x3e671976 + .long 0x00000000,0x3fe38ae2 + .long 0xf9cce311,0x3e85e980 + .long 0x00000000,0x3fe399a1 + .long 0x3a222092,0x3e9fcef7 + .long 0x00000000,0x3fe3afcc + .long 0xed5008bd,0x3e840d4c + .long 0x00000000,0x3fe3be9d + .long 0x1452e9ec,0x3e901695 + .long 0x00000000,0x3fe3cd74 + .long 0xb62b2ce8,0x3e7c8c7b + .long 0x00000000,0x3fe3e3c4 + .long 0xd8d571ad,0x3e964fda + .long 0x00000000,0x3fe3f2ac + .long 0x498c3678,0x3e7092e5 + .long 0x00000000,0x3fe4019c + .long 0xc8960bd4,0x3e884e25 + .long 0x00000000,0x3fe41810 + .long 0x5157ce35,0x3e84637d + .long 0x00000000,0x3fe42711 + .long 0xafcc2a6b,0x3e8384ad + .long 0x00000000,0x3fe43619 + .long 0x9a4ffe6d,0x3e875a3a + .long 0x00000000,0x3fe44528 + .long 0x4e8516c0,0x3e819322 + .long 0x00000000,0x3fe45bcc + .long 0xfe3457c8,0x3e70f88b + .long 0x00000000,0x3fe46aed + .long 0x69a4a836,0x3e73f451 + .long 0x00000000,0x3fe47a15 + .long 0x32f98351,0x3e87bfff + .long 0x00000000,0x3fe48944 + .long 0x06a8d925,0x3e9796d3 + .long 0x00000000,0x3fe4a018 + .long 0xaef076e2,0x3e593acb + .long 0x00000000,0x3fe4af5a + .long 0xd0e13620,0x3e94b7b7 + .long 0x00000000,0x3fe4bea2 + .long 0x88cfb12e,0x3e91e215 + .long 0x00000000,0x3fe4cdf2 + .long 0x0b0cb912,0x3e99f328 + .long 0x00000000,0x3fe4dd49 + .long 0xa0e67b10,0x3e8b9929 + .long 0x00000000,0x3fe4eca8 + .long 0xb401f873,0x3e7e6c75 + .long 0x00000000,0x3fe503c4 + .long 0x15ce5326,0x3e8999ff + .long 0x00000000,0x3fe51335 + .long 0x5f3840b2,0x3e4ce28f + .long 0x00000000,0x3fe522ae + .long 0x2b9988ba,0x3e73433c + .long 0x00000000,0x3fe5322e + .long 0x0122cc5c,0x3e9972f3 + .long 0x00000000,0x3fe541b5 + .long 0xac4eb353,0x3e9fb797 + .long 0x00000000,0x3fe55144 + .long 0x78d26225,0x3e988a2a + .long 0x00000000,0x3fe560db + .long 0x333017fe,0x3e735dc6 + .long 0x00000000,0x3fe5707a + .long 0xff9e8c9a,0x3e5dab71 + .long 0x00000000,0x3fe587f6 + .long 0xe623c257,0x3e92ef91 + .long 0x00000000,0x3fe597a7 + .long 0x715f0d98,0x3e9ac697 + .long 0x00000000,0x3fe5a760 + .long 0x21dc5b09,0x3e9a52be + .long 0x00000000,0x3fe5b721 + .long 0xdf20565e,0x3e928863 + .long 0x00000000,0x3fe5c6ea + .long 0x7afa1d46,0x3e717543 + .long 0x00000000,0x3fe5d6bb + .long 0x71f3b726,0x3e90c8ba + .long 0x00000000,0x3fe5e693 + .long 0xda3470be,0x3e98c345 + .long 0x00000000,0x3fe5f673 + .long 0x24c45894,0x3e9d470b + .long 0x00000000,0x3fe6065b + .long 0x0d6b6214,0x3e9f4f98 + .long 0x00000000,0x3fe6164b + .long 0xe85e3147,0x3e9fd9f2 + .long 0x00000000,0x3fe62643 + .type __libm_log_table_256,@object + .size __libm_log_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/logb_gen.S b/external/sgx_libm/intel64/logb_gen.S new file mode 100644 index 0000000000..d1f8050802 --- /dev/null +++ b/external/sgx_libm/intel64/logb_gen.S @@ -0,0 +1,132 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logb_gen.c" + .text +..TXTST0: +# -- Begin logb + .text + .align 16,0x90 + .globl logb +logb: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_logb.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %edx + andl $2147483647, %edx + lea -1048576(%rdx), %ecx + cmpl $2145386496, %ecx + jb ..B1.7 +..B1.2: + testl %ecx, %ecx + jge ..B1.6 +..B1.3: + movl -8(%rsp), %eax + orl %eax, %edx + je ..B1.8 +..B1.4: + lea _TWO_55(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) + pxor %xmm0, %xmm0 + movl -4(%rsp), %edx + andl $2147483647, %edx + shrl $20, %edx + addl $-1078, %edx + cvtsi2sd %edx, %xmm0 +..B1.5: + ret +..B1.6: + lea _ones(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm1 + mulsd %xmm1, %xmm0 + ret +..B1.7: + shrl $20, %ecx + pxor %xmm0, %xmm0 + addl $-1022, %ecx + cvtsi2sd %ecx, %xmm0 + ret +..B1.8: + lea 8+_ones(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + divsd (%rdx), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type logb,@function + .size logb,.-logb + .data +# -- End logb + .section .rodata, "a" + .align 4 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .type _TWO_55,@object + .size _TWO_55,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/logbf.S b/external/sgx_libm/intel64/logbf.S new file mode 100644 index 0000000000..330dd4f8aa --- /dev/null +++ b/external/sgx_libm/intel64/logbf.S @@ -0,0 +1,123 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logbf.c" + .text +..TXTST0: +# -- Begin logbf + .text + .align 16,0x90 + .globl logbf +logbf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_logbf.1: +..L2: + + movd %xmm0, %eax + movss %xmm0, -8(%rsp) + movl %eax, %edx + andl $2147483647, %edx + addl $-8388608, %edx + cmpl $2130706432, %edx + jb ..B1.7 +..B1.2: + testl %edx, %edx + jge ..B1.6 +..B1.3: + cmpl $-8388608, %edx + je ..B1.8 +..B1.4: + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + movd %xmm0, %eax + movss %xmm0, -8(%rsp) + pxor %xmm0, %xmm0 + andl $2147483647, %eax + shrl $23, %eax + addl $-152, %eax + cvtsi2ss %eax, %xmm0 +..B1.5: + ret +..B1.6: + lea _ones(%rip), %rdx + shrl $31, %eax + movss (%rdx,%rax,4), %xmm1 + mulss %xmm1, %xmm0 + ret +..B1.7: + shrl $23, %edx + pxor %xmm0, %xmm0 + addl $-126, %edx + cvtsi2ss %edx, %xmm0 + ret +..B1.8: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type logbf,@function + .size logbf,.-logbf + .data +# -- End logbf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/logbl.S b/external/sgx_libm/intel64/logbl.S new file mode 100644 index 0000000000..629052bf4f --- /dev/null +++ b/external/sgx_libm/intel64/logbl.S @@ -0,0 +1,165 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logbl.c" + .text +..TXTST0: +# -- Begin logbl + .text + .align 16,0x90 + .globl logbl +logbl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_logbl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %al, %al +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 26(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.7 +..B1.4: + orl $-64768, %ecx + movw %cx, 24(%rsp) +..B1.5: + fldcw 24(%rsp) +..B1.6: + movb $1, %al +..B1.7: + movzwl 56(%rsp), %edx + andl $32767, %edx + cmpl $32767, %edx + je ..B1.16 +..B1.8: + testl %edx, %edx + jne ..B1.11 +..B1.9: + cmpq $0, 48(%rsp) + je ..B1.15 +..B1.10: + fldt 48(%rsp) + lea _TWO_75(%rip), %rdx + fmull (%rdx) + fstpt 48(%rsp) + movzwl 56(%rsp), %ecx + andl $32767, %ecx + addl $-16458, %ecx + movl %ecx, (%rsp) + fildl (%rsp) + fstpt 8(%rsp) + jmp ..B1.12 +..B1.11: + addl $-16383, %edx + movl %edx, (%rsp) + fildl (%rsp) + fstpt 8(%rsp) +..B1.12: + testb %al, %al + je ..B1.14 +..B1.13: + fldcw 26(%rsp) +..B1.14: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.15: + lea 8+_ones(%rip), %rdx + lea _zeros(%rip), %rcx + movsd (%rdx), %xmm0 + divsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 8(%rsp) + jmp ..B1.12 +..B1.16: + fldt 48(%rsp) + lea _ones(%rip), %rcx + movb 57(%rsp), %dl + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + fmull (%rcx,%rsi,8) + fstpt 8(%rsp) + jmp ..B1.12 + .align 16,0x90 + .cfi_endproc + .type logbl,@function + .size logbl,.-logbl + .data +# -- End logbl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/logf_gen.S b/external/sgx_libm/intel64/logf_gen.S new file mode 100644 index 0000000000..9b3bd3f0f8 --- /dev/null +++ b/external/sgx_libm/intel64/logf_gen.S @@ -0,0 +1,234 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logf_gen.c" + .text +..TXTST0: +# -- Begin logf + .text + .align 16,0x90 + .globl logf +logf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_logf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + cmpl $2139095040, %edx + jae ..B1.11 +..B1.2: + lea -1065091072(%rdx), %eax + cmpl $524288, %eax + jae ..B1.7 +..B1.3: + cmpl $1065353216, %edx + jne ..B1.5 +..B1.4: + pxor %xmm3, %xmm3 + jmp ..B1.6 +..B1.5: + movss -8(%rsp), %xmm0 + lea 32+_Q(%rip), %rax + lea 24+_Q(%rip), %rcx + addss .L_2il0floatpacket.0(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + movaps %xmm0, %xmm2 + lea 16+_Q(%rip), %rdx + movsd (%rax), %xmm3 + lea 8+_Q(%rip), %rsi + movsd (%rcx), %xmm1 + lea _Q(%rip), %rdi + mulsd %xmm0, %xmm2 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm1 + addsd (%rdx), %xmm3 + addsd (%rsi), %xmm1 + mulsd %xmm2, %xmm3 + mulsd %xmm0, %xmm1 + addsd %xmm1, %xmm3 + addsd (%rdi), %xmm3 + mulsd %xmm2, %xmm3 + addsd %xmm0, %xmm3 + cvtsd2ss %xmm3, %xmm3 +..B1.6: + movaps %xmm3, %xmm0 + ret +..B1.7: + movl %edx, %esi + movl %edx, %eax + shrl $23, %esi + andl $8388607, %eax + addl $-127, %esi + cmpl $8388608, %edx + jae ..B1.10 +..B1.8: + movl %eax, -8(%rsp) + testl %edx, %edx + je ..B1.19 +..B1.9: + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.2(%rip), %xmm0 + movd %xmm0, %eax + movss %xmm0, -8(%rsp) + movl %eax, %esi + movl %eax, %edx + shrl $23, %esi + addl $-152, %esi +..B1.10: + shrl $15, %edx + orl $1065353216, %eax + movzbl %dl, %r8d + pxor %xmm1, %xmm1 + movl %eax, -8(%rsp) + pxor %xmm0, %xmm0 + movq __libm_rcp_table_256@GOTPCREL(%rip), %rax + lea 8+_P(%rip), %rdx + cvtss2sd -8(%rsp), %xmm1 + cvtss2sd (%rax,%r8,4), %xmm0 + mulsd %xmm0, %xmm1 + lea _P(%rip), %rcx + movsd (%rdx), %xmm0 + pxor %xmm2, %xmm2 + cvtsi2sd %esi, %xmm2 + addsd .L_2il0floatpacket.1(%rip), %xmm1 + mulsd %xmm1, %xmm0 + lea _LN2(%rip), %rsi + mulsd (%rsi), %xmm2 + addsd (%rcx), %xmm0 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movq __libm_logf_table_256@GOTPCREL(%rip), %rdi + addsd %xmm1, %xmm0 + addsd (%rdi,%r8,8), %xmm2 + addsd %xmm2, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.11: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.17 +..B1.12: + testl $-2147483648, %edx + je ..B1.17 +..B1.13: + testl %eax, %eax + jne ..B1.15 +..B1.14: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret +..B1.15: + movss .L_2il0floatpacket.3(%rip), %xmm1 + pxor %xmm0, %xmm0 + mulss %xmm1, %xmm0 +..B1.16: + ret +..B1.17: + movss -8(%rsp), %xmm0 + ret +..B1.19: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type logf,@function + .size logf,.-logf + .data +# -- End logf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x4c000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x7f800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_Q: + .long 4294868184 + .long 3219128319 + .long 1443356411 + .long 1070945621 + .long 823147527 + .long 3218079745 + .long 748089218 + .long 1070176642 + .long 1053536005 + .long 3217353219 + .type _Q,@object + .size _Q,40 + .align 4 +_P: + .long 3879088107 + .long 3219128321 + .long 1754324240 + .long 1070945626 + .type _P,@object + .size _P,16 + .align 4 +_LN2: + .long 4277811695 + .long 1072049730 + .type _LN2,@object + .size _LN2,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/logf_table.S b/external/sgx_libm/intel64/logf_table.S new file mode 100644 index 0000000000..9122ccb3c6 --- /dev/null +++ b/external/sgx_libm/intel64/logf_table.S @@ -0,0 +1,303 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logf_table.c" + .section .rodata, "a" + .align 32 + .align 32 + .globl __libm_logf_table_256 +__libm_logf_table_256: + .long 0x55d5889e,0x3f600401 + .long 0x14586b54,0x3f781212 + .long 0xf96832f0,0x3f841929 + .long 0x84c75f07,0x3f8c3173 + .long 0x1ac73386,0x3f91a6b9 + .long 0x5d9ac03a,0x3f95ba9a + .long 0x074325f4,0x3f99d2a8 + .long 0x25979802,0x3f9d6b27 + .long 0xa19dfaa9,0x3fa0c58f + .long 0x78cbce1b,0x3fa2954c + .long 0x2da96c57,0x3fa4a94d + .long 0xf2d4bb58,0x3fa67c94 + .long 0xb630f068,0x3fa85188 + .long 0xbe73af4c,0x3faa6b8a + .long 0x06f72a9e,0x3fac441e + .long 0x13606d07,0x3fae1e67 + .long 0x11ab9301,0x3faffa69 + .long 0x9c5da601,0x3fb0ec13 + .long 0x643d190b,0x3fb1dbd2 + .long 0x84fe5f1c,0x3fb2cc72 + .long 0xa7d1ee64,0x3fb3bdf5 + .long 0x7aa012e0,0x3fb4b05d + .long 0x7ceb5702,0x3fb580db + .long 0x89365a7a,0x3fb674f0 + .long 0x2c6b568d,0x3fb769ef + .long 0x27506a48,0x3fb85fd9 + .long 0x5d594989,0x3fb9335e + .long 0x20c8e5f5,0x3fba2b02 + .long 0xac1a86ac,0x3fbb0004 + .long 0x769fca11,0x3fbbf968 + .long 0xbfee13a8,0x3fbccfed + .long 0x638446a2,0x3fbda727 + .long 0x7fe10f7a,0x3fbea325 + .long 0xfedbfde6,0x3fbf7be9 + .long 0x52ff25f4,0x3fc02ab3 + .long 0x579d204d,0x3fc097ce + .long 0x8227e47c,0x3fc1178e + .long 0x7dbecf34,0x3fc18574 + .long 0x25f25d41,0x3fc1f3b9 + .long 0x1e6ddf57,0x3fc2625d + .long 0x0c86813a,0x3fc2d161 + .long 0x9741142e,0x3fc340c5 + .long 0x6757f2a9,0x3fc3b08b + .long 0x08378004,0x3fc40dfb + .long 0xe8ca5f7c,0x3fc47e74 + .long 0xf6466de4,0x3fc4ef51 + .long 0xe02ba516,0x3fc56092 + .long 0x57cd74d5,0x3fc5d238 + .long 0x37335d76,0x3fc6313a + .long 0xdabbd383,0x3fc6a399 + .long 0xdd3ce41a,0x3fc70337 + .long 0x128f6127,0x3fc77654 + .long 0x2a0b022d,0x3fc7e9d8 + .long 0x759f512f,0x3fc84a6b + .long 0xd5f5a310,0x3fc8ab47 + .long 0x9096581b,0x3fc91fe4 + .long 0x4011aa76,0x3fc98163 + .long 0x07089664,0x3fc9f6c4 + .long 0x29348f43,0x3fca58e7 + .long 0xc31693ad,0x3fcabb55 + .long 0x4919efd0,0x3fcb1e10 + .long 0x93e367cb,0x3fcb94ee + .long 0xc067555f,0x3fcbf851 + .long 0x54bf23a6,0x3fcc5c02 + .long 0xc9db3c52,0x3fccc000 + .long 0x99c85674,0x3fcd244d + .long 0x3fb2f450,0x3fcd88e9 + .long 0x37eaef01,0x3fcdedd4 + .long 0xffe71012,0x3fce530e + .long 0x1648b971,0x3fceb89a + .long 0xfadf9bde,0x3fcf1e75 + .long 0x2ead7c36,0x3fcf84a3 + .long 0x33ea07cd,0x3fcfeb22 + .long 0xc7035c1c,0x3fd028f9 + .long 0xe0d9635a,0x3fd05c8b + .long 0x8f8ae797,0x3fd085eb + .long 0xe32d1911,0x3fd0b9c8 + .long 0x60b78081,0x3fd0edd0 + .long 0x4cf0063f,0x3fd12202 + .long 0x927aecd4,0x3fd14be2 + .long 0x8ef18adf,0x3fd18061 + .long 0xbe2fc63b,0x3fd1b50b + .long 0xc7cf242d,0x3fd1df4c + .long 0x6d0eb8d4,0x3fd21445 + .long 0x991eba49,0x3fd23ec5 + .long 0x9f870afb,0x3fd2740d + .long 0xabcdfa04,0x3fd29ecd + .long 0x02adccee,0x3fd2d466 + .long 0xb04ea9d4,0x3fd2ff66 + .long 0x4b355a38,0x3fd33550 + .long 0x5ec44f5d,0x3fd36092 + .long 0xc3337e75,0x3fd38bf1 + .long 0x77333184,0x3fd3c252 + .long 0x63c1683e,0x3fd3edf4 + .long 0x23d5e8c7,0x3fd419b4 + .long 0xe0539f49,0x3fd44591 + .long 0x75b6f0ad,0x3fd47c91 + .long 0x41552b09,0x3fd4a8b3 + .long 0x908901a0,0x3fd4d4f3 + .long 0x8da1f968,0x3fd50152 + .long 0x6347d4f6,0x3fd52dd0 + .long 0x3c7b8a8a,0x3fd55a6d + .long 0x2b112a59,0x3fd5925d + .long 0x6b543db2,0x3fd5bf40 + .long 0x3d5c35ae,0x3fd5ec43 + .long 0xcdb02c1f,0x3fd61965 + .long 0x4935b2a2,0x3fd646a8 + .long 0xdd31de95,0x3fd6740a + .long 0xb74a58c5,0x3fd6a18d + .long 0x058670ec,0x3fd6cf31 + .long 0xe852f0ba,0x3fd6f180 + .long 0x71b894f0,0x3fd71f5d + .long 0xefd66d5c,0x3fd74d5a + .long 0x922bd37e,0x3fd77b79 + .long 0x889f19e2,0x3fd7a9b9 + .long 0x037eb6a6,0x3fd7d81b + .long 0x33827231,0x3fd8069e + .long 0xd3ef8bcb,0x3fd82996 + .long 0x776dcbfb,0x3fd85855 + .long 0x58327ccf,0x3fd88736 + .long 0x973ab8cf,0x3fd8aa75 + .long 0xdc8824e5,0x3fd8d992 + .long 0xea7d9512,0x3fd908d2 + .long 0xe79c0e56,0x3fd92c59 + .long 0x50ee3ed3,0x3fd95bd7 + .long 0x11a3ee5b,0x3fd98b78 + .long 0xf33d406c,0x3fd9af47 + .long 0x0c1914a8,0x3fd9df27 + .long 0xed14fda5,0x3fda0325 + .long 0x0224fa79,0x3fda3344 + .long 0x5e80c383,0x3fda5772 + .long 0x165dd199,0x3fda87d0 + .long 0x6c03f896,0x3fdaac2e + .long 0x6fdf6a81,0x3fdadccc + .long 0x3eb1e790,0x3fdb015b + .long 0x3a635948,0x3fdb323a + .long 0x04462909,0x3fdb56fa + .long 0xa659bc93,0x3fdb881a + .long 0xef3db165,0x3fdbad0b + .long 0x97781c2f,0x3fdbd212 + .long 0x36f08819,0x3fdc0392 + .long 0x1e4d32fd,0x3fdc28cb + .long 0xb84723c2,0x3fdc4e19 + .long 0xc74554c9,0x3fdc7ff9 + .long 0x64e9db05,0x3fdca57b + .long 0x0a5cebb0,0x3fdccb13 + .long 0xd18f326f,0x3fdcf0c0 + .long 0x75b5a201,0x3fdd2320 + .long 0x46defa6b,0x3fdd4902 + .long 0x918d25cd,0x3fdd6efa + .long 0x707ae52f,0x3fdd9509 + .long 0xfe92c554,0x3fddbb2e + .long 0x3445e4af,0x3fddee2f + .long 0x1a2726ce,0x3fde148a + .long 0x0a49ff40,0x3fde3afc + .long 0x206d516e,0x3fde6185 + .long 0x78823d52,0x3fde8825 + .long 0x2eac990c,0x3fdeaedd + .long 0x5f436be3,0x3fded5ac + .long 0x26d16ab9,0x3fdefc93 + .long 0xa2157600,0x3fdf2391 + .long 0xee03192d,0x3fdf4aa7 + .long 0x27c30bb0,0x3fdf71d6 + .long 0x6cb3b379,0x3fdf991c + .long 0xda69a910,0x3fdfc07a + .long 0x8eb03d3e,0x3fdfe7f1 + .long 0x53c5002e,0x3fe007c0 + .long 0x2198a5a1,0x3fe01b94 + .long 0x400c64eb,0x3fe02f74 + .long 0xbe7603ad,0x3fe04360 + .long 0xac47fe34,0x3fe05759 + .long 0x1911cf52,0x3fe06b5f + .long 0x0533c568,0x3fe078bf + .long 0x687e7b0e,0x3fe08cd9 + .long 0x74cf9019,0x3fe0a100 + .long 0x3a234477,0x3fe0b534 + .long 0xc89431ce,0x3fe0c974 + .long 0x305b9886,0x3fe0ddc2 + .long 0x4bafc918,0x3fe0eb52 + .long 0x4213a476,0x3fe0ffb5 + .long 0x3da97d9f,0x3fe11425 + .long 0x4f1d9aff,0x3fe128a2 + .long 0x52bf0865,0x3fe13652 + .long 0x58b4a92d,0x3fe14ae5 + .long 0xa19c765b,0x3fe15f85 + .long 0x38c119fa,0x3fe16d4d + .long 0xc20dd133,0x3fe18203 + .long 0xbc4b1f3b,0x3fe196c7 + .long 0x38b7a33c,0x3fe1a4a7 + .long 0xc0c9653d,0x3fe1b981 + .long 0xe8bb106b,0x3fe1ce69 + .long 0x9de06944,0x3fe1dc61 + .long 0xa2ad0da4,0x3fe1f160 + .long 0x7740737e,0x3fe2066d + .long 0xba47a394,0x3fe2147d + .long 0xbc5ebac3,0x3fe229a1 + .long 0x841a502e,0x3fe237c1 + .long 0xe6f80d9a,0x3fe24cfc + .long 0x55cd5762,0x3fe25b2c + .long 0x4d5f7c41,0x3fe2707f + .long 0x842ca384,0x3fe285e0 + .long 0x4708b773,0x3fe29429 + .long 0x670aff0c,0x3fe2a9a2 + .long 0x2c8d1cc1,0x3fe2b7fb + .long 0x6395f5f5,0x3fe2c65a + .long 0x57b0df43,0x3fe2dbf5 + .long 0xc3f97655,0x3fe2ea64 + .long 0x23684d73,0x3fe30018 + .long 0xe9a8b5cd,0x3fe30e97 + .long 0xebdd34ea,0x3fe32463 + .long 0x314ad796,0x3fe332f4 + .long 0x0e7464d0,0x3fe348d9 + .long 0xf8c43d6e,0x3fe35779 + .long 0x961a6a99,0x3fe36621 + .long 0x9f3c366a,0x3fe37c29 + .long 0x171976e7,0x3fe38ae2 + .long 0x57a603e7,0x3fe399a1 + .long 0xfe77b9d1,0x3fe3afcc + .long 0x503533b5,0x3fe3be9d + .long 0x80b4a8a3,0x3fe3cd74 + .long 0x3918f76c,0x3fe3e3c4 + .long 0xb27ed6c7,0x3fe3f2ac + .long 0x2125ca93,0x3fe4019c + .long 0x61389722,0x3fe41810 + .long 0x518df545,0x3fe42711 + .long 0x4e12b6bf,0x3fe43619 + .long 0x5d68ea69,0x3fe44528 + .long 0x464c893a,0x3fe45bcc + .long 0x21f117fc,0x3fe46aed + .long 0x27e8a2d3,0x3fe47a15 + .long 0x5efffccc,0x3fe48944 + .long 0xbcb69835,0x3fe4a018 + .long 0x0c9d65d7,0x3fe4af5a + .long 0xa5bdbe87,0x3fe4bea2 + .long 0x8f10ac47,0x3fe4cdf2 + .long 0xcf994058,0x3fe4dd49 + .long 0x6e64a684,0x3fe4eca8 + .long 0x3cd8eb68,0x3fe503c4 + .long 0x6667fc57,0x3fe51335 + .long 0x0738a3d8,0x3fe522ae + .long 0x26867857,0x3fe5322e + .long 0xcb979809,0x3fe541b5 + .long 0xfdbcbd62,0x3fe55144 + .long 0xc45153c7,0x3fe560db + .long 0x26bb8c66,0x3fe5707a + .long 0x0ed5b900,0x3fe587f6 + .long 0x977c8f31,0x3fe597a7 + .long 0xd634bb8b,0x3fe5a760 + .long 0xd295f10f,0x3fe5b721 + .long 0x94431ef9,0x3fe5c6ea + .long 0x22ea86f6,0x3fe5d6bb + .long 0x8645d390,0x3fe5e693 + .long 0xc61a2ed2,0x3fe5f673 + .long 0xea385926,0x3fe6065b + .long 0xfa7cc06b,0x3fe6164b + .long 0xfecf9743,0x3fe62643 + .type __libm_logf_table_256,@object + .size __libm_logf_table_256,2048 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/logl.S b/external/sgx_libm/intel64/logl.S new file mode 100644 index 0000000000..5479c7e4e0 --- /dev/null +++ b/external/sgx_libm/intel64/logl.S @@ -0,0 +1,66 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logl.c" + .text +..TXTST0: +# -- Begin logl + .text + .align 16,0x90 + .globl logl +logl: +# parameter 1: 8 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_logl.1: +..L2: + + fldt 8(%rsp) + fstpt 8(%rsp) + jmp __libm_logl@PLT + .align 16,0x90 + .cfi_endproc + .type logl,@function + .size logl,.-logl + .data +# -- End logl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/logl_table.S b/external/sgx_libm/intel64/logl_table.S new file mode 100644 index 0000000000..596f44159c --- /dev/null +++ b/external/sgx_libm/intel64/logl_table.S @@ -0,0 +1,559 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "logl_table.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __libm_logl_table_256 +__libm_logl_table_256: + .long 0x55d5a000,0x3f600401 + .long 0xf98e1114,0xbce76218 + .long 0x14588000,0x3f781212 + .long 0xf5a30364,0xbcf4abf1 + .long 0xf9684000,0x3f841929 + .long 0xa8bfb25e,0xbcfa20e2 + .long 0x84c74000,0x3f8c3173 + .long 0x18823013,0x3d0f0660 + .long 0x1ac72000,0x3f91a6b9 + .long 0x36a9c5bb,0x3d13861d + .long 0x5d9ac000,0x3f95ba9a + .long 0xe08d78ac,0x3cacbb84 + .long 0x07434000,0x3f99d2a8 + .long 0xeb1d2ef8,0xbd1a0c1f + .long 0x2597c000,0x3f9d6b27 + .long 0xa1a37071,0xbd23fef6 + .long 0xa19e0000,0x3fa0c58f + .long 0x58b17913,0xbd0559d1 + .long 0x78cbc000,0x3fa2954c + .long 0x570c1572,0x3d1c3526 + .long 0x2da98000,0x3fa4a94d + .long 0xbad48944,0xbd23a98f + .long 0xf2d4c000,0x3fa67c94 + .long 0xec19afa2,0xbd029efb + .long 0xb6310000,0x3fa85188 + .long 0xdf4d03fb,0xbd1f2fd5 + .long 0xbe73c000,0x3faa6b8a + .long 0x5c8ed1b8,0xbd20b3b9 + .long 0x06f74000,0x3fac441e + .long 0x6cf5e5d5,0xbd2561c1 + .long 0x13608000,0x3fae1e67 + .long 0xa4275f13,0xbd22f961 + .long 0x11ab8000,0x3faffa69 + .long 0x98381a8f,0x3d23008c + .long 0x9c5da000,0x3fb0ec13 + .long 0xe54ebd73,0x3d180247 + .long 0x643d2000,0x3fb1dbd2 + .long 0x9a20edb0,0xbd1bd36c + .long 0x84fe6000,0x3fb2cc72 + .long 0x34cd5d84,0xbcec742f + .long 0xa7d1e000,0x3fb3bdf5 + .long 0xa5db4ed7,0x3d2cc85e + .long 0x7aa00000,0x3fb4b05d + .long 0x8ddf26e3,0x3d32e053 + .long 0x7ceb8000,0x3fb580db + .long 0x26833e56,0xbd447f01 + .long 0x89364000,0x3fb674f0 + .long 0x4c9d3302,0x3d3a7999 + .long 0x2c6b8000,0x3fb769ef + .long 0xe71892b5,0xbd44b944 + .long 0x27508000,0x3fb85fd9 + .long 0x19970c1c,0xbd35b818 + .long 0x5d594000,0x3fb9335e + .long 0x3abd47da,0x3d23115c + .long 0x20c90000,0x3fba2b02 + .long 0x9c652090,0xbd3a0b35 + .long 0xac1a8000,0x3fbb0004 + .long 0x037f2b35,0x3d1aaf97 + .long 0x769fc000,0x3fbbf968 + .long 0x8d824283,0x3d24218c + .long 0xbfee0000,0x3fbccfed + .long 0x2fe71256,0x3d33a823 + .long 0x63844000,0x3fbda727 + .long 0x1fa71733,0x3d1a8940 + .long 0x7fe10000,0x3fbea325 + .long 0x47e4627a,0x3d2ef30d + .long 0xfedc0000,0x3fbf7be9 + .long 0x2b2b3bc6,0xbd00d05d + .long 0x52ff2000,0x3fc02ab3 + .long 0x5d569b2b,0x3d27ce63 + .long 0x579d2000,0x3fc097ce + .long 0xda652881,0x3ce33742 + .long 0x82280000,0x3fc1178e + .long 0xcc74be04,0xbd4b8421 + .long 0x7dbec000,0x3fc18574 + .long 0x45bd9b49,0x3d3e6744 + .long 0x25f26000,0x3fc1f3b9 + .long 0x9b083633,0xbd15f74e + .long 0x1e6de000,0x3fc2625d + .long 0xf09e3d82,0xbcf52962 + .long 0x0c868000,0x3fc2d161 + .long 0xcb81b4a1,0x3d039d6c + .long 0x97412000,0x3fc340c5 + .long 0xf7d9d386,0xbd37a3dc + .long 0x67580000,0x3fc3b08b + .long 0xf29320fb,0xbd3aade8 + .long 0x08378000,0x3fc40dfb + .long 0xc4f7b685,0x3c9bb453 + .long 0xe8ca6000,0x3fc47e74 + .long 0xb7020316,0xbcf07c95 + .long 0xf6466000,0x3fc4ef51 + .long 0x21c8cd53,0x3d3bc83d + .long 0xe02bc000,0x3fc56092 + .long 0xfe5d989a,0xbd4ae9eb + .long 0x57cd4000,0x3fc5d238 + .long 0x4b74dcf5,0x3d5a6a61 + .long 0x37334000,0x3fc6313a + .long 0x561bc2b2,0x3d4d7641 + .long 0xdabc0000,0x3fc6a399 + .long 0x399a856a,0xbd563e4d + .long 0xdd3d0000,0x3fc70337 + .long 0x1d685519,0xbd4be57a + .long 0x128f8000,0x3fc77654 + .long 0x520d9718,0xbd4ed8b4 + .long 0x2a0b4000,0x3fc7e9d8 + .long 0x605bf1b1,0xbd5ee97b + .long 0x759f8000,0x3fc84a6b + .long 0x0ab7e182,0xbd5768a0 + .long 0xd5f5c000,0x3fc8ab47 + .long 0xf5f4572e,0xbd4cf028 + .long 0x90964000,0x3fc91fe4 + .long 0x79850e19,0x3d481b4e + .long 0x4011c000,0x3fc98163 + .long 0x30b7dd0f,0xbd458a91 + .long 0x07088000,0x3fc9f6c4 + .long 0x5a19605e,0x3d466413 + .long 0x29348000,0x3fca58e7 + .long 0x504551b1,0x3d3e867d + .long 0xc3168000,0x3fcabb55 + .long 0x9a875994,0x3d43acd2 + .long 0x491a0000,0x3fcb1e10 + .long 0xed340663,0xbd402ffc + .long 0x93e38000,0x3fcb94ee + .long 0x47492dd7,0xbd48357e + .long 0xc0674000,0x3fcbf851 + .long 0xd9fbd5aa,0x3d455ef8 + .long 0x54bf4000,0x3fcc5c02 + .long 0x5184bd39,0xbd4c5a15 + .long 0xc9db4000,0x3fccc000 + .long 0x5d57aff9,0xbd1d6d58 + .long 0x99c84000,0x3fcd244d + .long 0x032241dc,0x3d4673ec + .long 0x3fb30000,0x3fcd88e9 + .long 0x0234bf51,0xbd375f28 + .long 0x37eb0000,0x3fcdedd4 + .long 0x565353b4,0xbd40ff6d + .long 0xffe70000,0x3fce530e + .long 0x276041f4,0x3d401212 + .long 0x1648c000,0x3fceb89a + .long 0x16fee901,0xbd2a3b21 + .long 0xfadfc000,0x3fcf1e75 + .long 0x64bb07ee,0xbd5210c5 + .long 0x2ead8000,0x3fcf84a3 + .long 0xb3098725,0xbd1e5438 + .long 0x33ea0000,0x3fcfeb22 + .long 0xde00938b,0x3d2f3418 + .long 0xc7036000,0x3fd028f9 + .long 0xe9f33100,0xbd2f1eb9 + .long 0xe0d96000,0x3fd05c8b + .long 0xc77ccb58,0x3d2ad0f1 + .long 0x8f8ae000,0x3fd085eb + .long 0x3f45fe7b,0x3d3e5d51 + .long 0xe32d2000,0x3fd0b9c8 + .long 0xedbee0d8,0xbd3bbb62 + .long 0x60b78000,0x3fd0edd0 + .long 0x2d8435f5,0x3d0019b5 + .long 0x4cf02000,0x3fd12202 + .long 0xa2415097,0xbd59c089 + .long 0x927ae000,0x3fd14be2 + .long 0xc85685e2,0x3d49a817 + .long 0x8ef18000,0x3fd18061 + .long 0x1bc9638d,0x3d45be80 + .long 0xbe2fc000,0x3fd1b50b + .long 0x3263201f,0x3d38ecd7 + .long 0xc7cf2000,0x3fd1df4c + .long 0x0455f7e4,0x3d30b43f + .long 0x6d0ea000,0x3fd21445 + .long 0xf5d235d7,0x3d58d43e + .long 0x991ec000,0x3fd23ec5 + .long 0x48a2e522,0xbd36dbe4 + .long 0x9f872000,0x3fd2740d + .long 0xfa32bfeb,0xbd5504cf + .long 0xabce0000,0x3fd29ecd + .long 0x8847bb7a,0xbd37f189 + .long 0x02ade000,0x3fd2d466 + .long 0xbb9aa833,0xbd5311a1 + .long 0xb04ea000,0x3fd2ff66 + .long 0xd5f0c8e9,0x3d43a896 + .long 0x4b356000,0x3fd33550 + .long 0xec6206db,0xbd372206 + .long 0x5ec44000,0x3fd36092 + .long 0xf344bbd1,0x3d4eb929 + .long 0xc3336000,0x3fd38bf1 + .long 0xa0f4a8b7,0x3d5e74f4 + .long 0x77332000,0x3fd3c252 + .long 0x4b606bd6,0x3d5183b5 + .long 0x63c16000,0x3fd3edf4 + .long 0xeb4069e1,0x3d407cc1 + .long 0x23d5e000,0x3fd419b4 + .long 0x6ec90e0a,0x3d418e43 + .long 0xe053a000,0x3fd44591 + .long 0x92923d88,0xbd06e958 + .long 0x75b6e000,0x3fd47c91 + .long 0x8b804f1b,0x3d50ad66 + .long 0x41554000,0x3fd4a8b3 + .long 0xe1791b98,0xbd54f6c0 + .long 0x90890000,0x3fd4d4f3 + .long 0x3a9f1441,0x3d19fd79 + .long 0x8da1e000,0x3fd50152 + .long 0x3694fa6b,0x3d5967d6 + .long 0x6347e000,0x3fd52dd0 + .long 0xeb98a049,0xbd46133a + .long 0x3c7b8000,0x3fd55a6d + .long 0xd6cf85a4,0x3d45138e + .long 0x2b110000,0x3fd5925d + .long 0x4b0b521a,0x3d652c81 + .long 0x6b544000,0x3fd5bf40 + .long 0xeb68981c,0xbd227023 + .long 0x3d5c4000,0x3fd5ec43 + .long 0xf6eb1741,0xbd44a472 + .long 0xcdb04000,0x3fd61965 + .long 0xac078912,0xbd53e115 + .long 0x4935c000,0x3fd646a8 + .long 0x6d25a6ca,0xbd4abc23 + .long 0xdd320000,0x3fd6740a + .long 0xb8b270ac,0xbd60b5c4 + .long 0xb74a8000,0x3fd6a18d + .long 0x67b50a45,0xbd639d6d + .long 0x05868000,0x3fd6cf31 + .long 0xddac7ab9,0xbd4e27a6 + .long 0xe8530000,0x3fd6f180 + .long 0x0a20af33,0xbd4e8c49 + .long 0x71b88000,0x3fd71f5d + .long 0x712fcc92,0x3d54efa4 + .long 0xefd68000,0x3fd74d5a + .long 0x30990150,0xbd52a3e5 + .long 0x922bc000,0x3fd77b79 + .long 0xf6201124,0x3d537dc9 + .long 0x889f4000,0x3fd7a9b9 + .long 0x0dd20a44,0xbd630ed1 + .long 0x037ec000,0x3fd7d81b + .long 0x622fc2c1,0xbd42b381 + .long 0x33828000,0x3fd8069e + .long 0xe1da7992,0xbd4b9e42 + .long 0xd3ef8000,0x3fd82996 + .long 0xae7d64a2,0x3d47956a + .long 0x776e0000,0x3fd85855 + .long 0x0cccc887,0xbd6a02a9 + .long 0x58328000,0x3fd88736 + .long 0x1f7fc497,0xbd2988e2 + .long 0x973ac000,0x3fd8aa75 + .long 0x9e0af65a,0xbd3cc466 + .long 0xdc884000,0x3fd8d992 + .long 0xebb56b23,0xbd5b1b77 + .long 0xea7d8000,0x3fd908d2 + .long 0xf0e513c0,0x3d551185 + .long 0xe79c0000,0x3fd92c59 + .long 0x039fe987,0x3d4cac17 + .long 0x50ee4000,0x3fd95bd7 + .long 0x0649244f,0xbd12d6ab + .long 0x11a3c000,0x3fd98b78 + .long 0x3a5b6609,0x3d672da9 + .long 0xf33d4000,0x3fd9af47 + .long 0x59d98c86,0x3cfae14a + .long 0x0c190000,0x3fd9df27 + .long 0x963f4336,0x3d54a786 + .long 0xed150000,0x3fda0325 + .long 0xb0d5e095,0xbd22dc20 + .long 0x02250000,0x3fda3344 + .long 0x40314305,0xbd361cdd + .long 0x5e80c000,0x3fda5772 + .long 0xd1062b1b,0x3d2c172b + .long 0x165dc000,0x3fda87d0 + .long 0x7845f58e,0x3d51991f + .long 0x6c040000,0x3fdaac2e + .long 0xc856ee3b,0xbd3da90d + .long 0x6fdf8000,0x3fdadccc + .long 0x23b48979,0xbd557ef2 + .long 0x3eb20000,0x3fdb015b + .long 0xa4504de4,0xbd586fcd + .long 0x3a638000,0x3fdb323a + .long 0x7a9aa342,0xbd635be0 + .long 0x04464000,0x3fdb56fa + .long 0xad27be67,0xbd56f6ad + .long 0xa659c000,0x3fdb881a + .long 0x58ba5c9c,0xbd2b65ac + .long 0xef3d8000,0x3fdbad0b + .long 0xe4a81b98,0x3d68b265 + .long 0x97780000,0x3fdbd212 + .long 0xa247841c,0x3d5c2f63 + .long 0x36f08000,0x3fdc0392 + .long 0x435af523,0x3d403109 + .long 0x1e4d4000,0x3fdc28cb + .long 0xdc568214,0xbd4a0635 + .long 0xb8474000,0x3fdc4e19 + .long 0x9ad9f32c,0xbd5c3e5b + .long 0xc7454000,0x3fdc7ff9 + .long 0x47d5b6ca,0x3d54c924 + .long 0x64e9c000,0x3fdca57b + .long 0xd12a2803,0x3d5b0510 + .long 0x0a5d0000,0x3fdccb13 + .long 0x48811a12,0xbd545041 + .long 0xd18f4000,0x3fdcf0c0 + .long 0xc2008d44,0xbd4b2160 + .long 0x75b58000,0x3fdd2320 + .long 0x12cccc3a,0x3d610091 + .long 0x46df0000,0x3fdd4902 + .long 0x0b2c4c2c,0xbd365228 + .long 0x918d4000,0x3fdd6efa + .long 0x7676c78e,0xbd5a329d + .long 0x707ac000,0x3fdd9509 + .long 0x77579caf,0x3d6297b8 + .long 0xfe92c000,0x3fddbb2e + .long 0x0943c435,0x3d3550ac + .long 0x3445c000,0x3fddee2f + .long 0x3a0f9d04,0x3d625775 + .long 0x1a274000,0x3fde148a + .long 0x20732293,0xbd59326b + .long 0x0a4a0000,0x3fde3afc + .long 0x573921f0,0xbd080095 + .long 0x206d4000,0x3fde6185 + .long 0xc9807dcf,0x3d516d95 + .long 0x78824000,0x3fde8825 + .long 0xaa15d3d9,0xbd25726d + .long 0x2eac8000,0x3fdeaedd + .long 0xad7934b2,0x3d590c33 + .long 0x5f438000,0x3fded5ac + .long 0x1bc1c15c,0xbd541d1a + .long 0x26d14000,0x3fdefc93 + .long 0x206858e7,0x3d655c54 + .long 0xa2154000,0x3fdf2391 + .long 0x202b7ba5,0x3d6affe2 + .long 0xee030000,0x3fdf4aa7 + .long 0x56f014a9,0x3d592cde + .long 0x27c30000,0x3fdf71d6 + .long 0xe30f87ad,0x3d47600a + .long 0x6cb38000,0x3fdf991c + .long 0xcca0cdf3,0x3d69bcbe + .long 0xda698000,0x3fdfc07a + .long 0x2683bdae,0x3d6487fd + .long 0x8eb04000,0x3fdfe7f1 + .long 0xceb37e7a,0xbd260f51 + .long 0x53c50000,0x3fe007c0 + .long 0xc9c065f1,0x3cf73add + .long 0x2198a000,0x3fe01b94 + .long 0x5498efb5,0x3d4683ab + .long 0x400c8000,0x3fe02f74 + .long 0xe23775e2,0xbd6b154b + .long 0xbe760000,0x3fe04360 + .long 0x030d58c4,0x3d3d6774 + .long 0xac480000,0x3fe05759 + .long 0x83c1e850,0xbd2cc5f3 + .long 0x1911e000,0x3fe06b5f + .long 0x2598b50b,0xbd60ae17 + .long 0x0533c000,0x3fe078bf + .long 0x907b7d7f,0x3d45a048 + .long 0x687e8000,0x3fe08cd9 + .long 0xc00a19af,0xbd43c67f + .long 0x74cfa000,0x3fe0a100 + .long 0x22f73f90,0xbd5fcd6d + .long 0x3a234000,0x3fe0b534 + .long 0x4c68a7e5,0x3d41da30 + .long 0xc8942000,0x3fe0c974 + .long 0xa7cdcbb8,0x3d61cdc0 + .long 0x305ba000,0x3fe0ddc2 + .long 0x566f7df8,0xbd4de684 + .long 0x4bafc000,0x3fe0eb52 + .long 0x7feb3411,0x3d5230c5 + .long 0x4213a000,0x3fe0ffb5 + .long 0xbeeae6be,0x3d41d77b + .long 0x3da98000,0x3fe11425 + .long 0x3d4743ea,0xbd33050e + .long 0x4f1da000,0x3fe128a2 + .long 0x5906450d,0xbd440318 + .long 0x52bf0000,0x3fe13652 + .long 0xa621d4be,0x3d50c985 + .long 0x58b4a000,0x3fe14ae5 + .long 0x9895512f,0x3d525a20 + .long 0xa19c6000,0x3fe15f85 + .long 0xe4dca81e,0x3d665b5b + .long 0x38c12000,0x3fe16d4d + .long 0xaf71a89e,0xbd481628 + .long 0xc20de000,0x3fe18203 + .long 0x4bb7b8b9,0xbd5d995f + .long 0xbc4b2000,0x3fe196c7 + .long 0x14cec2c3,0xbd18a766 + .long 0x38b7a000,0x3fe1a4a7 + .long 0x26042793,0x3d39e2b1 + .long 0xc0c96000,0x3fe1b981 + .long 0x549461ed,0x3d44f378 + .long 0xe8bb0000,0x3fe1ce69 + .long 0xcc3339e5,0x3d606af5 + .long 0x9de06000,0x3fe1dc61 + .long 0xa1767071,0x3d528836 + .long 0xa2ad0000,0x3fe1f160 + .long 0x6c9de298,0x3d5b4741 + .long 0x77406000,0x3fe2066d + .long 0xd051f38d,0x3d637e65 + .long 0xba47c000,0x3fe2147d + .long 0x0cf5c8e9,0xbd6c6c55 + .long 0xbc5ec000,0x3fe229a1 + .long 0xf20d6e42,0xbd44f266 + .long 0x841a6000,0x3fe237c1 + .long 0xa47dba85,0xbd5fa312 + .long 0xe6f82000,0x3fe24cfc + .long 0xb65cb7bb,0xbd626596 + .long 0x55cd6000,0x3fe25b2c + .long 0x2ff856c0,0xbd513b72 + .long 0x4d5f8000,0x3fe2707f + .long 0xc37d4cdf,0xbd3df8b3 + .long 0x842ca000,0x3fe285e0 + .long 0x866d5f22,0x3d3c1c4d + .long 0x4708c000,0x3fe29429 + .long 0x7aca88eb,0xbd5119e8 + .long 0x670b0000,0x3fe2a9a2 + .long 0x1c2e5d10,0xbd1e7864 + .long 0x2c8d2000,0x3fe2b7fb + .long 0x00c270dd,0xbd39fb3c + .long 0x63960000,0x3fe2c65a + .long 0x03be9586,0xbd5415ea + .long 0x57b0e000,0x3fe2dbf5 + .long 0x07b9dc11,0xbd17a6e5 + .long 0xc3f96000,0x3fe2ea64 + .long 0x8b7d46fa,0x3d6654b2 + .long 0x23686000,0x3fe30018 + .long 0x5363d25e,0xbd628cd2 + .long 0xe9a8c000,0x3fe30e97 + .long 0x06943683,0xbd546671 + .long 0xebdd4000,0x3fe32463 + .long 0xc46cb528,0xbd562c21 + .long 0x314ae000,0x3fe332f4 + .long 0x1ea74541,0xbd50d4b6 + .long 0x0e746000,0x3fe348d9 + .long 0x44f828b5,0x3d433f3c + .long 0xf8c44000,0x3fe35779 + .long 0x22a46dd6,0xbd34934a + .long 0x961a8000,0x3fe36621 + .long 0x0cdd9d24,0xbd6566ce + .long 0x9f3c2000,0x3fe37c29 + .long 0x8e5820fe,0x3d666a2b + .long 0x17198000,0x3fe38ae2 + .long 0x576aad35,0xbd52316f + .long 0x57a60000,0x3fe399a1 + .long 0x62286d89,0x3d3f399c + .long 0xfe77c000,0x3fe3afcc + .long 0xedc1a56f,0xbd48bbbb + .long 0x50352000,0x3fe3be9d + .long 0x22f47589,0x3d63b540 + .long 0x80b4a000,0x3fe3cd74 + .long 0x9ebf0b71,0x3d51452e + .long 0x39190000,0x3fe3e3c4 + .long 0x4c617cda,0xbd512753 + .long 0xb27ec000,0x3fe3f2ac + .long 0x8d68a543,0x3d66c6ab + .long 0x2125c000,0x3fe4019c + .long 0xd9e1e717,0x3d552630 + .long 0x6138a000,0x3fe41810 + .long 0xa1618e8d,0xbd51bb4f + .long 0x518de000,0x3fe42711 + .long 0x38d47013,0x3d65455f + .long 0x4e12c000,0x3fe43619 + .long 0xaca69593,0xbd52819e + .long 0x5d68e000,0x3fe44528 + .long 0xf367503a,0x3d54d27f + .long 0x464ca000,0x3fe45bcc + .long 0xa4ffdcb2,0xbd66c5eb + .long 0x21f12000,0x3fe46aed + .long 0xa0df038b,0xbd50072e + .long 0x27e8a000,0x3fe47a15 + .long 0x83594fab,0x3d369a4a + .long 0x5f000000,0x3fe48944 + .long 0x95dc2343,0xbd39a0cf + .long 0xbcb6a000,0x3fe4a018 + .long 0xdb5ebf58,0xbd4f2ae4 + .long 0x0c9d6000,0x3fe4af5a + .long 0xedc4bac0,0x3d475de0 + .long 0xa5bdc000,0x3fe4bea2 + .long 0xefe50211,0xbd278f64 + .long 0x8f10c000,0x3fe4cdf2 + .long 0x7690ed86,0xbd63b982 + .long 0xcf994000,0x3fe4dd49 + .long 0x24d59d34,0x3d061972 + .long 0x6e64a000,0x3fe4eca8 + .long 0xb1079278,0x3d4a0e67 + .long 0x3cd90000,0x3fe503c4 + .long 0x0f1a734d,0xbd6497fc + .long 0x6667e000,0x3fe51335 + .long 0x4c9987aa,0x3d6c5739 + .long 0x0738a000,0x3fe522ae + .long 0x8164c759,0x3d3ebe70 + .long 0x26868000,0x3fe5322e + .long 0xba2da8ad,0xbd4ea333 + .long 0xcb978000,0x3fe541b5 + .long 0x62e3a6b9,0x3d680916 + .long 0xfdbcc000,0x3fe55144 + .long 0x2b35ba3e,0xbd34ec53 + .long 0xc4518000,0x3fe560db + .long 0x776b86a6,0xbd761cb6 + .long 0x26bb8000,0x3fe5707a + .long 0x5ff9981f,0x3d58ccc0 + .long 0x0ed5c000,0x3fe587f6 + .long 0xe6cce4c9,0xbd4c00c2 + .long 0x977cc000,0x3fe597a7 + .long 0xf6a33533,0xbd786770 + .long 0xd6348000,0x3fe5a760 + .long 0x365e53d9,0x3d7dc57c + .long 0xd2960000,0x3fe5b721 + .long 0x4f6ab8cd,0xbd5de23a + .long 0x94434000,0x3fe5c6ea + .long 0xa68978ec,0xbd70837e + .long 0x22ea8000,0x3fe5d6bb + .long 0xea2eecbe,0x3d4bd7d0 + .long 0x86460000,0x3fe5e693 + .long 0x23677de5,0xbd763831 + .long 0xc61a4000,0x3fe5f673 + .long 0x7a110a0e,0xbd612e5c + .long 0xea384000,0x3fe6065b + .long 0xc49e2cb9,0x3d692622 + .long 0xfa7cc000,0x3fe6164b + .long 0x27c383a0,0x3d0ad6c4 + .long 0xfecfc000,0x3fe62643 + .long 0x3ae25ed1,0xbd745e87 + .type __libm_logl_table_256,@object + .size __libm_logl_table_256,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/lrint_gen.S b/external/sgx_libm/intel64/lrint_gen.S new file mode 100644 index 0000000000..b3d895587c --- /dev/null +++ b/external/sgx_libm/intel64/lrint_gen.S @@ -0,0 +1,88 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lrint_gen.c" + .text +..TXTST0: +# -- Begin lrint + .text + .align 16,0x90 + .globl lrint +lrint: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_lrint.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + movq %rsp, %rbp + .cfi_def_cfa 6, 16 + .cfi_offset 6, -16 + subq $16, %rsp + movq $0, -16(%rbp) + movl $0, -8(%rbp) +..B1.2: + pushq %rax + xorpd %xmm1, %xmm1 + stmxcsr -8(%rbp) + andl $-2, -8(%rbp) + ldmxcsr -8(%rbp) + cvtsd2si %xmm0, %rax + addsd %xmm0, %xmm1 + movq %rax, -16(%rbp) + stmxcsr -8(%rbp) + popq %rax +..B1.3: + movq -16(%rbp), %rax + movq %rbp, %rsp + popq %rbp + .cfi_restore 6 + ret + .align 16,0x90 + .cfi_endproc + .type lrint,@function + .size lrint,.-lrint + .data +# -- End lrint + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lrintf_gen.S b/external/sgx_libm/intel64/lrintf_gen.S new file mode 100644 index 0000000000..984b6174b7 --- /dev/null +++ b/external/sgx_libm/intel64/lrintf_gen.S @@ -0,0 +1,88 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lrintf_gen.c" + .text +..TXTST0: +# -- Begin lrintf + .text + .align 16,0x90 + .globl lrintf +lrintf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_lrintf.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + movq %rsp, %rbp + .cfi_def_cfa 6, 16 + .cfi_offset 6, -16 + subq $16, %rsp + movq $0, -16(%rbp) + movl $0, -8(%rbp) +..B1.2: + pushq %rax + xorpd %xmm1, %xmm1 + stmxcsr -8(%rbp) + andl $-2, -8(%rbp) + ldmxcsr -8(%rbp) + cvtss2si %xmm0, %rax + addss %xmm0, %xmm1 + movq %rax, -16(%rbp) + stmxcsr -8(%rbp) + popq %rax +..B1.3: + movq -16(%rbp), %rax + movq %rbp, %rsp + popq %rbp + .cfi_restore 6 + ret + .align 16,0x90 + .cfi_endproc + .type lrintf,@function + .size lrintf,.-lrintf + .data +# -- End lrintf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lrintl.S b/external/sgx_libm/intel64/lrintl.S new file mode 100644 index 0000000000..6473321dfd --- /dev/null +++ b/external/sgx_libm/intel64/lrintl.S @@ -0,0 +1,314 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lrintl.c" + .text +..TXTST0: +# -- Begin lrintl + .text + .align 16,0x90 + .globl lrintl +lrintl: +# parameter 1: 80 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_lrintl.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + subq $56, %rsp + .cfi_def_cfa_offset 80 + fldt 80(%rsp) + movzbl 89(%rsp), %edi + movzwl 88(%rsp), %r8d + andl $128, %edi + andl $32767, %r8d + shrl $7, %edi + fstpt 32(%rsp) + cmpl $16445, %r8d + jge ..B1.8 +..B1.2: + testl %r8d, %r8d + jne ..B1.6 +..B1.3: + cmpl $0, 84(%rsp) + jne ..B1.5 +..B1.4: + cmpl $0, 80(%rsp) + je ..B1.6 +..B1.5: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 8(%rsp) +..B1.6: + fldt 32(%rsp) + fistpq 16(%rsp) +..B1.7: + movq 16(%rsp), %rax + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.8: + cmpl $16447, %r8d + jge ..B1.21 +..B1.9: + movl %edi, %esi + movq $0x7fffffffffffffff, %rax + addq %rax, %rsi + cmpl $16446, %r8d + jge ..B1.16 +..B1.10: + fnstcw 4(%rsp) +..B1.11: + movl 80(%rsp), %ebx + movl %ebx, %ebp + movzwl 4(%rsp), %r11d + andl $1, %ebp + movl 84(%rsp), %ecx + andl $3072, %r11d + jne ..B1.13 +..B1.12: + movl %ebx, %eax + andl $3, %ebx + movl %ecx, %edx + movl $1, %r9d + cmpl $3, %ebx + movl $0, %ebx + cmovne %ebx, %r9d + shrl $1, %edx + shll $31, %ecx + shrl $1, %eax + orl %eax, %ecx + shlq $32, %rdx + orq %rcx, %rdx + addq %r9, %rdx + jmp ..B1.17 +..B1.13: + movl $1, %eax + xorl %edx, %edx + cmpl $3072, %r11d + cmove %eax, %edx + xorl %r10d, %r10d + cmpl $2048, %r11d + movl %eax, %r9d + cmove %eax, %r10d + testl %edi, %edi + cmove %edi, %r9d + andl %r9d, %r10d + xorl %r9d, %r9d + cmpl $1024, %r11d + cmove %eax, %r9d + xorl %r11d, %r11d + testl %edi, %edi + cmovne %r11d, %eax + orl %r10d, %edx + andl %eax, %r9d + orl %r9d, %edx + je ..B1.15 +..B1.14: + movl %ecx, %edx + shrl $1, %edx + shll $31, %ecx + shrl $1, %ebx + orl %ebx, %ecx + shlq $32, %rdx + orq %rcx, %rdx + jmp ..B1.17 +..B1.15: + movl %ecx, %edx + movl %ebx, %eax + shrl $1, %edx + shll $31, %ecx + shrl $1, %eax + orl %eax, %ecx + shlq $32, %rdx + orq %rcx, %rdx + andq $1, %rbx + addq %rbx, %rdx + jmp ..B1.17 +..B1.16: + movl 84(%rsp), %edx + xorl %ebp, %ebp + shlq $32, %rdx + movl 80(%rsp), %eax + orq %rax, %rdx +..B1.17: + movq %rdx, %rax + xorl %ecx, %ecx + negq %rax + testl %edi, %edi + cmove %rdx, %rax + cmpq %rdx, %rax + setae %cl + cmpq %rsi, %rdx + movl $0, %edx + setbe %dl + testl %edx, %ecx + je ..B1.21 +..B1.18: + testl %ebp, %ebp + je ..B1.20 +..B1.19: + lea _ones(%rip), %rdx + lea _small_value_64(%rip), %rcx + movq %rax, 16(%rsp) + movsd (%rdx), %xmm0 + addsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) +..B1.20: + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.21: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movq $0x8000000000000000, %rcx + cmpl $32767, %r8d + movq %rcx, 16(%rsp) + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 8(%rsp) + jne ..B1.24 +..B1.22: + cmpl $-2147483648, 84(%rsp) + jne ..B1.29 +..B1.23: + cmpl $0, 80(%rsp) + jne ..B1.29 +..B1.24: + fnstcw 2(%rsp) +..B1.25: + movzwl 2(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.26: + orl $-64768, %edx + movw %dx, (%rsp) +..B1.27: + fldcw (%rsp) +..B1.28: + fldcw 2(%rsp) +..B1.29: + movq 16(%rsp), %rax + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lrintl,@function + .size lrintl,.-lrintl + .data +# -- End lrintl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lround_gen.S b/external/sgx_libm/intel64/lround_gen.S new file mode 100644 index 0000000000..95136def07 --- /dev/null +++ b/external/sgx_libm/intel64/lround_gen.S @@ -0,0 +1,138 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lround_gen.c" + .text +..TXTST0: +# -- Begin lround + .text + .align 16,0x90 + .globl lround +lround: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_lround.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) + movq $0, 8(%rsp) + movl $0, 16(%rsp) +..B1.2: + stmxcsr 16(%rsp) + movsd (%rsp), %xmm1 + xorpd %xmm2, %xmm2 + andl $-2, 16(%rsp) + ldmxcsr 16(%rsp) + cvtsd2si %xmm1, %rax + addsd %xmm1, %xmm2 + movq %rax, 8(%rsp) + stmxcsr 16(%rsp) +..B1.3: + testb $1, 16(%rsp) + jne ..B1.6 +..B1.4: + pxor %xmm2, %xmm2 + movq 8(%rsp), %rax + cvtsi2sdq %rax, %xmm2 + movsd (%rsp), %xmm1 + movaps %xmm1, %xmm0 + subsd %xmm2, %xmm0 + andps .L_2il0floatpacket.1(%rip), %xmm0 + ucomisd .L_2il0floatpacket.0(%rip), %xmm0 + jp ..B1.5 + je ..B1.7 +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.6: + movq 8(%rsp), %rax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.7: + pxor %xmm0, %xmm0 + comisd %xmm0, %xmm1 + jbe ..B1.10 +..B1.8: + comisd %xmm2, %xmm1 + jbe ..B1.5 +..B1.9: + incq %rax + movq %rax, 8(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.10: + comisd %xmm1, %xmm2 + jbe ..B1.5 +..B1.11: + decq %rax + movq %rax, 8(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lround,@function + .size lround,.-lround + .data +# -- End lround + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lroundf_gen.S b/external/sgx_libm/intel64/lroundf_gen.S new file mode 100644 index 0000000000..43fd9b79c7 --- /dev/null +++ b/external/sgx_libm/intel64/lroundf_gen.S @@ -0,0 +1,138 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lroundf_gen.c" + .text +..TXTST0: +# -- Begin lroundf + .text + .align 16,0x90 + .globl lroundf +lroundf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_lroundf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movss %xmm0, 16(%rsp) + movq $0, (%rsp) + movl $0, 8(%rsp) +..B1.2: + stmxcsr 8(%rsp) + movsd 16(%rsp), %xmm1 + xorpd %xmm2, %xmm2 + andl $-2, 8(%rsp) + ldmxcsr 8(%rsp) + cvtss2si %xmm1, %rax + addss %xmm1, %xmm2 + movq %rax, (%rsp) + stmxcsr 8(%rsp) +..B1.3: + testb $1, 8(%rsp) + jne ..B1.6 +..B1.4: + pxor %xmm2, %xmm2 + movq (%rsp), %rax + cvtsi2ssq %rax, %xmm2 + movss 16(%rsp), %xmm1 + movaps %xmm1, %xmm0 + subss %xmm2, %xmm0 + andps .L_2il0floatpacket.1(%rip), %xmm0 + ucomiss .L_2il0floatpacket.0(%rip), %xmm0 + jp ..B1.5 + je ..B1.7 +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.6: + movq (%rsp), %rax + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.7: + pxor %xmm0, %xmm0 + comiss %xmm0, %xmm1 + jbe ..B1.10 +..B1.8: + comiss %xmm2, %xmm1 + jbe ..B1.5 +..B1.9: + incq %rax + movq %rax, (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.10: + comiss %xmm1, %xmm2 + jbe ..B1.5 +..B1.11: + decq %rax + movq %rax, (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lroundf,@function + .size lroundf,.-lroundf + .data +# -- End lroundf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x7fffffff,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 4 +.L_2il0floatpacket.0: + .long 0x3f000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/lroundl.S b/external/sgx_libm/intel64/lroundl.S new file mode 100644 index 0000000000..d60f8badfd --- /dev/null +++ b/external/sgx_libm/intel64/lroundl.S @@ -0,0 +1,243 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "lroundl.c" + .text +..TXTST0: +# -- Begin lroundl + .text + .align 16,0x90 + .globl lroundl +lroundl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_lroundl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %dl, %dl +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movb 57(%rsp), %r8b + lea _range(%rip), %rdi + andb $-128, %r8b + shrb $7, %r8b + movzbl %r8b, %eax + movq %rax, %rsi + shlq $4, %rsi + movzwl 56(%rsp), %r9d + andl $32767, %r9d + movzwl 8(%rsi,%rdi), %ecx + andl $32767, %ecx + cmpl %ecx, %r9d + jl ..B1.8 +..B1.4: + jne ..B1.16 +..B1.5: + movl 52(%rsp), %ecx + cmpl 4(%rsi,%rdi), %ecx + jb ..B1.8 +..B1.6: + jne ..B1.16 +..B1.7: + movl 48(%rsp), %ecx + cmpl (%rsi,%rdi), %ecx + ja ..B1.16 +..B1.8: + cmpl $16383, %r9d + jl ..B1.10 +..B1.9: + movl %r9d, %edi + negl %edi + movl 52(%rsp), %r10d + movl %r10d, %eax + movl 48(%rsp), %edx + movl %edx, %esi + shlq $32, %r10 + lea 29(%rdi), %ecx + shrl %cl, %eax + addl $62, %edi + shrl %cl, %esi + cmpl $16414, %r9d + movl %edi, %ecx + cmovl %eax, %esi + orq %rdx, %r10 + andl $1, %esi + shrq %cl, %r10 + addq %rsi, %r10 + movq %r10, %r9 + negq %r9 + testb %r8b, %r8b + cmovne %r9, %r10 + movq %r10, %rax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.10: + cmpl $16382, %r9d + je ..B1.23 +..B1.11: + testl %r9d, %r9d + jne ..B1.15 +..B1.12: + cmpl $0, 52(%rsp) + jne ..B1.14 +..B1.13: + cmpl $0, 48(%rsp) + je ..B1.15 +..B1.14: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rsp) +..B1.15: + xorl %eax, %eax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.16: + lea lres_maxmin(%rip), %rcx + movq (%rcx,%rax,8), %rax + movzwl 34(%rsp), %ecx + movl %ecx, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.20 +..B1.17: + orl $-64768, %ecx + movw %cx, 32(%rsp) +..B1.18: + fldcw 32(%rsp) +..B1.19: + movb $1, %dl +..B1.20: + lea _infs(%rip), %rcx + lea _zeros(%rip), %rsi + testb %dl, %dl + movsd (%rcx), %xmm0 + mulsd (%rsi), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + je ..B1.22 +..B1.21: + fldcw 34(%rsp) +..B1.22: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.23: + lea iones(%rip), %rdx + movslq (%rdx,%rax,4), %rax + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type lroundl,@function + .size lroundl,.-lroundl + .data +# -- End lroundl + .section .rodata, "a" + .align 8 + .align 8 +lres_maxmin: + .long 0xffffffff,0x7fffffff + .long 0x00000000,0x80000000 + .type lres_maxmin,@object + .size lres_maxmin,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 2 +_range: + .word 65534 + .word 65535 + .word 65535 + .word 65535 + .word 16445 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49214 + .word 0 + .word 0 + .word 0 + .type _range,@object + .size _range,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/modf_gen.S b/external/sgx_libm/intel64/modf_gen.S new file mode 100644 index 0000000000..e40486993c --- /dev/null +++ b/external/sgx_libm/intel64/modf_gen.S @@ -0,0 +1,153 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "modf_gen.c" + .text +..TXTST0: +# -- Begin modf + .text + .align 16,0x90 + .globl modf +modf: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_modf.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %r8d + andl $2147483647, %r8d + lea -1072693248(%r8), %edx + cmpl $54525952, %edx + jae ..B1.9 +..B1.2: + movl %r8d, %ecx + shrl $20, %ecx + movl -8(%rsp), %esi + cmpl $1094713344, %r8d + jae ..B1.4 +..B1.3: + negl %ecx + movl $-1, %edx + addl $19, %ecx + shll %cl, %edx + movl %edx, %ecx + andl %eax, %edx + notl %ecx + andl %eax, %ecx + movl %edx, 4(%rdi) + orl %esi, %ecx + movl $0, (%rdi) + jmp ..B1.5 +..B1.4: + negl %ecx + movl $-1, %edx + addl $19, %ecx + shll %cl, %edx + movl %edx, %ecx + andl %esi, %edx + notl %ecx + movl %edx, (%rdi) + andl %esi, %ecx + movl %eax, 4(%rdi) +..B1.5: + testl %ecx, %ecx + je ..B1.7 +..B1.6: + movsd -8(%rsp), %xmm0 + subsd (%rdi), %xmm0 + ret +..B1.7: + lea _zeros(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 +..B1.8: + ret +..B1.9: + shrl $31, %eax + cmpl $2146435072, %r8d + jb ..B1.12 +..B1.10: + addl $-2146435072, %r8d + orl -8(%rsp), %r8d + je ..B1.13 +..B1.11: + movsd -8(%rsp), %xmm0 + addsd %xmm0, %xmm0 + movsd %xmm0, (%rdi) + ret +..B1.12: + cmpl $1072693248, %r8d + jbe ..B1.14 +..B1.13: + movl %eax, %eax + lea _zeros(%rip), %rcx + movq -8(%rsp), %rdx + movq %rdx, (%rdi) + movsd (%rcx,%rax,8), %xmm0 + ret +..B1.14: + lea _zeros(%rip), %rdx + movsd -8(%rsp), %xmm0 + movq (%rdx,%rax,8), %rcx + movq %rcx, (%rdi) + ret + .align 16,0x90 + .cfi_endproc + .type modf,@function + .size modf,.-modf + .data +# -- End modf + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/modff.S b/external/sgx_libm/intel64/modff.S new file mode 100644 index 0000000000..4232ea9187 --- /dev/null +++ b/external/sgx_libm/intel64/modff.S @@ -0,0 +1,126 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "modff.c" + .text +..TXTST0: +# -- Begin modff + .text + .align 16,0x90 + .globl modff +modff: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_modff.1: +..L2: + + movd %xmm0, %esi + movss %xmm0, -8(%rsp) + movl %esi, %ecx + andl $2147483647, %ecx + lea -1065353216(%rcx), %eax + cmpl $192937984, %eax + jae ..B1.6 +..B1.2: + shrl $23, %ecx + movl $-1, %edx + negl %ecx + addl $22, %ecx + shll %cl, %edx + movl %edx, %eax + andl %esi, %edx + notl %eax + movl %edx, (%rdi) + testl %eax, %esi + je ..B1.4 +..B1.3: + subss (%rdi), %xmm0 + ret +..B1.4: + lea _zeros(%rip), %rax + shrl $31, %esi + movss (%rax,%rsi,4), %xmm0 +..B1.5: + ret +..B1.6: + shrl $31, %esi + cmpl $2139095040, %ecx + ja ..B1.11 +..B1.7: + cmpl $1065353216, %ecx + jbe ..B1.9 +..B1.8: + movl %esi, %esi + lea _zeros(%rip), %rdx + movl -8(%rsp), %eax + movl %eax, (%rdi) + movss (%rdx,%rsi,4), %xmm0 + ret +..B1.9: + lea _zeros(%rip), %rax + movss -8(%rsp), %xmm0 + movl (%rax,%rsi,4), %edx + movl %edx, (%rdi) +..B1.10: + ret +..B1.11: + movss -8(%rsp), %xmm0 + addss %xmm0, %xmm0 + movss %xmm0, (%rdi) + ret + .align 16,0x90 + .cfi_endproc + .type modff,@function + .size modff,.-modff + .data +# -- End modff + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/modfl.S b/external/sgx_libm/intel64/modfl.S new file mode 100644 index 0000000000..1788f0b5df --- /dev/null +++ b/external/sgx_libm/intel64/modfl.S @@ -0,0 +1,262 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "modfl.c" + .text +..TXTST0: +# -- Begin modfl + .text + .align 16,0x90 + .globl modfl +modfl: +# parameter 1: 48 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_modfl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 56(%rsp), %ecx + andl $32767, %ecx + cmpl $16446, %ecx + jge ..B1.21 +..B1.4: + cmpl $16383, %ecx + jl ..B1.16 +..B1.5: + fldt 48(%rsp) + cmpl $16415, %ecx + fstpt (%rsp) + jge ..B1.7 +..B1.6: + negl %ecx + movl $-1, %eax + addl $30, %ecx + shll %cl, %eax + movl %eax, %ecx + notl %ecx + movl 52(%rsp), %edx + andl %edx, %ecx + andl %eax, %edx + orl 48(%rsp), %ecx + movl %edx, 52(%rsp) + xorl %edx, %edx + jmp ..B1.8 +..B1.7: + negl %ecx + movl $-1, %edx + addl $30, %ecx + shll %cl, %edx + movl %edx, %ecx + notl %ecx + movl 48(%rsp), %eax + andl %eax, %ecx + andl %eax, %edx +..B1.8: + movl %edx, 48(%rsp) + testl %ecx, %ecx + je ..B1.14 +..B1.9: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.31 +..B1.10: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.11: + fldcw 24(%rsp) +..B1.12: + fldt 48(%rsp) + fstpt (%rdi) + fldt (%rdi) + fldt (%rsp) + fsubp %st, %st(1) + fstpt (%rsp) +..B1.13: + fldcw 26(%rsp) + jmp ..B1.15 +..B1.14: + fldt 48(%rsp) + lea _zeros(%rip), %rdx + movb 57(%rsp), %al + andb $-128, %al + fstpt (%rdi) + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fstpt (%rsp) +..B1.15: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.16: + testl %ecx, %ecx + jne ..B1.20 +..B1.17: + cmpl $0, 52(%rsp) + jne ..B1.19 +..B1.18: + cmpl $0, 48(%rsp) + je ..B1.20 +..B1.19: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 16(%rsp) +..B1.20: + movb 57(%rsp), %al + lea _zeros(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + fstpt (%rdi) + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.21: + cmpl $32767, %ecx + jne ..B1.24 +..B1.22: + cmpl $-2147483648, 52(%rsp) + jne ..B1.25 +..B1.23: + cmpl $0, 48(%rsp) + jne ..B1.25 +..B1.24: + fldt 48(%rsp) + lea _zeros(%rip), %rdx + movb 57(%rsp), %al + andb $-128, %al + shrb $7, %al + fstpt (%rdi) + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.25: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.32 +..B1.26: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.27: + fldcw 24(%rsp) +..B1.28: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) + fldt (%rsp) + fstpt (%rdi) +..B1.29: + fldcw 26(%rsp) +..B1.30: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.31: + fldt 48(%rsp) + fstpt (%rdi) + fldt (%rdi) + fldt (%rsp) + fsubp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.32: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) + fldt (%rsp) + fstpt (%rdi) + jmp ..B1.30 + .align 16,0x90 + .cfi_endproc + .type modfl,@function + .size modfl,.-modfl + .data +# -- End modfl + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nan.S b/external/sgx_libm/intel64/nan.S new file mode 100644 index 0000000000..d5e836144b --- /dev/null +++ b/external/sgx_libm/intel64/nan.S @@ -0,0 +1,144 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nan.c" + .text +..TXTST0: +# -- Begin nanf + .text + .align 16,0x90 + .globl nanf +nanf: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value_nanf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 +..___tag_value_nanf.4: + call __libm_conv_strtoull@PLT +..___tag_value_nanf.5: +..B1.2: + andl $4194303, %eax + orl $2143289344, %eax + movl %eax, (%rsp) + movss (%rsp), %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nanf,@function + .size nanf,.-nanf + .data +# -- End nanf + .text +# -- Begin nan + .text + .align 16,0x90 + .globl nan +nan: +# parameter 1: %rdi +..B2.1: + .cfi_startproc +..___tag_value_nan.8: +..L9: + + pushq %rsi + .cfi_def_cfa_offset 16 +..___tag_value_nan.11: + call __libm_conv_strtoull@PLT +..___tag_value_nan.12: +..B2.2: + movq $0x7ffffffffffff, %rdx + andq %rax, %rdx + movq $0x7ff8000000000000, %rax + orq %rdx, %rax + movq %rax, (%rsp) + movsd (%rsp), %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nan,@function + .size nan,.-nan + .data +# -- End nan + .text +# -- Begin nanl + .text + .align 16,0x90 + .globl nanl +nanl: +# parameter 1: %rdi +..B3.1: + .cfi_startproc +..___tag_value_nanl.15: +..L16: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..___tag_value_nanl.18: + call __libm_conv_strtoull@PLT +..___tag_value_nanl.19: +..B3.5: + movq %rax, %rdx +..B3.2: + movq $0xc000000000000000, %rax + orq %rax, %rdx + movq %rdx, (%rsp) + movl $32767, %edx + movw %dx, 8(%rsp) + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nanl,@function + .size nanl,.-nanl + .data +# -- End nanl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nearbyint_gen.S b/external/sgx_libm/intel64/nearbyint_gen.S new file mode 100644 index 0000000000..b7b32a6eda --- /dev/null +++ b/external/sgx_libm/intel64/nearbyint_gen.S @@ -0,0 +1,435 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nearbyint_gen.c" + .text +..TXTST0: +# -- Begin nearbyint + .text + .align 16,0x90 + .globl nearbyint +nearbyint: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_nearbyint.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + stmxcsr 8(%rsp) +..B1.3: + movzwl 6(%rsp), %esi + andl $32752, %esi + shrl $4, %esi + cmpl $1075, %esi + jge ..B1.62 +..B1.4: + movl 8(%rsp), %eax + andl $24576, %eax + cmpl $8192, %eax + je ..B1.49 +..B1.5: + cmpl $16384, %eax + jne ..B1.19 +..B1.6: + cmpl $1023, %esi + jl ..B1.14 +..B1.7: + cmpl $1043, %esi + jle ..B1.9 +..B1.8: + negl %esi + movl $-1, %edi + addl $19, %esi + movl %esi, %ecx + shll %cl, %edi + movl (%rsp), %eax + andl %eax, %edi + movl %edi, (%rsp) + xorl %eax, %edi + jmp ..B1.10 +..B1.9: + negl %esi + movl $1048575, %eax + addl $19, %esi + movl 4(%rsp), %edx + movl %edx, %edi + movl %esi, %ecx + andl $1048575, %edi + shll %cl, %eax + andl $-1048576, %edx + andl %edi, %eax + orl %eax, %edx + movl %edx, 4(%rsp) + andl $1048575, %edx + xorl %edx, %edi + orl (%rsp), %edi + movl $0, (%rsp) +..B1.10: + testb $-128, 7(%rsp) + jne ..B1.13 +..B1.11: + testl %edi, %edi + je ..B1.13 +..B1.12: + lea _ones(%rip), %rax + movsd (%rsp), %xmm0 + addsd (%rax), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.13: + movsd (%rsp), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.14: + testl %esi, %esi + jne ..B1.18 +..B1.15: + testl $1048575, 4(%rsp) + jne ..B1.18 +..B1.16: + cmpl $0, (%rsp) + je ..B1.13 +..B1.18: + movb 7(%rsp), %al + lea _pone_nzero(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.19: + cmpl $24576, %eax + jne ..B1.26 +..B1.20: + cmpl $1023, %esi + jl ..B1.25 +..B1.21: + cmpl $1043, %esi + jle ..B1.23 +..B1.22: + negl %esi + movl $-1, %eax + addl $19, %esi + movl %esi, %ecx + shll %cl, %eax + andl (%rsp), %eax + jmp ..B1.24 +..B1.23: + negl %esi + movl $1048575, %eax + addl $19, %esi + movl %esi, %ecx + shll %cl, %eax + movl 4(%rsp), %edx + movl %edx, %edi + andl %eax, %edx + andl $-1048576, %edi + andl $1048575, %edx + xorl %eax, %eax + orl %edx, %edi + movl %edi, 4(%rsp) +..B1.24: + movl %eax, (%rsp) + movsd (%rsp), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.25: + movb 7(%rsp), %al + lea _zeros(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.26: + cmpl $1023, %esi + jl ..B1.42 +..B1.27: + movl (%rsp), %eax + cmpl $1043, %esi + jl ..B1.29 +..B1.28: + movl %eax, %edx + lea 13(%rsi), %ecx + shll %cl, %edx + xorl %r9d, %r9d + jmp ..B1.30 +..B1.29: + movl 4(%rsp), %edx + lea 13(%rsi), %ecx + andl $1048575, %edx + movl %eax, %r9d + shll %cl, %edx +..B1.30: + cmpl $1043, %esi + jle ..B1.32 +..B1.31: + negl %esi + movl $-1, %edi + addl $19, %esi + movl %esi, %ecx + shll %cl, %edi + andl %edi, %eax + jmp ..B1.33 +..B1.32: + negl %esi + movl $1048575, %eax + addl $19, %esi + movl %esi, %ecx + shll %cl, %eax + movl 4(%rsp), %edi + movl %edi, %r8d + andl %eax, %edi + andl $-1048576, %r8d + andl $1048575, %edi + xorl %eax, %eax + orl %edi, %r8d + movl %r8d, 4(%rsp) +..B1.33: + movl %eax, (%rsp) + testl %edx, %edx + jge ..B1.13 +..B1.34: + andl $2147483647, %edx + orl %r9d, %edx + jne ..B1.37 +..B1.35: + movzwl 6(%rsp), %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $1043, %ecx + jle ..B1.38 +..B1.36: + negl %ecx + movl $1, %edx + addl $19, %ecx + shll %cl, %edx + testl %edx, %eax + je ..B1.13 +..B1.37: + movb 7(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movsd (%rsp), %xmm0 + movzbl %al, %ecx + addsd (%rdx,%rcx,8), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.38: + negl %ecx + movl $1, %eax + addl $19, %ecx + shll %cl, %eax + testl %eax, 4(%rsp) + je ..B1.13 +..B1.39: + movb 7(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movsd (%rsp), %xmm0 + movzbl %al, %ecx + addsd (%rdx,%rcx,8), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.42: + cmpl $1022, %esi + jg ..B1.48 +..B1.43: + jne ..B1.25 +..B1.44: + movl 4(%rsp), %eax + andl $1048575, %eax + jg ..B1.48 +..B1.45: + jne ..B1.25 +..B1.46: + cmpl $0, (%rsp) + jbe ..B1.25 +..B1.48: + movb 7(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.49: + cmpl $1023, %esi + jl ..B1.57 +..B1.50: + cmpl $1043, %esi + jle ..B1.52 +..B1.51: + negl %esi + movl $-1, %eax + addl $19, %esi + movl %esi, %ecx + shll %cl, %eax + movl (%rsp), %edi + andl %edi, %eax + movl %eax, (%rsp) + xorl %eax, %edi + jmp ..B1.53 +..B1.52: + negl %esi + movl $1048575, %eax + addl $19, %esi + movl 4(%rsp), %edx + movl %edx, %edi + movl %esi, %ecx + andl $1048575, %edi + shll %cl, %eax + andl $-1048576, %edx + andl %edi, %eax + orl %eax, %edx + movl %edx, 4(%rsp) + andl $1048575, %edx + xorl %edx, %edi + orl (%rsp), %edi + movl $0, (%rsp) +..B1.53: + testb $-128, 7(%rsp) + je ..B1.13 +..B1.54: + testl %edi, %edi + je ..B1.13 +..B1.55: + lea 8+_ones(%rip), %rax + movsd (%rsp), %xmm0 + addsd (%rax), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.57: + testl %esi, %esi + jne ..B1.61 +..B1.58: + testl $1048575, 4(%rsp) + jne ..B1.61 +..B1.59: + cmpl $0, (%rsp) + je ..B1.13 +..B1.61: + movb 7(%rsp), %al + lea _pzero_none(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.62: + lea _ones(%rip), %rax + movsd (%rsp), %xmm0 + mulsd (%rax), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nearbyint,@function + .size nearbyint,.-nearbyint + .data +# -- End nearbyint + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_pone_nzero: + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_pzero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _pzero_none,@object + .size _pzero_none,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nearbyintf_gen.S b/external/sgx_libm/intel64/nearbyintf_gen.S new file mode 100644 index 0000000000..06543a1462 --- /dev/null +++ b/external/sgx_libm/intel64/nearbyintf_gen.S @@ -0,0 +1,336 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nearbyintf_gen.c" + .text +..TXTST0: +# -- Begin nearbyintf + .text + .align 16,0x90 + .globl nearbyintf +nearbyintf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_nearbyintf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movss %xmm0, 8(%rsp) +..B1.2: + stmxcsr 4(%rsp) +..B1.3: + movzwl 10(%rsp), %eax + andl $32640, %eax + shrl $7, %eax + cmpl $150, %eax + jge ..B1.10 +..B1.4: + movl 4(%rsp), %edx + andl $24576, %edx + cmpl $8192, %edx + je ..B1.32 +..B1.5: + cmpl $16384, %edx + jne ..B1.15 +..B1.6: + cmpl $127, %eax + jl ..B1.11 +..B1.7: + negl %eax + movl $8388607, %edx + addl $22, %eax + movl 8(%rsp), %esi + movl %esi, %edi + movl %eax, %ecx + andl $8388607, %edi + shll %cl, %edx + andl $-8388608, %esi + andl %edi, %edx + orl %edx, %esi + movl %esi, %eax + andl $8388607, %eax + movl %esi, 8(%rsp) + testl $-2147483648, %esi + jne ..B1.10 +..B1.8: + cmpl %edi, %eax + je ..B1.10 +..B1.9: + movss 8(%rsp), %xmm0 + addss .L_2il0floatpacket.1(%rip), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.10: + movss 8(%rsp), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.11: + testl %eax, %eax + jne ..B1.14 +..B1.12: + testl $8388607, 8(%rsp) + je ..B1.10 +..B1.14: + movb 11(%rsp), %dl + lea _pone_nzero(%rip), %rcx + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + movl 8(%rsp), %eax + movl %eax, (%rsp) + movss (%rcx,%rsi,4), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.15: + cmpl $24576, %edx + jne ..B1.20 +..B1.16: + cmpl $127, %eax + jl ..B1.18 +..B1.17: + negl %eax + movl $8388607, %edx + addl $22, %eax + movl %eax, %ecx + shll %cl, %edx + movl 8(%rsp), %esi + movl %esi, %edi + andl %edx, %esi + andl $-8388608, %edi + andl $8388607, %esi + orl %esi, %edi + movl %edi, 8(%rsp) + movss 8(%rsp), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.18: + movb 11(%rsp), %dl + lea _zeros(%rip), %rcx + andb $-128, %dl + movl 8(%rsp), %eax + movl %eax, (%rsp) + shrb $7, %dl + movzbl %dl, %esi + movss (%rcx,%rsi,4), %xmm0 +..B1.19: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.20: + cmpl $127, %eax + jl ..B1.27 +..B1.21: + movl 8(%rsp), %edi + movl %edi, %esi + andl $8388607, %esi + lea 10(%rax), %ecx + negl %eax + movl %esi, %r8d + addl $22, %eax + movl $8388607, %edx + shll %cl, %r8d + movl %eax, %ecx + shll %cl, %edx + andl $-8388608, %edi + andl %edx, %esi + orl %esi, %edi + movl %edi, 8(%rsp) + testl %r8d, %r8d + jge ..B1.10 +..B1.22: + cmpl $-2147483648, %r8d + jne ..B1.24 +..B1.23: + movzwl 10(%rsp), %ecx + movl $1, %eax + shrl $7, %ecx + negl %ecx + addl $22, %ecx + shll %cl, %eax + testl %eax, 8(%rsp) + je ..B1.10 +..B1.24: + movb 11(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movss 8(%rsp), %xmm0 + movzbl %al, %ecx + addss (%rdx,%rcx,4), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.27: + cmpl $126, %eax + jg ..B1.31 +..B1.28: + jne ..B1.30 +..B1.29: + testl $8388607, 8(%rsp) + jg ..B1.31 +..B1.30: + movb 11(%rsp), %dl + lea _zeros(%rip), %rcx + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + movl 8(%rsp), %eax + movl %eax, (%rsp) + movss (%rcx,%rsi,4), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.31: + movb 11(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.32: + cmpl $127, %eax + jl ..B1.37 +..B1.33: + negl %eax + movl $8388607, %edx + addl $22, %eax + movl 8(%rsp), %esi + movl %esi, %edi + movl %eax, %ecx + andl $8388607, %edi + shll %cl, %edx + andl $-8388608, %esi + andl %edi, %edx + orl %edx, %esi + movl %esi, %eax + andl $8388607, %eax + movl %esi, 8(%rsp) + testl $-2147483648, %esi + je ..B1.10 +..B1.34: + cmpl %edi, %eax + je ..B1.10 +..B1.35: + movss 8(%rsp), %xmm0 + addss .L_2il0floatpacket.0(%rip), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.37: + testl %eax, %eax + jne ..B1.40 +..B1.38: + testl $8388607, 8(%rsp) + je ..B1.10 +..B1.40: + movb 11(%rsp), %dl + lea _pzero_none(%rip), %rcx + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + movl 8(%rsp), %eax + movl %eax, (%rsp) + movss (%rcx,%rsi,4), %xmm0 + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nearbyintf,@function + .size nearbyintf,.-nearbyintf + .data +# -- End nearbyintf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x3f800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_pone_nzero: + .long 1065353216 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_pzero_none: + .long 0 + .long 3212836864 + .type _pzero_none,@object + .size _pzero_none,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nearbyintl.S b/external/sgx_libm/intel64/nearbyintl.S new file mode 100644 index 0000000000..02ceb8f562 --- /dev/null +++ b/external/sgx_libm/intel64/nearbyintl.S @@ -0,0 +1,617 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nearbyintl.c" + .text +..TXTST0: +# -- Begin nearbyintl + .text + .align 16,0x90 + .globl nearbyintl +nearbyintl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_nearbyintl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %dil, %dil +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 56(%rsp), %r8d + andl $32767, %r8d + movzwl 26(%rsp), %r9d + cmpl $16446, %r8d + jge ..B1.95 +..B1.4: + movl %r9d, %eax + andl $3072, %eax + cmpl $1024, %eax + je ..B1.77 +..B1.5: + cmpl $2048, %eax + jne ..B1.24 +..B1.6: + cmpl $16383, %r8d + jl ..B1.19 +..B1.7: + cmpl $16415, %r8d + jl ..B1.9 +..B1.8: + negl %r8d + movl $-1, %edx + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %edx + movl 48(%rsp), %eax + andl %eax, %edx + movl %edx, 48(%rsp) + xorl %eax, %edx + jmp ..B1.10 +..B1.9: + negl %r8d + movl $-1, %edx + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %edx + movl 52(%rsp), %eax + andl %eax, %edx + movl %edx, 52(%rsp) + xorl %eax, %edx + orl 48(%rsp), %edx + movl $0, 48(%rsp) +..B1.10: + testb $-128, 57(%rsp) + jne ..B1.18 +..B1.11: + testl %edx, %edx + je ..B1.18 +..B1.12: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.101 +..B1.13: + orl $-64768, %r9d + movw %r9w, 24(%rsp) +..B1.14: + fldcw 24(%rsp) +..B1.15: + fldt 48(%rsp) + lea _ones(%rip), %rax + faddl (%rax) + fstpt (%rsp) +..B1.16: + fldcw 26(%rsp) +..B1.17: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.18: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.19: + testl %r8d, %r8d + jne ..B1.23 +..B1.20: + cmpq $0, 48(%rsp) + jne ..B1.22 +..B1.21: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.22: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 16(%rsp) +..B1.23: + movb 57(%rsp), %al + lea _pone_nzero(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.24: + cmpl $3072, %eax + jne ..B1.35 +..B1.25: + cmpl $16383, %r8d + jl ..B1.30 +..B1.26: + cmpl $16415, %r8d + jl ..B1.28 +..B1.27: + negl %r8d + movl $-1, %eax + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %eax + andl 48(%rsp), %eax + jmp ..B1.29 +..B1.28: + negl %r8d + movl $-1, %eax + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %eax + andl %eax, 52(%rsp) + xorl %eax, %eax +..B1.29: + movl %eax, 48(%rsp) + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.30: + testl %r8d, %r8d + jne ..B1.34 +..B1.31: + cmpl $0, 52(%rsp) + jne ..B1.33 +..B1.32: + cmpl $0, 48(%rsp) + je ..B1.34 +..B1.33: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 16(%rsp) +..B1.34: + movb 57(%rsp), %al + lea _zeros(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.35: + cmpl $16383, %r8d + jl ..B1.69 +..B1.36: + movl 48(%rsp), %esi + cmpl $16414, %r8d + jl ..B1.38 +..B1.37: + movl %esi, %edx + lea 2(%r8), %ecx + shll %cl, %edx + xorl %eax, %eax + jmp ..B1.39 +..B1.38: + movl 52(%rsp), %edx + lea 2(%r8), %ecx + shll %cl, %edx + movl %esi, %eax +..B1.39: + cmpl $16415, %r8d + jl ..B1.41 +..B1.40: + movl %r8d, %ecx + movl $-1, %r10d + negl %ecx + addl $30, %ecx + shll %cl, %r10d + andl %r10d, %esi + movl %esi, 48(%rsp) + jmp ..B1.42 +..B1.41: + movl %r8d, %ecx + movl $-1, %r10d + negl %ecx + xorl %esi, %esi + addl $30, %ecx + shll %cl, %r10d + movl $0, 48(%rsp) + andl %r10d, 52(%rsp) +..B1.42: + testl %edx, %edx + jge ..B1.68 +..B1.43: + andl $2147483647, %edx + orl %eax, %edx + je ..B1.51 +..B1.44: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.48 +..B1.45: + orl $-64768, %r9d + movw %r9w, 24(%rsp) +..B1.46: + fldcw 24(%rsp) +..B1.47: + movb $1, %dil +..B1.48: + fldt 48(%rsp) + lea _ones(%rip), %rdx + movb 57(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + testb %dil, %dil + faddl (%rdx,%rcx,8) + fstpt (%rsp) + je ..B1.50 +..B1.49: + fldcw 26(%rsp) +..B1.50: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.51: + cmpl $16415, %r8d + jl ..B1.60 +..B1.52: + negl %r8d + movl $1, %eax + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %eax + testl %eax, %esi + je ..B1.68 +..B1.53: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.57 +..B1.54: + orl $-64768, %r9d + movw %r9w, 24(%rsp) +..B1.55: + fldcw 24(%rsp) +..B1.56: + movb $1, %dil +..B1.57: + fldt 48(%rsp) + lea _ones(%rip), %rdx + movb 57(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + testb %dil, %dil + faddl (%rdx,%rcx,8) + fstpt (%rsp) + je ..B1.59 +..B1.58: + fldcw 26(%rsp) +..B1.59: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.60: + negl %r8d + movl $1, %eax + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %eax + testl %eax, 52(%rsp) + je ..B1.68 +..B1.61: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.65 +..B1.62: + orl $-64768, %r9d + movw %r9w, 24(%rsp) +..B1.63: + fldcw 24(%rsp) +..B1.64: + movb $1, %dil +..B1.65: + fldt 48(%rsp) + lea _ones(%rip), %rdx + movb 57(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + testb %dil, %dil + faddl (%rdx,%rcx,8) + fstpt (%rsp) + je ..B1.67 +..B1.66: + fldcw 26(%rsp) +..B1.67: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.68: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.69: + cmpl $16382, %r8d + jg ..B1.76 +..B1.70: + je ..B1.102 +..B1.71: + testl %r8d, %r8d + jne ..B1.75 +..B1.72: + cmpl $0, 52(%rsp) + jne ..B1.74 +..B1.73: + cmpl $0, 48(%rsp) + je ..B1.75 +..B1.74: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 16(%rsp) +..B1.75: + movb 57(%rsp), %al + lea _zeros(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.76: + movb 57(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.77: + cmpl $16383, %r8d + jl ..B1.90 +..B1.78: + cmpl $16415, %r8d + jl ..B1.80 +..B1.79: + negl %r8d + movl $-1, %eax + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %eax + movl 48(%rsp), %edx + andl %edx, %eax + movl %eax, 48(%rsp) + xorl %eax, %edx + jmp ..B1.81 +..B1.80: + negl %r8d + movl $-1, %eax + addl $30, %r8d + movl %r8d, %ecx + shll %cl, %eax + movl 52(%rsp), %edx + andl %edx, %eax + xorl %eax, %edx + orl 48(%rsp), %edx + movl %eax, 52(%rsp) + movl $0, 48(%rsp) +..B1.81: + testb $-128, 57(%rsp) + je ..B1.89 +..B1.82: + testl %edx, %edx + je ..B1.89 +..B1.83: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.105 +..B1.84: + orl $-64768, %r9d + movw %r9w, 24(%rsp) +..B1.85: + fldcw 24(%rsp) +..B1.86: + fldt 48(%rsp) + lea 8+_ones(%rip), %rax + faddl (%rax) + fstpt (%rsp) +..B1.87: + fldcw 26(%rsp) +..B1.88: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.89: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.90: + testl %r8d, %r8d + jne ..B1.94 +..B1.91: + cmpq $0, 48(%rsp) + jne ..B1.93 +..B1.92: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.93: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 16(%rsp) +..B1.94: + movb 57(%rsp), %al + lea _pzero_none(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.95: + movl %r9d, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.106 +..B1.96: + orl $-64768, %r9d + movw %r9w, 24(%rsp) +..B1.97: + fldcw 24(%rsp) +..B1.98: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.99: + fldcw 26(%rsp) +..B1.100: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.101: + fldt 48(%rsp) + lea _ones(%rip), %rax + faddl (%rax) + fstpt (%rsp) + jmp ..B1.17 +..B1.102: + movl 52(%rsp), %eax + cmpl $-2147483648, %eax + ja ..B1.76 +..B1.103: + jne ..B1.75 +..B1.104: + cmpl $0, 48(%rsp) + ja ..B1.76 + jmp ..B1.75 +..B1.105: + fldt 48(%rsp) + lea 8+_ones(%rip), %rax + faddl (%rax) + fstpt (%rsp) + jmp ..B1.88 +..B1.106: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) + jmp ..B1.100 + .align 16,0x90 + .cfi_endproc + .type nearbyintl,@function + .size nearbyintl,.-nearbyintl + .data +# -- End nearbyintl + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_pone_nzero: + .long 0 + .long 1072693248 + .long 0 + .long 2147483648 + .type _pone_nzero,@object + .size _pone_nzero,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_pzero_none: + .long 0 + .long 0 + .long 0 + .long 3220176896 + .type _pzero_none,@object + .size _pzero_none,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nextafter_gen.S b/external/sgx_libm/intel64/nextafter_gen.S new file mode 100644 index 0000000000..9d8d5ea14b --- /dev/null +++ b/external/sgx_libm/intel64/nextafter_gen.S @@ -0,0 +1,202 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nextafter_gen.c" + .text +..TXTST0: +# -- Begin nextafter + .text + .align 16,0x90 + .globl nextafter +nextafter: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_nextafter.1: +..L2: + + movsd %xmm0, -16(%rsp) + movzwl -10(%rsp), %r8d + andl $32752, %r8d + shrl $4, %r8d + movsd %xmm1, -8(%rsp) + cmpl $2047, %r8d + je ..B1.23 +..B1.2: + movzwl -2(%rsp), %edi + andl $32752, %edi + shrl $4, %edi + cmpl $2047, %edi + je ..B1.20 +..B1.3: + movsd -8(%rsp), %xmm0 + movsd -16(%rsp), %xmm1 + ucomisd %xmm0, %xmm1 + jp ..B1.4 + je ..B1.17 +..B1.4: + movl -12(%rsp), %edx + movl %edx, %eax + andl $2147483647, %eax + orl -16(%rsp), %eax + je ..B1.19 +..B1.5: + movl %edx, %eax + movl -4(%rsp), %ecx + xorl %ecx, %eax + movq -16(%rsp), %rsi + testl $-2147483648, %eax + jne ..B1.11 +..B1.6: + cmpl %edi, %r8d + jg ..B1.11 +..B1.7: + jne ..B1.12 +..B1.8: + andl $1048575, %edx + andl $1048575, %ecx + cmpl %ecx, %edx + jg ..B1.11 +..B1.9: + jne ..B1.12 +..B1.10: + movl -16(%rsp), %eax + cmpl -8(%rsp), %eax + jbe ..B1.12 +..B1.11: + decq %rsi + movq %rsi, -16(%rsp) + jmp ..B1.13 +..B1.12: + incq %rsi + movq %rsi, -16(%rsp) +..B1.13: + movl -12(%rsp), %edx + andl $2147483647, %edx + lea -1048576(%rdx), %eax + cmpl $2145386496, %eax + jb ..B1.18 +..B1.14: + cmpl $1048576, %edx + jae ..B1.16 +..B1.15: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -24(%rsp) + movsd -16(%rsp), %xmm0 + ret +..B1.16: + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -24(%rsp) + movsd -16(%rsp), %xmm0 +..B1.17: + ret +..B1.18: + movsd -16(%rsp), %xmm0 + ret +..B1.19: + movb -1(%rsp), %al + lea _small_value_64(%rip), %rdi + andb $-128, %al + lea _smallest_value_64(%rip), %rdx + shrb $7, %al + movsd (%rdi), %xmm0 + mulsd %xmm0, %xmm0 + movzbl %al, %ecx + movsd %xmm0, -24(%rsp) + movq (%rdx,%rcx,8), %rsi + movq %rsi, -16(%rsp) + jmp ..B1.18 +..B1.20: + testl $1048575, -4(%rsp) + jne ..B1.22 +..B1.21: + cmpl $0, -8(%rsp) + je ..B1.3 +..B1.22: + movsd -16(%rsp), %xmm0 + addsd -8(%rsp), %xmm0 + ret +..B1.23: + testl $1048575, -12(%rsp) + jne ..B1.22 +..B1.24: + cmpl $0, -16(%rsp) + jne ..B1.22 + jmp ..B1.2 + .align 16,0x90 + .cfi_endproc + .type nextafter,@function + .size nextafter,.-nextafter + .data +# -- End nextafter + .section .rodata, "a" + .align 4 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nextafterf_gen.S b/external/sgx_libm/intel64/nextafterf_gen.S new file mode 100644 index 0000000000..7725fa21da --- /dev/null +++ b/external/sgx_libm/intel64/nextafterf_gen.S @@ -0,0 +1,182 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nextafterf_gen.c" + .text +..TXTST0: +# -- Begin nextafterf + .text + .align 16,0x90 + .globl nextafterf +nextafterf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_nextafterf.1: +..L2: + + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %edi + andl $32640, %edi + shrl $7, %edi + movss %xmm1, -16(%rsp) + cmpl $255, %edi + je ..B1.20 +..B1.2: + movzwl -14(%rsp), %esi + andl $32640, %esi + shrl $7, %esi + cmpl $255, %esi + je ..B1.18 +..B1.3: + movss -16(%rsp), %xmm0 + movss -8(%rsp), %xmm1 + ucomiss %xmm0, %xmm1 + jp ..B1.4 + je ..B1.15 +..B1.4: + movl -8(%rsp), %ecx + testl $2147483647, %ecx + je ..B1.17 +..B1.5: + movl %ecx, %eax + movl -16(%rsp), %edx + xorl %edx, %eax + testl $-2147483648, %eax + jne ..B1.9 +..B1.6: + cmpl %esi, %edi + jg ..B1.9 +..B1.7: + jne ..B1.10 +..B1.8: + movl %ecx, %eax + andl $8388607, %edx + andl $8388607, %eax + cmpl %edx, %eax + jle ..B1.10 +..B1.9: + decl %ecx + movl %ecx, -20(%rsp) + jmp ..B1.11 +..B1.10: + incl %ecx + movl %ecx, -20(%rsp) +..B1.11: + andl $2147483647, %ecx + lea -8388608(%rcx), %eax + cmpl $2130706432, %eax + jb ..B1.16 +..B1.12: + cmpl $8388608, %ecx + jae ..B1.14 +..B1.13: + movss .L_2il0floatpacket.0(%rip), %xmm1 + movss %xmm1, -24(%rsp) + movss -24(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss -20(%rsp), %xmm0 + movss %xmm1, -24(%rsp) + ret +..B1.14: + movss .L_2il0floatpacket.1(%rip), %xmm0 + movss %xmm0, -24(%rsp) + movss -24(%rsp), %xmm1 + mulss %xmm0, %xmm1 + movss -20(%rsp), %xmm0 + movss %xmm1, -24(%rsp) +..B1.15: + ret +..B1.16: + movss -20(%rsp), %xmm0 + ret +..B1.17: + movb -13(%rsp), %al + lea _smallest_value_32(%rip), %rdx + andb $-128, %al + movss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, -24(%rsp) + shrb $7, %al + movss -24(%rsp), %xmm1 + mulss %xmm0, %xmm1 + movss %xmm1, -24(%rsp) + movzbl %al, %ecx + movl (%rdx,%rcx,4), %esi + movl %esi, -20(%rsp) + jmp ..B1.16 +..B1.18: + testl $8388607, -16(%rsp) + je ..B1.3 +..B1.19: + movss -8(%rsp), %xmm0 + addss -16(%rsp), %xmm0 + ret +..B1.20: + testl $8388607, -8(%rsp) + jne ..B1.19 + jmp ..B1.2 + .align 16,0x90 + .cfi_endproc + .type nextafterf,@function + .size nextafterf,.-nextafterf + .data +# -- End nextafterf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x0d800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_smallest_value_32: + .long 1 + .long 2147483649 + .type _smallest_value_32,@object + .size _smallest_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nextafterl.S b/external/sgx_libm/intel64/nextafterl.S new file mode 100644 index 0000000000..17e8aa1407 --- /dev/null +++ b/external/sgx_libm/intel64/nextafterl.S @@ -0,0 +1,382 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nextafterl.c" + .text +..TXTST0: +# -- Begin nextafterl + .text + .align 16,0x90 + .globl nextafterl +nextafterl: +# parameter 1: 48 + %rsp +# parameter 2: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_nextafterl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 56(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.53 +..B1.4: + movzwl 72(%rsp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.45 +..B1.5: + fldt 48(%rsp) + fldt 64(%rsp) + fucomi %st(1), %st + jp ..B1.6 + je ..B1.54 +..B1.6: + fstp %st(0) + testl %esi, %esi + jne ..B1.9 +..B1.7: + cmpl $0, 52(%rsp) + jne ..B1.9 +..B1.8: + cmpl $0, 48(%rsp) + je ..B1.44 +..B1.9: + movb 73(%rsp), %al + movb 57(%rsp), %dl + andb $-128, %al + andb $-128, %dl + shrb $7, %al + shrb $7, %dl + fstpt 16(%rsp) + cmpb %dl, %al + jne ..B1.15 +..B1.10: + cmpl %ecx, %esi + jg ..B1.15 +..B1.11: + jne ..B1.29 +..B1.12: + movl 52(%rsp), %eax + movl 68(%rsp), %edx + cmpl %edx, %eax + ja ..B1.15 +..B1.13: + jne ..B1.29 +..B1.14: + movl 48(%rsp), %eax + cmpl 64(%rsp), %eax + jbe ..B1.29 +..B1.15: + movzwl 24(%rsp), %edx + movl %edx, %edi + movl 16(%rsp), %eax + andl $32767, %edi + decl %eax + movl %eax, 16(%rsp) + cmpl $-1, %eax + jne ..B1.34 +..B1.16: + movl 20(%rsp), %eax + decl %eax + testl %edi, %edi + je ..B1.22 +..B1.17: + cmpl $2147483647, %eax + jne ..B1.21 +..B1.18: + decl %edi + andl $-32768, %edx + andl $32767, %edi + orl %edi, %edx + movw %dx, 24(%rsp) + testl %edi, %edi + je ..B1.20 +..B1.19: + movl %edx, %edi + orl $-2147483648, %eax + movl %eax, 20(%rsp) + andl $32767, %edi + jmp ..B1.34 +..B1.20: + movl %edx, %edi + movl %eax, 20(%rsp) + andl $32767, %edi + jmp ..B1.34 +..B1.21: + movl %eax, 20(%rsp) + jmp ..B1.35 +..B1.22: + movl %eax, 20(%rsp) +..B1.23: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.24: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.25: + fldcw 32(%rsp) +..B1.26: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) +..B1.27: + fldcw 34(%rsp) +..B1.28: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.29: + movzwl 24(%rsp), %ecx + movl %ecx, %edi + movl 16(%rsp), %eax + andl $32767, %edi + incl %eax + movl %eax, 16(%rsp) + jne ..B1.33 +..B1.30: + movl $-2147483648, %eax + xorl %edx, %edx + testl %edi, %edi + movl 20(%rsp), %esi + cmove %eax, %edx + incl %esi + cmpl %edx, %esi + jne ..B1.32 +..B1.31: + incl %edi + andl $-32768, %ecx + andl $32767, %edi + orl $-2147483648, %esi + orl %edi, %ecx + movl %ecx, %edi + movl %esi, 20(%rsp) + andl $32767, %edi + movw %cx, 24(%rsp) + jmp ..B1.33 +..B1.32: + movl %esi, 20(%rsp) +..B1.33: + cmpl $32767, %edi + je ..B1.37 +..B1.34: + testl %edi, %edi + je ..B1.23 +..B1.35: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.36: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.28 +..B1.37: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.38: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.39: + fldcw 32(%rsp) +..B1.40: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) +..B1.41: + fldcw 34(%rsp) +..B1.42: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.43: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.42 +..B1.44: + fstp %st(0) + movb 73(%rsp), %al + lea _smallest_value_80(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + shlq $4, %rcx + fldt (%rdx,%rcx) + movzwl 8(%rdx,%rcx), %edi + fstpt 16(%rsp) + andl $32767, %edi + jmp ..B1.34 +..B1.45: + movq $0x8000000000000000, %rax + cmpq 64(%rsp), %rax + je ..B1.5 +..B1.46: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.52 +..B1.47: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.48: + fldcw 32(%rsp) +..B1.49: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) +..B1.50: + fldcw 34(%rsp) +..B1.51: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.52: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.51 +..B1.53: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.46 + jmp ..B1.4 +..B1.54: + fstp %st(1) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nextafterl,@function + .size nextafterl,.-nextafterl + .data +# -- End nextafterl + .section .rodata, "a" + .align 4 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_smallest_value_80: + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 0 + .word 0 + .type _smallest_value_80,@object + .size _smallest_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nexttoward_gen.S b/external/sgx_libm/intel64/nexttoward_gen.S new file mode 100644 index 0000000000..aa9a7f0e30 --- /dev/null +++ b/external/sgx_libm/intel64/nexttoward_gen.S @@ -0,0 +1,212 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nexttoward_gen.c" + .text +..TXTST0: +# -- Begin nexttoward + .text + .align 16,0x90 + .globl nexttoward +nexttoward: +# parameter 1: %xmm0 +# parameter 2: 8 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_nexttoward.1: +..L2: + + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %eax + andl $32752, %eax + cmpl $32752, %eax + je ..B1.22 +..B1.2: + movzwl 16(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.20 +..B1.3: + fldl -8(%rsp) + fldt 8(%rsp) + fucomi %st(1), %st + jp ..B1.4 + je ..B1.24 +..B1.4: + fstp %st(0) + movl -4(%rsp), %eax + andl $2147483647, %eax + orl -8(%rsp), %eax + je ..B1.19 +..B1.5: + fstpt -24(%rsp) + movb -15(%rsp), %dl + movb 17(%rsp), %al + andb $-128, %dl + andb $-128, %al + shrb $7, %dl + shrb $7, %al + movq -8(%rsp), %rcx + cmpb %dl, %al + jne ..B1.11 +..B1.6: + movzwl -16(%rsp), %eax + andl $32767, %eax + cmpl %esi, %eax + jg ..B1.11 +..B1.7: + jne ..B1.12 +..B1.8: + movl -20(%rsp), %eax + movl 12(%rsp), %edx + cmpl %edx, %eax + ja ..B1.11 +..B1.9: + jne ..B1.12 +..B1.10: + movl -24(%rsp), %eax + cmpl 8(%rsp), %eax + jbe ..B1.12 +..B1.11: + decq %rcx + movq %rcx, -40(%rsp) + jmp ..B1.13 +..B1.12: + incq %rcx + movq %rcx, -40(%rsp) +..B1.13: + movl -36(%rsp), %edx + andl $2147483647, %edx + lea -1048576(%rdx), %eax + cmpl $2145386496, %eax + jb ..B1.18 +..B1.14: + cmpl $1048576, %edx + jae ..B1.16 +..B1.15: + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -32(%rsp) + movsd -40(%rsp), %xmm0 + ret +..B1.16: + lea _large_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, -32(%rsp) + movsd -40(%rsp), %xmm0 +..B1.17: + ret +..B1.18: + movsd -40(%rsp), %xmm0 + ret +..B1.19: + fstp %st(0) + movb 17(%rsp), %al + lea _small_value_64(%rip), %rdi + andb $-128, %al + lea _smallest_value_64(%rip), %rdx + shrb $7, %al + movsd (%rdi), %xmm0 + mulsd %xmm0, %xmm0 + movzbl %al, %ecx + movsd %xmm0, -32(%rsp) + movq (%rdx,%rcx,8), %rsi + movq %rsi, -40(%rsp) + jmp ..B1.18 +..B1.20: + movq $0x8000000000000000, %rax + cmpq 8(%rsp), %rax + je ..B1.3 +..B1.21: + fldl -8(%rsp) + fldt 8(%rsp) + fmulp %st, %st(1) + fstpl -40(%rsp) + movsd -40(%rsp), %xmm0 + ret +..B1.22: + testl $1048575, -4(%rsp) + jne ..B1.21 +..B1.23: + cmpl $0, -8(%rsp) + jne ..B1.21 + jmp ..B1.2 +..B1.24: + fstp %st(1) + fstpl -40(%rsp) + movsd -40(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type nexttoward,@function + .size nexttoward,.-nexttoward + .data +# -- End nexttoward + .section .rodata, "a" + .align 4 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nexttowardf_gen.S b/external/sgx_libm/intel64/nexttowardf_gen.S new file mode 100644 index 0000000000..cb6ecda6e4 --- /dev/null +++ b/external/sgx_libm/intel64/nexttowardf_gen.S @@ -0,0 +1,201 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nexttowardf_gen.c" + .text +..TXTST0: +# -- Begin nexttowardf + .text + .align 16,0x90 + .globl nexttowardf +nexttowardf: +# parameter 1: %xmm0 +# parameter 2: 8 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_nexttowardf.1: +..L2: + + movss %xmm0, -16(%rsp) + movzwl -14(%rsp), %eax + andl $32640, %eax + cmpl $32640, %eax + je ..B1.22 +..B1.2: + movzwl 16(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.20 +..B1.3: + flds -16(%rsp) + fldt 8(%rsp) + fucomi %st(1), %st + jp ..B1.4 + je ..B1.23 +..B1.4: + fstp %st(0) + movl -16(%rsp), %ecx + testl $2147483647, %ecx + je ..B1.19 +..B1.5: + fstpt -24(%rsp) + movb -15(%rsp), %dl + movb 17(%rsp), %al + andb $-128, %dl + andb $-128, %al + shrb $7, %dl + shrb $7, %al + cmpb %dl, %al + jne ..B1.11 +..B1.6: + movzwl -16(%rsp), %eax + andl $32767, %eax + cmpl %esi, %eax + jg ..B1.11 +..B1.7: + jne ..B1.12 +..B1.8: + movl -20(%rsp), %eax + movl 12(%rsp), %edx + cmpl %edx, %eax + ja ..B1.11 +..B1.9: + jne ..B1.12 +..B1.10: + movl -24(%rsp), %eax + cmpl 8(%rsp), %eax + jbe ..B1.12 +..B1.11: + decl %ecx + movl %ecx, -24(%rsp) + jmp ..B1.13 +..B1.12: + incl %ecx + movl %ecx, -24(%rsp) +..B1.13: + andl $2147483647, %ecx + lea -8388608(%rcx), %eax + cmpl $2130706432, %eax + jb ..B1.18 +..B1.14: + cmpl $8388608, %ecx + jae ..B1.16 +..B1.15: + movss .L_2il0floatpacket.0(%rip), %xmm1 + movss %xmm1, -8(%rsp) + movss -8(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss -24(%rsp), %xmm0 + movss %xmm1, -8(%rsp) + ret +..B1.16: + movss .L_2il0floatpacket.1(%rip), %xmm0 + movss %xmm0, -8(%rsp) + movss -8(%rsp), %xmm1 + mulss %xmm0, %xmm1 + movss -24(%rsp), %xmm0 + movss %xmm1, -8(%rsp) +..B1.17: + ret +..B1.18: + movss -24(%rsp), %xmm0 + ret +..B1.19: + fstp %st(0) + movb 17(%rsp), %al + lea _smallest_value_32(%rip), %rdx + andb $-128, %al + movss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, -8(%rsp) + shrb $7, %al + movss -8(%rsp), %xmm1 + mulss %xmm0, %xmm1 + movss %xmm1, -8(%rsp) + movzbl %al, %ecx + movl (%rdx,%rcx,4), %esi + movl %esi, -24(%rsp) + jmp ..B1.18 +..B1.20: + movq $0x8000000000000000, %rax + cmpq 8(%rsp), %rax + je ..B1.3 +..B1.21: + flds -16(%rsp) + fldt 8(%rsp) + fmulp %st, %st(1) + fstps -24(%rsp) + movss -24(%rsp), %xmm0 + ret +..B1.22: + testl $8388607, -16(%rsp) + jne ..B1.21 + jmp ..B1.2 +..B1.23: + fstp %st(1) + fstps -24(%rsp) + movss -24(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type nexttowardf,@function + .size nexttowardf,.-nexttowardf + .data +# -- End nexttowardf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x0d800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_smallest_value_32: + .long 1 + .long 2147483649 + .type _smallest_value_32,@object + .size _smallest_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/nexttowardl.S b/external/sgx_libm/intel64/nexttowardl.S new file mode 100644 index 0000000000..765e2c35bf --- /dev/null +++ b/external/sgx_libm/intel64/nexttowardl.S @@ -0,0 +1,382 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "nexttowardl.c" + .text +..TXTST0: +# -- Begin nexttowardl + .text + .align 16,0x90 + .globl nexttowardl +nexttowardl: +# parameter 1: 48 + %rsp +# parameter 2: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_nexttowardl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 56(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.53 +..B1.4: + movzwl 72(%rsp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.45 +..B1.5: + fldt 48(%rsp) + fldt 64(%rsp) + fucomi %st(1), %st + jp ..B1.6 + je ..B1.54 +..B1.6: + fstp %st(0) + testl %esi, %esi + jne ..B1.9 +..B1.7: + cmpl $0, 52(%rsp) + jne ..B1.9 +..B1.8: + cmpl $0, 48(%rsp) + je ..B1.44 +..B1.9: + movb 73(%rsp), %al + movb 57(%rsp), %dl + andb $-128, %al + andb $-128, %dl + shrb $7, %al + shrb $7, %dl + fstpt 16(%rsp) + cmpb %dl, %al + jne ..B1.15 +..B1.10: + cmpl %ecx, %esi + jg ..B1.15 +..B1.11: + jne ..B1.29 +..B1.12: + movl 52(%rsp), %eax + movl 68(%rsp), %edx + cmpl %edx, %eax + ja ..B1.15 +..B1.13: + jne ..B1.29 +..B1.14: + movl 48(%rsp), %eax + cmpl 64(%rsp), %eax + jbe ..B1.29 +..B1.15: + movzwl 24(%rsp), %edx + movl %edx, %edi + movl 16(%rsp), %eax + andl $32767, %edi + decl %eax + movl %eax, 16(%rsp) + cmpl $-1, %eax + jne ..B1.34 +..B1.16: + movl 20(%rsp), %eax + decl %eax + testl %edi, %edi + je ..B1.22 +..B1.17: + cmpl $2147483647, %eax + jne ..B1.21 +..B1.18: + decl %edi + andl $-32768, %edx + andl $32767, %edi + orl %edi, %edx + movw %dx, 24(%rsp) + testl %edi, %edi + je ..B1.20 +..B1.19: + movl %edx, %edi + orl $-2147483648, %eax + movl %eax, 20(%rsp) + andl $32767, %edi + jmp ..B1.34 +..B1.20: + movl %edx, %edi + movl %eax, 20(%rsp) + andl $32767, %edi + jmp ..B1.34 +..B1.21: + movl %eax, 20(%rsp) + jmp ..B1.35 +..B1.22: + movl %eax, 20(%rsp) +..B1.23: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.24: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.25: + fldcw 32(%rsp) +..B1.26: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) +..B1.27: + fldcw 34(%rsp) +..B1.28: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.29: + movzwl 24(%rsp), %ecx + movl %ecx, %edi + movl 16(%rsp), %eax + andl $32767, %edi + incl %eax + movl %eax, 16(%rsp) + jne ..B1.33 +..B1.30: + movl $-2147483648, %eax + xorl %edx, %edx + testl %edi, %edi + movl 20(%rsp), %esi + cmove %eax, %edx + incl %esi + cmpl %edx, %esi + jne ..B1.32 +..B1.31: + incl %edi + andl $-32768, %ecx + andl $32767, %edi + orl $-2147483648, %esi + orl %edi, %ecx + movl %ecx, %edi + movl %esi, 20(%rsp) + andl $32767, %edi + movw %cx, 24(%rsp) + jmp ..B1.33 +..B1.32: + movl %esi, 20(%rsp) +..B1.33: + cmpl $32767, %edi + je ..B1.37 +..B1.34: + testl %edi, %edi + je ..B1.23 +..B1.35: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.36: + lea _small_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.28 +..B1.37: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.38: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.39: + fldcw 32(%rsp) +..B1.40: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) +..B1.41: + fldcw 34(%rsp) +..B1.42: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.43: + lea _large_value_80(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt (%rsp) + jmp ..B1.42 +..B1.44: + fstp %st(0) + movb 73(%rsp), %al + lea _smallest_value_80(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + shlq $4, %rcx + fldt (%rdx,%rcx) + movzwl 8(%rdx,%rcx), %edi + fstpt 16(%rsp) + andl $32767, %edi + jmp ..B1.34 +..B1.45: + movq $0x8000000000000000, %rax + cmpq 64(%rsp), %rax + je ..B1.5 +..B1.46: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.52 +..B1.47: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.48: + fldcw 32(%rsp) +..B1.49: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) +..B1.50: + fldcw 34(%rsp) +..B1.51: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.52: + fldt 48(%rsp) + fldt 64(%rsp) + fmulp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.51 +..B1.53: + movq $0x8000000000000000, %rax + cmpq 48(%rsp), %rax + jne ..B1.46 + jmp ..B1.4 +..B1.54: + fstp %st(1) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type nexttowardl,@function + .size nexttowardl,.-nexttowardl + .data +# -- End nexttowardl + .section .rodata, "a" + .align 4 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_smallest_value_80: + .word 1 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 0 + .word 0 + .word 0 + .type _smallest_value_80,@object + .size _smallest_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/pow_gen.S b/external/sgx_libm/intel64/pow_gen.S new file mode 100644 index 0000000000..5df1c692ec --- /dev/null +++ b/external/sgx_libm/intel64/pow_gen.S @@ -0,0 +1,4493 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "pow_gen.c" + .text +..TXTST0: +# -- Begin pow + .text + .align 16,0x90 + .globl pow +pow: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_pow.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movsd %xmm0, 8(%rsp) + movsd %xmm1, 16(%rsp) +..B1.2: + movlpd SIGMASK(%rip), %xmm7 + movlpd ONEMASK(%rip), %xmm2 + andpd %xmm0, %xmm7 + movq %xmm0, %xmm4 + psrlq $44, %xmm0 + pextrw $0, %xmm0, %eax + orpd %xmm2, %xmm7 + pextrw $3, %xmm4, %ecx + andl $255, %eax + addl $1, %eax + andl $510, %eax + lea rcp_t1(%rip), %r8 + mulsd (%r8,%rax,4), %xmm7 + movlpd (%r8,%rax,4), %xmm5 + addl %eax, %eax + lea log2_t1(%rip), %r8 + movapd (%r8,%rax,4), %xmm6 + movl $32751, %edx + subl %ecx, %edx + subl $16, %ecx + orl %edx, %ecx + cmpl $-2147483648, %ecx + jae .L_2TAG_PACKET_0.0.2 + movl $0, %ecx + movl $261759, %edx +.L_2TAG_PACKET_1.0.2: +.L_2TAG_PACKET_2.0.2: + movd %edx, %xmm1 + psubq %xmm1, %xmm0 + psrlq $8, %xmm0 + cvtdq2pd %xmm0, %xmm0 + movlpd HALFSIG(%rip), %xmm1 + movq %xmm7, %xmm3 + psrlq $38, %xmm7 + pextrw $0, %xmm7, %eax + andpd SIGMASK(%rip), %xmm4 + andl $255, %eax + addl $1, %eax + andl $510, %eax + lea rcp_t2(%rip), %r8 + mulsd (%r8,%rax,4), %xmm3 + mulsd (%r8,%rax,4), %xmm5 + addl %eax, %eax + lea log2_t2(%rip), %r8 + addpd (%r8,%rax,4), %xmm6 + orpd ONEMASK(%rip), %xmm4 + addsd %xmm0, %xmm6 + andpd %xmm4, %xmm1 + movq %xmm3, %xmm2 + psrlq $31, %xmm3 + pextrw $0, %xmm3, %eax + movlpd HALFSIG(%rip), %xmm0 + subsd %xmm1, %xmm4 + movlpd LHN(%rip), %xmm7 + andl $511, %eax + addl $1, %eax + andl $1022, %eax + lea rcp_t3(%rip), %r8 + mulsd (%r8,%rax,4), %xmm5 + mulsd (%r8,%rax,4), %xmm2 + lea log2_t3(%rip), %r8 + addpd (%r8,%rax,8), %xmm6 + andpd %xmm5, %xmm0 + subsd %xmm0, %xmm5 + addsd %xmm2, %xmm7 + movq %xmm0, %xmm3 + mulsd %xmm1, %xmm0 + mulsd %xmm5, %xmm1 + mulsd %xmm4, %xmm3 + subsd %xmm0, %xmm2 + mulsd %xmm5, %xmm4 + movq %xmm6, %xmm0 + subsd %xmm1, %xmm2 + addsd %xmm7, %xmm6 + movlpd 16(%rsp), %xmm1 + pextrw $3, %xmm1, %eax + subsd %xmm3, %xmm2 + subsd %xmm6, %xmm0 + movlpd HALFSIG(%rip), %xmm3 + pextrw $3, %xmm6, %edx + subsd %xmm4, %xmm2 + movq %xmm6, %xmm4 + addsd %xmm7, %xmm0 + subsd %xmm2, %xmm7 + subsd %xmm2, %xmm6 + unpcklpd %xmm7, %xmm7 + andl $32752, %eax + cmpl $32752, %eax + jae .L_2TAG_PACKET_3.0.2 + andl $32752, %edx + subl $16368, %eax + addl %edx, %eax + movl $16544, %edx + subl %eax, %edx + subl $15472, %eax + orl %eax, %edx + cmpl $-2147483648, %edx + jae .L_2TAG_PACKET_4.0.2 +.L_2TAG_PACKET_5.0.2: + subsd %xmm6, %xmm4 + subsd %xmm4, %xmm2 + movlpd HALFSIG(%rip), %xmm4 + andpd %xmm1, %xmm3 + andpd %xmm6, %xmm4 + subsd %xmm2, %xmm0 + xorpd %xmm2, %xmm2 + movl $16480, %edx + pinsrw $3, %edx, %xmm2 + movq %xmm3, %xmm5 + mulsd %xmm4, %xmm3 + subsd %xmm4, %xmm6 + subsd %xmm5, %xmm1 + mulsd %xmm2, %xmm3 + mulsd %xmm6, %xmm5 + movapd clv(%rip), %xmm2 + mulsd %xmm1, %xmm4 + cvtsd2si %xmm3, %eax + mulsd %xmm1, %xmm6 + movapd 16+clv(%rip), %xmm1 + addsd %xmm4, %xmm5 + pshufd $238, %xmm6, %xmm4 + addsd %xmm6, %xmm5 + movl $130943, %edx + subl %eax, %edx + addl $123391, %eax + orl %eax, %edx + subl $123391, %eax + cmpl $0, %edx + jle .L_2TAG_PACKET_6.0.2 + addl %eax, %ecx + andl $127, %eax + andl $-128, %ecx + addl $130944, %ecx + addsd %xmm0, %xmm4 + movq %xmm3, %xmm0 + addsd Shifter(%rip), %xmm3 + mulpd %xmm7, %xmm2 + subsd Shifter(%rip), %xmm3 + mulpd %xmm7, %xmm7 + subsd %xmm3, %xmm0 + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + lea exp2_tbl(%rip), %r8 + movapd (%r8,%rax), %xmm3 + movapd cev(%rip), %xmm6 + mulpd %xmm7, %xmm1 + addpd %xmm1, %xmm2 + pshufd $238, %xmm2, %xmm1 + mulsd %xmm7, %xmm2 + xorpd %xmm7, %xmm7 + movl $16256, %edx + addsd %xmm1, %xmm2 + pinsrw $3, %edx, %xmm7 + addsd %xmm4, %xmm2 + movlpd 32+cev(%rip), %xmm4 + movd %ecx, %xmm1 + mulsd 16(%rsp), %xmm2 + mulsd %xmm7, %xmm0 + psllq $45, %xmm1 + pshufd $68, %xmm1, %xmm1 + movapd 16+cev(%rip), %xmm7 + addsd %xmm2, %xmm5 + addsd %xmm5, %xmm0 + unpcklpd %xmm0, %xmm0 + mulpd %xmm0, %xmm6 + mulsd %xmm0, %xmm4 + pshufd $238, %xmm3, %xmm5 + mulpd %xmm0, %xmm0 + addpd %xmm6, %xmm7 + mulpd %xmm0, %xmm7 + mulsd %xmm3, %xmm0 + pshufd $238, %xmm7, %xmm6 + mulsd %xmm7, %xmm0 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm4 + addsd %xmm5, %xmm0 + addsd %xmm6, %xmm0 + addsd %xmm4, %xmm0 + addsd %xmm3, %xmm0 + mulsd %xmm1, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movlpd 16(%rsp), %xmm1 + movlpd ABSVALMASK(%rip), %xmm3 + movd %xmm1, %eax + movq %xmm1, %xmm2 + andpd %xmm3, %xmm1 + psrlq $32, %xmm1 + movd %xmm1, %ecx + cmpl $2146435072, %ecx + jae .L_2TAG_PACKET_7.0.2 + orl %ecx, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_8.0.2 + cmpl $0, %edx + jge .L_2TAG_PACKET_9.0.2 + negl %edx + addl $32751, %edx + psllq $52, %xmm3 + orpd %xmm3, %xmm2 + movl $1011, %ecx + movd %ecx, %xmm3 + psrlq $20, %xmm1 + psubd %xmm3, %xmm1 + pxor %xmm3, %xmm3 + pmaxsw %xmm3, %xmm1 + psllq %xmm1, %xmm2 + pcmpeqd %xmm3, %xmm2 + pmovmskb %xmm2, %eax + movl %edx, %ecx + andl $32767, %edx + cmpl $32752, %edx + jae .L_2TAG_PACKET_10.0.2 + andl $255, %eax + cmpl $255, %eax + jne .L_2TAG_PACKET_11.0.2 + movlpd 16(%rsp), %xmm1 + movlpd 16(%rsp), %xmm2 + movl $1012, %ecx + movd %ecx, %xmm3 + andpd ABSVALMASK(%rip), %xmm1 + psrlq $52, %xmm1 + psubd %xmm3, %xmm1 + movlpd NEG_ZERO(%rip), %xmm3 + psllq %xmm1, %xmm2 + pcmpeqd %xmm3, %xmm2 + pmovmskb %xmm2, %eax + andl $255, %eax + movl $261889, %ecx + addl %eax, %ecx + andl $262144, %ecx + cmpl $16, %edx + jb .L_2TAG_PACKET_12.0.2 + movl $786047, %edx + movlpd SIGMASK(%rip), %xmm3 + movlpd ONEMASK(%rip), %xmm2 + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_7.0.2: + movlpd 8(%rsp), %xmm7 + movlpd 8(%rsp), %xmm4 + movd %xmm7, %edx + psrlq $32, %xmm7 + movd %xmm7, %eax + movl %eax, %ecx + andl $2147483647, %eax + cmpl $2146435072, %eax + jb .L_2TAG_PACKET_13.0.2 + ja .L_2TAG_PACKET_14.0.2 + cmpl $0, %edx + ja .L_2TAG_PACKET_14.0.2 + jmp .L_2TAG_PACKET_13.0.2 +.L_2TAG_PACKET_9.0.2: + movl $0, %ecx +.L_2TAG_PACKET_12.0.2: + xorpd %xmm0, %xmm0 + movl $17392, %eax + pinsrw $3, %eax, %xmm0 + movlpd SIGMASK(%rip), %xmm7 + movlpd ONEMASK(%rip), %xmm2 + mulsd %xmm4, %xmm0 + movd %xmm4, %edx + psrlq $32, %xmm4 + movd %xmm4, %eax + cmpl $0, %edx + je .L_2TAG_PACKET_15.0.2 + movq 16(%rsp), %xmm4 + pextrw $3, %xmm4, %eax + andl $49152, %eax + cmpl $16384, %eax + je .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_17.0.2: + andpd %xmm0, %xmm7 + movq %xmm0, %xmm4 + andpd ABSVALMASK(%rip), %xmm0 + psrlq $44, %xmm0 + pextrw $0, %xmm0, %eax + orpd %xmm2, %xmm7 + andl $255, %eax + addl $1, %eax + andl $510, %eax + lea rcp_t1(%rip), %r8 + mulsd (%r8,%rax,4), %xmm7 + movlpd (%r8,%rax,4), %xmm5 + addl %eax, %eax + lea log2_t1(%rip), %r8 + movapd (%r8,%rax,4), %xmm6 + movl $278143, %edx + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_15.0.2: + movl %eax, %edx + andl $2147483647, %edx + cmpl $0, %edx + jne .L_2TAG_PACKET_17.0.2 + movl 20(%rsp), %edx + andl $-2147483648, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_18.0.2 + shll $13, %ecx + andl %ecx, %eax + movl $2146435072, %edx + orl %eax, %edx + movd %edx, %xmm0 + psllq $32, %xmm0 + movlpd ONEMASK(%rip), %xmm1 + movlpd 8(%rsp), %xmm2 + divsd %xmm2, %xmm1 +.L_2TAG_PACKET_19.0.2: + movl $27, (%rsp) + jmp .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_18.0.2: + shll $13, %ecx + andl %ecx, %eax + cmpl $0, %eax + jne .L_2TAG_PACKET_21.0.2 + pxor %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_10.0.2: + movlpd SIGMASK(%rip), %xmm3 + xorpd %xmm1, %xmm1 + andpd %xmm4, %xmm3 + pcmpeqd %xmm3, %xmm1 + pmovmskb %xmm1, %ecx + andl $255, %ecx + cmpl $255, %ecx + jne .L_2TAG_PACKET_14.0.2 + pextrw $3, %xmm4, %ecx + andl $32768, %ecx + cmpl $0, %ecx + je .L_2TAG_PACKET_22.0.2 + andl $255, %eax + cmpl $255, %eax + jne .L_2TAG_PACKET_23.0.2 + movlpd 16(%rsp), %xmm1 + movlpd 16(%rsp), %xmm2 + movl $1012, %ecx + movd %ecx, %xmm3 + andpd ABSVALMASK(%rip), %xmm1 + psrlq $52, %xmm1 + psubd %xmm3, %xmm1 + pxor %xmm3, %xmm3 + psllq %xmm1, %xmm2 + pcmpeqd %xmm3, %xmm2 + pmovmskb %xmm2, %eax + andl $255, %eax + cmpl $255, %eax + je .L_2TAG_PACKET_23.0.2 + movlpd 16(%rsp), %xmm1 + pextrw $3, %xmm1, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_24.0.2 +.L_2TAG_PACKET_21.0.2: + movq NEG_ZERO(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_24.0.2: + movq NEG_INF(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_23.0.2: + movlpd 16(%rsp), %xmm1 + pextrw $3, %xmm1, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_25.0.2 + pxor %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_22.0.2: + movlpd 16(%rsp), %xmm1 + pextrw $3, %xmm1, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_25.0.2 + pxor %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_14.0.2: + addsd %xmm4, %xmm4 + movq %xmm4, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_11.0.2: + movlpd 8(%rsp), %xmm2 + movd %xmm2, %eax + psrlq $32, %xmm2 + movd %xmm2, %edx + andl $2147483647, %edx + orl %edx, %eax + movl $0, %ecx + cmpl $0, %eax + je .L_2TAG_PACKET_15.0.2 + movlpd sNaN(%rip), %xmm0 + mulsd %xmm0, %xmm0 + movl $28, (%rsp) + jmp .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_3.0.2: + movlpd 8(%rsp), %xmm4 + movlpd 16(%rsp), %xmm2 + movd %xmm4, %eax + cmpl $0, %eax + jne .L_2TAG_PACKET_13.0.2 + psrlq $32, %xmm4 + movd %xmm4, %edx + cmpl $1072693248, %edx + je .L_2TAG_PACKET_26.0.2 + cmpl $-1074790400, %edx + jne .L_2TAG_PACKET_13.0.2 + movlpd SIGMASK(%rip), %xmm3 + xorpd %xmm1, %xmm1 + andpd %xmm2, %xmm3 + pcmpeqd %xmm3, %xmm1 + pmovmskb %xmm1, %eax + cmpl $255, %eax + jne .L_2TAG_PACKET_27.0.2 + movq ONEMASK(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_13.0.2: + movlpd SIGMASK(%rip), %xmm3 + xorpd %xmm1, %xmm1 + andpd %xmm2, %xmm3 + pcmpeqd %xmm3, %xmm1 + pmovmskb %xmm1, %eax + andl $255, %eax + cmpl $255, %eax + jne .L_2TAG_PACKET_27.0.2 + pextrw $3, %xmm2, %eax + movlpd 8(%rsp), %xmm4 + andl $32768, %eax + xorl $-1074790400, %ecx + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_26.0.2 + cmpl $0, %eax + je .L_2TAG_PACKET_28.0.2 + pextrw $3, %xmm4, %eax + andl $32752, %eax + cmpl $16368, %eax + jae .L_2TAG_PACKET_29.0.2 + movd %xmm4, %eax + psrlq $32, %xmm4 + movd %xmm4, %edx + andl $2147483647, %edx + orl %eax, %edx + cmpl $0, %edx + jne .L_2TAG_PACKET_25.0.2 + xorpd %xmm1, %xmm1 + xorpd %xmm4, %xmm4 + movl $16368, %eax + pinsrw $3, %eax, %xmm1 + divsd %xmm4, %xmm1 + movq %xmm1, %xmm0 + jmp .L_2TAG_PACKET_19.0.2 +.L_2TAG_PACKET_29.0.2: + pxor %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_28.0.2: + pextrw $3, %xmm4, %eax + andl $32752, %eax + cmpl $16368, %eax + jae .L_2TAG_PACKET_25.0.2 + pxor %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_25.0.2: + movq INF(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_27.0.2: + addsd %xmm2, %xmm2 + movq %xmm2, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_30.0.2: + movl $26, (%rsp) + jmp .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_31.0.2: + movl $29, (%rsp) + jmp .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_8.0.2: + movd %xmm4, %eax + psrlq $32, %xmm4 + movd %xmm4, %edx + andl $2147483647, %edx + movl %eax, %ecx + orl %edx, %eax + movlpd ONEMASK(%rip), %xmm0 + cmpl $0, %eax + je .L_2TAG_PACKET_30.0.2 + movd %xmm4, %eax + andl $2147483647, %eax + cmpl $2146435072, %eax + ja .L_2TAG_PACKET_31.0.2 + jb .L_2TAG_PACKET_32.0.2 + cmpl $0, %ecx + ja .L_2TAG_PACKET_31.0.2 +.L_2TAG_PACKET_32.0.2: +.L_2TAG_PACKET_26.0.2: + movq ONEMASK(%rip), %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_33.0.2: + movl $24, (%rsp) + jmp .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_34.0.2: + movl $25, (%rsp) + jmp .L_2TAG_PACKET_20.0.2 +.L_2TAG_PACKET_6.0.2: + cmpl $0, %eax + jle .L_2TAG_PACKET_35.0.2 + cmpl $262144, %eax + jae .L_2TAG_PACKET_36.0.2 + movl %eax, %edx + andl $127, %eax + addl $261888, %ecx + subl $128, %edx + andl $-128, %edx + movl $16368, %edi + jmp .L_2TAG_PACKET_37.0.2 +.L_2TAG_PACKET_35.0.2: + cmpl $-261632, %eax + jle .L_2TAG_PACKET_16.0.2 + movl %eax, %edx + andl $127, %eax + addl $128, %ecx + andl $-128, %edx + addl $261760, %edx + movl $0, %edi +.L_2TAG_PACKET_37.0.2: + addsd %xmm0, %xmm4 + movq %xmm3, %xmm0 + addsd Shifter(%rip), %xmm3 + movl %edx, %esi + subl $130944, %esi + mulpd %xmm7, %xmm2 + subsd Shifter(%rip), %xmm3 + mulpd %xmm7, %xmm7 + subsd %xmm3, %xmm0 + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + addl %eax, %eax + lea exp2_tbl(%rip), %r8 + movapd (%r8,%rax), %xmm3 + movapd cev(%rip), %xmm6 + mulpd %xmm7, %xmm1 + addpd %xmm1, %xmm2 + pshufd $238, %xmm2, %xmm1 + mulsd %xmm7, %xmm2 + addsd %xmm1, %xmm2 + addsd %xmm4, %xmm2 + movlpd 32+cev(%rip), %xmm4 + movd %edx, %xmm1 + subl $130944, %edx + negl %edx + sarl $7, %edx + addl $2, %edx + movl %edx, %eax + andl $32, %eax + addl %eax, %edx + xorpd %xmm7, %xmm7 + movl $16256, %eax + pinsrw $3, %eax, %xmm7 + mulsd 16(%rsp), %xmm2 + mulsd %xmm7, %xmm0 + psllq $45, %xmm1 + pshufd $68, %xmm1, %xmm1 + movapd 16+cev(%rip), %xmm7 + addsd %xmm2, %xmm5 + mulpd %xmm1, %xmm3 + addsd %xmm5, %xmm0 + unpcklpd %xmm0, %xmm0 + mulpd %xmm0, %xmm6 + mulsd %xmm0, %xmm4 + mulpd %xmm0, %xmm0 + addpd %xmm6, %xmm7 + mulpd %xmm0, %xmm7 + mulsd %xmm3, %xmm0 + pshufd $238, %xmm7, %xmm6 + mulsd %xmm7, %xmm0 + pshufd $238, %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm4 + movd %ecx, %xmm7 + psllq $45, %xmm7 + movd %edx, %xmm2 + pcmpeqd %xmm1, %xmm1 + psllq %xmm2, %xmm1 + addsd %xmm5, %xmm0 + addsd %xmm6, %xmm0 + andpd %xmm3, %xmm1 + addsd %xmm4, %xmm0 + xorpd %xmm6, %xmm6 + pcmpeqd %xmm4, %xmm4 + psllq %xmm2, %xmm4 + subsd %xmm1, %xmm3 + movq %xmm1, %xmm2 + addsd %xmm0, %xmm1 + andpd %xmm4, %xmm1 + pinsrw $3, %edi, %xmm6 + subsd %xmm1, %xmm2 + addsd %xmm2, %xmm0 + addsd %xmm3, %xmm0 + cmpl $0, %esi + jge .L_2TAG_PACKET_38.0.2 + mulsd %xmm7, %xmm0 + mulsd %xmm7, %xmm1 + addsd %xmm1, %xmm0 + mulsd %xmm0, %xmm6 + addsd %xmm6, %xmm0 + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_33.0.2 + cmpl $0, %eax + je .L_2TAG_PACKET_34.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_38.0.2: + addsd %xmm1, %xmm0 + mulsd %xmm7, %xmm0 + mulsd %xmm0, %xmm6 + addsd %xmm6, %xmm0 + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_33.0.2 + cmpl $0, %eax + je .L_2TAG_PACKET_39.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_39.0.2: + xorpd %xmm2, %xmm2 + movl $1, %eax + movd %eax, %xmm2 + mulsd %xmm2, %xmm2 + jmp .L_2TAG_PACKET_34.0.2 +.L_2TAG_PACKET_16.0.2: + movlpd EMIN(%rip), %xmm0 + movd %ecx, %xmm1 + mulsd %xmm0, %xmm0 + psllq $45, %xmm1 + orpd %xmm1, %xmm0 + jmp .L_2TAG_PACKET_34.0.2 +.L_2TAG_PACKET_36.0.2: + xorpd %xmm1, %xmm1 + movl $32751, %eax + pinsrw $3, %eax, %xmm1 + mulsd %xmm1, %xmm1 + cmpl $0, %ecx + je .L_2TAG_PACKET_40.0.2 + movlpd NEG_INF(%rip), %xmm0 + jmp .L_2TAG_PACKET_33.0.2 +.L_2TAG_PACKET_40.0.2: + movlpd INF(%rip), %xmm0 + jmp .L_2TAG_PACKET_33.0.2 +.L_2TAG_PACKET_41.0.2: + movlpd 8(%rsp), %xmm4 + pextrw $3, %xmm4, %edx + andl $32752, %edx + subl $16368, %edx + pextrw $3, %xmm1, %eax + xorl %edx, %eax + andl $32768, %eax + cmpl $0, %eax + jne .L_2TAG_PACKET_16.0.2 + jmp .L_2TAG_PACKET_36.0.2 +.L_2TAG_PACKET_4.0.2: + pshufd $68, %xmm1, %xmm4 + mulpd %xmm6, %xmm4 + pextrw $3, %xmm4, %eax + andl $32752, %eax + movl $16544, %edx + subl %eax, %edx + subl $15472, %eax + orl %eax, %edx + cmpl $-2147483648, %edx + jb .L_2TAG_PACKET_5.0.2 + cmpl $-2147483648, %eax + jb .L_2TAG_PACKET_41.0.2 + orl $130944, %ecx + movd %ecx, %xmm0 + psllq $45, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_20.0.2: + movq %xmm0, 24(%rsp) +..B1.3: + movq 24(%rsp), %xmm0 +.L_2TAG_PACKET_42.0.2: +..B1.5: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type pow,@function + .size pow,.-pow + .data +# -- End pow + .section .rodata, "a" + .align 16 + .align 16 +SIGMASK: + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 1048575 + .type SIGMASK,@object + .size SIGMASK,16 + .align 16 +ONEMASK: + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .type ONEMASK,@object + .size ONEMASK,16 + .align 16 +log2_t1: + .long 0 + .long 0 + .long 0 + .long 0 + .long 1641152512 + .long 1065811444 + .long 1188689655 + .long 1027383036 + .long 830078976 + .long 1066853925 + .long 1683363035 + .long 1027948302 + .long 2542927872 + .long 1067522658 + .long 3621009110 + .long 1028493916 + .long 2686386176 + .long 1067891457 + .long 1949948784 + .long 1027381598 + .long 1667006464 + .long 1068256947 + .long 3184186889 + .long 1028293010 + .long 2150858752 + .long 1068558987 + .long 2486115301 + .long 1028528023 + .long 1655242752 + .long 1068739056 + .long 773151300 + .long 1026560495 + .long 1341652992 + .long 1068918120 + .long 2376679343 + .long 1026589938 + .long 861732864 + .long 1069095356 + .long 3976461951 + .long 1025794178 + .long 3619700736 + .long 1069270713 + .long 1113925208 + .long 1027979240 + .long 3789324288 + .long 1069445746 + .long 590586460 + .long 1028271785 + .long 2182004736 + .long 1069583575 + .long 297009670 + .long 1026900933 + .long 976470016 + .long 1069669519 + .long 2876077132 + .long 1027955084 + .long 665796608 + .long 1069755258 + .long 4251263665 + .long 1023912865 + .long 1282670592 + .long 1069839958 + .long 614174576 + .long 1028506527 + .long 1687183360 + .long 1069924424 + .long 2120169064 + .long 1026082260 + .long 4017643520 + .long 1070008228 + .long 1495131896 + .long 1028622058 + .long 4207116288 + .long 1070091353 + .long 1370573431 + .long 1027824851 + .long 1789706240 + .long 1070173781 + .long 3512135184 + .long 1026825352 + .long 53207040 + .long 1070255920 + .long 3737096549 + .long 1026438963 + .long 330194944 + .long 1070337330 + .long 2978734829 + .long 1028330940 + .long 3604373504 + .long 1070418425 + .long 3265342761 + .long 1026602327 + .long 2318204928 + .long 1070498761 + .long 3507296498 + .long 1027877621 + .long 3818315776 + .long 1070578756 + .long 677794871 + .long 1028109305 + .long 154591232 + .long 1070627028 + .long 135420162 + .long 1027142134 + .long 632459264 + .long 1070666446 + .long 256228069 + .long 1027376412 + .long 2011426816 + .long 1070705675 + .long 184843939 + .long 1027577616 + .long 2429726720 + .long 1070744485 + .long 3907638365 + .long 1027382133 + .long 2912112640 + .long 1070783319 + .long 596296254 + .long 1022964981 + .long 3197370368 + .long 1070821720 + .long 1122235614 + .long 1028265681 + .long 1147121664 + .long 1070859908 + .long 1274805357 + .long 1028037537 + .long 2702757888 + .long 1070897876 + .long 1929563301 + .long 1027984695 + .long 3792781312 + .long 1070935387 + .long 260587083 + .long 1027244900 + .long 1736605696 + .long 1070972899 + .long 1038777690 + .long 1028224348 + .long 2490597376 + .long 1071010174 + .long 574252996 + .long 1028557352 + .long 2465140736 + .long 1071047207 + .long 243175481 + .long 1026641700 + .long 2144403456 + .long 1071083992 + .long 835940059 + .long 1025870511 + .long 1797877760 + .long 1071120523 + .long 2362104182 + .long 1024853432 + .long 1487233024 + .long 1071156794 + .long 1462661599 + .long 1025546239 + .long 2657701888 + .long 1071193041 + .long 3841377895 + .long 1028504382 + .long 2881359872 + .long 1071229019 + .long 174174934 + .long 1028491418 + .long 1607143424 + .long 1071264722 + .long 3643575766 + .long 1028610165 + .long 2395561984 + .long 1071300143 + .long 2430782595 + .long 1027372849 + .long 658427904 + .long 1071335525 + .long 161357664 + .long 1028306250 + .long 242749440 + .long 1071370366 + .long 470667040 + .long 1025936066 + .long 3127775232 + .long 1071405408 + .long 2529919486 + .long 1027847357 + .long 2341548032 + .long 1071440150 + .long 89987554 + .long 1026534819 + .long 539168768 + .long 1071474585 + .long 2531816708 + .long 1025043792 + .long 234864640 + .long 1071508706 + .long 753765034 + .long 1027859052 + .long 2905993216 + .long 1071542763 + .long 3767440865 + .long 1023481353 + .long 3544465408 + .long 1071576755 + .long 756421882 + .long 1027650395 + .long 2658430976 + .long 1071610420 + .long 2178519328 + .long 1028288112 + .long 2660024320 + .long 1071644012 + .long 780560797 + .long 1023043397 + .long 2121920512 + .long 1071660969 + .long 3880750062 + .long 1025990162 + .long 2371102720 + .long 1071677556 + .long 2026769115 + .long 1027312699 + .long 1355743232 + .long 1071694102 + .long 3943781029 + .long 1028003666 + .long 649166848 + .long 1071710472 + .long 2315768408 + .long 1028563913 + .long 3712673792 + .long 1071726796 + .long 427741889 + .long 1025493722 + .long 1031030784 + .long 1071743075 + .long 132151873 + .long 1025660183 + .long 1854838784 + .long 1071759170 + .long 1812291413 + .long 1027042047 + .long 1572052992 + .long 1071775215 + .long 2231490673 + .long 1027883742 + .long 3357544448 + .long 1071791208 + .long 2435425658 + .long 1025969268 + .long 2690285568 + .long 1071807011 + .long 816977062 + .long 1028436202 + .long 473251840 + .long 3218771869 + .long 1330616403 + .long 3175482613 + .long 2934157312 + .long 3218740486 + .long 3685911680 + .long 3175415699 + .long 2326081536 + .long 3218709220 + .long 4062709 + .long 3171839703 + .long 1474240512 + .long 3218678073 + .long 3223011199 + .long 3174963306 + .long 2315530240 + .long 3218647330 + .long 3482179715 + .long 3175726112 + .long 3209805824 + .long 3218616430 + .long 1850213782 + .long 3175467046 + .long 92246016 + .long 3218585658 + .long 2672047941 + .long 3174429943 + .long 939302912 + .long 3218555302 + .long 2683312141 + .long 3175097844 + .long 3886694400 + .long 3218525081 + .long 3584491562 + .long 3175164762 + .long 3897806848 + .long 3218494709 + .long 2353689255 + .long 3175401216 + .long 2446540800 + .long 3218464767 + .long 3549477525 + .long 3175044174 + .long 863473664 + .long 3218434969 + .long 834332530 + .long 3174636992 + .long 1568866304 + .long 3218405023 + .long 3528175174 + .long 3174626157 + .long 558092288 + .long 3218375520 + .long 2586999089 + .long 3168836697 + .long 2316124160 + .long 3218346169 + .long 686294058 + .long 3172297276 + .long 3825598464 + .long 3218316675 + .long 1136723030 + .long 3175382806 + .long 4172640256 + .long 3218287637 + .long 3760034353 + .long 3171774178 + .long 143781888 + .long 3218258460 + .long 1815979570 + .long 3174536455 + .long 2912956416 + .long 3218229746 + .long 4273313359 + .long 3173677065 + .long 1821376512 + .long 3218200896 + .long 1051181106 + .long 3175433943 + .long 3545214976 + .long 3218172213 + .long 881689764 + .long 3173077446 + .long 977260544 + .long 3218144009 + .long 607141 + .long 3173756076 + .long 2363125760 + .long 3218115672 + .long 1333321633 + .long 3175335724 + .long 2364801024 + .long 3218087202 + .long 3356747073 + .long 3174852978 + .long 2121375744 + .long 3218038698 + .long 549802689 + .long 3174897014 + .long 155041792 + .long 3217983102 + .long 4093639872 + .long 3174461350 + .long 4268572672 + .long 3217927248 + .long 3146719241 + .long 3173737604 + .long 3896410112 + .long 3217871768 + .long 3834824761 + .long 3171284429 + .long 492560384 + .long 3217816668 + .long 239252792 + .long 3173483664 + .long 4219723776 + .long 3217761952 + .long 3911150007 + .long 3175766937 + .long 1522245632 + .long 3217706989 + .long 2153956895 + .long 3175454574 + .long 3796140032 + .long 3217653061 + .long 1733676290 + .long 3175095395 + .long 155754496 + .long 3217598893 + .long 1693604437 + .long 3175909818 + .long 2753691648 + .long 3217544480 + .long 3490227517 + .long 3173083716 + .long 3246325760 + .long 3217491126 + .long 1834407662 + .long 3175168640 + .long 2629189632 + .long 3217437536 + .long 394182940 + .long 3174297893 + .long 4285202432 + .long 3217384365 + .long 127148739 + .long 3175942199 + .long 2197757952 + .long 3217331621 + .long 326147828 + .long 3175005587 + .long 623484928 + .long 3217278646 + .long 2190917468 + .long 3175273136 + .long 1792204800 + .long 3217226104 + .long 3259512355 + .long 3174781320 + .long 41181184 + .long 3217174003 + .long 3260046653 + .long 3174058211 + .long 1413185536 + .long 3217121676 + .long 2746620881 + .long 3175463126 + .long 2720399360 + .long 3217069797 + .long 590176758 + .long 3175866008 + .long 1549172736 + .long 3217005579 + .long 3081069142 + .long 3175953539 + .long 2465087488 + .long 3216902292 + .long 4241850246 + .long 3175110025 + .long 3847749632 + .long 3216799930 + .long 59228567 + .long 3174380829 + .long 4210442240 + .long 3216698507 + .long 2884243012 + .long 3174896587 + .long 1231667200 + .long 3216596658 + .long 2996426567 + .long 3174508538 + .long 1101037568 + .long 3216495763 + .long 3170347605 + .long 3176066808 + .long 2861760512 + .long 3216395836 + .long 52313802 + .long 3174148818 + .long 3538583552 + .long 3216295495 + .long 291262391 + .long 3169534916 + .long 2493661184 + .long 3216196139 + .long 979886872 + .long 3175226185 + .long 3478798336 + .long 3216096373 + .long 329155479 + .long 3175972274 + .long 4175200256 + .long 3215997608 + .long 3920581672 + .long 3172282657 + .long 4103045120 + .long 3215814286 + .long 1366711740 + .long 3174574396 + .long 3613917184 + .long 3215617982 + .long 3682391844 + .long 3173719142 + .long 3246555136 + .long 3215423741 + .long 4071576370 + .long 3174315914 + .long 575995904 + .long 3215228718 + .long 2479189453 + .long 3173663302 + .long 2771812352 + .long 3215032905 + .long 1608471371 + .long 3175357197 + .long 3995074560 + .long 3214744373 + .long 766833229 + .long 3175292855 + .long 830078976 + .long 3214361213 + .long 1258533011 + .long 3175547121 + .long 219152384 + .long 3213976530 + .long 1716511551 + .long 3175540921 + .long 1290797056 + .long 3213306911 + .long 1477436787 + .long 3173730612 + .long 1836580864 + .long 3212249540 + .long 1456335140 + .long 3175441338 + .long 0 + .long 0 + .long 0 + .long 0 + .type log2_t1,@object + .size log2_t1,2064 + .align 16 +log2_t2: + .long 0 + .long 0 + .long 0 + .long 0 + .long 2088763392 + .long 1059147817 + .long 4130365781 + .long 1025575177 + .long 3758096384 + .long 1060385579 + .long 3761435677 + .long 1024020876 + .long 1623195648 + .long 1061142175 + .long 1460419383 + .long 1028311484 + .long 2740977664 + .long 1061528887 + .long 1629990790 + .long 1027810560 + .long 3418357760 + .long 1061907277 + .long 3164482262 + .long 1027367455 + .long 372244480 + .long 1062246601 + .long 749537322 + .long 1027570412 + .long 1678770176 + .long 1062435842 + .long 1420381118 + .long 1028382503 + .long 3506438144 + .long 1062625106 + .long 2539787500 + .long 1028059273 + .long 1584398336 + .long 1062814394 + .long 4277851274 + .long 1025918452 + .long 230686720 + .long 1063003705 + .long 2279601279 + .long 1027165899 + .long 3765436416 + .long 1063193038 + .long 1648733663 + .long 1027693874 + .long 3958898688 + .long 1063319229 + .long 3585544732 + .long 1028203366 + .long 4208984064 + .long 1063413919 + .long 395326031 + .long 1026777160 + .long 2644508672 + .long 1063508621 + .long 3080139365 + .long 1026686561 + .long 3572498432 + .long 1063603334 + .long 3213016626 + .long 1028477442 + .long 2711093248 + .long 1063698059 + .long 439612993 + .long 1027235725 + .long 71303168 + .long 1063792796 + .long 847494235 + .long 1028613481 + .long 4256169984 + .long 1063887543 + .long 1915821278 + .long 1028326816 + .long 2392850432 + .long 1063982303 + .long 2225307780 + .long 1026401230 + .long 3082813440 + .long 1064077074 + .long 3438929084 + .long 1027103624 + .long 2043674624 + .long 1064171857 + .long 2082386238 + .long 1027684439 + .long 3582459904 + .long 1064266651 + .long 1897021122 + .long 1028567773 + .long 3855876096 + .long 1064333048 + .long 1828790394 + .long 1028459899 + .long 2926837760 + .long 1064380457 + .long 4113329424 + .long 1027931731 + .long 1157627904 + .long 1064427872 + .long 1702728849 + .long 1027539743 + .long 2849243136 + .long 1064475292 + .long 981368224 + .long 1027987814 + .long 3713007616 + .long 1064522718 + .long 3588215231 + .long 1027706406 + .long 3754950656 + .long 1064570150 + .long 2599429676 + .long 1027136642 + .long 2981101568 + .long 1064617588 + .long 3033621989 + .long 1027640910 + .long 1397751808 + .long 1064665032 + .long 1866428510 + .long 1026593332 + .long 3305635840 + .long 1064712481 + .long 3898020334 + .long 1028538281 + .long 121372672 + .long 1064759937 + .long 2418247211 + .long 1028479303 + .long 440926208 + .long 1064807398 + .long 2151876465 + .long 1027654537 + .long 4270325760 + .long 1064854864 + .long 638259760 + .long 1025479387 + .long 3025666048 + .long 1064902337 + .long 3300197061 + .long 1024786488 + .long 1007943680 + .long 1064949816 + .long 2066224929 + .long 1028181309 + .long 2518679552 + .long 1064997300 + .long 1194091706 + .long 1027784991 + .long 3268673536 + .long 1065044790 + .long 3941768658 + .long 1028458821 + .long 3264479232 + .long 1065092286 + .long 2285092471 + .long 1025632049 + .long 2511601664 + .long 1065139788 + .long 274659519 + .long 1028009304 + .long 1016594432 + .long 1065187296 + .long 2660244528 + .long 1028621601 + .long 3080716288 + .long 1065234809 + .long 2948866684 + .long 1027363323 + .long 119799808 + .long 1065282329 + .long 2305553338 + .long 1027606374 + .long 730071040 + .long 1065329854 + .long 1656362908 + .long 1027822979 + .long 2458910720 + .long 1065365300 + .long 1598786858 + .long 1026178251 + .long 2587623424 + .long 1065383126 + .long 2378958549 + .long 1028197240 + .long 839778304 + .long 1065406897 + .long 1456429431 + .long 1026244901 + .long 3036413952 + .long 1065430670 + .long 1932205944 + .long 1027981879 + .long 590872576 + .long 1065454447 + .long 4023608769 + .long 1027958429 + .long 2096103424 + .long 1065478226 + .long 3732079947 + .long 1027967416 + .long 3260284928 + .long 1065502008 + .long 336608668 + .long 1026095801 + .long 4086300672 + .long 1065525793 + .long 136967562 + .long 1028120471 + .long 282460160 + .long 1065549582 + .long 3624814115 + .long 1028328839 + .long 441843712 + .long 1065573373 + .long 3566723455 + .long 1022759747 + .long 272236544 + .long 1065597167 + .long 4015454571 + .long 1028257780 + .long 4072013824 + .long 1065620963 + .long 4162319098 + .long 1028151765 + .long 3254255616 + .long 1065644763 + .long 3888083220 + .long 1027286836 + .long 2116943872 + .long 1065668566 + .long 1025436577 + .long 1027036048 + .long 663224320 + .long 1065692372 + .long 2834872887 + .long 1025744984 + .long 3191078912 + .long 1065716180 + .long 1809631811 + .long 1027064556 + .long 1113718784 + .long 1065739992 + .long 1168962244 + .long 1027829789 + .long 3024224256 + .long 1065763806 + .long 2016586535 + .long 1027435289 + .long 335675392 + .long 1065787624 + .long 1431812300 + .long 1027676827 + .long 1836580864 + .long 3212249540 + .long 1456335140 + .long 3175441338 + .long 2446065664 + .long 3212225994 + .long 1539749707 + .long 3174539680 + .long 1201405952 + .long 3212202447 + .long 1821058149 + .long 3175488506 + .long 2397044736 + .long 3212178898 + .long 3567155664 + .long 3175677071 + .long 1737228288 + .long 3212155348 + .long 3350760572 + .long 3175687587 + .long 3516137472 + .long 3212131796 + .long 54506174 + .long 3175826950 + .long 3438280704 + .long 3212108243 + .long 1906648915 + .long 3172999433 + .long 1502347264 + .long 3212084689 + .long 2084064274 + .long 3175617184 + .long 2003042304 + .long 3212061133 + .long 2608241578 + .long 3175876387 + .long 644612096 + .long 3212037576 + .long 1051263361 + .long 3175383946 + .long 1721237504 + .long 3212014017 + .long 3354885735 + .long 3173549367 + .long 936902656 + .long 3211990457 + .long 87463564 + .long 3175445923 + .long 2586312704 + .long 3211966895 + .long 506361461 + .long 3173795297 + .long 2373189632 + .long 3211943332 + .long 3280686310 + .long 3176104310 + .long 297533440 + .long 3211919768 + .long 3617245347 + .long 3172626443 + .long 652738560 + .long 3211896202 + .long 579141699 + .long 3175545653 + .long 3438542848 + .long 3211872634 + .long 3721652079 + .long 3176073447 + .long 64225280 + .long 3211849066 + .long 4212107268 + .long 3176133288 + .long 3413901312 + .long 3211825495 + .long 2932346116 + .long 3176017856 + .long 601882624 + .long 3211801924 + .long 3484155727 + .long 3176018735 + .long 435159040 + .long 3211768414 + .long 1225556500 + .long 3173101246 + .long 224395264 + .long 3211721265 + .long 1151472644 + .long 3175433137 + .long 570949632 + .long 3211674113 + .long 169440649 + .long 3175424350 + .long 1473249280 + .long 3211626958 + .long 767490525 + .long 3174092077 + .long 2929197056 + .long 3211579800 + .long 3954462340 + .long 3175313650 + .long 642777088 + .long 3211532640 + .long 293664658 + .long 3175782850 + .long 3202875392 + .long 3211485476 + .long 2810753961 + .long 3172053070 + .long 2016935936 + .long 3211438310 + .long 68049842 + .long 3174903053 + .long 1379401728 + .long 3211391141 + .long 2125367929 + .long 3172998826 + .long 1288175616 + .long 3211343969 + .long 2899939163 + .long 3173729914 + .long 1741684736 + .long 3211296794 + .long 3555933291 + .long 3175823424 + .long 2739404800 + .long 3211249616 + .long 3666032509 + .long 3173379218 + .long 4278714368 + .long 3211202435 + .long 836003693 + .long 3174279974 + .long 2063597568 + .long 3211155252 + .long 1236704766 + .long 3174628627 + .long 387448832 + .long 3211108066 + .long 2756688253 + .long 3175196858 + .long 3543662592 + .long 3211060876 + .long 3160170483 + .long 3175973516 + .long 2941255680 + .long 3211013684 + .long 2830353174 + .long 3175364122 + .long 2873098240 + .long 3210966489 + .long 4144291481 + .long 3175737650 + .long 3338141696 + .long 3210919291 + .long 3260331491 + .long 3175267671 + .long 39845888 + .long 3210872091 + .long 1922313952 + .long 3172367859 + .long 1566048256 + .long 3210824887 + .long 3310171853 + .long 3174855326 + .long 3620732928 + .long 3210777680 + .long 3325808113 + .long 3175681701 + .long 3815768064 + .long 3210721230 + .long 3926816425 + .long 3173875772 + .long 1439694848 + .long 3210626806 + .long 2528441557 + .long 3175954827 + .long 112197632 + .long 3210532376 + .long 2735049661 + .long 3176047308 + .long 4125097984 + .long 3210437939 + .long 2814107016 + .long 3175038571 + .long 589299712 + .long 3210343498 + .long 84420116 + .long 3175362012 + .long 2387607552 + .long 3210249050 + .long 886636141 + .long 3175106949 + .long 926941184 + .long 3210154597 + .long 4249864732 + .long 3174015648 + .long 498073600 + .long 3210060138 + .long 2571744411 + .long 3176070508 + .long 1099956224 + .long 3209965673 + .long 191977345 + .long 3175708074 + .long 2728394752 + .long 3209871202 + .long 1836848871 + .long 3175824104 + .long 1086324736 + .long 3209776726 + .long 3259464767 + .long 3174065342 + .long 929038336 + .long 3209673352 + .long 885961784 + .long 3173053400 + .long 1719664640 + .long 3209484376 + .long 3633085090 + .long 3175298882 + .long 245366784 + .long 3209295389 + .long 622998640 + .long 3175676299 + .long 794820608 + .long 3209106390 + .long 183843539 + .long 3175700419 + .long 3361734656 + .long 3208917379 + .long 319142191 + .long 3175621005 + .long 3644850176 + .long 3208728357 + .long 4064393657 + .long 3175686713 + .long 3279945728 + .long 3208436088 + .long 921315957 + .long 3167773730 + .long 3263168512 + .long 3208057998 + .long 1191737347 + .long 3175145444 + .long 2940207104 + .long 3207679885 + .long 676306098 + .long 3174972367 + .long 293601280 + .long 3207009515 + .long 3713153157 + .long 3176043736 + .long 989855744 + .long 3205960985 + .long 847981310 + .long 3172455261 + .long 0 + .long 0 + .long 0 + .long 0 + .type log2_t2,@object + .size log2_t2,2064 + .align 16 +log2_t3: + .long 0 + .long 0 + .long 0 + .long 0 + .long 3221225472 + .long 1052246016 + .long 10217817 + .long 1028072176 + .long 2684354560 + .long 1053294593 + .long 1823923246 + .long 1027991127 + .long 2684354560 + .long 1053884417 + .long 2844515178 + .long 1028130658 + .long 0 + .long 1054277635 + .long 1230948249 + .long 1025710668 + .long 2952790016 + .long 1054670852 + .long 1764281763 + .long 1028204164 + .long 1744830464 + .long 1054965763 + .long 2682119783 + .long 1027942224 + .long 1879048192 + .long 1055129604 + .long 690677466 + .long 1027931089 + .long 3623878656 + .long 1055326213 + .long 2988899587 + .long 1028585756 + .long 2013265920 + .long 1055522823 + .long 2646883118 + .long 1027643276 + .long 1207959552 + .long 1055719433 + .long 3152640337 + .long 1026797173 + .long 4026531840 + .long 1055883274 + .long 2707659781 + .long 1026392505 + .long 2348810240 + .long 1055997958 + .long 2715649106 + .long 1027422884 + .long 3087007744 + .long 1056096263 + .long 285997833 + .long 1028488126 + .long 0 + .long 1056194569 + .long 2595623046 + .long 1027865547 + .long 1610612736 + .long 1056292874 + .long 3757543522 + .long 1027743124 + .long 2550136832 + .long 1056374795 + .long 1685325986 + .long 1027848425 + .long 603979776 + .long 1056473101 + .long 971111892 + .long 1028643022 + .long 3422552064 + .long 1056571406 + .long 1310768194 + .long 1027840696 + .long 2348810240 + .long 1056669712 + .long 647785154 + .long 1027472771 + .long 335544320 + .long 1056751634 + .long 3447719136 + .long 1027384110 + .long 0 + .long 1056849940 + .long 2473353221 + .long 1028109426 + .long 134217728 + .long 1056948246 + .long 3908013601 + .long 1026650988 + .long 335544320 + .long 1057005580 + .long 3241725099 + .long 1023809487 + .long 4261412864 + .long 1057046540 + .long 3592425610 + .long 1028549905 + .long 637534208 + .long 1057095694 + .long 1951774861 + .long 1025790338 + .long 1476395008 + .long 1057144847 + .long 2386717008 + .long 1027825275 + .long 2550136832 + .long 1057194000 + .long 936867399 + .long 1026725625 + .long 3825205248 + .long 1057243153 + .long 3781996145 + .long 1026256374 + .long 33554432 + .long 1057284115 + .long 1781441569 + .long 1026554167 + .long 1677721600 + .long 1057333268 + .long 541855954 + .long 1027837629 + .long 3556769792 + .long 1057382421 + .long 3808194027 + .long 1026230743 + .long 1342177280 + .long 1057431575 + .long 1679773493 + .long 1024039205 + .long 2516582400 + .long 1057472536 + .long 4034037987 + .long 1022229492 + .long 671088640 + .long 1057521690 + .long 1732823594 + .long 1026728033 + .long 3321888768 + .long 1057570843 + .long 2629452715 + .long 1028246558 + .long 1912602624 + .long 1057619997 + .long 2171860443 + .long 1027730387 + .long 704643072 + .long 1057669151 + .long 1413946002 + .long 1027714921 + .long 2717908992 + .long 1057710112 + .long 3583986569 + .long 1027909771 + .long 1912602624 + .long 1057759266 + .long 2993702118 + .long 1024684384 + .long 1275068416 + .long 1057808420 + .long 3380540156 + .long 1028118518 + .long 872415232 + .long 1057857574 + .long 3787132338 + .long 1027925509 + .long 3556769792 + .long 1057898535 + .long 399829967 + .long 1027972484 + .long 3556769792 + .long 1057947689 + .long 99635239 + .long 1022741119 + .long 3724541952 + .long 1057996843 + .long 3258250598 + .long 1027826609 + .long 4211081216 + .long 1058029590 + .long 3506657137 + .long 1027308398 + .long 3741319168 + .long 1058050071 + .long 541288431 + .long 1027107230 + .long 4127195136 + .long 1058074648 + .long 3646427416 + .long 1027904075 + .long 335544320 + .long 1058099226 + .long 246496071 + .long 1025659624 + .long 922746880 + .long 1058123803 + .long 2177775776 + .long 1028406323 + .long 1627389952 + .long 1058148380 + .long 1181919501 + .long 1028360402 + .long 1577058304 + .long 1058168861 + .long 1426415599 + .long 1028530121 + .long 2483027968 + .long 1058193438 + .long 1417624514 + .long 1027006858 + .long 3489660928 + .long 1058218015 + .long 3323042516 + .long 1021955058 + .long 285212672 + .long 1058242593 + .long 710383729 + .long 1028457251 + .long 570425344 + .long 1058263074 + .long 179923617 + .long 1028480130 + .long 1879048192 + .long 1058287651 + .long 1513572732 + .long 1026553379 + .long 3271557120 + .long 1058312228 + .long 3860576606 + .long 1028277345 + .long 486539264 + .long 1058336806 + .long 742310640 + .long 1027879207 + .long 1107296256 + .long 1058357287 + .long 2654634259 + .long 1027755563 + .long 2801795072 + .long 1058381864 + .long 2910466432 + .long 1028276410 + .long 318767104 + .long 1058406442 + .long 4054947979 + .long 1026798334 + .long 2231369728 + .long 1058431019 + .long 878023543 + .long 1023510847 + .long 4227858432 + .long 1058455596 + .long 263450436 + .long 1028652562 + .long 989855744 + .long 1058476078 + .long 3244478756 + .long 1024589954 + .long 3187671040 + .long 1058500655 + .long 1529358695 + .long 1027496060 + .long 1207959552 + .long 1058525233 + .long 1449606828 + .long 1025374457 + .long 3607101440 + .long 1058549810 + .long 1121865491 + .long 1028651213 + .long 704643072 + .long 1058570292 + .long 76632162 + .long 1015281729 + .long 3305111552 + .long 1058594869 + .long 1705840257 + .long 1026852007 + .long 1711276032 + .long 1058619447 + .long 2189122428 + .long 1028401790 + .long 234881024 + .long 1058644025 + .long 3860440574 + .long 1027979737 + .long 1946157056 + .long 1058664506 + .long 3805699399 + .long 1027836413 + .long 654311424 + .long 1058689084 + .long 3144514508 + .long 1028333941 + .long 3774873600 + .long 1058713661 + .long 1551239808 + .long 1026867407 + .long 2701131776 + .long 1058738239 + .long 3872647589 + .long 1023700698 + .long 1711276032 + .long 1058762817 + .long 2939649020 + .long 1028642081 + .long 3858759680 + .long 1058783298 + .long 3869973501 + .long 1024259487 + .long 3070230528 + .long 1058807876 + .long 3430235573 + .long 1027394848 + .long 2399141888 + .long 1058832454 + .long 2837866956 + .long 1024798194 + .long 1811939328 + .long 1058857032 + .long 3195008471 + .long 1028558077 + .long 4278190080 + .long 1058877513 + .long 925127753 + .long 1028542902 + .long 3909091328 + .long 1058902091 + .long 3453656528 + .long 1026590044 + .long 3623878656 + .long 1058926669 + .long 2547020848 + .long 1028250625 + .long 3456106496 + .long 1058951247 + .long 3173507594 + .long 1027808713 + .long 1962934272 + .long 1058971729 + .long 624230052 + .long 1027649088 + .long 1979711488 + .long 1058996307 + .long 1896525098 + .long 1028127351 + .long 2113929216 + .long 1059020885 + .long 3776127051 + .long 1026276788 + .long 2332033024 + .long 1059045463 + .long 1850790470 + .long 1028492603 + .long 3481272320 + .long 1059065900 + .long 111238633 + .long 1028379644 + .long 2944401408 + .long 1059076141 + .long 1234093769 + .long 1028494241 + .long 3212836864 + .long 1059088430 + .long 4181043184 + .long 1026804589 + .long 3523215360 + .long 1059100719 + .long 2569064410 + .long 1028514056 + .long 3892314112 + .long 1059113008 + .long 312914348 + .long 1028228528 + .long 3523215360 + .long 1059123249 + .long 3115983504 + .long 1028199393 + .long 3992977408 + .long 1059135538 + .long 2038492604 + .long 1024861349 + .long 209715200 + .long 1059147828 + .long 152199155 + .long 1027874535 + .long 780140544 + .long 1059160117 + .long 1978960733 + .long 1027229157 + .long 578813952 + .long 1059170358 + .long 505645676 + .long 1026884061 + .long 1241513984 + .long 1059182647 + .long 514239020 + .long 1027707324 + .long 1962934272 + .long 1059194936 + .long 2032269232 + .long 1021518627 + .long 2726297600 + .long 1059207225 + .long 3497533428 + .long 1028043129 + .long 3548381184 + .long 1059219514 + .long 3658695522 + .long 1027915933 + .long 3556769792 + .long 1059229755 + .long 501547381 + .long 1028018915 + .long 184549376 + .long 1059242045 + .long 3705047602 + .long 1024687479 + .long 1149239296 + .long 1059254334 + .long 675335170 + .long 1028011771 + .long 2172649472 + .long 1059266623 + .long 2543593460 + .long 1027713249 + .long 2348810240 + .long 1059276864 + .long 2216047412 + .long 1027673535 + .long 3464495104 + .long 1059289153 + .long 712855157 + .long 1028296196 + .long 343932928 + .long 1059301443 + .long 930266665 + .long 1027043929 + .long 1568669696 + .long 1059313732 + .long 780927773 + .long 1025654091 + .long 1912602624 + .long 1059323973 + .long 3399331078 + .long 1024229490 + .long 3229614080 + .long 1059336262 + .long 3996204339 + .long 1026644611 + .long 301989888 + .long 1059348552 + .long 143359080 + .long 1028079044 + .long 1728053248 + .long 1059360841 + .long 2849827553 + .long 1027273550 + .long 3204448256 + .long 1059373130 + .long 2690987141 + .long 1026998795 + .long 3758096384 + .long 1059383371 + .long 2222711807 + .long 1027188284 + .long 1031798784 + .long 1059395661 + .long 1353013621 + .long 1028180599 + .long 2659188736 + .long 1059407950 + .long 756253115 + .long 1027136298 + .long 41943040 + .long 1059420240 + .long 532576643 + .long 1026486854 + .long 763363328 + .long 1059430481 + .long 3289135452 + .long 1026299195 + .long 2533359616 + .long 1059442770 + .long 1513734706 + .long 1027630332 + .long 67108864 + .long 1059455060 + .long 2085312894 + .long 1023872287 + .long 1937768448 + .long 1059467349 + .long 3183199319 + .long 1028270313 + .long 2826960896 + .long 1059477590 + .long 3972158195 + .long 1028082057 + .long 503316480 + .long 1059489880 + .long 264248663 + .long 1028526857 + .long 2533359616 + .long 1059502169 + .long 3362227203 + .long 1027150375 + .long 318767104 + .long 1059514459 + .long 4064547853 + .long 1024810530 + .long 268435456 + .long 3205959634 + .long 691182318 + .long 3173304996 + .long 3456106496 + .long 3205947346 + .long 2237848631 + .long 3175922029 + .long 1291845632 + .long 3205939155 + .long 2610806712 + .long 3173520353 + .long 150994944 + .long 3205926868 + .long 1392581829 + .long 3174351268 + .long 3271557120 + .long 3205914580 + .long 3292400060 + .long 3175929370 + .long 2080374784 + .long 3205902293 + .long 4178356410 + .long 3175965902 + .long 872415232 + .long 3205890006 + .long 330416743 + .long 3174570455 + .long 3925868544 + .long 3205877718 + .long 1897771058 + .long 3174145242 + .long 2650800128 + .long 3205865431 + .long 3340394865 + .long 3175328080 + .long 1358954496 + .long 3205853144 + .long 4006478009 + .long 3174644517 + .long 33554432 + .long 3205840857 + .long 2338318098 + .long 3175328560 + .long 1996488704 + .long 3205832665 + .long 908420916 + .long 3175917031 + .long 637534208 + .long 3205820378 + .long 1000116813 + .long 3175123051 + .long 3539992576 + .long 3205808090 + .long 4281444920 + .long 3175253057 + .long 2130706432 + .long 3205795803 + .long 376816689 + .long 3172256578 + .long 687865856 + .long 3205783516 + .long 196000653 + .long 3170433881 + .long 3506438144 + .long 3205771228 + .long 2744030195 + .long 3174702892 + .long 2013265920 + .long 3205758941 + .long 2211786449 + .long 3173892702 + .long 486539264 + .long 3205746654 + .long 4020273651 + .long 3175077302 + .long 2315255808 + .long 3205738462 + .long 3572678407 + .long 3175733405 + .long 754974720 + .long 3205726175 + .long 1564087220 + .long 3174977341 + .long 3456106496 + .long 3205713887 + .long 1784641315 + .long 3175256025 + .long 1845493760 + .long 3205701600 + .long 679907493 + .long 3173008683 + .long 201326592 + .long 3205689313 + .long 2119625261 + .long 3172818812 + .long 2818572288 + .long 3205677025 + .long 2101485035 + .long 3175178180 + .long 1124073472 + .long 3205664738 + .long 2832998731 + .long 3174717836 + .long 3690987520 + .long 3205652450 + .long 3610578708 + .long 3175551729 + .long 1946157056 + .long 3205640163 + .long 2398766049 + .long 3174966407 + .long 3623878656 + .long 3205631971 + .long 3995335152 + .long 3175656959 + .long 1828716544 + .long 3205619684 + .long 183250326 + .long 3175973344 + .long 16777216 + .long 3205607397 + .long 4019803825 + .long 3175116509 + .long 2466250752 + .long 3205595109 + .long 1578128721 + .long 3175183606 + .long 603979776 + .long 3205582822 + .long 112661265 + .long 3170010307 + .long 2986344448 + .long 3205570534 + .long 3756900035 + .long 3175992425 + .long 1073741824 + .long 3205558247 + .long 3996691019 + .long 3174185852 + .long 3422552064 + .long 3205545959 + .long 4247306560 + .long 3172221188 + .long 1442840576 + .long 3205533672 + .long 920037013 + .long 3174307610 + .long 2969567232 + .long 3205525480 + .long 2901018317 + .long 3175306400 + .long 956301312 + .long 3205513193 + .long 4209407270 + .long 3173953969 + .long 3204448256 + .long 3205500905 + .long 4232478211 + .long 3174316659 + .long 2248146944 + .long 3205480404 + .long 3976793802 + .long 3175786245 + .long 2348810240 + .long 3205455829 + .long 223141518 + .long 3175696845 + .long 2415919104 + .long 3205431254 + .long 2202058045 + .long 3173520944 + .long 2415919104 + .long 3205406679 + .long 780543142 + .long 3170584573 + .long 2348810240 + .long 3205382104 + .long 1379108477 + .long 3174272970 + .long 2248146944 + .long 3205357529 + .long 875461665 + .long 3170488084 + .long 704643072 + .long 3205341146 + .long 2105849568 + .long 3174271106 + .long 503316480 + .long 3205316571 + .long 1835672135 + .long 3174776330 + .long 234881024 + .long 3205291996 + .long 3252628102 + .long 3176108718 + .long 4227858432 + .long 3205267420 + .long 2720009520 + .long 3176111930 + .long 3892314112 + .long 3205242845 + .long 850238367 + .long 3174795595 + .long 3489660928 + .long 3205218270 + .long 3536085073 + .long 3174303192 + .long 3019898880 + .long 3205193695 + .long 3558909717 + .long 3175373323 + .long 2516582400 + .long 3205169120 + .long 920693007 + .long 3174667265 + .long 704643072 + .long 3205152737 + .long 4071589563 + .long 3175526566 + .long 100663296 + .long 3205128162 + .long 3392361480 + .long 3175871650 + .long 3758096384 + .long 3205103586 + .long 2972601747 + .long 3174998742 + .long 3053453312 + .long 3205079011 + .long 1605892160 + .long 3175139069 + .long 2315255808 + .long 3205054436 + .long 1553740054 + .long 3169146216 + .long 1476395008 + .long 3205029861 + .long 3751995331 + .long 3176004720 + .long 637534208 + .long 3205005286 + .long 3091908485 + .long 3174267031 + .long 4026531840 + .long 3204980710 + .long 3333214935 + .long 3172771610 + .long 3053453312 + .long 3204956135 + .long 790487160 + .long 3174501480 + .long 939524096 + .long 3204939752 + .long 1992793420 + .long 3175422045 + .long 4194304000 + .long 3204915176 + .long 3717748377 + .long 3174284044 + .long 3087007744 + .long 3204890601 + .long 105034497 + .long 3174659776 + .long 1912602624 + .long 3204866026 + .long 4120994791 + .long 3175985638 + .long 704643072 + .long 3204841451 + .long 136721814 + .long 3175923992 + .long 3758096384 + .long 3204816875 + .long 4178760049 + .long 3174289887 + .long 2449473536 + .long 3204792300 + .long 1385241146 + .long 3173295534 + .long 1073741824 + .long 3204767725 + .long 614436572 + .long 3174892815 + .long 3959422976 + .long 3204743149 + .long 3717352206 + .long 3173503234 + .long 1543503872 + .long 3204726766 + .long 2074792065 + .long 3174982293 + .long 33554432 + .long 3204702191 + .long 1160049312 + .long 3175315117 + .long 2785017856 + .long 3204677615 + .long 947382601 + .long 3173470865 + .long 1174405120 + .long 3204653040 + .long 1784674375 + .long 3173592242 + .long 3791650816 + .long 3204628464 + .long 3966380974 + .long 3175406146 + .long 2080374784 + .long 3204603889 + .long 90923019 + .long 3175186916 + .long 301989888 + .long 3204579314 + .long 2809276197 + .long 3175891468 + .long 2785017856 + .long 3204554738 + .long 2488581129 + .long 3175422649 + .long 100663296 + .long 3204538355 + .long 4207284753 + .long 3176089346 + .long 2516582400 + .long 3204513779 + .long 1763582947 + .long 3173239999 + .long 536870912 + .long 3204489204 + .long 1591642683 + .long 3175659480 + .long 2818572288 + .long 3204464628 + .long 1247815734 + .long 3175781625 + .long 1543503872 + .long 3204431850 + .long 3175237814 + .long 3174372638 + .long 1610612736 + .long 3204382699 + .long 3136020064 + .long 3174117678 + .long 1543503872 + .long 3204333548 + .long 145926225 + .long 3175399182 + .long 1409286144 + .long 3204284397 + .long 1146502365 + .long 3174956000 + .long 1140850688 + .long 3204235246 + .long 1806880589 + .long 3175568698 + .long 3825205248 + .long 3204202478 + .long 748557588 + .long 3171070759 + .long 3355443200 + .long 3204153327 + .long 3616893112 + .long 3175503309 + .long 2818572288 + .long 3204104176 + .long 3332544853 + .long 3175717064 + .long 2214592512 + .long 3204055025 + .long 59215988 + .long 3174426688 + .long 1476395008 + .long 3204005874 + .long 2509632280 + .long 3174354848 + .long 603979776 + .long 3203956723 + .long 1669980294 + .long 3175609302 + .long 3959422976 + .long 3203907571 + .long 231858041 + .long 3175323695 + .long 2885681152 + .long 3203858420 + .long 192153543 + .long 3175961815 + .long 1744830464 + .long 3203809269 + .long 507582953 + .long 3175426507 + .long 3758096384 + .long 3203776501 + .long 1672537466 + .long 3176048847 + .long 2483027968 + .long 3203727350 + .long 3522791035 + .long 3172632365 + .long 1006632960 + .long 3203678199 + .long 2149811783 + .long 3175485759 + .long 3758096384 + .long 3203629047 + .long 1999469990 + .long 3175541209 + .long 2147483648 + .long 3203579896 + .long 2226222860 + .long 3173477057 + .long 402653184 + .long 3203530745 + .long 4286112849 + .long 3172408839 + .long 2818572288 + .long 3203481593 + .long 713604598 + .long 3174828560 + .long 872415232 + .long 3203432442 + .long 2347361448 + .long 3173841417 + .long 1879048192 + .long 3203366901 + .long 1438571646 + .long 3174899801 + .long 402653184 + .long 3203301366 + .long 3419522004 + .long 3175593882 + .long 268435456 + .long 3203203063 + .long 4288382338 + .long 3174545520 + .long 4160749568 + .long 3203104759 + .long 272162157 + .long 3174838779 + .long 3489660928 + .long 3203006456 + .long 2794103335 + .long 3176033766 + .long 2684354560 + .long 3202908153 + .long 2632246937 + .long 3175930608 + .long 1744830464 + .long 3202809850 + .long 1508829515 + .long 3174219824 + .long 536870912 + .long 3202711547 + .long 3295780812 + .long 3172985552 + .long 3355443200 + .long 3202613243 + .long 1122596525 + .long 3174655334 + .long 805306368 + .long 3202547708 + .long 2645694757 + .long 3175532338 + .long 3355443200 + .long 3202449404 + .long 1159177678 + .long 3174604459 + .long 2684354560 + .long 3202351098 + .long 1034248407 + .long 3175079694 + .long 2684354560 + .long 3202154491 + .long 1158806475 + .long 3171580989 + .long 2147483648 + .long 3201957884 + .long 1293148021 + .long 3171385480 + .long 1073741824 + .long 3201761277 + .long 3828985497 + .long 3175006371 + .long 4026531840 + .long 3201564669 + .long 3153776129 + .long 3174482233 + .long 2147483648 + .long 3201368062 + .long 171710315 + .long 3175446758 + .long 0 + .long 3201040382 + .long 1900250098 + .long 3174781524 + .long 2147483648 + .long 3200778238 + .long 2246244539 + .long 3175572705 + .long 536870912 + .long 3200385023 + .long 3628536486 + .long 3175901120 + .long 1073741824 + .long 3199729663 + .long 231762015 + .long 3175023909 + .long 2147483648 + .long 3198681087 + .long 1401818636 + .long 3175134547 + .long 0 + .long 0 + .long 0 + .long 0 + .type log2_t3,@object + .size log2_t3,4112 + .space 496, 0x00 # pad + .align 16 +clv: + .long 1655945238 + .long 1069842388 + .long 2523158510 + .long 1048167334 + .long 713798755 + .long 3216330823 + .long 1181303047 + .long 3218484803 + .type clv,@object + .size clv,32 + .align 16 +exp2_tbl: + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 2851812149 + .long 1072698941 + .long 2595802551 + .long 1016815913 + .long 1048019041 + .long 1072704666 + .long 1398474845 + .long 3161559171 + .long 3899555717 + .long 1072710421 + .long 427280750 + .long 3163595548 + .long 3541402996 + .long 1072716208 + .long 2759177317 + .long 1015903202 + .long 702412510 + .long 1072722027 + .long 3803266086 + .long 3163328991 + .long 410360776 + .long 1072727877 + .long 1269990655 + .long 1013024446 + .long 3402036099 + .long 1072733758 + .long 405889333 + .long 1016154232 + .long 1828292879 + .long 1072739672 + .long 1255956746 + .long 1016636974 + .long 728909815 + .long 1072745618 + .long 383930225 + .long 1016078044 + .long 852742562 + .long 1072751596 + .long 667253586 + .long 1010842135 + .long 2952712987 + .long 1072757606 + .long 3293494651 + .long 3161168877 + .long 3490863953 + .long 1072763649 + .long 960797497 + .long 3163997456 + .long 3228316108 + .long 1072769725 + .long 3010241991 + .long 3159471380 + .long 2930322912 + .long 1072775834 + .long 2599499422 + .long 3163762623 + .long 3366293073 + .long 1072781976 + .long 3119426313 + .long 1015169130 + .long 1014845819 + .long 1072788152 + .long 3117910645 + .long 3162607681 + .long 948735466 + .long 1072794361 + .long 3516338027 + .long 3163623459 + .long 3949972341 + .long 1072800603 + .long 2068408548 + .long 1015962444 + .long 2214878420 + .long 1072806880 + .long 892270087 + .long 3164164998 + .long 828946858 + .long 1072813191 + .long 10642492 + .long 1016988014 + .long 586995997 + .long 1072819536 + .long 41662347 + .long 3163676568 + .long 2288159958 + .long 1072825915 + .long 2169144468 + .long 1015924597 + .long 2440944790 + .long 1072832329 + .long 2492769773 + .long 1015196030 + .long 1853186616 + .long 1072838778 + .long 3066496370 + .long 1016705150 + .long 1337108031 + .long 1072845262 + .long 3203724452 + .long 1015726421 + .long 1709341917 + .long 1072851781 + .long 2571168217 + .long 1015201075 + .long 3790955393 + .long 1072858335 + .long 2352942461 + .long 3164228666 + .long 4112506593 + .long 1072864925 + .long 2947355221 + .long 1015419624 + .long 3504003472 + .long 1072871551 + .long 3594001059 + .long 3158379228 + .long 2799960843 + .long 1072878213 + .long 1423655380 + .long 1016070727 + .long 2839424854 + .long 1072884911 + .long 1171596163 + .long 1014090255 + .long 171030293 + .long 1072891646 + .long 3526460132 + .long 1015477354 + .long 4232894513 + .long 1072898416 + .long 2383938684 + .long 1015717095 + .long 2992903935 + .long 1072905224 + .long 2218154405 + .long 1016276769 + .long 1603444721 + .long 1072912069 + .long 1548633640 + .long 3163249902 + .long 926591435 + .long 1072918951 + .long 3208833761 + .long 3163962090 + .long 1829099622 + .long 1072925870 + .long 1016661180 + .long 3164509581 + .long 887463927 + .long 1072932827 + .long 3596744162 + .long 3161842742 + .long 3272845541 + .long 1072939821 + .long 928852419 + .long 3164536824 + .long 1276261410 + .long 1072946854 + .long 300981947 + .long 1015732745 + .long 78413852 + .long 1072953925 + .long 4183226867 + .long 3164065827 + .long 569847338 + .long 1072961034 + .long 472945272 + .long 3160339305 + .long 3645941911 + .long 1072968181 + .long 3814685080 + .long 3162621917 + .long 1617004845 + .long 1072975368 + .long 82804943 + .long 1011391354 + .long 3978100823 + .long 1072982593 + .long 3513027190 + .long 1016894539 + .long 3049340112 + .long 1072989858 + .long 3062915824 + .long 1014219171 + .long 4040676318 + .long 1072997162 + .long 4090609238 + .long 1016712034 + .long 3577096743 + .long 1073004506 + .long 2951496418 + .long 1014842263 + .long 2583551245 + .long 1073011890 + .long 3161094195 + .long 1016655067 + .long 1990012071 + .long 1073019314 + .long 3529070563 + .long 3163861769 + .long 2731501122 + .long 1073026778 + .long 1774031854 + .long 3163518597 + .long 1453150082 + .long 1073034283 + .long 498154668 + .long 3162536638 + .long 3395129871 + .long 1073041828 + .long 4025345434 + .long 3163383964 + .long 917841882 + .long 1073049415 + .long 18715564 + .long 1016707884 + .long 3566716925 + .long 1073057042 + .long 1536826855 + .long 1015191009 + .long 3712504873 + .long 1073064711 + .long 88491948 + .long 1016476236 + .long 2321106615 + .long 1073072422 + .long 2171176610 + .long 1010584347 + .long 363667784 + .long 1073080175 + .long 813753949 + .long 1016833785 + .long 3111574537 + .long 1073087969 + .long 2606161479 + .long 3163808322 + .long 2956612997 + .long 1073095806 + .long 2118169750 + .long 3163784129 + .long 885834528 + .long 1073103686 + .long 1973258546 + .long 3163310140 + .long 2186617381 + .long 1073111608 + .long 2270764083 + .long 3164321289 + .long 3561793907 + .long 1073119573 + .long 1157054052 + .long 1012938926 + .long 1719614413 + .long 1073127582 + .long 330458197 + .long 3164331316 + .long 1963711167 + .long 1073135634 + .long 1744767756 + .long 3161622870 + .long 1013258799 + .long 1073143730 + .long 1748797610 + .long 3161177658 + .long 4182873220 + .long 1073151869 + .long 629542646 + .long 3163044879 + .long 3907805044 + .long 1073160053 + .long 2257091225 + .long 3162598983 + .long 1218806132 + .long 1073168282 + .long 1818613051 + .long 3163597017 + .long 1447192521 + .long 1073176555 + .long 1462857171 + .long 3163563097 + .long 1339972927 + .long 1073184873 + .long 167908908 + .long 1016620728 + .long 1944781191 + .long 1073193236 + .long 3993278767 + .long 3162772855 + .long 19972402 + .long 1073201645 + .long 3507899861 + .long 1017057868 + .long 919555682 + .long 1073210099 + .long 3121969534 + .long 1013996802 + .long 1413356050 + .long 1073218599 + .long 1651349290 + .long 3163716742 + .long 2571947539 + .long 1073227145 + .long 3558159063 + .long 3164425245 + .long 1176749997 + .long 1073235738 + .long 2738998779 + .long 3163084420 + .long 2604962541 + .long 1073244377 + .long 2614425274 + .long 3164587768 + .long 3649726105 + .long 1073253063 + .long 4085036346 + .long 1016698050 + .long 1110089947 + .long 1073261797 + .long 1451641638 + .long 1016523249 + .long 380978316 + .long 1073270578 + .long 854188970 + .long 3161511262 + .long 2568320822 + .long 1073279406 + .long 2732824428 + .long 1015401491 + .long 194117574 + .long 1073288283 + .long 777528611 + .long 3164460665 + .long 2966275557 + .long 1073297207 + .long 2176155323 + .long 3160891335 + .long 3418903055 + .long 1073306180 + .long 2527457337 + .long 3161869180 + .long 2682146384 + .long 1073315202 + .long 2082178512 + .long 3164411995 + .long 1892288442 + .long 1073324273 + .long 2446255666 + .long 3163648957 + .long 2191782032 + .long 1073333393 + .long 2960257726 + .long 1014791238 + .long 434316067 + .long 1073342563 + .long 2028358766 + .long 1014506698 + .long 2069751141 + .long 1073351782 + .long 1562170674 + .long 3163773257 + .long 3964284211 + .long 1073361051 + .long 2111583915 + .long 1016475740 + .long 2990417245 + .long 1073370371 + .long 3683467745 + .long 3164417902 + .long 321958744 + .long 1073379742 + .long 3401933766 + .long 1016843134 + .long 1434058175 + .long 1073389163 + .long 251133233 + .long 1016134345 + .long 3218338682 + .long 1073398635 + .long 3404164304 + .long 3163525684 + .long 2572866477 + .long 1073408159 + .long 878562433 + .long 1016570317 + .long 697153126 + .long 1073417735 + .long 1283515428 + .long 3164331765 + .long 3092190715 + .long 1073427362 + .long 814012167 + .long 3160571998 + .long 2380618042 + .long 1073437042 + .long 3149557219 + .long 3164369375 + .long 4076559943 + .long 1073446774 + .long 2119478330 + .long 3161806927 + .long 815859274 + .long 1073456560 + .long 240396590 + .long 3164536019 + .long 2420883922 + .long 1073466398 + .long 2049810052 + .long 1015168464 + .long 1540824585 + .long 1073476290 + .long 1064017010 + .long 3164536266 + .long 3716502172 + .long 1073486235 + .long 2303740125 + .long 1015091301 + .long 1610600570 + .long 1073496235 + .long 3766732298 + .long 1016808759 + .long 777507147 + .long 1073506289 + .long 4282924204 + .long 1016236109 + .long 2483480501 + .long 1073516397 + .long 1216371780 + .long 1014082748 + .long 3706687593 + .long 1073526560 + .long 3521726939 + .long 1014301643 + .long 1432208378 + .long 1073536779 + .long 1401068914 + .long 3163412539 + .long 1242007932 + .long 1073547053 + .long 1132034716 + .long 3164388407 + .long 135105010 + .long 1073557383 + .long 1906148727 + .long 3164424315 + .long 3707479175 + .long 1073567768 + .long 3613079302 + .long 1015213314 + .long 382305176 + .long 1073578211 + .long 2347622376 + .long 3163627201 + .long 64696965 + .long 1073588710 + .long 1768797490 + .long 1016865536 + .long 4076975200 + .long 1073599265 + .long 2029000898 + .long 1016257111 + .long 863738719 + .long 1073609879 + .long 1326992219 + .long 3163661773 + .long 351641897 + .long 1073620550 + .long 2172261526 + .long 3164059175 + .long 3884662774 + .long 1073631278 + .long 2158611599 + .long 1015258761 + .long 4224142467 + .long 1073642065 + .long 3389820385 + .long 1016255778 + .long 2728693978 + .long 1073652911 + .long 396109971 + .long 3164511267 + .long 764307441 + .long 1073663816 + .long 3021057420 + .long 3164378099 + .long 3999357479 + .long 1073674779 + .long 2258941616 + .long 1016973300 + .long 929806999 + .long 1073685803 + .long 3205336643 + .long 1016308133 + .long 1533953344 + .long 1073696886 + .long 769171850 + .long 1016714209 + .long 2912730644 + .long 1073708029 + .long 3490067721 + .long 3164453650 + .long 2174652632 + .long 1073719233 + .long 4087714590 + .long 1015498835 + .long 730821105 + .long 1073730498 + .long 2523232743 + .long 1013115764 + .type exp2_tbl,@object + .size exp2_tbl,2048 + .align 16 +cev: + .long 3884607281 + .long 1062590591 + .long 3607404735 + .long 1068264200 + .long 1874480759 + .long 1065595563 + .long 4286760334 + .long 1070514109 + .long 4277811695 + .long 1072049730 + .type cev,@object + .size cev,40 + .space 8, 0x00 # pad + .align 16 +ABSVALMASK: + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .type ABSVALMASK,@object + .size ABSVALMASK,16 + .align 4 +rcp_t1: + .long 0 + .long 1072693248 + .long 0 + .long 1072676992 + .long 0 + .long 1072660992 + .long 0 + .long 1072645248 + .long 0 + .long 1072629696 + .long 0 + .long 1072614400 + .long 0 + .long 1072599360 + .long 0 + .long 1072584512 + .long 0 + .long 1072569856 + .long 0 + .long 1072555456 + .long 0 + .long 1072541312 + .long 0 + .long 1072527296 + .long 0 + .long 1072513472 + .long 0 + .long 1072499904 + .long 0 + .long 1072486464 + .long 0 + .long 1072473280 + .long 0 + .long 1072460224 + .long 0 + .long 1072447360 + .long 0 + .long 1072434688 + .long 0 + .long 1072422208 + .long 0 + .long 1072409856 + .long 0 + .long 1072397696 + .long 0 + .long 1072385664 + .long 0 + .long 1072373824 + .long 0 + .long 1072362112 + .long 0 + .long 1072350592 + .long 0 + .long 1072339200 + .long 0 + .long 1072327936 + .long 0 + .long 1072316864 + .long 0 + .long 1072305856 + .long 0 + .long 1072295040 + .long 0 + .long 1072284352 + .long 0 + .long 1072273792 + .long 0 + .long 1072263424 + .long 0 + .long 1072253120 + .long 0 + .long 1072242944 + .long 0 + .long 1072232896 + .long 0 + .long 1072222976 + .long 0 + .long 1072213184 + .long 0 + .long 1072203520 + .long 0 + .long 1072193920 + .long 0 + .long 1072184448 + .long 0 + .long 1072175104 + .long 0 + .long 1072165888 + .long 0 + .long 1072156736 + .long 0 + .long 1072147776 + .long 0 + .long 1072138816 + .long 0 + .long 1072129984 + .long 0 + .long 1072121280 + .long 0 + .long 1072112704 + .long 0 + .long 1072104192 + .long 0 + .long 1072095744 + .long 0 + .long 1072087424 + .long 0 + .long 1072079168 + .long 0 + .long 1072071040 + .long 0 + .long 1072062976 + .long 0 + .long 1072054976 + .long 0 + .long 1072047104 + .long 0 + .long 1072039296 + .long 0 + .long 1072031552 + .long 0 + .long 1072023936 + .long 0 + .long 1072016384 + .long 0 + .long 1072008896 + .long 0 + .long 1072001536 + .long 0 + .long 1071994176 + .long 0 + .long 1071986944 + .long 0 + .long 1071979776 + .long 0 + .long 1071972672 + .long 0 + .long 1071965696 + .long 0 + .long 1071958720 + .long 0 + .long 1071951808 + .long 0 + .long 1071945024 + .long 0 + .long 1071938304 + .long 0 + .long 1071931584 + .long 0 + .long 1071924992 + .long 0 + .long 1071918464 + .long 0 + .long 1071911936 + .long 0 + .long 1071905536 + .long 0 + .long 1071899200 + .long 0 + .long 1071892864 + .long 0 + .long 1071886656 + .long 0 + .long 1071880448 + .long 0 + .long 1071874368 + .long 0 + .long 1071868288 + .long 0 + .long 1071862272 + .long 0 + .long 1071856384 + .long 0 + .long 1071850496 + .long 0 + .long 1071844608 + .long 0 + .long 1071838848 + .long 0 + .long 1071833152 + .long 0 + .long 1071827456 + .long 0 + .long 1071821824 + .long 0 + .long 1071816256 + .long 0 + .long 1071810752 + .long 0 + .long 1071805248 + .long 0 + .long 1071799872 + .long 0 + .long 1071794496 + .long 0 + .long 1071789120 + .long 0 + .long 1071783872 + .long 0 + .long 1071778624 + .long 0 + .long 1071773440 + .long 0 + .long 1071768320 + .long 0 + .long 1071763200 + .long 0 + .long 1071758144 + .long 0 + .long 1071753152 + .long 0 + .long 1071748160 + .long 0 + .long 1071743232 + .long 0 + .long 1071738368 + .long 0 + .long 1071733504 + .long 0 + .long 1071728704 + .long 0 + .long 1071723968 + .long 0 + .long 1071719232 + .long 0 + .long 1071714560 + .long 0 + .long 1071709952 + .long 0 + .long 1071705344 + .long 0 + .long 1071700800 + .long 0 + .long 1071696256 + .long 0 + .long 1071691776 + .long 0 + .long 1071687296 + .long 0 + .long 1071682880 + .long 0 + .long 1071678528 + .long 0 + .long 1071674176 + .long 0 + .long 1071669824 + .long 0 + .long 1071665536 + .long 0 + .long 1071661312 + .long 0 + .long 1071657088 + .long 0 + .long 1071652928 + .long 0 + .long 1071648768 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .type rcp_t1,@object + .size rcp_t1,1040 + .align 4 +HALFSIG: + .long 4160749568 + .long 4294967295 + .type HALFSIG,@object + .size HALFSIG,8 + .align 4 +rcp_t2: + .long 0 + .long 1072693248 + .long 0 + .long 1072693056 + .long 0 + .long 1072692800 + .long 0 + .long 1072692544 + .long 0 + .long 1072692288 + .long 0 + .long 1072692032 + .long 0 + .long 1072691776 + .long 0 + .long 1072691520 + .long 0 + .long 1072691264 + .long 0 + .long 1072691008 + .long 0 + .long 1072690752 + .long 0 + .long 1072690496 + .long 0 + .long 1072690240 + .long 0 + .long 1072689984 + .long 0 + .long 1072689728 + .long 0 + .long 1072689472 + .long 0 + .long 1072689216 + .long 0 + .long 1072688960 + .long 0 + .long 1072688704 + .long 0 + .long 1072688448 + .long 0 + .long 1072688192 + .long 0 + .long 1072687936 + .long 0 + .long 1072687680 + .long 0 + .long 1072687424 + .long 0 + .long 1072687168 + .long 0 + .long 1072686912 + .long 0 + .long 1072686656 + .long 0 + .long 1072686400 + .long 0 + .long 1072686144 + .long 0 + .long 1072685888 + .long 0 + .long 1072685632 + .long 0 + .long 1072685376 + .long 0 + .long 1072685120 + .long 0 + .long 1072684864 + .long 0 + .long 1072684608 + .long 0 + .long 1072684352 + .long 0 + .long 1072684096 + .long 0 + .long 1072683840 + .long 0 + .long 1072683584 + .long 0 + .long 1072683328 + .long 0 + .long 1072683072 + .long 0 + .long 1072682816 + .long 0 + .long 1072682560 + .long 0 + .long 1072682304 + .long 0 + .long 1072682048 + .long 0 + .long 1072681792 + .long 0 + .long 1072681600 + .long 0 + .long 1072681344 + .long 0 + .long 1072681088 + .long 0 + .long 1072680832 + .long 0 + .long 1072680576 + .long 0 + .long 1072680320 + .long 0 + .long 1072680064 + .long 0 + .long 1072679808 + .long 0 + .long 1072679552 + .long 0 + .long 1072679296 + .long 0 + .long 1072679040 + .long 0 + .long 1072678784 + .long 0 + .long 1072678528 + .long 0 + .long 1072678272 + .long 0 + .long 1072678016 + .long 0 + .long 1072677760 + .long 0 + .long 1072677504 + .long 0 + .long 1072677248 + .long 0 + .long 1072697344 + .long 0 + .long 1072697280 + .long 0 + .long 1072697216 + .long 0 + .long 1072697152 + .long 0 + .long 1072697088 + .long 0 + .long 1072697024 + .long 0 + .long 1072696960 + .long 0 + .long 1072696896 + .long 0 + .long 1072696832 + .long 0 + .long 1072696768 + .long 0 + .long 1072696704 + .long 0 + .long 1072696640 + .long 0 + .long 1072696576 + .long 0 + .long 1072696512 + .long 0 + .long 1072696448 + .long 0 + .long 1072696384 + .long 0 + .long 1072696320 + .long 0 + .long 1072696256 + .long 0 + .long 1072696192 + .long 0 + .long 1072696128 + .long 0 + .long 1072696064 + .long 0 + .long 1072696000 + .long 0 + .long 1072695936 + .long 0 + .long 1072695872 + .long 0 + .long 1072695808 + .long 0 + .long 1072695744 + .long 0 + .long 1072695680 + .long 0 + .long 1072695616 + .long 0 + .long 1072695552 + .long 0 + .long 1072695488 + .long 0 + .long 1072695424 + .long 0 + .long 1072695360 + .long 0 + .long 1072695296 + .long 0 + .long 1072695232 + .long 0 + .long 1072695168 + .long 0 + .long 1072695104 + .long 0 + .long 1072695040 + .long 0 + .long 1072694976 + .long 0 + .long 1072694912 + .long 0 + .long 1072694848 + .long 0 + .long 1072694784 + .long 0 + .long 1072694720 + .long 0 + .long 1072694656 + .long 0 + .long 1072694592 + .long 0 + .long 1072694528 + .long 0 + .long 1072694464 + .long 0 + .long 1072694400 + .long 0 + .long 1072694336 + .long 0 + .long 1072694272 + .long 0 + .long 1072694208 + .long 0 + .long 1072694144 + .long 0 + .long 1072694080 + .long 0 + .long 1072694016 + .long 0 + .long 1072693952 + .long 0 + .long 1072693888 + .long 0 + .long 1072693824 + .long 0 + .long 1072693760 + .long 0 + .long 1072693696 + .long 0 + .long 1072693632 + .long 0 + .long 1072693568 + .long 0 + .long 1072693504 + .long 0 + .long 1072693440 + .long 0 + .long 1072693376 + .long 0 + .long 1072693312 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .type rcp_t2,@object + .size rcp_t2,1040 + .align 4 +LHN: + .long 1073741824 + .long 3220641095 + .type LHN,@object + .size LHN,8 + .align 4 +rcp_t3: + .long 1073741824 + .long 1073157447 + .long 3221225472 + .long 1073157445 + .long 1073741824 + .long 1073157444 + .long 0 + .long 1073157443 + .long 2147483648 + .long 1073157441 + .long 0 + .long 1073157440 + .long 2147483648 + .long 1073157438 + .long 1073741824 + .long 1073157437 + .long 3221225472 + .long 1073157435 + .long 1073741824 + .long 1073157434 + .long 3221225472 + .long 1073157432 + .long 2147483648 + .long 1073157431 + .long 0 + .long 1073157430 + .long 2147483648 + .long 1073157428 + .long 0 + .long 1073157427 + .long 2147483648 + .long 1073157425 + .long 1073741824 + .long 1073157424 + .long 3221225472 + .long 1073157422 + .long 1073741824 + .long 1073157421 + .long 3221225472 + .long 1073157419 + .long 2147483648 + .long 1073157418 + .long 0 + .long 1073157417 + .long 2147483648 + .long 1073157415 + .long 0 + .long 1073157414 + .long 3221225472 + .long 1073157412 + .long 1073741824 + .long 1073157411 + .long 3221225472 + .long 1073157409 + .long 1073741824 + .long 1073157408 + .long 3221225472 + .long 1073157406 + .long 2147483648 + .long 1073157405 + .long 0 + .long 1073157404 + .long 2147483648 + .long 1073157402 + .long 0 + .long 1073157401 + .long 3221225472 + .long 1073157399 + .long 1073741824 + .long 1073157398 + .long 3221225472 + .long 1073157396 + .long 1073741824 + .long 1073157395 + .long 3221225472 + .long 1073157393 + .long 2147483648 + .long 1073157392 + .long 0 + .long 1073157391 + .long 2147483648 + .long 1073157389 + .long 0 + .long 1073157388 + .long 3221225472 + .long 1073157386 + .long 1073741824 + .long 1073157385 + .long 3221225472 + .long 1073157383 + .long 1073741824 + .long 1073157382 + .long 0 + .long 1073157381 + .long 2147483648 + .long 1073157379 + .long 0 + .long 1073157378 + .long 2147483648 + .long 1073157376 + .long 0 + .long 1073157375 + .long 3221225472 + .long 1073157373 + .long 1073741824 + .long 1073157372 + .long 3221225472 + .long 1073157370 + .long 1073741824 + .long 1073157369 + .long 0 + .long 1073157368 + .long 2147483648 + .long 1073157366 + .long 0 + .long 1073157365 + .long 2147483648 + .long 1073157363 + .long 1073741824 + .long 1073157362 + .long 3221225472 + .long 1073157360 + .long 1073741824 + .long 1073157359 + .long 3221225472 + .long 1073157357 + .long 1073741824 + .long 1073157356 + .long 0 + .long 1073157355 + .long 2147483648 + .long 1073157353 + .long 0 + .long 1073157352 + .long 2147483648 + .long 1073157350 + .long 1073741824 + .long 1073157349 + .long 3221225472 + .long 1073157347 + .long 1073741824 + .long 1073157346 + .long 3221225472 + .long 1073157344 + .long 2147483648 + .long 1073157343 + .long 0 + .long 1073157342 + .long 2147483648 + .long 1073157340 + .long 0 + .long 1073157339 + .long 2147483648 + .long 1073157337 + .long 1073741824 + .long 1073157336 + .long 3221225472 + .long 1073157334 + .long 1073741824 + .long 1073157333 + .long 3221225472 + .long 1073157331 + .long 2147483648 + .long 1073157330 + .long 0 + .long 1073157329 + .long 2147483648 + .long 1073157327 + .long 0 + .long 1073157326 + .long 3221225472 + .long 1073157324 + .long 1073741824 + .long 1073157323 + .long 3221225472 + .long 1073157321 + .long 1073741824 + .long 1073157320 + .long 3221225472 + .long 1073157318 + .long 2147483648 + .long 1073157317 + .long 0 + .long 1073157316 + .long 2147483648 + .long 1073157314 + .long 0 + .long 1073157313 + .long 3221225472 + .long 1073157311 + .long 1073741824 + .long 1073157310 + .long 3221225472 + .long 1073157308 + .long 1073741824 + .long 1073157307 + .long 0 + .long 1073157306 + .long 2147483648 + .long 1073157304 + .long 0 + .long 1073157303 + .long 2147483648 + .long 1073157301 + .long 0 + .long 1073157300 + .long 3221225472 + .long 1073157298 + .long 1073741824 + .long 1073157297 + .long 3221225472 + .long 1073157295 + .long 1073741824 + .long 1073157294 + .long 0 + .long 1073157293 + .long 2147483648 + .long 1073157291 + .long 0 + .long 1073157290 + .long 2147483648 + .long 1073157288 + .long 1073741824 + .long 1073157287 + .long 3221225472 + .long 1073157285 + .long 1073741824 + .long 1073157284 + .long 3221225472 + .long 1073157282 + .long 1073741824 + .long 1073157281 + .long 0 + .long 1073157280 + .long 2147483648 + .long 1073157278 + .long 0 + .long 1073157277 + .long 2147483648 + .long 1073157275 + .long 1073741824 + .long 1073157274 + .long 3221225472 + .long 1073157272 + .long 1073741824 + .long 1073157271 + .long 3221225472 + .long 1073157269 + .long 2147483648 + .long 1073157268 + .long 0 + .long 1073157267 + .long 2147483648 + .long 1073157265 + .long 0 + .long 1073157264 + .long 2147483648 + .long 1073157539 + .long 3221225472 + .long 1073157538 + .long 1073741824 + .long 1073157538 + .long 2147483648 + .long 1073157537 + .long 3221225472 + .long 1073157536 + .long 0 + .long 1073157536 + .long 1073741824 + .long 1073157535 + .long 2147483648 + .long 1073157534 + .long 3221225472 + .long 1073157533 + .long 0 + .long 1073157533 + .long 1073741824 + .long 1073157532 + .long 3221225472 + .long 1073157531 + .long 0 + .long 1073157531 + .long 1073741824 + .long 1073157530 + .long 2147483648 + .long 1073157529 + .long 3221225472 + .long 1073157528 + .long 0 + .long 1073157528 + .long 1073741824 + .long 1073157527 + .long 2147483648 + .long 1073157526 + .long 0 + .long 1073157526 + .long 1073741824 + .long 1073157525 + .long 2147483648 + .long 1073157524 + .long 3221225472 + .long 1073157523 + .long 0 + .long 1073157523 + .long 1073741824 + .long 1073157522 + .long 2147483648 + .long 1073157521 + .long 3221225472 + .long 1073157520 + .long 0 + .long 1073157520 + .long 2147483648 + .long 1073157519 + .long 3221225472 + .long 1073157518 + .long 0 + .long 1073157518 + .long 1073741824 + .long 1073157517 + .long 2147483648 + .long 1073157516 + .long 3221225472 + .long 1073157515 + .long 0 + .long 1073157515 + .long 1073741824 + .long 1073157514 + .long 2147483648 + .long 1073157513 + .long 0 + .long 1073157513 + .long 1073741824 + .long 1073157512 + .long 2147483648 + .long 1073157511 + .long 3221225472 + .long 1073157510 + .long 0 + .long 1073157510 + .long 1073741824 + .long 1073157509 + .long 2147483648 + .long 1073157508 + .long 3221225472 + .long 1073157507 + .long 0 + .long 1073157507 + .long 2147483648 + .long 1073157506 + .long 3221225472 + .long 1073157505 + .long 0 + .long 1073157505 + .long 1073741824 + .long 1073157504 + .long 2147483648 + .long 1073157503 + .long 3221225472 + .long 1073157502 + .long 0 + .long 1073157502 + .long 1073741824 + .long 1073157501 + .long 3221225472 + .long 1073157500 + .long 0 + .long 1073157500 + .long 1073741824 + .long 1073157499 + .long 2147483648 + .long 1073157498 + .long 3221225472 + .long 1073157497 + .long 0 + .long 1073157497 + .long 1073741824 + .long 1073157496 + .long 2147483648 + .long 1073157495 + .long 3221225472 + .long 1073157494 + .long 1073741824 + .long 1073157494 + .long 2147483648 + .long 1073157493 + .long 3221225472 + .long 1073157492 + .long 0 + .long 1073157492 + .long 1073741824 + .long 1073157491 + .long 2147483648 + .long 1073157490 + .long 3221225472 + .long 1073157489 + .long 0 + .long 1073157489 + .long 1073741824 + .long 1073157488 + .long 3221225472 + .long 1073157487 + .long 0 + .long 1073157487 + .long 1073741824 + .long 1073157486 + .long 2147483648 + .long 1073157485 + .long 3221225472 + .long 1073157484 + .long 0 + .long 1073157484 + .long 1073741824 + .long 1073157483 + .long 2147483648 + .long 1073157482 + .long 0 + .long 1073157482 + .long 1073741824 + .long 1073157481 + .long 2147483648 + .long 1073157480 + .long 3221225472 + .long 1073157479 + .long 0 + .long 1073157479 + .long 1073741824 + .long 1073157478 + .long 2147483648 + .long 1073157477 + .long 3221225472 + .long 1073157476 + .long 0 + .long 1073157476 + .long 2147483648 + .long 1073157475 + .long 3221225472 + .long 1073157474 + .long 0 + .long 1073157474 + .long 1073741824 + .long 1073157473 + .long 2147483648 + .long 1073157472 + .long 3221225472 + .long 1073157471 + .long 0 + .long 1073157471 + .long 1073741824 + .long 1073157470 + .long 2147483648 + .long 1073157469 + .long 0 + .long 1073157469 + .long 1073741824 + .long 1073157468 + .long 2147483648 + .long 1073157467 + .long 3221225472 + .long 1073157466 + .long 0 + .long 1073157466 + .long 1073741824 + .long 1073157465 + .long 2147483648 + .long 1073157464 + .long 3221225472 + .long 1073157463 + .long 0 + .long 1073157463 + .long 2147483648 + .long 1073157462 + .long 3221225472 + .long 1073157461 + .long 0 + .long 1073157461 + .long 1073741824 + .long 1073157460 + .long 2147483648 + .long 1073157459 + .long 3221225472 + .long 1073157458 + .long 0 + .long 1073157458 + .long 1073741824 + .long 1073157457 + .long 3221225472 + .long 1073157456 + .long 0 + .long 1073157456 + .long 1073741824 + .long 1073157455 + .long 2147483648 + .long 1073157454 + .long 3221225472 + .long 1073157453 + .long 0 + .long 1073157453 + .long 1073741824 + .long 1073157452 + .long 2147483648 + .long 1073157451 + .long 3221225472 + .long 1073157450 + .long 1073741824 + .long 1073157450 + .long 2147483648 + .long 1073157449 + .long 3221225472 + .long 1073157448 + .long 0 + .long 1073157448 + .long 1073741824 + .long 1073157447 + .long 0 + .long 0 + .type rcp_t3,@object + .size rcp_t3,2064 + .align 4 +Shifter: + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .type Shifter,@object + .size Shifter,16 + .align 4 +NEG_ZERO: + .long 0 + .long 2147483648 + .type NEG_ZERO,@object + .size NEG_ZERO,8 + .align 4 +NEG_INF: + .long 0 + .long 4293918720 + .type NEG_INF,@object + .size NEG_INF,8 + .align 4 +sNaN: + .long 1 + .long 2146435072 + .type sNaN,@object + .size sNaN,8 + .align 4 +INF: + .long 0 + .long 2146435072 + .type INF,@object + .size INF,8 + .align 4 +EMIN: + .long 0 + .long 1048576 + .type EMIN,@object + .size EMIN,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/powf_gen.S b/external/sgx_libm/intel64/powf_gen.S new file mode 100644 index 0000000000..f841ac81fe --- /dev/null +++ b/external/sgx_libm/intel64/powf_gen.S @@ -0,0 +1,892 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "powf_gen.c" + .text +..TXTST0: +# -- Begin powf + .text + .align 16,0x90 + .globl powf +powf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_powf.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movss %xmm0, 16(%rsp) + movss %xmm1, 24(%rsp) +..B1.2: + movq $0x3ff0000000000000, %r8 + movd %r8, %xmm5 + movd %xmm0, %eax + lea B_table(%rip), %r11 + psllq $32, %xmm0 + psrlq $3, %xmm0 + cvtss2sd %xmm1, %xmm1 + movapd cv(%rip), %xmm6 + orpd %xmm0, %xmm5 + movl $2130706431, %ecx + movl %eax, %edx + subl $8388608, %edx + cmpl %edx, %ecx + jb .L_2TAG_PACKET_0.0.2 + movl $0, %ecx + shrl $16, %eax +.L_2TAG_PACKET_1.0.2: +.L_2TAG_PACKET_2.0.2: + movl $127, %edx + andl %eax, %edx + addl $1, %edx + andl $254, %edx + movq (%r11,%rdx,8), %xmm3 + movl $130944, %r8d + addl %edx, %r8d + movd %r8, %xmm7 + movq 8(%r11,%rdx,8), %xmm0 + addl $65, %eax + sarl $7, %eax + subl $127, %eax + cvtsi2sd %eax, %xmm4 + psllq $45, %xmm7 + subsd %xmm7, %xmm5 + movl %eax, %edx + sarl $31, %eax + addl %eax, %edx + xorl %edx, %eax + movapd 16+cv(%rip), %xmm2 + mulsd %xmm3, %xmm5 + movq $0x42e8000000000000, %r9 + movd %r9, %xmm3 + pshufd $68, %xmm5, %xmm7 + addsd %xmm5, %xmm0 + bsr %eax, %eax + mulpd %xmm7, %xmm6 + mulpd %xmm7, %xmm7 + addsd %xmm4, %xmm0 + pextrw $3, %xmm1, %edx + addpd %xmm2, %xmm6 + andl $32752, %edx + shrl $4, %edx + subl $993, %eax + addl %edx, %eax + cmpl $35, %eax + jae .L_2TAG_PACKET_3.0.2 + mulsd %xmm1, %xmm0 + mulsd %xmm7, %xmm7 + movq %xmm0, %xmm4 + addsd %xmm3, %xmm0 + mulpd %xmm7, %xmm6 + movd %xmm0, %eax + subsd %xmm3, %xmm0 + pshufd $238, %xmm6, %xmm7 + subsd %xmm0, %xmm4 + addsd %xmm7, %xmm6 + movapd cev(%rip), %xmm7 + mulsd %xmm6, %xmm1 + movapd 16+cev(%rip), %xmm2 + xorpd %xmm6, %xmm6 + addsd %xmm1, %xmm4 + pshufd $68, %xmm4, %xmm5 + movl %eax, %edx + sarl $1, %edx + andl $31, %eax + movq 1056(%r11,%rax,8), %xmm3 + orl $16368, %ecx + andl $-16, %edx + addl %edx, %ecx + pinsrw $3, %ecx, %xmm6 + mulpd %xmm5, %xmm7 + mulsd %xmm5, %xmm5 + mulsd %xmm3, %xmm4 + addpd %xmm7, %xmm2 + mulsd %xmm6, %xmm3 + mulsd %xmm2, %xmm5 + pshufd $238, %xmm2, %xmm0 + mulsd %xmm6, %xmm4 + addsd %xmm5, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm0, %xmm3 + cvtpd2ps %xmm3, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + movq ABSVALMASK(%rip), %xmm3 + movd %xmm1, %edx + movq %xmm1, %xmm0 + movq %xmm1, %xmm7 + andpd %xmm3, %xmm0 + psrlq $32, %xmm0 + movd %xmm0, %ecx + cmpl $2146435072, %ecx + jae .L_2TAG_PACKET_4.0.2 + orl %ecx, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_5.0.2 + movl 16(%rsp), %edx + cmpl $2139095039, %edx + jbe .L_2TAG_PACKET_6.0.2 + movl 24(%rsp), %eax + movl %eax, %r9d + shrl $23, %r9d + andl $255, %r9d + subl $127, %r9d + movl %r9d, %ecx + sarl $31, %ecx + notl %ecx + addl $8, %r9d + andl %r9d, %ecx + subl $32, %ecx + movl %ecx, %r8d + sarl $31, %r8d + andl %r8d, %ecx + addl $32, %ecx + andl $8388607, %eax + orl $8388608, %eax + shlq %cl, %rax + andl $2147483647, %edx + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_7.0.2 + testl $2147483647, %eax + jne .L_2TAG_PACKET_8.0.2 + movl %eax, %ecx + shrl $16, %ecx + cmpl $8388608, %edx + jb .L_2TAG_PACKET_9.0.2 + movl 16(%rsp), %eax + shrl $16, %eax + andl $32767, %eax + jmp .L_2TAG_PACKET_1.0.2 +.L_2TAG_PACKET_4.0.2: + movss 16(%rsp), %xmm0 + movd %xmm0, %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + ja .L_2TAG_PACKET_10.0.2 + jmp .L_2TAG_PACKET_11.0.2 +.L_2TAG_PACKET_10.0.2: + movss 16(%rsp), %xmm0 + addss %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_6.0.2: + movl $0, %ecx +.L_2TAG_PACKET_9.0.2: + xorpd %xmm0, %xmm0 + movl $24448, %edx + pinsrw $1, %edx, %xmm0 + movss 16(%rsp), %xmm4 + movq EXPMASK(%rip), %xmm5 + mulss %xmm0, %xmm4 + movd %xmm4, %edx + andl $2147483647, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_12.0.2 + pextrw $1, %xmm4, %eax + movaps %xmm4, %xmm0 + andps ABSVALS(%rip), %xmm4 + psllq $29, %xmm0 + orpd %xmm0, %xmm5 + andl $32767, %eax + subl $8192, %eax + jmp .L_2TAG_PACKET_2.0.2 +.L_2TAG_PACKET_13.0.2: + movl 24(%rsp), %edx + andl $-2147483648, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_14.0.2 + movss ONEMASK(%rip), %xmm0 + xorps %xmm4, %xmm4 + divss %xmm4, %xmm0 +.L_2TAG_PACKET_15.0.2: + movl $33, (%rsp) + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_12.0.2: + movl 24(%rsp), %edx + andl $-2147483648, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_17.0.2 + shll $16, %ecx + movl 16(%rsp), %edx + andl %ecx, %edx + orl $2139095040, %edx + movd %edx, %xmm0 + movss ONEMASK(%rip), %xmm5 + divss %xmm4, %xmm5 + jmp .L_2TAG_PACKET_15.0.2 +.L_2TAG_PACKET_17.0.2: + shll $16, %ecx + movd %xmm4, %edx + andl %ecx, %edx + cmpl $0, %edx + jne .L_2TAG_PACKET_18.0.2 + xorps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_7.0.2: + movl 16(%rsp), %edx + cmpl $2139095040, %edx + je .L_2TAG_PACKET_19.0.2 + andl $2147483647, %edx + cmpl $2139095040, %edx + ja .L_2TAG_PACKET_10.0.2 + cmpl $-2147483648, %eax + jne .L_2TAG_PACKET_20.0.2 + pextrw $3, %xmm1, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_21.0.2 +.L_2TAG_PACKET_18.0.2: + movl $-2147483648, %eax + movd %rax, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_21.0.2: + movl $-8388608, %eax + movd %rax, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_20.0.2: + pextrw $3, %xmm1, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_22.0.2 + xorps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_19.0.2: + pextrw $3, %xmm1, %eax + andl $32768, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_22.0.2 + xorps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_8.0.2: + cmpl $0, %edx + je .L_2TAG_PACKET_13.0.2 + movss sNaN(%rip), %xmm0 + mulss %xmm0, %xmm0 + movl $34, (%rsp) + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_11.0.2: + movss 16(%rsp), %xmm4 + movss 24(%rsp), %xmm1 + movl 24(%rsp), %eax + movl %eax, %ecx + andl $2147483647, %eax + cmpl $2139095040, %eax + ja .L_2TAG_PACKET_23.0.2 + andl $-2147483648, %ecx + movd %xmm4, %edx + movl $2147483647, %eax + andl %edx, %eax + je .L_2TAG_PACKET_12.0.2 + xorl $-1082130432, %edx + cmpl $0, %edx + je .L_2TAG_PACKET_24.0.2 + cmpl $0, %ecx + je .L_2TAG_PACKET_25.0.2 + movd %xmm4, %eax + andl $2147483647, %eax + cmpl $1065353216, %eax + jae .L_2TAG_PACKET_14.0.2 + jmp .L_2TAG_PACKET_22.0.2 +.L_2TAG_PACKET_14.0.2: + xorps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_24.0.2: + stmxcsr 4(%rsp) + andl $-34, 4(%rsp) + ldmxcsr 4(%rsp) + movl $1065353216, %eax + movd %rax, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_25.0.2: + pextrw $1, %xmm4, %eax + andl $32640, %eax + cmpl $16256, %eax + jae .L_2TAG_PACKET_22.0.2 + xorps %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_22.0.2: + movl $2139095040, %eax + movd %rax, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_26.0.2: + movl $32, (%rsp) + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_27.0.2: + movl $35, (%rsp) + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_23.0.2: + movss 24(%rsp), %xmm0 + addss %xmm0, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_5.0.2: + movss 16(%rsp), %xmm4 + movss 24(%rsp), %xmm1 + movd %xmm4, %eax + movss ONEMASK(%rip), %xmm0 + cmpl $0, %eax + je .L_2TAG_PACKET_26.0.2 + movd %xmm4, %eax + xorps %xmm2, %xmm2 + addss %xmm2, %xmm4 + andl $2147483647, %eax + cmpl $2139095040, %eax + ja .L_2TAG_PACKET_27.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_28.0.2: + mulsd %xmm7, %xmm7 + mulpd %xmm7, %xmm6 + pshufd $238, %xmm6, %xmm7 + addsd %xmm7, %xmm0 + mulsd %xmm1, %xmm0 + movapd cev(%rip), %xmm7 + mulsd %xmm6, %xmm1 + movq %xmm0, %xmm4 + addsd %xmm3, %xmm0 + movd %xmm0, %eax + subsd %xmm3, %xmm0 + subsd %xmm0, %xmm4 + movapd 16+cev(%rip), %xmm2 + xorpd %xmm6, %xmm6 + addsd %xmm1, %xmm4 + pshufd $68, %xmm4, %xmm5 + movl %eax, %edx + sarl $1, %edx + andl $31, %eax + movq 1056(%r11,%rax,8), %xmm3 + orl $16368, %ecx + andl $-16, %edx + addl %edx, %ecx + pinsrw $3, %ecx, %xmm6 + mulpd %xmm5, %xmm7 + mulsd %xmm5, %xmm5 + mulsd %xmm3, %xmm4 + addpd %xmm7, %xmm2 + mulsd %xmm6, %xmm3 + mulsd %xmm6, %xmm4 + mulsd %xmm2, %xmm5 + pshufd $238, %xmm2, %xmm0 + addsd %xmm5, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm3, %xmm0 + cvtpd2ps %xmm0, %xmm0 + pextrw $1, %xmm0, %eax + andl $32767, %eax + cmpl $32640, %eax + jae .L_2TAG_PACKET_29.0.2 + cmpl $16, %eax + jb .L_2TAG_PACKET_30.0.2 + jmp ..B1.5 +.L_2TAG_PACKET_31.0.2: + orl $32639, %ecx + xorpd %xmm0, %xmm0 + pinsrw $1, %ecx, %xmm0 + addss %xmm0, %xmm0 +.L_2TAG_PACKET_29.0.2: + movl $30, (%rsp) + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_32.0.2: + movl $8388608, %eax + movd %eax, %xmm5 + mulss %xmm5, %xmm5 + xorpd %xmm0, %xmm0 + pinsrw $1, %ecx, %xmm0 +.L_2TAG_PACKET_30.0.2: + movl $31, (%rsp) + jmp .L_2TAG_PACKET_16.0.2 +.L_2TAG_PACKET_3.0.2: + movl 16(%rsp), %edx + cmpl $1065353216, %edx + je .L_2TAG_PACKET_24.0.2 + movl 24(%rsp), %edx + andl $2147483647, %edx + cmpl $2139095040, %edx + jae .L_2TAG_PACKET_11.0.2 + cmpl $0, %edx + je .L_2TAG_PACKET_5.0.2 + cmpl $0, %eax + jl .L_2TAG_PACKET_33.0.2 + cmpl $38, %eax + jb .L_2TAG_PACKET_28.0.2 + movl 16(%rsp), %edx + andl $2139095040, %edx + subl $1056964608, %edx + cmpl $8388608, %edx + jbe .L_2TAG_PACKET_34.0.2 +.L_2TAG_PACKET_35.0.2: + movl 16(%rsp), %eax + movl 24(%rsp), %edx + andl $2139095040, %eax + subl $1065353216, %eax + xorl %edx, %eax + andl $-2147483648, %eax + cmpl $0, %eax + je .L_2TAG_PACKET_31.0.2 + jmp .L_2TAG_PACKET_32.0.2 +.L_2TAG_PACKET_34.0.2: + movss 16(%rsp), %xmm4 + movl $1065353216, %eax + movd %eax, %xmm2 + pslld $1, %xmm4 + psrld $1, %xmm4 + subss %xmm4, %xmm2 + movd %xmm2, %edx + andl $2139095040, %edx + je .L_2TAG_PACKET_33.0.2 + movq %xmm1, %xmm4 + mulsd %xmm0, %xmm4 + pextrw $3, %xmm4, %eax + andl $32752, %eax + cmpl $16496, %eax + jb .L_2TAG_PACKET_28.0.2 + jmp .L_2TAG_PACKET_35.0.2 +.L_2TAG_PACKET_33.0.2: + shll $16, %ecx + orl $1065353216, %ecx + movd %ecx, %xmm0 + jmp ..B1.5 +.L_2TAG_PACKET_16.0.2: + movss %xmm0, 8(%rsp) +..B1.3: + movss 8(%rsp), %xmm0 +.L_2TAG_PACKET_36.0.2: +..B1.5: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type powf,@function + .size powf,.-powf + .data +# -- End powf + .section .rodata, "a" + .align 16 + .align 16 +B_table: + .long 1697350398 + .long 1073157447 + .long 0 + .long 0 + .long 3983912013 + .long 1073134173 + .long 2244132864 + .long 1066854294 + .long 3077571303 + .long 1073111605 + .long 1972305920 + .long 1067891411 + .long 787997771 + .long 1073089711 + .long 2678235136 + .long 1068559160 + .long 2608086797 + .long 1073068460 + .long 4207480832 + .long 1068917750 + .long 4250927815 + .long 1073047825 + .long 1085124608 + .long 1069271106 + .long 4006130247 + .long 1073027780 + .long 2363127808 + .long 1069583448 + .long 2255915958 + .long 1073008300 + .long 3799560192 + .long 1069755113 + .long 1031537321 + .long 1072989361 + .long 972806144 + .long 1069924378 + .long 3606154084 + .long 1072970940 + .long 3492741120 + .long 1070091307 + .long 1235818328 + .long 1072953018 + .long 766832640 + .long 1070255966 + .long 2880061438 + .long 1072935573 + .long 1278367744 + .long 1070418414 + .long 525144062 + .long 1072918588 + .long 3103942656 + .long 1070578710 + .long 3251485016 + .long 1072902043 + .long 3671264256 + .long 1070666503 + .long 2604098795 + .long 1072885923 + .long 2869823488 + .long 1070744583 + .long 2408035495 + .long 1072870211 + .long 3466906624 + .long 1070821668 + .long 1357880318 + .long 1072854892 + .long 1271733248 + .long 1070897784 + .long 1394140652 + .long 1072839951 + .long 972806144 + .long 1070972954 + .long 3210356685 + .long 1072825374 + .long 3449621504 + .long 1071047201 + .long 1774519652 + .long 1072811149 + .long 1662393344 + .long 1071120549 + .long 3338441873 + .long 1072797262 + .long 2300516352 + .long 1071193018 + .long 3804456356 + .long 1072783702 + .long 176119808 + .long 1071264630 + .long 1462910403 + .long 1072770458 + .long 4147676160 + .long 1071335403 + .long 1149890700 + .long 1072757518 + .long 2905168896 + .long 1071405359 + .long 1234436653 + .long 1072744872 + .long 3761433600 + .long 1071474515 + .long 2089211650 + .long 1072732510 + .long 2716292096 + .long 1071542890 + .long 1684223316 + .long 1072720423 + .long 1758136320 + .long 1071610501 + .long 4072784951 + .long 1072708601 + .long 2341968384 + .long 1071661018 + .long 2114454037 + .long 1072697037 + .long 14039552 + .long 1071694085 + .long 2012861074 + .long 1072678195 + .long 4204914176 + .long 1071726793 + .long 2037138800 + .long 1072656045 + .long 513134592 + .long 1071759153 + .long 3417210877 + .long 1072634361 + .long 3559335936 + .long 1071791169 + .long 3694789629 + .long 1072613129 + .long 1904282624 + .long 3218771961 + .long 2992528814 + .long 1072592335 + .long 714524672 + .long 3218709255 + .long 3882342941 + .long 1072571965 + .long 180337664 + .long 3218647192 + .long 2671772639 + .long 1072552007 + .long 47131648 + .long 3218585759 + .long 2172608510 + .long 1072532448 + .long 1751500800 + .long 3218524943 + .long 3001586108 + .long 1072513276 + .long 4058951680 + .long 3218464732 + .long 3477449063 + .long 1072494480 + .long 2999895040 + .long 3218405115 + .long 3818975826 + .long 1072476049 + .long 398715904 + .long 3218346080 + .long 1758664544 + .long 1072457973 + .long 3815829504 + .long 3218287614 + .long 1046539701 + .long 1072440241 + .long 722717696 + .long 3218229709 + .long 2778964739 + .long 1072422843 + .long 1399058432 + .long 3218172352 + .long 1026978211 + .long 1072405771 + .long 227933184 + .long 3218115534 + .long 4238694625 + .long 1072389014 + .long 2835759104 + .long 3218038744 + .long 811117725 + .long 1072372566 + .long 3554951168 + .long 3217927202 + .long 1975098645 + .long 1072356416 + .long 2818570240 + .long 3217816679 + .long 3079413536 + .long 1072340557 + .long 3041732608 + .long 3217707156 + .long 712695513 + .long 1072324982 + .long 180338688 + .long 3217598616 + .long 1238508315 + .long 1072309682 + .long 835166208 + .long 3217491040 + .long 3563503614 + .long 1072294650 + .long 704622592 + .long 3217384412 + .long 3383126459 + .long 1072279880 + .long 1695342592 + .long 3217278715 + .long 1724836050 + .long 1072265365 + .long 3266000896 + .long 3217173933 + .long 608820196 + .long 1072251098 + .long 2363885568 + .long 3217070051 + .long 3005930546 + .long 1072237072 + .long 3908239360 + .long 3216902938 + .long 4207804139 + .long 1072223282 + .long 448159744 + .long 3216698681 + .long 378851326 + .long 1072209723 + .long 2530197504 + .long 3216496132 + .long 1405092650 + .long 1072196387 + .long 4268273664 + .long 3216295264 + .long 795096448 + .long 1072183270 + .long 2785038336 + .long 3216096050 + .long 1417164049 + .long 1072170366 + .long 522182656 + .long 3215814333 + .long 2583387630 + .long 1072157670 + .long 3386466304 + .long 3215422356 + .long 20099889 + .long 1072145178 + .long 3838140416 + .long 3215033528 + .long 3019600065 + .long 1072132883 + .long 2250194944 + .long 3214361582 + .long 53601996 + .long 1072120783 + .long 2718924800 + .long 3213307003 + .long 1697350398 + .long 1072108871 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 3541402996 + .long 1072716208 + .long 1828292879 + .long 1072739672 + .long 3490863953 + .long 1072763649 + .long 1014845819 + .long 1072788152 + .long 828946858 + .long 1072813191 + .long 1853186616 + .long 1072838778 + .long 4112506593 + .long 1072864925 + .long 171030293 + .long 1072891646 + .long 926591435 + .long 1072918951 + .long 1276261410 + .long 1072946854 + .long 1617004845 + .long 1072975368 + .long 3577096743 + .long 1073004506 + .long 1453150082 + .long 1073034283 + .long 3712504873 + .long 1073064711 + .long 2956612997 + .long 1073095806 + .long 1719614413 + .long 1073127582 + .long 3907805044 + .long 1073160053 + .long 1944781191 + .long 1073193236 + .long 2571947539 + .long 1073227145 + .long 1110089947 + .long 1073261797 + .long 2966275557 + .long 1073297207 + .long 2191782032 + .long 1073333393 + .long 2990417245 + .long 1073370371 + .long 2572866477 + .long 1073408159 + .long 4076559943 + .long 1073446774 + .long 3716502172 + .long 1073486235 + .long 3706687593 + .long 1073526560 + .long 3707479175 + .long 1073567768 + .long 863738719 + .long 1073609879 + .long 2728693978 + .long 1073652911 + .long 1533953344 + .long 1073696886 + .type B_table,@object + .size B_table,1312 + .align 16 +cv: + .long 531389993 + .long 1067950900 + .long 4289495988 + .long 1069842387 + .long 2705553552 + .long 3216330822 + .long 4277811695 + .long 3218484802 + .type cv,@object + .size cv,32 + .align 16 +cev: + .long 1874480759 + .long 1065595563 + .long 4286760334 + .long 1070514109 + .long 3607404735 + .long 1068264200 + .long 4277811695 + .long 1072049730 + .type cev,@object + .size cev,32 + .align 16 +ABSVALMASK: + .long 4294967295 + .long 2147483647 + .type ABSVALMASK,@object + .size ABSVALMASK,8 + .space 8, 0x00 # pad + .align 16 +ABSVALS: + .long 2147483647 + .long 0 + .long 0 + .long 0 + .type ABSVALS,@object + .size ABSVALS,16 + .align 8 +EXPMASK: + .long 0 + .long 1072693248 + .type EXPMASK,@object + .size EXPMASK,8 + .align 4 +ONEMASK: + .long 1065353216 + .type ONEMASK,@object + .size ONEMASK,4 + .align 4 +sNaN: + .long 2139095041 + .type sNaN,@object + .size sNaN,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/powl.S b/external/sgx_libm/intel64/powl.S new file mode 100644 index 0000000000..564551d4bc --- /dev/null +++ b/external/sgx_libm/intel64/powl.S @@ -0,0 +1,2945 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "powl.c" + .text +..TXTST0: +# -- Begin powl + .text + .align 16,0x90 + .globl powl +powl: +# parameter 1: 336 + %rsp +# parameter 2: 352 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_powl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $280, %rsp + .cfi_def_cfa_offset 336 + xorb %r10b, %r10b + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 264(%rsp) +..B1.2: + fnstcw 250(%rsp) +..B1.3: + movzbl 345(%rsp), %ecx + xorl %r15d, %r15d + shrl $7, %ecx + movzwl 344(%rsp), %r14d + shll $15, %ecx + andl $32767, %r14d + movl 340(%rsp), %edx + orl %r14d, %ecx + movl %edx, %eax + movzbl 361(%rsp), %r8d + shrl $7, %r8d + shll $16, %ecx + shrl $16, %eax + movzwl 360(%rsp), %r12d + orl %eax, %ecx + shll $15, %r8d + andl $32767, %r12d + movl 356(%rsp), %eax + orl %r12d, %r8d + movl %eax, %ebx + movl %ecx, %r9d + shll $16, %r8d + andl $2147483647, %r9d + shrl $16, %ebx + cmpl $1073709056, %r9d + movl %ecx, %r13d + setb %r15b + orl %ebx, %r8d + movl %r8d, %ebp + andl $2147483647, %r8d + shrl $31, %ebp + movl %ebp, 128(%rsp) + xorl %ebp, %r15d + movl %r8d, %ebp + orl %eax, %ebp + shrl $31, %r13d + movl 352(%rsp), %r11d + orl %r11d, %ebp + movl 336(%rsp), %ebx + movl %r15d, 256(%rsp) + je ..B1.5 +..B1.4: + addl $-1073709056, %ecx + lea -2147483648(%rdx), %r15d + orl %r15d, %ecx + movl %r15d, 24(%rsp) + orl %ebx, %ecx + jne ..B1.11 +..B1.5: + cmpl $2147450880, %r8d + jae ..B1.8 +..B1.6: + cmpl $2147450880, %r9d + jb ..B1.9 +..B1.7: + addl $-2147483648, %edx + orl %ebx, %edx + je ..B1.9 +..B1.8: + fldt 336(%rsp) + fldt 352(%rsp) + fmulp %st, %st(1) + fstpt 224(%rsp) +..B1.9: + lea _ones(%rip), %rax + movq 264(%rsp), %rdx + xorq %rsp, %rdx + cmpq %fs:40, %rdx + movsd (%rax), %xmm0 + jne ..B1.155 +..B1.10: + movsd %xmm0, (%rsp) + fldl (%rsp) + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.11: + xorl %ecx, %ecx + lea -1073709056(%r8), %r15d + movq %rcx, 16(%rsp) + cmpl $4194304, %r15d + movq %rcx, 240(%rsp) + movl %r15d, 8(%rsp) + jae ..B1.16 +..B1.12: + movl %r8d, %edi + shrl $16, %edi + cmpl $1075806208, %r8d + ja ..B1.14 +..B1.13: + movl %edi, %ecx + movl %eax, %ebp + negl %ecx + addl $30, %ecx + shrl %cl, %ebp + movl %ebp, (%rsp) + lea 2(%rdi), %ecx + movl %eax, %ebp + shll %cl, %ebp + orl %r11d, %ebp + cmpl $1075740672, %r8d + cmova %r11d, %ebp + jmp ..B1.15 +..B1.14: + movl %edi, %ecx + movl %r11d, %ebp + negl %ecx + xorl %r15d, %r15d + addl $30, %ecx + shrl %cl, %ebp + movl %ebp, (%rsp) + lea 2(%rdi), %ecx + movl %r11d, %ebp + shll %cl, %ebp + cmpl $1077837824, %r8d + cmovae %r15d, %ebp +..B1.15: + xorl %ecx, %ecx + andl $1, (%rsp) + movl %r13d, %r15d + cmove %rcx, %r15 + movl (%rsp), %ecx + movq %r15, 240(%rsp) + movq %rcx, 16(%rsp) + jmp ..B1.17 +..B1.16: + xorl %ecx, %ecx + cmpl $1073709056, %r8d + cmovae %ecx, %ebp +..B1.17: + cmpl $32767, %r14d + je ..B1.233 +..B1.18: + cmpl $32767, %r12d + je ..B1.189 +..B1.19: + movl %edx, %ecx + andl $2147483647, %ecx + orl %ebx, %ecx + jne ..B1.26 +..B1.20: + movl %edx, %ecx + orl %r9d, %ecx + jne ..B1.26 +..B1.21: + movl $1, %edx + xorl %ecx, %ecx + testl %ebp, %ebp + cmove %edx, %ecx + movq 240(%rsp), %rax + andl %ecx, %eax + cmpl $0, 128(%rsp) + jne ..B1.157 +..B1.22: + cmpl $65536, %r8d + jae ..B1.24 +..B1.23: + lea _smallest_value_64(%rip), %rdx + movq (%rdx), %rcx + movq %rcx, 216(%rsp) +..B1.24: + movl %eax, %eax + lea _zeros(%rip), %rdx + movq 264(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + movsd (%rdx,%rax,8), %xmm0 + jne ..B1.155 +..B1.25: + movsd %xmm0, (%rsp) + fldl (%rsp) + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.26: + testl %r13d, %r13d + je ..B1.32 +..B1.27: + cmpl $1077837824, %r8d + jae ..B1.29 +..B1.28: + testl %ebp, %ebp + jne ..B1.160 +..B1.29: + lea -1073709056(%r9), %ecx + orl 24(%rsp), %ecx + orl %ebx, %ecx + jne ..B1.32 +..B1.30: + lea _ones(%rip), %rax + movq 16(%rsp), %rdx + movq 264(%rsp), %rcx + xorq %rsp, %rcx + movsd (%rax,%rdx,8), %xmm0 + cmpq %fs:40, %rcx + jne ..B1.155 +..B1.31: + movsd %xmm0, (%rsp) + fldl (%rsp) + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.32: + lea -65536(%r9), %r12d + lea -65536(%r8), %ecx + orl %ecx, %r12d + testl $-2147483648, %r12d + je ..B1.34 +..B1.33: + lea _smallest_value_64(%rip), %rcx + movq (%rcx), %r12 + movq %r12, 216(%rsp) +..B1.34: + movl %eax, %ecx + andl $2147483647, %ecx + orl %r11d, %ecx + jne ..B1.67 +..B1.35: + cmpl $1073709056, %r8d + jne ..B1.47 +..B1.36: + cmpl $0, 128(%rsp) + je ..B1.45 +..B1.37: + movzwl 250(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.41 +..B1.38: + orl $-64768, %edx + movw %dx, 248(%rsp) +..B1.39: + fldcw 248(%rsp) +..B1.40: + movb $1, %r10b +..B1.41: + fldt 336(%rsp) + lea _ones(%rip), %rax + testb %r10b, %r10b + movsd (%rax), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fdivp %st, %st(1) + fstpt 144(%rsp) + je ..B1.43 +..B1.42: + fldcw 250(%rsp) +..B1.43: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.44: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.45: + fldt 336(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.46: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.47: + cmpl $1073643520, %r8d + jne ..B1.67 +..B1.48: + movzwl 250(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.52 +..B1.49: + orl $-64768, %edx + movw %dx, 248(%rsp) +..B1.50: + fldcw 248(%rsp) +..B1.51: + movb $1, %r10b +..B1.52: + cmpl $0, 128(%rsp) + je ..B1.60 +..B1.53: + fldt 336(%rsp) + lea _ones(%rip), %rcx + movzbl 345(%rsp), %ebp + shrl $7, %ebp + movzwl 344(%rsp), %eax + shll $15, %ebp + andl $32767, %eax + orl %eax, %ebp + shll $16, %ebp + movzwl 342(%rsp), %edx + orl %edx, %ebp + fstpt 32(%rsp) + fldt 32(%rsp) + fstp %st(0) + fldl (%rcx) + fstpt (%rsp) + fldt (%rsp) + lea -536838144(%rbp), %ebx + cmpl $1073741824, %ebx + jbe ..B1.57 +..B1.54: + cmpl $536838144, %ebp + jae ..B1.56 +..B1.55: + fldt 32(%rsp) + lea _invsqrtl_scales(%rip), %rax + lea 16+_invsqrtl_scales(%rip), %rdx + fldt (%rax) + fmulp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fstp %st(0) + fldt (%rdx) + fstpt (%rsp) + jmp ..B1.57 +..B1.56: + fldt 32(%rsp) + lea 32+_invsqrtl_scales(%rip), %rax + lea 48+_invsqrtl_scales(%rip), %rdx + fldt (%rax) + fmulp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + fstp %st(0) + fldt (%rdx) + fstpt (%rsp) +..B1.57: + fldt 32(%rsp) + lea _TWO_43H(%rip), %rax + fld %st(0) + fxch %st(1) + fdivr %st, %st(2) + fxch %st(2) + fstpt 64(%rsp) + fldl (%rax) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) + fstpt 32(%rsp) +..B1.58: + fldt 64(%rsp) + fsqrt + fstpt 96(%rsp) +..B1.59: + fldt 96(%rsp) + fld %st(0) + fldt 16(%rsp) + fld %st(0) + fldt 32(%rsp) + fmul %st(4), %st + fldl (%rax) + lea 8+_ones(%rip), %rax + fmul %st(5), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fsubr %st(5), %st + fmul %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fld %st(1) + fxch %st(3) + fmul %st(4), %st + fmul %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fmul %st(3), %st + fldt .L_2il0floatpacket.0(%rip) + fldt (%rsp) + fxch %st(2) + faddl (%rax) + faddp %st, %st(4) + fxch %st(5) + fmulp %st, %st(3) + fxch %st(4) + fmulp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 144(%rsp) + jmp ..B1.63 +..B1.60: + fldt 336(%rsp) + fstpt 48(%rsp) +..B1.61: + fldt 48(%rsp) + fsqrt + fstpt 80(%rsp) +..B1.62: + fldt 80(%rsp) + fstpt 144(%rsp) +..B1.63: + testb %r10b, %r10b + je ..B1.65 +..B1.64: + fldcw 250(%rsp) +..B1.65: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.66: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.67: + movzwl 250(%rsp), %r11d + movl %r11d, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.71 +..B1.68: + orl $-64768, %r11d + movw %r11w, 248(%rsp) +..B1.69: + fldcw 248(%rsp) +..B1.70: + movb $1, %r10b +..B1.71: + fldt 336(%rsp) + lea _ones(%rip), %r11 + testl %ebp, %ebp + fmull (%r11,%r13,8) + fstpt 336(%rsp) + fldt 336(%rsp) + jne ..B1.100 +..B1.72: + cmpl $1048576, 8(%rsp) + jae ..B1.100 +..B1.73: + movl %r8d, %ecx + lea _exact_masks(%rip), %r12 + shrl $16, %ecx + negl %ecx + addl $30, %ecx + shrl %cl, %eax + cmpl $46, %eax + lea -2(%rax), %edi + jb ..L136 + movl $46, %edi +..L136: + movslq %edi, %rdi + movl 4(%r12,%rdi,8), %ebp + andl %ebp, %edx + movl (%r12,%rdi,8), %r13d + andl %r13d, %ebx + orl %ebx, %edx + jne ..B1.100 +..B1.74: + movq 240(%rsp), %rdx + cmpl $65535, %r9d + fldl (%r11,%rdx,8) + ja ..B1.76 +..B1.75: + lea _TWO_75(%rip), %rdx + fldl (%rdx) + fmulp %st, %st(2) + fxch %st(1) + fstpt 176(%rsp) + movzwl 184(%rsp), %ebp + movl %ebp, %ebx + andl $32767, %ebx + addl $-16458, %ebx + jmp ..B1.77 +..B1.76: + movzwl 344(%rsp), %ebx + fxch %st(1) + fstpt 176(%rsp) + andl $32767, %ebx + movzwl 184(%rsp), %ebp + addl $-16383, %ebx +..B1.77: + lea iones(%rip), %rdx + andl $-32768, %ebp + movl 128(%rsp), %ecx + orl $-49153, %ebp + movw %bp, 184(%rsp) + movl (%rdx,%rcx,4), %edx + imull %eax, %edx + imull %ebx, %edx + lea 16445(%rdx), %ebx + cmpl $32829, %ebx + lea 16383(%rdx), %ecx + jb ..B1.85 +..B1.78: + shlq $4, 240(%rsp) + cmpl $-63, %ecx + jg ..B1.80 +..B1.79: + lea _small_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + jmp ..B1.81 +..B1.80: + lea _large_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) +..B1.81: + fstpt 144(%rsp) + testb %r10b, %r10b + je ..B1.245 +..B1.82: + fstpt 32(%rsp) +..B1.237: + fldcw 250(%rsp) + jmp ..B1.83 +..B1.245: + fstp %st(0) +..B1.83: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.84: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.85: + fstpt 32(%rsp) + testl %ecx, %ecx + jg ..B1.87 +..B1.86: + addl $16458, %edx + movzwl 40(%rsp), %ecx + andl $32767, %edx + andl $-32768, %ecx + orl %edx, %ecx + lea 8+_TWO_75(%rip), %rdx + movw %cx, 40(%rsp) + fldt 32(%rsp) + fmull (%rdx) + fstpt 32(%rsp) + fldt 32(%rsp) + jmp ..B1.88 +..B1.87: + movzwl 40(%rsp), %edx + andl $32767, %ecx + andl $-32768, %edx + orl %ecx, %edx + movw %dx, 40(%rsp) + fldt 32(%rsp) +..B1.88: + cmpl $-2147483648, 180(%rsp) + jne ..B1.95 +..B1.89: + cmpl $0, 176(%rsp) + jne ..B1.95 +..B1.90: + fstpt 144(%rsp) +..B1.91: + testb %r10b, %r10b + je ..B1.93 +..B1.92: + fldcw 250(%rsp) +..B1.93: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.94: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.95: + fldt 176(%rsp) + lea _zeros(%rip), %rdx + fstpt 112(%rsp) + fldt 112(%rsp) + fldl (%r11) + movl $0, 112(%rsp) + fld %st(0) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt 112(%rsp) + fsubr %st, %st(3) + fldl (%rdx) + jmp ..B1.96 +..B1.99: + fld %st(1) + fadd %st(5), %st + fld %st(2) + fmul %st(6), %st + fxch %st(1) + fmulp %st, %st(6) + faddp %st, %st(5) + fld %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + movl $0, 112(%rsp) + fldt 112(%rsp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fxch %st(1) +..B1.96: + testb $1, %al + je ..B1.98 +..B1.97: + fld %st(1) + fadd %st(5), %st + fmulp %st, %st(1) + fld %st(4) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(1) + fmulp %st, %st(4) + fxch %st(3) + fstpt 16(%rsp) + fldt 16(%rsp) + movl $0, 16(%rsp) + fldt 16(%rsp) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(4) + fxch %st(3) +..B1.98: + shrl $1, %eax + testl %eax, %eax + je ..B1.169 + jmp ..B1.99 +..B1.100: + lea -1073676224(%r9), %eax + cmpl $32864, %eax + jae ..B1.102 +..B1.101: + lea 8+_ones(%rip), %rdx + lea _TWO_32H(%rip), %rcx + movb $1, %al + fldl (%rdx) + faddp %st, %st(1) + fld %st(0) + fld %st(1) + fxch %st(2) + fstpt 192(%rsp) + fldt 192(%rsp) + fldl (%rcx) + fmul %st, %st(2) + fxch %st(2) + fadd %st, %st(3) + fsubrp %st, %st(3) + fsub %st(2), %st + fxch %st(2) + jmp ..B1.106 +..B1.102: + xorb %al, %al + cmpl $65535, %r9d + ja ..B1.104 +..B1.103: + lea _TWO_75(%rip), %rdx + fldl (%rdx) + fmulp %st, %st(1) + fstpt 176(%rsp) + movzwl 184(%rsp), %edx + movl %edx, %edi + andl $32767, %edi + addl $-16458, %edi + jmp ..B1.105 +..B1.104: + movzwl 344(%rsp), %edi + fstpt 176(%rsp) + andl $32767, %edi + movzwl 184(%rsp), %edx + addl $-16383, %edi +..B1.105: + andl $-32768, %edx + lea 8+_ones(%rip), %rbx + orl $-49153, %edx + movw %dx, 184(%rsp) + lea _TWO_32H(%rip), %rdx + fldt 176(%rsp) + fld %st(0) + fld %st(1) + movl 180(%rsp), %esi + fldl (%rdx) + fmul %st, %st(2) + movq __libm_rcp_table_256@GOTPCREL(%rip), %rcx + fxch %st(1) + fadd %st(2), %st + shrl $23, %esi + fsubp %st, %st(2) + movzbl %sil, %esi + fxch %st(1) + fsubr %st, %st(2) + flds (%rcx,%rsi,4) + fmul %st, %st(1) + fmulp %st, %st(3) + faddl (%rbx) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fstpt 192(%rsp) + fldt 192(%rsp) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) +..B1.106: + fldt 192(%rsp) + lea 128+_LP(%rip), %rdx + fld %st(0) + lea 112+_LP(%rip), %rcx + lea 96+_LP(%rip), %rbx + lea 80+_LP(%rip), %rbp + lea 64+_LP(%rip), %r9 + lea 48+_LP(%rip), %r12 + lea 32+_LP(%rip), %r13 + lea 16+_LP(%rip), %r14 + lea _LP(%rip), %r15 + testb %al, %al + fadd %st(2), %st + fmul %st(4), %st + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + fmul %st(0), %st + fld %st(0) + fadd %st(3), %st + fld %st(0) + fxch %st(6) + fstpt 16(%rsp) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(6) + fsubrp %st, %st(6) + fxch %st(1) + fsub %st(5), %st + faddp %st, %st(3) + fldt (%rdx) + fmul %st(1), %st + fldt (%rcx) + fmul %st(2), %st + fldt (%rbx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rbp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r12) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r13) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r14) + faddp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fmul %st(4), %st + fld %st(2) + fadd %st(1), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fmul %st(4), %st + fldt (%r15) + fmul %st, %st(5) + fld %st(5) + fadd %st(2), %st + fsubr %st, %st(6) + fxch %st(2) + faddp %st, %st(6) + fmulp %st, %st(3) + fxch %st(1) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fldt (%rsp) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(1) + fadd %st(4), %st + fldt 16(%rsp) + faddp %st, %st(3) + faddp %st, %st(2) + je ..B1.108 +..B1.107: + fld %st(0) + fld %st(1) + fxch %st(2) + fxch %st(5) + fxch %st(2) + jmp ..B1.109 +..B1.108: + fstp %st(3) + movslq %esi, %rsi + pxor %xmm0, %xmm0 + lea _LT2(%rip), %rax + movq %rsi, %rdx + shlq $4, %rdx + lea _LLN2(%rip), %rbp + movq __libm_logl_table_256@GOTPCREL(%rip), %rcx + lea 16+_LLN2(%rip), %rbx + cvtss2sd (%rax,%rsi,4), %xmm0 + fldl (%rdx,%rcx) + fldt (%rbx) + fldt (%rbp) + addsd 8(%rdx,%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + movl %edi, (%rsp) + fildl (%rsp) + fmul %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(2) + fadd %st(1), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(4), %st + fld %st(0) + fld %st(2) + fsub %st(2), %st + fadd %st(6), %st + faddp %st, %st(4) +..B1.109: + fld %st(1) + fadd %st(4), %st + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 24(%rsp), %edx + shll $16, %edx + movzwl 22(%rsp), %eax + orl %eax, %edx + andl $2147483647, %edx + lea -1610514432(%rdx,%r8), %ecx + cmpl $538050560, %ecx + lea (%r8,%rdx), %eax + jbe ..B1.123 +..B1.110: + cmpl $-2146402304, %eax + jbe ..B1.118 +..B1.111: + fstp %st(4) + fstp %st(4) + fstp %st(2) + fstp %st(1) + shlq $4, 240(%rsp) + cmpl $0, 256(%rsp) + je ..B1.113 +..B1.112: + lea _small_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + jmp ..B1.114 +..B1.113: + lea _large_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) +..B1.114: + fstpt 144(%rsp) + testb %r10b, %r10b + je ..B1.246 +..B1.115: + fldt 32(%rsp) + fstpt 160(%rsp) + fxch %st(2) + fstpt 112(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) + fldt 192(%rsp) + fstpt 176(%rsp) +..B1.238: + fldcw 250(%rsp) + jmp ..B1.116 +..B1.246: + fstp %st(2) + fstp %st(1) + fstp %st(0) +..B1.116: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.117: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.118: + cmpl $1610514432, %eax + jae ..B1.123 +..B1.119: + fstp %st(4) + fstp %st(4) + fstp %st(2) + fstp %st(1) + movq 240(%rsp), %rcx + lea _small_value_80(%rip), %rdx + movl %ecx, %eax + xorl 256(%rsp), %eax + shlq $4, %rax + testb %r10b, %r10b + fldt (%rdx,%rax) + faddl (%r11,%rcx,8) + fstpt 144(%rsp) + je ..B1.247 +..B1.120: + fldt 32(%rsp) + fstpt 160(%rsp) + fxch %st(2) + fstpt 112(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) + fldt 192(%rsp) + fstpt 176(%rsp) +..B1.239: + fldcw 250(%rsp) + jmp ..B1.121 +..B1.247: + fstp %st(2) + fstp %st(1) + fstp %st(0) +..B1.121: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.122: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.123: + fstp %st(1) + fld %st(0) + fmul %st(5), %st + movq 240(%rsp), %rax + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fld %st(3) + fldt 352(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 128(%rsp) + fldt 128(%rsp) + fsubp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fmul %st(3), %st + fxch %st(5) + fmulp %st, %st(1) + faddp %st, %st(4) + fld %st(3) + fxch %st(1) + fmulp %st, %st(2) + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fldl (%r11,%rax,8) + movzwl 24(%rsp), %eax + shll $16, %eax + movzwl 22(%rsp), %edx + orl %edx, %eax + andl $2147483647, %eax + fstpl 208(%rsp) + cmpl $1072398336, %eax + jae ..B1.131 +..B1.124: + fstp %st(4) + cmpl $1069318144, %eax + jae ..B1.126 +..B1.125: + fstp %st(2) + fldl 208(%rsp) + fmul %st, %st(3) + faddp %st, %st(3) + fxch %st(1) + fxch %st(2) + jmp ..B1.127 +..B1.126: + lea 16+_EP1(%rip), %rax + lea _EP1(%rip), %rdx + fldt (%rax) + fmul %st(4), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(4), %st + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fldl 208(%rsp) + fmul %st, %st(1) + faddp %st, %st(1) +..B1.127: + fstpt 144(%rsp) + testb %r10b, %r10b + je ..B1.248 +..B1.128: + fldt 128(%rsp) + fstpt 160(%rsp) + fstpt 16(%rsp) + fxch %st(1) + fstpt 112(%rsp) + fstpt (%rsp) + fldt 192(%rsp) + fstpt 176(%rsp) + fldl 208(%rsp) + fstpt 32(%rsp) +..B1.240: + fldcw 250(%rsp) + jmp ..B1.129 +..B1.248: + fstp %st(2) + fstp %st(1) + fstp %st(0) +..B1.129: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.130: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.131: + fldt .L_2il0floatpacket.1(%rip) + lea _TWO_63H(%rip), %rdx + fmul %st(1), %st + lea ESC2_BIAS(%rip), %rbx + fxch %st(1) + fstpt 144(%rsp) + fldl (%rdx) + movl 256(%rsp), %eax + fadd %st, %st(1) + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + fsubp %st, %st(1) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(1), %st + movl 160(%rsp), %edx + movl %edx, %esi + movsbq %dl, %rcx + fsubr %st(2), %st + fldt .L_2il0floatpacket.3(%rip) + subl %ecx, %esi + fmulp %st, %st(2) + fld %st(0) + sarl $8, %esi + fsub %st(2), %st + movl (%rbx,%rax,4), %ebp + fadd %st(6), %st + fstpt 128(%rsp) + fldt 128(%rsp) + lea -1(%rbp,%rsi), %edi + cmpl $32766, %edi + lea (%rbp,%rsi), %ebx + fsubp %st, %st(6) + fsub %st(5), %st + fsubp %st, %st(1) + fstpt 112(%rsp) + fldt 144(%rsp) + jb ..B1.139 +..B1.132: + fstp %st(0) + fstp %st(2) + fstp %st(2) + shlq $4, 240(%rsp) + cmpl $1, %ebx + jg ..B1.134 +..B1.133: + lea _small_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + jmp ..B1.135 +..B1.134: + lea _large_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) +..B1.135: + fstpt 144(%rsp) + testb %r10b, %r10b + je ..B1.249 +..B1.136: + fldt 128(%rsp) + fstpt 160(%rsp) + fxch %st(1) + fstpt 16(%rsp) + fxch %st(1) + fstpt 112(%rsp) + fstpt (%rsp) + fldt 192(%rsp) + fstpt 176(%rsp) + fldl 208(%rsp) + fstpt 32(%rsp) +..B1.241: + fldcw 250(%rsp) + jmp ..B1.137 +..B1.249: + fstp %st(2) + fstp %st(0) + fstp %st(0) +..B1.137: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.138: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.139: + fldl 208(%rsp) + andl $32767, %ebx + fstpt 32(%rsp) + fld %st(4) + fxch %st(2) + fstpt 16(%rsp) + lea 48+_EP(%rip), %rsi + movzwl 40(%rsp), %ebp + lea 32+_EP(%rip), %rdi + andl $-32768, %ebp + lea 16+_EP(%rip), %r8 + fstpt 144(%rsp) + orl %ebx, %ebp + lea 64+_EP(%rip), %rbx + lea _EP(%rip), %r9 + fxch %st(1) + fstpt (%rsp) + addl $4196735, %edx + fldt 112(%rsp) + movslq %ecx, %rcx + faddp %st, %st(2) + shlq $4, %rcx + fadd %st(1), %st + fld %st(0) + cmpl $3070, %edx + fmul %st(1), %st + fldt (%rbx) + fmul %st(1), %st + fldt (%rsi) + fmul %st(2), %st + fldt (%rdi) + movq __libm_expl_table_256@GOTPCREL(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + movw %bp, 40(%rsp) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fmulp %st, %st(3) + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fxch %st(1) + fadd %st(2), %st + fldl 2048(%rcx,%r11) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fxch %st(1) + fmul %st, %st(3) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(1) + fmull 2056(%rcx,%r11) + faddp %st, %st(2) + fldt 16(%rsp) + fxch %st(3) + faddl 2056(%rcx,%r11) + faddp %st, %st(2) + fldt 144(%rsp) + fldt (%rsp) + ja ..B1.142 +..B1.140: + lea _Eexpbut(%rip), %rdx + fldt (%rdx) + fcomip %st(2), %st + jbe ..B1.142 +..B1.141: + fstp %st(1) + fld %st(1) + lea _TWO_12H(%rip), %rdx + shlq $4, %rax + fadd %st(3), %st + fldl (%rdx) + lea _ESC2(%rip), %rcx + fmul %st(1), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 128(%rsp) + fldt 128(%rsp) + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%rax,%rcx) + fldt 32(%rsp) + fmul %st, %st(3) + fxch %st(1) + fmul %st, %st(3) + fxch %st(4) + fmulp %st, %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 144(%rsp) + jmp ..B1.143 +..B1.142: + fstp %st(1) + shlq $4, %rax + lea _ESC2(%rip), %rdx + fldt (%rax,%rdx) + fmul %st, %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fmulp %st, %st(1) + fstpt 144(%rsp) +..B1.143: + movzwl 152(%rsp), %ecx + shll $16, %ecx + movzwl 150(%rsp), %eax + orl %eax, %ecx + andl $2147483647, %ecx + lea -98304(%rcx), %edx + cmpl $2147319808, %edx + jb ..B1.151 +..B1.144: + shlq $4, 240(%rsp) + cmpl $65535, %ecx + ja ..B1.146 +..B1.145: + lea _small_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + fstpt 224(%rsp) + jmp ..B1.147 +..B1.146: + lea _large_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + fstpt 144(%rsp) +..B1.147: + testb %r10b, %r10b + je ..B1.250 +..B1.148: + fldt 128(%rsp) + fstpt 160(%rsp) + fxch %st(2) + fstpt 112(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) + fldt 192(%rsp) + fstpt 176(%rsp) +..B1.242: + fldcw 250(%rsp) + jmp ..B1.149 +..B1.250: + fstp %st(2) + fstp %st(1) + fstp %st(0) +..B1.149: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.150: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.151: + testb %r10b, %r10b + je ..B1.251 +..B1.152: + fldt 128(%rsp) + fstpt 160(%rsp) + fxch %st(2) + fstpt 112(%rsp) + fstpt (%rsp) + fstpt 16(%rsp) + fldt 192(%rsp) + fstpt 176(%rsp) +..B1.243: + fldcw 250(%rsp) + jmp ..B1.153 +..B1.251: + fstp %st(2) + fstp %st(1) + fstp %st(0) +..B1.153: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.154: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.155: + call __stack_chk_fail@PLT +..B1.157: + lea _ones(%rip), %rdx + lea _zeros(%rip), %rcx + movsd (%rdx,%rax,8), %xmm0 + divsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + movq 264(%rsp), %rbx + xorq %rsp, %rbx + cmpq %fs:40, %rbx + je ..B1.44 +..B1.159: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.160: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + movq 264(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + jne ..B1.159 + jmp ..B1.44 +..B1.169: + fstp %st(4) + fstp %st(0) + cmpl $0, 128(%rsp) + jne ..B1.171 +..B1.170: + fstp %st(0) + fstpt (%rsp) + fldt (%rsp) + jmp ..B1.172 +..B1.171: + fld %st(1) + lea 8+_ones(%rip), %rax + fadd %st(3), %st + fdivr %st, %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fld %st(0) + movl $0, (%rsp) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fldt (%rsp) + fmul %st, %st(5) + fsubr %st, %st(2) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(5) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddl (%rax) + faddp %st, %st(4) + fmulp %st, %st(3) + fsubp %st, %st(2) +..B1.172: + fld %st(0) + fmul %st(3), %st + fld %st(0) + fld %st(4) + fmul %st(4), %st + fadd %st(1), %st + fstpt 144(%rsp) + movzwl 152(%rsp), %edx + shll $16, %edx + movzwl 150(%rsp), %eax + orl %eax, %edx + andl $2147483647, %edx + cmpl $65535, %edx + ja ..B1.174 +..B1.173: + fld %st(4) + fdivrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + fadd %st, %st(3) + fxch %st(3) + fmul %st(4), %st + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fadd %st(1), %st + fstpt 144(%rsp) + fldt 144(%rsp) + movzwl 152(%rsp), %edx + shll $16, %edx + movzwl 150(%rsp), %eax + orl %eax, %edx + andl $2147483647, %edx + fxch %st(1) + fxch %st(3) + fxch %st(2) +..B1.174: + fstp %st(1) + fstp %st(1) + fstp %st(0) + fstp %st(1) + fstp %st(0) + lea -98304(%rdx), %eax + cmpl $2147319808, %eax + jb ..B1.91 +..B1.175: + shlq $4, 240(%rsp) + cmpl $65535, %edx + ja ..B1.177 +..B1.176: + lea _small_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + fstpt 224(%rsp) + jmp ..B1.178 +..B1.177: + lea _large_value_80(%rip), %rdx + movq 240(%rsp), %rax + fldt (%rax,%rdx) + fldt (%rdx) + fmulp %st, %st(1) + fstpt 144(%rsp) +..B1.178: + testb %r10b, %r10b + je ..B1.180 +..B1.179: + fldcw 250(%rsp) +..B1.180: + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 + jmp ..B1.44 +..B1.189: + movq $0x8000000000000000, %rcx + cmpq 352(%rsp), %rcx + je ..B1.193 +..B1.190: + fldt 336(%rsp) + fldt 352(%rsp) + fmulp %st, %st(1) + fstpt 224(%rsp) + fldt 224(%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 + jmp ..B1.44 +..B1.193: + cmpl $32767, %r14d + je ..B1.223 +..B1.194: + cmpl $32767, %r12d + jne ..B1.19 +..B1.195: + cmpl $-2147483648, %eax + jne ..B1.19 +..B1.196: + testl %r11d, %r11d + jne ..B1.19 +..B1.197: + cmpl $1073709056, %r9d + jae ..B1.210 +..B1.198: + orl %r9d, %ebx + jne ..B1.203 +..B1.199: + lea _zeros(%rip), %rax + cmpl $0, 128(%rsp) + movsd (%rax), %xmm0 + jne ..B1.219 +..B1.200: + movsd %xmm0, (%rsp) + fldl (%rsp) +..B1.201: + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.202: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.203: + cmpl $65536, %r9d + jae ..B1.205 +..B1.204: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 216(%rsp) +..B1.205: + cmpl $0, 128(%rsp) + je ..B1.207 +..B1.206: + lea _infs(%rip), %rax + fldl (%rax) + jmp ..B1.208 +..B1.207: + lea _zeros(%rip), %rax + fldl (%rax) +..B1.208: + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.209: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.210: + addl $-1073709056, %r9d + orl 24(%rsp), %r9d + orl %ebx, %r9d + je ..B1.216 +..B1.211: + cmpl $0, 128(%rsp) + je ..B1.213 +..B1.212: + lea _zeros(%rip), %rax + fldl (%rax) + jmp ..B1.214 +..B1.213: + lea _infs(%rip), %rax + fldl (%rax) +..B1.214: + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 +..B1.215: + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.216: + lea _ones(%rip), %rax + movq 16(%rsp), %rdx + movq 264(%rsp), %rcx + xorq %rsp, %rcx + movsd (%rax,%rdx,8), %xmm0 + cmpq %fs:40, %rcx + jne ..B1.155 +..B1.217: + movsd %xmm0, (%rsp) + fldl (%rsp) + addq $280, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 336 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.219: + lea _ones(%rip), %rax + movsd (%rax), %xmm1 + divsd %xmm0, %xmm1 + movsd %xmm1, (%rsp) + fldl (%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + jmp ..B1.201 +..B1.223: + cmpl $-2147483648, %edx + jne ..B1.194 +..B1.224: + testl %ebx, %ebx + jne ..B1.194 +..B1.225: + cmpl $65536, %r8d + jae ..B1.227 +..B1.226: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 216(%rsp) +..B1.227: + xorl %eax, %eax + testl %ebp, %ebp + je ..L377 + movq %rax, 240(%rsp) +..L377: + cmpl $0, 128(%rsp) + je ..B1.229 +..B1.228: + lea _zeros(%rip), %rax + movq 240(%rsp), %rdx + fldl (%rax,%rdx,8) + jmp ..B1.230 +..B1.229: + lea _infs(%rip), %rax + movq 240(%rsp), %rdx + fldl (%rax,%rdx,8) +..B1.230: + movq 264(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.159 + jmp ..B1.44 +..B1.233: + movq $0x8000000000000000, %rcx + cmpq 336(%rsp), %rcx + jne ..B1.190 +..B1.234: + cmpl $32767, %r12d + je ..B1.189 + jmp ..B1.193 + .align 16,0x90 + .cfi_endproc + .type powl,@function + .size powl,.-powl + .data +# -- End powl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_43H: + .long 0 + .long 1118306304 + .type _TWO_43H,@object + .size _TWO_43H,8 + .align 4 +_exact_masks: + .long 131071 + .long 0 + .long 4294967295 + .long 1 + .long 4294967295 + .long 511 + .long 4294967295 + .long 16383 + .long 4294967295 + .long 131071 + .long 4294967295 + .long 1048575 + .long 4294967295 + .long 2097151 + .long 4294967295 + .long 8388607 + .long 4294967295 + .long 16777215 + .long 4294967295 + .long 33554431 + .long 4294967295 + .long 33554431 + .long 4294967295 + .long 67108863 + .long 4294967295 + .long 134217727 + .long 4294967295 + .long 134217727 + .long 4294967295 + .long 134217727 + .long 4294967295 + .long 268435455 + .long 4294967295 + .long 268435455 + .long 4294967295 + .long 268435455 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 536870911 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 1073741823 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .long 4294967295 + .long 2147483647 + .type _exact_masks,@object + .size _exact_masks,376 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_LT2: + .long 180342526 + .long 2357584585 + .long 2340989257 + .long 193458247 + .long 2370723239 + .long 2317577053 + .long 2382055315 + .long 232148275 + .long 200972627 + .long 2376530255 + .long 2376860906 + .long 222325808 + .long 228268523 + .long 229816737 + .long 2387925496 + .long 239088248 + .long 235445027 + .long 219576635 + .long 2365457762 + .long 200344795 + .long 2377779510 + .long 2396359259 + .long 256760275 + .long 2390604874 + .long 2403557039 + .long 2397936349 + .long 2387307486 + .long 2389941185 + .long 2375749593 + .long 224865835 + .long 2394232861 + .long 180745560 + .long 231885773 + .long 2352962188 + .long 2306055684 + .long 206875141 + .long 258325764 + .long 2386208973 + .long 231066739 + .long 195513036 + .long 2360327132 + .long 2396045581 + .long 236564318 + .long 2282584976 + .long 2351736009 + .long 236364231 + .long 2384427773 + .long 267355851 + .long 255771104 + .long 265321597 + .long 2384375360 + .long 2399209743 + .long 186438128 + .long 2407131686 + .long 2382793784 + .long 2395218767 + .long 229223248 + .long 256892528 + .long 2394735602 + .long 2385223602 + .long 2372921302 + .long 2398642377 + .long 2399679754 + .long 255686225 + .long 220689523 + .long 2385772978 + .long 209771590 + .long 2396079173 + .long 247531082 + .long 236085121 + .long 264660069 + .long 2357821390 + .long 236486650 + .long 2368138461 + .long 239690108 + .long 2396070228 + .long 196955922 + .long 217533735 + .long 255641653 + .long 249646543 + .long 253232621 + .long 246212714 + .long 2396427575 + .long 261629730 + .long 2364672847 + .long 2403865410 + .long 251273869 + .long 261125380 + .long 2388321036 + .long 2375891827 + .long 2381014317 + .long 2414822930 + .long 2406245053 + .long 2406988902 + .long 2395399973 + .long 213294711 + .long 2401319324 + .long 265450299 + .long 231845893 + .long 260578794 + .long 258934474 + .long 2368795786 + .long 2422506717 + .long 218205033 + .long 258708287 + .long 257044854 + .long 2396281866 + .long 2415975150 + .long 257697283 + .long 2393801226 + .long 2388654986 + .long 262910764 + .long 235638432 + .long 268054962 + .long 271083258 + .long 256780444 + .long 256064350 + .long 252979189 + .long 2420460964 + .long 233178508 + .long 251655134 + .long 2404577473 + .long 2408876374 + .long 2401072099 + .long 228623072 + .long 2421706621 + .long 2353033467 + .long 2411792212 + .long 2345330012 + .long 2397189005 + .long 243110369 + .long 2408213151 + .long 219253901 + .long 246695172 + .long 259288551 + .long 254210780 + .long 261865355 + .long 230359170 + .long 263524551 + .long 2405618542 + .long 2399869921 + .long 233826616 + .long 2362750769 + .long 257576291 + .long 251808114 + .long 2403390977 + .long 253249058 + .long 261065811 + .long 215406974 + .long 2407628993 + .long 258391343 + .long 2394470699 + .long 258495470 + .long 2415771687 + .long 224670583 + .long 263047889 + .long 2389031226 + .long 259453051 + .long 266564569 + .long 2422023012 + .long 264051375 + .long 2409075373 + .long 252244729 + .long 220302768 + .long 254847756 + .long 243124762 + .long 2363519942 + .long 2393496158 + .long 2402135082 + .long 2365706590 + .long 237902971 + .long 262295026 + .long 252689257 + .long 236678680 + .long 255167613 + .long 2406879752 + .long 274254693 + .long 259983961 + .long 245852525 + .long 256459527 + .long 220533989 + .long 245387845 + .long 243835221 + .long 2377853444 + .long 274540751 + .long 229741069 + .long 263626566 + .long 220608387 + .long 226161046 + .long 247301717 + .long 268433686 + .long 222008210 + .long 2414961139 + .long 276137642 + .long 2412197898 + .long 258445918 + .long 2412645341 + .long 260857859 + .long 263113037 + .long 2386484264 + .long 2390742630 + .long 259665290 + .long 2363417497 + .long 2384122046 + .long 263493300 + .long 219472625 + .long 2420433676 + .long 274201285 + .long 2404911312 + .long 257926520 + .long 260332203 + .long 256695016 + .long 218494534 + .long 2420150889 + .long 2414586287 + .long 267006159 + .long 231320206 + .long 2382797064 + .long 2414903062 + .long 263514471 + .long 2406010284 + .long 2410428205 + .long 2414319991 + .long 249083715 + .long 2381171937 + .long 236369629 + .long 2409614279 + .long 2424220710 + .long 2378379154 + .long 218677462 + .long 2382987336 + .long 2377870458 + .long 258155310 + .long 2368239928 + .long 2414896572 + .long 193310867 + .long 256673115 + .long 2406448055 + .long 271719709 + .long 248566852 + .long 229016248 + .long 272541555 + .long 2382115967 + .long 2375311600 + .long 2393766434 + .long 257187362 + .long 277931545 + .long 281038165 + .long 2373962226 + .long 261638946 + .long 255465134 + .long 273460929 + .long 275851296 + .long 2417166241 + .long 2361106656 + .long 278653754 + .type _LT2,@object + .size _LT2,1024 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +ESC2_BIAS: + .long 4095 + .long 28671 + .type ESC2_BIAS,@object + .size ESC2_BIAS,8 + .align 4 +_TWO_12H: + .long 0 + .long 1085800448 + .type _TWO_12H,@object + .size _TWO_12H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 2 +_invsqrtl_scales: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 24575 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 20479 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 8191 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 12287 + .word 0 + .word 0 + .word 0 + .type _invsqrtl_scales,@object + .size _invsqrtl_scales,64 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_LP: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 52785 + .word 52428 + .word 52428 + .word 52428 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 44453 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 25655 + .word 14678 + .word 9362 + .word 37449 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 38741 + .word 53722 + .word 65535 + .word 65535 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 45676 + .word 59527 + .word 48579 + .word 58254 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 41682 + .word 64796 + .word 25002 + .word 52429 + .word 49147 + .word 0 + .word 0 + .word 0 + .type _LP,@object + .size _LP,144 + .align 2 +_LLN2: + .word 0 + .word 53711 + .word 6135 + .word 45426 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 2022 + .word 26416 + .word 37831 + .word 62295 + .word 16333 + .word 0 + .word 0 + .word 0 + .type _LLN2,@object + .size _LLN2,32 + .align 2 +_EP1: + .word 43691 + .word 10 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30584 + .word 43703 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _EP1,@object + .size _EP1,32 + .align 2 +_EP: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _EP,@object + .size _EP,80 + .align 2 +_Eexpbut: + .word 60207 + .word 4624 + .word 35943 + .word 45420 + .word 49164 + .word 0 + .word 0 + .word 0 + .type _Eexpbut,@object + .size _Eexpbut,16 + .align 2 +_ESC2: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 28671 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 4095 + .word 0 + .word 0 + .word 0 + .type _ESC2,@object + .size _ESC2,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/q2l.S b/external/sgx_libm/intel64/q2l.S new file mode 100644 index 0000000000..6c9150bee8 --- /dev/null +++ b/external/sgx_libm/intel64/q2l.S @@ -0,0 +1,289 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "q2l.c" + .text +..TXTST0: +# -- Begin __qtol + .text + .align 16,0x90 + .globl __qtol +__qtol: +# parameter 1: %rdi +..B1.1: + .cfi_startproc +..___tag_value___qtol.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movq %rdi, %rdx + movq $0xffffffffffff, %rcx + movq 8(%rdx), %rax + movq %rax, %rsi + shrq $48, %rsi + andq %rax, %rcx + movq (%rdx), %rdi + movq %rdi, %r8 + movl %esi, %edx + shlq $15, %rcx + andl $32767, %edx + shrq $49, %r8 + shlq $15, %rdi + orq %r8, %rcx + cmpl $32767, %edx + jne ..B1.7 +..B1.2: + orq %rcx, %rdi + je ..B1.6 +..B1.3: + movq $0x4000000000000000, %rdx + testq %rcx, %rdx + jne ..B1.5 +..B1.4: + movq p_zero(%rip), %rax + movsd (%rax), %xmm0 + divsd %xmm0, %xmm0 + movsd %xmm0, (%rsp) +..B1.5: + orq %rdx, %rcx +..B1.6: + btsq $63, %rcx + movl %esi, 24(%rsp) + movq %rcx, 16(%rsp) + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.7: + testl %edx, %edx + je ..B1.9 +..B1.8: + movq $0x8000000000000000, %rax + orq %rax, %rcx + jmp ..B1.11 +..B1.9: + movq %rcx, %rax + orq %rdi, %rax + je ..B1.22 +..B1.10: + movq p_tiny(%rip), %rax + movq p_one(%rip), %r8 + movsd (%rax), %xmm0 + mulsd (%r8), %xmm0 + movsd %xmm0, (%rsp) +..B1.11: + testq %rdi, %rdi + je ..B1.21 +..B1.12: + stmxcsr 8(%rsp) +..B1.13: + movl 8(%rsp), %eax + shrl $3, %eax + andl $3072, %eax + jne ..B1.15 +..B1.14: + testq %rdi, %rdi + jl ..B1.23 + jmp ..B1.18 +..B1.15: + testl $32768, %esi + je ..B1.17 +..B1.16: + cmpl $1024, %eax + je ..B1.23 + jmp ..B1.18 +..B1.17: + cmpl $2048, %eax + je ..B1.23 +..B1.18: + testl %edx, %edx + jne ..B1.20 +..B1.19: + movq p_norm(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, (%rsp) + jmp ..B1.21 +..B1.20: + movq p_one(%rip), %rax + movq p_norm(%rip), %rdx + movsd (%rax), %xmm0 + addsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) +..B1.21: + movl %esi, 24(%rsp) + movq %rcx, 16(%rsp) + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.22: + movl %esi, 24(%rsp) + movq $0, 16(%rsp) + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.23: + incq %rcx + testl %edx, %edx + je ..B1.29 +..B1.24: + testq %rcx, %rcx + jne ..B1.28 +..B1.25: + incl %esi + movq $0x8000000000000000, %rcx + movl %esi, %edx + andl $32767, %edx +..B1.26: + cmpl $32767, %edx + jne ..B1.18 +..B1.27: + movq p_huge(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, (%rsp) + jmp ..B1.21 +..B1.28: + movq $0x8000000000000000, %rdx + movl $1, %r8d + cmpq %rdi, %rdx + movl $0, %edi + movq p_one(%rip), %r9 + movq p_norm(%rip), %r10 + cmove %r8d, %edi + testl %eax, %eax + movl $0, %eax + movsd (%r9), %xmm0 + cmove %r8d, %eax + addsd (%r10), %xmm0 + andl %eax, %edi + notl %edi + movslq %edi, %rdi + movsd %xmm0, (%rsp) + andq %rdi, %rcx + jmp ..B1.21 +..B1.29: + movq $0x8000000000000000, %rdx + movl $1, %r8d + cmpq %rdi, %rdx + movl $0, %edi + cmove %r8d, %edi + testl %eax, %eax + movl $0, %eax + cmove %r8d, %eax + andl %eax, %edi + notl %edi + movslq %edi, %rdi + andq %rdi, %rcx + jge ..B1.19 +..B1.30: + incl %esi + movl %esi, %edx + andl $32767, %edx + jmp ..B1.26 + .align 16,0x90 + .cfi_endproc + .type __qtol,@function + .size __qtol,.-__qtol + .data +# -- End __qtol + .data + .align 8 + .align 8 +p_zero: + .quad d_zero + .type p_zero,@object + .size p_zero,8 + .align 8 +p_tiny: + .quad d_tiny + .type p_tiny,@object + .size p_tiny,8 + .align 8 +p_one: + .quad d_one + .type p_one,@object + .size p_one,8 + .align 8 +p_norm: + .quad d_norm + .type p_norm,@object + .size p_norm,8 + .align 8 +p_huge: + .quad d_huge + .type p_huge,@object + .size p_huge,8 + .section .rodata, "a" + .align 8 + .align 8 +d_zero: + .long 0x00000000,0x00000000 + .type d_zero,@object + .size d_zero,8 + .align 8 +d_tiny: + .long 0x00000001,0x00000000 + .type d_tiny,@object + .size d_tiny,8 + .align 8 +d_one: + .long 0x00000000,0x3ff00000 + .type d_one,@object + .size d_one,8 + .align 8 +d_norm: + .long 0x00000000,0x00100000 + .type d_norm,@object + .size d_norm,8 + .align 8 +d_huge: + .long 0xffffffff,0x7fefffff + .type d_huge,@object + .size d_huge,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/rcp_table.S b/external/sgx_libm/intel64/rcp_table.S new file mode 100644 index 0000000000..ec4cfe363d --- /dev/null +++ b/external/sgx_libm/intel64/rcp_table.S @@ -0,0 +1,820 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rcp_table.c" + .section .rodata, "a" + .align 32 + .align 32 + .globl __libm_rcp_table_256 +__libm_rcp_table_256: + .long 0x3f7f8000 + .long 0x3f7e8000 + .long 0x3f7d8000 + .long 0x3f7c8000 + .long 0x3f7ba000 + .long 0x3f7aa000 + .long 0x3f79a000 + .long 0x3f78c000 + .long 0x3f77c000 + .long 0x3f76e000 + .long 0x3f75e000 + .long 0x3f750000 + .long 0x3f742000 + .long 0x3f732000 + .long 0x3f724000 + .long 0x3f716000 + .long 0x3f708000 + .long 0x3f6fa000 + .long 0x3f6ec000 + .long 0x3f6de000 + .long 0x3f6d0000 + .long 0x3f6c2000 + .long 0x3f6b6000 + .long 0x3f6a8000 + .long 0x3f69a000 + .long 0x3f68c000 + .long 0x3f680000 + .long 0x3f672000 + .long 0x3f666000 + .long 0x3f658000 + .long 0x3f64c000 + .long 0x3f640000 + .long 0x3f632000 + .long 0x3f626000 + .long 0x3f61a000 + .long 0x3f60e000 + .long 0x3f600000 + .long 0x3f5f4000 + .long 0x3f5e8000 + .long 0x3f5dc000 + .long 0x3f5d0000 + .long 0x3f5c4000 + .long 0x3f5b8000 + .long 0x3f5ae000 + .long 0x3f5a2000 + .long 0x3f596000 + .long 0x3f58a000 + .long 0x3f57e000 + .long 0x3f574000 + .long 0x3f568000 + .long 0x3f55e000 + .long 0x3f552000 + .long 0x3f546000 + .long 0x3f53c000 + .long 0x3f532000 + .long 0x3f526000 + .long 0x3f51c000 + .long 0x3f510000 + .long 0x3f506000 + .long 0x3f4fc000 + .long 0x3f4f2000 + .long 0x3f4e6000 + .long 0x3f4dc000 + .long 0x3f4d2000 + .long 0x3f4c8000 + .long 0x3f4be000 + .long 0x3f4b4000 + .long 0x3f4aa000 + .long 0x3f4a0000 + .long 0x3f496000 + .long 0x3f48c000 + .long 0x3f482000 + .long 0x3f478000 + .long 0x3f46e000 + .long 0x3f464000 + .long 0x3f45c000 + .long 0x3f452000 + .long 0x3f448000 + .long 0x3f43e000 + .long 0x3f436000 + .long 0x3f42c000 + .long 0x3f422000 + .long 0x3f41a000 + .long 0x3f410000 + .long 0x3f408000 + .long 0x3f3fe000 + .long 0x3f3f6000 + .long 0x3f3ec000 + .long 0x3f3e4000 + .long 0x3f3da000 + .long 0x3f3d2000 + .long 0x3f3ca000 + .long 0x3f3c0000 + .long 0x3f3b8000 + .long 0x3f3b0000 + .long 0x3f3a8000 + .long 0x3f39e000 + .long 0x3f396000 + .long 0x3f38e000 + .long 0x3f386000 + .long 0x3f37e000 + .long 0x3f376000 + .long 0x3f36c000 + .long 0x3f364000 + .long 0x3f35c000 + .long 0x3f354000 + .long 0x3f34c000 + .long 0x3f344000 + .long 0x3f33c000 + .long 0x3f334000 + .long 0x3f32e000 + .long 0x3f326000 + .long 0x3f31e000 + .long 0x3f316000 + .long 0x3f30e000 + .long 0x3f306000 + .long 0x3f2fe000 + .long 0x3f2f8000 + .long 0x3f2f0000 + .long 0x3f2e8000 + .long 0x3f2e2000 + .long 0x3f2da000 + .long 0x3f2d2000 + .long 0x3f2cc000 + .long 0x3f2c4000 + .long 0x3f2bc000 + .long 0x3f2b6000 + .long 0x3f2ae000 + .long 0x3f2a8000 + .long 0x3f2a0000 + .long 0x3f29a000 + .long 0x3f292000 + .long 0x3f28c000 + .long 0x3f284000 + .long 0x3f27e000 + .long 0x3f276000 + .long 0x3f270000 + .long 0x3f268000 + .long 0x3f262000 + .long 0x3f25c000 + .long 0x3f254000 + .long 0x3f24e000 + .long 0x3f248000 + .long 0x3f240000 + .long 0x3f23a000 + .long 0x3f234000 + .long 0x3f22e000 + .long 0x3f226000 + .long 0x3f220000 + .long 0x3f21a000 + .long 0x3f214000 + .long 0x3f20e000 + .long 0x3f206000 + .long 0x3f200000 + .long 0x3f1fa000 + .long 0x3f1f4000 + .long 0x3f1ee000 + .long 0x3f1e8000 + .long 0x3f1e2000 + .long 0x3f1dc000 + .long 0x3f1d6000 + .long 0x3f1d0000 + .long 0x3f1ca000 + .long 0x3f1c4000 + .long 0x3f1be000 + .long 0x3f1b8000 + .long 0x3f1b2000 + .long 0x3f1ac000 + .long 0x3f1a6000 + .long 0x3f1a0000 + .long 0x3f19a000 + .long 0x3f194000 + .long 0x3f190000 + .long 0x3f18a000 + .long 0x3f184000 + .long 0x3f17e000 + .long 0x3f178000 + .long 0x3f172000 + .long 0x3f16e000 + .long 0x3f168000 + .long 0x3f162000 + .long 0x3f15c000 + .long 0x3f158000 + .long 0x3f152000 + .long 0x3f14c000 + .long 0x3f148000 + .long 0x3f142000 + .long 0x3f13c000 + .long 0x3f138000 + .long 0x3f132000 + .long 0x3f12c000 + .long 0x3f128000 + .long 0x3f122000 + .long 0x3f11c000 + .long 0x3f118000 + .long 0x3f112000 + .long 0x3f10e000 + .long 0x3f108000 + .long 0x3f104000 + .long 0x3f0fe000 + .long 0x3f0f8000 + .long 0x3f0f4000 + .long 0x3f0ee000 + .long 0x3f0ea000 + .long 0x3f0e6000 + .long 0x3f0e0000 + .long 0x3f0dc000 + .long 0x3f0d6000 + .long 0x3f0d2000 + .long 0x3f0cc000 + .long 0x3f0c8000 + .long 0x3f0c2000 + .long 0x3f0be000 + .long 0x3f0ba000 + .long 0x3f0b4000 + .long 0x3f0b0000 + .long 0x3f0ac000 + .long 0x3f0a6000 + .long 0x3f0a2000 + .long 0x3f09e000 + .long 0x3f098000 + .long 0x3f094000 + .long 0x3f090000 + .long 0x3f08a000 + .long 0x3f086000 + .long 0x3f082000 + .long 0x3f07e000 + .long 0x3f078000 + .long 0x3f074000 + .long 0x3f070000 + .long 0x3f06c000 + .long 0x3f066000 + .long 0x3f062000 + .long 0x3f05e000 + .long 0x3f05a000 + .long 0x3f056000 + .long 0x3f052000 + .long 0x3f04c000 + .long 0x3f048000 + .long 0x3f044000 + .long 0x3f040000 + .long 0x3f03c000 + .long 0x3f038000 + .long 0x3f034000 + .long 0x3f030000 + .long 0x3f02a000 + .long 0x3f026000 + .long 0x3f022000 + .long 0x3f01e000 + .long 0x3f01a000 + .long 0x3f016000 + .long 0x3f012000 + .long 0x3f00e000 + .long 0x3f00a000 + .long 0x3f006000 + .long 0x3f002000 + .type __libm_rcp_table_256,@object + .size __libm_rcp_table_256,1024 + .align 32 + .globl __libm_double_rcp_table_256 +__libm_double_rcp_table_256: + .long 0 + .long 1072689152 + .long 0 + .long 1072680960 + .long 0 + .long 1072672768 + .long 0 + .long 1072664576 + .long 0 + .long 1072657408 + .long 0 + .long 1072649216 + .long 0 + .long 1072641024 + .long 0 + .long 1072633856 + .long 0 + .long 1072625664 + .long 0 + .long 1072618496 + .long 0 + .long 1072610304 + .long 0 + .long 1072603136 + .long 0 + .long 1072595968 + .long 0 + .long 1072587776 + .long 0 + .long 1072580608 + .long 0 + .long 1072573440 + .long 0 + .long 1072566272 + .long 0 + .long 1072559104 + .long 0 + .long 1072551936 + .long 0 + .long 1072544768 + .long 0 + .long 1072537600 + .long 0 + .long 1072530432 + .long 0 + .long 1072524288 + .long 0 + .long 1072517120 + .long 0 + .long 1072509952 + .long 0 + .long 1072502784 + .long 0 + .long 1072496640 + .long 0 + .long 1072489472 + .long 0 + .long 1072483328 + .long 0 + .long 1072476160 + .long 0 + .long 1072470016 + .long 0 + .long 1072463872 + .long 0 + .long 1072456704 + .long 0 + .long 1072450560 + .long 0 + .long 1072444416 + .long 0 + .long 1072438272 + .long 0 + .long 1072431104 + .long 0 + .long 1072424960 + .long 0 + .long 1072418816 + .long 0 + .long 1072412672 + .long 0 + .long 1072406528 + .long 0 + .long 1072400384 + .long 0 + .long 1072394240 + .long 0 + .long 1072389120 + .long 0 + .long 1072382976 + .long 0 + .long 1072376832 + .long 0 + .long 1072370688 + .long 0 + .long 1072364544 + .long 0 + .long 1072359424 + .long 0 + .long 1072353280 + .long 0 + .long 1072348160 + .long 0 + .long 1072342016 + .long 0 + .long 1072335872 + .long 0 + .long 1072330752 + .long 0 + .long 1072325632 + .long 0 + .long 1072319488 + .long 0 + .long 1072314368 + .long 0 + .long 1072308224 + .long 0 + .long 1072303104 + .long 0 + .long 1072297984 + .long 0 + .long 1072292864 + .long 0 + .long 1072286720 + .long 0 + .long 1072281600 + .long 0 + .long 1072276480 + .long 0 + .long 1072271360 + .long 0 + .long 1072266240 + .long 0 + .long 1072261120 + .long 0 + .long 1072256000 + .long 0 + .long 1072250880 + .long 0 + .long 1072245760 + .long 0 + .long 1072240640 + .long 0 + .long 1072235520 + .long 0 + .long 1072230400 + .long 0 + .long 1072225280 + .long 0 + .long 1072220160 + .long 0 + .long 1072216064 + .long 0 + .long 1072210944 + .long 0 + .long 1072205824 + .long 0 + .long 1072200704 + .long 0 + .long 1072196608 + .long 0 + .long 1072191488 + .long 0 + .long 1072186368 + .long 0 + .long 1072182272 + .long 0 + .long 1072177152 + .long 0 + .long 1072173056 + .long 0 + .long 1072167936 + .long 0 + .long 1072163840 + .long 0 + .long 1072158720 + .long 0 + .long 1072154624 + .long 0 + .long 1072149504 + .long 0 + .long 1072145408 + .long 0 + .long 1072141312 + .long 0 + .long 1072136192 + .long 0 + .long 1072132096 + .long 0 + .long 1072128000 + .long 0 + .long 1072123904 + .long 0 + .long 1072118784 + .long 0 + .long 1072114688 + .long 0 + .long 1072110592 + .long 0 + .long 1072106496 + .long 0 + .long 1072102400 + .long 0 + .long 1072098304 + .long 0 + .long 1072093184 + .long 0 + .long 1072089088 + .long 0 + .long 1072084992 + .long 0 + .long 1072080896 + .long 0 + .long 1072076800 + .long 0 + .long 1072072704 + .long 0 + .long 1072068608 + .long 0 + .long 1072064512 + .long 0 + .long 1072061440 + .long 0 + .long 1072057344 + .long 0 + .long 1072053248 + .long 0 + .long 1072049152 + .long 0 + .long 1072045056 + .long 0 + .long 1072040960 + .long 0 + .long 1072036864 + .long 0 + .long 1072033792 + .long 0 + .long 1072029696 + .long 0 + .long 1072025600 + .long 0 + .long 1072022528 + .long 0 + .long 1072018432 + .long 0 + .long 1072014336 + .long 0 + .long 1072011264 + .long 0 + .long 1072007168 + .long 0 + .long 1072003072 + .long 0 + .long 1072000000 + .long 0 + .long 1071995904 + .long 0 + .long 1071992832 + .long 0 + .long 1071988736 + .long 0 + .long 1071985664 + .long 0 + .long 1071981568 + .long 0 + .long 1071978496 + .long 0 + .long 1071974400 + .long 0 + .long 1071971328 + .long 0 + .long 1071967232 + .long 0 + .long 1071964160 + .long 0 + .long 1071960064 + .long 0 + .long 1071956992 + .long 0 + .long 1071953920 + .long 0 + .long 1071949824 + .long 0 + .long 1071946752 + .long 0 + .long 1071943680 + .long 0 + .long 1071939584 + .long 0 + .long 1071936512 + .long 0 + .long 1071933440 + .long 0 + .long 1071930368 + .long 0 + .long 1071926272 + .long 0 + .long 1071923200 + .long 0 + .long 1071920128 + .long 0 + .long 1071917056 + .long 0 + .long 1071913984 + .long 0 + .long 1071909888 + .long 0 + .long 1071906816 + .long 0 + .long 1071903744 + .long 0 + .long 1071900672 + .long 0 + .long 1071897600 + .long 0 + .long 1071894528 + .long 0 + .long 1071891456 + .long 0 + .long 1071888384 + .long 0 + .long 1071885312 + .long 0 + .long 1071882240 + .long 0 + .long 1071879168 + .long 0 + .long 1071876096 + .long 0 + .long 1071873024 + .long 0 + .long 1071869952 + .long 0 + .long 1071866880 + .long 0 + .long 1071863808 + .long 0 + .long 1071860736 + .long 0 + .long 1071857664 + .long 0 + .long 1071854592 + .long 0 + .long 1071851520 + .long 0 + .long 1071849472 + .long 0 + .long 1071846400 + .long 0 + .long 1071843328 + .long 0 + .long 1071840256 + .long 0 + .long 1071837184 + .long 0 + .long 1071834112 + .long 0 + .long 1071832064 + .long 0 + .long 1071828992 + .long 0 + .long 1071825920 + .long 0 + .long 1071822848 + .long 0 + .long 1071820800 + .long 0 + .long 1071817728 + .long 0 + .long 1071814656 + .long 0 + .long 1071812608 + .long 0 + .long 1071809536 + .long 0 + .long 1071806464 + .long 0 + .long 1071804416 + .long 0 + .long 1071801344 + .long 0 + .long 1071798272 + .long 0 + .long 1071796224 + .long 0 + .long 1071793152 + .long 0 + .long 1071790080 + .long 0 + .long 1071788032 + .long 0 + .long 1071784960 + .long 0 + .long 1071782912 + .long 0 + .long 1071779840 + .long 0 + .long 1071777792 + .long 0 + .long 1071774720 + .long 0 + .long 1071771648 + .long 0 + .long 1071769600 + .long 0 + .long 1071766528 + .long 0 + .long 1071764480 + .long 0 + .long 1071762432 + .long 0 + .long 1071759360 + .long 0 + .long 1071757312 + .long 0 + .long 1071754240 + .long 0 + .long 1071752192 + .long 0 + .long 1071749120 + .long 0 + .long 1071747072 + .long 0 + .long 1071744000 + .long 0 + .long 1071741952 + .long 0 + .long 1071739904 + .long 0 + .long 1071736832 + .long 0 + .long 1071734784 + .long 0 + .long 1071732736 + .long 0 + .long 1071729664 + .long 0 + .long 1071727616 + .long 0 + .long 1071725568 + .long 0 + .long 1071722496 + .long 0 + .long 1071720448 + .long 0 + .long 1071718400 + .long 0 + .long 1071715328 + .long 0 + .long 1071713280 + .long 0 + .long 1071711232 + .long 0 + .long 1071709184 + .long 0 + .long 1071706112 + .long 0 + .long 1071704064 + .long 0 + .long 1071702016 + .long 0 + .long 1071699968 + .long 0 + .long 1071696896 + .long 0 + .long 1071694848 + .long 0 + .long 1071692800 + .long 0 + .long 1071690752 + .long 0 + .long 1071688704 + .long 0 + .long 1071686656 + .long 0 + .long 1071683584 + .long 0 + .long 1071681536 + .long 0 + .long 1071679488 + .long 0 + .long 1071677440 + .long 0 + .long 1071675392 + .long 0 + .long 1071673344 + .long 0 + .long 1071671296 + .long 0 + .long 1071669248 + .long 0 + .long 1071666176 + .long 0 + .long 1071664128 + .long 0 + .long 1071662080 + .long 0 + .long 1071660032 + .long 0 + .long 1071657984 + .long 0 + .long 1071655936 + .long 0 + .long 1071653888 + .long 0 + .long 1071651840 + .long 0 + .long 1071649792 + .long 0 + .long 1071647744 + .long 0 + .long 1071645696 + .type __libm_double_rcp_table_256,@object + .size __libm_double_rcp_table_256,2048 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/remainder_gen.S b/external/sgx_libm/intel64/remainder_gen.S new file mode 100644 index 0000000000..b76afc36f3 --- /dev/null +++ b/external/sgx_libm/intel64/remainder_gen.S @@ -0,0 +1,311 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remainder_gen.c" + .text +..TXTST0: +# -- Begin remainder + .text + .align 16,0x90 + .globl remainder +remainder: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_remainder.1: +..L2: + + movq $0x7fffffffffffffff, %rdi + movd %xmm0, %r9 + movq $0x7ff0000000000000, %rax + movd %xmm1, %rdx + movsd %xmm0, -32(%rsp) + movsd %xmm1, -40(%rsp) + andq %r9, %rdi + btrq $63, %rdx + movq $0x7ff0000000000000, %rcx + andq %rdi, %rax + andq %rdx, %rcx + xorb %r8b, %r8b + shrq $52, %rax + shrq $52, %rcx + addl $-1023, %eax + movq %rdi, -16(%rsp) + addl $-1023, %ecx + movq %rdx, -8(%rsp) + sarq $63, %r9 + movq $0, -24(%rsp) + cmpl $1024, %eax + movsd -16(%rsp), %xmm2 + movsd -8(%rsp), %xmm0 + je ..B1.5 +..B1.2: + cmpl $1024, %ecx + je ..B1.5 +..B1.3: + testq %rdi, %rdi + je ..B1.5 +..B1.4: + testq %rdx, %rdx + jne ..B1.6 +..B1.5: + movb $1, %r8b +..B1.6: + movq $0xfffffffffffff, %rsi + andq %rsi, %rdi + andq %rsi, %rdx + testb %r8b, %r8b + je ..B1.17 +..B1.7: + testq %rdi, %rdi + je ..B1.9 +..B1.8: + cmpl $1024, %eax + je ..B1.43 +..B1.9: + testq %rdx, %rdx + je ..B1.11 +..B1.10: + cmpl $1024, %ecx + je ..B1.44 +..B1.11: + movsd -24(%rsp), %xmm1 + ucomisd %xmm1, %xmm0 + jp ..B1.12 + je ..B1.45 +..B1.12: + movsd -24(%rsp), %xmm0 + ucomisd %xmm0, %xmm2 + jp ..B1.13 + je ..B1.15 +..B1.13: + testq %rdi, %rdi + jne ..B1.15 +..B1.14: + cmpl $1024, %eax + je ..B1.45 +..B1.15: + movsd -32(%rsp), %xmm0 +..B1.16: + ret +..B1.17: + comisd %xmm2, %xmm0 + jb ..B1.23 +..B1.18: + ucomisd %xmm0, %xmm2 + jp ..B1.19 + je ..B1.57 +..B1.19: + cmpl $1023, %eax + je ..B1.21 +..B1.20: + movaps %xmm2, %xmm1 + addsd %xmm2, %xmm1 + comisd %xmm1, %xmm0 + jae ..B1.22 +..B1.21: + testl %r9d, %r9d + subsd %xmm0, %xmm2 + movaps %xmm2, %xmm0 + xorps .L_2il0floatpacket.1(%rip), %xmm0 + jne ..L3 + movaps %xmm2, %xmm0 +..L3: + ret +..B1.22: + movsd -32(%rsp), %xmm0 + ret +..B1.23: + cmpl $-1023, %eax + je ..B1.53 +..B1.24: + movq $0x10000000000000, %r8 + orq %r8, %rdi +..B1.25: + cmpl $-1023, %ecx + je ..B1.49 +..B1.26: + movq $0x10000000000000, %r8 + orq %r8, %rdx +..B1.27: + subl %ecx, %eax + xorl %r8d, %r8d + xorl %r11d, %r11d + incl %eax + je ..B1.31 +..B1.28: + movl $1, %r10d +..B1.29: + movq %rdi, %r8 + incl %r11d + subq %rdx, %r8 + cmpq %rdx, %rdi + cmovae %r8, %rdi + movl $0, %r8d + cmovae %r10, %r8 + addq %rdi, %rdi + cmpl %eax, %r11d + jb ..B1.29 +..B1.31: + testq %rdi, %rdi + je ..B1.58 +..B1.32: + shrq $1, %rdi + cmpq %rsi, %rdi + ja ..B1.36 +..B1.34: + addq %rdi, %rdi + decl %ecx + cmpq %rsi, %rdi + jbe ..B1.34 +..B1.36: + cmpl $-1022, %ecx + jl ..B1.38 +..B1.37: + movslq %ecx, %rcx + andq %rdi, %rsi + addq $1023, %rcx + jmp ..B1.39 +..B1.38: + negl %ecx + movq %rdi, %rsi + addl $2, %ecx + shrq %cl, %rsi + xorl %ecx, %ecx +..B1.39: + shlq $52, %rcx + orq %rsi, %rcx + movq %rcx, -40(%rsp) + movsd -40(%rsp), %xmm2 + movaps %xmm2, %xmm1 + addsd %xmm2, %xmm1 + comisd %xmm0, %xmm1 + jb ..B1.42 +..B1.40: + ucomisd %xmm1, %xmm0 + jp ..B1.41 + je ..B1.48 +..B1.41: + subsd %xmm0, %xmm2 +..B1.42: + movaps %xmm2, %xmm0 + testl %r9d, %r9d + xorps .L_2il0floatpacket.1(%rip), %xmm0 + jne ..L4 + movaps %xmm2, %xmm0 +..L4: + ret +..B1.43: + movsd -32(%rsp), %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + ret +..B1.44: + movsd -40(%rsp), %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + ret +..B1.45: + movsd -24(%rsp), %xmm0 + movsd -24(%rsp), %xmm1 + divsd %xmm1, %xmm0 + ret +..B1.48: + movaps %xmm2, %xmm0 + testq %r8, %r8 + xorps .L_2il0floatpacket.1(%rip), %xmm0 + je ..B1.42 + movaps %xmm0, %xmm2 + jmp ..B1.42 +..B1.49: + testq %rdx, %rdx + je ..B1.26 +..B1.50: + movl $-1022, %ecx +..B1.51: + addq %rdx, %rdx + decl %ecx + cmpq %rsi, %rdx + jbe ..B1.51 + jmp ..B1.27 +..B1.53: + testq %rdi, %rdi + je ..B1.24 +..B1.54: + movl $-1022, %eax +..B1.55: + addq %rdi, %rdi + decl %eax + cmpq %rsi, %rdi + jbe ..B1.55 + jmp ..B1.25 +..B1.57: + movsd -24(%rsp), %xmm0 + mulsd -32(%rsp), %xmm0 + ret +..B1.58: + movsd -24(%rsp), %xmm0 + mulsd -32(%rsp), %xmm0 + movq %rdi, -40(%rsp) + ret + .align 16,0x90 + .cfi_endproc + .type remainder,@function + .size remainder,.-remainder + .data +# -- End remainder + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x33333333,0x3ffb3333 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End + + .globl drem + .equ drem, remainder + diff --git a/external/sgx_libm/intel64/remainderf_gen.S b/external/sgx_libm/intel64/remainderf_gen.S new file mode 100644 index 0000000000..48bf94945f --- /dev/null +++ b/external/sgx_libm/intel64/remainderf_gen.S @@ -0,0 +1,78 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remainderf_gen.c" + .text +..TXTST0: +# -- Begin remainderf + .text + .align 16,0x90 + .globl remainderf +remainderf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_remainderf.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + cvtss2sd %xmm0, %xmm0 + cvtss2sd %xmm1, %xmm1 + call remainder@PLT +..B1.4: + cvtsd2ss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type remainderf,@function + .size remainderf,.-remainderf + .data +# -- End remainderf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End + + .globl dremf + .equ dremf, remainderf + diff --git a/external/sgx_libm/intel64/remainderl.S b/external/sgx_libm/intel64/remainderl.S new file mode 100644 index 0000000000..8174b7d7a2 --- /dev/null +++ b/external/sgx_libm/intel64/remainderl.S @@ -0,0 +1,313 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remainderl.c" + .text +..TXTST0: +# -- Begin remainderl + .text + .align 16,0x90 + .globl remainderl +remainderl: +# parameter 1: 80 + %rsp +# parameter 2: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_remainderl.1: +..L2: + + subq $72, %rsp + .cfi_def_cfa_offset 80 + xorb %dl, %dl + fldt 80(%rsp) + fstpt 32(%rsp) + fldt 96(%rsp) + fstpt 48(%rsp) +..B1.2: + fnstcw 66(%rsp) +..B1.3: + movzwl 104(%rsp), %ecx + andl $32767, %ecx + jne ..B1.6 +..B1.4: + cmpl $0, 100(%rsp) + jne ..B1.6 +..B1.5: + cmpl $0, 96(%rsp) + je ..B1.42 +..B1.6: + movzwl 88(%rsp), %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.40 +..B1.7: + cmpl $32767, %ecx + je ..B1.17 +..B1.8: + movzwl 66(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.9: + orl $-64768, %ecx + movw %cx, 64(%rsp) +..B1.10: + fldcw 64(%rsp) +..B1.11: + movb $1, %dl +..B1.12: + fldt 48(%rsp) + fldt 32(%rsp) + movq $1024, %rcx +.L_2TAG_PACKET_0.0.2: + fprem1 + fstsw %ax + andq %rcx, %rax + cmpq $1024, %rax + je .L_2TAG_PACKET_0.0.2 + fstp %st(1) + fstpt 16(%rsp) +..B1.13: + testb %dl, %dl + je ..B1.15 +..B1.14: + fldcw 66(%rsp) +..B1.15: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.17: + movq $0x8000000000000000, %rax + cmpq 96(%rsp), %rax + je ..B1.25 +..B1.18: + movzwl 66(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.24 +..B1.19: + orl $-64768, %edx + movw %dx, 64(%rsp) +..B1.20: + fldcw 64(%rsp) +..B1.21: + fldt 80(%rsp) + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.22: + fldcw 66(%rsp) +..B1.23: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.24: + fldt 80(%rsp) + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.23 +..B1.25: + cmpl $32767, %esi + je ..B1.31 +..B1.26: + testl %esi, %esi + jne ..B1.30 +..B1.27: + cmpl $0, 84(%rsp) + jne ..B1.29 +..B1.28: + cmpl $0, 80(%rsp) + je ..B1.30 +..B1.29: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 8(%rsp) +..B1.30: + fldt 80(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.31: + cmpl $-2147483648, 84(%rsp) + jne ..B1.30 +..B1.32: + cmpl $0, 80(%rsp) + jne ..B1.30 +..B1.33: + movzwl 66(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.34: + orl $-64768, %ecx + movw %cx, 64(%rsp) +..B1.35: + fldcw 64(%rsp) +..B1.36: + movb $1, %dl +..B1.37: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) + je ..B1.39 +..B1.38: + fldcw 66(%rsp) +..B1.39: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.40: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + jne ..B1.18 +..B1.41: + cmpl $32767, %ecx + je ..B1.17 + jmp ..B1.25 +..B1.42: + movzwl 66(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.46 +..B1.43: + orl $-64768, %ecx + movw %cx, 64(%rsp) +..B1.44: + fldcw 64(%rsp) +..B1.45: + movb $1, %dl +..B1.46: + movzwl 88(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.51 +..B1.47: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) +..B1.48: + testb %dl, %dl + je ..B1.50 +..B1.49: + fldcw 66(%rsp) +..B1.50: + fldt 16(%rsp) + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.51: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + je ..B1.47 +..B1.52: + fldt 80(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) + jmp ..B1.48 + .align 16,0x90 + .cfi_endproc + .type remainderl,@function + .size remainderl,.-remainderl + .data +# -- End remainderl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End + + .globl dreml + .equ dreml, remainderl + diff --git a/external/sgx_libm/intel64/remquo.S b/external/sgx_libm/intel64/remquo.S new file mode 100644 index 0000000000..dfb79d1776 --- /dev/null +++ b/external/sgx_libm/intel64/remquo.S @@ -0,0 +1,411 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remquo.c" + .text +..TXTST0: +# -- Begin remquo + .text + .align 16,0x90 + .globl remquo +remquo: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +# parameter 3: %rdi +..B1.1: + .cfi_startproc +..___tag_value_remquo.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + movq $0x7fffffffffffffff, %r8 + movd %xmm0, %rdx + movq $0x7fffffffffffffff, %rsi + movd %xmm1, %r9 + movsd %xmm0, -32(%rsp) + movsd %xmm1, -40(%rsp) + andq %rdx, %r8 + andq %r9, %rsi + sarq $63, %rdx + movq $0x7ff0000000000000, %rcx + sarq $63, %r9 + andq %rsi, %rcx + movl $-1, %eax + movl $1, %ebx + cmpl %edx, %r9d + movq $0x7ff0000000000000, %r9 + movq %r8, -16(%rsp) + movq %rsi, -8(%rsp) + cmovne %eax, %ebx + xorb %bpl, %bpl + andq %r8, %r9 + shrq $52, %r9 + shrq $52, %rcx + addl $-1023, %r9d + addl $-1023, %ecx + movq $0, -24(%rsp) + cmpl $1024, %r9d + movsd -16(%rsp), %xmm2 + movsd -8(%rsp), %xmm0 + je ..B1.5 +..B1.2: + cmpl $1024, %ecx + je ..B1.5 +..B1.3: + testq %r8, %r8 + je ..B1.5 +..B1.4: + testq %rsi, %rsi + jne ..B1.6 +..B1.5: + movb $1, %bpl +..B1.6: + movq $0xfffffffffffff, %r11 + movq %r8, %rax + movq %rsi, %r10 + andq %r11, %rax + andq %r11, %r10 + testb %bpl, %bpl + je ..B1.18 +..B1.7: + movl $0, (%rdi) + testq %rax, %rax + je ..B1.9 +..B1.8: + cmpl $1024, %r9d + je ..B1.47 +..B1.9: + testq %r10, %r10 + je ..B1.11 +..B1.10: + cmpl $1024, %ecx + je ..B1.48 +..B1.11: + testq %rsi, %rsi + je ..B1.49 +..B1.12: + testq %r8, %r8 + je ..B1.16 +..B1.14: + testq %rax, %rax + jne ..B1.16 +..B1.15: + cmpl $1024, %r9d + je ..B1.49 +..B1.16: + movsd -32(%rsp), %xmm0 +..B1.17: + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.18: + comisd %xmm2, %xmm0 + jb ..B1.25 +..B1.19: + ucomisd %xmm0, %xmm2 + jp ..B1.20 + je ..B1.62 +..B1.20: + cmpl $1023, %r9d + je ..B1.22 +..B1.21: + movaps %xmm2, %xmm1 + addsd %xmm2, %xmm1 + comisd %xmm1, %xmm0 + jae ..B1.24 +..B1.22: + movl %ebx, (%rdi) +..B1.23: + testl %edx, %edx + subsd %xmm0, %xmm2 + movaps %xmm2, %xmm0 + xorps .L_2il0floatpacket.1(%rip), %xmm0 + jne ..L14 + movaps %xmm2, %xmm0 +..L14: + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.24: + movl $0, (%rdi) + movsd -32(%rsp), %xmm0 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.25: + cmpl $-1023, %r9d + je ..B1.58 +..B1.26: + movq $0x10000000000000, %rbp + orq %rbp, %rax +..B1.27: + cmpl $-1023, %ecx + je ..B1.54 +..B1.28: + movq $0x10000000000000, %rbp + orq %rbp, %r10 +..B1.29: + subl %ecx, %r9d + xorl %ebp, %ebp + xorl %esi, %esi + incl %r9d + je ..B1.35 +..B1.31: + addl %ebp, %ebp + cmpq %r10, %rax + jb ..B1.33 +..B1.32: + subq %r10, %rax + incl %ebp +..B1.33: + incl %esi + addq %rax, %rax + cmpl %r9d, %esi + jb ..B1.31 +..B1.35: + testq %rax, %rax + je ..B1.63 +..B1.36: + shrq $1, %rax + movq $0xfffffffffffff, %rsi + cmpq %rsi, %rax + ja ..B1.40 +..B1.38: + addq %rax, %rax + decl %ecx + cmpq %rsi, %rax + jbe ..B1.38 +..B1.40: + cmpl $-1022, %ecx + jl ..B1.42 +..B1.41: + movslq %ecx, %rcx + movq $0xfffffffffffff, %rsi + andq %rax, %rsi + addq $1023, %rcx + jmp ..B1.43 +..B1.42: + negl %ecx + movq %rax, %rsi + addl $2, %ecx + shrq %cl, %rsi + xorl %ecx, %ecx +..B1.43: + shlq $52, %rcx + orq %rsi, %rcx + movq %rcx, -40(%rsp) + movsd -40(%rsp), %xmm2 + movaps %xmm2, %xmm1 + addsd %xmm2, %xmm1 + comisd %xmm0, %xmm1 + jb ..B1.46 +..B1.44: + ucomisd %xmm1, %xmm0 + jp ..B1.45 + je ..B1.52 +..B1.45: + incl %ebp + subsd %xmm0, %xmm2 +..B1.46: + andl $2147483647, %ebp + movaps %xmm2, %xmm0 + imull %ebp, %ebx + testl %edx, %edx + xorps .L_2il0floatpacket.1(%rip), %xmm0 + movl %ebx, (%rdi) + jne ..L29 + movaps %xmm2, %xmm0 +..L29: + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.47: + movsd -32(%rsp), %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.48: + movsd -40(%rsp), %xmm0 + mulsd .L_2il0floatpacket.0(%rip), %xmm0 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.49: + movsd -24(%rsp), %xmm0 + movsd -24(%rsp), %xmm1 + divsd %xmm1, %xmm0 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.52: + testl $1, %ebp + je ..B1.46 +..B1.53: + xorps .L_2il0floatpacket.1(%rip), %xmm2 + incl %ebp + jmp ..B1.46 +..B1.54: + testq %r10, %r10 + je ..B1.28 +..B1.55: + movl $-1022, %ecx + movq $0xfffffffffffff, %rbp +..B1.56: + addq %r10, %r10 + decl %ecx + cmpq %rbp, %r10 + jbe ..B1.56 + jmp ..B1.29 +..B1.58: + testq %rax, %rax + je ..B1.26 +..B1.59: + movl $-1022, %r9d + movq $0xfffffffffffff, %rbp +..B1.60: + addq %rax, %rax + decl %r9d + cmpq %rbp, %rax + jbe ..B1.60 + jmp ..B1.27 +..B1.62: + movl %ebx, (%rdi) + movsd -24(%rsp), %xmm0 + mulsd -32(%rsp), %xmm0 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 24 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.63: + andl $2147483647, %ebp + imull %ebp, %ebx + movl %ebx, (%rdi) + movsd -24(%rsp), %xmm0 + mulsd -32(%rsp), %xmm0 + movq %rax, -40(%rsp) + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type remquo,@function + .size remquo,.-remquo + .data +# -- End remquo + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x33333333,0x3ffb3333 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/remquof.S b/external/sgx_libm/intel64/remquof.S new file mode 100644 index 0000000000..a4866f0b2d --- /dev/null +++ b/external/sgx_libm/intel64/remquof.S @@ -0,0 +1,75 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remquof.c" + .text +..TXTST0: +# -- Begin remquof + .text + .align 16,0x90 + .globl remquof +remquof: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +# parameter 3: %rdi +..B1.1: + .cfi_startproc +..___tag_value_remquof.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 + cvtss2sd %xmm0, %xmm0 + cvtss2sd %xmm1, %xmm1 + call remquo@PLT +..B1.2: + cvtsd2ss %xmm0, %xmm0 + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type remquof,@function + .size remquof,.-remquof + .data +# -- End remquof + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/remquol.S b/external/sgx_libm/intel64/remquol.S new file mode 100644 index 0000000000..0b15bd3228 --- /dev/null +++ b/external/sgx_libm/intel64/remquol.S @@ -0,0 +1,1244 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "remquol.c" + .text +..TXTST0: +# -- Begin remquol + .text + .align 16,0x90 + .globl remquol +remquol: +# parameter 1: 80 + %rsp +# parameter 2: 96 + %rsp +# parameter 3: %rdi +..B1.1: + .cfi_startproc +..___tag_value_remquol.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %rbx + .cfi_def_cfa_offset 32 + .cfi_offset 3, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + subq $40, %rsp + .cfi_def_cfa_offset 80 + movq %rdi, %r13 + xorb %r12b, %r12b +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 104(%rsp), %edx + movl $0, (%r13) + andl $32767, %edx + jne ..B1.6 +..B1.4: + cmpl $0, 100(%rsp) + jne ..B1.6 +..B1.5: + cmpl $0, 96(%rsp) + je ..B1.50 +..B1.6: + movzwl 88(%rsp), %ecx + andl $32767, %ecx + cmpl $32767, %ecx + je ..B1.48 +..B1.7: + cmpl $32767, %edx + je ..B1.25 +..B1.8: + movzwl 34(%rsp), %edx + movl %edx, %eax + movb 89(%rsp), %bpl + andl $3840, %eax + movb 105(%rsp), %bl + andb $-128, %bpl + andb $-128, %bl + shrb $7, %bpl + shrb $7, %bl + cmpl $768, %eax + je ..B1.12 +..B1.9: + andl $-3841, %edx + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.10: + fldcw 32(%rsp) +..B1.11: + movb $1, %r12b +..B1.12: + addq $-32, %rsp + .cfi_def_cfa_offset 112 + movq %r13, %rdi + fldt 112(%rsp) + fstpt (%rsp) + fldt 128(%rsp) + fstpt 16(%rsp) +..___tag_value_remquol.13: + call __libm_remquol@PLT +..___tag_value_remquol.14: +..B1.63: + addq $32, %rsp + .cfi_def_cfa_offset 80 +..B1.13: + fstpt 16(%rsp) + testb %r12b, %r12b + je ..B1.15 +..B1.14: + fldcw 34(%rsp) +..B1.15: + movl (%r13), %esi + testl %esi, %esi + je ..B1.19 +..B1.16: + movzbl %bl, %edx + lea iones(%rip), %rax + movl (%rax,%rdx,4), %ecx + imull %ecx, %esi + cmpb %bpl, %bl + je ..B1.18 +..B1.17: + orl $-2147483648, %esi + movl %esi, (%r13) + jmp ..B1.19 +..B1.18: + andl $2147483647, %esi + movl %esi, (%r13) +..B1.19: + movzwl 24(%rsp), %eax + testl $32767, %eax + jne ..B1.24 +..B1.20: + cmpq $0, 16(%rsp) + jne ..B1.22 +..B1.21: + movzbl %bpl, %edx + lea _zeros(%rip), %rax + fldl (%rax,%rdx,8) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.22: + fldt 16(%rsp) + lea _small_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 8(%rsp) +..B1.23: + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.24: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.25: + movq $0x8000000000000000, %rax + cmpq 96(%rsp), %rax + je ..B1.33 +..B1.26: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.32 +..B1.27: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.28: + fldcw 32(%rsp) +..B1.29: + fldt 80(%rsp) + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.30: + fldcw 34(%rsp) +..B1.31: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.32: + fldt 80(%rsp) + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.31 +..B1.33: + cmpl $32767, %ecx + je ..B1.39 +..B1.34: + testl %ecx, %ecx + jne ..B1.38 +..B1.35: + cmpl $0, 84(%rsp) + jne ..B1.37 +..B1.36: + cmpl $0, 80(%rsp) + je ..B1.38 +..B1.37: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 8(%rsp) +..B1.38: + fldt 80(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.39: + cmpl $-2147483648, 84(%rsp) + jne ..B1.38 +..B1.40: + cmpl $0, 80(%rsp) + jne ..B1.38 +..B1.41: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.42: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.43: + fldcw 32(%rsp) +..B1.44: + movb $1, %r12b +..B1.45: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + testb %r12b, %r12b + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) + je ..B1.47 +..B1.46: + fldcw 34(%rsp) +..B1.47: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.48: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + jne ..B1.26 +..B1.49: + cmpl $32767, %edx + je ..B1.25 + jmp ..B1.33 +..B1.50: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.54 +..B1.51: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.52: + fldcw 32(%rsp) +..B1.53: + movb $1, %r12b +..B1.54: + movzwl 88(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.59 +..B1.55: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) +..B1.56: + testb %r12b, %r12b + je ..B1.58 +..B1.57: + fldcw 34(%rsp) +..B1.58: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 40 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 32 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -32 + .cfi_offset 6, -40 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.59: + movq $0x8000000000000000, %rax + cmpq 80(%rsp), %rax + je ..B1.55 +..B1.60: + fldt 80(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) + jmp ..B1.56 + .align 16,0x90 + .cfi_endproc + .type remquol,@function + .size remquol,.-remquol + .data +# -- End remquol + .text +# -- Begin __libm_remquol + .text + .align 16,0x90 + .globl __libm_remquol +__libm_remquol: +# parameter 1: 208 + %rsp +# parameter 2: 224 + %rsp +# parameter 3: %rdi +..B2.1: + .cfi_startproc +..___tag_value___libm_remquol.115: +..L116: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $152, %rsp + .cfi_def_cfa_offset 208 + lea _ones(%rip), %rax + fldt 208(%rsp) + movq %rdi, %rbx + andb $127, 233(%rsp) + movzwl 216(%rsp), %r15d + andl $32767, %r15d + movzwl 232(%rsp), %r11d + andl $32767, %r11d + fstpt 112(%rsp) + fldt 112(%rsp) + cmpl $32703, %r15d + fldt 224(%rsp) + fstpt 128(%rsp) + fldt 128(%rsp) + fldl (%rax) + movl $0, 128(%rsp) + jl ..B2.8 +..B2.2: + fstp %st(0) + cmpl $32703, %r11d + jl ..B2.5 +..B2.3: + lea 8+_scales(%rip), %rax + movq %rbx, %rdi + fldl (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt 224(%rsp) + fldt 224(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 240 + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_remquol.131: + call __libm_remquol@PLT +..___tag_value___libm_remquol.132: +..B2.35: + addq $32, %rsp + .cfi_def_cfa_offset 208 +..B2.4: + lea _scales(%rip), %rax + fmull (%rax) + fstpt 112(%rsp) + fldt 112(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.5: + lea 8+_scales(%rip), %rax + addq $-32, %rsp + .cfi_def_cfa_offset 240 + movq %rbx, %rdi + fldl (%rax) + fmulp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_remquol.155: + call __libm_remquol@PLT +..___tag_value___libm_remquol.156: +..B2.6: + lea _scales(%rip), %rax + movq %rbx, %rdi + fldl (%rax) + fmulp %st, %st(1) + fstpt (%rsp) + fldt 256(%rsp) + fstpt 16(%rsp) +..___tag_value___libm_remquol.157: + call __libm_remquol@PLT +..___tag_value___libm_remquol.158: +..B2.37: + addq $32, %rsp + .cfi_def_cfa_offset 208 +..B2.7: + fstpt 112(%rsp) + fldt 112(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.8: + cmpl $64, %r11d + jge ..B2.12 +..B2.9: + fstp %st(0) + lea _scales(%rip), %rax + movq %rbx, %rdi + fldl (%rax) + fmul %st, %st(1) + fxch %st(1) + fstpt 224(%rsp) + fldt 224(%rsp) + fxch %st(1) + fstpt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 240 + fxch %st(1) + fstpt (%rsp) + fstpt 16(%rsp) +..___tag_value___libm_remquol.181: + call __libm_remquol@PLT +..___tag_value___libm_remquol.182: +..B2.38: + addq $32, %rsp + .cfi_def_cfa_offset 208 +..B2.10: + fldt (%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 240 + fmulp %st, %st(1) + movq %rbx, %rdi + fstpt (%rsp) + fldt 256(%rsp) + fstpt 16(%rsp) +..___tag_value___libm_remquol.185: + call __libm_remquol@PLT +..___tag_value___libm_remquol.186: +..B2.39: + addq $32, %rsp + .cfi_def_cfa_offset 208 +..B2.11: + lea 8+_scales(%rip), %rax + fmull (%rax) + fstpt 112(%rsp) + fldt 112(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.12: + lea 1(%r15), %eax + cmpl %eax, %r11d + jg ..B2.31 +..B2.13: + lea -32(%r15), %eax + cmpl %eax, %r11d + jle ..B2.22 +..B2.14: + fstp %st(0) + fldt 128(%rsp) + fld %st(2) + fdiv %st(2), %st + lea _TWO_63H(%rip), %rax + fld %st(2) + lea _halfs(%rip), %rdx + fsub %st(2), %st + fldl (%rax) + fld %st(0) + fadd %st(3), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fmul %st, %st(3) + movl 16(%rsp), %eax + fxch %st(3) + fsubrp %st, %st(5) + fmul %st(2), %st + fsubrp %st, %st(4) + fld %st(1) + fsubr %st(1), %st + fabs + fldl (%rdx) + fucomi %st(1), %st + fxch %st(1) + fstp %st(0) + jp ..B2.15 + je ..B2.16 +..B2.15: + fstp %st(3) + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl %eax, (%rbx) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.16: + fmul %st(3), %st + fld %st(4) + fabs + fcomip %st(1), %st + fstp %st(0) + jp ..B2.17 + jbe ..B2.21 +..B2.17: + fcomip %st(1), %st + fstp %st(0) + ja ..B2.19 + jp ..B2.19 +..B2.18: + decl %eax + faddp %st, %st(1) + movl %eax, (%rbx) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.19: + incl %eax + fsubrp %st, %st(1) + movl %eax, (%rbx) +..B2.20: + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.21: + fstp %st(2) + fstp %st(0) + fstp %st(0) + movl %eax, (%rbx) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.22: + fldt 128(%rsp) + subl %r11d, %r15d + fstpt 32(%rsp) + fldt 32(%rsp) + fld %st(1) + fdiv %st(3), %st + fld %st(3) + fsubp %st, %st(2) + xorl %r10d, %r10d + addl $-31, %r15d + movl %r15d, %ecx + jle ..B2.32 +..B2.23: + lea _TWO_63H(%rip), %rdi + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 16(%rsp) + fldt 16(%rsp) + fxch %st(2) + fstpt 96(%rsp) + fldl (%rdi) + movzwl 8(%rsp), %eax + movzwl 88(%rsp), %r8d + andl $32767, %eax + movzwl 24(%rsp), %esi + movl 20(%rsp), %ebp + movzwl 104(%rsp), %edx + movzwl 136(%rsp), %r12d + movl 132(%rsp), %r13d + movzwl 72(%rsp), %r14d + movl 4(%rsp), %r9d + movq %rbx, 48(%rsp) + xorl %ebx, %ebx +..B2.24: + movl %esi, %edi + andl $-32768, %r8d + subl %r15d, %edi + andl $-32768, %edx + andl $32767, %edi + andl $-32768, %r14d + orl %edi, %r8d + lea (%r12,%r15), %edi + movw %r8w, 88(%rsp) + andl $32767, %edi + movl %ebp, 84(%rsp) + orl %edi, %edx + fldt 80(%rsp) + movl $1, %edi + testl %eax, %eax + fmul %st(5), %st + cmove %eax, %edi + subl %r15d, %ecx + imull %r15d, %edi + fadd %st(1), %st + fstpt 16(%rsp) + fldt 16(%rsp) + addl %eax, %edi + movw %dx, 104(%rsp) + andl $32767, %edi + movl %r13d, 100(%rsp) + orl %edi, %r14d + movw %r14w, 72(%rsp) + fsub %st(1), %st + fldt 96(%rsp) + fmul %st(1), %st + movl %r9d, 68(%rsp) + fsubrp %st, %st(6) + fldt 64(%rsp) + fmulp %st, %st(1) + shll %cl, %r10d + cmpl $32, %ecx + movl %r15d, %ecx + fsubrp %st, %st(5) + fxch %st(4) + fstpt 112(%rsp) + fldt 112(%rsp) + cmovae %ebx, %r10d + movzwl 120(%rsp), %edi + andl $32767, %edi + subl %r11d, %edi + movl %edi, %r15d + addl 16(%rsp), %r10d + addl $-31, %r15d + fxch %st(4) + jg ..B2.24 +..B2.25: + movq 48(%rsp), %rbx +..B2.26: + fldt 32(%rsp) + fld %st(1) + fxch %st(4) + fmul %st(6), %st + lea _halfs(%rip), %rdx + shll %cl, %r10d + xorl %eax, %eax + cmpl $32, %ecx + fadd %st, %st(4) + fxch %st(4) + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(3) + cmovb %r10d, %eax + fxch %st(1) + fsub %st(3), %st + fmul %st, %st(2) + addl 16(%rsp), %eax + fxch %st(2) + fsubrp %st, %st(7) + fmul %st(1), %st + fsubrp %st, %st(6) + fld %st(5) + fabs + fldl (%rdx) + fmul %st(6), %st + fstpt (%rsp) + fldt (%rsp) + fcomip %st(1), %st + ja ..B2.30 +..B2.27: + fldt (%rsp) + fcomip %st(1), %st + fstp %st(0) + jae ..B2.29 + jp ..B2.29 +..B2.28: + fstp %st(2) + fstp %st(0) + fxch %st(1) + fcomip %st(1), %st + fstp %st(0) + fld %st(1) + movl %eax, (%rbx) + fsub %st(1), %st + fxch %st(1) + faddp %st, %st(2) + fcmovb %st(1), %st + fstp %st(1) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.29: + fstp %st(0) + fstp %st(2) + fldt 32(%rsp) + fxch %st(3) + fdivr %st(4), %st + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + addl 16(%rsp), %eax + fxch %st(2) + fsubrp %st, %st(3) + fmulp %st, %st(1) + movl %eax, (%rbx) + fsubrp %st, %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.30: + fstp %st(5) + fstp %st(4) + fstp %st(3) + fstp %st(1) + fstp %st(0) + fstp %st(0) + movl %eax, (%rbx) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.31: + fstp %st(1) + fstp %st(0) + movl $0, (%rbx) + addq $152, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 208 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B2.32: + fstp %st(2) + lea _TWO_63H(%rip), %rax + fldl (%rax) + jmp ..B2.26 + .align 16,0x90 + .cfi_endproc + .type __libm_remquol,@function + .size __libm_remquol,.-__libm_remquol + .data +# -- End __libm_remquol + .section .rodata, "a" + .align 4 + .align 4 +iones: + .long 1 + .long -1 + .type iones,@object + .size iones,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_scales: + .long 0 + .long 1341128704 + .long 0 + .long 804257792 + .type _scales,@object + .size _scales,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_halfs: + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .type _halfs,@object + .size _halfs,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/rint_gen.S b/external/sgx_libm/intel64/rint_gen.S new file mode 100644 index 0000000000..71ee463b45 --- /dev/null +++ b/external/sgx_libm/intel64/rint_gen.S @@ -0,0 +1,89 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rint_gen.c" + .text +..TXTST0: +# -- Begin rint + .text + .align 16,0x90 + .globl rint +rint: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_rint.1: +..L2: + +..B1.2: + xorpd %xmm1, %xmm1 + ucomisd p2to52(%rip), %xmm0 + jae .L_2TAG_PACKET_0.0.1 + ucomisd m2to52(%rip), %xmm0 + jbe .L_2TAG_PACKET_0.0.1 + ucomisd %xmm1, %xmm0 + je .L_2TAG_PACKET_0.0.1 + cvtsd2si %xmm0, %rax + cvtsi2sdq %rax, %xmm0 +.L_2TAG_PACKET_0.0.1: + ret +..B1.3: + .align 16,0x90 + .cfi_endproc + .type rint,@function + .size rint,.-rint + .data +# -- End rint + .section .rodata, "a" + .align 16 + .align 16 +p2to52: + .long 0x00000000,0x43300000 + .type p2to52,@object + .size p2to52,8 + .space 8, 0x00 # pad + .align 16 +m2to52: + .long 0x00000000,0xc3300000 + .type m2to52,@object + .size m2to52,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/rintf_gen.S b/external/sgx_libm/intel64/rintf_gen.S new file mode 100644 index 0000000000..caef1e7adb --- /dev/null +++ b/external/sgx_libm/intel64/rintf_gen.S @@ -0,0 +1,89 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rintf_gen.c" + .text +..TXTST0: +# -- Begin rintf + .text + .align 16,0x90 + .globl rintf +rintf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_rintf.1: +..L2: + +..B1.2: + xorps %xmm1, %xmm1 + ucomiss p2to23(%rip), %xmm0 + jae .L_2TAG_PACKET_0.0.1 + ucomiss m2to23(%rip), %xmm0 + jbe .L_2TAG_PACKET_0.0.1 + ucomiss %xmm1, %xmm0 + je .L_2TAG_PACKET_0.0.1 + cvtss2si %xmm0, %eax + cvtsi2ss %eax, %xmm0 +.L_2TAG_PACKET_0.0.1: + ret +..B1.3: + .align 16,0x90 + .cfi_endproc + .type rintf,@function + .size rintf,.-rintf + .data +# -- End rintf + .section .rodata, "a" + .align 16 + .align 16 +p2to23: + .long 0x4b000000 + .type p2to23,@object + .size p2to23,4 + .space 12, 0x00 # pad + .align 16 +m2to23: + .long 0xcb000000 + .type m2to23,@object + .size m2to23,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/rintl.S b/external/sgx_libm/intel64/rintl.S new file mode 100644 index 0000000000..0c1537593b --- /dev/null +++ b/external/sgx_libm/intel64/rintl.S @@ -0,0 +1,163 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "rintl.c" + .text +..TXTST0: +# -- Begin rintl + .text + .align 16,0x90 + .globl rintl +rintl: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_rintl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + xorb %cl, %cl +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movb 41(%rsp), %dl + movzwl 40(%rsp), %eax + andb $-128, %dl + andl $32767, %eax + shrb $7, %dl + movzwl 18(%rsp), %esi + cmpl $16446, %eax + jge ..B1.13 +..B1.4: + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.8 +..B1.5: + orl $-64768, %esi + movw %si, 16(%rsp) +..B1.6: + fldcw 16(%rsp) +..B1.7: + movb $1, %cl +..B1.8: + fldt 32(%rsp) + lea _TWO_63(%rip), %rax + movzbl %dl, %edx + testb %cl, %cl + fldl (%rax,%rdx,8) + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 32(%rsp) + je ..B1.10 +..B1.9: + fldcw 18(%rsp) +..B1.10: + fldt 32(%rsp) + lea _zeros(%rip), %rax + fldl (%rax) + fucomip %st(1), %st + jp ..B1.12 + je ..B1.19 +..B1.12: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.13: + movl %esi, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.20 +..B1.14: + orl $-64768, %esi + movw %si, 16(%rsp) +..B1.15: + fldcw 16(%rsp) +..B1.16: + fldt 32(%rsp) + fstpt (%rsp) +..B1.17: + fldcw 18(%rsp) +..B1.18: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.19: + fstp %st(0) + fldl (%rax,%rdx,8) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.20: + fldt 32(%rsp) + fstpt (%rsp) + jmp ..B1.18 + .align 16,0x90 + .cfi_endproc + .type rintl,@function + .size rintl,.-rintl + .data +# -- End rintl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63: + .long 0 + .long 1138753536 + .long 0 + .long 3286237184 + .type _TWO_63,@object + .size _TWO_63,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/round_gen.S b/external/sgx_libm/intel64/round_gen.S new file mode 100644 index 0000000000..3aec83c446 --- /dev/null +++ b/external/sgx_libm/intel64/round_gen.S @@ -0,0 +1,181 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "round_gen.c" + .text +..TXTST0: +# -- Begin round + .text + .align 16,0x90 + .globl round +round: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_round.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, (%rsp) +..B1.2: + movapd bns(%rip), %xmm2 + movapd %xmm0, %xmm3 + movapd %xmm0, %xmm1 + psrlq $52, %xmm0 + movd %xmm0, %eax + andpd s(%rip), %xmm0 + psubd %xmm0, %xmm2 + psrlq %xmm2, %xmm1 + psllq %xmm2, %xmm1 + testl $2048, %eax + jne .L_2TAG_PACKET_0.0.1 + cmpl $1023, %eax + jl .L_2TAG_PACKET_1.0.1 + cmpl $1074, %eax + jg .L_2TAG_PACKET_2.0.1 + subsd %xmm1, %xmm3 + movq %xmm1, %xmm0 + cmppd $5, p_half(%rip), %xmm3 + andpd p_one(%rip), %xmm3 + addsd %xmm3, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + cmpl $1022, %eax + jl .L_2TAG_PACKET_3.0.1 + movq p_one(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_3.0.1: + pxor %xmm0, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_2.0.1: + movq (%rsp), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + cmpl $3071, %eax + jl .L_2TAG_PACKET_4.0.1 + cmpl $3122, %eax + jg .L_2TAG_PACKET_2.0.1 + subsd %xmm1, %xmm3 + movq %xmm1, %xmm0 + cmppd $2, n_half(%rip), %xmm3 + andpd n_one(%rip), %xmm3 + addsd %xmm3, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_4.0.1: + cmpl $3070, %eax + jl .L_2TAG_PACKET_5.0.1 + movq n_one(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_5.0.1: + movq 8+zeros(%rip), %xmm0 + movq %xmm0, 8(%rsp) +.L_2TAG_PACKET_6.0.1: +..B1.4: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type round,@function + .size round,.-round + .data +# -- End round + .section .rodata, "a" + .align 16 + .align 16 +bns: + .long 1075 + .long 0 + .long 1075 + .long 0 + .type bns,@object + .size bns,16 + .align 16 +s: + .long 2047 + .long 0 + .long 0 + .long 0 + .type s,@object + .size s,16 + .align 16 +p_half: + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .type p_half,@object + .size p_half,16 + .align 16 +p_one: + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .type p_one,@object + .size p_one,16 + .align 16 +n_half: + .long 0 + .long 3219128320 + .long 0 + .long 1127219200 + .type n_half,@object + .size n_half,16 + .align 16 +n_one: + .long 0 + .long 3220176896 + .long 0 + .long 1127219200 + .type n_one,@object + .size n_one,16 + .align 16 +zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type zeros,@object + .size zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/roundf_gen.S b/external/sgx_libm/intel64/roundf_gen.S new file mode 100644 index 0000000000..8bd688ee02 --- /dev/null +++ b/external/sgx_libm/intel64/roundf_gen.S @@ -0,0 +1,118 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "roundf_gen.c" + .text +..TXTST0: +# -- Begin roundf + .text + .align 16,0x90 + .globl roundf +roundf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_roundf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movss %xmm0, 8(%rsp) +..B1.2: + movl 8(%rsp), %eax + testl %eax, %eax + jl .L_2TAG_PACKET_0.0.1 + cmpl $1056964608, %eax + jl .L_2TAG_PACKET_1.0.1 + cmpl $1258291200, %eax + jge .L_2TAG_PACKET_2.0.1 + cmpl $1065353216, %eax + je .L_2TAG_PACKET_2.0.1 + addss half(%rip), %xmm0 + cvttss2si %xmm0, %eax + cvtsi2ss %eax, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + pxor %xmm0, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_2.0.1: + movss 8(%rsp), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_3.0.1: + movss nzero(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + andl $2147483647, %eax + cmpl $1056964608, %eax + jl .L_2TAG_PACKET_3.0.1 + cmpl $1258291200, %eax + jge .L_2TAG_PACKET_2.0.1 + cmpl $1065353216, %eax + je .L_2TAG_PACKET_2.0.1 + subss half(%rip), %xmm0 + cvttss2si %xmm0, %eax + cvtsi2ss %eax, %xmm0 + movss %xmm0, (%rsp) +.L_2TAG_PACKET_4.0.1: +..B1.4: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type roundf,@function + .size roundf,.-roundf + .data +# -- End roundf + .section .rodata, "a" + .align 4 + .align 4 +half: + .long 1056964608 + .type half,@object + .size half,4 + .align 4 +nzero: + .long 2147483648 + .type nzero,@object + .size nzero,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/roundl.S b/external/sgx_libm/intel64/roundl.S new file mode 100644 index 0000000000..75046e8fa0 --- /dev/null +++ b/external/sgx_libm/intel64/roundl.S @@ -0,0 +1,245 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "roundl.c" + .text +..TXTST0: +# -- Begin roundl + .text + .align 16,0x90 + .globl roundl +roundl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_roundl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %al, %al +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 56(%rsp), %edi + andl $32767, %edi + cmpl $16446, %edi + jge ..B1.25 +..B1.4: + cmpl $16383, %edi + jl ..B1.19 +..B1.5: + cmpl $16414, %edi + jge ..B1.7 +..B1.6: + movl 52(%rsp), %edx + lea 2(%rdi), %ecx + negl %edi + movl %edx, %esi + addl $30, %edi + shll %cl, %esi + movl %edi, %ecx + shrl %cl, %edx + movl %edi, %ecx + shll %cl, %edx + movl %edx, 52(%rsp) + movl $0, 48(%rsp) + jmp ..B1.10 +..B1.7: + jle ..B1.9 +..B1.8: + movl 48(%rsp), %edx + lea 2(%rdi), %ecx + negl %edi + movl %edx, %esi + addl $30, %edi + shll %cl, %esi + movl %edi, %ecx + shrl %cl, %edx + movl %edi, %ecx + shll %cl, %edx + movl %edx, 48(%rsp) + jmp ..B1.10 +..B1.9: + movl 48(%rsp), %esi + movl $0, 48(%rsp) +..B1.10: + testl %esi, %esi + jge ..B1.18 +..B1.11: + movzwl 26(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.15 +..B1.12: + orl $-64768, %ecx + movw %cx, 24(%rsp) +..B1.13: + fldcw 24(%rsp) +..B1.14: + movb $1, %al +..B1.15: + fldt 48(%rsp) + lea _ones(%rip), %rcx + movb 57(%rsp), %dl + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %esi + testb %al, %al + faddl (%rcx,%rsi,8) + fstpt (%rsp) + je ..B1.17 +..B1.16: + fldcw 26(%rsp) +..B1.17: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.18: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.19: + cmpl $16382, %edi + je ..B1.32 +..B1.20: + testl %edi, %edi + jne ..B1.24 +..B1.21: + cmpl $0, 52(%rsp) + jne ..B1.23 +..B1.22: + cmpl $0, 48(%rsp) + je ..B1.24 +..B1.23: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, 16(%rsp) +..B1.24: + movb 57(%rsp), %al + lea _zeros(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.25: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.31 +..B1.26: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.27: + fldcw 24(%rsp) +..B1.28: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.29: + fldcw 26(%rsp) +..B1.30: + fldt (%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.31: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt (%rsp) + jmp ..B1.30 +..B1.32: + movb 57(%rsp), %al + lea _ones(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type roundl,@function + .size roundl,.-roundl + .data +# -- End roundl + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalb_gen.S b/external/sgx_libm/intel64/scalb_gen.S new file mode 100644 index 0000000000..9d63d2832e --- /dev/null +++ b/external/sgx_libm/intel64/scalb_gen.S @@ -0,0 +1,369 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalb_gen.c" + .text +..TXTST0: +# -- Begin scalb + .text + .align 16,0x90 + .globl scalb +scalb: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_scalb.1: +..L2: + + movaps %xmm1, %xmm2 + movsd %xmm0, -16(%rsp) + movzwl -10(%rsp), %eax + movl %eax, %edx + movsd %xmm2, -8(%rsp) + andl $32752, %edx + movzwl -2(%rsp), %ecx + andl $32752, %ecx + shrl $4, %edx + shrl $4, %ecx + cmpl $2047, %edx + je ..B1.56 +..B1.2: + cmpl $2047, %ecx + je ..B1.37 +..B1.3: + cmpl $1023, %ecx + jl ..B1.20 +..B1.4: + cmpl $1044, %ecx + jge ..B1.7 +..B1.5: + lea _TWO_52H(%rip), %rcx + pxor %xmm1, %xmm1 + movsd (%rcx), %xmm0 + addsd %xmm2, %xmm0 + movsd %xmm0, -24(%rsp) + movl -24(%rsp), %edi + cvtsi2sd %edi, %xmm1 + ucomisd %xmm2, %xmm1 + jp ..B1.6 + je ..B1.10 +..B1.6: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + ret +..B1.7: + movb -1(%rsp), %sil + lea large_integers(%rip), %rdi + andb $-128, %sil + shrb $7, %sil + movzbl %sil, %r8d + cmpl $1075, %ecx + movl (%rdi,%r8,4), %edi + jge ..B1.10 +..B1.8: + addl $13, %ecx + movl -8(%rsp), %esi + shll %cl, %esi + testl %esi, %esi + jne ..B1.6 +..B1.10: + testl %edx, %edx + jne ..B1.15 +..B1.11: + testl $1048575, -12(%rsp) + jne ..B1.14 +..B1.12: + cmpl $0, -16(%rsp) + jne ..B1.14 +..B1.13: + movsd -16(%rsp), %xmm0 + ret +..B1.14: + lea _TWO_55(%rip), %rax + movsd -16(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -16(%rsp) + movzwl -10(%rsp), %eax + movl %eax, %edx + andl $32752, %edx + shrl $4, %edx + addl $-55, %edx +..B1.15: + movl $65536, %ecx + cmpl $65536, %edi + cmovg %ecx, %edi + movl $-65536, %esi + cmpl $-65536, %edi + cmovge %edi, %esi + lea (%rdx,%rsi), %ecx + testl %ecx, %ecx + jle ..B1.33 +..B1.16: + cmpl $2047, %ecx + jl ..B1.18 +..B1.17: + movb -9(%rsp), %al + lea _large_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.18: + andl $2047, %ecx + andl $-32753, %eax + shll $4, %ecx + orl %ecx, %eax + movw %ax, -10(%rsp) + movsd -16(%rsp), %xmm0 +..B1.19: + ret +..B1.20: + testl %ecx, %ecx + jne ..B1.24 +..B1.21: + testl $1048575, -4(%rsp) + jne ..B1.24 +..B1.22: + cmpl $0, -8(%rsp) + jne ..B1.24 +..B1.23: + lea _ones(%rip), %rax + movsd -16(%rsp), %xmm0 + mulsd (%rax), %xmm0 + ret +..B1.24: + cmpl $2047, %edx + jne ..B1.6 +..B1.25: + testl %ecx, %ecx + jle ..B1.6 +..B1.26: + cmpl $1, %ecx + jne ..B1.30 +..B1.27: + movl -4(%rsp), %eax + andl $1048575, %eax +..B1.28: + jne ..B1.30 +..B1.29: + cmpl $0, -8(%rsp) + jbe ..B1.6 +..B1.30: + movb -9(%rsp), %al + lea _infs(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movsd (%rdx,%rcx,8), %xmm0 + ret +..B1.33: + cmpl $-52, %ecx + jge ..B1.35 +..B1.34: + movb -9(%rsp), %al + lea _small_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.35: + andl $-32753, %eax + lea 55(%rdx,%rsi), %edx + andl $2047, %edx + shll $4, %edx + orl %edx, %eax + movw %ax, -10(%rsp) + lea 8+_TWO_55(%rip), %rax + movsd -16(%rsp), %xmm0 + mulsd (%rax), %xmm0 +..B1.36: + ret +..B1.37: + testl $1048575, -4(%rsp) + jne ..B1.51 +..B1.38: + cmpl $0, -8(%rsp) + jne ..B1.51 +..B1.39: + testl %edx, %edx + jne ..B1.46 +..B1.40: + testl $1048575, -12(%rsp) + jne ..B1.47 +..B1.41: + cmpl $0, -16(%rsp) + jne ..B1.47 +..B1.42: + testb $-128, -1(%rsp) + je ..B1.44 +..B1.43: + movsd -16(%rsp), %xmm0 + ret +..B1.44: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 +..B1.45: + ret +..B1.46: + cmpl $2047, %edx + je ..B1.52 +..B1.47: + movb -9(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + testb $-128, -1(%rsp) + je ..B1.49 +..B1.48: + lea _zeros(%rip), %rax + movsd (%rax,%rdx,8), %xmm0 + ret +..B1.49: + lea _infs(%rip), %rax + movsd (%rax,%rdx,8), %xmm0 +..B1.50: + ret +..B1.51: + movsd -16(%rsp), %xmm0 + addsd -8(%rsp), %xmm0 + ret +..B1.52: + testb $-128, -1(%rsp) + jne ..B1.54 +..B1.53: + movsd -16(%rsp), %xmm0 + ret +..B1.54: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 +..B1.55: + ret +..B1.56: + testl $1048575, -12(%rsp) + jne ..B1.51 +..B1.57: + cmpl $0, -16(%rsp) + jne ..B1.51 +..B1.58: + cmpl $2047, %ecx + je ..B1.37 + jmp ..B1.20 + .align 16,0x90 + .cfi_endproc + .type scalb,@function + .size scalb,.-scalb + .data +# -- End scalb + .section .rodata, "a" + .align 4 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +large_integers: + .long 65536 + .long -65536 + .type large_integers,@object + .size large_integers,8 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .type _TWO_55,@object + .size _TWO_55,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalbf.S b/external/sgx_libm/intel64/scalbf.S new file mode 100644 index 0000000000..a8e79cb12b --- /dev/null +++ b/external/sgx_libm/intel64/scalbf.S @@ -0,0 +1,321 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbf.c" + .text +..TXTST0: +# -- Begin scalbf + .text + .align 16,0x90 + .globl scalbf +scalbf: +# parameter 1: %xmm0 +# parameter 2: %xmm1 +..B1.1: + .cfi_startproc +..___tag_value_scalbf.1: +..L2: + + movss %xmm0, -16(%rsp) + movzwl -14(%rsp), %esi + movl %esi, %edx + movss %xmm1, -24(%rsp) + andl $32640, %edx + movzwl -22(%rsp), %r8d + andl $32640, %r8d + shrl $7, %edx + shrl $7, %r8d + cmpl $255, %edx + je ..B1.48 +..B1.2: + cmpl $255, %r8d + je ..B1.31 +..B1.3: + cmpl $127, %r8d + jl ..B1.16 +..B1.4: + cmpl $150, %r8d + jge ..B1.7 +..B1.5: + movd %xmm1, %edi + movl %r8d, %ecx + andl $8388607, %edi + negl %ecx + movl %edi, %eax + addl $22, %ecx + orl $8388608, %eax + addl $10, %r8d + shrl %cl, %eax + movl %r8d, %ecx + shll %cl, %edi + testl %edi, %edi + je ..B1.8 +..B1.6: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 + ret +..B1.7: + movl $65536, %eax +..B1.8: + testl %edx, %edx + jne ..B1.11 +..B1.9: + testl $8388607, -16(%rsp) + je ..B1.15 +..B1.10: + movss -16(%rsp), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + movss %xmm0, -16(%rsp) + movzwl -14(%rsp), %esi + movl %esi, %edx + andl $32640, %edx + shrl $7, %edx + addl $-25, %edx +..B1.11: + movl $65536, %ecx + cmpl $65536, %eax + movzbl -21(%rsp), %edi + cmovg %ecx, %eax + movl %eax, %r8d + negl %r8d + testl $128, %edi + cmovne %r8d, %eax + lea (%rdx,%rax), %ecx + testl %ecx, %ecx + jle ..B1.27 +..B1.12: + cmpl $255, %ecx + jge ..B1.26 +..B1.13: + movzbl %cl, %ecx + andl $-32641, %esi + shll $7, %ecx + orl %ecx, %esi + movw %si, -14(%rsp) + movss -16(%rsp), %xmm0 +..B1.14: + ret +..B1.15: + movss -16(%rsp), %xmm0 + ret +..B1.16: + testl %r8d, %r8d + jne ..B1.19 +..B1.17: + testl $8388607, -24(%rsp) + je ..B1.15 +..B1.19: + cmpl $255, %edx + jne ..B1.6 +..B1.20: + testl %r8d, %r8d + jle ..B1.6 +..B1.21: + cmpl $1, %r8d + jne ..B1.23 +..B1.22: + testl $8388607, -24(%rsp) + jle ..B1.6 +..B1.23: + movb -13(%rsp), %al + lea _infs(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + ret +..B1.26: + movb -13(%rsp), %al + lea _large_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.2(%rip), %xmm0 + movss %xmm0, -24(%rsp) + ret +..B1.27: + cmpl $-23, %ecx + jge ..B1.29 +..B1.28: + movb -13(%rsp), %al + lea _small_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.3(%rip), %xmm0 + jmp ..B1.30 +..B1.29: + movl -16(%rsp), %ecx + lea 25(%rdx,%rax), %eax + movl %ecx, -24(%rsp) + shrl $16, %ecx + movzbl %al, %eax + andl $-32641, %ecx + shll $7, %eax + orl %eax, %ecx + movw %cx, -22(%rsp) + movss -24(%rsp), %xmm0 + mulss .L_2il0floatpacket.4(%rip), %xmm0 +..B1.30: + movss %xmm0, -24(%rsp) + ret +..B1.31: + testl $8388607, -24(%rsp) + jne ..B1.43 +..B1.32: + testl %edx, %edx + jne ..B1.38 +..B1.33: + testl $8388607, -16(%rsp) + jne ..B1.39 +..B1.34: + testb $-128, -21(%rsp) + je ..B1.36 +..B1.35: + movss -16(%rsp), %xmm0 + ret +..B1.36: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 +..B1.37: + ret +..B1.38: + cmpl $255, %edx + je ..B1.44 +..B1.39: + movb -13(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + testb $-128, -21(%rsp) + je ..B1.41 +..B1.40: + lea _zeros(%rip), %rax + movss (%rax,%rdx,4), %xmm0 + ret +..B1.41: + lea _infs(%rip), %rax + movss (%rax,%rdx,4), %xmm0 +..B1.42: + ret +..B1.43: + movss -16(%rsp), %xmm0 + addss -24(%rsp), %xmm0 + ret +..B1.44: + testb $-128, -21(%rsp) + jne ..B1.46 +..B1.45: + movss -16(%rsp), %xmm0 + ret +..B1.46: + pxor %xmm0, %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 +..B1.47: + ret +..B1.48: + testl $8388607, -16(%rsp) + jne ..B1.43 +..B1.49: + cmpl $255, %r8d + je ..B1.31 + jmp ..B1.16 + .align 16,0x90 + .cfi_endproc + .type scalbf,@function + .size scalbf,.-scalbf + .data +# -- End scalbf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x7f800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x4c000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x71800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x0d800000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0x33000000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +_infs: + .long 2139095040 + .long 4286578688 + .type _infs,@object + .size _infs,8 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalbl.S b/external/sgx_libm/intel64/scalbl.S new file mode 100644 index 0000000000..9fe1d5ab06 --- /dev/null +++ b/external/sgx_libm/intel64/scalbl.S @@ -0,0 +1,623 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbl.c" + .text +..TXTST0: +# -- Begin scalbl + .text + .align 16,0x90 + .globl scalbl +scalbl: +# parameter 1: 48 + %rsp +# parameter 2: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_scalbl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + xorb %dl, %dl +..B1.2: + fnstcw 34(%rsp) +..B1.3: + movzwl 56(%rsp), %eax + andl $32767, %eax + movzwl 72(%rsp), %ecx + andl $32767, %ecx + cmpl $32767, %eax + je ..B1.100 +..B1.4: + cmpl $32767, %ecx + je ..B1.69 +..B1.5: + cmpl $16383, %ecx + jl ..B1.32 +..B1.6: + movzwl 34(%rsp), %edi + movl %edi, %esi + andl $768, %esi + cmpl $768, %esi + je ..B1.10 +..B1.7: + orl $-64768, %edi + movw %di, 32(%rsp) +..B1.8: + fldcw 32(%rsp) +..B1.9: + movb $1, %dl +..B1.10: + cmpl $16414, %ecx + jge ..B1.15 +..B1.11: + fldt 64(%rsp) + lea _TWO_63H(%rip), %rcx + fldl (%rcx) + fadd %st(1), %st + fstpt 16(%rsp) + fildl 16(%rsp) + movl 16(%rsp), %edi + fucomip %st(1), %st + fstp %st(0) + jp ..B1.12 + je ..B1.20 +..B1.12: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + je ..B1.14 +..B1.13: + fldcw 34(%rsp) +..B1.14: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.15: + movb 73(%rsp), %sil + lea large_integers(%rip), %rdi + andb $-128, %sil + shrb $7, %sil + movzbl %sil, %r8d + cmpl $16446, %ecx + movl (%rdi,%r8,4), %edi + jge ..B1.20 +..B1.16: + addl $2, %ecx + movl 64(%rsp), %esi + shll %cl, %esi + testl %esi, %esi + je ..B1.20 +..B1.17: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + je ..B1.19 +..B1.18: + fldcw 34(%rsp) +..B1.19: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.20: + testl %eax, %eax + jne ..B1.26 +..B1.21: + cmpq $0, 48(%rsp) + jne ..B1.25 +..B1.22: + testb %dl, %dl + je ..B1.24 +..B1.23: + fldcw 34(%rsp) +..B1.24: + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.25: + fldt 48(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 48(%rsp) + movzwl 56(%rsp), %eax + andl $32767, %eax + addl $-75, %eax +..B1.26: + movl $65536, %ecx + cmpl $65536, %edi + cmovg %ecx, %edi + movl $-65536, %esi + cmpl $-65536, %edi + cmovge %edi, %esi + lea (%rax,%rsi), %ecx + testl %ecx, %ecx + jle ..B1.49 +..B1.27: + cmpl $32767, %ecx + jge ..B1.48 +..B1.28: + movzwl 56(%rsp), %eax + andl $32767, %ecx + andl $-32768, %eax + orl %ecx, %eax + movw %ax, 56(%rsp) + fldt 48(%rsp) +..B1.29: + fstpt 16(%rsp) + testb %dl, %dl + je ..B1.31 +..B1.30: + fldcw 34(%rsp) +..B1.31: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.32: + testl %ecx, %ecx + jne ..B1.40 +..B1.33: + cmpq $0, 64(%rsp) + jne ..B1.40 +..B1.34: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.55 +..B1.35: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.36: + fldcw 32(%rsp) +..B1.37: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) +..B1.38: + fldcw 34(%rsp) +..B1.39: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.40: + cmpl $32767, %eax + je ..B1.56 +..B1.41: + movzwl 34(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.42: + orl $-64768, %ecx + movw %cx, 32(%rsp) +..B1.43: + fldcw 32(%rsp) +..B1.44: + movb $1, %dl +..B1.45: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + je ..B1.47 +..B1.46: + fldcw 34(%rsp) +..B1.47: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.48: + movb 57(%rsp), %al + lea _large_value_80(%rip), %rsi + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %ecx + shlq $4, %rcx + fldt (%rsi,%rcx) + fmulp %st, %st(1) + jmp ..B1.29 +..B1.49: + cmpl $-63, %ecx + jge ..B1.51 +..B1.50: + movb 57(%rsp), %al + lea _small_value_80(%rip), %rsi + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %ecx + shlq $4, %rcx + fldt (%rsi,%rcx) + fmulp %st, %st(1) + jmp ..B1.52 +..B1.51: + fldt 48(%rsp) + lea 75(%rax,%rsi), %eax + movzwl 56(%rsp), %ecx + andl $32767, %eax + lea 8+_TWO_75(%rip), %rsi + andl $-32768, %ecx + fstpt 16(%rsp) + orl %eax, %ecx + movw %cx, 24(%rsp) + fldt 16(%rsp) + fmull (%rsi) +..B1.52: + fstpt 16(%rsp) + testb %dl, %dl + je ..B1.54 +..B1.53: + fldcw 34(%rsp) +..B1.54: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.55: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) + jmp ..B1.39 +..B1.56: + testl %ecx, %ecx + jle ..B1.61 +..B1.57: + cmpl $1, %ecx + jne ..B1.68 +..B1.58: + movl 68(%rsp), %eax + cmpl $-2147483648, %eax + jb ..B1.61 +..B1.59: + jne ..B1.68 +..B1.60: + cmpl $0, 64(%rsp) + ja ..B1.68 +..B1.61: + movzwl 34(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.65 +..B1.62: + orl $-64768, %ecx + movw %cx, 32(%rsp) +..B1.63: + fldcw 32(%rsp) +..B1.64: + movb $1, %dl +..B1.65: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + testb %dl, %dl + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + je ..B1.67 +..B1.66: + fldcw 34(%rsp) +..B1.67: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.68: + movb 57(%rsp), %al + lea _infs(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.69: + movq $0x8000000000000000, %rcx + cmpq 64(%rsp), %rcx + je ..B1.77 +..B1.70: + movzwl 34(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.76 +..B1.71: + orl $-64768, %edx + movw %dx, 32(%rsp) +..B1.72: + fldcw 32(%rsp) +..B1.73: + fldt 48(%rsp) + fldt 64(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) +..B1.74: + fldcw 34(%rsp) +..B1.75: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.76: + fldt 48(%rsp) + fldt 64(%rsp) + faddp %st, %st(1) + fstpt 16(%rsp) + jmp ..B1.75 +..B1.77: + movzwl 34(%rsp), %esi + movl %esi, %ecx + andl $768, %ecx + cmpl $768, %ecx + je ..B1.81 +..B1.78: + orl $-64768, %esi + movw %si, 32(%rsp) +..B1.79: + fldcw 32(%rsp) +..B1.80: + movb $1, %dl +..B1.81: + testl %eax, %eax + jne ..B1.89 +..B1.82: + cmpl $0, 52(%rsp) + jne ..B1.84 +..B1.83: + cmpl $0, 48(%rsp) + je ..B1.85 +..B1.84: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rcx + movq %rcx, (%rsp) +..B1.85: + cmpq $0, 48(%rsp) + jne ..B1.90 +..B1.86: + testb $-128, 73(%rsp) + je ..B1.88 +..B1.87: + fldt 48(%rsp) + fstpt 16(%rsp) + jmp ..B1.94 +..B1.88: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + jmp ..B1.94 +..B1.89: + cmpl $32767, %eax + je ..B1.97 +..B1.90: + movb 57(%rsp), %al + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + testb $-128, 73(%rsp) + je ..B1.92 +..B1.91: + lea _zeros(%rip), %rax + movsd (%rax,%rcx,8), %xmm0 + jmp ..B1.93 +..B1.92: + lea _infs(%rip), %rax + movsd (%rax,%rcx,8), %xmm0 +..B1.93: + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) +..B1.94: + testb %dl, %dl + je ..B1.96 +..B1.95: + fldcw 34(%rsp) +..B1.96: + fldt 16(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.97: + testb $-128, 73(%rsp) + jne ..B1.99 +..B1.98: + fldt 48(%rsp) + fstpt 16(%rsp) + jmp ..B1.94 +..B1.99: + lea _infs(%rip), %rax + lea _zeros(%rip), %rcx + movsd (%rax), %xmm0 + mulsd (%rcx), %xmm0 + movsd %xmm0, 8(%rsp) + fldl 8(%rsp) + fstpt 16(%rsp) + jmp ..B1.94 +..B1.100: + movq $0x8000000000000000, %rsi + cmpq 48(%rsp), %rsi + jne ..B1.70 +..B1.101: + cmpl $32767, %ecx + je ..B1.69 + jmp ..B1.32 + .align 16,0x90 + .cfi_endproc + .type scalbl,@function + .size scalbl,.-scalbl + .data +# -- End scalbl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +large_integers: + .long 65536 + .long -65536 + .type large_integers,@object + .size large_integers,8 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalbln_gen.S b/external/sgx_libm/intel64/scalbln_gen.S new file mode 100644 index 0000000000..54f08a639c --- /dev/null +++ b/external/sgx_libm/intel64/scalbln_gen.S @@ -0,0 +1,195 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbln_gen.c" + .text +..TXTST0: +# -- Begin scalbln + .text + .align 16,0x90 + .globl scalbln +scalbln: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_scalbln.1: +..L2: + + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %esi + movl %esi, %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + je ..B1.17 +..B1.2: + xorb %r8b, %r8b + testl %ecx, %ecx + jne ..B1.7 +..B1.3: + testl $1048575, -4(%rsp) + jne ..B1.6 +..B1.4: + cmpl $0, -8(%rsp) + jne ..B1.6 +..B1.5: + movsd -8(%rsp), %xmm0 + ret +..B1.6: + lea _TWO_55(%rip), %rax + movb $1, %r8b + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %esi + movl %esi, %ecx + andl $32752, %ecx + shrl $4, %ecx + addl $-55, %ecx +..B1.7: + movl $65536, %eax + cmpq $65536, %rdi + cmovg %rax, %rdi + movq $-65536, %rdx + cmpq $-65536, %rdi + movslq %ecx, %rcx + cmovl %rdx, %rdi + addq %rdi, %rcx + testl %ecx, %ecx + jle ..B1.12 +..B1.8: + cmpl $2047, %ecx + jge ..B1.11 +..B1.9: + andl $2047, %ecx + andl $-32753, %esi + shll $4, %ecx + orl %ecx, %esi + movw %si, -2(%rsp) + movsd -8(%rsp), %xmm0 +..B1.10: + ret +..B1.11: + movb -1(%rsp), %al + lea _large_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.12: + cmpl $-52, %ecx + jl ..B1.16 +..B1.13: + addl $55, %ecx + lea 8+_TWO_55(%rip), %rax + andl $2047, %ecx + andl $-32753, %esi + shll $4, %ecx + orl %ecx, %esi + movw %si, -2(%rsp) + testb %r8b, %r8b + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + je ..B1.15 +..B1.14: + testq %rdi, %rdi + jl ..B1.10 +..B1.15: + ret +..B1.16: + movb -1(%rsp), %al + lea _small_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.17: + lea _ones(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type scalbln,@function + .size scalbln,.-scalbln + .data +# -- End scalbln + .section .rodata, "a" + .align 4 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .type _TWO_55,@object + .size _TWO_55,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalblnf.S b/external/sgx_libm/intel64/scalblnf.S new file mode 100644 index 0000000000..917c6bf513 --- /dev/null +++ b/external/sgx_libm/intel64/scalblnf.S @@ -0,0 +1,186 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalblnf.c" + .text +..TXTST0: +# -- Begin scalblnf + .text + .align 16,0x90 + .globl scalblnf +scalblnf: +# parameter 1: %xmm0 +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_scalblnf.1: +..L2: + + movq %rdi, %r8 + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %eax + movl %eax, %esi + andl $32640, %esi + shrl $7, %esi + cmpl $255, %esi + je ..B1.9 +..B1.2: + xorb %dil, %dil + testl %esi, %esi + jne ..B1.5 +..B1.3: + testl $8388607, -8(%rsp) + je ..B1.9 +..B1.4: + movss -8(%rsp), %xmm0 + movb $1, %dil + mulss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %eax + movl %eax, %esi + andl $32640, %esi + shrl $7, %esi + addl $-25, %esi +..B1.5: + movl $65536, %edx + cmpq $65536, %r8 + cmovg %rdx, %r8 + movq $-65536, %rcx + cmpq $-65536, %r8 + movslq %esi, %rsi + cmovl %rcx, %r8 + addq %r8, %rsi + testl %esi, %esi + jle ..B1.11 +..B1.6: + cmpl $255, %esi + jge ..B1.10 +..B1.7: + movzbl %sil, %esi + andl $-32641, %eax + shll $7, %esi + orl %esi, %eax + movw %ax, -6(%rsp) + movss -8(%rsp), %xmm0 +..B1.8: + ret +..B1.9: + movss -8(%rsp), %xmm0 + ret +..B1.10: + movb -5(%rsp), %al + lea _large_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + ret +..B1.11: + cmpl $-23, %esi + jl ..B1.15 +..B1.12: + addl $25, %esi + andl $-32641, %eax + movzbl %sil, %esi + shll $7, %esi + orl %esi, %eax + movw %ax, -6(%rsp) + testb %dil, %dil + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.3(%rip), %xmm0 + je ..B1.14 +..B1.13: + testq %r8, %r8 + jl ..B1.8 +..B1.14: + ret +..B1.15: + movb -5(%rsp), %al + lea _small_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.2(%rip), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type scalblnf,@function + .size scalblnf,.-scalblnf + .data +# -- End scalblnf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x0d800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x33000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalblnl.S b/external/sgx_libm/intel64/scalblnl.S new file mode 100644 index 0000000000..f934b79dfa --- /dev/null +++ b/external/sgx_libm/intel64/scalblnl.S @@ -0,0 +1,322 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalblnl.c" + .text +..TXTST0: +# -- Begin scalblnl + .text + .align 16,0x90 + .globl scalblnl +scalblnl: +# parameter 1: 32 + %rsp +# parameter 2: %rdi +..B1.1: + .cfi_startproc +..___tag_value_scalblnl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 40(%rsp), %eax + movl %eax, %r9d + andq $32767, %r9 + cmpq $32767, %r9 + je ..B1.39 +..B1.4: + testq %r9, %r9 + jne ..B1.12 +..B1.5: + cmpq $0, 32(%rsp) + je ..B1.15 +..B1.6: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.7: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.8: + fldcw 16(%rsp) +..B1.9: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) +..B1.10: + fldcw 18(%rsp) +..B1.11: + movzwl 40(%rsp), %eax + movl %eax, %ecx + andl $32767, %ecx + movl %ecx, %r9d + addq $-75, %r9 +..B1.12: + movl $65536, %esi + cmpq $65536, %rdi + cmovg %rsi, %rdi + movq $-65536, %r8 + xorb %dl, %dl + cmpq $-65536, %rdi + cmovl %r8, %rdi + lea (%r9,%rdi), %rcx + testq %rcx, %rcx + jle ..B1.23 +..B1.13: + cmpq $32767, %rcx + jge ..B1.16 +..B1.14: + andl $-32768, %eax + andl $32767, %ecx + orl %ecx, %eax + movw %ax, 40(%rsp) + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.15: + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.16: + movzwl 18(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.20 +..B1.17: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.18: + fldcw 16(%rsp) +..B1.19: + movb $1, %dl +..B1.20: + movb 41(%rsp), %al + lea _large_value_80(%rip), %rsi + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %ecx + shlq $4, %rcx + testb %dl, %dl + fldt (%rsi,%rcx) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.22 +..B1.21: + fldcw 18(%rsp) +..B1.22: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.23: + cmpq $-63, %rcx + jl ..B1.31 +..B1.24: + andl $-32768, %eax + lea 75(%r9,%rdi), %rdx + andl $32767, %edx + orl %edx, %eax + movzwl 18(%rsp), %edx + movw %ax, 40(%rsp) + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.30 +..B1.25: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.26: + fldcw 16(%rsp) +..B1.27: + fldt 32(%rsp) + lea 8+_TWO_75(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.28: + fldcw 18(%rsp) +..B1.29: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.30: + fldt 32(%rsp) + lea 8+_TWO_75(%rip), %rax + fmull (%rax) + fstpt (%rsp) + jmp ..B1.29 +..B1.31: + movzwl 18(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.35 +..B1.32: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.33: + fldcw 16(%rsp) +..B1.34: + movb $1, %dl +..B1.35: + movb 41(%rsp), %al + lea _small_value_80(%rip), %rsi + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %ecx + shlq $4, %rcx + testb %dl, %dl + fldt (%rsi,%rcx) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.37 +..B1.36: + fldcw 18(%rsp) +..B1.37: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.38: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) + jmp ..B1.11 +..B1.39: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.40: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.41: + fldcw 16(%rsp) +..B1.42: + fldt 32(%rsp) + fstpt (%rsp) +..B1.43: + fldcw 18(%rsp) +..B1.44: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.45: + fldt 32(%rsp) + fstpt (%rsp) + jmp ..B1.44 + .align 16,0x90 + .cfi_endproc + .type scalblnl,@function + .size scalblnl,.-scalblnl + .data +# -- End scalblnl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalbn_gen.S b/external/sgx_libm/intel64/scalbn_gen.S new file mode 100644 index 0000000000..27322b85b0 --- /dev/null +++ b/external/sgx_libm/intel64/scalbn_gen.S @@ -0,0 +1,194 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbn_gen.c" + .text +..TXTST0: +# -- Begin scalbn + .text + .align 16,0x90 + .globl scalbn +scalbn: +# parameter 1: %xmm0 +# parameter 2: %edi +..B1.1: + .cfi_startproc +..___tag_value_scalbn.1: +..L2: + + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %esi + movl %esi, %ecx + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + je ..B1.17 +..B1.2: + xorb %r8b, %r8b + testl %ecx, %ecx + jne ..B1.7 +..B1.3: + testl $1048575, -4(%rsp) + jne ..B1.6 +..B1.4: + cmpl $0, -8(%rsp) + jne ..B1.6 +..B1.5: + movsd -8(%rsp), %xmm0 + ret +..B1.6: + lea _TWO_55(%rip), %rax + movb $1, %r8b + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) + movzwl -2(%rsp), %esi + movl %esi, %ecx + andl $32752, %ecx + shrl $4, %ecx + addl $-55, %ecx +..B1.7: + movl $65536, %eax + cmpl $65536, %edi + cmovg %eax, %edi + movl $-65536, %edx + cmpl $-65536, %edi + cmovle %edx, %edi + lea (%rcx,%rdi), %eax + testl %eax, %eax + jle ..B1.12 +..B1.8: + cmpl $2047, %eax + jge ..B1.11 +..B1.9: + andl $2047, %eax + andl $-32753, %esi + shll $4, %eax + orl %eax, %esi + movw %si, -2(%rsp) + movsd -8(%rsp), %xmm0 +..B1.10: + ret +..B1.11: + movb -1(%rsp), %al + lea _large_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.12: + cmpl $-52, %eax + jl ..B1.16 +..B1.13: + lea 8+_TWO_55(%rip), %rdx + lea 55(%rcx,%rdi), %eax + andl $2047, %eax + andl $-32753, %esi + shll $4, %eax + orl %eax, %esi + movw %si, -2(%rsp) + testb %r8b, %r8b + movsd -8(%rsp), %xmm0 + mulsd (%rdx), %xmm0 + je ..B1.15 +..B1.14: + testl %edi, %edi + jl ..B1.10 +..B1.15: + ret +..B1.16: + movb -1(%rsp), %al + lea _small_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + ret +..B1.17: + lea _ones(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type scalbn,@function + .size scalbn,.-scalbn + .data +# -- End scalbn + .section .rodata, "a" + .align 4 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .long 0 + .long 1015021568 + .type _TWO_55,@object + .size _TWO_55,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalbnf.S b/external/sgx_libm/intel64/scalbnf.S new file mode 100644 index 0000000000..23c5beb1a1 --- /dev/null +++ b/external/sgx_libm/intel64/scalbnf.S @@ -0,0 +1,185 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbnf.c" + .text +..TXTST0: +# -- Begin scalbnf + .text + .align 16,0x90 + .globl scalbnf +scalbnf: +# parameter 1: %xmm0 +# parameter 2: %edi +..B1.1: + .cfi_startproc +..___tag_value_scalbnf.1: +..L2: + + movl %edi, %r8d + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %eax + movl %eax, %esi + andl $32640, %esi + shrl $7, %esi + cmpl $255, %esi + je ..B1.9 +..B1.2: + xorb %dil, %dil + testl %esi, %esi + jne ..B1.5 +..B1.3: + testl $8388607, -8(%rsp) + je ..B1.9 +..B1.4: + movss -8(%rsp), %xmm0 + movb $1, %dil + mulss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, -8(%rsp) + movzwl -6(%rsp), %eax + movl %eax, %esi + andl $32640, %esi + shrl $7, %esi + addl $-25, %esi +..B1.5: + movl $65536, %edx + cmpl $65536, %r8d + cmovg %edx, %r8d + movl $-65536, %ecx + cmpl $-65536, %r8d + cmovle %ecx, %r8d + lea (%rsi,%r8), %edx + testl %edx, %edx + jle ..B1.11 +..B1.6: + cmpl $255, %edx + jge ..B1.10 +..B1.7: + movzbl %dl, %edx + andl $-32641, %eax + shll $7, %edx + orl %edx, %eax + movw %ax, -6(%rsp) + movss -8(%rsp), %xmm0 +..B1.8: + ret +..B1.9: + movss -8(%rsp), %xmm0 + ret +..B1.10: + movb -5(%rsp), %al + lea _large_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + ret +..B1.11: + cmpl $-23, %edx + jl ..B1.15 +..B1.12: + andl $-32641, %eax + lea 25(%rsi,%r8), %edx + movzbl %dl, %edx + shll $7, %edx + orl %edx, %eax + movw %ax, -6(%rsp) + testb %dil, %dil + movss -8(%rsp), %xmm0 + mulss .L_2il0floatpacket.3(%rip), %xmm0 + je ..B1.14 +..B1.13: + testl %r8d, %r8d + jl ..B1.8 +..B1.14: + ret +..B1.15: + movb -5(%rsp), %al + lea _small_value_32(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + movss (%rdx,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.2(%rip), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type scalbnf,@function + .size scalbnf,.-scalbnf + .data +# -- End scalbnf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x0d800000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0x33000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/scalbnl.S b/external/sgx_libm/intel64/scalbnl.S new file mode 100644 index 0000000000..3d755cd844 --- /dev/null +++ b/external/sgx_libm/intel64/scalbnl.S @@ -0,0 +1,321 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "scalbnl.c" + .text +..TXTST0: +# -- Begin scalbnl + .text + .align 16,0x90 + .globl scalbnl +scalbnl: +# parameter 1: 32 + %rsp +# parameter 2: %edi +..B1.1: + .cfi_startproc +..___tag_value_scalbnl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 40(%rsp), %r8d + movl %r8d, %esi + andl $32767, %esi + cmpl $32767, %esi + je ..B1.39 +..B1.4: + testl %esi, %esi + jne ..B1.12 +..B1.5: + cmpq $0, 32(%rsp) + je ..B1.15 +..B1.6: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.7: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.8: + fldcw 16(%rsp) +..B1.9: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) +..B1.10: + fldcw 18(%rsp) +..B1.11: + movzwl 40(%rsp), %r8d + movl %r8d, %esi + andl $32767, %esi + addl $-75, %esi +..B1.12: + movl $65536, %edx + cmpl $65536, %edi + cmovg %edx, %edi + movl $-65536, %ecx + xorb %al, %al + cmpl $-65536, %edi + cmovle %ecx, %edi + lea (%rsi,%rdi), %edx + testl %edx, %edx + jle ..B1.23 +..B1.13: + cmpl $32767, %edx + jge ..B1.16 +..B1.14: + andl $-32768, %r8d + andl $32767, %edx + orl %edx, %r8d + movw %r8w, 40(%rsp) + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.15: + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.16: + movzwl 18(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.20 +..B1.17: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.18: + fldcw 16(%rsp) +..B1.19: + movb $1, %al +..B1.20: + movb 41(%rsp), %dl + lea _large_value_80(%rip), %rsi + andb $-128, %dl + shrb $7, %dl + fldt (%rsi) + movzbl %dl, %ecx + shlq $4, %rcx + testb %al, %al + fldt (%rsi,%rcx) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.22 +..B1.21: + fldcw 18(%rsp) +..B1.22: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.23: + cmpl $-63, %edx + jl ..B1.31 +..B1.24: + andl $-32768, %r8d + lea 75(%rsi,%rdi), %eax + andl $32767, %eax + orl %eax, %r8d + movzwl 18(%rsp), %eax + movl %eax, %edx + andl $768, %edx + movw %r8w, 40(%rsp) + cmpl $768, %edx + je ..B1.30 +..B1.25: + orl $-64768, %eax + movw %ax, 16(%rsp) +..B1.26: + fldcw 16(%rsp) +..B1.27: + fldt 32(%rsp) + lea 8+_TWO_75(%rip), %rax + fmull (%rax) + fstpt (%rsp) +..B1.28: + fldcw 18(%rsp) +..B1.29: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.30: + fldt 32(%rsp) + lea 8+_TWO_75(%rip), %rax + fmull (%rax) + fstpt (%rsp) + jmp ..B1.29 +..B1.31: + movzwl 18(%rsp), %ecx + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.35 +..B1.32: + orl $-64768, %ecx + movw %cx, 16(%rsp) +..B1.33: + fldcw 16(%rsp) +..B1.34: + movb $1, %al +..B1.35: + movb 41(%rsp), %dl + lea _small_value_80(%rip), %rsi + andb $-128, %dl + shrb $7, %dl + fldt (%rsi) + movzbl %dl, %ecx + shlq $4, %rcx + testb %al, %al + fldt (%rsi,%rcx) + fmulp %st, %st(1) + fstpt (%rsp) + je ..B1.37 +..B1.36: + fldcw 18(%rsp) +..B1.37: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.38: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) + jmp ..B1.11 +..B1.39: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.45 +..B1.40: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.41: + fldcw 16(%rsp) +..B1.42: + fldt 32(%rsp) + fstpt (%rsp) +..B1.43: + fldcw 18(%rsp) +..B1.44: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.45: + fldt 32(%rsp) + fstpt (%rsp) + jmp ..B1.44 + .align 16,0x90 + .cfi_endproc + .type scalbnl,@function + .size scalbnl,.-scalbnl + .data +# -- End scalbnl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/signbit.S b/external/sgx_libm/intel64/signbit.S new file mode 100644 index 0000000000..f5f7efaf4e --- /dev/null +++ b/external/sgx_libm/intel64/signbit.S @@ -0,0 +1,233 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "signbit.c" + .text +..TXTST0: +# -- Begin __signbitd + .text + .align 16,0x90 + .globl __signbitd +__signbitd: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value___signbitd.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __signbitd,@function + .size __signbitd,.-__signbitd + .data +# -- End __signbitd + .text +# -- Begin signbitd + .text + .align 16,0x90 + .globl signbitd +signbitd: +# parameter 1: %xmm0 +..B2.1: + .cfi_startproc +..___tag_value_signbitd.4: +..L5: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type signbitd,@function + .size signbitd,.-signbitd + .data +# -- End signbitd + .text +# -- Begin __signbit + .text + .align 16,0x90 + .globl __signbit +__signbit: +# parameter 1: %xmm0 +..B3.1: + .cfi_startproc +..___tag_value___signbit.7: +..L8: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __signbit,@function + .size __signbit,.-__signbit + .data +# -- End __signbit + .text +# -- Begin signbit + .text + .align 16,0x90 + .globl signbit +signbit: +# parameter 1: %xmm0 +..B4.1: + .cfi_startproc +..___tag_value_signbit.10: +..L11: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type signbit,@function + .size signbit,.-signbit + .data +# -- End signbit + .text +# -- Begin __signbitf + .text + .align 16,0x90 + .globl __signbitf +__signbitf: +# parameter 1: %xmm0 +..B5.1: + .cfi_startproc +..___tag_value___signbitf.13: +..L14: + + movd %xmm0, %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __signbitf,@function + .size __signbitf,.-__signbitf + .data +# -- End __signbitf + .text +# -- Begin signbitf + .text + .align 16,0x90 + .globl signbitf +signbitf: +# parameter 1: %xmm0 +..B6.1: + .cfi_startproc +..___tag_value_signbitf.16: +..L17: + + movd %xmm0, %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type signbitf,@function + .size signbitf,.-signbitf + .data +# -- End signbitf + .text +# -- Begin __signbitl + .text + .align 16,0x90 + .globl __signbitl +__signbitl: +# parameter 1: 8 + %rsp +..B7.1: + .cfi_startproc +..___tag_value___signbitl.19: +..L20: + + movzbl 17(%rsp), %eax + shrl $7, %eax + movzwl 16(%rsp), %edx + shll $15, %eax + andl $32767, %edx + orl %edx, %eax + shll $16, %eax + movzwl 14(%rsp), %ecx + orl %ecx, %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type __signbitl,@function + .size __signbitl,.-__signbitl + .data +# -- End __signbitl + .text +# -- Begin signbitl + .text + .align 16,0x90 + .globl signbitl +signbitl: +# parameter 1: 8 + %rsp +..B8.1: + .cfi_startproc +..___tag_value_signbitl.22: +..L23: + + movzbl 17(%rsp), %eax + shrl $7, %eax + movzwl 16(%rsp), %edx + shll $15, %eax + andl $32767, %edx + orl %edx, %eax + shll $16, %eax + movzwl 14(%rsp), %ecx + orl %ecx, %eax + shrl $31, %eax + ret + .align 16,0x90 + .cfi_endproc + .type signbitl,@function + .size signbitl,.-signbitl + .data +# -- End signbitl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/significand_gen.S b/external/sgx_libm/intel64/significand_gen.S new file mode 100644 index 0000000000..d3f789b75d --- /dev/null +++ b/external/sgx_libm/intel64/significand_gen.S @@ -0,0 +1,119 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "significand_gen.c" + .text +..TXTST0: +# -- Begin significand + .text + .align 16,0x90 + .globl significand +significand: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_significand.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %ecx + movl %ecx, %edx + andl $2147483647, %edx + lea -1048576(%rdx), %eax + cmpl $2145386496, %eax + jb ..B1.8 +..B1.2: + testl %eax, %eax + jge ..B1.7 +..B1.3: + movl -8(%rsp), %eax + orl %eax, %edx + jne ..B1.5 +..B1.4: + movsd -8(%rsp), %xmm0 + ret +..B1.5: + lea _TWO_55(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + andl $-2146435073, %edx + orl $1072693248, %edx + movl %edx, -4(%rsp) + movsd -8(%rsp), %xmm0 +..B1.6: + ret +..B1.7: + lea _ones(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 + ret +..B1.8: + andl $-2146435073, %ecx + orl $1072693248, %ecx + movl %ecx, -4(%rsp) + movsd -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type significand,@function + .size significand,.-significand + .data +# -- End significand + .section .rodata, "a" + .align 4 + .align 4 +_TWO_55: + .long 0 + .long 1130364928 + .type _TWO_55,@object + .size _TWO_55,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/significandf_gen.S b/external/sgx_libm/intel64/significandf_gen.S new file mode 100644 index 0000000000..390a851e54 --- /dev/null +++ b/external/sgx_libm/intel64/significandf_gen.S @@ -0,0 +1,101 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "significandf_gen.c" + .text +..TXTST0: +# -- Begin significandf + .text + .align 16,0x90 + .globl significandf +significandf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_significandf.1: +..L2: + + movaps %xmm0, %xmm1 + movd %xmm1, %ecx + movss %xmm1, -8(%rsp) + movl %ecx, %edx + andl $2147483647, %edx + lea -8388608(%rdx), %eax + cmpl $2130706432, %eax + jb ..B1.6 +..B1.2: + decl %edx + cmpl $2139095039, %edx + jae ..B1.4 +..B1.3: + movss .L_2il0floatpacket.0(%rip), %xmm0 + mulss %xmm0, %xmm1 + movd %xmm1, %eax + andl $-2139095041, %eax + orl $1065353216, %eax + movl %eax, -8(%rsp) + movss -8(%rsp), %xmm0 + ret +..B1.4: + movss -8(%rsp), %xmm0 +..B1.5: + ret +..B1.6: + andl $-2139095041, %ecx + orl $1065353216, %ecx + movl %ecx, -8(%rsp) + movss -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type significandf,@function + .size significandf,.-significandf + .data +# -- End significandf + .section .rodata, "a" + .align 4 + .align 4 +.L_2il0floatpacket.0: + .long 0x4c000000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/significandl.S b/external/sgx_libm/intel64/significandl.S new file mode 100644 index 0000000000..051c22980f --- /dev/null +++ b/external/sgx_libm/intel64/significandl.S @@ -0,0 +1,164 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "significandl.c" + .text +..TXTST0: +# -- Begin significandl + .text + .align 16,0x90 + .globl significandl +significandl: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_significandl.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + fnstcw 18(%rsp) +..B1.3: + movzwl 40(%rsp), %edx + movl %edx, %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.15 +..B1.4: + testl %eax, %eax + jne ..B1.13 +..B1.5: + cmpq $0, 32(%rsp) + je ..B1.12 +..B1.6: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.14 +..B1.7: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.8: + fldcw 16(%rsp) +..B1.9: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) +..B1.10: + fldcw 18(%rsp) +..B1.11: + movzwl 40(%rsp), %eax + andl $-32768, %eax + orl $-49153, %eax + movw %ax, 40(%rsp) + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.12: + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.13: + andl $-32768, %edx + orl $-49153, %edx + movw %dx, 40(%rsp) + fldt 32(%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.14: + fldt 32(%rsp) + lea _TWO_75(%rip), %rax + fmull (%rax) + fstpt 32(%rsp) + jmp ..B1.11 +..B1.15: + movzwl 18(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.21 +..B1.16: + orl $-64768, %edx + movw %dx, 16(%rsp) +..B1.17: + fldcw 16(%rsp) +..B1.18: + fldt 32(%rsp) + fstpt (%rsp) +..B1.19: + fldcw 18(%rsp) +..B1.20: + fldt (%rsp) + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 +..B1.21: + fldt 32(%rsp) + fstpt (%rsp) + jmp ..B1.20 + .align 16,0x90 + .cfi_endproc + .type significandl,@function + .size significandl,.-significandl + .data +# -- End significandl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sin_gen.S b/external/sgx_libm/intel64/sin_gen.S new file mode 100644 index 0000000000..b0a8199ab6 --- /dev/null +++ b/external/sgx_libm/intel64/sin_gen.S @@ -0,0 +1,1150 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sin_gen.c" + .text +..TXTST0: +# -- Begin sin + .text + .align 16,0x90 + .globl sin +sin: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_sin.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) +..B1.2: + pextrw $3, %xmm0, %eax + andw $32767, %ax + subw $12336, %ax + cmpw $4293, %ax + ja .L_2TAG_PACKET_0.0.1 + movq PI32INV(%rip), %xmm1 + mulsd %xmm0, %xmm1 + movapd ONEHALF(%rip), %xmm5 + movsd SIGN_MASK(%rip), %xmm4 + andpd %xmm0, %xmm4 + orps %xmm4, %xmm5 + addpd %xmm5, %xmm1 + cvttsd2si %xmm1, %edx + cvtsi2sd %edx, %xmm1 + movapd P_2(%rip), %xmm6 + movq $0x3fb921fb54400000, %r8 + movd %r8, %xmm3 + movapd SC_4(%rip), %xmm5 + pshufd $68, %xmm0, %xmm4 + mulsd %xmm1, %xmm3 + unpcklpd %xmm1, %xmm1 + andl $63, %edx + shll $5, %edx + lea Ctable(%rip), %rax + addq %rdx, %rax + mulpd %xmm1, %xmm6 + mulsd P_3(%rip), %xmm1 + subsd %xmm3, %xmm4 + movq 8(%rax), %xmm7 + subsd %xmm3, %xmm0 + movapd %xmm4, %xmm3 + unpcklpd %xmm4, %xmm3 + subsd %xmm6, %xmm4 + pshufd $68, %xmm0, %xmm0 + movapd (%rax), %xmm2 + mulpd %xmm0, %xmm5 + subpd %xmm6, %xmm0 + mulsd %xmm4, %xmm7 + subsd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subsd %xmm6, %xmm3 + movapd SC_2(%rip), %xmm6 + subsd %xmm3, %xmm1 + movq 24(%rax), %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm7 + mulsd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulsd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulsd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movq %xmm3, %xmm0 + addsd 8(%rax), %xmm3 + mulpd %xmm7, %xmm1 + movq %xmm4, %xmm7 + addsd %xmm3, %xmm4 + addpd %xmm5, %xmm6 + movq 8(%rax), %xmm5 + subsd %xmm3, %xmm5 + subsd %xmm4, %xmm3 + addsd 16(%rax), %xmm1 + mulpd %xmm2, %xmm6 + addsd %xmm0, %xmm5 + addsd %xmm7, %xmm3 + addsd %xmm5, %xmm1 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + unpckhpd %xmm6, %xmm6 + movq %xmm4, %xmm0 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + jg .L_2TAG_PACKET_1.0.1 + shrl $4, %eax + cmpw $3325, %ax + jne .L_2TAG_PACKET_2.0.1 + mulsd ALL_ONES(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_2.0.1: + movq TWO_POW_55(%rip), %xmm3 + mulsd %xmm0, %xmm3 + subsd %xmm0, %xmm3 + mulsd TWO_POW_M55(%rip), %xmm3 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_3.0.1 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + subl $16224, %ecx + shrl $7, %ecx + andl $65532, %ecx + lea PI_INV_TABLE(%rip), %r11 + addq %r11, %rcx + movd %xmm0, %rax + movl 20(%rcx), %r10d + movl 24(%rcx), %r8d + movl %eax, %edx + shrq $21, %rax + orl $-2147483648, %eax + shrl $11, %eax + movl %r10d, %r9d + imulq %rdx, %r10 + imulq %rax, %r9 + imulq %rax, %r8 + movl 16(%rcx), %esi + movl 12(%rcx), %edi + movl %r10d, %r11d + shrq $32, %r10 + addq %r10, %r9 + addq %r8, %r11 + movl %r11d, %r8d + shrq $32, %r11 + addq %r11, %r9 + movl %esi, %r10d + imulq %rdx, %rsi + imulq %rax, %r10 + movl %edi, %r11d + imulq %rdx, %rdi + movl %esi, %ebx + shrq $32, %rsi + addq %rbx, %r9 + movl %r9d, %ebx + shrq $32, %r9 + addq %rsi, %r10 + addq %r9, %r10 + shlq $32, %rbx + orq %rbx, %r8 + imulq %rax, %r11 + movl 8(%rcx), %r9d + movl 4(%rcx), %esi + movl %edi, %ebx + shrq $32, %rdi + addq %rbx, %r10 + movl %r10d, %ebx + shrq $32, %r10 + addq %rdi, %r11 + addq %r10, %r11 + movq %r9, %rdi + imulq %rdx, %r9 + imulq %rax, %rdi + movl %r9d, %r10d + shrq $32, %r9 + addq %r10, %r11 + movl %r11d, %r10d + shrq $32, %r11 + addq %r9, %rdi + addq %r11, %rdi + movq %rsi, %r9 + imulq %rdx, %rsi + imulq %rax, %r9 + shlq $32, %r10 + orq %rbx, %r10 + movl (%rcx), %eax + movl %esi, %r11d + shrq $32, %rsi + addq %r11, %rdi + movl %edi, %r11d + shrq $32, %rdi + addq %rsi, %r9 + addq %rdi, %r9 + imulq %rax, %rdx + pextrw $3, %xmm0, %ebx + lea PI_INV_TABLE(%rip), %rdi + subq %rdi, %rcx + addl %ecx, %ecx + addl %ecx, %ecx + addl %ecx, %ecx + addl $19, %ecx + movl $32768, %esi + andl %ebx, %esi + shrl $4, %ebx + andl $2047, %ebx + subl $1023, %ebx + subl %ebx, %ecx + addq %rdx, %r9 + movl %ecx, %edx + addl $32, %edx + cmpl $1, %ecx + jl .L_2TAG_PACKET_4.0.1 + negl %ecx + addl $29, %ecx + shll %cl, %r9d + movl %r9d, %edi + andl $536870911, %r9d + testl $268435456, %r9d + jne .L_2TAG_PACKET_5.0.1 + shrl %cl, %r9d + movl $0, %ebx + shlq $32, %r9 + orq %r11, %r9 +.L_2TAG_PACKET_6.0.1: +.L_2TAG_PACKET_7.0.1: + cmpq $0, %r9 + je .L_2TAG_PACKET_8.0.1 +.L_2TAG_PACKET_9.0.1: + bsr %r9, %r11 + movl $29, %ecx + subl %r11d, %ecx + jle .L_2TAG_PACKET_10.0.1 + shlq %cl, %r9 + movq %r10, %rax + shlq %cl, %r10 + addl %ecx, %edx + negl %ecx + addl $64, %ecx + shrq %cl, %rax + shrq %cl, %r8 + orq %rax, %r9 + orq %r8, %r10 +.L_2TAG_PACKET_11.0.1: + cvtsi2sdq %r9, %xmm0 + shrq $1, %r10 + cvtsi2sdq %r10, %xmm3 + xorpd %xmm4, %xmm4 + shll $4, %edx + negl %edx + addl $16368, %edx + orl %esi, %edx + xorl %ebx, %edx + pinsrw $3, %edx, %xmm4 + movq PI_4(%rip), %xmm2 + movq 8+PI_4(%rip), %xmm6 + xorpd %xmm5, %xmm5 + subl $1008, %edx + pinsrw $3, %edx, %xmm5 + mulsd %xmm4, %xmm0 + shll $16, %esi + sarl $31, %esi + mulsd %xmm5, %xmm3 + movq %xmm0, %xmm1 + mulsd %xmm2, %xmm0 + shrl $29, %edi + addsd %xmm3, %xmm1 + mulsd %xmm2, %xmm3 + addl %esi, %edi + xorl %esi, %edi + mulsd %xmm1, %xmm6 + movl %edi, %eax + addsd %xmm3, %xmm6 + movq %xmm0, %xmm2 + addsd %xmm6, %xmm0 + subsd %xmm0, %xmm2 + addsd %xmm2, %xmm6 +.L_2TAG_PACKET_12.0.1: + movq PI32INV(%rip), %xmm1 + mulsd %xmm0, %xmm1 + movq ONEHALF(%rip), %xmm5 + movq SIGN_MASK(%rip), %xmm4 + andpd %xmm0, %xmm4 + orps %xmm4, %xmm5 + addpd %xmm5, %xmm1 + cvttsd2si %xmm1, %edx + cvtsi2sd %edx, %xmm1 + movq P_1(%rip), %xmm3 + movapd P_2(%rip), %xmm2 + mulsd %xmm1, %xmm3 + unpcklpd %xmm1, %xmm1 + shll $3, %eax + addl $1865216, %edx + movq %xmm0, %xmm4 + addl %eax, %edx + andl $63, %edx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shll $5, %edx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subsd %xmm3, %xmm0 + mulsd P_3(%rip), %xmm1 + subsd %xmm3, %xmm4 + movq 8(%rax), %xmm7 + unpcklpd %xmm0, %xmm0 + movq %xmm4, %xmm3 + subsd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + mulsd %xmm4, %xmm7 + subsd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subsd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subsd %xmm3, %xmm1 + movq 24(%rax), %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm7 + subsd %xmm6, %xmm1 + movapd SC_2(%rip), %xmm6 + mulsd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulsd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulsd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movq %xmm3, %xmm0 + addsd 8(%rax), %xmm3 + mulpd %xmm7, %xmm1 + movq %xmm4, %xmm7 + addsd %xmm3, %xmm4 + addpd %xmm5, %xmm6 + movq 8(%rax), %xmm5 + subsd %xmm3, %xmm5 + subsd %xmm4, %xmm3 + addsd 16(%rax), %xmm1 + mulpd %xmm2, %xmm6 + addsd %xmm0, %xmm5 + addsd %xmm7, %xmm3 + addsd %xmm5, %xmm1 + addsd %xmm3, %xmm1 + addsd %xmm6, %xmm1 + unpckhpd %xmm6, %xmm6 + movq %xmm4, %xmm0 + addsd %xmm6, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_8.0.1: + addl $64, %edx + movq %r10, %r9 + movq %r8, %r10 + movq $0, %r8 + cmpq $0, %r9 + jne .L_2TAG_PACKET_9.0.1 + addl $64, %edx + movq %r10, %r9 + movq %r8, %r10 + cmpq $0, %r9 + jne .L_2TAG_PACKET_9.0.1 + xorpd %xmm0, %xmm0 + xorpd %xmm6, %xmm6 + jmp .L_2TAG_PACKET_12.0.1 +.L_2TAG_PACKET_10.0.1: + je .L_2TAG_PACKET_11.0.1 + negl %ecx + shrq %cl, %r10 + movq %r9, %rax + shrq %cl, %r9 + subl %ecx, %edx + negl %ecx + addl $64, %ecx + shlq %cl, %rax + orq %rax, %r10 + jmp .L_2TAG_PACKET_11.0.1 +.L_2TAG_PACKET_4.0.1: + negl %ecx + shlq $32, %r9 + orq %r11, %r9 + shlq %cl, %r9 + movq %r9, %rdi + testl $-2147483648, %r9d + jne .L_2TAG_PACKET_13.0.1 + shrl %cl, %r9d + movl $0, %ebx + shrq $3, %rdi + jmp .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_5.0.1: + shrl %cl, %r9d + movl $536870912, %ebx + shrl %cl, %ebx + shlq $32, %r9 + orq %r11, %r9 + shlq $32, %rbx + addl $536870912, %edi + movq $0, %rcx + movq $0, %r11 + subq %r8, %rcx + sbbq %r10, %r11 + sbbq %r9, %rbx + movq %rcx, %r8 + movq %r11, %r10 + movq %rbx, %r9 + movl $32768, %ebx + jmp .L_2TAG_PACKET_6.0.1 +.L_2TAG_PACKET_13.0.1: + shrl %cl, %r9d + movq $0x100000000, %rbx + shrq %cl, %rbx + movq $0, %rcx + movq $0, %r11 + subq %r8, %rcx + sbbq %r10, %r11 + sbbq %r9, %rbx + movq %rcx, %r8 + movq %r11, %r10 + movq %rbx, %r9 + movl $32768, %ebx + shrq $3, %rdi + addl $536870912, %edi + jmp .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_3.0.1: + movq 8(%rsp), %xmm0 + mulsd NEG_ZERO(%rip), %xmm0 + movq %xmm0, (%rsp) +.L_2TAG_PACKET_14.0.1: +..B1.4: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type sin,@function + .size sin,.-sin + .data +# -- End sin + .section .rodata, "a" + .align 16 + .align 16 +ONEHALF: + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .type ONEHALF,@object + .size ONEHALF,16 + .align 16 +P_2: + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .type P_2,@object + .size P_2,16 + .align 16 +SC_4: + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .type SC_4,@object + .size SC_4,16 + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 1072693248 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1071644672 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 1071644672 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1070596096 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 1070596096 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1069547520 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 1072683149 + .long 1073741824 + .long 3163061750 + .long 0 + .long 3217031168 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 1072652951 + .long 536870912 + .long 1014325783 + .long 0 + .long 3218079744 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 1072602945 + .long 3758096384 + .long 1015505073 + .long 0 + .long 3218079744 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 1072533611 + .long 536870912 + .long 1014257638 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 1072445618 + .long 2147483648 + .long 3161907377 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 1072339814 + .long 3758096384 + .long 1010431536 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3162686945 + .long 0 + .long 3219128320 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1013450602 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 1071761211 + .long 536870912 + .long 1015752157 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 1071524701 + .long 536870912 + .long 1012796809 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 1071152610 + .long 3758096384 + .long 3160878317 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 1070765062 + .long 2684354560 + .long 3161838221 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 1070135480 + .long 3221225472 + .long 3160567065 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 1069094822 + .long 3758096384 + .long 3158189848 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 393047345 + .long 1064548654 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3220176896 + .long 18115067 + .long 1066642694 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3220176896 + .long 2476548698 + .long 1067846634 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3220176896 + .long 2255197647 + .long 1068727457 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3220176896 + .long 1945768569 + .long 1069431400 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 3220176896 + .long 1539668340 + .long 1069912679 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 3220176896 + .long 1403757309 + .long 1070403070 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 2485417816 + .long 3217109964 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 3219128320 + .long 2598800519 + .long 3215750067 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3219128320 + .long 2140183630 + .long 1067272748 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3219128320 + .long 1699043957 + .long 1069418613 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 3219128320 + .long 1991047213 + .long 3215237169 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3218079744 + .long 240740309 + .long 1068244255 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 3218079744 + .long 257503056 + .long 1067164005 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 257503056 + .long 3214647653 + .long 2748392742 + .long 3220166797 + .long 1073741824 + .long 1015578102 + .long 0 + .long 1069547520 + .long 240740309 + .long 3215727903 + .long 3489094832 + .long 3220136599 + .long 536870912 + .long 3161809431 + .long 0 + .long 1070596096 + .long 1991047213 + .long 1067753521 + .long 1455828442 + .long 3220086593 + .long 3758096384 + .long 3162988721 + .long 0 + .long 1070596096 + .long 1699043957 + .long 3216902261 + .long 3476196678 + .long 3220017259 + .long 536870912 + .long 3161741286 + .long 0 + .long 1071644672 + .long 2140183630 + .long 3214756396 + .long 4051746225 + .long 3219929266 + .long 2147483648 + .long 1014423729 + .long 0 + .long 1071644672 + .long 2598800519 + .long 1068266419 + .long 688824739 + .long 3219823462 + .long 3758096384 + .long 3157915184 + .long 0 + .long 1071644672 + .long 2485417816 + .long 1069626316 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1015203297 + .long 0 + .long 1071644672 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3160934250 + .long 0 + .long 1072693248 + .long 1539668340 + .long 3217396327 + .long 967731400 + .long 3219244859 + .long 536870912 + .long 3163235805 + .long 0 + .long 1072693248 + .long 1945768569 + .long 3216915048 + .long 939980347 + .long 3219008349 + .long 536870912 + .long 3160280457 + .long 0 + .long 1072693248 + .long 2255197647 + .long 3216211105 + .long 2796464483 + .long 3218636258 + .long 3758096384 + .long 1013394669 + .long 0 + .long 1072693248 + .long 2476548698 + .long 3215330282 + .long 785751814 + .long 3218248710 + .long 2684354560 + .long 1014354573 + .long 0 + .long 1072693248 + .long 18115067 + .long 3214126342 + .long 1013556747 + .long 3217619128 + .long 3221225472 + .long 1013083417 + .long 0 + .long 1072693248 + .long 393047345 + .long 3212032302 + .long 3156849708 + .long 3216578470 + .long 3758096384 + .long 1010706200 + .long 0 + .long 1072693248 + .type Ctable,@object + .size Ctable,2048 + .align 16 +SC_2: + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .type SC_2,@object + .size SC_2,16 + .align 16 +SC_3: + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .type SC_3,@object + .size SC_3,16 + .align 16 +SC_1: + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .type SC_1,@object + .size SC_1,16 + .align 16 +PI_INV_TABLE: + .long 0 + .long 0 + .long 2734261102 + .long 1313084713 + .long 4230436817 + .long 4113882560 + .long 3680671129 + .long 1011060801 + .long 4266746795 + .long 3736847713 + .long 3072618042 + .long 1112396512 + .long 105459434 + .long 164729372 + .long 4263373596 + .long 2972297022 + .long 3900847605 + .long 784024708 + .long 3919343654 + .long 3026157121 + .long 965858873 + .long 2203269620 + .long 2625920907 + .long 3187222587 + .long 536385535 + .long 3724908559 + .long 4012839307 + .long 1510632735 + .long 1832287951 + .long 667617719 + .long 1330003814 + .long 2657085997 + .long 1965537991 + .long 3957715323 + .long 1023883767 + .long 2320667370 + .long 1811636145 + .long 529358088 + .long 1443049542 + .long 4235946923 + .long 4040145953 + .type PI_INV_TABLE,@object + .size PI_INV_TABLE,164 + .space 12, 0x00 # pad + .align 16 +PI_4: + .long 1073741824 + .long 1072243195 + .long 407279769 + .long 1046758445 + .type PI_4,@object + .size PI_4,16 + .align 8 +PI32INV: + .long 1841940611 + .long 1076125488 + .type PI32INV,@object + .size PI32INV,8 + .align 8 +SIGN_MASK: + .long 0 + .long 2147483648 + .type SIGN_MASK,@object + .size SIGN_MASK,8 + .align 8 +P_3: + .long 771977331 + .long 996350346 + .type P_3,@object + .size P_3,8 + .align 8 +ALL_ONES: + .long 4294967295 + .long 1072693247 + .type ALL_ONES,@object + .size ALL_ONES,8 + .align 8 +TWO_POW_55: + .long 0 + .long 1130364928 + .type TWO_POW_55,@object + .size TWO_POW_55,8 + .align 8 +TWO_POW_M55: + .long 0 + .long 1015021568 + .type TWO_POW_M55,@object + .size TWO_POW_M55,8 + .align 8 +P_1: + .long 1413480448 + .long 1069097467 + .type P_1,@object + .size P_1,8 + .align 8 +NEG_ZERO: + .long 0 + .long 2147483648 + .type NEG_ZERO,@object + .size NEG_ZERO,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sincos_gen.S b/external/sgx_libm/intel64/sincos_gen.S new file mode 100644 index 0000000000..1ca9835a35 --- /dev/null +++ b/external/sgx_libm/intel64/sincos_gen.S @@ -0,0 +1,1479 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincos_gen.c" + .text +..TXTST0: +# -- Begin sincos + .text + .align 16,0x90 + .globl sincos +sincos: +# parameter 1: %xmm0 +# parameter 2: %rdi +# parameter 3: %rsi +..B1.1: + .cfi_startproc +..___tag_value_sincos.1: +..L2: + + subq $72, %rsp + .cfi_def_cfa_offset 80 + movq %fs:40, %rax + xorq %rsp, %rax + movsd %xmm0, 8(%rsp) + movq %rdi, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rax, 56(%rsp) +..B1.2: + stmxcsr (%rsp) + movl (%rsp), %eax + andl $-24577, %eax + cmpl (%rsp), %eax + jne .L_2TAG_PACKET_0.0.1 +.L_2TAG_PACKET_1.0.1: + pextrw $3, %xmm0, %eax + andw $32767, %ax + subw $12336, %ax + cmpw $4293, %ax + ja .L_2TAG_PACKET_2.0.1 + unpcklpd %xmm0, %xmm0 + movapd PI32INV(%rip), %xmm1 + mulpd %xmm0, %xmm1 + movapd SHIFTER(%rip), %xmm2 + cvtsd2si %xmm1, %edx + addpd %xmm2, %xmm1 + movapd P_1(%rip), %xmm3 + subpd %xmm2, %xmm1 + movapd P_2(%rip), %xmm2 + mulpd %xmm1, %xmm3 + addq $1865216, %rdx + movapd %xmm0, %xmm4 + andq $63, %rdx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shlq $6, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subpd %xmm3, %xmm0 + mulpd P_3(%rip), %xmm1 + subpd %xmm3, %xmm4 + movapd 16(%rax), %xmm7 + movapd %xmm4, %xmm3 + subpd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + movapd SC_2(%rip), %xmm6 + mulpd %xmm4, %xmm7 + subpd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subpd %xmm3, %xmm1 + movapd 48(%rax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm7 + mulpd %xmm7, %xmm1 + movapd 16(%rax), %xmm7 + mulpd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulpd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm7 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulpd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addpd 16(%rax), %xmm3 + addpd %xmm5, %xmm6 + movq %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulpd %xmm7, %xmm6 + mulpd %xmm5, %xmm2 + movapd %xmm4, %xmm7 + addpd %xmm3, %xmm4 + movapd 16(%rax), %xmm5 + subpd %xmm3, %xmm5 + subpd %xmm4, %xmm3 + addpd 32(%rax), %xmm1 + addpd %xmm0, %xmm5 + addpd %xmm7, %xmm3 + addpd %xmm5, %xmm1 + movl (%rsp), %eax + andl $-24577, %eax + cmpl (%rsp), %eax + je .L_2TAG_PACKET_3.0.1 + stmxcsr 4(%rsp) + movl (%rsp), %eax + andl $24576, %eax + orl %eax, 4(%rsp) + ldmxcsr 4(%rsp) +.L_2TAG_PACKET_3.0.1: + addpd %xmm3, %xmm1 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + addpd %xmm4, %xmm1 + movq %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + movq 16(%rsp), %rax + movq %xmm0, (%rax) + movq 24(%rsp), %rax + movq %xmm1, (%rax) + jmp ..B1.7 +.L_2TAG_PACKET_2.0.1: + jg .L_2TAG_PACKET_4.0.1 + movq %xmm0, %xmm1 + pextrw $3, %xmm0, %eax + orw $32768, %ax + pinsrw $3, %eax, %xmm1 + addsd ONE(%rip), %xmm1 + cmpw $32784, %ax + jge .L_2TAG_PACKET_5.0.1 + movl (%rsp), %eax + andl $-24577, %eax + cmpl (%rsp), %eax + je .L_2TAG_PACKET_6.0.1 + stmxcsr 4(%rsp) + movl (%rsp), %eax + andl $24576, %eax + orl %eax, 4(%rsp) + ldmxcsr 4(%rsp) +.L_2TAG_PACKET_6.0.1: + mulsd ALL_ONES(%rip), %xmm0 + movq 16(%rsp), %rax + movq %xmm0, (%rax) + movq 24(%rsp), %rax + movq %xmm1, (%rax) + jmp ..B1.7 +.L_2TAG_PACKET_5.0.1: + movq TWO_POW_55(%rip), %xmm3 + mulsd %xmm0, %xmm3 + subsd %xmm3, %xmm0 + mulsd TWO_POW_M55(%rip), %xmm0 + movq 16(%rsp), %rax + movq %xmm0, (%rax) + movq 24(%rsp), %rax + movq %xmm1, (%rax) + jmp .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_4.0.1: + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_8.0.1 +..B1.3: + movsd 8(%rsp), %xmm0 + lea 40(%rsp), %rdi +..___tag_value_sincos.4: + call __libm_reduce_pio2d@PLT +..___tag_value_sincos.5: +..B1.4: + movl %eax, 32(%rsp) +..B1.5: + movq 40(%rsp), %xmm0 + movq 48(%rsp), %xmm6 + unpcklpd %xmm0, %xmm0 + unpcklpd %xmm6, %xmm6 + movapd PI32INV(%rip), %xmm1 + mulpd %xmm0, %xmm1 + movapd SHIFTER(%rip), %xmm2 + cvtsd2si %xmm1, %edx + addpd %xmm2, %xmm1 + movapd P_1(%rip), %xmm3 + subpd %xmm2, %xmm1 + movapd P_2(%rip), %xmm2 + mulpd %xmm1, %xmm3 + movl 32(%rsp), %eax + shlq $4, %rax + addq $1865216, %rdx + movapd %xmm0, %xmm4 + addq %rax, %rdx + andq $63, %rdx + movapd SC_4(%rip), %xmm5 + lea Ctable(%rip), %rax + shlq $6, %rdx + addq %rdx, %rax + mulpd %xmm1, %xmm2 + subpd %xmm3, %xmm0 + mulpd P_3(%rip), %xmm1 + subpd %xmm3, %xmm4 + movapd 16(%rax), %xmm7 + movapd %xmm4, %xmm3 + subpd %xmm2, %xmm4 + mulpd %xmm0, %xmm5 + subpd %xmm2, %xmm0 + mulpd %xmm4, %xmm7 + subpd %xmm4, %xmm3 + mulpd %xmm0, %xmm5 + mulpd %xmm0, %xmm0 + subpd %xmm2, %xmm3 + movapd (%rax), %xmm2 + subpd %xmm3, %xmm1 + movapd 48(%rax), %xmm3 + addpd %xmm3, %xmm2 + subpd %xmm2, %xmm7 + subpd %xmm6, %xmm1 + movapd SC_2(%rip), %xmm6 + mulpd %xmm7, %xmm1 + movapd 16(%rax), %xmm7 + mulpd %xmm4, %xmm2 + mulpd %xmm0, %xmm6 + mulpd %xmm4, %xmm3 + mulpd %xmm0, %xmm2 + mulpd %xmm0, %xmm7 + mulpd %xmm0, %xmm0 + addpd SC_3(%rip), %xmm5 + mulpd (%rax), %xmm4 + addpd SC_1(%rip), %xmm6 + mulpd %xmm0, %xmm5 + movapd %xmm3, %xmm0 + addpd 16(%rax), %xmm3 + addpd %xmm5, %xmm6 + movq %xmm6, %xmm5 + unpckhpd %xmm6, %xmm6 + unpcklpd %xmm5, %xmm5 + mulpd %xmm7, %xmm6 + mulpd %xmm5, %xmm2 + movapd %xmm4, %xmm7 + addpd %xmm3, %xmm4 + movapd 16(%rax), %xmm5 + subpd %xmm3, %xmm5 + subpd %xmm4, %xmm3 + addpd 32(%rax), %xmm1 + addpd %xmm0, %xmm5 + addpd %xmm7, %xmm3 + addpd %xmm5, %xmm1 + movl (%rsp), %eax + andl $-24577, %eax + cmpl (%rsp), %eax + je .L_2TAG_PACKET_9.0.1 + stmxcsr 4(%rsp) + movl (%rsp), %eax + andl $24576, %eax + orl %eax, 4(%rsp) + ldmxcsr 4(%rsp) +.L_2TAG_PACKET_9.0.1: + addpd %xmm3, %xmm1 + addpd %xmm2, %xmm1 + addpd %xmm6, %xmm1 + addpd %xmm4, %xmm1 + movq %xmm1, %xmm0 + unpckhpd %xmm1, %xmm1 + movq 16(%rsp), %rax + movq %xmm0, (%rax) + movq 24(%rsp), %rax + movq %xmm1, (%rax) + jmp ..B1.7 +.L_2TAG_PACKET_8.0.1: + movq 8(%rsp), %xmm0 + pxor %xmm1, %xmm1 + mulsd %xmm1, %xmm0 + movq 16(%rsp), %rax + movq %xmm0, (%rax) + movq 24(%rsp), %rax + movq %xmm0, (%rax) +.L_2TAG_PACKET_7.0.1: + movl (%rsp), %eax + andl $-24577, %eax + cmpl (%rsp), %eax + je .L_2TAG_PACKET_10.0.1 + stmxcsr 4(%rsp) + movl (%rsp), %eax + andl $24576, %eax + orl %eax, 4(%rsp) + ldmxcsr 4(%rsp) +.L_2TAG_PACKET_10.0.1: + jmp ..B1.7 +.L_2TAG_PACKET_0.0.1: + movl %eax, 4(%rsp) + ldmxcsr 4(%rsp) + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_11.0.1: +..B1.7: + movq 56(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.9 +..B1.8: + addq $72, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 +..B1.9: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type sincos,@function + .size sincos,.-sincos + .data +# -- End sincos + .section .rodata, "a" + .align 16 + .align 16 +PI32INV: + .long 1841940611 + .long 1076125488 + .long 1841940611 + .long 1076125488 + .type PI32INV,@object + .size PI32INV,16 + .align 16 +SHIFTER: + .long 0 + .long 1127743488 + .long 0 + .long 1127743488 + .type SHIFTER,@object + .size SHIFTER,16 + .align 16 +P_1: + .long 1413480448 + .long 1069097467 + .long 1413480448 + .long 1069097467 + .type P_1,@object + .size P_1,16 + .align 16 +P_2: + .long 442499072 + .long 1032893537 + .long 442499072 + .long 1032893537 + .type P_2,@object + .size P_2,16 + .align 16 +SC_4: + .long 2773927732 + .long 1053236707 + .long 436314138 + .long 1056571808 + .type SC_4,@object + .size SC_4,16 + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 3217031168 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 3218079744 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 3219128320 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 3219128320 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 3220176896 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 3220176896 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 1064548654 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 3163061750 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 3220176896 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 1066642694 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 1014325783 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 1067846634 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 1015505073 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 3220176896 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 1068727457 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 1014257638 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 1069431400 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 3161907377 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 1069912679 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 1010431536 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 1070403070 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 3162686945 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 3220176896 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 3217719929 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 3163282740 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 3217109964 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 1013450602 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 3215750067 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 1015752157 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 1067272748 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 1012796809 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 1069418613 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 3160878317 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 3219128320 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 3215237169 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 3161838221 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 1068244255 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 3160567065 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 3218079744 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 1067164005 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 3158189848 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 3217031168 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 393047345 + .long 1064548654 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 3220166797 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 1015578102 + .long 0 + .long 3220176896 + .long 0 + .long 1069547520 + .long 18115067 + .long 1066642694 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 3220136599 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 3161809431 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2476548698 + .long 1067846634 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 3220086593 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 3162988721 + .long 0 + .long 3220176896 + .long 0 + .long 1070596096 + .long 2255197647 + .long 1068727457 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 3220017259 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 3161741286 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1945768569 + .long 1069431400 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 3219929266 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 1014423729 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1539668340 + .long 1069912679 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 3219823462 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 3157915184 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 1403757309 + .long 1070403070 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 3219700864 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 1015203297 + .long 0 + .long 3220176896 + .long 0 + .long 1071644672 + .long 2583490354 + .long 3217719929 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 3219562654 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 1015799092 + .long 0 + .long 3219128320 + .long 0 + .long 1071644672 + .long 2485417816 + .long 3217109964 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 3219410163 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 3160934250 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2598800519 + .long 3215750067 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 3219244859 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 3163235805 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 2140183630 + .long 1067272748 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 3219008349 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 3160280457 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1699043957 + .long 1069418613 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 3218636258 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 1013394669 + .long 0 + .long 3219128320 + .long 0 + .long 1072693248 + .long 1991047213 + .long 3215237169 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 3218248710 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 1014354573 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 240740309 + .long 1068244255 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 3217619128 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 1013083417 + .long 0 + .long 3218079744 + .long 0 + .long 1072693248 + .long 257503056 + .long 1067164005 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 3216578470 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 1010706200 + .long 0 + .long 3217031168 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 257503056 + .long 3214647653 + .long 393047345 + .long 3212032302 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 1069094822 + .long 1073741824 + .long 1015578102 + .long 3758096384 + .long 3158189848 + .long 0 + .long 1069547520 + .long 0 + .long 1072693248 + .long 240740309 + .long 3215727903 + .long 18115067 + .long 3214126342 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 1070135480 + .long 536870912 + .long 3161809431 + .long 3221225472 + .long 3160567065 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1991047213 + .long 1067753521 + .long 2476548698 + .long 3215330282 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 1070765062 + .long 3758096384 + .long 3162988721 + .long 2684354560 + .long 3161838221 + .long 0 + .long 1070596096 + .long 0 + .long 1072693248 + .long 1699043957 + .long 3216902261 + .long 2255197647 + .long 3216211105 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 1071152610 + .long 536870912 + .long 3161741286 + .long 3758096384 + .long 3160878317 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2140183630 + .long 3214756396 + .long 1945768569 + .long 3216915048 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 1071524701 + .long 2147483648 + .long 1014423729 + .long 536870912 + .long 1012796809 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2598800519 + .long 1068266419 + .long 1539668340 + .long 3217396327 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 1071761211 + .long 3758096384 + .long 3157915184 + .long 536870912 + .long 1015752157 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2485417816 + .long 1069626316 + .long 1403757309 + .long 3217886718 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 1071926515 + .long 536870912 + .long 1015203297 + .long 536870912 + .long 1013450602 + .long 0 + .long 1071644672 + .long 0 + .long 1072693248 + .long 2583490354 + .long 1070236281 + .long 2583490354 + .long 1070236281 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 1072079006 + .long 536870912 + .long 1015799092 + .long 536870912 + .long 3163282740 + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .long 1403757309 + .long 3217886718 + .long 2485417816 + .long 1069626316 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 1072217216 + .long 536870912 + .long 3160934250 + .long 536870912 + .long 3162686945 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1539668340 + .long 3217396327 + .long 2598800519 + .long 1068266419 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 1072339814 + .long 536870912 + .long 3163235805 + .long 3758096384 + .long 1010431536 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 1945768569 + .long 3216915048 + .long 2140183630 + .long 3214756396 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 1072445618 + .long 536870912 + .long 3160280457 + .long 2147483648 + .long 3161907377 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2255197647 + .long 3216211105 + .long 1699043957 + .long 3216902261 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 1072533611 + .long 3758096384 + .long 1013394669 + .long 536870912 + .long 1014257638 + .long 0 + .long 1072693248 + .long 0 + .long 1071644672 + .long 2476548698 + .long 3215330282 + .long 1991047213 + .long 1067753521 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 1072602945 + .long 2684354560 + .long 1014354573 + .long 3758096384 + .long 1015505073 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 18115067 + .long 3214126342 + .long 240740309 + .long 3215727903 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 1072652951 + .long 3221225472 + .long 1013083417 + .long 536870912 + .long 1014325783 + .long 0 + .long 1072693248 + .long 0 + .long 1070596096 + .long 393047345 + .long 3212032302 + .long 257503056 + .long 3214647653 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 1072683149 + .long 3758096384 + .long 1010706200 + .long 1073741824 + .long 3163061750 + .long 0 + .long 1072693248 + .long 0 + .long 1069547520 + .type Ctable,@object + .size Ctable,4096 + .space 512, 0x00 # pad + .align 16 +P_3: + .long 771977331 + .long 996350346 + .long 771977331 + .long 996350346 + .type P_3,@object + .size P_3,16 + .align 16 +SC_2: + .long 286331153 + .long 1065423121 + .long 1431655765 + .long 1067799893 + .type SC_2,@object + .size SC_2,16 + .align 16 +SC_3: + .long 436314138 + .long 3207201184 + .long 381774871 + .long 3210133868 + .type SC_3,@object + .size SC_3,16 + .align 16 +SC_1: + .long 1431655765 + .long 3217380693 + .long 0 + .long 3219128320 + .type SC_1,@object + .size SC_1,16 + .align 16 +TWO_POW_55: + .long 0 + .long 1130364928 + .type TWO_POW_55,@object + .size TWO_POW_55,8 + .align 8 +ONE: + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,8 + .align 8 +ALL_ONES: + .long 4294967295 + .long 1072693247 + .type ALL_ONES,@object + .size ALL_ONES,8 + .align 8 +TWO_POW_M55: + .long 0 + .long 3162505216 + .type TWO_POW_M55,@object + .size TWO_POW_M55,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sincos_pi4l.S b/external/sgx_libm/intel64/sincos_pi4l.S new file mode 100644 index 0000000000..d664d8382e --- /dev/null +++ b/external/sgx_libm/intel64/sincos_pi4l.S @@ -0,0 +1,5050 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincos_pi4l.c" + .text +..TXTST0: +# -- Begin __libm_sincos_pi4l + .text + .align 16,0x90 + .globl __libm_sincos_pi4l +__libm_sincos_pi4l: +# parameter 1: 80 + %rsp +# parameter 2: %rdi +# parameter 3: %rsi +# parameter 4: %edx +..B1.1: + .cfi_startproc +..___tag_value___libm_sincos_pi4l.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + subq $56, %rsp + .cfi_def_cfa_offset 80 + lea _pzerol_value(%rip), %rax + fldt 80(%rsp) + movl %edx, %r8d + movl %r8d, %r9d + fld %st(0) + movq %fs:40, %rcx + negl %r9d + xorq %rsp, %rcx + fchs + fldt (%rax) + lea _pion4(%rip), %r11 + movl $1, %r10d + fcomi %st(2), %st + movq %rcx, 48(%rsp) + fxch %st(2) + fcmovnbe %st(1), %st + fstp %st(1) + fldt (%r11) + movl $-1, %ecx + cmova %r9d, %r8d + cmovbe %r10d, %ecx + fcomi %st(1), %st + jbe ..B1.3 +..B1.2: + fstp %st(2) + testl $1, %r8d + fsub %st, %st(1) + fcmovne %st(1), %st + fstp %st(1) + jmp ..B1.22 +..B1.3: + lea _cody_thres_val(%rip), %rax + fldz + fldt (%rax) + fcomip %st(3), %st + jbe ..B1.5 +..B1.4: + fstp %st(3) + fstp %st(0) + fstp %st(1) + lea __4onpi(%rip), %rax + lea _PI04(%rip), %r10 + lea 16+_PI04(%rip), %r11 + lea 32+_PI04(%rip), %r13 + fldt (%rax) + fmul %st(1), %st + fnstcw (%rsp) + movzwl (%rsp), %eax + orl $3072, %eax + movl %eax, 8(%rsp) + fldcw 8(%rsp) + fistpl 16(%rsp) + fldcw (%rsp) + fldt (%r10) + fldt (%r11) + fldt (%r13) + movl 16(%rsp), %r9d + addl %r9d, %r8d + testl $1, %r8d + lea 1(%r9), %edx + cmovne %edx, %r9d + movl %r9d, 24(%rsp) + fildl 24(%rsp) + fmul %st, %st(3) + fxch %st(3) + fsubrp %st, %st(4) + fxch %st(1) + fmul %st(2), %st + fsubrp %st, %st(3) + fmulp %st, %st(1) + fsubrp %st, %st(1) + jmp ..B1.22 +..B1.5: + fxch %st(2) + fstpt 16(%rsp) + movl $-2078209981, %eax + movzwl 24(%rsp), %r11d + movl %r11d, %r9d + andl $32767, %r9d + andl $-32768, %r11d + lea -16417(%r9), %r13d + imull %r13d + sarl $31, %r13d + lea -16417(%rdx,%r9), %eax + sarl $4, %eax + lea -62(%r9), %r10d + subl %r13d, %eax + andl $32767, %r10d + movl %eax, %r14d + orl %r10d, %r11d + shll $5, %r14d + negl %r14d + addl %eax, %r14d + movw %r11w, 24(%rsp) + fldt 16(%rsp) + fstpt (%rsp) + fldt (%rsp) + movl $0, (%rsp) + lea -16417(%r14,%r9), %edx + fldt (%rsp) + cmpl $23, %edx + fsubr %st, %st(1) + jl ..B1.7 +..B1.6: + movslq %eax, %rdx + incl %eax + shlq $4, %rdx + lea _4OPI(%rip), %r13 + fxch %st(3) + fstpt 16(%rsp) + fldt (%rdx,%r13) + fmul %st(1), %st + fldt 16(%rdx,%r13) + fmul %st(4), %st + faddp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + andl $-16777216, 32(%rsp) + fldt 32(%rsp) + fsubrp %st, %st(1) + jmp ..B1.8 +..B1.7: + fstp %st(3) + fld %st(3) + lea _4OPI(%rip), %r13 +..B1.8: + movslq %eax, %rdx + fld %st(3) + shlq $4, %rdx + lea _ADDING(%rip), %r9 + fldt 16(%rdx,%r13) + fmul %st, %st(1) + fmul %st(3), %st + fldt (%rdx,%r13) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fldt 32(%rdx,%r13) + fmul %st(6), %st + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fadd %st, %st(1) + fstpt 32(%rsp) + fldt (%r9) + fld %st(0) + fadd %st(2), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + movl 16(%rsp), %r9d + fcomi %st(1), %st + fxch %st(1) + fstp %st(0) + fldt (%rsp) + jbe ..B1.10 +..B1.9: + lea _nonel_value(%rip), %rdx + decl %r9d + fldt (%rdx) + faddp %st, %st(2) +..B1.10: + addl %r9d, %r8d + fxch %st(1) + fsubrp %st, %st(2) + testl $1, %r8d + je ..B1.13 +..B1.11: + fstp %st(5) + lea _nonel_value(%rip), %rdx + fldt (%rdx) + fxch %st(5) +..B1.13: + movslq %eax, %rax + movl $5, %r9d + fxch %st(1) + faddp %st, %st(5) + lea 2(%rax), %rdx + movl %edx, %r11d + faddp %st, %st(4) + negl %r11d + addl $532, %r11d + cmpl $5, %r11d + cmova %r9d, %r11d + cmpq $532, %rdx + jge ..B1.20 +..B1.14: + movl %r11d, %r9d + movl $1, %r14d + shrl $1, %r9d + xorl %r10d, %r10d + testl %r9d, %r9d + jbe ..B1.18 +..B1.15: + fldt .L_2il0floatpacket.0(%rip) + shlq $4, %rdx + addq %r13, %rdx +..B1.16: + jmp ..L8 +..L9: + faddp %st, %st(1) +..L8: + fld %st(3) + lea (%r10,%r10), %r14d + movslq %r14d, %r14 + incl %r10d + shlq $4, %r14 + cmpl %r9d, %r10d + fldt 16(%rdx,%r14) + fmul %st, %st(1) + fmul %st(3), %st + fldt (%rdx,%r14) + fmul %st(4), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(6) + fldt 32(%rdx,%r14) + fmul %st(5), %st + faddp %st, %st(1) + jb ..L9 + faddp %st, %st(1) +..B1.17: + faddp %st, %st(4) + lea 1(%r10,%r10), %r14d +..B1.18: + decl %r14d + movslq %r14d, %r14 + movslq %r11d, %r11 + cmpq %r11, %r14 + jae ..B1.20 +..B1.19: + lea 2(%r14,%rax), %rax + shlq $4, %rax + fldt (%rax,%r13) + fmulp %st, %st(1) + fldt 16(%rax,%r13) + fmulp %st, %st(3) + fadd %st(2), %st + fadd %st, %st(3) +..B1.20: + fstp %st(2) + fstp %st(1) + fmulp %st, %st(1) +..B1.22: + testl $1, %r8d + lea ssign(%rip), %rdx + lea csign(%rip), %r10 + lea 1(%r8), %eax + cmovne %eax, %r8d + fld %st(0) + andl $7, %r8d + movl (%rdx,%r8,4), %r9d + imull %r9d, %ecx + fmul %st(1), %st + movl (%r10,%r8,4), %eax + andl $3, %r8d + decl %r8d + movl %ecx, 24(%rsp) + cmpl $1, %r8d + fildl 24(%rsp) + ja ..B1.24 +..B1.23: + lea _PC(%rip), %rdx + lea 16+_PC(%rip), %rcx + lea 32+_PC(%rip), %r8 + lea 48+_PC(%rip), %r9 + lea 64+_PC(%rip), %r10 + lea 80+_PC(%rip), %r11 + lea 96+_PC(%rip), %r13 + lea 112+_PC(%rip), %r14 + fldt (%rdx) + lea _ponel_value(%rip), %rdx + movl %eax, 24(%rsp) + fmul %st(2), %st + fldt (%rcx) + lea 32+_PS(%rip), %rcx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + lea 64+_PS(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + lea 80+_PS(%rip), %r9 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + lea 96+_PS(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r11) + lea 112+_PS(%rip), %r11 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r13) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r14) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 16+_PS(%rip), %rdx + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rdi) + lea _PS(%rip), %rdi + fldt (%rdx) + fldt (%r8) + fldt (%r9) + fldt (%rdi) + lea 48+_PS(%rip), %rdi + fmul %st(4), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fildl 24(%rsp) + fmulp %st, %st(1) + fstpt (%rsi) + jmp ..B1.25 +..B1.24: + lea _PS(%rip), %rdx + lea 16+_PS(%rip), %rcx + lea 32+_PS(%rip), %r8 + lea 48+_PS(%rip), %r9 + lea 64+_PS(%rip), %r10 + lea 80+_PS(%rip), %r11 + lea 96+_PS(%rip), %r13 + lea 112+_PS(%rip), %r14 + fldt (%rdx) + lea 48+_PC(%rip), %rdx + movl %eax, 24(%rsp) + lea _PC(%rip), %rax + fmul %st(2), %st + fldt (%rcx) + lea 64+_PC(%rip), %rcx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + lea 96+_PC(%rip), %r8 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + lea 112+_PC(%rip), %r9 + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + lea _ponel_value(%rip), %r10 + faddp %st, %st(1) + fmul %st(2), %st + fildl 24(%rsp) + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r13) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r14) + faddp %st, %st(1) + fmul %st(3), %st + fmul %st(4), %st + faddp %st, %st(4) + fxch %st(3) + fmulp %st, %st(1) + fstpt (%rdi) + lea 16+_PC(%rip), %rdi + fldt (%rax) + lea 32+_PC(%rip), %rax + fmul %st(1), %st + fldt (%rdi) + lea 80+_PC(%rip), %rdi + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt (%rsi) +..B1.25: + movq 48(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.27 +..B1.26: + addq $56, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 13, -16 + .cfi_offset 14, -24 +..B1.27: + call __stack_chk_fail@PLT + .align 16,0x90 + .cfi_endproc + .type __libm_sincos_pi4l,@function + .size __libm_sincos_pi4l,.-__libm_sincos_pi4l + .data +# -- End __libm_sincos_pi4l + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 4 +ssign: + .long 1 + .long 1 + .long 1 + .long 1 + .long -1 + .long -1 + .long -1 + .long -1 + .type ssign,@object + .size ssign,32 + .align 4 +csign: + .long 1 + .long 1 + .long -1 + .long -1 + .long -1 + .long -1 + .long 1 + .long 1 + .type csign,@object + .size csign,32 + .align 2 +_pzerol_value: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _pzerol_value,@object + .size _pzerol_value,16 + .align 2 +_pion4: + .word 49717 + .word 8552 + .word 55970 + .word 51471 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _pion4,@object + .size _pion4,16 + .align 2 +_cody_thres_val: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16413 + .word 0 + .word 0 + .word 0 + .type _cody_thres_val,@object + .size _cody_thres_val,16 + .align 2 +__4onpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16383 + .word 0 + .word 0 + .word 0 + .type __4onpi,@object + .size __4onpi,16 + .align 2 +_PI04: + .word 0 + .word 0 + .word 55936 + .word 51471 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41728 + .word 34949 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 14087 + .word 41696 + .word 12696 + .word 36145 + .word 16328 + .word 0 + .word 0 + .word 0 + .type _PI04,@object + .size _PI04,48 + .align 2 +_4OPI: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33646 + .word 41721 + .word 16445 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10832 + .word 40072 + .word 16412 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44008 + .word 65043 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28384 + .word 64154 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38272 + .word 56162 + .word 16317 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7298 + .word 51682 + .word 16290 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45504 + .word 65320 + .word 16254 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61204 + .word 44922 + .word 16227 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18652 + .word 50030 + .word 16196 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14144 + .word 59657 + .word 16163 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37450 + .word 47105 + .word 16135 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14898 + .word 56641 + .word 16104 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34680 + .word 34623 + .word 16071 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4760 + .word 45515 + .word 16041 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41480 + .word 40187 + .word 16011 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47852 + .word 55252 + .word 15979 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54072 + .word 35081 + .word 15948 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26808 + .word 57421 + .word 15916 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20068 + .word 57232 + .word 15887 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49576 + .word 60188 + .word 15854 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10016 + .word 52861 + .word 15823 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30648 + .word 35825 + .word 15792 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60542 + .word 58528 + .word 15763 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65468 + .word 61743 + .word 15732 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64960 + .word 45825 + .word 15696 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50604 + .word 38792 + .word 15670 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18394 + .word 33435 + .word 15639 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55780 + .word 42703 + .word 15608 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 63841 + .word 15576 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63080 + .word 62563 + .word 15545 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20840 + .word 62207 + .word 15514 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30094 + .word 59983 + .word 15484 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61818 + .word 60389 + .word 15453 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40186 + .word 40579 + .word 15422 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42170 + .word 58004 + .word 15391 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55276 + .word 39678 + .word 15359 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44672 + .word 36806 + .word 15326 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13060 + .word 34144 + .word 15297 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28016 + .word 57231 + .word 15264 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16112 + .word 44995 + .word 15235 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53464 + .word 33387 + .word 15203 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7296 + .word 60751 + .word 15170 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29452 + .word 45231 + .word 15142 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26208 + .word 49689 + .word 15111 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37900 + .word 44002 + .word 15080 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57340 + .word 33800 + .word 15049 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27544 + .word 50178 + .word 15018 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6168 + .word 40132 + .word 14987 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21392 + .word 43702 + .word 14954 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45168 + .word 54372 + .word 14926 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8986 + .word 40688 + .word 14895 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1648 + .word 53745 + .word 14863 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30520 + .word 55795 + .word 14831 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43060 + .word 32914 + .word 14801 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46172 + .word 52771 + .word 14770 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14056 + .word 45285 + .word 14738 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53590 + .word 44868 + .word 14709 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40786 + .word 35970 + .word 14678 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33436 + .word 65411 + .word 14646 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32006 + .word 61382 + .word 14616 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37856 + .word 45239 + .word 14583 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60894 + .word 49555 + .word 14554 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48064 + .word 53065 + .word 14519 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48624 + .word 54844 + .word 14492 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7988 + .word 40762 + .word 14461 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16270 + .word 58745 + .word 14430 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37064 + .word 50168 + .word 14398 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18624 + .word 63736 + .word 14364 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60758 + .word 44966 + .word 14337 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33304 + .word 47465 + .word 14306 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6226 + .word 60503 + .word 14275 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26380 + .word 54900 + .word 14243 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44352 + .word 49860 + .word 14213 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11904 + .word 42646 + .word 14182 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55296 + .word 50279 + .word 14145 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15474 + .word 50606 + .word 14120 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45062 + .word 44137 + .word 14089 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 36063 + .word 14055 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40658 + .word 53854 + .word 14027 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28652 + .word 43690 + .word 13996 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24640 + .word 64348 + .word 13963 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30284 + .word 41980 + .word 13933 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45652 + .word 38222 + .word 13902 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15900 + .word 62940 + .word 13871 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31494 + .word 50741 + .word 13841 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43194 + .word 55096 + .word 13810 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1740 + .word 45646 + .word 13778 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28936 + .word 44150 + .word 13748 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8996 + .word 42955 + .word 13717 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44096 + .word 61205 + .word 13684 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44614 + .word 54550 + .word 13655 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24926 + .word 57347 + .word 13624 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3312 + .word 61415 + .word 13590 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64336 + .word 63884 + .word 13562 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2748 + .word 62259 + .word 13530 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56672 + .word 51775 + .word 13498 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32438 + .word 55423 + .word 13469 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17652 + .word 45713 + .word 13438 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65408 + .word 51586 + .word 13403 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40416 + .word 55736 + .word 13376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52546 + .word 37734 + .word 13345 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48880 + .word 64238 + .word 13314 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56004 + .word 46833 + .word 13282 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61760 + .word 38110 + .word 13250 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41496 + .word 35659 + .word 13219 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25472 + .word 41269 + .word 13187 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45444 + .word 36018 + .word 13159 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6510 + .word 56417 + .word 13128 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3072 + .word 56837 + .word 13097 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61338 + .word 48440 + .word 13066 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49568 + .word 57088 + .word 13034 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4240 + .word 39283 + .word 13002 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18562 + .word 33537 + .word 12973 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31422 + .word 44487 + .word 12942 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31930 + .word 60459 + .word 12911 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42272 + .word 36641 + .word 12878 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28940 + .word 36150 + .word 12849 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21010 + .word 50925 + .word 12818 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29448 + .word 64886 + .word 12786 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20500 + .word 54600 + .word 12756 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54258 + .word 46233 + .word 12725 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32628 + .word 42502 + .word 12693 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61608 + .word 55072 + .word 12663 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6236 + .word 57871 + .word 12631 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42408 + .word 34616 + .word 12601 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56692 + .word 51963 + .word 12569 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39094 + .word 48526 + .word 12539 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59870 + .word 38783 + .word 12508 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26560 + .word 33165 + .word 12477 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58666 + .word 37666 + .word 12446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58728 + .word 39788 + .word 12414 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9048 + .word 43530 + .word 12383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58496 + .word 57659 + .word 12350 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12324 + .word 37025 + .word 12322 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38432 + .word 55856 + .word 12290 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35210 + .word 45960 + .word 12260 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45644 + .word 51345 + .word 12229 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32854 + .word 63883 + .word 12198 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29348 + .word 41450 + .word 12166 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27384 + .word 38024 + .word 12134 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57356 + .word 57291 + .word 12105 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61164 + .word 51521 + .word 12073 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 59151 + .word 12041 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36704 + .word 39943 + .word 12010 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45864 + .word 50151 + .word 11981 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37892 + .word 63687 + .word 11949 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14560 + .word 51615 + .word 11918 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38776 + .word 55684 + .word 11886 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59136 + .word 53570 + .word 11855 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55556 + .word 37955 + .word 11826 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54458 + .word 44670 + .word 11795 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36446 + .word 34084 + .word 11764 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46416 + .word 51693 + .word 11731 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21432 + .word 34376 + .word 11702 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56036 + .word 34809 + .word 11671 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10562 + .word 55654 + .word 11640 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20264 + .word 53052 + .word 11608 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64064 + .word 50415 + .word 11574 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17444 + .word 48295 + .word 11546 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11874 + .word 52677 + .word 11516 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60808 + .word 39275 + .word 11485 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31792 + .word 55677 + .word 11451 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60710 + .word 49006 + .word 11423 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10520 + .word 37403 + .word 11391 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20004 + .word 59470 + .word 11360 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28096 + .word 37612 + .word 11330 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20268 + .word 44280 + .word 11298 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50740 + .word 61588 + .word 11267 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 58835 + .word 11235 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8576 + .word 42496 + .word 11200 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33920 + .word 54912 + .word 11169 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35620 + .word 54843 + .word 11143 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 736 + .word 43591 + .word 11109 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39632 + .word 61060 + .word 11080 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63452 + .word 63129 + .word 11051 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56798 + .word 58512 + .word 11020 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13472 + .word 46333 + .word 10986 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37300 + .word 36598 + .word 10957 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41952 + .word 41639 + .word 10924 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52452 + .word 33459 + .word 10895 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58558 + .word 33287 + .word 10865 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7570 + .word 43843 + .word 10834 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59416 + .word 63990 + .word 10802 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65298 + .word 47744 + .word 10772 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21076 + .word 34089 + .word 10741 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7048 + .word 57394 + .word 10710 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12872 + .word 55405 + .word 10677 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12608 + .word 51669 + .word 10643 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5350 + .word 48455 + .word 10617 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23568 + .word 58692 + .word 10585 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40784 + .word 37046 + .word 10553 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38992 + .word 43861 + .word 10523 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10064 + .word 40199 + .word 10493 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26368 + .word 35771 + .word 10456 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23994 + .word 60721 + .word 10431 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25052 + .word 34302 + .word 10399 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39842 + .word 54964 + .word 10369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11568 + .word 58277 + .word 10336 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26160 + .word 46438 + .word 10306 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23252 + .word 43049 + .word 10276 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35288 + .word 58000 + .word 10245 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14614 + .word 50216 + .word 10214 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1168 + .word 48804 + .word 10181 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60934 + .word 33006 + .word 10152 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64512 + .word 62247 + .word 10117 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59968 + .word 43121 + .word 10085 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25560 + .word 39974 + .word 10057 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1978 + .word 49353 + .word 10028 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16290 + .word 38807 + .word 9997 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8646 + .word 65226 + .word 9966 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56896 + .word 34317 + .word 9933 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40136 + .word 39118 + .word 9902 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14200 + .word 41756 + .word 9871 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59256 + .word 63202 + .word 9840 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 22968 + .word 63553 + .word 9810 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 736 + .word 44292 + .word 9778 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23186 + .word 37760 + .word 9749 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51008 + .word 34950 + .word 9714 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1664 + .word 64248 + .word 9681 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 35199 + .word 9656 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34656 + .word 63747 + .word 9625 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44330 + .word 49864 + .word 9594 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11654 + .word 35567 + .word 9563 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7924 + .word 58919 + .word 9531 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2532 + .word 32800 + .word 9500 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30024 + .word 53799 + .word 9469 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30172 + .word 64347 + .word 9438 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60036 + .word 51382 + .word 9407 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 58576 + .word 33093 + .word 9376 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13888 + .word 38760 + .word 9345 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9322 + .word 52460 + .word 9315 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20944 + .word 41077 + .word 9282 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17976 + .word 41861 + .word 9252 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55176 + .word 55158 + .word 9222 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4976 + .word 35223 + .word 9191 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7816 + .word 39783 + .word 9159 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27656 + .word 55669 + .word 9129 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64944 + .word 53184 + .word 9095 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12544 + .word 49190 + .word 9067 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50612 + .word 44644 + .word 9035 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8832 + .word 63111 + .word 9000 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11744 + .word 36870 + .word 8974 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9404 + .word 63025 + .word 8943 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47316 + .word 43381 + .word 8912 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55716 + .word 47433 + .word 8880 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46414 + .word 48441 + .word 8850 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19116 + .word 39506 + .word 8819 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48060 + .word 53381 + .word 8788 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57112 + .word 50739 + .word 8756 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5840 + .word 60581 + .word 8724 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62112 + .word 57199 + .word 8691 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35908 + .word 59499 + .word 8663 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13760 + .word 48116 + .word 8632 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3136 + .word 56059 + .word 8597 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37596 + .word 39221 + .word 8571 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3232 + .word 48550 + .word 8536 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 22872 + .word 42749 + .word 8507 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41948 + .word 40319 + .word 8478 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31196 + .word 64693 + .word 8446 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62052 + .word 52923 + .word 8416 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2750 + .word 33544 + .word 8385 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12462 + .word 46179 + .word 8354 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25128 + .word 45120 + .word 8321 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51634 + .word 62523 + .word 8292 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15758 + .word 42163 + .word 8261 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34022 + .word 36267 + .word 8230 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41252 + .word 39796 + .word 8198 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49782 + .word 54423 + .word 8168 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25428 + .word 42086 + .word 8136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34388 + .word 44810 + .word 8105 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7456 + .word 64092 + .word 8073 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48336 + .word 62448 + .word 8041 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60912 + .word 61622 + .word 8012 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17852 + .word 37250 + .word 7982 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57940 + .word 56453 + .word 7951 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47256 + .word 59825 + .word 7919 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3774 + .word 59120 + .word 7889 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43448 + .word 62852 + .word 7857 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4840 + .word 57195 + .word 7827 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40862 + .word 52565 + .word 7796 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1440 + .word 60474 + .word 7764 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55520 + .word 38648 + .word 7734 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15316 + .word 52422 + .word 7702 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 18704 + .word 47227 + .word 7672 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48892 + .word 54283 + .word 7640 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12670 + .word 41990 + .word 7610 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27570 + .word 49842 + .word 7579 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47230 + .word 47992 + .word 7548 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41020 + .word 56253 + .word 7516 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23404 + .word 58312 + .word 7486 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35176 + .word 51854 + .word 7455 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49188 + .word 59051 + .word 7423 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16656 + .word 54507 + .word 7391 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41320 + .word 48565 + .word 7362 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 302 + .word 42490 + .word 7331 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 26680 + .word 39967 + .word 7299 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41304 + .word 43638 + .word 7269 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2314 + .word 48533 + .word 7238 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63294 + .word 35693 + .word 7207 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24538 + .word 48319 + .word 7176 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56296 + .word 47263 + .word 7145 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 38599 + .word 7113 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6594 + .word 62116 + .word 7083 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47104 + .word 63573 + .word 7043 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34812 + .word 34303 + .word 7021 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5144 + .word 33695 + .word 6990 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24966 + .word 55768 + .word 6959 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62720 + .word 43946 + .word 6923 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31542 + .word 56062 + .word 6897 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 62356 + .word 59096 + .word 6865 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28412 + .word 40533 + .word 6835 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24080 + .word 50467 + .word 6803 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33296 + .word 46841 + .word 6770 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39600 + .word 38627 + .word 6742 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14436 + .word 37607 + .word 6710 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39032 + .word 56421 + .word 6678 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64032 + .word 54987 + .word 6649 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27648 + .word 42212 + .word 6613 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43840 + .word 46107 + .word 6584 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17316 + .word 36574 + .word 6556 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8928 + .word 37652 + .word 6522 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24944 + .word 47433 + .word 6493 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 57430 + .word 6461 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39848 + .word 43340 + .word 6430 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64160 + .word 43542 + .word 6400 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35226 + .word 63015 + .word 6370 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40736 + .word 64368 + .word 6338 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42168 + .word 49526 + .word 6307 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45596 + .word 34243 + .word 6277 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20690 + .word 39705 + .word 6246 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54448 + .word 46856 + .word 6213 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64392 + .word 62736 + .word 6182 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12780 + .word 56461 + .word 6152 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15360 + .word 49145 + .word 6122 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20512 + .word 49931 + .word 6087 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54512 + .word 55820 + .word 6057 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8402 + .word 39333 + .word 6029 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34094 + .word 53593 + .word 5998 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31960 + .word 38817 + .word 5966 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16954 + .word 39291 + .word 5936 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49600 + .word 48765 + .word 5901 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59580 + .word 56541 + .word 5874 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35624 + .word 44550 + .word 5843 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4142 + .word 47316 + .word 5812 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43520 + .word 43612 + .word 5780 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20976 + .word 40896 + .word 5747 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63576 + .word 57729 + .word 5719 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37288 + .word 33122 + .word 5688 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24384 + .word 52079 + .word 5654 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47952 + .word 58719 + .word 5624 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44242 + .word 55445 + .word 5595 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61232 + .word 38847 + .word 5561 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63232 + .word 46039 + .word 5528 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13396 + .word 42933 + .word 5502 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27392 + .word 43305 + .word 5467 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40708 + .word 35319 + .word 5440 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44408 + .word 55685 + .word 5409 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 42090 + .word 44607 + .word 5378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25504 + .word 53466 + .word 5345 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24208 + .word 33149 + .word 5315 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5268 + .word 45375 + .word 5285 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 144 + .word 40000 + .word 5254 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56688 + .word 52358 + .word 5221 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25848 + .word 56175 + .word 5190 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57900 + .word 44055 + .word 5160 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24800 + .word 43437 + .word 5128 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17984 + .word 54872 + .word 5094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25744 + .word 41345 + .word 5068 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 7668 + .word 43682 + .word 5036 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47434 + .word 36705 + .word 5006 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20888 + .word 40323 + .word 4974 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3962 + .word 43032 + .word 4944 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50270 + .word 49260 + .word 4913 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20160 + .word 64041 + .word 4877 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25624 + .word 36013 + .word 4849 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48328 + .word 59345 + .word 4820 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51508 + .word 63920 + .word 4788 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27872 + .word 39135 + .word 4758 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 13590 + .word 58857 + .word 4727 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 50880 + .word 61323 + .word 4692 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44802 + .word 37181 + .word 4665 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53808 + .word 57813 + .word 4634 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64424 + .word 49714 + .word 4602 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31652 + .word 44011 + .word 4572 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28252 + .word 50834 + .word 4541 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30370 + .word 38742 + .word 4510 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57728 + .word 58403 + .word 4473 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35900 + .word 37112 + .word 4448 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 40764 + .word 40914 + .word 4417 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21472 + .word 46910 + .word 4386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17854 + .word 35030 + .word 4355 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4378 + .word 35776 + .word 4324 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57962 + .word 55295 + .word 4293 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 64352 + .word 56717 + .word 4260 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37744 + .word 49416 + .word 4229 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38484 + .word 35759 + .word 4200 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 55020 + .word 54969 + .word 4169 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9188 + .word 55223 + .word 4137 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6822 + .word 43079 + .word 4107 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48870 + .word 40943 + .word 4076 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9936 + .word 42731 + .word 4043 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23430 + .word 43136 + .word 4014 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4700 + .word 55665 + .word 3982 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 8056 + .word 40216 + .word 3951 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3716 + .word 45403 + .word 3920 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53440 + .word 49488 + .word 3889 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 41776 + .word 50188 + .word 3858 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20994 + .word 64556 + .word 3828 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16252 + .word 60661 + .word 3796 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61252 + .word 65021 + .word 3765 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16236 + .word 43803 + .word 3734 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63064 + .word 35308 + .word 3702 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49096 + .word 39848 + .word 3673 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15680 + .word 48673 + .word 3642 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 48068 + .word 50957 + .word 3611 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20824 + .word 56086 + .word 3579 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46504 + .word 43224 + .word 3549 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52428 + .word 46094 + .word 3517 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17548 + .word 52066 + .word 3487 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61738 + .word 35565 + .word 3456 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31184 + .word 50588 + .word 3424 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1716 + .word 52681 + .word 3394 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44656 + .word 43385 + .word 3363 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12668 + .word 43259 + .word 3331 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24544 + .word 35408 + .word 3298 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28854 + .word 65018 + .word 3270 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5696 + .word 40391 + .word 3238 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 39580 + .word 56400 + .word 3208 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20428 + .word 39579 + .word 3177 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32328 + .word 36727 + .word 3146 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34020 + .word 54457 + .word 3115 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34016 + .word 48400 + .word 3083 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6922 + .word 51417 + .word 3053 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27208 + .word 64641 + .word 3021 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1802 + .word 48886 + .word 2991 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 35440 + .word 61590 + .word 2960 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 60610 + .word 51604 + .word 2929 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5440 + .word 38199 + .word 2895 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6914 + .word 43867 + .word 2867 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 24000 + .word 45256 + .word 2834 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51496 + .word 57396 + .word 2804 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11538 + .word 46256 + .word 2774 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36802 + .word 48020 + .word 2743 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57910 + .word 57903 + .word 2712 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47484 + .word 48798 + .word 2680 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 57766 + .word 57709 + .word 2650 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54064 + .word 47856 + .word 2619 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49340 + .word 48080 + .word 2588 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36454 + .word 56731 + .word 2557 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51548 + .word 63385 + .word 2526 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56000 + .word 48716 + .word 2490 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 44992 + .word 50040 + .word 2460 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43136 + .word 58177 + .word 2430 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49730 + .word 33270 + .word 2402 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 29808 + .word 51063 + .word 2371 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25276 + .word 46724 + .word 2339 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17324 + .word 35928 + .word 2308 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52284 + .word 63916 + .word 2278 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5414 + .word 46704 + .word 2247 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51710 + .word 57168 + .word 2216 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27366 + .word 49253 + .word 2185 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 45332 + .word 53033 + .word 2154 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 54152 + .word 37418 + .word 2121 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53076 + .word 47398 + .word 2092 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 14374 + .word 59477 + .word 2061 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59336 + .word 33435 + .word 2029 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21612 + .word 43267 + .word 1999 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34664 + .word 39372 + .word 1966 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 172 + .word 62761 + .word 1936 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9816 + .word 40715 + .word 1905 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65116 + .word 40481 + .word 1875 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28066 + .word 39184 + .word 1844 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37408 + .word 63923 + .word 1813 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15760 + .word 42305 + .word 1782 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 28236 + .word 59340 + .word 1750 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43258 + .word 59402 + .word 1720 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19988 + .word 50087 + .word 1689 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63456 + .word 47833 + .word 1655 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 65184 + .word 61426 + .word 1626 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52982 + .word 48456 + .word 1596 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30020 + .word 62809 + .word 1564 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9096 + .word 63061 + .word 1533 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59648 + .word 44374 + .word 1499 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11456 + .word 33847 + .word 1470 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 12392 + .word 50500 + .word 1440 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 56432 + .word 59196 + .word 1408 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61008 + .word 40265 + .word 1377 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37842 + .word 33270 + .word 1348 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 37916 + .word 44543 + .word 1316 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11490 + .word 36421 + .word 1286 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19040 + .word 38397 + .word 1254 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 31224 + .word 47162 + .word 1224 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 52056 + .word 41461 + .word 1192 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 10810 + .word 56374 + .word 1162 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 5358 + .word 35086 + .word 1131 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 36640 + .word 50226 + .word 1096 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33856 + .word 45597 + .word 1067 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21552 + .word 63128 + .word 1036 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1198 + .word 35616 + .word 1007 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 1232 + .word 59506 + .word 976 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 51086 + .word 34963 + .word 945 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 3960 + .word 39061 + .word 912 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 4564 + .word 57134 + .word 882 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 59468 + .word 35285 + .word 852 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 63422 + .word 35431 + .word 821 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38352 + .word 51462 + .word 790 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 25806 + .word 55660 + .word 759 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 38842 + .word 41327 + .word 728 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 17980 + .word 50458 + .word 697 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 61194 + .word 59710 + .word 666 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21098 + .word 42086 + .word 635 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 16704 + .word 43341 + .word 602 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 46316 + .word 52840 + .word 573 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20386 + .word 33936 + .word 542 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20064 + .word 51864 + .word 509 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 2268 + .word 57500 + .word 479 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 11152 + .word 51171 + .word 449 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 23164 + .word 63727 + .word 417 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 20514 + .word 40280 + .word 387 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 21818 + .word 57922 + .word 356 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32366 + .word 46413 + .word 325 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 53972 + .word 43148 + .word 294 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 30134 + .word 65133 + .word 263 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 15282 + .word 61516 + .word 232 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 49872 + .word 49222 + .word 200 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 9484 + .word 63958 + .word 170 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 47028 + .word 35341 + .word 139 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 6770 + .word 58613 + .word 108 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 33372 + .word 43448 + .word 77 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 27792 + .word 51629 + .word 43 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 19712 + .word 53691 + .word 15 + .word 0 + .word 0 + .word 0 + .type _4OPI,@object + .size _4OPI,8512 + .space 192, 0x00 # pad + .align 2 +_ADDING: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16446 + .word 0 + .word 0 + .word 0 + .type _ADDING,@object + .size _ADDING,16 + .align 2 +_nonel_value: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _nonel_value,@object + .size _nonel_value,16 + .align 2 +_PC: + .word 23996 + .word 61276 + .word 60076 + .word 54715 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 29541 + .word 45883 + .word 23690 + .word 51658 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 41007 + .word 30189 + .word 50933 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 11013 + .word 35124 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 13032 + .word 3304 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 45630 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .type _PC,@object + .size _PC,128 + .align 2 +_ponel_value: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _ponel_value,@object + .size _ponel_value,16 + .align 2 +_PS: + .word 25 + .word 22807 + .word 53737 + .word 51452 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 54536 + .word 42444 + .word 58524 + .word 55101 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 63911 + .word 27722 + .word 12213 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 3718 + .word 18986 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 10480 + .word 46680 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 12958 + .word 3329 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 35030 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _PS,@object + .size _PS,128 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sincosd_table.S b/external/sgx_libm/intel64/sincosd_table.S new file mode 100644 index 0000000000..369422e4b4 --- /dev/null +++ b/external/sgx_libm/intel64/sincosd_table.S @@ -0,0 +1,767 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincosd_table.c" + .section .rodata, "a" + .align 16 + .align 16 + .globl __libm_sindl_cosdl_table +__libm_sindl_cosdl_table: + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 730455326 + .long 1066524427 + .long 1746175880 + .long 1010139981 + .long 2549460874 + .long 1072692928 + .long 4286585365 + .long 3162605893 + .long 3388464167 + .long 1067572824 + .long 3405773388 + .long 1011262106 + .long 2025784679 + .long 1072691970 + .long 3458349249 + .long 3162669794 + .long 1223674126 + .long 1068157895 + .long 1350368814 + .long 3158420169 + .long 3977438749 + .long 1072690373 + .long 2138672104 + .long 1015504988 + .long 1835684136 + .long 1068620687 + .long 3698316769 + .long 3158223757 + .long 1903230966 + .long 1072688139 + .long 1549185311 + .long 1015860439 + .long 3099754755 + .long 1068912598 + .long 85775068 + .long 3160181596 + .long 3021477282 + .long 1072685267 + .long 1009168830 + .long 3161309439 + .long 2604423020 + .long 1069204064 + .long 2303648607 + .long 1009017464 + .long 2499307462 + .long 1072681759 + .long 1081812731 + .long 1015750919 + .long 1280271059 + .long 1069494996 + .long 1784430238 + .long 1012342196 + .long 631389835 + .long 1072677616 + .long 319889322 + .long 1015931913 + .long 2525863449 + .long 1069666412 + .long 3319430370 + .long 1012720668 + .long 2838533242 + .long 1072672838 + .long 3931096191 + .long 3163228296 + .long 1739084661 + .long 1069811211 + .long 266127812 + .long 1005440081 + .long 2486166620 + .long 1072667428 + .long 1862034983 + .long 3163124964 + .long 2114679690 + .long 1069955610 + .long 1043937223 + .long 3160884320 + .long 2357271575 + .long 1072661387 + .long 1809738197 + .long 1015448300 + .long 3715523151 + .long 1070099565 + .long 3282620278 + .long 1013092107 + .long 1765324482 + .long 1072654717 + .long 2731192352 + .long 3162086677 + .long 2890029302 + .long 1070243033 + .long 2223107338 + .long 3159965253 + .long 846856320 + .long 1072647420 + .long 116450415 + .long 3163379753 + .long 919455349 + .long 1070385970 + .long 2064618035 + .long 3159935516 + .long 558794511 + .long 1072639498 + .long 1424282741 + .long 3161718678 + .long 4075075869 + .long 1070528331 + .long 3748620424 + .long 3160490968 + .long 2675554853 + .long 1072630953 + .long 3840651826 + .long 3156703495 + .long 3247638160 + .long 1070633085 + .long 3696489768 + .long 1014652612 + .long 1195949845 + .long 1072621789 + .long 1259393923 + .long 3162332067 + .long 3711077929 + .long 1070703626 + .long 3146917124 + .long 1014611084 + .long 3814620032 + .long 1072612007 + .long 3070837564 + .long 3162674392 + .long 3481523655 + .long 1070773815 + .long 2713761655 + .long 1014001377 + .long 1853610783 + .long 1072601612 + .long 3649998803 + .long 1015704482 + .long 925886800 + .long 1070843631 + .long 436010265 + .long 3162460259 + .long 323245311 + .long 1072590606 + .long 3093873492 + .long 1015519453 + .long 3489713627 + .long 1070913051 + .long 528334979 + .long 1014764117 + .long 738112715 + .long 1072578992 + .long 334349375 + .long 3162809522 + .long 1955204085 + .long 1070982056 + .long 1689242582 + .long 1014445850 + .long 1112681756 + .long 1072566774 + .long 1734695380 + .long 3163113281 + .long 533648188 + .long 1071050624 + .long 3960375553 + .long 1012377538 + .long 251639813 + .long 1072553956 + .long 3380683078 + .long 1012638586 + .long 4008023681 + .long 1071118733 + .long 570275026 + .long 1014484594 + .long 2039991128 + .long 1072540541 + .long 1062999797 + .long 3162182390 + .long 580452267 + .long 1071186365 + .long 3449718872 + .long 3161633148 + .long 2553046639 + .long 1072526534 + .long 2419472295 + .long 3163244343 + .long 554048209 + .long 1071253497 + .long 2399772791 + .long 3156410517 + .long 2935979925 + .long 1072511939 + .long 1428602113 + .long 1015064920 + .long 2000132179 + .long 1071320109 + .long 2171125689 + .long 3159852223 + .long 808310631 + .long 1072496761 + .long 4227501583 + .long 1014931887 + .long 3669886408 + .long 1071386181 + .long 3536165134 + .long 1013933230 + .long 3142990026 + .long 1072481003 + .long 4101727212 + .long 3163150444 + .long 725933569 + .long 1071451694 + .long 522349177 + .long 3161311953 + .long 490548333 + .long 1072464672 + .long 2395907389 + .long 3162833649 + .long 1948536952 + .long 1071516626 + .long 320619183 + .long 1014863857 + .long 1332553480 + .long 1072447771 + .long 3321840403 + .long 3163208850 + .long 3991904492 + .long 1071580958 + .long 2374541978 + .long 1014892768 + .long 2010331591 + .long 1072430306 + .long 1428309641 + .long 3163418034 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .long 3898100906 + .long 1072412282 + .long 3501572579 + .long 1015868565 + .long 553508627 + .long 1071676209 + .long 3116078237 + .long 1016033865 + .long 511109854 + .long 1072393706 + .long 3227708102 + .long 3163199948 + .long 1051516202 + .long 1071707417 + .long 2823792103 + .long 1015984420 + .long 3268258117 + .long 1072374581 + .long 893580578 + .long 1013933326 + .long 3614471965 + .long 1071738286 + .long 2346555295 + .long 3158494963 + .long 2829987804 + .long 1072354915 + .long 4086147764 + .long 3161968777 + .long 2215771410 + .long 1071768808 + .long 2812627676 + .long 1015346091 + .long 3450400421 + .long 1072334713 + .long 2241324349 + .long 3163087632 + .long 4168894840 + .long 1071798972 + .long 555969416 + .long 1015775320 + .long 1494583111 + .long 1072313982 + .long 92043893 + .long 3160700658 + .long 74799710 + .long 1071828771 + .long 2770520589 + .long 3160558553 + .long 2610427048 + .long 1072292727 + .long 436010265 + .long 3162460259 + .long 2488647350 + .long 1071858193 + .long 3884027735 + .long 1013773085 + .long 245529108 + .long 1072270956 + .long 3304882442 + .long 1014213155 + .long 2982005049 + .long 1071887231 + .long 3980032926 + .long 3161177863 + .long 1408525265 + .long 1072248674 + .long 1201054953 + .long 1015994881 + .long 2219342526 + .long 1071915876 + .long 3430823751 + .long 3163318748 + .long 890610472 + .long 1072225889 + .long 1982309908 + .long 3162056199 + .long 1379669533 + .long 1071944119 + .long 3329850390 + .long 3162839200 + .long 2731495481 + .long 1072202607 + .long 1347545148 + .long 1014567853 + .long 2167951316 + .long 1071971951 + .long 2070879930 + .long 1013227818 + .long 3030457399 + .long 1072178836 + .long 162525240 + .long 3161624810 + .long 2531396568 + .long 1071999364 + .long 4091857862 + .long 3162202094 + .long 2821963458 + .long 1072154583 + .long 1545337900 + .long 3160735078 + .long 965516331 + .long 1072026350 + .long 156922899 + .long 1014731144 + .long 3771230594 + .long 1072129855 + .long 3521184819 + .long 1014696396 + .long 820015888 + .long 1072052900 + .long 2191736501 + .long 1015202773 + .long 3869592889 + .long 1072104660 + .long 2133682458 + .long 3163440098 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 1719614413 + .long 1072079006 + .long 330458198 + .long 3163282740 + .long 3869592889 + .long 1072104660 + .long 2133682458 + .long 3163440098 + .long 820015888 + .long 1072052900 + .long 2191736501 + .long 1015202773 + .long 3771230594 + .long 1072129855 + .long 3521184819 + .long 1014696396 + .long 965516331 + .long 1072026350 + .long 156922899 + .long 1014731144 + .long 2821963458 + .long 1072154583 + .long 1545337900 + .long 3160735078 + .long 2531396568 + .long 1071999364 + .long 4091857862 + .long 3162202094 + .long 3030457399 + .long 1072178836 + .long 162525240 + .long 3161624810 + .long 2167951316 + .long 1071971951 + .long 2070879930 + .long 1013227818 + .long 2731495481 + .long 1072202607 + .long 1347545148 + .long 1014567853 + .long 1379669533 + .long 1071944119 + .long 3329850390 + .long 3162839200 + .long 890610472 + .long 1072225889 + .long 1982309908 + .long 3162056199 + .long 2219342526 + .long 1071915876 + .long 3430823751 + .long 3163318748 + .long 1408525265 + .long 1072248674 + .long 1201054953 + .long 1015994881 + .long 2982005049 + .long 1071887231 + .long 3980032926 + .long 3161177863 + .long 245529108 + .long 1072270956 + .long 3304882442 + .long 1014213155 + .long 2488647350 + .long 1071858193 + .long 3884027735 + .long 1013773085 + .long 2610427048 + .long 1072292727 + .long 436010265 + .long 3162460259 + .long 74799710 + .long 1071828771 + .long 2770520589 + .long 3160558553 + .long 1494583111 + .long 1072313982 + .long 92043893 + .long 3160700658 + .long 4168894840 + .long 1071798972 + .long 555969416 + .long 1015775320 + .long 3450400421 + .long 1072334713 + .long 2241324349 + .long 3163087632 + .long 2215771410 + .long 1071768808 + .long 2812627676 + .long 1015346091 + .long 2829987804 + .long 1072354915 + .long 4086147764 + .long 3161968777 + .long 3614471965 + .long 1071738286 + .long 2346555295 + .long 3158494963 + .long 3268258117 + .long 1072374581 + .long 893580578 + .long 1013933326 + .long 1051516202 + .long 1071707417 + .long 2823792103 + .long 1015984420 + .long 511109854 + .long 1072393706 + .long 3227708102 + .long 3163199948 + .long 553508627 + .long 1071676209 + .long 3116078237 + .long 1016033865 + .long 3898100906 + .long 1072412282 + .long 3501572579 + .long 1015868565 + .long 0 + .long 1071644672 + .long 0 + .long 0 + .long 2010331591 + .long 1072430306 + .long 1428309641 + .long 3163418034 + .long 3991904492 + .long 1071580958 + .long 2374541978 + .long 1014892768 + .long 1332553480 + .long 1072447771 + .long 3321840403 + .long 3163208850 + .long 1948536952 + .long 1071516626 + .long 320619183 + .long 1014863857 + .long 490548333 + .long 1072464672 + .long 2395907389 + .long 3162833649 + .long 725933569 + .long 1071451694 + .long 522349177 + .long 3161311953 + .long 3142990026 + .long 1072481003 + .long 4101727212 + .long 3163150444 + .long 3669886408 + .long 1071386181 + .long 3536165134 + .long 1013933230 + .long 808310631 + .long 1072496761 + .long 4227501583 + .long 1014931887 + .long 2000132179 + .long 1071320109 + .long 2171125689 + .long 3159852223 + .long 2935979925 + .long 1072511939 + .long 1428602113 + .long 1015064920 + .long 554048209 + .long 1071253497 + .long 2399772791 + .long 3156410517 + .long 2553046639 + .long 1072526534 + .long 2419472295 + .long 3163244343 + .long 580452267 + .long 1071186365 + .long 3449718872 + .long 3161633148 + .long 2039991128 + .long 1072540541 + .long 1062999797 + .long 3162182390 + .long 4008023681 + .long 1071118733 + .long 570275026 + .long 1014484594 + .long 251639813 + .long 1072553956 + .long 3380683078 + .long 1012638586 + .long 533648188 + .long 1071050624 + .long 3960375553 + .long 1012377538 + .long 1112681756 + .long 1072566774 + .long 1734695380 + .long 3163113281 + .long 1955204085 + .long 1070982056 + .long 1689242582 + .long 1014445850 + .long 738112715 + .long 1072578992 + .long 334349375 + .long 3162809522 + .long 3489713627 + .long 1070913051 + .long 528334979 + .long 1014764117 + .long 323245311 + .long 1072590606 + .long 3093873492 + .long 1015519453 + .long 925886800 + .long 1070843631 + .long 436010265 + .long 3162460259 + .long 1853610783 + .long 1072601612 + .long 3649998803 + .long 1015704482 + .long 3481523655 + .long 1070773815 + .long 2713761655 + .long 1014001377 + .long 3814620032 + .long 1072612007 + .long 3070837564 + .long 3162674392 + .long 3711077929 + .long 1070703626 + .long 3146917124 + .long 1014611084 + .long 1195949845 + .long 1072621789 + .long 1259393923 + .long 3162332067 + .long 3247638160 + .long 1070633085 + .long 3696489768 + .long 1014652612 + .long 2675554853 + .long 1072630953 + .long 3840651826 + .long 3156703495 + .long 4075075869 + .long 1070528331 + .long 3748620424 + .long 3160490968 + .long 558794511 + .long 1072639498 + .long 1424282741 + .long 3161718678 + .long 919455349 + .long 1070385970 + .long 2064618035 + .long 3159935516 + .long 846856320 + .long 1072647420 + .long 116450415 + .long 3163379753 + .long 2890029302 + .long 1070243033 + .long 2223107338 + .long 3159965253 + .long 1765324482 + .long 1072654717 + .long 2731192352 + .long 3162086677 + .long 3715523151 + .long 1070099565 + .long 3282620278 + .long 1013092107 + .long 2357271575 + .long 1072661387 + .long 1809738197 + .long 1015448300 + .long 2114679690 + .long 1069955610 + .long 1043937223 + .long 3160884320 + .long 2486166620 + .long 1072667428 + .long 1862034983 + .long 3163124964 + .long 1739084661 + .long 1069811211 + .long 266127812 + .long 1005440081 + .long 2838533242 + .long 1072672838 + .long 3931096191 + .long 3163228296 + .long 2525863449 + .long 1069666412 + .long 3319430370 + .long 1012720668 + .long 631389835 + .long 1072677616 + .long 319889322 + .long 1015931913 + .long 1280271059 + .long 1069494996 + .long 1784430238 + .long 1012342196 + .long 2499307462 + .long 1072681759 + .long 1081812731 + .long 1015750919 + .long 2604423020 + .long 1069204064 + .long 2303648607 + .long 1009017464 + .long 3021477282 + .long 1072685267 + .long 1009168830 + .long 3161309439 + .long 3099754755 + .long 1068912598 + .long 85775068 + .long 3160181596 + .long 1903230966 + .long 1072688139 + .long 1549185311 + .long 1015860439 + .long 1835684136 + .long 1068620687 + .long 3698316769 + .long 3158223757 + .long 3977438749 + .long 1072690373 + .long 2138672104 + .long 1015504988 + .long 1223674126 + .long 1068157895 + .long 1350368814 + .long 3158420169 + .long 2025784679 + .long 1072691970 + .long 3458349249 + .long 3162669794 + .long 3388464167 + .long 1067572824 + .long 3405773388 + .long 1011262106 + .long 2549460874 + .long 1072692928 + .long 4286585365 + .long 3162605893 + .long 730455326 + .long 1066524427 + .long 1746175880 + .long 1010139981 + .type __libm_sindl_cosdl_table,@object + .size __libm_sindl_cosdl_table,2880 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/sincosf_gen.S b/external/sgx_libm/intel64/sincosf_gen.S new file mode 100644 index 0000000000..cce988fef3 --- /dev/null +++ b/external/sgx_libm/intel64/sincosf_gen.S @@ -0,0 +1,531 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincosf_gen.c" + .text +..TXTST0: +# -- Begin sincosf + .text + .align 16,0x90 + .globl sincosf +sincosf: +# parameter 1: %xmm0 +# parameter 2: %rdi +# parameter 3: %rsi +..B1.1: + .cfi_startproc +..___tag_value_sincosf.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) +..B1.2: + pextrw $1, %xmm0, %eax + andw $32767, %ax + subw $128, %ax + cmpw $17791, %ax + ja .L_2TAG_PACKET_0.0.1 + movq PI_32_RECIP(%rip), %xmm1 + mulss %xmm0, %xmm1 + movapd BIT_31(%rip), %xmm3 + cvtss2si %xmm1, %edx + movl %edx, %ecx + andpd %xmm0, %xmm3 + cvtss2sd %xmm0, %xmm0 + movlhps %xmm0, %xmm0 + addss SHIFTER(%rip), %xmm1 + subss SHIFTER(%rip), %xmm1 + movapd %xmm3, %xmm4 + psllq $32, %xmm3 + psllq $29, %xmm4 + xorpd %xmm4, %xmm3 + addl $1865216, %edx + shll $4, %edx + addl $1865232, %ecx + shll $4, %ecx + movq P_1(%rip), %xmm2 + xorpd %xmm3, %xmm2 + xorpd P_2(%rip), %xmm3 + movlhps %xmm2, %xmm2 + movlhps %xmm3, %xmm3 + lea Ctable(%rip), %rax + andq $1008, %rdx + andq $1008, %rcx + addq %rax, %rcx + addq %rdx, %rax + psllq $29, %xmm1 + movlhps %xmm1, %xmm1 + mulpd %xmm1, %xmm2 + mulpd %xmm1, %xmm3 + subpd %xmm2, %xmm0 + addpd %xmm0, %xmm3 + mulpd %xmm0, %xmm0 + movapd C_1(%rip), %xmm4 + movapd S_1(%rip), %xmm5 + movapd ONE(%rip), %xmm1 + mulpd %xmm0, %xmm4 + mulpd %xmm0, %xmm5 + movapd C_2(%rip), %xmm6 + movapd S_2(%rip), %xmm7 + mulpd %xmm0, %xmm0 + addpd %xmm1, %xmm4 + mulpd %xmm0, %xmm6 + addpd %xmm1, %xmm5 + mulpd %xmm0, %xmm7 + addpd %xmm6, %xmm4 + addpd %xmm7, %xmm5 + movq (%rax), %xmm2 + movq 8(%rax), %xmm1 + movhpd (%rcx), %xmm2 + movhpd 8(%rcx), %xmm1 + mulpd %xmm1, %xmm3 + mulpd %xmm4, %xmm2 + mulpd %xmm5, %xmm3 + addpd %xmm3, %xmm2 + cvtpd2ps %xmm2, %xmm0 + movq (%rsp), %rax + movss %xmm0, (%rax) + movq 8(%rsp), %rax + pshufd $1, %xmm0, %xmm0 + movss %xmm0, (%rax) + jmp ..B1.7 +.L_2TAG_PACKET_0.0.1: + jg .L_2TAG_PACKET_1.0.1 + cvtss2sd %xmm0, %xmm0 + movq ONE(%rip), %xmm1 + movq %xmm0, %xmm2 + mulsd ONE_M230(%rip), %xmm0 + mulsd %xmm2, %xmm2 + subsd %xmm2, %xmm1 + cvtsd2ss %xmm0, %xmm0 + cvtsd2ss %xmm1, %xmm1 + movq (%rsp), %rax + movss %xmm0, (%rax) + movq 8(%rsp), %rax + movss %xmm1, (%rax) + jmp ..B1.7 +.L_2TAG_PACKET_1.0.1: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_2.0.1 + cvtss2sd %xmm0, %xmm0 + movq %xmm0, 16(%rsp) +..B1.3: + movsd 16(%rsp), %xmm0 +..___tag_value_sincosf.4: + call __libm_sse2_sincos@PLT +..___tag_value_sincosf.5: +..B1.4: + movsd %xmm0, 24(%rsp) +..B1.5: + movq 24(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + cvtsd2ss %xmm1, %xmm1 + movq (%rsp), %rax + movss %xmm0, (%rax) + movq 8(%rsp), %rax + movss %xmm1, (%rax) + jmp ..B1.7 +.L_2TAG_PACKET_2.0.1: + pxor %xmm1, %xmm1 + mulss %xmm1, %xmm0 + movq (%rsp), %rax + movss %xmm0, (%rax) + movq 8(%rsp), %rax + movss %xmm0, (%rax) +.L_2TAG_PACKET_3.0.1: +..B1.7: + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type sincosf,@function + .size sincosf,.-sincosf + .data +# -- End sincosf + .section .rodata, "a" + .align 16 + .align 16 +BIT_31: + .long 2147483648 + .long 0 + .long 0 + .long 0 + .type BIT_31,@object + .size BIT_31,16 + .align 16 +P_1: + .long 1413758976 + .long 2008621563 + .type P_1,@object + .size P_1,8 + .space 8, 0x00 # pad + .align 16 +P_2: + .long 1734816687 + .long 1966270393 + .type P_2,@object + .size P_2,8 + .space 8, 0x00 # pad + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 1072683149 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 1072652951 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 1072602945 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 1072533611 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 1072445618 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 1072339814 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 1072217216 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 1072079006 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 1071926515 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 1071761211 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 1071524701 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 1071152610 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 1070765062 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 1070135480 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 1069094822 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 2748392742 + .long 1072683149 + .long 3156849708 + .long 3216578470 + .long 3489094832 + .long 1072652951 + .long 1013556747 + .long 3217619128 + .long 1455828442 + .long 1072602945 + .long 785751814 + .long 3218248710 + .long 3476196678 + .long 1072533611 + .long 2796464483 + .long 3218636258 + .long 4051746225 + .long 1072445618 + .long 939980347 + .long 3219008349 + .long 688824739 + .long 1072339814 + .long 967731400 + .long 3219244859 + .long 1796544321 + .long 1072217216 + .long 621354454 + .long 3219410163 + .long 1719614413 + .long 1072079006 + .long 1719614413 + .long 3219562654 + .long 621354454 + .long 1071926515 + .long 1796544321 + .long 3219700864 + .long 967731400 + .long 1071761211 + .long 688824739 + .long 3219823462 + .long 939980347 + .long 1071524701 + .long 4051746225 + .long 3219929266 + .long 2796464483 + .long 1071152610 + .long 3476196678 + .long 3220017259 + .long 785751814 + .long 1070765062 + .long 1455828442 + .long 3220086593 + .long 1013556747 + .long 1070135480 + .long 3489094832 + .long 3220136599 + .long 3156849708 + .long 1069094822 + .long 2748392742 + .long 3220166797 + .long 0 + .long 0 + .long 0 + .long 3220176896 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 3220166797 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 3220136599 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 3220086593 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 3220017259 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 3219929266 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 3219823462 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 3219700864 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 3219562654 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 3219410163 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 3219244859 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 3219008349 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 3218636258 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 3218248710 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 3217619128 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 3216578470 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 2748392742 + .long 3220166797 + .long 3156849708 + .long 1069094822 + .long 3489094832 + .long 3220136599 + .long 1013556747 + .long 1070135480 + .long 1455828442 + .long 3220086593 + .long 785751814 + .long 1070765062 + .long 3476196678 + .long 3220017259 + .long 2796464483 + .long 1071152610 + .long 4051746225 + .long 3219929266 + .long 939980347 + .long 1071524701 + .long 688824739 + .long 3219823462 + .long 967731400 + .long 1071761211 + .long 1796544321 + .long 3219700864 + .long 621354454 + .long 1071926515 + .long 1719614413 + .long 3219562654 + .long 1719614413 + .long 1072079006 + .long 621354454 + .long 3219410163 + .long 1796544321 + .long 1072217216 + .long 967731400 + .long 3219244859 + .long 688824739 + .long 1072339814 + .long 939980347 + .long 3219008349 + .long 4051746225 + .long 1072445618 + .long 2796464483 + .long 3218636258 + .long 3476196678 + .long 1072533611 + .long 785751814 + .long 3218248710 + .long 1455828442 + .long 1072602945 + .long 1013556747 + .long 3217619128 + .long 3489094832 + .long 1072652951 + .long 3156849708 + .long 3216578470 + .long 2748392742 + .long 1072683149 + .type Ctable,@object + .size Ctable,1024 + .align 16 +C_1: + .long 0 + .long 3219128320 + .long 0 + .long 3219128320 + .type C_1,@object + .size C_1,16 + .align 16 +S_1: + .long 1431655765 + .long 3217380693 + .long 1431655765 + .long 3217380693 + .type S_1,@object + .size S_1,16 + .align 16 +ONE: + .long 0 + .long 1072693248 + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,16 + .align 16 +C_2: + .long 1431655765 + .long 1067799893 + .long 1431655765 + .long 1067799893 + .type C_2,@object + .size C_2,16 + .align 16 +S_2: + .long 286331153 + .long 1065423121 + .long 286331153 + .long 1065423121 + .type S_2,@object + .size S_2,16 + .align 8 +PI_32_RECIP: + .long 1092811139 + .long 0 + .type PI_32_RECIP,@object + .size PI_32_RECIP,8 + .align 8 +SHIFTER: + .long 1262485504 + .type SHIFTER,@object + .size SHIFTER,4 + .space 4, 0x00 # pad + .align 8 +ONE_M230: + .long 4286578688 + .long 1072693247 + .type ONE_M230,@object + .size ONE_M230,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sincosl.S b/external/sgx_libm/intel64/sincosl.S new file mode 100644 index 0000000000..4fb7522bf7 --- /dev/null +++ b/external/sgx_libm/intel64/sincosl.S @@ -0,0 +1,1226 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sincosl.c" + .text +..TXTST0: +# -- Begin sincosl + .text + .align 16,0x90 + .globl sincosl +sincosl: +# parameter 1: 224 + %rsp +# parameter 2: %rdi +# parameter 3: %rsi +..B1.1: + .cfi_startproc +..___tag_value_sincosl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $176, %rsp + .cfi_def_cfa_offset 224 + movq %rsi, %r14 + movq %fs:40, %rax + movq %rdi, %r13 + xorq %rsp, %rax + xorb %r12b, %r12b + movq %rax, 168(%rsp) +..B1.2: + fnstcw 146(%rsp) +..B1.3: + movzwl 232(%rsp), %edx + andl $32767, %edx + movzwl 146(%rsp), %ecx + cmpl $32767, %edx + je ..B1.70 +..B1.4: + cmpl $16378, %edx + jge ..B1.42 +..B1.5: + cmpl $16372, %edx + jge ..B1.34 +..B1.6: + cmpl $16364, %edx + jge ..B1.26 +..B1.7: + cmpl $16308, %edx + jge ..B1.18 +..B1.8: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.9: + orl $-64768, %ecx + movw %cx, 144(%rsp) +..B1.10: + fldcw 144(%rsp) +..B1.11: + movzwl 232(%rsp), %edx + movb $1, %r12b + andl $32767, %edx +..B1.12: + testl %edx, %edx + jle ..B1.59 +..B1.13: + fldt 224(%rsp) + lea _TWO_75(%rip), %rax + lea _small_value_80(%rip), %rcx + lea 8+_TWO_75(%rip), %rdx + lea _ones(%rip), %rbx + fldl (%rax) + fmul %st(1), %st + fsubp %st, %st(1) + fldt (%rcx) + fsubrl (%rbx) + fstpt 32(%rsp) + fmull (%rdx) + fstpt 16(%rsp) +..B1.14: + testb %r12b, %r12b + je ..B1.16 +..B1.15: + fldcw 146(%rsp) +..B1.16: + fldt 16(%rsp) + fstpt (%r13) + fldt 32(%rsp) + fstpt (%r14) + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.17: + addq $176, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 224 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.18: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.22 +..B1.19: + orl $-64768, %ecx + movw %cx, 144(%rsp) +..B1.20: + fldcw 144(%rsp) +..B1.21: + movb $1, %r12b +..B1.22: + fldt 224(%rsp) + lea _SP3(%rip), %rax + lea _CP3(%rip), %rdx + lea _ones(%rip), %rcx + testb %r12b, %r12b + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + fadd %st(1), %st + fstpt 32(%rsp) + fldt (%rdx) + fmul %st(1), %st + fmulp %st, %st(1) + faddl (%rcx) + fstpt 16(%rsp) + je ..B1.24 +..B1.23: + fldcw 146(%rsp) +..B1.24: + fldt 32(%rsp) + fstpt (%r13) + fldt 16(%rsp) + fstpt (%r14) + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.25: + addq $176, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 224 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.26: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.30 +..B1.27: + orl $-64768, %ecx + movw %cx, 144(%rsp) +..B1.28: + fldcw 144(%rsp) +..B1.29: + movb $1, %r12b +..B1.30: + fldt 224(%rsp) + lea 16+_SP2(%rip), %rax + fld %st(0) + lea _SP2(%rip), %rdx + fmul %st(1), %st + lea 16+_CP2(%rip), %rcx + fldt (%rax) + lea _CP2(%rip), %rbx + fmul %st(1), %st + lea _ones(%rip), %rbp + fldt (%rdx) + testb %r12b, %r12b + faddp %st, %st(1) + fmul %st(1), %st + fmul %st(2), %st + faddp %st, %st(2) + fxch %st(1) + fstpt 32(%rsp) + fldt (%rcx) + fmul %st(1), %st + fldt (%rbx) + faddp %st, %st(1) + fmulp %st, %st(1) + faddl (%rbp) + fstpt 16(%rsp) + je ..B1.32 +..B1.31: + fldcw 146(%rsp) +..B1.32: + fldt 32(%rsp) + fstpt (%r13) + fldt 16(%rsp) + fstpt (%r14) + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.33: + addq $176, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 224 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.34: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.35: + orl $-64768, %ecx + movw %cx, 144(%rsp) +..B1.36: + fldcw 144(%rsp) +..B1.37: + movb $1, %r12b +..B1.38: + fldt 224(%rsp) + lea 32+_SP1(%rip), %rcx + fld %st(0) + lea _SP1(%rip), %rbx + fmul %st(1), %st + lea 48+_SP1(%rip), %rax + fld %st(0) + lea 48+_CP1(%rip), %rbp + fmul %st(1), %st + lea 16+_SP1(%rip), %rdx + fldt (%rax) + lea 16+_CP1(%rip), %rsi + fmul %st(1), %st + lea 32+_CP1(%rip), %rdi + fldt (%rdx) + lea _CP1(%rip), %r8 + lea _ones(%rip), %r9 + testb %r12b, %r12b + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmul %st(2), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(3) + fxch %st(2) + fstpt 32(%rsp) + fldt (%rbp) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rdi) + fmulp %st, %st(3) + fldt (%r8) + faddp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + faddl (%r9) + fstpt 16(%rsp) + je ..B1.40 +..B1.39: + fldcw 146(%rsp) +..B1.40: + fldt 32(%rsp) + fstpt (%r13) + fldt 16(%rsp) + fstpt (%r14) + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.41: + addq $176, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 224 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.42: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.46 +..B1.43: + orl $-64768, %ecx + movw %cx, 144(%rsp) +..B1.44: + fldcw 144(%rsp) +..B1.45: + movb $1, %r12b +..B1.46: + fldt 224(%rsp) + lea _ones(%rip), %rbp + movzbl 233(%rsp), %ebx + xorl %eax, %eax + andl $128, %ebx + shrl $7, %ebx + fmull (%rbp,%rbx,8) + fstpt 224(%rsp) + fldt 224(%rsp) + movzwl 232(%rsp), %edx + andl $32767, %edx + cmpl $16382, %edx + jge ..B1.48 +..B1.47: + lea _TWO_52H(%rip), %rcx + fld %st(0) + xorl %edx, %edx + fldl (%rcx) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fld %st(1) + fsubp %st, %st(1) + fxch %st(1) + jmp ..B1.51 +..B1.48: + je ..B1.67 +..B1.49: + addq $-16, %rsp + .cfi_def_cfa_offset 240 + xorl %edi, %edi + lea 168(%rsp), %rsi + fstpt (%rsp) +..___tag_value_sincosl.83: + call __libm_reduce_pi04l@PLT +..___tag_value_sincosl.84: +..B1.85: + movl %eax, %edx + addq $16, %rsp + .cfi_def_cfa_offset 224 +..B1.50: + fldl 152(%rsp) + lea 1(%rdx), %eax + lea _TWO_52H(%rip), %rcx + fld %st(0) + movsd 152(%rsp), %xmm0 + shrl $2, %eax + xorl %eax, %ebx + lea 3(%rdx), %eax + mulsd (%rcx), %xmm0 + andl $1, %ebx + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + shrl $2, %eax + fadd %st, %st(1) + andl $1, %eax + fsubrp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubr %st, %st(1) + fldl 160(%rsp) + faddp %st, %st(2) + fadd %st(1), %st +..B1.51: + fldt 16(%rsp) + lea 112+_SP(%rip), %rcx + fld %st(0) + lea 80+_SP(%rip), %rsi + fmul %st(3), %st + lea 48+_SP(%rip), %rdi + fxch %st(1) + fmul %st(0), %st + fld %st(0) + fld %st(1) + fxch %st(5) + fstpt 48(%rsp) + fldt 48(%rsp) + lea 128+_SP(%rip), %r9 + fmul %st(4), %st + lea 16+_SP(%rip), %r8 + lea 96+_SP(%rip), %r10 + lea 64+_SP(%rip), %r11 + movl %ebx, %ebx + incl %edx + testb $2, %dl + faddp %st, %st(3) + fld %st(2) + fxch %st(1) + fadd %st(3), %st + fmul %st, %st(1) + fxch %st(3) + fmul %st, %st(5) + fxch %st(1) + faddp %st, %st(5) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fmul %st(0), %st + fld %st(0) + fadd %st(5), %st + fxch %st(4) + fstpt 64(%rsp) + fstpt 112(%rsp) + fldt 112(%rsp) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rcx) + lea 32+_SP(%rip), %rcx + fmul %st(4), %st + fldt (%rsi) + lea _SP(%rip), %rsi + faddp %st, %st(1) + fmul %st(4), %st + fldt (%rdi) + lea 160+_SP(%rip), %rdi + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r8) + lea 144+_SP(%rip), %r8 + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r9) + lea _TWO_53H(%rip), %r9 + fmul %st(5), %st + fldt (%r10) + lea 112+_CP(%rip), %r10 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r11) + lea 80+_CP(%rip), %r11 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + lea 48+_CP(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rsi) + lea 16+_CP(%rip), %rsi + faddp %st, %st(1) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(5) + fldt (%rdi) + lea 128+_CP(%rip), %rdi + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(3) + fldt (%r8) + lea 96+_CP(%rip), %r8 + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 96(%rsp) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fldl (%r9) + fstpt 128(%rsp) + fldt 128(%rsp) + lea 64+_CP(%rip), %r9 + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(3), %st + fldt 64(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 16(%rsp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(2) + faddp %st, %st(1) + fldt (%r10) + fmul %st(3), %st + fldt (%r11) + lea 32+_CP(%rip), %r10 + lea _CP(%rip), %r11 + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + lea 160+_CP(%rip), %rcx + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rsi) + lea 144+_CP(%rip), %rsi + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + fmul %st(4), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(4) + fldt (%r11) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt (%rcx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt (%rsi) + fldt 80(%rsp) + fmul %st(1), %st + faddp %st, %st(2) + fldt 112(%rsp) + fmulp %st, %st(4) + fldt 96(%rsp) + fmulp %st, %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fldt 128(%rsp) + fmul %st(1), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fldl (%rbp) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fldl (%rbp,%rbx,8) + fldl (%rbp,%rax,8) + je ..B1.53 +..B1.52: + fxch %st(1) + fmul %st, %st(4) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(1) + fldt 32(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + fstpt 16(%rsp) + jmp ..B1.54 +..B1.53: + fldt 32(%rsp) + fmul %st(2), %st + fxch %st(4) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fstpt 16(%rsp) + fstpt 32(%rsp) +..B1.54: + testb %r12b, %r12b + je ..B1.56 +..B1.55: + fldcw 146(%rsp) +..B1.56: + fldt 16(%rsp) + fstpt (%r13) + fldt 32(%rsp) + fstpt (%r14) + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.57: + addq $176, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 224 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.58: + call __stack_chk_fail@PLT +..B1.59: + cmpl $0, 228(%rsp) + jne ..B1.61 +..B1.60: + cmpl $0, 224(%rsp) + je ..B1.62 +..B1.61: + fldt 224(%rsp) + lea _TWO_75(%rip), %rbx + movb 233(%rsp), %al + lea _small_value_80(%rip), %rcx + andb $-128, %al + lea _ones(%rip), %rsi + lea 8+_TWO_75(%rip), %rbp + fldl (%rbx) + shrb $7, %al + fmul %st(1), %st + fsubp %st, %st(1) + fldt (%rcx) + fxch %st(1) + fmull (%rbp) + movzbl %al, %edx + shlq $4, %rdx + fstpt 16(%rsp) + fldl (%rsi) + fsub %st(1), %st + fstpt 32(%rsp) + fldt (%rcx,%rdx) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.14 +..B1.62: + fldt 224(%rsp) + lea _ones(%rip), %rax + fstpt 16(%rsp) + fldl (%rax) + fstpt 32(%rsp) + jmp ..B1.14 +..B1.67: + movl 228(%rsp), %edx + cmpl $-921707870, %edx + jb ..B1.47 +..B1.68: + jne ..B1.49 +..B1.69: + cmpl $560513589, 224(%rsp) + jbe ..B1.47 + jmp ..B1.49 +..B1.70: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.74 +..B1.71: + orl $-64768, %ecx + movw %cx, 144(%rsp) +..B1.72: + fldcw 144(%rsp) +..B1.73: + movb $1, %r12b +..B1.74: + cmpl $-2147483648, 228(%rsp) + jne ..B1.77 +..B1.75: + cmpl $0, 224(%rsp) + jne ..B1.77 +..B1.76: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt 16(%rsp) + jmp ..B1.78 +..B1.77: + fldt 224(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) +..B1.78: + testb %r12b, %r12b + je ..B1.80 +..B1.79: + fldcw 146(%rsp) +..B1.80: + fldt 16(%rsp) + fstpt (%r13) + fldt (%r13) + fstpt (%r14) + movq 168(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 + jmp ..B1.17 + .align 16,0x90 + .cfi_endproc + .type sincosl,@function + .size sincosl,.-sincosl + .data +# -- End sincosl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_SP3: + .word 17476 + .word 43656 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _SP3,@object + .size _SP3,16 + .align 2 +_CP3: + .word 0 + .word 65450 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _CP3,@object + .size _CP3,16 + .align 2 +_SP2: + .word 43210 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 1587 + .word 57422 + .word 34932 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP2,@object + .size _SP2,32 + .align 2 +_CP2: + .word 63855 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 18238 + .word 17476 + .word 43656 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP2,@object + .size _CP2,32 + .align 2 +_SP1: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 12518 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43088 + .word 7396 + .word 207 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 55827 + .word 48618 + .word 3602 + .word 47342 + .word 16364 + .word 0 + .word 0 + .word 0 + .type _SP1,@object + .size _SP1,64 + .align 2 +_CP1: + .word 65535 + .word 65535 + .word 65535 + .word 65535 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 47533 + .word 43689 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 14131 + .word 49466 + .word 24756 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 37142 + .word 18013 + .word 35855 + .word 53259 + .word 16367 + .word 0 + .word 0 + .word 0 + .type _CP1,@object + .size _CP1,64 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP,@object + .size _SP,176 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 0 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP,@object + .size _CP,176 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sindl.S b/external/sgx_libm/intel64/sindl.S new file mode 100644 index 0000000000..42958e7e65 --- /dev/null +++ b/external/sgx_libm/intel64/sindl.S @@ -0,0 +1,837 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sindl.c" + .text +..TXTST0: +# -- Begin sindl + .text + .align 16,0x90 + .globl sindl +sindl: +# parameter 1: 112 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_sindl.1: +..L2: + + subq $104, %rsp + .cfi_def_cfa_offset 112 + xorb %r8b, %r8b +..B1.2: + fnstcw 90(%rsp) +..B1.3: + movzwl 90(%rsp), %edx + movl %edx, %eax + andl $3840, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + andl $-3841, %edx + orl $-64768, %edx + movw %dx, 88(%rsp) +..B1.5: + fldcw 88(%rsp) +..B1.6: + movb $1, %r8b +..B1.7: + fldt 112(%rsp) + lea ones(%rip), %rdi + movzwl 120(%rsp), %eax + movl %eax, %esi + shrl $15, %eax + andl $32767, %esi + cmpl $32767, %esi + flds (%rdi,%rax,4) + movss (%rdi,%rax,4), %xmm0 + fmul %st, %st(1) + je ..B1.32 +..B1.8: + fldt .L_2il0floatpacket.0(%rip) + fstpt 72(%rsp) + fldt 72(%rsp) + fucomip %st(2), %st + jp ..B1.9 + je ..B1.31 +..B1.9: + testl %esi, %esi + je ..B1.24 +..B1.10: + cmpl $7, %esi + fxch %st(1) + jl ..B1.25 +..B1.11: + cmpl $10783, %esi + jl ..B1.26 +..B1.12: + fstp %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + cmpl $16446, %esi + jge ..B1.17 +..B1.13: + fldt .L_2il0floatpacket.2(%rip) + lea _Rcp90(%rip), %rax + fldt 72(%rsp) + fldt (%rax) + fmulp %st, %st(3) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + movl 48(%rsp), %ecx + movl %ecx, %edx + andl $2, %edx + fsubp %st, %st(2) + fldt 112(%rsp) + fldt .L_2il0floatpacket.3(%rip) + fmulp %st, %st(3) + shrl $1, %edx + fsubp %st, %st(2) + mulss (%rdi,%rdx,4), %xmm0 + fucomip %st(1), %st + jp ..B1.14 + je ..B1.30 +..B1.14: + fldt .L_2il0floatpacket.4(%rip) + lea _TWO_53H(%rip), %rax + fmul %st(1), %st + fld %st(1) + movss %xmm0, (%rsp) + testb $1, %cl + fsubr %st(1), %st + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fld %st(0) + fld %st(3) + fsubr %st(3), %st + fchs + fmul %st, %st(3) + fld %st(4) + fxch %st(1) + fmul %st(5), %st + faddp %st, %st(4) + fld %st(4) + fldl (%rax) + fld %st(0) + fmul %st(5), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fxch %st(3) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(1) + fmul %st(2), %st + fld %st(5) + fadd %st(1), %st + fsubp %st, %st(1) + fsub %st, %st(1) + fxch %st(1) + fchs + fstpt 32(%rsp) + fld %st(4) + fmul %st(5), %st + fld %st(0) + fmul %st(1), %st + flds (%rsp) + fstps 64(%rsp) + je ..B1.16 +..B1.15: + fstp %st(6) + fstp %st(1) + fld %st(2) + lea 112+_cosdl_poly_coeff(%rip), %rax + fmul %st(3), %st + lea 80+_cosdl_poly_coeff(%rip), %rdx + fmul %st, %st(2) + fld %st(1) + fmul %st(5), %st + fxch %st(4) + fstpt (%rsp) + fldt (%rsp) + fld %st(2) + lea 48+_cosdl_poly_coeff(%rip), %rcx + lea 96+_cosdl_poly_coeff(%rip), %rsi + lea 64+_cosdl_poly_coeff(%rip), %rdi + lea 32+_cosdl_poly_coeff(%rip), %r9 + lea 24+_cosdl_mp_poly_coeff(%rip), %r10 + lea 8+_cosdl_mp_poly_coeff(%rip), %r11 + fmul %st(7), %st + fxch %st(1) + fmul %st(6), %st + faddp %st, %st(5) + fld %st(1) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) + faddp %st, %st(3) + fldt (%rax) + fmul %st(5), %st + fldt (%rdx) + lea 16+_cosdl_mp_poly_coeff(%rip), %rax + lea _cosdl_mp_poly_coeff(%rip), %rdx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmul %st(6), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r9) + faddp %st, %st(1) + faddp %st, %st(1) + fmulp %st, %st(2) + fldl (%r10) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldl (%r11) + fmulp %st, %st(4) + faddp %st, %st(3) + fldl (%rax) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldl (%rdx) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt (%rsp) + fmulp %st, %st(2) + fld %st(1) + fldt 16(%rsp) + fmulp %st, %st(2) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + flds 64(%rsp) + fld %st(0) + fldt .L_2il0floatpacket.5(%rip) + fadd %st(4), %st + fmul %st, %st(1) + fldt .L_2il0floatpacket.5(%rip) + fsubp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 72(%rsp) + jmp ..B1.27 +..B1.16: + fld %st(6) + lea 128+_sindl_poly_coeff(%rip), %rax + fmul %st(2), %st + lea 96+_sindl_poly_coeff(%rip), %rdx + fstpt 16(%rsp) + lea 64+_sindl_poly_coeff(%rip), %rcx + fxch %st(2) + fstpt (%rsp) + fldt (%rsp) + lea 32+_sindl_poly_coeff(%rip), %rsi + lea 112+_sindl_poly_coeff(%rip), %rdi + lea 80+_sindl_poly_coeff(%rip), %r9 + lea 48+_sindl_poly_coeff(%rip), %r10 + lea 24+_sindl_mp_poly_coeff(%rip), %r11 + fmul %st(4), %st + fmul %st, %st(3) + fxch %st(5) + fmul %st(6), %st + fldt 32(%rsp) + fmul %st, %st(5) + fxch %st(1) + faddp %st, %st(5) + fld %st(5) + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(3) + fsubr %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + lea 8+_sindl_mp_poly_coeff(%rip), %rax + lea 16+_sindl_mp_poly_coeff(%rip), %rdx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + lea _sindl_mp_poly_coeff(%rip), %rcx + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%rdi) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 16(%rsp) + fmul %st, %st(1) + fldl (%r11) + fmulp %st, %st(1) + faddp %st, %st(1) + fldl (%rax) + fmulp %st, %st(5) + faddp %st, %st(4) + fldl (%rdx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldl (%rcx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldt (%rsp) + fmulp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + flds 64(%rsp) + fld %st(0) + fmulp %st, %st(2) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 72(%rsp) + jmp ..B1.27 +..B1.17: + fstp %st(0) + lea -16446(%rsi), %ecx + cmpl $14, %ecx + jle ..B1.19 +..B1.18: + addl $-16449, %esi + movl $715827883, %eax + imull %esi + movl %esi, %ecx + sarl $1, %edx + sarl $31, %ecx + subl %ecx, %edx + lea (,%rdx,8), %r9d + lea (%r9,%rdx,4), %r10d + subl %r10d, %esi + lea 3(%rsi), %ecx +..B1.19: + movl 116(%rsp), %r11d + movl %r11d, %esi + shll $8, %esi + movl $381774871, %eax + movl %esi, %edx + andl $-16777216, %r11d + shrl $3, %edx + movl %r11d, %r10d + mull %edx + shrl $19, %r11d + shrl $2, %edx + imull $-360, %edx, %eax + addl %eax, %esi + movl $381774871, %eax + mull %r11d + shrl $16, %r10d + movl $381774871, %eax + shrl $2, %edx + imull $-360, %edx, %r9d + addl %r9d, %r10d + movl 112(%rsp), %r9d + addl %r10d, %esi + movl %r9d, %r10d + shrl $3, %r10d + mull %r10d + movl $-1240768329, %eax + shrl $2, %edx + imull $-360, %edx, %r11d + addl %r11d, %r9d + addl %r9d, %esi + shll %cl, %esi + imull %esi + movl %esi, %ecx + addl %esi, %edx + sarl $8, %edx + sarl $31, %ecx + subl %ecx, %edx + imull $-360, %edx, %eax + lea (%rsi,%rax), %edx + cmpl $179, %edx + lea -180(%rsi,%rax), %ecx + movl $2, %esi + movl $0, %eax + cmovg %ecx, %edx + cmovg %esi, %eax + cmpl $89, %edx + jle ..B1.21 +..B1.20: + incl %eax + addl $-90, %edx +..B1.21: + movl %edx, %ecx + orl %eax, %ecx + je ..B1.27 +..B1.22: + movl %eax, %ecx + andl $2, %eax + andl $1, %ecx + addl %ecx, %ecx + shrl $1, %eax + mulss (%rdi,%rax,4), %xmm0 + movq __libm_sindl_cosdl_table@GOTPCREL(%rip), %rdi + lea (%rcx,%rdx,4), %edx + movss %xmm0, (%rsp) + flds (%rsp) + movslq %edx, %rdx + fldl (%rdi,%rdx,8) + faddl 8(%rdi,%rdx,8) + fmulp %st, %st(1) + fstpt 72(%rsp) + jmp ..B1.27 +..B1.24: + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + testl $-1048576, 116(%rsp) + je ..B1.26 +..B1.25: + lea _TWO5600(%rip), %rax + lea _TWO_53H(%rip), %rdx + lea 8+_sindl_mp_poly_coeff(%rip), %rcx + lea _sindl_mp_poly_coeff(%rip), %rsi + lea 16+_TWO5600(%rip), %rdi + fldt (%rax) + fmulp %st, %st(1) + fld %st(0) + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fldl (%rdx) + fmul %st(1), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fldl (%rcx) + fmulp %st, %st(2) + fldl (%rsi) + fmul %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fld %st(0) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fsub %st, %st(1) + fsubp %st, %st(1) + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(1) + fldt (%rdi) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 72(%rsp) + jmp ..B1.27 +..B1.26: + lea _TWO5600(%rip), %rax + lea _TWO_53H(%rip), %rdx + lea 8+_sindl_mp_poly_coeff(%rip), %rcx + lea _sindl_mp_poly_coeff(%rip), %rsi + lea 16+_TWO5600(%rip), %rdi + fldt (%rax) + fmulp %st, %st(1) + fld %st(0) + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fldl (%rdx) + fmul %st(1), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fsubr %st(1), %st + fldl (%rcx) + fmulp %st, %st(2) + fldl (%rsi) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fld %st(0) + fxch %st(2) + fmulp %st, %st(3) + fxch %st(1) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fsub %st, %st(1) + fsubp %st, %st(1) + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(1) + faddp %st, %st(1) + fldt (%rdi) + fmulp %st, %st(1) + fstpt 72(%rsp) +..B1.27: + testb %r8b, %r8b + je ..B1.29 +..B1.28: + fldcw 90(%rsp) +..B1.29: + fldt 72(%rsp) + addq $104, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 112 +..B1.30: + fstp %st(0) + fldt 72(%rsp) + testb $1, %cl + movss %xmm0, (%rsp) + flds (%rsp) + fcmove %st(1), %st + fstp %st(1) + fstpt 72(%rsp) + jmp ..B1.27 +..B1.31: + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fmulp %st, %st(1) + fstpt 72(%rsp) + jmp ..B1.27 +..B1.32: + fstp %st(0) + fldt .L_2il0floatpacket.0(%rip) + fmul %st(1), %st + fstpt 72(%rsp) + fstpt 112(%rsp) + jmp ..B1.27 + .align 16,0x90 + .cfi_endproc + .type sindl,@function + .size sindl,.-sindl + .data +# -- End sindl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x80,0x13,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3e,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb4,0x05,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +_cosdl_poly_coeff: + .word 52350 + .word 41213 + .word 3800 + .word 40885 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 28613 + .word 7908 + .word 35668 + .word 34008 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 19927 + .word 58728 + .word 49885 + .word 45261 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 32884 + .word 22035 + .word 23267 + .word 64541 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 36401 + .word 51897 + .word 8309 + .word 57265 + .word 49070 + .word 0 + .word 0 + .word 0 + .word 34286 + .word 2728 + .word 41564 + .word 34642 + .word 16284 + .word 0 + .word 0 + .word 0 + .word 63248 + .word 18030 + .word 35596 + .word 60796 + .word 49032 + .word 0 + .word 0 + .word 0 + .word 52149 + .word 21294 + .word 63985 + .word 40123 + .word 16245 + .word 0 + .word 0 + .word 0 + .type _cosdl_poly_coeff,@object + .size _cosdl_poly_coeff,128 + .align 16 +_cosdl_mp_poly_coeff: + .long 3675529145 + .long 3206805153 + .long 2134983071 + .long 3151100167 + .long 1787026573 + .long 1043372817 + .long 205083639 + .long 988746860 + .type _cosdl_mp_poly_coeff,@object + .size _cosdl_mp_poly_coeff,32 + .align 16 +_sindl_poly_coeff: + .word 51374 + .word 38121 + .word 13586 + .word 36602 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 50116 + .word 41339 + .word 4204 + .word 60892 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 33704 + .word 2155 + .word 42839 + .word 60780 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 21250 + .word 19076 + .word 27901 + .word 57780 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 9076 + .word 49244 + .word 613 + .word 64083 + .word 16311 + .word 0 + .word 0 + .word 0 + .word 40572 + .word 30418 + .word 36251 + .word 46520 + .word 49061 + .word 0 + .word 0 + .word 0 + .word 3227 + .word 25505 + .word 5540 + .word 47626 + .word 16274 + .word 0 + .word 0 + .word 0 + .word 60933 + .word 3300 + .word 57416 + .word 36218 + .word 49023 + .word 0 + .word 0 + .word 0 + .word 45811 + .word 42646 + .word 37125 + .word 42185 + .word 16235 + .word 0 + .word 0 + .word 0 + .type _sindl_poly_coeff,@object + .size _sindl_poly_coeff,144 + .align 16 +_sindl_mp_poly_coeff: + .long 2723323193 + .long 1066524486 + .long 2863989530 + .long 1008058840 + .long 227815288 + .long 3199056770 + .long 3752327299 + .long 3142458725 + .type _sindl_mp_poly_coeff,@object + .size _sindl_mp_poly_coeff,32 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 2 +_Rcp90: + .word 46603 + .word 2912 + .word 24758 + .word 46603 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _Rcp90,@object + .size _Rcp90,16 + .align 2 +_TWO5600: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 21983 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 10783 + .word 0 + .word 0 + .word 0 + .type _TWO5600,@object + .size _TWO5600,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sinf_gen.S b/external/sgx_libm/intel64/sinf_gen.S new file mode 100644 index 0000000000..5e58fe229f --- /dev/null +++ b/external/sgx_libm/intel64/sinf_gen.S @@ -0,0 +1,543 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinf_gen.c" + .text +..TXTST0: +# -- Begin sinf + .text + .align 16,0x90 + .globl sinf +sinf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_sinf.1: +..L2: + +..B1.2: + subq $32, %rsp + .cfi_def_cfa_offset 40 + stmxcsr 8(%rsp) + cmpl $-24577, 8(%rsp) + jne .L_2TAG_PACKET_0.0.1 +.L_2TAG_PACKET_1.0.1: + pshuflw $68, %xmm0, %xmm1 + movd %xmm0, %ecx + cvtps2pd %xmm1, %xmm1 + movq $0x40445f306e000000, %rax + movd %rax, %xmm2 + movl $2147483647, %r10d + movl $1241513983, %r8d + andl %ecx, %r10d + subl %r10d, %r8d + subl $964689920, %r10d + orl %r10d, %r8d + jl .L_2TAG_PACKET_2.0.1 + movq $0x4338000000000000, %r11 + movd %r11, %xmm4 + mulsd %xmm1, %xmm2 + movq $0xbe5b1bbead603d8b, %rdx + movd %rdx, %xmm3 + movapd %xmm2, %xmm5 + addsd %xmm4, %xmm2 + movd %xmm2, %r9d + subsd %xmm4, %xmm2 + mulsd %xmm3, %xmm1 +.L_2TAG_PACKET_3.0.1: + lea Ctable(%rip), %r10 + movl $384, %eax + movq $0x40c37423899a1558, %rdx + movd %rdx, %xmm4 + subsd %xmm2, %xmm5 + addl %r9d, %r9d + movl %r9d, %r8d + sarb $7, %r9b + andl %r8d, %eax + addb %r9b, %r8b + xorb %r9b, %r8b + addsd %xmm5, %xmm1 + andl $254, %r8d + movsd (%r10,%r8,8), %xmm3 + movq $0x40a9f02f6222c720, %r11 + movd %r11, %xmm0 + movapd %xmm1, %xmm2 + unpcklpd %xmm1, %xmm2 + mulsd %xmm1, %xmm1 + movsd 8(%r10,%r8,8), %xmm5 + movl %eax, %r9d + addl $128, %r9d + andl $256, %r9d + shlq $55, %r9 + mulsd %xmm2, %xmm3 + movd %r9, %xmm2 + subsd %xmm1, %xmm0 + andl $256, %eax + shlq $55, %rax + subsd %xmm1, %xmm4 + movd %rax, %xmm1 + xorpd %xmm2, %xmm4 + mulsd %xmm5, %xmm0 + mulsd %xmm4, %xmm3 + xorpd %xmm1, %xmm0 + addsd %xmm3, %xmm0 + movl 8(%rsp), %eax + andl $-24577, %eax + cmpl 8(%rsp), %eax + jne .L_2TAG_PACKET_4.0.1 +.L_2TAG_PACKET_5.0.1: + cvtpd2ps %xmm0, %xmm0 + addq $32, %rsp + ret +.L_2TAG_PACKET_2.0.1: + andl $2147483647, %ecx + cmpl $1040187392, %ecx + ja .L_2TAG_PACKET_6.0.1 + cvtss2sd %xmm0, %xmm0 + mulsd ONE_M230(%rip), %xmm0 + movl 8(%rsp), %eax + andl $-24577, %eax + cmpl 8(%rsp), %eax + jne .L_2TAG_PACKET_4.0.1 + jmp .L_2TAG_PACKET_5.0.1 +.L_2TAG_PACKET_6.0.1: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_7.0.1 + shrl $23, %r10d + subl $27, %r10d + andl $65528, %r10d + lea Pitable(%rip), %rax + movsd (%rax,%r10,2), %xmm3 + movsd 8(%rax,%r10,2), %xmm5 + movq $0xffffffffff000000, %r9 + movd %r9, %xmm2 + movq $0x4338000000000000, %r11 + movd %r11, %xmm4 + andpd %xmm3, %xmm2 + psllq $40, %xmm3 + mulsd %xmm1, %xmm2 + mulsd %xmm1, %xmm3 + mulsd %xmm5, %xmm1 + movapd %xmm2, %xmm0 + addsd %xmm3, %xmm2 + movapd %xmm2, %xmm5 + subsd %xmm2, %xmm0 + addsd %xmm4, %xmm2 + addsd %xmm0, %xmm3 + movd %xmm2, %r9d + subsd %xmm4, %xmm2 + addsd %xmm3, %xmm1 + jmp .L_2TAG_PACKET_3.0.1 +.L_2TAG_PACKET_7.0.1: + movl 8(%rsp), %eax + andl $-24577, %eax + cmpl 8(%rsp), %eax + je .L_2TAG_PACKET_8.0.1 + stmxcsr 16(%rsp) + movl 8(%rsp), %eax + andl $24576, %eax + orl %eax, 16(%rsp) + ldmxcsr 16(%rsp) +.L_2TAG_PACKET_8.0.1: + subss %xmm0, %xmm0 + addq $32, %rsp + ret +.L_2TAG_PACKET_0.0.1: + movl 8(%rsp), %eax + andl $-24577, %eax + movl %eax, 16(%rsp) + ldmxcsr 16(%rsp) + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_4.0.1: + stmxcsr 16(%rsp) + movl 8(%rsp), %eax + andl $24576, %eax + orl %eax, 16(%rsp) + ldmxcsr 16(%rsp) + jmp .L_2TAG_PACKET_5.0.1 + .cfi_def_cfa_offset 8 +..B1.3: + .align 16,0x90 + .cfi_endproc + .type sinf,@function + .size sinf,.-sinf + .data +# -- End sinf + .section .rodata, "a" + .align 16 + .align 16 +Ctable: + .long 3861233235 + .long 1053076412 + .long 0 + .long 0 + .long 3836476539 + .long 1053076004 + .long 1466910230 + .long 1054802127 + .long 522802171 + .long 1053074781 + .long 1693671239 + .long 1055850091 + .long 1381230637 + .long 1053072742 + .long 3419039295 + .long 1056390099 + .long 3096463640 + .long 1053069889 + .long 3054827835 + .long 1056896220 + .long 163641427 + .long 1053066225 + .long 3381119115 + .long 1057182863 + .long 2063766514 + .long 1053061750 + .long 544295963 + .long 1057434550 + .long 3193221610 + .long 1053056468 + .long 3297207428 + .long 1057685321 + .long 36665700 + .long 1053050383 + .long 2811721921 + .long 1057935027 + .long 4043704933 + .long 1053043496 + .long 2950925715 + .long 1058098350 + .long 2964703016 + .long 1053035814 + .long 2674059679 + .long 1058221912 + .long 3789723003 + .long 1053027340 + .long 879820317 + .long 1058344717 + .long 2671784286 + .long 1053018080 + .long 1979618421 + .long 1058466690 + .long 2093526290 + .long 1053008039 + .long 3945677176 + .long 1058587758 + .long 2262842797 + .long 1052997223 + .long 2796081240 + .long 1058707849 + .long 1097233945 + .long 1052985639 + .long 1373383079 + .long 1058826890 + .long 2796885356 + .long 1052973293 + .long 941816458 + .long 1058944809 + .long 646746141 + .long 1052960194 + .long 1372808103 + .long 1059061535 + .long 2767093429 + .long 1052946348 + .long 664370609 + .long 1059119379 + .long 2028347177 + .long 1052931765 + .long 1369913724 + .long 1059176444 + .long 1799297257 + .long 1052916453 + .long 3344537919 + .long 1059232808 + .long 3039475318 + .long 1052900421 + .long 2500108843 + .long 1059288438 + .long 4275292648 + .long 1052883679 + .long 944109265 + .long 1059343300 + .long 1575056534 + .long 1052866238 + .long 2771364651 + .long 1059397360 + .long 1407782048 + .long 1052848107 + .long 1264637048 + .long 1059450587 + .long 3436142021 + .long 1052829297 + .long 453708735 + .long 1059502948 + .long 488211833 + .long 1052809821 + .long 2313428161 + .long 1059554411 + .long 2993330 + .long 1052789689 + .long 2550341159 + .long 1059604946 + .long 755484892 + .long 1052767523 + .long 3567792879 + .long 1059654522 + .long 3348027550 + .long 1052724710 + .long 1659779181 + .long 1059703110 + .long 2580634211 + .long 1052680662 + .long 4268074870 + .long 1059750679 + .long 742418353 + .long 1052635405 + .long 4288148241 + .long 1059797202 + .long 3250975870 + .long 1052588965 + .long 1618129506 + .long 1059842651 + .long 1401987205 + .long 1052541372 + .long 3231311734 + .long 1059886997 + .long 2361617751 + .long 1052492653 + .long 1772140623 + .long 1059930215 + .long 3322544997 + .long 1052442838 + .long 1395127179 + .long 1059972278 + .long 17970311 + .long 1052391958 + .long 652328457 + .long 1060013161 + .long 3823857331 + .long 1052340041 + .long 1148832537 + .long 1060052839 + .long 3024934267 + .long 1052287121 + .long 3311502568 + .long 1060091288 + .long 1388494065 + .long 1052233229 + .long 1077921708 + .long 1060119411 + .long 902054988 + .long 1052178397 + .long 115411415 + .long 1060137373 + .long 1689375324 + .long 1052122658 + .long 3838419993 + .long 1060154686 + .long 1925003623 + .long 1052066046 + .long 1813501338 + .long 1060171342 + .long 2042383238 + .long 1052008595 + .long 2490283769 + .long 1060187329 + .long 350661592 + .long 1051950340 + .long 3162654741 + .long 1060202638 + .long 1535093810 + .long 1051891315 + .long 2878576948 + .long 1060217260 + .long 3681356269 + .long 1051831556 + .long 2463945945 + .long 1060231186 + .long 2478530408 + .long 1051771100 + .long 250409509 + .long 1060244408 + .long 3726787968 + .long 1051698237 + .long 687004205 + .long 1060256917 + .long 2082609563 + .long 1051574753 + .long 1475857720 + .long 1060268706 + .long 1666812989 + .long 1051450094 + .long 2181617495 + .long 1060279768 + .long 2865853451 + .long 1051324335 + .long 4249822861 + .long 1060290096 + .long 321119318 + .long 1051197553 + .long 2434209605 + .long 1060299685 + .long 4207787592 + .long 1051069822 + .long 1992674941 + .long 1060308528 + .long 1382541649 + .long 1050941222 + .long 1522351063 + .long 1060316620 + .long 2429158325 + .long 1050811828 + .long 1563320407 + .long 1060323956 + .long 2803392399 + .long 1050681719 + .long 316258674 + .long 1060330532 + .long 3917367244 + .long 1050428795 + .long 2243801771 + .long 1060336343 + .long 1991825541 + .long 1050166188 + .long 900924147 + .long 1060341387 + .long 624330694 + .long 1049902623 + .long 418831766 + .long 1060345660 + .long 3087185898 + .long 1049638258 + .long 2627920248 + .long 1060349159 + .long 3670374716 + .long 1049121932 + .long 2769466396 + .long 1060351883 + .long 3431923622 + .long 1048590963 + .long 2385983684 + .long 1060353830 + .long 918535681 + .long 1047542708 + .long 735532773 + .long 1060354999 + .long 0 + .long 0 + .long 3384690142 + .long 1060355388 + .type Ctable,@object + .size Ctable,1040 + .align 16 +Pitable: + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1832810809 + .long 1078222640 + .long 4036845384 + .long 1030771879 + .long 1916669064 + .long 1072155675 + .long 660066805 + .long 1024797180 + .long 3829231700 + .long 1062745828 + .long 2884172442 + .long 1017445907 + .long 540874025 + .long 1055617650 + .long 4198409884 + .long 1011844330 + .long 2839315448 + .long 1046639136 + .long 4204424928 + .long 1000582120 + .long 1329339431 + .long 1038229673 + .long 1295478839 + .long 993391741 + .long 658191860 + .long 1024797180 + .long 3691886121 + .long 979325773 + .long 1966800710 + .long 1020436418 + .long 1882642597 + .long 977095991 + .long 2100977488 + .long 1012908661 + .long 1840335565 + .long 967470816 + .long 4198093645 + .long 1000582120 + .long 3307942521 + .long 957055414 + .long 2839123165 + .long 996851343 + .long 1387472776 + .long 952638316 + .long 2788761024 + .long 988712873 + .long 3005712498 + .long 944467026 + .long 3694676832 + .long 979325773 + .long 1326507024 + .long 934847846 + .long 221775557 + .long 970149340 + .long 1133527550 + .long 924162364 + .type Pitable,@object + .size Pitable,240 + .align 8 +ONE_M230: + .long 4286578688 + .long 1072693247 + .type ONE_M230,@object + .size ONE_M230,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sinh_gen.S b/external/sgx_libm/intel64/sinh_gen.S new file mode 100644 index 0000000000..d584312f9c --- /dev/null +++ b/external/sgx_libm/intel64/sinh_gen.S @@ -0,0 +1,457 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinh_gen.c" + .text +..TXTST0: +# -- Begin sinh + .text + .align 16,0x90 + .globl sinh +sinh: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_sinh.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $1077338037, %ecx + jae ..B1.12 +..B1.2: + cmpl $1066695393, %ecx + jae ..B1.11 +..B1.3: + cmpl $1012924416, %ecx + jae ..B1.10 +..B1.4: + shrl $31, %eax + cmpl $1048576, %ecx + jb ..B1.6 +..B1.5: + movsd .L_2il0floatpacket.13(%rip), %xmm1 + addsd %xmm0, %xmm1 + movsd %xmm1, -24(%rsp) + movsd -24(%rsp), %xmm2 + mulsd %xmm2, %xmm0 + ret +..B1.6: + movl -8(%rsp), %edx + orl %edx, %ecx + je ..B1.8 +..B1.7: + lea _small_value_64(%rip), %rdx + movsd (%rdx,%rax,8), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, -24(%rsp) + movsd -24(%rsp), %xmm0 + addsd -8(%rsp), %xmm0 + ret +..B1.8: + movsd -8(%rsp), %xmm0 +..B1.9: + ret +..B1.10: + movsd -8(%rsp), %xmm4 + movaps %xmm4, %xmm2 + mulsd %xmm4, %xmm2 + movaps %xmm2, %xmm1 + mulsd %xmm2, %xmm1 + movsd .L_2il0floatpacket.9(%rip), %xmm0 + movsd .L_2il0floatpacket.11(%rip), %xmm3 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm3 + addsd .L_2il0floatpacket.10(%rip), %xmm0 + addsd .L_2il0floatpacket.12(%rip), %xmm3 + mulsd %xmm1, %xmm0 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm4, %xmm0 + ret +..B1.11: + movsd -8(%rsp), %xmm1 + lea _TWO_52(%rip), %rdx + andps .L_2il0floatpacket.14(%rip), %xmm1 + lea _ptwo_32p1(%rip), %rsi + movsd .L_2il0floatpacket.0(%rip), %xmm2 + lea _ntwo_32p1(%rip), %rdi + mulsd %xmm1, %xmm2 + lea _two_32(%rip), %r8 + movsd .L_2il0floatpacket.1(%rip), %xmm3 + andl $-2147483648, %eax + movsd %xmm1, -8(%rsp) + movsd .L_2il0floatpacket.2(%rip), %xmm4 + movsd (%rsi), %xmm6 + movsd (%rdi), %xmm7 + movsd .L_2il0floatpacket.4(%rip), %xmm13 + movsd .L_2il0floatpacket.6(%rip), %xmm14 + movsd .L_2il0floatpacket.3(%rip), %xmm8 + movsd .L_2il0floatpacket.3(%rip), %xmm9 + addsd (%rdx), %xmm2 + movsd %xmm2, -24(%rsp) + movsd -24(%rsp), %xmm5 + movl -24(%rsp), %r10d + movl %r10d, %ecx + shll $25, %ecx + subsd (%rdx), %xmm5 + mulsd %xmm5, %xmm3 + mulsd %xmm4, %xmm5 + subsd %xmm3, %xmm1 + movaps %xmm1, %xmm10 + sarl $25, %ecx + subsd %xmm5, %xmm10 + movaps %xmm10, %xmm11 + movaps %xmm10, %xmm15 + movslq %ecx, %rcx + subsd %xmm10, %xmm1 + addsd %xmm10, %xmm6 + subsd %xmm10, %xmm7 + subsd %xmm5, %xmm1 + movsd %xmm6, -40(%rsp) + subl %ecx, %r10d + movsd %xmm7, -32(%rsp) + pxor %xmm5, %xmm5 + movsd -40(%rsp), %xmm2 + addsd %xmm1, %xmm11 + subsd (%r8), %xmm2 + movaps %xmm11, %xmm12 + addsd %xmm2, %xmm8 + mulsd %xmm11, %xmm12 + subsd %xmm8, %xmm15 + mulsd %xmm12, %xmm13 + mulsd %xmm12, %xmm14 + addsd %xmm1, %xmm15 + addsd .L_2il0floatpacket.5(%rip), %xmm13 + addsd .L_2il0floatpacket.7(%rip), %xmm14 + mulsd %xmm12, %xmm13 + mulsd %xmm12, %xmm14 + mulsd %xmm11, %xmm13 + addsd .L_2il0floatpacket.8(%rip), %xmm14 + addsd %xmm13, %xmm15 + mulsd %xmm12, %xmm14 + movsd -32(%rsp), %xmm0 + addsd %xmm14, %xmm15 + addsd (%r8), %xmm0 + shrl $7, %r10d + addsd %xmm0, %xmm9 + shll $23, %r10d + addsd %xmm9, %xmm10 + shlq $4, %rcx + lea 1056964608(%r10), %r9d + negl %r10d + orl %eax, %r9d + addl $1056964608, %r10d + addsd %xmm10, %xmm1 + orl %r10d, %eax + movl %eax, -12(%rsp) + movq __libm_exp_table_128@GOTPCREL(%rip), %rax + xorps .L_2il0floatpacket.15(%rip), %xmm1 + movl %r9d, -16(%rsp) + subsd %xmm13, %xmm1 + cvtss2sd -16(%rsp), %xmm5 + addsd %xmm14, %xmm1 + movsd 1032(%rax,%rcx), %xmm8 + movaps %xmm8, %xmm4 + mulsd %xmm15, %xmm4 + addsd %xmm2, %xmm15 + mulsd %xmm8, %xmm2 + mulsd 1024(%rax,%rcx), %xmm15 + negq %rcx + addsd %xmm15, %xmm4 + movsd 1032(%rax,%rcx), %xmm15 + movaps %xmm15, %xmm3 + mulsd %xmm1, %xmm3 + addsd %xmm0, %xmm1 + mulsd %xmm15, %xmm0 + mulsd %xmm5, %xmm4 + mulsd 1024(%rax,%rcx), %xmm1 + mulsd %xmm2, %xmm5 + addsd %xmm1, %xmm3 + pxor %xmm1, %xmm1 + cvtss2sd -12(%rsp), %xmm1 + mulsd %xmm1, %xmm3 + mulsd %xmm0, %xmm1 + subsd %xmm3, %xmm4 + movaps %xmm5, %xmm0 + subsd %xmm1, %xmm0 + subsd %xmm0, %xmm5 + subsd %xmm1, %xmm5 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm0 + ret +..B1.12: + cmpl $1082536910, %ecx + jb ..B1.18 +..B1.13: + jne ..B1.15 +..B1.14: + cmpl $-1883637635, -8(%rsp) + jbe ..B1.18 +..B1.15: + cmpl $2146435072, %ecx + jb ..B1.19 +..B1.16: + movsd -8(%rsp), %xmm0 + addsd %xmm0, %xmm0 +..B1.17: + ret +..B1.18: + movsd -8(%rsp), %xmm12 + lea _TWO_52(%rip), %rdx + andps .L_2il0floatpacket.14(%rip), %xmm12 + lea _ptwo_32p1(%rip), %rcx + movsd .L_2il0floatpacket.0(%rip), %xmm0 + lea _two_32(%rip), %rsi + mulsd %xmm12, %xmm0 + andl $-2147483648, %eax + movsd .L_2il0floatpacket.1(%rip), %xmm1 + lea _TWO_512(%rip), %r9 + movsd %xmm12, -8(%rsp) + movsd .L_2il0floatpacket.2(%rip), %xmm2 + movsd .L_2il0floatpacket.6(%rip), %xmm11 + movsd .L_2il0floatpacket.4(%rip), %xmm8 + movsd (%rcx), %xmm4 + movsd .L_2il0floatpacket.3(%rip), %xmm5 + movsd .L_2il0floatpacket.8(%rip), %xmm10 + movl $0, -16(%rsp) + addsd (%rdx), %xmm0 + movsd %xmm0, -24(%rsp) + movsd -24(%rsp), %xmm3 + movl -24(%rsp), %edi + movl %edi, %r8d + shll $25, %r8d + subsd (%rdx), %xmm3 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm3 + subsd %xmm1, %xmm12 + movaps %xmm12, %xmm6 + sarl $25, %r8d + subsd %xmm3, %xmm6 + movaps %xmm6, %xmm7 + subl %r8d, %edi + shrl $7, %edi + subsd %xmm6, %xmm12 + addsd %xmm6, %xmm4 + subsd %xmm3, %xmm12 + movsd %xmm4, -24(%rsp) + addsd %xmm12, %xmm7 + movaps %xmm7, %xmm9 + mulsd %xmm7, %xmm9 + mulsd %xmm9, %xmm11 + mulsd %xmm9, %xmm8 + mulsd %xmm9, %xmm10 + addsd .L_2il0floatpacket.7(%rip), %xmm11 + addsd .L_2il0floatpacket.5(%rip), %xmm8 + mulsd %xmm9, %xmm11 + mulsd %xmm7, %xmm8 + movsd -24(%rsp), %xmm0 + addsd %xmm8, %xmm11 + subsd (%rsi), %xmm0 + mulsd %xmm9, %xmm11 + addsd %xmm0, %xmm5 + addsd %xmm10, %xmm11 + subsd %xmm5, %xmm6 + shll $20, %edi + addsd %xmm6, %xmm12 + movslq %r8d, %r8 + addl $534773760, %edi + shlq $4, %r8 + orl %edi, %eax + movl %eax, -12(%rsp) + addsd %xmm11, %xmm12 + movq __libm_exp_table_128@GOTPCREL(%rip), %rax + movsd 1032(%rax,%r8), %xmm13 + movaps %xmm13, %xmm14 + mulsd %xmm12, %xmm14 + addsd %xmm0, %xmm12 + mulsd %xmm13, %xmm0 + mulsd 1024(%rax,%r8), %xmm12 + addsd %xmm12, %xmm14 + addsd %xmm14, %xmm0 + mulsd -16(%rsp), %xmm0 + mulsd (%r9), %xmm0 + ret +..B1.19: + lea _large_value_64(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 + mulsd (%rdx), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type sinh,@function + .size sinh,.-sinh + .data +# -- End sinh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.14: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,16 + .align 16 +.L_2il0floatpacket.15: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0xb9ff12f0,0x3ec71e39 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x111111c1,0x3f811111 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x1940cd88,0x3f2a01a0 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x55555555,0x3fc55555 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_TWO_52: + .long 0 + .long 1127219200 + .type _TWO_52,@object + .size _TWO_52,8 + .align 4 +_ptwo_32p1: + .long 1048576 + .long 1106247680 + .type _ptwo_32p1,@object + .size _ptwo_32p1,8 + .align 4 +_ntwo_32p1: + .long 4292870144 + .long 3253731327 + .type _ntwo_32p1,@object + .size _ntwo_32p1,8 + .align 4 +_two_32: + .long 0 + .long 1106247680 + .type _two_32,@object + .size _two_32,8 + .align 4 +_TWO_512: + .long 0 + .long 1609564160 + .type _TWO_512,@object + .size _TWO_512,8 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sinhf_gen.S b/external/sgx_libm/intel64/sinhf_gen.S new file mode 100644 index 0000000000..6875ce04c9 --- /dev/null +++ b/external/sgx_libm/intel64/sinhf_gen.S @@ -0,0 +1,365 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinhf_gen.c" + .text +..TXTST0: +# -- Begin sinhf + .text + .align 16,0x90 + .globl sinhf +sinhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_sinhf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %eax + andl $2147483647, %eax + cmpl $1107296256, %eax + jae ..B1.14 +..B1.2: + cmpl $1056964608, %eax + jae ..B1.13 +..B1.3: + cmpl $1031798784, %eax + jae ..B1.12 +..B1.4: + cmpl $838860800, %eax + jae ..B1.11 +..B1.5: + shrl $31, %edx + cmpl $8388608, %eax + jb ..B1.7 +..B1.6: + movss .L_2il0floatpacket.16(%rip), %xmm1 + addss %xmm0, %xmm1 + movss %xmm1, -16(%rsp) + ret +..B1.7: + testl %eax, %eax + je ..B1.9 +..B1.8: + lea _small_value_32(%rip), %rax + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.15(%rip), %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm0 + addss -8(%rsp), %xmm0 + ret +..B1.9: + movss -8(%rsp), %xmm0 +..B1.10: + ret +..B1.11: + pxor %xmm1, %xmm1 + cvtss2sd -8(%rsp), %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.13(%rip), %xmm2 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.14(%rip), %xmm2 + mulsd %xmm0, %xmm2 + mulsd %xmm1, %xmm2 + addsd %xmm1, %xmm2 + cvtsd2ss %xmm2, %xmm2 + movaps %xmm2, %xmm0 + ret +..B1.12: + pxor %xmm3, %xmm3 + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.8(%rip), %xmm4 + movsd .L_2il0floatpacket.10(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.9(%rip), %xmm4 + addsd .L_2il0floatpacket.11(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 + cvtsd2ss %xmm4, %xmm4 + movaps %xmm4, %xmm0 + ret +..B1.13: + pxor %xmm3, %xmm3 + andl $-2147483648, %edx + cvtss2sd -8(%rsp), %xmm3 + andps .L_2il0floatpacket.17(%rip), %xmm3 + pxor %xmm4, %xmm4 + movsd .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm6, %xmm6 + mulsd %xmm3, %xmm0 + movsd .L_2il0floatpacket.4(%rip), %xmm7 + movsd .L_2il0floatpacket.6(%rip), %xmm5 + addsd .L_2il0floatpacket.1(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movl -16(%rsp), %esi + movl %esi, %eax + shll $26, %eax + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + sarl $26, %eax + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm7 + mulsd %xmm2, %xmm5 + addsd .L_2il0floatpacket.5(%rip), %xmm7 + addsd .L_2il0floatpacket.7(%rip), %xmm5 + mulsd %xmm2, %xmm7 + mulsd %xmm3, %xmm5 + addsd .L_2il0floatpacket.18(%rip), %xmm7 + movslq %eax, %rax + movaps %xmm7, %xmm0 + subl %eax, %esi + addsd %xmm5, %xmm0 + subsd %xmm5, %xmm7 + shrl $6, %esi + shll $23, %esi + shlq $3, %rax + lea 1056964608(%rsi), %ecx + negl %esi + addl $1056964608, %esi + orl %edx, %ecx + orl %esi, %edx + movl %edx, -20(%rsp) + movq __libm_expf_table_64@GOTPCREL(%rip), %rdx + movl %ecx, -24(%rsp) + cvtss2sd -24(%rsp), %xmm4 + cvtss2sd -20(%rsp), %xmm6 + mulsd 256(%rdx,%rax), %xmm0 + negq %rax + mulsd %xmm4, %xmm0 + mulsd 256(%rdx,%rax), %xmm7 + mulsd %xmm6, %xmm7 + subsd %xmm7, %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.14: + cmpl $1119016188, %eax + jbe ..B1.18 +..B1.15: + cmpl $2139095040, %eax + jb ..B1.19 +..B1.16: + movss -8(%rsp), %xmm0 + addss %xmm0, %xmm0 +..B1.17: + ret +..B1.18: + pxor %xmm3, %xmm3 + andl $-2147483648, %edx + cvtss2sd -8(%rsp), %xmm3 + andps .L_2il0floatpacket.17(%rip), %xmm3 + movsd .L_2il0floatpacket.0(%rip), %xmm0 + mulsd %xmm3, %xmm0 + movsd .L_2il0floatpacket.6(%rip), %xmm4 + movl $0, -24(%rsp) + addsd .L_2il0floatpacket.1(%rip), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm0 + movl -16(%rsp), %eax + movl %eax, %ecx + shll $26, %ecx + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + mulsd .L_2il0floatpacket.3(%rip), %xmm1 + sarl $26, %ecx + addsd %xmm1, %xmm3 + movaps %xmm3, %xmm2 + subl %ecx, %eax + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm4 + addsd .L_2il0floatpacket.5(%rip), %xmm0 + addsd .L_2il0floatpacket.7(%rip), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm3, %xmm4 + shrl $6, %eax + addsd %xmm4, %xmm0 + shll $20, %eax + addsd .L_2il0floatpacket.18(%rip), %xmm0 + addl $1071644672, %eax + movslq %ecx, %rcx + orl %eax, %edx + movl %edx, -20(%rsp) + movq __libm_expf_table_64@GOTPCREL(%rip), %rdx + mulsd 256(%rdx,%rcx,8), %xmm0 + mulsd -24(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + ret +..B1.19: + lea _large_value_32(%rip), %rax + shrl $31, %edx + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.12(%rip), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type sinhf,@function + .size sinhf,.-sinhf + .data +# -- End sinhf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.17: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40571547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x41680000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.3: + .long 0xfefa39ef,0xbf862e42 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xeb78fa85,0x3fa56420 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x008d6118,0x3fe00000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xda752d4f,0x3fc55550 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xffffe7c6,0x3fefffff + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x4bc96d7d,0x3ec749d8 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x326ed15a,0x3f811111 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0xd09557cf,0x3f2a0168 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x552ed1e2,0x3fc55555 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x1fc8e65a,0x3f8111c7 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x4fa4d5d9,0x3fc55555 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +.L_2il0floatpacket.18: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,8 + .align 4 +.L_2il0floatpacket.2: + .long 0x4b400000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.12: + .long 0x71800000 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,4 + .align 4 +.L_2il0floatpacket.15: + .long 0x0d800000 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,4 + .align 4 +.L_2il0floatpacket.16: + .long 0x3f800000 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sinhl.S b/external/sgx_libm/intel64/sinhl.S new file mode 100644 index 0000000000..5aa5fd95fd --- /dev/null +++ b/external/sgx_libm/intel64/sinhl.S @@ -0,0 +1,960 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinhl.c" + .text +..TXTST0: +# -- Begin sinhl + .text + .align 16,0x90 + .globl sinhl +sinhl: +# parameter 1: 96 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_sinhl.1: +..L2: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + xorb %cl, %cl +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movzwl 104(%rsp), %esi + andl $32767, %esi + cmpl $16396, %esi + jge ..B1.59 +..B1.4: + cmpl $16382, %esi + jge ..B1.46 +..B1.5: + movzwl 82(%rsp), %edx + cmpl $16378, %esi + jge ..B1.39 +..B1.6: + cmpl $16373, %esi + jge ..B1.32 +..B1.7: + cmpl $16366, %esi + jge ..B1.25 +..B1.8: + cmpl $16308, %esi + jge ..B1.18 +..B1.9: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.13 +..B1.10: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.11: + fldcw 80(%rsp) +..B1.12: + movzwl 104(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.13: + testl %esi, %esi + jle ..B1.70 +..B1.14: + fldt 96(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + faddp %st, %st(1) + fmull (%rdx) + fstpt (%rsp) +..B1.15: + testb %cl, %cl + je ..B1.17 +..B1.16: + fldcw 82(%rsp) +..B1.17: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.18: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.22 +..B1.19: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.20: + fldcw 80(%rsp) +..B1.21: + movb $1, %cl +..B1.22: + fldt 96(%rsp) + lea _Q3(%rip), %rax + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 82(%rsp) +..B1.24: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.25: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.26: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.27: + fldcw 80(%rsp) +..B1.28: + movb $1, %cl +..B1.29: + fldt 96(%rsp) + lea 16+_Q2(%rip), %rax + fld %st(0) + lea _Q2(%rip), %rdx + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.31 +..B1.30: + fldcw 82(%rsp) +..B1.31: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.32: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.36 +..B1.33: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.34: + fldcw 80(%rsp) +..B1.35: + movb $1, %cl +..B1.36: + fldt 96(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rsi + fmul %st(1), %st + lea 16+_Q1(%rip), %rdx + fld %st(0) + lea _Q1(%rip), %rdi + fmul %st(1), %st + testb %cl, %cl + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.38 +..B1.37: + fldcw 82(%rsp) +..B1.38: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.39: + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.43 +..B1.40: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.41: + fldcw 80(%rsp) +..B1.42: + movb $1, %cl +..B1.43: + fldt 96(%rsp) + lea _TWO_48H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 112+_Q(%rip), %rsi + fmul %st(3), %st + lea 80+_Q(%rip), %rdi + fld %st(0) + lea 48+_Q(%rip), %r8 + fmul %st(1), %st + lea 16+_Q(%rip), %r9 + fldl (%rax) + lea 96+_Q(%rip), %r10 + lea 64+_Q(%rip), %r11 + lea 32+_Q(%rip), %rax + lea 128+_Q(%rip), %rdx + testb %cl, %cl + fadd %st, %st(4) + fxch %st(4) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(4) + fld %st(3) + fxch %st(3) + fsub %st(4), %st + fmul %st, %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fxch %st(4) + fstpt 48(%rsp) + fxch %st(2) + fstpt 32(%rsp) + fldt 32(%rsp) + fmul %st(0), %st + fldt (%rdx) + lea _Q(%rip), %rdx + fmul %st, %st(2) + fmulp %st, %st(1) + fldt (%rsi) + fmul %st(4), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(4), %st + fldt (%r10) + fmul %st(5), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(5) + fldt (%rdx) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + fld %st(0) + fmul %st(3), %st + fldt 96(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldt 32(%rsp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.45 +..B1.44: + fldt 16(%rsp) + fstpt 32(%rsp) +..B1.84: + fldcw 82(%rsp) +..B1.45: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.46: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.50 +..B1.47: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.48: + fldcw 80(%rsp) +..B1.49: + movb $1, %cl +..B1.50: + fldt 96(%rsp) + lea ones(%rip), %rax + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %rdi + fldt .L_2il0floatpacket.1(%rip) + lea _TWO_32(%rip), %r8 + fldt .L_2il0floatpacket.2(%rip) + lea _TWO_32P(%rip), %r9 + movb 105(%rsp), %dl + lea 64+_P(%rip), %r10 + fldl (%rdi) + andb $-128, %dl + fldl (%r8) + lea 32+_P(%rip), %r11 + shrb $7, %dl + lea 48+_P(%rip), %rdi + fstl 16(%rsp) + movzbl %dl, %esi + lea 16+_P(%rip), %r8 + fldl (%rax,%rsi,8) + lea _P(%rip), %rsi + fmul %st, %st(6) + fxch %st(5) + fmul %st(6), %st + fadd %st(2), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fmulp %st, %st(2) + fxch %st(4) + fstpt 96(%rsp) + fldt 96(%rsp) + fsubp %st, %st(2) + fld %st(1) + movl 32(%rsp), %edx + fsub %st(1), %st + movsbq %dl, %rax + subl %eax, %edx + shrl $8, %edx + fxch %st(3) + fstpt 64(%rsp) + fldt 64(%rsp) + fldl (%r9) + fmul %st(4), %st + fxch %st(5) + fmulp %st, %st(4) + movzwl 104(%rsp), %r9d + fxch %st(3) + fsubrp %st, %st(4) + fld %st(3) + andl $32767, %r9d + cmpl $16387, %r9d + fxch %st(2) + fsub %st(4), %st + fsubp %st, %st(1) + fadd %st, %st(1) + fld %st(1) + fmul %st(2), %st + fldt (%r10) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rdi) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + jle ..B1.54 +..B1.51: + addl $16350, %edx + faddp %st, %st(1) + movzwl 72(%rsp), %esi + andl $32767, %edx + andl $-32768, %esi + shlq $4, %rax + orl %edx, %esi + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + testb %cl, %cl + movw %si, 72(%rsp) + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + fld %st(0) + fmul %st(3), %st + fxch %st(3) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(3) + fmul %st, %st(4) + fld %st(0) + fadd %st(5), %st + fsubr %st, %st(1) + fxch %st(5) + faddp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(1) + fldt 64(%rsp) + fmul %st, %st(3) + fmulp %st, %st(1) + fldl 16(%rsp) + fmul %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + je ..B1.86 +..B1.52: + fstpt 48(%rsp) +..B1.85: + fldcw 82(%rsp) + jmp ..B1.53 +..B1.86: + fstp %st(0) +..B1.53: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.54: + je ..B1.74 +..B1.55: + fxch %st(2) + fstpt 48(%rsp) +..B1.56: + movzwl 56(%rsp), %r8d + lea 16382(%rdx), %esi + negl %edx + andl $-32768, %r8d + addl $16382, %edx + fld %st(0) + andl $32767, %edx + andl $32767, %esi + shlq $4, %rax + orl %edx, %r8d + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + fadd %st(2), %st + fxch %st(2) + fsubrp %st, %st(1) + fld %st(2) + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + negq %rax + fstpt 16(%rsp) + fldt 16(%rsp) + movzwl 72(%rsp), %edi + fadd %st(1), %st + fmulp %st, %st(4) + fld %st(4) + fmul %st(1), %st + andl $-32768, %edi + faddp %st, %st(4) + fldl 2056(%rdx,%rax) + orl %esi, %edi + fldl 2048(%rdx,%rax) + testb %cl, %cl + fld %st(0) + movw %di, 72(%rsp) + fadd %st(2), %st + fmulp %st, %st(5) + fld %st(6) + fmul %st(2), %st + movw %r8w, 56(%rsp) + fsubrp %st, %st(5) + fxch %st(4) + fstpt 32(%rsp) + fxch %st(3) + fmul %st, %st(5) + fldt 16(%rsp) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fsub %st(5), %st + fsubr %st, %st(4) + fxch %st(5) + fsubrp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 32(%rsp) + faddp %st, %st(2) + fldt 64(%rsp) + fmul %st, %st(1) + fld %st(1) + fxch %st(4) + fmulp %st, %st(1) + fldt 48(%rsp) + fmul %st, %st(5) + fxch %st(4) + fsub %st(5), %st + fsubr %st, %st(2) + fxch %st(5) + fsubrp %st, %st(2) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + fsubrp %st, %st(2) + faddp %st, %st(1) + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.58 +..B1.57: + fldcw 82(%rsp) +..B1.58: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.59: + je ..B1.79 +..B1.60: + movzwl 82(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.64 +..B1.61: + orl $-64768, %edx + movw %dx, 80(%rsp) +..B1.62: + fldcw 80(%rsp) +..B1.63: + movzwl 104(%rsp), %esi + movb $1, %cl + andl $32767, %esi +..B1.64: + cmpl $32767, %esi + jne ..B1.66 +..B1.65: + fldt 96(%rsp) + fstpt (%rsp) + jmp ..B1.67 +..B1.66: + movb 105(%rsp), %al + lea _large_value_80(%rip), %rsi + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %edx + shlq $4, %rdx + fldt (%rsi,%rdx) + fmulp %st, %st(1) + fstpt (%rsp) +..B1.67: + testb %cl, %cl + je ..B1.69 +..B1.68: + fldcw 82(%rsp) +..B1.69: + fldt (%rsp) + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 +..B1.70: + cmpl $0, 100(%rsp) + jne ..B1.72 +..B1.71: + cmpl $0, 96(%rsp) + je ..B1.73 +..B1.72: + fldt 96(%rsp) + lea _small_value_80(%rip), %rsi + movb 105(%rsp), %al + andb $-128, %al + shrb $7, %al + fldt (%rsi) + movzbl %al, %edx + shlq $4, %rdx + fldt (%rsi,%rdx) + fmulp %st, %st(1) + fstpt 32(%rsp) + fldt 32(%rsp) + faddp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.73: + fldt 96(%rsp) + fstpt (%rsp) + jmp ..B1.15 +..B1.74: + movl 100(%rsp), %esi + cmpl $-782985146, %esi + ja ..B1.51 +..B1.75: + jne ..B1.55 +..B1.76: + cmpl $1501741449, 96(%rsp) + ja ..B1.51 + jmp ..B1.55 +..B1.79: + movl 100(%rsp), %eax + cmpl $-1317741120, %eax + jb ..B1.4 +..B1.80: + jne ..B1.60 +..B1.81: + cmpl $833536233, 96(%rsp) + jbe ..B1.4 + jmp ..B1.60 + .align 16,0x90 + .cfi_endproc + .type sinhl,@function + .size sinhl,.-sinhl + .data +# -- End sinhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 2 +_Q3: + .word 21845 + .word 44373 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 29491 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 1838 + .word 3745 + .word 35050 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 56472 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 6470 + .word 8609 + .word 207 + .word 53261 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 51515 + .word 9159 + .word 10794 + .word 47344 + .word 16364 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 43620 + .word 43690 + .word 43690 + .word 43690 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 52382 + .word 3328 + .word 208 + .word 53261 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 44665 + .word 46658 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 15678 + .word 35942 + .word 11071 + .word 55090 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 10412 + .word 23121 + .word 12507 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 37213 + .word 41879 + .word 65084 + .word 55102 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 1721 + .word 42148 + .word 19309 + .word 52099 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,144 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sinl.S b/external/sgx_libm/intel64/sinl.S new file mode 100644 index 0000000000..eb9b79a4a8 --- /dev/null +++ b/external/sgx_libm/intel64/sinl.S @@ -0,0 +1,1048 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sinl.c" + .text +..TXTST0: +# -- Begin sinl + .text + .align 16,0x90 + .globl sinl +sinl: +# parameter 1: 192 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_sinl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + subq $160, %rsp + .cfi_def_cfa_offset 192 + xorb %r12b, %r12b + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 152(%rsp) +..B1.2: + fnstcw 130(%rsp) +..B1.3: + movzwl 200(%rsp), %edx + andl $32767, %edx + movzwl 130(%rsp), %ecx + cmpl $32767, %edx + je ..B1.70 +..B1.4: + cmpl $16378, %edx + jge ..B1.42 +..B1.5: + cmpl $16372, %edx + jge ..B1.34 +..B1.6: + cmpl $16364, %edx + jge ..B1.26 +..B1.7: + cmpl $16308, %edx + jge ..B1.18 +..B1.8: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.12 +..B1.9: + orl $-64768, %ecx + movw %cx, 128(%rsp) +..B1.10: + fldcw 128(%rsp) +..B1.11: + movzwl 200(%rsp), %edx + movb $1, %r12b + andl $32767, %edx +..B1.12: + testl %edx, %edx + jle ..B1.59 +..B1.13: + fldt 192(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + fsubp %st, %st(1) + fmull (%rdx) + fstpt 16(%rsp) +..B1.14: + testb %r12b, %r12b + je ..B1.16 +..B1.15: + fldcw 130(%rsp) +..B1.16: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.17: + fldt 16(%rsp) + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.18: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.22 +..B1.19: + orl $-64768, %ecx + movw %cx, 128(%rsp) +..B1.20: + fldcw 128(%rsp) +..B1.21: + movb $1, %r12b +..B1.22: + fldt 192(%rsp) + lea _SP3(%rip), %rax + testb %r12b, %r12b + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.24 +..B1.23: + fldcw 130(%rsp) +..B1.24: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.25: + fldt 16(%rsp) + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.26: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.30 +..B1.27: + orl $-64768, %ecx + movw %cx, 128(%rsp) +..B1.28: + fldcw 128(%rsp) +..B1.29: + movb $1, %r12b +..B1.30: + fldt 192(%rsp) + lea 16+_SP2(%rip), %rax + fld %st(0) + lea _SP2(%rip), %rdx + fmul %st(1), %st + testb %r12b, %r12b + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.32 +..B1.31: + fldcw 130(%rsp) +..B1.32: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.33: + fldt 16(%rsp) + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.34: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.38 +..B1.35: + orl $-64768, %ecx + movw %cx, 128(%rsp) +..B1.36: + fldcw 128(%rsp) +..B1.37: + movb $1, %r12b +..B1.38: + fldt 192(%rsp) + lea 48+_SP1(%rip), %rax + fld %st(0) + lea 32+_SP1(%rip), %rcx + fmul %st(1), %st + lea 16+_SP1(%rip), %rdx + fld %st(0) + lea _SP1(%rip), %rbx + fmul %st(1), %st + testb %r12b, %r12b + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmulp %st, %st(2) + fldt (%rbx) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.40 +..B1.39: + fldcw 130(%rsp) +..B1.40: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.41: + fldt 16(%rsp) + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.42: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.46 +..B1.43: + orl $-64768, %ecx + movw %cx, 128(%rsp) +..B1.44: + fldcw 128(%rsp) +..B1.45: + movzwl 200(%rsp), %edx + movb $1, %r12b + andl $32767, %edx +..B1.46: + cmpl $16382, %edx + jge ..B1.48 +..B1.47: + fldt 192(%rsp) + xorl %ecx, %ecx + movb 201(%rsp), %bpl + lea _TWO_52H(%rip), %rdx + andb $-128, %bpl + shrb $7, %bpl + fldl (%rdx) + movzbl %bpl, %eax + lea _ones(%rip), %rbp + fldl (%rbp,%rax,8) + fmul %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fxch %st(1) + fstpt 16(%rsp) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(1) + fld %st(0) + fsubr %st(2), %st + fxch %st(2) + fstpt 192(%rsp) + fldt 192(%rsp) + jmp ..B1.51 +..B1.48: + je ..B1.67 +..B1.49: + fldt 192(%rsp) + lea _ones(%rip), %rbp + movzbl 201(%rsp), %ebx + xorl %edi, %edi + andl $128, %ebx + shrl $7, %ebx + fmull (%rbp,%rbx,8) + fstpt 192(%rsp) + fldt 192(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 208 + lea 152(%rsp), %rsi + fstpt (%rsp) +..___tag_value_sinl.55: + call __libm_reduce_pi04l@PLT +..___tag_value_sinl.56: +..B1.85: + movl %eax, %ecx + addq $16, %rsp + .cfi_def_cfa_offset 192 +..B1.50: + fldl 136(%rsp) + lea 1(%rcx), %eax + lea _TWO_52H(%rip), %rdx + fld %st(0) + movsd 136(%rsp), %xmm0 + shrl $2, %eax + xorl %eax, %ebx + mulsd (%rdx), %xmm0 + andl $1, %ebx + fldl (%rbp,%rbx,8) + movsd %xmm0, 32(%rsp) + fstpt 16(%rsp) + fldl 32(%rsp) + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(1) + fldl 144(%rsp) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st +..B1.51: + fld %st(1) + lea _TWO_53H(%rip), %rax + fmul %st(3), %st + fld %st(3) + fmul %st(2), %st + incl %ecx + faddp %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fld %st(2) + fmul %st(3), %st + testb $2, %cl + fld %st(0) + fadd %st(2), %st + fstpt 80(%rsp) + fldt 80(%rsp) + fld %st(1) + fmul %st(3), %st + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fmul %st(0), %st + fld %st(0) + faddp %st, %st(2) + fldl (%rax) + fstpt 48(%rsp) + je ..B1.53 +..B1.52: + fstp %st(2) + fstp %st(2) + fstp %st(2) + lea 128+_CP(%rip), %rsi + lea 112+_CP(%rip), %rax + lea 96+_CP(%rip), %rdi + lea 80+_CP(%rip), %rdx + lea 64+_CP(%rip), %r8 + lea 48+_CP(%rip), %rcx + lea 32+_CP(%rip), %r9 + lea 16+_CP(%rip), %rbx + fldt (%rax) + lea _CP(%rip), %r10 + lea 160+_CP(%rip), %r11 + lea 144+_CP(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rsi) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r10) + faddp %st, %st(2) + fldt 80(%rsp) + fmulp %st, %st(2) + faddp %st, %st(1) + fldt 96(%rsp) + fldt 64(%rsp) + fldt 112(%rsp) + fldt 48(%rsp) + fldt (%r11) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fxch %st(3) + fmulp %st, %st(5) + fldt (%rax) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(5) + fld %st(4) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fadd %st(2), %st + fmul %st, %st(1) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldl (%rbp) + fadd %st, %st(1) + fsub %st(1), %st + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 16(%rsp) + fmul %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fstpt 32(%rsp) + jmp ..B1.54 +..B1.53: + lea 112+_SP(%rip), %rax + lea 80+_SP(%rip), %rdx + lea 48+_SP(%rip), %rcx + lea 128+_SP(%rip), %rbp + lea 16+_SP(%rip), %rbx + lea 96+_SP(%rip), %rsi + lea 64+_SP(%rip), %rdi + lea 32+_SP(%rip), %r8 + fldt (%rax) + lea _SP(%rip), %r9 + lea 160+_SP(%rip), %r10 + lea 144+_SP(%rip), %r11 + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rbx) + faddp %st, %st(1) + fmul %st(2), %st + fldt (%rbp) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%r9) + faddp %st, %st(3) + fldt 80(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + fldt 96(%rsp) + fldt 64(%rsp) + fldt (%r10) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + fmulp %st, %st(2) + fldt (%r11) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldt 112(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fld %st(5) + fldt 48(%rsp) + fmul %st(2), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(3) + fmul %st(1), %st + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fldt 16(%rsp) + fmul %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 32(%rsp) +..B1.54: + testb %r12b, %r12b + je ..B1.56 +..B1.55: + fldcw 130(%rsp) +..B1.56: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.57: + fldt 32(%rsp) + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 192 + .cfi_offset 3, -24 + .cfi_offset 6, -32 + .cfi_offset 12, -16 +..B1.58: + call __stack_chk_fail@PLT +..B1.59: + cmpl $0, 196(%rsp) + jne ..B1.61 +..B1.60: + cmpl $0, 192(%rsp) + je ..B1.62 +..B1.61: + fldt 192(%rsp) + lea _TWO_75(%rip), %rbx + movb 201(%rsp), %al + lea _small_value_80(%rip), %rcx + andb $-128, %al + lea 8+_TWO_75(%rip), %rbp + shrb $7, %al + fldl (%rbx) + fmul %st(1), %st + fsubp %st, %st(1) + fldt (%rcx) + fxch %st(1) + fmull (%rbp) + movzbl %al, %edx + shlq $4, %rdx + fstpt 16(%rsp) + fldt (%rcx,%rdx) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.14 +..B1.62: + fldt 192(%rsp) + fstpt 16(%rsp) + jmp ..B1.14 +..B1.67: + movl 196(%rsp), %eax + cmpl $-921707870, %eax + jb ..B1.47 +..B1.68: + jne ..B1.49 +..B1.69: + cmpl $560513589, 192(%rsp) + jbe ..B1.47 + jmp ..B1.49 +..B1.70: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.74 +..B1.71: + orl $-64768, %ecx + movw %cx, 128(%rsp) +..B1.72: + fldcw 128(%rsp) +..B1.73: + movb $1, %r12b +..B1.74: + cmpl $-2147483648, 196(%rsp) + jne ..B1.77 +..B1.75: + cmpl $0, 192(%rsp) + jne ..B1.77 +..B1.76: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt 16(%rsp) + jmp ..B1.78 +..B1.77: + fldt 192(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) +..B1.78: + testb %r12b, %r12b + je ..B1.80 +..B1.79: + fldcw 130(%rsp) +..B1.80: + movq 152(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.58 +..B1.81: + fldt 16(%rsp) + addq $160, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type sinl,@function + .size sinl,.-sinl + .data +# -- End sinl + .section .rodata, "a" + .align 4 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 2 +_SP3: + .word 17476 + .word 43656 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _SP3,@object + .size _SP3,16 + .align 2 +_SP2: + .word 43210 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 1587 + .word 57422 + .word 34932 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP2,@object + .size _SP2,32 + .align 2 +_SP1: + .word 43690 + .word 43690 + .word 43690 + .word 43690 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 12518 + .word 34952 + .word 34952 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 43088 + .word 7396 + .word 207 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 55827 + .word 48618 + .word 3602 + .word 47342 + .word 16364 + .word 0 + .word 0 + .word 0 + .type _SP1,@object + .size _SP1,64 + .align 2 +_CP: + .word 51631 + .word 16464 + .word 16497 + .word 44012 + .word 16306 + .word 0 + .word 0 + .word 0 + .word 43685 + .word 43690 + .word 43690 + .word 43690 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 46557 + .word 2912 + .word 24758 + .word 46603 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 28380 + .word 3328 + .word 208 + .word 53261 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 23816 + .word 50302 + .word 32187 + .word 37874 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 49866 + .word 64527 + .word 51070 + .word 36726 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 65056 + .word 3638 + .word 41889 + .word 51659 + .word 49114 + .word 0 + .word 0 + .word 0 + .word 13834 + .word 11317 + .word 33607 + .word 55101 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 40709 + .word 42374 + .word 64411 + .word 45709 + .word 49098 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43008 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _CP,@object + .size _CP,176 + .align 2 +_SP: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 34948 + .word 34952 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 53243 + .word 3328 + .word 208 + .word 53261 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 30577 + .word 46649 + .word 7466 + .word 47343 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 11760 + .word 43464 + .word 11071 + .word 55090 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 47000 + .word 43232 + .word 12444 + .word 45202 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 52983 + .word 47009 + .word 40440 + .word 55103 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 35433 + .word 14927 + .word 40941 + .word 51860 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 1340 + .word 16361 + .word 50747 + .word 38523 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _SP,@object + .size _SP,176 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sqrt.S b/external/sgx_libm/intel64/sqrt.S new file mode 100644 index 0000000000..ca5b6693cf --- /dev/null +++ b/external/sgx_libm/intel64/sqrt.S @@ -0,0 +1,80 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrt.c" + .text +..TXTST0: +# -- Begin sqrt + .text + .align 16,0x90 + .globl sqrt +sqrt: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_sqrt.1: +..L2: + + pushq %rsi + .cfi_def_cfa_offset 16 +..B1.2: + movq %xmm0, %xmm2 + xorpd %xmm1, %xmm1 + sqrtsd %xmm0, %xmm0 + ucomisd %xmm1, %xmm2 + jae ..B1.5 + jp ..B1.5 + movq %xmm0, (%rsp) +..B1.3: + movq (%rsp), %xmm0 +.L_2TAG_PACKET_0.0.2: +..B1.5: + popq %rcx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type sqrt,@function + .size sqrt,.-sqrt + .data +# -- End sqrt + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sqrt_tab_t.S b/external/sgx_libm/intel64/sqrt_tab_t.S new file mode 100644 index 0000000000..64efaa5b42 --- /dev/null +++ b/external/sgx_libm/intel64/sqrt_tab_t.S @@ -0,0 +1,815 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrt_tab_t.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __sqrt_t_table +__sqrt_t_table: + .long 0x400672f9 + .long 0xc060f4f5 + .long 0xba659415,0x40052c06 + .long 0x4003de5a + .long 0xc05e5b2f + .long 0xfe66c797,0x4005170e + .long 0x40015b59 + .long 0xc05bce24 + .long 0x13b32f30,0x40050255 + .long 0x3ffdd2b8 + .long 0xc0594d7e + .long 0xdae79d26,0x4004edd7 + .long 0x3ff90fa1 + .long 0xc056d8e8 + .long 0x13220f7f,0x4004d996 + .long 0x3ff46c51 + .long 0xc0547012 + .long 0xb3fa6a49,0x4004c58e + .long 0x3fefe7bb + .long 0xc05212ae + .long 0xa20bcbc6,0x4004b1c0 + .long 0x3feb80db + .long 0xc04fc070 + .long 0xc76937e4,0x40049e2a + .long 0x3fe736b7 + .long 0xc04d790f + .long 0x1f93d776,0x40048acc + .long 0x3fe30860 + .long 0xc04b3c44 + .long 0xa15ae4b0,0x400477a3 + .long 0x3fdef4f0 + .long 0xc04909cc + .long 0x697f4726,0x400464b0 + .long 0x3fdafb8a + .long 0xc046e163 + .long 0x6403b289,0x400451f1 + .long 0x3fd71b59 + .long 0xc044c2ca + .long 0xb7aecc11,0x40043f65 + .long 0x3fd35392 + .long 0xc042adc3 + .long 0x76dd1156,0x40042d0c + .long 0x3fcfa371 + .long 0xc040a213 + .long 0xd01983f9,0x40041ae4 + .long 0x3fcc0a37 + .long 0xc03e9f7d + .long 0xbecf4a2b,0x400408ed + .long 0x3fc88730 + .long 0xc03ca5ca + .long 0x7b0eeed7,0x4003f726 + .long 0x3fc519ad + .long 0xc03ab4c5 + .long 0x50846ea3,0x4003e58e + .long 0x3fc1c105 + .long 0xc038cc36 + .long 0x3decb5a1,0x4003d424 + .long 0x3fbe7c97 + .long 0xc036ebed + .long 0xb2048812,0x4003c2e7 + .long 0x3fbb4bc6 + .long 0xc03513b5 + .long 0xb29c9700,0x4003b1d7 + .long 0x3fb82dfc + .long 0xc0334360 + .long 0xa89c0a0a,0x4003a0f3 + .long 0x3fb522a8 + .long 0xc0317abe + .long 0xc440fe15,0x4003903a + .long 0x3fb2293e + .long 0xc02fb9a2 + .long 0x596206ff,0x40037fac + .long 0x3faf4138 + .long 0xc02dffe0 + .long 0xb44972f3,0x40036f47 + .long 0x3fac6a14 + .long 0xc02c4d4c + .long 0x1107001d,0x40035f0c + .long 0x3fa9a354 + .long 0xc02aa1be + .long 0xe7c62025,0x40034ef8 + .long 0x3fa6ec80 + .long 0xc028fd0d + .long 0x815ec2da,0x40033f0d + .long 0x3fa44523 + .long 0xc0275f11 + .long 0x2e0b0c0e,0x40032f49 + .long 0x3fa1accc + .long 0xc025c7a5 + .long 0x66b9f8b6,0x40031fab + .long 0x3f9f230f + .long 0xc02436a3 + .long 0x788665c8,0x40031033 + .long 0x3f9ca783 + .long 0xc022abe8 + .long 0xded1e594,0x400300e0 + .long 0x3f9a39c2 + .long 0xc0212751 + .long 0x0842a075,0x4002f1b3 + .long 0x3f97d96b + .long 0xc01fa8bb + .long 0x494fbc25,0x4002e2a9 + .long 0x3f95861f + .long 0xc01e3006 + .long 0x2b018f07,0x4002d3c3 + .long 0x3f933f82 + .long 0xc01cbd11 + .long 0x142c8510,0x4002c500 + .long 0x3f91053c + .long 0xc01b4fbd + .long 0x7f1daa26,0x4002b65f + .long 0x3f8ed6f7 + .long 0xc019e7eb + .long 0xdda5e7e2,0x4002a7e0 + .long 0x3f8cb461 + .long 0xc018857f + .long 0xc9948908,0x40029983 + .long 0x3f8a9d2a + .long 0xc017285b + .long 0xaa59eeeb,0x40028b47 + .long 0x3f889104 + .long 0xc015d062 + .long 0xf2821162,0x40027d2b + .long 0x3f868fa5 + .long 0xc0147d7c + .long 0x669445ed,0x40026f30 + .long 0x3f8498c3 + .long 0xc0132f8a + .long 0x3b85fad8,0x40026154 + .long 0x3f82ac1a + .long 0xc011e676 + .long 0x3e988364,0x40025397 + .long 0x3f80c964 + .long 0xc010a224 + .long 0xcf7601fc,0x400245f8 + .long 0x3f7de0c1 + .long 0xc00f627e + .long 0xaab7acb5,0x40023878 + .long 0x3f7a419f + .long 0xc00e276a + .long 0x36aab17c,0x40022b16 + .long 0x3f76b4e6 + .long 0xc00cf0d1 + .long 0x0f2aa54c,0x40021dd1 + .long 0x3f733a1e + .long 0xc00bbe9d + .long 0xdacdcc1a,0x400210a8 + .long 0x3f6fd0d4 + .long 0xc00a90b8 + .long 0x30e54b08,0x4002039d + .long 0x3f6c7897 + .long 0xc009670b + .long 0x8e05e1b3,0x4001f6ad + .long 0x3f6930fa + .long 0xc0084182 + .long 0xa51b1d74,0x4001e9d9 + .long 0x3f65f994 + .long 0xc0072009 + .long 0x1cf6297b,0x4001dd21 + .long 0x3f62d1fe + .long 0xc006028b + .long 0x8103f9e2,0x4001d083 + .long 0x3f5fb9d5 + .long 0xc004e8f5 + .long 0x7cc51dba,0x4001c400 + .long 0x3f5cb0b7 + .long 0xc003d333 + .long 0xa3e7f161,0x4001b797 + .long 0x3f59b649 + .long 0xc002c134 + .long 0xb4f86544,0x4001ab48 + .long 0x3f56ca2e + .long 0xc001b2e5 + .long 0x4bc09f7e,0x40019f13 + .long 0x3f53ec0f + .long 0xc000a834 + .long 0x04a8d6a9,0x400192f7 + .long 0x3f511b96 + .long 0xbfff4221 + .long 0x9d5a7e63,0x400186f3 + .long 0x3f4e5870 + .long 0xbffd3ad2 + .long 0xb211c804,0x40017b08 + .long 0x3f4ba24c + .long 0xbffb3a5b + .long 0xfc173425,0x40016f35 + .long 0x3f48f8dc + .long 0xbff9409b + .long 0x1e599490,0x4001637b + .long 0x3f465bd5 + .long 0xbff74d73 + .long 0xc880b659,0x400157d7 + .long 0x3f43caeb + .long 0xbff560c5 + .long 0xbd156bcf,0x40014c4b + .long 0x3f4145d7 + .long 0xbff37a71 + .long 0x9283ab1d,0x400140d6 + .long 0x3f3ecc53 + .long 0xbff19a5c + .long 0x19073c6b,0x40013578 + .long 0x3f3c5e1c + .long 0xbfefc069 + .long 0xfd4a0663,0x40012a2f + .long 0x3f39faef + .long 0xbfedec7b + .long 0xede7b908,0x40011efd + .long 0x3f37a28c + .long 0xbfec1e78 + .long 0xb252b4d7,0x400113e1 + .long 0x3f3554b6 + .long 0xbfea5645 + .long 0xf9904832,0x400108da + .long 0x3f33112e + .long 0xbfe893c7 + .long 0x7e150822,0x4000fde9 + .long 0x3f30d7ba + .long 0xbfe6d6e5 + .long 0xfd1a5086,0x4000f30c + .long 0x3f2ea821 + .long 0xbfe51f87 + .long 0x3d632fc4,0x4000e845 + .long 0x3f2c822c + .long 0xbfe36d94 + .long 0xf11c7d33,0x4000dd91 + .long 0x3f2a65a2 + .long 0xbfe1c0f3 + .long 0xd61ea754,0x4000d2f2 + .long 0x3f285250 + .long 0xbfe0198f + .long 0xc0d51627,0x4000c867 + .long 0x3f264803 + .long 0xbfde7750 + .long 0x61244ec6,0x4000bdf0 + .long 0x3f244687 + .long 0xbfdcda1f + .long 0x7a6b2e99,0x4000b38c + .long 0x3f224dad + .long 0xbfdb41e7 + .long 0xd19f4764,0x4000a93b + .long 0x3f205d44 + .long 0xbfd9ae92 + .long 0x2ad2e77d,0x40009efe + .long 0x3f1e751f + .long 0xbfd8200d + .long 0x5dbcaf97,0x400094d3 + .long 0x3f1c9510 + .long 0xbfd69641 + .long 0x14b04d5e,0x40008abb + .long 0x3f1abcec + .long 0xbfd5111c + .long 0x2cda2e67,0x400080b5 + .long 0x3f18ec88 + .long 0xbfd3908a + .long 0x6ab42acc,0x400076c1 + .long 0x3f1723ba + .long 0xbfd21477 + .long 0x8e9d45e3,0x40006cdf + .long 0x3f156259 + .long 0xbfd09cd0 + .long 0x62171386,0x4000630f + .long 0x3f13a83e + .long 0xbfcf2984 + .long 0xbfb6fb6a,0x40005950 + .long 0x3f11f542 + .long 0xbfcdba80 + .long 0x68a7e5f7,0x40004fa3 + .long 0x3f104940 + .long 0xbfcc4fb3 + .long 0x2ef38d27,0x40004607 + .long 0x3f0ea414 + .long 0xbfcae90c + .long 0xe03435f5,0x40003c7b + .long 0x3f0d0598 + .long 0xbfc98678 + .long 0x3b99fee4,0x40003301 + .long 0x3f0b6dab + .long 0xbfc827e9 + .long 0x28d4ef26,0x40002997 + .long 0x3f09dc2b + .long 0xbfc6cd4e + .long 0x6d906b03,0x4000203d + .long 0x3f0850f6 + .long 0xbfc57696 + .long 0xd0880103,0x400016f3 + .long 0x3f06cbec + .long 0xbfc423b3 + .long 0x37509185,0x40000dba + .long 0x3f054cee + .long 0xbfc2d495 + .long 0x66ce8c53,0x40000490 + .long 0x3f03d3dc + .long 0xbfc1892d + .long 0x72279bc0,0x3ffff6ec + .long 0x3f026099 + .long 0xbfc0416c + .long 0xeda5cd81,0x3fffe4d6 + .long 0x3f00f308 + .long 0xbfbefd45 + .long 0x0c012834,0x3fffd2e0 + .long 0x3eff1616 + .long 0xbfbdbca8 + .long 0x52f75b3b,0x3fffc107 + .long 0x3efc510e + .long 0xbfbc7f88 + .long 0x799a7f94,0x3fffaf4c + .long 0x3ef996c2 + .long 0xbfbb45d9 + .long 0x55edcc30,0x3fff9daf + .long 0x3ef6e6fb + .long 0xbfba0f8b + .long 0x537eb099,0x3fff8c2f + .long 0x3ef44186 + .long 0xbfb8dc92 + .long 0x38cd722f,0x3fff7acc + .long 0x3ef1a631 + .long 0xbfb7ace2 + .long 0xc800858f,0x3fff6985 + .long 0x3eef14c9 + .long 0xbfb6806e + .long 0xaed5086e,0x3fff585b + .long 0x3eec8d1e + .long 0xbfb55729 + .long 0x88bfcc7e,0x3fff474d + .long 0x3eea0f02 + .long 0xbfb43109 + .long 0x3db0d3c5,0x3fff365b + .long 0x3ee79a45 + .long 0xbfb30e00 + .long 0x4f3507e4,0x3fff2584 + .long 0x3ee52ebb + .long 0xbfb1ee03 + .long 0x7dab64e4,0x3fff14c8 + .long 0x3ee2cc37 + .long 0xbfb0d107 + .long 0x9247f5f1,0x3fff0427 + .long 0x3ee0728f + .long 0xbfafb700 + .long 0x252987ab,0x3ffef3a1 + .long 0x3ede2198 + .long 0xbfae9fe4 + .long 0x12fb7286,0x3ffee335 + .long 0x3edbd929 + .long 0xbfad8ba8 + .long 0x0e1fbfd6,0x3ffed2e3 + .long 0x3ed9991a + .long 0xbfac7a41 + .long 0xc33c7a14,0x3ffec2aa + .long 0x3ed76144 + .long 0xbfab6ba5 + .long 0xf7968902,0x3ffeb28b + .long 0x3ed53180 + .long 0xbfaa5fca + .long 0x72271f31,0x3ffea286 + .long 0x3ed309a8 + .long 0xbfa956a6 + .long 0xf446dfa2,0x3ffe9299 + .long 0x3ed0e998 + .long 0xbfa8502f + .long 0x31fc7113,0x3ffe82c6 + .long 0x3eced12c + .long 0xbfa74c5a + .long 0xc17a77a1,0x3ffe730a + .long 0x3eccc040 + .long 0xbfa64b20 + .long 0xb683d568,0x3ffe6367 + .long 0x3ecab6b3 + .long 0xbfa54c76 + .long 0x93851ebf,0x3ffe53dc + .long 0x3ec8b462 + .long 0xbfa45054 + .long 0x48e8d2d8,0x3ffe4469 + .long 0x3ec6b92d + .long 0xbfa356b0 + .long 0x72ed724b,0x3ffe350d + .long 0x3ec4c4f3 + .long 0xbfa25f82 + .long 0xf5acec61,0x3ffe25c8 + .long 0x3ec2d795 + .long 0xbfa16ac0 + .long 0x67c5c2c3,0x3ffe169b + .long 0x3ec0f0f5 + .long 0xbfa07864 + .long 0xd8265439,0x3ffe0784 + .long 0x3fbe23c8 + .long 0xc01f118b + .long 0x1ec5a532,0x3ffdf113 + .long 0x3fba7d85 + .long 0xc01d3ac5 + .long 0x0000d4c8,0x3ffdd36c + .long 0x3fb6f02d + .long 0xc01b6d00 + .long 0x57cb9031,0x3ffdb61c + .long 0x3fb37ae5 + .long 0xc019a7fe + .long 0x72ed1c77,0x3ffd9922 + .long 0x3fb01cdd + .long 0xc017eb83 + .long 0x95b0b15c,0x3ffd7c7c + .long 0x3facd54f + .long 0xc0163758 + .long 0x6603fec1,0x3ffd6029 + .long 0x3fa9a37b + .long 0xc0148b45 + .long 0x469777ae,0x3ffd4427 + .long 0x3fa686a9 + .long 0xc012e714 + .long 0xa71adcce,0x3ffd2874 + .long 0x3fa37e28 + .long 0xc0114a91 + .long 0x0c38599d,0x3ffd0d10 + .long 0x3fa08950 + .long 0xc00fb58a + .long 0xfc8f14cb,0x3ffcf1f7 + .long 0x3f9da77d + .long 0xc00e27d0 + .long 0x5027d5b6,0x3ffcd72b + .long 0x3f9ad814 + .long 0xc00ca133 + .long 0x77f69e05,0x3ffcbca8 + .long 0x3f981a7f + .long 0xc00b2187 + .long 0x4e14c785,0x3ffca26e + .long 0x3f956e2d + .long 0xc009a89f + .long 0x67cdb787,0x3ffc887b + .long 0x3f92d292 + .long 0xc0083650 + .long 0x7d1a45e5,0x3ffc6ece + .long 0x3f90472b + .long 0xc006ca73 + .long 0x887296e4,0x3ffc5566 + .long 0x3f8dcb76 + .long 0xc00564de + .long 0x1b6717e3,0x3ffc3c42 + .long 0x3f8b5ef7 + .long 0xc004056b + .long 0x264323b8,0x3ffc2360 + .long 0x3f890138 + .long 0xc002abf5 + .long 0x8c0c1853,0x3ffc0abf + .long 0x3f86b1c6 + .long 0xc0015858 + .long 0x4069b804,0x3ffbf25f + .long 0x3f847032 + .long 0xc0000a6f + .long 0xf2c0f56b,0x3ffbda3d + .long 0x3f823c13 + .long 0xbffd8435 + .long 0xe82b41be,0x3ffbc25a + .long 0x3f801501 + .long 0xbffafe6e + .long 0xd0c8f1c2,0x3ffbaab4 + .long 0x3f7bf536 + .long 0xbff8834b + .long 0xc1a3163f,0x3ffb934a + .long 0x3f77d900 + .long 0xbff6128d + .long 0xc6e21d7e,0x3ffb7c1b + .long 0x3f73d4ab + .long 0xbff3abf8 + .long 0xe60015a5,0x3ffb6526 + .long 0x3f6fe784 + .long 0xbff14f50 + .long 0x21cbd876,0x3ffb4e6b + .long 0x3f6c10e1 + .long 0xbfeefc5d + .long 0x9ee07b4c,0x3ffb37e7 + .long 0x3f68501d + .long 0xbfecb2e7 + .long 0x6d2d48b6,0x3ffb219b + .long 0x3f64a499 + .long 0xbfea72b8 + .long 0xa81c9b61,0x3ffb0b85 + .long 0x3f610dbb + .long 0xbfe83b9d + .long 0x902fdc83,0x3ffaf5a5 + .long 0x3f5d8aee + .long 0xbfe60d61 + .long 0x27f22c44,0x3ffadffa + .long 0x3f5a1ba3 + .long 0xbfe3e7d3 + .long 0xa3884d02,0x3ffaca82 + .long 0x3f56bf51 + .long 0xbfe1cac5 + .long 0x554d369e,0x3ffab53e + .long 0x3f537570 + .long 0xbfdfb606 + .long 0x5450035a,0x3ffaa02c + .long 0x3f503d7f + .long 0xbfdda969 + .long 0xe28ff013,0x3ffa8b4b + .long 0x3f4d1702 + .long 0xbfdba4c2 + .long 0x3ccf3bef,0x3ffa769c + .long 0x3f4a017f + .long 0xbfd9a7e6 + .long 0xadd0d7d8,0x3ffa621c + .long 0x3f46fc82 + .long 0xbfd7b2ab + .long 0x73a23063,0x3ffa4dcc + .long 0x3f440799 + .long 0xbfd5c4e8 + .long 0xd9b8e6fd,0x3ffa39aa + .long 0x3f412258 + .long 0xbfd3de77 + .long 0x47a99575,0x3ffa25b7 + .long 0x3f3e4c53 + .long 0xbfd1ff2e + .long 0xd6d4c329,0x3ffa11f0 + .long 0x3f3b8525 + .long 0xbfd026eb + .long 0x1e725d64,0x3ff9fe57 + .long 0x3f38cc6a + .long 0xbfce5587 + .long 0x4a856a92,0x3ff9eae9 + .long 0x3f3621c3 + .long 0xbfcc8ae0 + .long 0xd3534a3f,0x3ff9d7a6 + .long 0x3f3384d1 + .long 0xbfcac6d1 + .long 0xf6170fe5,0x3ff9c48e + .long 0x3f30f53c + .long 0xbfc9093b + .long 0x43d296cd,0x3ff9b1a1 + .long 0x3f2e72ac + .long 0xbfc751fb + .long 0xfbbf8768,0x3ff99edc + .long 0x3f2bfccb + .long 0xbfc5a0f2 + .long 0xaa7c60ad,0x3ff98c41 + .long 0x3f299349 + .long 0xbfc3f600 + .long 0x9e5e0c30,0x3ff979ce + .long 0x3f2735d5 + .long 0xbfc25106 + .long 0x47a967c7,0x3ff96783 + .long 0x3f24e423 + .long 0xbfc0b1e7 + .long 0x213a91b3,0x3ff9555f + .long 0x3f229de8 + .long 0xbfbf1887 + .long 0xb92f1e71,0x3ff94361 + .long 0x3f2062db + .long 0xbfbd84c7 + .long 0x4e9fbb55,0x3ff9318a + .long 0x3f1e32b7 + .long 0xbfbbf68e + .long 0x8c3e135d,0x3ff91fd8 + .long 0x3f1c0d36 + .long 0xbfba6dc0 + .long 0xe5486399,0x3ff90e4b + .long 0x3f19f217 + .long 0xbfb8ea42 + .long 0xbecd10bc,0x3ff8fce3 + .long 0x3f17e11a + .long 0xbfb76bfc + .long 0xbe525978,0x3ff8eb9f + .long 0x3f15d9ff + .long 0xbfb5f2d3 + .long 0x48293568,0x3ff8da7f + .long 0x3f13dc8c + .long 0xbfb47eb1 + .long 0x05d5e650,0x3ff8c982 + .long 0x3f11e884 + .long 0xbfb30f7c + .long 0x60ba5dac,0x3ff8b8a7 + .long 0x3f0ffdb0 + .long 0xbfb1a51e + .long 0xefd22e82,0x3ff8a7ee + .long 0x3f0e1bd7 + .long 0xbfb03f80 + .long 0x47805b92,0x3ff89758 + .long 0x3f0c42c3 + .long 0xbfaede8a + .long 0xcd57cc04,0x3ff886e2 + .long 0x3f0a7241 + .long 0xbfad8229 + .long 0x46b3d0d8,0x3ff8768e + .long 0x3f08aa1e + .long 0xbfac2a48 + .long 0x4cc7ad59,0x3ff8665a + .long 0x3f06ea27 + .long 0xbfaad6cf + .long 0x3347fcf1,0x3ff85646 + .long 0x3f05322e + .long 0xbfa987ad + .long 0xcc7c68cf,0x3ff84651 + .long 0x3f038204 + .long 0xbfa83ccd + .long 0x95d48bda,0x3ff8367c + .long 0x3f01d97a + .long 0xbfa6f61c + .long 0x40b0d774,0x3ff826c6 + .long 0x3f003866 + .long 0xbfa5b387 + .long 0x521e69ab,0x3ff8172e + .long 0x3efd3d38 + .long 0xbfa474fb + .long 0x64a31380,0x3ff807b4 + .long 0x3efa17e4 + .long 0xbfa33a67 + .long 0x344463f5,0x3ff7f858 + .long 0x3ef70080 + .long 0xbfa203b9 + .long 0x536e309d,0x3ff7e919 + .long 0x3ef3f6bd + .long 0xbfa0d0df + .long 0x51d9db7f,0x3ff7d9f7 + .long 0x3ef0fa4e + .long 0xbf9fa1ca + .long 0x03bdd024,0x3ff7caf2 + .long 0x3eee0ae8 + .long 0xbf9e7667 + .long 0xd06a95a6,0x3ff7bc08 + .long 0x3eeb2842 + .long 0xbf9d4ea8 + .long 0x96a621bf,0x3ff7ad3b + .long 0x3ee85215 + .long 0xbf9c2a7d + .long 0xfac56bba,0x3ff79e89 + .long 0x3ee5881d + .long 0xbf9b09d5 + .long 0x79c2bb58,0x3ff78ff3 + .long 0x3ee2ca16 + .long 0xbf99eca3 + .long 0xfa3e419f,0x3ff78177 + .long 0x3ee017bf + .long 0xbf98d2d7 + .long 0x07c1acb7,0x3ff77317 + .long 0x3edd70d7 + .long 0xbf97bc62 + .long 0x49bbc9e6,0x3ff764d0 + .long 0x3edad522 + .long 0xbf96a937 + .long 0x8367baca,0x3ff756a3 + .long 0x3ed84462 + .long 0xbf959948 + .long 0x6acc6906,0x3ff74890 + .long 0x3ed5be5d + .long 0xbf948c88 + .long 0xbcc0ac8a,0x3ff73a96 + .long 0x3ed342d8 + .long 0xbf9382e7 + .long 0xed77fbb2,0x3ff72cb5 + .long 0x3ed0d19d + .long 0xbf927c5c + .long 0x1262b283,0x3ff71eee + .long 0x3ece6a74 + .long 0xbf9178d7 + .long 0x928b4839,0x3ff7113e + .long 0x3ecc0d29 + .long 0xbf90784d + .long 0x46765494,0x3ff703a7 + .long 0x3ec9b988 + .long 0xbf8f7ab1 + .long 0xd271890f,0x3ff6f627 + .long 0x3ec76f5d + .long 0xbf8e7ff8 + .long 0x1330f37e,0x3ff6e8c0 + .long 0x3ec52e79 + .long 0xbf8d8817 + .long 0xca5f6659,0x3ff6db6f + .long 0x3ec2f6aa + .long 0xbf8c9300 + .long 0x7a3c2c24,0x3ff6ce36 + .long 0x3ec0c7c2 + .long 0xbf8ba0aa + .long 0x18d80162,0x3ff6c114 + .long 0x3ebea193 + .long 0xbf8ab109 + .long 0x4b1eb26b,0x3ff6b408 + .long 0x3ebc83f0 + .long 0xbf89c412 + .long 0xcd29fcba,0x3ff6a712 + .long 0x3eba6eaf + .long 0xbf88d9bb + .long 0x664b0f09,0x3ff69a33 + .long 0x3eb861a4 + .long 0xbf87f1f9 + .long 0xcfa00fd5,0x3ff68d69 + .long 0x3eb65ca6 + .long 0xbf870cc3 + .long 0xe9d2a6b3,0x3ff680b5 + .long 0x3eb45f8c + .long 0xbf862a0e + .long 0x5e7a0e0b,0x3ff67417 + .long 0x3eb26a30 + .long 0xbf8549d1 + .long 0xfe6852bf,0x3ff6678d + .long 0x3eb07c6a + .long 0xbf846c01 + .long 0x6f577b40,0x3ff65b19 + .long 0x3eae9616 + .long 0xbf839096 + .long 0x94beacb4,0x3ff64eb9 + .long 0x3eacb70d + .long 0xbf82b786 + .long 0x2d87a5b4,0x3ff6426e + .long 0x3eaadf2d + .long 0xbf81e0c9 + .long 0x133eca3a,0x3ff63637 + .long 0x3ea90e52 + .long 0xbf810c55 + .long 0xf3b8ca64,0x3ff62a13 + .long 0x3ea74459 + .long 0xbf803a22 + .long 0xb1e928a1,0x3ff61e04 + .long 0x3ea58123 + .long 0xbf7ed44e + .long 0xf9c12cea,0x3ff61208 + .long 0x3ea3c48d + .long 0xbf7d38b8 + .long 0xb0f105b4,0x3ff60620 + .long 0x3ea20e79 + .long 0xbf7ba172 + .long 0x9c747236,0x3ff5fa4b + .long 0x3ea05ec6 + .long 0xbf7a0e6a + .long 0x79454bb5,0x3ff5ee89 + .long 0x3e9eb556 + .long 0xbf787f92 + .long 0x2c804088,0x3ff5e2da + .long 0x3e9d120c + .long 0xbf76f4d9 + .long 0x686ac26d,0x3ff5d73d + .long 0x3e9b74ca + .long 0xbf756e31 + .long 0x1493b001,0x3ff5cbb3 + .long 0x3e99dd75 + .long 0xbf73eb8c + .long 0x048406f4,0x3ff5c03b + .long 0x3e984bef + .long 0xbf726cd9 + .long 0xf4dbeebe,0x3ff5b4d4 + .long 0x3e96c01f + .long 0xbf70f20b + .long 0xbbe3f38a,0x3ff5a980 + .long 0x3e9539e9 + .long 0xbf6f7b14 + .long 0x37ac4b0e,0x3ff59e3e + .long 0x3e93b933 + .long 0xbf6e07e5 + .long 0x294f0c16,0x3ff5930d + .long 0x3e923de4 + .long 0xbf6c9870 + .long 0x5aaed17d,0x3ff587ed + .long 0x3e90c7e3 + .long 0xbf6b2caa + .long 0xc550e64d,0x3ff57cde + .long 0x3e8f5718 + .long 0xbf69c484 + .long 0x1e1a64d6,0x3ff571e1 + .long 0x3e8deb6b + .long 0xbf685ff2 + .long 0x4990847b,0x3ff566f4 + .long 0x3e8c84c4 + .long 0xbf66fee6 + .long 0x0dee1cfa,0x3ff55c18 + .long 0x3e8b230e + .long 0xbf65a155 + .long 0x4a4098f7,0x3ff5514c + .long 0x3e89c631 + .long 0xbf644732 + .long 0xd65fdb98,0x3ff54690 + .long 0x3e886e18 + .long 0xbf62f072 + .long 0x9358f9fc,0x3ff53be5 + .type __sqrt_t_table,@object + .size __sqrt_t_table,4096 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/sqrtf_gen.S b/external/sgx_libm/intel64/sqrtf_gen.S new file mode 100644 index 0000000000..317421b256 --- /dev/null +++ b/external/sgx_libm/intel64/sqrtf_gen.S @@ -0,0 +1,93 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrtf_gen.c" + .text +..TXTST0: +# -- Begin sqrtf + .text + .align 16,0x90 + .globl sqrtf +sqrtf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_sqrtf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + movss %xmm0, 8(%rsp) +..B1.2: + testb $128, 11(%rsp) + jne .L_2TAG_PACKET_0.0.2 + sqrtss %xmm0, %xmm0 +.L_2TAG_PACKET_1.0.2: + jmp ..B1.5 +.L_2TAG_PACKET_0.0.2: + ucomiss 4+zeros(%rip), %xmm0 + sqrtss %xmm0, %xmm0 + jp .L_2TAG_PACKET_1.0.2 + je .L_2TAG_PACKET_1.0.2 + movss %xmm0, (%rsp) +..B1.3: + movss (%rsp), %xmm0 +.L_2TAG_PACKET_2.0.2: +..B1.5: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type sqrtf,@function + .size sqrtf,.-sqrtf + .data +# -- End sqrtf + .section .rodata, "a" + .align 16 + .align 16 +zeros: + .long 0 + .long 2147483648 + .type zeros,@object + .size zeros,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/sqrtl.S b/external/sgx_libm/intel64/sqrtl.S new file mode 100644 index 0000000000..2d105b0cee --- /dev/null +++ b/external/sgx_libm/intel64/sqrtl.S @@ -0,0 +1,211 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "sqrtl.c" + .text +..TXTST0: +# -- Begin sqrtl + .text + .align 16,0x90 + .globl sqrtl +sqrtl: +# parameter 1: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_sqrtl.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %cl, %cl + fldt 64(%rsp) + fstpt 32(%rsp) +..B1.2: + fnstcw 10(%rsp) +..B1.3: + movzwl 72(%rsp), %eax + andl $32767, %eax + cmpl $32767, %eax + je ..B1.23 +..B1.4: + testb $-128, 73(%rsp) + jne ..B1.13 +..B1.5: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.7: + fldcw 8(%rsp) +..B1.8: + movb $1, %cl +..B1.9: + fldt 32(%rsp) + fsqrt + fstpt 16(%rsp) +..B1.10: + testb %cl, %cl + je ..B1.12 +..B1.11: + fldcw 10(%rsp) +..B1.12: + fldt 16(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.13: + testl %eax, %eax + jne ..B1.16 +..B1.14: + cmpq $0, 64(%rsp) + jne ..B1.16 +..B1.15: + fldt 64(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.16: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.20 +..B1.17: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.18: + fldcw 8(%rsp) +..B1.19: + movb $1, %cl +..B1.20: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + testb %cl, %cl + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 16(%rsp) + je ..B1.22 +..B1.21: + fldcw 10(%rsp) +..B1.22: + fldt 16(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.23: + cmpl $-2147483648, 68(%rsp) + jne ..B1.25 +..B1.24: + cmpl $0, 64(%rsp) + je ..B1.4 +..B1.25: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.31 +..B1.26: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.27: + fldcw 8(%rsp) +..B1.28: + fldt 64(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) +..B1.29: + fldcw 10(%rsp) +..B1.30: + fldt 16(%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.31: + fldt 64(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) + jmp ..B1.30 + .align 16,0x90 + .cfi_endproc + .type sqrtl,@function + .size sqrtl,.-sqrtl + .data +# -- End sqrtl + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tan_gen.S b/external/sgx_libm/intel64/tan_gen.S new file mode 100644 index 0000000000..f7cc7fa1db --- /dev/null +++ b/external/sgx_libm/intel64/tan_gen.S @@ -0,0 +1,2170 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tan_gen.c" + .text +..TXTST0: +# -- Begin tan + .text + .align 16,0x90 + .globl tan +tan: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_tan.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + movsd %xmm0, 8(%rsp) +..B1.2: + pextrw $3, %xmm0, %eax + andl $32767, %eax + subl $16314, %eax + cmpl $270, %eax + ja .L_2TAG_PACKET_0.0.1 + movapd ONEHALF(%rip), %xmm5 + movapd MUL16(%rip), %xmm6 + unpcklpd %xmm0, %xmm0 + movapd sign_mask(%rip), %xmm4 + andpd %xmm0, %xmm4 + movapd PI32INV(%rip), %xmm1 + mulpd %xmm0, %xmm1 + orps %xmm4, %xmm5 + addpd %xmm5, %xmm1 + movapd %xmm1, %xmm7 + unpckhpd %xmm7, %xmm7 + cvttsd2si %xmm7, %rdx + cvttpd2dq %xmm1, %xmm1 + cvtdq2pd %xmm1, %xmm1 + mulpd %xmm6, %xmm1 + movapd P_1(%rip), %xmm3 + movq QQ_2(%rip), %xmm5 + addq $469248, %rdx + movapd P_2(%rip), %xmm4 + mulpd %xmm1, %xmm3 + andq $31, %rdx + mulsd %xmm1, %xmm5 + movq %rdx, %rcx + mulpd %xmm1, %xmm4 + shlq $1, %rcx + subpd %xmm3, %xmm0 + mulpd P_3(%rip), %xmm1 + addq %rcx, %rdx + shlq $2, %rcx + addq %rcx, %rdx + addsd %xmm0, %xmm5 + movapd %xmm0, %xmm2 + subpd %xmm4, %xmm0 + movq ONE(%rip), %xmm6 + shlq $4, %rdx + lea Ctable(%rip), %rax + andpd MASK_35(%rip), %xmm5 + movapd %xmm0, %xmm3 + addq %rdx, %rax + subpd %xmm0, %xmm2 + unpckhpd %xmm0, %xmm0 + divsd %xmm5, %xmm6 + subpd %xmm4, %xmm2 + movapd 16(%rax), %xmm7 + subsd %xmm5, %xmm3 + mulpd %xmm0, %xmm7 + subpd %xmm1, %xmm2 + movapd 48(%rax), %xmm1 + mulpd %xmm0, %xmm1 + movapd 96(%rax), %xmm4 + mulpd %xmm0, %xmm4 + addsd %xmm3, %xmm2 + movapd %xmm0, %xmm3 + mulpd %xmm0, %xmm0 + addpd (%rax), %xmm7 + addpd 32(%rax), %xmm1 + mulpd %xmm0, %xmm1 + addpd 80(%rax), %xmm4 + addpd %xmm1, %xmm7 + movapd 112(%rax), %xmm1 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm0 + addpd %xmm1, %xmm4 + movapd 64(%rax), %xmm1 + mulpd %xmm0, %xmm1 + addpd %xmm1, %xmm7 + movapd %xmm3, %xmm1 + mulpd %xmm0, %xmm3 + mulsd %xmm0, %xmm0 + mulpd 144(%rax), %xmm1 + mulpd %xmm3, %xmm4 + movq %xmm1, %xmm3 + addpd %xmm4, %xmm7 + movq %xmm1, %xmm4 + mulsd %xmm7, %xmm0 + unpckhpd %xmm7, %xmm7 + addsd %xmm7, %xmm0 + unpckhpd %xmm1, %xmm1 + addsd %xmm1, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm1 + movq %xmm2, %xmm4 + movq 144(%rax), %xmm7 + unpckhpd %xmm2, %xmm2 + addsd 152(%rax), %xmm7 + mulsd %xmm2, %xmm7 + addsd 136(%rax), %xmm7 + addsd %xmm1, %xmm7 + addsd %xmm7, %xmm0 + movq ONE(%rip), %xmm7 + mulsd %xmm6, %xmm4 + movq 168(%rax), %xmm2 + andpd %xmm6, %xmm2 + mulsd %xmm2, %xmm5 + mulsd 160(%rax), %xmm6 + subsd %xmm5, %xmm7 + subsd 128(%rax), %xmm2 + subsd %xmm4, %xmm7 + mulsd %xmm6, %xmm7 + movq %xmm3, %xmm4 + subsd %xmm2, %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm4 + addsd %xmm4, %xmm0 + subsd %xmm7, %xmm0 + addsd %xmm3, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_0.0.1: + jg .L_2TAG_PACKET_1.0.1 + pextrw $3, %xmm0, %eax + movl %eax, %edx + andl $32752, %eax + je .L_2TAG_PACKET_2.0.1 + andl $32767, %edx + cmpl $15904, %edx + jb .L_2TAG_PACKET_3.0.1 + movq %xmm0, %xmm2 + movq %xmm0, %xmm3 + movq Q_11(%rip), %xmm1 + mulsd %xmm0, %xmm2 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm1 + addsd Q_9(%rip), %xmm1 + mulsd %xmm2, %xmm1 + addsd Q_7(%rip), %xmm1 + mulsd %xmm2, %xmm1 + addsd Q_5(%rip), %xmm1 + mulsd %xmm2, %xmm1 + addsd Q_3(%rip), %xmm1 + mulsd %xmm3, %xmm1 + addsd %xmm1, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_3.0.1: + movq TWO_POW_55(%rip), %xmm3 + mulsd %xmm0, %xmm3 + addsd %xmm3, %xmm0 + mulsd TWO_POW_M55(%rip), %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_2.0.1: + movq %xmm0, %xmm1 + mulsd %xmm1, %xmm1 + jmp ..B1.4 +.L_2TAG_PACKET_1.0.1: + pextrw $3, %xmm0, %eax + andl $32752, %eax + cmpl $32752, %eax + je .L_2TAG_PACKET_4.0.1 + pextrw $3, %xmm0, %ecx + andl $32752, %ecx + subl $16224, %ecx + shrl $7, %ecx + andl $65532, %ecx + lea PI_INV_TABLE(%rip), %r11 + addq %r11, %rcx + movd %xmm0, %rax + movl 20(%rcx), %r10d + movl 24(%rcx), %r8d + movl %eax, %edx + shrq $21, %rax + orl $-2147483648, %eax + shrl $11, %eax + movl %r10d, %r9d + imulq %rdx, %r10 + imulq %rax, %r9 + imulq %rax, %r8 + movl 16(%rcx), %esi + movl 12(%rcx), %edi + movl %r10d, %r11d + shrq $32, %r10 + addq %r10, %r9 + addq %r8, %r11 + movl %r11d, %r8d + shrq $32, %r11 + addq %r11, %r9 + movl %esi, %r10d + imulq %rdx, %rsi + imulq %rax, %r10 + movl %edi, %r11d + imulq %rdx, %rdi + movl %esi, %ebx + shrq $32, %rsi + addq %rbx, %r9 + movl %r9d, %ebx + shrq $32, %r9 + addq %rsi, %r10 + addq %r9, %r10 + shlq $32, %rbx + orq %rbx, %r8 + imulq %rax, %r11 + movl 8(%rcx), %r9d + movl 4(%rcx), %esi + movl %edi, %ebx + shrq $32, %rdi + addq %rbx, %r10 + movl %r10d, %ebx + shrq $32, %r10 + addq %rdi, %r11 + addq %r10, %r11 + movq %r9, %rdi + imulq %rdx, %r9 + imulq %rax, %rdi + movl %r9d, %r10d + shrq $32, %r9 + addq %r10, %r11 + movl %r11d, %r10d + shrq $32, %r11 + addq %r9, %rdi + addq %r11, %rdi + movq %rsi, %r9 + imulq %rdx, %rsi + imulq %rax, %r9 + shlq $32, %r10 + orq %rbx, %r10 + movl (%rcx), %eax + movl %esi, %r11d + shrq $32, %rsi + addq %r11, %rdi + movl %edi, %r11d + shrq $32, %rdi + addq %rsi, %r9 + addq %rdi, %r9 + imulq %rax, %rdx + pextrw $3, %xmm0, %ebx + lea PI_INV_TABLE(%rip), %rdi + subq %rdi, %rcx + addl %ecx, %ecx + addl %ecx, %ecx + addl %ecx, %ecx + addl $19, %ecx + movl $32768, %esi + andl %ebx, %esi + shrl $4, %ebx + andl $2047, %ebx + subl $1023, %ebx + subl %ebx, %ecx + addq %rdx, %r9 + movl %ecx, %edx + addl $32, %edx + cmpl $0, %ecx + jl .L_2TAG_PACKET_5.0.1 + negl %ecx + addl $29, %ecx + shll %cl, %r9d + movl %r9d, %edi + andl $1073741823, %r9d + testl $536870912, %r9d + jne .L_2TAG_PACKET_6.0.1 + shrl %cl, %r9d + movl $0, %ebx + shlq $32, %r9 + orq %r11, %r9 +.L_2TAG_PACKET_7.0.1: +.L_2TAG_PACKET_8.0.1: + cmpq $0, %r9 + je .L_2TAG_PACKET_9.0.1 +.L_2TAG_PACKET_10.0.1: + bsr %r9, %r11 + movl $29, %ecx + subl %r11d, %ecx + jle .L_2TAG_PACKET_11.0.1 + shlq %cl, %r9 + movq %r10, %rax + shlq %cl, %r10 + addl %ecx, %edx + negl %ecx + addl $64, %ecx + shrq %cl, %rax + shrq %cl, %r8 + orq %rax, %r9 + orq %r8, %r10 +.L_2TAG_PACKET_12.0.1: + cvtsi2sdq %r9, %xmm0 + shrq $1, %r10 + cvtsi2sdq %r10, %xmm3 + xorpd %xmm4, %xmm4 + shll $4, %edx + negl %edx + addl $16368, %edx + orl %esi, %edx + xorl %ebx, %edx + pinsrw $3, %edx, %xmm4 + movq PI_4(%rip), %xmm2 + movq 8+PI_4(%rip), %xmm7 + xorpd %xmm5, %xmm5 + subl $1008, %edx + pinsrw $3, %edx, %xmm5 + mulsd %xmm4, %xmm0 + shll $16, %esi + sarl $31, %esi + mulsd %xmm5, %xmm3 + movq %xmm0, %xmm1 + mulsd %xmm2, %xmm0 + shrl $30, %edi + addsd %xmm3, %xmm1 + mulsd %xmm2, %xmm3 + addl %esi, %edi + xorl %esi, %edi + mulsd %xmm1, %xmm7 + movl %edi, %eax + addsd %xmm3, %xmm7 + movq %xmm0, %xmm2 + addsd %xmm7, %xmm0 + subsd %xmm0, %xmm2 + addsd %xmm2, %xmm7 + movapd PI32INV(%rip), %xmm1 + unpcklpd %xmm0, %xmm0 + movapd sign_mask(%rip), %xmm4 + andpd %xmm0, %xmm4 + mulpd %xmm0, %xmm1 + unpcklpd %xmm7, %xmm7 + movapd ONEHALF(%rip), %xmm5 + movapd MUL16(%rip), %xmm6 + orps %xmm4, %xmm5 + addpd %xmm5, %xmm1 + movapd %xmm1, %xmm5 + unpckhpd %xmm5, %xmm5 + cvttsd2si %xmm5, %edx + cvttpd2dq %xmm1, %xmm1 + cvtdq2pd %xmm1, %xmm1 + mulpd %xmm6, %xmm1 + movapd P_1(%rip), %xmm3 + movq QQ_2(%rip), %xmm5 + shll $4, %eax + addl $469248, %edx + movapd P_2(%rip), %xmm4 + mulpd %xmm1, %xmm3 + addl %eax, %edx + andl $31, %edx + mulsd %xmm1, %xmm5 + movl %edx, %ecx + mulpd %xmm1, %xmm4 + shll $1, %ecx + subpd %xmm3, %xmm0 + mulpd P_3(%rip), %xmm1 + addl %ecx, %edx + shll $2, %ecx + addl %ecx, %edx + addsd %xmm0, %xmm5 + movapd %xmm0, %xmm2 + subpd %xmm4, %xmm0 + movq ONE(%rip), %xmm6 + shll $4, %edx + lea Ctable(%rip), %rax + andpd MASK_35(%rip), %xmm5 + movapd %xmm0, %xmm3 + addq %rdx, %rax + subpd %xmm0, %xmm2 + unpckhpd %xmm0, %xmm0 + divsd %xmm5, %xmm6 + subpd %xmm4, %xmm2 + subsd %xmm5, %xmm3 + subpd %xmm1, %xmm2 + movapd 48(%rax), %xmm1 + addpd %xmm7, %xmm2 + movapd 16(%rax), %xmm7 + mulpd %xmm0, %xmm7 + movapd 96(%rax), %xmm4 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm4 + addsd %xmm3, %xmm2 + movapd %xmm0, %xmm3 + mulpd %xmm0, %xmm0 + addpd (%rax), %xmm7 + addpd 32(%rax), %xmm1 + mulpd %xmm0, %xmm1 + addpd 80(%rax), %xmm4 + addpd %xmm1, %xmm7 + movapd 112(%rax), %xmm1 + mulpd %xmm0, %xmm1 + mulpd %xmm0, %xmm0 + addpd %xmm1, %xmm4 + movapd 64(%rax), %xmm1 + mulpd %xmm0, %xmm1 + addpd %xmm1, %xmm7 + movapd %xmm3, %xmm1 + mulpd %xmm0, %xmm3 + mulsd %xmm0, %xmm0 + mulpd 144(%rax), %xmm1 + mulpd %xmm3, %xmm4 + movq %xmm1, %xmm3 + addpd %xmm4, %xmm7 + movq %xmm1, %xmm4 + mulsd %xmm7, %xmm0 + unpckhpd %xmm7, %xmm7 + addsd %xmm7, %xmm0 + unpckhpd %xmm1, %xmm1 + addsd %xmm1, %xmm3 + subsd %xmm3, %xmm4 + addsd %xmm4, %xmm1 + movq %xmm2, %xmm4 + movq 144(%rax), %xmm7 + unpckhpd %xmm2, %xmm2 + addsd 152(%rax), %xmm7 + mulsd %xmm2, %xmm7 + addsd 136(%rax), %xmm7 + addsd %xmm1, %xmm7 + addsd %xmm7, %xmm0 + movq ONE(%rip), %xmm7 + mulsd %xmm6, %xmm4 + movq 168(%rax), %xmm2 + andpd %xmm6, %xmm2 + mulsd %xmm2, %xmm5 + mulsd 160(%rax), %xmm6 + subsd %xmm5, %xmm7 + subsd 128(%rax), %xmm2 + subsd %xmm4, %xmm7 + mulsd %xmm6, %xmm7 + movq %xmm3, %xmm4 + subsd %xmm2, %xmm3 + addsd %xmm3, %xmm2 + subsd %xmm2, %xmm4 + addsd %xmm4, %xmm0 + subsd %xmm7, %xmm0 + addsd %xmm3, %xmm0 + jmp ..B1.4 +.L_2TAG_PACKET_9.0.1: + addl $64, %edx + movq %r10, %r9 + movq %r8, %r10 + movq $0, %r8 + cmpq $0, %r9 + jne .L_2TAG_PACKET_10.0.1 + addl $64, %edx + movq %r10, %r9 + movq %r8, %r10 + cmpq $0, %r9 + jne .L_2TAG_PACKET_10.0.1 + jmp .L_2TAG_PACKET_12.0.1 +.L_2TAG_PACKET_11.0.1: + je .L_2TAG_PACKET_12.0.1 + negl %ecx + shrq %cl, %r10 + movq %r9, %rax + shrq %cl, %r9 + subl %ecx, %edx + negl %ecx + addl $64, %ecx + shlq %cl, %rax + orq %rax, %r10 + jmp .L_2TAG_PACKET_12.0.1 +.L_2TAG_PACKET_5.0.1: + notl %ecx + shlq $32, %r9 + orq %r11, %r9 + shlq %cl, %r9 + movq %r9, %rdi + testl $-2147483648, %r9d + jne .L_2TAG_PACKET_13.0.1 + shrl %cl, %r9d + movl $0, %ebx + shrq $2, %rdi + jmp .L_2TAG_PACKET_8.0.1 +.L_2TAG_PACKET_6.0.1: + shrl %cl, %r9d + movl $1073741824, %ebx + shrl %cl, %ebx + shlq $32, %r9 + orq %r11, %r9 + shlq $32, %rbx + addl $1073741824, %edi + movq $0, %rcx + movq $0, %r11 + subq %r8, %rcx + sbbq %r10, %r11 + sbbq %r9, %rbx + movq %rcx, %r8 + movq %r11, %r10 + movq %rbx, %r9 + movl $32768, %ebx + jmp .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_13.0.1: + shrl %cl, %r9d + movq $0x100000000, %rbx + shrq %cl, %rbx + movq $0, %rcx + movq $0, %r11 + subq %r8, %rcx + sbbq %r10, %r11 + sbbq %r9, %rbx + movq %rcx, %r8 + movq %r11, %r10 + movq %rbx, %r9 + movl $32768, %ebx + shrq $2, %rdi + addl $1073741824, %edi + jmp .L_2TAG_PACKET_8.0.1 +.L_2TAG_PACKET_4.0.1: + movq 8(%rsp), %xmm0 + mulsd NEG_ZERO(%rip), %xmm0 + movq %xmm0, (%rsp) +.L_2TAG_PACKET_14.0.1: +..B1.4: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type tan,@function + .size tan,.-tan + .data +# -- End tan + .section .rodata, "a" + .align 16 + .align 16 +ONEHALF: + .long 0 + .long 1071644672 + .long 0 + .long 1071644672 + .type ONEHALF,@object + .size ONEHALF,16 + .align 16 +MUL16: + .long 0 + .long 1076887552 + .long 0 + .long 1072693248 + .type MUL16,@object + .size MUL16,16 + .align 16 +sign_mask: + .long 0 + .long 2147483648 + .long 0 + .long 2147483648 + .type sign_mask,@object + .size sign_mask,16 + .align 16 +PI32INV: + .long 1841940611 + .long 1071931184 + .long 1841940611 + .long 1076125488 + .type PI32INV,@object + .size PI32INV,16 + .align 16 +P_1: + .long 1413758976 + .long 1069097467 + .long 1413742592 + .long 1069097467 + .type P_1,@object + .size P_1,16 + .align 16 +P_2: + .long 1734819840 + .long 3174229945 + .long 1280049152 + .long 1028033571 + .type P_2,@object + .size P_2,16 + .align 16 +P_3: + .long 923219018 + .long 984130272 + .long 57701189 + .long 988383790 + .type P_3,@object + .size P_3,16 + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 0 + .long 2284589306 + .long 1066820852 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1441186365 + .long 1065494243 + .long 1431655765 + .long 1070945621 + .long 0 + .long 0 + .long 0 + .long 0 + .long 236289504 + .long 1064135997 + .long 286331153 + .long 1069617425 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1160476131 + .long 1062722102 + .long 463583772 + .long 1068212666 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1313038235 + .long 1066745731 + .long 0 + .long 0 + .long 1013878342 + .long 1067152618 + .long 0 + .long 0 + .long 3663426833 + .long 1065725283 + .long 3693284251 + .long 1069118808 + .long 650852232 + .long 1065882376 + .long 1996245381 + .long 1071000265 + .long 2008746170 + .long 1064664197 + .long 3055842593 + .long 1068578846 + .long 1495406348 + .long 1064652437 + .long 2269530157 + .long 1069711235 + .long 285563696 + .long 1063576465 + .long 1046897440 + .long 1067705865 + .long 233429731 + .long 1063453151 + .long 522045958 + .long 1068476590 + .long 2354785698 + .long 1069102779 + .long 1317599141 + .long 1012432133 + .long 0 + .long 1072693248 + .long 2828230105 + .long 1065606626 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1512545955 + .long 1068119047 + .long 0 + .long 0 + .long 1127048698 + .long 1067909459 + .long 0 + .long 0 + .long 2300200450 + .long 1067254767 + .long 3593250296 + .long 1070233561 + .long 3009365544 + .long 1066902117 + .long 1127373050 + .long 1071173457 + .long 3046103305 + .long 1066371299 + .long 24583402 + .long 1069723988 + .long 4082511758 + .long 1065914199 + .long 3223889699 + .long 1070020367 + .long 548927984 + .long 1065415756 + .long 558065897 + .long 1068949418 + .long 680073315 + .long 1064940726 + .long 388873200 + .long 1068944270 + .long 3763679576 + .long 1070167541 + .long 1497360404 + .long 1009710547 + .long 0 + .long 1072693248 + .long 64931152 + .long 1067729411 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2467582782 + .long 1069256389 + .long 0 + .long 0 + .long 162150096 + .long 1068946420 + .long 0 + .long 0 + .long 3702794237 + .long 1068579152 + .long 3631919291 + .long 1070936926 + .long 3456821413 + .long 1068217218 + .long 2031366438 + .long 1071495745 + .long 1596664020 + .long 1067799281 + .long 1509038701 + .long 1070601643 + .long 583171477 + .long 1067510148 + .long 3785344682 + .long 1070618476 + .long 2402036048 + .long 1067075736 + .long 3233018412 + .long 1069913186 + .long 411280568 + .long 1066710556 + .long 1065584192 + .long 1069747896 + .long 895247324 + .long 1070819848 + .long 500078909 + .long 3161288781 + .long 0 + .long 1072693248 + .long 729983843 + .long 1068994194 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1458794562 + .long 1070398550 + .long 0 + .long 0 + .long 2857777489 + .long 1070137637 + .long 0 + .long 0 + .long 1024359517 + .long 1069876531 + .long 2616040238 + .long 1071582937 + .long 1609024636 + .long 1069675088 + .long 2529240549 + .long 1071836633 + .long 1510128600 + .long 1069440113 + .long 2251697184 + .long 1071253687 + .long 1262761453 + .long 1069142850 + .long 1263091857 + .long 1071190461 + .long 3043383486 + .long 1068885191 + .long 2476932470 + .long 1070842002 + .long 3659995028 + .long 1068669200 + .long 855891755 + .long 1070696894 + .long 2583490354 + .long 1071284857 + .long 3062633575 + .long 1014008623 + .long 0 + .long 1072693248 + .long 2550940471 + .long 1069938201 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3422807297 + .long 1071640847 + .long 0 + .long 0 + .long 1151658053 + .long 1071494715 + .long 0 + .long 0 + .long 929607071 + .long 1071346340 + .long 1037049034 + .long 1072037305 + .long 2786928657 + .long 1071215282 + .long 1447406859 + .long 1072265209 + .long 3490952107 + .long 1071090851 + .long 3205232916 + .long 1071968658 + .long 1297344304 + .long 1070977120 + .long 1066110976 + .long 1071946035 + .long 3803721480 + .long 1070871082 + .long 1496754229 + .long 1071807201 + .long 2982550683 + .long 1070773243 + .long 4014441989 + .long 1071736222 + .long 419968236 + .long 1071717047 + .long 3451266538 + .long 3163444811 + .long 0 + .long 1072693248 + .long 2960267235 + .long 1070745841 + .long 0 + .long 0 + .long 0 + .long 0 + .long 724322768 + .long 1072881308 + .long 0 + .long 0 + .long 643153048 + .long 1072905816 + .long 0 + .long 0 + .long 4285079458 + .long 1072928558 + .long 3912524733 + .long 1072622983 + .long 118362272 + .long 1072952754 + .long 4107767972 + .long 1072827408 + .long 2689502883 + .long 1072976922 + .long 946523347 + .long 1072772766 + .long 573204189 + .long 1073001761 + .long 581531518 + .long 1072826391 + .long 1386236526 + .long 1073026959 + .long 3718905905 + .long 1072832823 + .long 1145558140 + .long 1073052673 + .long 513572637 + .long 1072861969 + .long 716700048 + .long 1071997368 + .long 547126769 + .long 1015523525 + .long 0 + .long 1072693248 + .long 1097907398 + .long 1071420120 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3349892442 + .long 1074290212 + .long 0 + .long 0 + .long 3913197405 + .long 1074501181 + .long 0 + .long 0 + .long 2494034522 + .long 1074739170 + .long 1264738763 + .long 1073084804 + .long 1520293906 + .long 1074899632 + .long 1958936600 + .long 1073411493 + .long 2133649635 + .long 1075052171 + .long 4270740730 + .long 1073574708 + .long 1728930189 + .long 1075224844 + .long 1303998552 + .long 1073799186 + .long 618611933 + .long 1075420255 + .long 1769828046 + .long 1073938542 + .long 2200537986 + .long 1075641421 + .long 433361110 + .long 1074105369 + .long 719595600 + .long 1072317184 + .long 294527206 + .long 3162140088 + .long 0 + .long 1073741824 + .long 3811788216 + .long 3218400550 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1704352102 + .long 1075943001 + .long 0 + .long 0 + .long 2284589306 + .long 1076258036 + .long 0 + .long 0 + .long 2211264291 + .long 1076659010 + .long 0 + .long 1073741824 + .long 1441186365 + .long 1077028579 + .long 1431655765 + .long 1074091349 + .long 876943673 + .long 1077353622 + .long 2863311531 + .long 1074440874 + .long 236289504 + .long 1077767485 + .long 286331153 + .long 1074860305 + .long 2805473311 + .long 1078115278 + .long 95443718 + .long 1075163227 + .long 1160476131 + .long 1078450742 + .long 463583772 + .long 1075552698 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1330165971 + .long 3207850745 + .long 0 + .long 0 + .long 217536623 + .long 1059109098 + .long 0 + .long 0 + .long 3492120849 + .long 3205151475 + .long 602185705 + .long 3215678092 + .long 760422958 + .long 1056312597 + .long 555127889 + .long 1067545266 + .long 3139784124 + .long 3202470837 + .long 3690544014 + .long 3213150171 + .long 95707915 + .long 1053635428 + .long 4003114407 + .long 1064581412 + .long 2034926231 + .long 3199711161 + .long 3759536023 + .long 3210559989 + .long 3826928214 + .long 1050893819 + .long 3837960785 + .long 1061790379 + .long 1526325248 + .long 3217967566 + .long 2356426521 + .long 1025423456 + .long 0 + .long 0 + .long 457728975 + .long 1071088276 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1398462608 + .long 3207303968 + .long 0 + .long 0 + .long 26205983 + .long 1058461213 + .long 0 + .long 0 + .long 56226238 + .long 3204528612 + .long 2754706541 + .long 3215359511 + .long 2187799823 + .long 1055634437 + .long 790323742 + .long 1067402587 + .long 1372385848 + .long 3201651479 + .long 4097292716 + .long 3212856302 + .long 3348210357 + .long 1052830099 + .long 2442796466 + .long 1064337602 + .long 862608142 + .long 3198830754 + .long 170296152 + .long 3210060867 + .long 3755571428 + .long 1049933343 + .long 3614866008 + .long 1061361670 + .long 719978496 + .long 3217669096 + .long 1998842465 + .long 3174703977 + .long 0 + .long 0 + .long 3749156607 + .long 1071048258 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3120498638 + .long 3206749304 + .long 0 + .long 0 + .long 2773578114 + .long 1058009312 + .long 0 + .long 0 + .long 2030783676 + .long 3203817873 + .long 2223654598 + .long 3215071936 + .long 2976134650 + .long 1054987244 + .long 706390066 + .long 1067217386 + .long 4258437615 + .long 3200900378 + .long 1066252975 + .long 3212391267 + .long 815777514 + .long 1051989462 + .long 3202745457 + .long 1064010682 + .long 2493556375 + .long 3198004753 + .long 1046243251 + .long 3209678971 + .long 2593078846 + .long 1049017717 + .long 2763962276 + .long 1060970161 + .long 701480960 + .long 3217377742 + .long 3205862232 + .long 3174660915 + .long 0 + .long 0 + .long 2267016812 + .long 1071015664 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 2107155798 + .long 3206166872 + .long 0 + .long 0 + .long 2642992129 + .long 1057424578 + .long 0 + .long 0 + .long 1936992811 + .long 3203204426 + .long 1485063559 + .long 3214682643 + .long 1432914553 + .long 1054319398 + .long 3996381654 + .long 1067075828 + .long 2833029256 + .long 3200223545 + .long 2866066872 + .long 3211982662 + .long 2432888737 + .long 1051234178 + .long 3669764559 + .long 1063748136 + .long 2458496952 + .long 3197170774 + .long 1948234989 + .long 3209098147 + .long 2843698787 + .long 1048163519 + .long 3398041407 + .long 1060559728 + .long 2829230080 + .long 3217092115 + .long 1034046433 + .long 3174271903 + .long 0 + .long 0 + .long 298675305 + .long 1070989821 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 437603223 + .long 3205589761 + .long 0 + .long 0 + .long 759330352 + .long 1057048511 + .long 0 + .long 0 + .long 3107463368 + .long 3202507988 + .long 3144465176 + .long 3214191500 + .long 2290961810 + .long 1053841035 + .long 1618153340 + .long 1066971547 + .long 3836869393 + .long 3199400272 + .long 584032116 + .long 3211469261 + .long 1245704358 + .long 1050626462 + .long 4247487438 + .long 1063561943 + .long 1669034927 + .long 3196274812 + .long 3844233498 + .long 3208626322 + .long 2706958524 + .long 1047411374 + .long 3857199098 + .long 1060281647 + .long 3593904128 + .long 3216590719 + .long 3267547836 + .long 3172163321 + .long 0 + .long 0 + .long 4076712227 + .long 1070970214 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3290090340 + .long 3204793485 + .long 0 + .long 0 + .long 3685760367 + .long 1056668370 + .long 0 + .long 0 + .long 2655163949 + .long 3201674917 + .long 628750575 + .long 3213566872 + .long 680140505 + .long 1053299777 + .long 2954464709 + .long 1066900026 + .long 803201619 + .long 3198516435 + .long 1466315631 + .long 3210837162 + .long 1611220163 + .long 1049972438 + .long 2766187256 + .long 1063437894 + .long 1804579484 + .long 3195331491 + .long 3695969289 + .long 3207854418 + .long 2617238373 + .long 1046675948 + .long 3095830084 + .long 1060095334 + .long 3789570048 + .long 3216034914 + .long 23826559 + .long 3172048060 + .long 0 + .long 0 + .long 3870939386 + .long 1070956467 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1571758758 + .long 3203672535 + .long 0 + .long 0 + .long 113026373 + .long 1056416381 + .long 0 + .long 0 + .long 1913766298 + .long 3200523326 + .long 2507068734 + .long 3212502004 + .long 4000648818 + .long 1053003803 + .long 2446607349 + .long 1066858259 + .long 912662124 + .long 3197333001 + .long 1349489537 + .long 3209765608 + .long 3412972607 + .long 1049641401 + .long 1721283327 + .long 1063366855 + .long 1466691883 + .long 3194116746 + .long 3852528092 + .long 3206760861 + .long 285443293 + .long 1046158380 + .long 1758739894 + .long 1059895449 + .long 1858781184 + .long 3214984212 + .long 3447575948 + .long 1024675855 + .long 0 + .long 0 + .long 2242038011 + .long 1070948320 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 0 + .long 0 + .long 0 + .long 0 + .long 737611454 + .long 1056336527 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3594790527 + .long 1052911621 + .long 381774871 + .long 1066844524 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3303051618 + .long 1049456050 + .long 3154187623 + .long 1063343722 + .long 0 + .long 0 + .long 0 + .long 0 + .long 528061788 + .long 1045944910 + .long 2469719819 + .long 1059831159 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1431655765 + .long 1070945621 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1571758758 + .long 1056188887 + .long 0 + .long 0 + .long 113026373 + .long 1056416381 + .long 0 + .long 0 + .long 1913766298 + .long 1053039678 + .long 2507068734 + .long 1065018356 + .long 4000648818 + .long 1053003803 + .long 2446607349 + .long 1066858259 + .long 912662124 + .long 1049849353 + .long 1349489537 + .long 1062281960 + .long 3412972607 + .long 1049641401 + .long 1721283327 + .long 1063366855 + .long 1466691883 + .long 1046633098 + .long 3852528092 + .long 1059277213 + .long 285443293 + .long 1046158380 + .long 1758739894 + .long 1059895449 + .long 1858781184 + .long 1067500564 + .long 3447575948 + .long 3172159503 + .long 0 + .long 0 + .long 2242038011 + .long 1070948320 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3290090340 + .long 1057309837 + .long 0 + .long 0 + .long 3685760367 + .long 1056668370 + .long 0 + .long 0 + .long 2655163949 + .long 1054191269 + .long 628750575 + .long 1066083224 + .long 680140505 + .long 1053299777 + .long 2954464709 + .long 1066900026 + .long 803201619 + .long 1051032787 + .long 1466315631 + .long 1063353514 + .long 1611220163 + .long 1049972438 + .long 2766187256 + .long 1063437894 + .long 1804579484 + .long 1047847843 + .long 3695969289 + .long 1060370770 + .long 2617238373 + .long 1046675948 + .long 3095830084 + .long 1060095334 + .long 3789570048 + .long 1068551266 + .long 23826559 + .long 1024564412 + .long 0 + .long 0 + .long 3870939386 + .long 1070956467 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 437603223 + .long 1058106113 + .long 0 + .long 0 + .long 759330352 + .long 1057048511 + .long 0 + .long 0 + .long 3107463368 + .long 1055024340 + .long 3144465176 + .long 1066707852 + .long 2290961810 + .long 1053841035 + .long 1618153340 + .long 1066971547 + .long 3836869393 + .long 1051916624 + .long 584032116 + .long 1063985613 + .long 1245704358 + .long 1050626462 + .long 4247487438 + .long 1063561943 + .long 1669034927 + .long 1048791164 + .long 3844233498 + .long 1061142674 + .long 2706958524 + .long 1047411374 + .long 3857199098 + .long 1060281647 + .long 3593904128 + .long 1069107071 + .long 3267547836 + .long 1024679673 + .long 0 + .long 0 + .long 4076712227 + .long 1070970214 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 2107155798 + .long 1058683224 + .long 0 + .long 0 + .long 2642992129 + .long 1057424578 + .long 0 + .long 0 + .long 1936992811 + .long 1055720778 + .long 1485063559 + .long 1067198995 + .long 1432914553 + .long 1054319398 + .long 3996381654 + .long 1067075828 + .long 2833029256 + .long 1052739897 + .long 2866066872 + .long 1064499014 + .long 2432888737 + .long 1051234178 + .long 3669764559 + .long 1063748136 + .long 2458496952 + .long 1049687126 + .long 1948234989 + .long 1061614499 + .long 2843698787 + .long 1048163519 + .long 3398041407 + .long 1060559728 + .long 2829230080 + .long 1069608467 + .long 1034046433 + .long 1026788255 + .long 0 + .long 0 + .long 298675305 + .long 1070989821 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 3120498638 + .long 1059265656 + .long 0 + .long 0 + .long 2773578114 + .long 1058009312 + .long 0 + .long 0 + .long 2030783676 + .long 1056334225 + .long 2223654598 + .long 1067588288 + .long 2976134650 + .long 1054987244 + .long 706390066 + .long 1067217386 + .long 4258437615 + .long 1053416730 + .long 1066252975 + .long 1064907619 + .long 815777514 + .long 1051989462 + .long 3202745457 + .long 1064010682 + .long 2493556375 + .long 1050521105 + .long 1046243251 + .long 1062195323 + .long 2593078846 + .long 1049017717 + .long 2763962276 + .long 1060970161 + .long 701480960 + .long 1069894094 + .long 3205862232 + .long 1027177267 + .long 0 + .long 0 + .long 2267016812 + .long 1071015664 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1398462608 + .long 1059820320 + .long 0 + .long 0 + .long 26205983 + .long 1058461213 + .long 0 + .long 0 + .long 56226238 + .long 1057044964 + .long 2754706541 + .long 1067875863 + .long 2187799823 + .long 1055634437 + .long 790323742 + .long 1067402587 + .long 1372385848 + .long 1054167831 + .long 4097292716 + .long 1065372654 + .long 3348210357 + .long 1052830099 + .long 2442796466 + .long 1064337602 + .long 862608142 + .long 1051347106 + .long 170296152 + .long 1062577219 + .long 3755571428 + .long 1049933343 + .long 3614866008 + .long 1061361670 + .long 719978496 + .long 1070185448 + .long 1998842465 + .long 1027220329 + .long 0 + .long 0 + .long 3749156607 + .long 1071048258 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1330165971 + .long 1060367097 + .long 0 + .long 0 + .long 217536623 + .long 1059109098 + .long 0 + .long 0 + .long 3492120849 + .long 1057667827 + .long 602185705 + .long 1068194444 + .long 760422958 + .long 1056312597 + .long 555127889 + .long 1067545266 + .long 3139784124 + .long 1054987189 + .long 3690544014 + .long 1065666523 + .long 95707915 + .long 1053635428 + .long 4003114407 + .long 1064581412 + .long 2034926231 + .long 1052227513 + .long 3759536023 + .long 1063076341 + .long 3826928214 + .long 1050893819 + .long 3837960785 + .long 1061790379 + .long 1526325248 + .long 1070483918 + .long 2356426521 + .long 3172907104 + .long 0 + .long 0 + .long 457728975 + .long 1071088276 + .long 0 + .long 1072693248 + .long 0 + .long 4294967288 + .long 1704352102 + .long 3223426649 + .long 0 + .long 0 + .long 2284589306 + .long 1076258036 + .long 0 + .long 0 + .long 2211264291 + .long 3224142658 + .long 0 + .long 3221225472 + .long 1441186365 + .long 1077028579 + .long 1431655765 + .long 1074091349 + .long 876943673 + .long 3224837270 + .long 2863311531 + .long 3221924522 + .long 236289504 + .long 1077767485 + .long 286331153 + .long 1074860305 + .long 2805473311 + .long 3225598926 + .long 95443718 + .long 3222646875 + .long 1160476131 + .long 1078450742 + .long 463583772 + .long 1075552698 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 0 + .long 1073741824 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3349892442 + .long 3221773860 + .long 0 + .long 0 + .long 3913197405 + .long 1074501181 + .long 0 + .long 0 + .long 2494034522 + .long 3222222818 + .long 1264738763 + .long 3220568452 + .long 1520293906 + .long 1074899632 + .long 1958936600 + .long 1073411493 + .long 2133649635 + .long 3222535819 + .long 4270740730 + .long 3221058356 + .long 1728930189 + .long 1075224844 + .long 1303998552 + .long 1073799186 + .long 618611933 + .long 3222903903 + .long 1769828046 + .long 3221422190 + .long 2200537986 + .long 1075641421 + .long 433361110 + .long 1074105369 + .long 719595600 + .long 3219800832 + .long 294527206 + .long 1014656440 + .long 0 + .long 1073741824 + .long 3811788216 + .long 3218400550 + .long 0 + .long 0 + .long 0 + .long 0 + .long 724322768 + .long 3220364956 + .long 0 + .long 0 + .long 643153048 + .long 1072905816 + .long 0 + .long 0 + .long 4285079458 + .long 3220412206 + .long 3912524733 + .long 3220106631 + .long 118362272 + .long 1072952754 + .long 4107767972 + .long 1072827408 + .long 2689502883 + .long 3220460570 + .long 946523347 + .long 3220256414 + .long 573204189 + .long 1073001761 + .long 581531518 + .long 1072826391 + .long 1386236526 + .long 3220510607 + .long 3718905905 + .long 3220316471 + .long 1145558140 + .long 1073052673 + .long 513572637 + .long 1072861969 + .long 716700048 + .long 3219481016 + .long 547126769 + .long 3163007173 + .long 0 + .long 1072693248 + .long 1097907398 + .long 1071420120 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3422807297 + .long 3219124495 + .long 0 + .long 0 + .long 1151658053 + .long 1071494715 + .long 0 + .long 0 + .long 929607071 + .long 3218829988 + .long 1037049034 + .long 3219520953 + .long 2786928657 + .long 1071215282 + .long 1447406859 + .long 1072265209 + .long 3490952107 + .long 3218574499 + .long 3205232916 + .long 3219452306 + .long 1297344304 + .long 1070977120 + .long 1066110976 + .long 1071946035 + .long 3803721480 + .long 3218354730 + .long 1496754229 + .long 3219290849 + .long 2982550683 + .long 1070773243 + .long 4014441989 + .long 1071736222 + .long 419968236 + .long 3219200695 + .long 3451266538 + .long 1015961163 + .long 0 + .long 1072693248 + .long 2960267235 + .long 1070745841 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1458794562 + .long 3217882198 + .long 0 + .long 0 + .long 2857777489 + .long 1070137637 + .long 0 + .long 0 + .long 1024359517 + .long 3217360179 + .long 2616040238 + .long 3219066585 + .long 1609024636 + .long 1069675088 + .long 2529240549 + .long 1071836633 + .long 1510128600 + .long 3216923761 + .long 2251697184 + .long 3218737335 + .long 1262761453 + .long 1069142850 + .long 1263091857 + .long 1071190461 + .long 3043383486 + .long 3216368839 + .long 2476932470 + .long 3218325650 + .long 3659995028 + .long 1068669200 + .long 855891755 + .long 1070696894 + .long 2583490354 + .long 3218768505 + .long 3062633575 + .long 3161492271 + .long 0 + .long 1072693248 + .long 2550940471 + .long 1069938201 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2467582782 + .long 3216740037 + .long 0 + .long 0 + .long 162150096 + .long 1068946420 + .long 0 + .long 0 + .long 3702794237 + .long 3216062800 + .long 3631919291 + .long 3218420574 + .long 3456821413 + .long 1068217218 + .long 2031366438 + .long 1071495745 + .long 1596664020 + .long 3215282929 + .long 1509038701 + .long 3218085291 + .long 583171477 + .long 1067510148 + .long 3785344682 + .long 1070618476 + .long 2402036048 + .long 3214559384 + .long 3233018412 + .long 3217396834 + .long 411280568 + .long 1066710556 + .long 1065584192 + .long 1069747896 + .long 895247324 + .long 3218303496 + .long 500078909 + .long 1013805133 + .long 0 + .long 1072693248 + .long 729983843 + .long 1068994194 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1512545955 + .long 3215602695 + .long 0 + .long 0 + .long 1127048698 + .long 1067909459 + .long 0 + .long 0 + .long 2300200450 + .long 3214738415 + .long 3593250296 + .long 3217717209 + .long 3009365544 + .long 1066902117 + .long 1127373050 + .long 1071173457 + .long 3046103305 + .long 3213854947 + .long 24583402 + .long 3217207636 + .long 4082511758 + .long 1065914199 + .long 3223889699 + .long 1070020367 + .long 548927984 + .long 3212899404 + .long 558065897 + .long 3216433066 + .long 680073315 + .long 1064940726 + .long 388873200 + .long 1068944270 + .long 3763679576 + .long 3217651189 + .long 1497360404 + .long 3157194195 + .long 0 + .long 1072693248 + .long 64931152 + .long 1067729411 + .long 0 + .long 0 + .long 0 + .long 0 + .long 1313038235 + .long 3214229379 + .long 0 + .long 0 + .long 1013878342 + .long 1067152618 + .long 0 + .long 0 + .long 3663426833 + .long 3213208931 + .long 3693284251 + .long 3216602456 + .long 650852232 + .long 1065882376 + .long 1996245381 + .long 1071000265 + .long 2008746170 + .long 3212147845 + .long 3055842593 + .long 3216062494 + .long 1495406348 + .long 1064652437 + .long 2269530157 + .long 1069711235 + .long 285563696 + .long 3211060113 + .long 1046897440 + .long 3215189513 + .long 233429731 + .long 1063453151 + .long 522045958 + .long 1068476590 + .long 2354785698 + .long 3216586427 + .long 1317599141 + .long 3159915781 + .long 0 + .long 1072693248 + .long 2828230105 + .long 1065606626 + .long 0 + .long 0 + .long 0 + .long 0 + .type Ctable,@object + .size Ctable,5632 + .align 16 +MASK_35: + .long 4294705152 + .long 4294967295 + .long 0 + .long 0 + .type MASK_35,@object + .size MASK_35,16 + .align 16 +Q_11: + .long 3103673719 + .long 1065509018 + .type Q_11,@object + .size Q_11,8 + .space 8, 0x00 # pad + .align 16 +Q_9: + .long 3213130307 + .long 1066820768 + .type Q_9,@object + .size Q_9,8 + .space 8, 0x00 # pad + .align 16 +Q_7: + .long 1388628139 + .long 1068212666 + .type Q_7,@object + .size Q_7,8 + .space 8, 0x00 # pad + .align 16 +Q_5: + .long 285812550 + .long 1069617425 + .type Q_5,@object + .size Q_5,8 + .space 8, 0x00 # pad + .align 16 +Q_3: + .long 1431655954 + .long 1070945621 + .type Q_3,@object + .size Q_3,8 + .space 8, 0x00 # pad + .align 16 +PI_INV_TABLE: + .long 0 + .long 0 + .long 2734261102 + .long 1313084713 + .long 4230436817 + .long 4113882560 + .long 3680671129 + .long 1011060801 + .long 4266746795 + .long 3736847713 + .long 3072618042 + .long 1112396512 + .long 105459434 + .long 164729372 + .long 4263373596 + .long 2972297022 + .long 3900847605 + .long 784024708 + .long 3919343654 + .long 3026157121 + .long 965858873 + .long 2203269620 + .long 2625920907 + .long 3187222587 + .long 536385535 + .long 3724908559 + .long 4012839307 + .long 1510632735 + .long 1832287951 + .long 667617719 + .long 1330003814 + .long 2657085997 + .long 1965537991 + .long 3957715323 + .long 1023883767 + .long 2320667370 + .long 1811636145 + .long 529358088 + .long 1443049542 + .long 4235946923 + .long 4040145953 + .type PI_INV_TABLE,@object + .size PI_INV_TABLE,164 + .space 12, 0x00 # pad + .align 16 +PI_4: + .long 0 + .long 1072243195 + .long 1175561766 + .long 1048908043 + .type PI_4,@object + .size PI_4,16 + .align 8 +QQ_2: + .long 1734816687 + .long 1026746297 + .type QQ_2,@object + .size QQ_2,8 + .align 8 +ONE: + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,8 + .align 8 +TWO_POW_55: + .long 0 + .long 1130364928 + .type TWO_POW_55,@object + .size TWO_POW_55,8 + .align 8 +TWO_POW_M55: + .long 0 + .long 1015021568 + .type TWO_POW_M55,@object + .size TWO_POW_M55,8 + .align 4 +NEG_ZERO: + .long 0 + .long 2147483648 + .type NEG_ZERO,@object + .size NEG_ZERO,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tanf_gen.S b/external/sgx_libm/intel64/tanf_gen.S new file mode 100644 index 0000000000..0007a4e83c --- /dev/null +++ b/external/sgx_libm/intel64/tanf_gen.S @@ -0,0 +1,858 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanf_gen.c" + .text +..TXTST0: +# -- Begin tanf + .text + .align 16,0x90 + .globl tanf +tanf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_tanf.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 +..B1.2: + stmxcsr 16(%rsp) + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + jne .L_2TAG_PACKET_0.0.1 +.L_2TAG_PACKET_1.0.1: + pextrw $1, %xmm0, %eax + andw $32767, %ax + subw $128, %ax + cmpw $18175, %ax + ja .L_2TAG_PACKET_2.0.1 + movq PI_32_RECIP(%rip), %xmm1 + mulss %xmm0, %xmm1 + movapd BIT_31(%rip), %xmm7 + cvtss2si %xmm1, %edx + andpd %xmm0, %xmm7 + cvtss2sd %xmm0, %xmm0 + movq SHIFTER_16(%rip), %xmm4 + addss %xmm1, %xmm4 + addss SHIFTER(%rip), %xmm1 + subss SHIFTER_16(%rip), %xmm4 + subss SHIFTER(%rip), %xmm1 + movapd %xmm7, %xmm5 + psllq $32, %xmm7 + psllq $29, %xmm5 + xorpd %xmm5, %xmm7 + addl $1865216, %edx + movq PP_1(%rip), %xmm5 + xorpd %xmm7, %xmm5 + movq P_1(%rip), %xmm2 + xorpd %xmm7, %xmm2 + movq PP_2(%rip), %xmm6 + xorpd %xmm7, %xmm6 + movq P_2(%rip), %xmm3 + xorpd %xmm7, %xmm3 + lea Ctable(%rip), %rax + shll $3, %edx + andq $248, %rdx + addq %rdx, %rax + shlq $3, %rdx + addq %rdx, %rax + psllq $29, %xmm4 + psllq $29, %xmm1 + mulsd %xmm4, %xmm5 + mulsd %xmm1, %xmm2 + mulsd %xmm4, %xmm6 + mulsd %xmm1, %xmm3 + addsd %xmm0, %xmm5 + addsd %xmm0, %xmm2 + addsd %xmm6, %xmm5 + addsd %xmm3, %xmm2 + movq ONE(%rip), %xmm7 + divsd %xmm5, %xmm7 + mulsd 64(%rax), %xmm7 + movq 56(%rax), %xmm3 + mulsd %xmm2, %xmm3 + movq 24(%rax), %xmm4 + mulsd %xmm2, %xmm4 + movq 40(%rax), %xmm5 + mulsd %xmm2, %xmm5 + movq 8(%rax), %xmm6 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm2 + addsd 48(%rax), %xmm3 + addsd 16(%rax), %xmm4 + addsd 32(%rax), %xmm5 + addsd (%rax), %xmm6 + mulsd %xmm2, %xmm3 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm2 + addsd %xmm5, %xmm3 + addsd %xmm6, %xmm4 + mulsd %xmm2, %xmm3 + addsd %xmm4, %xmm3 + subsd %xmm7, %xmm3 + movsd %xmm3, %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + jne .L_2TAG_PACKET_3.0.1 + cvtsd2ss %xmm0, %xmm0 + jmp ..B1.6 +.L_2TAG_PACKET_2.0.1: + jg .L_2TAG_PACKET_4.0.1 + cvtss2sd %xmm0, %xmm0 + mulsd ONE_P230(%rip), %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + jne .L_2TAG_PACKET_3.0.1 + cvtsd2ss %xmm0, %xmm0 + jmp ..B1.6 +.L_2TAG_PACKET_4.0.1: + movd %xmm0, %eax + andl $2139095040, %eax + cmpl $2139095040, %eax + je .L_2TAG_PACKET_5.0.1 + cvtss2sd %xmm0, %xmm0 + movq %xmm0, (%rsp) +..B1.3: + movsd (%rsp), %xmm0 + call tan@PLT +..B1.9: + movsd %xmm0, 8(%rsp) +..B1.4: + movq 8(%rsp), %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + jne .L_2TAG_PACKET_3.0.1 + cvtsd2ss %xmm0, %xmm0 + jmp ..B1.6 +.L_2TAG_PACKET_5.0.1: + subss %xmm0, %xmm0 + movl 16(%rsp), %eax + andl $-24577, %eax + cmpl 16(%rsp), %eax + je .L_2TAG_PACKET_6.0.1 + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) +.L_2TAG_PACKET_6.0.1: + jmp ..B1.6 +.L_2TAG_PACKET_7.0.1: + cvtsd2ss %xmm0, %xmm0 + jmp ..B1.6 +.L_2TAG_PACKET_0.0.1: + movl %eax, 20(%rsp) + ldmxcsr 20(%rsp) + jmp .L_2TAG_PACKET_1.0.1 +.L_2TAG_PACKET_3.0.1: + stmxcsr 20(%rsp) + movl 16(%rsp), %eax + andl $24576, %eax + orl %eax, 20(%rsp) + ldmxcsr 20(%rsp) + jmp .L_2TAG_PACKET_7.0.1 +.L_2TAG_PACKET_8.0.1: +..B1.6: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type tanf,@function + .size tanf,.-tanf + .data +# -- End tanf + .section .rodata, "a" + .align 16 + .align 16 +BIT_31: + .long 2147483648 + .long 0 + .long 0 + .long 0 + .type BIT_31,@object + .size BIT_31,16 + .align 16 +PP_1: + .long 1413742592 + .long 4156105211 + .type PP_1,@object + .size PP_1,8 + .space 8, 0x00 # pad + .align 16 +P_1: + .long 1414004736 + .long 4156105211 + .type P_1,@object + .size P_1,8 + .space 8, 0x00 # pad + .align 16 +PP_2: + .long 1280075305 + .long 4115041315 + .type PP_2,@object + .size PP_2,8 + .space 8, 0x00 # pad + .align 16 +P_2: + .long 3409656221 + .long 1972279101 + .type P_2,@object + .size P_2,8 + .space 8, 0x00 # pad + .align 16 +Ctable: + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1431655765 + .long 1070945621 + .long 0 + .long 0 + .long 286331153 + .long 1069617425 + .long 0 + .long 0 + .long 463583772 + .long 1068212666 + .long 0 + .long 0 + .long 2354785698 + .long 1069102779 + .long 3310429884 + .long 1072703419 + .long 3693284251 + .long 1069118808 + .long 1996245381 + .long 1071000265 + .long 3055842593 + .long 1068578846 + .long 2269530157 + .long 1069711235 + .long 1046897440 + .long 1067705865 + .long 522045958 + .long 1068476590 + .long 0 + .long 0 + .long 3763679576 + .long 1070167541 + .long 404682282 + .long 1072734736 + .long 3593250296 + .long 1070233561 + .long 1127373050 + .long 1071173457 + .long 24583402 + .long 1069723988 + .long 3223889699 + .long 1070020367 + .long 558065897 + .long 1068949418 + .long 388873200 + .long 1068944270 + .long 0 + .long 0 + .long 895247324 + .long 1070819848 + .long 582494902 + .long 1072789737 + .long 3631919291 + .long 1070936926 + .long 2031366438 + .long 1071495745 + .long 1509038701 + .long 1070601643 + .long 3785344682 + .long 1070618476 + .long 3233018412 + .long 1069913186 + .long 1065584192 + .long 1069747896 + .long 0 + .long 0 + .long 2583490354 + .long 1071284857 + .long 855738471 + .long 1072873155 + .long 2616040238 + .long 1071582937 + .long 2529240549 + .long 1071836633 + .long 2251697184 + .long 1071253687 + .long 1263091857 + .long 1071190461 + .long 2476932470 + .long 1070842002 + .long 855891755 + .long 1070696894 + .long 0 + .long 0 + .long 419968236 + .long 1071717047 + .long 1813808633 + .long 1072992828 + .long 1037049034 + .long 1072037305 + .long 1447406859 + .long 1072265209 + .long 3205232916 + .long 1071968658 + .long 1066110976 + .long 1071946035 + .long 1496754229 + .long 1071807201 + .long 4014441989 + .long 1071736222 + .long 0 + .long 0 + .long 716700048 + .long 1071997368 + .long 274476850 + .long 1073161398 + .long 3912524733 + .long 1072622983 + .long 4107767972 + .long 1072827408 + .long 946523347 + .long 1072772766 + .long 581531518 + .long 1072826391 + .long 3718905905 + .long 1072832823 + .long 513572637 + .long 1072861969 + .long 0 + .long 0 + .long 719595600 + .long 1072317184 + .long 1194536594 + .long 1073399478 + .long 1264738763 + .long 1073084804 + .long 1958936600 + .long 1073411493 + .long 4270740730 + .long 1073574708 + .long 1303998552 + .long 1073799186 + .long 1769828046 + .long 1073938542 + .long 433361110 + .long 1074105369 + .long 0 + .long 0 + .long 0 + .long 1072693248 + .long 0 + .long 1073741824 + .long 0 + .long 1073741824 + .long 1431655765 + .long 1074091349 + .long 2863311531 + .long 1074440874 + .long 286331153 + .long 1074860305 + .long 95443718 + .long 1075163227 + .long 463583772 + .long 1075552698 + .long 0 + .long 0 + .long 1526324265 + .long 3217967566 + .long 457728975 + .long 1071088276 + .long 602185705 + .long 3215678092 + .long 555127889 + .long 1067545266 + .long 3690544014 + .long 3213150171 + .long 4003114407 + .long 1064581412 + .long 3759536023 + .long 3210559989 + .long 3837960785 + .long 1061790379 + .long 0 + .long 1072693248 + .long 719981842 + .long 3217669096 + .long 3749156607 + .long 1071048258 + .long 2754706541 + .long 3215359511 + .long 790323742 + .long 1067402587 + .long 4097292716 + .long 3212856302 + .long 2442796466 + .long 1064337602 + .long 170296152 + .long 3210060867 + .long 3614866008 + .long 1061361670 + .long 0 + .long 1072693248 + .long 701484222 + .long 3217377742 + .long 2267016812 + .long 1071015664 + .long 2223654598 + .long 3215071936 + .long 706390066 + .long 1067217386 + .long 1066252975 + .long 3212391267 + .long 3202745457 + .long 1064010682 + .long 1046243251 + .long 3209678971 + .long 2763962276 + .long 1060970161 + .long 0 + .long 1072693248 + .long 2829232582 + .long 3217092115 + .long 298675305 + .long 1070989821 + .long 1485063559 + .long 3214682643 + .long 3996381654 + .long 1067075828 + .long 2866066872 + .long 3211982662 + .long 3669764559 + .long 1063748136 + .long 1948234989 + .long 3209098147 + .long 3398041407 + .long 1060559728 + .long 0 + .long 1072693248 + .long 3593905368 + .long 3216590719 + .long 4076712227 + .long 1070970214 + .long 3144465176 + .long 3214191500 + .long 1618153340 + .long 1066971547 + .long 584032116 + .long 3211469261 + .long 4247487438 + .long 1063561943 + .long 3844233498 + .long 3208626322 + .long 3857199098 + .long 1060281647 + .long 0 + .long 1072693248 + .long 3789571175 + .long 3216034914 + .long 3870939386 + .long 1070956467 + .long 628750575 + .long 3213566872 + .long 2954464709 + .long 1066900026 + .long 1466315631 + .long 3210837162 + .long 2766187256 + .long 1063437894 + .long 3695969289 + .long 3207854418 + .long 3095830084 + .long 1060095334 + .long 0 + .long 1072693248 + .long 1858778712 + .long 3214984212 + .long 2242038011 + .long 1070948320 + .long 2507068734 + .long 3212502004 + .long 2446607349 + .long 1066858259 + .long 1349489537 + .long 3209765608 + .long 1721283327 + .long 1063366855 + .long 3852528092 + .long 3206760861 + .long 1758739894 + .long 1059895449 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1431655765 + .long 1070945621 + .long 0 + .long 0 + .long 381774871 + .long 1066844524 + .long 0 + .long 0 + .long 3154187623 + .long 1063343722 + .long 0 + .long 0 + .long 2469719819 + .long 1059831159 + .long 0 + .long 1072693248 + .long 1858778712 + .long 1067500564 + .long 2242038011 + .long 1070948320 + .long 2507068734 + .long 1065018356 + .long 2446607349 + .long 1066858259 + .long 1349489537 + .long 1062281960 + .long 1721283327 + .long 1063366855 + .long 3852528092 + .long 1059277213 + .long 1758739894 + .long 1059895449 + .long 0 + .long 1072693248 + .long 3789571175 + .long 1068551266 + .long 3870939386 + .long 1070956467 + .long 628750575 + .long 1066083224 + .long 2954464709 + .long 1066900026 + .long 1466315631 + .long 1063353514 + .long 2766187256 + .long 1063437894 + .long 3695969289 + .long 1060370770 + .long 3095830084 + .long 1060095334 + .long 0 + .long 1072693248 + .long 3593905368 + .long 1069107071 + .long 4076712227 + .long 1070970214 + .long 3144465176 + .long 1066707852 + .long 1618153340 + .long 1066971547 + .long 584032116 + .long 1063985613 + .long 4247487438 + .long 1063561943 + .long 3844233498 + .long 1061142674 + .long 3857199098 + .long 1060281647 + .long 0 + .long 1072693248 + .long 2829232582 + .long 1069608467 + .long 298675305 + .long 1070989821 + .long 1485063559 + .long 1067198995 + .long 3996381654 + .long 1067075828 + .long 2866066872 + .long 1064499014 + .long 3669764559 + .long 1063748136 + .long 1948234989 + .long 1061614499 + .long 3398041407 + .long 1060559728 + .long 0 + .long 1072693248 + .long 701484222 + .long 1069894094 + .long 2267016812 + .long 1071015664 + .long 2223654598 + .long 1067588288 + .long 706390066 + .long 1067217386 + .long 1066252975 + .long 1064907619 + .long 3202745457 + .long 1064010682 + .long 1046243251 + .long 1062195323 + .long 2763962276 + .long 1060970161 + .long 0 + .long 1072693248 + .long 719981842 + .long 1070185448 + .long 3749156607 + .long 1071048258 + .long 2754706541 + .long 1067875863 + .long 790323742 + .long 1067402587 + .long 4097292716 + .long 1065372654 + .long 2442796466 + .long 1064337602 + .long 170296152 + .long 1062577219 + .long 3614866008 + .long 1061361670 + .long 0 + .long 1072693248 + .long 1526324265 + .long 1070483918 + .long 457728975 + .long 1071088276 + .long 602185705 + .long 1068194444 + .long 555127889 + .long 1067545266 + .long 3690544014 + .long 1065666523 + .long 4003114407 + .long 1064581412 + .long 3759536023 + .long 1063076341 + .long 3837960785 + .long 1061790379 + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .long 0 + .long 1073741824 + .long 0 + .long 3221225472 + .long 1431655765 + .long 1074091349 + .long 2863311531 + .long 3221924522 + .long 286331153 + .long 1074860305 + .long 95443718 + .long 3222646875 + .long 463583772 + .long 1075552698 + .long 0 + .long 0 + .long 719595600 + .long 3219800832 + .long 1194536594 + .long 1073399478 + .long 1264738763 + .long 3220568452 + .long 1958936600 + .long 1073411493 + .long 4270740730 + .long 3221058356 + .long 1303998552 + .long 1073799186 + .long 1769828046 + .long 3221422190 + .long 433361110 + .long 1074105369 + .long 0 + .long 0 + .long 716700048 + .long 3219481016 + .long 274476850 + .long 1073161398 + .long 3912524733 + .long 3220106631 + .long 4107767972 + .long 1072827408 + .long 946523347 + .long 3220256414 + .long 581531518 + .long 1072826391 + .long 3718905905 + .long 3220316471 + .long 513572637 + .long 1072861969 + .long 0 + .long 0 + .long 419968236 + .long 3219200695 + .long 1813808633 + .long 1072992828 + .long 1037049034 + .long 3219520953 + .long 1447406859 + .long 1072265209 + .long 3205232916 + .long 3219452306 + .long 1066110976 + .long 1071946035 + .long 1496754229 + .long 3219290849 + .long 4014441989 + .long 1071736222 + .long 0 + .long 0 + .long 2583490354 + .long 3218768505 + .long 855738471 + .long 1072873155 + .long 2616040238 + .long 3219066585 + .long 2529240549 + .long 1071836633 + .long 2251697184 + .long 3218737335 + .long 1263091857 + .long 1071190461 + .long 2476932470 + .long 3218325650 + .long 855891755 + .long 1070696894 + .long 0 + .long 0 + .long 895247324 + .long 3218303496 + .long 582494902 + .long 1072789737 + .long 3631919291 + .long 3218420574 + .long 2031366438 + .long 1071495745 + .long 1509038701 + .long 3218085291 + .long 3785344682 + .long 1070618476 + .long 3233018412 + .long 3217396834 + .long 1065584192 + .long 1069747896 + .long 0 + .long 0 + .long 3763679576 + .long 3217651189 + .long 404682282 + .long 1072734736 + .long 3593250296 + .long 3217717209 + .long 1127373050 + .long 1071173457 + .long 24583402 + .long 3217207636 + .long 3223889699 + .long 1070020367 + .long 558065897 + .long 3216433066 + .long 388873200 + .long 1068944270 + .long 0 + .long 0 + .long 2354785698 + .long 3216586427 + .long 3310429884 + .long 1072703419 + .long 3693284251 + .long 3216602456 + .long 1996245381 + .long 1071000265 + .long 3055842593 + .long 3216062494 + .long 2269530157 + .long 1069711235 + .long 1046897440 + .long 3215189513 + .long 522045958 + .long 1068476590 + .long 0 + .long 0 + .type Ctable,@object + .size Ctable,2304 + .align 16 +ONE: + .long 0 + .long 1072693248 + .type ONE,@object + .size ONE,8 + .space 8, 0x00 # pad + .align 16 +ONE_P230: + .long 4194304 + .long 1072693248 + .type ONE_P230,@object + .size ONE_P230,8 + .align 8 +PI_32_RECIP: + .long 1092811139 + .long 0 + .type PI_32_RECIP,@object + .size PI_32_RECIP,8 + .align 8 +SHIFTER_16: + .long 1296039936 + .long 0 + .type SHIFTER_16,@object + .size SHIFTER_16,8 + .align 4 +SHIFTER: + .long 1262485504 + .type SHIFTER,@object + .size SHIFTER,4 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tanh_gen.S b/external/sgx_libm/intel64/tanh_gen.S new file mode 100644 index 0000000000..208a8d01ee --- /dev/null +++ b/external/sgx_libm/intel64/tanh_gen.S @@ -0,0 +1,501 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanh_gen.c" + .text +..TXTST0: +# -- Begin tanh + .text + .align 16,0x90 + .globl tanh +tanh: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_tanh.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $2146435072, %ecx + jae ..B1.16 +..B1.2: + cmpl $1077088193, %ecx + jae ..B1.15 +..B1.3: + cmpl $1075078759, %ecx + jae ..B1.14 +..B1.4: + cmpl $1066695393, %ecx + jae ..B1.13 +..B1.5: + cmpl $1012924416, %ecx + jae ..B1.12 +..B1.6: + shrl $31, %eax + cmpl $1048576, %ecx + jb ..B1.8 +..B1.7: + movl %eax, %eax + lea _small_value_64(%rip), %rdx + movsd (%rdx,%rax,8), %xmm1 + mulsd (%rdx), %xmm1 + subsd %xmm1, %xmm0 + ret +..B1.8: + movl -8(%rsp), %edx + orl %edx, %ecx + je ..B1.10 +..B1.9: + lea _small_value_64(%rip), %rdx + movsd -8(%rsp), %xmm0 + movsd (%rdx,%rax,8), %xmm1 + mulsd (%rdx), %xmm1 + movsd %xmm1, -32(%rsp) + subsd %xmm1, %xmm0 + ret +..B1.10: + movsd -8(%rsp), %xmm0 +..B1.11: + ret +..B1.12: + movsd -8(%rsp), %xmm4 + movaps %xmm4, %xmm2 + mulsd %xmm4, %xmm2 + movaps %xmm2, %xmm1 + mulsd %xmm2, %xmm1 + movsd .L_2il0floatpacket.20(%rip), %xmm0 + movsd .L_2il0floatpacket.22(%rip), %xmm3 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm3 + addsd .L_2il0floatpacket.21(%rip), %xmm0 + addsd .L_2il0floatpacket.23(%rip), %xmm3 + mulsd %xmm1, %xmm0 + mulsd %xmm2, %xmm3 + addsd %xmm3, %xmm0 + mulsd %xmm4, %xmm0 + addsd %xmm4, %xmm0 + ret +..B1.13: + movsd -8(%rsp), %xmm0 + lea _TWO_52(%rip), %rdx + andps .L_2il0floatpacket.24(%rip), %xmm0 + xorl %r10d, %r10d + mulsd .L_2il0floatpacket.10(%rip), %xmm0 + movq $0x3ff0000000000000, %rsi + movsd .L_2il0floatpacket.11(%rip), %xmm4 + lea _TWO_32(%rip), %r9 + mulsd %xmm0, %xmm4 + lea ones(%rip), %r11 + movsd .L_2il0floatpacket.12(%rip), %xmm5 + movsd .L_2il0floatpacket.13(%rip), %xmm6 + movsd .L_2il0floatpacket.25(%rip), %xmm3 + movaps %xmm3, %xmm8 + addsd (%rdx), %xmm4 + movsd %xmm4, -32(%rsp) + movsd -32(%rsp), %xmm7 + movsd .L_2il0floatpacket.15(%rip), %xmm12 + movsd .L_2il0floatpacket.17(%rip), %xmm14 + movsd .L_2il0floatpacket.14(%rip), %xmm2 + movaps %xmm2, %xmm9 + subsd (%rdx), %xmm7 + mulsd %xmm7, %xmm5 + mulsd %xmm6, %xmm7 + subsd %xmm5, %xmm0 + movaps %xmm0, %xmm10 + movaps %xmm3, %xmm6 + movl -32(%rsp), %ecx + movl %ecx, %edi + shll $25, %edi + subsd %xmm7, %xmm10 + movaps %xmm10, %xmm11 + subsd %xmm10, %xmm0 + addsd %xmm10, %xmm8 + subsd %xmm7, %xmm0 + movsd %xmm8, -40(%rsp) + addsd %xmm0, %xmm11 + movaps %xmm11, %xmm13 + mulsd %xmm11, %xmm13 + mulsd %xmm13, %xmm12 + mulsd %xmm13, %xmm14 + addsd .L_2il0floatpacket.16(%rip), %xmm12 + addsd .L_2il0floatpacket.18(%rip), %xmm14 + mulsd %xmm13, %xmm12 + mulsd %xmm13, %xmm14 + mulsd %xmm11, %xmm12 + addsd .L_2il0floatpacket.19(%rip), %xmm14 + movl %r10d, -40(%rsp) + movsd -40(%rsp), %xmm4 + mulsd %xmm13, %xmm14 + addsd %xmm4, %xmm9 + sarl $25, %edi + subsd %xmm9, %xmm10 + subl %edi, %ecx + addsd %xmm10, %xmm0 + movslq %edi, %rdi + addsd %xmm12, %xmm0 + shlq $4, %rdi + addsd %xmm14, %xmm0 + movq __libm_exp_table_128@GOTPCREL(%rip), %r8 + shrl $7, %ecx + movsd (%r9), %xmm5 + movsd 1032(%r8,%rdi), %xmm15 + movaps %xmm15, %xmm1 + mulsd %xmm0, %xmm1 + addsd %xmm4, %xmm0 + mulsd %xmm15, %xmm4 + mulsd 1024(%r8,%rdi), %xmm0 + shlq $52, %rcx + addsd %xmm0, %xmm1 + addq %rsi, %rcx + movaps %xmm2, %xmm0 + movq %rcx, -16(%rsp) + movsd -16(%rsp), %xmm7 + mulsd %xmm7, %xmm1 + mulsd %xmm4, %xmm7 + movaps %xmm7, %xmm10 + addsd %xmm7, %xmm0 + addsd %xmm7, %xmm6 + addsd (%r9), %xmm0 + addsd %xmm5, %xmm6 + movsd %xmm0, -32(%rsp) + movsd -32(%rsp), %xmm0 + movsd %xmm6, -32(%rsp) + subsd %xmm5, %xmm0 + movsd -32(%rsp), %xmm9 + subsd %xmm0, %xmm10 + subsd (%r9), %xmm9 + addsd %xmm2, %xmm10 + movsd %xmm7, -40(%rsp) + movaps %xmm9, %xmm8 + shrl $31, %eax + subsd %xmm9, %xmm7 + addsd %xmm1, %xmm10 + addsd %xmm3, %xmm7 + movsd (%r11,%rax,8), %xmm12 + addsd %xmm7, %xmm1 + addsd %xmm1, %xmm8 + divsd %xmm8, %xmm3 + movsd %xmm3, -24(%rsp) + movl %r10d, -24(%rsp) + movsd -24(%rsp), %xmm11 + mulsd %xmm11, %xmm1 + subsd %xmm11, %xmm3 + mulsd %xmm11, %xmm9 + mulsd %xmm3, %xmm8 + addsd %xmm2, %xmm9 + addsd %xmm8, %xmm1 + movaps %xmm11, %xmm2 + addsd %xmm1, %xmm9 + addsd %xmm3, %xmm2 + mulsd %xmm9, %xmm2 + movaps %xmm0, %xmm1 + mulsd %xmm11, %xmm0 + subsd %xmm2, %xmm3 + mulsd %xmm3, %xmm1 + addsd %xmm11, %xmm3 + mulsd %xmm3, %xmm10 + movsd %xmm0, -8(%rsp) + addsd %xmm10, %xmm1 + mulsd %xmm12, %xmm0 + mulsd %xmm1, %xmm12 + addsd %xmm12, %xmm0 + ret +..B1.14: + lea _TWO_32(%rip), %rdx + lea _TWO_52(%rip), %rcx + movsd -8(%rsp), %xmm1 + movq $0x3ff0000000000000, %rsi + andps .L_2il0floatpacket.24(%rip), %xmm1 + lea twos(%rip), %r8 + movsd .L_2il0floatpacket.0(%rip), %xmm3 + movaps %xmm1, %xmm7 + movsd (%rdx), %xmm0 + lea ones(%rip), %r9 + movsd (%rcx), %xmm4 + addsd %xmm1, %xmm0 + movsd %xmm0, -32(%rsp) + movsd -32(%rsp), %xmm6 + movsd .L_2il0floatpacket.1(%rip), %xmm2 + mulsd %xmm1, %xmm2 + subsd (%rdx), %xmm6 + movsd .L_2il0floatpacket.2(%rip), %xmm12 + subsd %xmm6, %xmm7 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm7 + addsd %xmm6, %xmm4 + addsd %xmm2, %xmm7 + movsd %xmm4, -32(%rsp) + movsd -32(%rsp), %xmm5 + movsd .L_2il0floatpacket.6(%rip), %xmm9 + movsd .L_2il0floatpacket.25(%rip), %xmm11 + movslq -32(%rsp), %rdi + shlq $52, %rdi + subsd (%rcx), %xmm5 + addq %rsi, %rdi + subsd %xmm5, %xmm6 + movq %rdi, -16(%rsp) + addsd %xmm6, %xmm7 + movaps %xmm7, %xmm8 + mulsd %xmm7, %xmm8 + mulsd %xmm8, %xmm12 + mulsd %xmm8, %xmm9 + addsd .L_2il0floatpacket.3(%rip), %xmm12 + addsd .L_2il0floatpacket.7(%rip), %xmm9 + mulsd %xmm8, %xmm12 + mulsd %xmm8, %xmm9 + addsd .L_2il0floatpacket.4(%rip), %xmm12 + addsd .L_2il0floatpacket.8(%rip), %xmm9 + mulsd %xmm8, %xmm12 + mulsd %xmm8, %xmm9 + addsd .L_2il0floatpacket.5(%rip), %xmm12 + addsd .L_2il0floatpacket.9(%rip), %xmm9 + mulsd %xmm7, %xmm12 + movsd -16(%rsp), %xmm10 + subsd %xmm12, %xmm9 + divsd %xmm9, %xmm12 + mulsd .L_2il0floatpacket.10(%rip), %xmm12 + shrl $31, %eax + addsd %xmm11, %xmm12 + movl %eax, %r10d + movsd %xmm12, -24(%rsp) + xorl $1, %eax + mulsd %xmm10, %xmm12 + movsd (%r8,%rax,8), %xmm0 + addsd %xmm11, %xmm12 + divsd %xmm12, %xmm0 + movsd %xmm7, -8(%rsp) + addsd (%r9,%r10,8), %xmm0 + ret +..B1.15: + lea ones(%rip), %rdx + lea _small_value_64(%rip), %rcx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 + subsd (%rcx,%rax,8), %xmm0 + ret +..B1.16: + andl $-2146435073, %ecx + orl -8(%rsp), %ecx + jne ..B1.18 +..B1.17: + lea ones(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 + ret +..B1.18: + movsd -8(%rsp), %xmm0 +..B1.19: + ret + .align 16,0x90 + .cfi_endproc + .type tanh,@function + .size tanh,.-tanh + .data +# -- End tanh + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.24: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.24,@object + .size .L_2il0floatpacket.24,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x60000000,0x40071547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0xf85ddf44,0x3e64ae0b + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.2: + .long 0xfc0798c2,0x3fb3adff + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x0e243699,0x406e3d92 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0xefbe8c98,0x40f689a6 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x1ba09c9e,0x4156de47 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0xa57ad784,0x4018d7c2 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0x63529aa4,0x40b6b90b + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0xafc4d247,0x412d4376 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x41707ef8 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0x652b82fe,0x40671547 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x00000000,0x3f762e42 + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x3de6af28,0x3e2fdf47 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x00000000,0xbff00000 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +.L_2il0floatpacket.15: + .long 0x6887cd7c,0x3f811111 + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,8 + .align 8 +.L_2il0floatpacket.16: + .long 0x55555405,0x3fc55555 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,8 + .align 8 +.L_2il0floatpacket.17: + .long 0x87372663,0x3f56c16c + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,8 + .align 8 +.L_2il0floatpacket.18: + .long 0x5555541d,0x3fa55555 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,8 + .align 8 +.L_2il0floatpacket.19: + .long 0x00000000,0x3fe00000 + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,8 + .align 8 +.L_2il0floatpacket.20: + .long 0xbe3b77e0,0x3f9662a1 + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,8 + .align 8 +.L_2il0floatpacket.21: + .long 0x1110d2a4,0x3fc11111 + .type .L_2il0floatpacket.21,@object + .size .L_2il0floatpacket.21,8 + .align 8 +.L_2il0floatpacket.22: + .long 0x00fa2d61,0xbfaba1ba + .type .L_2il0floatpacket.22,@object + .size .L_2il0floatpacket.22,8 + .align 8 +.L_2il0floatpacket.23: + .long 0x55555555,0xbfd55555 + .type .L_2il0floatpacket.23,@object + .size .L_2il0floatpacket.23,8 + .align 8 +.L_2il0floatpacket.25: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.25,@object + .size .L_2il0floatpacket.25,8 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 8 +twos: + .long 0x00000000,0x40000000 + .long 0x00000000,0xc0000000 + .type twos,@object + .size twos,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_TWO_52: + .long 0 + .long 1127219200 + .type _TWO_52,@object + .size _TWO_52,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tanhf_gen.S b/external/sgx_libm/intel64/tanhf_gen.S new file mode 100644 index 0000000000..fa590bb2e1 --- /dev/null +++ b/external/sgx_libm/intel64/tanhf_gen.S @@ -0,0 +1,419 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanhf_gen.c" + .text +..TXTST0: +# -- Begin tanhf + .text + .align 16,0x90 + .globl tanhf +tanhf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_tanhf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %eax + andl $2147483647, %eax + cmpl $1098907648, %eax + jae ..B1.15 +..B1.2: + cmpl $1065353216, %eax + jae ..B1.14 +..B1.3: + cmpl $1048576000, %eax + jae ..B1.12 +..B1.4: + cmpl $838860800, %eax + jae ..B1.11 +..B1.5: + shrl $31, %edx + cmpl $8388608, %eax + jb ..B1.7 +..B1.6: + movl %edx, %edx + lea _small_value_32(%rip), %rax + movss (%rax,%rdx,4), %xmm1 + mulss .L_2il0floatpacket.28(%rip), %xmm1 + subss %xmm1, %xmm0 + ret +..B1.7: + testl %eax, %eax + je ..B1.9 +..B1.8: + lea _small_value_32(%rip), %rax + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + cvtss2sd -8(%rsp), %xmm2 + movss (%rax,%rdx,4), %xmm0 + mulss .L_2il0floatpacket.28(%rip), %xmm0 + cvtss2sd %xmm0, %xmm0 + cvtsd2ss %xmm0, %xmm1 + subsd %xmm0, %xmm2 + pxor %xmm0, %xmm0 + movss %xmm1, -16(%rsp) + cvtsd2ss %xmm2, %xmm0 + ret +..B1.9: + movss -8(%rsp), %xmm0 +..B1.10: + ret +..B1.11: + pxor %xmm3, %xmm3 + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.22(%rip), %xmm4 + movsd .L_2il0floatpacket.25(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.23(%rip), %xmm4 + addsd .L_2il0floatpacket.26(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.24(%rip), %xmm4 + addsd .L_2il0floatpacket.27(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 + jmp ..B1.13 +..B1.12: + pxor %xmm3, %xmm3 + cvtss2sd -8(%rsp), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 + movsd .L_2il0floatpacket.12(%rip), %xmm4 + movsd .L_2il0floatpacket.17(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.13(%rip), %xmm4 + addsd .L_2il0floatpacket.18(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.14(%rip), %xmm4 + addsd .L_2il0floatpacket.19(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.15(%rip), %xmm4 + addsd .L_2il0floatpacket.20(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm0, %xmm2 + addsd .L_2il0floatpacket.16(%rip), %xmm4 + addsd .L_2il0floatpacket.21(%rip), %xmm2 + mulsd %xmm0, %xmm4 + mulsd %xmm1, %xmm2 + addsd %xmm2, %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm3, %xmm4 +..B1.13: + cvtsd2ss %xmm4, %xmm4 + movaps %xmm4, %xmm0 + ret +..B1.14: + pxor %xmm5, %xmm5 + movq $0x3ff0000000000000, %rax + cvtss2sd -8(%rsp), %xmm5 + andps .L_2il0floatpacket.29(%rip), %xmm5 + mulsd .L_2il0floatpacket.0(%rip), %xmm5 + movsd .L_2il0floatpacket.1(%rip), %xmm0 + movsd .L_2il0floatpacket.8(%rip), %xmm7 + addsd %xmm5, %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, -16(%rsp) + movss -16(%rsp), %xmm1 + movsd .L_2il0floatpacket.4(%rip), %xmm8 + movsd .L_2il0floatpacket.6(%rip), %xmm2 + movsd .L_2il0floatpacket.10(%rip), %xmm6 + movsd .L_2il0floatpacket.30(%rip), %xmm9 + movl -16(%rsp), %edx + shlq $52, %rdx + subss .L_2il0floatpacket.2(%rip), %xmm1 + cvtss2sd %xmm1, %xmm1 + addq %rax, %rdx + subsd %xmm1, %xmm5 + movaps %xmm5, %xmm3 + mulsd %xmm5, %xmm3 + movaps %xmm3, %xmm4 + mulsd %xmm3, %xmm4 + mulsd %xmm4, %xmm7 + mulsd %xmm4, %xmm8 + mulsd %xmm4, %xmm2 + addsd .L_2il0floatpacket.9(%rip), %xmm7 + mulsd %xmm4, %xmm6 + addsd .L_2il0floatpacket.5(%rip), %xmm8 + addsd .L_2il0floatpacket.7(%rip), %xmm2 + mulsd %xmm3, %xmm7 + addsd .L_2il0floatpacket.11(%rip), %xmm6 + mulsd %xmm4, %xmm8 + mulsd %xmm3, %xmm2 + mulsd %xmm5, %xmm7 + mulsd %xmm5, %xmm6 + addsd %xmm2, %xmm8 + addsd %xmm6, %xmm7 + movq %rdx, -24(%rsp) + addsd %xmm7, %xmm8 + movsd .L_2il0floatpacket.3(%rip), %xmm10 + addsd %xmm9, %xmm8 + mulsd -24(%rsp), %xmm8 + testl $-2147483648, -8(%rsp) + addsd %xmm9, %xmm8 + divsd %xmm8, %xmm10 + subsd %xmm10, %xmm9 + movaps %xmm9, %xmm0 + xorps .L_2il0floatpacket.31(%rip), %xmm0 + jne ..L3 + movaps %xmm9, %xmm0 +..L3: + cvtsd2ss %xmm0, %xmm0 + ret +..B1.15: + shrl $31, %edx + cmpl $2139095040, %eax + jb ..B1.20 +..B1.16: + jne ..B1.18 +..B1.17: + movl %edx, %edx + lea ones(%rip), %rax + movss (%rax,%rdx,4), %xmm0 + ret +..B1.18: + movss -8(%rsp), %xmm0 +..B1.19: + ret +..B1.20: + lea ones(%rip), %rax + lea _small_value_32(%rip), %rcx + movss (%rax,%rdx,4), %xmm0 + subss (%rcx,%rdx,4), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type tanhf,@function + .size tanhf,.-tanhf + .data +# -- End tanhf + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.29: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.29,@object + .size .L_2il0floatpacket.29,16 + .align 16 +.L_2il0floatpacket.31: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.31,@object + .size .L_2il0floatpacket.31,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x652b82fe,0x40071547 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x41600000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.3: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x55f6ce44,0x3eb67839 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 8 +.L_2il0floatpacket.5: + .long 0x17eb7c1b,0x3f83b2ac + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,8 + .align 8 +.L_2il0floatpacket.6: + .long 0x5a9238ae,0x3f24300f + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,8 + .align 8 +.L_2il0floatpacket.7: + .long 0xfe8df8b5,0x3fcebfbd + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x97a846d7,0x3ef0355a + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0xb399a1da,0x3fac6b09 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x2d719ac7,0x3f55d7f6 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 8 +.L_2il0floatpacket.11: + .long 0xfe8bdf78,0x3fe62e42 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,8 + .align 8 +.L_2il0floatpacket.12: + .long 0x8d21df9d,0x3eed02fa + .type .L_2il0floatpacket.12,@object + .size .L_2il0floatpacket.12,8 + .align 8 +.L_2il0floatpacket.13: + .long 0x4a9bd1ce,0x3f3d92d7 + .type .L_2il0floatpacket.13,@object + .size .L_2il0floatpacket.13,8 + .align 8 +.L_2il0floatpacket.14: + .long 0x4b00cfe8,0x3f6d0411 + .type .L_2il0floatpacket.14,@object + .size .L_2il0floatpacket.14,8 + .align 8 +.L_2il0floatpacket.15: + .long 0x616f3508,0x3f96640f + .type .L_2il0floatpacket.15,@object + .size .L_2il0floatpacket.15,8 + .align 8 +.L_2il0floatpacket.16: + .long 0xd4e5c3b2,0x3fc11110 + .type .L_2il0floatpacket.16,@object + .size .L_2il0floatpacket.16,8 + .align 8 +.L_2il0floatpacket.17: + .long 0x112b299f,0xbf1cd749 + .type .L_2il0floatpacket.17,@object + .size .L_2il0floatpacket.17,8 + .align 8 +.L_2il0floatpacket.18: + .long 0x6388aa74,0xbf563031 + .type .L_2il0floatpacket.18,@object + .size .L_2il0floatpacket.18,8 + .align 8 +.L_2il0floatpacket.19: + .long 0xd81e0536,0xbf821e4b + .type .L_2il0floatpacket.19,@object + .size .L_2il0floatpacket.19,8 + .align 8 +.L_2il0floatpacket.20: + .long 0xdc3e3757,0xbfaba1ab + .type .L_2il0floatpacket.20,@object + .size .L_2il0floatpacket.20,8 + .align 8 +.L_2il0floatpacket.21: + .long 0x547e4ef2,0xbfd55555 + .type .L_2il0floatpacket.21,@object + .size .L_2il0floatpacket.21,8 + .align 8 +.L_2il0floatpacket.22: + .long 0x7be81b29,0x3f6ab4a5 + .type .L_2il0floatpacket.22,@object + .size .L_2il0floatpacket.22,8 + .align 8 +.L_2il0floatpacket.23: + .long 0x9dbd8fad,0x3f966488 + .type .L_2il0floatpacket.23,@object + .size .L_2il0floatpacket.23,8 + .align 8 +.L_2il0floatpacket.24: + .long 0x0f94d287,0x3fc11111 + .type .L_2il0floatpacket.24,@object + .size .L_2il0floatpacket.24,8 + .align 8 +.L_2il0floatpacket.25: + .long 0xa5e0a14a,0xbf821629 + .type .L_2il0floatpacket.25,@object + .size .L_2il0floatpacket.25,8 + .align 8 +.L_2il0floatpacket.26: + .long 0x983e34ea,0xbfaba1b8 + .type .L_2il0floatpacket.26,@object + .size .L_2il0floatpacket.26,8 + .align 8 +.L_2il0floatpacket.27: + .long 0x5553e1cf,0xbfd55555 + .type .L_2il0floatpacket.27,@object + .size .L_2il0floatpacket.27,8 + .align 8 +.L_2il0floatpacket.30: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.30,@object + .size .L_2il0floatpacket.30,8 + .align 4 +.L_2il0floatpacket.2: + .long 0x4b000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.28: + .long 0x0d800000 + .type .L_2il0floatpacket.28,@object + .size .L_2il0floatpacket.28,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +ones: + .long 0x3f800000 + .long 0xbf800000 + .type ones,@object + .size ones,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tanhl.S b/external/sgx_libm/intel64/tanhl.S new file mode 100644 index 0000000000..89bc17c931 --- /dev/null +++ b/external/sgx_libm/intel64/tanhl.S @@ -0,0 +1,1042 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanhl.c" + .text +..TXTST0: +# -- Begin tanhl + .text + .align 16,0x90 + .globl tanhl +tanhl: +# parameter 1: 64 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_tanhl.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + xorb %dil, %dil +..B1.2: + fnstcw 50(%rsp) +..B1.3: + movb 73(%rsp), %al + andb $-128, %al + shrb $7, %al + movzwl 72(%rsp), %ecx + andl $32767, %ecx + movzbl %al, %esi + cmpl $16388, %ecx + movzwl 50(%rsp), %eax + jge ..B1.57 +..B1.4: + cmpl $16382, %ecx + jge ..B1.46 +..B1.5: + cmpl $16376, %ecx + jge ..B1.39 +..B1.6: + cmpl $16371, %ecx + jge ..B1.32 +..B1.7: + cmpl $16365, %ecx + jge ..B1.25 +..B1.8: + cmpl $16308, %ecx + jge ..B1.18 +..B1.9: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.13 +..B1.10: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.11: + fldcw 48(%rsp) +..B1.12: + movzwl 72(%rsp), %ecx + movb $1, %dil + andl $32767, %ecx +..B1.13: + testl %ecx, %ecx + jle ..B1.66 +..B1.14: + fldt 64(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + fsubp %st, %st(1) + fmull (%rdx) + fstpt (%rsp) +..B1.15: + testb %dil, %dil + je ..B1.17 +..B1.16: + fldcw 50(%rsp) +..B1.17: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.18: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.22 +..B1.19: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.20: + fldcw 48(%rsp) +..B1.21: + movb $1, %dil +..B1.22: + fldt 64(%rsp) + lea _Q3(%rip), %rax + testb %dil, %dil + fldt (%rax) + fmul %st(1), %st + fmul %st(1), %st + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.24 +..B1.23: + fldcw 50(%rsp) +..B1.24: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.25: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.29 +..B1.26: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.27: + fldcw 48(%rsp) +..B1.28: + movb $1, %dil +..B1.29: + fldt 64(%rsp) + lea 16+_Q2(%rip), %rax + fld %st(0) + lea _Q2(%rip), %rdx + fmul %st(1), %st + testb %dil, %dil + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.31 +..B1.30: + fldcw 50(%rsp) +..B1.31: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.32: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.36 +..B1.33: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.34: + fldcw 48(%rsp) +..B1.35: + movb $1, %dil +..B1.36: + fldt 64(%rsp) + lea 48+_Q1(%rip), %rax + fld %st(0) + lea 32+_Q1(%rip), %rcx + fmul %st(1), %st + lea 16+_Q1(%rip), %rdx + fld %st(0) + lea _Q1(%rip), %rsi + fmul %st(1), %st + testb %dil, %dil + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt (%rsp) + je ..B1.38 +..B1.37: + fldcw 50(%rsp) +..B1.38: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.39: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.43 +..B1.40: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.41: + fldcw 48(%rsp) +..B1.42: + movb $1, %dil +..B1.43: + fldt 64(%rsp) + lea _TWO_52H(%rip), %rax + fld %st(0) + fld %st(1) + fld %st(2) + lea 240+_Q(%rip), %rdx + fmul %st(3), %st + lea 208+_Q(%rip), %rcx + fld %st(0) + lea 176+_Q(%rip), %rsi + fmul %st(1), %st + lea 144+_Q(%rip), %r8 + fldl (%rax) + lea 112+_Q(%rip), %r9 + fmul %st(5), %st + lea 80+_Q(%rip), %r10 + lea 48+_Q(%rip), %r11 + lea 16+_Q(%rip), %rax + testb %dil, %dil + fadd %st, %st(4) + fsubrp %st, %st(4) + fld %st(3) + fxch %st(3) + fsub %st(4), %st + fmul %st, %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(3) + fld %st(2) + fmul %st(2), %st + fxch %st(4) + fstpt (%rsp) + fldt (%rsp) + fmul %st(0), %st + fstpt 32(%rsp) + fldt 32(%rsp) + fxch %st(5) + fstpt 16(%rsp) + fld %st(2) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(4) + fmul %st(0), %st + fldt (%rdx) + lea 224+_Q(%rip), %rdx + fmul %st(5), %st + fldt (%rcx) + lea 192+_Q(%rip), %rcx + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rsi) + lea 160+_Q(%rip), %rsi + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r8) + lea 128+_Q(%rip), %r8 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r9) + lea 96+_Q(%rip), %r9 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r10) + lea 64+_Q(%rip), %r10 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%r11) + lea 32+_Q(%rip), %r11 + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rax) + lea _Q(%rip), %rax + faddp %st, %st(1) + fmul %st(5), %st + fldt (%rdx) + lea 272+_Q(%rip), %rdx + fmul %st(6), %st + fldt (%rcx) + lea 256+_Q(%rip), %rcx + faddp %st, %st(1) + fmul %st(6), %st + fldt (%rsi) + lea _TWO_48H(%rip), %rsi + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(6), %st + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(6) + fldt (%rax) + faddp %st, %st(6) + fxch %st(2) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fldt (%rdx) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fxch %st(3) + fmulp %st, %st(2) + fldt (%rcx) + fmul %st, %st(1) + fxch %st(1) + faddp %st, %st(3) + fldt 32(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt 16(%rsp) + fld %st(0) + fldl (%rsi) + fld %st(0) + fadd %st(4), %st + fsub %st, %st(1) + fxch %st(1) + fmul %st, %st(2) + fsubr %st, %st(4) + fxch %st(5) + faddp %st, %st(4) + fldt 64(%rsp) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldt (%rsp) + fmul %st, %st(3) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + je ..B1.80 +..B1.44: + fstpt 16(%rsp) +..B1.79: + fldcw 50(%rsp) + jmp ..B1.45 +..B1.80: + fstp %st(0) +..B1.45: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.46: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.50 +..B1.47: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.48: + fldcw 48(%rsp) +..B1.49: + movzwl 72(%rsp), %ecx + movb $1, %dil + andl $32767, %ecx +..B1.50: + fldt 64(%rsp) + lea twos(%rip), %r8 + fldt .L_2il0floatpacket.0(%rip) + lea _TWO_63H(%rip), %r9 + fstpt 32(%rsp) + lea _TWO_32(%rip), %r10 + fldt .L_2il0floatpacket.1(%rip) + lea _TWO_32P(%rip), %r11 + fxch %st(1) + fmull (%r8,%rsi,8) + lea 64+_P(%rip), %r8 + fmul %st, %st(1) + fldl (%r9) + lea 32+_P(%rip), %r9 + fadd %st, %st(2) + fxch %st(2) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(2) + fldt .L_2il0floatpacket.2(%rip) + fmul %st(2), %st + movl 16(%rsp), %edx + fsubrp %st, %st(1) + fld %st(0) + fldt .L_2il0floatpacket.3(%rip) + fmulp %st, %st(3) + movsbq %dl, %rax + fsub %st(2), %st + fldl (%r10) + lea _P(%rip), %r10 + fldl (%r11) + lea 48+_P(%rip), %r11 + fmul %st(2), %st + subl %eax, %edx + fxch %st(1) + fmul %st, %st(2) + shrl $8, %edx + fxch %st(2) + fsubrp %st, %st(1) + fld %st(0) + addl $16383, %edx + andl $32767, %edx + fxch %st(1) + fsubr %st, %st(3) + shlq $4, %rax + fxch %st(4) + fsubrp %st, %st(3) + fadd %st(2), %st + fld %st(0) + fmul %st(1), %st + fldt (%r8) + lea 16+_P(%rip), %r8 + fmul %st(1), %st + fldt (%r9) + movzwl 8+.L_2il0floatpacket.0(%rip), %r9d + faddp %st, %st(1) + fmul %st(1), %st + andl $-32768, %r9d + fldt (%r10) + orl %edx, %r9d + movq __libm_expl_table_256@GOTPCREL(%rip), %rdx + cmpl $16385, %ecx + movw %r9w, 40(%rsp) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fldl 2056(%rdx,%rax) + fldl 2048(%rdx,%rax) + fld %st(0) + fmul %st(4), %st + fxch %st(4) + fadd %st(5), %st + fmul %st(2), %st + faddp %st, %st(4) + fmul %st, %st(4) + jge ..B1.52 +..B1.51: + fldt 32(%rsp) + fld %st(1) + lea _TWO_32H(%rip), %rax + fadd %st(6), %st + fadd %st(4), %st + fsubp %st, %st(4) + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(1) + fldt .L_2il0floatpacket.0(%rip) + fadd %st, %st(1) + fld %st(1) + fadd %st(3), %st + fdivr %st(1), %st + fld %st(2) + fldl (%rax) + fld %st(0) + fadd %st(3), %st + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fmul %st, %st(4) + fxch %st(3) + fsubr %st, %st(4) + fxch %st(2) + fsub %st(3), %st + fld %st(0) + fadd %st(4), %st + fmul %st, %st(6) + fxch %st(1) + fmul %st, %st(2) + fxch %st(6) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fmulp %st, %st(3) + fxch %st(2) + fsubrp %st, %st(3) + fldt .L_2il0floatpacket.4(%rip) + fmul %st, %st(1) + fxch %st(1) + fsubrp %st, %st(2) + fmulp %st, %st(2) + fsubp %st, %st(1) + fstpt (%rsp) + jmp ..B1.54 +..B1.52: + je ..B1.70 +..B1.53: + fstp %st(2) + fldt .L_2il0floatpacket.0(%rip) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(3) + faddp %st, %st(2) + fldt 32(%rsp) + fmulp %st, %st(2) + fadd %st, %st(1) + fldt .L_2il0floatpacket.4(%rip) + fdivp %st, %st(2) + fsubp %st, %st(1) + fstpt (%rsp) +..B1.54: + fldt (%rsp) + testq %rsi, %rsi + fld %st(0) + fchs + fcmove %st(1), %st + fstp %st(1) + fstpt (%rsp) + testb %dil, %dil + je ..B1.56 +..B1.55: + fldcw 50(%rsp) +..B1.56: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.57: + movl %eax, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.61 +..B1.58: + orl $-64768, %eax + movw %ax, 48(%rsp) +..B1.59: + fldcw 48(%rsp) +..B1.60: + movzwl 72(%rsp), %ecx + movb $1, %dil + andl $32767, %ecx +..B1.61: + cmpl $32767, %ecx + je ..B1.73 +..B1.62: + movq %rsi, %rdx + lea _small_value_80(%rip), %rax + shlq $4, %rdx + lea ones(%rip), %rcx + fldt (%rax,%rdx) + fsubrl (%rcx,%rsi,8) + fstpt (%rsp) +..B1.63: + testb %dil, %dil + je ..B1.65 +..B1.64: + fldcw 50(%rsp) +..B1.65: + fldt (%rsp) + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.66: + cmpl $0, 68(%rsp) + jne ..B1.68 +..B1.67: + cmpl $0, 64(%rsp) + je ..B1.69 +..B1.68: + fldt 64(%rsp) + lea _small_value_80(%rip), %rax + shlq $4, %rsi + fldt (%rax) + fldt (%rax,%rsi) + fmulp %st, %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubrp %st, %st(1) + fstpt (%rsp) + jmp ..B1.15 +..B1.69: + fldt 64(%rsp) + fstpt (%rsp) + jmp ..B1.15 +..B1.70: + movl 68(%rsp), %eax + cmpl $-1771674010, %eax + jb ..B1.51 +..B1.71: + jne ..B1.53 +..B1.72: + cmpl $1717986918, 64(%rsp) + jb ..B1.51 + jmp ..B1.53 +..B1.73: + cmpl $-2147483648, 68(%rsp) + jne ..B1.76 +..B1.74: + cmpl $0, 64(%rsp) + jne ..B1.76 +..B1.75: + lea ones(%rip), %rax + fldl (%rax,%rsi,8) + fstpt (%rsp) + jmp ..B1.63 +..B1.76: + fldt 64(%rsp) + fstpt (%rsp) + jmp ..B1.63 + .align 16,0x90 + .cfi_endproc + .type tanhl,@function + .size tanhl,.-tanhl + .data +# -- End tanhl + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0xf0,0x17,0x5c,0x29,0x3b,0xaa,0xb8,0x07,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0xf8,0x17,0x72,0xb1,0xf6,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x30,0x71,0xd8,0x50,0x19,0xc2,0xb8,0xd4,0xbf,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 8 +twos: + .long 0x00000000,0x40000000 + .long 0x00000000,0xc0000000 + .type twos,@object + .size twos,16 + .align 8 +ones: + .long 0x00000000,0x3ff00000 + .long 0x00000000,0xbff00000 + .type ones,@object + .size ones,16 + .align 4 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_TWO_32: + .long 0 + .long 1106247680 + .type _TWO_32,@object + .size _TWO_32,8 + .align 4 +_TWO_32P: + .long 1048576 + .long 1106247680 + .type _TWO_32P,@object + .size _TWO_32P,8 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 2 +_Q3: + .word 21845 + .word 42325 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .type _Q3,@object + .size _Q3,16 + .align 2 +_Q2: + .word 36147 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 55638 + .word 59918 + .word 34848 + .word 34952 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,32 + .align 2 +_Q1: + .word 43688 + .word 43690 + .word 43690 + .word 43690 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 48627 + .word 34947 + .word 34952 + .word 34952 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 23872 + .word 38674 + .word 53460 + .word 56589 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 33152 + .word 13396 + .word 6324 + .word 45860 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,64 + .align 2 +_Q: + .word 43505 + .word 43690 + .word 43690 + .word 43690 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 51768 + .word 34951 + .word 34952 + .word 34952 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 53715 + .word 3536 + .word 53469 + .word 56589 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 37274 + .word 24708 + .word 42049 + .word 45863 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 51222 + .word 13677 + .word 6831 + .word 37175 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 45961 + .word 31945 + .word 59504 + .word 60265 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 5972 + .word 17449 + .word 45604 + .word 48849 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 32816 + .word 2946 + .word 4564 + .word 39596 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 14786 + .word 2112 + .word 44465 + .word 64190 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 3031 + .word 16844 + .word 22916 + .word 52030 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 47485 + .word 32270 + .word 51436 + .word 42167 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 3071 + .word 14344 + .word 30185 + .word 34131 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 24996 + .word 54454 + .word 53234 + .word 54781 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 39193 + .word 24581 + .word 37984 + .word 42131 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 5913 + .word 28127 + .word 47865 + .word 55395 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 25952 + .word 54950 + .word 21582 + .word 44803 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 43680 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 34944 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _Q,@object + .size _Q,288 + .align 2 +_P: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 10558 + .word 43680 + .word 43690 + .word 43690 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59664 + .word 43680 + .word 43690 + .word 43690 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 56450 + .word 15979 + .word 35652 + .word 34952 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 7105 + .word 47411 + .word 25657 + .word 46603 + .word 16373 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,80 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tanl.S b/external/sgx_libm/intel64/tanl.S new file mode 100644 index 0000000000..24f7d378aa --- /dev/null +++ b/external/sgx_libm/intel64/tanl.S @@ -0,0 +1,1843 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tanl.c" + .text +..TXTST0: +# -- Begin tanl + .text + .align 16,0x90 + .globl tanl +tanl: +# parameter 1: 144 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_tanl.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + subq $120, %rsp + .cfi_def_cfa_offset 144 + xorb %r13b, %r13b + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 104(%rsp) +..B1.2: + fnstcw 82(%rsp) +..B1.3: + movzwl 152(%rsp), %eax + andl $32767, %eax + movzwl 82(%rsp), %ecx + cmpl $16373, %eax + jge ..B1.41 +..B1.4: + cmpl $16371, %eax + jge ..B1.33 +..B1.5: + cmpl $16364, %eax + jge ..B1.25 +..B1.6: + cmpl $16308, %eax + jge ..B1.17 +..B1.7: + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.11 +..B1.8: + orl $-64768, %ecx + movw %cx, 80(%rsp) +..B1.9: + fldcw 80(%rsp) +..B1.10: + movzwl 152(%rsp), %eax + movb $1, %r13b + andl $32767, %eax +..B1.11: + testl %eax, %eax + jle ..B1.83 +..B1.12: + fldt 144(%rsp) + lea _TWO_75(%rip), %rax + lea 8+_TWO_75(%rip), %rdx + fldl (%rax) + fmul %st(1), %st + faddp %st, %st(1) + fmull (%rdx) + fstpt 16(%rsp) +..B1.13: + testb %r13b, %r13b + je ..B1.15 +..B1.14: + fldcw 82(%rsp) +..B1.15: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.16: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.17: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.21 +..B1.18: + orl $-64768, %ecx + movw %cx, 80(%rsp) +..B1.19: + fldcw 80(%rsp) +..B1.20: + movb $1, %r13b +..B1.21: + fldt 144(%rsp) + lea _P3(%rip), %rax + fld %st(0) + testb %r13b, %r13b + fmul %st(1), %st + fldt (%rax) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.23 +..B1.22: + fldcw 82(%rsp) +..B1.23: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.24: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.25: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.29 +..B1.26: + orl $-64768, %ecx + movw %cx, 80(%rsp) +..B1.27: + fldcw 80(%rsp) +..B1.28: + movb $1, %r13b +..B1.29: + fldt 144(%rsp) + lea 16+_P2(%rip), %rax + fld %st(0) + lea _P2(%rip), %rdx + fmul %st(1), %st + testb %r13b, %r13b + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmulp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.31 +..B1.30: + fldcw 82(%rsp) +..B1.31: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.32: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.33: + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.37 +..B1.34: + orl $-64768, %ecx + movw %cx, 80(%rsp) +..B1.35: + fldcw 80(%rsp) +..B1.36: + movb $1, %r13b +..B1.37: + fldt 144(%rsp) + lea 48+_P1(%rip), %rax + fld %st(0) + lea 32+_P1(%rip), %rcx + fmul %st(1), %st + lea 16+_P1(%rip), %rdx + fld %st(0) + lea _P1(%rip), %rsi + fmul %st(1), %st + testb %r13b, %r13b + fldt (%rax) + fmul %st(1), %st + fldt (%rdx) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rcx) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + fmul %st(1), %st + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.39 +..B1.38: + fldcw 82(%rsp) +..B1.39: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.40: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.41: + movl %ecx, %edx + andl $768, %edx + cmpl $768, %edx + je ..B1.45 +..B1.42: + orl $-64768, %ecx + movw %cx, 80(%rsp) +..B1.43: + fldcw 80(%rsp) +..B1.44: + movzwl 152(%rsp), %eax + movb $1, %r13b + andl $32767, %eax +..B1.45: + movb 153(%rsp), %dl + andb $-128, %dl + shrb $7, %dl + movzbl %dl, %r12d + cmpl $16413, %eax + jge ..B1.52 +..B1.46: + fldt 144(%rsp) + lea _Pi4Inv(%rip), %rdx + fld %st(0) + fabs + fldl (%rdx) + fmul %st(1), %st + fstpt 64(%rsp) + movzwl 72(%rsp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.48 +..B1.47: + fstp %st(0) + lea _TWO_48H(%rip), %rax + fld %st(0) + fld %st(1) + lea _KPi04(%rip), %rdx + fldl (%rax) + fmul %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(2) + fsub %st(2), %st + fldt (%rdx) + fmul %st(4), %st + fstpt 64(%rsp) + movl $1, %edx + fxch %st(3) + jmp ..B1.63 +..B1.48: + fstp %st(1) + negl %ecx + lea _TWO_32H(%rip), %rdi + addl $30, %ecx + movl 68(%rsp), %edx + shrl %cl, %edx + fldl (%rdi) + incl %edx + movl %edx, %esi + andl $-2, %esi + movl %esi, 32(%rsp) + cmpl $16400, %eax + fildl 32(%rsp) + jge ..B1.50 +..B1.49: + lea _Pi04x3(%rip), %rax + lea 8+_Pi04x3(%rip), %rcx + lea 16+_Pi04x3(%rip), %rsi + fldl (%rax) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl (%rcx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fld %st(0) + fldl (%rsi) + fmulp %st, %st(3) + fsub %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) + jmp ..B1.51 +..B1.50: + lea _Pi04x5(%rip), %rax + lea 8+_Pi04x5(%rip), %rcx + lea 16+_Pi04x5(%rip), %rsi + lea 24+_Pi04x5(%rip), %rdi + lea 32+_Pi04x5(%rip), %r8 + fldl (%rax) + fmul %st(1), %st + fsubrp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldl (%rcx) + fmul %st(3), %st + fsubr %st, %st(2) + fxch %st(1) + fsub %st(2), %st + fsubp %st, %st(1) + faddp %st, %st(3) + fld %st(0) + fldl (%rsi) + fmul %st(3), %st + fsubr %st, %st(1) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(4) + faddp %st, %st(2) + fldl (%rdi) + fmul %st(3), %st + fsubr %st, %st(1) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(1) + fsubrp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fldl (%r8) + fmulp %st, %st(2) + fld %st(0) + fsub %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + fsubrp %st, %st(1) + faddp %st, %st(2) +..B1.51: + lea _TWO_48H(%rip), %rax + fld %st(0) + fld %st(1) + lea _ones(%rip), %rcx + lea _KPi04(%rip), %rsi + fldl (%rax) + fmul %st, %st(2) + fxch %st(1) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldl (%rcx,%r12,8) + fmul %st, %st(2) + fld %st(2) + fxch %st(1) + fmulp %st, %st(4) + fadd %st(3), %st + fstpt 144(%rsp) + fldt 144(%rsp) + fldt (%rsi) + fmul %st(1), %st + fstpt 64(%rsp) + jmp ..B1.63 +..B1.52: + cmpl $32767, %eax + jne ..B1.61 +..B1.53: + cmpl $-2147483648, 148(%rsp) + jne ..B1.56 +..B1.54: + cmpl $0, 144(%rsp) + jne ..B1.56 +..B1.55: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fstpt 16(%rsp) + jmp ..B1.57 +..B1.56: + fldt 144(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 16(%rsp) +..B1.57: + testb %r13b, %r13b + je ..B1.59 +..B1.58: + fldcw 82(%rsp) +..B1.59: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.60: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.61: + addq $-16, %rsp + .cfi_def_cfa_offset 160 + xorl %edi, %edi + fldt 160(%rsp) + lea 104(%rsp), %rsi + fabs + fstpt (%rsp) +..___tag_value_tanl.49: + call __libm_reduce_pi04l@PLT +..___tag_value_tanl.50: +..B1.97: + movl %eax, %edx + addq $16, %rsp + .cfi_def_cfa_offset 144 +..B1.62: + fldl 88(%rsp) + incl %edx + lea _TWO_48H(%rip), %rcx + fld %st(0) + movsd 88(%rsp), %xmm0 + lea _ones(%rip), %rax + fldl (%rcx) + fldl (%rax,%r12,8) + lea _KPi04(%rip), %r12 + mulsd (%rcx), %xmm0 + fldt (%r12) + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fadd %st, %st(4) + fsubrp %st, %st(4) + fxch %st(3) + fsubr %st, %st(4) + fmul %st(1), %st + fldl 96(%rsp) + faddp %st, %st(5) + fxch %st(1) + fmulp %st, %st(4) + fld %st(0) + fadd %st(4), %st + fmul %st, %st(3) + fxch %st(3) + fstpt 64(%rsp) + fxch %st(2) + fstpt 144(%rsp) + fldt 144(%rsp) +..B1.63: + movzwl 72(%rsp), %ecx + andl $32767, %ecx + cmpl $16383, %ecx + jge ..B1.73 +..B1.64: + testb $2, %dl + je ..B1.69 +..B1.65: + lea 8+_ones(%rip), %rax + fld %st(2) + fmul %st(4), %st + lea 80+_PG(%rip), %rdx + fxch %st(4) + fstpt 32(%rsp) + fldt 32(%rsp) + lea 64+_PG(%rip), %rcx + fmul %st(1), %st + lea 48+_PG(%rip), %rsi + lea 32+_PG(%rip), %rdi + lea 16+_PG(%rip), %r8 + lea _PG(%rip), %r9 + lea _ones(%rip), %r10 + testb %r13b, %r13b + faddp %st, %st(4) + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + fmul %st(0), %st + faddp %st, %st(3) + fld %st(2) + fmul %st(3), %st + fldl (%rax) + fdiv %st(3), %st + fmul %st, %st(2) + fldt (%rdx) + fmul %st(2), %st + fldt (%rcx) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fld %st(3) + fadd %st(2), %st + fsub %st(4), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(6) + fldt (%r9) + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fld %st(2) + fsubr %st(2), %st + fxch %st(6) + fmulp %st, %st(5) + faddp %st, %st(4) + fldt 48(%rsp) + fld %st(0) + fmul %st(6), %st + fxch %st(1) + fmul %st(3), %st + fldt 32(%rsp) + fmul %st(3), %st + faddp %st, %st(2) + faddl (%r10) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.102 +..B1.66: + fstpt 64(%rsp) +..B1.98: + fldcw 82(%rsp) + jmp ..B1.67 +..B1.102: + fstp %st(0) +..B1.67: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.68: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.69: + fld %st(0) + lea 80+_PT(%rip), %rax + fmul %st(1), %st + lea 64+_PT(%rip), %rdx + fxch %st(3) + fstpt 48(%rsp) + fld %st(2) + fmul %st(3), %st + lea 48+_PT(%rip), %rcx + fldt (%rax) + lea 32+_PT(%rip), %rsi + fmul %st(1), %st + lea 16+_PT(%rip), %rdi + fldt (%rdx) + lea _PT(%rip), %r8 + fmul %st(2), %st + testb %r13b, %r13b + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%r8) + faddp %st, %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(1) + fmul %st(2), %st + fld %st(2) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fld %st(2) + fmul %st(1), %st + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldt 48(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) + je ..B1.103 +..B1.70: + fstpt 64(%rsp) +..B1.99: + fldcw 82(%rsp) + jmp ..B1.71 +..B1.103: + fstp %st(0) +..B1.71: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.72: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.73: + fstp %st(0) + negl %ecx + pxor %xmm2, %xmm2 + addl $30, %ecx + movl 68(%rsp), %eax + shrl %cl, %eax + movl %eax, %edi + movzbl 153(%rsp), %esi + negl %edi + testl $128, %esi + movsd .L_2il0floatpacket.0(%rip), %xmm0 + cmovne %edi, %eax + testb $2, %dl + cvtsi2sd %eax, %xmm2 + mulsd %xmm2, %xmm0 + movsd .L_2il0floatpacket.1(%rip), %xmm1 + mulsd %xmm1, %xmm2 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + movsd %xmm2, 32(%rsp) + fsubrp %st, %st(2) + fld %st(1) + fldl 32(%rsp) + fsubrp %st, %st(4) + fadd %st(3), %st + je ..B1.78 +..B1.74: + fld %st(2) + lea 80+_PT(%rip), %rdx + fmul %st(4), %st + fld %st(4) + fmul %st(2), %st + lea 64+_PT(%rip), %rcx + lea 48+_PT(%rip), %rsi + lea 32+_PT(%rip), %rdi + lea 16+_PT(%rip), %r8 + lea _PT(%rip), %r9 + addl %eax, %eax + movslq %eax, %rax + lea _TG(%rip), %r10 + lea _TT(%rip), %r11 + lea _ones(%rip), %r12 + testb %r13b, %r13b + faddp %st, %st(1) + fld %st(3) + fmul %st(4), %st + faddp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fxch %st(3) + fstpt 32(%rsp) + fxch %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + fldt (%rdx) + fmul %st(3), %st + fldt (%rcx) + fmul %st(4), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fxch %st(1) + fmul %st, %st(3) + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fldl 272(%r10,%rax,8) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(4) + faddl 280(%r11,%rax,8) + fxch %st(3) + faddl 272(%r11,%rax,8) + fld %st(0) + fadd %st(4), %st + fxch %st(3) + fmull 280(%r10,%rax,8) + lea 8+_ones(%rip), %r10 + faddp %st, %st(2) + fld %st(1) + fadd %st(5), %st + fldt 32(%rsp) + fadd %st, %st(1) + fsubr %st, %st(1) + fxch %st(1) + fsubr %st, %st(6) + fxch %st(6) + fstpt 48(%rsp) + fldt 48(%rsp) + faddp %st, %st(3) + fld %st(0) + fxch %st(4) + fdivrl (%r12) + fmul %st, %st(5) + fadd %st, %st(4) + fxch %st(1) + fsubrp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fld %st(2) + fmul %st(1), %st + faddp %st, %st(6) + fxch %st(2) + fmul %st(4), %st + fld %st(4) + fmul %st(4), %st + fxch %st(4) + fadd %st(7), %st + fxch %st(7) + fmulp %st, %st(5) + faddl (%r10) + lea _GG(%rip), %r10 + faddp %st, %st(5) + fmulp %st, %st(4) + fsubp %st, %st(3) + fxch %st(3) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + faddl 272(%r10,%rax,8) + fxch %st(1) + faddl 280(%r10,%rax,8) + faddp %st, %st(1) + fstpt 16(%rsp) + fldt 48(%rsp) + je ..B1.104 +..B1.75: + fstpt 64(%rsp) +..B1.100: + fldcw 82(%rsp) + jmp ..B1.76 +..B1.104: + fstp %st(0) +..B1.76: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.77: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.78: + fld %st(0) + lea 80+_PT(%rip), %rdx + fmul %st(1), %st + lea 64+_PT(%rip), %rcx + fld %st(0) + lea 48+_PT(%rip), %rsi + fmul %st(1), %st + lea 32+_PT(%rip), %rdi + fxch %st(4) + fstpt 48(%rsp) + lea 16+_PT(%rip), %r8 + fldt (%rdx) + lea _PT(%rip), %r9 + fmul %st(4), %st + addl %eax, %eax + fldt (%rcx) + lea _TG(%rip), %r10 + fmul %st(5), %st + lea _GG(%rip), %r11 + fldt (%rsi) + lea 8+_ones(%rip), %r12 + movslq %eax, %rax + testb %r13b, %r13b + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(5), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(5) + fld %st(3) + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(4) + fmul %st(3), %st + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(3) + fxch %st(1) + fmulp %st, %st(3) + fld %st(3) + fmul %st(1), %st + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(0) + fldt 48(%rsp) + fmul %st, %st(3) + faddp %st, %st(3) + fld %st(2) + fadd %st(4), %st + fmul %st, %st(1) + fstpt 144(%rsp) + fldt 144(%rsp) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(2) + fadd %st(2), %st + fldl 272(%r10,%rax,8) + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(5), %st + fxch %st(4) + faddl 280(%r11,%rax,8) + fxch %st(5) + faddl 272(%r11,%rax,8) + fxch %st(2) + fmull 280(%r10,%rax,8) + lea _ones(%rip), %r10 + faddp %st, %st(1) + fld %st(1) + fadd %st(5), %st + fdivrl (%r12) + fmul %st, %st(3) + fld %st(3) + fadd %st(1), %st + fsubp %st, %st(4) + fld %st(3) + fsubr %st(1), %st + fld %st(3) + fmul %st(1), %st + fxch %st(2) + fmul %st, %st(7) + fxch %st(7) + faddp %st, %st(2) + fxch %st(3) + fmul %st(4), %st + fld %st(4) + fmul %st(3), %st + fxch %st(3) + fadd %st(6), %st + fxch %st(6) + fmulp %st, %st(5) + faddl (%r10) + lea _TT(%rip), %r10 + faddp %st, %st(1) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(1) + fmulp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldl 272(%r10,%rax,8) + fld %st(0) + fadd %st(2), %st + fsub %st, %st(1) + fxch %st(1) + fsubr %st(2), %st + fxch %st(3) + faddl 280(%r10,%rax,8) + faddp %st, %st(3) + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + je ..B1.105 +..B1.79: + fstpt 64(%rsp) +..B1.101: + fldcw 82(%rsp) + jmp ..B1.80 +..B1.105: + fstp %st(0) +..B1.80: + movq 104(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.82 +..B1.81: + fldt 16(%rsp) + addq $120, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 144 + .cfi_offset 12, -16 + .cfi_offset 13, -24 +..B1.82: + call __stack_chk_fail@PLT +..B1.83: + cmpl $0, 148(%rsp) + jne ..B1.85 +..B1.84: + cmpl $0, 144(%rsp) + je ..B1.86 +..B1.85: + fldt 144(%rsp) + lea _TWO_75(%rip), %rsi + movb 153(%rsp), %al + lea _small_value_80(%rip), %rcx + andb $-128, %al + lea 8+_TWO_75(%rip), %rdi + shrb $7, %al + fldl (%rsi) + fmul %st(1), %st + faddp %st, %st(1) + fldt (%rcx) + fxch %st(1) + fmull (%rdi) + movzbl %al, %edx + shlq $4, %rdx + fstpt 16(%rsp) + fldt (%rcx,%rdx) + fmulp %st, %st(1) + fstpt (%rsp) + jmp ..B1.13 +..B1.86: + fldt 144(%rsp) + fstpt 16(%rsp) + jmp ..B1.13 + .align 16,0x90 + .cfi_endproc + .type tanl,@function + .size tanl,.-tanl + .data +# -- End tanl + .section .rodata, "a" + .align 16 + .align 16 +_TWO_75: + .long 0 + .long 1151336448 + .long 0 + .long 994050048 + .type _TWO_75,@object + .size _TWO_75,16 + .align 16 +_P3: + .word 13380 + .word 43827 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _P3,@object + .size _P3,16 + .align 16 +_P2: + .word 42806 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 23834 + .word 52331 + .word 35007 + .word 34952 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P2,@object + .size _P2,32 + .align 16 +_P1: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 34953 + .word 34952 + .word 34952 + .word 34952 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 31445 + .word 3491 + .word 53469 + .word 56589 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 16733 + .word 58542 + .word 44372 + .word 45863 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,64 + .align 16 +_Pi4Inv: + .long 1841940611 + .long 1072979760 + .type _Pi4Inv,@object + .size _Pi4Inv,8 + .space 8, 0x00 # pad + .align 16 +_TWO_48H: + .long 0 + .long 1123549184 + .type _TWO_48H,@object + .size _TWO_48H,8 + .space 8, 0x00 # pad + .align 16 +_KPi04: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16387 + .word 0 + .word 0 + .word 0 + .type _KPi04,@object + .size _KPi04,16 + .align 16 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .space 8, 0x00 # pad + .align 16 +_Pi04x3: + .long 1413754112 + .long 1072243195 + .long 2563527040 + .long 1021855384 + .long 3417685868 + .long 3118450936 + .type _Pi04x3,@object + .size _Pi04x3,24 + .space 8, 0x00 # pad + .align 16 +_Pi04x5: + .long 1413480448 + .long 1072243195 + .long 442499072 + .long 1036039265 + .long 771751936 + .long 999496074 + .long 622854144 + .long 963347354 + .long 1396597664 + .long 922906692 + .type _Pi04x5,@object + .size _Pi04x5,40 + .space 8, 0x00 # pad + .align 16 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 16 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 16 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 16 +_PG: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 46604 + .word 2912 + .word 24758 + .word 46603 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 64867 + .word 2218 + .word 21984 + .word 35507 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 37428 + .word 49066 + .word 48281 + .word 56811 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 28819 + .word 40692 + .word 30466 + .word 45908 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 58229 + .word 57025 + .word 27882 + .word 37211 + .word 16364 + .word 0 + .word 0 + .word 0 + .type _PG,@object + .size _PG,96 + .align 16 +_PT: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 35260 + .word 34952 + .word 34952 + .word 34952 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 59431 + .word 3445 + .word 53469 + .word 56589 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 60805 + .word 19035 + .word 42054 + .word 45863 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 32963 + .word 17667 + .word 64505 + .word 37174 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 33271 + .word 14204 + .word 52730 + .word 60442 + .word 16374 + .word 0 + .word 0 + .word 0 + .type _PT,@object + .size _PT,96 + .align 16 +_TG: + .long 2684354560 + .long 3221230545 + .long 1980244105 + .long 1046278452 + .long 0 + .long 3221225472 + .long 0 + .long 0 + .long 2684354560 + .long 3221230545 + .long 1980244105 + .long 1046278452 + .long 3758096384 + .long 3221246014 + .long 1513286675 + .long 1048381067 + .long 0 + .long 3221272655 + .long 4057975187 + .long 3193921290 + .long 2147483648 + .long 3221311866 + .long 2902494488 + .long 1046516509 + .long 3221225472 + .long 3221365863 + .long 1948335328 + .long 3196126810 + .long 2684354560 + .long 3221438007 + .long 3744091947 + .long 3192783219 + .long 2684354560 + .long 3221533379 + .long 3860423252 + .long 1047335024 + .long 2147483648 + .long 3221659806 + .long 862942416 + .long 1049198788 + .long 0 + .long 3221829776 + .long 543592927 + .long 3195468420 + .long 0 + .long 3222064283 + .long 2814267453 + .long 1048596082 + .long 536870912 + .long 3222337673 + .long 2980891112 + .long 3196362141 + .long 2684354560 + .long 3222595502 + .long 141458722 + .long 1049458206 + .long 3221225472 + .long 3223031588 + .long 2120823910 + .long 1049591613 + .long 3221225472 + .long 3223617753 + .long 663882580 + .long 3198186420 + .long 2147483648 + .long 3224659859 + .long 3051968734 + .long 3194791707 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1077176211 + .long 3051968734 + .long 1047308059 + .long 3221225472 + .long 1076134105 + .long 663882580 + .long 1050702772 + .long 3221225472 + .long 1075547940 + .long 2120823910 + .long 3197075261 + .long 2684354560 + .long 1075111854 + .long 141458722 + .long 3196941854 + .long 536870912 + .long 1074854025 + .long 2980891112 + .long 1048878493 + .long 0 + .long 1074580635 + .long 2814267453 + .long 3196079730 + .long 0 + .long 1074346128 + .long 543592927 + .long 1047984772 + .long 2147483648 + .long 1074176158 + .long 862942416 + .long 3196682436 + .long 2684354560 + .long 1074049731 + .long 3860423252 + .long 3194818672 + .long 2684354560 + .long 1073954359 + .long 3744091947 + .long 1045299571 + .long 3221225472 + .long 1073882215 + .long 1948335328 + .long 1048643162 + .long 2147483648 + .long 1073828218 + .long 2902494488 + .long 3194000157 + .long 0 + .long 1073789007 + .long 4057975187 + .long 1046437642 + .long 3758096384 + .long 1073762366 + .long 1513286675 + .long 3195864715 + .long 2684354560 + .long 1073746897 + .long 1980244105 + .long 3193762100 + .long 0 + .long 1073741824 + .long 0 + .long 0 + .long 2684354560 + .long 1073746897 + .long 1980244105 + .long 3193762100 + .type _TG,@object + .size _TG,560 + .align 16 +_TT: + .long 1610612736 + .long 3220285245 + .long 1765132704 + .long 1046851815 + .long 0 + .long 3220176896 + .long 0 + .long 0 + .long 3221225472 + .long 3219980491 + .long 3100042604 + .long 3192709428 + .long 1073741824 + .long 3219800832 + .long 2956254064 + .long 1046813655 + .long 0 + .long 3219635098 + .long 829070670 + .long 1046664815 + .long 0 + .long 3219481016 + .long 3358544266 + .long 3195362300 + .long 2147483648 + .long 3219336728 + .long 4185368031 + .long 3193047295 + .long 536870912 + .long 3219200695 + .long 1373988029 + .long 1045159724 + .long 0 + .long 3219014926 + .long 4104169752 + .long 3192540796 + .long 2147483648 + .long 3218768505 + .long 843197631 + .long 3193568495 + .long 0 + .long 3218531914 + .long 1839318447 + .long 1044402419 + .long 1073741824 + .long 3218303496 + .long 1215676724 + .long 1044727608 + .long 1610612736 + .long 3218081786 + .long 2922073518 + .long 3193275942 + .long 0 + .long 3217651190 + .long 2818065035 + .long 1045408462 + .long 2147483648 + .long 3217226924 + .long 2142552361 + .long 1043903475 + .long 2147483648 + .long 3216586427 + .long 1153689642 + .long 3190339163 + .long 2147483648 + .long 3215533863 + .long 3288774277 + .long 3189012002 + .long 0 + .long 0 + .long 0 + .long 0 + .long 2147483648 + .long 1068050215 + .long 3288774277 + .long 1041528354 + .long 2147483648 + .long 1069102779 + .long 1153689642 + .long 1042855515 + .long 2147483648 + .long 1069743276 + .long 2142552361 + .long 3191387123 + .long 0 + .long 1070167542 + .long 2818065035 + .long 3192892110 + .long 1610612736 + .long 1070598138 + .long 2922073518 + .long 1045792294 + .long 1073741824 + .long 1070819848 + .long 1215676724 + .long 3192211256 + .long 0 + .long 1071048266 + .long 1839318447 + .long 3191886067 + .long 2147483648 + .long 1071284857 + .long 843197631 + .long 1046084847 + .long 0 + .long 1071531278 + .long 4104169752 + .long 1045057148 + .long 536870912 + .long 1071717047 + .long 1373988029 + .long 3192643372 + .long 2147483648 + .long 1071853080 + .long 4185368031 + .long 1045563647 + .long 0 + .long 1071997368 + .long 3358544266 + .long 1047878652 + .long 0 + .long 1072151450 + .long 829070670 + .long 3194148463 + .long 1073741824 + .long 1072317184 + .long 2956254064 + .long 3194297303 + .long 3221225472 + .long 1072496843 + .long 3100042604 + .long 1045225780 + .long 0 + .long 1072693248 + .long 0 + .long 0 + .long 1610612736 + .long 1072801597 + .long 1765132704 + .long 3194335463 + .type _TT,@object + .size _TT,560 + .align 16 +_GG: + .long 3221225472 + .long 1072496843 + .long 3100042604 + .long 1045225780 + .long 0 + .long 1072693248 + .long 2680413623 + .long 2803148914 + .long 1610612736 + .long 1072801597 + .long 1765132704 + .long 3194335463 + .long 2147483648 + .long 1072922365 + .long 4224648010 + .long 1047203520 + .long 0 + .long 1073058513 + .long 1429029132 + .long 1047610106 + .long 0 + .long 1073213977 + .long 2662307862 + .long 3195905419 + .long 2147483648 + .long 1073394115 + .long 2332932060 + .long 3196140229 + .long 3221225472 + .long 1073606419 + .long 4089189126 + .long 3194062807 + .long 3758096384 + .long 1073801761 + .long 295749197 + .long 3195130376 + .long 1073741824 + .long 1073958991 + .long 862942416 + .long 3195633860 + .long 0 + .long 1074158535 + .long 1551453531 + .long 3197746903 + .long 0 + .long 1074421594 + .long 590804010 + .long 3196516863 + .long 0 + .long 1074786323 + .long 1872593098 + .long 1046983523 + .long 3758096384 + .long 1075059710 + .long 2286165020 + .long 1046614587 + .long 2147483648 + .long 1075509055 + .long 2023416727 + .long 3198791271 + .long 1610612736 + .long 1076121196 + .long 3469402705 + .long 3196752904 + .long 0 + .long 1077172992 + .long 2869016295 + .long 3199393764 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 3224656640 + .long 2869016295 + .long 1051910116 + .long 1610612736 + .long 3223604844 + .long 3469402705 + .long 1049269256 + .long 2147483648 + .long 3222992703 + .long 2023416727 + .long 1051307623 + .long 3758096384 + .long 3222543358 + .long 2286165020 + .long 3194098235 + .long 0 + .long 3222269971 + .long 1872593098 + .long 3194467171 + .long 0 + .long 3221905242 + .long 590804010 + .long 1049033215 + .long 0 + .long 3221642183 + .long 1551453531 + .long 1050263255 + .long 1073741824 + .long 3221442639 + .long 862942416 + .long 1048150212 + .long 3758096384 + .long 3221285409 + .long 295749197 + .long 1047646728 + .long 3221225472 + .long 3221090067 + .long 4089189126 + .long 1046579159 + .long 2147483648 + .long 3220877763 + .long 2332932060 + .long 1048656581 + .long 0 + .long 3220697625 + .long 2662307862 + .long 1048421771 + .long 0 + .long 3220542161 + .long 1429029132 + .long 3195093754 + .long 2147483648 + .long 3220406013 + .long 4224648010 + .long 3194687168 + .long 1610612736 + .long 3220285245 + .long 1765132704 + .long 1046851815 + .long 0 + .long 3220176896 + .long 2680413623 + .long 655665266 + .long 3221225472 + .long 3219980491 + .long 3100042604 + .long 3192709428 + .type _GG,@object + .size _GG,560 + .align 16 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 8 +.L_2il0floatpacket.0: + .long 0x54400000,0x3fa921fb + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x1a626331,0x3d80b461 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tgamma.S b/external/sgx_libm/intel64/tgamma.S new file mode 100644 index 0000000000..f277e018cd --- /dev/null +++ b/external/sgx_libm/intel64/tgamma.S @@ -0,0 +1,3885 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tgamma.c" + .text +..TXTST0: +# -- Begin tgamma + .text + .align 16,0x90 + .globl tgamma +tgamma: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_tgamma.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %r15 + .cfi_def_cfa_offset 40 + .cfi_offset 15, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + pushq %rbp + .cfi_def_cfa_offset 56 + .cfi_offset 6, -56 + subq $104, %rsp + .cfi_def_cfa_offset 160 + fldz + lea _zeros(%rip), %r15 + xorl %r12d, %r12d + movd %xmm0, %rax + xorb %r13b, %r13b + movsd %xmm0, 72(%rsp) + fstpt 48(%rsp) + movq (%r15), %rdx + movq %rax, 16(%rsp) + movq %rdx, 80(%rsp) +..B1.2: + fnstcw 90(%rsp) +..B1.3: + movzwl 90(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 88(%rsp) +..B1.5: + fldcw 88(%rsp) +..B1.6: + movb $1, %r13b +..B1.7: +..___tag_value_tgamma.16: + call fegetround@PLT +..___tag_value_tgamma.17: +..B1.121: + movl %eax, %r14d +..B1.8: + testl %r14d, %r14d + je ..B1.10 +..B1.9: + xorl %edi, %edi + movl $1, %r12d +..___tag_value_tgamma.18: + call fesetround@PLT +..___tag_value_tgamma.19: +..B1.10: + movzwl 78(%rsp), %edx + andl $32752, %edx + shrl $4, %edx + movl 76(%rsp), %ebx + shrl $31, %ebx + cmpl $2047, %edx + je ..B1.108 +..B1.11: + movsd 72(%rsp), %xmm2 + movsd (%r15), %xmm0 + movl 20(%rsp), %eax + andl $2147483647, %eax + movl 16(%rsp), %ecx + movl %eax, 20(%rsp) + movsd %xmm0, (%rsp) + ucomisd %xmm0, %xmm2 + jp ..B1.12 + je ..B1.103 +..B1.12: + cmpl $262144, %eax + jl ..B1.98 +..B1.13: + je ..B1.97 +..B1.14: + testl %ebx, %ebx + je ..B1.25 +..B1.15: + cmpl $1075, %edx + jge ..B1.87 +..B1.16: + lea _TWO_52H(%rip), %rax + movsd 16(%rsp), %xmm1 + movaps %xmm1, %xmm0 + addsd (%rax), %xmm0 + movsd %xmm0, 40(%rsp) + movsd 40(%rsp), %xmm0 + movl 40(%rsp), %r15d + subsd (%rax), %xmm0 + comisd %xmm1, %xmm0 + jbe ..B1.18 +..B1.17: + lea _ones(%rip), %rax + incl %r15d + subsd (%rax), %xmm0 +..B1.18: + ucomisd %xmm0, %xmm1 + jp ..B1.19 + je ..B1.82 +..B1.19: + movsd .L_2il0floatpacket.0(%rip), %xmm0 + comisd %xmm2, %xmm0 + jbe ..B1.25 +..B1.20: + testl %r12d, %r12d + je ..B1.22 +..B1.21: + movl %r14d, %edi +..___tag_value_tgamma.20: + call fesetround@PLT +..___tag_value_tgamma.21: +..B1.22: + lea _small_value_64(%rip), %rax + notl %r15d + andl $1, %r15d + testb %r13b, %r13b + movsd (%rax,%r15,8), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.24 +..B1.23: + fldcw 90(%rsp) +..B1.24: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.25: + lea _overflow_boundary(%rip), %rax + comisd (%rax), %xmm2 + jae ..B1.92 +..B1.26: + testl %ebx, %ebx + je ..B1.28 +..B1.27: + lea _TWO_52H(%rip), %rax + lea 144+_tgamma_sin_table(%rip), %rcx + movsd 16(%rsp), %xmm0 + lea 128+_tgamma_sin_table(%rip), %rsi + movaps %xmm0, %xmm1 + movaps %xmm0, %xmm3 + lea 112+_tgamma_sin_table(%rip), %r8 + lea 96+_tgamma_sin_table(%rip), %r9 + fldt (%rcx) + lea 80+_tgamma_sin_table(%rip), %r10 + fldt (%rsi) + lea 64+_tgamma_sin_table(%rip), %r11 + lea 48+_tgamma_sin_table(%rip), %r15 + addsd (%rax), %xmm1 + fldt (%r8) + lea 32+_tgamma_sin_table(%rip), %rdi + fldt (%r9) + lea 16+_tgamma_sin_table(%rip), %rcx + fldt (%r10) + lea _tgamma_sin_table(%rip), %rsi + movsd %xmm1, 40(%rsp) + movsd 40(%rsp), %xmm2 + movsd (%rax), %xmm1 + subsd %xmm1, %xmm2 + subsd %xmm2, %xmm3 + movsd %xmm3, 24(%rsp) + andl $2147483647, 28(%rsp) + fldl 24(%rsp) + fld %st(0) + fmul %st(1), %st + fmul %st, %st(6) + fxch %st(6) + faddp %st, %st(5) + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + faddp %st, %st(1) + fmul %st(3), %st + faddp %st, %st(1) + fmul %st(2), %st + fld %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r15) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(1) + fmulp %st, %st(3) + fldt (%rsi) + faddp %st, %st(3) + fmulp %st, %st(2) + faddp %st, %st(1) + fstpt 48(%rsp) + jmp ..B1.29 +..B1.28: + lea _TWO_52H(%rip), %rax + movsd 16(%rsp), %xmm0 + movsd (%rax), %xmm1 +..B1.29: + addsd %xmm0, %xmm1 + movsd %xmm1, 40(%rsp) + movsd 40(%rsp), %xmm1 + movl 40(%rsp), %ecx + subsd (%rax), %xmm1 + lea _ones(%rip), %rax + movsd (%rax), %xmm3 + comisd %xmm0, %xmm1 + jbe ..B1.31 +..B1.30: + decl %ecx + subsd %xmm3, %xmm1 +..B1.31: + lea 1(%rcx), %r15d + andl $1, %r15d + comisd .L_2il0floatpacket.1(%rip), %xmm0 + jb ..B1.54 +..B1.32: + movl %ecx, %ebp + movl %ecx, %edx + andl $-16, %ebp + andl $15, %edx + movl %ebp, %esi + cmpl $16, %ecx + movl %ebp, %ecx + movaps %xmm0, %xmm2 + lea _tgamma_A_table(%rip), %r8 + subsd %xmm1, %xmm2 + movsd %xmm2, 64(%rsp) + lea -2(%rdx), %eax + fldl 64(%rsp) + cmovl %eax, %edx + sarl $2, %esi + fld %st(0) + sarl $3, %ecx + addl %ebp, %esi + sarl $4, %ebp + addl %ebp, %ecx + addl %ecx, %esi + movslq %esi, %rsi + shlq $4, %rsi + fmul %st(1), %st + testl %edx, %edx + fldt 352(%r8,%rsi) + fldt (%r8,%rsi) + fmul %st(3), %st + movsd %xmm3, 64(%rsp) + fadd %st(2), %st + fldt 176(%r8,%rsi) + movsd %xmm2, 32(%rsp) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 16(%r8,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 32(%r8,%rsi) + fmul %st(4), %st + fadd %st(3), %st + fldt 192(%r8,%rsi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 208(%r8,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 224(%r8,%rsi) + fldt 240(%r8,%rsi) + fldt 256(%r8,%rsi) + fldt 48(%r8,%rsi) + fmul %st(6), %st + fadd %st(5), %st + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fldt 64(%r8,%rsi) + fmul %st(5), %st + fadd %st(4), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fldt 80(%r8,%rsi) + fmul %st(4), %st + fadd %st(3), %st + faddp %st, %st(1) + fmulp %st, %st(1) + fldt 96(%r8,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 128(%r8,%rsi) + fmul %st(4), %st + fadd %st(3), %st + fldt 272(%r8,%rsi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt 288(%r8,%rsi) + fldt 304(%r8,%rsi) + faddp %st, %st(2) + fldt 112(%r8,%rsi) + fmul %st(5), %st + fadd %st(4), %st + faddp %st, %st(1) + fmulp %st, %st(2) + fmulp %st, %st(1) + fldt 144(%r8,%rsi) + fmul %st(3), %st + fadd %st(2), %st + fldt 160(%r8,%rsi) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fldt 320(%r8,%rsi) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt 336(%r8,%rsi) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 8(%rsp) + fldl 64(%rsp) + fld %st(0) + je ..B1.37 +..B1.33: + movl $1, %eax + jle ..B1.37 +..B1.34: + movsd %xmm0, 64(%rsp) + fldl 64(%rsp) +..B1.35: + movl %eax, 64(%rsp) + incl %eax + fildl 64(%rsp) + cmpl %edx, %eax + fsubr %st(1), %st + fmulp %st, %st(2) + jle ..B1.35 +..B1.36: + fstp %st(0) +..B1.37: + testl %ebx, %ebx + je ..B1.48 +..B1.38: + fldt 48(%rsp) + fldt 8(%rsp) + movsd %xmm0, 64(%rsp) + fldl 64(%rsp) + fmulp %st, %st(2) + fmulp %st, %st(1) + fmulp %st, %st(1) + fdivrp %st, %st(1) + movsd .L_2il0floatpacket.4(%rip), %xmm0 + fstpl (%rsp) + movsd (%rsp), %xmm1 + comisd 72(%rsp), %xmm0 + jbe ..B1.45 +..B1.39: + movaps %xmm1, %xmm0 + testl %r15d, %r15d + xorps .L_2il0floatpacket.5(%rip), %xmm0 + jne ..L42 + movaps %xmm1, %xmm0 +..L42: + testl %r12d, %r12d + je ..B1.42 +..B1.40: + movl %r14d, %edi + movsd %xmm0, 80(%rsp) +..___tag_value_tgamma.43: + call fesetround@PLT +..___tag_value_tgamma.44: +..B1.41: + movsd 80(%rsp), %xmm0 + xorl %r12d, %r12d +..B1.42: + lea _tgamma_A176_inv(%rip), %rax + testl %r15d, %r15d + movsd %xmm0, 64(%rsp) + fldl 64(%rsp) + fldt (%rax) + fmulp %st, %st(1) + je ..B1.44 +..B1.43: + fchs + fstpl 80(%rsp) + jmp ..B1.46 +..B1.44: + fstpl 80(%rsp) + jmp ..B1.46 +..B1.45: + movsd %xmm1, 80(%rsp) +..B1.46: + shll $31, %r15d + xorl %r15d, 84(%rsp) + testl %r12d, %r12d + je ..B1.51 +..B1.47: + movl %r14d, %edi +..___tag_value_tgamma.45: + call fesetround@PLT +..___tag_value_tgamma.46: + jmp ..B1.51 +..B1.48: + fstp %st(1) + fldt 8(%rsp) + testl %r12d, %r12d + fmulp %st, %st(1) + fstpt 8(%rsp) + je ..B1.50 +..B1.49: + movl %r14d, %edi +..___tag_value_tgamma.47: + call fesetround@PLT +..___tag_value_tgamma.48: +..B1.50: + fldt 8(%rsp) + fstpl 80(%rsp) +..B1.51: + testb %r13b, %r13b + je ..B1.53 +..B1.52: + movsd 32(%rsp), %xmm0 + movsd %xmm0, 24(%rsp) +..B1.122: + fldcw 90(%rsp) +..B1.53: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.54: + fldt .L_2il0floatpacket.2(%rip) + comisd %xmm0, %xmm3 + movsd %xmm0, 64(%rsp) + fldl 64(%rsp) + movsd %xmm3, 64(%rsp) + fldl 64(%rsp) + fadd %st(1), %st + fcmovbe %st(1), %st + fcomi %st(2), %st + fxch %st(2) + fstp %st(0) + jb ..B1.56 +..B1.55: + movsd %xmm3, 64(%rsp) + lea _tgamma_A150_table(%rip), %rbp + fldl 64(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstl 24(%rsp) + fxch %st(1) + jmp ..B1.60 +..B1.56: + fldt .L_2il0floatpacket.3(%rip) + fcomi %st(2), %st + ja ..B1.58 + jp ..B1.58 +..B1.57: + fstp %st(0) + lea _local_minimum(%rip), %rax + lea _tgamma_A125_table(%rip), %rbp + movsd %xmm3, 64(%rsp) + fldl 64(%rsp) + faddl (%rax) + fsubrp %st, %st(2) + fxch %st(1) + fstl 24(%rsp) + fxch %st(1) + jmp ..B1.60 +..B1.58: + fcomip %st(2), %st + jbe ..B1.60 +..B1.59: + movsd %xmm3, 64(%rsp) + lea _tgamma_A100_table(%rip), %rbp + fldl 64(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fstl 24(%rsp) + fxch %st(1) +..B1.60: + fstp %st(1) + fldt (%rbp) + testl %edx, %edx + je ..B1.63 +..B1.61: + fldl 24(%rsp) + fldt 240(%rbp) + fmul %st(1), %st + fldt 224(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 208(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 192(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 176(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 160(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 144(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 128(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 112(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 96(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 80(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 64(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 48(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 32(%rbp) + faddp %st, %st(1) + fmul %st(1), %st + fldt 16(%rbp) + faddp %st, %st(1) + fmulp %st, %st(1) + faddp %st, %st(1) +..B1.63: + comisd %xmm0, %xmm3 + jbe ..B1.72 +..B1.64: + fstp %st(1) + testl %ebx, %ebx + je ..B1.68 +..B1.65: + fldt 48(%rsp) + testl %r12d, %r12d + fmulp %st, %st(1) + movsd %xmm3, 64(%rsp) + fldl 64(%rsp) + fdivp %st, %st(1) + fchs + fstpt (%rsp) + je ..B1.67 +..B1.66: + movl %r14d, %edi +..___tag_value_tgamma.69: + call fesetround@PLT +..___tag_value_tgamma.70: +..B1.67: + fldt (%rsp) + fchs + fstpl 80(%rsp) + shll $31, %r15d + xorl %r15d, 84(%rsp) + jmp ..B1.79 +..B1.68: + testl %r12d, %r12d + je ..B1.71 +..B1.69: + movl %r14d, %edi + fstpt (%rsp) +..___tag_value_tgamma.71: + call fesetround@PLT +..___tag_value_tgamma.72: +..B1.70: + fldt (%rsp) + movsd 16(%rsp), %xmm0 +..B1.71: + movsd %xmm0, 64(%rsp) + fldl 64(%rsp) + fdivrp %st, %st(1) + fstpl 80(%rsp) + jmp ..B1.79 +..B1.72: + testl %ebx, %ebx + je ..B1.76 +..B1.73: + fldt 48(%rsp) + testl %r12d, %r12d + fmulp %st, %st(2) + fmulp %st, %st(1) + movsd %xmm3, 64(%rsp) + fldl 64(%rsp) + fdivp %st, %st(1) + fstpt (%rsp) + je ..B1.75 +..B1.74: + movl %r14d, %edi +..___tag_value_tgamma.73: + call fesetround@PLT +..___tag_value_tgamma.74: +..B1.75: + fldt (%rsp) + fstpl 80(%rsp) + jmp ..B1.79 +..B1.76: + fstp %st(1) + testl %r12d, %r12d + je ..B1.78 +..B1.77: + movl %r14d, %edi + fstpt (%rsp) +..___tag_value_tgamma.75: + call fesetround@PLT +..___tag_value_tgamma.76: +..B1.123: + fldt (%rsp) +..B1.78: + fstpl 80(%rsp) +..B1.79: + testb %r13b, %r13b + je ..B1.81 +..B1.80: + fldcw 90(%rsp) +..B1.81: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.82: + testl %r12d, %r12d + je ..B1.84 +..B1.83: + movl %r14d, %edi +..___tag_value_tgamma.97: + call fesetround@PLT +..___tag_value_tgamma.98: +..B1.84: + movsd (%rsp), %xmm0 + testb %r13b, %r13b + divsd %xmm0, %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.86 +..B1.85: + fldcw 90(%rsp) +..B1.86: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.87: + testl %r12d, %r12d + je ..B1.89 +..B1.88: + movl %r14d, %edi +..___tag_value_tgamma.119: + call fesetround@PLT +..___tag_value_tgamma.120: +..B1.89: + movsd (%rsp), %xmm0 + testb %r13b, %r13b + divsd %xmm0, %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.91 +..B1.90: + fldcw 90(%rsp) +..B1.91: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.92: + testl %r12d, %r12d + je ..B1.94 +..B1.93: + movl %r14d, %edi +..___tag_value_tgamma.141: + call fesetround@PLT +..___tag_value_tgamma.142: +..B1.94: + lea _large_value_64(%rip), %rax + testb %r13b, %r13b + movsd (%rax), %xmm0 + mulsd %xmm0, %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.96 +..B1.95: + fldcw 90(%rsp) +..B1.96: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.97: + testl %ecx, %ecx + jne ..B1.14 +..B1.98: + testl %r12d, %r12d + je ..B1.100 +..B1.99: + movl %r14d, %edi +..___tag_value_tgamma.163: + call fesetround@PLT +..___tag_value_tgamma.164: +..B1.100: + movl %ebx, %ebx + lea _large_value_64(%rip), %rax + testb %r13b, %r13b + movsd (%rax,%rbx,8), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.102 +..B1.101: + fldcw 90(%rsp) +..B1.102: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.103: + testl %r12d, %r12d + je ..B1.105 +..B1.104: + movl %r14d, %edi +..___tag_value_tgamma.185: + call fesetround@PLT +..___tag_value_tgamma.186: +..B1.105: + lea _ones(%rip), %rax + testb %r13b, %r13b + movsd (%rax,%rbx,8), %xmm0 + divsd (%rsp), %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.107 +..B1.106: + fldcw 90(%rsp) +..B1.107: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.108: + testl %r12d, %r12d + je ..B1.110 +..B1.109: + movl %r14d, %edi +..___tag_value_tgamma.207: + call fesetround@PLT +..___tag_value_tgamma.208: +..B1.110: + testl %ebx, %ebx + je ..B1.113 +..B1.111: + testl $1048575, 76(%rsp) + jne ..B1.113 +..B1.112: + cmpl $0, 72(%rsp) + je ..B1.116 +..B1.113: + lea _ones(%rip), %rax + testb %r13b, %r13b + movsd 72(%rsp), %xmm0 + mulsd (%rax), %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.115 +..B1.114: + fldcw 90(%rsp) +..B1.115: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 160 + .cfi_offset 3, -48 + .cfi_offset 6, -56 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 + .cfi_offset 15, -40 +..B1.116: + lea 8+_zeros(%rip), %rax + testb %r13b, %r13b + movsd (%rax), %xmm0 + divsd (%r15), %xmm0 + movsd %xmm0, 80(%rsp) + je ..B1.118 +..B1.117: + fldcw 90(%rsp) +..B1.118: + movsd 80(%rsp), %xmm0 + addq $104, %rsp + .cfi_def_cfa_offset 56 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 48 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 40 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type tgamma,@function + .size tgamma,.-tgamma + .data +# -- End tgamma + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.5: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0xc0672000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +.L_2il0floatpacket.1: + .long 0x00000000,0x40000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,8 + .align 8 +.L_2il0floatpacket.4: + .long 0x00000000,0xc0660000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_52H: + .long 0 + .long 1127743488 + .type _TWO_52H,@object + .size _TWO_52H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_small_value_64: + .long 0 + .long 24117248 + .long 0 + .long 2171600896 + .type _small_value_64,@object + .size _small_value_64,16 + .align 4 +_overflow_boundary: + .long 3848402504 + .long 1080390650 + .type _overflow_boundary,@object + .size _overflow_boundary,8 + .align 4 +_local_minimum: + .long 2371549438 + .long 1071483745 + .type _local_minimum,@object + .size _local_minimum,8 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 2 +_tgamma_sin_table: + .word 39192 + .word 38974 + .word 13074 + .word 53901 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 25233 + .word 24099 + .word 23041 + .word 53198 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 14010 + .word 1755 + .word 29241 + .word 50004 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 12661 + .word 39557 + .word 743 + .word 54836 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 23329 + .word 12349 + .word 46418 + .word 39360 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 43549 + .word 22984 + .word 36093 + .word 39843 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 50635 + .word 59140 + .word 19560 + .word 59922 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 39826 + .word 40176 + .word 51583 + .word 34788 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 63061 + .word 25910 + .word 60600 + .word 64252 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 21154 + .word 4399 + .word 17218 + .word 48316 + .word 16350 + .word 0 + .word 0 + .word 0 + .type _tgamma_sin_table,@object + .size _tgamma_sin_table,160 + .align 2 +_tgamma_A_table: + .word 44002 + .word 44608 + .word 34249 + .word 61198 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 28120 + .word 46089 + .word 18909 + .word 51744 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 6796 + .word 56365 + .word 948 + .word 39330 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 21872 + .word 3113 + .word 40348 + .word 48989 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 15275 + .word 60291 + .word 893 + .word 59613 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 41018 + .word 41834 + .word 14754 + .word 46766 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 10107 + .word 10320 + .word 24796 + .word 32841 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 40832 + .word 16832 + .word 38712 + .word 55795 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 8761 + .word 28554 + .word 35431 + .word 39961 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 12838 + .word 702 + .word 32174 + .word 51595 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 442 + .word 50835 + .word 62234 + .word 59850 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 53618 + .word 2208 + .word 54662 + .word 64445 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 33537 + .word 7687 + .word 12653 + .word 64976 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 5604 + .word 18060 + .word 46944 + .word 34352 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 5422 + .word 18393 + .word 57870 + .word 37869 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 27417 + .word 51069 + .word 14904 + .word 43119 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 16515 + .word 36952 + .word 46206 + .word 50255 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 22913 + .word 57796 + .word 61047 + .word 59491 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 55054 + .word 14521 + .word 23522 + .word 35521 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 3828 + .word 37429 + .word 19301 + .word 42457 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 18611 + .word 8353 + .word 56126 + .word 50041 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 63177 + .word 14708 + .word 18871 + .word 56010 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 51349 + .word 6910 + .word 18794 + .word 33038 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 59411 + .word 13918 + .word 30079 + .word 63615 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 40356 + .word 37493 + .word 20410 + .word 60584 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 59667 + .word 1960 + .word 42334 + .word 54496 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 24443 + .word 19594 + .word 17897 + .word 45291 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 24957 + .word 63432 + .word 54964 + .word 32848 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 7770 + .word 43625 + .word 45329 + .word 33905 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 34249 + .word 63845 + .word 17962 + .word 44463 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 49963 + .word 34728 + .word 51109 + .word 54055 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 57585 + .word 19701 + .word 6443 + .word 57077 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 61186 + .word 8282 + .word 25787 + .word 47837 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 26720 + .word 42621 + .word 41546 + .word 37680 + .word 49154 + .word 0 + .word 0 + .word 0 + .word 18366 + .word 28044 + .word 60147 + .word 62846 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 6968 + .word 10789 + .word 37601 + .word 32880 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 60700 + .word 57063 + .word 36736 + .word 35909 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 61862 + .word 56439 + .word 50993 + .word 40752 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 41843 + .word 39363 + .word 59360 + .word 47812 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 63511 + .word 43763 + .word 855 + .word 57724 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 64510 + .word 20731 + .word 32839 + .word 35752 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 60398 + .word 46667 + .word 43836 + .word 45454 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 49807 + .word 23281 + .word 46849 + .word 59658 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 37270 + .word 40485 + .word 38862 + .word 41131 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 55072 + .word 194 + .word 57504 + .word 62944 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 6484 + .word 60537 + .word 3975 + .word 55679 + .word 16389 + .word 0 + .word 0 + .word 0 + .word 11759 + .word 24340 + .word 39489 + .word 49925 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 22650 + .word 18020 + .word 56002 + .word 47553 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 65458 + .word 2450 + .word 7569 + .word 42768 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 2740 + .word 58538 + .word 8888 + .word 35477 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 24012 + .word 19369 + .word 10014 + .word 51050 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 32754 + .word 14555 + .word 56874 + .word 50646 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 6322 + .word 39288 + .word 8326 + .word 56228 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 51606 + .word 9409 + .word 56084 + .word 47341 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 19293 + .word 17746 + .word 29435 + .word 49011 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 22538 + .word 37169 + .word 56949 + .word 41021 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 65507 + .word 8897 + .word 64576 + .word 64934 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 21309 + .word 38834 + .word 44023 + .word 38745 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 52933 + .word 53016 + .word 24774 + .word 40865 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 4045 + .word 21262 + .word 61923 + .word 45295 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 26065 + .word 18177 + .word 3420 + .word 52438 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 45505 + .word 1968 + .word 16227 + .word 62949 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 1037 + .word 13974 + .word 10559 + .word 38924 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 39502 + .word 38026 + .word 65467 + .word 49371 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 34978 + .word 59813 + .word 17957 + .word 64181 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 4031 + .word 54789 + .word 33142 + .word 42976 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 2719 + .word 21031 + .word 60489 + .word 60330 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 20734 + .word 53765 + .word 40154 + .word 46919 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 63028 + .word 7231 + .word 17811 + .word 43725 + .word 16468 + .word 0 + .word 0 + .word 0 + .word 32606 + .word 48355 + .word 22399 + .word 43710 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 29042 + .word 46559 + .word 51950 + .word 41588 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 47396 + .word 18113 + .word 2918 + .word 37305 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 22233 + .word 40098 + .word 6225 + .word 61543 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 611 + .word 49379 + .word 57729 + .word 43678 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 10450 + .word 9675 + .word 56147 + .word 41083 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 37401 + .word 8271 + .word 47219 + .word 34504 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 34774 + .word 15943 + .word 11357 + .word 45081 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 6639 + .word 15692 + .word 42534 + .word 45536 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 51630 + .word 6378 + .word 12961 + .word 37818 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 59527 + .word 55742 + .word 41884 + .word 59714 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 15629 + .word 31501 + .word 45205 + .word 59448 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 53044 + .word 1871 + .word 3840 + .word 62990 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 49829 + .word 44544 + .word 39222 + .word 35206 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 8319 + .word 42513 + .word 20106 + .word 41214 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 56062 + .word 65309 + .word 8860 + .word 50097 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 39637 + .word 65 + .word 3840 + .word 62744 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 8819 + .word 49083 + .word 32007 + .word 40272 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 33763 + .word 5027 + .word 16250 + .word 52917 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 4751 + .word 2633 + .word 61342 + .word 35759 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 8844 + .word 54174 + .word 63762 + .word 50574 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 8334 + .word 8890 + .word 4484 + .word 39560 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 4811 + .word 30700 + .word 3620 + .word 48492 + .word 16556 + .word 0 + .word 0 + .word 0 + .word 24963 + .word 23772 + .word 56823 + .word 39936 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 33598 + .word 3946 + .word 44700 + .word 37958 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 46964 + .word 13072 + .word 50440 + .word 33963 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 60803 + .word 30641 + .word 14857 + .word 55738 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 54016 + .word 37905 + .word 6345 + .word 39067 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 52847 + .word 8984 + .word 26176 + .word 34926 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 36664 + .word 26865 + .word 35876 + .word 39170 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 52449 + .word 52544 + .word 53629 + .word 43890 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 12025 + .word 58412 + .word 44187 + .word 43481 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 31442 + .word 43543 + .word 55683 + .word 35857 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 3846 + .word 7199 + .word 40600 + .word 56439 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 59606 + .word 22885 + .word 19144 + .word 49661 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 40642 + .word 40248 + .word 11664 + .word 52797 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 62936 + .word 44294 + .word 39296 + .word 59383 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 2909 + .word 51304 + .word 40819 + .word 35037 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 28573 + .word 45780 + .word 52012 + .word 42966 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 18650 + .word 49015 + .word 44104 + .word 54288 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 55601 + .word 45035 + .word 39824 + .word 35129 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 34144 + .word 30699 + .word 57231 + .word 46486 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 46246 + .word 1151 + .word 17498 + .word 63193 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 4951 + .word 25890 + .word 61661 + .word 44882 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 6537 + .word 64648 + .word 46171 + .word 35209 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 3418 + .word 59105 + .word 44678 + .word 47100 + .word 16651 + .word 0 + .word 0 + .word 0 + .word 12496 + .word 39220 + .word 65358 + .word 37319 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 42985 + .word 15941 + .word 31416 + .word 35438 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 48809 + .word 58407 + .word 25474 + .word 63277 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 16086 + .word 46002 + .word 58617 + .word 51682 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 55157 + .word 44549 + .word 61270 + .word 35823 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 21856 + .word 27160 + .word 26283 + .word 61078 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 57421 + .word 61358 + .word 44892 + .word 42671 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 51328 + .word 61945 + .word 60158 + .word 43127 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 51733 + .word 1166 + .word 54323 + .word 42075 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 52270 + .word 46964 + .word 5686 + .word 34493 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 2083 + .word 1761 + .word 7136 + .word 54130 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 16904 + .word 37253 + .word 64186 + .word 43390 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 30519 + .word 46073 + .word 2795 + .word 46255 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 6923 + .word 13957 + .word 9241 + .word 52280 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 60036 + .word 4102 + .word 42534 + .word 62082 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 23471 + .word 7124 + .word 59867 + .word 38328 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 43652 + .word 58293 + .word 38720 + .word 48757 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 30217 + .word 2002 + .word 31515 + .word 63491 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 32079 + .word 61591 + .word 63175 + .word 42230 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 708 + .word 13247 + .word 38402 + .word 57649 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 48098 + .word 14626 + .word 62525 + .word 41069 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 41824 + .word 29269 + .word 27314 + .word 64550 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 61231 + .word 60847 + .word 45074 + .word 55796 + .word 16751 + .word 0 + .word 0 + .word 0 + .word 41222 + .word 6965 + .word 41751 + .word 35359 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 3873 + .word 17289 + .word 23432 + .word 33549 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 31267 + .word 5735 + .word 3862 + .word 59787 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 54508 + .word 24423 + .word 13439 + .word 48632 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 1373 + .word 13548 + .word 5598 + .word 33375 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 51134 + .word 47274 + .word 24966 + .word 54404 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 6577 + .word 45385 + .word 2362 + .word 45409 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 3828 + .word 42112 + .word 22766 + .word 42583 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 12956 + .word 14074 + .word 46709 + .word 41030 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 36968 + .word 52126 + .word 60443 + .word 33467 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 6923 + .word 15273 + .word 58034 + .word 52381 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 32660 + .word 35575 + .word 5652 + .word 38971 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58845 + .word 37118 + .word 55534 + .word 41636 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 18460 + .word 14335 + .word 18170 + .word 47252 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 64257 + .word 33925 + .word 29284 + .word 56405 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 4762 + .word 47478 + .word 23933 + .word 35021 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 60070 + .word 43233 + .word 33997 + .word 44796 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 15498 + .word 56159 + .word 37136 + .word 58624 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 45618 + .word 14567 + .word 62599 + .word 39157 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 56427 + .word 8703 + .word 58958 + .word 53630 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 17868 + .word 58209 + .word 63399 + .word 38294 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 23727 + .word 3602 + .word 56293 + .word 60260 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 11566 + .word 31203 + .word 21261 + .word 41104 + .word 16856 + .word 0 + .word 0 + .word 0 + .word 50659 + .word 54826 + .word 2447 + .word 33815 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 40123 + .word 27511 + .word 38472 + .word 64120 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 60369 + .word 44894 + .word 35604 + .word 57033 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 46499 + .word 27632 + .word 5436 + .word 46222 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 30082 + .word 48277 + .word 45112 + .word 62871 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 22164 + .word 19009 + .word 61576 + .word 49094 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 46565 + .word 37565 + .word 23059 + .word 47623 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 32180 + .word 46156 + .word 40449 + .word 42167 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 43791 + .word 4543 + .word 64119 + .word 40210 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 35508 + .word 36368 + .word 50300 + .word 65316 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 24682 + .word 25954 + .word 24264 + .word 50994 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 2360 + .word 57697 + .word 56537 + .word 35655 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 35000 + .word 46863 + .word 45329 + .word 38168 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 34434 + .word 1782 + .word 6514 + .word 43468 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 42662 + .word 49367 + .word 10572 + .word 52120 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 20865 + .word 43286 + .word 18750 + .word 65033 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 9813 + .word 41323 + .word 59938 + .word 41786 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 37980 + .word 55255 + .word 47419 + .word 54914 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 3267 + .word 59107 + .word 21702 + .word 36808 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 56442 + .word 35583 + .word 19842 + .word 50549 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 14786 + .word 14705 + .word 8555 + .word 36161 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 5861 + .word 33921 + .word 55110 + .word 56952 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 12507 + .word 56326 + .word 38818 + .word 47266 + .word 16964 + .word 0 + .word 0 + .word 0 + .word 3472 + .word 16935 + .word 53300 + .word 65107 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 37860 + .word 60441 + .word 22458 + .word 61688 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 12243 + .word 56252 + .word 28016 + .word 54783 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 4212 + .word 39051 + .word 42484 + .word 44250 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 23380 + .word 35543 + .word 1695 + .word 59694 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 16948 + .word 23513 + .word 25700 + .word 44731 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 46140 + .word 40761 + .word 17956 + .word 49463 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 31263 + .word 46633 + .word 29941 + .word 41835 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 63205 + .word 61824 + .word 34317 + .word 39543 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 2572 + .word 33857 + .word 17789 + .word 63992 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 34199 + .word 18923 + .word 17606 + .word 49855 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 56334 + .word 35260 + .word 24180 + .word 33058 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 60689 + .word 52750 + .word 35337 + .word 35448 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 55452 + .word 53681 + .word 28550 + .word 40494 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 52405 + .word 7414 + .word 26290 + .word 48744 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 27310 + .word 49480 + .word 17006 + .word 61076 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58002 + .word 7573 + .word 241 + .word 39403 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 30618 + .word 4587 + .word 23737 + .word 51968 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 41850 + .word 57331 + .word 43567 + .word 34937 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 44076 + .word 54284 + .word 21386 + .word 48090 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 47582 + .word 54033 + .word 55369 + .word 34454 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 6559 + .word 5249 + .word 7172 + .word 54302 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 25070 + .word 13550 + .word 42045 + .word 60321 + .word 17075 + .word 0 + .word 0 + .word 0 + .word 25751 + .word 29482 + .word 15881 + .word 62993 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 20424 + .word 12720 + .word 54361 + .word 59648 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 47709 + .word 29790 + .word 54671 + .word 52895 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 19590 + .word 27782 + .word 43363 + .word 42595 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 58921 + .word 35180 + .word 21269 + .word 57023 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30519 + .word 24253 + .word 59969 + .word 41055 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 16433 + .word 48540 + .word 61714 + .word 51024 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 28524 + .word 50460 + .word 14901 + .word 41561 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 3212 + .word 32692 + .word 57818 + .word 38984 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 39499 + .word 42357 + .word 61063 + .word 62879 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 23069 + .word 2532 + .word 8249 + .word 48896 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 10213 + .word 8193 + .word 57687 + .word 61912 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 54407 + .word 51976 + .word 21399 + .word 33245 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 30319 + .word 6795 + .word 56359 + .word 38081 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 56783 + .word 23918 + .word 44955 + .word 45999 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 48670 + .word 51841 + .word 19543 + .word 57851 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 40765 + .word 30890 + .word 33317 + .word 37455 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 26976 + .word 54195 + .word 64249 + .word 49555 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 53450 + .word 46734 + .word 58278 + .word 33402 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 16139 + .word 61138 + .word 10791 + .word 46069 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 19833 + .word 46025 + .word 1951 + .word 33050 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 63698 + .word 28854 + .word 16724 + .word 52116 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 51628 + .word 52030 + .word 9741 + .word 32928 + .word 17190 + .word 0 + .word 0 + .word 0 + .word 12285 + .word 10951 + .word 58642 + .word 61183 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 21683 + .word 21165 + .word 28859 + .word 57903 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 16106 + .word 65177 + .word 61473 + .word 51279 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 10066 + .word 60251 + .word 8712 + .word 41178 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 11765 + .word 63661 + .word 54012 + .word 54733 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 6745 + .word 52609 + .word 60525 + .word 37899 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 48001 + .word 64846 + .word 20212 + .word 52373 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 17748 + .word 43200 + .word 11817 + .word 41329 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 21018 + .word 45635 + .word 21983 + .word 38507 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 3148 + .word 52957 + .word 41657 + .word 61926 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 4827 + .word 784 + .word 31692 + .word 48072 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 34179 + .word 53889 + .word 29926 + .word 58425 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 50615 + .word 27492 + .word 10833 + .word 62832 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 38001 + .word 13025 + .word 51995 + .word 36075 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 57519 + .word 47991 + .word 3845 + .word 43713 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 52312 + .word 45573 + .word 61386 + .word 55158 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 13085 + .word 59531 + .word 16529 + .word 35826 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 20993 + .word 34790 + .word 57361 + .word 47533 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 9726 + .word 28278 + .word 20623 + .word 64228 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 29543 + .word 44397 + .word 26216 + .word 44369 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 63031 + .word 4436 + .word 65303 + .word 63733 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 3202 + .word 26777 + .word 12818 + .word 50273 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 59134 + .word 17584 + .word 37875 + .word 50102 + .word 17306 + .word 0 + .word 0 + .word 0 + .word 7773 + .word 6529 + .word 24897 + .word 59610 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 9176 + .word 34994 + .word 24066 + .word 56385 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 38670 + .word 17644 + .word 9278 + .word 49874 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 31722 + .word 46384 + .word 26212 + .word 39944 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 4438 + .word 35654 + .word 55200 + .word 52739 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 27356 + .word 43702 + .word 58298 + .word 35147 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 11597 + .word 6768 + .word 60887 + .word 53553 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 2200 + .word 56289 + .word 1997 + .word 41129 + .word 49151 + .word 0 + .word 0 + .word 0 + .word 51208 + .word 51045 + .word 15577 + .word 38092 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 64525 + .word 30741 + .word 24355 + .word 61096 + .word 49152 + .word 0 + .word 0 + .word 0 + .word 16273 + .word 9188 + .word 1200 + .word 47354 + .word 49153 + .word 0 + .word 0 + .word 0 + .word 32505 + .word 64701 + .word 51161 + .word 55474 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 58255 + .word 43751 + .word 28307 + .word 59734 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 597 + .word 44015 + .word 59274 + .word 34374 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 17221 + .word 11824 + .word 60854 + .word 41770 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 32240 + .word 33006 + .word 58370 + .word 52867 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 22765 + .word 17058 + .word 17899 + .word 34437 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 3694 + .word 59578 + .word 1196 + .word 45807 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 37424 + .word 8934 + .word 53804 + .word 62023 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 6800 + .word 58264 + .word 43923 + .word 42913 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 27007 + .word 15916 + .word 20851 + .word 61705 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 33570 + .word 44306 + .word 22975 + .word 48691 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _tgamma_A_table,@object + .size _tgamma_A_table,4416 + .space 192, 0x00 # pad + .align 2 +_tgamma_A176_inv: + .word 38655 + .word 8470 + .word 22633 + .word 47709 + .word 15340 + .word 0 + .word 0 + .word 0 + .type _tgamma_A176_inv,@object + .size _tgamma_A176_inv,16 + .align 2 +_tgamma_A150_table: + .word 61060 + .word 8155 + .word 61816 + .word 65535 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 47752 + .word 30749 + .word 4057 + .word 37827 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 24760 + .word 16820 + .word 52631 + .word 64803 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 36324 + .word 24890 + .word 11532 + .word 59368 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 63381 + .word 49585 + .word 20519 + .word 63827 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 54086 + .word 22318 + .word 4776 + .word 62483 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 24236 + .word 16506 + .word 21666 + .word 59746 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 44402 + .word 44414 + .word 37650 + .word 53079 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 34766 + .word 8695 + .word 24359 + .word 42592 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30542 + .word 64415 + .word 14059 + .word 59378 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 36037 + .word 62568 + .word 21045 + .word 34628 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 39650 + .word 28877 + .word 62299 + .word 64900 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 43413 + .word 4175 + .word 59877 + .word 46549 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 13603 + .word 64648 + .word 43425 + .word 47701 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 48047 + .word 22044 + .word 23868 + .word 61943 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 17548 + .word 29243 + .word 63955 + .word 38195 + .word 49138 + .word 0 + .word 0 + .word 0 + .type _tgamma_A150_table,@object + .size _tgamma_A150_table,256 + .align 2 +_tgamma_A125_table: + .word 29804 + .word 14935 + .word 58389 + .word 58038 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 54039 + .word 49353 + .word 64455 + .word 62712 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 7246 + .word 48092 + .word 40889 + .word 56162 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 5238 + .word 25576 + .word 20384 + .word 34263 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 38009 + .word 2645 + .word 35759 + .word 42176 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 32410 + .word 34387 + .word 48471 + .word 48379 + .word 49147 + .word 0 + .word 0 + .word 0 + .word 9060 + .word 33571 + .word 56968 + .word 36683 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 26873 + .word 9749 + .word 59107 + .word 49208 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 61297 + .word 63742 + .word 25286 + .word 34210 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 6011 + .word 50033 + .word 7349 + .word 46841 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 30597 + .word 45929 + .word 271 + .word 64276 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 60120 + .word 8046 + .word 54753 + .word 44175 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 32461 + .word 45691 + .word 56111 + .word 58214 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 38908 + .word 23877 + .word 33636 + .word 50495 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 35983 + .word 59115 + .word 59685 + .word 60013 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 38519 + .word 97 + .word 2340 + .word 53304 + .word 49143 + .word 0 + .word 0 + .word 0 + .type _tgamma_A125_table,@object + .size _tgamma_A125_table,256 + .align 2 +_tgamma_A100_table: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 50486 + .word 32176 + .word 26595 + .word 37828 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 33232 + .word 55464 + .word 50705 + .word 64818 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 56000 + .word 37024 + .word 35961 + .word 59472 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 6308 + .word 2395 + .word 34858 + .word 64338 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 22779 + .word 60710 + .word 1868 + .word 64356 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 33054 + .word 60854 + .word 741 + .word 65087 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 46387 + .word 11445 + .word 51950 + .word 65273 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 6735 + .word 17127 + .word 21437 + .word 65409 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 40596 + .word 22792 + .word 61241 + .word 65445 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 7521 + .word 26365 + .word 15230 + .word 65303 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 33891 + .word 37638 + .word 54039 + .word 64371 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 37411 + .word 53884 + .word 56799 + .word 60663 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 30408 + .word 30767 + .word 55068 + .word 50398 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 49794 + .word 38369 + .word 16703 + .word 62901 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 52540 + .word 1662 + .word 21259 + .word 41989 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _tgamma_A100_table,@object + .size _tgamma_A100_table,256 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tgammaf.S b/external/sgx_libm/intel64/tgammaf.S new file mode 100644 index 0000000000..542a1e6d4b --- /dev/null +++ b/external/sgx_libm/intel64/tgammaf.S @@ -0,0 +1,1280 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tgammaf.c" + .text +..TXTST0: +# -- Begin tgammaf + .text + .align 16,0x90 + .globl tgammaf +tgammaf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_tgammaf.1: +..L2: + + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r14 + .cfi_def_cfa_offset 32 + .cfi_offset 14, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $32, %rsp + .cfi_def_cfa_offset 80 + xorb %r12b, %r12b + pxor %xmm2, %xmm2 + pxor %xmm1, %xmm1 + movss %xmm0, 24(%rsp) + movd %xmm0, %r14d + movss %xmm1, (%rsp) + movsd %xmm2, 8(%rsp) +..___tag_value_tgammaf.14: + call fegetround@PLT +..___tag_value_tgammaf.15: +..B1.94: + movsd 8(%rsp), %xmm2 + movl %eax, %ebp +..B1.2: + testl %ebp, %ebp + je ..B1.4 +..B1.3: + xorl %edi, %edi + movb $1, %r12b + movsd %xmm2, 8(%rsp) +..___tag_value_tgammaf.16: + call fesetround@PLT +..___tag_value_tgammaf.17: +..B1.95: + movsd 8(%rsp), %xmm2 +..B1.4: + movzwl 26(%rsp), %eax + andl $32640, %eax + shrl $7, %eax + movl 24(%rsp), %ebx + shrl $31, %ebx + cmpl $255, %eax + je ..B1.84 +..B1.5: + movss 24(%rsp), %xmm5 + andl $2147483647, %r14d + movl %r14d, 8(%rsp) + ucomiss (%rsp), %xmm5 + jp ..B1.6 + je ..B1.81 +..B1.6: + cmpl $2097152, %r14d + jle ..B1.78 +..B1.7: + testl %ebx, %ebx + je ..B1.16 +..B1.8: + cmpl $150, %eax + jge ..B1.72 +..B1.9: + movss .L_2il0floatpacket.2(%rip), %xmm3 + movss 8(%rsp), %xmm4 + movaps %xmm3, %xmm1 + movss (%rsp), %xmm0 + addss %xmm4, %xmm1 + movss %xmm1, 20(%rsp) + movss %xmm0, 16(%rsp) + movss 20(%rsp), %xmm0 + movl 20(%rsp), %r14d + subss %xmm3, %xmm0 + comiss %xmm4, %xmm0 + jbe ..B1.11 +..B1.10: + incl %r14d + subss .L_2il0floatpacket.11(%rip), %xmm0 +..B1.11: + ucomiss %xmm0, %xmm4 + jp ..B1.12 + je ..B1.69 +..B1.12: + movss .L_2il0floatpacket.3(%rip), %xmm0 + comiss %xmm5, %xmm0 + jbe ..B1.17 +..B1.13: + testb %r12b, %r12b + je ..B1.15 +..B1.14: + movl %ebp, %edi +..___tag_value_tgammaf.18: + call fesetround@PLT +..___tag_value_tgammaf.19: +..B1.15: + lea _small_value_32(%rip), %rax + notl %r14d + andl $1, %r14d + movss (%rax,%r14,4), %xmm0 + mulss .L_2il0floatpacket.4(%rip), %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.16: + movss (%rsp), %xmm0 + movss %xmm0, 16(%rsp) +..B1.17: + cvtss2sd %xmm5, %xmm5 + lea _overflow_boundary(%rip), %rdx + comisd (%rdx), %xmm5 + jae ..B1.75 +..B1.18: + movss .L_2il0floatpacket.2(%rip), %xmm9 + testl %ebx, %ebx + je ..B1.20 +..B1.19: + movss 8(%rsp), %xmm8 + movaps %xmm9, %xmm2 + movaps %xmm8, %xmm1 + addss %xmm8, %xmm2 + movss %xmm2, 20(%rsp) + pxor %xmm2, %xmm2 + movss 20(%rsp), %xmm0 + lea 8+_tgamma_sin_table(%rip), %rcx + lea 24+_tgamma_sin_table(%rip), %r8 + subss %xmm9, %xmm0 + movsd (%rcx), %xmm7 + subss %xmm0, %xmm1 + movd %xmm1, %edx + lea 40+_tgamma_sin_table(%rip), %r10 + movsd (%r8), %xmm3 + andl $2147483647, %edx + lea _tgamma_sin_table(%rip), %rsi + movl %edx, (%rsp) + lea 56+_tgamma_sin_table(%rip), %r14 + movsd (%r10), %xmm4 + lea 16+_tgamma_sin_table(%rip), %r9 + lea 32+_tgamma_sin_table(%rip), %r11 + lea 48+_tgamma_sin_table(%rip), %rdx + cvtss2sd (%rsp), %xmm2 + movaps %xmm2, %xmm6 + mulsd %xmm2, %xmm6 + mulsd %xmm6, %xmm7 + addsd %xmm6, %xmm3 + addsd %xmm6, %xmm4 + mulsd %xmm6, %xmm3 + addsd (%rsi), %xmm7 + mulsd %xmm6, %xmm4 + mulsd %xmm6, %xmm7 + addsd (%r9), %xmm3 + addsd (%r11), %xmm4 + mulsd %xmm3, %xmm7 + movsd (%r14), %xmm5 + mulsd %xmm4, %xmm7 + addsd %xmm6, %xmm5 + mulsd %xmm5, %xmm6 + addsd (%rdx), %xmm6 + mulsd %xmm6, %xmm7 + mulsd %xmm2, %xmm7 + addsd %xmm7, %xmm2 + jmp ..B1.21 +..B1.20: + movss 8(%rsp), %xmm8 +..B1.21: + movaps %xmm8, %xmm1 + addss %xmm9, %xmm8 + movss %xmm8, 20(%rsp) + movss 20(%rsp), %xmm0 + movl 20(%rsp), %ecx + subss %xmm9, %xmm0 + andl $1048575, %ecx + comiss %xmm1, %xmm0 + jbe ..B1.23 +..B1.22: + decl %ecx + subss .L_2il0floatpacket.11(%rip), %xmm0 +..B1.23: + comiss .L_2il0floatpacket.5(%rip), %xmm1 + lea 1(%rcx), %r14d + jb ..B1.39 +..B1.24: + movaps %xmm1, %xmm3 + movl %ecx, %esi + andl $-8, %esi + movl %ecx, %edx + andl $7, %edx + cmpl $8, %ecx + movl %esi, %ecx + lea _tgamma_A_table(%rip), %r8 + subss %xmm0, %xmm3 + cvtss2sd %xmm3, %xmm3 + movaps %xmm3, %xmm8 + lea -2(%rdx), %eax + mulsd %xmm3, %xmm8 + cmovl %eax, %edx + sarl $1, %ecx + addl %esi, %ecx + sarl $3, %esi + addl %esi, %ecx + movslq %ecx, %rcx + testl %edx, %edx + movsd (%r8,%rcx,8), %xmm9 + mulsd %xmm3, %xmm9 + movsd 8(%r8,%rcx,8), %xmm0 + addsd %xmm8, %xmm9 + mulsd %xmm3, %xmm0 + addsd 48(%r8,%rcx,8), %xmm9 + addsd %xmm8, %xmm0 + mulsd 96(%r8,%rcx,8), %xmm9 + addsd 56(%r8,%rcx,8), %xmm0 + movsd 16(%r8,%rcx,8), %xmm4 + mulsd %xmm3, %xmm4 + mulsd %xmm0, %xmm9 + addsd %xmm8, %xmm4 + movsd 24(%r8,%rcx,8), %xmm5 + mulsd %xmm3, %xmm5 + addsd 64(%r8,%rcx,8), %xmm4 + movsd 32(%r8,%rcx,8), %xmm6 + addsd %xmm8, %xmm5 + mulsd %xmm3, %xmm6 + mulsd %xmm4, %xmm9 + addsd 72(%r8,%rcx,8), %xmm5 + addsd %xmm8, %xmm6 + mulsd %xmm5, %xmm9 + addsd 80(%r8,%rcx,8), %xmm6 + movsd 40(%r8,%rcx,8), %xmm7 + mulsd %xmm3, %xmm7 + mulsd %xmm6, %xmm9 + addsd %xmm7, %xmm8 + movsd .L_2il0floatpacket.10(%rip), %xmm3 + movsd %xmm3, 8(%rsp) + addsd 88(%r8,%rcx,8), %xmm8 + mulsd %xmm8, %xmm9 + movsd %xmm9, (%rsp) + je ..B1.29 +..B1.25: + movl $1, %eax + jle ..B1.29 +..B1.26: + pxor %xmm0, %xmm0 + cvtss2sd %xmm1, %xmm0 +..B1.27: + pxor %xmm4, %xmm4 + movaps %xmm0, %xmm5 + cvtsi2sd %eax, %xmm4 + incl %eax + subsd %xmm4, %xmm5 + mulsd %xmm5, %xmm3 + cmpl %edx, %eax + jle ..B1.27 +..B1.29: + testl %ebx, %ebx + je ..B1.35 +..B1.30: + cvtss2sd %xmm1, %xmm1 + mulsd %xmm2, %xmm1 + mulsd (%rsp), %xmm1 + mulsd %xmm3, %xmm1 + movsd 8(%rsp), %xmm0 + divsd %xmm1, %xmm0 + movss .L_2il0floatpacket.6(%rip), %xmm2 + movsd %xmm0, 8(%rsp) + comiss 24(%rsp), %xmm2 + jbe ..B1.32 +..B1.31: + lea _tgamma_A40_inv(%rip), %rax + mulsd (%rax), %xmm0 + movsd %xmm0, 8(%rsp) +..B1.32: + testb %r12b, %r12b + je ..B1.34 +..B1.33: + movl %ebp, %edi +..___tag_value_tgammaf.37: + call fesetround@PLT +..___tag_value_tgammaf.38: +..B1.34: + movsd 8(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movd %xmm0, %eax + shll $31, %r14d + xorl %r14d, %eax + movl %eax, 16(%rsp) + movss 16(%rsp), %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.35: + movsd (%rsp), %xmm0 + testb %r12b, %r12b + mulsd %xmm3, %xmm0 + movsd %xmm0, (%rsp) + je ..B1.37 +..B1.36: + movl %ebp, %edi +..___tag_value_tgammaf.56: + call fesetround@PLT +..___tag_value_tgammaf.57: +..B1.37: + movsd (%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 16(%rsp) +..B1.38: + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.39: + movss .L_2il0floatpacket.11(%rip), %xmm6 + pxor %xmm0, %xmm0 + cvtss2sd %xmm1, %xmm0 + comiss %xmm1, %xmm6 + jbe ..B1.41 +..B1.40: + movsd .L_2il0floatpacket.10(%rip), %xmm3 + addsd %xmm0, %xmm3 + jmp ..B1.42 +..B1.41: + movaps %xmm0, %xmm3 +..B1.42: + comisd .L_2il0floatpacket.7(%rip), %xmm3 + jb ..B1.44 +..B1.43: + lea _tgamma_A175_table(%rip), %r13 + subsd .L_2il0floatpacket.10(%rip), %xmm3 + cvtsd2ss %xmm3, %xmm3 + movss %xmm3, (%rsp) + jmp ..B1.50 +..B1.44: + comisd .L_2il0floatpacket.8(%rip), %xmm3 + jb ..B1.46 +..B1.45: + lea _tgamma_A150_table(%rip), %r13 + subsd .L_2il0floatpacket.10(%rip), %xmm3 + cvtsd2ss %xmm3, %xmm3 + movss %xmm3, (%rsp) + jmp ..B1.50 +..B1.46: + movsd .L_2il0floatpacket.9(%rip), %xmm4 + comisd %xmm4, %xmm3 + jb ..B1.48 +..B1.47: + lea _local_minimum(%rip), %rdx + lea _tgamma_A125_table(%rip), %r13 + movsd .L_2il0floatpacket.10(%rip), %xmm4 + addsd (%rdx), %xmm4 + subsd %xmm4, %xmm3 + cvtsd2ss %xmm3, %xmm3 + movss %xmm3, (%rsp) + jmp ..B1.50 +..B1.48: + comisd %xmm3, %xmm4 + jbe ..B1.50 +..B1.49: + lea _tgamma_A100_table(%rip), %r13 + subsd .L_2il0floatpacket.10(%rip), %xmm3 + cvtsd2ss %xmm3, %xmm3 + movss %xmm3, (%rsp) +..B1.50: + movsd (%r13), %xmm3 + testl %eax, %eax + movsd %xmm3, 8(%rsp) + je ..B1.53 +..B1.51: + pxor %xmm4, %xmm4 + cvtss2sd (%rsp), %xmm4 + movsd 56(%r13), %xmm3 + mulsd %xmm4, %xmm3 + movsd 8(%rsp), %xmm5 + addsd 48(%r13), %xmm3 + mulsd %xmm4, %xmm3 + addsd 40(%r13), %xmm3 + mulsd %xmm4, %xmm3 + addsd 32(%r13), %xmm3 + mulsd %xmm4, %xmm3 + addsd 24(%r13), %xmm3 + mulsd %xmm4, %xmm3 + addsd 16(%r13), %xmm3 + mulsd %xmm4, %xmm3 + addsd 8(%r13), %xmm3 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + movsd %xmm5, 8(%rsp) +..B1.53: + comiss %xmm1, %xmm6 + jbe ..B1.61 +..B1.54: + testl %ebx, %ebx + je ..B1.58 +..B1.55: + mulsd 8(%rsp), %xmm2 + testb %r12b, %r12b + movsd .L_2il0floatpacket.10(%rip), %xmm0 + divsd %xmm2, %xmm0 + movsd %xmm0, (%rsp) + je ..B1.57 +..B1.56: + movl %ebp, %edi +..___tag_value_tgammaf.75: + call fesetround@PLT +..___tag_value_tgammaf.76: +..B1.57: + movsd (%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movd %xmm0, %eax + shll $31, %r14d + xorl %r14d, %eax + movl %eax, 16(%rsp) + movss 16(%rsp), %xmm0 + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.58: + movsd 8(%rsp), %xmm1 + testb %r12b, %r12b + divsd %xmm0, %xmm1 + movsd %xmm1, 8(%rsp) + je ..B1.67 +..B1.59: + movl %ebp, %edi +..___tag_value_tgammaf.94: + call fesetround@PLT +..___tag_value_tgammaf.95: + jmp ..B1.67 +..B1.61: + testl %ebx, %ebx + je ..B1.65 +..B1.62: + mulsd %xmm0, %xmm2 + testb %r12b, %r12b + mulsd 8(%rsp), %xmm2 + movsd .L_2il0floatpacket.10(%rip), %xmm1 + divsd %xmm2, %xmm1 + movsd %xmm1, (%rsp) + je ..B1.64 +..B1.63: + movl %ebp, %edi +..___tag_value_tgammaf.96: + call fesetround@PLT +..___tag_value_tgammaf.97: +..B1.64: + movsd (%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.65: + testb %r12b, %r12b + je ..B1.67 +..B1.66: + movl %ebp, %edi +..___tag_value_tgammaf.115: + call fesetround@PLT +..___tag_value_tgammaf.116: +..B1.67: + movsd 8(%rsp), %xmm0 + cvtsd2ss %xmm0, %xmm0 + movss %xmm0, 16(%rsp) +..B1.68: + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.69: + testb %r12b, %r12b + je ..B1.71 +..B1.70: + movl %ebp, %edi +..___tag_value_tgammaf.134: + call fesetround@PLT +..___tag_value_tgammaf.135: +..B1.71: + movss (%rsp), %xmm0 + divss %xmm0, %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.72: + testb %r12b, %r12b + je ..B1.74 +..B1.73: + movl %ebp, %edi +..___tag_value_tgammaf.153: + call fesetround@PLT +..___tag_value_tgammaf.154: +..B1.74: + movss (%rsp), %xmm0 + divss %xmm0, %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.75: + testb %r12b, %r12b + je ..B1.77 +..B1.76: + movl %ebp, %edi +..___tag_value_tgammaf.172: + call fesetround@PLT +..___tag_value_tgammaf.173: +..B1.77: + movl $1904214016, 20(%rsp) + movss 20(%rsp), %xmm1 + movss 20(%rsp), %xmm0 + mulss %xmm0, %xmm1 + movss %xmm1, 20(%rsp) + movss 20(%rsp), %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.78: + movss (%rsp), %xmm0 + testb %r12b, %r12b + movss %xmm0, 16(%rsp) + je ..B1.80 +..B1.79: + movl %ebp, %edi +..___tag_value_tgammaf.191: + call fesetround@PLT +..___tag_value_tgammaf.192: +..B1.80: + movl %ebx, %ebx + lea _large_value_32(%rip), %rax + movl (%rax,%rbx,4), %edx + movl %edx, 20(%rsp) + movss 20(%rsp), %xmm0 + mulss .L_2il0floatpacket.0(%rip), %xmm0 + movss %xmm0, 20(%rsp) + movss 20(%rsp), %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.81: + testb %r12b, %r12b + je ..B1.83 +..B1.82: + movl %ebp, %edi +..___tag_value_tgammaf.210: + call fesetround@PLT +..___tag_value_tgammaf.211: +..B1.83: + lea _ones(%rip), %rax + movss (%rax,%rbx,4), %xmm0 + divss (%rsp), %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.84: + testb %r12b, %r12b + je ..B1.86 +..B1.85: + movl %ebp, %edi +..___tag_value_tgammaf.229: + call fesetround@PLT +..___tag_value_tgammaf.230: +..B1.86: + testl %ebx, %ebx + je ..B1.89 +..B1.87: + testl $8388607, 24(%rsp) + je ..B1.91 +..B1.89: + movss (%rsp), %xmm0 + movss %xmm0, 16(%rsp) + movl %r14d, 8(%rsp) +..B1.90: + movl 24(%rsp), %eax + movl %eax, 20(%rsp) + movss 20(%rsp), %xmm1 + movss 20(%rsp), %xmm0 + addss %xmm0, %xmm1 + movss %xmm1, 20(%rsp) + movss 20(%rsp), %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 80 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 12, -16 + .cfi_offset 13, -24 + .cfi_offset 14, -32 +..B1.91: + movss .L_2il0floatpacket.1(%rip), %xmm0 + divss (%rsp), %xmm0 + movss %xmm0, 16(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 24 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 16 + .cfi_restore 12 + popq %r12 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type tgammaf,@function + .size tgammaf,.-tgammaf + .data +# -- End tgammaf + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.7: + .long 0x00000000,0x3ffc0000 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,8 + .align 8 +.L_2il0floatpacket.8: + .long 0x00000000,0x3ff80000 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,8 + .align 8 +.L_2il0floatpacket.9: + .long 0x00000000,0x3ff40000 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,8 + .align 8 +.L_2il0floatpacket.10: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,8 + .align 4 +.L_2il0floatpacket.0: + .long 0x71800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x80000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +.L_2il0floatpacket.2: + .long 0x4b400000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,4 + .align 4 +.L_2il0floatpacket.3: + .long 0xc22c0000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,4 + .align 4 +.L_2il0floatpacket.4: + .long 0x0d800000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,4 + .align 4 +.L_2il0floatpacket.5: + .long 0x40000000 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,4 + .align 4 +.L_2il0floatpacket.6: + .long 0xc2200000 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,4 + .align 4 +.L_2il0floatpacket.11: + .long 0x3f800000 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,4 + .align 4 +_small_value_32: + .long 226492416 + .long 2373976064 + .type _small_value_32,@object + .size _small_value_32,8 + .align 4 +_overflow_boundary: + .long 0 + .long 1078035746 + .type _overflow_boundary,@object + .size _overflow_boundary,8 + .align 4 +_tgamma_sin_table: + .long 1980114658 + .long 3200337074 + .long 804494867 + .long 1049689241 + .long 2884431818 + .long 1079329239 + .long 930502348 + .long 3223780109 + .long 1245824743 + .long 1080878479 + .long 2510431012 + .long 1073721695 + .long 1661126174 + .long 1078219640 + .long 1205599443 + .long 3223573914 + .type _tgamma_sin_table,@object + .size _tgamma_sin_table,64 + .align 4 +_tgamma_A_table: + .long 3121394612 + .long 1074393041 + .long 2029996066 + .long 1073722195 + .long 4137005464 + .long 1071238760 + .long 3372276227 + .long 3220751114 + .long 68401302 + .long 3222286887 + .long 1275947047 + .long 3223263002 + .long 4031994882 + .long 1074665426 + .long 1089993416 + .long 1074817170 + .long 427005612 + .long 1075089294 + .long 1508975772 + .long 1075601433 + .long 2111623053 + .long 1076192020 + .long 75538972 + .long 1077100653 + .long 2171869559 + .long 1055005400 + .long 2919987515 + .long 1074143787 + .long 860307162 + .long 1073890599 + .long 2407232453 + .long 1073038722 + .long 1468490975 + .long 3216757264 + .long 846192051 + .long 3221294835 + .long 402234383 + .long 3222573752 + .long 2566208764 + .long 1073763360 + .long 162360449 + .long 1073949715 + .long 1512348533 + .long 1074371728 + .long 2920174397 + .long 1074968946 + .long 3785085665 + .long 1075671857 + .long 1922428759 + .long 1076496000 + .long 2446382284 + .long 1072101083 + .long 42366358 + .long 1073746704 + .long 3587290866 + .long 1073390434 + .long 1169958761 + .long 1072607731 + .long 3891474799 + .long 3217275878 + .long 1452792685 + .long 3221010072 + .long 1006385979 + .long 3222363118 + .long 3663632771 + .long 1072778759 + .long 3212960448 + .long 1073036150 + .long 2202365811 + .long 1073636095 + .long 2023822532 + .long 1074258740 + .long 40477660 + .long 1075053854 + .long 658935515 + .long 1076010306 + .long 932572503 + .long 1105834679 + .long 1233355998 + .long 1073412029 + .long 3033646034 + .long 1073097432 + .long 3149182759 + .long 1072206908 + .long 1726027606 + .long 3217766868 + .long 3439348786 + .long 3220880557 + .long 2080997065 + .long 3222253033 + .long 843307201 + .long 1072200111 + .long 3138702878 + .long 1072613342 + .long 3610734718 + .long 1073142430 + .long 2651617324 + .long 1073914526 + .long 2611481547 + .long 1074796471 + .long 3284459136 + .long 1075745821 + .long 1365755587 + .long 1144167771 + .long 2699624028 + .long 1073212595 + .long 2232824171 + .long 1072922970 + .long 3659224963 + .long 1071959670 + .long 3026238542 + .long 3218100813 + .long 4240441539 + .long 3220810712 + .long 1772362075 + .long 3222132889 + .long 3742687744 + .long 1071863890 + .long 56227394 + .long 1072220001 + .long 969667939 + .long 1072882737 + .long 880059910 + .long 1073714908 + .long 247554419 + .long 1074515829 + .long 48918556 + .long 1075495246 + .long 2601377264 + .long 1185936586 + .long 3625529495 + .long 1073077476 + .long 3298250746 + .long 1072804056 + .long 2971501690 + .long 1071788510 + .long 2950162741 + .long 3218231788 + .long 26528490 + .long 3220765509 + .long 3761284804 + .long 3222050392 + .long 3800626879 + .long 1071658634 + .long 1108715276 + .long 1071977390 + .long 286829382 + .long 1072720005 + .long 3141975933 + .long 1073477575 + .long 4145290123 + .long 1074329952 + .long 2167683451 + .long 1075329952 + .long 0 + .long 1072693248 + .type _tgamma_A_table,@object + .size _tgamma_A_table,624 + .align 4 +_tgamma_A40_inv: + .long 3988571200 + .long 914969834 + .type _tgamma_A40_inv,@object + .size _tgamma_A40_inv,8 + .align 4 +_tgamma_A175_table: + .long 1682645026 + .long 1072688670 + .long 3753006229 + .long 3219243438 + .long 177700005 + .long 1072453288 + .long 3289039035 + .long 3219374666 + .long 2492560830 + .long 1071326765 + .long 123078934 + .long 3217486055 + .long 3499570675 + .long 1068068407 + .long 1362583934 + .long 3212265128 + .type _tgamma_A175_table,@object + .size _tgamma_A175_table,64 + .align 4 +_tgamma_A150_table: + .long 988281800 + .long 1072692321 + .long 502740408 + .long 3219277207 + .long 2058512241 + .long 1072588117 + .long 2109547492 + .long 3219675970 + .long 3371209031 + .long 1071892748 + .long 3191518250 + .long 3218447665 + .long 3816909947 + .long 1069498883 + .long 1366906983 + .long 3214177035 + .type _tgamma_A150_table,@object + .size _tgamma_A150_table,64 + .align 4 +_local_minimum: + .long 2371549438 + .long 1071483745 + .type _local_minimum,@object + .size _local_minimum,8 + .align 4 +_tgamma_A125_table: + .long 2191760034 + .long 1072453340 + .long 2642694891 + .long 3186525859 + .long 1706815263 + .long 1071344724 + .long 1896485049 + .long 3217079006 + .long 441733475 + .long 1069848224 + .long 978611902 + .long 3216500728 + .long 351495825 + .long 1068442485 + .long 1680249708 + .long 3216253219 + .type _tgamma_A125_table,@object + .size _tgamma_A125_table,64 + .align 4 +_tgamma_A100_table: + .long 4293468318 + .long 1072693247 + .long 3444857508 + .long 3219290252 + .long 3510931740 + .long 1072670280 + .long 3644082616 + .long 3219982336 + .long 2685454907 + .long 1072646231 + .long 4151446349 + .long 3220059936 + .long 4004008463 + .long 1072263166 + .long 1217534056 + .long 3218706582 + .type _tgamma_A100_table,@object + .size _tgamma_A100_table,64 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/tgammal.S b/external/sgx_libm/intel64/tgammal.S new file mode 100644 index 0000000000..5153d99b22 --- /dev/null +++ b/external/sgx_libm/intel64/tgammal.S @@ -0,0 +1,4186 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "tgammal.c" + .text +..TXTST0: +# -- Begin tgammal + .text + .align 16,0x90 + .globl tgammal +tgammal: +# parameter 1: 368 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_tgammal.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + pushq %rbx + .cfi_def_cfa_offset 40 + .cfi_offset 3, -40 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + subq $320, %rsp + .cfi_def_cfa_offset 368 + xorb %bpl, %bpl + fldt 368(%rsp) + xorb %r14b, %r14b + movq %fs:40, %rax + xorq %rsp, %rax + movq %rax, 304(%rsp) + fstpt 240(%rsp) +..B1.2: + fnstcw 258(%rsp) +..B1.3: + movzwl 258(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.7 +..B1.4: + orl $-64768, %edx + movw %dx, 256(%rsp) +..B1.5: + fldcw 256(%rsp) +..B1.6: + movb $1, %r14b +..B1.7: +..___tag_value_tgammal.14: + call fegetround@PLT +..___tag_value_tgammal.15: +..B1.195: + movl %eax, %r13d +..B1.8: + testl %r13d, %r13d + je ..B1.10 +..B1.9: + xorl %edi, %edi + movb $1, %bpl +..___tag_value_tgammal.16: + call fesetround@PLT +..___tag_value_tgammal.17: +..B1.10: + movl 376(%rsp), %ebx + movzwl 376(%rsp), %ecx + shrl $15, %ebx + andl $32767, %ecx + andl $1, %ebx + cmpl $32767, %ecx + je ..B1.178 +..B1.11: + fldt 368(%rsp) + lea _zeros(%rip), %rax + andl $32767, 248(%rsp) + fldl (%rax) + movsd (%rax), %xmm0 + fstpt 224(%rsp) + fldt 224(%rsp) + fucomip %st(1), %st + jp ..B1.12 + je ..B1.171 +..B1.12: + testl %ebx, %ebx + je ..B1.24 +..B1.13: + cmpl $16446, %ecx + jge ..B1.142 +..B1.14: + fldt 240(%rsp) + lea _TWO_63H(%rip), %rax + fld %st(0) + fldl (%rax) + fadd %st, %st(1) + fxch %st(1) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(1) + movl 112(%rsp), %r15d + fcomi %st(1), %st + jbe ..B1.16 +..B1.15: + lea _ones(%rip), %rax + incl %r15d + fsubl (%rax) +..B1.16: + fucomip %st(1), %st + fstp %st(0) + jp ..B1.17 + je ..B1.135 +..B1.17: + fldt .L_2il0floatpacket.0(%rip) + fcomip %st(1), %st + jbe ..B1.24 +..B1.18: + fstp %st(0) + testb %bpl, %bpl + je ..B1.20 +..B1.19: + movl %r13d, %edi +..___tag_value_tgammal.18: + call fesetround@PLT +..___tag_value_tgammal.19: +..B1.20: + notl %r15d + lea _small_value_80(%rip), %rax + andl $1, %r15d + shlq $4, %r15 + fldt (%rax) + testb %r14b, %r14b + fldt (%rax,%r15) + fmulp %st, %st(1) + fstpt 64(%rsp) + je ..B1.22 +..B1.21: + fldcw 258(%rsp) +..B1.22: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.23: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.24: + lea _POS_OVERFLOW(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + fstp %st(0) + jp ..B1.25 + jb ..B1.164 +..B1.25: + testl %ecx, %ecx + jne ..B1.28 +..B1.26: + cmpl $536870912, 372(%rsp) + jb ..B1.149 +..B1.27: + movq $0x2000000000000000, %rax + cmpq 368(%rsp), %rax + je ..B1.149 +..B1.28: + fldt 240(%rsp) + fldz + fstpt 144(%rsp) + fldt 144(%rsp) + fld %st(0) + fstpt 128(%rsp) + fldt 128(%rsp) + testl %ebx, %ebx + fxch %st(2) + fstpt 176(%rsp) + fldt 176(%rsp) + fstpt 208(%rsp) + fldt 208(%rsp) + fxch %st(2) + fstpt 192(%rsp) + fldt 192(%rsp) + fldt 224(%rsp) + fstpt 160(%rsp) + fldt 160(%rsp) + je ..B1.32 +..B1.29: + fstp %st(1) + lea _TWO_63H(%rip), %rax + cmpl $16299, %ecx + fldl (%rax) + jle ..B1.31 +..B1.30: + fldt .L_2il0floatpacket.1(%rip) + lea _TWO_53H(%rip), %rax + fxch %st(3) + fstps 96(%rsp) + fld %st(3) + lea 96+_tgammal_S(%rip), %rdx + fadd %st(1), %st + lea 80+_tgammal_S(%rip), %rsi + fsub %st(1), %st + lea 64+_tgammal_S(%rip), %r8 + fsubr %st(4), %st + fstpt 80(%rsp) + lea 48+_tgammal_S(%rip), %r9 + andl $32767, 88(%rsp) + lea 32+_tgammal_S(%rip), %r10 + fstpt 48(%rsp) + lea 16+_tgammal_S(%rip), %r11 + fstpt (%rsp) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt 80(%rsp) + fmul %st, %st(2) + fld %st(0) + fsub %st(3), %st + fchs + fsubrp %st, %st(3) + fld %st(2) + fld %st(1) + fsub %st(4), %st + fmul %st, %st(1) + fld %st(2) + fmul %st(3), %st + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fld %st(4) + fmul %st(5), %st + fxch %st(3) + fstpt 16(%rsp) + fld %st(2) + fldl (%rax) + lea _tgammal_S(%rip), %rax + fld %st(0) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fld %st(4) + fmul %st(1), %st + fld %st(5) + fadd %st(1), %st + fsubp %st, %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fsubrp %st, %st(5) + fxch %st(4) + fstpt 160(%rsp) + fldt (%rdx) + fmul %st(1), %st + fldt (%rsi) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r8) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r9) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r10) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%r11) + faddp %st, %st(1) + fmul %st(1), %st + fldt (%rax) + lea _tgammal_S2(%rip), %rax + faddp %st, %st(1) + fmulp %st, %st(1) + fldl (%rax) + lea 8+_tgammal_S2(%rip), %rax + fld %st(0) + fmul %st(4), %st + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + faddl (%rax) + fld %st(0) + lea 8+_tgammal_S1(%rip), %rax + fmul %st(4), %st + faddp %st, %st(3) + fmul %st(4), %st + faddp %st, %st(2) + fldl (%rax) + fld %st(0) + lea _tgammal_S1(%rip), %rax + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fldl (%rax) + fld %st(0) + lea _ones(%rip), %rax + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(5) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fld %st(1) + fmul %st(4), %st + fxch %st(4) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fld %st(2) + fldl (%rax) + fld %st(0) + fadd %st(4), %st + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fmul %st(7), %st + fmul %st, %st(6) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fmul %st, %st(4) + fldt 16(%rsp) + fld %st(0) + fmulp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fadd %st(2), %st + fsubp %st, %st(2) + fld %st(1) + fxch %st(2) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(2) + fld %st(3) + fxch %st(2) + fstpt 192(%rsp) + fldt 192(%rsp) + fldt 176(%rsp) + fmul %st, %st(4) + fxch %st(4) + fstpt 128(%rsp) + fxch %st(3) + fmulp %st, %st(2) + fldt 160(%rsp) + fmul %st, %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 144(%rsp) + fldt (%rsp) + fldt 48(%rsp) + flds 96(%rsp) + fldt 64(%rsp) + fxch %st(4) + fxch %st(2) + fxch %st(3) + fxch %st(1) + fxch %st(3) + jmp ..B1.33 +..B1.31: + fldt 208(%rsp) + fstpt 192(%rsp) + fldt 224(%rsp) + fstpt 128(%rsp) + fldt 128(%rsp) + fstpt 144(%rsp) + fldt 144(%rsp) + fxch %st(1) + jmp ..B1.33 +..B1.32: + lea _TWO_63H(%rip), %rax + fldl (%rax) +..B1.33: + fldt .L_2il0floatpacket.2(%rip) + fcomip %st(5), %st + jp ..B1.34 + jbe ..B1.95 +..B1.34: + fld %st(4) + fadd %st(1), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(1) + movl 112(%rsp), %edx + fcomi %st(4), %st + jbe ..B1.36 +..B1.35: + lea _ones(%rip), %rax + decl %edx + fsubl (%rax) +..B1.36: + cmpl $2, %edx + lea 1(%rdx), %r15d + jl ..B1.41 +..B1.37: + fstp %st(3) + testb $1, %dl + je ..B1.39 +..B1.38: + lea _ones(%rip), %rax + lea -1(%rdx), %r9d + fldl (%rax) + fsubr %st, %st(4) + fxch %st(4) + fstpt 208(%rsp) + fxch %st(3) + fsubrp %st, %st(2) + jmp ..B1.40 +..B1.39: + fstp %st(3) + movl %edx, %r9d +..B1.40: + fldt .L_2il0floatpacket.3(%rip) + addl $-2, %r9d + sarl $1, %r9d + lea _tgammal_T2(%rip), %rsi + movl %r9d, %eax + faddp %st, %st(2) + fldt 208(%rsp) + lea (,%r9,8), %r8d + shll $4, %eax + lea _tgammal_A2(%rip), %r10 + subl %r9d, %eax + lea (%r8,%r9,4), %r9d + movslq %eax, %rax + fsubp %st, %st(2) + shlq $4, %rax + movslq %r9d, %r9 + addq %rsi, %rax + lea (%r10,%r9,8), %rsi + fxch %st(2) + fxch %st(1) + fxch %st(2) + jmp ..B1.55 +..B1.41: + fstp %st(0) + fldt .L_2il0floatpacket.4(%rip) + fcomip %st(4), %st + jbe ..B1.43 +..B1.42: + movl $3, %r9d + jmp ..B1.54 +..B1.43: + fldt .L_2il0floatpacket.6(%rip) + fcomip %st(4), %st + jbe ..B1.45 +..B1.44: + xorl %r9d, %r9d + jmp ..B1.54 +..B1.45: + fldt .L_2il0floatpacket.7(%rip) + fcomip %st(4), %st + jbe ..B1.47 +..B1.46: + fldt .L_2il0floatpacket.3(%rip) + movl $1, %r9d + fsubrp %st, %st(4) + jmp ..B1.54 +..B1.47: + fldt .L_2il0floatpacket.8(%rip) + fcomip %st(4), %st + jbe ..B1.49 +..B1.48: + lea _ones(%rip), %rax + movl $2, %r9d + fldl (%rax) + fsubp %st, %st(4) + jmp ..B1.54 +..B1.49: + fldt .L_2il0floatpacket.9(%rip) + fcomip %st(4), %st + jbe ..B1.51 +..B1.50: + lea _ones(%rip), %rax + xorl %r9d, %r9d + fxch %st(3) + fsubl (%rax) + fxch %st(3) + jmp ..B1.54 +..B1.51: + fldt .L_2il0floatpacket.10(%rip) + fcomip %st(4), %st + jbe ..B1.53 +..B1.52: + fldt .L_2il0floatpacket.11(%rip) + movl $1, %r9d + fsubrp %st, %st(4) + jmp ..B1.54 +..B1.53: + fldt .L_2il0floatpacket.5(%rip) + movl $2, %r9d + fsubp %st, %st(4) +..B1.54: + movl %r9d, %eax + lea _tgammal_T1(%rip), %rsi + shll $4, %eax + lea (,%r9,8), %r8d + subl %r9d, %eax + lea (%r8,%r9,4), %r9d + lea _tgammal_A1(%rip), %r10 + shlq $4, %rax + fxch %st(2) + fstpt 208(%rsp) + addq %rsi, %rax + lea (%r10,%r9,8), %rsi +..B1.55: + cmpl $16299, %ecx + jle ..B1.61 +..B1.56: + fstp %st(1) + fldt 224(%rax) + testb $1, %dl + fmul %st(2), %st + fldt 208(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 192(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 176(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 160(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 144(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 128(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 112(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 96(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 80(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 64(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 48(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 32(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fldt 16(%rax) + faddp %st, %st(1) + fmul %st(2), %st + fld %st(2) + fldt (%rax) + faddp %st, %st(2) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(4) + fsub %st(2), %st + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(3), %st + fxch %st(2) + fsubr %st, %st(4) + fmul %st(1), %st + fld %st(1) + fmul %st(5), %st + fxch %st(4) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(4) + faddp %st, %st(3) + fldl 88(%rsi) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(4) + faddp %st, %st(3) + faddp %st, %st(2) + fldl 80(%rsi) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fld %st(1) + fmul %st(4), %st + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(1) + fmul %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldl 72(%rsi) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + fldl 64(%rsi) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + fld %st(2) + fmul %st(4), %st + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(4) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(3) + fldl 56(%rsi) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + fld %st(3) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + faddp %st, %st(1) + fldl 48(%rsi) + fld %st(0) + fadd %st(4), %st + fsubr %st, %st(1) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fld %st(2) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(3) + fxch %st(1) + faddp %st, %st(3) + fld %st(1) + fmul %st(3), %st + fld %st(1) + fmul %st(5), %st + fxch %st(4) + fmul %st(5), %st + faddp %st, %st(1) + fxch %st(1) + fmul %st(2), %st + faddp %st, %st(1) + fldl 40(%rsi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(4), %st + fsubr %st, %st(4) + fxch %st(2) + faddp %st, %st(4) + faddp %st, %st(3) + fldl 32(%rsi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(3) + fld %st(2) + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(2), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(2) + fmul %st(2), %st + fxch %st(2) + fmul %st(5), %st + faddp %st, %st(2) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldl 24(%rsi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + faddp %st, %st(2) + fldl 16(%rsi) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(2), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(5), %st + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(4) + fld %st(3) + fmulp %st, %st(1) + faddp %st, %st(4) + fxch %st(2) + fmulp %st, %st(1) + faddp %st, %st(2) + fldl 8(%rsi) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(3) + fxch %st(1) + fadd %st, %st(3) + fsubrp %st, %st(2) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fldl (%rsi) + fld %st(0) + fadd %st(3), %st + fsubr %st, %st(1) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fstpt 96(%rsp) + fldt 96(%rsp) + fsubrp %st, %st(2) + faddp %st, %st(1) + fldt 16(%rsp) + je ..B1.59 +..B1.57: + cmpl $1, %edx + jle ..B1.59 +..B1.58: + fstp %st(0) + fstp %st(1) + fldt .L_2il0floatpacket.1(%rip) + fldt .L_2il0floatpacket.1(%rip) + fldt 96(%rsp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(4) + fld %st(3) + fldt 208(%rsp) + fmul %st, %st(3) + fld %st(0) + fadd %st(4), %st + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(4) + fxch %st(3) + fmul %st, %st(5) + fsubr %st, %st(3) + fxch %st(1) + fmul %st(3), %st + fxch %st(3) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fadd %st, %st(3) + fxch %st(2) + fmulp %st, %st(1) + fstpt 96(%rsp) + jmp ..B1.63 +..B1.59: + fstpt 112(%rsp) + fxch %st(1) + jmp ..B1.62 +..B1.61: + lea _ones(%rip), %rax + fldl (%rax) + fstpt 96(%rsp) +..B1.62: + testl %edx, %edx + jle ..B1.76 +..B1.63: + fstp %st(0) + testl %ebx, %ebx + jne ..B1.70 +..B1.64: + testb %bpl, %bpl + je ..B1.66 +..B1.65: + movl %r13d, %edi + fstpt (%rsp) + fstpt 64(%rsp) +..___tag_value_tgammal.37: + call fesetround@PLT +..___tag_value_tgammal.38: +..B1.206: + fldt 64(%rsp) + fldt (%rsp) +..B1.66: + fldt 96(%rsp) + testb %r14b, %r14b + faddp %st, %st(1) + fstpt 64(%rsp) + je ..B1.212 +..B1.67: + fstpt 80(%rsp) +..B1.196: + fldcw 258(%rsp) + jmp ..B1.68 +..B1.212: + fstp %st(0) +..B1.68: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.69: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.70: + fldt .L_2il0floatpacket.1(%rip) + lea _ones(%rip), %rax + fldt .L_2il0floatpacket.1(%rip) + testb %bpl, %bpl + fldt 128(%rsp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fsub %st(2), %st + fldt 144(%rsp) + faddp %st, %st(1) + fldt 96(%rsp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fld %st(2) + fmul %st(4), %st + fxch %st(1) + fsub %st(3), %st + faddp %st, %st(5) + fld %st(4) + fmul %st(2), %st + fxch %st(4) + fmulp %st, %st(5) + fxch %st(4) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + fld %st(0) + fadd %st(2), %st + fld %st(2) + fxch %st(1) + fdivrl (%rax) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(6), %st + fadd %st, %st(4) + fsubrp %st, %st(4) + fxch %st(3) + fsubr %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fxch %st(2) + fmul %st(4), %st + fld %st(2) + fmul %st(4), %st + fxch %st(3) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + fldt .L_2il0floatpacket.5(%rip) + fsub %st(2), %st + fldt .L_2il0floatpacket.5(%rip) + fsub %st(1), %st + fsubp %st, %st(3) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubp %st, %st(1) + fstpt 272(%rsp) + fldt 272(%rsp) + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 288(%rsp) + fldt 288(%rsp) + fld %st(3) + fmul %st(2), %st + fstpt 16(%rsp) + fld %st(2) + fmul %st(1), %st + fxch %st(1) + fmulp %st, %st(4) + faddp %st, %st(3) + fmulp %st, %st(1) + faddp %st, %st(1) + je ..B1.72 +..B1.71: + movl %r13d, %edi + fstpt (%rsp) + fstpt 64(%rsp) +..___tag_value_tgammal.56: + call fesetround@PLT +..___tag_value_tgammal.57: +..B1.205: + fldt 64(%rsp) + fldt (%rsp) +..B1.72: + fldt 16(%rsp) + andl $1, %r15d + shll $15, %r15d + faddp %st, %st(1) + fstpt 64(%rsp) + xorl %r15d, 72(%rsp) + testb %r14b, %r14b + je ..B1.213 +..B1.73: + fldt 48(%rsp) + fstpt 112(%rsp) + fstpt 80(%rsp) +..B1.197: + fldcw 258(%rsp) + jmp ..B1.74 +..B1.213: + fstp %st(0) +..B1.74: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.75: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.76: + lea _ones(%rip), %rax + testl %ebx, %ebx + fldl (%rax) + fstpt (%rsp) + jne ..B1.86 +..B1.77: + fstp %st(0) + fldt 176(%rsp) + cmpl $100, %ecx + fldt 160(%rsp) + faddp %st, %st(1) + jge ..B1.79 +..B1.78: + fstp %st(1) + fldt (%rsp) + fdivp %st, %st(1) + fldt 96(%rsp) + fmulp %st, %st(1) + fstpt 96(%rsp) + jmp ..B1.80 +..B1.79: + fldt (%rsp) + fdivp %st, %st(1) + fxch %st(2) + fstpt 64(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(2), %st + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(1) + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fldt .L_2il0floatpacket.1(%rip) + fldt 176(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fsubr %st, %st(1) + fmul %st(5), %st + fld %st(5) + fldt 160(%rsp) + faddp %st, %st(3) + fmul %st(2), %st + fxch %st(2) + fmul %st(3), %st + faddp %st, %st(2) + faddp %st, %st(1) + fldt .L_2il0floatpacket.5(%rip) + fsub %st(3), %st + fldt .L_2il0floatpacket.5(%rip) + fsub %st(1), %st + fsubp %st, %st(4) + fxch %st(1) + fsubrp %st, %st(3) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(4) + faddp %st, %st(2) + fld %st(5) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(5), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fmul %st, %st(6) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(2) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(1) + faddp %st, %st(5) + fxch %st(1) + fstpt 288(%rsp) + fld %st(0) + fxch %st(2) + fstpt 272(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fldt 96(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fsub %st(1), %st + faddp %st, %st(4) + fld %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(4) + fxch %st(4) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(4) + fxch %st(3) + fmul %st, %st(4) + fsubr %st, %st(2) + fxch %st(5) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(2) + fld %st(1) + fmulp %st, %st(5) + fxch %st(4) + fstpt 96(%rsp) + fmulp %st, %st(3) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 224(%rsp) + fldt 64(%rsp) +..B1.80: + testb %bpl, %bpl + je ..B1.82 +..B1.81: + movl %r13d, %edi + fstpt 64(%rsp) +..___tag_value_tgammal.75: + call fesetround@PLT +..___tag_value_tgammal.76: +..B1.208: + fldt 64(%rsp) +..B1.82: + fldt 224(%rsp) + testb %r14b, %r14b + fldt 96(%rsp) + faddp %st, %st(1) + fstpt 64(%rsp) + je ..B1.214 +..B1.83: + fstpt 80(%rsp) +..B1.198: + fldcw 258(%rsp) + jmp ..B1.84 +..B1.214: + fstp %st(0) +..B1.84: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.85: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.86: + cmpl $100, %ecx + jge ..B1.88 +..B1.87: + fstp %st(0) + fldt 192(%rsp) + fldt 96(%rsp) + fmulp %st, %st(1) + faddp %st, %st(1) + fldt (%rsp) + fdivp %st, %st(1) + fstpt (%rsp) + jmp ..B1.89 +..B1.88: + fldt .L_2il0floatpacket.1(%rip) + fldt .L_2il0floatpacket.1(%rip) + fldt 96(%rsp) + fmul %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsubp %st, %st(3) + fsub %st(2), %st + faddp %st, %st(4) + fldt 192(%rsp) + fmul %st, %st(1) + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(2) + fsub %st(1), %st + faddp %st, %st(3) + fld %st(3) + fmul %st(3), %st + fld %st(2) + fmul %st(2), %st + fxch %st(4) + fmulp %st, %st(3) + faddp %st, %st(2) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fldt (%rsp) + fdivp %st, %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(1) + fld %st(0) + fsubrp %st, %st(2) + fld %st(1) + fld %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(5), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fsubr %st, %st(4) + fxch %st(4) + faddp %st, %st(5) + fmul %st(4), %st + fld %st(1) + fmul %st(4), %st + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + faddp %st, %st(1) + fxch %st(2) + fmul %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fldt .L_2il0floatpacket.5(%rip) + fsub %st(1), %st + fldt .L_2il0floatpacket.5(%rip) + fsub %st(1), %st + fsubp %st, %st(2) + fxch %st(2) + fsubrp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(3) + fxch %st(2) + faddp %st, %st(3) + fld %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(2) + fxch %st(2) + fstpt 112(%rsp) + fldt 112(%rsp) + fsubp %st, %st(2) + fxch %st(1) + fmul %st, %st(4) + fsubr %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmul %st(1), %st + fld %st(4) + fmul %st(3), %st + fstpt (%rsp) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt 224(%rsp) + fstpt 272(%rsp) + fstpt 288(%rsp) +..B1.89: + testb %bpl, %bpl + je ..B1.91 +..B1.90: + movl %r13d, %edi + fstpt 64(%rsp) +..___tag_value_tgammal.94: + call fesetround@PLT +..___tag_value_tgammal.95: +..B1.207: + fldt 64(%rsp) +..B1.91: + fldt 224(%rsp) + andl $1, %r15d + fldt (%rsp) + shll $15, %r15d + faddp %st, %st(1) + fstpt 64(%rsp) + xorl %r15d, 72(%rsp) + testb %r14b, %r14b + je ..B1.215 +..B1.92: + fstpt 80(%rsp) +..B1.199: + fldcw 258(%rsp) + jmp ..B1.93 +..B1.215: + fstp %st(0) +..B1.93: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.94: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.95: + fstp %st(1) + fstp %st(1) + fstp %st(1) + lea _ones(%rip), %rax + fld %st(1) + fldl (%rax) + fdiv %st, %st(1) + fld %st(1) + fmul %st(2), %st + fstpt (%rsp) + fstpl 80(%rsp) + addq $-32, %rsp + .cfi_def_cfa_offset 400 + lea 224(%rsp), %rdi + fxch %st(2) + fstpt (%rsp) + fldt 32(%rdi) + fstpt 16(%rsp) + fxch %st(1) + fstpt 48(%rsp) + fstpt 80(%rsp) +..___tag_value_tgammal.114: + call __libm_logl_k80@PLT +..___tag_value_tgammal.115: +..B1.200: + fstp %st(0) + fldt 80(%rsp) + fldt 48(%rsp) + addq $32, %rsp + .cfi_def_cfa_offset 368 +..B1.96: + fldt .L_2il0floatpacket.3(%rip) + lea 56+_tgammal_B(%rip), %rax + fxch %st(2) + fstpt 48(%rsp) + lea 48+_tgammal_B(%rip), %rdx + fldt (%rsp) + lea 40+_tgammal_B(%rip), %rcx + fldt 192(%rsp) + lea 32+_tgammal_B(%rip), %rsi + fldl (%rax) + lea 24+_tgammal_B(%rip), %r8 + fmul %st(2), %st + lea 16+_tgammal_B(%rip), %r9 + fldt .L_2il0floatpacket.1(%rip) + lea 8+_tgammal_B(%rip), %r10 + lea _tgammal_B(%rip), %r11 + lea _tgammal_B0(%rip), %rdi + lea 8+_tgammal_C(%rip), %rax + testl %ebx, %ebx + fxch %st(1) + faddl (%rdx) + lea _tgammal_C(%rip), %rdx + fmul %st(3), %st + fldt (%rdi) + fxch %st(1) + faddl (%rcx) + fmul %st(4), %st + faddl (%rsi) + fmul %st(4), %st + faddl (%r8) + fmul %st(4), %st + faddl (%r9) + fmul %st(4), %st + faddl (%r10) + fmul %st(4), %st + faddl (%r11) + fmulp %st, %st(4) + faddp %st, %st(3) + fxch %st(2) + fmulp %st, %st(3) + fld %st(0) + fldt 240(%rsp) + fsub %st, %st(5) + fxch %st(3) + fmul %st(5), %st + fld %st(5) + fadd %st(1), %st + fsubp %st, %st(1) + fsubr %st, %st(5) + fxch %st(3) + fchs + fldt 208(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(4), %st + fadd %st, %st(3) + fxch %st(3) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(3) + fxch %st(2) + fstpt 192(%rsp) + fldt 192(%rsp) + fld %st(4) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(4) + fxch %st(3) + faddp %st, %st(4) + fxch %st(3) + fmul %st, %st(4) + fld %st(6) + fmul %st(1), %st + faddp %st, %st(5) + fxch %st(2) + fmulp %st, %st(6) + fxch %st(5) + faddp %st, %st(3) + fstpt 208(%rsp) + fld %st(3) + fadd %st(2), %st + fld %st(0) + fadd %st(2), %st + fsub %st, %st(2) + fxch %st(2) + fchs + fadd %st(1), %st + fxch %st(1) + fsubrp %st, %st(5) + fxch %st(2) + faddp %st, %st(4) + fxch %st(1) + faddp %st, %st(3) + fld %st(0) + fadd %st(3), %st + fld %st(0) + fxch %st(1) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(4) + fld %st(3) + fadd %st(3), %st + fadd %st, %st(1) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fchs + fadd %st(1), %st + fxch %st(1) + fsubrp %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldl (%rax) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fldl (%rdx) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + faddp %st, %st(2) + fld %st(0) + fadd %st(3), %st + fsub %st, %st(3) + fxch %st(3) + fchs + faddp %st, %st(1) + faddp %st, %st(1) + fld %st(1) + fadd %st(1), %st + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fldt 48(%rsp) + jne ..B1.108 +..B1.97: + fxch %st(1) + fstpt 288(%rsp) + lea 160(%rsp), %rdi + fxch %st(1) + fstpt 112(%rdi) + lea 272(%rsp), %rsi + fstpt -112(%rdi) +..___tag_value_tgammal.117: + call __libm_expl_k80@PLT +..___tag_value_tgammal.118: +..B1.201: + fldt 48(%rsp) +..B1.98: + testb %bpl, %bpl + fxch %st(1) + je ..B1.101 +..B1.99: + movl %r13d, %edi + fstpt (%rsp) + fstpt 48(%rsp) +..___tag_value_tgammal.119: + call fesetround@PLT +..___tag_value_tgammal.120: +..B1.100: + fldt 48(%rsp) + fldt (%rsp) +..B1.101: + fldt 160(%rsp) + fxch %st(1) + faddp %st, %st(2) + fxch %st(1) + fstpt (%rsp) + fldt 176(%rsp) + movl (%rsp), %edx + cmpl $16383, %edx + faddp %st, %st(1) + fldl 80(%rsp) + fstpt (%rsp) + jg ..B1.103 +..B1.102: + addl $16383, %edx + movzwl 8(%rsp), %eax + andl $32767, %edx + andl $-32768, %eax + orl %edx, %eax + movw %ax, 8(%rsp) + fldt (%rsp) + fmulp %st, %st(1) + jmp ..B1.104 +..B1.103: + lea _TWO_POW_16383(%rip), %rax + andl $32767, %edx + movzwl 8(%rsp), %ecx + andl $-32768, %ecx + orl %edx, %ecx + fldt (%rax) + fmulp %st, %st(1) + movw %cx, 8(%rsp) + fldt (%rsp) + fmulp %st, %st(1) +..B1.104: + fstpt 64(%rsp) + testb %r14b, %r14b + je ..B1.106 +..B1.105: + fldt 16(%rsp) + fstpt 112(%rsp) +..B1.202: + fldcw 258(%rsp) +..B1.106: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.107: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.108: + fxch %st(2) + fchs + lea 160(%rsp), %rdi + fstpt 112(%rdi) + lea 272(%rsp), %rsi + fchs + incl %r15d + fstpt 16(%rsi) + fstpt -112(%rdi) +..___tag_value_tgammal.138: + call __libm_expl_k80@PLT +..___tag_value_tgammal.139: +..B1.203: + fldt 48(%rsp) +..B1.109: + fldt 128(%rsp) + fld %st(0) + fld %st(1) + fxch %st(4) + faddp %st, %st(3) + fxch %st(2) + fstpt (%rsp) + fldt 144(%rsp) + movl (%rsp), %eax + fadd %st, %st(2) + fxch %st(2) + fdivrl 80(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(1), %st + fld %st(0) + fadd %st(2), %st + fsubp %st, %st(1) + fsubr %st, %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(5) + fsubrp %st, %st(5) + fxch %st(2) + fsub %st(4), %st + faddp %st, %st(3) + fld %st(2) + fmul %st(1), %st + fld %st(4) + fmul %st(3), %st + fxch %st(3) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fxch %st(1) + fmul %st, %st(4) + fxch %st(4) + faddp %st, %st(1) + fldt .L_2il0floatpacket.5(%rip) + fsub %st(2), %st + fldt .L_2il0floatpacket.5(%rip) + fsub %st(1), %st + fsubp %st, %st(3) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(0) + fadd %st(2), %st + fsubr %st, %st(1) + fxch %st(2) + faddp %st, %st(1) + fld %st(1) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(1) + fsubrp %st, %st(1) + fstpt 272(%rsp) + fldt 272(%rsp) + fld %st(3) + fmul %st(1), %st + fxch %st(1) + fsubr %st, %st(3) + fxch %st(3) + faddp %st, %st(2) + fxch %st(1) + fmul %st, %st(3) + fld %st(4) + fmul %st(1), %st + faddp %st, %st(4) + fstpt 288(%rsp) + fxch %st(1) + fmulp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fldt 160(%rsp) + fld %st(0) + fldt 176(%rsp) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(3), %st + fadd %st, %st(2) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 160(%rsp) + fldt 160(%rsp) + fsubr %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fstpt 176(%rsp) + fldt 176(%rsp) + fld %st(3) + fldt .L_2il0floatpacket.1(%rip) + fmul %st(5), %st + fadd %st, %st(1) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubp %st, %st(1) + fld %st(0) + fmul %st(3), %st + fxch %st(1) + fsubr %st, %st(5) + fxch %st(4) + faddp %st, %st(5) + fld %st(4) + fmul %st(2), %st + fxch %st(2) + fmulp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fxch %st(1) + fmulp %st, %st(3) + faddp %st, %st(2) + fld %st(1) + fadd %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + movzwl 72(%rsp), %edx + andl $32767, %edx + lea -1(%rax,%rdx), %ecx + cmpl $32765, %ecx + lea (%rax,%rdx), %ebx + ja ..B1.115 +..B1.110: + fstp %st(1) + fstp %st(1) + fldl 80(%rsp) + lea 16382(%rax), %edx + fstpt (%rsp) + cmpl $32765, %edx + ja ..B1.112 +..B1.111: + addl $16383, %eax + movzwl 8(%rsp), %edx + andl $32767, %eax + andl $-32768, %edx + orl %eax, %edx + movw %dx, 8(%rsp) + fldt (%rsp) + fmulp %st, %st(1) + fstpt 64(%rsp) + jmp ..B1.128 +..B1.112: + cmpl $16383, %eax + jle ..B1.114 +..B1.113: + lea _TWO_POW_16383(%rip), %rdx + andl $32767, %eax + movzwl 8(%rsp), %ecx + andl $-32768, %ecx + orl %eax, %ecx + fldt (%rdx) + fmulp %st, %st(1) + movw %cx, 8(%rsp) + fldt (%rsp) + fmulp %st, %st(1) + fstpt 64(%rsp) + jmp ..B1.128 +..B1.114: + lea _TWO_POW_M16382(%rip), %rdx + addl $32765, %eax + movzwl 8(%rsp), %ecx + andl $32767, %eax + andl $-32768, %ecx + orl %eax, %ecx + fldt (%rdx) + fmulp %st, %st(1) + movw %cx, 8(%rsp) + fldt (%rsp) + fmulp %st, %st(1) + fstpt 64(%rsp) + jmp ..B1.128 +..B1.115: + fstp %st(0) + cmpl $32766, %ebx + jle ..B1.117 +..B1.116: + fstp %st(0) + fstp %st(0) + lea _TWO_POW_16383(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 64(%rsp) + jmp ..B1.128 +..B1.117: + cmpl $-65, %ebx + jg ..B1.119 +..B1.118: + fstp %st(0) + fstp %st(0) + lea _TWO_POW_M16382(%rip), %rax + fldt (%rax) + fmul %st(0), %st + fstpt 64(%rsp) + jmp ..B1.128 +..B1.119: + fldl 80(%rsp) + cmpl $-16382, %eax + fstpt (%rsp) + jl ..B1.124 +..B1.120: + addl $16383, %eax + fld %st(0) + movzwl 8(%rsp), %edx + andl $32767, %eax + andl $-32768, %edx + orl %eax, %edx + lea _TWO_53H(%rip), %rax + movw %dx, 8(%rsp) + testb %bpl, %bpl + fldt (%rsp) + fldl (%rax) + fmul %st(3), %st + fsub %st, %st(2) + fxch %st(2) + fstpt 48(%rsp) + fldt 48(%rsp) + fsubrp %st, %st(2) + fxch %st(1) + fsub %st, %st(2) + fxch %st(2) + fchs + faddp %st, %st(3) + fmul %st, %st(2) + fmulp %st, %st(1) + fstpt 16(%rsp) + je ..B1.123 +..B1.121: + movl %r13d, %edi + fstpt (%rsp) +..___tag_value_tgammal.140: + call fesetround@PLT +..___tag_value_tgammal.141: +..B1.122: + fldt (%rsp) + xorb %bpl, %bpl +..B1.123: + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 64(%rsp) + jmp ..B1.128 +..B1.124: + lea _TWO_POW_M16000(%rip), %rcx + negl %eax + addl $-15999, %eax + lea _TWO_32H(%rip), %rsi + movzwl 8(%rsp), %edx + andl $32767, %eax + andl $-32768, %edx + lea _small_value_80(%rip), %rbx + fldt (%rcx) + orl %eax, %edx + fmul %st, %st(1) + lea _TWO_32HP(%rip), %rax + fld %st(1) + testb %bpl, %bpl + fxch %st(1) + fmulp %st, %st(3) + movw %dx, 8(%rsp) + fadd %st(2), %st + fldl (%rax) + fldt (%rbx) + fmul %st(0), %st + fstpt 32(%rsp) + fldt (%rsp) + fadd %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fxch %st(2) + fmull (%rsi) + fsubrp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fsubp %st, %st(1) + fsubrp %st, %st(1) + faddp %st, %st(1) + je ..B1.127 +..B1.125: + movl %r13d, %edi + fstpt (%rsp) +..___tag_value_tgammal.142: + call fesetround@PLT +..___tag_value_tgammal.143: +..B1.126: + fldt (%rsp) + xorb %bpl, %bpl +..B1.127: + fldt 16(%rsp) + faddp %st, %st(1) + fstpt 64(%rsp) + movzwl 72(%rsp), %eax + andl $-32768, %eax + andl $2147483647, 68(%rsp) + movw %ax, 72(%rsp) +..B1.128: + andl $1, %r15d + shll $15, %r15d + xorl %r15d, 72(%rsp) + testb %bpl, %bpl + je ..B1.130 +..B1.129: + movl %r13d, %edi +..___tag_value_tgammal.144: + call fesetround@PLT +..___tag_value_tgammal.145: +..B1.130: + testb %r14b, %r14b + je ..B1.132 +..B1.131: + fldt 48(%rsp) + fstpt 112(%rsp) +..B1.204: + fldcw 258(%rsp) +..B1.132: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.133: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.134: + fstp %st(0) + call __stack_chk_fail@PLT +..B1.135: + fstp %st(0) + testb %bpl, %bpl + je ..B1.137 +..B1.136: + movl %r13d, %edi + movsd %xmm0, (%rsp) +..___tag_value_tgammal.163: + call fesetround@PLT +..___tag_value_tgammal.164: +..B1.211: + movsd (%rsp), %xmm0 +..B1.137: + divsd %xmm0, %xmm0 + movsd %xmm0, (%rsp) + testb %r14b, %r14b + fldl (%rsp) + fstpt 64(%rsp) + je ..B1.139 +..B1.138: + fldcw 258(%rsp) +..B1.139: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 + jmp ..B1.23 +..B1.142: + fstp %st(0) + testb %bpl, %bpl + je ..B1.144 +..B1.143: + movl %r13d, %edi + movsd %xmm0, (%rsp) +..___tag_value_tgammal.165: + call fesetround@PLT +..___tag_value_tgammal.166: +..B1.210: + movsd (%rsp), %xmm0 +..B1.144: + divsd %xmm0, %xmm0 + movsd %xmm0, (%rsp) + testb %r14b, %r14b + fldl (%rsp) + fstpt 64(%rsp) + je ..B1.146 +..B1.145: + fldcw 258(%rsp) +..B1.146: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 + jmp ..B1.23 +..B1.149: + testb %bpl, %bpl + je ..B1.151 +..B1.150: + movl %r13d, %edi +..___tag_value_tgammal.167: + call fesetround@PLT +..___tag_value_tgammal.168: +..B1.151: + movl %ebx, %eax + lea _large_value_80(%rip), %rdx + shlq $4, %rax + testl %ebx, %ebx + fldt (%rdx) + fldt (%rdx,%rax) + fmulp %st, %st(1) + fstpt 64(%rsp) + je ..B1.153 +..B1.152: + shll $15, %ebx + orl %ebx, 72(%rsp) +..B1.153: + testb %r14b, %r14b + je ..B1.155 +..B1.154: + fldcw 258(%rsp) +..B1.155: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 + jmp ..B1.23 +..B1.164: + testb %bpl, %bpl + je ..B1.166 +..B1.165: + movl %r13d, %edi +..___tag_value_tgammal.169: + call fesetround@PLT +..___tag_value_tgammal.170: +..B1.166: + lea _large_value_80(%rip), %rax + testb %r14b, %r14b + fldt (%rax) + fmul %st(0), %st + fstpt 64(%rsp) + je ..B1.168 +..B1.167: + fldcw 258(%rsp) +..B1.168: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 + jmp ..B1.23 +..B1.171: + fstp %st(0) + testb %bpl, %bpl + je ..B1.173 +..B1.172: + movl %r13d, %edi + movsd %xmm0, (%rsp) +..___tag_value_tgammal.171: + call fesetround@PLT +..___tag_value_tgammal.172: +..B1.209: + movsd (%rsp), %xmm0 +..B1.173: + lea _ones(%rip), %rax + testb %r14b, %r14b + movsd (%rax,%rbx,8), %xmm1 + divsd %xmm0, %xmm1 + movsd %xmm1, (%rsp) + fldl (%rsp) + fstpt 64(%rsp) + je ..B1.175 +..B1.174: + fldcw 258(%rsp) +..B1.175: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 + jmp ..B1.23 +..B1.178: + testl %ebx, %ebx + je ..B1.181 +..B1.179: + cmpl $-2147483648, 372(%rsp) + jne ..B1.181 +..B1.180: + cmpl $0, 368(%rsp) + je ..B1.187 +..B1.181: + fldt 368(%rsp) + lea _ones(%rip), %rax + testb %r14b, %r14b + fmull (%rax) + fstpt 64(%rsp) + je ..B1.183 +..B1.182: + fldcw 258(%rsp) +..B1.183: + testb %bpl, %bpl + je ..B1.185 +..B1.184: + movl %r13d, %edi +..___tag_value_tgammal.173: + call fesetround@PLT +..___tag_value_tgammal.174: +..B1.185: + fldt 64(%rsp) + movq 304(%rsp), %rax + xorq %rsp, %rax + cmpq %fs:40, %rax + jne ..B1.134 +..B1.186: + addq $320, %rsp + .cfi_def_cfa_offset 48 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 40 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 368 + .cfi_offset 3, -40 + .cfi_offset 6, -48 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.187: + testb %bpl, %bpl + je ..B1.189 +..B1.188: + movl %r13d, %edi +..___tag_value_tgammal.192: + call fesetround@PLT +..___tag_value_tgammal.193: +..B1.189: + lea 8+_zeros(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + divsd (%rdx), %xmm0 + movsd %xmm0, (%rsp) + fldl (%rsp) + fstpt 64(%rsp) + fldt 64(%rsp) + movq 304(%rsp), %rcx + xorq %rsp, %rcx + cmpq %fs:40, %rcx + jne ..B1.134 + jmp ..B1.23 + .align 16,0x90 + .cfi_endproc + .type tgammal,@function + .size tgammal,.-tgammal + .data +# -- End tgammal + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.0: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xdc,0x09,0xc0,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,16 + .align 16 +.L_2il0floatpacket.1: + .byte 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 16 +.L_2il0floatpacket.2: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd0,0x02,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfc,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 16 +.L_2il0floatpacket.5: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.5,@object + .size .L_2il0floatpacket.5,16 + .align 16 +.L_2il0floatpacket.6: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xfd,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.6,@object + .size .L_2il0floatpacket.6,16 + .align 16 +.L_2il0floatpacket.7: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xfe,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.7,@object + .size .L_2il0floatpacket.7,16 + .align 16 +.L_2il0floatpacket.8: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.8,@object + .size .L_2il0floatpacket.8,16 + .align 16 +.L_2il0floatpacket.9: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.9,@object + .size .L_2il0floatpacket.9,16 + .align 16 +.L_2il0floatpacket.10: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.10,@object + .size .L_2il0floatpacket.10,16 + .align 16 +.L_2il0floatpacket.11: + .byte 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00 + .type .L_2il0floatpacket.11,@object + .size .L_2il0floatpacket.11,16 + .align 16 +_TWO_53H: + .long 0 + .long 1128792064 + .type _TWO_53H,@object + .size _TWO_53H,8 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_TWO_63H: + .long 0 + .long 1139277824 + .type _TWO_63H,@object + .size _TWO_63H,8 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_tgammal_S2: + .long 1076610156 + .long 1072298443 + .long 2174450924 + .long 1012377779 + .type _tgammal_S2,@object + .size _tgammal_S2,16 + .align 4 +_tgammal_S1: + .long 1649608659 + .long 3220853158 + .long 544854255 + .long 3162597952 + .type _tgammal_S1,@object + .size _tgammal_S1,16 + .align 4 +_tgammal_A2: + .long 1833415567 + .long 1073038586 + .long 2552883231 + .long 1018148522 + .long 1595568275 + .long 1072556376 + .long 458238143 + .long 1015211580 + .long 3568820252 + .long 1071968804 + .long 1244365593 + .long 1010337025 + .long 799339768 + .long 1070612333 + .long 3666663601 + .long 1014637144 + .long 2303274075 + .long 1069290379 + .long 1349342802 + .long 1013375288 + .long 3297989586 + .long 1067256475 + .long 254004781 + .long 1007721194 + .long 3884346469 + .long 1076314993 + .long 442477728 + .long 1020223370 + .long 318512670 + .long 1076897708 + .long 471158811 + .long 1020359281 + .long 2510778168 + .long 1076450444 + .long 1901825555 + .long 1020381374 + .long 1635478559 + .long 1075598710 + .long 824259222 + .long 1018719588 + .long 1081324001 + .long 1074338163 + .long 3447625061 + .long 1017363587 + .long 3947156014 + .long 1072861090 + .long 1379190805 + .long 1015115048 + .long 420607958 + .long 1081212458 + .long 3477976495 + .long 1025491940 + .long 3806068795 + .long 1082138936 + .long 4217379562 + .long 1025598832 + .long 3604563515 + .long 1082026571 + .long 2373575058 + .long 1026208390 + .long 2007420787 + .long 1081336307 + .long 1677630540 + .long 1025930127 + .long 1505609351 + .long 1080304853 + .long 3680187356 + .long 1024342399 + .long 1798798240 + .long 1079036631 + .long 724429118 + .long 1022004699 + .long 573661072 + .long 1087072564 + .long 1175535566 + .long 1031320119 + .long 3742832273 + .long 1088193077 + .long 2163102943 + .long 1030481607 + .long 1347160184 + .long 1088323961 + .long 872134502 + .long 1032553403 + .long 3527047012 + .long 1087786342 + .long 974187100 + .long 1028831099 + .long 1718309677 + .long 1086914107 + .long 744179587 + .long 1031128181 + .long 2775103229 + .long 1085724862 + .long 1153587355 + .long 1029745229 + .long 1670522313 + .long 1093749470 + .long 3603089619 + .long 1038783597 + .long 2795800948 + .long 1094969738 + .long 1113103030 + .long 1039749901 + .long 3483985892 + .long 1095195750 + .long 707212107 + .long 1037942235 + .long 3634938287 + .long 1094882573 + .long 3822913920 + .long 1039689416 + .long 1233016495 + .long 1094091821 + .long 3838048750 + .long 1037461559 + .long 817468048 + .long 1093018536 + .long 360059332 + .long 1037856380 + .long 3404619429 + .long 1101025312 + .long 2324006265 + .long 1046266629 + .long 1757595371 + .long 1102333247 + .long 3317464771 + .long 1041601336 + .long 2951620935 + .long 1102677785 + .long 2114793479 + .long 1046829217 + .long 1356962213 + .long 1102426961 + .long 3236647680 + .long 1046257529 + .long 378361594 + .long 1101790815 + .long 2326245451 + .long 1045004339 + .long 704627613 + .long 1100821691 + .long 771850637 + .long 1043974839 + .type _tgammal_A2,@object + .size _tgammal_A2,576 + .align 4 +_tgammal_A1: + .long 4294967295 + .long 1072693247 + .long 4294254158 + .long 1017118719 + .long 4235179544 + .long 3219290252 + .long 1647137719 + .long 3164508998 + .long 3258652024 + .long 1072670296 + .long 2787078119 + .long 1015928435 + .long 2402437986 + .long 3219982865 + .long 3119239167 + .long 3164440263 + .long 89167536 + .long 1072654929 + .long 3734368228 + .long 1015667286 + .long 3963139337 + .long 3220139136 + .long 2050876349 + .long 3162686202 + .long 2444554090 + .long 1072454648 + .long 2100370444 + .long 1016394631 + .long 2397397425 + .long 1067486888 + .long 3603318790 + .long 1011860326 + .long 3126988118 + .long 1071287373 + .long 3410508918 + .long 1015153675 + .long 480439205 + .long 3216734124 + .long 3426889025 + .long 3160197739 + .long 927904425 + .long 1069712317 + .long 1130465219 + .long 1014845612 + .long 4266680347 + .long 3216234636 + .long 1626218864 + .long 3161277677 + .long 0 + .long 1072693248 + .long 1528870101 + .long 964807786 + .long 119575502 + .long 3218804454 + .long 1881625935 + .long 3159804816 + .long 2341912255 + .long 1071274903 + .long 3500227044 + .long 1010193322 + .long 2554745004 + .long 3216302649 + .long 3304224511 + .long 3156439793 + .long 2968672914 + .long 1068696059 + .long 4206584367 + .long 1012030447 + .long 1090398824 + .long 1060208439 + .long 842313838 + .long 1004803849 + .long 4294967295 + .long 1072693247 + .long 4294967295 + .long 1017118719 + .long 4235179544 + .long 3219290252 + .long 4177388891 + .long 3164508998 + .long 3258652024 + .long 1072670296 + .long 1161858311 + .long 1015929131 + .long 2402437986 + .long 3219982865 + .long 3056812941 + .long 3164521903 + .long 89167541 + .long 1072654929 + .long 2427235615 + .long 1014999039 + .long 3963139706 + .long 3220139136 + .long 3024603167 + .long 3163626566 + .type _tgammal_A1,@object + .size _tgammal_A1,384 + .align 4 +_tgammal_B: + .long 381774871 + .long 3211182444 + .long 436314138 + .long 1061814688 + .long 327235604 + .long 3208872248 + .long 723058467 + .long 1061917982 + .long 3650698365 + .long 3210701488 + .long 440509466 + .long 1064976804 + .long 3406779288 + .long 3214819974 + .long 941491840 + .long 1070005910 + .type _tgammal_B,@object + .size _tgammal_B,64 + .align 4 +_tgammal_C: + .long 3362045620 + .long 1072523249 + .long 4064281872 + .long 1016386130 + .type _tgammal_C,@object + .size _tgammal_C,16 + .align 4 +_TWO_32H: + .long 0 + .long 1106771968 + .type _TWO_32H,@object + .size _TWO_32H,8 + .align 4 +_TWO_32HP: + .long 1048576 + .long 1106771968 + .type _TWO_32HP,@object + .size _TWO_32HP,8 + .align 2 +_small_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 6383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 39151 + .word 0 + .word 0 + .word 0 + .type _small_value_80,@object + .size _small_value_80,32 + .align 2 +_POS_OVERFLOW: + .word 11809 + .word 27445 + .word 35846 + .word 56177 + .word 16393 + .word 0 + .word 0 + .word 0 + .type _POS_OVERFLOW,@object + .size _POS_OVERFLOW,16 + .align 2 +_tgammal_S: + .word 24210 + .word 1753 + .word 29241 + .word 50004 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 51350 + .word 39166 + .word 743 + .word 54836 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 3640 + .word 30975 + .word 46417 + .word 39360 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 53672 + .word 10841 + .word 35989 + .word 39843 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 36569 + .word 52859 + .word 829 + .word 59922 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 48029 + .word 59092 + .word 17416 + .word 34773 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 51219 + .word 52454 + .word 61951 + .word 62382 + .word 49123 + .word 0 + .word 0 + .word 0 + .type _tgammal_S,@object + .size _tgammal_S,112 + .align 2 +_tgammal_T2: + .word 46722 + .word 54455 + .word 58933 + .word 43588 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 11656 + .word 9670 + .word 26887 + .word 53935 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 37336 + .word 10857 + .word 59094 + .word 50631 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 42778 + .word 63737 + .word 45056 + .word 33859 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 26755 + .word 45167 + .word 18275 + .word 32926 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 44721 + .word 19678 + .word 48085 + .word 54982 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 51053 + .word 39319 + .word 36729 + .word 62310 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 45874 + .word 5043 + .word 3955 + .word 43983 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 10698 + .word 13153 + .word 62730 + .word 37178 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 47802 + .word 34638 + .word 48577 + .word 58524 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 5552 + .word 49084 + .word 18209 + .word 47263 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 27946 + .word 40146 + .word 45659 + .word 36839 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 43027 + .word 63179 + .word 35272 + .word 58163 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 51497 + .word 52569 + .word 40730 + .word 59709 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 50075 + .word 12939 + .word 25687 + .word 50566 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 50229 + .word 1163 + .word 49491 + .word 48597 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 65107 + .word 33673 + .word 57229 + .word 54934 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 40234 + .word 4993 + .word 58268 + .word 55864 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 37170 + .word 65173 + .word 7022 + .word 51747 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 26509 + .word 26471 + .word 6311 + .word 44116 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 19430 + .word 24800 + .word 9769 + .word 34884 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 11267 + .word 5159 + .word 36913 + .word 51530 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 64725 + .word 57237 + .word 10436 + .word 35732 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 9979 + .word 17874 + .word 14609 + .word 46771 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 48661 + .word 14142 + .word 37902 + .word 57970 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 44331 + .word 229 + .word 33140 + .word 34177 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 18505 + .word 49699 + .word 39129 + .word 38384 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 55009 + .word 45387 + .word 16863 + .word 41316 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 32472 + .word 62749 + .word 3488 + .word 43302 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 38507 + .word 49300 + .word 64329 + .word 42149 + .word 16346 + .word 0 + .word 0 + .word 0 + .word 54685 + .word 59022 + .word 19355 + .word 48977 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 11322 + .word 9818 + .word 14110 + .word 61121 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 35672 + .word 18289 + .word 56841 + .word 34043 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 40623 + .word 27826 + .word 27872 + .word 34330 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 23588 + .word 8736 + .word 44949 + .word 63368 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 65458 + .word 32180 + .word 45318 + .word 53999 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 7083 + .word 36157 + .word 35044 + .word 42795 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 41937 + .word 53706 + .word 63704 + .word 63466 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 56782 + .word 14002 + .word 58756 + .word 44258 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 50000 + .word 929 + .word 21531 + .word 58307 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 29164 + .word 41738 + .word 63210 + .word 36416 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 22318 + .word 7527 + .word 19550 + .word 43267 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 36459 + .word 32677 + .word 20918 + .word 49089 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 54142 + .word 37469 + .word 39035 + .word 54353 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 43987 + .word 37066 + .word 46591 + .word 55009 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 23593 + .word 355 + .word 54000 + .word 36277 + .word 16394 + .word 0 + .word 0 + .word 0 + .word 38981 + .word 26613 + .word 65277 + .word 49004 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 37709 + .word 48898 + .word 35761 + .word 58794 + .word 16390 + .word 0 + .word 0 + .word 0 + .word 20062 + .word 54760 + .word 43546 + .word 63578 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 4376 + .word 65424 + .word 42405 + .word 62684 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 53174 + .word 32360 + .word 45557 + .word 56872 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 50961 + .word 21643 + .word 2055 + .word 47845 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 44504 + .word 53228 + .word 208 + .word 37559 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 22458 + .word 24129 + .word 6745 + .word 55322 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 45571 + .word 12909 + .word 9586 + .word 38400 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 63967 + .word 2945 + .word 37284 + .word 50443 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 40100 + .word 52281 + .word 37909 + .word 62907 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 14124 + .word 37910 + .word 18802 + .word 37402 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 28370 + .word 35717 + .word 42940 + .word 43396 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 57898 + .word 23307 + .word 6391 + .word 45620 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 46932 + .word 12112 + .word 28768 + .word 37645 + .word 16401 + .word 0 + .word 0 + .word 0 + .word 4289 + .word 37433 + .word 59606 + .word 54245 + .word 16399 + .word 0 + .word 0 + .word 0 + .word 64482 + .word 38480 + .word 36982 + .word 34595 + .word 16398 + .word 0 + .word 0 + .word 0 + .word 60245 + .word 51970 + .word 24673 + .word 39653 + .word 16396 + .word 0 + .word 0 + .word 0 + .word 5116 + .word 50868 + .word 49618 + .word 41328 + .word 16394 + .word 0 + .word 0 + .word 0 + .word 41766 + .word 46400 + .word 3930 + .word 39543 + .word 16392 + .word 0 + .word 0 + .word 0 + .word 10780 + .word 29057 + .word 64174 + .word 35004 + .word 16390 + .word 0 + .word 0 + .word 0 + .word 53671 + .word 48824 + .word 23962 + .word 57716 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 53678 + .word 31584 + .word 52783 + .word 44557 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 6190 + .word 44351 + .word 42084 + .word 64733 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 38744 + .word 53501 + .word 23462 + .word 44426 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 5624 + .word 56691 + .word 10270 + .word 57805 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 37833 + .word 48670 + .word 48257 + .word 35818 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 2793 + .word 44149 + .word 23652 + .word 43316 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 36532 + .word 60099 + .word 3358 + .word 47101 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 26210 + .word 6795 + .word 18267 + .word 52540 + .word 16408 + .word 0 + .word 0 + .word 0 + .word 4852 + .word 29729 + .word 14912 + .word 39944 + .word 16407 + .word 0 + .word 0 + .word 0 + .word 5407 + .word 41984 + .word 60375 + .word 53635 + .word 16405 + .word 0 + .word 0 + .word 0 + .word 50093 + .word 12566 + .word 13387 + .word 64582 + .word 16403 + .word 0 + .word 0 + .word 0 + .word 49147 + .word 13632 + .word 405 + .word 35287 + .word 16402 + .word 0 + .word 0 + .word 0 + .word 19308 + .word 51191 + .word 49444 + .word 35336 + .word 16400 + .word 0 + .word 0 + .word 0 + .word 42358 + .word 64331 + .word 14656 + .word 65374 + .word 16397 + .word 0 + .word 0 + .word 0 + .word 20975 + .word 39047 + .word 28983 + .word 56232 + .word 16395 + .word 0 + .word 0 + .word 0 + .word 29936 + .word 14466 + .word 41903 + .word 45232 + .word 16393 + .word 0 + .word 0 + .word 0 + .word 29960 + .word 52783 + .word 56228 + .word 34190 + .word 16391 + .word 0 + .word 0 + .word 0 + .word 35121 + .word 10599 + .word 28021 + .word 48776 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 24922 + .word 26565 + .word 63850 + .word 32942 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 35914 + .word 31178 + .word 25984 + .word 42348 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 32787 + .word 34531 + .word 38943 + .word 53136 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 12957 + .word 55078 + .word 57592 + .word 59546 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _tgammal_T2,@object + .size _tgammal_T2,1440 + .align 2 +_tgammal_T1: + .word 33333 + .word 22332 + .word 1335 + .word 65087 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 47908 + .word 35098 + .word 63659 + .word 65273 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 46380 + .word 12569 + .word 56008 + .word 65411 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 48850 + .word 62280 + .word 7688 + .word 65472 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 39250 + .word 51171 + .word 14264 + .word 65504 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 1152 + .word 29364 + .word 36762 + .word 65519 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 3017 + .word 25231 + .word 24799 + .word 65523 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 25322 + .word 65334 + .word 59366 + .word 65496 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 56776 + .word 58800 + .word 13007 + .word 65323 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 19307 + .word 43631 + .word 60167 + .word 64530 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 36275 + .word 49480 + .word 28369 + .word 61762 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 21913 + .word 46254 + .word 26555 + .word 54444 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 35908 + .word 6208 + .word 45367 + .word 40294 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 27036 + .word 5944 + .word 26542 + .word 42848 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 29582 + .word 26316 + .word 64938 + .word 47331 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 2023 + .word 42870 + .word 23457 + .word 61457 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 65015 + .word 19522 + .word 60134 + .word 39847 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 37347 + .word 35810 + .word 25431 + .word 54185 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 59586 + .word 38885 + .word 5307 + .word 36118 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 55581 + .word 26604 + .word 61099 + .word 48328 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 26530 + .word 8530 + .word 11497 + .word 64510 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 5884 + .word 49309 + .word 23213 + .word 43047 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 39008 + .word 7698 + .word 42498 + .word 57424 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 52706 + .word 42552 + .word 1743 + .word 38295 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 36375 + .word 51085 + .word 41378 + .word 51088 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 45665 + .word 51480 + .word 46902 + .word 34067 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 45474 + .word 25613 + .word 9050 + .word 44941 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 10137 + .word 18971 + .word 38654 + .word 59779 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 53562 + .word 56969 + .word 3619 + .word 46768 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 12931 + .word 40754 + .word 53864 + .word 63282 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 16582 + .word 62753 + .word 30052 + .word 46783 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 41763 + .word 18743 + .word 29826 + .word 47859 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 61445 + .word 12179 + .word 9444 + .word 35298 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 19195 + .word 47291 + .word 36415 + .word 61711 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 13845 + .word 40089 + .word 27018 + .word 32909 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 12017 + .word 58217 + .word 13416 + .word 64677 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 35895 + .word 43222 + .word 31657 + .word 65323 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 20613 + .word 26232 + .word 50069 + .word 65270 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 35252 + .word 65344 + .word 3340 + .word 65456 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 10600 + .word 13283 + .word 40541 + .word 64928 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 11880 + .word 32674 + .word 50280 + .word 34435 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 63446 + .word 286 + .word 54268 + .word 48349 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 8548 + .word 23982 + .word 1825 + .word 63713 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 34666 + .word 29375 + .word 64038 + .word 41244 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 59811 + .word 4152 + .word 44775 + .word 65267 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 18717 + .word 22920 + .word 1335 + .word 65087 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 45811 + .word 56269 + .word 63659 + .word 65273 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 65298 + .word 48931 + .word 56016 + .word 65411 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 32491 + .word 12018 + .word 7860 + .word 65472 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 14368 + .word 44485 + .word 16906 + .word 65504 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 41970 + .word 59715 + .word 3074 + .word 65520 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 4801 + .word 21592 + .word 65211 + .word 65527 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 62592 + .word 41973 + .word 39337 + .word 65531 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 13381 + .word 40677 + .word 15011 + .word 65529 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 46580 + .word 36519 + .word 54875 + .word 65490 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 37477 + .word 29387 + .word 41414 + .word 65216 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 16797 + .word 56146 + .word 15453 + .word 63766 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 40859 + .word 15091 + .word 60713 + .word 58161 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 1004 + .word 12255 + .word 49061 + .word 43226 + .word 49150 + .word 0 + .word 0 + .word 0 + .word 52096 + .word 41479 + .word 59455 + .word 37399 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _tgammal_T1,@object + .size _tgammal_T1,960 + .align 2 +_tgammal_B0: + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16379 + .word 0 + .word 0 + .word 0 + .type _tgammal_B0,@object + .size _tgammal_B0,16 + .align 2 +_TWO_POW_16383: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 32766 + .word 0 + .word 0 + .word 0 + .type _TWO_POW_16383,@object + .size _TWO_POW_16383,16 + .align 2 +_TWO_POW_M16382: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 1 + .word 0 + .word 0 + .word 0 + .type _TWO_POW_M16382,@object + .size _TWO_POW_M16382,16 + .align 2 +_TWO_POW_M16000: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 383 + .word 0 + .word 0 + .word 0 + .type _TWO_POW_M16000,@object + .size _TWO_POW_M16000,16 + .align 2 +_large_value_80: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 26383 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 59151 + .word 0 + .word 0 + .word 0 + .type _large_value_80,@object + .size _large_value_80,32 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/trig_pi_bits.S b/external/sgx_libm/intel64/trig_pi_bits.S new file mode 100644 index 0000000000..2977f39ed4 --- /dev/null +++ b/external/sgx_libm/intel64/trig_pi_bits.S @@ -0,0 +1,310 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "trig_pi_bits.c" + .section .rodata, "a" + .align 8 + .align 8 + .globl __four_over_pi +__four_over_pi: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0xdb939105,0x0028be60 + .long 0xf47d4d37,0x4a7f09d5 + .long 0x664f10e4,0x7036d8a5 + .long 0xeaf7aef1,0x107f9458 + .long 0x8e909374,0x586dc91b + .long 0xba827464,0xb801924b + .long 0xc72c4a69,0x873f877a + .long 0x7d4baed1,0xcfba208d + .long 0x09ad17df,0x213a671c + .long 0x8e60d4ce,0x904e6475 + .long 0xe2ef7e4a,0x7d272117 + .long 0xfff78166,0x0ec7fe25 + .long 0x62d6829b,0x03fbcbc4 + .long 0xb3c9f2c2,0x47db4d9f + .long 0xd9a797fa,0x6dd3d18f + .long 0xb1faf97c,0x8b5d49ee + .long 0x7de294a4,0x5ecf41ce + .long 0xec47e357,0xba9afed7 + .long 0x11bf1eda,0x421580cc + .long 0x0826bd0d,0xeafc33ef + .long 0x5857b986,0x876a78e4 + .long 0x57c5281a,0xc2196661 + .long 0x20135cc9,0x10237ff6 + .long 0x55b29cea,0xcc418185 + .long 0xf0231ad1,0x3258389e + .long 0xf3773a02,0xf10670d9 + .long 0x1da2e587,0x4aa0d671 + .long 0x3455c641,0x29b76bd1 + .long 0xc14fdf8c,0x4fa97fc1 + .long 0x93e60c9f,0xfa0cb0b7 + .long 0xbbdac797,0x6ef0cf49 + .long 0xcd72bc9f,0xbe27ce87 + .long 0x641f1f09,0xc761fc48 + .long 0x5dcb4c10,0x1abe9bb5 + .long 0x2d674670,0xcec57185 + .long 0x534b1740,0xf0b12b50 + .long 0x8b5c78e6,0x03119f61 + .long 0x8cdf34ad,0xb1a6c018 + .long 0x554dfd8f,0x25e9ed35 + .long 0xff1d934a,0xb5c60428 + .long 0xdc3e1f18,0xa7592af5 + .long 0xc545d592,0xd5ec1eb9 + .long 0xce2129f2,0x7036758e + .long 0xb588d516,0xc8c91de2 + .long 0xc2bc77f3,0xae47c006 + .long 0xda879998,0x867fcc67 + .long 0xeb361fdf,0x55e651fe + .long 0x7a0c982f,0xadd948a2 + .long 0xc24d9b35,0xf9b3713b + .long 0x85b78ed6,0x0fd775f7 + .long 0x08b4ba21,0x24a6f78a + .long 0x8cb2b185,0x8a135638 + .long 0x78143005,0xb8c232df + .long 0xf8060d04,0xe9c77cd6 + .long 0xc05220d6,0xcb9884a0 + .long 0x2b7cba47,0xe3bd5fec + .long 0xd9c43637,0x90d29234 + .long 0xb3985aa9,0x6a9097eb + .long 0x74fca981,0x0a02ad26 + .long 0xf0a8e20f,0x9fddd720 + .long 0x96a32bef,0x185e1ce2 + .long 0x8b72effd,0x75dbd8e9 + .long 0xf0499172,0x3be06359 + .long 0xb4aa0a23,0x954db672 + .long 0x44850981,0x58709df2 + .long 0x16711131,0x26d184b1 + .long 0x7cc5c02b,0x72246c93 + .long 0x4a44357f,0x50f53952 + .long 0x2507bbb3,0x7f2f8033 + .long 0xe03c7b30,0x9c3d4f84 + .long 0x31e50164,0xf9ecca3e + .long 0xc24bbcd1,0xcf9c706c + .long 0x1ec82ae7,0x42e704a2 + .long 0x91cbcc9e,0xed4bb0a4 + .long 0x29dc87f9,0xdb554324 + .long 0x52859e78,0xdae5b2cc + .long 0xfd25e53a,0x9e506277 + .long 0xcc665afb,0x2139b8a5 + .long 0xc3bf6eed,0x620d97d7 + .long 0x19d09c9c,0x26921b29 + .long 0x0567c279,0x4c97636e + .long 0x4e5d3dc7,0x6f094c63 + .long 0x035a0212,0x014c0043 + .long 0x2a91c0b9,0xd63b8b24 + .long 0x699f7ddc,0xdd0935af + .long 0xa7e9a523,0x921bbbc5 + .long 0x54f47c82,0xbda46d14 + .long 0x1f92fd5a,0xb3cce608 + .long 0xb740d750,0x18ec97cf + .long 0x54957019,0x1fe2614a + .long 0x4c920c9d,0x0dc4361b + .long 0x539b9511,0x5316f51c + .long 0x7d4ab559,0x704242da + .long 0xd4011776,0x852741c9 + .long 0xba85fe61,0xceed315d + .long 0x89c74a5a,0xdf5ad26e + .long 0x95052b5a,0x65ab3331 + .long 0x62141c8b,0xb8a42276 + .long 0x01dddc0c,0x2fa90125 + .long 0x2a1c7a92,0x3cc9ff00 + .long 0x1920f765,0x70998f78 + .long 0x6510e321,0xe5cfe8ff + .long 0x674e64a3,0x8377904c + .long 0xc5cef7c2,0x1c3779ed + .long 0x201724e0,0x0acdc568 + .long 0x363a03eb,0x16a48444 + .long 0xf6c3e40e,0xe01b12ff + .long 0x6958aef2,0x1d861645 + .long 0xef500401,0xd86e6271 + .long 0x527dadba,0x3cb489dd + .long 0x85028bc9,0xeec8b6ea + .long 0x0ccec246,0xa25da0d9 + .long 0x9470a8c7,0xa503aa8e + .long 0x89971370,0x6bbb6bc4 + .long 0x65d5b020,0x9b671e8b + .long 0x0263100a,0xcfc0fdbc + .long 0xed0e4548,0xe64c5b41 + .long 0x3124bd52,0x0316f0f6 + .long 0x93b34de9,0xeb71a972 + .long 0x24aada10,0xcdaa79a5 + .long 0x7be31d94,0xb77798c6 + .long 0xff2ae86b,0xa2da0df6 + .long 0x6b8036be,0x8c4577e8 + .long 0x2dc17b4c,0xc3199359 + .long 0x95cebfd1,0x194a6fd5 + .long 0xef9d77e4,0xee7e5abc + .long 0xfda31985,0xca0c202a + .long 0xbe877936,0x72c10188 + .long 0xc6d5c273,0x692ccf63 + .long 0xa92f84ed,0x4dba5093 + .long 0xbc2a1953,0x48ccc6aa + .long 0xcfc2f35e,0xe9707483 + .long 0xc122dedc,0x16ddbe48 + .long 0xb1b89b9b,0x85e254e9 + .long 0x12a6edf6,0xc03afbd6 + .long 0xb3f3dd87,0xb12e99aa + .long 0x6c706663,0x40b44b7c + .long 0x9221a817,0x1deb70f6 + .long 0x8bfc2b26,0x7dfd2031 + .long 0x0fdb77b4,0xbb376f17 + .long 0xb6ca8e89,0x07f1e42d + .long 0x24d4eb41,0x68e6abc0 + .long 0x4a5fa012,0x15edad0b + .long 0xaa9da856,0xe9c1f683 + .long 0x8b6df73f,0x5eca8485 + .long 0xe27f6fa2,0x797ebfb6 + .long 0x2a419c20,0x5b1db93f + .long 0x7fe1ff41,0x0f855ba1 + .long 0xd861860a,0xcf8a0cd9 + .long 0xf9ecdb9b,0xbaaf536b + .long 0x56efcc52,0x63ce59e5 + .long 0xcc10cb71,0x35e105b7 + .long 0x9c326e32,0xcd584973 + .long 0xe8802939,0xcc3f5b2f + .long 0x5691dbc8,0x1b016837 + .long 0x172e5258,0x748498a1 + .long 0xc054a64d,0x5c38159a + .long 0x47b13c4c,0xd5542df5 + .long 0x0c176a4b,0xd7db84f9 + .long 0x4d8ca869,0xa170ec87 + .long 0x7a887dc5,0x2dc2352c + .long 0xffc9e000,0xb91a63dd + .long 0x683353e6,0xc30b5023 + .long 0xacc2974b,0x694834e8 + .long 0xf684742f,0xd0be6d32 + .long 0xef45eae0,0x9f7076e6 + .long 0x8205d54b,0x68b2971a + .long 0x051fe181,0x954009fc + .long 0x235065b7,0xf85902c5 + .long 0x76ad895a,0xafa1cabf + .long 0xbcc167af,0xcd225eff + .long 0x2a0a9296,0xee53da9a + .long 0x0b6616b5,0xb113ef3e + .long 0x5343698e,0xe571fd23 + .long 0x2c4fc525,0x8817d5e9 + .long 0x3321b75c,0x4e200048 + .long 0x582fc459,0x6db7b27d + .long 0x6b2c2334,0x535ac1c0 + .long 0x5443bec7,0x302c9215 + .long 0xc1a8cd50,0xb0dca54e + .long 0xb311783e,0x301ef701 + .long 0xb5907cfa,0x8a53b232 + .long 0x1926cc6f,0x37991f36 + .long 0x35161df1,0xb670e5e9 + .long 0xbc0f0eae,0x78da44f6 + .long 0xdd557d6f,0x91861197 + .long 0x974bab3b,0x74b1a49b + .long 0x8721f118,0x5103908f + .long 0xf5b9f29f,0x7a7f4a7c + .long 0xf1780223,0x088d645b + .long 0x9bb1bf6c,0x75fff89a + .long 0x175f2cab,0x304224dd + .long 0x5edc8f9a,0x5ae75bb3 + .long 0xfdf7dcca,0x8471aa73 + .long 0x402dc36c,0x6eb26d54 + .long 0x181f7962,0xb8892e9d + .long 0x43430620,0xb61d0b05 + .long 0x8a405d9e,0x65199f85 + .long 0x7bd1558d,0xa7efbf7f + .long 0x7b2e6ea2,0x9fb644f6 + .long 0xea0c70db,0xff25f109 + .long 0x15aa362d,0xbc4db165 + .long 0x33cb6244,0x6a2d03b3 + .long 0x558b38f3,0x8d15dbe2 + .long 0xaa979ae7,0xa66e4835 + .long 0xc45282ff,0x0a8fb317 + .long 0x4ee38b21,0x7efd385b + .long 0x6a6d3f34,0xb8a1353a + .long 0x4b984e4b,0x7bbbf24d + .long 0x3646c2bf,0xd1084e32 + .long 0xf6070be1,0x205a92be + .long 0x53b30895,0x2d14e326 + .long 0xb1b02586,0x37154ab5 + .long 0x99255a58,0x42ee1c06 + .long 0x8fc3c45f,0x1689bb94 + .long 0x72ff0b6f,0xc46d7d3d + .long 0x33177a18,0x0d3baf0d + .long 0x99fbcce4,0x17b766e3 + .long 0xd6186f15,0xae05f266 + .long 0x440fb612,0xf871a0d4 + .long 0x0b68462b,0x1c777747 + .long 0xfcd6661e,0xd18b0875 + .long 0xbea193ff,0xb6701527 + .long 0x794d88a2,0x0195ab9e + .long 0x24d9eaba,0x48ab4e37 + .long 0xa6f9f2a9,0x154e09a0 + .long 0xe643b5ea,0x03546c4c + .long 0x2c9969e2,0x52015a7c + .long 0x0db47e6c,0x1fe5d322 + .long 0x9ec873e6,0xe48852a0 + .long 0x51f70e9d,0x3727d015 + .long 0xf7e77f97,0x3850bad9 + .long 0xdedeab2e,0xf517a919 + .long 0xe20ad56e,0xa8bd9548 + .long 0x618a8860,0x90421b96 + .long 0xe27527b9,0xd1ce79b8 + .long 0x55bff283,0x503ed27a + .long 0x4afea531,0xc7229671 + .long 0x43eb96b6,0x7074f3f1 + .long 0x90e14ee1,0xe1b151d8 + .long 0x21d8441e,0x88651e4b + .long 0x2004afd0,0xd30a868b + .long 0x4f1e3931,0xe409a222 + .long 0x708eb13a,0x2a1ef6f9 + .long 0xfdefe483,0xbd09a299 + .long 0x64cf42df,0x4ae8d96c + .long 0x18f749f7,0x2f771469 + .long 0x26a54a6a,0x785a4665 + .long 0x3b424827,0x0a339a2d + .long 0x98e09c08,0xd132a613 + .long 0x43e3bd69,0xdf1f8cae + .long 0x3c484aa7,0xf9d58502 + .long 0xd446696a,0x6d535f9b + .long 0xe0987765,0xfe6d75b7 + .long 0xceb12868,0x808d85a7 + .long 0x9ea34e6a,0xa0db7b5c + .long 0x9ad6c9d1,0x6e20970c + .long 0xc034957d,0xbb4d001d + .long 0x601c7838,0x3f135640 + .long 0x7cd92a3c,0x4fe26ca5 + .long 0x3f133aac,0x6ba9d2ce + .type __four_over_pi,@object + .size __four_over_pi,2104 + .data + .section .note.GNU-stack, "" +# End diff --git a/external/sgx_libm/intel64/trunc_gen.S b/external/sgx_libm/intel64/trunc_gen.S new file mode 100644 index 0000000000..374a372a63 --- /dev/null +++ b/external/sgx_libm/intel64/trunc_gen.S @@ -0,0 +1,126 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "trunc_gen.c" + .text +..TXTST0: +# -- Begin trunc + .text + .align 16,0x90 + .globl trunc +trunc: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_trunc.1: +..L2: + + movsd %xmm0, -8(%rsp) + movl -4(%rsp), %edx + movl %edx, %eax + andl $2147483647, %eax + addl $-1072693248, %eax + cmpl $54525952, %eax + jae ..B1.6 +..B1.2: + movl %eax, %ecx + shrl $20, %ecx + cmpl $22020096, %eax + jae ..B1.4 +..B1.3: + negl %ecx + movl $-1, %eax + addl $20, %ecx + shll %cl, %eax + andl %eax, %edx + movl %edx, -4(%rsp) + movl $0, -8(%rsp) + movsd -8(%rsp), %xmm0 + ret +..B1.4: + negl %ecx + movl $-1, %eax + addl $20, %ecx + shll %cl, %eax + andl %eax, -8(%rsp) + movsd -8(%rsp), %xmm0 +..B1.5: + ret +..B1.6: + testl %eax, %eax + jl ..B1.9 +..B1.7: + lea _ones(%rip), %rax + movsd -8(%rsp), %xmm0 + mulsd (%rax), %xmm0 +..B1.8: + ret +..B1.9: + lea _zeros(%rip), %rax + shrl $31, %edx + movsd (%rax,%rdx,8), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type trunc,@function + .size trunc,.-trunc + .data +# -- End trunc + .section .rodata, "a" + .align 4 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/truncf.S b/external/sgx_libm/intel64/truncf.S new file mode 100644 index 0000000000..5b4ecdd7eb --- /dev/null +++ b/external/sgx_libm/intel64/truncf.S @@ -0,0 +1,90 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "truncf.c" + .text +..TXTST0: +# -- Begin truncf + .text + .align 16,0x90 + .globl truncf +truncf: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_truncf.1: +..L2: + + movd %xmm0, %edx + movss %xmm0, -8(%rsp) + movl %edx, %ecx + andl $2147483647, %ecx + addl $-1065353216, %ecx + cmpl $192937984, %ecx + jb ..B1.5 +..B1.2: + testl %ecx, %ecx + jl ..B1.6 +..B1.4: + ret +..B1.5: + shrl $23, %ecx + movl $-1, %eax + negl %ecx + addl $23, %ecx + shll %cl, %eax + andl %eax, %edx + movl %edx, -8(%rsp) + movss -8(%rsp), %xmm0 + ret +..B1.6: + andl $-2147483648, %edx + movl %edx, -8(%rsp) + movss -8(%rsp), %xmm0 + ret + .align 16,0x90 + .cfi_endproc + .type truncf,@function + .size truncf,.-truncf + .data +# -- End truncf + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/truncl.S b/external/sgx_libm/intel64/truncl.S new file mode 100644 index 0000000000..e637ebb60f --- /dev/null +++ b/external/sgx_libm/intel64/truncl.S @@ -0,0 +1,180 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "truncl.c" + .text +..TXTST0: +# -- Begin truncl + .text + .align 16,0x90 + .globl truncl +truncl: +# parameter 1: 48 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_truncl.1: +..L2: + + subq $40, %rsp + .cfi_def_cfa_offset 48 +..B1.2: + fnstcw 26(%rsp) +..B1.3: + movzwl 56(%rsp), %ecx + andl $32767, %ecx + cmpl $16446, %ecx + jge ..B1.14 +..B1.4: + cmpl $16383, %ecx + jl ..B1.9 +..B1.5: + cmpl $16415, %ecx + jge ..B1.7 +..B1.6: + negl %ecx + addl $30, %ecx + movl 52(%rsp), %eax + shrl %cl, %eax + shll %cl, %eax + movl %eax, 52(%rsp) + xorl %eax, %eax + jmp ..B1.8 +..B1.7: + negl %ecx + addl $30, %ecx + movl 48(%rsp), %eax + shrl %cl, %eax + shll %cl, %eax +..B1.8: + movl %eax, 48(%rsp) + fldt 48(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.9: + testl %ecx, %ecx + jne ..B1.13 +..B1.10: + cmpl $0, 52(%rsp) + jne ..B1.12 +..B1.11: + cmpl $0, 48(%rsp) + je ..B1.13 +..B1.12: + lea _smallest_value_64(%rip), %rax + movq (%rax), %rdx + movq %rdx, (%rsp) +..B1.13: + movb 57(%rsp), %al + lea _zeros(%rip), %rdx + andb $-128, %al + shrb $7, %al + movzbl %al, %ecx + fldl (%rdx,%rcx,8) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.14: + movzwl 26(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.20 +..B1.15: + orl $-64768, %edx + movw %dx, 24(%rsp) +..B1.16: + fldcw 24(%rsp) +..B1.17: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) +..B1.18: + fldcw 26(%rsp) +..B1.19: + fldt 8(%rsp) + addq $40, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 48 +..B1.20: + fldt 48(%rsp) + lea _ones(%rip), %rax + fmull (%rax) + fstpt 8(%rsp) + jmp ..B1.19 + .align 16,0x90 + .cfi_endproc + .type truncl,@function + .size truncl,.-truncl + .data +# -- End truncl + .section .rodata, "a" + .align 4 + .align 4 +_smallest_value_64: + .long 1 + .long 0 + .long 1 + .long 2147483648 + .type _smallest_value_64,@object + .size _smallest_value_64,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/y0.S b/external/sgx_libm/intel64/y0.S new file mode 100644 index 0000000000..d2ea09d103 --- /dev/null +++ b/external/sgx_libm/intel64/y0.S @@ -0,0 +1,4231 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y0.c" + .text +..TXTST0: +# -- Begin y0 + .text + .align 16,0x90 + .globl y0 +y0: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_y0.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + xorb %bl, %bl + movsd %xmm0, (%rsp) +..B1.2: + fnstcw 10(%rsp) +..B1.3: + movl 4(%rsp), %edx + movl %edx, %ecx + andl $2147483647, %ecx + cmpl $2146435072, %ecx + jge ..B1.13 +..B1.4: + cmpq $0, (%rsp) + jle ..B1.19 +..B1.5: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.7: + fldcw 8(%rsp) +..B1.8: + movb $1, %bl +..B1.9: + addq $-16, %rsp + .cfi_def_cfa_offset 48 + fldl 16(%rsp) + fstpt (%rsp) +..___tag_value_y0.7: + call __y0l@PLT +..___tag_value_y0.8: +..B1.25: + addq $16, %rsp + .cfi_def_cfa_offset 32 +..B1.10: + fstpl (%rsp) + testb %bl, %bl + movsd (%rsp), %xmm0 + je ..B1.12 +..B1.11: + fldcw 10(%rsp) +..B1.12: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 3, -16 +..B1.13: + andl $-2146435073, %ecx + orl (%rsp), %ecx + jne ..B1.18 +..B1.14: + lea _zeros(%rip), %rax + testl $-2147483648, %edx + movsd (%rax), %xmm0 + je ..B1.17 +..B1.15: + lea _infs(%rip), %rax + movsd (%rax), %xmm1 + mulsd %xmm1, %xmm0 +..B1.17: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 3, -16 +..B1.18: + movsd (%rsp), %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 3, -16 +..B1.19: + lea _zeros(%rip), %rax + movl (%rsp), %edx + orl %edx, %ecx + movsd (%rax), %xmm1 + je ..B1.21 +..B1.20: + lea _infs(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm1, %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 3, -16 +..B1.21: + lea 8+_ones(%rip), %rax + movsd (%rax), %xmm0 + divsd %xmm1, %xmm0 +..B1.22: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type y0,@function + .size y0,.-y0 + .data +# -- End y0 + .text +# -- Begin __y0l + .text + .align 16,0x90 + .globl __y0l +__y0l: +# parameter 1: 96 + %rsp +..B2.1: + .cfi_startproc +..___tag_value___y0l.34: +..L35: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + lea 176+_S(%rip), %rax + fldt 96(%rsp) + fldt (%rax) + fcomip %st(1), %st + jb ..B2.22 +..B2.2: + lea _val_0_6L(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + ja ..B2.20 +..B2.3: + lea _val_1_2L(%rip), %rax + fldt (%rax) + fcomi %st(1), %st + jbe ..B2.5 +..B2.4: + fstp %st(0) + lea _Z(%rip), %rax + lea _P11(%rip), %rdx + lea 16+_P11(%rip), %rcx + lea 32+_P11(%rip), %rdi + lea 48+_P11(%rip), %r8 + lea 64+_P11(%rip), %r9 + lea 80+_P11(%rip), %r10 + fldt (%rax) + lea _Q11(%rip), %rsi + lea 16+_Q11(%rip), %r11 + lea 96+_P11(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 112+_P11(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 128+_P11(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 144+_P11(%rip), %rsi + fmul %st(4), %st + fldt (%rdi) + lea 32+_Q11(%rip), %rdi + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r8) + lea 160+_P11(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r9) + lea 176+_P11(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r10) + lea 192+_P11(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + lea 208+_P11(%rip), %r11 + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt (%rax) + lea 48+_Q11(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rdx) + lea _ones(%rip), %rdx + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rcx) + lea 224+_P11(%rip), %rcx + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rsi) + lea 240+_P11(%rip), %rsi + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rdi) + lea 256+_P11(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r8) + lea 272+_P11(%rip), %r8 + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(3) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fdivrl (%rdx) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B2.27 +..B2.5: + lea _S(%rip), %rcx + fldt (%rcx) + fcomip %st(2), %st + jbe ..B2.7 +..B2.6: + lea _P12(%rip), %rax + lea 16+_P12(%rip), %rdx + lea 32+_P12(%rip), %rcx + lea 48+_P12(%rip), %rsi + lea 64+_P12(%rip), %rdi + lea 80+_P12(%rip), %r8 + lea 96+_P12(%rip), %r9 + lea 112+_P12(%rip), %r10 + fldt (%rax) + lea 128+_P12(%rip), %r11 + lea 144+_P12(%rip), %rax + fxch %st(1) + fsubrp %st, %st(2) + fld %st(1) + fmul %st(2), %st + fmul %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 160+_P12(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 176+_P12(%rip), %rcx + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt (%rsi) + lea 192+_P12(%rip), %rsi + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdi) + lea 208+_P12(%rip), %rdi + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r8) + lea 224+_P12(%rip), %r8 + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r9) + lea 240+_P12(%rip), %r9 + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r10) + lea 256+_P12(%rip), %r10 + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r11) + lea 272+_P12(%rip), %r11 + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rax) + lea 288+_P12(%rip), %rax + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdx) + lea 304+_P12(%rip), %rdx + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rcx) + lea 320+_P12(%rip), %rcx + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rsi) + lea 336+_P12(%rip), %rsi + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rdi) + lea 352+_P12(%rip), %rdi + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r8) + lea 368+_P12(%rip), %r8 + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r9) + lea 384+_P12(%rip), %r9 + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r10) + lea 400+_P12(%rip), %r10 + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r11) + lea 416+_P12(%rip), %r11 + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rax) + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rdx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rcx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rsi) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdi) + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r8) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r9) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r11) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.7: + fstp %st(0) + lea _val_3_0L(%rip), %rax + fldt (%rax) + fcomi %st(1), %st + jbe ..B2.9 +..B2.8: + lea _P20(%rip), %rax + lea 16+_P20(%rip), %rdx + lea 32+_P20(%rip), %rcx + lea 48+_P20(%rip), %rsi + lea 64+_P20(%rip), %rdi + lea 80+_P20(%rip), %r8 + lea 96+_P20(%rip), %r9 + lea 112+_P20(%rip), %r10 + lea 128+_P20(%rip), %r11 + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rax) + lea 144+_P20(%rip), %rax + fmul %st(1), %st + fldt (%rdx) + lea 160+_P20(%rip), %rdx + fmul %st(2), %st + fldt (%rcx) + lea 176+_P20(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 192+_P20(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 208+_P20(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 224+_P20(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 240+_P20(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 256+_P20(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 272+_P20(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%r10) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r11) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.9: + fstp %st(0) + lea _val_3_875L(%rip), %rax + fldt (%rax) + fcomi %st(1), %st + jbe ..B2.11 +..B2.10: + lea _P21(%rip), %rax + lea 16+_P21(%rip), %rdx + lea 32+_P21(%rip), %rcx + lea 48+_P21(%rip), %rsi + lea 64+_P21(%rip), %rdi + lea 80+_P21(%rip), %r8 + lea 96+_P21(%rip), %r9 + lea 112+_P21(%rip), %r10 + fldt (%rax) + fxch %st(1) + fsubrp %st, %st(2) + fld %st(1) + lea 128+_P21(%rip), %r11 + lea 144+_P21(%rip), %rax + fmul %st(2), %st + fmul %st, %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 160+_P21(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 176+_P21(%rip), %rcx + faddp %st, %st(3) + fxch %st(1) + fmul %st, %st(2) + fldt (%rsi) + lea 192+_P21(%rip), %rsi + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdi) + lea 208+_P21(%rip), %rdi + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r8) + lea 224+_P21(%rip), %r8 + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r9) + lea 240+_P21(%rip), %r9 + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%r10) + lea 256+_P21(%rip), %r10 + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r11) + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rax) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rdx) + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rcx) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%rsi) + faddp %st, %st(3) + fmul %st, %st(2) + fldt (%rdi) + faddp %st, %st(2) + fmul %st, %st(1) + fldt (%r8) + faddp %st, %st(3) + fmulp %st, %st(2) + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%r10) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.11: + fstp %st(0) + lea 16+_S(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + jb ..B2.13 +..B2.12: + lea 16+_Z(%rip), %rax + lea _P22(%rip), %rdx + lea 16+_P22(%rip), %rcx + lea 32+_P22(%rip), %rsi + lea 48+_P22(%rip), %rdi + lea 64+_P22(%rip), %r8 + lea 80+_P22(%rip), %r9 + lea 96+_P22(%rip), %r10 + fldt (%rax) + lea 112+_P22(%rip), %r11 + lea 128+_P22(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 144+_P22(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 160+_P22(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 176+_P22(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 192+_P22(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 208+_P22(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 224+_P22(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 240+_P22(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 256+_P22(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 272+_P22(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 288+_P22(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rdx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.13: + lea 32+_S(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + jbe ..B2.15 +..B2.14: + lea 32+_Z(%rip), %rax + lea _P3(%rip), %rdx + lea 16+_P3(%rip), %rcx + lea 32+_P3(%rip), %rsi + lea 48+_P3(%rip), %rdi + lea 64+_P3(%rip), %r8 + lea 80+_P3(%rip), %r9 + fldt (%rax) + lea 96+_P3(%rip), %r10 + lea 112+_P3(%rip), %r11 + lea 128+_P3(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 144+_P3(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 160+_P3(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 176+_P3(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 192+_P3(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 208+_P3(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 224+_P3(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 240+_P3(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 256+_P3(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 272+_P3(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 288+_P3(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 304+_P3(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 320+_P3(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 336+_P3(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rsi) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rdi) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.15: + movl $3, %edx + movl $48, %eax +..B2.16: + fldt (%rax,%rcx) + fcomip %st(1), %st + ja ..B2.19 + jp ..B2.19 +..B2.17: + incq %rdx + addq $16, %rax + cmpq $11, %rdx + jl ..B2.16 +..B2.18: + movq %rdx, %rax + shlq $4, %rax +..B2.19: + lea _Z(%rip), %rcx + fldt (%rax,%rcx) + lea (%rdx,%rdx,4), %rax + shlq $6, %rax + fsubrp %st, %st(1) + fld %st(0) + lea _P(%rip), %rdx + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt -960(%rax,%rdx) + fmul %st(1), %st + fldt -944(%rax,%rdx) + fmul %st(2), %st + fldt -928(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -912(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -896(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -880(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -864(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -848(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -832(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -816(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -800(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -784(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -768(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -752(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -736(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -720(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -704(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -688(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -672(%rax,%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -656(%rax,%rdx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.27 +..B2.20: + fld %st(0) + lea _P0(%rip), %rax + fmul %st(1), %st + lea 16+_P0(%rip), %rdx + fxch %st(1) + fld %st(1) + lea 32+_P0(%rip), %rcx + fmul %st(2), %st + lea 48+_P0(%rip), %rsi + lea 64+_P0(%rip), %rdi + lea 80+_P0(%rip), %r8 + lea 96+_P0(%rip), %r9 + lea 112+_P0(%rip), %r10 + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + fxch %st(1) + fstpt (%rsp) + fldt (%rax) + fmul %st(2), %st + fldt (%rdx) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%r9) + faddp %st, %st(1) + fmulp %st, %st(1) + fldt (%r10) + faddp %st, %st(2) + faddp %st, %st(1) + fstpt 16(%rsp) +..___tag_value___y0l.38: + call __j0l@PLT +..___tag_value___y0l.39: +..B2.31: + fldt 112(%rsp) + fxch %st(1) + fstpt 32(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 96 +..B2.21: + fxch %st(1) + fstpl 40(%rsp) + movsd 40(%rsp), %xmm0 + fstpt (%rsp) + call log@PLT +..B2.32: + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt 16(%rsp) + movsd %xmm0, 32(%rsp) + fldt (%rax) + fmulp %st, %st(1) + fmull 32(%rsp) + faddp %st, %st(1) + jmp ..B2.27 +..B2.22: + lea _ones(%rip), %rax + lea _val_36_0L(%rip), %rdx + lea _PP(%rip), %rcx + lea _QP(%rip), %rsi + lea 16+_PP(%rip), %rdi + lea 16+_QP(%rip), %r8 + lea 32+_PP(%rip), %r9 + lea 32+_QP(%rip), %r10 + fldl (%rax) + lea 48+_PP(%rip), %r11 + fdiv %st(1), %st + lea 48+_QP(%rip), %rax + fxch %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rdx) + lea 64+_PP(%rip), %rdx + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fxch %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + fxch %st(2) + fstpt (%rsp) + fldt (%rcx) + lea 64+_QP(%rip), %rcx + fmul %st(1), %st + fldt (%rsi) + lea 80+_PP(%rip), %rsi + fmul %st(2), %st + fldt (%rdi) + lea 80+_QP(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 96+_PP(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 96+_QP(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 112+_PP(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 112+_QP(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_PP(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 128+_QP(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 144+_PP(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 144+_QP(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 80(%rsp), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + movl $-1, %edx + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rcx) + faddp %st, %st(1) + fstpt -48(%rdi) + fldt (%rsi) + lea 64(%rsp), %rsi + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -16(%rsi) +..___tag_value___y0l.42: + call __libm_sincos_pi4l@PLT +..___tag_value___y0l.43: +..B2.33: + fldt 112(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 96 +..B2.23: + fldt 64(%rsp) + lea _val_0_03L(%rip), %rax + fmulp %st, %st(1) + fldt 48(%rsp) + fmulp %st, %st(2) + fadd %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt (%rax) + fmulp %st, %st(1) + fcomip %st(1), %st + fstp %st(0) + jae ..B2.25 + jp ..B2.25 +..B2.24: + fstp %st(1) + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + jmp ..B2.27 +..B2.25: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B2.35: + addq $16, %rsp + .cfi_def_cfa_offset 96 + movaps (%rsp), %xmm0 +..___tag_value___y0l.47: + call __y0q@PLT +..___tag_value___y0l.48: +..B2.26: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B2.36: + fstpl 40(%rsp) + movsd 40(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) +..B2.27: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __y0l,@function + .size __y0l,.-__y0l + .data +# -- End __y0l + .section .rodata, "a" + .align 4 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_S: + .word 5921 + .word 65426 + .word 63142 + .word 35997 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 29632 + .word 15745 + .word 62068 + .word 44479 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 41288 + .word 2893 + .word 15731 + .word 35209 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 12322 + .word 41360 + .word 35270 + .word 48124 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 21828 + .word 62500 + .word 60486 + .word 61019 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 54460 + .word 63729 + .word 58186 + .word 36952 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 27250 + .word 3142 + .word 10825 + .word 43393 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 20649 + .word 49414 + .word 53633 + .word 49831 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 59160 + .word 26587 + .word 26484 + .word 56269 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 57283 + .word 10561 + .word 16432 + .word 62706 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 44243 + .word 51162 + .word 18495 + .word 34571 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 63781 + .word 54231 + .word 15770 + .word 37789 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _S,@object + .size _S,192 + .align 2 +_val_0_6L: + .word 39322 + .word 39321 + .word 39321 + .word 39321 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _val_0_6L,@object + .size _val_0_6L,16 + .align 2 +_val_1_2L: + .word 39322 + .word 39321 + .word 39321 + .word 39321 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _val_1_2L,@object + .size _val_1_2L,16 + .align 2 +_Z: + .word 20971 + .word 41151 + .word 30150 + .word 58561 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 56848 + .word 49844 + .word 39532 + .word 64842 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 5940 + .word 14600 + .word 60967 + .word 58048 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 48233 + .word 9194 + .word 47533 + .word 41870 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 19716 + .word 3898 + .word 3621 + .word 54727 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 41547 + .word 400 + .word 58272 + .word 33793 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 46312 + .word 65374 + .word 26362 + .word 40225 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 15253 + .word 48480 + .word 38891 + .word 46657 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 12158 + .word 16394 + .word 14239 + .word 53090 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 31253 + .word 2914 + .word 8779 + .word 59523 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 29606 + .word 9567 + .word 8455 + .word 32978 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 51148 + .word 41491 + .word 50276 + .word 36194 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _Z,@object + .size _Z,192 + .align 2 +_P11: + .word 21672 + .word 14168 + .word 38767 + .word 33539 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 41169 + .word 50619 + .word 21849 + .word 37014 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 55003 + .word 42793 + .word 44721 + .word 50737 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 1169 + .word 13656 + .word 30890 + .word 57268 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 2761 + .word 22275 + .word 55697 + .word 58639 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 63624 + .word 9235 + .word 64995 + .word 56818 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 62376 + .word 14952 + .word 24232 + .word 50456 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 35764 + .word 14862 + .word 11423 + .word 44812 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 799 + .word 749 + .word 44421 + .word 44099 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 57800 + .word 45157 + .word 3532 + .word 40524 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 54824 + .word 35595 + .word 46140 + .word 46550 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 57927 + .word 14014 + .word 38764 + .word 61194 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 31025 + .word 58986 + .word 13056 + .word 57752 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 25304 + .word 41780 + .word 21387 + .word 41754 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 38881 + .word 54183 + .word 37931 + .word 34827 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 19650 + .word 12565 + .word 569 + .word 58514 + .word 16383 + .word 0 + .word 0 + .word 0 + .word 23916 + .word 27820 + .word 49726 + .word 50434 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 37686 + .word 17141 + .word 5720 + .word 38948 + .word 16317 + .word 0 + .word 0 + .word 0 + .type _P11,@object + .size _P11,288 + .align 2 +_Q11: + .word 14194 + .word 21345 + .word 52686 + .word 49437 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 16969 + .word 59638 + .word 1826 + .word 39310 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 28926 + .word 48282 + .word 1364 + .word 41291 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 13574 + .word 15497 + .word 63728 + .word 57349 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _Q11,@object + .size _Q11,64 + .align 2 +_P12: + .word 59330 + .word 22263 + .word 34178 + .word 51006 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 16861 + .word 21193 + .word 35273 + .word 46715 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 2103 + .word 12628 + .word 1838 + .word 41114 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 46148 + .word 53581 + .word 46203 + .word 46468 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 19710 + .word 1268 + .word 64842 + .word 38086 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 10276 + .word 59226 + .word 39596 + .word 48586 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 31029 + .word 64049 + .word 23137 + .word 50693 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 22014 + .word 1854 + .word 56980 + .word 45052 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 12740 + .word 38047 + .word 44756 + .word 35383 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 9689 + .word 42893 + .word 35756 + .word 50848 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 16570 + .word 20820 + .word 51546 + .word 34499 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 49962 + .word 36228 + .word 57995 + .word 45370 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 32489 + .word 35981 + .word 43312 + .word 58898 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 10311 + .word 12657 + .word 16405 + .word 38148 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 32504 + .word 29604 + .word 49577 + .word 49580 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 65322 + .word 54336 + .word 27403 + .word 64825 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 33227 + .word 51353 + .word 11288 + .word 42704 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 30209 + .word 39595 + .word 16790 + .word 56786 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 17645 + .word 4926 + .word 40100 + .word 38165 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 6983 + .word 2488 + .word 5292 + .word 51990 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 4652 + .word 21592 + .word 9570 + .word 36478 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 53361 + .word 14763 + .word 26464 + .word 52381 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 50485 + .word 35307 + .word 30503 + .word 59794 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 18614 + .word 21402 + .word 49824 + .word 37715 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 55547 + .word 61092 + .word 564 + .word 48870 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 9082 + .word 24716 + .word 52021 + .word 40706 + .word 16382 + .word 0 + .word 0 + .word 0 + .word 17305 + .word 30912 + .word 47308 + .word 59790 + .word 16380 + .word 0 + .word 0 + .word 0 + .type _P12,@object + .size _P12,432 + .align 2 +_val_3_0L: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _val_3_0L,@object + .size _val_3_0L,16 + .align 2 +_P20: + .word 37654 + .word 4018 + .word 25149 + .word 64448 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 19189 + .word 12397 + .word 54733 + .word 33028 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 22349 + .word 41220 + .word 13172 + .word 45200 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 43891 + .word 61784 + .word 34756 + .word 53833 + .word 16358 + .word 0 + .word 0 + .word 0 + .word 23592 + .word 62506 + .word 40671 + .word 50152 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 27771 + .word 49376 + .word 49653 + .word 53593 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 29892 + .word 65375 + .word 48818 + .word 47355 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 33664 + .word 20071 + .word 46988 + .word 35237 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 40179 + .word 47562 + .word 27113 + .word 46088 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 39977 + .word 33568 + .word 2856 + .word 39237 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 22462 + .word 11227 + .word 63692 + .word 48552 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 9895 + .word 49985 + .word 29445 + .word 35598 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 41034 + .word 13031 + .word 20740 + .word 35245 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 32927 + .word 48253 + .word 43 + .word 37376 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 5109 + .word 58801 + .word 31733 + .word 33042 + .word 16379 + .word 0 + .word 0 + .word 0 + .word 34717 + .word 51477 + .word 15888 + .word 35209 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 4166 + .word 43043 + .word 47592 + .word 42555 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 20077 + .word 289 + .word 31753 + .word 49394 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _P20,@object + .size _P20,288 + .align 2 +_val_3_875L: + .word 0 + .word 0 + .word 0 + .word 63488 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _val_3_875L,@object + .size _val_3_875L,16 + .align 2 +_P21: + .word 27895 + .word 14185 + .word 11256 + .word 61473 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 55110 + .word 27090 + .word 21413 + .word 51858 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 47481 + .word 51958 + .word 45685 + .word 44708 + .word 49121 + .word 0 + .word 0 + .word 0 + .word 53606 + .word 43192 + .word 10601 + .word 36675 + .word 49120 + .word 0 + .word 0 + .word 0 + .word 9703 + .word 39697 + .word 3773 + .word 54687 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 39016 + .word 46259 + .word 57439 + .word 47927 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 18601 + .word 64800 + .word 43294 + .word 45654 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 11755 + .word 20846 + .word 12691 + .word 36847 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 34925 + .word 21969 + .word 12496 + .word 40232 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 33074 + .word 22131 + .word 45345 + .word 58077 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 28402 + .word 30562 + .word 17788 + .word 44258 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 64431 + .word 22682 + .word 21098 + .word 38133 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 38064 + .word 47115 + .word 9737 + .word 49752 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 32940 + .word 23551 + .word 17164 + .word 63584 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 20289 + .word 55054 + .word 36724 + .word 37823 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 46434 + .word 29308 + .word 2375 + .word 53705 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 16931 + .word 9593 + .word 51956 + .word 35227 + .word 16378 + .word 0 + .word 0 + .word 0 + .type _P21,@object + .size _P21,272 + .align 2 +_P22: + .word 40244 + .word 7737 + .word 8636 + .word 43048 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 47822 + .word 28463 + .word 39991 + .word 46660 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 52293 + .word 15799 + .word 45377 + .word 51162 + .word 49113 + .word 0 + .word 0 + .word 0 + .word 37860 + .word 10494 + .word 27911 + .word 39108 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 1970 + .word 24596 + .word 57275 + .word 48105 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 64547 + .word 28877 + .word 41771 + .word 52711 + .word 16352 + .word 0 + .word 0 + .word 0 + .word 63459 + .word 4647 + .word 40018 + .word 64048 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 38817 + .word 50313 + .word 34514 + .word 41599 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 6873 + .word 59727 + .word 11575 + .word 48044 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 29515 + .word 62000 + .word 64058 + .word 40336 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 47818 + .word 19180 + .word 47066 + .word 42033 + .word 49133 + .word 0 + .word 0 + .word 0 + .word 35527 + .word 6093 + .word 4081 + .word 54678 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 16787 + .word 50723 + .word 15144 + .word 52417 + .word 16370 + .word 0 + .word 0 + .word 0 + .word 27442 + .word 31785 + .word 24103 + .word 36633 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 6233 + .word 52232 + .word 32482 + .word 57483 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 59606 + .word 43125 + .word 44255 + .word 61366 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 29998 + .word 6975 + .word 18760 + .word 53326 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 24786 + .word 2384 + .word 4789 + .word 52762 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 34816 + .word 30902 + .word 22802 + .word 44066 + .word 49086 + .word 0 + .word 0 + .word 0 + .type _P22,@object + .size _P22,304 + .align 2 +_P3: + .word 38373 + .word 25081 + .word 52784 + .word 41269 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 2433 + .word 58494 + .word 34093 + .word 49310 + .word 49089 + .word 0 + .word 0 + .word 0 + .word 20384 + .word 14386 + .word 32743 + .word 56565 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 12279 + .word 3882 + .word 34299 + .word 37877 + .word 49096 + .word 0 + .word 0 + .word 0 + .word 57529 + .word 46240 + .word 60154 + .word 40126 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 46223 + .word 16522 + .word 54101 + .word 39334 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 17152 + .word 52627 + .word 55415 + .word 33597 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 46957 + .word 15713 + .word 64890 + .word 47269 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 63416 + .word 7921 + .word 11783 + .word 63655 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 22182 + .word 52374 + .word 10257 + .word 64822 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 20533 + .word 18718 + .word 7837 + .word 41493 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 34870 + .word 43221 + .word 2667 + .word 34068 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 62446 + .word 64657 + .word 15033 + .word 39509 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 31017 + .word 38768 + .word 5018 + .word 46409 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 37858 + .word 10529 + .word 62079 + .word 49339 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 60794 + .word 51427 + .word 47345 + .word 37742 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 8999 + .word 61205 + .word 62511 + .word 36506 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 22683 + .word 43326 + .word 42314 + .word 55672 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 37536 + .word 24482 + .word 58150 + .word 50356 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 47735 + .word 57962 + .word 45199 + .word 44407 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 54502 + .word 19410 + .word 25859 + .word 39334 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 1861 + .word 57822 + .word 27975 + .word 42824 + .word 49086 + .word 0 + .word 0 + .word 0 + .type _P3,@object + .size _P3,352 + .align 2 +_P: + .word 6710 + .word 46975 + .word 45541 + .word 45018 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 47994 + .word 32334 + .word 52627 + .word 65214 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 25829 + .word 961 + .word 45314 + .word 63623 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 56740 + .word 896 + .word 13408 + .word 40400 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 60385 + .word 50719 + .word 53670 + .word 35961 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 18363 + .word 40724 + .word 30788 + .word 37641 + .word 16343 + .word 0 + .word 0 + .word 0 + .word 54199 + .word 26560 + .word 1100 + .word 63052 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 31112 + .word 47384 + .word 24910 + .word 52460 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 62051 + .word 62630 + .word 7457 + .word 41285 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 41021 + .word 16553 + .word 53133 + .word 51701 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 43336 + .word 19494 + .word 20322 + .word 38261 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 44128 + .word 40851 + .word 40287 + .word 33282 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 15978 + .word 61692 + .word 60093 + .word 46462 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 34924 + .word 34591 + .word 27618 + .word 49090 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 22325 + .word 56457 + .word 51367 + .word 65297 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 21258 + .word 62600 + .word 63264 + .word 33170 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 31459 + .word 43701 + .word 15672 + .word 42803 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 10392 + .word 64190 + .word 8847 + .word 51227 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 34244 + .word 38351 + .word 44643 + .word 65457 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 24705 + .word 53181 + .word 1549 + .word 55232 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 24274 + .word 2157 + .word 59872 + .word 44641 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 44404 + .word 52032 + .word 31206 + .word 56185 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 42376 + .word 53700 + .word 44782 + .word 63474 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 55880 + .word 43379 + .word 3093 + .word 34064 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 62288 + .word 61979 + .word 24976 + .word 35576 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 30673 + .word 34148 + .word 2010 + .word 61956 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 45192 + .word 28065 + .word 60055 + .word 61722 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 24582 + .word 59932 + .word 774 + .word 41831 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 39741 + .word 15639 + .word 29541 + .word 39821 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 32965 + .word 53765 + .word 3652 + .word 39681 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 55274 + .word 5931 + .word 14729 + .word 36200 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 4659 + .word 41741 + .word 5124 + .word 48783 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 61896 + .word 13936 + .word 31722 + .word 42885 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 29587 + .word 13947 + .word 35938 + .word 34351 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 30548 + .word 42185 + .word 15217 + .word 58709 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 32944 + .word 45803 + .word 62008 + .word 44929 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 15543 + .word 17819 + .word 22981 + .word 37733 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 40787 + .word 12944 + .word 27687 + .word 34273 + .word 49144 + .word 0 + .word 0 + .word 0 + .word 14474 + .word 51712 + .word 20794 + .word 57241 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 31505 + .word 44115 + .word 25843 + .word 56405 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 29537 + .word 33343 + .word 23367 + .word 43948 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 15837 + .word 34931 + .word 8097 + .word 48214 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 1126 + .word 23018 + .word 59367 + .word 62418 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 50591 + .word 16203 + .word 45917 + .word 57446 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 6095 + .word 44294 + .word 16725 + .word 34699 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 2346 + .word 25530 + .word 14073 + .word 51139 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 48724 + .word 10078 + .word 7882 + .word 59578 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 3077 + .word 7734 + .word 24746 + .word 33688 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 52085 + .word 9505 + .word 49832 + .word 37954 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 41663 + .word 47247 + .word 238 + .word 62191 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 48361 + .word 39255 + .word 14492 + .word 33999 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 35816 + .word 34414 + .word 54424 + .word 37185 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 20077 + .word 189 + .word 48758 + .word 39656 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 35728 + .word 48114 + .word 41225 + .word 51144 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 10943 + .word 64308 + .word 2314 + .word 53541 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 32154 + .word 56468 + .word 40039 + .word 32925 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 4941 + .word 52917 + .word 35073 + .word 34082 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 61194 + .word 15048 + .word 42139 + .word 49938 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 19128 + .word 18289 + .word 6860 + .word 51502 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 49300 + .word 58708 + .word 59005 + .word 55071 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 26502 + .word 47642 + .word 36933 + .word 42964 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 30051 + .word 60756 + .word 30625 + .word 41460 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 61015 + .word 15762 + .word 48007 + .word 60846 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 21975 + .word 20753 + .word 22643 + .word 48677 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 54246 + .word 4624 + .word 38600 + .word 33572 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 59379 + .word 53723 + .word 32353 + .word 42607 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 40791 + .word 16038 + .word 57576 + .word 57139 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 25939 + .word 3603 + .word 54023 + .word 55128 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 7176 + .word 58381 + .word 25669 + .word 36047 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 23057 + .word 6107 + .word 22526 + .word 49962 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 19351 + .word 39386 + .word 35003 + .word 63923 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 45293 + .word 12882 + .word 9948 + .word 58748 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 20001 + .word 20829 + .word 53529 + .word 36918 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 21919 + .word 49831 + .word 37577 + .word 39856 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 47026 + .word 46471 + .word 55318 + .word 49443 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 61519 + .word 51459 + .word 6950 + .word 50870 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 1555 + .word 2971 + .word 23597 + .word 62610 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 45926 + .word 36681 + .word 39043 + .word 38451 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 64160 + .word 21923 + .word 31542 + .word 47202 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 36569 + .word 36429 + .word 41036 + .word 40257 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 63272 + .word 57206 + .word 4215 + .word 41813 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 38880 + .word 42175 + .word 14999 + .word 35837 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 42787 + .word 9806 + .word 63168 + .word 59020 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 31095 + .word 14929 + .word 48209 + .word 41580 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 36413 + .word 27679 + .word 45695 + .word 64718 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 24761 + .word 31380 + .word 27544 + .word 35930 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 11221 + .word 62995 + .word 50975 + .word 54692 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 29668 + .word 1933 + .word 17144 + .word 45888 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 30810 + .word 24149 + .word 32113 + .word 34254 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 34856 + .word 24408 + .word 21475 + .word 41075 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 33943 + .word 23810 + .word 62559 + .word 60314 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 3305 + .word 24934 + .word 37437 + .word 47776 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 54895 + .word 55211 + .word 32000 + .word 34613 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 35009 + .word 47065 + .word 21660 + .word 64281 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 9852 + .word 9156 + .word 55656 + .word 46121 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 36442 + .word 41210 + .word 20060 + .word 40802 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 21758 + .word 47322 + .word 2788 + .word 58210 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 52348 + .word 9004 + .word 18276 + .word 61559 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 54786 + .word 7147 + .word 27070 + .word 43826 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 34268 + .word 15768 + .word 2480 + .word 60089 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 1157 + .word 52048 + .word 20458 + .word 40588 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 51540 + .word 48806 + .word 47292 + .word 62380 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 19999 + .word 57758 + .word 46120 + .word 57112 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 21459 + .word 54484 + .word 23863 + .word 35854 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 28754 + .word 5362 + .word 55327 + .word 62303 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 45243 + .word 6687 + .word 17114 + .word 61365 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 32048 + .word 1009 + .word 39781 + .word 52368 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 64584 + .word 3308 + .word 26412 + .word 38818 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 23088 + .word 38547 + .word 22659 + .word 65247 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 14061 + .word 22418 + .word 61292 + .word 34447 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 57848 + .word 26921 + .word 61797 + .word 57155 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 1597 + .word 31414 + .word 38572 + .word 39774 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 30034 + .word 27108 + .word 16687 + .word 65316 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 32265 + .word 44536 + .word 9779 + .word 53216 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 550 + .word 16407 + .word 19715 + .word 43369 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 7132 + .word 1973 + .word 39654 + .word 33659 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 19090 + .word 42384 + .word 19608 + .word 54616 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 29916 + .word 8899 + .word 53582 + .word 50715 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 63987 + .word 34002 + .word 32751 + .word 41084 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 31930 + .word 50610 + .word 35321 + .word 40669 + .word 49085 + .word 0 + .word 0 + .word 0 + .word 64556 + .word 32042 + .word 47688 + .word 39353 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 22761 + .word 33268 + .word 25802 + .word 54704 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 48596 + .word 35082 + .word 36228 + .word 55222 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 62834 + .word 26257 + .word 62649 + .word 62428 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 22216 + .word 57771 + .word 11637 + .word 59993 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 32841 + .word 24077 + .word 25618 + .word 53031 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 7134 + .word 15474 + .word 25724 + .word 50216 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 679 + .word 61058 + .word 8963 + .word 33314 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 30607 + .word 23707 + .word 50236 + .word 62315 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 57112 + .word 44811 + .word 22996 + .word 58760 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 7925 + .word 14145 + .word 19419 + .word 54389 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 15063 + .word 11101 + .word 53306 + .word 33747 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 17212 + .word 63840 + .word 49608 + .word 61962 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 64221 + .word 2367 + .word 56115 + .word 44976 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 25958 + .word 42476 + .word 21228 + .word 41045 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 39160 + .word 29939 + .word 20970 + .word 56757 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 34212 + .word 35958 + .word 8729 + .word 51611 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 47817 + .word 56326 + .word 46415 + .word 42719 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 14697 + .word 51278 + .word 14116 + .word 38800 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 42056 + .word 1202 + .word 6817 + .word 52251 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 9811 + .word 3897 + .word 54180 + .word 38147 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 22279 + .word 36400 + .word 23268 + .word 48339 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 3604 + .word 63501 + .word 23839 + .word 53404 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 1179 + .word 37183 + .word 50892 + .word 54850 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 59751 + .word 27404 + .word 14795 + .word 57826 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 14718 + .word 11779 + .word 34360 + .word 46330 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 59705 + .word 41619 + .word 32041 + .word 48245 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 23030 + .word 54615 + .word 27535 + .word 57905 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 39169 + .word 62610 + .word 58529 + .word 59687 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 51398 + .word 44311 + .word 12717 + .word 50833 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 27431 + .word 2954 + .word 22657 + .word 51954 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 58296 + .word 29685 + .word 27243 + .word 58169 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 51216 + .word 48206 + .word 42318 + .word 59054 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 56132 + .word 37000 + .word 55250 + .word 38652 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 33362 + .word 39562 + .word 49329 + .word 39051 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 45334 + .word 5673 + .word 58520 + .word 48690 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 35653 + .word 20625 + .word 33642 + .word 49050 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 58051 + .word 8993 + .word 6809 + .word 36624 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 52356 + .word 59873 + .word 62958 + .word 36858 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 32142 + .word 25405 + .word 33867 + .word 33307 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 49519 + .word 13151 + .word 56037 + .word 36991 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 44868 + .word 63207 + .word 24006 + .word 43028 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 8083 + .word 45145 + .word 39702 + .word 51683 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 45111 + .word 52725 + .word 38011 + .word 48603 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 60521 + .word 20244 + .word 23464 + .word 55814 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 20556 + .word 16261 + .word 38082 + .word 40872 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 25337 + .word 58099 + .word 56911 + .word 46447 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 37285 + .word 19168 + .word 56812 + .word 50878 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 15949 + .word 20065 + .word 40118 + .word 57328 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 40507 + .word 40248 + .word 14830 + .word 44509 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 5104 + .word 24529 + .word 29756 + .word 49797 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 46472 + .word 25780 + .word 5432 + .word 50788 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 15446 + .word 10547 + .word 15373 + .word 56506 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 3213 + .word 104 + .word 59551 + .word 33676 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 34009 + .word 54843 + .word 32265 + .word 37318 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 45472 + .word 58672 + .word 64591 + .word 42366 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 32200 + .word 21528 + .word 8481 + .word 46835 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 49716 + .word 3176 + .word 29068 + .word 63703 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 39156 + .word 24341 + .word 43754 + .word 35182 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 61730 + .word 30329 + .word 55010 + .word 38388 + .word 16320 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,2880 + .align 2 +_P0: + .word 46060 + .word 21479 + .word 19707 + .word 37102 + .word 16345 + .word 0 + .word 0 + .word 0 + .word 35676 + .word 11242 + .word 15120 + .word 54134 + .word 49120 + .word 0 + .word 0 + .word 0 + .word 34641 + .word 49003 + .word 21090 + .word 56946 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 36501 + .word 52298 + .word 48288 + .word 40780 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 2947 + .word 56486 + .word 859 + .word 36145 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 6106 + .word 41115 + .word 36319 + .word 33709 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 13230 + .word 6676 + .word 23048 + .word 46558 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 62532 + .word 24192 + .word 46286 + .word 38694 + .word 49147 + .word 0 + .word 0 + .word 0 + .type _P0,@object + .size _P0,128 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _tonpi,@object + .size _tonpi,16 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,16 + .align 2 +_PP: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP,@object + .size _PP,160 + .align 2 +_QP: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .word 0 + .word 0 + .type _QP,@object + .size _QP,160 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/y0f.S b/external/sgx_libm/intel64/y0f.S new file mode 100644 index 0000000000..c9f3efb8d0 --- /dev/null +++ b/external/sgx_libm/intel64/y0f.S @@ -0,0 +1,805 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y0f.c" + .text +..TXTST0: +# -- Begin y0f + .text + .align 16,0x90 + .globl y0f +y0f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_y0f.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movd %xmm0, %ecx + movss %xmm0, 48(%rsp) + lea -1(%rcx), %eax + cmpl $2139095039, %eax + jae ..B1.13 +..B1.2: + cmpl $1099978979, %ecx + jae ..B1.21 +..B1.3: + cmpl $1094450314, %ecx + jae ..B1.12 +..B1.4: + cmpl $1085128690, %ecx + jae ..B1.11 +..B1.5: + cmpl $1074568695, %ecx + jae ..B1.10 +..B1.6: + cmpl $1058642330, %ecx + jb ..B1.8 +..B1.7: + cvtss2sd %xmm0, %xmm0 + lea 168+_P1(%rip), %rax + lea 160+_P1(%rip), %rdx + lea 144+_P1(%rip), %r9 + lea 128+_P1(%rip), %rcx + lea 112+_P1(%rip), %r10 + lea 96+_P1(%rip), %rsi + lea 80+_P1(%rip), %r11 + lea 64+_P1(%rip), %rdi + movsd (%rdx), %xmm6 + lea 32+_P1(%rip), %r8 + movsd (%r9), %xmm1 + lea 16+_P1(%rip), %rdx + lea 56+_P1(%rip), %r9 + subsd (%rax), %xmm0 + movaps %xmm0, %xmm2 + lea 48+_P1(%rip), %rax + mulsd %xmm0, %xmm2 + movaps %xmm2, %xmm3 + mulsd %xmm2, %xmm3 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm1 + addsd (%rcx), %xmm6 + addsd (%r10), %xmm1 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm1 + addsd (%rsi), %xmm6 + addsd (%r11), %xmm1 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm1 + addsd (%rdi), %xmm6 + addsd (%rax), %xmm1 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm1 + addsd (%r8), %xmm6 + addsd (%rdx), %xmm1 + mulsd %xmm3, %xmm6 + mulsd %xmm2, %xmm1 + lea 152+_P1(%rip), %rsi + lea 136+_P1(%rip), %r11 + lea 120+_P1(%rip), %rdi + lea 104+_P1(%rip), %rax + lea 88+_P1(%rip), %r8 + lea 72+_P1(%rip), %rdx + lea _P1(%rip), %rcx + lea 24+_P1(%rip), %r10 + movsd (%rsi), %xmm5 + lea 8+_P1(%rip), %rsi + mulsd %xmm3, %xmm5 + addsd %xmm1, %xmm6 + movsd (%r11), %xmm4 + mulsd %xmm3, %xmm4 + addsd (%rdi), %xmm5 + addsd (%rcx), %xmm6 + mulsd %xmm3, %xmm5 + addsd (%rax), %xmm4 + mulsd %xmm3, %xmm4 + addsd (%r8), %xmm5 + mulsd %xmm3, %xmm5 + addsd (%rdx), %xmm4 + mulsd %xmm3, %xmm4 + addsd (%r9), %xmm5 + lea 40+_P1(%rip), %rcx + mulsd %xmm3, %xmm5 + addsd (%rcx), %xmm4 + addsd (%r10), %xmm5 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm4 + mulsd %xmm0, %xmm5 + mulsd %xmm0, %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.8: + pxor %xmm3, %xmm3 + cvtss2sd 48(%rsp), %xmm3 + movaps %xmm3, %xmm0 + movsd %xmm3, (%rsp) +..___tag_value_y0f.6: + call __libm_log_k32@PLT +..___tag_value_y0f.7: +..B1.25: + movsd (%rsp), %xmm3 +..B1.9: + mulsd %xmm3, %xmm3 + lea _tonpi(%rip), %rax + movaps %xmm3, %xmm2 + lea 32+_Q1(%rip), %rdx + lea 24+_Q2(%rip), %r9 + lea 16+_Q2(%rip), %r11 + mulsd %xmm3, %xmm2 + lea 24+_Q1(%rip), %rdi + movsd (%rax), %xmm6 + lea 16+_Q1(%rip), %rcx + mulsd %xmm0, %xmm6 + lea 8+_Q2(%rip), %r10 + movsd (%rdx), %xmm0 + lea _Q2(%rip), %rax + movsd (%r9), %xmm5 + lea 8+_Q1(%rip), %r8 + movsd (%r11), %xmm4 + lea _Q1(%rip), %rsi + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm4 + addsd (%rcx), %xmm0 + addsd (%r10), %xmm5 + addsd (%rax), %xmm4 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + mulsd %xmm3, %xmm4 + addsd (%rsi), %xmm0 + addsd %xmm4, %xmm5 + movsd (%rdi), %xmm1 + mulsd %xmm2, %xmm1 + mulsd %xmm6, %xmm5 + addsd (%r8), %xmm1 + mulsd %xmm3, %xmm1 + addsd %xmm1, %xmm0 + addsd %xmm5, %xmm0 + addsd %xmm6, %xmm0 + cvtsd2ss %xmm0, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.10: + pxor %xmm0, %xmm0 + lea 144+_P2(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + lea 136+_P2(%rip), %rdx + lea 120+_P2(%rip), %r9 + lea 104+_P2(%rip), %rcx + lea 88+_P2(%rip), %r10 + lea 72+_P2(%rip), %rsi + lea 56+_P2(%rip), %r11 + lea 40+_P2(%rip), %rdi + lea 8+_P2(%rip), %r8 + movsd (%rdx), %xmm6 + lea 128+_P2(%rip), %rdx + movsd (%r9), %xmm1 + lea 112+_P2(%rip), %r9 + subsd (%rax), %xmm0 + lea 24+_P2(%rip), %rax + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + addsd (%rcx), %xmm6 + addsd (%r10), %xmm1 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + addsd (%rsi), %xmm6 + addsd (%r11), %xmm1 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + addsd (%rdi), %xmm6 + addsd (%rax), %xmm1 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm1 + addsd (%r8), %xmm6 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm6 + movsd (%rdx), %xmm5 + lea 96+_P2(%rip), %rcx + mulsd %xmm2, %xmm5 + lea 80+_P2(%rip), %r10 + addsd %xmm1, %xmm6 + addsd (%rcx), %xmm5 + movsd (%r9), %xmm4 + lea 64+_P2(%rip), %rsi + mulsd %xmm2, %xmm4 + lea 48+_P2(%rip), %r11 + mulsd %xmm2, %xmm5 + addsd (%r10), %xmm4 + addsd (%rsi), %xmm5 + mulsd %xmm2, %xmm4 + mulsd %xmm2, %xmm5 + addsd (%r11), %xmm4 + lea 32+_P2(%rip), %rdi + lea 16+_P2(%rip), %rax + mulsd %xmm2, %xmm4 + lea _P2(%rip), %r8 + addsd (%rdi), %xmm5 + addsd (%rax), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm3, %xmm4 + addsd (%r8), %xmm5 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.11: + cmpl $1091143997, %ecx + pxor %xmm0, %xmm0 + lea _P3(%rip), %rdx + lea _P4(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + jb ..L12 + movq %rax, %rdx +..L12: + movsd 104(%rdx), %xmm6 + movsd 88(%rdx), %xmm1 + movsd 96(%rdx), %xmm5 + movsd 80(%rdx), %xmm4 + subsd 112(%rdx), %xmm0 + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd 72(%rdx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 56(%rdx), %xmm1 + addsd 64(%rdx), %xmm5 + mulsd %xmm2, %xmm6 + addsd 48(%rdx), %xmm4 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd 40(%rdx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 24(%rdx), %xmm1 + addsd 32(%rdx), %xmm5 + mulsd %xmm2, %xmm6 + addsd 16(%rdx), %xmm4 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm5 + addsd 8(%rdx), %xmm6 + mulsd %xmm3, %xmm4 + mulsd %xmm0, %xmm1 + addsd (%rdx), %xmm5 + mulsd %xmm0, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm1, %xmm6 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + cmpl $1097751532, %ecx + pxor %xmm3, %xmm3 + lea _P5(%rip), %rdx + lea _P6(%rip), %rax + cvtss2sd 48(%rsp), %xmm3 + jb ..L15 + movq %rax, %rdx +..L15: + movsd 80(%rdx), %xmm6 + movsd 88(%rdx), %xmm5 + movsd 96(%rdx), %xmm0 + movsd 72(%rdx), %xmm4 + subsd 104(%rdx), %xmm3 + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm0 + addsd 48(%rdx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 56(%rdx), %xmm5 + addsd 64(%rdx), %xmm0 + mulsd %xmm2, %xmm6 + addsd 40(%rdx), %xmm4 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm0 + addsd 16(%rdx), %xmm6 + mulsd %xmm2, %xmm4 + addsd 24(%rdx), %xmm5 + addsd 32(%rdx), %xmm0 + mulsd %xmm1, %xmm6 + addsd 8(%rdx), %xmm4 + mulsd %xmm1, %xmm5 + mulsd %xmm2, %xmm0 + addsd (%rdx), %xmm6 + mulsd %xmm3, %xmm4 + mulsd %xmm3, %xmm5 + addsd %xmm0, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.13: + movl %ecx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.20 +..B1.14: + testl %eax, %eax + je ..B1.19 +..B1.15: + testl $-2147483648, %ecx + pxor %xmm0, %xmm0 + je ..B1.18 +..B1.16: + movss .L_2il0floatpacket.1(%rip), %xmm1 + mulss %xmm1, %xmm0 +..B1.18: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.19: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.20: + movss 48(%rsp), %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.21: + pxor %xmm0, %xmm0 + lea _val_16_0(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + movsd .L_2il0floatpacket.2(%rip), %xmm1 + lea (%rsp), %rdi + divsd %xmm0, %xmm1 + movsd (%rax), %xmm2 + lea 8(%rsp), %rsi + mulsd %xmm1, %xmm2 + movl $-1, %edx + movsd %xmm2, 8(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm2, 24(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm1, 16(%rsi) + movsd %xmm2, 32(%rsi) +..___tag_value_y0f.24: + call __libm_sincos_k32@PLT +..___tag_value_y0f.25: +..B1.22: + lea 40+_QP(%rip), %r10 + lea 40+_PP(%rip), %rdx + movsd 40(%rsp), %xmm2 + lea 24+_QP(%rip), %r11 + lea 24+_PP(%rip), %rcx + lea 32+_PP(%rip), %rdi + lea _tonpi(%rip), %rax + lea 16+_PP(%rip), %r8 + movsd (%r10), %xmm5 + lea 8+_PP(%rip), %rsi + movsd (%rdx), %xmm6 + lea 32+_QP(%rip), %rdx + mulsd %xmm2, %xmm5 + lea _PP(%rip), %r9 + mulsd %xmm2, %xmm6 + addsd (%r11), %xmm5 + addsd (%rcx), %xmm6 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm6 + movsd (%rdx), %xmm4 + lea 16+_QP(%rip), %rcx + mulsd %xmm2, %xmm4 + addsd (%rsi), %xmm6 + movsd (%rdi), %xmm1 + lea _QP(%rip), %rsi + mulsd %xmm2, %xmm1 + addsd (%rcx), %xmm4 + movsd (%rax), %xmm0 + lea 8+_QP(%rip), %rax + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm1 + mulsd 24(%rsp), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm1 + addsd (%rsi), %xmm4 + sqrtsd %xmm0, %xmm0 + addsd (%r9), %xmm1 + movsd 32(%rsp), %xmm3 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm1, %xmm6 + mulsd 16(%rsp), %xmm5 + mulsd (%rsp), %xmm6 + mulsd 8(%rsp), %xmm5 + addsd %xmm5, %xmm6 + mulsd %xmm6, %xmm0 + cvtsd2ss %xmm0, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type y0f,@function + .size y0f,.-y0f + .data +# -- End y0f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x7f800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_P1: + .long 4195291908 + .long 3162175307 + .long 406986291 + .long 1072440375 + .long 2776221165 + .long 3219095096 + .long 1133938471 + .long 1070349075 + .long 2954828429 + .long 3217879437 + .long 2763399148 + .long 1070335612 + .long 808830809 + .long 3217701246 + .long 1570268664 + .long 1070154462 + .long 3296077481 + .long 3217609508 + .long 420330990 + .long 1070118798 + .long 773510171 + .long 3217614074 + .long 4056659129 + .long 1070174592 + .long 3219431954 + .long 3217750970 + .long 3785879815 + .long 1070358232 + .long 574751405 + .long 3217779900 + .long 4260549547 + .long 1069957964 + .long 2938320462 + .long 3216782740 + .long 3378329138 + .long 1068120728 + .long 1915664650 + .long 3213929269 + .long 3426344990 + .long 1063895342 + .long 349103460 + .long 3207738231 + .long 3100907498 + .long 1072470062 + .type _P1,@object + .size _P1,176 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_Q1: + .long 2580172613 + .long 3216172246 + .long 1084453148 + .long 1069988811 + .long 2056290550 + .long 3213915569 + .long 1236657422 + .long 1061266913 + .long 2321867150 + .long 3202594720 + .type _Q1,@object + .size _Q1,40 + .align 4 +_Q2: + .long 4294648676 + .long 3218079743 + .long 3841535415 + .long 1066401791 + .long 664070481 + .long 3208409496 + .long 1981210199 + .long 1054621065 + .type _Q2,@object + .size _Q2,32 + .align 4 +_P2: + .long 1454683265 + .long 3163093641 + .long 1453379447 + .long 3218719554 + .long 687601567 + .long 1068108233 + .long 2612704149 + .long 1068365525 + .long 3658933664 + .long 3212579183 + .long 2932711330 + .long 3210863403 + .long 1642366143 + .long 1059690534 + .long 3271323791 + .long 1057665714 + .long 1907282597 + .long 3201598976 + .long 379771377 + .long 3197347542 + .long 4245487245 + .long 3193415108 + .long 3608497393 + .long 1045674492 + .long 2931231697 + .long 3190739602 + .long 990015633 + .long 1041359383 + .long 1316300206 + .long 3186258158 + .long 3640313785 + .long 3183477336 + .long 2399178872 + .long 3182342144 + .long 1279629276 + .long 1034489495 + .long 1301829276 + .long 1074768211 + .type _P2,@object + .size _P2,152 + .align 4 +_P3: + .long 2564005090 + .long 1014927793 + .long 2691273771 + .long 1070806220 + .long 300870104 + .long 3214257910 + .long 1691761700 + .long 3215496860 + .long 2795355208 + .long 1063989012 + .long 2286168356 + .long 1063375710 + .long 3010782666 + .long 3206704598 + .long 629642940 + .long 3204978559 + .long 4085313989 + .long 1053206786 + .long 1695842824 + .long 1050888907 + .long 399213285 + .long 3194002865 + .long 3012936744 + .long 3191097259 + .long 3874678520 + .long 1039019405 + .long 2821019721 + .long 1035940102 + .long 3303481603 + .long 1075599389 + .type _P3,@object + .size _P3,120 + .align 4 +_P4: + .long 3357785889 + .long 3165432791 + .long 3430075659 + .long 3218077237 + .long 1374220014 + .long 1065943908 + .long 2803440381 + .long 1067771495 + .long 3788987270 + .long 3210752606 + .long 378839180 + .long 3210732089 + .long 3385429871 + .long 1058535500 + .long 2609792408 + .long 1057402845 + .long 2316098656 + .long 3200270393 + .long 2785606124 + .long 3198332594 + .long 1489685130 + .long 1046034133 + .long 973177683 + .long 1043605688 + .long 113866720 + .long 3186126026 + .long 1355313597 + .long 3183357512 + .long 899972440 + .long 1076130263 + .type _P4,@object + .size _P4,120 + .align 4 +_P5: + .long 1219042543 + .long 1017436670 + .long 659497129 + .long 1070330666 + .long 2213395954 + .long 3212885037 + .long 920472610 + .long 3215092907 + .long 483400048 + .long 1062596670 + .long 3012498212 + .long 1063037606 + .long 1375970636 + .long 3205547500 + .long 3836089736 + .long 3204771982 + .long 199192965 + .long 1052233910 + .long 194857414 + .long 1050781561 + .long 2407988550 + .long 3193126966 + .long 3806101946 + .long 3190982557 + .long 3164279536 + .long 1038193510 + .long 3298944842 + .long 1076541665 + .type _P5,@object + .size _P5,112 + .align 4 +_P6: + .long 4139807906 + .long 1017960487 + .long 1501500641 + .long 3217630659 + .long 2447579003 + .long 1064854100 + .long 511348540 + .long 1067492433 + .long 1810619958 + .long 3209696179 + .long 1806624601 + .long 3210355872 + .long 4035698547 + .long 1057552651 + .long 467530437 + .long 1057185016 + .long 2985801821 + .long 3199346510 + .long 2460583618 + .long 3198194818 + .long 4117830692 + .long 1045310355 + .long 1133672721 + .long 1043441078 + .long 2717688296 + .long 3185336108 + .long 1946169876 + .long 1076920380 + .type _P6,@object + .size _P6,112 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_QP: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP,@object + .size _QP,48 + .align 4 +_PP: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP,@object + .size _PP,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/y0l.S b/external/sgx_libm/intel64/y0l.S new file mode 100644 index 0000000000..1443a25af1 --- /dev/null +++ b/external/sgx_libm/intel64/y0l.S @@ -0,0 +1,86 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y0l.c" + .text +..TXTST0: +# -- Begin y0l + .text + .align 16,0x90 + .globl y0l +y0l: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_y0l.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 48 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B1.6: + addq $16, %rsp + .cfi_def_cfa_offset 32 + movaps (%rsp), %xmm0 +..___tag_value_y0l.6: + call __y0q@PLT +..___tag_value_y0l.7: +..B1.2: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type y0l,@function + .size y0l,.-y0l + .data +# -- End y0l + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/y1.S b/external/sgx_libm/intel64/y1.S new file mode 100644 index 0000000000..c7fdf10f2f --- /dev/null +++ b/external/sgx_libm/intel64/y1.S @@ -0,0 +1,3354 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y1.c" + .text +..TXTST0: +# -- Begin y1 + .text + .align 16,0x90 + .globl y1 +y1: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_y1.1: +..L2: + + pushq %r15 + .cfi_def_cfa_offset 16 + .cfi_offset 15, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + xorb %r15b, %r15b + movsd %xmm0, (%rsp) +..B1.2: + fnstcw 10(%rsp) +..B1.3: + movl 4(%rsp), %eax + movl %eax, %ecx + andl $2147483647, %ecx + cmpl $2146435072, %ecx + jge ..B1.13 +..B1.4: + cmpq $0, (%rsp) + jle ..B1.19 +..B1.5: + movzwl 10(%rsp), %edx + movl %edx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.9 +..B1.6: + orl $-64768, %edx + movw %dx, 8(%rsp) +..B1.7: + fldcw 8(%rsp) +..B1.8: + movb $1, %r15b +..B1.9: + addq $-16, %rsp + .cfi_def_cfa_offset 48 + fldl 16(%rsp) + fstpt (%rsp) +..___tag_value_y1.7: + call __y1l@PLT +..___tag_value_y1.8: +..B1.25: + addq $16, %rsp + .cfi_def_cfa_offset 32 +..B1.10: + fstpl (%rsp) + testb %r15b, %r15b + movsd (%rsp), %xmm0 + je ..B1.12 +..B1.11: + fldcw 10(%rsp) +..B1.12: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 15, -16 +..B1.13: + andl $-2146435073, %ecx + orl (%rsp), %ecx + jne ..B1.18 +..B1.14: + testl $-2147483648, %eax + je ..B1.16 +..B1.15: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 15, -16 +..B1.16: + lea _zeros(%rip), %rdx + shrl $31, %eax + movsd (%rdx,%rax,8), %xmm0 +..B1.17: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 15, -16 +..B1.18: + movsd (%rsp), %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 15, -16 +..B1.19: + lea _zeros(%rip), %rax + movl (%rsp), %edx + orl %edx, %ecx + movsd (%rax), %xmm1 + je ..B1.21 +..B1.20: + lea _infs(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm1, %xmm0 + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 32 + .cfi_offset 15, -16 +..B1.21: + lea 8+_ones(%rip), %rax + movsd (%rax), %xmm0 + divsd %xmm1, %xmm0 +..B1.22: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type y1,@function + .size y1,.-y1 + .data +# -- End y1 + .text +# -- Begin __y1l + .text + .align 16,0x90 + .globl __y1l +__y1l: +# parameter 1: 96 + %rsp +..B2.1: + .cfi_startproc +..___tag_value___y1l.39: +..L40: + + subq $88, %rsp + .cfi_def_cfa_offset 96 + lea 176+_S(%rip), %rax + fldt 96(%rsp) + fldt (%rax) + fcomip %st(1), %st + jb ..B2.14 +..B2.2: + lea _val_1_77L(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + ja ..B2.12 +..B2.3: + lea _S(%rip), %rcx + fldt (%rcx) + fcomip %st(1), %st + jbe ..B2.5 +..B2.4: + lea _Z(%rip), %rax + lea _P1(%rip), %rdx + lea 16+_P1(%rip), %rcx + lea _Q1(%rip), %rsi + lea 32+_P1(%rip), %rdi + lea 48+_P1(%rip), %r8 + lea 16+_Q1(%rip), %r9 + fldt (%rax) + lea 64+_P1(%rip), %r10 + lea 80+_P1(%rip), %r11 + lea 32+_Q1(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 96+_P1(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 112+_P1(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 48+_Q1(%rip), %rsi + fmul %st(4), %st + fldt (%rdi) + lea 128+_P1(%rip), %rdi + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r8) + lea 144+_P1(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r9) + lea 64+_Q1(%rip), %r9 + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt (%r10) + lea 160+_P1(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + lea 176+_P1(%rip), %r11 + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rax) + lea 80+_Q1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%rdx) + lea _ones(%rip), %rdx + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rcx) + lea 192+_P1(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rsi) + lea 208+_P1(%rip), %rsi + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt (%rdi) + lea 224+_P1(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r8) + lea 240+_P1(%rip), %r8 + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(3) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fdivrl (%rdx) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B2.19 +..B2.5: + lea 16+_S(%rip), %rax + fldt (%rax) + fcomip %st(1), %st + jbe ..B2.7 +..B2.6: + lea 16+_Z(%rip), %rax + lea _P2(%rip), %rdx + lea 16+_P2(%rip), %rcx + lea _Q2(%rip), %rsi + lea 32+_P2(%rip), %rdi + lea 48+_P2(%rip), %r8 + lea 16+_Q2(%rip), %r9 + fldt (%rax) + lea 64+_P2(%rip), %r10 + lea 80+_P2(%rip), %r11 + lea 32+_Q2(%rip), %rax + fsubrp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt (%rdx) + lea 96+_P2(%rip), %rdx + fmul %st(1), %st + fldt (%rcx) + lea 112+_P2(%rip), %rcx + fmul %st(2), %st + fldt (%rsi) + lea 48+_Q2(%rip), %rsi + fmul %st(4), %st + fldt (%rdi) + lea 128+_P2(%rip), %rdi + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r8) + lea 144+_P2(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r9) + lea 64+_Q2(%rip), %r9 + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt (%r10) + lea 160+_P2(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + lea 176+_P2(%rip), %r11 + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rax) + lea 80+_Q2(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%rdx) + lea _ones(%rip), %rdx + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%rcx) + lea 192+_P2(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rsi) + lea 208+_P2(%rip), %rsi + faddp %st, %st(3) + fxch %st(2) + fmul %st(4), %st + fldt (%rdi) + lea 224+_P2(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r8) + lea 240+_P2(%rip), %r8 + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(3) + fxch %st(2) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + faddp %st, %st(3) + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fxch %st(2) + fdivrl (%rdx) + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(3) + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + faddp %st, %st(2) + fmulp %st, %st(1) + jmp ..B2.19 +..B2.7: + movl $2, %edx + movl $32, %eax +..B2.8: + fldt (%rax,%rcx) + fcomip %st(1), %st + ja ..B2.11 + jp ..B2.11 +..B2.9: + incq %rdx + addq $16, %rax + cmpq $11, %rdx + jl ..B2.8 +..B2.10: + movq %rdx, %rax + shlq $4, %rax +..B2.11: + lea _Z(%rip), %rcx + fldt (%rax,%rcx) + lea (%rdx,%rdx,4), %rax + shlq $6, %rax + fsubrp %st, %st(1) + fld %st(0) + lea _P(%rip), %rdx + fmul %st(1), %st + fstpt 64(%rsp) + fldt 64(%rsp) + fldt -640(%rax,%rdx) + fmul %st(1), %st + fldt -624(%rax,%rdx) + fmul %st(2), %st + fldt -608(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -592(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -576(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -560(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -544(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -528(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -512(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -496(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -480(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -464(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -448(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -432(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -416(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -400(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -384(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt -368(%rax,%rdx) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt -352(%rax,%rdx) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt -336(%rax,%rdx) + faddp %st, %st(1) + faddp %st, %st(1) + jmp ..B2.19 +..B2.12: + fld %st(0) + lea _P0(%rip), %rax + fmul %st(1), %st + lea 16+_P0(%rip), %rdx + fxch %st(1) + fld %st(1) + lea 32+_P0(%rip), %rcx + fmul %st(2), %st + lea 48+_P0(%rip), %rsi + lea 64+_P0(%rip), %rdi + lea 80+_P0(%rip), %r8 + lea 96+_P0(%rip), %r9 + lea 112+_P0(%rip), %r10 + lea 128+_P0(%rip), %r11 + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(2) + fstpt 64(%rsp) + fldt 64(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rax) + lea 144+_P0(%rip), %rax + fmul %st(3), %st + fldt (%rdx) + fmul %st(4), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(4), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(4) + fldt (%r11) + faddp %st, %st(1) + fmulp %st, %st(2) + fldt (%rax) + faddp %st, %st(3) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rsp) +..___tag_value___y1l.43: + call __j1l@PLT +..___tag_value___y1l.44: +..B2.23: + fldt 112(%rsp) + fldt 16(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 96 +..B2.13: + fxch %st(1) + fstl 40(%rsp) + fstp %st(0) + movsd 40(%rsp), %xmm0 + fxch %st(1) + fstpt 16(%rsp) + fstpt (%rsp) + call log@PLT +..B2.24: + fldt 96(%rsp) + lea _val_N1_0L(%rip), %rdx + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt 16(%rsp) + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fldt (%rdx) + fdivp %st, %st(4) + fxch %st(3) + faddp %st, %st(1) + fmulp %st, %st(2) + faddp %st, %st(1) + jmp ..B2.19 +..B2.14: + lea _ones(%rip), %rax + lea _val_36_0L(%rip), %rdx + lea _PP(%rip), %rcx + lea _QP(%rip), %rsi + lea 16+_PP(%rip), %rdi + lea 16+_QP(%rip), %r8 + lea 32+_PP(%rip), %r9 + lea 32+_QP(%rip), %r10 + fldl (%rax) + lea 48+_PP(%rip), %r11 + fdiv %st(1), %st + lea 48+_QP(%rip), %rax + fxch %st(1) + fxch %st(1) + fstpt (%rsp) + fldt (%rsp) + fldt (%rdx) + lea 64+_PP(%rip), %rdx + fmulp %st, %st(1) + fld %st(0) + fmul %st(1), %st + fstpt 48(%rsp) + fldt 48(%rsp) + fxch %st(1) + fstpt 64(%rsp) + fldt 64(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + fxch %st(2) + fstpt (%rsp) + fldt (%rcx) + lea 64+_QP(%rip), %rcx + fmul %st(1), %st + fldt (%rsi) + lea 80+_PP(%rip), %rsi + fmul %st(2), %st + fldt (%rdi) + lea 80+_QP(%rip), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + lea 96+_PP(%rip), %r8 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + lea 96+_QP(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + lea 112+_PP(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + lea 112+_QP(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_PP(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + lea 128+_QP(%rip), %rdx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rcx) + lea 144+_PP(%rip), %rcx + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rsi) + lea 144+_QP(%rip), %rsi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdi) + lea 80(%rsp), %rdi + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rdx) + movl $-3, %edx + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rcx) + faddp %st, %st(1) + fstpt -48(%rdi) + fldt (%rsi) + lea 64(%rsp), %rsi + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -16(%rsi) +..___tag_value___y1l.47: + call __libm_sincos_pi4l@PLT +..___tag_value___y1l.48: +..B2.25: + fldt 112(%rsp) + fldt 48(%rsp) + fldt 32(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 96 +..B2.15: + fldt 64(%rsp) + lea _val_0_03L(%rip), %rax + fmulp %st, %st(1) + fldt 48(%rsp) + fmulp %st, %st(2) + fadd %st, %st(1) + fld %st(1) + fabs + fxch %st(1) + fabs + fldt (%rax) + fmulp %st, %st(1) + fcomip %st(1), %st + fstp %st(0) + jae ..B2.17 + jp ..B2.17 +..B2.16: + fstp %st(1) + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt (%rax) + fmulp %st, %st(1) + fsqrt + fmulp %st, %st(1) + jmp ..B2.19 +..B2.17: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 112 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B2.27: + addq $16, %rsp + .cfi_def_cfa_offset 96 + movaps (%rsp), %xmm0 +..___tag_value___y1l.52: + call __y1q@PLT +..___tag_value___y1l.53: +..B2.18: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B2.28: + fstpl 40(%rsp) + movsd 40(%rsp), %xmm0 + movsd %xmm0, 32(%rsp) + fldl 32(%rsp) +..B2.19: + addq $88, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type __y1l,@function + .size __y1l,.-__y1l + .data +# -- End __y1l + .section .rodata, "a" + .align 4 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_S: + .word 56848 + .word 49844 + .word 39532 + .word 64842 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 5940 + .word 14600 + .word 60967 + .word 58048 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 48233 + .word 9194 + .word 47533 + .word 41870 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 19716 + .word 3898 + .word 3621 + .word 54727 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 41547 + .word 400 + .word 58272 + .word 33793 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 46312 + .word 65374 + .word 26362 + .word 40225 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 15253 + .word 48480 + .word 38891 + .word 46657 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 12158 + .word 16394 + .word 14239 + .word 53090 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 31253 + .word 2914 + .word 8779 + .word 59523 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 29606 + .word 9567 + .word 8455 + .word 32978 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 51148 + .word 41491 + .word 50276 + .word 36194 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 1224 + .word 58769 + .word 30330 + .word 39411 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _S,@object + .size _S,192 + .align 2 +_val_1_77L: + .word 36700 + .word 62914 + .word 23592 + .word 57999 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _val_1_77L,@object + .size _val_1_77L,16 + .align 2 +_Z: + .word 5921 + .word 65426 + .word 63142 + .word 35997 + .word 16384 + .word 0 + .word 0 + .word 0 + .word 29632 + .word 15745 + .word 62068 + .word 44479 + .word 16385 + .word 0 + .word 0 + .word 0 + .word 41288 + .word 2893 + .word 15731 + .word 35209 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 12322 + .word 41360 + .word 35270 + .word 48124 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 21828 + .word 62500 + .word 60486 + .word 61019 + .word 16386 + .word 0 + .word 0 + .word 0 + .word 54460 + .word 63729 + .word 58186 + .word 36952 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 27250 + .word 3142 + .word 10825 + .word 43393 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 20649 + .word 49414 + .word 53633 + .word 49831 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 59160 + .word 26587 + .word 26484 + .word 56269 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 57283 + .word 10561 + .word 16432 + .word 62706 + .word 16387 + .word 0 + .word 0 + .word 0 + .word 44243 + .word 51162 + .word 18495 + .word 34571 + .word 16388 + .word 0 + .word 0 + .word 0 + .word 63781 + .word 54231 + .word 15770 + .word 37789 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _Z,@object + .size _Z,192 + .align 2 +_P1: + .word 21770 + .word 62666 + .word 46899 + .word 35378 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 28454 + .word 23396 + .word 41885 + .word 48017 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 61344 + .word 9332 + .word 29378 + .word 47284 + .word 49120 + .word 0 + .word 0 + .word 0 + .word 60127 + .word 25512 + .word 35054 + .word 43181 + .word 16353 + .word 0 + .word 0 + .word 0 + .word 25808 + .word 25324 + .word 9989 + .word 53047 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 46582 + .word 21062 + .word 5476 + .word 44690 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 61332 + .word 1419 + .word 18476 + .word 34785 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 51513 + .word 63307 + .word 40855 + .word 38307 + .word 49134 + .word 0 + .word 0 + .word 0 + .word 22560 + .word 55588 + .word 5655 + .word 48627 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 56966 + .word 1018 + .word 54245 + .word 62436 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 17453 + .word 15035 + .word 65421 + .word 57312 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 53367 + .word 52143 + .word 3664 + .word 58921 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 16321 + .word 41163 + .word 52734 + .word 35978 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 15288 + .word 52738 + .word 13594 + .word 53174 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 42685 + .word 25071 + .word 48779 + .word 62301 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 7354 + .word 8216 + .word 60720 + .word 54923 + .word 49085 + .word 0 + .word 0 + .word 0 + .type _P1,@object + .size _P1,256 + .align 2 +_Q1: + .word 64227 + .word 6706 + .word 76 + .word 58690 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 8371 + .word 16695 + .word 56692 + .word 45251 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 9179 + .word 20845 + .word 29706 + .word 43997 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 44943 + .word 15045 + .word 18794 + .word 45614 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 10671 + .word 41768 + .word 56247 + .word 64663 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 25530 + .word 4231 + .word 4140 + .word 59815 + .word 16381 + .word 0 + .word 0 + .word 0 + .type _Q1,@object + .size _Q1,96 + .align 2 +_P2: + .word 42420 + .word 39002 + .word 59647 + .word 60050 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 9209 + .word 30875 + .word 32003 + .word 38109 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 63337 + .word 29381 + .word 46828 + .word 35859 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 25340 + .word 63034 + .word 61574 + .word 39960 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 21587 + .word 1531 + .word 17186 + .word 56230 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 35654 + .word 56865 + .word 61897 + .word 49746 + .word 49126 + .word 0 + .word 0 + .word 0 + .word 6701 + .word 41291 + .word 18798 + .word 55141 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 35596 + .word 2936 + .word 34861 + .word 35797 + .word 16365 + .word 0 + .word 0 + .word 0 + .word 59382 + .word 44988 + .word 46794 + .word 33373 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 39208 + .word 51898 + .word 38063 + .word 56363 + .word 49138 + .word 0 + .word 0 + .word 0 + .word 34426 + .word 35681 + .word 546 + .word 45071 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 27055 + .word 35919 + .word 19182 + .word 39238 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 11379 + .word 16934 + .word 10723 + .word 57120 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 30778 + .word 48366 + .word 51582 + .word 60462 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 38504 + .word 65531 + .word 34807 + .word 43722 + .word 49149 + .word 0 + .word 0 + .word 0 + .word 52867 + .word 16075 + .word 29885 + .word 33161 + .word 49086 + .word 0 + .word 0 + .word 0 + .type _P2,@object + .size _P2,256 + .align 2 +_Q2: + .word 24596 + .word 8363 + .word 28671 + .word 51312 + .word 16360 + .word 0 + .word 0 + .word 0 + .word 22889 + .word 23763 + .word 37225 + .word 46345 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 24119 + .word 47441 + .word 54379 + .word 48688 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 1240 + .word 59184 + .word 48701 + .word 46748 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 22888 + .word 65215 + .word 58633 + .word 45869 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 31023 + .word 50278 + .word 49158 + .word 64237 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _Q2,@object + .size _Q2,96 + .align 2 +_P: + .word 61722 + .word 43505 + .word 23994 + .word 37346 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 30291 + .word 24028 + .word 22863 + .word 34750 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 1126 + .word 901 + .word 35659 + .word 64778 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 24961 + .word 30514 + .word 59096 + .word 39096 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 35564 + .word 61687 + .word 10716 + .word 35707 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 46848 + .word 13986 + .word 10777 + .word 37699 + .word 49111 + .word 0 + .word 0 + .word 0 + .word 25983 + .word 4211 + .word 22533 + .word 63008 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 41622 + .word 55080 + .word 16927 + .word 53017 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 59504 + .word 42891 + .word 54413 + .word 41203 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 12571 + .word 13616 + .word 30559 + .word 53698 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 24504 + .word 22188 + .word 22875 + .word 38390 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 45455 + .word 51567 + .word 14687 + .word 35767 + .word 16364 + .word 0 + .word 0 + .word 0 + .word 2489 + .word 10124 + .word 54664 + .word 47037 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 18722 + .word 39166 + .word 48910 + .word 55942 + .word 49137 + .word 0 + .word 0 + .word 0 + .word 52167 + .word 5 + .word 15467 + .word 33747 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 64650 + .word 13451 + .word 38167 + .word 40566 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 40279 + .word 20454 + .word 61426 + .word 45514 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 34995 + .word 30989 + .word 51614 + .word 33113 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 57629 + .word 30042 + .word 51710 + .word 35580 + .word 16381 + .word 0 + .word 0 + .word 0 + .word 22801 + .word 35092 + .word 8589 + .word 55177 + .word 16319 + .word 0 + .word 0 + .word 0 + .word 18213 + .word 9889 + .word 16490 + .word 42684 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 35117 + .word 3709 + .word 30056 + .word 56315 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 23979 + .word 26668 + .word 51699 + .word 63315 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 37328 + .word 63574 + .word 8303 + .word 34466 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 46391 + .word 17329 + .word 18036 + .word 35570 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 30054 + .word 21312 + .word 25061 + .word 63482 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 2570 + .word 34880 + .word 30954 + .word 61846 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 48934 + .word 61799 + .word 17650 + .word 43599 + .word 49118 + .word 0 + .word 0 + .word 0 + .word 9996 + .word 54252 + .word 12364 + .word 40067 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 26028 + .word 41231 + .word 49512 + .word 42301 + .word 16357 + .word 0 + .word 0 + .word 0 + .word 36582 + .word 15370 + .word 8472 + .word 36675 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 63654 + .word 5080 + .word 49106 + .word 53579 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 31057 + .word 54537 + .word 2640 + .word 43916 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 21142 + .word 46896 + .word 24614 + .word 39087 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 3964 + .word 40668 + .word 52365 + .word 60967 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 39332 + .word 9457 + .word 22878 + .word 52919 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 54210 + .word 18213 + .word 48816 + .word 39742 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 59971 + .word 56061 + .word 65402 + .word 41492 + .word 16376 + .word 0 + .word 0 + .word 0 + .word 50867 + .word 29775 + .word 29962 + .word 60938 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 39008 + .word 10804 + .word 60432 + .word 53771 + .word 49083 + .word 0 + .word 0 + .word 0 + .word 8797 + .word 29964 + .word 61128 + .word 42619 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 49667 + .word 64253 + .word 56687 + .word 49119 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 12708 + .word 20574 + .word 59517 + .word 62457 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 61123 + .word 30114 + .word 53775 + .word 59072 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 12480 + .word 24376 + .word 40478 + .word 34829 + .word 49108 + .word 0 + .word 0 + .word 0 + .word 31610 + .word 2541 + .word 29797 + .word 53230 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 57351 + .word 51530 + .word 20151 + .word 60005 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 27929 + .word 50140 + .word 46261 + .word 35597 + .word 16350 + .word 0 + .word 0 + .word 0 + .word 13266 + .word 42539 + .word 17988 + .word 38413 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 60482 + .word 30188 + .word 54757 + .word 33461 + .word 49125 + .word 0 + .word 0 + .word 0 + .word 28412 + .word 55589 + .word 45206 + .word 34637 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 32067 + .word 62816 + .word 60815 + .word 40858 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 5401 + .word 9100 + .word 50782 + .word 40732 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 54621 + .word 58390 + .word 59249 + .word 57428 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 35825 + .word 1375 + .word 322 + .word 55483 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 16432 + .word 16110 + .word 8852 + .word 37720 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 5000 + .word 34131 + .word 51425 + .word 35608 + .word 49146 + .word 0 + .word 0 + .word 0 + .word 53929 + .word 6276 + .word 23388 + .word 58152 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 51579 + .word 17004 + .word 5616 + .word 54145 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 7103 + .word 16103 + .word 63732 + .word 61608 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 53540 + .word 14563 + .word 28490 + .word 42103 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 50538 + .word 7801 + .word 54621 + .word 42667 + .word 16326 + .word 0 + .word 0 + .word 0 + .word 21289 + .word 53272 + .word 50234 + .word 61084 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 53615 + .word 53374 + .word 57363 + .word 50528 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 54514 + .word 9539 + .word 36475 + .word 33817 + .word 16340 + .word 0 + .word 0 + .word 0 + .word 31658 + .word 4746 + .word 1163 + .word 44700 + .word 16342 + .word 0 + .word 0 + .word 0 + .word 52867 + .word 45166 + .word 52684 + .word 57761 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 48341 + .word 5188 + .word 19803 + .word 58551 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 18455 + .word 50865 + .word 10646 + .word 36603 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 16819 + .word 38651 + .word 15489 + .word 53797 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 57587 + .word 29612 + .word 6330 + .word 65256 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 60926 + .word 53369 + .word 5356 + .word 64182 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 26295 + .word 42515 + .word 37715 + .word 37910 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 26848 + .word 34589 + .word 11687 + .word 44170 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 52547 + .word 41404 + .word 29188 + .word 51071 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 59720 + .word 37814 + .word 50864 + .word 57112 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 63754 + .word 1059 + .word 28610 + .word 65011 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 48135 + .word 53252 + .word 54091 + .word 43638 + .word 16375 + .word 0 + .word 0 + .word 0 + .word 14971 + .word 8471 + .word 3609 + .word 49212 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 4052 + .word 57147 + .word 31484 + .word 54446 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 11824 + .word 2112 + .word 5588 + .word 41288 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 30937 + .word 56824 + .word 10791 + .word 37103 + .word 49094 + .word 0 + .word 0 + .word 0 + .word 13479 + .word 25038 + .word 44704 + .word 59408 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 6837 + .word 41457 + .word 42451 + .word 43375 + .word 16334 + .word 0 + .word 0 + .word 0 + .word 53800 + .word 46435 + .word 51001 + .word 65352 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 15811 + .word 55852 + .word 5902 + .word 37814 + .word 49110 + .word 0 + .word 0 + .word 0 + .word 19663 + .word 64639 + .word 1883 + .word 55408 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 5332 + .word 44968 + .word 15414 + .word 48765 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 24635 + .word 46043 + .word 59114 + .word 34832 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 15088 + .word 55241 + .word 15044 + .word 44102 + .word 49124 + .word 0 + .word 0 + .word 0 + .word 6405 + .word 38383 + .word 37570 + .word 61587 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 22931 + .word 45450 + .word 10147 + .word 51835 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 64299 + .word 50831 + .word 27180 + .word 35495 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 23200 + .word 7806 + .word 1364 + .word 35222 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 45807 + .word 4679 + .word 55327 + .word 47491 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 30764 + .word 65323 + .word 55387 + .word 45120 + .word 16372 + .word 0 + .word 0 + .word 0 + .word 15039 + .word 21256 + .word 11217 + .word 60156 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 57173 + .word 14361 + .word 2624 + .word 34299 + .word 49143 + .word 0 + .word 0 + .word 0 + .word 56410 + .word 62508 + .word 42699 + .word 45420 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 50446 + .word 42024 + .word 63781 + .word 38435 + .word 49087 + .word 0 + .word 0 + .word 0 + .word 10333 + .word 60348 + .word 17128 + .word 40300 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 43838 + .word 25371 + .word 62467 + .word 64794 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 26845 + .word 6377 + .word 43437 + .word 57595 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 7442 + .word 5283 + .word 26036 + .word 37481 + .word 49102 + .word 0 + .word 0 + .word 0 + .word 15454 + .word 29184 + .word 54291 + .word 63010 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 5297 + .word 38874 + .word 4456 + .word 64615 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 12966 + .word 61910 + .word 53167 + .word 53110 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 20395 + .word 4102 + .word 12283 + .word 41188 + .word 49117 + .word 0 + .word 0 + .word 0 + .word 19094 + .word 29300 + .word 12828 + .word 33187 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 28120 + .word 22694 + .word 2680 + .word 36839 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 25698 + .word 43431 + .word 60429 + .word 58329 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 59006 + .word 57475 + .word 62067 + .word 42866 + .word 49130 + .word 0 + .word 0 + .word 0 + .word 60088 + .word 17714 + .word 44332 + .word 33435 + .word 16368 + .word 0 + .word 0 + .word 0 + .word 3844 + .word 12917 + .word 11965 + .word 57777 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 17310 + .word 43236 + .word 29566 + .word 44535 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 38891 + .word 11594 + .word 35001 + .word 36788 + .word 49140 + .word 0 + .word 0 + .word 0 + .word 62784 + .word 19866 + .word 27725 + .word 56232 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 26552 + .word 62874 + .word 50518 + .word 55747 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 41449 + .word 54733 + .word 7288 + .word 42389 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 25436 + .word 16965 + .word 21076 + .word 40960 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 39083 + .word 3258 + .word 61438 + .word 39229 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 62602 + .word 12963 + .word 51303 + .word 56904 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 41532 + .word 46799 + .word 27449 + .word 55757 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 25508 + .word 35836 + .word 14539 + .word 65290 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 34796 + .word 56106 + .word 58112 + .word 60724 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 52331 + .word 50671 + .word 56071 + .word 55789 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 50430 + .word 49256 + .word 15625 + .word 50948 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 15753 + .word 56169 + .word 3376 + .word 35261 + .word 16349 + .word 0 + .word 0 + .word 0 + .word 47489 + .word 43658 + .word 29070 + .word 63380 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 14447 + .word 45157 + .word 5 + .word 62576 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 14392 + .word 17120 + .word 59854 + .word 55457 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 2389 + .word 54610 + .word 7938 + .word 36154 + .word 16362 + .word 0 + .word 0 + .word 0 + .word 24225 + .word 54966 + .word 22944 + .word 63335 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 6246 + .word 36346 + .word 2616 + .word 48455 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 61678 + .word 13662 + .word 7713 + .word 42050 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 4329 + .word 54820 + .word 31411 + .word 61458 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 48026 + .word 57812 + .word 53661 + .word 52979 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 47545 + .word 24071 + .word 10224 + .word 46463 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 51405 + .word 19517 + .word 26454 + .word 39893 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 2714 + .word 52847 + .word 64285 + .word 36922 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 51895 + .word 36793 + .word 33802 + .word 38136 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 2488 + .word 31490 + .word 30800 + .word 50300 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 13623 + .word 29920 + .word 59063 + .word 53960 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 4071 + .word 44015 + .word 56417 + .word 57333 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 57861 + .word 52773 + .word 20389 + .word 58553 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 64934 + .word 37948 + .word 51829 + .word 48662 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 56954 + .word 19807 + .word 167 + .word 48948 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 28104 + .word 12997 + .word 51038 + .word 61119 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 3409 + .word 4305 + .word 3650 + .word 60679 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 43193 + .word 24597 + .word 44129 + .word 53916 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 17521 + .word 14667 + .word 10096 + .word 52923 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 55445 + .word 18677 + .word 32228 + .word 61988 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 19057 + .word 4855 + .word 59096 + .word 60271 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 13479 + .word 55645 + .word 42570 + .word 41372 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 1282 + .word 28535 + .word 31957 + .word 39927 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 572 + .word 61602 + .word 36341 + .word 52326 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 28923 + .word 3577 + .word 27552 + .word 50228 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 55167 + .word 15365 + .word 46318 + .word 39497 + .word 16374 + .word 0 + .word 0 + .word 0 + .word 19602 + .word 36437 + .word 16591 + .word 37792 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 46605 + .word 39778 + .word 56315 + .word 52295 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 30298 + .word 45364 + .word 48554 + .word 37056 + .word 49091 + .word 0 + .word 0 + .word 0 + .word 36916 + .word 47157 + .word 55353 + .word 44757 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 36754 + .word 52515 + .word 12207 + .word 52242 + .word 16331 + .word 0 + .word 0 + .word 0 + .word 22625 + .word 1809 + .word 14640 + .word 50749 + .word 16333 + .word 0 + .word 0 + .word 0 + .word 16563 + .word 52625 + .word 13365 + .word 56520 + .word 49107 + .word 0 + .word 0 + .word 0 + .word 27329 + .word 9102 + .word 21835 + .word 42848 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 25313 + .word 26147 + .word 37973 + .word 47112 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 62093 + .word 47762 + .word 2878 + .word 53553 + .word 16348 + .word 0 + .word 0 + .word 0 + .word 45304 + .word 46632 + .word 22697 + .word 58245 + .word 49122 + .word 0 + .word 0 + .word 0 + .word 52304 + .word 22429 + .word 48300 + .word 47033 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 1240 + .word 8778 + .word 3434 + .word 50676 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 64382 + .word 35832 + .word 24068 + .word 53872 + .word 16361 + .word 0 + .word 0 + .word 0 + .word 9372 + .word 49794 + .word 11542 + .word 57592 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 29118 + .word 43193 + .word 8003 + .word 35849 + .word 49135 + .word 0 + .word 0 + .word 0 + .word 3582 + .word 16932 + .word 42429 + .word 38089 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 26846 + .word 61869 + .word 11277 + .word 45246 + .word 16371 + .word 0 + .word 0 + .word 0 + .word 12490 + .word 64508 + .word 30037 + .word 47862 + .word 49145 + .word 0 + .word 0 + .word 0 + .word 36625 + .word 65383 + .word 13633 + .word 34114 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 6011 + .word 54183 + .word 37651 + .word 35991 + .word 16380 + .word 0 + .word 0 + .word 0 + .word 43024 + .word 51442 + .word 35220 + .word 35244 + .word 16321 + .word 0 + .word 0 + .word 0 + .word 2338 + .word 9974 + .word 58099 + .word 36011 + .word 16323 + .word 0 + .word 0 + .word 0 + .word 54231 + .word 56678 + .word 56840 + .word 40082 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 47406 + .word 57592 + .word 65286 + .word 50617 + .word 49099 + .word 0 + .word 0 + .word 0 + .word 15992 + .word 46142 + .word 20381 + .word 45257 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 17722 + .word 6937 + .word 55940 + .word 54630 + .word 16339 + .word 0 + .word 0 + .word 0 + .word 44953 + .word 7303 + .word 1203 + .word 38053 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 9155 + .word 41724 + .word 2745 + .word 45433 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 23208 + .word 13836 + .word 51920 + .word 47377 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 46053 + .word 58453 + .word 7516 + .word 56049 + .word 16354 + .word 0 + .word 0 + .word 0 + .word 51100 + .word 31216 + .word 1872 + .word 41469 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 24653 + .word 32384 + .word 37643 + .word 48672 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 61101 + .word 35176 + .word 37213 + .word 47362 + .word 49129 + .word 0 + .word 0 + .word 0 + .word 62301 + .word 22066 + .word 41591 + .word 55226 + .word 16367 + .word 0 + .word 0 + .word 0 + .word 37791 + .word 15476 + .word 41140 + .word 62892 + .word 16366 + .word 0 + .word 0 + .word 0 + .word 18919 + .word 33505 + .word 35758 + .word 36479 + .word 49141 + .word 0 + .word 0 + .word 0 + .word 58610 + .word 16753 + .word 52674 + .word 39626 + .word 49139 + .word 0 + .word 0 + .word 0 + .word 19653 + .word 21667 + .word 11428 + .word 45800 + .word 16377 + .word 0 + .word 0 + .word 0 + .word 51212 + .word 10491 + .word 15737 + .word 59703 + .word 16373 + .word 0 + .word 0 + .word 0 + .word 54759 + .word 31668 + .word 63308 + .word 34425 + .word 49148 + .word 0 + .word 0 + .word 0 + .word 62523 + .word 11996 + .word 50486 + .word 33912 + .word 49089 + .word 0 + .word 0 + .word 0 + .type _P,@object + .size _P,3200 + .align 2 +_P0: + .word 10891 + .word 2847 + .word 4043 + .word 50135 + .word 16324 + .word 0 + .word 0 + .word 0 + .word 8878 + .word 10523 + .word 36094 + .word 35357 + .word 49101 + .word 0 + .word 0 + .word 0 + .word 12191 + .word 2098 + .word 38631 + .word 38182 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 58416 + .word 39431 + .word 6152 + .word 63591 + .word 49116 + .word 0 + .word 0 + .word 0 + .word 18600 + .word 1852 + .word 53867 + .word 39282 + .word 16356 + .word 0 + .word 0 + .word 0 + .word 37377 + .word 45824 + .word 1379 + .word 34108 + .word 49131 + .word 0 + .word 0 + .word 0 + .word 58815 + .word 28468 + .word 57342 + .word 38462 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 35703 + .word 42482 + .word 52164 + .word 49581 + .word 49142 + .word 0 + .word 0 + .word 0 + .word 14326 + .word 44453 + .word 47843 + .word 56988 + .word 16378 + .word 0 + .word 0 + .word 0 + .word 21045 + .word 58852 + .word 12449 + .word 51395 + .word 49148 + .word 0 + .word 0 + .word 0 + .type _P0,@object + .size _P0,160 + .align 2 +_val_N1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _val_N1_0L,@object + .size _val_N1_0L,16 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _tonpi,@object + .size _tonpi,16 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,16 + .align 2 +_PP: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 0 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP,@object + .size _PP,160 + .align 2 +_QP: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _QP,@object + .size _QP,160 + .align 2 +_val_0_03L: + .word 49807 + .word 10485 + .word 36700 + .word 62914 + .word 16377 + .word 0 + .word 0 + .word 0 + .type _val_0_03L,@object + .size _val_0_03L,16 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/y1f.S b/external/sgx_libm/intel64/y1f.S new file mode 100644 index 0000000000..f9d2339cfc --- /dev/null +++ b/external/sgx_libm/intel64/y1f.S @@ -0,0 +1,921 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y1f.c" + .text +..TXTST0: +# -- Begin y1f + .text + .align 16,0x90 + .globl y1f +y1f: +# parameter 1: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_y1f.1: +..L2: + + subq $56, %rsp + .cfi_def_cfa_offset 64 + movd %xmm0, %edx + movss %xmm0, 48(%rsp) + lea -1(%rdx), %eax + cmpl $2139095039, %eax + jae ..B1.17 +..B1.2: + cmpl $1100816743, %edx + jae ..B1.25 +..B1.3: + cmpl $1099170276, %edx + jae ..B1.16 +..B1.4: + cmpl $1096140558, %edx + jae ..B1.15 +..B1.5: + cmpl $1092849338, %edx + jae ..B1.14 +..B1.6: + cmpl $1088602350, %edx + jae ..B1.13 +..B1.7: + cmpl $1081952922, %edx + jae ..B1.12 +..B1.8: + cmpl $1071812444, %edx + jb ..B1.10 +..B1.9: + cvtss2sd %xmm0, %xmm0 + lea 128+_P1(%rip), %rax + lea 120+_P1(%rip), %rdx + lea 88+_P1(%rip), %rcx + lea 56+_P1(%rip), %rsi + lea 104+_P1(%rip), %r8 + lea 24+_P1(%rip), %rdi + lea 72+_P1(%rip), %r9 + lea 40+_P1(%rip), %r10 + movsd (%rdx), %xmm6 + lea 80+_P1(%rip), %rdx + lea 8+_P1(%rip), %r11 + subsd (%rax), %xmm0 + movaps %xmm0, %xmm2 + lea 112+_P1(%rip), %rax + mulsd %xmm0, %xmm2 + movaps %xmm2, %xmm3 + mulsd %xmm2, %xmm3 + mulsd %xmm3, %xmm6 + movsd (%r8), %xmm1 + lea 64+_P1(%rip), %r8 + movsd (%rax), %xmm5 + mulsd %xmm3, %xmm1 + addsd (%rcx), %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd (%r9), %xmm1 + addsd (%rdx), %xmm5 + mulsd %xmm3, %xmm1 + addsd (%rsi), %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd (%r10), %xmm1 + lea 48+_P1(%rip), %rcx + lea 32+_P1(%rip), %r9 + mulsd %xmm3, %xmm1 + addsd (%rdi), %xmm6 + addsd (%rcx), %xmm5 + mulsd %xmm2, %xmm6 + addsd (%r11), %xmm1 + mulsd %xmm3, %xmm5 + mulsd %xmm0, %xmm6 + mulsd %xmm0, %xmm1 + lea 96+_P1(%rip), %rdi + lea 16+_P1(%rip), %rsi + lea _P1(%rip), %r10 + addsd %xmm1, %xmm6 + addsd (%rsi), %xmm5 + movsd (%rdi), %xmm4 + mulsd %xmm3, %xmm4 + mulsd %xmm2, %xmm5 + addsd (%r8), %xmm4 + mulsd %xmm3, %xmm4 + addsd (%r9), %xmm4 + mulsd %xmm3, %xmm4 + addsd (%r10), %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.10: + pxor %xmm4, %xmm4 + cvtss2sd 48(%rsp), %xmm4 + movaps %xmm4, %xmm0 + movsd %xmm4, (%rsp) +..___tag_value_y1f.6: + call __libm_log_k32@PLT +..___tag_value_y1f.7: +..B1.29: + movsd (%rsp), %xmm4 +..B1.11: + lea _tonpi(%rip), %rax + movaps %xmm4, %xmm2 + mulsd %xmm4, %xmm2 + lea 40+_Q2(%rip), %r10 + movsd (%rax), %xmm7 + movaps %xmm2, %xmm3 + mulsd %xmm7, %xmm0 + lea 40+_Q1(%rip), %rdx + divsd %xmm4, %xmm7 + mulsd %xmm2, %xmm3 + lea 24+_Q2(%rip), %r11 + movsd (%r10), %xmm6 + lea 24+_Q1(%rip), %rcx + movsd (%rdx), %xmm8 + lea 32+_Q2(%rip), %rdx + mulsd %xmm3, %xmm6 + lea 32+_Q1(%rip), %rdi + mulsd %xmm3, %xmm8 + addsd (%r11), %xmm6 + addsd (%rcx), %xmm8 + mulsd %xmm3, %xmm6 + mulsd %xmm3, %xmm8 + movsd (%rdx), %xmm5 + lea 16+_Q2(%rip), %rcx + mulsd %xmm3, %xmm5 + lea 8+_Q2(%rip), %rax + addsd (%rax), %xmm6 + addsd (%rcx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm5 + mulsd %xmm4, %xmm6 + lea 8+_Q1(%rip), %rsi + lea 16+_Q1(%rip), %r8 + movsd (%rdi), %xmm1 + lea _Q1(%rip), %r9 + mulsd %xmm3, %xmm1 + addsd (%rsi), %xmm8 + addsd (%r8), %xmm1 + mulsd %xmm2, %xmm8 + mulsd %xmm3, %xmm1 + mulsd %xmm4, %xmm8 + addsd (%r9), %xmm1 + lea _Q2(%rip), %rsi + mulsd %xmm4, %xmm1 + addsd (%rsi), %xmm5 + addsd %xmm1, %xmm8 + mulsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + mulsd %xmm6, %xmm0 + subsd %xmm7, %xmm0 + addsd %xmm0, %xmm8 + cvtsd2ss %xmm8, %xmm8 + movaps %xmm8, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.12: + pxor %xmm0, %xmm0 + lea 112+_P2(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + lea 104+_P2(%rip), %rdx + lea 72+_P2(%rip), %rcx + lea 40+_P2(%rip), %rsi + lea 88+_P2(%rip), %r8 + lea 96+_P2(%rip), %r11 + lea 56+_P2(%rip), %r9 + lea 8+_P2(%rip), %rdi + lea 24+_P2(%rip), %r10 + movsd (%rdx), %xmm6 + lea 32+_P2(%rip), %rdx + movsd (%r8), %xmm1 + lea 16+_P2(%rip), %r8 + movsd (%r11), %xmm5 + subsd (%rax), %xmm0 + lea 64+_P2(%rip), %rax + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rcx), %xmm6 + addsd (%r9), %xmm1 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm6 + addsd (%r10), %xmm1 + addsd (%rdx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rdi), %xmm6 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm6 + lea 80+_P2(%rip), %rsi + lea 48+_P2(%rip), %rdi + lea _P2(%rip), %rcx + addsd %xmm1, %xmm6 + addsd (%rcx), %xmm5 + movsd (%rsi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rdi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.13: + pxor %xmm3, %xmm3 + lea 104+_P3(%rip), %rax + cvtss2sd 48(%rsp), %xmm3 + lea 96+_P3(%rip), %rdx + lea 64+_P3(%rip), %rcx + lea 80+_P3(%rip), %rdi + lea 88+_P3(%rip), %r11 + lea 48+_P3(%rip), %r8 + lea 32+_P3(%rip), %rsi + lea 16+_P3(%rip), %r9 + lea _P3(%rip), %r10 + movsd (%rdx), %xmm6 + lea 24+_P3(%rip), %rdx + movsd (%rdi), %xmm0 + lea 8+_P3(%rip), %rdi + movsd (%r11), %xmm5 + subsd (%rax), %xmm3 + lea 56+_P3(%rip), %rax + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd (%rcx), %xmm6 + addsd (%r8), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm6 + addsd (%r9), %xmm0 + addsd (%rdx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm0, %xmm6 + mulsd %xmm3, %xmm5 + addsd (%r10), %xmm6 + lea 72+_P3(%rip), %rcx + lea 40+_P3(%rip), %rsi + movsd (%rcx), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rsi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rdi), %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.14: + pxor %xmm0, %xmm0 + lea 112+_P4(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + lea 104+_P4(%rip), %rdx + lea 72+_P4(%rip), %rcx + lea 40+_P4(%rip), %rsi + lea 88+_P4(%rip), %r8 + lea 96+_P4(%rip), %r11 + lea 56+_P4(%rip), %r9 + lea 8+_P4(%rip), %rdi + lea 24+_P4(%rip), %r10 + movsd (%rdx), %xmm6 + lea 32+_P4(%rip), %rdx + movsd (%r8), %xmm1 + lea 16+_P4(%rip), %r8 + movsd (%r11), %xmm5 + subsd (%rax), %xmm0 + lea 64+_P4(%rip), %rax + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rcx), %xmm6 + addsd (%r9), %xmm1 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm6 + addsd (%r10), %xmm1 + addsd (%rdx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rdi), %xmm6 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm6 + lea 80+_P4(%rip), %rsi + lea 48+_P4(%rip), %rdi + lea _P4(%rip), %rcx + addsd %xmm1, %xmm6 + addsd (%rcx), %xmm5 + movsd (%rsi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rdi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.15: + pxor %xmm3, %xmm3 + lea 104+_P5(%rip), %rax + cvtss2sd 48(%rsp), %xmm3 + lea 96+_P5(%rip), %rdx + lea 64+_P5(%rip), %rcx + lea 80+_P5(%rip), %rdi + lea 88+_P5(%rip), %r11 + lea 48+_P5(%rip), %r8 + lea 32+_P5(%rip), %rsi + lea 16+_P5(%rip), %r9 + lea _P5(%rip), %r10 + movsd (%rdx), %xmm6 + lea 24+_P5(%rip), %rdx + movsd (%rdi), %xmm0 + lea 8+_P5(%rip), %rdi + movsd (%r11), %xmm5 + subsd (%rax), %xmm3 + lea 56+_P5(%rip), %rax + movaps %xmm3, %xmm1 + mulsd %xmm3, %xmm1 + movaps %xmm1, %xmm2 + mulsd %xmm1, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd (%rcx), %xmm6 + addsd (%r8), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm0 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm6 + addsd (%r9), %xmm0 + addsd (%rdx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm1, %xmm0 + mulsd %xmm1, %xmm5 + addsd %xmm0, %xmm6 + mulsd %xmm3, %xmm5 + addsd (%r10), %xmm6 + lea 72+_P5(%rip), %rcx + lea 40+_P5(%rip), %rsi + movsd (%rcx), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rsi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rdi), %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.16: + pxor %xmm0, %xmm0 + lea 112+_P6(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + lea 104+_P6(%rip), %rdx + lea 72+_P6(%rip), %rcx + lea 40+_P6(%rip), %rsi + lea 88+_P6(%rip), %r8 + lea 96+_P6(%rip), %r11 + lea 56+_P6(%rip), %r9 + lea 8+_P6(%rip), %rdi + lea 24+_P6(%rip), %r10 + movsd (%rdx), %xmm6 + lea 32+_P6(%rip), %rdx + movsd (%r8), %xmm1 + lea 16+_P6(%rip), %r8 + movsd (%r11), %xmm5 + subsd (%rax), %xmm0 + lea 64+_P6(%rip), %rax + movaps %xmm0, %xmm3 + mulsd %xmm0, %xmm3 + movaps %xmm3, %xmm2 + mulsd %xmm3, %xmm2 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rcx), %xmm6 + addsd (%r9), %xmm1 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm2, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rsi), %xmm6 + addsd (%r10), %xmm1 + addsd (%rdx), %xmm5 + mulsd %xmm2, %xmm6 + mulsd %xmm3, %xmm1 + mulsd %xmm2, %xmm5 + addsd (%rdi), %xmm6 + mulsd %xmm0, %xmm1 + mulsd %xmm0, %xmm6 + lea 80+_P6(%rip), %rsi + lea 48+_P6(%rip), %rdi + lea _P6(%rip), %rcx + addsd %xmm1, %xmm6 + addsd (%rcx), %xmm5 + movsd (%rsi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%rdi), %xmm4 + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm4 + mulsd %xmm3, %xmm4 + addsd %xmm4, %xmm5 + addsd %xmm5, %xmm6 + cvtsd2ss %xmm6, %xmm6 + movaps %xmm6, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.17: + movl %edx, %eax + andl $2147483647, %eax + cmpl $2139095040, %eax + ja ..B1.24 +..B1.18: + testl %eax, %eax + je ..B1.23 +..B1.19: + testl $-2147483648, %edx + pxor %xmm0, %xmm0 + je ..B1.22 +..B1.20: + movss .L_2il0floatpacket.1(%rip), %xmm1 + mulss %xmm1, %xmm0 +..B1.22: + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.23: + movss .L_2il0floatpacket.0(%rip), %xmm0 + pxor %xmm1, %xmm1 + divss %xmm1, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.24: + movss 48(%rsp), %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 64 +..B1.25: + pxor %xmm0, %xmm0 + lea _val_16_0(%rip), %rax + cvtss2sd 48(%rsp), %xmm0 + movsd .L_2il0floatpacket.2(%rip), %xmm1 + lea (%rsp), %rdi + divsd %xmm0, %xmm1 + movsd (%rax), %xmm2 + lea 8(%rsp), %rsi + mulsd %xmm1, %xmm2 + movl $-3, %edx + movsd %xmm2, 8(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm2, 24(%rsi) + mulsd %xmm2, %xmm2 + movsd %xmm1, 16(%rsi) + movsd %xmm2, 32(%rsi) +..___tag_value_y1f.26: + call __libm_sincos_k32@PLT +..___tag_value_y1f.27: +..B1.26: + lea 40+_QP(%rip), %r10 + lea 40+_PP(%rip), %rdx + movsd 40(%rsp), %xmm2 + lea 24+_QP(%rip), %r11 + lea 24+_PP(%rip), %rcx + lea 32+_PP(%rip), %rdi + lea _tonpi(%rip), %rax + lea 16+_PP(%rip), %r8 + movsd (%r10), %xmm5 + lea 8+_PP(%rip), %rsi + movsd (%rdx), %xmm6 + lea 32+_QP(%rip), %rdx + mulsd %xmm2, %xmm5 + lea _PP(%rip), %r9 + mulsd %xmm2, %xmm6 + addsd (%r11), %xmm5 + addsd (%rcx), %xmm6 + mulsd %xmm2, %xmm5 + mulsd %xmm2, %xmm6 + movsd (%rdx), %xmm4 + lea 16+_QP(%rip), %rcx + mulsd %xmm2, %xmm4 + addsd (%rsi), %xmm6 + movsd (%rdi), %xmm1 + lea _QP(%rip), %rsi + mulsd %xmm2, %xmm1 + addsd (%rcx), %xmm4 + movsd (%rax), %xmm0 + lea 8+_QP(%rip), %rax + mulsd %xmm2, %xmm4 + addsd (%r8), %xmm1 + mulsd 24(%rsp), %xmm0 + addsd (%rax), %xmm5 + mulsd %xmm2, %xmm1 + addsd (%rsi), %xmm4 + sqrtsd %xmm0, %xmm0 + addsd (%r9), %xmm1 + movsd 32(%rsp), %xmm3 + mulsd %xmm3, %xmm5 + mulsd %xmm3, %xmm6 + addsd %xmm4, %xmm5 + addsd %xmm1, %xmm6 + mulsd 16(%rsp), %xmm5 + mulsd (%rsp), %xmm6 + mulsd 8(%rsp), %xmm5 + addsd %xmm5, %xmm6 + mulsd %xmm6, %xmm0 + cvtsd2ss %xmm0, %xmm0 + addq $56, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type y1f,@function + .size y1f,.-y1f + .data +# -- End y1f + .section .rodata, "a" + .align 8 + .align 8 +.L_2il0floatpacket.2: + .long 0x00000000,0x3ff00000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,8 + .align 4 +.L_2il0floatpacket.0: + .long 0xbf800000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x7f800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +_P1: + .long 3588334709 + .long 1014823416 + .long 1143617537 + .long 1071688264 + .long 543393268 + .long 3216922360 + .long 1079832790 + .long 3214987951 + .long 1415988155 + .long 3212027618 + .long 2493495630 + .long 1065248537 + .long 1666720954 + .long 3211084359 + .long 543676354 + .long 1062304274 + .long 4191589146 + .long 3208689738 + .long 2170605073 + .long 1060053158 + .long 3542706363 + .long 3206309752 + .long 3704389215 + .long 1057513307 + .long 2063423420 + .long 3203511534 + .long 3202091398 + .long 1054023270 + .long 2674374220 + .long 3198818668 + .long 2780141937 + .long 1047561374 + .long 3571446339 + .long 1073845182 + .type _P1,@object + .size _P1,136 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_Q2: + .long 4294700894 + .long 1071644671 + .long 4245872852 + .long 3215982591 + .long 2793978972 + .long 1063605588 + .long 1731774639 + .long 3205263755 + .long 824990963 + .long 1051113520 + .long 1573521749 + .long 3191272273 + .type _Q2,@object + .size _Q2,48 + .align 4 +_Q1: + .long 330682653 + .long 3217627238 + .long 1311559603 + .long 1068225431 + .long 1711886415 + .long 3211277751 + .long 3301707240 + .long 1058195349 + .long 1381458166 + .long 3199245881 + .long 361785213 + .long 1044511851 + .type _Q1,@object + .size _Q1,48 + .align 4 +_P2: + .long 2989758108 + .long 1017408064 + .long 1458640109 + .long 3218458565 + .long 2240523794 + .long 1067453343 + .long 773815536 + .long 1068111321 + .long 2743923681 + .long 3211856434 + .long 3232814431 + .long 3210853997 + .long 2451601872 + .long 1059272649 + .long 1805313442 + .long 1057512342 + .long 1838988672 + .long 3200779931 + .long 3139341808 + .long 3198309937 + .long 844655003 + .long 1046186753 + .long 3216852589 + .long 1043859826 + .long 2659303056 + .long 3187506951 + .long 2880143704 + .long 1034033463 + .long 1317515310 + .long 1075165182 + .type _P2,@object + .size _P2,120 + .align 4 +_P3: + .long 280256326 + .long 3163962304 + .long 1070207352 + .long 1070686105 + .long 878012560 + .long 3213896505 + .long 4238571140 + .long 3215341917 + .long 3113338666 + .long 1063505618 + .long 910161668 + .long 1063287399 + .long 1478416875 + .long 3206238429 + .long 3015160168 + .long 3204904859 + .long 3974776004 + .long 1052866426 + .long 579855125 + .long 1050851686 + .long 261378128 + .long 3193590641 + .long 798233178 + .long 3191027115 + .long 1498363474 + .long 1038832298 + .long 2925619636 + .long 1075917095 + .type _P3,@object + .size _P3,112 + .align 4 +_P4: + .long 738390343 + .long 1012897491 + .long 2706267969 + .long 3217932622 + .long 4014538048 + .long 1065632415 + .long 3590329970 + .long 1067673559 + .long 671215353 + .long 3210335979 + .long 2374781669 + .long 3210593529 + .long 1890699418 + .long 1058215403 + .long 1890155166 + .long 1057321344 + .long 1713507622 + .long 3199871308 + .long 2862637523 + .long 3198281783 + .long 1122846306 + .long 1045733660 + .long 622299794 + .long 1043564297 + .long 2771483851 + .long 3185854918 + .long 1632198108 + .long 3183235242 + .long 953430534 + .long 1076330385 + .type _P4,@object + .size _P4,120 + .align 4 +_P5: + .long 342107947 + .long 1017254688 + .long 3187585117 + .long 1070231586 + .long 1823227594 + .long 3212600587 + .long 444207028 + .long 3215024921 + .long 1802122913 + .long 1062365956 + .long 1966738039 + .long 1062934367 + .long 3649894624 + .long 3205237410 + .long 1726294277 + .long 3204703097 + .long 1880085380 + .long 1051980794 + .long 1949762981 + .long 1050731607 + .long 2695921962 + .long 3192939649 + .long 1096030507 + .long 3190939319 + .long 3356663664 + .long 1038219909 + .long 2296284299 + .long 1076743037 + .type _P5,@object + .size _P5,112 + .align 4 +_P6: + .long 1104511903 + .long 3165887820 + .long 3273918356 + .long 3217557377 + .long 1767833442 + .long 1064652506 + .long 4164235278 + .long 1067433581 + .long 3499046825 + .long 3209421592 + .long 1038038689 + .long 3210276846 + .long 3702826228 + .long 1057329476 + .long 3651609877 + .long 1057129169 + .long 1779967631 + .long 3199161987 + .long 3308825176 + .long 3198147781 + .long 897891533 + .long 1045052198 + .long 2444111938 + .long 1043454098 + .long 144575532 + .long 3185257015 + .long 1701846534 + .long 3183129264 + .long 1767841339 + .long 1077021468 + .type _P6,@object + .size _P6,120 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_QP: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP,@object + .size _QP,48 + .align 4 +_PP: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP,@object + .size _PP,48 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/y1l.S b/external/sgx_libm/intel64/y1l.S new file mode 100644 index 0000000000..1798aae609 --- /dev/null +++ b/external/sgx_libm/intel64/y1l.S @@ -0,0 +1,86 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "y1l.c" + .text +..TXTST0: +# -- Begin y1l + .text + .align 16,0x90 + .globl y1l +y1l: +# parameter 1: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_y1l.1: +..L2: + + subq $24, %rsp + .cfi_def_cfa_offset 32 + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 48 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B1.6: + addq $16, %rsp + .cfi_def_cfa_offset 32 + movaps (%rsp), %xmm0 +..___tag_value_y1l.6: + call __y1q@PLT +..___tag_value_y1l.7: +..B1.2: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B1.7: + addq $24, %rsp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type y1l,@function + .size y1l,.-y1l + .data +# -- End y1l + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/yn.S b/external/sgx_libm/intel64/yn.S new file mode 100644 index 0000000000..100e3f3fb8 --- /dev/null +++ b/external/sgx_libm/intel64/yn.S @@ -0,0 +1,1623 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "yn.c" + .text +..TXTST0: +# -- Begin yn + .text + .align 16,0x90 + .globl yn +yn: +# parameter 1: %edi +# parameter 2: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_yn.1: +..L2: + + pushq %r13 + .cfi_def_cfa_offset 16 + .cfi_offset 13, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + pushq %r15 + .cfi_def_cfa_offset 32 + .cfi_offset 15, -32 + subq $224, %rsp + .cfi_def_cfa_offset 256 + movl %edi, %r13d + movsd %xmm0, (%rsp) + xorb %r14b, %r14b +..B1.2: + fnstcw 218(%rsp) +..B1.3: + movzwl 6(%rsp), %ecx + movl $1, %r15d + andl $32752, %ecx + shrl $4, %ecx + cmpl $2047, %ecx + je ..B1.58 +..B1.4: + lea _zeros(%rip), %rax + movsd (%rsp), %xmm0 + movsd (%rax), %xmm1 + comisd %xmm0, %xmm1 + jb ..B1.8 +..B1.5: + ucomisd %xmm1, %xmm0 + jp ..B1.6 + je ..B1.37 +..B1.6: + lea _infs(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm1, %xmm0 +..B1.7: + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.8: + testl %r13d, %r13d + je ..B1.36 +..B1.9: + jge ..B1.11 +..B1.10: + negl %r13d + movl %r13d, %eax + notl %eax + andl $1, %eax + lea -1(%rax,%rax), %r15d +..B1.11: + cmpl $1, %r13d + je ..B1.50 +..B1.12: + movl %r13d, %ecx + sarl $5, %ecx + cmpl $160, %ecx + jg ..B1.14 +..B1.13: + movslq %ecx, %rcx + lea XINF(%rip), %rax + movsd (%rax,%rcx,8), %xmm1 + jmp ..B1.15 +..B1.14: + pxor %xmm1, %xmm1 + lea -640(,%rcx,4), %eax + lea (,%rax,8), %ecx + subl %eax, %ecx + cvtsi2sd %ecx, %xmm1 + addsd .L_2il0floatpacket.0(%rip), %xmm1 +..B1.15: + comisd %xmm0, %xmm1 + ja ..B1.35 +..B1.16: + movzwl 218(%rsp), %ecx + movl %ecx, %eax + andl $768, %eax + cmpl $768, %eax + je ..B1.20 +..B1.17: + orl $-64768, %ecx + movw %cx, 216(%rsp) +..B1.18: + fldcw 216(%rsp) +..B1.19: + movsd (%rsp), %xmm0 + movb $1, %r14b +..B1.20: + movsd %xmm0, (%rsp) + lea _val_20_0L(%rip), %rax + fldl (%rsp) + lea _val_1000_0L(%rip), %rcx + movl %r13d, (%rsp) + fildl (%rsp) + fldt (%rax) + fmul %st(1), %st + fldt (%rcx) + faddp %st, %st(1) + fcomip %st(2), %st + ja ..B1.39 +..B1.21: + lea _val_4_0L(%rip), %rcx + fld %st(0) + lea _val_8_0L(%rip), %rsi + movl $-1, %eax + lea _val_n1_0L(%rip), %r8 + lea _val_3_0L(%rip), %r10 + lea _val_p1_0L(%rip), %rdi + lea _val_5_0L(%rip), %r11 + lea _val_2_0L(%rip), %r9 + fxch %st(2) + fstl 112(%rsp) + fldt (%rcx) + xorb %cl, %cl + fstpt 136(%rsp) + fldt 136(%rsp) + fmulp %st, %st(3) + fxch %st(1) + fmulp %st, %st(2) + fxch %st(1) + fstpt 200(%rsp) + fldt 200(%rsp) + fldt (%rsi) + lea _val_0_0L(%rip), %rsi + fmulp %st, %st(2) + fxch %st(1) + fstpt 168(%rsp) + fldt 168(%rsp) + fldt (%rdi) + fstpt (%rsp) + fldt (%rsp) + fstpt 64(%rsp) + fldt (%r8) + faddp %st, %st(2) + fdivrp %st, %st(1) + fstpt 48(%rsp) + fldt 48(%rsp) + fldt (%r9) + fstpt 80(%rsp) + fldt 80(%rsp) + fstpt 152(%rsp) + fldt (%r10) + fstpt 32(%rsp) + fldt 32(%rsp) + fstpt 96(%rsp) + fldt (%r11) + fstpt 16(%rsp) + fldt (%rsi) + fstpt 120(%rsp) + fldt 16(%rsp) + fldt 96(%rsp) + fldt 32(%rsp) + fldt (%rsp) +..B1.22: + fldt 200(%rsp) + fld %st(3) + fmul %st(4), %st + testl %eax, %eax + fsubr %st(1), %st + fxch %st(4) + fstpt 96(%rsp) + fxch %st(1) + fstpt 16(%rsp) + fldt 16(%rsp) + fstpt 184(%rsp) + fldt 184(%rsp) + fldt 80(%rsp) + fldt 168(%rsp) + fmul %st, %st(1) + fxch %st(1) + fdivrp %st, %st(5) + fxch %st(6) + fmulp %st, %st(4) + fld %st(4) + fmul %st(5), %st + fsubrp %st, %st(2) + fxch %st(2) + fmul %st, %st(5) + fxch %st(5) + fdivrp %st, %st(1) + fmul %st(2), %st + fldt 96(%rsp) + jle ..B1.24 +..B1.23: + fldt 48(%rsp) + fadd %st(2), %st + fstpt 48(%rsp) + fxch %st(3) + faddp %st, %st(2) + jmp ..B1.25 +..B1.24: + fldt 48(%rsp) + fsub %st(2), %st + fstpt 48(%rsp) + fxch %st(3) + fsubrp %st, %st(2) +..B1.25: + fldt 152(%rsp) + fadd %st, %st(5) + fldt 80(%rsp) + faddp %st, %st(1) + fstpt 80(%rsp) + fld %st(0) + fdiv %st(2), %st + fldt 136(%rsp) + fadd %st, %st(4) + faddp %st, %st(5) + fld %st(0) + fchs + fldt 120(%rsp) + fcomip %st(2), %st + fcmovbe %st(1), %st + fstp %st(1) + fldt 64(%rsp) + fcomip %st(1), %st + jbe ..B1.27 +..B1.26: + fstpt 64(%rsp) + movb $1, %cl + jmp ..B1.28 +..B1.27: + fstp %st(0) + testb %cl, %cl + jne ..B1.38 +..B1.28: + fldt 16(%rsp) + negl %eax + fucomip %st(2), %st + fxch %st(4) + fxch %st(1) + jne ..B1.22 + jp ..B1.22 +..B1.29: + fstp %st(2) + fstp %st(0) + fstp %st(1) + fldt 184(%rsp) + fstpt 16(%rsp) + fstpt (%rsp) + fstpt 32(%rsp) + fldl 112(%rsp) +..B1.30: + addl %r13d, %r13d + addq $-16, %rsp + .cfi_def_cfa_offset 272 + negl %r13d + lea 32(%rsp), %rdi + decl %r13d + lea 48(%rsp), %rsi + movl %r13d, %edx + fstpt (%rsp) + fldt (%rsp) + fstpl 80(%rsi) +..___tag_value_yn.22: + call __libm_sincos_pi4l@PLT +..___tag_value_yn.23: +..B1.67: + fldl 128(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 256 +..B1.31: + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt 32(%rsp) + fldt 48(%rsp) + fmulp %st, %st(1) + fldt (%rax) + fdivp %st, %st(3) + fxch %st(2) + fsqrt + fldt 16(%rsp) + fmulp %st, %st(2) + fxch %st(2) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt 16(%rsp) +..B1.32: + testb %r14b, %r14b + je ..B1.34 +..B1.33: + fldcw 218(%rsp) +..B1.34: + fldt 16(%rsp) + testl %r15d, %r15d + fstpl (%rsp) + movsd (%rsp), %xmm1 + movaps %xmm1, %xmm0 + xorps .L_2il0floatpacket.1(%rip), %xmm0 + jl ..L25 + movaps %xmm1, %xmm0 +..L25: + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.35: + movb 7(%rsp), %al + lea _large_value_64(%rip), %rcx + andb $-128, %al + shrb $7, %al + movzbl %al, %edx + movsd (%rcx,%rdx,8), %xmm0 + mulsd (%rcx), %xmm0 + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.36: + call y0@PLT +..B1.68: + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.37: + lea 8+_ones(%rip), %rax + movsd (%rax), %xmm0 + divsd %xmm1, %xmm0 + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.38: + fstp %st(2) + fstp %st(3) + fstp %st(1) + fldt 184(%rsp) + fstpt 16(%rsp) + fxch %st(1) + fstpt (%rsp) + fstpt 32(%rsp) + fldl 112(%rsp) + jmp ..B1.30 +..B1.39: + fstp %st(0) + lea _val_36_0L(%rip), %rax + fldt (%rax) + fcomi %st(1), %st + jbe ..B1.43 +..B1.40: + fstp %st(0) + addq $-16, %rsp + .cfi_def_cfa_offset 272 + fstpt (%rsp) + fldt (%rsp) + fstpl 128(%rsp) +..___tag_value_yn.71: + call __y0l@PLT +..___tag_value_yn.72: +..B1.69: + fldl 128(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 256 +..B1.41: + fxch %st(1) + fstpt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 272 + fstpt (%rsp) + fldt (%rsp) + fstpl 128(%rsp) +..___tag_value_yn.75: + call __y1l@PLT +..___tag_value_yn.76: +..B1.70: + fldl 128(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 256 +..B1.42: + fxch %st(1) + jmp ..B1.45 +..B1.43: + lea _ones(%rip), %rax + lea _PP0(%rip), %rcx + lea 16+_PP0(%rip), %r9 + lea _PP1(%rip), %r8 + lea 16+_PP1(%rip), %r10 + lea 32+_PP0(%rip), %r11 + lea 48+_PP1(%rip), %rsi + lea 64+_PP0(%rip), %rdi + fldl (%rax) + lea 32+_PP1(%rip), %rax + fdiv %st(2), %st + movl $-1, %edx + fmul %st, %st(1) + fld %st(1) + fmul %st(2), %st + fstpt 96(%rsp) + fldt 96(%rsp) + fxch %st(1) + fstpt (%rsp) + fxch %st(1) + fstpt 80(%rsp) + fldt 80(%rsp) + fldt (%rcx) + lea 48+_PP0(%rip), %rcx + fmul %st(2), %st + fldt (%r8) + lea 64+_PP1(%rip), %r8 + fmul %st(3), %st + fldt (%r9) + lea 80+_PP0(%rip), %r9 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r10) + lea 80+_PP1(%rip), %r10 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + lea 96+_PP0(%rip), %r11 + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 96+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rcx) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rsi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rdi) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r8) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r9) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r10) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%r11) + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 112+_PP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 112+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 128+_PP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 128+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 144+_PP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(3), %st + fldt (%rax) + lea 144+_PP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fstpt 16(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 272 + lea 96(%rsp), %rdi + lea 112(%rsp), %rsi + fxch %st(3) + fstpt (%rsp) + fldt (%rsp) + fstpl 16(%rsi) + fldt (%rax) + lea _QP0(%rip), %rax + faddp %st, %st(3) + fxch %st(2) + fstpt -32(%rsi) + fldt (%rax) + lea _QP1(%rip), %rax + fmul %st(1), %st + fldt (%rax) + lea 16+_QP0(%rip), %rax + fmul %st(2), %st + fldt (%rax) + lea 16+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 32+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 32+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 48+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 48+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 64+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 64+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 80+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 80+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 96+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 96+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 112+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 112+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 128+_QP1(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmul %st(2), %st + fldt (%rax) + lea 144+_QP0(%rip), %rax + faddp %st, %st(2) + fxch %st(1) + fmulp %st, %st(2) + fldt (%rax) + lea 144+_QP1(%rip), %rax + faddp %st, %st(1) + fmul %st(2), %st + fstpt -64(%rsi) + fldt (%rax) + faddp %st, %st(1) + fmulp %st, %st(1) + fstpt -48(%rsi) +..___tag_value_yn.79: + call __libm_sincos_pi4l@PLT +..___tag_value_yn.80: +..B1.71: + fldl 128(%rsp) + fldt 80(%rsp) + fldt 64(%rsp) + fldt 48(%rsp) + addq $16, %rsp + .cfi_def_cfa_offset 256 +..B1.44: + fldt (%rsp) + lea _tonpi(%rip), %rax + fldt 96(%rsp) + fmul %st, %st(2) + fmulp %st, %st(4) + fldt 16(%rsp) + fldt (%rax) + fmulp %st, %st(2) + fxch %st(1) + fsqrt + fldt 80(%rsp) + fmul %st, %st(2) + fxch %st(3) + faddp %st, %st(2) + fmul %st, %st(1) + fxch %st(1) + fstpt 32(%rsp) + fxch %st(2) + fmulp %st, %st(1) + fsubp %st, %st(2) + fmulp %st, %st(1) +..B1.45: + lea _val_2_0L(%rip), %rax + cmpl $1, %r13d + fldt (%rax) + movl $0, %eax + fld %st(0) + jle ..B1.49 +..B1.46: + fldt 32(%rsp) + decl %r13d +..B1.47: + fld %st(1) + incl %eax + fdiv %st(5), %st + cmpl %r13d, %eax + fmul %st(4), %st + fxch %st(2) + fadd %st(3), %st + fxch %st(2) + fsubp %st, %st(1) + fld %st(3) + jae ..B1.48 +..B1.73: + fstp %st(4) + fxch %st(3) + jmp ..B1.47 +..B1.48: + fstp %st(5) + fstp %st(4) + fstp %st(0) + fstp %st(0) + fxch %st(1) + fstpt 16(%rsp) + fstpt 32(%rsp) + jmp ..B1.32 +..B1.49: + fstp %st(3) + fstp %st(2) + fstp %st(1) + fstpt 16(%rsp) + jmp ..B1.32 +..B1.50: + testl %ecx, %ecx + jne ..B1.57 +..B1.51: + testl $1048575, 4(%rsp) + jne ..B1.57 +..B1.52: + cmpl $1, (%rsp) + jne ..B1.57 +..B1.53: + lea _large_value_64(%rip), %rax + testl %r15d, %r15d + movsd (%rax), %xmm1 + jl ..B1.55 +..B1.54: + lea 8+_large_value_64(%rip), %rax + movsd (%rax), %xmm0 + mulsd %xmm1, %xmm0 + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.55: + movaps %xmm1, %xmm0 + mulsd %xmm1, %xmm0 +..B1.56: + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.57: + call y1@PLT +..B1.72: + movaps %xmm0, %xmm1 + testl %r15d, %r15d + xorps .L_2il0floatpacket.1(%rip), %xmm1 + jge ..L104 + movaps %xmm1, %xmm0 +..L104: + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.58: + testl $1048575, 4(%rsp) + jne ..B1.64 +..B1.59: + cmpl $0, (%rsp) + jne ..B1.64 +..B1.60: + testb $-128, 7(%rsp) + je ..B1.62 +..B1.61: + lea _infs(%rip), %rax + lea _zeros(%rip), %rdx + movsd (%rax), %xmm0 + mulsd (%rdx), %xmm0 + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.62: + lea _zeros(%rip), %rdx + movl %r13d, %eax + shrl $31, %eax + andl %r13d, %eax + movsd (%rdx,%rax,8), %xmm0 +..B1.63: + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 256 + .cfi_offset 13, -16 + .cfi_offset 14, -24 + .cfi_offset 15, -32 +..B1.64: + lea _ones(%rip), %rax + movsd (%rsp), %xmm0 + mulsd (%rax), %xmm0 + addq $224, %rsp + .cfi_def_cfa_offset 32 + .cfi_restore 15 + popq %r15 + .cfi_def_cfa_offset 24 + .cfi_restore 14 + popq %r14 + .cfi_def_cfa_offset 16 + .cfi_restore 13 + popq %r13 + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type yn,@function + .size yn,.-yn + .data +# -- End yn + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.1: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,16 + .align 8 +.L_2il0floatpacket.0: + .long 0x00000000,0x40adc000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,8 + .align 8 +XINF: + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x00000000,0x00000000 + .long 0x33333333,0x3fd33333 + .long 0xcccccccd,0x3ff4cccc + .long 0x33333333,0x400b3333 + .long 0x33333333,0x401b3333 + .long 0x33333333,0x40273333 + .long 0xcccccccd,0x4031cccc + .long 0x66666666,0x40396666 + .long 0x9999999a,0x40411999 + .long 0x9999999a,0x40461999 + .long 0x66666666,0x404ba666 + .long 0x9999999a,0x4050d999 + .long 0x00000000,0x40542000 + .long 0x33333333,0x40579333 + .long 0x9999999a,0x405b3999 + .long 0x00000000,0x405f0000 + .long 0x00000000,0x40618000 + .long 0x00000000,0x40638000 + .long 0x00000000,0x4065a000 + .long 0x00000000,0x4067e000 + .long 0x00000000,0x406a2000 + .long 0x00000000,0x406c8000 + .long 0x00000000,0x406ee000 + .long 0x00000000,0x4070a000 + .long 0x00000000,0x4071e000 + .long 0x00000000,0x40732000 + .long 0x00000000,0x40746000 + .long 0x00000000,0x4075b000 + .long 0x00000000,0x40770000 + .long 0x00000000,0x40785000 + .long 0x00000000,0x4079a000 + .long 0x00000000,0x407b0000 + .long 0x00000000,0x407c6000 + .long 0x00000000,0x407dc000 + .long 0x00000000,0x407f3000 + .long 0x00000000,0x40804800 + .long 0x00000000,0x40810000 + .long 0x00000000,0x4081b800 + .long 0x00000000,0x40827000 + .long 0x00000000,0x40832800 + .long 0x00000000,0x4083e000 + .long 0x00000000,0x4084a000 + .long 0x00000000,0x40856000 + .long 0x00000000,0x40861800 + .long 0x00000000,0x4086d800 + .long 0x00000000,0x4087a000 + .long 0x00000000,0x40886000 + .long 0x00000000,0x40892000 + .long 0x00000000,0x4089e800 + .long 0x00000000,0x408aa800 + .long 0x00000000,0x408b7000 + .long 0x00000000,0x408c3000 + .long 0x00000000,0x408cf800 + .long 0x00000000,0x408dc000 + .long 0x00000000,0x408e8800 + .long 0x00000000,0x408f5800 + .long 0x00000000,0x40901000 + .long 0x00000000,0x40907400 + .long 0x00000000,0x4090d800 + .long 0x00000000,0x40914000 + .long 0x00000000,0x4091a800 + .long 0x00000000,0x40920c00 + .long 0x00000000,0x40927400 + .long 0x00000000,0x4092dc00 + .long 0x00000000,0x40934400 + .long 0x00000000,0x4093a800 + .long 0x00000000,0x40941000 + .long 0x00000000,0x40947800 + .long 0x00000000,0x4094e400 + .long 0x00000000,0x40954c00 + .long 0x00000000,0x4095b400 + .long 0x00000000,0x40961c00 + .long 0x00000000,0x40968800 + .long 0x00000000,0x4096f000 + .long 0x00000000,0x40975c00 + .long 0x00000000,0x4097c400 + .long 0x00000000,0x40983000 + .long 0x00000000,0x40989800 + .long 0x00000000,0x40990400 + .long 0x00000000,0x40997000 + .long 0x00000000,0x4099d800 + .long 0x00000000,0x409a4400 + .long 0x00000000,0x409ab000 + .long 0x00000000,0x409b1c00 + .long 0x00000000,0x409b8800 + .long 0x00000000,0x409bf400 + .long 0x00000000,0x409c6000 + .long 0x00000000,0x409ccc00 + .long 0x00000000,0x409d3800 + .long 0x00000000,0x409da400 + .long 0x00000000,0x409e1000 + .long 0x00000000,0x409e8000 + .long 0x00000000,0x409eec00 + .long 0x00000000,0x409f5800 + .long 0x00000000,0x409fc800 + .long 0x00000000,0x40a01a00 + .long 0x00000000,0x40a05000 + .long 0x00000000,0x40a08800 + .long 0x00000000,0x40a0be00 + .long 0x00000000,0x40a0f600 + .long 0x00000000,0x40a12c00 + .long 0x00000000,0x40a16400 + .long 0x00000000,0x40a19a00 + .long 0x00000000,0x40a1d200 + .long 0x00000000,0x40a20a00 + .long 0x00000000,0x40a24000 + .long 0x00000000,0x40a27800 + .long 0x00000000,0x40a2b000 + .long 0x00000000,0x40a2e800 + .long 0x00000000,0x40a31e00 + .long 0x00000000,0x40a35600 + .long 0x00000000,0x40a38e00 + .long 0x00000000,0x40a3c600 + .long 0x00000000,0x40a3fe00 + .long 0x00000000,0x40a43600 + .long 0x00000000,0x40a46e00 + .long 0x00000000,0x40a4a600 + .long 0x00000000,0x40a4de00 + .long 0x00000000,0x40a51600 + .long 0x00000000,0x40a54e00 + .long 0x00000000,0x40a58600 + .long 0x00000000,0x40a5be00 + .long 0x00000000,0x40a5f600 + .long 0x00000000,0x40a62e00 + .long 0x00000000,0x40a66600 + .long 0x00000000,0x40a6a000 + .long 0x00000000,0x40a6d800 + .long 0x00000000,0x40a71000 + .long 0x00000000,0x40a74800 + .long 0x00000000,0x40a78200 + .long 0x00000000,0x40a7ba00 + .long 0x00000000,0x40a7f200 + .long 0x00000000,0x40a82c00 + .long 0x00000000,0x40a86400 + .long 0x00000000,0x40a89c00 + .long 0x00000000,0x40a8d600 + .long 0x00000000,0x40a90e00 + .long 0x00000000,0x40a94600 + .long 0x00000000,0x40a98000 + .long 0x00000000,0x40a9b800 + .long 0x00000000,0x40a9f200 + .long 0x00000000,0x40aa2a00 + .long 0x00000000,0x40aa6400 + .long 0x00000000,0x40aa9c00 + .long 0x00000000,0x40aad600 + .long 0x00000000,0x40ab1000 + .long 0x00000000,0x40ab4800 + .long 0x00000000,0x40ab8200 + .long 0x00000000,0x40abba00 + .long 0x00000000,0x40abf400 + .long 0x00000000,0x40ac2e00 + .long 0x00000000,0x40ac6600 + .long 0x00000000,0x40aca000 + .long 0x00000000,0x40acda00 + .long 0x00000000,0x40ad1200 + .long 0x00000000,0x40ad4c00 + .long 0x00000000,0x40ad8600 + .long 0x00000000,0x40adc000 + .type XINF,@object + .size XINF,1288 + .align 4 +_zeros: + .long 0 + .long 0 + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,16 + .align 4 +_infs: + .long 0 + .long 2146435072 + .long 0 + .long 4293918720 + .type _infs,@object + .size _infs,16 + .align 4 +_large_value_64: + .long 0 + .long 2121269248 + .long 0 + .long 4268752896 + .type _large_value_64,@object + .size _large_value_64,16 + .align 4 +_ones: + .long 0 + .long 1072693248 + .long 0 + .long 3220176896 + .type _ones,@object + .size _ones,16 + .align 2 +_val_20_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16387 + .word 0 + .word 0 + .word 0 + .type _val_20_0L,@object + .size _val_20_0L,16 + .align 2 +_val_1000_0L: + .word 0 + .word 0 + .word 0 + .word 64000 + .word 16392 + .word 0 + .word 0 + .word 0 + .type _val_1000_0L,@object + .size _val_1000_0L,16 + .align 2 +_val_4_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16385 + .word 0 + .word 0 + .word 0 + .type _val_4_0L,@object + .size _val_4_0L,16 + .align 2 +_val_8_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16386 + .word 0 + .word 0 + .word 0 + .type _val_8_0L,@object + .size _val_8_0L,16 + .align 2 +_val_n1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 49151 + .word 0 + .word 0 + .word 0 + .type _val_n1_0L,@object + .size _val_n1_0L,16 + .align 2 +_val_3_0L: + .word 0 + .word 0 + .word 0 + .word 49152 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _val_3_0L,@object + .size _val_3_0L,16 + .align 2 +_val_p1_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _val_p1_0L,@object + .size _val_p1_0L,16 + .align 2 +_val_5_0L: + .word 0 + .word 0 + .word 0 + .word 40960 + .word 16385 + .word 0 + .word 0 + .word 0 + .type _val_5_0L,@object + .size _val_5_0L,16 + .align 2 +_val_2_0L: + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16384 + .word 0 + .word 0 + .word 0 + .type _val_2_0L,@object + .size _val_2_0L,16 + .align 2 +_val_0_0L: + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .type _val_0_0L,@object + .size _val_0_0L,16 + .align 2 +_tonpi: + .word 5418 + .word 20036 + .word 33646 + .word 41721 + .word 16382 + .word 0 + .word 0 + .word 0 + .type _tonpi,@object + .size _tonpi,16 + .align 2 +_val_36_0L: + .word 0 + .word 0 + .word 0 + .word 36864 + .word 16388 + .word 0 + .word 0 + .word 0 + .type _val_36_0L,@object + .size _val_36_0L,16 + .align 2 +_PP0: + .word 3555 + .word 4199 + .word 61716 + .word 36505 + .word 49086 + .word 0 + .word 0 + .word 0 + .word 21640 + .word 56203 + .word 47336 + .word 57608 + .word 16322 + .word 0 + .word 0 + .word 0 + .word 3059 + .word 27554 + .word 42044 + .word 45622 + .word 49095 + .word 0 + .word 0 + .word 0 + .word 55815 + .word 35656 + .word 54748 + .word 47307 + .word 16332 + .word 0 + .word 0 + .word 0 + .word 42025 + .word 6728 + .word 28939 + .word 34692 + .word 49106 + .word 0 + .word 0 + .word 0 + .word 58943 + .word 11189 + .word 14960 + .word 38786 + .word 16344 + .word 0 + .word 0 + .word 0 + .word 43526 + .word 20005 + .word 29826 + .word 37014 + .word 49119 + .word 0 + .word 0 + .word 0 + .word 58976 + .word 17109 + .word 36079 + .word 36708 + .word 16359 + .word 0 + .word 0 + .word 0 + .word 58243 + .word 36408 + .word 14563 + .word 58254 + .word 49136 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP0,@object + .size _PP0,160 + .align 2 +_PP1: + .word 52008 + .word 23245 + .word 2457 + .word 38658 + .word 16318 + .word 0 + .word 0 + .word 0 + .word 61876 + .word 57278 + .word 25234 + .word 61346 + .word 49090 + .word 0 + .word 0 + .word 0 + .word 33834 + .word 23040 + .word 39409 + .word 49003 + .word 16327 + .word 0 + .word 0 + .word 0 + .word 54525 + .word 6554 + .word 40935 + .word 51421 + .word 49100 + .word 0 + .word 0 + .word 0 + .word 9848 + .word 9769 + .word 18248 + .word 38344 + .word 16338 + .word 0 + .word 0 + .word 0 + .word 45790 + .word 60252 + .word 47538 + .word 43957 + .word 49112 + .word 0 + .word 0 + .word 0 + .word 27022 + .word 41654 + .word 23333 + .word 43744 + .word 16351 + .word 0 + .word 0 + .word 0 + .word 12816 + .word 40723 + .word 46387 + .word 47196 + .word 49127 + .word 0 + .word 0 + .word 0 + .word 4849 + .word 19418 + .word 12136 + .word 48545 + .word 16369 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 32768 + .word 16383 + .word 0 + .word 0 + .word 0 + .type _PP1,@object + .size _PP1,160 + .align 2 +_QP0: + .word 30466 + .word 14887 + .word 33885 + .word 35327 + .word 16316 + .word 0 + .word 0 + .word 0 + .word 41139 + .word 65374 + .word 59488 + .word 50915 + .word 49088 + .word 0 + .word 0 + .word 0 + .word 35675 + .word 30946 + .word 22284 + .word 35505 + .word 16325 + .word 0 + .word 0 + .word 0 + .word 65216 + .word 29458 + .word 42913 + .word 63176 + .word 49097 + .word 0 + .word 0 + .word 0 + .word 5130 + .word 24339 + .word 48915 + .word 38634 + .word 16335 + .word 0 + .word 0 + .word 0 + .word 30040 + .word 27658 + .word 23448 + .word 34596 + .word 49109 + .word 0 + .word 0 + .word 0 + .word 37816 + .word 17431 + .word 24401 + .word 49646 + .word 16347 + .word 0 + .word 0 + .word 0 + .word 4377 + .word 35057 + .word 45578 + .word 33037 + .word 49123 + .word 0 + .word 0 + .word 0 + .word 19863 + .word 65266 + .word 6202 + .word 53939 + .word 16363 + .word 0 + .word 0 + .word 0 + .word 58254 + .word 36408 + .word 14563 + .word 58254 + .word 49142 + .word 0 + .word 0 + .word 0 + .type _QP0,@object + .size _QP0,160 + .align 2 +_QP1: + .word 65402 + .word 6822 + .word 45128 + .word 37300 + .word 49084 + .word 0 + .word 0 + .word 0 + .word 41532 + .word 52948 + .word 50360 + .word 54021 + .word 16320 + .word 0 + .word 0 + .word 0 + .word 21320 + .word 30785 + .word 26870 + .word 37955 + .word 49093 + .word 0 + .word 0 + .word 0 + .word 55382 + .word 38611 + .word 29746 + .word 34115 + .word 16330 + .word 0 + .word 0 + .word 0 + .word 37194 + .word 6554 + .word 16235 + .word 42314 + .word 49103 + .word 0 + .word 0 + .word 0 + .word 17886 + .word 15840 + .word 33918 + .word 38666 + .word 16341 + .word 0 + .word 0 + .word 0 + .word 62905 + .word 55876 + .word 18072 + .word 57284 + .word 49115 + .word 0 + .word 0 + .word 0 + .word 28423 + .word 64693 + .word 26579 + .word 40379 + .word 16355 + .word 0 + .word 0 + .word 0 + .word 40135 + .word 58793 + .word 24002 + .word 37757 + .word 49132 + .word 0 + .word 0 + .word 0 + .word 43691 + .word 43690 + .word 43690 + .word 43690 + .word 16376 + .word 0 + .word 0 + .word 0 + .type _QP1,@object + .size _QP1,160 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ynf.S b/external/sgx_libm/intel64/ynf.S new file mode 100644 index 0000000000..627810e6cf --- /dev/null +++ b/external/sgx_libm/intel64/ynf.S @@ -0,0 +1,1220 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ynf.c" + .text +..TXTST0: +# -- Begin ynf + .text + .align 16,0x90 + .globl ynf +ynf: +# parameter 1: %edi +# parameter 2: %xmm0 +..B1.1: + .cfi_startproc +..___tag_value_ynf.1: +..L2: + + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + pushq %rbp + .cfi_def_cfa_offset 24 + .cfi_offset 6, -24 + subq $72, %rsp + .cfi_def_cfa_offset 96 + movl %edi, %ebx + movd %xmm0, %ecx + movss %xmm0, (%rsp) + lea -1(%rcx), %esi + cmpl $2139095039, %esi + jae ..B1.48 +..B1.2: + testl %ebx, %ebx + je ..B1.59 +..B1.3: + movl %ecx, %ebp + movl %ebx, %eax + cltd + xorl %ebx, %ebp + shrl $31, %ebp + andl %ebx, %ebp + xorl %edx, %ebx + subl %edx, %ebx + cmpl $1, %ebx + je ..B1.58 +..B1.4: + movl %ebx, %edi + sarl $3, %edi + cmpl $320, %edi + jg ..B1.6 +..B1.5: + movslq %edi, %rdi + lea function_zeros(%rip), %rsi + movss (%rsi,%rdi,4), %xmm0 + jmp ..B1.7 +..B1.6: + pxor %xmm0, %xmm0 + lea -320(%rdi), %esi + lea -2560(,%rdi,8), %edi + subl %esi, %edi + cvtsi2ss %edi, %xmm0 + addss .L_2il0floatpacket.0(%rip), %xmm0 +..B1.7: + movss (%rsp), %xmm3 + comiss %xmm3, %xmm0 + ja ..B1.47 +..B1.8: + cvtss2sd %xmm3, %xmm3 + cmpl $6, %ebx + jge ..B1.26 +..B1.9: + lea _val_0_6(%rip), %rcx + movsd (%rcx), %xmm1 + comisd %xmm3, %xmm1 + jb ..B1.27 +..B1.10: + lea _val_2_0(%rip), %rsi + pxor %xmm5, %xmm5 + lea _zeros(%rip), %rcx + movaps %xmm3, %xmm6 + pxor %xmm4, %xmm4 + testl %ebx, %ebx + pxor %xmm1, %xmm1 + movsd (%rsi), %xmm7 + lea _ones(%rip), %rsi + movsd %xmm1, 8(%rsp) + divsd %xmm7, %xmm6 + cvtss2sd (%rsi), %xmm5 + cvtss2sd (%rcx), %xmm4 + divsd %xmm3, %xmm7 + movsd %xmm5, (%rsp) + movaps %xmm5, %xmm2 + movaps %xmm5, %xmm1 + movaps %xmm5, %xmm8 + movl $0, %ecx + jle ..B1.14 +..B1.11: + movaps %xmm1, %xmm9 +..B1.12: + incl %ecx + mulsd %xmm6, %xmm1 + cmpl %ebx, %ecx + mulsd %xmm7, %xmm9 + jb ..B1.12 +..B1.13: + movsd %xmm9, (%rsp) + testl %ebx, %ebx +..B1.14: + movl $0, %ecx + jle ..B1.18 +..B1.16: + movaps %xmm5, %xmm7 + incl %ecx + divsd %xmm8, %xmm7 + movaps %xmm2, %xmm9 + cmpl %ebx, %ecx + mulsd %xmm8, %xmm2 + addsd %xmm7, %xmm4 + addsd %xmm5, %xmm8 + jb ..B1.16 +..B1.17: + movsd %xmm9, 8(%rsp) +..B1.18: + mulsd %xmm6, %xmm6 + lea _TWO_19H(%rip), %rcx + movsd %xmm5, 32(%rsp) + movaps %xmm4, %xmm8 + movsd %xmm4, 64(%rsp) + xorl %r8d, %r8d + xorps .L_2il0floatpacket.3(%rip), %xmm6 + movl %ebx, %edi + movsd (%rcx), %xmm7 + movl %ebx, %ecx +..B1.19: + incl %r8d + incl %edi + movl %r8d, %r9d + movaps %xmm8, %xmm13 + imull %edi, %r9d + pxor %xmm8, %xmm8 + movss (%rsi), %xmm9 + pxor %xmm10, %xmm10 + movsd 32(%rsp), %xmm11 + movaps %xmm7, %xmm12 + mulsd %xmm6, %xmm11 + cvtsi2ss %r9d, %xmm8 + divss %xmm8, %xmm9 + addl $2, %ecx + cvtsi2sd %ecx, %xmm10 + cvtss2sd %xmm9, %xmm9 + mulsd %xmm9, %xmm10 + mulsd %xmm9, %xmm11 + addsd %xmm10, %xmm4 + addsd %xmm11, %xmm5 + movsd %xmm11, 32(%rsp) + mulsd %xmm4, %xmm11 + addsd 64(%rsp), %xmm11 + mulsd %xmm11, %xmm12 + movsd %xmm11, 64(%rsp) + addsd %xmm12, %xmm11 + movsd %xmm11, 56(%rsp) + movsd 56(%rsp), %xmm8 + subsd %xmm12, %xmm8 + ucomisd %xmm13, %xmm8 + jne ..B1.19 + jp ..B1.19 +..B1.20: + divsd %xmm2, %xmm1 + lea _eulon2(%rip), %rcx + movsd %xmm1, 32(%rsp) + mulsd %xmm1, %xmm5 + movsd (%rcx), %xmm1 + mulsd %xmm1, %xmm3 + movaps %xmm3, %xmm0 + movsd %xmm5, 16(%rsp) + movsd %xmm6, 24(%rsp) +..___tag_value_ynf.8: + call __libm_log_k32@PLT +..___tag_value_ynf.9: +..B1.62: + movsd 24(%rsp), %xmm6 + movaps %xmm0, %xmm1 + movsd 16(%rsp), %xmm5 +..B1.21: + lea _tonpi(%rip), %rsi + lea _oonpi(%rip), %rcx + xorps .L_2il0floatpacket.3(%rip), %xmm6 + cmpl $1, %ebx + movsd (%rsi), %xmm0 + movl $0, %esi + mulsd %xmm5, %xmm0 + movsd (%rcx), %xmm2 + lea -1(%rbx), %ecx + mulsd %xmm1, %xmm0 + movsd 64(%rsp), %xmm1 + mulsd %xmm2, %xmm1 + mulsd 32(%rsp), %xmm1 + subsd %xmm1, %xmm0 + movsd 8(%rsp), %xmm1 + jle ..B1.25 +..B1.22: + movaps %xmm1, %xmm4 + decl %ebx +..B1.23: + incl %esi + lea -1(%rcx), %edi + imull %esi, %ecx + mulsd %xmm6, %xmm4 + cvtsi2sd %ecx, %xmm3 + divsd %xmm3, %xmm4 + movl %edi, %ecx + cmpl %ebx, %esi + addsd %xmm4, %xmm1 + jb ..B1.23 +..B1.25: + mulsd %xmm2, %xmm1 + mulsd (%rsp), %xmm1 + subsd %xmm1, %xmm0 + jmp ..B1.46 +..B1.26: + cmpl $80, %ebx + jge ..B1.35 +..B1.27: + lea _val_18_0(%rip), %rcx + movsd (%rcx), %xmm1 + comisd %xmm3, %xmm1 + jbe ..B1.29 +..B1.28: + movaps %xmm3, %xmm0 + movsd %xmm3, 48(%rsp) + call y0@PLT +..B1.64: + movsd 48(%rsp), %xmm3 + movaps %xmm0, %xmm1 + movaps %xmm3, %xmm0 + movsd %xmm1, (%rsp) + call y1@PLT +..B1.63: + movsd 48(%rsp), %xmm3 + movsd (%rsp), %xmm1 + jmp ..B1.31 +..B1.29: + lea _ones(%rip), %rcx + pxor %xmm1, %xmm1 + lea _val_16_0(%rip), %r8 + lea (%rsp), %rdi + movaps %xmm3, %xmm0 + lea 8(%rsp), %rsi + movl $-1, %edx + cvtss2sd (%rcx), %xmm1 + divsd %xmm3, %xmm1 + movsd (%r8), %xmm8 + mulsd %xmm1, %xmm8 + movaps %xmm8, %xmm6 + mulsd %xmm8, %xmm6 + movaps %xmm6, %xmm7 + mulsd %xmm6, %xmm7 + movq $0, 56(%rsi) + movsd %xmm1, 8(%rsi) + movsd %xmm6, 16(%rsi) + movsd %xmm7, 24(%rsi) + movsd %xmm8, 32(%rsi) + movsd %xmm3, 40(%rsi) +..___tag_value_ynf.10: + call __libm_sincos_k32@PLT +..___tag_value_ynf.11: +..B1.30: + lea 40+_PP1(%rip), %r11 + lea 40+_PP0(%rip), %rcx + movsd 32(%rsp), %xmm7 + lea 24+_PP0(%rip), %rsi + lea 8+_PP0(%rip), %rdi + lea 32+_PP0(%rip), %r8 + movsd 24(%rsp), %xmm6 + lea 16+_PP0(%rip), %r9 + movsd (%r11), %xmm11 + lea _PP0(%rip), %r10 + movsd (%rcx), %xmm1 + lea 24+_PP1(%rip), %rcx + movsd (%r8), %xmm2 + movsd 40(%rsp), %xmm8 + mulsd %xmm7, %xmm11 + mulsd %xmm7, %xmm1 + mulsd %xmm7, %xmm2 + addsd (%rcx), %xmm11 + addsd (%rsi), %xmm1 + addsd (%r9), %xmm2 + mulsd %xmm7, %xmm11 + mulsd %xmm7, %xmm1 + mulsd %xmm7, %xmm2 + addsd (%rdi), %xmm1 + addsd (%r10), %xmm2 + mulsd %xmm6, %xmm1 + lea 8+_PP1(%rip), %rcx + addsd %xmm2, %xmm1 + addsd (%rcx), %xmm11 + lea 32+_PP1(%rip), %rcx + mulsd %xmm6, %xmm11 + movsd (%rcx), %xmm4 + lea 16+_PP1(%rip), %rcx + mulsd %xmm7, %xmm4 + movsd 48(%rsp), %xmm3 + addsd (%rcx), %xmm4 + lea _PP1(%rip), %rcx + mulsd %xmm7, %xmm4 + addsd (%rcx), %xmm4 + lea 40+_QP0(%rip), %rcx + movsd (%rcx), %xmm9 + lea 24+_QP0(%rip), %rcx + mulsd %xmm7, %xmm9 + addsd %xmm4, %xmm11 + addsd (%rcx), %xmm9 + lea 8+_QP0(%rip), %rcx + mulsd %xmm7, %xmm9 + addsd (%rcx), %xmm9 + lea 32+_QP0(%rip), %rcx + movsd (%rcx), %xmm5 + lea 16+_QP0(%rip), %rcx + mulsd %xmm7, %xmm5 + mulsd %xmm6, %xmm9 + addsd (%rcx), %xmm5 + mulsd %xmm8, %xmm9 + mulsd %xmm7, %xmm5 + lea _QP0(%rip), %rcx + addsd (%rcx), %xmm5 + lea 40+_QP1(%rip), %rcx + movsd (%rcx), %xmm10 + lea 24+_QP1(%rip), %rcx + mulsd %xmm7, %xmm10 + mulsd %xmm8, %xmm5 + addsd (%rcx), %xmm10 + addsd %xmm5, %xmm9 + mulsd %xmm7, %xmm10 + lea 8+_QP1(%rip), %rcx + addsd (%rcx), %xmm10 + lea 32+_QP1(%rip), %rcx + mulsd %xmm6, %xmm10 + movsd (%rcx), %xmm6 + lea 16+_QP1(%rip), %rcx + mulsd %xmm7, %xmm6 + mulsd %xmm8, %xmm10 + addsd (%rcx), %xmm6 + mulsd %xmm7, %xmm6 + lea _QP1(%rip), %rcx + movsd 8(%rsp), %xmm7 + mulsd %xmm7, %xmm9 + addsd (%rcx), %xmm6 + mulsd %xmm11, %xmm7 + mulsd %xmm8, %xmm6 + lea _tonpi(%rip), %rcx + addsd %xmm6, %xmm10 + movsd (%rcx), %xmm0 + mulsd 16(%rsp), %xmm0 + movsd (%rsp), %xmm8 + sqrtsd %xmm0, %xmm0 + mulsd %xmm8, %xmm1 + mulsd %xmm10, %xmm8 + addsd %xmm9, %xmm1 + subsd %xmm7, %xmm8 + mulsd %xmm0, %xmm1 + mulsd %xmm8, %xmm0 +..B1.31: + lea _val_2_0(%rip), %rcx + cmpl $1, %ebx + movsd (%rcx), %xmm2 + movl $0, %ecx + divsd %xmm3, %xmm2 + jle ..B1.46 +..B1.32: + decl %ebx +..B1.33: + incl %ecx + pxor %xmm3, %xmm3 + cvtsi2sd %ecx, %xmm3 + mulsd %xmm2, %xmm3 + movaps %xmm0, %xmm4 + mulsd %xmm0, %xmm3 + cmpl %ebx, %ecx + movaps %xmm3, %xmm0 + subsd %xmm1, %xmm0 + movaps %xmm4, %xmm1 + jb ..B1.33 + jmp ..B1.46 +..B1.35: + pxor %xmm1, %xmm1 + lea 5000(%rbx,%rbx,4), %ecx + cvtsi2sd %ecx, %xmm1 + comisd %xmm3, %xmm1 + ja ..B1.27 +..B1.36: + pxor %xmm1, %xmm1 + lea _val_4_0(%rip), %rsi + cvtsi2sd %ebx, %xmm1 + movsd (%rsi), %xmm15 + pxor %xmm2, %xmm2 + movaps %xmm15, %xmm14 + lea _val_5_0(%rip), %rsi + mulsd %xmm1, %xmm14 + lea 4+_ones(%rip), %r9 + cvtss2sd (%r9), %xmm2 + mulsd %xmm1, %xmm14 + lea _val_8_0(%rip), %rdi + addsd %xmm14, %xmm2 + movsd (%rdi), %xmm11 + pxor %xmm1, %xmm1 + mulsd %xmm3, %xmm11 + lea _ones(%rip), %r8 + cvtss2sd (%r8), %xmm1 + divsd %xmm11, %xmm2 + lea _val_2_0(%rip), %r10 + lea _val_3_0(%rip), %r11 + movaps %xmm1, %xmm12 + movaps %xmm1, %xmm4 + movsd %xmm2, 32(%rsp) + movaps %xmm1, %xmm13 + movsd (%rsi), %xmm6 + movl $-1, %ecx + movsd (%r10), %xmm10 + xorb %sil, %sil + movsd (%r11), %xmm8 + movaps %xmm10, %xmm9 + divsd %xmm1, %xmm12 + movaps %xmm8, %xmm7 +..B1.37: + movsd %xmm4, 64(%rsp) + movaps %xmm7, %xmm4 + mulsd %xmm7, %xmm4 + movaps %xmm14, %xmm5 + movaps %xmm6, %xmm0 + testl %ecx, %ecx + mulsd %xmm6, %xmm0 + subsd %xmm4, %xmm5 + movaps %xmm9, %xmm4 + mulsd %xmm11, %xmm4 + divsd %xmm4, %xmm5 + movaps %xmm14, %xmm4 + mulsd 32(%rsp), %xmm5 + subsd %xmm0, %xmm4 + movaps %xmm11, %xmm0 + mulsd %xmm8, %xmm0 + divsd %xmm0, %xmm4 + mulsd %xmm5, %xmm4 + jle ..B1.57 +..B1.38: + addsd %xmm5, %xmm1 + addsd %xmm4, %xmm2 +..B1.39: + movsd %xmm4, 32(%rsp) + addsd %xmm10, %xmm9 + mulsd %xmm12, %xmm4 + addsd %xmm10, %xmm8 + addsd %xmm15, %xmm7 + addsd %xmm15, %xmm6 + andps .L_2il0floatpacket.2(%rip), %xmm4 + comisd %xmm4, %xmm13 + jbe ..B1.41 +..B1.40: + movaps %xmm4, %xmm13 + movb $1, %sil + jmp ..B1.42 +..B1.41: + testb %sil, %sil + jne ..B1.44 +..B1.42: + lea _TWO_19H(%rip), %rdi + movaps %xmm1, %xmm4 + negl %ecx + movsd (%rdi), %xmm5 + mulsd %xmm1, %xmm5 + addsd %xmm5, %xmm4 + movsd %xmm4, 56(%rsp) + movsd 56(%rsp), %xmm4 + subsd %xmm5, %xmm4 + ucomisd 64(%rsp), %xmm4 + jne ..B1.37 + jp ..B1.37 +..B1.44: + addl %ebx, %ebx + lea 64(%rsp), %rdi + negl %ebx + lea 32(%rsp), %rsi + decl %ebx + movaps %xmm3, %xmm0 + movl %ebx, %edx + movsd %xmm2, (%rsp) + movsd %xmm1, -24(%rsi) + movsd %xmm3, 16(%rsi) +..___tag_value_ynf.12: + call __libm_sincos_k32@PLT +..___tag_value_ynf.13: +..B1.45: + lea _tonpi(%rip), %rax + movsd 48(%rsp), %xmm3 + movsd 8(%rsp), %xmm1 + movsd (%rsp), %xmm2 + movsd (%rax), %xmm0 + divsd %xmm3, %xmm0 + sqrtsd %xmm0, %xmm0 + mulsd 64(%rsp), %xmm1 + mulsd 32(%rsp), %xmm2 + addsd %xmm2, %xmm1 + mulsd %xmm1, %xmm0 +..B1.46: + movaps %xmm0, %xmm1 + testl %ebp, %ebp + xorps .L_2il0floatpacket.3(%rip), %xmm1 + jne ..L14 + movaps %xmm0, %xmm1 +..L14: + cvtsd2ss %xmm1, %xmm1 + movaps %xmm1, %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.47: + lea _large_value_32(%rip), %rax + shrl $31, %ecx + movss (%rax,%rcx,4), %xmm0 + mulss .L_2il0floatpacket.1(%rip), %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.48: + movl %ecx, %ebp + andl $2147483647, %ebp + cmpl $2139095040, %ebp + ja ..B1.55 +..B1.49: + testl %ebp, %ebp + je ..B1.54 +..B1.50: + testl $-2147483648, %ecx + je ..B1.52 +..B1.51: + lea _zeros(%rip), %rax + lea _infs(%rip), %rdx + movss (%rax), %xmm0 + mulss (%rdx), %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.52: + lea _zeros(%rip), %rax + movl %ebx, %ecx + shrl $31, %ecx + andl %ebx, %ecx + movss (%rax,%rcx,4), %xmm0 +..B1.53: + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.54: + lea 4+_ones(%rip), %rax + lea _zeros(%rip), %rdx + movss (%rax), %xmm0 + divss (%rdx), %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.55: + lea _ones(%rip), %rax + movss (%rsp), %xmm0 + mulss (%rax), %xmm0 + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.57: + subsd %xmm5, %xmm1 + subsd %xmm4, %xmm2 + jmp ..B1.39 +..B1.58: + movss (%rsp), %xmm0 + call y1f@PLT +..B1.65: + movaps %xmm0, %xmm1 + testl %ebp, %ebp + xorps .L_2il0floatpacket.4(%rip), %xmm1 + je ..L63 + movaps %xmm1, %xmm0 +..L63: + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .cfi_def_cfa_offset 96 + .cfi_offset 3, -16 + .cfi_offset 6, -24 +..B1.59: + movss (%rsp), %xmm0 + call y0f@PLT +..B1.66: + addq $72, %rsp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rbx + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ynf,@function + .size ynf,.-ynf + .data +# -- End ynf + .data + .align 4 + .align 4 +_zeros: + .long 0 + .long 2147483648 + .type _zeros,@object + .size _zeros,8 + .align 4 +_ones: + .long 1065353216 + .long 3212836864 + .type _ones,@object + .size _ones,8 + .align 4 +_infs: + .long 2139095040 + .long 4286578688 + .type _infs,@object + .size _infs,8 + .section .rodata, "a" + .align 16 + .align 16 +.L_2il0floatpacket.2: + .long 0xffffffff,0x7fffffff,0x00000000,0x00000000 + .type .L_2il0floatpacket.2,@object + .size .L_2il0floatpacket.2,16 + .align 16 +.L_2il0floatpacket.3: + .long 0x00000000,0x80000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.3,@object + .size .L_2il0floatpacket.3,16 + .align 16 +.L_2il0floatpacket.4: + .long 0x80000000,0x00000000,0x00000000,0x00000000 + .type .L_2il0floatpacket.4,@object + .size .L_2il0floatpacket.4,16 + .align 4 +.L_2il0floatpacket.0: + .long 0x450e6000 + .type .L_2il0floatpacket.0,@object + .size .L_2il0floatpacket.0,4 + .align 4 +.L_2il0floatpacket.1: + .long 0x71800000 + .type .L_2il0floatpacket.1,@object + .size .L_2il0floatpacket.1,4 + .align 4 +function_zeros: + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x3ecccccd + .long 0x3fa66666 + .long 0x40400000 + .long 0x40a9999a + .long 0x4101999a + .long 0x41366666 + .long 0x4171999a + .long 0x4198cccd + .long 0x41ba6666 + .long 0x41df3333 + .long 0x42026666 + .long 0x42160000 + .long 0x422a0000 + .long 0x423f3333 + .long 0x42546666 + .long 0x426a0000 + .long 0x42803333 + .long 0x428b999a + .long 0x42970000 + .long 0x42a2999a + .long 0x42ae6666 + .long 0x42ba6666 + .long 0x42c66666 + .long 0x42d2999a + .long 0x42decccd + .long 0x42eb3333 + .long 0x42f7999a + .long 0x4302199a + .long 0x43086666 + .long 0x430ecccd + .long 0x43153333 + .long 0x431b999a + .long 0x4322199a + .long 0x4328999a + .long 0x432f199a + .long 0x4335b333 + .long 0x433c3333 + .long 0x4342e666 + .long 0x43498000 + .long 0x43503333 + .long 0x4356e666 + .long 0x435d999a + .long 0x43644ccd + .long 0x436b0000 + .long 0x4371cccd + .long 0x4378999a + .long 0x437f6666 + .long 0x4383199a + .long 0x43868ccd + .long 0x4389f333 + .long 0x438d6666 + .long 0x4390d99a + .long 0x43944ccd + .long 0x4397c000 + .long 0x439b3333 + .long 0x439eb333 + .long 0x43a23333 + .long 0x43a5a666 + .long 0x43a92666 + .long 0x43aca666 + .long 0x43b02666 + .long 0x43b3a666 + .long 0x43b73333 + .long 0x43bab333 + .long 0x43be4000 + .long 0x43c1c000 + .long 0x43c54ccd + .long 0x43c8d99a + .long 0x43cc6666 + .long 0x43cff333 + .long 0x43d38000 + .long 0x43d70ccd + .long 0x43da999a + .long 0x43de2666 + .long 0x43e1c000 + .long 0x43e54ccd + .long 0x43e8e666 + .long 0x43ec8000 + .long 0x43f00ccd + .long 0x43f3a666 + .long 0x43f74000 + .long 0x43fad99a + .long 0x43fe7333 + .long 0x44010666 + .long 0x4402d333 + .long 0x4404a000 + .long 0x44067333 + .long 0x44084000 + .long 0x440a0ccd + .long 0x440be000 + .long 0x440daccd + .long 0x440f8000 + .long 0x44114ccd + .long 0x44132000 + .long 0x4414f333 + .long 0x4416c666 + .long 0x4418999a + .long 0x441a6666 + .long 0x441c399a + .long 0x441e0ccd + .long 0x441fe000 + .long 0x4421b333 + .long 0x44238ccd + .long 0x44256000 + .long 0x44273333 + .long 0x44290666 + .long 0x442ae000 + .long 0x442cb333 + .long 0x442e8666 + .long 0x44306000 + .long 0x44323333 + .long 0x44340ccd + .long 0x4435e000 + .long 0x4437b99a + .long 0x44398ccd + .long 0x443b6666 + .long 0x443d4000 + .long 0x443f199a + .long 0x4440eccd + .long 0x4442c666 + .long 0x4444a000 + .long 0x4446799a + .long 0x44485333 + .long 0x444a2ccd + .long 0x444c0666 + .long 0x444de000 + .long 0x444fb99a + .long 0x44519333 + .long 0x44536ccd + .long 0x44554666 + .long 0x44572000 + .long 0x44590000 + .long 0x445ad99a + .long 0x445cb333 + .long 0x445e9333 + .long 0x44606ccd + .long 0x44624666 + .long 0x44642666 + .long 0x44660000 + .long 0x4467d99a + .long 0x4469b99a + .long 0x446b9333 + .long 0x446d7333 + .long 0x446f5333 + .long 0x44712ccd + .long 0x44730ccd + .long 0x4474e666 + .long 0x4476c666 + .long 0x4478a666 + .long 0x447a8000 + .long 0x447c6000 + .long 0x447e4000 + .long 0x44801000 + .long 0x4480fccd + .long 0x4481eccd + .long 0x4482dccd + .long 0x4483cccd + .long 0x4484bccd + .long 0x4485accd + .long 0x44869ccd + .long 0x44878ccd + .long 0x44887ccd + .long 0x44896ccd + .long 0x448a5ccd + .long 0x448b4ccd + .long 0x448c3ccd + .long 0x448d2ccd + .long 0x448e1ccd + .long 0x448f0ccd + .long 0x448ffccd + .long 0x4490eccd + .long 0x4491e000 + .long 0x4492d000 + .long 0x4493c000 + .long 0x4494b000 + .long 0x4495a333 + .long 0x44969333 + .long 0x44978333 + .long 0x44987333 + .long 0x44996666 + .long 0x449a5666 + .long 0x449b499a + .long 0x449c399a + .long 0x449d299a + .long 0x449e1ccd + .long 0x449f0ccd + .long 0x44a00000 + .long 0x44a0f000 + .long 0x44a1e333 + .long 0x44a2d333 + .long 0x44a3c666 + .long 0x44a4b666 + .long 0x44a5a99a + .long 0x44a6999a + .long 0x44a78ccd + .long 0x44a87ccd + .long 0x44a97000 + .long 0x44aa6333 + .long 0x44ab5333 + .long 0x44ac4666 + .long 0x44ad399a + .long 0x44ae299a + .long 0x44af1ccd + .long 0x44b01000 + .long 0x44b10333 + .long 0x44b1f333 + .long 0x44b2e666 + .long 0x44b3d99a + .long 0x44b4cccd + .long 0x44b5bccd + .long 0x44b6b000 + .long 0x44b7a333 + .long 0x44b89666 + .long 0x44b9899a + .long 0x44ba7ccd + .long 0x44bb6ccd + .long 0x44bc6000 + .long 0x44bd5333 + .long 0x44be4666 + .long 0x44bf399a + .long 0x44c02ccd + .long 0x44c12000 + .long 0x44c21333 + .long 0x44c30666 + .long 0x44c3f99a + .long 0x44c4eccd + .long 0x44c5e000 + .long 0x44c6d333 + .long 0x44c7c666 + .long 0x44c8b99a + .long 0x44c9accd + .long 0x44caa000 + .long 0x44cb9333 + .long 0x44cc899a + .long 0x44cd7ccd + .long 0x44ce7000 + .long 0x44cf6333 + .long 0x44d05666 + .long 0x44d1499a + .long 0x44d23ccd + .long 0x44d33333 + .long 0x44d42666 + .long 0x44d5199a + .long 0x44d60ccd + .long 0x44d70000 + .long 0x44d7f666 + .long 0x44d8e99a + .long 0x44d9dccd + .long 0x44dad000 + .long 0x44dbc666 + .long 0x44dcb99a + .long 0x44ddaccd + .long 0x44dea333 + .long 0x44df9666 + .long 0x44e0899a + .long 0x44e18000 + .long 0x44e27333 + .long 0x44e36666 + .long 0x44e45ccd + .long 0x44e55000 + .long 0x44e64333 + .long 0x44e7399a + .long 0x44e82ccd + .long 0x44e92333 + .long 0x44ea1666 + .long 0x44eb099a + .long 0x44ec0000 + .long 0x44ecf333 + .long 0x44ede99a + .long 0x44eedccd + .long 0x44efd333 + .long 0x44f0c666 + .long 0x44f1bccd + .long 0x44f2b000 + .long 0x44f3a666 + .long 0x44f4999a + .long 0x44f59000 + .long 0x44f68333 + .long 0x44f7799a + .long 0x44f86ccd + .long 0x44f96333 + .long 0x44fa599a + .long 0x44fb4ccd + .long 0x44fc4333 + .long 0x44fd3666 + .long 0x44fe2ccd + .long 0x44ff2000 + .long 0x45000b33 + .long 0x45008666 + .long 0x45010000 + .long 0x45017000 + .long 0x4501f000 + .long 0x45027000 + .long 0x4502e000 + .long 0x45036000 + .long 0x4503e000 + .long 0x45045000 + .long 0x4504d000 + .long 0x45055000 + .long 0x4505c000 + .long 0x45064000 + .long 0x4506c000 + .long 0x45073000 + .long 0x4507b000 + .long 0x45083000 + .long 0x4508a000 + .long 0x45092000 + .long 0x4509a000 + .long 0x450a1000 + .long 0x450a9000 + .long 0x450b1000 + .long 0x450b8000 + .long 0x450c0000 + .long 0x450c8000 + .long 0x450cf000 + .long 0x450d7000 + .long 0x450df000 + .long 0x450e6000 + .type function_zeros,@object + .size function_zeros,1284 + .align 4 +_val_0_6: + .long 858993459 + .long 1071854387 + .type _val_0_6,@object + .size _val_0_6,8 + .align 4 +_val_2_0: + .long 0 + .long 1073741824 + .type _val_2_0,@object + .size _val_2_0,8 + .align 4 +_TWO_19H: + .long 0 + .long 1093140480 + .type _TWO_19H,@object + .size _TWO_19H,8 + .align 4 +_eulon2: + .long 3400611180 + .long 1072463685 + .type _eulon2,@object + .size _eulon2,8 + .align 4 +_tonpi: + .long 1841940611 + .long 1071931184 + .type _tonpi,@object + .size _tonpi,8 + .align 4 +_oonpi: + .long 1841940611 + .long 1070882608 + .type _oonpi,@object + .size _oonpi,8 + .align 4 +_val_18_0: + .long 0 + .long 1077018624 + .type _val_18_0,@object + .size _val_18_0,8 + .align 4 +_val_16_0: + .long 0 + .long 1076887552 + .type _val_16_0,@object + .size _val_16_0,8 + .align 4 +_PP1: + .long 551 + .long 1072693248 + .long 4267608614 + .long 1061027839 + .long 3690881252 + .long 3200414971 + .long 3933039373 + .long 1046848465 + .long 3246008603 + .long 3189439465 + .long 1689113401 + .long 1037483563 + .type _PP1,@object + .size _PP1,48 + .align 4 +_PP0: + .long 4294966288 + .long 1072693247 + .long 4269912424 + .long 3207725055 + .long 1780799603 + .long 1052554744 + .long 2285933488 + .long 3194113879 + .long 3892950982 + .long 1041746526 + .long 150212775 + .long 3184818833 + .type _PP0,@object + .size _PP0,48 + .align 4 +_QP0: + .long 4294921804 + .long 3212836863 + .long 4153409851 + .long 1056096255 + .long 2226361937 + .long 3196916170 + .long 3849695089 + .long 1044094312 + .long 663042994 + .long 3187124278 + .long 3336948587 + .long 1035486718 + .type _QP0,@object + .size _QP0,48 + .align 4 +_QP1: + .long 4294954956 + .long 1066926079 + .long 4141388976 + .long 3204071423 + .long 1500123100 + .long 1049740228 + .long 3264213437 + .long 3191856517 + .long 1489731078 + .long 1039824630 + .long 1807021260 + .long 3183130166 + .type _QP1,@object + .size _QP1,48 + .align 4 +_val_4_0: + .long 0 + .long 1074790400 + .type _val_4_0,@object + .size _val_4_0,8 + .align 4 +_val_5_0: + .long 0 + .long 1075052544 + .type _val_5_0,@object + .size _val_5_0,8 + .align 4 +_val_8_0: + .long 0 + .long 1075838976 + .type _val_8_0,@object + .size _val_8_0,8 + .align 4 +_val_3_0: + .long 0 + .long 1074266112 + .type _val_3_0,@object + .size _val_3_0,8 + .align 4 +_large_value_32: + .long 1904214016 + .long 4051697664 + .type _large_value_32,@object + .size _large_value_32,8 + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/intel64/ynl.S b/external/sgx_libm/intel64/ynl.S new file mode 100644 index 0000000000..1c5b35aa9f --- /dev/null +++ b/external/sgx_libm/intel64/ynl.S @@ -0,0 +1,95 @@ +/* +* Math library +* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Author Name +* History: +* 03-14-2016 Initial version. numerics svn rev. 12864 +*/ + .file "ynl.c" + .text +..TXTST0: +# -- Begin ynl + .text + .align 16,0x90 + .globl ynl +ynl: +# parameter 1: %edi +# parameter 2: 32 + %rsp +..B1.1: + .cfi_startproc +..___tag_value_ynl.1: +..L2: + + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + subq $16, %rsp + .cfi_def_cfa_offset 32 + movl %edi, %ebp + fldt 32(%rsp) + addq $-16, %rsp + .cfi_def_cfa_offset 48 + lea 16(%rsp), %rdi + fstpt (%rsp) + call __ltoq@PLT +..B1.6: + addq $16, %rsp + .cfi_def_cfa_offset 32 + movl %ebp, %edi + movaps (%rsp), %xmm0 +..___tag_value_ynl.8: + call __ynq@PLT +..___tag_value_ynl.9: +..B1.2: + movaps %xmm0, (%rsp) + lea (%rsp), %rdi + call __qtol@PLT +..B1.7: + addq $16, %rsp + .cfi_def_cfa_offset 16 + .cfi_restore 6 + popq %rbp + .cfi_def_cfa_offset 8 + ret + .align 16,0x90 + .cfi_endproc + .type ynl,@function + .size ynl,.-ynl + .data +# -- End ynl + .data + .section .note.GNU-stack, "" +// -- Begin DWARF2 SEGMENT .eh_frame + .section .eh_frame,"a",@progbits +.eh_frame_seg: + .align 1 +# End diff --git a/external/sgx_libm/makefile b/external/sgx_libm/makefile new file mode 100644 index 0000000000..e275bca40f --- /dev/null +++ b/external/sgx_libm/makefile @@ -0,0 +1,25 @@ +ARCH ?= intel64 +.PHONE: lib clean +all: lib + cp $(ARCH)/libm.a libm.a +ifeq ($(ARCH),ia32) +CFLAGS := -m32 +endif + +SRC_FILES := $(wildcard $(ARCH)/*.S) +OBJ_FILES := $(SRC_FILES:.S=.o) +STATIC_LIB:= $(ARCH)/libm.a +SHARED_LIB:= $(ARCH)/libm.so +lib : $(STATIC_LIB) $(SHARED_LIB) + +%.o : %.S + gcc $(CFLAGS) -c $< -o $@ + +$(STATIC_LIB) : $(OBJ_FILES) + ar crv $@ $^ + +$(SHARED_LIB) : $(OBJ_FILES) + gcc $(CFLAGS) -shared -o $@ $^ + +clean: + -rm -rf $(OBJ_FILES) $(STATIC_LIB) $(SHARED_LIB) libm.a diff --git a/external/tinyxml/tinystr.cpp b/external/tinyxml/tinystr.cpp new file mode 100644 index 0000000000..07047a77ba --- /dev/null +++ b/external/tinyxml/tinystr.cpp @@ -0,0 +1,117 @@ +/* +www.sourceforge.net/projects/tinyxml +Original file by Yves Berquin. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +/* + * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005. + */ + + + +#ifndef TIXML_USE_STL + +#include "tinystr.h" + +// Error value for find primitive +const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); + + +// Null rep. +TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; + + +void TiXmlString::reserve (size_type cap) +{ + if (cap > capacity()) + { + TiXmlString tmp; + tmp.init(length(), cap); + memcpy(tmp.start(), data(), length()); + swap(tmp); + } +} + + +TiXmlString& TiXmlString::assign(const char* str, size_type len) +{ + size_type cap = capacity(); + if (len > cap || cap > 3*(len + 8)) + { + TiXmlString tmp; + tmp.init(len); + memcpy(tmp.start(), str, len); + swap(tmp); + } + else + { + memmove(start(), str, len); + set_size(len); + } + return *this; +} + + +TiXmlString& TiXmlString::append(const char* str, size_type len) +{ + size_type newsize = length() + len; + if (newsize > capacity()) + { + reserve (newsize + capacity()); + } + memmove(finish(), str, len); + set_size(newsize); + return *this; +} + + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) +{ + TiXmlString tmp; + tmp.reserve(a.length() + b.length()); + tmp += a; + tmp += b; + return tmp; +} + +TiXmlString operator + (const TiXmlString & a, const char* b) +{ + TiXmlString tmp; + TiXmlString::size_type b_len = static_cast( strlen(b) ); + tmp.reserve(a.length() + b_len); + tmp += a; + tmp.append(b, b_len); + return tmp; +} + +TiXmlString operator + (const char* a, const TiXmlString & b) +{ + TiXmlString tmp; + TiXmlString::size_type a_len = static_cast( strlen(a) ); + tmp.reserve(a_len + b.length()); + tmp.append(a, a_len); + tmp += b; + return tmp; +} + + +#endif // TIXML_USE_STL diff --git a/external/tinyxml/tinystr.h b/external/tinyxml/tinystr.h new file mode 100644 index 0000000000..3c2aa9d54d --- /dev/null +++ b/external/tinyxml/tinystr.h @@ -0,0 +1,319 @@ +/* +www.sourceforge.net/projects/tinyxml +Original file by Yves Berquin. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +/* + * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005. + * + * - completely rewritten. compact, clean, and fast implementation. + * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems) + * - fixed reserve() to work as per specification. + * - fixed buggy compares operator==(), operator<(), and operator>() + * - fixed operator+=() to take a const ref argument, following spec. + * - added "copy" constructor with length, and most compare operators. + * - added swap(), clear(), size(), capacity(), operator+(). + */ + +#ifndef TIXML_USE_STL + +#ifndef TIXML_STRING_INCLUDED +#define TIXML_STRING_INCLUDED + +#include +#include + +/* The support for explicit isn't that universal, and it isn't really + required - it is used to check that the TiXmlString class isn't incorrectly + used. Be nice to old compilers and macro it here: +*/ +#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + #define TIXML_EXPLICIT explicit +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + #define TIXML_EXPLICIT explicit +#else + #define TIXML_EXPLICIT +#endif + + +/* + TiXmlString is an emulation of a subset of the std::string template. + Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. + Only the member functions relevant to the TinyXML project have been implemented. + The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase + a string and there's no more room, we allocate a buffer twice as big as we need. +*/ +class TiXmlString +{ + public : + // The size type used + typedef size_t size_type; + + // Error value for find primitive + static const size_type npos; // = -1; + + + // TiXmlString empty constructor + TiXmlString () : rep_(&nullrep_) + { + } + + // TiXmlString copy constructor + TiXmlString ( const TiXmlString & copy) : rep_(0) + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) + { + init( static_cast( strlen(copy) )); + memcpy(start(), copy, length()); + } + + // TiXmlString constructor, based on a string + TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) + { + init(len); + memcpy(start(), str, len); + } + + // TiXmlString destructor + ~TiXmlString () + { + quit(); + } + + // = operator + TiXmlString& operator = (const char * copy) + { + return assign( copy, (size_type)strlen(copy)); + } + + // = operator + TiXmlString& operator = (const TiXmlString & copy) + { + return assign(copy.start(), copy.length()); + } + + + // += operator. Maps to append + TiXmlString& operator += (const char * suffix) + { + return append(suffix, static_cast( strlen(suffix) )); + } + + // += operator. Maps to append + TiXmlString& operator += (char single) + { + return append(&single, 1); + } + + // += operator. Maps to append + TiXmlString& operator += (const TiXmlString & suffix) + { + return append(suffix.data(), suffix.length()); + } + + + // Convert a TiXmlString into a null-terminated char * + const char * c_str () const { return rep_->str; } + + // Convert a TiXmlString into a char * (need not be null terminated). + const char * data () const { return rep_->str; } + + // Return the length of a TiXmlString + size_type length () const { return rep_->size; } + + // Alias for length() + size_type size () const { return rep_->size; } + + // Checks if a TiXmlString is empty + bool empty () const { return rep_->size == 0; } + + // Return capacity of string + size_type capacity () const { return rep_->capacity; } + + + // single char extraction + const char& at (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // [] operator + char& operator [] (size_type index) const + { + assert( index < length() ); + return rep_->str[ index ]; + } + + // find a char in a string. Return TiXmlString::npos if not found + size_type find (char lookup) const + { + return find(lookup, 0); + } + + // find a char in a string from an offset. Return TiXmlString::npos if not found + size_type find (char tofind, size_type offset) const + { + if (offset >= length()) return npos; + + for (const char* p = c_str() + offset; *p != '\0'; ++p) + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } + return npos; + } + + void clear () + { + //Lee: + //The original was just too strange, though correct: + // TiXmlString().swap(*this); + //Instead use the quit & re-init: + quit(); + init(0,0); + } + + /* Function to reserve a big amount of data when we know we'll need it. Be aware that this + function DOES NOT clear the content of the TiXmlString if any exists. + */ + void reserve (size_type cap); + + TiXmlString& assign (const char* str, size_type len); + + TiXmlString& append (const char* str, size_type len); + + void swap (TiXmlString& other) + { + Rep* r = rep_; + rep_ = other.rep_; + other.rep_ = r; + } + + private: + + void init(size_type sz) { init(sz, sz); } + void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } + char* start() const { return rep_->str; } + char* finish() const { return rep_->str + rep_->size; } + + struct Rep + { + size_type size, capacity; + char str[1]; + }; + + void init(size_type sz, size_type cap) + { + if (cap) + { + // Lee: the original form: + // rep_ = static_cast(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } + else + { + rep_ = &nullrep_; + } + } + + void quit() + { + if (rep_ != &nullrep_) + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast( rep_ ) ); + } + } + + Rep * rep_; + static Rep nullrep_; + +} ; + + +inline bool operator == (const TiXmlString & a, const TiXmlString & b) +{ + return ( a.length() == b.length() ) // optimization on some platforms + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare +} +inline bool operator < (const TiXmlString & a, const TiXmlString & b) +{ + return strcmp(a.c_str(), b.c_str()) < 0; +} + +inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } +inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } +inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } +inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } + +inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } +inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } +inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } +inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } + +TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); +TiXmlString operator + (const TiXmlString & a, const char* b); +TiXmlString operator + (const char* a, const TiXmlString & b); + + +/* + TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. + Only the operators that we need for TinyXML have been developped. +*/ +class TiXmlOutStream : public TiXmlString +{ +public : + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const TiXmlString & in) + { + *this += in; + return *this; + } + + // TiXmlOutStream << operator. + TiXmlOutStream & operator << (const char * in) + { + *this += in; + return *this; + } + +} ; + +#endif // TIXML_STRING_INCLUDED +#endif // TIXML_USE_STL diff --git a/external/tinyxml/tinyxml.cpp b/external/tinyxml/tinyxml.cpp new file mode 100644 index 0000000000..968f2409c3 --- /dev/null +++ b/external/tinyxml/tinyxml.cpp @@ -0,0 +1,1840 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#include + +#ifdef TIXML_USE_STL +#include +#include +#endif + +#include "tinyxml.h" + +FILE* TiXmlFOpen( const char* filename, const char* mode ); + +bool TiXmlBase::condenseWhiteSpace = true; + +// Microsoft compiler security +FILE* TiXmlFOpen( const char* filename, const char* mode ) +{ + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + FILE* fp = 0; + errno_t err = fopen_s( &fp, filename, mode ); + if ( !err && fp ) + return fp; + return 0; + #else + return fopen( filename, mode ); + #endif +} + +void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) +{ + int i=0; + + while( i<(int)str.length() ) + { + unsigned char c = (unsigned char) str[i]; + + if ( c == '&' + && i < ( (int)str.length() - 2 ) + && str[i+1] == '#' + && str[i+2] == 'x' ) + { + // Hexadecimal character reference. + // Pass through unchanged. + // © -- copyright symbol, for example. + // + // The -1 is a bug fix from Rob Laveaux. It keeps + // an overflow from happening if there is no ';'. + // There are actually 2 ways to exit this loop - + // while fails (error case) and break (semicolon found). + // However, there is no mechanism (currently) for + // this function to return an error. + while ( i<(int)str.length()-1 ) + { + outString->append( str.c_str() + i, 1 ); + ++i; + if ( str[i] == ';' ) + break; + } + } + else if ( c == '&' ) + { + outString->append( entity[0].str, entity[0].strLength ); + ++i; + } + else if ( c == '<' ) + { + outString->append( entity[1].str, entity[1].strLength ); + ++i; + } + else if ( c == '>' ) + { + outString->append( entity[2].str, entity[2].strLength ); + ++i; + } + else if ( c == '\"' ) + { + outString->append( entity[3].str, entity[3].strLength ); + ++i; + } + else if ( c == '\'' ) + { + outString->append( entity[4].str, entity[4].strLength ); + ++i; + } + else if ( c < 32 ) + { + // Easy pass at non-alpha/numeric/symbol + // Below 32 is symbolic. + char buf[ 32 ]; + + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); + #else + sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); + #endif + + //*ME: warning C4267: convert 'size_t' to 'int' + //*ME: Int-Cast to make compiler happy ... + outString->append( buf, (int)strlen( buf ) ); + ++i; + } + else + { + //char realc = (char) c; + //outString->append( &realc, 1 ); + *outString += (char) c; // somewhat more efficient function call. + ++i; + } + } +} + + +TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() +{ + parent = 0; + type = _type; + firstChild = 0; + lastChild = 0; + prev = 0; + next = 0; +} + + +TiXmlNode::~TiXmlNode() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } +} + + +void TiXmlNode::CopyTo( TiXmlNode* target ) const +{ + target->SetValue (value.c_str() ); + target->userData = userData; + target->location = location; +} + + +void TiXmlNode::Clear() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } + + firstChild = 0; + lastChild = 0; +} + + +TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) +{ + assert( node->parent == 0 || node->parent == this ); + assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); + + if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + delete node; + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + node->parent = this; + + node->prev = lastChild; + node->next = 0; + + if ( lastChild ) + lastChild->next = node; + else + firstChild = node; // it was an empty list. + + lastChild = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) +{ + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + + return LinkEndChild( node ); +} + + +TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) +{ + if ( !beforeThis || beforeThis->parent != this ) { + return 0; + } + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + node->parent = this; + + node->next = beforeThis; + node->prev = beforeThis->prev; + if ( beforeThis->prev ) + { + beforeThis->prev->next = node; + } + else + { + assert( firstChild == beforeThis ); + firstChild = node; + } + beforeThis->prev = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) +{ + if ( !afterThis || afterThis->parent != this ) { + return 0; + } + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = addThis.Clone(); + if ( !node ) + return 0; + node->parent = this; + + node->prev = afterThis; + node->next = afterThis->next; + if ( afterThis->next ) + { + afterThis->next->prev = node; + } + else + { + assert( lastChild == afterThis ); + lastChild = node; + } + afterThis->next = node; + return node; +} + + +TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) +{ + if ( !replaceThis ) + return 0; + + if ( replaceThis->parent != this ) + return 0; + + if ( withThis.ToDocument() ) { + // A document can never be a child. Thanks to Noam. + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + TiXmlNode* node = withThis.Clone(); + if ( !node ) + return 0; + + node->next = replaceThis->next; + node->prev = replaceThis->prev; + + if ( replaceThis->next ) + replaceThis->next->prev = node; + else + lastChild = node; + + if ( replaceThis->prev ) + replaceThis->prev->next = node; + else + firstChild = node; + + delete replaceThis; + node->parent = this; + return node; +} + + +bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) +{ + if ( !removeThis ) { + return false; + } + + if ( removeThis->parent != this ) + { + assert( 0 ); + return false; + } + + if ( removeThis->next ) + removeThis->next->prev = removeThis->prev; + else + lastChild = removeThis->prev; + + if ( removeThis->prev ) + removeThis->prev->next = removeThis->next; + else + firstChild = removeThis->next; + + delete removeThis; + return true; +} + +const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = firstChild; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = lastChild; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return FirstChild(); + } + else + { + assert( previous->parent == this ); + return previous->NextSibling(); + } +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return FirstChild( val ); + } + else + { + assert( previous->parent == this ); + return previous->NextSibling( val ); + } +} + + +const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = next; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const +{ + const TiXmlNode* node; + for ( node = prev; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } + return 0; +} + + +void TiXmlElement::RemoveAttribute( const char * name ) +{ + #ifdef TIXML_USE_STL + TIXML_STRING str( name ); + TiXmlAttribute* node = attributeSet.Find( str ); + #else + TiXmlAttribute* node = attributeSet.Find( name ); + #endif + if ( node ) + { + attributeSet.Remove( node ); + delete node; + } +} + +const TiXmlElement* TiXmlNode::FirstChildElement() const +{ + const TiXmlNode* node; + + for ( node = FirstChild(); + node; + node = node->NextSibling() ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const +{ + const TiXmlNode* node; + + for ( node = FirstChild( _value ); + node; + node = node->NextSibling( _value ) ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlElement* TiXmlNode::NextSiblingElement() const +{ + const TiXmlNode* node; + + for ( node = NextSibling(); + node; + node = node->NextSibling() ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const +{ + const TiXmlNode* node; + + for ( node = NextSibling( _value ); + node; + node = node->NextSibling( _value ) ) + { + if ( node->ToElement() ) + return node->ToElement(); + } + return 0; +} + + +const TiXmlDocument* TiXmlNode::GetDocument() const +{ + const TiXmlNode* node; + + for( node = this; node; node = node->parent ) + { + if ( node->ToDocument() ) + return node->ToDocument(); + } + return 0; +} + + +TiXmlElement::TiXmlElement (const char * _value) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + value = _value; +} + + +#ifdef TIXML_USE_STL +TiXmlElement::TiXmlElement( const std::string& _value ) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + value = _value; +} +#endif + + +TiXmlElement::TiXmlElement( const TiXmlElement& copy) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + copy.CopyTo( this ); +} + + +void TiXmlElement::operator=( const TiXmlElement& base ) +{ + ClearThis(); + base.CopyTo( this ); +} + + +TiXmlElement::~TiXmlElement() +{ + ClearThis(); +} + + +void TiXmlElement::ClearThis() +{ + Clear(); + while( attributeSet.First() ) + { + TiXmlAttribute* node = attributeSet.First(); + attributeSet.Remove( node ); + delete node; + } +} + + +const char* TiXmlElement::Attribute( const char* name ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( node ) + return node->Value(); + return 0; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( attrib ) + return &attrib->ValueStr(); + return 0; +} +#endif + + +const char* TiXmlElement::Attribute( const char* name, int* i ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const char* result = 0; + + if ( attrib ) { + result = attrib->Value(); + if ( i ) { + attrib->QueryIntValue( i ); + } + } + return result; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const std::string* result = 0; + + if ( attrib ) { + result = &attrib->ValueStr(); + if ( i ) { + attrib->QueryIntValue( i ); + } + } + return result; +} +#endif + + +const char* TiXmlElement::Attribute( const char* name, double* d ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const char* result = 0; + + if ( attrib ) { + result = attrib->Value(); + if ( d ) { + attrib->QueryDoubleValue( d ); + } + } + return result; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const std::string* result = 0; + + if ( attrib ) { + result = &attrib->ValueStr(); + if ( d ) { + attrib->QueryDoubleValue( d ); + } + } + return result; +} +#endif + + +int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryIntValue( ival ); +} + + +#ifdef TIXML_USE_STL +int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryIntValue( ival ); +} +#endif + + +int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryDoubleValue( dval ); +} + + +#ifdef TIXML_USE_STL +int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + if ( !attrib ) + return TIXML_NO_ATTRIBUTE; + return attrib->QueryDoubleValue( dval ); +} +#endif + + +void TiXmlElement::SetAttribute( const char * name, int val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetIntValue( val ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetAttribute( const std::string& name, int val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetIntValue( val ); + } +} +#endif + + +void TiXmlElement::SetDoubleAttribute( const char * name, double val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetDoubleValue( val ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + if ( attrib ) { + attrib->SetDoubleValue( val ); + } +} +#endif + + +void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); + if ( attrib ) { + attrib->SetValue( cvalue ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); + if ( attrib ) { + attrib->SetValue( _value ); + } +} +#endif + + +void TiXmlElement::Print( FILE* cfile, int depth ) const +{ + int i; + assert( cfile ); + for ( i=0; iNext() ) + { + fprintf( cfile, " " ); + attrib->Print( cfile, depth ); + } + + // There are 3 different formatting approaches: + // 1) An element without children is printed as a node + // 2) An element with only a text child is printed as text + // 3) An element with children is printed on multiple lines. + TiXmlNode* node; + if ( !firstChild ) + { + fprintf( cfile, " />" ); + } + else if ( firstChild == lastChild && firstChild->ToText() ) + { + fprintf( cfile, ">" ); + firstChild->Print( cfile, depth + 1 ); + fprintf( cfile, "", value.c_str() ); + } + else + { + fprintf( cfile, ">" ); + + for ( node = firstChild; node; node=node->NextSibling() ) + { + if ( !node->ToText() ) + { + fprintf( cfile, "\n" ); + } + node->Print( cfile, depth+1 ); + } + fprintf( cfile, "\n" ); + for( i=0; i", value.c_str() ); + } +} + + +void TiXmlElement::CopyTo( TiXmlElement* target ) const +{ + // superclass: + TiXmlNode::CopyTo( target ); + + // Element class: + // Clone the attributes, then clone the children. + const TiXmlAttribute* attribute = 0; + for( attribute = attributeSet.First(); + attribute; + attribute = attribute->Next() ) + { + target->SetAttribute( attribute->Name(), attribute->Value() ); + } + + TiXmlNode* node = 0; + for ( node = firstChild; node; node = node->NextSibling() ) + { + target->LinkEndChild( node->Clone() ); + } +} + +bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this, attributeSet.First() ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + if ( !node->Accept( visitor ) ) + break; + } + } + return visitor->VisitExit( *this ); +} + + +TiXmlNode* TiXmlElement::Clone() const +{ + TiXmlElement* clone = new TiXmlElement( Value() ); + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +const char* TiXmlElement::GetText() const +{ + const TiXmlNode* child = this->FirstChild(); + if ( child ) { + const TiXmlText* childText = child->ToText(); + if ( childText ) { + return childText->Value(); + } + } + return 0; +} + + +TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = false; + ClearError(); +} + +TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = false; + value = documentName; + ClearError(); +} + + +#ifdef TIXML_USE_STL +TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = false; + value = documentName; + ClearError(); +} +#endif + + +TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + copy.CopyTo( this ); +} + + +void TiXmlDocument::operator=( const TiXmlDocument& copy ) +{ + Clear(); + copy.CopyTo( this ); +} + + +bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) +{ + return LoadFile( Value(), encoding ); +} + + +bool TiXmlDocument::SaveFile() const +{ + return SaveFile( Value() ); +} + +bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) +{ + TIXML_STRING filename( _filename ); + value = filename; + + // reading in binary mode so that tinyxml can normalize the EOL + FILE* file = TiXmlFOpen( value.c_str (), "rb" ); + + if ( file ) + { + bool result = LoadFile( file, encoding ); + fclose( file ); + return result; + } + else + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } +} + +bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) +{ + if ( !file ) + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Delete the existing data: + Clear(); + location.Clear(); + + // Get the file size, so we can pre-allocate the string. HUGE speed impact. + long length = 0; + fseek( file, 0, SEEK_END ); + length = ftell( file ); + fseek( file, 0, SEEK_SET ); + + // Strange case, but good to handle up front. + if ( length <= 0 ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Subtle bug here. TinyXml did use fgets. But from the XML spec: + // 2.11 End-of-Line Handling + // + // + // ...the XML processor MUST behave as if it normalized all line breaks in external + // parsed entities (including the document entity) on input, before parsing, by translating + // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to + // a single #xA character. + // + // + // It is not clear fgets does that, and certainly isn't clear it works cross platform. + // Generally, you expect fgets to translate from the convention of the OS to the c/unix + // convention, and not work generally. + + /* + while( fgets( buf, sizeof(buf), file ) ) + { + data += buf; + } + */ + + char* buf = new char[ length+1 ]; + buf[0] = 0; + + if ( fread( buf, length, 1, file ) != 1 ) { + delete [] buf; + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Process the buffer in place to normalize new lines. (See comment above.) + // Copies from the 'p' to 'q' pointer, where p can advance faster if + // a newline-carriage return is hit. + // + // Wikipedia: + // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or + // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... + // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others + // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS + // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 + + const char* p = buf; // the read head + char* q = buf; // the write head + const char CR = 0x0d; + const char LF = 0x0a; + + buf[length] = 0; + while( *p ) { + assert( p < (buf+length) ); + assert( q <= (buf+length) ); + assert( q <= p ); + + if ( *p == CR ) { + *q++ = LF; + p++; + if ( *p == LF ) { // check for CR+LF (and skip LF) + p++; + } + } + else { + *q++ = *p++; + } + } + assert( q <= (buf+length) ); + *q = 0; + + Parse( buf, 0, encoding ); + + delete [] buf; + return !Error(); +} + + +bool TiXmlDocument::SaveFile( const char * filename ) const +{ + // The old c stuff lives on... + FILE* fp = TiXmlFOpen( filename, "w" ); + if ( fp ) + { + bool result = SaveFile( fp ); + fclose( fp ); + return result; + } + return false; +} + + +bool TiXmlDocument::SaveFile( FILE* fp ) const +{ + if ( useMicrosoftBOM ) + { + const unsigned char TIXML_UTF_LEAD_0 = 0xefU; + const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; + const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + + fputc( TIXML_UTF_LEAD_0, fp ); + fputc( TIXML_UTF_LEAD_1, fp ); + fputc( TIXML_UTF_LEAD_2, fp ); + } + Print( fp, 0 ); + return (ferror(fp) == 0); +} + + +void TiXmlDocument::CopyTo( TiXmlDocument* target ) const +{ + TiXmlNode::CopyTo( target ); + + target->error = error; + target->errorId = errorId; + target->errorDesc = errorDesc; + target->tabsize = tabsize; + target->errorLocation = errorLocation; + target->useMicrosoftBOM = useMicrosoftBOM; + + TiXmlNode* node = 0; + for ( node = firstChild; node; node = node->NextSibling() ) + { + target->LinkEndChild( node->Clone() ); + } +} + + +TiXmlNode* TiXmlDocument::Clone() const +{ + TiXmlDocument* clone = new TiXmlDocument(); + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +void TiXmlDocument::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + node->Print( cfile, depth ); + fprintf( cfile, "\n" ); + } +} + + +bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + if ( !node->Accept( visitor ) ) + break; + } + } + return visitor->VisitExit( *this ); +} + + +const TiXmlAttribute* TiXmlAttribute::Next() const +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( next->value.empty() && next->name.empty() ) + return 0; + return next; +} + +/* +TiXmlAttribute* TiXmlAttribute::Next() +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( next->value.empty() && next->name.empty() ) + return 0; + return next; +} +*/ + +const TiXmlAttribute* TiXmlAttribute::Previous() const +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( prev->value.empty() && prev->name.empty() ) + return 0; + return prev; +} + +/* +TiXmlAttribute* TiXmlAttribute::Previous() +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( prev->value.empty() && prev->name.empty() ) + return 0; + return prev; +} +*/ + +void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + TIXML_STRING n, v; + + EncodeString( name, &n ); + EncodeString( value, &v ); + + if (value.find ('\"') == TIXML_STRING::npos) { + if ( cfile ) { + fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); + } + if ( str ) { + (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; + } + } + else { + if ( cfile ) { + fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); + } + if ( str ) { + (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; + } + } +} + + +int TiXmlAttribute::QueryIntValue( int* ival ) const +{ + if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; +} + +int TiXmlAttribute::QueryDoubleValue( double* dval ) const +{ + if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; +} + +void TiXmlAttribute::SetIntValue( int _value ) +{ + char buf [64]; + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); + #else + sprintf (buf, "%d", _value); + #endif + SetValue (buf); +} + +void TiXmlAttribute::SetDoubleValue( double _value ) +{ + char buf [256]; + #if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); + #else + sprintf (buf, "%g", _value); + #endif + SetValue (buf); +} + +int TiXmlAttribute::IntValue() const +{ + return atoi (value.c_str ()); +} + +double TiXmlAttribute::DoubleValue() const +{ + return atof (value.c_str ()); +} + + +TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) +{ + copy.CopyTo( this ); +} + + +void TiXmlComment::operator=( const TiXmlComment& base ) +{ + Clear(); + base.CopyTo( this ); +} + + +void TiXmlComment::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + for ( int i=0; i", value.c_str() ); +} + + +void TiXmlComment::CopyTo( TiXmlComment* target ) const +{ + TiXmlNode::CopyTo( target ); +} + + +bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlComment::Clone() const +{ + TiXmlComment* clone = new TiXmlComment(); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +void TiXmlText::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + if ( cdata ) + { + int i; + fprintf( cfile, "\n" ); + for ( i=0; i\n", value.c_str() ); // unformatted output + } + else + { + TIXML_STRING buffer; + EncodeString( value, &buffer ); + fprintf( cfile, "%s", buffer.c_str() ); + } +} + + +void TiXmlText::CopyTo( TiXmlText* target ) const +{ + TiXmlNode::CopyTo( target ); + target->cdata = cdata; +} + + +bool TiXmlText::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlText::Clone() const +{ + TiXmlText* clone = 0; + clone = new TiXmlText( "" ); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +TiXmlDeclaration::TiXmlDeclaration( const char * _version, + const char * _encoding, + const char * _standalone ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + version = _version; + encoding = _encoding; + standalone = _standalone; +} + + +#ifdef TIXML_USE_STL +TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + version = _version; + encoding = _encoding; + standalone = _standalone; +} +#endif + + +TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + copy.CopyTo( this ); +} + + +void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) +{ + Clear(); + copy.CopyTo( this ); +} + + +void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + if ( cfile ) fprintf( cfile, "" ); + if ( str ) (*str) += "?>"; +} + + +void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const +{ + TiXmlNode::CopyTo( target ); + + target->version = version; + target->encoding = encoding; + target->standalone = standalone; +} + + +bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlDeclaration::Clone() const +{ + TiXmlDeclaration* clone = new TiXmlDeclaration(); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +void TiXmlUnknown::Print( FILE* cfile, int depth ) const +{ + for ( int i=0; i", value.c_str() ); +} + + +void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const +{ + TiXmlNode::CopyTo( target ); +} + + +bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlUnknown::Clone() const +{ + TiXmlUnknown* clone = new TiXmlUnknown(); + + if ( !clone ) + return 0; + + CopyTo( clone ); + return clone; +} + + +TiXmlAttributeSet::TiXmlAttributeSet() +{ + sentinel.next = &sentinel; + sentinel.prev = &sentinel; +} + + +TiXmlAttributeSet::~TiXmlAttributeSet() +{ + assert( sentinel.next == &sentinel ); + assert( sentinel.prev == &sentinel ); +} + + +void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) +{ + #ifdef TIXML_USE_STL + assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. + #else + assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. + #endif + + addMe->next = &sentinel; + addMe->prev = sentinel.prev; + + sentinel.prev->next = addMe; + sentinel.prev = addMe; +} + +void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) +{ + TiXmlAttribute* node; + + for( node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node == removeMe ) + { + node->prev->next = node->next; + node->next->prev = node->prev; + node->next = 0; + node->prev = 0; + return; + } + } + assert( 0 ); // we tried to remove a non-linked attribute. +} + + +#ifdef TIXML_USE_STL +TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const +{ + for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node->name == name ) + return node; + } + return 0; +} + +TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) +{ + TiXmlAttribute* attrib = Find( _name ); + if ( !attrib ) { + attrib = new TiXmlAttribute(); + Add( attrib ); + attrib->SetName( _name ); + } + return attrib; +} +#endif + + +TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const +{ + for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( strcmp( node->name.c_str(), name ) == 0 ) + return node; + } + return 0; +} + + +TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) +{ + TiXmlAttribute* attrib = Find( _name ); + if ( !attrib ) { + attrib = new TiXmlAttribute(); + Add( attrib ); + attrib->SetName( _name ); + } + return attrib; +} + + +#ifdef TIXML_USE_STL +std::istream& operator>> (std::istream & in, TiXmlNode & base) +{ + TIXML_STRING tag; + tag.reserve( 8 * 1000 ); + base.StreamIn( &in, &tag ); + + base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); + return in; +} +#endif + + +#ifdef TIXML_USE_STL +std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) +{ + TiXmlPrinter printer; + printer.SetStreamPrinting(); + base.Accept( &printer ); + out << printer.Str(); + + return out; +} + + +std::string& operator<< (std::string& out, const TiXmlNode& base ) +{ + TiXmlPrinter printer; + printer.SetStreamPrinting(); + base.Accept( &printer ); + out.append( printer.Str() ); + + return out; +} +#endif + + +TiXmlHandle TiXmlHandle::FirstChild() const +{ + if ( node ) + { + TiXmlNode* child = node->FirstChild(); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const +{ + if ( node ) + { + TiXmlNode* child = node->FirstChild( value ); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChildElement() const +{ + if ( node ) + { + TiXmlElement* child = node->FirstChildElement(); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const +{ + if ( node ) + { + TiXmlElement* child = node->FirstChildElement( value ); + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::Child( int count ) const +{ + if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild(); + for ( i=0; + child && iNextSibling(), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const +{ + if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild( value ); + for ( i=0; + child && iNextSibling( value ), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::ChildElement( int count ) const +{ + if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement(); + for ( i=0; + child && iNextSiblingElement(), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const +{ + if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement( value ); + for ( i=0; + child && iNextSiblingElement( value ), ++i ) + { + // nothing + } + if ( child ) + return TiXmlHandle( child ); + } + return TiXmlHandle( 0 ); +} + + +bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) +{ + return true; +} + +bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) +{ + return true; +} + +bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) +{ + DoIndent(); + buffer += "<"; + buffer += element.Value(); + + for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) + { + buffer += " "; + attrib->Print( 0, 0, &buffer ); + } + + if ( !element.FirstChild() ) + { + buffer += " />"; + DoLineBreak(); + } + else + { + buffer += ">"; + if ( element.FirstChild()->ToText() + && element.LastChild() == element.FirstChild() + && element.FirstChild()->ToText()->CDATA() == false ) + { + simpleTextPrint = true; + // no DoLineBreak()! + } + else + { + DoLineBreak(); + } + } + ++depth; + return true; +} + + +bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) +{ + --depth; + if ( !element.FirstChild() ) + { + // nothing. + } + else + { + if ( simpleTextPrint ) + { + simpleTextPrint = false; + } + else + { + DoIndent(); + } + buffer += ""; + DoLineBreak(); + } + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlText& text ) +{ + if ( text.CDATA() ) + { + DoIndent(); + buffer += ""; + DoLineBreak(); + } + else if ( simpleTextPrint ) + { + TIXML_STRING str; + TiXmlBase::EncodeString( text.ValueTStr(), &str ); + buffer += str; + } + else + { + DoIndent(); + TIXML_STRING str; + TiXmlBase::EncodeString( text.ValueTStr(), &str ); + buffer += str; + DoLineBreak(); + } + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) +{ + DoIndent(); + declaration.Print( 0, 0, &buffer ); + DoLineBreak(); + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlComment& comment ) +{ + DoIndent(); + buffer += ""; + DoLineBreak(); + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) +{ + DoIndent(); + buffer += "<"; + buffer += unknown.Value(); + buffer += ">"; + DoLineBreak(); + return true; +} + diff --git a/external/tinyxml/tinyxml.h b/external/tinyxml/tinyxml.h new file mode 100644 index 0000000000..01822911c7 --- /dev/null +++ b/external/tinyxml/tinyxml.h @@ -0,0 +1,1799 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TINYXML_INCLUDED +#define TINYXML_INCLUDED + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4530 ) +#pragma warning( disable : 4786 ) +#endif + +#include +#include +#include +#include +#include + +// Help out windows: +#if defined( _DEBUG ) && !defined( DEBUG ) +#define DEBUG +#endif + +#ifdef TIXML_USE_STL + #include + #include + #include + #define TIXML_STRING std::string +#else + #include "tinystr.h" + #define TIXML_STRING TiXmlString +#endif + +// Deprecated library function hell. Compilers want to use the +// new safe versions. This probably doesn't fully address the problem, +// but it gets closer. There are too many compilers for me to fully +// test. If you get compilation troubles, undefine TIXML_SAFE +#define TIXML_SAFE + +#ifdef TIXML_SAFE + #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + // Microsoft visual studio, version 2005 and higher. + #define TIXML_SNPRINTF _snprintf_s + #define TIXML_SSCANF sscanf_s + #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) + // Microsoft visual studio, version 6 and higher. + //#pragma message( "Using _sn* functions." ) + #define TIXML_SNPRINTF _snprintf + #define TIXML_SSCANF sscanf + #elif defined(__GNUC__) && (__GNUC__ >= 3 ) + // GCC version 3 and higher.s + //#warning( "Using sn* functions." ) + #define TIXML_SNPRINTF snprintf + #define TIXML_SSCANF sscanf + #else + #define TIXML_SNPRINTF snprintf + #define TIXML_SSCANF sscanf + #endif +#endif + +class TiXmlDocument; +class TiXmlElement; +class TiXmlComment; +class TiXmlUnknown; +class TiXmlAttribute; +class TiXmlText; +class TiXmlDeclaration; +class TiXmlParsingData; + +const int TIXML_MAJOR_VERSION = 2; +const int TIXML_MINOR_VERSION = 6; +const int TIXML_PATCH_VERSION = 1; + +/* Internal structure for tracking location of items + in the XML file. +*/ +struct TiXmlCursor +{ + TiXmlCursor() { Clear(); } + void Clear() { row = col = -1; } + + int row; // 0 based. + int col; // 0 based. +}; + + +/** + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simply called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its sibilings will be Visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + + You should never change the document from a callback. + + @sa TiXmlNode::Accept() +*/ +class TiXmlVisitor +{ +public: + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } + /// Visit an unknow node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } +}; + +// Only used by Attribute::Query functions +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE +}; + + +// Used by the parsing routines. +enum TiXmlEncoding +{ + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY +}; + +const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; + +/** TiXmlBase is a base class for every class in TinyXml. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. + + In XML, the document and elements can contain + other elements and other types of nodes. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + A Decleration contains: Attributes (not on tree) + @endverbatim +*/ +class TiXmlBase +{ + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; + +public: + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const { return location.row + 1; } + int Column() const { return location.col + 1; } ///< See Row() + + void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. + void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. + const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; + +protected: + + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + return IsWhiteSpace( (char) c ); + return false; // Again, only truly correct for English/Latin...but usually works. + } + + #ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); + static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); + #endif + + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + return GetEntity( p, _value, length, encoding ); + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; p[i] && i<*length; ++i ) { + _value[i] = p[i]; + } + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; + + /// Field containing a generic user pointer + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) return tolower( v ); + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + +private: + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; +}; + + +/** The parent class for everything in the Document Object Model. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. +*/ +class TiXmlNode : public TiXmlBase +{ + friend class TiXmlDocument; + friend class TiXmlElement; + +public: + #ifdef TIXML_USE_STL + + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. + + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + + #endif + + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + TINYXML_DOCUMENT, + TINYXML_ELEMENT, + TINYXML_COMMENT, + TINYXML_UNKNOWN, + TINYXML_TEXT, + TINYXML_DECLARATION, + TINYXML_TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char *Value() const { return value.c_str (); } + + #ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const { return value; } + #endif + + const TIXML_STRING& ValueTStr() const { return value; } + + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char * _value) { value = _value;} + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() { return parent; } + const TiXmlNode* Parent() const { return parent; } + + const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. + TiXmlNode* FirstChild() { return firstChild; } + const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char * _value ) { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. + TiXmlNode* LastChild() { return lastChild; } + + const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char * _value ) { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. + #endif + + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. + #endif + + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + + + /** Add a new node related to this. Adds a child past the LastChild. + + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. + + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const { return prev; } + TiXmlNode* PreviousSibling() { return prev; } + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char * ) const; + TiXmlNode* PreviousSibling( const char *_prev ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. + const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. + TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const { return next; } + TiXmlNode* NextSibling() { return next; } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char * ) const; + TiXmlNode* NextSibling( const char* _next ) { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char * ) const; + TiXmlElement* NextSiblingElement( const char *_next ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char * _value ) const; + TiXmlElement* FirstChildElement( const char * _value ) { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + + #ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. + #endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: DOCUMENT, ELEMENT, COMMENT, + UNKNOWN, TEXT, and DECLARATION. + */ + int Type() const { return type; } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const { return !firstChild; } + + virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + +protected: + TiXmlNode( NodeType _type ); + + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; + + #ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; + #endif + + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + + TiXmlNode* parent; + NodeType type; + + TiXmlNode* firstChild; + TiXmlNode* lastChild; + + TIXML_STRING value; + + TiXmlNode* prev; + TiXmlNode* next; + +private: + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. +*/ +class TiXmlAttribute : public TiXmlBase +{ + friend class TiXmlAttributeSet; + +public: + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + #endif + + /// Construct an attribute with a name and value. + TiXmlAttribute( const char * _name, const char * _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. + const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. + #ifdef TIXML_USE_STL + const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. + #endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. + + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const { return name; } + + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. + + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; + + void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. + void SetValue( const char* _value ) { value = _value; } ///< Set the value. + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + + #ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) { name = _name; } + /// STL std::string form. + void SetValue( const std::string& _value ) { value = _value; } + #endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } + bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } + bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) { document = doc; } + +private: + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; +}; + + +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. + + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. +*/ +class TiXmlAttributeSet +{ +public: + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); + + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); + + const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } + const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } + + TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* FindOrCreate( const char* _name ); + +# ifdef TIXML_USE_STL + TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* FindOrCreate( const std::string& _name ); +# endif + + +private: + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + + TiXmlAttribute sentinel; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TiXmlElement : public TiXmlNode +{ +public: + /// Construct an element. + TiXmlElement (const char * in_value); + + #ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); + #endif + + TiXmlElement( const TiXmlElement& ); + + void operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const { + double d; + int result = QueryDoubleAttribute( name, &d ); + if ( result == TIXML_SUCCESS ) { + *_value = (float)d; + } + return result; + } + + #ifdef TIXML_USE_STL + /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). + int QueryStringAttribute( const char* name, std::string* _value ) const { + const char* cstr = Attribute( name ); + if ( cstr ) { + *_value = std::string( cstr ); + return TIXML_SUCCESS; + } + return TIXML_NO_ATTRIBUTE; + } + + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types that contain spaces. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + if ( !sstream.fail() ) + return TIXML_SUCCESS; + return TIXML_WRONG_TYPE; + } + + int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + if ( !node ) + return TIXML_NO_ATTRIBUTE; + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char * _value ); + + #ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + ///< STL std::string form. + void SetDoubleAttribute( const std::string& name, double value ); + #endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char * name, int value ); + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char * name, double value ); + + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char * name ); + #ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. + #endif + + const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. + TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } + const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. + TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". + + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + safe type casts on the referenced node. + */ + const char* GetText() const; + + /// Creates a new Element and returns it - the returned element is a copy. + virtual TiXmlNode* Clone() const; + // Print the Element to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: next char past '<' + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + + void CopyTo( TiXmlElement* target ) const; + void ClearThis(); // like clear, but initializes 'this' object as well + + // Used to be public [internal use] + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + /* [internal use] + Reads the "value" of the element -- another element, or text. + This should terminate with the current end tag. + */ + const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + +private: + TiXmlAttributeSet attributeSet; +}; + + +/** An XML comment. +*/ +class TiXmlComment : public TiXmlNode +{ +public: + /// Constructs an empty comment. + TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} + /// Construct a comment from text. + TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { + SetValue( _value ); + } + TiXmlComment( const TiXmlComment& ); + void operator=( const TiXmlComment& base ); + + virtual ~TiXmlComment() {} + + /// Returns a copy of this Comment. + virtual TiXmlNode* Clone() const; + // Write this Comment to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: at the ! of the !-- + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + void CopyTo( TiXmlComment* target ) const; + + // used to be public + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif +// virtual void StreamOut( TIXML_OSTREAM * out ) const; + +private: + +}; + + +/** XML text. A text node can have 2 ways to output the next. "normal" output + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCDATA() and query it with CDATA(). +*/ +class TiXmlText : public TiXmlNode +{ + friend class TiXmlElement; +public: + /** Constructor for text element. By default, it is treated as + normal, encoded text. If you want it be output as a CDATA text + element, set the parameter _cdata to 'true' + */ + TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + virtual ~TiXmlText() {} + + #ifdef TIXML_USE_STL + /// Constructor. + TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + #endif + + TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } + void operator=( const TiXmlText& base ) { base.CopyTo( this ); } + + // Write this text object to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /// Queries whether this represents text using a CDATA section. + bool CDATA() const { return cdata; } + /// Turns on or off a CDATA representation of text. + void SetCDATA( bool _cdata ) { cdata = _cdata; } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected : + /// [internal use] Creates a new Element and returns it. + virtual TiXmlNode* Clone() const; + void CopyTo( TiXmlText* target ) const; + + bool Blank() const; // returns true if all white space and new lines + // [internal use] + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + bool cdata; // true if this should be input and output as a CDATA style text element +}; + + +/** In correct XML the declaration is the first entry in the file. + @verbatim + + @endverbatim + + TinyXml will happily read or write files without a declaration, + however. There are 3 possible attributes to the declaration: + version, encoding, and standalone. + + Note: In this version of the code, the attributes are + handled as special cases, not generic attributes, simply + because there can only be at most 3 and they are always the same. +*/ +class TiXmlDeclaration : public TiXmlNode +{ +public: + /// Construct an empty declaration. + TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} + +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ); +#endif + + /// Construct. + TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ); + + TiXmlDeclaration( const TiXmlDeclaration& copy ); + void operator=( const TiXmlDeclaration& copy ); + + virtual ~TiXmlDeclaration() {} + + /// Version. Will return an empty string if none was found. + const char *Version() const { return version.c_str (); } + /// Encoding. Will return an empty string if none was found. + const char *Encoding() const { return encoding.c_str (); } + /// Is this a standalone document? + const char *Standalone() const { return standalone.c_str (); } + + /// Creates a copy of this Declaration and returns it. + virtual TiXmlNode* Clone() const; + // Print this declaration to a FILE stream. + virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + virtual void Print( FILE* cfile, int depth ) const { + Print( cfile, depth, 0 ); + } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + void CopyTo( TiXmlDeclaration* target ) const; + // used to be public + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + + TIXML_STRING version; + TIXML_STRING encoding; + TIXML_STRING standalone; +}; + + +/** Any tag that tinyXml doesn't recognize is saved as an + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. + + DTD tags get thrown into TiXmlUnknowns. +*/ +class TiXmlUnknown : public TiXmlNode +{ +public: + TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} + virtual ~TiXmlUnknown() {} + + TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } + void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); } + + /// Creates a copy of this Unknown and returns it. + virtual TiXmlNode* Clone() const; + // Print this Unknown to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected: + void CopyTo( TiXmlUnknown* target ) const; + + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + +}; + + +/** Always the top level node. A document binds together all the + XML pieces. It can be saved, loaded, and printed to the screen. + The 'value' of a document node is the xml file name. +*/ +class TiXmlDocument : public TiXmlNode +{ +public: + /// Create an empty document, that has no name. + TiXmlDocument(); + /// Create a document with a name. The name of the document is also the filename of the xml. + TiXmlDocument( const char * documentName ); + + #ifdef TIXML_USE_STL + /// Constructor. + TiXmlDocument( const std::string& documentName ); + #endif + + TiXmlDocument( const TiXmlDocument& copy ); + void operator=( const TiXmlDocument& copy ); + + virtual ~TiXmlDocument() {} + + /** Load a file using the current document value. + Returns true if successful. Will delete any existing + document data before loading. + */ + bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the current document value. Returns true if successful. + bool SaveFile() const; + /// Load a file using the given filename. Returns true if successful. + bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given filename. Returns true if successful. + bool SaveFile( const char * filename ) const; + /** Load a file using the given FILE*. Returns true if successful. Note that this method + doesn't stream - the entire object pointed at by the FILE* + will be interpreted as an XML file. TinyXML doesn't stream in XML from the current + file location. Streaming may be added in the future. + */ + bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given FILE*. Returns true if successful. + bool SaveFile( FILE* ) const; + + #ifdef TIXML_USE_STL + bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. + { + return LoadFile( filename.c_str(), encoding ); + } + bool SaveFile( const std::string& filename ) const ///< STL std::string version. + { + return SaveFile( filename.c_str() ); + } + #endif + + /** Parse the given null terminated block of xml data. Passing in an encoding to this + method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml + to use that encoding, regardless of what TinyXml might otherwise try to detect. + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + + /** Get the root element -- the only top level element -- of the document. + In well formed XML, there should only be one. TinyXml is tolerant of + multiple elements at the document level. + */ + const TiXmlElement* RootElement() const { return FirstChildElement(); } + TiXmlElement* RootElement() { return FirstChildElement(); } + + /** If an error occurs, Error will be set to true. Also, + - The ErrorId() will contain the integer identifier of the error (not generally useful) + - The ErrorDesc() method will return the name of the error. (very useful) + - The ErrorRow() and ErrorCol() will return the location of the error (if known) + */ + bool Error() const { return error; } + + /// Contains a textual (english) description of the error if one occurs. + const char * ErrorDesc() const { return errorDesc.c_str (); } + + /** Generally, you probably want the error string ( ErrorDesc() ). But if you + prefer the ErrorId, this function will fetch it. + */ + int ErrorId() const { return errorId; } + + /** Returns the location (if known) of the error. The first column is column 1, + and the first row is row 1. A value of 0 means the row and column wasn't applicable + (memory errors, for example, have no row/column) or the parser lost the error. (An + error in the error reporting, in that case.) + + @sa SetTabSize, Row, Column + */ + int ErrorRow() const { return errorLocation.row+1; } + int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() + + /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) + to report the correct values for row and column. It does not change the output + or input in any way. + + By calling this method, with a tab size + greater than 0, the row and column of each node and attribute is stored + when the file is loaded. Very useful for tracking the DOM back in to + the source file. + + The tab size is required for calculating the location of nodes. If not + set, the default of 4 is used. The tabsize is set per document. Setting + the tabsize to 0 disables row/column tracking. + + Note that row and column tracking is not supported when using operator>>. + + The tab size needs to be enabled before the parse or load. Correct usage: + @verbatim + TiXmlDocument doc; + doc.SetTabSize( 8 ); + doc.Load( "myfile.xml" ); + @endverbatim + + @sa Row, Column + */ + void SetTabSize( int _tabsize ) { tabsize = _tabsize; } + + int TabSize() const { return tabsize; } + + /** If you have handled the error, it can be reset with this call. The error + state is automatically cleared if you Parse a new XML block. + */ + void ClearError() { error = false; + errorId = 0; + errorDesc = ""; + errorLocation.row = errorLocation.col = 0; + //errorLocation.last = 0; + } + + /** Write the document to standard out using formatted printing ("pretty print"). */ + void Print() const { Print( stdout, 0 ); } + + /* Write the document to a string using formatted printing ("pretty print"). This + will allocate a character array (new char[]) and return it as a pointer. The + calling code pust call delete[] on the return char* to avoid a memory leak. + */ + //char* PrintToMemory() const; + + /// Print this Document to a FILE stream. + virtual void Print( FILE* cfile, int depth = 0 ) const; + // [internal use] + void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + + virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected : + // [internal use] + virtual TiXmlNode* Clone() const; + #ifdef TIXML_USE_STL + virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); + #endif + +private: + void CopyTo( TiXmlDocument* target ) const; + + bool error; + int errorId; + TIXML_STRING errorDesc; + int tabsize; + TiXmlCursor errorLocation; + bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. +}; + + +/** + A TiXmlHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml + DOM structure. It is a separate utility class. + + Take an example: + @verbatim + + + + + + + @endverbatim + + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: + + @verbatim + TiXmlElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + TiXmlElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + TiXmlElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + TiXmlElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim + + And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity + of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + and correct to use: + + @verbatim + TiXmlHandle docHandle( &document ); + TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); + if ( child2 ) + { + // do something useful + @endverbatim + + Which is MUCH more concise and useful. + + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + TiXmlHandle handleCopy = handle; + @endverbatim + + What they should not be used for is iteration: + + @verbatim + int i=0; + while ( true ) + { + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); + if ( !child ) + break; + // do something + ++i; + } + @endverbatim + + It seems reasonable, but it is in fact two embedded while loops. The Child method is + a linear walk to find the element, so this code would iterate much more than it needs + to. Instead, prefer: + + @verbatim + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); + + for( child; child; child=child->NextSiblingElement() ) + { + // do something + } + @endverbatim +*/ +class TiXmlHandle +{ +public: + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } + /// Copy constructor + TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } + TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; } + + /// Return a handle to the first child node. + TiXmlHandle FirstChild() const; + /// Return a handle to the first child node with the given name. + TiXmlHandle FirstChild( const char * value ) const; + /// Return a handle to the first child element. + TiXmlHandle FirstChildElement() const; + /// Return a handle to the first child element with the given name. + TiXmlHandle FirstChildElement( const char * value ) const; + + /** Return a handle to the "index" child with the given name. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( const char* value, int index ) const; + /** Return a handle to the "index" child. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( int index ) const; + /** Return a handle to the "index" child element with the given name. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( const char* value, int index ) const; + /** Return a handle to the "index" child element. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( int index ) const; + + #ifdef TIXML_USE_STL + TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } + TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } + + TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } + TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } + #endif + + /** Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* ToNode() const { return node; } + /** Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } + /** Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } + /** Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } + + /** @deprecated use ToNode. + Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* Node() const { return ToNode(); } + /** @deprecated use ToElement. + Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* Element() const { return ToElement(); } + /** @deprecated use ToText() + Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* Text() const { return ToText(); } + /** @deprecated use ToUnknown() + Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* Unknown() const { return ToUnknown(); } + +private: + TiXmlNode* node; +}; + + +/** Print to memory functionality. The TiXmlPrinter is useful when you need to: + + -# Print to memory (especially in non-STL mode) + -# Control formatting (line endings, etc.) + + When constructed, the TiXmlPrinter is in its default "pretty printing" mode. + Before calling Accept() you can call methods to control the printing + of the XML document. After TiXmlNode::Accept() is called, the printed document can + be accessed via the CStr(), Str(), and Size() methods. + + TiXmlPrinter uses the Visitor API. + @verbatim + TiXmlPrinter printer; + printer.SetIndent( "\t" ); + + doc.Accept( &printer ); + fprintf( stdout, "%s", printer.CStr() ); + @endverbatim +*/ +class TiXmlPrinter : public TiXmlVisitor +{ +public: + TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), + buffer(), indent( " " ), lineBreak( "\n" ) {} + + virtual bool VisitEnter( const TiXmlDocument& doc ); + virtual bool VisitExit( const TiXmlDocument& doc ); + + virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); + virtual bool VisitExit( const TiXmlElement& element ); + + virtual bool Visit( const TiXmlDeclaration& declaration ); + virtual bool Visit( const TiXmlText& text ); + virtual bool Visit( const TiXmlComment& comment ); + virtual bool Visit( const TiXmlUnknown& unknown ); + + /** Set the indent characters for printing. By default 4 spaces + but tab (\t) is also useful, or null/empty string for no indentation. + */ + void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } + /// Query the indention string. + const char* Indent() { return indent.c_str(); } + /** Set the line breaking string. By default set to newline (\n). + Some operating systems prefer other characters, or can be + set to the null/empty string for no indenation. + */ + void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } + /// Query the current line breaking string. + const char* LineBreak() { return lineBreak.c_str(); } + + /** Switch over to "stream printing" which is the most dense formatting without + linebreaks. Common when the XML is needed for network transmission. + */ + void SetStreamPrinting() { indent = ""; + lineBreak = ""; + } + /// Return the result. + const char* CStr() { return buffer.c_str(); } + /// Return the length of the result string. + size_t Size() { return buffer.size(); } + + #ifdef TIXML_USE_STL + /// Return the result. + const std::string& Str() { return buffer; } + #endif + +private: + void DoIndent() { + for( int i=0; i +#include + +#include "tinyxml.h" + +//#define DEBUG_PARSER +#if defined( DEBUG_PARSER ) +# if defined( DEBUG ) && defined( _MSC_VER ) +# include +# define TIXML_LOG OutputDebugString +# else +# define TIXML_LOG printf +# endif +#endif + +// Note tha "PutString" hardcodes the same list. This +// is less flexible than it appears. Changing the entries +// or order will break putstring. +TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] = +{ + { "&", 5, '&' }, + { "<", 4, '<' }, + { ">", 4, '>' }, + { """, 6, '\"' }, + { "'", 6, '\'' } +}; + +// Bunch of unicode info at: +// http://www.unicode.org/faq/utf_bom.html +// Including the basic of this table, which determines the #bytes in the +// sequence from the lead byte. 1 placed for invalid sequences -- +// although the result will be junk, pass it through as much as possible. +// Beware of the non-characters in UTF-8: +// ef bb bf (Microsoft "lead bytes") +// ef bf be +// ef bf bf + +const unsigned char TIXML_UTF_LEAD_0 = 0xefU; +const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; +const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + +const int TiXmlBase::utf8ByteTable[256] = +{ + // 0 1 2 3 4 5 6 7 8 9 a b c d e f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte + 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid +}; + + +void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) +{ + const unsigned long BYTE_MASK = 0xBF; + const unsigned long BYTE_MARK = 0x80; + const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + + if (input < 0x80) + *length = 1; + else if ( input < 0x800 ) + *length = 2; + else if ( input < 0x10000 ) + *length = 3; + else if ( input < 0x200000 ) + *length = 4; + else + { *length = 0; return; } // This code won't covert this correctly anyway. + + output += *length; + + // Scary scary fall throughs. + switch (*length) + { + case 4: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 3: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 2: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 1: + --output; + *output = (char)(input | FIRST_BYTE_MARK[*length]); + } +} + + +/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) +{ + // This will only work for low-ascii, everything else is assumed to be a valid + // letter. I'm not sure this is the best approach, but it is quite tricky trying + // to figure out alhabetical vs. not across encoding. So take a very + // conservative approach. + +// if ( encoding == TIXML_ENCODING_UTF8 ) +// { + if ( anyByte < 127 ) + return isalpha( anyByte ); + else + return 1; // What else to do? The unicode set is huge...get the english ones right. +// } +// else +// { +// return isalpha( anyByte ); +// } +} + + +/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) +{ + // This will only work for low-ascii, everything else is assumed to be a valid + // letter. I'm not sure this is the best approach, but it is quite tricky trying + // to figure out alhabetical vs. not across encoding. So take a very + // conservative approach. + +// if ( encoding == TIXML_ENCODING_UTF8 ) +// { + if ( anyByte < 127 ) + return isalnum( anyByte ); + else + return 1; // What else to do? The unicode set is huge...get the english ones right. +// } +// else +// { +// return isalnum( anyByte ); +// } +} + + +class TiXmlParsingData +{ + friend class TiXmlDocument; + public: + void Stamp( const char* now, TiXmlEncoding encoding ); + + const TiXmlCursor& Cursor() { return cursor; } + + private: + // Only used by the document! + TiXmlParsingData( const char* start, int _tabsize, int row, int col ) + { + assert( start ); + stamp = start; + tabsize = _tabsize; + cursor.row = row; + cursor.col = col; + } + + TiXmlCursor cursor; + const char* stamp; + int tabsize; +}; + + +void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) +{ + assert( now ); + + // Do nothing if the tabsize is 0. + if ( tabsize < 1 ) + { + return; + } + + // Get the current row, column. + int row = cursor.row; + int col = cursor.col; + const char* p = stamp; + assert( p ); + + while ( p < now ) + { + // Treat p as unsigned, so we have a happy compiler. + const unsigned char* pU = (const unsigned char*)p; + + // Code contributed by Fletcher Dunn: (modified by lee) + switch (*pU) { + case 0: + // We *should* never get here, but in case we do, don't + // advance past the terminating null character, ever + return; + + case '\r': + // bump down to the next line + ++row; + col = 0; + // Eat the character + ++p; + + // Check for \r\n sequence, and treat this as a single character + if (*p == '\n') { + ++p; + } + break; + + case '\n': + // bump down to the next line + ++row; + col = 0; + + // Eat the character + ++p; + + // Check for \n\r sequence, and treat this as a single + // character. (Yes, this bizarre thing does occur still + // on some arcane platforms...) + if (*p == '\r') { + ++p; + } + break; + + case '\t': + // Eat the character + ++p; + + // Skip to next tab stop + col = (col / tabsize + 1) * tabsize; + break; + + case TIXML_UTF_LEAD_0: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( *(p+1) && *(p+2) ) + { + // In these cases, don't advance the column. These are + // 0-width spaces. + if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) + p += 3; + else + { p +=3; ++col; } // A normal character. + } + } + else + { + ++p; + ++col; + } + break; + + default: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // Eat the 1 to 4 byte utf8 character. + int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; + if ( step == 0 ) + step = 1; // Error case from bad encoding, but handle gracefully. + p += step; + + // Just advance one column, of course. + ++col; + } + else + { + ++p; + ++col; + } + break; + } + } + cursor.row = row; + cursor.col = col; + assert( cursor.row >= -1 ); + assert( cursor.col >= -1 ); + stamp = p; + assert( stamp ); +} + + +const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) +{ + if ( !p || !*p ) + { + return 0; + } + if ( encoding == TIXML_ENCODING_UTF8 ) + { + while ( *p ) + { + const unsigned char* pU = (const unsigned char*)p; + + // Skip the stupid Microsoft UTF-8 Byte order marks + if ( *(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==TIXML_UTF_LEAD_1 + && *(pU+2)==TIXML_UTF_LEAD_2 ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbeU ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbfU ) + { + p += 3; + continue; + } + + if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. + ++p; + else + break; + } + } + else + { + while ( *p && IsWhiteSpace( *p ) ) + ++p; + } + + return p; +} + +#ifdef TIXML_USE_STL +/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) +{ + for( ;; ) + { + if ( !in->good() ) return false; + + int c = in->peek(); + // At this scope, we can't get to a document. So fail silently. + if ( !IsWhiteSpace( c ) || c <= 0 ) + return true; + + *tag += (char) in->get(); + } +} + +/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) +{ + //assert( character > 0 && character < 128 ); // else it won't work in utf-8 + while ( in->good() ) + { + int c = in->peek(); + if ( c == character ) + return true; + if ( c <= 0 ) // Silent failure: can't get document at this scope + return false; + + in->get(); + *tag += (char) c; + } + return false; +} +#endif + +// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The +// "assign" optimization removes over 10% of the execution time. +// +const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) +{ + // Oddly, not supported on some comilers, + //name->clear(); + // So use this: + *name = ""; + assert( p ); + + // Names start with letters or underscores. + // Of course, in unicode, tinyxml has no idea what a letter *is*. The + // algorithm is generous. + // + // After that, they can be letters, underscores, numbers, + // hyphens, or colons. (Colons are valid ony for namespaces, + // but tinyxml can't tell namespaces from names.) + if ( p && *p + && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) + { + const char* start = p; + while( p && *p + && ( IsAlphaNum( (unsigned char ) *p, encoding ) + || *p == '_' + || *p == '-' + || *p == '.' + || *p == ':' ) ) + { + //(*name) += *p; // expensive + ++p; + } + if ( p-start > 0 ) { + name->assign( start, p-start ); + } + return p; + } + return 0; +} + +const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) +{ + // Presume an entity, and pull it out. + TIXML_STRING ent; + int i; + *length = 0; + + if ( *(p+1) && *(p+1) == '#' && *(p+2) ) + { + unsigned long ucs = 0; + ptrdiff_t delta = 0; + unsigned mult = 1; + + if ( *(p+2) == 'x' ) + { + // Hexadecimal. + if ( !*(p+3) ) return 0; + + const char* q = p+3; + q = strchr( q, ';' ); + + if ( !q || !*q ) return 0; + + delta = q-p; + --q; + + while ( *q != 'x' ) + { + if ( *q >= '0' && *q <= '9' ) + ucs += mult * (*q - '0'); + else if ( *q >= 'a' && *q <= 'f' ) + ucs += mult * (*q - 'a' + 10); + else if ( *q >= 'A' && *q <= 'F' ) + ucs += mult * (*q - 'A' + 10 ); + else + return 0; + mult *= 16; + --q; + } + } + else + { + // Decimal. + if ( !*(p+2) ) return 0; + + const char* q = p+2; + q = strchr( q, ';' ); + + if ( !q || !*q ) return 0; + + delta = q-p; + --q; + + while ( *q != '#' ) + { + if ( *q >= '0' && *q <= '9' ) + ucs += mult * (*q - '0'); + else + return 0; + mult *= 10; + --q; + } + } + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // convert the UCS to UTF-8 + ConvertUTF32ToUTF8( ucs, value, length ); + } + else + { + *value = (char)ucs; + *length = 1; + } + return p + delta + 1; + } + + // Now try to match it. + for( i=0; iappend( cArr, len ); + } + } + else + { + bool whitespace = false; + + // Remove leading white space: + p = SkipWhiteSpace( p, encoding ); + while ( p && *p + && !StringEqual( p, endTag, caseInsensitive, encoding ) ) + { + if ( *p == '\r' || *p == '\n' ) + { + whitespace = true; + ++p; + } + else if ( IsWhiteSpace( *p ) ) + { + whitespace = true; + ++p; + } + else + { + // If we've found whitespace, add it before the + // new character. Any whitespace just becomes a space. + if ( whitespace ) + { + (*text) += ' '; + whitespace = false; + } + int len; + char cArr[4] = { 0, 0, 0, 0 }; + p = GetChar( p, cArr, &len, encoding ); + if ( len == 1 ) + (*text) += cArr[0]; // more efficient + else + text->append( cArr, len ); + } + } + } + if ( p && *p ) + p += strlen( endTag ); + return p; +} + +#ifdef TIXML_USE_STL + +void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) +{ + // The basic issue with a document is that we don't know what we're + // streaming. Read something presumed to be a tag (and hope), then + // identify it, and call the appropriate stream method on the tag. + // + // This "pre-streaming" will never read the closing ">" so the + // sub-tag can orient itself. + + if ( !StreamTo( in, '<', tag ) ) + { + SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + while ( in->good() ) + { + int tagIndex = (int) tag->length(); + while ( in->good() && in->peek() != '>' ) + { + int c = in->get(); + if ( c <= 0 ) + { + SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + break; + } + (*tag) += (char) c; + } + + if ( in->good() ) + { + // We now have something we presume to be a node of + // some sort. Identify it, and call the node to + // continue streaming. + TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); + + if ( node ) + { + node->StreamIn( in, tag ); + bool isElement = node->ToElement() != 0; + delete node; + node = 0; + + // If this is the root element, we're done. Parsing will be + // done by the >> operator. + if ( isElement ) + { + return; + } + } + else + { + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + } + } + // We should have returned sooner. + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); +} + +#endif + +const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) +{ + ClearError(); + + // Parse away, at the document level. Since a document + // contains nothing but other tags, most of what happens + // here is skipping white space. + if ( !p || !*p ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + // Note that, for a document, this needs to come + // before the while space skip, so that parsing + // starts from the pointer we are given. + location.Clear(); + if ( prevData ) + { + location.row = prevData->cursor.row; + location.col = prevData->cursor.col; + } + else + { + location.row = 0; + location.col = 0; + } + TiXmlParsingData data( p, TabSize(), location.row, location.col ); + location = data.Cursor(); + + if ( encoding == TIXML_ENCODING_UNKNOWN ) + { + // Check for the Microsoft UTF-8 lead bytes. + const unsigned char* pU = (const unsigned char*)p; + if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 + && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 + && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) + { + encoding = TIXML_ENCODING_UTF8; + useMicrosoftBOM = true; + } + } + + p = SkipWhiteSpace( p, encoding ); + if ( !p ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + while ( p && *p ) + { + TiXmlNode* node = Identify( p, encoding ); + if ( node ) + { + p = node->Parse( p, &data, encoding ); + LinkEndChild( node ); + } + else + { + break; + } + + // Did we get encoding info? + if ( encoding == TIXML_ENCODING_UNKNOWN + && node->ToDeclaration() ) + { + TiXmlDeclaration* dec = node->ToDeclaration(); + const char* enc = dec->Encoding(); + assert( enc ); + + if ( *enc == 0 ) + encoding = TIXML_ENCODING_UTF8; + else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) + encoding = TIXML_ENCODING_UTF8; + else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) + encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice + else + encoding = TIXML_ENCODING_LEGACY; + } + + p = SkipWhiteSpace( p, encoding ); + } + + // Was this empty? + if ( !firstChild ) { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); + return 0; + } + + // All is well. + return p; +} + +void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + // The first error in a chain is more accurate - don't set again! + if ( error ) + return; + + assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); + error = true; + errorId = err; + errorDesc = errorString[ errorId ]; + + errorLocation.Clear(); + if ( pError && data ) + { + data->Stamp( pError, encoding ); + errorLocation = data->Cursor(); + } +} + + +TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) +{ + TiXmlNode* returnNode = 0; + + p = SkipWhiteSpace( p, encoding ); + if( !p || !*p || *p != '<' ) + { + return 0; + } + + p = SkipWhiteSpace( p, encoding ); + + if ( !p || !*p ) + { + return 0; + } + + // What is this thing? + // - Elements start with a letter or underscore, but xml is reserved. + // - Comments: "; + + if ( !StringEqual( p, startTag, false, encoding ) ) + { + document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); + return 0; + } + p += strlen( startTag ); + + // [ 1475201 ] TinyXML parses entities in comments + // Oops - ReadText doesn't work, because we don't want to parse the entities. + // p = ReadText( p, &value, false, endTag, false, encoding ); + // + // from the XML spec: + /* + [Definition: Comments may appear anywhere in a document outside other markup; in addition, + they may appear within the document type declaration at places allowed by the grammar. + They are not part of the document's character data; an XML processor MAY, but need not, + make it possible for an application to retrieve the text of comments. For compatibility, + the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity + references MUST NOT be recognized within comments. + + An example of a comment: + + + */ + + value = ""; + // Keep all the white space. + while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) + { + value.append( p, 1 ); + ++p; + } + if ( p && *p ) + p += strlen( endTag ); + + return p; +} + + +const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p ) return 0; + + if ( data ) + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } + // Read the name, the '=' and the value. + const char* pErr = p; + p = ReadName( p, &name, encoding ); + if ( !p || !*p ) + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); + return 0; + } + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p || *p != '=' ) + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + + ++p; // skip '=' + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p ) + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + + const char* end; + const char SINGLE_QUOTE = '\''; + const char DOUBLE_QUOTE = '\"'; + + if ( *p == SINGLE_QUOTE ) + { + ++p; + end = "\'"; // single quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } + else if ( *p == DOUBLE_QUOTE ) + { + ++p; + end = "\""; // double quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } + else + { + // All attribute values should be in single or double quotes. + // But this is such a common error that the parser will try + // its best, even without them. + value = ""; + while ( p && *p // existence + && !IsWhiteSpace( *p ) // whitespace + && *p != '/' && *p != '>' ) // tag end + { + if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { + // [ 1451649 ] Attribute values with trailing quotes not handled correctly + // We did not have an opening quote but seem to have a + // closing one. Give up and throw an error. + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + value += *p; + ++p; + } + } + return p; +} + +#ifdef TIXML_USE_STL +void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) +{ + while ( in->good() ) + { + int c = in->peek(); + if ( !cdata && (c == '<' ) ) + { + return; + } + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + (*tag) += (char) c; + in->get(); // "commits" the peek made above + + if ( cdata && c == '>' && tag->size() >= 3 ) { + size_t len = tag->size(); + if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { + // terminator of cdata. + return; + } + } + } +} +#endif + +const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + value = ""; + TiXmlDocument* document = GetDocument(); + + if ( data ) + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } + + const char* const startTag = ""; + + if ( cdata || StringEqual( p, startTag, false, encoding ) ) + { + cdata = true; + + if ( !StringEqual( p, startTag, false, encoding ) ) + { + document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); + return 0; + } + p += strlen( startTag ); + + // Keep all the white space, ignore the encoding, etc. + while ( p && *p + && !StringEqual( p, endTag, false, encoding ) + ) + { + value += *p; + ++p; + } + + TIXML_STRING dummy; + p = ReadText( p, &dummy, false, endTag, false, encoding ); + return p; + } + else + { + bool ignoreWhite = true; + + const char* end = "<"; + p = ReadText( p, &value, ignoreWhite, end, false, encoding ); + if ( p ) + return p-1; // don't truncate the '<' + return 0; + } +} + +#ifdef TIXML_USE_STL +void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) +{ + while ( in->good() ) + { + int c = in->get(); + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + (*tag) += (char) c; + + if ( c == '>' ) + { + // All is well. + return; + } + } +} +#endif + +const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) +{ + p = SkipWhiteSpace( p, _encoding ); + // Find the beginning, find the end, and look for + // the stuff in-between. + TiXmlDocument* document = GetDocument(); + if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); + return 0; + } + if ( data ) + { + data->Stamp( p, _encoding ); + location = data->Cursor(); + } + p += 5; + + version = ""; + encoding = ""; + standalone = ""; + + while ( p && *p ) + { + if ( *p == '>' ) + { + ++p; + return p; + } + + p = SkipWhiteSpace( p, _encoding ); + if ( StringEqual( p, "version", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + version = attrib.Value(); + } + else if ( StringEqual( p, "encoding", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + encoding = attrib.Value(); + } + else if ( StringEqual( p, "standalone", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + standalone = attrib.Value(); + } + else + { + // Read over whatever it is. + while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) + ++p; + } + } + return 0; +} + +bool TiXmlText::Blank() const +{ + for ( unsigned i=0; i + +typedef HMODULE lib_t; + +#define __itt_get_proc(lib, name) GetProcAddress(lib, name) +#define __itt_load_lib(name) LoadLibraryA(name) +#define __itt_unload_lib(handle) FreeLibrary(handle) +#define __itt_system_error() (int)GetLastError() +#endif /* ANNOTATE_DECLARE */ + +#else /* defined(WIN32) || defined(_WIN32) */ + +#if defined _M_IX86 || __i386__ +# define ANNOTATEAPI __attribute__ ((cdecl)) +#else +# define ANNOTATEAPI /* actual only on x86 platform */ +#endif + + +#ifndef ANNOTATE_DECLARE +#include +#include +#include + +typedef void* lib_t; + +#define __itt_get_proc(lib, name) dlsym(lib, name) +#define __itt_load_lib(name) dlopen(name, RTLD_LAZY) +#define __itt_unload_lib(handle) dlclose(handle) +#define __itt_system_error() errno +#endif /* ANNOTATE_DECLARE */ + +#endif /* defined(WIN32) || defined(_WIN32) */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef _ITTNOTIFY_H_ + +/* Handles for sites and tasks. + */ +typedef void* __itt_model_site; /* handle for lexical site */ +typedef void* __itt_model_site_instance; /* handle for dynamic instance */ +typedef void* __itt_model_task; /* handle for lexical site */ +typedef void* __itt_model_task_instance; /* handle for dynamic instance */ + +typedef enum { + __itt_model_disable_observation, + __itt_model_disable_collection +} __itt_model_disable; + +#endif /* _ITTNOTIFY_H_ */ + +/*** Use the routines in libittnotify.dll. ***/ + +/* Basic approach: + * For the case of calling the dll, there is an __annotate_routine function + * declared as a comdat in each compilation unit with annotations present. + * That routine in turn has an internal static structure that is initialized + * once to contain the address of functions occuring in libittnotify.dll. + * Each time an annotation macro is invoked, that causes a call to the + * __annotate_routine function to get addresses of the routines, followed + * by calling the specific routine, provided the address is non-null. + */ + +/* This set of macros generates calls that are part of application images, + * which call the __itt_model_xxx routines in the dynamically loaded + * libittnotify.dll. + */ +#ifndef _ITTNOTIFY_H_ +#define ITT_NOTIFY_DECL(_text) _text +#else +#define ITT_NOTIFY_DECL(_text) +#endif + +/* For C++, a static initialization is used */ +#if defined(__cplusplus) && defined(WIN32) +#define _ANNOTATE_ROUTINES_ADDR __annotate_routines_s +#else +#define _ANNOTATE_ROUTINES_ADDR __annotate_routines_init( __annotate_routines() ) +#endif /* __cplusplus */ + + +#define _ANNOTATE_DECLARE_0(_BASENAME) \ +typedef void (ANNOTATEAPI * __annotate_##_BASENAME##_t)(); \ +static __inline void ANNOTATEAPI __annotate_##_BASENAME##_t_nop() { }; \ +ITT_NOTIFY_DECL( extern void ANNOTATEAPI __itt_model_##_BASENAME(); ) + +#define _ANNOTATE_DECLARE_0_INT(_BASENAME) \ +typedef int (ANNOTATEAPI * __annotate_##_BASENAME##_t)(); \ +static __inline int ANNOTATEAPI __annotate_##_BASENAME##_t_nop() { return 0; }; \ +ITT_NOTIFY_DECL( extern void ANNOTATEAPI __itt_model_##_BASENAME(); ) + +#define _ANNOTATE_CALL_0(_BASENAME) { _ANNOTATE_ROUTINES_ADDR->_BASENAME(); } + +#define _ANNOTATE_DECLARE_1(_BASENAME, _P1TYPE) \ +typedef void (ANNOTATEAPI * __annotate_##_BASENAME##_t)(_P1TYPE p1); \ +static __inline void ANNOTATEAPI __annotate_##_BASENAME##_t_nop(_P1TYPE p1) { (void)p1; }; \ +ITT_NOTIFY_DECL( extern void ANNOTATEAPI __itt_model_##_BASENAME(_P1TYPE p1); ) + +#define _ANNOTATE_CALL_1(_BASENAME, _P1) { _ANNOTATE_ROUTINES_ADDR->_BASENAME(_P1); } + +#define _ANNOTATE_DECLARE_2(_BASENAME, _P1TYPE, _P2TYPE) \ +typedef void (ANNOTATEAPI * __annotate_##_BASENAME##_t)(_P1TYPE p1, _P2TYPE p2); \ +static __inline void ANNOTATEAPI __annotate_##_BASENAME##_t_nop(_P1TYPE p1, _P2TYPE p2) { (void)p1; (void)p2; }; \ +ITT_NOTIFY_DECL( extern void ANNOTATEAPI __itt_model_##_BASENAME(_P1TYPE p1, _P2TYPE p2); ) + +#define _ANNOTATE_CALL_2(_BASENAME, _P1, _P2) { _ANNOTATE_ROUTINES_ADDR->_BASENAME((_P1), (_P2)); } + +/*** Declare routines appropriately based on usage style ***/ + +/* Depending on above, this will either expand to comdats that are + * used directly, or comdats that call routines in libittnotify.dll + */ +_ANNOTATE_DECLARE_1(site_beginA, const char *) +_ANNOTATE_DECLARE_0(site_end_2) +_ANNOTATE_DECLARE_1(task_beginA, const char *) +_ANNOTATE_DECLARE_0(task_end_2) +_ANNOTATE_DECLARE_1(iteration_taskA, const char *) +_ANNOTATE_DECLARE_1(lock_acquire_2, void *) +_ANNOTATE_DECLARE_1(lock_release_2, void *) +_ANNOTATE_DECLARE_2(record_allocation, void *, size_t) +_ANNOTATE_DECLARE_1(record_deallocation, void *) +_ANNOTATE_DECLARE_2(induction_uses, void *, size_t) +_ANNOTATE_DECLARE_2(reduction_uses, void *, size_t) +_ANNOTATE_DECLARE_2(observe_uses, void *, size_t) +_ANNOTATE_DECLARE_1(clear_uses, void *) +_ANNOTATE_DECLARE_1(disable_push, __itt_model_disable) +_ANNOTATE_DECLARE_0(disable_pop) +_ANNOTATE_DECLARE_1(aggregate_task, size_t) +_ANNOTATE_DECLARE_0_INT(is_collection_disabled) + +/* All of the symbols potentially in the library + */ +struct __annotate_routines { + volatile int initialized; + __annotate_site_beginA_t site_beginA; + __annotate_site_end_2_t site_end_2; + __annotate_task_beginA_t task_beginA; + __annotate_task_end_2_t task_end_2; + __annotate_iteration_taskA_t iteration_taskA; + __annotate_lock_acquire_2_t lock_acquire_2; + __annotate_lock_release_2_t lock_release_2; + __annotate_record_allocation_t record_allocation; + __annotate_record_deallocation_t record_deallocation; + __annotate_induction_uses_t induction_uses; + __annotate_reduction_uses_t reduction_uses; + __annotate_observe_uses_t observe_uses; + __annotate_clear_uses_t clear_uses; + __annotate_disable_push_t disable_push; + __annotate_disable_pop_t disable_pop; + __annotate_aggregate_task_t aggregate_task; + __annotate_is_collection_disabled_t is_collection_disabled; +}; + +/* This comdat-ed routine means there is a single instance of the function pointer + * structure per image + */ +static __inline struct __annotate_routines* __annotate_routines() +{ + static struct __annotate_routines __annotate_routines; + return &__annotate_routines; +} + +/* This routine is called to get the address of an initialized + * set of function pointers for the annotation routines. + */ + +#ifdef ANNOTATE_DECLARE +extern struct __annotate_routines* ANNOTATEAPI __annotate_routines_init(struct __annotate_routines* itt); +#else +#ifdef ANNOTATE_DEFINE + /* */ +#else + static __inline +#endif +struct __annotate_routines* +ANNOTATEAPI +__annotate_routines_init(struct __annotate_routines* itt) { + + if (itt->initialized) { + return itt; + } else { + + /* Initialized by first invocation + * This assumes that the code here can be executed successfully + * by multiple threads, should that ever happen. + */ + int do_disable_pop = 0; +#if !(defined(WIN32) || defined(_WIN32)) + char* lib_name = NULL; +#endif + + lib_t itt_notify = 0; + +#if defined(WIN32) || defined(_WIN32) + itt_notify = __itt_load_lib("libittnotify.dll"); +#else + if (sizeof(void*) > 4) { + lib_name = getenv("INTEL_LIBITTNOTIFY64"); + } else { + lib_name = getenv("INTEL_LIBITTNOTIFY32"); + } + if (lib_name) { + itt_notify = __itt_load_lib(lib_name); + } +#endif + if (itt_notify != NULL) { + + /* The static variables initialized and itt are reported as race conditions + * or inconsistent lock usage by Dependencies Modeling in some obscure cases + * involving multiple dlls. Ignoring this initialization phase gets rid of + * this problem. + */ + __annotate_disable_push_t disable_push; + __annotate_is_collection_disabled_t is_collection_disabled; + disable_push = (__annotate_disable_push_t) __itt_get_proc(itt_notify, "__itt_model_disable_push"); + is_collection_disabled = (__annotate_is_collection_disabled_t) __itt_get_proc(itt_notify, "__itt_model_is_collection_disabled"); + if (disable_push) { + if ( ! (is_collection_disabled && is_collection_disabled()) ) + { + // disable collection only if it is not disabled already (for example, started paused) + disable_push(__itt_model_disable_observation); + do_disable_pop = 1; + } + } + itt->site_beginA = (__annotate_site_beginA_t) __itt_get_proc(itt_notify, "__itt_model_site_beginA"); + itt->site_end_2 = (__annotate_site_end_2_t) __itt_get_proc(itt_notify, "__itt_model_site_end_2"); + itt->task_beginA = (__annotate_task_beginA_t) __itt_get_proc(itt_notify, "__itt_model_task_beginA"); + itt->task_end_2 = (__annotate_task_end_2_t) __itt_get_proc(itt_notify, "__itt_model_task_end_2"); + itt->iteration_taskA = (__annotate_iteration_taskA_t) __itt_get_proc(itt_notify, "__itt_model_iteration_taskA"); + itt->lock_acquire_2 = (__annotate_lock_acquire_2_t) __itt_get_proc(itt_notify, "__itt_model_lock_acquire_2"); + itt->lock_release_2 = (__annotate_lock_release_2_t) __itt_get_proc(itt_notify, "__itt_model_lock_release_2"); + itt->record_allocation = (__annotate_record_allocation_t) __itt_get_proc(itt_notify, "__itt_model_record_allocation"); + itt->record_deallocation = (__annotate_record_deallocation_t)__itt_get_proc(itt_notify, "__itt_model_record_deallocation"); + itt->induction_uses = (__annotate_induction_uses_t) __itt_get_proc(itt_notify, "__itt_model_induction_uses"); + itt->reduction_uses = (__annotate_reduction_uses_t) __itt_get_proc(itt_notify, "__itt_model_reduction_uses"); + itt->observe_uses = (__annotate_observe_uses_t) __itt_get_proc(itt_notify, "__itt_model_observe_uses"); + itt->clear_uses = (__annotate_clear_uses_t) __itt_get_proc(itt_notify, "__itt_model_clear_uses"); + itt->disable_push = disable_push; + itt->disable_pop = (__annotate_disable_pop_t) __itt_get_proc(itt_notify, "__itt_model_disable_pop"); + itt->aggregate_task = (__annotate_aggregate_task_t) __itt_get_proc(itt_notify, "__itt_model_aggregate_task"); + itt->is_collection_disabled = is_collection_disabled; + } + /* No-op routine for any that didn't get resolved */ + if (!itt->site_beginA) itt->site_beginA = __annotate_site_beginA_t_nop; + if (!itt->site_end_2) itt->site_end_2 = __annotate_site_end_2_t_nop; + if (!itt->task_beginA) itt->task_beginA = __annotate_task_beginA_t_nop; + if (!itt->task_end_2) itt->task_end_2 = __annotate_task_end_2_t_nop; + if (!itt->iteration_taskA) itt->iteration_taskA = __annotate_iteration_taskA_t_nop; + if (!itt->lock_acquire_2) itt->lock_acquire_2 = __annotate_lock_acquire_2_t_nop; + if (!itt->lock_release_2) itt->lock_release_2 = __annotate_lock_release_2_t_nop; + if (!itt->record_allocation) itt->record_allocation = __annotate_record_allocation_t_nop; + if (!itt->record_deallocation) itt->record_deallocation=__annotate_record_deallocation_t_nop; + if (!itt->induction_uses) itt->induction_uses = __annotate_induction_uses_t_nop; + if (!itt->reduction_uses) itt->reduction_uses = __annotate_reduction_uses_t_nop; + if (!itt->observe_uses) itt->observe_uses = __annotate_observe_uses_t_nop; + if (!itt->clear_uses) itt->clear_uses = __annotate_clear_uses_t_nop; + if (!itt->disable_push) itt->disable_push = __annotate_disable_push_t_nop; + if (!itt->disable_pop) itt->disable_pop = __annotate_disable_pop_t_nop; + if (!itt->aggregate_task) itt->aggregate_task = __annotate_aggregate_task_t_nop; + if (!itt->is_collection_disabled) itt->is_collection_disabled = __annotate_is_collection_disabled_t_nop; + + itt->initialized = 1; + + if (do_disable_pop) { + itt->disable_pop(); + } + } + return itt; +} +#endif /* ANNOTATE_DECLARE */ + +/* For C++ only, use a class to force initialization */ + +#if defined(__cplusplus) && defined(WIN32) +/* Force one-shot initialization so individual calls don't need it */ +static struct __annotate_routines* __annotate_routines_s = __annotate_routines_init( __annotate_routines() ); +#endif + +/* For C++, allow the Annotate::SiteBegin(x) form. For Windows CLR, this is the default + * expansion for the macros (with no-inline) to get the best call stacks in the tools. */ +#if defined(__cplusplus) +/* Ensure this code is managed and non-inlinable */ +#if defined(WIN32) && defined(__CLR_VER) +#pragma managed(push, on) +#define ANNOTATE_CLR_NOINLINE __declspec(noinline) +#else +#define ANNOTATE_CLR_NOINLINE +#endif +class Annotate { +public: + static ANNOTATE_CLR_NOINLINE void SiteBegin(const char* site) { _ANNOTATE_ROUTINES_ADDR->site_beginA(site); } + static ANNOTATE_CLR_NOINLINE void SiteEnd() { _ANNOTATE_ROUTINES_ADDR->site_end_2(); } + static ANNOTATE_CLR_NOINLINE void TaskBegin(const char* task) { _ANNOTATE_ROUTINES_ADDR->task_beginA(task); } + static ANNOTATE_CLR_NOINLINE void TaskEnd() { _ANNOTATE_ROUTINES_ADDR->task_end_2(); } + static ANNOTATE_CLR_NOINLINE void IterationTask(const char* task) { _ANNOTATE_ROUTINES_ADDR->iteration_taskA(task); } + static ANNOTATE_CLR_NOINLINE void LockAcquire(void* lockId) { _ANNOTATE_ROUTINES_ADDR->lock_acquire_2(lockId); } + static ANNOTATE_CLR_NOINLINE void LockRelease(void* lockId) { _ANNOTATE_ROUTINES_ADDR->lock_release_2(lockId); } + static ANNOTATE_CLR_NOINLINE void RecordAllocation(void *p, size_t s) { _ANNOTATE_ROUTINES_ADDR->record_allocation(p, s); } + static ANNOTATE_CLR_NOINLINE void RecordDeallocation(void *p) { _ANNOTATE_ROUTINES_ADDR->record_deallocation(p); } + static ANNOTATE_CLR_NOINLINE void InductionUses(void *p, size_t s) { _ANNOTATE_ROUTINES_ADDR->induction_uses(p, s); } + static ANNOTATE_CLR_NOINLINE void ReductionUses(void *p, size_t s) { _ANNOTATE_ROUTINES_ADDR->reduction_uses(p, s); } + static ANNOTATE_CLR_NOINLINE void ObserveUses(void *p, size_t s) { _ANNOTATE_ROUTINES_ADDR->observe_uses(p, s); } + static ANNOTATE_CLR_NOINLINE void ClearUses(void *p) { _ANNOTATE_ROUTINES_ADDR->clear_uses(p); } + static ANNOTATE_CLR_NOINLINE void DisablePush(__itt_model_disable d) { _ANNOTATE_ROUTINES_ADDR->disable_push(d); } + static ANNOTATE_CLR_NOINLINE void DisablePop() { _ANNOTATE_ROUTINES_ADDR->disable_pop(); } + static ANNOTATE_CLR_NOINLINE void AggregateTask(size_t c) { _ANNOTATE_ROUTINES_ADDR->aggregate_task(c); } +}; +#if defined(WIN32) && defined(__CLR_VER) +#pragma managed(pop) +#endif +#undef ANNOTATE_CLR_NOINLINE +#endif + +#if defined(__cplusplus) && defined(WIN32) && defined(__CLR_VER) + +#define ANNOTATE_SITE_BEGIN(_SITE) Annotate::SiteBegin(#_SITE) +#define ANNOTATE_SITE_END(...) Annotate::SiteEnd() +#define ANNOTATE_TASK_BEGIN(_TASK) Annotate::TaskBegin(#_TASK) +#define ANNOTATE_TASK_END(...) Annotate::TaskEnd() +#define ANNOTATE_ITERATION_TASK(_TASK) Annotate::IterationTask(#_TASK) +#define ANNOTATE_LOCK_ACQUIRE(_ADDR) Annotate::LockAcquire(_ADDR) +#define ANNOTATE_LOCK_RELEASE(_ADDR) Annotate::LockRelease(_ADDR) +#define ANNOTATE_RECORD_ALLOCATION(_ADDR, _SIZE) Annotate::RecordAllocation((_ADDR), (_SIZE)) +#define ANNOTATE_RECORD_DEALLOCATION(_ADDR) Annotate::RecordDeallocation(_ADDR) +#define ANNOTATE_INDUCTION_USES(_ADDR, _SIZE) Annotate::InductionUses((_ADDR), (_SIZE)) +#define ANNOTATE_REDUCTION_USES(_ADDR, _SIZE) Annotate::ReductionUses((_ADDR), (_SIZE)) +#define ANNOTATE_OBSERVE_USES(_ADDR, _SIZE) Annotate::ObserveUses((_ADDR), (_SIZE)) +#define ANNOTATE_CLEAR_USES(_ADDR) Annotate::ClearUses(_ADDR) +#define ANNOTATE_DISABLE_OBSERVATION_PUSH Annotate::DisablePush(itt_model_disable_observation) +#define ANNOTATE_DISABLE_OBSERVATION_POP Annotate::DisablePop() +#define ANNOTATE_DISABLE_COLLECTION_PUSH Annotate::DisablePush(__itt_model_disable_collection) +#define ANNOTATE_DISABLE_COLLECTION_POP Annotate::DisablePop() +#define ANNOTATE_AGGREGATE_TASK(_COUNT) Annotate::AggregateTask(_COUNT) + +#else + +/* Mark the start of a site (region) to be analyzed by the tool */ +#define ANNOTATE_SITE_BEGIN(_SITE) _ANNOTATE_CALL_1(site_beginA, #_SITE) + +/* Mark the end of a site (region) to be analyzed by the tool and + * indicate a WaitForAll task synchronization */ +#define ANNOTATE_SITE_END(...) _ANNOTATE_CALL_0(site_end_2) + +/* Mark the beginning of a region of code that constitutes a task */ +#define ANNOTATE_TASK_BEGIN(_TASK) _ANNOTATE_CALL_1(task_beginA, #_TASK) + +/* Mark the end of a region of code that constitutes a task */ +#define ANNOTATE_TASK_END(...) _ANNOTATE_CALL_0(task_end_2) + +/* Mark the break between one task and the next task (a "split" description model + * rather than a "begin/end" description model. */ +#define ANNOTATE_ITERATION_TASK(_TASK) _ANNOTATE_CALL_1(iteration_taskA, #_TASK) + +/* Acquire a lock identified by lockId */ +#define ANNOTATE_LOCK_ACQUIRE(_ADDR) _ANNOTATE_CALL_1(lock_acquire_2, (_ADDR)) + +/* Release a lock identified by lockId */ +#define ANNOTATE_LOCK_RELEASE(_ADDR) _ANNOTATE_CALL_1(lock_release_2, (_ADDR)) + +/* Record user allocation of memory */ +#define ANNOTATE_RECORD_ALLOCATION(_ADDR, _SIZE) _ANNOTATE_CALL_2(record_allocation, (_ADDR), (_SIZE)) + +/* Record user deallocation of memory */ +#define ANNOTATE_RECORD_DEALLOCATION(_ADDR) _ANNOTATE_CALL_1(record_deallocation, (_ADDR)) + +/* Denote storage as an inductive value */ +#define ANNOTATE_INDUCTION_USES(_ADDR, _SIZE) _ANNOTATE_CALL_2(induction_uses, (_ADDR), (_SIZE)) + +/* Denote storage as a reduction */ +#define ANNOTATE_REDUCTION_USES(_ADDR, _SIZE) _ANNOTATE_CALL_2(reduction_uses, (_ADDR), (_SIZE)) + +/* Record all observations of uses */ +#define ANNOTATE_OBSERVE_USES(_ADDR, _SIZE) _ANNOTATE_CALL_2(observe_uses, (_ADDR), (_SIZE)) + +/* Clear handling of values */ +#define ANNOTATE_CLEAR_USES(_ADDR) _ANNOTATE_CALL_1(clear_uses, (_ADDR)) + +/* Push disable of observations */ +#define ANNOTATE_DISABLE_OBSERVATION_PUSH _ANNOTATE_CALL_1(disable_push, __itt_model_disable_observation) + +/* Pop disable of observations */ +#define ANNOTATE_DISABLE_OBSERVATION_POP _ANNOTATE_CALL_0(disable_pop) + +/* Push disable of collection */ +#define ANNOTATE_DISABLE_COLLECTION_PUSH _ANNOTATE_CALL_1(disable_push, __itt_model_disable_collection) + +/* Pop disable of collection */ +#define ANNOTATE_DISABLE_COLLECTION_POP _ANNOTATE_CALL_0(disable_pop) + +/* Task aggregation */ +#define ANNOTATE_AGGREGATE_TASK(_COUNT) _ANNOTATE_CALL_1(aggregate_task, (_COUNT)) + +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ANNOTATE_EXPAND_NULL */ + +#endif /* _ADVISOR_ANNOTATE_H_ */ diff --git a/external/vtune/linux/include/advisor_annotate.f90 b/external/vtune/linux/include/advisor_annotate.f90 new file mode 100644 index 0000000000..d4d2d34d62 --- /dev/null +++ b/external/vtune/linux/include/advisor_annotate.f90 @@ -0,0 +1,706 @@ +! ======================================================================== +! +! SAMPLE SOURCE CODE - SUBJECT TO THE TERMS OF END-USER LICENSE AGREEMENT +! FOR INTEL(R) ADVISOR XE 2016. +! +! Copyright (c) 2012-2015 Intel Corporation. All rights reserved. +! +! THIS FILE IS PROVIDED "AS IS" WITH NO WARRANTIES, EXPRESS OR IMPLIED, +! INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY, +! FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OF INTELLECTUAL +! PROPERTY RIGHTS. +! +! ======================================================================== +! + +!-------- +! +! This file defines functions used by the Intel(R) Advisor XE +! "Dependencies Modeling" and "Suitability Modeling" analysis, which +! are described in the "Annotations" section of the help. +! +! Version of the annotations. +! The presence of this macro serves to idetify the annotation definition +! file and the form of annotations. +! INTEL_ADVISOR_ANNOTATION_VERSION 1.0 +!-------- + +module advisor_annotate + use, intrinsic :: iso_c_binding, only: C_PTR, C_FUNPTR, C_INT, C_CHAR, C_NULL_CHAR, C_F_PROCPOINTER, C_LOC, C_ASSOCIATED + implicit none + + !-------- + ! + ! Public interface + ! + !-------- + + public :: annotate_site_begin + public :: annotate_site_end + public :: annotate_task_begin + public :: annotate_task_end + public :: annotate_iteration_task + public :: annotate_lock_acquire + public :: annotate_lock_release + public :: annotate_disable_observation_push + public :: annotate_disable_observation_pop + public :: annotate_disable_collection_push + public :: annotate_disable_collection_pop + public :: annotate_induction_uses + public :: annotate_reduction_uses + public :: annotate_observe_uses + public :: annotate_clear_uses + public :: annotate_aggregate_task + + interface annotate_induction_uses + module procedure annotate_induction_uses_i2 + module procedure annotate_induction_uses_i4 + module procedure annotate_induction_uses_i8 + module procedure annotate_induction_uses_r4 + module procedure annotate_induction_uses_r8 + module procedure annotate_induction_uses_c4 + module procedure annotate_induction_uses_c8 + end interface annotate_induction_uses + + interface annotate_reduction_uses + module procedure annotate_reduction_uses_i2 + module procedure annotate_reduction_uses_i4 + module procedure annotate_reduction_uses_i8 + module procedure annotate_reduction_uses_r4 + module procedure annotate_reduction_uses_r8 + module procedure annotate_reduction_uses_c4 + module procedure annotate_reduction_uses_c8 + end interface annotate_reduction_uses + + interface annotate_observe_uses + module procedure annotate_observe_uses_i2 + module procedure annotate_observe_uses_i4 + module procedure annotate_observe_uses_i8 + module procedure annotate_observe_uses_r4 + module procedure annotate_observe_uses_r8 + module procedure annotate_observe_uses_c4 + module procedure annotate_observe_uses_c8 + end interface annotate_observe_uses + + interface annotate_clear_uses + module procedure annotate_clear_uses_i2 + module procedure annotate_clear_uses_i4 + module procedure annotate_clear_uses_i8 + module procedure annotate_clear_uses_r4 + module procedure annotate_clear_uses_r8 + module procedure annotate_clear_uses_c4 + module procedure annotate_clear_uses_c8 + end interface annotate_clear_uses + + private + + !-------- + ! + ! Interfaces to the itt_notify entry points + ! + !-------- + + enum, bind(C) + enumerator :: disable_observation + enumerator :: disable_collection + end enum + + abstract interface + + subroutine itt_proc_noargs() bind(C) + end subroutine itt_proc_noargs + + subroutine itt_proc_with_name(name, len) bind(C) + import + character, dimension(*), intent(in) :: name + integer(kind=C_INT), intent(in), value :: len + end subroutine itt_proc_with_name + + subroutine itt_proc_with_int(intval) bind(C) + import + integer(kind=C_INT), intent(in), value :: intval + end subroutine itt_proc_with_int + + subroutine itt_proc_with_disable(disable_kind) bind(C) + import + integer(kind=C_INT), intent(in), value :: disable_kind + end subroutine itt_proc_with_disable + + subroutine itt_proc_with_addr_size(addr, size) bind(C) + import + type(C_PTR), intent(in), value :: addr + integer(kind=C_INT), intent(in), value :: size + end subroutine itt_proc_with_addr_size + + end interface + + !-------- + ! + ! Subroutine pointer variables to access the itt_notify entry points + ! + !-------- + +!dec$ if defined(use_initialized_proc_ptrs) + procedure(itt_proc_with_name), pointer :: site_begin => site_begin_load + procedure(itt_proc_noargs), pointer :: site_end_2 => site_end_2_load + procedure(itt_proc_with_name), pointer :: task_begin => task_begin_load + procedure(itt_proc_noargs), pointer :: task_end_2 => task_end_2_load + procedure(itt_proc_noargs), pointer :: iteration_task => iteration_task_load + procedure(itt_proc_with_int), pointer :: lock_acquire_2 => lock_acquire_2_load + procedure(itt_proc_with_int), pointer :: lock_release_2 => lock_release_2_load + procedure(itt_proc_with_disable), pointer :: disable_push => disable_push_load + procedure(itt_proc_noargs), pointer :: disable_pop => disable_pop_load + procedure(itt_proc_with_addr_size), pointer :: induction_uses => induction_uses_load + procedure(itt_proc_with_addr_size), pointer :: reduction_uses => reduction_uses_load + procedure(itt_proc_with_addr_size), pointer :: observe_uses => observe_uses_load + procedure(itt_proc_with_addr_size), pointer :: clear_uses => clear_uses_load + procedure(itt_proc_with_int), pointer :: aggregate_task => aggregate_task_load +!dec$ else + procedure(itt_proc_with_name), pointer :: site_begin + procedure(itt_proc_noargs), pointer :: site_end_2 + procedure(itt_proc_with_name), pointer :: task_begin + procedure(itt_proc_noargs), pointer :: task_end_2 + procedure(itt_proc_with_name), pointer :: iteration_task + procedure(itt_proc_with_int), pointer :: lock_acquire_2 + procedure(itt_proc_with_int), pointer :: lock_release_2 + procedure(itt_proc_with_disable), pointer :: disable_push + procedure(itt_proc_noargs), pointer :: disable_pop + procedure(itt_proc_with_addr_size), pointer :: induction_uses + procedure(itt_proc_with_addr_size), pointer :: reduction_uses + procedure(itt_proc_with_addr_size), pointer :: observe_uses + procedure(itt_proc_with_addr_size), pointer :: clear_uses + procedure(itt_proc_with_int), pointer :: aggregate_task + + logical :: initialized = .false. +!dec$ endif + + + !-------- + ! + ! Functions for loading dynamic libraries + ! + !-------- + + interface + + !dec$ if defined(_WIN32) + + !DEC$OBJCOMMENT LIB:"KERNEL32.LIB" + !DEC$OBJCOMMENT LIB:"advisor.lib" + + function load_library(file) + import + !dec$ attributes default, stdcall, decorate, alias : 'LoadLibraryA' :: load_library + type(C_PTR) :: load_library + character(kind=C_CHAR), dimension(*), intent(in) :: file + end function load_library + + function get_library_entry(library, proc_name) + import + !dec$ attributes default, stdcall, decorate, alias : 'GetProcAddress' :: get_library_entry + type(C_FUNPTR) :: get_library_entry + type(C_PTR), intent(in), value :: library + character(kind=C_CHAR), dimension(*), intent(in) :: proc_name + end function get_library_entry + + !dec$ else + + function load_library(file, mode) bind(C, name="dlopen") + import + type(C_PTR) :: load_library + character(kind=C_CHAR), dimension(*), intent(in) :: file + integer(kind=C_INT), intent(in), value :: mode + end function load_library + + function get_library_entry(library, proc_name) bind(C, name="dlsym") + import + type(C_FUNPTR) :: get_library_entry + type(C_PTR), intent(in), value :: library + character(kind=C_CHAR), dimension(*), intent(in) :: proc_name + end function get_library_entry + + !dec$ endif + + end interface + +contains + + !-------- + ! + ! The public interface subroutines just make sure the module has been initialized, + ! and then make an indirect call through the corresponding pointer variables. + ! Initializing the module tries to load the itt notify library. If the library + ! is loaded successfully, the variables are set to point to the corresponding + ! entries in the library. If the library load fails, the variables are set to point + ! to stub routines. + ! + !-------- + + subroutine annotate_site_begin(site_name) + !DEC$ ATTRIBUTES DEFAULT :: annotate_site_begin + character(len=*), intent(in) :: site_name + if (.not. initialized) call load_itt_library + call site_begin(site_name, len(site_name)) + end subroutine annotate_site_begin + + subroutine annotate_site_end + !DEC$ ATTRIBUTES DEFAULT :: annotate_site_end + if (.not. initialized) call load_itt_library + call site_end_2 + end subroutine annotate_site_end + + subroutine annotate_task_begin(task_name) + !DEC$ ATTRIBUTES DEFAULT :: annotate_task_begin + character(len=*), intent(in) :: task_name + if (.not. initialized) call load_itt_library + call task_begin(task_name, len(task_name)) + end subroutine annotate_task_begin + + subroutine annotate_task_end + !DEC$ ATTRIBUTES DEFAULT :: annotate_task_end + if (.not. initialized) call load_itt_library + call task_end_2 + end subroutine annotate_task_end + + subroutine annotate_iteration_task(task_name) + !DEC$ ATTRIBUTES DEFAULT :: annotate_iteration_task + character(len=*), intent(in) :: task_name + if (.not. initialized) call load_itt_library + call iteration_task(task_name, len(task_name)) + end subroutine annotate_iteration_task + + subroutine annotate_lock_acquire(lock_id) + !DEC$ ATTRIBUTES DEFAULT :: annotate_lock_acquire + integer, intent(in) :: lock_id + if (.not. initialized) call load_itt_library + call lock_acquire_2(lock_id) + end subroutine annotate_lock_acquire + + subroutine annotate_lock_release(lock_id) + !DEC$ ATTRIBUTES DEFAULT :: annotate_lock_release + integer, intent(in) :: lock_id + if (.not. initialized) call load_itt_library + call lock_release_2(lock_id) + end subroutine annotate_lock_release + + subroutine annotate_disable_observation_push + !DEC$ ATTRIBUTES DEFAULT :: annotate_disable_observation_push + if (.not. initialized) call load_itt_library + call disable_push(disable_observation) + end subroutine annotate_disable_observation_push + + subroutine annotate_disable_observation_pop + !DEC$ ATTRIBUTES DEFAULT :: annotate_disable_observation_pop + if (.not. initialized) call load_itt_library + call disable_pop + end subroutine annotate_disable_observation_pop + + subroutine annotate_disable_collection_push + !DEC$ ATTRIBUTES DEFAULT :: annotate_disable_collection_push + if (.not. initialized) call load_itt_library + call disable_push(disable_collection) + end subroutine annotate_disable_collection_push + + subroutine annotate_disable_collection_pop + !DEC$ ATTRIBUTES DEFAULT :: annotate_disable_collection_pop + if (.not. initialized) call load_itt_library + call disable_pop + end subroutine annotate_disable_collection_pop + + subroutine annotate_induction_uses_i2(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_i2 + integer(kind=2), intent(in) :: x + if (.not. initialized) call load_itt_library + call induction_uses(C_LOC(x), 2) + end subroutine annotate_induction_uses_i2 + + subroutine annotate_induction_uses_i4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_i4 + integer(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call induction_uses(C_LOC(x), 4) + end subroutine annotate_induction_uses_i4 + + subroutine annotate_induction_uses_i8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_i8 + integer(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call induction_uses(C_LOC(x), 8) + end subroutine annotate_induction_uses_i8 + + subroutine annotate_induction_uses_r4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_r4 + real(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call induction_uses(C_LOC(x), 4) + end subroutine annotate_induction_uses_r4 + + subroutine annotate_induction_uses_r8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_r8 + real(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call induction_uses(C_LOC(x), 8) + end subroutine annotate_induction_uses_r8 + + subroutine annotate_induction_uses_c4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_c4 + complex(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call induction_uses(C_LOC(x), 8) + end subroutine annotate_induction_uses_c4 + + subroutine annotate_induction_uses_c8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_induction_uses_c8 + complex(kind=16), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 16) + end subroutine annotate_induction_uses_c8 + + subroutine annotate_reduction_uses_i2(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_i2 + integer(kind=2), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 2) + end subroutine annotate_reduction_uses_i2 + + subroutine annotate_reduction_uses_i4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_i4 + integer(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 4) + end subroutine annotate_reduction_uses_i4 + + subroutine annotate_reduction_uses_i8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_i8 + integer(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 8) + end subroutine annotate_reduction_uses_i8 + + subroutine annotate_reduction_uses_r4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_r4 + real(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 4) + end subroutine annotate_reduction_uses_r4 + + subroutine annotate_reduction_uses_r8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_r8 + real(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 8) + end subroutine annotate_reduction_uses_r8 + + subroutine annotate_reduction_uses_c4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_c4 + complex(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 8) + end subroutine annotate_reduction_uses_c4 + + subroutine annotate_reduction_uses_c8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_reduction_uses_c8 + complex(kind=16), intent(in) :: x + if (.not. initialized) call load_itt_library + call reduction_uses(C_LOC(x), 16) + end subroutine annotate_reduction_uses_c8 + + subroutine annotate_observe_uses_i2(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_i2 + integer(kind=2), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 2) + end subroutine annotate_observe_uses_i2 + + subroutine annotate_observe_uses_i4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_i4 + integer(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 4) + end subroutine annotate_observe_uses_i4 + + subroutine annotate_observe_uses_i8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_i8 + integer(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 8) + end subroutine annotate_observe_uses_i8 + + subroutine annotate_observe_uses_r4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_r4 + real(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 4) + end subroutine annotate_observe_uses_r4 + + subroutine annotate_observe_uses_r8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_r8 + real(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 8) + end subroutine annotate_observe_uses_r8 + + subroutine annotate_observe_uses_c4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_c4 + complex(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 8) + end subroutine annotate_observe_uses_c4 + + subroutine annotate_observe_uses_c8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_observe_uses_c8 + complex(kind=16), intent(in) :: x + if (.not. initialized) call load_itt_library + call observe_uses(C_LOC(x), 16) + end subroutine annotate_observe_uses_c8 + + subroutine annotate_clear_uses_i2(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_i2 + integer(kind=2), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 2) + end subroutine annotate_clear_uses_i2 + + subroutine annotate_clear_uses_i4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_i4 + integer(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 4) + end subroutine annotate_clear_uses_i4 + + subroutine annotate_clear_uses_i8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_i8 + integer(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 8) + end subroutine annotate_clear_uses_i8 + + subroutine annotate_clear_uses_r4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_r4 + real(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 4) + end subroutine annotate_clear_uses_r4 + + subroutine annotate_clear_uses_r8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_r8 + real(kind=8), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 8) + end subroutine annotate_clear_uses_r8 + + subroutine annotate_clear_uses_c4(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_c4 + complex(kind=4), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 8) + end subroutine annotate_clear_uses_c4 + + subroutine annotate_clear_uses_c8(x) + !DEC$ ATTRIBUTES DEFAULT :: annotate_clear_uses_c8 + complex(kind=16), intent(in) :: x + if (.not. initialized) call load_itt_library + call clear_uses(C_LOC(x), 16) + end subroutine annotate_clear_uses_c8 + + subroutine annotate_aggregate_task(count) + !DEC$ ATTRIBUTES DEFAULT :: annotate_aggregate_task + integer, intent(in) :: count + if (.not. initialized) call load_itt_library + call aggregate_task(count) + end subroutine annotate_aggregate_task + + + !-------- + ! + ! These are the load-library subroutines. + ! + !-------- + +!dec$ if defined(use_initialized_proc_ptrs) + + subroutine site_begin_load(name, len) bind(C) + character, dimension(*), intent(in) :: name + integer(kind=C_INT), intent(in), value :: len + call load_itt_library + call site_begin(name, len) + end subroutine site_begin_load + + subroutine site_end_2_load bind(C) + call load_itt_library + call site_end_2 + end subroutine site_end_2_load + + subroutine task_begin_load(name, len) bind(C) + character, dimension(*), intent(in) :: name + integer(kind=C_INT), intent(in), value :: len + call load_itt_library + call task_begin(name, len) + end subroutine task_begin_load + + subroutine task_end_2_load bind(C) + call load_itt_library + call task_end_2 + end subroutine task_end_2_load + + subroutine iteration_task_load(name, len) bind(C) + character, dimension(*), intent(in) :: name + integer(kind=C_INT), intent(in), value :: len + call load_itt_library + call iteration_task(name, len) + end subroutine iteration_task_load + + subroutine lock_acquire_2_load(lock_id) bind(C) + integer(kind=C_INT), intent(in), value :: lock_id + call load_itt_library + call lock_acquire_2(lock_id) + end subroutine lock_acquire_2_load + + subroutine lock_release_2_load(lock_id) bind(C) + integer(kind=C_INT), intent(in), value :: lock_id + call load_itt_library + call lock_release_2(lock_id) + end subroutine lock_release_2_load + + subroutine disable_push_load(disable_kind) bind(C) + integer(kind=C_INT), intent(in), value :: disable_kind + call load_itt_library + call disable_push(disable_kind) + end subroutine disable_push_load + + subroutine disable_pop_load bind(C) + call load_itt_library + call disable_pop + end subroutine disable_pop_load + + subroutine induction_uses_load(addr, size) bind(C) + type(C_PTR), intent(in), value :: addr + integer(kind=C_INT), intent(in), value :: size + call itt_load_library + call induction_uses(addr, size) + end subroutine induction_uses_load + + subroutine reduction_uses_load(addr, size) bind(C) + type(C_PTR), intent(in), value :: addr + integer(kind=C_INT), intent(in), value :: size + call itt_load_library + call reduction_uses(addr, size) + end subroutine reduction_uses_load + + subroutine observe_uses_load(addr, size) bind(C) + type(C_PTR), intent(in), value :: addr + integer(kind=C_INT), intent(in), value :: size + call itt_load_library + call observe_uses(addr, size) + end subroutine observe_uses_load + + subroutine clear_uses_load(addr, size) bind(C) + type(C_PTR), intent(in), value :: addr + integer(kind=C_INT), intent(in), value :: size + call itt_load_library + call clear_uses(addr, size) + end subroutine clear_uses_load + + subroutine annotate_task_load(count) bind(C) + integer(kind=C_INT), intent(in), value :: count + call load_itt_library + call annotate_task(count) + end subroutine annotate_task_load + +!dec$ endif + + !-------- + ! + ! These are the stub subroutines. + ! + !-------- + + subroutine itt_proc_stub() bind(C) + end subroutine itt_proc_stub + + subroutine itt_proc_with_name_stub(name, len) bind(C) + character, dimension(*), intent(in) :: name + integer(kind=C_INT), intent(in), value :: len + end subroutine itt_proc_with_name_stub + + subroutine itt_proc_with_int_stub(count) bind(C) + integer(kind=C_INT), intent(in), value :: count + end subroutine itt_proc_with_int_stub + + subroutine itt_proc_with_disable_stub(disable_kind) bind(C) + integer(kind=C_INT), value :: disable_kind + end subroutine itt_proc_with_disable_stub + + subroutine itt_proc_with_addr_size_stub(addr, size) bind(C) + type(C_PTR), intent(in), value :: addr + integer(kind=C_INT), intent(in), value :: size + end subroutine itt_proc_with_addr_size_stub + + !-------- + ! + ! Internal support code to load the itt notify library and get pointers + ! to its entry points. + ! + !-------- + + subroutine load_itt_library + type(C_PTR) :: library + character*1024 ittnotify_path + +!dec$ if defined(_WIN32) + library = load_library("libittnotify.dll"C) +!dec$ else if defined(__APPLE__) + library = load_library("libittnotify.dylib"C, 0) +!dec$ else +!dec$ if defined(__X86_64) .or. defined(_M_X64) + call getenv('INTEL_LIBITTNOTIFY64',ittnotify_path) +!dec$ else + call getenv('INTEL_LIBITTNOTIFY32',ittnotify_path) +!dec$ endif + if ( ittnotify_path /= '' ) then + ! print *,' libpath: "'//trim(ittnotify_path)//'"' + library = load_library(trim(ittnotify_path)//char(0), 1) ! 1 is RTLD_LAZY + else + ! print *,' libpath: "libittnotify.so"' + library = load_library("libittnotify.so"C, 1) ! 1 is RTLD_LAZY + endif +!dec$ endif + + if (C_ASSOCIATED(library)) then + ! print *, "Library loaded" + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_site_beginAL"C), site_begin) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_site_end_2"C), site_end_2) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_task_beginAL"C), task_begin) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_task_end_2"C), task_end_2) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_iteration_taskAL"C), iteration_task) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_lock_acquire_2"C), lock_acquire_2) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_lock_release_2"C), lock_release_2) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_disable_push"C), disable_push) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_disable_pop"C), disable_pop) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_induction_uses"C), induction_uses) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_reduction_uses"C), reduction_uses) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_observe_uses"C), observe_uses) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_clear_uses"C), clear_uses) + call C_F_PROCPOINTER(get_library_entry(library, "__itt_model_aggregate_task"C), aggregate_task) + else + ! print *, "Library not found" + site_begin => itt_proc_with_name_stub + site_end_2 => itt_proc_stub + task_begin => itt_proc_with_name_stub + task_end_2 => itt_proc_stub + iteration_task => itt_proc_with_name_stub + lock_acquire_2 => itt_proc_with_int_stub + lock_release_2 => itt_proc_with_int_stub + disable_push => itt_proc_with_disable_stub + disable_pop => itt_proc_stub + induction_uses => itt_proc_with_addr_size_stub + reduction_uses => itt_proc_with_addr_size_stub + observe_uses => itt_proc_with_addr_size_stub + clear_uses => itt_proc_with_addr_size_stub + aggregate_task => itt_proc_with_int_stub + end if + + initialized = .true. + end subroutine + +end module advisor_annotate diff --git a/external/vtune/linux/include/internal/ittnotify.h b/external/vtune/linux/include/internal/ittnotify.h new file mode 100644 index 0000000000..43f4f1f3ae --- /dev/null +++ b/external/vtune/linux/include/internal/ittnotify.h @@ -0,0 +1,260 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _INTERNAL_ITTNOTIFY_H_ +#define _INTERNAL_ITTNOTIFY_H_ + +/** + * @file + * @brief Internal User API functions and types + */ + +/** @cond exclude_from_documentation */ +#ifndef ITT_OS_WIN +# define ITT_OS_WIN 1 +#endif /* ITT_OS_WIN */ + +#ifndef ITT_OS_LINUX +# define ITT_OS_LINUX 2 +#endif /* ITT_OS_LINUX */ + +#ifndef ITT_OS_MAC +# define ITT_OS_MAC 3 +#endif /* ITT_OS_MAC */ + +#ifndef ITT_OS_FREEBSD +# define ITT_OS_FREEBSD 4 +#endif /* ITT_OS_FREEBSD */ + +#ifndef ITT_OS +# if defined WIN32 || defined _WIN32 +# define ITT_OS ITT_OS_WIN +# elif defined( __APPLE__ ) && defined( __MACH__ ) +# define ITT_OS ITT_OS_MAC +# elif defined( __FreeBSD__ ) +# define ITT_OS ITT_OS_FREEBSD +# else +# define ITT_OS ITT_OS_LINUX +# endif +#endif /* ITT_OS */ + +#ifndef ITT_PLATFORM_WIN +# define ITT_PLATFORM_WIN 1 +#endif /* ITT_PLATFORM_WIN */ + +#ifndef ITT_PLATFORM_POSIX +# define ITT_PLATFORM_POSIX 2 +#endif /* ITT_PLATFORM_POSIX */ + +#ifndef ITT_PLATFORM_MAC +# define ITT_PLATFORM_MAC 3 +#endif /* ITT_PLATFORM_MAC */ + +#ifndef ITT_PLATFORM_FREEBSD +# define ITT_PLATFORM_FREEBSD 4 +#endif /* ITT_PLATFORM_FREEBSD */ + +#ifndef ITT_PLATFORM +# if ITT_OS==ITT_OS_WIN +# define ITT_PLATFORM ITT_PLATFORM_WIN +# elif ITT_OS==ITT_OS_MAC +# define ITT_PLATFORM ITT_PLATFORM_MAC +# elif ITT_OS==ITT_OS_FREEBSD +# define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# else +# define ITT_PLATFORM ITT_PLATFORM_POSIX +# endif +#endif /* ITT_PLATFORM */ + +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#include +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#if defined(UNICODE) || defined(_UNICODE) +#include +#endif /* UNICODE || _UNICODE */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef CDECL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define CDECL __cdecl +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define CDECL __attribute__ ((cdecl)) +# else /* _M_IX86 || __i386__ */ +# define CDECL /* actual only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* CDECL */ + +#ifndef STDCALL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define STDCALL __stdcall +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define STDCALL __attribute__ ((stdcall)) +# else /* _M_IX86 || __i386__ */ +# define STDCALL /* supported only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* STDCALL */ + +#define ITTAPI CDECL +#define LIBITTAPI CDECL + +/* TODO: Temporary for compatibility! */ +#define ITTAPI_CALL CDECL +#define LIBITTAPI_CALL CDECL + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +/* use __forceinline (VC++ specific) */ +#define ITT_INLINE __forceinline +#define ITT_INLINE_ATTRIBUTE /* nothing */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/* + * Generally, functions are not inlined unless optimization is specified. + * For functions declared inline, this attribute inlines the function even + * if no optimization level was specified. + */ +#ifdef __STRICT_ANSI__ +#define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) +#else /* __STRICT_ANSI__ */ +#define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) +#endif /* __STRICT_ANSI__ */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/** @endcond */ + +/** @cond exclude_from_documentation */ +/* Helper macro for joining tokens */ +#define ITT_JOIN_AUX(p,n) p##n +#define ITT_JOIN(p,n) ITT_JOIN_AUX(p,n) + +#ifdef ITT_MAJOR +#undef ITT_MAJOR +#endif +#ifdef ITT_MINOR +#undef ITT_MINOR +#endif +#define ITT_MAJOR 3 +#define ITT_MINOR 0 + +/* Standard versioning of a token with major and minor version numbers */ +#define ITT_VERSIONIZE(x) \ + ITT_JOIN(x, \ + ITT_JOIN(_, \ + ITT_JOIN(ITT_MAJOR, \ + ITT_JOIN(_, ITT_MINOR)))) + +#ifndef INTEL_ITTNOTIFY_PREFIX +# define INTEL_ITTNOTIFY_PREFIX __itt_ +#endif /* INTEL_ITTNOTIFY_PREFIX */ +#ifndef INTEL_ITTNOTIFY_POSTFIX +# define INTEL_ITTNOTIFY_POSTFIX _ptr_ +#endif /* INTEL_ITTNOTIFY_POSTFIX */ + +#define ITTNOTIFY_NAME_AUX(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n) +#define ITTNOTIFY_NAME(n) ITT_VERSIONIZE(ITTNOTIFY_NAME_AUX(ITT_JOIN(n,INTEL_ITTNOTIFY_POSTFIX))) + +#define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) +#define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) + +#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) + +#ifdef ITT_STUB +#undef ITT_STUB +#endif +#ifdef ITT_STUBV +#undef ITT_STUBV +#endif +#define ITT_STUBV(api,type,name,args) \ + typedef type (api* ITT_JOIN(ITTNOTIFY_NAME(name),_t)) args; \ + extern ITT_JOIN(ITTNOTIFY_NAME(name),_t) ITTNOTIFY_NAME(name); +#define ITT_STUB ITT_STUBV +/** @endcond */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define INTEL_ITTNOTIFY_API_PRIVATE +#include "../ittnotify.h" + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _INTERNAL_ITTNOTIFY_H_ */ diff --git a/external/vtune/linux/include/ittnotify.f90 b/external/vtune/linux/include/ittnotify.f90 new file mode 100644 index 0000000000..ba49cb0c4a --- /dev/null +++ b/external/vtune/linux/include/ittnotify.f90 @@ -0,0 +1,473 @@ +! ======================================================================== +! +! This file is provided under a dual BSD/GPLv2 license. When using or +! redistributing this file, you may do so under either license. +! +! GPL LICENSE SUMMARY +! +! Copyright (c) 2005-2014 Intel Corporation. All rights reserved. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of version 2 of the GNU General Public License as +! published by the Free Software Foundation. +! +! This program is distributed in the hope that it will be useful, but +! WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +! General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program; if not, write to the Free Software +! Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +! The full GNU General Public License is included in this distribution +! in the file called LICENSE.GPL. +! +! Contact Information: +! http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ +! +! BSD LICENSE +! +! Copyright (c) 2005-2014 Intel Corporation. All rights reserved. +! All rights reserved. +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! +! * Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! * Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions and the following disclaimer in +! the documentation and/or other materials provided with the +! distribution. +! * Neither the name of Intel Corporation nor the names of its +! contributors may be used to endorse or promote products derived +! from this software without specific prior written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +! +! ======================================================================== +! + +!-------- +! +! This file defines functions used by Intel(R) Parallel Inspector and +! Amplifier. +! +! Version of ittnotify that was used to generate this file. +! This is not Fortran code that can be used to check but rather a comment +! that only serves to identify the interface. +! INTEL_ITT_FORTRAN_API_VERSION 3.0 +!-------- + +module ittnotify + use, intrinsic :: iso_c_binding, only: C_PTR, C_FUNPTR, C_INT, C_CHAR, C_NULL_CHAR, C_F_PROCPOINTER, C_LOC, C_ASSOCIATED + implicit none + + !-------- + ! + ! Public interface + ! + !-------- + integer, parameter :: itt_ptr = int_ptr_kind() + public :: itt_pause + public :: itt_resume + public :: itt_thread_ignore + public :: itt_suppress_push + public :: itt_suppress_pop + public :: itt_suppress_mark_range + public :: itt_suppress_clear_range + public :: itt_sync_prepare + public :: itt_sync_cancel + public :: itt_sync_acquired + public :: itt_sync_releasing + public :: itt_fsync_prepare + public :: itt_fsync_cancel + public :: itt_fsync_acquired + public :: itt_fsync_releasing + public :: itt_sync_destroy + public :: itt_sync_create + public :: itt_sync_rename + public :: itt_thread_set_name + public :: itt_heap_record_memory_growth_begin + public :: itt_heap_record_memory_growth_end + public :: itt_heap_reset_detection + public :: itt_heap_record + + integer, parameter, public :: itt_attr_barrier = 1 + integer, parameter, public :: itt_attr_mutex = 2 + integer, parameter, public :: itt_suppress_threading_errors = 255 + integer, parameter, public :: itt_suppress_memory_errors = 65280 + integer, parameter, public :: itt_suppress_all_errors = 2147483647 + integer, parameter, public :: itt_unsuppress_range = 0 + integer, parameter, public :: itt_suppress_range = 1 + integer, parameter, public :: itt_heap_leaks = 1 + integer, parameter, public :: itt_heap_growth = 2 + + private + + abstract interface + + subroutine itt_proc_none() bind(C) + import + end subroutine itt_proc_none + + subroutine itt_proc_sup_push(mask) bind(C) + import + integer, intent(in), value :: mask + end subroutine itt_proc_sup_push + + subroutine itt_proc_sup_range(action, mask, addr, size) bind(C) + import + integer, intent(in), value :: action + integer, intent(in), value :: mask + integer(kind=itt_ptr), intent(in), value :: addr + integer(kind=itt_ptr), intent(in), value :: size + end subroutine itt_proc_sup_range + + subroutine itt_proc_address(addr) bind(C) + import + integer(kind=itt_ptr), intent(in), value :: addr + end subroutine itt_proc_address + + subroutine itt_proc_create(addr, objname, attribute) bind(C) + import + integer(kind=itt_ptr), intent(in), value :: addr + character(kind=C_CHAR), dimension(*), intent(in) :: objname + integer, intent(in), value :: attribute + end subroutine itt_proc_create + + subroutine itt_proc_name(name) bind(C) + import + character(kind=C_CHAR), dimension(*), intent(in) :: name + end subroutine itt_proc_name + + subroutine itt_proc_rename(addr, objname) bind(C) + import + integer(kind=itt_ptr), intent(in), value :: addr + character(kind=C_CHAR), dimension(*), intent(in) :: objname + end subroutine itt_proc_rename + + subroutine itt_proc_heapmask(heapmask) bind(C) + import + integer, intent(in), value :: heapmask + end subroutine itt_proc_heapmask + + end interface + + type(C_FUNPTR) :: itt_pause_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_pause_ptr__3_0' :: itt_pause_fort_ptr + type(C_FUNPTR) :: itt_resume_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_resume_ptr__3_0' :: itt_resume_fort_ptr + type(C_FUNPTR) :: itt_thread_ignore_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_thread_ignore_ptr__3_0' :: itt_thread_ignore_fort_ptr + type(C_FUNPTR) :: itt_suppress_push_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_suppress_push_ptr__3_0' :: itt_suppress_push_fort_ptr + type(C_FUNPTR) :: itt_suppress_pop_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_suppress_pop_ptr__3_0' :: itt_suppress_pop_fort_ptr + type(C_FUNPTR) :: itt_suppress_mark_range_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_suppress_mark_range_ptr__3_0' :: itt_suppress_mark_range_fort_ptr + type(C_FUNPTR) :: itt_suppress_clear_range_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_suppress_clear_range_ptr__3_0' :: itt_suppress_clear_range_fort_ptr + type(C_FUNPTR) :: itt_sync_prepare_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_prepare_ptr__3_0' :: itt_sync_prepare_fort_ptr + type(C_FUNPTR) :: itt_sync_cancel_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_cancel_ptr__3_0' :: itt_sync_cancel_fort_ptr + type(C_FUNPTR) :: itt_sync_acquired_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_acquired_ptr__3_0' :: itt_sync_acquired_fort_ptr + type(C_FUNPTR) :: itt_sync_releasing_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_releasing_ptr__3_0' :: itt_sync_releasing_fort_ptr + type(C_FUNPTR) :: itt_fsync_prepare_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_fsync_prepare_ptr__3_0' :: itt_fsync_prepare_fort_ptr + type(C_FUNPTR) :: itt_fsync_cancel_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_fsync_cancel_ptr__3_0' :: itt_fsync_cancel_fort_ptr + type(C_FUNPTR) :: itt_fsync_acquired_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_fsync_acquired_ptr__3_0' :: itt_fsync_acquired_fort_ptr + type(C_FUNPTR) :: itt_fsync_releasing_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_fsync_releasing_ptr__3_0' :: itt_fsync_releasing_fort_ptr + type(C_FUNPTR) :: itt_sync_destroy_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_destroy_ptr__3_0' :: itt_sync_destroy_fort_ptr + type(C_FUNPTR) :: itt_sync_create_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_create_ptr__3_0' :: itt_sync_create_fort_ptr + type(C_FUNPTR) :: itt_sync_rename_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_sync_rename_ptr__3_0' :: itt_sync_rename_fort_ptr + type(C_FUNPTR) :: itt_thread_set_name_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_thread_set_name_ptr__3_0' :: itt_thread_set_name_fort_ptr + type(C_FUNPTR) :: itt_heap_record_memory_growth_begin_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_heap_record_memory_growth_begin_ptr__3_0' :: itt_heap_record_memory_growth_begin_fort_ptr + type(C_FUNPTR) :: itt_heap_record_memory_growth_end_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_heap_record_memory_growth_end_ptr__3_0' :: itt_heap_record_memory_growth_end_fort_ptr + type(C_FUNPTR) :: itt_heap_reset_detection_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_heap_reset_detection_ptr__3_0' :: itt_heap_reset_detection_fort_ptr + type(C_FUNPTR) :: itt_heap_record_fort_ptr + !DEC$ ATTRIBUTES C, EXTERN, ALIAS:'__itt_heap_record_ptr__3_0' :: itt_heap_record_fort_ptr + + contains + + subroutine itt_pause() + procedure(itt_proc_none), pointer :: pause_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_pause + if (C_ASSOCIATED(itt_pause_fort_ptr)) then + call C_F_PROCPOINTER(itt_pause_fort_ptr, pause_ptr) + call pause_ptr() + end if + end subroutine itt_pause + + subroutine itt_resume() + procedure(itt_proc_none), pointer :: resume_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_resume + if (C_ASSOCIATED(itt_resume_fort_ptr)) then + call C_F_PROCPOINTER(itt_resume_fort_ptr, resume_ptr) + call resume_ptr() + end if + end subroutine itt_resume + + subroutine itt_thread_ignore() + procedure(itt_proc_none), pointer :: thread_ignore_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_thread_ignore + if (C_ASSOCIATED(itt_thread_ignore_fort_ptr)) then + call C_F_PROCPOINTER(itt_thread_ignore_fort_ptr, thread_ignore_ptr) + call thread_ignore_ptr() + end if + end subroutine itt_thread_ignore + + subroutine itt_suppress_push(mask) + procedure(itt_proc_sup_push), pointer :: suppress_push_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_suppress_push + integer, intent(in), value :: mask + if (C_ASSOCIATED(itt_suppress_push_fort_ptr)) then + call C_F_PROCPOINTER(itt_suppress_push_fort_ptr, suppress_push_ptr) + call suppress_push_ptr(mask) + end if + end subroutine itt_suppress_push + + subroutine itt_suppress_pop() + procedure(itt_proc_none), pointer :: suppress_pop_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_suppress_pop + if (C_ASSOCIATED(itt_suppress_pop_fort_ptr)) then + call C_F_PROCPOINTER(itt_suppress_pop_fort_ptr, suppress_pop_ptr) + call suppress_pop_ptr() + end if + end subroutine itt_suppress_pop + + subroutine itt_suppress_mark_range(action, mask, addr, size) + procedure(itt_proc_sup_range), pointer :: suppress_mark_range_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_suppress_mark_range + integer, intent(in), value :: action + integer, intent(in), value :: mask + integer(kind=itt_ptr), intent(in), value :: addr + integer(kind=itt_ptr), intent(in), value :: size + if (C_ASSOCIATED(itt_suppress_mark_range_fort_ptr)) then + call C_F_PROCPOINTER(itt_suppress_mark_range_fort_ptr, suppress_mark_range_ptr) + call suppress_mark_range_ptr(action, mask, addr, size) + end if + end subroutine itt_suppress_mark_range + + subroutine itt_suppress_clear_range(action, mask, addr, size) + procedure(itt_proc_sup_range), pointer :: suppress_clear_range_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_suppress_clear_range + integer, intent(in), value :: action + integer, intent(in), value :: mask + integer(kind=itt_ptr), intent(in), value :: addr + integer(kind=itt_ptr), intent(in), value :: size + if (C_ASSOCIATED(itt_suppress_clear_range_fort_ptr)) then + call C_F_PROCPOINTER(itt_suppress_clear_range_fort_ptr, suppress_clear_range_ptr) + call suppress_clear_range_ptr(action, mask, addr, size) + end if + end subroutine itt_suppress_clear_range + + subroutine itt_sync_prepare(addr) + procedure(itt_proc_address), pointer :: sync_prepare_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_prepare + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_sync_prepare_fort_ptr)) then + call C_F_PROCPOINTER(itt_sync_prepare_fort_ptr, sync_prepare_ptr) + call sync_prepare_ptr(addr) + end if + end subroutine itt_sync_prepare + + subroutine itt_sync_cancel(addr) + procedure(itt_proc_address), pointer :: sync_cancel_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_cancel + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_sync_cancel_fort_ptr)) then + call C_F_PROCPOINTER(itt_sync_cancel_fort_ptr, sync_cancel_ptr) + call sync_cancel_ptr(addr) + end if + end subroutine itt_sync_cancel + + subroutine itt_sync_acquired(addr) + procedure(itt_proc_address), pointer :: sync_acquired_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_acquired + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_sync_acquired_fort_ptr)) then + call C_F_PROCPOINTER(itt_sync_acquired_fort_ptr, sync_acquired_ptr) + call sync_acquired_ptr(addr) + end if + end subroutine itt_sync_acquired + + subroutine itt_sync_releasing(addr) + procedure(itt_proc_address), pointer :: sync_releasing_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_releasing + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_sync_releasing_fort_ptr)) then + call C_F_PROCPOINTER(itt_sync_releasing_fort_ptr, sync_releasing_ptr) + call sync_releasing_ptr(addr) + end if + end subroutine itt_sync_releasing + + subroutine itt_fsync_prepare(addr) + procedure(itt_proc_address), pointer :: fsync_prepare_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_fsync_prepare + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_fsync_prepare_fort_ptr)) then + call C_F_PROCPOINTER(itt_fsync_prepare_fort_ptr, fsync_prepare_ptr) + call fsync_prepare_ptr(addr) + end if + end subroutine itt_fsync_prepare + + subroutine itt_fsync_cancel(addr) + procedure(itt_proc_address), pointer :: fsync_cancel_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_fsync_cancel + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_fsync_cancel_fort_ptr)) then + call C_F_PROCPOINTER(itt_fsync_cancel_fort_ptr, fsync_cancel_ptr) + call fsync_cancel_ptr(addr) + end if + end subroutine itt_fsync_cancel + + subroutine itt_fsync_acquired(addr) + procedure(itt_proc_address), pointer :: fsync_acquired_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_fsync_acquired + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_fsync_acquired_fort_ptr)) then + call C_F_PROCPOINTER(itt_fsync_acquired_fort_ptr, fsync_acquired_ptr) + call fsync_acquired_ptr(addr) + end if + end subroutine itt_fsync_acquired + + subroutine itt_fsync_releasing(addr) + procedure(itt_proc_address), pointer :: fsync_releasing_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_fsync_releasing + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_fsync_releasing_fort_ptr)) then + call C_F_PROCPOINTER(itt_fsync_releasing_fort_ptr, fsync_releasing_ptr) + call fsync_releasing_ptr(addr) + end if + end subroutine itt_fsync_releasing + + subroutine itt_sync_destroy(addr) + procedure(itt_proc_address), pointer :: sync_destroy_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_destroy + integer(kind=itt_ptr), intent(in), value :: addr + if (C_ASSOCIATED(itt_sync_destroy_fort_ptr)) then + call C_F_PROCPOINTER(itt_sync_destroy_fort_ptr, sync_destroy_ptr) + call sync_destroy_ptr(addr) + end if + end subroutine itt_sync_destroy + + subroutine itt_sync_create(addr, objname, attribute) + procedure(itt_proc_create), pointer :: sync_create_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_create + integer(kind=itt_ptr), intent(in), value :: addr + character(len=*), intent(in) :: objname + integer, intent(in), value :: attribute + CHARACTER(LEN=1,KIND=C_CHAR) :: objnametmp(LEN_TRIM(objname)+1) + INTEGER :: iobjname, nobjname + if (C_ASSOCIATED(itt_sync_create_fort_ptr)) then + nobjname = LEN_TRIM(objname) + DO iobjname = 1, nobjname + objnametmp(iobjname) = objname(iobjname:iobjname) + END DO + objnametmp(nobjname + 1) = C_NULL_CHAR + call C_F_PROCPOINTER(itt_sync_create_fort_ptr, sync_create_ptr) + call sync_create_ptr(addr, objnametmp, attribute) + end if + end subroutine itt_sync_create + + subroutine itt_sync_rename(addr, objname) + procedure(itt_proc_rename), pointer :: sync_rename_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_sync_rename + integer(kind=itt_ptr), intent(in), value :: addr + character(len=*), intent(in) :: objname + CHARACTER(LEN=1,KIND=C_CHAR) :: objnametmp(LEN_TRIM(objname)+1) + INTEGER :: iobjname, nobjname + if (C_ASSOCIATED(itt_sync_rename_fort_ptr)) then + nobjname = LEN_TRIM(objname) + DO iobjname = 1, nobjname + objnametmp(iobjname) = objname(iobjname:iobjname) + END DO + objnametmp(nobjname + 1) = C_NULL_CHAR + call C_F_PROCPOINTER(itt_sync_rename_fort_ptr, sync_rename_ptr) + call sync_rename_ptr(addr, objnametmp) + end if + end subroutine itt_sync_rename + + subroutine itt_thread_set_name(name) + procedure(itt_proc_name), pointer :: thread_set_name_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_thread_set_name + character(len=*), intent(in) :: name + CHARACTER(LEN=1,KIND=C_CHAR) :: nametmp(LEN_TRIM(name)+1) + INTEGER :: iname, nname + if (C_ASSOCIATED(itt_thread_set_name_fort_ptr)) then + nname = LEN_TRIM(name) + DO iname = 1, nname + nametmp(iname) = name(iname:iname) + END DO + nametmp(nname + 1) = C_NULL_CHAR + call C_F_PROCPOINTER(itt_thread_set_name_fort_ptr, thread_set_name_ptr) + call thread_set_name_ptr(nametmp) + end if + end subroutine itt_thread_set_name + + subroutine itt_heap_record_memory_growth_begin() + procedure(itt_proc_none), pointer :: heap_record_memory_growth_begin_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_heap_record_memory_growth_begin + if (C_ASSOCIATED(itt_heap_record_memory_growth_begin_fort_ptr)) then + call C_F_PROCPOINTER(itt_heap_record_memory_growth_begin_fort_ptr, heap_record_memory_growth_begin_ptr) + call heap_record_memory_growth_begin_ptr() + end if + end subroutine itt_heap_record_memory_growth_begin + + subroutine itt_heap_record_memory_growth_end() + procedure(itt_proc_none), pointer :: heap_record_memory_growth_end_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_heap_record_memory_growth_end + if (C_ASSOCIATED(itt_heap_record_memory_growth_end_fort_ptr)) then + call C_F_PROCPOINTER(itt_heap_record_memory_growth_end_fort_ptr, heap_record_memory_growth_end_ptr) + call heap_record_memory_growth_end_ptr() + end if + end subroutine itt_heap_record_memory_growth_end + + subroutine itt_heap_reset_detection(heapmask) + procedure(itt_proc_heapmask), pointer :: heap_reset_detection_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_heap_reset_detection + integer, intent(in), value :: heapmask + if (C_ASSOCIATED(itt_heap_reset_detection_fort_ptr)) then + call C_F_PROCPOINTER(itt_heap_reset_detection_fort_ptr, heap_reset_detection_ptr) + call heap_reset_detection_ptr(heapmask) + end if + end subroutine itt_heap_reset_detection + + subroutine itt_heap_record(heapmask) + procedure(itt_proc_heapmask), pointer :: heap_record_ptr + !DEC$ ATTRIBUTES DEFAULT :: itt_heap_record + integer, intent(in), value :: heapmask + if (C_ASSOCIATED(itt_heap_record_fort_ptr)) then + call C_F_PROCPOINTER(itt_heap_record_fort_ptr, heap_record_ptr) + call heap_record_ptr(heapmask) + end if + end subroutine itt_heap_record + + + end module ittnotify + diff --git a/external/vtune/linux/include/ittnotify.h b/external/vtune/linux/include/ittnotify.h new file mode 100644 index 0000000000..1ce41c8260 --- /dev/null +++ b/external/vtune/linux/include/ittnotify.h @@ -0,0 +1,4123 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _ITTNOTIFY_H_ +#define _ITTNOTIFY_H_ + +/** +@file +@brief Public User API functions and types +@mainpage + +The ITT API is used to annotate a user's program with additional information +that can be used by correctness and performance tools. The user inserts +calls in their program. Those calls generate information that is collected +at runtime, and used by Intel(R) Threading Tools. + +@section API Concepts +The following general concepts are used throughout the API. + +@subsection Unicode Support +Many API functions take character string arguments. On Windows, there +are two versions of each such function. The function name is suffixed +by W if Unicode support is enabled, and by A otherwise. Any API function +that takes a character string argument adheres to this convention. + +@subsection Conditional Compilation +Many users prefer having an option to modify ITT API code when linking it +inside their runtimes. ITT API header file provides a mechanism to replace +ITT API function names inside your code with empty strings. To do this, +define the macros INTEL_NO_ITTNOTIFY_API during compilation and remove the +static library from the linker script. + +@subsection Domains +[see domains] +Domains provide a way to separate notification for different modules or +libraries in a program. Domains are specified by dotted character strings, +e.g. TBB.Internal.Control. + +A mechanism (to be specified) is provided to enable and disable +domains. By default, all domains are enabled. +@subsection Named Entities and Instances +Named entities (frames, regions, tasks, and markers) communicate +information about the program to the analysis tools. A named entity often +refers to a section of program code, or to some set of logical concepts +that the programmer wants to group together. + +Named entities relate to the programmer's static view of the program. When +the program actually executes, many instances of a given named entity +may be created. + +The API annotations denote instances of named entities. The actual +named entities are displayed using the analysis tools. In other words, +the named entities come into existence when instances are created. + +Instances of named entities may have instance identifiers (IDs). Some +API calls use instance identifiers to create relationships between +different instances of named entities. Other API calls associate data +with instances of named entities. + +Some named entities must always have instance IDs. In particular, regions +and frames always have IDs. Task and markers need IDs only if the ID is +needed in another API call (such as adding a relation or metadata). + +The lifetime of instance IDs is distinct from the lifetime of +instances. This allows various relationships to be specified separate +from the actual execution of instances. This flexibility comes at the +expense of extra API calls. + +The same ID may not be reused for different instances, unless a previous +[ref] __itt_id_destroy call for that ID has been issued. +*/ + +/** @cond exclude_from_documentation */ +#ifndef ITT_OS_WIN +# define ITT_OS_WIN 1 +#endif /* ITT_OS_WIN */ + +#ifndef ITT_OS_LINUX +# define ITT_OS_LINUX 2 +#endif /* ITT_OS_LINUX */ + +#ifndef ITT_OS_MAC +# define ITT_OS_MAC 3 +#endif /* ITT_OS_MAC */ + +#ifndef ITT_OS_FREEBSD +# define ITT_OS_FREEBSD 4 +#endif /* ITT_OS_FREEBSD */ + +#ifndef ITT_OS +# if defined WIN32 || defined _WIN32 +# define ITT_OS ITT_OS_WIN +# elif defined( __APPLE__ ) && defined( __MACH__ ) +# define ITT_OS ITT_OS_MAC +# elif defined( __FreeBSD__ ) +# define ITT_OS ITT_OS_FREEBSD +# else +# define ITT_OS ITT_OS_LINUX +# endif +#endif /* ITT_OS */ + +#ifndef ITT_PLATFORM_WIN +# define ITT_PLATFORM_WIN 1 +#endif /* ITT_PLATFORM_WIN */ + +#ifndef ITT_PLATFORM_POSIX +# define ITT_PLATFORM_POSIX 2 +#endif /* ITT_PLATFORM_POSIX */ + +#ifndef ITT_PLATFORM_MAC +# define ITT_PLATFORM_MAC 3 +#endif /* ITT_PLATFORM_MAC */ + +#ifndef ITT_PLATFORM_FREEBSD +# define ITT_PLATFORM_FREEBSD 4 +#endif /* ITT_PLATFORM_FREEBSD */ + +#ifndef ITT_PLATFORM +# if ITT_OS==ITT_OS_WIN +# define ITT_PLATFORM ITT_PLATFORM_WIN +# elif ITT_OS==ITT_OS_MAC +# define ITT_PLATFORM ITT_PLATFORM_MAC +# elif ITT_OS==ITT_OS_FREEBSD +# define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# else +# define ITT_PLATFORM ITT_PLATFORM_POSIX +# endif +#endif /* ITT_PLATFORM */ + +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#include +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#if defined(UNICODE) || defined(_UNICODE) +#include +#endif /* UNICODE || _UNICODE */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef CDECL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define CDECL __cdecl +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define CDECL __attribute__ ((cdecl)) +# else /* _M_IX86 || __i386__ */ +# define CDECL /* actual only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* CDECL */ + +#ifndef STDCALL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define STDCALL __stdcall +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define STDCALL __attribute__ ((stdcall)) +# else /* _M_IX86 || __i386__ */ +# define STDCALL /* supported only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* STDCALL */ + +#define ITTAPI CDECL +#define LIBITTAPI CDECL + +/* TODO: Temporary for compatibility! */ +#define ITTAPI_CALL CDECL +#define LIBITTAPI_CALL CDECL + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +/* use __forceinline (VC++ specific) */ +#define ITT_INLINE __forceinline +#define ITT_INLINE_ATTRIBUTE /* nothing */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/* + * Generally, functions are not inlined unless optimization is specified. + * For functions declared inline, this attribute inlines the function even + * if no optimization level was specified. + */ +#ifdef __STRICT_ANSI__ +#define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) +#else /* __STRICT_ANSI__ */ +#define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) +#endif /* __STRICT_ANSI__ */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/** @endcond */ + +#ifdef INTEL_ITTNOTIFY_ENABLE_LEGACY +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# pragma message("WARNING!!! Deprecated API is used. Please undefine INTEL_ITTNOTIFY_ENABLE_LEGACY macro") +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# warning "Deprecated API is used. Please undefine INTEL_ITTNOTIFY_ENABLE_LEGACY macro" +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# include "legacy/ittnotify.h" +#endif /* INTEL_ITTNOTIFY_ENABLE_LEGACY */ + +/** @cond exclude_from_documentation */ +/* Helper macro for joining tokens */ +#define ITT_JOIN_AUX(p,n) p##n +#define ITT_JOIN(p,n) ITT_JOIN_AUX(p,n) + +#ifdef ITT_MAJOR +#undef ITT_MAJOR +#endif +#ifdef ITT_MINOR +#undef ITT_MINOR +#endif +#define ITT_MAJOR 3 +#define ITT_MINOR 0 + +/* Standard versioning of a token with major and minor version numbers */ +#define ITT_VERSIONIZE(x) \ + ITT_JOIN(x, \ + ITT_JOIN(_, \ + ITT_JOIN(ITT_MAJOR, \ + ITT_JOIN(_, ITT_MINOR)))) + +#ifndef INTEL_ITTNOTIFY_PREFIX +# define INTEL_ITTNOTIFY_PREFIX __itt_ +#endif /* INTEL_ITTNOTIFY_PREFIX */ +#ifndef INTEL_ITTNOTIFY_POSTFIX +# define INTEL_ITTNOTIFY_POSTFIX _ptr_ +#endif /* INTEL_ITTNOTIFY_POSTFIX */ + +#define ITTNOTIFY_NAME_AUX(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n) +#define ITTNOTIFY_NAME(n) ITT_VERSIONIZE(ITTNOTIFY_NAME_AUX(ITT_JOIN(n,INTEL_ITTNOTIFY_POSTFIX))) + +#define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) +#define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) + +#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) + +#ifdef ITT_STUB +#undef ITT_STUB +#endif +#ifdef ITT_STUBV +#undef ITT_STUBV +#endif +#define ITT_STUBV(api,type,name,args) \ + typedef type (api* ITT_JOIN(ITTNOTIFY_NAME(name),_t)) args; \ + extern ITT_JOIN(ITTNOTIFY_NAME(name),_t) ITTNOTIFY_NAME(name); +#define ITT_STUB ITT_STUBV +/** @endcond */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** @cond exclude_from_gpa_documentation */ +/** + * @defgroup public Public API + * @{ + * @} + */ + +/** + * @defgroup control Collection Control + * @ingroup public + * General behavior: application continues to run, but no profiling information is being collected + * + * Pausing occurs not only for the current thread but for all process as well as spawned processes + * - Intel(R) Parallel Inspector and Intel(R) Inspector XE: + * - Does not analyze or report errors that involve memory access. + * - Other errors are reported as usual. Pausing data collection in + * Intel(R) Parallel Inspector and Intel(R) Inspector XE + * only pauses tracing and analyzing memory access. + * It does not pause tracing or analyzing threading APIs. + * . + * - Intel(R) Parallel Amplifier and Intel(R) VTune(TM) Amplifier XE: + * - Does continue to record when new threads are started. + * . + * - Other effects: + * - Possible reduction of runtime overhead. + * . + * @{ + */ +/** @brief Pause collection */ +void ITTAPI __itt_pause(void); +/** @brief Resume collection */ +void ITTAPI __itt_resume(void); +/** @brief Detach collection */ +void ITTAPI __itt_detach(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, pause, (void)) +ITT_STUBV(ITTAPI, void, resume, (void)) +ITT_STUBV(ITTAPI, void, detach, (void)) +#define __itt_pause ITTNOTIFY_VOID(pause) +#define __itt_pause_ptr ITTNOTIFY_NAME(pause) +#define __itt_resume ITTNOTIFY_VOID(resume) +#define __itt_resume_ptr ITTNOTIFY_NAME(resume) +#define __itt_detach ITTNOTIFY_VOID(detach) +#define __itt_detach_ptr ITTNOTIFY_NAME(detach) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_pause() +#define __itt_pause_ptr 0 +#define __itt_resume() +#define __itt_resume_ptr 0 +#define __itt_detach() +#define __itt_detach_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_pause_ptr 0 +#define __itt_resume_ptr 0 +#define __itt_detach_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} control group */ +/** @endcond */ + +/** + * @defgroup threads Threads + * @ingroup public + * Give names to threads + * @{ + */ +/** + * @brief Sets thread name of calling thread + * @param[in] name - name of thread + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_thread_set_nameA(const char *name); +void ITTAPI __itt_thread_set_nameW(const wchar_t *name); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_thread_set_name __itt_thread_set_nameW +# define __itt_thread_set_name_ptr __itt_thread_set_nameW_ptr +#else /* UNICODE */ +# define __itt_thread_set_name __itt_thread_set_nameA +# define __itt_thread_set_name_ptr __itt_thread_set_nameA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_thread_set_name(const char *name); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, thread_set_nameA, (const char *name)) +ITT_STUBV(ITTAPI, void, thread_set_nameW, (const wchar_t *name)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, thread_set_name, (const char *name)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_thread_set_nameA ITTNOTIFY_VOID(thread_set_nameA) +#define __itt_thread_set_nameA_ptr ITTNOTIFY_NAME(thread_set_nameA) +#define __itt_thread_set_nameW ITTNOTIFY_VOID(thread_set_nameW) +#define __itt_thread_set_nameW_ptr ITTNOTIFY_NAME(thread_set_nameW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_thread_set_name ITTNOTIFY_VOID(thread_set_name) +#define __itt_thread_set_name_ptr ITTNOTIFY_NAME(thread_set_name) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_thread_set_nameA(name) +#define __itt_thread_set_nameA_ptr 0 +#define __itt_thread_set_nameW(name) +#define __itt_thread_set_nameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_thread_set_name(name) +#define __itt_thread_set_name_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_thread_set_nameA_ptr 0 +#define __itt_thread_set_nameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_thread_set_name_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @cond exclude_from_gpa_documentation */ + +/** + * @brief Mark current thread as ignored from this point on, for the duration of its existence. + */ +void ITTAPI __itt_thread_ignore(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, thread_ignore, (void)) +#define __itt_thread_ignore ITTNOTIFY_VOID(thread_ignore) +#define __itt_thread_ignore_ptr ITTNOTIFY_NAME(thread_ignore) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_thread_ignore() +#define __itt_thread_ignore_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_thread_ignore_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} threads group */ + +/** + * @defgroup suppress Error suppression + * @ingroup public + * General behavior: application continues to run, but errors are suppressed + * + * @{ + */ + +/*****************************************************************//** + * @name group of functions used for error suppression in correctness tools + *********************************************************************/ +/** @{ */ +/** + * @hideinitializer + * @brief possible value for suppression mask + */ +#define __itt_suppress_all_errors 0x7fffffff + +/** + * @hideinitializer + * @brief possible value for suppression mask (suppresses errors from threading analysis) + */ +#define __itt_suppress_threading_errors 0x000000ff + +/** + * @hideinitializer + * @brief possible value for suppression mask (suppresses errors from memory analysis) + */ +#define __itt_suppress_memory_errors 0x0000ff00 + +/** + * @brief Start suppressing errors identified in mask on this thread + */ +void ITTAPI __itt_suppress_push(unsigned int mask); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, suppress_push, (unsigned int mask)) +#define __itt_suppress_push ITTNOTIFY_VOID(suppress_push) +#define __itt_suppress_push_ptr ITTNOTIFY_NAME(suppress_push) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_suppress_push(mask) +#define __itt_suppress_push_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_suppress_push_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Undo the effects of the matching call to __itt_suppress_push + */ +void ITTAPI __itt_suppress_pop(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, suppress_pop, (void)) +#define __itt_suppress_pop ITTNOTIFY_VOID(suppress_pop) +#define __itt_suppress_pop_ptr ITTNOTIFY_NAME(suppress_pop) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_suppress_pop() +#define __itt_suppress_pop_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_suppress_pop_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @enum __itt_model_disable + * @brief Enumerator for the disable methods + */ +typedef enum __itt_suppress_mode { + __itt_unsuppress_range, + __itt_suppress_range +} __itt_suppress_mode_t; + +/** + * @brief Mark a range of memory for error suppression or unsuppression for error types included in mask + */ +void ITTAPI __itt_suppress_mark_range(__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, suppress_mark_range, (__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size)) +#define __itt_suppress_mark_range ITTNOTIFY_VOID(suppress_mark_range) +#define __itt_suppress_mark_range_ptr ITTNOTIFY_NAME(suppress_mark_range) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_suppress_mark_range(mask) +#define __itt_suppress_mark_range_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_suppress_mark_range_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Undo the effect of a matching call to __itt_suppress_mark_range. If not matching + * call is found, nothing is changed. + */ +void ITTAPI __itt_suppress_clear_range(__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, suppress_clear_range, (__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size)) +#define __itt_suppress_clear_range ITTNOTIFY_VOID(suppress_clear_range) +#define __itt_suppress_clear_range_ptr ITTNOTIFY_NAME(suppress_clear_range) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_suppress_clear_range(mask) +#define __itt_suppress_clear_range_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_suppress_clear_range_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} */ +/** @} suppress group */ + +/** + * @defgroup sync Synchronization + * @ingroup public + * Indicate user-written synchronization code + * @{ + */ +/** + * @hideinitializer + * @brief possible value of attribute argument for sync object type + */ +#define __itt_attr_barrier 1 + +/** + * @hideinitializer + * @brief possible value of attribute argument for sync object type + */ +#define __itt_attr_mutex 2 + +/** +@brief Name a synchronization object +@param[in] addr Handle for the synchronization object. You should +use a real address to uniquely identify the synchronization object. +@param[in] objtype null-terminated object type string. If NULL is +passed, the name will be "User Synchronization". +@param[in] objname null-terminated object name string. If NULL, +no name will be assigned to the object. +@param[in] attribute one of [#__itt_attr_barrier, #__itt_attr_mutex] + */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_sync_createA(void *addr, const char *objtype, const char *objname, int attribute); +void ITTAPI __itt_sync_createW(void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_sync_create __itt_sync_createW +# define __itt_sync_create_ptr __itt_sync_createW_ptr +#else /* UNICODE */ +# define __itt_sync_create __itt_sync_createA +# define __itt_sync_create_ptr __itt_sync_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_sync_create (void *addr, const char *objtype, const char *objname, int attribute); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, sync_createA, (void *addr, const char *objtype, const char *objname, int attribute)) +ITT_STUBV(ITTAPI, void, sync_createW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, sync_create, (void *addr, const char* objtype, const char* objname, int attribute)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_createA ITTNOTIFY_VOID(sync_createA) +#define __itt_sync_createA_ptr ITTNOTIFY_NAME(sync_createA) +#define __itt_sync_createW ITTNOTIFY_VOID(sync_createW) +#define __itt_sync_createW_ptr ITTNOTIFY_NAME(sync_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_create ITTNOTIFY_VOID(sync_create) +#define __itt_sync_create_ptr ITTNOTIFY_NAME(sync_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_createA(addr, objtype, objname, attribute) +#define __itt_sync_createA_ptr 0 +#define __itt_sync_createW(addr, objtype, objname, attribute) +#define __itt_sync_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_create(addr, objtype, objname, attribute) +#define __itt_sync_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_createA_ptr 0 +#define __itt_sync_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** +@brief Rename a synchronization object + +You can use the rename call to assign or reassign a name to a given +synchronization object. +@param[in] addr handle for the synchronization object. +@param[in] name null-terminated object name string. +*/ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_sync_renameA(void *addr, const char *name); +void ITTAPI __itt_sync_renameW(void *addr, const wchar_t *name); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_sync_rename __itt_sync_renameW +# define __itt_sync_rename_ptr __itt_sync_renameW_ptr +#else /* UNICODE */ +# define __itt_sync_rename __itt_sync_renameA +# define __itt_sync_rename_ptr __itt_sync_renameA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_sync_rename(void *addr, const char *name); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, sync_renameA, (void *addr, const char *name)) +ITT_STUBV(ITTAPI, void, sync_renameW, (void *addr, const wchar_t *name)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, sync_rename, (void *addr, const char *name)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_renameA ITTNOTIFY_VOID(sync_renameA) +#define __itt_sync_renameA_ptr ITTNOTIFY_NAME(sync_renameA) +#define __itt_sync_renameW ITTNOTIFY_VOID(sync_renameW) +#define __itt_sync_renameW_ptr ITTNOTIFY_NAME(sync_renameW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_rename ITTNOTIFY_VOID(sync_rename) +#define __itt_sync_rename_ptr ITTNOTIFY_NAME(sync_rename) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_renameA(addr, name) +#define __itt_sync_renameA_ptr 0 +#define __itt_sync_renameW(addr, name) +#define __itt_sync_renameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_rename(addr, name) +#define __itt_sync_rename_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_renameA_ptr 0 +#define __itt_sync_renameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_rename_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + @brief Destroy a synchronization object. + @param addr Handle for the synchronization object. + */ +void ITTAPI __itt_sync_destroy(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, sync_destroy, (void *addr)) +#define __itt_sync_destroy ITTNOTIFY_VOID(sync_destroy) +#define __itt_sync_destroy_ptr ITTNOTIFY_NAME(sync_destroy) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_sync_destroy(addr) +#define __itt_sync_destroy_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_sync_destroy_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/*****************************************************************//** + * @name group of functions is used for performance measurement tools + *********************************************************************/ +/** @{ */ +/** + * @brief Enter spin loop on user-defined sync object + */ +void ITTAPI __itt_sync_prepare(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, sync_prepare, (void *addr)) +#define __itt_sync_prepare ITTNOTIFY_VOID(sync_prepare) +#define __itt_sync_prepare_ptr ITTNOTIFY_NAME(sync_prepare) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_sync_prepare(addr) +#define __itt_sync_prepare_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_sync_prepare_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Quit spin loop without acquiring spin object + */ +void ITTAPI __itt_sync_cancel(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, sync_cancel, (void *addr)) +#define __itt_sync_cancel ITTNOTIFY_VOID(sync_cancel) +#define __itt_sync_cancel_ptr ITTNOTIFY_NAME(sync_cancel) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_sync_cancel(addr) +#define __itt_sync_cancel_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_sync_cancel_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Successful spin loop completion (sync object acquired) + */ +void ITTAPI __itt_sync_acquired(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, sync_acquired, (void *addr)) +#define __itt_sync_acquired ITTNOTIFY_VOID(sync_acquired) +#define __itt_sync_acquired_ptr ITTNOTIFY_NAME(sync_acquired) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_sync_acquired(addr) +#define __itt_sync_acquired_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_sync_acquired_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Start sync object releasing code. Is called before the lock release call. + */ +void ITTAPI __itt_sync_releasing(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, sync_releasing, (void *addr)) +#define __itt_sync_releasing ITTNOTIFY_VOID(sync_releasing) +#define __itt_sync_releasing_ptr ITTNOTIFY_NAME(sync_releasing) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_sync_releasing(addr) +#define __itt_sync_releasing_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_sync_releasing_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} */ + +/** @} sync group */ + +/**************************************************************//** + * @name group of functions is used for correctness checking tools + ******************************************************************/ +/** @{ */ +/** + * @ingroup legacy + * @deprecated Legacy API + * @brief Fast synchronization which does no require spinning. + * - This special function is to be used by TBB and OpenMP libraries only when they know + * there is no spin but they need to suppress TC warnings about shared variable modifications. + * - It only has corresponding pointers in static library and does not have corresponding function + * in dynamic library. + * @see void __itt_sync_prepare(void* addr); + */ +void ITTAPI __itt_fsync_prepare(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, fsync_prepare, (void *addr)) +#define __itt_fsync_prepare ITTNOTIFY_VOID(fsync_prepare) +#define __itt_fsync_prepare_ptr ITTNOTIFY_NAME(fsync_prepare) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_fsync_prepare(addr) +#define __itt_fsync_prepare_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_fsync_prepare_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup legacy + * @deprecated Legacy API + * @brief Fast synchronization which does no require spinning. + * - This special function is to be used by TBB and OpenMP libraries only when they know + * there is no spin but they need to suppress TC warnings about shared variable modifications. + * - It only has corresponding pointers in static library and does not have corresponding function + * in dynamic library. + * @see void __itt_sync_cancel(void *addr); + */ +void ITTAPI __itt_fsync_cancel(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, fsync_cancel, (void *addr)) +#define __itt_fsync_cancel ITTNOTIFY_VOID(fsync_cancel) +#define __itt_fsync_cancel_ptr ITTNOTIFY_NAME(fsync_cancel) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_fsync_cancel(addr) +#define __itt_fsync_cancel_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_fsync_cancel_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup legacy + * @deprecated Legacy API + * @brief Fast synchronization which does no require spinning. + * - This special function is to be used by TBB and OpenMP libraries only when they know + * there is no spin but they need to suppress TC warnings about shared variable modifications. + * - It only has corresponding pointers in static library and does not have corresponding function + * in dynamic library. + * @see void __itt_sync_acquired(void *addr); + */ +void ITTAPI __itt_fsync_acquired(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, fsync_acquired, (void *addr)) +#define __itt_fsync_acquired ITTNOTIFY_VOID(fsync_acquired) +#define __itt_fsync_acquired_ptr ITTNOTIFY_NAME(fsync_acquired) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_fsync_acquired(addr) +#define __itt_fsync_acquired_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_fsync_acquired_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup legacy + * @deprecated Legacy API + * @brief Fast synchronization which does no require spinning. + * - This special function is to be used by TBB and OpenMP libraries only when they know + * there is no spin but they need to suppress TC warnings about shared variable modifications. + * - It only has corresponding pointers in static library and does not have corresponding function + * in dynamic library. + * @see void __itt_sync_releasing(void* addr); + */ +void ITTAPI __itt_fsync_releasing(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, fsync_releasing, (void *addr)) +#define __itt_fsync_releasing ITTNOTIFY_VOID(fsync_releasing) +#define __itt_fsync_releasing_ptr ITTNOTIFY_NAME(fsync_releasing) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_fsync_releasing(addr) +#define __itt_fsync_releasing_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_fsync_releasing_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} */ + +/** + * @defgroup model Modeling by Intel(R) Parallel Advisor + * @ingroup public + * This is the subset of itt used for modeling by Intel(R) Parallel Advisor. + * This API is called ONLY using annotate.h, by "Annotation" macros + * the user places in their sources during the parallelism modeling steps. + * + * site_begin/end and task_begin/end take the address of handle variables, + * which are writeable by the API. Handles must be 0 initialized prior + * to the first call to begin, or may cause a run-time failure. + * The handles are initialized in a multi-thread safe way by the API if + * the handle is 0. The commonly expected idiom is one static handle to + * identify a site or task. If a site or task of the same name has already + * been started during this collection, the same handle MAY be returned, + * but is not required to be - it is unspecified if data merging is done + * based on name. These routines also take an instance variable. Like + * the lexical instance, these must be 0 initialized. Unlike the lexical + * instance, this is used to track a single dynamic instance. + * + * API used by the Intel(R) Parallel Advisor to describe potential concurrency + * and related activities. User-added source annotations expand to calls + * to these procedures to enable modeling of a hypothetical concurrent + * execution serially. + * @{ + */ +#if !defined(_ADVISOR_ANNOTATE_H_) || defined(ANNOTATE_EXPAND_NULL) + +typedef void* __itt_model_site; /*!< @brief handle for lexical site */ +typedef void* __itt_model_site_instance; /*!< @brief handle for dynamic instance */ +typedef void* __itt_model_task; /*!< @brief handle for lexical site */ +typedef void* __itt_model_task_instance; /*!< @brief handle for dynamic instance */ + +/** + * @enum __itt_model_disable + * @brief Enumerator for the disable methods + */ +typedef enum { + __itt_model_disable_observation, + __itt_model_disable_collection +} __itt_model_disable; + +#endif /* !_ADVISOR_ANNOTATE_H_ || ANNOTATE_EXPAND_NULL */ + +/** + * @brief ANNOTATE_SITE_BEGIN/ANNOTATE_SITE_END support. + * + * site_begin/end model a potential concurrency site. + * site instances may be recursively nested with themselves. + * site_end exits the most recently started but unended site for the current + * thread. The handle passed to end may be used to validate structure. + * Instances of a site encountered on different threads concurrently + * are considered completely distinct. If the site name for two different + * lexical sites match, it is unspecified whether they are treated as the + * same or different for data presentation. + */ +void ITTAPI __itt_model_site_begin(__itt_model_site *site, __itt_model_site_instance *instance, const char *name); +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_model_site_beginW(const wchar_t *name); +#endif +void ITTAPI __itt_model_site_beginA(const char *name); +void ITTAPI __itt_model_site_beginAL(const char *name, size_t siteNameLen); +void ITTAPI __itt_model_site_end (__itt_model_site *site, __itt_model_site_instance *instance); +void ITTAPI __itt_model_site_end_2(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_site_begin, (__itt_model_site *site, __itt_model_site_instance *instance, const char *name)) +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, model_site_beginW, (const wchar_t *name)) +#endif +ITT_STUBV(ITTAPI, void, model_site_beginA, (const char *name)) +ITT_STUBV(ITTAPI, void, model_site_beginAL, (const char *name, size_t siteNameLen)) +ITT_STUBV(ITTAPI, void, model_site_end, (__itt_model_site *site, __itt_model_site_instance *instance)) +ITT_STUBV(ITTAPI, void, model_site_end_2, (void)) +#define __itt_model_site_begin ITTNOTIFY_VOID(model_site_begin) +#define __itt_model_site_begin_ptr ITTNOTIFY_NAME(model_site_begin) +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_model_site_beginW ITTNOTIFY_VOID(model_site_beginW) +#define __itt_model_site_beginW_ptr ITTNOTIFY_NAME(model_site_beginW) +#endif +#define __itt_model_site_beginA ITTNOTIFY_VOID(model_site_beginA) +#define __itt_model_site_beginA_ptr ITTNOTIFY_NAME(model_site_beginA) +#define __itt_model_site_beginAL ITTNOTIFY_VOID(model_site_beginAL) +#define __itt_model_site_beginAL_ptr ITTNOTIFY_NAME(model_site_beginAL) +#define __itt_model_site_end ITTNOTIFY_VOID(model_site_end) +#define __itt_model_site_end_ptr ITTNOTIFY_NAME(model_site_end) +#define __itt_model_site_end_2 ITTNOTIFY_VOID(model_site_end_2) +#define __itt_model_site_end_2_ptr ITTNOTIFY_NAME(model_site_end_2) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_site_begin(site, instance, name) +#define __itt_model_site_begin_ptr 0 +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_model_site_beginW(name) +#define __itt_model_site_beginW_ptr 0 +#endif +#define __itt_model_site_beginA(name) +#define __itt_model_site_beginA_ptr 0 +#define __itt_model_site_beginAL(name, siteNameLen) +#define __itt_model_site_beginAL_ptr 0 +#define __itt_model_site_end(site, instance) +#define __itt_model_site_end_ptr 0 +#define __itt_model_site_end_2() +#define __itt_model_site_end_2_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_site_begin_ptr 0 +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_model_site_beginW_ptr 0 +#endif +#define __itt_model_site_beginA_ptr 0 +#define __itt_model_site_beginAL_ptr 0 +#define __itt_model_site_end_ptr 0 +#define __itt_model_site_end_2_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_TASK_BEGIN/ANNOTATE_TASK_END support + * + * task_begin/end model a potential task, which is contained within the most + * closely enclosing dynamic site. task_end exits the most recently started + * but unended task. The handle passed to end may be used to validate + * structure. It is unspecified if bad dynamic nesting is detected. If it + * is, it should be encoded in the resulting data collection. The collector + * should not fail due to construct nesting issues, nor attempt to directly + * indicate the problem. + */ +void ITTAPI __itt_model_task_begin(__itt_model_task *task, __itt_model_task_instance *instance, const char *name); +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_model_task_beginW(const wchar_t *name); +void ITTAPI __itt_model_iteration_taskW(const wchar_t *name); +#endif +void ITTAPI __itt_model_task_beginA(const char *name); +void ITTAPI __itt_model_task_beginAL(const char *name, size_t taskNameLen); +void ITTAPI __itt_model_iteration_taskA(const char *name); +void ITTAPI __itt_model_iteration_taskAL(const char *name, size_t taskNameLen); +void ITTAPI __itt_model_task_end (__itt_model_task *task, __itt_model_task_instance *instance); +void ITTAPI __itt_model_task_end_2(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_task_begin, (__itt_model_task *task, __itt_model_task_instance *instance, const char *name)) +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, model_task_beginW, (const wchar_t *name)) +ITT_STUBV(ITTAPI, void, model_iteration_taskW, (const wchar_t *name)) +#endif +ITT_STUBV(ITTAPI, void, model_task_beginA, (const char *name)) +ITT_STUBV(ITTAPI, void, model_task_beginAL, (const char *name, size_t taskNameLen)) +ITT_STUBV(ITTAPI, void, model_iteration_taskA, (const char *name)) +ITT_STUBV(ITTAPI, void, model_iteration_taskAL, (const char *name, size_t taskNameLen)) +ITT_STUBV(ITTAPI, void, model_task_end, (__itt_model_task *task, __itt_model_task_instance *instance)) +ITT_STUBV(ITTAPI, void, model_task_end_2, (void)) +#define __itt_model_task_begin ITTNOTIFY_VOID(model_task_begin) +#define __itt_model_task_begin_ptr ITTNOTIFY_NAME(model_task_begin) +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_model_task_beginW ITTNOTIFY_VOID(model_task_beginW) +#define __itt_model_task_beginW_ptr ITTNOTIFY_NAME(model_task_beginW) +#define __itt_model_iteration_taskW ITTNOTIFY_VOID(model_iteration_taskW) +#define __itt_model_iteration_taskW_ptr ITTNOTIFY_NAME(model_iteration_taskW) +#endif +#define __itt_model_task_beginA ITTNOTIFY_VOID(model_task_beginA) +#define __itt_model_task_beginA_ptr ITTNOTIFY_NAME(model_task_beginA) +#define __itt_model_task_beginAL ITTNOTIFY_VOID(model_task_beginAL) +#define __itt_model_task_beginAL_ptr ITTNOTIFY_NAME(model_task_beginAL) +#define __itt_model_iteration_taskA ITTNOTIFY_VOID(model_iteration_taskA) +#define __itt_model_iteration_taskA_ptr ITTNOTIFY_NAME(model_iteration_taskA) +#define __itt_model_iteration_taskAL ITTNOTIFY_VOID(model_iteration_taskAL) +#define __itt_model_iteration_taskAL_ptr ITTNOTIFY_NAME(model_iteration_taskAL) +#define __itt_model_task_end ITTNOTIFY_VOID(model_task_end) +#define __itt_model_task_end_ptr ITTNOTIFY_NAME(model_task_end) +#define __itt_model_task_end_2 ITTNOTIFY_VOID(model_task_end_2) +#define __itt_model_task_end_2_ptr ITTNOTIFY_NAME(model_task_end_2) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_task_begin(task, instance, name) +#define __itt_model_task_begin_ptr 0 +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_model_task_beginW(name) +#define __itt_model_task_beginW_ptr 0 +#endif +#define __itt_model_task_beginA(name) +#define __itt_model_task_beginA_ptr 0 +#define __itt_model_task_beginAL(name, siteNameLen) +#define __itt_model_task_beginAL_ptr 0 +#define __itt_model_iteration_taskA(name) +#define __itt_model_iteration_taskA_ptr 0 +#define __itt_model_iteration_taskAL(name, siteNameLen) +#define __itt_model_iteration_taskAL_ptr 0 +#define __itt_model_task_end(task, instance) +#define __itt_model_task_end_ptr 0 +#define __itt_model_task_end_2() +#define __itt_model_task_end_2_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_task_begin_ptr 0 +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_model_task_beginW_ptr 0 +#endif +#define __itt_model_task_beginA_ptr 0 +#define __itt_model_task_beginAL_ptr 0 +#define __itt_model_iteration_taskA_ptr 0 +#define __itt_model_iteration_taskAL_ptr 0 +#define __itt_model_task_end_ptr 0 +#define __itt_model_task_end_2_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_LOCK_ACQUIRE/ANNOTATE_LOCK_RELEASE support + * + * lock_acquire/release model a potential lock for both lockset and + * performance modeling. Each unique address is modeled as a separate + * lock, with invalid addresses being valid lock IDs. Specifically: + * no storage is accessed by the API at the specified address - it is only + * used for lock identification. Lock acquires may be self-nested and are + * unlocked by a corresponding number of releases. + * (These closely correspond to __itt_sync_acquired/__itt_sync_releasing, + * but may not have identical semantics.) + */ +void ITTAPI __itt_model_lock_acquire(void *lock); +void ITTAPI __itt_model_lock_acquire_2(void *lock); +void ITTAPI __itt_model_lock_release(void *lock); +void ITTAPI __itt_model_lock_release_2(void *lock); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_lock_acquire, (void *lock)) +ITT_STUBV(ITTAPI, void, model_lock_acquire_2, (void *lock)) +ITT_STUBV(ITTAPI, void, model_lock_release, (void *lock)) +ITT_STUBV(ITTAPI, void, model_lock_release_2, (void *lock)) +#define __itt_model_lock_acquire ITTNOTIFY_VOID(model_lock_acquire) +#define __itt_model_lock_acquire_ptr ITTNOTIFY_NAME(model_lock_acquire) +#define __itt_model_lock_acquire_2 ITTNOTIFY_VOID(model_lock_acquire_2) +#define __itt_model_lock_acquire_2_ptr ITTNOTIFY_NAME(model_lock_acquire_2) +#define __itt_model_lock_release ITTNOTIFY_VOID(model_lock_release) +#define __itt_model_lock_release_ptr ITTNOTIFY_NAME(model_lock_release) +#define __itt_model_lock_release_2 ITTNOTIFY_VOID(model_lock_release_2) +#define __itt_model_lock_release_2_ptr ITTNOTIFY_NAME(model_lock_release_2) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_lock_acquire(lock) +#define __itt_model_lock_acquire_ptr 0 +#define __itt_model_lock_acquire_2(lock) +#define __itt_model_lock_acquire_2_ptr 0 +#define __itt_model_lock_release(lock) +#define __itt_model_lock_release_ptr 0 +#define __itt_model_lock_release_2(lock) +#define __itt_model_lock_release_2_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_lock_acquire_ptr 0 +#define __itt_model_lock_acquire_2_ptr 0 +#define __itt_model_lock_release_ptr 0 +#define __itt_model_lock_release_2_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_RECORD_ALLOCATION/ANNOTATE_RECORD_DEALLOCATION support + * + * record_allocation/deallocation describe user-defined memory allocator + * behavior, which may be required for correctness modeling to understand + * when storage is not expected to be actually reused across threads. + */ +void ITTAPI __itt_model_record_allocation (void *addr, size_t size); +void ITTAPI __itt_model_record_deallocation(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_record_allocation, (void *addr, size_t size)) +ITT_STUBV(ITTAPI, void, model_record_deallocation, (void *addr)) +#define __itt_model_record_allocation ITTNOTIFY_VOID(model_record_allocation) +#define __itt_model_record_allocation_ptr ITTNOTIFY_NAME(model_record_allocation) +#define __itt_model_record_deallocation ITTNOTIFY_VOID(model_record_deallocation) +#define __itt_model_record_deallocation_ptr ITTNOTIFY_NAME(model_record_deallocation) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_record_allocation(addr, size) +#define __itt_model_record_allocation_ptr 0 +#define __itt_model_record_deallocation(addr) +#define __itt_model_record_deallocation_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_record_allocation_ptr 0 +#define __itt_model_record_deallocation_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_INDUCTION_USES support + * + * Note particular storage is inductive through the end of the current site + */ +void ITTAPI __itt_model_induction_uses(void* addr, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_induction_uses, (void *addr, size_t size)) +#define __itt_model_induction_uses ITTNOTIFY_VOID(model_induction_uses) +#define __itt_model_induction_uses_ptr ITTNOTIFY_NAME(model_induction_uses) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_induction_uses(addr, size) +#define __itt_model_induction_uses_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_induction_uses_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_REDUCTION_USES support + * + * Note particular storage is used for reduction through the end + * of the current site + */ +void ITTAPI __itt_model_reduction_uses(void* addr, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_reduction_uses, (void *addr, size_t size)) +#define __itt_model_reduction_uses ITTNOTIFY_VOID(model_reduction_uses) +#define __itt_model_reduction_uses_ptr ITTNOTIFY_NAME(model_reduction_uses) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_reduction_uses(addr, size) +#define __itt_model_reduction_uses_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_reduction_uses_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_OBSERVE_USES support + * + * Have correctness modeling record observations about uses of storage + * through the end of the current site + */ +void ITTAPI __itt_model_observe_uses(void* addr, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_observe_uses, (void *addr, size_t size)) +#define __itt_model_observe_uses ITTNOTIFY_VOID(model_observe_uses) +#define __itt_model_observe_uses_ptr ITTNOTIFY_NAME(model_observe_uses) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_observe_uses(addr, size) +#define __itt_model_observe_uses_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_observe_uses_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_CLEAR_USES support + * + * Clear the special handling of a piece of storage related to induction, + * reduction or observe_uses + */ +void ITTAPI __itt_model_clear_uses(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_clear_uses, (void *addr)) +#define __itt_model_clear_uses ITTNOTIFY_VOID(model_clear_uses) +#define __itt_model_clear_uses_ptr ITTNOTIFY_NAME(model_clear_uses) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_clear_uses(addr) +#define __itt_model_clear_uses_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_clear_uses_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief ANNOTATE_DISABLE_*_PUSH/ANNOTATE_DISABLE_*_POP support + * + * disable_push/disable_pop push and pop disabling based on a parameter. + * Disabling observations stops processing of memory references during + * correctness modeling, and all annotations that occur in the disabled + * region. This allows description of code that is expected to be handled + * specially during conversion to parallelism or that is not recognized + * by tools (e.g. some kinds of synchronization operations.) + * This mechanism causes all annotations in the disabled region, other + * than disable_push and disable_pop, to be ignored. (For example, this + * might validly be used to disable an entire parallel site and the contained + * tasks and locking in it for data collection purposes.) + * The disable for collection is a more expensive operation, but reduces + * collector overhead significantly. This applies to BOTH correctness data + * collection and performance data collection. For example, a site + * containing a task might only enable data collection for the first 10 + * iterations. Both performance and correctness data should reflect this, + * and the program should run as close to full speed as possible when + * collection is disabled. + */ +void ITTAPI __itt_model_disable_push(__itt_model_disable x); +void ITTAPI __itt_model_disable_pop(void); +void ITTAPI __itt_model_aggregate_task(size_t x); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, model_disable_push, (__itt_model_disable x)) +ITT_STUBV(ITTAPI, void, model_disable_pop, (void)) +ITT_STUBV(ITTAPI, void, model_aggregate_task, (size_t x)) +#define __itt_model_disable_push ITTNOTIFY_VOID(model_disable_push) +#define __itt_model_disable_push_ptr ITTNOTIFY_NAME(model_disable_push) +#define __itt_model_disable_pop ITTNOTIFY_VOID(model_disable_pop) +#define __itt_model_disable_pop_ptr ITTNOTIFY_NAME(model_disable_pop) +#define __itt_model_aggregate_task ITTNOTIFY_VOID(model_aggregate_task) +#define __itt_model_aggregate_task_ptr ITTNOTIFY_NAME(model_aggregate_task) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_model_disable_push(x) +#define __itt_model_disable_push_ptr 0 +#define __itt_model_disable_pop() +#define __itt_model_disable_pop_ptr 0 +#define __itt_model_aggregate_task(x) +#define __itt_model_aggregate_task_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_model_disable_push_ptr 0 +#define __itt_model_disable_pop_ptr 0 +#define __itt_model_aggregate_task_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} model group */ + +/** + * @defgroup heap Heap + * @ingroup public + * Heap group + * @{ + */ + +typedef void* __itt_heap_function; + +/** + * @brief Create an identification for heap function + * @return non-zero identifier or NULL + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_heap_function ITTAPI __itt_heap_function_createA(const char* name, const char* domain); +__itt_heap_function ITTAPI __itt_heap_function_createW(const wchar_t* name, const wchar_t* domain); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_heap_function_create __itt_heap_function_createW +# define __itt_heap_function_create_ptr __itt_heap_function_createW_ptr +#else +# define __itt_heap_function_create __itt_heap_function_createA +# define __itt_heap_function_create_ptr __itt_heap_function_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_heap_function ITTAPI __itt_heap_function_create(const char* name, const char* domain); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_heap_function, heap_function_createA, (const char* name, const char* domain)) +ITT_STUB(ITTAPI, __itt_heap_function, heap_function_createW, (const wchar_t* name, const wchar_t* domain)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_heap_function, heap_function_create, (const char* name, const char* domain)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_heap_function_createA ITTNOTIFY_DATA(heap_function_createA) +#define __itt_heap_function_createA_ptr ITTNOTIFY_NAME(heap_function_createA) +#define __itt_heap_function_createW ITTNOTIFY_DATA(heap_function_createW) +#define __itt_heap_function_createW_ptr ITTNOTIFY_NAME(heap_function_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_heap_function_create ITTNOTIFY_DATA(heap_function_create) +#define __itt_heap_function_create_ptr ITTNOTIFY_NAME(heap_function_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_heap_function_createA(name, domain) (__itt_heap_function)0 +#define __itt_heap_function_createA_ptr 0 +#define __itt_heap_function_createW(name, domain) (__itt_heap_function)0 +#define __itt_heap_function_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_heap_function_create(name, domain) (__itt_heap_function)0 +#define __itt_heap_function_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_heap_function_createA_ptr 0 +#define __itt_heap_function_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_heap_function_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an allocation begin occurrence. + */ +void ITTAPI __itt_heap_allocate_begin(__itt_heap_function h, size_t size, int initialized); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_allocate_begin, (__itt_heap_function h, size_t size, int initialized)) +#define __itt_heap_allocate_begin ITTNOTIFY_VOID(heap_allocate_begin) +#define __itt_heap_allocate_begin_ptr ITTNOTIFY_NAME(heap_allocate_begin) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_allocate_begin(h, size, initialized) +#define __itt_heap_allocate_begin_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_allocate_begin_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an allocation end occurrence. + */ +void ITTAPI __itt_heap_allocate_end(__itt_heap_function h, void** addr, size_t size, int initialized); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_allocate_end, (__itt_heap_function h, void** addr, size_t size, int initialized)) +#define __itt_heap_allocate_end ITTNOTIFY_VOID(heap_allocate_end) +#define __itt_heap_allocate_end_ptr ITTNOTIFY_NAME(heap_allocate_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_allocate_end(h, addr, size, initialized) +#define __itt_heap_allocate_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_allocate_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an free begin occurrence. + */ +void ITTAPI __itt_heap_free_begin(__itt_heap_function h, void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_free_begin, (__itt_heap_function h, void* addr)) +#define __itt_heap_free_begin ITTNOTIFY_VOID(heap_free_begin) +#define __itt_heap_free_begin_ptr ITTNOTIFY_NAME(heap_free_begin) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_free_begin(h, addr) +#define __itt_heap_free_begin_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_free_begin_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an free end occurrence. + */ +void ITTAPI __itt_heap_free_end(__itt_heap_function h, void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_free_end, (__itt_heap_function h, void* addr)) +#define __itt_heap_free_end ITTNOTIFY_VOID(heap_free_end) +#define __itt_heap_free_end_ptr ITTNOTIFY_NAME(heap_free_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_free_end(h, addr) +#define __itt_heap_free_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_free_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an reallocation begin occurrence. + */ +void ITTAPI __itt_heap_reallocate_begin(__itt_heap_function h, void* addr, size_t new_size, int initialized); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_reallocate_begin, (__itt_heap_function h, void* addr, size_t new_size, int initialized)) +#define __itt_heap_reallocate_begin ITTNOTIFY_VOID(heap_reallocate_begin) +#define __itt_heap_reallocate_begin_ptr ITTNOTIFY_NAME(heap_reallocate_begin) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_reallocate_begin(h, addr, new_size, initialized) +#define __itt_heap_reallocate_begin_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_reallocate_begin_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an reallocation end occurrence. + */ +void ITTAPI __itt_heap_reallocate_end(__itt_heap_function h, void* addr, void** new_addr, size_t new_size, int initialized); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_reallocate_end, (__itt_heap_function h, void* addr, void** new_addr, size_t new_size, int initialized)) +#define __itt_heap_reallocate_end ITTNOTIFY_VOID(heap_reallocate_end) +#define __itt_heap_reallocate_end_ptr ITTNOTIFY_NAME(heap_reallocate_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_reallocate_end(h, addr, new_addr, new_size, initialized) +#define __itt_heap_reallocate_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_reallocate_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @brief internal access begin */ +void ITTAPI __itt_heap_internal_access_begin(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_internal_access_begin, (void)) +#define __itt_heap_internal_access_begin ITTNOTIFY_VOID(heap_internal_access_begin) +#define __itt_heap_internal_access_begin_ptr ITTNOTIFY_NAME(heap_internal_access_begin) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_internal_access_begin() +#define __itt_heap_internal_access_begin_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_internal_access_begin_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @brief internal access end */ +void ITTAPI __itt_heap_internal_access_end(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_internal_access_end, (void)) +#define __itt_heap_internal_access_end ITTNOTIFY_VOID(heap_internal_access_end) +#define __itt_heap_internal_access_end_ptr ITTNOTIFY_NAME(heap_internal_access_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_internal_access_end() +#define __itt_heap_internal_access_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_internal_access_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @brief record memory growth begin */ +void ITTAPI __itt_heap_record_memory_growth_begin(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_record_memory_growth_begin, (void)) +#define __itt_heap_record_memory_growth_begin ITTNOTIFY_VOID(heap_record_memory_growth_begin) +#define __itt_heap_record_memory_growth_begin_ptr ITTNOTIFY_NAME(heap_record_memory_growth_begin) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_record_memory_growth_begin() +#define __itt_heap_record_memory_growth_begin_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_record_memory_growth_begin_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @brief record memory growth end */ +void ITTAPI __itt_heap_record_memory_growth_end(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_record_memory_growth_end, (void)) +#define __itt_heap_record_memory_growth_end ITTNOTIFY_VOID(heap_record_memory_growth_end) +#define __itt_heap_record_memory_growth_end_ptr ITTNOTIFY_NAME(heap_record_memory_growth_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_record_memory_growth_end() +#define __itt_heap_record_memory_growth_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_record_memory_growth_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Specify the type of heap detection/reporting to modify. + */ +/** + * @hideinitializer + * @brief Report on memory leaks. + */ +#define __itt_heap_leaks 0x00000001 + +/** + * @hideinitializer + * @brief Report on memory growth. + */ +#define __itt_heap_growth 0x00000002 + + +/** @brief heap reset detection */ +void ITTAPI __itt_heap_reset_detection(unsigned int reset_mask); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_reset_detection, (unsigned int reset_mask)) +#define __itt_heap_reset_detection ITTNOTIFY_VOID(heap_reset_detection) +#define __itt_heap_reset_detection_ptr ITTNOTIFY_NAME(heap_reset_detection) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_reset_detection() +#define __itt_heap_reset_detection_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_reset_detection_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @brief report */ +void ITTAPI __itt_heap_record(unsigned int record_mask); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, heap_record, (unsigned int record_mask)) +#define __itt_heap_record ITTNOTIFY_VOID(heap_record) +#define __itt_heap_record_ptr ITTNOTIFY_NAME(heap_record) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_heap_record() +#define __itt_heap_record_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_heap_record_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @} heap group */ +/** @endcond */ +/* ========================================================================== */ + +/** + * @defgroup domains Domains + * @ingroup public + * Domains group + * @{ + */ + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_domain +{ + volatile int flags; /*!< Zero if disabled, non-zero if enabled. The meaning of different non-zero values is reserved to the runtime */ + const char* nameA; /*!< Copy of original name in ASCII. */ +#if defined(UNICODE) || defined(_UNICODE) + const wchar_t* nameW; /*!< Copy of original name in UNICODE. */ +#else /* UNICODE || _UNICODE */ + void* nameW; +#endif /* UNICODE || _UNICODE */ + int extra1; /*!< Reserved to the runtime */ + void* extra2; /*!< Reserved to the runtime */ + struct ___itt_domain* next; +} __itt_domain; + +#pragma pack(pop) +/** @endcond */ + +/** + * @ingroup domains + * @brief Create a domain. + * Create domain using some domain name: the URI naming style is recommended. + * Because the set of domains is expected to be static over the application's + * execution time, there is no mechanism to destroy a domain. + * Any domain can be accessed by any thread in the process, regardless of + * which thread created the domain. This call is thread-safe. + * @param[in] name name of domain + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_domain* ITTAPI __itt_domain_createA(const char *name); +__itt_domain* ITTAPI __itt_domain_createW(const wchar_t *name); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_domain_create __itt_domain_createW +# define __itt_domain_create_ptr __itt_domain_createW_ptr +#else /* UNICODE */ +# define __itt_domain_create __itt_domain_createA +# define __itt_domain_create_ptr __itt_domain_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_domain* ITTAPI __itt_domain_create(const char *name); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_domain*, domain_createA, (const char *name)) +ITT_STUB(ITTAPI, __itt_domain*, domain_createW, (const wchar_t *name)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_domain*, domain_create, (const char *name)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_domain_createA ITTNOTIFY_DATA(domain_createA) +#define __itt_domain_createA_ptr ITTNOTIFY_NAME(domain_createA) +#define __itt_domain_createW ITTNOTIFY_DATA(domain_createW) +#define __itt_domain_createW_ptr ITTNOTIFY_NAME(domain_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_domain_create ITTNOTIFY_DATA(domain_create) +#define __itt_domain_create_ptr ITTNOTIFY_NAME(domain_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_domain_createA(name) (__itt_domain*)0 +#define __itt_domain_createA_ptr 0 +#define __itt_domain_createW(name) (__itt_domain*)0 +#define __itt_domain_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_domain_create(name) (__itt_domain*)0 +#define __itt_domain_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_domain_createA_ptr 0 +#define __itt_domain_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_domain_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} domains group */ + +/** + * @defgroup ids IDs + * @ingroup public + * IDs group + * @{ + */ + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_id +{ + unsigned long long d1, d2, d3; +} __itt_id; + +#pragma pack(pop) +/** @endcond */ + +static const __itt_id __itt_null = { 0, 0, 0 }; + +/** + * @ingroup ids + * @brief A convenience function is provided to create an ID without domain control. + * @brief This is a convenience function to initialize an __itt_id structure. This function + * does not affect the collector runtime in any way. After you make the ID with this + * function, you still must create it with the __itt_id_create function before using the ID + * to identify a named entity. + * @param[in] addr The address of object; high QWORD of the ID value. + * @param[in] extra The extra data to unique identify object; low QWORD of the ID value. + */ + +ITT_INLINE __itt_id ITTAPI __itt_id_make(void* addr, unsigned long long extra) ITT_INLINE_ATTRIBUTE; +ITT_INLINE __itt_id ITTAPI __itt_id_make(void* addr, unsigned long long extra) +{ + __itt_id id = __itt_null; + id.d1 = (unsigned long long)((uintptr_t)addr); + id.d2 = (unsigned long long)extra; + id.d3 = (unsigned long long)0; /* Reserved. Must be zero */ + return id; +} + +/** + * @ingroup ids + * @brief Create an instance of identifier. + * This establishes the beginning of the lifetime of an instance of + * the given ID in the trace. Once this lifetime starts, the ID + * can be used to tag named entity instances in calls such as + * __itt_task_begin, and to specify relationships among + * identified named entity instances, using the \ref relations APIs. + * Instance IDs are not domain specific! + * @param[in] domain The domain controlling the execution of this call. + * @param[in] id The ID to create. + */ +void ITTAPI __itt_id_create(const __itt_domain *domain, __itt_id id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, id_create, (const __itt_domain *domain, __itt_id id)) +#define __itt_id_create(d,x) ITTNOTIFY_VOID_D1(id_create,d,x) +#define __itt_id_create_ptr ITTNOTIFY_NAME(id_create) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_id_create(domain,id) +#define __itt_id_create_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_id_create_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup ids + * @brief Destroy an instance of identifier. + * This ends the lifetime of the current instance of the given ID value in the trace. + * Any relationships that are established after this lifetime ends are invalid. + * This call must be performed before the given ID value can be reused for a different + * named entity instance. + * @param[in] domain The domain controlling the execution of this call. + * @param[in] id The ID to destroy. + */ +void ITTAPI __itt_id_destroy(const __itt_domain *domain, __itt_id id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, id_destroy, (const __itt_domain *domain, __itt_id id)) +#define __itt_id_destroy(d,x) ITTNOTIFY_VOID_D1(id_destroy,d,x) +#define __itt_id_destroy_ptr ITTNOTIFY_NAME(id_destroy) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_id_destroy(domain,id) +#define __itt_id_destroy_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_id_destroy_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} ids group */ + +/** + * @defgroup handless String Handles + * @ingroup public + * String Handles group + * @{ + */ + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_string_handle +{ + const char* strA; /*!< Copy of original string in ASCII. */ +#if defined(UNICODE) || defined(_UNICODE) + const wchar_t* strW; /*!< Copy of original string in UNICODE. */ +#else /* UNICODE || _UNICODE */ + void* strW; +#endif /* UNICODE || _UNICODE */ + int extra1; /*!< Reserved. Must be zero */ + void* extra2; /*!< Reserved. Must be zero */ + struct ___itt_string_handle* next; +} __itt_string_handle; + +#pragma pack(pop) +/** @endcond */ + +/** + * @ingroup handles + * @brief Create a string handle. + * Create and return handle value that can be associated with a string. + * Consecutive calls to __itt_string_handle_create with the same name + * return the same value. Because the set of string handles is expected to remain + * static during the application's execution time, there is no mechanism to destroy a string handle. + * Any string handle can be accessed by any thread in the process, regardless of which thread created + * the string handle. This call is thread-safe. + * @param[in] name The input string + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_string_handle* ITTAPI __itt_string_handle_createA(const char *name); +__itt_string_handle* ITTAPI __itt_string_handle_createW(const wchar_t *name); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_string_handle_create __itt_string_handle_createW +# define __itt_string_handle_create_ptr __itt_string_handle_createW_ptr +#else /* UNICODE */ +# define __itt_string_handle_create __itt_string_handle_createA +# define __itt_string_handle_create_ptr __itt_string_handle_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_string_handle* ITTAPI __itt_string_handle_create(const char *name); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_createA, (const char *name)) +ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_createW, (const wchar_t *name)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_create, (const char *name)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_string_handle_createA ITTNOTIFY_DATA(string_handle_createA) +#define __itt_string_handle_createA_ptr ITTNOTIFY_NAME(string_handle_createA) +#define __itt_string_handle_createW ITTNOTIFY_DATA(string_handle_createW) +#define __itt_string_handle_createW_ptr ITTNOTIFY_NAME(string_handle_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_string_handle_create ITTNOTIFY_DATA(string_handle_create) +#define __itt_string_handle_create_ptr ITTNOTIFY_NAME(string_handle_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_string_handle_createA(name) (__itt_string_handle*)0 +#define __itt_string_handle_createA_ptr 0 +#define __itt_string_handle_createW(name) (__itt_string_handle*)0 +#define __itt_string_handle_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_string_handle_create(name) (__itt_string_handle*)0 +#define __itt_string_handle_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_string_handle_createA_ptr 0 +#define __itt_string_handle_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_string_handle_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} handles group */ + +/** @cond exclude_from_documentation */ +typedef unsigned long long __itt_timestamp; +/** @endcond */ + +#define __itt_timestamp_none ((__itt_timestamp)-1LL) + +/** @cond exclude_from_gpa_documentation */ + +/** + * @ingroup timestamps + * @brief Return timestamp corresponding to the current moment. + * This returns the timestamp in the format that is the most relevant for the current + * host or platform (RDTSC, QPC, and others). You can use the "<" operator to + * compare __itt_timestamp values. + */ +__itt_timestamp ITTAPI __itt_get_timestamp(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_timestamp, get_timestamp, (void)) +#define __itt_get_timestamp ITTNOTIFY_DATA(get_timestamp) +#define __itt_get_timestamp_ptr ITTNOTIFY_NAME(get_timestamp) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_get_timestamp() +#define __itt_get_timestamp_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_get_timestamp_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} timestamps */ +/** @endcond */ + +/** @cond exclude_from_gpa_documentation */ + +/** + * @defgroup regions Regions + * @ingroup public + * Regions group + * @{ + */ +/** + * @ingroup regions + * @brief Begin of region instance. + * Successive calls to __itt_region_begin with the same ID are ignored + * until a call to __itt_region_end with the same ID + * @param[in] domain The domain for this region instance + * @param[in] id The instance ID for this region instance. Must not be __itt_null + * @param[in] parentid The instance ID for the parent of this region instance, or __itt_null + * @param[in] name The name of this region + */ +void ITTAPI __itt_region_begin(const __itt_domain *domain, __itt_id id, __itt_id parentid, __itt_string_handle *name); + +/** + * @ingroup regions + * @brief End of region instance. + * The first call to __itt_region_end with a given ID ends the + * region. Successive calls with the same ID are ignored, as are + * calls that do not have a matching __itt_region_begin call. + * @param[in] domain The domain for this region instance + * @param[in] id The instance ID for this region instance + */ +void ITTAPI __itt_region_end(const __itt_domain *domain, __itt_id id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, region_begin, (const __itt_domain *domain, __itt_id id, __itt_id parentid, __itt_string_handle *name)) +ITT_STUBV(ITTAPI, void, region_end, (const __itt_domain *domain, __itt_id id)) +#define __itt_region_begin(d,x,y,z) ITTNOTIFY_VOID_D3(region_begin,d,x,y,z) +#define __itt_region_begin_ptr ITTNOTIFY_NAME(region_begin) +#define __itt_region_end(d,x) ITTNOTIFY_VOID_D1(region_end,d,x) +#define __itt_region_end_ptr ITTNOTIFY_NAME(region_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_region_begin(d,x,y,z) +#define __itt_region_begin_ptr 0 +#define __itt_region_end(d,x) +#define __itt_region_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_region_begin_ptr 0 +#define __itt_region_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} regions group */ + +/** + * @defgroup frames Frames + * @ingroup public + * Frames are similar to regions, but are intended to be easier to use and to implement. + * In particular: + * - Frames always represent periods of elapsed time + * - By default, frames have no nesting relationships + * @{ + */ + +/** + * @ingroup frames + * @brief Begin a frame instance. + * Successive calls to __itt_frame_begin with the + * same ID are ignored until a call to __itt_frame_end with the same ID. + * @param[in] domain The domain for this frame instance + * @param[in] id The instance ID for this frame instance or NULL + */ +void ITTAPI __itt_frame_begin_v3(const __itt_domain *domain, __itt_id *id); + +/** + * @ingroup frames + * @brief End a frame instance. + * The first call to __itt_frame_end with a given ID + * ends the frame. Successive calls with the same ID are ignored, as are + * calls that do not have a matching __itt_frame_begin call. + * @param[in] domain The domain for this frame instance + * @param[in] id The instance ID for this frame instance or NULL for current + */ +void ITTAPI __itt_frame_end_v3(const __itt_domain *domain, __itt_id *id); + +/** + * @ingroup frames + * @brief Submits a frame instance. + * Successive calls to __itt_frame_begin or __itt_frame_submit with the + * same ID are ignored until a call to __itt_frame_end or __itt_frame_submit + * with the same ID. + * Passing special __itt_timestamp_none value as "end" argument means + * take the current timestamp as the end timestamp. + * @param[in] domain The domain for this frame instance + * @param[in] id The instance ID for this frame instance or NULL + * @param[in] begin Timestamp of the beginning of the frame + * @param[in] end Timestamp of the end of the frame + */ +void ITTAPI __itt_frame_submit_v3(const __itt_domain *domain, __itt_id *id, + __itt_timestamp begin, __itt_timestamp end); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, frame_begin_v3, (const __itt_domain *domain, __itt_id *id)) +ITT_STUBV(ITTAPI, void, frame_end_v3, (const __itt_domain *domain, __itt_id *id)) +ITT_STUBV(ITTAPI, void, frame_submit_v3, (const __itt_domain *domain, __itt_id *id, __itt_timestamp begin, __itt_timestamp end)) +#define __itt_frame_begin_v3(d,x) ITTNOTIFY_VOID_D1(frame_begin_v3,d,x) +#define __itt_frame_begin_v3_ptr ITTNOTIFY_NAME(frame_begin_v3) +#define __itt_frame_end_v3(d,x) ITTNOTIFY_VOID_D1(frame_end_v3,d,x) +#define __itt_frame_end_v3_ptr ITTNOTIFY_NAME(frame_end_v3) +#define __itt_frame_submit_v3(d,x,b,e) ITTNOTIFY_VOID_D3(frame_submit_v3,d,x,b,e) +#define __itt_frame_submit_v3_ptr ITTNOTIFY_NAME(frame_submit_v3) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_frame_begin_v3(domain,id) +#define __itt_frame_begin_v3_ptr 0 +#define __itt_frame_end_v3(domain,id) +#define __itt_frame_end_v3_ptr 0 +#define __itt_frame_submit_v3(domain,id,begin,end) +#define __itt_frame_submit_v3_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_frame_begin_v3_ptr 0 +#define __itt_frame_end_v3_ptr 0 +#define __itt_frame_submit_v3_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} frames group */ +/** @endcond */ + +/** + * @defgroup taskgroup Task Group + * @ingroup public + * Task Group + * @{ + */ +/** + * @ingroup task_groups + * @brief Denotes a task_group instance. + * Successive calls to __itt_task_group with the same ID are ignored. + * @param[in] domain The domain for this task_group instance + * @param[in] id The instance ID for this task_group instance. Must not be __itt_null. + * @param[in] parentid The instance ID for the parent of this task_group instance, or __itt_null. + * @param[in] name The name of this task_group + */ +void ITTAPI __itt_task_group(const __itt_domain *domain, __itt_id id, __itt_id parentid, __itt_string_handle *name); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, task_group, (const __itt_domain *domain, __itt_id id, __itt_id parentid, __itt_string_handle *name)) +#define __itt_task_group(d,x,y,z) ITTNOTIFY_VOID_D3(task_group,d,x,y,z) +#define __itt_task_group_ptr ITTNOTIFY_NAME(task_group) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_task_group(d,x,y,z) +#define __itt_task_group_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_task_group_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} taskgroup group */ + +/** + * @defgroup tasks Tasks + * @ingroup public + * A task instance represents a piece of work performed by a particular + * thread for a period of time. A call to __itt_task_begin creates a + * task instance. This becomes the current instance for that task on that + * thread. A following call to __itt_task_end on the same thread ends the + * instance. There may be multiple simultaneous instances of tasks with the + * same name on different threads. If an ID is specified, the task instance + * receives that ID. Nested tasks are allowed. + * + * Note: The task is defined by the bracketing of __itt_task_begin and + * __itt_task_end on the same thread. If some scheduling mechanism causes + * task switching (the thread executes a different user task) or task + * switching (the user task switches to a different thread) then this breaks + * the notion of current instance. Additional API calls are required to + * deal with that possibility. + * @{ + */ + +/** + * @ingroup tasks + * @brief Begin a task instance. + * @param[in] domain The domain for this task + * @param[in] taskid The instance ID for this task instance, or __itt_null + * @param[in] parentid The parent instance to which this task instance belongs, or __itt_null + * @param[in] name The name of this task + */ +void ITTAPI __itt_task_begin(const __itt_domain *domain, __itt_id taskid, __itt_id parentid, __itt_string_handle *name); + +/** + * @ingroup tasks + * @brief Begin a task instance. + * @param[in] domain The domain for this task + * @param[in] taskid The identifier for this task instance (may be 0) + * @param[in] parentid The parent of this task (may be 0) + * @param[in] fn The pointer to the function you are tracing + */ +void ITTAPI __itt_task_begin_fn(const __itt_domain *domain, __itt_id taskid, __itt_id parentid, void* fn); + +/** + * @ingroup tasks + * @brief End the current task instance. + * @param[in] domain The domain for this task + */ +void ITTAPI __itt_task_end(const __itt_domain *domain); + +/** + * @ingroup tasks + * @brief Begin an overlapped task instance. + * @param[in] domain The domain for this task. + * @param[in] taskid The identifier for this task instance, *cannot* be __itt_null. + * @param[in] parentid The parent of this task, or __itt_null. + * @param[in] name The name of this task. + */ +void ITTAPI __itt_task_begin_overlapped(const __itt_domain* domain, __itt_id taskid, __itt_id parentid, __itt_string_handle* name); + +/** + * @ingroup tasks + * @brief End an overlapped task instance. + * @param[in] domain The domain for this task + * @param[in] taskid Explicit ID of finished task + */ +void ITTAPI __itt_task_end_overlapped(const __itt_domain *domain, __itt_id taskid); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, task_begin, (const __itt_domain *domain, __itt_id id, __itt_id parentid, __itt_string_handle *name)) +ITT_STUBV(ITTAPI, void, task_begin_fn, (const __itt_domain *domain, __itt_id id, __itt_id parentid, void* fn)) +ITT_STUBV(ITTAPI, void, task_end, (const __itt_domain *domain)) +ITT_STUBV(ITTAPI, void, task_begin_overlapped, (const __itt_domain *domain, __itt_id taskid, __itt_id parentid, __itt_string_handle *name)) +ITT_STUBV(ITTAPI, void, task_end_overlapped, (const __itt_domain *domain, __itt_id taskid)) +#define __itt_task_begin(d,x,y,z) ITTNOTIFY_VOID_D3(task_begin,d,x,y,z) +#define __itt_task_begin_ptr ITTNOTIFY_NAME(task_begin) +#define __itt_task_begin_fn(d,x,y,z) ITTNOTIFY_VOID_D3(task_begin_fn,d,x,y,z) +#define __itt_task_begin_fn_ptr ITTNOTIFY_NAME(task_begin_fn) +#define __itt_task_end(d) ITTNOTIFY_VOID_D0(task_end,d) +#define __itt_task_end_ptr ITTNOTIFY_NAME(task_end) +#define __itt_task_begin_overlapped(d,x,y,z) ITTNOTIFY_VOID_D3(task_begin_overlapped,d,x,y,z) +#define __itt_task_begin_overlapped_ptr ITTNOTIFY_NAME(task_begin_overlapped) +#define __itt_task_end_overlapped(d,x) ITTNOTIFY_VOID_D1(task_end_overlapped,d,x) +#define __itt_task_end_overlapped_ptr ITTNOTIFY_NAME(task_end_overlapped) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_task_begin(domain,id,parentid,name) +#define __itt_task_begin_ptr 0 +#define __itt_task_begin_fn(domain,id,parentid,fn) +#define __itt_task_begin_fn_ptr 0 +#define __itt_task_end(domain) +#define __itt_task_end_ptr 0 +#define __itt_task_begin_overlapped(domain,taskid,parentid,name) +#define __itt_task_begin_overlapped_ptr 0 +#define __itt_task_end_overlapped(domain,taskid) +#define __itt_task_end_overlapped_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_task_begin_ptr 0 +#define __itt_task_begin_fn_ptr 0 +#define __itt_task_end_ptr 0 +#define __itt_task_begin_overlapped_ptr 0 +#define __itt_task_end_overlapped_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} tasks group */ + + +/** + * @defgroup markers Markers + * Markers represent a single discreet event in time. Markers have a scope, + * described by an enumerated type __itt_scope. Markers are created by + * the API call __itt_marker. A marker instance can be given an ID for use in + * adding metadata. + * @{ + */ + +/** + * @brief Describes the scope of an event object in the trace. + */ +typedef enum +{ + __itt_scope_unknown = 0, + __itt_scope_global, + __itt_scope_track_group, + __itt_scope_track, + __itt_scope_task, + __itt_scope_marker +} __itt_scope; + +/** @cond exclude_from_documentation */ +#define __itt_marker_scope_unknown __itt_scope_unknown +#define __itt_marker_scope_global __itt_scope_global +#define __itt_marker_scope_process __itt_scope_track_group +#define __itt_marker_scope_thread __itt_scope_track +#define __itt_marker_scope_task __itt_scope_task +/** @endcond */ + +/** + * @ingroup markers + * @brief Create a marker instance + * @param[in] domain The domain for this marker + * @param[in] id The instance ID for this marker or __itt_null + * @param[in] name The name for this marker + * @param[in] scope The scope for this marker + */ +void ITTAPI __itt_marker(const __itt_domain *domain, __itt_id id, __itt_string_handle *name, __itt_scope scope); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, marker, (const __itt_domain *domain, __itt_id id, __itt_string_handle *name, __itt_scope scope)) +#define __itt_marker(d,x,y,z) ITTNOTIFY_VOID_D3(marker,d,x,y,z) +#define __itt_marker_ptr ITTNOTIFY_NAME(marker) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_marker(domain,id,name,scope) +#define __itt_marker_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_marker_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} markers group */ + +/** + * @defgroup metadata Metadata + * The metadata API is used to attach extra information to named + * entities. Metadata can be attached to an identified named entity by ID, + * or to the current entity (which is always a task). + * + * Conceptually metadata has a type (what kind of metadata), a key (the + * name of the metadata), and a value (the actual data). The encoding of + * the value depends on the type of the metadata. + * + * The type of metadata is specified by an enumerated type __itt_metdata_type. + * @{ + */ + +/** + * @ingroup parameters + * @brief describes the type of metadata + */ +typedef enum { + __itt_metadata_unknown = 0, + __itt_metadata_u64, /**< Unsigned 64-bit integer */ + __itt_metadata_s64, /**< Signed 64-bit integer */ + __itt_metadata_u32, /**< Unsigned 32-bit integer */ + __itt_metadata_s32, /**< Signed 32-bit integer */ + __itt_metadata_u16, /**< Unsigned 16-bit integer */ + __itt_metadata_s16, /**< Signed 16-bit integer */ + __itt_metadata_float, /**< Signed 32-bit floating-point */ + __itt_metadata_double /**< SIgned 64-bit floating-point */ +} __itt_metadata_type; + +/** + * @ingroup parameters + * @brief Add metadata to an instance of a named entity. + * @param[in] domain The domain controlling the call + * @param[in] id The identifier of the instance to which the metadata is to be added, or __itt_null to add to the current task + * @param[in] key The name of the metadata + * @param[in] type The type of the metadata + * @param[in] count The number of elements of the given type. If count == 0, no metadata will be added. + * @param[in] data The metadata itself +*/ +void ITTAPI __itt_metadata_add(const __itt_domain *domain, __itt_id id, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, metadata_add, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data)) +#define __itt_metadata_add(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(metadata_add,d,x,y,z,a,b) +#define __itt_metadata_add_ptr ITTNOTIFY_NAME(metadata_add) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_metadata_add(d,x,y,z,a,b) +#define __itt_metadata_add_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_metadata_add_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup parameters + * @brief Add string metadata to an instance of a named entity. + * @param[in] domain The domain controlling the call + * @param[in] id The identifier of the instance to which the metadata is to be added, or __itt_null to add to the current task + * @param[in] key The name of the metadata + * @param[in] data The metadata itself + * @param[in] length The number of characters in the string, or -1 if the length is unknown but the string is null-terminated +*/ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_metadata_str_addA(const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char *data, size_t length); +void ITTAPI __itt_metadata_str_addW(const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const wchar_t *data, size_t length); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_metadata_str_add __itt_metadata_str_addW +# define __itt_metadata_str_add_ptr __itt_metadata_str_addW_ptr +#else /* UNICODE */ +# define __itt_metadata_str_add __itt_metadata_str_addA +# define __itt_metadata_str_add_ptr __itt_metadata_str_addA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_metadata_str_add(const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char *data, size_t length); +#endif + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, metadata_str_addA, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char *data, size_t length)) +ITT_STUBV(ITTAPI, void, metadata_str_addW, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const wchar_t *data, size_t length)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, metadata_str_add, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char *data, size_t length)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_metadata_str_addA(d,x,y,z,a) ITTNOTIFY_VOID_D4(metadata_str_addA,d,x,y,z,a) +#define __itt_metadata_str_addA_ptr ITTNOTIFY_NAME(metadata_str_addA) +#define __itt_metadata_str_addW(d,x,y,z,a) ITTNOTIFY_VOID_D4(metadata_str_addW,d,x,y,z,a) +#define __itt_metadata_str_addW_ptr ITTNOTIFY_NAME(metadata_str_addW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_metadata_str_add(d,x,y,z,a) ITTNOTIFY_VOID_D4(metadata_str_add,d,x,y,z,a) +#define __itt_metadata_str_add_ptr ITTNOTIFY_NAME(metadata_str_add) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_metadata_str_addA(d,x,y,z,a) +#define __itt_metadata_str_addA_ptr 0 +#define __itt_metadata_str_addW(d,x,y,z,a) +#define __itt_metadata_str_addW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_metadata_str_add(d,x,y,z,a) +#define __itt_metadata_str_add_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_metadata_str_addA_ptr 0 +#define __itt_metadata_str_addW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_metadata_str_add_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup parameters + * @brief Add metadata to an instance of a named entity. + * @param[in] domain The domain controlling the call + * @param[in] scope The scope of the instance to which the metadata is to be added + + * @param[in] id The identifier of the instance to which the metadata is to be added, or __itt_null to add to the current task + + * @param[in] key The name of the metadata + * @param[in] type The type of the metadata + * @param[in] count The number of elements of the given type. If count == 0, no metadata will be added. + * @param[in] data The metadata itself +*/ +void ITTAPI __itt_metadata_add_with_scope(const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, metadata_add_with_scope, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data)) +#define __itt_metadata_add_with_scope(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(metadata_add_with_scope,d,x,y,z,a,b) +#define __itt_metadata_add_with_scope_ptr ITTNOTIFY_NAME(metadata_add_with_scope) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_metadata_add_with_scope(d,x,y,z,a,b) +#define __itt_metadata_add_with_scope_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_metadata_add_with_scope_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup parameters + * @brief Add string metadata to an instance of a named entity. + * @param[in] domain The domain controlling the call + * @param[in] scope The scope of the instance to which the metadata is to be added + + * @param[in] id The identifier of the instance to which the metadata is to be added, or __itt_null to add to the current task + + * @param[in] key The name of the metadata + * @param[in] data The metadata itself + * @param[in] length The number of characters in the string, or -1 if the length is unknown but the string is null-terminated +*/ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_metadata_str_add_with_scopeA(const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length); +void ITTAPI __itt_metadata_str_add_with_scopeW(const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const wchar_t *data, size_t length); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_metadata_str_add_with_scope __itt_metadata_str_add_with_scopeW +# define __itt_metadata_str_add_with_scope_ptr __itt_metadata_str_add_with_scopeW_ptr +#else /* UNICODE */ +# define __itt_metadata_str_add_with_scope __itt_metadata_str_add_with_scopeA +# define __itt_metadata_str_add_with_scope_ptr __itt_metadata_str_add_with_scopeA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_metadata_str_add_with_scope(const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length); +#endif + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, metadata_str_add_with_scopeA, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length)) +ITT_STUBV(ITTAPI, void, metadata_str_add_with_scopeW, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const wchar_t *data, size_t length)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, metadata_str_add_with_scope, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_metadata_str_add_with_scopeA(d,x,y,z,a) ITTNOTIFY_VOID_D4(metadata_str_add_with_scopeA,d,x,y,z,a) +#define __itt_metadata_str_add_with_scopeA_ptr ITTNOTIFY_NAME(metadata_str_add_with_scopeA) +#define __itt_metadata_str_add_with_scopeW(d,x,y,z,a) ITTNOTIFY_VOID_D4(metadata_str_add_with_scopeW,d,x,y,z,a) +#define __itt_metadata_str_add_with_scopeW_ptr ITTNOTIFY_NAME(metadata_str_add_with_scopeW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_metadata_str_add_with_scope(d,x,y,z,a) ITTNOTIFY_VOID_D4(metadata_str_add_with_scope,d,x,y,z,a) +#define __itt_metadata_str_add_with_scope_ptr ITTNOTIFY_NAME(metadata_str_add_with_scope) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_metadata_str_add_with_scopeA(d,x,y,z,a) +#define __itt_metadata_str_add_with_scopeA_ptr 0 +#define __itt_metadata_str_add_with_scopeW(d,x,y,z,a) +#define __itt_metadata_str_add_with_scopeW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_metadata_str_add_with_scope(d,x,y,z,a) +#define __itt_metadata_str_add_with_scope_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_metadata_str_add_with_scopeA_ptr 0 +#define __itt_metadata_str_add_with_scopeW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_metadata_str_add_with_scope_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @} metadata group */ + +/** + * @defgroup relations Relations + * Instances of named entities can be explicitly associated with other + * instances using instance IDs and the relationship API calls. + * + * @{ + */ + +/** + * @ingroup relations + * @brief The kind of relation between two instances is specified by the enumerated type __itt_relation. + * Relations between instances can be added with an API call. The relation + * API uses instance IDs. Relations can be added before or after the actual + * instances are created and persist independently of the instances. This + * is the motivation for having different lifetimes for instance IDs and + * the actual instances. + */ +typedef enum +{ + __itt_relation_is_unknown = 0, + __itt_relation_is_dependent_on, /**< "A is dependent on B" means that A cannot start until B completes */ + __itt_relation_is_sibling_of, /**< "A is sibling of B" means that A and B were created as a group */ + __itt_relation_is_parent_of, /**< "A is parent of B" means that A created B */ + __itt_relation_is_continuation_of, /**< "A is continuation of B" means that A assumes the dependencies of B */ + __itt_relation_is_child_of, /**< "A is child of B" means that A was created by B (inverse of is_parent_of) */ + __itt_relation_is_continued_by, /**< "A is continued by B" means that B assumes the dependencies of A (inverse of is_continuation_of) */ + __itt_relation_is_predecessor_to /**< "A is predecessor to B" means that B cannot start until A completes (inverse of is_dependent_on) */ +} __itt_relation; + +/** + * @ingroup relations + * @brief Add a relation to the current task instance. + * The current task instance is the head of the relation. + * @param[in] domain The domain controlling this call + * @param[in] relation The kind of relation + * @param[in] tail The ID for the tail of the relation + */ +void ITTAPI __itt_relation_add_to_current(const __itt_domain *domain, __itt_relation relation, __itt_id tail); + +/** + * @ingroup relations + * @brief Add a relation between two instance identifiers. + * @param[in] domain The domain controlling this call + * @param[in] head The ID for the head of the relation + * @param[in] relation The kind of relation + * @param[in] tail The ID for the tail of the relation + */ +void ITTAPI __itt_relation_add(const __itt_domain *domain, __itt_id head, __itt_relation relation, __itt_id tail); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, relation_add_to_current, (const __itt_domain *domain, __itt_relation relation, __itt_id tail)) +ITT_STUBV(ITTAPI, void, relation_add, (const __itt_domain *domain, __itt_id head, __itt_relation relation, __itt_id tail)) +#define __itt_relation_add_to_current(d,x,y) ITTNOTIFY_VOID_D2(relation_add_to_current,d,x,y) +#define __itt_relation_add_to_current_ptr ITTNOTIFY_NAME(relation_add_to_current) +#define __itt_relation_add(d,x,y,z) ITTNOTIFY_VOID_D3(relation_add,d,x,y,z) +#define __itt_relation_add_ptr ITTNOTIFY_NAME(relation_add) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_relation_add_to_current(d,x,y) +#define __itt_relation_add_to_current_ptr 0 +#define __itt_relation_add(d,x,y,z) +#define __itt_relation_add_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_relation_add_to_current_ptr 0 +#define __itt_relation_add_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} relations group */ + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_clock_info +{ + unsigned long long clock_freq; /*!< Clock domain frequency */ + unsigned long long clock_base; /*!< Clock domain base timestamp */ +} __itt_clock_info; + +#pragma pack(pop) +/** @endcond */ + +/** @cond exclude_from_documentation */ +typedef void (ITTAPI *__itt_get_clock_info_fn)(__itt_clock_info* clock_info, void* data); +/** @endcond */ + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_clock_domain +{ + __itt_clock_info info; /*!< Most recent clock domain info */ + __itt_get_clock_info_fn fn; /*!< Callback function pointer */ + void* fn_data; /*!< Input argument for the callback function */ + int extra1; /*!< Reserved. Must be zero */ + void* extra2; /*!< Reserved. Must be zero */ + struct ___itt_clock_domain* next; +} __itt_clock_domain; + +#pragma pack(pop) +/** @endcond */ + +/** + * @ingroup clockdomains + * @brief Create a clock domain. + * Certain applications require the capability to trace their application using + * a clock domain different than the CPU, for instance the instrumentation of events + * that occur on a GPU. + * Because the set of domains is expected to be static over the application's execution time, + * there is no mechanism to destroy a domain. + * Any domain can be accessed by any thread in the process, regardless of which thread created + * the domain. This call is thread-safe. + * @param[in] fn A pointer to a callback function which retrieves alternative CPU timestamps + * @param[in] fn_data Argument for a callback function; may be NULL + */ +__itt_clock_domain* ITTAPI __itt_clock_domain_create(__itt_get_clock_info_fn fn, void* fn_data); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_clock_domain*, clock_domain_create, (__itt_get_clock_info_fn fn, void* fn_data)) +#define __itt_clock_domain_create ITTNOTIFY_DATA(clock_domain_create) +#define __itt_clock_domain_create_ptr ITTNOTIFY_NAME(clock_domain_create) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_clock_domain_create(fn,fn_data) (__itt_clock_domain*)0 +#define __itt_clock_domain_create_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_clock_domain_create_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup clockdomains + * @brief Recalculate clock domains frequences and clock base timestamps. + */ +void ITTAPI __itt_clock_domain_reset(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, clock_domain_reset, (void)) +#define __itt_clock_domain_reset ITTNOTIFY_VOID(clock_domain_reset) +#define __itt_clock_domain_reset_ptr ITTNOTIFY_NAME(clock_domain_reset) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_clock_domain_reset() +#define __itt_clock_domain_reset_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_clock_domain_reset_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup clockdomain + * @brief Create an instance of identifier. This establishes the beginning of the lifetime of + * an instance of the given ID in the trace. Once this lifetime starts, the ID can be used to + * tag named entity instances in calls such as __itt_task_begin, and to specify relationships among + * identified named entity instances, using the \ref relations APIs. + * @param[in] domain The domain controlling the execution of this call. + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] id The ID to create. + */ +void ITTAPI __itt_id_create_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id); + +/** + * @ingroup clockdomain + * @brief Destroy an instance of identifier. This ends the lifetime of the current instance of the + * given ID value in the trace. Any relationships that are established after this lifetime ends are + * invalid. This call must be performed before the given ID value can be reused for a different + * named entity instance. + * @param[in] domain The domain controlling the execution of this call. + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] id The ID to destroy. + */ +void ITTAPI __itt_id_destroy_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, id_create_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id)) +ITT_STUBV(ITTAPI, void, id_destroy_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id)) +#define __itt_id_create_ex(d,x,y,z) ITTNOTIFY_VOID_D3(id_create_ex,d,x,y,z) +#define __itt_id_create_ex_ptr ITTNOTIFY_NAME(id_create_ex) +#define __itt_id_destroy_ex(d,x,y,z) ITTNOTIFY_VOID_D3(id_destroy_ex,d,x,y,z) +#define __itt_id_destroy_ex_ptr ITTNOTIFY_NAME(id_destroy_ex) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_id_create_ex(domain,clock_domain,timestamp,id) +#define __itt_id_create_ex_ptr 0 +#define __itt_id_destroy_ex(domain,clock_domain,timestamp,id) +#define __itt_id_destroy_ex_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_id_create_ex_ptr 0 +#define __itt_id_destroy_ex_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup clockdomain + * @brief Begin a task instance. + * @param[in] domain The domain for this task + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] taskid The instance ID for this task instance, or __itt_null + * @param[in] parentid The parent instance to which this task instance belongs, or __itt_null + * @param[in] name The name of this task + */ +void ITTAPI __itt_task_begin_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id taskid, __itt_id parentid, __itt_string_handle* name); + +/** + * @ingroup clockdomain + * @brief Begin a task instance. + * @param[in] domain The domain for this task + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] taskid The identifier for this task instance, or __itt_null + * @param[in] parentid The parent of this task, or __itt_null + * @param[in] fn The pointer to the function you are tracing + */ +void ITTAPI __itt_task_begin_fn_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id taskid, __itt_id parentid, void* fn); + +/** + * @ingroup clockdomain + * @brief End the current task instance. + * @param[in] domain The domain for this task + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + */ +void ITTAPI __itt_task_end_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, task_begin_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, __itt_string_handle *name)) +ITT_STUBV(ITTAPI, void, task_begin_fn_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, void* fn)) +ITT_STUBV(ITTAPI, void, task_end_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp)) +#define __itt_task_begin_ex(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(task_begin_ex,d,x,y,z,a,b) +#define __itt_task_begin_ex_ptr ITTNOTIFY_NAME(task_begin_ex) +#define __itt_task_begin_fn_ex(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(task_begin_fn_ex,d,x,y,z,a,b) +#define __itt_task_begin_fn_ex_ptr ITTNOTIFY_NAME(task_begin_fn_ex) +#define __itt_task_end_ex(d,x,y) ITTNOTIFY_VOID_D2(task_end_ex,d,x,y) +#define __itt_task_end_ex_ptr ITTNOTIFY_NAME(task_end_ex) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_task_begin_ex(domain,clock_domain,timestamp,id,parentid,name) +#define __itt_task_begin_ex_ptr 0 +#define __itt_task_begin_fn_ex(domain,clock_domain,timestamp,id,parentid,fn) +#define __itt_task_begin_fn_ex_ptr 0 +#define __itt_task_end_ex(domain,clock_domain,timestamp) +#define __itt_task_end_ex_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_task_begin_ex_ptr 0 +#define __itt_task_begin_fn_ex_ptr 0 +#define __itt_task_end_ex_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @defgroup counters Counters + * @ingroup public + * Counters are user-defined objects with a monotonically increasing + * value. Counter values are 64-bit unsigned integers. + * Counters have names that can be displayed in + * the tools. + * @{ + */ + +/** + * @brief opaque structure for counter identification + */ +/** @cond exclude_from_documentation */ + +typedef struct ___itt_counter* __itt_counter; + +/** + * @brief Create an unsigned 64 bits integer counter with given name/domain + * + * After __itt_counter_create() is called, __itt_counter_inc(id), __itt_counter_inc_delta(id, delta), + * __itt_counter_set_value(id, value_ptr) or __itt_counter_set_value_ex(id, clock_domain, timestamp, value_ptr) + * can be used to change the value of the counter, where value_ptr is a pointer to an unsigned 64 bits integer + * + * The call is equal to __itt_counter_create_typed(name, domain, __itt_metadata_u64) + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_counter ITTAPI __itt_counter_createA(const char *name, const char *domain); +__itt_counter ITTAPI __itt_counter_createW(const wchar_t *name, const wchar_t *domain); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_counter_create __itt_counter_createW +# define __itt_counter_create_ptr __itt_counter_createW_ptr +#else /* UNICODE */ +# define __itt_counter_create __itt_counter_createA +# define __itt_counter_create_ptr __itt_counter_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_counter ITTAPI __itt_counter_create(const char *name, const char *domain); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_counter, counter_createA, (const char *name, const char *domain)) +ITT_STUB(ITTAPI, __itt_counter, counter_createW, (const wchar_t *name, const wchar_t *domain)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_counter, counter_create, (const char *name, const char *domain)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_counter_createA ITTNOTIFY_DATA(counter_createA) +#define __itt_counter_createA_ptr ITTNOTIFY_NAME(counter_createA) +#define __itt_counter_createW ITTNOTIFY_DATA(counter_createW) +#define __itt_counter_createW_ptr ITTNOTIFY_NAME(counter_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_counter_create ITTNOTIFY_DATA(counter_create) +#define __itt_counter_create_ptr ITTNOTIFY_NAME(counter_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_counter_createA(name, domain) +#define __itt_counter_createA_ptr 0 +#define __itt_counter_createW(name, domain) +#define __itt_counter_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_counter_create(name, domain) +#define __itt_counter_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_counter_createA_ptr 0 +#define __itt_counter_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_counter_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Increment the unsigned 64 bits integer counter value + * + * Calling this function to non-unsigned 64 bits integer counters has no effect + */ +void ITTAPI __itt_counter_inc(__itt_counter id); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_inc, (__itt_counter id)) +#define __itt_counter_inc ITTNOTIFY_VOID(counter_inc) +#define __itt_counter_inc_ptr ITTNOTIFY_NAME(counter_inc) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_inc(id) +#define __itt_counter_inc_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_inc_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** + * @brief Increment the unsigned 64 bits integer counter value with x + * + * Calling this function to non-unsigned 64 bits integer counters has no effect + */ +void ITTAPI __itt_counter_inc_delta(__itt_counter id, unsigned long long value); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_inc_delta, (__itt_counter id, unsigned long long value)) +#define __itt_counter_inc_delta ITTNOTIFY_VOID(counter_inc_delta) +#define __itt_counter_inc_delta_ptr ITTNOTIFY_NAME(counter_inc_delta) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_inc_delta(id, value) +#define __itt_counter_inc_delta_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_inc_delta_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Decrement the unsigned 64 bits integer counter value + * + * Calling this function to non-unsigned 64 bits integer counters has no effect + */ +void ITTAPI __itt_counter_dec(__itt_counter id); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_dec, (__itt_counter id)) +#define __itt_counter_dec ITTNOTIFY_VOID(counter_dec) +#define __itt_counter_dec_ptr ITTNOTIFY_NAME(counter_dec) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_dec(id) +#define __itt_counter_dec_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_dec_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** + * @brief Decrement the unsigned 64 bits integer counter value with x + * + * Calling this function to non-unsigned 64 bits integer counters has no effect + */ +void ITTAPI __itt_counter_dec_delta(__itt_counter id, unsigned long long value); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_dec_delta, (__itt_counter id, unsigned long long value)) +#define __itt_counter_dec_delta ITTNOTIFY_VOID(counter_dec_delta) +#define __itt_counter_dec_delta_ptr ITTNOTIFY_NAME(counter_dec_delta) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_dec_delta(id, value) +#define __itt_counter_dec_delta_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_dec_delta_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup counters + * @brief Increment a counter by one. + * The first call with a given name creates a counter by that name and sets its + * value to zero. Successive calls increment the counter value. + * @param[in] domain The domain controlling the call. Counter names are not domain specific. + * The domain argument is used only to enable or disable the API calls. + * @param[in] name The name of the counter + */ +void ITTAPI __itt_counter_inc_v3(const __itt_domain *domain, __itt_string_handle *name); + +/** + * @ingroup counters + * @brief Increment a counter by the value specified in delta. + * @param[in] domain The domain controlling the call. Counter names are not domain specific. + * The domain argument is used only to enable or disable the API calls. + * @param[in] name The name of the counter + * @param[in] delta The amount by which to increment the counter + */ +void ITTAPI __itt_counter_inc_delta_v3(const __itt_domain *domain, __itt_string_handle *name, unsigned long long delta); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_inc_v3, (const __itt_domain *domain, __itt_string_handle *name)) +ITT_STUBV(ITTAPI, void, counter_inc_delta_v3, (const __itt_domain *domain, __itt_string_handle *name, unsigned long long delta)) +#define __itt_counter_inc_v3(d,x) ITTNOTIFY_VOID_D1(counter_inc_v3,d,x) +#define __itt_counter_inc_v3_ptr ITTNOTIFY_NAME(counter_inc_v3) +#define __itt_counter_inc_delta_v3(d,x,y) ITTNOTIFY_VOID_D2(counter_inc_delta_v3,d,x,y) +#define __itt_counter_inc_delta_v3_ptr ITTNOTIFY_NAME(counter_inc_delta_v3) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_inc_v3(domain,name) +#define __itt_counter_inc_v3_ptr 0 +#define __itt_counter_inc_delta_v3(domain,name,delta) +#define __itt_counter_inc_delta_v3_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_inc_v3_ptr 0 +#define __itt_counter_inc_delta_v3_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + + +/** + * @ingroup counters + * @brief Decrement a counter by one. + * The first call with a given name creates a counter by that name and sets its + * value to zero. Successive calls decrement the counter value. + * @param[in] domain The domain controlling the call. Counter names are not domain specific. + * The domain argument is used only to enable or disable the API calls. + * @param[in] name The name of the counter + */ +void ITTAPI __itt_counter_dec_v3(const __itt_domain *domain, __itt_string_handle *name); + +/** + * @ingroup counters + * @brief Decrement a counter by the value specified in delta. + * @param[in] domain The domain controlling the call. Counter names are not domain specific. + * The domain argument is used only to enable or disable the API calls. + * @param[in] name The name of the counter + * @param[in] delta The amount by which to decrement the counter + */ +void ITTAPI __itt_counter_dec_delta_v3(const __itt_domain *domain, __itt_string_handle *name, unsigned long long delta); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_dec_v3, (const __itt_domain *domain, __itt_string_handle *name)) +ITT_STUBV(ITTAPI, void, counter_dec_delta_v3, (const __itt_domain *domain, __itt_string_handle *name, unsigned long long delta)) +#define __itt_counter_dec_v3(d,x) ITTNOTIFY_VOID_D1(counter_dec_v3,d,x) +#define __itt_counter_dec_v3_ptr ITTNOTIFY_NAME(counter_dec_v3) +#define __itt_counter_dec_delta_v3(d,x,y) ITTNOTIFY_VOID_D2(counter_dec_delta_v3,d,x,y) +#define __itt_counter_dec_delta_v3_ptr ITTNOTIFY_NAME(counter_dec_delta_v3) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_dec_v3(domain,name) +#define __itt_counter_dec_v3_ptr 0 +#define __itt_counter_dec_delta_v3(domain,name,delta) +#define __itt_counter_dec_delta_v3_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_dec_v3_ptr 0 +#define __itt_counter_dec_delta_v3_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @} counters group */ + + +/** + * @brief Set the counter value + */ +void ITTAPI __itt_counter_set_value(__itt_counter id, void *value_ptr); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_set_value, (__itt_counter id, void *value_ptr)) +#define __itt_counter_set_value ITTNOTIFY_VOID(counter_set_value) +#define __itt_counter_set_value_ptr ITTNOTIFY_NAME(counter_set_value) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_set_value(id, value_ptr) +#define __itt_counter_set_value_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_set_value_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Set the counter value + */ +void ITTAPI __itt_counter_set_value_ex(__itt_counter id, __itt_clock_domain *clock_domain, unsigned long long timestamp, void *value_ptr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_set_value_ex, (__itt_counter id, __itt_clock_domain *clock_domain, unsigned long long timestamp, void *value_ptr)) +#define __itt_counter_set_value_ex ITTNOTIFY_VOID(counter_set_value_ex) +#define __itt_counter_set_value_ex_ptr ITTNOTIFY_NAME(counter_set_value_ex) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_set_value_ex(id, clock_domain, timestamp, value_ptr) +#define __itt_counter_set_value_ex_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_set_value_ex_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Create a typed counter with given name/domain + * + * After __itt_counter_create_typed() is called, __itt_counter_inc(id), __itt_counter_inc_delta(id, delta), + * __itt_counter_set_value(id, value_ptr) or __itt_counter_set_value_ex(id, clock_domain, timestamp, value_ptr) + * can be used to change the value of the counter + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_counter ITTAPI __itt_counter_create_typedA(const char *name, const char *domain, __itt_metadata_type type); +__itt_counter ITTAPI __itt_counter_create_typedW(const wchar_t *name, const wchar_t *domain, __itt_metadata_type type); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_counter_create_typed __itt_counter_create_typedW +# define __itt_counter_create_typed_ptr __itt_counter_create_typedW_ptr +#else /* UNICODE */ +# define __itt_counter_create_typed __itt_counter_create_typedA +# define __itt_counter_create_typed_ptr __itt_counter_create_typedA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_counter ITTAPI __itt_counter_create_typed(const char *name, const char *domain, __itt_metadata_type type); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_counter, counter_create_typedA, (const char *name, const char *domain, __itt_metadata_type type)) +ITT_STUB(ITTAPI, __itt_counter, counter_create_typedW, (const wchar_t *name, const wchar_t *domain, __itt_metadata_type type)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_counter, counter_create_typed, (const char *name, const char *domain, __itt_metadata_type type)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_counter_create_typedA ITTNOTIFY_DATA(counter_create_typedA) +#define __itt_counter_create_typedA_ptr ITTNOTIFY_NAME(counter_create_typedA) +#define __itt_counter_create_typedW ITTNOTIFY_DATA(counter_create_typedW) +#define __itt_counter_create_typedW_ptr ITTNOTIFY_NAME(counter_create_typedW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_counter_create_typed ITTNOTIFY_DATA(counter_create_typed) +#define __itt_counter_create_typed_ptr ITTNOTIFY_NAME(counter_create_typed) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_counter_create_typedA(name, domain, type) +#define __itt_counter_create_typedA_ptr 0 +#define __itt_counter_create_typedW(name, domain, type) +#define __itt_counter_create_typedW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_counter_create_typed(name, domain, type) +#define __itt_counter_create_typed_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_counter_create_typedA_ptr 0 +#define __itt_counter_create_typedW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_counter_create_typed_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Destroy the counter identified by the pointer previously returned by __itt_counter_create() or + * __itt_counter_create_typed() + */ +void ITTAPI __itt_counter_destroy(__itt_counter id); + +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, counter_destroy, (__itt_counter id)) +#define __itt_counter_destroy ITTNOTIFY_VOID(counter_destroy) +#define __itt_counter_destroy_ptr ITTNOTIFY_NAME(counter_destroy) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_counter_destroy(id) +#define __itt_counter_destroy_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_counter_destroy_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} counters group */ + +/** + * @ingroup markers + * @brief Create a marker instance. + * @param[in] domain The domain for this marker + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] id The instance ID for this marker, or __itt_null + * @param[in] name The name for this marker + * @param[in] scope The scope for this marker + */ +void ITTAPI __itt_marker_ex(const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_string_handle *name, __itt_scope scope); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, marker_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_string_handle *name, __itt_scope scope)) +#define __itt_marker_ex(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(marker_ex,d,x,y,z,a,b) +#define __itt_marker_ex_ptr ITTNOTIFY_NAME(marker_ex) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_marker_ex(domain,clock_domain,timestamp,id,name,scope) +#define __itt_marker_ex_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_marker_ex_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @ingroup clockdomain + * @brief Add a relation to the current task instance. + * The current task instance is the head of the relation. + * @param[in] domain The domain controlling this call + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] relation The kind of relation + * @param[in] tail The ID for the tail of the relation + */ +void ITTAPI __itt_relation_add_to_current_ex(const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_relation relation, __itt_id tail); + +/** + * @ingroup clockdomain + * @brief Add a relation between two instance identifiers. + * @param[in] domain The domain controlling this call + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] head The ID for the head of the relation + * @param[in] relation The kind of relation + * @param[in] tail The ID for the tail of the relation + */ +void ITTAPI __itt_relation_add_ex(const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id head, __itt_relation relation, __itt_id tail); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, relation_add_to_current_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_relation relation, __itt_id tail)) +ITT_STUBV(ITTAPI, void, relation_add_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id head, __itt_relation relation, __itt_id tail)) +#define __itt_relation_add_to_current_ex(d,x,y,z,a) ITTNOTIFY_VOID_D4(relation_add_to_current_ex,d,x,y,z,a) +#define __itt_relation_add_to_current_ex_ptr ITTNOTIFY_NAME(relation_add_to_current_ex) +#define __itt_relation_add_ex(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(relation_add_ex,d,x,y,z,a,b) +#define __itt_relation_add_ex_ptr ITTNOTIFY_NAME(relation_add_ex) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_relation_add_to_current_ex(domain,clock_domain,timestame,relation,tail) +#define __itt_relation_add_to_current_ex_ptr 0 +#define __itt_relation_add_ex(domain,clock_domain,timestamp,head,relation,tail) +#define __itt_relation_add_ex_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_relation_add_to_current_ex_ptr 0 +#define __itt_relation_add_ex_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @cond exclude_from_documentation */ +typedef enum ___itt_track_group_type +{ + __itt_track_group_type_normal = 0 +} __itt_track_group_type; +/** @endcond */ + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_track_group +{ + __itt_string_handle* name; /*!< Name of the track group */ + struct ___itt_track* track; /*!< List of child tracks */ + __itt_track_group_type tgtype; /*!< Type of the track group */ + int extra1; /*!< Reserved. Must be zero */ + void* extra2; /*!< Reserved. Must be zero */ + struct ___itt_track_group* next; +} __itt_track_group; + +#pragma pack(pop) +/** @endcond */ + +/** + * @brief Placeholder for custom track types. Currently, "normal" custom track + * is the only available track type. + */ +typedef enum ___itt_track_type +{ + __itt_track_type_normal = 0 +#ifdef INTEL_ITTNOTIFY_API_PRIVATE + , __itt_track_type_queue +#endif /* INTEL_ITTNOTIFY_API_PRIVATE */ +} __itt_track_type; + +/** @cond exclude_from_documentation */ +#pragma pack(push, 8) + +typedef struct ___itt_track +{ + __itt_string_handle* name; /*!< Name of the track group */ + __itt_track_group* group; /*!< Parent group to a track */ + __itt_track_type ttype; /*!< Type of the track */ + int extra1; /*!< Reserved. Must be zero */ + void* extra2; /*!< Reserved. Must be zero */ + struct ___itt_track* next; +} __itt_track; + +#pragma pack(pop) +/** @endcond */ + +/** + * @brief Create logical track group. + */ +__itt_track_group* ITTAPI __itt_track_group_create(__itt_string_handle* name, __itt_track_group_type track_group_type); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_track_group*, track_group_create, (__itt_string_handle* name, __itt_track_group_type track_group_type)) +#define __itt_track_group_create ITTNOTIFY_DATA(track_group_create) +#define __itt_track_group_create_ptr ITTNOTIFY_NAME(track_group_create) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_track_group_create(name) (__itt_track_group*)0 +#define __itt_track_group_create_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_track_group_create_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Create logical track. + */ +__itt_track* ITTAPI __itt_track_create(__itt_track_group* track_group, __itt_string_handle* name, __itt_track_type track_type); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_track*, track_create, (__itt_track_group* track_group,__itt_string_handle* name, __itt_track_type track_type)) +#define __itt_track_create ITTNOTIFY_DATA(track_create) +#define __itt_track_create_ptr ITTNOTIFY_NAME(track_create) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_track_create(track_group,name,track_type) (__itt_track*)0 +#define __itt_track_create_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_track_create_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Set the logical track. + */ +void ITTAPI __itt_set_track(__itt_track* track); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, set_track, (__itt_track *track)) +#define __itt_set_track ITTNOTIFY_VOID(set_track) +#define __itt_set_track_ptr ITTNOTIFY_NAME(set_track) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_set_track(track) +#define __itt_set_track_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_set_track_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/* ========================================================================== */ +/** @cond exclude_from_gpa_documentation */ +/** + * @defgroup events Events + * @ingroup public + * Events group + * @{ + */ +/** @brief user event type */ +typedef int __itt_event; + +/** + * @brief Create an event notification + * @note name or namelen being null/name and namelen not matching, user event feature not enabled + * @return non-zero event identifier upon success and __itt_err otherwise + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_event LIBITTAPI __itt_event_createA(const char *name, int namelen); +__itt_event LIBITTAPI __itt_event_createW(const wchar_t *name, int namelen); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_event_create __itt_event_createW +# define __itt_event_create_ptr __itt_event_createW_ptr +#else +# define __itt_event_create __itt_event_createA +# define __itt_event_create_ptr __itt_event_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_event LIBITTAPI __itt_event_create(const char *name, int namelen); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, __itt_event, event_createA, (const char *name, int namelen)) +ITT_STUB(LIBITTAPI, __itt_event, event_createW, (const wchar_t *name, int namelen)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, __itt_event, event_create, (const char *name, int namelen)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_event_createA ITTNOTIFY_DATA(event_createA) +#define __itt_event_createA_ptr ITTNOTIFY_NAME(event_createA) +#define __itt_event_createW ITTNOTIFY_DATA(event_createW) +#define __itt_event_createW_ptr ITTNOTIFY_NAME(event_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_event_create ITTNOTIFY_DATA(event_create) +#define __itt_event_create_ptr ITTNOTIFY_NAME(event_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_event_createA(name, namelen) (__itt_event)0 +#define __itt_event_createA_ptr 0 +#define __itt_event_createW(name, namelen) (__itt_event)0 +#define __itt_event_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_event_create(name, namelen) (__itt_event)0 +#define __itt_event_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_event_createA_ptr 0 +#define __itt_event_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_event_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an event occurrence. + * @return __itt_err upon failure (invalid event id/user event feature not enabled) + */ +int LIBITTAPI __itt_event_start(__itt_event event); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(LIBITTAPI, int, event_start, (__itt_event event)) +#define __itt_event_start ITTNOTIFY_DATA(event_start) +#define __itt_event_start_ptr ITTNOTIFY_NAME(event_start) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_event_start(event) (int)0 +#define __itt_event_start_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_event_start_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an event end occurrence. + * @note It is optional if events do not have durations. + * @return __itt_err upon failure (invalid event id/user event feature not enabled) + */ +int LIBITTAPI __itt_event_end(__itt_event event); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(LIBITTAPI, int, event_end, (__itt_event event)) +#define __itt_event_end ITTNOTIFY_DATA(event_end) +#define __itt_event_end_ptr ITTNOTIFY_NAME(event_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_event_end(event) (int)0 +#define __itt_event_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_event_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} events group */ + + +/** + * @defgroup arrays Arrays Visualizer + * @ingroup public + * Visualize arrays + * @{ + */ + +/** + * @enum __itt_av_data_type + * @brief Defines types of arrays data (for C/C++ intrinsic types) + */ +typedef enum +{ + __itt_e_first = 0, + __itt_e_char = 0, /* 1-byte integer */ + __itt_e_uchar, /* 1-byte unsigned integer */ + __itt_e_int16, /* 2-byte integer */ + __itt_e_uint16, /* 2-byte unsigned integer */ + __itt_e_int32, /* 4-byte integer */ + __itt_e_uint32, /* 4-byte unsigned integer */ + __itt_e_int64, /* 8-byte integer */ + __itt_e_uint64, /* 8-byte unsigned integer */ + __itt_e_float, /* 4-byte floating */ + __itt_e_double, /* 8-byte floating */ + __itt_e_last = __itt_e_double +} __itt_av_data_type; + +/** + * @brief Save an array data to a file. + * Output format is defined by the file extension. The csv and bmp formats are supported (bmp - for 2-dimensional array only). + * @param[in] data - pointer to the array data + * @param[in] rank - the rank of the array + * @param[in] dimensions - pointer to an array of integers, which specifies the array dimensions. + * The size of dimensions must be equal to the rank + * @param[in] type - the type of the array, specified as one of the __itt_av_data_type values (for intrinsic types) + * @param[in] filePath - the file path; the output format is defined by the file extension + * @param[in] columnOrder - defines how the array is stored in the linear memory. + * It should be 1 for column-major order (e.g. in FORTRAN) or 0 - for row-major order (e.g. in C). + */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +int ITTAPI __itt_av_saveA(void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder); +int ITTAPI __itt_av_saveW(void *data, int rank, const int *dimensions, int type, const wchar_t *filePath, int columnOrder); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_av_save __itt_av_saveW +# define __itt_av_save_ptr __itt_av_saveW_ptr +#else /* UNICODE */ +# define __itt_av_save __itt_av_saveA +# define __itt_av_save_ptr __itt_av_saveA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +int ITTAPI __itt_av_save(void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, int, av_saveA, (void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder)) +ITT_STUB(ITTAPI, int, av_saveW, (void *data, int rank, const int *dimensions, int type, const wchar_t *filePath, int columnOrder)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, av_save, (void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_av_saveA ITTNOTIFY_DATA(av_saveA) +#define __itt_av_saveA_ptr ITTNOTIFY_NAME(av_saveA) +#define __itt_av_saveW ITTNOTIFY_DATA(av_saveW) +#define __itt_av_saveW_ptr ITTNOTIFY_NAME(av_saveW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_av_save ITTNOTIFY_DATA(av_save) +#define __itt_av_save_ptr ITTNOTIFY_NAME(av_save) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_av_saveA(name) +#define __itt_av_saveA_ptr 0 +#define __itt_av_saveW(name) +#define __itt_av_saveW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_av_save(name) +#define __itt_av_save_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_av_saveA_ptr 0 +#define __itt_av_saveW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_av_save_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +void ITTAPI __itt_enable_attach(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, enable_attach, (void)) +#define __itt_enable_attach ITTNOTIFY_VOID(enable_attach) +#define __itt_enable_attach_ptr ITTNOTIFY_NAME(enable_attach) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_enable_attach() +#define __itt_enable_attach_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_enable_attach_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @cond exclude_from_gpa_documentation */ + +/** @} arrays group */ + +/** @endcond */ + +/** + * @brief Module load info + * This API is used to report necessary information in case of module relocation + * @param[in] start_addr - relocated module start address + * @param[in] end_addr - relocated module end address + * @param[in] path - file system path to the module + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_module_loadA(void *start_addr, void *end_addr, const char *path); +void ITTAPI __itt_module_loadW(void *start_addr, void *end_addr, const wchar_t *path); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_module_load __itt_module_loadW +# define __itt_module_load_ptr __itt_module_loadW_ptr +#else /* UNICODE */ +# define __itt_module_load __itt_module_loadA +# define __itt_module_load_ptr __itt_module_loadA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_module_load(void *start_addr, void *end_addr, const char *path); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, void, module_loadA, (void *start_addr, void *end_addr, const char *path)) +ITT_STUB(ITTAPI, void, module_loadW, (void *start_addr, void *end_addr, const wchar_t *path)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, void, module_load, (void *start_addr, void *end_addr, const char *path)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_module_loadA ITTNOTIFY_VOID(module_loadA) +#define __itt_module_loadA_ptr ITTNOTIFY_NAME(module_loadA) +#define __itt_module_loadW ITTNOTIFY_VOID(module_loadW) +#define __itt_module_loadW_ptr ITTNOTIFY_NAME(module_loadW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_module_load ITTNOTIFY_VOID(module_load) +#define __itt_module_load_ptr ITTNOTIFY_NAME(module_load) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_module_loadA(start_addr, end_addr, path) +#define __itt_module_loadA_ptr 0 +#define __itt_module_loadW(start_addr, end_addr, path) +#define __itt_module_loadW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_module_load(start_addr, end_addr, path) +#define __itt_module_load_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_module_loadA_ptr 0 +#define __itt_module_loadW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_module_load_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _ITTNOTIFY_H_ */ + +#ifdef INTEL_ITTNOTIFY_API_PRIVATE + +#ifndef _ITTNOTIFY_PRIVATE_ +#define _ITTNOTIFY_PRIVATE_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @ingroup clockdomain + * @brief Begin an overlapped task instance. + * @param[in] domain The domain for this task + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] taskid The identifier for this task instance, *cannot* be __itt_null. + * @param[in] parentid The parent of this task, or __itt_null. + * @param[in] name The name of this task. + */ +void ITTAPI __itt_task_begin_overlapped_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id taskid, __itt_id parentid, __itt_string_handle* name); + +/** + * @ingroup clockdomain + * @brief End an overlapped task instance. + * @param[in] domain The domain for this task + * @param[in] clock_domain The clock domain controlling the execution of this call. + * @param[in] timestamp The user defined timestamp. + * @param[in] taskid Explicit ID of finished task + */ +void ITTAPI __itt_task_end_overlapped_ex(const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id taskid); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, task_begin_overlapped_ex, (const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id taskid, __itt_id parentid, __itt_string_handle* name)) +ITT_STUBV(ITTAPI, void, task_end_overlapped_ex, (const __itt_domain* domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id taskid)) +#define __itt_task_begin_overlapped_ex(d,x,y,z,a,b) ITTNOTIFY_VOID_D5(task_begin_overlapped_ex,d,x,y,z,a,b) +#define __itt_task_begin_overlapped_ex_ptr ITTNOTIFY_NAME(task_begin_overlapped_ex) +#define __itt_task_end_overlapped_ex(d,x,y,z) ITTNOTIFY_VOID_D3(task_end_overlapped_ex,d,x,y,z) +#define __itt_task_end_overlapped_ex_ptr ITTNOTIFY_NAME(task_end_overlapped_ex) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_task_begin_overlapped_ex(domain,clock_domain,timestamp,taskid,parentid,name) +#define __itt_task_begin_overlapped_ex_ptr 0 +#define __itt_task_end_overlapped_ex(domain,clock_domain,timestamp,taskid) +#define __itt_task_end_overlapped_ex_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_task_begin_overlapped_ex_ptr 0 +#define __itt_task_end_overlapped_ptr 0 +#define __itt_task_end_overlapped_ex_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @defgroup makrs_internal Marks + * @ingroup internal + * Marks group + * @warning Internal API: + * - It is not shipped to outside of Intel + * - It is delivered to internal Intel teams using e-mail or SVN access only + * @{ + */ +/** @brief user mark type */ +typedef int __itt_mark_type; + +/** + * @brief Creates a user mark type with the specified name using char or Unicode string. + * @param[in] name - name of mark to create + * @return Returns a handle to the mark type + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_mark_type ITTAPI __itt_mark_createA(const char *name); +__itt_mark_type ITTAPI __itt_mark_createW(const wchar_t *name); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_mark_create __itt_mark_createW +# define __itt_mark_create_ptr __itt_mark_createW_ptr +#else /* UNICODE */ +# define __itt_mark_create __itt_mark_createA +# define __itt_mark_create_ptr __itt_mark_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_mark_type ITTAPI __itt_mark_create(const char *name); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_mark_type, mark_createA, (const char *name)) +ITT_STUB(ITTAPI, __itt_mark_type, mark_createW, (const wchar_t *name)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_mark_type, mark_create, (const char *name)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_mark_createA ITTNOTIFY_DATA(mark_createA) +#define __itt_mark_createA_ptr ITTNOTIFY_NAME(mark_createA) +#define __itt_mark_createW ITTNOTIFY_DATA(mark_createW) +#define __itt_mark_createW_ptr ITTNOTIFY_NAME(mark_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_create ITTNOTIFY_DATA(mark_create) +#define __itt_mark_create_ptr ITTNOTIFY_NAME(mark_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_mark_createA(name) (__itt_mark_type)0 +#define __itt_mark_createA_ptr 0 +#define __itt_mark_createW(name) (__itt_mark_type)0 +#define __itt_mark_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_create(name) (__itt_mark_type)0 +#define __itt_mark_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_mark_createA_ptr 0 +#define __itt_mark_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Creates a "discrete" user mark type of the specified type and an optional parameter using char or Unicode string. + * + * - The mark of "discrete" type is placed to collection results in case of success. It appears in overtime view(s) as a special tick sign. + * - The call is "synchronous" - function returns after mark is actually added to results. + * - This function is useful, for example, to mark different phases of application + * (beginning of the next mark automatically meand end of current region). + * - Can be used together with "continuous" marks (see below) at the same collection session + * @param[in] mt - mark, created by __itt_mark_create(const char* name) function + * @param[in] parameter - string parameter of mark + * @return Returns zero value in case of success, non-zero value otherwise. + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +int ITTAPI __itt_markA(__itt_mark_type mt, const char *parameter); +int ITTAPI __itt_markW(__itt_mark_type mt, const wchar_t *parameter); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_mark __itt_markW +# define __itt_mark_ptr __itt_markW_ptr +#else /* UNICODE */ +# define __itt_mark __itt_markA +# define __itt_mark_ptr __itt_markA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +int ITTAPI __itt_mark(__itt_mark_type mt, const char *parameter); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, int, markA, (__itt_mark_type mt, const char *parameter)) +ITT_STUB(ITTAPI, int, markW, (__itt_mark_type mt, const wchar_t *parameter)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, mark, (__itt_mark_type mt, const char *parameter)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_markA ITTNOTIFY_DATA(markA) +#define __itt_markA_ptr ITTNOTIFY_NAME(markA) +#define __itt_markW ITTNOTIFY_DATA(markW) +#define __itt_markW_ptr ITTNOTIFY_NAME(markW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark ITTNOTIFY_DATA(mark) +#define __itt_mark_ptr ITTNOTIFY_NAME(mark) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_markA(mt, parameter) (int)0 +#define __itt_markA_ptr 0 +#define __itt_markW(mt, parameter) (int)0 +#define __itt_markW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark(mt, parameter) (int)0 +#define __itt_mark_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_markA_ptr 0 +#define __itt_markW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Use this if necessary to create a "discrete" user event type (mark) for process + * rather then for one thread + * @see int __itt_mark(__itt_mark_type mt, const char* parameter); + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +int ITTAPI __itt_mark_globalA(__itt_mark_type mt, const char *parameter); +int ITTAPI __itt_mark_globalW(__itt_mark_type mt, const wchar_t *parameter); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_mark_global __itt_mark_globalW +# define __itt_mark_global_ptr __itt_mark_globalW_ptr +#else /* UNICODE */ +# define __itt_mark_global __itt_mark_globalA +# define __itt_mark_global_ptr __itt_mark_globalA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +int ITTAPI __itt_mark_global(__itt_mark_type mt, const char *parameter); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, int, mark_globalA, (__itt_mark_type mt, const char *parameter)) +ITT_STUB(ITTAPI, int, mark_globalW, (__itt_mark_type mt, const wchar_t *parameter)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, mark_global, (__itt_mark_type mt, const char *parameter)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_mark_globalA ITTNOTIFY_DATA(mark_globalA) +#define __itt_mark_globalA_ptr ITTNOTIFY_NAME(mark_globalA) +#define __itt_mark_globalW ITTNOTIFY_DATA(mark_globalW) +#define __itt_mark_globalW_ptr ITTNOTIFY_NAME(mark_globalW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_global ITTNOTIFY_DATA(mark_global) +#define __itt_mark_global_ptr ITTNOTIFY_NAME(mark_global) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_mark_globalA(mt, parameter) (int)0 +#define __itt_mark_globalA_ptr 0 +#define __itt_mark_globalW(mt, parameter) (int)0 +#define __itt_mark_globalW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_global(mt, parameter) (int)0 +#define __itt_mark_global_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_mark_globalA_ptr 0 +#define __itt_mark_globalW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_mark_global_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Creates an "end" point for "continuous" mark with specified name. + * + * - Returns zero value in case of success, non-zero value otherwise. + * Also returns non-zero value when preceding "begin" point for the + * mark with the same name failed to be created or not created. + * - The mark of "continuous" type is placed to collection results in + * case of success. It appears in overtime view(s) as a special tick + * sign (different from "discrete" mark) together with line from + * corresponding "begin" mark to "end" mark. + * @note Continuous marks can overlap and be nested inside each other. + * Discrete mark can be nested inside marked region + * @param[in] mt - mark, created by __itt_mark_create(const char* name) function + * @return Returns zero value in case of success, non-zero value otherwise. + */ +int ITTAPI __itt_mark_off(__itt_mark_type mt); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, int, mark_off, (__itt_mark_type mt)) +#define __itt_mark_off ITTNOTIFY_DATA(mark_off) +#define __itt_mark_off_ptr ITTNOTIFY_NAME(mark_off) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_mark_off(mt) (int)0 +#define __itt_mark_off_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_mark_off_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Use this if necessary to create an "end" point for mark of process + * @see int __itt_mark_off(__itt_mark_type mt); + */ +int ITTAPI __itt_mark_global_off(__itt_mark_type mt); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, int, mark_global_off, (__itt_mark_type mt)) +#define __itt_mark_global_off ITTNOTIFY_DATA(mark_global_off) +#define __itt_mark_global_off_ptr ITTNOTIFY_NAME(mark_global_off) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_mark_global_off(mt) (int)0 +#define __itt_mark_global_off_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_mark_global_off_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} marks group */ + +/** + * @defgroup counters_internal Counters + * @ingroup internal + * Counters group + * @{ + */ + + +/** + * @defgroup stitch Stack Stitching + * @ingroup internal + * Stack Stitching group + * @{ + */ +/** + * @brief opaque structure for counter identification + */ +typedef struct ___itt_caller *__itt_caller; + +/** + * @brief Create the stitch point e.g. a point in call stack where other stacks should be stitched to. + * The function returns a unique identifier which is used to match the cut points with corresponding stitch points. + */ +__itt_caller ITTAPI __itt_stack_caller_create(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_caller, stack_caller_create, (void)) +#define __itt_stack_caller_create ITTNOTIFY_DATA(stack_caller_create) +#define __itt_stack_caller_create_ptr ITTNOTIFY_NAME(stack_caller_create) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_stack_caller_create() (__itt_caller)0 +#define __itt_stack_caller_create_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_stack_caller_create_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Destroy the inforamtion about stitch point identified by the pointer previously returned by __itt_stack_caller_create() + */ +void ITTAPI __itt_stack_caller_destroy(__itt_caller id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, stack_caller_destroy, (__itt_caller id)) +#define __itt_stack_caller_destroy ITTNOTIFY_VOID(stack_caller_destroy) +#define __itt_stack_caller_destroy_ptr ITTNOTIFY_NAME(stack_caller_destroy) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_stack_caller_destroy(id) +#define __itt_stack_caller_destroy_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_stack_caller_destroy_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Sets the cut point. Stack from each event which occurs after this call will be cut + * at the same stack level the function was called and stitched to the corresponding stitch point. + */ +void ITTAPI __itt_stack_callee_enter(__itt_caller id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, stack_callee_enter, (__itt_caller id)) +#define __itt_stack_callee_enter ITTNOTIFY_VOID(stack_callee_enter) +#define __itt_stack_callee_enter_ptr ITTNOTIFY_NAME(stack_callee_enter) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_stack_callee_enter(id) +#define __itt_stack_callee_enter_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_stack_callee_enter_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief This function eliminates the cut point which was set by latest __itt_stack_callee_enter(). + */ +void ITTAPI __itt_stack_callee_leave(__itt_caller id); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, stack_callee_leave, (__itt_caller id)) +#define __itt_stack_callee_leave ITTNOTIFY_VOID(stack_callee_leave) +#define __itt_stack_callee_leave_ptr ITTNOTIFY_NAME(stack_callee_leave) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_stack_callee_leave(id) +#define __itt_stack_callee_leave_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_stack_callee_leave_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @} stitch group */ + +/* ***************************************************************************************************************************** */ + +#include + +/** @cond exclude_from_documentation */ +typedef enum __itt_error_code +{ + __itt_error_success = 0, /*!< no error */ + __itt_error_no_module = 1, /*!< module can't be loaded */ + /* %1$s -- library name; win: %2$d -- system error code; unx: %2$s -- system error message. */ + __itt_error_no_symbol = 2, /*!< symbol not found */ + /* %1$s -- library name, %2$s -- symbol name. */ + __itt_error_unknown_group = 3, /*!< unknown group specified */ + /* %1$s -- env var name, %2$s -- group name. */ + __itt_error_cant_read_env = 4, /*!< GetEnvironmentVariable() failed */ + /* %1$s -- env var name, %2$d -- system error. */ + __itt_error_env_too_long = 5, /*!< variable value too long */ + /* %1$s -- env var name, %2$d -- actual length of the var, %3$d -- max allowed length. */ + __itt_error_system = 6 /*!< pthread_mutexattr_init or pthread_mutex_init failed */ + /* %1$s -- function name, %2$d -- errno. */ +} __itt_error_code; + +typedef void (__itt_error_handler_t)(__itt_error_code code, va_list); +__itt_error_handler_t* __itt_set_error_handler(__itt_error_handler_t*); + +const char* ITTAPI __itt_api_version(void); +/** @endcond */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#define __itt_error_handler ITT_JOIN(INTEL_ITTNOTIFY_PREFIX, error_handler) +void __itt_error_handler(__itt_error_code code, va_list args); +extern const int ITTNOTIFY_NAME(err); +#define __itt_err ITTNOTIFY_NAME(err) +ITT_STUB(ITTAPI, const char*, api_version, (void)) +#define __itt_api_version ITTNOTIFY_DATA(api_version) +#define __itt_api_version_ptr ITTNOTIFY_NAME(api_version) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_api_version() (const char*)0 +#define __itt_api_version_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_api_version_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _ITTNOTIFY_PRIVATE_ */ + +#endif /* INTEL_ITTNOTIFY_API_PRIVATE */ diff --git a/external/vtune/linux/include/jitprofiling.h b/external/vtune/linux/include/jitprofiling.h new file mode 100644 index 0000000000..ef6557b4f2 --- /dev/null +++ b/external/vtune/linux/include/jitprofiling.h @@ -0,0 +1,694 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __JITPROFILING_H__ +#define __JITPROFILING_H__ + +/** + * @brief JIT Profiling APIs + * + * The JIT Profiling API is used to report information about just-in-time + * generated code that can be used by performance tools. The user inserts + * calls in the code generator to report information before JIT-compiled + * code goes to execution. This information is collected at runtime and used + * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics + * associated with JIT-compiled code. + * + * These APIs can be used to\n + * - **Profile trace-based and method-based JIT-compiled + * code**. Some examples of environments that you can profile with these APIs: + * dynamic JIT compilation of JavaScript code traces, JIT execution in OpenCL(TM) + * software technology, Java/.NET managed execution environments, and custom + * ISV JIT engines. + * @code + * #include + * + * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) { + * return; + * } + * + * iJIT_Method_Load jmethod = {0}; + * jmethod.method_id = iJIT_GetNewMethodID(); + * jmethod.method_name = "method_name"; + * jmethod.class_file_name = "class_name"; + * jmethod.source_file_name = "source_file_name"; + * jmethod.method_load_address = code_addr; + * jmethod.method_size = code_size; + * + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod); + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL); + * @endcode + * + * * Expected behavior: + * * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an + * already reported method, then such a method becomes invalid and its + * memory region is treated as unloaded. VTune Amplifier displays the metrics + * collected by the method until it is overwritten. + * * If supplied line number information contains multiple source lines for + * the same assembly instruction (code location), then VTune Amplifier picks up + * the first line number. + * * Dynamically generated code can be associated with a module name. + * Use the iJIT_Method_Load_V2 structure.\n + * Clarification of some cases: + * * If you register a function with the same method ID multiple times, + * specifying different module names, then the VTune Amplifier picks up + * the module name registered first. If you want to distinguish the same + * function between different JIT engines, supply different method IDs for + * each function. Other symbolic information (for example, source file) + * can be identical. + * + * - **Analyze split functions** (multiple joint or disjoint code regions + * belonging to the same function) **including re-JIT** + * with potential overlapping of code regions in time, which is common in + * resource-limited environments. + * @code + * #include + * + * unsigned int method_id = iJIT_GetNewMethodID(); + * + * iJIT_Method_Load a = {0}; + * a.method_id = method_id; + * a.method_load_address = 0x100; + * a.method_size = 0x20; + * + * iJIT_Method_Load b = {0}; + * b.method_id = method_id; + * b.method_load_address = 0x200; + * b.method_size = 0x30; + * + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b); + * @endcode + * + * * Expected behaviour: + * * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an + * already reported method, then such a method becomes invalid and + * its memory region is treated as unloaded. + * * All code regions reported with the same method ID are considered as + * belonging to the same method. Symbolic information (method name, + * source file name) will be taken from the first notification, and all + * subsequent notifications with the same method ID will be processed + * only for line number table information. So, the VTune Amplifier will map + * samples to a source line using the line number table from the current + * notification while taking the source file name from the very first one.\n + * Clarification of some cases:\n + * * If you register a second code region with a different source file + * name and the same method ID, then this information will be saved and + * will not be considered as an extension of the first code region, but + * VTune Amplifier will use the source file of the first code region and map + * performance metrics incorrectly. + * * If you register a second code region with the same source file as + * for the first region and the same method ID, then the source file will be + * discarded but VTune Amplifier will map metrics to the source file correctly. + * * If you register a second code region with a null source file and + * the same method ID, then provided line number info will be associated + * with the source file of the first code region. + * + * - **Explore inline functions** including multi-level hierarchy of + * nested inline methods which shows how performance metrics are distributed through them. + * @code + * #include + * + * // method_id parent_id + * // [-- c --] 3000 2000 + * // [---- d -----] 2001 1000 + * // [---- b ----] 2000 1000 + * // [------------ a ----------------] 1000 n/a + * + * iJIT_Method_Load a = {0}; + * a.method_id = 1000; + * + * iJIT_Method_Inline_Load b = {0}; + * b.method_id = 2000; + * b.parent_method_id = 1000; + * + * iJIT_Method_Inline_Load c = {0}; + * c.method_id = 3000; + * c.parent_method_id = 2000; + * + * iJIT_Method_Inline_Load d = {0}; + * d.method_id = 2001; + * d.parent_method_id = 1000; + * + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a); + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b); + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c); + * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d); + * @endcode + * + * * Requirements: + * * Each inline (iJIT_Method_Inline_Load) method should be associated + * with two method IDs: one for itself; one for its immediate parent. + * * Address regions of inline methods of the same parent method cannot + * overlap each other. + * * Execution of the parent method must not be started until it and all + * its inline methods are reported. + * * Expected behaviour: + * * In case of nested inline methods an order of + * iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important. + * * If any event overwrites either inline method or top parent method, + * then the parent, including inline methods, becomes invalid and its memory + * region is treated as unloaded. + * + * **Life time of allocated data**\n + * The client sends an event notification to the agent with event-specific + * data, which is a structure. The pointers in the structure refer to memory + * allocated by the client, which responsible for releasing it. The pointers are + * used by the iJIT_NotifyEvent method to copy client's data in a trace file, + * and they are not used after the iJIT_NotifyEvent method returns. + */ + +/** + * @defgroup jitapi JIT Profiling + * @ingroup internal + * @{ + */ + +/** + * @brief Enumerator for the types of notifications + */ +typedef enum iJIT_jvm_event +{ + iJVM_EVENT_TYPE_SHUTDOWN = 2, /**<\brief Send this to shutdown the agent. + * Use NULL for event data. */ + + iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**<\brief Send when dynamic code is + * JIT compiled and loaded into + * memory by the JIT engine, but + * before the code is executed. + * Use iJIT_Method_Load as event + * data. */ +/** @cond exclude_from_documentation */ + iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**<\brief Send when compiled dynamic + * code is being unloaded from memory. + * Use iJIT_Method_Load as event data.*/ +/** @endcond */ + + iJVM_EVENT_TYPE_METHOD_UPDATE, /**<\brief Send to provide new content for + * a previously reported dynamic code. + * The previous content will be invalidated + * starting from the time of the notification. + * Use iJIT_Method_Load as event data but + * required fields are following: + * - method_id identify the code to update. + * - method_load_address specify start address + * within identified code range + * where update should be started. + * - method_size specify length of updated code + * range. */ + + + iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**<\brief Send when an inline dynamic + * code is JIT compiled and loaded + * into memory by the JIT engine, + * but before the parent code region + * starts executing. + * Use iJIT_Method_Inline_Load as event data.*/ + +/** @cond exclude_from_documentation */ + iJVM_EVENT_TYPE_METHOD_UPDATE_V2, +/** @endcond */ + + iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 = 21, /**<\brief Send when a dynamic code is + * JIT compiled and loaded into + * memory by the JIT engine, but + * before the code is executed. + * Use iJIT_Method_Load_V2 as event data. */ + + iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 /**<\brief Send when a dynamic code is + * JIT compiled and loaded into + * memory by the JIT engine, but + * before the code is executed. + * Use iJIT_Method_Load_V3 as event data. */ +} iJIT_JVM_EVENT; + +/** + * @brief Enumerator for the agent's mode + */ +typedef enum _iJIT_IsProfilingActiveFlags +{ + iJIT_NOTHING_RUNNING = 0x0000, /**<\brief The agent is not running; + * iJIT_NotifyEvent calls will + * not be processed. */ + iJIT_SAMPLING_ON = 0x0001, /**<\brief The agent is running and + * ready to process notifications. */ +} iJIT_IsProfilingActiveFlags; + +/** + * @brief Description of a single entry in the line number information of a code region. + * @details A table of line number entries gives information about how the reported code region + * is mapped to source file. + * Intel(R) VTune(TM) Amplifier uses line number information to attribute + * the samples (virtual address) to a line number. \n + * It is acceptable to report different code addresses for the same source line: + * @code + * Offset LineNumber + * 1 2 + * 12 4 + * 15 2 + * 18 1 + * 21 30 + * + * VTune Amplifier constructs the following table using the client data + * + * Code subrange Line number + * 0-1 2 + * 1-12 4 + * 12-15 2 + * 15-18 1 + * 18-21 30 + * @endcode + */ +typedef struct _LineNumberInfo +{ + unsigned int Offset; /**<\brief Offset from the begining of the code region. */ + unsigned int LineNumber; /**<\brief Matching source line number offset (from beginning of source file). */ + +} *pLineNumberInfo, LineNumberInfo; + +/** + * @brief Enumerator for the code architecture. + */ +typedef enum _iJIT_CodeArchitecture +{ + iJIT_CA_NATIVE = 0, /**<\brief Native to the process architecture that is calling it. */ + + iJIT_CA_32, /**<\brief 32-bit machine code. */ + + iJIT_CA_64 /**<\brief 64-bit machine code. */ + +} iJIT_CodeArchitecture; + +#pragma pack(push, 8) + +/** + * @brief Description of a JIT-compiled method + * @details When you use the iJIT_Method_Load structure to describe + * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED + * as an event type to report it. + */ +typedef struct _iJIT_Method_Load +{ + unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. + * You must either use the API function + * iJIT_GetNewMethodID to get a valid and unique + * method ID, or else manage ID uniqueness + * and correct range by yourself.\n + * You must use the same method ID for all code + * regions of the same method, otherwise different + * method IDs specify different methods. */ + + char* method_name; /**<\brief The name of the method. It can be optionally + * prefixed with its class name and appended with + * its complete signature. Can't be NULL. */ + + void* method_load_address; /**<\brief The start virtual address of the method code + * region. If NULL, data provided with + * event are not accepted. */ + + unsigned int method_size; /**<\brief The code size of the method in memory. + * If 0, then data provided with the event are not + * accepted. */ + + unsigned int line_number_size; /**<\brief The number of entries in the line number + * table.0 if none. */ + + pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info + * array. Can be NULL if + * line_number_size is 0. See + * LineNumberInfo Structure for a + * description of a single entry in + * the line number info array */ + + unsigned int class_id; /**<\brief This field is obsolete. */ + + char* class_file_name; /**<\brief Class name. Can be NULL.*/ + + char* source_file_name; /**<\brief Source file name. Can be NULL.*/ + +} *piJIT_Method_Load, iJIT_Method_Load; + +/** + * @brief Description of a JIT-compiled method + * @details When you use the iJIT_Method_Load_V2 structure to describe + * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 + * as an event type to report it. + */ +typedef struct _iJIT_Method_Load_V2 +{ + unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. + * You must either use the API function + * iJIT_GetNewMethodID to get a valid and unique + * method ID, or else manage ID uniqueness + * and correct range by yourself.\n + * You must use the same method ID for all code + * regions of the same method, otherwise different + * method IDs specify different methods. */ + + char* method_name; /**<\brief The name of the method. It can be optionally + * prefixed with its class name and appended with + * its complete signature. Can't be NULL. */ + + void* method_load_address; /**<\brief The start virtual address of the method code + * region. If NULL, then data provided with the + * event are not accepted. */ + + unsigned int method_size; /**<\brief The code size of the method in memory. + * If 0, then data provided with the event are not + * accepted. */ + + unsigned int line_number_size; /**<\brief The number of entries in the line number + * table. 0 if none. */ + + pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info + * array. Can be NULL if + * line_number_size is 0. See + * LineNumberInfo Structure for a + * description of a single entry in + * the line number info array. */ + + char* class_file_name; /**<\brief Class name. Can be NULL. */ + + char* source_file_name; /**<\brief Source file name. Can be NULL. */ + + char* module_name; /**<\brief Module name. Can be NULL. + The module name can be useful for distinguishing among + different JIT engines. VTune Amplifier will display + reported methods grouped by specific module. */ + +} *piJIT_Method_Load_V2, iJIT_Method_Load_V2; + +/** + * @brief Description of a JIT-compiled method + * @details The iJIT_Method_Load_V3 structure is the same as iJIT_Method_Load_V2 + * with a newly introduced 'arch' field that specifies architecture of the code region. + * When you use the iJIT_Method_Load_V3 structure to describe + * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 + * as an event type to report it. + */ +typedef struct _iJIT_Method_Load_V3 +{ + unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. + * You must either use the API function + * iJIT_GetNewMethodID to get a valid and unique + * method ID, or manage ID uniqueness + * and correct range by yourself.\n + * You must use the same method ID for all code + * regions of the same method, otherwise they are + * treated as regions of different methods. */ + + char* method_name; /**<\brief The name of the method. It can be optionally + * prefixed with its class name and appended with + * its complete signature. Cannot be NULL. */ + + void* method_load_address; /**<\brief The start virtual address of the method code + * region. If NULL, then data provided with the + * event are not accepted. */ + + unsigned int method_size; /**<\brief The code size of the method in memory. + * If 0, then data provided with the event are not + * accepted. */ + + unsigned int line_number_size; /**<\brief The number of entries in the line number + * table. 0 if none. */ + + pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info + * array. Can be NULL if + * line_number_size is 0. See + * LineNumberInfo Structure for a + * description of a single entry in + * the line number info array. */ + + char* class_file_name; /**<\brief Class name. Can be NULL. */ + + char* source_file_name; /**<\brief Source file name. Can be NULL. */ + + char* module_name; /**<\brief Module name. Can be NULL. + * The module name can be useful for distinguishing among + * different JIT engines. VTune Amplifier will display + * reported methods grouped by specific module. */ + + iJIT_CodeArchitecture module_arch; /**<\brief Architecture of the method's code region. + * By default, it is the same as the process + * architecture that is calling it. + * For example, you can use it if your 32-bit JIT + * engine generates 64-bit code. + * + * If JIT engine reports both 32-bit and 64-bit types + * of methods then VTune Amplifier splits the methods + * with the same module name but with different + * architectures in two different modules. VTune Amplifier + * modifies the original name provided with a 64-bit method + * version by ending it with '(64)' */ + +} *piJIT_Method_Load_V3, iJIT_Method_Load_V3; + +/** + * @brief Description of an inline JIT-compiled method + * @details When you use the_iJIT_Method_Inline_Load structure to describe + * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED + * as an event type to report it. + */ +typedef struct _iJIT_Method_Inline_Load +{ + unsigned int method_id; /**<\brief Unique method ID. Cannot be 0. + * You must either use the API function + * iJIT_GetNewMethodID to get a valid and unique + * method ID, or else manage ID uniqueness + * and correct range by yourself. */ + + unsigned int parent_method_id; /**<\brief Unique immediate parent's method ID. + * Cannot be 0. + * You must either use the API function + * iJIT_GetNewMethodID to get a valid and unique + * method ID, or else manage ID uniqueness + * and correct range by yourself. */ + + char* method_name; /**<\brief The name of the method. It can be optionally + * prefixed with its class name and appended with + * its complete signature. Can't be NULL. */ + + void* method_load_address; /** <\brief The virtual address on which the method + * is inlined. If NULL, then data provided with + * the event are not accepted. */ + + unsigned int method_size; /**<\brief The code size of the method in memory. + * If 0, then data provided with the event are not + * accepted. */ + + unsigned int line_number_size; /**<\brief The number of entries in the line number + * table. 0 if none. */ + + pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info + * array. Can be NULL if + * line_number_size is 0. See + * LineNumberInfo Structure for a + * description of a single entry in + * the line number info array */ + + char* class_file_name; /**<\brief Class name. Can be NULL.*/ + + char* source_file_name; /**<\brief Source file name. Can be NULL.*/ + +} *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load; + +/** @cond exclude_from_documentation */ +/** + * @brief Description of a segment type + * @details Use the segment type to specify a type of data supplied + * with the iJVM_EVENT_TYPE_METHOD_UPDATE_V2 event to be applied to + * a certain code trace. + */ +typedef enum _iJIT_SegmentType +{ + iJIT_CT_UNKNOWN = 0, + + iJIT_CT_CODE, /**<\brief Executable code. */ + + iJIT_CT_DATA, /**<\brief Data (not executable code). + * VTune Amplifier uses the format string + * (see iJIT_Method_Update) to represent + * this data in the VTune Amplifier GUI */ + + iJIT_CT_KEEP, /**<\brief Use the previous markup for the trace. + * Can be used for the following + * iJVM_EVENT_TYPE_METHOD_UPDATE_V2 events, + * if the type of the previously reported segment + * type is the same. */ + iJIT_CT_EOF +} iJIT_SegmentType; + +/** + * @brief Description of a dynamic update of the content within JIT-compiled method + * @details The JIT engine may generate the methods that are updated at runtime + * partially by mixed (data + executable code) content. When you use the iJIT_Method_Update + * structure to describe the update of the content within a JIT-compiled method, + * use iJVM_EVENT_TYPE_METHOD_UPDATE_V2 as an event type to report it. + * + * On the first Update event, VTune Amplifier copies the original code range reported by + * the iJVM_EVENT_TYPE_METHOD_LOAD event, then modifies it with the supplied bytes and + * adds the modified range to the original method. For next update events, VTune Amplifier + * does the same but it uses the latest modified version of a code region for update. + * Eventually, VTune Amplifier GUI displays multiple code ranges for the method reported by + * the iJVM_EVENT_TYPE_METHOD_LOAD event. + * Notes: + * - Multiple update events with different types for the same trace are allowed + * but they must be reported for the same code ranges. + * Example, + * @code + * [-- data---] Allowed + * [-- code --] Allowed + * [code] Ignored + * [-- data---] Allowed + * [-- code --] Allowed + * [------------ trace ---------] + * @endcode + * - The types of previously reported events can be changed but they must be reported + * for the same code ranges. + * Example, + * @code + * [-- data---] Allowed + * [-- code --] Allowed + * [-- data---] Allowed + * [-- code --] Allowed + * [------------ trace ---------] + * @endcode + */ + +typedef struct _iJIT_Method_Update +{ + void* load_address; /**<\brief Start address of the update within a method */ + + unsigned int size; /**<\brief The update size */ + + iJIT_SegmentType type; /**<\brief Type of the update */ + + const char* data_format; /**<\brief C string that contains a format string + * that follows the same specifications as format in printf. + * The format string is used for iJIT_CT_CODE only + * and cannot be NULL. + * Format can be changed on the fly. */ +} *piJIT_Method_Update, iJIT_Method_Update; + +/** @endcond */ + +#pragma pack(pop) + +/** @cond exclude_from_documentation */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef CDECL +# if defined WIN32 || defined _WIN32 +# define CDECL __cdecl +# else /* defined WIN32 || defined _WIN32 */ +# if defined _M_IX86 || defined __i386__ +# define CDECL __attribute__ ((cdecl)) +# else /* _M_IX86 || __i386__ */ +# define CDECL /* actual only on x86_64 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* defined WIN32 || defined _WIN32 */ +#endif /* CDECL */ + +#define JITAPI CDECL +/** @endcond */ + +/** + * @brief Generates a new unique method ID. + * + * You must use this API to obtain unique and valid method IDs for methods or + * traces reported to the agent if you don't have your own mechanism to generate + * unique method IDs. + * + * @return a new unique method ID. When out of unique method IDs, this API + * returns 0, which is not an accepted value. + */ +unsigned int JITAPI iJIT_GetNewMethodID(void); + +/** + * @brief Returns the current mode of the agent. + * + * @return iJIT_SAMPLING_ON, indicating that agent is running, or + * iJIT_NOTHING_RUNNING if no agent is running. + */ +iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void); + +/** + * @brief Reports infomation about JIT-compiled code to the agent. + * + * The reported information is used to attribute samples obtained from any + * Intel(R) VTune(TM) Amplifier collector. This API needs to be called + * after JIT compilation and before the first entry into the JIT-compiled + * code. + * + * @param[in] event_type - type of the data sent to the agent + * @param[in] EventSpecificData - pointer to event-specific data + * + * @returns 1 on success, otherwise 0. + */ +int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +/** @endcond */ + +/** @} jitapi group */ + +#endif /* __JITPROFILING_H__ */ diff --git a/external/vtune/linux/include/legacy/ittnotify.h b/external/vtune/linux/include/legacy/ittnotify.h new file mode 100644 index 0000000000..b40a5f9244 --- /dev/null +++ b/external/vtune/linux/include/legacy/ittnotify.h @@ -0,0 +1,1039 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _LEGACY_ITTNOTIFY_H_ +#define _LEGACY_ITTNOTIFY_H_ + +/** + * @file + * @brief Legacy User API functions and types + */ + +/** @cond exclude_from_documentation */ +#ifndef ITT_OS_WIN +# define ITT_OS_WIN 1 +#endif /* ITT_OS_WIN */ + +#ifndef ITT_OS_LINUX +# define ITT_OS_LINUX 2 +#endif /* ITT_OS_LINUX */ + +#ifndef ITT_OS_MAC +# define ITT_OS_MAC 3 +#endif /* ITT_OS_MAC */ + +#ifndef ITT_OS_FREEBSD +# define ITT_OS_FREEBSD 4 +#endif /* ITT_OS_FREEBSD */ + +#ifndef ITT_OS +# if defined WIN32 || defined _WIN32 +# define ITT_OS ITT_OS_WIN +# elif defined( __APPLE__ ) && defined( __MACH__ ) +# define ITT_OS ITT_OS_MAC +# elif defined( __FreeBSD__ ) +# define ITT_OS ITT_OS_FREEBSD +# else +# define ITT_OS ITT_OS_LINUX +# endif +#endif /* ITT_OS */ + +#ifndef ITT_PLATFORM_WIN +# define ITT_PLATFORM_WIN 1 +#endif /* ITT_PLATFORM_WIN */ + +#ifndef ITT_PLATFORM_POSIX +# define ITT_PLATFORM_POSIX 2 +#endif /* ITT_PLATFORM_POSIX */ + +#ifndef ITT_PLATFORM_MAC +# define ITT_PLATFORM_MAC 3 +#endif /* ITT_PLATFORM_MAC */ + +#ifndef ITT_PLATFORM_FREEBSD +# define ITT_PLATFORM_FREEBSD 4 +#endif /* ITT_PLATFORM_FREEBSD */ + +#ifndef ITT_PLATFORM +# if ITT_OS==ITT_OS_WIN +# define ITT_PLATFORM ITT_PLATFORM_WIN +# elif ITT_OS==ITT_OS_MAC +# define ITT_PLATFORM ITT_PLATFORM_MAC +# elif ITT_OS==ITT_OS_FREEBSD +# define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# else +# define ITT_PLATFORM ITT_PLATFORM_POSIX +# endif +#endif /* ITT_PLATFORM */ + +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#include +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#if defined(UNICODE) || defined(_UNICODE) +#include +#endif /* UNICODE || _UNICODE */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef CDECL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define CDECL __cdecl +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define CDECL __attribute__ ((cdecl)) +# else /* _M_IX86 || __i386__ */ +# define CDECL /* actual only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* CDECL */ + +#ifndef STDCALL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define STDCALL __stdcall +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define STDCALL __attribute__ ((stdcall)) +# else /* _M_IX86 || __i386__ */ +# define STDCALL /* supported only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* STDCALL */ + +#define ITTAPI CDECL +#define LIBITTAPI CDECL + +/* TODO: Temporary for compatibility! */ +#define ITTAPI_CALL CDECL +#define LIBITTAPI_CALL CDECL + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +/* use __forceinline (VC++ specific) */ +#define ITT_INLINE __forceinline +#define ITT_INLINE_ATTRIBUTE /* nothing */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/* + * Generally, functions are not inlined unless optimization is specified. + * For functions declared inline, this attribute inlines the function even + * if no optimization level was specified. + */ +#ifdef __STRICT_ANSI__ +#define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) +#else /* __STRICT_ANSI__ */ +#define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) +#endif /* __STRICT_ANSI__ */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/** @endcond */ + +/** @cond exclude_from_documentation */ +/* Helper macro for joining tokens */ +#define ITT_JOIN_AUX(p,n) p##n +#define ITT_JOIN(p,n) ITT_JOIN_AUX(p,n) + +#ifdef ITT_MAJOR +#undef ITT_MAJOR +#endif +#ifdef ITT_MINOR +#undef ITT_MINOR +#endif +#define ITT_MAJOR 3 +#define ITT_MINOR 0 + +/* Standard versioning of a token with major and minor version numbers */ +#define ITT_VERSIONIZE(x) \ + ITT_JOIN(x, \ + ITT_JOIN(_, \ + ITT_JOIN(ITT_MAJOR, \ + ITT_JOIN(_, ITT_MINOR)))) + +#ifndef INTEL_ITTNOTIFY_PREFIX +# define INTEL_ITTNOTIFY_PREFIX __itt_ +#endif /* INTEL_ITTNOTIFY_PREFIX */ +#ifndef INTEL_ITTNOTIFY_POSTFIX +# define INTEL_ITTNOTIFY_POSTFIX _ptr_ +#endif /* INTEL_ITTNOTIFY_POSTFIX */ + +#define ITTNOTIFY_NAME_AUX(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n) +#define ITTNOTIFY_NAME(n) ITT_VERSIONIZE(ITTNOTIFY_NAME_AUX(ITT_JOIN(n,INTEL_ITTNOTIFY_POSTFIX))) + +#define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) +#define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) + +#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) + +#ifdef ITT_STUB +#undef ITT_STUB +#endif +#ifdef ITT_STUBV +#undef ITT_STUBV +#endif +#define ITT_STUBV(api,type,name,args) \ + typedef type (api* ITT_JOIN(ITTNOTIFY_NAME(name),_t)) args; \ + extern ITT_JOIN(ITTNOTIFY_NAME(name),_t) ITTNOTIFY_NAME(name); +#define ITT_STUB ITT_STUBV +/** @endcond */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @defgroup legacy Legacy API + * @{ + * @} + */ + +/** + * @defgroup legacy_control Collection Control + * @ingroup legacy + * General behavior: application continues to run, but no profiling information is being collected + * + * Pausing occurs not only for the current thread but for all process as well as spawned processes + * - Intel(R) Parallel Inspector and Intel(R) Inspector XE: + * - Does not analyze or report errors that involve memory access. + * - Other errors are reported as usual. Pausing data collection in + * Intel(R) Parallel Inspector and Intel(R) Inspector XE + * only pauses tracing and analyzing memory access. + * It does not pause tracing or analyzing threading APIs. + * . + * - Intel(R) Parallel Amplifier and Intel(R) VTune(TM) Amplifier XE: + * - Does continue to record when new threads are started. + * . + * - Other effects: + * - Possible reduction of runtime overhead. + * . + * @{ + */ +#ifndef _ITTNOTIFY_H_ +/** @brief Pause collection */ +void ITTAPI __itt_pause(void); +/** @brief Resume collection */ +void ITTAPI __itt_resume(void); +/** @brief Detach collection */ +void ITTAPI __itt_detach(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, pause, (void)) +ITT_STUBV(ITTAPI, void, resume, (void)) +ITT_STUBV(ITTAPI, void, detach, (void)) +#define __itt_pause ITTNOTIFY_VOID(pause) +#define __itt_pause_ptr ITTNOTIFY_NAME(pause) +#define __itt_resume ITTNOTIFY_VOID(resume) +#define __itt_resume_ptr ITTNOTIFY_NAME(resume) +#define __itt_detach ITTNOTIFY_VOID(detach) +#define __itt_detach_ptr ITTNOTIFY_NAME(detach) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_pause() +#define __itt_pause_ptr 0 +#define __itt_resume() +#define __itt_resume_ptr 0 +#define __itt_detach() +#define __itt_detach_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_pause_ptr 0 +#define __itt_resume_ptr 0 +#define __itt_detach_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +#endif /* _ITTNOTIFY_H_ */ +/** @} legacy_control group */ + +/** + * @defgroup legacy_threads Threads + * @ingroup legacy + * Threads group + * @warning Legacy API + * @{ + */ +/** + * @deprecated Legacy API + * @brief Set name to be associated with thread in analysis GUI. + * @return __itt_err upon failure (name or namelen being null,name and namelen mismatched) + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +int LIBITTAPI __itt_thr_name_setA(const char *name, int namelen); +int LIBITTAPI __itt_thr_name_setW(const wchar_t *name, int namelen); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_thr_name_set __itt_thr_name_setW +# define __itt_thr_name_set_ptr __itt_thr_name_setW_ptr +#else +# define __itt_thr_name_set __itt_thr_name_setA +# define __itt_thr_name_set_ptr __itt_thr_name_setA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +int LIBITTAPI __itt_thr_name_set(const char *name, int namelen); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, int, thr_name_setA, (const char *name, int namelen)) +ITT_STUB(LIBITTAPI, int, thr_name_setW, (const wchar_t *name, int namelen)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, int, thr_name_set, (const char *name, int namelen)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_thr_name_setA ITTNOTIFY_DATA(thr_name_setA) +#define __itt_thr_name_setA_ptr ITTNOTIFY_NAME(thr_name_setA) +#define __itt_thr_name_setW ITTNOTIFY_DATA(thr_name_setW) +#define __itt_thr_name_setW_ptr ITTNOTIFY_NAME(thr_name_setW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_thr_name_set ITTNOTIFY_DATA(thr_name_set) +#define __itt_thr_name_set_ptr ITTNOTIFY_NAME(thr_name_set) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_thr_name_setA(name, namelen) +#define __itt_thr_name_setA_ptr 0 +#define __itt_thr_name_setW(name, namelen) +#define __itt_thr_name_setW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_thr_name_set(name, namelen) +#define __itt_thr_name_set_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_thr_name_setA_ptr 0 +#define __itt_thr_name_setW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_thr_name_set_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Mark current thread as ignored from this point on, for the duration of its existence. + */ +void LIBITTAPI __itt_thr_ignore(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, thr_ignore, (void)) +#define __itt_thr_ignore ITTNOTIFY_VOID(thr_ignore) +#define __itt_thr_ignore_ptr ITTNOTIFY_NAME(thr_ignore) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_thr_ignore() +#define __itt_thr_ignore_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_thr_ignore_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} legacy_threads group */ + +/** + * @defgroup legacy_sync Synchronization + * @ingroup legacy + * Synchronization group + * @warning Legacy API + * @{ + */ +/** + * @hideinitializer + * @brief possible value of attribute argument for sync object type + */ +#define __itt_attr_barrier 1 + +/** + * @hideinitializer + * @brief possible value of attribute argument for sync object type + */ +#define __itt_attr_mutex 2 + +/** + * @deprecated Legacy API + * @brief Assign a name to a sync object using char or Unicode string + * @param[in] addr - pointer to the sync object. You should use a real pointer to your object + * to make sure that the values don't clash with other object addresses + * @param[in] objtype - null-terminated object type string. If NULL is passed, the object will + * be assumed to be of generic "User Synchronization" type + * @param[in] objname - null-terminated object name string. If NULL, no name will be assigned + * to the object -- you can use the __itt_sync_rename call later to assign + * the name + * @param[in] attribute - one of [#__itt_attr_barrier, #__itt_attr_mutex] values which defines the + * exact semantics of how prepare/acquired/releasing calls work. + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +void ITTAPI __itt_sync_set_nameA(void *addr, const char *objtype, const char *objname, int attribute); +void ITTAPI __itt_sync_set_nameW(void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_sync_set_name __itt_sync_set_nameW +# define __itt_sync_set_name_ptr __itt_sync_set_nameW_ptr +#else /* UNICODE */ +# define __itt_sync_set_name __itt_sync_set_nameA +# define __itt_sync_set_name_ptr __itt_sync_set_nameA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +void ITTAPI __itt_sync_set_name(void *addr, const char* objtype, const char* objname, int attribute); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, sync_set_nameA, (void *addr, const char *objtype, const char *objname, int attribute)) +ITT_STUBV(ITTAPI, void, sync_set_nameW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, sync_set_name, (void *addr, const char *objtype, const char *objname, int attribute)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_set_nameA ITTNOTIFY_VOID(sync_set_nameA) +#define __itt_sync_set_nameA_ptr ITTNOTIFY_NAME(sync_set_nameA) +#define __itt_sync_set_nameW ITTNOTIFY_VOID(sync_set_nameW) +#define __itt_sync_set_nameW_ptr ITTNOTIFY_NAME(sync_set_nameW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_set_name ITTNOTIFY_VOID(sync_set_name) +#define __itt_sync_set_name_ptr ITTNOTIFY_NAME(sync_set_name) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_set_nameA(addr, objtype, objname, attribute) +#define __itt_sync_set_nameA_ptr 0 +#define __itt_sync_set_nameW(addr, objtype, objname, attribute) +#define __itt_sync_set_nameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_set_name(addr, objtype, objname, attribute) +#define __itt_sync_set_name_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_sync_set_nameA_ptr 0 +#define __itt_sync_set_nameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_sync_set_name_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Assign a name and type to a sync object using char or Unicode string + * @param[in] addr - pointer to the sync object. You should use a real pointer to your object + * to make sure that the values don't clash with other object addresses + * @param[in] objtype - null-terminated object type string. If NULL is passed, the object will + * be assumed to be of generic "User Synchronization" type + * @param[in] objname - null-terminated object name string. If NULL, no name will be assigned + * to the object -- you can use the __itt_sync_rename call later to assign + * the name + * @param[in] typelen, namelen - a length of string for appropriate objtype and objname parameter + * @param[in] attribute - one of [#__itt_attr_barrier, #__itt_attr_mutex] values which defines the + * exact semantics of how prepare/acquired/releasing calls work. + * @return __itt_err upon failure (name or namelen being null,name and namelen mismatched) + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +int LIBITTAPI __itt_notify_sync_nameA(void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute); +int LIBITTAPI __itt_notify_sync_nameW(void *addr, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_notify_sync_name __itt_notify_sync_nameW +#else +# define __itt_notify_sync_name __itt_notify_sync_nameA +#endif +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +int LIBITTAPI __itt_notify_sync_name(void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, int, notify_sync_nameA, (void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute)) +ITT_STUB(LIBITTAPI, int, notify_sync_nameW, (void *addr, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, int, notify_sync_name, (void *addr, const char *objtype, int typelen, const char *objname, int namelen, int attribute)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_notify_sync_nameA ITTNOTIFY_DATA(notify_sync_nameA) +#define __itt_notify_sync_nameA_ptr ITTNOTIFY_NAME(notify_sync_nameA) +#define __itt_notify_sync_nameW ITTNOTIFY_DATA(notify_sync_nameW) +#define __itt_notify_sync_nameW_ptr ITTNOTIFY_NAME(notify_sync_nameW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_notify_sync_name ITTNOTIFY_DATA(notify_sync_name) +#define __itt_notify_sync_name_ptr ITTNOTIFY_NAME(notify_sync_name) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_notify_sync_nameA(addr, objtype, typelen, objname, namelen, attribute) +#define __itt_notify_sync_nameA_ptr 0 +#define __itt_notify_sync_nameW(addr, objtype, typelen, objname, namelen, attribute) +#define __itt_notify_sync_nameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_notify_sync_name(addr, objtype, typelen, objname, namelen, attribute) +#define __itt_notify_sync_name_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_notify_sync_nameA_ptr 0 +#define __itt_notify_sync_nameW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_notify_sync_name_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Enter spin loop on user-defined sync object + */ +void LIBITTAPI __itt_notify_sync_prepare(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, notify_sync_prepare, (void *addr)) +#define __itt_notify_sync_prepare ITTNOTIFY_VOID(notify_sync_prepare) +#define __itt_notify_sync_prepare_ptr ITTNOTIFY_NAME(notify_sync_prepare) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_notify_sync_prepare(addr) +#define __itt_notify_sync_prepare_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_notify_sync_prepare_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Quit spin loop without acquiring spin object + */ +void LIBITTAPI __itt_notify_sync_cancel(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, notify_sync_cancel, (void *addr)) +#define __itt_notify_sync_cancel ITTNOTIFY_VOID(notify_sync_cancel) +#define __itt_notify_sync_cancel_ptr ITTNOTIFY_NAME(notify_sync_cancel) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_notify_sync_cancel(addr) +#define __itt_notify_sync_cancel_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_notify_sync_cancel_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Successful spin loop completion (sync object acquired) + */ +void LIBITTAPI __itt_notify_sync_acquired(void *addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, notify_sync_acquired, (void *addr)) +#define __itt_notify_sync_acquired ITTNOTIFY_VOID(notify_sync_acquired) +#define __itt_notify_sync_acquired_ptr ITTNOTIFY_NAME(notify_sync_acquired) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_notify_sync_acquired(addr) +#define __itt_notify_sync_acquired_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_notify_sync_acquired_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Start sync object releasing code. Is called before the lock release call. + */ +void LIBITTAPI __itt_notify_sync_releasing(void* addr); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, notify_sync_releasing, (void *addr)) +#define __itt_notify_sync_releasing ITTNOTIFY_VOID(notify_sync_releasing) +#define __itt_notify_sync_releasing_ptr ITTNOTIFY_NAME(notify_sync_releasing) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_notify_sync_releasing(addr) +#define __itt_notify_sync_releasing_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_notify_sync_releasing_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} legacy_sync group */ + +#ifndef _ITTNOTIFY_H_ +/** + * @defgroup legacy_events Events + * @ingroup legacy + * Events group + * @{ + */ + +/** @brief user event type */ +typedef int __itt_event; + +/** + * @brief Create an event notification + * @note name or namelen being null/name and namelen not matching, user event feature not enabled + * @return non-zero event identifier upon success and __itt_err otherwise + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_event LIBITTAPI __itt_event_createA(const char *name, int namelen); +__itt_event LIBITTAPI __itt_event_createW(const wchar_t *name, int namelen); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_event_create __itt_event_createW +# define __itt_event_create_ptr __itt_event_createW_ptr +#else +# define __itt_event_create __itt_event_createA +# define __itt_event_create_ptr __itt_event_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_event LIBITTAPI __itt_event_create(const char *name, int namelen); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, __itt_event, event_createA, (const char *name, int namelen)) +ITT_STUB(LIBITTAPI, __itt_event, event_createW, (const wchar_t *name, int namelen)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, __itt_event, event_create, (const char *name, int namelen)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_event_createA ITTNOTIFY_DATA(event_createA) +#define __itt_event_createA_ptr ITTNOTIFY_NAME(event_createA) +#define __itt_event_createW ITTNOTIFY_DATA(event_createW) +#define __itt_event_createW_ptr ITTNOTIFY_NAME(event_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_event_create ITTNOTIFY_DATA(event_create) +#define __itt_event_create_ptr ITTNOTIFY_NAME(event_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_event_createA(name, namelen) (__itt_event)0 +#define __itt_event_createA_ptr 0 +#define __itt_event_createW(name, namelen) (__itt_event)0 +#define __itt_event_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_event_create(name, namelen) (__itt_event)0 +#define __itt_event_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_event_createA_ptr 0 +#define __itt_event_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_event_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an event occurrence. + * @return __itt_err upon failure (invalid event id/user event feature not enabled) + */ +int LIBITTAPI __itt_event_start(__itt_event event); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(LIBITTAPI, int, event_start, (__itt_event event)) +#define __itt_event_start ITTNOTIFY_DATA(event_start) +#define __itt_event_start_ptr ITTNOTIFY_NAME(event_start) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_event_start(event) (int)0 +#define __itt_event_start_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_event_start_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @brief Record an event end occurrence. + * @note It is optional if events do not have durations. + * @return __itt_err upon failure (invalid event id/user event feature not enabled) + */ +int LIBITTAPI __itt_event_end(__itt_event event); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(LIBITTAPI, int, event_end, (__itt_event event)) +#define __itt_event_end ITTNOTIFY_DATA(event_end) +#define __itt_event_end_ptr ITTNOTIFY_NAME(event_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_event_end(event) (int)0 +#define __itt_event_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_event_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} legacy_events group */ +#endif /* _ITTNOTIFY_H_ */ + +/** + * @defgroup legacy_memory Memory Accesses + * @ingroup legacy + */ + +/** + * @deprecated Legacy API + * @brief Inform the tool of memory accesses on reading + */ +void LIBITTAPI __itt_memory_read(void *addr, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, memory_read, (void *addr, size_t size)) +#define __itt_memory_read ITTNOTIFY_VOID(memory_read) +#define __itt_memory_read_ptr ITTNOTIFY_NAME(memory_read) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_memory_read(addr, size) +#define __itt_memory_read_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_memory_read_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Inform the tool of memory accesses on writing + */ +void LIBITTAPI __itt_memory_write(void *addr, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, memory_write, (void *addr, size_t size)) +#define __itt_memory_write ITTNOTIFY_VOID(memory_write) +#define __itt_memory_write_ptr ITTNOTIFY_NAME(memory_write) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_memory_write(addr, size) +#define __itt_memory_write_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_memory_write_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief Inform the tool of memory accesses on updating + */ +void LIBITTAPI __itt_memory_update(void *address, size_t size); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(LIBITTAPI, void, memory_update, (void *addr, size_t size)) +#define __itt_memory_update ITTNOTIFY_VOID(memory_update) +#define __itt_memory_update_ptr ITTNOTIFY_NAME(memory_update) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_memory_update(addr, size) +#define __itt_memory_update_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_memory_update_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} legacy_memory group */ + +/** + * @defgroup legacy_state Thread and Object States + * @ingroup legacy + */ + +/** @brief state type */ +typedef int __itt_state_t; + +/** @cond exclude_from_documentation */ +typedef enum __itt_obj_state { + __itt_obj_state_err = 0, + __itt_obj_state_clr = 1, + __itt_obj_state_set = 2, + __itt_obj_state_use = 3 +} __itt_obj_state_t; + +typedef enum __itt_thr_state { + __itt_thr_state_err = 0, + __itt_thr_state_clr = 1, + __itt_thr_state_set = 2 +} __itt_thr_state_t; + +typedef enum __itt_obj_prop { + __itt_obj_prop_watch = 1, + __itt_obj_prop_ignore = 2, + __itt_obj_prop_sharable = 3 +} __itt_obj_prop_t; + +typedef enum __itt_thr_prop { + __itt_thr_prop_quiet = 1 +} __itt_thr_prop_t; +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief managing thread and object states + */ +__itt_state_t LIBITTAPI __itt_state_get(void); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_state_t, state_get, (void)) +#define __itt_state_get ITTNOTIFY_DATA(state_get) +#define __itt_state_get_ptr ITTNOTIFY_NAME(state_get) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_state_get(void) (__itt_state_t)0 +#define __itt_state_get_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_state_get_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief managing thread and object states + */ +__itt_state_t LIBITTAPI __itt_state_set(__itt_state_t s); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_state_t, state_set, (__itt_state_t s)) +#define __itt_state_set ITTNOTIFY_DATA(state_set) +#define __itt_state_set_ptr ITTNOTIFY_NAME(state_set) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_state_set(s) (__itt_state_t)0 +#define __itt_state_set_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_state_set_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief managing thread and object modes + */ +__itt_thr_state_t LIBITTAPI __itt_thr_mode_set(__itt_thr_prop_t p, __itt_thr_state_t s); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_thr_state_t, thr_mode_set, (__itt_thr_prop_t p, __itt_thr_state_t s)) +#define __itt_thr_mode_set ITTNOTIFY_DATA(thr_mode_set) +#define __itt_thr_mode_set_ptr ITTNOTIFY_NAME(thr_mode_set) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_thr_mode_set(p, s) (__itt_thr_state_t)0 +#define __itt_thr_mode_set_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_thr_mode_set_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** + * @deprecated Legacy API + * @brief managing thread and object modes + */ +__itt_obj_state_t LIBITTAPI __itt_obj_mode_set(__itt_obj_prop_t p, __itt_obj_state_t s); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUB(ITTAPI, __itt_obj_state_t, obj_mode_set, (__itt_obj_prop_t p, __itt_obj_state_t s)) +#define __itt_obj_mode_set ITTNOTIFY_DATA(obj_mode_set) +#define __itt_obj_mode_set_ptr ITTNOTIFY_NAME(obj_mode_set) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_obj_mode_set(p, s) (__itt_obj_state_t)0 +#define __itt_obj_mode_set_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_obj_mode_set_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} legacy_state group */ + +/** + * @defgroup frames Frames + * @ingroup legacy + * Frames group + * @{ + */ +/** + * @brief opaque structure for frame identification + */ +typedef struct __itt_frame_t *__itt_frame; + +/** + * @brief Create a global frame with given domain + */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +__itt_frame ITTAPI __itt_frame_createA(const char *domain); +__itt_frame ITTAPI __itt_frame_createW(const wchar_t *domain); +#if defined(UNICODE) || defined(_UNICODE) +# define __itt_frame_create __itt_frame_createW +# define __itt_frame_create_ptr __itt_frame_createW_ptr +#else /* UNICODE */ +# define __itt_frame_create __itt_frame_createA +# define __itt_frame_create_ptr __itt_frame_createA_ptr +#endif /* UNICODE */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +__itt_frame ITTAPI __itt_frame_create(const char *domain); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_frame, frame_createA, (const char *domain)) +ITT_STUB(ITTAPI, __itt_frame, frame_createW, (const wchar_t *domain)) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_frame, frame_create, (const char *domain)) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_frame_createA ITTNOTIFY_DATA(frame_createA) +#define __itt_frame_createA_ptr ITTNOTIFY_NAME(frame_createA) +#define __itt_frame_createW ITTNOTIFY_DATA(frame_createW) +#define __itt_frame_createW_ptr ITTNOTIFY_NAME(frame_createW) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_frame_create ITTNOTIFY_DATA(frame_create) +#define __itt_frame_create_ptr ITTNOTIFY_NAME(frame_create) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#else /* INTEL_NO_ITTNOTIFY_API */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_frame_createA(domain) +#define __itt_frame_createA_ptr 0 +#define __itt_frame_createW(domain) +#define __itt_frame_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_frame_create(domain) +#define __itt_frame_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_frame_createA_ptr 0 +#define __itt_frame_createW_ptr 0 +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#define __itt_frame_create_ptr 0 +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ + +/** @brief Record an frame begin occurrence. */ +void ITTAPI __itt_frame_begin(__itt_frame frame); +/** @brief Record an frame end occurrence. */ +void ITTAPI __itt_frame_end (__itt_frame frame); + +/** @cond exclude_from_documentation */ +#ifndef INTEL_NO_MACRO_BODY +#ifndef INTEL_NO_ITTNOTIFY_API +ITT_STUBV(ITTAPI, void, frame_begin, (__itt_frame frame)) +ITT_STUBV(ITTAPI, void, frame_end, (__itt_frame frame)) +#define __itt_frame_begin ITTNOTIFY_VOID(frame_begin) +#define __itt_frame_begin_ptr ITTNOTIFY_NAME(frame_begin) +#define __itt_frame_end ITTNOTIFY_VOID(frame_end) +#define __itt_frame_end_ptr ITTNOTIFY_NAME(frame_end) +#else /* INTEL_NO_ITTNOTIFY_API */ +#define __itt_frame_begin(frame) +#define __itt_frame_begin_ptr 0 +#define __itt_frame_end(frame) +#define __itt_frame_end_ptr 0 +#endif /* INTEL_NO_ITTNOTIFY_API */ +#else /* INTEL_NO_MACRO_BODY */ +#define __itt_frame_begin_ptr 0 +#define __itt_frame_end_ptr 0 +#endif /* INTEL_NO_MACRO_BODY */ +/** @endcond */ +/** @} frames group */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _LEGACY_ITTNOTIFY_H_ */ diff --git a/external/vtune/linux/include/libittnotify.h b/external/vtune/linux/include/libittnotify.h new file mode 100644 index 0000000000..15d8056a9d --- /dev/null +++ b/external/vtune/linux/include/libittnotify.h @@ -0,0 +1,71 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LIBITTNOTIFY_H_ +#define _LIBITTNOTIFY_H_ + +#ifndef __ITT_INTERNAL_INCLUDE +# if defined WIN32 || defined _WIN32 +# pragma message("WARNING!!! Include file libittnotify.h is deprecated and should not be included anymore") +# else /* WIN32 */ +# warning "Include file libittnotify.h is deprecated and should not be included anymore" +# endif /* WIN32 */ +#endif /* __ITT_INTERNAL_INCLUDE */ +#include "legacy/ittnotify.h" + +#endif /* _LIBITTNOTIFY_H_ */ diff --git a/external/vtune/linux/include/llvm_jit_event_listener.hpp b/external/vtune/linux/include/llvm_jit_event_listener.hpp new file mode 100644 index 0000000000..2d1ca7fc43 --- /dev/null +++ b/external/vtune/linux/include/llvm_jit_event_listener.hpp @@ -0,0 +1,241 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This file implements an interface bridge from Low-Level Virtual Machine + * llvm::JITEventListener to Intel JIT Profiling API. It passes the function + * and line information to the appropriate functions in the JIT profiling + * interface so that any LLVM-based JIT engine can emit the JIT code + * notifications that the profiler will receive. + * + * Usage model: + * + * 1. Register the listener implementation instance with the execution engine: + * + * #include + * ... + * ExecutionEngine *TheExecutionEngine; + * ... + * TheExecutionEngine = EngineBuilder(TheModule).create(); + * ... + * __itt_llvm_jit_event_listener jitListener; + * TheExecutionEngine->RegisterJITEventListener(&jitListener); + * ... + * + * 2. When compiling make sure to add the ITT API include directory to the + * compiler include directories, ITT API library directory to the linker + * library directories and link with jitprofling static library. + */ + +#ifndef __ITT_LLVM_JIT_EVENT_LISTENER_HPP__ +#define __ITT_LLVM_JIT_EVENT_LISTENER_HPP__ + +#include "jitprofiling.h" + +#include +#include +#include +#include + +#include +#include + +// Uncomment the line below to turn on logging to stderr +#define JITPROFILING_DEBUG_ENABLE + +// Some elementary logging support +#ifdef JITPROFILING_DEBUG_ENABLE +#include +#include +static void _jit_debug(const char* format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} +// Use the macro as JITDEBUG(("foo: %d", foo_val)); +#define JITDEBUG(x) \ + do { \ + _jit_debug("jit-listener: "); \ + _jit_debug x; \ + } \ + while (0) +#else +#define JITDEBUG(x) +#endif + +// LLVM JIT event listener, translates the notifications to the JIT profiling +// API information. +class __itt_llvm_jit_event_listener : public llvm::JITEventListener +{ +public: + __itt_llvm_jit_event_listener() {} + +public: + virtual void NotifyFunctionEmitted(const llvm::Function &F, + void *Code, size_t Size, const EmittedFunctionDetails &Details) + { + std::string name = F.getName().str(); + JITDEBUG(("function jitted:\n")); + JITDEBUG((" addr=0x%08x\n", (int)Code)); + JITDEBUG((" name=`%s'\n", name.c_str())); + JITDEBUG((" code-size=%d\n", (int)Size)); + JITDEBUG((" line-infos-count=%d\n", Details.LineStarts.size())); + + // The method must not be in the map - the entry must have been cleared + // from the map in NotifyFreeingMachineCode in case of rejitting. + assert(m_addr2MethodId.find(Code) == m_addr2MethodId.end()); + + int mid = iJIT_GetNewMethodID(); + m_addr2MethodId[Code] = mid; + + iJIT_Method_Load mload; + memset(&mload, 0, sizeof mload); + mload.method_id = mid; + + // Populate the method size and name information + // TODO: The JIT profiling API should have members as const char pointers. + mload.method_name = (char*)name.c_str(); + mload.method_load_address = Code; + mload.method_size = (unsigned int)Size; + + // Populate line information now. + // From the JIT API documentation it is not quite clear whether the + // line information can be given in ranges, so we'll populate it for + // every byte of the function, hmm. + std::string srcFilePath; + std::vector lineInfos; + char *addr = (char*)Code; + char *lineAddr = addr; // Exclusive end point at which current + // line info changes. + const llvm::DebugLoc* loc = 0; // Current line info + int lineIndex = -1; // Current index into the line info table + for (int i = 0; i < Size; ++i, ++addr) { + while (addr >= lineAddr) { + if (lineIndex >= 0 && lineIndex < Details.LineStarts.size()) { + loc = &Details.LineStarts[lineIndex].Loc; + std::string p = getSrcFilePath(F.getContext(), *loc); + assert(srcFilePath.empty() || p == srcFilePath); + srcFilePath = p; + } else { + loc = NULL; + } + lineIndex++; + if (lineIndex >= 0 && lineIndex < Details.LineStarts.size()) { + lineAddr = (char*)Details.LineStarts[lineIndex].Address; + } else { + lineAddr = addr + Size; + } + } + if (loc) { + int line = loc->getLine(); + LineNumberInfo info = { i, line }; + lineInfos.push_back(info); + JITDEBUG((" addr 0x%08x -> line %d\n", addr, line)); + } + } + if (!lineInfos.empty()) { + mload.line_number_size = lineInfos.size(); + JITDEBUG((" translated to %d line infos to JIT", (int)lineInfos.size())); + mload.line_number_table = &lineInfos[0]; + mload.source_file_name = (char*)srcFilePath.c_str(); + } + + iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &mload); + } + + virtual void NotifyFreeingMachineCode(void *OldPtr) + { + JITDEBUG(("function unjitted\n")); + JITDEBUG((" addr=0x%08x\n", (int)OldPtr)); + Addr2MethodId::iterator it = m_addr2MethodId.find(OldPtr); + assert(it != m_addr2MethodId.end()); + iJIT_Method_Id mid = { it->second }; + iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_UNLOAD_START, &mid); + m_addr2MethodId.erase(it); + } + +private: + std::string getSrcFilePath(const llvm::LLVMContext& ctx, const llvm::DebugLoc& loc) + { + llvm::MDNode* node = loc.getAsMDNode(ctx); + llvm::DILocation srcLoc(node); + return srcLoc.getDirectory().str() + "/" + srcLoc.getFilename().str(); + } + +private: + /// Don't copy + __itt_llvm_jit_event_listener(const __itt_llvm_jit_event_listener&); + __itt_llvm_jit_event_listener& operator=(const __itt_llvm_jit_event_listener&); + +private: + typedef std::vector LineInfoList; + + // The method unload notification in VTune JIT profiling API takes the + // method ID, not method address so have to maintain the mapping. Is + // there a more efficient and simple way to do this like attaching the + // method ID information somehow to the LLVM function instance? + // + // TODO: It would be more convenient for the JIT API to take the method + // address, not method ID. + typedef std::map Addr2MethodId; + Addr2MethodId m_addr2MethodId; +}; + +#endif // Header guard diff --git a/external/vtune/linux/include/prototype/ittnotify.h b/external/vtune/linux/include/prototype/ittnotify.h new file mode 100644 index 0000000000..85aabe5806 --- /dev/null +++ b/external/vtune/linux/include/prototype/ittnotify.h @@ -0,0 +1,263 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _PROTOTYPE_ITTNOTIFY_H_ +#define _PROTOTYPE_ITTNOTIFY_H_ + +/** + * @file + * @brief Prototype User API functions and types + */ + +/** @cond exclude_from_documentation */ +#ifndef ITT_OS_WIN +# define ITT_OS_WIN 1 +#endif /* ITT_OS_WIN */ + +#ifndef ITT_OS_LINUX +# define ITT_OS_LINUX 2 +#endif /* ITT_OS_LINUX */ + +#ifndef ITT_OS_MAC +# define ITT_OS_MAC 3 +#endif /* ITT_OS_MAC */ + +#ifndef ITT_OS_FREEBSD +# define ITT_OS_FREEBSD 4 +#endif /* ITT_OS_FREEBSD */ + +#ifndef ITT_OS +# if defined WIN32 || defined _WIN32 +# define ITT_OS ITT_OS_WIN +# elif defined( __APPLE__ ) && defined( __MACH__ ) +# define ITT_OS ITT_OS_MAC +# elif defined( __FreeBSD__ ) +# define ITT_OS ITT_OS_FREEBSD +# else +# define ITT_OS ITT_OS_LINUX +# endif +#endif /* ITT_OS */ + +#ifndef ITT_PLATFORM_WIN +# define ITT_PLATFORM_WIN 1 +#endif /* ITT_PLATFORM_WIN */ + +#ifndef ITT_PLATFORM_POSIX +# define ITT_PLATFORM_POSIX 2 +#endif /* ITT_PLATFORM_POSIX */ + +#ifndef ITT_PLATFORM_MAC +# define ITT_PLATFORM_MAC 3 +#endif /* ITT_PLATFORM_MAC */ + +#ifndef ITT_PLATFORM_FREEBSD +# define ITT_PLATFORM_FREEBSD 4 +#endif /* ITT_PLATFORM_FREEBSD */ + +#ifndef ITT_PLATFORM +# if ITT_OS==ITT_OS_WIN +# define ITT_PLATFORM ITT_PLATFORM_WIN +# elif ITT_OS==ITT_OS_MAC +# define ITT_PLATFORM ITT_PLATFORM_MAC +# elif ITT_OS==ITT_OS_FREEBSD +# define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# else +# define ITT_PLATFORM ITT_PLATFORM_POSIX +# endif +#endif /* ITT_PLATFORM */ + +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#include +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#if defined(UNICODE) || defined(_UNICODE) +#include +#endif /* UNICODE || _UNICODE */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef CDECL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define CDECL __cdecl +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define CDECL __attribute__ ((cdecl)) +# else /* _M_IX86 || __i386__ */ +# define CDECL /* actual only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* CDECL */ + +#ifndef STDCALL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define STDCALL __stdcall +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define STDCALL __attribute__ ((stdcall)) +# else /* _M_IX86 || __i386__ */ +# define STDCALL /* supported only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* STDCALL */ + +#define ITTAPI CDECL +#define LIBITTAPI CDECL + +/* TODO: Temporary for compatibility! */ +#define ITTAPI_CALL CDECL +#define LIBITTAPI_CALL CDECL + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +/* use __forceinline (VC++ specific) */ +#define ITT_INLINE __forceinline +#define ITT_INLINE_ATTRIBUTE /* nothing */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/* + * Generally, functions are not inlined unless optimization is specified. + * For functions declared inline, this attribute inlines the function even + * if no optimization level was specified. + */ +#ifdef __STRICT_ANSI__ +#define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) +#else /* __STRICT_ANSI__ */ +#define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) +#endif /* __STRICT_ANSI__ */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/** @endcond */ + +/** @cond exclude_from_documentation */ +/* Helper macro for joining tokens */ +#define ITT_JOIN_AUX(p,n) p##n +#define ITT_JOIN(p,n) ITT_JOIN_AUX(p,n) + +#ifdef ITT_MAJOR +#undef ITT_MAJOR +#endif +#ifdef ITT_MINOR +#undef ITT_MINOR +#endif +#define ITT_MAJOR 3 +#define ITT_MINOR 0 + +/* Standard versioning of a token with major and minor version numbers */ +#define ITT_VERSIONIZE(x) \ + ITT_JOIN(x, \ + ITT_JOIN(_, \ + ITT_JOIN(ITT_MAJOR, \ + ITT_JOIN(_, ITT_MINOR)))) + +#ifndef INTEL_ITTNOTIFY_PREFIX +# define INTEL_ITTNOTIFY_PREFIX __itt_ +#endif /* INTEL_ITTNOTIFY_PREFIX */ +#ifndef INTEL_ITTNOTIFY_POSTFIX +# define INTEL_ITTNOTIFY_POSTFIX _ptr_ +#endif /* INTEL_ITTNOTIFY_POSTFIX */ + +#define ITTNOTIFY_NAME_AUX(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n) +#define ITTNOTIFY_NAME(n) ITT_VERSIONIZE(ITTNOTIFY_NAME_AUX(ITT_JOIN(n,INTEL_ITTNOTIFY_POSTFIX))) + +#define ITTNOTIFY_VOID(n) (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n) +#define ITTNOTIFY_DATA(n) (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n) + +#define ITTNOTIFY_VOID_D0(n,d) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_VOID_D1(n,d,x) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_VOID_D2(n,d,x,y) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_VOID_D3(n,d,x,y,z) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_VOID_D4(n,d,x,y,z,a) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_VOID_D5(n,d,x,y,z,a,b) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_VOID_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? (void)0 : (!ITTNOTIFY_NAME(n)) ? (void)0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) +#define ITTNOTIFY_DATA_D0(n,d) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d) +#define ITTNOTIFY_DATA_D1(n,d,x) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x) +#define ITTNOTIFY_DATA_D2(n,d,x,y) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y) +#define ITTNOTIFY_DATA_D3(n,d,x,y,z) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z) +#define ITTNOTIFY_DATA_D4(n,d,x,y,z,a) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a) +#define ITTNOTIFY_DATA_D5(n,d,x,y,z,a,b) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b) +#define ITTNOTIFY_DATA_D6(n,d,x,y,z,a,b,c) (!(d)->flags) ? 0 : (!ITTNOTIFY_NAME(n)) ? 0 : ITTNOTIFY_NAME(n)(d,x,y,z,a,b,c) + +#ifdef ITT_STUB +#undef ITT_STUB +#endif +#ifdef ITT_STUBV +#undef ITT_STUBV +#endif +#define ITT_STUBV(api,type,name,args) \ + typedef type (api* ITT_JOIN(ITTNOTIFY_NAME(name),_t)) args; \ + extern ITT_JOIN(ITTNOTIFY_NAME(name),_t) ITTNOTIFY_NAME(name); +#define ITT_STUB ITT_STUBV +/** @endcond */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @defgroup prototype Prototype API + * @{ + * @} + */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _PROTOTYPE_ITTNOTIFY_H_ */ diff --git a/external/vtune/linux/sdk/src/ittnotify/LICENSE.BSD b/external/vtune/linux/sdk/src/ittnotify/LICENSE.BSD new file mode 100644 index 0000000000..7beafe5ce9 --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/LICENSE.BSD @@ -0,0 +1,7 @@ +Copyright (c) 2011, Intel Corporation +All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +• Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/external/vtune/linux/sdk/src/ittnotify/LICENSE.GPL b/external/vtune/linux/sdk/src/ittnotify/LICENSE.GPL new file mode 100644 index 0000000000..efe910f4f0 --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/LICENSE.GPL @@ -0,0 +1,65 @@ +The GNU General Public License (GPL) +Version 2, June 1991 +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: +a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. +b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. +c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: +a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, +b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, +c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. +NO WARRANTY +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. +One line to give the program's name and a brief idea of what it does. +Copyright (C) +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Also add information on how to contact you by electronic and paper mail. +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: +Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: +Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. +signature of Ty Coon, 1 April 1989 +Ty Coon, President of Vice +This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. diff --git a/external/vtune/linux/sdk/src/ittnotify/Makefile b/external/vtune/linux/sdk/src/ittnotify/Makefile new file mode 100644 index 0000000000..adb8b1ecad --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/Makefile @@ -0,0 +1,17 @@ +OBJ := ittnotify_static.o jitprofiling.o + +LIBNAME := libittnotify.a + +INCLUDE += -I ../../../include + +CFLAGS += $(INCLUDE) -fPIC + +.PHONY: all +all: $(LIBNAME) + +$(LIBNAME): $(OBJ) + $(AR) rcs $@ $^ + +.PHONY: clean +clean: + @$(RM) $(LIBNAME) $(OBJ) diff --git a/external/vtune/linux/sdk/src/ittnotify/disable_warnings.h b/external/vtune/linux/sdk/src/ittnotify/disable_warnings.h new file mode 100644 index 0000000000..4210f86bfd --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/disable_warnings.h @@ -0,0 +1,77 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ittnotify_config.h" + +#if ITT_PLATFORM==ITT_PLATFORM_WIN + +#pragma warning (disable: 593) /* parameter "XXXX" was set but never used */ +#pragma warning (disable: 344) /* typedef name has already been declared (with same type) */ +#pragma warning (disable: 174) /* expression has no effect */ +#pragma warning (disable: 4127) /* conditional expression is constant */ +#pragma warning (disable: 4306) /* conversion from '?' to '?' of greater size */ + +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#if defined __INTEL_COMPILER + +#pragma warning (disable: 869) /* parameter "XXXXX" was never referenced */ +#pragma warning (disable: 1418) /* external function definition with no prior declaration */ +#pragma warning (disable: 1419) /* external declaration in primary source file */ + +#endif /* __INTEL_COMPILER */ diff --git a/external/vtune/linux/sdk/src/ittnotify/ittnotify_config.h b/external/vtune/linux/sdk/src/ittnotify/ittnotify_config.h new file mode 100644 index 0000000000..2489297bd3 --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/ittnotify_config.h @@ -0,0 +1,541 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _ITTNOTIFY_CONFIG_H_ +#define _ITTNOTIFY_CONFIG_H_ + +/** @cond exclude_from_documentation */ +#ifndef ITT_OS_WIN +# define ITT_OS_WIN 1 +#endif /* ITT_OS_WIN */ + +#ifndef ITT_OS_LINUX +# define ITT_OS_LINUX 2 +#endif /* ITT_OS_LINUX */ + +#ifndef ITT_OS_MAC +# define ITT_OS_MAC 3 +#endif /* ITT_OS_MAC */ + +#ifndef ITT_OS_FREEBSD +# define ITT_OS_FREEBSD 4 +#endif /* ITT_OS_FREEBSD */ + +#ifndef ITT_OS +# if defined WIN32 || defined _WIN32 +# define ITT_OS ITT_OS_WIN +# elif defined( __APPLE__ ) && defined( __MACH__ ) +# define ITT_OS ITT_OS_MAC +# elif defined( __FreeBSD__ ) +# define ITT_OS ITT_OS_FREEBSD +# else +# define ITT_OS ITT_OS_LINUX +# endif +#endif /* ITT_OS */ + +#ifndef ITT_PLATFORM_WIN +# define ITT_PLATFORM_WIN 1 +#endif /* ITT_PLATFORM_WIN */ + +#ifndef ITT_PLATFORM_POSIX +# define ITT_PLATFORM_POSIX 2 +#endif /* ITT_PLATFORM_POSIX */ + +#ifndef ITT_PLATFORM_MAC +# define ITT_PLATFORM_MAC 3 +#endif /* ITT_PLATFORM_MAC */ + +#ifndef ITT_PLATFORM_FREEBSD +# define ITT_PLATFORM_FREEBSD 4 +#endif /* ITT_PLATFORM_FREEBSD */ + +#ifndef ITT_PLATFORM +# if ITT_OS==ITT_OS_WIN +# define ITT_PLATFORM ITT_PLATFORM_WIN +# elif ITT_OS==ITT_OS_MAC +# define ITT_PLATFORM ITT_PLATFORM_MAC +# elif ITT_OS==ITT_OS_FREEBSD +# define ITT_PLATFORM ITT_PLATFORM_FREEBSD +# else +# define ITT_PLATFORM ITT_PLATFORM_POSIX +# endif +#endif /* ITT_PLATFORM */ + +#if defined(_UNICODE) && !defined(UNICODE) +#define UNICODE +#endif + +#include +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#if defined(UNICODE) || defined(_UNICODE) +#include +#endif /* UNICODE || _UNICODE */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#ifndef CDECL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define CDECL __cdecl +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define CDECL __attribute__ ((cdecl)) +# else /* _M_IX86 || __i386__ */ +# define CDECL /* actual only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* CDECL */ + +#ifndef STDCALL +# if ITT_PLATFORM==ITT_PLATFORM_WIN +# define STDCALL __stdcall +# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +# if defined _M_IX86 || defined __i386__ +# define STDCALL __attribute__ ((stdcall)) +# else /* _M_IX86 || __i386__ */ +# define STDCALL /* supported only on x86 platform */ +# endif /* _M_IX86 || __i386__ */ +# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* STDCALL */ + +#define ITTAPI CDECL +#define LIBITTAPI CDECL + +/* TODO: Temporary for compatibility! */ +#define ITTAPI_CALL CDECL +#define LIBITTAPI_CALL CDECL + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +/* use __forceinline (VC++ specific) */ +#define ITT_INLINE __forceinline +#define ITT_INLINE_ATTRIBUTE /* nothing */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/* + * Generally, functions are not inlined unless optimization is specified. + * For functions declared inline, this attribute inlines the function even + * if no optimization level was specified. + */ +#ifdef __STRICT_ANSI__ +#define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) +#else /* __STRICT_ANSI__ */ +#define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) +#endif /* __STRICT_ANSI__ */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +/** @endcond */ + +#ifndef ITT_ARCH_IA32 +# define ITT_ARCH_IA32 1 +#endif /* ITT_ARCH_IA32 */ + +#ifndef ITT_ARCH_IA32E +# define ITT_ARCH_IA32E 2 +#endif /* ITT_ARCH_IA32E */ + +#ifndef ITT_ARCH_ARM +# define ITT_ARCH_ARM 4 +#endif /* ITT_ARCH_ARM */ + +#ifndef ITT_ARCH_PPC64 +# define ITT_ARCH_PPC64 5 +#endif /* ITT_ARCH_PPC64 */ + +#ifndef ITT_ARCH +# if defined _M_IX86 || defined __i386__ +# define ITT_ARCH ITT_ARCH_IA32 +# elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__ +# define ITT_ARCH ITT_ARCH_IA32E +# elif defined _M_IA64 || defined __ia64__ +# define ITT_ARCH ITT_ARCH_IA64 +# elif defined _M_ARM || defined __arm__ +# define ITT_ARCH ITT_ARCH_ARM +# elif defined __powerpc64__ +# define ITT_ARCH ITT_ARCH_PPC64 +# endif +#endif + +#ifdef __cplusplus +# define ITT_EXTERN_C extern "C" +# define ITT_EXTERN_C_BEGIN extern "C" { +# define ITT_EXTERN_C_END } +#else +# define ITT_EXTERN_C /* nothing */ +# define ITT_EXTERN_C_BEGIN /* nothing */ +# define ITT_EXTERN_C_END /* nothing */ +#endif /* __cplusplus */ + +#define ITT_TO_STR_AUX(x) #x +#define ITT_TO_STR(x) ITT_TO_STR_AUX(x) + +#define __ITT_BUILD_ASSERT(expr, suffix) do { \ + static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \ + __itt_build_check_##suffix[0] = 0; \ +} while(0) +#define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix) +#define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__) + +#define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 } + +/* Replace with snapshot date YYYYMMDD for promotion build. */ +#define API_VERSION_BUILD 20111111 + +#ifndef API_VERSION_NUM +#define API_VERSION_NUM 0.0.0 +#endif /* API_VERSION_NUM */ + +#define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \ + " (" ITT_TO_STR(API_VERSION_BUILD) ")" + +/* OS communication functions */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +typedef HMODULE lib_t; +typedef DWORD TIDT; +typedef CRITICAL_SECTION mutex_t; +#define MUTEX_INITIALIZER { 0 } +#define strong_alias(name, aliasname) /* empty for Windows */ +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#if defined(UNICODE) || defined(_UNICODE) +#include +#endif /* UNICODE */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */ +#endif /* _GNU_SOURCE */ +#ifndef __USE_UNIX98 +#define __USE_UNIX98 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein pthread.h missing dependency on __USE_XOPEN2K8 */ +#endif /*__USE_UNIX98*/ +#include +typedef void* lib_t; +typedef pthread_t TIDT; +typedef pthread_mutex_t mutex_t; +#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#define _strong_alias(name, aliasname) \ + extern __typeof (name) aliasname __attribute__ ((alias (#name))); +#define strong_alias(name, aliasname) _strong_alias(name, aliasname) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define __itt_get_proc(lib, name) GetProcAddress(lib, name) +#define __itt_mutex_init(mutex) InitializeCriticalSection(mutex) +#define __itt_mutex_lock(mutex) EnterCriticalSection(mutex) +#define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex) +#define __itt_load_lib(name) LoadLibraryA(name) +#define __itt_unload_lib(handle) FreeLibrary(handle) +#define __itt_system_error() (int)GetLastError() +#define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2) +#define __itt_fstrnlen(s, l) strnlen_s(s, l) +#define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l) +#define __itt_fstrdup(s) _strdup(s) +#define __itt_thread_id() GetCurrentThreadId() +#define __itt_thread_yield() SwitchToThread() +#ifndef ITT_SIMPLE_INIT +ITT_INLINE long +__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE; +ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) +{ + return InterlockedIncrement(ptr); +} +#endif /* ITT_SIMPLE_INIT */ +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +#define __itt_get_proc(lib, name) dlsym(lib, name) +#define __itt_mutex_init(mutex) {\ + pthread_mutexattr_t mutex_attr; \ + int error_code = pthread_mutexattr_init(&mutex_attr); \ + if (error_code) \ + __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \ + error_code); \ + error_code = pthread_mutexattr_settype(&mutex_attr, \ + PTHREAD_MUTEX_RECURSIVE); \ + if (error_code) \ + __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \ + error_code); \ + error_code = pthread_mutex_init(mutex, &mutex_attr); \ + if (error_code) \ + __itt_report_error(__itt_error_system, "pthread_mutex_init", \ + error_code); \ + error_code = pthread_mutexattr_destroy(&mutex_attr); \ + if (error_code) \ + __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \ + error_code); \ +} +#define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex) +#define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex) +#define __itt_load_lib(name) dlopen(name, RTLD_LAZY) +#define __itt_unload_lib(handle) dlclose(handle) +#define __itt_system_error() errno +#define __itt_fstrcmp(s1, s2) strcmp(s1, s2) + +/* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */ +#ifdef SDL_STRNLEN_S +#define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l) +#else +#define __itt_fstrnlen(s, l) strlen(s) +#endif /* SDL_STRNLEN_S */ +#ifdef SDL_STRNCPY_S +#define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l) +#else +#define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, l) +#endif /* SDL_STRNCPY_S */ + +#define __itt_fstrdup(s) strdup(s) +#define __itt_thread_id() pthread_self() +#define __itt_thread_yield() sched_yield() +//#if ITT_ARCH==ITT_ARCH_IA64 +#if defined(ITT_ARCH_IA64) && ITT_ARCH==ITT_ARCH_IA64 +#ifdef __INTEL_COMPILER +#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val) +#else /* __INTEL_COMPILER */ +/* TODO: Add Support for not Intel compilers for IA-64 architecture */ +#endif /* __INTEL_COMPILER */ +#elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */ +ITT_INLINE long +__TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE; +ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend) +{ + long result; + __asm__ __volatile__("lock\nxadd %0,%1" + : "=r"(result),"=m"(*(int*)ptr) + : "0"(addend), "m"(*(int*)ptr) + : "memory"); + return result; +} +#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64 +#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val) +#endif /* ITT_ARCH==ITT_ARCH_IA64 */ +#ifndef ITT_SIMPLE_INIT +ITT_INLINE long +__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE; +ITT_INLINE long __itt_interlocked_increment(volatile long* ptr) +{ + return __TBB_machine_fetchadd4(ptr, 1) + 1L; +} +#endif /* ITT_SIMPLE_INIT */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +typedef enum { + __itt_collection_normal = 0, + __itt_collection_paused = 1 +} __itt_collection_state; + +typedef enum { + __itt_thread_normal = 0, + __itt_thread_ignored = 1 +} __itt_thread_state; + +#pragma pack(push, 8) + +typedef struct ___itt_thread_info +{ + const char* nameA; /*!< Copy of original name in ASCII. */ +#if defined(UNICODE) || defined(_UNICODE) + const wchar_t* nameW; /*!< Copy of original name in UNICODE. */ +#else /* UNICODE || _UNICODE */ + void* nameW; +#endif /* UNICODE || _UNICODE */ + TIDT tid; + __itt_thread_state state; /*!< Thread state (paused or normal) */ + int extra1; /*!< Reserved to the runtime */ + void* extra2; /*!< Reserved to the runtime */ + struct ___itt_thread_info* next; +} __itt_thread_info; + +#include "ittnotify_types.h" /* For __itt_group_id definition */ + +typedef struct ___itt_api_info_20101001 +{ + const char* name; + void** func_ptr; + void* init_func; + __itt_group_id group; +} __itt_api_info_20101001; + +typedef struct ___itt_api_info +{ + const char* name; + void** func_ptr; + void* init_func; + void* null_func; + __itt_group_id group; +} __itt_api_info; + +struct ___itt_domain; +struct ___itt_string_handle; + +typedef struct ___itt_global +{ + unsigned char magic[8]; + unsigned long version_major; + unsigned long version_minor; + unsigned long version_build; + volatile long api_initialized; + volatile long mutex_initialized; + volatile long atomic_counter; + mutex_t mutex; + lib_t lib; + void* error_handler; + const char** dll_path_ptr; + __itt_api_info* api_list_ptr; + struct ___itt_global* next; + /* Joinable structures below */ + __itt_thread_info* thread_list; + struct ___itt_domain* domain_list; + struct ___itt_string_handle* string_list; + __itt_collection_state state; +} __itt_global; + +#pragma pack(pop) + +#define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \ + h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ + if (h != NULL) { \ + h->tid = t; \ + h->nameA = NULL; \ + h->nameW = n ? _wcsdup(n) : NULL; \ + h->state = s; \ + h->extra1 = 0; /* reserved */ \ + h->extra2 = NULL; /* reserved */ \ + h->next = NULL; \ + if (h_tail == NULL) \ + (gptr)->thread_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \ + h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \ + if (h != NULL) { \ + h->tid = t; \ + h->nameA = n ? __itt_fstrdup(n) : NULL; \ + h->nameW = NULL; \ + h->state = s; \ + h->extra1 = 0; /* reserved */ \ + h->extra2 = NULL; /* reserved */ \ + h->next = NULL; \ + if (h_tail == NULL) \ + (gptr)->thread_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#define NEW_DOMAIN_W(gptr,h,h_tail,name) { \ + h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ + if (h != NULL) { \ + h->flags = 1; /* domain is enabled by default */ \ + h->nameA = NULL; \ + h->nameW = name ? _wcsdup(name) : NULL; \ + h->extra1 = 0; /* reserved */ \ + h->extra2 = NULL; /* reserved */ \ + h->next = NULL; \ + if (h_tail == NULL) \ + (gptr)->domain_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#define NEW_DOMAIN_A(gptr,h,h_tail,name) { \ + h = (__itt_domain*)malloc(sizeof(__itt_domain)); \ + if (h != NULL) { \ + h->flags = 1; /* domain is enabled by default */ \ + h->nameA = name ? __itt_fstrdup(name) : NULL; \ + h->nameW = NULL; \ + h->extra1 = 0; /* reserved */ \ + h->extra2 = NULL; /* reserved */ \ + h->next = NULL; \ + if (h_tail == NULL) \ + (gptr)->domain_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \ + h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ + if (h != NULL) { \ + h->strA = NULL; \ + h->strW = name ? _wcsdup(name) : NULL; \ + h->extra1 = 0; /* reserved */ \ + h->extra2 = NULL; /* reserved */ \ + h->next = NULL; \ + if (h_tail == NULL) \ + (gptr)->string_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \ + h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \ + if (h != NULL) { \ + h->strA = name ? __itt_fstrdup(name) : NULL; \ + h->strW = NULL; \ + h->extra1 = 0; /* reserved */ \ + h->extra2 = NULL; /* reserved */ \ + h->next = NULL; \ + if (h_tail == NULL) \ + (gptr)->string_list = h; \ + else \ + h_tail->next = h; \ + } \ +} + +#endif /* _ITTNOTIFY_CONFIG_H_ */ diff --git a/external/vtune/linux/sdk/src/ittnotify/ittnotify_static.c b/external/vtune/linux/sdk/src/ittnotify/ittnotify_static.c new file mode 100644 index 0000000000..9303895a27 --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/ittnotify_static.c @@ -0,0 +1,1080 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ittnotify_config.h" + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define PATH_MAX 512 +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +#include +#include +#include +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#include +#include +#include +#include + +#define INTEL_NO_MACRO_BODY +#define INTEL_ITTNOTIFY_API_PRIVATE +#include "ittnotify.h" +#include "legacy/ittnotify.h" + +#include "disable_warnings.h" + +static const char api_version[] = API_VERSION "\0\n@(#) $Revision: 422936 $\n"; + +#define _N_(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n) + +#if ITT_OS==ITT_OS_WIN +static const char* ittnotify_lib_name = "libittnotify.dll"; +#elif ITT_OS==ITT_OS_LINUX || ITT_OS==ITT_OS_FREEBSD +static const char* ittnotify_lib_name = "libittnotify.so"; +#elif ITT_OS==ITT_OS_MAC +static const char* ittnotify_lib_name = "libittnotify.dylib"; +#else +#error Unsupported or unknown OS. +#endif + +#ifdef __ANDROID__ +#include +#include +#include +#include +#include +#include +#include + +#ifdef ITT_ANDROID_LOG + #define ITT_ANDROID_LOG_TAG "INTEL_VTUNE_USERAPI" + #define ITT_ANDROID_LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, ITT_ANDROID_LOG_TAG, __VA_ARGS__)) + #define ITT_ANDROID_LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, ITT_ANDROID_LOG_TAG, __VA_ARGS__)) + #define ITT_ANDROID_LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR,ITT_ANDROID_LOG_TAG, __VA_ARGS__)) + #define ITT_ANDROID_LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG,ITT_ANDROID_LOG_TAG, __VA_ARGS__)) +#else + #define ITT_ANDROID_LOGI(...) + #define ITT_ANDROID_LOGW(...) + #define ITT_ANDROID_LOGE(...) + #define ITT_ANDROID_LOGD(...) +#endif + +/* default location of userapi collector on Android */ +#define ANDROID_ITTNOTIFY_DEFAULT_PATH_MASK(x) "/data/data/com.intel.vtune/perfrun/lib" \ + #x "/runtime/libittnotify.so" + +#if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM +#define ANDROID_ITTNOTIFY_DEFAULT_PATH ANDROID_ITTNOTIFY_DEFAULT_PATH_MASK(32) +#else +#define ANDROID_ITTNOTIFY_DEFAULT_PATH ANDROID_ITTNOTIFY_DEFAULT_PATH_MASK(64) +#endif + +#endif + + +#ifndef LIB_VAR_NAME +#if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM +#define LIB_VAR_NAME INTEL_LIBITTNOTIFY32 +#else +#define LIB_VAR_NAME INTEL_LIBITTNOTIFY64 +#endif +#endif /* LIB_VAR_NAME */ + +#define ITT_MUTEX_INIT_AND_LOCK(p) { \ + if (!p.mutex_initialized) \ + { \ + if (__itt_interlocked_increment(&p.atomic_counter) == 1) \ + { \ + __itt_mutex_init(&p.mutex); \ + p.mutex_initialized = 1; \ + } \ + else \ + while (!p.mutex_initialized) \ + __itt_thread_yield(); \ + } \ + __itt_mutex_lock(&p.mutex); \ +} + +const int _N_(err) = 0; + +typedef int (__itt_init_ittlib_t)(const char*, __itt_group_id); + +/* this define used to control initialization function name. */ +#ifndef __itt_init_ittlib_name +ITT_EXTERN_C int _N_(init_ittlib)(const char*, __itt_group_id); +static __itt_init_ittlib_t* __itt_init_ittlib_ptr = _N_(init_ittlib); +#define __itt_init_ittlib_name __itt_init_ittlib_ptr +#endif /* __itt_init_ittlib_name */ + +typedef void (__itt_fini_ittlib_t)(void); + +/* this define used to control finalization function name. */ +#ifndef __itt_fini_ittlib_name +ITT_EXTERN_C void _N_(fini_ittlib)(void); +static __itt_fini_ittlib_t* __itt_fini_ittlib_ptr = _N_(fini_ittlib); +#define __itt_fini_ittlib_name __itt_fini_ittlib_ptr +#endif /* __itt_fini_ittlib_name */ + +/* building pointers to imported funcs */ +#undef ITT_STUBV +#undef ITT_STUB +#define ITT_STUB(api,type,name,args,params,ptr,group,format) \ +static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\ +typedef type api ITT_JOIN(_N_(name),_t) args; \ +ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END \ +static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args \ +{ \ + __itt_init_ittlib_name(NULL, __itt_group_all); \ + if (ITTNOTIFY_NAME(name) && ITTNOTIFY_NAME(name) != ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init))) \ + return ITTNOTIFY_NAME(name) params; \ + else \ + return (type)0; \ +} + +#define ITT_STUBV(api,type,name,args,params,ptr,group,format) \ +static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\ +typedef type api ITT_JOIN(_N_(name),_t) args; \ +ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END \ +static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args \ +{ \ + __itt_init_ittlib_name(NULL, __itt_group_all); \ + if (ITTNOTIFY_NAME(name) && ITTNOTIFY_NAME(name) != ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init))) \ + ITTNOTIFY_NAME(name) params; \ + else \ + return; \ +} + +#undef __ITT_INTERNAL_INIT +#include "ittnotify_static.h" + +#undef ITT_STUB +#undef ITT_STUBV +#define ITT_STUB(api,type,name,args,params,ptr,group,format) \ +static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\ +typedef type api ITT_JOIN(_N_(name),_t) args; \ +ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END + +#define ITT_STUBV(api,type,name,args,params,ptr,group,format) \ +static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\ +typedef type api ITT_JOIN(_N_(name),_t) args; \ +ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END + +#define __ITT_INTERNAL_INIT +#include "ittnotify_static.h" +#undef __ITT_INTERNAL_INIT + +ITT_GROUP_LIST(group_list); + +#pragma pack(push, 8) + +typedef struct ___itt_group_alias +{ + const char* env_var; + __itt_group_id groups; +} __itt_group_alias; + +static __itt_group_alias group_alias[] = { + { "KMP_FOR_TPROFILE", (__itt_group_id)(__itt_group_control | __itt_group_thread | __itt_group_sync | __itt_group_mark) }, + { "KMP_FOR_TCHECK", (__itt_group_id)(__itt_group_control | __itt_group_thread | __itt_group_sync | __itt_group_fsync | __itt_group_mark | __itt_group_suppress) }, + { NULL, (__itt_group_none) }, + { api_version, (__itt_group_none) } /* !!! Just to avoid unused code elimination !!! */ +}; + +#pragma pack(pop) + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#pragma warning(push) +#pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +static __itt_api_info api_list[] = { +/* Define functions with static implementation */ +#undef ITT_STUB +#undef ITT_STUBV +#define ITT_STUB(api,type,name,args,params,nameindll,group,format) { ITT_TO_STR(ITT_JOIN(__itt_,nameindll)), (void**)(void*)&ITTNOTIFY_NAME(name), (void*)(size_t)&ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)), (void*)(size_t)&ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)), (__itt_group_id)(group)}, +#define ITT_STUBV ITT_STUB +#define __ITT_INTERNAL_INIT +#include "ittnotify_static.h" +#undef __ITT_INTERNAL_INIT +/* Define functions without static implementation */ +#undef ITT_STUB +#undef ITT_STUBV +#define ITT_STUB(api,type,name,args,params,nameindll,group,format) {ITT_TO_STR(ITT_JOIN(__itt_,nameindll)), (void**)(void*)&ITTNOTIFY_NAME(name), (void*)(size_t)&ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)), NULL, (__itt_group_id)(group)}, +#define ITT_STUBV ITT_STUB +#include "ittnotify_static.h" + {NULL, NULL, NULL, NULL, __itt_group_none} +}; + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#pragma warning(pop) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +static const char dll_path[PATH_MAX] = { 0 }; + +/* static part descriptor which handles. all notification api attributes. */ +__itt_global _N_(_ittapi_global) = { + ITT_MAGIC, /* identification info */ + ITT_MAJOR, ITT_MINOR, API_VERSION_BUILD, /* version info */ + 0, /* api_initialized */ + 0, /* mutex_initialized */ + 0, /* atomic_counter */ + MUTEX_INITIALIZER, /* mutex */ + NULL, /* dynamic library handle */ + NULL, /* error_handler */ + (const char**)&dll_path, /* dll_path_ptr */ + (__itt_api_info*)&api_list, /* api_list_ptr */ + NULL, /* next __itt_global */ + NULL, /* thread_list */ + NULL, /* domain_list */ + NULL, /* string_list */ + __itt_collection_normal /* collection state */ +}; + +ITT_EXTERN_C __itt_global* _N_(get_ittapi_global)() { return &_N_(_ittapi_global); } +typedef void (__itt_api_init_t)(__itt_global*, __itt_group_id); +typedef void (__itt_api_fini_t)(__itt_global*); + +/* ========================================================================= */ + +#ifdef ITT_NOTIFY_EXT_REPORT +ITT_EXTERN_C void _N_(error_handler)(__itt_error_code, va_list args); +#endif /* ITT_NOTIFY_EXT_REPORT */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#pragma warning(push) +#pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +static void __itt_report_error(__itt_error_code code, ...) +{ + va_list args; + va_start(args, code); + if (_N_(_ittapi_global).error_handler != NULL) + { + __itt_error_handler_t* handler = (__itt_error_handler_t*)(size_t)_N_(_ittapi_global).error_handler; + handler(code, args); + } +#ifdef ITT_NOTIFY_EXT_REPORT + _N_(error_handler)(code, args); +#endif /* ITT_NOTIFY_EXT_REPORT */ + va_end(args); +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#pragma warning(pop) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +static __itt_domain* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createW),_init))(const wchar_t* name) +{ + __itt_domain *h_tail = NULL, *h = NULL; + + if (name == NULL) + { + return NULL; + } + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).api_initialized) + { + if (ITTNOTIFY_NAME(domain_createW) && ITTNOTIFY_NAME(domain_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createW),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(domain_createW)(name); + } + } + for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameW != NULL && !wcscmp(h->nameW, name)) break; + } + if (h == NULL) + { + NEW_DOMAIN_W(&_N_(_ittapi_global),h,h_tail,name); + } + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return h; +} + +static __itt_domain* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createA),_init))(const char* name) +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +static __itt_domain* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(domain_create),_init))(const char* name) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +{ + __itt_domain *h_tail = NULL, *h = NULL; + + if (name == NULL) + { + return NULL; + } + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).api_initialized) + { +#if ITT_PLATFORM==ITT_PLATFORM_WIN + if (ITTNOTIFY_NAME(domain_createA) && ITTNOTIFY_NAME(domain_createA) != ITT_VERSIONIZE(ITT_JOIN(_N_(domain_createA),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(domain_createA)(name); + } +#else + if (ITTNOTIFY_NAME(domain_create) && ITTNOTIFY_NAME(domain_create) != ITT_VERSIONIZE(ITT_JOIN(_N_(domain_create),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(domain_create)(name); + } +#endif + } + for (h_tail = NULL, h = _N_(_ittapi_global).domain_list; h != NULL; h_tail = h, h = h->next) + { + if (h->nameA != NULL && !__itt_fstrcmp(h->nameA, name)) break; + } + if (h == NULL) + { + NEW_DOMAIN_A(&_N_(_ittapi_global),h,h_tail,name); + } + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return h; +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init))(const wchar_t* name) +{ + __itt_string_handle *h_tail = NULL, *h = NULL; + + if (name == NULL) + { + return NULL; + } + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).api_initialized) + { + if (ITTNOTIFY_NAME(string_handle_createW) && ITTNOTIFY_NAME(string_handle_createW) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createW),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(string_handle_createW)(name); + } + } + for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next) + { + if (h->strW != NULL && !wcscmp(h->strW, name)) break; + } + if (h == NULL) + { + NEW_STRING_HANDLE_W(&_N_(_ittapi_global),h,h_tail,name); + } + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return h; +} + +static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createA),_init))(const char* name) +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +static __itt_string_handle* ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_create),_init))(const char* name) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +{ + __itt_string_handle *h_tail = NULL, *h = NULL; + + if (name == NULL) + { + return NULL; + } + + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); + if (_N_(_ittapi_global).api_initialized) + { +#if ITT_PLATFORM==ITT_PLATFORM_WIN + if (ITTNOTIFY_NAME(string_handle_createA) && ITTNOTIFY_NAME(string_handle_createA) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_createA),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(string_handle_createA)(name); + } +#else + if (ITTNOTIFY_NAME(string_handle_create) && ITTNOTIFY_NAME(string_handle_create) != ITT_VERSIONIZE(ITT_JOIN(_N_(string_handle_create),_init))) + { + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return ITTNOTIFY_NAME(string_handle_create)(name); + } +#endif + } + for (h_tail = NULL, h = _N_(_ittapi_global).string_list; h != NULL; h_tail = h, h = h->next) + { + if (h->strA != NULL && !__itt_fstrcmp(h->strA, name)) break; + } + if (h == NULL) + { + NEW_STRING_HANDLE_A(&_N_(_ittapi_global),h,h_tail,name); + } + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + return h; +} + +/* -------------------------------------------------------------------------- */ + +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(pause),_init))(void) +{ + if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL) + { + __itt_init_ittlib_name(NULL, __itt_group_all); + } + if (ITTNOTIFY_NAME(pause) && ITTNOTIFY_NAME(pause) != ITT_VERSIONIZE(ITT_JOIN(_N_(pause),_init))) + { + ITTNOTIFY_NAME(pause)(); + } + else + { + _N_(_ittapi_global).state = __itt_collection_paused; + } +} + +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(resume),_init))(void) +{ + if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL) + { + __itt_init_ittlib_name(NULL, __itt_group_all); + } + if (ITTNOTIFY_NAME(resume) && ITTNOTIFY_NAME(resume) != ITT_VERSIONIZE(ITT_JOIN(_N_(resume),_init))) + { + ITTNOTIFY_NAME(resume)(); + } + else + { + _N_(_ittapi_global).state = __itt_collection_normal; + } +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init))(const wchar_t* name) +{ + if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL) + { + __itt_init_ittlib_name(NULL, __itt_group_all); + } + if (ITTNOTIFY_NAME(thread_set_nameW) && ITTNOTIFY_NAME(thread_set_nameW) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init))) + { + ITTNOTIFY_NAME(thread_set_nameW)(name); + } +} + +static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_setW),_init))(const wchar_t* name, int namelen) +{ + (void)namelen; + ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameW),_init))(name); + return 0; +} + +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init))(const char* name) +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init))(const char* name) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +{ + if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL) + { + __itt_init_ittlib_name(NULL, __itt_group_all); + } +#if ITT_PLATFORM==ITT_PLATFORM_WIN + if (ITTNOTIFY_NAME(thread_set_nameA) && ITTNOTIFY_NAME(thread_set_nameA) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init))) + { + ITTNOTIFY_NAME(thread_set_nameA)(name); + } +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + if (ITTNOTIFY_NAME(thread_set_name) && ITTNOTIFY_NAME(thread_set_name) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init))) + { + ITTNOTIFY_NAME(thread_set_name)(name); + } +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_setA),_init))(const char* name, int namelen) +{ + (void)namelen; + ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_nameA),_init))(name); + return 0; +} +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +static int ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_name_set),_init))(const char* name, int namelen) +{ + (void)namelen; + ITT_VERSIONIZE(ITT_JOIN(_N_(thread_set_name),_init))(name); + return 0; +} +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thread_ignore),_init))(void) +{ + if (!_N_(_ittapi_global).api_initialized && _N_(_ittapi_global).thread_list == NULL) + { + __itt_init_ittlib_name(NULL, __itt_group_all); + } + if (ITTNOTIFY_NAME(thread_ignore) && ITTNOTIFY_NAME(thread_ignore) != ITT_VERSIONIZE(ITT_JOIN(_N_(thread_ignore),_init))) + { + ITTNOTIFY_NAME(thread_ignore)(); + } +} + +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(thr_ignore),_init))(void) +{ + ITT_VERSIONIZE(ITT_JOIN(_N_(thread_ignore),_init))(); +} + +static void ITTAPI ITT_VERSIONIZE(ITT_JOIN(_N_(enable_attach),_init))(void) +{ +#ifdef __ANDROID__ + /* + * if LIB_VAR_NAME env variable were set before then stay previous value + * else set default path + */ + setenv(ITT_TO_STR(LIB_VAR_NAME), ANDROID_ITTNOTIFY_DEFAULT_PATH, 0); +#endif +} + +/* -------------------------------------------------------------------------- */ + +static const char* __itt_fsplit(const char* s, const char* sep, const char** out, int* len) +{ + int i; + int j; + + if (!s || !sep || !out || !len) + return NULL; + + for (i = 0; s[i]; i++) + { + int b = 0; + for (j = 0; sep[j]; j++) + if (s[i] == sep[j]) + { + b = 1; + break; + } + if (!b) + break; + } + + if (!s[i]) + return NULL; + + *len = 0; + *out = &s[i]; + + for (; s[i]; i++, (*len)++) + { + int b = 0; + for (j = 0; sep[j]; j++) + if (s[i] == sep[j]) + { + b = 1; + break; + } + if (b) + break; + } + + for (; s[i]; i++) + { + int b = 0; + for (j = 0; sep[j]; j++) + if (s[i] == sep[j]) + { + b = 1; + break; + } + if (!b) + break; + } + + return &s[i]; +} + +/* This function return value of env variable that placed into static buffer. + * !!! The same static buffer is used for subsequent calls. !!! + * This was done to aviod dynamic allocation for few calls. + * Actually we need this function only four times. + */ +static const char* __itt_get_env_var(const char* name) +{ +#define MAX_ENV_VALUE_SIZE 4086 + static char env_buff[MAX_ENV_VALUE_SIZE]; + static char* env_value = (char*)env_buff; + + if (name != NULL) + { +#if ITT_PLATFORM==ITT_PLATFORM_WIN + size_t max_len = MAX_ENV_VALUE_SIZE - (size_t)(env_value - env_buff); + DWORD rc = GetEnvironmentVariableA(name, env_value, (DWORD)max_len); + if (rc >= max_len) + __itt_report_error(__itt_error_env_too_long, name, (size_t)rc - 1, (size_t)(max_len - 1)); + else if (rc > 0) + { + const char* ret = (const char*)env_value; + env_value += rc + 1; + return ret; + } + else + { + /* If environment variable is empty, GetEnvirornmentVariables() + * returns zero (number of characters (not including terminating null), + * and GetLastError() returns ERROR_SUCCESS. */ + DWORD err = GetLastError(); + if (err == ERROR_SUCCESS) + return env_value; + + if (err != ERROR_ENVVAR_NOT_FOUND) + __itt_report_error(__itt_error_cant_read_env, name, (int)err); + } +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ + char* env = getenv(name); + if (env != NULL) + { + size_t len = __itt_fstrnlen(env, MAX_ENV_VALUE_SIZE); + size_t max_len = MAX_ENV_VALUE_SIZE - (size_t)(env_value - env_buff); + if (len < max_len) + { + const char* ret = (const char*)env_value; + __itt_fstrcpyn(env_value, max_len, env, len + 1); + env_value += len + 1; + return ret; + } else + __itt_report_error(__itt_error_env_too_long, name, (size_t)len, (size_t)(max_len - 1)); + } +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + } + return NULL; +} + +static const char* __itt_get_lib_name(void) +{ + const char* lib_name = __itt_get_env_var(ITT_TO_STR(LIB_VAR_NAME)); + +#ifdef __ANDROID__ + if (lib_name == NULL) + { + +#if ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_ARM + const char* const marker_filename = "com.intel.itt.collector_lib_32"; +#else + const char* const marker_filename = "com.intel.itt.collector_lib_64"; +#endif + + char system_wide_marker_filename[PATH_MAX] = {0}; + int itt_marker_file_fd = -1; + ssize_t res = 0; + + res = snprintf(system_wide_marker_filename, PATH_MAX - 1, "%s%s", "/data/local/tmp/", marker_filename); + if (res < 0) + { + ITT_ANDROID_LOGE("Unable to concatenate marker file string."); + return lib_name; + } + itt_marker_file_fd = open(system_wide_marker_filename, O_RDONLY); + + if (itt_marker_file_fd == -1) + { + const pid_t my_pid = getpid(); + char cmdline_path[PATH_MAX] = {0}; + char package_name[PATH_MAX] = {0}; + char app_sandbox_file[PATH_MAX] = {0}; + int cmdline_fd = 0; + + ITT_ANDROID_LOGI("Unable to open system-wide marker file."); + res = snprintf(cmdline_path, PATH_MAX - 1, "/proc/%d/cmdline", my_pid); + if (res < 0) + { + ITT_ANDROID_LOGE("Unable to get cmdline path string."); + return lib_name; + } + + ITT_ANDROID_LOGI("CMD file: %s\n", cmdline_path); + cmdline_fd = open(cmdline_path, O_RDONLY); + if (cmdline_fd == -1) + { + ITT_ANDROID_LOGE("Unable to open %s file!", cmdline_path); + return lib_name; + } + res = read(cmdline_fd, package_name, PATH_MAX - 1); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to read %s file!", cmdline_path); + res = close(cmdline_fd); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to close %s file!", cmdline_path); + } + return lib_name; + } + res = close(cmdline_fd); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to close %s file!", cmdline_path); + return lib_name; + } + ITT_ANDROID_LOGI("Package name: %s\n", package_name); + res = snprintf(app_sandbox_file, PATH_MAX - 1, "/data/data/%s/%s", package_name, marker_filename); + if (res < 0) + { + ITT_ANDROID_LOGE("Unable to concatenate marker file string."); + return lib_name; + } + + ITT_ANDROID_LOGI("Lib marker file name: %s\n", app_sandbox_file); + itt_marker_file_fd = open(app_sandbox_file, O_RDONLY); + if (itt_marker_file_fd == -1) + { + ITT_ANDROID_LOGE("Unable to open app marker file!"); + return lib_name; + } + } + + { + char itt_lib_name[PATH_MAX] = {0}; + + res = read(itt_marker_file_fd, itt_lib_name, PATH_MAX - 1); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to read %s file!", itt_marker_file_fd); + res = close(itt_marker_file_fd); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to close %s file!", itt_marker_file_fd); + } + return lib_name; + } + ITT_ANDROID_LOGI("ITT Lib path: %s", itt_lib_name); + res = close(itt_marker_file_fd); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to close %s file!", itt_marker_file_fd); + return lib_name; + } + ITT_ANDROID_LOGI("Set env %s to %s", ITT_TO_STR(LIB_VAR_NAME), itt_lib_name); + res = setenv(ITT_TO_STR(LIB_VAR_NAME), itt_lib_name, 0); + if (res == -1) + { + ITT_ANDROID_LOGE("Unable to set env var!"); + return lib_name; + } + lib_name = __itt_get_env_var(ITT_TO_STR(LIB_VAR_NAME)); + ITT_ANDROID_LOGI("ITT Lib path from env: %s", lib_name); + } + } +#endif + + return lib_name; +} + +#ifndef min +#define min(a,b) (a) < (b) ? (a) : (b) +#endif /* min */ + +static __itt_group_id __itt_get_groups(void) +{ + register int i; + __itt_group_id res = __itt_group_none; + const char* var_name = "INTEL_ITTNOTIFY_GROUPS"; + const char* group_str = __itt_get_env_var(var_name); + + if (group_str != NULL) + { + int len; + char gr[255]; + const char* chunk; + while ((group_str = __itt_fsplit(group_str, ",; ", &chunk, &len)) != NULL) + { + int min_len = min(len, (int)(sizeof(gr) - 1)); + __itt_fstrcpyn(gr, sizeof(gr) - 1, chunk, min_len); + gr[min_len] = 0; + + for (i = 0; group_list[i].name != NULL; i++) + { + if (!__itt_fstrcmp(gr, group_list[i].name)) + { + res = (__itt_group_id)(res | group_list[i].id); + break; + } + } + } + /* TODO: !!! Workaround for bug with warning for unknown group !!! + * Should be fixed in new initialization scheme. + * Now the following groups should be set always. */ + for (i = 0; group_list[i].id != __itt_group_none; i++) + if (group_list[i].id != __itt_group_all && + group_list[i].id > __itt_group_splitter_min && + group_list[i].id < __itt_group_splitter_max) + res = (__itt_group_id)(res | group_list[i].id); + return res; + } + else + { + for (i = 0; group_alias[i].env_var != NULL; i++) + if (__itt_get_env_var(group_alias[i].env_var) != NULL) + return group_alias[i].groups; + } + + return res; +} + +static int __itt_lib_version(lib_t lib) +{ + if (lib == NULL) + return 0; + if (__itt_get_proc(lib, "__itt_api_init")) + return 2; + if (__itt_get_proc(lib, "__itt_api_version")) + return 1; + return 0; +} + +/* It's not used right now! Comment it out to avoid warnings. +static void __itt_reinit_all_pointers(void) +{ + register int i; + // Fill all pointers with initial stubs + for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++) + *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].init_func; +} +*/ + +static void __itt_nullify_all_pointers(void) +{ + register int i; + /* Nulify all pointers except domain_create and string_handle_create */ + for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++) + *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func; +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#pragma warning(push) +#pragma warning(disable: 4054) /* warning C4054: 'type cast' : from function pointer 'XXX' to data pointer 'void *' */ +#pragma warning(disable: 4055) /* warning C4055: 'type cast' : from data pointer 'void *' to function pointer 'XXX' */ +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +ITT_EXTERN_C void _N_(fini_ittlib)(void) +{ + __itt_api_fini_t* __itt_api_fini_ptr = NULL; + static volatile TIDT current_thread = 0; + + if (_N_(_ittapi_global).api_initialized) + { + __itt_mutex_lock(&_N_(_ittapi_global).mutex); + if (_N_(_ittapi_global).api_initialized) + { + if (current_thread == 0) + { + current_thread = __itt_thread_id(); + if (_N_(_ittapi_global).lib != NULL) + { + __itt_api_fini_ptr = (__itt_api_fini_t*)(size_t)__itt_get_proc(_N_(_ittapi_global).lib, "__itt_api_fini"); + } + if (__itt_api_fini_ptr) + { + __itt_api_fini_ptr(&_N_(_ittapi_global)); + } + + __itt_nullify_all_pointers(); + + /* TODO: !!! not safe !!! don't support unload so far. + * if (_N_(_ittapi_global).lib != NULL) + * __itt_unload_lib(_N_(_ittapi_global).lib); + * _N_(_ittapi_global).lib = NULL; + */ + _N_(_ittapi_global).api_initialized = 0; + current_thread = 0; + } + } + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); + } +} + +ITT_EXTERN_C int _N_(init_ittlib)(const char* lib_name, __itt_group_id init_groups) +{ + register int i; + __itt_group_id groups; +#ifdef ITT_COMPLETE_GROUP + __itt_group_id zero_group = __itt_group_none; +#endif /* ITT_COMPLETE_GROUP */ + static volatile TIDT current_thread = 0; + + if (!_N_(_ittapi_global).api_initialized) + { +#ifndef ITT_SIMPLE_INIT + ITT_MUTEX_INIT_AND_LOCK(_N_(_ittapi_global)); +#endif /* ITT_SIMPLE_INIT */ + + if (!_N_(_ittapi_global).api_initialized) + { + if (current_thread == 0) + { + current_thread = __itt_thread_id(); + if (lib_name == NULL) + { + lib_name = __itt_get_lib_name(); + } + groups = __itt_get_groups(); + if (groups != __itt_group_none || lib_name != NULL) + { + _N_(_ittapi_global).lib = __itt_load_lib((lib_name == NULL) ? ittnotify_lib_name : lib_name); + + if (_N_(_ittapi_global).lib != NULL) + { + __itt_api_init_t* __itt_api_init_ptr; + int lib_version = __itt_lib_version(_N_(_ittapi_global).lib); + + switch (lib_version) { + case 0: + groups = __itt_group_legacy; + case 1: + /* Fill all pointers from dynamic library */ + for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++) + { + if (_N_(_ittapi_global).api_list_ptr[i].group & groups & init_groups) + { + *_N_(_ittapi_global).api_list_ptr[i].func_ptr = (void*)__itt_get_proc(_N_(_ittapi_global).lib, _N_(_ittapi_global).api_list_ptr[i].name); + if (*_N_(_ittapi_global).api_list_ptr[i].func_ptr == NULL) + { + /* Restore pointers for function with static implementation */ + *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func; + __itt_report_error(__itt_error_no_symbol, lib_name, _N_(_ittapi_global).api_list_ptr[i].name); +#ifdef ITT_COMPLETE_GROUP + zero_group = (__itt_group_id)(zero_group | _N_(_ittapi_global).api_list_ptr[i].group); +#endif /* ITT_COMPLETE_GROUP */ + } + } + else + *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func; + } + + if (groups == __itt_group_legacy) + { + /* Compatibility with legacy tools */ + ITTNOTIFY_NAME(thread_ignore) = ITTNOTIFY_NAME(thr_ignore); +#if ITT_PLATFORM==ITT_PLATFORM_WIN + ITTNOTIFY_NAME(sync_createA) = ITTNOTIFY_NAME(sync_set_nameA); + ITTNOTIFY_NAME(sync_createW) = ITTNOTIFY_NAME(sync_set_nameW); +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ + ITTNOTIFY_NAME(sync_create) = ITTNOTIFY_NAME(sync_set_name); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + ITTNOTIFY_NAME(sync_prepare) = ITTNOTIFY_NAME(notify_sync_prepare); + ITTNOTIFY_NAME(sync_cancel) = ITTNOTIFY_NAME(notify_sync_cancel); + ITTNOTIFY_NAME(sync_acquired) = ITTNOTIFY_NAME(notify_sync_acquired); + ITTNOTIFY_NAME(sync_releasing) = ITTNOTIFY_NAME(notify_sync_releasing); + } + +#ifdef ITT_COMPLETE_GROUP + for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++) + if (_N_(_ittapi_global).api_list_ptr[i].group & zero_group) + *_N_(_ittapi_global).api_list_ptr[i].func_ptr = _N_(_ittapi_global).api_list_ptr[i].null_func; +#endif /* ITT_COMPLETE_GROUP */ + break; + case 2: + __itt_api_init_ptr = (__itt_api_init_t*)(size_t)__itt_get_proc(_N_(_ittapi_global).lib, "__itt_api_init"); + if (__itt_api_init_ptr) + __itt_api_init_ptr(&_N_(_ittapi_global), init_groups); + break; + } + } + else + { + __itt_nullify_all_pointers(); + + __itt_report_error(__itt_error_no_module, lib_name, +#if ITT_PLATFORM==ITT_PLATFORM_WIN + __itt_system_error() +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + dlerror() +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + ); + } + } + else + { + __itt_nullify_all_pointers(); + } + _N_(_ittapi_global).api_initialized = 1; + current_thread = 0; + /* !!! Just to avoid unused code elimination !!! */ + if (__itt_fini_ittlib_ptr == _N_(fini_ittlib)) current_thread = 0; + } + } + +#ifndef ITT_SIMPLE_INIT + __itt_mutex_unlock(&_N_(_ittapi_global).mutex); +#endif /* ITT_SIMPLE_INIT */ + } + + /* Evaluating if any function ptr is non empty and it's in init_groups */ + for (i = 0; _N_(_ittapi_global).api_list_ptr[i].name != NULL; i++) + { + if (*_N_(_ittapi_global).api_list_ptr[i].func_ptr != _N_(_ittapi_global).api_list_ptr[i].null_func && + _N_(_ittapi_global).api_list_ptr[i].group & init_groups) + { + return 1; + } + } + return 0; +} + +ITT_EXTERN_C __itt_error_handler_t* _N_(set_error_handler)(__itt_error_handler_t* handler) +{ + __itt_error_handler_t* prev = (__itt_error_handler_t*)(size_t)_N_(_ittapi_global).error_handler; + _N_(_ittapi_global).error_handler = (void*)(size_t)handler; + return prev; +} + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#pragma warning(pop) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + diff --git a/external/vtune/linux/sdk/src/ittnotify/ittnotify_static.h b/external/vtune/linux/sdk/src/ittnotify/ittnotify_static.h new file mode 100644 index 0000000000..e728f8b154 --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/ittnotify_static.h @@ -0,0 +1,376 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ittnotify_config.h" + +#ifndef ITT_FORMAT_DEFINED +# ifndef ITT_FORMAT +# define ITT_FORMAT +# endif /* ITT_FORMAT */ +# ifndef ITT_NO_PARAMS +# define ITT_NO_PARAMS +# endif /* ITT_NO_PARAMS */ +#endif /* ITT_FORMAT_DEFINED */ + +/* + * parameters for macro expected: + * ITT_STUB(api, type, func_name, arguments, params, func_name_in_dll, group, printf_fmt) + */ +#ifdef __ITT_INTERNAL_INIT + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_domain*, domain_createA, (const char *name), (ITT_FORMAT name), domain_createA, __itt_group_structure, "\"%s\"") +ITT_STUB(ITTAPI, __itt_domain*, domain_createW, (const wchar_t *name), (ITT_FORMAT name), domain_createW, __itt_group_structure, "\"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_domain*, domain_create, (const char *name), (ITT_FORMAT name), domain_create, __itt_group_structure, "\"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_createA, (const char *name), (ITT_FORMAT name), string_handle_createA, __itt_group_structure, "\"%s\"") +ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_createW, (const wchar_t *name), (ITT_FORMAT name), string_handle_createW, __itt_group_structure, "\"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_string_handle*, string_handle_create, (const char *name), (ITT_FORMAT name), string_handle_create, __itt_group_structure, "\"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +ITT_STUBV(ITTAPI, void, pause, (void), (ITT_NO_PARAMS), pause, __itt_group_control | __itt_group_legacy, "no args") +ITT_STUBV(ITTAPI, void, resume, (void), (ITT_NO_PARAMS), resume, __itt_group_control | __itt_group_legacy, "no args") + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, thread_set_nameA, (const char *name), (ITT_FORMAT name), thread_set_nameA, __itt_group_thread, "\"%s\"") +ITT_STUBV(ITTAPI, void, thread_set_nameW, (const wchar_t *name), (ITT_FORMAT name), thread_set_nameW, __itt_group_thread, "\"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, thread_set_name, (const char *name), (ITT_FORMAT name), thread_set_name, __itt_group_thread, "\"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, thread_ignore, (void), (ITT_NO_PARAMS), thread_ignore, __itt_group_thread, "no args") + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, int, thr_name_setA, (const char *name, int namelen), (ITT_FORMAT name, namelen), thr_name_setA, __itt_group_thread | __itt_group_legacy, "\"%s\", %d") +ITT_STUB(LIBITTAPI, int, thr_name_setW, (const wchar_t *name, int namelen), (ITT_FORMAT name, namelen), thr_name_setW, __itt_group_thread | __itt_group_legacy, "\"%S\", %d") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, int, thr_name_set, (const char *name, int namelen), (ITT_FORMAT name, namelen), thr_name_set, __itt_group_thread | __itt_group_legacy, "\"%s\", %d") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(LIBITTAPI, void, thr_ignore, (void), (ITT_NO_PARAMS), thr_ignore, __itt_group_thread | __itt_group_legacy, "no args") +#endif /* __ITT_INTERNAL_BODY */ + +ITT_STUBV(ITTAPI, void, enable_attach, (void), (ITT_NO_PARAMS), enable_attach, __itt_group_all, "no args") + +#else /* __ITT_INTERNAL_INIT */ + +ITT_STUBV(ITTAPI, void, detach, (void), (ITT_NO_PARAMS), detach, __itt_group_control | __itt_group_legacy, "no args") + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, sync_createA, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_createA, __itt_group_sync | __itt_group_fsync, "%p, \"%s\", \"%s\", %x") +ITT_STUBV(ITTAPI, void, sync_createW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_createW, __itt_group_sync | __itt_group_fsync, "%p, \"%S\", \"%S\", %x") +ITT_STUBV(ITTAPI, void, sync_renameA, (void *addr, const char *name), (ITT_FORMAT addr, name), sync_renameA, __itt_group_sync | __itt_group_fsync, "%p, \"%s\"") +ITT_STUBV(ITTAPI, void, sync_renameW, (void *addr, const wchar_t *name), (ITT_FORMAT addr, name), sync_renameW, __itt_group_sync | __itt_group_fsync, "%p, \"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, sync_create, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_create, __itt_group_sync | __itt_group_fsync, "%p, \"%s\", \"%s\", %x") +ITT_STUBV(ITTAPI, void, sync_rename, (void *addr, const char *name), (ITT_FORMAT addr, name), sync_rename, __itt_group_sync | __itt_group_fsync, "%p, \"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, sync_destroy, (void *addr), (ITT_FORMAT addr), sync_destroy, __itt_group_sync | __itt_group_fsync, "%p") + +ITT_STUBV(ITTAPI, void, sync_prepare, (void* addr), (ITT_FORMAT addr), sync_prepare, __itt_group_sync, "%p") +ITT_STUBV(ITTAPI, void, sync_cancel, (void *addr), (ITT_FORMAT addr), sync_cancel, __itt_group_sync, "%p") +ITT_STUBV(ITTAPI, void, sync_acquired, (void *addr), (ITT_FORMAT addr), sync_acquired, __itt_group_sync, "%p") +ITT_STUBV(ITTAPI, void, sync_releasing, (void* addr), (ITT_FORMAT addr), sync_releasing, __itt_group_sync, "%p") + +ITT_STUBV(ITTAPI, void, suppress_push, (unsigned int mask), (ITT_FORMAT mask), suppress_push, __itt_group_suppress, "%p") +ITT_STUBV(ITTAPI, void, suppress_pop, (void), (ITT_NO_PARAMS), suppress_pop, __itt_group_suppress, "no args") +ITT_STUBV(ITTAPI, void, suppress_mark_range, (__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size),(ITT_FORMAT mode, mask, address, size), suppress_mark_range, __itt_group_suppress, "%d, %p, %p, %d") +ITT_STUBV(ITTAPI, void, suppress_clear_range,(__itt_suppress_mode_t mode, unsigned int mask, void * address, size_t size),(ITT_FORMAT mode, mask, address, size), suppress_clear_range,__itt_group_suppress, "%d, %p, %p, %d") + +ITT_STUBV(ITTAPI, void, fsync_prepare, (void* addr), (ITT_FORMAT addr), sync_prepare, __itt_group_fsync, "%p") +ITT_STUBV(ITTAPI, void, fsync_cancel, (void *addr), (ITT_FORMAT addr), sync_cancel, __itt_group_fsync, "%p") +ITT_STUBV(ITTAPI, void, fsync_acquired, (void *addr), (ITT_FORMAT addr), sync_acquired, __itt_group_fsync, "%p") +ITT_STUBV(ITTAPI, void, fsync_releasing, (void* addr), (ITT_FORMAT addr), sync_releasing, __itt_group_fsync, "%p") + +ITT_STUBV(ITTAPI, void, model_site_begin, (__itt_model_site *site, __itt_model_site_instance *instance, const char *name), (ITT_FORMAT site, instance, name), model_site_begin, __itt_group_model, "%p, %p, \"%s\"") +ITT_STUBV(ITTAPI, void, model_site_end, (__itt_model_site *site, __itt_model_site_instance *instance), (ITT_FORMAT site, instance), model_site_end, __itt_group_model, "%p, %p") +ITT_STUBV(ITTAPI, void, model_task_begin, (__itt_model_task *task, __itt_model_task_instance *instance, const char *name), (ITT_FORMAT task, instance, name), model_task_begin, __itt_group_model, "%p, %p, \"%s\"") +ITT_STUBV(ITTAPI, void, model_task_end, (__itt_model_task *task, __itt_model_task_instance *instance), (ITT_FORMAT task, instance), model_task_end, __itt_group_model, "%p, %p") +ITT_STUBV(ITTAPI, void, model_lock_acquire, (void *lock), (ITT_FORMAT lock), model_lock_acquire, __itt_group_model, "%p") +ITT_STUBV(ITTAPI, void, model_lock_release, (void *lock), (ITT_FORMAT lock), model_lock_release, __itt_group_model, "%p") +ITT_STUBV(ITTAPI, void, model_record_allocation, (void *addr, size_t size), (ITT_FORMAT addr, size), model_record_allocation, __itt_group_model, "%p, %d") +ITT_STUBV(ITTAPI, void, model_record_deallocation, (void *addr), (ITT_FORMAT addr), model_record_deallocation, __itt_group_model, "%p") +ITT_STUBV(ITTAPI, void, model_induction_uses, (void* addr, size_t size), (ITT_FORMAT addr, size), model_induction_uses, __itt_group_model, "%p, %d") +ITT_STUBV(ITTAPI, void, model_reduction_uses, (void* addr, size_t size), (ITT_FORMAT addr, size), model_reduction_uses, __itt_group_model, "%p, %d") +ITT_STUBV(ITTAPI, void, model_observe_uses, (void* addr, size_t size), (ITT_FORMAT addr, size), model_observe_uses, __itt_group_model, "%p, %d") +ITT_STUBV(ITTAPI, void, model_clear_uses, (void* addr), (ITT_FORMAT addr), model_clear_uses, __itt_group_model, "%p") + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, model_site_beginW, (const wchar_t *name), (ITT_FORMAT name), model_site_beginW, __itt_group_model, "\"%s\"") +ITT_STUBV(ITTAPI, void, model_task_beginW, (const wchar_t *name), (ITT_FORMAT name), model_task_beginW, __itt_group_model, "\"%s\"") +ITT_STUBV(ITTAPI, void, model_iteration_taskW, (const wchar_t *name), (ITT_FORMAT name), model_iteration_taskW, __itt_group_model, "\"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, model_site_beginA, (const char *name), (ITT_FORMAT name), model_site_beginA, __itt_group_model, "\"%s\"") +ITT_STUBV(ITTAPI, void, model_site_beginAL, (const char *name, size_t len), (ITT_FORMAT name, len), model_site_beginAL, __itt_group_model, "\"%s\", %d") +ITT_STUBV(ITTAPI, void, model_task_beginA, (const char *name), (ITT_FORMAT name), model_task_beginA, __itt_group_model, "\"%s\"") +ITT_STUBV(ITTAPI, void, model_task_beginAL, (const char *name, size_t len), (ITT_FORMAT name, len), model_task_beginAL, __itt_group_model, "\"%s\", %d") +ITT_STUBV(ITTAPI, void, model_iteration_taskA, (const char *name), (ITT_FORMAT name), model_iteration_taskA, __itt_group_model, "\"%s\"") +ITT_STUBV(ITTAPI, void, model_iteration_taskAL, (const char *name, size_t len), (ITT_FORMAT name, len), model_iteration_taskAL, __itt_group_model, "\"%s\", %d") +ITT_STUBV(ITTAPI, void, model_site_end_2, (void), (ITT_NO_PARAMS), model_site_end_2, __itt_group_model, "no args") +ITT_STUBV(ITTAPI, void, model_task_end_2, (void), (ITT_NO_PARAMS), model_task_end_2, __itt_group_model, "no args") +ITT_STUBV(ITTAPI, void, model_lock_acquire_2, (void *lock), (ITT_FORMAT lock), model_lock_acquire_2, __itt_group_model, "%p") +ITT_STUBV(ITTAPI, void, model_lock_release_2, (void *lock), (ITT_FORMAT lock), model_lock_release_2, __itt_group_model, "%p") +ITT_STUBV(ITTAPI, void, model_aggregate_task, (size_t count), (ITT_FORMAT count), model_aggregate_task, __itt_group_model, "%d") +ITT_STUBV(ITTAPI, void, model_disable_push, (__itt_model_disable x), (ITT_FORMAT x), model_disable_push, __itt_group_model, "%p") +ITT_STUBV(ITTAPI, void, model_disable_pop, (void), (ITT_NO_PARAMS), model_disable_pop, __itt_group_model, "no args") +#endif /* __ITT_INTERNAL_BODY */ + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_heap_function, heap_function_createA, (const char *name, const char *domain), (ITT_FORMAT name, domain), heap_function_createA, __itt_group_heap, "\"%s\", \"%s\"") +ITT_STUB(ITTAPI, __itt_heap_function, heap_function_createW, (const wchar_t *name, const wchar_t *domain), (ITT_FORMAT name, domain), heap_function_createW, __itt_group_heap, "\"%s\", \"%s\"") +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_heap_function, heap_function_create, (const char *name, const char *domain), (ITT_FORMAT name, domain), heap_function_create, __itt_group_heap, "\"%s\", \"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* __ITT_INTERNAL_BODY */ +ITT_STUBV(ITTAPI, void, heap_allocate_begin, (__itt_heap_function h, size_t size, int initialized), (ITT_FORMAT h, size, initialized), heap_allocate_begin, __itt_group_heap, "%p, %lu, %d") +ITT_STUBV(ITTAPI, void, heap_allocate_end, (__itt_heap_function h, void** addr, size_t size, int initialized), (ITT_FORMAT h, addr, size, initialized), heap_allocate_end, __itt_group_heap, "%p, %p, %lu, %d") +ITT_STUBV(ITTAPI, void, heap_free_begin, (__itt_heap_function h, void* addr), (ITT_FORMAT h, addr), heap_free_begin, __itt_group_heap, "%p, %p") +ITT_STUBV(ITTAPI, void, heap_free_end, (__itt_heap_function h, void* addr), (ITT_FORMAT h, addr), heap_free_end, __itt_group_heap, "%p, %p") +ITT_STUBV(ITTAPI, void, heap_reallocate_begin, (__itt_heap_function h, void* addr, size_t new_size, int initialized), (ITT_FORMAT h, addr, new_size, initialized), heap_reallocate_begin, __itt_group_heap, "%p, %p, %lu, %d") +ITT_STUBV(ITTAPI, void, heap_reallocate_end, (__itt_heap_function h, void* addr, void** new_addr, size_t new_size, int initialized), (ITT_FORMAT h, addr, new_addr, new_size, initialized), heap_reallocate_end, __itt_group_heap, "%p, %p, %p, %lu, %d") +ITT_STUBV(ITTAPI, void, heap_internal_access_begin, (void), (ITT_NO_PARAMS), heap_internal_access_begin, __itt_group_heap, "no args") +ITT_STUBV(ITTAPI, void, heap_internal_access_end, (void), (ITT_NO_PARAMS), heap_internal_access_end, __itt_group_heap, "no args") +ITT_STUBV(ITTAPI, void, heap_record_memory_growth_begin, (void), (ITT_NO_PARAMS), heap_record_memory_growth_begin, __itt_group_heap, "no args") +ITT_STUBV(ITTAPI, void, heap_record_memory_growth_end, (void), (ITT_NO_PARAMS), heap_record_memory_growth_end, __itt_group_heap, "no args") +ITT_STUBV(ITTAPI, void, heap_reset_detection, (unsigned int reset_mask), (ITT_FORMAT reset_mask), heap_reset_detection, __itt_group_heap, "%u") +ITT_STUBV(ITTAPI, void, heap_record, (unsigned int record_mask), (ITT_FORMAT record_mask), heap_record, __itt_group_heap, "%u") + +ITT_STUBV(ITTAPI, void, id_create, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), id_create, __itt_group_structure, "%p, %lu") +ITT_STUBV(ITTAPI, void, id_destroy, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), id_destroy, __itt_group_structure, "%p, %lu") + +ITT_STUB(ITTAPI, __itt_timestamp, get_timestamp, (void), (ITT_NO_PARAMS), get_timestamp, __itt_group_structure, "no args") + +ITT_STUBV(ITTAPI, void, region_begin, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), region_begin, __itt_group_structure, "%p, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, region_end, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), region_end, __itt_group_structure, "%p, %lu") + +#ifndef __ITT_INTERNAL_BODY +ITT_STUBV(ITTAPI, void, frame_begin_v3, (const __itt_domain *domain, __itt_id *id), (ITT_FORMAT domain, id), frame_begin_v3, __itt_group_structure, "%p, %p") +ITT_STUBV(ITTAPI, void, frame_end_v3, (const __itt_domain *domain, __itt_id *id), (ITT_FORMAT domain, id), frame_end_v3, __itt_group_structure, "%p, %p") +ITT_STUBV(ITTAPI, void, frame_submit_v3, (const __itt_domain *domain, __itt_id *id, __itt_timestamp begin, __itt_timestamp end), (ITT_FORMAT domain, id, begin, end), frame_submit_v3, __itt_group_structure, "%p, %p, %lu, %lu") +#endif /* __ITT_INTERNAL_BODY */ + +ITT_STUBV(ITTAPI, void, task_group, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), task_group, __itt_group_structure, "%p, %lu, %lu, %p") + +ITT_STUBV(ITTAPI, void, task_begin, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), task_begin, __itt_group_structure, "%p, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, task_begin_fn, (const __itt_domain *domain, __itt_id id, __itt_id parent, void* fn), (ITT_FORMAT domain, id, parent, fn), task_begin_fn, __itt_group_structure, "%p, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, task_end, (const __itt_domain *domain), (ITT_FORMAT domain), task_end, __itt_group_structure, "%p") + +ITT_STUBV(ITTAPI, void, counter_inc_v3, (const __itt_domain *domain, __itt_string_handle *name), (ITT_FORMAT domain, name), counter_inc_v3, __itt_group_structure, "%p, %p") +ITT_STUBV(ITTAPI, void, counter_inc_delta_v3, (const __itt_domain *domain, __itt_string_handle *name, unsigned long long value), (ITT_FORMAT domain, name, value), counter_inc_delta_v3, __itt_group_structure, "%p, %p, %lu") + +ITT_STUBV(ITTAPI, void, marker, (const __itt_domain *domain, __itt_id id, __itt_string_handle *name, __itt_scope scope), (ITT_FORMAT domain, id, name, scope), marker, __itt_group_structure, "%p, %lu, %p, %d") + +ITT_STUBV(ITTAPI, void, metadata_add, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data), (ITT_FORMAT domain, id, key, type, count, data), metadata_add, __itt_group_structure, "%p, %lu, %p, %d, %lu, %p") +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, metadata_str_addA, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char* data, size_t length), (ITT_FORMAT domain, id, key, data, length), metadata_str_addA, __itt_group_structure, "%p, %lu, %p, %p, %lu") +ITT_STUBV(ITTAPI, void, metadata_str_addW, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const wchar_t* data, size_t length), (ITT_FORMAT domain, id, key, data, length), metadata_str_addW, __itt_group_structure, "%p, %lu, %p, %p, %lu") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, metadata_str_add, (const __itt_domain *domain, __itt_id id, __itt_string_handle *key, const char* data, size_t length), (ITT_FORMAT domain, id, key, data, length), metadata_str_add, __itt_group_structure, "%p, %lu, %p, %p, %lu") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +ITT_STUBV(ITTAPI, void, relation_add_to_current, (const __itt_domain *domain, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, relation, tail), relation_add_to_current, __itt_group_structure, "%p, %lu, %p") +ITT_STUBV(ITTAPI, void, relation_add, (const __itt_domain *domain, __itt_id head, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, head, relation, tail), relation_add, __itt_group_structure, "%p, %p, %lu, %p") + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, __itt_event, event_createA, (const char *name, int namelen), (ITT_FORMAT name, namelen), event_createA, __itt_group_mark | __itt_group_legacy, "\"%s\", %d") +ITT_STUB(LIBITTAPI, __itt_event, event_createW, (const wchar_t *name, int namelen), (ITT_FORMAT name, namelen), event_createW, __itt_group_mark | __itt_group_legacy, "\"%S\", %d") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, __itt_event, event_create, (const char *name, int namelen), (ITT_FORMAT name, namelen), event_create, __itt_group_mark | __itt_group_legacy, "\"%s\", %d") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, int, event_start, (__itt_event event), (ITT_FORMAT event), event_start, __itt_group_mark | __itt_group_legacy, "%d") +ITT_STUB(LIBITTAPI, int, event_end, (__itt_event event), (ITT_FORMAT event), event_end, __itt_group_mark | __itt_group_legacy, "%d") +#endif /* __ITT_INTERNAL_BODY */ + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, sync_set_nameA, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_set_nameA, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%s\", \"%s\", %x") +ITT_STUBV(ITTAPI, void, sync_set_nameW, (void *addr, const wchar_t *objtype, const wchar_t *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_set_nameW, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%S\", \"%S\", %x") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, sync_set_name, (void *addr, const char *objtype, const char *objname, int attribute), (ITT_FORMAT addr, objtype, objname, attribute), sync_set_name, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "p, \"%s\", \"%s\", %x") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(LIBITTAPI, int, notify_sync_nameA, (void *p, const char *objtype, int typelen, const char *objname, int namelen, int attribute), (ITT_FORMAT p, objtype, typelen, objname, namelen, attribute), notify_sync_nameA, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%s\", %d, \"%s\", %d, %x") +ITT_STUB(LIBITTAPI, int, notify_sync_nameW, (void *p, const wchar_t *objtype, int typelen, const wchar_t *objname, int namelen, int attribute), (ITT_FORMAT p, objtype, typelen, objname, namelen, attribute), notify_sync_nameW, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%S\", %d, \"%S\", %d, %x") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(LIBITTAPI, int, notify_sync_name, (void *p, const char *objtype, int typelen, const char *objname, int namelen, int attribute), (ITT_FORMAT p, objtype, typelen, objname, namelen, attribute), notify_sync_name, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p, \"%s\", %d, \"%s\", %d, %x") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +ITT_STUBV(LIBITTAPI, void, notify_sync_prepare, (void *p), (ITT_FORMAT p), notify_sync_prepare, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p") +ITT_STUBV(LIBITTAPI, void, notify_sync_cancel, (void *p), (ITT_FORMAT p), notify_sync_cancel, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p") +ITT_STUBV(LIBITTAPI, void, notify_sync_acquired, (void *p), (ITT_FORMAT p), notify_sync_acquired, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p") +ITT_STUBV(LIBITTAPI, void, notify_sync_releasing, (void *p), (ITT_FORMAT p), notify_sync_releasing, __itt_group_sync | __itt_group_fsync | __itt_group_legacy, "%p") +#endif /* __ITT_INTERNAL_BODY */ + +ITT_STUBV(LIBITTAPI, void, memory_read, (void *addr, size_t size), (ITT_FORMAT addr, size), memory_read, __itt_group_legacy, "%p, %lu") +ITT_STUBV(LIBITTAPI, void, memory_write, (void *addr, size_t size), (ITT_FORMAT addr, size), memory_write, __itt_group_legacy, "%p, %lu") +ITT_STUBV(LIBITTAPI, void, memory_update, (void *addr, size_t size), (ITT_FORMAT addr, size), memory_update, __itt_group_legacy, "%p, %lu") + +ITT_STUB(LIBITTAPI, __itt_state_t, state_get, (void), (ITT_NO_PARAMS), state_get, __itt_group_legacy, "no args") +ITT_STUB(LIBITTAPI, __itt_state_t, state_set, (__itt_state_t s), (ITT_FORMAT s), state_set, __itt_group_legacy, "%d") +ITT_STUB(LIBITTAPI, __itt_obj_state_t, obj_mode_set, (__itt_obj_prop_t p, __itt_obj_state_t s), (ITT_FORMAT p, s), obj_mode_set, __itt_group_legacy, "%d, %d") +ITT_STUB(LIBITTAPI, __itt_thr_state_t, thr_mode_set, (__itt_thr_prop_t p, __itt_thr_state_t s), (ITT_FORMAT p, s), thr_mode_set, __itt_group_legacy, "%d, %d") + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_frame, frame_createA, (const char *domain), (ITT_FORMAT domain), frame_createA, __itt_group_frame, "\"%s\"") +ITT_STUB(ITTAPI, __itt_frame, frame_createW, (const wchar_t *domain), (ITT_FORMAT domain), frame_createW, __itt_group_frame, "\"%s\"") +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_frame, frame_create, (const char *domain), (ITT_FORMAT domain), frame_create, __itt_group_frame, "\"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* __ITT_INTERNAL_BODY */ +ITT_STUBV(ITTAPI, void, frame_begin, (__itt_frame frame), (ITT_FORMAT frame), frame_begin, __itt_group_frame, "%p") +ITT_STUBV(ITTAPI, void, frame_end, (__itt_frame frame), (ITT_FORMAT frame), frame_end, __itt_group_frame, "%p") + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_counter, counter_createA, (const char *name, const char *domain), (ITT_FORMAT name, domain), counter_createA, __itt_group_counter, "\"%s\", \"%s\"") +ITT_STUB(ITTAPI, __itt_counter, counter_createW, (const wchar_t *name, const wchar_t *domain), (ITT_FORMAT name, domain), counter_createW, __itt_group_counter, "\"%s\", \"%s\"") +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_counter, counter_create, (const char *name, const char *domain), (ITT_FORMAT name, domain), counter_create, __itt_group_counter, "\"%s\", \"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* __ITT_INTERNAL_BODY */ +ITT_STUBV(ITTAPI, void, counter_destroy, (__itt_counter id), (ITT_FORMAT id), counter_destroy, __itt_group_counter, "%p") +ITT_STUBV(ITTAPI, void, counter_inc, (__itt_counter id), (ITT_FORMAT id), counter_inc, __itt_group_counter, "%p") +ITT_STUBV(ITTAPI, void, counter_inc_delta, (__itt_counter id, unsigned long long value), (ITT_FORMAT id, value), counter_inc_delta, __itt_group_counter, "%p, %lu") + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, __itt_mark_type, mark_createA, (const char *name), (ITT_FORMAT name), mark_createA, __itt_group_mark, "\"%s\"") +ITT_STUB(ITTAPI, __itt_mark_type, mark_createW, (const wchar_t *name), (ITT_FORMAT name), mark_createW, __itt_group_mark, "\"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, __itt_mark_type, mark_create, (const char *name), (ITT_FORMAT name), mark_create, __itt_group_mark, "\"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* __ITT_INTERNAL_BODY */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, int, markA, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), markA, __itt_group_mark, "%d, \"%s\"") +ITT_STUB(ITTAPI, int, markW, (__itt_mark_type mt, const wchar_t *parameter), (ITT_FORMAT mt, parameter), markW, __itt_group_mark, "%d, \"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, mark, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), mark, __itt_group_mark, "%d, \"%s\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, mark_off, (__itt_mark_type mt), (ITT_FORMAT mt), mark_off, __itt_group_mark, "%d") +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, int, mark_globalA, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), mark_globalA, __itt_group_mark, "%d, \"%s\"") +ITT_STUB(ITTAPI, int, mark_globalW, (__itt_mark_type mt, const wchar_t *parameter), (ITT_FORMAT mt, parameter), mark_globalW, __itt_group_mark, "%d, \"%S\"") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, mark_global, (__itt_mark_type mt, const char *parameter), (ITT_FORMAT mt, parameter), mark_global, __itt_group_mark, "%d, \"%S\"") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, mark_global_off, (__itt_mark_type mt), (ITT_FORMAT mt), mark_global_off, __itt_group_mark, "%d") + +#ifndef __ITT_INTERNAL_BODY +ITT_STUB(ITTAPI, __itt_caller, stack_caller_create, (void), (ITT_NO_PARAMS), stack_caller_create, __itt_group_stitch, "no args") +#endif /* __ITT_INTERNAL_BODY */ +ITT_STUBV(ITTAPI, void, stack_caller_destroy, (__itt_caller id), (ITT_FORMAT id), stack_caller_destroy, __itt_group_stitch, "%p") +ITT_STUBV(ITTAPI, void, stack_callee_enter, (__itt_caller id), (ITT_FORMAT id), stack_callee_enter, __itt_group_stitch, "%p") +ITT_STUBV(ITTAPI, void, stack_callee_leave, (__itt_caller id), (ITT_FORMAT id), stack_callee_leave, __itt_group_stitch, "%p") + +ITT_STUB(ITTAPI, __itt_clock_domain*, clock_domain_create, (__itt_get_clock_info_fn fn, void* fn_data), (ITT_FORMAT fn, fn_data), clock_domain_create, __itt_group_structure, "%p, %p") +ITT_STUBV(ITTAPI, void, clock_domain_reset, (void), (ITT_NO_PARAMS), clock_domain_reset, __itt_group_structure, "no args") +ITT_STUBV(ITTAPI, void, id_create_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id), (ITT_FORMAT domain, clock_domain, timestamp, id), id_create_ex, __itt_group_structure, "%p, %p, %lu, %lu") +ITT_STUBV(ITTAPI, void, id_destroy_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id), (ITT_FORMAT domain, clock_domain, timestamp, id), id_destroy_ex, __itt_group_structure, "%p, %p, %lu, %lu") +ITT_STUBV(ITTAPI, void, task_begin_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, __itt_string_handle *name), (ITT_FORMAT domain, clock_domain, timestamp, id, parentid, name), task_begin_ex, __itt_group_structure, "%p, %p, %lu, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, task_begin_fn_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, void* fn), (ITT_FORMAT domain, clock_domain, timestamp, id, parentid, fn), task_begin_fn_ex, __itt_group_structure, "%p, %p, %lu, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, task_end_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp), (ITT_FORMAT domain, clock_domain, timestamp), task_end_ex, __itt_group_structure, "%p, %p, %lu") +ITT_STUBV(ITTAPI, void, task_begin_overlapped, (const __itt_domain *domain, __itt_id id, __itt_id parent, __itt_string_handle *name), (ITT_FORMAT domain, id, parent, name), task_begin_overlapped, __itt_group_structure, "%p, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, task_begin_overlapped_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_id parentid, __itt_string_handle *name), (ITT_FORMAT domain, clock_domain, timestamp, id, parentid, name), task_begin_overlapped_ex, __itt_group_structure, "%p, %p, %lu, %lu, %lu, %p") +ITT_STUBV(ITTAPI, void, task_end_overlapped, (const __itt_domain *domain, __itt_id id), (ITT_FORMAT domain, id), task_end_overlapped, __itt_group_structure, "%p, %lu") +ITT_STUBV(ITTAPI, void, task_end_overlapped_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id), (ITT_FORMAT domain, clock_domain, timestamp, id), task_end_overlapped_ex, __itt_group_structure, "%p, %p, %lu, %lu") +ITT_STUBV(ITTAPI, void, marker_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id id, __itt_string_handle *name, __itt_scope scope), (ITT_FORMAT domain, clock_domain, timestamp, id, name, scope), marker_ex, __itt_group_structure, "%p, %p, %lu, %lu, %p, %d") +ITT_STUBV(ITTAPI, void, metadata_add_with_scope, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, __itt_metadata_type type, size_t count, void *data), (ITT_FORMAT domain, scope, key, type, count, data), metadata_add_with_scope, __itt_group_structure, "%p, %d, %p, %d, %lu, %p") +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, metadata_str_add_with_scopeA, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length), (ITT_FORMAT domain, scope, key, data, length), metadata_str_add_with_scopeA, __itt_group_structure, "%p, %d, %p, %p, %lu") +ITT_STUBV(ITTAPI, void, metadata_str_add_with_scopeW, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const wchar_t *data, size_t length), (ITT_FORMAT domain, scope, key, data, length), metadata_str_add_with_scopeW, __itt_group_structure, "%p, %d, %p, %p, %lu") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, metadata_str_add_with_scope, (const __itt_domain *domain, __itt_scope scope, __itt_string_handle *key, const char *data, size_t length), (ITT_FORMAT domain, scope, key, data, length), metadata_str_add_with_scope, __itt_group_structure, "%p, %d, %p, %p, %lu") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, relation_add_to_current_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, clock_domain, timestamp, relation, tail), relation_add_to_current_ex, __itt_group_structure, "%p, %p, %lu, %d, %lu") +ITT_STUBV(ITTAPI, void, relation_add_ex, (const __itt_domain *domain, __itt_clock_domain* clock_domain, unsigned long long timestamp, __itt_id head, __itt_relation relation, __itt_id tail), (ITT_FORMAT domain, clock_domain, timestamp, head, relation, tail), relation_add_ex, __itt_group_structure, "%p, %p, %lu, %lu, %d, %lu") +ITT_STUB(ITTAPI, __itt_track_group*, track_group_create, (__itt_string_handle* name, __itt_track_group_type track_group_type), (ITT_FORMAT name, track_group_type), track_group_create, __itt_group_structure, "%p, %d") +ITT_STUB(ITTAPI, __itt_track*, track_create, (__itt_track_group* track_group,__itt_string_handle* name, __itt_track_type track_type), (ITT_FORMAT track_group, name, track_type), track_create, __itt_group_structure, "%p, %p, %d") +ITT_STUBV(ITTAPI, void, set_track, (__itt_track *track), (ITT_FORMAT track), set_track, __itt_group_structure, "%p") + +#ifndef __ITT_INTERNAL_BODY +ITT_STUB(ITTAPI, const char*, api_version, (void), (ITT_NO_PARAMS), api_version, __itt_group_all & ~__itt_group_legacy, "no args") +#endif /* __ITT_INTERNAL_BODY */ + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUB(ITTAPI, int, av_saveA, (void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder), (ITT_FORMAT data, rank, dimensions, type, filePath, columnOrder), av_saveA, __itt_group_arrays, "%p, %d, %p, %d, \"%s\", %d") +ITT_STUB(ITTAPI, int, av_saveW, (void *data, int rank, const int *dimensions, int type, const wchar_t *filePath, int columnOrder), (ITT_FORMAT data, rank, dimensions, type, filePath, columnOrder), av_saveW, __itt_group_arrays, "%p, %d, %p, %d, \"%S\", %d") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUB(ITTAPI, int, av_save, (void *data, int rank, const int *dimensions, int type, const char *filePath, int columnOrder), (ITT_FORMAT data, rank, dimensions, type, filePath, columnOrder), av_save, __itt_group_arrays, "%p, %d, %p, %d, \"%s\", %d") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* __ITT_INTERNAL_BODY */ + +#ifndef __ITT_INTERNAL_BODY +#if ITT_PLATFORM==ITT_PLATFORM_WIN +ITT_STUBV(ITTAPI, void, module_loadA, (void *start_addr, void* end_addr, const char *path), (ITT_FORMAT start_addr, end_addr, path), module_loadA, __itt_group_none, "%p, %p, %p") +ITT_STUBV(ITTAPI, void, module_loadW, (void *start_addr, void* end_addr, const wchar_t *path), (ITT_FORMAT start_addr, end_addr, path), module_loadW, __itt_group_none, "%p, %p, %p") +#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */ +ITT_STUBV(ITTAPI, void, module_load, (void *start_addr, void *end_addr, const char *path), (ITT_FORMAT start_addr, end_addr, path), module_load, __itt_group_none, "%p, %p, %p") +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#endif /* __ITT_INTERNAL_BODY */ + + +#endif /* __ITT_INTERNAL_INIT */ diff --git a/external/vtune/linux/sdk/src/ittnotify/ittnotify_types.h b/external/vtune/linux/sdk/src/ittnotify/ittnotify_types.h new file mode 100644 index 0000000000..d6320d2b4a --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/ittnotify_types.h @@ -0,0 +1,115 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ITTNOTIFY_TYPES_H_ +#define _ITTNOTIFY_TYPES_H_ + +typedef enum ___itt_group_id +{ + __itt_group_none = 0, + __itt_group_legacy = 1<<0, + __itt_group_control = 1<<1, + __itt_group_thread = 1<<2, + __itt_group_mark = 1<<3, + __itt_group_sync = 1<<4, + __itt_group_fsync = 1<<5, + __itt_group_jit = 1<<6, + __itt_group_model = 1<<7, + __itt_group_splitter_min = 1<<7, + __itt_group_counter = 1<<8, + __itt_group_frame = 1<<9, + __itt_group_stitch = 1<<10, + __itt_group_heap = 1<<11, + __itt_group_splitter_max = 1<<12, + __itt_group_structure = 1<<12, + __itt_group_suppress = 1<<13, + __itt_group_arrays = 1<<14, + __itt_group_all = -1 +} __itt_group_id; + +#pragma pack(push, 8) + +typedef struct ___itt_group_list +{ + __itt_group_id id; + const char* name; +} __itt_group_list; + +#pragma pack(pop) + +#define ITT_GROUP_LIST(varname) \ + static __itt_group_list varname[] = { \ + { __itt_group_all, "all" }, \ + { __itt_group_control, "control" }, \ + { __itt_group_thread, "thread" }, \ + { __itt_group_mark, "mark" }, \ + { __itt_group_sync, "sync" }, \ + { __itt_group_fsync, "fsync" }, \ + { __itt_group_jit, "jit" }, \ + { __itt_group_model, "model" }, \ + { __itt_group_counter, "counter" }, \ + { __itt_group_frame, "frame" }, \ + { __itt_group_stitch, "stitch" }, \ + { __itt_group_heap, "heap" }, \ + { __itt_group_structure, "structure" }, \ + { __itt_group_suppress, "suppress" }, \ + { __itt_group_arrays, "arrays" }, \ + { __itt_group_none, NULL } \ + } + +#endif /* _ITTNOTIFY_TYPES_H_ */ diff --git a/external/vtune/linux/sdk/src/ittnotify/jitprofiling.c b/external/vtune/linux/sdk/src/ittnotify/jitprofiling.c new file mode 100644 index 0000000000..647aac1193 --- /dev/null +++ b/external/vtune/linux/sdk/src/ittnotify/jitprofiling.c @@ -0,0 +1,315 @@ +/* + This file is provided under a dual BSD/GPLv2 license. When using or + redistributing this file, you may do so under either license. + + GPL LICENSE SUMMARY + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + The full GNU General Public License is included in this distribution + in the file called LICENSE.GPL. + + Contact Information: + http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/ + + BSD LICENSE + + Copyright (c) 2005-2014 Intel Corporation. All rights reserved. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "ittnotify_config.h" + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#include +#pragma optimize("", off) +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ +#if ITT_PLATFORM != ITT_PLATFORM_MAC && ITT_PLATFORM != ITT_PLATFORM_FREEBSD +#include +#endif +#include + +#include "jitprofiling.h" + +static const char rcsid[] = "\n@(#) $Revision: 398909 $\n"; + +#define DLL_ENVIRONMENT_VAR "VS_PROFILER" + +#ifndef NEW_DLL_ENVIRONMENT_VAR +#if ITT_ARCH==ITT_ARCH_IA32 +#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER32" +#else +#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER64" +#endif +#endif /* NEW_DLL_ENVIRONMENT_VAR */ + +#if ITT_PLATFORM==ITT_PLATFORM_WIN +#define DEFAULT_DLLNAME "JitPI.dll" +HINSTANCE m_libHandle = NULL; +#elif ITT_PLATFORM==ITT_PLATFORM_MAC +#define DEFAULT_DLLNAME "libJitPI.dylib" +void* m_libHandle = NULL; +#else +#define DEFAULT_DLLNAME "libJitPI.so" +void* m_libHandle = NULL; +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + +/* default location of JIT profiling agent on Android */ +#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so" + +/* the function pointers */ +typedef unsigned int(*TPInitialize)(void); +static TPInitialize FUNC_Initialize=NULL; + +typedef unsigned int(*TPNotify)(unsigned int, void*); +static TPNotify FUNC_NotifyEvent=NULL; + +static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING; + +/* end collector dll part. */ + +/* loadiJIT_Funcs() : this function is called just in the beginning + * and is responsible to load the functions from BistroJavaCollector.dll + * result: + * on success: the functions loads, iJIT_DLL_is_missing=0, return value = 1 + * on failure: the functions are NULL, iJIT_DLL_is_missing=1, return value = 0 + */ +static int loadiJIT_Funcs(void); + +/* global representing whether the collector can't be loaded */ +static int iJIT_DLL_is_missing = 0; + +ITT_EXTERN_C int JITAPI +iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData) +{ + int ReturnValue; + + /* initialization part - the collector has not been loaded yet. */ + if (!FUNC_NotifyEvent) + { + if (iJIT_DLL_is_missing) + return 0; + + if (!loadiJIT_Funcs()) + return 0; + } + + if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED || + event_type == iJVM_EVENT_TYPE_METHOD_UPDATE) + { + if (((piJIT_Method_Load)EventSpecificData)->method_id == 0) + return 0; + } + else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2) + { + if (((piJIT_Method_Load_V2)EventSpecificData)->method_id == 0) + return 0; + } + else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3) + { + if (((piJIT_Method_Load_V3)EventSpecificData)->method_id == 0) + return 0; + } + else if (event_type == iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED) + { + if (((piJIT_Method_Inline_Load)EventSpecificData)->method_id == 0 || + ((piJIT_Method_Inline_Load)EventSpecificData)->parent_method_id == 0) + return 0; + } + + ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData); + + return ReturnValue; +} + +ITT_EXTERN_C iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive() +{ + if (!iJIT_DLL_is_missing) + { + loadiJIT_Funcs(); + } + + return executionMode; +} + +/* This function loads the collector dll and the relevant functions. + * on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1 + * on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0 + */ +static int loadiJIT_Funcs() +{ + static int bDllWasLoaded = 0; + char *dllName = (char*)rcsid; /* !! Just to avoid unused code elimination */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN + DWORD dNameLength = 0; +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + + if(bDllWasLoaded) + { + /* dll was already loaded, no need to do it for the second time */ + return 1; + } + + /* Assumes that the DLL will not be found */ + iJIT_DLL_is_missing = 1; + FUNC_NotifyEvent = NULL; + + if (m_libHandle) + { +#if ITT_PLATFORM==ITT_PLATFORM_WIN + FreeLibrary(m_libHandle); +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + dlclose(m_libHandle); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + m_libHandle = NULL; + } + + /* Try to get the dll name from the environment */ +#if ITT_PLATFORM==ITT_PLATFORM_WIN + dNameLength = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, NULL, 0); + if (dNameLength) + { + DWORD envret = 0; + dllName = (char*)malloc(sizeof(char) * (dNameLength + 1)); + if(dllName != NULL) + { + envret = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, + dllName, dNameLength); + if (envret) + { + /* Try to load the dll from the PATH... */ + m_libHandle = LoadLibraryExA(dllName, + NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } + free(dllName); + } + } else { + /* Try to use old VS_PROFILER variable */ + dNameLength = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, NULL, 0); + if (dNameLength) + { + DWORD envret = 0; + dllName = (char*)malloc(sizeof(char) * (dNameLength + 1)); + if(dllName != NULL) + { + envret = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, + dllName, dNameLength); + if (envret) + { + /* Try to load the dll from the PATH... */ + m_libHandle = LoadLibraryA(dllName); + } + free(dllName); + } + } + } +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + dllName = getenv(NEW_DLL_ENVIRONMENT_VAR); + if (!dllName) + dllName = getenv(DLL_ENVIRONMENT_VAR); +#if defined(__ANDROID__) || defined(ANDROID) + if (!dllName) + dllName = ANDROID_JIT_AGENT_PATH; +#endif + if (dllName) + { + /* Try to load the dll from the PATH... */ + m_libHandle = dlopen(dllName, RTLD_LAZY); + } +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + + if (!m_libHandle) + { +#if ITT_PLATFORM==ITT_PLATFORM_WIN + m_libHandle = LoadLibraryA(DEFAULT_DLLNAME); +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + } + + /* if the dll wasn't loaded - exit. */ + if (!m_libHandle) + { + iJIT_DLL_is_missing = 1; /* don't try to initialize + * JIT agent the second time + */ + return 0; + } + +#if ITT_PLATFORM==ITT_PLATFORM_WIN + FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent"); +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + FUNC_NotifyEvent = (TPNotify)dlsym(m_libHandle, "NotifyEvent"); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + if (!FUNC_NotifyEvent) + { + FUNC_Initialize = NULL; + return 0; + } + +#if ITT_PLATFORM==ITT_PLATFORM_WIN + FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize"); +#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + FUNC_Initialize = (TPInitialize)dlsym(m_libHandle, "Initialize"); +#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ + if (!FUNC_Initialize) + { + FUNC_NotifyEvent = NULL; + return 0; + } + + executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize(); + + bDllWasLoaded = 1; + iJIT_DLL_is_missing = 0; /* DLL is ok. */ + + return 1; +} + +ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID() +{ + static unsigned int methodID = 1; + + if (methodID == 0) + return 0; /* ERROR : this is not a valid value */ + + return methodID++; +} diff --git a/linux/installer/bin/build-installpkg.sh b/linux/installer/bin/build-installpkg.sh new file mode 100755 index 0000000000..5db4537402 --- /dev/null +++ b/linux/installer/bin/build-installpkg.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +set -e + +[[ $# -eq 1 ]] || { + echo "Usage : ./build-installpkg.sh sdk | psw " + exit 1 +} + +[[ "$1" == "sdk" ]] || [[ "$1" == "psw" ]] || { + echo "Usage : ./build-installpkg.sh sdk | psw " + exit 1 +} + +INSTALLER_TYPE="$1" + +SCRIPT_DIR=$(dirname "$0") +ROOT_DIR="${SCRIPT_DIR}/../../.." +LINUX_INSTALLER_COMMON_DIR="${ROOT_DIR}/linux/installer/common" +LINUX_INSTALLER_COMMON_SDK_DIR="${LINUX_INSTALLER_COMMON_DIR}/sdk" +LINUX_INSTALLER_COMMON_PSW_DIR="${LINUX_INSTALLER_COMMON_DIR}/psw" + +# The result dir of the build +BUILD_DIR=${ROOT_DIR}/build/linux + +# Get the architecture of the build from generated binary +get_arch() +{ + local a=$(readelf -h $BUILD_DIR/sgx_sign | awk '/Class:/{print $2}') + test $a = ELF64 && echo 'x86_64' || echo 'x86' +} + + +ARCH=$(get_arch) + +case $ARCH in + x86_64)PACKAGE_SUFFIX="x64" + ;; + x86)PACKAGE_SUFFIX="x86" + ;; +esac + +case "$INSTALLER_TYPE" in + psw) + source ${LINUX_INSTALLER_COMMON_PSW_DIR}/installConfig.${PACKAGE_SUFFIX} + ${LINUX_INSTALLER_COMMON_PSW_DIR}/createTarball.sh + cp ${LINUX_INSTALLER_COMMON_PSW_DIR}/output/${TARBALL_NAME} ${SCRIPT_DIR} + ;; + sdk) + source ${LINUX_INSTALLER_COMMON_SDK_DIR}/installConfig.${PACKAGE_SUFFIX} + ${LINUX_INSTALLER_COMMON_SDK_DIR}/createTarball.sh + cp ${LINUX_INSTALLER_COMMON_SDK_DIR}/output/${TARBALL_NAME} ${SCRIPT_DIR} + ;; +esac + +trap "rm -f ${SCRIPT_DIR}/$TARBALL_NAME 2>/dev/null" 0 + +# Create the tarball and compute its MD5 check sum. +m=$(md5sum ${SCRIPT_DIR}/$TARBALL_NAME | awk '{print $1}') +v=$(awk '/STRFILEVER/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') +TEMPLATE_FILE=$SCRIPT_DIR/install-sgx-"$INSTALLER_TYPE".bin.tmpl +INSTALLER_NAME=$SCRIPT_DIR/sgx_linux_"${PACKAGE_SUFFIX}"_"$INSTALLER_TYPE"_"$v".bin +l=$(wc -l $TEMPLATE_FILE | awk '{print $1}') +l=$(($l+1)) + +sed -e "s:@linenum@:$l:" \ + -e "s:@md5sum@:$m:" \ + -e "s:@arch@:$ARCH:" \ + $TEMPLATE_FILE > $INSTALLER_NAME + +cat ${SCRIPT_DIR}/${TARBALL_NAME} >> $INSTALLER_NAME +chmod +x $INSTALLER_NAME +echo "Generated ${INSTALLER_TYPE} installer: $INSTALLER_NAME" +exit 0 diff --git a/linux/installer/bin/install-sgx-psw.bin.tmpl b/linux/installer/bin/install-sgx-psw.bin.tmpl new file mode 100755 index 0000000000..4c36e367ff --- /dev/null +++ b/linux/installer/bin/install-sgx-psw.bin.tmpl @@ -0,0 +1,110 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +modinfo isgx &> /dev/null +if [[ $? != "0" ]]; then + echo "Please install the driver package before the PSW package" + exit 4 +fi + +set -e + +PKG_NAME="Intel SGX PSW Package" + +if test $(id -u) -ne 0; then + echo "Root privilege is required to install $PKG_NAME." + exit 4 +fi + + +PKG_ARCH=@arch@ +ARCH=$(arch) + +if [ $ARCH == "i386" ] || [ $ARCH == "i586" ] || [ $ARCH == "i686" ]; then + ARCH=x86 +fi + +if [[ $ARCH != $PKG_ARCH ]]; then + echo "$PKG_ARCH $PKG_NAME can not be installed on $ARCH platform." + exit 4 +fi + +PATH=/usr/bin:/bin +umask 022 + +PSWPKG=`mktemp -t sgx-psw-pkg.XXXXXX` +PSW_TEMP_FOLDER=`mktemp -d sgx-psw-XXXXXX -p /tmp` +trap "rm -fr $PSWPKG $PSW_TEMP_FOLDER= 2>/dev/null; exit 3" HUP INT QUIT TERM + +# The number of lines in this script (plus 1). Using this number to +# calculate the start address of the payload. +NR_SCRIPT_LINES=@linenum@ + +# Run /usr/bin/md5sum on the binary payload to get the MD5 check sum. +CHKSUM=@md5sum@ + +# Get the install payload from this shell script. +echo -n "Unpacking $PKG_NAME ..." +tail -n +$NR_SCRIPT_LINES "$0" > $PSWPKG +echo " done." + +echo -n "Verifying the integrity of the install package ..." +if test $(md5sum $PSWPKG | awk '{print $1}') != $CHKSUM; then + echo " The install package appears to be corrupted." + exit 1 +fi +echo " done." + +echo -n "Installing $PKG_NAME ..." +tar zxf $PSWPKG -C $PSW_TEMP_FOLDER >/dev/null 2>&1 +retcode=$? # Save the return code +# Clean-up the temporary tarball. +rm -f $PSWPKG 2>/dev/null + +if test $retcode -ne 0; then + echo " failed." + exit 2 +fi + +pushd $PSW_TEMP_FOLDER + +source scripts/installConfig +make install + +popd + +${SGX_PACKAGES_PATH}/${PSW_PKG_NAME}/scripts/install.sh + +rm -fr ${PSW_TEMP_FOLDER} + + +exit 0 diff --git a/linux/installer/bin/install-sgx-sdk.bin.tmpl b/linux/installer/bin/install-sgx-sdk.bin.tmpl new file mode 100755 index 0000000000..71457ba804 --- /dev/null +++ b/linux/installer/bin/install-sgx-sdk.bin.tmpl @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +set -e + +PKG_NAME="Intel SGX SDK" + +if test $(id -u) -ne 0; then + echo "Root privilege is required to install $PKG_NAME." + exit 4 +fi + +PATH=/usr/bin:/bin +umask 022 + +SDKPKG=`mktemp -t sgx-sdk-pkg.XXXXXX` +SDK_TEMP_FOLDER=`mktemp -d sgx-sdk-XXXXXX -p /tmp` +trap "rm -rf $SDKPKG $SDK_TEMP_FOLDER 2>/dev/null; exit 3" HUP INT QUIT TERM + +# The number of lines in this script (plus 1). Using this number to +# calculate the start address of the payload. +NR_SCRIPT_LINES=@linenum@ + +# Run /usr/bin/md5sum on the binary payload to get the MD5 check sum. +CHKSUM=@md5sum@ + +# Get the install payload from this shell script. +echo -n "Unpacking $PKG_NAME ..." +tail -n +$NR_SCRIPT_LINES "$0" > $SDKPKG +echo " done." + +echo -n "Verifying the integrity of the install package ..." +if test $(md5sum $SDKPKG | awk '{print $1}') != $CHKSUM; then + echo " The install package appears to be corrupted." + exit 1 +fi +echo " done." + +echo -n "Installing $PKG_NAME ..." +tar zxf $SDKPKG -C $SDK_TEMP_FOLDER >/dev/null 2>&1 +retcode=$? # Save the return code +# Clean-up the temporary tarball. +rm -f $SDKPKG 2>/dev/null + +if test $retcode -ne 0; then + echo " failed." + exit 2 +fi +echo " done." + +pushd ${SDK_TEMP_FOLDER} + +source scripts/installConfig +make install + +popd + +${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/scripts/install.sh + +rm -fr ${SDK_TEMP_FOLDER} + +exit 0 diff --git a/linux/installer/common/gen_source/gen_source.py b/linux/installer/common/gen_source/gen_source.py new file mode 100755 index 0000000000..65774728f0 --- /dev/null +++ b/linux/installer/common/gen_source/gen_source.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +# This script is used to copy file from src to dest as descript in a BOM file +# example: python gen_source.py --bom=PATH_TO_BOM [--cleanup=false] [--deliverydir=DIR_RELATIVE_TO_gen_source.py] +# + + +import sys +import os +import shutil +import getopt + +def parse_cmd(argc, argv): + global bom_file + global cleanup + global deliverydir + + bom_file = "" + cleanup = True + deliverydir = "" + + local_path = os.path.split(os.path.realpath(sys.argv[0]))[0] + + try: + opts, args = getopt.getopt(sys.argv[1:], "", ["bom=", "cleanup=", "deliverydir="]) + except getopt.GetoptError as err: + print str(err) + return False + + for option, value in opts: + if option == "--bom": + bom_file = value + if not os.path.exists(os.path.join(local_path, bom_file)): + return False + + if option == "--cleanup": + cleanup = value + if cleanup.lower() != "true" and cleanup.lower() != "false": + return False + if cleanup.lower() == "false": + cleanup = False + + if option == "--deliverydir": + deliverydir = value + + + if bom_file == "": + return False + + return True + +################################################################################ +# Name: copy_folder_unrecursively() # +# Usage: # +# return: True if the operation is successful. False otherwise. # +################################################################################ +def copy_folder_unrecursively(src_dir, dest_dir): + if os.path.isdir(src_dir) == True : + print "Warning: The src is a fold ......" + return False + + #print "copy" + src_dir + "->" + dest_dir + try: + shutil.copy(src_dir, dest_dir) + return True + except: + print "Error !!!: can't find file:" + src_dir + return False + +################################################################################ +# Name: copy_folder_recursively() # +# Usage: # +################################################################################ +def copy_folder_recursively(src_dir, dest_dir): + if os.path.isdir(src_dir) == True: + #copy the folder + if os.path.exists(dest_dir) == False: + os.makedirs(dest_dir) + + for item in os.listdir(src_dir): + #print (os.path.join(src_dir, item)).replace("\\", "/") + copy_folder_recursively((os.path.join(src_dir, item)).replace("\\", "/"), (os.path.join(dest_dir, item)).replace("\\", "/")) + continue + else: + #copy the file + print "copy file from " + src_dir + " to " + dest_dir + shutil.copyfile(src_dir, dest_dir) + + + #if os.path.isdir(src_dir) == False or os.path.isdir(dest_dir) == False: + # print "Bom file error at copying " + src_dir + " to " + dest_dir + # exit(-1) + + +################################################################################ +# Name: read_BOM() # +# Usage: read bom_file # +# return: the contents in bom_file # +################################################################################ +def read_BOM(local_path): + #get the BOM file path that need to open + file_list = local_path + "/" + bom_file + f = open(file_list, 'r') + #read the content in BOM file + lines = f.readlines() + f.close() + return lines + +################################################################################ +# Name: copy_files() # +# Usage: copy file from src to dest # +# return: # +################################################################################ +def copy_txt_files(local_path): + home_path = os.path.realpath(os.path.join(local_path, "..", "..", "..", "..")) + + #read BOM file contents + lines = read_BOM(local_path) + + for line in lines[1:]: + if line == "\n": + continue + src = line.split('\t')[0] + dest = line.split('\t')[1] + src = src.replace("\\", "/") + dest = dest.replace("\\", "/") + if deliverydir == "": + src = src.replace("/", home_path + "/") + else: + src = src.replace("/", deliverydir + "/") + dest = dest.replace("/", local_path + "/output/") + #print "copy folder from " + src + " to " + dest + + if os.path.exists(src) == True: + #check whether the src is a fold or file + if os.path.isdir(src) == False : + #the src is a file + if os.path.exists(os.path.dirname(dest)) == False: + os.makedirs(os.path.dirname(dest)) + ret = copy_folder_unrecursively(src, dest) + if ret == False: + break + + else: + #the src is a fold + copy_folder_recursively(src, dest) + else: + #although the src file isn't exist, create the dest folder + if os.path.exists(os.path.dirname(dest)) == False: + os.makedirs(os.path.dirname(dest)) + print "Error !!!: src folder not exist" + src + + +if __name__ == "__main__": + ret = parse_cmd(len(sys.argv), sys.argv) + if ret == False: + print "Usage:" + print "python gen_source.py --bom=PATH_TO_BOM [--cleanup=false] [--deliverydir=DIR_RELATIVE_TO_gen_source.py]" + exit(1) + + #script locate direction + local_path = os.path.split(os.path.realpath(sys.argv[0]))[0] + local_dir = os.path.basename(local_path) + local_path = local_path.replace("\\", "/") + + ret = os.path.exists(local_path + "/output") + if ret == True: + if cleanup == True: + print "clean the dest dir" + shutil.rmtree(local_path + "/output") + os.mkdir(local_path + "/output") + else: + print "Create the dest dir" + os.mkdir(local_path + "/output") + + #cpoy the files + copy_txt_files(local_path) + + print "Copy files finished ......" + exit(0) diff --git a/linux/installer/common/licenses/BOM_license.txt b/linux/installer/common/licenses/BOM_license.txt new file mode 100644 index 0000000000..e03073c637 --- /dev/null +++ b/linux/installer/common/licenses/BOM_license.txt @@ -0,0 +1,2 @@ +DeliveryName InstallName FileCheckSum FileFeature FileOwner +/License.txt /package/licenses/License.txt 0 main STP diff --git a/linux/installer/common/psw/BOMs/psw_base.txt b/linux/installer/common/psw/BOMs/psw_base.txt new file mode 100644 index 0000000000..5a5325372b --- /dev/null +++ b/linux/installer/common/psw/BOMs/psw_base.txt @@ -0,0 +1,12 @@ +DeliveryName InstallName FileCheckSum FileFeature FileOwner +/build/linux/aesmd.conf /package/aesm/aesmd.conf 0 main STP +/build/linux/aesmd.service /package/aesm/aesmd.service 0 main STP +/build/linux/aesm_service /package/aesm/aesm_service 0 main STP +/build/linux/le_prod_css.bin /package/aesm/le_prod_css.bin 0 main STP +/build/linux/libsgx_le.signed.so /package/aesm/libsgx_le.signed.so 0 main STP +/build/linux/libsgx_pve.signed.so /package/aesm/libsgx_pve.signed.so 0 main STP +/build/linux/libsgx_qe.signed.so /package/aesm/libsgx_qe.signed.so 0 main STP +/linux/installer/common/psw/install.sh /scripts/install.sh 0 main STP +/linux/installer/common/psw/Makefile /Makefile 0 main STP +/psw/ae/aesm_service/config/network/aesmd.conf /package/aesm/conf/aesmd.conf 0 main STP +/psw/ae/aesm_service/data/white_list_cert_to_be_verify.bin /package/aesm/data/white_list_cert_to_be_verify.bin 0 main STP diff --git a/linux/installer/common/psw/BOMs/psw_x64.txt b/linux/installer/common/psw/BOMs/psw_x64.txt new file mode 100644 index 0000000000..88502f37a6 --- /dev/null +++ b/linux/installer/common/psw/BOMs/psw_x64.txt @@ -0,0 +1,4 @@ +DeliveryName InstallName FileCheckSum FileFeature FileOwner +/build/linux/libsgx_uae_service.so /package/lib64/libsgx_uae_service.so 0 main STP +/build/linux/libsgx_urts.so /package/lib64/libsgx_urts.so 0 main STP +/linux/installer/common/psw/installConfig.x64 /scripts/installConfig 0 main STP diff --git a/linux/installer/common/psw/BOMs/psw_x86.txt b/linux/installer/common/psw/BOMs/psw_x86.txt new file mode 100644 index 0000000000..715c3db84d --- /dev/null +++ b/linux/installer/common/psw/BOMs/psw_x86.txt @@ -0,0 +1,4 @@ +DeliveryName InstallName FileCheckSum FileFeature FileOwner +/build/linux/libsgx_uae_service.so /package/lib/libsgx_uae_service.so 0 main STP +/build/linux/libsgx_urts.so /package/lib/libsgx_urts.so 0 main STP +/linux/installer/common/psw/installConfig.x86 /scripts/installConfig 0 main STP diff --git a/linux/installer/common/psw/Makefile b/linux/installer/common/psw/Makefile new file mode 100644 index 0000000000..648f6ee7b0 --- /dev/null +++ b/linux/installer/common/psw/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include scripts/installConfig + +SOURCE_FOLDER=package +SCRIPTS_FOLDER=scripts + +INSTALL_PATH=$(DESTDIR)/$(SGX_PACKAGES_PATH)/$(PSW_PKG_NAME) +SOURCE_INSTALL_PATH=$(INSTALL_PATH) +SCRIPTS_INSTALL_PATH=$(INSTALL_PATH)/$(SCRIPTS_FOLDER) +PSW_LIB_PATH=$(SOURCE_INSTALL_PATH)/$(LIB_DIR) + +default: + +install: + install -d $(SOURCE_INSTALL_PATH) + install -d $(SCRIPTS_INSTALL_PATH) + install -d $(DESTDIR)/usr/lib + cp -r $(SOURCE_FOLDER)/* $(SOURCE_INSTALL_PATH) + install $(SCRIPTS_FOLDER)/* $(SCRIPTS_INSTALL_PATH) + mv $(PSW_LIB_PATH)/libsgx_uae_service.so $(DESTDIR)/usr/lib + mv $(PSW_LIB_PATH)/libsgx_urts.so $(DESTDIR)/usr/lib + rmdir $(PSW_LIB_PATH) diff --git a/linux/installer/common/psw/createTarball.sh b/linux/installer/common/psw/createTarball.sh new file mode 100755 index 0000000000..79d1df3506 --- /dev/null +++ b/linux/installer/common/psw/createTarball.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +set -e + +SCRIPT_DIR=$(dirname "$0") +ROOT_DIR="${SCRIPT_DIR}/../../../../" +BUILD_DIR="${ROOT_DIR}/build/linux" +LINUX_INSTALLER_DIR="${ROOT_DIR}/linux/installer" +LINUX_INSTALLER_COMMON_DIR="${LINUX_INSTALLER_DIR}/common" + +INSTALL_PATH=${SCRIPT_DIR}/output + +# Cleanup +rm -fr ${INSTALL_PATH} + +# Get the architecture of the build from generated binary +get_arch() +{ + local a=$(readelf -h $BUILD_DIR/sgx_sign | awk '/Class:/{print $2}') + test $a = ELF64 && echo 'x64' || echo 'x86' +} + +ARCH=$(get_arch) + +# Fetch the gen_source script +cp ${LINUX_INSTALLER_COMMON_DIR}/gen_source/gen_source.py ${SCRIPT_DIR} + +# Copy the files according to the BOM +python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/psw_base.txt +python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/psw_${ARCH}.txt --cleanup=false +python ${SCRIPT_DIR}/gen_source.py --bom=../licenses/BOM_license.txt --cleanup=false + +# Create the tarball +source ${SCRIPT_DIR}/installConfig.${ARCH} + +pushd ${INSTALL_PATH} &> /dev/null +tar -zcvf ${TARBALL_NAME} * +popd &> /dev/null diff --git a/linux/installer/common/psw/install.sh b/linux/installer/common/psw/install.sh new file mode 100755 index 0000000000..5e38a9b449 --- /dev/null +++ b/linux/installer/common/psw/install.sh @@ -0,0 +1,143 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +set -e + +SCRIPT_DIR=$(dirname "$0") +source ${SCRIPT_DIR}/installConfig + +PSW_DST_PATH=${SGX_PACKAGES_PATH}/${PSW_PKG_NAME} +AESM_PATH=$PSW_DST_PATH/aesm + +# Install the AESM service + +cut -d: -f1 /etc/passwd | grep -q -w aesmd || \ + /usr/sbin/useradd -r -c "User for aesmd" \ + -d /var/opt/aesmd -s /sbin/nologin aesmd + +mkdir -p /var/opt/aesmd +cp -rf $AESM_PATH/data /var/opt/aesmd/ +rm -rf $AESM_PATH/data +cp -rf $AESM_PATH/conf/aesmd.conf /etc/aesmd.conf +rm -rf $AESM_PATH/conf +chmod 0644 /etc/aesmd.conf +chown -R aesmd /var/opt/aesmd +chmod 0750 /var/opt/aesmd + +if [ -d /run/systemd/system ]; then + AESMD_NAME=aesmd.service + AESMD_TEMP=$AESM_PATH/$AESMD_NAME + if [ -d /lib/systemd/system ]; then + AESMD_DEST=/lib/systemd/system/$AESMD_NAME + else + AESMD_DEST=/usr/lib/systemd/system/$AESMD_NAME + fi + echo -n "Installing $AESMD_NAME service ..." + sed -e "s:@aesm_folder@:$AESM_PATH:" \ + $AESMD_TEMP > $AESMD_DEST + chmod 0644 $AESMD_DEST + rm -f $AESMD_TEMP + rm -f $AESM_PATH/aesmd.conf + DISABLE_AESMD="systemctl disable aesmd" + systemctl enable aesmd + retval=$? +elif [ -d /etc/init/ ]; then + AESMD_NAME=aesmd.conf + AESMD_TEMP=$AESM_PATH/$AESMD_NAME + AESMD_DEST=/etc/init/$AESMD_NAME + echo -n "Installing $AESMD_NAME service ..." + sed -e "s:@aesm_folder@:$AESM_PATH:" \ + $AESMD_TEMP > $AESMD_DEST + chmod 0644 $AESMD_DEST + rm -f $AESMD_TEMP + rm -f $AESM_PATH/aesmd.service + sudo /sbin/initctl reload-configuration + retval=$? +else + echo " failed." + echo "Unsupported platform - neither systemctl nor initctl is found." + exit 5 +fi + +if test $retval -ne 0; then + echo "$rcmngr failed to install $AESMD_NAME." + exit 6 +fi + +echo " done." + + +cat > $PSW_DST_PATH/uninstall.sh </build/linux/libsample_libcrypto.so /package/SampleCode/RemoteAttestation/sample_libcrypto/libsample_libcrypto.so 0 main STP +/common/inc/sgx_attributes.h /package/include/./sgx_attributes.h 0 main STP +/common/inc/sgx_cpuid.h /package/include/./sgx_cpuid.h 0 main STP +/common/inc/sgx_defs.h /package/include/./sgx_defs.h 0 main STP +/common/inc/sgx_dh.h /package/include/./sgx_dh.h 0 main STP +/common/inc/sgx_ecp_types.h /package/include/./sgx_ecp_types.h 0 main STP +/common/inc/sgx_edger8r.h /package/include/./sgx_edger8r.h 0 main STP +/common/inc/sgx_eid.h /package/include/./sgx_eid.h 0 main STP +/common/inc/sgx_error.h /package/include/./sgx_error.h 0 main STP +/common/inc/sgx.h /package/include/./sgx.h 0 main STP +/common/inc/sgx_intrin.h /package/include/./sgx_intrin.h 0 main STP +/common/inc/sgx_key_exchange.h /package/include/./sgx_key_exchange.h 0 main STP +/common/inc/sgx_key.h /package/include/./sgx_key.h 0 main STP +/common/inc/sgx_quote.h /package/include/./sgx_quote.h 0 main STP +/common/inc/sgx_report.h /package/include/./sgx_report.h 0 main STP +/common/inc/sgx_spinlock.h /package/include/./sgx_spinlock.h 0 main STP +/common/inc/sgx_tae_service.edl /package/include/./sgx_tae_service.edl 0 main STP +/common/inc/sgx_tae_service.h /package/include/./sgx_tae_service.h 0 main STP +/common/inc/sgx_tcrypto.h /package/include/./sgx_tcrypto.h 0 main STP +/common/inc/sgx_thread.h /package/include/./sgx_thread.h 0 main STP +/common/inc/sgx_tkey_exchange.edl /package/include/./sgx_tkey_exchange.edl 0 main STP +/common/inc/sgx_tkey_exchange.h /package/include/./sgx_tkey_exchange.h 0 main STP +/common/inc/sgx_trts_exception.h /package/include/./sgx_trts_exception.h 0 main STP +/common/inc/sgx_trts.h /package/include/./sgx_trts.h 0 main STP +/common/inc/sgx_tseal.h /package/include/./sgx_tseal.h 0 main STP +/common/inc/sgx_tstdc.edl /package/include/./sgx_tstdc.edl 0 main STP +/common/inc/sgx_uae_service.h /package/include/./sgx_uae_service.h 0 main STP +/common/inc/sgx_ukey_exchange.h /package/include/./sgx_ukey_exchange.h 0 main STP +/common/inc/sgx_urts.h /package/include/./sgx_urts.h 0 main STP +/common/inc/sgx_utils.h /package/include/./sgx_utils.h 0 main STP +/common/inc/stdc++/exception /package/include/stdc++/exception 0 main STP +/common/inc/stdc++/linux/exception /package/include/stdc++/linux/exception 0 main STP +/common/inc/stdc++/linux/typeinfo /package/include/stdc++/linux/typeinfo 0 main STP +/common/inc/stdc++/new /package/include/stdc++/new 0 main STP +/common/inc/stdc++/typeinfo /package/include/stdc++/typeinfo 0 main STP +/common/inc/tlibc/assert.h /package/include/tlibc/assert.h 0 main STP +/common/inc/tlibc/ctype.h /package/include/tlibc/ctype.h 0 main STP +/common/inc/tlibc/endian.h /package/include/tlibc/endian.h 0 main STP +/common/inc/tlibc/errno.h /package/include/tlibc/errno.h 0 main STP +/common/inc/tlibc/float.h /package/include/tlibc/float.h 0 main STP +/common/inc/tlibc/inttypes.h /package/include/tlibc/inttypes.h 0 main STP +/common/inc/tlibc/iso646.h /package/include/tlibc/iso646.h 0 main STP +/common/inc/tlibc/limits.h /package/include/tlibc/limits.h 0 main STP +/common/inc/tlibc/math.h /package/include/tlibc/math.h 0 main STP +/common/inc/tlibc/stdarg.h /package/include/tlibc/stdarg.h 0 main STP +/common/inc/tlibc/stdbool.h /package/include/tlibc/stdbool.h 0 main STP +/common/inc/tlibc/stddef.h /package/include/tlibc/stddef.h 0 main STP +/common/inc/tlibc/stdint.h /package/include/tlibc/stdint.h 0 main STP +/common/inc/tlibc/stdio.h /package/include/tlibc/stdio.h 0 main STP +/common/inc/tlibc/stdlib.h /package/include/tlibc/stdlib.h 0 main STP +/common/inc/tlibc/string.h /package/include/tlibc/string.h 0 main STP +/common/inc/tlibc/sys/cdefs.h /package/include/tlibc/sys/cdefs.h 0 main STP +/common/inc/tlibc/sys/endian.h /package/include/tlibc/sys/endian.h 0 main STP +/common/inc/tlibc/sys/limits.h /package/include/tlibc/sys/limits.h 0 main STP +/common/inc/tlibc/sys/stdint.h /package/include/tlibc/sys/stdint.h 0 main STP +/common/inc/tlibc/sys/_types.h /package/include/tlibc/sys/_types.h 0 main STP +/common/inc/tlibc/sys/types.h /package/include/tlibc/sys/types.h 0 main STP +/common/inc/tlibc/time.h /package/include/tlibc/time.h 0 main STP +/common/inc/tlibc/unistd.h /package/include/tlibc/unistd.h 0 main STP +/common/inc/tlibc/wchar.h /package/include/tlibc/wchar.h 0 main STP +/common/inc/tlibc/wctype.h /package/include/tlibc/wctype.h 0 main STP +/common/src/se_memory.c /package/ptrace/se_memory.c 0 main STP +/common/src/se_trace.c /package/ptrace/se_trace.c 0 main STP +/linux/installer/common/sdk/install.sh /scripts/install.sh 0 main STP +/linux/installer/common/sdk/Makefile /Makefile 0 main STP +/SampleCode/LocalAttestation/App/App.cpp /package/SampleCode/LocalAttestation/App/App.cpp 0 main STP +/SampleCode/LocalAttestation/.cproject /package/SampleCode/LocalAttestation/.cproject 0 main STP +/SampleCode/LocalAttestation/Enclave1/Enclave1.config.xml /package/SampleCode/LocalAttestation/Enclave1/Enclave1.config.xml 0 main STP +/SampleCode/LocalAttestation/Enclave1/Enclave1.cpp /package/SampleCode/LocalAttestation/Enclave1/Enclave1.cpp 0 main STP +/SampleCode/LocalAttestation/Enclave1/Enclave1.edl /package/SampleCode/LocalAttestation/Enclave1/Enclave1.edl 0 main STP +/SampleCode/LocalAttestation/Enclave1/Enclave1_private.pem /package/SampleCode/LocalAttestation/Enclave1/Enclave1_private.pem 0 main STP +/SampleCode/LocalAttestation/Enclave1/Utility_E1.cpp /package/SampleCode/LocalAttestation/Enclave1/Utility_E1.cpp 0 main STP +/SampleCode/LocalAttestation/Enclave1/Utility_E1.h /package/SampleCode/LocalAttestation/Enclave1/Utility_E1.h 0 main STP +/SampleCode/LocalAttestation/Enclave2/Enclave2.config.xml /package/SampleCode/LocalAttestation/Enclave2/Enclave2.config.xml 0 main STP +/SampleCode/LocalAttestation/Enclave2/Enclave2.cpp /package/SampleCode/LocalAttestation/Enclave2/Enclave2.cpp 0 main STP +/SampleCode/LocalAttestation/Enclave2/Enclave2.edl /package/SampleCode/LocalAttestation/Enclave2/Enclave2.edl 0 main STP +/SampleCode/LocalAttestation/Enclave2/Enclave2_private.pem /package/SampleCode/LocalAttestation/Enclave2/Enclave2_private.pem 0 main STP +/SampleCode/LocalAttestation/Enclave2/Utility_E2.cpp /package/SampleCode/LocalAttestation/Enclave2/Utility_E2.cpp 0 main STP +/SampleCode/LocalAttestation/Enclave2/Utility_E2.h /package/SampleCode/LocalAttestation/Enclave2/Utility_E2.h 0 main STP +/SampleCode/LocalAttestation/Enclave3/Enclave3.config.xml /package/SampleCode/LocalAttestation/Enclave3/Enclave3.config.xml 0 main STP +/SampleCode/LocalAttestation/Enclave3/Enclave3.cpp /package/SampleCode/LocalAttestation/Enclave3/Enclave3.cpp 0 main STP +/SampleCode/LocalAttestation/Enclave3/Enclave3.edl /package/SampleCode/LocalAttestation/Enclave3/Enclave3.edl 0 main STP +/SampleCode/LocalAttestation/Enclave3/Enclave3_private.pem /package/SampleCode/LocalAttestation/Enclave3/Enclave3_private.pem 0 main STP +/SampleCode/LocalAttestation/Enclave3/Utility_E3.cpp /package/SampleCode/LocalAttestation/Enclave3/Utility_E3.cpp 0 main STP +/SampleCode/LocalAttestation/Enclave3/Utility_E3.h /package/SampleCode/LocalAttestation/Enclave3/Utility_E3.h 0 main STP +/SampleCode/LocalAttestation/Include/dh_session_protocol.h /package/SampleCode/LocalAttestation/Include/dh_session_protocol.h 0 main STP +/SampleCode/LocalAttestation/LocalAttestationCode/datatypes.h /package/SampleCode/LocalAttestation/LocalAttestationCode/datatypes.h 0 main STP +/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.cpp /package/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.cpp 0 main STP +/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.h /package/SampleCode/LocalAttestation/LocalAttestationCode/EnclaveMessageExchange.h 0 main STP +/SampleCode/LocalAttestation/LocalAttestationCode/error_codes.h /package/SampleCode/LocalAttestation/LocalAttestationCode/error_codes.h 0 main STP +/SampleCode/LocalAttestation/LocalAttestationCode/LocalAttestationCode.edl /package/SampleCode/LocalAttestation/LocalAttestationCode/LocalAttestationCode.edl 0 main STP +/SampleCode/LocalAttestation/Makefile /package/SampleCode/LocalAttestation/Makefile 0 main STP +/SampleCode/LocalAttestation/README.txt /package/SampleCode/LocalAttestation/README.txt 0 main STP +/SampleCode/LocalAttestation/.project /package/SampleCode/LocalAttestation/.project 0 main STP +/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.cpp /package/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.cpp 0 main STP +/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.h /package/SampleCode/LocalAttestation/Untrusted_LocalAttestation/UntrustedEnclaveMessageExchange.h 0 main STP +/SampleCode/PowerTransition/App/App.cpp /package/SampleCode/PowerTransition/App/App.cpp 0 main STP +/SampleCode/PowerTransition/App/ErrorSupport.cpp /package/SampleCode/PowerTransition/App/ErrorSupport.cpp 0 main STP +/SampleCode/PowerTransition/App/ErrorSupport.h /package/SampleCode/PowerTransition/App/ErrorSupport.h 0 main STP +/SampleCode/PowerTransition/App/rwlock.cpp /package/SampleCode/PowerTransition/App/rwlock.cpp 0 main STP +/SampleCode/PowerTransition/App/rwlock.h /package/SampleCode/PowerTransition/App/rwlock.h 0 main STP +/SampleCode/PowerTransition/Common/types.h /package/SampleCode/PowerTransition/Common/types.h 0 main STP +/SampleCode/PowerTransition/.cproject /package/SampleCode/PowerTransition/.cproject 0 main STP +/SampleCode/PowerTransition/Enclave/Enclave.config.xml /package/SampleCode/PowerTransition/Enclave/Enclave.config.xml 0 main STP +/SampleCode/PowerTransition/Enclave/Enclave.cpp /package/SampleCode/PowerTransition/Enclave/Enclave.cpp 0 main STP +/SampleCode/PowerTransition/Enclave/Enclave.edl /package/SampleCode/PowerTransition/Enclave/Enclave.edl 0 main STP +/SampleCode/PowerTransition/Enclave/Enclave.lds /package/SampleCode/PowerTransition/Enclave/Enclave.lds 0 main STP +/SampleCode/PowerTransition/Enclave/Enclave_private.pem /package/SampleCode/PowerTransition/Enclave/Enclave_private.pem 0 main STP +/SampleCode/PowerTransition/Makefile /package/SampleCode/PowerTransition/Makefile 0 main STP +/SampleCode/PowerTransition/.project /package/SampleCode/PowerTransition/.project 0 main STP +/SampleCode/PowerTransition/README.txt /package/SampleCode/PowerTransition/README.txt 0 main STP +/SampleCode/RemoteAttestation/.cproject /package/SampleCode/RemoteAttestation/.cproject 0 main STP +/SampleCode/RemoteAttestation/isv_app/isv_app.cpp /package/SampleCode/RemoteAttestation/isv_app/isv_app.cpp 0 main STP +/SampleCode/RemoteAttestation/isv_app/sample_messages.h /package/SampleCode/RemoteAttestation/isv_app/sample_messages.h 0 main STP +/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.config.xml /package/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.config.xml 0 main STP +/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp /package/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp 0 main STP +/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.edl /package/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.edl 0 main STP +/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.lds /package/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.lds 0 main STP +/SampleCode/RemoteAttestation/isv_enclave/isv_enclave_private.pem /package/SampleCode/RemoteAttestation/isv_enclave/isv_enclave_private.pem 0 main STP +/SampleCode/RemoteAttestation/Makefile /package/SampleCode/RemoteAttestation/Makefile 0 main STP +/SampleCode/RemoteAttestation/README.txt /package/SampleCode/RemoteAttestation/README.txt 0 main STP +/SampleCode/RemoteAttestation/.project /package/SampleCode/RemoteAttestation/.project 0 main STP +/SampleCode/RemoteAttestation/service_provider/ecp.cpp /package/SampleCode/RemoteAttestation/service_provider/ecp.cpp 0 main STP +/SampleCode/RemoteAttestation/service_provider/ecp.h /package/SampleCode/RemoteAttestation/service_provider/ecp.h 0 main STP +/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp /package/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp 0 main STP +/SampleCode/RemoteAttestation/service_provider/ias_ra.h /package/SampleCode/RemoteAttestation/service_provider/ias_ra.h 0 main STP +/SampleCode/RemoteAttestation/service_provider/network_ra.cpp /package/SampleCode/RemoteAttestation/service_provider/network_ra.cpp 0 main STP +/SampleCode/RemoteAttestation/service_provider/network_ra.h /package/SampleCode/RemoteAttestation/service_provider/network_ra.h 0 main STP +/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h /package/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h 0 main STP +/SampleCode/RemoteAttestation/service_provider/service_provider.cpp /package/SampleCode/RemoteAttestation/service_provider/service_provider.cpp 0 main STP +/SampleCode/RemoteAttestation/service_provider/service_provider.h /package/SampleCode/RemoteAttestation/service_provider/service_provider.h 0 main STP +/SampleCode/SampleEnclave/App/App.cpp /package/SampleCode/SampleEnclave/App/App.cpp 0 main STP +/SampleCode/SampleEnclave/App/App.h /package/SampleCode/SampleEnclave/App/App.h 0 main STP +/SampleCode/SampleEnclave/App/Edger8rSyntax/Arrays.cpp /package/SampleCode/SampleEnclave/App/Edger8rSyntax/Arrays.cpp 0 main STP +/SampleCode/SampleEnclave/App/Edger8rSyntax/Functions.cpp /package/SampleCode/SampleEnclave/App/Edger8rSyntax/Functions.cpp 0 main STP +/SampleCode/SampleEnclave/App/Edger8rSyntax/Pointers.cpp /package/SampleCode/SampleEnclave/App/Edger8rSyntax/Pointers.cpp 0 main STP +/SampleCode/SampleEnclave/App/Edger8rSyntax/Types.cpp /package/SampleCode/SampleEnclave/App/Edger8rSyntax/Types.cpp 0 main STP +/SampleCode/SampleEnclave/App/TrustedLibrary/Libc.cpp /package/SampleCode/SampleEnclave/App/TrustedLibrary/Libc.cpp 0 main STP +/SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp /package/SampleCode/SampleEnclave/App/TrustedLibrary/Libcxx.cpp 0 main STP +/SampleCode/SampleEnclave/App/TrustedLibrary/Thread.cpp /package/SampleCode/SampleEnclave/App/TrustedLibrary/Thread.cpp 0 main STP +/SampleCode/SampleEnclave/.cproject /package/SampleCode/SampleEnclave/.cproject 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.cpp /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.edl /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Arrays.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.cpp /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.edl /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Functions.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.edl /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.cpp /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.edl /package/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Types.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/Enclave.config.xml /package/SampleCode/SampleEnclave/Enclave/Enclave.config.xml 0 main STP +/SampleCode/SampleEnclave/Enclave/Enclave.cpp /package/SampleCode/SampleEnclave/Enclave/Enclave.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/Enclave.edl /package/SampleCode/SampleEnclave/Enclave/Enclave.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/Enclave.h /package/SampleCode/SampleEnclave/Enclave/Enclave.h 0 main STP +/SampleCode/SampleEnclave/Enclave/Enclave.lds /package/SampleCode/SampleEnclave/Enclave/Enclave.lds 0 main STP +/SampleCode/SampleEnclave/Enclave/Enclave_private.pem /package/SampleCode/SampleEnclave/Enclave/Enclave_private.pem 0 main STP +/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.cpp /package/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.edl /package/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libc.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.cpp /package/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl /package/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Libcxx.edl 0 main STP +/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.cpp /package/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.cpp 0 main STP +/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.edl /package/SampleCode/SampleEnclave/Enclave/TrustedLibrary/Thread.edl 0 main STP +/SampleCode/SampleEnclave/Include/user_types.h /package/SampleCode/SampleEnclave/Include/user_types.h 0 main STP +/SampleCode/SampleEnclave/Makefile /package/SampleCode/SampleEnclave/Makefile 0 main STP +/SampleCode/SampleEnclave/.project /package/SampleCode/SampleEnclave/.project 0 main STP +/SampleCode/SampleEnclave/README.txt /package/SampleCode/SampleEnclave/README.txt 0 main STP +/sdk/debugger_interface/linux/se_ptrace.c /package/ptrace/se_ptrace.c 0 main STP +/sdk/sample_libcrypto/sample_libcrypto.h /package/SampleCode/RemoteAttestation/sample_libcrypto/sample_libcrypto.h 0 main STP +/sdk/tlibstdcxx/stlport/algorithm /package/include/stlport/algorithm 0 main STP +/sdk/tlibstdcxx/stlport/assert.h /package/include/stlport/assert.h 0 main STP +/sdk/tlibstdcxx/stlport/bitset /package/include/stlport/bitset 0 main STP +/sdk/tlibstdcxx/stlport/cassert /package/include/stlport/cassert 0 main STP +/sdk/tlibstdcxx/stlport/cctype /package/include/stlport/cctype 0 main STP +/sdk/tlibstdcxx/stlport/cerrno /package/include/stlport/cerrno 0 main STP +/sdk/tlibstdcxx/stlport/cfloat /package/include/stlport/cfloat 0 main STP +/sdk/tlibstdcxx/stlport/ciso646 /package/include/stlport/ciso646 0 main STP +/sdk/tlibstdcxx/stlport/climits /package/include/stlport/climits 0 main STP +/sdk/tlibstdcxx/stlport/cmath /package/include/stlport/cmath 0 main STP +/sdk/tlibstdcxx/stlport/complex /package/include/stlport/complex 0 main STP +/sdk/tlibstdcxx/stlport/cstdarg /package/include/stlport/cstdarg 0 main STP +/sdk/tlibstdcxx/stlport/cstddef /package/include/stlport/cstddef 0 main STP +/sdk/tlibstdcxx/stlport/cstdio /package/include/stlport/cstdio 0 main STP +/sdk/tlibstdcxx/stlport/cstdlib /package/include/stlport/cstdlib 0 main STP +/sdk/tlibstdcxx/stlport/cstring /package/include/stlport/cstring 0 main STP +/sdk/tlibstdcxx/stlport/ctime /package/include/stlport/ctime 0 main STP +/sdk/tlibstdcxx/stlport/ctype.h /package/include/stlport/ctype.h 0 main STP +/sdk/tlibstdcxx/stlport/cwchar /package/include/stlport/cwchar 0 main STP +/sdk/tlibstdcxx/stlport/cwctype /package/include/stlport/cwctype 0 main STP +/sdk/tlibstdcxx/stlport/deque /package/include/stlport/deque 0 main STP +/sdk/tlibstdcxx/stlport/errno.h /package/include/stlport/errno.h 0 main STP +/sdk/tlibstdcxx/stlport/exception /package/include/stlport/exception 0 main STP +/sdk/tlibstdcxx/stlport/float.h /package/include/stlport/float.h 0 main STP +/sdk/tlibstdcxx/stlport/functional /package/include/stlport/functional 0 main STP +/sdk/tlibstdcxx/stlport/iso646.h /package/include/stlport/iso646.h 0 main STP +/sdk/tlibstdcxx/stlport/iterator /package/include/stlport/iterator 0 main STP +/sdk/tlibstdcxx/stlport/limits.h /package/include/stlport/limits.h 0 main STP +/sdk/tlibstdcxx/stlport/limits /package/include/stlport/limits 0 main STP +/sdk/tlibstdcxx/stlport/list /package/include/stlport/list 0 main STP +/sdk/tlibstdcxx/stlport/map /package/include/stlport/map 0 main STP +/sdk/tlibstdcxx/stlport/math.h /package/include/stlport/math.h 0 main STP +/sdk/tlibstdcxx/stlport/memory /package/include/stlport/memory 0 main STP +/sdk/tlibstdcxx/stlport/new.h /package/include/stlport/new.h 0 main STP +/sdk/tlibstdcxx/stlport/new /package/include/stlport/new 0 main STP +/sdk/tlibstdcxx/stlport/numeric /package/include/stlport/numeric 0 main STP +/sdk/tlibstdcxx/stlport/queue /package/include/stlport/queue 0 main STP +/sdk/tlibstdcxx/stlport/set /package/include/stlport/set 0 main STP +/sdk/tlibstdcxx/stlport/stack /package/include/stlport/stack 0 main STP +/sdk/tlibstdcxx/stlport/stdarg.h /package/include/stlport/stdarg.h 0 main STP +/sdk/tlibstdcxx/stlport/stddef.h /package/include/stlport/stddef.h 0 main STP +/sdk/tlibstdcxx/stlport/stdexcept /package/include/stlport/stdexcept 0 main STP +/sdk/tlibstdcxx/stlport/stdio.h /package/include/stlport/stdio.h 0 main STP +/sdk/tlibstdcxx/stlport/stdlib.h /package/include/stlport/stdlib.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_abbrevs.h /package/include/stlport/stl/_abbrevs.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_algobase.c /package/include/stlport/stl/_algobase.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_algobase.h /package/include/stlport/stl/_algobase.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_algo.c /package/include/stlport/stl/_algo.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_algo.h /package/include/stlport/stl/_algo.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_alloc.c /package/include/stlport/stl/_alloc.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_alloc.h /package/include/stlport/stl/_alloc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_auto_ptr.h /package/include/stlport/stl/_auto_ptr.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_bitset.c /package/include/stlport/stl/_bitset.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_bitset.h /package/include/stlport/stl/_bitset.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/boost_type_traits.h /package/include/stlport/stl/boost_type_traits.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_bvector.h /package/include/stlport/stl/_bvector.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_carray.h /package/include/stlport/stl/_carray.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cctype.h /package/include/stlport/stl/_cctype.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/char_traits.h /package/include/stlport/stl/char_traits.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_clocale.h /package/include/stlport/stl/_clocale.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/c_locale.h /package/include/stlport/stl/c_locale.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cmath.h /package/include/stlport/stl/_cmath.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_codecvt.h /package/include/stlport/stl/_codecvt.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_collate.h /package/include/stlport/stl/_collate.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_complex.c /package/include/stlport/stl/_complex.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_complex.h /package/include/stlport/stl/_complex.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/concept_checks.h /package/include/stlport/stl/concept_checks.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_aix.h /package/include/stlport/stl/config/_aix.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_apcc.h /package/include/stlport/stl/config/_apcc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_apple.h /package/include/stlport/stl/config/_apple.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_as400.h /package/include/stlport/stl/config/_as400.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_auto_link.h /package/include/stlport/stl/config/_auto_link.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_bc.h /package/include/stlport/stl/config/_bc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_como.h /package/include/stlport/stl/config/_como.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/compat.h /package/include/stlport/stl/config/compat.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_config_compat_post.h /package/include/stlport/stl/_config_compat_post.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_cray.h /package/include/stlport/stl/config/_cray.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_cygwin.h /package/include/stlport/stl/config/_cygwin.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_dec.h /package/include/stlport/stl/config/_dec.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_dec_vms.h /package/include/stlport/stl/config/_dec_vms.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_detect_dll_or_lib.h /package/include/stlport/stl/config/_detect_dll_or_lib.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_dm.h /package/include/stlport/stl/config/_dm.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_epilog.h /package/include/stlport/stl/config/_epilog.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_evc.h /package/include/stlport/stl/config/_evc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/features.h /package/include/stlport/stl/config/features.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_feedback.h /package/include/stlport/stl/config/_feedback.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_freebsd.h /package/include/stlport/stl/config/_freebsd.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_fujitsu.h /package/include/stlport/stl/config/_fujitsu.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_gcc.h /package/include/stlport/stl/config/_gcc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/host.h /package/include/stlport/stl/config/host.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_hpacc.h /package/include/stlport/stl/config/_hpacc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_hpux.h /package/include/stlport/stl/config/_hpux.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_ibm.h /package/include/stlport/stl/config/_ibm.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_icc.h /package/include/stlport/stl/config/_icc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_intel.h /package/include/stlport/stl/config/_intel.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_kai.h /package/include/stlport/stl/config/_kai.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_linux.h /package/include/stlport/stl/config/_linux.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_mac.h /package/include/stlport/stl/config/_mac.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_macosx.h /package/include/stlport/stl/config/_macosx.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_mlc.h /package/include/stlport/stl/config/_mlc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_msvc.h /package/include/stlport/stl/config/_msvc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_mwerks.h /package/include/stlport/stl/config/_mwerks.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_native_headers.h /package/include/stlport/stl/config/_native_headers.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_openbsd.h /package/include/stlport/stl/config/_openbsd.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_prolog.h /package/include/stlport/stl/config/_prolog.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_sgi.h /package/include/stlport/stl/config/_sgi.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_sgx.h /package/include/stlport/stl/config/_sgx.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_solaris.h /package/include/stlport/stl/config/_solaris.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/stl_confix.h /package/include/stlport/stl/config/stl_confix.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/stl_mycomp.h /package/include/stlport/stl/config/stl_mycomp.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_sunprocc.h /package/include/stlport/stl/config/_sunprocc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_system.h /package/include/stlport/stl/config/_system.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/user_config.h /package/include/stlport/stl/config/user_config.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_warnings_off.h /package/include/stlport/stl/config/_warnings_off.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_watcom.h /package/include/stlport/stl/config/_watcom.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/config/_windows.h /package/include/stlport/stl/config/_windows.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_construct.h /package/include/stlport/stl/_construct.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cprolog.h /package/include/stlport/stl/_cprolog.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_csetjmp.h /package/include/stlport/stl/_csetjmp.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_csignal.h /package/include/stlport/stl/_csignal.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cstdarg.h /package/include/stlport/stl/_cstdarg.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cstddef.h /package/include/stlport/stl/_cstddef.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cstdio.h /package/include/stlport/stl/_cstdio.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cstdlib.h /package/include/stlport/stl/_cstdlib.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cstring.h /package/include/stlport/stl/_cstring.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ctime.h /package/include/stlport/stl/_ctime.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ctraits_fns.h /package/include/stlport/stl/_ctraits_fns.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ctype.h /package/include/stlport/stl/_ctype.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cwchar.h /package/include/stlport/stl/_cwchar.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_cwctype.h /package/include/stlport/stl/_cwctype.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/debug/_debug.h /package/include/stlport/stl/debug/_debug.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_deque.c /package/include/stlport/stl/_deque.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_deque.h /package/include/stlport/stl/_deque.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_epilog.h /package/include/stlport/stl/_epilog.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_exception.h /package/include/stlport/stl/_exception.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_facets_fwd.h /package/include/stlport/stl/_facets_fwd.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_fstream.c /package/include/stlport/stl/_fstream.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_fstream.h /package/include/stlport/stl/_fstream.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_function_adaptors.h /package/include/stlport/stl/_function_adaptors.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_function_base.h /package/include/stlport/stl/_function_base.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_function.h /package/include/stlport/stl/_function.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_hash_fun.h /package/include/stlport/stl/_hash_fun.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_hash_map.h /package/include/stlport/stl/_hash_map.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_hash_set.h /package/include/stlport/stl/_hash_set.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_hashtable.c /package/include/stlport/stl/_hashtable.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_hashtable.h /package/include/stlport/stl/_hashtable.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_heap.c /package/include/stlport/stl/_heap.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_heap.h /package/include/stlport/stl/_heap.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_iomanip.h /package/include/stlport/stl/_iomanip.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ios_base.h /package/include/stlport/stl/_ios_base.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ios.c /package/include/stlport/stl/_ios.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ioserr.h /package/include/stlport/stl/_ioserr.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_iosfwd.h /package/include/stlport/stl/_iosfwd.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ios.h /package/include/stlport/stl/_ios.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_iostream_string.h /package/include/stlport/stl/_iostream_string.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_istreambuf_iterator.h /package/include/stlport/stl/_istreambuf_iterator.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_istream.c /package/include/stlport/stl/_istream.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_istream.h /package/include/stlport/stl/_istream.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_iterator_base.h /package/include/stlport/stl/_iterator_base.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_iterator.h /package/include/stlport/stl/_iterator.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_iterator_old.h /package/include/stlport/stl/_iterator_old.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_limits.c /package/include/stlport/stl/_limits.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_limits.h /package/include/stlport/stl/_limits.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_list.c /package/include/stlport/stl/_list.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_list.h /package/include/stlport/stl/_list.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_locale.h /package/include/stlport/stl/_locale.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_map.h /package/include/stlport/stl/_map.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_mbstate_t.h /package/include/stlport/stl/_mbstate_t.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_messages_facets.h /package/include/stlport/stl/_messages_facets.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_monetary.c /package/include/stlport/stl/_monetary.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_monetary.h /package/include/stlport/stl/_monetary.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_move_construct_fwk.h /package/include/stlport/stl/_move_construct_fwk.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/msl_string.h /package/include/stlport/stl/msl_string.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_new.h /package/include/stlport/stl/_new.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_numeric.c /package/include/stlport/stl/_numeric.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_numeric.h /package/include/stlport/stl/_numeric.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_num_get.c /package/include/stlport/stl/_num_get.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_num_get.h /package/include/stlport/stl/_num_get.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_numpunct.h /package/include/stlport/stl/_numpunct.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_num_put.c /package/include/stlport/stl/_num_put.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_num_put.h /package/include/stlport/stl/_num_put.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ostreambuf_iterator.h /package/include/stlport/stl/_ostreambuf_iterator.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ostream.c /package/include/stlport/stl/_ostream.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ostream.h /package/include/stlport/stl/_ostream.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_pair.h /package/include/stlport/stl/_pair.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/pointers/_deque.h /package/include/stlport/stl/pointers/_deque.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/pointers/_list.h /package/include/stlport/stl/pointers/_list.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/pointers/_set.h /package/include/stlport/stl/pointers/_set.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/pointers/_slist.h /package/include/stlport/stl/pointers/_slist.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/pointers/_tools.h /package/include/stlport/stl/pointers/_tools.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/pointers/_vector.h /package/include/stlport/stl/pointers/_vector.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_prolog.h /package/include/stlport/stl/_prolog.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_pthread_alloc.h /package/include/stlport/stl/_pthread_alloc.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_ptrs_specialize.h /package/include/stlport/stl/_ptrs_specialize.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_queue.h /package/include/stlport/stl/_queue.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_range_errors.c /package/include/stlport/stl/_range_errors.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_range_errors.h /package/include/stlport/stl/_range_errors.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_raw_storage_iter.h /package/include/stlport/stl/_raw_storage_iter.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_relops_cont.h /package/include/stlport/stl/_relops_cont.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_relops_hash_cont.h /package/include/stlport/stl/_relops_hash_cont.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_rope.c /package/include/stlport/stl/_rope.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_rope.h /package/include/stlport/stl/_rope.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_set.h /package/include/stlport/stl/_set.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_slist_base.c /package/include/stlport/stl/_slist_base.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_slist_base.h /package/include/stlport/stl/_slist_base.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_slist.c /package/include/stlport/stl/_slist.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_slist.h /package/include/stlport/stl/_slist.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_sparc_atomic.h /package/include/stlport/stl/_sparc_atomic.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_sstream.c /package/include/stlport/stl/_sstream.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_sstream.h /package/include/stlport/stl/_sstream.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_stack.h /package/include/stlport/stl/_stack.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.c /package/include/stlport/stl/_stdexcept_base.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.h /package/include/stlport/stl/_stdexcept_base.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_stdexcept.h /package/include/stlport/stl/_stdexcept.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_stlport_version.h /package/include/stlport/stl/_stlport_version.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_streambuf.c /package/include/stlport/stl/_streambuf.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_streambuf.h /package/include/stlport/stl/_streambuf.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_stream_iterator.h /package/include/stlport/stl/_stream_iterator.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_base.h /package/include/stlport/stl/_string_base.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string.c /package/include/stlport/stl/_string.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_fwd.h /package/include/stlport/stl/_string_fwd.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_hash.h /package/include/stlport/stl/_string_hash.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string.h /package/include/stlport/stl/_string.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_io.c /package/include/stlport/stl/_string_io.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_io.h /package/include/stlport/stl/_string_io.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_npos.h /package/include/stlport/stl/_string_npos.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_operators.h /package/include/stlport/stl/_string_operators.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_sum.h /package/include/stlport/stl/_string_sum.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_sum_methods.h /package/include/stlport/stl/_string_sum_methods.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_string_workaround.h /package/include/stlport/stl/_string_workaround.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_strstream.h /package/include/stlport/stl/_strstream.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_tempbuf.c /package/include/stlport/stl/_tempbuf.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_tempbuf.h /package/include/stlport/stl/_tempbuf.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_threads.c /package/include/stlport/stl/_threads.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_threads.h /package/include/stlport/stl/_threads.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_time_facets.c /package/include/stlport/stl/_time_facets.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_time_facets.h /package/include/stlport/stl/_time_facets.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_tree.c /package/include/stlport/stl/_tree.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_tree.h /package/include/stlport/stl/_tree.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_typeinfo.h /package/include/stlport/stl/_typeinfo.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/type_manips.h /package/include/stlport/stl/type_manips.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/type_traits.h /package/include/stlport/stl/type_traits.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_uninitialized.h /package/include/stlport/stl/_uninitialized.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_unordered_map.h /package/include/stlport/stl/_unordered_map.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_unordered_set.h /package/include/stlport/stl/_unordered_set.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_valarray.c /package/include/stlport/stl/_valarray.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_valarray.h /package/include/stlport/stl/_valarray.h 0 main STP +/sdk/tlibstdcxx/stlport/stl/_vector.c /package/include/stlport/stl/_vector.c 0 main STP +/sdk/tlibstdcxx/stlport/stl/_vector.h /package/include/stlport/stl/_vector.h 0 main STP +/sdk/tlibstdcxx/stlport/string.h /package/include/stlport/string.h 0 main STP +/sdk/tlibstdcxx/stlport/string /package/include/stlport/string 0 main STP +/sdk/tlibstdcxx/stlport/time.h /package/include/stlport/time.h 0 main STP +/sdk/tlibstdcxx/stlport/typeinfo.h /package/include/stlport/typeinfo.h 0 main STP +/sdk/tlibstdcxx/stlport/typeinfo /package/include/stlport/typeinfo 0 main STP +/sdk/tlibstdcxx/stlport/type_traits /package/include/stlport/type_traits 0 main STP +/sdk/tlibstdcxx/stlport/unordered_map /package/include/stlport/unordered_map 0 main STP +/sdk/tlibstdcxx/stlport/unordered_set /package/include/stlport/unordered_set 0 main STP +/sdk/tlibstdcxx/stlport/using/cstring /package/include/stlport/using/cstring 0 main STP +/sdk/tlibstdcxx/stlport/using/export /package/include/stlport/using/export 0 main STP +/sdk/tlibstdcxx/stlport/using/fstream /package/include/stlport/using/fstream 0 main STP +/sdk/tlibstdcxx/stlport/using/h/fstream.h /package/include/stlport/using/h/fstream.h 0 main STP +/sdk/tlibstdcxx/stlport/using/h/iomanip.h /package/include/stlport/using/h/iomanip.h 0 main STP +/sdk/tlibstdcxx/stlport/using/h/iostream.h /package/include/stlport/using/h/iostream.h 0 main STP +/sdk/tlibstdcxx/stlport/using/h/ostream.h /package/include/stlport/using/h/ostream.h 0 main STP +/sdk/tlibstdcxx/stlport/using/h/streambuf.h /package/include/stlport/using/h/streambuf.h 0 main STP +/sdk/tlibstdcxx/stlport/using/h/strstream.h /package/include/stlport/using/h/strstream.h 0 main STP +/sdk/tlibstdcxx/stlport/using/iomanip /package/include/stlport/using/iomanip 0 main STP +/sdk/tlibstdcxx/stlport/using/iosfwd /package/include/stlport/using/iosfwd 0 main STP +/sdk/tlibstdcxx/stlport/using/ios /package/include/stlport/using/ios 0 main STP +/sdk/tlibstdcxx/stlport/using/iostream /package/include/stlport/using/iostream 0 main STP +/sdk/tlibstdcxx/stlport/using/istream /package/include/stlport/using/istream 0 main STP +/sdk/tlibstdcxx/stlport/using/locale /package/include/stlport/using/locale 0 main STP +/sdk/tlibstdcxx/stlport/using/ostream /package/include/stlport/using/ostream 0 main STP +/sdk/tlibstdcxx/stlport/using/sstream /package/include/stlport/using/sstream 0 main STP +/sdk/tlibstdcxx/stlport/using/streambuf /package/include/stlport/using/streambuf 0 main STP +/sdk/tlibstdcxx/stlport/using/strstream /package/include/stlport/using/strstream 0 main STP +/sdk/tlibstdcxx/stlport/utility /package/include/stlport/utility 0 main STP +/sdk/tlibstdcxx/stlport/valarray /package/include/stlport/valarray 0 main STP +/sdk/tlibstdcxx/stlport/vector /package/include/stlport/vector 0 main STP +/sdk/tlibstdcxx/stlport/wchar.h /package/include/stlport/wchar.h 0 main STP +/sdk/tlibstdcxx/stlport/wctype.h /package/include/stlport/wctype.h 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_x64.txt b/linux/installer/common/sdk/BOMs/sdk_x64.txt new file mode 100644 index 0000000000..0d8926c423 --- /dev/null +++ b/linux/installer/common/sdk/BOMs/sdk_x64.txt @@ -0,0 +1,25 @@ +DeliveryName InstallName FileCheckSum FileFeature FileOwner +/build/linux/gdb-sgx-plugin/gdb_sgx_cmd /package/lib64/gdb-sgx-plugin/gdb_sgx_cmd 0 main STP +/build/linux/gdb-sgx-plugin/gdb_sgx_plugin.py /package/lib64/gdb-sgx-plugin/gdb_sgx_plugin.py 0 main STP +/build/linux/gdb-sgx-plugin/load_symbol_cmd.py /package/lib64/gdb-sgx-plugin/load_symbol_cmd.py 0 main STP +/build/linux/gdb-sgx-plugin/readelf.py /package/lib64/gdb-sgx-plugin/readelf.py 0 main STP +/build/linux/gdb-sgx-plugin/sgx_emmt.py /package/lib64/gdb-sgx-plugin/sgx_emmt.py 0 main STP +/build/linux/libsgx_ptrace.so /package/lib64/libsgx_ptrace.so 0 main STP +/build/linux/libsgx_tcrypto.a /package/lib64/libsgx_tcrypto.a 0 main STP +/build/linux/libsgx_tkey_exchange.a /package/lib64/libsgx_tkey_exchange.a 0 main STP +/build/linux/libsgx_trts.a /package/lib64/libsgx_trts.a 0 main STP +/build/linux/libsgx_trts_sim.a /package/lib64/libsgx_trts_sim.a 0 main STP +/build/linux/libsgx_tservice.a /package/lib64/libsgx_tservice.a 0 main STP +/build/linux/libsgx_tservice_sim.a /package/lib64/libsgx_tservice_sim.a 0 main STP +/build/linux/libsgx_tstdc.a /package/lib64/libsgx_tstdc.a 0 main STP +/build/linux/libsgx_tstdcxx.a /package/lib64/libsgx_tstdcxx.a 0 main STP +/build/linux/libsgx_uae_service_deploy.so /package/lib64/libsgx_uae_service.so 0 main STP +/build/linux/libsgx_uae_service_sim.so /package/lib64/libsgx_uae_service_sim.so 0 main STP +/build/linux/libsgx_ukey_exchange.a /package/lib64/libsgx_ukey_exchange.a 0 main STP +/build/linux/libsgx_urts_deploy.so /package/lib64/libsgx_urts.so 0 main STP +/build/linux/libsgx_urts_sim.so /package/lib64/libsgx_urts_sim.so 0 main STP +/build/linux/STLport_Changes_SGX.txt /package/lib64/STLport_Changes_SGX.txt 0 main STP +/build/linux/sgx_config_cpusvn /package/bin/x64/sgx_config_cpusvn 0 main STP +/build/linux/sgx_edger8r /package/bin/x64/sgx_edger8r 0 main STP +/build/linux/sgx_sign /package/bin/x64/sgx_sign 0 main STP +/linux/installer/common/sdk/installConfig.x64 /scripts/installConfig 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_x86.txt b/linux/installer/common/sdk/BOMs/sdk_x86.txt new file mode 100644 index 0000000000..23f3b47a2b --- /dev/null +++ b/linux/installer/common/sdk/BOMs/sdk_x86.txt @@ -0,0 +1,25 @@ +DeliveryName InstallName FileCheckSum FileFeature FileOwner +/build/linux/gdb-sgx-plugin/gdb_sgx_cmd /package/lib/gdb-sgx-plugin/gdb_sgx_cmd 0 main STP +/build/linux/gdb-sgx-plugin/gdb_sgx_plugin.py /package/lib/gdb-sgx-plugin/gdb_sgx_plugin.py 0 main STP +/build/linux/gdb-sgx-plugin/load_symbol_cmd.py /package/lib/gdb-sgx-plugin/load_symbol_cmd.py 0 main STP +/build/linux/gdb-sgx-plugin/readelf.py /package/lib/gdb-sgx-plugin/readelf.py 0 main STP +/build/linux/gdb-sgx-plugin/sgx_emmt.py /package/lib/gdb-sgx-plugin/sgx_emmt.py 0 main STP +/build/linux/libsgx_ptrace.so /package/lib/libsgx_ptrace.so 0 main STP +/build/linux/libsgx_tcrypto.a /package/lib/libsgx_tcrypto.a 0 main STP +/build/linux/libsgx_tkey_exchange.a /package/lib/libsgx_tkey_exchange.a 0 main STP +/build/linux/libsgx_trts.a /package/lib/libsgx_trts.a 0 main STP +/build/linux/libsgx_trts_sim.a /package/lib/libsgx_trts_sim.a 0 main STP +/build/linux/libsgx_tservice.a /package/lib/libsgx_tservice.a 0 main STP +/build/linux/libsgx_tservice_sim.a /package/lib/libsgx_tservice_sim.a 0 main STP +/build/linux/libsgx_tstdc.a /package/lib/libsgx_tstdc.a 0 main STP +/build/linux/libsgx_tstdcxx.a /package/lib/libsgx_tstdcxx.a 0 main STP +/build/linux/libsgx_uae_service_deploy.so /package/lib/libsgx_uae_service.so 0 main STP +/build/linux/libsgx_uae_service_sim.so /package/lib/libsgx_uae_service_sim.so 0 main STP +/build/linux/libsgx_ukey_exchange.a /package/lib/libsgx_ukey_exchange.a 0 main STP +/build/linux/libsgx_urts_deploy.so /package/lib/libsgx_urts.so 0 main STP +/build/linux/libsgx_urts_sim.so /package/lib/libsgx_urts_sim.so 0 main STP +/build/linux/STLport_Changes_SGX.txt /package/lib/STLport_Changes_SGX.txt 0 main STP +/build/linux/sgx_config_cpusvn /package/bin/x86/sgx_config_cpusvn 0 main STP +/build/linux/sgx_edger8r /package/bin/x86/sgx_edger8r 0 main STP +/build/linux/sgx_sign /package/bin/x86/sgx_sign 0 main STP +/linux/installer/common/sdk/installConfig.x86 /scripts/installConfig 0 main STP diff --git a/linux/installer/common/sdk/Makefile b/linux/installer/common/sdk/Makefile new file mode 100644 index 0000000000..68363821d5 --- /dev/null +++ b/linux/installer/common/sdk/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include scripts/installConfig + +SOURCE_FOLDER=package +SCRIPTS_FOLDER=scripts + +INSTALL_PATH=$(DESTDIR)/$(SGX_PACKAGES_PATH)/$(SDK_PKG_NAME) +SOURCE_INSTALL_PATH=$(INSTALL_PATH) +SCRIPTS_INSTALL_PATH=$(INSTALL_PATH)/$(SCRIPTS_FOLDER) +SDK_LIB_PATH=$(SOURCE_INSTALL_PATH)/$(LIB_DIR) + +default: + +install: + install -d $(SOURCE_INSTALL_PATH) + install -d $(SCRIPTS_INSTALL_PATH) + install -d $(DESTDIR)/usr/lib + cp -r $(SOURCE_FOLDER)/* $(SOURCE_INSTALL_PATH) + install $(SCRIPTS_FOLDER)/* $(SCRIPTS_INSTALL_PATH) + mv $(SDK_LIB_PATH)/libsgx_uae_service_sim.so $(DESTDIR)/usr/lib + mv $(SDK_LIB_PATH)/libsgx_urts_sim.so $(DESTDIR)/usr/lib diff --git a/linux/installer/common/sdk/createTarball.sh b/linux/installer/common/sdk/createTarball.sh new file mode 100755 index 0000000000..cda3c29a07 --- /dev/null +++ b/linux/installer/common/sdk/createTarball.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +set -e + +SCRIPT_DIR=$(dirname "$0") +ROOT_DIR="${SCRIPT_DIR}/../../../../" +BUILD_DIR="${ROOT_DIR}/build/linux" +LINUX_INSTALLER_DIR="${ROOT_DIR}/linux/installer" +LINUX_INSTALLER_COMMON_DIR="${LINUX_INSTALLER_DIR}/common" + +INSTALL_PATH=${SCRIPT_DIR}/output + +# Cleanup +rm -fr ${INSTALL_PATH} + +# Get the architecture of the build from generated binary +get_arch() +{ + local a=$(readelf -h $BUILD_DIR/sgx_sign | awk '/Class:/{print $2}') + test $a = ELF64 && echo 'x64' || echo 'x86' +} + +ARCH=$(get_arch) + +# Fetch the gen_source script +cp ${LINUX_INSTALLER_COMMON_DIR}/gen_source/gen_source.py ${SCRIPT_DIR} + +# Copy the files according to the BOM +python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/sdk_base.txt +python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/sdk_${ARCH}.txt --cleanup=false +python ${SCRIPT_DIR}/gen_source.py --bom=../licenses/BOM_license.txt --cleanup=false + +# Create the tarball +source ${SCRIPT_DIR}/installConfig.${ARCH} + +pushd ${INSTALL_PATH} &> /dev/null +tar -zcvf ${TARBALL_NAME} * +popd &> /dev/null diff --git a/linux/installer/common/sdk/install.sh b/linux/installer/common/sdk/install.sh new file mode 100755 index 0000000000..cea3366a1f --- /dev/null +++ b/linux/installer/common/sdk/install.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +set -e + +SCRIPT_DIR=$(dirname "$0") +source ${SCRIPT_DIR}/installConfig + +# Generate the script to preload SGX ptrace library for gdb +SDK_DST_PATH=${SGX_PACKAGES_PATH}/${SDK_PKG_NAME} +GDB_SCRIPT=/usr/bin/sgx-gdb +SDK_LIB_PATH=${SDK_DST_PATH}/${LIB_DIR} + +generate_gdb_script() +{ + cat > $GDB_SCRIPT < $SDK_DST_PATH/uninstall.sh < +typedef struct _aesm_thread_t *aesm_thread_t; +typedef ptrdiff_t aesm_thread_arg_type_t; +typedef ae_error_t (*aesm_thread_function_t)(aesm_thread_arg_type_t arg); + +ae_error_t aesm_create_thread(aesm_thread_function_t function_entry, aesm_thread_arg_type_t arg, aesm_thread_t* h); +ae_error_t aesm_free_thread(aesm_thread_t h); +ae_error_t aesm_join_thread(aesm_thread_t h, ae_error_t *thread_ret); + +extern const uint32_t AESM_THREAD_INFINITE; + +ae_error_t aesm_wait_thread(aesm_thread_t h, ae_error_t *thread_ret, unsigned long milisecond); + +#endif diff --git a/psw/ae/aesm_service/include/oal/error_report.h b/psw/ae/aesm_service/include/oal/error_report.h new file mode 100644 index 0000000000..5e05334c26 --- /dev/null +++ b/psw/ae/aesm_service/include/oal/error_report.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __OAL_ERROR_REPORT_H__ +#define __OAL_ERROR_REPORT_H__ +#define AESM_LOG_REPORT_FATAL 0 +#define AESM_LOG_REPORT_ERROR 1 +#define AESM_LOG_REPORT_WARNING 2 +#include "event_strings.h" +#ifdef __cplusplus +extern "C" { +#endif/*__cplusplus*/ + void aesm_log_report(int level, const char *format, ...); + void aesm_log_init(void); + void aesm_log_fini(void); +#ifdef __cplusplus +}; +#endif/*__cplusplus*/ + +#define AESM_LOG_FATAL(format, args...) aesm_log_report(AESM_LOG_REPORT_FATAL, format, ## args) +#define AESM_LOG_ERROR(format, args...) aesm_log_report(AESM_LOG_REPORT_ERROR, format, ## args) +#define AESM_LOG_WARN(format, args...) aesm_log_report(AESM_LOG_REPORT_WARNING, format, ## args) +#define AESM_LOG_INIT() aesm_log_init() +#define AESM_LOG_FINI() aesm_log_fini() + +#endif/*__OAL_ERROR_REPORT_H__*/ + diff --git a/psw/ae/aesm_service/include/oal/internal_log.h b/psw/ae/aesm_service/include/oal/internal_log.h new file mode 100644 index 0000000000..93ce70df43 --- /dev/null +++ b/psw/ae/aesm_service/include/oal/internal_log.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __OAL_INTERNAL_LOG_H__ +#define __OAL_INTERNAL_LOG_H__ +#ifdef DBG_LOG +#include +#define FATAL_LOG_LEVEL 0 /*report critical internal error*/ +#define ERROR_LOG_LEVEL 1 /*report internal error message*/ +#define WARN_LOG_LEVEL 2 /*report internal warning messages*/ +#define INFO_LOG_LEVEL 3 /*aesm high level trace information, usually information for each components*/ +#define DEBUG_LOG_LEVEL 4 /*aesm middle level trace information, usually information for each function*/ +#define TRACE_LOG_LEVEL 5 /*aesm low level trace information, usually inside a control flow*/ +#ifdef __cplusplus +extern "C" { +#endif/*__cplusplus*/ + void aesm_internal_log(const char *filename, int line_no, const char *funname, int level, const char *format, ...); + void aesm_set_log_level(int level); + void aesm_dbg_format_hex(const uint8_t *data, uint32_t data_len, char *out_buf, uint32_t buf_size); + int enter_module(int module_index); + void leave_module(int module_index); +#ifdef __cplusplus +}; +#endif/*__cplusplus*/ + +#define AESM_DBG_FATAL(format, args...) aesm_internal_log(__FILE__, __LINE__, __FUNCTION__, FATAL_LOG_LEVEL, format, ## args) +#define AESM_DBG_ERROR(format, args...) aesm_internal_log(__FILE__, __LINE__, __FUNCTION__, ERROR_LOG_LEVEL, format, ## args) +#define AESM_DBG_WARN(format, args...) aesm_internal_log(__FILE__, __LINE__, __FUNCTION__, WARN_LOG_LEVEL, format, ## args) +#define AESM_DBG_INFO(format, args...) aesm_internal_log(__FILE__, __LINE__, __FUNCTION__, INFO_LOG_LEVEL, format, ## args) +#define AESM_DBG_DEBUG(format, args...) aesm_internal_log(__FILE__, __LINE__, __FUNCTION__, DEBUG_LOG_LEVEL, format, ## args) +#define AESM_DBG_TRACE(format, args...) aesm_internal_log(__FILE__, __LINE__, __FUNCTION__, TRACE_LOG_LEVEL, format, ## args) + +#define AESM_SET_DBG_LEVEL(level) aesm_set_log_level(level) +#else +#define AESM_DBG_FATAL(args...) +#define AESM_DBG_ERROR(args...) +#define AESM_DBG_WARN(args...) +#define AESM_DBG_INFO(args...) +#define AESM_DBG_DEBUG(args...) +#define AESM_DBG_TRACE(args...) +#define AESM_SET_DBG_LEVEL(level) +#endif/*DBG_LOG*/ + +#define SGX_DBGPRINT_ONE_STRING_ONE_INT(x,y) AESM_DBG_WARN("%s %d", x, y) +#define SGX_DBGPRINT_ONE_STRING_ONE_INT_LTP(x,y) AESM_DBG_WARN("LTP: %s %d", x, y) +#define SGX_DBGPRINT_PRINT_FUNCTION_AND_RETURNVAL(x,y) AESM_DBG_WARN("%s returned %d",x,y) +#define SGX_DBGPRINT_PRINT_TWO_STRINGS(x,y) AESM_DBG_WARN("%s %s",x, y) +#define SGX_DBGPRINT_PRINT_TWO_STRINGS_ONE_INT(x,y,z) AESM_DBG_WARN("%s %s %d", x,y,z) +#define SGX_DBGPRINT_PRINT_FIVE_STRINGS(a,b,c,d,e) AESM_DBG_WARN("%s %s %s %s %s",a,b,c,d,e) +#define SGX_DBGPRINT_PRINT_STRING_LTP(x) AESM_DBG_WARN("%s",x) +#define SGX_DBGPRINT_PRINT_STRING(x) AESM_DBG_WARN("%s",x) + +#define SGX_DBGPRINT_ONE_STRING_ONE_INT_CERT(x,y) AESM_DBG_WARN("cert: %s %d", x, y) +#define SGX_DBGPRINT_ONE_STRING_ONE_INT_OCSP(x,y) AESM_DBG_WARN("OCSP: %s %d", x, y) + +#define SGX_DBGPRINT_ONE_STRING_TWO_INTS_EPH(x,y,z) +#define SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(x,y,z) +#define SGX_DBGPRINT_ONE_STRING_TWO_INTS_ENDPOINT_SELECTION(x,y,z) + +#endif/*__OAL_INTERNAL_LOG_H__*/ + diff --git a/psw/ae/aesm_service/include/oal/oal.h b/psw/ae/aesm_service/include/oal/oal.h new file mode 100644 index 0000000000..47854de0c9 --- /dev/null +++ b/psw/ae/aesm_service/include/oal/oal.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_OAL_H_ +#define _AESM_OAL_H_ +#include "oal/aesm_network.h" +#include "oal/aesm_persistent_storage.h" +#include "oal/power.h" +#include "oal/error_report.h" +#include "oal/internal_log.h" +#include "oal/aesm_thread.h" + +#define CLASS_UNCOPYABLE(classname) \ + private: \ + classname(const classname&); \ + classname& operator=(const classname&); +#endif + diff --git a/psw/ae/aesm_service/include/oal/power.h b/psw/ae/aesm_service/include/oal/power.h new file mode 100644 index 0000000000..faf992e024 --- /dev/null +++ b/psw/ae/aesm_service/include/oal/power.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __OAL_POWER_H__ +#include + +ae_error_t aesm_start_request_wake_execution(); +ae_error_t aesm_stop_request_wake_execution(); +#endif + diff --git a/psw/ae/aesm_service/source/aesm/application/AEClass.h b/psw/ae/aesm_service/source/aesm/application/AEClass.h new file mode 100644 index 0000000000..0fe1b5d87b --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/AEClass.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AE_CLASS_H_ +#define _AE_CLASS_H_ +#include "sgx_eid.h" +#include "sgx_key.h" +#include "se_thread.h" +#include "sgx_urts.h" +#include "internal/se_stdio.h" +#include "oal/oal.h" +#include "aeerror.h" +#include +#include + +template +class Singleton +{ + CLASS_UNCOPYABLE(Singleton) +public: + static T& instance() + { + if (0 == _instance) + { + _instance = new T(); + atexit(destroy); + } + return *_instance; + } + + virtual ~Singleton() + { + _instance = NULL; + } + +protected: + Singleton(){} +private: + static void destroy() + { + if ( _instance != 0 ) + { + delete _instance; + _instance = 0; + } + } + static T * volatile _instance; +}; + +template +class SingletonEnclave: public Singleton +{ + CLASS_UNCOPYABLE(SingletonEnclave) +public: + + virtual ae_error_t load_enclave(); + void unload_enclave(); +protected: + sgx_enclave_id_t m_enclave_id; + sgx_launch_token_t m_launch_token; + sgx_misc_attribute_t m_attributes; + SingletonEnclave():m_enclave_id(0) + { + memset(&m_launch_token, 0, sizeof(m_launch_token)); + memset(&m_attributes, 0, sizeof(m_attributes)); + } + ~SingletonEnclave(){} + virtual void before_enclave_load() {} + virtual int get_debug_flag() = 0; + +}; +template +ae_error_t SingletonEnclave::load_enclave() +{ + before_enclave_load(); + + if(m_enclave_id) + return AE_SUCCESS; + + aesm_enclave_id_t aesm_enclave_id = T::get_enclave_fid(); + AESM_DBG_INFO("loading enclave %d",aesm_enclave_id); + + sgx_status_t ret; + ae_error_t ae_err; + char enclave_path[MAX_PATH]= {0}; + if((ae_err = aesm_get_pathname(FT_ENCLAVE_NAME, aesm_enclave_id, enclave_path, + MAX_PATH)) + !=AE_SUCCESS){ + AESM_DBG_ERROR("fail to get enclave pathname"); + return ae_err; + } + int launch_token_update; + ret = sgx_create_enclave(enclave_path, get_debug_flag(), &m_launch_token, + &launch_token_update, &m_enclave_id, + &m_attributes); + if (ret == SGX_ERROR_NO_DEVICE){ + AESM_DBG_ERROR("AE SERVER NOT AVAILABLE in load enclave: %s",enclave_path); + return AE_SERVER_NOT_AVAILABLE; + } + if (ret != SGX_SUCCESS){ + AESM_DBG_ERROR("Create Enclave failed:%d",ret); + return AE_FAILURE; + } + AESM_DBG_INFO("enclave %d loaded with id 0X%llX",aesm_enclave_id,m_enclave_id); + + return AE_SUCCESS; +} + +template +void SingletonEnclave::unload_enclave() +{ + if (m_enclave_id) + { + AESM_DBG_INFO("unload enclave 0X%llX",m_enclave_id); + sgx_destroy_enclave(m_enclave_id); + m_enclave_id = 0; + } + + return; +} + +template +T * volatile Singleton::_instance = 0; + +#define AESM_RETRY_COUNT 3 + +ae_error_t sgx_error_to_ae_error(sgx_status_t status); +#endif + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp b/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp new file mode 100644 index 0000000000..c651501f0c --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "aesm_config.h" +#include "aesm_proxy_type.h" +#include "oal.h" +#include +#include +#include + +#define AESM_CONFIG_FILE "/etc/aesmd.conf" +#define MAX_LINE 1024 +#define URL_PATTERN "[[:blank:]]*(http[s]?://[^[:blank:]]*)[[:blank:]]*" //pattern used to match a URL which should be started with http:// or https:// +#define OPTION_COMMENT "(#.*)?" + +enum _config_value_t{ + config_comment, + config_space, + config_endpoint_url, + config_pse_rl_url, + config_pse_ocsp_url, + config_aesm_proxy_url, + config_aesm_proxy_type, + config_value_nums +}; + +struct _config_patterns_t{ + enum _config_value_t id; + const char *pattern; +}config_patterns[]={ + {config_comment, "^[[:blank:]]*#"}, //matching a line with comments only (It is started by #) + {config_space, "^[[:blank:]]*$"}, //matching empty line + {config_endpoint_url, "^[[:blank:]]*endpoint[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: endpoint url = .... + {config_pse_rl_url, "^[[:blank:]]*pse[[:blank:]]*rl[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: pse rl url = ... + {config_pse_ocsp_url, "^[[:blank:]]*pse[[:blank:]]*ocsp[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: pse ocsp url = ... + {config_aesm_proxy_url,"^[[:blank:]]*aesm[[:blank:]]*proxy[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: aesm proxy = ... + {config_aesm_proxy_type, "^[[:blank:]]*proxy[[:blank:]]*type[[:blank:]]*=[[:blank:]]([^[:blank:]]+)[[:blank:]]*" OPTION_COMMENT "$"}//matching line in format: proxy type = [direct|default|manual] +}; + +#define NUM_CONFIG_PATTERNS (sizeof(config_patterns)/sizeof(config_patterns[0])) + +typedef struct _config_entry_t{ + bool initialized; + regex_t reg; +} config_entry_t; + +//static function to initialize all regular expression pattern +static void init_config_patterns(config_entry_t entries[]) +{ + uint32_t i; + for(i=0;i=config_value_nums){ + AESM_DBG_ERROR("config id %d is too large", entry_id); + continue; + } + if(entries[entry_id].initialized){ + AESM_DBG_ERROR("duplicated item for config id %d",entry_id); + continue; + } + if(regcomp(&entries[entry_id].reg,config_patterns[i].pattern, REG_EXTENDED|REG_ICASE)!=0){ + AESM_DBG_ERROR("Invalid config pattern %s", config_patterns[i].pattern); + continue; + } + entries[entry_id].initialized=true; + } +} + +static void release_config_patterns(config_entry_t entries[]) +{ + uint32_t i; + for(i=0;i=MAX_PATH){ + AESM_DBG_ERROR("too long endpoint url in config file"); + }else{ + memcpy(infos.endpoint_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); + infos.endpoint_url[matches[1].rm_eo-matches[1].rm_so]='\0'; + } + break; + case config_pse_rl_url: + if(matches[1].rm_eo-matches[1].rm_so>=MAX_PATH){ + AESM_DBG_ERROR("too long pse pr url in config file"); + }else{ + memcpy(infos.pse_rl_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); + infos.pse_rl_url[matches[1].rm_eo-matches[1].rm_so]='\0'; + } + break; + case config_pse_ocsp_url: + if(matches[1].rm_eo-matches[1].rm_so>=MAX_PATH){ + AESM_DBG_ERROR("too long pse ocsp url in config file"); + }else{ + memcpy(infos.pse_ocsp_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); + infos.pse_ocsp_url[matches[1].rm_eo-matches[1].rm_so]='\0'; + } + break; + case config_aesm_proxy_url: + if(matches[1].rm_eo-matches[1].rm_so>=MAX_PATH){ + AESM_DBG_ERROR("too long aesm proxy url in config file"); + }else{ + memcpy(infos.aesm_proxy, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); + infos.aesm_proxy[matches[1].rm_eo-matches[1].rm_so]='\0'; + } + break; + case config_aesm_proxy_type://It is a proxy type, we need change the string to integer by calling function read_aesm_proxy_type + infos.proxy_type = read_aesm_proxy_type(line+matches[1].rm_so, matches[1].rm_eo-matches[1].rm_so); + break; + default: + AESM_DBG_ERROR("reg exp type %d not processed", i); + break; + } + break; + } + } + if(i>=config_value_nums){//the line matching nothing + AESM_DBG_ERROR("aesm config file error: invalid line[%s]",line); + return false; + } + return true; +} + +bool read_aesm_config(aesm_config_infos_t& infos) +{ + char line[MAX_LINE]; + int line_no=0; + bool ret = true; + config_entry_t entries[config_value_nums]; + memset(&entries,0,sizeof(entries)); + memset(&infos, 0, sizeof(aesm_config_infos_t)); + strcpy(infos.endpoint_url, DEFAULT_URL); + strcpy(infos.pse_rl_url, DEFAULT_PSE_RL_URL); + strcpy(infos.pse_ocsp_url, DEFAULT_PSE_OCSP_URL); + + infos.proxy_type = AESM_PROXY_TYPE_DEFAULT_PROXY; + FILE *f =fopen(AESM_CONFIG_FILE, "r"); + if(f==NULL){ + AESM_DBG_ERROR("Cannnot read aesm config file %s",AESM_CONFIG_FILE); + return false; + } + init_config_patterns(entries); + while(fgets(line, MAX_LINE, f)!=NULL){ + size_t len=strlen(line); + if(len>0&&line[len-1]=='\n')line[len-1]='\0';//remove the line ending + line_no++; + if(!config_process_one_line(line, entries, infos)){ + AESM_LOG_WARN("format error in file %s:%d [%s]",AESM_CONFIG_FILE, line_no, line); + ret = false;//continue process the file but save the error status + } + } + release_config_patterns(entries); + fclose(f); + if(infos.proxy_type>=NUM_PROXY_TYPE|| + (infos.proxy_type==AESM_PROXY_TYPE_MANUAL_PROXY&&infos.aesm_proxy[0]=='\0')){ + AESM_DBG_WARN("Invalid proxy type %d",infos.proxy_type); + infos.proxy_type = AESM_PROXY_TYPE_DIRECT_ACCESS; + ret = false; + } + return ret; +} + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_config.h b/psw/ae/aesm_service/source/aesm/application/aesm_config.h new file mode 100644 index 0000000000..0dc5b5f24f --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_config.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AESM_CONFIG_H_ +#define _AESM_CONFIG_H_ +#include "se_types.h" +#include "se_wrapper.h" +#include "aesm_logic.h" +typedef struct _aesm_config_infos_t{ + uint32_t proxy_type; + char endpoint_url[MAX_PATH]; + char pse_rl_url[MAX_PATH]; + char pse_ocsp_url[MAX_PATH]; + char aesm_proxy[MAX_PATH]; +}aesm_config_infos_t; +#endif + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp b/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp new file mode 100644 index 0000000000..84b124a0b9 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp @@ -0,0 +1,549 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "QEClass.h" +#include "LEClass.h" +#include "PVEClass.h" + +#include "arch.h" +#include "sgx_report.h" +#include "sgx_tseal.h" +#include "epid_pve_type.h" +#include "util.h" +#include +#include +#include "oal/oal.h" +#include "oal/aesm_thread.h" +#include "aesm_encode.h" +#include "aesm_epid_blob.h" +#include "aesm_logic.h" +#include "pve_logic.h" +#include "qe_logic.h" +#include "platform_info_logic.h" +#include "prov_msg_size.h" +#include "se_sig_rl.h" +#include "se_quote_internal.h" +#include "endpoint_select_info.h" +#include "se_wrapper.h" +#include "ippcp.h" +#include "ippcore.h" +#include +#include +#include "ippcp.h" +#include "ippcore.h" +#include "prof_fun.h" +#include "aesm_long_lived_thread.h" +#include "sgx_profile.h" + +#define CHECK_SERVICE_STATUS if (!is_service_running()) return AESM_SERVICE_STOPPED; +#define CHECK_SGX_STATUS if (g_sgx_device_status != SGX_ENABLED) return AESM_SGX_DEVICE_NOT_AVAILABLE; + +AESMLogicMutex AESMLogic::_qe_pve_mutex; +AESMLogicMutex AESMLogic::_pse_mutex; +AESMLogicMutex AESMLogic::_le_mutex; + +bool AESMLogic::_is_qe_psvn_set; +bool AESMLogic::_is_pse_psvn_set; +psvn_t AESMLogic::_qe_psvn; +psvn_t AESMLogic::_pse_psvn; + +static ae_error_t thread_to_load_qe(aesm_thread_arg_type_t arg) +{ + epid_blob_with_cur_psvn_t epid_data; + ae_error_t ae_ret = AE_FAILURE; + UNUSED(arg); + AESM_DBG_TRACE("start to load qe"); + memset(&epid_data, 0, sizeof(epid_data)); + AESMLogicLock lock(AESMLogic::_qe_pve_mutex); + if((ae_ret = EPIDBlob::instance().read(epid_data)) == AE_SUCCESS) + { + AESM_DBG_TRACE("EPID blob is read successfully, loading QE ..."); + ae_ret = CQEClass::instance().load_enclave(); + if(AE_SUCCESS != ae_ret) + { + AESM_DBG_WARN("fail to load QE: %d", ae_ret); + }else{ + AESM_DBG_TRACE("QE loaded successfully"); + } + } + AESM_DBG_TRACE("QE Thread finished succ"); + return AE_SUCCESS; +} + +// Must be called when AESM starts +ae_error_t AESMLogic::service_start() +{ + AESM_PROFILE_INIT; + ae_error_t ae_ret = AE_SUCCESS; + + AESM_LOG_INIT(); + + //ippInit();//no ippInit available for c version ipp + AESM_DBG_INFO("aesm service is starting"); + ae_ret = CLEClass::instance().load_enclave(); + if(AE_SUCCESS != ae_ret) + { + AESM_DBG_INFO("fail to load LE: %d", ae_ret); + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_SERVICE_UNAVAILABLE]); + + return ae_ret; + } + + aesm_thread_t qe_thread=NULL; + ae_error_t aesm_ret1 = aesm_create_thread(thread_to_load_qe, 0,&qe_thread); + if(AE_SUCCESS != aesm_ret1 ){ + AESM_DBG_WARN("Fail to create thread to preload QE:%d",aesm_ret1); + }else{ + (void)aesm_free_thread(qe_thread);//release thread handle to free memory + } + + AESM_DBG_TRACE("aesm service is started"); + + return AE_SUCCESS; +} + +void AESMLogic::service_stop() +{ + CPVEClass::instance().unload_enclave(); + CQEClass::instance().unload_enclave(); + CLEClass::instance().unload_enclave(); + stop_all_long_lived_threads(); + AESM_DBG_INFO("aesm service down"); + AESM_LOG_FINI(); + + AESM_PROFILE_OUTPUT; +} + +bool AESMLogic::is_service_running() +{ + return true; +} + +ae_error_t AESMLogic::save_unverified_white_list(const uint8_t *white_list_cert, uint32_t white_list_cert_size) +{ + wl_cert_chain_t old_cert; + const wl_cert_chain_t *p_new_cert = reinterpret_cast(white_list_cert); + uint32_t old_cert_size = sizeof(old_cert); + memset(&old_cert, 0, sizeof(old_cert)); + if((aesm_read_data(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_TO_BE_VERIFY_FID, reinterpret_cast(&old_cert), &old_cert_size) == AE_SUCCESS) + && (old_cert_size == sizeof(old_cert)) && (white_list_cert_size >= sizeof(wl_cert_chain_t))) + { + if(_ntohl(p_new_cert->wl_cert.wl_version) <= _ntohl(old_cert.wl_cert.wl_version)) + { + AESM_DBG_WARN("White list version downgraded! current version is %d, new version is %d", + _ntohl(old_cert.wl_cert.wl_version), _ntohl(p_new_cert->wl_cert.wl_version)); + return OAL_PARAMETER_ERROR; // OAL_PARAMETER_ERROR used here is to indicate the white list is incorrect + } + } + return aesm_write_data(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_TO_BE_VERIFY_FID, white_list_cert, white_list_cert_size); +} + +aesm_error_t AESMLogic::white_list_register( + const uint8_t *white_list_cert, uint32_t white_list_cert_size) +{ + AESM_DBG_INFO("enter function"); + CHECK_SERVICE_STATUS; + AESMLogicLock lock(_le_mutex); + CHECK_SERVICE_STATUS; + ae_error_t ret_le = AE_SUCCESS; + if (NULL == white_list_cert||0==white_list_cert_size){ + AESM_DBG_TRACE("Invalid parameter"); + return AESM_PARAMETER_ERROR; + } + ae_error_t ae_ret = CLEClass::instance().load_enclave(); + if(ae_ret == AE_SERVER_NOT_AVAILABLE) + { + AESM_DBG_WARN("LE not loaded due to AE_SERVER_NOT_AVAILABLE, possible SGX Env Not Ready"); + ret_le = save_unverified_white_list(white_list_cert, white_list_cert_size); + } + else if(AE_FAILED(ae_ret)) + { + AESM_DBG_ERROR("LE not loaded:%d", ae_ret); + return AESM_UNEXPECTED_ERROR; + }else{ + ret_le = static_cast(CLEClass::instance().white_list_register( + white_list_cert, white_list_cert_size)); + } + + switch (ret_le) + { + case AE_SUCCESS: + return AESM_SUCCESS; + case LE_INVALID_PARAMETER: + AESM_DBG_TRACE("Invalid parameter"); + return AESM_PARAMETER_ERROR; + case LE_INVALID_ATTRIBUTE: + AESM_DBG_TRACE("Launch token error"); + return AESM_GET_LICENSETOKEN_ERROR; + default: + AESM_DBG_WARN("unexpeted error %d", ret_le); + return AESM_UNEXPECTED_ERROR; + } +} + +aesm_error_t AESMLogic::get_launch_token( + const uint8_t * mrenclave, uint32_t mrenclave_size, + const uint8_t *public_key, uint32_t public_key_size, + const uint8_t *se_attributes, uint32_t se_attributes_size, + uint8_t * lictoken, uint32_t lictoken_size) +{ + AESM_DBG_INFO("enter function"); + + CHECK_SERVICE_STATUS; + AESMLogicLock lock(_le_mutex); + CHECK_SERVICE_STATUS; + + ae_error_t ret_le = AE_SUCCESS; + if (NULL == mrenclave || + NULL == public_key || + NULL == se_attributes || + NULL == lictoken) + { + //sizes are checked in CLEClass::get_launch_token() + AESM_DBG_TRACE("Invalid parameter"); + return AESM_PARAMETER_ERROR; + } + ae_error_t ae_ret = CLEClass::instance().load_enclave(); + if(ae_ret == AE_SERVER_NOT_AVAILABLE) + { + AESM_LOG_ERROR("%s", g_event_string_table[SGX_EVENT_SERVICE_UNAVAILABLE]); + AESM_DBG_FATAL("LE not loaded due to AE_SERVER_NOT_AVAILABLE, possible SGX Env Not Ready"); + return AESM_NO_DEVICE_ERROR; + } + else if(AE_FAILED(ae_ret)) + { + AESM_DBG_ERROR("LE not loaded:%d", ae_ret); + return AESM_UNEXPECTED_ERROR; + } + ret_le = static_cast(CLEClass::instance().get_launch_token( + const_cast(mrenclave), mrenclave_size, + const_cast(public_key), public_key_size, + const_cast(se_attributes), se_attributes_size, + lictoken, lictoken_size)); + + switch (ret_le) + { + case AE_SUCCESS: + return AESM_SUCCESS; + case LE_INVALID_PARAMETER: + AESM_DBG_TRACE("Invalid parameter"); + return AESM_PARAMETER_ERROR; + case LE_INVALID_ATTRIBUTE: + case LE_INVALID_PRIVILEGE_ERROR: + AESM_DBG_TRACE("Launch token error"); + return AESM_GET_LICENSETOKEN_ERROR; + case LE_WHITELIST_UNINITIALIZED_ERROR: + AESM_DBG_TRACE("LE whitelist uninitialized error"); + return AESM_UNEXPECTED_ERROR; + default: + AESM_DBG_WARN("unexpeted error %d", ret_le); + return AESM_UNEXPECTED_ERROR; + } +} + +/* This function will be called outside aesm(from urts_internal) */ +extern "C" sgx_status_t get_launch_token(const enclave_css_t* signature, + const sgx_attributes_t* attribute, + sgx_launch_token_t* launch_token) +{ + AESM_DBG_INFO("enter function"); + return AESMLogic::get_launch_token(signature, attribute, launch_token); +} + +ae_error_t AESMLogic::get_qe_isv_svn(uint16_t& isv_svn) +{ + if(!_is_qe_psvn_set){ + ae_error_t ae_err = CQEClass::instance().load_enclave(); + if(AE_SUCCESS != ae_err){ + AESM_DBG_ERROR("Fail to load QE Enclave:%d",ae_err); + return ae_err; + } + } + assert(_is_qe_psvn_set); + if(0!=memcpy_s(&isv_svn, sizeof(isv_svn), &_qe_psvn.isv_svn, sizeof(_qe_psvn.isv_svn))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + return AE_SUCCESS; +} + +ae_error_t AESMLogic::get_pse_isv_svn(uint16_t& isv_svn) +{ + return AE_FAILURE; +} + +ae_error_t AESMLogic::get_qe_cpu_svn(sgx_cpu_svn_t& cpu_svn) +{ + if(!_is_qe_psvn_set){ + ae_error_t ae_err = CQEClass::instance().load_enclave(); + if(AE_SUCCESS != ae_err){ + AESM_DBG_ERROR("Fail to load QE Enclave:%d",ae_err); + return ae_err; + } + } + assert(_is_qe_psvn_set); + if(0!=memcpy_s(&cpu_svn, sizeof(sgx_cpu_svn_t), &_qe_psvn.cpu_svn, sizeof(_qe_psvn.cpu_svn))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + return AE_SUCCESS; +} + + + +ae_error_t AESMLogic::set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn) +{ + if(prod_id == QE_PROD_ID){ + if(_is_qe_psvn_set){ + if(0!=memcmp(&_qe_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| + 0!=memcmp(&_qe_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("PSVN unmatched for QE/PVE"); + return AE_PSVN_UNMATCHED_ERROR; + } + }else{ + if(0!=memcpy_s(&_qe_psvn.isv_svn, sizeof(_qe_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| + 0!=memcpy_s(&_qe_psvn.cpu_svn, sizeof(_qe_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + AESM_DBG_TRACE("get QE or PvE isv_svn=%d",(int)isv_svn); + _is_qe_psvn_set = true; + return AE_SUCCESS; + } + }else if(prod_id == PSE_PROD_ID){ + if(_is_pse_psvn_set){ + if(0!=memcmp(&_pse_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| + 0!=memcmp(&_pse_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("PSVN unmatched for PSE"); + return AE_PSVN_UNMATCHED_ERROR; + } + }else{ + if(0!=memcpy_s(&_pse_psvn.isv_svn, sizeof(_pse_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| + 0!=memcpy_s(&_pse_psvn.cpu_svn, sizeof(_pse_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + AESM_DBG_TRACE("get PSE isv_svn=%d", (int)isv_svn); + _is_pse_psvn_set = true; + return AE_SUCCESS; + } + } + return AE_SUCCESS; +} + +sgx_status_t AESMLogic::get_launch_token(const enclave_css_t* signature, + const sgx_attributes_t* attribute, + sgx_launch_token_t* launch_token) +{ + AESM_DBG_INFO("enter function"); + AESMLogicLock lock(_le_mutex); + + ae_error_t ret_le = AE_SUCCESS; + // load LE to get launch token + if((ret_le=CLEClass::instance().load_enclave()) != AE_SUCCESS) + { + if(ret_le == AE_SERVER_NOT_AVAILABLE) + { + AESM_DBG_FATAL("LE not loaded due to AE_SERVER_NOT_AVAILABLE, possible SGX Env Not Ready"); + return SGX_ERROR_NO_DEVICE; + } + AESM_DBG_FATAL("fail to load LE:%d",ret_le); + return SGX_ERROR_UNEXPECTED; + } + + + ret_le = static_cast(CLEClass::instance().get_launch_token( + const_cast(reinterpret_cast(&signature->body.enclave_hash)), + sizeof(sgx_measurement_t), + const_cast(reinterpret_cast(&signature->key.modulus)), + sizeof(signature->key.modulus), + const_cast(reinterpret_cast(attribute)), + sizeof(sgx_attributes_t), + reinterpret_cast(launch_token), + sizeof(token_t))); + switch (ret_le) + { + case AE_SUCCESS: + break; + case LE_INVALID_PARAMETER: + AESM_DBG_TRACE("Invalid parameter"); + return SGX_ERROR_INVALID_PARAMETER; + case LE_INVALID_ATTRIBUTE: + case LE_INVALID_PRIVILEGE_ERROR: + AESM_DBG_TRACE("Launch token error"); + return SGX_ERROR_SERVICE_INVALID_PRIVILEGE; + case LE_WHITELIST_UNINITIALIZED_ERROR: + AESM_DBG_TRACE("LE whitelist uninitialized error"); + return SGX_ERROR_UNEXPECTED; + default: + AESM_DBG_WARN("unexpeted error %d", ret_le); + return SGX_ERROR_UNEXPECTED; + } + + token_t *lt = reinterpret_cast(launch_token); + ret_le = set_psvn(signature->body.isv_prod_id, signature->body.isv_svn, lt->cpu_svn_le); + if(AE_PSVN_UNMATCHED_ERROR == ret_le) + { + //QE or PSE has been changed, but AESM doesn't restart. Will not provide service. + return SGX_ERROR_SERVICE_UNAVAILABLE; + }else if(AE_SUCCESS != ret_le) { + AESM_DBG_ERROR("fail to save psvn:%d", ret_le); + return SGX_ERROR_UNEXPECTED; + } + + return SGX_SUCCESS; +} + +aesm_error_t AESMLogic::create_session( + uint32_t* session_id, + uint8_t* se_dh_msg1, uint32_t se_dh_msg1_size) +{ + return AESM_SERVICE_NOT_AVAILABLE; +} + +aesm_error_t AESMLogic::exchange_report( + uint32_t session_id, + const uint8_t* se_dh_msg2, uint32_t se_dh_msg2_size, + uint8_t* se_dh_msg3, uint32_t se_dh_msg3_size) +{ + return AESM_SERVICE_NOT_AVAILABLE; +} + +aesm_error_t AESMLogic::close_session( + uint32_t session_id) +{ + return AESM_SERVICE_NOT_AVAILABLE; +} + +aesm_error_t AESMLogic::invoke_service( + const uint8_t* pse_message_req, uint32_t pse_message_req_size, + uint8_t* pse_message_resp, uint32_t pse_message_resp_size) +{ + return AESM_SERVICE_NOT_AVAILABLE;; +} + +aesm_error_t AESMLogic::get_ps_cap( + uint64_t* ps_cap) +{ + return AESM_PSDA_UNAVAILABLE; +} + +#define CHECK_EPID_PROVISIONG_STATUS \ + if(!query_pve_thread_status()){\ + return AESM_BUSY;\ + } + +aesm_error_t AESMLogic::init_quote( + uint8_t *target_info, uint32_t target_info_size, + uint8_t *gid, uint32_t gid_size) +{ + ae_error_t ret = AE_SUCCESS; + uint16_t qe_isv_svn = 0xFFFF; + sgx_cpu_svn_t qe_cpu_svn; + memset(&qe_cpu_svn, 0, sizeof(qe_cpu_svn)); + AESM_DBG_INFO("init_quote"); + if(sizeof(sgx_target_info_t) != target_info_size || + sizeof(sgx_epid_group_id_t) != gid_size) + { + return AESM_PARAMETER_ERROR; + } + AESMLogicLock lock(_qe_pve_mutex); + CHECK_EPID_PROVISIONG_STATUS; + ret = get_qe_cpu_svn(qe_cpu_svn); + if(AE_SUCCESS != ret) + { + return AESM_UNEXPECTED_ERROR; + } + ret = get_qe_isv_svn(qe_isv_svn); + if(AE_SUCCESS != ret) + { + return AESM_UNEXPECTED_ERROR; + } + return QEAESMLogic::init_quote( + reinterpret_cast(target_info), + gid, gid_size, qe_isv_svn, qe_cpu_svn); +} + +aesm_error_t AESMLogic::get_quote(const uint8_t *report, uint32_t report_size, + uint32_t quote_type, + const uint8_t *spid, uint32_t spid_size, + const uint8_t *nonce, uint32_t nonce_size, + const uint8_t *sigrl, uint32_t sigrl_size, + uint8_t *qe_report, uint32_t qe_report_size, + uint8_t *quote, uint32_t buf_size) +{ + AESM_DBG_INFO("get_quote"); + if(sizeof(sgx_report_t) != report_size || + sizeof(sgx_spid_t) != spid_size) + { + return AESM_PARAMETER_ERROR; + } + if((nonce && sizeof(sgx_quote_nonce_t) != nonce_size) + || (qe_report && sizeof(sgx_report_t) != qe_report_size)) + + { + return AESM_PARAMETER_ERROR; + } + AESMLogicLock lock(_qe_pve_mutex); + CHECK_EPID_PROVISIONG_STATUS; + return QEAESMLogic::get_quote(report, quote_type, spid, nonce, sigrl, + sigrl_size, qe_report, quote, buf_size); +} + +uint32_t AESMLogic::endpoint_selection(endpoint_selection_infos_t& es_info) +{ + AESMLogicLock lock(_qe_pve_mutex); + SGX_DBGPRINT_ONE_STRING_TWO_INTS_ENDPOINT_SELECTION(__FUNCTION__" (line, 0)", __LINE__, 0); + return EndpointSelectionInfo::instance().start_protocol(es_info); +} + + +aesm_error_t AESMLogic::report_attestation_status( + uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_status, + uint8_t* update_info, uint32_t update_info_size) +{ + AESM_DBG_INFO("report_attestation_status"); + AESMLogicLock lock(_pse_mutex); + return PlatformInfoLogic::report_attestation_status(platform_info, platform_info_size, attestation_status, update_info, update_info_size); +} + +ae_error_t sgx_error_to_ae_error(sgx_status_t status) +{ + if(SGX_ERROR_OUT_OF_MEMORY == status) + return AE_OUT_OF_MEMORY_ERROR; + if(SGX_SUCCESS == status) + return AE_SUCCESS; + return AE_FAILURE; +} + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_logic.h b/psw/ae/aesm_service/source/aesm/application/aesm_logic.h new file mode 100644 index 0000000000..48ef7fc527 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_logic.h @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _AESM_LOGIC_H_ +#define _AESM_LOGIC_H_ +#include "sgx_urts.h" +#include "aesm_error.h" +#include "arch.h" +#include "aeerror.h" +#include "tlv_common.h" +#include "se_thread.h" +#include "internal/se_stdio.h" +#include "internal/se_memcpy.h" +#include "internal/uncopyable.h" +#include "oal/oal.h" +#include +#include +#include "se_wrapper.h" +#include "upse/platform_info_blob.h" + +#include "default_url_info.hh" + +/*File to declare AESMLogic Class */ + +const uint32_t THREAD_TIMEOUT = 5000; + +class AESMLogicMutex{ + CLASS_UNCOPYABLE(AESMLogicMutex) +public: + AESMLogicMutex() {se_mutex_init(&mutex);} + ~AESMLogicMutex() { se_mutex_destroy(&mutex);} + void lock() { se_mutex_lock(&mutex); } + void unlock() { se_mutex_unlock(&mutex); } +private: + se_mutex_t mutex; +}; + +class AESMLogicLock { + CLASS_UNCOPYABLE(AESMLogicLock) +public: + explicit AESMLogicLock(AESMLogicMutex& cs) :_cs(cs) { _cs.lock(); } + ~AESMLogicLock() { _cs.unlock(); } +private: + AESMLogicMutex& _cs; +}; + +#define QE_PROD_ID 1 +#define PSE_PROD_ID 2 + + +typedef struct _endpoint_selection_infos_t endpoint_selection_infos_t; +class AESMLogic{ +public: + static AESMLogicMutex _qe_pve_mutex, _pse_mutex, _le_mutex; /*mutex to lock external interface*/ +private: + static psvn_t _qe_psvn, _pse_psvn; /*two different cpu svn used although they're same. We should only access qe_psvn when qe_pve_mutex is acquired and only access pse_psvn when pse_mutext is acquired*/ + static bool _is_qe_psvn_set, _is_pse_psvn_set; + static ae_error_t set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn); + static ae_error_t save_unverified_white_list(const uint8_t *white_list_cert, uint32_t white_list_cert_size); +public: + static ae_error_t get_qe_isv_svn(uint16_t& isv_svn);/*This function should only be called when _qe_pve_mutex is acquired*/ + static ae_error_t get_qe_cpu_svn(sgx_cpu_svn_t& cpu_svn);/*This function should only be called when _qe_pve_mutex is acquired*/ + static ae_error_t get_pse_isv_svn(uint16_t& isv_svn); /*This function should only be called when _pse_mutex is acquired*/ + static ae_error_t get_pse_cpu_svn(sgx_cpu_svn_t& cpu_svn);/*This function should only be called when _pse_mutex is acquired*/ + + static ae_error_t service_start(); + static void service_stop(); + + static bool is_service_running(); + + static sgx_status_t get_launch_token(const enclave_css_t* signature, + const sgx_attributes_t* attribute, + sgx_launch_token_t* launch_token); + + static aesm_error_t get_launch_token( + const uint8_t *mrenclave, uint32_t mrenclave_size, + const uint8_t *public_key, uint32_t public_key_size, + const uint8_t *se_attributes, uint32_t se_attributes_size, + uint8_t * lictoken, uint32_t lictoken_size); + + static aesm_error_t init_quote(uint8_t *target_info, uint32_t target_info_size, + uint8_t *gid, uint32_t gid_size); + + static aesm_error_t get_quote(const uint8_t *report, uint32_t report_size, + uint32_t quote_type, + const uint8_t *spid, uint32_t spid_size, + const uint8_t *nonce, uint32_t nonce_size, + const uint8_t *sigrl, uint32_t sigrl_size, + uint8_t *qe_report, uint32_t qe_report_size, + uint8_t *quote, uint32_t buf_size); + + static aesm_error_t create_session( + uint32_t* session_id, + uint8_t* se_dh_msg1, uint32_t se_dh_msg1_size); + + static aesm_error_t exchange_report( + uint32_t session_id, + const uint8_t* se_dh_msg2, uint32_t se_dh_msg2_size, + uint8_t* se_dh_msg3, uint32_t se_dh_msg3_size); + + static aesm_error_t close_session( + uint32_t session_id); + + static aesm_error_t invoke_service( + const uint8_t* pse_message_req, uint32_t pse_message_req_size, + uint8_t* pse_message_resp, uint32_t pse_message_resp_size); + + static aesm_error_t get_ps_cap( + uint64_t* ps_cap); + + static uint32_t endpoint_selection(endpoint_selection_infos_t& es_info); + + static aesm_error_t report_attestation_status( + uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_status, + uint8_t* update_info, uint32_t update_info_size); + + static aesm_error_t white_list_register( + const uint8_t *white_list_cert, uint32_t white_list_cert_size); + +}; +#endif + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_proxy_type.h b/psw/ae/aesm_service/source/aesm/application/aesm_proxy_type.h new file mode 100644 index 0000000000..092ff42949 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_proxy_type.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __AESM_PROXY_TYPE_H__ +#define __AESM_PROXY_TYPE_H__ +#define AESM_PROXY_TYPE_DIRECT_ACCESS 0 +#define AESM_PROXY_TYPE_DEFAULT_PROXY 1 +#define AESM_PROXY_TYPE_MANUAL_PROXY 2 +#define AESM_PROXY_TYPE_MAX_VALUE 2 + +#define AESM_PROXY_DEFAULT_VALUE AESM_PROXY_TYPE_DEFAULT_PROXY +#endif diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_rand.cpp b/psw/ae/aesm_service/source/aesm/application/aesm_rand.cpp new file mode 100644 index 0000000000..c22f98eb41 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_rand.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include +#include "sgx_read_rand.h" +#include "se_wrapper.h" +#include "aesm_rand.h" +#include "AEClass.h" + + +extern "C" ae_error_t aesm_read_rand(unsigned char *rand_buf, unsigned int length_in_bytes) +{ + // check parameters + // + if (!rand_buf || !length_in_bytes) + { + return AE_INVALID_PARAMETER; + } + + sgx_status_t sgx_status = sgx_read_rand(rand_buf, length_in_bytes); + + return sgx_error_to_ae_error(sgx_status); +} + + + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_rand.h b/psw/ae/aesm_service/source/aesm/application/aesm_rand.h new file mode 100644 index 0000000000..f1576e31dd --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/aesm_rand.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef __AESM_RAND_H__ +#define __AESM_RAND_H__ + +#include "aeerror.h" + +extern "C" ae_error_t aesm_read_rand(unsigned char *rand, unsigned int length_in_bytes); + +#endif diff --git a/psw/ae/aesm_service/source/aesm/application/event_strings.cpp b/psw/ae/aesm_service/source/aesm/application/event_strings.cpp new file mode 100644 index 0000000000..91c384b36d --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/event_strings.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +const char* g_event_string_table[] = { + "SGX EPID provisioning network failure", // SGX_EVENT_EPID_PROV_FAILURE //network + "Fail to save attestation key in persistent storage", + // SGX_EVENT_EPID_BLOB_PERSISTENT_STROAGE_FAILURE + "Platform Info Blob Signature Error", // SGX_EVENT_PIB_SIGNATURE_FAILURE, + "PSE certificate provisioning failure", // SGX_EVENT_PSE_CERT_PROV_FAILURE //network + "OCSP failure", // SGX_EVENT_OCSP_FAILURE //network + "DAL failure", // SGX_EVENT_DAL_COMM_FAILURE //communication + "SGX disabled", // SGX_EVENT_DISABLED + "SGX Service unavailable", // SGX_EVENT_SERVICE_UNAVAILABLE + "SGX AESM will exit", // SGX_EVENT_AESM_EXIT + "PSE certificate revoked", // SGX_EVENT_PSE_CERT_REVOCATION + "PCH EPID group revoked", // SGX_EVENT_ME_EPID_GROUP_REVOCATION + "SGX EPID revocation", // SGX_EVENT_EPID_REVOCATION //SigRL fail + "SGX EPID blob integrity error", // SGX_EVENT_EPID_INTEGRITY_ERROR + "LTP blob integrity error", // SGX_EVENT_LTP_BLOB_INTEGRITY_ERROR + "LTP blob invalid error", //SGX_EVENT_LTP_BLOB_INVALID_ERROR + "PCH EPID SigRL integrity error", // SGX_EVENT_EPID11_SIGRL_INTEGRITY_ERROR + "PCH EPID PrivRL integrity error", // SGX_EVENT_EPID11_PRIVRL_INTEGRITY_ERROR + "SGX EPID SigRL integrity error", // SGX_EVENT_EPID20_SIGRL_INTEGRITY_ERROR + "PCH EPID RL retrieval failure", // SGX_EVENT_EPID11_RL_RETRIEVAL_FAILURE + "Integrity error during SGX EPID provisioning", // SGX_EVENT_EPID_PROV_INTEGRITY_ERROR + "Integrity error during PSE certificate provisioning", + // SGX_EVENT_PSE_CERT_PROV_INTEGRITY_ERROR + "OCSP response error", // SGX_EVENT_OCSP_RESPONSE_ERROR //based on non-crypto checks that AESM does + "DAL SIGMA error", // SGX_EVENT_DAL_SIGMA_ERROR //DAL returns error during Sigma protocol + "LTP failure", // SGX_EVENT_LTP_FAILURE //other than above + "DAL not installed or broken installation", // SGX_EVENT_DAL_NOT_AVAILABLE_ERROR //other than above + "PCH EPID group certificate provisioning error", + // SGX_EVENT_EPID11_GROUP_CERT_PROV_ERROR + "PSE certificate provisioning failure (Server Protocol Response %d)", + // SGX_EVENT_PSE_CERT_PROV_PROTOCOL_RESPONSE_FAILURE //backend server protocol + "PSE certificate provisioning failure (Server General Response %d)", + // SGX_EVENT_PSE_CERT_PROV_GENERAL_RESPONSE_FAILURE //backend server status + "PCH EPID signature revoked", // SGX_EVENT_ME_EPID_SIG_REVOCATION, + "PCH EPID key revoked", // SGX_EVENT_ME_EPID_KEY_REVOCATION, + "SIGMA S2 integrity error", // SGX_EVENT_SIGMA_S2_INTEGRITY_ERROR + "DAL service layer error", // SGX_EVENT_DAL_SERVICE_ERROR + "PSE attestation error" // SGX_EVENT_PSE_ATTESTATION_ERROR + +}; diff --git a/psw/ae/aesm_service/source/aesm/application/event_strings.h b/psw/ae/aesm_service/source/aesm/application/event_strings.h new file mode 100644 index 0000000000..e19c851544 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/event_strings.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _EVENT_STRINGS_H_ +#define _EVENT_STRINGS_H_ +typedef enum { + SGX_EVENT_EPID_PROV_FAILURE, /*network*/ + SGX_EVENT_EPID_BLOB_PERSISTENT_STROAGE_FAILURE, + SGX_EVENT_PID_SIGNATURE_FAILURE, + SGX_EVENT_PSE_CERT_PROV_FAILURE, + SGX_EVENT_OCSP_FAILURE, + SGX_EVENT_DAL_COMM_FAILURE, /*communication*/ + SGX_EVENT_DISABLED, + SGX_EVENT_SERVICE_UNAVAILABLE, + SGX_EVENT_AESM_EXIT, + SGX_EVENT_PSE_CERT_REVOCATION, + SGX_EVENT_ME_EPID_GROUP_REVOCATION, + SGX_EVENT_EPID_REVOCATION, /*SigRL fail*/ + SGX_EVENT_EPID_INTEGRITY_ERROR, + SGX_EVENT_LTP_BLOB_INTEGRITY_ERROR, + SGX_EVENT_LTP_BLOB_INVALID_ERROR, + SGX_EVENT_EPID11_SIGRL_INTEGRITY_ERROR, + SGX_EVENT_EPID11_PRIVRL_INTEGRITY_ERROR, + SGX_EVENT_EPID20_SIGRL_INTEGRITY_ERROR, + SGX_EVENT_EPID11_RL_RETRIEVAL_FAILURE, + SGX_EVENT_EPID_PROV_INTEGRITY_ERROR, + SGX_EVENT_PSE_CERT_PROV_INTEGRITY_ERROR, + SGX_EVENT_OCSP_RESPONSE_ERROR, /*based on non-crypto checks that AESM does*/ + SGX_EVENT_DAL_SIGMA_ERROR, /*DAL returns error during Sigma protocol*/ + SGX_EVENT_LTP_FAILURE, /*other than above*/ + SGX_EVENT_DAL_NOT_AVAILABLE_ERROR, + SGX_EVENT_EPID11_GROUP_CERT_PROV_ERROR, + SGX_EVENT_PSE_CERT_PROV_PROTOCOL_RESPONSE_FAILURE, + SGX_EVENT_PSE_CERT_PROV_GENERAL_RESPONSE_FAILURE, + SGX_EVENT_ME_EPID_SIG_REVOCATION, + SGX_EVENT_ME_EPID_KEY_REVOCATION, + SGX_EVENT_SIGMA_S2_INTEGRITY_ERROR, + SGX_EVENT_DAL_SERVICE_ERROR, + SGX_EVENT_PSE_ATTESTATION_ERROR +}sgx_event_string_table_t; + +extern const char* g_event_string_table[]; +#endif + diff --git a/psw/ae/aesm_service/source/aesm/application/main.cpp b/psw/ae/aesm_service/source/aesm/application/main.cpp new file mode 100644 index 0000000000..459bce923e --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/main.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +static bool curl_initialized; +bool is_curl_initialized_succ() +{ + return curl_initialized; +} + +static CAESMServer* server = NULL; +volatile bool reload = false; + +void signal_handler(int sig) +{ + switch(sig) + { + case SIGTERM: + if (server) + { + reload = false; + server->shutDown(); + } + break; + case SIGHUP: + if (server) + { + reload = true; + server->shutDown(); + } + break; + default: + break; + } +} + +int main() { + if(daemon(0, 0) < 0) + { + AESM_LOG_INIT(); + AESM_LOG_FATAL("Fail to set daemon."); + AESM_LOG_FINI(); + exit(1); + } + CURLcode curl_code = curl_global_init(CURL_GLOBAL_DEFAULT); + if(curl_code!=CURLE_OK){ + curl_initialized = false; + }else{ + curl_initialized = true; + } + signal(SIGCHLD, SIG_IGN); + signal(SIGHUP, signal_handler); + //ignore SIGPIPE, socket is unexpectedly closed by client + signal(SIGPIPE, SIG_IGN); + signal(SIGTERM, signal_handler); + try{ + do{ + reload = false; + AESMLogicWrapper* aesmLogic = new AESMLogicWrapper(); + if(aesmLogic->service_start()!=AE_SUCCESS){ + AESM_LOG_ERROR("Fail to start service."); + delete aesmLogic; + exit(1); + } + UnixServerSocket* serverSock = new UnixServerSocket(CONFIG_SOCKET_PATH); + + CSelector* selector = new CSelector(serverSock); + server = new CAESMServer(serverSock, selector, aesmLogic); + + AESM_LOG_WARN("The server sock is %#lx" ,serverSock); + + server->init(); + server->doWork(); + CAESMServer* temp_server = server; + server = NULL; + delete temp_server; + }while(reload == true); + } + catch(char const* error_msg) + { + AESM_LOG_FATAL("%s", error_msg); + } + + + return 0; +} diff --git a/psw/ae/aesm_service/source/aesm/application/prof_fun.h b/psw/ae/aesm_service/source/aesm/application/prof_fun.h new file mode 100644 index 0000000000..c4c6d2876b --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/application/prof_fun.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PROFILE_FUN_H_ +#define _PROFILE_FUN_H_ +#include "sgx_profile.h" +#include "oal/oal.h" + +#ifdef _PROFILE_ +class AESMProfileUtil{ + const char *tag; +public: + AESMProfileUtil(const char *ttag){ + this->tag = ttag; + PROFILE_START(ttag); + } + ~AESMProfileUtil(){ + PROFILE_END(tag); + } + static void output(){ + char filename[MAX_PATH]; + if(aesm_get_cpathname(FT_PERSISTENT_STORAGE, AESM_PERF_DATA_FID, filename, MAX_PATH)==AE_SUCCESS){ + PROFILE_OUTPUT(filename); + } + } +}; +#define AESM_PROFILE_FUN AESMProfileUtil __aesm_profile_util_##__LINE__(__PRETTY_FUNCTION__) /*Gcc in Linux does not support concatenation of __FUNCTION__, is it a compiler bug?*/ +#define AESM_PROFILE_INIT PROFILE_INIT() +#define AESM_PROFILE_OUTPUT AESMProfileUtil::output() +#else +#define AESM_PROFILE_FUN +#define AESM_PROFILE_INIT +#define AESM_PROFILE_OUTPUT +#endif + +#endif/*_AESM_PROFILE_H_*/ diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp new file mode 100644 index 0000000000..92832a0469 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "sgx_memset_s.h" +#include "sgx_tcrypto.h" +#include "aeerror.h" +#include "tlv_common.h" +#include "cipher.h" + +ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek) +{ + uint8_t result = SGX_EC_INVALID_SIGNATURE; + sgx_status_t sgx_code = check_pek_signature(signed_pek, &result); + if(sgx_code == SGX_ERROR_OUT_OF_MEMORY) + return AE_OUT_OF_MEMORY_ERROR; + else if(sgx_code != SGX_SUCCESS) + return AE_FAILURE; //unknown error code + else if(result != SGX_EC_VALID)//sgx_code is SGX_SUCCESS + return PVE_MSG_ERROR; //signature verification failed + else + return AE_SUCCESS;//PEK Singatue verified successfully +} + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp new file mode 100644 index 0000000000..bebc4a7e95 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "aesm_encode.h" +#include "se_memcpy.h" +#include "AEClass.h" +#include "PVEClass.h" +#include "tlv_common.h" +#include +#include +#include +#include +#include + +/** +* Method converts byte containing value from 0x00-0x0F into its corresponding ASCII code, +* e.g. converts 0x00 to '0', 0x0A to 'A'. +* Note: This is mainly a helper method for internal use in byte_array_to_hex_string(). +* +* @param in byte to be converted (allowed values: 0x00-0x0F) +* +* @return ASCII code representation of the byte or 0 if method failed (e.g input value was not in provided range). +*/ +static uint8_t convert_value_to_ascii(uint8_t in) +{ + if(in <= 0x09) + { + return (uint8_t)(in + '0'); + } + else if(in <= 0x0F) + { + return (uint8_t)(in - 10 + 'A'); + } + + return 0; +} + +/** +* Method converts char containing ASCII code into its corresponding value, +* e.g. converts '0' to 0x00, 'A' to 0x0A. +* +* @param in char containing ASCII code (allowed values: '0-9', 'a-f', 'A-F') +* @param val output parameter containing converted value, if method suceeds. +* +* @return true if conversion succeeds, false otherwise +*/ +static bool convert_ascii_to_value(uint8_t in, uint8_t& val) +{ + if(in >= '0' && in <= '9') + { + val = static_cast(in - '0'); + } + else if(in >= 'A' && in <= 'F') + { + val = static_cast(in - 'A'+10); + } + else if(in >= 'a' && in <= 'f') + { + val = static_cast(in - 'a'+10); + } + else + { + return false; + } + + return true; +} + +//Function to do HEX encoding of array of bytes +//@param in_buf, bytes array whose length is in_size +// out_buf, output the HEX encoding of in_buf on success. +//@return true on success and false on error +//The out_size must always be 2*in_size since each byte into encoded by 2 characters +static bool byte_array_to_hex_string(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) +{ + if(in_buf==NULL||out_buf==NULL|| out_size!=in_size*2 )return false; + + for(uint32_t i=0; i< in_size; i++) + { + *out_buf++ = convert_value_to_ascii( static_cast(*in_buf >> 4)); + *out_buf++ = convert_value_to_ascii( static_cast(*in_buf & 0xf)); + in_buf++; + } + return true; +} + +//Function to do HEX decoding +//@param in_buf, character strings which are HEX encoding of a byte array +// out_buf, output the decode byte array on success +//@return true on success and false on error +//The in_size must be even number and equals 2*out_size +static bool hex_string_to_byte_array(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) +{ + if(in_buf==NULL||out_buf==NULL||out_size*2!=in_size)return false; + + for(uint32_t i=0;i(value_second+ (value_first<<4)); + } + return true; +} + +//Function to use openssl to do BASE64 encoding +static bool base_64_encode(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t *out_size) +{ + BIO* bioMem = NULL; + bool ret = false; + BIO *bio64 = NULL; + BIO_METHOD *bm = BIO_f_base64(); + if(bm == NULL) + goto ret_point; + bio64 = BIO_new(bm); + if(bio64 == NULL) + goto ret_point; + BIO_set_flags(bio64, BIO_FLAGS_BASE64_NO_NL); + bm = BIO_s_mem(); + if(bm == NULL) + goto ret_point; + bioMem = BIO_new(bm); + if(bioMem == NULL) + goto ret_point; + (void)BIO_push(bio64, bioMem); + + if(BIO_write(bio64, in_buf, in_size) != (int)in_size){ + goto ret_point; + } + (void)BIO_flush(bio64); + + BUF_MEM *bptr; + BIO_get_mem_ptr(bio64, &bptr); + if(bptr==NULL){ + goto ret_point; + } + if(*out_size < bptr->length){ + goto ret_point; + } + if(memcpy_s(out_buf, *out_size,bptr->data, bptr->length)!=0) + goto ret_point; + + *out_size = static_cast(bptr->length); + ret = true; +ret_point: + BIO_free_all(bio64);//we need not free bioMem too because the free_all has free it. + return ret; +} + +//Function to use openssl to do BASE64 decoding +static bool base_64_decode(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t *out_size) +{ + BIO *b64 =NULL, *bmem = NULL; + bool ret = false; + int read=0; + memset(out_buf, 0, *out_size); + BIO_METHOD *bm = BIO_f_base64(); + if(bm == NULL) + goto ret_point; + b64 = BIO_new(bm); + if(b64 == NULL) + goto ret_point; + BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); + bmem = BIO_new_mem_buf(const_cast(in_buf), in_size); + if(bmem == NULL){ + goto ret_point; + } + bmem = BIO_push(b64, bmem); + read = BIO_read(bmem, out_buf, *out_size); + if(read < 0) + goto ret_point; + *out_size = read; + ret = true; +ret_point: + BIO_free_all(bmem); + return ret; +} + +//Function to give an upbound of size of data after BASE64 decoding +//@param length: the length in bytes of BASE64 encoded data +//@return an upbound of length in bytes of decoded data +static uint32_t get_unbase_64_length(uint32_t length) +{ + return (length * 3 / 4) + ((length * 3 % 4 > 0) ? 1 : 0 ); +} + +//Function to give an upbound of size of data after BASR64 encoding +//@param length: the length in bytes of data to be encoded +//@return an upbound of length in bytes of data after encoding +static uint32_t get_base_64_length_upbound(uint32_t length) +{ + uint32_t extra = (length+9)/10+50;//using enough extra memory + return extra+(length*4+2)/3; +} + +uint32_t get_request_encoding_length(const uint8_t *req) +{ + //adding 1 extra byte to hold '\0' + return static_cast(2*PROVISION_REQUEST_HEADER_SIZE+get_base_64_length_upbound(GET_BODY_SIZE_FROM_PROVISION_REQUEST(req))+1); +} + +uint32_t get_response_decoding_length(uint32_t buf_len) +{ + if(buf_len<2*PROVISION_RESPONSE_HEADER_SIZE) + return 0; + return static_cast(get_unbase_64_length(buf_len-2*static_cast(PROVISION_RESPONSE_HEADER_SIZE)) + PROVISION_RESPONSE_HEADER_SIZE); +} + +bool encode_request(const uint8_t *req, uint32_t req_len, uint8_t *out_buf, uint32_t *out_len) +{ + uint32_t encoded_header_size = static_cast(2*PROVISION_REQUEST_HEADER_SIZE); + if(*out_len(2*PROVISION_RESPONSE_HEADER_SIZE), resp, static_cast(PROVISION_RESPONSE_HEADER_SIZE))) + return false; + if(*out_len(PROVISION_RESPONSE_HEADER_SIZE); + if(!base_64_decode(input_buf+static_cast(2*PROVISION_RESPONSE_HEADER_SIZE), input_len - static_cast(2*PROVISION_RESPONSE_HEADER_SIZE), + resp+static_cast(PROVISION_RESPONSE_HEADER_SIZE), out_len)) + return false; + *out_len += static_cast(PROVISION_RESPONSE_HEADER_SIZE); + if(*out_len != GET_SIZE_FROM_PROVISION_RESPONSE(resp)) + return false; + return true; +} diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h new file mode 100644 index 0000000000..3b35f281e0 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_ENCODE_H_ +#define _AESM_ENCODE_H_ +#include "sgx_urts.h" +#include "se_thread.h" +#ifdef __cplusplus +extern "C"{ +#endif + +uint32_t certPseSvn(); + +/*Function to provide an upbound of buffer size of encoded message for an input request + *@param req, the header for the input request such as ProvMsg1 or ProvMsg3 + *@return an upbound of the required buffer size for the encoded message + */ +uint32_t get_request_encoding_length(const uint8_t *req); + +/*Function to provide an upbound of the response body size given the length of encoded response message + *@param buf_len, the length of the encoded message for an response message + *@return an upbound of the length in bytes of decoded response message body such as ProvMsg2 or ProvMsg4 + */ +uint32_t get_response_decoding_length(uint32_t buf_len); + +/*Function to encode an request message so that we could send it to Provisioning server + *@param req, pointer to the request + *@param out_buf, pointer to a buffer to receive the encoded request message + *@param out_len, *out_len to pass in the buffer len and return the encoded message length when successful + *@return true if successful and false if there's any error. No error code provided + */ +bool encode_request(const uint8_t *req, uint32_t req_len, uint8_t *out_buf, uint32_t *out_len); + +/*Function to decode an response message from Provisioning Server + *@param input_buf, pointer to the encoded response message + *@param input_len, length in bytes of the encoded response message + *@param resp, pointer to a bufer to recieve the decoded message + *@param out_len, *out_len to pass in the buffer len and return the decoded response message + *@return true if successful and false if there's any error. No error code provided + */ +bool decode_response(const uint8_t *input_buf, uint32_t input_len, uint8_t *resp, uint32_t *out_len); +#ifdef __cplusplus +}; +#endif/*__cplusplus*/ +#endif/*_AESM_ENCOCE_H_*/ + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp new file mode 100644 index 0000000000..cbfa1cd6fa --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "aesm_epid_blob.h" +#include "internal/se_memcpy.h" +#include "oal/oal.h" +#include "byte_order.h" + + +ae_error_t EPIDBlob::read(epid_blob_with_cur_psvn_t& blob) +{ + ae_error_t ae_ret = AE_FAILURE; + if(status == not_initialized){ + uint32_t data_size = sizeof(blob_cache); + if((ae_ret=aesm_read_data(FT_PERSISTENT_STORAGE, EPID_DATA_BLOB_FID, reinterpret_cast(&blob_cache), &data_size))!=AE_SUCCESS){ + goto CLEANUP_READ_FILE; + } + + if( data_size != sizeof(blob_cache) ) + { + ae_ret = QE_EPIDBLOB_ERROR; + goto CLEANUP_READ_FILE; + } + status = update_to_date; +CLEANUP_READ_FILE: + if(status!=update_to_date) + status = not_available;//epid blob lost + } + + if(status == update_to_date){ + if(memcpy_s(&blob, sizeof(blob), &blob_cache, sizeof(blob_cache))!=0){ + status = not_available; //invalid + ae_ret = AE_FAILURE; + }else{ + ae_ret = AE_SUCCESS; + } + } + return ae_ret; +} + +ae_error_t EPIDBlob::write(const epid_blob_with_cur_psvn_t& blob) +{ + ae_error_t ae_ret = AE_FAILURE; + status = not_available; + if((ae_ret = aesm_write_data(FT_PERSISTENT_STORAGE, EPID_DATA_BLOB_FID,reinterpret_cast(&blob), sizeof(blob)))!=AE_SUCCESS) + { + AESM_DBG_WARN("fail to write epid blob to persistent storage:%d",ae_ret); + AESM_LOG_WARN("%s",g_event_string_table[SGX_EVENT_EPID_BLOB_PERSISTENT_STROAGE_FAILURE]); + // continue to update cache + } + if(memcpy_s(&blob_cache, sizeof(blob_cache), &blob, sizeof(blob))!=0){ + status = not_available; //invalid status + ae_ret = AE_FAILURE; + }else{ + status = update_to_date; + ae_ret = AE_SUCCESS; + } + return ae_ret; +} + +// +// get_sgx_gid +// +// get sgx gid from epid blob, specifically from stored group cert in epid blob +// +// inputs +// +// pgid: pointer to gid +// +// outputs +// +// *pgid: gid +// status +// +ae_error_t EPIDBlob::get_sgx_gid(uint32_t* pgid) +{ + ae_error_t aesm_result = AE_SUCCESS; + epid_blob_with_cur_psvn_t epid_blob; + sgx_sealed_data_t *sealed_epid = reinterpret_cast(epid_blob.trusted_epid_blob); + + if (NULL != pgid) { + // + // get the epid blob + // + aesm_result = this->read(epid_blob); + if (AE_SUCCESS == aesm_result) { + // + // get the gid + // + uint32_t plain_text_offset = sealed_epid->plain_text_offset; + se_plaintext_epid_data_t* plain_text = reinterpret_cast(epid_blob.trusted_epid_blob + sizeof(sgx_sealed_data_t) + plain_text_offset); + if(memcpy_s(pgid, sizeof(*pgid), &plain_text->epid_group_cert.gid, sizeof(plain_text->epid_group_cert.gid))) //read gid from EPID Data blob + { + AESM_DBG_ERROR("memcpy_s failed"); + aesm_result = AE_FAILURE; + } + // + // return little-endian + // + *pgid = _htonl(*pgid); + AESM_DBG_TRACE(": get gid %d from epid blob", *pgid); + } + } + else { + aesm_result = AE_INVALID_PARAMETER; + } + + return aesm_result; + +} diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h new file mode 100644 index 0000000000..16b49e20d6 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_EPID_BLOB_H_ +#define _AESM_EPID_BLOB_H_ +/*File to declare class for EPIDBlob*/ +#include "se_types.h" +#include "sgx_tseal.h" +#include "oal/oal.h" +#include "AEClass.h" +#include "epid_pve_type.h" +#include "assert.h" +#include "aeerror.h" +#include "se_thread.h" +#include "provision_msg.h" +#include "internal/se_rwlock.h" + +typedef struct _epid_blob_with_cur_psvn_t{ + uint8_t trusted_epid_blob[HARD_CODED_EPID_BLOB_SIZE]; + psvn_t cur_psvn; +}epid_blob_with_cur_psvn_t; + +#define SGX_EPID_BLOB_SIZE sizeof(epid_blob_with_cur_psvn_t) + +class EPIDBlob: public Singleton{ + CLASS_UNCOPYABLE(EPIDBlob) + epid_blob_with_cur_psvn_t blob_cache; + friend class Singleton; + enum EPIDBlobStatus {not_initialized=0, update_to_date=1, not_available=2} status; + EPIDBlob(){memset(&blob_cache, 0 ,sizeof(blob_cache));status = not_initialized;} +public: + ae_error_t read(epid_blob_with_cur_psvn_t& blob); + ae_error_t write(const epid_blob_with_cur_psvn_t& blob); + ae_error_t get_sgx_gid(uint32_t* pgid);/*get little endian gid from epid data blob*/ +}; +#endif/*_AESM_EPID_BLOB_H_*/ + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp new file mode 100644 index 0000000000..0f7ffbc682 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "aesm_encode.h" +#include "oal.h" +#include "se_wrapper.h" +#include "prof_fun.h" +#include "aesm_proxy_type.h" +#include "endpoint_select_info.h" +#include "util.h" + +#include +#ifndef INTERNET_DEFAULT_HTTP_PORT +#define INTERNET_DEFAULT_HTTP_PORT 80 +#endif + +#define AESM_DEFAULT_CONN_TIME_OUT 1000 +#define AESM_DEFAULT_TIME_OUT 10000 + +bool is_curl_initialized_succ(void);//network is available only when curl library is successfully initialized + +typedef struct _network_malloc_info_t{ + char *base; + uint32_t size; +}network_malloc_info_t; + +static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) +{ + network_malloc_info_t* s=reinterpret_cast(stream); + uint32_t start=0; + if(s->base==NULL){ + s->base = reinterpret_cast(malloc(size*nmemb)); + s->size = static_cast(size*nmemb); + if(s->base==NULL){ + AESM_DBG_ERROR("malloc error in write callback fun"); + return 0; + } + }else{ + uint32_t newsize = s->size+static_cast(size*nmemb); + char *p=reinterpret_cast(malloc(newsize)); + if(p == NULL){ + free(s->base); + s->base = NULL; + AESM_DBG_ERROR("malloc error in write callback fun"); + return 0; + } + memcpy(p, s->base, s->size); + free(s->base); + start = s->size; + s->base = p; + s->size = newsize; + } + memcpy(s->base +start, ptr, size*nmemb); + return nmemb; +} + +static ae_error_t http_network_init(CURL **curl, const char *url, bool is_ocsp) +{ + CURLcode cc = CURLE_OK; + UNUSED(is_ocsp); + AESM_DBG_TRACE("http init for url %s",url); + if(!is_curl_initialized_succ()){ + AESM_DBG_ERROR("libcurl not initialized"); + return AE_FAILURE;//fatal error that libcurl could not be initialized + } + std::string url_path = url; + uint32_t proxy_type; + char proxy_url[MAX_PATH]; + EndpointSelectionInfo::instance().get_proxy(proxy_type, proxy_url); + + *curl = curl_easy_init(); + if(!*curl){ + AESM_DBG_ERROR("fail to init curl handle"); + return AE_FAILURE; + } + if((cc=curl_easy_setopt(*curl, CURLOPT_URL, url_path.c_str()))!=CURLE_OK){ + AESM_DBG_ERROR("fail error code %d in set url %s",(int)cc, url_path.c_str()); + return AE_FAILURE; + } + (void)curl_easy_setopt(*curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + //setting proxy now + if(proxy_type == AESM_PROXY_TYPE_DIRECT_ACCESS){ + AESM_DBG_TRACE("use no proxy"); + (void)curl_easy_setopt(*curl, CURLOPT_NOPROXY , "*"); + }else if(proxy_type == AESM_PROXY_TYPE_MANUAL_PROXY){ + AESM_DBG_TRACE("use manual proxy %s",proxy_url); + (void)curl_easy_setopt(*curl, CURLOPT_PROXY, proxy_url); + } + return AE_SUCCESS; +} + +static ae_error_t http_network_send_data(CURL *curl, const char *req_msg, uint32_t msg_size, char **resp_msg, uint32_t& resp_size, http_methods_t method, bool is_ocsp) +{ + AESM_DBG_TRACE("send data method=%d",method); + struct curl_slist *headers=NULL; + CURLcode cc=CURLE_OK; + if(is_ocsp){ + headers = curl_slist_append(headers, "Accept: application/ocsp-response"); + if(headers==NULL){ + AESM_DBG_ERROR("fail in add accept ocsp-response header"); + return AE_FAILURE; + } + headers = curl_slist_append(headers, "Content-Type: application/ocsp-request"); + if(headers == NULL){ + AESM_DBG_ERROR("fail in add content type ocsp-request"); + return AE_FAILURE; + } + AESM_DBG_TRACE("ocsp request"); + } + char buf[50]; + sprintf(buf, "Content-Length: %u", (unsigned int)msg_size); + headers = curl_slist_append(headers, buf); + if(headers == NULL){ + AESM_DBG_ERROR("fail to add content-length header"); + return AE_FAILURE; + } + if((cc=curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers))!=CURLE_OK){ + AESM_DBG_ERROR("fail to set http header:%d",(int)cc); + return AE_FAILURE; + } + if(method == POST){ + if((cc=curl_easy_setopt(curl, CURLOPT_POSTFIELDS, req_msg))!=CURLE_OK){ + AESM_DBG_ERROR("fail to set POST fields:%d",(int)cc); + return AE_FAILURE; + } + if((cc=curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, msg_size))!=CURLE_OK){ + AESM_DBG_ERROR("fail to set POST fields size:%d",(int)cc); + return AE_FAILURE; + } + } + if((cc=curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback))!=CURLE_OK){ + AESM_DBG_ERROR("Fail to set callback function:%d",(int)cc); + return AE_FAILURE; + } + + network_malloc_info_t malloc_info; + malloc_info.base=NULL; + malloc_info.size = 0; + if((cc=curl_easy_setopt(curl, CURLOPT_WRITEDATA, reinterpret_cast(&malloc_info)))!=CURLE_OK){ + AESM_DBG_ERROR("fail to set write back function parameter:%d",(int)cc); + return AE_FAILURE; + } + if((cc=curl_easy_perform(curl))!=CURLE_OK){ + if(malloc_info.base){ + free(malloc_info.base); + } + AESM_DBG_ERROR("fail in connect:%d",(int)cc); + return OAL_NETWORK_UNAVAILABLE_ERROR; + } + *resp_msg = malloc_info.base; + resp_size = malloc_info.size; + AESM_DBG_TRACE("get response size=%d",resp_size); + return AE_SUCCESS; +} + +static void http_network_fini(CURL *curl) +{ + if(curl!=NULL) + curl_easy_cleanup(curl); +} + + +ae_error_t aesm_network_send_receive(const char *server_url, const uint8_t *req, uint32_t req_size, + uint8_t **p_resp, uint32_t *p_resp_size, http_methods_t method, bool is_ocsp) +{ + AESM_PROFILE_FUN; + ae_error_t ret= AE_SUCCESS; + CURL *curl = NULL; + ret = http_network_init(&curl, server_url, is_ocsp); + if(ret != AE_SUCCESS){ + goto ret_point; + } + ret = http_network_send_data(curl, reinterpret_cast(req), req_size, + reinterpret_cast(p_resp), *p_resp_size, method, is_ocsp); +ret_point: + http_network_fini(curl); + return ret; +} + +void aesm_free_network_response_buffer(uint8_t *resp) +{ + if(resp!=NULL)free(resp); +} diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp new file mode 100644 index 0000000000..1395c8438d --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp @@ -0,0 +1,510 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "aesm_long_lived_thread.h" +#include "pve_logic.h" +#include "platform_info_logic.h" +#include "oal/internal_log.h" +#include "se_time.h" +#include "se_wrapper.h" +#include +#include +#include + +enum _thread_state +{ + ths_idle, + ths_busy, + ths_stop//The thread is to be stopped and no new job will be accepted +}; + +enum _io_cache_state +{ + ioc_idle, //thread has been finished + ioc_busy, //thread not finished yet + ioc_stop //thread stop required +}; + +#define MAX_OUTPUT_CACHE 50 +class ThreadStatus; +class BaseThreadIOCache; +typedef ae_error_t (*long_lived_thread_func_t)(BaseThreadIOCache *cache); + +//Base class for cached data of each thread to fork +class BaseThreadIOCache:private Uncopyable{ + time_t timeout; //The data will timeout after the time if the state is not busy + int ref_count; //ref_count is used to track how many threads are currently referencing the data + _io_cache_state status; + //handle of the thread, some thread will be waited by other threads so that we could not + // free the handle until all other threads have got notification that the thread is terminated + aesm_thread_t thread_handle; + friend class ThreadStatus; +protected: + ae_error_t ae_ret; + BaseThreadIOCache():ref_count(0),status(ioc_busy){ + timeout=0; + thread_handle=NULL; + ae_ret = AE_FAILURE; + } + virtual ThreadStatus& get_thread()=0; +public: + virtual ae_error_t entry(void)=0; + virtual bool operator==(const BaseThreadIOCache& oc)const=0; + ae_error_t start(BaseThreadIOCache *&out_ioc, uint32_t timeout=THREAD_TIMEOUT); + void deref(void); + void set_status_finish(); +public: + virtual ~BaseThreadIOCache(){} +}; + +class ThreadStatus: private Uncopyable +{ +private: + AESMLogicMutex thread_mutex; + _thread_state thread_state; + uint64_t status_clock; + BaseThreadIOCache *cur_iocache; + std::listoutput_cache; +protected: + friend class BaseThreadIOCache; + //function to look up cached output, there will be no real thread associated with the input ioc + //If a match is found the input parameter will be free automatically and the matched value is returned + //return true if a thread will be forked for the out_ioc + bool find_or_insert_iocache(BaseThreadIOCache* ioc, BaseThreadIOCache *&out_ioc) + { + AESMLogicLock locker(thread_mutex); + std::list::reverse_iterator it; + out_ioc=NULL; + if(thread_state == ths_stop){ + AESM_DBG_TRACE("thread %p has been stopped and ioc %p not inserted", this,ioc); + delete ioc; + return false;//never visit any item after thread is stopped + } + time_t cur=time(NULL); + AESM_DBG_TRACE("cache size %d",(int)output_cache.size()); + BaseThreadIOCache *remove_candidate = NULL; + for(it=output_cache.rbegin();it!=output_cache.rend();++it){//visit the cache in reverse order so that the newest item will be visited firstly + BaseThreadIOCache *pioc=*it; + if((pioc->status==ioc_idle)&&(pioc->timeoutref_count==0&&remove_candidate==NULL){ + remove_candidate = pioc; + } + continue;//value timeout + } + if(*pioc==*ioc){//matched value find + pioc->ref_count++;//reference it + AESM_DBG_TRACE("IOC %p matching input IOC %p (ref_count:%d,status:%d,timeout:%d) in thread %p",pioc, ioc,(int)pioc->ref_count,(int)pioc->status, (int)pioc->timeout, this); + out_ioc= pioc; + delete ioc; + return false; + } + } + if(thread_state == ths_busy){//It is not permitted to insert in busy status + AESM_DBG_TRACE("thread busy when trying insert input ioc %p",ioc); + delete ioc; + return false; + } + if(remove_candidate!=NULL){ + output_cache.remove(remove_candidate); + delete remove_candidate; + } + if(output_cache.size()>=MAX_OUTPUT_CACHE){ + std::list::iterator fit; + bool erased=false; + for(fit = output_cache.begin(); fit!=output_cache.end();++fit){ + BaseThreadIOCache *pioc=*fit; + if(pioc->ref_count==0){//find a not timeout item to remove + assert(pioc->status==ioc_idle); + AESM_DBG_TRACE("erase idle ioc %p", pioc); + output_cache.erase(fit); + erased = true; + AESM_DBG_TRACE("thread %p cache size %d",this, output_cache.size()); + delete pioc; + break; + } + } + if(!erased){//no item could be removed + AESM_DBG_TRACE("no free ioc found and cannot insert ioc %p",ioc); + delete ioc; + return false;//similar as busy status + } + } + output_cache.push_back(ioc); + out_ioc = cur_iocache = ioc; + cur_iocache->ref_count=2;//initialize to be refenced by parent thread and the thread itself + thread_state = ths_busy;//mark thread to be busy that the thread to be started + AESM_DBG_TRACE("successfully add ioc %p (status=%d,timeout=%d) into thread %p",out_ioc, (int)out_ioc->status, (int)out_ioc->timeout, this); + return true; + } + +public: + ThreadStatus():output_cache() + { + thread_state = ths_idle; + status_clock = 0; + cur_iocache = NULL; + } + void set_status_finish(BaseThreadIOCache* ioc);//only called at the end of aesm_long_lived_thread_entry + void deref(BaseThreadIOCache* iocache); + ae_error_t wait_iocache(BaseThreadIOCache* ioc); + + //create thread and wait at most 'timeout' for the thread to be finished + // It will first look up whether there is a previous run with same input before starting the thread + // we should not delete ioc after calling to this function + ae_error_t set_thread_start(BaseThreadIOCache* ioc, BaseThreadIOCache *&out_ioc, uint32_t timeout=THREAD_TIMEOUT); + + void stop_thread();//We need wait for thread to be terminated and all thread_handle in list to be closed + + ~ThreadStatus(){stop_thread();}//ThreadStatus instance should be global object. Otherwise, it is possible that the object is destroyed before a thread waiting for and IOCache got notified and causing exception + + ae_error_t wait_for_cur_thread(void); + + //function to query whether current thread is idle, + //if it is idle, return true and reset clock to current clock value + bool query_status_and_reset_clock(void); +}; + +ae_error_t BaseThreadIOCache::start(BaseThreadIOCache *&out_ioc, uint32_t timeout_value) +{ + return get_thread().set_thread_start(this, out_ioc, timeout_value); +} + +void BaseThreadIOCache::deref(void) +{ + get_thread().deref(this); +} + +void BaseThreadIOCache::set_status_finish(void) +{ + get_thread().set_status_finish(this); +} + +//This is thread entry wrapper for all threads +static ae_error_t aesm_long_lived_thread_entry(aesm_thread_arg_type_t arg) +{ + BaseThreadIOCache *cache=(BaseThreadIOCache *)arg; + ae_error_t ae_err = cache->entry(); + cache->set_status_finish(); + return ae_err; +} + +void ThreadStatus::stop_thread() +{ + //change state to stop + thread_mutex.lock(); + thread_state = ths_stop; + + do{ + std::list::iterator it; + for(it=output_cache.begin(); it!=output_cache.end();++it){ + BaseThreadIOCache *p=*it; + if(p->status != ioc_stop){//It has not been processed + p->status = ioc_stop; + break; + } + } + if(it!=output_cache.end()){//found item to stop + BaseThreadIOCache *p=*it; + p->ref_count++; + thread_mutex.unlock(); + wait_iocache(p); + thread_mutex.lock(); + }else{ + break; + } + }while(1); + + thread_mutex.unlock(); + //This function should only be called at AESM exit + //Leave memory leak here is OK and all pointer to BaseThreadIOCache will not be released +} + +ae_error_t ThreadStatus::wait_for_cur_thread(void) +{ + BaseThreadIOCache *ioc=NULL; + thread_mutex.lock(); + if(cur_iocache!=NULL){ + ioc = cur_iocache; + ioc->ref_count++; + } + thread_mutex.unlock(); + if(ioc!=NULL){ + return wait_iocache(ioc); + } + return AE_SUCCESS; +} + +ae_error_t ThreadStatus::wait_iocache(BaseThreadIOCache* ioc) +{ + ae_error_t ae_ret=AE_SUCCESS; + bool need_wait=false; + aesm_thread_t handle=NULL; + thread_mutex.lock(); + if(ioc->thread_handle!=NULL){ + AESM_DBG_TRACE("wait for busy ioc %p(refcount=%d)",ioc,ioc->ref_count); + need_wait = true; + handle = ioc->thread_handle; + } + thread_mutex.unlock(); + if(need_wait){ + ae_ret= aesm_wait_thread(handle, &ae_ret, AESM_THREAD_INFINITE); + } + deref(ioc); + return ae_ret; +} + +void ThreadStatus::deref(BaseThreadIOCache *ioc) +{ + aesm_thread_t handle = NULL; + time_t cur=time(NULL); + { + AESMLogicLock locker(thread_mutex); + AESM_DBG_TRACE("deref ioc %p (ref_count=%d,status=%d,timeout=%d) of thread %p",ioc,(int)ioc->ref_count,(int)ioc->status,(int)ioc->timeout, this); + --ioc->ref_count; + if(ioc->ref_count == 0){//try free the thread handle now + handle = ioc->thread_handle; + ioc->thread_handle = NULL; + if(ioc->status == ioc_busy){ + ioc->status = ioc_idle; + } + AESM_DBG_TRACE("free thread handle for ioc %p",ioc); + } + if(ioc->ref_count==0 &&(ioc->status==ioc_stop||ioc->timeoutthread_handle); + if (ae_ret != AE_SUCCESS) + { + AESM_DBG_TRACE("fail to create thread for ioc %p",out_ioc); + AESMLogicLock locker(thread_mutex); + thread_state = ths_idle; + out_ioc->status = ioc_idle;//set to finished status + cur_iocache = NULL; + deref(out_ioc); + return ae_ret; + }else{ + AESM_DBG_TRACE("succ create thread %p for ioc %p",this, out_ioc); + } + } + + if(out_ioc == NULL){ + AESM_DBG_TRACE("no ioc created for input ioc %p in thread %p",ioc, this); + return OAL_THREAD_TIMEOUT_ERROR; + } + + {//check whether thread has been finished + AESMLogicLock locker(thread_mutex); + if(out_ioc->status!=ioc_busy){//job is done + AESM_DBG_TRACE("job done for ioc %p (status=%d,timeout=%d,ref_count=%d) in thread %p",out_ioc, (int)out_ioc->status,(int)out_ioc->timeout,(int)out_ioc->ref_count,this); + return AE_SUCCESS; + } + } + + if(timeout >= AESM_THREAD_INFINITE ){ + ae_ret = aesm_join_thread(out_ioc->thread_handle, &ret); + }else{ + uint64_t now = se_get_tick_count(); + double timediff = static_cast(timeout) - (static_cast(now - status_clock))/static_cast(se_get_tick_count_freq()) *1000; + if (timediff <= 0.0) { + AESM_DBG_ERROR("long flow thread timeout"); + return OAL_THREAD_TIMEOUT_ERROR; + } + else{ + AESM_DBG_TRACE("timeout:%u,timediff: %f", timeout,timediff); + ae_ret = aesm_wait_thread(out_ioc->thread_handle, &ret, (unsigned long)timediff); + } + } + AESM_DBG_TRACE("wait for ioc %p (status=%d,timeout=%d,ref_count=%d) result:%d",out_ioc,(int)out_ioc->status,(int)out_ioc->timeout,(int)out_ioc->ref_count, ae_ret); + return ae_ret; +}; + +#define TIMEOUT_SHORT_TIME 60 +#define TIMEOUT_FOR_A_WHILE (5*60) +#define TIMEOUT_LONG_TIME (3600*24) //at most once every day +static time_t get_timeout_via_ae_error(ae_error_t ae) +{ + time_t cur=time(NULL); + switch(ae){ + case AE_SUCCESS: + case OAL_PROXY_SETTING_ASSIST: + case OAL_NETWORK_RESEND_REQUIRED: + return cur-1;//always timeout, the error code will never be reused + case PVE_INTEGRITY_CHECK_ERROR: + case OAL_NETWORK_UNAVAILABLE_ERROR: + case OAL_NETWORK_BUSY: + case PVE_SERVER_BUSY_ERROR: + return cur+TIMEOUT_SHORT_TIME; //retry after short time + case QE_REVOKED_ERROR: + case PVE_REVOKED_ERROR: + case PVE_MSG_ERROR: + case PVE_PERFORMANCE_REKEY_NOT_SUPPORTED: + case PSW_UPDATED_REQUIRED: + return cur+TIMEOUT_LONG_TIME; + default: + return cur+TIMEOUT_FOR_A_WHILE;//not retry too quickly for unknown error + } +} + +void ThreadStatus::set_status_finish(BaseThreadIOCache* ioc) +{ + aesm_thread_t handle = NULL; + { + AESMLogicLock locker(thread_mutex); + assert(thread_state==ths_busy||thread_state==ths_stop); + assert(ioc->status == ioc_busy); + AESM_DBG_TRACE("set finish status for ioc %p(status=%d,timeout=%d,ref_count=%d) of thread %p",ioc, (int)ioc->status,(int)ioc->timeout,(int)ioc->ref_count,this); + if(thread_state==ths_busy){ + AESM_DBG_TRACE("set thread %p to idle", this); + thread_state=ths_idle; + cur_iocache = NULL; + } + ioc->status=ioc_idle; + ioc->ref_count--; + ioc->timeout = get_timeout_via_ae_error(ioc->ae_ret); + if(ioc->ref_count==0){//try free thread handle + handle = ioc->thread_handle; + ioc->thread_handle = NULL; + AESM_DBG_TRACE("thread handle release for ioc %p and status to idle of thread %p",ioc, this); + } + } + if(handle!=NULL){ + aesm_free_thread(handle); + } +} + +bool ThreadStatus::query_status_and_reset_clock(void) +{ + AESMLogicLock locker(thread_mutex); + if(thread_state == ths_busy || thread_state == ths_stop) + return false; + status_clock = se_get_tick_count(); + return true; +} + +//Code above implement logic of threads in the AESM Service +//Code below to define IOCache of each thread +static ThreadStatus epid_thread; + + +class EpidProvIOCache:public BaseThreadIOCache{ + bool performance_rekey;//input +protected: + EpidProvIOCache(bool perf_rekey){ + this->performance_rekey = perf_rekey; + } + virtual ae_error_t entry(void); + virtual ThreadStatus& get_thread(); + friend ae_error_t start_epid_provision_thread(bool performance_rekey, unsigned long timeout); +public: + virtual bool operator==(const BaseThreadIOCache& oc)const{ + const EpidProvIOCache *p=dynamic_cast(&oc); + if(p==NULL)return false; + return performance_rekey==p->performance_rekey;//only compare input + } +}; + + +ThreadStatus& EpidProvIOCache::get_thread() +{ + return epid_thread; +} + + +ae_error_t EpidProvIOCache::entry() +{ + return ae_ret = PvEAESMLogic::epid_provision_thread_func(performance_rekey); +} + + +//start implementation of external functions + +#define INIT_THREAD(cache_type, timeout, init_list) \ + BaseThreadIOCache *ioc = new cache_type init_list; \ + BaseThreadIOCache *out_ioc = NULL; \ + ae_error_t ae_ret = AE_FAILURE; \ + ae_ret = ioc->start(out_ioc, (uint32_t)(timeout)); \ + if(ae_ret != AE_SUCCESS){ \ + if(out_ioc!=NULL){out_ioc->deref();}\ + return ae_ret; \ + }\ + assert(out_ioc!=NULL);\ + cache_type *pioc = dynamic_cast(out_ioc);\ + assert(pioc!=NULL); + //now the thread has finished it's execution and we could read result without lock +#define COPY_OUTPUT(x) x=pioc->x +#define FINI_THREAD() \ + ae_ret = pioc->ae_ret;\ + pioc->deref();/*derefence the cache object after usage of it*/ \ + return ae_ret; + +//usage model +//INIT_THREAD(thread_used, cache_type, timeout, init_list) +// COPY_OUTPUT(is_new_pairing);// copy out output parameter except for return value from pioc object to output parameter, such as +//FINI_THREAD(thread_used) + +ae_error_t start_epid_provision_thread(bool performance_rekey, unsigned long timeout) +{ + INIT_THREAD(EpidProvIOCache, timeout, (performance_rekey)) + FINI_THREAD() +} + +bool query_pve_thread_status(void) +{ + return epid_thread.query_status_and_reset_clock(); +} + +ae_error_t wait_pve_thread(void) +{ + return epid_thread.wait_for_cur_thread(); +} + +void stop_all_long_lived_threads(void) +{ + epid_thread.stop_thread(); +} diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h new file mode 100644 index 0000000000..1685b80078 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_LONG_LIVED_THREAD_H_ +#define _AESM_LONG_LIVED_THREAD_H_ +#include "aesm_logic.h" + +extern ae_error_t start_epid_provision_thread(bool performance_rekey, unsigned long timeout=THREAD_TIMEOUT); +extern bool query_pve_thread_status(void);/*return true if idle and reset clock for thread*/ +extern ae_error_t wait_pve_thread(void); +extern void stop_all_long_lived_threads(void); +#endif + diff --git a/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp new file mode 100644 index 0000000000..0c0f8754cd --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp @@ -0,0 +1,290 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "endpoint_select_info.h" +#include "PVEClass.h" +#include "prov_msg_size.h" +#include "network_encoding_wrapper.h" +#include "ipp_wrapper.h" +#include "sgx_tcrypto.h" +#include "ippcp.h" +#include "ippcore.h" +#include "sgx_read_rand.h" +#include "se_wrapper.h" +#include + + +//Function to do basic checking of the endpoint selection blob. Esp to avoid no zero-ending in the input string url +static bool is_valid_endpoint_selection_info(const endpoint_selection_infos_t& es_info) +{ + if(es_info.aesm_data_type != AESM_DATA_ENDPOINT_SELECTION_INFOS) + return false; + if(es_info.aesm_data_version != AESM_DATA_ENDPOINT_SELECTION_VERSION) + return false; + if(strnlen(es_info.provision_url,MAX_PATH)>=MAX_PATH) + return false; + return true; +} + +ae_error_t EndpointSelectionInfo::read_pek(endpoint_selection_infos_t& es_info) +{ + ae_error_t ae_err=AE_SUCCESS; + uint32_t es_info_size = sizeof(es_info); + + ae_err = aesm_read_data(FT_PERSISTENT_STORAGE, PROVISION_PEK_BLOB_FID, reinterpret_cast(&es_info), &es_info_size); + + if(AE_SUCCESS == ae_err && (es_info_size != sizeof(es_info)||!is_valid_endpoint_selection_info(es_info))){ + AESM_DBG_ERROR("Invalid ES result in persistent storage:size %d, expected size %d", es_info_size, sizeof(es_info)); + ae_err = OAL_FILE_ACCESS_ERROR; + } + + if(AE_SUCCESS == ae_err){ + AESM_DBG_INFO("Read ES result from persistent storage successfully"); + }else{ + AESM_DBG_WARN("ES result in persistent storage failed to load:%d", ae_err); + } + + return ae_err; +} + +ae_error_t EndpointSelectionInfo::write_pek(const endpoint_selection_infos_t& es_info) +{ + return aesm_write_data(FT_PERSISTENT_STORAGE, PROVISION_PEK_BLOB_FID, reinterpret_cast(&es_info), sizeof(es_info)); +} + +static ae_error_t ipp_error_to_ae_error(IppStatus ipp_status) +{ + if(ipp_status == ippStsNoErr) return AE_SUCCESS; + else if(ipp_status == ippStsMemAllocErr|| + ipp_status == ippStsNoMemErr) return AE_OUT_OF_MEMORY_ERROR; + else return AE_FAILURE;//unknown or unexpected ipp error +} + +ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek); +IppStatus get_provision_server_rsa_pub_key_in_ipp_format(const signed_pek_t& pek, IppsRSAPublicKeyState **rsa_pub_key); + +//The function is to verify the PEK ECDSA Signature and RSA Signature for ES Msg2 +// When PvE uses PEK, it will re-check the ECDSA Signature +//The function will only be called after ES protocol is completed. But it will not be called when reading data back from persitent storage +//@param provision_ttl: The TTL field from ES Msg2 in little endian format +//@param rsa_signature: The RSA Signature in ES Msg2, it is RSA Signature to XID:TTL:provision_url +//@param xid: The transaction id (XID) of the ES Protocol +//@return AE_SUCCESS if signature verification success and passed +//@return PVE_MSG_ERROR if signature verification failed or message error +//other kinds of error code could be returned too due to corresponding error situation +ae_error_t EndpointSelectionInfo::verify_signature(const endpoint_selection_infos_t& es_info, uint8_t xid[XID_SIZE], uint8_t rsa_signature[PVE_RSA_KEY_BYTES], uint16_t provision_ttl) +{ + //Do signature verification here + ae_error_t ae_err = AE_SUCCESS; + IppsRSAPublicKeyState *rsa_pub_key = NULL; + Ipp8u *buffer = NULL; + int public_key_buffer_size = 0; + int vr = 0; + uint16_t ttl=_htons(provision_ttl); + IppStatus ipp_status = ippStsNoErr; + uint8_t msg_buf[XID_SIZE + sizeof(ttl) + MAX_PATH]; + uint32_t buf_size = 0; + + ae_err = aesm_check_pek_signature(es_info.pek); + if(AE_SUCCESS != ae_err){ + AESM_DBG_ERROR("PEK Signature verifcation not passed:%d",ae_err); + goto ret_point; + } + AESM_DBG_INFO("PEK signature verified successfully"); + buf_size = XID_SIZE +static_cast(sizeof(ttl) + strnlen_s(es_info.provision_url, MAX_PATH)); + if(0!=memcpy_s(msg_buf,sizeof(msg_buf), xid, XID_SIZE)|| + 0!=memcpy_s(msg_buf+XID_SIZE, sizeof(ttl) + MAX_PATH, &ttl, sizeof(ttl))|| + 0!=memcpy_s(msg_buf+XID_SIZE+sizeof(ttl), MAX_PATH, es_info.provision_url, buf_size-XID_SIZE-sizeof(ttl))){ + ae_err = AE_FAILURE; + AESM_DBG_ERROR("memcpy error"); + goto ret_point; + } + + ipp_status = get_provision_server_rsa_pub_key_in_ipp_format(es_info.pek, &rsa_pub_key); + if(ippStsNoErr != ipp_status){ + AESM_DBG_ERROR("Fail to load rsa public key from PEK:%d", ipp_status); + ae_err = ipp_error_to_ae_error(ipp_status); + goto ret_point; + } + ipp_status = ippsRSA_GetBufferSizePublicKey(&public_key_buffer_size, rsa_pub_key); + if(ippStsNoErr != ipp_status){ + AESM_DBG_ERROR("Fail to get rsa public key size:%s", ipp_status); + ae_err = ipp_error_to_ae_error(ipp_status); + goto ret_point; + } + buffer = (Ipp8u *)malloc(public_key_buffer_size); + if(NULL == buffer){ + AESM_DBG_ERROR("malloc error"); + ae_err = AE_OUT_OF_MEMORY_ERROR; + goto ret_point; + } + ipp_status = ippsRSAVerify_PKCS1v15(msg_buf, buf_size, rsa_signature, &vr, rsa_pub_key, ippHashAlg_SHA256, buffer); + if(ippStsNoErr != ipp_status){ + AESM_DBG_ERROR("Fail to verify rsa signature:%d", ipp_status); + ae_err = ipp_error_to_ae_error(ipp_status); + goto ret_point; + } + if(vr == 0){ + AESM_DBG_TRACE("rsa signature verification failed"); + ae_err = PVE_MSG_ERROR; + goto ret_point; + }else{ + AESM_DBG_TRACE("rsa signature verification passed"); + ae_err = AE_SUCCESS; + } +ret_point: + if(NULL != rsa_pub_key){ + secure_free_rsa_pub_key(PVE_RSA_KEY_BYTES, sizeof(uint32_t), rsa_pub_key); + } + if(NULL != buffer){ + free(buffer); + } + return ae_err; +} + +#define MAX_ENCLAVE_LOST_RETRY_TIME 1 + +bool read_aesm_config(aesm_config_infos_t& infos); + +//Function to implement the end point selection protocol +ae_error_t EndpointSelectionInfo::start_protocol(endpoint_selection_infos_t& es_info) +{ + AESMLogicLock lock(_es_lock); + uint32_t msg_size = 0; + uint8_t *resp = NULL; + uint32_t resp_size = 0; + uint16_t provision_ttl = 0; + uint8_t *msg = NULL; + uint8_t rsa_signature[PVE_RSA_KEY_BYTES]; + gen_endpoint_selection_output_t enclave_output; + ae_error_t ae_ret = AE_SUCCESS; + uint32_t enclave_lost_count = 0; + + AESM_DBG_DEBUG("enter fun"); + memset(&es_info, 0, sizeof(es_info)); + memset(&enclave_output, 0, sizeof(enclave_output)); + if(!_is_server_url_loaded){ + (void) read_aesm_config(_server_urls); + _is_server_url_loaded = true; + } + + do{ + if((ae_ret = CPVEClass::instance().load_enclave())!=AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PVE enclave:%d", ae_ret); + goto final_point; + } + //call PvE to generate the partition and xid + ae_ret = static_cast(CPVEClass::instance().gen_es_msg1_data(&enclave_output)); + if(ae_ret == AE_ENCLAVE_LOST&& (++enclave_lost_count)<=MAX_ENCLAVE_LOST_RETRY_TIME ){ + CPVEClass::instance().unload_enclave();//unload and reload PvE when enclave lost encountered + continue; + }else if(ae_ret == AE_SUCCESS){ + break; + }else{ + AESM_DBG_ERROR("fail to generate parition by PvE"); + goto final_point; + } + }while(1); + + AESM_DBG_TRACE("use parition %d from PvE", (int)enclave_output.selector_id); + + AESM_DBG_INFO("Connect to server url \"%s\" for endpoint selection", _server_urls.endpoint_url); + + msg_size = estimate_es_msg1_size(); + assert(msg_size>0); + msg = reinterpret_cast(malloc(msg_size)); + if(msg == NULL){ + AESM_DBG_ERROR("malloc error"); + ae_ret = AE_OUT_OF_MEMORY_ERROR; + goto final_point; + } + memset(msg, 0, msg_size); + + ae_ret = static_cast(CPVEClass::instance().gen_es_msg1(msg, msg_size, enclave_output));//Generate EndPoint Selection Msg1 + if(ae_ret != AE_SUCCESS){ + AESM_DBG_ERROR("ES msg1 generation failed:%d",ae_ret); + goto final_point; + } + AESM_DBG_TRACE("ES msg1 generated"); + + ae_ret = AESMNetworkEncoding::aesm_send_recv_msg_encoding(_server_urls.endpoint_url, msg, msg_size, resp, resp_size);//Encoding/send/receive/Decoding + + if(ae_ret != AE_SUCCESS){ + AESM_DBG_ERROR("fail to send ES msg1 to backend server:%d",ae_ret); + if(OAL_PROXY_SETTING_ASSIST == ae_ret){//when proxy setting assistant required, return directly + goto final_point; + } + if(read_pek(es_info)==AE_SUCCESS){ + ae_ret = AE_SUCCESS;//use es_info inside persistent storage and ignore network error + } + goto final_point; + } + assert(resp != NULL); + AESM_DBG_TRACE("start to process ES msg2"); + ae_ret = static_cast(CPVEClass::instance().proc_es_msg2(resp, resp_size, es_info.provision_url, provision_ttl, enclave_output.xid, rsa_signature , es_info.pek)); + if(AE_SUCCESS != ae_ret){ + AESM_DBG_WARN("Fail to process ES msg2 from backend server:%d",ae_ret); + goto final_point; + } + + AESM_DBG_TRACE("ES Msg2 decoded successfully, ttl %ds",provision_ttl); + ae_ret = verify_signature(es_info, enclave_output.xid, rsa_signature, provision_ttl); + if(AE_SUCCESS != ae_ret){ + AESM_DBG_WARN("Signature verification in ES Msg2 failed"); + goto final_point; + } + AESM_DBG_TRACE("Signature in ES Msg2 verified"); + es_info.aesm_data_type = AESM_DATA_ENDPOINT_SELECTION_INFOS; + es_info.aesm_data_version = AESM_DATA_ENDPOINT_SELECTION_VERSION; + (void)write_pek(es_info);//ignore file writing error + AESM_DBG_TRACE("end point selection succ, provisioning url: %s",es_info.provision_url); + +final_point: + if(msg!=NULL)free(msg); + if(resp!=NULL){ + AESMNetworkEncoding::aesm_free_response_msg(resp); + } + + return ae_ret; +} + +void EndpointSelectionInfo::get_proxy(uint32_t& proxy_type, char proxy_url[MAX_PATH]) +{ + AESMLogicLock lock(_es_lock); + if(!_is_server_url_loaded){ + (void)read_aesm_config(_server_urls); + _is_server_url_loaded=true; + } + proxy_type = _server_urls.proxy_type; + strcpy(proxy_url, _server_urls.aesm_proxy); +} + diff --git a/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h new file mode 100644 index 0000000000..39c38a0ebb --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _ENDPOINT_SELECT_INFO_H_ +#define _ENDPOINT_SELECT_INFO_H_ +#include "se_types.h" +#include "sgx_tseal.h" +#include "aeerror.h" +#include "tlv_common.h" +#include "se_thread.h" +#include "internal/se_rwlock.h" +#include "oal/oal.h" +#include "se_wrapper.h" +#include +#include +#include "AEClass.h" +#include "aesm_logic.h" + +#define AESM_DATA_ENDPOINT_SELECTION_INFOS 'B' +#define AESM_DATA_ENDPOINT_SELECTION_VERSION 1 +#pragma pack(1) +#include "aesm_config.h" + +/*Struct for data to save endpoint selection protocol result into persistent data storage*/ +typedef struct _endpoint_selection_infos_t{ + uint8_t aesm_data_type; + uint8_t aesm_data_version; + signed_pek_t pek; + char provision_url[MAX_PATH]; +}endpoint_selection_infos_t; +#pragma pack() + +/*An interface to provide the endpoint selection protocol and also provide some URLs (result of ES protocol or some static url) + *Singleton class used to provide a singleton instance in memory and lock used so that it could be shared by PvE/PSEPR + *EndpointSelectionInfo::instance().start_protocol(...) could be used to get endpoint selection result + * It will restart the ES protocol to get updated data. If the protocol fails, it may resue existing endpoint selection protocol result in persistent storage + */ +class EndpointSelectionInfo: public Singleton{ + CLASS_UNCOPYABLE(EndpointSelectionInfo); + friend class Singleton; +private: + AESMLogicMutex _es_lock; /*lock used since the data will be accessed by two different components: PSEPR and PVE*/ + aesm_config_infos_t _server_urls; /*some readonly urls */ + bool _is_server_url_valid; /*Set it to true when field _server_urls is valid*/ + bool _is_server_url_loaded;/*Set it to true after trying to read _server_urls from persistent storage. If _is_server_url_valid is false but this field is true, it means there're problem in persistent storage access*/ + static ae_error_t read_pek(endpoint_selection_infos_t& es_info); /*read _es_info from persistent storage*/ + static ae_error_t write_pek(const endpoint_selection_infos_t& es_info); /*save _es_info to persistent storage*/ + ae_error_t verify_signature(const endpoint_selection_infos_t& es_info, uint8_t xid[XID_SIZE], uint8_t rsa_signature[PVE_RSA_KEY_BYTES], uint16_t ttl); /*verify rsa signature in ES protocol result*/ +public: + EndpointSelectionInfo(){ + memset(&_server_urls, 0, sizeof(_server_urls)); + _is_server_url_loaded=false; + _is_server_url_valid=false; + } +public: + void get_proxy(uint32_t& proxy_type, char proxy_url[MAX_PATH]); + /*Function to get result of Endpoint Selection Protocol from Backend Server*/ + ae_error_t start_protocol(endpoint_selection_infos_t& es_info); +}; +#endif /*_ENDPOINT_SELECT_INFO_H_*/ + diff --git a/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp new file mode 100644 index 0000000000..40ed197950 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp @@ -0,0 +1,345 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "util.h" +#include "platform_info_logic.h" +#include "sgx_quote.h" +#include "aesm_encode.h" +#include "pve_logic.h" +#include "aesm_logic.h" +#include +#include "sgx_profile.h" +#include "le2be_macros.h" +#include "pibsk_pub.hh" +#include "sgx_sha256_128.h" +#include "aesm_long_lived_thread.h" + +ae_error_t PlatformInfoLogic::get_sgx_epid_group_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint8_t* pflags) +{ + ae_error_t retval = AE_SUCCESS; + if (NULL != pflags && NULL != p_platform_info_blob && p_platform_info_blob->valid_info_blob){ + *pflags = p_platform_info_blob->platform_info_blob.sgx_epid_group_flags; + } + else { + retval = AE_INVALID_PARAMETER; + } + return retval; +} + +ae_error_t PlatformInfoLogic::get_sgx_tcb_evaluation_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint16_t* pflags) +{ + ae_error_t retval = AE_SUCCESS; + if (NULL != pflags && NULL != p_platform_info_blob && p_platform_info_blob->valid_info_blob) { + const uint16_t* p = reinterpret_cast(p_platform_info_blob->platform_info_blob.sgx_tcb_evaluation_flags); + *pflags = lv_ntohs(*p); + } + else { + retval = AE_INVALID_PARAMETER; + } + return retval; +} + +bool PlatformInfoLogic::sgx_gid_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint8_t flags = 0; + bool retVal = false; + ae_error_t getflagsError = get_sgx_epid_group_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = (0 != (QE_EPID_GROUP_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + + return retVal; +} + +ae_error_t PlatformInfoLogic::need_epid_provisioning(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + ae_error_t status = AESM_NEP_DONT_NEED_EPID_PROVISIONING; + if (sgx_gid_out_of_date(p_platform_info_blob) && + !qe_svn_out_of_date(p_platform_info_blob) && + !cpu_svn_out_of_date(p_platform_info_blob)) + { + status = AESM_NEP_DONT_NEED_UPDATE_PVEQE; // don't need update, but need epid provisioning + } + else if (!sgx_gid_out_of_date(p_platform_info_blob) && performance_rekey_available(p_platform_info_blob)) + { + status = AESM_NEP_PERFORMANCE_REKEY; + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", status, status); + return status; +} + + +ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper) +{ + ae_error_t ae_err = AE_FAILURE; + sgx_ecc_state_handle_t ecc_handle = NULL; + + uint8_t result = SGX_EC_INVALID_SIGNATURE; + + const uint32_t data_size = static_cast(sizeof(piBlobWrapper.platform_info_blob) - sizeof(piBlobWrapper.platform_info_blob.signature)); + + + piBlobWrapper.valid_info_blob = false; + do + { + sgx_ec256_public_t publicKey; + sgx_ec256_signature_t signature; + sgx_status_t sgx_status; + + //BREAK_IF_TRUE((sizeof(publicKey) != sizeof(s_pib_pub_key_big_endian)), ae_err, AE_FAILURE); + //BREAK_IF_TRUE((sizeof(signature) != sizeof(piBlobWrapper.platform_info_blob.signature)), ae_err, AE_FAILURE); + + // convert the public key to little endian + if(0!=memcpy_s(&publicKey, sizeof(publicKey), s_pib_pub_key_big_endian, sizeof(s_pib_pub_key_big_endian))){ + ae_err = AE_FAILURE; + break; + } + SwapEndian_32B(((uint8_t*)&publicKey) + 0); + SwapEndian_32B(((uint8_t*)&publicKey) + 32); + + // convert the signature to little endian + if(0!=memcpy_s(&signature, sizeof(signature), &piBlobWrapper.platform_info_blob.signature, sizeof(piBlobWrapper.platform_info_blob.signature))){ + ae_err = AE_FAILURE; + break; + } + SwapEndian_32B(((uint8_t*)&signature) + 0); + SwapEndian_32B(((uint8_t*)&signature) + 32); + + sgx_status = sgx_ecc256_open_context(&ecc_handle); + BREAK_IF_TRUE((SGX_SUCCESS != sgx_status), ae_err, AE_FAILURE); + + sgx_status = sgx_ecdsa_verify((uint8_t*)&piBlobWrapper.platform_info_blob, data_size, &publicKey, &signature, &result, ecc_handle); + BREAK_IF_TRUE((SGX_SUCCESS != sgx_status), ae_err, AE_FAILURE); + + if (SGX_EC_VALID != result) + { + AESM_LOG_WARN(g_event_string_table[SGX_EVENT_PID_SIGNATURE_FAILURE]); + break; + } + + piBlobWrapper.valid_info_blob = true; + + ae_err = AE_SUCCESS; + + } while (0); + if (ecc_handle != NULL) { + sgx_ecc256_close_context(ecc_handle); + } + + return ae_err; +} + +aesm_error_t PlatformInfoLogic::report_attestation_status( + uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_status, + uint8_t* update_info, uint32_t update_info_size) +{ + AESM_DBG_TRACE("enter fun"); + // + // we don't do anything without platform info + // + if (NULL == platform_info) { + return AESM_PARAMETER_ERROR; + } + + platform_info_blob_wrapper_t pibw; + + // + // presence of platform info is conditional, on whether we're up to date + // if we're up to date, no platform info and no need for update info + // + if (((sizeof(pibw.platform_info_blob) > platform_info_size)) || ((NULL != update_info) && (sizeof(sgx_update_info_bit_t) > update_info_size))) { + return AESM_PARAMETER_ERROR; + } + + pibw.valid_info_blob = false; + memcpy_s(&pibw.platform_info_blob, sizeof(pibw.platform_info_blob), platform_info, platform_info_size); + + aesm_error_t status = AESM_SUCCESS; // status only tells app to look at updateInfo + + // + // contents of input platform info can get stale, but not by virtue of anything we do + // (the latest/current versions can change) + // therefore, we'll use the same platform info the whole time + // + bool pibSigGood = (AE_SUCCESS == pib_verify_signature(pibw)); + // + // invalid pib is an error whenever it's provided + // + if (!pibSigGood) { + AESM_DBG_ERROR("pib verify signature failed"); + return AESM_PLATFORM_INFO_BLOB_INVALID_SIG; + } + + ae_error_t nepStatus = need_epid_provisioning(&pibw); + AESM_DBG_TRACE("need_epid_provisioning return %d",nepStatus); + switch (nepStatus) + { + case AESM_NEP_DONT_NEED_EPID_PROVISIONING: + { + break; + } + case AESM_NEP_DONT_NEED_UPDATE_PVEQE: // sure thing + { + AESMLogicLock lock(AESMLogic::_qe_pve_mutex); + if(!query_pve_thread_status()){//If another thread is busy on Epid Provisioning + status = AESM_SUCCESS; + break; + } + bool perfRekey = false; + status = PvEAESMLogic::provision(perfRekey, THREAD_TIMEOUT); + if (AESM_BUSY == status || //thread timeout + AESM_PROXY_SETTING_ASSIST == status || //uae service need to set up proxy info and retry + AESM_UPDATE_AVAILABLE == status) //PSW need be updated + { + return status;//We should return to uae serivce directly + } + if (AESM_SUCCESS != status && + AESM_OUT_OF_MEMORY_ERROR != status && + AESM_BACKEND_SERVER_BUSY != status && + AESM_NETWORK_ERROR != status && + AESM_NETWORK_BUSY_ERROR != status) + { + status = AESM_SGX_PROVISION_FAILED; + } + break; + } + case AESM_NEP_PERFORMANCE_REKEY: + { + if (0 == attestation_status) // pr only if we succeeded (also we'll never get pr unless gid up-to-date) + { + bool perfRekey = true; + AESMLogicLock lock(AESMLogic::_qe_pve_mutex); + if(!query_pve_thread_status()){//If another thread is busy on Epid Provisioning + status = AESM_SUCCESS; + break; + } + status = PvEAESMLogic::provision(perfRekey, THREAD_TIMEOUT); + if (AESM_BUSY == status ||//thread timeout + AESM_PROXY_SETTING_ASSIST == status ||//uae service need to set up proxy info and retry + AESM_UPDATE_AVAILABLE == status) + { + return status;//We should return to uae serivce directly + } + if (AESM_SUCCESS != status && + AESM_OUT_OF_MEMORY_ERROR != status && + AESM_BACKEND_SERVER_BUSY != status && + AESM_NETWORK_ERROR != status && + AESM_NETWORK_BUSY_ERROR != status) + { + status = AESM_SGX_PROVISION_FAILED; + } + } + break; + } + default: + { + status = AESM_UNEXPECTED_ERROR; + break; + } + } + + // + // don't nag happy app about updates + // + if ((0 != attestation_status) && (NULL != update_info)) + { + sgx_update_info_bit_t* p_update_info = (sgx_update_info_bit_t*)update_info; + memset(p_update_info, 0, sizeof(*p_update_info)); + + // + // here, we treat values that get reported live - cpusvn, qe.isvsvn + // in normal flow, live values reported to attestation server will be the same as current values now so + // we just look at out-of-date bits corresponding to these values. + // the alternative would be to compare current with latest as reported by IAS. this + // isn't an option for cpusvn since what we get from IAS is equivalent cpusvn. + // + if (cpu_svn_out_of_date(&pibw)) + { + p_update_info->ucodeUpdate = 1; + status = AESM_UPDATE_AVAILABLE; + } + if (qe_svn_out_of_date(&pibw)) + { + p_update_info->pswUpdate = 1; + status = AESM_UPDATE_AVAILABLE; + } + + } + return status; +} + +bool PlatformInfoLogic::cpu_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint16_t flags = 0; + bool retVal = false; + ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = ( 0 !=(QUOTE_CPUSVN_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + + return retVal; +} + +bool PlatformInfoLogic::qe_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint16_t flags = 0; + // + // default to true since easy to update QE/PvE + // + bool retVal = true; + ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = ( 0 !=(QUOTE_ISVSVN_QE_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + return retVal; +} + +bool PlatformInfoLogic::performance_rekey_available(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + // + // return whether platform info blob says PR is available + // the group associated with PR that's returned corresponds to the group + // that we'll be in **after** executing PR + // + bool retVal = false; + uint8_t flags; + ae_error_t getflagsError = get_sgx_epid_group_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = static_cast(flags & PERF_REKEY_FOR_QE_EPID_GROUP_AVAILABLE); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + return retVal; +} diff --git a/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h new file mode 100644 index 0000000000..d77a713496 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PLATFORM_INFO_LOGIC_H_ +#define _PLATFORM_INFO_LOGIC_H_ +#include "sgx_urts.h" +#include "aesm_error.h" +#include "aeerror.h" +#include "oal/oal.h" +#include "upse/platform_info_blob.h" + +struct update_pse_thread_func_arg; + +/*File to declare PlatformInfoLogic Class which is platform independent*/ +class PlatformInfoLogic{ +public: + static aesm_error_t report_attestation_status( + uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_status, + uint8_t* update_info, uint32_t update_info_size); + + + static ae_error_t need_epid_provisioning(const platform_info_blob_wrapper_t* p_platform_info_blob); + + static bool sgx_gid_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); + static bool cpu_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); + static bool qe_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); + static bool performance_rekey_available(const platform_info_blob_wrapper_t* p_platform_info_blob); + +private: + static ae_error_t get_sgx_epid_group_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint8_t* flags); + static ae_error_t get_sgx_tcb_evaluation_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint16_t* flags); + +}; +#endif + diff --git a/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp b/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp new file mode 100644 index 0000000000..301026fb57 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp @@ -0,0 +1,526 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: type_length_value.cpp + * Description: Cpp file for code to decoding/encoding of the TLV, the type length value encoding format of Provision Message + */ + +#include "type_length_value.h" +#include "sgx.h" +#include "se_wrapper.h" +#include "oal/oal.h" +#include + +#ifdef DBG_LOG +#define CASE_ENUM_RET_STRING(x) case x: return #x; +const char *get_tlv_enum_type_t_string(uint8_t type){ + switch(type){ + CASE_ENUM_RET_STRING(TLV_CIPHER_TEXT) + CASE_ENUM_RET_STRING(TLV_BLOCK_CIPHER_TEXT) + CASE_ENUM_RET_STRING(TLV_BLOCK_CIPHER_INFO) + CASE_ENUM_RET_STRING(TLV_MESSAGE_AUTHENTICATION_CODE) + CASE_ENUM_RET_STRING(TLV_NONCE) + CASE_ENUM_RET_STRING(TLV_EPID_GID) + CASE_ENUM_RET_STRING(TLV_EPID_SIG_RL) + CASE_ENUM_RET_STRING(TLV_EPID_GROUP_CERT) + CASE_ENUM_RET_STRING(TLV_DEVICE_ID) + CASE_ENUM_RET_STRING(TLV_PS_ID) + CASE_ENUM_RET_STRING(TLV_EPID_JOIN_PROOF) + CASE_ENUM_RET_STRING(TLV_EPID_SIG) + CASE_ENUM_RET_STRING(TLV_EPID_MEMBERSHIP_CREDENTIAL) + CASE_ENUM_RET_STRING(TLV_EPID_PSVN) + CASE_ENUM_RET_STRING(TLV_QUOTE) + CASE_ENUM_RET_STRING(TLV_X509_CERT_TLV) + CASE_ENUM_RET_STRING(TLV_X509_CSR_TLV) + CASE_ENUM_RET_STRING(TLV_ES_SELECTOR) + CASE_ENUM_RET_STRING(TLV_ES_INFORMATION) + CASE_ENUM_RET_STRING(TLV_FLAGS) + CASE_ENUM_RET_STRING(TLV_QUOTE_SIG) + CASE_ENUM_RET_STRING(TLV_PEK) + CASE_ENUM_RET_STRING(TLV_SIGNATURE) + default: + return "Unknown TLV"; + } +} +#endif +//Function to write tlv header into a msg according to tlv info, the input buffer size should be at least MAX_TLV_HEADER_SIZE +static tlv_status_t write_tlv_header(uint8_t *msg, const tlv_info_t *info) +{ + uint8_t type = info->type; + if(info->size>UINT16_MAX ||info->header_size == LARGE_TLV_HEADER_SIZE){//6 bytes header + uint32_t size = info->size; //4 bytes in size field + type |= FOUR_BYTES_SIZE_TYPE; + msg[0] = type; + msg[1] = info->version; + size = _htonl(size); + if(memcpy_s(&msg[2], sizeof(uint32_t), &size, sizeof(size))!=0){ + AESM_DBG_ERROR("memcpy failed"); + return TLV_UNKNOWN_ERROR; + } + }else{//4 bytes header + uint16_t size = (uint16_t)info->size;//2 bytes in size field + msg[0] = type; + msg[1] = info->version; + size = _htons(size); + if(memcpy_s(&msg[2], sizeof(uint16_t), &size, sizeof(size))!=0){ + AESM_DBG_ERROR("memcpy failed"); + return TLV_UNKNOWN_ERROR; + } + } + return TLV_SUCCESS; +} + +//Function to read the first tlv info from msg and return length in bytes of the TLV header (so it provides offset of TLV payload) +// the function return 0 on error +static uint32_t read_tlv_info(const tlv_msg_t& msg, tlv_info_t *info) +{ + if(msg.msg_sizetype = GET_TLV_TYPE(msg.msg_buf[0]); + info->version = msg.msg_buf[1]; + if(IS_FOUR_BYTES_SIZE_TYPE(msg.msg_buf[0])){//four bytes or two bytes of size + if(msg.msg_sizesize, sizeof(info->size), &msg.msg_buf[2], sizeof(uint32_t)); + info->size = _ntohl(info->size); + info->payload = msg.msg_buf+LARGE_TLV_HEADER_SIZE; + info->header_size = LARGE_TLV_HEADER_SIZE; + return LARGE_TLV_HEADER_SIZE;//6 bytes TLV header + }else{ + uint16_t size = 0; + (void)memcpy_s(&size, sizeof(uint16_t), &msg.msg_buf[2], sizeof(uint16_t)); + info->size = (uint32_t)_ntohs(size); //reorder to form little endian size value and extended by 0 + info->payload = msg.msg_buf+SMALL_TLV_HEADER_SIZE; + info->header_size = SMALL_TLV_HEADER_SIZE; + return SMALL_TLV_HEADER_SIZE; //4 bytes TLV header + } +} + +static bool decode_one_tlv(tlv_msg_t& msg, tlv_info_t *info) +{ + if(msg.msg_sizesize; + if(msg.msg_sizeUINT16_MAX){//6 bytes TLV header + if(payload_size>UINT32_MAX-LARGE_TLV_HEADER_SIZE)//overflow of uint32_t, return 0 to indicate error + return 0; + return LARGE_TLV_HEADER_SIZE; + }else{ + return SMALL_TLV_HEADER_SIZE;//4 bytes TLV header + } +} + +uint32_t get_tlv_header_size(const tlv_info_t *info) +{ + assert(info->header_size == LARGE_TLV_HEADER_SIZE|| + info->header_size == SMALL_TLV_HEADER_SIZE); + return info->header_size; +} + +uint32_t get_tlv_total_size(const tlv_info_t &info) +{ + return get_tlv_header_size(&info)+info.size; +} + +static uint32_t calc_one_tlv_size(const tlv_info_t& infos) +{ + uint32_t the_size = 0; + if(infos.header_size == UNKNOWN_TLV_HEADER_SIZE) + the_size = get_tlv_total_size(infos.size); + else + the_size = get_tlv_total_size(infos); + return the_size; +} + + +static tlv_status_t tlv_msg_init_one_tlv(tlv_info_t* infos, const tlv_msg_t& tlv_msg) +{ + uint16_t hsize; + tlv_status_t status = TLV_SUCCESS; + if(infos->header_size == UNKNOWN_TLV_HEADER_SIZE) + hsize = get_tlv_header_size_from_payload_size(infos->size); //TLV header size + else + hsize = (uint8_t)infos->header_size; + uint32_t tsize = hsize+infos->size; //size of header and payload + if(tlv_msg.msg_sizeheader_size = hsize; + infos->payload = tlv_msg.msg_buf + hsize; //initialize the payload of the tlv_info + if(tsize=1); + assert(info.payload!=NULL); + return info.payload; +} + +tlv_msg_t cipher_text_tlv_get_encrypted_text(const tlv_info_t& info) +{ + assert(info.type == TLV_CIPHER_TEXT && info.size>=1); + assert(info.payload!=NULL); + tlv_msg_t tlv_msg; + tlv_msg.msg_buf = info.payload+1; + tlv_msg.msg_size = info.size -1; + return tlv_msg; +} + +tlv_iv_t *block_cipher_tlv_get_iv(const tlv_info_t& info) +{ + assert(info.type == TLV_BLOCK_CIPHER_TEXT && info.size >= IV_SIZE); + assert(info.payload!=NULL); + return reinterpret_cast(info.payload); +} + +tlv_msg_t block_cipher_tlv_get_encrypted_text(const tlv_info_t& info) +{ + assert(info.type == TLV_BLOCK_CIPHER_TEXT && info.size >= IV_SIZE); + assert(info.payload!=NULL); + tlv_msg_t tlv_msg; + tlv_msg.msg_buf = info.payload + IV_SIZE; + tlv_msg.msg_size = info.size - IV_SIZE; + return tlv_msg; +} + + +fmsp_t *device_id_tlv_get_fmsp(const tlv_info_t& info) +{ + assert(info.type == TLV_DEVICE_ID && info.size == DEVICE_ID_TLV_PAYLOAD_SIZE()); + assert(info.payload!=NULL); + return reinterpret_cast(info.payload+sizeof(psvn_t)+sizeof(ppid_t)); +} + +psvn_t *device_id_tlv_get_psvn(const tlv_info_t& info) +{ + assert(info.type == TLV_DEVICE_ID && info.size == DEVICE_ID_TLV_PAYLOAD_SIZE()); + assert(info.payload!=NULL); + return reinterpret_cast(info.payload+sizeof(ppid_t)); +} + + +tlv_status_t TLVsMsg::init_from_tlv_msg(const tlv_msg_t& tlv_msg) +{ + clear(); + msg.msg_size = tlv_msg.msg_size; + msg.msg_buf = (uint8_t *)malloc(msg.msg_size); + if(msg.msg_buf == NULL){ + msg.msg_size = 0; + AESM_DBG_ERROR("malloc failed"); + return TLV_OUT_OF_MEMORY_ERROR; + } + if(memcpy_s(msg.msg_buf, msg.msg_size, tlv_msg.msg_buf, tlv_msg.msg_size)!=0){ + AESM_DBG_ERROR("memcpy failed"); + return TLV_UNKNOWN_ERROR; + } + tlv_msg_t tlv_tmp = msg; + tlv_info_t one_info; + tlv_info_t *new_info = NULL; + while(tlv_tmp.msg_size>0){ + if(decode_one_tlv(tlv_tmp, &one_info)){ + tlv_status_t ret = create_new_info(new_info); + if(ret != TLV_SUCCESS) return ret; + if(memcpy_s(new_info, sizeof(*new_info), &one_info, sizeof(one_info))!=0){ + AESM_DBG_ERROR("memcpy failed"); + return TLV_UNKNOWN_ERROR; + } +#ifdef DBG_LOG + char dbg_str[256]; + aesm_dbg_format_hex(new_info->payload, new_info->size, dbg_str, 256); + AESM_DBG_TRACE("Decode One TLV: type %s, size %u, version %d, payload:%s",get_tlv_enum_type_t_string(new_info->type), new_info->size, (int)new_info->version,dbg_str); +#endif + }else{ + return TLV_INVALID_MSG_ERROR; + } + } + return TLV_SUCCESS; +} + +tlv_status_t TLVsMsg::init_from_buffer(const uint8_t *msg_buf, uint32_t msg_size) +{ + tlv_msg_t tlv_msg; + tlv_msg.msg_buf=const_cast(msg_buf); + tlv_msg.msg_size = msg_size; + return init_from_tlv_msg(tlv_msg); +} + +tlv_status_t TLVsMsg::alloc_more_buffer(uint32_t new_size, tlv_msg_t& new_buf) +{ + if(msg.msg_buf == NULL){ + assert(msg.msg_size==0); + msg.msg_buf = (uint8_t *)malloc(new_size); + if(msg.msg_buf == NULL){ + return TLV_OUT_OF_MEMORY_ERROR; + } + msg.msg_size = new_size; + new_buf = msg; + }else{ + uint8_t *old_p = msg.msg_buf; + uint8_t *p = (uint8_t *)malloc(msg.msg_size+new_size); + if(p==NULL){ + return (TLV_OUT_OF_MEMORY_ERROR); + } + if(0!=memcpy_s(p,msg.msg_size+new_size, old_p, msg.msg_size)){ + free(p); + return TLV_UNKNOWN_ERROR; + } + size_t i; + for(i=0;ipayload, new_info->size, dbg_str, 256);\ + AESM_DBG_INFO("create TLV: type %s, size %u, version %d, payload %s", get_tlv_enum_type_t_string(new_info->type), new_info->size, (int)new_info->version, dbg_str);\ +} +#else +#define ADD_TLV_DBG_INFO +#endif + +tlv_status_t TLVsMsg::add_cipher_text(const uint8_t *text, uint32_t len, uint8_t key_id) +{ + tlv_info_t one_info; + one_info.header_size = UNKNOWN_TLV_HEADER_SIZE; + one_info.payload = NULL; + one_info.size = CIPHER_TEXT_TLV_PAYLOAD_SIZE(len); + one_info.type = TLV_CIPHER_TEXT; + one_info.version = TLV_VERSION_1; + uint32_t size = ::calc_one_tlv_size(one_info); + tlv_msg_t new_buf; + tlv_info_t *new_info = NULL; + tlv_status_t ret = alloc_more_buffer(size, new_buf); + if(ret != TLV_SUCCESS) + return ret; + ret = create_new_info(new_info); + if(ret != TLV_SUCCESS) + return ret; + if((ret = ::tlv_msg_init_one_tlv(&one_info, new_buf)) !=TLV_SUCCESS){ + return ret; + } + *cipher_text_tlv_get_key_id(one_info)=key_id; + new_buf = cipher_text_tlv_get_encrypted_text(one_info); + if(memcpy_s(new_buf.msg_buf, new_buf.msg_size, text, len)!=0){ + return TLV_UNKNOWN_ERROR; + } + if(memcpy_s(new_info, sizeof(*new_info), &one_info, sizeof(one_info))!=0){ + return TLV_UNKNOWN_ERROR; + } + ADD_TLV_DBG_INFO + return TLV_SUCCESS; +} + +tlv_status_t TLVsMsg::add_block_cipher_text(const uint8_t iv[IV_SIZE],const uint8_t *text, uint32_t len) +{ + tlv_info_t one_info; + one_info.header_size = UNKNOWN_TLV_HEADER_SIZE; + one_info.payload = NULL; + one_info.size = BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(len); + one_info.type = TLV_BLOCK_CIPHER_TEXT; + one_info.version = TLV_VERSION_1; + uint32_t size = ::calc_one_tlv_size(one_info); + tlv_msg_t new_buf; + tlv_info_t *new_info = NULL; + tlv_status_t ret = alloc_more_buffer(size, new_buf); + if(ret != TLV_SUCCESS) + return ret; + ret = create_new_info(new_info); + if(ret != TLV_SUCCESS) + return ret; + if((ret=::tlv_msg_init_one_tlv(&one_info, new_buf))!=TLV_SUCCESS){ + return ret; + } + new_buf = block_cipher_tlv_get_encrypted_text(one_info); + if(len>0&&text!=NULL){ + if(memcpy_s(new_buf.msg_buf, new_buf.msg_size, text, len)!=0){ + return (TLV_UNKNOWN_ERROR); + } + } + if(memcpy_s(block_cipher_tlv_get_iv(one_info), IV_SIZE, iv, IV_SIZE)!=0){ + return (TLV_UNKNOWN_ERROR); + } + if(memcpy_s(new_info, sizeof(*new_info), &one_info, sizeof(one_info))!=0){ + return TLV_UNKNOWN_ERROR; + } + ADD_TLV_DBG_INFO + return TLV_SUCCESS; +} + +tlv_status_t TLVsMsg::add_block_cipher_info(const uint8_t sk[SK_SIZE]) +{ + tlv_info_t one_info; + one_info.header_size = UNKNOWN_TLV_HEADER_SIZE; + one_info.payload = NULL; + one_info.size = BLOCK_CIPHER_INFO_TLV_PAYLOAD_SIZE(); + one_info.type = TLV_BLOCK_CIPHER_INFO; + one_info.version = TLV_VERSION_1; + uint32_t size = ::calc_one_tlv_size(one_info); + tlv_msg_t new_buf; + tlv_info_t *new_info = NULL; + tlv_status_t ret = alloc_more_buffer(size, new_buf); + if(ret!=TLV_SUCCESS) + return ret; + ret = create_new_info(new_info); + if(ret!=TLV_SUCCESS) + return ret; + if((ret=::tlv_msg_init_one_tlv(&one_info, new_buf))!=TLV_SUCCESS){ + return ret; + } + if(memcpy_s(one_info.payload, one_info.size, sk, SK_SIZE)!=0){ + return (TLV_UNKNOWN_ERROR); + } + if(memcpy_s(new_info, sizeof(*new_info),&one_info, sizeof(one_info))!=0) + return TLV_UNKNOWN_ERROR; + ADD_TLV_DBG_INFO + return TLV_SUCCESS; +} + +#define ADD_TLV_BY_DATA_SIZE(data_type, data, data_size) \ + tlv_info_t one_info; \ + one_info.header_size = UNKNOWN_TLV_HEADER_SIZE; \ + one_info.payload = NULL;\ + one_info.size = data_size;\ + one_info.type = data_type; \ + one_info.version = TLV_VERSION_1; \ + uint32_t size = ::calc_one_tlv_size(one_info);\ + tlv_msg_t new_buf; \ + tlv_info_t *new_info = NULL; \ + tlv_status_t ret = alloc_more_buffer(size, new_buf); \ + if(ret!=TLV_SUCCESS){ \ + return ret; \ + } \ + ret = create_new_info(new_info); \ + if(ret != TLV_SUCCESS) \ + return ret; \ + if((ret=::tlv_msg_init_one_tlv(&one_info, new_buf))!=TLV_SUCCESS){ \ + return ret; \ + }\ + if(memcpy_s(one_info.payload, one_info.size, data, data_size)!=0){\ + return (TLV_UNKNOWN_ERROR);\ + }\ + if(memcpy_s(new_info, sizeof(*new_info), &one_info, sizeof(one_info))!=0) \ + return TLV_UNKNOWN_ERROR; \ + ADD_TLV_DBG_INFO \ + return TLV_SUCCESS; + +tlv_status_t TLVsMsg::add_mac(const uint8_t mac[MAC_SIZE]) +{ + ADD_TLV_BY_DATA_SIZE(TLV_MESSAGE_AUTHENTICATION_CODE, mac, MAC_SIZE) +} + +tlv_status_t TLVsMsg::add_nonce(const uint8_t *nonce, uint32_t nonce_size) +{ + ADD_TLV_BY_DATA_SIZE(TLV_NONCE, nonce, nonce_size) +} + + +tlv_status_t TLVsMsg::add_epid_gid(const GroupID& gid) +{ + ADD_TLV_BY_DATA_SIZE(TLV_EPID_GID, &gid, sizeof(GroupID)) +} + + +tlv_status_t TLVsMsg::add_quote(const uint8_t *quote_data, uint32_t quote_size) +{ + ADD_TLV_BY_DATA_SIZE(TLV_QUOTE, quote_data, quote_size) +} + + +tlv_status_t TLVsMsg::add_x509_csr(const uint8_t *csr_data, uint32_t csr_size) +{ + ADD_TLV_BY_DATA_SIZE(TLV_X509_CSR_TLV, csr_data, csr_size) +} + + +tlv_status_t TLVsMsg::add_quote_signature(const uint8_t *quote_signature, uint32_t sign_size) +{ + tlv_info_t one_info; + one_info.header_size = LARGE_TLV_HEADER_SIZE;//always use large tlv for sigrl and epid sig + one_info.payload = NULL; + one_info.size = sign_size; + one_info.type = TLV_QUOTE_SIG; + one_info.version = TLV_VERSION_1; + uint32_t size = ::calc_one_tlv_size(one_info); + tlv_msg_t new_buf; + tlv_info_t *new_info = NULL; + tlv_status_t ret = alloc_more_buffer(size, new_buf); + if(ret!=TLV_SUCCESS) + return ret; + ret = create_new_info(new_info); + if(ret!=TLV_SUCCESS) + return ret; + if((ret=::tlv_msg_init_one_tlv(&one_info, new_buf))!=TLV_SUCCESS){ + return (TLV_UNKNOWN_ERROR); + } + if(memcpy_s(one_info.payload, one_info.size, quote_signature, sign_size)!=0){ + return (TLV_UNKNOWN_ERROR); + } + if(memcpy_s(new_info, sizeof(*new_info),&one_info, sizeof(one_info))!=0) + return TLV_UNKNOWN_ERROR; + ADD_TLV_DBG_INFO + return TLV_SUCCESS; +} + + +tlv_status_t TLVsMsg::add_es_selector(uint8_t protocol, uint8_t selector_id) +{ + uint8_t buf[2]; + buf[0]=protocol; + buf[1]=selector_id; + ADD_TLV_BY_DATA_SIZE(TLV_ES_SELECTOR, buf, static_cast(2*sizeof(uint8_t))) +} diff --git a/psw/ae/aesm_service/source/aesm/extension/type_length_value.h b/psw/ae/aesm_service/source/aesm/extension/type_length_value.h new file mode 100644 index 0000000000..047538148b --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/type_length_value.h @@ -0,0 +1,344 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: type_length_value.h + * Description: Header file for data structure and macro definition of the TLV, the type length value encoding format of Provision Message + * + * Unaligned data will be used and for TLV, no data structure but some macros are used to extract information from TLV (due to var size of some fields) + * A tlv_info_t structure is defined for decoded TLV header information + * + *To encoding TLV: + * i) declare array of tlv_info_t and filling type/version/size of each TLV + * ii) call get_tlv_msg_size to calculate size of encoded buffer + * iii) prepare the output buffer in tlv_msg_t (set both msg_buf and msg_size) + * iv) call tlv_msg_init to initialize tlv headers of all sub-tlv + * v) use function like cipher_text_tlv_get_encrypted_text(...) to get pointer to each payload component + * vi) copy corresponding data into each payload + *To decoding TLV: + * i) initialize tlv_msg_t to input buffer (msg_buf and msg_size) + * ii) call read_tlv_info to get correpondent tlv_info_t array + * iii) use function like cipher_text_tlv_get_encrypted_text(...) to get pointer to each payload component + * or access size field of tlv_info_t directly to get size of payload + *Usually, there're multiple level of TLVs. + * So in encoding TLV, we need + * go through step i) and ii) from inner-most level TLV to out-most level of TLV to define + * tlv_info_t of all level of TLVs and get msg size for them + * Usually, the tlv_info_t of outer level is dependent on size of inner level + * After that, we could prepare the output buffer which is step iii) according to size of outmost level TLVs + * call tlv_msg_init to initialize TLV headers and get start address of payload (where inner TLV will share the memory) + * from outmost level to innermost level which is step iv) and v) + * In decoding TLV, it is simpler, just decode from outmost-level to innermost-level and do decryption if required + */ + +#ifndef _PVE_TLV_H +#define _PVE_TLV_H +#include "epid_types.h" +#include "sgx_urts.h" +#include +#include +#include +#include "oal/oal.h" +#include "tlv_common.h" +#include "se_sig_rl.h" +#include "se_wrapper.h" + +#define FOUR_BYTES_SIZE_TYPE 128 /*mask used in type of TLV to indicate that 'size' field uses 4 bytes*/ + +#ifndef UINT16_MAX +#define UINT16_MAX 0xFFFF +#endif +#ifndef UINT32_MAX +#define UINT32_MAX 0xFFFFFFFFU +#endif + +#define IS_FOUR_BYTES_SIZE_TYPE(x) (((x)&FOUR_BYTES_SIZE_TYPE)!=0) +#define GET_TLV_TYPE(x) ((uint8_t)((x)&~FOUR_BYTES_SIZE_TYPE)) + +typedef enum _tlv_status_t { + TLV_SUCCESS=0, + TLV_OUT_OF_MEMORY_ERROR=1, + TLV_INVALID_PARAMETER_ERROR, + TLV_INVALID_MSG_ERROR, + TLV_UNKNOWN_ERROR, + TLV_MORE_TLVS, /*There're more TLVs in the encoded buffer than user's expectation*/ + TLV_INSUFFICIENT_MEMORY, /*There'ld be more data in the TLV buffer according to the partially decoded data*/ + TLV_INVALID_FORMAT, /*Invalid data format in the TLV buffer to be decoded*/ + TLV_UNSUPPORTED /*the feature has not been supported such as version is later than supported version*/ +}tlv_status_t; + +/*usually, we could initialize header_size by UNKOWN_TLV_HEADER_SIZE + *but sometimes, we could initialize it by LARGE_TLV_HEADER_SIZE if we want to always use 4 bytes for size even though it is small such as in EPIDSignature TLV*/ +#define UNKNOWN_TLV_HEADER_SIZE 0 +#define TLV_HEADER_SIZE_OFFSET 2 +#define SMALL_TLV_HEADER_SIZE 4 +#define LARGE_TLV_HEADER_SIZE 6 +#define MAX_TLV_HEADER_SIZE 6 /*an upper bound for TLV header size*/ +#define SHORT_TLV_MAX_SIZE UINT16_MAX +/*It defines a TLV information + *All those information is encoded inside a TLV but not in this structure*/ +typedef struct _tlv_info_t{ + uint8_t type; /*type of tlv must be between 0 and 127 before encoding*/ + uint8_t version; + uint16_t header_size; /*header_size used to easy query begin and end address of TLV*/ + uint32_t size; /* 2 or 4 bytes size after encoding but always 4 bytes in this structure*/ + uint8_t *payload; /*pointer to payload of the TLV*/ +}tlv_info_t; + +typedef struct _tlv_msg_t{ + uint8_t *msg_buf; + uint32_t msg_size; +}tlv_msg_t; + +#define SIGRL_CERT_PREFIX_SIZE (sizeof(se_sig_rl_t)-sizeof(SigRL)) /*size for version and type*/ +#define SIGRL_CERT_HEADER_SIZE (sizeof(se_sig_rl_t)-sizeof(SigRLEntry)) +#define SIGRL_CERT_SIZE(sigrl_count) (sizeof(se_sig_rl_t)+((sigrl_count)-1)*sizeof(SigRLEntry)+2*SE_ECDSA_SIGN_SIZE) +#define EPID_SIGNATURE_HEADER_SIZE (sizeof(EPIDSignature)-sizeof(NRProof)) +#define EPID_SIGNATURE_SIZE(sign_count) (sizeof(EPIDSignature)+((sign_count)-1)*sizeof(NRProof)) + + +/*Function to decode a buffer which contains a list of TLV containers + *msg.msg_buf: pointer to the start address of the buffer + *msg.msg_size: number of bytes of the buffer + *tlvs_count: input/output parameter, the input *tlvs_count gives size of array infos and offsets + * when the function return successful (TLV_SUCCESS) or there're too many TLVs (TLV_MORE_TLVS), + * the output of *tlvs_count returns the number of TLVs in the msg + *infos: output parameter, infos[i] gives the decoded TLV structure information of the i'th TLV in the msg + *return: TLV_SUCCESS on success or other value to indicate error + */ +tlv_status_t read_tlv_infos(const tlv_msg_t& msg, uint32_t *tlvs_count, tlv_info_t infos[]); + +/*Function to return the header size in encoded TLV buffer*/ +uint32_t get_tlv_header_size(const tlv_info_t *info); + +/*Function to return the estimated upper bound of length of TLV in bytes given length in bytes of payload. + * Currently, it returns the exact value for TLV encoding, it should not be used for TLV decoding + *return 0 if there's any error + */ +inline static uint32_t get_tlv_total_size(size_t payload_size) +{ + if(payload_size>UINT16_MAX){/*6 bytes TLV header*/ + if(payload_size>UINT32_MAX-LARGE_TLV_HEADER_SIZE)/*overflow of uint32_t, return 0 to indicate error*/ + return 0; + return static_cast(payload_size+LARGE_TLV_HEADER_SIZE); + }else{ + return static_cast(payload_size+SMALL_TLV_HEADER_SIZE);/*4 bytes TLV header*/ + } +} + + +/*Function to return number in bytes of a msg with some encoded TLVs + *tlvs_count gives number of TLVs in the msg and infos[i] gives info of the i'th TLV*/ +uint32_t get_tlv_msg_size(uint32_t tlvs_count, const tlv_info_t infos[]); + +/*Function to initialize a msg of some encoded TLVs + *Before calling the function, all fields except payload of infos[.] has been initialized + *After calling to the function, the TLV header of all TLVs will be fill in and payload of info[.] will be initialized + *After calling to the function, we could use payload field + *tlvs_count: input parameter gives number of TLV in the msg + *infos: input parameter where infos[i] is the tlv structure information of the i'th TLV + *tlv_msg.msg_buf: the msg buffer to be initialized + *tlv_msg.msg_size: input parameter gives the size of the msg buffer, it must be result of function get_tlv_msg_count(tlvs_count, infos); + *The function return TLV_SUCCESS on success and other to indicate any error + */ +tlv_status_t tlv_msg_init(uint32_t tlvs_count, tlv_info_t infos[], const tlv_msg_t& tlv_msg); + +/*Function used to initialize msg header only without checking payload size + *The function will return size in bytes of the header to be filled + * the payload field will be set but payload size not checked + *msg: The buffer to fill + *info: the tlv_info of the TLV + */ +uint32_t tlv_msg_init_one_header(uint8_t msg[MAX_TLV_HEADER_SIZE], tlv_info_t& info); + +/*Macro used to crack tlv structure, the pointer type of payload must be uint8_t * + *The alignment of all types used inside payload should be 1 (which means no alignment) + *cipher text TLV*/ +#define CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size) ((text_size)+1) /*size of payload*/ +#define CIPHER_TEXT_TLV_SIZE(text_size) get_tlv_total_size(CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size)) /*size of TLV*/ +uint8_t *cipher_text_tlv_get_key_id(const tlv_info_t& info); /*given tlv_info_t, return pointer to key_id*/ +tlv_msg_t cipher_text_tlv_get_encrypted_text(const tlv_info_t& info); /*given tlv_info_t return tlv_msg for encrypted text so that we could restart decode*/ +/*block cipher text TLV*/ +#define BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size) ((text_size)+IV_SIZE) /*size of payload*/ +#define BLOCK_CIPHER_TEXT_TLV_SIZE(text_size) get_tlv_total_size(BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size)) /*size of TLV*/ +struct _tlv_iv_t;/*an incomplete type for iv only*/ +typedef struct _tlv_iv_t tlv_iv_t; +tlv_iv_t *block_cipher_tlv_get_iv(const tlv_info_t& info); +tlv_msg_t block_cipher_tlv_get_encrypted_text(const tlv_info_t& info); +#define BLOCK_CIPHER_TEXT_SIZE_FROM_PAYLOAD_SIZE(psize) ((psize)-IV_SIZE) + +/*block cipher info TLV*/ +#define BLOCK_CIPHER_INFO_TLV_PAYLOAD_SIZE() SK_SIZE /*size of payload*/ +#define BLOCK_CIPHER_INFO_TLV_SIZE() get_tlv_total_size(BLOCK_CIPHER_INFO_TLV_PAYLOAD_SIZE()) +struct _tlv_sk_t; /*an incomplete type for SK only*/ +typedef struct _tlv_sk_t tlv_sk_t; +tlv_sk_t *block_cipher_info_tlv_get_sk(const tlv_info_t& info); + +/*message authentication code TLV*/ +#define MAC_TLV_PAYLOAD_SIZE(mac_size) (mac_size) +#define MAC_TLV_SIZE(mac_size) get_tlv_total_size(MAC_TLV_PAYLOAD_SIZE(mac_size)) +struct _tlv_mac_t; /*an incomplete type for MAC only*/ +typedef struct _tlv_mac_t tlv_mac_t; +tlv_mac_t *mac_tlv_get_mac(const tlv_info_t& info); +/*NONCE TLV*/ +#define NONCE_TLV_PAYLOAD_SIZE(nonce_size) (nonce_size) +#define NONCE_TLV_SIZE(nonce_size) get_tlv_total_size(NONCE_TLV_PAYLOAD_SIZE(nonce_size)) +struct _tlv_nonce_t; +typedef struct _tlv_nonce_t tlv_nonce_t; +tlv_nonce_t *nonce_tlv_get_nonce(const tlv_info_t& info); + +/*EPID GID TLV*/ +#define EPID_GID_TLV_PAYLOAD_SIZE() (sizeof(GroupID)) +#define EPID_GID_TLV_SIZE() get_tlv_total_size(EPID_GID_TLV_PAYLOAD_SIZE()) +struct _tlv_gid_t; /*an incomplete type for GID only*/ +typedef struct _tlv_gid_t tlv_gid_t; +tlv_sk_t *epid_gid_tlv_get_gid(const tlv_info_t& info); + +/*EPID SigRL TLV*/ +#define EPID_SIGRL_TLV_PAYLOAD_SIZE(sigrl_count) (sizeof(se_sig_rl_t)+sizeof(SigRLEntry)*(sigrl_count)-sizeof(SigRLEntry)+ECDSA_SIGN_SIZE*2) +#define EPID_SIGRL_TLV_SIZE(sigrl_count) (sigrl_count>0?get_tlv_total_size(EPID_SIGRL_TLV_PAYLOAD_SIZE(sigrl_count)):0) + +/*EPID SigRL PSVN TLV*/ +#define EPID_SIGRL_PSVN_TLV_PAYLOAD_SIZE() (sizeof(psvn_t)) +#define EPID_SIGRL_PSVN_TLV_SIZE() get_tlv_total_size(EPID_SIGRL_PSVN_TLV_PAYLOAD_SIZE()) +psvn_t *epid_sigrl_psvn_tlv_get_psvn(const tlv_info_t& info); + +/*EPID group certificate TLV*/ +#define EPID_GROUP_CERT_TLV_PAYLOAD_SIZE() (sizeof(signed_epid_group_cert_t)) +#define EPID_GROUP_CERT_TLV_SIZE() get_tlv_total_size(EPID_GROUP_CERT_TLV_PAYLOAD_SIZE()) + +/*Device ID TLV*/ +#define DEVICE_ID_TLV_PAYLOAD_SIZE() (sizeof(ppid_t)+sizeof(fmsp_t)+sizeof(psvn_t)) +#define DEVICE_ID_TLV_SIZE() get_tlv_total_size(DEVICE_ID_TLV_PAYLOAD_SIZE()) +ppid_t *device_id_tlv_get_ppid(const tlv_info_t& info); +fmsp_t *device_id_tlv_get_fmsp(const tlv_info_t& info); +psvn_t *device_id_tlv_get_psvn(const tlv_info_t& info); + +/*PSID TLV*/ +#define PSID_TLV_PAYLOAD_SIZE() (sizeof(psid_t)) +#define PSID_TLV_SIZE() get_tlv_total_size(PSID_TLV_PAYLOAD_SIZE()) +psid_t *psid_tlv_get_psid(const tlv_info_t& info); + +/*Join Proof TLV*/ +#define EPID_JOIN_PROOF_TLV_PAYLOAD_SIZE() (JOIN_PROOF_SIZE+BLIND_ESCROW_SIZE) +#define EPID_JOIN_PROOF_TLV_SIZE() get_tlv_total_size(EPID_JOIN_PROOF_TLV_PAYLOAD_SIZE()) + +/*EPID Signature TLV*/ +#define EPID_SIGNATURE_TLV_PAYLOAD_SIZE(sign_count) (sizeof(EPIDSignature)+sizeof(NRProof)*(sign_count)-sizeof(NRProof)) +#define EPID_SIGNATURE_TLV_SIZE(sign_count) (LARGE_TLV_HEADER_SIZE+EPID_SIGNATURE_TLV_PAYLOAD_SIZE(sign_count)) /*always use large header size for Signature TLV*/ + +/*EPID Membership Credential TLV*/ +#define MEMBERSHIP_CREDENTIAL_TLV_PAYLOAD_SIZE() (sizeof(membertship_credential_with_escrow_t)) +#define MEMBERSHIP_CREDENTIAL_TLV_SIZE() get_tlv_total_size(MEMBERSHIP_CREDENTIAL_TLV_PAYLOAD_SIZE()) +PElemStr *membership_credential_tlv_get_x(const tlv_info_t& info); +G1ElemStr *membership_credential_tlv_get_A(const tlv_info_t& info); + +/*FLAGS TLV*/ +#define FLAGS_TLV_PAYLOAD_SIZE() FLAGS_SIZE +#define FLAGS_TLV_SIZE() get_tlv_total_size(FLAGS_TLV_PAYLOAD_SIZE()) + +#define ES_SELECTOR_TLV_PAYLOAD_SIZE() 2 +#define ES_SELECTOR_TLV_SIZE() get_tlv_total_size(ES_SELECTOR_TLV_PAYLOAD_SIZE()) +uint8_t *es_selector_tlv_get_es_type(const tlv_info_t& info); +uint8_t *es_selector_tlv_get_selector_id(const tlv_info_t& info); + +class TLVsMsg{ + uint32_t num_infos; + tlv_info_t* infos; + tlv_msg_t msg; + CLASS_UNCOPYABLE(TLVsMsg) +protected: + void clear(){ + if(msg.msg_buf!=NULL){free(msg.msg_buf);msg.msg_buf=NULL;msg.msg_size=0;} + if(infos!=NULL){free(infos);infos=NULL;num_infos=0;} + } + tlv_status_t alloc_more_buffer(uint32_t buffer, tlv_msg_t& new_buf); + tlv_status_t create_new_info(tlv_info_t *& new_info){ + if(num_infos==0){ + assert(infos==NULL); + infos = (tlv_info_t *)malloc(sizeof(tlv_info_t)); + if(infos==NULL) return TLV_OUT_OF_MEMORY_ERROR; + num_infos=1; + new_info = infos; + }else{ + tlv_info_t * p = (tlv_info_t *)malloc(sizeof(tlv_info_t)*(num_infos+1)); + if(p==NULL){ + return TLV_OUT_OF_MEMORY_ERROR; + } + if(0!=memcpy_s(p, sizeof(tlv_info_t)*(num_infos+1), infos, sizeof(tlv_info_t)*num_infos)){ + free(p); + return TLV_UNKNOWN_ERROR; + } + free(infos); + infos = p; + new_info = infos + (num_infos); + num_infos ++; + } + return TLV_SUCCESS; + } +public: + TLVsMsg(){ + num_infos = 0; + infos = NULL; + msg.msg_size = 0; + msg.msg_buf = NULL; + } + ~TLVsMsg(){ + clear(); + } + tlv_status_t init_from_buffer(const uint8_t *msg, uint32_t msg_size); + tlv_status_t init_from_tlv_msg(const tlv_msg_t& tlv_msg); + uint32_t get_tlv_count()const{return num_infos;} + tlv_info_t& operator[](uint32_t x){ + assert(x +#include +#include "IAESMLogic.h" +#include + +class AESMLogicWrapper :public IAESMLogic { + public: + AESMLogicWrapper() { + } + + ae_error_t service_start(){ + return AESMLogic::service_start(); + } + + void service_stop(); + + virtual aesm_error_t initQuote(uint8_t *target_info, + uint32_t target_info_length, + uint8_t *gid, + uint32_t gid_length); + + virtual aesm_error_t getQuote(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, uint8_t* quote, + uint32_t qe_reportSize, uint8_t* qe_report); + + virtual aesm_error_t closeSession(uint32_t sessionId); + + virtual aesm_error_t createSession(uint32_t *session_id, + uint8_t *se_dh_msg1, + uint32_t se_dh_msg1_size); + + virtual aesm_error_t exchangeReport(uint32_t session_id, + const uint8_t* se_dh_msg2, + uint32_t se_dh_msg2_size, + uint8_t* se_dh_msg3, + uint32_t se_dh_msg3_size); + + virtual aesm_error_t getLaunchToken(const uint8_t *measurement, + uint32_t measurement_size, + const uint8_t *public_key, + uint32_t public_key_size, + const uint8_t *se_attributes, + uint32_t se_attributes_size, + uint8_t **launch_token, + uint32_t *launch_token_size); + + virtual aesm_error_t invokeService(const uint8_t *pse_message_req, + uint32_t pse_message_req_size, + uint8_t *pse_message_resp, + uint32_t pse_message_resp_size); + + virtual aesm_error_t getPsCap(uint64_t* ps_cap); + virtual aesm_error_t reportAttestationStatus(uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_error_code, + uint8_t* update_info, uint32_t update_info_size); + + private: + AESMLogicWrapper& operator=(const AESMLogicWrapper&); + AESMLogicWrapper(const AESMLogicWrapper&); +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueue.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueue.h new file mode 100644 index 0000000000..31cb79d86d --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueue.h @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef AESM_QUEUE_H +#define AESM_QUEUE_H + +#include +#include +#include "RequestData.h" +#include "IAERequest.h" +#include "IAESMQueue.h" +#include + +template +class AESMQueue : public IAESMQueue { + public: + AESMQueue(); + ~AESMQueue(); + + void push(T*); + T* blockingPop(); + void close(); + + private: + std::queue m_queue; + pthread_cond_t m_queueCond; + pthread_mutex_t m_queueMutex; + volatile uint8_t m_events; + private: + AESMQueue& operator=(const AESMQueue&); + AESMQueue(const AESMQueue&); +}; + +#define QUEUE_EVENT_CLOSE 1 + +template +AESMQueue::AESMQueue() : + m_queue() +{ + int rc; + + rc = pthread_mutex_init(&m_queueMutex, NULL); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to initialize mutex"); + exit(-1); + } + + rc = pthread_cond_init(&m_queueCond, NULL); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to initialize a condition variable"); + exit(-1); + } + + m_events = 0; +} + +template +AESMQueue::~AESMQueue() +{ + int rc; + + rc = pthread_mutex_destroy(&m_queueMutex); + if (rc != 0) + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to destroy mutex"); + + rc = pthread_cond_destroy(&m_queueCond); + if (rc != 0) + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to destory a condition variable"); + +} + +template +void AESMQueue::push(T* value) +{ + int rc; + + rc = pthread_mutex_lock(&m_queueMutex); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to acquire mutex"); + exit(-1); + } + + m_queue.push(value); + + // m_events |= QUEUE_EVENT_INSERT; + rc = pthread_cond_signal(&m_queueCond); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to signal condition"); + exit(-1); + } + + rc = pthread_mutex_unlock(&m_queueMutex); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to unlock mutex"); + exit(-1); + } +} + +template +T* AESMQueue::blockingPop() +{ + int rc; + T* value = NULL; + + rc = pthread_mutex_lock(&m_queueMutex); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to acquire mutex"); + exit(-1); + } + + while(1) { + // check CLOSE event + if (m_events & QUEUE_EVENT_CLOSE) { + //epmty the queue + while (!m_queue.empty()) + { + value = m_queue.front(); + m_queue.pop(); + delete value; + } + value = NULL; + break; + } + if (!m_queue.empty()) { + // queue is not empty + value = m_queue.front(); + m_queue.pop(); + break; + } + else { + rc = pthread_cond_wait(&m_queueCond, &m_queueMutex); + + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed wait on a condition"); + exit(-1); + } + } + } + + rc = pthread_mutex_unlock(&m_queueMutex); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to unlock mutex"); + exit(-1); + } + + return value; +} + +template +void AESMQueue::close() +{ + int rc; + + rc = pthread_mutex_lock(&m_queueMutex); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to acquire mutex"); + exit(-1); + } + + m_events |= QUEUE_EVENT_CLOSE; + rc = pthread_cond_signal(&m_queueCond); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to signal a condition"); + exit(-1); + } + + rc = pthread_mutex_unlock(&m_queueMutex); + if (rc != 0) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Failed to unlock mutex"); + exit(-1); + } +} + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueueManager.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueueManager.h new file mode 100644 index 0000000000..90e1497c81 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMQueueManager.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef AESM_QUEUE_MANAGER_H +#define AESM_QUEUE_MANAGER_H + +#include "RequestData.h" +#include "AESMWorkerThread.h" +#include + +class AESMQueueManager +{ + public: + AESMQueueManager( + AESMWorkerThread *quotingThread, + AESMWorkerThread *launchThread, + AESMWorkerThread *platformServiceThread + ); + + ~AESMQueueManager(); + + void enqueue(RequestData* requestData); + + void shutDown(); + private: + AESMQueueManager& operator=(const AESMQueueManager&); + AESMQueueManager(const AESMQueueManager&); + void startQueueThreads(); + + AESMWorkerThread* m_quotingThread; + AESMWorkerThread* m_launchThread; + AESMWorkerThread* m_platformServiceThread; +}; + +#endif //AESM_QUEUE_MANAGER_H diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMWorkerThread.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMWorkerThread.h new file mode 100644 index 0000000000..acf943d505 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMWorkerThread.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_WORKER_THREAD_H_ +#define _AESM_WORKER_THREAD_H_ +#include "Thread.h" +#include "IAESMLogic.h" +#include "IAESMQueue.h" +#include "ITransporter.h" +#include "RequestData.h" + + +class AESMWorkerThread : public Thread +{ + public: + AESMWorkerThread(IAESMLogic& aesmLogic, ITransporter& transporter, IAESMQueue* queue); + ~AESMWorkerThread(); + virtual void enqueue(RequestData* request); + virtual void shutDown(); + private: + virtual void run(); + AESMWorkerThread& operator=(const AESMWorkerThread&); + AESMWorkerThread(const AESMWorkerThread&); + IAESMLogic &m_aesmLogic; + ITransporter &m_transporter; + IAESMQueue *m_queue; +}; +#endif + + diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/CAESMServer.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/CAESMServer.h new file mode 100644 index 0000000000..422bbcdb9d --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/CAESMServer.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _CAESM_SERVER_H_ +#define _CAESM_SERVER_H_ + +#include "CSelector.h" +#include "IServerSocket.h" +#include "ITransporter.h" +#include "ISerializer.h" +#include "IAESMLogic.h" +#include "AESMQueueManager.h" +#include + +using namespace std; + +/* + * Encapsulates all AESM server logic + */ +class CAESMServer +{ +public: + virtual ~CAESMServer(); + CAESMServer(IServerSocket* server_sock, CSelector* selector, IAESMLogic* aesmLogic); + + void doWork(); + void shutDown(); + void init(); + + //creates an AESMQueueManager instance with three queues and three work threads (one for each event class) + static AESMQueueManager* constructAESMQueueManager(IAESMLogic& aesmLogic, ITransporter& transporter); + +protected: + + IServerSocket* m_serverSocket; + CSelector* m_selector; + ITransporter* m_transporter; + AESMQueueManager* m_queueManager; + IAESMLogic* m_aesmLogic; + bool m_shutDown; + int m_fdPipe[2]; + +private: + CAESMServer& operator=(const CAESMServer&); + CAESMServer(const CAESMServer&); +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/CSelector.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/CSelector.h new file mode 100644 index 0000000000..6ba0d4e97b --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/CSelector.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _SELECTOR_H +#define _SELECTOR_H + +#include +#include "IServerSocket.h" +#include +#include + +class ICommunicationSocket; + +class CSelector +{ +public: + + CSelector(IServerSocket* serverSock); + virtual ~CSelector(); + + virtual void addSocket(ICommunicationSocket*); + virtual void removeSocket(ICommunicationSocket*); + + virtual bool select(int fd_term = -1); + virtual bool canAcceptConnection(); + virtual std::list getSocsWithNewContent(); + +private: + CSelector& operator=(const CSelector&); + CSelector(const CSelector&); + + IServerSocket* m_serverSock; + std::list m_connectedSockets; + fd_set m_workingSet; +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/IAESMQueue.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/IAESMQueue.h new file mode 100644 index 0000000000..6e2df26c7f --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/IAESMQueue.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef IAESM_QUEUE_H +#define IAESM_QUEUE_H + +template +class IAESMQueue { + public: + virtual void push(T*) = 0; + virtual T* blockingPop() = 0; + virtual void close() = 0; + virtual ~IAESMQueue() {} +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/IServerSocket.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/IServerSocket.h new file mode 100644 index 0000000000..ae8e3175b4 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/IServerSocket.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _I_SERVER_SOCKET_H +#define _I_SERVER_SOCKET_H + +/* + Interface for the server socket; + Will be used to accept connections from clients. +*/ +class ICommunicationSocket; + +class IServerSocket +{ +public: + virtual void init() = 0; + virtual int getSockDescriptor() = 0; + virtual ICommunicationSocket* accept() = 0; + virtual ~IServerSocket() {}; +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/RequestData.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/RequestData.h new file mode 100644 index 0000000000..d4a75757d5 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/RequestData.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _REQUEST_DATA_H +#define _REQUEST_DATA_H + +#include "ICommunicationSocket.h" +#include "IAERequest.h" + +class RequestData { + public: + RequestData(ICommunicationSocket* socket = NULL, IAERequest* request = NULL): m_socket(socket), m_request(request) {}; + ~RequestData() + { + delete m_socket; + delete m_request; + } + void setSocket(ICommunicationSocket* socket) { m_socket = socket; } + void setRequest(IAERequest* request) { m_request = request; } + + ICommunicationSocket* getSocket() { return m_socket; } + IAERequest* getRequest() { return m_request; } + + private: + ICommunicationSocket* m_socket; + IAERequest* m_request; + RequestData& operator=(const RequestData& other); + RequestData(const RequestData& other); +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/Thread.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/Thread.h new file mode 100644 index 0000000000..6f2dda55e7 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/Thread.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_WRAPPER_THREAD_H_ +#define _AESM_WRAPPER_THREAD_H_ +#include + +class Thread +{ + public: + Thread(); + virtual ~Thread(); + + void start(); + + void stop(); //set a flag to signal the thread to be stopped. It is the run() implementation's responsibility to check this and to return. + bool isStopped(); + void join(); + + private: + void virtual run() = 0; + Thread& operator=(const Thread&); + Thread(const Thread&); + + volatile bool m_shutDown; + pthread_t m_thread; + static void* doWork(void* param); + + +}; +#endif + diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/UnixServerSocket.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/UnixServerSocket.h new file mode 100644 index 0000000000..b6afb5f265 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/UnixServerSocket.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _UNIX_SERVER_SOCKET_H +#define _UNIX_SERVER_SOCKET_H + +/* + * Interface for the server socket; + * Will be used to accept connections from clients. +**/ +#include "IServerSocket.h" + +class UnixServerSocket: public IServerSocket +{ +public: + UnixServerSocket(const char* socketbase, const unsigned int clientTimeout = 0); + virtual ~UnixServerSocket(); + + virtual void init(); + virtual ICommunicationSocket* accept(); + + virtual int getSockDescriptor() { return mSocket; } + +private: + UnixServerSocket& operator=(const UnixServerSocket&); + UnixServerSocket(const UnixServerSocket&); + const char* mSocketBase; + int mSocket; + unsigned int mClientTimeout; +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/aesm_exception.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/aesm_exception.h new file mode 100644 index 0000000000..9bf3bcc166 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/aesm_exception.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AESM_EXCEPTION_H_ +#define __AESM_EXCEPTION_H_ + +#include + +class aesm_exception{ +public: + aesm_exception(std::string& msg){ + mMsg = msg; + } + + const std::string message() { return mMsg; } + +protected: + std::string mMsg; +}; + +#endif diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp new file mode 100644 index 0000000000..9ff970e0e7 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "AESMLogicWrapper.h" +#include +#include + +#include "LEClass.h" +#include "Config.h" + +aesm_error_t AESMLogicWrapper::initQuote(uint8_t *target_info, + uint32_t target_info_length, + uint8_t *gid, + uint32_t gid_length) +{ + return AESMLogic::init_quote(target_info, target_info_length, + gid, gid_length); +} + +aesm_error_t AESMLogicWrapper::getQuote(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, uint8_t* quote, + uint32_t qe_reportSize, uint8_t* qe_report) +{ + + return AESMLogic::get_quote(report, reportLength, + quoteType, + spid, spidLength, + nonce, nonceLength, + sig_rl, sig_rlLength, + qe_report, qe_reportSize, + quote, bufferSize); + +} + +aesm_error_t AESMLogicWrapper::closeSession(uint32_t sessionId) +{ + return AESMLogic::close_session(sessionId); +} + +aesm_error_t AESMLogicWrapper::createSession(uint32_t *session_id, + uint8_t *se_dh_msg1, + uint32_t se_dh_msg1_size) +{ + + return AESMLogic::create_session(session_id, se_dh_msg1, se_dh_msg1_size); + +} + +aesm_error_t AESMLogicWrapper::exchangeReport(uint32_t session_id, + const uint8_t* se_dh_msg2, + uint32_t se_dh_msg2_size, + uint8_t* se_dh_msg3, + uint32_t se_dh_msg3_size ) +{ + return AESMLogic::exchange_report(session_id, + se_dh_msg2, + se_dh_msg2_size, + se_dh_msg3, + se_dh_msg3_size); +} + +aesm_error_t AESMLogicWrapper::getLaunchToken(const uint8_t *measurement, + uint32_t measurement_size, + const uint8_t *mrsigner, + uint32_t mrsigner_size, + const uint8_t *se_attributes, + uint32_t se_attributes_size, + uint8_t **launch_token, + uint32_t *launch_token_size) +{ + *launch_token_size = sizeof(token_t); + *launch_token = new uint8_t[*launch_token_size]; + + return AESMLogic::get_launch_token(measurement, + measurement_size, + mrsigner, + mrsigner_size, + se_attributes, + se_attributes_size, + *launch_token, + *launch_token_size); + +} + +aesm_error_t AESMLogicWrapper::invokeService(const uint8_t *pse_message_req, + uint32_t pse_message_req_size, + uint8_t *pse_message_resp, + uint32_t pse_message_resp_size) +{ + return AESMLogic::invoke_service(pse_message_req, + pse_message_req_size, + pse_message_resp, + pse_message_resp_size); +} + +aesm_error_t AESMLogicWrapper::getPsCap(uint64_t* ps_cap) +{ + return AESMLogic::get_ps_cap(ps_cap); +} + +aesm_error_t AESMLogicWrapper::reportAttestationStatus(uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_error_code, + uint8_t* update_info, uint32_t update_info_size) + +{ + return AESMLogic::report_attestation_status(platform_info,platform_info_size, + attestation_error_code, + update_info, update_info_size); +} + +void AESMLogicWrapper::service_stop() +{ + AESMLogic::service_stop(); +} diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/AESMQueueManager.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMQueueManager.cpp new file mode 100644 index 0000000000..1b3686d11f --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMQueueManager.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "AESMQueueManager.h" +#include "IAERequest.h" + +#include + +AESMQueueManager::AESMQueueManager( + AESMWorkerThread *quotingThread, + AESMWorkerThread *launchThread, + AESMWorkerThread *platformServiceThread + ) : + m_quotingThread(quotingThread), + m_launchThread(launchThread), + m_platformServiceThread(platformServiceThread) +{ + startQueueThreads(); +} + +AESMQueueManager::~AESMQueueManager() +{ + delete m_quotingThread; + delete m_launchThread; + delete m_platformServiceThread; +} + +void AESMQueueManager::startQueueThreads() +{ + m_launchThread->start(); + m_quotingThread->start(); + m_platformServiceThread->start(); +} + +void AESMQueueManager::enqueue(RequestData* requestData) +{ + if(requestData != NULL && requestData->getRequest() != NULL) + { + switch (requestData->getRequest()->getRequestClass()) { + case IAERequest::QUOTING_CLASS: + m_quotingThread->enqueue(requestData); + break; + case IAERequest::LAUNCH_CLASS: + m_launchThread->enqueue(requestData); + break; + case IAERequest::PLATFORM_CLASS: + m_platformServiceThread->enqueue(requestData); + break; + default: //if we reach this point, this could only mean a corrupted or a forged message. In any case, close the connection + // Closing the connection will translate in an IPC error on the client side in case of corruption (and we would be correct), or in unexpected manner for forged messages (the case of an attacker client) + delete requestData; //this will delete the socket also. + AESM_LOG_ERROR("Malformed request received (May be forged for attack)"); + } + + } +} + +void AESMQueueManager::shutDown() +{ + m_launchThread->shutDown(); + m_quotingThread->shutDown(); + m_platformServiceThread->shutDown(); +} diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/AESMWorkerThread.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMWorkerThread.cpp new file mode 100644 index 0000000000..c698997e52 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMWorkerThread.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "AESMWorkerThread.h" +#include "RequestData.h" +#include "IAEResponse.h" + +AESMWorkerThread::AESMWorkerThread(IAESMLogic& aesmLogic, ITransporter& transporter, IAESMQueue* queue) + : m_aesmLogic(aesmLogic), + m_transporter(transporter), + m_queue(queue) +{} + +AESMWorkerThread::~AESMWorkerThread() +{ + shutDown(); + delete m_queue; +} + +/*override*/ +void AESMWorkerThread::run() +{ + while (!isStopped()) { + RequestData* requestData = m_queue->blockingPop(); + if (isStopped()) + break; + IAEResponse *response = requestData->getRequest()->execute(&m_aesmLogic); + m_transporter.sendResponse(response, requestData->getSocket()); + delete requestData; + delete response; + } +} + +void AESMWorkerThread::enqueue(RequestData* requestData) +{ + if (isStopped()) { + //! [mlu] don't like the silent ignore; at least a log should go here. + return; + } + m_queue->push(requestData); +} + +void AESMWorkerThread::shutDown() +{ + stop(); + m_queue->close(); + join(); +} + +/*--------------------------------------------------------------------------------------------------*/ diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/CAESMServer.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/CAESMServer.cpp new file mode 100644 index 0000000000..ad4764e11b --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/CAESMServer.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "CAESMServer.h" +#include "SocketTransporter.h" +#include "ProtobufSerializer.h" +#include "RequestData.h" +#include "AESMQueue.h" +#include "AESMWorkerThread.h" + +#include +#include +#include + + + +/*static*/ +AESMQueueManager* CAESMServer::constructAESMQueueManager(IAESMLogic& aesmLogic, ITransporter& transporter) +{ + return new AESMQueueManager( + new AESMWorkerThread(aesmLogic, transporter, new AESMQueue()), + new AESMWorkerThread(aesmLogic, transporter, new AESMQueue()), + new AESMWorkerThread(aesmLogic, transporter, new AESMQueue()) + ); +} + +CAESMServer::CAESMServer(IServerSocket* server_sock, CSelector* selector, IAESMLogic* aesmLogic): + m_serverSocket(server_sock), + m_selector(selector), + m_aesmLogic(aesmLogic), + m_shutDown(false) +{ + // Dependency injection + ISerializer* serializer = new ProtobufSerializer(); + m_transporter = new SocketTransporter(NULL, serializer); + + m_queueManager = constructAESMQueueManager(*aesmLogic, *m_transporter); +} + +CAESMServer::~CAESMServer() +{ + delete m_transporter; + delete m_queueManager; + delete m_serverSocket; + delete m_selector; + delete m_aesmLogic; +} + +/* + * Verify that the server was initialized with proper parameters + * Create the worker thread for the server; + * This function will throw whatever it is that the called functions throw. + */ +void CAESMServer::init() +{ + if(NULL == this->m_serverSocket || + NULL == this->m_selector) + { + std::string msg("null members"); + throw new aesm_exception(msg); + } + + this->m_serverSocket->init(); +} + +void CAESMServer::doWork() +{ + // pipe is used to prevent select from blocking current thread + if (pipe(m_fdPipe) < 0) { + std::string msg("failed to create pipe"); + throw new aesm_exception(msg); + } + + while(!m_shutDown) { + + if (!m_selector->select(m_fdPipe[0])) + break; + + if(m_selector->canAcceptConnection()) + { + ICommunicationSocket* commSock = this->m_serverSocket->accept(); + if (commSock == NULL) + continue; + + m_selector->addSocket(commSock); + } + + std::list socketsWithData = m_selector->getSocsWithNewContent(); + std::list::const_iterator it = socketsWithData.begin(); + + for (;it != socketsWithData.end(); ++it) { + try { + IAERequest *request = m_transporter->receiveRequest(*it); + RequestData *requestData = new RequestData(*it, request); //deleted by the AESMWorkerThread after response is sent + + m_queueManager->enqueue(requestData); + + } catch (SockDisconnectedException& e) { + m_selector->removeSocket(*it); + } + } + } + + close(m_fdPipe[0]); + close(m_fdPipe[1]); +} + +void CAESMServer::shutDown() +{ + m_shutDown = true; + + // notify CSelector to terminate + if (write(m_fdPipe[1], &m_fdPipe[1], sizeof(int)) < 0) + { + // do nothing + } + + m_aesmLogic->service_stop(); +} diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/CSelector.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/CSelector.cpp new file mode 100644 index 0000000000..f69c559c20 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/CSelector.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "CSelector.h" +#include "ICommunicationSocket.h" +#include +#include +#include +#include + +CSelector::CSelector(IServerSocket* serverSock) : + m_serverSock(serverSock) +{ + m_connectedSockets.clear(); + FD_ZERO(&m_workingSet); +} + + +CSelector::~CSelector() +{ +} + +void CSelector::addSocket(ICommunicationSocket* socket) +{ + m_connectedSockets.push_back(socket); +} + +void CSelector::removeSocket(ICommunicationSocket* socket) +{ + m_connectedSockets.remove(socket); +} + +bool CSelector::select(int fd_term) +{ + int max_sd; + std::list::const_iterator it = m_connectedSockets.begin(); + + FD_ZERO(&m_workingSet); + FD_SET(m_serverSock->getSockDescriptor(), &m_workingSet); + max_sd = m_serverSock->getSockDescriptor(); + + if (fd_term != -1) { + // a pipe is setup to prevent select from blocking current thread + FD_SET(fd_term, &m_workingSet); + if (fd_term > max_sd) + max_sd = fd_term; + } + + for(; it!=m_connectedSockets.end(); ++it) { + int sock_fd = (*it)->getSockDescriptor(); + if (sock_fd > max_sd) + max_sd = sock_fd; + + FD_SET(sock_fd, &m_workingSet); + } + + int rc = (int) TEMP_FAILURE_RETRY(::select(max_sd + 1, &m_workingSet, NULL, NULL, NULL)); + if (rc < 0) { + throw "Select failed"; /* TODO throw a specific exception */ + } + + if (fd_term != -1 && FD_ISSET(fd_term, &m_workingSet)) + return false; + + return true; +} + +bool CSelector::canAcceptConnection() +{ + if (FD_ISSET(m_serverSock->getSockDescriptor(), &m_workingSet)) { + return true; + } else { + return false; + } +} + +std::list CSelector::getSocsWithNewContent() +{ + std::list socketswithContent; + std::list::iterator it = m_connectedSockets.begin(); + + while( it!=m_connectedSockets.end()) + { + if (FD_ISSET((*it)->getSockDescriptor(), &m_workingSet)) { + socketswithContent.push_back(*it); + m_connectedSockets.erase(it++); + } else { + ++it; + } + } + + return socketswithContent; +} diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/Thread.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/Thread.cpp new file mode 100644 index 0000000000..7339b05f30 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/Thread.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "Thread.h" +#include +#include +#include +#include +#include "util.h" + + +/*--------------------------------------------------------------------------------------------------*/ + +Thread::Thread() + : m_shutDown(false), m_thread(0) +{ +} + +Thread::~Thread() +{ +} + +void Thread::start() +{ + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); + pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); + + int rc = pthread_create(&m_thread, &attr, Thread::doWork, (void*)this); + assert(rc == 0); + UNUSED(rc); + + pthread_attr_destroy(&attr); +} + +void Thread::stop() +{ + m_shutDown = true; +} + +bool Thread::isStopped() +{ + return m_shutDown; +} + +/*virtual*/ +void Thread::run() +{ +} + +/*static*/ +void* Thread::doWork(void* param) +{ + //! [MLU] is this safe for derived classes? + try + { + Thread* thread = static_cast(param); + thread->run(); + } + catch(std::bad_alloc& allocationException) + { + aesm_log_report(AESM_LOG_REPORT_ERROR, "Unable to allocate memory"); + throw; + } + + return NULL; +}; + + +void Thread::join() +{ + void* res; + pthread_join(m_thread, &res); +} + +/*--------------------------------------------------------------------------------------------------*/ diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/UnixServerSocket.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/UnixServerSocket.cpp new file mode 100644 index 0000000000..a9228f889d --- /dev/null +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/UnixServerSocket.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include + +#include "NonBlockingUnixCommunicationSocket.h" +#include "UnixServerSocket.h" + +UnixServerSocket::UnixServerSocket(const char* socketbase, const unsigned int clientTimeout) : + mSocketBase(socketbase), + mSocket(-1), + mClientTimeout(clientTimeout) +{ +} + +UnixServerSocket::~UnixServerSocket() { + if (mSocket > 0) + close(mSocket); +} + +void UnixServerSocket::init() +{ + /* init will always return directly with success if object was created with pre-existent socket */ + if (mSocket > 0) + return; + + struct sockaddr_un server_address; + + mSocket = socket(AF_UNIX, SOCK_STREAM, 0); + if (mSocket < 0) { + throw("Failed to create socket"); + } + + server_address.sun_family = AF_UNIX; + memset(server_address.sun_path, 0, sizeof(server_address.sun_path)); + // leave the first byte to 0 in order to have an abstract socket address + strncpy(server_address.sun_path + 1, mSocketBase, sizeof(server_address.sun_path) - 1); + unlink(server_address.sun_path); + + socklen_t server_len = sizeof(server_address); + int rc = bind(mSocket, (sockaddr*)&server_address, server_len); + if (rc < 0) { + close(mSocket); + throw("Failed to create socket"); + } + + rc = listen(mSocket, 32); + if (rc < 0) { + close(mSocket); + throw("Error listening on socket"); + } +} + +ICommunicationSocket* UnixServerSocket::accept() +{ + int client_sockfd = (int) TEMP_FAILURE_RETRY(::accept(mSocket, NULL, NULL)); + if (client_sockfd < 0) + return NULL; + + NonBlockingUnixCommunicationSocket* sock = new NonBlockingUnixCommunicationSocket(client_sockfd); + + bool initializationSuccessfull = false; + + if (sock != NULL) + initializationSuccessfull = sock->init(); + + if (initializationSuccessfull == false) + { + delete sock; + sock = NULL; + } + else + { + //set AESM specific timeout for operations with client sockets + sock->setTimeout(mClientTimeout); + } + + return sock; +} diff --git a/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp b/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp new file mode 100644 index 0000000000..26f1beedb5 --- /dev/null +++ b/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "provision_msg.h" +#include "type_length_value.h" +#include +#include "PVEClass.h" +#include "aesm_rand.h" +#include "se_wrapper.h" +#include "epid_utility.h" +#include "prof_fun.h" +#include "oal/internal_log.h" +#include + +static ae_error_t prov_es_gen_header(provision_request_header_t *es_header, + const uint8_t *xid, + uint32_t msg_buffer_size) +{ + uint32_t total_size = 0; + + total_size = ES_SELECTOR_TLV_SIZE(); + //initialize ES Msg1 Header + es_header->protocol = ENDPOINT_SELECTION; + es_header->type = TYPE_ES_MSG1; + es_header->version = TLV_VERSION_1; + if(0!=memcpy_s(es_header->xid, XID_SIZE, xid, XID_SIZE)){ + AESM_DBG_FATAL("memcpy error"); + return PVE_UNEXPECTED_ERROR; + } + uint32_t size_in; + size_in = _htonl(total_size);//big endian size required in msg header + if(0!=memcpy_s(&es_header->size,sizeof(es_header->size), &size_in, sizeof(size_in))){ + AESM_DBG_FATAL("memcpy error"); + return PVE_UNEXPECTED_ERROR; + } + if(total_size +sizeof(*es_header) >msg_buffer_size){//the input msg body buffer size is not large enough + AESM_DBG_ERROR("input msg buffer is too small"); + return PVE_INSUFFICIENT_MEMORY_ERROR; + } + return AE_SUCCESS; +} + +uint32_t CPVEClass::gen_es_msg1( + uint8_t *msg, + uint32_t msg_size, + const gen_endpoint_selection_output_t& es_output) +{ + ae_error_t ret; + AESM_PROFILE_FUN; + if(msg_size < PROVISION_REQUEST_HEADER_SIZE) + return PVE_INSUFFICIENT_MEMORY_ERROR; + provision_request_header_t *es_header = reinterpret_cast(msg); + + ret = prov_es_gen_header(es_header, es_output.xid, msg_size); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Endpoint Selection Msg1 Header:%d",ret); + return ret; + } + + { + TLVsMsg tlvs_msg; + tlv_status_t tlv_status = tlvs_msg.add_es_selector(SE_EPID_PROVISIONING, es_output.selector_id); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("fail to create ES Selector TLV:%d",ret); + return ret; + } + assert(tlvs_msg.get_tlv_msg_size()<=msg_size - PROVISION_REQUEST_HEADER_SIZE); //The checking should have been done in prov_es_gen_header + if(0!=memcpy_s(msg+PROVISION_REQUEST_HEADER_SIZE, msg_size-PROVISION_REQUEST_HEADER_SIZE, tlvs_msg.get_tlv_msg(), tlvs_msg.get_tlv_msg_size())){ + AESM_DBG_FATAL("memcpy failed"); + return PVE_UNEXPECTED_ERROR; + } + return AE_SUCCESS; + } +} + +#define ES_MSG2_FIELD_COUNT 3 +#define ES_FIELD0_MIN_SIZE 3 +#define ES_FIELD0_MAX_SIZE (MAX_PATH-1) +uint32_t CPVEClass::proc_es_msg2( + const uint8_t *msg, + uint32_t msg_size, + char server_url[MAX_PATH], + uint16_t& ttl, + const uint8_t xid[XID_SIZE], + uint8_t rsa_signature[PVE_RSA_KEY_BYTES], + signed_pek_t& pek) +{ + uint32_t ae_ret = PVE_MSG_ERROR; + TLVsMsg tlvs_msg; + AESM_PROFILE_FUN; + tlv_status_t tlv_status; + uint16_t time_in_net; + const provision_response_header_t *resp_header = (const provision_response_header_t *)msg; + const uint8_t *resp_body = msg + PROVISION_RESPONSE_HEADER_SIZE; + if(msg_sizeprotocol != ENDPOINT_SELECTION || resp_header->version!=TLV_VERSION_1 || resp_header->type != TYPE_ES_MSG2){ + AESM_DBG_ERROR("ES Msg2 header error"); + goto final_point; + } + ae_ret = check_endpoint_pg_stauts(resp_header); + if(AE_SUCCESS != ae_ret){ + AESM_DBG_ERROR("Backend report error in ES Msg2 Header:%d",ae_ret); + goto final_point; + } + if(0!=memcmp(xid, resp_header->xid, XID_SIZE)){ + AESM_DBG_ERROR("XID in ES Msg2 header doesn't match the one in ES Msg1"); + ae_ret = PVE_MSG_ERROR; + goto final_point; + } + uint32_t size; size = GET_BODY_SIZE_FROM_PROVISION_RESPONSE(msg); + if(size + PROVISION_RESPONSE_HEADER_SIZE != msg_size){ //size information inconsistent + AESM_DBG_ERROR("message size inconsistent in ES Msg2"); + ae_ret = PVE_MSG_ERROR; + goto final_point; + } + tlv_status = tlvs_msg.init_from_buffer(resp_body, msg_size - static_cast(PROVISION_RESPONSE_HEADER_SIZE)); + ae_ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ae_ret){ + AESM_DBG_ERROR("Fail to decode ES Msg2:%d",ae_ret); + goto final_point; + } + if(tlvs_msg.get_tlv_count() != ES_MSG2_FIELD_COUNT){//three TLVs + AESM_DBG_ERROR("Invaid number of TLV in ES Msg2"); + ae_ret = PVE_MSG_ERROR; + goto final_point; + } + if(tlvs_msg[0].type != TLV_ES_INFORMATION || tlvs_msg[0].version != TLV_VERSION_1 || tlvs_msg[0].header_size != SMALL_TLV_HEADER_SIZE){//TLV header checking + AESM_DBG_ERROR("Invalid TLV in ES Msg2"); + ae_ret = PVE_MSG_ERROR; + goto final_point; + } + + if(tlvs_msg[0].sizeES_FIELD0_MAX_SIZE){//size checking + AESM_DBG_ERROR("Invalid TLV in ES Msg2"); + ae_ret = PVE_MSG_ERROR; + goto final_point; + } + if(tlvs_msg[1].type != TLV_SIGNATURE || tlvs_msg[1].version != TLV_VERSION_1 || + tlvs_msg[1].header_size!=SMALL_TLV_HEADER_SIZE||tlvs_msg[1].size != PVE_RSA_KEY_BYTES+1 || + tlvs_msg[1].payload[0] != PEK_PRIV){ + ae_ret = PVE_MSG_ERROR; + AESM_DBG_ERROR("Invalid Signature TLV: type %d, version %d, size %d while expected value is %d, %d, %d", + tlvs_msg[1].type, tlvs_msg[1].version, tlvs_msg[1].size, + TLV_SIGNATURE, TLV_VERSION_1, PVE_RSA_KEY_BYTES); + goto final_point; + } + if(tlvs_msg[2].type != TLV_PEK || tlvs_msg[2].version != TLV_VERSION_1 || + tlvs_msg[2].header_size!=SMALL_TLV_HEADER_SIZE||tlvs_msg[2].size != sizeof(signed_pek_t)){ + ae_ret = PVE_MSG_ERROR; + AESM_DBG_ERROR("Invalid PEK TLV: type %d, version %d, size %d while expected value is %d, %d, %d", + tlvs_msg[2].type, tlvs_msg[2].version, tlvs_msg[2].size, + TLV_PEK, TLV_VERSION_1, sizeof(signed_pek_t)); + goto final_point; + } + //skip the byte for KEY_ID + if(memcpy_s(rsa_signature, PVE_RSA_KEY_BYTES, tlvs_msg[1].payload+1, tlvs_msg[1].size-1)!=0){ + ae_ret = AE_FAILURE; + AESM_DBG_ERROR("memcpy failed"); + goto final_point; + } + if(memcpy_s(&pek, sizeof(pek), tlvs_msg[2].payload, tlvs_msg[2].size)!=0){ + ae_ret = AE_FAILURE; + AESM_DBG_ERROR("memcpy failed"); + goto final_point; + } + + time_in_net = *(uint16_t *)tlvs_msg[0].payload;//TTL in ES + ttl = lv_ntohs(time_in_net);//First two bytes in payload for TTL (maximal seconds that the URL to be valid) + if(memcpy_s(server_url, MAX_PATH, tlvs_msg[0].payload+2, tlvs_msg[0].size-2)!=0){//other bytes for URL + ae_ret = AE_FAILURE; + AESM_DBG_ERROR("memcpy failed"); + goto final_point; + } + server_url[tlvs_msg[0].size-2]='\0'; + ae_ret = AE_SUCCESS; +final_point: + return ae_ret; +} diff --git a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp new file mode 100644 index 0000000000..ac0b03bd62 --- /dev/null +++ b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "type_length_value.h" +#include "sgx_tcrypto_internal.h" +#include "epid_utility.h" +#include "oal/oal.h" +#include "aeerror.h" +#include "PVEClass.h" +#include "se_wrapper.h" + + /** + * File: epid_provision_msg1.cpp + * Description: Provide the untrusted implementation of code to generate ProvMsg1 + */ + +//For each ProvMsg, the first field is msg header (which including XID) +//But in the code here, XID is not counted as a TLV field(since it is part of msg header) +// and the index of TLV field is started from 0. + +//Msg1 Top TLVs: TLV_CIPHER_TEXT(rsa_oaep_result),E+MAC(encrypted_and_mac_data) +#define MSG1_TOP_FIELDS_COUNT 3 +#define MSG1_TOP_FIELD_RSA_OAEP_DATA msg1_fields[0] +#define MSG1_TOP_FIELD_GCM_DATA msg1_fields[1] +#define MSG1_TOP_FIELD_GCM_MAC msg1_fields[2] + + + +//Function to initialize TLV Header for ProvMsg1 and check whether input buffer for ProvMsg1 is large enough +//field1_data_size[in]: size of field1_data which varies according to whether performance rekey used. +//msg1_buffer_size[in]: size of buffer used to hold generated ProvMsg1, it is used by the function to verify whether size of buffer is large enough +//xid[in]: Transaction ID used in protocol +//msg1_header[out]: request header for ProvMsg1 to fill in +static ae_error_t prov_msg1_gen_header(provision_request_header_t *msg1_header, + uint32_t field1_data_size, + const uint8_t *xid, + uint32_t msg1_buffer_size) +{ + uint32_t total_size = 0; + + if(sizeof(*msg1_header)>msg1_buffer_size){ + AESM_DBG_ERROR("Too small ProvMsg1 buffer size"); + return PVE_INSUFFICIENT_MEMORY_ERROR; + } + total_size = CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES) + BLOCK_CIPHER_TEXT_TLV_SIZE(field1_data_size) +MAC_TLV_SIZE(MAC_SIZE); + //initialize field in Msg1 Header + msg1_header->protocol = SE_EPID_PROVISIONING; + msg1_header->type = TYPE_PROV_MSG1; + msg1_header->version = TLV_VERSION_1; + if(0!=memcpy_s(msg1_header->xid, XID_SIZE, xid, XID_SIZE)){ + AESM_DBG_FATAL("fail in memcpy"); + return PVE_UNEXPECTED_ERROR; + } + uint32_t size_in; + size_in = _htonl(total_size);//big endian size required in msg header + if(0!=memcpy_s(&msg1_header->size, sizeof(msg1_header->size),&size_in, sizeof(size_in))){ + AESM_DBG_FATAL("fail in memcpy"); + return PVE_UNEXPECTED_ERROR; + } + if(total_size +sizeof(*msg1_header) >msg1_buffer_size){//the input msg body size is not large enough + AESM_DBG_ERROR("Too small ProvMsg1 buffer size"); + return PVE_INSUFFICIENT_MEMORY_ERROR; + } + return AE_SUCCESS; +} + +//Function to generate ProvMsg1 +//Input psvn could be NULL to use the current psvn, or input the previous_psvn from preivous ProvMsg2 +//The function will generate a random transaction id which is used by msg header of msg1 +//The function return AE_SUCCESS on success and other to indicate error +//Format of ProvMsg1: RSA-OAEP(SK,PSID),E+MAC(DeviceID[:Flags]) +//@psvn: the input psvn or NULL +//@pek: the input PEK got from endpoint selection +//@performance_rekey_used: true for performance rekey and false for first provisioning, backup retrieval or TCB upgrade +//@msg1: buffer to receive ProvMsg1 (including both header and body) +//@msg1_size: size of buffer for generating ProvMsg1 +//@return AE_SUCCESS on success +uint32_t CPVEClass::gen_prov_msg1(const psvn_t *psvn, + const signed_pek_t& pek, + bool performance_rekey_used, + uint8_t *msg1, + uint32_t msg1_size) +{ + uint32_t ret = AE_SUCCESS; + prov_msg1_output_t msg1_output; + //ProvMsg1 header will be in the beginning part of the output msg + provision_request_header_t *msg1_header = reinterpret_cast(msg1); + memset(&msg1_output, 0, sizeof(msg1_output)); + + ret = gen_prov_msg1_data(psvn, &pek, performance_rekey_used, &msg1_output); + if(AE_SUCCESS !=ret ){ + AESM_DBG_ERROR("Gen ProvMsg1 in trusted code failed:%d",ret); + return ret; + } + + ret = prov_msg1_gen_header(msg1_header, msg1_output.field1_data_size, msg1_output.xid, msg1_size); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("fail to generate ProvMsg1 Header:%d",ret); + return ret; + } + + { + TLVsMsg tlvs_msg1; + tlv_status_t tlv_status; + tlv_status= tlvs_msg1.add_cipher_text(msg1_output.field0, PVE_RSA_KEY_BYTES, PEK_PUB); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to generate field0 TLV of ProvMsg1:%d",ret); + return ret; + } + tlv_status = tlvs_msg1.add_block_cipher_text(msg1_output.field1_iv, msg1_output.field1_data, msg1_output.field1_data_size); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to generate field1 TLV of ProvMsg1:%d",ret); + return ret; + } + tlv_status = tlvs_msg1.add_mac(msg1_output.field1_mac); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to create field2 TLV of ProvMsg1:%d",ret); + return ret; + } + uint32_t size = tlvs_msg1.get_tlv_msg_size(); + if(memcpy_s(msg1+PROVISION_REQUEST_HEADER_SIZE, msg1_size - PROVISION_REQUEST_HEADER_SIZE, + tlvs_msg1.get_tlv_msg(), size)!=0){ + AESM_DBG_FATAL("memcpy error"); + return PVE_UNEXPECTED_ERROR;//The size overflow has been checked in header generation + } + } + return AE_SUCCESS; +} + + diff --git a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp new file mode 100644 index 0000000000..c688b00511 --- /dev/null +++ b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp @@ -0,0 +1,537 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "type_length_value.h" +#include "sgx_tcrypto_internal.h" +#include "epid_utility.h" +#include "aeerror.h" +#include "PVEClass.h" +#include "aesm_rand.h" +#include "se_wrapper.h" +#include + +/** +* File: epid_provision_msg2.cpp +* Description: Provide the untrusted implementation of code to process ProvMsg2 +* +* Untrusted Code for EPID Provision +*/ +#define MSG2_TOP_FIELDS_COUNT_WITH_SIGRL 4 +#define MSG2_TOP_FIELDS_COUNT_WITHOUT_SIGRL 3 +#define MSG2_TOP_FIELD_NONCE tlvs_msg2[0] +#define MSG2_TOP_FIELD_DATA tlvs_msg2[1] +#define MSG2_TOP_FIELD_MAC tlvs_msg2[2] +#define MSG2_TOP_FIELD_SIGRL tlvs_msg2[3] +#define MSG2_FIELD1_MAX_COUNT 8 +#define MSG2_FIELD1_MIN_COUNT 6 +#define MSG2_FIELD1_GROUP_CERT tlvs_field1[0] +#define MSG2_FIELD1_NONCE tlvs_field1[1] +#define MSG2_FIELD1_PREV_PSVN tlvs_field1[2]//optional field +#define MSG2_FIELD1_PSID tlvs_field1[psid_index]//psid_index is 2 if optional PREV_PSVN is not present or 3 if it is present +#define MSG2_FIELD1_ENC_TCB tlvs_field1[psid_index+1] +#define MSG2_FIELD1_MAC_TCB tlvs_field1[psid_index+2] +#define MSG2_FIELD1_DEVICE_ID tlvs_field1[psid_index+3] +#define PREV_GID_INDEX (psid_index+4) +#define MSG2_FIELD1_PREV_GID tlvs_field1[PREV_GID_INDEX] + + +//Function to verify that EPID SigRL type and version is correct for sigrl +static ae_error_t verify_sigrl_cert_type_version(const se_sig_rl_t *sigrl_cert) +{ + if(sigrl_cert->epid_identifier!=SE_EPID_SIG_RL_ID|| + sigrl_cert->protocol_version!=SE_EPID_SIG_RL_VERSION) + return PVE_INTEGRITY_CHECK_ERROR; + return AE_SUCCESS; +} + +static ae_error_t msg2_integrity_checking(const TLVsMsg& tlvs_msg2) +{ + uint32_t tlv_count = tlvs_msg2.get_tlv_count(); + if(tlv_count != MSG2_TOP_FIELDS_COUNT_WITH_SIGRL && tlv_count != MSG2_TOP_FIELDS_COUNT_WITHOUT_SIGRL) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_NONCE.type != TLV_NONCE || MSG2_TOP_FIELD_NONCE.size != NONCE_SIZE || MSG2_TOP_FIELD_NONCE.version != TLV_VERSION_1) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE)//NONCE TLV has small header size + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_DATA.type != TLV_BLOCK_CIPHER_TEXT || MSG2_TOP_FIELD_DATA.version != TLV_VERSION_1) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_MAC.type != TLV_MESSAGE_AUTHENTICATION_CODE || MSG2_TOP_FIELD_MAC.version != TLV_VERSION_1 || MSG2_TOP_FIELD_MAC.size != MAC_SIZE) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_MAC.header_size != SMALL_TLV_HEADER_SIZE) + return PVE_INTEGRITY_CHECK_ERROR; + if(tlv_count == MSG2_TOP_FIELDS_COUNT_WITH_SIGRL){ + if(MSG2_TOP_FIELD_SIGRL.type != TLV_EPID_SIG_RL || MSG2_TOP_FIELD_SIGRL.version != TLV_VERSION_1) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_SIGRL.size < 2*SE_ECDSA_SIGN_SIZE + sizeof(se_sig_rl_t)) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG2_TOP_FIELD_SIGRL.header_size != LARGE_TLV_HEADER_SIZE) + return PVE_INTEGRITY_CHECK_ERROR; + return verify_sigrl_cert_type_version(reinterpret_cast(MSG2_TOP_FIELD_SIGRL.payload)); + } + return AE_SUCCESS; +} + +//check the format of msg2_field1 and copy correspondent data input msg2_blob_input +static ae_error_t msg2_field1_msg_check_copy(const TLVsMsg& tlvs_field1, proc_prov_msg2_blob_input_t& msg2_blob_input, const signed_pek_t& pek) +{ + uint32_t tlv_count = tlvs_field1.get_tlv_count(); + uint32_t psid_index = 2; + msg2_blob_input.is_previous_psvn_provided = false; + if(tlv_countMSG2_FIELD1_MAX_COUNT){ + return PVE_MSG_ERROR; + } + uint32_t i; + for(i=0;i(&pek.n), static_cast(sizeof(pek.n)+sizeof(pek.e)), &psid_hash)); + if(AE_SUCCESS != ret) + return ret; + if(0!=memcmp(&psid_hash, MSG2_FIELD1_PSID.payload, sizeof(psid_hash)))//PSID does not match + return PVE_MSG_ERROR; + + tlv_msg_t tcb_data = block_cipher_tlv_get_encrypted_text(MSG2_FIELD1_ENC_TCB); + if(0!=memcpy_s(&msg2_blob_input.group_cert, sizeof(msg2_blob_input.group_cert), MSG2_FIELD1_GROUP_CERT.payload, MSG2_FIELD1_GROUP_CERT.size)|| + 0!=memcpy_s(&msg2_blob_input.challenge_nonce, CHALLENGE_NONCE_SIZE, MSG2_FIELD1_NONCE.payload, MSG2_FIELD1_NONCE.size)|| + 0!=memcpy_s(&msg2_blob_input.equivalent_psvn, sizeof(psvn_t), device_id_tlv_get_psvn(MSG2_FIELD1_DEVICE_ID),sizeof(psvn_t))|| + 0!=memcpy_s(&msg2_blob_input.fmsp, sizeof(fmsp_t), device_id_tlv_get_fmsp(MSG2_FIELD1_DEVICE_ID), sizeof(fmsp_t))|| + 0!=memcpy_s(&msg2_blob_input.tcb_iv, IV_SIZE, block_cipher_tlv_get_iv(MSG2_FIELD1_ENC_TCB), IV_SIZE)|| + 0!=memcpy_s(&msg2_blob_input.encrypted_tcb, SK_SIZE, tcb_data.msg_buf, tcb_data.msg_size)|| + 0!=memcpy_s(&msg2_blob_input.tcb_mac, MAC_SIZE, MSG2_FIELD1_MAC_TCB.payload, MSG2_FIELD1_MAC_TCB.size)){ + return PVE_UNEXPECTED_ERROR; + } + return AE_SUCCESS; +} + +//Function to check message header of ProvMsg2 to determine whether it is valid +//@msg2_header, input the message header of ProvMsg2 +//@return AE_SUCCESS if the message header is valid ProvMsg2 or error code if there're any problems +static ae_error_t check_prov_msg2_header(const provision_response_header_t *msg2_header, uint32_t msg2_size) +{ + if(msg2_header->protocol != SE_EPID_PROVISIONING || msg2_header->type != TYPE_PROV_MSG2 || + msg2_header->version != TLV_VERSION_1){ + return PVE_INTEGRITY_CHECK_ERROR; + } + uint32_t size_in_header = lv_ntohl(msg2_header->size); + if(size_in_header + PROVISION_RESPONSE_HEADER_SIZE != msg2_size) + return PVE_INTEGRITY_CHECK_ERROR; + return AE_SUCCESS; +} + +static uint32_t estimate_epid_sig_size(uint32_t sigrl_size) +{ + uint32_t sigrl_body_size = 0; + uint32_t sigrl_extra_size = static_cast(sizeof(se_sig_rl_t)-sizeof(SigRLEntry)+2*ECDSA_SIGN_SIZE); + if(sigrl_size<=sigrl_extra_size){ + return static_cast(sizeof(EPIDSignature)-sizeof(NRProof)); + }else{ + sigrl_body_size = sigrl_size - sigrl_extra_size; + size_t entry_count = sigrl_body_size/sizeof(SigRLEntry); + return static_cast(sizeof(EPIDSignature)-sizeof(NRProof)+sizeof(NRProof)*entry_count); + } +} + +static ae_error_t gen_msg3_header(const gen_prov_msg3_output_t& msg3_output, const uint8_t xid[XID_SIZE], provision_request_header_t *msg3_header, uint32_t& msg3_size) +{ + msg3_header->protocol = SE_EPID_PROVISIONING; + msg3_header->version = TLV_VERSION_1; + msg3_header->type = TYPE_PROV_MSG3; + size_t field1_size = 0; + if(msg3_output.is_join_proof_generated){ + field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE)+MAC_TLV_SIZE(MAC_SIZE); + }else{ + field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(0)+MAC_TLV_SIZE(MAC_SIZE); + } + size_t total_body_size = NONCE_TLV_SIZE(NONCE_SIZE) + BLOCK_CIPHER_TEXT_TLV_SIZE(field1_size)+MAC_TLV_SIZE(MAC_SIZE); + if(msg3_output.is_epid_sig_generated){ + total_body_size += BLOCK_CIPHER_TEXT_TLV_SIZE(msg3_output.epid_sig_output_size)+MAC_TLV_SIZE(MAC_SIZE); + } + uint32_t size_in_net = _htonl(total_body_size); + if(0!=memcpy_s(&msg3_header->size, sizeof(msg3_header->size), &size_in_net, sizeof(size_in_net))) + return PVE_UNEXPECTED_ERROR;//size in Big Endian in message header of ProvMsg3 + if(total_body_size>msg3_size - PROVISION_REQUEST_HEADER_SIZE ){//make sure buffer size provided by user is large enough + return PVE_INSUFFICIENT_MEMORY_ERROR; + } + if(0!=memcpy_s(msg3_header->xid, XID_SIZE, xid, XID_SIZE)) + return PVE_UNEXPECTED_ERROR; //copy transaction id of ProvMsg2 + msg3_size = static_cast(total_body_size + PROVISION_REQUEST_HEADER_SIZE); + return AE_SUCCESS; +} + +//Function to decode ProvMsg2 and generate ProvMsg3 on success +//ProvMsg2 Format: +//R, E+MAC(**), [SigRL with ECDSA Sig] +//@msg2, the input buffer for ProvMsg2 in TLV encoded format +//@msg2_size, size of buffer msg2 +//@pek, the input pek got from endpoint selection protocol +//@epid_blob, input an optional old epid data blob used to generate non-revoke proof if required +//@blob_size, the buffer size of epid_blob +//@ek2, an output parameter for EK2 used in provision protocol which could be reused in proc_prov_msg4 +//@previous_psvn, an optional output buffer for Previous SigRL PSVN if old epid blob is missing or invalid +// so that caller could repeat ProvMsg1 and ProvMsg4 to retrieve backuped old epid data blob +//@msg3, output the ProvMsg3 in TLV encoded format +//@msg3_size: input the size of buffer msg3 +//@return AE_SUCCESS on success and error code on failure +// PVE_EPID_BLOB_ERROR is returned if old_epid_blob is required but it is invalid or not provided and +// previous_psvn will be filled in by a Previous SigRL PSVN +uint32_t CPVEClass::proc_prov_msg2( + const uint8_t* msg2, + uint32_t msg2_size, + const signed_pek_t& pek, + const uint8_t* epid_blob, + uint32_t blob_size, + uint8_t ek2[SK_SIZE], + psvn_t* previous_psvn, + uint8_t* msg3, + uint32_t msg3_size) +{ + ae_error_t ret = AE_SUCCESS; + const se_sig_rl_t *sigrl = NULL; + uint32_t sigrl_size = 0; + uint8_t *epid_sig = NULL; + uint8_t *decoded_msg2 = NULL; + uint8_t *encrypted_field1 = NULL; + uint8_t aad[PROVISION_RESPONSE_HEADER_SIZE+sizeof(RLver_t)+sizeof(GroupID)]; + size_t aad_size = PROVISION_RESPONSE_HEADER_SIZE; + const provision_response_header_t *msg2_header = reinterpret_cast(msg2); + provision_request_header_t *msg3_header = reinterpret_cast(msg3); + if(msg2_size < PROVISION_RESPONSE_HEADER_SIZE){ + AESM_DBG_ERROR("ProvMsg2 size too small"); + return PVE_MSG_ERROR; + } + if(msg3_size (PROVISION_RESPONSE_HEADER_SIZE), msg2_size - static_cast(PROVISION_RESPONSE_HEADER_SIZE)); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to decode ProvMsg2:%d",ret); + break; + } + ret = msg2_integrity_checking(tlvs_msg2);//checking and verifying that TLV structure is correct and version is supported + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("ProvMsg2 integrity checking error:%d",ret); + break; + } + prov_get_ek2_input_t ek2_input; + if(memcpy_s(ek2_input.nonce, NONCE_SIZE, MSG2_TOP_FIELD_NONCE.payload, NONCE_SIZE)!=0){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + if(memcpy_s(ek2_input.xid, XID_SIZE, msg2_header->xid, XID_SIZE)!=0){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + //call PvE to get EK2 + se_static_assert(SK_SIZE == sizeof(prov_get_ek2_output_t)); + ret = static_cast(get_ek2(&ek2_input, reinterpret_cast(ek2))); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to get EK2:%d",ret); + break; + } + if(tlvs_msg2.get_tlv_count() == MSG2_TOP_FIELDS_COUNT_WITH_SIGRL){//RLver and gid is added as part of AAD if available + sigrl = reinterpret_cast(MSG2_TOP_FIELD_SIGRL.payload); + if(0!=memcpy_s(aad+PROVISION_RESPONSE_HEADER_SIZE, sizeof(RLver_t), &sigrl->sig_rl.RLver, sizeof(RLver_t))){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + if(0!=memcpy_s(aad+PROVISION_RESPONSE_HEADER_SIZE+sizeof(RLver_t), sizeof(GroupID), &sigrl->sig_rl.gid, sizeof(GroupID))){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + aad_size += sizeof(RLver_t)+sizeof(GroupID); + sigrl_size = MSG2_TOP_FIELD_SIGRL.size; + } + se_static_assert(SK_SIZE==sizeof(sgx_aes_gcm_128bit_key_t)); + tlv_msg_t field1 = block_cipher_tlv_get_encrypted_text(MSG2_TOP_FIELD_DATA); + decoded_msg2 = reinterpret_cast(malloc(field1.msg_size)); + if(NULL == decoded_msg2){ + AESM_DBG_ERROR("malloc error"); + ret= AE_OUT_OF_MEMORY_ERROR; + break; + } + //decrypt ProvMsg2 by EK2 + sgx_status_t sgx_status = sgx_rijndael128GCM_decrypt(reinterpret_cast(ek2), + field1.msg_buf, field1.msg_size, decoded_msg2, + reinterpret_cast(block_cipher_tlv_get_iv(MSG2_TOP_FIELD_DATA)), IV_SIZE, + aad, static_cast(aad_size), reinterpret_cast(MSG2_TOP_FIELD_MAC.payload)); + if(SGX_ERROR_MAC_MISMATCH == sgx_status){ + AESM_DBG_ERROR("Fail to decrypt ProvMsg2 body by EK2"); + ret = PVE_INTEGRITY_CHECK_ERROR; + break; + } + if( AE_SUCCESS != (ret = sgx_error_to_ae_error(sgx_status))){ + AESM_DBG_ERROR("error in decrypting ProvMsg2 body:%d",sgx_status); + break; + } + + ret = check_epid_pve_pg_status_after_mac_verification(msg2_header); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Backend server reported error in ProvMsg2 passed MAC verification:%d",ret); + break; + } + TLVsMsg tlvs_field1; + tlv_status = tlvs_field1.init_from_buffer(decoded_msg2, field1.msg_size);//decode TLV structure of field1 of ProvMsg2 + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to decode field1 of ProvMsg2:%d",tlv_status); + break; + } + proc_prov_msg2_blob_input_t msg2_blob_input; + ret = msg2_field1_msg_check_copy(tlvs_field1, msg2_blob_input, pek);//version/type checking to verify message format + if( AE_SUCCESS != ret){ + AESM_DBG_ERROR("field1 of ProvMsg2 checking error:%d",ret); + break; + } + gen_prov_msg3_output_t msg3_fixed_output; + memset(&msg3_fixed_output, 0, sizeof(msg3_fixed_output)); + //collect old epid blob + if(epid_blob==NULL){ + memset(msg2_blob_input.old_epid_data_blob, 0, HARD_CODED_EPID_BLOB_SIZE); + }else if(blob_size!=HARD_CODED_EPID_BLOB_SIZE){ + AESM_DBG_FATAL("epid blob internal size error"); + ret = PVE_UNEXPECTED_ERROR; + break; + }else{ +#ifdef DBG_LOG + { + char dbg_str[256]; + aesm_dbg_format_hex(reinterpret_cast(&epid_blob), blob_size, dbg_str, 256); + AESM_DBG_TRACE("old epid blob=%s",dbg_str); + } +#endif + if(0!=memcpy_s(msg2_blob_input.old_epid_data_blob, HARD_CODED_EPID_BLOB_SIZE, epid_blob, blob_size)){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + } + uint32_t epid_sig_output_size = estimate_epid_sig_size(sigrl_size) + MAX_TLV_HEADER_SIZE; + epid_sig = reinterpret_cast(malloc(epid_sig_output_size)); + if(NULL == epid_sig){ + AESM_DBG_ERROR("malloc error"); + ret = AE_OUT_OF_MEMORY_ERROR; + break; + } + ret = (ae_error_t)proc_prov_msg2_data(&msg2_blob_input, reinterpret_cast(sigrl), sigrl_size, + &msg3_fixed_output, epid_sig, epid_sig_output_size);//ecall to process msg2 data and generate msg3 data in PvE + if( PVE_EPIDBLOB_ERROR == ret){ + if(previous_psvn == NULL){ + AESM_DBG_ERROR("PvE requires previous PSVN but it is not provided"); + ret = PVE_PARAMETER_ERROR; + break; + }else{//output previous svn in correspondent to sigrl in epid blob error + if(0!=memcpy_s(previous_psvn, sizeof(psvn_t), &msg2_blob_input.previous_psvn, sizeof(psvn_t))){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + } + } + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("PvE report error %d in processing ProvMsg2",ret); + break; + } + uint8_t iv[IV_SIZE]; + uint8_t mac[MAC_SIZE]; + uint8_t *payload_data=NULL; + uint32_t payload_size = 0; + ret = aesm_read_rand(iv, IV_SIZE); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("fail to generate random number:%d",ret); + break; + } + //Now start to generate ProvMsg3 + ret = gen_msg3_header(msg3_fixed_output, ek2_input.xid, msg3_header,msg3_size);//first generate header + if( AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate ProvMsg3 Header:%d",ret); + break; + } + TLVsMsg tlvs_msg3; + tlv_status = tlvs_msg3.add_nonce(ek2_input.nonce, NONCE_SIZE); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to generate Nonce TLV in ProvMsg3:%d",tlv_status); + break; + } + if(msg3_fixed_output.is_join_proof_generated){ + payload_data = msg3_fixed_output.field1_data; + payload_size = static_cast(HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE); + } + TLVsMsg tlvs_m3field1; + tlv_status = tlvs_m3field1.add_block_cipher_text(msg3_fixed_output.field1_iv, payload_data, payload_size); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Field3.1 TLV in ProvMsg3:%d",tlv_status); + break; + } + tlv_status = tlvs_m3field1.add_mac(msg3_fixed_output.field1_mac); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Field3.2 TLV in ProvMsg3:%d",tlv_status); + break; + } + encrypted_field1 = reinterpret_cast(malloc(tlvs_m3field1.get_tlv_msg_size())); + if( NULL == encrypted_field1){ + AESM_DBG_ERROR("malloc error"); + ret = AE_OUT_OF_MEMORY_ERROR; + break; + } + //encrypt field1 using ek2 as key + sgx_status = sgx_rijndael128GCM_encrypt(reinterpret_cast(ek2), + tlvs_m3field1.get_tlv_msg(), tlvs_m3field1.get_tlv_msg_size(), encrypted_field1, + iv, IV_SIZE, reinterpret_cast(msg3_header), PROVISION_REQUEST_HEADER_SIZE, + reinterpret_cast(mac)); + if(AE_SUCCESS != (ret = sgx_error_to_ae_error(sgx_status))){ + AESM_DBG_ERROR("fail to encrypting ProvMsg3 body by ek2:%d",sgx_status); + break; + } + tlv_status = tlvs_msg3.add_block_cipher_text(iv, encrypted_field1, tlvs_m3field1.get_tlv_msg_size()); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to create Field1 TLV of ProvMsg3:%d",tlv_status); + break; + } + ret = tlv_error_2_pve_error(tlvs_msg3.add_mac(mac)); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to create Field2 TLV of ProvMsg3:%d",ret); + break; + } + if(msg3_fixed_output.is_epid_sig_generated){ + tlv_status = tlvs_msg3.add_block_cipher_text(msg3_fixed_output.epid_sig_iv, epid_sig, msg3_fixed_output.epid_sig_output_size); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to create Field3 TLV of ProvMsg3:%d",tlv_status); + break; + } + tlv_status = tlvs_msg3.add_mac(msg3_fixed_output.epid_sig_mac); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to create Field4 TLV of ProvMsg3:%d",tlv_status); + break; + } + } + assert( tlvs_msg3.get_tlv_msg_size() <= msg3_size - PROVISION_REQUEST_HEADER_SIZE);//The checking should have been done in header generation + + if(0!=memcpy_s(msg3+PROVISION_REQUEST_HEADER_SIZE, msg3_size-PROVISION_REQUEST_HEADER_SIZE, + tlvs_msg3.get_tlv_msg(), tlvs_msg3.get_tlv_msg_size())){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + AESM_DBG_TRACE("ProvMsg3 generated successfully"); + ret = AE_SUCCESS; + }while(0); + if(decoded_msg2)free(decoded_msg2); + if(encrypted_field1) free(encrypted_field1); + if(epid_sig)free(epid_sig); + return ret; +} diff --git a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp new file mode 100644 index 0000000000..18cccf91e0 --- /dev/null +++ b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp @@ -0,0 +1,272 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "type_length_value.h" +#include "sgx_tcrypto_internal.h" +#include +#include "epid_utility.h" +#include "aeerror.h" +#include "PVEClass.h" +#include "se_wrapper.h" +#include "oal/internal_log.h" +/** +* File: epid_provision_msg4.cpp +* Description: Provide the untrusted implementation of code to process ProvMsg4 +* +* Untrusted Code for EPID Provision +*/ +#define MSG4_TOP_FIELDS_COUNT 3 +#define MSG4_TOP_FIELD_NONCE tlvs_msg4[0] +#define MSG4_TOP_FIELD_DATA tlvs_msg4[1] +#define MSG4_TOP_FIELD_MAC tlvs_msg4[2] + +#define MSG4_FIELD1_COUNT 6 +#define MSG4_FIELD1_DEVICE_ID tlvs_field1[5] +#define MSG4_FIELD1_ENC_TCB tlvs_field1[0] +#define MSG4_FIELD1_MAC_TCB tlvs_field1[1] +#define MSG4_FIELD1_ENC_Axf tlvs_field1[2] +#define MSG4_FIELD1_MAC_Axf tlvs_field1[3] +#define MSG4_FIELD1_GROUP_CERT tlvs_field1[4] + + +static ae_error_t msg4_integrity_checking(const TLVsMsg& tlvs_msg4) +{ + uint32_t tlv_count = tlvs_msg4.get_tlv_count(); + if(tlv_count != MSG4_TOP_FIELDS_COUNT) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG4_TOP_FIELD_NONCE.type != TLV_NONCE || MSG4_TOP_FIELD_NONCE.size != NONCE_SIZE || + MSG4_TOP_FIELD_NONCE.version != TLV_VERSION_1 || MSG4_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG4_TOP_FIELD_DATA.type != TLV_BLOCK_CIPHER_TEXT || MSG4_TOP_FIELD_DATA.version != TLV_VERSION_1) + return PVE_INTEGRITY_CHECK_ERROR; + if(MSG4_TOP_FIELD_MAC.type != TLV_MESSAGE_AUTHENTICATION_CODE || MSG4_TOP_FIELD_MAC.version != TLV_VERSION_1 || + MSG4_TOP_FIELD_MAC.size != MAC_SIZE || MSG4_TOP_FIELD_MAC.header_size != SMALL_TLV_HEADER_SIZE) + return PVE_INTEGRITY_CHECK_ERROR; + return AE_SUCCESS; +} + +static ae_error_t msg4_field1_msg_checking(const TLVsMsg& tlvs_field1) +{ + uint32_t tlv_count = tlvs_field1.get_tlv_count(); + if(tlv_count!=MSG4_FIELD1_COUNT){ + return PVE_MSG_ERROR; + } + uint32_t i; + for(i=0;iprotocol != SE_EPID_PROVISIONING || msg4_header->type != TYPE_PROV_MSG4 || + msg4_header->version != TLV_VERSION_1){ + return PVE_INTEGRITY_CHECK_ERROR; + } + uint32_t size_in_header = lv_ntohl(msg4_header->size); + if(size_in_header + PROVISION_RESPONSE_HEADER_SIZE != msg4_size) + return PVE_INTEGRITY_CHECK_ERROR; + return AE_SUCCESS; +} + + +//Function to decode ProvMsg4 and generate epid data blob +uint32_t CPVEClass::proc_prov_msg4( + bool use_ek2_in_input, + const uint8_t ek2[SK_SIZE], + const uint8_t* msg4, + uint32_t msg4_size, + uint8_t* data_blob, + uint32_t blob_size) +{ + ae_error_t ret = AE_SUCCESS; + uint8_t local_ek2[SK_SIZE]; + uint8_t *decoded_msg4 = NULL; + const provision_response_header_t *msg4_header = reinterpret_cast(msg4); + if(msg4_size < PROVISION_RESPONSE_HEADER_SIZE){ + AESM_DBG_ERROR("invalid msg4 size"); + return PVE_MSG_ERROR; + } + if(blob_size != HARD_CODED_EPID_BLOB_SIZE){ + AESM_DBG_FATAL("invalid input epid blob size"); + return PVE_PARAMETER_ERROR; + } + + ret = check_prov_msg4_header(msg4_header, msg4_size); + if( AE_SUCCESS != ret){ + AESM_DBG_ERROR("Invalid ProvMsg4 Header:%d",ret); + return ret; + } + ret = check_epid_pve_pg_status_before_mac_verification(msg4_header); + if( AE_SUCCESS != ret){ + AESM_DBG_ERROR("Backend return failure in ProvMsg4 Header:%d",ret); + return ret; + } + + do{ + TLVsMsg tlvs_msg4; + tlv_status_t tlv_status; + tlv_status = tlvs_msg4.init_from_buffer(msg4+static_cast(PROVISION_RESPONSE_HEADER_SIZE), msg4_size - static_cast(PROVISION_RESPONSE_HEADER_SIZE)); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("fail to decode ProvMsg4:%d",tlv_status); + break; + } + ret = msg4_integrity_checking(tlvs_msg4); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("ProvMsg4 integrity checking error:%d",ret); + break; + } + AESM_DBG_TRACE("ProvMsg4 decoded"); + if(!use_ek2_in_input){ //we need generate ek2 + prov_get_ek2_input_t ek2_input; + if(memcpy_s(ek2_input.nonce, NONCE_SIZE, MSG4_TOP_FIELD_NONCE.payload, NONCE_SIZE)!=0){ + AESM_DBG_ERROR("fail in memcpy"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + if(memcpy_s(ek2_input.xid, XID_SIZE, msg4_header->xid, XID_SIZE)!=0){ + AESM_DBG_ERROR("fail in memcpy"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + //call PvE to get EK2 + se_static_assert(SK_SIZE == sizeof(prov_get_ek2_output_t)); + + ret = (ae_error_t)get_ek2(&ek2_input, reinterpret_cast(local_ek2)); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("fail to get EK2:%d",ret); + break; + } + }else{//reuse ek2 generated in processing ProvMsg2 + if(0!=memcpy_s(local_ek2, sizeof(local_ek2), ek2, SK_SIZE)){ + AESM_DBG_ERROR("fail in memcpy"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + } + se_static_assert(SK_SIZE==sizeof(sgx_aes_gcm_128bit_key_t)); + tlv_msg_t field1 = block_cipher_tlv_get_encrypted_text(MSG4_TOP_FIELD_DATA); + decoded_msg4 = reinterpret_cast(malloc(field1.msg_size)); + if(NULL == decoded_msg4){ + AESM_DBG_ERROR("malloc error"); + ret = AE_OUT_OF_MEMORY_ERROR; + break; + } + sgx_status_t sgx_status = sgx_rijndael128GCM_decrypt(reinterpret_cast(local_ek2), + field1.msg_buf, field1.msg_size, decoded_msg4, + reinterpret_cast(block_cipher_tlv_get_iv(MSG4_TOP_FIELD_DATA)), IV_SIZE, + reinterpret_cast(msg4_header), PROVISION_RESPONSE_HEADER_SIZE, + reinterpret_cast(MSG4_TOP_FIELD_MAC.payload)); + if(SGX_ERROR_MAC_MISMATCH == sgx_status){ + AESM_DBG_ERROR("fail to decrypt ProvMsg4 by EK2"); + ret = PVE_INTEGRITY_CHECK_ERROR; + break; + } + if( AE_SUCCESS != (ret = sgx_error_to_ae_error(sgx_status))){ + AESM_DBG_ERROR("error in decrypting ProvMsg4:%d",sgx_status); + break; + } + AESM_DBG_TRACE("ProvMsg4 decrypted by EK2 successfully"); + ret = check_epid_pve_pg_status_after_mac_verification(msg4_header); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Backend reported error passed MAC verification:%d",ret); + break; + } + TLVsMsg tlvs_field1; + tlv_status = tlvs_field1.init_from_buffer(decoded_msg4, field1.msg_size); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("ProvMsg4 Field2.1 decoding failed:%d",tlv_status); + break; + } + ret = msg4_field1_msg_checking(tlvs_field1); + if( AE_SUCCESS != ret){ + AESM_DBG_ERROR("ProvMsg4 Field2.1 invalid:%d",ret); + break; + } + proc_prov_msg4_input_t msg4_input; + if(sizeof(proc_prov_msg4_output_t)!=SGX_TRUSTED_EPID_BLOB_SIZE){ + AESM_DBG_FATAL("Trusted ProvMsg4 output buffer size error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + tlv_msg_t tcb_data = block_cipher_tlv_get_encrypted_text(MSG4_FIELD1_ENC_TCB); + tlv_msg_t Axf_data = block_cipher_tlv_get_encrypted_text(MSG4_FIELD1_ENC_Axf); + if(0!=memcpy_s(&msg4_input.group_cert, sizeof(msg4_input.group_cert), MSG4_FIELD1_GROUP_CERT.payload, MSG4_FIELD1_GROUP_CERT.size)|| + 0!=memcpy_s(&msg4_input.equivalent_psvn, sizeof(psvn_t), device_id_tlv_get_psvn(MSG4_FIELD1_DEVICE_ID), sizeof(psvn_t))|| + 0!=memcpy_s(&msg4_input.fmsp, sizeof(fmsp_t), device_id_tlv_get_fmsp(MSG4_FIELD1_DEVICE_ID), sizeof(fmsp_t))|| + 0!=memcpy_s(&msg4_input.tcb_iv, IV_SIZE, block_cipher_tlv_get_iv(MSG4_FIELD1_ENC_TCB), IV_SIZE)|| + 0!=memcpy_s(&msg4_input.encrypted_tcb, SK_SIZE, tcb_data.msg_buf, tcb_data.msg_size)|| + 0!=memcpy_s(&msg4_input.tcb_mac, MAC_SIZE, MSG4_FIELD1_MAC_TCB.payload, MSG4_FIELD1_MAC_TCB.size)|| + 0!=memcpy_s(&msg4_input.member_credential_iv, IV_SIZE, block_cipher_tlv_get_iv(MSG4_FIELD1_ENC_Axf), IV_SIZE)|| + 0!=memcpy_s(&msg4_input.encrypted_member_credential, HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE, Axf_data.msg_buf, Axf_data.msg_size)|| + 0!=memcpy_s(&msg4_input.member_credential_mac, MAC_SIZE, MSG4_FIELD1_MAC_Axf.payload, MSG4_FIELD1_MAC_Axf.size)){ + AESM_DBG_ERROR("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; + break; + } + ret = (ae_error_t)proc_prov_msg4_data(&msg4_input, reinterpret_cast(data_blob)); + AESM_DBG_TRACE("PvE return %d in Process ProvMsg4",ret); + }while(0); + if(decoded_msg4)free(decoded_msg4); + return ret; +} diff --git a/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp b/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp new file mode 100644 index 0000000000..7e39e0cb79 --- /dev/null +++ b/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "epid_utility.h" + +ae_error_t tlv_error_2_pve_error(tlv_status_t tlv_status) +{ + switch(tlv_status){ + case TLV_SUCCESS: + return AE_SUCCESS; + case TLV_INVALID_PARAMETER_ERROR: + return PVE_PARAMETER_ERROR; + case TLV_INVALID_MSG_ERROR: + case TLV_INVALID_FORMAT: + return PVE_MSG_ERROR; + case TLV_INSUFFICIENT_MEMORY: + return PVE_INSUFFICIENT_MEMORY_ERROR; + case TLV_OUT_OF_MEMORY_ERROR: + return AE_OUT_OF_MEMORY_ERROR; + case TLV_UNKNOWN_ERROR: + case TLV_MORE_TLVS: + case TLV_UNSUPPORTED: + return PVE_UNEXPECTED_ERROR; + } + return PVE_UNEXPECTED_ERROR; +} + +ae_error_t check_endpoint_pg_stauts(const provision_response_header_t *msg_header) +{ + uint16_t gstatus; + gstatus = lv_ntohs(msg_header->gstatus); + switch(gstatus){ + case GRS_SERVER_BUSY: + return PVE_SERVER_BUSY_ERROR; + case GRS_INTEGRITY_CHECK_FAIL: + return PVE_INTEGRITY_CHECK_ERROR; + case GRS_INCOMPATIBLE_VERSION://Backend report that PSW has used too old protocol, we need update PSW software + return PSW_UPDATED_REQUIRED; + case GRS_INCORRECT_SYNTAX: + return PVE_MSG_ERROR; + case GRS_OK: + return AE_SUCCESS; + default: //For endpoint selection, no MAC checking of error code required so that return server reported error directly + return PVE_SERVER_REPORTED_ERROR; + } +} + +ae_error_t check_epid_pve_pg_status_before_mac_verification(const provision_response_header_t *msg_header) +{ + uint16_t gstatus; + gstatus = lv_ntohs(msg_header->gstatus); + switch(gstatus){ + case GRS_SERVER_BUSY: + return PVE_SERVER_BUSY_ERROR; + case GRS_INTEGRITY_CHECK_FAIL: + return PVE_INTEGRITY_CHECK_ERROR; + case GRS_INCOMPATIBLE_VERSION://Backend report that PSW has used too old protocol, we need update PSW software, no MAC provided + return PSW_UPDATED_REQUIRED; + case GRS_INCORRECT_SYNTAX: + return PVE_MSG_ERROR; + case GRS_OK: + return AE_SUCCESS; + case GRS_PROTOCOL_ERROR: + return AE_SUCCESS;//ignore those errors to check them after mac verification passed + default: + return PVE_SERVER_REPORTED_ERROR; + } +} + +ae_error_t check_epid_pve_pg_status_after_mac_verification(const provision_response_header_t *msg_header) +{ + uint16_t gstatus, pstatus; + gstatus = lv_ntohs(msg_header->gstatus); + pstatus = lv_ntohs(msg_header->pstatus); + switch(gstatus){ + case GRS_OK: + if(pstatus!=SE_PRS_OK) + return PVE_SERVER_REPORTED_ERROR; + return AE_SUCCESS; + case GRS_PROTOCOL_ERROR: + AESM_DBG_INFO("Server reported protocol error %d", (int)pstatus); + switch(pstatus){ + case SE_PRS_STATUS_INTEGRITY_FAILED: + return PVE_INTEGRITY_CHECK_ERROR; + case SE_PRS_PLATFORM_REVOKED: + return PVE_REVOKED_ERROR; + case SE_PRS_PERFORMANCE_REKEY_NOT_SUPPORTED: + return PVE_PERFORMANCE_REKEY_NOT_SUPPORTED; + default: + return PVE_SERVER_REPORTED_ERROR; + } + default: + return PVE_SERVER_REPORTED_ERROR; + } +} diff --git a/psw/ae/aesm_service/source/epid_provision/epid_utility.h b/psw/ae/aesm_service/source/epid_provision/epid_utility.h new file mode 100644 index 0000000000..ebc9498ab3 --- /dev/null +++ b/psw/ae/aesm_service/source/epid_provision/epid_utility.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _EPID_UTILITY_H_ +#define _EPID_UTILITY_H_ + +#include "aeerror.h" +#include "arch.h" +#include "type_length_value.h" + +ae_error_t tlv_error_2_pve_error(tlv_status_t tlv_status); +ae_error_t check_endpoint_pg_stauts(const provision_response_header_t *msg_header); +ae_error_t check_epid_pve_pg_status_before_mac_verification(const provision_response_header_t *msg_header); +ae_error_t check_epid_pve_pg_status_after_mac_verification(const provision_response_header_t *msg_header); +#endif + diff --git a/psw/ae/aesm_service/source/le/LEClass.cpp b/psw/ae/aesm_service/source/le/LEClass.cpp new file mode 100644 index 0000000000..3412fc3943 --- /dev/null +++ b/psw/ae/aesm_service/source/le/LEClass.cpp @@ -0,0 +1,271 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "LEClass.h" +#include "aeerror.h" +#include "arch.h" +#include "ae_ipp.h" +#include "util.h" + +extern "C" sgx_status_t sgx_create_le(const char *file_name, const char *prd_css_file_name, const int debug, sgx_launch_token_t *launch_token, int *launch_token_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr, int *production_loaded); + +#include "launch_enclave_u.h" +#include "launch_enclave_u.c" + +int CLEClass::white_list_register( + const uint8_t *white_list_cert, + uint32_t white_list_cert_size, + bool save_to_persistent_storage) +{ + sgx_status_t ret = SGX_SUCCESS; + int retry = 0; + uint32_t status = 0; + + assert(m_enclave_id); + + ret = le_init_white_list_wrapper(m_enclave_id, &status, + const_cast(white_list_cert), + white_list_cert_size); + for(; ret == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + if(AE_SUCCESS != load_enclave_only()) + return AE_FAILURE; + ret = le_init_white_list_wrapper(m_enclave_id, &status, + const_cast(white_list_cert), + white_list_cert_size); + } + + if(SGX_SUCCESS!=ret) + return sgx_error_to_ae_error(ret); + AESM_DBG_TRACE("le_init_white_list_wrapper return %d",status); + if(AE_SUCCESS == status&&save_to_persistent_storage){//successfully register the white list cert + if(AE_SUCCESS != aesm_write_data(FT_PERSISTENT_STORAGE,AESM_WHITE_LIST_CERT_FID,white_list_cert, white_list_cert_size)){//ignore error if failed to save in persistent storage + AESM_DBG_WARN("Fail to save white list cert in persistent storage"); + } + } + return status; +} + + +void CLEClass::load_white_cert_list() +{ + load_verified_white_cert_list(); + load_white_cert_list_to_be_verify();//If this version is older than previous one, it will not be loaded +} + +ae_error_t CLEClass::load_verified_white_cert_list() +{ + ae_error_t ae_err; + uint32_t white_cert_size=0; + ae_err = aesm_query_data_size(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_FID, &white_cert_size); + if(AE_SUCCESS == ae_err && white_cert_size ==0){//file not existing or 0 size + AESM_DBG_TRACE("no white cert list available in persistent storage"); + return AE_SUCCESS; + } + if(AE_SUCCESS != ae_err) + return ae_err; + uint8_t *p = (uint8_t *)malloc(white_cert_size); + if(NULL == p){ + AESM_DBG_ERROR("out of memory"); + return AE_OUT_OF_MEMORY_ERROR; + } + ae_err = aesm_read_data(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_FID, p, &white_cert_size); + if(AE_SUCCESS != ae_err){ + AESM_DBG_WARN("Fail to read white cert list file"); + free(p); + return ae_err; + } + ae_err = (ae_error_t)white_list_register(p, white_cert_size,false);//Need not save the data to file again + if(AE_SUCCESS!=ae_err){ + AESM_DBG_WARN("fail to register white cert list file in persistent storage"); + } + free(p); + return ae_err; +} + +//This function must be called after white list cert has been verified and the file may overwrite the original one +ae_error_t CLEClass::load_white_cert_list_to_be_verify() +{ + ae_error_t ae_err; + uint32_t white_cert_size=0; + ae_err = aesm_query_data_size(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_TO_BE_VERIFY_FID, &white_cert_size); + if(AE_SUCCESS != ae_err || white_cert_size ==0){//file not existing or 0 size + AESM_DBG_TRACE("no white cert list to be verify in persistent storage"); + return AE_SUCCESS; + } + uint8_t *p = (uint8_t *)malloc(white_cert_size); + if(NULL == p){ + AESM_DBG_ERROR("out of memory"); + return AE_OUT_OF_MEMORY_ERROR; + } + ae_err = aesm_read_data(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_TO_BE_VERIFY_FID, p, &white_cert_size); + if(AE_SUCCESS != ae_err){ + AESM_DBG_WARN("Fail to read white cert list file"); + free(p); + return ae_err; + } + ae_err = (ae_error_t)white_list_register(p, white_cert_size,true);//We need to overwrite the original white list file if the file is passed + if(AE_SUCCESS!=ae_err){ + AESM_DBG_WARN("fail to register white cert list file in persistent storage"); + } + {//Always remove the file now. If it is not verified, the file has problem and remove it; otherwise, it has been saved as the AESM_WHITE_LIST_CERT_FID + char white_list_to_be_verify_path_name[MAX_PATH]; + ae_err = aesm_get_pathname(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_TO_BE_VERIFY_FID, white_list_to_be_verify_path_name, MAX_PATH); + if(AE_SUCCESS == ae_err){ + se_delete_tfile(white_list_to_be_verify_path_name); + } + } + free(p); + return ae_err; +} + +ae_error_t CLEClass::load_enclave_only() +{ + before_enclave_load(); + + assert(m_enclave_id==0); + sgx_status_t ret; + ae_error_t ae_err; + char prod_css_path[MAX_PATH]={0}; + char enclave_path[MAX_PATH]= {0}; + char *p_prod_css_path = prod_css_path; + int production_le_loaded = 0; + if((ae_err = aesm_get_pathname(FT_PERSISTENT_STORAGE, LE_PROD_SIG_STRUCT_FID, prod_css_path, MAX_PATH))!=AE_SUCCESS){ + AESM_DBG_WARN("fail to get production sig struction of LE"); + p_prod_css_path = NULL; + } + if((ae_err = aesm_get_pathname(FT_ENCLAVE_NAME, get_enclave_fid(), enclave_path,//get non-production signed LE pathname + MAX_PATH)) + !=AE_SUCCESS){ + AESM_DBG_ERROR("fail to get LE pathname"); + return ae_err; + } + int launch_token_update; +#ifdef AESM_SIM + UNUSED(p_prod_css_path); + UNUSED(production_le_loaded); + ret = sgx_create_enclave(enclave_path, get_debug_flag(), &m_launch_token, + &launch_token_update, &m_enclave_id, + &m_attributes);//simulation mode has no sgx_create_le function. Use sgx_create_enclave + if(ret != SGX_SUCCESS){ + AESM_DBG_ERROR("Fail to load LE"); + return AE_FAILURE; + } + return AE_SUCCESS; +#else + ret = sgx_create_le(enclave_path, p_prod_css_path, get_debug_flag(), &m_launch_token, + &launch_token_update, &m_enclave_id, + &m_attributes, &production_le_loaded); + if (ret == SGX_ERROR_NO_DEVICE){ + AESM_DBG_ERROR("AE SERVER NOT AVAILABLE in load non-production signed LE: %s",enclave_path); + return AE_SERVER_NOT_AVAILABLE; + } + if (ret != SGX_SUCCESS){ + AESM_DBG_ERROR("Loading LE failed:%d",ret); + return AE_FAILURE; + }else if(production_le_loaded!=0){//production signed LE loaded + AESM_DBG_INFO("Production signed LE loaded, try loading white list now"); + }else{ + AESM_DBG_INFO("Debug signed LE loaded"); + } + return AE_SUCCESS; +#endif +} + +ae_error_t CLEClass::load_enclave() +{ + if(m_enclave_id){//LE has been loaded before + return AE_SUCCESS; + } + ae_error_t ae_err = load_enclave_only(); + if( AE_SUCCESS == ae_err){ + load_white_cert_list(); + } + return ae_err; +} + +int CLEClass::get_launch_token( + uint8_t * mrenclave, uint32_t mrenclave_size, + uint8_t *public_key, uint32_t public_key_size, + uint8_t *se_attributes, uint32_t se_attributes_size, + uint8_t * lictoken, uint32_t lictoken_size + ) +{ + sgx_status_t ret = SGX_SUCCESS; + int retry = 0; + int status = 0; + + assert(m_enclave_id); + sgx_measurement_t mrsigner; + + if(mrenclave_size !=sizeof(sgx_measurement_t) || + SE_KEY_SIZE != public_key_size || + se_attributes_size != sizeof(sgx_attributes_t) || + lictoken_size < sizeof(token_t) ) + return LE_INVALID_PARAMETER; + //set mrsigner based on the hash of isv pub key from enclave signature + IppStatus ipperrorCode = ippStsNoErr; + ipperrorCode = ippsHashMessage(reinterpret_cast(public_key), public_key_size, reinterpret_cast(&mrsigner), IPP_ALG_HASH_SHA256); + if( ipperrorCode != ippStsNoErr){ + return AE_FAILURE; + } + +#ifdef DBG_LOG + char mrsigner_info[256]; + aesm_dbg_format_hex((uint8_t *)&mrsigner, sizeof(mrsigner), mrsigner_info, 256); + AESM_DBG_INFO("try to load Enclave with mrsigner:%s",mrsigner_info); +#endif + + //get launch token by ecall into LE + ret = le_get_launch_token_wrapper(m_enclave_id, &status, + reinterpret_cast(mrenclave), + &mrsigner, + reinterpret_cast(se_attributes), + reinterpret_cast(lictoken)); + for(; ret == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + ret = le_get_launch_token_wrapper(m_enclave_id, &status, + reinterpret_cast(mrenclave), + &mrsigner, + reinterpret_cast(se_attributes), + reinterpret_cast(lictoken)); + } + + if(SGX_SUCCESS!=ret) + return sgx_error_to_ae_error(ret); + return status; +} diff --git a/psw/ae/aesm_service/source/le/LEClass.h b/psw/ae/aesm_service/source/le/LEClass.h new file mode 100644 index 0000000000..c69a6461c4 --- /dev/null +++ b/psw/ae/aesm_service/source/le/LEClass.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _LE_CLASS_H_ +#define _LE_CLASS_H_ +#include "arch.h" +#include "AEClass.h" +#include "ae_debug_flag.hh" + +class CLEClass: public SingletonEnclave +{ + friend class Singleton; + friend class SingletonEnclave; + static aesm_enclave_id_t get_enclave_fid(){return LE_ENCLAVE_FID;} +protected: + CLEClass(){}; + ~CLEClass(){}; + virtual int get_debug_flag() { return LE_DEBUG_FLAG;} + void load_white_cert_list(); + ae_error_t load_enclave_only();/*protected function to load Enclave only without loading white list*/ + ae_error_t load_verified_white_cert_list(); + ae_error_t load_white_cert_list_to_be_verify(); +public: + virtual ae_error_t load_enclave();/*overload LE load enclave function since i) we have two different LE SigStruct now, ii) we need load white list*/ + int get_launch_token( + uint8_t * mrenclave, uint32_t mrenclave_size, + uint8_t *mrsigner, uint32_t mrsigner_size, + uint8_t *se_attributes, uint32_t se_attributes_size, + uint8_t * lictoken, uint32_t lictoken_size + ); + int white_list_register( + const uint8_t *white_list_cert, + uint32_t white_list_cert_size, + bool save_to_persistent_storage=true); +}; +#endif + + diff --git a/psw/ae/aesm_service/source/network/network_encoding_wrapper.cpp b/psw/ae/aesm_service/source/network/network_encoding_wrapper.cpp new file mode 100644 index 0000000000..88ed8b874d --- /dev/null +++ b/psw/ae/aesm_service/source/network/network_encoding_wrapper.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "network_encoding_wrapper.h" +#include "oal/oal.h" +#include "aesm_encode.h" + +ae_error_t AESMNetworkEncoding::aesm_send_recv_msg(const char *url, const uint8_t * msg, uint32_t msg_size, uint8_t* &resp_msg, uint32_t& resp_size, http_methods_t type, bool is_ocsp) +{ + return ::aesm_network_send_receive(url, msg, msg_size, &resp_msg, &resp_size, type, is_ocsp); +} + +ae_error_t AESMNetworkEncoding::aesm_send_recv_msg_encoding_internal(const char *url, const uint8_t * msg, uint32_t msg_size, uint8_t* &resp, uint32_t& resp_size) +{ + resp = NULL; + resp_size = 0; + + ae_error_t ae_ret = AE_SUCCESS; + uint8_t *encode_msg = NULL; + uint32_t encoding_size = get_request_encoding_length(msg); + uint8_t *recv_msg = NULL; + uint32_t decode_buffer_size = 0; + uint32_t recv_size = 0; + if(encoding_size == 0){ + AESM_DBG_WARN("invalid msg_size 0 to send to url:%s", url); + ae_ret = AE_FAILURE; + goto ret_point; + } + encode_msg = reinterpret_cast(malloc(encoding_size)); + if(encode_msg == NULL){ + AESM_DBG_ERROR("malloc failed"); + ae_ret = AE_OUT_OF_MEMORY_ERROR; + goto ret_point; + } +#ifdef DBG_LOG + char dbg_hex_string[256]; + aesm_dbg_format_hex(msg, msg_size, dbg_hex_string, 256); + AESM_DBG_TRACE("send msg \"%s\" to server:%s",dbg_hex_string, url); +#endif + memset(encode_msg, 0, encoding_size); + if(!encode_request(msg, msg_size, encode_msg, &encoding_size)){ + AESM_DBG_ERROR("message encoding error, msg size %d",msg_size); + ae_ret = PVE_UNEXPECTED_ERROR; + goto ret_point; + } + AESM_DBG_TRACE("encoded msg %.*s",encoding_size, encode_msg); + ae_ret = aesm_network_send_receive(url, encode_msg, encoding_size, + &recv_msg, &recv_size, POST, false); + if(ae_ret != AE_SUCCESS ){ + AESM_DBG_ERROR("fail to send encoded msg (size=%d) to url:%s",encoding_size, url); + goto ret_point; + } + if(recv_msg == NULL){ + AESM_DBG_ERROR("recv NULL message from backend server"); + ae_ret = PVE_UNEXPECTED_ERROR; + goto ret_point; + } + AESM_DBG_TRACE("response msg %.*s", recv_size, recv_msg); + decode_buffer_size= get_response_decoding_length(recv_size); + + if(decode_buffer_size == 0){ + AESM_DBG_ERROR("response 0 length message from backend server:%s",url); + ae_ret = PVE_UNEXPECTED_ERROR; + goto ret_point; + } + AESM_DBG_TRACE("Succ recv msg:%.*s", recv_size, recv_msg); + + resp = reinterpret_cast(malloc(decode_buffer_size)); + if(resp == NULL){ + AESM_DBG_ERROR("malloc error"); + ae_ret = AE_OUT_OF_MEMORY_ERROR; + goto ret_point; + } + memset(resp, 0, decode_buffer_size); + if(!decode_response(recv_msg,recv_size, resp, &decode_buffer_size)){ + AESM_DBG_WARN("fail to decode message from server"); + ae_ret = PVE_MSG_ERROR; + goto ret_point; + } +#ifdef DBG_LOG + aesm_dbg_format_hex(resp, decode_buffer_size, dbg_hex_string, 256); + AESM_DBG_TRACE("succ decode msg \"%s\" ",dbg_hex_string); +#endif + resp_size = decode_buffer_size; +ret_point: + aesm_free_network_response_buffer(recv_msg); + if(ae_ret != AE_SUCCESS){ + if(resp!=NULL)free(resp); + resp = NULL; + } + if(encode_msg!=NULL)free(encode_msg); + return ae_ret; +} + + +void AESMNetworkEncoding::aesm_free_response_msg(uint8_t *resp) +{ + if(resp!=NULL){ + free(resp); + } +} + + +ae_error_t AESMNetworkEncoding::aesm_send_recv_msg_encoding(const char *url, const uint8_t * msg, uint32_t msg_size, uint8_t* &resp, uint32_t& resp_size) +{ + resp = NULL; + resp_size = 0; + AESM_DBG_TRACE("send msg to url %s",url); + //call global function to encoding message, send/receive message via HTTP POST and decode response message + return aesm_send_recv_msg_encoding_internal(url, msg, msg_size, resp, resp_size); +} + + diff --git a/psw/ae/aesm_service/source/network/network_encoding_wrapper.h b/psw/ae/aesm_service/source/network/network_encoding_wrapper.h new file mode 100644 index 0000000000..0fc68064b8 --- /dev/null +++ b/psw/ae/aesm_service/source/network/network_encoding_wrapper.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NETWORK_WRAPPER_H_ +#define _NETWORK_WRAPPER_H_ +#include "sgx_urts.h" +#include "aesm_error.h" +#include "arch.h" +#include "aeerror.h" +#include "tlv_common.h" +#include "se_thread.h" +#include "oal/oal.h" +#include "se_wrapper.h" +#include "endpoint_select_info.h" + +/*Class for network interface inside AESM*/ +class AESMNetworkEncoding{ +protected: + static ae_error_t aesm_send_recv_msg_encoding_internal(const char *url, const uint8_t * msg, uint32_t msg_size, uint8_t* &resp_msg, uint32_t& resp_size); +public: + /*Function to send data to server via HTTP/HTTPS protocol*/ + static ae_error_t aesm_send_recv_msg(const char *url, const uint8_t * msg, uint32_t msg_size, uint8_t* &resp_msg, uint32_t& resp_size, http_methods_t type= POST, bool is_ocsp=false); + /*Function to send data to server via HTTP/HTTPS protocol but the data to be send will be HEX/BASE64 encoded and the respose message is decoded. It is used for ES/SGX/PSEPR Provisioning*/ + static ae_error_t aesm_send_recv_msg_encoding(const char *url, const uint8_t * msg, uint32_t msg_size, uint8_t* &resp_msg, uint32_t& resp_size); + static void aesm_free_response_msg(uint8_t *resp); /*Function to free the buffer of resp_msg from previous two functions*/ +}; +#endif + diff --git a/psw/ae/aesm_service/source/oal/aesm_thread.cpp b/psw/ae/aesm_service/source/oal/aesm_thread.cpp new file mode 100644 index 0000000000..85a6d110ac --- /dev/null +++ b/psw/ae/aesm_service/source/oal/aesm_thread.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "oal/aesm_thread.h" +#include +#include +#include +#include +#include "oal/internal_log.h" +#include "se_thread.h"//using se_mutex + +const uint32_t AESM_THREAD_INFINITE = 0xffffffff; // special flag to indicate that thread to be blocked + +//thread status: +// At the beginning, status is initialized to AESM_THREAD_INIT +// After the started thread has copied all input data, the status will be updated to AESM_THREAD_RUNNING (So that aesm_free_thread could be called and mainthread could quit) +// If the thread has finished before function like aesm_free_thread is called, the thread will find the status is still AESM_TRHEAD_RUNNING, +// it will update the status to AESM_THREAD_PENDING and leave the resource free to following call of aesm_free_thread +// If the thread is finished after function aesm_free_thread is called, the status should be AESM_THREAD_FREED, so that it should free the resource. +// If aesm_join_thread is called, it will wait the thread to be finished (so that it should find the status to be AESM_THREAD_PENDING when pthread_join returned +// and it will update the status to AESM_THREAD_DETACHED +// If aesm_free_thread is called before the thread has been finished, so the function find the status is AESM_THREAD_RUNNING, +// it will update the status to AESM_THREAD_FREED and leaving the memory free the aesm_thread_proc +// But when aesm_free_thread is called and it found the thread has been finished so that the status is AESM_THREAD_PENDING or AESM_THREAD_DETACHED +// the function should free all the resource. +enum _aesm_thread_status_t{AESM_THREAD_INIT, AESM_THREAD_INVALID, AESM_THREAD_RUNNING, AESM_THREAD_PENDING, AESM_THREAD_DETACHED, AESM_THREAD_FREED}; + + +struct _aesm_thread_t{ + pthread_mutex_t mutex; + pthread_cond_t copy_cond; + pthread_cond_t timeout_cond; + aesm_thread_arg_type_t arg; + aesm_thread_function_t fun_entry; + ae_error_t ae_ret; + pthread_t hthread; + volatile _aesm_thread_status_t status; +}; + +static void aesm_dealloc_resource(aesm_thread_t h) +{ + h->status = AESM_THREAD_INVALID; + pthread_cond_destroy(&h->copy_cond); + pthread_cond_destroy(&h->timeout_cond); + (void)pthread_mutex_destroy(&h->mutex); + free(h); +} + +void* aesm_thread_proc(void* param) +{ + struct _aesm_thread_t *p=(struct _aesm_thread_t *)param; + aesm_thread_function_t fun_entry = NULL; + aesm_thread_arg_type_t arg = 0; + AESM_DBG_TRACE("start running thread %p...",param); + if(pthread_mutex_lock(&p->mutex)!=0){ + AESM_DBG_ERROR("fail to lock the thread mutex of thread %p",param); + return reinterpret_cast(static_cast(AE_FAILURE)); + } + fun_entry = p->fun_entry; + arg = p->arg; + p->status = AESM_THREAD_RUNNING; + p->ae_ret = AE_FAILURE; + pthread_cond_signal(&p->copy_cond);//notify mainthread that input parameter data has been copied to thread and we could release it(if aesm_thread_free has been called) + pthread_mutex_unlock(&p->mutex); + AESM_DBG_TRACE("thread parameters of thread %p copied",param); + ae_error_t err = fun_entry(arg); + AESM_DBG_TRACE("returned from user defined thread code for thread %p",param); + pthread_mutex_lock(&p->mutex); + p->ae_ret = err; + if(p->status == AESM_THREAD_RUNNING){ + p->status = AESM_THREAD_PENDING; + pthread_cond_signal(&p->timeout_cond); + pthread_mutex_unlock(&p->mutex); + AESM_DBG_TRACE("thread %p change to status AESM_THREAD_PEDNING",param); + }else if(p->status == AESM_THREAD_FREED){ + pthread_mutex_unlock(&p->mutex); + pthread_detach(p->hthread); + aesm_dealloc_resource(p); + AESM_DBG_TRACE("resource of thread %p has been dealloced",param); + }else{ + p->status = AESM_THREAD_INVALID;//It should never be reached + pthread_mutex_unlock(&p->mutex); + AESM_DBG_TRACE("thread %p status invalid",param); + assert(0); + } + return reinterpret_cast(static_cast(err)); +} + +ae_error_t aesm_create_thread(aesm_thread_function_t function_entry, aesm_thread_arg_type_t arg, aesm_thread_t* h) +{ + ae_error_t err = AE_SUCCESS; + int r=0; + int mutex_inited = 0; + int copy_cond_inited = 0; + int timeout_cond_inited = 0; + assert(h!=NULL); + AESM_DBG_TRACE("start to create a thread"); + struct _aesm_thread_t *p=(struct _aesm_thread_t *)malloc(sizeof(struct _aesm_thread_t)); + if(p==NULL){ + AESM_DBG_ERROR("fail to malloc"); + err = AE_OUT_OF_MEMORY_ERROR; + goto ret_point; + } + memset(p, 0, sizeof(struct _aesm_thread_t)); + p->arg = arg; + p->fun_entry = function_entry; + if(pthread_mutex_init(&p->mutex, NULL)!=0){ + err = AE_FAILURE; + AESM_DBG_ERROR("fail to init mutex"); + goto ret_point; + } + mutex_inited=1; + if(pthread_cond_init(&p->copy_cond, NULL)!=0){ + err = AE_FAILURE; + AESM_DBG_ERROR("fail to init copy cond"); + goto ret_point; + } + copy_cond_inited=1; + if(pthread_cond_init(&p->timeout_cond, NULL)!=0){ + err = AE_FAILURE; + AESM_DBG_ERROR("fail to init timeout cond"); + goto ret_point; + } + timeout_cond_inited=1; + p->status = AESM_THREAD_INIT; + r=pthread_create(&p->hthread, NULL, aesm_thread_proc, p); + if(r!=0){ + AESM_DBG_ERROR("fail to create thread"); + err = OAL_THREAD_ERROR; + goto ret_point; + } + *h = p; + AESM_DBG_TRACE("thread %p created successfully",p); +ret_point: + if(err!=AE_SUCCESS&&p!=NULL){ + if(mutex_inited!=0){ + (void)pthread_mutex_destroy(&p->mutex); + } + if(copy_cond_inited!=0){ + (void)pthread_cond_destroy(&p->copy_cond); + } + if(timeout_cond_inited!=0){ + (void)pthread_cond_destroy(&p->timeout_cond); + } + free(p); + } + return err; +} + +ae_error_t aesm_join_thread(aesm_thread_t h, ae_error_t *thread_ret) +{ + void *ret_value; + AESM_DBG_TRACE("start to join thread %p",h); + if(0!=pthread_join(h->hthread, &ret_value)){ + AESM_DBG_ERROR("fail to join thread %p",h); + return OAL_THREAD_ERROR; + } + if(pthread_mutex_lock(&h->mutex)!=0){ + AESM_DBG_ERROR("fail to lock thread %p",h); + return AE_FAILURE; + } + if(h->status != AESM_THREAD_PENDING){ + AESM_DBG_ERROR("thread %p status error %d in join",h,h->status); + h->status = AESM_THREAD_INVALID;//invalid + pthread_mutex_unlock(&h->mutex); + assert(0); + return OAL_THREAD_ERROR; + } + h->status = AESM_THREAD_DETACHED;//no call to pthread_detach after pthread_join + pthread_mutex_unlock(&h->mutex); + *thread_ret = static_cast(reinterpret_cast(ret_value)); + AESM_DBG_TRACE("thread %p join successfully with return value %d",h,*thread_ret); + return AE_SUCCESS; +} + +ae_error_t aesm_free_thread(aesm_thread_t h) +{ + AESM_DBG_TRACE("start to free thread %p",h); + if(pthread_mutex_lock(&h->mutex)!=0){ + AESM_DBG_ERROR("fail to lock thread %p",h); + return AE_FAILURE; + } + if(h->status == AESM_THREAD_INIT){//wait for parameters copy to be finished in thread_proc + AESM_DBG_TRACE("wait for parameter copy in thread %p",h); + (void)pthread_cond_wait(&h->copy_cond, &h->mutex);//ignore the waiting error, we will continue to free the thread info even if waiting failed anyway + //The h->status should have been updated if the waiting of copy_cond is finished + } + if(h->status == AESM_THREAD_RUNNING){ + h->status = AESM_THREAD_FREED; + }else if(h->status == AESM_THREAD_PENDING){ + h->status = AESM_THREAD_DETACHED; + pthread_detach(h->hthread); + AESM_DBG_TRACE("thread %p detached",h); + } + if(h->status == AESM_THREAD_DETACHED){ + pthread_mutex_unlock(&h->mutex); + aesm_dealloc_resource(h); + AESM_DBG_TRACE("thread %p resource dealloced",h); + return AE_SUCCESS; + }else if(h->status != AESM_THREAD_FREED){ + pthread_mutex_unlock(&h->mutex); + AESM_DBG_ERROR("thread %p status error %d",h,h->status); + aesm_dealloc_resource(h);//dealloc anyway + assert(0); + return OAL_THREAD_ERROR; + }else{ + pthread_mutex_unlock(&h->mutex); + AESM_DBG_TRACE("thread %p marked to be free",h); + return AE_SUCCESS; + } +} + + +ae_error_t aesm_wait_thread(aesm_thread_t h, ae_error_t *thread_ret, unsigned long milisecond) +{ + AESM_DBG_TRACE("start to wait thread %p for %d ms",h,milisecond); + pthread_mutex_lock(&h->mutex); + if(h->status==AESM_THREAD_PENDING||h->status==AESM_THREAD_DETACHED){//if the thread has been finished + pthread_mutex_unlock(&h->mutex); + AESM_DBG_TRACE("thread %p is pending",h); + return AE_SUCCESS; + }else if(h->status!=AESM_THREAD_INIT&&h->status!=AESM_THREAD_RUNNING){ + pthread_mutex_unlock(&h->mutex); + AESM_DBG_ERROR("invalid thread status %d for thread %p",h->status,h); + return OAL_THREAD_ERROR; + } + struct timespec abstime; + clock_gettime(CLOCK_REALTIME, &abstime); + abstime.tv_sec += milisecond/1000 + (abstime.tv_nsec/1000000+milisecond%1000)/1000; + abstime.tv_nsec = (abstime.tv_nsec/1000000+milisecond%1000)%1000 *1000000 + abstime.tv_nsec%1000000; + + + + int err_no; + err_no = pthread_cond_timedwait(&h->timeout_cond , &h->mutex , &abstime); + if(err_no == ETIMEDOUT) + { + pthread_mutex_unlock(&h->mutex); + AESM_DBG_TRACE("thread %p waiting timeout",h); + return OAL_THREAD_TIMEOUT_ERROR; + } + else if(err_no == 0) + { + *thread_ret = h->ae_ret; + pthread_mutex_unlock(&h->mutex); + AESM_DBG_TRACE("thread %p is detached with return value %d",h,*thread_ret); + return AE_SUCCESS; + } + else + { + pthread_mutex_unlock(&h->mutex); + AESM_DBG_ERROR("thread wait error in thread %p",h); + return OAL_THREAD_ERROR; + } +} diff --git a/psw/ae/aesm_service/source/oal/aesm_util.cpp b/psw/ae/aesm_service/source/oal/aesm_util.cpp new file mode 100644 index 0000000000..d50b6ffb36 --- /dev/null +++ b/psw/ae/aesm_service/source/oal/aesm_util.cpp @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +//#include "memset_s.h" +#include "persistent_storage_info.h" +#include "oal/aesm_persistent_storage.h" +#include "internal/se_stdio.h" +#include +#include +#include +#include +#include + + +static ae_error_t aesm_get_path( + const char *p_file_name, + char *p_file_path, + size_t buf_size) +{ + if(!p_file_name || !p_file_path) + return OAL_PARAMETER_ERROR; + + Dl_info dl_info; + if(0==dladdr(__builtin_return_address(0), &dl_info)|| + NULL==dl_info.dli_fname) + return AE_FAILURE; + if(strlen(dl_info.dli_fname)>buf_size-1) + return OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; + strncpy(p_file_path,dl_info.dli_fname,buf_size); + char* p_last_slash = strrchr(p_file_path, '/' ); + if ( p_last_slash != NULL ) + { + p_last_slash++; //increment beyond the last slash + *p_last_slash = '\0'; //null terminate the string + } + else p_file_path[0] = '\0'; + if(strlen(p_file_path)+strlen(p_file_name)+sizeof(char)>buf_size) + return OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; + strncat(p_file_path,p_file_name, strlen(p_file_name)); + return AE_SUCCESS; +} + +#define AESM_DATA_FOLDER "/var/opt/aesmd/data/" +static ae_error_t aesm_get_data_path( + const char *p_file_name, + char *p_file_path, + size_t buf_size) +{ + if(!p_file_name || !p_file_path) + return OAL_PARAMETER_ERROR; + + if(strlen(AESM_DATA_FOLDER)+strlen(p_file_name)+sizeof(char)>buf_size) + return OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; + strcpy(p_file_path, AESM_DATA_FOLDER); + strncat(p_file_path,p_file_name, strlen(p_file_name)); + return AE_SUCCESS; +} + +static ae_error_t aesm_write_file( + const uint8_t *p_buf, + uint32_t buf_size, + char *p_file_name, + bool is_full_path) +{ + ae_error_t ret = AE_FAILURE; + uint32_t write_length = 0; + FILE* p_file = NULL; + char p_full_path[MAX_PATH]= {0}; + if(is_full_path){ + if(strlen(p_file_name)>MAX_PATH-1){ + ret = OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; + goto CLEANUP; + } + strcpy(p_full_path, p_file_name); + }else{ + if((ret=aesm_get_data_path(p_file_name, p_full_path, MAX_PATH)) != AE_SUCCESS) + goto CLEANUP; + } + if(NULL == (p_file = fopen(p_full_path, "wb"))){ + ret = OAL_FILE_ACCESS_ERROR; + goto CLEANUP; + } + + write_length = (uint32_t)fwrite(p_buf, 1, buf_size, p_file); + if(buf_size != write_length){ + ret = OAL_FILE_ACCESS_ERROR; + goto CLEANUP; + } + ret = AE_SUCCESS; + +CLEANUP: + if(p_file) + fclose(p_file); + return ret; +} + +static ae_error_t aesm_read_file( + uint8_t *p_buf, + uint32_t& buf_size, + char *p_file_name, + bool is_full_path) +{ + ae_error_t ret = AE_FAILURE; + FILE* p_file = NULL; + char p_full_path[MAX_PATH]= {0}; + if(is_full_path){ + if(strlen(p_file_name)>MAX_PATH-1){ + ret = OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; + goto CLEANUP; + } + strcpy(p_full_path, p_file_name); + }else{ + if((ret=aesm_get_data_path(p_file_name, p_full_path, MAX_PATH)) != AE_SUCCESS) + goto CLEANUP; + } + if(NULL == (p_file = fopen(p_full_path, "rb"))){ + ret = OAL_FILE_ACCESS_ERROR; + goto CLEANUP; + } + + buf_size = (uint32_t)fread(p_buf, 1, buf_size, p_file); + ret = AE_SUCCESS; + +CLEANUP: + if(p_file) + fclose(p_file); + return ret; +} + +ae_error_t aesm_get_pathname(aesm_data_type_t type, aesm_data_id_t id, char *buf, uint32_t buf_size) +{ + const persistent_storage_info_t *info = get_persistent_storage_info(id); + if(info == NULL) + return OAL_PARAMETER_ERROR; + if(info->type != type) + return OAL_PARAMETER_ERROR; + if(info->type == FT_ENCLAVE_NAME){ + char local_info_name[MAX_PATH]; + sprintf(local_info_name,"libsgx_%s.signed.so",info->name); + return aesm_get_path(local_info_name, buf, buf_size); + }else if(info->loc == AESM_LOCATION_DATA){ + return aesm_get_data_path(info->name, buf, buf_size); + }else{//info->loc == AESM_LOCATION_EXE_FOLDER + return aesm_get_path(info->name, buf, buf_size); + } +} + +//alias function for aesm_get_pathname +ae_error_t aesm_get_cpathname(aesm_data_type_t type, aesm_data_id_t id, char *buf, uint32_t buf_size) +{ + return aesm_get_pathname(type, id, buf, buf_size); +} + +ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t *p_size) +{ + char pathname[MAX_PATH]; + ae_error_t ret = AE_SUCCESS; + + const persistent_storage_info_t *info = get_persistent_storage_info(data_id); + if(info == NULL) + return OAL_PARAMETER_ERROR; + if(info->access == AESM_FILE_ACCESS_PATH_ONLY) + return OAL_PARAMETER_ERROR; + + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH); + if(ret != AE_SUCCESS) + return ret; + + struct stat stat_info; + + if(stat(pathname, &stat_info)!=0){//Maybe file has not been created + *p_size = 0; + return AE_SUCCESS; + } + *p_size = (uint32_t)stat_info.st_size; + return AE_SUCCESS; +} + +ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t *buf, uint32_t *p_size) +{ + char pathname[MAX_PATH]; + ae_error_t ret = AE_SUCCESS; + const persistent_storage_info_t *info = get_persistent_storage_info(data_id); + if(info == NULL) + return OAL_PARAMETER_ERROR; + if(info->access == AESM_FILE_ACCESS_PATH_ONLY) + return OAL_PARAMETER_ERROR; + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH); + if(ret != AE_SUCCESS) + return ret; + + if((ret=aesm_read_file(buf, *p_size, pathname, true))!=AE_SUCCESS) + return ret; + return AE_SUCCESS; +} + +ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const uint8_t *buf, uint32_t size) +{ + char pathname[MAX_PATH]; + ae_error_t ret = AE_SUCCESS; + + const persistent_storage_info_t *info = get_persistent_storage_info(data_id); + if(info == NULL) + return OAL_PARAMETER_ERROR; + if(info->access != AESM_FILE_ACCESS_ALL) + return OAL_PARAMETER_ERROR; + + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH); + if(ret != AE_SUCCESS) + return ret; + if((ret=aesm_write_file(buf, size, pathname, true))!=AE_SUCCESS) + return ret; + return AE_SUCCESS; +} + diff --git a/psw/ae/aesm_service/source/oal/error_report.cpp b/psw/ae/aesm_service/source/oal/error_report.cpp new file mode 100644 index 0000000000..aa230adb8a --- /dev/null +++ b/psw/ae/aesm_service/source/oal/error_report.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include "oal/error_report.h" + +void aesm_log_init(void) +{ + openlog("aesm_service", LOG_CONS|LOG_PID, LOG_USER); +} + +void aesm_log_fini(void) +{ + closelog(); +} + +void aesm_log_report(int level, const char *format, ...) +{ + int priority = 0; + va_list ap; + va_start(ap, format); + switch(level){ + case AESM_LOG_REPORT_FATAL: + priority = LOG_CRIT; + break; + case AESM_LOG_REPORT_ERROR: + priority = LOG_ERR; + break; + case AESM_LOG_REPORT_WARNING: + priority = LOG_WARNING; + break; + default: + return;//ignore + } + vsyslog(priority, format, ap); + va_end(ap); +} + diff --git a/psw/ae/aesm_service/source/oal/internal_log.cpp b/psw/ae/aesm_service/source/oal/internal_log.cpp new file mode 100644 index 0000000000..4a692e3352 --- /dev/null +++ b/psw/ae/aesm_service/source/oal/internal_log.cpp @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifdef DBG_LOG +#include "oal/oal.h" +#include "se_wrapper.h" +#include "se_stdio.h" +#include +#include +#include +#include +#include "se_thread.h" +static int aesm_trace_level = TRACE_LOG_LEVEL; +static int at_start=1; + +ae_error_t load_log_config(void); +se_mutex_t cs; +static ae_error_t init_log_file(void) +{ + char filename[MAX_PATH]; + ae_error_t err = aesm_get_pathname(FT_PERSISTENT_STORAGE, AESM_DBG_LOG_FID, filename, MAX_PATH); + if(err != AE_SUCCESS) + return err; + (void)load_log_config(); + return AE_SUCCESS; +} + +#define TIME_BUF_SIZE 100 +void aesm_internal_log(const char *file_name, int line_no, const char *funname, int level, const char *format, ...) +{ + if(level <= aesm_trace_level){ + if(at_start){ + at_start=0; + se_mutex_init(&cs); + init_log_file(); + } + char filename[MAX_PATH]; + ae_error_t err = aesm_get_cpathname(FT_PERSISTENT_STORAGE, AESM_DBG_LOG_FID, filename, MAX_PATH); + if(err != AE_SUCCESS) + return; + FILE *logfile = NULL; + se_mutex_lock(&cs); + errno_t err_code = fopen_s(&logfile, filename, "a+"); + if(err_code!=0){ + se_mutex_unlock(&cs); + return; + } + time_t t; + struct tm time_info; + va_list varg; + char time_buf[TIME_BUF_SIZE]; + time(&t); + struct tm *temp_time_info; + temp_time_info = localtime(&t); + memcpy_s(&time_info, sizeof(time_info), temp_time_info, sizeof(*temp_time_info)); + if(strftime(time_buf, TIME_BUF_SIZE, "%c", &time_info)!=0){ + fprintf(logfile, "[%s|%d|%s|%s]",file_name, line_no, funname, time_buf); + }else{ + fprintf(logfile, "[%s|%d|%s]",file_name, line_no, funname); + } + va_start(varg, format); + vfprintf(logfile, format, varg); + va_end(varg); + fprintf(logfile, "\n"); + fflush(logfile); + fclose(logfile); + se_mutex_unlock(&cs); + } +} + + +void aesm_set_log_level(int level) +{ + aesm_trace_level = level; +} + +static char half_byte_to_char(int x) +{ + assert(0<=x&&x<=0xF); + if(0<=x&&x<=9)return (char)('0'+x); + else return (char)('A'+x-10); +} + +void aesm_dbg_format_hex(const uint8_t *data, uint32_t data_len, char *out_buf, uint32_t buf_size) +{ + uint32_t i; + assert(buf_size>0); + if(data_len==0){ + out_buf[0]='\0'; + return; + } + if(buf_size/3>=data_len){ + for(i=0;i>4)&0xF; + out_buf[i*3]=half_byte_to_char(high); + out_buf[i*3+1]=half_byte_to_char(low); + out_buf[i*3+2]=' '; + } + out_buf[data_len*3-1]='\0'; + }else if(buf_size>10){ + uint32_t tcount=buf_size/3-1; + uint32_t off; + uint32_t ecount=tcount/2,bcount=tcount-ecount; + for(i=0;i>4)&0xF; + out_buf[i*3]=half_byte_to_char(high); + out_buf[i*3+1]=half_byte_to_char(low); + out_buf[i*3+2]=' '; + } + out_buf[i*3]=out_buf[i*3+1]=out_buf[i*3+2]='.'; + off=i*3+3; + for(i=0;i>4)&0xF; + out_buf[off+i*3]=half_byte_to_char(high); + out_buf[off+i*3+1]=half_byte_to_char(low); + out_buf[off+i*3+2]=' '; + } + out_buf[off+i*3-1]='\0'; + }else{ + for(i=0;/*i>4)&0xF; + out_buf[i*3]=half_byte_to_char(high); + out_buf[i*3+1]=half_byte_to_char(low); + out_buf[i*3+2]=' '; + } + out_buf[i*3]='\0'; + } +} + +#include "tinyxml.h" + +static const char *xml_get_child_text(TiXmlNode *parent, const char *name) +{ + if(parent == NULL) return NULL; + TiXmlNode *sub_node = parent->FirstChild(name); + if(sub_node == NULL) return NULL; + TiXmlElement *elem = sub_node->ToElement(); + if(elem == NULL) return NULL; + return elem->GetText(); +} + +static const char *dbg_level_str[]={ + "fatal", + "error", + "warning", + "info", + "debug", + "trace" +}; +#define DBG_LEVEL_COUNT (sizeof(dbg_level_str)/sizeof(dbg_level_str[0])) +static int find_dbg_level_str(const char *text_level) +{ + uint32_t i; + size_t text_level_len = strlen(text_level); + for(i=0;itext_level_len)cur_len=text_level_len; + if(_strnicmp(text_level, dbg_level_str[i], cur_len)==0){ + return (int)i; + } + } + AESM_DBG_ERROR("unkown level %s",text_level); + return -1; +} + +ae_error_t load_log_config(void) +{ + char path_name[MAX_PATH]; + ae_error_t ae_err = AE_SUCCESS; + if((ae_err=aesm_get_cpathname(FT_PERSISTENT_STORAGE, AESM_DBG_LOG_CFG_FID, path_name, MAX_PATH))!=AE_SUCCESS){ + AESM_DBG_ERROR("fail to read config path"); + return ae_err; + } + + TiXmlDocument doc(path_name); + bool load_ok = doc.LoadFile(); + if(!load_ok){ + AESM_DBG_ERROR("fail to load config file %s", path_name); + return OAL_FILE_ACCESS_ERROR; + } + TiXmlNode *pmetadata_node = doc.FirstChild("DbgLog"); + const char *temp_text = xml_get_child_text(pmetadata_node, "level"); + if(temp_text!=NULL){ + if(isdigit(temp_text[0])){ + AESM_SET_DBG_LEVEL(atoi(temp_text)); + }else{ + int level = find_dbg_level_str(temp_text); + if(level>=0){ + AESM_SET_DBG_LEVEL(level); + } + } + }else{ + AESM_DBG_ERROR("fail to find level"); + } + return AE_SUCCESS; +} + +#endif + diff --git a/psw/ae/aesm_service/source/oal/oal_power.cpp b/psw/ae/aesm_service/source/oal/oal_power.cpp new file mode 100644 index 0000000000..74df14cd2f --- /dev/null +++ b/psw/ae/aesm_service/source/oal/oal_power.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +ae_error_t aesm_start_request_wake_execution() +{ + return AE_SUCCESS; +} + +ae_error_t aesm_stop_request_wake_execution() +{ + return AE_SUCCESS; +} + diff --git a/psw/ae/aesm_service/source/protobuf/Makefile b/psw/ae/aesm_service/source/protobuf/Makefile new file mode 100644 index 0000000000..ef629ad97e --- /dev/null +++ b/psw/ae/aesm_service/source/protobuf/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR = $(shell pwd)/../../../../.. +include $(TOP_DIR)/buildenv.mk + +RPC_PROTP_DIR = $(TOP_DIR)/psw/ae/common/proto/ + +RPC_PROTO = messages.proto +RPC_PB_H = messages.pb.h +RPC_PB_C = messages.pb.cc + +PROTOC = protoc + +all: $(RPC_PB_C) + +$(RPC_PROTO): + cp $(RPC_PROTP_DIR)$(RPC_PROTO) . + +$(RPC_PB_C): $(RPC_PROTO) + $(PROTOC) $^ --cpp_out=. + +CLEANFILES = $(RPC_PB_H) $(RPC_PB_C) $(RPC_PROTO) + +clean: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) diff --git a/psw/ae/aesm_service/source/pve/PVEClass.cpp b/psw/ae/aesm_service/source/pve/PVEClass.cpp new file mode 100644 index 0000000000..4ba432e15b --- /dev/null +++ b/psw/ae/aesm_service/source/pve/PVEClass.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "PVEClass.h" +#include "QEClass.h" +#include "util.h" +#include "prof_fun.h" +#include "sgx_report.h" +#include "sgx_tseal.h" +#include "epid_pve_type.h" +#include "provision_enclave_u.h" +#include "provision_enclave_u.c" + +void CPVEClass::before_enclave_load() { + // always unload qe enclave before loading pve enclave + CQEClass::instance().unload_enclave(); +} + +uint32_t CPVEClass::gen_prov_msg1_data( + const psvn_t* psvn, + const signed_pek_t *pek, + bool performance_rekey_used, + prov_msg1_output_t* output) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + AESM_PROFILE_FUN; + if(m_enclave_id==0){ + AESM_DBG_ERROR("call gen_prov_msg1_data without loading PvE"); + return AE_FAILURE; + } + + status = gen_prov_msg1_data_wrapper( + m_enclave_id, &ret, + psvn, + pek, + performance_rekey_used?1:0, + output); + if(status == SGX_ERROR_ENCLAVE_LOST) + ret = AE_ENCLAVE_LOST; + else if(status != SGX_SUCCESS) + ret = AE_FAILURE; + return ret; +} + +uint32_t CPVEClass::get_ek2( + const prov_get_ek2_input_t* input, + prov_get_ek2_output_t* ek2) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + AESM_PROFILE_FUN; + if(m_enclave_id==0){ + AESM_DBG_ERROR("call get_ek2 without loading PvE"); + return AE_FAILURE; + } + + status = get_ek2_wrapper( + m_enclave_id, &ret, + input, + ek2); + if(status == SGX_ERROR_ENCLAVE_LOST) + ret = AE_ENCLAVE_LOST; + else if(status != SGX_SUCCESS) + ret = AE_FAILURE; + return ret; +} + +uint32_t CPVEClass::proc_prov_msg2_data( + const proc_prov_msg2_blob_input_t* input, + const uint8_t* sigrl, + uint32_t sigrl_size, + gen_prov_msg3_output_t* msg3_fixed_output, + uint8_t* epid_sig, + uint32_t epid_sig_buffer_size) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + AESM_PROFILE_FUN; + if(m_enclave_id==0){ + AESM_DBG_ERROR("call proc_prov_msg2_data without loading PvE"); + return AE_FAILURE; + } + + status = proc_prov_msg2_data_wrapper( + m_enclave_id, &ret, + input, + sigrl, sigrl_size, + msg3_fixed_output, + epid_sig, epid_sig_buffer_size); + if(status == SGX_ERROR_ENCLAVE_LOST) + ret = AE_ENCLAVE_LOST; + else if(status != SGX_SUCCESS) + ret = AE_FAILURE; + return ret; +} + +uint32_t CPVEClass::proc_prov_msg4_data( + const proc_prov_msg4_input_t* msg4_input, + proc_prov_msg4_output_t* data_blob) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + AESM_PROFILE_FUN; + if(m_enclave_id==0){ + AESM_DBG_ERROR("call proc_prov_msg4_data without loading PvE"); + return AE_FAILURE; + } + + status = proc_prov_msg4_data_wrapper( + m_enclave_id, &ret, + msg4_input, + data_blob); + if(status == SGX_ERROR_ENCLAVE_LOST) + ret = AE_ENCLAVE_LOST; + else if(status != SGX_SUCCESS) + ret = AE_FAILURE; + return ret; +} + +uint32_t CPVEClass::gen_es_msg1_data( + gen_endpoint_selection_output_t* es_output) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + AESM_PROFILE_FUN; + if(m_enclave_id==0){ + AESM_DBG_ERROR("call gen_es_msg1_data without loading PvE"); + return AE_FAILURE; + } + + status = gen_es_msg1_data_wrapper( + m_enclave_id, &ret, + es_output); + if(status == SGX_ERROR_ENCLAVE_LOST) + ret = AE_ENCLAVE_LOST; + else if(status != SGX_SUCCESS) + ret = AE_FAILURE; + return ret; +} + + diff --git a/psw/ae/aesm_service/source/pve/PVEClass.h b/psw/ae/aesm_service/source/pve/PVEClass.h new file mode 100644 index 0000000000..3ea1a828c9 --- /dev/null +++ b/psw/ae/aesm_service/source/pve/PVEClass.h @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PVE_CLASS_H_ +#define _PVE_CLASS_H_ +#include "AEClass.h" +#include "aeerror.h" +#include "provision_msg.h" +#include "ae_debug_flag.hh" + +class CPVEClass: public SingletonEnclave +{ + friend class Singleton; + friend class SingletonEnclave; + static aesm_enclave_id_t get_enclave_fid(){return PVE_ENCLAVE_FID;} +protected: + CPVEClass(){}; + ~CPVEClass(){}; + virtual void before_enclave_load(); + virtual int get_debug_flag() { return AE_DEBUG_FLAG;} + + uint32_t gen_prov_msg1_data( + const psvn_t* psvn, + const signed_pek_t *pek, + bool performance_rekey_used, + prov_msg1_output_t* output); + + uint32_t get_ek2( + const prov_get_ek2_input_t* input, + prov_get_ek2_output_t* ek2); + + uint32_t proc_prov_msg2_data( + const proc_prov_msg2_blob_input_t* input, + const uint8_t* sigrl, + uint32_t sigrl_size, + gen_prov_msg3_output_t* msg3_fixed_output, + uint8_t* epid_sig, + uint32_t epid_sig_buffer_size); + + uint32_t proc_prov_msg4_data( + const proc_prov_msg4_input_t* msg4_input, + proc_prov_msg4_output_t* data_blob); + +public: + uint32_t gen_es_msg1_data( + gen_endpoint_selection_output_t* es_output); + + uint32_t gen_prov_msg1( + const psvn_t* psvn, + const signed_pek_t& pek, + bool performance_rekey_used, + uint8_t* msg1, + uint32_t msg1_size); + + uint32_t proc_prov_msg2( + const uint8_t* msg2, + uint32_t msg2_size, + const signed_pek_t& pek, + const uint8_t* epid_blob, + uint32_t blob_size, + uint8_t ek2[SK_SIZE], + psvn_t* sigrl_svn, + uint8_t* msg3, + uint32_t msg3_size); + + uint32_t proc_prov_msg4( + bool use_ek2_in_input, + const uint8_t ek2[SK_SIZE], + const uint8_t* msg4, + uint32_t msg4_size, + uint8_t* data_blob, + uint32_t blob_size); + + uint32_t gen_es_msg1( + uint8_t *msg, + uint32_t msg_size, + const gen_endpoint_selection_output_t& es1_output); + + uint32_t proc_es_msg2( + const uint8_t *msg, + uint32_t msg_size, + char server_url[MAX_PATH], + uint16_t& ttl, + const uint8_t xid[XID_SIZE], + uint8_t rsa_signature[PVE_RSA_KEY_BYTES], + signed_pek_t& pek); +}; +#endif + diff --git a/psw/ae/aesm_service/source/pve/prov_msg_size.h b/psw/ae/aesm_service/source/pve/prov_msg_size.h new file mode 100644 index 0000000000..ebf7a737e1 --- /dev/null +++ b/psw/ae/aesm_service/source/pve/prov_msg_size.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _PROV_MSG_SIZE_H_ +#define _PROV_MSG_SIZE_H_ + +#include "type_length_value.h" + +/*Inline functions to estimate size of ProvMsg1, ProvMsg3 etc*/ + +/*Function to estimate the size of ProvMsg1 + TLV_CIPHER_TEXT(SK, PSID): E+MAC(Device_ID_TLV[:FLAG_TLV])*/ +inline uint32_t estimate_msg1_size(bool performance_rekey) +{ + size_t field0_size = CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES); + size_t field1_0_size = DEVICE_ID_TLV_SIZE(); + size_t field1_1_size = performance_rekey? FLAGS_TLV_SIZE():0; + size_t field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field1_0_size+field1_1_size); + size_t field2_size = MAC_TLV_SIZE(MAC_SIZE); + return static_cast(PROVISION_REQUEST_HEADER_SIZE+field0_size+field1_size+field2_size); /*no checking for integer overflow since the size of msg1 is fixed and small*/ +} + +/*Function to estimate the size of ProvMsg3 + NONCE_TLV(NONCE_SIZE):E+MAC(E+MAC(EPID_JOIN_PROOF_TLV):E+MAC(EPID_SIGNATURE_TLV))*/ +inline uint32_t calc_msg3_size_by_sigrl_count(uint32_t sigrl_count) +{ + size_t field0_size = NONCE_TLV_SIZE(NONCE_SIZE); + size_t field1_0_size = BLOCK_CIPHER_TEXT_TLV_SIZE(EPID_JOIN_PROOF_TLV_SIZE()); + size_t field1_1_size = MAC_TLV_SIZE(MAC_SIZE); + size_t field3_0_size = EPID_SIGNATURE_TLV_SIZE(sigrl_count); + size_t field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field1_0_size+field1_1_size); + size_t field2_size = MAC_TLV_SIZE(MAC_SIZE); + size_t field3_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field3_0_size); + size_t field4_size = MAC_TLV_SIZE(MAC_SIZE); + return static_cast(PROVISION_REQUEST_HEADER_SIZE+field0_size+field1_size+field2_size+field3_size+field4_size); +} + +/*Function to estimate the count of SigRL Entry inside a ProvMsg2 + Nonce_TLV(NONCE_SIZE):E+MAC(PubGroupCert:ChallengeNonce[:SigrlPSVN]:PSID:E+MAC(TCB_KEY):deviceID)[:signed SigRL]*/ +inline uint32_t estimate_sigrl_count_by_msg2_size(uint32_t msg2_size) +{ + size_t field_0_size = NONCE_TLV_SIZE(NONCE_SIZE); + size_t field_1_0_size = EPID_GROUP_CERT_TLV_SIZE(); + size_t field_1_1_size = NONCE_TLV_SIZE(CHALLENGE_NONCE_SIZE); + size_t field_1_2_size = EPID_SIGRL_PSVN_TLV_SIZE(); /*It is always present if sigrl entry count is nonzero*/ + size_t field_1_3_size = PSID_TLV_SIZE(); + size_t field_1_4_size = BLOCK_CIPHER_TEXT_TLV_SIZE(SK_SIZE); + size_t field_1_5_size = MAC_TLV_SIZE(MAC_SIZE); + size_t field_1_6_size = DEVICE_ID_TLV_SIZE(); + size_t field_1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field_1_0_size+field_1_1_size+field_1_2_size + + field_1_3_size + field_1_4_size + field_1_5_size + field_1_6_size); + size_t field_2_size = MAC_TLV_SIZE(MAC_SIZE); + size_t field_3_size = 0; + if(PROVISION_RESPONSE_HEADER_SIZE+field_0_size+field_1_size+field_2_size>=msg2_size) + return 0; + field_3_size = msg2_size - (PROVISION_RESPONSE_HEADER_SIZE+field_0_size+field_1_size+field_2_size); + if(field_3_size < ECDSA_SIGN_SIZE*2 +sizeof(SigRL)) + return 0; + field_3_size -= ECDSA_SIGN_SIZE*2 + sizeof(SigRL); + /*The first SigRLEntry has been included into SigRL structure so that an extra 1 is added*/ + return static_cast(1+field_3_size/sizeof(SigRLEntry)); +} + +inline uint32_t estimate_msg3_size_by_msg2_size(uint32_t msg2_size) +{ + return calc_msg3_size_by_sigrl_count(estimate_sigrl_count_by_msg2_size(msg2_size)); +} + +inline uint32_t estimate_es_msg1_size(void) +{ + return static_cast(PROVISION_REQUEST_HEADER_SIZE+ES_SELECTOR_TLV_SIZE()); +} +#endif + diff --git a/psw/ae/aesm_service/source/pve/pve_logic.cpp b/psw/ae/aesm_service/source/pve/pve_logic.cpp new file mode 100644 index 0000000000..8853118e60 --- /dev/null +++ b/psw/ae/aesm_service/source/pve/pve_logic.cpp @@ -0,0 +1,436 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "pve_logic.h" +#include "aesm_logic.h" +#include "PVEClass.h" +#include "QEClass.h" +#include "oal/oal.h" +#include "aesm_epid_blob.h" +#include "se_wrapper.h" +#include "prov_msg_size.h" +#include "network_encoding_wrapper.h" +#include "prof_fun.h" +#include "aesm_long_lived_thread.h" +#include + +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} + +//Function to continue process Provisioning logic when the response of ProvMsg1 is ProvMsg2 +ae_error_t PvEAESMLogic::process_pve_msg2(psvn_t& sigrl_psvn, const uint8_t* msg2, uint32_t msg2_size, const endpoint_selection_infos_t& es_info) +{ + uint32_t msg_size = 0; + uint8_t *msg = NULL; + uint8_t *resp_msg = NULL; + uint32_t resp_size = 0; + epid_blob_with_cur_psvn_t epid_data; + ae_error_t ret = AE_SUCCESS; + uint8_t ek2[SK_SIZE]; + AESM_PROFILE_FUN; + + AESM_DBG_DEBUG("enter fun"); + AESM_DBG_TRACE("processing msg2 whose length is %d",msg2_size); + memset(&epid_data, 0, sizeof(epid_data)); + + + if(EPIDBlob::instance().read(epid_data)!=AE_SUCCESS){ + //First try to read existing EPID Blob to get old epid blob + //error code of reading epid blob will be ignored since old epid blob is optional + AESM_DBG_TRACE("read old epid blob fail"); + }else{ + AESM_DBG_TRACE("succ read old epid blob"); + } + + msg_size = estimate_msg3_size_by_msg2_size(msg2_size); //estimate an upbound for msg3 size + AESM_DBG_TRACE("estimate msg3 size: %d",msg_size); + + assert(msg_size > 0); + msg = reinterpret_cast(malloc(msg_size)); + if(msg == NULL){ + AESM_DBG_ERROR("malloc failed"); + ret = AE_OUT_OF_MEMORY_ERROR; + goto CLEANUP; + } + memset(msg, 0, msg_size); + AESM_DBG_TRACE("start processing msg2 and gen msg3"); + ret = static_cast(CPVEClass::instance().proc_prov_msg2(msg2, msg2_size, es_info.pek, epid_data.trusted_epid_blob, SGX_TRUSTED_EPID_BLOB_SIZE,//discard curpsvn in epid blob which is used in untrusted code only + ek2, &sigrl_psvn, msg, msg_size));//with help of PvE, process ProvMsg2 and generate ProvMsg3 + + if(ret == AE_SUCCESS){ + if(GET_SIZE_FROM_PROVISION_REQUEST(msg)>msg_size){ + AESM_DBG_ERROR("prov msg2 size %d is larger than buffer size %d", GET_SIZE_FROM_PROVISION_REQUEST(msg), msg_size); + ret = PVE_UNEXPECTED_ERROR; + goto CLEANUP; + } + AESM_DBG_TRACE("Start send msg3 and recv msg4"); + msg_size = static_cast(GET_SIZE_FROM_PROVISION_REQUEST(msg));//get the real size of ProvMsg3 + ret = AESMNetworkEncoding::aesm_send_recv_msg_encoding(es_info.provision_url, + msg, msg_size, resp_msg, resp_size); //Encoding ProvMsg3, send to server, receive ProvMsg4 and decode + if(ret != AE_SUCCESS){ + AESM_LOG_ERROR("%s",g_event_string_table[SGX_EVENT_EPID_PROV_FAILURE]); + AESM_DBG_WARN("send prov msg3 via network failed:%d",ret); + goto CLEANUP; + } + assert(resp_msg!=NULL); + AESM_DBG_TRACE("Start to proc msg4"); + ret = process_pve_msg4(resp_msg, resp_size, NULL, true, ek2);//The response msg must be ProvMsg4, process it to generate EPIDBlob + if(ret != AE_SUCCESS){ + AESM_DBG_TRACE("processing msg4 failed:%d",ret); + goto CLEANUP; + } + ret = AE_SUCCESS; + AESM_DBG_TRACE("processing msg4 succ"); + }else{ + AESM_DBG_WARN("fail to process prov msg2:%d",ret); + } +CLEANUP: + SAFE_FREE(msg); + if(resp_msg!=NULL) + AESMNetworkEncoding::aesm_free_response_msg(resp_msg); + return ret; +} + +//Function to finish the Provisioning Logic when a ProvMsg4 is expected or encountered +ae_error_t PvEAESMLogic::process_pve_msg4(const uint8_t* msg4, uint32_t msg4_size, const psvn_t* old_psvn, bool use_ek2, const uint8_t ek2[SK_SIZE]) +{ + AESM_PROFILE_FUN; + epid_blob_with_cur_psvn_t epid_data; + ae_error_t ret = AE_SUCCESS; + + AESM_DBG_DEBUG("enter fun"); + AESM_DBG_TRACE("processing msg4 with size %d",msg4_size); + memset(&epid_data, 0, sizeof(epid_data)); + + //with the help of PvE to process ProvMsg4 and generate EPIDDataBlob + if((ret = static_cast(CPVEClass::instance().proc_prov_msg4(use_ek2, ek2, msg4, msg4_size, + epid_data.trusted_epid_blob, SGX_TRUSTED_EPID_BLOB_SIZE )))!=AE_SUCCESS){ + AESM_DBG_WARN("proc prov msg4 fail:%d",ret); + goto fini; + } + if(NULL != old_psvn){ + if(0!=memcpy_s(&epid_data.cur_psvn, sizeof(epid_data.cur_psvn), + old_psvn, sizeof(psvn_t))){ + AESM_DBG_ERROR("memcpy failed"); + ret = PVE_UNEXPECTED_ERROR; + goto fini; + } + }else{//using current QE/PvE PSVN + uint16_t isv_svn; + ret = AESMLogic::get_qe_cpu_svn(epid_data.cur_psvn.cpu_svn); + if(AE_SUCCESS != ret){ + goto fini; + } + ret = AESMLogic::get_qe_isv_svn(isv_svn); + if(AE_SUCCESS != ret){ + goto fini; + } + if(0!=memcpy_s(&epid_data.cur_psvn.isv_svn, sizeof(epid_data.cur_psvn.isv_svn), &isv_svn, sizeof(isv_svn))){ + AESM_DBG_ERROR("memcpy failed"); + ret = PVE_UNEXPECTED_ERROR; + goto fini; + } + } + ret=EPIDBlob::instance().write(epid_data);//save the data into persistent data storage + if(AE_SUCCESS!=ret){ + AESM_DBG_WARN("fail to write epid_data:%d",ret); + } +fini: + return (ae_error_t)ret; +} + +//Function to process the Provisioning Logic for backup retrieval of old epid data blob +//The function assumes that the PvE state has been IDLE +ae_error_t PvEAESMLogic::update_old_blob(const psvn_t& psvn, const endpoint_selection_infos_t& es_info) +{ + uint32_t msg_size = 0; + uint8_t *msg = NULL; + uint32_t ae_ret = AE_SUCCESS; + uint8_t *resp_msg = NULL; + uint32_t resp_size = 0; + + AESM_PROFILE_FUN; + AESM_DBG_DEBUG("enter fun"); + + msg_size = estimate_msg1_size(false); + assert(msg_size > 0); + + msg = reinterpret_cast(malloc(msg_size)); + if(msg == NULL){ + AESM_DBG_ERROR("malloc fail"); + ae_ret = AE_OUT_OF_MEMORY_ERROR; + goto ret_point; + } + memset(msg, 0, msg_size); + + AESM_DBG_TRACE("start to gen prov msg1, estimated size %d", msg_size); + ae_ret = CPVEClass::instance().gen_prov_msg1(&psvn, es_info.pek, + false, msg, msg_size);//generate ProvMsg1 + if (ae_ret != AE_SUCCESS) + { + AESM_DBG_WARN("gen prov msg1 failed:%d",ae_ret); + goto ret_point; + } + msg_size = static_cast(GET_SIZE_FROM_PROVISION_REQUEST(msg)); + + AESM_DBG_TRACE("start to send msg1 to server and recv msg4"); + ae_ret = AESMNetworkEncoding::aesm_send_recv_msg_encoding(es_info.provision_url, + msg, msg_size, resp_msg,resp_size);//encoding/send/receive/decoding + if(ae_ret != AE_SUCCESS){ + AESM_LOG_ERROR("%s",g_event_string_table[SGX_EVENT_EPID_PROV_FAILURE]); + AESM_DBG_WARN("send prov msg1 via network failed:%d",ae_ret); + goto ret_point; + } + assert(resp_msg != NULL); + if (resp_size < PROVISION_RESPONSE_HEADER_SIZE) { + AESM_DBG_WARN("response message %d too small",resp_size); + ae_ret = PVE_UNEXPECTED_ERROR; + goto ret_point; + } + + AESM_DBG_TRACE("start to proc msg4"); + + if(GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg) == TYPE_PROV_MSG4){ + ae_ret = process_pve_msg4(resp_msg, resp_size, &psvn, false, NULL);//process ProvMsg4 and generated/save EPID Data Blob + AESM_DBG_TRACE("msg4 processing finished, status %d",ae_ret); + }else{ + AESM_DBG_WARN("response message is not prov msg4"); + ae_ret = PVE_UNEXPECTED_ERROR; + } +ret_point: + if(msg)free(msg); + if(resp_msg!=NULL){ + AESMNetworkEncoding::aesm_free_response_msg(resp_msg); + } + return (ae_error_t)ae_ret; +} + +aesm_error_t PvEAESMLogic::pve_error_postprocess(ae_error_t ae_error) +{ + switch(ae_error){ + case AE_SUCCESS: + return AESM_SUCCESS; + case OAL_NETWORK_UNAVAILABLE_ERROR: + { + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_EPID_PROV_FAILURE]); + return AESM_NETWORK_ERROR; + } + case OAL_THREAD_TIMEOUT_ERROR: + return AESM_BUSY; + case OAL_NETWORK_BUSY: + return AESM_NETWORK_BUSY_ERROR; + case OAL_PROXY_SETTING_ASSIST: + return AESM_PROXY_SETTING_ASSIST; + case OAL_FILE_ACCESS_ERROR: + case OAL_CONFIG_FILE_ERROR: + return AESM_FILE_ACCESS_ERROR; + case PVE_PARAMETER_ERROR: + case AE_INVALID_PARAMETER: + case OAL_PARAMETER_ERROR: + return AESM_PARAMETER_ERROR; + case PVE_EPIDBLOB_ERROR: + return AESM_EPIDBLOB_ERROR; + case AE_ENCLAVE_LOST: + case AE_SERVER_NOT_AVAILABLE: + return AESM_NO_DEVICE_ERROR; + case PVE_INTEGRITY_CHECK_ERROR: + { + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_EPID_PROV_INTEGRITY_ERROR]); + return AESM_SGX_PROVISION_FAILED; + } + case PVE_SIGRL_INTEGRITY_CHECK_ERROR: + { + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_EPID20_SIGRL_INTEGRITY_ERROR]); + return AESM_SGX_PROVISION_FAILED; + } + case PVE_SERVER_REPORTED_ERROR: + case PVE_MSG_ERROR: + return AESM_SGX_PROVISION_FAILED; + case PVE_REVOKED_ERROR: + return AESM_EPID_REVOKED_ERROR; + case PVE_SERVER_BUSY_ERROR: + return AESM_BACKEND_SERVER_BUSY; + case AE_OUT_OF_MEMORY_ERROR: + return AESM_OUT_OF_MEMORY_ERROR; + case PSW_UPDATED_REQUIRED: + return AESM_UPDATE_AVAILABLE; + default: + return AESM_UNEXPECTED_ERROR; + } +} + +aesm_error_t PvEAESMLogic::provision(bool performance_rekey_used, uint32_t timeout_usec) +{ + ae_error_t ae_ret = AE_SUCCESS; + AESM_PROFILE_FUN; + AESM_DBG_DEBUG("enter fun"); + + ae_ret = start_epid_provision_thread(performance_rekey_used, timeout_usec); + + return pve_error_postprocess(ae_ret); +} + + +ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) +{ + uint32_t msg_size = 0; + uint8_t *msg = NULL; + uint8_t *resp_msg = NULL; + uint32_t resp_size = 0; + ae_error_t ae_ret = AE_SUCCESS; + uint32_t repeat = 0; + int retry = 0; + endpoint_selection_infos_t es_info; + + if(AE_SUCCESS!=(ae_ret=aesm_start_request_wake_execution())){ + AESM_DBG_ERROR("fail to request wake execution:%d", ae_ret); + return ae_ret; + } + + if((ae_ret = EndpointSelectionInfo::instance().start_protocol(es_info))!=AE_SUCCESS){//EndPoint Selection Protocol to setup Provisioning URL + (void)aesm_stop_request_wake_execution(); + AESM_DBG_WARN("end point selection failed:%d",ae_ret); + return ae_ret; + } + + //If enclave_lost encountered(such as S3/S4 reached, the retry will be increased by 1, for other kinds of exception like network error, repeat is increased by 1) + while((ae_ret!=AE_ENCLAVE_LOST&&repeat < AESM_RETRY_COUNT) || (ae_ret == AE_ENCLAVE_LOST && retry < AESM_RETRY_COUNT)){ + if(ae_ret == AE_ENCLAVE_LOST){ + AESM_DBG_TRACE("enclave lost inside SGX Provisioning and reload PvE required"); + CPVEClass::instance().unload_enclave();//force PVE to be reloaded later + } + if((ae_ret = CPVEClass::instance().load_enclave())!=AE_SUCCESS) + { + AESM_DBG_ERROR("load pve failed:%d",ae_ret); + break; + } + //estimate upbound size of ProvMsg1 and alloc memory for it + msg_size = estimate_msg1_size(performance_rekey_used); + AESM_DBG_TRACE("estimate msg1 size :%d",msg_size); + assert(msg_size > 0); + if(msg!=NULL)free(msg); + msg = (uint8_t *)malloc(msg_size); + if(msg == NULL){ + AESM_DBG_TRACE("malloc failed"); + ae_ret = AE_OUT_OF_MEMORY_ERROR; + break; + } + memset(msg, 0, msg_size); + + //Generate ProvMsg1 + ae_ret = static_cast(CPVEClass::instance().gen_prov_msg1(NULL, es_info.pek, performance_rekey_used, msg, msg_size));//Generate ProvMsg1 + if (ae_ret != AE_SUCCESS) + { + if(ae_ret == AE_ENCLAVE_LOST){ + AESM_DBG_TRACE("Enclave lost after gen_prov_msg1"); + retry++; + continue; + } + AESM_DBG_WARN("fail to generate prov msg1:%d",ae_ret); + break; + } + assert( msg != NULL && GET_SIZE_FROM_PROVISION_REQUEST(msg) >= PROVISION_REQUEST_HEADER_SIZE); + msg_size = static_cast(GET_SIZE_FROM_PROVISION_REQUEST(msg)); + AESM_DBG_TRACE("msg1 generated with size %d",msg_size); + + if(resp_msg!=NULL){ + AESMNetworkEncoding::aesm_free_response_msg(resp_msg); + resp_msg=NULL; + } + AESM_DBG_TRACE("start to send prov msg1 and recv response"); + ae_ret = AESMNetworkEncoding::aesm_send_recv_msg_encoding(es_info.provision_url, + msg,msg_size, resp_msg, resp_size);//encoding/send ProvMsg1, receiving and decoding resp message + if(ae_ret != AE_SUCCESS){ + AESM_DBG_WARN("send msg1 via network fail:%d",ae_ret); + break;//aesm_send_recv_se_msg will not return AE_ENCLAVE_LOST + } + + assert (resp_msg != NULL && resp_size >= PROVISION_RESPONSE_HEADER_SIZE); + + if(GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg) == TYPE_PROV_MSG2){//If responsed msg is ProvMsg2 + psvn_t sigrl_svn; + AESM_DBG_TRACE("start to process prov msg2, size %d", resp_size); + ae_ret = process_pve_msg2(sigrl_svn, resp_msg, resp_size, es_info); + if(ae_ret != AE_SUCCESS){ + if(ae_ret == PVE_EPIDBLOB_ERROR){//If it reports old EPID Blob Error + AESM_DBG_TRACE("retrieve old epid blob"); + if((ae_ret = update_old_blob(sigrl_svn, es_info))!=AE_SUCCESS){//try to retrieve old EPID blob from backend server + if(ae_ret == AE_ENCLAVE_LOST){ + AESM_DBG_TRACE("PvE Enclave lost in update_old_blob"); + retry++; + continue; + } + AESM_DBG_WARN("fail to retrieve old epid blob:%d",ae_ret); + break; + }else{ + AESM_DBG_TRACE("retrieve old epid blob successfully"); + ae_ret = AE_FAILURE;//set to failure + repeat++;//only retry after update old epid blob + continue; + } + }else if(ae_ret == AE_ENCLAVE_LOST){ + AESM_DBG_TRACE("PvE enclave lost in process_pve_msg2"); + retry++; + continue; + }else{ + AESM_DBG_WARN("processing prov msg2 failed:%d",ae_ret); + break; + } + } + }else if(GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg) == TYPE_PROV_MSG4){ + AESM_DBG_TRACE("start to process prov msg4 for current psvn"); + if((ae_ret = process_pve_msg4(resp_msg,resp_size, NULL, false, NULL))!=AE_SUCCESS){//process ProvMsg4 to generate EPID blob if resp is Msg4 + if(ae_ret == AE_ENCLAVE_LOST){ + AESM_DBG_TRACE("PvE Enclave lost in process_pve_msg4"); + retry++; + continue; + } + AESM_DBG_WARN("fail to process prov msg4:%d",ae_ret); + break; + } + }else{ + AESM_DBG_ERROR("Invalid resp msg type from backend server:%d",(int)GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg)); + ae_ret = AE_FAILURE; + break; + } + AESM_DBG_TRACE("provisioning succ"); + ae_ret = AE_SUCCESS; + break; + } + + SAFE_FREE(msg); + if(resp_msg!=NULL){ + AESMNetworkEncoding::aesm_free_response_msg(resp_msg); + } + (void)aesm_stop_request_wake_execution(); + return ae_ret; + +} diff --git a/psw/ae/aesm_service/source/pve/pve_logic.h b/psw/ae/aesm_service/source/pve/pve_logic.h new file mode 100644 index 0000000000..c07a1495f8 --- /dev/null +++ b/psw/ae/aesm_service/source/pve/pve_logic.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PVE_LOGIC_H_ +#define _PVE_LOGIC_H_ +#include "sgx_urts.h" +#include "aesm_error.h" +#include "arch.h" +#include "aeerror.h" +#include "tlv_common.h" +#include "se_thread.h" +#include "oal/oal.h" +#include "se_wrapper.h" +#include +#include + +typedef struct _endpoint_selection_infos_t endpoint_selection_infos_t; + +class PvEAESMLogic{ +public: + static aesm_error_t provision(bool performance_rekey_used, uint32_t timeout_usec); + static aesm_error_t pve_error_postprocess(ae_error_t ae_error); + static ae_error_t epid_provision_thread_func(bool performance_rekey_used); /*call get_epid_provision_thread_status().start(performance_rekey_used) to invoke this function with timeout*/ +private: + static ae_error_t update_old_blob(const psvn_t& psvn, const endpoint_selection_infos_t& es_info); + static ae_error_t process_pve_msg2(psvn_t& sigrl_psvn, const uint8_t *msg2, uint32_t msg2_size, const endpoint_selection_infos_t& es_info); + static ae_error_t process_pve_msg4(const uint8_t *msg4, uint32_t msg4_size, const psvn_t* old_psvn, bool use_ek2, const uint8_t ek2[SK_SIZE]); +}; +#endif + diff --git a/psw/ae/aesm_service/source/qe/QEClass.cpp b/psw/ae/aesm_service/source/qe/QEClass.cpp new file mode 100644 index 0000000000..7e41bdaf76 --- /dev/null +++ b/psw/ae/aesm_service/source/qe/QEClass.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "arch.h" +#include "QEClass.h" +#include "PVEClass.h" +#include "se_memcpy.h" +#include "prof_fun.h" +#include "quoting_enclave_u.h" +#include "quoting_enclave_u.c" + +void CQEClass::before_enclave_load() { + // always unload qe enclave before loading pve enclave + CPVEClass::instance().unload_enclave(); +} + +uint32_t CQEClass::get_qe_target( + sgx_target_info_t *p_qe_target) +{ + token_t *p_launch = + reinterpret_cast(&m_launch_token); + + /* We need to make sure the QE is successfully loaded and then we can use + the cached attributes and launch token. */ + assert(m_enclave_id); + memset(p_qe_target, 0, sizeof(sgx_target_info_t)); + memcpy_s(&p_qe_target->attributes, sizeof(p_qe_target->attributes), + &m_attributes.secs_attr, sizeof(m_attributes.secs_attr)); + memcpy_s(&p_qe_target->misc_select, sizeof(p_qe_target->misc_select), + &m_attributes.misc_select, sizeof(m_attributes.misc_select)); + memcpy_s(&p_qe_target->mr_enclave, sizeof(p_qe_target->mr_enclave), + &p_launch->body.mr_enclave, + sizeof(p_launch->body.mr_enclave)); + return AE_SUCCESS; +} + +uint32_t CQEClass::verify_blob( + uint8_t *p_epid_blob, + uint32_t blob_size, + bool *p_is_resealed) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + uint8_t is_resealed = 0; + int retry = 0; + AESM_PROFILE_FUN; + + assert(m_enclave_id); + status = ::verify_blob(m_enclave_id, &ret, p_epid_blob, blob_size, + &is_resealed); + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = ::verify_blob(m_enclave_id, &ret, p_epid_blob, blob_size, + &is_resealed); + } + if(status != SGX_SUCCESS) + return AE_FAILURE; + if(ret == AE_SUCCESS) + { + *p_is_resealed = is_resealed != 0; + } + if(ret == QE_EPIDBLOB_ERROR) + { + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_EPID_INTEGRITY_ERROR]); + } + return ret; +} + +uint32_t CQEClass::get_quote( + uint8_t *p_epid_blob, + uint32_t blob_size, + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sigrl, + uint32_t sigrl_size, + sgx_report_t *p_qe_report, + uint8_t *p_quote, + uint32_t quote_size) +{ + uint32_t ret = AE_SUCCESS; + sgx_status_t status = SGX_SUCCESS; + int retry = 0; + AESM_PROFILE_FUN; + + assert(m_enclave_id); + status = ::get_quote( + m_enclave_id, + &ret, + p_epid_blob, + blob_size, + p_report, + quote_type, + p_spid, + p_nonce, + p_sigrl, + sigrl_size, + p_qe_report, + p_quote, + quote_size); + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = ::get_quote( + m_enclave_id, + &ret, + p_epid_blob, + blob_size, + p_report, + quote_type, + p_spid, + p_nonce, + p_sigrl, + sigrl_size, + p_qe_report, + p_quote, + quote_size); + } + if(status != SGX_SUCCESS) + return AE_FAILURE; + if(ret == QE_REVOKED_ERROR) + { + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_EPID_REVOCATION]); + } + else if(ret == QE_SIGRL_ERROR) + { + AESM_LOG_FATAL("%s", g_event_string_table[SGX_EVENT_EPID20_SIGRL_INTEGRITY_ERROR]); + } + return ret; +} diff --git a/psw/ae/aesm_service/source/qe/QEClass.h b/psw/ae/aesm_service/source/qe/QEClass.h new file mode 100644 index 0000000000..e1e83ea4d4 --- /dev/null +++ b/psw/ae/aesm_service/source/qe/QEClass.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _QE_CLASS_H_ +#define _QE_CLASS_H_ +#include "AEClass.h" +#include "aeerror.h" +#include "sgx_report.h" +#include "sgx_quote.h" +#include "ae_debug_flag.hh" + +class CQEClass: public SingletonEnclave +{ + friend class Singleton; + friend class SingletonEnclave; + static aesm_enclave_id_t get_enclave_fid(){return QE_ENCLAVE_FID;} +protected: + CQEClass(){}; + ~CQEClass(){}; + virtual void before_enclave_load(); + virtual int get_debug_flag() { return AE_DEBUG_FLAG;} + +public: + uint32_t get_qe_target( + sgx_target_info_t *p_qe_target); + uint32_t verify_blob( + uint8_t *p_epid_blob, + uint32_t blob_size, + bool *p_is_resealed); + uint32_t get_quote( + uint8_t *p_epid_blob, + uint32_t blob_size, + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sigrl, + uint32_t sigrl_size, + sgx_report_t *p_qe_report, + uint8_t *p_quote, + uint32_t quote_size); +}; +#endif + diff --git a/psw/ae/aesm_service/source/qe/qe_logic.cpp b/psw/ae/aesm_service/source/qe/qe_logic.cpp new file mode 100644 index 0000000000..66d8e567b2 --- /dev/null +++ b/psw/ae/aesm_service/source/qe/qe_logic.cpp @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "aesm_epid_blob.h" +#include "qe_logic.h" +#include "pve_logic.h" +#include "aesm_logic.h" +#include "PVEClass.h" +#include "QEClass.h" +#include "se_sig_rl.h" +#include "se_quote_internal.h" +#include "se_wrapper.h" +#include "prof_fun.h" +#include "util.h" + +static ae_error_t get_qe_target(sgx_target_info_t *p_qe_target) +{ + ae_error_t ae_ret = AE_SUCCESS; + + if((ae_ret = CQEClass::instance().load_enclave())!=AE_SUCCESS) + { + AESM_DBG_ERROR("Fail to load QE:%d",ae_ret); + return ae_ret; + } + ae_ret = static_cast(CQEClass::instance().get_qe_target(p_qe_target)); + if(ae_ret != AE_SUCCESS) + return ae_ret; + return AE_SUCCESS; +} + +//Function to do reprovision if flag updated is false and set it to true if updated successfully +//The flag updated is used to simpilify logic in caller's code so that provision will not be invoked again +//if a previous provision has been successfully run +//After reprovision, the output epid_blob will be copied into output parameter epid_data +static aesm_error_t try_reprovision_if_not(bool& updated, epid_blob_with_cur_psvn_t& epid_data) +{ + aesm_error_t aesm_result; + ae_error_t ae_ret; + if(updated){ + // We've just got a EPID blob. It's a rare case to reach here. + // No retry, just return error. + AESM_DBG_ERROR("try to reprovision again after another provision"); + return AESM_EPIDBLOB_ERROR; + } + // The EPID blob is corrupted, and we've not provisioned yet, then + // we need to start the provision process. + if((aesm_result = PvEAESMLogic::provision(false, THREAD_TIMEOUT))!=AESM_SUCCESS){ + + AESM_DBG_ERROR("pve provision failed:%d", aesm_result); + return aesm_result; + } + updated = true; + // Update the epid blob after a successful provisioning. + if((ae_ret = EPIDBlob::instance().read(epid_data))!=AE_SUCCESS){ + AESM_DBG_ERROR("read epid blob failed:%d", ae_ret); + return AESM_EPIDBLOB_ERROR; + } + return AESM_SUCCESS; +} + +//Function to fetch gid from Epid Data Blob and also return target info +//EPID Provisioning will be redone if Epid Data Blob is not existing/invalid or +// the qe_isv_svn or cpu_svn don't match that in Epid Data Blob +aesm_error_t QEAESMLogic::init_quote( + sgx_target_info_t *target, + uint8_t *gid, uint32_t gid_size, + uint16_t qe_isv_svn, const sgx_cpu_svn_t qe_cpu_svn) +{ + ae_error_t ae_ret = AE_SUCCESS; + EPIDBlob& epid_blob = EPIDBlob::instance(); + AESM_DBG_DEBUG("enter fun"); + aesm_error_t aesm_result = AESM_UNEXPECTED_ERROR; + + AESM_PROFILE_FUN; + + epid_blob_with_cur_psvn_t epid_data; + bool resealed = false; + bool updated = false; + memset(&epid_data,0,sizeof(epid_data)); + + AESM_DBG_TRACE("start read and verify old epid blob"); + if((ae_ret = epid_blob.read(epid_data))!=AE_SUCCESS){ + if(AESM_SUCCESS!=(aesm_result = try_reprovision_if_not(updated, epid_data))){ + goto ret_point; + } + } + + if((ae_ret = CQEClass::instance().load_enclave())!=AE_SUCCESS) + { + AESM_DBG_ERROR("Fail to load QE:%d", ae_ret); + aesm_result = AESM_UNEXPECTED_ERROR; + goto ret_point; + } + ae_ret = static_cast(CQEClass::instance().verify_blob(epid_data.trusted_epid_blob, + SGX_TRUSTED_EPID_BLOB_SIZE, + &resealed)); + if(ae_ret == QE_EPIDBLOB_ERROR){ + if(AESM_SUCCESS!=(aesm_result = try_reprovision_if_not(updated, epid_data))){ + goto ret_point; + } + } + else if(ae_ret != AE_SUCCESS) + { + aesm_result = AESM_UNEXPECTED_ERROR; + goto ret_point; + } + + // Assert the size of GID, we have already checked it in upper level. + assert(sizeof(uint32_t) == gid_size); + UNUSED(gid_size); + + if (AE_SUCCESS != EPIDBlob::instance().get_sgx_gid((uint32_t*) gid)) { + aesm_result = AESM_UNEXPECTED_ERROR; + goto ret_point; + } + + AESM_DBG_TRACE("get gid %d from epid blob (little-endian)", + *(uint32_t*) gid); + + if(get_qe_target(target)!=AE_SUCCESS){ + AESM_DBG_ERROR("get qe target failed"); + aesm_result = AESM_UNEXPECTED_ERROR; + goto ret_point; + } + AESM_DBG_TRACE("get qe_target flags:%llx xfrm:%llx", + target->attributes.flags, target->attributes.xfrm); + //Any Quoting enclave related code must be before this section to avoid QE/PvE unloading each other + //Do the upgrade reprovision if required + AESM_DBG_TRACE("qe_isv_svn %d, epid_isv_svn %df",qe_isv_svn, epid_data.cur_psvn.isv_svn); + if((qe_isv_svn > epid_data.cur_psvn.isv_svn) + || (0!=memcmp(&qe_cpu_svn, &epid_data.cur_psvn.cpu_svn, + sizeof(sgx_cpu_svn_t)))) + { + //We will ignore all provision failure when there is a working EPID blob and leave the decision to attestation server + if(AESM_SUCCESS == (aesm_result = try_reprovision_if_not(updated, epid_data))){ + resealed = false; + }else if(AESM_PROXY_SETTING_ASSIST == aesm_result || + AESM_BUSY == aesm_result || + AESM_UPDATE_AVAILABLE == aesm_result ){//we should not ignore the three special error + goto ret_point; + } + } + //Any Quoting enclave related code must be before this section to avoid QE/PvE unloading each other */ + aesm_result = AESM_SUCCESS; +ret_point: + if(resealed && aesm_result == AESM_SUCCESS){ + AESM_DBG_TRACE("Update epid blob"); + if((ae_ret=epid_blob.write(epid_data))!=AE_SUCCESS){ + AESM_DBG_WARN("Fail to update epid blob:%d",ae_ret); + } + } + return aesm_result; +} + +/* Assuming buffer size is checked before calling this function, and get_quote + in QE will also check size. */ +aesm_error_t QEAESMLogic::get_quote(const uint8_t *report, + uint32_t quote_type, + const uint8_t *spid, + const uint8_t *nonce, + const uint8_t *sigrl, uint32_t sigrl_size, + uint8_t *qe_report, + uint8_t *quote, uint32_t buf_size) +{ + epid_blob_with_cur_psvn_t epid_data; + uint32_t ae_ret = AE_SUCCESS; + aesm_error_t aesm_result = AESM_UNEXPECTED_ERROR; + EPIDBlob& epid_blob = EPIDBlob::instance(); + + AESM_PROFILE_FUN; + memset(&epid_data, 0, sizeof(epid_data)); + + AESM_DBG_TRACE("start to read and verify epid blob"); + + if((ae_ret = epid_blob.read(epid_data))!=AE_SUCCESS){ + if((aesm_result = PvEAESMLogic::provision(false, THREAD_TIMEOUT))!=AESM_SUCCESS){ + + AESM_DBG_ERROR("pve provision failed:%d", aesm_result); + goto CLEANUP; + } + } + + if(CQEClass::instance().load_enclave()) + { + AESM_DBG_ERROR("load QE failed"); + aesm_result = AESM_UNEXPECTED_ERROR; + goto CLEANUP; + } + AESM_DBG_TRACE("start to get quote"); + ae_ret = CQEClass::instance().get_quote(epid_data.trusted_epid_blob, + SGX_TRUSTED_EPID_BLOB_SIZE, + reinterpret_cast(report), + static_cast(quote_type), + reinterpret_cast(spid), + reinterpret_cast(nonce), + sigrl, + sigrl_size, + reinterpret_cast(qe_report), + quote, + buf_size); + if(ae_ret != AE_SUCCESS) + { + AESM_DBG_TRACE("get_quote failed:%d",ae_ret); + if(ae_ret == QE_EPIDBLOB_ERROR) + aesm_result = AESM_EPIDBLOB_ERROR; + else if(ae_ret == QE_PARAMETER_ERROR) + aesm_result = AESM_PARAMETER_ERROR; + else if(ae_ret == QE_REVOKED_ERROR) + aesm_result = AESM_EPID_REVOKED_ERROR; + else + aesm_result = AESM_UNEXPECTED_ERROR; + goto CLEANUP; + } + AESM_DBG_TRACE("get quote succ"); + aesm_result = AESM_SUCCESS; +CLEANUP: + return aesm_result; +} + diff --git a/psw/ae/aesm_service/source/qe/qe_logic.h b/psw/ae/aesm_service/source/qe/qe_logic.h new file mode 100644 index 0000000000..22227bd103 --- /dev/null +++ b/psw/ae/aesm_service/source/qe/qe_logic.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _QE_LOGIC_H_ +#define _QE_LOGIC_H_ + +#include "sgx_urts.h" +#include "aesm_error.h" +#include "arch.h" +#include "aeerror.h" +#include "tlv_common.h" +#include "se_thread.h" +#include "oal/oal.h" +#include +#include + +class QEAESMLogic{ +public: + static aesm_error_t init_quote(sgx_target_info_t *target_info, + uint8_t *gid, uint32_t gid_size, uint16_t qe_isv_svn, + const sgx_cpu_svn_t qe_cpu_svn); + + static aesm_error_t get_quote(const uint8_t *report, + uint32_t quote_type, + const uint8_t *spid, + const uint8_t *nonce, + const uint8_t *sigrl, uint32_t sigrl_size, + uint8_t *qe_report, + uint8_t *quote, uint32_t buf_size); +}; +#endif + diff --git a/psw/ae/aesm_service/source/storage/persistent_storage_info.h b/psw/ae/aesm_service/source/storage/persistent_storage_info.h new file mode 100644 index 0000000000..1f9e4e5b2e --- /dev/null +++ b/psw/ae/aesm_service/source/storage/persistent_storage_info.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PERSISTENT_STORAGE_INFO_H_ +#define _PERSISTENT_STORAGE_INFO_H_ +#include "oal/aesm_persistent_storage.h" + +typedef enum _aesm_location_info_t {AESM_LOCATION_EXE_FOLDER, AESM_LOCATION_DATA} aesm_location_info_t; +typedef enum _aesm_file_access_type_t { + AESM_FILE_ACCESS_PATH_ONLY, /*We will only get pathname of the file obj via oal interface but AESM could still access the file via other APIs*/ + AESM_FILE_ACCESS_READ_ONLY, /*Only read the data*/ + AESM_FILE_ACCESS_ALL /*read and write*/ +} aesm_file_access_type_t; + +/*The table defines detail information about the persistent storages*/ +typedef struct _persistent_storage_info_t{ + aesm_data_type_t type; + aesm_location_info_t loc; + aesm_file_access_type_t access; + const char *name; +}persistent_storage_info_t; + +const persistent_storage_info_t* get_persistent_storage_info(aesm_data_id_t id); +#endif + diff --git a/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp b/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp new file mode 100644 index 0000000000..076056a8d2 --- /dev/null +++ b/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "persistent_storage_info.h" +#include "util.h" + +//The ordering of the array must be same as the enumerartion aesm_data_id_t +static const persistent_storage_info_t psinfos[]={ + {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "le"},//LE_ENCLAVE_FID + {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "qe"},//QE_ENCLAVE_FID + {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pve"},//PVE_ENCLAVE_FID + {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pse_op"},//PSE_OP_ENCLAVE_FID + {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pse_pr"},//PSE_PR_ENCLAVE_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "le_prod_css.bin"},//LE_PROD_SIG_STRUCT_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "endpoint_selection_info.blob"},//PROVISION_PEK_BLOB_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "epid_data.blob"},//EPID_DATA_BLOB_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_READ_ONLY, "aesm_server_url.blob"},//AESM_SERVER_URL_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, "pse_vmc.db"},//VMC_DATABASE_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, "backup_pse_vmc.db"},//VMC_DATABASE_BK_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, "prebuild_pse_vmc.db"},//VMC_DATABASE_PREBUILD_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "PSDA.dalp"}, //PSDA_FID, path only information? + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "aesm_network_setting.blob"},//NETWORK_SETTING_FID +#ifdef DBG_LOG + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "internal_log.txt"}, //AESM_DBG_LOG_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "internal_log_cfg.xml"}, //AESM_DBG_LOG_CFG_FID +#endif +#ifdef _PROFILE_ + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "perf_time.csv"}, //AESM_PERF_DATA_FID +#endif + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "white_list_cert.bin"},//AESM_WHITE_LIST_CERT_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "white_list_cert_to_be_verify.bin"},//AESM_WHITE_LIST_CERT_TO_BE_VERIFY_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "OcspResponseVLR.dat"}, //PSE_PR_OCSPRESP_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "LTPairing.blob"}, //PSE_PR_LT_PAIRING_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "CertificateChain.list"},//PSE_PR_CERTIFICATE_CHAIN_FID + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "Certificate.cer"},//PSE_PR_CERTIFICATE_FID, user may add some postfix after name retrieved + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "Certificate2.cer"}, + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "Certificate3.cer"}, + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "Certificate4.cer"}, + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "Certificate5.cer"}, + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "Certificate6.cer"}, + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "CertificateMax.cer"}, + {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, ""},//PSE_PR_SIGRL_FID, user may add some postfix after name retrieved +}; + +se_static_assert(sizeof(psinfos)/sizeof(persistent_storage_info_t) == NUMBER_OF_FIDS); + +const persistent_storage_info_t* get_persistent_storage_info(aesm_data_id_t id) +{ + if(id<0||id>=NUMBER_OF_FIDS) + return NULL; + return &psinfos[id]; +} + +aesm_data_id_t operator++(aesm_data_id_t& id, int) +{ + aesm_data_id_t retid = id; + switch (id) + { + case PSE_PR_CERTIFICATE_FID: + id = PSE_PR_CERTIFICATE_FID2; + break; + case PSE_PR_CERTIFICATE_FID2: + id = PSE_PR_CERTIFICATE_FID3; + break; + case PSE_PR_CERTIFICATE_FID3: + id = PSE_PR_CERTIFICATE_FID4; + break; + case PSE_PR_CERTIFICATE_FID4: + id = PSE_PR_CERTIFICATE_FID5; + break; + case PSE_PR_CERTIFICATE_FID5: + id = PSE_PR_CERTIFICATE_FID6; + break; + case PSE_PR_CERTIFICATE_FID6: + id = PSE_PR_CERTIFICATE_FID_MAX; + break; + default: + id = NUMBER_OF_FIDS; + break; + } + + return retid; +} + diff --git a/psw/ae/aesm_service/source/upse/platform_info_blob.h b/psw/ae/aesm_service/source/upse/platform_info_blob.h new file mode 100644 index 0000000000..f24a566f99 --- /dev/null +++ b/psw/ae/aesm_service/source/upse/platform_info_blob.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PLATFORM_INFO_BLOB_H_ +#define _PLATFORM_INFO_BLOB_H_ + +#include +#include "epid_pve_type.h" +#include "sgx_tcrypto.h" + + +#pragma pack(push, 1) + +#define ISVSVN_SIZE 2 +#define PSDA_SVN_SIZE 4 +#define RSA_SHA256_SIZE 256 + +typedef uint8_t tcb_psvn_t[PSVN_SIZE]; +typedef uint8_t psda_svn_t[PSDA_SVN_SIZE]; +typedef uint8_t pse_isvsvn_t[ISVSVN_SIZE]; + +/* Masks for sgx_epid_group_flags*/ +const uint8_t QE_EPID_GROUP_REVOKED = 0x01; +const uint8_t PERF_REKEY_FOR_QE_EPID_GROUP_AVAILABLE = 0x02; +const uint8_t QE_EPID_GROUP_OUT_OF_DATE = 0x04; + +/* Masks for sgx_tcb_evaluation_flags*/ +const uint16_t QUOTE_CPUSVN_OUT_OF_DATE = 0x0001; +const uint16_t QUOTE_ISVSVN_QE_OUT_OF_DATE = 0x0002; + +/* Masks for sgx_pse_evaluation_flags + PS_SEC_PROP_DESC.PSE_ISVSVN is out of date*/ +const int PSE_ISVSVN_OUT_OF_DATE = 0x0001; +/* CSME EPID 1.1 group identified by PS_SEC_PROP_DESC. PS_HW_GID has been revoked*/ +const int EPID_GROUP_ID_BY_PS_HW_GID_REVOKED = 0x0002; +/* PSDA SVN indicated in PS_SEC_PROP_DESC.PS_HW_SEC_INFO is out of date*/ +const int SVN_FROM_PS_HW_SEC_INFO_OUT_OF_DATE = 0x0004; +/* CSME EPID 1.1 SigRL version indicated in PS_SEC_PROP_DESC. PS_HW_SIG_RLver is out of date*/ +const int SIGRL_VER_FROM_PS_HW_SIG_RLVER_OUT_OF_DATE = 0x0008; +/* CSME EPID 1.1 PrivRL version indicated in PS_SEC_PROP_DESC. PS_HW_PrivKey_RLver is out of date*/ +const int PRIVRL_VER_FROM_PS_HW_PRV_KEY_RLVER_OUT_OF_DATE = 0x0010; + + + +typedef struct _platform_info_blob_wrapper_t +{ + bool valid_info_blob; + struct + { + uint8_t sgx_epid_group_flags; + uint8_t sgx_tcb_evaluation_flags[2]; + uint8_t pse_evaluation_flags[2]; + tcb_psvn_t latest_equivalent_tcb_psvn; + pse_isvsvn_t latest_pse_isvsvn; + psda_svn_t latest_psda_svn; + GroupID performance_rekey_gid; + GroupID gid; + sgx_ec256_signature_t signature; + } platform_info_blob; +} platform_info_blob_wrapper_t; + +#pragma pack(pop) + +ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper); + +#endif diff --git a/psw/ae/buildenv.mk b/psw/ae/buildenv.mk new file mode 100644 index 0000000000..fe89e61471 --- /dev/null +++ b/psw/ae/buildenv.mk @@ -0,0 +1,95 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +ENV := $(strip $(wildcard $(TOP_DIR)/buildenv.mk)) + +ifeq ($(ENV),) + $(error "Can't find $(TOP_DIR)/buildenv.mk") +endif + +include $(TOP_DIR)/buildenv.mk + +WORK_DIR := $(shell pwd) +AENAME := $(notdir $(WORK_DIR)) +SONAME := $(AENAME).so +ifdef DEBUG +CONFIG := config_debug.xml +else +CONFIG := config.xml +endif +EDLFILE := $(wildcard *.edl) + +LINUX_EPID := $(LINUX_EXTERNAL_DIR)/epid/lib/linux + +EXTERNAL_LIB_NO_CRYPTO = -lsgx_tstdc + +URTSLIB := -lsgx_urts +TRTSLIB := -lsgx_trts +EXTERNAL_LIB_NO_CRYPTO += -lsgx_tservice + +TCRYPTO_LIBDIR := $(LINUX_SDK_DIR)/tlibcrypto +EXTERNAL_LIB = $(EXTERNAL_LIB_NO_CRYPTO) -L$(TCRYPTO_LIBDIR) -lsgx_tcrypto + +INCLUDE := -I$(LINUX_PSW_DIR)/ae/inc \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(LINUX_SDK_DIR)/selib \ + -I$(LINUX_SDK_DIR)/trts + +SIGNTOOL := $(ROOT_DIR)/build/linux/sgx_sign +SGXSIGN := $(ROOT_DIR)/build/linux/sgx_sign + +KEYFILE := $(LINUX_SDK_DIR)/sign_tool/sample_sec.pem +EDGER8R := $(LINUX_SDK_DIR)/edger8r/linux/_build/Edger8r.native + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) +CFLAGS += $(ENCLAVE_CFLAGS) + +LDTFLAGS = -L$(BUILD_DIR) -Wl,--whole-archive $(TRTSLIB) -Wl,--no-whole-archive \ + -Wl,--start-group $(EXTERNAL_LIB) -Wl,--end-group \ + -Wl,--version-script=$(ROOT_DIR)/build-scripts/enclave.lds $(ENCLAVE_LDFLAGS) + +LDTFLAGS_NO_CRYPTO = -L$(BUILD_DIR) -Wl,--whole-archive $(TRTSLIB) -Wl,--no-whole-archive \ + -Wl,--start-group $(EXTERNAL_LIB_NO_CRYPTO) -Wl,--end-group \ + -Wl,--version-script=$(ROOT_DIR)/build-scripts/enclave.lds $(ENCLAVE_LDFLAGS) + +LDTFLAGS += -fuse-ld=gold -Wl,--rosegment -Wl,-Map=out.map +LDTFLAGS_NO_CRYPTO += -fuse-ld=gold -Wl,--rosegment -Wl,-Map=out.map + +DEFINES := -D__linux__ + +vpath %.cpp $(COMMON_DIR)/src:\ + $(LINUX_PSW_DIR)/ae/common + +.PHONY : version +version: + echo "#include \"se_version.h\"\nchar version[] = \"\$$SGXVer: LinuxOpenSource\" STRFILEVER \"\$$\";" > $(LINUX_PSW_DIR)/ae/common/version.cpp diff --git a/psw/ae/common/inc/AECloseSessionRequest.h b/psw/ae/common/inc/AECloseSessionRequest.h new file mode 100644 index 0000000000..3d598b21e7 --- /dev/null +++ b/psw/ae/common/inc/AECloseSessionRequest.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_CLOSE_SESSION_REQUEST_H +#define _AE_CLOSE_SESSION_REQUEST_H + +#include + +class AECloseSessionRequest : public IAERequest +{ + public: + AECloseSessionRequest(); + AECloseSessionRequest(uint32_t sessionId, uint32_t timeout); + AECloseSessionRequest(const AECloseSessionRequest& other); + ~AECloseSessionRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t sessionId, uint32_t timeout); + + //getters + int GetSessionId() const { return mSessionId; } + + //operators + bool operator==(const AECloseSessionRequest& other) const; + AECloseSessionRequest& operator=(const AECloseSessionRequest& request); + + //checks + bool check(); + void visit(IAERequestVisitor& visitor); + + //hooks + IAEResponse* execute(IAESMLogic* aesmLogic); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + + protected: + void ReleaseMemory(); + void CopyFields(uint32_t sessionId, uint32_t timeout); + + uint32_t mSessionId; +}; + +#endif diff --git a/psw/ae/common/inc/AECloseSessionResponse.h b/psw/ae/common/inc/AECloseSessionResponse.h new file mode 100644 index 0000000000..8927ec27cb --- /dev/null +++ b/psw/ae/common/inc/AECloseSessionResponse.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_CLOSE_SESSION_RESPONSE_H +#define _AE_CLOSE_SESSION_RESPONSE_H + +#include + +class AECloseSessionResponse : public IAEResponse +{ + public: + AECloseSessionResponse(); + AECloseSessionResponse(int errorCode); + AECloseSessionResponse(const AECloseSessionResponse& other); + ~AECloseSessionResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode); + + //operators + bool operator==(const AECloseSessionResponse& other) const; + AECloseSessionResponse& operator=(const AECloseSessionResponse& other); + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode); + +}; + +#endif diff --git a/psw/ae/common/inc/AECreateSessionRequest.h b/psw/ae/common/inc/AECreateSessionRequest.h new file mode 100644 index 0000000000..b900dac958 --- /dev/null +++ b/psw/ae/common/inc/AECreateSessionRequest.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_CREATE_SESSION_REQUEST_H +#define __AE_CREATE_SESSION_REQUEST_H + +#include +class AESMLogicWrapper; + +class AECreateSessionRequest : public IAERequest +{ + public: + AECreateSessionRequest(); + AECreateSessionRequest(uint32_t dhMsg1Size, uint32_t timeout = 0); + AECreateSessionRequest(const AECreateSessionRequest& other); + ~AECreateSessionRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t dhMsg1Size, uint32_t timeout = 0); + + //getters + uint32_t GetDHMsg1Size() const {return mDHMsg1Size;} + + //operators + bool operator==(const AECreateSessionRequest& other) const; + AECreateSessionRequest& operator=(const AECreateSessionRequest& other); + + //checks + bool check(); + virtual IAEResponse* execute(IAESMLogic*); + void visit(IAERequestVisitor& visitor); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + protected: + void ReleaseMemory(); + void CopyFields(uint32_t dhMsg1Size, uint32_t timeout); + + uint32_t mDHMsg1Size; +}; + +#endif diff --git a/psw/ae/common/inc/AECreateSessionResponse.h b/psw/ae/common/inc/AECreateSessionResponse.h new file mode 100644 index 0000000000..5193bd8feb --- /dev/null +++ b/psw/ae/common/inc/AECreateSessionResponse.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_CREATE_SESSION_RESPONSE_H +#define _AE_CREATE_SESSION_RESPONSE_H + +#include +#include + +class AECreateSessionResponse : public IAEResponse +{ + public: + AECreateSessionResponse(); + AECreateSessionResponse(int errorCode, uint32_t sessionId, uint32_t dhMsg1Length, const uint8_t* dhMsg1); + AECreateSessionResponse(const AECreateSessionResponse& other); + ~AECreateSessionResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode, uint32_t sessionId, uint32_t dhMsg1Length, const uint8_t* dhMsg1); + + inline int GetSessionId() const { return mSessionId; } + inline uint32_t GetDHMsg1Length() const { return mDHMsg1Length; } + inline const uint8_t* GetDHMsg1() const { return mDHMsg1; } + + //operators + bool operator==(const AECreateSessionResponse& other) const; + AECreateSessionResponse& operator=(const AECreateSessionResponse& other); + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t sessionId, uint32_t dhMsg1Length, const uint8_t* dhMsg1); + + uint32_t mSessionId; + uint32_t mDHMsg1Length; + uint8_t* mDHMsg1; +}; + +#endif diff --git a/psw/ae/common/inc/AEExchangeReportRequest.h b/psw/ae/common/inc/AEExchangeReportRequest.h new file mode 100644 index 0000000000..78be0d53b5 --- /dev/null +++ b/psw/ae/common/inc/AEExchangeReportRequest.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_EXCHANGE_REPORT_REQUEST_H +#define _AE_EXCHANGE_REPORT_REQUEST_H + +#include +#include + +class AEExchangeReportRequest : public IAERequest +{ + public: + AEExchangeReportRequest(); + AEExchangeReportRequest(uint32_t sessionId, uint32_t dhMsg2Length, const uint8_t* dhMsg2, uint32_t dhMsg3Length, uint32_t timeout=0); + AEExchangeReportRequest(const AEExchangeReportRequest& other); + ~AEExchangeReportRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t sessionId, uint32_t dhMsg2Length, const uint8_t* dhMsg2, uint32_t dhMsg3Length, uint32_t timeout=0); + + //getters + uint32_t GetSessionId() const { return mSessionId; } + uint32_t GetDHMsg2Length() const { return mDHMsg2Length; } + uint32_t GetDHMsg3Length() const { return mDHMsg3Length; } + const uint8_t* GetDHMsg2() const { return mDHMsg2; } + + //operators + bool operator==(const AEExchangeReportRequest& other) const; + AEExchangeReportRequest& operator=(const AEExchangeReportRequest& other); + + //checkers + bool check(); + IAEResponse* execute(IAESMLogic* aesmLogic); + void visit(IAERequestVisitor& visitor); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + protected: + void ReleaseMemory(); + void CopyFields(uint32_t sessionId, uint32_t dhMsg2Length, const uint8_t* dhMsg2, uint32_t dhMsg3Length, uint32_t timeout); + + uint32_t mSessionId; + uint32_t mDHMsg2Length; + uint8_t* mDHMsg2; + uint32_t mDHMsg3Length; +}; + +#endif diff --git a/psw/ae/common/inc/AEExchangeReportResponse.h b/psw/ae/common/inc/AEExchangeReportResponse.h new file mode 100644 index 0000000000..7a20d0891d --- /dev/null +++ b/psw/ae/common/inc/AEExchangeReportResponse.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_EXCHANGE_REPORT_RESPONSE_H +#define _AE_EXCHANGE_REPORT_RESPONSE_H + +#include +#include + +class AEExchangeReportResponse : public IAEResponse +{ + public: + AEExchangeReportResponse(); + AEExchangeReportResponse(int errorCode, uint32_t dhMsg3Length, const uint8_t* dhMsg3); + AEExchangeReportResponse(const AEExchangeReportResponse& other); + ~AEExchangeReportResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode, uint32_t dhMsg3Length, const uint8_t* dhMsg3); + + //getters + uint32_t GetDHMsg3Length() const { return mDHMsg3Length; } + const uint8_t* GetDHMsg3() const { return mDHMsg3; } + + //operators + bool operator==(const AEExchangeReportResponse& other) const; + AEExchangeReportResponse& operator=(const AEExchangeReportResponse& other); + + //checkers + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t dhMsg3Length, const uint8_t* dhMsg3); + + uint32_t mDHMsg3Length; + uint8_t* mDHMsg3; +}; + +#endif diff --git a/psw/ae/common/inc/AEGetLaunchTokenRequest.h b/psw/ae/common/inc/AEGetLaunchTokenRequest.h new file mode 100644 index 0000000000..fefd1d5102 --- /dev/null +++ b/psw/ae/common/inc/AEGetLaunchTokenRequest.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_LICENSE_TOKEN_H +#define __AE_GET_LICENSE_TOKEN_H + +#include +#include + +class IAESMLogic; + +class AEGetLaunchTokenRequest : public IAERequest +{ + public: + AEGetLaunchTokenRequest(); + AEGetLaunchTokenRequest(uint32_t measurementLength, const uint8_t* measurement, + uint32_t sigstructLength, const uint8_t* sigstruct, + uint32_t attributesLength, const uint8_t* attributes, uint32_t timeout = 0); + AEGetLaunchTokenRequest(const AEGetLaunchTokenRequest& other); + + ~AEGetLaunchTokenRequest(); + + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t measurementLength,const uint8_t* measurement, + uint32_t sigstructLength,const uint8_t* sigstruct, + uint32_t attributesLength,const uint8_t* attributes, + uint32_t timeout = 0); + + //inlines + uint32_t GetMeasurementLength() const { return mEnclaveMeasurementLength; } + const uint8_t* GetMeasurement() const { return mEnclaveMeasurement; } + uint32_t GetSigstructLength() const { return mSigstructLength; } + const uint8_t* GetSigstruct() const { return mSigstruct; } + uint32_t GetAttributesLength() const { return mSEAttributesLength; } + const uint8_t* GetAttributes() const { return mSEAttributes; } + + //operators + bool operator==( const AEGetLaunchTokenRequest& other) const; + AEGetLaunchTokenRequest& operator=(const AEGetLaunchTokenRequest& other); + + //checks + bool check(); + virtual IAEResponse* execute(IAESMLogic*); + + void visit(IAERequestVisitor& visitor); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + protected: + //release all members + void ReleaseMemory(); + void CopyFields(uint32_t measurementLength,const uint8_t* measurement, + uint32_t sigstructLength,const uint8_t* sigstruct, + uint32_t attributesLength,const uint8_t* attributes, + uint32_t timeout); + + uint32_t mEnclaveMeasurementLength; + uint8_t* mEnclaveMeasurement; + + uint32_t mSigstructLength; + uint8_t* mSigstruct; + + uint32_t mSEAttributesLength; + uint8_t* mSEAttributes; +}; + +#endif diff --git a/psw/ae/common/inc/AEGetLaunchTokenResponse.h b/psw/ae/common/inc/AEGetLaunchTokenResponse.h new file mode 100644 index 0000000000..b4a73f4abe --- /dev/null +++ b/psw/ae/common/inc/AEGetLaunchTokenResponse.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_GET_LICENSE_TOKEN_H +#define _AE_GET_LICENSE_TOKEN_H + +#include +#include + +class AEGetLaunchTokenResponse : public IAEResponse +{ + public: + AEGetLaunchTokenResponse(); + AEGetLaunchTokenResponse(int errorCode, uint32_t tokenLength, const uint8_t* token); + AEGetLaunchTokenResponse(const AEGetLaunchTokenResponse& other); + + ~AEGetLaunchTokenResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode, uint32_t tokenLength,const uint8_t* token); + + //inlines + int GetTokenLength() const { return mTokenLength; } + const uint8_t* GetToken() const { return mToken; } + + //operators + bool operator==(const AEGetLaunchTokenResponse& other) const; + AEGetLaunchTokenResponse& operator=(const AEGetLaunchTokenResponse& other); + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t tokenLength,const uint8_t* token); + + uint32_t mTokenLength; + uint8_t* mToken; +}; + +#endif diff --git a/psw/ae/common/inc/AEGetPsCapRequest.h b/psw/ae/common/inc/AEGetPsCapRequest.h new file mode 100644 index 0000000000..d72496e222 --- /dev/null +++ b/psw/ae/common/inc/AEGetPsCapRequest.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_PS_CAP_REQUEST_H +#define __AE_GET_PS_CAP_REQUEST_H + +#include +class IAESMLogic; + +class AEGetPsCapRequest : public IAERequest{ + public: + AEGetPsCapRequest(uint32_t timeout = 0); + AEGetPsCapRequest(const AEGetPsCapRequest& other); + ~AEGetPsCapRequest(); + + void ReleaseMemory(); + + AEMessage* serialize(ISerializer* serializer); + + //inflater -> empty for now ... but soon + void inflateValues(uint32_t timeout = 0); + + //checks + bool check() {return true;} // no special check for this object. Maybe later + virtual IAEResponse* execute(IAESMLogic*); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + bool operator==(const AEGetPsCapRequest& other) const; + AEGetPsCapRequest& operator=(const AEGetPsCapRequest& other); + void visit(IAERequestVisitor& visitor); + void CopyFields(uint32_t timeout); +}; + +#endif diff --git a/psw/ae/common/inc/AEGetPsCapResponse.h b/psw/ae/common/inc/AEGetPsCapResponse.h new file mode 100644 index 0000000000..572156e895 --- /dev/null +++ b/psw/ae/common/inc/AEGetPsCapResponse.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_PS_CAP_RESPONSE_H +#define __AE_GET_PS_CAP_RESPONSE_H + +#include +#include + +class ISerializer; + +class AEGetPsCapResponse : public IAEResponse +{ + public: + AEGetPsCapResponse(); //default ... will prepare a response that will later be inflated + + AEGetPsCapResponse(int errorCode, uint64_t ps_cap); + AEGetPsCapResponse(const AEGetPsCapResponse& other); + + ~AEGetPsCapResponse(); + + //inflater + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + + inline uint64_t GetPsCap() const { return mPsCap;} + + AEMessage* serialize(ISerializer* serializer); + + //this is used to inflate values from a serializer, instead of creating the object directly + void inflateValues(int errorCode, uint64_t ps_cap); + + //operators + virtual bool operator==(const AEGetPsCapResponse &other) const; + AEGetPsCapResponse& operator=(const AEGetPsCapResponse &other); + + void visit(IAEResponseVisitor& visitor); + + //checks + bool check(); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint64_t ps_cap); + + uint64_t mPsCap; +}; + +#endif diff --git a/psw/ae/common/inc/AEGetQuoteRequest.h b/psw/ae/common/inc/AEGetQuoteRequest.h new file mode 100644 index 0000000000..0a0d5925d3 --- /dev/null +++ b/psw/ae/common/inc/AEGetQuoteRequest.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_QUOTE_H +#define __AE_GET_QUOTE_H + +#include +#include +class IAESMLogic; + +class AEGetQuoteRequest : public IAERequest +{ + public: + AEGetQuoteRequest(); + AEGetQuoteRequest(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, + bool qe_report, + uint32_t timeout = 0); + AEGetQuoteRequest(const AEGetQuoteRequest& other); + + ~AEGetQuoteRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, + bool qe_report, + uint32_t timeout = 0); + + inline const uint8_t* GetReport() const { return mReport; } + inline uint32_t GetReportLength() const { return mReportLength; } + inline uint32_t GetQuoteType() const { return mQuoteType; } + inline uint32_t GetSPIDLength() const { return mSPIDLength; } + inline const uint8_t* GetSPID() const { return mSPID; } + inline uint32_t GetNonceLength() const { return mNonceLength; } + inline const uint8_t* GetNonce() const { return mNonce; } + inline const uint8_t* GetSigRL() const { return mSigRL; } + inline uint32_t GetSigRLLength() const { return mSigRLLength; } + inline uint32_t GetBufferSize() const { return mBufferSize; } + inline bool GetQEReport() const { return mQEReport; } + + //operators + virtual bool operator==(const AEGetQuoteRequest& other) const; + AEGetQuoteRequest& operator=(const AEGetQuoteRequest& other); + + //checks + bool check(); + virtual IAEResponse* execute(IAESMLogic*); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + + void visit(IAERequestVisitor& visitor); + + protected: + + void ReleaseMemory(); + void CopyFields(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, + bool qe_report, + uint32_t timeout); + + uint32_t mReportLength; + uint8_t* mReport; + + uint32_t mQuoteType; + + uint32_t mSPIDLength; + uint8_t* mSPID; + + uint32_t mNonceLength; + uint8_t* mNonce; + + uint32_t mSigRLLength; + uint8_t* mSigRL; + + uint32_t mBufferSize; + bool mQEReport; + +}; + + +#endif diff --git a/psw/ae/common/inc/AEGetQuoteResponse.h b/psw/ae/common/inc/AEGetQuoteResponse.h new file mode 100644 index 0000000000..48b9411630 --- /dev/null +++ b/psw/ae/common/inc/AEGetQuoteResponse.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_QUOTE_RESPONSE_H +#define __AE_GET_QUOTE_RESPONSE_H + +#include +#include + +class AEGetQuoteResponse : public IAEResponse +{ + public: + AEGetQuoteResponse(); + AEGetQuoteResponse(int errorCode, uint32_t quoteLength, const uint8_t* quote, + uint32_t qeReportLength, const uint8_t* qeReport); + AEGetQuoteResponse(const AEGetQuoteResponse& other); + + ~AEGetQuoteResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* response); + void inflateValues(int errorCode, uint32_t quoteLength,const uint8_t* quote, + uint32_t qeReportLength, const uint8_t* qeReport); + + + //operators + bool operator==(const AEGetQuoteResponse& other) const; + AEGetQuoteResponse& operator=(const AEGetQuoteResponse& other); + + //getters + inline uint32_t GetQuoteLength() { return mQuoteLength; } + inline const uint8_t* GetQuote() { return mQuote; } + inline uint32_t GetQEReportLength() { return mQEReportLength; } + inline const uint8_t* GetQEReport() { return mQEReport; } + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t quoteLength,const uint8_t* quote, + uint32_t qeReportLength, const uint8_t* qeReport); + + uint32_t mQuoteLength; + uint8_t* mQuote; + uint32_t mQEReportLength; + uint8_t* mQEReport; +}; + +#endif diff --git a/psw/ae/common/inc/AEInitQuoteRequest.h b/psw/ae/common/inc/AEInitQuoteRequest.h new file mode 100644 index 0000000000..f8a4d546d1 --- /dev/null +++ b/psw/ae/common/inc/AEInitQuoteRequest.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_INIT_QUOTE_REQUEST_H +#define __AE_INIT_QUOTE_REQUEST_H + +#include +class IAESMLogic; + +class AEInitQuoteRequest : public IAERequest{ + public: + AEInitQuoteRequest(uint32_t timeout = 0); + AEInitQuoteRequest(const AEInitQuoteRequest& other); + ~AEInitQuoteRequest(); + + void CopyFields(uint32_t timeout); + void ReleaseMemory(); + + AEMessage* serialize(ISerializer* serializer); + + //inflater -> empty for now ... but soon + void inflateValues(uint32_t timeout = 0); + + //checks + bool check() {return true;} // no special check for this object. Maybe later + virtual IAEResponse* execute(IAESMLogic*); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + + bool operator==(const AEInitQuoteRequest& other) const; + AEInitQuoteRequest& operator=(const AEInitQuoteRequest& other); + + void visit(IAERequestVisitor& visitor); +}; + + + +#endif diff --git a/psw/ae/common/inc/AEInitQuoteResponse.h b/psw/ae/common/inc/AEInitQuoteResponse.h new file mode 100644 index 0000000000..7ddb111d4e --- /dev/null +++ b/psw/ae/common/inc/AEInitQuoteResponse.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_INIT_QUOTE_RESPONSE_H +#define __AE_INIT_QUOTE_RESPONSE_H + +#include +#include + +class ISerializer; + +class AEInitQuoteResponse : public IAEResponse +{ + public: + AEInitQuoteResponse(); //default ... will prepare a response that will later be inflated + + AEInitQuoteResponse(int errorCode, uint32_t gidLength, const uint8_t* gid, + uint32_t targetInfoLength, const uint8_t* targetInfo); + AEInitQuoteResponse(const AEInitQuoteResponse& other); + + ~AEInitQuoteResponse(); + + //inflater + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + + inline const uint8_t* GetGID() const { return mGID;} + inline uint32_t GetGIDLength() const { return mGIDLength; } + inline const uint8_t* GetTargetInfo() const { return mTargetInfo;} + inline uint32_t GetTargetInfoLength() const { return mTargetInfoLength; } + + AEMessage* serialize(ISerializer* serializer); + + //this is used to inflate values from a serializer, instead of creating the object directly + void inflateValues(int errorCode, uint32_t gidLength, const uint8_t* gid, + uint32_t targetInfoLength, const uint8_t* targetInfo); + + + //operators + virtual bool operator==(const AEInitQuoteResponse &other) const; + AEInitQuoteResponse& operator=(const AEInitQuoteResponse &other); + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t gidLength,const uint8_t* gid, + uint32_t targetInfoLength,const uint8_t* targetInfo); + + uint32_t mGIDLength; + uint32_t mTargetInfoLength; + + uint8_t* mTargetInfo; + uint8_t* mGID; +}; + +#endif diff --git a/psw/ae/common/inc/AEInvokeServiceRequest.h b/psw/ae/common/inc/AEInvokeServiceRequest.h new file mode 100644 index 0000000000..53755ae397 --- /dev/null +++ b/psw/ae/common/inc/AEInvokeServiceRequest.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_INVOKE_SERVICE_REQUEST_H +#define _AE_INVOKE_SERVICE_REQUEST_H + +#include +#include + +class AEInvokeServiceRequest : public IAERequest +{ + public: + AEInvokeServiceRequest(); + AEInvokeServiceRequest(uint32_t pseMessageLength, const uint8_t* pseMessage, uint32_t pseResponseSize, uint32_t timeout = 0); + AEInvokeServiceRequest(const AEInvokeServiceRequest& other); + ~AEInvokeServiceRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t pseMessageLength, const uint8_t* pseMessage, uint32_t pseResponseSize, uint32_t timeout = 0); + + //getters + inline uint32_t GetPSEMessageLength() const { return mPSEMessageLength; } + inline const uint8_t* GetPSEMessage() const { return mPSEMessage; } + inline uint32_t GetResponseSize() const { return mResponseSize; } + + //operators + bool operator==(const AEInvokeServiceRequest& other) const; + AEInvokeServiceRequest& operator=(const AEInvokeServiceRequest& other); + + //checks + bool check(); + virtual IAEResponse* execute(IAESMLogic*); + void visit(IAERequestVisitor& visitor); + + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + protected: + void ReleaseMemory(); + void CopyFields(uint32_t pseMessageLength, const uint8_t* pseMessage, uint32_t pseResponseSize, uint32_t timeout); + + uint32_t mPSEMessageLength; + uint8_t* mPSEMessage; + uint32_t mResponseSize; +}; + +#endif diff --git a/psw/ae/common/inc/AEInvokeServiceResponse.h b/psw/ae/common/inc/AEInvokeServiceResponse.h new file mode 100644 index 0000000000..412ccadd46 --- /dev/null +++ b/psw/ae/common/inc/AEInvokeServiceResponse.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_INVOKE_SERVICE_RESPONSE_H +#define _AE_INVOKE_SERVICE_RESPONSE_H + +#include +#include + +class AEInvokeServiceResponse : public IAEResponse +{ + public: + AEInvokeServiceResponse(); + AEInvokeServiceResponse(int errorCode, uint32_t pseMessageLength, const uint8_t* pseMessage); + AEInvokeServiceResponse(const AEInvokeServiceResponse& other); + ~AEInvokeServiceResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode, uint32_t pseMessageLength,const uint8_t* pseMessage); + + //getters + inline uint32_t GetPSEMessageLength() const { return mPSEMessageLength; } + inline const uint8_t* GetPSEMessage() const { return mPSEMessage; } + + //operators + bool operator==(const AEInvokeServiceResponse& other) const; + AEInvokeServiceResponse& operator=(const AEInvokeServiceResponse& other); + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t pseMessageLength,const uint8_t* pseMessage); + + uint32_t mPSEMessageLength; + uint8_t* mPSEMessage; +}; +#endif diff --git a/psw/ae/common/inc/AEReportAttestationRequest.h b/psw/ae/common/inc/AEReportAttestationRequest.h new file mode 100644 index 0000000000..cd669b8aa2 --- /dev/null +++ b/psw/ae/common/inc/AEReportAttestationRequest.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_REPORT_ATTESTATION_REQUEST_H +#define _AE_REPORT_ATTESTATION_REQUEST_H + +#include + +class AEReportAttestationRequest : public IAERequest +{ + public: + AEReportAttestationRequest(); + AEReportAttestationRequest(uint32_t platformInfoLength, const uint8_t* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout = 0); + AEReportAttestationRequest(const AEReportAttestationRequest& other); + ~AEReportAttestationRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t platformInfoLength, const uint8_t* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout = 0); + + //getters + inline uint32_t GetAttestationErrorCode() const { return mAttestationErrorCode; } + inline uint32_t GetPlatformInfoLength() const { return mPlatformInfoLength;} + inline const uint8_t* GetPlatformInfo() const { return mPlatformInfo;} + inline uint32_t GetUpdateInfoLength() const { return mUpdateInfoLength;} + + //operators + bool operator==(const AEReportAttestationRequest& other) const; + AEReportAttestationRequest& operator=(const AEReportAttestationRequest& request); + + //checks + bool check(); + + //hooks + IAEResponse* execute(IAESMLogic* aesmLogic); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + void visit(IAERequestVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(uint32_t platformInfoLength, const uint8_t* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout); + + uint32_t mAttestationErrorCode; + + uint32_t mPlatformInfoLength; + uint8_t* mPlatformInfo; + uint32_t mUpdateInfoLength; +}; + +#endif diff --git a/psw/ae/common/inc/AEReportAttestationResponse.h b/psw/ae/common/inc/AEReportAttestationResponse.h new file mode 100644 index 0000000000..a736a5d818 --- /dev/null +++ b/psw/ae/common/inc/AEReportAttestationResponse.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_REPORT_ATTESTATION_ERROR_RESPONSE_H +#define _AE_REPORT_ATTESTATION_ERROR_RESPONSE_H + +#include + +class AEReportAttestationResponse : public IAEResponse +{ + public: + AEReportAttestationResponse(); + AEReportAttestationResponse(int errorCode, uint32_t UpdateInfoLength, const uint8_t* UpdateInfo); + AEReportAttestationResponse(const AEReportAttestationResponse& other); + ~AEReportAttestationResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode, uint32_t updateInfoLength,const uint8_t* updateInfo); + + + //inlines + int GetUpdateInfoLength() const { return mUpdateInfoLength; } + const uint8_t* GetUpdateInfo() const { return mUpdateInfo; } + + //operators + bool operator==(const AEReportAttestationResponse& other) const; + AEReportAttestationResponse& operator=(const AEReportAttestationResponse& other); + + //checks + bool check(); + void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t updateInfoLength, const uint8_t* updateInfo); + + uint32_t mUpdateInfoLength; + uint8_t* mUpdateInfo; +}; + +#endif diff --git a/psw/ae/common/inc/Config.h b/psw/ae/common/inc/Config.h new file mode 100644 index 0000000000..801fd8101f --- /dev/null +++ b/psw/ae/common/inc/Config.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _PSW_COMMON_INC_CONFIG_H +#define _PSW_COMMON_INC_CONFIG_H + + +#ifndef CONFIG_SOCKET_PATH + #define CONFIG_SOCKET_PATH "sgx_aesm_socket_base" +#endif /* CONFIG_SOCKET_PATH */ + + +#define MAX_MEMORY_ALLOCATION 1<<25 //32 MB +#define IPC_LATENCY 10000 +#define AESM_IPC_LATENCY 1000 //1 second (AESM must be fair; also, clients should finsih writing and reading with speed) + //This timeout could be reduced even more +#endif + diff --git a/psw/ae/common/inc/IAERequest.h b/psw/ae/common/inc/IAERequest.h new file mode 100644 index 0000000000..9254c0b3d4 --- /dev/null +++ b/psw/ae/common/inc/IAERequest.h @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_REQUEST_H__ +#define __AE_REQUEST_H__ + +#include +#include +#include +#include +#include + +struct AEMessage{ + uint32_t size; + char* data; + +#ifdef __cplusplus + AEMessage(): size(0), data(NULL) {} + ~AEMessage(){ + if (data != NULL) delete [] data; + data = NULL; + } + + bool operator==(const AEMessage &other) const + { + if (this == &other) return true; + if (this == NULL) return false; + + if (size != other.size) return false; + if (memcmp(data, other.data, size) != 0) return false; + return true; + } + + void copyFields(const AEMessage& other) + { + size = other.size; + + if (other.data == NULL) + data = NULL; + else + { + data = new char[size]; + + memcpy(data, other.data, size); + } + } + + AEMessage& operator=(const AEMessage& other) + { + if (this == &other) + return *this; + + if (data != NULL) + delete [] data; + + copyFields(other); + + return *this; + } + + AEMessage(const AEMessage& other) + { + copyFields(other); + } +#endif +}; + +class ISerializer; +class IAEResponse; +class IAESMLogic; + +class AECloseSessionRequest; +class AEExchangeReportRequest; +class AEInvokeServiceRequest; +class AECreateSessionRequest; +class AEReportAttestationRequest; +class AEGetLaunchTokenRequest; +class AEGetQuoteRequest; +class AEInitQuoteRequest; +class AEGetPsCapRequest; + +class IAERequestVisitor +{ + public: + virtual void visitInitQuoteRequest(AEInitQuoteRequest&) = 0; + virtual void visitGetQuoteRequest(AEGetQuoteRequest&) = 0; + virtual void visitGetLaunchTokenRequest(AEGetLaunchTokenRequest&) = 0; + virtual void visitReportAttestationRequest(AEReportAttestationRequest&) = 0; + virtual void visitCreateSessionRequest(AECreateSessionRequest&) = 0; + virtual void visitInvokeServiceRequest(AEInvokeServiceRequest&) = 0; + virtual void visitExchangeReportRequest(AEExchangeReportRequest&) = 0; + virtual void visitCloseSessionRequest(AECloseSessionRequest&) = 0; + virtual void visitGetPsCapRequest(AEGetPsCapRequest&) = 0; + + virtual ~IAERequestVisitor() = 0; +}; + +class IAERequest{ + public: + typedef enum {QUOTING_CLASS, LAUNCH_CLASS, PLATFORM_CLASS} RequestClass; + + IAERequest(uint32_t timeout = IPC_LATENCY) : mTimeout(timeout), mValidSizeCheck(false) {} //constructor with default parameter + virtual ~IAERequest() {} + + virtual void visit(IAERequestVisitor&) = 0; + virtual AEMessage* serialize(ISerializer* serializer) =0; + + virtual RequestClass getRequestClass() = 0; + + //this method is added especially for future compatibility (may be used to check thigs like the message MAC) + virtual bool check() {return false;} //although only some requests will need more complex logic here, this will default to + //invalid. Validity needs to be explicitly declared in children :) + virtual IAEResponse* execute(IAESMLogic* aesmLogic) =0; + + //timeout + uint32_t GetTimeout() const { return mTimeout; } + protected: + uint32_t mTimeout; + bool mValidSizeCheck; +}; + +#endif diff --git a/psw/ae/common/inc/IAEResponse.h b/psw/ae/common/inc/IAEResponse.h new file mode 100644 index 0000000000..0fb9719b99 --- /dev/null +++ b/psw/ae/common/inc/IAEResponse.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_RESPONSE_H +#define __AE_RESPONSE_H + +#include +#include +#include +#include + + +struct AEMessage; +class ISerializer; + +class AECloseSessionResponse; +class AEExchangeReportResponse; +class AEInvokeServiceResponse; +class AECreateSessionResponse; +class AEReportAttestationResponse; +class AEGetLaunchTokenResponse; +class AEGetQuoteResponse; +class AEInitQuoteResponse; +class AEGetPsCapResponse; + +#include + +class IAEResponseVisitor +{ + public: + virtual void visitInitQuoteResponse(AEInitQuoteResponse&) = 0; + virtual void visitGetQuoteResponse(AEGetQuoteResponse&) = 0; + virtual void visitGetLaunchTokenResponse(AEGetLaunchTokenResponse&) = 0; + virtual void visitReportAttestationResponse(AEReportAttestationResponse&) = 0; + virtual void visitCreateSessionResponse(AECreateSessionResponse&) = 0; + virtual void visitInvokeServiceResponse(AEInvokeServiceResponse&) = 0; + virtual void visitExchangeReportResponse(AEExchangeReportResponse&) = 0; + virtual void visitCloseSessionResponse(AECloseSessionResponse&) = 0; + virtual void visitGetPsCapResponse(AEGetPsCapResponse&) = 0; + + virtual ~IAEResponseVisitor() {}; +}; + +class IAEResponse{ + public: + IAEResponse() : mErrorCode(SGX_ERROR_UNEXPECTED),mValidSizeCheck(false) {} + inline virtual ~IAEResponse() {} + virtual AEMessage* serialize(ISerializer* serializer) =0; + virtual bool inflateWithMessage(AEMessage* message, ISerializer* serializer) =0; + + //operators + virtual bool operator==(const IAEResponse& other) const {return this == &other;} + + //this method is added especially for future compatibility (may be used to check thigs like the message MAC) + virtual bool check() {return false;} //although only some responses will need more complex logic here, this will default to + //invalid. Validity needs to be explicitly declared in children :) + + inline int GetErrorCode() const { return mErrorCode; } + inline void SetErrorCode(uint32_t error) { mErrorCode = error; } + + virtual void visit(IAEResponseVisitor& visitor) = 0; + + protected: + uint32_t mErrorCode; + bool mValidSizeCheck; + +}; + +#endif diff --git a/psw/ae/common/inc/IAESMLogic.h b/psw/ae/common/inc/IAESMLogic.h new file mode 100644 index 0000000000..95d685b9ab --- /dev/null +++ b/psw/ae/common/inc/IAESMLogic.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _I_AESM_LOGIC_H +#define _I_AESM_LOGIC_H + +#include +#include +#include + +class IAESMLogic { + public: + virtual aesm_error_t initQuote(uint8_t *target_info, + uint32_t target_info_length, + uint8_t *gid, + uint32_t gid_length) = 0; + + virtual aesm_error_t getQuote(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, uint8_t* quote, + uint32_t qe_reportSize, uint8_t* qe_report) = 0; + + virtual aesm_error_t createSession(uint32_t *session_id, + uint8_t *se_dh_msg1, + uint32_t se_dh_msg1_size) = 0; + + virtual aesm_error_t closeSession(uint32_t sessionId) = 0; + + virtual aesm_error_t exchangeReport(uint32_t session_id, + const uint8_t* se_dh_msg2, + uint32_t se_dh_msg2_size, + uint8_t* se_dh_msg3, + uint32_t se_dh_msg3_size) = 0; + + virtual aesm_error_t getLaunchToken(const uint8_t* measurement, uint32_t measurement_size, + const uint8_t *public_key, uint32_t public_key_size, + const uint8_t* se_attributes, uint32_t se_attributes_size, + uint8_t** launch_token, uint32_t* launch_tocken_size) = 0; + + virtual aesm_error_t invokeService(const uint8_t *pse_message_req, + uint32_t pse_message_req_size, + uint8_t *pse_message_resp, + uint32_t pse_message_resp_size) = 0; + + virtual aesm_error_t getPsCap(uint64_t* ps_cap) = 0; + + virtual aesm_error_t reportAttestationStatus(uint8_t* platform_info, uint32_t platform_info_size, + uint32_t attestation_error_code, + uint8_t* update_info, uint32_t update_info_size) = 0; + virtual void service_stop() = 0; + virtual ~IAESMLogic(){}; +}; + +#endif diff --git a/psw/ae/common/inc/ICommunicationSocket.h b/psw/ae/common/inc/ICommunicationSocket.h new file mode 100644 index 0000000000..c1639d6752 --- /dev/null +++ b/psw/ae/common/inc/ICommunicationSocket.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GATEWAY_H +#define __AE_GATEWAY_H + +#include +#include +#include + +class SockDisconnectedException : public std::exception { +}; + +class ICommunicationSocket{ + public: + virtual ~ICommunicationSocket() {} + + //init returns true on successful connection + virtual bool init() =0; + virtual char* readRaw(ssize_t length) = 0; //throw(SockDisconnectedException) = 0; + virtual ssize_t writeRaw(const char* data, ssize_t length) = 0; + virtual int getSockDescriptor() = 0; + virtual bool wasTimeoutDetected() = 0; + virtual bool setTimeout(uint32_t milliseconds) = 0; + protected: + int mSocket; +}; + +#endif + diff --git a/psw/ae/common/inc/ISerializer.h b/psw/ae/common/inc/ISerializer.h new file mode 100644 index 0000000000..6da6d931ec --- /dev/null +++ b/psw/ae/common/inc/ISerializer.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_SERIALIZER_H_ +#define __AE_SERIALIZER_H_ + +struct AEMessage; + +class AEInitQuoteRequest; +class AEInitQuoteResponse; + +class AEGetQuoteRequest; +class AEGetQuoteResponse; + +class AEGetLaunchTokenRequest; +class AEGetLaunchTokenResponse; + +class AECreateSessionRequest; +class AECreateSessionResponse; + +class AEInvokeServiceRequest; +class AEInvokeServiceResponse; + +class AEExchangeReportRequest; +class AEExchangeReportResponse; + +class AECloseSessionRequest; +class AECloseSessionResponse; + +class AEGetPsCapRequest; +class AEGetPsCapResponse; + +class AEReportAttestationRequest; +class AEReportAttestationResponse; + + +class IAERequest; +class IAEResponse; + +class ISerializer{ + public: + //request serializers + virtual AEMessage* serialize(AEInitQuoteRequest* request) = 0; + virtual AEMessage* serialize(AEGetQuoteRequest* request) = 0; + virtual AEMessage* serialize(AEGetLaunchTokenRequest* request) = 0; + virtual AEMessage* serialize(AECreateSessionRequest* request) = 0; + virtual AEMessage* serialize(AEInvokeServiceRequest* request) = 0; + virtual AEMessage* serialize(AEExchangeReportRequest* request) = 0; + virtual AEMessage* serialize(AECloseSessionRequest* request) = 0; + virtual AEMessage* serialize(AEGetPsCapRequest* request) = 0; + virtual AEMessage* serialize(AEReportAttestationRequest* request) = 0; + + //response serializers + virtual AEMessage* serialize(AEInitQuoteResponse* response) = 0; + virtual AEMessage* serialize(AEGetQuoteResponse* response) = 0; + virtual AEMessage* serialize(AEGetLaunchTokenResponse* response) = 0; + virtual AEMessage* serialize(AECreateSessionResponse* response) = 0; + virtual AEMessage* serialize(AEInvokeServiceResponse* response) = 0; + virtual AEMessage* serialize(AEExchangeReportResponse* response) = 0; + virtual AEMessage* serialize(AECloseSessionResponse* response) = 0; + virtual AEMessage* serialize(AEGetPsCapResponse* response) = 0; + virtual AEMessage* serialize(AEReportAttestationResponse* response) = 0; + + //request inflater -> will inflate request objects by unmarshaling communication level data (this will be used by server) + virtual IAERequest* inflateRequest(AEMessage* message) = 0; + + //response inflater -> will inflate response objects with data by unmarshaling communication level data + virtual bool inflateResponse(AEMessage* message, AEInitQuoteResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEGetQuoteResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEGetLaunchTokenResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AECreateSessionResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEInvokeServiceResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEExchangeReportResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AECloseSessionResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEGetPsCapResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEReportAttestationResponse* response) = 0; + + + virtual ~ISerializer() {} +}; + +#endif diff --git a/psw/ae/common/inc/ISocketFactory.h b/psw/ae/common/inc/ISocketFactory.h new file mode 100644 index 0000000000..e4ddff35b9 --- /dev/null +++ b/psw/ae/common/inc/ISocketFactory.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_SOCKET_FACTORY_H +#define __AE_SOCKET_FACTORY_H + +#include + +class ISocketFactory +{ +public: + virtual ~ISocketFactory() {} + + virtual ICommunicationSocket* NewCommunicationSocket() = 0; +}; + +#endif diff --git a/psw/ae/common/inc/ITransporter.h b/psw/ae/common/inc/ITransporter.h new file mode 100644 index 0000000000..cb7e8e4c1e --- /dev/null +++ b/psw/ae/common/inc/ITransporter.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_TRANSPORTER_H +#define __AE_TRANSPORTER_H + +class IAERequest; +class IAEResponse; +class ICommunicationSocket; + +#include + +class ITransporter{ + public: + virtual ~ITransporter() {}; + + virtual uae_oal_status_t transact(IAERequest* request, IAEResponse* response) = 0; + virtual IAERequest* receiveRequest(ICommunicationSocket* sock) = 0; //throw(SockDisconnectedException) = 0; + virtual uae_oal_status_t sendResponse(IAEResponse* response, ICommunicationSocket* sock) = 0; + + protected: +}; + +#endif diff --git a/psw/ae/common/inc/NonBlockingUnixCommunicationSocket.h b/psw/ae/common/inc/NonBlockingUnixCommunicationSocket.h new file mode 100644 index 0000000000..3abc1e9883 --- /dev/null +++ b/psw/ae/common/inc/NonBlockingUnixCommunicationSocket.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_NON_BLOCKING_COMM_SOCKET_H +#define __AE_NON_BLOCKING_COMM_SOCKET_H + +#include + +#define MAX_EVENTS 12 + +class NonBlockingUnixCommunicationSocket : public UnixCommunicationSocket +{ +public: + NonBlockingUnixCommunicationSocket(const char* socketbase) : UnixCommunicationSocket(socketbase), mEvents(NULL), mEpoll(-1) {} + NonBlockingUnixCommunicationSocket(int socket) : UnixCommunicationSocket(socket), mEvents(NULL), mEpoll(-1) {} + + ~NonBlockingUnixCommunicationSocket(); + + bool init(); + char* readRaw(ssize_t length); //throw(SockDisconnectedException) = 0; + ssize_t writeRaw(const char* data, ssize_t length); + int getSockDescriptor(); + bool wasTimeoutDetected(); + bool setTimeout(uint32_t milliseconds); + + void Cancel() const; + +protected: + bool MakeNonBlocking(); + ssize_t partialRead(char* buffer, ssize_t maxLength); + + //members + struct epoll_event *mEvents; //epoll for events on two sources: 0->special command pipe. 1->the socket + int mEpoll; + int mCommandPipe[2]; +private: + //non-copyable + NonBlockingUnixCommunicationSocket(const NonBlockingUnixCommunicationSocket&); + NonBlockingUnixCommunicationSocket& operator=(const NonBlockingUnixCommunicationSocket&); +}; + +#endif diff --git a/psw/ae/common/inc/NonBlockingUnixSocketFactory.h b/psw/ae/common/inc/NonBlockingUnixSocketFactory.h new file mode 100644 index 0000000000..befaefd082 --- /dev/null +++ b/psw/ae/common/inc/NonBlockingUnixSocketFactory.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_NON_BLOCKING_UNIX_SOCKET_FACTORY_H +#define __AE_NON_BLOCKING_UNIX_SOCKET_FACTORY_H + +#include + +class NonBlockingUnixSocketFactory : public UnixSocketFactory +{ +public: + NonBlockingUnixSocketFactory(const char* socketbase) : UnixSocketFactory(socketbase) {} + ~NonBlockingUnixSocketFactory() {} + + ICommunicationSocket* NewCommunicationSocket(); +}; + +#endif diff --git a/psw/ae/common/inc/ProtobufSerializer.h b/psw/ae/common/inc/ProtobufSerializer.h new file mode 100644 index 0000000000..b2e694334b --- /dev/null +++ b/psw/ae/common/inc/ProtobufSerializer.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_PROTOBUF_SERIALIZER +#define __AE_PROTOBUF_SERIALIZER + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wconversion" +#include +#pragma GCC diagnostic pop + +class IAERequest; +class IAEResponse; + + +class ProtobufSerializer : public ISerializer{ + public: + ~ProtobufSerializer() {} + + //request serializers + AEMessage* serialize(AEInitQuoteRequest* request); + AEMessage* serialize(AEGetQuoteRequest* request); + AEMessage* serialize(AEGetLaunchTokenRequest* request); + AEMessage* serialize(AECreateSessionRequest* request); + AEMessage* serialize(AEInvokeServiceRequest* request); + AEMessage* serialize(AEExchangeReportRequest* request); + AEMessage* serialize(AECloseSessionRequest* request); + AEMessage* serialize(AEGetPsCapRequest* request); + AEMessage* serialize(AEReportAttestationRequest* request); + + //response serializers + AEMessage* serialize(AEInitQuoteResponse* response); + AEMessage* serialize(AEGetQuoteResponse* response); + AEMessage* serialize(AEGetLaunchTokenResponse* response); + AEMessage* serialize(AECreateSessionResponse* response); + AEMessage* serialize(AEInvokeServiceResponse* response); + AEMessage* serialize(AEExchangeReportResponse* response); + AEMessage* serialize(AECloseSessionResponse* response); + AEMessage* serialize(AEGetPsCapResponse* response); + AEMessage* serialize(AEReportAttestationResponse* response); + + //base inflate request + IAERequest* inflateRequest(AEMessage* message); + + //response inflaters + bool inflateResponse(AEMessage* message, AEInitQuoteResponse* response); + bool inflateResponse(AEMessage* message, AEGetQuoteResponse* response); + bool inflateResponse(AEMessage* message, AEGetLaunchTokenResponse* response); + bool inflateResponse(AEMessage* message, AECreateSessionResponse* response); + bool inflateResponse(AEMessage* message, AEInvokeServiceResponse* response); + bool inflateResponse(AEMessage* message, AEExchangeReportResponse* response); + bool inflateResponse(AEMessage* message, AECloseSessionResponse* response); + bool inflateResponse(AEMessage* message, AEGetPsCapResponse* response); + bool inflateResponse(AEMessage* message, AEReportAttestationResponse* response); + + private: + //request inflaters + IAERequest* inflateInitQuoteRequest(aesm::message::Request* reqMsg); + IAERequest* inflateGetQuoteRequest(aesm::message::Request* reqMsg); + IAERequest* inflateCloseSessionRequest(aesm::message::Request* reqMsg); + IAERequest* inflateCreateSessionRequest(aesm::message::Request* reqMsg); + IAERequest* inflateExchangeReportRequest(aesm::message::Request* reqMsg); + IAERequest* inflateGetLaunchTokenRequest(aesm::message::Request* reqMsg); + IAERequest* inflateInvokeServiceRequest(aesm::message::Request* reqMsg); + IAERequest* inflateGetPsCapRequest(aesm::message::Request* reqMsg); + IAERequest* inflateReportAttestationErrorRequest(aesm::message::Request* reqMsg); +}; + +#endif diff --git a/psw/ae/common/inc/SocketTransporter.h b/psw/ae/common/inc/SocketTransporter.h new file mode 100644 index 0000000000..453b97fdb3 --- /dev/null +++ b/psw/ae/common/inc/SocketTransporter.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_UNIX_SOCKET_TRANSPORTER_H +#define __AE_UNIX_SOCKET_TRANSPORTER_H + +#include +#include +#include +#include + +#include + +class ISerializer; +class ICommunicationSocket; + +class SocketTransporter : public ITransporter{ + public: + SocketTransporter(ISocketFactory* socketFactory, ISerializer* serializer); + ~SocketTransporter(); + + uae_oal_status_t transact(IAERequest* request, IAEResponse* response); + + IAERequest* receiveRequest(ICommunicationSocket* sock);// throw(SockDisconnectedException); + uae_oal_status_t sendResponse(IAEResponse* response, ICommunicationSocket* sock); + + protected: + ISocketFactory* mSocketFactory; + ISerializer* mSerializer; + + private: + uae_oal_status_t sendMessage(AEMessage *message, ICommunicationSocket* sock); + AEMessage* receiveMessage(ICommunicationSocket* sock);// throw(SockDisconnectedException); + SocketTransporter& operator=(const SocketTransporter&); + SocketTransporter(const SocketTransporter&); +}; + +#endif diff --git a/psw/ae/common/inc/UnixCommunicationSocket.h b/psw/ae/common/inc/UnixCommunicationSocket.h new file mode 100644 index 0000000000..1c5cbebaea --- /dev/null +++ b/psw/ae/common/inc/UnixCommunicationSocket.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_UNIX_SOCKET_GATEWAY_H +#define __AE_UNIX_SOCKET_GATEWAY_H + +#include +#include + +class UnixCommunicationSocket : public ICommunicationSocket{ + public: + UnixCommunicationSocket(const char* socketbase); + UnixCommunicationSocket(int socket); + + ~UnixCommunicationSocket(); + + virtual bool init(); + virtual ssize_t writeRaw(const char* data, ssize_t length); + virtual char* readRaw(ssize_t length);// throw(SockDisconnectedException); + + void disconnect(); + virtual int getSockDescriptor(); + + //timeout + virtual bool setTimeout(uint32_t timeout_milliseconds); + virtual bool wasTimeoutDetected() { return mWasTimeout; } + protected: + char* mSocketBase; + bool mWasTimeout; + + void MarkStartTime(); + bool CheckForTimeout(); + + struct timeval mStartTime; + uint32_t mTimeoutMseconds; + + private: + //non-copyable + UnixCommunicationSocket(const UnixCommunicationSocket&); + UnixCommunicationSocket& operator=(const UnixCommunicationSocket&); +}; + +#endif diff --git a/psw/ae/common/inc/UnixSocketFactory.h b/psw/ae/common/inc/UnixSocketFactory.h new file mode 100644 index 0000000000..dd4b06e3f3 --- /dev/null +++ b/psw/ae/common/inc/UnixSocketFactory.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_UNIX_SOCKET_FACTORY_H +#define __AE_UNIX_SOCKET_FACTORY_H + +#include + +class UnixSocketFactory : public ISocketFactory +{ +public: + UnixSocketFactory(const char* socketbase); + ~UnixSocketFactory(); + + ICommunicationSocket* NewCommunicationSocket(); + +protected: + char* mSocketBase; +private: + UnixSocketFactory(const UnixSocketFactory&); // Prevent copy-construction + UnixSocketFactory& operator=(const UnixSocketFactory&); // Prevent assignment + +}; + +#endif diff --git a/psw/ae/common/pek_pub_key.cpp b/psw/ae/common/pek_pub_key.cpp new file mode 100644 index 0000000000..59940d5b1c --- /dev/null +++ b/psw/ae/common/pek_pub_key.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "arch.h" +#include "sgx_tcrypto.h" +#include "pek_pub_key.h" +#include "pve_qe_common.h" +#include +#include "peksk_pub.hh" + + +//Function to verify the ECDSA signature of a PEK +//SHA1 value for integrity checking is not verified since the ECDSA verification could make sure the integrity at the sametime. +sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, uint8_t *result) +{ + sgx_status_t status = SGX_SUCCESS; + sgx_ecc_state_handle_t handle= 0; + sgx_ec256_signature_t ec_signature; + status = sgx_ecc256_open_context(&handle); + if(SGX_SUCCESS!=status){ + return status; + } + se_static_assert(sizeof(ec_signature)==sizeof(signed_pek.pek_signature)); + memcpy(&ec_signature, signed_pek.pek_signature, sizeof(signed_pek.pek_signature)); + SWAP_ENDIAN_32B(ec_signature.x); + SWAP_ENDIAN_32B(ec_signature.y); + status = sgx_ecdsa_verify(reinterpret_cast(&signed_pek), + static_cast(sizeof(signed_pek.n)+sizeof(signed_pek.e)), + const_cast(&g_pek_pub_key_little_endian), + &ec_signature, + result, + handle); + (void)sgx_ecc256_close_context(handle); + return status; +} diff --git a/psw/ae/common/proto/Makefile b/psw/ae/common/proto/Makefile new file mode 100644 index 0000000000..bb7b163f30 --- /dev/null +++ b/psw/ae/common/proto/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +parent-dir = $(patsubst %/,%,$(dir $(1:%/=%))) +my-dir = $(call parent-dir,$(lastword $(MAKEFILE_LIST))) +################################################################################ + +LOCAL_PATH := $(call my-dir) +BASE_DIR := $(LOCAL_PATH)/../../../.. +ANDROID_DIR := $(BASE_DIR)/android +include $(BASE_DIR)/buildenv.mk +PROTOC := protoc +################################################################################ + +proto_sources := messages.proto +proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) +proto_generated_cc_sources := $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)) +proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources)) + +all: $(proto_generated_headers) + +$(proto_generated_headers): %.pb.h: %.pb.cc + +$(proto_generated_cc_sources): PRIVATE_PROTO_OUT_DIR := $(LOCAL_PATH) +$(proto_generated_cc_sources): PRIVATE_PROTO_PATH_DIR := $(LOCAL_PATH) +$(proto_generated_cc_sources): %.pb.cc: %.proto + $(PROTOC) --cpp_out=$(PRIVATE_PROTO_OUT_DIR) --proto_path=$(PRIVATE_PROTO_PATH_DIR) $^ + +clean:: + rm -f $(proto_generated_cc_sources) $(proto_generated_headers) diff --git a/psw/ae/common/proto/messages.proto b/psw/ae/common/proto/messages.proto new file mode 100644 index 0000000000..3fdc784019 --- /dev/null +++ b/psw/ae/common/proto/messages.proto @@ -0,0 +1,131 @@ +package aesm.message; + +message Request{ + + message InitQuoteRequest{ + optional uint32 timeout = 9; + } + + message GetQuoteRequest{ + required bytes report = 1; + required uint32 quote_type = 2; + required bytes spid = 3; + optional bytes nonce = 4; + optional bytes sig_rl = 5; + required uint32 buf_size = 6; + optional bool qe_report = 7; + optional uint32 timeout = 9; + } + + message GetLaunchTokenRequest{ + required bytes mr_enclave = 1; + required bytes mr_signer = 2; + required bytes se_attributes = 3; + optional uint32 timeout = 9; + } + + message ReportAttestationErrorRequest{ + required bytes platform_info = 1; + required uint32 attestation_error_code = 2; + required uint32 update_info_size =3; + optional uint32 timeout = 9; + } + + //private API + message CreateSessionRequest{ + required uint32 dh_msg1_size = 1; + optional uint32 timeout = 9; + } + + message InvokeServiceRequest{ + required bytes pse_message = 1; + required uint32 pse_resp_size = 2; + optional uint32 timeout = 9; + } + + message ExchangeReportRequest{ + required uint32 session_id = 1; + required bytes se_dh_msg2 = 2; + required uint32 se_dh_msg3_size = 3; + optional uint32 timeout = 9; + } + + message CloseSessionRequest{ + required uint32 session_id = 1; + optional uint32 timeout = 9; + } + + message GetPsCapRequest{ + optional uint32 timeout = 9; + } + + optional InitQuoteRequest initQuoteReq = 1; + optional GetQuoteRequest getQuoteReq = 2; + optional GetLaunchTokenRequest getLicTokenReq = 3; + optional ReportAttestationErrorRequest reportErrReq = 4; + optional CreateSessionRequest createSessionReq = 5; + optional InvokeServiceRequest invokeServiceReq = 6; + optional ExchangeReportRequest exchangeReportReq = 7; + optional CloseSessionRequest closeSessionReq = 8; + optional GetPsCapRequest getPsCapReq = 9; +} + +message Response{ + + message InitQuoteResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes targetInfo = 2; + optional bytes gid = 3; + } + + message GetQuoteResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes quote = 2; + optional bytes qe_report = 3; + } + + message GetLaunchTokenResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes token = 2; + } + + message ReportAttestationErrorResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes platform_update_info = 2; + } + + //private API + message CreateSessionResponse{ + required uint32 errorCode = 1 [default = 1]; + optional uint32 session_id = 2; + optional bytes se_dh_msg1 = 3; + } + + message InvokeServiceResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes pse_message = 2; + } + + message ExchangeReportResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes se_dh_msg3 = 2; + } + + message CloseSessionResponse{ + required uint32 errorCode = 1 [default = 1]; + } + + message GetPsCapResponse{ + required uint32 errorCode = 1 [default = 1]; + optional uint64 ps_cap = 2; + } + optional InitQuoteResponse initQuoteRes = 1; + optional GetQuoteResponse getQuoteRes = 2; + optional GetLaunchTokenResponse getLicTokenRes = 3; + optional ReportAttestationErrorResponse reportErrRes = 4; + optional CreateSessionResponse createSessionRes = 5; + optional InvokeServiceResponse invokeServiceRes = 6; + optional ExchangeReportResponse exchangeReportRes = 7; + optional CloseSessionResponse closeSessionRes = 8; + optional GetPsCapResponse getPsCapRes = 9; +} diff --git a/psw/ae/common/pve_pub_key.cpp b/psw/ae/common/pve_pub_key.cpp new file mode 100644 index 0000000000..19dc02cbfc --- /dev/null +++ b/psw/ae/common/pve_pub_key.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "byte_order.h" +#include "epid_pve_type.h" +#include "sgx_tcrypto.h" +#include "ipp_wrapper.h" + + +static void get_provision_server_rsa_key_little_endian_order(const signed_pek_t& pek, signed_pek_t& little_endian_key) +{ + uint32_t i; + for(i=0;i(little_endian_key.n), + reinterpret_cast(&little_endian_key.e), + rsa_pub_key); + if(status != ippStsNoErr){ + return status; + } + return ippStsNoErr; +} diff --git a/psw/ae/common/se_sig_rl.cpp b/psw/ae/common/se_sig_rl.cpp new file mode 100644 index 0000000000..0702890406 --- /dev/null +++ b/psw/ae/common/se_sig_rl.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "stdint.h" +#include "se_sig_rl.h" +#include "byte_order.h" +#include "sgx_quote.h" +#include "se_quote_internal.h" + +uint64_t se_get_sig_rl_size(const se_sig_rl_t *p_sig_rl) +{ + uint64_t n2 = (p_sig_rl) ? lv_ntohl(p_sig_rl->sig_rl.n2) : 0; + return(sizeof(se_sig_rl_t) - sizeof(p_sig_rl->sig_rl.BK[0]) + + n2 * sizeof(p_sig_rl->sig_rl.BK[0]) + 2 * SE_ECDSA_SIGN_SIZE); +} + +sgx_status_t sgx_get_quote_size(const uint8_t *sig_rl, uint32_t* p_quote_size) +{ + if(!p_quote_size) + return SGX_ERROR_INVALID_PARAMETER; + uint64_t quote_size = 0; + uint64_t sign_size = 0; + uint64_t n2 = 0; + const se_sig_rl_t *p_sig_rl = reinterpret_cast(sig_rl); + + if(sig_rl) + { + if(p_sig_rl->protocol_version != SE_EPID_SIG_RL_VERSION + || p_sig_rl->epid_identifier != SE_EPID_SIG_RL_ID) + { + return SGX_ERROR_INVALID_PARAMETER; + } + } + + n2 = (sig_rl) ? lv_ntohl(p_sig_rl->sig_rl.n2) : 0; + sign_size = sizeof(EPIDSignature) - sizeof(NRProof) + n2*sizeof(NRProof); + quote_size = SE_QUOTE_LENGTH_WITHOUT_SIG + sign_size; + if (quote_size >= 1ull<<32) + { + return SGX_ERROR_INVALID_PARAMETER; + } + *p_quote_size = static_cast(quote_size); + return SGX_SUCCESS; +} + diff --git a/psw/ae/common/src/AECloseSessionRequest.cpp b/psw/ae/common/src/AECloseSessionRequest.cpp new file mode 100644 index 0000000000..f8df312457 --- /dev/null +++ b/psw/ae/common/src/AECloseSessionRequest.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include +#include + +AECloseSessionRequest::AECloseSessionRequest() +:mSessionId(0) +{ +} + +AECloseSessionRequest::AECloseSessionRequest(uint32_t sessionId, uint32_t timeout) +:mSessionId(0) + +{ + CopyFields(sessionId, timeout); +} + +AECloseSessionRequest::AECloseSessionRequest(const AECloseSessionRequest& other) +:IAERequest(other), mSessionId(0) +{ + CopyFields(other.mSessionId, other.mTimeout); +} + +AECloseSessionRequest::~AECloseSessionRequest() +{ + ReleaseMemory(); +} + +void AECloseSessionRequest::ReleaseMemory() +{ + mSessionId = 0; +} + +void AECloseSessionRequest::CopyFields(uint32_t sessionId, uint32_t timeout) +{ + mSessionId = sessionId; + mTimeout = timeout; +} + +AEMessage* AECloseSessionRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AECloseSessionRequest::inflateValues(uint32_t sessionId, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(sessionId, timeout); +} + +bool AECloseSessionRequest::operator==(const AECloseSessionRequest& other) const +{ + if (this == &other) + return true; + + if (mSessionId != other.mSessionId || + mTimeout != other.mTimeout) + return false; + + return true; +} + +AECloseSessionRequest& AECloseSessionRequest::operator=(const AECloseSessionRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mSessionId, other.mTimeout); + + return *this; +} + +bool AECloseSessionRequest::check() +{ + return true; +} + +IAERequest::RequestClass AECloseSessionRequest::getRequestClass() +{ + return PLATFORM_CLASS; +} + +IAEResponse* AECloseSessionRequest::execute(IAESMLogic* aesmLogic) +{ + aesm_error_t result; + result = aesmLogic->closeSession(mSessionId); + + return new AECloseSessionResponse(result); +} + +void AECloseSessionRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitCloseSessionRequest(*this); +} diff --git a/psw/ae/common/src/AECloseSessionResponse.cpp b/psw/ae/common/src/AECloseSessionResponse.cpp new file mode 100644 index 0000000000..52ec5d4d41 --- /dev/null +++ b/psw/ae/common/src/AECloseSessionResponse.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AECloseSessionResponse::AECloseSessionResponse() +{ +} + +AECloseSessionResponse::AECloseSessionResponse(int errorCode) +{ + CopyFields(errorCode); +} + +AECloseSessionResponse::AECloseSessionResponse(const AECloseSessionResponse& other) +{ + CopyFields(other.mErrorCode); +} + +AECloseSessionResponse::~AECloseSessionResponse() +{ + ReleaseMemory(); +} + +void AECloseSessionResponse::ReleaseMemory() +{ +} + +void AECloseSessionResponse::CopyFields(int errorCode) +{ + mErrorCode = errorCode; +} + +AEMessage* AECloseSessionResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AECloseSessionResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AECloseSessionResponse::inflateValues(int errorCode) +{ + ReleaseMemory(); + + CopyFields(errorCode); +} + +bool AECloseSessionResponse::operator==(const AECloseSessionResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode) + return false; + + return true; +} + +AECloseSessionResponse& AECloseSessionResponse::operator=(const AECloseSessionResponse& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode); + + return *this; +} + +bool AECloseSessionResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + return true; +} + +void AECloseSessionResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitCloseSessionResponse(*this); +} diff --git a/psw/ae/common/src/AECreateSessionRequest.cpp b/psw/ae/common/src/AECreateSessionRequest.cpp new file mode 100644 index 0000000000..ca7c30f4fb --- /dev/null +++ b/psw/ae/common/src/AECreateSessionRequest.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include + +AECreateSessionRequest::AECreateSessionRequest() +:mDHMsg1Size(0) +{ +} + +AECreateSessionRequest::AECreateSessionRequest(uint32_t dhMsg1Size, uint32_t timeout) +:mDHMsg1Size(0) +{ + CopyFields(dhMsg1Size, timeout); +} + +AECreateSessionRequest::AECreateSessionRequest(const AECreateSessionRequest& other) +:IAERequest(other), mDHMsg1Size(0) +{ + CopyFields(other.mDHMsg1Size, other.mTimeout); +} + +AECreateSessionRequest::~AECreateSessionRequest() +{ + ReleaseMemory(); +} + +void AECreateSessionRequest::ReleaseMemory() +{ + //none for now +} + +void AECreateSessionRequest::CopyFields(uint32_t dhMsg1Size, uint32_t timeout) +{ + if(dhMsg1Size <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mDHMsg1Size = dhMsg1Size; + mTimeout = timeout; +} + +AEMessage* AECreateSessionRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AECreateSessionRequest::inflateValues(uint32_t dhMsg1Size, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(dhMsg1Size, timeout); +} + +bool AECreateSessionRequest::operator==(const AECreateSessionRequest& other) const +{ + if (this == &other) + return true; + + if (mDHMsg1Size != other.mDHMsg1Size || + mTimeout != other.mTimeout) + return false; + + return true; +} + +AECreateSessionRequest& AECreateSessionRequest::operator=(const AECreateSessionRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mDHMsg1Size, mTimeout); + + return *this; +} + +bool AECreateSessionRequest::check() +{ + if (mValidSizeCheck == false) + return false; + + return true; +} + +IAERequest::RequestClass AECreateSessionRequest::getRequestClass() { + return PLATFORM_CLASS; +} + +IAEResponse* AECreateSessionRequest::execute(IAESMLogic* aesmLogic) { + uint8_t* dh_msg1 = new uint8_t[mDHMsg1Size]; + uint32_t sid = 0; + + aesm_error_t result = aesmLogic->createSession(&sid, dh_msg1, mDHMsg1Size); + + AECreateSessionResponse* sessionResponse = new AECreateSessionResponse(result, sid, mDHMsg1Size, dh_msg1); + delete [] dh_msg1; + return sessionResponse; +} + +void AECreateSessionRequest::visit(IAERequestVisitor& visitor) { + visitor.visitCreateSessionRequest(*this); +} diff --git a/psw/ae/common/src/AECreateSessionResponse.cpp b/psw/ae/common/src/AECreateSessionResponse.cpp new file mode 100644 index 0000000000..0c78e5a18f --- /dev/null +++ b/psw/ae/common/src/AECreateSessionResponse.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AECreateSessionResponse::AECreateSessionResponse() +:mSessionId(0), mDHMsg1Length(0), mDHMsg1(NULL) +{ +} + +AECreateSessionResponse::AECreateSessionResponse(int errorCode, uint32_t sessionId, uint32_t dhMsg1Length, const uint8_t* dhMsg1) +:mSessionId(0), mDHMsg1Length(0), mDHMsg1(NULL) +{ + CopyFields(errorCode, sessionId, dhMsg1Length, dhMsg1); +} + +AECreateSessionResponse::AECreateSessionResponse(const AECreateSessionResponse& other) +:mSessionId(0), mDHMsg1Length(0), mDHMsg1(NULL) +{ + CopyFields(other.mErrorCode, other.mSessionId, other.mDHMsg1Length, other.mDHMsg1); +} + +AECreateSessionResponse::~AECreateSessionResponse() +{ + ReleaseMemory(); +} + +void AECreateSessionResponse::ReleaseMemory() +{ + if (mDHMsg1 != NULL) + { + if (mDHMsg1Length > 0) + memset(mDHMsg1, 0, mDHMsg1Length); + delete [] mDHMsg1; + mDHMsg1 = NULL; + } + mErrorCode = SGX_ERROR_UNEXPECTED; + mDHMsg1Length = 0; + mSessionId = 0; +} + +void AECreateSessionResponse::CopyFields(int errorCode, uint32_t sessionId, uint32_t dhMsg1Length, const uint8_t* dhMsg1) +{ + if(dhMsg1Length <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + + mErrorCode = errorCode; + mSessionId = sessionId; + mDHMsg1Length = dhMsg1Length; + + if (dhMsg1 != NULL && dhMsg1Length > 0) { + mDHMsg1 = new uint8_t[dhMsg1Length]; + memcpy(mDHMsg1, dhMsg1, dhMsg1Length); + } +} + +AEMessage* AECreateSessionResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AECreateSessionResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AECreateSessionResponse::inflateValues(int errorCode, uint32_t sessionId, uint32_t dhMsg1Length, const uint8_t* dhMsg1) +{ + ReleaseMemory(); + + CopyFields(errorCode, sessionId, dhMsg1Length, dhMsg1); +} + +bool AECreateSessionResponse::operator==(const AECreateSessionResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode || + mSessionId != other.mSessionId || + mDHMsg1Length != other.mDHMsg1Length) + return false; + + if ((mDHMsg1 != other.mDHMsg1) && + (mDHMsg1 == NULL || other.mDHMsg1 == NULL)) + return false; + + if (mDHMsg1 != NULL && other.mDHMsg1 != NULL && memcmp(mDHMsg1, other.mDHMsg1, other.mDHMsg1Length) != 0) + return false; + + + + return true; +} + +AECreateSessionResponse& AECreateSessionResponse::operator=(const AECreateSessionResponse& other) +{ + if (this == & other) + return *this; + + inflateValues(other.mErrorCode, other.mSessionId, other.mDHMsg1Length, other.mDHMsg1); + + return *this; +} + +bool AECreateSessionResponse::check() +{ + if (mErrorCode != SGX_SUCCESS ) + return false; + + if (mValidSizeCheck == false) + return false; + + if (mDHMsg1 == NULL) + return false; + + return true; +} + +void AECreateSessionResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitCreateSessionResponse(*this); +} diff --git a/psw/ae/common/src/AEExchangeReportRequest.cpp b/psw/ae/common/src/AEExchangeReportRequest.cpp new file mode 100644 index 0000000000..c96698635f --- /dev/null +++ b/psw/ae/common/src/AEExchangeReportRequest.cpp @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include +#include + + +AEExchangeReportRequest::AEExchangeReportRequest() +:mSessionId(0), mDHMsg2Length(0), mDHMsg2(NULL), mDHMsg3Length(0) +{ +} + +AEExchangeReportRequest::AEExchangeReportRequest(uint32_t sessionId, uint32_t dhMsg2Length, const uint8_t* dhMsg2, uint32_t dhMsg3Length, uint32_t timeout) +:mSessionId(0), mDHMsg2Length(0), mDHMsg2(NULL), mDHMsg3Length(0) +{ + CopyFields(sessionId, dhMsg2Length, dhMsg2, dhMsg3Length, timeout); +} + +AEExchangeReportRequest::AEExchangeReportRequest(const AEExchangeReportRequest& other) +:IAERequest(other), mSessionId(0), mDHMsg2Length(0), mDHMsg2(NULL), mDHMsg3Length(0) +{ + CopyFields(other.mSessionId, other.mDHMsg2Length, other.mDHMsg2, other.mDHMsg3Length, other.mTimeout); +} + +AEExchangeReportRequest::~AEExchangeReportRequest() +{ + ReleaseMemory(); +} + +void AEExchangeReportRequest::ReleaseMemory() +{ + if (mDHMsg2 != NULL) + { + if (mDHMsg2Length > 0) + memset(mDHMsg2, 0, mDHMsg2Length); + delete [] mDHMsg2; + mDHMsg2 = NULL; + } + mDHMsg2Length = 0; + mDHMsg3Length = 0; + mSessionId = 0; + mTimeout = 0; +} + +void AEExchangeReportRequest::CopyFields(uint32_t sessionId, uint32_t dhMsg2Length, const uint8_t* dhMsg2, uint32_t dhMsg3Length, uint32_t timeout) +{ + if(dhMsg2Length <= MAX_MEMORY_ALLOCATION && mDHMsg3Length <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mSessionId = sessionId; + mDHMsg2Length = dhMsg2Length; + mDHMsg3Length = dhMsg3Length; + + mTimeout = timeout; + + if (dhMsg2 != NULL && dhMsg2Length > 0) { + mDHMsg2 = new uint8_t[dhMsg2Length]; + memcpy(mDHMsg2, dhMsg2, dhMsg2Length); + } + +} + +AEMessage* AEExchangeReportRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AEExchangeReportRequest::inflateValues(uint32_t sessionId, uint32_t dhMsg2Length, const uint8_t* dhMsg2, uint32_t dhMsg3Length, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(sessionId, dhMsg2Length, dhMsg2, dhMsg3Length, timeout); +} + +bool AEExchangeReportRequest::operator==(const AEExchangeReportRequest& other) const +{ + if (this == &other) + return true; + + if (mSessionId != other.mSessionId || + mDHMsg2Length != other.mDHMsg2Length || + mDHMsg3Length != other.mDHMsg3Length || + mTimeout != other.mTimeout) + return false; + + if ((mDHMsg2 != other.mDHMsg2) && + (mDHMsg2 == NULL || other.mDHMsg2 == NULL)) + return false; + + if (mDHMsg2 != NULL && other.mDHMsg2 != NULL && memcmp(mDHMsg2, other.mDHMsg2, other.mDHMsg2Length) != 0) + return false; + + return true; +} + +AEExchangeReportRequest& AEExchangeReportRequest::operator=(const AEExchangeReportRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mSessionId, other.mDHMsg2Length, other.mDHMsg2, other.mDHMsg3Length, other.mTimeout); + + return *this; +} + +bool AEExchangeReportRequest::check() +{ + if(mValidSizeCheck == false) + return false; + + if (mDHMsg2 == NULL) + return false; + + return true; +} + +IAERequest::RequestClass AEExchangeReportRequest::getRequestClass() { + return PLATFORM_CLASS; +} + +IAEResponse* AEExchangeReportRequest::execute(IAESMLogic* aesmLogic) { + aesm_error_t ret = AESM_UNEXPECTED_ERROR; + uint8_t* dh_msg3 = NULL; + + if (check() == false) + { + ret = AESM_PARAMETER_ERROR; + } + else + { + dh_msg3 = new uint8_t[mDHMsg3Length]; + ret = aesmLogic->exchangeReport(mSessionId, mDHMsg2, mDHMsg2Length, dh_msg3, mDHMsg3Length); + } + + IAEResponse* ae_res = new AEExchangeReportResponse(ret, mDHMsg3Length, dh_msg3); + + if (dh_msg3) + { + delete [] dh_msg3; + } + + return ae_res; +} + +void AEExchangeReportRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitExchangeReportRequest(*this); +} diff --git a/psw/ae/common/src/AEExchangeReportResponse.cpp b/psw/ae/common/src/AEExchangeReportResponse.cpp new file mode 100644 index 0000000000..57d3726367 --- /dev/null +++ b/psw/ae/common/src/AEExchangeReportResponse.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEExchangeReportResponse::AEExchangeReportResponse() +:mDHMsg3Length(0), mDHMsg3(NULL) +{ +} + +AEExchangeReportResponse::AEExchangeReportResponse(int errorCode, uint32_t dhMsg3Length, const uint8_t* dhMsg3) +:mDHMsg3Length(0), mDHMsg3(NULL) +{ + CopyFields(errorCode, dhMsg3Length, dhMsg3); +} + +AEExchangeReportResponse::AEExchangeReportResponse(const AEExchangeReportResponse& other) +:mDHMsg3Length(0), mDHMsg3(NULL) +{ + CopyFields(other.mErrorCode, other.mDHMsg3Length, other.mDHMsg3); +} + +AEExchangeReportResponse::~AEExchangeReportResponse() +{ + ReleaseMemory(); +} + +void AEExchangeReportResponse::ReleaseMemory() +{ + if (mDHMsg3 != NULL) + { + if (mDHMsg3Length > 0) + memset(mDHMsg3, 0, mDHMsg3Length); + delete [] mDHMsg3; + mDHMsg3 = NULL; + } + mDHMsg3Length = 0; + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEExchangeReportResponse::CopyFields(int errorCode, uint32_t dhMsg3Length,const uint8_t* dhMsg3) +{ + if(dhMsg3Length <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + mDHMsg3Length = dhMsg3Length; + if (dhMsg3 != NULL && dhMsg3Length > 0) { + mDHMsg3 = new uint8_t[dhMsg3Length]; + memcpy(mDHMsg3, dhMsg3, dhMsg3Length); + } +} + +AEMessage* AEExchangeReportResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEExchangeReportResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEExchangeReportResponse::inflateValues(int errorCode, uint32_t dhMsg3Length,const uint8_t* dhMsg3) +{ + ReleaseMemory(); + + CopyFields(errorCode, dhMsg3Length, dhMsg3); +} + +bool AEExchangeReportResponse::operator==(const AEExchangeReportResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode || + mDHMsg3Length != other.mDHMsg3Length) + return false; + + if ((mDHMsg3 != other.mDHMsg3) && + (mDHMsg3 == NULL || other.mDHMsg3 == NULL)) + return false; + + if (mDHMsg3 != NULL && other.mDHMsg3 != NULL && memcmp(mDHMsg3, other.mDHMsg3, other.mDHMsg3Length) != 0) + return false; + + return true; +} + +AEExchangeReportResponse& AEExchangeReportResponse::operator=(const AEExchangeReportResponse& other) +{ + if (this == &other) + return *this; + + ReleaseMemory(); + + CopyFields(other.mErrorCode, other.mDHMsg3Length, other.mDHMsg3); + + return *this; +} + +bool AEExchangeReportResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + + if (mValidSizeCheck == false) + return false; + + if (mDHMsg3 == NULL) + return false; + + return true; +} + +void AEExchangeReportResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitExchangeReportResponse(*this); +} diff --git a/psw/ae/common/src/AEGetLaunchTokenRequest.cpp b/psw/ae/common/src/AEGetLaunchTokenRequest.cpp new file mode 100644 index 0000000000..3c3e811af5 --- /dev/null +++ b/psw/ae/common/src/AEGetLaunchTokenRequest.cpp @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include + +AEGetLaunchTokenRequest::AEGetLaunchTokenRequest() : + mEnclaveMeasurementLength(0), + mEnclaveMeasurement(NULL), + mSigstructLength(0), + mSigstruct(NULL), + mSEAttributesLength(0), + mSEAttributes(NULL) +{ +} + +AEGetLaunchTokenRequest::AEGetLaunchTokenRequest(uint32_t measurementLength, const uint8_t* measurement, + uint32_t sigstructLength, const uint8_t* sigstruct, + uint32_t attributesLength, const uint8_t* attributes, + uint32_t timeout) : + mEnclaveMeasurementLength(0), + mEnclaveMeasurement(NULL), + mSigstructLength(0), + mSigstruct(NULL), + mSEAttributesLength(0), + mSEAttributes(NULL) +{ + CopyFields(measurementLength, measurement, sigstructLength, sigstruct, attributesLength, attributes, timeout); +} + +AEGetLaunchTokenRequest::AEGetLaunchTokenRequest(const AEGetLaunchTokenRequest& other) : + IAERequest(other), + mEnclaveMeasurementLength(0), + mEnclaveMeasurement(NULL), + mSigstructLength(0), + mSigstruct(NULL), + mSEAttributesLength(0), + mSEAttributes(NULL) +{ + CopyFields(other.mEnclaveMeasurementLength, other.mEnclaveMeasurement, other.mSigstructLength, other.mSigstruct, other.mSEAttributesLength, other.mSEAttributes, other.mTimeout); +} + +AEGetLaunchTokenRequest::~AEGetLaunchTokenRequest() +{ + ReleaseMemory(); +} + +void AEGetLaunchTokenRequest::CopyFields(uint32_t measurementLength,const uint8_t* measurement, + uint32_t sigstructLength,const uint8_t* sigstruct, + uint32_t attributesLength,const uint8_t* attributes, + uint32_t timeout) +{ + uint32_t totalSize = measurementLength + sigstructLength + attributesLength; + if (measurementLength <= MAX_MEMORY_ALLOCATION && sigstructLength <= MAX_MEMORY_ALLOCATION && + attributesLength <= MAX_MEMORY_ALLOCATION && totalSize <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mTimeout = timeout; + + if (measurement != NULL && measurementLength > 0) + { + mEnclaveMeasurement = new uint8_t[measurementLength]; + mEnclaveMeasurementLength = measurementLength; + memcpy(mEnclaveMeasurement, measurement, measurementLength); + } + + if (sigstruct != NULL && sigstructLength > 0) + { + mSigstruct = new uint8_t[sigstructLength]; + mSigstructLength = sigstructLength; + memcpy(mSigstruct, sigstruct, sigstructLength); + } + + if (attributes != NULL && attributesLength > 0) + { + mSEAttributes = new uint8_t[attributesLength]; + mSEAttributesLength = attributesLength; + memcpy(mSEAttributes, attributes, attributesLength); + } +} + +void AEGetLaunchTokenRequest::ReleaseMemory() +{ + if (mEnclaveMeasurement != NULL) + { + delete [] mEnclaveMeasurement; + mEnclaveMeasurement = NULL; + } + + if (mSigstruct != NULL) + { + if (mSigstructLength > 0) + { + memset(mSigstruct, 0, mSigstructLength); + } + delete [] mSigstruct; + mSigstruct = NULL; + + } + + if (mSEAttributes != NULL) + { + if (mSEAttributesLength > 0) + { + memset(mSEAttributes, 0, mSEAttributesLength); + } + delete [] mSEAttributes; + mSEAttributes = NULL; + } +} + +AEMessage* AEGetLaunchTokenRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AEGetLaunchTokenRequest::inflateValues(uint32_t measurementLength,const uint8_t* measurement, + uint32_t sigstructLength,const uint8_t* sigstruct, + uint32_t attributesLength,const uint8_t* attributes, + uint32_t timeout) +{ + + ReleaseMemory(); + + CopyFields(measurementLength, measurement, sigstructLength, sigstruct, attributesLength, attributes, timeout); +} + +bool AEGetLaunchTokenRequest::check() +{ + if (mValidSizeCheck == false) + return false; + + //memory + if (mEnclaveMeasurement == NULL || mSigstruct == NULL || mSEAttributes == NULL) + return false; + //sizes + if (mEnclaveMeasurementLength == 0 || mSigstructLength == 0 || mSEAttributesLength == 0) + return false; + + return true; +} + +bool AEGetLaunchTokenRequest::operator==(const AEGetLaunchTokenRequest& other) const +{ + if (this == &other) + return true; + + if (mEnclaveMeasurementLength != other.mEnclaveMeasurementLength || + mSigstructLength != other.mSigstructLength || + mSEAttributesLength != other.mSEAttributesLength || + mTimeout != other.mTimeout) + return false; + + if ((mEnclaveMeasurement != other.mEnclaveMeasurement) && + (mEnclaveMeasurement == NULL || other.mEnclaveMeasurement == NULL)) + return false; + + if ((mSigstruct != other.mSigstruct) && + (mSigstruct == NULL || other.mSigstruct == NULL)) + return false; + + if ((mSEAttributes != other.mSEAttributes) && + (mSEAttributes == NULL || other.mSEAttributes == NULL)) + return false; + + if (mEnclaveMeasurement != NULL && memcmp(mEnclaveMeasurement, other.mEnclaveMeasurement, other.mEnclaveMeasurementLength) != 0) + return false; + + if (mSigstruct != NULL && memcmp(mSigstruct, other.mSigstruct, other.mSigstructLength) != 0) + return false; + + if (mSEAttributes != NULL && memcmp(mSEAttributes, other.mSEAttributes, other.mSEAttributesLength) != 0) + return false; + + return true; + +} + +AEGetLaunchTokenRequest& AEGetLaunchTokenRequest::operator=(const AEGetLaunchTokenRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mEnclaveMeasurementLength, other.mEnclaveMeasurement, other.mSigstructLength, other.mSigstruct, other.mSEAttributesLength, other.mSEAttributes, other.mTimeout); + + return *this; +} + +IAERequest::RequestClass AEGetLaunchTokenRequest::getRequestClass() { + return LAUNCH_CLASS; +} + +IAEResponse* AEGetLaunchTokenRequest::execute(IAESMLogic* aesmLogic) { + uint8_t* token; + uint32_t tokenSize; + + aesm_error_t result = aesmLogic->getLaunchToken(mEnclaveMeasurement, mEnclaveMeasurementLength, mSigstruct, mSigstructLength, mSEAttributes, mSEAttributesLength, &token, &tokenSize); + + IAEResponse* response = new AEGetLaunchTokenResponse(result, tokenSize, token); + + //free the buffer before send + delete [] token; + + return response; +} + +void AEGetLaunchTokenRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitGetLaunchTokenRequest(*this); +} diff --git a/psw/ae/common/src/AEGetLaunchTokenResponse.cpp b/psw/ae/common/src/AEGetLaunchTokenResponse.cpp new file mode 100644 index 0000000000..ce8d7bffcd --- /dev/null +++ b/psw/ae/common/src/AEGetLaunchTokenResponse.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEGetLaunchTokenResponse::AEGetLaunchTokenResponse() : + mTokenLength(0), + mToken(NULL) +{ +} + +AEGetLaunchTokenResponse::AEGetLaunchTokenResponse(int errorCode, uint32_t tokenLength, const uint8_t* token) : + mTokenLength(0), + mToken(NULL) +{ + CopyFields(errorCode, tokenLength, token); +} + +AEGetLaunchTokenResponse::AEGetLaunchTokenResponse(const AEGetLaunchTokenResponse& other) : + mTokenLength(0), + mToken(NULL) +{ + CopyFields(other.mErrorCode, other.mTokenLength, other.mToken); +} + +AEGetLaunchTokenResponse::~AEGetLaunchTokenResponse() +{ + ReleaseMemory(); +} + +AEMessage* AEGetLaunchTokenResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEGetLaunchTokenResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEGetLaunchTokenResponse::inflateValues(int errorCode, uint32_t tokenLength,const uint8_t* token) +{ + ReleaseMemory(); + + CopyFields(errorCode, tokenLength, token); +} + + //operators +bool AEGetLaunchTokenResponse::operator==(const AEGetLaunchTokenResponse& other) const +{ + if (this == &other) + return true; + + if (mTokenLength != other.mTokenLength) + return false; + + if (mToken == NULL && mToken != other.mToken) + return false; + + if (mToken != NULL && other.mToken != NULL) + if (memcmp(mToken, other.mToken, other.mTokenLength) != 0) + return false; + + return true; +} + +AEGetLaunchTokenResponse& AEGetLaunchTokenResponse::operator=(const AEGetLaunchTokenResponse& other) +{ + if (this == &other) + return *this; + + ReleaseMemory(); + + CopyFields(other.mErrorCode, other.mTokenLength, other.mToken); + + return *this; +} + + //checks +bool AEGetLaunchTokenResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + + //simple size check + if (mValidSizeCheck == false) + return false; + + if (mToken == NULL) + return false; + + return true; +} + +void AEGetLaunchTokenResponse::ReleaseMemory() +{ + if (mToken != NULL) + delete [] mToken; + mToken = NULL; + mTokenLength = 0; + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEGetLaunchTokenResponse::CopyFields(int errorCode, uint32_t tokenLength,const uint8_t* token) +{ + if(tokenLength <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + mTokenLength = tokenLength; + + if (token != NULL && tokenLength > 0) + { + mToken = new uint8_t[tokenLength]; + memcpy(mToken, token, tokenLength); + } +} + +void AEGetLaunchTokenResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitGetLaunchTokenResponse(*this); +} diff --git a/psw/ae/common/src/AEGetPsCapRequest.cpp b/psw/ae/common/src/AEGetPsCapRequest.cpp new file mode 100644 index 0000000000..dac8bee3d6 --- /dev/null +++ b/psw/ae/common/src/AEGetPsCapRequest.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include + +#include + +AEGetPsCapRequest::AEGetPsCapRequest(uint32_t timeout) : IAERequest(timeout) { +} + +AEGetPsCapRequest::AEGetPsCapRequest(const AEGetPsCapRequest& other) +: IAERequest(other) +{ + CopyFields(other.mTimeout); +} + +AEGetPsCapRequest::~AEGetPsCapRequest() +{ + ReleaseMemory(); +} + +void AEGetPsCapRequest::ReleaseMemory() +{ + //empty for now +} + + +void AEGetPsCapRequest::CopyFields(uint32_t timeout) +{ + mTimeout = timeout; +} + +AEMessage* AEGetPsCapRequest::serialize(ISerializer* serializer){ + return serializer->serialize(this); +} + +IAERequest::RequestClass AEGetPsCapRequest::getRequestClass() { + return PLATFORM_CLASS; +} + +void AEGetPsCapRequest::inflateValues(uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(timeout); +} + +bool AEGetPsCapRequest::operator==(const AEGetPsCapRequest& other) const +{ + if (this == &other) + return true; + + if (mTimeout != other.mTimeout) + return false; + + return true; //no members , default to true +} + +AEGetPsCapRequest& AEGetPsCapRequest::operator=(const AEGetPsCapRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mTimeout); + + //do nothing - no members + return *this; +} + +void AEGetPsCapRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitGetPsCapRequest(*this); +} + + +IAEResponse* AEGetPsCapRequest::execute(IAESMLogic* aesmLogic) +{ + uint64_t ps_cap; + + aesm_error_t result = aesmLogic->getPsCap(&ps_cap); + + AEGetPsCapResponse * response = new AEGetPsCapResponse((uint32_t)result, ps_cap); + + return response; +} diff --git a/psw/ae/common/src/AEGetPsCapResponse.cpp b/psw/ae/common/src/AEGetPsCapResponse.cpp new file mode 100644 index 0000000000..fe89c54be9 --- /dev/null +++ b/psw/ae/common/src/AEGetPsCapResponse.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEGetPsCapResponse::AEGetPsCapResponse() : + mPsCap(-1) +{ +} + +AEGetPsCapResponse::AEGetPsCapResponse(int errorCode, uint64_t ps_cap) : + mPsCap(-1) +{ + CopyFields(errorCode, ps_cap); +} + +AEGetPsCapResponse::AEGetPsCapResponse(const AEGetPsCapResponse& other) : + mPsCap(-1) +{ + CopyFields(other.mErrorCode, other.mPsCap); +} + +AEGetPsCapResponse::~AEGetPsCapResponse() +{ + ReleaseMemory(); +} + +void AEGetPsCapResponse::ReleaseMemory() +{ + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEGetPsCapResponse::CopyFields(int errorCode, uint64_t ps_cap) +{ + mErrorCode = errorCode; + mPsCap = ps_cap; +} + + +AEMessage* AEGetPsCapResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEGetPsCapResponse::inflateWithMessage(AEMessage* message, ISerializer *serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEGetPsCapResponse::inflateValues(int errorCode, uint64_t ps_cap) +{ + ReleaseMemory(); + + CopyFields(errorCode, ps_cap); +} + +bool AEGetPsCapResponse::operator==(const AEGetPsCapResponse &other) const +{ + if (this == &other) + return true; + + if (mPsCap!= other.mPsCap) + return false; + return true; +} + +AEGetPsCapResponse & AEGetPsCapResponse::operator=(const AEGetPsCapResponse &other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode, other.mPsCap); + + return *this; +} + +bool AEGetPsCapResponse::check() +{ + // no MAC to check at this point, but do some generic parameter check + + //impose a limit of 1MB for these messages. If larger then a transmission, or unmarshalling error may have occured + //also a big value here might be an attack + + //first, fail if errorCode is not 0 + if (mErrorCode != SGX_SUCCESS) + return false; + + return true; +} + +void AEGetPsCapResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitGetPsCapResponse(*this); +} + diff --git a/psw/ae/common/src/AEGetQuoteRequest.cpp b/psw/ae/common/src/AEGetQuoteRequest.cpp new file mode 100644 index 0000000000..57cc100586 --- /dev/null +++ b/psw/ae/common/src/AEGetQuoteRequest.cpp @@ -0,0 +1,324 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include "IAESMLogic.h" + +#include + +#include + + AEGetQuoteRequest::AEGetQuoteRequest() +:mReportLength(0), mReport(NULL), mQuoteType(0), mSPIDLength(0), mSPID(NULL), + mNonceLength(0), mNonce(NULL), mSigRLLength(0), mSigRL(NULL), mBufferSize(0), mQEReport(false) +{ + mValidSizeCheck = false; +} + +AEGetQuoteRequest::AEGetQuoteRequest(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, + bool qe_report, + uint32_t timeout) +:mReportLength(0), mReport(NULL), mQuoteType(0), mSPIDLength(0), mSPID(NULL), + mNonceLength(0), mNonce(NULL), mSigRLLength(0), mSigRL(NULL), mBufferSize(0), mQEReport(false) +{ + CopyFields(reportLength, report, quoteType, spidLength, spid, + nonceLength, nonce, sig_rlLength, sig_rl, bufferSize, qe_report, timeout); +} + +AEGetQuoteRequest::AEGetQuoteRequest(const AEGetQuoteRequest& other) +: IAERequest(other) +{ + CopyFields(other.mReportLength, other.mReport, + other.mQuoteType, + other.mSPIDLength, other.mSPID, + other.mNonceLength, other.mNonce, + other.mSigRLLength, other.mSigRL, + other.mBufferSize, + other.mQEReport, + other.mTimeout); +} + +AEGetQuoteRequest::~AEGetQuoteRequest() +{ + ReleaseMemory(); +} + +AEMessage* AEGetQuoteRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AEGetQuoteRequest::CopyFields(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, + bool qe_report, + uint32_t timeout) +{ + uint32_t totalAllocation = reportLength + spidLength + nonceLength + sig_rlLength; + if(reportLength <= MAX_MEMORY_ALLOCATION && spidLength <= MAX_MEMORY_ALLOCATION && + nonceLength <= MAX_MEMORY_ALLOCATION && sig_rlLength <= MAX_MEMORY_ALLOCATION && + totalAllocation <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mReport = NULL; + mReportLength = 0; + + mSigRL = NULL; + mSigRLLength = 0; + + mNonce = NULL; + mNonceLength = 0; + + mSPID = NULL; + mSPIDLength = 0; + + mValidSizeCheck = false; + return; + } + + mReportLength = reportLength; + if (reportLength > 0 && report != NULL) + { + mReport = new uint8_t[reportLength]; + memcpy(mReport, report, reportLength); + } + else + mReport = NULL; + + mSigRLLength = sig_rlLength; + if (sig_rl != NULL && sig_rlLength > 0) + { + mSigRL = new uint8_t[sig_rlLength]; + memcpy(mSigRL, sig_rl, sig_rlLength); + } + else + mSigRL = NULL; + + mNonceLength = nonceLength; + if (nonce != NULL && nonceLength > 0) + { + mNonce = new uint8_t[nonceLength]; + memcpy(mNonce, nonce, nonceLength); + } + else + mNonce = NULL; + + mSPIDLength = spidLength; + if (spid != NULL && spidLength > 0) + { + mSPID = new uint8_t[spidLength]; + memcpy(mSPID, spid, spidLength); + } + else + mSPID = NULL; + + mQuoteType = quoteType; + mBufferSize = bufferSize; + mQEReport = qe_report; + mTimeout = timeout; +} + +void AEGetQuoteRequest::inflateValues(uint32_t reportLength, const uint8_t* report, + uint32_t quoteType, + uint32_t spidLength, const uint8_t* spid, + uint32_t nonceLength, const uint8_t* nonce, + uint32_t sig_rlLength, const uint8_t* sig_rl, + uint32_t bufferSize, + bool qe_report, + uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(reportLength, report, quoteType, spidLength, spid, + nonceLength, nonce, sig_rlLength, sig_rl, bufferSize, qe_report, timeout); +} + + +void AEGetQuoteRequest::ReleaseMemory() +{ + if (mReport != NULL) + { + if (mReportLength > 0) + memset(mReport,0,mReportLength); + delete [] mReport; + mReport = NULL; + } + if (mSigRL != NULL) + { + if (mSigRLLength > 0) + memset(mSigRL, 0, mSigRLLength); + delete [] mSigRL; + mSigRL = NULL; + } + if (mNonce != NULL) + { + if (mNonceLength > 0) + memset(mNonce, 0, mNonceLength); + delete [] mNonce; + mNonce = NULL; + } + if (mSPID != NULL) + { + if (mSPIDLength > 0) + memset(mSPID, 0, mSPIDLength); + delete [] mSPID; + mSPID = NULL; + } + + mReportLength = 0; + mSigRLLength = 0; + mNonceLength = 0; + mSPIDLength = 0; + mBufferSize = 0; + mQuoteType = 0; + mQEReport = false; + mTimeout = 0; +} + +bool AEGetQuoteRequest::operator==(const AEGetQuoteRequest& other) const +{ + if (&other == this) + return true; + + if (mReportLength != other.mReportLength || + mSigRLLength != other.mSigRLLength || + mNonceLength != other.mNonceLength || + mSPIDLength != other.mSPIDLength || + mQuoteType != other.mQuoteType || + mBufferSize != other.mBufferSize || + mQEReport != other.mQEReport || + mTimeout != other.mTimeout) + return false; + + if ((mReport != other.mReport) && + (mReport == NULL || other.mReport == NULL)) + return false; + + if ((mSigRL != other.mSigRL) && + (mSigRL == NULL || other.mSigRL == NULL)) + return false; + + if ((mNonce != other.mNonce) && + (mNonce == NULL || other.mNonce == NULL)) + return false; + + if ((mSPID != other.mSPID) && + (mSPID == NULL || other.mSPID == NULL)) + return false; + + if ((mReport != NULL && other.mReport != NULL && memcmp(mReport, other.mReport, mReportLength) != 0) || + (mSigRL != NULL && other.mSigRL != NULL && memcmp(mSigRL, other.mSigRL, mSigRLLength) != 0) || + (mNonce != NULL && other.mNonce != NULL && memcmp(mNonce, other.mNonce, mNonceLength) != 0) || + (mSPID != NULL && other.mSPID != NULL && memcmp(mSPID, other.mSPID, mSPIDLength) !=0 )) + return false; + return true; +} + +AEGetQuoteRequest& AEGetQuoteRequest::operator=(const AEGetQuoteRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mReportLength, other.mReport, + other.mQuoteType, + other.mSPIDLength, other.mSPID, + other.mNonceLength, other.mNonce, + other.mSigRLLength, other.mSigRL, + other.mBufferSize, + other.mQEReport, + other.mTimeout); + + return *this; +} + +bool AEGetQuoteRequest::check() +{ + //maybe TODO - add stronger checks + + if(mValidSizeCheck == false) + return false; + + //allocations - only non optional fields + if (mReport == NULL || mSPID == NULL) + return false; + + return true; +} + +IAERequest::RequestClass AEGetQuoteRequest::getRequestClass() { + return QUOTING_CLASS; +} + +void AEGetQuoteRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitGetQuoteRequest(*this); +} + +IAEResponse* AEGetQuoteRequest::execute(IAESMLogic* aesmLogic) { + aesm_error_t result; + + int32_t qe_report_length = 0; + uint8_t* qe_report = NULL; + if (mQEReport == true) + { + qe_report_length = sizeof(sgx_report_t); + qe_report = new uint8_t[sizeof(sgx_report_t)]; + } + uint8_t* quote = new uint8_t[mBufferSize]; + + result = aesmLogic->getQuote(mReportLength,mReport, + mQuoteType, + mSPIDLength, mSPID, + mNonceLength, mNonce, + mSigRLLength, mSigRL, + mBufferSize, quote, + qe_report_length, qe_report); + + AEGetQuoteResponse* response = new AEGetQuoteResponse(result, mBufferSize, quote, qe_report_length, qe_report); + + //free memory + delete [] quote; + delete [] qe_report; + + return response; +} diff --git a/psw/ae/common/src/AEGetQuoteResponse.cpp b/psw/ae/common/src/AEGetQuoteResponse.cpp new file mode 100644 index 0000000000..d30f179af6 --- /dev/null +++ b/psw/ae/common/src/AEGetQuoteResponse.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEGetQuoteResponse::AEGetQuoteResponse() : + mQuoteLength(0), + mQuote(NULL), + mQEReportLength(0), + mQEReport(NULL) +{ +} + +AEGetQuoteResponse::AEGetQuoteResponse(int errorCode, uint32_t quoteLength, const uint8_t* quote, + uint32_t qeReportLength, const uint8_t* qeReport) : + mQuoteLength(0), + mQuote(NULL), + mQEReportLength(0), + mQEReport(NULL) +{ + CopyFields(errorCode, quoteLength, quote,qeReportLength, qeReport); +} + +//copy constructor +AEGetQuoteResponse::AEGetQuoteResponse(const AEGetQuoteResponse& other) : + mQuoteLength(0), + mQuote(NULL), + mQEReportLength(0), + mQEReport(NULL) +{ + CopyFields(other.mErrorCode, other.mQuoteLength, other.mQuote, other.mQEReportLength, other.mQEReport); +} + +AEGetQuoteResponse::~AEGetQuoteResponse() +{ + ReleaseMemory(); +} + +void AEGetQuoteResponse::ReleaseMemory() +{ + if (mQuote != NULL) + delete [] mQuote; + if (mQEReport != NULL) + delete [] mQEReport; + mQuote = NULL; + mQEReport = NULL; + mQuoteLength = 0; + mQEReportLength = 0; + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEGetQuoteResponse::CopyFields(int errorCode, uint32_t quoteLength,const uint8_t* quote, + uint32_t qeReportLength, const uint8_t* qeReport) +{ + uint32_t totalSize = qeReportLength + quoteLength; + + if(quoteLength <= MAX_MEMORY_ALLOCATION && qeReportLength <= MAX_MEMORY_ALLOCATION + && totalSize <= MAX_MEMORY_ALLOCATION ) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + mQuoteLength = quoteLength; + mQEReportLength = qeReportLength; + + if (quote != NULL && quoteLength > 0) + { + mQuote = new uint8_t[quoteLength]; + memcpy(mQuote, quote, quoteLength); + } + + if (qeReport != NULL&& qeReportLength > 0) + { + mQEReport = new uint8_t[qeReportLength]; + memcpy(mQEReport, qeReport, qeReportLength); + } +} + +AEMessage* AEGetQuoteResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEGetQuoteResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEGetQuoteResponse::inflateValues(int errorCode, uint32_t quoteLength, const uint8_t* quote, + uint32_t qeReportLength, const uint8_t* qeReport) +{ + ReleaseMemory(); + + CopyFields(errorCode, quoteLength, quote, qeReportLength, qeReport); +} + +bool AEGetQuoteResponse::operator==(const AEGetQuoteResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode || + mQuoteLength != other.mQuoteLength || + mQEReportLength != other.mQEReportLength) + return false; + + if (mQuote != NULL && other.mQuote != NULL) + if (memcmp(mQuote, other.mQuote, other.mQuoteLength) != 0) + return false; + if (mQEReport != NULL && other.mQEReport != NULL) + if (memcmp(mQEReport, other.mQEReport, other.mQEReportLength) != 0) + return false; + + return true; +} + +AEGetQuoteResponse& AEGetQuoteResponse::operator=(const AEGetQuoteResponse& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode, other.mQuoteLength, other.mQuote, other.mQEReportLength, other.mQEReport); + + return *this; +} + +bool AEGetQuoteResponse::check() +{ + if (mValidSizeCheck == false) + return false; + + return true; +} + +void AEGetQuoteResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitGetQuoteResponse(*this); +} diff --git a/psw/ae/common/src/AEInitQuoteRequest.cpp b/psw/ae/common/src/AEInitQuoteRequest.cpp new file mode 100644 index 0000000000..f4c77d8ce4 --- /dev/null +++ b/psw/ae/common/src/AEInitQuoteRequest.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include + +#include + +AEInitQuoteRequest::AEInitQuoteRequest(uint32_t timeout) +{ + inflateValues(timeout); +} + +AEInitQuoteRequest::AEInitQuoteRequest(const AEInitQuoteRequest& other) +:IAERequest(other) +{ + CopyFields(other.mTimeout); +} + +AEInitQuoteRequest::~AEInitQuoteRequest() +{ +} + +void AEInitQuoteRequest::ReleaseMemory() +{ + //empty for now +} + +void AEInitQuoteRequest::CopyFields(uint32_t timeout) +{ + mTimeout = timeout; +} + +AEMessage* AEInitQuoteRequest::serialize(ISerializer* serializer){ + return serializer->serialize(this); +} + +IAERequest::RequestClass AEInitQuoteRequest::getRequestClass() { + return QUOTING_CLASS; +} + +void AEInitQuoteRequest::inflateValues(uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(timeout); +} + +bool AEInitQuoteRequest::operator==(const AEInitQuoteRequest& other) const +{ + if (this == &other) + return true; + + if (mTimeout != other.mTimeout) + return false; + + return true; //no members , default to true +} + +AEInitQuoteRequest& AEInitQuoteRequest::operator=(const AEInitQuoteRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mTimeout); + + //do nothing - no members + return *this; +} + +void AEInitQuoteRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitInitQuoteRequest(*this); +} + + +IAEResponse* AEInitQuoteRequest::execute(IAESMLogic* aesmLogic) { + uint8_t* target_info = new uint8_t[sizeof(sgx_target_info_t)]; + uint8_t* gid = new uint8_t[sizeof(sgx_epid_group_id_t)]; + uint32_t target_info_length=sizeof(sgx_target_info_t); + uint32_t gid_length=sizeof(sgx_epid_group_id_t); + + aesm_error_t result= aesmLogic->initQuote(target_info,target_info_length,gid, gid_length); + + AEInitQuoteResponse * response = new AEInitQuoteResponse((uint32_t)result, gid_length, gid, target_info_length, target_info); + + delete [] target_info; + delete [] gid; + + return response; +} diff --git a/psw/ae/common/src/AEInitQuoteResponse.cpp b/psw/ae/common/src/AEInitQuoteResponse.cpp new file mode 100644 index 0000000000..5fabb98f7f --- /dev/null +++ b/psw/ae/common/src/AEInitQuoteResponse.cpp @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEInitQuoteResponse::AEInitQuoteResponse() : + mGIDLength(0), + mTargetInfoLength(0), + mTargetInfo(NULL), + mGID(NULL) +{ +} + +AEInitQuoteResponse::AEInitQuoteResponse(int errorCode, uint32_t gidLength, const uint8_t* gid, + uint32_t targetInfoLength, const uint8_t* targetInfo) : + mGIDLength(0), + mTargetInfoLength(0), + mTargetInfo(NULL), + mGID(NULL) +{ + CopyFields(errorCode, gidLength, gid, targetInfoLength, targetInfo); +} + +AEInitQuoteResponse::AEInitQuoteResponse(const AEInitQuoteResponse& other) : + mGIDLength(0), + mTargetInfoLength(0), + mTargetInfo(NULL), + mGID(NULL) +{ + CopyFields(other.mErrorCode, other.mGIDLength, other.mGID, other.mTargetInfoLength, other.mTargetInfo); +} + +AEInitQuoteResponse::~AEInitQuoteResponse() +{ + ReleaseMemory(); +} + +void AEInitQuoteResponse::ReleaseMemory() +{ + if (mGID != NULL){ + delete [] mGID; + mGID = NULL; + mGIDLength = 0; + } + + if (mTargetInfo != NULL) + { + delete [] mTargetInfo; + mTargetInfo = NULL; + mTargetInfoLength = 0; + } + + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEInitQuoteResponse::CopyFields(int errorCode, uint32_t gidLength, const uint8_t* gid, + uint32_t targetInfoLength, const uint8_t* targetInfo) +{ + uint32_t totalSize = gidLength + targetInfoLength; + + if(gidLength <= MAX_MEMORY_ALLOCATION && targetInfoLength <= MAX_MEMORY_ALLOCATION + && totalSize <= MAX_MEMORY_ALLOCATION ) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + + mGIDLength = gidLength; + + if (gid == NULL) + mGID = NULL; + else + { + mGID = new uint8_t[mGIDLength]; + memcpy(mGID, gid, mGIDLength); + } + + mTargetInfoLength = targetInfoLength; + mTargetInfo = new uint8_t[mTargetInfoLength]; + memcpy(mTargetInfo, targetInfo, mTargetInfoLength); +} + + +AEMessage* AEInitQuoteResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEInitQuoteResponse::inflateWithMessage(AEMessage* message, ISerializer *serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEInitQuoteResponse::inflateValues(int errorCode, uint32_t gidLength, const uint8_t* gid, + uint32_t targetInfoLength, const uint8_t* targetInfo) +{ + ReleaseMemory(); + + CopyFields(errorCode, gidLength, gid, targetInfoLength, targetInfo); +} + +bool AEInitQuoteResponse::operator==(const AEInitQuoteResponse &other) const +{ + if (this == &other) + return true; + + if (mTargetInfoLength != other.mTargetInfoLength || + mGIDLength != other.mGIDLength) + return false; + + if (memcmp(mGID, other.mGID, mGIDLength) != 0) + return false; + + if (memcmp(mTargetInfo, other.mTargetInfo, mTargetInfoLength) != 0) + return false; + + return true; +} + +AEInitQuoteResponse & AEInitQuoteResponse::operator=(const AEInitQuoteResponse &other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode, other.mGIDLength, other.mGID, other.mTargetInfoLength, other.mTargetInfo); + + return *this; +} + +bool AEInitQuoteResponse::check() +{ + // no MAC to check at this point, but do some generic parameter check + + //first, fail if errorCode is not 0 + if (mErrorCode != SGX_SUCCESS) + return false; + + if (mValidSizeCheck == false) + return false; + + //check memory allocation fail in this object + if (mTargetInfoLength > 0 && mTargetInfo == NULL) + return false; + + if (mGIDLength > 0 && mGID == NULL) + return false; + + return true; +} + +void AEInitQuoteResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitInitQuoteResponse(*this); +} diff --git a/psw/ae/common/src/AEInvokeServiceRequest.cpp b/psw/ae/common/src/AEInvokeServiceRequest.cpp new file mode 100644 index 0000000000..68335e8080 --- /dev/null +++ b/psw/ae/common/src/AEInvokeServiceRequest.cpp @@ -0,0 +1,182 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include +#include + + AEInvokeServiceRequest::AEInvokeServiceRequest() +:mPSEMessageLength(0), mPSEMessage(NULL), mResponseSize(0) +{ +} + + AEInvokeServiceRequest::AEInvokeServiceRequest(uint32_t pseMessageLength, const uint8_t* pseMessage, uint32_t pseResponseSize, uint32_t timeout) +:mPSEMessageLength(0), mPSEMessage(NULL), mResponseSize(0) +{ + CopyFields(pseMessageLength, pseMessage, pseResponseSize, timeout); +} + + AEInvokeServiceRequest::AEInvokeServiceRequest(const AEInvokeServiceRequest& other) +:IAERequest(other), mPSEMessageLength(0), mPSEMessage(NULL), mResponseSize(0) +{ + CopyFields(other.mPSEMessageLength, other.mPSEMessage, other.mResponseSize, other.mTimeout); +} + +AEInvokeServiceRequest::~AEInvokeServiceRequest() +{ + ReleaseMemory(); +} + +void AEInvokeServiceRequest::ReleaseMemory() +{ + if (mPSEMessage != NULL) + { + if (mPSEMessageLength > 0) + memset(mPSEMessage, 0, mPSEMessageLength); + delete [] mPSEMessage; + mPSEMessage = NULL; + } + mPSEMessageLength = 0; + mResponseSize = 0; + mTimeout = 0; +} + +void AEInvokeServiceRequest::CopyFields(uint32_t pseMessageLength, const uint8_t* pseMessage, uint32_t pseResponseSize, uint32_t timeout) +{ + if(pseMessageLength <= MAX_MEMORY_ALLOCATION && pseResponseSize <= MAX_MEMORY_ALLOCATION) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mPSEMessageLength = pseMessageLength; + if (pseMessage != NULL && pseMessageLength > 0) + { + mPSEMessage = new uint8_t[pseMessageLength]; + memcpy(mPSEMessage, pseMessage, pseMessageLength); + } + + mTimeout = timeout; + mResponseSize = pseResponseSize; +} + +AEMessage* AEInvokeServiceRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AEInvokeServiceRequest::inflateValues(uint32_t pseMessageLength, const uint8_t* pseMessage, uint32_t pseResponseSize, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(pseMessageLength, pseMessage, pseResponseSize, timeout); +} + +bool AEInvokeServiceRequest::operator==(const AEInvokeServiceRequest& other) const +{ + if (this == & other) + return true; + + if (mPSEMessageLength != other.mPSEMessageLength || + mResponseSize != other.mResponseSize || + mTimeout != other.mTimeout) + return false; + + if ((mPSEMessage != other.mPSEMessage) && + (mPSEMessage == NULL || other.mPSEMessage == NULL)) + return false; + + if (mPSEMessage != NULL && other.mPSEMessage != NULL && memcmp(mPSEMessage, other.mPSEMessage, other.mPSEMessageLength) != 0) + return false; + //NOTE: timeout discarded from test + return true; +} + +AEInvokeServiceRequest& AEInvokeServiceRequest::operator=(const AEInvokeServiceRequest& other) +{ + if (this == &other) + return * this; + + CopyFields(other.mPSEMessageLength, other.mPSEMessage, other.mResponseSize, other.mTimeout); + + return *this; +} + +bool AEInvokeServiceRequest::check() +{ + if(mValidSizeCheck == false) + return false; + + if (mPSEMessage == NULL) + return false; + + return true; +} + +IAERequest::RequestClass AEInvokeServiceRequest::getRequestClass() { + return PLATFORM_CLASS; +} + +IAEResponse* AEInvokeServiceRequest::execute(IAESMLogic* aesmLogic) { + aesm_error_t ret = AESM_UNEXPECTED_ERROR; + uint8_t* response = NULL; + + if (check() == false) + { + ret = AESM_PARAMETER_ERROR; + } + else + { + response = new uint8_t[mResponseSize]; + } + if (response != NULL) + { + ret = aesmLogic->invokeService(mPSEMessage, mPSEMessageLength, response, mResponseSize); + } + + IAEResponse* ae_res= new AEInvokeServiceResponse(ret, mResponseSize, response); + + delete [] response; + + return ae_res; +} + +void AEInvokeServiceRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitInvokeServiceRequest(*this); +} diff --git a/psw/ae/common/src/AEInvokeServiceResponse.cpp b/psw/ae/common/src/AEInvokeServiceResponse.cpp new file mode 100644 index 0000000000..5f384edbd6 --- /dev/null +++ b/psw/ae/common/src/AEInvokeServiceResponse.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + + AEInvokeServiceResponse::AEInvokeServiceResponse() +:mPSEMessageLength(0), mPSEMessage(NULL) +{ +} + + AEInvokeServiceResponse::AEInvokeServiceResponse(int errorCode, uint32_t pseMessageLength, const uint8_t* pseMessage) +:mPSEMessageLength(0), mPSEMessage(NULL) +{ + CopyFields(errorCode, pseMessageLength, pseMessage); +} + + AEInvokeServiceResponse::AEInvokeServiceResponse(const AEInvokeServiceResponse& other) +:mPSEMessageLength(0), mPSEMessage(NULL) +{ + CopyFields(other.mErrorCode, other.mPSEMessageLength, other.mPSEMessage); +} + +AEInvokeServiceResponse::~AEInvokeServiceResponse() +{ + ReleaseMemory(); +} + +void AEInvokeServiceResponse::ReleaseMemory() +{ + if (mPSEMessage != NULL) + { + if (mPSEMessageLength > 0) + memset(mPSEMessage, 0, mPSEMessageLength); + delete [] mPSEMessage; + mPSEMessage = NULL; + } + mErrorCode = SGX_ERROR_UNEXPECTED; + mPSEMessageLength = 0; +} + +void AEInvokeServiceResponse::CopyFields(int errorCode, uint32_t pseMessageLength,const uint8_t* pseMessage) +{ + if(pseMessageLength <= MAX_MEMORY_ALLOCATION ) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + mPSEMessageLength = pseMessageLength; + if (pseMessage != NULL && pseMessageLength > 0) { + mPSEMessage = new uint8_t[pseMessageLength]; + memcpy(mPSEMessage, pseMessage, pseMessageLength); + } +} + +AEMessage* AEInvokeServiceResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEInvokeServiceResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEInvokeServiceResponse::inflateValues(int errorCode, uint32_t pseMessageLength,const uint8_t* pseMessage) +{ + ReleaseMemory(); + + CopyFields(errorCode, pseMessageLength, pseMessage); +} + +bool AEInvokeServiceResponse::operator==(const AEInvokeServiceResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode || + mPSEMessageLength != other.mPSEMessageLength) + return false; + + if ((mPSEMessage != other.mPSEMessage) && + (mPSEMessage == NULL || other.mPSEMessage == NULL)) + return false; + + if (mPSEMessage != NULL && other.mPSEMessage != NULL && + memcmp(mPSEMessage, other.mPSEMessage, other.mPSEMessageLength) != 0) + return false; + + return true; +} + +AEInvokeServiceResponse& AEInvokeServiceResponse::operator=(const AEInvokeServiceResponse& other) +{ + if (this == &other) + return * this; + + inflateValues(other.mErrorCode, other.mPSEMessageLength, other.mPSEMessage); + + return *this; +} + +bool AEInvokeServiceResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + + if (mValidSizeCheck == false) + return false; + + if (mPSEMessage == NULL) + return false; + + return true; +} + +void AEInvokeServiceResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitInvokeServiceResponse(*this); +} diff --git a/psw/ae/common/src/AEReportAttestationRequest.cpp b/psw/ae/common/src/AEReportAttestationRequest.cpp new file mode 100644 index 0000000000..bc90db810c --- /dev/null +++ b/psw/ae/common/src/AEReportAttestationRequest.cpp @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include +#include + +AEReportAttestationRequest::AEReportAttestationRequest() +:mAttestationErrorCode(-1), +mPlatformInfoLength(0), +mPlatformInfo(NULL), +mUpdateInfoLength(0) +{ +} + +AEReportAttestationRequest::AEReportAttestationRequest(uint32_t platformInfoLength, const uint8_t* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout) +:mAttestationErrorCode(-1), +mPlatformInfoLength(0), +mPlatformInfo(NULL), +mUpdateInfoLength(0) + +{ + CopyFields(platformInfoLength, platformInfo, attestation_error_code, updateInfoLength, timeout); +} + +AEReportAttestationRequest::AEReportAttestationRequest(const AEReportAttestationRequest& other) +:IAERequest(other), +mAttestationErrorCode(-1), +mPlatformInfoLength(0), +mPlatformInfo(NULL), +mUpdateInfoLength(0) +{ + CopyFields(other.mPlatformInfoLength, other.mPlatformInfo, other.mAttestationErrorCode, other.mUpdateInfoLength, other.mTimeout); +} + +AEReportAttestationRequest::~AEReportAttestationRequest() +{ + ReleaseMemory(); +} + +void AEReportAttestationRequest::ReleaseMemory() +{ + if (mPlatformInfo != NULL) + { + if (mPlatformInfoLength > 0) + { + memset(mPlatformInfo, 0, mPlatformInfoLength); + } + delete [] mPlatformInfo; + mPlatformInfo = NULL; + } +} + +void AEReportAttestationRequest::CopyFields(uint32_t platformInfoLength, const uint8_t* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout) +{ + if (platformInfoLength <= MAX_MEMORY_ALLOCATION ) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + if (platformInfo != NULL && platformInfoLength > 0) + { + mPlatformInfo = new uint8_t[platformInfoLength]; + mPlatformInfoLength = platformInfoLength; + memcpy(mPlatformInfo, platformInfo, platformInfoLength); + } + mAttestationErrorCode = attestation_error_code; + mUpdateInfoLength = updateInfoLength; + mTimeout = timeout; +} + +AEMessage* AEReportAttestationRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AEReportAttestationRequest::inflateValues(uint32_t platformInfoLength, const uint8_t* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(platformInfoLength, platformInfo, attestation_error_code, updateInfoLength, timeout); +} + +bool AEReportAttestationRequest::operator==(const AEReportAttestationRequest& other) const +{ + if (this == &other) + return true; + + if (mPlatformInfoLength != other.mPlatformInfoLength || + mTimeout != other.mTimeout) + return false; + + if (mAttestationErrorCode != other.mAttestationErrorCode) + return false; + + if (mUpdateInfoLength!= other.mUpdateInfoLength) + return false; + + + if (mPlatformInfo == other.mPlatformInfo) + return true; + + if (mPlatformInfo == NULL) + return false; //only mPlatformInfo in NULL, because mPlatformInfo != other.mPlatformInfo + + if (other.mPlatformInfo == NULL) + return false; //only other.mPlatformInfo in NULL, because mPlatformInfo != other.mPlatformInfo + + if (memcmp(mPlatformInfo, other.mPlatformInfo, other.mPlatformInfoLength) != 0) + return false; + + return true; +} + +AEReportAttestationRequest& AEReportAttestationRequest::operator=(const AEReportAttestationRequest& other) +{ + if (this == &other) + return *this; + + ReleaseMemory(); + + CopyFields(other.mPlatformInfoLength, other.mPlatformInfo, other.mAttestationErrorCode, other.mUpdateInfoLength, other.mTimeout); + + return *this; +} + +bool AEReportAttestationRequest::check() +{ + if (mValidSizeCheck == false) + return false; + return true; +} + +IAERequest::RequestClass AEReportAttestationRequest::getRequestClass() +{ + return QUOTING_CLASS; +} + +IAEResponse* AEReportAttestationRequest::execute(IAESMLogic* aesmLogic) +{ + aesm_error_t result; + uint8_t* update_info = new uint8_t[mUpdateInfoLength]; + result = aesmLogic->reportAttestationStatus(mPlatformInfo, mPlatformInfoLength, + mAttestationErrorCode, + update_info, mUpdateInfoLength); + + IAEResponse* response = new AEReportAttestationResponse(result, mUpdateInfoLength, update_info); + delete []update_info; + return response; +} + +void AEReportAttestationRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitReportAttestationRequest(*this); +} + diff --git a/psw/ae/common/src/AEReportAttestationResponse.cpp b/psw/ae/common/src/AEReportAttestationResponse.cpp new file mode 100644 index 0000000000..cf95e70d63 --- /dev/null +++ b/psw/ae/common/src/AEReportAttestationResponse.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEReportAttestationResponse::AEReportAttestationResponse() : + mUpdateInfoLength(0), + mUpdateInfo(NULL) +{ +} + +AEReportAttestationResponse::AEReportAttestationResponse(int errorCode, uint32_t updateInfoLength, const uint8_t* updateInfo) : + mUpdateInfoLength(0), + mUpdateInfo(NULL) +{ + CopyFields(errorCode, updateInfoLength, updateInfo); +} + +AEReportAttestationResponse::AEReportAttestationResponse(const AEReportAttestationResponse& other) : + mUpdateInfoLength(0), + mUpdateInfo(NULL) +{ + CopyFields(other.mErrorCode, other.mUpdateInfoLength, other.mUpdateInfo); +} + +AEReportAttestationResponse::~AEReportAttestationResponse() +{ + ReleaseMemory(); +} + +void AEReportAttestationResponse::ReleaseMemory() +{ + if (mUpdateInfo != NULL) + delete [] mUpdateInfo; + mUpdateInfo = NULL; + mUpdateInfoLength = 0; + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEReportAttestationResponse::CopyFields(int errorCode, uint32_t updateInfoLength,const uint8_t* updateInfo) +{ + if(updateInfoLength <= MAX_MEMORY_ALLOCATION ) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + mUpdateInfoLength = updateInfoLength; + if (updateInfo != NULL && updateInfoLength > 0) + { + mUpdateInfo = new uint8_t[updateInfoLength]; + memcpy(mUpdateInfo, updateInfo, updateInfoLength); + } +} + +AEMessage* AEReportAttestationResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEReportAttestationResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEReportAttestationResponse::inflateValues(int errorCode, uint32_t updateInfoLength, const uint8_t* updateInfo) +{ + ReleaseMemory(); + + CopyFields(errorCode, updateInfoLength, updateInfo); +} + +bool AEReportAttestationResponse::operator==(const AEReportAttestationResponse& other) const +{ + if (this == &other) + return true; + + if (mUpdateInfoLength != other.mUpdateInfoLength) + return false; + + if (mUpdateInfo == NULL && mUpdateInfo != other.mUpdateInfo) + return false; + + if (mUpdateInfo != NULL && other.mUpdateInfo != NULL) + if (memcmp(mUpdateInfo, other.mUpdateInfo, other.mUpdateInfoLength) != 0) + return false; + + return true; +} + +AEReportAttestationResponse& AEReportAttestationResponse::operator=(const AEReportAttestationResponse& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode, other.mUpdateInfoLength, other.mUpdateInfo); + + return *this; +} + +//checks +bool AEReportAttestationResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + + if (mValidSizeCheck == false) + return false; + + if (mUpdateInfo == NULL) + return false; + + return true; +} + +void AEReportAttestationResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitReportAttestationResponse(*this); +} diff --git a/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp b/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp new file mode 100644 index 0000000000..3fb2bb79e3 --- /dev/null +++ b/psw/ae/common/src/NonBlockingUnixCommunicationSocket.cpp @@ -0,0 +1,445 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +NonBlockingUnixCommunicationSocket::~NonBlockingUnixCommunicationSocket() +{ + if (mEvents != NULL) + delete [] mEvents; + + close(mEpoll); + close(mCommandPipe[0]); + close(mCommandPipe[1]); + +} + +se_static_assert(MAX_EVENTS<=UINT32_MAX/sizeof(struct epoll_event)); +bool NonBlockingUnixCommunicationSocket::init() +{ + //create the epoll structure + mEpoll = epoll_create(1); + if (mEpoll < 0) + return false; + + //create the command pipe + int ret; + ret = pipe(mCommandPipe); + if (ret != 0) + { + close(mEpoll); + return false; + } + + //place one end of the pipe in the epoll list + struct epoll_event event; + event.data.fd = mCommandPipe[0]; + event.events = EPOLLIN | EPOLLET; + int registerCommand = epoll_ctl (mEpoll, EPOLL_CTL_ADD, mCommandPipe[0], &event); + + //connect to the AESM - blocking connect + bool connectInit = UnixCommunicationSocket::init(); + + //register the event + event.data.fd = mSocket; + event.events = EPOLLET; + int registerSocket = epoll_ctl (mEpoll, EPOLL_CTL_ADD, mSocket, &event); + + if (registerCommand != 0 || registerSocket != 0 || connectInit == false) + { + close(mEpoll); + close(mCommandPipe[0]); + close(mCommandPipe[1]); + + return false; + } + + //create events buffer + mEvents = new struct epoll_event[MAX_EVENTS]; + memset((char*)mEvents, 0, MAX_EVENTS * sizeof(struct epoll_event)); + + return MakeNonBlocking(); +} + +char* NonBlockingUnixCommunicationSocket::readRaw(ssize_t length) +{ + if (mSocket == -1) + return NULL; + + // Add read event + struct epoll_event event; + event.data.fd = mSocket; + event.events = EPOLLIN | EPOLLET; + int registerSocket = epoll_ctl (mEpoll, EPOLL_CTL_MOD, mSocket, &event); + if (registerSocket != 0) + { + return NULL; + } + + ssize_t total_read = 0; + ssize_t step = 0; + char * recBuf = NULL; + recBuf = new char[length]; + memset(recBuf, 0, length); + + int32_t epollTimeout = (mTimeoutMseconds > 0 ? mTimeoutMseconds : -1); + int eventNum = 0; + int i = 0; + bool errorDetected = false; + bool cancellationDetected = false; + bool peerSocketClosed = false; + + + MarkStartTime(); + + do{ + //try a direct read (maybe all data is available already) + step = read(mSocket, recBuf, length); + if (step == -1 && errno != EAGAIN) + { + errorDetected = true; + } + else + { + if (step != -1) + { + total_read += step; + } + + if (total_read == length) + { + break; //we are finished here + } + } + + //wait for events + eventNum = epoll_wait(mEpoll, mEvents, MAX_EVENTS, epollTimeout); + if (eventNum == -1) + { + errorDetected = true; + } + + for (i = 0; + CheckForTimeout() == false && //need to be sure to check this first + errorDetected == false && + cancellationDetected == false && + peerSocketClosed == false && + i < eventNum; + i++) + { + if (mEvents[i].events & EPOLLHUP) + { + peerSocketClosed = true; + continue; + } + if ((mEvents[i].events & EPOLLERR) || + (!(mEvents[i].events & EPOLLIN))) + { + //error + errorDetected = true; + } + else + { + if (mEvents[i].data.fd == mCommandPipe[0]) + { + //cancellation -- in the case this logic would complicate by needing more commands, we will detach this into + //a CommandManager of some sort + cancellationDetected = true; + } + else + { + //read data + step = partialRead(recBuf + total_read, length - total_read); + if (step == -1) + { + errorDetected = true; + } + if (step == 0) //peer closed socket + { + //did this happen before getting the entire data ? + if (total_read != length) + errorDetected = true; + } + total_read += step; + } + } + + } + + if (total_read != length) + { + if (errorDetected || cancellationDetected || wasTimeoutDetected()) + { + disconnect(); + delete [] recBuf; + recBuf = NULL; + break; + } + } + + //clear events + memset((char*)mEvents, 0, MAX_EVENTS * sizeof(struct epoll_event)); + + }while (total_read < length); + + event.data.fd = mSocket; + event.events = EPOLLET; + registerSocket = epoll_ctl (mEpoll, EPOLL_CTL_MOD, mSocket, &event); + if (registerSocket != 0) + { + disconnect(); + delete [] recBuf; + return NULL; + } + + return recBuf; +} + +/** +* Read no more than maxLength bytes +*/ +ssize_t NonBlockingUnixCommunicationSocket::partialRead(char* buffer, ssize_t maxLength) +{ + ssize_t step = 0; + ssize_t chunkSize = (maxLength < 512 ? maxLength : 512); + ssize_t totalRead = 0; + ssize_t remaining = maxLength; + + while (totalRead < maxLength) + { + remaining = maxLength - totalRead; + + step = read(mSocket, buffer + totalRead, (remaining > chunkSize ? chunkSize : remaining)); + if (step == -1) + { + if (errno != EAGAIN) + return -1; + break; + } + + totalRead += step; + if (step == 0) + break; + } + return totalRead; +} + +ssize_t NonBlockingUnixCommunicationSocket::writeRaw(const char* data, ssize_t length) +{ + if (mSocket == -1) + return -1; + + ssize_t total_write = 0; + ssize_t step = 0; + + int32_t epollTimeout = (mTimeoutMseconds > 0 ? mTimeoutMseconds : -1); + int eventNum = 0; + int i = 0; + bool errorDetected = false; + bool cancellationDetected = false; + bool peerSocketClosed = false; + + bool lastWriteSuccessful = false; + struct epoll_event event; + int registerSocket; + + MarkStartTime(); + + do + { + step = write(mSocket, data + total_write, length - total_write); + + if (step == -1 && errno != EAGAIN) + { + // an error occured + errorDetected = true; + } + else + { + if (step == -1 && errno == EAGAIN) + { + // the internal buffer is full + + // EPOLLOUT is added so that an event is generated when there is + // empty space in the buffer + lastWriteSuccessful = false; + + event.data.fd = mSocket; + event.events = EPOLLET | EPOLLOUT; + registerSocket = epoll_ctl (mEpoll, EPOLL_CTL_MOD, mSocket, &event); + if (registerSocket != 0) + { + return -1; + } + } + else + { + // the write was successful + + if (!lastWriteSuccessful) + { + // remove EPOLLOUT + lastWriteSuccessful = true; + + event.data.fd = mSocket; + event.events = EPOLLET; + registerSocket = epoll_ctl (mEpoll, EPOLL_CTL_MOD, mSocket, &event); + if (registerSocket != 0) + { + return -1; + } + } + + total_write += step; + + if (total_write == length) + { + break; + } + + continue; + } + } + + eventNum = epoll_wait(mEpoll, mEvents, MAX_EVENTS, epollTimeout); + if (eventNum == -1) + { + errorDetected = true; + } + + for (i = 0; + CheckForTimeout() == false && + errorDetected == false && + cancellationDetected == false && + peerSocketClosed == false && + i < eventNum; + i++) + { + if (mEvents[i].events & EPOLLHUP) + { + // the socket or that pipe have been closed + peerSocketClosed = true; + continue; + } + if ((mEvents[i].events & EPOLLERR) || + (!(mEvents[i].events & EPOLLOUT))) + { + // received an event other than EPOLLOUT + errorDetected = true; + } + else + { + if (mEvents[i].data.fd == mCommandPipe[0]) + { + cancellationDetected = true; + } + } + } + + if (errorDetected || cancellationDetected || wasTimeoutDetected() || peerSocketClosed) + { + disconnect(); + break; + } + + memset((char*)mEvents, 0, MAX_EVENTS * sizeof(struct epoll_event)); + } + while(total_write < length); + + event.data.fd = mSocket; + event.events = EPOLLET; + registerSocket = epoll_ctl (mEpoll, EPOLL_CTL_MOD, mSocket, &event); + if (registerSocket != 0) + { + return -1; + } + + return total_write; +} + +int NonBlockingUnixCommunicationSocket::getSockDescriptor() +{ + return UnixCommunicationSocket::getSockDescriptor(); +} + +bool NonBlockingUnixCommunicationSocket::wasTimeoutDetected() +{ + return UnixCommunicationSocket::wasTimeoutDetected(); +} + +bool NonBlockingUnixCommunicationSocket::setTimeout(uint32_t milliseconds) +{ + mTimeoutMseconds = milliseconds; + return true; +} + +bool NonBlockingUnixCommunicationSocket::MakeNonBlocking() +{ + int flags, ret; + + flags = fcntl (mSocket, F_GETFL, 0); + if (flags == -1) + { + return false; + } + + flags |= (int)O_NONBLOCK; + ret = fcntl (mSocket, F_SETFL, flags); + if (ret == -1) + { + return false; + } + + return true; +} + +void NonBlockingUnixCommunicationSocket::Cancel() const +{ + //write anything on the pipe + char cmd = '1'; + if (write(mCommandPipe[0],&cmd,1) < 0) + { + // do nothing + } +} diff --git a/psw/ae/common/src/NonBlockingUnixSocketFactory.cpp b/psw/ae/common/src/NonBlockingUnixSocketFactory.cpp new file mode 100644 index 0000000000..461e58f765 --- /dev/null +++ b/psw/ae/common/src/NonBlockingUnixSocketFactory.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +ICommunicationSocket* NonBlockingUnixSocketFactory::NewCommunicationSocket() +{ + NonBlockingUnixCommunicationSocket* sock = new NonBlockingUnixCommunicationSocket(mSocketBase); + bool initializationSuccessfull = false; + + if (sock != NULL) + initializationSuccessfull = sock->init(); + + if (initializationSuccessfull == false) + { + delete sock; + sock = NULL; + } + + return sock; + +} diff --git a/psw/ae/common/src/ProtobufSerializer.cpp b/psw/ae/common/src/ProtobufSerializer.cpp new file mode 100644 index 0000000000..aec29bc3b8 --- /dev/null +++ b/psw/ae/common/src/ProtobufSerializer.cpp @@ -0,0 +1,1289 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + * Implementation of serializer based on google protobufs + */ + +#include +#include +#include + +/* must include this AFTER ProtobufSerializer.h */ +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +using namespace google::protobuf; + +#define UNUSED(val) (void)(val) + +/* + * InitQuote + */ + + +AEMessage* ProtobufSerializer::serialize(AEInitQuoteRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::InitQuoteRequest proto_req; + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::InitQuoteRequest* mutableReq = msg.mutable_initquotereq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_initquotereq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEInitQuoteResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::InitQuoteResponse proto_res; + + if (response->GetGID() != NULL) + { + std::string gid((const char*)response->GetGID(), response->GetGIDLength()); + proto_res.set_gid(gid); + } + + if (response->GetTargetInfo() != NULL) + { + std::string target_info((const char*)response->GetTargetInfo(), response->GetTargetInfoLength()); + proto_res.set_targetinfo(target_info); + } + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::InitQuoteResponse* mutableRes = msg.mutable_initquoteres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_initquoteres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), data.size()); + } + + delete mutableRes; + } + return ae_msg; +} + +IAERequest* ProtobufSerializer::inflateGetQuoteRequest(aesm::message::Request* reqMsg) +{ + aesm::message::Request::GetQuoteRequest proto_req = reqMsg->getquotereq(); + + uint32_t report_length = 0; + uint8_t* report = NULL; + uint32_t spid_length = 0; + uint8_t* spid = NULL; + uint32_t nonce_length = 0; + uint8_t* nonce = NULL; + uint32_t sig_rl_length = 0; + uint8_t* sig_rl = NULL; + + if (proto_req.has_report()) + { + if(proto_req.report().size() > UINT_MAX) { + return NULL; + } + report_length = (unsigned int) proto_req.report().size(); + report = (uint8_t*)const_cast(proto_req.report().data()); + } + if (proto_req.has_spid()) + { + if(proto_req.spid().size() > UINT_MAX) { + return NULL; + } + spid_length = (unsigned int) proto_req.spid().size(); + spid = (uint8_t*)const_cast(proto_req.spid().data()); + } + if (proto_req.has_nonce()) + { + if(proto_req.nonce().size() > UINT_MAX) { + return NULL; + } + nonce_length = (unsigned int) proto_req.nonce().size(); + nonce = (uint8_t*)const_cast(proto_req.nonce().data()); + } + if (proto_req.has_sig_rl()) + { + if(proto_req.sig_rl().size() > UINT_MAX) { + return NULL; + } + sig_rl_length = (unsigned int) proto_req.sig_rl().size(); + sig_rl = (uint8_t*)const_cast(proto_req.sig_rl().data()); + } + + AEGetQuoteRequest* request = new AEGetQuoteRequest(); + request->inflateValues(report_length, report, + proto_req.quote_type(), + spid_length, spid, + nonce_length, nonce, + sig_rl_length, sig_rl, + proto_req.buf_size(), + proto_req.qe_report(), + proto_req.timeout()); + + return request; +} + +IAERequest* ProtobufSerializer::inflateInitQuoteRequest(aesm::message::Request* reqMsg) +{ + AEInitQuoteRequest* request = new AEInitQuoteRequest(); + aesm::message::Request::InitQuoteRequest proto_req = reqMsg->initquotereq(); + + request->inflateValues(proto_req.timeout()); + return request; +} + +IAERequest* ProtobufSerializer::inflateCloseSessionRequest(aesm::message::Request* reqMsg) +{ + AECloseSessionRequest* request = new AECloseSessionRequest(); + aesm::message::Request::CloseSessionRequest proto_req = reqMsg->closesessionreq(); + + request->inflateValues(proto_req.session_id(), proto_req.timeout()); + return request; +} + +IAERequest* ProtobufSerializer::inflateCreateSessionRequest(aesm::message::Request* reqMsg) +{ + AECreateSessionRequest* request = new AECreateSessionRequest(); + aesm::message::Request::CreateSessionRequest proto_req = reqMsg->createsessionreq(); + + request->inflateValues(proto_req.dh_msg1_size(), proto_req.timeout()); + + return request; +} + +IAERequest* ProtobufSerializer::inflateExchangeReportRequest(aesm::message::Request* reqMsg) +{ + aesm::message::Request::ExchangeReportRequest proto_req = reqMsg->exchangereportreq(); + + uint32_t dh_msg2_length = 0; + uint8_t* dh_msg2 = NULL; + + if (proto_req.has_se_dh_msg2()) + { + if(proto_req.se_dh_msg2().size() > UINT_MAX) { + return NULL; + } + dh_msg2_length = (unsigned int)proto_req.se_dh_msg2().size(); + dh_msg2 = (uint8_t*)const_cast(proto_req.se_dh_msg2().data()); + } + + AEExchangeReportRequest* request = new AEExchangeReportRequest(); + request->inflateValues(proto_req.session_id(), + dh_msg2_length, + dh_msg2, + proto_req.se_dh_msg3_size(), + proto_req.timeout()); + + return request; +} + +IAERequest* ProtobufSerializer::inflateGetLaunchTokenRequest(aesm::message::Request* reqMsg) +{ + aesm::message::Request::GetLaunchTokenRequest proto_req = reqMsg->getlictokenreq(); + + uint32_t mr_enclave_length = 0; + uint8_t* mr_enclave = NULL; + uint32_t mr_signer_length = 0; + uint8_t* mr_signer = NULL; + uint32_t se_attributes_length = 0; + uint8_t* se_attributes = NULL; + + if (proto_req.has_mr_enclave()) + { + if(proto_req.mr_enclave().size() > UINT_MAX) { + return NULL; + } + mr_enclave_length = (unsigned int)proto_req.mr_enclave().size(); + mr_enclave = (uint8_t*)const_cast(proto_req.mr_enclave().data()); + } + if (proto_req.has_mr_signer()) + { + if(proto_req.mr_signer().size() > UINT_MAX) { + return NULL; + } + mr_signer_length = (unsigned int)proto_req.mr_signer().size(); + mr_signer = (uint8_t*)const_cast(proto_req.mr_signer().data()); + } + if (proto_req.has_se_attributes()) + { + if(proto_req.se_attributes().size() > UINT_MAX) { + return NULL; + } + se_attributes_length = (unsigned int)proto_req.se_attributes().size(); + se_attributes = (uint8_t*)const_cast(proto_req.se_attributes().data()); + } + + AEGetLaunchTokenRequest* request = new AEGetLaunchTokenRequest(); + request->inflateValues(mr_enclave_length, mr_enclave, + mr_signer_length, mr_signer, + se_attributes_length, se_attributes, + proto_req.timeout()); + + return request; +} + +IAERequest* ProtobufSerializer::inflateInvokeServiceRequest(aesm::message::Request* reqMsg) +{ + aesm::message::Request::InvokeServiceRequest proto_req = reqMsg->invokeservicereq(); + + uint32_t pse_message_length = 0; + uint8_t* pse_message = NULL; + + if (proto_req.has_pse_message()) + { + if(proto_req.pse_message().size() > UINT_MAX) { + return NULL; + } + pse_message_length = (unsigned int)proto_req.pse_message().size(); + pse_message = (uint8_t*)const_cast(proto_req.pse_message().data()); + } + + AEInvokeServiceRequest* request = new AEInvokeServiceRequest(); + request->inflateValues(pse_message_length, pse_message, proto_req.pse_resp_size(), proto_req.timeout()); + + return request; +} + +IAERequest* ProtobufSerializer::inflateGetPsCapRequest(aesm::message::Request* reqMsg) +{ + AEGetPsCapRequest* request = new AEGetPsCapRequest(); + aesm::message::Request::GetPsCapRequest proto_req = reqMsg->getpscapreq(); + + request->inflateValues(proto_req.timeout()); + return request; +} + +IAERequest* ProtobufSerializer::inflateReportAttestationErrorRequest(aesm::message::Request* reqMsg) +{ + aesm::message::Request::ReportAttestationErrorRequest proto_req = reqMsg->reporterrreq(); + + uint32_t attestation_error_code = -1; + if (proto_req.has_attestation_error_code()) + { + attestation_error_code = proto_req.attestation_error_code(); + } + uint32_t update_info_size = 0; + if (proto_req.has_update_info_size()) + { + update_info_size = proto_req.update_info_size(); + } + uint32_t platform_info_length = 0; + uint8_t* platform_info = NULL; + if (proto_req.has_platform_info()) + { + if(proto_req.platform_info().size() > UINT_MAX) { + return NULL; + } + platform_info_length = (unsigned int)proto_req.platform_info().size(); + platform_info = (uint8_t*)const_cast(proto_req.platform_info().data()); + } + + AEReportAttestationRequest* request = new AEReportAttestationRequest(); + request->inflateValues(platform_info_length, platform_info, attestation_error_code, update_info_size, proto_req.timeout()); + return request; +} + +IAERequest* ProtobufSerializer::inflateRequest(AEMessage* message) { + if (message == NULL || message->data == NULL) + return NULL; + + std::string data((char*)message->data, message->size); + aesm::message::Request* reqMsg = new aesm::message::Request(); + + reqMsg->ParseFromString(data); + IAERequest* request = NULL; + if (reqMsg->has_initquotereq() == true) + request = inflateInitQuoteRequest(reqMsg); + if (reqMsg->has_getquotereq() == true) + request = inflateGetQuoteRequest(reqMsg); + if (reqMsg->has_closesessionreq() == true) + request = inflateCloseSessionRequest(reqMsg); + if (reqMsg->has_createsessionreq() == true) + request = inflateCreateSessionRequest(reqMsg); + if (reqMsg->has_exchangereportreq() == true) + request = inflateExchangeReportRequest(reqMsg); + if (reqMsg->has_getlictokenreq() == true) + request = inflateGetLaunchTokenRequest(reqMsg); + if (reqMsg->has_invokeservicereq() == true) + request = inflateInvokeServiceRequest(reqMsg); + if (reqMsg->has_getpscapreq() == true) + request = inflateGetPsCapRequest(reqMsg); + if (reqMsg->has_reporterrreq() == true) + request = inflateReportAttestationErrorRequest(reqMsg); + delete reqMsg; + return request; +} + +//return false if inflate failed +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEInitQuoteResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_initquoteres() == false) + return false; + + //this is an AEInitQuoteResponse + aesm::message::Response::InitQuoteResponse proto_res = msg.initquoteres(); + + uint32_t gid_length = 0; + uint8_t* gid = NULL; + uint32_t target_info_length = 0; + uint8_t* target_info = NULL; + + if (proto_res.has_gid()) + { + if(proto_res.gid().size() > UINT_MAX) { + return NULL; + } + gid_length = (unsigned int)proto_res.gid().size(); + gid = (uint8_t*)const_cast(proto_res.gid().data()); + } + if (proto_res.has_targetinfo()) + { + if(proto_res.targetinfo().size() > UINT_MAX) { + return NULL; + } + + target_info_length = (unsigned int) proto_res.targetinfo().size(); + target_info = (uint8_t*)const_cast(proto_res.targetinfo().data()); + } + + response->inflateValues(proto_res.errorcode(), + gid_length, gid, + target_info_length, target_info); + + return true; +} + + +/* + * GetQuote + */ + + +AEMessage* ProtobufSerializer::serialize(AEGetQuoteRequest* request) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::GetQuoteRequest proto_req;//= new aesm::message::Response::InitQuoteResponse(); + + if (request->GetReport() != NULL) + { + std::string report((const char*)request->GetReport(), request->GetReportLength()); + proto_req.set_report(report); + } + + if (request->GetSigRL() != NULL) + { + std::string sig_rl((const char*)request->GetSigRL(), request->GetSigRLLength()); + proto_req.set_sig_rl(sig_rl); + } + + if (request->GetNonce() != NULL) + { + std::string nonce((const char*)request->GetNonce(), request->GetNonceLength()); + proto_req.set_nonce(nonce); + } + + if (request->GetSPID() != NULL) + { + std::string spid((const char*)request->GetSPID(), request->GetSPIDLength()); + proto_req.set_spid(spid); + } + + proto_req.set_quote_type(request->GetQuoteType()); + proto_req.set_buf_size(request->GetBufferSize()); + proto_req.set_qe_report(request->GetQEReport()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::GetQuoteRequest* mutableReq = msg.mutable_getquotereq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_getquotereq(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEGetQuoteResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::GetQuoteResponse proto_res;//= new aesm::message::Response::InitQuoteResponse(); + + proto_res.set_errorcode(response->GetErrorCode()); + + if (response->GetQuote() != NULL) + { + std::string quote((const char*)response->GetQuote(), response->GetQuoteLength()); + proto_res.set_quote(quote); + } + + + if (response->GetQEReport() != NULL) + { + std::string qe_report((const char*)response->GetQEReport(), response->GetQEReportLength()); + proto_res.set_qe_report(qe_report); + } + + if (proto_res.IsInitialized()) + { + aesm::message::Response::GetQuoteResponse* mutableRes = msg.mutable_getquoteres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_getquoteres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEGetQuoteResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_getquoteres() == false) + return false; + + //this is an AEInitQuoteResponse + aesm::message::Response::GetQuoteResponse proto_res = msg.getquoteres(); + + uint32_t qe_report_length = 0; + uint8_t* qe_report = NULL; + uint32_t quote_length = 0; + uint8_t* quote = NULL; + uint32_t errorCode = proto_res.errorcode(); + + if (proto_res.has_quote()) + { + if (proto_res.quote().size() > UINT_MAX) { + return false; + } + quote_length = (unsigned int) proto_res.quote().size(); + quote = (uint8_t*)const_cast(proto_res.quote().data()); + } + + if (proto_res.has_qe_report()) + { + if (proto_res.qe_report().size() > UINT_MAX) { + return false; + } + qe_report_length = (unsigned int) proto_res.qe_report().size(); + qe_report = (uint8_t*)const_cast(proto_res.qe_report().data()); + } + + + response->inflateValues(errorCode, + quote_length, + quote, + qe_report_length, + qe_report); + + return true; +} + +/******** + GET Launch Token + ********/ + +AEMessage* ProtobufSerializer::serialize(AEGetLaunchTokenRequest* request) +{ + if (request->check() == false) + return NULL; + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::GetLaunchTokenRequest proto_req; + + if (request->GetMeasurement() != NULL) + { + std::string mr_enclave((const char*)request->GetMeasurement(), request->GetMeasurementLength()); + proto_req.set_mr_enclave(mr_enclave); + } + + if (request->GetSigstruct() != NULL) + { + std::string mr_signer((const char*)request->GetSigstruct(), request->GetSigstructLength()); + proto_req.set_mr_signer(mr_signer); + } + + if (request->GetAttributes() != NULL) + { + std::string se_attributes((const char*)request->GetAttributes(), request->GetAttributesLength()); + proto_req.set_se_attributes(se_attributes); + } + + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::GetLaunchTokenRequest* mutableReq = msg.mutable_getlictokenreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_getlictokenreq(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, (const char*)data.data(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEGetLaunchTokenResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::GetLaunchTokenResponse proto_res; + + if (response->GetToken() != NULL) + { + std::string token((const char*)response->GetToken(), response->GetTokenLength()); + proto_res.set_token(token); + } + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::GetLaunchTokenResponse* mutableRes = msg.mutable_getlictokenres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_getlictokenres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEGetLaunchTokenResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_getlictokenres() == false) + return false; + + //this is an AEInitQuoteResponse + aesm::message::Response::GetLaunchTokenResponse proto_res = msg.getlictokenres(); + + uint32_t errorCode = proto_res.errorcode(); + uint32_t token_length = 0; + uint8_t* token = NULL; + + if (proto_res.has_token()) + { + if (proto_res.token().size() > UINT_MAX) { + return false; + } + token_length = (unsigned int)proto_res.token().size(); + token = (uint8_t*)const_cast(proto_res.token().data()); + } + + response->inflateValues(errorCode, + token_length, + token); + + return true; +} + +AEMessage* ProtobufSerializer::serialize(AECreateSessionRequest* request){ + + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::CreateSessionRequest proto_req; + + proto_req.set_dh_msg1_size(request->GetDHMsg1Size()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::CreateSessionRequest* mutableReq = msg.mutable_createsessionreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_createsessionreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AECreateSessionResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::CreateSessionResponse proto_res; + + if (response->GetDHMsg1() != NULL) + { + std::string se_dh_msg1((const char*)response->GetDHMsg1(), response->GetDHMsg1Length()); + proto_res.set_se_dh_msg1(se_dh_msg1); + } + + proto_res.set_errorcode(response->GetErrorCode()); + proto_res.set_session_id(response->GetSessionId()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::CreateSessionResponse* mutableRes = msg.mutable_createsessionres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_createsessionres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AECreateSessionResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_createsessionres() == false) + return false; + + aesm::message::Response::CreateSessionResponse proto_res = msg.createsessionres(); + + uint32_t errorCode = proto_res.errorcode(); + uint32_t session_id = proto_res.session_id(); + uint32_t dh_msg1_length = 0; + uint8_t* dh_msg1 = NULL; + + if (proto_res.has_se_dh_msg1()) + { + if (proto_res.se_dh_msg1().size() > UINT_MAX) { + return false; + } + dh_msg1_length = (unsigned int) proto_res.se_dh_msg1().size(); + dh_msg1 = (uint8_t*)const_cast(proto_res.se_dh_msg1().data()); + } + + response->inflateValues(errorCode, + session_id, + dh_msg1_length, + dh_msg1); + + return true; +} + +/* + * Invoke Service + */ + +AEMessage* ProtobufSerializer::serialize(AEInvokeServiceRequest* request) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::InvokeServiceRequest proto_req; + + if (request->GetPSEMessage() != NULL) + { + std::string pse_message((const char*)request->GetPSEMessage(), request->GetPSEMessageLength()); + proto_req.set_pse_message(pse_message); + } + + proto_req.set_pse_resp_size(request->GetResponseSize()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::InvokeServiceRequest* mutableReq = msg.mutable_invokeservicereq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_invokeservicereq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEInvokeServiceResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::InvokeServiceResponse proto_res; + + if (response->GetPSEMessage() != NULL) + { + std::string pse_message((const char*)response->GetPSEMessage(), response->GetPSEMessageLength()); + proto_res.set_pse_message(pse_message); + } + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::InvokeServiceResponse* mutableRes = msg.mutable_invokeserviceres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_invokeserviceres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEInvokeServiceResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_invokeserviceres() == false) + return false; + + aesm::message::Response::InvokeServiceResponse proto_res = msg.invokeserviceres(); + + uint32_t errorCode = proto_res.errorcode(); + uint32_t pse_message_length = 0; + uint8_t* pse_message = NULL; + + if (proto_res.has_pse_message()) + { + if (proto_res.pse_message().size() > UINT_MAX) { + return false; + } + pse_message_length = (unsigned int) proto_res.pse_message().size(); + pse_message = (uint8_t*)const_cast(proto_res.pse_message().data()); + } + + response->inflateValues(errorCode, + pse_message_length, + pse_message); + + return true; +} + +/* + * Exchange REPORT + */ + +AEMessage* ProtobufSerializer::serialize(AEExchangeReportRequest* request) +{ + AEMessage* ae_msg = NULL; + + std::string data; + + aesm::message::Request msg; + aesm::message::Request::ExchangeReportRequest proto_req; + + if (request->GetDHMsg2() != NULL) + { + std::string se_dh_msg2((const char*)request->GetDHMsg2(), request->GetDHMsg2Length()); + proto_req.set_se_dh_msg2(se_dh_msg2); + } + + proto_req.set_session_id(request->GetSessionId()); + proto_req.set_se_dh_msg3_size(request->GetDHMsg3Length()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::ExchangeReportRequest* mutableReq = msg.mutable_exchangereportreq(); + + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_exchangereportreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableReq; + + } + + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEExchangeReportResponse* response) +{ + std::string data; + AEMessage* ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::ExchangeReportResponse proto_res; + + if (response->GetDHMsg3() != NULL) + { + std::string se_dh_msg3((const char*)response->GetDHMsg3(), response->GetDHMsg3Length()); + proto_res.set_se_dh_msg3(se_dh_msg3); + } + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::ExchangeReportResponse* mutableRes = msg.mutable_exchangereportres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_exchangereportres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableRes; + } + + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEExchangeReportResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_exchangereportres() == false) + return false; + + aesm::message::Response::ExchangeReportResponse proto_res = msg.exchangereportres(); + + uint32_t errorCode = proto_res.errorcode(); + uint32_t dh_msg3_length = 0; + uint8_t* dh_msg3 = NULL; + + if (proto_res.has_se_dh_msg3()) + { + if (proto_res.se_dh_msg3().size() > UINT_MAX) { + return false; + } + dh_msg3_length = (unsigned int) proto_res.se_dh_msg3().size(); + dh_msg3 = (uint8_t*)const_cast(proto_res.se_dh_msg3().data()); + } + + + response->inflateValues(errorCode, + dh_msg3_length, + dh_msg3); + + return true; + +} + +/* + * CLOSE SESSION + */ + +AEMessage* ProtobufSerializer::serialize(AECloseSessionRequest* request) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::CloseSessionRequest proto_req; + + proto_req.set_session_id(request->GetSessionId()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::CloseSessionRequest* mutableReq = msg.mutable_closesessionreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_closesessionreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AECloseSessionResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::CloseSessionResponse proto_res; + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::CloseSessionResponse* mutableRes = msg.mutable_closesessionres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_closesessionres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AECloseSessionResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_closesessionres() == false) + return false; + + aesm::message::Response::CloseSessionResponse proto_res = msg.closesessionres(); + response->inflateValues(proto_res.errorcode()); + + return true; +} + + +AEMessage* ProtobufSerializer::serialize(AEGetPsCapRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::GetPsCapRequest proto_req; + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::GetPsCapRequest* mutableReq = msg.mutable_getpscapreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_getpscapreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEGetPsCapResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::GetPsCapResponse proto_res; + + proto_res.set_errorcode(response->GetErrorCode()); + proto_res.set_ps_cap(response->GetPsCap()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::GetPsCapResponse* mutableRes = msg.mutable_getpscapres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_getpscapres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), data.size()); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEGetPsCapResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_getpscapres() == false) + return false; + + aesm::message::Response::GetPsCapResponse proto_res = msg.getpscapres(); + uint32_t errorCode = proto_res.errorcode(); + uint64_t ps_cap = -1; + if (proto_res.has_ps_cap()) + { + ps_cap = proto_res.ps_cap(); + } + response->inflateValues(errorCode, + ps_cap); + + return true; +} + + +AEMessage* ProtobufSerializer::serialize(AEReportAttestationRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::ReportAttestationErrorRequest proto_req; + if (request->GetPlatformInfo() != NULL) + { + std::string platform_info((const char*)request->GetPlatformInfo(), request->GetPlatformInfoLength()); + proto_req.set_platform_info(platform_info); + } + proto_req.set_attestation_error_code(request->GetAttestationErrorCode()); + proto_req.set_update_info_size(request->GetUpdateInfoLength()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::ReportAttestationErrorRequest* mutableReq = msg.mutable_reporterrreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_reporterrreq(); //free the internal object + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEReportAttestationResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::ReportAttestationErrorResponse proto_res; + + if (response->GetUpdateInfo() != NULL) + { + std::string platform_update_info((const char*)response->GetUpdateInfo(), response->GetUpdateInfoLength()); + proto_res.set_platform_update_info(platform_update_info); + } + + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::ReportAttestationErrorResponse* mutableRes = msg.mutable_reporterrres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_reporterrres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), data.size()); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEReportAttestationResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_reporterrres() == false) + return false; + + aesm::message::Response::ReportAttestationErrorResponse proto_res = msg.reporterrres(); + uint32_t errorCode = proto_res.errorcode(); + uint32_t platform_update_info_length = 0; + uint8_t* platform_update_info = NULL; + + if (proto_res.has_platform_update_info()) + { + if (proto_res.platform_update_info().size() > UINT_MAX) { + return false; + } + platform_update_info_length = (unsigned int) proto_res.platform_update_info().size(); + platform_update_info = (uint8_t*)const_cast(proto_res.platform_update_info().data()); + } + response->inflateValues(errorCode, + platform_update_info_length, + platform_update_info); + + return true; +} diff --git a/psw/ae/common/src/SocketTransporter.cpp b/psw/ae/common/src/SocketTransporter.cpp new file mode 100644 index 0000000000..96c7f621a6 --- /dev/null +++ b/psw/ae/common/src/SocketTransporter.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include + +#include +#include +#include +#include + +#include +#include + +SocketTransporter::SocketTransporter(ISocketFactory* socketFactory, ISerializer* serializer) +:mSocketFactory(NULL), mSerializer(NULL) +{ + mSocketFactory = socketFactory; + mSerializer = serializer; +} + +SocketTransporter::~SocketTransporter() +{ + if (mSocketFactory != NULL) + { + delete mSocketFactory; + mSocketFactory = NULL; + } + if (mSerializer != NULL) + { + delete mSerializer; + mSerializer = NULL; + } +} + +AEMessage* SocketTransporter::receiveMessage(ICommunicationSocket* sock) { + AEMessage * message = new AEMessage; + char* msgSize = NULL; + msgSize = sock->readRaw(sizeof(AEMessage::size)); + if (msgSize != NULL) + { + memcpy((char*)&message->size, msgSize, sizeof(message->size)); + message->data = sock->readRaw(message->size); + delete [] msgSize; + } + return message; +} + +uae_oal_status_t SocketTransporter::sendMessage(AEMessage *message, ICommunicationSocket* sock) { + if ((sock->writeRaw((char*)&message->size, sizeof(message->size))) == -1) + return UAE_OAL_ERROR_UNEXPECTED; + if ((sock->writeRaw(message->data, message->size)) == -1) + return UAE_OAL_ERROR_UNEXPECTED; + return UAE_OAL_SUCCESS; +} + +uae_oal_status_t SocketTransporter::transact(IAERequest* request, IAEResponse* response) +{ + if (request == NULL || response == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + + ICommunicationSocket* communicationSocket = mSocketFactory->NewCommunicationSocket(); + + if (communicationSocket == NULL) + return UAE_OAL_ERROR_AESM_UNAVAILABLE; + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + + //set the timeout value + if (request->GetTimeout() > 0) + communicationSocket->setTimeout(request->GetTimeout()); + + AEMessage * reqMsg = request->serialize(mSerializer); + + if (reqMsg != NULL) + { + //send the request + ret = sendMessage(reqMsg, communicationSocket); + if (ret == UAE_OAL_SUCCESS) + { + + //read the response + AEMessage * resMsg = receiveMessage(communicationSocket); + + if (communicationSocket->wasTimeoutDetected() == false) + { + if (resMsg != NULL && resMsg->data != NULL) + response->inflateWithMessage(resMsg, mSerializer); + else + ret = UAE_OAL_ERROR_UNEXPECTED; + } + + delete resMsg; + } + } + + if (communicationSocket->wasTimeoutDetected() == true) + ret = UAE_OAL_ERROR_TIMEOUT; + + //free stuff + delete reqMsg; + delete communicationSocket; + + return ret; +} + +IAERequest* SocketTransporter::receiveRequest(ICommunicationSocket* sock) { + AEMessage * msg = receiveMessage(sock); + IAERequest* request = mSerializer->inflateRequest(msg); + delete msg; + return request; +} + +uae_oal_status_t SocketTransporter::sendResponse(IAEResponse* response, ICommunicationSocket* sock) { + AEMessage * message = response->serialize(mSerializer); + uae_oal_status_t retVal = sendMessage(message, sock); + delete message; + return retVal; +} diff --git a/psw/ae/common/src/UnixCommunicationSocket.cpp b/psw/ae/common/src/UnixCommunicationSocket.cpp new file mode 100644 index 0000000000..d261a8b0d6 --- /dev/null +++ b/psw/ae/common/src/UnixCommunicationSocket.cpp @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include + +UnixCommunicationSocket::UnixCommunicationSocket(const char* socketbase) +:mSocketBase(NULL), mWasTimeout(false), mTimeoutMseconds(0) +{ + //doing all this manually to ensure based memory allocation across the solution + size_t size = strlen(socketbase) + 1; + //ensure a fairly decend size for socketbase is not overflowed + if (size > 255) + return; //a socketbase of more than 255 chars may break the system on connect + + mSocketBase = new char[size]; + memset(mSocketBase, 0, size); + strncpy(mSocketBase, socketbase, size); + + mSocket = -1; + + memset(&mStartTime, 0, sizeof(struct timeval)); +} + +UnixCommunicationSocket::UnixCommunicationSocket(int socket) +:mSocketBase(NULL), mWasTimeout(false), mTimeoutMseconds(0) +{ + mSocket = socket; + + memset(&mStartTime, 0, sizeof(struct timeval)); +} + +UnixCommunicationSocket::~UnixCommunicationSocket() +{ + disconnect(); + if (mSocketBase != NULL) + { + delete [] mSocketBase; + mSocketBase = NULL; + } +} + +void UnixCommunicationSocket::disconnect() +{ + if (mSocket != -1){ + close(mSocket); + mSocket = -1; + } +} + +bool UnixCommunicationSocket::setTimeout(uint32_t timeout_milliseconds) +{ + struct timeval timeout; + + mTimeoutMseconds = timeout_milliseconds; + timeout.tv_sec = timeout_milliseconds / 1000; + + uint32_t millisecondsRemainder = timeout_milliseconds % 1000; + timeout.tv_usec = millisecondsRemainder * 1000; + + int rc = 0; + rc = setsockopt (mSocket, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)); + if (rc < 0) + return false; + + rc = setsockopt (mSocket, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout)); + if (rc < 0) + return false; + + return true; +} + +void UnixCommunicationSocket::MarkStartTime() +{ + gettimeofday(&mStartTime,NULL); +} + +bool UnixCommunicationSocket::CheckForTimeout() +{ + mWasTimeout = false; + + if (mTimeoutMseconds == 0) + return false; + + struct timeval now; + gettimeofday(&now, NULL); + + uint32_t sec = (uint32_t) (now.tv_sec - mStartTime.tv_sec); + int32_t usec = (int32_t) (now.tv_usec - mStartTime.tv_usec); + + uint32_t delta_msec = (uint32_t) (sec * 1000 + usec / 1000); + + if (delta_msec >= mTimeoutMseconds) + { + mWasTimeout = true; + return true; + } + + return false; +} + +ssize_t UnixCommunicationSocket::writeRaw(const char* data, ssize_t length) +{ + MarkStartTime(); + + if (length > MAX_MEMORY_ALLOCATION) + { + return -1; + } + + if (mSocket == -1) + return -1; + + ssize_t written = 0; + do { + ssize_t step = write(mSocket, data+written, length-written); + + if (step < 0 || CheckForTimeout()) + { + //this connection is probably closed + disconnect(); + break; + } + + written+=step; + } while (written < length); + + return written; +} + +char* UnixCommunicationSocket::readRaw(ssize_t length) +{ + if (mSocket == -1) + return NULL; + + MarkStartTime(); + + ssize_t total_read = 0; + char * recBuf = NULL; + recBuf = new char[length]; + memset(recBuf, 0, length); + + do { + ssize_t step = read(mSocket, recBuf + total_read, length - total_read); + + //check connection closed by peer + if (step <= 0 || CheckForTimeout()) + { + //this connection is probably closed + disconnect(); + delete[] recBuf; + recBuf = NULL; + break; + } + + total_read += step; + } while (total_read < length); + + return recBuf; +} + +//this will connect to the AESM by opening an Unix Socket +bool UnixCommunicationSocket::init() +{ + //init will always return directly with success if object was created with pre-existent socket + if (mSocket == -1) + { + struct sockaddr_un serv_addr; + + mSocket = socket(AF_UNIX, SOCK_STREAM, 0); + if(mSocket < 0) + { + return false; + } + + memset(&serv_addr, 0, sizeof(struct sockaddr_un)); + serv_addr.sun_family = AF_UNIX; + memset(serv_addr.sun_path, 0, sizeof(serv_addr.sun_path)); + // leave the first byte to 0 in order to have an abstract socket address + strncpy(serv_addr.sun_path + 1, mSocketBase, sizeof(serv_addr.sun_path) - 1); + + if( connect(mSocket, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) + { + return false; + } + if (mSocket < 0) + return false; + } + return true; +} + +int UnixCommunicationSocket::getSockDescriptor() { + return mSocket; +} diff --git a/psw/ae/common/src/UnixSocketFactory.cpp b/psw/ae/common/src/UnixSocketFactory.cpp new file mode 100644 index 0000000000..ac4eacf6ae --- /dev/null +++ b/psw/ae/common/src/UnixSocketFactory.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +#define MAX_SIZE 255 + +UnixSocketFactory::UnixSocketFactory(const char* socketbase) +:mSocketBase(NULL) +{ + //doing all this manually to ensure based memory allocation across the solution + ssize_t sizeInBytes = strnlen(socketbase, MAX_SIZE) + 1; + + //ensure a fairly decend size for socketbase is not overflowed + if (sizeInBytes > MAX_SIZE) + return; //a socketbase of more than 255 chars may break the system on connect + + mSocketBase = new char[sizeInBytes]; + strncpy(mSocketBase, socketbase, sizeInBytes); +} + +UnixSocketFactory::~UnixSocketFactory() +{ + if (mSocketBase != NULL) + delete [] mSocketBase; + mSocketBase = NULL; +} + +ICommunicationSocket* UnixSocketFactory::NewCommunicationSocket() +{ + UnixCommunicationSocket* sock = new UnixCommunicationSocket(mSocketBase); + bool initializationSuccessfull = false; + + if (sock != NULL) + initializationSuccessfull = sock->init(); + + if (initializationSuccessfull == false) + { + delete sock; + sock = NULL; + } + + return sock; +} diff --git a/psw/ae/data/constants/linux/ae_debug_flag.hh b/psw/ae/data/constants/linux/ae_debug_flag.hh new file mode 100644 index 0000000000..595f7e83af --- /dev/null +++ b/psw/ae/data/constants/linux/ae_debug_flag.hh @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AE_DEBUG_FLAG_HH_ +#define _AE_DEBUG_FLAG_HH_ + +#define LE_DEBUG_FLAG 0 +#define AE_DEBUG_FLAG 0 + +#endif + diff --git a/psw/ae/data/constants/linux/default_url_info.hh b/psw/ae/data/constants/linux/default_url_info.hh new file mode 100644 index 0000000000..08f6743370 --- /dev/null +++ b/psw/ae/data/constants/linux/default_url_info.hh @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _DEFAULT_URL_HH_ +#define _DEFAULT_URL_HH_ +#define DEFAULT_URL "http://ps.sgx.trustedservices.intel.com:8080/" /*production backend server*/ +#define DEFAULT_PSE_RL_URL "https://trustedservices.intel.com/content/CRL/" +#define DEFAULT_PSE_OCSP_URL "http://trustedservices.intel.com/ocsp" +#endif + diff --git a/psw/ae/data/constants/linux/isk_pub.hh b/psw/ae/data/constants/linux/isk_pub.hh new file mode 100644 index 0000000000..db45bcedea --- /dev/null +++ b/psw/ae/data/constants/linux/isk_pub.hh @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _ISK_PUB_HH_ +#define _ISK_PUB_HH_ +/* This is the x component of production public key used for EC-DSA verify for EPID Signing key. */ +const uint8_t g_sgx_isk_pubkey_x[] = { + 0x26, 0x9c, 0x10, 0x82, 0xe3, 0x5a, 0x78, 0x26, + 0xee, 0x2e, 0xcc, 0x0d, 0x29, 0x50, 0xc9, 0xa4, + 0x7a, 0x21, 0xdb, 0xcf, 0xa7, 0x6a, 0x95, 0x92, + 0xeb, 0x2f, 0xb9, 0x24, 0x89, 0x88, 0xbd, 0xce +}; + +/* This is the y component of production public key used for EC-DSA verify. Same as upper. */ +const uint8_t g_sgx_isk_pubkey_y[] = { + 0xb8, 0xe0, 0xf2, 0x41, 0xc3, 0xe5, 0x35, 0x52, + 0xbc, 0xef, 0x9c, 0x04, 0x02, 0x06, 0x48, 0xa5, + 0x76, 0x10, 0x1b, 0xa4, 0x28, 0xe4, 0x8e, 0xa9, + 0xcf, 0xba, 0x41, 0x75, 0xdf, 0x06, 0x50, 0x62 +}; +#endif + diff --git a/psw/ae/data/constants/linux/launch_enclave_mrsigner.hh b/psw/ae/data/constants/linux/launch_enclave_mrsigner.hh new file mode 100644 index 0000000000..a193713bd2 --- /dev/null +++ b/psw/ae/data/constants/linux/launch_enclave_mrsigner.hh @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _LANCH_ENCLAVE_MRSIGNER_HH_ +#define _LANCH_ENCLAVE_MRSIGNER_HH_ +const sgx_measurement_t g_le_mrsigner[] = +{ + { + { + /* SHA256 of SGXLaunchEnclave release signing key*/ + 0xac, 0xb7, 0x70, 0x12, 0x05, 0x3e, 0x05, 0xa6, + 0x3d, 0x41, 0x3b, 0x8b, 0xba, 0xe8, 0xfb, 0x6c, + 0x5d, 0x73, 0xb3, 0xf2, 0x99, 0x6d, 0x91, 0xc4, + 0x3b, 0xbb, 0xf9, 0x09, 0x59, 0xc0, 0xf8, 0xd4 + } + } +}; +#endif + diff --git a/psw/ae/data/constants/linux/peksk_pub.hh b/psw/ae/data/constants/linux/peksk_pub.hh new file mode 100644 index 0000000000..b7bde511e7 --- /dev/null +++ b/psw/ae/data/constants/linux/peksk_pub.hh @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _PEK_SK_PUB_HH_ +#define _PEK_SK_PUB_HH_ +const sgx_ec256_public_t g_pek_pub_key_little_endian = +{ + { + 0xd3, 0x43, 0x31, 0x3b, 0xf7, 0x3a, 0x1b, 0xa1, + 0xca, 0x47, 0xb2, 0xab, 0xb2, 0xa1, 0x43, 0x4d, + 0x1a, 0xcd, 0x4b, 0xf5, 0x94, 0x77, 0xeb, 0x44, + 0x5a, 0x06, 0x2d, 0x13, 0x4b, 0xe1, 0xc5, 0xa0 + }, + { + 0x33, 0xf8, 0x41, 0x6b, 0xb2, 0x39, 0x45, 0xcc, + 0x8d, 0xcd, 0x81, 0xb4, 0x80, 0xb4, 0xbd, 0x82, + 0x11, 0xf2, 0xdc, 0x9c, 0x0b, 0x4c, 0x8a, 0x28, + 0xb0, 0xaa, 0xca, 0x65, 0x14, 0xd2, 0xc8, 0x62 + } +}; +#endif + diff --git a/psw/ae/data/constants/linux/pibsk_pub.hh b/psw/ae/data/constants/linux/pibsk_pub.hh new file mode 100644 index 0000000000..b3efa94d2c --- /dev/null +++ b/psw/ae/data/constants/linux/pibsk_pub.hh @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PIBSK_PUB_HH_ +#define _PIBSK_PUB_HH_ +const uint8_t s_pib_pub_key_big_endian[] = +{ + 0xe0, 0x16, 0x28, 0x55, 0x98, 0x4e, 0xc7, 0xc5, + 0x01, 0xef, 0x1c, 0xa4, 0xd8, 0x1d, 0x7d, 0x5d, + 0xa6, 0x0f, 0x6e, 0x0e, 0x0d, 0xae, 0xf0, 0x8f, + 0xcd, 0x0c, 0xde, 0x50, 0x27, 0x4c, 0xe3, 0xb3, + 0x17, 0xda, 0x9a, 0x8a, 0x6d, 0x2c, 0x1d, 0xb5, + 0x3a, 0x01, 0x34, 0x99, 0xe4, 0xc8, 0x95, 0xb3, + 0x4d, 0xf3, 0xaf, 0x48, 0xf2, 0xfb, 0x3f, 0xbc, + 0x8b, 0x40, 0x46, 0xe4, 0x52, 0x2e, 0xab, 0xe6 +}; +#endif + diff --git a/psw/ae/data/constants/linux/pse_op_isv_svn_min.hh b/psw/ae/data/constants/linux/pse_op_isv_svn_min.hh new file mode 100644 index 0000000000..6abb70af73 --- /dev/null +++ b/psw/ae/data/constants/linux/pse_op_isv_svn_min.hh @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PSE_OP_ISV_SVN_MIN_HH_ +#define _PSE_OP_ISV_SVN_MIN_HH_ +/* hard-coded minimal isv svn of pse-op accepted. isv svn of production pse-op starts at 3*/ +const sgx_isv_svn_t PSE_ISV_SVN_MIN = 3; +#endif + diff --git a/psw/ae/data/constants/linux/pse_op_prod_id.hh b/psw/ae/data/constants/linux/pse_op_prod_id.hh new file mode 100644 index 0000000000..0110ea238b --- /dev/null +++ b/psw/ae/data/constants/linux/pse_op_prod_id.hh @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PSE_OP_PROD_ID_HH_ +#define _PSE_OP_PROD_ID_HH_ +/*this hard code depends on EncalveConfigure xml of PSE*/ +const sgx_prod_id_t PSE_PROD_ID = 0x2; +#endif + diff --git a/psw/ae/data/constants/linux/qsdk_pub.hh b/psw/ae/data/constants/linux/qsdk_pub.hh new file mode 100644 index 0000000000..35ad80e31b --- /dev/null +++ b/psw/ae/data/constants/linux/qsdk_pub.hh @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _QSDK_PUB_HH_ +#define _QSDK_PUB_HH_ +/* publicexponent = 010001*/ +unsigned int g_qsdk_pub_key_e[] = { + 0x00010001 +}; + +/* modulus = + c3195b35fe43f9e358b1f7ec6456bedc0db2af138f8b9c7d6ac711a5ee824fe8 + 7ac0bee3f829e489f9f79c83b947683805b64950d1eea5fb02ff89a67711e95e + 4f8058d9d24ae34db041c4245c9e3655c118c80ca69895b40ab6d5214bcfa63b + 742b4717c70f72d1415dea1a5844bb6d1635ea2043f4c1b26f6def568003bc37 + 7822bf095b3a7f7f24556dca8e3ed903fd22292ad56370d6f58354635764c298 + fac1c874eb8040c28e28ef14b52198090cedc16c6fe56b221023ee7dcfdd5c82 + 822d7fcdade9835c2fef3964bca24c9ee3672cec403189cadefc0e8f503fefef + 4c21e2c4d9809146f69d2d30219f7d17e93ce010202dacb9bd9505ced2a69adf +*/ +const uint32_t g_qsdk_pub_key_n[] = { + 0xd2a69adf, 0xbd9505ce, 0x202dacb9, 0xe93ce010, 0x219f7d17, + 0xf69d2d30, 0xd9809146, 0x4c21e2c4, 0x503fefef, 0xdefc0e8f, + 0x403189ca, 0xe3672cec, 0xbca24c9e, 0x2fef3964, 0xade9835c, + 0x822d7fcd, 0xcfdd5c82, 0x1023ee7d, 0x6fe56b22, 0x0cedc16c, + 0xb5219809, 0x8e28ef14, 0xeb8040c2, 0xfac1c874, 0x5764c298, + 0xf5835463, 0xd56370d6, 0xfd22292a, 0x8e3ed903, 0x24556dca, + 0x5b3a7f7f, 0x7822bf09, 0x8003bc37, 0x6f6def56, 0x43f4c1b2, + 0x1635ea20, 0x5844bb6d, 0x415dea1a, 0xc70f72d1, 0x742b4717, + 0x4bcfa63b, 0x0ab6d521, 0xa69895b4, 0xc118c80c, 0x5c9e3655, + 0xb041c424, 0xd24ae34d, 0x4f8058d9, 0x7711e95e, 0x02ff89a6, + 0xd1eea5fb, 0x05b64950, 0xb9476838, 0xf9f79c83, 0xf829e489, + 0x7ac0bee3, 0xee824fe8, 0x6ac711a5, 0x8f8b9c7d, 0x0db2af13, + 0x6456bedc, 0x58b1f7ec, 0xfe43f9e3, 0xc3195b35, +}; +#endif + diff --git a/psw/ae/data/constants/linux/service_enclave_mrsigner.hh b/psw/ae/data/constants/linux/service_enclave_mrsigner.hh new file mode 100644 index 0000000000..594b1ada25 --- /dev/null +++ b/psw/ae/data/constants/linux/service_enclave_mrsigner.hh @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SERVICE_ENCLAVE_MRSIGNER_HH_ +#define _SERVICE_ENCLAVE_MRSIGNER_HH_ +/* hard-coded mrsigner is SHA256 of CSS production signing key*/ +const sgx_measurement_t G_SERVICE_ENCLAVE_MRSIGNER[] = +{ + { + { + 0xec, 0x15, 0xb1, 0x07, 0x87, 0xd2, 0xf8, 0x46, + 0x67, 0xce, 0xb0, 0xb5, 0x98, 0xff, 0xc4, 0x4a, + 0x1f, 0x1c, 0xb8, 0x0f, 0x67, 0x0a, 0xae, 0x5d, + 0xf9, 0xe8, 0xfa, 0x9f, 0x63, 0x76, 0xe1, 0xf8 + } + } +}; +#endif + diff --git a/psw/ae/data/constants/linux/wl_pub.hh b/psw/ae/data/constants/linux/wl_pub.hh new file mode 100644 index 0000000000..6d7e662175 --- /dev/null +++ b/psw/ae/data/constants/linux/wl_pub.hh @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _WL_PUB_HH_ +#define _WL_PUB_HH_ +const sgx_ec256_public_t g_wl_root_pubkey = +{ + { + 0x29, 0x39, 0x1e, 0x9b, 0xcb, 0x86, 0xd6, 0xeb, + 0x3c, 0x17, 0x91, 0xc8, 0x8f, 0xc9, 0x5f, 0x8c, + 0xee, 0x0c, 0x1c, 0x75, 0x60, 0x9c, 0x16, 0xc2, + 0x18, 0x6d, 0x67, 0x31, 0x45, 0x5c, 0x36, 0xa9 + }, + { + 0x5f, 0x09, 0x83, 0x0d, 0xe1, 0x22, 0xda, 0xe4, + 0xed, 0x97, 0x54, 0xe6, 0xfe, 0xe2, 0xcc, 0x93, + 0x5e, 0x05, 0x99, 0x84, 0xc9, 0x4f, 0x44, 0x24, + 0x7a, 0x28, 0xcf, 0x81, 0xca, 0x11, 0x7e, 0xb6 + } +}; +#endif + diff --git a/psw/ae/data/prebuilt/le_prod_css.bin b/psw/ae/data/prebuilt/le_prod_css.bin new file mode 100644 index 0000000000000000000000000000000000000000..76e8543ec69e8991a7a3df4059c0bde392686bb4 GIT binary patch literal 1808 zcmcIjc{~&d8y<|Y#8NcbnH;&tk=xp)lo{6!6H$yzE$uo=Ovo@a%#d*nC6=_IoRL;) zO(Z!+jdd>O%uyIuG?i(ham=#q_uu#Z`8~hi^SrtA-?A?_pp`>mww)18*6E4{$`dYrK>CSb8;0|;`mF}!4O;EzhD|a> zIt>yPg-PFh;BCbU-)ep>UkLmw)UQh*)zE6Diw)@*ECRth(}rm7^-4)^HP}Q!uor?3g8T+>0kwMt8IMQ#i<7p zd=pDQ&se~`hZ(-Rtge)osh~2JrFdT*!9AP2I_zQ!&4u12=G!vD-^Bc35rwuVmu2oETTDxSwRFsyt%5eo5{ABPL5_RH4Mdk}xB%s_qt zhf*{!{M~61WpoZEB*7FP89|Y|UzB=ULT^|2L>tR`BD4Kemt>ONlXENT#u4R>`F4&3 z$F}qoCcXxkXM)pIBo_W?qBh8G!CKpYxmGMNXx+t=Pio102$uey!*yQLMFbcqHXiVd z<)*Pe#0xH@UQ*C9b$g&?fn7K;4qNeYdND?K&;towSHb>;_(ezS4tRZF_xx6Eg)fV5(CxJ4kk zgAVZaxrceJqDWK*Rh!*4Y-PVYq!lZ)bcy@@q6xS&c99-`T$kUE!R1dwYYREJh2iAA z{!`{K<;F!`!9kILbG5I{Fjo9va&>mG^%sA1G_b=!T0h^iu08|j#v~PQe&+}lcdvgo zK|H(7)|aw(_%c_fWbtV@=2AP=b^Z9j9sIWwgFMz)Y9ONEYS6euizV}3ZH-8y!L;p# z;Mm2vD9tonU{~l%$o{G@3~hdZeC{TmT-zSAVeauIpsPg<_B{)mZ#^$8(z+)cN zcPCepZTz=<>HTZ&{AmX}dpm%BEs~=&-4syc?OeFtB)7M}goj9t&djwLFsrNrM-DaO zE`PoH->Us@?*Fr4C}4GM`O1HPrzr7uAZo>sp&D78?ouspeBEcT!~;4A5l(4TtNpCv z{<%&i0x$uc5tq0f`~jc3dP9|#)Go>!b8fzT$mQ0&AGRi*ea@x^t|PZ}BFmhGO7}mspkMA409|41=@YEtfR!P<>nCW=);%{s zjx@uQRGSEq-O&nwd(%pb+H4IBY=X)b%P41+zk%&OqR`HV!Cz+#C&@e~*<8_RPgX_= zA}fE(G3%ix_7gUqfE7}^T9wWShcLj=zQAQrmCoAi=oKB*>?s+^;5s|?8sBrieoF92($i9vcm#Jj z)Why2f(>W()@K~K-y3VSVI+7HhiypiJsO@tX@AAi9QXYQM{dp~(RvKP^2fTY!avl) zBg#4X1xdH4Fsl_)S-#VAO^e{--HGBE_*k$}evz49YS2w5|FdoW8(*G;pitzjV#;T zYYk^ifpT*CFTAmNSw|a7J_37#2^pMf8=L!Lp zjbfIMikMBvTt`0eB?-bE==aOY>;^?)(Gpj$U(tuaIWLY-6xXIKj1!leO$(M!lWGnd y-Yi$2`Nr6x3XKtxoqfW1W2w&C()5S@W=JQdm#66GTC4i~Cz)Z-OoA`Eq5cLZ^(o{4 literal 0 HcmV?d00001 diff --git a/psw/ae/data/prebuilt/white_list_cert_to_be_verify.bin b/psw/ae/data/prebuilt/white_list_cert_to_be_verify.bin new file mode 100644 index 0000000000000000000000000000000000000000..d573b1f47f37bab8aa5f091552117006a855144d GIT binary patch literal 280 zcmV+z0q6bz0RR910001GhzNs{=RE|S_RiMw=9V!<;fcTl`#N-o3n0@fsHCAX&sbw> zW3Sdr`CMRk2Ag7xId!%T66IRcJ)43a(xG==z^ycH#I-;;#c^X6wWkZg8bJ@B~HK z1$~wT`0CT+BlCbt5&5k6f7NS~Qj?+dNB&qnds)0j{=)mh7Ccdpgram0nLkp{zM5md eIkQ!PUBaq({XBJB>>NJ+1X`=T4Q4hs14U5HCxiU} literal 0 HcmV?d00001 diff --git a/psw/ae/inc/aeerror.h b/psw/ae/inc/aeerror.h new file mode 100644 index 0000000000..929dcfddd5 --- /dev/null +++ b/psw/ae/inc/aeerror.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _AE_ERROR_H_ +#define _AE_ERROR_H_ + +typedef enum _ae_error_t{ + AE_SUCCESS = 0, + AE_FAILURE = 1, + AE_ENCLAVE_LOST = 2, + + OAL_PARAMETER_ERROR = 3, + OAL_PATHNAME_BUFFER_OVERFLOW_ERROR = 4, + OAL_FILE_ACCESS_ERROR = 5, + OAL_CONFIG_FILE_ERROR = 6, + OAL_NETWORK_UNAVAILABLE_ERROR = 7, + OAL_NETWORK_BUSY = 8, + OAL_NETWORK_RESEND_REQUIRED = 9, + OAL_PROXY_SETTING_ASSIST = 10, + OAL_THREAD_ERROR = 11, + OAL_THREAD_TIMEOUT_ERROR = 12, + + AE_PSVN_UNMATCHED_ERROR = 13, + AE_SERVER_NOT_AVAILABLE = 14, + AE_INVALID_PARAMETER = 15, + AE_READ_RAND_ERROR = 16, + AE_OUT_OF_MEMORY_ERROR = 17, + AE_INSUFFICIENT_DATA_IN_BUFFER = 18, + + /* QUOTING ENCLAVE ERROR CASES*/ + QE_UNEXPECTED_ERROR = 19, + QE_PARAMETER_ERROR = 20, + QE_EPIDBLOB_ERROR = 21, + QE_REVOKED_ERROR = 22, + QE_SIGRL_ERROR = 23, + + /* PROVISIONING ENCLAVE ERROR CASES*/ + PVE_UNEXPECTED_ERROR = 24, + PVE_PARAMETER_ERROR = 25, + PVE_EPIDBLOB_ERROR = 26, + PVE_INSUFFICIENT_MEMORY_ERROR = 27, + PVE_INTEGRITY_CHECK_ERROR = 28, + PVE_SIGRL_INTEGRITY_CHECK_ERROR = 29, + PVE_SERVER_REPORTED_ERROR = 30, + PVE_PEK_SIGN_ERROR = 31, + PVE_MSG_ERROR = 32, + PVE_REVOKED_ERROR = 33, + PVE_SESSION_OUT_OF_ORDER_ERROR = 34, + PVE_SERVER_BUSY_ERROR = 35, + PVE_PERFORMANCE_REKEY_NOT_SUPPORTED = 36, + + /* LICENSING ENCLAVE ERROR CASES*/ + LE_UNEXPECTED_ERROR = 37, + LE_INVALID_PARAMETER = 38, + LE_GET_LICENSE_KEY_ERROR = 39, + LE_INVALID_ATTRIBUTE = 40, + LE_INVALID_PRIVILEGE_ERROR = 41, + LE_WHITELIST_UNINITIALIZED_ERROR = 42, + LE_CALC_LIC_TOKEN_ERROR = 43, + + AESM_NLTP_NO_LTP_BLOB =178, + AESM_NLTP_DONT_NEED_UPDATE_PAIR_LTP =179, + AESM_NLTP_MAY_NEED_UPDATE_LTP =180, + AESM_NLTP_OLD_EPID11_RLS =181, + AESM_PCP_NEED_PSE_UPDATE =182, + AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_NEED_EPID_UPDATE =183, + AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_MIGHT_NEED_EPID_UPDATE =184, + AESM_PCP_SIMPLE_PSE_CERT_PROVISIONING_ERROR =185, + AESM_PCP_SIMPLE_EPID_PROVISION_ERROR =186, + AESM_NPC_DONT_NEED_PSEP =187, + AESM_NPC_NO_PSE_CERT =188, + AESM_NPC_DONT_NEED_UPDATE_PSEP =189, + AESM_NPC_MAY_NEED_UPDATE_PSEP =190, + AESM_NEP_DONT_NEED_EPID_PROVISIONING =191, + AESM_NEP_DONT_NEED_UPDATE_PVEQE =192, + AESM_NEP_PERFORMANCE_REKEY =193, + AESM_NEP_MAY_NEED_UPDATE =194, + AESM_CP_ATTESTATION_FAILURE =195, + AESM_LTP_PSE_CERT_REVOKED =196, + AESM_LTP_SIMPLE_LTP_ERROR =197, + AESM_PSE_PR_GET_PRIVRL_ERROR =198, + AESM_NETWORK_TIMEOUT =199, + + AE_SERVICE_NOT_AVAILABLE =200, + + PSW_UPDATED_REQUIRED =201 +} ae_error_t; + +#define AE_FAILED(x) (AE_SUCCESS != (x)) +#define AE_SUCCEEDED(x) (AE_SUCCESS == (x)) + +/* These definitions are usable to exit a loop*/ +#define BREAK_IF_TRUE(x, Sts, ErrCode) if (x) { Sts = ErrCode; break; } +#define BREAK_IF_FALSE(x, Sts, ErrCode) if (!(x)) { Sts = ErrCode; break; } +#define BREAK_IF_FAILED(x) if (AE_SUCCESS != (x)) { break; } +#define BREAK_IF_FAILED_ERR(x, ErrCode) if (AE_SUCCESS != (x)) { x = ErrCode; break; } + + +#endif/*_AE_ERROR_H_*/ + diff --git a/psw/ae/inc/byte_order.h b/psw/ae/inc/byte_order.h new file mode 100644 index 0000000000..65c798df40 --- /dev/null +++ b/psw/ae/inc/byte_order.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: byte_order.h + * Description: Header file to convert between host byte order and network byte order + * The file assume the code is running in little endian machine + */ + +#ifndef _BYTE_ORDER_H +#define _BYTE_ORDER_H + +/*macro to get the kth byte of 32 bits integer x + *k should be 0, 1, 2 or 3 + *k equal to 0 means to get the least significant byte + */ +#define GET_BYTE(x, k) (((const unsigned char *)&(x))[k]) + +#define _htonl(x) ((uint32_t)( \ + (((uint32_t)(x) & (uint32_t)0x000000ff) << 24) | \ + (((uint32_t)(x) & (uint32_t)0x0000ff00) << 8) | \ + (((uint32_t)(x) & (uint32_t)0x00ff0000) >> 8) | \ + (((uint32_t)(x) & (uint32_t)0xff000000) >> 24))) +#define _htons(x) ((uint16_t)( \ + (((uint16_t)(x) & (uint16_t)0xff00) >> 8) | \ + (((uint16_t)(x) & (uint16_t)0x00ff) << 8))) + +#define lv_htonl(x) ( \ + (((uint32_t)GET_BYTE(x,0))<<24)| \ + (((uint32_t)GET_BYTE(x,1))<<16)| \ + (((uint32_t)GET_BYTE(x,2))<<8)| \ + (((uint32_t)GET_BYTE(x,3))) ) +#define lv_htons(x) (\ + (uint16_t)((((uint16_t)GET_BYTE(x,0))<<8) | \ + (((uint16_t)GET_BYTE(x,1))) )) + +#define _ntohl(u32) _htonl(u32) +#define _ntohs(u16) _htons(u16) +#define lv_ntohl(u32) lv_htonl(u32) +#define lv_ntohs(u16) lv_htons(u16) + +#endif /*_BYTE_ORDER_H*/ + diff --git a/psw/ae/inc/internal/aesm_error.h b/psw/ae/inc/internal/aesm_error.h new file mode 100644 index 0000000000..02b87fe485 --- /dev/null +++ b/psw/ae/inc/internal/aesm_error.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _AESM_ERROR_H_ +#define _AESM_ERROR_H_ + +/*File to define aesm error code*/ + +typedef enum _aesm_error_t +{ + AESM_SUCCESS = 0, + AESM_UNEXPECTED_ERROR = 1, + AESM_NO_DEVICE_ERROR = 2, + AESM_PARAMETER_ERROR = 3, + AESM_EPIDBLOB_ERROR = 4, + AESM_EPID_REVOKED_ERROR = 5, + AESM_GET_LICENSETOKEN_ERROR = 6, + AESM_SESSION_INVALID = 7, + AESM_MAX_NUM_SESSION_REACHED = 8, + AESM_PSDA_UNAVAILABLE = 9, + AESM_EPH_SESSION_FAILED = 10, + AESM_LONG_TERM_PAIRING_FAILED = 11, + AESM_NETWORK_ERROR = 12, + AESM_NETWORK_BUSY_ERROR = 13, + AESM_PROXY_SETTING_ASSIST = 14, + AESM_FILE_ACCESS_ERROR = 15, + AESM_SGX_PROVISION_FAILED = 16, + AESM_SERVICE_STOPPED = 17, + AESM_BUSY = 18, + AESM_BACKEND_SERVER_BUSY = 19, + AESM_UPDATE_AVAILABLE = 20, + AESM_OUT_OF_MEMORY_ERROR = 21, + AESM_MSG_ERROR = 22, + AESM_THREAD_ERROR = 23, + AESM_SGX_DEVICE_NOT_AVAILABLE = 24, + AESM_ENABLE_SGX_DEVICE_FAILED = 25, + AESM_PLATFORM_INFO_BLOB_INVALID_SIG = 26, + AESM_SERVICE_NOT_AVAILABLE = 27, + AESM_KDF_MISMATCH = 28, + +} aesm_error_t; +#endif + diff --git a/psw/ae/inc/internal/cipher.h b/psw/ae/inc/internal/cipher.h new file mode 100644 index 0000000000..04efe63282 --- /dev/null +++ b/psw/ae/inc/internal/cipher.h @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: cipher.h + * Description: Header file to wrap cipher related function from IPP for Provision Enclave + * + * Wrap for ipp function like aes-cmac, aes-gcm, rsa-oaep, sha512. + */ + +#ifndef _CIPHER_H +#define _CIPHER_H + +#include "se_cdefs.h" +#include "ae_ipp.h" +#include "sgx_tseal.h" +#include "epid_types.h" +#include "se_types.h" +#include "sgx_key.h" +#include "provision_msg.h" +#include "se_sig_rl.h" + +/*Function to generate a random parameter f (0BE translation of DWORD +#define SwapEndian_DW(dw) ( (((dw) & 0x000000ff) << 24) | (((dw) & 0x0000ff00) << 8) | (((dw) & 0x00ff0000) >> 8) | (((dw) & 0xff000000) >> 24) ) +// LE<->BE translation of 8 byte big number +#define SwapEndian_8B(ptr) \ +{ \ + unsigned int Temp = 0; \ + unsigned int* p = reinterpret_cast(ptr); \ + Temp = SwapEndian_DW(p[0]); \ + p[0] = SwapEndian_DW(p[1]); \ + p[1] = Temp; \ +} \ +// LE<->BE translation of 10 byte (80 bit) big number +#define SwapEndian_10B(ptr) \ +{ \ + unsigned int Temp1 = 0; \ + unsigned int Temp2 = 0; \ + unsigned int* p = reinterpret_cast(ptr); \ + Temp1 = SwapEndian_DW( (unsigned int)( (((unsigned char*)(ptr))[8] << 16 ) | ( ((unsigned char*)(ptr))[9] << 24) ) ); \ + Temp2 = SwapEndian_DW(p[1]); \ + *(reinterpret_cast((unsigned char*)(ptr) + 6)) = SwapEndian_DW(p[0]); \ + *(reinterpret_cast((unsigned char*)(ptr) + 2)) = Temp2; \ + p[0] = (Temp1 & 0x0000ffff) | (p[0] & 0xffff0000); \ +} +// LE<->BE translation of 16 byte (128-bit) big number +#define SwapEndian_16B(ptr) \ +{ \ + unsigned int Temp = 0; \ + unsigned int* p = reinterpret_cast(ptr); \ + Temp = SwapEndian_DW(p[0]); \ + p[0] = SwapEndian_DW(p[3]); \ + p[3] = Temp; \ + Temp = SwapEndian_DW(p[1]); \ + p[1] = SwapEndian_DW(p[2]); \ + p[2] = Temp; \ +} +// LE<->BE translation of 32 byte big number +#define SwapEndian_32B(ptr) \ +{ \ + unsigned int Temp = 0; \ + unsigned int* p = reinterpret_cast(ptr); \ + Temp = SwapEndian_DW(p[0]); \ + p[0] = SwapEndian_DW(p[7]); \ + p[7] = Temp; \ + Temp = SwapEndian_DW(p[1]); \ + p[1] = SwapEndian_DW(p[6]); \ + p[6] = Temp; \ + Temp = SwapEndian_DW(p[2]); \ + p[2] = SwapEndian_DW(p[5]); \ + p[5] = Temp; \ + Temp = SwapEndian_DW(p[3]); \ + p[3] = SwapEndian_DW(p[4]); \ + p[4] = Temp; \ +} +// LE<->BE translation of 64 byte big number +#define SwapEndian_64B(ptr) \ +{ \ + unsigned int Temp = 0; \ + unsigned int* p = reinterpret_cast(ptr); \ + Temp = SwapEndian_DW(p[0]); \ + p[0] = SwapEndian_DW(p[15]); \ + p[15] = Temp; \ + Temp = SwapEndian_DW(p[1]); \ + p[1] = SwapEndian_DW(p[14]); \ + p[14] = Temp; \ + Temp = SwapEndian_DW(p[2]); \ + p[2] = SwapEndian_DW(p[13]); \ + p[13] = Temp; \ + Temp = SwapEndian_DW(p[3]); \ + p[3] = SwapEndian_DW(p[12]); \ + p[12] = Temp; \ + Temp = SwapEndian_DW(p[4]); \ + p[4] = SwapEndian_DW(p[11]); \ + p[11] = Temp; \ + Temp = SwapEndian_DW(p[5]); \ + p[5] = SwapEndian_DW(p[10]); \ + p[10] = Temp; \ + Temp = SwapEndian_DW(p[6]); \ + p[6] = SwapEndian_DW(p[9]); \ + p[9] = Temp; \ + Temp = SwapEndian_DW(p[7]); \ + p[7] = SwapEndian_DW(p[8]); \ + p[8] = Temp; \ +} +// LE<->BE translation of 75 byte (600 bit) big number +#define SwapEndian_75B(ptr) \ +{ \ + unsigned int Temp1 = 0; \ + unsigned int Temp2 = 0; \ + unsigned char i = 0; \ + unsigned int* p = reinterpret_cast(ptr); \ + Temp1 = SwapEndian_DW( (unsigned int)( ( ((unsigned char*)(ptr))[72] << 8 ) | ( ((unsigned char*)(ptr))[73] << 16 ) | ( ((unsigned char*)(ptr))[74] << 24 ) ) ); \ + Temp2 = (p[17] & 0xff000000); \ + *((unsigned int*)((unsigned char*)(ptr) + 71)) = SwapEndian_DW(p[0]); \ + p[0] = Temp1; \ + Temp1 = SwapEndian_DW(p[1]); \ + *((unsigned int*)((unsigned char*)(ptr) + 3 )) = SwapEndian_DW( ( (p[17] & 0x00ffffff) | Temp2 ) ); \ + for(i = 0; i < 8; i++) { \ + Temp2 = (p[16 - i] & 0xff000000); \ + *((unsigned int*)((unsigned char*)(ptr) + 67 - 4*i)) = Temp1; \ + Temp1 = SwapEndian_DW(p[2 + i]); \ + *((unsigned int*)((unsigned char*)(ptr) + 7 + 4*i)) = SwapEndian_DW( ( (p[16 - i] & 0x00ffffff) | Temp2 ) ); \ + } \ +} + +#if defined(DEFINE_GPOINTS_IN_LE2BE_MACROS) + +/* + * Some structures useful during the conversion of SafeId data + */ + +typedef struct _G1Point { + unsigned char x[32]; + unsigned char y[32]; +} G1Point; + +typedef struct _G2Point { + unsigned char x0[32]; + unsigned char x1[32]; + unsigned char x2[32]; + unsigned char y0[32]; + unsigned char y1[32]; + unsigned char y2[32]; +} G2Point; + +typedef G1Point G3Point; + +typedef struct _GTPoint { + unsigned char x0[32]; + unsigned char x1[32]; + unsigned char x2[32]; + unsigned char x3[32]; + unsigned char x4[32]; + unsigned char x5[32]; +} GTPoint; + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/psw/ae/inc/internal/pek_pub_key.h b/psw/ae/inc/internal/pek_pub_key.h new file mode 100644 index 0000000000..624fd5e869 --- /dev/null +++ b/psw/ae/inc/internal/pek_pub_key.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _PEK_SIGN_KEY_H_ +#define _PEK_SIGN_KEY_H_ +#include "se_types.h" +#include "sgx_error.h" +#include "epid_pve_type.h" + + +sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, uint8_t *result); +#endif + diff --git a/psw/ae/inc/internal/provision_msg.h b/psw/ae/inc/internal/provision_msg.h new file mode 100644 index 0000000000..33f466d3e8 --- /dev/null +++ b/psw/ae/inc/internal/provision_msg.h @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + /** + * File: provision_msg.h + * Description: Definition for data structure and provision protocol + * + * Definition for data structure and provision protocol + */ + +#ifndef _PVE_MSG_H_ +#define _PVE_MSG_H_ + +#include "epid_pve_type.h" +#include "sgx_tseal.h" + +//error code definition +typedef enum _pve_status_t +{ + PVEC_SUCCESS = 0, + PVEC_PARAMETER_ERROR, + PVEC_INSUFFICIENT_MEMORY_ERROR, + PVEC_READ_RAND_ERROR, + PVEC_SIGRL_INTEGRITY_CHECK_ERROR, + PVEC_MALLOC_ERROR, + PVEC_EPID_BLOB_ERROR, + PVEC_SE_ERROR, + PVEC_IPP_ERROR, + PVEC_MSG_ERROR, + PVEC_PEK_SIGN_ERROR, + PVEC_INTEGER_OVERFLOW_ERROR, + PVEC_SEAL_ERROR, + PVEC_EPID_ERROR, + PVEC_SESSION_OUT_OF_ORDER_ERROR, + PVEC_REVOKED_ERROR, + PVEC_UNSUPPORTED_VERSION_ERROR, + PVEC_INVALID_CPU_ISV_SVN, + PVEC_INVALID_EPID_KEY, + PVEC_UNEXPECTED_ERROR //unknown error which should never happen, it indicates there're internal logical error in PvE's code +}pve_status_t; + +//State inside PvE +typedef enum _prov_stage_t +{ + PVE_STAGE_IDLE, //waiting for ProvMsg1 + PVE_STAGE_WAIT_FOR_GET_EK2, //waiting for get ek2 after processing msg1 + PVE_STAGE_WAIT_FOR_MSG2_OR_MSG4, //waiting for ProvMsg2 or ProvMsg4 after getting ek2 + PVE_STAGE_WAIT_FOR_MSG4, //waiting for ProvMsg4 only +}prov_stage_t; + +#define PVE_RSAOAEP_ENCRYPT_MAXLEN (PVE_RSA_KEY_BYTES - 2*SHA_SIZE_BIT/8 - 2) //190 bytes at most + +//macro definition for RSA-OAE algorithm +//SHA-256 will be used for the hash generation + +#define SHA_SIZE_BIT 256 + +#define MSG1_FIELD1_MAX_PAYLOAD_SIZE (4+PPID_SIZE+FMSP_SIZE+PSVN_SIZE+4+FLAGS_SIZE) +#define HARD_CODED_EPID_BLOB_SIZE (sizeof(sgx_sealed_data_t)+sizeof(se_secret_epid_data_t)+sizeof(se_plaintext_epid_data_t)) +#define pointer_diff_u32(p1, p2) static_cast(p1-p2) +#pragma pack(1) +//output information from PvE for AESM to generated ProvMsg1 +typedef struct _prov_msg1_output_t{ + uint32_t field1_data_size; //size of field1_data, it will be no more than MSG1_FIELD1_MAX_PAYLOAD_SIZE + uint8_t xid[XID_SIZE]; //The random transaction id which will be generated inside Enclave + uint8_t field0[PVE_RSA_KEY_BYTES]; //field0 of Msg1 generated inside PvE encrypted by RSA-OAEP, that's SK TLV:PSID TLV + uint8_t field1_iv[IV_SIZE]; //The random IV used to encrypt field1 of Msg1 by aes-gcm + //field1 before encryption is DeviceIDTlV[:FlagTLV] + uint8_t field1_data[MSG1_FIELD1_MAX_PAYLOAD_SIZE];//The encrypted field1 of Msg1 by aes-gcm, the size in byte is indicated by field1_data + uint8_t field1_mac[MAC_SIZE]; //The generated mac value of field1 of Msg1 by aes-gcm +}prov_msg1_output_t; + +//input information to generate EK2 by PvE +typedef struct _prov_get_ek2_input_t{ + uint8_t xid[XID_SIZE]; //The transaction Id + uint8_t nonce[NONCE_SIZE]; //The nonce_r from ProvMsg2 or ProvMsg4 +}prov_get_ek2_input_t; + +//Ek2 generated by PvE +typedef struct _prov_get_ek2_output_t{ + uint8_t ek2[SK_SIZE]; +}prov_get_ek2_output_t; + +//input information for PvE to decode data from ProvMsg2 +typedef struct _proc_prov_msg2_blob_input_t{ + signed_epid_group_cert_t group_cert; //ECDSA signed EPID Group Public Certificate from Intel decoded from ProvMsg2 + uint8_t challenge_nonce[CHALLENGE_NONCE_SIZE]; //The challenge nonce from ProvMsg2 + psvn_t equivalent_psvn; //The Equivalent PSVN which contains ISVN and Equivalent CPUSVN + psvn_t previous_psvn; //an optional PSVN for Sigrl corresponding to previous EPID (if we upgrade TCB or performance rekey) + fmsp_t fmsp; //fmsp passing in ProvMsg2 from Provisioning Backend server + GroupID previous_gid; //optional previous_gid if previous_psvn is provided + uint8_t old_epid_data_blob[HARD_CODED_EPID_BLOB_SIZE]; //optional old epid data blob corresponding to previous EPID + uint8_t tcb_iv[IV_SIZE]; //The random IV to decode TIK + uint8_t encrypted_tcb[SK_SIZE]; //It's TIK1, the aesm-gcm encrypted TIK by aes-gcm + uint8_t tcb_mac[MAC_SIZE]; //The mac value to check the integrity of TIK1 + uint8_t is_previous_psvn_provided;//both previous_psvn and old_epid_data_blob should be provided if it is true and prev gid must be provided too +}proc_prov_msg2_blob_input_t; + +#define HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE (4+sizeof(join_proof_with_escrow_t)) +#define HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE (4+sizeof(membertship_credential_with_escrow_t)) + +//output information from PvE for AESM to generate ProvMsg3 +typedef struct _gen_prov_msg3_output_t{ + uint8_t field1_iv[IV_SIZE]; //The random generated IV for aes-gcm encryption of join proof and escrow data + uint8_t field1_data[HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE]; //The encrypted join proof and escrow data TLV by aes-gcm + uint8_t field1_mac[MAC_SIZE]; //The corresponding mac value of previous encrypted data + uint8_t epid_sig_iv[IV_SIZE]; //The random generated IV for aes-gcm encryption of EPIDSignature if available + uint8_t epid_sig_mac[MAC_SIZE];//The corresponding mac value for encrypted EPIDSignature if available + uint32_t epid_sig_output_size; //The size of EPIDSignature if available + uint8_t is_join_proof_generated; //boolean value to tell whether join proof and escrow data is generated. The first three fields in this structure will be invalid if this field is false + uint8_t is_epid_sig_generated; //boolean value to tell whether EpidSignature is generated + //If it is false, the epid_sig_iv/mac/output_size are all invalid +}gen_prov_msg3_output_t; + +//input information for PvE to decode data from ProvMsg4 and generate EPID Data Blob +typedef struct _proc_prov_msg4_input_t{ + uint8_t tcb_iv[IV_SIZE]; //The random IV to decode TIK + uint8_t encrypted_tcb[SK_SIZE]; //It's TIK1, the aes-gcm encrypted TIK by aes-gcm + uint8_t tcb_mac[MAC_SIZE]; //The mac value to check the integrity of TIK1 + uint8_t member_credential_iv[IV_SIZE]; //The random IV to decode member credential and escrow data TLV + uint8_t encrypted_member_credential[HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE]; //The encrypted member credential and escrow data TLV by aes-gcm + uint8_t member_credential_mac[MAC_SIZE]; //The mac value of previous field + psvn_t equivalent_psvn; //An equivalent PSVN including ISVN and equivalent CPUSVN + fmsp_t fmsp; //The fmsp from provisioning backend server + signed_epid_group_cert_t group_cert;//ECDSA signed EPID Group Public Certificate from Intel decoded from ProvMsg4 +}proc_prov_msg4_input_t; + +//The EPID Data Blob generated by PvE in processing ProvMsg4 data +typedef struct _proc_prov_msg4_output_t{ + uint8_t truested_epid_blob[HARD_CODED_EPID_BLOB_SIZE]; +}proc_prov_msg4_output_t; + +//output data of PvE to generate End Point Selection TLV +typedef struct _gen_endpoint_selection_output_t{ + uint8_t xid[XID_SIZE]; + uint8_t selector_id; +}gen_endpoint_selection_output_t; +#pragma pack() + +#define PSVN_START_IN_DEVICE_ID sizeof(ppid_t) +#define PPID_START_IN_DEVICE_ID 0 +#define FMSP_START_IN_DEVICE_ID (sizeof(ppid_t)+sizeof(psvn_t)) +#endif diff --git a/psw/ae/inc/internal/pse_inc.h b/psw/ae/inc/internal/pse_inc.h new file mode 100644 index 0000000000..26a4e8775a --- /dev/null +++ b/psw/ae/inc/internal/pse_inc.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef PSE_INC_H_ +#define PSE_INC_H_ + +#include "se_cdefs.h" +#include "ae_ipp.h" +#include "sgx_utils.h" +#include "sgx_trts.h" +#include "string.h" +#include "aeerror.h" + +#endif diff --git a/psw/ae/inc/internal/pse_types.h b/psw/ae/inc/internal/pse_types.h new file mode 100644 index 0000000000..4869da6adf --- /dev/null +++ b/psw/ae/inc/internal/pse_types.h @@ -0,0 +1,464 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _PSE_TYPES_H_ +#define _PSE_TYPES_H_ + +#include "sgx_ecp_types.h" +#include "sgx_report.h" + +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} + +#define EPH_SESSION_NONCE_SIZE 16 +#define EPH_MESSAGE_MAC_SIZE 16 +#define CSE_ID_SIZE 32 +#define EPH_SESSION_TSK_SIZE 16 +#define EPH_SESSION_TMK_SIZE 16 +#define SW_INSTANCE_ID_SIZE 16 + +#define DERIVE_MAC_KEY 0x0 +#define DERIVE_SEAL_KEY 0x1 + +#pragma pack(push, 1) + +typedef struct _pse_dh_msg1_t +{ + sgx_ec256_public_t dh_ga; /* the Endian-ness of Ga is Little-Endian*/ + sgx_target_info_t pse_info; +}pse_dh_msg1_t; + +typedef struct _cse_sec_prop_t +{ + uint32_t sec_info_type; /* MBZ */ + uint32_t gid_cse; /* from PSE-CSE pairing blob */ + uint32_t prvrl_version; /* from PSE-CSE pairing blob */ + uint32_t sigrl_version; /* from PSE-CSE pairing blob */ + uint8_t ca_id_cse[20]; /* from PSE-CSE pairing blob */ + uint8_t sec_info[92]; /* from PSE-CSE pairing blob */ +}cse_sec_prop_t; + +typedef struct _secu_info{ + uint32_t jom_task_id; /* must be the hardcoded value - 8 */ + uint32_t reserved; /* MBZ */ + uint32_t psda_id; /* must be hardcoded value - 1 */ + uint32_t psda_svn; /* from PSE-CSE pairing blob */ + uint8_t reserved2[76]; /* MBZ */ +}secu_info_t; + +typedef struct _pse_dh_msg3_t +{ + uint8_t cmac[EPH_MESSAGE_MAC_SIZE]; + sgx_report_t report; + uint32_t additional_prop_length; + cse_sec_prop_t cse_sec_prop; +}pse_dh_msg3_t; + +/***********************\ +**message handling data** +\***********************/ +#define PSE_TRUSTED_TIME_SERVICE 0 +#define PSE_MC_SERVICE 1 +/*monotonic counter*/ +#define PSE_MC_CREATE 0 +#define PSE_MC_READ 1 +#define PSE_MC_INC 2 +#define PSE_MC_DEL 3 +/*trusted time*/ +#define PSE_TIMER_READ 0 + + +/*VMC creation policy*/ +#define MC_POLICY_SIGNER 0x1 +#define MC_POLICY_ENCLAVE 0x2 + +#define PAYLOAD_IV_SIZE 12 +typedef struct _pse_msssage_t +{ + uint32_t session_id; + uint32_t exp_resp_size; /* 0: response message*/ + uint8_t payload_iv[PAYLOAD_IV_SIZE]; + uint32_t payload_size; + uint8_t payload_tag[SGX_AESGCM_MAC_SIZE]; /* 16: AES-GMAC of the Plain Text, Payload, and the sizes*/ + uint8_t payload[0]; /* encrypted payload*/ +}pse_message_t; + +typedef enum _pse_op_error_t +{ + OP_SUCCESS = 0, + OP_ERROR_INTERNAL, /* Internal errors */ + OP_ERROR_INVALID_PARAMETER, /* Invalid input parameter */ + OP_ERROR_MALLOC, /* malloc() fails */ + OP_ERROR_UNKNOWN_REQUEST, /* Unknown request sent to CSE */ + OP_ERROR_CAP_NOT_AVAILABLE, /* The required service is not available */ + OP_ERROR_MAX_NUM_SESSION_REACHED, /* All session slots are in use and + the least active session does not exceed predefined time */ + OP_ERROR_INVALID_SESSION, /* Create APP Enclave - PSE session failed + or the session indicated by SID is invalid */ + OP_ERROR_DATABASE_FULL, /* No empty vmc nodes left in VMC DB */ + OP_ERROR_DATABASE_OVER_QUOTA, /* The quota for the MRSIGNER is exceeded */ + OP_ERROR_INVALID_EPH_SESSION, /* Ephemeral session is not valid or sequence no overflows. + Need do repairing. */ + OP_ERROR_PSDA_SESSION_LOST, /* CSME session is lost during OCALL */ + OP_ERROR_PSDA_BUSY, /* CSME is busy */ + OP_ERROR_EPH_SESSION_ESTABLISHMENT_INTEGRITY_ERROR, /* Integrity error of ephemeral session message */ + OP_ERROR_SQLITE_INTERNAL, /* SQLite internal errors */ + OP_ERROR_COPY_PREBUILD_DB, /* Copy of prebuilt DB failed */ + OP_ERROR_BACKUP_CURRENT_DB, /* Copy of current DB failed */ + OP_ERROR_INVALID_HW_MC, /* CC_MC > WR_MC or WR_MC > CC_MC + 2 */ + OP_ERROR_INVALID_COUNTER, /* The VMC counter ID passed in is not valid */ + OP_ERROR_INVALID_OWNER, /* owner ID or isv_svn doesn't match */ + OP_ERROR_UNSEAL_PAIRING_BLOB, /* Unsealing LT pairing blob failed */ + OP_ERROR_INVALID_POLICY, /* Invalid owner policy */ + OP_ERROR_INVALID_PAIRING_BLOB, /* LT pairing blob is invalid */ + + /* Errors for internal use. Won't be returned to AESM*/ + OP_ERROR_INVALID_VMC_DB, /* Verification of VMC DB failed. Should re-initialize DB */ + OP_ERROR_DATABASE_FATAL, /* Fatal error returned when opening VMC DB, Should re-initialize DB */ + OP_ERROR_SQLITE_NOT_FOUND, /* Record not found. */ + OP_ERROR_CACHE_MISS, /* The related nodes of a leaf node are not cached */ +}pse_op_error_t; + +typedef enum _pse_service_resp_status_t +{ + PSE_SUCCESS = 0, + PSE_ERROR_UNKNOWN_REQ, + PSE_ERROR_CAP_NOT_AVAILABLE, + PSE_ERROR_INVALID_PARAM, + PSE_ERROR_BUSY, + PSE_ERROR_INTERNAL, + PSE_ERROR_INVALID_POLICY, + PSE_ERROR_QUOTA_EXCEEDED, + PSE_ERROR_MC_NOT_FOUND, + PSE_ERROR_MC_NO_ACCESS_RIGHT, + PSE_ERROR_MC_USED_UP, + PSE_ERROR_MC_OVER_QUOTA +} pse_service_resp_status_t; + +typedef struct _pse_req_hdr_t +{ + uint32_t seq_num; + uint16_t service_id; + uint16_t service_cmd; +}pse_req_hdr_t; + +typedef struct _pse_resp_hdr_t +{ + uint32_t seq_num; + uint16_t service_id; + uint16_t service_cmd; + pse_service_resp_status_t status; +}pse_resp_hdr_t; + +typedef struct _pse_mc_create_req_t +{ + pse_req_hdr_t req_hdr; + uint16_t policy; + uint8_t attr_mask[16]; +}pse_mc_create_req_t; + +typedef struct _pse_mc_create_resp_t +{ + pse_resp_hdr_t resp_hdr; + uint8_t counter_id[3]; + uint8_t nonce[13]; +}pse_mc_create_resp_t; + +typedef struct _pse_mc_read_req_t +{ + pse_req_hdr_t req_hdr; + uint8_t counter_id[3]; + uint8_t nonce[13]; +}pse_mc_read_req_t; + +typedef struct _pse_mc_inc_req_t +{ + pse_req_hdr_t req_hdr; + uint8_t counter_id[3]; + uint8_t nonce[13]; +}pse_mc_inc_req_t; + +typedef struct _pse_mc_del_req_t +{ + pse_req_hdr_t req_hdr; + uint8_t counter_id[3]; + uint8_t nonce[13]; +}pse_mc_del_req_t; + +typedef struct _pse_mc_read_resp_t +{ + pse_resp_hdr_t resp_hdr; + uint32_t counter_value; + uint16_t pse_svn; +}pse_mc_read_resp_t; + +typedef struct _pse_mc_inc_resp_t +{ + pse_resp_hdr_t resp_hdr; + uint32_t counter_value; + uint16_t pse_svn; +}pse_mc_inc_resp_t; + +typedef struct _pse_mc_del_resp_t +{ + pse_resp_hdr_t resp_hdr; +}pse_mc_del_resp_t; + +typedef struct _pse_timer_read_req_t +{ + pse_req_hdr_t req_hdr; +}pse_timer_read_req_t; + +typedef struct _pse_timer_read_resp_t +{ + pse_resp_hdr_t resp_hdr; + uint64_t timestamp; + uint8_t time_source_nonce[32]; +}pse_timer_read_resp_t; + +/*message length*/ +#define PSE_CREATE_MC_REQ_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_create_req_t)) +#define PSE_CREATE_MC_RESP_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_create_resp_t)) +#define PSE_READ_MC_REQ_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_read_req_t)) +#define PSE_READ_MC_RESP_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_read_resp_t)) +#define PSE_INC_MC_REQ_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_inc_req_t)) +#define PSE_INC_MC_RESP_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_inc_resp_t)) +#define PSE_DEL_MC_REQ_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_del_req_t)) +#define PSE_DEL_MC_RESP_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_mc_del_resp_t)) +#define PSE_TIMER_READ_REQ_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_timer_read_req_t)) +#define PSE_TIMER_READ_RESP_SIZE static_cast(sizeof(pse_message_t) + sizeof(pse_timer_read_resp_t)) + +/*********************************************\ +** Define macros for CSE session and messages** +\*********************************************/ +#define PSDA_API_VERSION 1 +#define BE_PSDA_API_VERSION 0x01000000 + +#define PSDA_COMMAND_INFO 0 +#define PSDA_COMMAND_EP 2 +#define PSDA_COMMAND_SERVICE 3 + +#define PSDA_MSG_TYPE_CAP_QUERY 0 +#define PSDA_MSG_TYPE_CAP_RESULT 1 +#define PSDA_MSG_TYPE_CERT_INFO_QUERY 2 +#define PSDA_MSG_TYPE_CERT_INFO_RESULT 3 +#define PSDA_MSG_TYPE_LT_M1 0 +#define PSDA_MSG_TYPE_LT_M2 1 +#define PSDA_MSG_TYPE_LT_M7 2 +#define PSDA_MSG_TYPE_LT_M8 3 +#define PSDA_MSG_TYPE_EP_M1 0 +#define PSDA_MSG_TYPE_EP_M2 1 +#define PSDA_MSG_TYPE_EP_M3 2 +#define PSDA_MSG_TYPE_EP_M4 3 +#define PSDA_MSG_TYPE_SERV_REQ 0 +#define PSDA_MSG_TYPE_SERV_RESP 1 +#define BE_PSDA_MSG_TYPE_SERV_REQ 0x00000000 +#define BE_PSDA_MSG_TYPE_SERV_RESP 0x01000000 + +typedef struct _psda_msg_hdr_t +{ + uint8_t pse_instance_id[SW_INSTANCE_ID_SIZE]; + uint32_t msg_type; + uint32_t msg_len; +}psda_msg_hdr_t; + +typedef struct _psda_info_query_msg_t +{ + psda_msg_hdr_t msg_hdr; +}psda_info_query_msg_t; + +typedef struct _psda_cap_result_msg_t +{ + psda_msg_hdr_t msg_hdr; + uint32_t cap_descriptor_version; + uint32_t cap_descriptor0; + uint32_t cap_descriptor1; +}psda_cap_result_msg_t; + +typedef struct _psda_cert_result_msg_t +{ + psda_msg_hdr_t msg_hdr; + uint8_t cert_info[24]; +}psda_cert_result_msg_t; + +/* messages used for pse-cse ephemeral session establishment */ +typedef struct _pse_cse_msg2_t +{ + uint8_t id_cse[CSE_ID_SIZE]; + uint8_t nonce_r_cse[EPH_SESSION_NONCE_SIZE]; +}pse_cse_msg2_t; + +typedef struct _pse_cse_msg3_t +{ + uint8_t id_pse[CSE_ID_SIZE]; + uint8_t id_cse[CSE_ID_SIZE]; + uint8_t nonce_r_cse[EPH_SESSION_NONCE_SIZE]; + uint8_t nonce_r_pse[EPH_SESSION_NONCE_SIZE]; + uint8_t mac[SGX_SHA256_HASH_SIZE]; +}pse_cse_msg3_t; + +typedef struct _pse_cse_msg4_t +{ + uint8_t id_cse[CSE_ID_SIZE]; + uint8_t nonce_r_pse[EPH_SESSION_NONCE_SIZE]; + uint8_t mac[SGX_SHA256_HASH_SIZE]; +}pse_cse_msg4_t; + +typedef struct _eph_session_m1_t +{ + psda_msg_hdr_t msg_hdr; +}eph_session_m1_t; + +typedef struct _eph_session_m2_t +{ + psda_msg_hdr_t msg_hdr; + pse_cse_msg2_t msg2; +}eph_session_m2_t; + +typedef struct _eph_session_m3_t +{ + psda_msg_hdr_t msg_hdr; + pse_cse_msg3_t msg3; +}eph_session_m3_t; + +typedef struct _eph_session_m4_t +{ + psda_msg_hdr_t msg_hdr; + pse_cse_msg4_t msg4; +}eph_session_m4_t; + +/*********************************\ +**PSDA service message definition** +\*********************************/ +#define PSDA_MC_READ 1 /* Read MC command*/ +#define PSDA_MC_INC 2 /* Incroment MC command*/ +#define PSDA_MESSAGE_IV_SIZE 16 /* IV size*/ +#define PSDA_MESSAGE_MAC_SIZE 32 /* MAC size*/ + + +#define SGX_RPDATA_SIZE 16 /* RPDATA size*/ + +typedef struct _service_message_t +{ + uint32_t version; + uint32_t session_id; + uint32_t msg_type_exp_resp_size; + uint32_t payload_size; + uint8_t payload_iv[PSDA_MESSAGE_IV_SIZE]; + uint8_t payload_mac[PSDA_MESSAGE_MAC_SIZE]; + uint8_t payload[0]; /*encrypted payload*/ +}service_message_t; + +typedef struct _psda_service_message_t +{ + psda_msg_hdr_t msg_hdr; + service_message_t service_message; +}psda_service_message_t; + +typedef struct _psda_req_hdr_t +{ + uint32_t seqnum; + uint16_t service_id; + uint16_t service_cmd; +}psda_req_hdr_t; + +typedef struct _psda_resp_hdr_t +{ + uint32_t seqnum; + uint16_t service_id; + uint16_t service_cmd; + uint32_t status; +}psda_resp_hdr_t; + +typedef struct _cse_mc_read_req_t +{ + psda_req_hdr_t req_hdr; + uint8_t counter_id; +}cse_mc_read_req_t; + +typedef struct _cse_mc_inc_req_t +{ + psda_req_hdr_t req_hdr; + uint8_t counter_id; + uint8_t increase_amount; +}cse_mc_inc_req_t; + +typedef struct _cse_mc_resp_t +{ + psda_resp_hdr_t resp_hdr; + uint32_t counter_value; + uint32_t mc_epoch; +}cse_mc_resp_t; + +typedef struct _cse_rpdata_read_req_t +{ + psda_req_hdr_t req_hdr; +}cse_rpdata_read_req_t; + +typedef struct _cse_rpdata_update_req_t +{ + psda_req_hdr_t req_hdr; + uint8_t rpdata_cur[SGX_RPDATA_SIZE]; + uint8_t rpdata_new[SGX_RPDATA_SIZE]; +}cse_rpdata_update_req_t; + +typedef struct _cse_rpdata_reset_req_t +{ + psda_req_hdr_t req_hdr; + uint8_t rpdata_cur[SGX_RPDATA_SIZE]; +}cse_rpdata_reset_req_t; + +typedef struct _cse_rpdata_resp_t +{ + psda_resp_hdr_t resp_hdr; + uint8_t rpdata[SGX_RPDATA_SIZE]; + uint32_t rp_epoch; +}cse_rpdata_resp_t; + +typedef struct _cse_timer_read_req_t +{ + psda_req_hdr_t req_hdr; +}cse_timer_read_req_t; + +typedef struct _cse_timer_read_resp_t +{ + psda_resp_hdr_t resp_hdr; + uint64_t timestamp; + uint32_t epoch; +}cse_timer_read_resp_t; + +/* Because PSDA requires buffer size to be a multiple of AES_BLOCK_SIZE, add an extra AES_BLOCK_SIZE here + * to make sure response message can be stored in the buffer*/ +#define AES_BLOCK_SIZE 16 + +#pragma pack(pop) +#endif + diff --git a/psw/ae/inc/internal/pve_qe_common.h b/psw/ae/inc/internal/pve_qe_common.h new file mode 100644 index 0000000000..96d5cb9084 --- /dev/null +++ b/psw/ae/inc/internal/pve_qe_common.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _PVE_QE_COMMON_H_ +#define _PVE_QE_COMMON_H_ + +#include "se_types.h" +#include "ae_ipp.h" +#include "sgx_tcrypto.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const uint8_t g_sgx_isk_pubkey_x[SGX_ECP256_KEY_SIZE]; + +extern const uint8_t g_sgx_isk_pubkey_y[SGX_ECP256_KEY_SIZE]; + +IppStatus new_std_256_ecp(IppsECCPState **pp_new_ecp); + +void secure_free_std_256_ecp(IppsECCPState *p_ecp); + + +int __STDCALL epid_random_func( + unsigned int *p_random_data, + int bits, + void* p_user_data); + + +#ifdef __cplusplus + } +#endif + +#if !defined(SWAP_ENDIAN_DW) +#define SWAP_ENDIAN_DW(dw) ((((dw) & 0x000000ff) << 24) \ + | (((dw) & 0x0000ff00) << 8) \ + | (((dw) & 0x00ff0000) >> 8) \ + | (((dw) & 0xff000000) >> 24)) +#endif + +#if !defined(SWAP_ENDIAN_32B) +#define SWAP_ENDIAN_32B(ptr) \ +{ \ + unsigned int temp = 0; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[0]); \ + ((unsigned int*)(ptr))[0] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[7]); \ + ((unsigned int*)(ptr))[7] = temp; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[1]); \ + ((unsigned int*)(ptr))[1] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[6]); \ + ((unsigned int*)(ptr))[6] = temp; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[2]); \ + ((unsigned int*)(ptr))[2] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[5]); \ + ((unsigned int*)(ptr))[5] = temp; \ + temp = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[3]); \ + ((unsigned int*)(ptr))[3] = SWAP_ENDIAN_DW(((unsigned int*)(ptr))[4]); \ + ((unsigned int*)(ptr))[4] = temp; \ +} +#endif + + +#endif + diff --git a/psw/ae/inc/internal/tlv_common.h b/psw/ae/inc/internal/tlv_common.h new file mode 100644 index 0000000000..ccf193de83 --- /dev/null +++ b/psw/ae/inc/internal/tlv_common.h @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: tlv_common.h + * Description: Header file to define TLV (the Type Length Value) related data or structure which may be commonly used by multiple components + */ + +#ifndef _PVE_TLV_COMMON_H +#define _PVE_TLV_COMMON_H +#include "se_cdefs.h" +#include "se_types.h" +#include "sgx_key.h" +#include "byte_order.h" + +/*enumerate all tlv types, the value of it is not defined in spec yet*/ +typedef enum _tlv_enum_type_t{ + TLV_CIPHER_TEXT=0, + TLV_BLOCK_CIPHER_TEXT, + TLV_BLOCK_CIPHER_INFO, + TLV_MESSAGE_AUTHENTICATION_CODE, + TLV_NONCE, + TLV_EPID_GID, + TLV_EPID_SIG_RL, + TLV_EPID_GROUP_CERT, + /*SE Provisioning Protocol TLVs*/ + TLV_DEVICE_ID, + TLV_PS_ID, + TLV_EPID_JOIN_PROOF, + TLV_EPID_SIG, + TLV_EPID_MEMBERSHIP_CREDENTIAL, + TLV_EPID_PSVN, + /*PSE Provisioning Protocol TLVs*/ + TLV_QUOTE, + TLV_X509_CERT_TLV, + TLV_X509_CSR_TLV, + /*End-point Selection Protocol TLVs*/ + TLV_ES_SELECTOR, + TLV_ES_INFORMATION, + /* EPID Provisioning Protocol TLVs Part 2*/ + TLV_FLAGS, + /* PSE Quote Signature*/ + TLV_QUOTE_SIG, + TLV_PLATFORM_INFO_BLOB, + /* Generic TLVs*/ + TLV_SIGNATURE, + /* End-point Selection Protocol TLVs*/ + TLV_PEK, +}tlv_enum_type_t; + +/*here comes general type and macro definition for AESM related Server URL which will be shared by code in other components*/ +typedef enum _aesm_network_server_enum_type_t{ + SE_EPID_PROVISIONING, + PSE_PROVISIONING, + ENDPOINT_SELECTION, + REVOCATION_LIST_RETRIEVAL, + PSE_OCSP +}aesm_network_server_enum_type_t; + +typedef enum _pve_msg_type_t +{ + TYPE_PROV_MSG1, + TYPE_PROV_MSG2, + TYPE_PROV_MSG3, + TYPE_PROV_MSG4 +}pve_msg_type_t; + +typedef enum _pse_msg_type_t +{ + TYPE_PSE_MSG1, + TYPE_PSE_MSG2, + TYPE_PSE_MSG3, + TYPE_PSE_MSG4 +}pse_msg_type_t; + +typedef enum _es_msg_type_t +{ + TYPE_ES_MSG1, + TYPE_ES_MSG2 +}es_msg_type_t; + +typedef enum _rlr_msg_type_t +{ + TYPE_RLR_MSG1, + TYPE_RLR_MSG2 +}rlr_msg_type_t; + +#include "epid_pve_type.h" + +typedef uint16_t general_response_status_t; +enum _general_response_status_t +{ + GRS_OK, + GRS_SERVER_BUSY, + GRS_INTEGRITY_CHECK_FAIL, + GRS_INCORRECT_SYNTAX, + GRS_INCOMPATIBLE_VERSION, + GRS_TRANSACTION_STATE_LOST, + GRS_PROTOCOL_ERROR, + GRS_INTERNAL_ERROR +}; + +typedef uint16_t se_protocol_response_status_t; + +enum _se_protocol_response_status_t +{ + SE_PRS_OK, + SE_PRS_PLATFORM_REVOKED, + SE_PRS_STATUS_INTEGRITY_FAILED, + SE_PRS_PERFORMANCE_REKEY_NOT_SUPPORTED +}; + +typedef uint16_t pse_protocol_response_status_t; +enum _pse_protocol_response_status_t +{ + PSE_PRS_OK, + PSE_PRS_INVALID_GID, + PSE_PRS_GID_REVOKED, + PSE_PRS_INVALID_QUOTE, + PSE_PRS_INVALID_REQUEST +}; + + +#pragma pack(1) +#define NET_S_OK 0 +typedef struct _provision_request_header_t{ + uint8_t protocol; + uint8_t version; + uint8_t xid[XID_SIZE]; /*transaction id, the unique id from ProvMsg1 to ProvMsg4*/ + uint8_t type; + uint8_t size[4]; /*size of request body*/ +}provision_request_header_t; + +typedef struct _provision_response_header_t{ + uint8_t protocol; + uint8_t version; + uint8_t xid[XID_SIZE]; + uint8_t type; + uint8_t gstatus[2]; + uint8_t pstatus[2]; + uint8_t size[4]; +}provision_response_header_t; + +#pragma pack() + +#define PROVISION_REQUEST_HEADER_SIZE sizeof(provision_request_header_t) +#define PROVISION_RESPONSE_HEADER_SIZE sizeof(provision_response_header_t) +#define GET_BODY_SIZE_FROM_PROVISION_REQUEST(req) lv_ntohl(((const provision_request_header_t *)(req))->size) +#define GET_BODY_SIZE_FROM_PROVISION_RESPONSE(resp) lv_ntohl(((const provision_response_header_t *)(resp))->size) +#define GET_SIZE_FROM_PROVISION_REQUEST(req) (GET_BODY_SIZE_FROM_PROVISION_REQUEST(req)+PROVISION_REQUEST_HEADER_SIZE) +#define GET_SIZE_FROM_PROVISION_RESPONSE(resp) (GET_BODY_SIZE_FROM_PROVISION_RESPONSE(resp)+PROVISION_RESPONSE_HEADER_SIZE) +#define GET_TYPE_FROM_PROVISION_REQUEST(req) (((const provision_request_header_t *)(req))->type) +#define GET_TYPE_FROM_PROVISION_RESPONSE(resp) (((const provision_response_header_t *)(resp))->type) + +#define TLV_VERSION_1 1 + +#endif + diff --git a/psw/ae/inc/internal/utility.h b/psw/ae/inc/internal/utility.h new file mode 100644 index 0000000000..b5ec769cab --- /dev/null +++ b/psw/ae/inc/internal/utility.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ECC_H +#define _ECC_H + +#include "pse_inc.h" +#include "pse_types.h" +#include "stdlib.h" +#include "aeerror.h" +#include "ae_ipp.h" + +#ifndef BREAK_ON_ERROR +#define BREAK_ON_ERROR(x) if(SGX_SUCCESS != x){break;} +#endif + +bool verify_hmac_sha256( + const uint8_t* mac_key, + uint32_t key_len, + const uint8_t* data_buf, + uint32_t buf_size, + const uint8_t* mac_buf); + +ae_error_t error_reinterpret(pse_op_error_t op_error); + +#endif \ No newline at end of file diff --git a/psw/ae/inc/se_sig_rl.h b/psw/ae/inc/se_sig_rl.h new file mode 100644 index 0000000000..f33250cba7 --- /dev/null +++ b/psw/ae/inc/se_sig_rl.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SE_SIG_RL_H_ +#define _SE_SIG_RL_H_ + +#include "se_types.h" +#include "epid_types.h" +#include "sgx_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define SE_EPID_SIG_RL_VERSION 0x200 +#define SE_EPID_SIG_RL_ID 0xE00 +/* This is the size of ECDSA signature appended at the end of SIG-RL, + in bytes. */ +#define SE_ECDSA_SIGN_SIZE 32 + +#pragma pack(push, 1) +typedef struct _se_sig_rl_t { + uint16_t protocol_version; /* Big-endian*/ + uint16_t epid_identifier; /* Big-endian, 14 for sig_rl.*/ + SigRL sig_rl; +}se_sig_rl_t; + +typedef struct _se_ae_ecdsa_hash_t { + uint32_t hash[8]; +}se_ae_ecdsa_hash_t; +#pragma pack(pop) + +uint64_t se_get_sig_rl_size(const se_sig_rl_t *p_sig_rl); + +#ifndef _SGX_UAE_SERVICE_H_ +sgx_status_t sgx_get_quote_size(const uint8_t *sig_rl, uint32_t* p_quote_size); +#endif + +#ifdef __cplusplus + } +#endif + + +#endif + diff --git a/psw/ae/le/Makefile b/psw/ae/le/Makefile new file mode 100644 index 0000000000..53a855dd88 --- /dev/null +++ b/psw/ae/le/Makefile @@ -0,0 +1,77 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR := ../../.. +include ../buildenv.mk + +AENAME = launch_enclave + +CFLAGS += -Werror +CXXFLAGS += -Werror + +INCLUDE += -I$(LINUX_PSW_DIR)/ae/common +INCLUDE += -I$(LINUX_PSW_DIR)/ae/data/constants/linux + +SRC := $(wildcard *.cpp) version.cpp +OBJ := $(SRC:.cpp=.o) +AENAME_OUT := $(SONAME) #generate $(SONAME) only but do not sign it +LE_COPY_OUT := ../../ae/data/prebuilt/libsgx_le.signed.so ../../ae/data/prebuilt/le_prod_css.bin + +CONFIG := config_linux.xml + +.PHONY: all +all: version $(AENAME_OUT) | $(BUILD_DIR) + @$(CP) $(LE_COPY_OUT) $| + +$(SONAME): $(AENAME)_t.c $(OBJ) + $(CXX) $(CXXFLAGS) -o $@ $(OBJ) -nostdlib -nodefaultlibs -nostartfiles $(LDTFLAGS) + +$(OBJ): %.o:%.cpp + $(CXX) $(CXXFLAGS) -fno-exceptions -fno-rtti $(INCLUDE) $(DEFINES) -c $< -o $@ + +$(AENAME)_t.c: $(EDLFILE) + @$(EDGER8R) --trusted $< + +version.o: $(LINUX_PSW_DIR)/ae/common/version.cpp + $(CXX) $(CXXFLAGS) -fno-exceptions -fno-rtti $(INCLUDE) $(DEFINES) -c $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + @$(RM) *.o + @$(RM) *.so + @$(RM) *.map + @$(RM) *_t.* + +.PHONY: rebuild +rebuild: clean all diff --git a/psw/ae/le/config_debug.xml b/psw/ae/le/config_debug.xml new file mode 100644 index 0000000000..7a66a6d111 --- /dev/null +++ b/psw/ae/le/config_debug.xml @@ -0,0 +1,12 @@ + + 1 + 0 + 1 + 0x20 + 1 + 1 + 1 + 0x2000 + 0xb000 + 0x1 + diff --git a/psw/ae/le/config_linux.xml b/psw/ae/le/config_linux.xml new file mode 100644 index 0000000000..e6c98d43e4 --- /dev/null +++ b/psw/ae/le/config_linux.xml @@ -0,0 +1,13 @@ + + 1 + 0 + 1 + 0x20 + 1 + 1 + 1 + 0x2000 + 0xb000 + 0x1 + 1 + diff --git a/psw/ae/le/launch_enclave.cpp b/psw/ae/le/launch_enclave.cpp new file mode 100644 index 0000000000..75a2cd59d5 --- /dev/null +++ b/psw/ae/le/launch_enclave.cpp @@ -0,0 +1,604 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "launch_enclave.h" +#include "byte_order.h" +#include "sgx_utils.h" + +#include "launch_enclave_t.c" +#include "wl_pub.hh" +#include "launch_enclave_mrsigner.hh" +#include "service_enclave_mrsigner.hh" + +#if !defined(SWAP_ENDIAN_DW) +#define SWAP_ENDIAN_DW(dw) ((((dw) & 0x000000ff) << 24) \ + | (((dw) & 0x0000ff00) << 8) \ + | (((dw) & 0x00ff0000) >> 8) \ + | (((dw) & 0xff000000) >> 24)) +#endif + +#if !defined(SWAP_ENDIAN_32B) +#define SWAP_ENDIAN_8X32B(ptr) \ +{ \ + uint32_t temp = 0; \ + temp = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[0]); \ + ((uint32_t*)(ptr))[0] = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[7]); \ + ((uint32_t*)(ptr))[7] = temp; \ + temp = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[1]); \ + ((uint32_t*)(ptr))[1] = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[6]); \ + ((uint32_t*)(ptr))[6] = temp; \ + temp = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[2]); \ + ((uint32_t*)(ptr))[2] = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[5]); \ + ((uint32_t*)(ptr))[5] = temp; \ + temp = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[3]); \ + ((uint32_t*)(ptr))[3] = SWAP_ENDIAN_DW(((uint32_t*)(ptr))[4]); \ + ((uint32_t*)(ptr))[4] = temp; \ +} +#endif + +#define LE_MAX_MRSIGNER_NUMBER 512 +// Macro used to get mac wl cert size, signature is not included +#define LE_MAX_WL_CERT_SIZE (sizeof(wl_cert_t) + LE_MAX_MRSIGNER_NUMBER \ + * sizeof(sgx_measurement_t)) + +#define WL_CERT_VERSION 0x0100 +#define WL_CERT_TYPE 0x0100 +#define WL_CERT_PROVIDER_ID 0 +#define WL_PROVIDER_CERT_VERSION 0x0100 +#define WL_PROVIDER_CERT_TYPE 0 +#define WL_PROVIDER_CERT_PROVIDER_ID 0 +#define WL_PROVIDER_CERT_ROOT_ID 0 + + +static uint8_t g_wl_cert_buf[LE_MAX_WL_CERT_SIZE] = {0}; + +static void reverse_byte_array(uint8_t *array, size_t size) +{ + size_t i = 0; + for(i = 0; i < size / 2; i++) + { + uint8_t temp = array[i]; + array[i] = array[size - i - 1]; + array[size - i - 1] = temp; + } +} + +//calculate launch token. key_id, attributes_le and then mac is updated. +//return AE_SUCCESS on success +static ae_error_t le_calc_lic_token(token_t* lictoken) +{ + //calculate launch token + + sgx_key_request_t key_request; + sgx_key_128bit_t launch_key; + + if(SGX_SUCCESS != sgx_read_rand((uint8_t*)&lictoken->key_id, + sizeof(sgx_key_id_t))) + { + return LE_UNEXPECTED_ERROR; + } + // Create Key Request + memset(&key_request, 0, sizeof(key_request)); + + //setup key_request parameters to derive launch key + key_request.key_name = SGX_KEYSELECT_LICENSE; + + memcpy(&key_request.key_id, &lictoken->key_id, + sizeof(key_request.key_id)); + + memcpy(&key_request.cpu_svn, &(lictoken->cpu_svn_le), + sizeof(key_request.cpu_svn)); + + memcpy(&key_request.isv_svn, &(lictoken->isv_svn_le), + sizeof(key_request.isv_svn)); + + + key_request.attribute_mask.xfrm = 0; + //0xFFFFFFFFFFFFFFFB: ~SGX_FLAGS_MODE64BIT + key_request.attribute_mask.flags = ~SGX_FLAGS_MODE64BIT; + key_request.misc_mask = 0xFFFFFFFF; + + lictoken->masked_misc_select_le &= key_request.misc_mask; + + + + lictoken->attributes_le.flags = (lictoken->attributes_le.flags) + & (key_request.attribute_mask.flags); + lictoken->attributes_le.xfrm = (lictoken->attributes_le.xfrm) + & (key_request.attribute_mask.xfrm); + + // EGETKEY + sgx_status_t sgx_ret = sgx_get_key(&key_request,&launch_key); + if(SGX_SUCCESS != sgx_ret) + { + return LE_GET_LICENSE_KEY_ERROR; + } + + sgx_cmac_state_handle_t p_cmac_handle = NULL; + do{ + sgx_ret = sgx_cmac128_init(&launch_key, &p_cmac_handle); + if(SGX_SUCCESS != sgx_ret) + { + break; + } + sgx_ret = sgx_cmac128_update((uint8_t*)&lictoken->body, + sizeof(lictoken->body), + p_cmac_handle); + if(SGX_SUCCESS != sgx_ret) + { + break; + } + sgx_ret = sgx_cmac128_final(p_cmac_handle, + (sgx_cmac_128bit_tag_t*)&lictoken->mac); + }while(0); + if (p_cmac_handle != NULL) + { + sgx_cmac128_close(p_cmac_handle); + } + + //clear launch_key after being used + memset_s(launch_key,sizeof(launch_key), 0, sizeof(launch_key)); + if (SGX_SUCCESS != sgx_ret) + { + return AE_FAILURE; + } + + return AE_SUCCESS; +} + + +ae_error_t le_generate_launch_token( + const sgx_measurement_t* mrenclave, + const sgx_measurement_t* mrsigner, + const sgx_attributes_t* se_attributes, + token_t* lictoken) +{ + uint32_t i = 0; + bool is_production = false; + sgx_status_t sgx_ret = SGX_ERROR_UNEXPECTED; + ae_error_t ae_ret = AE_FAILURE; + wl_cert_t *p_wl_cert_cache = (wl_cert_t *)g_wl_cert_buf; + sgx_measurement_t empty_mrsigner; + sgx_report_t report; + + // se_attributes must have no reserved bit set. + // urts(finally EINIT instruction)rejects EINIT Token with SGX_FLAGS_INITTED + // set. So LE doesn't need to check it here. + if((se_attributes->flags) & SGX_FLAGS_RESERVED) + { + return LE_INVALID_ATTRIBUTE; + } + + memset(&report, 0, sizeof(report)); + // Create report to get current cpu_svn and isv_svn. + sgx_ret = sgx_create_report(NULL, NULL, &report); + if(SGX_SUCCESS != sgx_ret) + { + return LE_UNEXPECTED_ERROR; + } + + for(i = 0; i < (sizeof(g_le_mrsigner) / sizeof(g_le_mrsigner[0])); i++) + { + if(0 == memcmp(&(g_le_mrsigner[i]), &(report.body.mr_signer), + sizeof(g_le_mrsigner[0]))) + { + is_production = true; + break; + } + } + + if(true == is_production) + { + // Only Provision Enclave is allowed to be EINITed with the privilege + // to access the PROVISIONKEY, which is signed with fixed signing key + if((se_attributes->flags & SGX_FLAGS_PROVISION_KEY)) + { + for(i = 0; i < (sizeof(G_SERVICE_ENCLAVE_MRSIGNER) / sizeof(G_SERVICE_ENCLAVE_MRSIGNER[0])); + i++) + { + if(0 == memcmp(&G_SERVICE_ENCLAVE_MRSIGNER[i], mrsigner, + sizeof(G_SERVICE_ENCLAVE_MRSIGNER[0]))) + { + break; + } + } + if(i == sizeof(G_SERVICE_ENCLAVE_MRSIGNER) / sizeof(G_SERVICE_ENCLAVE_MRSIGNER[0])) + { + return LE_INVALID_ATTRIBUTE; + } + } + } + + // on "production" system, enclaves to be launched in "non-enclave-debug" + // mode are subjected to Enclave Signing Key White Listing control. + if(((se_attributes->flags & SGX_FLAGS_DEBUG) == 0) + && (true == is_production)) + { + // Check whether the wl is initialized + if(p_wl_cert_cache->version == 0) + { + return LE_WHITELIST_UNINITIALIZED_ERROR; + } + + // Create an empty mrsigner + memset(&empty_mrsigner, 0, sizeof(empty_mrsigner)); + // Check if p_wl_cert_cache->mr_signer_list[0] is empty. + // If mr_signer_list[0] = 0, a "wild card" white list cert is in-use, + // meant to allow any enclave to launch. + if(0 != memcmp(&(p_wl_cert_cache->mr_signer_list[0]), &empty_mrsigner, + sizeof(p_wl_cert_cache->mr_signer_list[0]))) + { + for(i = 0; i < p_wl_cert_cache->entry_number; i++) + { + if(0 == memcmp(&(p_wl_cert_cache->mr_signer_list[i]), + mrsigner, + sizeof(p_wl_cert_cache->mr_signer_list[i]))) + { + break; + } + } + if(i == p_wl_cert_cache->entry_number) + { + return LE_INVALID_PRIVILEGE_ERROR; + } + } + } + + + //initial EINIT Token and set 0 for all reserved area + memset(lictoken, 0, sizeof(*lictoken)); + + //set the EINIT Token valid + lictoken->body.valid = 1; + + //set EINIT Token mrenclave + memcpy(&lictoken->body.mr_enclave, mrenclave, + sizeof(lictoken->body.mr_enclave)); + + //set EINIT Token mrsigner + memcpy(&lictoken->body.mr_signer, mrsigner, + sizeof(lictoken->body.mr_signer)); + + //set EINIT Token attributes + memcpy(&lictoken->body.attributes, se_attributes, + sizeof(lictoken->body.attributes)); + + //set EINIT Token with platform information from ereport of LE + memcpy(&lictoken->cpu_svn_le, &report.body.cpu_svn, sizeof(sgx_cpu_svn_t)); + lictoken->isv_svn_le = report.body.isv_svn; + lictoken->isv_prod_id_le = report.body.isv_prod_id; + + //will mask attributes in le_calc_lic_token + memcpy(&lictoken->attributes_le, &report.body.attributes, + sizeof(lictoken->attributes_le)); + + //will mask misc_select_le in le_calc_lic_token + lictoken->masked_misc_select_le = report.body.misc_select; + + //calculate EINIT Token + ae_ret = le_calc_lic_token(lictoken); + //if failure, clear EINIT Token + if (ae_ret != AE_SUCCESS) + { + memset_s(lictoken,sizeof(*lictoken), 0, sizeof(*lictoken)); + } + return ae_ret; + +} + + +int le_get_launch_token_wrapper( + const sgx_measurement_t* mrenclave, + const sgx_measurement_t* mrsigner, + const sgx_attributes_t* se_attributes, + token_t* lictoken) +{ + // Security assumption is that the edgr8r generated trusted bridge code + // makes sure mrenclave, mrsigner, se_attributes, lictoken buffers are all + // inside enclave. check all input and output pointers, defense in depth + if (NULL == mrenclave || + NULL == mrsigner || + NULL == se_attributes || + NULL == lictoken) + { + return LE_INVALID_PARAMETER; + } + + return le_generate_launch_token(mrenclave, mrsigner, se_attributes, + lictoken); +} + + +/* + * Internal function used to init white list. It will check the content of the + * cert chain, and verify the signature of input cert chains. If no problem, + * it will cache the input white list into EPC. + * + * @param p_wl_cert_chain[in] Pointer to the white list cert chain. + * @param entry_number[in] The entry number within the white list. + * @param wl_cert_chain_size[in] The size of white list cert chain, in bytes. + * @return uint32_t AE_SUCCESS for success, otherwise for errors. + */ +uint32_t le_init_white_list( + const wl_cert_chain_t *p_wl_cert_chain, + uint32_t entry_number, + uint32_t wl_cert_chain_size) +{ + sgx_status_t sgx_ret = SGX_SUCCESS; + uint32_t ret = AE_SUCCESS; + uint32_t new_wl_version = 0; + uint8_t verify_result = 0; + int valid = 0; + const uint8_t *buf = NULL; + uint32_t buf_size = 0; + sgx_prod_id_t wl_prod_id = 0; + sgx_ecc_state_handle_t ecc_handle = NULL; + wl_cert_t *p_wl_cert_cache = (wl_cert_t *)g_wl_cert_buf; + sgx_report_t report; + sgx_ec256_signature_t wl_signature; + sgx_ec256_public_t wl_pubkey; + + + // Check fields of provider cert + // Format version should be 1 (big endian) + if(p_wl_cert_chain->wl_provider_cert.version != WL_PROVIDER_CERT_VERSION) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + // For Enclave Signing Key White List Cert, must be 0 + if(p_wl_cert_chain->wl_provider_cert.cert_type != WL_PROVIDER_CERT_TYPE) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + // only one White List Provider is approved: + // WLProviderID: ISecG = 0 + if(p_wl_cert_chain->wl_provider_cert.provider_id != WL_PROVIDER_CERT_PROVIDER_ID) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + // only one WLRootID is valid: WLRootID-iKGF-Key-0 = 0 + if(p_wl_cert_chain->wl_provider_cert.root_id != WL_PROVIDER_CERT_ROOT_ID) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + + // Check fields of wl cert + // only valid version is 1 + if(p_wl_cert_chain->wl_cert.version != WL_CERT_VERSION) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + // For Enclave Signing Key White List Cert, must be 1 + if(p_wl_cert_chain->wl_cert.cert_type != WL_CERT_TYPE) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + // only one White List Provider is approved: + // WLProviderID: ISecG = 0 + if(p_wl_cert_chain->wl_cert.provider_id != WL_CERT_PROVIDER_ID) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + + // If cache exists + new_wl_version = p_wl_cert_chain->wl_cert.wl_version; + new_wl_version = _ntohl(new_wl_version); + if(p_wl_cert_cache->version != 0) + { + // the logic will be needed to support more than + // one providers in the future. + //if(p_wl_cert_chain->wl_cert.provider_id + // != p_wl_cert_cache->provider_id) + //{ + // ret = LE_INVALID_PARAMETER; + // goto CLEANUP; + //} + if(new_wl_version < p_wl_cert_cache->wl_version) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + } + + sgx_ret = sgx_ecc256_open_context(&ecc_handle); + if (SGX_SUCCESS != sgx_ret) + { + ret = LE_UNEXPECTED_ERROR; + goto CLEANUP; + } + + memset(&wl_signature, 0, sizeof(wl_signature)); + // Convert the signature of provider cert into little endian + memcpy(&wl_signature, + &(p_wl_cert_chain->wl_provider_cert.signature), + sizeof(wl_signature)); + SWAP_ENDIAN_8X32B(wl_signature.x); + SWAP_ENDIAN_8X32B(wl_signature.y); + + // Verify the wl provider cert + buf = (const uint8_t *)&(p_wl_cert_chain->wl_provider_cert); + buf_size = static_cast(sizeof(p_wl_cert_chain->wl_provider_cert) + - sizeof(p_wl_cert_chain->wl_provider_cert.signature)); + sgx_ret = sgx_ecdsa_verify(buf, buf_size, + &g_wl_root_pubkey, + &wl_signature, + &verify_result, + ecc_handle); + if (SGX_SUCCESS != sgx_ret) + { + ret = LE_UNEXPECTED_ERROR; + goto CLEANUP; + } + if(SGX_EC_VALID != verify_result) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + + // Convert the signature of wl cert into little endian + buf = (const uint8_t *)p_wl_cert_chain + wl_cert_chain_size + - sizeof(wl_signature); + memcpy(&wl_signature, buf, sizeof(wl_signature)); + SWAP_ENDIAN_8X32B(wl_signature.x); + SWAP_ENDIAN_8X32B(wl_signature.y); + + // Convert the pubkey into little endian + memset(&wl_pubkey, 0, sizeof(wl_pubkey)); + memcpy(&wl_pubkey, + &(p_wl_cert_chain->wl_provider_cert.pub_key), + sizeof(wl_pubkey)); + reverse_byte_array(wl_pubkey.gx, sizeof(wl_pubkey.gx)); + reverse_byte_array(wl_pubkey.gy, sizeof(wl_pubkey.gy)); + + // Check whether the pubkey is valid first. + sgx_ret = sgx_ecc256_check_point(&wl_pubkey, ecc_handle, &valid); + if(SGX_SUCCESS != sgx_ret) + { + ret = LE_UNEXPECTED_ERROR; + goto CLEANUP; + } + if(!valid) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + + // Verify the wl_cert + buf = (const uint8_t *)&(p_wl_cert_chain->wl_cert); + buf_size = wl_cert_chain_size - static_cast(sizeof(wl_provider_cert_t) + sizeof(sgx_ec256_signature_t)); + sgx_ret = sgx_ecdsa_verify(buf, buf_size, + &wl_pubkey, + &wl_signature, + &verify_result, + ecc_handle); + if (SGX_SUCCESS != sgx_ret) + { + ret = LE_UNEXPECTED_ERROR; + goto CLEANUP; + } + if(SGX_EC_VALID != verify_result) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + + memset(&report, 0, sizeof(report)); + // Create report to get current mrsigner. + sgx_ret = sgx_create_report(NULL, NULL, &report); + if(SGX_SUCCESS != sgx_ret) + { + ret = LE_UNEXPECTED_ERROR; + goto CLEANUP; + } + + // Convert the big endian prod id to little endian. + wl_prod_id = p_wl_cert_chain->wl_cert.le_prod_id; + wl_prod_id = _ntohs(wl_prod_id); + if(report.body.isv_prod_id != wl_prod_id) + { + ret = LE_INVALID_PARAMETER; + goto CLEANUP; + } + + // Cache the wl cert + memset(g_wl_cert_buf, 0, sizeof(g_wl_cert_buf)); + memcpy(g_wl_cert_buf, &(p_wl_cert_chain->wl_cert), buf_size); + // Change entry_number and wl_version to little endian, so we don't need to + // convert them next time. + p_wl_cert_cache->entry_number = entry_number; + p_wl_cert_cache->wl_version = new_wl_version; + +CLEANUP: + if(ecc_handle != NULL) + { + sgx_ecc256_close_context(ecc_handle); + } + return ret; + +} + +/* + * External function used to init white list. It will check whether the input + * buffer is correctly copied into EPC, and check the size of the buffer. + * + * @param wl_cert_chain[in] Pointer to the white list cert chain. + * @param wl_cert_chain_size[in] The size of white list cert chain, in bytes. + * @return uint32_t AE_SUCCESS for success, otherwise for errors. + */ +uint32_t le_init_white_list_wrapper( + const uint8_t *wl_cert_chain, + uint32_t wl_cert_chain_size) +{ + const wl_cert_chain_t *p_wl_cert_chain = NULL; + uint32_t entry_number = 0; + uint32_t temp_size = 0; + + if(wl_cert_chain == NULL) + { + return LE_INVALID_PARAMETER; + } + if(!sgx_is_within_enclave(wl_cert_chain, wl_cert_chain_size)) + return LE_INVALID_PARAMETER; + p_wl_cert_chain = (const wl_cert_chain_t *)wl_cert_chain; + // First compare wl_cert_chain_size with the minimal size of cert chain. + // It should have at least one entry of mrsigner. + if(wl_cert_chain_size < sizeof(wl_cert_chain_t) + + sizeof(sgx_measurement_t) + + sizeof(sgx_ec256_signature_t)) + { + return LE_INVALID_PARAMETER; + } + entry_number = p_wl_cert_chain->wl_cert.entry_number; + entry_number = _ntohl(entry_number); + // limits max MRSIGNER entry number in + // WL Cert to be <= 512 + if(entry_number > LE_MAX_MRSIGNER_NUMBER) + { + return LE_INVALID_PARAMETER; + } + temp_size = static_cast(sizeof(wl_cert_chain_t) + + sizeof(sgx_ec256_signature_t) + + (sizeof(sgx_measurement_t) * entry_number)); + if(wl_cert_chain_size != temp_size) + { + return LE_INVALID_PARAMETER; + } + return le_init_white_list(p_wl_cert_chain, entry_number, wl_cert_chain_size); +} + diff --git a/psw/ae/le/launch_enclave.edl b/psw/ae/le/launch_enclave.edl new file mode 100644 index 0000000000..1624b39bb6 --- /dev/null +++ b/psw/ae/le/launch_enclave.edl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +enclave { + + include "arch.h" + include "sgx_report.h" + + trusted { + public int le_get_launch_token_wrapper( + [in] const sgx_measurement_t *mrenclave, + [in] const sgx_measurement_t *mrsigner, + [in] const sgx_attributes_t *se_attributes, + [out] token_t * lictoken + ); + + public uint32_t le_init_white_list_wrapper( + [size = wl_cert_chain_size, in] const uint8_t *wl_cert_chain, + uint32_t wl_cert_chain_size + ); + + }; +}; diff --git a/psw/ae/le/launch_enclave.h b/psw/ae/le/launch_enclave.h new file mode 100644 index 0000000000..2118ebf486 --- /dev/null +++ b/psw/ae/le/launch_enclave.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "aeerror.h" +#include "arch.h" +#include "sgx_tcrypto.h" diff --git a/psw/ae/pve/provision_enclave.edl b/psw/ae/pve/provision_enclave.edl new file mode 100644 index 0000000000..356d68888a --- /dev/null +++ b/psw/ae/pve/provision_enclave.edl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave{ + include "provision_msg.h" + trusted { + public uint32_t gen_prov_msg1_data_wrapper([in]const psvn_t *psvn, + [in]const signed_pek_t *pek, + uint8_t performance_rekey_flag, + [out] prov_msg1_output_t *msg1_output); + + public uint32_t get_ek2_wrapper([in] const prov_get_ek2_input_t *input, + [out] prov_get_ek2_output_t *ek2); + + public uint32_t proc_prov_msg2_data_wrapper([in]const proc_prov_msg2_blob_input_t *msg2_input, + [user_check]const uint8_t *sigrl, uint32_t sigrl_size,//optional input sigrl in external memory + [out] gen_prov_msg3_output_t *msg3_fixed_output, + [user_check]uint8_t *epid_sig, uint32_t epid_sig_buffer_size);//optional output epid signature in external memory directly + + public uint32_t proc_prov_msg4_data_wrapper([in]const proc_prov_msg4_input_t* msg4_input, + [out]proc_prov_msg4_output_t* data_blob); + + public uint32_t gen_es_msg1_data_wrapper([out]gen_endpoint_selection_output_t *es_output); //output one byte selector + }; +}; diff --git a/psw/ae/qe/quoting_enclave.edl b/psw/ae/qe/quoting_enclave.edl new file mode 100644 index 0000000000..426736e6ba --- /dev/null +++ b/psw/ae/qe/quoting_enclave.edl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +enclave { +include "sgx_report.h" +include "sgx_quote.h" + trusted { + public uint32_t verify_blob([size = blob_size, in, out] uint8_t *p_blob, + uint32_t blob_size, + [out] uint8_t *p_is_resealed); + + public uint32_t get_quote([size = blob_size, in, out] uint8_t *p_blob, + uint32_t blob_size, + [in] const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + [in] const sgx_spid_t *p_spid, + [in] const sgx_quote_nonce_t *p_nonce, + [user_check] const uint8_t *p_sig_rl, // SigRL is relatively big, so we cannot copy it into EPC + uint32_t sig_rl_size, + [out] sgx_report_t *qe_report, + [user_check] uint8_t *p_quote, // Quote is also big, we should output it in piece meal. + uint32_t quote_size); + }; +}; diff --git a/psw/uae_service/config.h b/psw/uae_service/config.h new file mode 100644 index 0000000000..9c705c36c4 --- /dev/null +++ b/psw/uae_service/config.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + + +#ifdef _DEBUG +//wait for 10min at most for debug +#define IPC_LATENCY 600000 +#else +//long enough to do IPC and EPID Provisioning +#define IPC_LATENCY 15000 +#endif + +#define LE_RETRY_TIMES 3 +#define QE_RETRY_TIMES 3 +#define PSE_RETRY_TIMES 3 + +#endif diff --git a/psw/uae_service/linux/Makefile b/psw/uae_service/linux/Makefile new file mode 100644 index 0000000000..5771ae8ac9 --- /dev/null +++ b/psw/uae_service/linux/Makefile @@ -0,0 +1,153 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR = ../../.. +include $(TOP_DIR)/buildenv.mk + +IPC_COMMON_DIR := $(TOP_DIR)/psw/ae/common +IPC_COMMON_SRC_DIR := $(IPC_COMMON_DIR)/src +IPC_COMMON_INC_DIR := $(IPC_COMMON_DIR)/inc +IPC_COMMON_PROTO_DIR := $(IPC_COMMON_DIR)/proto +UAE_WRAPPER_DIR := ../uae_wrapper +UAE_SRC_DIR := $(UAE_WRAPPER_DIR)/src +UAE_INC_DIR := $(UAE_WRAPPER_DIR)/inc +AE_COMMON_DIR := $(LINUX_PSW_DIR)/ae/common + +INCLUDE += -I. +INCLUDE += -I$(COMMON_DIR) \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + +INCLUDE += -I$(LINUX_PSW_DIR)/ae/common \ + -I$(LINUX_PSW_DIR)/ae/inc \ + -I$(LINUX_PSW_DIR)/ae/inc/internal \ + -I$(LINUX_SDK_DIR)/tseal + +INCLUDE += -I$(LINUX_EXTERNAL_DIR)/epid/inc \ + -I$(IPC_COMMON_INC_DIR) \ + -I$(UAE_INC_DIR) \ + -I$(IPC_COMMON_PROTO_DIR) \ + -I$(LINUX_PSW_DIR)/ae/aesm_service/source + +CXXFLAGS += -fPIC -Werror +PROTPBUF_CXXFLAGS := -fstack-protector -fPIC -Wall -Werror +ifdef DEBUG + PROTPBUF_CXXFLAGS += -ggdb -DDEBUG -UNDEBUG +else + PROTPBUF_CXXFLAGS += -O2 -UDEBUG -DNDEBUG +endif +ifeq ($(ARCH), x86) + PROTPBUF_CXXFLAGS += -m32 +else + PROTPBUF_CXXFLAGS += -m64 +endif + +EXTERNAL_LIB += -lprotobuf + +vpath %.cpp .. $(COMMON_DIR)/src $(IPC_COMMON_SRC_DIR) $(IPC_COMMON_PROTO_DIR) $(UAE_SRC_DIR) $(COMMON_DIR)/src $(AE_COMMON_DIR) + + + +IPC_SRC := AECloseSessionRequest.cpp \ + AEGetQuoteResponse.cpp \ + AECloseSessionResponse.cpp \ + AEInitQuoteRequest.cpp \ + AECreateSessionRequest.cpp \ + AEInitQuoteResponse.cpp \ + AECreateSessionResponse.cpp \ + AEInvokeServiceRequest.cpp \ + AEExchangeReportRequest.cpp \ + AEInvokeServiceResponse.cpp \ + AEExchangeReportResponse.cpp \ + AEGetPsCapRequest.cpp \ + AEGetPsCapResponse.cpp \ + AEReportAttestationRequest.cpp \ + AEReportAttestationResponse.cpp \ + ProtobufSerializer.cpp \ + AEGetLaunchTokenRequest.cpp \ + SocketTransporter.cpp \ + AEGetLaunchTokenResponse.cpp \ + UnixCommunicationSocket.cpp \ + AEGetQuoteRequest.cpp \ + UnixSocketFactory.cpp \ + NonBlockingUnixCommunicationSocket.cpp \ + NonBlockingUnixSocketFactory.cpp + +PROTOBUF_SRC := messages.pb.cc + + +SRC := AEInternalServicesProvider.cpp \ + AEServicesImpl.cpp \ + AEServicesProvider.cpp \ + tae_ocall_api.cpp \ + uae_api.cpp \ + se_sig_rl.cpp \ + sgx_uae_service.cpp \ + uae_service_version.cpp \ + uae_service_assert.cpp + +OBJ := $(SRC:.cpp=.o) $(IPC_SRC:.cpp=.o) $(PROTOBUF_SRC:.cc=.o) + +LDUFLAGS:= -pthread -L$(BUILD_DIR) + +DLLNAME = libsgx_uae_service.so + + +.PHONY: all +all: install_dll + + +.PHONY: install_dll +install_dll: $(DLLNAME)| $(BUILD_DIR) + @$(CP) $^ $| + +$(DLLNAME): $(OBJ) + $(CXX) $(CXXFLAGS) $(OBJ) -shared $(LDUFLAGS) $(EXTERNAL_LIB) -o $@ + +%.o :%.cpp PROTPBUF + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: PROTPBUF +PROTPBUF: + $(MAKE) -C $(IPC_COMMON_PROTO_DIR) + (test -f messages.pb.o) || ($(CXX) $(PROTPBUF_CXXFLAGS) -c $(IPC_COMMON_PROTO_DIR)/messages.pb.cc -o messages.pb.o) + +.PHONY: clean +clean: + $(MAKE) -C $(IPC_COMMON_PROTO_DIR) clean + @$(RM) $(OBJ) + @$(RM) $(DLLNAME) $(BUILD_DIR)/$(DLLNAME) + +.PHONY: rebuild +rebuild: clean all diff --git a/psw/uae_service/sgx_uae_service.cpp b/psw/uae_service/sgx_uae_service.cpp new file mode 100644 index 0000000000..89b5304433 --- /dev/null +++ b/psw/uae_service/sgx_uae_service.cpp @@ -0,0 +1,516 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include "sgx_uae_service.h" +#include "uae_service_internal.h" +#include /*needed to unify default timeout values */ + +#include "stdint.h" +#include "se_sig_rl.h" + +#if !defined(ntohl) +#define ntohl(u32) \ + ((uint32_t)(((((const unsigned char*)&(u32))[0]) << 24) \ + + ((((const unsigned char*)&(u32))[1]) << 16) \ + + ((((const unsigned char*)&(u32))[2]) << 8) \ + + (((const unsigned char*)&(u32))[3]))) +#endif + + +#define GET_LAUNCH_TOKEN_TIMEOUT_MSEC (IPC_LATENCY) +#define SE_INIT_QUOTE_TIMEOUT_MSEC (IPC_LATENCY) +//add 3 millisecond per sig_rl entry +#define SE_GET_QUOTE_TIMEOUT_MSEC(p_sig_rl) (IPC_LATENCY + ((p_sig_rl) ? 3*ntohl(((const se_sig_rl_t*)p_sig_rl)->sig_rl.n2) : 0)) +#define SE_GET_PS_CAP_TIMEOUT_MSEC (IPC_LATENCY) +#define SE_REPORT_REMOTE_ATTESTATION_FAILURE_TIMEOUT_MSEC (IPC_LATENCY) + +extern "C" { + +sgx_status_t get_launch_token( + const enclave_css_t* signature, + const sgx_attributes_t* attribute, + sgx_launch_token_t* launch_token) +{ + if (signature == NULL || attribute == NULL || launch_token == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t status = oal_get_launch_token(signature, attribute, launch_token, GET_LAUNCH_TOKEN_TIMEOUT_MSEC*1000, &result); + + /*common mappings */ + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_NO_DEVICE_ERROR: + mapped = SGX_ERROR_NO_DEVICE; + break; + case AESM_GET_LICENSETOKEN_ERROR: + mapped = SGX_ERROR_SERVICE_INVALID_PRIVILEGE; + break; + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + +sgx_status_t sgx_init_quote( + sgx_target_info_t *p_target_info, + sgx_epid_group_id_t *p_gid) +{ + if (p_target_info == NULL || p_gid == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + + uae_oal_status_t status = oal_init_quote(p_target_info, p_gid, SE_INIT_QUOTE_TIMEOUT_MSEC*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_EPIDBLOB_ERROR: + mapped = SGX_ERROR_AE_INVALID_EPIDBLOB; + break; + case AESM_EPID_REVOKED_ERROR: + mapped = SGX_ERROR_EPID_MEMBER_REVOKED; + break; + case AESM_BACKEND_SERVER_BUSY: + mapped = SGX_ERROR_BUSY; + break; + case AESM_SGX_PROVISION_FAILED: + mapped = SGX_ERROR_UNEXPECTED; + break; + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + + +sgx_status_t sgx_get_quote( + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sig_rl, + uint32_t sig_rl_size, + sgx_report_t *p_qe_report, + sgx_quote_t *p_quote, + uint32_t quote_size) +{ + + if (p_report == NULL || p_spid == NULL || p_quote == NULL || quote_size == 0 ) + return SGX_ERROR_INVALID_PARAMETER; + if ((p_sig_rl == NULL && sig_rl_size != 0) || + (p_sig_rl != NULL && sig_rl_size == 0) ) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + + uae_oal_status_t status = oal_get_quote(p_report, quote_type, p_spid, p_nonce, p_sig_rl, sig_rl_size, p_qe_report, + p_quote, quote_size, SE_GET_QUOTE_TIMEOUT_MSEC(p_sig_rl)*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_EPIDBLOB_ERROR: + mapped = SGX_ERROR_AE_INVALID_EPIDBLOB; + break; + case AESM_EPID_REVOKED_ERROR: + mapped = SGX_ERROR_EPID_MEMBER_REVOKED; + break; + case AESM_BACKEND_SERVER_BUSY: + mapped = SGX_ERROR_BUSY; + break; + case AESM_SGX_PROVISION_FAILED: + mapped = SGX_ERROR_UNEXPECTED; + break; + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; + +} + +sgx_status_t sgx_get_ps_cap(sgx_ps_cap_t* p_sgx_ps_cap) +{ + if (p_sgx_ps_cap == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uint64_t ps_cap = 0; + + uae_oal_status_t status = oal_get_ps_cap(&ps_cap, SE_GET_PS_CAP_TIMEOUT_MSEC*1000, &result); + p_sgx_ps_cap->ps_cap0 = (uint32_t)ps_cap; + p_sgx_ps_cap->ps_cap1 = (uint32_t)(ps_cap >> 32); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_LONG_TERM_PAIRING_FAILED: + case AESM_EPH_SESSION_FAILED: + case AESM_PSDA_UNAVAILABLE: + mapped = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; + +} + +sgx_status_t sgx_report_attestation_status( + const sgx_platform_info_t* p_platform_info, + int attestation_status, + sgx_update_info_bit_t* p_update_info) +{ + if (p_platform_info == NULL || p_update_info == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + + uae_oal_status_t status = oal_report_attestation_status(p_platform_info, attestation_status, p_update_info, SE_REPORT_REMOTE_ATTESTATION_FAILURE_TIMEOUT_MSEC*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_BACKEND_SERVER_BUSY: + mapped = SGX_ERROR_BUSY; + break; + case AESM_PLATFORM_INFO_BLOB_INVALID_SIG: + mapped = SGX_ERROR_INVALID_PARAMETER; + break; + case AESM_SGX_PROVISION_FAILED: + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + +sgx_status_t create_session_ocall( + uint32_t *session_id, + uint8_t *se_dh_msg1, + uint32_t dh_msg1_size, + uint32_t timeout) +{ + + if(!session_id || !se_dh_msg1) + return SGX_ERROR_INVALID_PARAMETER; + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t status = oal_create_session(session_id, se_dh_msg1, dh_msg1_size, timeout*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_MAX_NUM_SESSION_REACHED: + mapped = SGX_ERROR_BUSY; + break; + case AESM_EPH_SESSION_FAILED: + case AESM_LONG_TERM_PAIRING_FAILED: + case AESM_PSDA_UNAVAILABLE: + case AESM_SERVICE_NOT_AVAILABLE: + mapped = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + case AESM_MSG_ERROR: + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + +sgx_status_t exchange_report_ocall( + uint32_t session_id, + const uint8_t *se_dh_msg2, + uint32_t dh_msg2_size, + uint8_t *se_dh_msg3, + uint32_t dh_msg3_size, + uint32_t timeout) +{ + if (!se_dh_msg2 || !se_dh_msg3) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t status = oal_exchange_report(session_id, se_dh_msg2, dh_msg2_size, se_dh_msg3, dh_msg3_size, timeout*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_SESSION_INVALID: + mapped = SGX_ERROR_AE_SESSION_INVALID; + break; + case AESM_KDF_MISMATCH: + mapped = SGX_ERROR_KDF_MISMATCH; + break; + case AESM_EPH_SESSION_FAILED: + case AESM_LONG_TERM_PAIRING_FAILED: + case AESM_PSDA_UNAVAILABLE: + case AESM_SERVICE_NOT_AVAILABLE: + mapped = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; + +} + +sgx_status_t close_session_ocall( + uint32_t session_id, + uint32_t timeout) +{ + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t status = oal_close_session(session_id, timeout*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_SESSION_INVALID: + mapped = SGX_ERROR_AE_SESSION_INVALID; + break; + case AESM_EPH_SESSION_FAILED: + case AESM_LONG_TERM_PAIRING_FAILED: + case AESM_SERVICE_NOT_AVAILABLE: + mapped = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + +sgx_status_t invoke_service_ocall( + const uint8_t *pse_message_req, + uint32_t pse_message_req_size, + uint8_t *pse_message_resp, + uint32_t pse_message_resp_size, + uint32_t timeout) +{ + if (pse_message_req == NULL || pse_message_resp == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t status = oal_invoke_service(pse_message_req, pse_message_req_size, pse_message_resp, pse_message_resp_size, timeout*1000, &result); + + sgx_status_t mapped = oal_map_status(status); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + /*operation specific mapping */ + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + case AESM_SESSION_INVALID: + mapped = SGX_ERROR_AE_SESSION_INVALID; + break; + case AESM_EPH_SESSION_FAILED: + case AESM_LONG_TERM_PAIRING_FAILED: + case AESM_PSDA_UNAVAILABLE: + case AESM_SERVICE_NOT_AVAILABLE: + mapped = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + case AESM_MSG_ERROR: + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + +// common mapper function for all OAL specific error codes + +sgx_status_t oal_map_status(uae_oal_status_t status) +{ + sgx_status_t retVal; + + switch (status) + { + case UAE_OAL_SUCCESS: + retVal = SGX_SUCCESS; + break; + case UAE_OAL_ERROR_UNEXPECTED: + retVal = SGX_ERROR_UNEXPECTED; + break; + case UAE_OAL_ERROR_AESM_UNAVAILABLE: + retVal = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + case UAE_OAL_ERROR_TIMEOUT: + retVal = SGX_ERROR_SERVICE_TIMEOUT; + break; + default: + retVal = SGX_ERROR_UNEXPECTED; + } + + return retVal; +} + +sgx_status_t oal_map_result(aesm_error_t result) +{ + sgx_status_t retVal = SGX_ERROR_UNEXPECTED; + + switch (result) + { + case AESM_SUCCESS: + retVal = SGX_SUCCESS; + break; + case AESM_UPDATE_AVAILABLE: + retVal = SGX_ERROR_UPDATE_NEEDED; + break; + case AESM_UNEXPECTED_ERROR: + retVal = SGX_ERROR_UNEXPECTED; + break; + case AESM_PARAMETER_ERROR: + retVal = SGX_ERROR_INVALID_PARAMETER; + break; + case AESM_SERVICE_STOPPED: + retVal = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + case AESM_OUT_OF_MEMORY_ERROR: + retVal = SGX_ERROR_OUT_OF_MEMORY; + break; + case AESM_BUSY: + retVal = SGX_ERROR_BUSY; + break; + case AESM_NETWORK_ERROR: + case AESM_NETWORK_BUSY_ERROR: + case AESM_PROXY_SETTING_ASSIST: + retVal = SGX_ERROR_NETWORK_FAILURE; + break; + default: + retVal = SGX_ERROR_UNEXPECTED; + } + + return retVal; + +} + +} /* extern "C" */ diff --git a/psw/uae_service/uae_service_assert.cpp b/psw/uae_service/uae_service_assert.cpp new file mode 100644 index 0000000000..43a301783c --- /dev/null +++ b/psw/uae_service/uae_service_assert.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** +* File: +* uae_service_assert.cpp +* Description: +* do some compile-time checking +*/ + +#include "aeerror.h" +#include "sgx_uae_service.h" +#include "upse/platform_info_blob.h" + +static_assert(sizeof(sgx_platform_info_t)==sizeof(((platform_info_blob_wrapper_t*)0)->platform_info_blob), "size of sgx_platform_info_t is incorret"); diff --git a/psw/uae_service/uae_service_version.cpp b/psw/uae_service/uae_service_version.cpp new file mode 100644 index 0000000000..e4b77c3d74 --- /dev/null +++ b/psw/uae_service/uae_service_version.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" +#include "se_cdefs.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_UAE_SERVICE_VERSION_STR __CONCAT("SGX_UAE_SERVICE_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_uae_service_version = SGX_UAE_SERVICE_VERSION_STR; + +#ifdef __cplusplus +} +#endif + +SGX_ACCESS_VERSION(uae_service, 1) diff --git a/psw/uae_service/uae_wrapper/inc/AEInternalServices.h b/psw/uae_service/uae_wrapper/inc/AEInternalServices.h new file mode 100644 index 0000000000..52329fe220 --- /dev/null +++ b/psw/uae_service/uae_wrapper/inc/AEInternalServices.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_INTERNAL_SERVICES_H +#define __AE_INTERNAL_SERVICES_H + +#include + +class AEInternalServices : public AEServices +{ + public: + virtual ~AEInternalServices() {} + + virtual AttestationInformation* InitQuote(uint32_t timeout_msec=0) = 0; + virtual QuoteInfo* GetQuote(const Report* report, const uint32_t quoteType, const SPID* spid, const Nonce* nonce, + const SignatureRevocationList* sig_rl, const uint32_t bufSize, const bool qe_report, + uint32_t timeout_msec=0) = 0; + + virtual CreateSessionInformation* CreateSession(uint32_t dhMsg1Size, uint32_t timeout = 0) =0; + virtual PSEMessage* InvokeService(PSEMessage* targetServiceMessage, uint32_t pseResponseSize, uint32_t timeout = 0) =0; + virtual PlainData* ExchangeReport(uint32_t sessionId, PlainData* dhMsg, uint32_t pseResponseSize, uint32_t timeout = 0) =0; + virtual PlainData* CloseSession(uint32_t sessionId, uint32_t timeout = 0) =0; + + virtual LaunchToken* GetLaunchToken(EnclaveMeasurement* mr_enclave, Signature* mr_signer, SEAttributes* se_attributes, uint32_t timeout_msec=0) =0; + + virtual PsCap* GetPsCap(uint32_t timeout_msec=0) =0; + virtual AttestationStatus* ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout_msec=0) =0; +}; + +#endif diff --git a/psw/uae_service/uae_wrapper/inc/AEInternalServicesProvider.h b/psw/uae_service/uae_wrapper/inc/AEInternalServicesProvider.h new file mode 100644 index 0000000000..a9d64c2606 --- /dev/null +++ b/psw/uae_service/uae_wrapper/inc/AEInternalServicesProvider.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_INTERNAL_SERVICES_PROVIDER_H +#define _AE_INTERNAL_SERVICES_PROVIDER_H + +class AEInternalServices; + +class AEInternalServicesProvider +{ + public: + static AEInternalServices* GetInternalServicesProvider(); + + protected: + AEInternalServicesProvider(); + + static AEInternalServices* mProviderInstance; +}; + +#endif diff --git a/psw/uae_service/uae_wrapper/inc/AEServices.h b/psw/uae_service/uae_wrapper/inc/AEServices.h new file mode 100644 index 0000000000..f688428eb2 --- /dev/null +++ b/psw/uae_service/uae_wrapper/inc/AEServices.h @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_SERVICES_H +#define _AE_SERVICES_H + +#include +#include +#include + +#include +#include +#include +#include + +struct PlainData +{ + uint32_t length; + uint8_t* data; + uint32_t errorCode; + uae_oal_status_t uaeStatus; + +#ifdef __cplusplus + PlainData() : length(0), data(NULL), errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED) {} + ~PlainData(){ + if (data != NULL) delete [] data; + data = NULL; + } + + bool operator==(const PlainData& other) const { + if (this == &other) return true; + if (this == NULL || &other == NULL) return false; + + if (length != other.length || errorCode != other.errorCode) + return false; + if (data == NULL && other.data == NULL) return true; + + if (data != NULL && other.data != NULL) + return (memcmp(data, other.data, other.length) == 0); + else + return false; + } + + void copyFields(const PlainData& other) { + length = other.length; + errorCode = other.errorCode; + + if(other.data == NULL) + data = NULL; + else { + data = new uint8_t[length]; + + memcpy(data, other.data, length); + } + } + + PlainData& operator=(const PlainData& other) { + if (this == &other) + return *this; + + if (data != NULL) + delete [] data; + + copyFields(other); + + return *this; + } + + PlainData(const PlainData& other):length(0), data(NULL), errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED) { + copyFields(other); + } +#endif +}; + +typedef PlainData Quote; +typedef PlainData Report; +typedef PlainData TargetInfo; + +typedef PlainData PlatformGID; +typedef PlainData SignatureRevocationList; +typedef PlainData Nonce; +typedef PlainData SPID; + +typedef PlainData LaunchToken; +typedef PlainData EnclaveMeasurement; +typedef PlainData Signature; +typedef PlainData SEAttributes; +typedef PlainData PSEMessage; + +typedef PlainData PlatformInfo; +typedef PlainData UpdateInfo; + +struct AttestationInformation +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + TargetInfo* quotingTarget; + PlatformGID* platformGID; + + AttestationInformation(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), quotingTarget(NULL),platformGID(NULL) {} + ~AttestationInformation() + { + delete quotingTarget; + delete platformGID; + } + + bool operator==(const AttestationInformation& other) const{ + if (this == &other) return true; + if (errorCode != other.errorCode) return false; + if (*quotingTarget == *other.quotingTarget && + *platformGID == *other.platformGID) + return true; + return false; + } + private: + AttestationInformation(const AttestationInformation&); // Prevent copy-construction + AttestationInformation& operator=(const AttestationInformation&); // Prevent assignment + + +}; + +struct QuoteInfo +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + Quote* quote; + Report* qeReport; + + QuoteInfo(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), quote(NULL), qeReport(NULL) {} + ~QuoteInfo() + { + delete quote; + delete qeReport; + } + + bool operator==(const QuoteInfo& other) const{ + if (this == &other) return true; + if (errorCode != other.errorCode) return false; + if (*quote == *other.quote && + *qeReport == *other.qeReport) + return true; + return false; + } + private: + QuoteInfo(const QuoteInfo&); // Prevent copy-construction + QuoteInfo& operator=(const QuoteInfo&); // Prevent assignment +}; + +struct CreateSessionInformation +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + unsigned int sessionId; + PlainData* dh_msg1; + + CreateSessionInformation(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), sessionId(0),dh_msg1(NULL) {} + ~CreateSessionInformation() + { + delete dh_msg1; + } + + bool operator==(const CreateSessionInformation& other) const + { + if (this == &other) return true; + if (sessionId != other.sessionId || errorCode != other.errorCode) + return false; + return *dh_msg1 == *other.dh_msg1; + } + + private: + CreateSessionInformation(const CreateSessionInformation&); // Prevent copy-construction + CreateSessionInformation& operator=(const CreateSessionInformation&); // Prevent assignment + +}; + +struct PsCap +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + uint64_t ps_cap; + + PsCap(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), ps_cap(0){} + ~PsCap() + { + } + + bool operator==(const PsCap& other) const + { + if (this == &other) return true; + return ps_cap == other.ps_cap; + } +}; + + + +struct AttestationStatus +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + UpdateInfo* updateInfo; + + AttestationStatus(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), updateInfo(NULL) {} + ~AttestationStatus() + { + delete updateInfo; + } + + bool operator==(const AttestationStatus& other) const{ + if (this == &other) return true; + if (errorCode != other.errorCode) return false; + if (*updateInfo == *other.updateInfo) + return true; + return false; + } + private: + AttestationStatus(const AttestationStatus&); // Prevent copy-construction + AttestationStatus& operator=(const AttestationStatus&); // Prevent assignment +}; + +class AEServices +{ + public: + AEServices() {} + virtual ~AEServices() {} + + virtual AttestationInformation* InitQuote(uint32_t timeout_msec=0) = 0; + virtual QuoteInfo* GetQuote(const Report* report, const uint32_t quoteType, const SPID* spid, const Nonce* nonce, + const SignatureRevocationList* sig_rl, const uint32_t bufSize, const bool qe_report, + uint32_t timeout_msec=0) = 0; + virtual PsCap* GetPsCap(uint32_t timeout_msec=0) = 0; + virtual AttestationStatus* ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout_msec=0) = 0; + +}; + +#endif diff --git a/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h b/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h new file mode 100644 index 0000000000..45eac15978 --- /dev/null +++ b/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_SERVICES_IMPL_H__ +#define __AE_SERVICES_IMPL_H__ + +#include +#include +#include + +class ITransporter; + +class AEServicesImpl : public AEInternalServices{ + public: + ~AEServicesImpl(); + + QuoteInfo* GetQuote(const Report* report, const uint32_t quoteType, const SPID* spid, const Nonce* nonce, + const SignatureRevocationList* sig_rl, const uint32_t bufSize, const bool qe_report, uint32_t timeout_msec=0); + + AttestationInformation* InitQuote(uint32_t timeout_msec=0); + + LaunchToken* GetLaunchToken(EnclaveMeasurement *mr_enclave, + Signature *mr_signer, + SEAttributes *se_attributes, + uint32_t timeout_msec=0); + + CreateSessionInformation* CreateSession(uint32_t dhMsg1Size, uint32_t timeout = 0); + + PSEMessage* InvokeService(PSEMessage* targetServiceMessage, uint32_t pseResponseSize, uint32_t timeout = 0); + + PlainData* ExchangeReport(uint32_t sessionId, PlainData* dhMsg, uint32_t pseResponseSize, uint32_t timeout = 0); + + PlainData* CloseSession(uint32_t sessionId, uint32_t timeout = 0); + + PsCap* GetPsCap(uint32_t timeout_msec=0); + + AttestationStatus* ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength,uint32_t timeout_msec=0) ; + + friend AEServices* AEServicesProvider::GetServicesProvider(); + friend AEInternalServices* AEInternalServicesProvider::GetInternalServicesProvider(); + + protected: + AEServicesImpl(const char* socketbase); + static bool mBoundToService; + ITransporter* mTransporter; //the internal interface to the AESM + + private: + AEServicesImpl& operator=(const AEServicesImpl&); + AEServicesImpl(const AEServicesImpl&); +}; + +#endif diff --git a/psw/uae_service/uae_wrapper/inc/AEServicesProvider.h b/psw/uae_service/uae_wrapper/inc/AEServicesProvider.h new file mode 100644 index 0000000000..2a6cc1109a --- /dev/null +++ b/psw/uae_service/uae_wrapper/inc/AEServicesProvider.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_SERVICES_PROVIDER_H +#define _AE_SERVICES_PROVIDER_H + + +class AEServices; + +class AEServicesProvider +{ + public: + static AEServices* GetServicesProvider(); + static void FreeServiceProvider(); + + protected: + AEServicesProvider(); + + static AEServices* mProviderInstance; +}; + +#endif diff --git a/psw/uae_service/uae_wrapper/src/AEInternalServicesProvider.cpp b/psw/uae_service/uae_wrapper/src/AEInternalServicesProvider.cpp new file mode 100644 index 0000000000..3914a1d950 --- /dev/null +++ b/psw/uae_service/uae_wrapper/src/AEInternalServicesProvider.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + + +#include + +#ifndef CONFIG_SOCKET_PATH +#error "CONFIG_SOCKET_PATH is not defined" +#endif + +#include + +AEInternalServices* AEInternalServicesProvider::mProviderInstance = NULL; + +AEInternalServicesProvider::AEInternalServicesProvider() { /* empty */ } + +AEInternalServices* AEInternalServicesProvider::GetInternalServicesProvider() +{ + if (mProviderInstance) + return mProviderInstance; + + const char *socketbase = CONFIG_SOCKET_PATH; + + mProviderInstance = new AEServicesImpl(socketbase); + + return mProviderInstance; +} diff --git a/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp b/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp new file mode 100644 index 0000000000..4fa0e378b1 --- /dev/null +++ b/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp @@ -0,0 +1,397 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +AEServicesImpl::AEServicesImpl(const char* socketbase) : + mTransporter(NULL) +{ + ProtobufSerializer * serializer = new ProtobufSerializer(); + NonBlockingUnixSocketFactory *socketFactory = new NonBlockingUnixSocketFactory(socketbase); + mTransporter = new SocketTransporter(socketFactory, serializer); +} + +AEServicesImpl::~AEServicesImpl() +{ + delete mTransporter; +} + +QuoteInfo* AEServicesImpl::GetQuote(const Report* report, const uint32_t quoteType, const SPID* spid, const Nonce* nonce, + const SignatureRevocationList* sig_rl, const uint32_t bufSize, const bool qe_report, + uint32_t timeout_msec) +{ + AEGetQuoteRequest* getQuoteRequest = new AEGetQuoteRequest(report->length, report->data, + quoteType, + spid->length, spid->data, + nonce->length, nonce->data, + sig_rl->length, sig_rl->data, + bufSize, + qe_report, + timeout_msec); + + if(getQuoteRequest->check() == false) + { + delete getQuoteRequest; + QuoteInfo* quoteInfo = new QuoteInfo; + quoteInfo->uaeStatus = UAE_OAL_ERROR_UNEXPECTED; + return quoteInfo; + } + + AEGetQuoteResponse* getQuoteResponse = new AEGetQuoteResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(getQuoteRequest, getQuoteResponse); + + //public exposed quote container + QuoteInfo* quoteInfo = new QuoteInfo; + quoteInfo->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && getQuoteResponse->check() == true) + { + Quote* quote = new Quote; + Report* qeReport = NULL; + + quote->length = getQuoteResponse->GetQuoteLength(); + quote->data = new uint8_t[quote->length]; + memcpy(quote->data, getQuoteResponse->GetQuote(), getQuoteResponse->GetQuoteLength()); + if (getQuoteResponse->GetQEReport() != NULL) //If we have also a report + { + qeReport = new Report; + qeReport->data = new uint8_t[getQuoteResponse->GetQEReportLength()]; + qeReport->length = getQuoteResponse->GetQEReportLength(); + memcpy(qeReport->data, getQuoteResponse->GetQEReport(), qeReport->length); + } + + quoteInfo->quote = quote; + quoteInfo->qeReport = qeReport; + } + + quoteInfo->errorCode = getQuoteResponse->GetErrorCode(); + + delete getQuoteRequest; + delete getQuoteResponse; + + return quoteInfo; +} + +AttestationInformation* AEServicesImpl::InitQuote(uint32_t timeout_msec) +{ + AEInitQuoteResponse* initQuoteResponse = new AEInitQuoteResponse(); /* empty response */ + AEInitQuoteRequest* initQuoteRequest = new AEInitQuoteRequest(timeout_msec); + + uae_oal_status_t ipc_status = mTransporter->transact(initQuoteRequest, initQuoteResponse); + + AttestationInformation* info = new AttestationInformation; + info->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && initQuoteResponse->check() == true) { + /* populate the public exposed data structure */ + + TargetInfo* tInfo = new TargetInfo; + PlatformGID* pGID = new PlatformGID; + + tInfo->length = initQuoteResponse->GetTargetInfoLength(); + pGID->length = initQuoteResponse->GetGIDLength(); + + tInfo->data = new uint8_t[tInfo->length]; + pGID->data = new uint8_t[pGID->length]; + + memcpy(tInfo->data, initQuoteResponse->GetTargetInfo(), tInfo->length); + memcpy(pGID->data, initQuoteResponse->GetGID(), pGID->length); + + info->quotingTarget = tInfo; + info->platformGID = pGID; + } + info->errorCode = initQuoteResponse->GetErrorCode(); + + delete initQuoteRequest; + delete initQuoteResponse; + + return info; +} + +LaunchToken* AEServicesImpl::GetLaunchToken(EnclaveMeasurement* mr_enclave, Signature* mr_signer, SEAttributes* se_attributes, uint32_t timeout_msec) +{ + AEGetLaunchTokenRequest* getLaunchTokenRequest = new AEGetLaunchTokenRequest(mr_enclave->length, + mr_enclave->data, + mr_signer->length, + mr_signer->data, + se_attributes->length, + se_attributes->data, + timeout_msec); + if(getLaunchTokenRequest->check() == false) + { + delete getLaunchTokenRequest; + LaunchToken* token = new LaunchToken; + token->uaeStatus = UAE_OAL_ERROR_UNEXPECTED; + return token; + } + + AEGetLaunchTokenResponse* getLaunchTokenResponse = new AEGetLaunchTokenResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(getLaunchTokenRequest, getLaunchTokenResponse); + + LaunchToken* token = new LaunchToken; + token->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && getLaunchTokenResponse->check() == true ) + { + token->length = getLaunchTokenResponse->GetTokenLength(); + token->data = new uint8_t[token->length]; + + memcpy(token->data, getLaunchTokenResponse->GetToken(), token->length); + } + + token->errorCode = getLaunchTokenResponse->GetErrorCode(); + + delete getLaunchTokenRequest; + delete getLaunchTokenResponse; + + return token; +} + +CreateSessionInformation* AEServicesImpl::CreateSession(uint32_t dhMsg1Size, uint32_t timeout) +{ + AECreateSessionRequest* createSessionRequest = new AECreateSessionRequest(dhMsg1Size, timeout); + AECreateSessionResponse* createSessionResponse = new AECreateSessionResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(createSessionRequest, createSessionResponse); + + CreateSessionInformation* info = new CreateSessionInformation(); + info->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && createSessionResponse->check() == true) + { + info->sessionId = createSessionResponse->GetSessionId(); + info->dh_msg1 = new PlainData; + + info->dh_msg1->length = createSessionResponse->GetDHMsg1Length(); + info->dh_msg1->data = new uint8_t[createSessionResponse->GetDHMsg1Length()]; + + memcpy(info->dh_msg1->data, createSessionResponse->GetDHMsg1(), info->dh_msg1->length); + } + + info->errorCode = createSessionResponse->GetErrorCode(); + + delete createSessionRequest; + delete createSessionResponse; + + return info; +} + +PSEMessage* AEServicesImpl::InvokeService(PSEMessage* targetServiceMessage, uint32_t pseResponseSize,uint32_t timeout) +{ + AEInvokeServiceRequest* invokeServiceRequest = new AEInvokeServiceRequest(targetServiceMessage->length, + targetServiceMessage->data, + pseResponseSize, + timeout); + if(invokeServiceRequest->check() == false) + { + delete invokeServiceRequest; + PSEMessage* msg = new PSEMessage; + msg->uaeStatus = UAE_OAL_ERROR_UNEXPECTED; + return msg; + } + + + AEInvokeServiceResponse* invokeServiceResponse = new AEInvokeServiceResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(invokeServiceRequest, invokeServiceResponse); + + PSEMessage* msg = new PSEMessage; + msg->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && invokeServiceResponse->check()) + { + msg->length = invokeServiceResponse->GetPSEMessageLength(); + if (msg->length > 0) + { + msg->data = new uint8_t[msg->length]; + memcpy(msg->data, invokeServiceResponse->GetPSEMessage(), msg->length); + } + } + + msg->errorCode = invokeServiceResponse->GetErrorCode(); + + delete invokeServiceRequest; + delete invokeServiceResponse; + + return msg; +} + +PlainData* AEServicesImpl::ExchangeReport(uint32_t sessionId, PlainData* dhMsg, uint32_t pseResponseSize, uint32_t timeout) +{ + AEExchangeReportRequest* exchangeReportRequest = new AEExchangeReportRequest(sessionId, dhMsg->length, dhMsg->data, + pseResponseSize, timeout); + + if(exchangeReportRequest->check() == false) + { + delete exchangeReportRequest; + PlainData* dhMsg3 = new PlainData; + dhMsg3->uaeStatus = UAE_OAL_ERROR_UNEXPECTED; + return dhMsg3; + } + + AEExchangeReportResponse* exchangeReportResponse = new AEExchangeReportResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(exchangeReportRequest, exchangeReportResponse); + + PlainData* dhMsg3 = new PlainData; + dhMsg3->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && exchangeReportResponse->check()) + { + dhMsg3->length = exchangeReportResponse->GetDHMsg3Length(); + + if (dhMsg3->length > 0) + { + dhMsg3->data = new uint8_t[dhMsg3->length]; + memcpy(dhMsg3->data, exchangeReportResponse->GetDHMsg3(), dhMsg3->length); + } + } + + dhMsg3->errorCode = exchangeReportResponse->GetErrorCode(); + + delete exchangeReportRequest; + delete exchangeReportResponse; + + return dhMsg3; +} + +PlainData* AEServicesImpl::CloseSession(uint32_t sessionId, uint32_t timeout) +{ + AECloseSessionRequest* closeSessionRequest = new AECloseSessionRequest(sessionId, timeout); + AECloseSessionResponse* closeSessionResponse = new AECloseSessionResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(closeSessionRequest, closeSessionResponse); + + PlainData* res = new PlainData; + + res->errorCode = closeSessionResponse->GetErrorCode(); + res->uaeStatus = ipc_status; + + delete closeSessionRequest; + delete closeSessionResponse; + + return res; +} + +PsCap* AEServicesImpl::GetPsCap(uint32_t timeout_msec) +{ + AEGetPsCapRequest* getPsCapRequest = new AEGetPsCapRequest(timeout_msec); + AEGetPsCapResponse* getPsCapResponse = new AEGetPsCapResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(getPsCapRequest, getPsCapResponse); + + PsCap* ps_cap = new PsCap(); + ps_cap->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && getPsCapResponse->check() == true) + ps_cap->ps_cap= getPsCapResponse->GetPsCap(); + + ps_cap->errorCode = getPsCapResponse->GetErrorCode(); + + delete getPsCapRequest; + delete getPsCapResponse; + + return ps_cap; +} + + +AttestationStatus* AEServicesImpl::ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout_msec) +{ + AEReportAttestationRequest* reportAttestationErrorRequest = new AEReportAttestationRequest(platformInfo->length, + platformInfo->data, + attestation_error_code, updateInfoLength, timeout_msec); + if(reportAttestationErrorRequest->check() == false) + { + delete reportAttestationErrorRequest; + AttestationStatus* attestationStatus = new AttestationStatus; + attestationStatus->uaeStatus = UAE_OAL_ERROR_UNEXPECTED; + return attestationStatus; + } + AEReportAttestationResponse* reportAttestationErrorResponse = new AEReportAttestationResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(reportAttestationErrorRequest, reportAttestationErrorResponse); + + AttestationStatus* attestationStatus = new AttestationStatus; + attestationStatus->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && reportAttestationErrorResponse->check()) + { + UpdateInfo* tInfo = new UpdateInfo; + tInfo->length = reportAttestationErrorResponse->GetUpdateInfoLength(); + + tInfo->data = new uint8_t[tInfo->length]; + memcpy(tInfo->data, reportAttestationErrorResponse->GetUpdateInfo(), tInfo->length); + attestationStatus->updateInfo = tInfo; + } + + attestationStatus->errorCode = reportAttestationErrorResponse->GetErrorCode(); + + delete reportAttestationErrorRequest; + delete reportAttestationErrorResponse; + + return attestationStatus; + +} diff --git a/psw/uae_service/uae_wrapper/src/AEServicesProvider.cpp b/psw/uae_service/uae_wrapper/src/AEServicesProvider.cpp new file mode 100644 index 0000000000..bf3142ab42 --- /dev/null +++ b/psw/uae_service/uae_wrapper/src/AEServicesProvider.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + + +#include + +#ifndef CONFIG_SOCKET_PATH +#error "CONFIG_SOCKET_PATH is not defined" +#endif + +#include + +AEServices* AEServicesProvider::mProviderInstance = NULL; + +AEServicesProvider::AEServicesProvider() { } + +AEServices* AEServicesProvider::GetServicesProvider() +{ + if (mProviderInstance) + return mProviderInstance; + + const char *socketbase = CONFIG_SOCKET_PATH; + + mProviderInstance = new AEServicesImpl(socketbase); + + return mProviderInstance; +} + +void AEServicesProvider::FreeServiceProvider() +{ + if(mProviderInstance != NULL) + { + delete mProviderInstance; + mProviderInstance = NULL; + } +} diff --git a/psw/uae_service/uae_wrapper/src/tae_ocall_api.cpp b/psw/uae_service/uae_wrapper/src/tae_ocall_api.cpp new file mode 100644 index 0000000000..c7bfe7e2f8 --- /dev/null +++ b/psw/uae_service/uae_wrapper/src/tae_ocall_api.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +extern "C" +{ + + +uae_oal_status_t oal_create_session( + uint32_t *sid, + uint8_t* dh_msg1, + uint32_t dh_msg1_size, + uint32_t timeout_usec, + aesm_error_t *result) +{ + //get services provider + AEInternalServices* internalServices = AEInternalServicesProvider::GetInternalServicesProvider(); + if (internalServices == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + CreateSessionInformation* info = internalServices->CreateSession(dh_msg1_size, timeout_usec); + + uae_oal_status_t retVal = UAE_OAL_ERROR_UNEXPECTED; + if (info != NULL) + { + *result = (aesm_error_t)info->errorCode; + retVal = info->uaeStatus; + + if (info->dh_msg1 != NULL) + { + *sid = info->sessionId; + if (info->dh_msg1 != NULL && info->dh_msg1->data != NULL) + { + if (dh_msg1_size < info->dh_msg1->length) + retVal = UAE_OAL_ERROR_UNEXPECTED; + else + memcpy(dh_msg1, info->dh_msg1->data, info->dh_msg1->length); + } + } + delete info; + } + return retVal; +} + +uae_oal_status_t oal_close_session(uint32_t sid, + uint32_t timeout_usec, + aesm_error_t *result) +{ + AEInternalServices* internalServices = AEInternalServicesProvider::GetInternalServicesProvider(); + if (internalServices == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + PlainData* info = internalServices->CloseSession(sid, timeout_usec); + + uae_oal_status_t retVal = UAE_OAL_ERROR_UNEXPECTED; + if (info != NULL) + { + *result = (aesm_error_t)info->errorCode; + retVal = info->uaeStatus; + } + + return retVal; +} + +uae_oal_status_t oal_exchange_report(uint32_t sid, + const uint8_t* dh_msg2, + uint32_t dh_msg2_size, + uint8_t* dh_msg3, + uint32_t dh_msg3_size, + uint32_t timeout_usec, + aesm_error_t *result) +{ + + AEInternalServices* internalServices = AEInternalServicesProvider::GetInternalServicesProvider(); + if (internalServices == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + PlainData* dhMsg2 = NULL; + PlainData* msg3 = NULL; + dhMsg2 = new PlainData; + + dhMsg2->length = dh_msg2_size; + dhMsg2->data = new uint8_t[dh_msg2_size]; + memcpy(dhMsg2->data, dh_msg2, dh_msg2_size); + + msg3 = internalServices->ExchangeReport(sid, dhMsg2, dh_msg3_size, timeout_usec); + + uae_oal_status_t retVal = UAE_OAL_ERROR_UNEXPECTED; + + if (msg3 != NULL) + { + *result = (aesm_error_t)msg3->errorCode; + retVal = msg3->uaeStatus; + + if (*result == AESM_SUCCESS) + { + if( msg3->data != NULL) + { + memcpy(dh_msg3, msg3->data, dh_msg3_size); + } + else + retVal = UAE_OAL_ERROR_UNEXPECTED; + } + } + + delete msg3; + delete dhMsg2; + + return retVal; +} + +uae_oal_status_t oal_invoke_service(const uint8_t* pse_message_req, + uint32_t pse_message_req_size, + uint8_t* pse_message_resp, + uint32_t pse_message_resp_size, + uint32_t timeout_usec, + aesm_error_t *result) +{ + AEInternalServices* internalServices = AEInternalServicesProvider::GetInternalServicesProvider(); + if (internalServices == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + PSEMessage* request = new PSEMessage; + + request->length = pse_message_req_size; + request->data = new uint8_t[pse_message_req_size]; + memcpy(request->data, pse_message_req, pse_message_req_size); + + PSEMessage* pse_resp = internalServices->InvokeService(request, pse_message_resp_size, timeout_usec); + + uae_oal_status_t retVal = UAE_OAL_ERROR_UNEXPECTED; + if (pse_resp != NULL) + { + *result = (aesm_error_t)pse_resp->errorCode; + retVal = pse_resp->uaeStatus; + + if (pse_resp->data != NULL) + memcpy(pse_message_resp, pse_resp->data, pse_message_resp_size); + } + + delete request; + delete pse_resp; + + return retVal; +} + +} //end of extern block + diff --git a/psw/uae_service/uae_wrapper/src/uae_api.cpp b/psw/uae_service/uae_wrapper/src/uae_api.cpp new file mode 100644 index 0000000000..fa7588c03d --- /dev/null +++ b/psw/uae_service/uae_wrapper/src/uae_api.cpp @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +#include + +////////THE COMMON STUFF aka INTEGRATION with Linux API +#include +#include +#include +#include + +#include + +#include +#include + +/////////////////////////////////////////////////////// + +// NOTE -> uAE works internally with milliseconds and cannot obtain a better resolution for timeout because +// epoll_wait will get the timeout parameter in milliseconds + +extern "C" +uae_oal_status_t oal_get_launch_token(const enclave_css_t* signature, const sgx_attributes_t* attribute, sgx_launch_token_t* launchToken, uint32_t timeout_usec, aesm_error_t *result) +{ + AEInternalServices* servicesProvider = AEInternalServicesProvider::GetInternalServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + EnclaveMeasurement* mrenclave = new EnclaveMeasurement; + SEAttributes* attr = new SEAttributes; + Signature* mrsigner = new Signature; + + mrenclave->data = new uint8_t[sizeof(sgx_measurement_t)]; + mrenclave->length = sizeof(sgx_measurement_t); + memcpy(mrenclave->data, &signature->body.enclave_hash, mrenclave->length); + + attr->data = new uint8_t[sizeof(sgx_attributes_t)]; + attr->length = sizeof(sgx_attributes_t); + memcpy(attr->data, attribute, attr->length); + + mrsigner->data = new uint8_t[sizeof(signature->key.modulus)]; + mrsigner->length = sizeof(signature->key.modulus); + memcpy(mrsigner->data, &signature->key.modulus, mrsigner->length); + + LaunchToken* token = servicesProvider->GetLaunchToken(mrenclave, mrsigner, attr, timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (token != NULL) + { + *result = (aesm_error_t)token->errorCode; + ret = token->uaeStatus; + + if (*result == AESM_SUCCESS) + memcpy(launchToken, token->data, token->length); + } + + delete mrenclave; + delete mrsigner; + delete attr; + delete token; + + return ret; +} + +/* + QUOTING +*/ + +extern "C" +uae_oal_status_t SGXAPI oal_init_quote(sgx_target_info_t *p_target_info, sgx_epid_group_id_t *p_gid, uint32_t timeout_usec, aesm_error_t *result) +{ + AEServices *servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + AttestationInformation* attestationInfo = servicesProvider->InitQuote(timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (attestationInfo != NULL) + { + *result = (aesm_error_t)attestationInfo->errorCode; + ret = attestationInfo->uaeStatus; + + if (*result == AESM_SUCCESS) + { + if (p_target_info != NULL) + memcpy(p_target_info, attestationInfo->quotingTarget->data, attestationInfo->quotingTarget->length); + if (p_gid != NULL) + memcpy(p_gid, attestationInfo->platformGID->data, attestationInfo->platformGID->length); + } + delete attestationInfo; + } + return ret; +} + + extern "C" +uae_oal_status_t SGXAPI oal_get_quote( + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sig_rl, + uint32_t sig_rl_size, + sgx_report_t *p_qe_report, + sgx_quote_t *p_quote, + uint32_t quote_size, + uint32_t timeout_usec, + aesm_error_t *result) +{ + + if (quote_size > MAX_MEMORY_ALLOCATION) + { + *result = AESM_PARAMETER_ERROR; + return UAE_OAL_SUCCESS; + } + + AEServices *servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + Report* l_report = new Report; + SPID* l_spid = new SPID; + Nonce* l_nonce = new Nonce; + SignatureRevocationList* l_sigRL = new SignatureRevocationList; + + l_report->length = sizeof(sgx_report_t); + l_report->data = new uint8_t[sizeof(sgx_report_t)]; + memcpy(l_report->data, p_report, l_report->length); + + l_spid->length = sizeof(sgx_spid_t); + l_spid->data = new uint8_t[sizeof(sgx_spid_t)]; + memcpy(l_spid->data, p_spid, l_spid->length); + + if (p_nonce != NULL) + { + l_nonce->length = sizeof(sgx_quote_nonce_t); + l_nonce->data = new uint8_t[sizeof(sgx_quote_nonce_t)]; + memcpy(l_nonce->data, p_nonce, l_nonce->length); + } + + if (p_sig_rl != NULL && sig_rl_size > 0) + { + l_sigRL->length = sig_rl_size; + l_sigRL->data = new uint8_t[sig_rl_size]; + memcpy(l_sigRL->data, p_sig_rl, l_sigRL->length); + } + + bool getQEReport = false; + if (p_qe_report != NULL) + getQEReport = true; + + QuoteInfo* quoteInfo = servicesProvider->GetQuote(l_report, quote_type, l_spid, l_nonce, l_sigRL, quote_size, getQEReport, timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + + if (quoteInfo != NULL) + { + ret = quoteInfo->uaeStatus; + *result = (aesm_error_t)quoteInfo->errorCode; + + if (*result == AESM_SUCCESS) + { + Quote* quote = quoteInfo->quote; + if (quote->data != NULL) + memcpy(p_quote, quote->data, quote->length); + //do we have a qe_report? + Report* qeReport = quoteInfo->qeReport; + if (qeReport != NULL) + { + if (p_qe_report == NULL) + { + ret = UAE_OAL_ERROR_UNEXPECTED; + } + else + { + memcpy(p_qe_report, qeReport->data, qeReport->length); + } + } + } + + delete quoteInfo; + } + + //cleanup + delete l_report; + delete l_spid; + delete l_nonce; + delete l_sigRL; + + return ret; +} + + +extern "C" +uae_oal_status_t SGXAPI oal_get_ps_cap(uint64_t* ps_cap, uint32_t timeout_usec, aesm_error_t *result) +{ + AEServices* servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + PsCap* cap = servicesProvider->GetPsCap(timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (cap != NULL) + { + ret = cap->uaeStatus; + *result = (aesm_error_t)cap->errorCode; + + if (*result == AESM_SUCCESS) + { + *ps_cap = cap->ps_cap; + } + } + delete cap; + return ret; +} + +extern "C" +uae_oal_status_t SGXAPI oal_report_attestation_status( + const sgx_platform_info_t* platform_info, + int attestation_error_code, + sgx_update_info_bit_t* platform_update_info, + uint32_t timeout_usec, + aesm_error_t *result) +{ + AEServices* servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + + PlatformInfo* platformInfo = new PlatformInfo; + + platformInfo->data = new uint8_t[sizeof(sgx_platform_info_t)]; + platformInfo->length = sizeof(sgx_platform_info_t); + memcpy(platformInfo->data, platform_info, platformInfo->length); + + AttestationStatus* attestationStatus = servicesProvider->ReportAttestationError(platformInfo, attestation_error_code,sizeof(sgx_update_info_bit_t), timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (attestationStatus != NULL) + { + *result = (aesm_error_t)attestationStatus->errorCode; + ret = attestationStatus->uaeStatus; + + if (*result == AESM_SUCCESS) + memcpy(platform_update_info, attestationStatus->updateInfo->data, attestationStatus->updateInfo->length); + } + + delete attestationStatus; + delete platformInfo; + return ret; +} + diff --git a/psw/urts/cpu_features.cpp b/psw/urts/cpu_features.cpp new file mode 100644 index 0000000000..346a6f0c0e --- /dev/null +++ b/psw/urts/cpu_features.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "se_cpu_feature_defs.h" +#include "se_types.h" +#include "cpu_features.h" + +void get_cpu_features(uint64_t *__intel_cpu_feature_indicator) +{ + unsigned int cpuid0_eax, cpuid0_ebx, cpuid0_ecx, cpuid0_edx; + unsigned int cpuid1_eax, cpuid1_ebx, cpuid1_ecx, cpuid1_edx; + unsigned int cpuid7_eax, cpuid7_ebx, cpuid7_ecx, cpuid7_edx; + unsigned int ecpuid1_eax, ecpuid1_ebx, ecpuid1_ecx, ecpuid1_edx; + uint64_t cpu_feature_indicator = CPU_FEATURE_GENERIC_IA32; + + sgx_cpuid(0, &cpuid0_eax, &cpuid0_ebx, &cpuid0_ecx, &cpuid0_edx); + if(cpuid0_eax == 0 || + !(cpuid0_ebx == CPU_GENU_VAL && + cpuid0_edx == CPU_INEI_VAL && + cpuid0_ecx == CPU_NTEL_VAL)) + { + *__intel_cpu_feature_indicator = cpu_feature_indicator; + return; + } + + sgx_cpuid(1, &cpuid1_eax, &cpuid1_ebx, &cpuid1_ecx, &cpuid1_edx); + if (CPU_MODEL(cpuid1_eax) == CPU_ATOM1 || + CPU_MODEL(cpuid1_eax) == CPU_ATOM2 || + CPU_MODEL(cpuid1_eax) == CPU_ATOM3) { + cpu_feature_indicator |= CPU_FEATURE_FULL_INORDER; + } + + // Walk through supported features + if (CPU_HAS_FPU(cpuid1_edx)) { + cpu_feature_indicator |= CPU_FEATURE_FPU; + } + + if (CPU_HAS_CMOV(cpuid1_edx)) { + cpu_feature_indicator |= CPU_FEATURE_CMOV; + } + + if (CPU_HAS_MMX(cpuid1_edx)) { + cpu_feature_indicator |= CPU_FEATURE_MMX; + } + + if (CPU_HAS_FXSAVE(cpuid1_edx)) { + cpu_feature_indicator |= CPU_FEATURE_FXSAVE; + + if (CPU_HAS_SSE(cpuid1_edx)) { + cpu_feature_indicator |= CPU_FEATURE_SSE; + } + if (CPU_HAS_SSE2(cpuid1_edx)) { + cpu_feature_indicator |= CPU_FEATURE_SSE2; + } + if (CPU_HAS_SSE3(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_SSE3; + } + + if (CPU_HAS_SSSE3(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_SSSE3; + } + + if (CPU_HAS_MOVBE(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_MOVBE; + } + // + // Penryn is a P6 with SNI support. + // + if (CPU_HAS_SSE4_1(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_SSE4_1; + } + if (CPU_HAS_SSE4_2(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_SSE4_2; + } + + if (CPU_HAS_POPCNT(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_POPCNT; + } + if (CPU_HAS_PCLMULQDQ(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_PCLMULQDQ; + } + + if (CPU_HAS_AES(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_AES; + } + } + + // IvyBridge + if (CPU_HAS_RDRAND(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_RDRND; + } + + sgx_cpuidex(7, 0, &cpuid7_eax, &cpuid7_ebx, &cpuid7_ecx, &cpuid7_edx); + sgx_cpuid(0x80000001, &ecpuid1_eax, &ecpuid1_ebx, &ecpuid1_ecx, &ecpuid1_edx); + + // Haswell + // BMI checks for both ebx[3] and ebx[8] (VEX-encoded instructions) + if (CPU_HAS_BMI(cpuid7_ebx)) { + cpu_feature_indicator |= CPU_FEATURE_BMI; + } + if (CPU_HAS_LZCNT(ecpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_LZCNT; + } + if (CPU_HAS_PREFETCHW(ecpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_PREFETCHW; + } + if (CPU_HAS_HLE(cpuid7_ebx)) { + cpu_feature_indicator |= CPU_FEATURE_HLE; + } + if (CPU_HAS_RTM(cpuid7_ebx)) { + cpu_feature_indicator |= CPU_FEATURE_RTM; + } + if (CPU_HAS_RDSEED(cpuid7_ebx)) { + cpu_feature_indicator |= CPU_FEATURE_RDSEED; + } + if (CPU_HAS_ADCOX(cpuid7_ebx)) { + cpu_feature_indicator |= CPU_FEATURE_ADCOX; + } + + if (CPU_HAS_XSAVE(cpuid1_ecx)) + { + //don't get xcr0_features, tRTS will do it. + if (CPU_HAS_AVX(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_AVX; + } + + // IvyBridge + if (CPU_HAS_F16C(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_F16C; + } + + // Haswell + if (CPU_HAS_AVX2(cpuid7_ebx)) { + cpu_feature_indicator |= CPU_FEATURE_AVX2; + } + if (CPU_HAS_FMA(cpuid1_ecx)) { + cpu_feature_indicator |= CPU_FEATURE_FMA; + } + } + + + *__intel_cpu_feature_indicator = cpu_feature_indicator; +} diff --git a/psw/urts/cpu_features.h b/psw/urts/cpu_features.h new file mode 100644 index 0000000000..bcf51f2362 --- /dev/null +++ b/psw/urts/cpu_features.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _CPU_FEATURES_H_ +#define _CPU_FEATURES_H_ + +#include "cpuid.h" + +void get_cpu_features(uint64_t *__intel_cpu_feature_indicator); + +inline void sgx_cpuid(unsigned int in_eax, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) +{ + int cpu_info[4] = {0}; + __cpuid(cpu_info, in_eax); + *eax = cpu_info[0]; + *ebx = cpu_info[1]; + *ecx = cpu_info[2]; + *edx = cpu_info[3]; +} + +inline void sgx_cpuidex(unsigned int in_eax, unsigned int leaf, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) +{ + int cpu_info[4] = {0}; + __cpuidex(cpu_info, in_eax, leaf); + *eax = cpu_info[0]; + *ebx = cpu_info[1]; + *ecx = cpu_info[2]; + *edx = cpu_info[3]; +} + +#endif diff --git a/psw/urts/create_param.h b/psw/urts/create_param.h new file mode 100644 index 0000000000..e5e5d65002 --- /dev/null +++ b/psw/urts/create_param.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _CREATE_PARAM_H_ +#define _CREATE_PARAM_H_ + +#include "metadata.h" +typedef struct _create_param_t +{ + uint64_t enclave_size; + uint64_t stack_max_size; + uint64_t stack_limit_addr; + uint64_t stack_base_addr; + uint64_t heap_max_size; + uint64_t heap_offset; + uint64_t first_ssa_gpr; + uint64_t td_addr; + uint64_t tls_addr; + uint32_t tcs_max_num; + uint32_t tcs_policy; + uint32_t ssa_frame_size; +} create_param_t; + +#endif diff --git a/psw/urts/enclave.cpp b/psw/urts/enclave.cpp new file mode 100644 index 0000000000..7586b1e87f --- /dev/null +++ b/psw/urts/enclave.cpp @@ -0,0 +1,503 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "enclave.h" +#include "util.h" +#include "se_detect.h" +#include "enclave_creator.h" +#include "sgx_error.h" +#include "se_error_internal.h" +#include "debugger_support.h" +#include "se_memory.h" +#include + +using namespace std; + +int do_ecall(const int fn, const void *ocall_table, const void *ms, CTrustThread *trust_thread); +int do_ocall(const bridge_fn_t bridge, void *ms); + +CEnclave::CEnclave(CLoader &ldr) + : m_loader(ldr) + , m_enclave_id(0) + , m_start_addr(NULL) + , m_size(0) + , m_power_event_flag(0) + , m_ref(0) + , m_zombie(false) + , m_thread_pool(NULL) + , m_dbg_flag(false) + , m_destroyed(false) +{ + memset(&m_enclave_info, 0, sizeof(debug_enclave_info_t)); + se_init_rwlock(&m_rwlock); +} + + +sgx_status_t CEnclave::initialize(const se_file_t& file, const sgx_enclave_id_t enclave_id, void * const start_addr, const uint64_t enclave_size, const uint32_t tcs_policy) +{ + uint32_t name_len = file.name_len; + if (file.unicode) + name_len *= (uint32_t)sizeof(wchar_t); + + const int buf_len = name_len + 4; //+4, because we need copy the charactor of string end ('\0').; + + m_enclave_info.lpFileName = calloc(1, buf_len); + if (m_enclave_info.lpFileName == NULL) + return SGX_ERROR_OUT_OF_MEMORY; + + memcpy_s(m_enclave_info.lpFileName, name_len, file.name, name_len); + m_enclave_info.unicode = file.unicode?0:1; + m_enclave_info.file_name_size = name_len; + + m_enclave_info.struct_version = DEBUG_INFO_STRUCT_VERSION; + + + m_enclave_id = enclave_id; + m_start_addr = start_addr; + m_size = enclave_size; + + if(TCS_POLICY_BIND == tcs_policy) + { + m_thread_pool = new CThreadPoolBindMode(); + } + else if(TCS_POLICY_UNBIND == tcs_policy) + { + //we also set it as bind mode. + m_thread_pool = new CThreadPoolUnBindMode(); + } + else + { + SE_TRACE(SE_TRACE_WARNING, "BUG: unknown tcs policy\n"); + //Should NOT run here, because we have validate the metadata before. + free(m_enclave_info.lpFileName); + m_enclave_info.lpFileName = NULL; + return SGX_ERROR_INVALID_PARAMETER; + } + return SGX_SUCCESS; +} + +CEnclave::~CEnclave() +{ + if (m_thread_pool) + { + delete m_thread_pool; + m_thread_pool = NULL; + } + + destory_debug_info(&m_enclave_info); + se_fini_rwlock(&m_rwlock); +} + +void * CEnclave::get_symbol_address(const char * const symbol) +{ + return m_loader.get_symbol_address(symbol); +} + +sgx_enclave_id_t CEnclave::get_enclave_id() +{ + return m_enclave_id; +} + + +sgx_status_t CEnclave::error_trts2urts(unsigned int trts_error) +{ + if(trts_error == (unsigned int)SE_ERROR_READ_LOCK_FAIL) + { + return SGX_ERROR_ENCLAVE_LOST; + } + + //tRTS may directly return the external error code, so we don't need transfer it. + if(EXTERNAL_ERROR != (trts_error >> MAIN_MOD_SHIFT)) + { + SE_TRACE(SE_TRACE_WARNING, "trts return error %x, it should be urts/trts bug\n", trts_error); + return SGX_ERROR_UNEXPECTED; + } + + return (sgx_status_t)trts_error; +} + +sgx_status_t CEnclave::ecall(const int proc, const void *ocall_table, void *ms) +{ + if(se_try_rdlock(&m_rwlock)) + { + //Maybe the enclave has been destroyed after acquire/release m_rwlock. See CEnclave::destroy() + if(m_destroyed) + { + se_rdunlock(&m_rwlock); + return SGX_ERROR_ENCLAVE_LOST; + } + + //do sgx_ecall + CTrustThread *trust_thread = get_tcs(); + unsigned ret = SGX_ERROR_OUT_OF_TCS; + + { + if(NULL != trust_thread) { + ret = do_ecall(proc, ocall_table, ms, trust_thread); + } + } + { + put_tcs(trust_thread); + + //release the read/write lock, the only exception is enclave already be removed in ocall + if(AbnormalTermination() || ret != SE_ERROR_READ_LOCK_FAIL) + { + se_rdunlock(&m_rwlock); + } + } + return error_trts2urts(ret); + } else { + return SGX_ERROR_ENCLAVE_LOST; + } +} + +int CEnclave::ocall(const unsigned int proc, const sgx_ocall_table_t *ocall_table, void *ms) +{ + int error = SGX_ERROR_UNEXPECTED; + + //validate the proc is within ocall_table; + if(NULL == ocall_table + || proc >= ocall_table->count) + { + return SGX_ERROR_INVALID_FUNCTION; + } + + se_rdunlock(&m_rwlock); + bridge_fn_t bridge = reinterpret_cast(ocall_table->ocall[proc]); + error = do_ocall(bridge, ms); + + if (!se_try_rdlock(&m_rwlock)) + { + //Probablly the enclave has been destroyed, so we can't get the read lock. + error = SE_ERROR_READ_LOCK_FAIL; + } + //We have m_destroyed to determinate if the enclave has been destroyed. + else if(m_destroyed) + { + //Enclave has been destroyed, emulate that we fail to get read lock. + se_rdunlock(&m_rwlock); + error = SE_ERROR_READ_LOCK_FAIL; + } + return error; +} + +const debug_enclave_info_t* CEnclave::get_debug_info() +{ + return &m_enclave_info; +} + + +CTrustThread * CEnclave::get_tcs() +{ + CTrustThread *trust_thread = m_thread_pool->acquire_thread(); + + return trust_thread; +} + +void CEnclave::put_tcs(CTrustThread *trust_thread) +{ + if(NULL == trust_thread) + { + return; + } + + m_thread_pool->release_thread(trust_thread); +} + +void CEnclave::destroy() +{ + se_wtlock(&m_rwlock); + //send debug event to debugger when enclave is debug mode or release mode + debug_enclave_info_t *debug_info = const_cast(get_debug_info()); + generate_enclave_debug_event(URTS_EXCEPTION_PREREMOVEENCLAVE, debug_info); + + get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL); + + m_destroyed = true; + //We are going to destory m_rwlock. At this point, maybe an ecall is in progress, and try to get m_rwlock. + //To prevent such ecall, we use m_destroyed to identify that the no ecall should going on. See CEnclave::ecall(...). + //For new ecall to the enclave, it will return with SGX_ERROR_INVALID_ENCLAVE_ID immediately. + se_wtunlock(&m_rwlock); + // We should not use loader to destroy encalve because loader has been removed after successful enclave loading + //m_loader.destroy_enclave(); +} + +void CEnclave::add_thread(tcs_t * const tcs) +{ + CTrustThread *trust_thread = m_thread_pool->add_thread(tcs, this); + insert_debug_tcs_info_head(&m_enclave_info, trust_thread->get_debug_info()); +} + +int CEnclave::set_extra_debug_info(secs_t& secs) +{ + void *g_peak_heap_used_addr = get_symbol_address("g_peak_heap_used"); + m_enclave_info.g_peak_heap_used_addr = g_peak_heap_used_addr; + m_enclave_info.start_addr = secs.base; + m_enclave_info.misc_select = secs.misc_select; + + if(g_peak_heap_used_addr == NULL) + { + SE_TRACE(SE_TRACE_DEBUG, "Symbol 'g_peak_heap_used' is not found\n"); + //This error should not break loader and debugger, so the upper layer function will ignore it. + return SGX_ERROR_INVALID_ENCLAVE; + } + return SGX_SUCCESS; +} + +void CEnclave::push_ocall_frame(ocall_frame_t* frame_point, CTrustThread *trust_thread) +{ + if(NULL == trust_thread) + { + return; + } + + trust_thread->push_ocall_frame(frame_point); +} + +void CEnclave::pop_ocall_frame(CTrustThread *trust_thread) +{ + if(NULL == trust_thread) + { + return; + } + + trust_thread->pop_ocall_frame(); +} + +CEnclavePool CEnclavePool::m_instance; +CEnclavePool::CEnclavePool() +{ + m_enclave_list = NULL; + se_mutex_init(&m_enclave_mutex); + SE_TRACE(SE_TRACE_NOTICE, "enter CEnclavePool constructor\n"); +} + +CEnclavePool *CEnclavePool::instance() +{ + return &m_instance; +} + +int CEnclavePool::add_enclave(CEnclave *enclave) +{ + int result = TRUE; + + se_mutex_lock(&m_enclave_mutex); + + if (m_enclave_list == NULL) { + m_enclave_list = new Node(enclave->get_enclave_id(), enclave); + } else { + Node* node = new Node(enclave->get_enclave_id(), enclave); + if (m_enclave_list->InsertNext(node) == false) { + delete node; + SE_TRACE(SE_TRACE_WARNING, "the encalve %llx has already been added\n", enclave->get_enclave_id()); + result = FALSE; + } + } + se_mutex_unlock(&m_enclave_mutex); + return result; +} + +CEnclave * CEnclavePool::get_enclave(const sgx_enclave_id_t enclave_id) +{ + se_mutex_lock(&m_enclave_mutex); + Node* it = m_enclave_list->Find(enclave_id); + if(it != NULL) + { + se_mutex_unlock(&m_enclave_mutex); + return it->value; + } + else + { + se_mutex_unlock(&m_enclave_mutex); + return NULL; + } +} + +CEnclave * CEnclavePool::ref_enclave(const sgx_enclave_id_t enclave_id) +{ + se_mutex_lock(&m_enclave_mutex); + Node* it = m_enclave_list->Find(enclave_id); + if(it != NULL) + { + it->value->atomic_inc_ref(); + se_mutex_unlock(&m_enclave_mutex); + return it->value; + } + else + { + se_mutex_unlock(&m_enclave_mutex); + return NULL; + } +} + +void CEnclavePool::unref_enclave(CEnclave *enclave) +{ + //We use enclave pool lock to protect data, the lock is big, but is more secure. + se_mutex_lock(&m_enclave_mutex); + //The ref is increased in ref_enclave; + uint32_t ref = enclave->atomic_dec_ref(); + + //If the enclave is in zombie state, the HW enclave must have been destroyed. + //And if the enclave is not referenced, the enclave instance will not be referenced any more, + //so we delete the instance. + //Another code path that delete enclave instance is in function "CEnclavePool::remove_enclave" + if(enclave->is_zombie() && !ref) + delete enclave; + + se_mutex_unlock(&m_enclave_mutex); +} + +se_handle_t CEnclavePool::get_event(const void * const tcs) +{ + se_handle_t hevent = NULL; + CEnclave *enclave = NULL; + + assert(tcs != NULL); + se_mutex_lock(&m_enclave_mutex); + + Node* it = m_enclave_list; + for(; it != NULL; it = it->next) + { + void *start = it->value->get_start_address(); + void *end = GET_PTR(void, start, it->value->get_size()); + + /* check start & end */ + if (tcs >= start && tcs < end) { + enclave = it->value; + break; + } + } + + if (NULL != enclave) + { + CTrustThreadPool *pool = enclave->get_thread_pool(); + if (pool != NULL) + { + CTrustThread *thread = pool->get_bound_thread((const tcs_t *)tcs); + if (thread != NULL) + hevent = thread->get_event(); + } + } + + se_mutex_unlock(&m_enclave_mutex); + return hevent; +} + +CEnclave* CEnclavePool::remove_enclave(const sgx_enclave_id_t enclave_id, sgx_status_t &status) +{ + status = SGX_SUCCESS; + se_mutex_lock(&m_enclave_mutex); + + CEnclave *enclave = get_enclave(enclave_id); + if(NULL == enclave) + { + status = SGX_ERROR_INVALID_ENCLAVE_ID; + SE_TRACE(SE_TRACE_WARNING, "remove an unkonwn enclave\n"); + se_mutex_unlock(&m_enclave_mutex); + return enclave; + } + + enclave->destroy(); + //the ref is not 0, maybe some thread is in sgx_ocall, so we can NOT delete enclave instance. + if(enclave->get_ref()) + { + enclave->mark_zombie(); + + /* When destroy the enclave, all threads that are waiting/about to wait + * on untrusted event need to be waked. Otherwise, they will be always + * pending on the untrusted events, and app need to manually kill the threads. + */ + CTrustThreadPool *pool = enclave->get_thread_pool(); + pool->wake_threads(); + + enclave = NULL; + } + Node* it = m_enclave_list->Remove(enclave_id); + if (it == m_enclave_list) + m_enclave_list = it->next; + delete it; + se_mutex_unlock(&m_enclave_mutex); + + return enclave; +} + +void CEnclavePool::notify_debugger() +{ + se_mutex_lock(&m_enclave_mutex); + if(m_enclave_list!= NULL) + { + Node* it = m_enclave_list; + for(; it != NULL; it = it->next) + { + //send debug event to debugger when enclave is debug mode or release mode + debug_enclave_info_t * debug_info = const_cast((it->value)->get_debug_info()); + generate_enclave_debug_event(URTS_EXCEPTION_PREREMOVEENCLAVE, debug_info); + } + } + se_mutex_unlock(&m_enclave_mutex); + +} + +bool CEnclave::update_trust_thread_debug_flag(void* tcs_address, uint8_t debug_flag) +{ + uint64_t debug_flag2 = (uint64_t)debug_flag; + debug_enclave_info_t *debug_info = NULL; + + debug_info = const_cast(get_debug_info()); + + pid_t pid = getpid(); + + if(debug_info->enclave_type == ET_DEBUG) + { + + if(!se_write_process_mem(pid, reinterpret_cast(tcs_address) + sizeof(uint64_t), &debug_flag2, sizeof(uint64_t), NULL)) + return FALSE; + + } + + return TRUE; +} + +bool CEnclave::update_debug_flag(uint8_t debug_flag) +{ + debug_tcs_info_t* tcs_list_entry = m_enclave_info.tcs_list; + + while(tcs_list_entry) + { + if(!update_trust_thread_debug_flag(tcs_list_entry->TCS_address, debug_flag)) + return FALSE; + + tcs_list_entry = tcs_list_entry->next_tcs_info; + } + + return TRUE; +} diff --git a/psw/urts/enclave.h b/psw/urts/enclave.h new file mode 100644 index 0000000000..c6957c0033 --- /dev/null +++ b/psw/urts/enclave.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ENCLAVE_H_ +#define _ENCLAVE_H_ + +#include "se_wrapper.h" +#include "tcs.h" +#include "create_param.h" +#include "sgx_eid.h" +#include "routine.h" +#include "loader.h" +#include "file.h" +#include "uncopyable.h" +#include "node.h" + +class CLoader; + +class CEnclave: private Uncopyable +{ +public: + explicit CEnclave(CLoader &ldr); + ~CEnclave(); + void* get_start_address(){ return m_start_addr;}; + void * get_symbol_address(const char * const symbol); + sgx_enclave_id_t get_enclave_id(); + CTrustThreadPool * get_thread_pool() { return m_thread_pool; } + uint64_t get_size() { return m_size; }; + sgx_status_t ecall(const int proc, const void *ocall_table, void *ms); + int ocall(const unsigned int proc, const sgx_ocall_table_t *ocall_table, void *ms); + void destroy(); + uint32_t atomic_inc_ref() { return se_atomic_inc(&m_ref); } + uint32_t atomic_dec_ref() { return se_atomic_dec(&m_ref); } + uint32_t get_ref() { return m_ref; } + void mark_zombie() { m_zombie = true; } + bool is_zombie() { return m_zombie; } + sgx_status_t initialize(const se_file_t& file, const sgx_enclave_id_t enclave_id, void * const start_addr, const uint64_t enclave_size, const uint32_t tcs_policy); + void add_thread(tcs_t * const tcs); + const debug_enclave_info_t* get_debug_info(); + void set_dbg_flag(bool dbg_flag) { m_dbg_flag = dbg_flag; } + bool get_dbg_flag() { return m_dbg_flag; } + int set_extra_debug_info(secs_t& secs); + //rdunlock is used in signal handler + void rdunlock() { se_rdunlock(&m_rwlock); } + void push_ocall_frame(ocall_frame_t* frame_point, CTrustThread *trust_thread); + void pop_ocall_frame(CTrustThread *trust_thread); + bool update_trust_thread_debug_flag(void*, uint8_t); + bool update_debug_flag(uint8_t); +private: + CTrustThread * get_tcs(); + void put_tcs(CTrustThread *trust_thread); + sgx_status_t error_trts2urts(unsigned int trts_error); + + CLoader &m_loader; + sgx_enclave_id_t m_enclave_id; + void *m_start_addr; + uint64_t m_size; + se_rwlock_t m_rwlock; + uint32_t m_power_event_flag; + uint32_t m_ref; + bool m_zombie; + CTrustThreadPool *m_thread_pool; + debug_enclave_info_t m_enclave_info; + bool m_dbg_flag; + bool m_destroyed; +}; + +class CEnclavePool: private Uncopyable +{ +public: + static CEnclavePool *instance(); + int add_enclave(CEnclave *enclave); + CEnclave * get_enclave(const sgx_enclave_id_t enclave_id); + CEnclave * ref_enclave(const sgx_enclave_id_t enclave_id); + void unref_enclave(CEnclave *enclave); + int get_symbol_ordinal(const sgx_enclave_id_t enclave_id, const char *symbol, int *ordinal); + CEnclave * remove_enclave(const sgx_enclave_id_t enclave_id, sgx_status_t &status); + se_handle_t get_event(const void * const); + void notify_debugger(); +private: + CEnclavePool(); + + Node *m_enclave_list; + se_mutex_t m_enclave_mutex; //sync for add/get/remove enclave. + static CEnclavePool m_instance; +}; + +#define AbnormalTermination() (FALSE) + +#endif diff --git a/psw/urts/enclave_creator_hw.h b/psw/urts/enclave_creator_hw.h new file mode 100644 index 0000000000..db176d976d --- /dev/null +++ b/psw/urts/enclave_creator_hw.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ENCLAVE_CREATOR_H_ +#define _ENCLAVE_CREATOR_H_ + +#include "enclave_creator.h" +#include "sgx_eid.h" +#include "se_types.h" +#include "se_thread.h" +#include "util.h" +#include "se_map.h" +#include "se_error_internal.h" +#include "se_lock.hpp" +#include "file.h" + +// hardware mode +class EnclaveCreatorHW : public EnclaveCreator +{ +public: + EnclaveCreatorHW(); + ~EnclaveCreatorHW(); + int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae); + int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr); + int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file); + int destroy_enclave(sgx_enclave_id_t enclave_id); + int initialize(sgx_enclave_id_t enclave_id); + bool use_se_hw() const; + int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag); + bool get_plat_cap(sgx_misc_attribute_t *se_attr); +private: + virtual bool open_se_device(); + virtual void close_se_device(); + int try_init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, token_t *launch); + int error_driver2urts(int driver_error); + se_file_handle_t m_hdevice; + Mutex m_dev_mutex; + bool m_sig_registered; + se_mutex_t m_sig_mutex; +}; + +#endif diff --git a/psw/urts/enclave_creator_hw_com.cpp b/psw/urts/enclave_creator_hw_com.cpp new file mode 100644 index 0000000000..51f22696df --- /dev/null +++ b/psw/urts/enclave_creator_hw_com.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#include "enclave.h" +#include "rts.h" +#include "routine.h" +#include "cpu_features.h" +#include "enclave_creator_hw.h" +#include "se_error_internal.h" +#include "prd_css_util.h" +#include "se_memcpy.h" + +bool EnclaveCreatorHW::use_se_hw() const +{ + return true; +} + +int EnclaveCreatorHW::initialize(sgx_enclave_id_t enclave_id) +{ + cpu_sdk_info_t info; + + CEnclave *enclave= CEnclavePool::instance()->get_enclave(enclave_id); + + if(enclave == NULL) + return SGX_ERROR_INVALID_ENCLAVE_ID; + + //Since CPUID instruction is NOT supported within enclave, we enumerate the cpu features here and send to tRTS. + info.cpu_features = 0; + get_cpu_features(&info.cpu_features); + info.version = SDK_VERSION_1_5; + + int status = enclave->ecall(ECMD_INIT_ENCLAVE, NULL, reinterpret_cast(&info)); + //free the tcs used by initialization; + enclave->get_thread_pool()->reset(); + + //Enclave initialization may fail caused by power transition. + //The upper layer code will re-create enclave based on SGX_ERROR_ENCLAVE_LOST. + if(SGX_SUCCESS == status || SGX_ERROR_ENCLAVE_LOST == status) + { + return status; + } + else + { + //For other error code, may be caused by tRTS bug, or caused by attacker, + //so we just return SGX_ERROR_UNEXPECTED. + SE_TRACE(SE_TRACE_WARNING, "initialize enclave failed\n"); + return SGX_ERROR_UNEXPECTED; + } +} + +int EnclaveCreatorHW::get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t debug_flag) +{ + sgx_attributes_t *required_attr = &metadata->attributes; + enclave_css_t *enclave_css = &metadata->enclave_css; + sgx_attributes_t *secs_attr = &sgx_misc_attr->secs_attr; + //fp, sse must be set. + uint64_t tmp = required_attr->xfrm & SGX_XFRM_LEGACY; + + if(SGX_XFRM_LEGACY != tmp) + { + SE_TRACE(SE_TRACE_WARNING, "fp/sse attributes is a must in attributes\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + //step 1, set enclave properties + sgx_misc_attribute_t se_cap; + if(!get_plat_cap(&se_cap)) + return SGX_ERROR_NO_DEVICE; + + if(debug_flag) + { + //If enclave is signed as product enclave, but is launched as debug enclave, we need report specific error code. + if((enclave_css->body.attribute_mask.flags & SGX_FLAGS_DEBUG) + && !(enclave_css->body.attributes.flags & SGX_FLAGS_DEBUG) + ) + { + return SGX_ERROR_NDEBUG_ENCLAVE; + } + required_attr->flags |= SGX_FLAGS_DEBUG; + } + else + required_attr->flags &= (~SGX_FLAGS_DEBUG); + + secs_attr->flags = required_attr->flags & se_cap.secs_attr.flags; + secs_attr->xfrm = required_attr->xfrm & se_cap.secs_attr.xfrm; + + + + + //step 3, evaluate the encalve attributes in secs. + + //check the signature structure xfrm attribute restrictions. + if((enclave_css->body.attribute_mask.xfrm & secs_attr->xfrm) + != (enclave_css->body.attribute_mask.xfrm & enclave_css->body.attributes.xfrm)) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes.xfrm does NOT match signature attributes.xfrm\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + //Debug bit has been checked before. For other attributes, check the signature structure flags attribute restrictions. + if((enclave_css->body.attribute_mask.flags & secs_attr->flags) + != (enclave_css->body.attribute_mask.flags & enclave_css->body.attributes.flags)) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes.flag does NOT match signature attributes.flag\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + // Check misc_select/misc_mask + // enclave_css->body.misc_select & enclave_css->body.misc_mask must be a subset of se_cap.misc_select + if(~(se_cap.misc_select) & (enclave_css->body.misc_select & enclave_css->body.misc_mask)) + return SGX_ERROR_INVALID_MISC; + + // try to use maximum ablity of cpu + sgx_misc_attr->misc_select = se_cap.misc_select & enclave_css->body.misc_select; + + if(lc != NULL) + { + // Read launch token from lc + sgx_launch_token_t token; + memset(&token, 0, sizeof(token)); + if(lc->get_launch_token(&token) != SGX_SUCCESS) + return SGX_ERROR_UNEXPECTED; + token_t *launch = (token_t *)token; + if(1 == launch->body.valid) + { + //debug launch enclave cannot launch production enclave + if( !(secs_attr->flags & SGX_FLAGS_DEBUG) + && (launch->attributes_le.flags & SGX_FLAGS_DEBUG) ) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes is non-debug, \n"); + return SE_ERROR_INVALID_LAUNCH_TOKEN; + } + //verify attributes in lictoken are the same as the enclave + if(memcmp(&launch->body.attributes, secs_attr, sizeof(sgx_attributes_t))) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes does NOT match launch token attributes\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + } + } + + return SGX_SUCCESS; +} + +int EnclaveCreatorHW::init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken * lc, le_prd_css_file_t *prd_css_file) +{ + unsigned int ret = 0; + sgx_launch_token_t token; + memset(token, 0, sizeof(sgx_launch_token_t)); + + enclave_css_t css; + memcpy_s(&css, sizeof(enclave_css_t), enclave_css, sizeof(enclave_css_t)); + + for(int i = 0; i < 2; i++) + { + if(SGX_SUCCESS != (ret = lc->get_launch_token(&token))) + return ret; + + ret = try_init_enclave(enclave_id, &css, reinterpret_cast(token)); + + if(i > 0) + return ret; + if(true == is_le(lc, &css)) + { + // LE is loaded with the interface sgx_create_le. + // Read the input prd css file and use it to init again. + if(SGX_ERROR_INVALID_ATTRIBUTE == ret && prd_css_file != NULL) { + if((ret = read_prd_css(prd_css_file->prd_css_name, &css)) != SGX_SUCCESS) + { + return ret; + } + + prd_css_file->is_used = true; + continue; + } + + // LE is loaded with the normal interface, or LE is loaded with sgx_create_le but EINIT returns other error code + // No need to get launch token and retry, so just return error code. + return ret; + } + + //If current launch token does NOT match the platform, then update the launch token. + //If the hash of signer (public key) in signature does not match launch token, EINIT will return SE_INVALID_MEASUREMENT + else if(!lc->is_launch_updated() && (SE_ERROR_INVALID_LAUNCH_TOKEN == ret || SGX_ERROR_INVALID_CPUSVN == ret || SE_ERROR_INVALID_MEASUREMENT == ret || SE_ERROR_INVALID_ISVSVNLE == ret)) + { + if(SGX_SUCCESS != (ret = lc->update_launch_token(true))) + { + return ret; + } + else + { + continue; + } + } + else + break; + } + return ret; + +} + diff --git a/psw/urts/enclave_mutex.cpp b/psw/urts/enclave_mutex.cpp new file mode 100644 index 0000000000..966e3a553a --- /dev/null +++ b/psw/urts/enclave_mutex.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_defs.h" +#include "enclave.h" +#include "se_event.h" + +#include "internal/se_error_internal.h" + +/* wait on untrusted event */ +extern "C" int sgx_thread_wait_untrusted_event_ocall(const void *self) +{ + if (self == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + se_handle_t hevent = CEnclavePool::instance()->get_event(self); + if (hevent == NULL) + return SE_ERROR_MUTEX_GET_EVENT; + + if (SE_MUTEX_SUCCESS != se_event_wait(hevent)) + return SE_ERROR_MUTEX_WAIT_EVENT; + + return SGX_SUCCESS; +} + +/* set untrusted event */ +extern "C" int sgx_thread_set_untrusted_event_ocall(const void *waiter) +{ + if (waiter == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + se_handle_t hevent = CEnclavePool::instance()->get_event(waiter); + if (hevent == NULL) + return SE_ERROR_MUTEX_GET_EVENT; + + if (SE_MUTEX_SUCCESS != se_event_wake(hevent)) + return SE_ERROR_MUTEX_WAKE_EVENT; + + return SGX_SUCCESS; +} + +extern "C" int sgx_thread_set_multiple_untrusted_events_ocall(const void **waiters, size_t total) +{ + if (waiters == NULL || *waiters == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + for (unsigned int i = 0; i < total; i++) { + se_handle_t hevent = CEnclavePool::instance()->get_event(*waiters++); + + if (hevent == NULL) + return SE_ERROR_MUTEX_GET_EVENT; + + if (SE_MUTEX_SUCCESS != se_event_wake(hevent)) + return SE_ERROR_MUTEX_WAKE_EVENT; + } + + return SGX_SUCCESS; +} + +extern "C" int sgx_thread_setwait_untrusted_events_ocall(const void *waiter, const void *self) +{ + int ret = sgx_thread_set_untrusted_event_ocall(waiter); + if (ret != SGX_SUCCESS) return ret; + + return sgx_thread_wait_untrusted_event_ocall(self); +} diff --git a/psw/urts/file.h b/psw/urts/file.h new file mode 100644 index 0000000000..d9ed257208 --- /dev/null +++ b/psw/urts/file.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _FILE_H_ +#define _FILE_H_ + +typedef char* prd_css_path_t; + +typedef struct _se_file_t { + void* name; + uint32_t name_len; + bool unicode; +} se_file_t; + +typedef struct _le_prd_css_file_t +{ + prd_css_path_t prd_css_name; + bool is_used; +} le_prd_css_file_t; + +#endif //_FILE_H_ diff --git a/psw/urts/launch_checker.cpp b/psw/urts/launch_checker.cpp new file mode 100644 index 0000000000..36ae1c2fba --- /dev/null +++ b/psw/urts/launch_checker.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include + +#include "se_memcpy.h" +#include "se_error_internal.h" +#include "uae_service_internal.h" +#include "launch_checker.h" + + +static unsigned int chk_launch_token( + const enclave_css_t *css, + const sgx_attributes_t *secs_attr, + const sgx_launch_token_t *tok) +{ + const token_t *launch = reinterpret_cast(tok); + + // Is it a valid launch_token? 0 = Invalid, 1 = Valid. + if(!launch->body.valid) + { + // For Non-Architectural Enclaves: HWVERSION = 0 + // Anyway, EINIT will return SE_INVALID_LAUNCH_TOKEN if the Enclave + // is not signed by intel key. + if(0 == css->header.hw_version) + { + // If the licese token is invalid, only intel key signed + // enclave can be lauched. + return (unsigned int)SE_ERROR_INVALID_LAUNCH_TOKEN; + } + else + { + // Don't need launch token for intel key signed enclave. + return (unsigned int)SGX_SUCCESS; + } + } + + // The MRENCLAVE should match the one in SIGSTRUCT. We must check + // it here, becaue EINIT will return SE_INVALID_MEASUREMENT for + // this case. + if(memcmp(&launch->body.mr_enclave, &css->body.enclave_hash, sizeof(sgx_measurement_t))) + { + return (unsigned int)SE_ERROR_INVALID_LAUNCH_TOKEN; + } + + // The ATTRIBUTES should match the attributes in SECS. + + + + if(memcmp(&launch->body.attributes, secs_attr, sizeof(sgx_attributes_t))) + { + return (unsigned int)SE_ERROR_INVALID_LAUNCH_TOKEN; + } + + // Other checks are done in get_secs_attr later. + return SGX_SUCCESS; +} + +SGXLaunchToken::SGXLaunchToken( + const enclave_css_t *css, + const sgx_attributes_t *secs_attr, + const sgx_launch_token_t *launch) + :m_css(css), m_secs_attr(secs_attr), m_launch_updated(false) +{ + memcpy_s(m_launch, sizeof(m_launch), launch, sizeof(m_launch)); +} + +bool SGXLaunchToken::is_launch_updated() const +{ + return m_launch_updated; +} + +sgx_status_t SGXLaunchToken::get_launch_token(sgx_launch_token_t *tok) const +{ + if (memcpy_s(tok, sizeof(m_launch), &m_launch, sizeof(m_launch))) + return SGX_ERROR_UNEXPECTED; + return SGX_SUCCESS; +} + +sgx_status_t SGXLaunchToken::update_launch_token( + bool force_update_tok) +{ + sgx_status_t status = SGX_SUCCESS; + + if (force_update_tok || + SE_ERROR_INVALID_LAUNCH_TOKEN == chk_launch_token(m_css, m_secs_attr, &m_launch)) + { + status = ::get_launch_token(m_css, m_secs_attr, &m_launch); + + if (status == SGX_SUCCESS) + m_launch_updated = true; + else + return status; + } + + return status; +} + + diff --git a/psw/urts/launch_checker.h b/psw/urts/launch_checker.h new file mode 100644 index 0000000000..eb592ff4cf --- /dev/null +++ b/psw/urts/launch_checker.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef launch_checker_h__ +#define launch_checker_h__ + +#include "uncopyable.h" +#include "sgx_error.h" +#include "arch.h" +#include "sgx_urts.h" + +class SGXLaunchToken : private Uncopyable { +public: + SGXLaunchToken( + const enclave_css_t *css, + const sgx_attributes_t *secs_attr, + const sgx_launch_token_t *launch); + + sgx_status_t update_launch_token( + bool force_update_tok); + sgx_status_t get_launch_token(sgx_launch_token_t *tok) const; + bool is_launch_updated() const; + +private: + const enclave_css_t *m_css; + const sgx_attributes_t *m_secs_attr; + sgx_launch_token_t m_launch; + bool m_launch_updated; +}; + +#endif + +/* vim: set et ts=4 sw=4 cin: */ diff --git a/psw/urts/linux/Makefile b/psw/urts/linux/Makefile new file mode 100644 index 0000000000..9c9e81cd1b --- /dev/null +++ b/psw/urts/linux/Makefile @@ -0,0 +1,147 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +ifndef DEBUG +CXXFLAGS += -DDISABLE_TRACE +CFLAGS += -DDISABLE_TRACE +endif + +CXXFLAGS += -fPIC -Werror +CXXFLAGS += $(ADDED_INC) + +CFLAGS += -fPIC -Werror +CFLAGS += $(ADDED_INC) + +VTUNE_DIR = $(LINUX_EXTERNAL_DIR)/vtune/linux + +INC += -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc/internal/linux \ + -I$(LINUX_PSW_DIR)/urts/ \ + -I$(LINUX_PSW_DIR)/urts/linux \ + -I$(LINUX_PSW_DIR)/urts/parser \ + -I$(VTUNE_DIR)/include \ + -I$(VTUNE_DIR)/sdk/src/ittnotify + +LDFLAGS := -lwrapper +LDFLAGS += -Wl,-Bdynamic -lsgx_uae_service + +LDFLAGS += -L$(VTUNE_DIR)/sdk/src/ittnotify -littnotify -ldl + +DIR1 := $(LINUX_PSW_DIR)/urts/linux +DIR2 := $(LINUX_PSW_DIR)/urts +DIR3 := $(LINUX_PSW_DIR)/urts/parser +DIR4 := $(LINUX_PSW_DIR)/urts/parser/linux + +LIB += -L$(COMMON_DIR)/se_wrapper \ + -L$(BUILD_DIR) + +OBJ1 := loader.o \ + node.o \ + se_detect.o \ + enclave.o \ + tcs.o \ + enclave_mutex.o \ + routine.o \ + urts_xsave.o \ + se_ocalls.o \ + cpu_features.o \ + launch_checker.o \ + urts_version.o \ + enclave_creator_hw_com.o + +OBJ2 := urts.o \ + enclave_creator_hw.o \ + misc.o \ + sig_handler.o \ + debugger_support.o \ + get_thread_id.o \ + prd_css_util.o + +OBJ3 := enter_enclave.o + +OBJ4 := section.o \ + elfparser.o + +OBJ5 := urts_internal.o + +CPP_OBJ := $(OBJ1) $(OBJ2) $(OBJ4) $(OBJ5) +URTS_OBJ := $(OBJ3) $(OBJ1) $(OBJ2) $(OBJ4) +INTERNAL_OBJ := $(OBJ3) $(CPP_OBJ) + + +vpath %.cpp $(DIR1):$(DIR2):$(DIR3):$(DIR4) + +LIBWRAPPER := libwrapper.a +LIBURTS := libsgx_urts.so +LIBURTS_INTERNAL := liburts_internal.a + +.PHONY: all +all: $(LIBWRAPPER) uae_service ittnotify $(LIBURTS) $(LIBURTS_INTERNAL) | $(BUILD_DIR) + @$(CP) $(LIBURTS) $| + @$(CP) $(LIBURTS_INTERNAL) $| + +$(LIBURTS_INTERNAL): $(INTERNAL_OBJ) + $(CP) $(COMMON_DIR)/se_wrapper/libwrapper.a $@ + $(AR) rcs $@ $^ + +$(LIBURTS): $(URTS_OBJ) + $(CXX) $(CXXFLAGS) -shared -Wl,-soname=$@ $(LIB) -o $@ $^ $(LDFLAGS) + +$(CPP_OBJ): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(INC) $< -o $@ + +$(OBJ3): %.o: %.S + $(CC) -c $(CFLAGS) $(INC) $< -o $@ + +$(LIBWRAPPER): + $(MAKE) -C $(COMMON_DIR)/se_wrapper/ + +.PHONY:uae_service +uae_service: + $(MAKE) -C $(LINUX_PSW_DIR)/uae_service/linux + +.PHONY: ittnotify +ittnotify: + $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean:: + @$(RM) *.o $(LIBURTS) $(LIBURTS_INTERNAL) + @$(RM) $(BUILD_DIR)/$(LIBURTS) $(BUILD_DIR)/$(LIBURTS_INTERNAL) + $(MAKE) -C $(COMMON_DIR)/se_wrapper/ clean + $(MAKE) -C $(LINUX_PSW_DIR)/uae_service/linux/ clean + $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify clean diff --git a/psw/urts/linux/debugger_support.cpp b/psw/urts/linux/debugger_support.cpp new file mode 100644 index 0000000000..3d91ea569d --- /dev/null +++ b/psw/urts/linux/debugger_support.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "debugger_support.h" +#include "se_trace.h" +#include "util.h" +#include "se_debugger_lib.h" + +#include "rts.h" +#include "thread_data.h" +#include "se_memory.h" +#include "enclave.h" +#include +#include +#include + +#define fastcall __attribute__((regparm(3))) + +extern "C" void fastcall sgx_debug_load_state_add_element(const debug_enclave_info_t *enclave_info, debug_enclave_info_t** g_debug_enclave_info_list); +extern "C" void fastcall sgx_debug_unload_state_remove_element(const debug_enclave_info_t *enclave_info, debug_enclave_info_t** pre_enclave_info, debug_enclave_info_t* next_enclave_info); + +static pthread_mutex_t g_debug_info_mutex = PTHREAD_MUTEX_INITIALIZER; +debug_enclave_info_t *g_debug_enclave_info_list = NULL; + +// There is no need to add lock here: +// This function only be called by CEnclave::add_thread and the enclave_info is a member +// of CEnclave instance. There is no race condition +void insert_debug_tcs_info_head(debug_enclave_info_t* enclave_info, debug_tcs_info_t* tcs_info) +{ + tcs_info->next_tcs_info = enclave_info->tcs_list; + enclave_info->tcs_list = tcs_info; +} + +static void insert_debug_info_head(debug_enclave_info_t *enclave_info) +{ + enclave_info->next_enclave_info = g_debug_enclave_info_list; + //g_debug_enclave_info_list = enclave_info; + //To avoid the race between attach event and load event, we set load event bp at where the list is changed + sgx_debug_load_state_add_element(enclave_info, &g_debug_enclave_info_list); +} + +static void remove_debug_info(debug_enclave_info_t *enclave_info) +{ + debug_enclave_info_t **pre_entry = &g_debug_enclave_info_list; + debug_enclave_info_t *cur = g_debug_enclave_info_list; + + while(cur) + { + if(cur == enclave_info) + { + //*pre_entry = cur->next_enclave_info; + //To avoid the race between attach event and unload event, we set unload event bp at where the list is changed + sgx_debug_unload_state_remove_element(enclave_info, pre_entry, cur->next_enclave_info); + break; + } + pre_entry = &cur->next_enclave_info; + cur = cur->next_enclave_info; + } +} + +void generate_enclave_debug_event(uint32_t code, const debug_enclave_info_t* enclave_info) +{ + if(URTS_EXCEPTION_POSTINITENCLAVE == code) + { + if(pthread_mutex_lock(&g_debug_info_mutex) != 0) + abort(); + insert_debug_info_head(const_cast(enclave_info)); + if(pthread_mutex_unlock(&g_debug_info_mutex) != 0) + abort(); + } + else if(URTS_EXCEPTION_PREREMOVEENCLAVE == code) + { + if(pthread_mutex_lock(&g_debug_info_mutex) != 0) + abort(); + remove_debug_info(const_cast(enclave_info)); + if(pthread_mutex_unlock(&g_debug_info_mutex) != 0) + abort(); + } +} + + +extern "C" void fastcall notify_gdb_to_update(void* base, tcs_t* tcs, uintptr_t of) +{ + UNUSED(base); + UNUSED(tcs); + UNUSED(of); +} + +extern "C" void push_ocall_frame(uintptr_t frame_point, tcs_t* tcs, CTrustThread *trust_thread) +{ + assert(trust_thread != NULL); + CEnclave* enclave = trust_thread->get_enclave(); + assert(enclave != NULL); + enclave->push_ocall_frame(container_of(frame_point, ocall_frame_t, xbp), trust_thread); + notify_gdb_to_update(enclave->get_start_address(), tcs, (uintptr_t)container_of(frame_point, ocall_frame_t, xbp)); +} + +extern "C" void pop_ocall_frame(tcs_t* tcs, CTrustThread *trust_thread) +{ + UNUSED(tcs); + assert(trust_thread != NULL); + CEnclave* enclave = trust_thread->get_enclave(); + assert(enclave != NULL); + enclave->pop_ocall_frame(trust_thread); +} diff --git a/psw/urts/linux/debugger_support.h b/psw/urts/linux/debugger_support.h new file mode 100644 index 0000000000..946012c75e --- /dev/null +++ b/psw/urts/linux/debugger_support.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _DEBUGGER_SUPPORT_H_ +#define _DEBUGGER_SUPPORT_H_ + +#include "se_debugger_lib.h" + + +void insert_debug_tcs_info_head(debug_enclave_info_t*, debug_tcs_info_t*); +void generate_enclave_debug_event(uint32_t code, const debug_enclave_info_t* enclave_info); + +#endif //_DEBUGGER_SUPPORT_H_ diff --git a/psw/urts/linux/enclave_creator_hw.cpp b/psw/urts/linux/enclave_creator_hw.cpp new file mode 100644 index 0000000000..10c80a94a2 --- /dev/null +++ b/psw/urts/linux/enclave_creator_hw.cpp @@ -0,0 +1,253 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "enclave_creator_hw.h" +#include "se_trace.h" +#include "se_page_attr.h" +#include "isgx_user.h" +#include "sig_handler.h" +#include "se_error_internal.h" +#include "se_memcpy.h" +#include "se_atomic.h" +#include "se_detect.h" +#include "cpuid.h" +#include +#include +#include +#include +#include +#include +#include +#include + + +EnclaveCreator* g_enclave_creator = new EnclaveCreatorHW(); +static uint32_t g_eid_low = 0x1; +static uint32_t g_eid_high = 0x0; + +EnclaveCreatorHW::EnclaveCreatorHW(): + m_hdevice(-1), + m_sig_registered(false) +{ + se_mutex_init(&m_sig_mutex); +} + +EnclaveCreatorHW::~EnclaveCreatorHW() +{ + close_se_device(); +} + +int EnclaveCreatorHW::error_driver2urts(int driver_error) +{ + int ret = SGX_ERROR_UNEXPECTED; + + switch(driver_error) + { + case ISGX_ERROR: + if(ENOMEM == errno) + ret = SGX_ERROR_OUT_OF_MEMORY; + else + ret = SGX_ERROR_NO_DEVICE; + break; + case ISGX_INVALID_ATTRIBUTE: + ret = SGX_ERROR_INVALID_ATTRIBUTE; + break; + case ISGX_INVALID_MEASUREMENT: + ret = SE_ERROR_INVALID_MEASUREMENT; + break; + case ISGX_INVALID_SIG_STRUCT: + case ISGX_INVALID_SIGNATIRE: + ret = SGX_ERROR_INVALID_SIGNATURE; + break; + case ISGX_INVALID_LAUNCH_TOKEN: + ret = SE_ERROR_INVALID_LAUNCH_TOKEN; + break; + case ISGX_INVALID_CPUSVN: + ret = SGX_ERROR_INVALID_CPUSVN; + break; + case ISGX_INVALID_ISVSVN: + ret = SGX_ERROR_INVALID_ISVSVN; + break; + case ISGX_UNMASKED_EVENT: + ret = SGX_ERROR_DEVICE_BUSY; + break; + case (int)ISGX_POWER_LOST_ENCLAVE: // [-Wc++11-narrowing] + ret = SGX_ERROR_ENCLAVE_LOST; + break; + default: + SE_TRACE(SE_TRACE_WARNING, "unexpected error %#x from driver, should be uRTS/driver bug\n", ret); + ret = SGX_ERROR_UNEXPECTED; + break; + } + + return ret; +} + +int EnclaveCreatorHW::create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae) +{ + assert(secs != NULL && enclave_id != NULL && start_addr != NULL); + UNUSED(ae); + + if (false == open_se_device()) + return SGX_ERROR_NO_DEVICE; + + SE_TRACE(SE_TRACE_DEBUG, "\n secs.attibutes.flags = %llx, secs.attributes.xfrm = %llx \n" + , secs->attributes.flags, secs->attributes.xfrm); + + struct isgx_create_param param = { secs, 0 }; + int ret = ioctl(m_hdevice, ISGX_IOCTL_ENCLAVE_CREATE, ¶m); + if(ret) { + SE_TRACE(SE_TRACE_WARNING, "\nISGX_IOCTL_ENCLAVE_CREATE fails: errno = %x\n", errno); + return error_driver2urts(ret); + } + uint32_t tmp = se_atomic_inc(&g_eid_low); + //32bit overflow + if(0 == tmp) + g_eid_high++; + *enclave_id = ((uint64_t)g_eid_high << 32) | g_eid_low; + *start_addr = secs->base = (void *)param.addr; + + return SGX_SUCCESS; +} + +int EnclaveCreatorHW::add_enclave_page(sgx_enclave_id_t enclave_id, void *src, uint64_t rva, const sec_info_t &sinfo, uint32_t attr) +{ + assert((rva & ((1<(&color_page); + } + + int ret = 0; + struct isgx_add_param addp = { 0, 0, 0, 0 }; + + addp.addr = (unsigned long)enclave_id + (unsigned long)rva; + addp.user_addr = reinterpret_cast(source); + addp.secinfo = (void *)const_cast(&sinfo); + if(!((1<(enclave_css); + //launch should NOT be NULL, because it has been checked in urts_com.h::_create_enclave(...) + assert(launch != NULL); + + initp.einittoken = reinterpret_cast(launch); + ret = ioctl(m_hdevice, ISGX_IOCTL_ENCLAVE_INIT, &initp); + if (ret) { + SE_TRACE(SE_TRACE_WARNING, "\nISGX_IOCTL_ENCLAVE_INIT fails error = %x\n", ret); + return error_driver2urts(ret); + } + + //register signal handler + se_mutex_lock(&m_sig_mutex); + if(false == m_sig_registered) + { + reg_sig_handler(); + m_sig_registered = true; + } + se_mutex_unlock(&m_sig_mutex); + + return SGX_SUCCESS; +} + +int EnclaveCreatorHW::destroy_enclave(sgx_enclave_id_t enclave_id) +{ + int ret = 0; + + isgx_destroy_param param = { (unsigned long)enclave_id }; + ret = ioctl(m_hdevice, ISGX_IOCTL_ENCLAVE_DESTROY, ¶m); + + if (-1 == ret) { + SE_TRACE(SE_TRACE_WARNING, "destroy SGX enclave failed, error = %d\n", errno); + ret = SGX_ERROR_UNEXPECTED; + } + else + { + ret = SGX_SUCCESS; + } + + return ret; +} + +bool EnclaveCreatorHW::get_plat_cap(sgx_misc_attribute_t *misc_attr) +{ + return get_plat_cap_by_cpuid(misc_attr); +} + + + +bool EnclaveCreatorHW::open_se_device() +{ + LockGuard lock(&m_dev_mutex); + int fd = -1; + + if(-1 != m_hdevice) + { + return true; + } + + fd = open("/dev/isgx", O_RDWR); + if (-1 == fd) { + SE_TRACE(SE_TRACE_WARNING, "open isgx device failed\n"); + return false; + } + m_hdevice = fd; + + return true; +} + +void EnclaveCreatorHW::close_se_device() +{ + LockGuard lock(&m_dev_mutex); + + if (m_hdevice != -1) + { + close(m_hdevice); + m_hdevice = -1; + } +} diff --git a/psw/urts/linux/enter_enclave.S b/psw/urts/linux/enter_enclave.S new file mode 100644 index 0000000000..3fb35543bc --- /dev/null +++ b/psw/urts/linux/enter_enclave.S @@ -0,0 +1,284 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "enter_enclave.h" + + +/* int __morestack(const tcs_t *tcs, const int fn, const void *ocall_table, const void *ms, CTrustThread *trust_thread); */ +.file "enter_enclave.S" +.text +DECLARE_GLOBAL_FUNC __morestack + +__morestack: +EENTER_PROLOG + movl frame_arg1, %edi /* fn */ +#if defined(__x86_64__) + /* we defined fn as int, so we do sign extend.*/ + movslq %edi, %rdi +#endif + mov frame_arg3, %xsi /* ms */ + +.Ldo_eenter: + mov frame_arg0, %xbx /* tcs addr */ + lea_pic .Lasync_exit_pointer, %xcx /* aep addr */ + mov $SE_EENTER, %xax /* EENTER leaf */ + +.Leenter_inst: + ENCLU + +/* + * at this point, we may have returned due to a normal EEXIT, + * or we may have returned due to an OCALL. We differentiate + * by popping the top of the stack. If it is not -1, we have + * an untrusted bridge to call at that address. + */ + +/* We have an ocall. Call our bridge function. */ + + cmp $OCMD_ERET, %xdi + je .Leret + +.Ldo_ocall: +/* call ocall + * int ocall(const unsigned int proc, void *ocall_table, const void *ms, CEnclave *enclave); + * + * When EEXIT'ed from tRTS due to an OCALL, + * - `rdi' holds OCALL index + *- `rsi' holds the pointer to marshalling structure + */ +.type sgx_ocall,@function +.hidden sgx_ocall +#if defined(__i386__) + sub $(3*SE_WORDSIZE), %xsp /* make stack 16 bytes aligned */ + push frame_arg0 + push frame_arg4 + push %esi + push frame_arg2 + push %edi +#endif + +#if defined(__x86_64__) + mov %rsi, %rdx /* param2 */ + /*mov %rdi, %rdi */ /* param0 */ + mov frame_arg2, %rsi /* param1 */ + mov frame_arg4, %rcx /* param3 */ + mov frame_arg0, %r8 /* param4 */ +#endif + + call stack_sticker + cmp $SE_ERROR_READ_LOCK_FAIL, %eax + je .Loret + mov $ECMD_ORET, %xdi /* oret */ + mov %xax, %xsi /* the result of ocall */ + jmp .Ldo_eenter + /* never return here */ + ud2 +.Leret: + mov %xsi, %xax +.Loret: + EENTER_EPILOG + +.Lasync_exit_pointer: + ENCLU + +.size __morestack, .-__morestack + + +DECLARE_GLOBAL_FUNC get_aep + lea_pic .Lasync_exit_pointer, %xax + ret + +DECLARE_GLOBAL_FUNC get_eenterp + lea_pic .Leenter_inst, %xax + ret + +DECLARE_GLOBAL_FUNC get_eretp + lea_pic .Leret, %xax + ret + +/* + * function stack_sticker is the wrapper of ocall, + * before call ocall, update the ret address and frame pointer (BP) on the stack + * + * Stack before: + * |__morestack stack |<--| + * ------------- | + * |return adress | | + * xbp -> | caller xbp | --| + * | | + * xsp -> | | + * ------------- + * + * Stack after: + * |__morestack stack | + * ------------------ + * | __morestack(inside)| + * xbp -> | xbp_t | ---->the frame point of __morestack + * | | + * xsp -> | | + * | | + * ------------------ + * int stack_sticker(unsigned int proc, sgx_ocall_table_t *ocall_table, void *ms, CTrustThread *trust_thread, tcs_t *tcs) + */ +DECLARE_GLOBAL_FUNC stack_sticker +.hidden stack_sticker +.type push_ocall_frame,@function +.hidden push_ocall_frame +.type pop_ocall_frame,@function +.hidden pop_ocall_frame +.cfi_startproc + push %xbp +.cfi_def_cfa_offset 2*SE_WORDSIZE +.cfi_offset xbp,-2*SE_WORDSIZE + mov %xsp, %xbp +.cfi_def_cfa_register xbp +#if defined(__i386__) + sub $(10*SE_WORDSIZE), %xsp /* We should have the stack 16 bytes aligned */ +#elif defined(__x86_64__) + sub $(10*SE_WORDSIZE), %xsp +#endif + + /* save the return address and the frame point */ + mov (0*SE_WORDSIZE)(%xbp), %xax + mov %xax, (4*SE_WORDSIZE)(%xsp) + mov (1*SE_WORDSIZE)(%xbp), %xax + mov %xax, (5*SE_WORDSIZE)(%xsp) + +#if defined(__i386__) + /* save the first 4 parameters */ + mov frame_arg0, %xax + mov %xax, (0*SE_WORDSIZE)(%xsp) + mov frame_arg1, %xax + mov %xax, (1*SE_WORDSIZE)(%xsp) + mov frame_arg2, %xax + mov %xax, (2*SE_WORDSIZE)(%xsp) + mov frame_arg3, %xax + mov %xax, (3*SE_WORDSIZE)(%xsp) + + /* update the frame infomation */ + mov frame_arg3, %xax /* the pointer of trustthread instance */ + push %xax + mov frame_arg4, %xax /* tcs */ + push %xax + push %xbp + /*just for call push_ocall_frame and return, no stack 16 bytes alignment needed */ + call push_ocall_frame + + /* recover parameters */ + add $(3*SE_WORDSIZE), %xsp +#elif defined(__x86_64__) + /* save the first 4 parameters */ + mov %xdi, (0*SE_WORDSIZE)(%xsp) + mov %xsi, (1*SE_WORDSIZE)(%xsp) + mov %xdx, (2*SE_WORDSIZE)(%xsp) + mov %xcx, (3*SE_WORDSIZE)(%xsp) + + /* update the frame infomation */ + mov %xcx, %xdx /* the pointer of trustthread instance */ + mov %r8, %xsi /* tcs */ + mov %xbp, %xdi + call push_ocall_frame + + /* recover parameters */ + mov (0*SE_WORDSIZE)(%xsp), %xdi + mov (1*SE_WORDSIZE)(%xsp), %xsi + mov (2*SE_WORDSIZE)(%xsp), %xdx + mov (3*SE_WORDSIZE)(%xsp), %xcx +#endif + + /* start the ocall */ + call sgx_ocall + + /* save the return value */ + mov %xax, (0*SE_WORDSIZE)(%xsp) + +#if defined(__i386__) + /* pop the frame infomation */ + mov frame_arg3, %xax /* the pointer of trustthread instance */ + push %xax + mov frame_arg4, %xax /* tcs is not used for now */ + push %xax + call pop_ocall_frame + + /* recover parameters */ + add $(2*SE_WORDSIZE), %xsp + +#elif defined(__x86_64__) + /* pop the frame infomation */ + mov (3*SE_WORDSIZE)(%xsp), %xsi /* the pointer of trustthread instance */ + call pop_ocall_frame +#endif + + /* recover the return address and frame point */ + mov (4*SE_WORDSIZE)(%xsp), %xax + mov %xax, (0*SE_WORDSIZE)(%xbp) + mov (5*SE_WORDSIZE)(%xsp), %xax + mov %xax, (1*SE_WORDSIZE)(%xbp) + + /* recover the return value */ + mov (0*SE_WORDSIZE)(%xsp), %xax + + leave + ret + .cfi_endproc + +/* + * void sgx_debug_load_state_add_element(debug_enclave_info_t* new_enclave_info, debug_enclave_info_t** g_debug_enclave_info_list) + * On x86, calling convention is "void sgx_debug_load_state_add_element(eax, edx)" + * On x64, calling convention is "void sgx_debug_load_state_add_element(rdi, rsi)" + * Add an new enclave info to list head and raise enclave load event + */ +DECLARE_GLOBAL_FUNC sgx_debug_load_state_add_element +#if defined(__i386__) + movl %eax, (%edx) +#else + movq %rdi, (%rsi) +#endif + ret + +/* + * void sgx_debug_unload_state_remove_element(debug_enclave_info_t* enclave_info, debug_enclave_info_t** pre_enclave_info, debug_enclave_info_t* next_enclave_info) + * On x86, calling convention is "void se_debug_load_state_remove_element(eax, edx, ecx)" + * On x64, calling convention is "void se_debug_load_state_remove_element(rdi, rsi, rdx)" + * eax is to pass the removed enclave info to debugger. + * Remove an enclave info from list and raise enclave unload event + */ +DECLARE_GLOBAL_FUNC sgx_debug_unload_state_remove_element +#if defined(__i386__) + movl %ecx, (%edx) +#else + movq %rdx, (%rsi) +#endif + ret + +/* We do not need executable stack.*/ +.section .note.GNU-stack,"",@progbits diff --git a/psw/urts/linux/enter_enclave.h b/psw/urts/linux/enter_enclave.h new file mode 100644 index 0000000000..fdd31b997f --- /dev/null +++ b/psw/urts/linux/enter_enclave.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* ------------------------------------------------------------ + * Normal function enter/leave wrappers. + * ------------------------------------------------------------ + */ + +#ifndef _ENTER_ENCLAVE_H_ +#define _ENTER_ENCLAVE_H_ + +#include "linux-regs.h" +#include "rts_cmd.h" + +/* macro for enter_enclave + * There is no .cfi_xxx to describe unwind information, because we want c++ exception can't across enclave boundary +*/ +.macro EENTER_PROLOG +push %xbp +mov %xsp, %xbp + +#if defined(__i386__) +push %ebx +push %esi +push %edi + +/* These 3 wordsize buffer are used for paddings, so that the + * stack-boundary can be kept 16-byte aligned. + * + * Note that, by default GCC assumes + * -mpreferred-stack-boundary=4 + * which results to 16 (2^4) byte alignment of stack boundary. + * + * | parameters | <- previous frame + * ==+================+====== + * | return address | ^ + * +----------------+ | + * | ebp | | + * +----------------+ 16 bytes <- current frame + * | ebx | | + * +----------------+ | + * | esi | v + * +----------------+ ---- + * | edi | 4 bytes + * +----------------+ + * | paddings | 3*4 bytes + * ==+================+====== + * | ENCLU | + */ +sub $(3 * SE_WORDSIZE), %esp + +#elif defined(__x86_64__) +push %rbx +push %r12 +push %r13 +push %r14 +push %r15 +/*save 5 parameter*/ +push %r8 +push %rcx +push %rdx +push %rsi +push %rdi +#else +# error unknown platform +#endif +.endm + +.macro EENTER_EPILOG +#if defined(__i386__) +mov -SE_WORDSIZE*1(%ebp), %ebx +mov -SE_WORDSIZE*2(%ebp), %esi +mov -SE_WORDSIZE*3(%ebp), %edi +#elif defined(__x86_64__) +mov -SE_WORDSIZE*1(%rbp), %rbx +mov -SE_WORDSIZE*2(%rbp), %r12 +mov -SE_WORDSIZE*3(%rbp), %r13 +mov -SE_WORDSIZE*4(%rbp), %r14 +mov -SE_WORDSIZE*5(%rbp), %r15 +#else +# error unknown platform +#endif +/* don't need recover rdi, rsi, rdx, rcx */ +mov %xbp, %xsp +pop %xbp +ret +.endm + +#if defined(__i386__) +#define frame_arg0 2*SE_WORDSIZE(%ebp) +#define frame_arg1 3*SE_WORDSIZE(%ebp) +#define frame_arg2 4*SE_WORDSIZE(%ebp) +#define frame_arg3 5*SE_WORDSIZE(%ebp) +#define frame_arg4 6*SE_WORDSIZE(%ebp) +#elif defined(__x86_64__) +#define frame_arg0 -10*SE_WORDSIZE(%rbp) +#define frame_arg1 -9*SE_WORDSIZE(%rbp) +#define frame_arg2 -8*SE_WORDSIZE(%rbp) +#define frame_arg3 -7*SE_WORDSIZE(%rbp) +#define frame_arg4 -6*SE_WORDSIZE(%rbp) +#else +# error unknown platform +#endif + +//refer sgx_error.h +#define SE_ERROR_READ_LOCK_FAIL 0xc0002202 + +#endif diff --git a/psw/urts/linux/get_thread_id.cpp b/psw/urts/linux/get_thread_id.cpp new file mode 100644 index 0000000000..acb760b079 --- /dev/null +++ b/psw/urts/linux/get_thread_id.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_thread.h" +#include + +static pthread_key_t g_tid_key; +static pthread_once_t g_key_once = PTHREAD_ONCE_INIT; + +static void create_key() +{ + pthread_key_create(&g_tid_key, NULL); +} + +se_thread_id_t get_thread_id() +{ + if(pthread_once(&g_key_once, create_key) != 0) + abort(); + + // If the key is invalid, pthread_getspecific will return NULL. + // No need to check the pthread_key_create and pthread_setspecific return value. + se_thread_id_t tid = (se_thread_id_t)(size_t)pthread_getspecific(g_tid_key); + + if( tid == 0) + { + tid = se_get_threadid(); + + // pthread_setspecific() shall fail if insufficient memory exists to associate the value + // with the key or the input key value is invalid. + // Here we don't check the return value. Then if pthread_setspecific fails in one ecall, + // the following ecall would call the syscall gettid to retrive the tid in one thread + // instead of returning SGX_ERROR_OUT_OF_TCS. + pthread_setspecific(g_tid_key, (void*)(size_t)tid); + } + return tid; +} diff --git a/psw/urts/linux/isgx_user.h b/psw/urts/linux/isgx_user.h new file mode 100644 index 0000000000..bee8016bcd --- /dev/null +++ b/psw/urts/linux/isgx_user.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _X86_ISGX_USER_H +#define _X86_ISGX_USER_H + +#include +#include +#include + +#define ISGX_IOCTL_ENCLAVE_CREATE _IOWR('p', 0x02, struct isgx_create_param) +#define ISGX_IOCTL_ENCLAVE_ADD_PAGE _IOW('p', 0x03, struct isgx_add_param) +#define ISGX_IOCTL_ENCLAVE_INIT _IOW('p', 0x04, struct isgx_init_param) +#define ISGX_IOCTL_ENCLAVE_DESTROY _IOW('p', 0x06, struct isgx_destroy_param) + +#define SECS_SIZE_OFFSET 0 +#define SECS_BASE_OFFSET (SECS_SIZE_OFFSET + 8) +#define SECS_FLAGS_OFFSET (SECS_BASE_OFFSET + 8) +#define SECS_SSAFRAMESIZE_OFFSET (SECS_SIZE_OFFSET + 164) + +/* SGX leaf instruction return values */ +#define ISGX_SUCCESS 0 +#define ISGX_ERROR -1 +#define ISGX_INVALID_SIG_STRUCT 0x1 +#define ISGX_INVALID_ATTRIBUTE 0x2 +#define ISGX_INVALID_MEASUREMENT 0x4 +#define ISGX_INVALID_SIGNATIRE 0x8 +#define ISGX_INVALID_LAUNCH_TOKEN 0x10 +#define ISGX_INVALID_CPUSVN 0x20 +#define ISGX_INVALID_ISVSVN 0x40 +#define ISGX_UNMASKED_EVENT 0x80 +#define ISGX_INVALID_KEYNAME 0x100 + +/* IOCTL return values */ +#define ISGX_OUT_OF_EPC_PAGES 0xc0000001 +#define ISGX_POWER_LOST_ENCLAVE 0xc0000002 + +/* SECINFO flags */ +#define ISGX_SECINFO_R 0x1 /* Read Access */ +#define ISGX_SECINFO_W 0x2 /* Write Access */ +#define ISGX_SECINFO_X 0x4 /* Execute Access */ +#define ISGX_SECINFO_SECS 0x000 /* SECS */ +#define ISGX_SECINFO_TCS 0x100 /* TCS */ +#define ISGX_SECINFO_REG 0x200 /* Regular Page */ + +struct isgx_secinfo { + __u64 flags; + __u64 reserved[7]; +}; + +struct isgx_create_param { + void *secs; + unsigned long addr; +}; + +#define ISGX_ADD_SKIP_EEXTEND 0x1 + +struct isgx_add_param { + unsigned long addr; + unsigned long user_addr; + void *secinfo; + unsigned int flags; +}; + +struct isgx_init_param { + unsigned long addr; + void *sigstruct; + void *einittoken; +}; + +struct isgx_destroy_param { + unsigned long addr; +}; + +#endif /* _X86_ISGX_USER_H */ diff --git a/psw/urts/linux/misc.cpp b/psw/urts/linux/misc.cpp new file mode 100644 index 0000000000..37f61318d8 --- /dev/null +++ b/psw/urts/linux/misc.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_wrapper.h" +#include +#include + +using namespace std; + +//get all thread id of current process. +void get_thread_set(vector &thread_vector) +{ + DIR* dir = NULL; + struct dirent* dirent = NULL; + + if(NULL == (dir = opendir("/proc/self/task"))) + { + SE_TRACE(SE_TRACE_WARNING, "Failed to open /proc/slef/task\n"); + } + else + { + while(NULL != (dirent=readdir(dir))) + { + se_thread_id_t tid = (se_thread_id_t)strtol(dirent->d_name, NULL, 10); + + if(!tid) continue; //dir name may be . or .. + thread_vector.push_back(tid); + SE_TRACE(SE_TRACE_DEBUG, "tid = %d\n", (int)tid); + } + closedir(dir); + } +} diff --git a/psw/urts/linux/read_xcr0.h b/psw/urts/linux/read_xcr0.h new file mode 100644 index 0000000000..7b786ea9e3 --- /dev/null +++ b/psw/urts/linux/read_xcr0.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _READ_XCR0_H_ +#define _READ_XCR0_H_ + +static inline uint64_t xgetbv(uint32_t index) +{ + uint32_t eax, edx; + + asm volatile(".byte 0x0f,0x01,0xd0" /* xgetbv */ + : "=a" (eax), "=d" (edx) + : "c" (index)); + return eax + ((uint64_t)edx << 32); +} + +static inline uint64_t read_xcr0() +{ + return xgetbv(0); +} + +#endif diff --git a/psw/urts/linux/sig_handler.cpp b/psw/urts/linux/sig_handler.cpp new file mode 100644 index 0000000000..8651538f2d --- /dev/null +++ b/psw/urts/linux/sig_handler.cpp @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "arch.h" +#include "sgx_error.h" +#include "tcs.h" +#include "se_trace.h" +#include "xsave.h" +#include "rts.h" +#include "enclave.h" +#include +#include +#include +#include + + +typedef struct _ecall_param_t +{ + tcs_t *tcs; + long fn; //long because we need register bandwith align on stack, refer to enter_enclave.h; + void *ocall_table; + void *ms; + CTrustThread *trust_thread; +} ecall_param_t; + +#ifdef __x86_64__ +#define REG_XIP REG_RIP +#define REG_XAX REG_RAX +#define REG_XBX REG_RBX +#define REG_XSI REG_RSI +#define REG_XBP REG_RBP +/* + * refer to enter_enclave.h + * stack high address <------------- + * |rip|rbp|rbx|r10|r13|r14|r15|r8|rcx|rdx|rsi|rdi| + * ^ ^ + * | <-rbp | <-param4 + */ +#define ECALL_PARAM (reinterpret_cast(context->uc_mcontext.gregs[REG_RBP] - 10 * 8)) +#else +#define REG_XIP REG_EIP +#define REG_XAX REG_EAX +#define REG_XBX REG_EBX +#define REG_XSI REG_ESI +#define REG_XBP REG_EBP +/* + * refer to enter_enclave.h + * stack high address <------------- + * |param4|param3|param2|param2|param0|eip|ebp| + * ^ + * | <-ebp + */ +#define ECALL_PARAM (reinterpret_cast(context->uc_mcontext.gregs[REG_EBP] + 2 * 4)) +#endif + +extern "C" void *get_aep(); +extern "C" void *get_eenterp(); +extern "C" void *get_eretp(); +static struct sigaction g_old_sigact[_NSIG]; + +void reg_sig_handler(); + +void sig_handler(int signum, siginfo_t* siginfo, void *priv) +{ + SE_TRACE(SE_TRACE_DEBUG, "signal handler is triggered\n"); + ucontext_t* context = reinterpret_cast(priv); + unsigned int *xip = reinterpret_cast(context->uc_mcontext.gregs[REG_XIP]); + size_t xax = context->uc_mcontext.gregs[REG_XAX]; +#ifndef NDEBUG + /* `xbx' is only used in assertions. */ + size_t xbx = context->uc_mcontext.gregs[REG_XBX]; +#endif + ecall_param_t *param = ECALL_PARAM; + + //the case of exception on ERESUME or within enclave. + //We can't distinguish ERESUME exception from exception within enclave. We assume it is the exception within enclave. + //If it is ERESUME exception, it will raise another exception in ecall and ecall will return error. + if(xip == get_aep() + && SE_ERESUME == xax) + { + assert(ENCLU == (*xip & 0xffffff)); + //suppose the exception is within enclave. + SE_TRACE(SE_TRACE_NOTICE, "exception on ERESUME\n"); + //The ecall looks recursively, but it will not cause infinite call. + //If exception is raised in trts again and again, the SSA will overflow, and finally it is EENTER exception. + assert(reinterpret_cast(xbx) == param->tcs); + CEnclave *enclave = param->trust_thread->get_enclave(); + unsigned int ret = enclave->ecall(ECMD_EXCEPT, param->ocall_table, NULL); + if(SGX_SUCCESS == ret) + { + //ERESUME execute + return; + } + //If the exception is caused by enclave lost or internal stack overrun, then return the error code to ecall caller elegantly. + else if(SGX_ERROR_ENCLAVE_LOST == ret || SGX_ERROR_STACK_OVERRUN == ret) + { + //enter_enlcave function will return with ret which is from tRTS; + context->uc_mcontext.gregs[REG_XIP] = reinterpret_cast(get_eretp()); + context->uc_mcontext.gregs[REG_XSI] = ret; + return; + } + //If we can't fix the exception within enclave, then give the handle to other signal hanlder. + //Call the previous signal handler. The default signal handler should terminate the application. + + enclave->rdunlock(); + CEnclavePool::instance()->unref_enclave(enclave); + } + //the case of exception on EENTER instruction. + else if(xip == get_eenterp() + && SE_EENTER == xax) + { + assert(reinterpret_cast(xbx) == param->tcs); + assert(ENCLU == (*xip & 0xffffff)); + SE_TRACE(SE_TRACE_NOTICE, "exception on EENTER\n"); + //enter_enlcave function will return with SE_ERROR_ENCLAVE_LOST + context->uc_mcontext.gregs[REG_XIP] = reinterpret_cast(get_eretp()); + context->uc_mcontext.gregs[REG_XSI] = SGX_ERROR_ENCLAVE_LOST; + return; + } + + SE_TRACE(SE_TRACE_DEBUG, "NOT enclave signal\n"); + //it is not SE exception. if the old signal handler is default signal handler, we reset signal handler. + //raise the signal again, and the default signal handler will be called. + if(SIG_DFL == g_old_sigact[signum].sa_handler) + { + signal(signum, SIG_DFL); + raise(signum); + } + //if there is old signal handler, we need transfer the signal to the old signal handler; + else + { + if(!(g_old_sigact[signum].sa_flags & SA_NODEFER)) + sigaddset(&g_old_sigact[signum].sa_mask, signum); + + sigset_t cur_set; + pthread_sigmask(SIG_SETMASK, &g_old_sigact[signum].sa_mask, &cur_set); + + if(g_old_sigact[signum].sa_flags & SA_SIGINFO) + { + g_old_sigact[signum].sa_sigaction(signum, siginfo, priv); + } + else + { + g_old_sigact[signum].sa_handler(signum); + } + + pthread_sigmask(SIG_SETMASK, &cur_set, NULL); + + //If the g_old_sigact set SA_RESETHAND, it will break the chain which means + //g_old_sigact->next_old_sigact will not be called. Our signal handler does not + //responsable for that. We just follow what os do on SA_RESETHAND. + if(g_old_sigact[signum].sa_flags & SA_RESETHAND) + g_old_sigact[signum].sa_handler = SIG_DFL; + } +} + +void reg_sig_handler() +{ + int ret = 0; + struct sigaction sig_act; + SE_TRACE(SE_TRACE_DEBUG, "signal handler is registered\n"); + + memset(&sig_act, 0, sizeof(sig_act)); + sig_act.sa_sigaction = sig_handler; + sig_act.sa_flags = SA_SIGINFO | SA_NODEFER | SA_RESTART; + sigemptyset(&sig_act.sa_mask); + if(sigprocmask(SIG_SETMASK, NULL, &sig_act.sa_mask)) + { + SE_TRACE(SE_TRACE_WARNING, "%s\n", strerror(errno)); + } + else + { + sigdelset(&sig_act.sa_mask, SIGSEGV); + sigdelset(&sig_act.sa_mask, SIGFPE); + sigdelset(&sig_act.sa_mask, SIGILL); + sigdelset(&sig_act.sa_mask, SIGBUS); + sigdelset(&sig_act.sa_mask, SIGTRAP); + } + + ret = sigaction(SIGSEGV, &sig_act, &g_old_sigact[SIGSEGV]); + if (0 != ret) abort(); + ret = sigaction(SIGFPE, &sig_act, &g_old_sigact[SIGFPE]); + if (0 != ret) abort(); + ret = sigaction(SIGILL, &sig_act, &g_old_sigact[SIGILL]); + if (0 != ret) abort(); + ret = sigaction(SIGBUS, &sig_act, &g_old_sigact[SIGBUS]); + if (0 != ret) abort(); + ret = sigaction(SIGTRAP, &sig_act, &g_old_sigact[SIGTRAP]); + if (0 != ret) abort(); +} + +//trust_thread is saved at stack for ocall. +#define enter_enclave __morestack + +extern "C" int enter_enclave(const tcs_t *tcs, const long fn, const void *ocall_table, const void *ms, CTrustThread *trust_thread); + +int do_ecall(const int fn, const void *ocall_table, const void *ms, CTrustThread *trust_thread) +{ + int status = SGX_ERROR_UNEXPECTED; + +#ifdef SE_SIM + CEnclave* enclave = trust_thread->get_enclave(); + //check if it is current pid, it is to simulate fork() scenario on HW + sgx_enclave_id_t eid = enclave->get_enclave_id(); + if((pid_t)(eid >> 32) != getpid()) + return SGX_ERROR_ENCLAVE_LOST; +#endif + + tcs_t *tcs = trust_thread->get_tcs(); + //seh_handler.cpp have the same code to save and restore pf register. + //put the save register code here, because we want remind maintainer we should do it near EENTER + uint8_t buffer[FXSAVE_SIZE]; + save_and_clean_xfeature_regs(buffer); + + status = enter_enclave(tcs, fn, ocall_table, ms, trust_thread); + + restore_xfeature_regs(buffer); + + return status; +} + +int do_ocall(const bridge_fn_t bridge, void *ms) +{ + int error = SGX_ERROR_UNEXPECTED; + + error = bridge(ms); + + save_and_clean_xfeature_regs(NULL); + + return error; +} diff --git a/psw/urts/linux/sig_handler.h b/psw/urts/linux/sig_handler.h new file mode 100644 index 0000000000..93acd4261c --- /dev/null +++ b/psw/urts/linux/sig_handler.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SIG_HANDLER_H_ +#define _SIG_HANDLER_H_ + +void reg_sig_handler(); + +#endif diff --git a/psw/urts/linux/urts.cpp b/psw/urts/linux/urts.cpp new file mode 100644 index 0000000000..4c2af4c365 --- /dev/null +++ b/psw/urts/linux/urts.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_error.h" +#include "sgx_urts.h" +#include "se_types.h" +#include +#include +#include + +#include "urts_com.h" +extern "C" sgx_status_t sgx_create_enclave(const char *file_name, const int debug, sgx_launch_token_t *launch_token, int *launch_token_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr) +{ + sgx_status_t ret = SGX_SUCCESS; + + //Only true or flase is valid + if(TRUE != debug && FALSE != debug) + return SGX_ERROR_INVALID_PARAMETER; + + int fd = open(file_name, O_RDONLY); + if(-1 == fd) + { + SE_TRACE(SE_TRACE_ERROR, "Couldn't open the enclave file, error = %d\n", errno); + return SGX_ERROR_ENCLAVE_FILE_ACCESS; + } + se_file_t file = {NULL, 0, false}; + char resolved_path[PATH_MAX]; + file.name = realpath(file_name, resolved_path); + file.name_len = (uint32_t)strlen(resolved_path); + + ret = _create_enclave(!!debug, fd, file, NULL, launch_token, launch_token_updated, enclave_id, misc_attr); + close(fd); + + return ret; +} diff --git a/psw/urts/linux/urts_internal.cpp b/psw/urts/linux/urts_internal.cpp new file mode 100644 index 0000000000..60ba21dfda --- /dev/null +++ b/psw/urts/linux/urts_internal.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_error.h" +#include "sgx_urts.h" +#include "se_types.h" +#include +#include +#include +#include "file.h" +#include "se_wrapper.h" +#include "se_map.h" + + +extern sgx_status_t _create_enclave(const bool debug, se_file_handle_t pfile, se_file_t& file, le_prd_css_file_t *prd_css_file, sgx_launch_token_t *launch, int *launch_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr); + +extern "C" sgx_status_t sgx_create_le(const char* file_name, const char* prd_css_file_name, const int debug, sgx_launch_token_t *launch_token, int *launch_token_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr, int *production_loaded) +{ + sgx_status_t ret = SGX_SUCCESS; + + //Only true or flase is valid + if(TRUE != debug && FALSE != debug) + return SGX_ERROR_INVALID_PARAMETER; + + int fd = open(file_name, O_RDONLY); + if(-1 == fd) + { + SE_TRACE(SE_TRACE_ERROR, "Couldn't open the enclave file, error = %d\n", errno); + return SGX_ERROR_ENCLAVE_FILE_ACCESS; + } + se_file_t file = {NULL, 0, false}; + char resolved_path[PATH_MAX]; + file.name = realpath(file_name, resolved_path); + file.name_len = (uint32_t)strlen(resolved_path); + + char css_real_path[PATH_MAX]; + + le_prd_css_file_t prd_css_file = {NULL, false}; + prd_css_file.prd_css_name = realpath(prd_css_file_name, css_real_path); + + ret = _create_enclave(!!debug, fd, file, &prd_css_file, launch_token, launch_token_updated, enclave_id, misc_attr); + close(fd); + if(ret == SGX_SUCCESS && production_loaded != NULL) + { + *production_loaded = prd_css_file.is_used ? 1: 0; + } + + return ret; +} diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp new file mode 100644 index 0000000000..01b61ce238 --- /dev/null +++ b/psw/urts/loader.cpp @@ -0,0 +1,779 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_wrapper.h" +#include "se_error_internal.h" +#include "arch.h" +#include "util.h" +#include "loader.h" +#include "se_page_attr.h" +#include "enclave.h" +#include "enclave_creator.h" +#include "routine.h" +#include "sgx_attributes.h" +#include "se_vendor.h" +#include "se_detect.h" +#include "binparser.h" +#include +#include +#include +#define __STDC_FORMAT_MACROS +#include +#include + +// enclave creator instance +extern EnclaveCreator* g_enclave_creator; + +EnclaveCreator* get_enclave_creator(void) +{ + return g_enclave_creator; +} + +CLoader::CLoader(uint8_t *mapped_file_base, BinParser &parser) + : m_mapped_file_base(mapped_file_base) + , m_enclave_id(0) + , m_start_addr(NULL) + , m_metadata(NULL) + , m_parser(parser) +{ + memset(&m_secs, 0, sizeof(m_secs)); +} + +CLoader::~CLoader() +{ + +} + +sgx_enclave_id_t CLoader::get_enclave_id() const +{ + return m_enclave_id; +} + +const void* CLoader::get_start_addr() const +{ + return m_start_addr; +} + +const std::vector& CLoader::get_tcs_list() const +{ + return m_tcs_list; +} + +const secs_t& CLoader::get_secs() const +{ + return m_secs; +} + +void* CLoader::get_symbol_address(const char * const symbol) +{ + uint64_t rva = m_parser.get_symbol_rva(symbol); + if(0 == rva) + return NULL; + return GET_PTR(void, m_start_addr, rva); +} + +int CLoader::build_mem_region(const section_info_t * const sec_info) +{ + int ret = SGX_SUCCESS; + uint8_t added_page[SE_PAGE_SIZE]; + uint64_t offset = 0; + uint8_t *raw_ptr = NULL; + uint64_t rva = 0; + sec_info_t sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + + rva = sec_info->rva + offset; + while(offset < TRIM_TO_PAGE(sec_info->raw_data_size)) + { + raw_ptr = sec_info->raw_data + offset; + sinfo.flags = sec_info->flag; + + //check if the page is writable. + if(sec_info->bitmap && sec_info->bitmap->size()) + { + uint64_t page_frame = rva >> SE_PAGE_SHIFT; + + //NOTE: + // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. + // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. + // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) + if((*sec_info->bitmap)[(size_t)(page_frame / 8)] & (1 << (page_frame % 8))) + sinfo.flags = sec_info->flag | SI_FLAG_W; + } + //call driver API to add page; raw_ptr needn't be page align, driver will handle page align; + if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, raw_ptr, rva, sinfo, ADD_EXTEND_PAGE))) + { + //if add page failed , we should remove enclave somewhere; + return ret; + } + offset += SE_PAGE_SIZE; + rva = sec_info->rva + offset; + } + //add the remaider of last page of raw data + if(!IS_PAGE_ALIGNED(sec_info->raw_data_size)) + { + sinfo.flags = sec_info->flag; + //the padding be 0 + memset(added_page, 0, SE_PAGE_SIZE); + raw_ptr = sec_info->raw_data + offset; + rva = sec_info->rva + offset; + memcpy_s(added_page, SE_PAGE_SIZE, raw_ptr, sec_info->raw_data_size & (SE_PAGE_SIZE-1)); + //check if the page is writable. + if(sec_info->bitmap && sec_info->bitmap->size()) + { + uint64_t page_frame = rva >> SE_PAGE_SHIFT; + //NOTE: + // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. + // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. + // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) + if((*sec_info->bitmap)[(size_t)(page_frame / 8)] & (1 << (page_frame % 8))) + sinfo.flags = sec_info->flag | SI_FLAG_W; + } + //call driver to add page; + if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, added_page, rva, sinfo, ADD_EXTEND_PAGE))) + { + //if add page failed , we should remove enclave somewhere; + return ret; + } + rva += SE_PAGE_SIZE; + } + //add unintialized page.If the section have no raw data, the offset should be 0. + if(ROUND_TO_PAGE(sec_info->virtual_size) > ROUND_TO_PAGE(sec_info->raw_data_size)) + { + size_t size = (size_t)(ROUND_TO_PAGE(sec_info->virtual_size) - ROUND_TO_PAGE(sec_info->raw_data_size)); + sinfo.flags = sec_info->flag; + if(SGX_SUCCESS != (ret = build_pages(rva, size, 0, sinfo, ADD_EXTEND_PAGE))) + return ret; + } + + return SGX_SUCCESS; +} + +int CLoader::build_sections(vector *bitmap) +{ + int ret = SGX_SUCCESS; + std::vector sections = m_parser.get_sections(); + + for(unsigned int i = 0; i < sections.size() ; i++) + { + //since build_mem_region require the sec_info.rva be page aligned, we need handle the first page. + //build the first page; + uint64_t offset = (sections[i]->get_rva() & (SE_PAGE_SIZE -1)); + uint64_t size = SE_PAGE_SIZE - offset; + uint8_t first_page[SE_PAGE_SIZE]; + //the raw data may be smaller than the size, we get the min of them + if(sections[i]->raw_data_size() < size) + size = sections[i]->raw_data_size(); + //the padding is '0' + memset(first_page, 0, SE_PAGE_SIZE); + memcpy_s(&first_page[offset], (size_t)size, sections[i]->raw_data(), (size_t)size); + section_info_t sec_info = { first_page, SE_PAGE_SIZE, sections[i]->get_rva() & (~(SE_PAGE_SIZE - 1)), SE_PAGE_SIZE, sections[i]->get_si_flags(), bitmap }; + + if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) + { + return ret; + } + //if there is more pages, then build the next paged aligned pages + if((sections[i]->virtual_size() + offset) > SE_PAGE_SIZE) + { + sec_info.raw_data = GET_PTR(uint8_t, sections[i]->raw_data(), size); + sec_info.raw_data_size = sections[i]->raw_data_size() - size; + sec_info.rva = sections[i]->get_rva() + (SE_PAGE_SIZE - offset); + assert(0 == (sec_info.rva & (SE_PAGE_SIZE - 1))); + //we need use (SE_PAGE_SIZE - offset), because (SE_PAGE_SIZE - offset) may larger than size + sec_info.virtual_size = sections[i]->virtual_size() - (SE_PAGE_SIZE - offset); + sec_info.flag = sections[i]->get_si_flags(); + sec_info.bitmap = bitmap; + if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) + { + return ret; + } + } + } + + return SGX_SUCCESS; +} + +int CLoader::build_pages(const uint64_t start_rva, const uint64_t size, void *source, const sec_info_t &sinfo, const uint32_t attr) +{ + int ret = SGX_SUCCESS; + uint64_t offset = 0; + uint64_t rva = start_rva; + + while(offset < size) + { + //call driver to add page; + if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, source, rva, sinfo, attr))) + { + //if add page failed , we should remove enclave somewhere; + return ret; + } + offset += SE_PAGE_SIZE; + rva += SE_PAGE_SIZE; + } + + return SGX_SUCCESS; +} +int CLoader::build_context(const uint64_t start_rva, layout_entry_t *layout) +{ + int ret = SGX_ERROR_UNEXPECTED; + uint8_t added_page[SE_PAGE_SIZE]; + sec_info_t sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + uint64_t rva = start_rva + layout->rva; + + if (layout->content_offset) + { + // assume TCS is only 1 page + if(layout->si_flags == SI_FLAGS_TCS) + { + memset(added_page, 0, SE_PAGE_SIZE); + memcpy_s(added_page, SE_PAGE_SIZE, GET_PTR(uint8_t, m_metadata, layout->content_offset), layout->content_size); + + tcs_t *ptcs = reinterpret_cast(added_page); + ptcs->ossa += rva; + ptcs->ofs_base += rva; + ptcs->ogs_base += rva; + m_tcs_list.push_back(GET_PTR(tcs_t, m_start_addr, rva)); + sinfo.flags = layout->si_flags; + if(SGX_SUCCESS != (ret = build_pages(rva, layout->page_count << SE_PAGE_SHIFT, added_page, sinfo, layout->attributes))) + { + return ret; + } + } + else // guard page should not have content_offset != 0 + { + section_info_t sec_info = {GET_PTR(uint8_t, m_metadata, layout->content_offset), layout->content_size, rva, layout->page_count << SE_PAGE_SHIFT, layout->si_flags, NULL}; + if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) + { + return ret; + } + } + } + else if (layout->si_flags != SI_FLAG_NONE) + { + sinfo.flags = layout->si_flags; + + void *source = NULL; + if(layout->content_size) + { + for(uint32_t *p = (uint32_t *)added_page; p < GET_PTR(uint32_t, added_page, SE_PAGE_SIZE); p++) + { + *p = layout->content_size; + } + source = added_page; + } + if(SGX_SUCCESS != (ret = build_pages(rva, layout->page_count << SE_PAGE_SHIFT, source, sinfo, layout->attributes))) + { + return ret; + } + } + return SGX_SUCCESS; +} +int CLoader::build_contexts(layout_t *layout_start, layout_t *layout_end, uint64_t delta) +{ + int ret = SGX_ERROR_UNEXPECTED; + for(layout_t *layout = layout_start; layout < layout_end; layout++) + { + if (!IS_GROUP_ID(layout->group.id)) + { + if(SGX_SUCCESS != (ret = build_context(delta, &layout->entry))) + { + return ret; + } + } + else + { + uint64_t step = 0; + for(uint32_t j = 0; j < layout->group.load_times; j++) + { + step += layout->group.load_step; + if(SGX_SUCCESS != (ret = build_contexts(&layout[-layout->group.entry_count], layout, step))) + { + return ret; + } + } + } + } + return SGX_SUCCESS; +} +int CLoader::build_secs(sgx_attributes_t * const secs_attr, sgx_misc_attribute_t * const misc_attr) +{ + memset(&m_secs, 0, sizeof(secs_t)); //should set resvered field of secs as 0. + //create secs structure. + m_secs.base = 0; //base is allocated by driver. set it as 0 + m_secs.size = m_metadata->enclave_size; + m_secs.misc_select = misc_attr->misc_select; + + memcpy_s(&m_secs.attributes, sizeof(m_secs.attributes), secs_attr, sizeof(m_secs.attributes)); + m_secs.ssa_frame_size = m_metadata->ssa_frame_size; + + EnclaveCreator *enclave_creator = get_enclave_creator(); + if(NULL == enclave_creator) + return SGX_ERROR_UNEXPECTED; + int ret = enclave_creator->create_enclave(&m_secs, &m_enclave_id, &m_start_addr, is_ae(&m_metadata->enclave_css)); + if(SGX_SUCCESS == ret) + { + SE_TRACE(SE_TRACE_NOTICE, "enclave start address = %p, size = %x\n", m_start_addr, m_metadata->enclave_size); + } + return ret; +} +int CLoader::build_image(SGXLaunchToken * const lc, sgx_attributes_t * const secs_attr, le_prd_css_file_t *prd_css_file, sgx_misc_attribute_t * const misc_attr) +{ + int ret = SGX_SUCCESS; + + if(SGX_SUCCESS != (ret = build_secs(secs_attr, misc_attr))) + { + SE_TRACE(SE_TRACE_WARNING, "build secs failed\n"); + return ret; + }; + // read reloc bitmap before patch the enclave file + // If load_enclave_ex try to load the enclave for the 2nd time, + // the enclave image is already patched, and parser cannot read the information. + // For linux, there's no map conflict. We assume load_enclave_ex will not do the retry. + vector bitmap; + if(!m_parser.get_reloc_bitmap(bitmap)) + return SGX_ERROR_INVALID_ENCLAVE; + + // patch enclave file + patch_entry_t *patch_start = GET_PTR(patch_entry_t, m_metadata, m_metadata->dirs[DIR_PATCH].offset); + patch_entry_t *patch_end = GET_PTR(patch_entry_t, m_metadata, m_metadata->dirs[DIR_PATCH].offset + m_metadata->dirs[DIR_PATCH].size); + for(patch_entry_t *patch = patch_start; patch < patch_end; patch++) + { + memcpy_s(GET_PTR(void, m_parser.get_start_addr(), patch->dst), patch->size, GET_PTR(void, m_metadata, patch->src), patch->size); + } + + //build sections, copy export function table as well; + if(SGX_SUCCESS != (ret = build_sections(&bitmap))) + { + SE_TRACE(SE_TRACE_WARNING, "build sections failed\n"); + goto fail; + } + + // build heap/thread context + if (SGX_SUCCESS != (ret = build_contexts(GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset), + GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset + m_metadata->dirs[DIR_LAYOUT].size), + 0))) + { + SE_TRACE(SE_TRACE_WARNING, "build heap/thread context failed\n"); + goto fail; + } + + //initialize Enclave + ret = get_enclave_creator()->init_enclave(ENCLAVE_ID_IOCTL, const_cast(&m_metadata->enclave_css), lc, prd_css_file); + if(SGX_SUCCESS != ret) + { + SE_TRACE(SE_TRACE_WARNING, "init_enclave failed\n"); + goto fail; + } + + return SGX_SUCCESS; + +fail: + get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL); + + return ret; +} +bool CLoader::is_metadata_buffer(uint32_t offset, uint32_t size) +{ + if((offsetof(metadata_t, data) > offset) || (offset >= m_metadata->size)) + { + return false; + } + uint32_t end = offset + size; + if ((end < offset) || (end < size) || (end > m_metadata->size)) + { + return false; + } + return true; +} +bool CLoader::is_enclave_buffer(uint64_t offset, uint64_t size) +{ + if(offset >= m_metadata->enclave_size) + { + return false; + } + uint64_t end = offset + size; + if ((end < offset) || (end < size) || (end > m_metadata->enclave_size)) + { + return false; + } + return true; +} +int CLoader::validate_layout_table() +{ + layout_t *layout_start = GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset); + layout_t *layout_end = GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset + m_metadata->dirs[DIR_LAYOUT].size); + vector> rva_vector; + for (layout_t *layout = layout_start; layout < layout_end; layout++) + { + if(!IS_GROUP_ID(layout->entry.id)) // layout entry + { + rva_vector.push_back(make_pair(layout->entry.rva, layout->entry.page_count << SE_PAGE_SHIFT)); + if(layout->entry.content_offset) + { + if(false == is_metadata_buffer(layout->entry.content_offset, layout->entry.content_size)) + { + return SGX_ERROR_INVALID_METADATA; + } + } + } + else // layout group + { + if (layout->group.entry_count > (uint32_t)(PTR_DIFF(layout, layout_start)/sizeof(layout_t))) + { + return SGX_ERROR_INVALID_METADATA; + } + uint64_t load_step = 0; + for(uint32_t i = 0; i < layout->group.load_times; i++) + { + load_step += layout->group.load_step; + if(load_step > m_metadata->enclave_size) + { + return SGX_ERROR_INVALID_METADATA; + } + for(layout_entry_t *entry = &layout[-layout->group.entry_count].entry; entry < &layout->entry; entry++) + { + if(IS_GROUP_ID(entry->id)) + { + return SGX_ERROR_INVALID_METADATA; + } + rva_vector.push_back(make_pair(entry->rva + load_step, entry->page_count << SE_PAGE_SHIFT)); + // no need to check integer overflow for entry->rva + load_step, because + // entry->rva and load_step are less than enclave_size, whose size is no more than 37 bit + } + } + } + } + sort(rva_vector.begin(), rva_vector.end()); + for (vector>::iterator it = rva_vector.begin(); it != rva_vector.end(); it++) + { + if(!IS_PAGE_ALIGNED(it->first)) + { + return SGX_ERROR_INVALID_METADATA; + } + if(false == is_enclave_buffer(it->first, it->second)) + { + return SGX_ERROR_INVALID_METADATA; + } + if((it+1) != rva_vector.end()) + { + if((it->first+it->second) > (it+1)->first) + { + return SGX_ERROR_INVALID_METADATA; + } + } + } + return SGX_SUCCESS; +} + +int CLoader::validate_patch_table() +{ + patch_entry_t *patch_start = GET_PTR(patch_entry_t, m_metadata, m_metadata->dirs[DIR_PATCH].offset); + patch_entry_t *patch_end = GET_PTR(patch_entry_t, m_metadata, m_metadata->dirs[DIR_PATCH].offset + m_metadata->dirs[DIR_PATCH].size); + for(patch_entry_t *patch = patch_start; patch < patch_end; patch++) + { + if(false == is_metadata_buffer(patch->src, patch->size)) + { + return SGX_ERROR_INVALID_METADATA; + } + if(false == is_enclave_buffer(patch->dst, patch->size)) + { + return SGX_ERROR_INVALID_METADATA; + } + } + return SGX_SUCCESS; +} +int CLoader::validate_metadata() +{ + if(!m_metadata) + return SGX_ERROR_INVALID_METADATA; + uint64_t version = META_DATA_MAKE_VERSION(MAJOR_VERSION,MINOR_VERSION ); + //if the version of metadata does NOT match the version of metadata in urts, we should NOT launch enclave. + if(m_metadata->version != version) + { + SE_TRACE(SE_TRACE_WARNING, "Mismatch between the metadata urts required and the metadata in use.\n"); + return SGX_ERROR_INVALID_VERSION; + } + if(m_metadata->size > sizeof(metadata_t)) + { + return SGX_ERROR_INVALID_METADATA; + } + if(m_metadata->tcs_policy > TCS_POLICY_UNBIND) + return SGX_ERROR_INVALID_METADATA; + if(m_metadata->ssa_frame_size < SSA_FRAME_SIZE_MIN || m_metadata->ssa_frame_size > SSA_FRAME_SIZE_MAX) + return SGX_ERROR_INVALID_METADATA; + uint64_t size = m_metadata->enclave_size; + if(size > m_parser.get_enclave_max_size()) + { + return SGX_ERROR_INVALID_METADATA; + } + while ((size != 0) && ((size & 1) != 1)) + { + size = size >> 1; + } + if(size != 1) + { + return SGX_ERROR_INVALID_METADATA; + } + + // check dirs + for(uint32_t i = 0; i < DIR_NUM; i++) + { + if(false == is_metadata_buffer(m_metadata->dirs[i].offset, m_metadata->dirs[i].size)) + { + return SGX_ERROR_INVALID_METADATA; + } + } + // check layout table + int status = validate_layout_table(); + if(SGX_SUCCESS != status) + { + return status; + } + // check patch table + status = validate_patch_table(); + if(SGX_SUCCESS != status) + { + return status; + } + + return SGX_SUCCESS; +} + +bool CLoader::is_ae(const enclave_css_t *enclave_css) +{ + assert(NULL != enclave_css); + + if(INTEL_VENDOR_ID == enclave_css->header.module_vendor + && AE_PRODUCT_ID == enclave_css->body.isv_prod_id) + return true; + + return false; +} + +int CLoader::load_enclave(SGXLaunchToken *lc, int debug, const metadata_t *metadata, le_prd_css_file_t *prd_css_file, sgx_misc_attribute_t *misc_attr) +{ + int ret = SGX_SUCCESS; + sgx_misc_attribute_t sgx_misc_attr; + memset(&sgx_misc_attr, 0, sizeof(sgx_misc_attribute_t)); + + m_metadata = metadata; + ret = validate_metadata(); + if(SGX_SUCCESS != ret) + { + SE_TRACE(SE_TRACE_ERROR, "The metadata setting is not correct\n"); + return ret; + } + + ret = get_enclave_creator()->get_misc_attr(&sgx_misc_attr, const_cast(m_metadata), lc, debug); + if(SGX_SUCCESS != ret) + { + return ret; + } + + ret = build_image(lc, &sgx_misc_attr.secs_attr, prd_css_file, &sgx_misc_attr); + //return platform capability if fail. Otherwise, return secs.attr. + if(SGX_SUCCESS == ret) + { + if(misc_attr) + { + memcpy_s(misc_attr, sizeof(sgx_misc_attribute_t), &sgx_misc_attr, sizeof(sgx_misc_attribute_t)); + //When run here EINIT success, so SGX_FLAGS_INITTED should be set by ucode. uRTS align it with EINIT instruction. + misc_attr->secs_attr.flags |= SGX_FLAGS_INITTED; + } + } + else + { + if(misc_attr) + { + sgx_misc_attribute_t plat_cap; + memset(&plat_cap, 0, sizeof(plat_cap)); + get_enclave_creator()->get_plat_cap(&plat_cap); + memcpy_s(misc_attr, sizeof(sgx_misc_attribute_t), &plat_cap, sizeof(sgx_misc_attribute_t)); + } + } + + return ret; +} + +int CLoader::load_enclave_ex(SGXLaunchToken *lc, bool debug, const metadata_t *metadata, le_prd_css_file_t *prd_css_file, sgx_misc_attribute_t *misc_attr) +{ + unsigned int ret = SGX_SUCCESS, map_conflict_count = 3; + bool retry = true; + + while (retry) + { + ret = this->load_enclave(lc, debug, metadata, prd_css_file, misc_attr); + switch(ret) + { + //If CreateEnclave failed due to power transition, we retry it. + case SGX_ERROR_ENCLAVE_LOST: //caused by loading enclave while power transition occurs + break; + + //If memroy map conflict occurs, we only retry 3 times. + case SGX_ERROR_MEMORY_MAP_CONFLICT: + if(0 == map_conflict_count) + retry = false; + else + map_conflict_count--; + break; + + //We don't re-load enclave due to other error code. + default: + retry = false; + break; + } + } + + return ret; +} + +int CLoader::destroy_enclave() +{ + return get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL); +} + +int CLoader::set_memory_protection() +{ + + uint64_t rva = 0; + uint64_t len = 0; + uint64_t last_section_end = 0; + unsigned int i = 0; + int ret = 0; + //for sections + std::vector sections = m_parser.get_sections(); + + for(i = 0; i < sections.size() ; i++) + { + //require the sec_info.rva be page aligned, we need handle the first page. + //the first page; + uint64_t offset = (sections[i]->get_rva() & (SE_PAGE_SIZE -1)); + uint64_t size = SE_PAGE_SIZE - offset; + + //the raw data may be smaller than the size, we get the min of them + if(sections[i]->raw_data_size() < size) + size = sections[i]->raw_data_size(); + + len = SE_PAGE_SIZE; + + //if there is more pages, then calc the next paged aligned pages + if((sections[i]->virtual_size() + offset) > SE_PAGE_SIZE) + { + uint64_t raw_data_size = sections[i]->raw_data_size() - size; + //we need use (SE_PAGE_SIZE - offset), because (SE_PAGE_SIZE - offset) may larger than size + uint64_t virtual_size = sections[i]->virtual_size() - (SE_PAGE_SIZE - offset); + len += ROUND_TO_PAGE(raw_data_size); + + if(ROUND_TO_PAGE(virtual_size) > ROUND_TO_PAGE(raw_data_size)) + { + len += ROUND_TO_PAGE(virtual_size) - ROUND_TO_PAGE(raw_data_size); + } + } + rva = TRIM_TO_PAGE(sections[i]->get_rva()) + (uint64_t)m_start_addr; + ret = mprotect((void*)rva, (size_t)len, (int)(sections[i]->get_si_flags()&SI_MASK_MEM_ATTRIBUTE)); + if(ret != 0) + { + SE_TRACE(SE_TRACE_WARNING, "section[%d]:mprotect(rva=%" PRIu64 ", len=%" PRIu64 ", flags=%" PRIu64 ") failed\n", + i, rva, len, (sections[i]->get_si_flags())); + return SGX_ERROR_UNEXPECTED; + } + //there is a gap between sections, need to set those to NONE access + if(last_section_end != 0) + { + ret = mprotect((void*)last_section_end, (size_t)(rva - last_section_end), (int)(SI_FLAG_NONE & SI_MASK_MEM_ATTRIBUTE)); + if(ret != 0) + { + SE_TRACE(SE_TRACE_WARNING, "set protection for gap before section[%d]:mprotect(rva=%" PRIu64 ", len=%" PRIu64 ", flags=%" PRIu64 ") failed\n", + i, last_section_end, rva - last_section_end, SI_FLAG_NONE); + return SGX_ERROR_UNEXPECTED; + } + } + last_section_end = rva + len; + } + + ret = set_context_protection(GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset), + GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset + m_metadata->dirs[DIR_LAYOUT].size), + 0); + if (SGX_SUCCESS != ret) + { + return ret; + } + + return SGX_SUCCESS; + +} + +int CLoader::set_context_protection(layout_t *layout_start, layout_t *layout_end, uint64_t delta) +{ + int ret = SGX_ERROR_UNEXPECTED; + for(layout_t *layout = layout_start; layout < layout_end; layout++) + { + if (!IS_GROUP_ID(layout->group.id)) + { + int prot = 0 ; + if(layout->entry.attributes == SI_FLAG_NONE) + { + prot = SI_FLAG_NONE & SI_MASK_MEM_ATTRIBUTE; + } + else + { + prot = SI_FLAGS_RW & SI_MASK_MEM_ATTRIBUTE; + } + ret = mprotect(GET_PTR(void, m_start_addr, layout->entry.rva + delta), + (size_t)(layout->entry.page_count << SE_PAGE_SHIFT), + prot); + if(ret != 0) + { + SE_TRACE(SE_TRACE_WARNING, "mprotect(rva=%" PRIu64 ", len=%" PRIu64 ", flags=%d) failed\n", + (uint64_t)m_start_addr + layout->entry.rva + delta, + (uint64_t)(layout->entry.page_count << SE_PAGE_SHIFT), + prot); + return SGX_ERROR_UNEXPECTED; + } + } + else + { + uint64_t step = 0; + for(uint32_t j = 0; j < layout->group.load_times; j++) + { + step += layout->group.load_step; + if(SGX_SUCCESS != (ret = set_context_protection(&layout[-layout->group.entry_count], layout, step))) + { + return ret; + } + } + } + } + return SGX_SUCCESS; +} diff --git a/psw/urts/loader.h b/psw/urts/loader.h new file mode 100644 index 0000000000..77b7c194ed --- /dev/null +++ b/psw/urts/loader.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _LOADER_H_ +#define _LOADER_H_ + +#include "se_wrapper.h" +#include "arch.h" +#include "enclave.h" +#include "enclave_creator.h" +#include "section_info.h" +#include "launch_checker.h" +#include "file.h" + +#define GET_RELOC_FAILED ((uint8_t *)-1) + +#if defined(SE_SIM) +#define ENCLAVE_ID_IOCTL m_enclave_id +#else +//only translate enclave id to start address for linux HW mode. +#define ENCLAVE_ID_IOCTL (sgx_enclave_id_t)m_start_addr +#endif + +class BinParser; + +class CLoader: private Uncopyable +{ +public: + CLoader(uint8_t *mapped_file_base, BinParser &parser); + virtual ~CLoader(); + int load_enclave(SGXLaunchToken *lc, int flag, const metadata_t *metadata, le_prd_css_file_t *prd_css_file = NULL, sgx_misc_attribute_t *misc_attr = NULL); + int load_enclave_ex(SGXLaunchToken *lc, bool is_debug, const metadata_t *metadata, le_prd_css_file_t *prd_css_file = NULL, sgx_misc_attribute_t *misc_attr = NULL); + int destroy_enclave(); + sgx_enclave_id_t get_enclave_id() const; + const void* get_start_addr() const; + const secs_t& get_secs() const; + const std::vector& get_tcs_list() const; + void* get_symbol_address(const char* const sym); + int set_memory_protection(); + +private: + int build_mem_region(const section_info_t * const sec_info); + int build_image(SGXLaunchToken * const lc, sgx_attributes_t * const secs_attr, le_prd_css_file_t *prd_css_file, sgx_misc_attribute_t * const misc_attr); + int build_secs(sgx_attributes_t * const secs_attr, sgx_misc_attribute_t * const misc_attr); + int build_context(const uint64_t start_rva, layout_entry_t *layout); + int build_contexts(layout_t *layout_start, layout_t *layout_end, uint64_t delta); + int build_pages(const uint64_t start_rva, const uint64_t size, void *source, const sec_info_t &sinfo, const uint32_t attr); + + bool is_ae(const enclave_css_t *enclave_css); + bool is_metadata_buffer(uint32_t offset, uint32_t size); + bool is_enclave_buffer(uint64_t offset, uint64_t size); + int validate_layout_table(); + int validate_patch_table(); + int validate_metadata(); + int get_debug_flag(const token_t * const launch); + virtual int build_sections(vector *bitmap); + int set_context_protection(layout_t *layout_start, layout_t *layout_end, uint64_t delta); + + uint8_t *m_mapped_file_base; + sgx_enclave_id_t m_enclave_id; + void *m_start_addr; + + // the TCS list + std::vector m_tcs_list; + // the enclave creation parameters + const metadata_t *m_metadata; + secs_t m_secs; + BinParser &m_parser; +}; + +#endif diff --git a/psw/urts/node.cpp b/psw/urts/node.cpp new file mode 100644 index 0000000000..a31ba9c88e --- /dev/null +++ b/psw/urts/node.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "node.h" +#include +#include "enclave.h" +#include "tcs.h" + +template +Node::Node(const T1& k, const T2& v) +{ + this->key = k; + this->value = v; + this->next = NULL; +} + +template +bool Node::InsertNext(Node *p) +{ + if (this->Find(p->key) != NULL) + return false; + p->next = this->next; + this->next = p; + return true; +} + +template +Node* Node::Remove(const T1& k) +{ + Node *c = this, *p = this; + while (c != NULL) { + if (c->key == k) { + p->next = c->next; + break; + } + p = c; + c = c->next; + } + return c; +} + +template +Node* Node::Find(const T1& k) +{ + Node* c = this; + if (c == NULL) return NULL; + while (c != NULL) { + if (c->key == k) + break; + c = c->next; + } + return c; +} + + +template class Node; +template class Node; diff --git a/psw/urts/node.h b/psw/urts/node.h new file mode 100644 index 0000000000..42b178bf9c --- /dev/null +++ b/psw/urts/node.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef NODE_H +#define NODE_H + +#include "uncopyable.h" + +template +class Node: private Uncopyable +{ +public: + T1 key; + T2 value; + Node * next; + + Node(); + Node(const T1& key, const T2& value); + + bool InsertNext(Node* p); + Node* Find(const T1& key); + Node* Remove(const T1& key); +}; + +#endif // NODE_H diff --git a/psw/urts/parser/Makefile b/psw/urts/parser/Makefile new file mode 100644 index 0000000000..c85dfd6141 --- /dev/null +++ b/psw/urts/parser/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +SRCS := $(wildcard *.cpp) +SRCS := $(filter-out elfparser.cpp, $(SRCS)) +OBJS := $(SRCS:.cpp=.o) + +TARGET := libenclaveparser.a + +CXXFLAGS += -fPIC -USE_DEBUG_LEVEL -DSE_DEBUG_LEVEL=SE_TRACE_WARNING + +ifneq ($(HOST_OS), darwin) + CXXFLAGS += -Werror +endif + +CXXFLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal \ + -I. \ + -I.. + +.PHONY: all +all: $(OBJS) + $(AR) rcs $(TARGET) $^ + +.PHONY: clean +clean: + $(RM) *~ $(OBJS) $(TARGET) diff --git a/psw/urts/parser/binparser.h b/psw/urts/parser/binparser.h new file mode 100644 index 0000000000..7198c05328 --- /dev/null +++ b/psw/urts/parser/binparser.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _BINPARSER_H_ +#define _BINPARSER_H_ + +#include "section.h" +#include "util.h" +#include "se_memcpy.h" +#include "create_param.h" +#include "sgx_error.h" + +#include +#include +#include +using std::vector; +using std::string; + +#define ENCLAVE_MAX_SIZE_32 0xffffffff +#define ENCLAVE_MAX_SIZE_64 0x1fffffffff + +typedef enum _bin_fmt_t +{ + BF_UNKNOWN = 0, + BF_PE32, + BF_PE64, + BF_ELF32, + BF_ELF64 +} bin_fmt_t; + +typedef struct _enclave_diff_info_t +{ +} enclave_diff_info_t; + +class BinParser { +public: + virtual ~BinParser() {} + + virtual sgx_status_t run_parser() = 0; + + virtual bin_fmt_t get_bin_format() const = 0; + + virtual uint64_t get_enclave_max_size() const = 0; + + virtual uint64_t get_metadata_offset() const = 0; + + virtual uint64_t get_metadata_block_size() const = 0; + + virtual const uint8_t* get_start_addr() const = 0; + + // Get a vector of sections to be loaded + virtual const vector

& get_sections() const = 0; + + // Get the TLS section + virtual const Section* get_tls_section() const = 0; + + virtual uint64_t get_symbol_rva(const char* name) const = 0; + + virtual bool get_reloc_bitmap(vector &bitmap) = 0; + + virtual void get_reloc_entry_offset(const char* sec_name, + vector& offsets) = 0; + + // We need to put this method into BinParser class since + // the `global_data_t' is platform-dependent as the parser. + // c.f. global_data.h for more information. + // + // Unfortunately, although the implementation is the same, + // we can't put them here but into the subclasses - + // ElfParsr and PEParser, since the `global_data_t' for + // them are different in terms of size and layout. + virtual bool update_global_data(const create_param_t* const create_param, + uint8_t *data, + uint32_t *data_size) = 0; + + virtual sgx_status_t modify_info(enclave_diff_info_t *enclave_diff_info) = 0; + + virtual sgx_status_t get_info(enclave_diff_info_t *enclave_diff_info) = 0; +}; + +#endif diff --git a/psw/urts/parser/clearvars.h b/psw/urts/parser/clearvars.h new file mode 100644 index 0000000000..ae023924a0 --- /dev/null +++ b/psw/urts/parser/clearvars.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Make sure the `elfparser.h' is preprocessed again. */ +#ifdef _ELFPARSER_H_ +#undef _ELFPARSER_H_ +#endif + +/* Anding using the ELF class we want. */ +#ifdef __ELF_NATIVE_CLASS +#undef __ELF_NATIVE_CLASS +#endif + +#ifdef RTS_SYSTEM_WORDSIZE +#undef RTS_SYSTEM_WORDSIZE +#endif + +/* We will rename the class `ElfParser'. */ +#ifdef ElfParser +#undef ElfParser +#endif diff --git a/psw/urts/parser/elf32parser.cpp b/psw/urts/parser/elf32parser.cpp new file mode 100644 index 0000000000..d29d8736f0 --- /dev/null +++ b/psw/urts/parser/elf32parser.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "elf32parser.h" + +#include "elfparser.cpp" diff --git a/psw/urts/parser/elf32parser.h b/psw/urts/parser/elf32parser.h new file mode 100644 index 0000000000..ff72f85802 --- /dev/null +++ b/psw/urts/parser/elf32parser.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ELF32_PARSER_H_ +#define ELF32_PARSER_H_ + +#include "clearvars.h" + +/* Set the ELF native class to 32-bit. */ +#define __ELF_NATIVE_CLASS 32 + +#ifndef TD_SUPPORT_MULTI_PLATFORM +#define TD_SUPPORT_MULTI_PLATFORM +#endif +#define RTS_SYSTEM_WORDSIZE 32 + +/* Change the generic class name `ElfParser' to `Elf32Parser'. */ +#define ElfParser Elf32Parser +#include "elfparser.h" + +#endif diff --git a/psw/urts/parser/elf64parser.cpp b/psw/urts/parser/elf64parser.cpp new file mode 100644 index 0000000000..e02d91344b --- /dev/null +++ b/psw/urts/parser/elf64parser.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "elf64parser.h" + +#include "elfparser.cpp" diff --git a/psw/urts/parser/elf64parser.h b/psw/urts/parser/elf64parser.h new file mode 100644 index 0000000000..51119c8bc1 --- /dev/null +++ b/psw/urts/parser/elf64parser.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef ELF64_PARSER_H_ +#define ELF64_PARSER_H_ + +#include "clearvars.h" + +/* Set the ELF native class to 64-bit. */ +#define __ELF_NATIVE_CLASS 64 + +#ifndef TD_SUPPORT_MULTI_PLATFORM +#define TD_SUPPORT_MULTI_PLATFORM +#endif +#define RTS_SYSTEM_WORDSIZE 64 + +/* Change the generic class name `ElfParser' to `Elf64Parser'. */ +#define ElfParser Elf64Parser +#include "elfparser.h" + +#endif diff --git a/psw/urts/parser/elfparser.cpp b/psw/urts/parser/elfparser.cpp new file mode 100644 index 0000000000..aa2f7974fc --- /dev/null +++ b/psw/urts/parser/elfparser.cpp @@ -0,0 +1,850 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "elfparser.h" +#include "cpputil.h" +#include "se_trace.h" +#include "se_memcpy.h" +#include "global_data.h" + +#define META_SECTION_ALIGNMENT 1 /*metadata section no alignment*/ + +namespace { +/** the callback function to filter a section. + * + * @shstrtab: the section header string table + * @shdr: the current section header to be examined + * @user_data: user supplied data for the callback + * + * @return: true if current section header is what we are looking for. + */ +typedef bool (* section_filter_f)(const char* shstrtab, + const ElfW(Shdr)* shdr, + const void* user_data); + +bool compare_section_name(const char* shstrtab, + const ElfW(Shdr)* shdr, + const void* user_data) +{ + // `shstrtab + shdr->sh_name' is the section name. + return (!strcmp(shstrtab + shdr->sh_name, (const char*)user_data)); +} + +bool compare_section_addr(const char* shstrtab, + const ElfW(Shdr)* shdr, + const void* user_data) +{ + UNUSED(shstrtab); + return (shdr->sh_addr == (ElfW(Addr))(size_t)user_data); +} + +const ElfW(Shdr)* get_section(const ElfW(Ehdr) *elf_hdr, + section_filter_f f, + const void* user_data) +{ + const ElfW(Shdr) *shdr = GET_PTR(ElfW(Shdr), elf_hdr, elf_hdr->e_shoff); + assert(sizeof(ElfW(Shdr)) == elf_hdr->e_shentsize); + + // section header string table + const char *shstrtab = GET_PTR(char, elf_hdr, shdr[elf_hdr->e_shstrndx].sh_offset); + + for (unsigned idx = 0; idx < elf_hdr->e_shnum; ++idx, ++shdr) + { + SE_TRACE(SE_TRACE_DEBUG, "section [%u] %s: sh_addr = %x, sh_size = %x, sh_offset = %x, sh_name = %x\n", + idx, shstrtab + shdr->sh_name, shdr->sh_addr, shdr->sh_size, shdr->sh_offset, shdr->sh_name); + if (f(shstrtab, shdr, user_data)) + return shdr; + } + + return NULL; +} + +const ElfW(Shdr)* get_section_by_name(const ElfW(Ehdr) *elf_hdr, const char *name) +{ + return get_section(elf_hdr, compare_section_name, name); +} + +const ElfW(Shdr)* get_section_by_addr(const ElfW(Ehdr) *elf_hdr, ElfW(Addr) start_addr) +{ + return get_section(elf_hdr, compare_section_addr, (const void*)(size_t)start_addr); +} + +template +const T* get_section_raw_data(const ElfW(Ehdr) *elf_hdr, ElfW(Addr) start_addr) +{ + const ElfW(Shdr)* shdr = get_section_by_addr(elf_hdr, start_addr); + if (shdr == NULL) + return NULL; + + return GET_PTR(T, elf_hdr, shdr->sh_offset); +} + +bool validate_elf_header(const ElfW(Ehdr) *elf_hdr) +{ + // validate magic number + if (memcmp(&elf_hdr->e_ident, ELFMAG, SELFMAG)) + return false; + +#if RTS_SYSTEM_WORDSIZE == 64 + if (ELFCLASS64 != elf_hdr->e_ident[EI_CLASS]) + return false; +#else + if (ELFCLASS32 != elf_hdr->e_ident[EI_CLASS]) + return false; +#endif + + if (ELFDATA2LSB!= elf_hdr->e_ident[EI_DATA]) + return false; + + if (EV_CURRENT != elf_hdr->e_ident[EI_VERSION]) + return false; + + if (ET_DYN != elf_hdr->e_type) + return false; + + if (sizeof(ElfW(Phdr)) != elf_hdr->e_phentsize) + return false; + + return true; +} + +bool parse_dyn(const ElfW(Ehdr) *elf_hdr, ElfW(Dyn)* dyn_info) +{ + const ElfW(Phdr) *prg_hdr = GET_PTR(ElfW(Phdr), elf_hdr, elf_hdr->e_phoff); + bool has_dyn = false; + + for (unsigned idx = 0; idx < elf_hdr->e_phnum; ++idx, ++prg_hdr) + { + if (PT_DYNAMIC == prg_hdr->p_type) + { + const ElfW(Dyn) *dyn_entry = GET_PTR(ElfW(Dyn), elf_hdr, prg_hdr->p_offset); + + // parse dynamic segment + // An entry with a DT_NULL tag marks the end. + while (dyn_entry->d_tag != DT_NULL) + { + SE_TRACE(SE_TRACE_DEBUG, "dynamic tag = %x, ptr = %x\n", dyn_entry->d_tag, dyn_entry->d_un.d_ptr); + + if (dyn_entry->d_tag < DT_NUM) + { + memcpy_s(&dyn_info[dyn_entry->d_tag], sizeof(ElfW(Dyn)), dyn_entry, sizeof(ElfW(Dyn))); + } + else if (dyn_entry->d_tag > DT_ADDRRNGLO && dyn_entry->d_tag <= DT_ADDRRNGHI) + { + memcpy_s(&dyn_info[DT_ADDRTAGIDX(dyn_entry->d_tag) + DT_NUM], sizeof(ElfW(Dyn)), dyn_entry, sizeof(ElfW(Dyn))); + } + + dyn_entry++; + has_dyn = true; + } + + return has_dyn; + } + } + + return false; +} + +/** Check whether there are undefined symbols and save the address + * for a few reserved symbols. + * + * ELF format defined two symbol tables, `.symtab' and `.dynsym'. + * + * `.symtab' is non-allocable, and might be stripped. + * `.dynsym' is allocable, and only contains global symbols. + * + * We only need to search `.dynsym' for undefined symbols. + */ +bool check_symbol_table(const ElfW(Ehdr) *elf_hdr, const ElfW(Dyn) *dyn_info, + map& sym_table) +{ + const ElfW(Shdr) *sh_symtab = get_section_by_addr(elf_hdr, dyn_info[DT_SYMTAB].d_un.d_ptr); + + if (sh_symtab == NULL) + { + // We must at least have "enclave_entry" + SE_TRACE(SE_TRACE_WARNING, "There is no .dynsym section"); + return false; + } + + if (sh_symtab->sh_entsize == 0) + { + SE_TRACE(SE_TRACE_WARNING, "In section .dynsym, sh_entsize is 0."); + return false; + } + + const ElfW(Sym) *symtab = GET_PTR(ElfW(Sym), elf_hdr, sh_symtab->sh_offset); + uint32_t sym_num = (uint32_t)(sh_symtab->sh_size/sh_symtab->sh_entsize); + const char *strtab = get_section_raw_data(elf_hdr, dyn_info[DT_STRTAB].d_un.d_ptr); + + // We only store "enclave_entry", "g_global_data_sim" and "g_peak_heap_used". + // To export new symbols, add them here. + // + // "g_global_data_sim" is needed so that we can check that whether + // an simulated enclave is given when running an HW loader. + const char* str[] = { "enclave_entry", "g_global_data_sim", "g_peak_heap_used", "g_global_data" }; + + // The first entry is reserved, and must be all zeros + for (uint32_t idx = 1; idx < sym_num; ++idx) + { + // st_name == 0 indicates the symble table entry has no name. + if (symtab[idx].st_name == 0) continue; + + const char* sym = strtab + symtab[idx].st_name; + if (sym == NULL) + { + SE_TRACE(SE_TRACE_WARNING, "Malformed enclave with NULL symbol name\n"); + return false; + } + + if (SHN_UNDEF == symtab[idx].st_shndx + && STB_WEAK != ELFW(ST_BIND)(symtab[idx].st_info)) + { + SE_TRACE(SE_TRACE_WARNING, "symbol '%s' is undefined\n", sym); + return false; + } + +#define SYMBOL_NUM (ARRAY_LENGTH(str)) + for (size_t i = 0; i < SYMBOL_NUM; ++i) + { + if (0 == strcmp(str[i], sym)) + { + sym_table[sym] = (uint64_t)symtab[idx].st_value; + } + } + } + + // If the enclave if compiled/linked with -fpie/-pie, and setting the + // enclave entry to `enclave_entry', the `st_name' for `enclave_entry' + // will be 0 in `.dynsym'. + map::const_iterator it = sym_table.find("enclave_entry"); + if (it == sym_table.end()) + { + sym_table["enclave_entry"] = (uint64_t)elf_hdr->e_entry; + } + + return true; +} + +bool do_validate_reltab(const ElfW(Rel) *reltab, size_t nr_rel) +{ + if (reltab == NULL && nr_rel != 0) return false; + +#if RTS_SYSTEM_WORDSIZE == 64 + const ElfW(Rel) *rela = reltab; + + for (unsigned idx = 0; idx < nr_rel; idx++, rela++) + { + switch (ELF64_R_TYPE(rela->r_info)) + + { + case R_X86_64_RELATIVE: + break; + + case R_X86_64_GLOB_DAT: + case R_X86_64_JUMP_SLOT: + case R_X86_64_64: + break; + + case R_X86_64_NONE: + break; + + case R_X86_64_DTPMOD64: + case R_X86_64_DTPOFF64: + case R_X86_64_TPOFF64: + break; +#else + const ElfW(Rel) *rel = reltab; + + for (unsigned idx = 0; idx < nr_rel; idx++, rel++) + { + switch (ELF32_R_TYPE(rel->r_info)) + { + case R_386_RELATIVE: /* B+A */ + break; + + case R_386_GLOB_DAT: + case R_386_JMP_SLOT: /* S */ + break; + + case R_386_32: /* S+A */ + break; + + case R_386_PC32: /* S+A-P */ + break; + + case R_386_NONE: + break; + + case R_386_TLS_DTPMOD32: + break; + + case R_386_TLS_DTPOFF32: + break; + + case R_386_TLS_TPOFF: + break; + + case R_386_TLS_TPOFF32: + break; +#endif + + default: /* unsupported relocs */ + SE_TRACE(SE_TRACE_WARNING, "unsupported relocation type detected\n"); + return false; + } + } + + return true; +} + +bool validate_reltabs(const ElfW(Ehdr) *elf_hdr, const ElfW(Dyn) *dyn_info) +{ +#if RTS_SYSTEM_WORDSIZE == 64 + // The relocation struct must be rela on x64. + if (dyn_info[DT_REL].d_un.d_ptr) + { + SE_TRACE(SE_TRACE_WARNING, "Rel struct detected on x64\n"); + return false; + } +#else + // The relocation struct must be rel on x86. + if (dyn_info[DT_RELA].d_un.d_ptr) + { + SE_TRACE(SE_TRACE_WARNING, "Rela struct detected on x86\n"); + return false; + } +#endif + + const ElfW(Rel) *reltab = get_section_raw_data(elf_hdr, dyn_info[RTS_DT_REL].d_un.d_ptr); + const ElfW(Word) reltab_sz = (ElfW(Word))dyn_info[RTS_DT_RELSZ].d_un.d_val; + + const ElfW(Rel) *jmpreltab = get_section_raw_data(elf_hdr, dyn_info[DT_JMPREL].d_un.d_ptr); + const ElfW(Word) jmpreltab_sz = (ElfW(Word))dyn_info[DT_PLTRELSZ].d_un.d_val; + + return (do_validate_reltab(reltab, reltab_sz / sizeof(ElfW(Rel))) + && do_validate_reltab(jmpreltab, jmpreltab_sz / sizeof(ElfW(Rel)))); +} + +bool has_ctor_section(const ElfW(Ehdr) *elf_hdr) +{ + const ElfW(Shdr) *shdr = get_section_by_name(elf_hdr, ".ctors"); + if (NULL == shdr) return false; + + se_trace(SE_TRACE_ERROR, "ERROR: .ctors section is found, global initializers will not be invoked correctly!\n"); + return true; +} + +inline bool is_tls_segment(const ElfW(Phdr)* prg_hdr) +{ + return (PT_TLS == prg_hdr->p_type); +} + +bool get_meta_property(const uint8_t *start_addr, const ElfW(Ehdr) *elf_hdr, uint64_t &meta_offset, uint64_t &meta_block_size) +{ + const ElfW(Shdr)* shdr = get_section_by_name(elf_hdr, ".note.sgxmeta"); + if (shdr == NULL) + { + se_trace(SE_TRACE_ERROR, "ERROR: The enclave image should have '.note.sgxmeta' section\n"); + return false; + } + + /* We require that enclaves should have .note.sgxmeta section to store the metadata information + * We limit this section is used for metadata only and ISV should not extend this section. + * + * .note.sgxmeta layout: + * + * | namesz | + * | metadata size | + * | type | + * | name | + * | metadata | + */ + + if (shdr->sh_addralign != META_SECTION_ALIGNMENT) + { + se_trace(SE_TRACE_ERROR, "ERROR: The '.note.sgxmeta' section must be 4byte aligned\n"); + return false; + } + + const ElfW(Note) *note = GET_PTR(ElfW(Note), start_addr, shdr->sh_offset); + assert(note != NULL); + + if (shdr->sh_size != ROUND_TO(sizeof(ElfW(Note)) + note->namesz + note->descsz, META_SECTION_ALIGNMENT)) + { + se_trace(SE_TRACE_ERROR, "ERROR: The '.note.sgxmeta' section size is not correct.\n"); + return false; + } + + if (memcmp(GET_PTR(void, start_addr, shdr->sh_offset + sizeof(ElfW(Note))), "sgx_metadata", note->namesz)) + { + se_trace(SE_TRACE_ERROR, "ERROR: The note in the '.note.sgxmeta' section must be named as \"sgx_metadata\"\n"); + return false; + } + + meta_offset = static_cast(shdr->sh_offset + sizeof(ElfW(Note)) + note->namesz); + meta_block_size = note->descsz; + return true; +} + +bool validate_segment(const ElfW(Ehdr) *elf_hdr, uint64_t len) +{ + const ElfW(Phdr) *prg_hdr = GET_PTR(ElfW(Phdr), elf_hdr, elf_hdr->e_phoff); + assert(sizeof(ElfW(Phdr)) == elf_hdr->e_phentsize); + + std::vector< std::pair > load_seg(elf_hdr->e_phnum, std::make_pair(0, 0)); + int k = 0; + + for (int idx = 0; idx < elf_hdr->e_phnum; idx++, prg_hdr++) + { + /* Validate the size of the buffer */ + if (len < (uint64_t)prg_hdr->p_offset + prg_hdr->p_filesz) + return false; + + if (PT_LOAD == prg_hdr->p_type) + { + // The default align is max page size. On x86-64, the max page size is 2M, but EPC page size is 4K, + // so in x86-64, we just treat it as EPC page size. The (2M - 4K) size is not eadded. We leave it + // as a hole. + if (!IS_PAGE_ALIGNED(prg_hdr->p_align)) + { + SE_TRACE(SE_TRACE_WARNING, "A segment is not PAGE aligned, alignment = %x\n", prg_hdr->p_align); + return false; + } + + // Verify the overlap of segment. we don't verify here, because a well compiled file has no overlapped segment. + load_seg[k].first = prg_hdr->p_vaddr; + load_seg[k].second = prg_hdr->p_vaddr + ROUND_TO(prg_hdr->p_memsz, prg_hdr->p_align) - 1; + + for (int j = 0; j < k; j++) + { + if (is_overlap(load_seg[k], load_seg[j])) + { + SE_TRACE(SE_TRACE_WARNING, "there is overlap segment [%x : %x] [%x : %x]\n", + load_seg[k].first, load_seg[k].second, load_seg[j].first, load_seg[j].second); + return false; + } + + } + + k++; + } + } + return true; +} + +bool get_bin_fmt(const ElfW(Ehdr) *elf_hdr, bin_fmt_t& bf) +{ + switch(elf_hdr->e_machine) + { +#if RTS_SYSTEM_WORDSIZE == 32 + case EM_386: + bf = BF_ELF32; + return true; +#endif + +#if RTS_SYSTEM_WORDSIZE == 64 + case EM_X86_64: + bf = BF_ELF64; + return true; +#endif + } + + return false; +} + +si_flags_t page_attr_to_si_flags(uint32_t page_attr) +{ + si_flags_t res = SI_FLAG_REG; + + if (page_attr & PF_R) + res |= SI_FLAG_R; + + if (page_attr & PF_W) + res |= SI_FLAG_W; + + if (page_attr & PF_X) + res |= SI_FLAG_X; + + return res; +} + +Section* build_section(const uint8_t* raw_data, uint64_t size, uint64_t virtual_size, + uint64_t rva, uint32_t page_attr) +{ + si_flags_t sf = page_attr_to_si_flags(page_attr); + + if (sf != SI_FLAG_REG) + return new Section(raw_data, size, virtual_size, rva, sf); + + return NULL; +} + +bool build_regular_sections(const uint8_t* start_addr, + vector
& sections, + const Section*& tls_sec, + uint64_t& metadata_offset, + uint64_t& metadata_block_size) +{ + const ElfW(Ehdr) *elf_hdr = (const ElfW(Ehdr) *)start_addr; + const ElfW(Phdr) *prg_hdr = GET_PTR(ElfW(Phdr), start_addr, elf_hdr->e_phoff); + uint64_t virtual_size = 0, alignment = 0, aligned_virtual_size = 0; + + if (get_meta_property(start_addr, elf_hdr, metadata_offset, metadata_block_size) == false) + return false; + + for (unsigned idx = 0; idx < elf_hdr->e_phnum; ++idx, ++prg_hdr) + { + Section* sec = NULL; + + switch (prg_hdr->p_type) + { + case PT_LOAD: + sec = build_section(GET_PTR(uint8_t, start_addr, prg_hdr->p_offset), + (uint64_t)prg_hdr->p_filesz, ROUND_TO_PAGE((uint64_t)prg_hdr->p_memsz), + (uint64_t)prg_hdr->p_vaddr, (uint32_t) prg_hdr->p_flags); + break; + + case PT_TLS: + virtual_size = (uint64_t)prg_hdr->p_memsz; + alignment = (uint64_t)prg_hdr->p_align; + + /* according to ELF spec, alignment equals zero or one means no align requirement */ + if (alignment == 0 || alignment == 1) + aligned_virtual_size = virtual_size; + else + aligned_virtual_size = (virtual_size + alignment - 1) & (~(alignment - 1)); + + sec = build_section(GET_PTR(uint8_t, start_addr, prg_hdr->p_offset), + (uint64_t)prg_hdr->p_filesz, aligned_virtual_size, + (uint64_t)prg_hdr->p_vaddr, (uint32_t) prg_hdr->p_flags); + break; + + default: + continue; + } + + if (sec == NULL) + return false; + + /* We've filtered segments that are not of PT_LOAD or PT_TLS type. */ + if (!is_tls_segment(prg_hdr)) + { + /* A PT_LOAD segment. */ + sections.push_back(sec); + continue; + } + + /* It is a TLS segment. */ + tls_sec = sec; + } + + return true; +} + +const Section* get_max_rva_section(const vector sections) +{ + size_t sec_size = sections.size(); + + if (sec_size == 0) + return NULL; + + const Section* psec = sections[0]; + for (size_t idx = 1; idx < sec_size; ++idx) + { + if (sections[idx]->get_rva() > psec->get_rva()) + psec = sections[idx]; + } + + return psec; +} +} + +ElfParser::ElfParser (const uint8_t* start_addr, uint64_t len) + :m_start_addr(start_addr), m_len(len), m_bin_fmt(BF_UNKNOWN), + m_tls_section(NULL), m_metadata_offset(0), m_metadata_block_size(0) +{ + memset(&m_dyn_info, 0, sizeof(m_dyn_info)); +} + +sgx_status_t ElfParser::run_parser() +{ + /* We only need to run the parser once. */ + if (m_sections.size() != 0) return SGX_SUCCESS; + + const ElfW(Ehdr) *elf_hdr = (const ElfW(Ehdr) *)m_start_addr; + if (elf_hdr == NULL || m_len < sizeof(ElfW(Ehdr))) + return SGX_ERROR_INVALID_ENCLAVE; + + /* Check elf header*/ + if (!validate_elf_header(elf_hdr)) + return SGX_ERROR_INVALID_ENCLAVE; + + /* Get and check machine mode */ + if (!get_bin_fmt(elf_hdr, m_bin_fmt)) + return SGX_ERROR_MODE_INCOMPATIBLE; + + /* Check if there is any overlap segment, and make sure the segment is 1 page aligned; + * TLS segment must exist. + */ + if (!validate_segment(elf_hdr, m_len)) + return SGX_ERROR_INVALID_ENCLAVE; + + if (!parse_dyn(elf_hdr, &m_dyn_info[0])) + return SGX_ERROR_INVALID_ENCLAVE; + + /* Check if there is any undefined symbol */ + if (!check_symbol_table(elf_hdr, m_dyn_info, m_sym_table)) + { + return SGX_ERROR_UNDEFINED_SYMBOL; + } + + /* Check if there is unexpected relocation type */ + if (!validate_reltabs(elf_hdr, m_dyn_info)) + return SGX_ERROR_INVALID_ENCLAVE; + + /* Check if there is .ctor section */ + if (has_ctor_section(elf_hdr)) + return SGX_ERROR_INVALID_ENCLAVE; + + /* build regular sections */ + if (build_regular_sections(m_start_addr, m_sections, m_tls_section, m_metadata_offset, m_metadata_block_size)) + return SGX_SUCCESS; + else + return SGX_ERROR_INVALID_ENCLAVE; +} + +ElfParser::~ElfParser() +{ + delete_ptrs_from_container(m_sections); + if (m_tls_section) delete m_tls_section; +} + +bin_fmt_t ElfParser::get_bin_format() const +{ + return m_bin_fmt; +} + +uint64_t ElfParser::get_enclave_max_size() const +{ + if(m_bin_fmt == BF_ELF64) + return ENCLAVE_MAX_SIZE_64; + else + return ENCLAVE_MAX_SIZE_32; +} + +uint64_t ElfParser::get_metadata_offset() const +{ + return m_metadata_offset; +} + +uint64_t ElfParser::get_metadata_block_size() const +{ + return m_metadata_block_size; +} + + +const uint8_t* ElfParser::get_start_addr() const +{ + return m_start_addr; +} + +const vector
& ElfParser::get_sections() const +{ + return m_sections; +} + +const Section* ElfParser::get_tls_section() const +{ + return m_tls_section; +} + +uint64_t ElfParser::get_symbol_rva(const char* name) const +{ + map::const_iterator it = m_sym_table.find(name); + if (it != m_sym_table.end()) + return it->second; + else + return 0; +} + +bool ElfParser::get_reloc_bitmap(vector& bitmap) +{ + // Clear the `bitmap' so that it is in a known state + bitmap.clear(); + + if (!m_dyn_info[DT_TEXTREL].d_tag) + return true; + + const ElfW(Ehdr) *elf_hdr = (const ElfW(Ehdr) *)m_start_addr; + const ElfW(Rel) *rel[4] = { NULL, NULL, NULL, NULL }; + + if (m_dyn_info[DT_JMPREL].d_tag) + { + rel[2] = get_section_raw_data(elf_hdr, m_dyn_info[DT_JMPREL].d_un.d_ptr); + rel[3] = GET_PTR(const ElfW(Rel), rel[2], m_dyn_info[DT_PLTRELSZ].d_un.d_val); + } + + if (m_dyn_info[RTS_DT_REL].d_tag) + { + rel[0] = get_section_raw_data(elf_hdr, m_dyn_info[RTS_DT_REL].d_un.d_ptr); + rel[1] = GET_PTR(const ElfW(Rel), rel[0], m_dyn_info[RTS_DT_RELSZ].d_un.d_val); + assert(sizeof(ElfW(Rel)) == m_dyn_info[RTS_DT_RELENT].d_un.d_val); + } + + // The enclave size mapped in memory is calculated by + // sec->get_rva() + sec->virtual_size(); + // where the `sec' is the section with maximum RVA value. + uint64_t image_size = 0; + const Section* max_rva_sec = get_max_rva_section(this->m_sections); + if (max_rva_sec == NULL) + return false; + + image_size = max_rva_sec->get_rva() + max_rva_sec->virtual_size(); + + // NOTE: + // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. + // In the future, if the max enclave size is extended to beyond 1<<49, this type-casting will not work. + // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) + + // allocate bitmap + bitmap.resize((size_t)((((image_size + (SE_PAGE_SIZE - 1)) >> SE_PAGE_SHIFT) + 7) / 8)); + + for (unsigned idx = 0; idx < ARRAY_LENGTH(rel); idx += 2) + { + const ElfW(Rel) *rel_entry = rel[idx], *rel_end = rel[idx+1]; + if (NULL == rel_entry) + continue; + + for (; rel_entry < rel_end; rel_entry++) + { +#if RTS_SYSTEM_WORDSIZE == 64 + if (ELF64_R_TYPE(rel_entry->r_info) == R_X86_64_NONE) +#else + if (ELF32_R_TYPE(rel_entry->r_info) == R_386_NONE) +#endif + continue; + + ElfW(Addr) reloc_addr = rel_entry->r_offset; + uint64_t page_frame = (uint64_t)(reloc_addr >> SE_PAGE_SHIFT); + + // NOTE: + // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. + // In the future, if the max enclave size is extended to beyond 1<<49, this type-casting will not work. + // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) + + // If there is more than one relocation in one page, then "|" works as there + // is only one relocation in one page. + bitmap[(size_t)(page_frame/8)] = (uint8_t)(bitmap[(size_t)(page_frame/8)] | (uint8_t)(1 << (page_frame % 8))); + + // Check if the relocation across boundary + if ((reloc_addr & (SE_PAGE_SIZE - 1)) > (SE_PAGE_SIZE - sizeof(sys_word_t))) + { + page_frame++; + bitmap[(size_t)(page_frame/8)] = (uint8_t)(bitmap[(size_t)(page_frame/8)] | (uint8_t)(1 << (page_frame % 8))); + } + } + } + + return true; +} + +void ElfParser::get_reloc_entry_offset(const char* sec_name, vector& offsets) +{ + if (sec_name == NULL) + return; + + const ElfW(Ehdr) *ehdr = (const ElfW(Ehdr) *)m_start_addr; + const ElfW(Shdr) *shdr = get_section_by_name(ehdr, sec_name); + + if (shdr == NULL) + return; + + /* find the start and end offset of the target section */ + const uint64_t start = shdr->sh_addr; + const uint64_t end = start + shdr->sh_size; + + offsets.clear(); + SE_TRACE(SE_TRACE_DEBUG, "found section '%s' - offset %#lx, size %#lx\n", + sec_name, (long)start, (long)shdr->sh_size); + + /* iterate sections to find the relocs */ + shdr = GET_PTR(ElfW(Shdr), m_start_addr, ehdr->e_shoff); + for (unsigned idx = 0; idx < ehdr->e_shnum; ++idx, ++shdr) + { + if (shdr->sh_type != SHT_RELA && + shdr->sh_type != SHT_REL) + continue; + + uint64_t rel_size = shdr->sh_size; + uint64_t rel_offset = shdr->sh_offset; + uint64_t nr_rel = rel_size / shdr->sh_entsize; + + /* for each reloc, check its target address */ + const ElfW(Rel) *rel = GET_PTR(ElfW(Rel), m_start_addr, rel_offset); + for (; nr_rel > 0; --nr_rel, ++rel) + { + if (rel->r_offset >= start && rel->r_offset < end) + { + uint64_t offset = DIFF64(rel, m_start_addr); + SE_TRACE(SE_TRACE_DEBUG, "found one reloc at offset %#lx\n", offset); + offsets.push_back(offset); + } + } + } +} + +#include "update_global_data.hxx" + +bool ElfParser::update_global_data(const create_param_t* const create_param, + uint8_t *data, + uint32_t *data_size) +{ + if(*data_size < sizeof(global_data_t)) + { + *data_size = sizeof(global_data_t); + return false; + } + do_update_global_data(create_param, (global_data_t *)data); + *data_size = sizeof(global_data_t); + return true; +} + +sgx_status_t ElfParser::modify_info(enclave_diff_info_t *enclave_diff_info) +{ + UNUSED(enclave_diff_info); + return SGX_SUCCESS; +} + +sgx_status_t ElfParser::get_info(enclave_diff_info_t *enclave_diff_info) +{ + UNUSED(enclave_diff_info); + return SGX_SUCCESS; +} diff --git a/psw/urts/parser/elfparser.h b/psw/urts/parser/elfparser.h new file mode 100644 index 0000000000..21f5582b47 --- /dev/null +++ b/psw/urts/parser/elfparser.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _ELFPARSER_H_ +#define _ELFPARSER_H_ + +#include "binparser.h" +#include "elf_util.h" + +#include +#include +#include +#include + +using std::map; +using std::string; + +class ElfParser : public BinParser, private Uncopyable { +public: + // The `start_addr' cannot be NULL + ElfParser(const uint8_t* start_addr, uint64_t len); + ~ElfParser(); + + // Do the parsing job - use it before calling other methods + sgx_status_t run_parser(); + + bin_fmt_t get_bin_format() const; + + uint64_t get_enclave_max_size() const; + + uint64_t get_metadata_offset() const; + + uint64_t get_metadata_block_size() const; + + const uint8_t* get_start_addr() const; + + // The `section' here is a section in PE's concept. + // It is in fact a `segment' in ELF's view. + const vector
& get_sections() const; + const Section* get_tls_section() const; + uint64_t get_symbol_rva(const char* name) const; + + bool get_reloc_bitmap(vector &bitmap); + bool update_global_data(const create_param_t* const create_param, + uint8_t *data, + uint32_t *data_size); + + // Get the offsets (relative to the base address) of the relocation + // entries, of which the relocation address falls into the range of + // section identified by `sec_name'. + // + // The relocation entry is of type: + // - Elf64_Rel on x86_64, + // - Elf32_Rel on x86. + // + // To check whether current enclave has any TEXTREL: + // get_reloc_entry_offset(".text", offsets); + void get_reloc_entry_offset(const char* sec_name, + vector& offsets); + + sgx_status_t modify_info(enclave_diff_info_t *enclave_diff_info); + sgx_status_t get_info(enclave_diff_info_t *enclave_diff_info); + +private: + const uint8_t* m_start_addr; + uint64_t m_len; + bin_fmt_t m_bin_fmt; + vector
m_sections; + const Section* m_tls_section; + uint64_t m_metadata_offset; + uint64_t m_metadata_block_size;/*multiple metadata block size*/ + + ElfW(Dyn) m_dyn_info[DT_NUM + DT_ADDRNUM]; + + // A map from symbol name to its RVA + map m_sym_table; +}; + +#endif diff --git a/psw/urts/parser/parserfactory.cpp b/psw/urts/parser/parserfactory.cpp new file mode 100644 index 0000000000..3e2c7c0c2d --- /dev/null +++ b/psw/urts/parser/parserfactory.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include "parserfactory.h" +#include "util.h" + +#include "elf32parser.h" +#include "elf64parser.h" + +namespace { + bin_fmt_t check_elf_format(const uint8_t* start_addr, uint64_t len) + { + assert(start_addr != NULL); + const Elf32_Ehdr* ehdr = (const Elf32_Ehdr *) start_addr; + + if (len < sizeof(Elf32_Ehdr)) + return BF_UNKNOWN; + + if (strncmp((const char *)ehdr->e_ident, ELFMAG, SELFMAG) != 0) + return BF_UNKNOWN; + + switch (ehdr->e_ident[EI_CLASS]) + { + case ELFCLASS32: return BF_ELF32; + case ELFCLASS64: return BF_ELF64; + default: return BF_UNKNOWN; + } + } +} + +namespace binparser { + /* Note, the `start_addr' should NOT be NULL! */ + BinParser* get_parser(const uint8_t* start_addr, uint64_t len) + { + assert(start_addr != NULL); + + bin_fmt_t bf = BF_UNKNOWN; + + bf = check_elf_format(start_addr, len); + if (bf == BF_ELF64) return new Elf64Parser(start_addr, len); + + /* Doesn't matter whether it is an ELF32 shared library or not, + * here we just make sure that the factory method won't return + * NULL. + */ + return new Elf32Parser(start_addr, len); + } +} diff --git a/psw/urts/parser/parserfactory.h b/psw/urts/parser/parserfactory.h new file mode 100644 index 0000000000..c99a77c4a8 --- /dev/null +++ b/psw/urts/parser/parserfactory.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _PARSER_FACTORY_H_ +#define _PARSER_FACTORY_H_ + +#include "binparser.h" + + +namespace binparser { +// Create a parser instance `p' automatically. +// The caller needs to destroy the instance with `delete p'. +// +// Return NULL if no suitable parser found. +BinParser* get_parser(const uint8_t* start_addr, uint64_t len); +} + +#endif diff --git a/psw/urts/parser/section.cpp b/psw/urts/parser/section.cpp new file mode 100644 index 0000000000..9b2a67be34 --- /dev/null +++ b/psw/urts/parser/section.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "section.h" + +#include +#include + +Section::Section(const uint8_t* start_addr, uint64_t size, uint64_t virt_size, + uint64_t rva, si_flags_t sf) + :m_start_addr(start_addr), m_raw_data_size(size), m_rva(rva), + m_virtual_size(virt_size), m_si_flag(sf) +{} + +Section::~Section() +{ +} + +const uint8_t* Section::raw_data(void) const +{ + return m_start_addr; +} + +uint64_t Section::raw_data_size(void) const +{ + return m_raw_data_size; +} + +uint64_t Section::get_rva(void) const +{ + return m_rva; +} + +uint64_t Section::virtual_size(void) const +{ + return m_virtual_size; +} + +si_flags_t Section::get_si_flags(void) const +{ + return m_si_flag; +} diff --git a/psw/urts/parser/section.h b/psw/urts/parser/section.h new file mode 100644 index 0000000000..c54280e03f --- /dev/null +++ b/psw/urts/parser/section.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SECTION_H_ +#define _SECTION_H_ + +#include "arch.h" // for `si_flag_t' etc. + +#include "uncopyable.h" +#include + +class Section : private Uncopyable +{ +public: + Section(const uint8_t* start_addr, uint64_t size, uint64_t virt_size, + uint64_t rva, si_flags_t sf); + ~Section(); + + const uint8_t* raw_data(void) const; + uint64_t raw_data_size(void) const; + + uint64_t get_rva(void) const; + + // The virtual size is rounded to align with 1-page. + uint64_t virtual_size(void) const; + + si_flags_t get_si_flags(void) const; + +private: + const uint8_t* m_start_addr; + uint64_t m_raw_data_size; + uint64_t m_rva; + uint64_t m_virtual_size; + si_flags_t m_si_flag; +}; + +#endif diff --git a/psw/urts/parser/update_global_data.hxx b/psw/urts/parser/update_global_data.hxx new file mode 100644 index 0000000000..236a3a3d70 --- /dev/null +++ b/psw/urts/parser/update_global_data.hxx @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +namespace { + void do_update_global_data(const create_param_t* const create_param, + global_data_t* global_data) + { + global_data->enclave_size = (sys_word_t)create_param->enclave_size; + global_data->heap_offset = (sys_word_t)create_param->heap_offset; + global_data->heap_size = (sys_word_t)create_param->heap_max_size; + global_data->thread_policy = (uint32_t)create_param->tcs_policy; + thread_data_t *thread_data = &global_data->td_template; + thread_data->stack_base_addr = (sys_word_t)create_param->stack_base_addr; + thread_data->stack_limit_addr = (sys_word_t)create_param->stack_limit_addr; + thread_data->last_sp = thread_data->stack_base_addr; + thread_data->ssa_frame_size = create_param->ssa_frame_size; + thread_data->first_ssa_gpr = (sys_word_t)create_param->first_ssa_gpr; + // TD address relative to TCS + thread_data->self_addr = (sys_word_t)create_param->td_addr; + thread_data->tls_addr = (sys_word_t)create_param->tls_addr; + thread_data->tls_array = thread_data->self_addr + (sys_word_t)offsetof(thread_data_t, tls_addr); + } +} diff --git a/psw/urts/prd_css_util.cpp b/psw/urts/prd_css_util.cpp new file mode 100644 index 0000000000..f6171798dc --- /dev/null +++ b/psw/urts/prd_css_util.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "arch.h" +#include "launch_checker.h" +#include "se_vendor.h" +#include "prd_css_util.h" +#include "se_memcpy.h" + +#include +#include +#include + + + +extern "C" int read_prd_css(const prd_css_path_t prd_css_path, enclave_css_t *css) +{ + assert(css != NULL); + + enclave_css_t prd_css; + memset(&prd_css, 0, sizeof(enclave_css_t)); + + FILE * fp = NULL; + fp = fopen(prd_css_path, "rb"); + if(fp == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + + fseek(fp, 0L, SEEK_END); + if(ftell(fp) != sizeof(enclave_css_t)) + { + fclose(fp); + return SGX_ERROR_INVALID_PARAMETER; + } + fseek(fp, 0L, SEEK_SET); + if(fread(&prd_css, 1, sizeof(enclave_css_t), fp) != sizeof(enclave_css_t)) + { + fclose(fp); + return SGX_ERROR_INVALID_PARAMETER; + } + fclose(fp); + + memcpy_s(css, sizeof(enclave_css_t), &prd_css, sizeof(prd_css)); + return SGX_SUCCESS; +} + +extern "C" bool is_le(SGXLaunchToken *lc, const enclave_css_t *const css) +{ + assert(NULL != css && NULL != lc); + sgx_launch_token_t token; + + lc->get_launch_token(&token); + + token_t *launch = reinterpret_cast(token); + + if(INTEL_VENDOR_ID == css->header.module_vendor + && LE_PROD_ID == css->body.isv_prod_id + && 0 != css->header.hw_version + && 0 == launch->body.valid) + return true; + + return false; +} diff --git a/psw/urts/prd_css_util.h b/psw/urts/prd_css_util.h new file mode 100644 index 0000000000..e0f6075c95 --- /dev/null +++ b/psw/urts/prd_css_util.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _PRD_CSS_UTIL_H_ +#define _PRD_CSS_UTIL_H_ +#include "arch.h" +#include "launch_checker.h" +#include "file.h" +#include + +#define LE_PROD_ID 0x20 + +#ifdef __cplusplus +extern "C" { +#endif + int read_prd_css(const prd_css_path_t prd_css_path, enclave_css_t *css); + bool is_le(SGXLaunchToken *lc, const enclave_css_t *const css); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/psw/urts/routine.cpp b/psw/urts/routine.cpp new file mode 100644 index 0000000000..ed2af060e6 --- /dev/null +++ b/psw/urts/routine.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "enclave.h" +#include "routine.h" +#include "se_error_internal.h" +#include "xsave.h" + +extern "C" +sgx_status_t sgx_ecall(const sgx_enclave_id_t enclave_id, const int proc, const void *ocall_table, void *ms) +{ + if(proc < 0) + return SGX_ERROR_INVALID_FUNCTION; + + CEnclave* enclave = CEnclavePool::instance()->ref_enclave(enclave_id); + + //If we failed to reference enclave, there is no corresponding enclave instance, so we didn't increase the enclave.m_ref; + if(!enclave) + return SGX_ERROR_INVALID_ENCLAVE_ID; + + sgx_status_t result = SGX_ERROR_UNEXPECTED; + { + result = enclave->ecall(proc, ocall_table, ms); + } + { + //This solution seems more readable and easy to validate, but low performace + CEnclavePool::instance()->unref_enclave(enclave); + } + + return result; +} + +extern "C" +int sgx_ocall(const unsigned int proc, const sgx_ocall_table_t *ocall_table, void *ms, CTrustThread *trust_thread) +{ + assert(trust_thread != NULL); + CEnclave* enclave = trust_thread->get_enclave(); + assert(enclave != NULL); + return enclave->ocall(proc, ocall_table, ms); +} diff --git a/psw/urts/se_detect.cpp b/psw/urts/se_detect.cpp new file mode 100644 index 0000000000..621a9eed4a --- /dev/null +++ b/psw/urts/se_detect.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_detect.h" +#include "cpuid.h" + +bool is_se_supported() +{ + int cpu_info[4] = {0, 0, 0, 0}; + __cpuidex(cpu_info, CPUID_FEATURE_FLAGS, 0); + if (!(cpu_info[1] & (1<secs_attr.flags = ((uint64_t)cpu_info[1] << 32) | cpu_info[0]; + + if(false == try_read_xcr0(&se_misc_attr->secs_attr.xfrm)) + { + se_misc_attr->secs_attr.xfrm = SGX_XFRM_LEGACY; + } + //If x-feature is supported and enabled by OS, we need make sure it is also supported in se. + else + { + se_misc_attr->secs_attr.xfrm &= (((uint64_t)cpu_info[3] << 32) | cpu_info[2]); + } + // use cpuid to get the misc_select + __cpuidex(cpu_info, SE_LEAF, 0); + se_misc_attr->misc_select = cpu_info[1]; + + return true; +} + + diff --git a/psw/urts/se_detect.h b/psw/urts/se_detect.h new file mode 100644 index 0000000000..8f2bce746d --- /dev/null +++ b/psw/urts/se_detect.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef SE_DETECT_H_ +#define SE_DETECT_H_ + +#include "se_types.h" +#include "sgx_attributes.h" + +#define SE_LEAF 0x12 +#define CPUID_FEATURE_FLAGS 7 +#define SE_FEATURE_SHIFT 2 +#define SE1_SHIFT 0 + +#define XSAVE_SHIFT 26 +#define OSXSAVE_SHIFT 27 + +bool try_read_xcr0(uint64_t *value); +//bool is_se_debug_supported(); +bool get_plat_cap_by_cpuid(sgx_misc_attribute_t *se_misc_attr); + +#endif diff --git a/psw/urts/se_ocalls.cpp b/psw/urts/se_ocalls.cpp new file mode 100644 index 0000000000..80c84c9384 --- /dev/null +++ b/psw/urts/se_ocalls.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: se_ocalls.cpp + * Description: + * Ocalls required by trusted libraries. + */ + +#include "sgx_defs.h" +#include "cpuid.h" + +extern "C" void sgx_oc_cpuidex(int cpuinfo[4], int leaf, int subleaf) +{ + __cpuidex(cpuinfo, leaf, subleaf); +} diff --git a/psw/urts/section_info.h b/psw/urts/section_info.h new file mode 100644 index 0000000000..f55dafdaf9 --- /dev/null +++ b/psw/urts/section_info.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _SECTION_INFO_H_ +#define _SECTION_INFO_H_ + +#include "arch.h" +#include "util.h" +#include + +using namespace std; + +typedef struct _section_info_t +{ + uint8_t *raw_data; //The file pointer to the first page of the section. + uint64_t raw_data_size; //The size of the section or the size of the initialized section on disk. + uint64_t rva; //The address of the first byte of the section relative to the image base when section is loaded into memory. + uint64_t virtual_size; //The total size of the section when loaded into memory. + si_flags_t flag; //the attribute of memory region. + vector *bitmap; //bitmap of the total image page, if bit is 1, the page should be writable. + //the first bit of scetion in the bitmap is bitmap[(rva >> PAGE_SHIFT) / 8] & (1 << ((rva >> PAGE_SHIFT) % 8)) + //if the bitmap is NULL, then no restrict on page attribute. +} section_info_t; + +#endif diff --git a/psw/urts/tcs.cpp b/psw/urts/tcs.cpp new file mode 100644 index 0000000000..4b7fc6b858 --- /dev/null +++ b/psw/urts/tcs.cpp @@ -0,0 +1,352 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "tcs.h" +#include "se_trace.h" +#include "sgx_error.h" +#include "se_memory.h" +#include "se_thread.h" +#include + +extern se_thread_id_t get_thread_id(); + + +CTrustThread::CTrustThread(tcs_t *tcs, CEnclave* enclave) + : m_tcs(tcs) + , m_enclave(enclave) + , m_reference(0) + , m_event(NULL) +{ + memset(&m_tcs_info, 0, sizeof(debug_tcs_info_t)); + m_tcs_info.TCS_address = reinterpret_cast(tcs); + m_tcs_info.ocall_frame = 0; + m_tcs_info.thread_id = 0; +} + +CTrustThread::~CTrustThread() +{ + se_event_destroy(m_event); + m_event = NULL; +} + +se_handle_t CTrustThread::get_event() +{ + if (m_event == NULL) + m_event = se_event_init(); + + return m_event; +} + +void CTrustThread::push_ocall_frame(ocall_frame_t* frame_point) +{ + frame_point->index = this->get_reference(); + frame_point->pre_last_frame = m_tcs_info.ocall_frame; + m_tcs_info.ocall_frame = reinterpret_cast(frame_point); + m_tcs_info.thread_id = get_thread_id(); +} + +void CTrustThread::pop_ocall_frame() +{ + ocall_frame_t* last_ocall_frame = reinterpret_cast(m_tcs_info.ocall_frame); + if (last_ocall_frame) + { + m_tcs_info.ocall_frame = last_ocall_frame->pre_last_frame; + } +} + + +CTrustThreadPool::CTrustThreadPool() +{ + m_thread_list = NULL; +} + +CTrustThreadPool::~CTrustThreadPool() +{ + LockGuard lock(&m_thread_mutex); + //destroy free tcs list + for(vector::iterator it=m_free_thread_vector.begin(); it!=m_free_thread_vector.end(); it++) + { + delete *it; + } + m_free_thread_vector.clear(); + //destroy thread cache + Node* it = m_thread_list, *tmp = NULL; + while (it != NULL) + { + delete it->value; + tmp = it; + it = it->next; + delete tmp; + } + m_thread_list = NULL; +} + +void get_thread_set(vector &thread_vector); +inline int CTrustThreadPool::find_thread(vector &thread_vector, se_thread_id_t thread_id) +{ + for(vector::iterator it=thread_vector.begin(); it!=thread_vector.end(); it++) + if(*it == thread_id) + return TRUE; + return FALSE; +} + +inline CTrustThread * CTrustThreadPool::get_free_thread() +{ + if(true == m_free_thread_vector.empty()) + { + return NULL; + } + //if there is free tcs, remove it from free list + CTrustThread *thread_node = m_free_thread_vector.back(); + m_free_thread_vector.pop_back(); + + return thread_node; +} + +//This tcs policy is bind tcs with one thread. +int CTrustThreadPool::bind_thread(const se_thread_id_t thread_id, CTrustThread * const trust_thread) +{ + if (m_thread_list == NULL) { + m_thread_list = new Node(thread_id, trust_thread); + } else { + Node* it = new Node(thread_id, trust_thread); + if (m_thread_list->InsertNext(it) == false) { + delete it; + SE_TRACE(SE_TRACE_WARNING, "trust thread %x is already added to the list\n", trust_thread); + return FALSE; + } + } + return TRUE; +} + +CTrustThread * CTrustThreadPool::get_bound_thread(const se_thread_id_t thread_id) +{ + CTrustThread *trust_thread = NULL; + + Node* it = m_thread_list->Find(thread_id); + if(it != NULL) + trust_thread = it->value; + + return trust_thread; +} + +CTrustThread * CTrustThreadPool::add_thread(tcs_t * const tcs, CEnclave * const enclave) +{ + CTrustThread *trust_thread = new CTrustThread(tcs, enclave); + LockGuard lock(&m_thread_mutex); + //add tcs to free list + m_free_thread_vector.push_back(trust_thread); + + return trust_thread; +} + +CTrustThread *CTrustThreadPool::get_bound_thread(const tcs_t *tcs) +{ + //Since now this function will be call outside, we need get lock to protect map + LockGuard lock(&m_thread_mutex); + + CTrustThread *trust_thread = NULL; + if (m_thread_list == NULL) + return NULL; + Node* it = m_thread_list; + while (it != NULL) { + trust_thread = it->value; + if(trust_thread->get_tcs() == tcs) { + return trust_thread; + } + it = it->next; + } + return NULL; +} + +void CTrustThreadPool::reset() +{ + //get lock at the begin of list walk. + LockGuard lock(&m_thread_mutex); + + //walk through thread cache to free every element; + Node* it = m_thread_list, *tmp = NULL; + + while(it != NULL) + { + tmp = it; + it = it->next; + CTrustThread *trust_thread = tmp->value; + //remove from thread cache + delete tmp; + trust_thread->reset_ref(); + m_free_thread_vector.push_back(trust_thread); + } + m_thread_list = NULL; + + return; +} + +void CTrustThreadPool::wake_threads() +{ + LockGuard lock(&m_thread_mutex); + Node* it = m_thread_list; + + while (it != NULL) { + CTrustThread *thread = it->value; + se_handle_t event = thread->get_event(); + se_event_wake(event); + it = it->next; + } +} + +CTrustThread * CTrustThreadPool::_acquire_thread() +{ + //try to get tcs from thread cache + se_thread_id_t thread_id = get_thread_id(); + CTrustThread *trust_thread = get_bound_thread(thread_id); + if(NULL != trust_thread) + { + return trust_thread; + } + //try get tcs from free list; + trust_thread = get_free_thread(); + //if there is no free tcs, collect useless tcs. + if(NULL == trust_thread) + { + if(!garbage_collect()) + return NULL; + //get tcs from free list again. + trust_thread = get_free_thread(); + assert(NULL != trust_thread); + } + //we have got a free tcs. add the tcs to thread cache + bind_thread(thread_id, trust_thread); + return trust_thread; +} + +CTrustThread * CTrustThreadPool::acquire_thread() +{ + LockGuard lock(&m_thread_mutex); + CTrustThread *trust_thread = NULL; + + trust_thread = _acquire_thread(); + if(trust_thread) + trust_thread->increase_ref(); + + return trust_thread; +} + +//Do nothing for bind mode, the tcs is always bound to a thread. +void CTrustThreadPool::release_thread(CTrustThread * const trust_thread) +{ + LockGuard lock(&m_thread_mutex); + trust_thread->decrease_ref(); + return; +} + +//The return value stand for the number of free trust thread. +int CThreadPoolBindMode::garbage_collect() +{ + int nr_free = 0; + + //if free list is NULL, recycle tcs. + //get thread id set of current process + vector thread_vector; + get_thread_set(thread_vector); + //walk through thread cache to see if there is any thread that has exited + Node* it = m_thread_list, *pre = NULL, *tmp = NULL; + + while(it != NULL) + { + se_thread_id_t thread_id = it->key; + //if the thread has exited + if(FALSE == find_thread(thread_vector, thread_id)) + { + //if the reference is not 0, there must be some wrong termination, so we can't recycle such trust thread. + //return to free_tcs list + if(0 == it->value->get_reference()) + { + m_free_thread_vector.push_back(it->value); + nr_free++; + } + else + { + //the list only record the pointer of trust thread, so we can delete it first and then erase from map. + delete it->value; + } + tmp = it; + it = it->next; + if (tmp == m_thread_list) + m_thread_list = it; + if (pre != NULL) + pre->next = it; + //remove from thread cache + delete tmp; + } + else + { + pre = it; + it = it->next; + } + } + + return nr_free; +} + +int CThreadPoolUnBindMode::garbage_collect() +{ + int nr_free = 0; + + //walk through to free unused trust thread + Node* it = m_thread_list, *pre = NULL, *tmp = NULL; + while(it != NULL) + { + //if the reference is 0, then the trust thread is not in use, so return to free_tcs list + if(0 == it->value->get_reference()) + { + m_free_thread_vector.push_back(it->value); + nr_free++; + + tmp = it; + it = it->next; + if (tmp == m_thread_list) + m_thread_list = it; + if (pre != NULL) + pre->next = it; + //remove from thread cache + delete tmp; + } + else + { + pre = it; + it = it->next; + } + } + + return nr_free; +} diff --git a/psw/urts/tcs.h b/psw/urts/tcs.h new file mode 100644 index 0000000000..39c3484f13 --- /dev/null +++ b/psw/urts/tcs.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _TCS_H_ +#define _TCS_H_ +#include "arch.h" +#include "se_wrapper.h" +#include "util.h" +#include "sgx_error.h" +#include "se_debugger_lib.h" +#include "se_lock.hpp" +#include +#include "node.h" + +using namespace std; + +typedef int (*bridge_fn_t)(const void*); + +class CEnclave; + +class CTrustThread: private Uncopyable +{ +public: + CTrustThread(tcs_t *tcs, CEnclave* enclave); + ~CTrustThread(); + int get_reference() { return m_reference; } + void increase_ref() { m_reference++; } + void decrease_ref() { m_reference--; } + tcs_t *get_tcs() { return m_tcs; } + CEnclave *get_enclave() { return m_enclave; } + se_handle_t get_event(); + void reset_ref() { m_reference = 0; } + debug_tcs_info_t* get_debug_info(){return &m_tcs_info;} + void push_ocall_frame(ocall_frame_t* frame_point); + void pop_ocall_frame(); +private: + tcs_t *m_tcs; + CEnclave *m_enclave; + int m_reference; //it will increase by 1 before ecall, and decrease after ecall. + se_handle_t m_event; + debug_tcs_info_t m_tcs_info; +}; + +class CTrustThreadPool: private Uncopyable +{ +public: + CTrustThreadPool(); + virtual ~CTrustThreadPool(); + CTrustThread * acquire_thread(); + void release_thread(CTrustThread * const trust_thread); + CTrustThread *add_thread(tcs_t * const tcs, CEnclave * const enclave); + CTrustThread *get_bound_thread(const tcs_t *tcs); + void reset(); + void wake_threads(); +protected: + virtual int garbage_collect() = 0; + inline int find_thread(vector &thread_vector, se_thread_id_t thread_id); + inline CTrustThread * get_free_thread(); + int bind_thread(const se_thread_id_t thread_id, CTrustThread * const trust_thread); + CTrustThread * get_bound_thread(const se_thread_id_t thread_id); + + vector m_free_thread_vector; + Node *m_thread_list; + Mutex m_thread_mutex; //protect both thread_cache list and fress tcs list. The mutex is recursive. + //Thread can operate the two list when it get the mutex +private: + CTrustThread * _acquire_thread(); +}; + +class CThreadPoolBindMode : public CTrustThreadPool +{ +public: + CThreadPoolBindMode():CTrustThreadPool(){} +private: + virtual int garbage_collect(); +}; + +class CThreadPoolUnBindMode : public CTrustThreadPool +{ +public: + CThreadPoolUnBindMode():CTrustThreadPool(){} +private: + virtual int garbage_collect(); +}; +#endif diff --git a/psw/urts/urts_com.h b/psw/urts/urts_com.h new file mode 100644 index 0000000000..ab370bdf60 --- /dev/null +++ b/psw/urts/urts_com.h @@ -0,0 +1,378 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _URTS_COM_H_ +#define _URTS_COM_H_ + + +#include "arch.h" +#include "sgx_error.h" +#include "se_error_internal.h" +#include "se_trace.h" +#include "file.h" +#include "sgx_eid.h" +#include "se_map.h" +#include "launch_checker.h" +#include "debugger_support.h" +#include "loader.h" +#include "binparser.h" +#include "cpuid.h" +#include "se_macro.h" +#include "prd_css_util.h" +#include "se_detect.h" + +#ifndef PARSER +#include "elfparser.h" +#define PARSER ElfParser +#endif + +#include "ittnotify.h" +#include "ittnotify_config.h" +#include "ittnotify_types.h" + +extern "C" int __itt_init_ittlib(const char*, __itt_group_id); +extern "C" __itt_global* __itt_get_ittapi_global(); + + +#define HSW_C0 0x306c3 +#define GPR_A0 0x406e0 +#define GPR_B0 0x406e1 +#define GPR_P0 0x506e0 + +#ifndef SE_SIM +static int validate_platform() +{ + int cpu_info[4] = {0, 0, 0, 0}; + + __cpuid(cpu_info, 1); + + // The compatibility between SDK and PSW is checked by the metadata version. + // Below check the compatibility between the platform and uRTS only. + + + // It is HSW users' responsibility to make the uRTS version to consistent with the HSW patch. + if(cpu_info[0] == HSW_C0) + { + return SGX_SUCCESS; + } + + // GPR region + else if(cpu_info[0] == GPR_A0 || cpu_info[0] == GPR_B0 || cpu_info[0] == GPR_P0) + { + SE_TRACE(SE_TRACE_ERROR, "ERROR: The enclave cannot be launched on current platform.\n"); + return SGX_ERROR_INVALID_VERSION; + } + + return SGX_SUCCESS; +} +#endif + +static sgx_status_t get_metadata(BinParser *parser, const int debug, metadata_t **metadata, sgx_misc_attribute_t *sgx_misc_attr) +{ + assert(parser != NULL && metadata != NULL && sgx_misc_attr != NULL); + uint64_t meta_rva = parser->get_metadata_offset(); + const uint8_t *base_addr = parser->get_start_addr(); + + uint64_t meta_block_size = parser->get_metadata_block_size(); + uint64_t version = META_DATA_MAKE_VERSION(MAJOR_VERSION,MINOR_VERSION ); + + //scan multiple metadata list in sgx_metadata section + do{ + *metadata = GET_PTR(metadata_t, base_addr, meta_rva); + + if((*metadata)->magic_num != METADATA_MAGIC) + return SGX_ERROR_INVALID_METADATA; + //check metadata version + if(version == (*metadata)->version) + break; + + if(0 == (*metadata)->size) + { + SE_TRACE(SE_TRACE_ERROR, "ERROR: metadata's size can't be zero.\n"); + return SGX_ERROR_INVALID_METADATA; + } + meta_rva += (*metadata)->size; /*goto next metadata offset*/ + if(meta_rva - (parser->get_metadata_offset()) >= meta_block_size) + { + SE_TRACE(SE_TRACE_ERROR, "ERROR: Exceed metadata block bound.\n"); + return SGX_ERROR_INVALID_METADATA; + } + }while(1); + + return (sgx_status_t)get_enclave_creator()->get_misc_attr(sgx_misc_attr, *metadata, NULL, debug); +} + +static int __create_enclave(BinParser &parser, uint8_t* base_addr, const metadata_t *metadata, se_file_t& file, const bool debug, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr) +{ + // The "parser" will be registered into "loader" and "loader" will be registered into "enclave". + // After enclave is created, "parser" and "loader" are not needed any more. + debug_enclave_info_t *debug_info = NULL; + int ret = SGX_SUCCESS; + CLoader loader(base_addr, parser); + + ret = loader.load_enclave_ex(lc, debug, metadata, prd_css_file, misc_attr); + if (ret != SGX_SUCCESS) + { + return ret; + } + + CEnclave* enclave = new CEnclave(loader); + + // initialize the enclave object + ret = enclave->initialize(file, + loader.get_enclave_id(), + const_cast(loader.get_start_addr()), + metadata->enclave_size, + metadata->tcs_policy); + + if (ret != SGX_SUCCESS) + { + loader.destroy_enclave(); + delete enclave; // The `enclave' object owns the `loader' object. + return ret; + } + + std::vector tcs_list = loader.get_tcs_list(); + for (unsigned idx = 0; idx < tcs_list.size(); ++idx) + { + enclave->add_thread(tcs_list[idx]); + SE_TRACE(SE_TRACE_DEBUG, "add tcs %p\n", tcs_list[idx]); + } + + // It is accurate to get debug flag from secs + enclave->set_dbg_flag(!!(loader.get_secs().attributes.flags & SGX_FLAGS_DEBUG)); + + debug_info = const_cast(enclave->get_debug_info()); + + enclave->set_extra_debug_info(const_cast(loader.get_secs())); + + //add enclave to enclave pool before init_enclave because in simualtion + //mode init_enclave will rely on CEnclavePool to get Enclave instance. + if (FALSE == CEnclavePool::instance()->add_enclave(enclave)) + { + ret = SGX_ERROR_UNEXPECTED; + goto fail; + } + + if(debug) + debug_info->enclave_type |= ET_DEBUG; + if (!(get_enclave_creator()->use_se_hw())) + debug_info->enclave_type |= ET_SIM; + + bool isVTuneProfiling; + + if(debug || !(get_enclave_creator()->use_se_hw())) + { + SE_TRACE(SE_TRACE_DEBUG, "Debug enclave. Checking if VTune is profiling\n"); + + __itt_init_ittlib(NULL, __itt_group_none); + + if(__itt_get_ittapi_global()->api_initialized && __itt_get_ittapi_global()->lib) + isVTuneProfiling = true; + else + isVTuneProfiling = false; + + if(isVTuneProfiling) + { + SE_TRACE(SE_TRACE_DEBUG, "VTune is profiling\n"); + + bool thread_updated; + thread_updated = enclave->update_debug_flag(1); + + if(thread_updated == false) + { + SE_TRACE(SE_TRACE_DEBUG, "Failed to update debug OPTIN bit\n"); + } + else + { + SE_TRACE(SE_TRACE_DEBUG, "Updated debug OPTIN bit\n"); + } + + uint64_t enclave_start_addr; + uint64_t enclave_end_addr; + const char* enclave_path; + enclave_start_addr = (uint64_t) loader.get_start_addr(); + enclave_end_addr = enclave_start_addr + (uint64_t) metadata->enclave_size; + + SE_TRACE(SE_TRACE_DEBUG, "Invoking VTune's module mapping API __itt_module_load \n"); + SE_TRACE(SE_TRACE_DEBUG, "Enclave_start_addr==0x%llx\n", enclave_start_addr); + SE_TRACE(SE_TRACE_DEBUG, "Enclave_end_addr==0x%llx\n", enclave_end_addr); + + enclave_path = (const char*)file.name; + SE_TRACE(SE_TRACE_DEBUG, "Enclave_path==%s\n", enclave_path); + __itt_module_load((void*)enclave_start_addr, (void*) enclave_end_addr, enclave_path); + } + else + { + SE_TRACE(SE_TRACE_DEBUG, "VTune is not profiling. Debug OPTIN bit not set and API to do module mapping not invoked\n"); + } + } + + //send debug event to debugger when enclave is debug mode or release mode + //set struct version + debug_info->struct_version = enclave->get_debug_info()->struct_version; + //generate load debug event after EINIT + generate_enclave_debug_event(URTS_EXCEPTION_POSTINITENCLAVE, debug_info); + + + //call trts to do some intialization + if(SGX_SUCCESS != (ret = get_enclave_creator()->initialize(loader.get_enclave_id()))) + { + sgx_status_t status = SGX_SUCCESS; + CEnclavePool::instance()->remove_enclave(loader.get_enclave_id(), status); + goto fail; + } + + + if(SGX_SUCCESS != (ret = loader.set_memory_protection())) + { + sgx_status_t status = SGX_SUCCESS; + CEnclavePool::instance()->remove_enclave(loader.get_enclave_id(), status); + goto fail; + } + + *enclave_id = loader.get_enclave_id(); + return SGX_SUCCESS; + +fail: + loader.destroy_enclave(); + delete enclave; + return ret; +} + + +sgx_status_t _create_enclave(const bool debug, se_file_handle_t pfile, se_file_t& file, le_prd_css_file_t *prd_css_file, sgx_launch_token_t *launch, int *launch_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr) +{ + unsigned int ret = SGX_SUCCESS; + sgx_status_t lt_result = SGX_SUCCESS; + uint32_t file_size = 0; + map_handle_t* mh = NULL; + sgx_misc_attribute_t sgx_misc_attr; + metadata_t *metadata = NULL; + SGXLaunchToken *lc = NULL; + memset(&sgx_misc_attr, 0, sizeof(sgx_misc_attribute_t)); + + if(NULL == launch || NULL == launch_updated || NULL == enclave_id) + return SGX_ERROR_INVALID_PARAMETER; +#ifndef SE_SIM + ret = validate_platform(); + if(ret != SGX_SUCCESS) + return (sgx_status_t)ret; +#endif + + mh = map_file(pfile, &file_size); + if (!mh) + return SGX_ERROR_OUT_OF_MEMORY; + + PARSER parser(const_cast(mh->base_addr), (uint64_t)(file_size)); + if(SGX_SUCCESS != (ret = parser.run_parser())) + { + goto clean_return; + } + //Make sure HW uRTS won't load simulation enclave and vice verse. + if(get_enclave_creator()->use_se_hw() != (!parser.get_symbol_rva("g_global_data_sim"))) + { + SE_TRACE_WARNING("HW and Simulation mode incompatibility detected. The enclave is linked with the incorrect tRTS library.\n"); + ret = SGX_ERROR_MODE_INCOMPATIBLE; + goto clean_return; + } + + if(SGX_SUCCESS != (ret = get_metadata(&parser, debug, &metadata, &sgx_misc_attr))) + { + goto clean_return; + } + + *launch_updated = FALSE; + + lc = new SGXLaunchToken(&metadata->enclave_css, &sgx_misc_attr.secs_attr, launch); + lt_result = lc->update_launch_token(false); + if(SGX_SUCCESS != lt_result) + { + ret = lt_result; + goto clean_return; + } +#ifndef SE_SIM + // Only LE allows the prd_css_file + if(is_le(lc, &metadata->enclave_css) == false && prd_css_file != NULL) + { + ret = SGX_ERROR_INVALID_PARAMETER; + goto clean_return; + } +#endif + + //Need to set the whole misc_attr instead of just secs_attr. + do { + ret = __create_enclave(parser, mh->base_addr, metadata, file, debug, lc, prd_css_file, enclave_id, + misc_attr); + //SGX_ERROR_ENCLAVE_LOST caused by initializing enclave while power transition occurs + } while(SGX_ERROR_ENCLAVE_LOST == ret); + + if(SE_ERROR_INVALID_LAUNCH_TOKEN == ret || SGX_ERROR_INVALID_CPUSVN == ret) + ret = SGX_ERROR_UNEXPECTED; + + // The launch token is updated, so the SE_INVALID_MEASUREMENT is only caused by signature. + if(SE_ERROR_INVALID_MEASUREMENT == ret) + ret = SGX_ERROR_INVALID_SIGNATURE; + + // The launch token is updated, so the SE_ERROR_INVALID_ISVSVNLE means user needs to update the LE image + if (SE_ERROR_INVALID_ISVSVNLE == ret) + ret = SGX_ERROR_UPDATE_NEEDED; + + if(SGX_SUCCESS != ret) + goto clean_return; + else if(lc->is_launch_updated()) + { + *launch_updated = TRUE; + ret = lc->get_launch_token(launch); + } + + +clean_return: + if(mh != NULL) + unmap_file(mh); + if(lc != NULL) + delete lc; + return (sgx_status_t)ret; +} + +extern "C" sgx_status_t sgx_destroy_enclave(const sgx_enclave_id_t enclave_id) +{ + sgx_status_t status = SGX_SUCCESS; + CEnclave* enclave = CEnclavePool::instance()->remove_enclave(enclave_id, status); + + if (enclave) + { + delete enclave; + } + + return status; +} +#endif diff --git a/psw/urts/urts_version.cpp b/psw/urts/urts_version.cpp new file mode 100644 index 0000000000..68ec6ceedd --- /dev/null +++ b/psw/urts/urts_version.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" +#include "se_cdefs.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_URTS_VERSION_STR __CONCAT("SGX_URTS_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_urts_version = SGX_URTS_VERSION_STR; + +#ifdef __cplusplus +} +#endif + +SGX_ACCESS_VERSION(urts, 1) diff --git a/psw/urts/urts_xsave.cpp b/psw/urts/urts_xsave.cpp new file mode 100644 index 0000000000..71cd646b7d --- /dev/null +++ b/psw/urts/urts_xsave.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "xsave.h" +#include "util.h" +#include "se_detect.h" +#include "sgx_attributes.h" + +#define XFRM_YMM_BITMASK 0x00000004 + +// save_and_clean_xfeature_regs() +// do fwait, fxsave, and then clear the upper bits of YMM regs before executing EENTER. +// Parameters: +// buffer - if the pointer is not NULL, save the CPU state to the buffer +// Return Value: +// none + + + + + + + + +void save_and_clean_xfeature_regs(uint8_t *buffer) +{ + // XCR0 is not supposed to be changed. So query it once. + static uint64_t xcr0 = 0; + if(xcr0 == 0) + { + if(false == try_read_xcr0(&xcr0)) + { + xcr0 = SGX_XFRM_LEGACY; + } + } + + // do fwait to flush the float-point exceptions + do_fwait(); + + // do fxsave to save the CPU state before ecall + // no need to save the CPU state before oret + if(buffer != 0) + { + uint8_t *buf = (uint8_t*)ROUND_TO((size_t)buffer, FXSAVE_ALIGN_SIZE); + do_fxsave(buf); + } + + // clean the upper bits of the YMM regs + if(xcr0 & XFRM_YMM_BITMASK) + { + do_vzeroupper(); + } +} + +void restore_xfeature_regs(const uint8_t *buffer) +{ + if (buffer) + { + uint8_t *buf = (uint8_t*)ROUND_TO((size_t)buffer, FXSAVE_ALIGN_SIZE); + do_fxrstor(buf); + } +} diff --git a/sdk/Makefile b/sdk/Makefile new file mode 100644 index 0000000000..029026880b --- /dev/null +++ b/sdk/Makefile @@ -0,0 +1,222 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +# This Makefile will compile SDK to generate various components +# including: +# - Trusted libraries +# - tstdc: libsgx_tstdc.a +# - tstdcxx: libsgx_tstdcxx.a +# - tservice: libsgx_tservice.a +# - trts: libsgx_trts.a +# - tcrypto: libsgx_tcrypto.a +# - tkey_exchange: libsgx_tkey_exchange.a +# - Untrtusted libraries +# - ukey_exchange: libsgx_ukey_exchange.a +# - ptrace: libsgx_ptrace.so, gdb-sgx-plugin +# - sample_crypto: libsample_crypto.so (for sample code use) +# - Tools +# - signtool: sgx_sign +# - edger8r: sgx_edger8r +# - Simulation libraries and tools +# - simulation: libsgx_trts_sim.a, libsgx_tservice_sim.a, libsgx_urts_sim.a, libsgx_uae_service_sim.a, sgx_config_cpusvn +# +include ../buildenv.mk + +LIBTLIBC := $(BUILD_DIR)/libsgx_tstdc.a +LIBTLIBCXX := $(BUILD_DIR)/libsgx_tstdcxx.a +LIBTSE := $(BUILD_DIR)/libsgx_tservice.a + +.PHONY: all +all: tstdc tstdcxx tservice trts tcrypto tkey_exchange ukey_exchange ptrace sample_crypto simulation signtool edger8r + +# --------------------------------------------------- +# tstdc +# includes: tlibc, libm, tlibthread, compiler-rt +# --------------------------------------------------- +.PHONY: tstdc +tstdc: $(LIBTLIBC) + +$(LIBTLIBC): tlibthread compiler-rt sgx_libm + $(MAKE) -C tlibc/ -j4 2> /dev/null + @$(MKDIR) $(BUILD_DIR)/.libm $(BUILD_DIR)/.tlibc $(BUILD_DIR)/.tlibthread + @$(RM) -f $(BUILD_DIR)/.libm/* $(BUILD_DIR)/.tlibc/* $(BUILD_DIR)/.tlibthread/* + @cd $(BUILD_DIR)/.libm && $(AR) x $(LINUX_EXTERNAL_DIR)/sgx_libm/libm.a + @cd $(BUILD_DIR)/.tlibc && $(AR) x $(LINUX_SDK_DIR)/tlibc/libtlibc.a + @cd $(BUILD_DIR)/.tlibthread && $(AR) x $(LINUX_SDK_DIR)/tlibthread/libtlibthread.a + $(CP) compiler-rt/libcompiler-rt.a $@ + $(AR) rsD $@ $(BUILD_DIR)/.libm/*.o $(BUILD_DIR)/.tlibc/*.o $(BUILD_DIR)/.tlibthread/*.o + @$(RM) -rf $(BUILD_DIR)/.libm $(BUILD_DIR)/.tlibc $(BUILD_DIR)/.tlibthread + +.PHONY: tlibthread +tlibthread: + $(MAKE) -C tlibthread/ + +.PHONY: compiler-rt +compiler-rt: + $(MAKE) -C compiler-rt/ 2> /dev/null + +LIBM_PATH = $(LINUX_EXTERNAL_DIR)/sgx_libm/ + +M_ARCH = intel64 +ifneq ($(ARCH), x86_64) + M_ARCH := ia32 +endif + +.PHONY: sgx_libm +sgx_libm: + $(MAKE) -C $(LIBM_PATH) ARCH=$(M_ARCH) 2> /dev/null + +# --------------------------------------------------- +# tstdcxx +# includes: cpprt, tlibstdcxx +# --------------------------------------------------- +.PHONY: tstdcxx +tstdcxx: $(LIBTLIBCXX) + +$(LIBTLIBCXX): cpprt tlibstdcxx + @$(MKDIR) $(BUILD_DIR)/.cpprt $(BUILD_DIR)/.tlibstdcxx + @$(RM) -f $(BUILD_DIR)/.cpprt/* $(BUILD_DIR)/.tlibstdcxx/* + @cd $(BUILD_DIR)/.cpprt && $(AR) x $(LINUX_SDK_DIR)/cpprt/libcpprt.a + @cd $(BUILD_DIR)/.tlibstdcxx && $(AR) x $(LINUX_SDK_DIR)/tlibstdcxx/libtlibstdcxx.a + $(AR) rcsD $@ $(BUILD_DIR)/.cpprt/*.o $(BUILD_DIR)/.tlibstdcxx/*.o + @$(RM) -rf $(BUILD_DIR)/.cpprt $(BUILD_DIR)/.tlibstdcxx + +.PHONY: cpprt +cpprt: + $(MAKE) -C cpprt + +.PHONY: tlibstdcxx +tlibstdcxx: $(BUILD_DIR) + $(MAKE) -C tlibstdcxx/ 2> /dev/null + $(CP) tlibstdcxx/README.sgx $(BUILD_DIR)/STLport_Changes_SGX.txt + +# --------------------------------------------------- +# tse +# includes: selib, tseal, tae_service, ec_dh_lib +# --------------------------------------------------- +.PHONY: tservice +tservice: $(LIBTSE) + +$(LIBTSE): selib tseal tae_service + @$(MKDIR) $(BUILD_DIR)/.tservice + @$(RM) -f $(BUILD_DIR)/.tservice/* + cd $(BUILD_DIR)/.tservice && $(AR) x $(LINUX_SDK_DIR)/tseal/linux/libtSeal.a + cd $(BUILD_DIR)/.tservice && $(AR) x $(LINUX_SDK_DIR)/tae_service/libtae_service.a + $(CP) $(LINUX_SDK_DIR)/selib/linux/libselib.a $@ + $(AR) rsD $@ $(BUILD_DIR)/.tservice/*.o + @$(RM) -rf $(BUILD_DIR)/.tservice + +.PHONY: selib +selib: + $(MAKE) -C selib/linux/ + +.PHONY: tseal +tseal: + $(MAKE) -C tseal/linux/ + +.PHONY: tae_service +tae_service: + $(MAKE) -C tae_service + +# --------------------------------------------------- +# Other trusted libraries +# --------------------------------------------------- +.PHONY: trts +trts: + $(MAKE) -C trts/ + +.PHONY: tcrypto +tcrypto: + $(MAKE) -C tlibcrypto/ + +.PHONY: tkey_exchange +tkey_exchange: + $(MAKE) -C tkey_exchange + +# --------------------------------------------------- +# Untrusted libraries +# --------------------------------------------------- +.PHONY: ukey_exchange +ukey_exchange: + $(MAKE) -C ukey_exchange + +.PHONY: ptrace +ptrace: + $(MAKE) -C debugger_interface/linux/ + +.PHONY: sample_crypto +sample_crypto: + $(MAKE) -C sample_libcrypto + +# --------------------------------------------------- +# simualtion libraries and tools +# --------------------------------------------------- +.PHONY: simulation +simulation: + $(MAKE) -C simulation/ + +# --------------------------------------------------- +# tools +# --------------------------------------------------- +.PHONY: signtool +signtool: + $(MAKE) -C sign_tool/SignTool/ + +.PHONY: edger8r +edger8r: + $(MAKE) -C edger8r/linux/ + +$(BUILD_DIR): + $(MKDIR) $@ + +clean: + $(MAKE) -C $(LIBM_PATH) ARCH=$(M_ARCH) clean + $(MAKE) -C tlibc/ clean + $(MAKE) -C tlibthread/ clean + $(MAKE) -C compiler-rt/ clean + $(MAKE) -C cpprt clean + $(MAKE) -C tlibstdcxx/ clean + $(MAKE) -C tseal/linux/ clean + $(MAKE) -C selib/linux/ clean + $(MAKE) -C tae_service/ clean + $(MAKE) -C trts/ clean + $(MAKE) -C tlibcrypto/ clean + $(MAKE) -C tkey_exchange/ clean + $(MAKE) -C ukey_exchange/ clean + $(MAKE) -C debugger_interface/linux/ clean + $(MAKE) -C sample_libcrypto/ clean + $(MAKE) -C simulation/ clean + $(MAKE) -C sign_tool/SignTool clean + $(MAKE) -C edger8r/linux clean + @$(RM) $(LIBTLIBC) $(LIBTLIBCXX) $(LIBTSE) + @$(RM) $(BUILD_DIR)/STLport_Changes_SGX.txt + +rebuild: clean all diff --git a/sdk/compiler-rt/LICENSE.TXT b/sdk/compiler-rt/LICENSE.TXT new file mode 100644 index 0000000000..488baf5e3a --- /dev/null +++ b/sdk/compiler-rt/LICENSE.TXT @@ -0,0 +1,98 @@ +============================================================================== +compiler_rt License +============================================================================== + +The compiler_rt library is dual licensed under both the University of Illinois +"BSD-Like" license and the MIT license. As a user of this code you may choose +to use it under either license. As a contributor, you agree to allow your code +to be used under both. + +Full text of the relevant licenses is included below. + +============================================================================== + +University of Illinois/NCSA +Open Source License + +Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT + +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== + +Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- +sysinfo lib/asan/sysinfo +mach_override lib/asan/mach_override diff --git a/sdk/compiler-rt/Makefile b/sdk/compiler-rt/Makefile new file mode 100644 index 0000000000..202a2f6002 --- /dev/null +++ b/sdk/compiler-rt/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CFLAGS += $(ENCLAVE_CFLAGS) +CPPFLAGS += $(ADDED_INC) \ + -I$(COMMON_DIR)/inc/tlibc/ + +SRCS := $(wildcard *.c) +OBJS := $(SRCS:.c=.o) + +TARGET := libcompiler-rt.a + +.PHONY: all +all: $(TARGET) + +$(TARGET): $(OBJS) + $(AR) rcsD $@ $^ + +$(OBJS): %.o: %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(OBJS) $(TARGET) diff --git a/sdk/compiler-rt/addtf3.c b/sdk/compiler-rt/addtf3.c new file mode 100644 index 0000000000..e4bbe0227a --- /dev/null +++ b/sdk/compiler-rt/addtf3.c @@ -0,0 +1,25 @@ +//===-- lib/addtf3.c - Quad-precision addition --------------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements quad-precision soft-float addition with the IEEE-754 +// default rounding (to nearest, ties to even). +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#include "fp_add_impl.inc" + +COMPILER_RT_ABI long double __addtf3(long double a, long double b){ + return __addXf3__(a, b); +} + +#endif diff --git a/sdk/compiler-rt/ashldi3.c b/sdk/compiler-rt/ashldi3.c new file mode 100644 index 0000000000..eb4698ac51 --- /dev/null +++ b/sdk/compiler-rt/ashldi3.c @@ -0,0 +1,43 @@ +/* ====-- ashldi3.c - Implement __ashldi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ashldi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a << b */ + +/* Precondition: 0 <= b < bits_in_dword */ + +ARM_EABI_FNALIAS(llsl, ashldi3) + +COMPILER_RT_ABI di_int +__ashldi3(di_int a, si_int b) +{ + const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT); + dwords input; + dwords result; + input.all = a; + if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */ + { + result.s.low = 0; + result.s.high = input.s.low << (b - bits_in_word); + } + else /* 0 <= b < bits_in_word */ + { + if (b == 0) + return a; + result.s.low = input.s.low << b; + result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_word - b)); + } + return result.all; +} diff --git a/sdk/compiler-rt/ashlti3.c b/sdk/compiler-rt/ashlti3.c new file mode 100644 index 0000000000..638ae845ff --- /dev/null +++ b/sdk/compiler-rt/ashlti3.c @@ -0,0 +1,45 @@ +/* ===-- ashlti3.c - Implement __ashlti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ashlti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: a << b */ + +/* Precondition: 0 <= b < bits_in_tword */ + +COMPILER_RT_ABI ti_int +__ashlti3(ti_int a, si_int b) +{ + const int bits_in_dword = (int)(sizeof(di_int) * CHAR_BIT); + twords input; + twords result; + input.all = a; + if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */ + { + result.s.low = 0; + result.s.high = input.s.low << (b - bits_in_dword); + } + else /* 0 <= b < bits_in_dword */ + { + if (b == 0) + return a; + result.s.low = input.s.low << b; + result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_dword - b)); + } + return result.all; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/ashrdi3.c b/sdk/compiler-rt/ashrdi3.c new file mode 100644 index 0000000000..14c878bb77 --- /dev/null +++ b/sdk/compiler-rt/ashrdi3.c @@ -0,0 +1,44 @@ +/*===-- ashrdi3.c - Implement __ashrdi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ashrdi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: arithmetic a >> b */ + +/* Precondition: 0 <= b < bits_in_dword */ + +ARM_EABI_FNALIAS(lasr, ashrdi3) + +COMPILER_RT_ABI di_int +__ashrdi3(di_int a, si_int b) +{ + const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT); + dwords input; + dwords result; + input.all = a; + if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */ + { + /* result.s.high = input.s.high < 0 ? -1 : 0 */ + result.s.high = input.s.high >> (bits_in_word - 1); + result.s.low = input.s.high >> (b - bits_in_word); + } + else /* 0 <= b < bits_in_word */ + { + if (b == 0) + return a; + result.s.high = input.s.high >> b; + result.s.low = (input.s.high << (bits_in_word - b)) | (input.s.low >> b); + } + return result.all; +} diff --git a/sdk/compiler-rt/ashrti3.c b/sdk/compiler-rt/ashrti3.c new file mode 100644 index 0000000000..f78205d961 --- /dev/null +++ b/sdk/compiler-rt/ashrti3.c @@ -0,0 +1,46 @@ +/* ===-- ashrti3.c - Implement __ashrti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ashrti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: arithmetic a >> b */ + +/* Precondition: 0 <= b < bits_in_tword */ + +COMPILER_RT_ABI ti_int +__ashrti3(ti_int a, si_int b) +{ + const int bits_in_dword = (int)(sizeof(di_int) * CHAR_BIT); + twords input; + twords result; + input.all = a; + if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */ + { + /* result.s.high = input.s.high < 0 ? -1 : 0 */ + result.s.high = input.s.high >> (bits_in_dword - 1); + result.s.low = input.s.high >> (b - bits_in_dword); + } + else /* 0 <= b < bits_in_dword */ + { + if (b == 0) + return a; + result.s.high = input.s.high >> b; + result.s.low = (input.s.high << (bits_in_dword - b)) | (input.s.low >> b); + } + return result.all; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/clear_cache.c b/sdk/compiler-rt/clear_cache.c new file mode 100644 index 0000000000..e0bd8b045f --- /dev/null +++ b/sdk/compiler-rt/clear_cache.c @@ -0,0 +1,96 @@ +/* ===-- clear_cache.c - Implement __clear_cache ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#if __APPLE__ + #include +#endif +#if defined(__NetBSD__) && defined(__arm__) + #include +#endif + +#if defined(ANDROID) && defined(__mips__) + #include +#endif + +#if defined(ANDROID) && defined(__arm__) + #include +#endif + +/* + * The compiler generates calls to __clear_cache() when creating + * trampoline functions on the stack for use with nested functions. + * It is expected to invalidate the instruction cache for the + * specified range. + */ + +void __clear_cache(void *start, void *end) { +#if __i386__ || __x86_64__ +/* + * Intel processors have a unified instruction and data cache + * so there is nothing to do + */ +#elif defined(__arm__) && !defined(__APPLE__) + #if defined(__NetBSD__) + struct arm_sync_icache_args arg; + + arg.addr = (uintptr_t)start; + arg.len = (uintptr_t)end - (uintptr_t)start; + + sysarch(ARM_SYNC_ICACHE, &arg); + #elif defined(ANDROID) + const register int start_reg __asm("r0") = (int) (intptr_t) start; + const register int end_reg __asm("r1") = (int) (intptr_t) end; + const register int flags __asm("r2") = 0; + const register int syscall_nr __asm("r7") = __ARM_NR_cacheflush; + __asm __volatile("svc 0x0" : "=r"(start_reg) + : "r"(syscall_nr), "r"(start_reg), "r"(end_reg), "r"(flags) : "r0"); + if (start_reg != 0) { + compilerrt_abort(); + } + #else + compilerrt_abort(); + #endif +#elif defined(ANDROID) && defined(__mips__) + const uintptr_t start_int = (uintptr_t) start; + const uintptr_t end_int = (uintptr_t) end; + _flush_cache(start, (end_int - start_int), BCACHE); +#elif defined(__aarch64__) && !defined(__APPLE__) + uint64_t xstart = (uint64_t)(uintptr_t) start; + uint64_t xend = (uint64_t)(uintptr_t) end; + + // Get Cache Type Info + uint64_t ctr_el0; + __asm __volatile("mrs %0, ctr_el0" : "=r"(ctr_el0)); + + /* + * dc & ic instructions must use 64bit registers so we don't use + * uintptr_t in case this runs in an IPL32 environment. + */ + const size_t dcache_line_size = 4 << ((ctr_el0 >> 16) & 15); + for (uint64_t addr = xstart; addr < xend; addr += dcache_line_size) + __asm __volatile("dc cvau, %0" :: "r"(addr)); + __asm __volatile("dsb ish"); + + const size_t icache_line_size = 4 << ((ctr_el0 >> 0) & 15); + for (uint64_t addr = xstart; addr < xend; addr += icache_line_size) + __asm __volatile("ic ivau, %0" :: "r"(addr)); + __asm __volatile("isb sy"); +#else + #if __APPLE__ + /* On Darwin, sys_icache_invalidate() provides this functionality */ + sys_icache_invalidate(start, end-start); + #else + compilerrt_abort(); + #endif +#endif +} + diff --git a/sdk/compiler-rt/clzdi2.c b/sdk/compiler-rt/clzdi2.c new file mode 100644 index 0000000000..b9e64da492 --- /dev/null +++ b/sdk/compiler-rt/clzdi2.c @@ -0,0 +1,29 @@ +/* ===-- clzdi2.c - Implement __clzdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: the number of leading 0-bits */ + +/* Precondition: a != 0 */ + +COMPILER_RT_ABI si_int +__clzdi2(di_int a) +{ + dwords x; + x.all = a; + const si_int f = -(x.s.high == 0); + return __builtin_clz((x.s.high & ~f) | (x.s.low & f)) + + (f & ((si_int)(sizeof(si_int) * CHAR_BIT))); +} diff --git a/sdk/compiler-rt/clzsi2.c b/sdk/compiler-rt/clzsi2.c new file mode 100644 index 0000000000..25b8ed2c4c --- /dev/null +++ b/sdk/compiler-rt/clzsi2.c @@ -0,0 +1,53 @@ +/* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: the number of leading 0-bits */ + +/* Precondition: a != 0 */ + +COMPILER_RT_ABI si_int +__clzsi2(si_int a) +{ + su_int x = (su_int)a; + si_int t = ((x & 0xFFFF0000) == 0) << 4; /* if (x is small) t = 16 else 0 */ + x >>= 16 - t; /* x = [0 - 0xFFFF] */ + su_int r = t; /* r = [0, 16] */ + /* return r + clz(x) */ + t = ((x & 0xFF00) == 0) << 3; + x >>= 8 - t; /* x = [0 - 0xFF] */ + r += t; /* r = [0, 8, 16, 24] */ + /* return r + clz(x) */ + t = ((x & 0xF0) == 0) << 2; + x >>= 4 - t; /* x = [0 - 0xF] */ + r += t; /* r = [0, 4, 8, 12, 16, 20, 24, 28] */ + /* return r + clz(x) */ + t = ((x & 0xC) == 0) << 1; + x >>= 2 - t; /* x = [0 - 3] */ + r += t; /* r = [0 - 30] and is even */ + /* return r + clz(x) */ +/* switch (x) + * { + * case 0: + * return r + 2; + * case 1: + * return r + 1; + * case 2: + * case 3: + * return r; + * } + */ + return r + ((2 - x) & -((x & 2) == 0)); +} diff --git a/sdk/compiler-rt/clzti2.c b/sdk/compiler-rt/clzti2.c new file mode 100644 index 0000000000..15a7b3c900 --- /dev/null +++ b/sdk/compiler-rt/clzti2.c @@ -0,0 +1,33 @@ +/* ===-- clzti2.c - Implement __clzti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __clzti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: the number of leading 0-bits */ + +/* Precondition: a != 0 */ + +COMPILER_RT_ABI si_int +__clzti2(ti_int a) +{ + twords x; + x.all = a; + const di_int f = -(x.s.high == 0); + return __builtin_clzll((x.s.high & ~f) | (x.s.low & f)) + + ((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT))); +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/cmpdi2.c b/sdk/compiler-rt/cmpdi2.c new file mode 100644 index 0000000000..52634d9c33 --- /dev/null +++ b/sdk/compiler-rt/cmpdi2.c @@ -0,0 +1,51 @@ +/* ===-- cmpdi2.c - Implement __cmpdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __cmpdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: if (a < b) returns 0 +* if (a == b) returns 1 +* if (a > b) returns 2 +*/ + +COMPILER_RT_ABI si_int +__cmpdi2(di_int a, di_int b) +{ + dwords x; + x.all = a; + dwords y; + y.all = b; + if (x.s.high < y.s.high) + return 0; + if (x.s.high > y.s.high) + return 2; + if (x.s.low < y.s.low) + return 0; + if (x.s.low > y.s.low) + return 2; + return 1; +} + +#ifdef __ARM_EABI__ +/* Returns: if (a < b) returns -1 +* if (a == b) returns 0 +* if (a > b) returns 1 +*/ +COMPILER_RT_ABI si_int +__aeabi_lcmp(di_int a, di_int b) +{ + return __cmpdi2(a, b) - 1; +} +#endif + diff --git a/sdk/compiler-rt/cmpti2.c b/sdk/compiler-rt/cmpti2.c new file mode 100644 index 0000000000..2c8b56e29a --- /dev/null +++ b/sdk/compiler-rt/cmpti2.c @@ -0,0 +1,42 @@ +/* ===-- cmpti2.c - Implement __cmpti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __cmpti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: if (a < b) returns 0 + * if (a == b) returns 1 + * if (a > b) returns 2 + */ + +COMPILER_RT_ABI si_int +__cmpti2(ti_int a, ti_int b) +{ + twords x; + x.all = a; + twords y; + y.all = b; + if (x.s.high < y.s.high) + return 0; + if (x.s.high > y.s.high) + return 2; + if (x.s.low < y.s.low) + return 0; + if (x.s.low > y.s.low) + return 2; + return 1; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/comparetf2.c b/sdk/compiler-rt/comparetf2.c new file mode 100644 index 0000000000..a6436de89e --- /dev/null +++ b/sdk/compiler-rt/comparetf2.c @@ -0,0 +1,133 @@ +//===-- lib/comparetf2.c - Quad-precision comparisons -------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// // This file implements the following soft-float comparison routines: +// +// __eqtf2 __getf2 __unordtf2 +// __letf2 __gttf2 +// __lttf2 +// __netf2 +// +// The semantics of the routines grouped in each column are identical, so there +// is a single implementation for each, and wrappers to provide the other names. +// +// The main routines behave as follows: +// +// __letf2(a,b) returns -1 if a < b +// 0 if a == b +// 1 if a > b +// 1 if either a or b is NaN +// +// __getf2(a,b) returns -1 if a < b +// 0 if a == b +// 1 if a > b +// -1 if either a or b is NaN +// +// __unordtf2(a,b) returns 0 if both a and b are numbers +// 1 if either a or b is NaN +// +// Note that __letf2( ) and __getf2( ) are identical except in their handling of +// NaN values. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +enum LE_RESULT { + LE_LESS = -1, + LE_EQUAL = 0, + LE_GREATER = 1, + LE_UNORDERED = 1 +}; + +COMPILER_RT_ABI enum LE_RESULT __letf2(fp_t a, fp_t b) { + + const srep_t aInt = toRep(a); + const srep_t bInt = toRep(b); + const rep_t aAbs = aInt & absMask; + const rep_t bAbs = bInt & absMask; + + // If either a or b is NaN, they are unordered. + if (aAbs > infRep || bAbs > infRep) return LE_UNORDERED; + + // If a and b are both zeros, they are equal. + if ((aAbs | bAbs) == 0) return LE_EQUAL; + + // If at least one of a and b is positive, we get the same result comparing + // a and b as signed integers as we would with a floating-point compare. + if ((aInt & bInt) >= 0) { + if (aInt < bInt) return LE_LESS; + else if (aInt == bInt) return LE_EQUAL; + else return LE_GREATER; + } + else { + // Otherwise, both are negative, so we need to flip the sense of the + // comparison to get the correct result. (This assumes a twos- or ones- + // complement integer representation; if integers are represented in a + // sign-magnitude representation, then this flip is incorrect). + if (aInt > bInt) return LE_LESS; + else if (aInt == bInt) return LE_EQUAL; + else return LE_GREATER; + } +} + +enum GE_RESULT { + GE_LESS = -1, + GE_EQUAL = 0, + GE_GREATER = 1, + GE_UNORDERED = -1 // Note: different from LE_UNORDERED +}; + +COMPILER_RT_ABI enum GE_RESULT __getf2(fp_t a, fp_t b) { + + const srep_t aInt = toRep(a); + const srep_t bInt = toRep(b); + const rep_t aAbs = aInt & absMask; + const rep_t bAbs = bInt & absMask; + + if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; + if ((aAbs | bAbs) == 0) return GE_EQUAL; + if ((aInt & bInt) >= 0) { + if (aInt < bInt) return GE_LESS; + else if (aInt == bInt) return GE_EQUAL; + else return GE_GREATER; + } else { + if (aInt > bInt) return GE_LESS; + else if (aInt == bInt) return GE_EQUAL; + else return GE_GREATER; + } +} + +COMPILER_RT_ABI int __unordtf2(fp_t a, fp_t b) { + const rep_t aAbs = toRep(a) & absMask; + const rep_t bAbs = toRep(b) & absMask; + return aAbs > infRep || bAbs > infRep; +} + +// The following are alternative names for the preceding routines. + +COMPILER_RT_ABI enum LE_RESULT __eqtf2(fp_t a, fp_t b) { + return __letf2(a, b); +} + +COMPILER_RT_ABI enum LE_RESULT __lttf2(fp_t a, fp_t b) { + return __letf2(a, b); +} + +COMPILER_RT_ABI enum LE_RESULT __netf2(fp_t a, fp_t b) { + return __letf2(a, b); +} + +COMPILER_RT_ABI enum GE_RESULT __gttf2(fp_t a, fp_t b) { + return __getf2(a, b); +} + +#endif diff --git a/sdk/compiler-rt/ctzdi2.c b/sdk/compiler-rt/ctzdi2.c new file mode 100644 index 0000000000..db3c6fdc08 --- /dev/null +++ b/sdk/compiler-rt/ctzdi2.c @@ -0,0 +1,29 @@ +/* ===-- ctzdi2.c - Implement __ctzdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ctzdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: the number of trailing 0-bits */ + +/* Precondition: a != 0 */ + +COMPILER_RT_ABI si_int +__ctzdi2(di_int a) +{ + dwords x; + x.all = a; + const si_int f = -(x.s.low == 0); + return __builtin_ctz((x.s.high & f) | (x.s.low & ~f)) + + (f & ((si_int)(sizeof(si_int) * CHAR_BIT))); +} diff --git a/sdk/compiler-rt/ctzsi2.c b/sdk/compiler-rt/ctzsi2.c new file mode 100644 index 0000000000..c69486ea44 --- /dev/null +++ b/sdk/compiler-rt/ctzsi2.c @@ -0,0 +1,57 @@ +/* ===-- ctzsi2.c - Implement __ctzsi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ctzsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: the number of trailing 0-bits */ + +/* Precondition: a != 0 */ + +COMPILER_RT_ABI si_int +__ctzsi2(si_int a) +{ + su_int x = (su_int)a; + si_int t = ((x & 0x0000FFFF) == 0) << 4; /* if (x has no small bits) t = 16 else 0 */ + x >>= t; /* x = [0 - 0xFFFF] + higher garbage bits */ + su_int r = t; /* r = [0, 16] */ + /* return r + ctz(x) */ + t = ((x & 0x00FF) == 0) << 3; + x >>= t; /* x = [0 - 0xFF] + higher garbage bits */ + r += t; /* r = [0, 8, 16, 24] */ + /* return r + ctz(x) */ + t = ((x & 0x0F) == 0) << 2; + x >>= t; /* x = [0 - 0xF] + higher garbage bits */ + r += t; /* r = [0, 4, 8, 12, 16, 20, 24, 28] */ + /* return r + ctz(x) */ + t = ((x & 0x3) == 0) << 1; + x >>= t; + x &= 3; /* x = [0 - 3] */ + r += t; /* r = [0 - 30] and is even */ + /* return r + ctz(x) */ + +/* The branch-less return statement below is equivalent + * to the following switch statement: + * switch (x) + * { + * case 0: + * return r + 2; + * case 2: + * return r + 1; + * case 1: + * case 3: + * return r; + * } + */ + return r + ((2 - (x >> 1)) & -((x & 1) == 0)); +} diff --git a/sdk/compiler-rt/ctzti2.c b/sdk/compiler-rt/ctzti2.c new file mode 100644 index 0000000000..45de682700 --- /dev/null +++ b/sdk/compiler-rt/ctzti2.c @@ -0,0 +1,33 @@ +/* ===-- ctzti2.c - Implement __ctzti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ctzti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: the number of trailing 0-bits */ + +/* Precondition: a != 0 */ + +COMPILER_RT_ABI si_int +__ctzti2(ti_int a) +{ + twords x; + x.all = a; + const di_int f = -(x.s.low == 0); + return __builtin_ctzll((x.s.high & f) | (x.s.low & ~f)) + + ((si_int)f & ((si_int)(sizeof(di_int) * CHAR_BIT))); +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/divdi3.c b/sdk/compiler-rt/divdi3.c new file mode 100644 index 0000000000..b8eebcb204 --- /dev/null +++ b/sdk/compiler-rt/divdi3.c @@ -0,0 +1,29 @@ +/* ===-- divdi3.c - Implement __divdi3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __divdi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a / b */ + +COMPILER_RT_ABI di_int +__divdi3(di_int a, di_int b) +{ + const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1; + di_int s_a = a >> bits_in_dword_m1; /* s_a = a < 0 ? -1 : 0 */ + di_int s_b = b >> bits_in_dword_m1; /* s_b = b < 0 ? -1 : 0 */ + a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ + b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ + s_a ^= s_b; /*sign of quotient */ + return (__udivmoddi4(a, b, (du_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */ +} diff --git a/sdk/compiler-rt/divsi3.c b/sdk/compiler-rt/divsi3.c new file mode 100644 index 0000000000..bab4aefda3 --- /dev/null +++ b/sdk/compiler-rt/divsi3.c @@ -0,0 +1,37 @@ +/* ===-- divsi3.c - Implement __divsi3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __divsi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a / b */ + +ARM_EABI_FNALIAS(idiv, divsi3) + +COMPILER_RT_ABI si_int +__divsi3(si_int a, si_int b) +{ + const int bits_in_word_m1 = (int)(sizeof(si_int) * CHAR_BIT) - 1; + si_int s_a = a >> bits_in_word_m1; /* s_a = a < 0 ? -1 : 0 */ + si_int s_b = b >> bits_in_word_m1; /* s_b = b < 0 ? -1 : 0 */ + a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ + b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ + s_a ^= s_b; /* sign of quotient */ + /* + * On CPUs without unsigned hardware division support, + * this calls __udivsi3 (notice the cast to su_int). + * On CPUs with unsigned hardware division support, + * this uses the unsigned division instruction. + */ + return ((su_int)a/(su_int)b ^ s_a) - s_a; /* negate if s_a == -1 */ +} diff --git a/sdk/compiler-rt/divtf3.c b/sdk/compiler-rt/divtf3.c new file mode 100644 index 0000000000..e81dab826b --- /dev/null +++ b/sdk/compiler-rt/divtf3.c @@ -0,0 +1,203 @@ +//===-- lib/divtf3.c - Quad-precision division --------------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements quad-precision soft-float division +// with the IEEE-754 default rounding (to nearest, ties to even). +// +// For simplicity, this implementation currently flushes denormals to zero. +// It should be a fairly straightforward exercise to implement gradual +// underflow with correct rounding. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +COMPILER_RT_ABI fp_t __divtf3(fp_t a, fp_t b) { + + const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; + const unsigned int bExponent = toRep(b) >> significandBits & maxExponent; + const rep_t quotientSign = (toRep(a) ^ toRep(b)) & signBit; + + rep_t aSignificand = toRep(a) & significandMask; + rep_t bSignificand = toRep(b) & significandMask; + int scale = 0; + + // Detect if a or b is zero, denormal, infinity, or NaN. + if (aExponent-1U >= maxExponent-1U || bExponent-1U >= maxExponent-1U) { + + const rep_t aAbs = toRep(a) & absMask; + const rep_t bAbs = toRep(b) & absMask; + + // NaN / anything = qNaN + if (aAbs > infRep) return fromRep(toRep(a) | quietBit); + // anything / NaN = qNaN + if (bAbs > infRep) return fromRep(toRep(b) | quietBit); + + if (aAbs == infRep) { + // infinity / infinity = NaN + if (bAbs == infRep) return fromRep(qnanRep); + // infinity / anything else = +/- infinity + else return fromRep(aAbs | quotientSign); + } + + // anything else / infinity = +/- 0 + if (bAbs == infRep) return fromRep(quotientSign); + + if (!aAbs) { + // zero / zero = NaN + if (!bAbs) return fromRep(qnanRep); + // zero / anything else = +/- zero + else return fromRep(quotientSign); + } + // anything else / zero = +/- infinity + if (!bAbs) return fromRep(infRep | quotientSign); + + // one or both of a or b is denormal, the other (if applicable) is a + // normal number. Renormalize one or both of a and b, and set scale to + // include the necessary exponent adjustment. + if (aAbs < implicitBit) scale += normalize(&aSignificand); + if (bAbs < implicitBit) scale -= normalize(&bSignificand); + } + + // Or in the implicit significand bit. (If we fell through from the + // denormal path it was already set by normalize( ), but setting it twice + // won't hurt anything.) + aSignificand |= implicitBit; + bSignificand |= implicitBit; + int quotientExponent = aExponent - bExponent + scale; + + // Align the significand of b as a Q63 fixed-point number in the range + // [1, 2.0) and get a Q64 approximate reciprocal using a small minimax + // polynomial approximation: reciprocal = 3/4 + 1/sqrt(2) - b/2. This + // is accurate to about 3.5 binary digits. + const uint64_t q63b = bSignificand >> 49; + uint64_t recip64 = UINT64_C(0x7504f333F9DE6484) - q63b; + // 0x7504f333F9DE6484 / 2^64 + 1 = 3/4 + 1/sqrt(2) + + // Now refine the reciprocal estimate using a Newton-Raphson iteration: + // + // x1 = x0 * (2 - x0 * b) + // + // This doubles the number of correct binary digits in the approximation + // with each iteration. + uint64_t correction64; + correction64 = -((rep_t)recip64 * q63b >> 64); + recip64 = (rep_t)recip64 * correction64 >> 63; + correction64 = -((rep_t)recip64 * q63b >> 64); + recip64 = (rep_t)recip64 * correction64 >> 63; + correction64 = -((rep_t)recip64 * q63b >> 64); + recip64 = (rep_t)recip64 * correction64 >> 63; + correction64 = -((rep_t)recip64 * q63b >> 64); + recip64 = (rep_t)recip64 * correction64 >> 63; + correction64 = -((rep_t)recip64 * q63b >> 64); + recip64 = (rep_t)recip64 * correction64 >> 63; + + // recip64 might have overflowed to exactly zero in the preceeding + // computation if the high word of b is exactly 1.0. This would sabotage + // the full-width final stage of the computation that follows, so we adjust + // recip64 downward by one bit. + recip64--; + + // We need to perform one more iteration to get us to 112 binary digits; + // The last iteration needs to happen with extra precision. + const uint64_t q127blo = bSignificand << 15; + rep_t correction, reciprocal; + + // NOTE: This operation is equivalent to __multi3, which is not implemented + // in some architechure + rep_t r64q63, r64q127, r64cH, r64cL, dummy; + wideMultiply((rep_t)recip64, (rep_t)q63b, &dummy, &r64q63); + wideMultiply((rep_t)recip64, (rep_t)q127blo, &dummy, &r64q127); + + correction = -(r64q63 + (r64q127 >> 64)); + + uint64_t cHi = correction >> 64; + uint64_t cLo = correction; + + wideMultiply((rep_t)recip64, (rep_t)cHi, &dummy, &r64cH); + wideMultiply((rep_t)recip64, (rep_t)cLo, &dummy, &r64cL); + + reciprocal = r64cH + (r64cL >> 64); + + // We already adjusted the 64-bit estimate, now we need to adjust the final + // 128-bit reciprocal estimate downward to ensure that it is strictly smaller + // than the infinitely precise exact reciprocal. Because the computation + // of the Newton-Raphson step is truncating at every step, this adjustment + // is small; most of the work is already done. + reciprocal -= 2; + + // The numerical reciprocal is accurate to within 2^-112, lies in the + // interval [0.5, 1.0), and is strictly smaller than the true reciprocal + // of b. Multiplying a by this reciprocal thus gives a numerical q = a/b + // in Q127 with the following properties: + // + // 1. q < a/b + // 2. q is in the interval [0.5, 2.0) + // 3. the error in q is bounded away from 2^-113 (actually, we have a + // couple of bits to spare, but this is all we need). + + // We need a 128 x 128 multiply high to compute q, which isn't a basic + // operation in C, so we need to be a little bit fussy. + rep_t quotient, quotientLo; + wideMultiply(aSignificand << 2, reciprocal, "ient, "ientLo); + + // Two cases: quotient is in [0.5, 1.0) or quotient is in [1.0, 2.0). + // In either case, we are going to compute a residual of the form + // + // r = a - q*b + // + // We know from the construction of q that r satisfies: + // + // 0 <= r < ulp(q)*b + // + // if r is greater than 1/2 ulp(q)*b, then q rounds up. Otherwise, we + // already have the correct result. The exact halfway case cannot occur. + // We also take this time to right shift quotient if it falls in the [1,2) + // range and adjust the exponent accordingly. + rep_t residual; + rep_t qb; + + if (quotient < (implicitBit << 1)) { + wideMultiply(quotient, bSignificand, &dummy, &qb); + residual = (aSignificand << 113) - qb; + quotientExponent--; + } else { + quotient >>= 1; + wideMultiply(quotient, bSignificand, &dummy, &qb); + residual = (aSignificand << 112) - qb; + } + + const int writtenExponent = quotientExponent + exponentBias; + + if (writtenExponent >= maxExponent) { + // If we have overflowed the exponent, return infinity. + return fromRep(infRep | quotientSign); + } + else if (writtenExponent < 1) { + // Flush denormals to zero. In the future, it would be nice to add + // code to round them correctly. + return fromRep(quotientSign); + } + else { + const bool round = (residual << 1) >= bSignificand; + // Clear the implicit bit + rep_t absResult = quotient & significandMask; + // Insert the exponent + absResult |= (rep_t)writtenExponent << significandBits; + // Round + absResult += round; + // Insert the sign and return + const long double result = fromRep(absResult | quotientSign); + return result; + } +} + +#endif diff --git a/sdk/compiler-rt/divti3.c b/sdk/compiler-rt/divti3.c new file mode 100644 index 0000000000..c73eae28fe --- /dev/null +++ b/sdk/compiler-rt/divti3.c @@ -0,0 +1,33 @@ +/* ===-- divti3.c - Implement __divti3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __divti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: a / b */ + +COMPILER_RT_ABI ti_int +__divti3(ti_int a, ti_int b) +{ + const int bits_in_tword_m1 = (int)(sizeof(ti_int) * CHAR_BIT) - 1; + ti_int s_a = a >> bits_in_tword_m1; /* s_a = a < 0 ? -1 : 0 */ + ti_int s_b = b >> bits_in_tword_m1; /* s_b = b < 0 ? -1 : 0 */ + a = (a ^ s_a) - s_a; /* negate if s_a == -1 */ + b = (b ^ s_b) - s_b; /* negate if s_b == -1 */ + s_a ^= s_b; /* sign of quotient */ + return (__udivmodti4(a, b, (tu_int*)0) ^ s_a) - s_a; /* negate if s_a == -1 */ +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/extenddftf2.c b/sdk/compiler-rt/extenddftf2.c new file mode 100644 index 0000000000..86dab8f03a --- /dev/null +++ b/sdk/compiler-rt/extenddftf2.c @@ -0,0 +1,23 @@ +//===-- lib/extenddftf2.c - double -> quad conversion -------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#define SRC_DOUBLE +#define DST_QUAD +#include "fp_extend_impl.inc" + +COMPILER_RT_ABI long double __extenddftf2(double a) { + return __extendXfYf2__(a); +} + +#endif diff --git a/sdk/compiler-rt/extendsftf2.c b/sdk/compiler-rt/extendsftf2.c new file mode 100644 index 0000000000..2eeeba2848 --- /dev/null +++ b/sdk/compiler-rt/extendsftf2.c @@ -0,0 +1,23 @@ +//===-- lib/extendsftf2.c - single -> quad conversion -------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#define SRC_SINGLE +#define DST_QUAD +#include "fp_extend_impl.inc" + +COMPILER_RT_ABI long double __extendsftf2(float a) { + return __extendXfYf2__(a); +} + +#endif diff --git a/sdk/compiler-rt/ffsdi2.c b/sdk/compiler-rt/ffsdi2.c new file mode 100644 index 0000000000..a5ac9900ff --- /dev/null +++ b/sdk/compiler-rt/ffsdi2.c @@ -0,0 +1,33 @@ +/* ===-- ffsdi2.c - Implement __ffsdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ffsdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: the index of the least significant 1-bit in a, or + * the value zero if a is zero. The least significant bit is index one. + */ + +COMPILER_RT_ABI si_int +__ffsdi2(di_int a) +{ + dwords x; + x.all = a; + if (x.s.low == 0) + { + if (x.s.high == 0) + return 0; + return __builtin_ctz(x.s.high) + (1 + sizeof(si_int) * CHAR_BIT); + } + return __builtin_ctz(x.s.low) + 1; +} diff --git a/sdk/compiler-rt/ffsti2.c b/sdk/compiler-rt/ffsti2.c new file mode 100644 index 0000000000..dcdb3bd7f8 --- /dev/null +++ b/sdk/compiler-rt/ffsti2.c @@ -0,0 +1,37 @@ +/* ===-- ffsti2.c - Implement __ffsti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ffsti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: the index of the least significant 1-bit in a, or + * the value zero if a is zero. The least significant bit is index one. + */ + +COMPILER_RT_ABI si_int +__ffsti2(ti_int a) +{ + twords x; + x.all = a; + if (x.s.low == 0) + { + if (x.s.high == 0) + return 0; + return __builtin_ctzll(x.s.high) + (1 + sizeof(di_int) * CHAR_BIT); + } + return __builtin_ctzll(x.s.low) + 1; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/fixtfsi.c b/sdk/compiler-rt/fixtfsi.c new file mode 100644 index 0000000000..12b082d252 --- /dev/null +++ b/sdk/compiler-rt/fixtfsi.c @@ -0,0 +1,26 @@ +//===-- lib/fixtfsi.c - Quad-precision -> integer conversion ------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements quad-precision to integer conversion for the +// compiler-rt library. No range checking is performed; the behavior of this +// conversion is undefined for out of range values in the C standard. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#include "fp_fixsi_impl.inc" + +COMPILER_RT_ABI int __fixtfsi(fp_t a) { + return __fixXsi(a); +} + +#endif diff --git a/sdk/compiler-rt/floatsitf.c b/sdk/compiler-rt/floatsitf.c new file mode 100644 index 0000000000..85346933f8 --- /dev/null +++ b/sdk/compiler-rt/floatsitf.c @@ -0,0 +1,52 @@ +//===-- lib/floatsitf.c - integer -> quad-precision conversion ----*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements integer to quad-precision conversion for the +// compiler-rt library in the IEEE-754 default round-to-nearest, ties-to-even +// mode. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +COMPILER_RT_ABI fp_t __floatsitf(int a) { + + const int aWidth = sizeof a * CHAR_BIT; + + // Handle zero as a special case to protect clz + if (a == 0) + return fromRep(0); + + // All other cases begin by extracting the sign and absolute value of a + rep_t sign = 0; + unsigned aAbs = (unsigned)a; + if (a < 0) { + sign = signBit; + aAbs += 0x80000000; + } + + // Exponent of (fp_t)a is the width of abs(a). + const int exponent = (aWidth - 1) - __builtin_clz(a); + rep_t result; + + // Shift a into the significand field and clear the implicit bit. Extra + // cast to unsigned int is necessary to get the correct behavior for + // the input INT_MIN. + const int shift = significandBits - exponent; + result = (rep_t)aAbs << shift ^ implicitBit; + + // Insert the exponent + result += (rep_t)(exponent + exponentBias) << significandBits; + // Insert the sign bit and return + return fromRep(result | sign); +} + +#endif diff --git a/sdk/compiler-rt/floatunsitf.c b/sdk/compiler-rt/floatunsitf.c new file mode 100644 index 0000000000..1cd1842e70 --- /dev/null +++ b/sdk/compiler-rt/floatunsitf.c @@ -0,0 +1,40 @@ +//===-- lib/floatunsitf.c - uint -> quad-precision conversion -----*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements unsigned integer to quad-precision conversion for the +// compiler-rt library in the IEEE-754 default round-to-nearest, ties-to-even +// mode. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +COMPILER_RT_ABI fp_t __floatunsitf(unsigned int a) { + + const int aWidth = sizeof a * CHAR_BIT; + + // Handle zero as a special case to protect clz + if (a == 0) return fromRep(0); + + // Exponent of (fp_t)a is the width of abs(a). + const int exponent = (aWidth - 1) - __builtin_clz(a); + rep_t result; + + // Shift a into the significand field and clear the implicit bit. + const int shift = significandBits - exponent; + result = (rep_t)a << shift ^ implicitBit; + + // Insert the exponent + result += (rep_t)(exponent + exponentBias) << significandBits; + return fromRep(result); +} + +#endif diff --git a/sdk/compiler-rt/fp_extend.h b/sdk/compiler-rt/fp_extend.h new file mode 100644 index 0000000000..fff676eeca --- /dev/null +++ b/sdk/compiler-rt/fp_extend.h @@ -0,0 +1,76 @@ +//===-lib/fp_extend.h - low precision -> high precision conversion -*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Set source and destination setting +// +//===----------------------------------------------------------------------===// + +#ifndef FP_EXTEND_HEADER +#define FP_EXTEND_HEADER + +#include "int_lib.h" + +#if defined SRC_SINGLE +typedef float src_t; +typedef uint32_t src_rep_t; +#define SRC_REP_C UINT32_C +static const int srcSigBits = 23; +#define src_rep_t_clz __builtin_clz + +#elif defined SRC_DOUBLE +typedef double src_t; +typedef uint64_t src_rep_t; +#define SRC_REP_C UINT64_C +static const int srcSigBits = 52; +static inline int src_rep_t_clz(src_rep_t a) { +#if defined __LP64__ + return __builtin_clzl(a); +#else + if (a & REP_C(0xffffffff00000000)) + return __builtin_clz(a >> 32); + else + return 32 + __builtin_clz(a & REP_C(0xffffffff)); +#endif +} + +#else +#error Source should be single precision or double precision! +#endif //end source precision + +#if defined DST_DOUBLE +typedef double dst_t; +typedef uint64_t dst_rep_t; +#define DST_REP_C UINT64_C +static const int dstSigBits = 52; + +#elif defined DST_QUAD +typedef long double dst_t; +typedef __uint128_t dst_rep_t; +#define DST_REP_C (__uint128_t) +static const int dstSigBits = 112; + +#else +#error Destination should be double precision or quad precision! +#endif //end destination precision + +// End of specialization parameters. Two helper routines for conversion to and +// from the representation of floating-point data as integer values follow. + +static inline src_rep_t srcToRep(src_t x) { + const union { src_t f; src_rep_t i; } rep = {.f = x}; + return rep.i; +} + +static inline dst_t dstFromRep(dst_rep_t x) { + const union { dst_t f; dst_rep_t i; } rep = {.i = x}; + return rep.f; +} +// End helper routines. Conversion implementation follows. + +#endif //FP_EXTEND_HEADER diff --git a/sdk/compiler-rt/fp_lib.h b/sdk/compiler-rt/fp_lib.h new file mode 100644 index 0000000000..faebb99ecd --- /dev/null +++ b/sdk/compiler-rt/fp_lib.h @@ -0,0 +1,270 @@ +//===-- lib/fp_lib.h - Floating-point utilities -------------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file is a configuration header for soft-float routines in compiler-rt. +// This file does not provide any part of the compiler-rt interface, but defines +// many useful constants and utility routines that are used in the +// implementation of the soft-float routines in compiler-rt. +// +// Assumes that float, double and long double correspond to the IEEE-754 +// binary32, binary64 and binary 128 types, respectively, and that integer +// endianness matches floating point endianness on the target platform. +// +//===----------------------------------------------------------------------===// + +#ifndef FP_LIB_HEADER +#define FP_LIB_HEADER + +#include +#include +#include +#include "int_lib.h" + +// x86_64 FreeBSD prior v9.3 define fixed-width types incorrectly in +// 32-bit mode. +#if defined(__FreeBSD__) && defined(__i386__) +# include +# if __FreeBSD_version < 903000 // v9.3 +# define uint64_t unsigned long long +# define int64_t long long +# undef UINT64_C +# define UINT64_C(c) (c ## ULL) +# endif +#endif + +#if defined SINGLE_PRECISION + +typedef uint32_t rep_t; +typedef int32_t srep_t; +typedef float fp_t; +#define REP_C UINT32_C +#define significandBits 23 + +static inline int rep_clz(rep_t a) { + return __builtin_clz(a); +} + +// 32x32 --> 64 bit multiply +static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) { + const uint64_t product = (uint64_t)a*b; + *hi = product >> 32; + *lo = product; +} +COMPILER_RT_ABI fp_t __addsf3(fp_t a, fp_t b); + +#elif defined DOUBLE_PRECISION + +typedef uint64_t rep_t; +typedef int64_t srep_t; +typedef double fp_t; +#define REP_C UINT64_C +#define significandBits 52 + +static inline int rep_clz(rep_t a) { +#if defined __LP64__ + return __builtin_clzl(a); +#else + if (a & REP_C(0xffffffff00000000)) + return __builtin_clz(a >> 32); + else + return 32 + __builtin_clz(a & REP_C(0xffffffff)); +#endif +} + +#define loWord(a) (a & 0xffffffffU) +#define hiWord(a) (a >> 32) + +// 64x64 -> 128 wide multiply for platforms that don't have such an operation; +// many 64-bit platforms have this operation, but they tend to have hardware +// floating-point, so we don't bother with a special case for them here. +static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) { + // Each of the component 32x32 -> 64 products + const uint64_t plolo = loWord(a) * loWord(b); + const uint64_t plohi = loWord(a) * hiWord(b); + const uint64_t philo = hiWord(a) * loWord(b); + const uint64_t phihi = hiWord(a) * hiWord(b); + // Sum terms that contribute to lo in a way that allows us to get the carry + const uint64_t r0 = loWord(plolo); + const uint64_t r1 = hiWord(plolo) + loWord(plohi) + loWord(philo); + *lo = r0 + (r1 << 32); + // Sum terms contributing to hi with the carry from lo + *hi = hiWord(plohi) + hiWord(philo) + hiWord(r1) + phihi; +} +#undef loWord +#undef hiWord + +COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b); + +#elif defined QUAD_PRECISION +#if __LDBL_MANT_DIG__ == 113 +#define CRT_LDBL_128BIT +typedef __uint128_t rep_t; +typedef __int128_t srep_t; +typedef long double fp_t; +#define REP_C (__uint128_t) +// Note: Since there is no explicit way to tell compiler the constant is a +// 128-bit integer, we let the constant be casted to 128-bit integer +#define significandBits 112 + +static inline int rep_clz(rep_t a) { + const union + { + __uint128_t ll; +#if _YUGA_BIG_ENDIAN + struct { uint64_t high, low; } s; +#else + struct { uint64_t low, high; } s; +#endif + } uu = { .ll = a }; + + uint64_t word; + uint64_t add; + + if (uu.s.high){ + word = uu.s.high; + add = 0; + } + else{ + word = uu.s.low; + add = 64; + } + return __builtin_clzll(word) + add; +} + +#define Word_LoMask UINT64_C(0x00000000ffffffff) +#define Word_HiMask UINT64_C(0xffffffff00000000) +#define Word_FullMask UINT64_C(0xffffffffffffffff) +#define Word_1(a) (uint64_t)((a >> 96) & Word_LoMask) +#define Word_2(a) (uint64_t)((a >> 64) & Word_LoMask) +#define Word_3(a) (uint64_t)((a >> 32) & Word_LoMask) +#define Word_4(a) (uint64_t)(a & Word_LoMask) + +// 128x128 -> 256 wide multiply for platforms that don't have such an operation; +// many 64-bit platforms have this operation, but they tend to have hardware +// floating-point, so we don't bother with a special case for them here. +static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) { + + const uint64_t product11 = Word_1(a) * Word_1(b); + const uint64_t product12 = Word_1(a) * Word_2(b); + const uint64_t product13 = Word_1(a) * Word_3(b); + const uint64_t product14 = Word_1(a) * Word_4(b); + const uint64_t product21 = Word_2(a) * Word_1(b); + const uint64_t product22 = Word_2(a) * Word_2(b); + const uint64_t product23 = Word_2(a) * Word_3(b); + const uint64_t product24 = Word_2(a) * Word_4(b); + const uint64_t product31 = Word_3(a) * Word_1(b); + const uint64_t product32 = Word_3(a) * Word_2(b); + const uint64_t product33 = Word_3(a) * Word_3(b); + const uint64_t product34 = Word_3(a) * Word_4(b); + const uint64_t product41 = Word_4(a) * Word_1(b); + const uint64_t product42 = Word_4(a) * Word_2(b); + const uint64_t product43 = Word_4(a) * Word_3(b); + const uint64_t product44 = Word_4(a) * Word_4(b); + + const __uint128_t sum0 = (__uint128_t)product44; + const __uint128_t sum1 = (__uint128_t)product34 + + (__uint128_t)product43; + const __uint128_t sum2 = (__uint128_t)product24 + + (__uint128_t)product33 + + (__uint128_t)product42; + const __uint128_t sum3 = (__uint128_t)product14 + + (__uint128_t)product23 + + (__uint128_t)product32 + + (__uint128_t)product41; + const __uint128_t sum4 = (__uint128_t)product13 + + (__uint128_t)product22 + + (__uint128_t)product31; + const __uint128_t sum5 = (__uint128_t)product12 + + (__uint128_t)product21; + const __uint128_t sum6 = (__uint128_t)product11; + + const __uint128_t r0 = (sum0 & Word_FullMask) + + ((sum1 & Word_LoMask) << 32); + const __uint128_t r1 = (sum0 >> 64) + + ((sum1 >> 32) & Word_FullMask) + + (sum2 & Word_FullMask) + + ((sum3 << 32) & Word_HiMask); + + *lo = r0 + (r1 << 64); + *hi = (r1 >> 64) + + (sum1 >> 96) + + (sum2 >> 64) + + (sum3 >> 32) + + sum4 + + (sum5 << 32) + + (sum6 << 64); +} +#undef Word_1 +#undef Word_2 +#undef Word_3 +#undef Word_4 +#undef Word_HiMask +#undef Word_LoMask +#undef Word_FullMask +#endif // __LDBL_MANT_DIG__ == 113 +#else +#error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined. +#endif + +#if defined(SINGLE_PRECISION) || defined(DOUBLE_PRECISION) || defined(CRT_LDBL_128BIT) +#define typeWidth (sizeof(rep_t)*CHAR_BIT) +#define exponentBits (typeWidth - significandBits - 1) +#define maxExponent ((1 << exponentBits) - 1) +#define exponentBias (maxExponent >> 1) + +#define implicitBit (REP_C(1) << significandBits) +#define significandMask (implicitBit - 1U) +#define signBit (REP_C(1) << (significandBits + exponentBits)) +#define absMask (signBit - 1U) +#define exponentMask (absMask ^ significandMask) +#define oneRep ((rep_t)exponentBias << significandBits) +#define infRep exponentMask +#define quietBit (implicitBit >> 1) +#define qnanRep (exponentMask | quietBit) + +static inline rep_t toRep(fp_t x) { + const union { fp_t f; rep_t i; } rep = {.f = x}; + return rep.i; +} + +static inline fp_t fromRep(rep_t x) { + const union { fp_t f; rep_t i; } rep = {.i = x}; + return rep.f; +} + +static inline int normalize(rep_t *significand) { + const int shift = rep_clz(*significand) - rep_clz(implicitBit); + *significand <<= shift; + return 1 - shift; +} + +static inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) { + *hi = *hi << count | *lo >> (typeWidth - count); + *lo = *lo << count; +} + +static inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) { + if (count < typeWidth) { + const bool sticky = *lo << (typeWidth - count); + *lo = *hi << (typeWidth - count) | *lo >> count | sticky; + *hi = *hi >> count; + } + else if (count < 2*typeWidth) { + const bool sticky = *hi << (2*typeWidth - count) | *lo; + *lo = *hi >> (count - typeWidth) | sticky; + *hi = 0; + } else { + const bool sticky = *hi | *lo; + *lo = sticky; + *hi = 0; + } +} +#endif + +#endif // FP_LIB_HEADER diff --git a/sdk/compiler-rt/fp_trunc.h b/sdk/compiler-rt/fp_trunc.h new file mode 100644 index 0000000000..49a9aebbc6 --- /dev/null +++ b/sdk/compiler-rt/fp_trunc.h @@ -0,0 +1,64 @@ +//=== lib/fp_trunc.h - high precision -> low precision conversion *- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Set source and destination precision setting +// +//===----------------------------------------------------------------------===// + +#ifndef FP_TRUNC_HEADER +#define FP_TRUNC_HEADER + +#include "int_lib.h" + +#if defined SRC_DOUBLE +typedef double src_t; +typedef uint64_t src_rep_t; +#define SRC_REP_C UINT64_C +static const int srcSigBits = 52; + +#elif defined SRC_QUAD +typedef long double src_t; +typedef __uint128_t src_rep_t; +#define SRC_REP_C (__uint128_t) +static const int srcSigBits = 112; + +#else +#error Source should be double precision or quad precision! +#endif //end source precision + +#if defined DST_DOUBLE +typedef double dst_t; +typedef uint64_t dst_rep_t; +#define DST_REP_C UINT64_C +static const int dstSigBits = 52; + +#elif defined DST_SINGLE +typedef float dst_t; +typedef uint32_t dst_rep_t; +#define DST_REP_C UINT32_C +static const int dstSigBits = 23; + +#else +#error Destination should be single precision or double precision! +#endif //end destination precision + +// End of specialization parameters. Two helper routines for conversion to and +// from the representation of floating-point data as integer values follow. + +static inline src_rep_t srcToRep(src_t x) { + const union { src_t f; src_rep_t i; } rep = {.f = x}; + return rep.i; +} + +static inline dst_t dstFromRep(dst_rep_t x) { + const union { dst_t f; dst_rep_t i; } rep = {.i = x}; + return rep.f; +} + +#endif // FP_TRUNC_HEADER diff --git a/sdk/compiler-rt/int_endianness.h b/sdk/compiler-rt/int_endianness.h new file mode 100644 index 0000000000..7ac5056224 --- /dev/null +++ b/sdk/compiler-rt/int_endianness.h @@ -0,0 +1,113 @@ +/* ===-- int_endianness.h - configuration header for compiler-rt ------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file is a configuration header for compiler-rt. + * This file is not part of the interface of this library. + * + * ===----------------------------------------------------------------------=== + */ + +#ifndef INT_ENDIANNESS_H +#define INT_ENDIANNESS_H + +#if defined(__SVR4) && defined(__sun) +#include + +#if defined(_BIG_ENDIAN) +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif defined(_LITTLE_ENDIAN) +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#else /* !_LITTLE_ENDIAN */ +#error "unknown endianness" +#endif /* !_LITTLE_ENDIAN */ + +#endif /* Solaris and AuroraUX. */ + +/* .. */ + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \ + defined(__minix) +#include + +#if _BYTE_ORDER == _BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* _BYTE_ORDER */ + +#endif /* *BSD */ + +#if defined(__OpenBSD__) || defined(__Bitrig__) +#include + +#if _BYTE_ORDER == _BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* _BYTE_ORDER */ + +#endif /* OpenBSD and Bitrig. */ + +/* .. */ + +/* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the + * compiler (at least with GCC) */ +#if defined(__APPLE__) || defined(__ellcc__ ) + +#ifdef __BIG_ENDIAN__ +#if __BIG_ENDIAN__ +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#endif +#endif /* __BIG_ENDIAN__ */ + +#ifdef __LITTLE_ENDIAN__ +#if __LITTLE_ENDIAN__ +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif +#endif /* __LITTLE_ENDIAN__ */ + +#endif /* Mac OSX */ + +/* .. */ + +#if defined(__linux__) +#include + +#if __BYTE_ORDER == __BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif __BYTE_ORDER == __LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* __BYTE_ORDER */ + +#endif /* GNU/Linux */ + +#if defined(_WIN32) + +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 + +#endif /* Windows */ + +/* . */ + +#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN) +#error Unable to determine endian +#endif /* Check we found an endianness correctly. */ + +#endif /* INT_ENDIANNESS_H */ diff --git a/sdk/compiler-rt/int_lib.h b/sdk/compiler-rt/int_lib.h new file mode 100644 index 0000000000..ff314da986 --- /dev/null +++ b/sdk/compiler-rt/int_lib.h @@ -0,0 +1,70 @@ +/* ===-- int_lib.h - configuration header for compiler-rt -----------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file is a configuration header for compiler-rt. + * This file is not part of the interface of this library. + * + * ===----------------------------------------------------------------------=== + */ + +#ifndef INT_LIB_H +#define INT_LIB_H + +/* Assumption: Signed integral is 2's complement. */ +/* Assumption: Right shift of signed negative is arithmetic shift. */ +/* Assumption: Endianness is little or big (not mixed). */ + +/* ABI macro definitions */ + +#if __ARM_EABI__ +# define ARM_EABI_FNALIAS(aeabi_name, name) \ + void __aeabi_##aeabi_name() __attribute__((alias("__" #name))); +# define COMPILER_RT_ABI __attribute__((pcs("aapcs"))) +#else +# define ARM_EABI_FNALIAS(aeabi_name, name) +# define COMPILER_RT_ABI +#endif + +#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE)) +/* + * Kernel and boot environment can't use normal headers, + * so use the equivalent system headers. + */ +# include +# include +# include +#else +/* Include the standard compiler builtin headers we use functionality from. */ +# include +# include +# include +# include +#endif + +/* Include the commonly used internal type definitions. */ +#include "int_types.h" + +/* Include internal utility function declarations. */ +#include "int_util.h" + +COMPILER_RT_ABI si_int __paritysi2(si_int a); +COMPILER_RT_ABI si_int __paritydi2(di_int a); + +COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b); +COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b); +COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d); + +COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem); +COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem); +#ifdef CRT_HAS_128BIT +COMPILER_RT_ABI si_int __clzti2(ti_int a); +COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem); +#endif + +#endif /* INT_LIB_H */ diff --git a/sdk/compiler-rt/int_types.h b/sdk/compiler-rt/int_types.h new file mode 100644 index 0000000000..5107f71550 --- /dev/null +++ b/sdk/compiler-rt/int_types.h @@ -0,0 +1,143 @@ +/* ===-- int_lib.h - configuration header for compiler-rt -----------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file is not part of the interface of this library. + * + * This file defines various standard types, most importantly a number of unions + * used to access parts of larger types. + * + * ===----------------------------------------------------------------------=== + */ + +#ifndef INT_TYPES_H +#define INT_TYPES_H + +#include "int_endianness.h" + +typedef int si_int; +typedef unsigned su_int; + +typedef long long di_int; +typedef unsigned long long du_int; + +typedef union +{ + di_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + su_int low; + si_int high; +#else + si_int high; + su_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} dwords; + +typedef union +{ + du_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + su_int low; + su_int high; +#else + su_int high; + su_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} udwords; + +#if __LP64__ +#define CRT_HAS_128BIT +#endif + +#ifdef CRT_HAS_128BIT +typedef int ti_int __attribute__ ((mode (TI))); +typedef unsigned tu_int __attribute__ ((mode (TI))); + +typedef union +{ + ti_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + du_int low; + di_int high; +#else + di_int high; + du_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} twords; + +typedef union +{ + tu_int all; + struct + { +#if _YUGA_LITTLE_ENDIAN + du_int low; + du_int high; +#else + du_int high; + du_int low; +#endif /* _YUGA_LITTLE_ENDIAN */ + }s; +} utwords; + +static inline ti_int make_ti(di_int h, di_int l) { + twords r; + r.s.high = h; + r.s.low = l; + return r.all; +} + +static inline tu_int make_tu(du_int h, du_int l) { + utwords r; + r.s.high = h; + r.s.low = l; + return r.all; +} + +#endif /* CRT_HAS_128BIT */ + +typedef union +{ + su_int u; + float f; +} float_bits; + +typedef union +{ + udwords u; + double f; +} double_bits; + +typedef struct +{ +#if _YUGA_LITTLE_ENDIAN + udwords low; + udwords high; +#else + udwords high; + udwords low; +#endif /* _YUGA_LITTLE_ENDIAN */ +} uqwords; + +typedef union +{ + uqwords u; + long double f; +} long_double_bits; + +#endif /* INT_TYPES_H */ + diff --git a/sdk/compiler-rt/int_util.h b/sdk/compiler-rt/int_util.h new file mode 100644 index 0000000000..a9b595db8d --- /dev/null +++ b/sdk/compiler-rt/int_util.h @@ -0,0 +1,29 @@ +/* ===-- int_util.h - internal utility functions ----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===-----------------------------------------------------------------------=== + * + * This file is not part of the interface of this library. + * + * This file defines non-inline utilities which are available for use in the + * library. The function definitions themselves are all contained in int_util.c + * which will always be compiled into any compiler-rt library. + * + * ===-----------------------------------------------------------------------=== + */ + +#ifndef INT_UTIL_H +#define INT_UTIL_H + +/** \brief Trigger a program abort (or panic for kernel code). */ +#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \ + __func__) + +void compilerrt_abort_impl(const char *file, int line, + const char *function) __attribute__((noreturn)); + +#endif /* INT_UTIL_H */ diff --git a/sdk/compiler-rt/lshrdi3.c b/sdk/compiler-rt/lshrdi3.c new file mode 100644 index 0000000000..6b1ea923b7 --- /dev/null +++ b/sdk/compiler-rt/lshrdi3.c @@ -0,0 +1,43 @@ +/* ===-- lshrdi3.c - Implement __lshrdi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __lshrdi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: logical a >> b */ + +/* Precondition: 0 <= b < bits_in_dword */ + +ARM_EABI_FNALIAS(llsr, lshrdi3) + +COMPILER_RT_ABI di_int +__lshrdi3(di_int a, si_int b) +{ + const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT); + udwords input; + udwords result; + input.all = a; + if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */ + { + result.s.high = 0; + result.s.low = input.s.high >> (b - bits_in_word); + } + else /* 0 <= b < bits_in_word */ + { + if (b == 0) + return a; + result.s.high = input.s.high >> b; + result.s.low = (input.s.high << (bits_in_word - b)) | (input.s.low >> b); + } + return result.all; +} diff --git a/sdk/compiler-rt/lshrti3.c b/sdk/compiler-rt/lshrti3.c new file mode 100644 index 0000000000..e4170ff84a --- /dev/null +++ b/sdk/compiler-rt/lshrti3.c @@ -0,0 +1,45 @@ +/* ===-- lshrti3.c - Implement __lshrti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __lshrti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: logical a >> b */ + +/* Precondition: 0 <= b < bits_in_tword */ + +COMPILER_RT_ABI ti_int +__lshrti3(ti_int a, si_int b) +{ + const int bits_in_dword = (int)(sizeof(di_int) * CHAR_BIT); + utwords input; + utwords result; + input.all = a; + if (b & bits_in_dword) /* bits_in_dword <= b < bits_in_tword */ + { + result.s.high = 0; + result.s.low = input.s.high >> (b - bits_in_dword); + } + else /* 0 <= b < bits_in_dword */ + { + if (b == 0) + return a; + result.s.high = input.s.high >> b; + result.s.low = (input.s.high << (bits_in_dword - b)) | (input.s.low >> b); + } + return result.all; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/moddi3.c b/sdk/compiler-rt/moddi3.c new file mode 100644 index 0000000000..a04279e387 --- /dev/null +++ b/sdk/compiler-rt/moddi3.c @@ -0,0 +1,30 @@ +/*===-- moddi3.c - Implement __moddi3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __moddi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a % b */ + +COMPILER_RT_ABI di_int +__moddi3(di_int a, di_int b) +{ + const int bits_in_dword_m1 = (int)(sizeof(di_int) * CHAR_BIT) - 1; + di_int s = b >> bits_in_dword_m1; /* s = b < 0 ? -1 : 0 */ + b = (b ^ s) - s; /* negate if s == -1 */ + s = a >> bits_in_dword_m1; /* s = a < 0 ? -1 : 0 */ + a = (a ^ s) - s; /* negate if s == -1 */ + du_int r; + __udivmoddi4(a, b, &r); + return ((di_int)r ^ s) - s; /* negate if s == -1 */ +} diff --git a/sdk/compiler-rt/modsi3.c b/sdk/compiler-rt/modsi3.c new file mode 100644 index 0000000000..86c73ce137 --- /dev/null +++ b/sdk/compiler-rt/modsi3.c @@ -0,0 +1,23 @@ +/* ===-- modsi3.c - Implement __modsi3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __modsi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a % b */ + +COMPILER_RT_ABI si_int +__modsi3(si_int a, si_int b) +{ + return a - __divsi3(a, b) * b; +} diff --git a/sdk/compiler-rt/modti3.c b/sdk/compiler-rt/modti3.c new file mode 100644 index 0000000000..d505c07ac1 --- /dev/null +++ b/sdk/compiler-rt/modti3.c @@ -0,0 +1,34 @@ +/* ===-- modti3.c - Implement __modti3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __modti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/*Returns: a % b */ + +COMPILER_RT_ABI ti_int +__modti3(ti_int a, ti_int b) +{ + const int bits_in_tword_m1 = (int)(sizeof(ti_int) * CHAR_BIT) - 1; + ti_int s = b >> bits_in_tword_m1; /* s = b < 0 ? -1 : 0 */ + b = (b ^ s) - s; /* negate if s == -1 */ + s = a >> bits_in_tword_m1; /* s = a < 0 ? -1 : 0 */ + a = (a ^ s) - s; /* negate if s == -1 */ + tu_int r; + __udivmodti4(a, b, &r); + return ((ti_int)r ^ s) - s; /* negate if s == -1 */ +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/muldi3.c b/sdk/compiler-rt/muldi3.c new file mode 100644 index 0000000000..2dae44c11b --- /dev/null +++ b/sdk/compiler-rt/muldi3.c @@ -0,0 +1,56 @@ +/* ===-- muldi3.c - Implement __muldi3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __muldi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a * b */ + +static +di_int +__muldsi3(su_int a, su_int b) +{ + dwords r; + const int bits_in_word_2 = (int)(sizeof(si_int) * CHAR_BIT) / 2; + const su_int lower_mask = (su_int)~0 >> bits_in_word_2; + r.s.low = (a & lower_mask) * (b & lower_mask); + su_int t = r.s.low >> bits_in_word_2; + r.s.low &= lower_mask; + t += (a >> bits_in_word_2) * (b & lower_mask); + r.s.low += (t & lower_mask) << bits_in_word_2; + r.s.high = t >> bits_in_word_2; + t = r.s.low >> bits_in_word_2; + r.s.low &= lower_mask; + t += (b >> bits_in_word_2) * (a & lower_mask); + r.s.low += (t & lower_mask) << bits_in_word_2; + r.s.high += t >> bits_in_word_2; + r.s.high += (a >> bits_in_word_2) * (b >> bits_in_word_2); + return r.all; +} + +/* Returns: a * b */ + +ARM_EABI_FNALIAS(lmul, muldi3) + +COMPILER_RT_ABI di_int +__muldi3(di_int a, di_int b) +{ + dwords x; + x.all = a; + dwords y; + y.all = b; + dwords r; + r.all = __muldsi3(x.s.low, y.s.low); + r.s.high += x.s.high * y.s.low + x.s.low * y.s.high; + return r.all; +} diff --git a/sdk/compiler-rt/multf3.c b/sdk/compiler-rt/multf3.c new file mode 100644 index 0000000000..0b915923ea --- /dev/null +++ b/sdk/compiler-rt/multf3.c @@ -0,0 +1,25 @@ +//===-- lib/multf3.c - Quad-precision multiplication --------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements quad-precision soft-float multiplication +// with the IEEE-754 default rounding (to nearest, ties to even). +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#include "fp_mul_impl.inc" + +COMPILER_RT_ABI fp_t __multf3(fp_t a, fp_t b) { + return __mulXf3__(a, b); +} + +#endif diff --git a/sdk/compiler-rt/multi3.c b/sdk/compiler-rt/multi3.c new file mode 100644 index 0000000000..e0d52d430b --- /dev/null +++ b/sdk/compiler-rt/multi3.c @@ -0,0 +1,58 @@ +/* ===-- multi3.c - Implement __multi3 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + + * This file implements __multi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: a * b */ + +static +ti_int +__mulddi3(du_int a, du_int b) +{ + twords r; + const int bits_in_dword_2 = (int)(sizeof(di_int) * CHAR_BIT) / 2; + const du_int lower_mask = (du_int)~0 >> bits_in_dword_2; + r.s.low = (a & lower_mask) * (b & lower_mask); + du_int t = r.s.low >> bits_in_dword_2; + r.s.low &= lower_mask; + t += (a >> bits_in_dword_2) * (b & lower_mask); + r.s.low += (t & lower_mask) << bits_in_dword_2; + r.s.high = t >> bits_in_dword_2; + t = r.s.low >> bits_in_dword_2; + r.s.low &= lower_mask; + t += (b >> bits_in_dword_2) * (a & lower_mask); + r.s.low += (t & lower_mask) << bits_in_dword_2; + r.s.high += t >> bits_in_dword_2; + r.s.high += (a >> bits_in_dword_2) * (b >> bits_in_dword_2); + return r.all; +} + +/* Returns: a * b */ + +COMPILER_RT_ABI ti_int +__multi3(ti_int a, ti_int b) +{ + twords x; + x.all = a; + twords y; + y.all = b; + twords r; + r.all = __mulddi3(x.s.low, y.s.low); + r.s.high += x.s.high * y.s.low + x.s.low * y.s.high; + return r.all; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/negdi2.c b/sdk/compiler-rt/negdi2.c new file mode 100644 index 0000000000..3d49ba2899 --- /dev/null +++ b/sdk/compiler-rt/negdi2.c @@ -0,0 +1,26 @@ +/* ===-- negdi2.c - Implement __negdi2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __negdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: -a */ + +COMPILER_RT_ABI di_int +__negdi2(di_int a) +{ + /* Note: this routine is here for API compatibility; any sane compiler + * should expand it inline. + */ + return -a; +} diff --git a/sdk/compiler-rt/negti2.c b/sdk/compiler-rt/negti2.c new file mode 100644 index 0000000000..9b00b303f8 --- /dev/null +++ b/sdk/compiler-rt/negti2.c @@ -0,0 +1,30 @@ +/* ===-- negti2.c - Implement __negti2 -------------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __negti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: -a */ + +COMPILER_RT_ABI ti_int +__negti2(ti_int a) +{ + /* Note: this routine is here for API compatibility; any sane compiler + * should expand it inline. + */ + return -a; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/paritydi2.c b/sdk/compiler-rt/paritydi2.c new file mode 100644 index 0000000000..8ea5ab4214 --- /dev/null +++ b/sdk/compiler-rt/paritydi2.c @@ -0,0 +1,25 @@ +/* ===-- paritydi2.c - Implement __paritydi2 -------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __paritydi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: 1 if number of bits is odd else returns 0 */ + +COMPILER_RT_ABI si_int +__paritydi2(di_int a) +{ + dwords x; + x.all = a; + return __paritysi2(x.s.high ^ x.s.low); +} diff --git a/sdk/compiler-rt/paritysi2.c b/sdk/compiler-rt/paritysi2.c new file mode 100644 index 0000000000..5999846638 --- /dev/null +++ b/sdk/compiler-rt/paritysi2.c @@ -0,0 +1,27 @@ +/* ===-- paritysi2.c - Implement __paritysi2 -------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __paritysi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: 1 if number of bits is odd else returns 0 */ + +COMPILER_RT_ABI si_int +__paritysi2(si_int a) +{ + su_int x = (su_int)a; + x ^= x >> 16; + x ^= x >> 8; + x ^= x >> 4; + return (0x6996 >> (x & 0xF)) & 1; +} diff --git a/sdk/compiler-rt/parityti2.c b/sdk/compiler-rt/parityti2.c new file mode 100644 index 0000000000..5a4fe49248 --- /dev/null +++ b/sdk/compiler-rt/parityti2.c @@ -0,0 +1,29 @@ +/* ===-- parityti2.c - Implement __parityti2 -------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __parityti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: 1 if number of bits is odd else returns 0 */ + +COMPILER_RT_ABI si_int +__parityti2(ti_int a) +{ + twords x; + x.all = a; + return __paritydi2(x.s.high ^ x.s.low); +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/popcountdi2.c b/sdk/compiler-rt/popcountdi2.c new file mode 100644 index 0000000000..5e8a62f075 --- /dev/null +++ b/sdk/compiler-rt/popcountdi2.c @@ -0,0 +1,36 @@ +/* ===-- popcountdi2.c - Implement __popcountdi2 ----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __popcountdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: count of 1 bits */ + +COMPILER_RT_ABI si_int +__popcountdi2(di_int a) +{ + du_int x2 = (du_int)a; + x2 = x2 - ((x2 >> 1) & 0x5555555555555555uLL); + /* Every 2 bits holds the sum of every pair of bits (32) */ + x2 = ((x2 >> 2) & 0x3333333333333333uLL) + (x2 & 0x3333333333333333uLL); + /* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (16) */ + x2 = (x2 + (x2 >> 4)) & 0x0F0F0F0F0F0F0F0FuLL; + /* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (8) */ + su_int x = (su_int)(x2 + (x2 >> 32)); + /* The lower 32 bits hold four 16 bit sums (5 significant bits). */ + /* Upper 32 bits are garbage */ + x = x + (x >> 16); + /* The lower 16 bits hold two 32 bit sums (6 significant bits). */ + /* Upper 16 bits are garbage */ + return (x + (x >> 8)) & 0x0000007F; /* (7 significant bits) */ +} diff --git a/sdk/compiler-rt/popcountsi2.c b/sdk/compiler-rt/popcountsi2.c new file mode 100644 index 0000000000..44544ff498 --- /dev/null +++ b/sdk/compiler-rt/popcountsi2.c @@ -0,0 +1,33 @@ +/* ===-- popcountsi2.c - Implement __popcountsi2 ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __popcountsi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: count of 1 bits */ + +COMPILER_RT_ABI si_int +__popcountsi2(si_int a) +{ + su_int x = (su_int)a; + x = x - ((x >> 1) & 0x55555555); + /* Every 2 bits holds the sum of every pair of bits */ + x = ((x >> 2) & 0x33333333) + (x & 0x33333333); + /* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) */ + x = (x + (x >> 4)) & 0x0F0F0F0F; + /* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) */ + x = (x + (x >> 16)); + /* The lower 16 bits hold two 8 bit sums (5 significant bits).*/ + /* Upper 16 bits are garbage */ + return (x + (x >> 8)) & 0x0000003F; /* (6 significant bits) */ +} diff --git a/sdk/compiler-rt/popcountti2.c b/sdk/compiler-rt/popcountti2.c new file mode 100644 index 0000000000..7451bbb286 --- /dev/null +++ b/sdk/compiler-rt/popcountti2.c @@ -0,0 +1,44 @@ +/* ===-- popcountti2.c - Implement __popcountti2 ----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __popcountti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: count of 1 bits */ + +COMPILER_RT_ABI si_int +__popcountti2(ti_int a) +{ + tu_int x3 = (tu_int)a; + x3 = x3 - ((x3 >> 1) & (((tu_int)0x5555555555555555uLL << 64) | + 0x5555555555555555uLL)); + /* Every 2 bits holds the sum of every pair of bits (64) */ + x3 = ((x3 >> 2) & (((tu_int)0x3333333333333333uLL << 64) | 0x3333333333333333uLL)) + + (x3 & (((tu_int)0x3333333333333333uLL << 64) | 0x3333333333333333uLL)); + /* Every 4 bits holds the sum of every 4-set of bits (3 significant bits) (32) */ + x3 = (x3 + (x3 >> 4)) + & (((tu_int)0x0F0F0F0F0F0F0F0FuLL << 64) | 0x0F0F0F0F0F0F0F0FuLL); + /* Every 8 bits holds the sum of every 8-set of bits (4 significant bits) (16) */ + du_int x2 = (du_int)(x3 + (x3 >> 64)); + /* Every 8 bits holds the sum of every 8-set of bits (5 significant bits) (8) */ + su_int x = (su_int)(x2 + (x2 >> 32)); + /* Every 8 bits holds the sum of every 8-set of bits (6 significant bits) (4) */ + x = x + (x >> 16); + /* Every 8 bits holds the sum of every 8-set of bits (7 significant bits) (2) */ + /* Upper 16 bits are garbage */ + return (x + (x >> 8)) & 0xFF; /* (8 significant bits) */ +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/stack_chk.c b/sdk/compiler-rt/stack_chk.c new file mode 100644 index 0000000000..27478edb38 --- /dev/null +++ b/sdk/compiler-rt/stack_chk.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "stdlib.h" + +void +__attribute__((noreturn)) +__stack_chk_fail(void) +{ + abort(); +} + +void +__attribute__((noreturn)) +__attribute__((visibility ("hidden"))) +__stack_chk_fail_local (void) +{ + __stack_chk_fail (); +} + +extern void * __intel_security_cookie; + +#ifdef __x86_64__ +void __intel_security_check_cookie(void * cookie) +#else +void __attribute__ ((regparm(1))) __intel_security_check_cookie(void * cookie) +#endif /* __x86_64__ */ +{ + if (cookie == __intel_security_cookie) + return; + abort(); +} + diff --git a/sdk/compiler-rt/subtf3.c b/sdk/compiler-rt/subtf3.c new file mode 100644 index 0000000000..609b816f41 --- /dev/null +++ b/sdk/compiler-rt/subtf3.c @@ -0,0 +1,27 @@ +//===-- lib/subtf3.c - Quad-precision subtraction -----------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements quad-precision soft-float subtraction with the +// IEEE-754 default rounding (to nearest, ties to even). +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +COMPILER_RT_ABI fp_t __addtf3(fp_t a, fp_t b); + +// Subtraction; flip the sign bit of b and add. +COMPILER_RT_ABI fp_t +__subtf3(fp_t a, fp_t b) { + return __addtf3(a, fromRep(toRep(b) ^ signBit)); +} + +#endif diff --git a/sdk/compiler-rt/trunctfdf2.c b/sdk/compiler-rt/trunctfdf2.c new file mode 100644 index 0000000000..741a71b33c --- /dev/null +++ b/sdk/compiler-rt/trunctfdf2.c @@ -0,0 +1,22 @@ +//===-- lib/truncdfsf2.c - quad -> double conversion --------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#define SRC_QUAD +#define DST_DOUBLE +#include "fp_trunc_impl.inc" + +COMPILER_RT_ABI double __trunctfdf2(long double a) { + return __truncXfYf2__(a); +} + +#endif diff --git a/sdk/compiler-rt/trunctfsf2.c b/sdk/compiler-rt/trunctfsf2.c new file mode 100644 index 0000000000..de96c1decf --- /dev/null +++ b/sdk/compiler-rt/trunctfsf2.c @@ -0,0 +1,22 @@ +//===-- lib/trunctfsf2.c - quad -> single conversion --------------*- C -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +#define SRC_QUAD +#define DST_SINGLE +#include "fp_trunc_impl.inc" + +COMPILER_RT_ABI float __trunctfsf2(long double a) { + return __truncXfYf2__(a); +} + +#endif diff --git a/sdk/compiler-rt/ucmpdi2.c b/sdk/compiler-rt/ucmpdi2.c new file mode 100644 index 0000000000..40af23613b --- /dev/null +++ b/sdk/compiler-rt/ucmpdi2.c @@ -0,0 +1,51 @@ +/* ===-- ucmpdi2.c - Implement __ucmpdi2 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ucmpdi2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: if (a < b) returns 0 + * if (a == b) returns 1 + * if (a > b) returns 2 + */ + +COMPILER_RT_ABI si_int +__ucmpdi2(du_int a, du_int b) +{ + udwords x; + x.all = a; + udwords y; + y.all = b; + if (x.s.high < y.s.high) + return 0; + if (x.s.high > y.s.high) + return 2; + if (x.s.low < y.s.low) + return 0; + if (x.s.low > y.s.low) + return 2; + return 1; +} + +#ifdef __ARM_EABI__ +/* Returns: if (a < b) returns -1 +* if (a == b) returns 0 +* if (a > b) returns 1 +*/ +COMPILER_RT_ABI si_int +__aeabi_ulcmp(di_int a, di_int b) +{ + return __ucmpdi2(a, b) - 1; +} +#endif + diff --git a/sdk/compiler-rt/ucmpti2.c b/sdk/compiler-rt/ucmpti2.c new file mode 100644 index 0000000000..bda8083bb2 --- /dev/null +++ b/sdk/compiler-rt/ucmpti2.c @@ -0,0 +1,42 @@ +/* ===-- ucmpti2.c - Implement __ucmpti2 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __ucmpti2 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: if (a < b) returns 0 + * if (a == b) returns 1 + * if (a > b) returns 2 + */ + +COMPILER_RT_ABI si_int +__ucmpti2(tu_int a, tu_int b) +{ + utwords x; + x.all = a; + utwords y; + y.all = b; + if (x.s.high < y.s.high) + return 0; + if (x.s.high > y.s.high) + return 2; + if (x.s.low < y.s.low) + return 0; + if (x.s.low > y.s.low) + return 2; + return 1; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/udivdi3.c b/sdk/compiler-rt/udivdi3.c new file mode 100644 index 0000000000..dc68e154b1 --- /dev/null +++ b/sdk/compiler-rt/udivdi3.c @@ -0,0 +1,23 @@ +/* ===-- udivdi3.c - Implement __udivdi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __udivdi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a / b */ + +COMPILER_RT_ABI du_int +__udivdi3(du_int a, du_int b) +{ + return __udivmoddi4(a, b, 0); +} diff --git a/sdk/compiler-rt/udivmoddi4.c b/sdk/compiler-rt/udivmoddi4.c new file mode 100644 index 0000000000..0c8b4ff464 --- /dev/null +++ b/sdk/compiler-rt/udivmoddi4.c @@ -0,0 +1,231 @@ +/* ===-- udivmoddi4.c - Implement __udivmoddi4 -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __udivmoddi4 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Effects: if rem != 0, *rem = a % b + * Returns: a / b + */ + +/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */ + +COMPILER_RT_ABI du_int +__udivmoddi4(du_int a, du_int b, du_int* rem) +{ + const unsigned n_uword_bits = sizeof(su_int) * CHAR_BIT; + const unsigned n_udword_bits = sizeof(du_int) * CHAR_BIT; + udwords n; + n.all = a; + udwords d; + d.all = b; + udwords q; + udwords r; + unsigned sr; + /* special cases, X is unknown, K != 0 */ + if (n.s.high == 0) + { + if (d.s.high == 0) + { + /* 0 X + * --- + * 0 X + */ + if (rem) + *rem = n.s.low % d.s.low; + return n.s.low / d.s.low; + } + /* 0 X + * --- + * K X + */ + if (rem) + *rem = n.s.low; + return 0; + } + /* n.s.high != 0 */ + if (d.s.low == 0) + { + if (d.s.high == 0) + { + /* K X + * --- + * 0 0 + */ + if (rem) + *rem = n.s.high % d.s.low; + return n.s.high / d.s.low; + } + /* d.s.high != 0 */ + if (n.s.low == 0) + { + /* K 0 + * --- + * K 0 + */ + if (rem) + { + r.s.high = n.s.high % d.s.high; + r.s.low = 0; + *rem = r.all; + } + return n.s.high / d.s.high; + } + /* K K + * --- + * K 0 + */ + if ((d.s.high & (d.s.high - 1)) == 0) /* if d is a power of 2 */ + { + if (rem) + { + r.s.low = n.s.low; + r.s.high = n.s.high & (d.s.high - 1); + *rem = r.all; + } + return n.s.high >> __builtin_ctz(d.s.high); + } + /* K K + * --- + * K 0 + */ + sr = __builtin_clz(d.s.high) - __builtin_clz(n.s.high); + /* 0 <= sr <= n_uword_bits - 2 or sr large */ + if (sr > n_uword_bits - 2) + { + if (rem) + *rem = n.all; + return 0; + } + ++sr; + /* 1 <= sr <= n_uword_bits - 1 */ + /* q.all = n.all << (n_udword_bits - sr); */ + q.s.low = 0; + q.s.high = n.s.low << (n_uword_bits - sr); + /* r.all = n.all >> sr; */ + r.s.high = n.s.high >> sr; + r.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr); + } + else /* d.s.low != 0 */ + { + if (d.s.high == 0) + { + /* K X + * --- + * 0 K + */ + if ((d.s.low & (d.s.low - 1)) == 0) /* if d is a power of 2 */ + { + if (rem) + *rem = n.s.low & (d.s.low - 1); + if (d.s.low == 1) + return n.all; + sr = __builtin_ctz(d.s.low); + q.s.high = n.s.high >> sr; + q.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr); + return q.all; + } + /* K X + * --- + * 0 K + */ + sr = 1 + n_uword_bits + __builtin_clz(d.s.low) - __builtin_clz(n.s.high); + /* 2 <= sr <= n_udword_bits - 1 + * q.all = n.all << (n_udword_bits - sr); + * r.all = n.all >> sr; + */ + if (sr == n_uword_bits) + { + q.s.low = 0; + q.s.high = n.s.low; + r.s.high = 0; + r.s.low = n.s.high; + } + else if (sr < n_uword_bits) // 2 <= sr <= n_uword_bits - 1 + { + q.s.low = 0; + q.s.high = n.s.low << (n_uword_bits - sr); + r.s.high = n.s.high >> sr; + r.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr); + } + else // n_uword_bits + 1 <= sr <= n_udword_bits - 1 + { + q.s.low = n.s.low << (n_udword_bits - sr); + q.s.high = (n.s.high << (n_udword_bits - sr)) | + (n.s.low >> (sr - n_uword_bits)); + r.s.high = 0; + r.s.low = n.s.high >> (sr - n_uword_bits); + } + } + else + { + /* K X + * --- + * K K + */ + sr = __builtin_clz(d.s.high) - __builtin_clz(n.s.high); + /* 0 <= sr <= n_uword_bits - 1 or sr large */ + if (sr > n_uword_bits - 1) + { + if (rem) + *rem = n.all; + return 0; + } + ++sr; + /* 1 <= sr <= n_uword_bits */ + /* q.all = n.all << (n_udword_bits - sr); */ + q.s.low = 0; + if (sr == n_uword_bits) + { + q.s.high = n.s.low; + r.s.high = 0; + r.s.low = n.s.high; + } + else + { + q.s.high = n.s.low << (n_uword_bits - sr); + r.s.high = n.s.high >> sr; + r.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr); + } + } + } + /* Not a special case + * q and r are initialized with: + * q.all = n.all << (n_udword_bits - sr); + * r.all = n.all >> sr; + * 1 <= sr <= n_udword_bits - 1 + */ + su_int carry = 0; + for (; sr > 0; --sr) + { + /* r:q = ((r:q) << 1) | carry */ + r.s.high = (r.s.high << 1) | (r.s.low >> (n_uword_bits - 1)); + r.s.low = (r.s.low << 1) | (q.s.high >> (n_uword_bits - 1)); + q.s.high = (q.s.high << 1) | (q.s.low >> (n_uword_bits - 1)); + q.s.low = (q.s.low << 1) | carry; + /* carry = 0; + * if (r.all >= d.all) + * { + * r.all -= d.all; + * carry = 1; + * } + */ + const di_int s = (di_int)(d.all - r.all - 1) >> (n_udword_bits - 1); + carry = s & 1; + r.all -= d.all & s; + } + q.all = (q.all << 1) | carry; + if (rem) + *rem = r.all; + return q.all; +} diff --git a/sdk/compiler-rt/udivmodti4.c b/sdk/compiler-rt/udivmodti4.c new file mode 100644 index 0000000000..803168849c --- /dev/null +++ b/sdk/compiler-rt/udivmodti4.c @@ -0,0 +1,238 @@ +/* ===-- udivmodti4.c - Implement __udivmodti4 -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __udivmodti4 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Effects: if rem != 0, *rem = a % b + * Returns: a / b + */ + +/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */ + +COMPILER_RT_ABI tu_int +__udivmodti4(tu_int a, tu_int b, tu_int* rem) +{ + const unsigned n_udword_bits = sizeof(du_int) * CHAR_BIT; + const unsigned n_utword_bits = sizeof(tu_int) * CHAR_BIT; + utwords n; + n.all = a; + utwords d; + d.all = b; + utwords q; + utwords r; + unsigned sr; + /* special cases, X is unknown, K != 0 */ + if (n.s.high == 0) + { + if (d.s.high == 0) + { + /* 0 X + * --- + * 0 X + */ + if (rem) + *rem = n.s.low % d.s.low; + return n.s.low / d.s.low; + } + /* 0 X + * --- + * K X + */ + if (rem) + *rem = n.s.low; + return 0; + } + /* n.s.high != 0 */ + if (d.s.low == 0) + { + if (d.s.high == 0) + { + /* K X + * --- + * 0 0 + */ + if (rem) + *rem = n.s.high % d.s.low; + return n.s.high / d.s.low; + } + /* d.s.high != 0 */ + if (n.s.low == 0) + { + /* K 0 + * --- + * K 0 + */ + if (rem) + { + r.s.high = n.s.high % d.s.high; + r.s.low = 0; + *rem = r.all; + } + return n.s.high / d.s.high; + } + /* K K + * --- + * K 0 + */ + if ((d.s.high & (d.s.high - 1)) == 0) /* if d is a power of 2 */ + { + if (rem) + { + r.s.low = n.s.low; + r.s.high = n.s.high & (d.s.high - 1); + *rem = r.all; + } + return n.s.high >> __builtin_ctzll(d.s.high); + } + /* K K + * --- + * K 0 + */ + sr = __builtin_clzll(d.s.high) - __builtin_clzll(n.s.high); + /* 0 <= sr <= n_udword_bits - 2 or sr large */ + if (sr > n_udword_bits - 2) + { + if (rem) + *rem = n.all; + return 0; + } + ++sr; + /* 1 <= sr <= n_udword_bits - 1 */ + /* q.all = n.all << (n_utword_bits - sr); */ + q.s.low = 0; + q.s.high = n.s.low << (n_udword_bits - sr); + /* r.all = n.all >> sr; */ + r.s.high = n.s.high >> sr; + r.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr); + } + else /* d.s.low != 0 */ + { + if (d.s.high == 0) + { + /* K X + * --- + * 0 K + */ + if ((d.s.low & (d.s.low - 1)) == 0) /* if d is a power of 2 */ + { + if (rem) + *rem = n.s.low & (d.s.low - 1); + if (d.s.low == 1) + return n.all; + sr = __builtin_ctzll(d.s.low); + q.s.high = n.s.high >> sr; + q.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr); + return q.all; + } + /* K X + * --- + * 0 K + */ + sr = 1 + n_udword_bits + __builtin_clzll(d.s.low) + - __builtin_clzll(n.s.high); + /* 2 <= sr <= n_utword_bits - 1 + * q.all = n.all << (n_utword_bits - sr); + * r.all = n.all >> sr; + */ + if (sr == n_udword_bits) + { + q.s.low = 0; + q.s.high = n.s.low; + r.s.high = 0; + r.s.low = n.s.high; + } + else if (sr < n_udword_bits) // 2 <= sr <= n_udword_bits - 1 + { + q.s.low = 0; + q.s.high = n.s.low << (n_udword_bits - sr); + r.s.high = n.s.high >> sr; + r.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr); + } + else // n_udword_bits + 1 <= sr <= n_utword_bits - 1 + { + q.s.low = n.s.low << (n_utword_bits - sr); + q.s.high = (n.s.high << (n_utword_bits - sr)) | + (n.s.low >> (sr - n_udword_bits)); + r.s.high = 0; + r.s.low = n.s.high >> (sr - n_udword_bits); + } + } + else + { + /* K X + * --- + * K K + */ + sr = __builtin_clzll(d.s.high) - __builtin_clzll(n.s.high); + /*0 <= sr <= n_udword_bits - 1 or sr large */ + if (sr > n_udword_bits - 1) + { + if (rem) + *rem = n.all; + return 0; + } + ++sr; + /* 1 <= sr <= n_udword_bits + * q.all = n.all << (n_utword_bits - sr); + * r.all = n.all >> sr; + */ + q.s.low = 0; + if (sr == n_udword_bits) + { + q.s.high = n.s.low; + r.s.high = 0; + r.s.low = n.s.high; + } + else + { + r.s.high = n.s.high >> sr; + r.s.low = (n.s.high << (n_udword_bits - sr)) | (n.s.low >> sr); + q.s.high = n.s.low << (n_udword_bits - sr); + } + } + } + /* Not a special case + * q and r are initialized with: + * q.all = n.all << (n_utword_bits - sr); + * r.all = n.all >> sr; + * 1 <= sr <= n_utword_bits - 1 + */ + su_int carry = 0; + for (; sr > 0; --sr) + { + /* r:q = ((r:q) << 1) | carry */ + r.s.high = (r.s.high << 1) | (r.s.low >> (n_udword_bits - 1)); + r.s.low = (r.s.low << 1) | (q.s.high >> (n_udword_bits - 1)); + q.s.high = (q.s.high << 1) | (q.s.low >> (n_udword_bits - 1)); + q.s.low = (q.s.low << 1) | carry; + /* carry = 0; + * if (r.all >= d.all) + * { + * r.all -= d.all; + * carry = 1; + * } + */ + const ti_int s = (ti_int)(d.all - r.all - 1) >> (n_utword_bits - 1); + carry = s & 1; + r.all -= d.all & s; + } + q.all = (q.all << 1) | carry; + if (rem) + *rem = r.all; + return q.all; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/udivsi3.c b/sdk/compiler-rt/udivsi3.c new file mode 100644 index 0000000000..5d0140cc3e --- /dev/null +++ b/sdk/compiler-rt/udivsi3.c @@ -0,0 +1,66 @@ +/* ===-- udivsi3.c - Implement __udivsi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __udivsi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a / b */ + +/* Translated from Figure 3-40 of The PowerPC Compiler Writer's Guide */ + +ARM_EABI_FNALIAS(uidiv, udivsi3) + +/* This function should not call __divsi3! */ +COMPILER_RT_ABI su_int +__udivsi3(su_int n, su_int d) +{ + const unsigned n_uword_bits = sizeof(su_int) * CHAR_BIT; + su_int q; + su_int r; + unsigned sr; + /* special cases */ + if (d == 0) + return 0; /* ?! */ + if (n == 0) + return 0; + sr = __builtin_clz(d) - __builtin_clz(n); + /* 0 <= sr <= n_uword_bits - 1 or sr large */ + if (sr > n_uword_bits - 1) /* d > r */ + return 0; + if (sr == n_uword_bits - 1) /* d == 1 */ + return n; + ++sr; + /* 1 <= sr <= n_uword_bits - 1 */ + /* Not a special case */ + q = n << (n_uword_bits - sr); + r = n >> sr; + su_int carry = 0; + for (; sr > 0; --sr) + { + /* r:q = ((r:q) << 1) | carry */ + r = (r << 1) | (q >> (n_uword_bits - 1)); + q = (q << 1) | carry; + /* carry = 0; + * if (r.all >= d.all) + * { + * r.all -= d.all; + * carry = 1; + * } + */ + const si_int s = (si_int)(d - r - 1) >> (n_uword_bits - 1); + carry = s & 1; + r -= d & s; + } + q = (q << 1) | carry; + return q; +} diff --git a/sdk/compiler-rt/udivti3.c b/sdk/compiler-rt/udivti3.c new file mode 100644 index 0000000000..ec94673e25 --- /dev/null +++ b/sdk/compiler-rt/udivti3.c @@ -0,0 +1,27 @@ +/* ===-- udivti3.c - Implement __udivti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __udivti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: a / b */ + +COMPILER_RT_ABI tu_int +__udivti3(tu_int a, tu_int b) +{ + return __udivmodti4(a, b, 0); +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/compiler-rt/umoddi3.c b/sdk/compiler-rt/umoddi3.c new file mode 100644 index 0000000000..d513f080a1 --- /dev/null +++ b/sdk/compiler-rt/umoddi3.c @@ -0,0 +1,25 @@ +/* ===-- umoddi3.c - Implement __umoddi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __umoddi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a % b */ + +COMPILER_RT_ABI du_int +__umoddi3(du_int a, du_int b) +{ + du_int r; + __udivmoddi4(a, b, &r); + return r; +} diff --git a/sdk/compiler-rt/umodsi3.c b/sdk/compiler-rt/umodsi3.c new file mode 100644 index 0000000000..d5fda4a6af --- /dev/null +++ b/sdk/compiler-rt/umodsi3.c @@ -0,0 +1,23 @@ +/* ===-- umodsi3.c - Implement __umodsi3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __umodsi3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +/* Returns: a % b */ + +COMPILER_RT_ABI su_int +__umodsi3(su_int a, su_int b) +{ + return a - __udivsi3(a, b) * b; +} diff --git a/sdk/compiler-rt/umodti3.c b/sdk/compiler-rt/umodti3.c new file mode 100644 index 0000000000..6d1ca7a8cf --- /dev/null +++ b/sdk/compiler-rt/umodti3.c @@ -0,0 +1,29 @@ +/* ===-- umodti3.c - Implement __umodti3 -----------------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + * This file implements __umodti3 for the compiler_rt library. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" + +#ifdef CRT_HAS_128BIT + +/* Returns: a % b */ + +COMPILER_RT_ABI tu_int +__umodti3(tu_int a, tu_int b) +{ + tu_int r; + __udivmodti4(a, b, &r); + return r; +} + +#endif /* CRT_HAS_128BIT */ diff --git a/sdk/cpprt/Makefile b/sdk/cpprt/Makefile new file mode 100644 index 0000000000..dbfafaeb72 --- /dev/null +++ b/sdk/cpprt/Makefile @@ -0,0 +1,104 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +LINUXDIR := linux +CPPRT := libcpprt.a + +CFLAGS += $(ENCLAVE_CFLAGS) +CXXFLAGS += $(ENCLAVE_CXXFLAGS) + +CPPFLAGS += -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/inc/stdc++ \ + -I$(COMMON_DIR)/inc/internal \ + +CPPFLAGS += -I$(LINUX_SDK_DIR)/trts \ + -I$(LINUX_SDK_DIR)/trts/linux \ + +CPP_SRCS := $(wildcard memory_manage/new*.cpp) \ + $(wildcard memory_manage/delete*.cpp) +CPP_SRCS += tstdcxx_version.cpp + +CC_SRCS := $(wildcard $(LINUXDIR)/*.cc) +C_SRCS := $(filter-out $(LINUXDIR)/libelftc_dem_gnu3.c, $(wildcard $(LINUXDIR)/*.c)) + +CPP_OBJS := $(CPP_SRCS:.cpp=.o) +CC_OBJS := $(CC_SRCS:.cc=.o) +C_OBJS := $(C_SRCS:.c=.o) + +OBJS := $(CPP_OBJS) $(C_OBJS) $(CC_OBJS) + +$(C_OBJS): %.o: %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +$(CC_OBJS): %.o: %.cc + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + +$(CPP_OBJS): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + + +.PHONY: all +all: $(CPPRT) + +.PHONY: prepare-libunwind +prepare-libunwind: + $(CP) linux/pthread_compat.h linux/libunwind/include + +$(CPPRT): $(OBJS) prepare-libunwind libunwind + $(CP) linux/libunwind/src/.libs/libunwind.a $(CPPRT) + $(AR) rs $@ $(OBJS) + +$(CPPRT): CC = gcc +$(CPPRT): CXX = g++ + +.PHONY: libunwind +libunwind: + cd linux/libunwind/ && ( test -f Makefile || ./autogen-linux.sh ) && $(MAKE) -j5 + + +.PHONY: clean +clean: + @-$(MAKE) -C linux/libunwind distclean + @$(RM) $(OBJS) $(CPPRT) + @$(RM) -r linux/libunwind/INSTALL \ + linux/libunwind/Makefile.in \ + linux/libunwind/aclocal.m4 \ + linux/libunwind/autom4te.cache/ \ + linux/libunwind/config/ \ + linux/libunwind/configure \ + linux/libunwind/doc/Makefile.in \ + linux/libunwind/include/pthread_compat.h \ + linux/libunwind/include/config.h.in \ + linux/libunwind/src/Makefile.in + diff --git a/sdk/cpprt/linux/abi_namespace.h b/sdk/cpprt/linux/abi_namespace.h new file mode 100644 index 0000000000..dda788da19 --- /dev/null +++ b/sdk/cpprt/linux/abi_namespace.h @@ -0,0 +1,5 @@ +/** + * The namespace used for the ABI declarations. This is currently defined to + * be the same as GNU libsupc++, however this may change in the future. + */ +#define ABI_NAMESPACE __cxxabiv1 diff --git a/sdk/cpprt/linux/atomic.h b/sdk/cpprt/linux/atomic.h new file mode 100644 index 0000000000..8086e66889 --- /dev/null +++ b/sdk/cpprt/linux/atomic.h @@ -0,0 +1,28 @@ +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif +#ifndef __has_feature +#define __has_feature(x) 0 +#endif +/** + * Swap macro that enforces a happens-before relationship with a corresponding + * ATOMIC_LOAD. + */ +#if __has_feature(cxx_atomic) +#define ATOMIC_SWAP(addr, val)\ + __atomic_exchange(addr, val, __ATOMIC_ACQ_REL) +#elif __has_builtin(__sync_swap) +#define ATOMIC_SWAP(addr, val)\ + __sync_swap(addr, val) +#else +#define ATOMIC_SWAP(addr, val)\ + __sync_lock_test_and_set(addr, val) +#endif + +#if __has_feature(cxx_atomic) +#define ATOMIC_LOAD(addr)\ + __atomic_load(addr, __ATOMIC_ACQUIRE) +#else +#define ATOMIC_LOAD(addr)\ + (__sync_synchronize(), *addr) +#endif diff --git a/sdk/cpprt/linux/auxhelper.cc b/sdk/cpprt/linux/auxhelper.cc new file mode 100644 index 0000000000..d7ecfafcd8 --- /dev/null +++ b/sdk/cpprt/linux/auxhelper.cc @@ -0,0 +1,67 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * aux.cc - Compiler helper functions. + * + * The functions declared in this file are intended to be called only by code + * that is automatically generated by C++ compilers for some common cases. + */ + +#include +#include + +/** + * Called to generate a bad cast exception. This function is intended to allow + * compilers to insert code generating this exception without needing to + * duplicate the code for throwing the exception in every call site. + */ +extern "C" void __cxa_bad_cast() +{ + throw std::bad_cast(); +} + +/** + * Called to generate a bad typeid exception. This function is intended to + * allow compilers to insert code generating this exception without needing to + * duplicate the code for throwing the exception in every call site. + */ +extern "C" void __cxa_bad_typeid() +{ + throw std::bad_typeid(); +} + +/** + * Compilers may (but are not required to) set any pure-virtual function's + * vtable entry to this function. This makes debugging slightly easier, as + * users can add a breakpoint on this function to tell if they've accidentally + * called a pure-virtual function. + */ +extern "C" void __cxa_pure_virtual() +{ + abort(); +} + diff --git a/sdk/cpprt/linux/cxa_finalize.c b/sdk/cpprt/linux/cxa_finalize.c new file mode 100644 index 0000000000..d6681c3763 --- /dev/null +++ b/sdk/cpprt/linux/cxa_finalize.c @@ -0,0 +1,8 @@ +void __cxa_finalize(void *d ) { (void)d; }; + +extern void* __dso_handle; + +__attribute((destructor)) +static void cleanup(void) { + __cxa_finalize(&__dso_handle); +} diff --git a/sdk/cpprt/linux/cxxabi.h b/sdk/cpprt/linux/cxxabi.h new file mode 100644 index 0000000000..e1f5054b90 --- /dev/null +++ b/sdk/cpprt/linux/cxxabi.h @@ -0,0 +1,241 @@ +/* + * Copyright 2012 David Chisnall. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __CXXABI_H_ +#define __CXXABI_H_ +#include +#include "unwind.h" +namespace std +{ + class type_info; +} +/* + * The cxxabi.h header provides a set of public definitions for types and + * functions defined by the Itanium C++ ABI specification. For reference, see + * the ABI specification here: + * + * http://sourcery.mentor.com/public/cxx-abi/abi.html + * + * All deviations from this specification, unless otherwise noted, are + * accidental. + */ + +#ifdef __cplusplus +namespace __cxxabiv1 { +extern "C" { +#endif +/** + * Function type to call when an unexpected exception is encountered. + */ +typedef void (*unexpected_handler)(); +/** + * Function type to call when an unrecoverable condition is encountered. + */ +typedef void (*terminate_handler)(); + + +/** + * Structure used as a header on thrown exceptions. This is the same layout as + * defined by the Itanium ABI spec, so should be interoperable with any other + * implementation of this spec, such as GNU libsupc++. + * + * This structure is allocated when an exception is thrown. Unwinding happens + * in two phases, the first looks for a handler and the second installs the + * context. This structure stores a cache of the handler location between + * phase 1 and phase 2. Unfortunately, cleanup information is not cached, so + * must be looked up in both phases. This happens for two reasons. The first + * is that we don't know how many frames containing cleanups there will be, and + * we should avoid dynamic allocation during unwinding (the exception may be + * reporting that we've run out of memory). The second is that finding + * cleanups is much cheaper than finding handlers, because we don't have to + * look at the type table at all. + * + * Note: Several fields of this structure have not-very-informative names. + * These are taken from the ABI spec and have not been changed to make it + * easier for people referring to to the spec while reading this code. + */ +struct __cxa_exception +{ +#if __LP64__ + /** + * Reference count. Used to support the C++11 exception_ptr class. This + * is prepended to the structure in 64-bit mode and squeezed in to the + * padding left before the 64-bit aligned _Unwind_Exception at the end in + * 32-bit mode. + * + * Note that it is safe to extend this structure at the beginning, rather + * than the end, because the public API for creating it returns the address + * of the end (where the exception object can be stored). + */ + uintptr_t referenceCount; +#endif + /** Type info for the thrown object. */ + std::type_info *exceptionType; + /** Destructor for the object, if one exists. */ + void (*exceptionDestructor) (void *); + /** Handler called when an exception specification is violated. */ + unexpected_handler unexpectedHandler; + /** Hander called to terminate. */ + terminate_handler terminateHandler; + /** + * Next exception in the list. If an exception is thrown inside a catch + * block and caught in a nested catch, this points to the exception that + * will be handled after the inner catch block completes. + */ + __cxa_exception *nextException; + /** + * The number of handlers that currently have references to this + * exception. The top (non-sign) bit of this is used as a flag to indicate + * that the exception is being rethrown, so should not be deleted when its + * handler count reaches 0 (which it doesn't with the top bit set). + */ + int handlerCount; +#ifdef __arm__ + /** + * The ARM EH ABI requires the unwind library to keep track of exceptions + * during cleanups. These support nesting, so we need to keep a list of + * them. + */ + _Unwind_Exception *nextCleanup; + /** + * The number of cleanups that are currently being run on this exception. + */ + int cleanupCount; +#endif + /** + * The selector value to be returned when installing the catch handler. + * Used at the call site to determine which catch() block should execute. + * This is found in phase 1 of unwinding then installed in phase 2. + */ + int handlerSwitchValue; + /** + * The action record for the catch. This is cached during phase 1 + * unwinding. + */ + const char *actionRecord; + /** + * Pointer to the language-specific data area (LSDA) for the handler + * frame. This is unused in this implementation, but set for ABI + * compatibility in case we want to mix code in very weird ways. + */ + const char *languageSpecificData; + /** The cached landing pad for the catch handler.*/ + void *catchTemp; + /** + * The pointer that will be returned as the pointer to the object. When + * throwing a class and catching a virtual superclass (for example), we + * need to adjust the thrown pointer to make it all work correctly. + */ + void *adjustedPtr; +#if !__LP64__ + /** + * Reference count. Used to support the C++11 exception_ptr class. This + * is prepended to the structure in 64-bit mode and squeezed in to the + * padding left before the 64-bit aligned _Unwind_Exception at the end in + * 32-bit mode. + * + * Note that it is safe to extend this structure at the beginning, rather + * than the end, because the public API for creating it returns the address + * of the end (where the exception object can be stored) + */ + uintptr_t referenceCount; +#endif + /** The language-agnostic part of the exception header. */ + _Unwind_Exception unwindHeader; +}; + +/** + * ABI-specified globals structure. Returned by the __cxa_get_globals() + * function and its fast variant. This is a per-thread structure - every + * thread will have one lazily allocated. + * + * This structure is defined by the ABI, so may be used outside of this + * library. + */ +struct __cxa_eh_globals +{ + /** + * A linked list of exceptions that are currently caught. There may be + * several of these in nested catch() blocks. + */ + __cxa_exception *caughtExceptions; + /** + * The number of uncaught exceptions. + */ + unsigned int uncaughtExceptions; +}; +/** + * ABI function returning the __cxa_eh_globals structure. + */ +__cxa_eh_globals *__cxa_get_globals(void); +/** + * Version of __cxa_get_globals() assuming that __cxa_get_globals() has already + * been called at least once by this thread. + */ +__cxa_eh_globals *__cxa_get_globals_fast(void); + +/** + * Throws an exception returned by __cxa_current_primary_exception(). This + * exception may have been caught in another thread. + */ +void __cxa_rethrow_primary_exception(void* thrown_exception); +/** + * Returns the current exception in a form that can be stored in an + * exception_ptr object and then rethrown by a call to + * __cxa_rethrow_primary_exception(). + */ +void *__cxa_current_primary_exception(void); +/** + * Increments the reference count of an exception. Called when an + * exception_ptr is copied. + */ +void __cxa_increment_exception_refcount(void* thrown_exception); +/** + * Decrements the reference count of an exception. Called when an + * exception_ptr is deleted. + */ +void __cxa_decrement_exception_refcount(void* thrown_exception); +/** + * Demangles a C++ symbol or type name. The buffer, if non-NULL, must be + * allocated with malloc() and must be *n bytes or more long. This function + * may call realloc() on the value pointed to by buf, and will return the + * length of the string via *n. + * + * The value pointed to by status is set to one of the following: + * + * 0: success + * -1: memory allocation failure + * -2: invalid mangled name + * -3: invalid arguments + */ +char* __cxa_demangle(const char* mangled_name, + char* buf, + size_t* n, + int* status); +#ifdef __cplusplus +} // extern "C" +} // namespace + +namespace abi = __cxxabiv1; + +#endif /* __cplusplus */ +#endif /* __CXXABI_H_ */ diff --git a/sdk/cpprt/linux/dwarf_eh.h b/sdk/cpprt/linux/dwarf_eh.h new file mode 100644 index 0000000000..21557fc1a8 --- /dev/null +++ b/sdk/cpprt/linux/dwarf_eh.h @@ -0,0 +1,479 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * dwarf_eh.h - Defines some helper functions for parsing DWARF exception + * handling tables. + * + * This file contains various helper functions that are independent of the + * language-specific code. It can be used in any personality function for the + * Itanium ABI. + */ +#include + +// TODO: Factor out Itanium / ARM differences. We probably want an itanium.h +// and arm.h that can be included by this file depending on the target ABI. + +// _GNU_SOURCE must be defined for unwind.h to expose some of the functions +// that we want. If it isn't, then we define it and undefine it to make sure +// that it doesn't impact the rest of the program. +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# include "unwind.h" +# undef _GNU_SOURCE +#else +# include "unwind.h" +#endif + +#include + +/// Type used for pointers into DWARF data +typedef unsigned char *dw_eh_ptr_t; + +// Flag indicating a signed quantity +#define DW_EH_PE_signed 0x08 +/// DWARF data encoding types. +enum dwarf_data_encoding +{ + /// Unsigned, little-endian, base 128-encoded (variable length). + DW_EH_PE_uleb128 = 0x01, + /// Unsigned 16-bit integer. + DW_EH_PE_udata2 = 0x02, + /// Unsigned 32-bit integer. + DW_EH_PE_udata4 = 0x03, + /// Unsigned 64-bit integer. + DW_EH_PE_udata8 = 0x04, + /// Signed, little-endian, base 128-encoded (variable length) + DW_EH_PE_sleb128 = DW_EH_PE_uleb128 | DW_EH_PE_signed, + /// Signed 16-bit integer. + DW_EH_PE_sdata2 = DW_EH_PE_udata2 | DW_EH_PE_signed, + /// Signed 32-bit integer. + DW_EH_PE_sdata4 = DW_EH_PE_udata4 | DW_EH_PE_signed, + /// Signed 32-bit integer. + DW_EH_PE_sdata8 = DW_EH_PE_udata8 | DW_EH_PE_signed +}; + +/** + * Returns the encoding for a DWARF EH table entry. The encoding is stored in + * the low four of an octet. The high four bits store the addressing mode. + */ +static inline enum dwarf_data_encoding get_encoding(unsigned char x) +{ + return (enum dwarf_data_encoding)(x & 0xf); +} + +/** + * DWARF addressing mode constants. When reading a pointer value from a DWARF + * exception table, you must know how it is stored and what the addressing mode + * is. The low four bits tell you the encoding, allowing you to decode a + * number. The high four bits tell you the addressing mode, allowing you to + * turn that number into an address in memory. + */ +enum dwarf_data_relative +{ + /// Value is omitted + DW_EH_PE_omit = 0xff, + /// Absolute pointer value + DW_EH_PE_absptr = 0x00, + /// Value relative to program counter + DW_EH_PE_pcrel = 0x10, + /// Value relative to the text segment + DW_EH_PE_textrel = 0x20, + /// Value relative to the data segment + DW_EH_PE_datarel = 0x30, + /// Value relative to the start of the function + DW_EH_PE_funcrel = 0x40, + /// Aligned pointer (Not supported yet - are they actually used?) + DW_EH_PE_aligned = 0x50, + /// Pointer points to address of real value + DW_EH_PE_indirect = 0x80 +}; +/** + * Returns the addressing mode component of this encoding. + */ +static inline enum dwarf_data_relative get_base(unsigned char x) +{ + return (enum dwarf_data_relative)(x & 0x70); +} +/** + * Returns whether an encoding represents an indirect address. + */ +static int is_indirect(unsigned char x) +{ + return ((x & DW_EH_PE_indirect) == DW_EH_PE_indirect); +} + +/** + * Returns the size of a fixed-size encoding. This function will abort if + * called with a value that is not a fixed-size encoding. + */ +static inline int dwarf_size_of_fixed_size_field(unsigned char type) +{ + switch (get_encoding(type)) + { + default: abort(); + case DW_EH_PE_sdata2: + case DW_EH_PE_udata2: return 2; + case DW_EH_PE_sdata4: + case DW_EH_PE_udata4: return 4; + case DW_EH_PE_sdata8: + case DW_EH_PE_udata8: return 8; + case DW_EH_PE_absptr: return sizeof(void*); + } +} + +/** + * Read an unsigned, little-endian, base-128, DWARF value. Updates *data to + * point to the end of the value. Stores the number of bits read in the value + * pointed to by b, allowing you to determine the value of the highest bit, and + * therefore the sign of a signed value. + * + * This function is not intended to be called directly. Use read_sleb128() or + * read_uleb128() for reading signed and unsigned versions, respectively. + */ +static uint64_t read_leb128(dw_eh_ptr_t *data, int *b) +{ + uint64_t uleb = 0; + unsigned int bit = 0; + unsigned char digit = 0; + // We have to read at least one octet, and keep reading until we get to one + // with the high bit unset + do + { + // This check is a bit too strict - we should also check the highest + // bit of the digit. + assert(bit < sizeof(uint64_t) * 8); + // Get the base 128 digit + digit = (**data) & 0x7f; + // Add it to the current value + uleb += digit << bit; + // Increase the shift value + bit += 7; + // Proceed to the next octet + (*data)++; + // Terminate when we reach a value that does not have the high bit set + // (i.e. which was not modified when we mask it with 0x7f) + } while ((*(*data - 1)) != digit); + *b = bit; + + return uleb; +} + +/** + * Reads an unsigned little-endian base-128 value starting at the address + * pointed to by *data. Updates *data to point to the next byte after the end + * of the variable-length value. + */ +static int64_t read_uleb128(dw_eh_ptr_t *data) +{ + int b; + return read_leb128(data, &b); +} + +/** + * Reads a signed little-endian base-128 value starting at the address pointed + * to by *data. Updates *data to point to the next byte after the end of the + * variable-length value. + */ +static int64_t read_sleb128(dw_eh_ptr_t *data) +{ + int bits; + // Read as if it's signed + uint64_t uleb = read_leb128(data, &bits); + // If the most significant bit read is 1, then we need to sign extend it + if ((uleb >> (bits-1)) == 1) + { + // Sign extend by setting all bits in front of it to 1 + uleb |= ((int64_t)-1) << bits; + } + return (int64_t)uleb; +} +/** + * Reads a value using the specified encoding from the address pointed to by + * *data. Updates the value of *data to point to the next byte after the end + * of the data. + */ +static uint64_t read_value(char encoding, dw_eh_ptr_t *data) +{ + enum dwarf_data_encoding type = get_encoding(encoding); + uint64_t v; + switch (type) + { + // Read fixed-length types +#define READ(dwarf, type) \ + case dwarf:\ + v = (uint64_t)(*(type*)(*data));\ + *data += sizeof(type);\ + break; + READ(DW_EH_PE_udata2, uint16_t) + READ(DW_EH_PE_udata4, uint32_t) + READ(DW_EH_PE_udata8, uint64_t) + READ(DW_EH_PE_sdata2, int16_t) + READ(DW_EH_PE_sdata4, int32_t) + READ(DW_EH_PE_sdata8, int64_t) + READ(DW_EH_PE_absptr, intptr_t) +#undef READ + // Read variable-length types + case DW_EH_PE_sleb128: + v = read_sleb128(data); + break; + case DW_EH_PE_uleb128: + v = read_uleb128(data); + break; + default: abort(); + } + + return v; +} + +/** + * Resolves an indirect value. This expects an unwind context, an encoding, a + * decoded value, and the start of the region as arguments. The returned value + * is a pointer to the address identified by the encoded value. + * + * If the encoding does not specify an indirect value, then this returns v. + */ +static uint64_t resolve_indirect_value(_Unwind_Context *c, + unsigned char encoding, + int64_t v, + dw_eh_ptr_t start) +{ + switch (get_base(encoding)) + { + case DW_EH_PE_pcrel: + v += (uint64_t)start; + break; + case DW_EH_PE_textrel: + v += (uint64_t)_Unwind_GetTextRelBase(c); + break; + case DW_EH_PE_datarel: + v += (uint64_t)_Unwind_GetDataRelBase(c); + break; + case DW_EH_PE_funcrel: + v += (uint64_t)_Unwind_GetRegionStart(c); + default: + break; + } + // If this is an indirect value, then it is really the address of the real + // value + // TODO: Check whether this should really always be a pointer - it seems to + // be a GCC extensions, so not properly documented... + if (is_indirect(encoding)) + { + v = (uint64_t)(uintptr_t)*(void**)v; + } + return v; +} + + +/** + * Reads an encoding and a value, updating *data to point to the next byte. + */ +static inline void read_value_with_encoding(_Unwind_Context *context, + dw_eh_ptr_t *data, + uint64_t *out) +{ + dw_eh_ptr_t start = *data; + unsigned char encoding = *((*data)++); + // If this value is omitted, skip it and don't touch the output value + if (encoding == DW_EH_PE_omit) { return; } + + *out = read_value(encoding, data); + *out = resolve_indirect_value(context, encoding, *out, start); +} + +/** + * Structure storing a decoded language-specific data area. Use parse_lsda() + * to generate an instance of this structure from the address returned by the + * generic unwind library. + * + * You should not need to inspect the fields of this structure directly if you + * are just using this header. The structure stores the locations of the + * various tables used for unwinding exceptions and is used by the functions + * for reading values from these tables. + */ +struct dwarf_eh_lsda +{ + /// The start of the region. This is a cache of the value returned by + /// _Unwind_GetRegionStart(). + dw_eh_ptr_t region_start; + /// The start of the landing pads table. + dw_eh_ptr_t landing_pads; + /// The start of the type table. + dw_eh_ptr_t type_table; + /// The encoding used for entries in the type tables. + unsigned char type_table_encoding; + /// The location of the call-site table. + dw_eh_ptr_t call_site_table; + /// The location of the action table. + dw_eh_ptr_t action_table; + /// The encoding used for entries in the call-site table. + unsigned char callsite_encoding; +}; + +/** + * Parse the header on the language-specific data area and return a structure + * containing the addresses and encodings of the various tables. + */ +static inline struct dwarf_eh_lsda parse_lsda(_Unwind_Context *context, + unsigned char *data) +{ + struct dwarf_eh_lsda lsda; + + lsda.region_start = (dw_eh_ptr_t)(uintptr_t)_Unwind_GetRegionStart(context); + + // If the landing pads are relative to anything other than the start of + // this region, find out where. This is @LPStart in the spec, although the + // encoding that GCC uses does not quite match the spec. + uint64_t v = (uint64_t)(uintptr_t)lsda.region_start; + read_value_with_encoding(context, &data, &v); + lsda.landing_pads = (dw_eh_ptr_t)(uintptr_t)v; + + // If there is a type table, find out where it is. This is @TTBase in the + // spec. Note: we find whether there is a type table pointer by checking + // whether the leading byte is DW_EH_PE_omit (0xff), which is not what the + // spec says, but does seem to be how G++ indicates this. + lsda.type_table = 0; + lsda.type_table_encoding = *data++; + if (lsda.type_table_encoding != DW_EH_PE_omit) + { + v = read_uleb128(&data); + dw_eh_ptr_t type_table = data; + type_table += v; + lsda.type_table = type_table; + //lsda.type_table = (uintptr_t*)(data + v); + } +#if __arm__ + lsda.type_table_encoding = (DW_EH_PE_pcrel | DW_EH_PE_indirect); +#endif + + lsda.callsite_encoding = (enum dwarf_data_encoding)(*(data++)); + + // Action table is immediately after the call site table + lsda.action_table = data; + uintptr_t callsite_size = (uintptr_t)read_uleb128(&data); + lsda.action_table = data + callsite_size; + // Call site table is immediately after the header + lsda.call_site_table = (dw_eh_ptr_t)data; + + + return lsda; +} + +/** + * Structure representing an action to be performed while unwinding. This + * contains the address that should be unwound to and the action record that + * provoked this action. + */ +struct dwarf_eh_action +{ + /** + * The address that this action directs should be the new program counter + * value after unwinding. + */ + dw_eh_ptr_t landing_pad; + /// The address of the action record. + dw_eh_ptr_t action_record; +}; + +/** + * Look up the landing pad that corresponds to the current invoke. + * Returns true if record exists. The context is provided by the generic + * unwind library and the lsda should be the result of a call to parse_lsda(). + * + * The action record is returned via the result parameter. + */ +static bool dwarf_eh_find_callsite(struct _Unwind_Context *context, + struct dwarf_eh_lsda *lsda, + struct dwarf_eh_action *result) +{ + result->action_record = 0; + result->landing_pad = 0; + // The current instruction pointer offset within the region + uint64_t ip = _Unwind_GetIP(context) - _Unwind_GetRegionStart(context); + unsigned char *callsite_table = (unsigned char*)lsda->call_site_table; + + while (callsite_table <= lsda->action_table) + { + // Once again, the layout deviates from the spec. + uint64_t call_site_start, call_site_size, landing_pad, action; + call_site_start = read_value(lsda->callsite_encoding, &callsite_table); + call_site_size = read_value(lsda->callsite_encoding, &callsite_table); + + // Call site entries are sorted, so if we find a call site that's after + // the current instruction pointer then there is no action associated + // with this call and we should unwind straight through this frame + // without doing anything. + if (call_site_start > ip) { break; } + + // Read the address of the landing pad and the action from the call + // site table. + landing_pad = read_value(lsda->callsite_encoding, &callsite_table); + action = read_uleb128(&callsite_table); + + // We should not include the call_site_start (beginning of the region) + // address in the ip range. For each call site: + // + // address1: call proc + // address2: next instruction + // + // The call stack contains address2 and not address1, address1 can be + // at the end of another EH region. + if (call_site_start < ip && ip <= call_site_start + call_site_size) + { + if (action) + { + // Action records are 1-biased so both no-record and zeroth + // record can be stored. + result->action_record = lsda->action_table + action - 1; + } + // No landing pad means keep unwinding. + if (landing_pad) + { + // Landing pad is the offset from the value in the header + result->landing_pad = lsda->landing_pads + landing_pad; + } + return true; + } + } + return false; +} + +/// Defines an exception class from 8 bytes (endian independent) +#define EXCEPTION_CLASS(a,b,c,d,e,f,g,h) \ + (((uint64_t)a << 56) +\ + ((uint64_t)b << 48) +\ + ((uint64_t)c << 40) +\ + ((uint64_t)d << 32) +\ + ((uint64_t)e << 24) +\ + ((uint64_t)f << 16) +\ + ((uint64_t)g << 8) +\ + ((uint64_t)h)) + +#define GENERIC_EXCEPTION_CLASS(e,f,g,h) \ + ((uint32_t)e << 24) +\ + ((uint32_t)f << 16) +\ + ((uint32_t)g << 8) +\ + ((uint32_t)h) diff --git a/sdk/cpprt/linux/dynamic_cast.cc b/sdk/cpprt/linux/dynamic_cast.cc new file mode 100644 index 0000000000..7a07e4c6a7 --- /dev/null +++ b/sdk/cpprt/linux/dynamic_cast.cc @@ -0,0 +1,210 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "typeinfo.h" +#include + +using namespace ABI_NAMESPACE; + +/** + * Vtable header. + */ +struct vtable_header +{ + /** Offset of the leaf object. */ + ptrdiff_t leaf_offset; + /** Type of the object. */ + const __class_type_info *type; +}; + +/** + * Simple macro that does pointer arithmetic in bytes but returns a value of + * the same type as the original. + */ +#define ADD_TO_PTR(x, off) (__typeof__(x))(((char*)x) + off) + +bool std::type_info::__do_catch(std::type_info const *ex_type, + void **exception_object, + unsigned int outer) const +{ + const type_info *type = this; + + if (type == ex_type) + { + return true; + } + if (const __class_type_info *cti = dynamic_cast(type)) + { + return ex_type->__do_upcast(cti, exception_object); + } + return false; +} + +bool __pbase_type_info::__do_catch(std::type_info const *ex_type, + void **exception_object, + unsigned int outer) const +{ + if (ex_type == this) + { + return true; + } + if (!ex_type->__is_pointer_p()) + { + // Can't catch a non-pointer type in a pointer catch + return false; + } + + if (!(outer & 1)) + { + // If the low bit is cleared on this means that we've gone + // through a pointer that is not const qualified. + return false; + } + // Clear the low bit on outer if we're not const qualified. + if (!(__flags & __const_mask)) + { + outer &= ~1; + } + + const __pbase_type_info *ptr_type = + static_cast(ex_type); + + if (ptr_type->__flags & ~__flags) + { + // Handler pointer is less qualified + return false; + } + + // Special case for void* handler. + if(*__pointee == typeid(void)) + { + return true; + } + + return __pointee->__do_catch(ptr_type->__pointee, exception_object, outer); +} + +void *__class_type_info::cast_to(void *obj, const struct __class_type_info *other) const +{ + if (this == other) + { + return obj; + } + return 0; +} + +void *__si_class_type_info::cast_to(void *obj, const struct __class_type_info *other) const +{ + if (this == other) + { + return obj; + } + return __base_type->cast_to(obj, other); +} +bool __si_class_type_info::__do_upcast(const __class_type_info *target, + void **thrown_object) const +{ + if (this == target) + { + return true; + } + return __base_type->__do_upcast(target, thrown_object); +} + +void *__vmi_class_type_info::cast_to(void *obj, const struct __class_type_info *other) const +{ + if (__do_upcast(other, &obj)) + { + return obj; + } + return 0; +} + +bool __vmi_class_type_info::__do_upcast(const __class_type_info *target, + void **thrown_object) const +{ + if (this == target) + { + return true; + } + for (unsigned int i=0 ; i<__base_count ; i++) + { + const __base_class_type_info *info = &__base_info[i]; + ptrdiff_t offset = info->offset(); + // If this is a virtual superclass, the offset is stored in the + // object's vtable at the offset requested; 2.9.5.6.c: + // + // 'For a non-virtual base, this is the offset in the object of the + // base subobject. For a virtual base, this is the offset in the + // virtual table of the virtual base offset for the virtual base + // referenced (negative).' + + void *obj = *thrown_object; + if (info->isVirtual()) + { + // Object's vtable + ptrdiff_t *off = *(ptrdiff_t**)obj; + // Offset location in vtable + off = ADD_TO_PTR(off, offset); + offset = *off; + } + void *cast = ADD_TO_PTR(obj, offset); + + if (info->__base_type == target || + (info->__base_type->__do_upcast(target, &cast))) + { + *thrown_object = cast; + return true; + } + } + return 0; +} + + +/** + * ABI function used to implement the dynamic_cast<> operator. Some cases of + * this operator are implemented entirely in the compiler (e.g. to void*). + * This function implements the dynamic casts of the form dynamic_cast(v). + * This will be translated to a call to this function with the value v as the + * first argument. The type id of the static type of v is the second argument + * and the type id of the destination type (T) is the third argument. + * + * The third argument is a hint about the compiler's guess at the correct + * pointer offset. If this value is negative, then -1 indicates no hint, -2 + * that src is not a public base of dst, and -3 that src is a multiple public + * base type but never a virtual base type + */ +extern "C" void* __dynamic_cast(const void *sub, + const __class_type_info *src, + const __class_type_info *dst, + ptrdiff_t src2dst_offset) +{ + char *vtable_location = *(char**)sub; + const vtable_header *header = + (const vtable_header*)(vtable_location - sizeof(vtable_header)); + void *leaf = ADD_TO_PTR((void*)sub, header->leaf_offset); + return header->type->cast_to(leaf, dst); +} diff --git a/sdk/cpprt/linux/exception.cc b/sdk/cpprt/linux/exception.cc new file mode 100644 index 0000000000..8bf30a26d3 --- /dev/null +++ b/sdk/cpprt/linux/exception.cc @@ -0,0 +1,1419 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include "pthread_compat.h" +#include "typeinfo.h" +#include "dwarf_eh.h" +#include "atomic.h" +#include "cxxabi.h" +#include "thread_data.h" +#include "se_cdefs.h" + +// access the version varible to add a version to tstdcxx lib +SGX_ACCESS_VERSION(tstdcxx, 1) + +using namespace ABI_NAMESPACE; + +/** + * Saves the result of the landing pad that we have found. For ARM, this is + * stored in the generic unwind structure, while on other platforms it is + * stored in the C++ exception. + */ +static void saveLandingPad(struct _Unwind_Context *context, + struct _Unwind_Exception *ucb, + struct __cxa_exception *ex, + int selector, + dw_eh_ptr_t landingPad) +{ +#ifdef __arm__ + // On ARM, we store the saved exception in the generic part of the structure + ucb->barrier_cache.sp = _Unwind_GetGR(context, 13); + ucb->barrier_cache.bitpattern[1] = (uint32_t)selector; + ucb->barrier_cache.bitpattern[3] = (uint32_t)landingPad; +#endif + // Cache the results for the phase 2 unwind, if we found a handler + // and this is not a foreign exception. + if (ex) + { + ex->handlerSwitchValue = selector; + ex->catchTemp = landingPad; + } +} + +/** + * Loads the saved landing pad. Returns 1 on success, 0 on failure. + */ +static int loadLandingPad(struct _Unwind_Context *context, + struct _Unwind_Exception *ucb, + struct __cxa_exception *ex, + unsigned long *selector, + dw_eh_ptr_t *landingPad) +{ +#ifdef __arm__ + *selector = ucb->barrier_cache.bitpattern[1]; + *landingPad = (dw_eh_ptr_t)ucb->barrier_cache.bitpattern[3]; + return 1; +#else + if (ex) + { + *selector = ex->handlerSwitchValue; + *landingPad = (dw_eh_ptr_t)ex->catchTemp; + return 0; + } + return 0; +#endif +} + +static inline _Unwind_Reason_Code continueUnwinding(struct _Unwind_Exception *ex, + struct _Unwind_Context *context) +{ +#ifdef __arm__ + if (__gnu_unwind_frame(ex, context) != _URC_OK) { return _URC_FAILURE; } +#endif + return _URC_CONTINUE_UNWIND; +} + + +extern "C" void __cxa_free_exception(void *thrown_exception); +extern "C" void __cxa_free_dependent_exception(void *thrown_exception); +extern "C" void* __dynamic_cast(const void *sub, + const __class_type_info *src, + const __class_type_info *dst, + ptrdiff_t src2dst_offset); + +/** + * The type of a handler that has been found. + */ +typedef enum +{ + /** No handler. */ + handler_none, + /** + * A cleanup - the exception will propagate through this frame, but code + * must be run when this happens. + */ + handler_cleanup, + /** + * A catch statement. The exception will not propagate past this frame + * (without an explicit rethrow). + */ + handler_catch +} handler_type; + +/** + * Per-thread info required by the runtime. We store a single structure + * pointer in thread-local storage, because this tends to be a scarce resource + * and it's impolite to steal all of it and not leave any for the rest of the + * program. + * + * Instances of this structure are allocated lazily - at most one per thread - + * and are destroyed on thread termination. + */ +struct __cxa_thread_info +{ + /** The termination handler for this thread. */ + terminate_handler terminateHandler; + /** The unexpected exception handler for this thread. */ + unexpected_handler unexpectedHandler; + /** + * The number of emergency buffers held by this thread. This is 0 in + * normal operation - the emergency buffers are only used when malloc() + * fails to return memory for allocating an exception. Threads are not + * permitted to hold more than 4 emergency buffers (as per recommendation + * in ABI spec [3.3.1]). + */ + int emergencyBuffersHeld; + /** + * The exception currently running in a cleanup. + */ + _Unwind_Exception *currentCleanup; + /** + * The public part of this structure, accessible from outside of this + * module. + */ + __cxa_eh_globals globals; +}; +/** + * Dependent exception. This + */ +struct __cxa_dependent_exception +{ +#if __LP64__ + void *primaryException; +#endif + std::type_info *exceptionType; + void (*exceptionDestructor) (void *); + unexpected_handler unexpectedHandler; + terminate_handler terminateHandler; + __cxa_exception *nextException; + int handlerCount; +#ifdef __arm__ + _Unwind_Exception *nextCleanup; + int cleanupCount; +#endif + int handlerSwitchValue; + const char *actionRecord; + const char *languageSpecificData; + void *catchTemp; + void *adjustedPtr; +#if !__LP64__ + void *primaryException; +#endif + _Unwind_Exception unwindHeader; +}; + + +namespace std +{ + void unexpected(); +#if 0 + class exception + { + public: + virtual ~exception() throw(); + virtual const char* what() const throw(); + }; +#endif +} + +extern "C" std::type_info *__cxa_current_exception_type(); + +/** + * Class of exceptions to distinguish between this and other exception types. + * + * The first four characters are the vendor ID. Currently, we use GNUC, + * because we aim for ABI-compatibility with the GNU implementation, and + * various checks may test for equality of the class, which is incorrect. + */ +static const uint64_t exception_class = + EXCEPTION_CLASS('G', 'N', 'U', 'C', 'C', '+', '+', '\0'); +/** + * Class used for dependent exceptions. + */ +static const uint64_t dependent_exception_class = + EXCEPTION_CLASS('G', 'N', 'U', 'C', 'C', '+', '+', '\x01'); +/** + * The low four bytes of the exception class, indicating that we conform to the + * Itanium C++ ABI. This is currently unused, but should be used in the future + * if we change our exception class, to allow this library and libsupc++ to be + * linked to the same executable and both to interoperate. + */ +static const uint32_t abi_exception_class = + GENERIC_EXCEPTION_CLASS('C', '+', '+', '\0'); + +static bool isCXXException(uint64_t cls) +{ + return (cls == exception_class) || (cls == dependent_exception_class); +} + +static bool isDependentException(uint64_t cls) +{ + return cls == dependent_exception_class; +} + +static __cxa_exception *exceptionFromPointer(void *ex) +{ + return (__cxa_exception*)((char*)ex - + offsetof(struct __cxa_exception, unwindHeader)); +} +static __cxa_exception *realExceptionFromException(__cxa_exception *ex) +{ + if (!isDependentException(ex->unwindHeader.exception_class)) { return ex; } + return ((__cxa_exception*)(((__cxa_dependent_exception*)ex)->primaryException))-1; +} + + +namespace std +{ + // Forward declaration of standard library terminate() function used to + // abort execution. + void terminate(void); +} + +using namespace ABI_NAMESPACE; + + + +/** The global termination handler. */ +static terminate_handler terminateHandler = abort; +/** The global unexpected exception handler. */ +static unexpected_handler unexpectedHandler = std::terminate; + + +/** + * Cleanup function, allowing foreign exception handlers to correctly destroy + * this exception if they catch it. + */ +static void exception_cleanup(_Unwind_Reason_Code reason, + struct _Unwind_Exception *ex) +{ + __cxa_free_exception((void*)ex); +} +static void dependent_exception_cleanup(_Unwind_Reason_Code reason, + struct _Unwind_Exception *ex) +{ + + __cxa_free_dependent_exception((void*)ex); +} + +/** + * Recursively walk a list of exceptions and delete them all in post-order. + */ +static void free_exception_list(__cxa_exception *ex) +{ + if (0 != ex->nextException) + { + free_exception_list(ex->nextException); + } + // __cxa_free_exception() expects to be passed the thrown object, which + // immediately follows the exception, not the exception itself + __cxa_free_exception(ex+1); +} + +/** + * We may not be linked against a full pthread implementation. If we're not, + * then we need to fake the thread-local storage by storing 'thread-local' + * things in a global. + */ +static __cxa_thread_info* __get_thread_info_ptr() +{ + thread_data_t* td = get_thread_data(); + return (__cxa_thread_info *)td->cxx_thread_info; +} + +/** + * Returns the thread info structure, creating it if it is not already created. + */ +static __cxa_thread_info *thread_info() +{ + return __get_thread_info_ptr(); +} +/** + * Fast version of thread_info(). May fail if thread_info() is not called on + * this thread at least once already. + */ +static __cxa_thread_info *thread_info_fast() +{ + return __get_thread_info_ptr(); +} +/** + * ABI function returning the __cxa_eh_globals structure. + */ +extern "C" __cxa_eh_globals *ABI_NAMESPACE::__cxa_get_globals(void) +{ + return &(thread_info()->globals); +} +/** + * Version of __cxa_get_globals() assuming that __cxa_get_globals() has already + * been called at least once by this thread. + */ +extern "C" __cxa_eh_globals *ABI_NAMESPACE::__cxa_get_globals_fast(void) +{ + return &(thread_info_fast()->globals); +} + +/** + * An emergency allocation reserved for when malloc fails. This is treated as + * 16 buffers of 1KB each. + */ +static char emergency_buffer[16384]; +/** + * Flag indicating whether each buffer is allocated. + */ +static bool buffer_allocated[16]; +/** + * Lock used to protect emergency allocation. + */ +static pthread_mutex_t emergency_malloc_lock = PTHREAD_MUTEX_INITIALIZER; +/** + * Indicate whether there is chunk in `emergency_buffer available'. + * This variable is also protected by `emergency_malloc_lock'. + */ +static volatile bool buffer_available = true; + +/** + * Allocates size bytes from the emergency allocation mechanism, if possible. + * This function will fail if size is over 1KB or if this thread already has 4 + * emergency buffers. If all emergency buffers are allocated, it will wait + * until one becomes available. + */ +static char *emergency_malloc(size_t size) +{ + if (size > 1024) { return 0; } + + __cxa_thread_info *info = thread_info(); + // Only 4 emergency buffers allowed per thread! + if (info->emergencyBuffersHeld > 3) { return 0; } + + pthread_mutex_lock(&emergency_malloc_lock); + int buffer = -1; + while (buffer < 0) + { + // While we were sleeping on the lock, another thread might have free'd + // enough memory for us to use, so try the allocation again - no point + // using the emergency buffer if there is some real memory that we can + // use... + void *m = calloc(1, size); + if (0 != m) + { + pthread_mutex_unlock(&emergency_malloc_lock); + return (char*)m; + } + for (int i=0 ; i<16 ; i++) + { + if (!buffer_allocated[i]) + { + buffer = i; + buffer_allocated[i] = true; + break; + } + } + // If there still isn't a buffer available ... + if (buffer < 0) + { + // No buffer available, unlock and waiting on `buffer_available'. + buffer_available = false; + pthread_mutex_unlock(&emergency_malloc_lock); + while (!buffer_available) continue; + + // Try to acquire the lock again. + pthread_mutex_lock(&emergency_malloc_lock); + } + } + pthread_mutex_unlock(&emergency_malloc_lock); + info->emergencyBuffersHeld++; + return emergency_buffer + (1024 * buffer); +} + +/** + * Frees a buffer returned by emergency_malloc(). + * + * Note: Neither this nor emergency_malloc() is particularly efficient. This + * should not matter, because neither will be called in normal operation - they + * are only used when the program runs out of memory, which should not happen + * often. + */ +static void emergency_malloc_free(char *ptr) +{ + int buffer = -1; + // Find the buffer corresponding to this pointer. + for (int i=0 ; i<16 ; i++) + { + if (ptr == (void*)(emergency_buffer + (1024 * i))) + { + buffer = i; + break; + } + } + assert(buffer >= 0 && + "Trying to free something that is not an emergency buffer!"); + // emergency_malloc() is expected to return 0-initialized data. We don't + // zero the buffer when allocating it, because the static buffers will + // begin life containing 0 values. + memset((void*)ptr, 0, 1024); + pthread_mutex_lock(&emergency_malloc_lock); + // In theory, we don't need to do this with the lock held. In practice, + // our array of bools will probably be updated using 32-bit or 64-bit + // memory operations, so this update may clobber adjacent values. + if (buffer != -1) + { + buffer_allocated[buffer] = false; + buffer_available = true; + } + pthread_mutex_unlock(&emergency_malloc_lock); +} + +static char *alloc_or_die(size_t size) +{ + char *buffer = (char*)calloc(1, size); + + // If calloc() doesn't want to give us any memory, try using an emergency + // buffer. + if (0 == buffer) + { + buffer = emergency_malloc(size); + // This is only reached if the allocation is greater than 1KB, and + // anyone throwing objects that big really should know better. + if (0 == buffer) + { + //fprintf(stderr, "Out of memory attempting to allocate exception\n"); + std::terminate(); + } + } + return buffer; +} +static void free_exception(char *e) +{ + // If this allocation is within the address range of the emergency buffer, + // don't call free() because it was not allocated with malloc() + if ((e >= emergency_buffer) && + (e < (emergency_buffer + sizeof(emergency_buffer)))) + { + emergency_malloc_free(e); + } + else + { + free(e); + } +} + +/** + * Allocates an exception structure. Returns a pointer to the space that can + * be used to store an object of thrown_size bytes. This function will use an + * emergency buffer if malloc() fails, and may block if there are no such + * buffers available. + */ +extern "C" void *__cxa_allocate_exception(size_t thrown_size) +{ + size_t size = thrown_size + sizeof(__cxa_exception); + char *buffer = alloc_or_die(size); + return buffer+sizeof(__cxa_exception); +} + +extern "C" void *__cxa_allocate_dependent_exception(void) +{ + size_t size = sizeof(__cxa_dependent_exception); + char *buffer = alloc_or_die(size); + return buffer+sizeof(__cxa_dependent_exception); +} + +/** + * __cxa_free_exception() is called when an exception was thrown in between + * calling __cxa_allocate_exception() and actually throwing the exception. + * This happens when the object's copy constructor throws an exception. + * + * In this implementation, it is also called by __cxa_end_catch() and during + * thread cleanup. + */ +extern "C" void __cxa_free_exception(void *thrown_exception) +{ + __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + // Free the object that was thrown, calling its destructor + if (0 != ex->exceptionDestructor) + { + try + { + ex->exceptionDestructor(thrown_exception); + } + catch(...) + { + // FIXME: Check that this is really what the spec says to do. + std::terminate(); + } + } + + free_exception((char*)ex); +} + +static void releaseException(__cxa_exception *exception) +{ + if (isDependentException(exception->unwindHeader.exception_class)) + { + __cxa_free_dependent_exception(exception+1); + return; + } + if (__sync_sub_and_fetch(&exception->referenceCount, 1) == 0) + { + // __cxa_free_exception() expects to be passed the thrown object, + // which immediately follows the exception, not the exception + // itself + __cxa_free_exception(exception+1); + } +} + +void __cxa_free_dependent_exception(void *thrown_exception) +{ + __cxa_dependent_exception *ex = ((__cxa_dependent_exception*)thrown_exception) - 1; + assert(isDependentException(ex->unwindHeader.exception_class)); + if (ex->primaryException) + { + releaseException(realExceptionFromException((__cxa_exception*)ex)); + } + free_exception((char*)ex); +} + +/** + * Callback function used with _Unwind_Backtrace(). + * + * Prints a stack trace. Used only for debugging help. + * + * Note: As of FreeBSD 8.1, dladd() still doesn't work properly, so this only + * correctly prints function names from public, relocatable, symbols. + */ +static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c) +{ +#if 0 + Dl_info myinfo; + int mylookup = + dladdr((void*)(uintptr_t)__cxa_current_exception_type, &myinfo); + void *ip = (void*)_Unwind_GetIP(context); + Dl_info info; + if (dladdr(ip, &info) != 0) + { + if (mylookup == 0 || strcmp(info.dli_fname, myinfo.dli_fname) != 0) + { + printf("%p:%s() in %s\n", ip, info.dli_sname, info.dli_fname); + } + } +#endif + return _URC_CONTINUE_UNWIND; +} + +/** + * Report a failure that occurred when attempting to throw an exception. + * + * If the failure happened by falling off the end of the stack without finding + * a handler, prints a back trace before aborting. + */ +static void report_failure(_Unwind_Reason_Code err, __cxa_exception *thrown_exception) +{ + switch (err) + { + default: break; + case _URC_FATAL_PHASE1_ERROR: + //fprintf(stderr, "Fatal error during phase 1 unwinding\n"); + break; +#ifndef __arm__ + case _URC_FATAL_PHASE2_ERROR: + //fprintf(stderr, "Fatal error during phase 2 unwinding\n"); + break; +#endif + case _URC_END_OF_STACK: + //fprintf(stderr, "Terminating due to uncaught exception %p", + // (void*)thrown_exception); + thrown_exception = realExceptionFromException(thrown_exception); + static const __class_type_info *e_ti = + static_cast(&typeid(std::exception)); + const __class_type_info *throw_ti = + dynamic_cast(thrown_exception->exceptionType); + if (throw_ti) + { + std::exception *e = + (std::exception*)e_ti->cast_to((void*)(thrown_exception+1), + throw_ti); + if (e) + { + //fprintf(stderr, " '%s'", e->what()); + } + } + +#if 0 + size_t bufferSize = 128; + char *demangled = (char*)malloc(bufferSize); + const char *mangled = thrown_exception->exceptionType->name(); + int status; + demangled = __cxa_demangle(mangled, demangled, &bufferSize, &status); + //fprintf(stderr, " of type %s\n", + // status == 0 ? (const char*)demangled : mangled); + if (status == 0) { free(demangled); } +#endif + // Print a back trace if no handler is found. + // TODO: Make this optional + _Unwind_Backtrace(trace, 0); + break; + } + std::terminate(); +} + +static void throw_exception(__cxa_exception *ex) +{ + __cxa_thread_info *info = thread_info(); + ex->unexpectedHandler = info->unexpectedHandler; + if (0 == ex->unexpectedHandler) + { + ex->unexpectedHandler = unexpectedHandler; + } + ex->terminateHandler = info->terminateHandler; + if (0 == ex->terminateHandler) + { + ex->terminateHandler = terminateHandler; + } + info->globals.uncaughtExceptions++; + + _Unwind_Reason_Code err = _Unwind_RaiseException(&ex->unwindHeader); + // The _Unwind_RaiseException() function should not return, it should + // unwind the stack past this function. If it does return, then something + // has gone wrong. + report_failure(err, ex); +} + + +/** + * ABI function for throwing an exception. Takes the object to be thrown (the + * pointer returned by __cxa_allocate_exception()), the type info for the + * pointee, and the destructor (if there is one) as arguments. + */ +extern "C" void __cxa_throw(void *thrown_exception, + std::type_info *tinfo, + void(*dest)(void*)) +{ + __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + + ex->referenceCount = 1; + ex->exceptionType = tinfo; + + ex->exceptionDestructor = dest; + + ex->unwindHeader.exception_class = exception_class; + ex->unwindHeader.exception_cleanup = exception_cleanup; + + throw_exception(ex); +} + +extern "C" void __cxa_rethrow_primary_exception(void* thrown_exception) +{ + if (NULL == thrown_exception) { return; } + + __cxa_exception *original = exceptionFromPointer(thrown_exception); + __cxa_dependent_exception *ex = ((__cxa_dependent_exception*)__cxa_allocate_dependent_exception())-1; + + ex->primaryException = thrown_exception; + __cxa_increment_exception_refcount(thrown_exception); + + ex->exceptionType = original->exceptionType; + ex->unwindHeader.exception_class = dependent_exception_class; + ex->unwindHeader.exception_cleanup = dependent_exception_cleanup; + + throw_exception((__cxa_exception*)ex); +} + +extern "C" void *__cxa_current_primary_exception(void) +{ + __cxa_eh_globals* globals = __cxa_get_globals(); + __cxa_exception *ex = globals->caughtExceptions; + + if (0 == ex) { return NULL; } + ex = realExceptionFromException(ex); + __sync_fetch_and_add(&ex->referenceCount, 1); + return ex + 1; +} + +extern "C" void __cxa_increment_exception_refcount(void* thrown_exception) +{ + if (NULL == thrown_exception) { return; } + __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + if (isDependentException(ex->unwindHeader.exception_class)) { return; } + __sync_fetch_and_add(&ex->referenceCount, 1); +} +extern "C" void __cxa_decrement_exception_refcount(void* thrown_exception) +{ + if (NULL == thrown_exception) { return; } + __cxa_exception *ex = ((__cxa_exception*)thrown_exception) - 1; + releaseException(ex); +} + +/** + * ABI function. Rethrows the current exception. Does not remove the + * exception from the stack or decrement its handler count - the compiler is + * expected to set the landing pad for this function to the end of the catch + * block, and then call _Unwind_Resume() to continue unwinding once + * __cxa_end_catch() has been called and any cleanup code has been run. + */ +extern "C" void __cxa_rethrow() +{ + __cxa_eh_globals *globals = __cxa_get_globals(); + // Note: We don't remove this from the caught list here, because + // __cxa_end_catch will be called when we unwind out of the try block. We + // could probably make this faster by providing an alternative rethrow + // function and ensuring that all cleanup code is run before calling it, so + // we can skip the top stack frame when unwinding. + __cxa_exception *ex = globals->caughtExceptions; + + if (0 == ex) + { + //fprintf(stderr, + // "Attempting to rethrow an exception that doesn't exist!\n"); + std::terminate(); + } + + assert(ex->handlerCount > 0 && "Rethrowing uncaught exception!"); + + globals->uncaughtExceptions++; + + // ex->handlerCount will be decremented in __cxa_end_catch in enclosing + // catch block + + // Make handler count negative. This will tell __cxa_end_catch that + // exception was rethrown and exception object should not be destroyed + // when handler count become zero + ex->handlerCount = -ex->handlerCount; + + // Continue unwinding the stack with this exception. This should unwind to + // the place in the caller where __cxa_end_catch() is called. The caller + // will then run cleanup code and bounce the exception back with + // _Unwind_Resume(). + _Unwind_Reason_Code err = _Unwind_Resume_or_Rethrow(&ex->unwindHeader); + report_failure(err, ex); +} + +/** + * Returns the type_info object corresponding to the filter. + */ +static std::type_info *get_type_info_entry(_Unwind_Context *context, + dwarf_eh_lsda *lsda, + int filter) +{ + // Get the address of the record in the table. + dw_eh_ptr_t record = lsda->type_table - + dwarf_size_of_fixed_size_field(lsda->type_table_encoding)*filter; + //record -= 4; + dw_eh_ptr_t start = record; + // Read the value, but it's probably an indirect reference... + int64_t offset = read_value(lsda->type_table_encoding, &record); + + // (If the entry is 0, don't try to dereference it. That would be bad.) + if (offset == 0) { return 0; } + + // ...so we need to resolve it + return (std::type_info*)resolve_indirect_value(context, + lsda->type_table_encoding, offset, start); +} + + + +/** + * Checks the type signature found in a handler against the type of the thrown + * object. If ex is 0 then it is assumed to be a foreign exception and only + * matches cleanups. + */ +static bool check_type_signature(__cxa_exception *ex, + const std::type_info *type, + void *&adjustedPtr) +{ + void *exception_ptr = (void*)(ex+1); + const std::type_info *ex_type = NULL; + + if (ex) + { + ex_type = ex->exceptionType; + + bool is_ptr = ex_type->__is_pointer_p(); + if (is_ptr) + { + exception_ptr = *(void**)exception_ptr; + } + } + // Always match a catchall, even with a foreign exception + // + // Note: A 0 here is a catchall, not a cleanup, so we return true to + // indicate that we found a catch. + if (0 == type) + { + if (ex) + { + adjustedPtr = exception_ptr; + } + return true; + } + + if (0 == ex) { return false; } + + // If the types are the same, no casting is needed. + if (*type == *ex_type) + { + adjustedPtr = exception_ptr; + return true; + } + + + if (type->__do_catch(ex_type, &exception_ptr, 1)) + { + adjustedPtr = exception_ptr; + return true; + } + + return false; +} +/** + * Checks whether the exception matches the type specifiers in this action + * record. If the exception only matches cleanups, then this returns false. + * If it matches a catch (including a catchall) then it returns true. + * + * The selector argument is used to return the selector that is passed in the + * second exception register when installing the context. + */ +static handler_type check_action_record(_Unwind_Context *context, + dwarf_eh_lsda *lsda, + dw_eh_ptr_t action_record, + __cxa_exception *ex, + unsigned long *selector, + void *&adjustedPtr) +{ + if (!action_record) { return handler_cleanup; } + handler_type found = handler_none; + while (action_record) + { + int filter = read_sleb128(&action_record); + dw_eh_ptr_t action_record_offset_base = action_record; + int displacement = read_sleb128(&action_record); + action_record = displacement ? + action_record_offset_base + displacement : 0; + // We only check handler types for C++ exceptions - foreign exceptions + // are only allowed for cleanup. + if (filter > 0 && 0 != ex) + { + std::type_info *handler_type = get_type_info_entry(context, lsda, filter); + if (check_type_signature(ex, handler_type, adjustedPtr)) + { + *selector = filter; + return handler_catch; + } + } + else if (filter < 0 && 0 != ex) + { + bool matched = false; + if (found == handler_none) *selector = filter; +#ifdef __arm__ + filter++; + std::type_info *handler_type = get_type_info_entry(context, lsda, filter--); + while (handler_type) + { + if (check_type_signature(ex, handler_type, adjustedPtr)) + { + matched = true; + break; + } + handler_type = get_type_info_entry(context, lsda, filter--); + } +#else + unsigned char *type_index = ((unsigned char*)lsda->type_table - filter - 1); + while (*type_index) + { + std::type_info *handler_type = get_type_info_entry(context, lsda, *(type_index++)); + // If the exception spec matches a permitted throw type for + // this function, don't report a handler - we are allowed to + // propagate this exception out. + if (check_type_signature(ex, handler_type, adjustedPtr)) + { + matched = true; + break; + } + } +#endif + if (matched) { continue; } + // If we don't find an allowed exception spec, we need to install + // the context for this action. The landing pad will then call the + // unexpected exception function. Treat this as a catch + return handler_catch; + } + else if (filter == 0) + { + *selector = filter; + found = handler_cleanup; + } + } + return found; +} + +static void pushCleanupException(_Unwind_Exception *exceptionObject, + __cxa_exception *ex) +{ +#ifdef __arm__ + __cxa_thread_info *info = thread_info_fast(); + if (ex) + { + ex->cleanupCount++; + if (ex->cleanupCount > 1) + { + assert(exceptionObject == info->currentCleanup); + return; + } + ex->nextCleanup = info->currentCleanup; + } + info->currentCleanup = exceptionObject; +#endif +} + +/** + * The exception personality function. This is referenced in the unwinding + * DWARF metadata and is called by the unwind library for each C++ stack frame + * containing catch or cleanup code. + */ +extern "C" +BEGIN_PERSONALITY_FUNCTION(__gxx_personality_v0) + // This personality function is for version 1 of the ABI. If you use it + // with a future version of the ABI, it won't know what to do, so it + // reports a fatal error and give up before it breaks anything. + if (1 != version) + { + return _URC_FATAL_PHASE1_ERROR; + } + __cxa_exception *ex = 0; + __cxa_exception *realEx = 0; + + // If this exception is throw by something else then we can't make any + // assumptions about its layout beyond the fields declared in + // _Unwind_Exception. + bool foreignException = !isCXXException(exceptionClass); + + // If this isn't a foreign exception, then we have a C++ exception structure + if (!foreignException) + { + ex = exceptionFromPointer(exceptionObject); + realEx = realExceptionFromException(ex); + } + + unsigned char *lsda_addr = + (unsigned char*)_Unwind_GetLanguageSpecificData(context); + + // No LSDA implies no landing pads - try the next frame + if (0 == lsda_addr) { return continueUnwinding(exceptionObject, context); } + + // These two variables define how the exception will be handled. + dwarf_eh_action action = {0}; + unsigned long selector = 0; + + // During the search phase, we do a complete lookup. If we return + // _URC_HANDLER_FOUND, then the phase 2 unwind will call this function with + // a _UA_HANDLER_FRAME action, telling us to install the handler frame. If + // we return _URC_CONTINUE_UNWIND, we may be called again later with a + // _UA_CLEANUP_PHASE action for this frame. + // + // The point of the two-stage unwind allows us to entirely avoid any stack + // unwinding if there is no handler. If there are just cleanups found, + // then we can just panic call an abort function. + // + // Matching a handler is much more expensive than matching a cleanup, + // because we don't need to bother doing type comparisons (or looking at + // the type table at all) for a cleanup. This means that there is no need + // to cache the result of finding a cleanup, because it's (quite) quick to + // look it up again from the action table. + if (actions & _UA_SEARCH_PHASE) + { + struct dwarf_eh_lsda lsda = parse_lsda(context, lsda_addr); + + if (!dwarf_eh_find_callsite(context, &lsda, &action)) + { + // EH range not found. This happens if exception is thrown and not + // caught inside a cleanup (destructor). We should call + // terminate() in this case. The catchTemp (landing pad) field of + // exception object will contain null when personality function is + // called with _UA_HANDLER_FRAME action for phase 2 unwinding. + return _URC_HANDLER_FOUND; + } + + handler_type found_handler = check_action_record(context, &lsda, + action.action_record, realEx, &selector, ex->adjustedPtr); + // If there's no action record, we've only found a cleanup, so keep + // searching for something real + if (found_handler == handler_catch) + { + // Cache the results for the phase 2 unwind, if we found a handler + // and this is not a foreign exception. + if (ex) + { + saveLandingPad(context, exceptionObject, ex, selector, action.landing_pad); + ex->languageSpecificData = (const char*)lsda_addr; + ex->actionRecord = (const char*)action.action_record; + // ex->adjustedPtr is set when finding the action record. + } + return _URC_HANDLER_FOUND; + } + return continueUnwinding(exceptionObject, context); + } + + + // If this is a foreign exception, we didn't have anywhere to cache the + // lookup stuff, so we need to do it again. If this is either a forced + // unwind, a foreign exception, or a cleanup, then we just install the + // context for a cleanup. + if (!(actions & _UA_HANDLER_FRAME)) + { + // cleanup + struct dwarf_eh_lsda lsda = parse_lsda(context, lsda_addr); + dwarf_eh_find_callsite(context, &lsda, &action); + if (0 == action.landing_pad) { return continueUnwinding(exceptionObject, context); } + handler_type found_handler = check_action_record(context, &lsda, + action.action_record, realEx, &selector, ex->adjustedPtr); + // Ignore handlers this time. + if (found_handler != handler_cleanup) { return continueUnwinding(exceptionObject, context); } + pushCleanupException(exceptionObject, ex); + } + else if (foreignException) + { + struct dwarf_eh_lsda lsda = parse_lsda(context, lsda_addr); + dwarf_eh_find_callsite(context, &lsda, &action); + check_action_record(context, &lsda, action.action_record, realEx, + &selector, ex->adjustedPtr); + } + else if (ex->catchTemp == 0) + { + // Uncaught exception in cleanup, calling terminate + std::terminate(); + } + else + { + // Restore the saved info if we saved some last time. + loadLandingPad(context, exceptionObject, ex, &selector, &action.landing_pad); + ex->catchTemp = 0; + ex->handlerSwitchValue = 0; + } + + + _Unwind_SetIP(context, (unsigned long)action.landing_pad); + _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), + (unsigned long)exceptionObject); + _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), selector); + + return _URC_INSTALL_CONTEXT; +} + +/** + * ABI function called when entering a catch statement. The argument is the + * pointer passed out of the personality function. This is always the start of + * the _Unwind_Exception object. The return value for this function is the + * pointer to the caught exception, which is either the adjusted pointer (for + * C++ exceptions) of the unadjusted pointer (for foreign exceptions). + */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +extern "C" void *__cxa_begin_catch(void *e) throw() +#else +extern "C" void *__cxa_begin_catch(void *e) +#endif +{ + // Decrement the uncaught exceptions count + __cxa_eh_globals *globals = __cxa_get_globals(); + globals->uncaughtExceptions--; + _Unwind_Exception *exceptionObject = (_Unwind_Exception*)e; + + if (isCXXException(exceptionObject->exception_class)) + { + __cxa_exception *ex = exceptionFromPointer(exceptionObject); + + if (ex->handlerCount == 0) + { + // Add this to the front of the list of exceptions being handled + // and increment its handler count so that it won't be deleted + // prematurely. + ex->nextException = globals->caughtExceptions; + globals->caughtExceptions = ex; + } + + if (ex->handlerCount < 0) + { + // Rethrown exception is catched before end of catch block. + // Clear the rethrow flag (make value positive) - we are allowed + // to delete this exception at the end of the catch block, as long + // as it isn't thrown again later. + + // Code pattern: + // + // try { + // throw x; + // } + // catch() { + // try { + // throw; + // } + // catch() { + // __cxa_begin_catch() <- we are here + // } + // } + ex->handlerCount = -ex->handlerCount + 1; + } + else + { + ex->handlerCount++; + } + + return ex->adjustedPtr; + } + // exceptionObject is the pointer to the _Unwind_Exception within the + // __cxa_exception. The throw object is after this + return ((char*)exceptionObject + sizeof(_Unwind_Exception)); +} + + + +/** + * ABI function called when exiting a catch block. This will free the current + * exception if it is no longer referenced in other catch blocks. + */ +extern "C" void __cxa_end_catch() +{ + // We can call the fast version here because the slow version is called in + // __cxa_throw(), which must have been called before we end a catch block + __cxa_eh_globals *globals = __cxa_get_globals_fast(); + __cxa_exception *ex = globals->caughtExceptions; + + assert(0 != ex && "Ending catch when no exception is on the stack!"); + + bool deleteException = true; + + if (ex->handlerCount < 0) + { + // exception was rethrown. Exception should not be deleted even if + // handlerCount become zero. + // Code pattern: + // try { + // throw x; + // } + // catch() { + // { + // throw; + // } + // cleanup { + // __cxa_end_catch(); <- we are here + // } + // } + // + + ex->handlerCount++; + deleteException = false; + } + else + { + ex->handlerCount--; + } + + if (ex->handlerCount == 0) + { + globals->caughtExceptions = ex->nextException; + if (deleteException) + { + releaseException(ex); + } + } +} + +/** + * ABI function. Returns the type of the current exception. + */ +extern "C" std::type_info *__cxa_current_exception_type() +{ + __cxa_eh_globals *globals = __cxa_get_globals(); + __cxa_exception *ex = globals->caughtExceptions; + return ex ? ex->exceptionType : 0; +} + +/** + * ABI function, called when an exception specification is violated. + * + * This function does not return. + */ +extern "C" void __cxa_call_unexpected(void*exception) +{ + _Unwind_Exception *exceptionObject = (_Unwind_Exception*)exception; + if (exceptionObject->exception_class == exception_class) + { + __cxa_exception *ex = exceptionFromPointer(exceptionObject); + if (ex->unexpectedHandler) + { + ex->unexpectedHandler(); + // Should not be reached. + abort(); + } + } + std::unexpected(); + // Should not be reached. + abort(); +} + +/** + * ABI function, returns the adjusted pointer to the exception object. + */ +extern "C" void *__cxa_get_exception_ptr(void *exceptionObject) +{ + return exceptionFromPointer(exceptionObject)->adjustedPtr; +} + +/** + * As an extension, we provide the ability for the unexpected and terminate + * handlers to be thread-local. We default to the standards-compliant + * behaviour where they are global. + */ +static bool thread_local_handlers = false; + + +namespace pathscale +{ + /** + * Sets whether unexpected and terminate handlers should be thread-local. + */ + void set_use_thread_local_handlers(bool flag) throw() + { + thread_local_handlers = flag; + } + /** + * Sets a thread-local unexpected handler. + */ + unexpected_handler set_unexpected(unexpected_handler f) throw() + { + static __cxa_thread_info *info = thread_info(); + unexpected_handler old = info->unexpectedHandler; + info->unexpectedHandler = f; + return old; + } + /** + * Sets a thread-local terminate handler. + */ + terminate_handler set_terminate(terminate_handler f) throw() + { + static __cxa_thread_info *info = thread_info(); + terminate_handler old = info->terminateHandler; + info->terminateHandler = f; + return old; + } +} + +namespace std +{ + /** + * Sets the function that will be called when an exception specification is + * violated. + */ + unexpected_handler set_unexpected(unexpected_handler f) throw() + { + if (thread_local_handlers) { return pathscale::set_unexpected(f); } + + return ATOMIC_SWAP(&unexpectedHandler, f); + } + /** + * Sets the function that is called to terminate the program. + */ + terminate_handler set_terminate(terminate_handler f) throw() + { + if (thread_local_handlers) { return pathscale::set_terminate(f); } + + return ATOMIC_SWAP(&terminateHandler, f); + } + /** + * Terminates the program, calling a custom terminate implementation if + * required. + */ + void terminate() + { +// Note, if there is a HW exception raised in the `term_handler', +// the abort() function might possibly be bypassed. +// +// On the other hand, if we disable ECALL before calling into +// the `term_handler', then the user can do only one OCALL in +// the handler (and it will fail when ORET). +#define force_abort(term_handler) do { \ + try { term_handler (); abort(); } \ + catch (...) { abort(); } \ +} while (0) + static __cxa_thread_info *info = thread_info_fast(); + if (0 != info && 0 != info->terminateHandler) + { + force_abort(info->terminateHandler); + // Should not be reached - a terminate handler is not expected to + // return. + } + force_abort(terminateHandler); +#undef force_abort + } + /** + * Called when an unexpected exception is encountered (i.e. an exception + * violates an exception specification). This calls abort() unless a + * custom handler has been set.. + */ + void unexpected() + { + static __cxa_thread_info *info = thread_info_fast(); + if (0 != info && 0 != info->unexpectedHandler) + { + info->unexpectedHandler(); + // Should not be reached - a terminate handler is not expected to + // return. + abort(); + } + unexpectedHandler(); + } + /** + * Returns whether there are any exceptions currently being thrown that + * have not been caught. This can occur inside a nested catch statement. + */ + bool uncaught_exception() throw() + { + __cxa_thread_info *info = thread_info(); + return info->globals.uncaughtExceptions != 0; + } + /** + * Returns the current unexpected handler. + */ + unexpected_handler get_unexpected() throw() + { + __cxa_thread_info *info = thread_info(); + if (info->unexpectedHandler) + { + return info->unexpectedHandler; + } + return ATOMIC_LOAD(&unexpectedHandler); + } + /** + * Returns the current terminate handler. + */ + terminate_handler get_terminate() throw() + { + __cxa_thread_info *info = thread_info(); + if (info->terminateHandler) + { + return info->terminateHandler; + } + return ATOMIC_LOAD(&terminateHandler); + } +} +#ifdef __arm__ +extern "C" _Unwind_Exception *__cxa_get_cleanup(void) +{ + __cxa_thread_info *info = thread_info_fast(); + _Unwind_Exception *exceptionObject = info->currentCleanup; + if (isCXXException(exceptionObject->exception_class)) + { + __cxa_exception *ex = exceptionFromPointer(exceptionObject); + ex->cleanupCount--; + if (ex->cleanupCount == 0) + { + info->currentCleanup = ex->nextCleanup; + ex->nextCleanup = 0; + } + } + else + { + info->currentCleanup = 0; + } + return exceptionObject; +} + +asm ( +".pushsection .text.__cxa_end_cleanup \n" +".global __cxa_end_cleanup \n" +".type __cxa_end_cleanup, \"function\" \n" +"__cxa_end_cleanup: \n" +" push {r1, r2, r3, r4} \n" +" bl __cxa_get_cleanup \n" +" push {r1, r2, r3, r4} \n" +" b _Unwind_Resume \n" +" bl abort \n" +".popsection \n" +); +#endif diff --git a/sdk/cpprt/linux/gcc_personality_v0.c b/sdk/cpprt/linux/gcc_personality_v0.c new file mode 100644 index 0000000000..cde07d7f67 --- /dev/null +++ b/sdk/cpprt/linux/gcc_personality_v0.c @@ -0,0 +1,254 @@ +/* ===-- gcc_personality_v0.c - Implement __gcc_personality_v0 -------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + * + */ + +#include +#include +#include "se_cdefs.h" + +#define compilerrt_abort abort + +SGX_ACCESS_VERSION(tstdcxx, 2) + + +/* + * _Unwind_* stuff based on C++ ABI public documentation + * http://refspecs.freestandards.org/abi-eh-1.21.html + */ + +typedef enum { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + +typedef enum { + _UA_SEARCH_PHASE = 1, + _UA_CLEANUP_PHASE = 2, + _UA_HANDLER_FRAME = 4, + _UA_FORCE_UNWIND = 8, + _UA_END_OF_STACK = 16 +} _Unwind_Action; + +typedef struct _Unwind_Context* _Unwind_Context_t; + +struct _Unwind_Exception { + uint64_t exception_class; + void (*exception_cleanup)(_Unwind_Reason_Code reason, + struct _Unwind_Exception* exc); + uintptr_t private_1; + uintptr_t private_2; +}; + +extern const uint8_t* _Unwind_GetLanguageSpecificData(_Unwind_Context_t c); +extern void _Unwind_SetGR(_Unwind_Context_t c, int i, uintptr_t n); +extern void _Unwind_SetIP(_Unwind_Context_t, uintptr_t new_value); +extern uintptr_t _Unwind_GetIP(_Unwind_Context_t context); +extern uintptr_t _Unwind_GetRegionStart(_Unwind_Context_t context); + + +/* + * Pointer encodings documented at: + * http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html + */ + +#define DW_EH_PE_omit 0xff /* no data follows */ + +#define DW_EH_PE_absptr 0x00 +#define DW_EH_PE_uleb128 0x01 +#define DW_EH_PE_udata2 0x02 +#define DW_EH_PE_udata4 0x03 +#define DW_EH_PE_udata8 0x04 +#define DW_EH_PE_sleb128 0x09 +#define DW_EH_PE_sdata2 0x0A +#define DW_EH_PE_sdata4 0x0B +#define DW_EH_PE_sdata8 0x0C + +#define DW_EH_PE_pcrel 0x10 +#define DW_EH_PE_textrel 0x20 +#define DW_EH_PE_datarel 0x30 +#define DW_EH_PE_funcrel 0x40 +#define DW_EH_PE_aligned 0x50 +#define DW_EH_PE_indirect 0x80 /* gcc extension */ + + + +/* read a uleb128 encoded value and advance pointer */ +static uintptr_t readULEB128(const uint8_t** data) +{ + uintptr_t result = 0; + uintptr_t shift = 0; + unsigned char byte; + const uint8_t* p = *data; + do { + byte = *p++; + result |= (byte & 0x7f) << shift; + shift += 7; + } while (byte & 0x80); + *data = p; + return result; +} + +/* read a pointer encoded value and advance pointer */ +static uint64_t readEncodedPointer(const uint8_t** data, uint8_t encoding) +{ + const uint8_t* p = *data; + uint64_t result = 0; + + if ( encoding == DW_EH_PE_omit ) + return 0; + + /* first get value */ + switch (encoding & 0x0F) { + case DW_EH_PE_absptr: + result = *((uintptr_t*)p); + p += sizeof(uintptr_t); + break; + case DW_EH_PE_uleb128: + result = readULEB128(&p); + break; + case DW_EH_PE_udata2: + result = *((uint16_t*)p); + p += sizeof(uint16_t); + break; + case DW_EH_PE_udata4: + result = *((uint32_t*)p); + p += sizeof(uint32_t); + break; + case DW_EH_PE_udata8: + result = *((uint64_t*)p); + p += sizeof(uint64_t); + break; + case DW_EH_PE_sdata2: + result = *((int16_t*)p); + p += sizeof(int16_t); + break; + case DW_EH_PE_sdata4: + result = *((int32_t*)p); + p += sizeof(int32_t); + break; + case DW_EH_PE_sdata8: + result = *((int64_t*)p); + p += sizeof(int64_t); + break; + case DW_EH_PE_sleb128: + default: + /* not supported */ + compilerrt_abort(); + break; + } + + /* then add relative offset */ + switch ( encoding & 0x70 ) { + case DW_EH_PE_absptr: + /* do nothing */ + break; + case DW_EH_PE_pcrel: + result += (uintptr_t)(*data); + break; + case DW_EH_PE_textrel: + case DW_EH_PE_datarel: + case DW_EH_PE_funcrel: + case DW_EH_PE_aligned: + default: + /* not supported */ + compilerrt_abort(); + break; + } + + /* then apply indirection */ + if (encoding & DW_EH_PE_indirect) { + result = *((uintptr_t*)result); + } + + *data = p; + return result; +} + + +/* + * The C compiler makes references to __gcc_personality_v0 in + * the dwarf unwind information for translation units that use + * __attribute__((cleanup(xx))) on local variables. + * This personality routine is called by the system unwinder + * on each frame as the stack is unwound during a C++ exception + * throw through a C function compiled with -fexceptions. + */ +#if __arm__ +// the setjump-longjump based exceptions personality routine has a different name +_Unwind_Reason_Code __gcc_personality_sj0(int version, _Unwind_Action actions, + uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject, + _Unwind_Context_t context) +#else +_Unwind_Reason_Code __gcc_personality_v0(int version, _Unwind_Action actions, + uint64_t exceptionClass, struct _Unwind_Exception* exceptionObject, + _Unwind_Context_t context) +#endif +{ + /* Since C does not have catch clauses, there is nothing to do during */ + /* phase 1 (the search phase). */ + if ( actions & _UA_SEARCH_PHASE ) + return _URC_CONTINUE_UNWIND; + + /* There is nothing to do if there is no LSDA for this frame. */ + const uint8_t* lsda = _Unwind_GetLanguageSpecificData(context); + if ( lsda == (uint8_t*) 0 ) + return _URC_CONTINUE_UNWIND; + + uintptr_t pc = _Unwind_GetIP(context)-1; + uintptr_t funcStart = _Unwind_GetRegionStart(context); + uintptr_t pcOffset = pc - funcStart; + + /* Parse LSDA header. */ + uint8_t lpStartEncoding = *lsda++; + if (lpStartEncoding != DW_EH_PE_omit) { + readEncodedPointer(&lsda, lpStartEncoding); + } + uint8_t ttypeEncoding = *lsda++; + if (ttypeEncoding != DW_EH_PE_omit) { + readULEB128(&lsda); + } + /* Walk call-site table looking for range that includes current PC. */ + uint8_t callSiteEncoding = *lsda++; + uint32_t callSiteTableLength = readULEB128(&lsda); + const uint8_t* callSiteTableStart = lsda; + const uint8_t* callSiteTableEnd = callSiteTableStart + callSiteTableLength; + const uint8_t* p=callSiteTableStart; + while (p < callSiteTableEnd) { + uint64_t start = readEncodedPointer(&p, callSiteEncoding); + uint64_t length = readEncodedPointer(&p, callSiteEncoding); + uint64_t landingPad = readEncodedPointer(&p, callSiteEncoding); + readULEB128(&p); /* action value not used for C code */ + if ( landingPad == 0 ) + continue; /* no landing pad for this entry */ + if ( (start <= pcOffset) && (pcOffset < (start+length)) ) { + /* Found landing pad for the PC. + * Set Instruction Pointer to so we re-enter function + * at landing pad. The landing pad is created by the compiler + * to take two parameters in registers. + */ + _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), + (uintptr_t)exceptionObject); + _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), 0); + _Unwind_SetIP(context, funcStart+landingPad); + return _URC_INSTALL_CONTEXT; + } + } + + /* No landing pad found, continue unwinding. */ + return _URC_CONTINUE_UNWIND; +} + diff --git a/sdk/cpprt/linux/guard.cc b/sdk/cpprt/linux/guard.cc new file mode 100644 index 0000000000..bfdf340284 --- /dev/null +++ b/sdk/cpprt/linux/guard.cc @@ -0,0 +1,169 @@ +/* + * Copyright 2010-2012 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * guard.cc: Functions for thread-safe static initialisation. + * + * Static values in C++ can be initialised lazily their first use. This file + * contains functions that are used to ensure that two threads attempting to + * initialize the same static do not call the constructor twice. This is + * important because constructors can have side effects, so calling the + * constructor twice may be very bad. + * + * Statics that require initialisation are protected by a 64-bit value. Any + * platform that can do 32-bit atomic test and set operations can use this + * value as a low-overhead lock. Because statics (in most sane code) are + * accessed far more times than they are initialised, this lock implementation + * is heavily optimised towards the case where the static has already been + * initialised. + */ +#include +#include + +#include "se_cdefs.h" + +SGX_ACCESS_VERSION(tstdcxx, 3) + +#ifdef __arm__ +// ARM ABI - 32-bit guards. + +/** + * Acquires a lock on a guard, returning 0 if the object has already been + * initialised, and 1 if it has not. If the object is already constructed then + * this function just needs to read a byte from memory and return. + */ +extern "C" int __cxa_guard_acquire(volatile int32_t *guard_object) +{ + if ((1<<31) == *guard_object) { return 0; } + // If we can atomically move the value from 0 -> 1, then this is + // uninitialised. + if (__sync_bool_compare_and_swap(guard_object, 0, 1)) + { + return 1; + } + // If the value is not 0, some other thread was initialising this. Spin + // until it's finished. + while (__sync_bool_compare_and_swap(guard_object, (1<<31), (1<<31))) + { + // If the other thread aborted, then we grab the lock + if (__sync_bool_compare_and_swap(guard_object, 0, 1)) + { + return 1; + } + sched_yield(); + } + return 0; +} + +/** + * Releases the lock without marking the object as initialised. This function + * is called if initialising a static causes an exception to be thrown. + */ +extern "C" void __cxa_guard_abort(int32_t *guard_object) +{ + assert(__sync_bool_compare_and_swap(guard_object, 1, 0)); +} +/** + * Releases the guard and marks the object as initialised. This function is + * called after successful initialisation of a static. + */ +extern "C" void __cxa_guard_release(int32_t *guard_object) +{ + assert(__sync_bool_compare_and_swap(guard_object, 1, (1<<31))); +} + + +#else +// Itanium ABI: 64-bit guards + +/** + * Returns a pointer to the low 32 bits in a 64-bit value, respecting the + * platform's byte order. + */ +static int32_t *low_32_bits(volatile int64_t *ptr) +{ + int32_t *low= (int32_t*)ptr; + // Test if the machine is big endian - constant propagation at compile time + // should eliminate this completely. + int one = 1; + if (*(char*)&one != 1) + { + low++; + } + return low; +} + +/** + * Acquires a lock on a guard, returning 0 if the object has already been + * initialised, and 1 if it has not. If the object is already constructed then + * this function just needs to read a byte from memory and return. + */ +extern "C" int __cxa_guard_acquire(volatile int64_t *guard_object) +{ + char first_byte = (*guard_object) >> 56; + if (1 == first_byte) { return 0; } + int32_t *lock = low_32_bits(guard_object); + // Simple spin lock using the low 32 bits. We assume that concurrent + // attempts to initialize statics are very rare, so we don't need to + // optimise for the case where we have lots of threads trying to acquire + // the lock at the same time. + while (!__sync_bool_compare_and_swap_4(lock, 0, 1)) + { + if (1 == ((*guard_object) >> 56)) + { + break; + } + // sched_yield need to be implemented as a OCALL, + // while we try to remove OCALLs in this library. + //sched_yield(); + } + // We have to test the guard again, in case another thread has performed + // the initialisation while we were trying to acquire the lock. + first_byte = (*guard_object) >> 56; + return (1 != first_byte); +} + +/** + * Releases the lock without marking the object as initialised. This function + * is called if initialising a static causes an exception to be thrown. + */ +extern "C" void __cxa_guard_abort(int64_t *guard_object) +{ + int32_t *lock = low_32_bits(guard_object); + *lock = 0; +} +/** + * Releases the guard and marks the object as initialised. This function is + * called after successful initialisation of a static. + */ +extern "C" void __cxa_guard_release(int64_t *guard_object) +{ + // Set the first byte to 1 + *guard_object |= ((int64_t)1) << 56; + __cxa_guard_abort(guard_object); +} + +#endif diff --git a/sdk/cpprt/linux/libelftc_dem_gnu3.c b/sdk/cpprt/linux/libelftc_dem_gnu3.c new file mode 100644 index 0000000000..6d0680be3f --- /dev/null +++ b/sdk/cpprt/linux/libelftc_dem_gnu3.c @@ -0,0 +1,3474 @@ +/*- + * Copyright (c) 2007, 2008 Hyogeol Lee + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * @file cpp_demangle.c + * @brief Decode IA-64 C++ ABI style implementation. + * + * IA-64 standard ABI(Itanium C++ ABI) references. + * + * http://www.codesourcery.com/cxx-abi/abi.html#mangling \n + * http://www.codesourcery.com/cxx-abi/abi-mangling.html + */ + +/** @brief Dynamic vector data for string. */ +struct vector_str { + /** Current size */ + size_t size; + /** Total capacity */ + size_t capacity; + /** String array */ + char **container; +}; + +#define BUFFER_GROWFACTOR 1.618 +#define VECTOR_DEF_CAPACITY 8 +#define ELFTC_ISDIGIT(C) (isdigit((C) & 0xFF)) + +enum type_qualifier { + TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT, + TYPE_CST +}; + +struct vector_type_qualifier { + size_t size, capacity; + enum type_qualifier *q_container; + struct vector_str ext_name; +}; + +enum read_cmd { + READ_FAIL, READ_NEST, READ_TMPL, READ_EXPR, READ_EXPL, READ_LOCAL, + READ_TYPE, READ_FUNC, READ_PTRMEM +}; + +struct vector_read_cmd { + size_t size, capacity; + enum read_cmd *r_container; +}; + +struct cpp_demangle_data { + struct vector_str output; /* output string vector */ + struct vector_str output_tmp; + struct vector_str subst; /* substitution string vector */ + struct vector_str tmpl; + struct vector_str class_type; + struct vector_read_cmd cmd; + bool paren; /* parenthesis opened */ + bool pfirst; /* first element of parameter */ + bool mem_rst; /* restrict member function */ + bool mem_vat; /* volatile member function */ + bool mem_cst; /* const member function */ + int func_type; + const char *cur; /* current mangled name ptr */ + const char *last_sname; /* last source name */ + int push_head; +}; + +#define CPP_DEMANGLE_TRY_LIMIT 128 +#define FLOAT_SPRINTF_TRY_LIMIT 5 +#define FLOAT_QUADRUPLE_BYTES 16 +#define FLOAT_EXTENED_BYTES 10 + +#define SIMPLE_HASH(x,y) (64 * x + y) + +static size_t get_strlen_sum(const struct vector_str *v); +static bool vector_str_grow(struct vector_str *v); + +static size_t +get_strlen_sum(const struct vector_str *v) +{ + size_t i, len = 0; + + if (v == NULL) + return (0); + + assert(v->size > 0); + + for (i = 0; i < v->size; ++i) + len += strlen(v->container[i]); + + return (len); +} + +/** + * @brief Deallocate resource in vector_str. + */ +static void +vector_str_dest(struct vector_str *v) +{ + size_t i; + + if (v == NULL) + return; + + for (i = 0; i < v->size; ++i) + free(v->container[i]); + + free(v->container); +} + +/** + * @brief Find string in vector_str. + * @param v Destination vector. + * @param o String to find. + * @param l Length of the string. + * @return -1 at failed, 0 at not found, 1 at found. + */ +static int +vector_str_find(const struct vector_str *v, const char *o, size_t l) +{ + size_t i; + + if (v == NULL || o == NULL) + return (-1); + + for (i = 0; i < v->size; ++i) + if (strncmp(v->container[i], o, l) == 0) + return (1); + + return (0); +} + +/** + * @brief Get new allocated flat string from vector. + * + * If l is not NULL, return length of the string. + * @param v Destination vector. + * @param l Length of the string. + * @return NULL at failed or NUL terminated new allocated string. + */ +static char * +vector_str_get_flat(const struct vector_str *v, size_t *l) +{ + ssize_t elem_pos, elem_size, rtn_size; + size_t i; + char *rtn; + + if (v == NULL || v->size == 0) + return (NULL); + + if ((rtn_size = get_strlen_sum(v)) == 0) + return (NULL); + + if ((rtn = malloc(sizeof(char) * (rtn_size + 1))) == NULL) + return (NULL); + + elem_pos = 0; + for (i = 0; i < v->size; ++i) { + elem_size = strlen(v->container[i]); + + memcpy(rtn + elem_pos, v->container[i], elem_size); + + elem_pos += elem_size; + } + + rtn[rtn_size] = '\0'; + + if (l != NULL) + *l = rtn_size; + + return (rtn); +} + +static bool +vector_str_grow(struct vector_str *v) +{ + size_t i, tmp_cap; + char **tmp_ctn; + + if (v == NULL) + return (false); + + assert(v->capacity > 0); + + tmp_cap = v->capacity * BUFFER_GROWFACTOR; + + assert(tmp_cap > v->capacity); + + if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) + return (false); + + for (i = 0; i < v->size; ++i) + tmp_ctn[i] = v->container[i]; + + free(v->container); + + v->container = tmp_ctn; + v->capacity = tmp_cap; + + return (true); +} + +/** + * @brief Initialize vector_str. + * @return false at failed, true at success. + */ +static bool +vector_str_init(struct vector_str *v) +{ + + if (v == NULL) + return (false); + + v->size = 0; + v->capacity = VECTOR_DEF_CAPACITY; + + assert(v->capacity > 0); + + if ((v->container = malloc(sizeof(char *) * v->capacity)) == NULL) + return (false); + + assert(v->container != NULL); + + return (true); +} + +/** + * @brief Remove last element in vector_str. + * @return false at failed, true at success. + */ +static bool +vector_str_pop(struct vector_str *v) +{ + + if (v == NULL) + return (false); + + if (v->size == 0) + return (true); + + --v->size; + + free(v->container[v->size]); + v->container[v->size] = NULL; + + return (true); +} + +/** + * @brief Push back string to vector. + * @return false at failed, true at success. + */ +static bool +vector_str_push(struct vector_str *v, const char *str, size_t len) +{ + + if (v == NULL || str == NULL) + return (false); + + if (v->size == v->capacity && vector_str_grow(v) == false) + return (false); + + if ((v->container[v->size] = malloc(sizeof(char) * (len + 1))) == NULL) + return (false); + + snprintf(v->container[v->size], len + 1, "%s", str); + + ++v->size; + + return (true); +} + +/** + * @brief Push front org vector to det vector. + * @return false at failed, true at success. + */ +static bool +vector_str_push_vector_head(struct vector_str *dst, struct vector_str *org) +{ + size_t i, j, tmp_cap; + char **tmp_ctn; + + if (dst == NULL || org == NULL) + return (false); + + tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + + if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) + return (false); + + for (i = 0; i < org->size; ++i) + if ((tmp_ctn[i] = strdup(org->container[i])) == NULL) { + for (j = 0; j < i; ++j) + free(tmp_ctn[j]); + + free(tmp_ctn); + + return (false); + } + + for (i = 0; i < dst->size; ++i) + tmp_ctn[i + org->size] = dst->container[i]; + + free(dst->container); + + dst->container = tmp_ctn; + dst->capacity = tmp_cap; + dst->size += org->size; + + return (true); +} + +/** + * @brief Get new allocated flat string from vector between begin and end. + * + * If r_len is not NULL, string length will be returned. + * @return NULL at failed or NUL terminated new allocated string. + */ +static char * +vector_str_substr(const struct vector_str *v, size_t begin, size_t end, + size_t *r_len) +{ + size_t cur, i, len; + char *rtn; + + if (v == NULL || begin > end) + return (NULL); + + len = 0; + for (i = begin; i < end + 1; ++i) + len += strlen(v->container[i]); + + if ((rtn = malloc(sizeof(char) * (len + 1))) == NULL) + return (NULL); + + if (r_len != NULL) + *r_len = len; + + cur = 0; + for (i = begin; i < end + 1; ++i) { + len = strlen(v->container[i]); + memcpy(rtn + cur, v->container[i], len); + cur += len; + } + rtn[cur] = '\0'; + + return (rtn); +} + +static void cpp_demangle_data_dest(struct cpp_demangle_data *); +static int cpp_demangle_data_init(struct cpp_demangle_data *, + const char *); +static int cpp_demangle_get_subst(struct cpp_demangle_data *, size_t); +static int cpp_demangle_get_tmpl_param(struct cpp_demangle_data *, size_t); +static int cpp_demangle_push_fp(struct cpp_demangle_data *, + char *(*)(const char *, size_t)); +static int cpp_demangle_push_str(struct cpp_demangle_data *, const char *, + size_t); +static int cpp_demangle_push_subst(struct cpp_demangle_data *, + const char *, size_t); +static int cpp_demangle_push_subst_v(struct cpp_demangle_data *, + struct vector_str *); +static int cpp_demangle_push_type_qualifier(struct cpp_demangle_data *, + struct vector_type_qualifier *, const char *); +static int cpp_demangle_read_array(struct cpp_demangle_data *); +static int cpp_demangle_read_encoding(struct cpp_demangle_data *); +static int cpp_demangle_read_expr_primary(struct cpp_demangle_data *); +static int cpp_demangle_read_expression(struct cpp_demangle_data *); +static int cpp_demangle_read_expression_binary(struct cpp_demangle_data *, + const char *, size_t); +static int cpp_demangle_read_expression_unary(struct cpp_demangle_data *, + const char *, size_t); +static int cpp_demangle_read_expression_trinary(struct cpp_demangle_data *, + const char *, size_t, const char *, size_t); +static int cpp_demangle_read_function(struct cpp_demangle_data *, int *, + struct vector_type_qualifier *); +static int cpp_demangle_read_local_name(struct cpp_demangle_data *); +static int cpp_demangle_read_name(struct cpp_demangle_data *); +static int cpp_demangle_read_nested_name(struct cpp_demangle_data *); +static int cpp_demangle_read_number(struct cpp_demangle_data *, long *); +static int cpp_demangle_read_nv_offset(struct cpp_demangle_data *); +static int cpp_demangle_read_offset(struct cpp_demangle_data *); +static int cpp_demangle_read_offset_number(struct cpp_demangle_data *); +static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *); +static int cpp_demangle_read_sname(struct cpp_demangle_data *); +static int cpp_demangle_read_subst(struct cpp_demangle_data *); +static int cpp_demangle_read_subst_std(struct cpp_demangle_data *); +static int cpp_demangle_read_subst_stdtmpl(struct cpp_demangle_data *, + const char *, size_t); +static int cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *); +static int cpp_demangle_read_tmpl_args(struct cpp_demangle_data *); +static int cpp_demangle_read_tmpl_param(struct cpp_demangle_data *); +static int cpp_demangle_read_type(struct cpp_demangle_data *, int); +static int cpp_demangle_read_uqname(struct cpp_demangle_data *); +static int cpp_demangle_read_v_offset(struct cpp_demangle_data *); +static char *decode_fp_to_double(const char *, size_t); +static char *decode_fp_to_float(const char *, size_t); +static char *decode_fp_to_float128(const char *, size_t); +static char *decode_fp_to_float80(const char *, size_t); +static char *decode_fp_to_long_double(const char *, size_t); +static int hex_to_dec(char); +static void vector_read_cmd_dest(struct vector_read_cmd *); +static int vector_read_cmd_find(struct vector_read_cmd *, enum read_cmd); +static int vector_read_cmd_init(struct vector_read_cmd *); +static int vector_read_cmd_pop(struct vector_read_cmd *); +static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd); +static void vector_type_qualifier_dest(struct vector_type_qualifier *); +static int vector_type_qualifier_init(struct vector_type_qualifier *); +static int vector_type_qualifier_push(struct vector_type_qualifier *, + enum type_qualifier); + +/** + * @brief Decode the input string by IA-64 C++ ABI style. + * + * GNU GCC v3 use IA-64 standard ABI. + * @return New allocated demangled string or NULL if failed. + * @todo 1. Testing and more test case. 2. Code cleaning. + */ +char * +__cxa_demangle_gnu3(const char *org) +{ + struct cpp_demangle_data ddata; + ssize_t org_len; + unsigned int limit; + char *rtn = NULL; + + if (org == NULL) + return (NULL); + + // Try demangling as a type for short encodings + if (((org_len = strlen(org)) < 2) || (org[0] != '_' || org[1] != 'Z' )) { + if (!cpp_demangle_data_init(&ddata, org)) + return (NULL); + if (!cpp_demangle_read_type(&ddata, 0)) + goto clean; + rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); + goto clean; + } + if (org_len > 11 && !strncmp(org, "_GLOBAL__I_", 11)) { + if ((rtn = malloc(org_len + 19)) == NULL) + return (NULL); + snprintf(rtn, org_len + 19, + "global constructors keyed to %s", org + 11); + return (rtn); + } + + + if (!cpp_demangle_data_init(&ddata, org + 2)) + return (NULL); + + if (!cpp_demangle_read_encoding(&ddata)) + goto clean; + + limit = 0; + while (*ddata.cur != '\0') { + /* + * Breaking at some gcc info at tail. e.g) @@GLIBCXX_3.4 + */ + if (*ddata.cur == '@' && *(ddata.cur + 1) == '@') + break; + if (!cpp_demangle_read_type(&ddata, 1)) + goto clean; + if (limit++ > CPP_DEMANGLE_TRY_LIMIT) + goto clean; + } + + if (ddata.output.size == 0) + goto clean; + if (ddata.paren && !vector_str_push(&ddata.output, ")", 1)) + goto clean; + if (ddata.mem_vat && !vector_str_push(&ddata.output, " volatile", 9)) + goto clean; + if (ddata.mem_cst && !vector_str_push(&ddata.output, " const", 6)) + goto clean; + if (ddata.mem_rst && !vector_str_push(&ddata.output, " restrict", 9)) + goto clean; + + rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); + +clean: + cpp_demangle_data_dest(&ddata); + + return (rtn); +} + +char * +__cxa_demangle(const char*org) __attribute__((weak, alias("__cxa_demangle_gnu3"))); + +static void +cpp_demangle_data_dest(struct cpp_demangle_data *d) +{ + + if (d == NULL) + return; + + vector_read_cmd_dest(&d->cmd); + vector_str_dest(&d->class_type); + vector_str_dest(&d->tmpl); + vector_str_dest(&d->subst); + vector_str_dest(&d->output_tmp); + vector_str_dest(&d->output); +} + +static int +cpp_demangle_data_init(struct cpp_demangle_data *d, const char *cur) +{ + + if (d == NULL || cur == NULL) + return (0); + + if (!vector_str_init(&d->output)) + return (0); + if (!vector_str_init(&d->output_tmp)) + goto clean1; + if (!vector_str_init(&d->subst)) + goto clean2; + if (!vector_str_init(&d->tmpl)) + goto clean3; + if (!vector_str_init(&d->class_type)) + goto clean4; + if (!vector_read_cmd_init(&d->cmd)) + goto clean5; + + assert(d->output.container != NULL); + assert(d->output_tmp.container != NULL); + assert(d->subst.container != NULL); + assert(d->tmpl.container != NULL); + assert(d->class_type.container != NULL); + + d->paren = false; + d->pfirst = false; + d->mem_rst = false; + d->mem_vat = false; + d->mem_cst = false; + d->func_type = 0; + d->cur = cur; + d->last_sname = NULL; + d->push_head = 0; + + return (1); + +clean5: + vector_str_dest(&d->class_type); +clean4: + vector_str_dest(&d->tmpl); +clean3: + vector_str_dest(&d->subst); +clean2: + vector_str_dest(&d->output_tmp); +clean1: + vector_str_dest(&d->output); + + return (0); +} + +static int +cpp_demangle_push_fp(struct cpp_demangle_data *ddata, + char *(*decoder)(const char *, size_t)) +{ + size_t len; + int rtn; + const char *fp; + char *f; + + if (ddata == NULL || decoder == NULL) + return (0); + + fp = ddata->cur; + while (*ddata->cur != 'E') + ++ddata->cur; + ++ddata->cur; + + if ((f = decoder(fp, ddata->cur - fp)) == NULL) + return (0); + + rtn = 0; + if ((len = strlen(f)) > 0 && + cpp_demangle_push_str(ddata, f, len)) + rtn = 1; + + free(f); + + return (rtn); +} + +static int +cpp_demangle_push_str(struct cpp_demangle_data *ddata, const char *str, + size_t len) +{ + + if (ddata == NULL || str == NULL || len == 0) + return (0); + + if (ddata->push_head > 0) + return (vector_str_push(&ddata->output_tmp, str, len)); + + return (vector_str_push(&ddata->output, str, len)); +} + +static int +cpp_demangle_push_subst(struct cpp_demangle_data *ddata, const char *str, + size_t len) +{ + + if (ddata == NULL || str == NULL || len == 0) + return (0); + + if (!vector_str_find(&ddata->subst, str, len)) + return (vector_str_push(&ddata->subst, str, len)); + + return (1); +} + +static int +cpp_demangle_push_subst_v(struct cpp_demangle_data *ddata, struct vector_str *v) +{ + size_t str_len; + int rtn; + char *str; + + if (ddata == NULL || v == NULL) + return (0); + + if ((str = vector_str_get_flat(v, &str_len)) == NULL) + return (0); + + rtn = cpp_demangle_push_subst(ddata, str, str_len); + free(str); + + return (rtn); +} + +static int +cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, + struct vector_type_qualifier *v, const char *type_str) +{ + struct vector_str subst_v; + size_t idx, e_idx, e_len; + int rtn; + char *buf; + + if (ddata == NULL || v == NULL) + return (0); + + if ((idx = v->size) == 0) + return (1); + + rtn = 0; + if (type_str != NULL) { + if (!vector_str_init(&subst_v)) + return (0); + if (!vector_str_push(&subst_v, type_str, strlen(type_str))) + goto clean; + } + + e_idx = 0; + while (idx > 0) { + switch (v->q_container[idx - 1]) { + case TYPE_PTR: + if (!cpp_demangle_push_str(ddata, "*", 1)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, "*", 1)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + case TYPE_REF: + if (!cpp_demangle_push_str(ddata, "&", 1)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, "&", 1)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + case TYPE_CMX: + if (!cpp_demangle_push_str(ddata, " complex", 8)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, " complex", 8)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + case TYPE_IMG: + if (!cpp_demangle_push_str(ddata, " imaginary", 10)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, " imaginary", 10)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + case TYPE_EXT: + if (e_idx > v->ext_name.size - 1) + goto clean; + if ((e_len = strlen(v->ext_name.container[e_idx])) == 0) + goto clean; + if ((buf = malloc(sizeof(char) * (e_len + 1))) == NULL) + goto clean; + + memcpy(buf, " ", 1); + memcpy(buf + 1, v->ext_name.container[e_idx], e_len); + + if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) { + free(buf); + goto clean; + } + + if (type_str != NULL) { + if (!vector_str_push(&subst_v, buf, + e_len + 1)) { + free(buf); + goto clean; + } + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) { + free(buf); + goto clean; + } + } + free(buf); + ++e_idx; + break; + + case TYPE_RST: + if (!cpp_demangle_push_str(ddata, " restrict", 9)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, " restrict", 9)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + case TYPE_VAT: + if (!cpp_demangle_push_str(ddata, " volatile", 9)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, " volatile", 9)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + case TYPE_CST: + if (!cpp_demangle_push_str(ddata, " const", 6)) + goto clean; + if (type_str != NULL) { + if (!vector_str_push(&subst_v, " const", 6)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &subst_v)) + goto clean; + } + break; + + }; + --idx; + } + + rtn = 1; +clean: + if (type_str != NULL) + vector_str_dest(&subst_v); + + return (rtn); +} + +static int +cpp_demangle_get_subst(struct cpp_demangle_data *ddata, size_t idx) +{ + size_t len; + + if (ddata == NULL || ddata->subst.size <= idx) + return (0); + if ((len = strlen(ddata->subst.container[idx])) == 0) + return (0); + if (!cpp_demangle_push_str(ddata, ddata->subst.container[idx], len)) + return (0); + + /* skip '_' */ + ++ddata->cur; + + return (1); +} + +static int +cpp_demangle_get_tmpl_param(struct cpp_demangle_data *ddata, size_t idx) +{ + size_t len; + + if (ddata == NULL || ddata->tmpl.size <= idx) + return (0); + if ((len = strlen(ddata->tmpl.container[idx])) == 0) + return (0); + if (!cpp_demangle_push_str(ddata, ddata->tmpl.container[idx], len)) + return (0); + + ++ddata->cur; + + return (1); +} + +static int +cpp_demangle_read_array(struct cpp_demangle_data *ddata) +{ + size_t i, num_len, exp_len, p_idx, idx; + const char *num; + char *exp; + + if (ddata == NULL || *(++ddata->cur) == '\0') + return (0); + + if (*ddata->cur == '_') { + if (*(++ddata->cur) == '\0') + return (0); + + if (!cpp_demangle_read_type(ddata, 0)) + return (0); + + if (!cpp_demangle_push_str(ddata, "[]", 2)) + return (0); + } else { + if (ELFTC_ISDIGIT(*ddata->cur) != 0) { + num = ddata->cur; + while (ELFTC_ISDIGIT(*ddata->cur) != 0) + ++ddata->cur; + if (*ddata->cur != '_') + return (0); + num_len = ddata->cur - num; + assert(num_len > 0); + if (*(++ddata->cur) == '\0') + return (0); + if (!cpp_demangle_read_type(ddata, 0)) + return (0); + if (!cpp_demangle_push_str(ddata, "[", 1)) + return (0); + if (!cpp_demangle_push_str(ddata, num, num_len)) + return (0); + if (!cpp_demangle_push_str(ddata, "]", 1)) + return (0); + } else { + p_idx = ddata->output.size; + if (!cpp_demangle_read_expression(ddata)) + return (0); + if ((exp = vector_str_substr(&ddata->output, p_idx, + ddata->output.size - 1, &exp_len)) == NULL) + return (0); + idx = ddata->output.size; + for (i = p_idx; i < idx; ++i) + if (!vector_str_pop(&ddata->output)) { + free(exp); + return (0); + } + if (*ddata->cur != '_') { + free(exp); + return (0); + } + ++ddata->cur; + if (*ddata->cur == '\0') { + free(exp); + return (0); + } + if (!cpp_demangle_read_type(ddata, 0)) { + free(exp); + return (0); + } + if (!cpp_demangle_push_str(ddata, "[", 1)) { + free(exp); + return (0); + } + if (!cpp_demangle_push_str(ddata, exp, exp_len)) { + free(exp); + return (0); + } + if (!cpp_demangle_push_str(ddata, "]", 1)) { + free(exp); + return (0); + } + free(exp); + } + } + + return (1); +} + +static int +cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata) +{ + const char *num; + + if (ddata == NULL || *(++ddata->cur) == '\0') + return (0); + + if (*ddata->cur == '_' && *(ddata->cur + 1) == 'Z') { + ddata->cur += 2; + if (*ddata->cur == '\0') + return (0); + if (!cpp_demangle_read_encoding(ddata)) + return (0); + ++ddata->cur; + return (1); + } + + switch (*ddata->cur) { + case 'b': + switch (*(++ddata->cur)) { + case '0': + return (cpp_demangle_push_str(ddata, "false", 5)); + case '1': + return (cpp_demangle_push_str(ddata, "true", 4)); + default: + return (0); + }; + + case 'd': + ++ddata->cur; + return (cpp_demangle_push_fp(ddata, decode_fp_to_double)); + + case 'e': + ++ddata->cur; + if (sizeof(long double) == 10) + return (cpp_demangle_push_fp(ddata, + decode_fp_to_double)); + return (cpp_demangle_push_fp(ddata, decode_fp_to_float80)); + + case 'f': + ++ddata->cur; + return (cpp_demangle_push_fp(ddata, decode_fp_to_float)); + + case 'g': + ++ddata->cur; + if (sizeof(long double) == 16) + return (cpp_demangle_push_fp(ddata, + decode_fp_to_double)); + return (cpp_demangle_push_fp(ddata, decode_fp_to_float128)); + + case 'i': + case 'j': + case 'l': + case 'm': + case 'n': + case 's': + case 't': + case 'x': + case 'y': + if (*(++ddata->cur) == 'n') { + if (!cpp_demangle_push_str(ddata, "-", 1)) + return (0); + ++ddata->cur; + } + num = ddata->cur; + while (*ddata->cur != 'E') { + if (!ELFTC_ISDIGIT(*ddata->cur)) + return (0); + ++ddata->cur; + } + ++ddata->cur; + return (cpp_demangle_push_str(ddata, num, ddata->cur - num)); + + default: + return (0); + }; +} + +static int +cpp_demangle_read_expression(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { + case SIMPLE_HASH('s', 't'): + ddata->cur += 2; + return (cpp_demangle_read_type(ddata, 0)); + + case SIMPLE_HASH('s', 'r'): + ddata->cur += 2; + if (!cpp_demangle_read_type(ddata, 0)) + return (0); + if (!cpp_demangle_read_uqname(ddata)) + return (0); + if (*ddata->cur == 'I') + return (cpp_demangle_read_tmpl_args(ddata)); + return (1); + + case SIMPLE_HASH('a', 'a'): + /* operator && */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "&&", 2)); + + case SIMPLE_HASH('a', 'd'): + /* operator & (unary) */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "&", 1)); + + case SIMPLE_HASH('a', 'n'): + /* operator & */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "&", 1)); + + case SIMPLE_HASH('a', 'N'): + /* operator &= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "&=", 2)); + + case SIMPLE_HASH('a', 'S'): + /* operator = */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "=", 1)); + + case SIMPLE_HASH('c', 'l'): + /* operator () */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "()", 2)); + + case SIMPLE_HASH('c', 'm'): + /* operator , */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, ",", 1)); + + case SIMPLE_HASH('c', 'o'): + /* operator ~ */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "~", 1)); + + case SIMPLE_HASH('c', 'v'): + /* operator (cast) */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "(cast)", 6)); + + case SIMPLE_HASH('d', 'a'): + /* operator delete [] */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "delete []", 9)); + + case SIMPLE_HASH('d', 'e'): + /* operator * (unary) */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "*", 1)); + + case SIMPLE_HASH('d', 'l'): + /* operator delete */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "delete", 6)); + + case SIMPLE_HASH('d', 'v'): + /* operator / */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "/", 1)); + + case SIMPLE_HASH('d', 'V'): + /* operator /= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "/=", 2)); + + case SIMPLE_HASH('e', 'o'): + /* operator ^ */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "^", 1)); + + case SIMPLE_HASH('e', 'O'): + /* operator ^= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "^=", 2)); + + case SIMPLE_HASH('e', 'q'): + /* operator == */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "==", 2)); + + case SIMPLE_HASH('g', 'e'): + /* operator >= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, ">=", 2)); + + case SIMPLE_HASH('g', 't'): + /* operator > */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, ">", 1)); + + case SIMPLE_HASH('i', 'x'): + /* operator [] */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "[]", 2)); + + case SIMPLE_HASH('l', 'e'): + /* operator <= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "<=", 2)); + + case SIMPLE_HASH('l', 's'): + /* operator << */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "<<", 2)); + + case SIMPLE_HASH('l', 'S'): + /* operator <<= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "<<=", 3)); + + case SIMPLE_HASH('l', 't'): + /* operator < */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "<", 1)); + + case SIMPLE_HASH('m', 'i'): + /* operator - */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "-", 1)); + + case SIMPLE_HASH('m', 'I'): + /* operator -= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "-=", 2)); + + case SIMPLE_HASH('m', 'l'): + /* operator * */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "*", 1)); + + case SIMPLE_HASH('m', 'L'): + /* operator *= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "*=", 2)); + + case SIMPLE_HASH('m', 'm'): + /* operator -- */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "--", 2)); + + case SIMPLE_HASH('n', 'a'): + /* operator new[] */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "new []", 6)); + + case SIMPLE_HASH('n', 'e'): + /* operator != */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "!=", 2)); + + case SIMPLE_HASH('n', 'g'): + /* operator - (unary) */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "-", 1)); + + case SIMPLE_HASH('n', 't'): + /* operator ! */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "!", 1)); + + case SIMPLE_HASH('n', 'w'): + /* operator new */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "new", 3)); + + case SIMPLE_HASH('o', 'o'): + /* operator || */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "||", 2)); + + case SIMPLE_HASH('o', 'r'): + /* operator | */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "|", 1)); + + case SIMPLE_HASH('o', 'R'): + /* operator |= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "|=", 2)); + + case SIMPLE_HASH('p', 'l'): + /* operator + */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "+", 1)); + + case SIMPLE_HASH('p', 'L'): + /* operator += */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "+=", 2)); + + case SIMPLE_HASH('p', 'm'): + /* operator ->* */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "->*", 3)); + + case SIMPLE_HASH('p', 'p'): + /* operator ++ */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "++", 2)); + + case SIMPLE_HASH('p', 's'): + /* operator + (unary) */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "+", 1)); + + case SIMPLE_HASH('p', 't'): + /* operator -> */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "->", 2)); + + case SIMPLE_HASH('q', 'u'): + /* operator ? */ + ddata->cur += 2; + return (cpp_demangle_read_expression_trinary(ddata, "?", 1, + ":", 1)); + + case SIMPLE_HASH('r', 'm'): + /* operator % */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "%", 1)); + + case SIMPLE_HASH('r', 'M'): + /* operator %= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, "%=", 2)); + + case SIMPLE_HASH('r', 's'): + /* operator >> */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, ">>", 2)); + + case SIMPLE_HASH('r', 'S'): + /* operator >>= */ + ddata->cur += 2; + return (cpp_demangle_read_expression_binary(ddata, ">>=", 3)); + + case SIMPLE_HASH('r', 'z'): + /* operator sizeof */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6)); + + case SIMPLE_HASH('s', 'v'): + /* operator sizeof */ + ddata->cur += 2; + return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6)); + }; + + switch (*ddata->cur) { + case 'L': + return (cpp_demangle_read_expr_primary(ddata)); + case 'T': + return (cpp_demangle_read_tmpl_param(ddata)); + }; + + return (0); +} + +static int +cpp_demangle_read_expression_binary(struct cpp_demangle_data *ddata, + const char *name, size_t len) +{ + + if (ddata == NULL || name == NULL || len == 0) + return (0); + if (!cpp_demangle_read_expression(ddata)) + return (0); + if (!cpp_demangle_push_str(ddata, name, len)) + return (0); + + return (cpp_demangle_read_expression(ddata)); +} + +static int +cpp_demangle_read_expression_unary(struct cpp_demangle_data *ddata, + const char *name, size_t len) +{ + + if (ddata == NULL || name == NULL || len == 0) + return (0); + if (!cpp_demangle_read_expression(ddata)) + return (0); + + return (cpp_demangle_push_str(ddata, name, len)); +} + +static int +cpp_demangle_read_expression_trinary(struct cpp_demangle_data *ddata, + const char *name1, size_t len1, const char *name2, size_t len2) +{ + + if (ddata == NULL || name1 == NULL || len1 == 0 || name2 == NULL || + len2 == 0) + return (0); + + if (!cpp_demangle_read_expression(ddata)) + return (0); + if (!cpp_demangle_push_str(ddata, name1, len1)) + return (0); + if (!cpp_demangle_read_expression(ddata)) + return (0); + if (!cpp_demangle_push_str(ddata, name2, len2)) + return (0); + + return (cpp_demangle_read_expression(ddata)); +} + +static int +cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c, + struct vector_type_qualifier *v) +{ + size_t class_type_size, class_type_len, limit; + const char *class_type; + + if (ddata == NULL || *ddata->cur != 'F' || v == NULL) + return (0); + + ++ddata->cur; + if (*ddata->cur == 'Y') { + if (ext_c != NULL) + *ext_c = 1; + ++ddata->cur; + } + if (!cpp_demangle_read_type(ddata, 0)) + return (0); + if (*ddata->cur != 'E') { + if (!cpp_demangle_push_str(ddata, "(", 1)) + return (0); + if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM)) { + if ((class_type_size = ddata->class_type.size) == 0) + return (0); + class_type = + ddata->class_type.container[class_type_size - 1]; + if (class_type == NULL) + return (0); + if ((class_type_len = strlen(class_type)) == 0) + return (0); + if (!cpp_demangle_push_str(ddata, class_type, + class_type_len)) + return (0); + if (!cpp_demangle_push_str(ddata, "::*", 3)) + return (0); + ++ddata->func_type; + } else { + if (!cpp_demangle_push_type_qualifier(ddata, v, + (const char *) NULL)) + return (0); + vector_type_qualifier_dest(v); + if (!vector_type_qualifier_init(v)) + return (0); + } + + if (!cpp_demangle_push_str(ddata, ")(", 2)) + return (0); + + limit = 0; + for (;;) { + if (!cpp_demangle_read_type(ddata, 0)) + return (0); + if (*ddata->cur == 'E') + break; + if (limit++ > CPP_DEMANGLE_TRY_LIMIT) + return (0); + } + + if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM) == 1) { + if (!cpp_demangle_push_type_qualifier(ddata, v, + (const char *) NULL)) + return (0); + vector_type_qualifier_dest(v); + if (!vector_type_qualifier_init(v)) + return (0); + } + + if (!cpp_demangle_push_str(ddata, ")", 1)) + return (0); + } + + ++ddata->cur; + + return (1); +} + +/* read encoding, encoding are function name, data name, special-name */ +static int +cpp_demangle_read_encoding(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + /* special name */ + switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { + case SIMPLE_HASH('G', 'V'): + /* sentry object for 1 time init */ + if (!cpp_demangle_push_str(ddata, "guard variable for ", 20)) + return (0); + ddata->cur += 2; + break; + + case SIMPLE_HASH('T', 'c'): + /* virtual function covariant override thunk */ + if (!cpp_demangle_push_str(ddata, + "virtual function covariant override ", 36)) + return (0); + ddata->cur += 2; + if (*ddata->cur == '\0') + return (0); + if (!cpp_demangle_read_offset(ddata)) + return (0); + if (!cpp_demangle_read_offset(ddata)) + return (0); + return (cpp_demangle_read_encoding(ddata)); + + case SIMPLE_HASH('T', 'D'): + /* typeinfo common proxy */ + break; + + case SIMPLE_HASH('T', 'h'): + /* virtual function non-virtual override thunk */ + if (cpp_demangle_push_str(ddata, + "virtual function non-virtual override ", 38) == 0) + return (0); + ddata->cur += 2; + if (*ddata->cur == '\0') + return (0); + if (!cpp_demangle_read_nv_offset(ddata)) + return (0); + return (cpp_demangle_read_encoding(ddata)); + + case SIMPLE_HASH('T', 'I'): + /* typeinfo structure */ + /* FALLTHROUGH */ + case SIMPLE_HASH('T', 'S'): + /* RTTI name (NTBS) */ + if (!cpp_demangle_push_str(ddata, "typeinfo for ", 14)) + return (0); + ddata->cur += 2; + if (*ddata->cur == '\0') + return (0); + return (cpp_demangle_read_type(ddata, 1)); + + case SIMPLE_HASH('T', 'T'): + /* VTT table */ + if (!cpp_demangle_push_str(ddata, "VTT for ", 8)) + return (0); + ddata->cur += 2; + return (cpp_demangle_read_type(ddata, 1)); + + case SIMPLE_HASH('T', 'v'): + /* virtual function virtual override thunk */ + if (!cpp_demangle_push_str(ddata, + "virtual function virtual override ", 34)) + return (0); + ddata->cur += 2; + if (*ddata->cur == '\0') + return (0); + if (!cpp_demangle_read_v_offset(ddata)) + return (0); + return (cpp_demangle_read_encoding(ddata)); + + case SIMPLE_HASH('T', 'V'): + /* virtual table */ + if (!cpp_demangle_push_str(ddata, "vtable for ", 12)) + return (0); + ddata->cur += 2; + if (*ddata->cur == '\0') + return (0); + return (cpp_demangle_read_type(ddata, 1)); + }; + + return (cpp_demangle_read_name(ddata)); +} + +static int +cpp_demangle_read_local_name(struct cpp_demangle_data *ddata) +{ + size_t limit; + + if (ddata == NULL) + return (0); + if (*(++ddata->cur) == '\0') + return (0); + if (!cpp_demangle_read_encoding(ddata)) + return (0); + + limit = 0; + for (;;) { + if (!cpp_demangle_read_type(ddata, 1)) + return (0); + if (*ddata->cur == 'E') + break; + if (limit++ > CPP_DEMANGLE_TRY_LIMIT) + return (0); + } + if (*(++ddata->cur) == '\0') + return (0); + if (ddata->paren == true) { + if (!cpp_demangle_push_str(ddata, ")", 1)) + return (0); + ddata->paren = false; + } + if (*ddata->cur == 's') + ++ddata->cur; + else { + if (!cpp_demangle_push_str(ddata, "::", 2)) + return (0); + if (!cpp_demangle_read_name(ddata)) + return (0); + } + if (*ddata->cur == '_') { + ++ddata->cur; + while (ELFTC_ISDIGIT(*ddata->cur) != 0) + ++ddata->cur; + } + + return (1); +} + +static int +cpp_demangle_read_name(struct cpp_demangle_data *ddata) +{ + struct vector_str *output, v; + size_t p_idx, subst_str_len; + int rtn; + char *subst_str; + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; + + subst_str = NULL; + + switch (*ddata->cur) { + case 'S': + return (cpp_demangle_read_subst(ddata)); + case 'N': + return (cpp_demangle_read_nested_name(ddata)); + case 'Z': + return (cpp_demangle_read_local_name(ddata)); + }; + + if (!vector_str_init(&v)) + return (0); + + p_idx = output->size; + rtn = 0; + if (!cpp_demangle_read_uqname(ddata)) + goto clean; + if ((subst_str = vector_str_substr(output, p_idx, output->size - 1, + &subst_str_len)) == NULL) + goto clean; + if (subst_str_len > 8 && strstr(subst_str, "operator") != NULL) { + rtn = 1; + goto clean; + } + if (!vector_str_push(&v, subst_str, subst_str_len)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &v)) + goto clean; + + if (*ddata->cur == 'I') { + p_idx = output->size; + if (!cpp_demangle_read_tmpl_args(ddata)) + goto clean; + free(subst_str); + if ((subst_str = vector_str_substr(output, p_idx, + output->size - 1, &subst_str_len)) == NULL) + goto clean; + if (!vector_str_push(&v, subst_str, subst_str_len)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &v)) + goto clean; + } + + rtn = 1; + +clean: + if (subst_str) free(subst_str); + vector_str_dest(&v); + + return (rtn); +} + +static int +cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata) +{ + struct vector_str *output, v; + size_t limit, p_idx, subst_str_len; + int rtn; + char *subst_str; + + if (ddata == NULL || *ddata->cur != 'N') + return (0); + if (*(++ddata->cur) == '\0') + return (0); + + while (*ddata->cur == 'r' || *ddata->cur == 'V' || + *ddata->cur == 'K') { + switch (*ddata->cur) { + case 'r': + ddata->mem_rst = true; + break; + case 'V': + ddata->mem_vat = true; + break; + case 'K': + ddata->mem_cst = true; + break; + }; + ++ddata->cur; + } + + output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; + if (!vector_str_init(&v)) + return (0); + + rtn = 0; + limit = 0; + for (;;) { + p_idx = output->size; + switch (*ddata->cur) { + case 'I': + if (!cpp_demangle_read_tmpl_args(ddata)) + goto clean; + break; + case 'S': + if (!cpp_demangle_read_subst(ddata)) + goto clean; + break; + case 'T': + if (!cpp_demangle_read_tmpl_param(ddata)) + goto clean; + break; + default: + if (!cpp_demangle_read_uqname(ddata)) + goto clean; + }; + + if ((subst_str = vector_str_substr(output, p_idx, + output->size - 1, &subst_str_len)) == NULL) + goto clean; + if (!vector_str_push(&v, subst_str, subst_str_len)) { + free(subst_str); + goto clean; + } + free(subst_str); + + if (!cpp_demangle_push_subst_v(ddata, &v)) + goto clean; + if (*ddata->cur == 'E') + break; + else if (*ddata->cur != 'I' && + *ddata->cur != 'C' && *ddata->cur != 'D') { + if (!cpp_demangle_push_str(ddata, "::", 2)) + goto clean; + if (!vector_str_push(&v, "::", 2)) + goto clean; + } + if (limit++ > CPP_DEMANGLE_TRY_LIMIT) + goto clean; + } + + ++ddata->cur; + rtn = 1; + +clean: + vector_str_dest(&v); + + return (rtn); +} + +/* + * read number + * number ::= [n] + */ +static int +cpp_demangle_read_number(struct cpp_demangle_data *ddata, long *rtn) +{ + long len, negative_factor; + + if (ddata == NULL || rtn == NULL) + return (0); + + negative_factor = 1; + if (*ddata->cur == 'n') { + negative_factor = -1; + + ++ddata->cur; + } + if (ELFTC_ISDIGIT(*ddata->cur) == 0) + return (0); + + errno = 0; + if ((len = strtol(ddata->cur, (char **) NULL, 10)) == 0 && + errno != 0) + return (0); + + while (ELFTC_ISDIGIT(*ddata->cur) != 0) + ++ddata->cur; + + assert(len >= 0); + assert(negative_factor == 1 || negative_factor == -1); + + *rtn = len * negative_factor; + + return (1); +} + +static int +cpp_demangle_read_nv_offset(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL) + return (0); + + if (!cpp_demangle_push_str(ddata, "offset : ", 9)) + return (0); + + return (cpp_demangle_read_offset_number(ddata)); +} + +/* read offset, offset are nv-offset, v-offset */ +static int +cpp_demangle_read_offset(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL) + return (0); + + if (*ddata->cur == 'h') { + ++ddata->cur; + return (cpp_demangle_read_nv_offset(ddata)); + } else if (*ddata->cur == 'v') { + ++ddata->cur; + return (cpp_demangle_read_v_offset(ddata)); + } + + return (0); +} + +static int +cpp_demangle_read_offset_number(struct cpp_demangle_data *ddata) +{ + bool negative; + const char *start; + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + /* offset could be negative */ + if (*ddata->cur == 'n') { + negative = true; + start = ddata->cur + 1; + } else { + negative = false; + start = ddata->cur; + } + + while (*ddata->cur != '_') + ++ddata->cur; + + if (negative && !cpp_demangle_push_str(ddata, "-", 1)) + return (0); + + assert(start != NULL); + + if (!cpp_demangle_push_str(ddata, start, ddata->cur - start)) + return (0); + if (!cpp_demangle_push_str(ddata, " ", 1)) + return (0); + + ++ddata->cur; + + return (1); +} + +static int +cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *ddata) +{ + size_t class_type_len, i, idx, p_idx; + int p_func_type, rtn; + char *class_type; + + if (ddata == NULL || *ddata->cur != 'M' || *(++ddata->cur) == '\0') + return (0); + + p_idx = ddata->output.size; + if (!cpp_demangle_read_type(ddata, 0)) + return (0); + + if ((class_type = vector_str_substr(&ddata->output, p_idx, + ddata->output.size - 1, &class_type_len)) == NULL) + return (0); + + rtn = 0; + idx = ddata->output.size; + for (i = p_idx; i < idx; ++i) + if (!vector_str_pop(&ddata->output)) + goto clean1; + + if (!vector_read_cmd_push(&ddata->cmd, READ_PTRMEM)) + goto clean1; + + if (!vector_str_push(&ddata->class_type, class_type, class_type_len)) + goto clean2; + + p_func_type = ddata->func_type; + if (!cpp_demangle_read_type(ddata, 0)) + goto clean3; + + if (p_func_type == ddata->func_type) { + if (!cpp_demangle_push_str(ddata, " ", 1)) + goto clean3; + if (!cpp_demangle_push_str(ddata, class_type, class_type_len)) + goto clean3; + if (!cpp_demangle_push_str(ddata, "::*", 3)) + goto clean3; + } + + rtn = 1; +clean3: + if (!vector_str_pop(&ddata->class_type)) + rtn = 0; +clean2: + if (!vector_read_cmd_pop(&ddata->cmd)) + rtn = 0; +clean1: + free(class_type); + + return (rtn); +} + +/* read source-name, source-name is */ +static int +cpp_demangle_read_sname(struct cpp_demangle_data *ddata) +{ + long len; + + if (ddata == NULL || cpp_demangle_read_number(ddata, &len) == 0 || + len <= 0 || cpp_demangle_push_str(ddata, ddata->cur, len) == 0) + return (0); + + assert(ddata->output.size > 0); + if (vector_read_cmd_find(&ddata->cmd, READ_TMPL) == 0) + ddata->last_sname = + ddata->output.container[ddata->output.size - 1]; + + ddata->cur += len; + + return (1); +} + +static int +cpp_demangle_read_subst(struct cpp_demangle_data *ddata) +{ + long nth; + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + /* abbreviations of the form Sx */ + switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { + case SIMPLE_HASH('S', 'a'): + /* std::allocator */ + if (cpp_demangle_push_str(ddata, "std::allocator", 14) == 0) + return (0); + ddata->cur += 2; + if (*ddata->cur == 'I') + return (cpp_demangle_read_subst_stdtmpl(ddata, + "std::allocator", 14)); + return (1); + + case SIMPLE_HASH('S', 'b'): + /* std::basic_string */ + if (!cpp_demangle_push_str(ddata, "std::basic_string", 17)) + return (0); + ddata->cur += 2; + if (*ddata->cur == 'I') + return (cpp_demangle_read_subst_stdtmpl(ddata, + "std::basic_string", 17)); + return (1); + + case SIMPLE_HASH('S', 'd'): + /* std::basic_iostream > */ + if (!cpp_demangle_push_str(ddata, "std::iostream", 19)) + return (0); + ddata->last_sname = "iostream"; + ddata->cur += 2; + if (*ddata->cur == 'I') + return (cpp_demangle_read_subst_stdtmpl(ddata, + "std::iostream", 19)); + return (1); + + case SIMPLE_HASH('S', 'i'): + /* std::basic_istream > */ + if (!cpp_demangle_push_str(ddata, "std::istream", 18)) + return (0); + ddata->last_sname = "istream"; + ddata->cur += 2; + if (*ddata->cur == 'I') + return (cpp_demangle_read_subst_stdtmpl(ddata, + "std::istream", 18)); + return (1); + + case SIMPLE_HASH('S', 'o'): + /* std::basic_ostream > */ + if (!cpp_demangle_push_str(ddata, "std::ostream", 18)) + return (0); + ddata->last_sname = "istream"; + ddata->cur += 2; + if (*ddata->cur == 'I') + return (cpp_demangle_read_subst_stdtmpl(ddata, + "std::ostream", 18)); + return (1); + + case SIMPLE_HASH('S', 's'): + /* + * std::basic_string, + * std::allocator > + * + * a.k.a std::string + */ + if (!cpp_demangle_push_str(ddata, "std::string", 11)) + return (0); + ddata->last_sname = "string"; + ddata->cur += 2; + if (*ddata->cur == 'I') + return (cpp_demangle_read_subst_stdtmpl(ddata, + "std::string", 11)); + return (1); + + case SIMPLE_HASH('S', 't'): + /* std:: */ + return (cpp_demangle_read_subst_std(ddata)); + }; + + if (*(++ddata->cur) == '\0') + return (0); + + /* substitution */ + if (*ddata->cur == '_') + return (cpp_demangle_get_subst(ddata, 0)); + else { + errno = 0; + /* substitution number is base 36 */ + if ((nth = strtol(ddata->cur, (char **) NULL, 36)) == 0 && + errno != 0) + return (0); + + /* first was '_', so increase one */ + ++nth; + + while (*ddata->cur != '_') + ++ddata->cur; + + assert(nth > 0); + + return (cpp_demangle_get_subst(ddata, nth)); + } + + /* NOTREACHED */ + return (0); +} + +static int +cpp_demangle_read_subst_std(struct cpp_demangle_data *ddata) +{ + struct vector_str *output, v; + size_t p_idx, subst_str_len; + int rtn; + char *subst_str; + + if (ddata == NULL) + return (0); + + if (!vector_str_init(&v)) + return (0); + + subst_str = NULL; + rtn = 0; + if (!cpp_demangle_push_str(ddata, "std::", 5)) + goto clean; + + if (!vector_str_push(&v, "std::", 5)) + goto clean; + + ddata->cur += 2; + + output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; + + p_idx = output->size; + if (!cpp_demangle_read_uqname(ddata)) + goto clean; + + if ((subst_str = vector_str_substr(output, p_idx, output->size - 1, + &subst_str_len)) == NULL) + goto clean; + + if (!vector_str_push(&v, subst_str, subst_str_len)) + goto clean; + + if (!cpp_demangle_push_subst_v(ddata, &v)) + goto clean; + + if (*ddata->cur == 'I') { + p_idx = output->size; + if (!cpp_demangle_read_tmpl_args(ddata)) + goto clean; + free(subst_str); + if ((subst_str = vector_str_substr(output, p_idx, + output->size - 1, &subst_str_len)) == NULL) + goto clean; + if (!vector_str_push(&v, subst_str, subst_str_len)) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, &v)) + goto clean; + } + + rtn = 1; +clean: + if (subst_str) free(subst_str); + vector_str_dest(&v); + + return (rtn); +} + +static int +cpp_demangle_read_subst_stdtmpl(struct cpp_demangle_data *ddata, + const char *str, size_t len) +{ + struct vector_str *output; + size_t p_idx, substr_len; + int rtn; + char *subst_str, *substr; + + if (ddata == NULL || str == NULL || len == 0) + return (0); + + output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; + + p_idx = output->size; + substr = NULL; + subst_str = NULL; + + if (!cpp_demangle_read_tmpl_args(ddata)) + return (0); + if ((substr = vector_str_substr(output, p_idx, output->size - 1, + &substr_len)) == NULL) + return (0); + + rtn = 0; + if ((subst_str = malloc(sizeof(char) * (substr_len + len + 1))) == + NULL) + goto clean; + + memcpy(subst_str, str, len); + memcpy(subst_str + len, substr, substr_len); + subst_str[substr_len + len] = '\0'; + + if (!cpp_demangle_push_subst(ddata, subst_str, substr_len + len)) + goto clean; + + rtn = 1; +clean: + if (subst_str) free(subst_str); + free(substr); + + return (rtn); +} + +static int +cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + switch (*ddata->cur) { + case 'L': + return (cpp_demangle_read_expr_primary(ddata)); + case 'X': + return (cpp_demangle_read_expression(ddata)); + }; + + return (cpp_demangle_read_type(ddata, 0)); +} + +static int +cpp_demangle_read_tmpl_args(struct cpp_demangle_data *ddata) +{ + struct vector_str *v; + size_t arg_len, idx, limit, size; + char *arg; + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + ++ddata->cur; + + if (!vector_read_cmd_push(&ddata->cmd, READ_TMPL)) + return (0); + + if (!cpp_demangle_push_str(ddata, "<", 1)) + return (0); + + limit = 0; + v = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; + for (;;) { + idx = v->size; + if (!cpp_demangle_read_tmpl_arg(ddata)) + return (0); + if ((arg = vector_str_substr(v, idx, v->size - 1, &arg_len)) == + NULL) + return (0); + if (!vector_str_find(&ddata->tmpl, arg, arg_len) && + !vector_str_push(&ddata->tmpl, arg, arg_len)) { + free(arg); + return (0); + } + + free(arg); + + if (*ddata->cur == 'E') { + ++ddata->cur; + size = v->size; + assert(size > 0); + if (!strncmp(v->container[size - 1], ">", 1)) { + if (!cpp_demangle_push_str(ddata, " >", 2)) + return (0); + } else if (!cpp_demangle_push_str(ddata, ">", 1)) + return (0); + break; + } else if (*ddata->cur != 'I' && + !cpp_demangle_push_str(ddata, ", ", 2)) + return (0); + + if (limit++ > CPP_DEMANGLE_TRY_LIMIT) + return (0); + } + + return (vector_read_cmd_pop(&ddata->cmd)); +} + +/* + * Read template parameter that forms in 'T[number]_'. + * This function much like to read_subst but only for types. + */ +static int +cpp_demangle_read_tmpl_param(struct cpp_demangle_data *ddata) +{ + long nth; + + if (ddata == NULL || *ddata->cur != 'T') + return (0); + + ++ddata->cur; + + if (*ddata->cur == '_') + return (cpp_demangle_get_tmpl_param(ddata, 0)); + else { + + errno = 0; + if ((nth = strtol(ddata->cur, (char **) NULL, 36)) == 0 && + errno != 0) + return (0); + + /* T_ is first */ + ++nth; + + while (*ddata->cur != '_') + ++ddata->cur; + + assert(nth > 0); + + return (cpp_demangle_get_tmpl_param(ddata, nth)); + } + + /* NOTREACHED */ + return (0); +} + +static int +cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit) +{ + struct vector_type_qualifier v; + struct vector_str *output; + size_t p_idx, type_str_len; + int extern_c, is_builtin; + long len; + char *type_str; + + if (ddata == NULL) + return (0); + + output = &ddata->output; + if (ddata->output.size > 0 && !strncmp(ddata->output.container[ddata->output.size - 1], ">", 1)) { + ddata->push_head++; + output = &ddata->output_tmp; + } else if (delimit == 1) { + if (ddata->paren == false) { + if (!cpp_demangle_push_str(ddata, "(", 1)) + return (0); + if (ddata->output.size < 2) + return (0); + ddata->paren = true; + ddata->pfirst = true; + /* Need pop function name */ + if (ddata->subst.size == 1 && + !vector_str_pop(&ddata->subst)) + return (0); + } + + if (ddata->pfirst) + ddata->pfirst = false; + else if (*ddata->cur != 'I' && + !cpp_demangle_push_str(ddata, ", ", 2)) + return (0); + } + + assert(output != NULL); + /* + * [r, V, K] [P, R, C, G, U] builtin, function, class-enum, array + * pointer-to-member, template-param, template-template-param, subst + */ + + if (!vector_type_qualifier_init(&v)) + return (0); + + extern_c = 0; + is_builtin = 1; + p_idx = output->size; + type_str = NULL; +again: + /* builtin type */ + switch (*ddata->cur) { + case 'a': + /* signed char */ + if (!cpp_demangle_push_str(ddata, "signed char", 11)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'A': + /* array type */ + if (!cpp_demangle_read_array(ddata)) + goto clean; + is_builtin = 0; + goto rtn; + + case 'b': + /* bool */ + if (!cpp_demangle_push_str(ddata, "bool", 4)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'C': + /* complex pair */ + if (!vector_type_qualifier_push(&v, TYPE_CMX)) + goto clean; + ++ddata->cur; + goto again; + + case 'c': + /* char */ + if (!cpp_demangle_push_str(ddata, "char", 4)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'd': + /* double */ + if (!cpp_demangle_push_str(ddata, "double", 6)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'e': + /* long double */ + if (!cpp_demangle_push_str(ddata, "long double", 11)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'f': + /* float */ + if (!cpp_demangle_push_str(ddata, "float", 5)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'F': + /* function */ + if (!cpp_demangle_read_function(ddata, &extern_c, &v)) + goto clean; + is_builtin = 0; + goto rtn; + + case 'g': + /* __float128 */ + if (!cpp_demangle_push_str(ddata, "__float128", 10)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'G': + /* imaginary */ + if (!vector_type_qualifier_push(&v, TYPE_IMG)) + goto clean; + ++ddata->cur; + goto again; + + case 'h': + /* unsigned char */ + if (!cpp_demangle_push_str(ddata, "unsigned char", 13)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'i': + /* int */ + if (!cpp_demangle_push_str(ddata, "int", 3)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'j': + /* unsigned int */ + if (!cpp_demangle_push_str(ddata, "unsigned int", 12)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'K': + /* const */ + if (!vector_type_qualifier_push(&v, TYPE_CST)) + goto clean; + ++ddata->cur; + goto again; + + case 'l': + /* long */ + if (!cpp_demangle_push_str(ddata, "long", 4)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'm': + /* unsigned long */ + if (!cpp_demangle_push_str(ddata, "unsigned long", 13)) + goto clean; + + ++ddata->cur; + + goto rtn; + case 'M': + /* pointer to member */ + if (!cpp_demangle_read_pointer_to_member(ddata)) + goto clean; + is_builtin = 0; + goto rtn; + + case 'n': + /* __int128 */ + if (!cpp_demangle_push_str(ddata, "__int128", 8)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'o': + /* unsigned __int128 */ + if (!cpp_demangle_push_str(ddata, "unsigned _;int128", 17)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'P': + /* pointer */ + if (!vector_type_qualifier_push(&v, TYPE_PTR)) + goto clean; + ++ddata->cur; + goto again; + + case 'r': + /* restrict */ + if (!vector_type_qualifier_push(&v, TYPE_RST)) + goto clean; + ++ddata->cur; + goto again; + + case 'R': + /* reference */ + if (!vector_type_qualifier_push(&v, TYPE_REF)) + goto clean; + ++ddata->cur; + goto again; + + case 's': + /* short, local string */ + if (!cpp_demangle_push_str(ddata, "short", 5)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'S': + /* substitution */ + if (!cpp_demangle_read_subst(ddata)) + goto clean; + is_builtin = 0; + goto rtn; + + case 't': + /* unsigned short */ + if (!cpp_demangle_push_str(ddata, "unsigned short", 14)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'T': + /* template parameter */ + if (!cpp_demangle_read_tmpl_param(ddata)) + goto clean; + is_builtin = 0; + goto rtn; + + case 'u': + /* vendor extended builtin */ + ++ddata->cur; + if (!cpp_demangle_read_sname(ddata)) + goto clean; + is_builtin = 0; + goto rtn; + + case 'U': + /* vendor extended type qualifier */ + if (!cpp_demangle_read_number(ddata, &len)) + goto clean; + if (len <= 0) + goto clean; + if (!vector_str_push(&v.ext_name, ddata->cur, len)) + goto clean; + ddata->cur += len; + goto again; + + case 'v': + /* void */ + if (!cpp_demangle_push_str(ddata, "void", 4)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'V': + /* volatile */ + if (!vector_type_qualifier_push(&v, TYPE_VAT)) + goto clean; + ++ddata->cur; + goto again; + + case 'w': + /* wchar_t */ + if (!cpp_demangle_push_str(ddata, "wchar_t", 6)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'x': + /* long long */ + if (!cpp_demangle_push_str(ddata, "long long", 9)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'y': + /* unsigned long long */ + if (!cpp_demangle_push_str(ddata, "unsigned long long", 18)) + goto clean; + ++ddata->cur; + goto rtn; + + case 'z': + /* ellipsis */ + if (!cpp_demangle_push_str(ddata, "ellipsis", 8)) + goto clean; + ++ddata->cur; + goto rtn; + }; + + if (!cpp_demangle_read_name(ddata)) + goto clean; + + is_builtin = 0; +rtn: + if ((type_str = vector_str_substr(output, p_idx, output->size - 1, + &type_str_len)) == NULL) + goto clean; + + if (is_builtin == 0) { + if (!vector_str_find(&ddata->subst, type_str, type_str_len) && + !vector_str_push(&ddata->subst, type_str, type_str_len)) + goto clean; + } + + if (!cpp_demangle_push_type_qualifier(ddata, &v, type_str)) + goto clean; + + free(type_str); + vector_type_qualifier_dest(&v); + + if (ddata->push_head > 0) { + if (*ddata->cur == 'I' && cpp_demangle_read_tmpl_args(ddata) + == 0) + return (0); + + if (--ddata->push_head > 0) + return (1); + + if (!vector_str_push(&ddata->output_tmp, " ", 1)) + return (0); + + if (!vector_str_push_vector_head(&ddata->output, + &ddata->output_tmp)) + return (0); + + vector_str_dest(&ddata->output_tmp); + if (!vector_str_init(&ddata->output_tmp)) + return (0); + + if (!cpp_demangle_push_str(ddata, "(", 1)) + return (0); + + ddata->paren = true; + ddata->pfirst = true; + } + + return (1); +clean: + if (type_str) free(type_str); + vector_type_qualifier_dest(&v); + + return (0); +} + +/* + * read unqualified-name, unqualified name are operator-name, ctor-dtor-name, + * source-name + */ +static int +cpp_demangle_read_uqname(struct cpp_demangle_data *ddata) +{ + size_t len; + + if (ddata == NULL || *ddata->cur == '\0') + return (0); + + /* operator name */ + switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { + case SIMPLE_HASH('a', 'a'): + /* operator && */ + if (!cpp_demangle_push_str(ddata, "operator&&", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('a', 'd'): + /* operator & (unary) */ + if (!cpp_demangle_push_str(ddata, "operator&", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('a', 'n'): + /* operator & */ + if (!cpp_demangle_push_str(ddata, "operator&", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('a', 'N'): + /* operator &= */ + if (!cpp_demangle_push_str(ddata, "operator&=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('a', 'S'): + /* operator = */ + if (!cpp_demangle_push_str(ddata, "operator=", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('c', 'l'): + /* operator () */ + if (!cpp_demangle_push_str(ddata, "operator()", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('c', 'm'): + /* operator , */ + if (!cpp_demangle_push_str(ddata, "operator,", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('c', 'o'): + /* operator ~ */ + if (!cpp_demangle_push_str(ddata, "operator~", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('c', 'v'): + /* operator (cast) */ + if (!cpp_demangle_push_str(ddata, "operator(cast)", 14)) + return (0); + ddata->cur += 2; + return (cpp_demangle_read_type(ddata, 1)); + + case SIMPLE_HASH('d', 'a'): + /* operator delete [] */ + if (!cpp_demangle_push_str(ddata, "operator delete []", 18)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('d', 'e'): + /* operator * (unary) */ + if (!cpp_demangle_push_str(ddata, "operator*", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('d', 'l'): + /* operator delete */ + if (!cpp_demangle_push_str(ddata, "operator delete", 15)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('d', 'v'): + /* operator / */ + if (!cpp_demangle_push_str(ddata, "operator/", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('d', 'V'): + /* operator /= */ + if (!cpp_demangle_push_str(ddata, "operator/=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('e', 'o'): + /* operator ^ */ + if (!cpp_demangle_push_str(ddata, "operator^", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('e', 'O'): + /* operator ^= */ + if (!cpp_demangle_push_str(ddata, "operator^=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('e', 'q'): + /* operator == */ + if (!cpp_demangle_push_str(ddata, "operator==", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('g', 'e'): + /* operator >= */ + if (!cpp_demangle_push_str(ddata, "operator>=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('g', 't'): + /* operator > */ + if (!cpp_demangle_push_str(ddata, "operator>", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('i', 'x'): + /* operator [] */ + if (!cpp_demangle_push_str(ddata, "operator[]", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('l', 'e'): + /* operator <= */ + if (!cpp_demangle_push_str(ddata, "operator<=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('l', 's'): + /* operator << */ + if (!cpp_demangle_push_str(ddata, "operator<<", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('l', 'S'): + /* operator <<= */ + if (!cpp_demangle_push_str(ddata, "operator<<=", 11)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('l', 't'): + /* operator < */ + if (!cpp_demangle_push_str(ddata, "operator<", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('m', 'i'): + /* operator - */ + if (!cpp_demangle_push_str(ddata, "operator-", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('m', 'I'): + /* operator -= */ + if (!cpp_demangle_push_str(ddata, "operator-=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('m', 'l'): + /* operator * */ + if (!cpp_demangle_push_str(ddata, "operator*", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('m', 'L'): + /* operator *= */ + if (!cpp_demangle_push_str(ddata, "operator*=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('m', 'm'): + /* operator -- */ + if (!cpp_demangle_push_str(ddata, "operator--", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('n', 'a'): + /* operator new[] */ + if (!cpp_demangle_push_str(ddata, "operator new []", 15)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('n', 'e'): + /* operator != */ + if (!cpp_demangle_push_str(ddata, "operator!=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('n', 'g'): + /* operator - (unary) */ + if (!cpp_demangle_push_str(ddata, "operator-", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('n', 't'): + /* operator ! */ + if (!cpp_demangle_push_str(ddata, "operator!", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('n', 'w'): + /* operator new */ + if (!cpp_demangle_push_str(ddata, "operator new", 12)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('o', 'o'): + /* operator || */ + if (!cpp_demangle_push_str(ddata, "operator||", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('o', 'r'): + /* operator | */ + if (!cpp_demangle_push_str(ddata, "operator|", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('o', 'R'): + /* operator |= */ + if (!cpp_demangle_push_str(ddata, "operator|=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('p', 'l'): + /* operator + */ + if (!cpp_demangle_push_str(ddata, "operator+", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('p', 'L'): + /* operator += */ + if (!cpp_demangle_push_str(ddata, "operator+=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('p', 'm'): + /* operator ->* */ + if (!cpp_demangle_push_str(ddata, "operator->*", 11)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('p', 'p'): + /* operator ++ */ + if (!cpp_demangle_push_str(ddata, "operator++", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('p', 's'): + /* operator + (unary) */ + if (!cpp_demangle_push_str(ddata, "operator+", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('p', 't'): + /* operator -> */ + if (!cpp_demangle_push_str(ddata, "operator->", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('q', 'u'): + /* operator ? */ + if (!cpp_demangle_push_str(ddata, "operator?", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('r', 'm'): + /* operator % */ + if (!cpp_demangle_push_str(ddata, "operator%", 9)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('r', 'M'): + /* operator %= */ + if (!cpp_demangle_push_str(ddata, "operator%=", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('r', 's'): + /* operator >> */ + if (!cpp_demangle_push_str(ddata, "operator>>", 10)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('r', 'S'): + /* operator >>= */ + if (!cpp_demangle_push_str(ddata, "operator>>=", 11)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('r', 'z'): + /* operator sizeof */ + if (!cpp_demangle_push_str(ddata, "operator sizeof ", 16)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('s', 'r'): + /* scope resolution operator */ + if (!cpp_demangle_push_str(ddata, "scope resolution operator ", + 26)) + return (0); + ddata->cur += 2; + return (1); + + case SIMPLE_HASH('s', 'v'): + /* operator sizeof */ + if (!cpp_demangle_push_str(ddata, "operator sizeof ", 16)) + return (0); + ddata->cur += 2; + return (1); + }; + + /* vendor extened operator */ + if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) { + if (!cpp_demangle_push_str(ddata, "vendor extened operator ", + 24)) + return (0); + if (!cpp_demangle_push_str(ddata, ddata->cur + 1, 1)) + return (0); + ddata->cur += 2; + return (cpp_demangle_read_sname(ddata)); + } + + /* ctor-dtor-name */ + switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { + case SIMPLE_HASH('C', '1'): + /* FALLTHROUGH */ + case SIMPLE_HASH('C', '2'): + /* FALLTHROUGH */ + case SIMPLE_HASH('C', '3'): + if (ddata->last_sname == NULL) + return (0); + if ((len = strlen(ddata->last_sname)) == 0) + return (0); + if (!cpp_demangle_push_str(ddata, "::", 2)) + return (0); + if (!cpp_demangle_push_str(ddata, ddata->last_sname, len)) + return (0); + ddata->cur +=2; + return (1); + + case SIMPLE_HASH('D', '0'): + /* FALLTHROUGH */ + case SIMPLE_HASH('D', '1'): + /* FALLTHROUGH */ + case SIMPLE_HASH('D', '2'): + if (ddata->last_sname == NULL) + return (0); + if ((len = strlen(ddata->last_sname)) == 0) + return (0); + if (!cpp_demangle_push_str(ddata, "::~", 3)) + return (0); + if (!cpp_demangle_push_str(ddata, ddata->last_sname, len)) + return (0); + ddata->cur +=2; + return (1); + }; + + /* source name */ + if (ELFTC_ISDIGIT(*ddata->cur) != 0) + return (cpp_demangle_read_sname(ddata)); + + return (1); +} + +static int +cpp_demangle_read_v_offset(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL) + return (0); + + if (!cpp_demangle_push_str(ddata, "offset : ", 9)) + return (0); + + if (!cpp_demangle_read_offset_number(ddata)) + return (0); + + if (!cpp_demangle_push_str(ddata, "virtual offset : ", 17)) + return (0); + + return (!cpp_demangle_read_offset_number(ddata)); +} + +/* + * Decode floating point representation to string + * Return new allocated string or NULL + * + * Todo + * Replace these functions to macro. + */ +static char * +decode_fp_to_double(const char *p, size_t len) +{ + double f; + size_t rtn_len, limit, i; + int byte; + char *rtn; + + if (p == NULL || len == 0 || len % 2 != 0 || len / 2 > sizeof(double)) + return (NULL); + + memset(&f, 0, sizeof(double)); + + for (i = 0; i < len / 2; ++i) { + byte = hex_to_dec(p[len - i * 2 - 1]) + + hex_to_dec(p[len - i * 2 - 2]) * 16; + + if (byte < 0 || byte > 255) + return (NULL); + +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + ((unsigned char *)&f)[i] = (unsigned char)(byte); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + ((unsigned char *)&f)[sizeof(double) - i - 1] = + (unsigned char)(byte); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + } + + rtn_len = 64; + limit = 0; +again: + if ((rtn = malloc(sizeof(char) * rtn_len)) == NULL) + return (NULL); + + if (snprintf(rtn, rtn_len, "%fld", f) >= (int)rtn_len) { + free(rtn); + if (limit++ > FLOAT_SPRINTF_TRY_LIMIT) + return (NULL); + rtn_len *= BUFFER_GROWFACTOR; + goto again; + } + + return rtn; +} + +static char * +decode_fp_to_float(const char *p, size_t len) +{ + size_t i, rtn_len, limit; + float f; + int byte; + char *rtn; + + if (p == NULL || len == 0 || len % 2 != 0 || len / 2 > sizeof(float)) + return (NULL); + + memset(&f, 0, sizeof(float)); + + for (i = 0; i < len / 2; ++i) { + byte = hex_to_dec(p[len - i * 2 - 1]) + + hex_to_dec(p[len - i * 2 - 2]) * 16; + if (byte < 0 || byte > 255) + return (NULL); +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + ((unsigned char *)&f)[i] = (unsigned char)(byte); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + ((unsigned char *)&f)[sizeof(float) - i - 1] = + (unsigned char)(byte); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + } + + rtn_len = 64; + limit = 0; +again: + if ((rtn = malloc(sizeof(char) * rtn_len)) == NULL) + return (NULL); + + if (snprintf(rtn, rtn_len, "%ff", f) >= (int)rtn_len) { + free(rtn); + if (limit++ > FLOAT_SPRINTF_TRY_LIMIT) + return (NULL); + rtn_len *= BUFFER_GROWFACTOR; + goto again; + } + + return rtn; +} + +static char * +decode_fp_to_float128(const char *p, size_t len) +{ + long double f; + size_t rtn_len, limit, i; + int byte; + unsigned char buf[FLOAT_QUADRUPLE_BYTES]; + char *rtn; + + switch(sizeof(long double)) { + case FLOAT_QUADRUPLE_BYTES: + return (decode_fp_to_long_double(p, len)); + case FLOAT_EXTENED_BYTES: + if (p == NULL || len == 0 || len % 2 != 0 || + len / 2 > FLOAT_QUADRUPLE_BYTES) + return (NULL); + + memset(buf, 0, FLOAT_QUADRUPLE_BYTES); + + for (i = 0; i < len / 2; ++i) { + byte = hex_to_dec(p[len - i * 2 - 1]) + + hex_to_dec(p[len - i * 2 - 2]) * 16; + if (byte < 0 || byte > 255) + return (NULL); +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + buf[i] = (unsigned char)(byte); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + buf[FLOAT_QUADRUPLE_BYTES - i -1] = + (unsigned char)(byte); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + } + memset(&f, 0, FLOAT_EXTENED_BYTES); + +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + memcpy(&f, buf, FLOAT_EXTENED_BYTES); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + memcpy(&f, buf + 6, FLOAT_EXTENED_BYTES); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + + rtn_len = 256; + limit = 0; +again: + if ((rtn = malloc(sizeof(char) * rtn_len)) == NULL) + return (NULL); + + if (snprintf(rtn, rtn_len, "%Lfd", f) >= (int)rtn_len) { + free(rtn); + if (limit++ > FLOAT_SPRINTF_TRY_LIMIT) + return (NULL); + rtn_len *= BUFFER_GROWFACTOR; + goto again; + } + + return (rtn); + default: + return (NULL); + } +} + +static char * +decode_fp_to_float80(const char *p, size_t len) +{ + long double f; + size_t rtn_len, limit, i; + int byte; + unsigned char buf[FLOAT_EXTENED_BYTES]; + char *rtn; + + switch(sizeof(long double)) { + case FLOAT_QUADRUPLE_BYTES: + if (p == NULL || len == 0 || len % 2 != 0 || + len / 2 > FLOAT_EXTENED_BYTES) + return (NULL); + + memset(buf, 0, FLOAT_EXTENED_BYTES); + + for (i = 0; i < len / 2; ++i) { + byte = hex_to_dec(p[len - i * 2 - 1]) + + hex_to_dec(p[len - i * 2 - 2]) * 16; + + if (byte < 0 || byte > 255) + return (NULL); + +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + buf[i] = (unsigned char)(byte); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + buf[FLOAT_EXTENED_BYTES - i -1] = + (unsigned char)(byte); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + } + + memset(&f, 0, FLOAT_QUADRUPLE_BYTES); + +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + memcpy(&f, buf, FLOAT_EXTENED_BYTES); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + memcpy((unsigned char *)(&f) + 6, buf, FLOAT_EXTENED_BYTES); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + + rtn_len = 256; + limit = 0; +again: + if ((rtn = malloc(sizeof(char) * rtn_len)) == NULL) + return (NULL); + + if (snprintf(rtn, rtn_len, "%Lfd", f) >= (int)rtn_len) { + free(rtn); + if (limit++ > FLOAT_SPRINTF_TRY_LIMIT) + return (NULL); + rtn_len *= BUFFER_GROWFACTOR; + goto again; + } + + return (rtn); + case FLOAT_EXTENED_BYTES: + return (decode_fp_to_long_double(p, len)); + default: + return (NULL); + } +} + +static char * +decode_fp_to_long_double(const char *p, size_t len) +{ + long double f; + size_t rtn_len, limit, i; + int byte; + char *rtn; + + if (p == NULL || len == 0 || len % 2 != 0 || + len / 2 > sizeof(long double)) + return (NULL); + + memset(&f, 0, sizeof(long double)); + + for (i = 0; i < len / 2; ++i) { + byte = hex_to_dec(p[len - i * 2 - 1]) + + hex_to_dec(p[len - i * 2 - 2]) * 16; + + if (byte < 0 || byte > 255) + return (NULL); + +#if ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN + ((unsigned char *)&f)[i] = (unsigned char)(byte); +#else /* ELFTC_BYTE_ORDER != ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + ((unsigned char *)&f)[sizeof(long double) - i - 1] = + (unsigned char)(byte); +#endif /* ELFTC_BYTE_ORDER == ELFTC_BYTE_ORDER_LITTLE_ENDIAN */ + } + + rtn_len = 256; + limit = 0; +again: + if ((rtn = malloc(sizeof(char) * rtn_len)) == NULL) + return (NULL); + + if (snprintf(rtn, rtn_len, "%Lfd", f) >= (int)rtn_len) { + free(rtn); + if (limit++ > FLOAT_SPRINTF_TRY_LIMIT) + return (NULL); + rtn_len *= BUFFER_GROWFACTOR; + goto again; + } + + return (rtn); +} + +/* Simple hex to integer function used by decode_to_* function. */ +static int +hex_to_dec(char c) +{ + + switch (c) { + case '0': + return (0); + case '1': + return (1); + case '2': + return (2); + case '3': + return (3); + case '4': + return (4); + case '5': + return (5); + case '6': + return (6); + case '7': + return (7); + case '8': + return (8); + case '9': + return (9); + case 'a': + return (10); + case 'b': + return (11); + case 'c': + return (12); + case 'd': + return (13); + case 'e': + return (14); + case 'f': + return (15); + default: + return (-1); + }; +} + +static void +vector_read_cmd_dest(struct vector_read_cmd *v) +{ + + if (v == NULL) + return; + + free(v->r_container); +} + +/* return -1 at failed, 0 at not found, 1 at found. */ +static int +vector_read_cmd_find(struct vector_read_cmd *v, enum read_cmd dst) +{ + size_t i; + + if (v == NULL || dst == READ_FAIL) + return (-1); + + for (i = 0; i < v->size; ++i) + if (v->r_container[i] == dst) + return (1); + + return (0); +} + +static int +vector_read_cmd_init(struct vector_read_cmd *v) +{ + + if (v == NULL) + return (0); + + v->size = 0; + v->capacity = VECTOR_DEF_CAPACITY; + + if ((v->r_container = malloc(sizeof(enum read_cmd) * v->capacity)) + == NULL) + return (0); + + return (1); +} + +static int +vector_read_cmd_pop(struct vector_read_cmd *v) +{ + + if (v == NULL || v->size == 0) + return (0); + + --v->size; + v->r_container[v->size] = READ_FAIL; + + return (1); +} + +static int +vector_read_cmd_push(struct vector_read_cmd *v, enum read_cmd cmd) +{ + enum read_cmd *tmp_r_ctn; + size_t tmp_cap; + size_t i; + + if (v == NULL) + return (0); + + if (v->size == v->capacity) { + tmp_cap = v->capacity * BUFFER_GROWFACTOR; + if ((tmp_r_ctn = malloc(sizeof(enum read_cmd) * tmp_cap)) + == NULL) + return (0); + for (i = 0; i < v->size; ++i) + tmp_r_ctn[i] = v->r_container[i]; + free(v->r_container); + v->r_container = tmp_r_ctn; + v->capacity = tmp_cap; + } + + v->r_container[v->size] = cmd; + ++v->size; + + return (1); +} + +static void +vector_type_qualifier_dest(struct vector_type_qualifier *v) +{ + + if (v == NULL) + return; + + free(v->q_container); + vector_str_dest(&v->ext_name); +} + +/* size, capacity, ext_name */ +static int +vector_type_qualifier_init(struct vector_type_qualifier *v) +{ + + if (v == NULL) + return (0); + + v->size = 0; + v->capacity = VECTOR_DEF_CAPACITY; + + if ((v->q_container = malloc(sizeof(enum type_qualifier) * v->capacity)) + == NULL) + return (0); + + assert(v->q_container != NULL); + + if (vector_str_init(&v->ext_name) == false) { + free(v->q_container); + return (0); + } + + return (1); +} + +static int +vector_type_qualifier_push(struct vector_type_qualifier *v, + enum type_qualifier t) +{ + enum type_qualifier *tmp_ctn; + size_t tmp_cap; + size_t i; + + if (v == NULL) + return (0); + + if (v->size == v->capacity) { + tmp_cap = v->capacity * BUFFER_GROWFACTOR; + if ((tmp_ctn = malloc(sizeof(enum type_qualifier) * tmp_cap)) + == NULL) + return (0); + for (i = 0; i < v->size; ++i) + tmp_ctn[i] = v->q_container[i]; + free(v->q_container); + v->q_container = tmp_ctn; + v->capacity = tmp_cap; + } + + v->q_container[v->size] = t; + ++v->size; + + return (1); +} diff --git a/sdk/cpprt/linux/libunwind/AUTHORS b/sdk/cpprt/linux/libunwind/AUTHORS new file mode 100644 index 0000000000..719eee5c85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/AUTHORS @@ -0,0 +1 @@ +David Mosberger diff --git a/sdk/cpprt/linux/libunwind/COPYING b/sdk/cpprt/linux/libunwind/COPYING new file mode 100644 index 0000000000..41e7d8a6fd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/COPYING @@ -0,0 +1,20 @@ +Copyright (c) 2002 Hewlett-Packard Co. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sdk/cpprt/linux/libunwind/ChangeLog b/sdk/cpprt/linux/libunwind/ChangeLog new file mode 100644 index 0000000000..dfa24b957c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/ChangeLog @@ -0,0 +1,55 @@ +*********************************************************** + + Discontinued. See git log instead at + + http://www.kernel.org/git/gitweb.cgi?p=libs/libunwind/libunwind.git;a=log + +*********************************************************** + +2002-11-08 David Mosberger-Tang + + * src/ia64/unwind_i.h (ia64_getfp): Change from macro to inline + function. Check "loc" argument for being NULL before dereferencing it. + (ia64_putfp): Ditto. + (ia64_get): Ditto. + (ia64_put): Ditto. + +2002-01-18 David Mosberger-Tang + + * src/ia64/parser.c (__ia64_unw_create_state_record): Set + IA64_FLAG_HAS_HANDLER if the unwind info descriptors indicate that + there a handler. + + * src/ia64/regs.c (__ia64_access_reg): Return zero for UNW_REG_HANDLER + in frames that don't have a personality routine. + + * src/ia64/unwind_i.h (IA64_FLAG_HAS_HANDLER): New flag. + + * src/ia64/regs.c (__ia64_access_reg): When reading UNW_REG_HANDLER, + account for the fact that the personality address is gp-relative. + + * src/ia64/parser.c (__ia64_unw_create_state_record): Fix + initialization of segbase and len. + +2002-01-17 David Mosberger-Tang + + * include/unwind-ia64.h: Include via "unwind.h" to ensure + the file is picked up from same directory. + +2002-01-16 David Mosberger-Tang + + * include/unwind.h: Define UNW_ESTOPUNWIND. This error code may + be returned by acquire_unwind_info() to force termination of + unwinding. An application may want to do this when encountering a + call frame for dynamically generated code, for example. + + * unwind.h: Pass opaque argument pointer to acquire_unwind_info() + and release_unwind_info() like we do for access_mem() etc. + +2002-01-14 David Mosberger-Tang + + * Version 0.0 released. + +2002-01-11 David Mosberger-Tang + + * ChangeLog created. diff --git a/sdk/cpprt/linux/libunwind/LICENSE b/sdk/cpprt/linux/libunwind/LICENSE new file mode 100644 index 0000000000..c9b44cb8aa --- /dev/null +++ b/sdk/cpprt/linux/libunwind/LICENSE @@ -0,0 +1,18 @@ +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/sdk/cpprt/linux/libunwind/Makefile.am b/sdk/cpprt/linux/libunwind/Makefile.am new file mode 100644 index 0000000000..12f514ffdc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/Makefile.am @@ -0,0 +1,75 @@ +include_HEADERS = include/libunwind-dynamic.h \ + include/libunwind-ptrace.h \ + include/libunwind-coredump.h + +if ARCH_ARM +include_HEADERS += include/libunwind-arm.h +endif +if ARCH_IA64 +include_HEADERS += include/libunwind-ia64.h +endif +if ARCH_HPPA +include_HEADERS += include/libunwind-hppa.h +endif +if ARCH_MIPS +include_HEADERS += include/libunwind-mips.h +endif +if ARCH_X86 +include_HEADERS += include/libunwind-x86.h +endif +if ARCH_X86_64 +include_HEADERS += include/libunwind-x86_64.h +endif +if ARCH_PPC32 +include_HEADERS += include/libunwind-ppc32.h +endif +if ARCH_PPC64 +include_HEADERS += include/libunwind-ppc64.h +endif + +if !REMOTE_ONLY +include_HEADERS += include/libunwind.h include/unwind.h +endif + +nodist_include_HEADERS = include/libunwind-common.h + +SUBDIRS = src + +noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \ + include/libunwind_i.h include/mempool.h \ + include/remote.h \ + include/tdep-arm/dwarf-config.h \ + include/tdep-arm/jmpbuf.h include/tdep-arm/libunwind_i.h \ + include/tdep-ia64/jmpbuf.h include/tdep-ia64/rse.h \ + include/tdep-ia64/libunwind_i.h include/tdep-ia64/script.h \ + include/tdep-hppa/libunwind_i.h \ + include/tdep-hppa/jmpbuf.h include/tdep-hppa/dwarf-config.h \ + include/tdep-mips/libunwind_i.h \ + include/tdep-mips/jmpbuf.h include/tdep-mips/dwarf-config.h \ + include/tdep-x86/libunwind_i.h \ + include/tdep-x86/jmpbuf.h include/tdep-x86/dwarf-config.h \ + include/tdep-x86_64/libunwind_i.h \ + include/tdep-x86_64/jmpbuf.h include/tdep-x86_64/dwarf-config.h \ + include/tdep-ppc32/dwarf-config.h \ + include/tdep-ppc32/jmpbuf.h include/tdep-ppc32/libunwind_i.h \ + include/tdep-ppc64/dwarf-config.h \ + include/tdep-ppc64/jmpbuf.h include/tdep-ppc64/libunwind_i.h \ + include/tdep/libunwind_i.h \ + include/tdep/jmpbuf.h include/tdep/dwarf-config.h + +EXTRA_DIST = include/libunwind-common.h.in + +MAINTAINERCLEANFILES = \ + Makefile.in \ + INSTALL \ + aclocal.m4 \ + configure \ + config/compile \ + config/config.guess \ + config/config.sub \ + config/depcomp \ + config/install-sh \ + config/ltmain.sh \ + config/missing \ + include/config.h.in \ + include/config.h.in~ diff --git a/sdk/cpprt/linux/libunwind/NEWS b/sdk/cpprt/linux/libunwind/NEWS new file mode 100644 index 0000000000..2cf7184d2b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/NEWS @@ -0,0 +1,221 @@ +-*-Mode: outline-*- + +* News for v1.0: + +** Fast unwind (rbp, rsp, rip only) on x86_64 with a fallback to + slow code path (Lassi Tuura) +** Improved local and remote unwinding on ARM (Ken Werner) +** Testing, stability and many fixes on x86 (Paul Pluzhnikov) +** FreeBSD port and clean separation of OS specific bits + (Konstantin Belousov) +** Thanks for all the bug reports, contributions and testing! + +* News for v0.99: + +** Greatly improved x86-64 support thanks to Arun Sharma. +** Support for PPC64 added by Jose Flavio Aguilar Paulino. + +* News for v0.98.6: + +** Fix address-leak triggered by invalid byte-order. Fixed by Andreas Schwab. +** On ia64, get_static_proc_name() no longer uses a weak reference to + _Uelf64_get_proc_name(), since that was causing problems with archive + libraries and no longer served any apparent purpose. Fixed by + Curt Wohlgemuth. + +* News for v0.98.5: + +** Fix a typo in the man-page of unw_create_addr_space(). +** Fix an off-by-1 bug in the handling of the dynamic ALIAS directive + for ia64. Reported by Todd L. Miller. +** Fix a bug in libunwind-ptrace which could cause crash due to extraneous + munmap() calls. + +* News for v0.98.4: + +** Fix a typo in _ReadSLEB.c which caused hangs when throwing exceptions + from Intel ICC-compiled programs. Reported by Tommy Hoffner. + +* News for v0.98.3: + +** Make it possible to link against libunwind-ia64.a only (i.e., without + requiring libunwind.a as well). This keeps apps which need only + remote unwinding cleaner, since they logically have no dependency + on libunwind.a. +** Dont link against libatomic_ops for now. Due to a packaging bug on + Debian, linking against this library causes libunwind.so to get + a dependency on libatomic_ops.so, which is not at all what we want. + Fortunately, we don't have to link against that library on x86 or + ia64 since the library is strictly needed only for platforms with + poor atomic operation support. Once the libatomic_ops package is fixed, + we can re-enable linking against libatomic_ops. + +* News for v0.98.2: + +** Fixed bug which caused _UPT_get_dyn_info_list_addr() to sometimes fail + needlessly. Found by Todd L. Miller. + +** When using GCC to build libunwind on ia64, libunwind.so had an + unresolved reference to __divdi3. This is undesirable since it + creates an implicit dependency on libgcc. This problem has been + fixed in the 0.98.2 release by explicitly linking against libgcc.a + when building libunwind. + +* News for v0.98.1: + +** Fixed a bug which caused "make install" to install libunwind-common.h.in + instead of libunwind-common.h. +** Fixed a bug in the ia64 {sig,}longjmp() which showed on + SuSE Linux 9 because it's using a newer compiler & the EPC-based system + call stubs. +** Fixed incorrect offsets in tests/ia64-test-nat-asm.S. + Warning: you'll need a GNU assembler dated later than 21-Sep-2004 to + get this file translated correctly. With an old assembler, "make check" + will get lots of failures when running Gia64-test-nat or Lia64-test-nat! +** Convert tests/bt into a full-blown test-case. It's designed to + trigger a (rarely-encountered) bug in the GNU assembler on ia64. + The assembler has been fixed and once the libraries (libc etc) + have been rebuilt, this test will pass. +** Added test-case tests/run-ptrace-misc which, on ia64, triggers a bug in + current GCC (including v3.4.2) which causes bad unwind info. + +* News for v0.98: + +** Update libunwind to be compliant with the updated/expanded + ia64 unwind specificiation by HJ Lu [1]. This is needed for + GCC 3.4 compatibility. + + [1] http://www.kernel.org/pub/linux/devel/gcc/unwind/ + +** Initial support for x86-64 has been added courtesy of Max Asbock. + Along with this came a bunch of DWARF2 unwinder fixes. + +** A new rountine unw_strerror() has been added courtesy of + Thomas Hallgren. + +** Including now defines 4 macros that can be used + to determine the version number of libunwind. Specifically, + UNW_VERSION_MAJOR, UNW_VERSION_MINOR, UNW_VERSION, and + UNW_VERSION_CODE are defined by the header now. + +** Bug fixes +*** Fix a memory-leak in _UPT_get_dyn_info_list_addr() courtesy of Ed Connell. +*** Fix a crash in libunwind-ptrace courtesy of Mark Young. +*** Fix a bug in ia64-version of unw_init_remote() which prevented + it from working correctly for the local address space. Reported by + Troy Heber. +*** Many other small and not so small fixes. + +* News for v0.97: + +** unw_get_proc_name() may now be called from signal-handler. + +** The ptrace-helper routines are now declared in libunwind-ptrace.h. + Applications which use ptrace-based unwinding should include + to get the _UPT_*() routines declared. + +** libunwind has been split into a "local-only" and a "generic" versions. + The former is optimized for local unwinding (within a process) and + is called libunwind.so (shared version) or libunwind.a (archive + version). The generic version is not limited to unwinding within a + process and is called libunwind-generic.so (shared version) + libunwind-generic.a (archive version). Similarly, the ptrace() + support has been separated out into a convenience library called + libunwind-ptrace.a. For the most part, backwards-compatibility + is retained. However, when building an application which uses + libunwind, it may be necessary to change the linker command-line + as shown in the table below: + + Application which does: Before v0.97: With v0.97: + ----------------------- ------------- ----------- + local unwinding only: -lunwind -lunwind + remote unwinding: -lunwind -lunwind-generic + cross unwinding: -lunwind-PLAT -lunwind-PLAT + ptrace-based unwinding: -lunwind -lunwind-ptrace -lunwind-generic + + The motivation for this splitting is to keep libunwind.so as minimal + as possible. This library will eventually be loaded by most (if not + all) executables and hence it is important to ensure that it can + be loaded as quickly as possible. + +** unw_getcontext() tuned on IA-64. + + The unw_getcontext() routine used to be provided by (GNU) libc + (getcontext()). This caused unnecessary overhead (e.g., an + unnecessary system-call to sigprocmask()). The new + unw_getcontext() only does the work really needed for libunwind and + hence performs much better. However, this change implies that + programs linked against libunwind v0.97 won't be + backwards-compatible with earlier versions (there would be an + unresolved symbol for _Uia64_getcontext()). + +** Fix NaT-bit handling on IA-64. + + New test-cases have been added to test the handling of the NaT bit + (and floating-point NaT values) and all discovered/known bugs have + been fixed. + +** Initial DWARF-based unwinder for x86. + + There is a beginning for a DWARF-based unwinder for x86. Work for + x86-64-support based on this DWARF unwinder is currently underway + at IBM and it is expected that this support will be merged into the + official tree soon. + + +* News for v0.96: + +** _Unwind_*() routines defined by the C++ ABI are now included in + libunwind. + + +* News for v0.95: + +** Bigger, better, faster, or so the theory goes. + + +* News for v0.93: + +** More bug-fixes & improved HP-UX support. + + +* News for v0.92: + +** Bug-fix release. IA-64 unwinder can now be built with Intel compiler (ECC). + + +* News for v0.91: + +** Lots of documentation updates +** Some portability fixes. + + +* News for v0.9: + +** The libunwind API is mostly feature-complete at this point (hence the + version jump from v0.2 to v0.9). + + +* News for v0.2: + +** Automated configuration/build with autoconf and automake. +** Added support for building libunwind as a shared library. +** Added support for remote unwinding. +** Added support for cross-building. +** Added two new routines to the API: + - unw_is_fpreg() + - unw_get_save_loc() +** Added multi-architecture supports (lets a single application use + the unwind libraries for multiple target architectures; this is useful, + e.g., useful for building a debugger that can support multiple targets + such as x86, ia64, etc.) + + +* News for v0.1: + +** Added support for exception handling. + + +* News for v0.0: + +** It's a brand new package. diff --git a/sdk/cpprt/linux/libunwind/README b/sdk/cpprt/linux/libunwind/README new file mode 100644 index 0000000000..9f03a1830c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/README @@ -0,0 +1,212 @@ +-*- mode: Outline -*- + +This is version 1.0 of the unwind library. This library supports +several architecture/operating-system combinations: + + Linux/x86-64: Works well. + Linux/x86: Works well. + Linux/ARM: Works well. + Linux/IA-64: Fully tested and supported. + Linux/PARISC: Works well, but C library missing unwind-info. + HP-UX/IA-64: Mostly works but known to have some serious limitations. + Linux/PPC64: Newly added. + FreeBSD/i386: Newly added. + FreeBSD/x86-64: Newly added (FreeBSD architecture is known as amd64). + + +* General Build Instructions + +In general, this library can be built and installed with the following +commands: + + $ autoreconf -i # Needed only for building from git. Depends on libtool. + $ ./configure + $ make + $ make install prefix=PREFIX + +where PREFIX is the installation prefix. By default, a prefix of +/usr/local is used, such that libunwind.a is installed in +/usr/local/lib and unwind.h is installed in /usr/local/include. For +testing, you may want to use a prefix of /usr/local instead. + + +* Building with Intel compiler + +** Version 8 and later + +Starting with version 8, the preferred name for the IA-64 Intel +compiler is "icc" (same name as on x86). Thus, the configure-line +should look like this: + + $ ./configure CC=icc CFLAGS="-g -O3 -ip" CXX=icc CCAS=gcc CCASFLAGS=-g \ + LDFLAGS="-L$PWD/src/.libs" + + +* Building on HP-UX + +For the time being, libunwind must be built with GCC on HP-UX. + +libunwind should be configured and installed on HP-UX like this: + + $ ./configure CFLAGS="-g -O2 -mlp64" CXXFLAGS="-g -O2 -mlp64" + +Caveat: Unwinding of 32-bit (ILP32) binaries is not supported + at the moment. + +** Workaround for older versions of GCC + +GCC v3.0 and GCC v3.2 ship with a bad version of sys/types.h. The +workaround is to issue the following commands before running +"configure": + + $ mkdir $top_dir/include/sys + $ cp /usr/include/sys/types.h $top_dir/include/sys + +GCC v3.3.2 or later have been fixed and do not require this +workaround. + +* Building for PowerPC64 / Linux + +For building for power64 you should use: + + $ ./configure CFLAGS="-g -O2 -m64" CXXFLAGS="-g -O2 -m64" + +If your power support altivec registers: + $ ./configure CFLAGS="-g -O2 -m64 -maltivec" CXXFLAGS="-g -O2 -m64 -maltivec" + +To check if your processor has support for vector registers (altivec): + cat /proc/cpuinfo | grep altivec +and should have something like this: + cpu : PPC970, altivec supported + +If libunwind seems to not work (backtracing failing), try to compile +it with -O0, without optimizations. There are some compiler problems +depending on the version of your gcc. + +* Building on FreeBSD + +General building instructions apply. To build and execute several tests, +you need libexecinfo library available in ports as devel/libexecinfo. + +Development of the port was done of FreeBSD 8.0-STABLE. The library +was build with the system compiler that is modified version of gcc 4.2.1, +as well as the gcc 4.4.3. + +* Regression Testing + +After building the library, you can run a set of regression tests with: + + $ make check + +** Expected results on IA-64 Linux + +Unless you have a very recent C library and compiler installed, it is +currently expected to have the following tests fail on IA-64 Linux: + + Gtest-init (should pass starting with glibc-2.3.x/gcc-3.4) + Ltest-init (should pass starting with glibc-2.3.x/gcc-3.4) + test-ptrace (should pass starting with glibc-2.3.x/gcc-3.4) + run-ia64-test-dyn1 (should pass starting with glibc-2.3.x) + +This does not mean that libunwind cannot be used with older compilers +or C libraries, it just means that for certain corner cases, unwinding +will fail. Since they're corner cases, it is not likely for +applications to trigger them. + +Note: If you get lots of errors in Gia64-test-nat and Lia64-test-nat, it's + almost certainly a sign of an old assembler. The GNU assembler used + to encode previous-stack-pointer-relative offsets incorrectly. + This bug was fixed on 21-Sep-2004 so any later assembler will be + fine. + +** Expected results on x86 Linux + +The following tests are expected to fail on x86 Linux: + + Gtest-resume-sig (fails to get SIGUSR2) + Ltest-resume-sig (likewise) + Gtest-dyn1 (no dynamic unwind info support yet) + Ltest-dyn1 (no dynamic unwind info support yet) + test-setjmp (longjmp() not implemented yet) + run-check-namespace (no _Ux86_getcontext yet) + test-ptrace + +** Expected results on x86-64 Linux + +The following tests are expected to fail on x86-64 Linux: + + Gtest-dyn1 (no dynamic unwind info support yet) + Ltest-dyn1 (no dynamic unwind info support yet) + Gtest-init (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18743) + Ltest-init (likewise) + test-async-sig (crashes due to bad unwind-info?) + test-setjmp (longjmp() not implemented yet) + run-check-namespace (no _Ux86_64_getcontext yet) + run-ptrace-mapper (??? investigate) + run-ptrace-misc (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18748 + and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18749) + +** Expected results on PARISC Linux + +Caveat: GCC v3.4 or newer is needed on PA-RISC Linux. Earlier +versions of the compiler failed to generate the exception-handling +program header (GNU_EH_FRAME) needed for unwinding. + +The following tests are expected to fail on x86-64 Linux: + + Gtest-bt (backtrace truncated at kill() due to lack of unwind-info) + Ltest-bt (likewise) + Gtest-resume-sig (Gresume.c:my_rt_sigreturn() is wrong somehow) + Ltest-resume-sig (likewise) + Gtest-init (likewise) + Ltest-init (likewise) + Gtest-dyn1 (no dynamic unwind info support yet) + Ltest-dyn1 (no dynamic unwind info support yet) + test-setjmp (longjmp() not implemented yet) + run-check-namespace (toolchain doesn't support HIDDEN yet) + +** Expected results on HP-UX + +"make check" is currently unsupported for HP-UX. You can try to run +it, but most tests will fail (and some may fail to terminate). The +only test programs that are known to work at this time are: + + tests/bt + tests/Gperf-simple + tests/test-proc-info + tests/test-static-link + tests/Gtest-init + tests/Ltest-init + tests/Gtest-resume-sig + tests/Ltest-resume-sig + +** Expected results on PPC64 Linux + +"make check" should run with no more than 10 out of 24 tests failed. + + +* Performance Testing + +This distribution includes a few simple performance tests which give +some idea of the basic cost of various libunwind operations. After +building the library, you can run these tests with the following +commands: + + $ cd tests + $ make perf + +* Contacting the Developers + +Please direct all questions regarding this library to: + + libunwind-devel@nongnu.org + +You can do this by sending a mail to libunwind-request@nongnu.org with +a body of: + + subscribe libunwind-devel + +or you can subscribe and manage your subscription via the +web-interface at: + + https://savannah.nongnu.org/mail/?group=libunwind diff --git a/sdk/cpprt/linux/libunwind/TODO b/sdk/cpprt/linux/libunwind/TODO new file mode 100644 index 0000000000..8b2e0262b0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/TODO @@ -0,0 +1,97 @@ +- Update the libunwind man page for the new/fixed cache-flushing behavior. + Effectively, that unw_flush_cache() doesn't have to be called by + applications except for extraordinary circumstances (e.g., if application + implements its own runtime loader). +- document split local-only/generic libraries and separate libunwind-ptrace.a + convenience-library +- document new "tdep" member in unw_proc_info_t structure +- for DWARF 2, use a dummy CIE entry with an augmentation that + provides the dyn-info-list-address + +=== taken care of: + +Testing: + + ensure that saving r4-r7 in a stacked register properly preserves + the NaT bit, even in the face of register-rotation + + ensure that IA64_INSN_MOVE_STACKED works correctly in the face of + register rotation + + on Linux, test access to f32-f127 in a signal handler (e.g., verify + that fph partition gets initialized properly) ++ According to Nicholas S. Wourms , adding this to the + Makefile.am: + AUTOMAKE_OPTIONS = 1.6 subdir-objects + ensures that object-files are build in separate subdirectories and that + in turn makes it possible for source files in different directories to + have the same filename, thus avoiding the need for those ugly -x86, -ia64, + etc., postfixes. ++ Switch ia64 (and rest over) to using Debug() instead of debug() ++ implement non-local versions of dwarf_readXX() ++ consolidate mostly architecture-independent code such as + unw_get_accessors() into shared files ++ caching is pretty fundamentally broken, what should happen is this: + o On unw_init_local()/unw_init_remote(), libunwind should validate + that the cached information is still valid and, if not, flush the + cache on its own. Rationale: once unw_init_local() has been + called, it is clear that the unwind info for the calling thread + cannot change (otherwise the program would be buggy anyhow) and + hence it is sufficient to validate the cache at this point. + Similarly, once unw_init_remote() has been called, the target + address space must have been stopped, because the unwinding would + otherwise be unreliable anyhow. + o glibc currently lacks a feature for dl_iterate_phdr() to support + safe caching; I proposed on 12/16/2003 that glibc maintain two + atomic counters which get inremented whenever something is added + to/removed from the dl_iterate_phdr-list. Once we have such counters, + we can use them in libunwind to implement an efficient version of a + cache-validation routine. + Once this has been fixed, update the libunwind man page accordingly. + Effectively, what this means is that unw_flush_cache() doesn't have + to be called by applications except for extraordinary circumstances + (e.g., if application implements its own runtime loader). ++ man-page for unw_is_fpreg() ++ man-page for _U_dyn_cancel() ++ man-page for _U_dyn_register() ++ global data is not protected by a lock; causes problems if two threads + call ia64_init() at almost the same time ++ cache the value of *cfm_loc; each rotate_FOO() call needs it! ++ implement the remote-lookup of the dynamic registration list ++ when doing sigreturn, must restore fp regs (and perhaps other regs) the same + way as the (user-level) gate.S sigreturn path does! ++ unw_resume() must at least restore gp (r1)! consider restoring all + scratch regs (but what's the performance impact on exception handling?); + alternative: restore scratch regs that may be used during procedure + call/return (e.g., r8-r11, f8-f11) ++ implement unw_resume() for the case where the current register frame is split + across multiple backing stores ++ document restricions on using unw_resume(): ++ implement remote cases of unw_resume() ++ test both with UNW_LOCAL_ONLY and without where this makes sense ++ allow region-length (insn_count) in unw_dyn_region_info_t to be negative + to indicate counting from the end of the procedure (to make it possible + for differently-sized procedures to share the same region list if they + share the same prologue/epilogue). ++ it appears that it is currently not possible to read register UNW_IA64_TP; + fix that => no, attempts to access r13 will result in access_reg() callbacks, + as desired; for local-case, access to r13 will fail though (since + getcontext() doesn't, and shouldn't, capture r13) ++ document the special nature of UNW_IA64_GP: read-only, but adjusted + automatically if the IP is changed ++ use pthread-mutexes where necessary, atomic ops where possible ++ man-page for unw_init_local() ++ man-page for unw_init_remote() ++ man-page for unw_create_addr_space() ++ man-page for unw_destroy_addr_space() ++ man-page for unw_get_proc_info() ++ man-page for unw_get_proc_name() ++ man-page for unw_get_accessors() ++ man-page for unw_regname() ++ man-page for unw_flush_cache() ++ man-page for unw_set_caching_policy() ++ man-page for unw_getcontext() ++ man-page for unw_is_signal_frame() ++ man-page for unw_step() ++ man-page for unw_get_reg() ++ man-page for unw_set_reg() ++ man-page for unw_get_fpreg() ++ man-page for unw_set_fpreg() ++ test with Intel compiler diff --git a/sdk/cpprt/linux/libunwind/acinclude.m4 b/sdk/cpprt/linux/libunwind/acinclude.m4 new file mode 100644 index 0000000000..497f7c2f21 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/acinclude.m4 @@ -0,0 +1,32 @@ +AC_DEFUN([LIBUNWIND___THREAD], +[dnl Check whether the compiler supports the __thread keyword. +if test "x$enable___thread" != xno; then + AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread, + [cat > conftest.c <<\EOF + __thread int a = 42; +EOF + if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then + libc_cv_gcc___thread=yes + else + libc_cv_gcc___thread=no + fi + rm -f conftest*]) + if test "$libc_cv_gcc___thread" = yes; then + AC_DEFINE(HAVE___THREAD, 1, + [Define to 1 if __thread keyword is supported by the C compiler.]) + fi +else + libc_cv_gcc___thread=no +fi]) + +AC_DEFUN([CHECK_ATOMIC_OPS], +[dnl Check whether the system has the atomic_ops package installed. + AC_CHECK_HEADERS(atomic_ops.h) +# +# Don't link against libatomic_ops for now. We don't want libunwind +# to depend on libatomic_ops.so. Fortunately, none of the platforms +# we care about so far need libatomic_ops.a (everything is done via +# inline macros). +# +# AC_CHECK_LIB(atomic_ops, main) +]) diff --git a/sdk/cpprt/linux/libunwind/autogen-linux.sh b/sdk/cpprt/linux/libunwind/autogen-linux.sh new file mode 100755 index 0000000000..b1bbdc1a9c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/autogen-linux.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +set -x + +srcdir=`dirname $0` +[ -z "$srcdir" ] && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit $? +cd $ORIGDIR || exit $? + +CFLAGS="$CFLAGS -std=c99 -fno-builtin -DHAVE_SGX=1 -fPIC -DUNW_LOCAL_ONLY" + +# Remove duplicated compiler options and filter out `-nostdinc' +CFLAGS=`echo $CFLAGS | tr ' ' '\n' | sort | uniq | grep -v nostdinc | tr '\n' ' '` + +HOST_OPT= +if echo $CFLAGS | grep -q -- '-m32'; then + HOST_OPT='--host=i386-linux-gnu' +fi + +# Workaround for icc +# +# If we are running icc on Debian-like system, add +# /usr/include/$(dpkg-architecture -qDEB_BUILD_MULTIARCH) +# to the header search path. +if [ -f /usr/bin/dpkg ]; then + if [ x$CC != x"" ]; then + if $CC -E -dM -xc /dev/null | grep -q __INTEL_COMPILER; then + INCVAR=$(dpkg-architecture -qDEB_BUILD_MULTIARCH) + CFLAGS="$CFLAGS -I/usr/include/$INCVAR" + fi + fi +fi + +export CFLAGS +$srcdir/configure $HOST_OPT --enable-shared=no \ + --disable-block-signals \ + --enable-debug=no \ + --enable-debug-frame=no \ + --enable-cxx-exceptions \ + "$@" diff --git a/sdk/cpprt/linux/libunwind/configure.in b/sdk/cpprt/linux/libunwind/configure.in new file mode 100644 index 0000000000..c25deb1f5f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/configure.in @@ -0,0 +1,308 @@ +define(pkg_major, 1) +define(pkg_minor, 0) +define(pkg_extra, ) +define(pkg_maintainer, libunwind-devel@nongnu.org) +define(mkvers, $1.$2$3) +dnl Process this file with autoconf to produce a configure script. +AC_INIT(libunwind, mkvers(pkg_major, pkg_minor, pkg_extra), pkg_maintainer) +AC_CONFIG_SRCDIR(src/mi/backtrace.c) +AC_CONFIG_AUX_DIR(config) +AC_CANONICAL_SYSTEM +AM_INIT_AUTOMAKE([1.6 subdir-objects]) +AM_MAINTAINER_MODE +AM_CONFIG_HEADER(include/config.h) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AM_PROG_LIBTOOL +AM_PROG_AS +AM_PROG_CC_C_O + +dnl Checks for libraries. +AC_CHECK_LIB(uca, __uc_get_grs) +OLD_LIBS=${LIBS} +AC_SEARCH_LIBS(dlopen, dl) +LIBS=${OLD_LIBS} +case "$ac_cv_search_dlopen" in + -l*) DLLIB=$ac_cv_search_dlopen;; + *) DLLIB="";; +esac + +CHECK_ATOMIC_OPS + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(asm/ptrace_offsets.h endian.h sys/endian.h execinfo.h \ + ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \ + sys/procfs.h sys/ptrace.h byteswap.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T +AC_CHECK_SIZEOF(off_t) + +CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" + +AC_CHECK_MEMBERS([struct dl_phdr_info.dlpi_subs],,,[#include ]) +AC_CHECK_TYPES([sighandler_t], [], [], +[$ac_includes_default +#if HAVE_SIGNAL_H +# include +#endif +]) +AC_CHECK_TYPES([struct elf_prstatus, struct prstatus], [], [], +[$ac_includes_default +#if HAVE_SYS_PROCFS_H +# include +#endif +]) + +AC_CHECK_DECLS([PTRACE_POKEUSER, PTRACE_POKEDATA, +PTRACE_TRACEME, PTRACE_CONT, PTRACE_SINGLESTEP, +PTRACE_SYSCALL, PT_IO, PT_GETREGS, +PT_GETFPREGS, PT_CONTINUE, PT_TRACE_ME, +PT_STEP, PT_SYSCALL], [], [], +[$ac_includes_default +#if HAVE_SYS_TYPES_H +#include +#endif +#include +]) + +dnl Checks for library functions. +AC_FUNC_MEMCMP +AC_TYPE_SIGNAL +AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \ + ttrace mincore) +is_gcc_m64() { + if test `echo $CFLAGS | grep "\-m64" -c` -eq 1 ; then echo ppc64; + else + if test `echo $CC | grep "\-m64" -c` -eq 1 ; then echo ppc64; else echo ppc32; fi; + fi; +} + +is_gcc_altivec() { + if test `echo $CFLAGS | grep "\-maltivec" -c` -eq 1 ; then echo has_altivec; + else + if test `echo $CC | grep "\-maltivec" -c` -eq 1 ; then echo has_altivec; else echo no_altivec; fi; + fi; +} + +AC_MSG_CHECKING([if building with AltiVec]) +use_altivec=`is_gcc_altivec` +AM_CONDITIONAL(USE_ALTIVEC, test x$use_altivec = xhas_altivec) +if test x$use_altivec = xhas_altivec; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +get_arch() { + case "$1" in + arm*) echo arm;; + i?86) echo x86;; + hppa*) echo hppa;; + mips*) echo mips;; + powerpc*) is_gcc_m64;; + amd64) echo x86_64;; + *) echo $1;; + esac +} + +build_arch=`get_arch $build_cpu` +host_arch=`get_arch $host_cpu` +target_arch=`get_arch $target_cpu` + +AC_MSG_CHECKING([for build architecture]) +AC_MSG_RESULT([$build_arch]) +AC_MSG_CHECKING([for host architecture]) +AC_MSG_RESULT([$host_arch]) +AC_MSG_CHECKING([for target architecture]) +AC_MSG_RESULT([$target_arch]) +AC_MSG_CHECKING([for target operating system]) +AC_MSG_RESULT([$target_os]) + +AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch) +AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm) +AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64) +AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa) +AM_CONDITIONAL(ARCH_MIPS, test x$target_arch = xmips) +AM_CONDITIONAL(ARCH_X86, test x$target_arch = xx86) +AM_CONDITIONAL(ARCH_X86_64, test x$target_arch = xx86_64) +AM_CONDITIONAL(ARCH_PPC32, test x$target_arch = xppc32) +AM_CONDITIONAL(ARCH_PPC64, test x$target_arch = xppc64) +AM_CONDITIONAL(OS_LINUX, expr x$target_os : xlinux >/dev/null) +AM_CONDITIONAL(OS_HPUX, expr x$target_os : xhpux >/dev/null) +AM_CONDITIONAL(OS_FREEBSD, expr x$target_os : xfreebsd >/dev/null) + +AC_MSG_CHECKING([for ELF helper width]) +case "${target_arch}" in +(arm|hppa|ppc32|x86) use_elf32=yes; AC_MSG_RESULT([32]);; +(ia64|ppc64|x86_64) use_elf64=yes; AC_MSG_RESULT([64]);; +(mips) use_elfxx=yes; AC_MSG_RESULT([xx]);; +*) AC_MSG_ERROR([Unknown ELF target: ${target_arch}]) +esac +AM_CONDITIONAL(USE_ELF32, [test x$use_elf32 = xyes]) +AM_CONDITIONAL(USE_ELF64, [test x$use_elf64 = xyes]) +AM_CONDITIONAL(USE_ELFXX, [test x$use_elfxx = xyes]) + +AC_MSG_CHECKING([whether to include DWARF support]) +if test x$target_arch != xia64; then + use_dwarf=yes +else + use_dwarf=no +fi +AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes]) +AC_MSG_RESULT([$use_dwarf]) + +if test x$target_arch = xppc64; then + libdir='${exec_prefix}/lib64' + AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]); + AC_SUBST([libdir]) +fi + +AC_MSG_CHECKING([whether to restrict build to remote support]) +if test x$target_arch != x$host_arch; then + CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY" + remote_only=yes +else + remote_only=no +fi +AC_MSG_RESULT([$remote_only]) + +AC_MSG_CHECKING([whether to enable debug support]) +AC_ARG_ENABLE(debug, +[ --enable-debug turn on debug support (slows down execution)], +[enable_debug=$enableval], [enable_debug=no]) +if test x$enable_debug = xyes; then + CPPFLAGS="${CPPFLAGS} -DDEBUG" +else + CPPFLAGS="${CPPFLAGS} -DNDEBUG" +fi +AC_MSG_RESULT([$enable_debug]) + +AC_MSG_CHECKING([whether to enable C++ exception support]) +AC_ARG_ENABLE(cxx_exceptions, +[ --enable-cxx-exceptions use libunwind to handle C++ exceptions], +[enable_cxx_exceptions=$enableval], +[ +# C++ exception handling doesn't work too well on x86 +case $target_arch in + x86*) enable_cxx_exceptions=no;; + arm*) enable_cxx_exceptions=no;; + mips*) enable_cxx_exceptions=no;; + *) enable_cxx_exceptions=yes;; +esac +]) + +AM_CONDITIONAL([SUPPORT_CXX_EXCEPTIONS], [test x$enable_cxx_exceptions = xyes]) +AC_MSG_RESULT([$enable_cxx_exceptions]) + +AC_MSG_CHECKING([whether to load .debug_frame sections]) +AC_ARG_ENABLE(debug_frame, +[ --enable-debug-frame Load the ".debug_frame" section if available], +[enable_debug_frame=$enableval], [ +case "${target_arch}" in + (arm) enable_debug_frame=yes;; + (*) enable_debug_frame=no;; +esac]) +if test x$enable_debug_frame = xyes; then + AC_DEFINE([CONFIG_DEBUG_FRAME], [], [Enable Debug Frame]) +fi +AC_MSG_RESULT([$enable_debug_frame]) + +AC_MSG_CHECKING([whether to block signals during mutex ops]) +AC_ARG_ENABLE(block_signals, +[ --enable-block-signals Block signals before performing mutex operations], +[enable_block_signals=$enableval], [enable_block_signals=yes]) +if test x$enable_block_signals = xyes; then + AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations]) +fi +AC_MSG_RESULT([$enable_block_signals]) + +AC_MSG_CHECKING([whether to validate memory addresses before use]) +AC_ARG_ENABLE(conservative_checks, +[ --enable-conservative-checks Validate all memory addresses before use], +[enable_conservative_checks=$enableval], [enable_conservative_checks=yes]) +if test x$enable_conservative_checks = xyes; then + AC_DEFINE(CONSERVATIVE_CHECKS, 1, + [Define to 1 if you want every memory access validated]) +fi +AC_MSG_RESULT([$enable_conservative_checks]) + +AC_MSG_CHECKING([whether to enable msabi support]) +AC_ARG_ENABLE(msabi_support, +[ --enable-msabi-support Enables support for Microsoft ABI extensions ], +[enable_msabi_support=$enableval], [enable_msabi_support=no]) +if test x$enable_msabi_support = xyes; then + AC_DEFINE([CONFIG_MSABI_SUPPORT], [], [Support for Microsoft ABI extensions]) +fi +AC_MSG_RESULT([$enable_msabi_support]) + +LIBUNWIND___THREAD + +AC_MSG_CHECKING([for Intel compiler]) +AC_TRY_COMPILE([], [#ifndef __INTEL_COMPILER +#error choke me +#endif], [intel_compiler=yes], [intel_compiler=no]) + +if test x$GCC = xyes -a x$intel_compiler != xyes; then + CFLAGS="${CFLAGS} -fexceptions -Wall -Wsign-compare" + LIBCRTS="-lgcc" +fi +AC_MSG_RESULT([$intel_compiler]) + +if test x$intel_compiler = xyes; then + AC_MSG_CHECKING([if linker supports -static-libcxa]) + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -static-libcxa" + AC_TRY_LINK([], [], [have_static_libcxa=yes], [have_static_libcxa=no]) + LDFLAGS="$save_LDFLAGS" + if test "x$have_static_libcxa" = xyes; then + LDFLAGS_STATIC_LIBCXA="-XCClinker -static-libcxa" + fi + AC_MSG_RESULT([$have_static_libcxa]) +fi + +CCASFLAGS="${CCASFLAGS} ${CPPFLAGS}" + +arch="$target_arch" +ARCH=`echo $target_arch | tr [a-z] [A-Z]` + +dnl create shell variables from the M4 macros: +PKG_MAJOR=pkg_major +PKG_MINOR=pkg_minor +PKG_EXTRA=pkg_extra +PKG_MAINTAINER=pkg_maintainer + +old_LIBS="$LIBS" +LIBS="" +AC_SEARCH_LIBS(backtrace, execinfo) +AM_CONDITIONAL(HAVE_BACKTRACE, test "x$ac_cv_search_backtrace" != xno) +BACKTRACELIB="$LIBS" +LIBS="$old_LIBS" + +AC_SUBST(build_arch) +AC_SUBST(target_os) +AC_SUBST(arch) +AC_SUBST(ARCH) +AC_SUBST(LDFLAGS_STATIC_LIBCXA) +AC_SUBST(LIBCRTS) +AC_SUBST(PKG_MAJOR) +AC_SUBST(PKG_MINOR) +AC_SUBST(PKG_EXTRA) +AC_SUBST(PKG_MAINTAINER) +AC_SUBST(enable_cxx_exceptions) +AC_SUBST(enable_debug_frame) +AC_SUBST(DLLIB) +AC_SUBST(BACKTRACELIB) + +AC_CONFIG_FILES(Makefile src/Makefile + include/libunwind-common.h + include/libunwind.h include/tdep/libunwind_i.h) +AC_OUTPUT diff --git a/sdk/cpprt/linux/libunwind/doc/Makefile.am b/sdk/cpprt/linux/libunwind/doc/Makefile.am new file mode 100644 index 0000000000..4730f9b7f8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/Makefile.am @@ -0,0 +1,71 @@ +# man pages that go into section 3: +man3_MANS = libunwind.man libunwind-dynamic.man libunwind-ia64.man \ + libunwind-ptrace.man libunwind-setjmp.man \ + unw_flush_cache.man \ + unw_get_accessors.man \ + unw_get_proc_info.man \ + unw_get_proc_info_by_ip.man \ + unw_get_proc_name.man \ + unw_get_fpreg.man \ + unw_get_reg.man \ + unw_getcontext.man \ + unw_init_local.man unw_init_remote.man \ + unw_is_fpreg.man \ + unw_is_signal_frame.man \ + unw_create_addr_space.man \ + unw_destroy_addr_space.man \ + unw_regname.man unw_resume.man \ + unw_set_caching_policy.man \ + unw_set_fpreg.man \ + unw_set_reg.man \ + unw_step.man \ + unw_strerror.man \ + _U_dyn_register.man \ + _U_dyn_cancel.man + +EXTRA_DIST = NOTES libunwind.trans \ + libunwind.tex libunwind-dynamic.tex libunwind-ia64.tex \ + libunwind-ptrace.tex libunwind-setjmp.tex \ + unw_flush_cache.tex \ + unw_get_accessors.tex \ + unw_get_proc_info.tex \ + unw_get_proc_info_by_ip.tex \ + unw_get_proc_name.tex \ + unw_get_fpreg.tex \ + unw_get_reg.tex \ + unw_getcontext.tex \ + unw_init_local.tex unw_init_remote.tex \ + unw_is_fpreg.tex \ + unw_is_signal_frame.tex \ + unw_create_addr_space.tex unw_destroy_addr_space.tex \ + unw_regname.tex unw_resume.tex unw_set_caching_policy.tex \ + unw_set_fpreg.tex \ + unw_set_reg.tex \ + unw_step.tex \ + unw_strerror.tex \ + _U_dyn_register.tex \ + _U_dyn_cancel.tex \ + $(man3_MANS) + +L2M = latex2man +L2P = pdflatex +L2M_CMD = $(L2M) -t $(srcdir)/libunwind.trans +L2H_CMD = $(L2M) -H -t $(srcdir)/libunwind.trans + +.tex.man: + $(L2M_CMD) $< $@ + -cp $@ $(srcdir)/$@ + +html: + for n in $(man3_MANS); do \ + page=`basename $$n .man`; \ + $(L2H_CMD) $(srcdir)/$$page.tex "$$page(3).raw"; \ + done + +pdf: + for n in $(man3_MANS); do \ + page=`basename $$n .man`; \ + $(L2P) $(srcdir)/$$page.tex "$$page(3).pdf"; \ + done + +MAINTAINERCLEANFILES = Makefile.in diff --git a/sdk/cpprt/linux/libunwind/doc/NOTES b/sdk/cpprt/linux/libunwind/doc/NOTES new file mode 100644 index 0000000000..3f3caa95bb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/NOTES @@ -0,0 +1,127 @@ +The central data structure of the unwind API is the unwind cursor. +This structure tracks the register contents. The unwind API defines a +handful of well-known frame "registers": + + - ip: the instruction pointer (pc) + - rp: the return pointer (rp, aka "return address" or "return link") + - sp: the stack pointer (memory stack pointer, in the case of ia64) + - fp: the frame pointer + - first_ip: the starting address of the current "procedure" + - handler: a pointer to an architecture & language-specific + "personality" routine + - lsda: a pointer to an architecture & language-specific + data-area + +The API defines no well-known preserved registers. Each architecture +can define additional registers as needed. Of course, a portable +application may only rely on well-known registers. The names for +preserved registers are defined in the architecture-specific header +file . For example, to get the IA-64-specific register +names, an application would do: + + #include + +The API is designed to handle two primary cases: unwinding within the +current (local) process and unwinding of another ("remote") process +(e.g., through ptrace()). In the local case, the initial machine +state is captured by an unwind context (currently the same as +ucontext_t). In the remote case, the initial machine state is +captured by an unwind accessor structure, which provides callback +routines for reading/writing memory and registers and for obtaining +unwind information. + +Once a cursor has been initialized, you can step through the call +chain with the unw_step() routine. The frame registers and the +preserved state can then be accessed with unw_get_reg() or modified +with unw_set_reg(). For floating-point registers, there are separate +unw_get_fpreg() and unw_set_fpreg() routines (on some arches, e.g., +Alpha, these could be just aliases for unw_{g,s}et_reg()). The +unw_resume() routine can be used to resume execution at an arbitrary +point in the call-chain (as identified by an unwind cursor). This is +intended for exception handling and, at least for now, the intention +is to support this routine only for the local case. Kevin, if you +feel gdb could benefit from such a routine, I'd be interested to hear +about it. + +Note that it is perfectly legal to make copies of the unwind cursor. +This makes it possible, e.g., to obtain an unwind context, modify the +state in an earlier call frame, and then resume execution at the point +at which the unwind context was captured. + +Here is a quick example of how to use the unwind API to do a simple +stack trace: + + unw_cursor_t cursor; + unw_word_t ip, sp; + unw_context_t uc; + + unw_getcontext(&uc); + unw_init_local(&cursor, &uc); + do + { + unw_get_reg(&cursor, UNW_REG_IP, &ip); + unw_get_reg(&cursor, UNW_REG_SP, &sp); + printf ("ip=%016lx sp=%016lx\n", ip, sp); + } + while (unw_step (&cursor) > 0); + +Note that this particular example should work on pretty much any +architecture, as it doesn't rely on any arch-specific registers. + +* Multiarchitecture support + +If libunwind is configured for a target other than the local (native) +host, the library is installed as libunwind-$ARCH, where $ARCH is +the target architecture name (e.g., ia32, ia64, or alpha). Similarly, +the header file is installed as libunwind-$ARCH. + +With this setup, an application should: + + - include , and + - link against -lunwind + +if the application needs to use the unwinder of the host. An +application wanting to use the unwinder for a different target (e.g., +a cross-debugger) should: + + - include , and + - link against -lunwind-$ARCH + +The global symbols exported by -lunwind-$ARCH are unique such that the +same application can be linked against the separate unwind libraries +of multiple targets. However, a single compilation unit can include +the header file for only one target. For example, foo.c might include + and bar.c might include and the +entire application would have to be linked against both -lunwind and +-lunwind-ia64. + +Note: the unwind header files of all targets have a common dependency +on libunwind-common.h. To avoid version conflicts, it is necessary to +ensure that the unwind libraries for all targets were derived from the +same release of libunwind. That is, if the unwind library for one +target is upgraded to a newer version, the libraries for all other +targets also need to be upgraded. + +Note 2: The assumption is that a cross-unwinder can handle all +interesting flavors of a target. For example, the unwinder for the +ia64 target is expected to be able to handle both Linux and HP-UX. + +* IA-64 Specific Information + +Apart from the normal frame-registers, the IA-64 implementation of +libunwind provides the means to access the current value of the +register backing store pointer (bsp). One quirk with this +frame-register is that it corresponds to the address that would be in +register ar.bsp after flushing the current register stack to the +backing store (i.e., as if a "flushrs" instruction had been executed). +Of course, given this value and the contents of the current frame +marker (CFM), it's easy to calculate the original value of ar.bsp: + + unw_word_t cfm, bsp, bsp_after_flushrs, sof; + + unw_get_reg (&cursor, UNW_IA64_BSP, &bsp_after_flushrs); + unw_get_reg (&cursor, UNW_IA64_CFM, &cfm); + bsp = ia64_rse_skip_regs (bsp_after_flushrs, -(cfm & 0x7f)); + +** Dynamic Unwind Info + diff --git a/sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.man b/sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.man new file mode 100644 index 0000000000..a420a6deaf --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.man @@ -0,0 +1,66 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "\\_U\\_DYN\\_CANCEL" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +_U_dyn_cancel +\-\- cancel unwind\-info for dynamically generated code +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +void +_U_dyn_cancel(unw_dyn_info_t *di); +.br +.PP +.SH DESCRIPTION + +.PP +The _U_dyn_cancel() +routine cancels the registration of the +unwind\-info for a dynamically generated procedure. Argument di +is the pointer to the unw_dyn_info_t +structure that +describes the procedure\&'s unwind\-info. +.PP +The _U_dyn_cancel() +routine is guaranteed to execute in +constant time (in the absence of contention from concurrent calls to +_U_dyn_register() +or _U_dyn_cancel()). +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +_U_dyn_cancel() +is thread\-safe but \fInot\fP +safe to use +from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind\-dynamic(3), +_U_dyn_register(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.tex b/sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.tex new file mode 100644 index 0000000000..ca5a12a76e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/_U_dyn_cancel.tex @@ -0,0 +1,46 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{\_U\_dyn\_cancel}{David Mosberger-Tang}{Programming Library}{\_U\_dyn\_cancel}\_U\_dyn\_cancel -- cancel unwind-info for dynamically generated code +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{void} \Func{\_U\_dyn\_cancel}(\Type{unw\_dyn\_info\_t~*}\Var{di});\\ + +\section{Description} + +The \Func{\_U\_dyn\_cancel}() routine cancels the registration of the +unwind-info for a dynamically generated procedure. Argument \Var{di} +is the pointer to the \Type{unw\_dyn\_info\_t} structure that +describes the procedure's unwind-info. + +The \Func{\_U\_dyn\_cancel}() routine is guaranteed to execute in +constant time (in the absence of contention from concurrent calls to +\Func{\_U\_dyn\_register}() or \Func{\_U\_dyn\_cancel}()). + + +\section{Thread and Signal Safety} + +\Func{\_U\_dyn\_cancel}() is thread-safe but \emph{not} safe to use +from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind-dynamic(3)}, \SeeAlso{\_U\_dyn\_register(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/_U_dyn_register.man b/sdk/cpprt/linux/libunwind/doc/_U_dyn_register.man new file mode 100644 index 0000000000..107e5fd0e1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/_U_dyn_register.man @@ -0,0 +1,68 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "\\_U\\_DYN\\_REGISTER" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +_U_dyn_register +\-\- register unwind\-info for dynamically generated code +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +void +_U_dyn_register(unw_dyn_info_t *di); +.br +.PP +.SH DESCRIPTION + +.PP +The _U_dyn_register() +routine registers unwind\-info for a +dynamically generated procedure. The procedure\&'s unwind\-info is +described by a structure of type unw_dyn_info_t +(see +libunwind\-dynamic(3)). +A pointer to this structure is +passed in argument di\&. +.PP +The _U_dyn_register() +routine is guaranteed to execute in +constant time (in the absence of contention from concurrent calls to +_U_dyn_register() +or _U_dyn_cancel()). +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +_U_dyn_register() +is thread\-safe but \fInot\fP +safe to use +from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind\-dynamic(3), +_U_dyn_cancel(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/_U_dyn_register.tex b/sdk/cpprt/linux/libunwind/doc/_U_dyn_register.tex new file mode 100644 index 0000000000..ab23b5c621 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/_U_dyn_register.tex @@ -0,0 +1,47 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{\_U\_dyn\_register}{David Mosberger-Tang}{Programming Library}{\_U\_dyn\_register}\_U\_dyn\_register -- register unwind-info for dynamically generated code +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{void} \Func{\_U\_dyn\_register}(\Type{unw\_dyn\_info\_t~*}\Var{di});\\ + +\section{Description} + +The \Func{\_U\_dyn\_register}() routine registers unwind-info for a +dynamically generated procedure. The procedure's unwind-info is +described by a structure of type \Type{unw\_dyn\_info\_t} (see +\SeeAlso{libunwind-dynamic(3)}). A pointer to this structure is +passed in argument \Var{di}. + +The \Func{\_U\_dyn\_register}() routine is guaranteed to execute in +constant time (in the absence of contention from concurrent calls to +\Func{\_U\_dyn\_register}() or \Func{\_U\_dyn\_cancel}()). + + +\section{Thread and Signal Safety} + +\Func{\_U\_dyn\_register}() is thread-safe but \emph{not} safe to use +from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind-dynamic(3)}, \SeeAlso{\_U\_dyn\_cancel(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/common.tex.in b/sdk/cpprt/linux/libunwind/doc/common.tex.in new file mode 100644 index 0000000000..91c96a9df4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/common.tex.in @@ -0,0 +1,11 @@ +\setVersion{@VERSION@} + +\sloppy + +\newcommand{\Lt}{\symbol{"3C}} +\newcommand{\Gt}{\symbol{"3E}} +\newcommand{\Type}[1]{\File{#1}} % see libunwind.trans +\newcommand{\Func}[1]{\Prog{#1}} % see libunwind.trans +\newcommand{\Var}[1]{\Prog{#1}} % see libunwind.trans +\newcommand{\Const}[1]{\File{#1}} % see libunwind.trans +\newcommand{\SeeAlso}[2]{\File{#1}} % see libunwind.trans diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.man b/sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.man new file mode 100644 index 0000000000..7c7507cb10 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.man @@ -0,0 +1,538 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "LIBUNWIND\-DYNAMIC" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +libunwind\-dynamic +\-\- libunwind\-support for runtime\-generated code +.PP +.SH INTRODUCTION + +.PP +For libunwind +to do its job, it needs to be able to reconstruct +the \fIframe state\fP +of each frame in a call\-chain. The frame state +describes the subset of the machine\-state that consists of the +\fIframe registers\fP +(typically the instruction\-pointer and the +stack\-pointer) and all callee\-saved registers (preserved registers). +The frame state describes each register either by providing its +current value (for frame registers) or by providing the location at +which the current value is stored (callee\-saved registers). +.PP +For statically generated code, the compiler normally takes care of +emitting \fIunwind\-info\fP +which provides the minimum amount of +information needed to reconstruct the frame\-state for each instruction +in a procedure. For dynamically generated code, the runtime code +generator must use the dynamic unwind\-info interface provided by +libunwind +to supply the equivalent information. This manual +page describes the format of this information in detail. +.PP +For the purpose of this discussion, a \fIprocedure\fP +is defined to +be an arbitrary piece of \fIcontiguous\fP +code. Normally, each +procedure directly corresponds to a function in the source\-language +but this is not strictly required. For example, a runtime +code\-generator could translate a given function into two separate +(discontiguous) procedures: one for frequently\-executed (hot) code and +one for rarely\-executed (cold) code. Similarly, simple +source\-language functions (usually leaf functions) may get translated +into code for which the default unwind\-conventions apply and for such +code, it is not strictly necessary to register dynamic unwind\-info. +.PP +A procedure logically consists of a sequence of \fIregions\fP\&. +Regions are nested in the sense that the frame state at the end of one +region is, by default, assumed to be the frame state for the next +region. Each region is thought of as being divided into a +\fIprologue\fP, +a \fIbody\fP, +and an \fIepilogue\fP\&. +Each of them +can be empty. If non\-empty, the prologue sets up the frame state for +the body. For example, the prologue may need to allocate some space +on the stack and save certain callee\-saved registers. The body +performs the actual work of the procedure but does not change the +frame state in any way. If non\-empty, the epilogue restores the +previous frame state and as such it undoes or cancels the effect of +the prologue. In fact, a single epilogue may undo the effect of the +prologues of several (nested) regions. +.PP +We should point out that even though the prologue, body, and epilogue +are logically separate entities, optimizing code\-generators will +generally interleave instructions from all three entities. For this +reason, the dynamic unwind\-info interface of libunwind +makes no +distinction whatsoever between prologue and body. Similarly, the +exact set of instructions that make up an epilogue is also irrelevant. +The only point in the epilogue that needs to be described explicitly +by the dynamic unwind\-info is the point at which the stack\-pointer +gets restored. The reason this point needs to be described is that +once the stack\-pointer is restored, all values saved in the +deallocated portion of the stack frame become invalid and hence +libunwind +needs to know about it. The portion of the frame +state not saved on the stack is assume to remain valid through the end +of the region. For this reason, there is usually no need to describe +instructions which restore the contents of callee\-saved registers. +.PP +Within a region, each instruction that affects the frame state in some +fashion needs to be described with an operation descriptor. For this +purpose, each instruction in the region is assigned a unique index. +Exactly how this index is derived depends on the architecture. For +example, on RISC and EPIC\-style architecture, instructions have a +fixed size so it\&'s possible to simply number the instructions. In +contrast, most CISC use variable\-length instruction encodings, so it +is usually necessary to use a byte\-offset as the index. Given the +instruction index, the operation descriptor specifies the effect of +the instruction in an abstract manner. For example, it might express +that the instruction stores calle\-saved register r1 +at offset 16 +in the stack frame. +.PP +.SH PROCEDURES + +.PP +A runtime code\-generator registers the dynamic unwind\-info of a +procedure by setting up a structure of type unw_dyn_info_t +and calling _U_dyn_register(), +passing the address of the +structure as the sole argument. The members of the +unw_dyn_info_t +structure are described below: +.TP +void *next + Private to libunwind\&. +Must not be used +by the application. +.TP +void *prev + Private to libunwind\&. +Must not be used +by the application. +.TP +unw_word_t start_ip + The start\-address of the +instructions of the procedure (remember: procedure are defined to be +contiguous pieces of code, so a single code\-range is sufficient). +.TP +unw_word_t end_ip + The end\-address of the +instructions of the procedure (non\-inclusive, that is, +end_ip\-start_ip +is the size of the procedure in +bytes). +.TP +unw_word_t gp + The global\-pointer value in use +for this procedure. The exact meaing of the global\-pointer is +architecture\-specific and on some architecture, it is not used at +all. +.TP +int32_t format + The format of the unwind\-info. +This member can be one of UNW_INFO_FORMAT_DYNAMIC, +UNW_INFO_FORMAT_TABLE, +or +UNW_INFO_FORMAT_REMOTE_TABLE\&. +.TP +union u + This union contains one sub\-member +structure for every possible unwind\-info format: +.RS +.TP +unw_dyn_proc_info_t pi + This member is used +for format UNW_INFO_FORMAT_DYNAMIC\&. +.TP +unw_dyn_table_info_t ti + This member is used +for format UNW_INFO_FORMAT_TABLE\&. +.TP +unw_dyn_remote_table_info_t rti + This member +is used for format UNW_INFO_FORMAT_REMOTE_TABLE\&. +.RE +.RS +.PP +The format of these sub\-members is described in detail below. +.RE +.PP +.SS PROC\-INFO FORMAT +.PP +This is the preferred dynamic unwind\-info format and it is generally +the one used by full\-blown runtime code\-generators. In this format, +the details of a procedure are described by a structure of type +unw_dyn_proc_info_t\&. +This structure contains the following +members: +.PP +.RE +.TP +unw_word_t name_ptr + The address of a +(human\-readable) name of the procedure or 0 if no such name is +available. If non\-zero, The string stored at this address must be +ASCII NUL terminated. For source languages that use name\-mangling +(such as C++ or Java) the string stored at this address should be +the \fIdemangled\fP +version of the name. +.PP +.TP +unw_word_t handler + The address of the +personality\-routine for this procedure. Personality\-routines are +used in conjunction with exception handling. See the C++ ABI draft +(http://www.codesourcery.com/cxx\-abi/) for an overview and a +description of the personality routine. If the procedure has no +personality routine, handler +must be set to 0. +.PP +.TP +uint32_t flags + A bitmask of flags. At the +moment, no flags have been defined and this member must be +set to 0. +.PP +.TP +unw_dyn_region_info_t *regions + A NULL\-terminated +linked list of region\-descriptors. See section ``Region +descriptors\&'' below for more details. +.PP +.SS TABLE\-INFO FORMAT +.PP +This format is generally used when the dynamically generated code was +derived from static code and the unwind\-info for the dynamic and the +static versions is identical. For example, this format can be useful +when loading statically\-generated code into an address\-space in a +non\-standard fashion (i.e., through some means other than +dlopen()). +In this format, the details of a group of procedures +is described by a structure of type unw_dyn_table_info\&. +This structure contains the following members: +.PP +.TP +unw_word_t name_ptr + The address of a +(human\-readable) name of the procedure or 0 if no such name is +available. If non\-zero, The string stored at this address must be +ASCII NUL terminated. For source languages that use name\-mangling +(such as C++ or Java) the string stored at this address should be +the \fIdemangled\fP +version of the name. +.PP +.TP +unw_word_t segbase + The segment\-base value +that needs to be added to the segment\-relative values stored in the +unwind\-info. The exact meaning of this value is +architecture\-specific. +.PP +.TP +unw_word_t table_len + The length of the +unwind\-info (table_data) +counted in units of words +(unw_word_t). +.PP +.TP +unw_word_t table_data + A pointer to the actual +data encoding the unwind\-info. The exact format is +architecture\-specific (see architecture\-specific sections below). +.PP +.SS REMOTE TABLE\-INFO FORMAT +.PP +The remote table\-info format has the same basic purpose as the regular +table\-info format. The only difference is that when libunwind +uses the unwind\-info, it will keep the table data in the target +address\-space (which may be remote). Consequently, the type of the +table_data +member is unw_word_t +rather than a pointer. +This implies that libunwind +will have to access the table\-data +via the address\-space\&'s access_mem() +call\-back, rather than +through a direct memory reference. +.PP +From the point of view of a runtime\-code generator, the remote +table\-info format offers no advantage and it is expected that such +generators will describe their procedures either with the proc\-info +format or the normal table\-info format. The main reason that the +remote table\-info format exists is to enable the +address\-space\-specific find_proc_info() +callback (see +unw_create_addr_space(3)) +to return unwind tables whose +data remains in remote memory. This can speed up unwinding (e.g., for +a debugger) because it reduces the amount of data that needs to be +loaded from remote memory. +.PP +.SH REGIONS DESCRIPTORS + +.PP +A region descriptor is a variable length structure that describes how +each instruction in the region affects the frame state. Of course, +most instructions in a region usualy do not change the frame state and +for those, nothing needs to be recorded in the region descriptor. A +region descriptor is a structure of type +unw_dyn_region_info_t +and has the following members: +.TP +unw_dyn_region_info_t *next + A pointer to the +next region. If this is the last region, next +is NULL\&. +.TP +int32_t insn_count + The length of the region in +instructions. Each instruction is assumed to have a fixed size (see +architecture\-specific sections for details). The value of +insn_count +may be negative in the last region of a procedure +(i.e., it may be negative only if next +is NULL). +A +negative value indicates that the region covers the last \fIN\fP +instructions of the procedure, where \fIN\fP +is the absolute value +of insn_count\&. +.TP +uint32_t op_count + The (allocated) length of +the op_count +array. +.TP +unw_dyn_op_t op + An array of dynamic unwind +directives. See Section ``Dynamic unwind directives\&'' for a +description of the directives. +.PP +A region descriptor with an insn_count +of zero is an +\fIempty region\fP +and such regions are perfectly legal. In fact, +empty regions can be useful to establish a particular frame state +before the start of another region. +.PP +A single region list can be shared across multiple procedures provided +those procedures share a common prologue and epilogue (their bodies +may differ, of course). Normally, such procedures consist of a canned +prologue, the body, and a canned epilogue. This could be described by +two regions: one covering the prologue and one covering the epilogue. +Since the body length is variable, the latter region would need to +specify a negative value in insn_count +such that +libunwind +knows that the region covers the end of the procedure +(up to the address specified by end_ip). +.PP +The region descriptor is a variable length structure to make it +possible to allocate all the necessary memory with a single +memory\-allocation request. To facilitate the allocation of a region +descriptors libunwind +provides a helper routine with the +following synopsis: +.PP +size_t +_U_dyn_region_size(int +op_count); +.PP +This routine returns the number of bytes needed to hold a region +descriptor with space for op_count +unwind directives. Note +that the length of the op +array does not have to match exactly +with the number of directives in a region. Instead, it is sufficient +if the op +array contains at least as many entries as there are +directives, since the end of the directives can always be indicated +with the UNW_DYN_STOP +directive. +.PP +.SH DYNAMIC UNWIND DIRECTIVES + +.PP +A dynamic unwind directive describes how the frame state changes +at a particular point within a region. The description is in +the form of a structure of type unw_dyn_op_t\&. +This +structure has the following members: +.TP +int8_t tag + The operation tag. Must be one +of the unw_dyn_operation_t +values described below. +.TP +int8_t qp + The qualifying predicate that controls +whether or not this directive is active. This is useful for +predicated architecturs such as IA\-64 or ARM, where the contents of +another (callee\-saved) register determines whether or not an +instruction is executed (takes effect). If the directive is always +active, this member should be set to the manifest constant +_U_QP_TRUE +(this constant is defined for all +architectures, predicated or not). +.TP +int16_t reg + The number of the register affected +by the instruction. +.TP +int32_t when + The region\-relative number of +the instruction to which this directive applies. For example, +a value of 0 means that the effect described by this directive +has taken place once the first instruction in the region has +executed. +.TP +unw_word_t val + The value to be applied by the +operation tag. The exact meaning of this value varies by tag. See +Section ``Operation tags\&'' below. +.PP +It is perfectly legitimate to specify multiple dynamic unwind +directives with the same when +value, if a particular instruction +has a complex effect on the frame state. +.PP +Empty regions by definition contain no actual instructions and as such +the directives are not tied to a particular instruction. By +convention, the when +member should be set to 0, however. +.PP +There is no need for the dynamic unwind directives to appear +in order of increasing when +values. If the directives happen to +be sorted in that order, it may result in slightly faster execution, +but a runtime code\-generator should not go to extra lengths just to +ensure that the directives are sorted. +.PP +IMPLEMENTATION NOTE: should libunwind +implementations for +certain architectures prefer the list of unwind directives to be +sorted, it is recommended that such implementations first check +whether the list happens to be sorted already and, if not, sort the +directives explicitly before the first use. With this approach, the +overhead of explicit sorting is only paid when there is a real benefit +and if the runtime code\-generator happens to generated sorted lists +naturally, the performance penalty is limited to a simple O(N) check. +.PP +.SS OPERATIONS TAGS +.PP +The possible operation tags are defined by enumeration type +unw_dyn_operation_t +which defines the following +values: +.PP +.TP +UNW_DYN_STOP + Marks the end of the dynamic unwind +directive list. All remaining entries in the op +array of the +region\-descriptor are ignored. This tag is guaranteed to have a +value of 0. +.PP +.TP +UNW_DYN_SAVE_REG + Marks an instruction which saves +register reg +to register val\&. +.PP +.TP +UNW_DYN_SPILL_FP_REL + Marks an instruction which +spills register reg +to a frame\-pointer\-relative location. The +frame\-pointer\-relative offset is given by the value stored in member +val\&. +See the architecture\-specific sections for a description +of the stack frame layout. +.PP +.TP +UNW_DYN_SPILL_SP_REL + Marks an instruction which +spills register reg +to a stack\-pointer\-relative location. The +stack\-pointer\-relative offset is given by the value stored in member +val\&. +See the architecture\-specific sections for a description +of the stack frame layout. +.PP +.TP +UNW_DYN_ADD + Marks an instruction which adds +the constant value val +to register reg\&. +To add subtract +a constant value, store the two\&'s\-complement of the value in +val\&. +The set of registers that can be specified for this tag +is described in the architecture\-specific sections below. +.PP +.TP +UNW_DYN_POP_FRAMES + .PP +.TP +UNW_DYN_LABEL_STATE + .PP +.TP +UNW_DYN_COPY_STATE + .PP +.TP +UNW_DYN_ALIAS + .PP +unw_dyn_op_t +.PP +_U_dyn_op_save_reg(); +_U_dyn_op_spill_fp_rel(); +_U_dyn_op_spill_sp_rel(); +_U_dyn_op_add(); +_U_dyn_op_pop_frames(); +_U_dyn_op_label_state(); +_U_dyn_op_copy_state(); +_U_dyn_op_alias(); +_U_dyn_op_stop(); +.PP +.SH IA\-64 SPECIFICS + +.PP +\- meaning of segbase member in table\-info/table\-remote\-info format +\- format of table_data in table\-info/table\-remote\-info format +\- instruction size: each bundle is counted as 3 instructions, regardless +of template (MLX) +\- describe stack\-frame layout, especially with regards to sp\-relative +and fp\-relative addressing +\- UNW_DYN_ADD can only add to ``sp\&'' (always a negative value); use +POP_FRAMES otherwise +.PP +.SH SEE ALSO + +.PP +libunwind(3), +_U_dyn_register(3), +_U_dyn_cancel(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.tex b/sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.tex new file mode 100644 index 0000000000..21e895a34f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-dynamic.tex @@ -0,0 +1,401 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{libunwind-dynamic}{David Mosberger-Tang}{Programming Library}{Introduction to dynamic unwind-info}libunwind-dynamic -- libunwind-support for runtime-generated code +\end{Name} + +\section{Introduction} + +For \Prog{libunwind} to do its job, it needs to be able to reconstruct +the \emph{frame state} of each frame in a call-chain. The frame state +describes the subset of the machine-state that consists of the +\emph{frame registers} (typically the instruction-pointer and the +stack-pointer) and all callee-saved registers (preserved registers). +The frame state describes each register either by providing its +current value (for frame registers) or by providing the location at +which the current value is stored (callee-saved registers). + +For statically generated code, the compiler normally takes care of +emitting \emph{unwind-info} which provides the minimum amount of +information needed to reconstruct the frame-state for each instruction +in a procedure. For dynamically generated code, the runtime code +generator must use the dynamic unwind-info interface provided by +\Prog{libunwind} to supply the equivalent information. This manual +page describes the format of this information in detail. + +For the purpose of this discussion, a \emph{procedure} is defined to +be an arbitrary piece of \emph{contiguous} code. Normally, each +procedure directly corresponds to a function in the source-language +but this is not strictly required. For example, a runtime +code-generator could translate a given function into two separate +(discontiguous) procedures: one for frequently-executed (hot) code and +one for rarely-executed (cold) code. Similarly, simple +source-language functions (usually leaf functions) may get translated +into code for which the default unwind-conventions apply and for such +code, it is not strictly necessary to register dynamic unwind-info. + +A procedure logically consists of a sequence of \emph{regions}. +Regions are nested in the sense that the frame state at the end of one +region is, by default, assumed to be the frame state for the next +region. Each region is thought of as being divided into a +\emph{prologue}, a \emph{body}, and an \emph{epilogue}. Each of them +can be empty. If non-empty, the prologue sets up the frame state for +the body. For example, the prologue may need to allocate some space +on the stack and save certain callee-saved registers. The body +performs the actual work of the procedure but does not change the +frame state in any way. If non-empty, the epilogue restores the +previous frame state and as such it undoes or cancels the effect of +the prologue. In fact, a single epilogue may undo the effect of the +prologues of several (nested) regions. + +We should point out that even though the prologue, body, and epilogue +are logically separate entities, optimizing code-generators will +generally interleave instructions from all three entities. For this +reason, the dynamic unwind-info interface of \Prog{libunwind} makes no +distinction whatsoever between prologue and body. Similarly, the +exact set of instructions that make up an epilogue is also irrelevant. +The only point in the epilogue that needs to be described explicitly +by the dynamic unwind-info is the point at which the stack-pointer +gets restored. The reason this point needs to be described is that +once the stack-pointer is restored, all values saved in the +deallocated portion of the stack frame become invalid and hence +\Prog{libunwind} needs to know about it. The portion of the frame +state not saved on the stack is assume to remain valid through the end +of the region. For this reason, there is usually no need to describe +instructions which restore the contents of callee-saved registers. + +Within a region, each instruction that affects the frame state in some +fashion needs to be described with an operation descriptor. For this +purpose, each instruction in the region is assigned a unique index. +Exactly how this index is derived depends on the architecture. For +example, on RISC and EPIC-style architecture, instructions have a +fixed size so it's possible to simply number the instructions. In +contrast, most CISC use variable-length instruction encodings, so it +is usually necessary to use a byte-offset as the index. Given the +instruction index, the operation descriptor specifies the effect of +the instruction in an abstract manner. For example, it might express +that the instruction stores calle-saved register \Var{r1} at offset 16 +in the stack frame. + +\section{Procedures} + +A runtime code-generator registers the dynamic unwind-info of a +procedure by setting up a structure of type \Type{unw\_dyn\_info\_t} +and calling \Func{\_U\_dyn\_register}(), passing the address of the +structure as the sole argument. The members of the +\Type{unw\_dyn\_info\_t} structure are described below: +\begin{itemize} +\item[\Type{void~*}next] Private to \Prog{libunwind}. Must not be used + by the application. +\item[\Type{void~*}prev] Private to \Prog{libunwind}. Must not be used + by the application. +\item[\Type{unw\_word\_t} \Var{start\_ip}] The start-address of the + instructions of the procedure (remember: procedure are defined to be + contiguous pieces of code, so a single code-range is sufficient). +\item[\Type{unw\_word\_t} \Var{end\_ip}] The end-address of the + instructions of the procedure (non-inclusive, that is, + \Var{end\_ip}-\Var{start\_ip} is the size of the procedure in + bytes). +\item[\Type{unw\_word\_t} \Var{gp}] The global-pointer value in use + for this procedure. The exact meaing of the global-pointer is + architecture-specific and on some architecture, it is not used at + all. +\item[\Type{int32\_t} \Var{format}] The format of the unwind-info. + This member can be one of \Const{UNW\_INFO\_FORMAT\_DYNAMIC}, + \Const{UNW\_INFO\_FORMAT\_TABLE}, or + \Const{UNW\_INFO\_FORMAT\_REMOTE\_TABLE}. +\item[\Type{union} \Var{u}] This union contains one sub-member + structure for every possible unwind-info format: + \begin{description} + \item[\Type{unw\_dyn\_proc\_info\_t} \Var{pi}] This member is used + for format \Const{UNW\_INFO\_FORMAT\_DYNAMIC}. + \item[\Type{unw\_dyn\_table\_info\_t} \Var{ti}] This member is used + for format \Const{UNW\_INFO\_FORMAT\_TABLE}. + \item[\Type{unw\_dyn\_remote\_table\_info\_t} \Var{rti}] This member + is used for format \Const{UNW\_INFO\_FORMAT\_REMOTE\_TABLE}. + \end{description}\ + The format of these sub-members is described in detail below. +\end{itemize} + +\subsection{Proc-info format} + +This is the preferred dynamic unwind-info format and it is generally +the one used by full-blown runtime code-generators. In this format, +the details of a procedure are described by a structure of type +\Type{unw\_dyn\_proc\_info\_t}. This structure contains the following +members: +\begin{description} + +\item[\Type{unw\_word\_t} \Var{name\_ptr}] The address of a + (human-readable) name of the procedure or 0 if no such name is + available. If non-zero, The string stored at this address must be + ASCII NUL terminated. For source languages that use name-mangling + (such as C++ or Java) the string stored at this address should be + the \emph{demangled} version of the name. + +\item[\Type{unw\_word\_t} \Var{handler}] The address of the + personality-routine for this procedure. Personality-routines are + used in conjunction with exception handling. See the C++ ABI draft + (http://www.codesourcery.com/cxx-abi/) for an overview and a + description of the personality routine. If the procedure has no + personality routine, \Var{handler} must be set to 0. + +\item[\Type{uint32\_t} \Var{flags}] A bitmask of flags. At the + moment, no flags have been defined and this member must be + set to 0. + +\item[\Type{unw\_dyn\_region\_info\_t~*}\Var{regions}] A NULL-terminated + linked list of region-descriptors. See section ``Region + descriptors'' below for more details. + +\end{description} + +\subsection{Table-info format} + +This format is generally used when the dynamically generated code was +derived from static code and the unwind-info for the dynamic and the +static versions is identical. For example, this format can be useful +when loading statically-generated code into an address-space in a +non-standard fashion (i.e., through some means other than +\Func{dlopen}()). In this format, the details of a group of procedures +is described by a structure of type \Type{unw\_dyn\_table\_info}. +This structure contains the following members: +\begin{description} + +\item[\Type{unw\_word\_t} \Var{name\_ptr}] The address of a + (human-readable) name of the procedure or 0 if no such name is + available. If non-zero, The string stored at this address must be + ASCII NUL terminated. For source languages that use name-mangling + (such as C++ or Java) the string stored at this address should be + the \emph{demangled} version of the name. + +\item[\Type{unw\_word\_t} \Var{segbase}] The segment-base value + that needs to be added to the segment-relative values stored in the + unwind-info. The exact meaning of this value is + architecture-specific. + +\item[\Type{unw\_word\_t} \Var{table\_len}] The length of the + unwind-info (\Var{table\_data}) counted in units of words + (\Type{unw\_word\_t}). + +\item[\Type{unw\_word\_t} \Var{table\_data}] A pointer to the actual + data encoding the unwind-info. The exact format is + architecture-specific (see architecture-specific sections below). + +\end{description} + +\subsection{Remote table-info format} + +The remote table-info format has the same basic purpose as the regular +table-info format. The only difference is that when \Prog{libunwind} +uses the unwind-info, it will keep the table data in the target +address-space (which may be remote). Consequently, the type of the +\Var{table\_data} member is \Type{unw\_word\_t} rather than a pointer. +This implies that \Prog{libunwind} will have to access the table-data +via the address-space's \Func{access\_mem}() call-back, rather than +through a direct memory reference. + +From the point of view of a runtime-code generator, the remote +table-info format offers no advantage and it is expected that such +generators will describe their procedures either with the proc-info +format or the normal table-info format. The main reason that the +remote table-info format exists is to enable the +address-space-specific \Func{find\_proc\_info}() callback (see +\SeeAlso{unw\_create\_addr\_space}(3)) to return unwind tables whose +data remains in remote memory. This can speed up unwinding (e.g., for +a debugger) because it reduces the amount of data that needs to be +loaded from remote memory. + +\section{Regions descriptors} + +A region descriptor is a variable length structure that describes how +each instruction in the region affects the frame state. Of course, +most instructions in a region usualy do not change the frame state and +for those, nothing needs to be recorded in the region descriptor. A +region descriptor is a structure of type +\Type{unw\_dyn\_region\_info\_t} and has the following members: +\begin{description} +\item[\Type{unw\_dyn\_region\_info\_t~*}\Var{next}] A pointer to the + next region. If this is the last region, \Var{next} is \Const{NULL}. +\item[\Type{int32\_t} \Var{insn\_count}] The length of the region in + instructions. Each instruction is assumed to have a fixed size (see + architecture-specific sections for details). The value of + \Var{insn\_count} may be negative in the last region of a procedure + (i.e., it may be negative only if \Var{next} is \Const{NULL}). A + negative value indicates that the region covers the last \emph{N} + instructions of the procedure, where \emph{N} is the absolute value + of \Var{insn\_count}. +\item[\Type{uint32\_t} \Var{op\_count}] The (allocated) length of + the \Var{op\_count} array. +\item[\Type{unw\_dyn\_op\_t} \Var{op}] An array of dynamic unwind + directives. See Section ``Dynamic unwind directives'' for a + description of the directives. +\end{description} +A region descriptor with an \Var{insn\_count} of zero is an +\emph{empty region} and such regions are perfectly legal. In fact, +empty regions can be useful to establish a particular frame state +before the start of another region. + +A single region list can be shared across multiple procedures provided +those procedures share a common prologue and epilogue (their bodies +may differ, of course). Normally, such procedures consist of a canned +prologue, the body, and a canned epilogue. This could be described by +two regions: one covering the prologue and one covering the epilogue. +Since the body length is variable, the latter region would need to +specify a negative value in \Var{insn\_count} such that +\Prog{libunwind} knows that the region covers the end of the procedure +(up to the address specified by \Var{end\_ip}). + +The region descriptor is a variable length structure to make it +possible to allocate all the necessary memory with a single +memory-allocation request. To facilitate the allocation of a region +descriptors \Prog{libunwind} provides a helper routine with the +following synopsis: + +\noindent +\Type{size\_t} \Func{\_U\_dyn\_region\_size}(\Type{int} \Var{op\_count}); + +This routine returns the number of bytes needed to hold a region +descriptor with space for \Var{op\_count} unwind directives. Note +that the length of the \Var{op} array does not have to match exactly +with the number of directives in a region. Instead, it is sufficient +if the \Var{op} array contains at least as many entries as there are +directives, since the end of the directives can always be indicated +with the \Const{UNW\_DYN\_STOP} directive. + +\section{Dynamic unwind directives} + +A dynamic unwind directive describes how the frame state changes +at a particular point within a region. The description is in +the form of a structure of type \Type{unw\_dyn\_op\_t}. This +structure has the following members: +\begin{description} +\item[\Type{int8\_t} \Var{tag}] The operation tag. Must be one + of the \Type{unw\_dyn\_operation\_t} values described below. +\item[\Type{int8\_t} \Var{qp}] The qualifying predicate that controls + whether or not this directive is active. This is useful for + predicated architecturs such as IA-64 or ARM, where the contents of + another (callee-saved) register determines whether or not an + instruction is executed (takes effect). If the directive is always + active, this member should be set to the manifest constant + \Const{\_U\_QP\_TRUE} (this constant is defined for all + architectures, predicated or not). +\item[\Type{int16\_t} \Var{reg}] The number of the register affected + by the instruction. +\item[\Type{int32\_t} \Var{when}] The region-relative number of + the instruction to which this directive applies. For example, + a value of 0 means that the effect described by this directive + has taken place once the first instruction in the region has + executed. +\item[\Type{unw\_word\_t} \Var{val}] The value to be applied by the + operation tag. The exact meaning of this value varies by tag. See + Section ``Operation tags'' below. +\end{description} +It is perfectly legitimate to specify multiple dynamic unwind +directives with the same \Var{when} value, if a particular instruction +has a complex effect on the frame state. + +Empty regions by definition contain no actual instructions and as such +the directives are not tied to a particular instruction. By +convention, the \Var{when} member should be set to 0, however. + +There is no need for the dynamic unwind directives to appear +in order of increasing \Var{when} values. If the directives happen to +be sorted in that order, it may result in slightly faster execution, +but a runtime code-generator should not go to extra lengths just to +ensure that the directives are sorted. + +IMPLEMENTATION NOTE: should \Prog{libunwind} implementations for +certain architectures prefer the list of unwind directives to be +sorted, it is recommended that such implementations first check +whether the list happens to be sorted already and, if not, sort the +directives explicitly before the first use. With this approach, the +overhead of explicit sorting is only paid when there is a real benefit +and if the runtime code-generator happens to generated sorted lists +naturally, the performance penalty is limited to a simple O(N) check. + +\subsection{Operations tags} + +The possible operation tags are defined by enumeration type +\Type{unw\_dyn\_operation\_t} which defines the following +values: +\begin{description} + +\item[\Const{UNW\_DYN\_STOP}] Marks the end of the dynamic unwind + directive list. All remaining entries in the \Var{op} array of the + region-descriptor are ignored. This tag is guaranteed to have a + value of 0. + +\item[\Const{UNW\_DYN\_SAVE\_REG}] Marks an instruction which saves + register \Var{reg} to register \Var{val}. + +\item[\Const{UNW\_DYN\_SPILL\_FP\_REL}] Marks an instruction which + spills register \Var{reg} to a frame-pointer-relative location. The + frame-pointer-relative offset is given by the value stored in member + \Var{val}. See the architecture-specific sections for a description + of the stack frame layout. + +\item[\Const{UNW\_DYN\_SPILL\_SP\_REL}] Marks an instruction which + spills register \Var{reg} to a stack-pointer-relative location. The + stack-pointer-relative offset is given by the value stored in member + \Var{val}. See the architecture-specific sections for a description + of the stack frame layout. + +\item[\Const{UNW\_DYN\_ADD}] Marks an instruction which adds + the constant value \Var{val} to register \Var{reg}. To add subtract + a constant value, store the two's-complement of the value in + \Var{val}. The set of registers that can be specified for this tag + is described in the architecture-specific sections below. + +\item[\Const{UNW\_DYN\_POP\_FRAMES}] + +\item[\Const{UNW\_DYN\_LABEL\_STATE}] + +\item[\Const{UNW\_DYN\_COPY\_STATE}] + +\item[\Const{UNW\_DYN\_ALIAS}] + +\end{description} + +unw\_dyn\_op\_t + +\_U\_dyn\_op\_save\_reg(); +\_U\_dyn\_op\_spill\_fp\_rel(); +\_U\_dyn\_op\_spill\_sp\_rel(); +\_U\_dyn\_op\_add(); +\_U\_dyn\_op\_pop\_frames(); +\_U\_dyn\_op\_label\_state(); +\_U\_dyn\_op\_copy\_state(); +\_U\_dyn\_op\_alias(); +\_U\_dyn\_op\_stop(); + +\section{IA-64 specifics} + +- meaning of segbase member in table-info/table-remote-info format +- format of table\_data in table-info/table-remote-info format +- instruction size: each bundle is counted as 3 instructions, regardless + of template (MLX) +- describe stack-frame layout, especially with regards to sp-relative + and fp-relative addressing +- UNW\_DYN\_ADD can only add to ``sp'' (always a negative value); use + POP\_FRAMES otherwise + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{\_U\_dyn\_register(3)}, +\SeeAlso{\_U\_dyn\_cancel(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-ia64.man b/sdk/cpprt/linux/libunwind/doc/libunwind-ia64.man new file mode 100644 index 0000000000..06b141eb3e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-ia64.man @@ -0,0 +1,314 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "LIBUNWIND\-IA64" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +libunwind\-ia64 +\-\- IA\-64\-specific support in libunwind +.PP +.SH INTRODUCTION + +.PP +The IA\-64 version of libunwind +uses a platform\-string of +ia64 +and, at least in theory, should be able to support all +operating systems adhering to the processor\-specific ABI defined for +the Itanium Processor Family. This includes both little\-endian Linux +and big\-endian HP\-UX. Furthermore, to make it possible for a single +library to unwind both 32\- and 64\-bit targets, the type +unw_word_t +is always defined to be 64 bits wide (independent +of the natural word\-size of the host). Having said that, the current +implementation has been tested only with IA\-64 Linux. +.PP +When targeting IA\-64, the libunwind +header file defines the +macro UNW_TARGET_IA64 +as 1 and the macro UNW_TARGET +as ``ia64\&'' (without the quotation marks). The former makes it +possible for platform\-dependent unwind code to use +conditional\-compilation to select an appropriate implementation. The +latter is useful for stringification purposes and to construct +target\-platform\-specific symbols. +.PP +One special feature of IA\-64 is the use of NaT bits to support +speculative execution. Often, NaT bits are thought of as the ``65\-th +bit\&'' of a general register. However, to make everything fit into +64\-bit wide unw_word_t +values, libunwind +treats the +NaT\-bits like separate boolean registers, whose 64\-bit value is either +TRUE (non\-zero) or FALSE (zero). +.PP +.SH MACHINE\-STATE + +.PP +The machine\-state (set of registers) that is accessible through +libunwind +depends on the type of stack frame that a cursor +points to. For normal frames, all ``preserved\&'' (callee\-saved) +registers are accessible. For signal\-trampoline frames, all registers +(including ``scratch\&'' (caller\-saved) registers) are accessible. Most +applications do not have to worry a\-priori about which registers are +accessible when. In case of doubt, it is always safe to \fItry\fP +to +access a register (via unw_get_reg() +or +unw_get_fpreg()) +and if the register isn\&'t accessible, the +call will fail with a return\-value of \-UNW_EBADREG\&. +.PP +As a special exception to the above general rule, scratch registers +r15\-r18 +are always accessible, even in normal +frames. This makes it possible to pass arguments, e.g., to exception +handlers. +.PP +For a detailed description of the IA\-64 register usage convention, +please see the ``Itanium Software Conventions and Runtime Architecture +Guide\&'', available at: +.ce 100 +\fBhttp://www.intel.com/design/itanium/downloads/245358.htm\fP +.ce 0 + +.PP +.SH REGISTER NAMES + +.PP +The IA\-64\-version of libunwind +defines three kinds of register +name macros: frame\-register macros, normal register macros, and +convenience macros. Below, we describe each kind in turn: +.PP +.SS FRAME\-REGISTER MACROS +.PP +Frame\-registers are special (pseudo) registers because they always +have a valid value, even though sometimes they do not get saved +explicitly (e.g., if a memory stack frame is 16 bytes in size, the +previous stack\-pointer value can be calculated simply as +sp+16, +so there is no need to save the stack\-pointer +explicitly). Moreover, the set of frame register values uniquely +identifies a stack frame. The IA\-64 architecture defines two stacks +(a memory and a register stack). Including the instruction\-pointer +(IP), this means there are three frame registers: +.TP +UNW_IA64_IP: + Contains the instruction pointer (IP, or +``program counter\&'') of the current stack frame. Given this value, +the remaining machine\-state corresponds to the register\-values that +were present in the CPU when it was just about to execute the +instruction pointed to by UNW_IA64_IP\&. +Bits 0 and 1 of +this frame\-register encode the slot number of the instruction. +\fBNote:\fP +Due to the way the call instruction works on IA\-64, +the slot number is usually zero, but can be non\-zero, e.g., in the +stack\-frame of a signal\-handler trampoline. +.TP +UNW_IA64_SP: + Contains the (memory) stack\-pointer +value (SP). +.TP +UNW_IA64_BSP: + Contains the register backing\-store +pointer (BSP). \fBNote:\fP +the value in this register is equal +to the contents of register ar.bsp +at the time the +instruction at UNW_IA64_IP +was about to begin execution. +.PP +.SS NORMAL REGISTER MACROS +.PP +The following normal register name macros are available: +.TP +UNW_IA64_GR: + The base\-index for general (integer) +registers. Add an index in the range from 0..127 to get a +particular general register. For example, to access r4, +the index UNW_IA64_GR+4 +should be used. +Registers r0 +and r1 +(gp) +are read\-only, +and any attempt to write them will result in an error +(\-UNW_EREADONLYREG). +Even though r1 +is +read\-only, libunwind +will automatically adjust its value if +the instruction\-pointer (UNW_IA64_IP) +is modified. For +example, if UNW_IA64_IP +is set to a value inside a +function func(), +then reading +UNW_IA64_GR+1 +will return the global\-pointer +value for this function. +.TP +UNW_IA64_NAT: + The base\-index for the NaT bits of the +general (integer) registers. A non\-zero value in these registers +corresponds to a set NaT\-bit. Add an index in the range from 0..127 +to get a particular NaT\-bit register. For example, to access the +NaT bit of r4, +the index UNW_IA64_NAT+4 +should be used. +.TP +UNW_IA64_FR: + The base\-index for floating\-point +registers. Add an index in the range from 0..127 to get a +particular floating\-point register. For example, to access +f2, +the index UNW_IA64_FR+2 +should be +used. Registers f0 +and f1 +are read\-only, and any +attempt to write to indices UNW_IA64_FR+0 +or +UNW_IA64_FR+1 +will result in an error +(\-UNW_EREADONLYREG). +.TP +UNW_IA64_AR: + The base\-index for application +registers. Add an index in the range from 0..127 to get a +particular application register. For example, to access +ar40, +the index UNW_IA64_AR+40 +should be +used. The IA\-64 architecture defines several application registers +as ``reserved for future use\&''\&. Attempting to access such registers +results in an error (\-UNW_EBADREG). +.TP +UNW_IA64_BR: + The base\-index for branch registers. +Add an index in the range from 0..7 to get a particular branch +register. For example, to access b6, +the index +UNW_IA64_BR+6 +should be used. +.TP +UNW_IA64_PR: + Contains the set of predicate registers. +This 64\-bit wide register contains registers p0 +through +p63 +in the ``broad\-side\&'' format. Just like with the +``move predicates\&'' instruction, the registers are mapped as if +CFM.rrb.pr +were set to 0. Thus, in general the value of +predicate register pN +with N>=16 can be found +in bit 16 + ((N\-16)+CFM.rrb.pr) % 48\&. +.TP +UNW_IA64_CFM: + Contains the current\-frame\-mask +register. +.PP +.SS CONVENIENCE MACROS +.PP +Convenience macros are simply aliases for certain frequently used +registers: +.TP +UNW_IA64_GP: + Alias for UNW_IA64_GR+1, +the global\-pointer register. +.TP +UNW_IA64_TP: + Alias for UNW_IA64_GR+13, +the thread\-pointer register. +.TP +UNW_IA64_AR_RSC: + Alias for UNW_IA64_GR+16, +the register\-stack configuration register. +.TP +UNW_IA64_AR_BSP: + Alias for +UNW_IA64_GR+17\&. +This register index accesses the +value of register ar.bsp +as of the time it was last saved +explicitly. This is rarely what you want. Normally, you\&'ll want to +use UNW_IA64_BSP +instead. +.TP +UNW_IA64_AR_BSPSTORE: + Alias for UNW_IA64_GR+18, +the register\-backing store write pointer. +.TP +UNW_IA64_AR_RNAT: + Alias for UNW_IA64_GR+19, +the register\-backing store NaT\-collection register. +.TP +UNW_IA64_AR_CCV: + Alias for UNW_IA64_GR+32, +the compare\-and\-swap value register. +.TP +UNW_IA64_AR_CSD: + Alias for UNW_IA64_GR+25, +the compare\-and\-swap\-data register (used by 16\-byte atomic operations). +.TP +UNW_IA64_AR_UNAT: + Alias for UNW_IA64_GR+36, +the user NaT\-collection register. +.TP +UNW_IA64_AR_FPSR: + Alias for UNW_IA64_GR+40, +the floating\-point status (and control) register. +.TP +UNW_IA64_AR_PFS: + Alias for UNW_IA64_GR+64, +the previous frame\-state register. +.TP +UNW_IA64_AR_LC: + Alias for UNW_IA64_GR+65 +the loop\-count register. +.TP +UNW_IA64_AR_EC: + Alias for UNW_IA64_GR+66, +the epilogue\-count register. +.PP +.SH THE UNWIND\-CONTEXT TYPE + +.PP +On IA\-64, unw_context_t +is simply an alias for +ucontext_t +(as defined by the Single UNIX Spec). This implies +that it is possible to initialize a value of this type not just with +unw_getcontext(), +but also with getcontext(), +for +example. However, since this is an IA\-64\-specific extension to +libunwind, +portable code should not rely on this equivalence. +.PP +.SH SEE ALSO + +.PP +libunwind(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-ia64.tex b/sdk/cpprt/linux/libunwind/doc/libunwind-ia64.tex new file mode 100644 index 0000000000..c08946dc4b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-ia64.tex @@ -0,0 +1,216 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{libunwind-ia64}{David Mosberger-Tang}{Programming Library}{IA-64-specific support in libunwind}libunwind-ia64 -- IA-64-specific support in libunwind +\end{Name} + + +\section{Introduction} + +The IA-64 version of \Prog{libunwind} uses a platform-string of +\texttt{ia64} and, at least in theory, should be able to support all +operating systems adhering to the processor-specific ABI defined for +the Itanium Processor Family. This includes both little-endian Linux +and big-endian HP-UX. Furthermore, to make it possible for a single +library to unwind both 32- and 64-bit targets, the type +\Type{unw\_word\_t} is always defined to be 64 bits wide (independent +of the natural word-size of the host). Having said that, the current +implementation has been tested only with IA-64 Linux. + +When targeting IA-64, the \Prog{libunwind} header file defines the +macro \Const{UNW\_TARGET\_IA64} as 1 and the macro \Const{UNW\_TARGET} +as ``ia64'' (without the quotation marks). The former makes it +possible for platform-dependent unwind code to use +conditional-compilation to select an appropriate implementation. The +latter is useful for stringification purposes and to construct +target-platform-specific symbols. + +One special feature of IA-64 is the use of NaT bits to support +speculative execution. Often, NaT bits are thought of as the ``65-th +bit'' of a general register. However, to make everything fit into +64-bit wide \Type{unw\_word\_t} values, \Prog{libunwind} treats the +NaT-bits like separate boolean registers, whose 64-bit value is either +TRUE (non-zero) or FALSE (zero). + + +\section{Machine-State} + +The machine-state (set of registers) that is accessible through +\Prog{libunwind} depends on the type of stack frame that a cursor +points to. For normal frames, all ``preserved'' (callee-saved) +registers are accessible. For signal-trampoline frames, all registers +(including ``scratch'' (caller-saved) registers) are accessible. Most +applications do not have to worry a-priori about which registers are +accessible when. In case of doubt, it is always safe to \emph{try} to +access a register (via \Func{unw\_get\_reg}() or +\Func{unw\_get\_fpreg}()) and if the register isn't accessible, the +call will fail with a return-value of \texttt{-}\Const{UNW\_EBADREG}. + +As a special exception to the above general rule, scratch registers +\texttt{r15}-\texttt{r18} are always accessible, even in normal +frames. This makes it possible to pass arguments, e.g., to exception +handlers. + +For a detailed description of the IA-64 register usage convention, +please see the ``Itanium Software Conventions and Runtime Architecture +Guide'', available at: +\begin{center} + \URL{http://www.intel.com/design/itanium/downloads/245358.htm} +\end{center} + + +\section{Register Names} + +The IA-64-version of \Prog{libunwind} defines three kinds of register +name macros: frame-register macros, normal register macros, and +convenience macros. Below, we describe each kind in turn: + + +\subsection{Frame-register Macros} + +Frame-registers are special (pseudo) registers because they always +have a valid value, even though sometimes they do not get saved +explicitly (e.g., if a memory stack frame is 16 bytes in size, the +previous stack-pointer value can be calculated simply as +\texttt{sp+16}, so there is no need to save the stack-pointer +explicitly). Moreover, the set of frame register values uniquely +identifies a stack frame. The IA-64 architecture defines two stacks +(a memory and a register stack). Including the instruction-pointer +(IP), this means there are three frame registers: +\begin{Description} +\item[\Const{UNW\_IA64\_IP}:] Contains the instruction pointer (IP, or + ``program counter'') of the current stack frame. Given this value, + the remaining machine-state corresponds to the register-values that + were present in the CPU when it was just about to execute the + instruction pointed to by \Const{UNW\_IA64\_IP}. Bits 0 and 1 of + this frame-register encode the slot number of the instruction. + \textbf{Note:} Due to the way the call instruction works on IA-64, + the slot number is usually zero, but can be non-zero, e.g., in the + stack-frame of a signal-handler trampoline. +\item[\Const{UNW\_IA64\_SP}:] Contains the (memory) stack-pointer + value (SP). +\item[\Const{UNW\_IA64\_BSP}:] Contains the register backing-store + pointer (BSP). \textbf{Note:} the value in this register is equal + to the contents of register \texttt{ar.bsp} at the time the + instruction at \Const{UNW\_IA64\_IP} was about to begin execution. +\end{Description} + + +\subsection{Normal Register Macros} + +The following normal register name macros are available: +\begin{Description} +\item[\Const{UNW\_IA64\_GR}:] The base-index for general (integer) + registers. Add an index in the range from 0..127 to get a + particular general register. For example, to access \texttt{r4}, + the index \Const{UNW\_IA64\_GR}\texttt{+4} should be used. + Registers \texttt{r0} and \texttt{r1} (\texttt{gp}) are read-only, + and any attempt to write them will result in an error + (\texttt{-}\Const{UNW\_EREADONLYREG}). Even though \texttt{r1} is + read-only, \Prog{libunwind} will automatically adjust its value if + the instruction-pointer (\Const{UNW\_IA64\_IP}) is modified. For + example, if \Const{UNW\_IA64\_IP} is set to a value inside a + function \Func{func}(), then reading + \Const{UNW\_IA64\_GR}\texttt{+1} will return the global-pointer + value for this function. +\item[\Const{UNW\_IA64\_NAT}:] The base-index for the NaT bits of the + general (integer) registers. A non-zero value in these registers + corresponds to a set NaT-bit. Add an index in the range from 0..127 + to get a particular NaT-bit register. For example, to access the + NaT bit of \texttt{r4}, the index \Const{UNW\_IA64\_NAT}\texttt{+4} + should be used. +\item[\Const{UNW\_IA64\_FR}:] The base-index for floating-point + registers. Add an index in the range from 0..127 to get a + particular floating-point register. For example, to access + \texttt{f2}, the index \Const{UNW\_IA64\_FR}\texttt{+2} should be + used. Registers \texttt{f0} and \texttt{f1} are read-only, and any + attempt to write to indices \Const{UNW\_IA64\_FR}\texttt{+0} or + \Const{UNW\_IA64\_FR}\texttt{+1} will result in an error + (\texttt{-}\Const{UNW\_EREADONLYREG}). +\item[\Const{UNW\_IA64\_AR}:] The base-index for application + registers. Add an index in the range from 0..127 to get a + particular application register. For example, to access + \texttt{ar40}, the index \Const{UNW\_IA64\_AR}\texttt{+40} should be + used. The IA-64 architecture defines several application registers + as ``reserved for future use''. Attempting to access such registers + results in an error (\texttt{-}\Const{UNW\_EBADREG}). +\item[\Const{UNW\_IA64\_BR}:] The base-index for branch registers. + Add an index in the range from 0..7 to get a particular branch + register. For example, to access \texttt{b6}, the index + \Const{UNW\_IA64\_BR}\texttt{+6} should be used. +\item[\Const{UNW\_IA64\_PR}:] Contains the set of predicate registers. + This 64-bit wide register contains registers \texttt{p0} through + \texttt{p63} in the ``broad-side'' format. Just like with the + ``move predicates'' instruction, the registers are mapped as if + \texttt{CFM.rrb.pr} were set to 0. Thus, in general the value of + predicate register \texttt{p}$N$ with $N$>=16 can be found + in bit \texttt{16 + (($N$-16)+CFM.rrb.pr) \% 48}. +\item[\Const{UNW\_IA64\_CFM}:] Contains the current-frame-mask + register. +\end{Description} + + +\subsection{Convenience Macros} + +Convenience macros are simply aliases for certain frequently used +registers: +\begin{Description} +\item[\Const{UNW\_IA64\_GP}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+1}, + the global-pointer register. +\item[\Const{UNW\_IA64\_TP}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+13}, + the thread-pointer register. +\item[\Const{UNW\_IA64\_AR\_RSC}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+16}, + the register-stack configuration register. +\item[\Const{UNW\_IA64\_AR\_BSP}:] Alias for + \Const{UNW\_IA64\_GR}\texttt{+17}. This register index accesses the + value of register \texttt{ar.bsp} as of the time it was last saved + explicitly. This is rarely what you want. Normally, you'll want to + use \Const{UNW\_IA64\_BSP} instead. +\item[\Const{UNW\_IA64\_AR\_BSPSTORE}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+18}, + the register-backing store write pointer. +\item[\Const{UNW\_IA64\_AR\_RNAT}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+19}, + the register-backing store NaT-collection register. +\item[\Const{UNW\_IA64\_AR\_CCV}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+32}, + the compare-and-swap value register. +\item[\Const{UNW\_IA64\_AR\_CSD}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+25}, + the compare-and-swap-data register (used by 16-byte atomic operations). +\item[\Const{UNW\_IA64\_AR\_UNAT}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+36}, + the user NaT-collection register. +\item[\Const{UNW\_IA64\_AR\_FPSR}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+40}, + the floating-point status (and control) register. +\item[\Const{UNW\_IA64\_AR\_PFS}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+64}, + the previous frame-state register. +\item[\Const{UNW\_IA64\_AR\_LC}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+65} + the loop-count register. +\item[\Const{UNW\_IA64\_AR\_EC}:] Alias for \Const{UNW\_IA64\_GR}\texttt{+66}, + the epilogue-count register. +\end{Description} + + +\section{The Unwind-Context Type} + +On IA-64, \Type{unw\_context\_t} is simply an alias for +\Type{ucontext\_t} (as defined by the Single UNIX Spec). This implies +that it is possible to initialize a value of this type not just with +\Func{unw\_getcontext}(), but also with \Func{getcontext}(), for +example. However, since this is an IA-64-specific extension to +\Prog{libunwind}, portable code should not rely on this equivalence. + + +\section{See Also} + +\SeeAlso{libunwind(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.man b/sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.man new file mode 100644 index 0000000000..985fcae275 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.man @@ -0,0 +1,220 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "LIBUNWIND\-PTRACE" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +libunwind\-ptrace +\-\- ptrace() support in libunwind +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +unw_accessors_t +_UPT_accessors; +.br +.PP +void *_UPT_create(pid_t); +.br +void +_UPT_destroy(void *); +.br +.PP +int +_UPT_find_proc_info(unw_addr_space_t, +unw_word_t, +unw_proc_info_t *, +int, +void *); +.br +void +_UPT_put_unwind_info(unw_addr_space_t, +unw_proc_info_t *, +void *); +.br +int +_UPT_get_dyn_info_list_addr(unw_addr_space_t, +unw_word_t *, +void *); +.br +int +_UPT_access_mem(unw_addr_space_t, +unw_word_t, +unw_word_t *, +int, +void *); +.br +int +_UPT_access_reg(unw_addr_space_t, +unw_regnum_t, +unw_word_t *, +int, +void *); +.br +int +_UPT_access_fpreg(unw_addr_space_t, +unw_regnum_t, +unw_fpreg_t *, +int, +void *); +.br +int +_UPT_get_proc_name(unw_addr_space_t, +unw_word_t, +char *, +size_t, +unw_word_t *, +void *); +.br +int +_UPT_resume(unw_addr_space_t, +unw_cursor_t *, +void *); +.br +.PP +.SH DESCRIPTION + +.PP +The ptrace(2) +system\-call makes it possible for a process to +gain access to the machine\-state and virtual memory of \fIanother\fP +process. With the right set of call\-back routines, it is therefore +possible to hook up libunwind +to another process via +ptrace(2). +While it\&'s not very difficult to do so directly, +libunwind +further facilitates this task by providing +ready\-to\-use callbacks for this purpose. The routines and variables +implementing this facility use a name\-prefix of _UPT, +which is +stands for ``unwind\-via\-ptrace\&''\&. +.PP +An application that wants to use the _UPT\-facility +first needs +to create a new libunwind +address\-space that represents the +target process. This is done by calling +unw_create_addr_space(). +In many cases, the application +will simply want to pass the address of _UPT_accessors +as the +first argument to this routine. Doing so will ensure that +libunwind +will be able to properly unwind the target process. +However, in special circumstances, an application may prefer to use +only portions of the _UPT\-facility. +For this reason, the +individual callback routines (_UPT_find_proc_info(), +_UPT_put_unwind_info(), +etc.) are also available for direct +use. Of course, the addresses of these routines could also be picked +up from _UPT_accessors, +but doing so would prevent static +initialization. Also, when using _UPT_accessors, +\fIall\fP +the callback routines will be linked into the application, even if +they are never actually called. +.PP +Next, the application can turn on ptrace\-mode on the target process, +either by forking a new process, invoking PTRACE_TRACEME, +and +then starting the target program (via execve(2)), +or by +directly attaching to an already running process (via +PTRACE_ATTACH). +Either way, once the process\-ID (pid) of the +target process is known, a _UPT\-info\-structure +can be created +by calling _UPT_create(), +passing the pid of the target process +as the only argument. The returned void\-pointer then needs to be +passed as the ``argument\&'' pointer (third argument) to +unw_init_remote(). +.PP +The _UPT_resume() +routine can be used to resume execution of +the target process. It simply invokes ptrace(2) +with a command +value of PTRACE_CONT\&. +.PP +When the application is done using libunwind +on the target +process, _UPT_destroy() +needs to be called, passing it the +void\-pointer that was returned by the corresponding call to +_UPT_create(). +This ensures that all memory and other +resources are freed up. +.PP +.SH AVAILABILITY + +.PP +Since ptrace(2) +works within a single machine only, the +_UPT\-facility +by definition is not available in +libunwind\-versions +configured for cross\-unwinding. +.PP +.SH THREAD SAFETY + +.PP +The _UPT\-facility +assumes that a single _UPT\-info +structure is never shared between threads. Because of this, no +explicit locking is used. As long as only one thread uses +a _UPT\-info +structure at any given time, this facility +is thread\-safe. +.PP +.SH RETURN VALUE + +.PP +_UPT_create() +may return a NULL +pointer if it fails +to create the _UPT\-info\-structure +for any reason. For the +current implementation, the only reason this call may fail is when the +system is out of memory. +.PP +.SH FILES + +.PP +.TP +libunwind\-ptrace.h + Headerfile to include when using the +interface defined by this library. +.TP +\fB\-l\fPunwind\-ptrace \fB\-l\fPunwind\-generic + Linker\-switches to add when building a program that uses the +functions defined by this library. +.PP +.SH SEE ALSO + +.PP +execve(2), +libunwind(3), +ptrace(2) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.tex b/sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.tex new file mode 100644 index 0000000000..fe074d8619 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-ptrace.tex @@ -0,0 +1,134 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{libunwind-ptrace}{David Mosberger-Tang}{Programming Library}{ptrace() support in libunwind}libunwind-ptrace -- ptrace() support in libunwind +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind-ptrace.h$>$}\\ + +\noindent +\Type{unw\_accessors\_t} \Var{\_UPT\_accessors};\\ + +\Type{void~*}\Func{\_UPT\_create}(\Type{pid\_t});\\ +\noindent +\Type{void} \Func{\_UPT\_destroy}(\Type{void~*});\\ + +\noindent +\Type{int} \Func{\_UPT\_find\_proc\_info}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{unw\_proc\_info\_t~*}, \Type{int}, \Type{void~*});\\ +\noindent +\Type{void} \Func{\_UPT\_put\_unwind\_info}(\Type{unw\_addr\_space\_t}, \Type{unw\_proc\_info\_t~*}, \Type{void~*});\\ +\noindent +\Type{int} \Func{\_UPT\_get\_dyn\_info\_list\_addr}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t~*}, \Type{void~*});\\ +\noindent +\Type{int} \Func{\_UPT\_access\_mem}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{unw\_word\_t~*}, \Type{int}, \Type{void~*});\\ +\noindent +\Type{int} \Func{\_UPT\_access\_reg}(\Type{unw\_addr\_space\_t}, \Type{unw\_regnum\_t}, \Type{unw\_word\_t~*}, \Type{int}, \Type{void~*});\\ +\noindent +\Type{int} \Func{\_UPT\_access\_fpreg}(\Type{unw\_addr\_space\_t}, \Type{unw\_regnum\_t}, \Type{unw\_fpreg\_t~*}, \Type{int}, \Type{void~*});\\ +\noindent +\Type{int} \Func{\_UPT\_get\_proc\_name}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{char~*}, \Type{size\_t}, \Type{unw\_word\_t~*}, \Type{void~*});\\ +\noindent +\Type{int} \Func{\_UPT\_resume}(\Type{unw\_addr\_space\_t}, \Type{unw\_cursor\_t~*}, \Type{void~*});\\ + +\section{Description} + +The \Func{ptrace}(2) system-call makes it possible for a process to +gain access to the machine-state and virtual memory of \emph{another} +process. With the right set of call-back routines, it is therefore +possible to hook up \Prog{libunwind} to another process via +\Func{ptrace}(2). While it's not very difficult to do so directly, +\Prog{libunwind} further facilitates this task by providing +ready-to-use callbacks for this purpose. The routines and variables +implementing this facility use a name-prefix of \Func{\_UPT}, which is +stands for ``unwind-via-ptrace''. + +An application that wants to use the \Func{\_UPT}-facility first needs +to create a new \Prog{libunwind} address-space that represents the +target process. This is done by calling +\Func{unw\_create\_addr\_space}(). In many cases, the application +will simply want to pass the address of \Var{\_UPT\_accessors} as the +first argument to this routine. Doing so will ensure that +\Prog{libunwind} will be able to properly unwind the target process. +However, in special circumstances, an application may prefer to use +only portions of the \Prog{\_UPT}-facility. For this reason, the +individual callback routines (\Func{\_UPT\_find\_proc\_info}(), +\Func{\_UPT\_put\_unwind\_info}(), etc.) are also available for direct +use. Of course, the addresses of these routines could also be picked +up from \Var{\_UPT\_accessors}, but doing so would prevent static +initialization. Also, when using \Var{\_UPT\_accessors}, \emph{all} +the callback routines will be linked into the application, even if +they are never actually called. + +Next, the application can turn on ptrace-mode on the target process, +either by forking a new process, invoking \Const{PTRACE\_TRACEME}, and +then starting the target program (via \Func{execve}(2)), or by +directly attaching to an already running process (via +\Const{PTRACE\_ATTACH}). Either way, once the process-ID (pid) of the +target process is known, a \Prog{\_UPT}-info-structure can be created +by calling \Func{\_UPT\_create}(), passing the pid of the target process +as the only argument. The returned void-pointer then needs to be +passed as the ``argument'' pointer (third argument) to +\Func{unw\_init\_remote}(). + +The \Func{\_UPT\_resume}() routine can be used to resume execution of +the target process. It simply invokes \Func{ptrace}(2) with a command +value of \Const{PTRACE\_CONT}. + +When the application is done using \Prog{libunwind} on the target +process, \Func{\_UPT\_destroy}() needs to be called, passing it the +void-pointer that was returned by the corresponding call to +\Func{\_UPT\_create}(). This ensures that all memory and other +resources are freed up. + +\section{Availability} + +Since \Func{ptrace}(2) works within a single machine only, the +\Prog{\_UPT}-facility by definition is not available in +\Prog{libunwind}-versions configured for cross-unwinding. + +\section{Thread Safety} + +The \Prog{\_UPT}-facility assumes that a single \Prog{\_UPT}-info +structure is never shared between threads. Because of this, no +explicit locking is used. As long as only one thread uses +a \Prog{\_UPT}-info structure at any given time, this facility +is thread-safe. + +\section{Return Value} + +\Func{\_UPT\_create}() may return a \Const{NULL} pointer if it fails +to create the \Prog{\_UPT}-info-structure for any reason. For the +current implementation, the only reason this call may fail is when the +system is out of memory. + +\section{Files} + +\begin{Description} +\item[\File{libunwind-ptrace.h}] Headerfile to include when using the + interface defined by this library. +\item[\Opt{-l}\File{unwind-ptrace} \Opt{-l}\File{unwind-generic}] + Linker-switches to add when building a program that uses the + functions defined by this library. +\end{Description} + +\section{See Also} + +execve(2), +\SeeAlso{libunwind(3)}, +ptrace(2) + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.man b/sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.man new file mode 100644 index 0000000000..e8b9de82c7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.man @@ -0,0 +1,132 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "LIBUNWIND\-SETJMP" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +libunwind\-setjmp +\-\- libunwind\-based non\-local gotos +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +setjmp(jmp_buf env); +.br +void +longjmp(jmp_buf env, +int val); +.br +int +_setjmp(jmp_buf env); +.br +void +_longjmp(jmp_buf env, +int val); +.br +int +setjmp(sigjmp_buf env, +int savemask); +.br +void +siglongjmp(sigjmp_buf env, +int val); +.br +.PP +.SH DESCRIPTION + +.PP +The unwind\-setjmp +library offers a libunwind\-based +implementation of non\-local gotos. This implementation is intended to +be a drop\-in replacement for the normal, system\-provided routines of +the same name. The main advantage of using the unwind\-setjmp +library is that setting up a non\-local goto via one of the +setjmp() +routines is very fast. Typically, just 2 or 3 words +need to be saved in the jump\-buffer (plus one call to +sigprocmask(2), +in the case of sigsetjmp). +On the +other hand, executing a non\-local goto by calling one of the +longjmp() +routines tends to be much slower than with the +system\-provided routines. In fact, the time spent on a +longjmp() +will be proportional to the number of call frames +that exist between the points where setjmp() +and +longjmp() +were called. For this reason, the +unwind\-setjmp +library is beneficial primarily in applications +that frequently call setjmp() +but only rarely call +longjmp(). +.PP +.SH CAVEATS + +.PP +.TP +.B * +The correct operation of this library depends on the presence of +correct unwind information. On newer platforms, this is rarely an +issue. On older platforms, care needs to be taken to +ensure that each of the functions whose stack frames may have to be +unwound during a longjmp() +have correct unwind information +(on those platforms, there is usually a compiler\-switch, such as +\fB\-funwind\-tables\fP, +to request the generation of unwind +information). +.TP +.B * +The contents of jmp_buf and sigjmp_buf as setup +and used by these routines is completely different from the ones +used by the system\-provided routines. Thus, a jump\-buffer created +by the libunwind\-based setjmp()/_setjmp +may only be +used in a call to the libunwind\-based +longjmp()/_longjmp(). +The analogous applies for +sigjmp_buf +with sigsetjmp() +and siglongjmp(). +.PP +.SH FILES + +.PP +.TP +\fB\-l\fPunwind\-setjmp + The library an application should +be linked against to ensure it uses the libunwind\-based non\-local +goto routines. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +setjmp(3), longjmp(3), +_setjmp(3), _longjmp(3), +sigsetjmp(3), siglongjmp(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.tex b/sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.tex new file mode 100644 index 0000000000..b31ee9e589 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind-setjmp.tex @@ -0,0 +1,87 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{libunwind-setjmp}{David Mosberger-Tang}{Programming Library}{libunwind-based non-local gotos}libunwind-setjmp -- libunwind-based non-local gotos +\end{Name} + +\section{Synopsis} + +\File{\#include $<$setjmp.h$>$}\\ + +\noindent +\Type{int} \Func{setjmp}(\Type{jmp\_buf}~\Var{env});\\ +\Type{void} \Func{longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\ +\Type{int} \Func{\_setjmp}(\Type{jmp\_buf}~\Var{env});\\ +\Type{void} \Func{\_longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\ +\Type{int} \Func{setjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{savemask});\\ +\Type{void} \Func{siglongjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\ + +\section{Description} + +The \Prog{unwind-setjmp} library offers a \Prog{libunwind}-based +implementation of non-local gotos. This implementation is intended to +be a drop-in replacement for the normal, system-provided routines of +the same name. The main advantage of using the \Prog{unwind-setjmp} +library is that setting up a non-local goto via one of the +\Func{setjmp}() routines is very fast. Typically, just 2 or 3 words +need to be saved in the jump-buffer (plus one call to +\Func{sigprocmask}(2), in the case of \Func{sigsetjmp}). On the +other hand, executing a non-local goto by calling one of the +\Func{longjmp}() routines tends to be much slower than with the +system-provided routines. In fact, the time spent on a +\Func{longjmp}() will be proportional to the number of call frames +that exist between the points where \Func{setjmp}() and +\Func{longjmp}() were called. For this reason, the +\Prog{unwind-setjmp} library is beneficial primarily in applications +that frequently call \Func{setjmp}() but only rarely call +\Func{longjmp}(). + +\section{Caveats} + +\begin{itemize} +\item The correct operation of this library depends on the presence of + correct unwind information. On newer platforms, this is rarely an + issue. On older platforms, care needs to be taken to + ensure that each of the functions whose stack frames may have to be + unwound during a \Func{longjmp}() have correct unwind information + (on those platforms, there is usually a compiler-switch, such as + \Opt{-funwind-tables}, to request the generation of unwind + information). +\item The contents of \Type{jmp\_buf} and \Type{sigjmp\_buf} as setup + and used by these routines is completely different from the ones + used by the system-provided routines. Thus, a jump-buffer created + by the libunwind-based \Func{setjmp}()/\Func{\_setjmp} may only be + used in a call to the libunwind-based + \Func{longjmp}()/\Func{\_longjmp}(). The analogous applies for + \Type{sigjmp\_buf} with \Func{sigsetjmp}() and \Func{siglongjmp}(). +\end{itemize} + +\section{Files} + +\begin{Description} +\item[\Opt{-l}\File{unwind-setjmp}] The library an application should + be linked against to ensure it uses the libunwind-based non-local + goto routines. +\end{Description} + + +\section{See Also} + +\SeeAlso{libunwind(3)}, +setjmp(3), longjmp(3), +\_setjmp(3), \_longjmp(3), +sigsetjmp(3), siglongjmp(3) + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind.man b/sdk/cpprt/linux/libunwind/doc/libunwind.man new file mode 100644 index 0000000000..c6046e2833 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind.man @@ -0,0 +1,500 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:43 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "LIBUNWIND" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +libunwind +\-\- a (mostly) platform\-independent unwind API +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_getcontext(unw_context_t *); +.br +int +unw_init_local(unw_cursor_t *, +unw_context_t *); +.br +int +unw_init_remote(unw_cursor_t *, +unw_addr_space_t, +void *); +.br +int +unw_step(unw_cursor_t *); +.br +int +unw_get_reg(unw_cursor_t *, +unw_regnum_t, +unw_word_t *); +.br +int +unw_get_fpreg(unw_cursor_t *, +unw_regnum_t, +unw_fpreg_t *); +.br +int +unw_set_reg(unw_cursor_t *, +unw_regnum_t, +unw_word_t); +.br +int +unw_set_fpreg(unw_cursor_t *, +unw_regnum_t, +unw_fpreg_t); +.br +int +unw_resume(unw_cursor_t *); +.br +.PP +unw_addr_space_t +unw_local_addr_space; +.br +unw_addr_space_t +unw_create_addr_space(unw_accessors_t, +int); +.br +void +unw_destroy_addr_space(unw_addr_space_t); +.br +unw_accessors_t +unw_get_accessors(unw_addr_space_t); +.br +void +unw_flush_cache(unw_addr_space_t, +unw_word_t, +unw_word_t); +.br +int +unw_set_caching_policy(unw_addr_space_t, +unw_caching_policy_t); +.br +.PP +const char *unw_regname(unw_regnum_t); +.br +int +unw_get_proc_info(unw_cursor_t *, +unw_proc_info_t *); +.br +int +unw_get_save_loc(unw_cursor_t *, +int, +unw_save_loc_t *); +.br +int +unw_is_fpreg(unw_regnum_t); +.br +int +unw_is_signal_frame(unw_cursor_t *); +.br +int +unw_get_proc_name(unw_cursor_t *, +char *, +size_t, +unw_word_t *); +.br +.PP +void +_U_dyn_register(unw_dyn_info_t *); +.br +void +_U_dyn_cancel(unw_dyn_info_t *); +.br +.PP +.SH LOCAL UNWINDING + +.PP +Libunwind +is very easy to use when unwinding a stack from +within a running program. This is called \fIlocal\fP +unwinding. Say +you want to unwind the stack while executing in some function +F(). +In this function, you would call unw_getcontext() +to get a snapshot of the CPU registers (machine\-state). Then you +initialize an \fIunwind cursor\fP +based on this snapshot. This is +done with a call to unw_init_local(). +The cursor now points +to the current frame, that is, the stack frame that corresponds to the +current activation of function F(). +The unwind cursor can then +be moved ``up\&'' (towards earlier stack frames) by calling +unw_step(). +By repeatedly calling this routine, you can +uncover the entire call\-chain that led to the activation of function +F(). +A positive return value from unw_step() +indicates +that there are more frames in the chain, zero indicates that the end +of the chain has been reached, and any negative value indicates that +some sort of error has occurred. +.PP +While it is not possible to directly move the unwind cursor in the +``down\&'' direction (towards newer stack frames), this effect can be +achieved by making copies of an unwind cursor. For example, a program +that sometimes has to move ``down\&'' by one stack frame could maintain +two cursor variables: ``curr\&'' +and ``prev\&''\&. +The former +would be used as the current cursor and prev +would be maintained +as the ``previous frame\&'' cursor by copying the contents of curr +to prev +right before calling unw_step(). +With this +approach, the program could move one step ``down\&'' simply by copying +back prev +to curr +whenever that is necessary. In the most +extreme case, a program could maintain a separate cursor for each call +frame and that way it could move up and down the callframe\-chain at +will. +.PP +Given an unwind cursor, it is possible to read and write the CPU +registers that were preserved for the current stack frame (as +identified by the cursor). Libunwind +provides several routines +for this purpose: unw_get_reg() +reads an integer (general) +register, unw_get_fpreg() +reads a floating\-point register, +unw_set_reg() +writes an integer register, and +unw_set_fpreg() +writes a floating\-point register. Note that, +by definition, only the \fIpreserved\fP +machine state can be accessed +during an unwind operation. Normally, this state consists of the +\fIcallee\-saved\fP +(``preserved\&'') registers. However, in some +special circumstances (e.g., in a signal handler trampoline), even the +\fIcaller\-saved\fP +(``scratch\&'') registers are preserved in the stack +frame and, in those cases, libunwind +will grant access to them +as well. The exact set of registers that can be accessed via the +cursor depends, of course, on the platform. However, there are two +registers that can be read on all platforms: the instruction pointer +(IP), sometimes also known as the ``program counter\&'', and the stack +pointer (SP). In libunwind, +these registers are identified by +the macros UNW_REG_IP +and UNW_REG_SP, +respectively. +.PP +Besides just moving the unwind cursor and reading/writing saved +registers, libunwind +also provides the ability to resume +execution at an arbitrary stack frame. As you might guess, this is +useful for implementing non\-local gotos and the exception handling +needed by some high\-level languages such as Java. Resuming execution +with a particular stack frame simply requires calling +unw_resume() +and passing the cursor identifying the target +frame as the only argument. +.PP +Normally, libunwind +supports both local and remote unwinding +(the latter will be explained in the next section). However, if you +tell libunwind that your program only needs local unwinding, then a +special implementation can be selected which may run much faster than +the generic implementation which supports both kinds of unwinding. To +select this optimized version, simply define the macro +UNW_LOCAL_ONLY +before including the headerfile +\&. +It is perfectly OK for a single program to +employ both local\-only and generic unwinding. That is, whether or not +UNW_LOCAL_ONLY +is defined is a choice that each source\-file +(compilation\-unit) can make on its own. Independent of the setting(s) +of UNW_LOCAL_ONLY, +you\&'ll always link the same library into +the program (normally \fB\-l\fPunwind). +Furthermore, the +portion of libunwind +that manages unwind\-info for dynamically +generated code is not affected by the setting of +UNW_LOCAL_ONLY\&. +.PP +If we put all of the above together, here is how we could use +libunwind +to write a function ``show_backtrace()\&'' +which prints a classic stack trace: +.PP +.Vb +#define UNW_LOCAL_ONLY +#include + +void show_backtrace (void) { + unw_cursor_t cursor; unw_context_t uc; + unw_word_t ip, sp; + + unw_getcontext(&uc); + unw_init_local(&cursor, &uc); + while (unw_step(&cursor) > 0) { + unw_get_reg(&cursor, UNW_REG_IP, &ip); + unw_get_reg(&cursor, UNW_REG_SP, &sp); + printf ("ip = %lx, sp = %lx\\n", (long) ip, (long) sp); + } +} +.Ve +.PP +.SH REMOTE UNWINDING + +.PP +Libunwind +can also be used to unwind a stack in a ``remote\&'' +process. Here, ``remote\&'' may mean another process on the same +machine or even a process on a completely different machine from the +one that is running libunwind\&. +Remote unwinding is typically +used by debuggers and instruction\-set simulators, for example. +.PP +Before you can unwind a remote process, you need to create a new +address\-space object for that process. This is achieved with the +unw_create_addr_space() +routine. The routine takes two +arguments: a pointer to a set of \fIaccessor\fP +routines and an +integer that specifies the byte\-order of the target process. The +accessor routines provide libunwind +with the means to +communicate with the remote process. In particular, there are +callbacks to read and write the process\&'s memory, its registers, and +to access unwind information which may be needed by libunwind\&. +.PP +With the address space created, unwinding can be initiated by a call +to unw_init_remote(). +This routine is very similar to +unw_init_local(), +except that it takes an address\-space +object and an opaque pointer as arguments. The routine uses these +arguments to fetch the initial machine state. Libunwind +never +uses the opaque pointer on its own, but instead just passes it on to +the accessor (callback) routines. Typically, this pointer is used to +select, e.g., the thread within a process that is to be unwound. +.PP +Once a cursor has been initialized with unw_init_remote(), +unwinding works exactly like in the local case. That is, you can use +unw_step() +to move ``up\&'' in the call\-chain, read and write +registers, or resume execution at a particular stack frame by calling +unw_resume\&. +.PP +.SH CROSS\-PLATFORM AND MULTI\-PLATFORM UNWINDING + +.PP +Libunwind +has been designed to enable unwinding across +platforms (architectures). Indeed, a single program can use +libunwind +to unwind an arbitrary number of target platforms, +all at the same time! +.PP +We call the machine that is running libunwind +the \fIhost\fP +and the machine that is running the process being unwound the +\fItarget\fP\&. +If the host and the target platform are the same, we +call it \fInative\fP +unwinding. If they differ, we call it +\fIcross\-platform\fP +unwinding. +.PP +The principle behind supporting native, cross\-platform, and +multi\-platform unwinding is very simple: for native unwinding, a +program includes +and uses the linker switch +\fB\-l\fPunwind\&. +For cross\-platform unwinding, a program +includes +and uses the linker +switch \fB\-l\fPunwind\-PLAT, +where PLAT +is the name +of the target platform (e.g., ia64 +for IA\-64, hppa\-elf +for ELF\-based HP PA\-RISC, or x86 +for 80386). Multi\-platform +unwinding works exactly like cross\-platform unwinding, the only +limitation is that a single source file (compilation unit) can include +at most one libunwind +header file. In other words, the +platform\-specific support for each supported target needs to be +isolated in separate source files\-\-\-a limitation that shouldn\&'t be an +issue in practice. +.PP +Note that, by definition, local unwinding is possible only for the +native case. Attempting to call, e.g., unw_local_init() +when +targeting a cross\-platform will result in a link\-time error +(unresolved references). +.PP +.SH THREAD\- AND SIGNAL\-SAFETY + +.PP +All libunwind +routines are thread\-safe. What this means is +that multiple threads may use libunwind +simulatenously. +However, any given cursor may be accessed by only one thread at +any given time. +.PP +To ensure thread\-safety, some libunwind +routines may have to +use locking. Such routines \fImust not\fP +be called from signal +handlers (directly or indirectly) and are therefore \fInot\fP +signal\-safe. The manual page for each libunwind +routine +identifies whether or not it is signal\-safe, but as a general rule, +any routine that may be needed for \fIlocal\fP +unwinding is +signal\-safe (e.g., unw_step() +for local unwinding is +signal\-safe). For remote\-unwinding, \fInone\fP +of the +libunwind +routines are guaranteed to be signal\-safe. +.PP +.SH UNWINDING THROUGH DYNAMICALLY GENERATED CODE + +.PP +Libunwind +provides the routines _U_dyn_register() +and +_U_dyn_cancel() +to register/cancel the information required to +unwind through code that has been generated at runtime (e.g., by a +just\-in\-time (JIT) compiler). It is important to register the +information for \fIall\fP +dynamically generated code because +otherwise, a debugger may not be able to function properly or +high\-level language exception handling may not work as expected. +.PP +The interface for registering and canceling dynamic unwind info has +been designed for maximum efficiency, so as to minimize the +performance impact on JIT\-compilers. In particular, both routines are +guaranteed to execute in ``constant time\&'' (O(1)) and the +data\-structure encapsulating the dynamic unwind info has been designed +to facilitate sharing, such that similar procedures can share much of +the underlying information. +.PP +For more information on the libunwind +support for dynamically +generated code, see libunwind\-dynamic(3)\&. +.PP +.SH CACHING OF UNWIND INFO + +.PP +To speed up execution, libunwind +may aggressively cache the +information it needs to perform unwinding. If a process changes +during its lifetime, this creates a risk of libunwind +using +stale data. For example, this would happen if libunwind +were +to cache information about a shared library which later on gets +unloaded (e.g., via \fIdlclose\fP(3)). +.PP +To prevent the risk of using stale data, libunwind +provides two +facilities: first, it is possible to flush the cached information +associated with a specific address range in the target process (or the +entire address space, if desired). This functionality is provided by +unw_flush_cache(). +The second facility is provided by +unw_set_caching_policy(), +which lets a program +select the exact caching policy in use for a given address\-space +object. In particular, by selecting the policy +UNW_CACHE_NONE, +it is possible to turn off caching +completely, therefore eliminating the risk of stale data alltogether +(at the cost of slower execution). By default, caching is enabled for +local unwinding only. +.PP +.SH FILES + +.PP +.TP +libunwind.h + Headerfile to include for native (same +platform) unwinding. +.TP +libunwind\-PLAT\&.h + Headerfile to include when +the unwind target runs on platform PLAT\&. +For example, to unwind +an IA\-64 program, the header file libunwind\-ia64.h +should be +included. +.TP +\fB\-l\fPunwind + Linker\-switch to add when building a +program that does native (same platform) unwinding. +.TP +\fB\-l\fPunwind\-PLAT + Linker\-switch to add when +building a program that unwinds a program on platform PLAT\&. +For example, to (cross\-)unwind an IA\-64 program, the linker switch +\-lunwind\-ia64 +should be added. Note: multiple such switches +may need to be specified for programs that can unwind programs on +multiple platforms. +.PP +.SH SEE ALSO + +.PP +libunwind\-dynamic(3), +libunwind\-ia64(3), +libunwind\-ptrace(3), +libunwind\-setjmp(3), +unw_create_addr_space(3), +unw_destroy_addr_space(3), +unw_flush_cache(3), +unw_get_accessors(3), +unw_get_fpreg(3), +unw_get_proc_info(3), +unw_get_proc_name(3), +unw_get_reg(3), +unw_getcontext(3), +unw_init_local(3), +unw_init_remote(3), +unw_is_fpreg(3), +unw_is_signal_frame(3), +unw_regname(3), +unw_resume(3), +unw_set_caching_policy(3), +unw_set_fpreg(3), +unw_set_reg(3), +unw_step(3), +unw_strerror(3), +_U_dyn_register(3), +_U_dyn_cancel(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind.tex b/sdk/cpprt/linux/libunwind/doc/libunwind.tex new file mode 100644 index 0000000000..534bd4db88 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind.tex @@ -0,0 +1,355 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{libunwind}{David Mosberger-Tang}{Programming Library}{Introduction to libunwind}libunwind -- a (mostly) platform-independent unwind API +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\noindent +\Type{int} \Func{unw\_getcontext}(\Type{unw\_context\_t~*});\\ +\noindent +\Type{int} \Func{unw\_init\_local}(\Type{unw\_cursor\_t~*}, \Type{unw\_context\_t~*});\\ +\noindent +\Type{int} \Func{unw\_init\_remote}(\Type{unw\_cursor\_t~*}, \Type{unw\_addr\_space\_t}, \Type{void~*});\\ +\noindent +\Type{int} \Func{unw\_step}(\Type{unw\_cursor\_t~*});\\ +\noindent +\Type{int} \Func{unw\_get\_reg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_word\_t~*});\\ +\noindent +\Type{int} \Func{unw\_get\_fpreg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_fpreg\_t~*});\\ +\noindent +\Type{int} \Func{unw\_set\_reg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_word\_t});\\ +\noindent +\Type{int} \Func{unw\_set\_fpreg}(\Type{unw\_cursor\_t~*}, \Type{unw\_regnum\_t}, \Type{unw\_fpreg\_t});\\ +\noindent +\Type{int} \Func{unw\_resume}(\Type{unw\_cursor\_t~*});\\ + +\noindent +\Type{unw\_addr\_space\_t} \Var{unw\_local\_addr\_space};\\ +\noindent +\Type{unw\_addr\_space\_t} \Func{unw\_create\_addr\_space}(\Type{unw\_accessors\_t}, \Type{int});\\ +\noindent +\Type{void} \Func{unw\_destroy\_addr\_space}(\Type{unw\_addr\_space\_t});\\ +\noindent +\Type{unw\_accessors\_t} \Func{unw\_get\_accessors}(\Type{unw\_addr\_space\_t});\\ +\noindent +\Type{void} \Func{unw\_flush\_cache}(\Type{unw\_addr\_space\_t}, \Type{unw\_word\_t}, \Type{unw\_word\_t});\\ +\noindent +\Type{int} \Func{unw\_set\_caching\_policy}(\Type{unw\_addr\_space\_t}, \Type{unw\_caching\_policy\_t});\\ + +\noindent +\Type{const char *}\Func{unw\_regname}(\Type{unw\_regnum\_t});\\ +\noindent +\Type{int} \Func{unw\_get\_proc\_info}(\Type{unw\_cursor\_t~*}, \Type{unw\_proc\_info\_t~*});\\ +\noindent +\Type{int} \Func{unw\_get\_save\_loc}(\Type{unw\_cursor\_t~*}, \Type{int}, \Type{unw\_save\_loc\_t~*});\\ +\noindent +\Type{int} \Func{unw\_is\_fpreg}(\Type{unw\_regnum\_t});\\ +\Type{int} \Func{unw\_is\_signal\_frame}(\Type{unw\_cursor\_t~*});\\ +\noindent +\Type{int} \Func{unw\_get\_proc\_name}(\Type{unw\_cursor\_t~*}, \Type{char~*}, \Type{size\_t}, \Type{unw\_word\_t~*});\\ + +\noindent +\Type{void} \Func{\_U\_dyn\_register}(\Type{unw\_dyn\_info\_t~*});\\ +\noindent +\Type{void} \Func{\_U\_dyn\_cancel}(\Type{unw\_dyn\_info\_t~*});\\ + +\section{Local Unwinding} + +\Prog{Libunwind} is very easy to use when unwinding a stack from +within a running program. This is called \emph{local} unwinding. Say +you want to unwind the stack while executing in some function +\Func{F}(). In this function, you would call \Func{unw\_getcontext}() +to get a snapshot of the CPU registers (machine-state). Then you +initialize an \emph{unwind~cursor} based on this snapshot. This is +done with a call to \Func{unw\_init\_local}(). The cursor now points +to the current frame, that is, the stack frame that corresponds to the +current activation of function \Func{F}(). The unwind cursor can then +be moved ``up'' (towards earlier stack frames) by calling +\Func{unw\_step}(). By repeatedly calling this routine, you can +uncover the entire call-chain that led to the activation of function +\Func{F}(). A positive return value from \Func{unw\_step}() indicates +that there are more frames in the chain, zero indicates that the end +of the chain has been reached, and any negative value indicates that +some sort of error has occurred. + +While it is not possible to directly move the unwind cursor in the +``down'' direction (towards newer stack frames), this effect can be +achieved by making copies of an unwind cursor. For example, a program +that sometimes has to move ``down'' by one stack frame could maintain +two cursor variables: ``\Var{curr}'' and ``\Var{prev}''. The former +would be used as the current cursor and \Var{prev} would be maintained +as the ``previous frame'' cursor by copying the contents of \Var{curr} +to \Var{prev} right before calling \Func{unw\_step}(). With this +approach, the program could move one step ``down'' simply by copying +back \Var{prev} to \Var{curr} whenever that is necessary. In the most +extreme case, a program could maintain a separate cursor for each call +frame and that way it could move up and down the callframe-chain at +will. + +Given an unwind cursor, it is possible to read and write the CPU +registers that were preserved for the current stack frame (as +identified by the cursor). \Prog{Libunwind} provides several routines +for this purpose: \Func{unw\_get\_reg}() reads an integer (general) +register, \Func{unw\_get\_fpreg}() reads a floating-point register, +\Func{unw\_set\_reg}() writes an integer register, and +\Func{unw\_set\_fpreg}() writes a floating-point register. Note that, +by definition, only the \emph{preserved} machine state can be accessed +during an unwind operation. Normally, this state consists of the +\emph{callee-saved} (``preserved'') registers. However, in some +special circumstances (e.g., in a signal handler trampoline), even the +\emph{caller-saved} (``scratch'') registers are preserved in the stack +frame and, in those cases, \Prog{libunwind} will grant access to them +as well. The exact set of registers that can be accessed via the +cursor depends, of course, on the platform. However, there are two +registers that can be read on all platforms: the instruction pointer +(IP), sometimes also known as the ``program counter'', and the stack +pointer (SP). In \Prog{libunwind}, these registers are identified by +the macros \Const{UNW\_REG\_IP} and \Const{UNW\_REG\_SP}, +respectively. + +Besides just moving the unwind cursor and reading/writing saved +registers, \Prog{libunwind} also provides the ability to resume +execution at an arbitrary stack frame. As you might guess, this is +useful for implementing non-local gotos and the exception handling +needed by some high-level languages such as Java. Resuming execution +with a particular stack frame simply requires calling +\Func{unw\_resume}() and passing the cursor identifying the target +frame as the only argument. + +Normally, \Prog{libunwind} supports both local and remote unwinding +(the latter will be explained in the next section). However, if you +tell libunwind that your program only needs local unwinding, then a +special implementation can be selected which may run much faster than +the generic implementation which supports both kinds of unwinding. To +select this optimized version, simply define the macro +\Const{UNW\_LOCAL\_ONLY} before including the headerfile +\File{$<$libunwind.h$>$}. It is perfectly OK for a single program to +employ both local-only and generic unwinding. That is, whether or not +\Const{UNW\_LOCAL\_ONLY} is defined is a choice that each source-file +(compilation-unit) can make on its own. Independent of the setting(s) +of \Const{UNW\_LOCAL\_ONLY}, you'll always link the same library into +the program (normally \Opt{-l}\File{unwind}). Furthermore, the +portion of \Prog{libunwind} that manages unwind-info for dynamically +generated code is not affected by the setting of +\Const{UNW\_LOCAL\_ONLY}. + +If we put all of the above together, here is how we could use +\Prog{libunwind} to write a function ``\Func{show\_backtrace}()'' +which prints a classic stack trace: + +\begin{verbatim} +#define UNW_LOCAL_ONLY +#include + +void show_backtrace (void) { + unw_cursor_t cursor; unw_context_t uc; + unw_word_t ip, sp; + + unw_getcontext(&uc); + unw_init_local(&cursor, &uc); + while (unw_step(&cursor) > 0) { + unw_get_reg(&cursor, UNW_REG_IP, &ip); + unw_get_reg(&cursor, UNW_REG_SP, &sp); + printf ("ip = %lx, sp = %lx\n", (long) ip, (long) sp); + } +} +\end{verbatim} + + +\section{Remote Unwinding} + +\Prog{Libunwind} can also be used to unwind a stack in a ``remote'' +process. Here, ``remote'' may mean another process on the same +machine or even a process on a completely different machine from the +one that is running \Prog{libunwind}. Remote unwinding is typically +used by debuggers and instruction-set simulators, for example. + +Before you can unwind a remote process, you need to create a new +address-space object for that process. This is achieved with the +\Func{unw\_create\_addr\_space}() routine. The routine takes two +arguments: a pointer to a set of \emph{accessor} routines and an +integer that specifies the byte-order of the target process. The +accessor routines provide \Func{libunwind} with the means to +communicate with the remote process. In particular, there are +callbacks to read and write the process's memory, its registers, and +to access unwind information which may be needed by \Func{libunwind}. + +With the address space created, unwinding can be initiated by a call +to \Func{unw\_init\_remote}(). This routine is very similar to +\Func{unw\_init\_local}(), except that it takes an address-space +object and an opaque pointer as arguments. The routine uses these +arguments to fetch the initial machine state. \Prog{Libunwind} never +uses the opaque pointer on its own, but instead just passes it on to +the accessor (callback) routines. Typically, this pointer is used to +select, e.g., the thread within a process that is to be unwound. + +Once a cursor has been initialized with \Func{unw\_init\_remote}(), +unwinding works exactly like in the local case. That is, you can use +\Func{unw\_step}() to move ``up'' in the call-chain, read and write +registers, or resume execution at a particular stack frame by calling +\Func{unw\_resume}. + + +\section{Cross-platform and Multi-platform Unwinding} + +\Prog{Libunwind} has been designed to enable unwinding across +platforms (architectures). Indeed, a single program can use +\Prog{libunwind} to unwind an arbitrary number of target platforms, +all at the same time! + +We call the machine that is running \Prog{libunwind} the \emph{host} +and the machine that is running the process being unwound the +\emph{target}. If the host and the target platform are the same, we +call it \emph{native} unwinding. If they differ, we call it +\emph{cross-platform} unwinding. + +The principle behind supporting native, cross-platform, and +multi-platform unwinding is very simple: for native unwinding, a +program includes \File{$<$libunwind.h$>$} and uses the linker switch +\Opt{-l}\File{unwind}. For cross-platform unwinding, a program +includes \File{$<$libunwind-}\Var{PLAT}\File{.h$>$} and uses the linker +switch \Opt{-l}\File{unwind-}\Var{PLAT}, where \Var{PLAT} is the name +of the target platform (e.g., \File{ia64} for IA-64, \File{hppa-elf} +for ELF-based HP PA-RISC, or \File{x86} for 80386). Multi-platform +unwinding works exactly like cross-platform unwinding, the only +limitation is that a single source file (compilation unit) can include +at most one \Prog{libunwind} header file. In other words, the +platform-specific support for each supported target needs to be +isolated in separate source files---a limitation that shouldn't be an +issue in practice. + +Note that, by definition, local unwinding is possible only for the +native case. Attempting to call, e.g., \Func{unw\_local\_init}() when +targeting a cross-platform will result in a link-time error +(unresolved references). + + +\section{Thread- and Signal-Safety} + + +All \Prog{libunwind} routines are thread-safe. What this means is +that multiple threads may use \Prog{libunwind} simulatenously. +However, any given cursor may be accessed by only one thread at +any given time. + +To ensure thread-safety, some \Prog{libunwind} routines may have to +use locking. Such routines \emph{must~not} be called from signal +handlers (directly or indirectly) and are therefore \emph{not} +signal-safe. The manual page for each \Prog{libunwind} routine +identifies whether or not it is signal-safe, but as a general rule, +any routine that may be needed for \emph{local} unwinding is +signal-safe (e.g., \Func{unw\_step}() for local unwinding is +signal-safe). For remote-unwinding, \emph{none} of the +\Prog{libunwind} routines are guaranteed to be signal-safe. + + +\section{Unwinding Through Dynamically Generated Code} + +\Func{Libunwind} provides the routines \Func{\_U\_dyn\_register}() and +\Func{\_U\_dyn\_cancel}() to register/cancel the information required to +unwind through code that has been generated at runtime (e.g., by a +just-in-time (JIT) compiler). It is important to register the +information for \emph{all} dynamically generated code because +otherwise, a debugger may not be able to function properly or +high-level language exception handling may not work as expected. + +The interface for registering and canceling dynamic unwind info has +been designed for maximum efficiency, so as to minimize the +performance impact on JIT-compilers. In particular, both routines are +guaranteed to execute in ``constant time'' (O(1)) and the +data-structure encapsulating the dynamic unwind info has been designed +to facilitate sharing, such that similar procedures can share much of +the underlying information. + +For more information on the \Prog{libunwind} support for dynamically +generated code, see \SeeAlso{libunwind-dynamic(3)}. + + +\section{Caching of Unwind Info} + +To speed up execution, \Prog{libunwind} may aggressively cache the +information it needs to perform unwinding. If a process changes +during its lifetime, this creates a risk of \Prog{libunwind} using +stale data. For example, this would happen if \Prog{libunwind} were +to cache information about a shared library which later on gets +unloaded (e.g., via \Cmd{dlclose}{3}). + +To prevent the risk of using stale data, \Prog{libunwind} provides two +facilities: first, it is possible to flush the cached information +associated with a specific address range in the target process (or the +entire address space, if desired). This functionality is provided by +\Func{unw\_flush\_cache}(). The second facility is provided by +\Func{unw\_set\_caching\_policy}(), which lets a program +select the exact caching policy in use for a given address-space +object. In particular, by selecting the policy +\Const{UNW\_CACHE\_NONE}, it is possible to turn off caching +completely, therefore eliminating the risk of stale data alltogether +(at the cost of slower execution). By default, caching is enabled for +local unwinding only. + + +\section{Files} + +\begin{Description} +\item[\File{libunwind.h}] Headerfile to include for native (same + platform) unwinding. +\item[\File{libunwind-}\Var{PLAT}\File{.h}] Headerfile to include when + the unwind target runs on platform \Var{PLAT}. For example, to unwind + an IA-64 program, the header file \File{libunwind-ia64.h} should be + included. +\item[\Opt{-l}\File{unwind}] Linker-switch to add when building a + program that does native (same platform) unwinding. +\item[\Opt{-l}\File{unwind-}\Var{PLAT}] Linker-switch to add when + building a program that unwinds a program on platform \Var{PLAT}. + For example, to (cross-)unwind an IA-64 program, the linker switch + \File{-lunwind-ia64} should be added. Note: multiple such switches + may need to be specified for programs that can unwind programs on + multiple platforms. +\end{Description} + +\section{See Also} + +\SeeAlso{libunwind-dynamic(3)}, +\SeeAlso{libunwind-ia64(3)}, +\SeeAlso{libunwind-ptrace(3)}, +\SeeAlso{libunwind-setjmp(3)}, +\SeeAlso{unw\_create\_addr\_space(3)}, +\SeeAlso{unw\_destroy\_addr\_space(3)}, +\SeeAlso{unw\_flush\_cache(3)}, +\SeeAlso{unw\_get\_accessors(3)}, +\SeeAlso{unw\_get\_fpreg(3)}, +\SeeAlso{unw\_get\_proc\_info(3)}, +\SeeAlso{unw\_get\_proc\_name(3)}, +\SeeAlso{unw\_get\_reg(3)}, +\SeeAlso{unw\_getcontext(3)}, +\SeeAlso{unw\_init\_local(3)}, +\SeeAlso{unw\_init\_remote(3)}, +\SeeAlso{unw\_is\_fpreg(3)}, +\SeeAlso{unw\_is\_signal\_frame(3)}, +\SeeAlso{unw\_regname(3)}, +\SeeAlso{unw\_resume(3)}, +\SeeAlso{unw\_set\_caching\_policy(3)}, +\SeeAlso{unw\_set\_fpreg(3)}, +\SeeAlso{unw\_set\_reg(3)}, +\SeeAlso{unw\_step(3)}, +\SeeAlso{unw\_strerror(3)}, +\SeeAlso{\_U\_dyn\_register(3)}, +\SeeAlso{\_U\_dyn\_cancel(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/libunwind.trans b/sdk/cpprt/linux/libunwind/doc/libunwind.trans new file mode 100644 index 0000000000..a514e5a081 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/libunwind.trans @@ -0,0 +1,34 @@ +$manMacro1a{'Type'} = $manMacro1a{File}; + $manMacro1b{'Type'} = $manMacro1b{File}; +$htmlMacro1a{'Type'} = $htmlMacro1a{File}; + $htmlMacro1b{'Type'} = $htmlMacro1b{File}; +$texiMacro1a{'Type'} = $texiMacro1a{File}; + $texiMacro1b{'Type'} = $texiMacro1b{File}; +$manMacro1a{'Func'} = $manMacro1a{Prog}; + $manMacro1b{'Func'} = $manMacro1b{Prog}; +$htmlMacro1a{'Func'} = $htmlMacro1a{Arg}; + $htmlMacro1b{'Func'} = $htmlMacro1b{Arg}; +$texiMacro1a{'Func'} = $texiMacro1a{Prog}; + $texiMacro1b{'Func'} = $texiMacro1b{Prog}; +$manMacro1a{'Var'} = $manMacro1a{Prog}; + $manMacro1b{'Var'} = $manMacro1b{Prog}; +$htmlMacro1a{'Var'} = $htmlMacro1a{Prog}; + $htmlMacro1b{'Var'} = $htmlMacro1b{Prog}; +$texiMacro1a{'Var'} = $texiMacro1a{Prog}; + $texiMacro1b{'Var'} = $texiMacro1b{Prog}; +$manMacro1a{'Const'} = $manMacro1a{File}; + $manMacro1b{'Const'} = $manMacro1b{File}; +$htmlMacro1a{'Const'} = $htmlMacro1a{File}; + $htmlMacro1b{'Const'} = $htmlMacro1b{File}; +$texiMacro1a{'Const'} = $texiMacro1a{File}; + $texiMacro1b{'Const'} = $texiMacro1b{File}; + +$manMacro1a{'SeeAlso'} = $manMacro1a{File}; + $manMacro1b{'SeeAlso'} = $manMacro1b{File}; +# special handling of SeeAlso in latex2man, so that argument gets doubled: +$htmlMacro2a{'SeeAlso'} = "$htmlMacro1a{File}"; + $htmlMacro2c{'SeeAlso'} = "$htmlMacro1b{File}"; +$texiMacro1a{'SeeAlso'} = $texiMacro1a{File}; + $texiMacro1b{'SeeAlso'} = $texiMacro1b{File}; + diff --git a/sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.man b/sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.man new file mode 100644 index 0000000000..4aca13ecd8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.man @@ -0,0 +1,457 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_CREATE\\_ADDR\\_SPACE" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_create_addr_space +\-\- create address space for remote unwinding +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +unw_addr_space_t +unw_create_addr_space(unw_accessors_t *ap, +int +byteorder); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_create_addr_space() +routine creates a new unwind +address\-space and initializes it based on the call\-back routines +passed via the ap +pointer and the specified byteorder\&. +The call\-back routines are described in detail below. The +byteorder +can be set to 0 to request the default byte\-order of +the unwind target. To request a particular byte\-order, +byteorder +can be set to any constant defined by +\&. +In particular, __LITTLE_ENDIAN +would +request little\-endian byte\-order and __BIG_ENDIAN +would +request big\-endian byte\-order. Whether or not a particular byte\-order +is supported depends on the target platform. +.PP +.SH CALL\-BACK ROUTINES + +.PP +Libunwind +uses a set of call\-back routines to access the +information it needs to unwind a chain of stack\-frames. These +routines are specified via the ap +argument, which points to a +variable of type unw_accessors_t\&. +The contents of this +variable is copied into the newly\-created address space, so the +variable must remain valid only for the duration of the call to +unw_create_addr_space(). +.PP +The first argument to every call\-back routine is an address\-space +identifier (as) +and the last argument is an arbitrary, +application\-specified void\-pointer (arg). +When invoking a +call\-back routine, libunwind +sets the as +argument to the +address\-space on whose behalf the invocation is made and the arg +argument to the value that was specified when +unw_init_remote(3) +was called. +.PP +The synopsis and a detailed description of every call\-back routine +follows below. +.PP +.SS CALL\-BACK ROUTINE SYNOPSIS +.PP +int +find_proc_info(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t +ip, +unw_proc_info_t *pip, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint +need_unwind_info, +void *arg); +.br +void +put_unwind_info(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_proc_info_t *pip, +void *arg); +.br +int +get_dyn_info_list_addr(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t *dilap, +void *arg); +.br +int +access_mem(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t +addr, +unw_word_t *valp, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint +write, +void *arg); +.br +int +access_reg(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_regnum_t +regnum, +unw_word_t *valp, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint +write, +void *arg); +.br +int +access_fpreg(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_regnum_t +regnum, +unw_fpreg_t *fpvalp, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPint +write, +void *arg); +.br +int +resume(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_cursor_t *cp, +void *arg); +.br +int +get_proc_name(unw_addr_space_t +as, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPunw_word_t +addr, +char *bufp, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPsize_t +buf_len, +unw_word_t *offp, +.br +\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fP\fB \fPvoid *arg); +.br +.PP +.SS FIND_PROC_INFO +.PP +Libunwind +invokes the find_proc_info() +call\-back to +locate the information need to unwind a particular procedure. The +ip +argument is an instruction\-address inside the procedure whose +information is needed. The pip +argument is a pointer to the +variable used to return the desired information. The type of this +variable is unw_proc_info_t\&. +See +unw_get_proc_info(3) +for details. Argument +need_unwind_info +is zero if the call\-back does not need to +provide values for the following members in the +unw_proc_info_t +structure: format, +unwind_info_size, +and unwind_info\&. +If +need_unwind_info +is non\-zero, valid values need to be returned +in these members. Furthermore, the contents of the memory addressed +by the unwind_info +member must remain valid until the info is +released via the put_unwind_info +call\-back (see below). +.PP +On successful completion, the find_proc_info() +call\-back must +return zero. Otherwise, the negative value of one of the +unw_error_t +error\-codes may be returned. In particular, this +call\-back may return \-UNW_ESTOPUNWIND +to signal the end of +the frame\-chain. +.PP +.SS PUT_UNWIND_INFO +.PP +Libunwind +invokes the put_unwind_info() +call\-back to +release the resources (such as memory) allocated by a previous call to +find_proc_info() +with the need_unwind_info +argument +set to a non\-zero value. The pip +argument has the same value as +the argument of the same name in the previous matching call to +find_proc_info(). +Note that libunwind +does \fInot\fP +invoke put_unwind_info +for calls to find_proc_info() +with a zero need_unwind_info +argument. +.PP +.SS GET_DYN_INFO_LIST_ADDR +.PP +Libunwind +invokes the get_dyn_info_list_addr() +call\-back to obtain the address of the head of the dynamic unwind\-info +registration list. The variable stored at the returned address must +have a type of unw_dyn_info_list_t +(see +_U_dyn_register(3)). +The dliap +argument is a pointer +to a variable of type unw_word_t +which is used to return the +address of the dynamic unwind\-info registration list. If no dynamic +unwind\-info registration list exist, the value pointed to by +dliap +must be cleared to zero. Libunwind +will cache the +value returned by get_dyn_info_list_addr() +if caching is +enabled for the given address\-space. The cache can be cleared with a +call to unw_flush_cache(). +.PP +On successful completion, the get_dyn_info_list_addr() +call\-back must return zero. Otherwise, the negative value of one of +the unw_error_t +error\-codes may be returned. +.PP +.SS ACCESS_MEM +.PP +Libunwind +invokes the access_mem() +call\-back to read +from or write to a word of memory in the target address\-space. The +address of the word to be accessed is passed in argument addr\&. +To read memory, libunwind +sets argument write +to zero and +valp +to point to the word that receives the read value. To +write memory, libunwind +sets argument write +to a non\-zero +value and valp +to point to the word that contains the value to +be written. The word that valp +points to is always in the +byte\-order of the host\-platform, regardless of the byte\-order of the +target. In other words, it is the responsibility of the call\-back +routine to convert between the target\&'s and the host\&'s byte\-order, if +necessary. +.PP +On successful completion, the access_mem() +call\-back must return zero. Otherwise, the negative value of one of +the unw_error_t +error\-codes may be returned. +.PP +.SS ACCESS_REG +.PP +Libunwind +invokes the access_reg() +call\-back to read +from or write to a scalar (non\-floating\-point) CPU register. The +index of the register to be accessed is passed in argument +regnum\&. +To read a register, libunwind +sets argument +write +to zero and valp +to point to the word that receives +the read value. To write a register, libunwind +sets argument +write +to a non\-zero value and valp +to point to the word +that contains the value to be written. The word that valp +points to is always in the byte\-order of the host\-platform, regardless +of the byte\-order of the target. In other words, it is the +responsibility of the call\-back routine to convert between the +target\&'s and the host\&'s byte\-order, if necessary. +.PP +On successful completion, the access_reg() +call\-back must +return zero. Otherwise, the negative value of one of the +unw_error_t +error\-codes may be returned. +.PP +.SS ACCESS_FPREG +.PP +Libunwind +invokes the access_fpreg() +call\-back to read +from or write to a floating\-point CPU register. The index of the +register to be accessed is passed in argument regnum\&. +To read a +register, libunwind +sets argument write +to zero and +fpvalp +to point to a variable of type unw_fpreg_t +that +receives the read value. To write a register, libunwind +sets +argument write +to a non\-zero value and fpvalp +to point to +the variable of type unw_fpreg_t +that contains the value to +be written. The word that fpvalp +points to is always in the +byte\-order of the host\-platform, regardless of the byte\-order of the +target. In other words, it is the responsibility of the call\-back +routine to convert between the target\&'s and the host\&'s byte\-order, if +necessary. +.PP +On successful completion, the access_fpreg() +call\-back must +return zero. Otherwise, the negative value of one of the +unw_error_t +error\-codes may be returned. +.PP +.SS RESUME +.PP +Libunwind +invokes the resume() +call\-back to resume +execution in the target address space. Argument cp +is the +unwind\-cursor that identifies the stack\-frame in which execution +should resume. By the time libunwind +invokes the resume +call\-back, it has already established the desired machine\- and +memory\-state via calls to the access_reg(), +access_fpreg, +and access_mem() +call\-backs. Thus, all +the call\-back needs to do is perform whatever action is needed to +actually resume execution. +.PP +The resume +call\-back is invoked only in response to a call to +unw_resume(3), +so applications which never invoke +unw_resume(3) +need not define the resume +callback. +.PP +On successful completion, the resume() +call\-back must return +zero. Otherwise, the negative value of one of the +unw_error_t +error\-codes may be returned. As a special case, +when resuming execution in the local address space, the call\-back will +not return on success. +.PP +.SS GET_PROC_NAME +.PP +Libunwind +invokes the get_proc_name() +call\-back to +obtain the procedure\-name of a static (not dynamically generated) +procedure. Argument addr +is an instruction\-address within the +procedure whose name is to be obtained. The bufp +argument is a +pointer to a character\-buffer used to return the procedure name. The +size of this buffer is specified in argument buf_len\&. +The +returned name must be terminated by a NUL character. If the +procedure\&'s name is longer than buf_len +bytes, it must be +truncated to buf_len\-1 +bytes, with the last byte in the +buffer set to the NUL character and \-UNW_ENOMEM +must be +returned. Argument offp +is a pointer to a word which is used to +return the byte\-offset relative to the start of the procedure whose +name is being returned. For example, if procedure foo() +starts +at address 0x40003000, then invoking get_proc_name() +with +addr +set to 0x40003080 should return a value of 0x80 in the word +pointed to by offp +(assuming the procedure is at least 0x80 +bytes long). +.PP +On successful completion, the get_proc_name() +call\-back must +return zero. Otherwise, the negative value of one of the +unw_error_t +error\-codes may be returned. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_create_addr_space() +returns a +non\-NULL +value that represents the newly created +address\-space. Otherwise, NULL +is returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_create_addr_space() +is thread\-safe but \fInot\fP +safe to use from a signal handler. +.PP +.SH SEE ALSO + +.PP +_U_dyn_register(3), +libunwind(3), +unw_destroy_addr_space(3), +unw_get_proc_info(3), +unw_init_remote(3), +unw_resume(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.tex b/sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.tex new file mode 100644 index 0000000000..8de0691f3a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_create_addr_space.tex @@ -0,0 +1,265 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_create\_addr\_space}{David Mosberger-Tang}{Programming Library}{unw\_create\_addr\_space}unw\_create\_addr\_space -- create address space for remote unwinding +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{unw\_addr\_space\_t} \Func{unw\_create\_addr\_space}(\Type{unw\_accessors\_t~*}\Var{ap}, \Type{int} \Var{byteorder});\\ + +\section{Description} + +The \Func{unw\_create\_addr\_space}() routine creates a new unwind +address-space and initializes it based on the call-back routines +passed via the \Var{ap} pointer and the specified \Var{byteorder}. +The call-back routines are described in detail below. The +\Var{byteorder} can be set to 0 to request the default byte-order of +the unwind target. To request a particular byte-order, +\Var{byteorder} can be set to any constant defined by +\File{$<$endian.h$>$}. In particular, \Const{\_\_LITTLE\_ENDIAN} would +request little-endian byte-order and \Const{\_\_BIG\_ENDIAN} would +request big-endian byte-order. Whether or not a particular byte-order +is supported depends on the target platform. + +\section{Call-back Routines} + +\Prog{Libunwind} uses a set of call-back routines to access the +information it needs to unwind a chain of stack-frames. These +routines are specified via the \Var{ap} argument, which points to a +variable of type \Type{unw\_accessors\_t}. The contents of this +variable is copied into the newly-created address space, so the +variable must remain valid only for the duration of the call to +\Func{unw\_create\_addr\_space}(). + +The first argument to every call-back routine is an address-space +identifier (\Var{as}) and the last argument is an arbitrary, +application-specified void-pointer (\Var{arg}). When invoking a +call-back routine, \Prog{libunwind} sets the \Var{as} argument to the +address-space on whose behalf the invocation is made and the \Var{arg} +argument to the value that was specified when +\Func{unw\_init\_remote}(3) was called. + +The synopsis and a detailed description of every call-back routine +follows below. + +\subsection{Call-back Routine Synopsis} + +\Type{int} \Func{find\_proc\_info}(\Type{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t} \Var{ip}, \Type{unw\_proc\_info\_t~*}\Var{pip},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{need\_unwind\_info}, \Type{void~*}arg);\\ +\Type{void} \Func{put\_unwind\_info}(\Type{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_proc\_info\_t~*}pip, \Type{void~*}\Var{arg});\\ +\Type{int} \Func{get\_dyn\_info\_list\_addr}(\Type{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t~*}\Var{dilap}, \Type{void~*}\Var{arg});\\ +\Type{int} \Func{access\_mem}(\Var{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t} \Var{addr}, \Type{unw\_word\_t~*}\Var{valp},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{write}, \Type{void~*}\Var{arg});\\ +\Type{int} \Func{access\_reg}(\Var{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_regnum\_t} \Var{regnum}, \Type{unw\_word\_t~*}\Var{valp},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{write}, \Type{void~*}\Var{arg});\\ +\Type{int} \Func{access\_fpreg}(\Var{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_regnum\_t} \Var{regnum}, \Type{unw\_fpreg\_t~*}\Var{fpvalp},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{int} \Var{write}, \Type{void~*}\Var{arg});\\ +\Type{int} \Func{resume}(\Var{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_cursor\_t~*}\Var{cp}, \Type{void~*}\Var{arg});\\ +\Type{int} \Func{get\_proc\_name}(\Type{unw\_addr\_space\_t} \Var{as},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{unw\_word\_t} \Var{addr}, \Type{char~*}\Var{bufp},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{size\_t} \Var{buf\_len}, \Type{unw\_word\_t~*}\Var{offp},\\ +\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\SP\Type{void~*}\Var{arg});\\ + +\subsection{find\_proc\_info} + +\Prog{Libunwind} invokes the \Func{find\_proc\_info}() call-back to +locate the information need to unwind a particular procedure. The +\Var{ip} argument is an instruction-address inside the procedure whose +information is needed. The \Var{pip} argument is a pointer to the +variable used to return the desired information. The type of this +variable is \Type{unw\_proc\_info\_t}. See +\Func{unw\_get\_proc\_info(3)} for details. Argument +\Var{need\_unwind\_info} is zero if the call-back does not need to +provide values for the following members in the +\Type{unw\_proc\_info\_t} structure: \Var{format}, +\Var{unwind\_info\_size}, and \Var{unwind\_info}. If +\Var{need\_unwind\_info} is non-zero, valid values need to be returned +in these members. Furthermore, the contents of the memory addressed +by the \Var{unwind\_info} member must remain valid until the info is +released via the \Func{put\_unwind\_info} call-back (see below). + +On successful completion, the \Func{find\_proc\_info}() call-back must +return zero. Otherwise, the negative value of one of the +\Type{unw\_error\_t} error-codes may be returned. In particular, this +call-back may return -\Const{UNW\_ESTOPUNWIND} to signal the end of +the frame-chain. + +\subsection{put\_unwind\_info} + +\Prog{Libunwind} invokes the \Func{put\_unwind\_info}() call-back to +release the resources (such as memory) allocated by a previous call to +\Func{find\_proc\_info}() with the \Var{need\_unwind\_info} argument +set to a non-zero value. The \Var{pip} argument has the same value as +the argument of the same name in the previous matching call to +\Func{find\_proc\_info}(). Note that \Prog{libunwind} does \emph{not} +invoke \Func{put\_unwind\_info} for calls to \Func{find\_proc\_info}() +with a zero \Var{need\_unwind\_info} argument. + + +\subsection{get\_dyn\_info\_list\_addr} + +\Prog{Libunwind} invokes the \Func{get\_dyn\_info\_list\_addr}() +call-back to obtain the address of the head of the dynamic unwind-info +registration list. The variable stored at the returned address must +have a type of \Type{unw\_dyn\_info\_list\_t} (see +\Func{\_U\_dyn\_register}(3)). The \Var{dliap} argument is a pointer +to a variable of type \Type{unw\_word\_t} which is used to return the +address of the dynamic unwind-info registration list. If no dynamic +unwind-info registration list exist, the value pointed to by +\Var{dliap} must be cleared to zero. \Prog{Libunwind} will cache the +value returned by \Func{get\_dyn\_info\_list\_addr}() if caching is +enabled for the given address-space. The cache can be cleared with a +call to \Func{unw\_flush\_cache}(). + +On successful completion, the \Func{get\_dyn\_info\_list\_addr}() +call-back must return zero. Otherwise, the negative value of one of +the \Type{unw\_error\_t} error-codes may be returned. + +\subsection{access\_mem} + +\Prog{Libunwind} invokes the \Func{access\_mem}() call-back to read +from or write to a word of memory in the target address-space. The +address of the word to be accessed is passed in argument \Var{addr}. +To read memory, \Prog{libunwind} sets argument \Var{write} to zero and +\Var{valp} to point to the word that receives the read value. To +write memory, \Prog{libunwind} sets argument \Var{write} to a non-zero +value and \Var{valp} to point to the word that contains the value to +be written. The word that \Var{valp} points to is always in the +byte-order of the host-platform, regardless of the byte-order of the +target. In other words, it is the responsibility of the call-back +routine to convert between the target's and the host's byte-order, if +necessary. + +On successful completion, the \Func{access\_mem}() +call-back must return zero. Otherwise, the negative value of one of +the \Type{unw\_error\_t} error-codes may be returned. + +\subsection{access\_reg} + +\Prog{Libunwind} invokes the \Func{access\_reg}() call-back to read +from or write to a scalar (non-floating-point) CPU register. The +index of the register to be accessed is passed in argument +\Var{regnum}. To read a register, \Prog{libunwind} sets argument +\Var{write} to zero and \Var{valp} to point to the word that receives +the read value. To write a register, \Prog{libunwind} sets argument +\Var{write} to a non-zero value and \Var{valp} to point to the word +that contains the value to be written. The word that \Var{valp} +points to is always in the byte-order of the host-platform, regardless +of the byte-order of the target. In other words, it is the +responsibility of the call-back routine to convert between the +target's and the host's byte-order, if necessary. + +On successful completion, the \Func{access\_reg}() call-back must +return zero. Otherwise, the negative value of one of the +\Type{unw\_error\_t} error-codes may be returned. + +\subsection{access\_fpreg} + +\Prog{Libunwind} invokes the \Func{access\_fpreg}() call-back to read +from or write to a floating-point CPU register. The index of the +register to be accessed is passed in argument \Var{regnum}. To read a +register, \Prog{libunwind} sets argument \Var{write} to zero and +\Var{fpvalp} to point to a variable of type \Type{unw\_fpreg\_t} that +receives the read value. To write a register, \Prog{libunwind} sets +argument \Var{write} to a non-zero value and \Var{fpvalp} to point to +the variable of type \Type{unw\_fpreg\_t} that contains the value to +be written. The word that \Var{fpvalp} points to is always in the +byte-order of the host-platform, regardless of the byte-order of the +target. In other words, it is the responsibility of the call-back +routine to convert between the target's and the host's byte-order, if +necessary. + +On successful completion, the \Func{access\_fpreg}() call-back must +return zero. Otherwise, the negative value of one of the +\Type{unw\_error\_t} error-codes may be returned. + +\subsection{resume} + +\Prog{Libunwind} invokes the \Func{resume}() call-back to resume +execution in the target address space. Argument \Var{cp} is the +unwind-cursor that identifies the stack-frame in which execution +should resume. By the time \Prog{libunwind} invokes the \Func{resume} +call-back, it has already established the desired machine- and +memory-state via calls to the \Func{access\_reg}(), +\Func{access\_fpreg}, and \Func{access\_mem}() call-backs. Thus, all +the call-back needs to do is perform whatever action is needed to +actually resume execution. + +The \Func{resume} call-back is invoked only in response to a call to +\Func{unw\_resume}(3), so applications which never invoke +\Func{unw\_resume}(3) need not define the \Func{resume} callback. + +On successful completion, the \Func{resume}() call-back must return +zero. Otherwise, the negative value of one of the +\Type{unw\_error\_t} error-codes may be returned. As a special case, +when resuming execution in the local address space, the call-back will +not return on success. + +\subsection{get\_proc\_name} + +\Prog{Libunwind} invokes the \Func{get\_proc\_name}() call-back to +obtain the procedure-name of a static (not dynamically generated) +procedure. Argument \Var{addr} is an instruction-address within the +procedure whose name is to be obtained. The \Var{bufp} argument is a +pointer to a character-buffer used to return the procedure name. The +size of this buffer is specified in argument \Var{buf\_len}. The +returned name must be terminated by a NUL character. If the +procedure's name is longer than \Var{buf\_len} bytes, it must be +truncated to \Var{buf\_len}\Prog{-1} bytes, with the last byte in the +buffer set to the NUL character and -\Const{UNW\_ENOMEM} must be +returned. Argument \Var{offp} is a pointer to a word which is used to +return the byte-offset relative to the start of the procedure whose +name is being returned. For example, if procedure \Func{foo}() starts +at address 0x40003000, then invoking \Func{get\_proc\_name}() with +\Var{addr} set to 0x40003080 should return a value of 0x80 in the word +pointed to by \Var{offp} (assuming the procedure is at least 0x80 +bytes long). + +On successful completion, the \Func{get\_proc\_name}() call-back must +return zero. Otherwise, the negative value of one of the +\Type{unw\_error\_t} error-codes may be returned. + + +\section{Return Value} + +On successful completion, \Func{unw\_create\_addr\_space}() returns a +non-\Const{NULL} value that represents the newly created +address-space. Otherwise, \Const{NULL} is returned. + +\section{Thread and Signal Safety} + +\Func{unw\_create\_addr\_space}() is thread-safe but \emph{not} +safe to use from a signal handler. + +\section{See Also} + +\SeeAlso{\_U\_dyn\_register(3)}, +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_destroy\_addr\_space(3)}, +\SeeAlso{unw\_get\_proc\_info(3)}, +\SeeAlso{unw\_init\_remote(3)}, +\SeeAlso{unw\_resume(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.man b/sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.man new file mode 100644 index 0000000000..90c9777efb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.man @@ -0,0 +1,57 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_DESTROY\\_ADDR\\_SPACE" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_destroy_addr_space +\-\- destroy unwind address space +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +void +unw_destroy_addr_space(unw_addr_space_t +as); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_destroy_addr_space() +routine destroys the +address space specified by argument as +and thereby releases +all associated resources (such as memory). +.PP +Applications must not destroy the local address space +unw_local_addr_space\&. +Attempting to do so results in +undefined behavior (e.g., the application may crash). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.tex b/sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.tex new file mode 100644 index 0000000000..a66b10b4b0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_destroy_addr_space.tex @@ -0,0 +1,40 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_destroy\_addr\_space}{David Mosberger-Tang}{Programming Library}{unw\_destroy\_addr\_space}unw\_destroy\_addr\_space -- destroy unwind address space +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{void} \Func{unw\_destroy\_addr\_space}(\Type{unw\_addr\_space\_t} \Var{as});\\ + +\section{Description} + +The \Func{unw\_destroy\_addr\_space}() routine destroys the +address space specified by argument \Var{as} and thereby releases +all associated resources (such as memory). + +Applications must not destroy the local address space +\Var{unw\_local\_addr\_space}. Attempting to do so results in +undefined behavior (e.g., the application may crash). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_create\_addr\_space(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_flush_cache.man b/sdk/cpprt/linux/libunwind/doc/unw_flush_cache.man new file mode 100644 index 0000000000..2c05bc234a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_flush_cache.man @@ -0,0 +1,92 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_FLUSH\\_CACHE" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_flush_cache +\-\- flush cached info +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +void +unw_flush_cache(unw_addr_space_t +as, +unw_word_t +lo, +unw_word_t +hi); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_flush_cache() +routine flushes all cached info as it +relates to address\-range lo +to hi +(non\-inclusive) in the +target address\-space as\&. +In addition, all info cached for +address\-space as +that is not tied to a particular code\-range is +also flushed. For example, the address of the dynamic registration +list is not tied to a code\-range and its cached value (if any) is +flushed by a call to this routine. The address range specified by +lo +and hi +should be understood as a hint: +unw_flush_cache() +may flush more information than requested, +but \fInever\fP +less. In other words, unw_flush_cache() +may +overflush, but not underflush. +.PP +As a special case, if arguments lo +and hi +are both 0, all +information cached on behalf of address space as +is flushed. +.PP +.SH RETURN VALUE + +.PP +The unw_flush_cache() +routine cannot fail and does not +return a value. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +The unw_flush_cache() +routine is thread\-safe as well as safe to +use from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_set_caching_policy(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_flush_cache.tex b/sdk/cpprt/linux/libunwind/doc/unw_flush_cache.tex new file mode 100644 index 0000000000..9b61dfc309 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_flush_cache.tex @@ -0,0 +1,57 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_flush\_cache}{David Mosberger-Tang}{Programming Library}{unw\_flush\_cache}unw\_flush\_cache -- flush cached info +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{void} \Func{unw\_flush\_cache}(\Type{unw\_addr\_space\_t} \Var{as}, \Type{unw\_word\_t} \Var{lo}, \Type{unw\_word\_t} \Var{hi});\\ + +\section{Description} + +The \Func{unw\_flush\_cache}() routine flushes all cached info as it +relates to address-range \Var{lo} to \Var{hi} (non-inclusive) in the +target address-space \Var{as}. In addition, all info cached for +address-space \Var{as} that is not tied to a particular code-range is +also flushed. For example, the address of the dynamic registration +list is not tied to a code-range and its cached value (if any) is +flushed by a call to this routine. The address range specified by +\Var{lo} and \Var{hi} should be understood as a hint: +\Func{unw\_flush\_cache}() may flush more information than requested, +but \emph{never} less. In other words, \Func{unw\_flush\_cache}() may +overflush, but not underflush. + +As a special case, if arguments \Var{lo} and \Var{hi} are both 0, all +information cached on behalf of address space \Var{as} is flushed. + +\section{Return Value} + +The \Func{unw\_flush\_cache}() routine cannot fail and does not +return a value. + +\section{Thread and Signal Safety} + +The \Func{unw\_flush\_cache}() routine is thread-safe as well as safe to +use from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_set\_caching\_policy(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_accessors.man b/sdk/cpprt/linux/libunwind/doc/unw_get_accessors.man new file mode 100644 index 0000000000..83fe4fcea6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_accessors.man @@ -0,0 +1,79 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GET\\_ACCESSORS" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_get_accessors +\-\- get pointer to accessor call\-backs +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +unw_accessors_t *unw_get_accessors(unw_addr_space_t as); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_get_accessors() +routine returns a pointer to a +unw_accessors_t +structure, which contains the call\-back +routines that were specified when address space as +was created +(see unw_create_addr_space(3)). +The returned pointer is +guaranteed to remain valid until address space as +is destroyed +by a call to unw_destroy_addr_space(3). +.PP +Note that unw_get_accessors() +can be used to retrieve the +call\-back routines for the local address space +unw_local_addr_space\&. +.PP +.SH RETURN VALUE + +.PP +The unw_get_accessors() +routine cannot fail and always +returns a valid (non\-NULL) +pointer to an +unw_accessors_t +structure. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +The unw_get_accessors() +routine is thread\-safe as well as +safe to use from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3), +unw_destroy_addr_space(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_accessors.tex b/sdk/cpprt/linux/libunwind/doc/unw_get_accessors.tex new file mode 100644 index 0000000000..bf344a32de --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_accessors.tex @@ -0,0 +1,55 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_get\_accessors}{David Mosberger-Tang}{Programming Library}{unw\_get\_accessors}unw\_get\_accessors -- get pointer to accessor call-backs +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{unw\_accessors\_t~*}\Func{unw\_get\_accessors}(\Type{unw\_addr\_space\_t~}\Var{as});\\ + +\section{Description} + +The \Func{unw\_get\_accessors}() routine returns a pointer to a +\Type{unw\_accessors\_t} structure, which contains the call-back +routines that were specified when address space \Var{as} was created +(see \Func{unw\_create\_addr\_space}(3)). The returned pointer is +guaranteed to remain valid until address space \Var{as} is destroyed +by a call to \Func{unw\_destroy\_addr\_space}(3). + +Note that \Func{unw\_get\_accessors}() can be used to retrieve the +call-back routines for the local address space +\Var{unw\_local\_addr\_space}. + +\section{Return Value} + +The \Func{unw\_get\_accessors}() routine cannot fail and always +returns a valid (non-\Const{NULL}) pointer to an +\Type{unw\_accessors\_t} structure. + +\section{Thread and Signal Safety} + +The \Func{unw\_get\_accessors}() routine is thread-safe as well as +safe to use from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_create\_addr\_space(3)}, +\SeeAlso{unw\_destroy\_addr\_space(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.man b/sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.man new file mode 100644 index 0000000000..5e54ca13d3 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.man @@ -0,0 +1,111 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GET\\_FPREG" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_get_fpreg +\-\- get contents of floating\-point register +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_get_fpreg(unw_cursor_t *cp, +unw_regnum_t +reg, +unw_fpreg_t *valp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_get_fpreg() +routine reads the value of floating\-point +register reg +in the stack frame identified by cursor cp +and stores the value in the variable pointed to by valp\&. +.PP +The register numbering is target\-dependent and described in separate +manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that cp +is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee\-saved\&'') registers and frame\-related registers (such as the +stack\-pointer). However, for signal frames (see +unw_is_signal_frame(3)), +it is usually possible to access +all registers. +.PP +Note that unw_get_fpreg() +can only read the contents of +floating\-point registers. See unw_get_fpreg(3) +for a way to +read registers which fit in a single word. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_get_fpreg() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_get_fpreg() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + An attempt was made to read a register +that is either invalid or not accessible in the current frame. +.PP +In addition, unw_get_fpreg() +may return any error returned by +the access_mem(), +access_reg(), +and +access_fpreg() +call\-backs (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +libunwind\-ia64(3), +unw_get_reg(3), +unw_is_fpreg(3), +unw_is_signal_frame(3), +unw_set_fpreg(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.tex b/sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.tex new file mode 100644 index 0000000000..dd679adc06 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_fpreg.tex @@ -0,0 +1,77 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_get\_fpreg}{David Mosberger-Tang}{Programming Library}{unw\_get\_fpreg}unw\_get\_fpreg -- get contents of floating-point register +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_get\_fpreg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_fpreg\_t~*}\Var{valp});\\ + +\section{Description} + +The \Func{unw\_get\_fpreg}() routine reads the value of floating-point +register \Var{reg} in the stack frame identified by cursor \Var{cp} +and stores the value in the variable pointed to by \Var{valp}. + +The register numbering is target-dependent and described in separate +manual pages (e.g., libunwind-ia64(3) for the IA-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that \Var{cp} is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee-saved'') registers and frame-related registers (such as the +stack-pointer). However, for signal frames (see +\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access +all registers. + +Note that \Func{unw\_get\_fpreg}() can only read the contents of +floating-point registers. See \Func{unw\_get\_fpreg}(3) for a way to +read registers which fit in a single word. + +\section{Return Value} + +On successful completion, \Func{unw\_get\_fpreg}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_get\_fpreg}() is thread-safe as well as safe to use +from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] An attempt was made to read a register + that is either invalid or not accessible in the current frame. +\end{Description} +In addition, \Func{unw\_get\_fpreg}() may return any error returned by +the \Func{access\_mem}(), \Func{access\_reg}(), and +\Func{access\_fpreg}() call-backs (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{libunwind-ia64(3)}, +\SeeAlso{unw\_get\_reg(3)}, +\SeeAlso{unw\_is\_fpreg(3)}, +\SeeAlso{unw\_is\_signal\_frame(3)}, +\SeeAlso{unw\_set\_fpreg(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.man b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.man new file mode 100644 index 0000000000..09eadee27a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.man @@ -0,0 +1,203 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:44 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GET\\_PROC\\_INFO" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_get_proc_info +\-\- get info on current procedure +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_get_proc_info(unw_cursor_t *cp, +unw_proc_info_t *pip); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_get_proc_info() +routine returns auxiliary +information about the procedure that created the stack frame +identified by argument cp\&. +The pip +argument is a pointer +to a structure of type unw_proc_info_t +which is used to +return the information. The unw_proc_info_t +has the +following members: +.TP +unw_word_t start_ip + The address of the first +instruction of the procedure. If this address cannot be determined +(e.g., due to lack of unwind information), the start_ip +member is cleared to 0. +.br +.TP +unw_word_t end_ip + The address of the first +instruction \fIbeyond\fP +the end of the procedure. If this address +cannot be determined (e.g., due to lack of unwind information), +the end_ip +member is cleared to 0. +.br +.TP +unw_word_t lsda + The address of the +language\-specific data\-area (LSDA). This area normally contains +language\-specific information needed during exception handling. If +the procedure has no such area, this member is cleared to 0. +.br +.TP +unw_word_t handler + The address of the exception +handler routine. This is sometimes called the \fIpersonality\fP +routine. If the procedure does not define +a personality routine, the handler +member is cleared to 0. +.br +.TP +unw_word_t gp + The global\-pointer of the +procedure. On platforms that do not use a global pointer, this +member may contain an undefined value. On all other platforms, it +must be set either to the correct global\-pointer value of the +procedure or to 0 if the proper global\-pointer cannot be +obtained for some reason. +.br +.TP +unw_word_t flags + A set of flags. There are +currently no target\-independent flags. For the IA\-64 target, the +flag UNW_PI_FLAG_IA64_RBS_SWITCH +is set if the +procedure may switch the register\-backing store. +.br +.TP +int format + The format of the unwind\-info for this +procedure. If the unwind\-info consists of dynamic procedure info, +format +is equal to UNW_INFO_FORMAT_DYNAMIC\&. +If the +unwind\-info consists of a (target\-specific) unwind table, it is +equal to to UNW_INFO_FORMAT_TABLE\&. +All other values are +reserved for future use by libunwind\&. +This member exists +for use by the find_proc_info() +call\-back (see +unw_create_addr_space(3)). +The +unw_get_proc_info() +routine +may return an undefined value in this member. +.br +.TP +int unwind_info_size + The size of the unwind\-info +in bytes. This member exists for use by the +find_proc_info() +call\-back (see +unw_create_addr_space(3)). +The +unw_get_proc_info() +routine +may return an undefined value in this member. +.br +.TP +void *unwind_info + The pointer to the unwind\-info. +If no unwind info is available, this member must be set to +NULL\&. +This member exists for use by the +find_proc_info() +call\-back (see +unw_create_addr_space(3)). +The +unw_get_proc_info() +routine +may return an undefined value in this member. +.br +.PP +Note that for the purposes of libunwind, +the code of a +procedure is assumed to occupy a single, contiguous range of +addresses. For this reason, it is alwas possible to describe the +extent of a procedure with the start_ip +and end_ip +members. If a single function/routine is split into multiple, +discontiguous pieces, libunwind +will treat each piece as a +separate procedure. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_get_proc_info() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_get_proc_info() +is thread\-safe. If cursor cp +is +in the local address\-space, this routine is also safe to use from a +signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_ENOINFO + Libunwind +was unable to locate +unwind\-info for the procedure. +.TP +UNW_EBADVERSION + The unwind\-info for the procedure has +version or format that is not understood by libunwind\&. +.PP +In addition, unw_get_proc_info() +may return any error +returned by the access_mem() +call\-back (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3), +unw_get_proc_name(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.tex b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.tex new file mode 100644 index 0000000000..72621f1a65 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info.tex @@ -0,0 +1,123 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_get\_proc\_info}{David Mosberger-Tang}{Programming Library}{unw\_get\_proc\_info}unw\_get\_proc\_info -- get info on current procedure +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_get\_proc\_info}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_proc\_info\_t~*}\Var{pip});\\ + +\section{Description} + +The \Func{unw\_get\_proc\_info}() routine returns auxiliary +information about the procedure that created the stack frame +identified by argument \Var{cp}. The \Var{pip} argument is a pointer +to a structure of type \Type{unw\_proc\_info\_t} which is used to +return the information. The \Type{unw\_proc\_info\_t} has the +following members: +\begin{description} +\item[\Type{unw\_word\_t} \Var{start\_ip}] The address of the first + instruction of the procedure. If this address cannot be determined + (e.g., due to lack of unwind information), the \Var{start\_ip} + member is cleared to 0. \\ +\item[\Type{unw\_word\_t} \Var{end\_ip}] The address of the first + instruction \emph{beyond} the end of the procedure. If this address + cannot be determined (e.g., due to lack of unwind information), + the \Var{end\_ip} member is cleared to 0. \\ +\item[\Type{unw\_word\_t} \Var{lsda}] The address of the + language-specific data-area (LSDA). This area normally contains + language-specific information needed during exception handling. If + the procedure has no such area, this member is cleared to 0. \\ +\item[\Type{unw\_word\_t} \Var{handler}] The address of the exception + handler routine. This is sometimes called the \emph{personality} + routine. If the procedure does not define + a personality routine, the \Var{handler} member is cleared to 0. \\ +\item[\Type{unw\_word\_t} \Var{gp}] The global-pointer of the + procedure. On platforms that do not use a global pointer, this + member may contain an undefined value. On all other platforms, it + must be set either to the correct global-pointer value of the + procedure or to 0 if the proper global-pointer cannot be + obtained for some reason. \\ +\item[\Type{unw\_word\_t} \Var{flags}] A set of flags. There are + currently no target-independent flags. For the IA-64 target, the + flag \Const{UNW\_PI\_FLAG\_IA64\_RBS\_SWITCH} is set if the + procedure may switch the register-backing store.\\ +\item[\Type{int} \Var{format}] The format of the unwind-info for this + procedure. If the unwind-info consists of dynamic procedure info, + \Var{format} is equal to \Const{UNW\_INFO\_FORMAT\_DYNAMIC}. If the + unwind-info consists of a (target-specific) unwind table, it is + equal to to \Const{UNW\_INFO\_FORMAT\_TABLE}. All other values are + reserved for future use by \Prog{libunwind}. This member exists + for use by the \Func{find\_proc\_info}() call-back (see + \Func{unw\_create\_addr\_space}(3)). The + \Func{unw\_get\_proc\_info}() routine + may return an undefined value in this member. \\ +\item[\Type{int} \Var{unwind\_info\_size}] The size of the unwind-info + in bytes. This member exists for use by the + \Func{find\_proc\_info}() call-back (see + \Func{unw\_create\_addr\_space}(3)). The + \Func{unw\_get\_proc\_info}() routine + may return an undefined value in this member.\\ +\item[\Type{void~*}\Var{unwind\_info}] The pointer to the unwind-info. + If no unwind info is available, this member must be set to + \Const{NULL}. This member exists for use by the + \Func{find\_proc\_info}() call-back (see + \Func{unw\_create\_addr\_space}(3)). The + \Func{unw\_get\_proc\_info}() routine + may return an undefined value in this member.\\ +\end{description} +Note that for the purposes of \Prog{libunwind}, the code of a +procedure is assumed to occupy a single, contiguous range of +addresses. For this reason, it is alwas possible to describe the +extent of a procedure with the \Var{start\_ip} and \Var{end\_ip} +members. If a single function/routine is split into multiple, +discontiguous pieces, \Prog{libunwind} will treat each piece as a +separate procedure. + +\section{Return Value} + +On successful completion, \Func{unw\_get\_proc\_info}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_get\_proc\_info}() is thread-safe. If cursor \Var{cp} is +in the local address-space, this routine is also safe to use from a +signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate + unwind-info for the procedure. +\item[\Const{UNW\_EBADVERSION}] The unwind-info for the procedure has + version or format that is not understood by \Prog{libunwind}. +\end{Description} +In addition, \Func{unw\_get\_proc\_info}() may return any error +returned by the \Func{access\_mem}() call-back (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_create\_addr\_space(3)}, +\SeeAlso{unw\_get\_proc\_name(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.man b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.man new file mode 100644 index 0000000000..a347a1d008 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.man @@ -0,0 +1,134 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GET\\_PROC\\_INFO\\_BY\\_IP" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_get_proc_info_by_ip +\-\- get procedure info by IP +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_get_proc_info_by_ip(unw_addr_space_t as, +unw_word_t ip, +unw_proc_info_t *pip, +void *arg); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_get_proc_info_by_ip() +routine returns the same +kind of auxiliary information about a procedure as +unw_get_proc_info(), +except that the info is looked up by +instruction\-pointer (IP) instead of a cursor. This is more flexible +because it is possible to look up the info for an arbitrary procedure, +even if it is not part of the current call\-chain. However, since it +is more flexible, it also tends to run slower (and often much slower) +than unw_get_proc_info(). +.PP +The routine expects the followins arguments: as +is the +address\-space in which the instruction\-pointer should be looked up. +For a look\-up in the local address\-space, +unw_local_addr_space +can be passed for this argument. +Argument ip +is the instruction\-pointer for which the procedure +info should be looked up and pip +is a pointer to a structure of +type unw_proc_info_t +which is used to return the info. +Lastly, arg +is the address\-space argument that should be used +when accessing the address\-space. It has the same purpose as the +argument of the same name for unw_init_remote(). +When +accessing the local address\-space (first argument is +unw_local_addr_space), +NULL +must be passed for this +argument. +.PP +Note that for the purposes of libunwind, +the code of a +procedure is assumed to occupy a single, contiguous range of +addresses. For this reason, it is alwas possible to describe the +extent of a procedure with the start_ip +and end_ip +members. If a single function/routine is split into multiple, +discontiguous pieces, libunwind +will treat each piece as a +separate procedure. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_get_proc_info_by_ip() +returns 0. Otherwise the negative value of one of the error\-codes +below is returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_get_proc_info() +is thread\-safe. If the local +address\-space is passed in argument as, +this routine is also +safe to use from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_ENOINFO + Libunwind +was unable to locate +unwind\-info for the procedure. +.TP +UNW_EBADVERSION + The unwind\-info for the procedure has +version or format that is not understood by libunwind\&. +.PP +In addition, unw_get_proc_info() +may return any error +returned by the access_mem() +call\-back (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3), +unw_get_proc_name(3), +unw_get_proc_info(3), +unw_init_remote(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.tex b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.tex new file mode 100644 index 0000000000..5e1d5d247e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_info_by_ip.tex @@ -0,0 +1,91 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_get\_proc\_info\_by\_ip}{David Mosberger-Tang}{Programming Library}{unw\_get\_proc\_info\_by\_ip}unw\_get\_proc\_info\_by\_ip -- get procedure info by IP +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_get\_proc\_info\_by\_ip}(\Type{unw\_addr\_space\_t~}\Var{as}, \Type{unw\_word\_t~}\Var{ip}, \Type{unw\_proc\_info\_t~*}\Var{pip}, \Type{void~*}\Var{arg});\\ + +\section{Description} + +The \Func{unw\_get\_proc\_info\_by\_ip}() routine returns the same +kind of auxiliary information about a procedure as +\Func{unw\_get\_proc\_info}(), except that the info is looked up by +instruction-pointer (IP) instead of a cursor. This is more flexible +because it is possible to look up the info for an arbitrary procedure, +even if it is not part of the current call-chain. However, since it +is more flexible, it also tends to run slower (and often much slower) +than \Func{unw\_get\_proc\_info}(). + +The routine expects the followins arguments: \Var{as} is the +address-space in which the instruction-pointer should be looked up. +For a look-up in the local address-space, +\Var{unw\_local\_addr\_space} can be passed for this argument. +Argument \Var{ip} is the instruction-pointer for which the procedure +info should be looked up and \Var{pip} is a pointer to a structure of +type \Type{unw\_proc\_info\_t} which is used to return the info. +Lastly, \Var{arg} is the address-space argument that should be used +when accessing the address-space. It has the same purpose as the +argument of the same name for \Func{unw\_init\_remote}(). When +accessing the local address-space (first argument is +\Var{unw\_local\_addr\_space}), \Const{NULL} must be passed for this +argument. + +Note that for the purposes of \Prog{libunwind}, the code of a +procedure is assumed to occupy a single, contiguous range of +addresses. For this reason, it is alwas possible to describe the +extent of a procedure with the \Var{start\_ip} and \Var{end\_ip} +members. If a single function/routine is split into multiple, +discontiguous pieces, \Prog{libunwind} will treat each piece as a +separate procedure. + +\section{Return Value} + +On successful completion, \Func{unw\_get\_proc\_info\_by\_ip}() +returns 0. Otherwise the negative value of one of the error-codes +below is returned. + +\section{Thread and Signal Safety} + +\Func{unw\_get\_proc\_info}() is thread-safe. If the local +address-space is passed in argument \Var{as}, this routine is also +safe to use from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate + unwind-info for the procedure. +\item[\Const{UNW\_EBADVERSION}] The unwind-info for the procedure has + version or format that is not understood by \Prog{libunwind}. +\end{Description} +In addition, \Func{unw\_get\_proc\_info}() may return any error +returned by the \Func{access\_mem}() call-back (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_create\_addr\_space(3)}, +\SeeAlso{unw\_get\_proc\_name(3)}, +\SeeAlso{unw\_get\_proc\_info(3)}, +\SeeAlso{unw\_init\_remote(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.man b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.man new file mode 100644 index 0000000000..bbf350fe7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.man @@ -0,0 +1,123 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GET\\_PROC\\_NAME" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_get_proc_name +\-\- get name of current procedure +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_get_proc_name(unw_cursor_t *cp, +char *bufp, +size_t +len, +unw_word_t *offp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_get_proc_name() +routine returns the name of the +procedure that created the stack frame identified by argument +cp\&. +The bufp +argument is a pointer to a character buffer +that is at least len +bytes long. This buffer is used to return +the name of the procedure. The offp +argument is a pointer to a +word that is used to return the byte\-offset of the instruction\-pointer +saved in the stack frame identified by cp, +relative to the start +of the procedure. For example, if procedure foo() +starts at +address 0x40003000, then invoking unw_get_proc_name() +on a +stack frame with an instruction\-pointer value of 0x40003080 would +return a value of 0x80 in the word pointed to by offp +(assuming +the procedure is at least 0x80 bytes long). +.PP +Note that on some platforms there is no reliable way to distinguish +between procedure names and ordinary labels. Furthermore, if symbol +information has been stripped from a program, procedure names may be +completely unavailable or may be limited to those exported via a +dynamic symbol table. In such cases, unw_get_proc_name() +may return the name of a label or a preceeding (nearby) procedure. +However, the offset returned through offp +is always relative to +the returned name, which ensures that the value (address) of the +returned name plus the returned offset will always be equal to the +instruction\-pointer of the stack frame identified by cp\&. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_get_proc_name() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_get_proc_name() +is thread\-safe. If cursor cp +is +in the local address\-space, this routine is also safe to use from a +signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_ENOINFO + Libunwind +was unable to determine +the name of the procedure. +.TP +UNW_ENOMME + The procedure name is too long to fit +in the buffer provided. A truncated version of the name has been +returned. +.PP +In addition, unw_get_proc_name() +may return any error +returned by the access_mem() +call\-back (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_get_proc_info(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.tex b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.tex new file mode 100644 index 0000000000..4a9b5850fb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_proc_name.tex @@ -0,0 +1,82 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_get\_proc\_name}{David Mosberger-Tang}{Programming Library}{unw\_get\_proc\_name}unw\_get\_proc\_name -- get name of current procedure +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_get\_proc\_name}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{char~*}\Var{bufp}, \Type{size\_t} \Var{len}, \Type{unw\_word\_t~*}\Var{offp});\\ + +\section{Description} + +The \Func{unw\_get\_proc\_name}() routine returns the name of the +procedure that created the stack frame identified by argument +\Var{cp}. The \Var{bufp} argument is a pointer to a character buffer +that is at least \Var{len} bytes long. This buffer is used to return +the name of the procedure. The \Var{offp} argument is a pointer to a +word that is used to return the byte-offset of the instruction-pointer +saved in the stack frame identified by \Var{cp}, relative to the start +of the procedure. For example, if procedure \Func{foo}() starts at +address 0x40003000, then invoking \Func{unw\_get\_proc\_name}() on a +stack frame with an instruction-pointer value of 0x40003080 would +return a value of 0x80 in the word pointed to by \Var{offp} (assuming +the procedure is at least 0x80 bytes long). + +Note that on some platforms there is no reliable way to distinguish +between procedure names and ordinary labels. Furthermore, if symbol +information has been stripped from a program, procedure names may be +completely unavailable or may be limited to those exported via a +dynamic symbol table. In such cases, \Func{unw\_get\_proc\_name}() +may return the name of a label or a preceeding (nearby) procedure. +However, the offset returned through \Var{offp} is always relative to +the returned name, which ensures that the value (address) of the +returned name plus the returned offset will always be equal to the +instruction-pointer of the stack frame identified by \Var{cp}. + +\section{Return Value} + +On successful completion, \Func{unw\_get\_proc\_name}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_get\_proc\_name}() is thread-safe. If cursor \Var{cp} is +in the local address-space, this routine is also safe to use from a +signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to determine + the name of the procedure. +\item[\Const{UNW\_ENOMME}] The procedure name is too long to fit + in the buffer provided. A truncated version of the name has been + returned. +\end{Description} +In addition, \Func{unw\_get\_proc\_name}() may return any error +returned by the \Func{access\_mem}() call-back (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_get\_proc\_info(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_reg.man b/sdk/cpprt/linux/libunwind/doc/unw_get_reg.man new file mode 100644 index 0000000000..83e8bb43b6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_reg.man @@ -0,0 +1,112 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GET\\_REG" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_get_reg +\-\- get register contents +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_get_reg(unw_cursor_t *cp, +unw_regnum_t +reg, +unw_word_t *valp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_get_reg() +routine reads the value of register +reg +in the stack frame identified by cursor cp +and stores +the value in the word pointed to by valp\&. +.PP +The register numbering is target\-dependent and described in separate +manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that cp +is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee\-saved\&'') registers and frame\-related registers (such as the +stack\-pointer). However, for signal frames (see +unw_is_signal_frame(3)), +it is usually possible to access +all registers. +.PP +Note that unw_get_reg() +can only read the contents of +registers whose values fit in a single word. See +unw_get_fpreg(3) +for a way to read registers which do not fit +this constraint. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_get_reg() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_get_reg() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + An attempt was made to read a register +that is either invalid or not accessible in the current frame. +.PP +In addition, unw_get_reg() +may return any error returned by +the access_mem(), +access_reg(), +and +access_fpreg() +call\-backs (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +libunwind\-ia64(3), +unw_get_fpreg(3), +unw_is_signal_frame(3), +unw_set_reg(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_get_reg.tex b/sdk/cpprt/linux/libunwind/doc/unw_get_reg.tex new file mode 100644 index 0000000000..b66e8c0dbb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_get_reg.tex @@ -0,0 +1,77 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_get\_reg}{David Mosberger-Tang}{Programming Library}{unw\_get\_reg}unw\_get\_reg -- get register contents +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_get\_reg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_word\_t~*}\Var{valp});\\ + +\section{Description} + +The \Func{unw\_get\_reg}() routine reads the value of register +\Var{reg} in the stack frame identified by cursor \Var{cp} and stores +the value in the word pointed to by \Var{valp}. + +The register numbering is target-dependent and described in separate +manual pages (e.g., libunwind-ia64(3) for the IA-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that \Var{cp} is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee-saved'') registers and frame-related registers (such as the +stack-pointer). However, for signal frames (see +\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access +all registers. + +Note that \Func{unw\_get\_reg}() can only read the contents of +registers whose values fit in a single word. See +\Func{unw\_get\_fpreg}(3) for a way to read registers which do not fit +this constraint. + +\section{Return Value} + +On successful completion, \Func{unw\_get\_reg}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_get\_reg}() is thread-safe as well as safe to use +from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] An attempt was made to read a register + that is either invalid or not accessible in the current frame. +\end{Description} +In addition, \Func{unw\_get\_reg}() may return any error returned by +the \Func{access\_mem}(), \Func{access\_reg}(), and +\Func{access\_fpreg}() call-backs (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{libunwind-ia64(3)}, +\SeeAlso{unw\_get\_fpreg(3)}, +\SeeAlso{unw\_is\_signal\_frame(3)}, +\SeeAlso{unw\_set\_reg(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_getcontext.man b/sdk/cpprt/linux/libunwind/doc/unw_getcontext.man new file mode 100644 index 0000000000..13725df957 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_getcontext.man @@ -0,0 +1,93 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_GETCONTEXT" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_getcontext +\-\- get initial machine\-state +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_getcontext(unw_context_t *ucp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_getcontext() +routine initializes the context structure +pointed to by ucp +with the machine\-state of the call\-site. The +exact set of registers stored by unw_getcontext() +is +platform\-specific, but, in general, at least all preserved +(``callee\-saved\&'') and all frame\-related registers, such as the +stack\-pointer, will be stored. +.PP +This routine is normally implemented as a macro and applications +should not attempt to take its address. +.PP +.SH PLATFORM\-SPECIFIC NOTES + +.PP +On IA\-64, unw_context_t +has a layout that is compatible with +that of ucontext_t +and such structures can be initialized with +getcontext() +instead of unw_getcontext(). +However, the +reverse is \fInot\fP +true and it is \fInot\fP +safe to use structures +initialized by unw_getcontext() +in places where a structure +initialized by getcontext() +is expected. The reason for this +asymmetry is that unw_getcontext() +is optimized for maximum +performance and does not, for example, save the signal mask. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_getcontext() +returns 0. +Otherwise, a value of \-1 is returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_getcontext() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_init_local(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_getcontext.tex b/sdk/cpprt/linux/libunwind/doc/unw_getcontext.tex new file mode 100644 index 0000000000..fa3eb814b3 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_getcontext.tex @@ -0,0 +1,63 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_getcontext}{David Mosberger-Tang}{Programming Library}{unw\_getcontext}unw\_getcontext -- get initial machine-state +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_getcontext}(\Type{unw\_context\_t~*}\Var{ucp});\\ + +\section{Description} + +The \Func{unw\_getcontext}() routine initializes the context structure +pointed to by \Var{ucp} with the machine-state of the call-site. The +exact set of registers stored by \Func{unw\_getcontext}() is +platform-specific, but, in general, at least all preserved +(``callee-saved'') and all frame-related registers, such as the +stack-pointer, will be stored. + +This routine is normally implemented as a macro and applications +should not attempt to take its address. + +\section{Platform-specific Notes} + +On IA-64, \Type{unw\_context\_t} has a layout that is compatible with +that of \Type{ucontext\_t} and such structures can be initialized with +\Func{getcontext}() instead of \Func{unw\_getcontext}(). However, the +reverse is \emph{not} true and it is \emph{not} safe to use structures +initialized by \Func{unw\_getcontext()} in places where a structure +initialized by \Func{getcontext()} is expected. The reason for this +asymmetry is that \Func{unw\_getcontext()} is optimized for maximum +performance and does not, for example, save the signal mask. + +\section{Return Value} + +On successful completion, \Func{unw\_getcontext}() returns 0. +Otherwise, a value of -1 is returned. + +\section{Thread and Signal Safety} + +\Func{unw\_getcontext}() is thread-safe as well as safe to use +from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_init\_local(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_init_local.man b/sdk/cpprt/linux/libunwind/doc/unw_init_local.man new file mode 100644 index 0000000000..73b798863a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_init_local.man @@ -0,0 +1,119 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_INIT\\_LOCAL" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_init_local +\-\- initialize cursor for local unwinding +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_init_local(unw_cursor_t *c, +unw_context_t *ctxt); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_init_local() +routine initializes the unwind cursor +pointed to by c +with the machine\-state in the context structure +pointed to by ctxt\&. +As such, the machine\-state pointed to by +ctxt +identifies the initial stack frame at which unwinding +starts. The machine\-state must remain valid for the duration for +which the cursor c +is in use. +.PP +The unw_init_local() +routine can be used only for unwinding in +the address space of the current process (i.e., for local unwinding). +For all other cases, unw_init_remote() +must be used instead. +From a behavioral point of view, the call: +.PP +.Vb + ret = unw_init_local(&cursor, &ucontext); +.Ve +is equivalent to: +.PP +.Vb + ret = unw_init_remote(&cursor, unw_local_addr_space, + &ucontext); +.Ve +However, unwind performance may be better when using +unw_init_local(). +Also, unw_init_local() +is +available even when UNW_LOCAL_ONLY +has been defined before +including , +whereas unw_init_remote() +is not. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_init_local() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_init_local() +is thread\-safe as well as safe to use from a +signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EINVAL + unw_init_local() +was called in a +version of libunwind +which supports remote unwinding only +(this normally happens when calling unw_init_local() +for a +cross\-platform version of libunwind). +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + A register needed by unw_init_local() +wasn\&'t accessible. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_init_remote(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_init_local.tex b/sdk/cpprt/linux/libunwind/doc/unw_init_local.tex new file mode 100644 index 0000000000..5cea673c8f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_init_local.tex @@ -0,0 +1,81 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_init\_local}{David Mosberger-Tang}{Programming Library}{unw\_init\_local}unw\_init\_local -- initialize cursor for local unwinding +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_init\_local}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_context\_t~*}\Var{ctxt});\\ + +\section{Description} + +The \Func{unw\_init\_local}() routine initializes the unwind cursor +pointed to by \Var{c} with the machine-state in the context structure +pointed to by \Var{ctxt}. As such, the machine-state pointed to by +\Var{ctxt} identifies the initial stack frame at which unwinding +starts. The machine-state must remain valid for the duration for +which the cursor \Var{c} is in use. + +The \Func{unw\_init\_local}() routine can be used only for unwinding in +the address space of the current process (i.e., for local unwinding). +For all other cases, \Func{unw\_init\_remote}() must be used instead. +From a behavioral point of view, the call: + +\begin{verbatim} + ret = unw_init_local(&cursor, &ucontext); +\end{verbatim} +is equivalent to: + +\begin{verbatim} + ret = unw_init_remote(&cursor, unw_local_addr_space, + &ucontext); +\end{verbatim} +However, unwind performance may be better when using +\Func{unw\_init\_local}(). Also, \Func{unw\_init\_local}() is +available even when \Const{UNW\_LOCAL\_ONLY} has been defined before +including \File{$<$libunwind.h$>$}, whereas \Func{unw\_init\_remote}() +is not. + +\section{Return Value} + +On successful completion, \Func{unw\_init\_local}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_init\_local}() is thread-safe as well as safe to use from a +signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EINVAL}] \Func{unw\_init\_local}() was called in a + version of \Prog{libunwind} which supports remote unwinding only + (this normally happens when calling \Func{unw\_init\_local}() for a + cross-platform version of \Prog{libunwind}). +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_init\_local}() + wasn't accessible. +\end{Description} + +\section{See Also} + +\SeeAlso{libunwind(3)}, \SeeAlso{unw\_init\_remote(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_init_remote.man b/sdk/cpprt/linux/libunwind/doc/unw_init_remote.man new file mode 100644 index 0000000000..0acdac9617 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_init_remote.man @@ -0,0 +1,123 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_INIT\\_REMOTE" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_init_remote +\-\- initialize cursor for remote unwinding +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_init_remote(unw_cursor_t *c, +unw_addr_space_t as, +void *arg); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_init_remote() +routine initializes the unwind cursor +pointed to by c +for unwinding in the address space identified by +as\&. +The as +argument can either be set to +unw_local_addr_space +(local address space) or to an arbitrary +address space created with unw_create_addr_space(). +.PP +The arg +void\-pointer tells the address space exactly what entity +should be unwound. For example, if unw_local_addr_space +is +passed in as, +then arg +needs to be a pointer to a context +structure containing the machine\-state of the initial stack frame. +However, other address\-spaces may instead expect a process\-id, a +thread\-id, or a pointer to an arbitrary structure which identifies the +stack\-frame chain to be unwound. In other words, the interpretation +of arg +is entirely dependent on the address\-space in use; +libunwind +never interprets the argument in any way on its own. +.PP +Note that unw_init_remote() +can be used to initiate unwinding +in \fIany\fP +process, including the local process in which the +unwinder itself is running. However, for local unwinding, it is +generally preferable to use unw_init_local() +instead, because +it is easier to use and because it may perform better. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_init_remote() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_init_remote() +is thread\-safe. If the local address\-space +is passed in argument as, +this routine is also safe to use from +a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EINVAL + unw_init_remote() +was called in a +version of libunwind +which supports local unwinding only +(this normally happens when defining UNW_LOCAL_ONLY +before +including +and then calling +unw_init_remote()). +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + A register needed by unw_init_remote() +wasn\&'t accessible. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3), +unw_init_local(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_init_remote.tex b/sdk/cpprt/linux/libunwind/doc/unw_init_remote.tex new file mode 100644 index 0000000000..9b4dc7997a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_init_remote.tex @@ -0,0 +1,79 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_init\_remote}{David Mosberger-Tang}{Programming Library}{unw\_init\_remote}unw\_init\_remote -- initialize cursor for remote unwinding +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_init\_remote}(\Type{unw\_cursor\_t~*}\Var{c}, \Type{unw\_addr\_space\_t~}\Var{as}, \Type{void~*}\Var{arg});\\ + +\section{Description} + +The \Func{unw\_init\_remote}() routine initializes the unwind cursor +pointed to by \Var{c} for unwinding in the address space identified by +\Var{as}. The \Var{as} argument can either be set to +\Var{unw\_local\_addr\_space} (local address space) or to an arbitrary +address space created with \Func{unw\_create\_addr\_space}(). + +The \Var{arg} void-pointer tells the address space exactly what entity +should be unwound. For example, if \Var{unw\_local\_addr\_space} is +passed in \Var{as}, then \Var{arg} needs to be a pointer to a context +structure containing the machine-state of the initial stack frame. +However, other address-spaces may instead expect a process-id, a +thread-id, or a pointer to an arbitrary structure which identifies the +stack-frame chain to be unwound. In other words, the interpretation +of \Var{arg} is entirely dependent on the address-space in use; +\Prog{libunwind} never interprets the argument in any way on its own. + +Note that \Func{unw\_init\_remote}() can be used to initiate unwinding +in \emph{any} process, including the local process in which the +unwinder itself is running. However, for local unwinding, it is +generally preferable to use \Func{unw\_init\_local}() instead, because +it is easier to use and because it may perform better. + +\section{Return Value} + +On successful completion, \Func{unw\_init\_remote}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_init\_remote}() is thread-safe. If the local address-space +is passed in argument \Var{as}, this routine is also safe to use from +a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EINVAL}] \Func{unw\_init\_remote}() was called in a + version of \Prog{libunwind} which supports local unwinding only + (this normally happens when defining \Const{UNW\_LOCAL\_ONLY} before + including \File{$<$libunwind.h$>$} and then calling + \Func{unw\_init\_remote}()). +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_init\_remote}() + wasn't accessible. +\end{Description} + +\section{See Also} + +\SeeAlso{libunwind(3)}, \SeeAlso{unw\_create\_addr\_space(3)}, +\SeeAlso{unw\_init\_local(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.man b/sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.man new file mode 100644 index 0000000000..0c26ec1bc7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.man @@ -0,0 +1,73 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_IS\\_FPREG" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_is_fpreg +\-\- check if a register is a floating\-point register +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_is_fpreg(unw_regnum_t +reg); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_is_fpreg() +routine checks whether register number +reg +is a floating\-point register. +.PP +This routine is normally implemented as a macro and applications +should not attempt to take its address. +.PP +.SH RETURN VALUE + +.PP +The unw_is_fpreg() +routine returns a non\-zero value if +reg +is a floating\-point register. Otherwise, it returns a value +of 0. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_is_fpreg() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_get_reg(3), +unw_set_reg(3), +unw_get_fpreg(3), +unw_set_fpreg(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.tex b/sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.tex new file mode 100644 index 0000000000..c28cdc9be4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_is_fpreg.tex @@ -0,0 +1,52 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_is\_fpreg}{David Mosberger-Tang}{Programming Library}{unw\_is\_fpreg}unw\_is\_fpreg -- check if a register is a floating-point register +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_is\_fpreg}(\Type{unw\_regnum\_t} \Var{reg});\\ + +\section{Description} + +The \Func{unw\_is\_fpreg}() routine checks whether register number +\Var{reg} is a floating-point register. + +This routine is normally implemented as a macro and applications +should not attempt to take its address. + +\section{Return Value} + +The \Func{unw\_is\_fpreg}() routine returns a non-zero value if +\Var{reg} is a floating-point register. Otherwise, it returns a value +of 0. + +\section{Thread and Signal Safety} + +\Func{unw\_is\_fpreg}() is thread-safe as well as safe to use +from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_get\_reg(3)}, +\SeeAlso{unw\_set\_reg(3)}, +\SeeAlso{unw\_get\_fpreg(3)}, +\SeeAlso{unw\_set\_fpreg(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.man b/sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.man new file mode 100644 index 0000000000..d9a7cda7b5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.man @@ -0,0 +1,88 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_IS\\_SIGNAL\\_FRAME" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_is_signal_frame +\-\- check if current frame is a signal frame +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_is_signal_frame(unw_cursor_t *cp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_is_signal_frame() +routine returns a positive value +if the current frame identified by cp +is a signal frame, and a +value of 0 otherwise. For the purpose of this discussion, a signal +frame is a frame that was created in response to a potentially +asynchronous interruption. For UNIX and UNIX\-like platforms, such +frames are normally created by the kernel when delivering a signal. +In a kernel\-environment, a signal frame might, for example, correspond +to a frame created in response to a device interrupt. +.PP +Signal frames are somewhat unusual because the asynchronous nature of +the events that create them require storing the contents of registers +that are normally treated as scratch (``caller\-saved\&'') registers. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_is_signal_frame() +returns a +positive value if the current frame is a signal frame, or 0 if it is +not. Otherwise, a negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_is_signal_frame() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_ENOINFO + Libunwind +is unable to determine +whether or not the current frame is a signal frame. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_get_reg(3), +unw_set_reg(3), +unw_get_fpreg(3), +unw_set_fpreg(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.tex b/sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.tex new file mode 100644 index 0000000000..f262e5600c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_is_signal_frame.tex @@ -0,0 +1,67 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_is\_signal\_frame}{David Mosberger-Tang}{Programming Library}{unw\_is\_signal\_frame}unw\_is\_signal\_frame -- check if current frame is a signal frame +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_is\_signal\_frame}(\Type{unw\_cursor\_t~*}\Var{cp});\\ + +\section{Description} + +The \Func{unw\_is\_signal\_frame}() routine returns a positive value +if the current frame identified by \Var{cp} is a signal frame, and a +value of 0 otherwise. For the purpose of this discussion, a signal +frame is a frame that was created in response to a potentially +asynchronous interruption. For UNIX and UNIX-like platforms, such +frames are normally created by the kernel when delivering a signal. +In a kernel-environment, a signal frame might, for example, correspond +to a frame created in response to a device interrupt. + +Signal frames are somewhat unusual because the asynchronous nature of +the events that create them require storing the contents of registers +that are normally treated as scratch (``caller-saved'') registers. + +\section{Return Value} + +On successful completion, \Func{unw\_is\_signal\_frame}() returns a +positive value if the current frame is a signal frame, or 0 if it is +not. Otherwise, a negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_is\_signal\_frame}() is thread-safe as well as safe to use +from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} is unable to determine + whether or not the current frame is a signal frame. +\end{Description} + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_get\_reg(3)}, +\SeeAlso{unw\_set\_reg(3)}, +\SeeAlso{unw\_get\_fpreg(3)}, +\SeeAlso{unw\_set\_fpreg(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_regname.man b/sdk/cpprt/linux/libunwind/doc/unw_regname.man new file mode 100644 index 0000000000..1e3e2dbc6e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_regname.man @@ -0,0 +1,68 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_REGNAME" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_regname +\-\- get register name +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +const char *unw_regname(unw_regnum_t +regnum); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_regname() +routine returns a printable name for +register regnum\&. +If regnum +is an invalid or otherwise +unrecognized register number, a string consisting of three question +marks is returned. The returned string is statically allocated and +therefore guaranteed to remain valid until the application terminates. +.PP +.SH RETURN VALUE + +.PP +The unw_regname() +routine cannot fail and always returns a +valid (non\-NULL) +string. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +The unw_regname() +routine is thread\-safe as well as safe to +use from a signal handler. +.PP +.SH SEE ALSO + +.PP +libunwind(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_regname.tex b/sdk/cpprt/linux/libunwind/doc/unw_regname.tex new file mode 100644 index 0000000000..94b6434194 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_regname.tex @@ -0,0 +1,47 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_regname}{David Mosberger-Tang}{Programming Library}{unw\_regname}unw\_regname -- get register name +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{const char~*}\Func{unw\_regname}(\Type{unw\_regnum\_t} \Var{regnum});\\ + +\section{Description} + +The \Func{unw\_regname}() routine returns a printable name for +register \Var{regnum}. If \Var{regnum} is an invalid or otherwise +unrecognized register number, a string consisting of three question +marks is returned. The returned string is statically allocated and +therefore guaranteed to remain valid until the application terminates. + +\section{Return Value} + +The \Func{unw\_regname}() routine cannot fail and always returns a +valid (non-\Const{NULL}) string. + +\section{Thread and Signal Safety} + +The \Func{unw\_regname}() routine is thread-safe as well as safe to +use from a signal handler. + +\section{See Also} + +\SeeAlso{libunwind(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_resume.man b/sdk/cpprt/linux/libunwind/doc/unw_resume.man new file mode 100644 index 0000000000..1bf38327bf --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_resume.man @@ -0,0 +1,146 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_RESUME" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_resume +\-\- resume execution in a particular stack frame +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_resume(unw_cursor_t *cp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_resume() +routine resumes execution at the stack frame +identified by cp\&. +The behavior of this routine differs +slightly for local and remote unwinding. +.PP +For local unwinding, unw_resume() +restores the machine state +and then directly resumes execution in the target stack frame. Thus +unw_resume() +does not return in this case. Restoring the +machine state normally involves restoring the ``preserved\&'' +(callee\-saved) registers. However, if execution in any of the stack +frames younger (more deeply nested) than the one identified by +cp +was interrupted by a signal, then unw_resume() +will +restore all registers as well as the signal mask. Attempting to call +unw_resume() +on a cursor which identifies the stack frame of +another thread results in undefined behavior (e.g., the program may +crash). +.PP +For remote unwinding, unw_resume() +installs the machine state +identified by the cursor by calling the access_reg +and +access_fpreg +accessor callbacks as needed. Once that is +accomplished, the resume +accessor callback is invoked. The +unw_resume +routine then returns normally (that is, unlikely +for local unwinding, unw_resume +will always return for remote +unwinding). +.PP +Most platforms reserve some registers to pass arguments to exception +handlers (e.g., IA\-64 uses r15\-r18 +for this +purpose). These registers are normally treated like ``scratch\&'' +registers. However, if libunwind +is used to set an exception +argument register to a particular value (e.g., via +unw_set_reg()), +then unw_resume() +will install this +value as the contents of the register. In other words, the exception +handling arguments are installed even in cases where normally only the +``preserved\&'' registers are restored. +.PP +Note that unw_resume() +does \fInot\fP +invoke any unwind +handlers (aka, ``personality routines\&''). If a program needs this, it +will have to do so on its own by obtaining the unw_proc_info_t +of each unwound frame and appropriately processing its unwind handler +and language\-specific data area (lsda). These steps are generally +dependent on the target\-platform and are regulated by the +processor\-specific ABI (application\-binary interface). +.PP +.SH RETURN VALUE + +.PP +For local unwinding, unw_resume() +does not return on success. +For remote unwinding, it returns 0 on success. On failure, the +negative value of one of the errors below is returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_resume() +is thread\-safe. If cursor cp +is in the +local address\-space, this routine is also safe to use from a signal +handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + A register needed by unw_resume() +wasn\&'t +accessible. +.TP +UNW_EINVALIDIP + The instruction pointer identified by +cp +is not valid. +.TP +UNW_BADFRAME + The stack frame identified by +cp +is not valid. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_set_reg(3), +sigprocmask(2) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_resume.tex b/sdk/cpprt/linux/libunwind/doc/unw_resume.tex new file mode 100644 index 0000000000..38b18248ab --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_resume.tex @@ -0,0 +1,99 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_resume}{David Mosberger-Tang}{Programming Library}{unw\_resume}unw\_resume -- resume execution in a particular stack frame +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_resume}(\Type{unw\_cursor\_t~*}\Var{cp});\\ + +\section{Description} + +The \Func{unw\_resume}() routine resumes execution at the stack frame +identified by \Var{cp}. The behavior of this routine differs +slightly for local and remote unwinding. + +For local unwinding, \Func{unw\_resume}() restores the machine state +and then directly resumes execution in the target stack frame. Thus +\Func{unw\_resume}() does not return in this case. Restoring the +machine state normally involves restoring the ``preserved'' +(callee-saved) registers. However, if execution in any of the stack +frames younger (more deeply nested) than the one identified by +\Var{cp} was interrupted by a signal, then \Func{unw\_resume}() will +restore all registers as well as the signal mask. Attempting to call +\Func{unw\_resume}() on a cursor which identifies the stack frame of +another thread results in undefined behavior (e.g., the program may +crash). + +For remote unwinding, \Func{unw\_resume}() installs the machine state +identified by the cursor by calling the \Func{access\_reg} and +\Func{access\_fpreg} accessor callbacks as needed. Once that is +accomplished, the \Func{resume} accessor callback is invoked. The +\Func{unw\_resume} routine then returns normally (that is, unlikely +for local unwinding, \Func{unw\_resume} will always return for remote +unwinding). + +Most platforms reserve some registers to pass arguments to exception +handlers (e.g., IA-64 uses \texttt{r15}-\texttt{r18} for this +purpose). These registers are normally treated like ``scratch'' +registers. However, if \Prog{libunwind} is used to set an exception +argument register to a particular value (e.g., via +\Func{unw\_set\_reg}()), then \Func{unw\_resume}() will install this +value as the contents of the register. In other words, the exception +handling arguments are installed even in cases where normally only the +``preserved'' registers are restored. + +Note that \Func{unw\_resume}() does \emph{not} invoke any unwind +handlers (aka, ``personality routines''). If a program needs this, it +will have to do so on its own by obtaining the \Type{unw\_proc\_info\_t} +of each unwound frame and appropriately processing its unwind handler +and language-specific data area (lsda). These steps are generally +dependent on the target-platform and are regulated by the +processor-specific ABI (application-binary interface). + +\section{Return Value} + +For local unwinding, \Func{unw\_resume}() does not return on success. +For remote unwinding, it returns 0 on success. On failure, the +negative value of one of the errors below is returned. + +\section{Thread and Signal Safety} + +\Func{unw\_resume}() is thread-safe. If cursor \Var{cp} is in the +local address-space, this routine is also safe to use from a signal +handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] A register needed by \Func{unw\_resume}() wasn't + accessible. +\item[\Const{UNW\_EINVALIDIP}] The instruction pointer identified by + \Var{cp} is not valid. +\item[\Const{UNW\_BADFRAME}] The stack frame identified by + \Var{cp} is not valid. +\end{Description} + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_set\_reg(3)}, +sigprocmask(2) + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.man b/sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.man new file mode 100644 index 0000000000..a21d84a6dd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.man @@ -0,0 +1,118 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_SET\\_CACHING\\_POLICY" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_set_caching_policy +\-\- set unwind caching policy +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_set_caching_policy(unw_addr_space_t +as, +unw_caching_policy_t +policy); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_set_caching_policy() +routine sets the caching policy +of address space as +to the policy specified by argument +policy\&. +The policy +argument can take one of three +possible values: +.TP +UNW_CACHE_NONE + Turns off caching completely. This +also implicitly flushes the contents of all caches as if +unw_flush_cache() +had been called. +.TP +UNW_CACHE_GLOBAL + Enables caching using a global cache +that is shared by all threads. If global caching is unavailable or +unsupported, libunwind +may fall back on using a per\-thread +cache, as if UNW_CACHE_PER_THREAD +had been specified. +.TP +UNW_CACHE_PER_THREAD + Enables caching using +thread\-local caches. If a thread\-local caching are unavailable or +unsupported, libunwind +may fall back on using a global cache, +as if UNW_CACHE_GLOBAL +had been specified. +.PP +If caching is enabled, an application must be prepared to make +appropriate calls to unw_flush_cache() +whenever the target +changes in a way that could affect the validity of cached information. +For example, after unloading (removing) a shared library, +unw_flush_cache() +would have to be called (at least) for the +address\-range that was covered by the shared library. +.PP +For address spaces created via unw_create_addr_space(3), +caching is turned off by default. For the local address space +unw_local_addr_space, +caching is turned on by default. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_set_caching_policy() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_set_caching_policy() +is thread\-safe but \fInot\fP +safe +to use from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_ENOMEM + The desired caching policy could not be +established because the application is out of memory. +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3), +unw_flush_cache(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.tex b/sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.tex new file mode 100644 index 0000000000..a84e0201e0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_set_caching_policy.tex @@ -0,0 +1,80 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_set\_caching\_policy}{David Mosberger-Tang}{Programming Library}{unw\_set\_caching\_policy}unw\_set\_caching\_policy -- set unwind caching policy +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_set\_caching\_policy}(\Type{unw\_addr\_space\_t} \Var{as}, \Type{unw\_caching\_policy\_t} \Var{policy});\\ + +\section{Description} + +The \Func{unw\_set\_caching\_policy}() routine sets the caching policy +of address space \Var{as} to the policy specified by argument +\Var{policy}. The \Var{policy} argument can take one of three +possible values: +\begin{description} +\item[\Const{UNW\_CACHE\_NONE}] Turns off caching completely. This + also implicitly flushes the contents of all caches as if + \Func{unw\_flush\_cache}() had been called. +\item[\Const{UNW\_CACHE\_GLOBAL}] Enables caching using a global cache + that is shared by all threads. If global caching is unavailable or + unsupported, \Prog{libunwind} may fall back on using a per-thread + cache, as if \Const{UNW\_CACHE\_PER\_THREAD} had been specified. +\item[\Const{UNW\_CACHE\_PER\_THREAD}] Enables caching using + thread-local caches. If a thread-local caching are unavailable or + unsupported, \Prog{libunwind} may fall back on using a global cache, + as if \Const{UNW\_CACHE\_GLOBAL} had been specified. +\end{description} + +If caching is enabled, an application must be prepared to make +appropriate calls to \Func{unw\_flush\_cache}() whenever the target +changes in a way that could affect the validity of cached information. +For example, after unloading (removing) a shared library, +\Func{unw\_flush\_cache}() would have to be called (at least) for the +address-range that was covered by the shared library. + +For address spaces created via \Func{unw\_create\_addr\_space}(3), +caching is turned off by default. For the local address space +\Func{unw\_local\_addr\_space}, caching is turned on by default. + +\section{Return Value} + +On successful completion, \Func{unw\_set\_caching\_policy}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_set\_caching\_policy}() is thread-safe but \emph{not} safe +to use from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_ENOMEM}] The desired caching policy could not be + established because the application is out of memory. +\end{Description} + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_create\_addr\_space(3)}, +\SeeAlso{unw\_flush\_cache(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.man b/sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.man new file mode 100644 index 0000000000..6cefa54623 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.man @@ -0,0 +1,117 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_SET\\_FPREG" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_set_fpreg +\-\- set contents of floating\-point register +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_set_fpreg(unw_cursor_t *cp, +unw_regnum_t +reg, +unw_fpreg_t +val); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_set_fpreg() +routine sets the value of register +reg +in the stack frame identified by cursor cp +to the +value passed in val\&. +.PP +The register numbering is target\-dependent and described in separate +manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that cp +is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee\-saved\&'') registers and frame\-related registers (such as the +stack\-pointer). However, for signal frames (see +unw_is_signal_frame(3)), +it is usually possible to access +all registers. +.PP +Note that unw_set_fpreg() +can only write the contents of +floating\-point registers. See unw_set_reg(3) +for a way to +write registers which fit in a single word. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_set_fpreg() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_set_fpreg() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + An attempt was made to write a register +that is either invalid or not accessible in the current frame. +.TP +UNW_EREADONLY + An attempt was made to write to a +read\-only register. +.PP +In addition, unw_set_fpreg() +may return any error returned by +the access_mem(), +access_reg(), +and +access_fpreg() +call\-backs (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +libunwind\-ia64(3), +unw_get_fpreg(3), +unw_is_fpreg(3), +unw_is_signal_frame(3), +unw_set_reg(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.tex b/sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.tex new file mode 100644 index 0000000000..aaf7fb25a7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_set_fpreg.tex @@ -0,0 +1,79 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_set\_fpreg}{David Mosberger-Tang}{Programming Library}{unw\_set\_fpreg}unw\_set\_fpreg -- set contents of floating-point register +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_set\_fpreg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_fpreg\_t} \Var{val});\\ + +\section{Description} + +The \Func{unw\_set\_fpreg}() routine sets the value of register +\Var{reg} in the stack frame identified by cursor \Var{cp} to the +value passed in \Var{val}. + +The register numbering is target-dependent and described in separate +manual pages (e.g., libunwind-ia64(3) for the IA-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that \Var{cp} is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee-saved'') registers and frame-related registers (such as the +stack-pointer). However, for signal frames (see +\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access +all registers. + +Note that \Func{unw\_set\_fpreg}() can only write the contents of +floating-point registers. See \Func{unw\_set\_reg}(3) for a way to +write registers which fit in a single word. + +\section{Return Value} + +On successful completion, \Func{unw\_set\_fpreg}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_set\_fpreg}() is thread-safe as well as safe to use +from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] An attempt was made to write a register + that is either invalid or not accessible in the current frame. +\item[\Const{UNW\_EREADONLY}] An attempt was made to write to a + read-only register. +\end{Description} +In addition, \Func{unw\_set\_fpreg}() may return any error returned by +the \Func{access\_mem}(), \Func{access\_reg}(), and +\Func{access\_fpreg}() call-backs (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{libunwind-ia64(3)}, +\SeeAlso{unw\_get\_fpreg(3)}, +\SeeAlso{unw\_is\_fpreg(3)}, +\SeeAlso{unw\_is\_signal\_frame(3)}, +\SeeAlso{unw\_set\_reg(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_set_reg.man b/sdk/cpprt/linux/libunwind/doc/unw_set_reg.man new file mode 100644 index 0000000000..5d57045f74 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_set_reg.man @@ -0,0 +1,117 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_SET\\_REG" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_set_reg +\-\- set register contents +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_set_reg(unw_cursor_t *cp, +unw_regnum_t +reg, +unw_word_t +val); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_set_reg() +routine sets the value of register +reg +in the stack frame identified by cursor cp +to the +value passed in val\&. +.PP +The register numbering is target\-dependent and described in separate +manual pages (e.g., libunwind\-ia64(3) for the IA\-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that cp +is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee\-saved\&'') registers and frame\-related registers (such as the +stack\-pointer). However, for signal frames (see +unw_is_signal_frame(3)), +it is usually possible to access +all registers. +.PP +Note that unw_set_reg() +can only write the contents of +registers whose values fit in a single word. See +unw_set_fpreg(3) +for a way to write registers which do not +fit this constraint. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_set_reg() +returns 0. +Otherwise the negative value of one of the error\-codes below is +returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_set_reg() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_EBADREG + An attempt was made to write a register +that is either invalid or not accessible in the current frame. +.TP +UNW_EREADONLY + An attempt was made to write to a +read\-only register. +.PP +In addition, unw_set_reg() +may return any error returned by +the access_mem(), +access_reg(), +and +access_fpreg() +call\-backs (see +unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +libunwind\-ia64(3), +unw_get_reg(3), +unw_is_signal_frame(3), +unw_set_fpreg(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_set_reg.tex b/sdk/cpprt/linux/libunwind/doc/unw_set_reg.tex new file mode 100644 index 0000000000..2421846be5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_set_reg.tex @@ -0,0 +1,79 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_set\_reg}{David Mosberger-Tang}{Programming Library}{unw\_set\_reg}unw\_set\_reg -- set register contents +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_set\_reg}(\Type{unw\_cursor\_t~*}\Var{cp}, \Type{unw\_regnum\_t} \Var{reg}, \Type{unw\_word\_t} \Var{val});\\ + +\section{Description} + +The \Func{unw\_set\_reg}() routine sets the value of register +\Var{reg} in the stack frame identified by cursor \Var{cp} to the +value passed in \Var{val}. + +The register numbering is target-dependent and described in separate +manual pages (e.g., libunwind-ia64(3) for the IA-64 target). +Furthermore, the exact set of accessible registers may depend on the +type of frame that \Var{cp} is referring to. For ordinary stack +frames, it is normally possible to access only the preserved +(``callee-saved'') registers and frame-related registers (such as the +stack-pointer). However, for signal frames (see +\Func{unw\_is\_signal\_frame}(3)), it is usually possible to access +all registers. + +Note that \Func{unw\_set\_reg}() can only write the contents of +registers whose values fit in a single word. See +\Func{unw\_set\_fpreg}(3) for a way to write registers which do not +fit this constraint. + +\section{Return Value} + +On successful completion, \Func{unw\_set\_reg}() returns 0. +Otherwise the negative value of one of the error-codes below is +returned. + +\section{Thread and Signal Safety} + +\Func{unw\_set\_reg}() is thread-safe as well as safe to use +from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_EBADREG}] An attempt was made to write a register + that is either invalid or not accessible in the current frame. +\item[\Const{UNW\_EREADONLY}] An attempt was made to write to a + read-only register. +\end{Description} +In addition, \Func{unw\_set\_reg}() may return any error returned by +the \Func{access\_mem}(), \Func{access\_reg}(), and +\Func{access\_fpreg}() call-backs (see +\Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{libunwind-ia64(3)}, +\SeeAlso{unw\_get\_reg(3)}, +\SeeAlso{unw\_is\_signal\_frame(3)}, +\SeeAlso{unw\_set\_fpreg(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_step.man b/sdk/cpprt/linux/libunwind/doc/unw_step.man new file mode 100644 index 0000000000..54da1b2f3d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_step.man @@ -0,0 +1,106 @@ +'\" t +.\" Manual page created with latex2man on Thu Aug 16 09:44:45 MDT 2007 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_STEP" "3" "16 August 2007" "Programming Library " "Programming Library " +.SH NAME +unw_step +\-\- advance to next stack frame +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +int +unw_step(unw_cursor_t *cp); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_step() +routine advances the unwind cursor cp +to +the next older, less deeply nested stack frame. +.PP +.SH RETURN VALUE + +.PP +On successful completion, unw_step() +returns a positive value +if the updated cursor refers to a valid stack frame, or 0 if the +previous stack frame was the last frame in the chain. On error, the +negative value of one of the error\-codes below is returned. +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_step() +is thread\-safe. If cursor cp +is in the local +address\-space, this routine is also safe to use from a signal handler. +.PP +.SH ERRORS + +.PP +.TP +UNW_EUNSPEC + An unspecified error occurred. +.TP +UNW_ENOINFO + Libunwind +was unable to locate the +unwind\-info needed to complete the operation. +.TP +UNW_EBADVERSION + The unwind\-info needed to complete the +operation has a version or a format that is not understood by +libunwind\&. +.TP +UNW_EINVALIDIP + The instruction\-pointer +(``program\-counter\&'') of the next stack frame is invalid (e.g., not +properly aligned). +.TP +UNW_EBADFRAME + The next stack frame is invalid. +.TP +UNW_ESTOPUNWIND + Returned if a call to +find_proc_info() +returned \-UNW_ESTOPUNWIND\&. +.PP +In addition, unw_step() +may return any error returned by the +find_proc_info(), +get_dyn_info_list_addr(), +access_mem(), +access_reg(), +or access_fpreg() +call\-backs (see unw_create_addr_space(3)). +.PP +.SH SEE ALSO + +.PP +libunwind(3), +unw_create_addr_space(3) +.PP +.SH AUTHOR + +.PP +David Mosberger\-Tang +.br +Email: \fBdmosberger@gmail.com\fP +.br +WWW: \fBhttp://www.nongnu.org/libunwind/\fP\&. +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_step.tex b/sdk/cpprt/linux/libunwind/doc/unw_step.tex new file mode 100644 index 0000000000..106bd9ba99 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_step.tex @@ -0,0 +1,68 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_step}{David Mosberger-Tang}{Programming Library}{unw\_step}unw\_step -- advance to next stack frame +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{int} \Func{unw\_step}(\Type{unw\_cursor\_t~*}\Var{cp});\\ + +\section{Description} + +The \Func{unw\_step}() routine advances the unwind cursor \Var{cp} to +the next older, less deeply nested stack frame. + +\section{Return Value} + +On successful completion, \Func{unw\_step}() returns a positive value +if the updated cursor refers to a valid stack frame, or 0 if the +previous stack frame was the last frame in the chain. On error, the +negative value of one of the error-codes below is returned. + +\section{Thread and Signal Safety} + +\Func{unw\_step}() is thread-safe. If cursor \Var{cp} is in the local +address-space, this routine is also safe to use from a signal handler. + +\section{Errors} + +\begin{Description} +\item[\Const{UNW\_EUNSPEC}] An unspecified error occurred. +\item[\Const{UNW\_ENOINFO}] \Prog{Libunwind} was unable to locate the + unwind-info needed to complete the operation. +\item[\Const{UNW\_EBADVERSION}] The unwind-info needed to complete the + operation has a version or a format that is not understood by + \Prog{libunwind}. +\item[\Const{UNW\_EINVALIDIP}] The instruction-pointer + (``program-counter'') of the next stack frame is invalid (e.g., not + properly aligned). +\item[\Const{UNW\_EBADFRAME}] The next stack frame is invalid. +\item[\Const{UNW\_ESTOPUNWIND}] Returned if a call to + \Func{find\_proc\_info}() returned -\Const{UNW\_ESTOPUNWIND}. +\end{Description} +In addition, \Func{unw\_step}() may return any error returned by the +\Func{find\_proc\_info}(), \Func{get\_dyn\_info\_list\_addr}(), +\Func{access\_mem}(), \Func{access\_reg}(), or \Func{access\_fpreg}() +call-backs (see \Func{unw\_create\_addr\_space}(3)). + +\section{See Also} + +\SeeAlso{libunwind(3)}, +\SeeAlso{unw\_create\_addr\_space(3)} + +\section{Author} + +\noindent +David Mosberger-Tang\\ +Email: \Email{dmosberger@gmail.com}\\ +WWW: \URL{http://www.nongnu.org/libunwind/}. +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/doc/unw_strerror.man b/sdk/cpprt/linux/libunwind/doc/unw_strerror.man new file mode 100644 index 0000000000..467c44d262 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_strerror.man @@ -0,0 +1,63 @@ +'\" t +.\" Manual page created with latex2man on Wed Aug 18 16:51:29 CEST 2004 +.\" NOTE: This file is generated, DO NOT EDIT. +.de Vb +.ft CW +.nf +.. +.de Ve +.ft R + +.fi +.. +.TH "UNW\\_STRERROR" "3" "18 August 2004" "Programming Library " "Programming Library " +.SH NAME +unw_strerror +\-\- get text corresponding to error code +.PP +.SH SYNOPSIS + +.PP +#include +.br +.PP +const char * +unw_strerror(int +err_code); +.br +.PP +.SH DESCRIPTION + +.PP +The unw_strerror() +routine maps the (negative) err_code +to a corresponding text message and returns it. +.PP +.SH RETURN VALUE + +.PP +The message that corresponds to err_code +or, if the +err_code +has no corresponding message, the text "invalid error +code". +.PP +.SH THREAD AND SIGNAL SAFETY + +.PP +unw_strerror() +is thread\-safe as well as safe to use +from a signal handler. +.PP +.SH AUTHOR + +.PP +Thomas Hallgren +.br +BEA Systems +.br +Stockholm, Sweden +.br +Email: \fBthallgre@bea.com\fP +.br +.\" NOTE: This file is generated, DO NOT EDIT. diff --git a/sdk/cpprt/linux/libunwind/doc/unw_strerror.tex b/sdk/cpprt/linux/libunwind/doc/unw_strerror.tex new file mode 100644 index 0000000000..7cad011768 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/doc/unw_strerror.tex @@ -0,0 +1,42 @@ +\documentclass{article} +\usepackage[fancyhdr,pdf]{latex2man} + +\input{common.tex} + +\begin{document} + +\begin{Name}{3}{unw\_strerror}{Thomas Hallgren}{Programming Library}{unw\_strerror}unw\_strerror -- get text corresponding to error code +\end{Name} + +\section{Synopsis} + +\File{\#include $<$libunwind.h$>$}\\ + +\Type{const char *} \Func{unw\_strerror}(\Type{int} \Var{err\_code});\\ + +\section{Description} + +The \Func{unw\_strerror}() routine maps the (negative) \Var{err\_code} +to a corresponding text message and returns it. + +\section{Return Value} + +The message that corresponds to \Var{err\_code} or, if the +\Var{err\_code} has no corresponding message, the text "invalid error +code". + +\section{Thread and Signal Safety} + +\Func{unw\_strerror}() is thread-safe as well as safe to use +from a signal handler. + +\section{Author} + +\noindent +Thomas Hallgren\\ +BEA Systems\\ +Stockholm, Sweden\\ +Email: \Email{thallgre@bea.com}\\ +\LatexManEnd + +\end{document} diff --git a/sdk/cpprt/linux/libunwind/include/dwarf-eh.h b/sdk/cpprt/linux/libunwind/include/dwarf-eh.h new file mode 100644 index 0000000000..405e394a61 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/dwarf-eh.h @@ -0,0 +1,128 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_eh_h +#define dwarf_eh_h + +#include "dwarf.h" + +/* This header file defines the format of a DWARF exception-header + section (.eh_frame_hdr, pointed to by program-header + PT_GNU_EH_FRAME). The exception-header is self-describing in the + sense that the format of the addresses contained in it is expressed + as a one-byte type-descriptor called a "pointer-encoding" (PE). + + The exception header encodes the address of the .eh_frame section + and optionally contains a binary search table for the + Frame Descriptor Entries (FDEs) in the .eh_frame. The contents of + .eh_frame has the format described by the DWARF v3 standard + (http://www.eagercon.com/dwarf/dwarf3std.htm), except that code + addresses may be encoded in different ways. Also, .eh_frame has + augmentations that allow encoding a language-specific data-area + (LSDA) pointer and a pointer to a personality-routine. + + Details: + + The Common Information Entry (CIE) associated with an FDE may + contain an augmentation string. Each character in this string has + a specific meaning and either one or two associated operands. The + operands are stored in an augmentation body which appears right + after the "return_address_register" member and before the + "initial_instructions" member. The operands appear in the order + in which the characters appear in the string. For example, if the + augmentation string is "zL", the operand for 'z' would be first in + the augmentation body and the operand for 'L' would be second. + The following characters are supported for the CIE augmentation + string: + + 'z': The operand for this character is a uleb128 value that gives the + length of the CIE augmentation body, not counting the length + of the uleb128 operand itself. If present, this code must + appear as the first character in the augmentation body. + + 'L': Indicates that the FDE's augmentation body contains an LSDA + pointer. The operand for this character is a single byte + that specifies the pointer-encoding (PE) that is used for + the LSDA pointer. + + 'R': Indicates that the code-pointers (FDE members + "initial_location" and "address_range" and the operand for + DW_CFA_set_loc) in the FDE have a non-default encoding. The + operand for this character is a single byte that specifies + the pointer-encoding (PE) that is used for the + code-pointers. Note: the "address_range" member is always + encoded as an absolute value. Apart from that, the specified + FDE pointer-encoding applies. + + 'P': Indicates the presence of a personality routine (handler). + The first operand for this character specifies the + pointer-encoding (PE) that is used for the second operand, + which specifies the address of the personality routine. + + If the augmentation string contains any other characters, the + remainder of the augmentation string should be ignored. + Furthermore, if the size of the augmentation body is unknown + (i.e., 'z' is not the first character of the augmentation string), + then the entire CIE as well all associated FDEs must be ignored. + + A Frame Descriptor Entries (FDE) may contain an augmentation body + which, if present, appears right after the "address_range" member + and before the "instructions" member. The contents of this body + is implicitly defined by the augmentation string of the associated + CIE. The meaning of the characters in the CIE's augmentation + string as far as FDEs are concerned is as follows: + + 'z': The first operand in the FDE's augmentation body specifies + the total length of the augmentation body as a uleb128 (not + counting the length of the uleb128 operand itself). + + 'L': The operand for this character is an LSDA pointer, encoded + in the format specified by the corresponding operand in the + CIE's augmentation body. + +*/ + +#define DW_EH_VERSION 1 /* The version we're implementing */ + +struct dwarf_eh_frame_hdr + { + unsigned char version; + unsigned char eh_frame_ptr_enc; + unsigned char fde_count_enc; + unsigned char table_enc; + /* The rest of the header is variable-length and consists of the + following members: + + encoded_t eh_frame_ptr; + encoded_t fde_count; + struct + { + encoded_t start_ip; // first address covered by this FDE + encoded_t fde_addr; // address of the FDE + } + binary_search_table[fde_count]; */ + }; + +#endif /* dwarf_eh_h */ diff --git a/sdk/cpprt/linux/libunwind/include/dwarf.h b/sdk/cpprt/linux/libunwind/include/dwarf.h new file mode 100644 index 0000000000..4abe6692e4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/dwarf.h @@ -0,0 +1,433 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_h +#define dwarf_h + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_ATOMIC_OPS_H +# include +#endif + +#include + +struct dwarf_cursor; /* forward-declaration */ +struct elf_dyn_info; + +#include "dwarf-config.h" +#ifndef UNW_REMOTE_ONLY +#include +#endif + +#if HAVE_SGX +#include "pthread_compat.h" +#else +#include +#endif + +/* DWARF expression opcodes. */ + +typedef enum + { + DW_OP_addr = 0x03, + DW_OP_deref = 0x06, + DW_OP_const1u = 0x08, + DW_OP_const1s = 0x09, + DW_OP_const2u = 0x0a, + DW_OP_const2s = 0x0b, + DW_OP_const4u = 0x0c, + DW_OP_const4s = 0x0d, + DW_OP_const8u = 0x0e, + DW_OP_const8s = 0x0f, + DW_OP_constu = 0x10, + DW_OP_consts = 0x11, + DW_OP_dup = 0x12, + DW_OP_drop = 0x13, + DW_OP_over = 0x14, + DW_OP_pick = 0x15, + DW_OP_swap = 0x16, + DW_OP_rot = 0x17, + DW_OP_xderef = 0x18, + DW_OP_abs = 0x19, + DW_OP_and = 0x1a, + DW_OP_div = 0x1b, + DW_OP_minus = 0x1c, + DW_OP_mod = 0x1d, + DW_OP_mul = 0x1e, + DW_OP_neg = 0x1f, + DW_OP_not = 0x20, + DW_OP_or = 0x21, + DW_OP_plus = 0x22, + DW_OP_plus_uconst = 0x23, + DW_OP_shl = 0x24, + DW_OP_shr = 0x25, + DW_OP_shra = 0x26, + DW_OP_xor = 0x27, + DW_OP_skip = 0x2f, + DW_OP_bra = 0x28, + DW_OP_eq = 0x29, + DW_OP_ge = 0x2a, + DW_OP_gt = 0x2b, + DW_OP_le = 0x2c, + DW_OP_lt = 0x2d, + DW_OP_ne = 0x2e, + DW_OP_lit0 = 0x30, + DW_OP_lit1, DW_OP_lit2, DW_OP_lit3, DW_OP_lit4, DW_OP_lit5, + DW_OP_lit6, DW_OP_lit7, DW_OP_lit8, DW_OP_lit9, DW_OP_lit10, + DW_OP_lit11, DW_OP_lit12, DW_OP_lit13, DW_OP_lit14, DW_OP_lit15, + DW_OP_lit16, DW_OP_lit17, DW_OP_lit18, DW_OP_lit19, DW_OP_lit20, + DW_OP_lit21, DW_OP_lit22, DW_OP_lit23, DW_OP_lit24, DW_OP_lit25, + DW_OP_lit26, DW_OP_lit27, DW_OP_lit28, DW_OP_lit29, DW_OP_lit30, + DW_OP_lit31, + DW_OP_reg0 = 0x50, + DW_OP_reg1, DW_OP_reg2, DW_OP_reg3, DW_OP_reg4, DW_OP_reg5, + DW_OP_reg6, DW_OP_reg7, DW_OP_reg8, DW_OP_reg9, DW_OP_reg10, + DW_OP_reg11, DW_OP_reg12, DW_OP_reg13, DW_OP_reg14, DW_OP_reg15, + DW_OP_reg16, DW_OP_reg17, DW_OP_reg18, DW_OP_reg19, DW_OP_reg20, + DW_OP_reg21, DW_OP_reg22, DW_OP_reg23, DW_OP_reg24, DW_OP_reg25, + DW_OP_reg26, DW_OP_reg27, DW_OP_reg28, DW_OP_reg29, DW_OP_reg30, + DW_OP_reg31, + DW_OP_breg0 = 0x70, + DW_OP_breg1, DW_OP_breg2, DW_OP_breg3, DW_OP_breg4, DW_OP_breg5, + DW_OP_breg6, DW_OP_breg7, DW_OP_breg8, DW_OP_breg9, DW_OP_breg10, + DW_OP_breg11, DW_OP_breg12, DW_OP_breg13, DW_OP_breg14, DW_OP_breg15, + DW_OP_breg16, DW_OP_breg17, DW_OP_breg18, DW_OP_breg19, DW_OP_breg20, + DW_OP_breg21, DW_OP_breg22, DW_OP_breg23, DW_OP_breg24, DW_OP_breg25, + DW_OP_breg26, DW_OP_breg27, DW_OP_breg28, DW_OP_breg29, DW_OP_breg30, + DW_OP_breg31, + DW_OP_regx = 0x90, + DW_OP_fbreg = 0x91, + DW_OP_bregx = 0x92, + DW_OP_piece = 0x93, + DW_OP_deref_size = 0x94, + DW_OP_xderef_size = 0x95, + DW_OP_nop = 0x96, + DW_OP_push_object_address = 0x97, + DW_OP_call2 = 0x98, + DW_OP_call4 = 0x99, + DW_OP_call_ref = 0x9a, + DW_OP_lo_user = 0xe0, + DW_OP_hi_user = 0xff + } +dwarf_expr_op_t; + +#define DWARF_CIE_VERSION 3 /* GCC emits version 1??? */ + +#define DWARF_CFA_OPCODE_MASK 0xc0 +#define DWARF_CFA_OPERAND_MASK 0x3f + +typedef enum + { + DW_CFA_advance_loc = 0x40, + DW_CFA_offset = 0x80, + DW_CFA_restore = 0xc0, + DW_CFA_nop = 0x00, + DW_CFA_set_loc = 0x01, + DW_CFA_advance_loc1 = 0x02, + DW_CFA_advance_loc2 = 0x03, + DW_CFA_advance_loc4 = 0x04, + DW_CFA_offset_extended = 0x05, + DW_CFA_restore_extended = 0x06, + DW_CFA_undefined = 0x07, + DW_CFA_same_value = 0x08, + DW_CFA_register = 0x09, + DW_CFA_remember_state = 0x0a, + DW_CFA_restore_state = 0x0b, + DW_CFA_def_cfa = 0x0c, + DW_CFA_def_cfa_register = 0x0d, + DW_CFA_def_cfa_offset = 0x0e, + DW_CFA_def_cfa_expression = 0x0f, + DW_CFA_expression = 0x10, + DW_CFA_offset_extended_sf = 0x11, + DW_CFA_def_cfa_sf = 0x12, + DW_CFA_def_cfa_offset_sf = 0x13, + DW_CFA_lo_user = 0x1c, + DW_CFA_MIPS_advance_loc8 = 0x1d, + DW_CFA_GNU_window_save = 0x2d, + DW_CFA_GNU_args_size = 0x2e, + DW_CFA_GNU_negative_offset_extended = 0x2f, + DW_CFA_hi_user = 0x3c + } +dwarf_cfa_t; + +/* DWARF Pointer-Encoding (PEs). + + Pointer-Encodings were invented for the GCC exception-handling + support for C++, but they represent a rather generic way of + describing the format in which an address/pointer is stored and + hence we include the definitions here, in the main dwarf.h file. + The Pointer-Encoding format is partially documented in Linux Base + Spec v1.3 (http://www.linuxbase.org/spec/). The rest is reverse + engineered from GCC. + +*/ +#define DW_EH_PE_FORMAT_MASK 0x0f /* format of the encoded value */ +#define DW_EH_PE_APPL_MASK 0x70 /* how the value is to be applied */ +/* Flag bit. If set, the resulting pointer is the address of the word + that contains the final address. */ +#define DW_EH_PE_indirect 0x80 + +/* Pointer-encoding formats: */ +#define DW_EH_PE_omit 0xff +#define DW_EH_PE_ptr 0x00 /* pointer-sized unsigned value */ +#define DW_EH_PE_uleb128 0x01 /* unsigned LE base-128 value */ +#define DW_EH_PE_udata2 0x02 /* unsigned 16-bit value */ +#define DW_EH_PE_udata4 0x03 /* unsigned 32-bit value */ +#define DW_EH_PE_udata8 0x04 /* unsigned 64-bit value */ +#define DW_EH_PE_sleb128 0x09 /* signed LE base-128 value */ +#define DW_EH_PE_sdata2 0x0a /* signed 16-bit value */ +#define DW_EH_PE_sdata4 0x0b /* signed 32-bit value */ +#define DW_EH_PE_sdata8 0x0c /* signed 64-bit value */ + +/* Pointer-encoding application: */ +#define DW_EH_PE_absptr 0x00 /* absolute value */ +#define DW_EH_PE_pcrel 0x10 /* rel. to addr. of encoded value */ +#define DW_EH_PE_textrel 0x20 /* text-relative (GCC-specific???) */ +#define DW_EH_PE_datarel 0x30 /* data-relative */ +/* The following are not documented by LSB v1.3, yet they are used by + GCC, presumably they aren't documented by LSB since they aren't + used on Linux: */ +#define DW_EH_PE_funcrel 0x40 /* start-of-procedure-relative */ +#define DW_EH_PE_aligned 0x50 /* aligned pointer */ + +extern struct mempool dwarf_reg_state_pool; +extern struct mempool dwarf_cie_info_pool; + +typedef enum + { + DWARF_WHERE_UNDEF, /* register isn't saved at all */ + DWARF_WHERE_SAME, /* register has same value as in prev. frame */ + DWARF_WHERE_CFAREL, /* register saved at CFA-relative address */ + DWARF_WHERE_REG, /* register saved in another register */ + DWARF_WHERE_EXPR, /* register saved */ + } +dwarf_where_t; + +typedef struct + { + dwarf_where_t where; /* how is the register saved? */ + unw_word_t val; /* where it's saved */ + } +dwarf_save_loc_t; + +/* For uniformity, we'd like to treat the CFA save-location like any + other register save-location, but this doesn't quite work, because + the CFA can be expressed as a (REGISTER,OFFSET) pair. To handle + this, we use two dwarf_save_loc structures to describe the CFA. + The first one (CFA_REG_COLUMN), tells us where the CFA is saved. + In the case of DWARF_WHERE_EXPR, the CFA is defined by a DWARF + location expression whose address is given by member "val". In the + case of DWARF_WHERE_REG, member "val" gives the number of the + base-register and the "val" member of DWARF_CFA_OFF_COLUMN gives + the offset value. */ +#define DWARF_CFA_REG_COLUMN DWARF_NUM_PRESERVED_REGS +#define DWARF_CFA_OFF_COLUMN (DWARF_NUM_PRESERVED_REGS + 1) + +typedef struct dwarf_reg_state + { + struct dwarf_reg_state *next; /* for rs_stack */ + dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2]; + unw_word_t ip; /* ip this rs is for */ + unw_word_t ret_addr_column; /* indicates which column in the rule table represents return address */ + unsigned short lru_chain; /* used for least-recently-used chain */ + unsigned short coll_chain; /* used for hash collisions */ + unsigned short hint; /* hint for next rs to try (or -1) */ + unsigned short valid : 1; /* optional machine-dependent signal info */ + unsigned short signal_frame : 1; /* optional machine-dependent signal info */ + } +dwarf_reg_state_t; + +typedef struct dwarf_cie_info + { + unw_word_t cie_instr_start; /* start addr. of CIE "initial_instructions" */ + unw_word_t cie_instr_end; /* end addr. of CIE "initial_instructions" */ + unw_word_t fde_instr_start; /* start addr. of FDE "instructions" */ + unw_word_t fde_instr_end; /* end addr. of FDE "instructions" */ + unw_word_t code_align; /* code-alignment factor */ + unw_word_t data_align; /* data-alignment factor */ + unw_word_t ret_addr_column; /* column of return-address register */ + unw_word_t handler; /* address of personality-routine */ + uint16_t abi; + uint16_t tag; + uint8_t fde_encoding; + uint8_t lsda_encoding; + unsigned int sized_augmentation : 1; + unsigned int have_abi_marker : 1; + unsigned int signal_frame : 1; + } +dwarf_cie_info_t; + +typedef struct dwarf_state_record + { + unsigned char fde_encoding; + unw_word_t args_size; + + dwarf_reg_state_t rs_initial; /* reg-state after CIE instructions */ + dwarf_reg_state_t rs_current; /* current reg-state */ + } +dwarf_state_record_t; + +typedef struct dwarf_cursor + { + void *as_arg; /* argument to address-space callbacks */ + unw_addr_space_t as; /* reference to per-address-space info */ + + unw_word_t cfa; /* canonical frame address; aka frame-/stack-pointer */ + unw_word_t ip; /* instruction pointer */ + unw_word_t args_size; /* size of arguments */ + unw_word_t ret_addr_column; /* column for return-address */ + unw_word_t eh_args[UNW_TDEP_NUM_EH_REGS]; + unsigned int eh_valid_mask; + + dwarf_loc_t loc[DWARF_NUM_PRESERVED_REGS]; + + unsigned int stash_frames :1; /* stash frames for fast lookup */ + unsigned int use_prev_instr :1; /* use previous (= call) or current (= signal) instruction? */ + unsigned int pi_valid :1; /* is proc_info valid? */ + unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */ + unw_proc_info_t pi; /* info about current procedure */ + + short hint; /* faster lookup of the rs cache */ + short prev_rs; + } +dwarf_cursor_t; + +#define DWARF_LOG_UNW_CACHE_SIZE 7 +#define DWARF_UNW_CACHE_SIZE (1 << DWARF_LOG_UNW_CACHE_SIZE) + +#define DWARF_LOG_UNW_HASH_SIZE (DWARF_LOG_UNW_CACHE_SIZE + 1) +#define DWARF_UNW_HASH_SIZE (1 << DWARF_LOG_UNW_HASH_SIZE) + +typedef unsigned char unw_hash_index_t; + +struct dwarf_rs_cache + { + pthread_mutex_t lock; + unsigned short lru_head; /* index of lead-recently used rs */ + unsigned short lru_tail; /* index of most-recently used rs */ + + /* hash table that maps instruction pointer to rs index: */ + unsigned short hash[DWARF_UNW_HASH_SIZE]; + + uint32_t generation; /* generation number */ + + /* rs cache: */ + dwarf_reg_state_t buckets[DWARF_UNW_CACHE_SIZE]; + }; + +/* A list of descriptors for loaded .debug_frame sections. */ + +struct unw_debug_frame_list + { + /* The start (inclusive) and end (exclusive) of the described region. */ + unw_word_t start; + unw_word_t end; + /* The debug frame itself. */ + char *debug_frame; + size_t debug_frame_size; + /* Index (for binary search). */ + struct table_entry *index; + size_t index_size; + /* Pointer to next descriptor. */ + struct unw_debug_frame_list *next; + }; + +struct dwarf_callback_data + { + /* in: */ + unw_word_t ip; /* instruction-pointer we're looking for */ + unw_proc_info_t *pi; /* proc-info pointer */ + int need_unwind_info; + /* out: */ + int single_fde; /* did we find a single FDE? (vs. a table) */ + unw_dyn_info_t di; /* table info (if single_fde is false) */ + unw_dyn_info_t di_debug; /* additional table info for .debug_frame */ + }; + +/* Convenience macros: */ +#define dwarf_init UNW_ARCH_OBJ (dwarf_init) +#define dwarf_callback UNW_OBJ (dwarf_callback) +#define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info) +#define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame) +#define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table) +#define dwarf_find_unwind_table UNW_OBJ (dwarf_find_unwind_table) +#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info) +#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info) +#define dwarf_eval_expr UNW_OBJ (dwarf_eval_expr) +#define dwarf_extract_proc_info_from_fde \ + UNW_OBJ (dwarf_extract_proc_info_from_fde) +#define dwarf_find_save_locs UNW_OBJ (dwarf_find_save_locs) +#define dwarf_create_state_record UNW_OBJ (dwarf_create_state_record) +#define dwarf_make_proc_info UNW_OBJ (dwarf_make_proc_info) +#define dwarf_read_encoded_pointer UNW_OBJ (dwarf_read_encoded_pointer) +#define dwarf_step UNW_OBJ (dwarf_step) + +extern int dwarf_init (void); +#ifndef UNW_REMOTE_ONLY +extern int dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr); +extern int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, + int need_unwind_info, void *arg); +#endif /* !UNW_REMOTE_ONLY */ +extern int dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, + unw_word_t ip, unw_word_t segbase, + const char* obj_name, unw_word_t start, + unw_word_t end); +extern int dwarf_search_unwind_table (unw_addr_space_t as, + unw_word_t ip, + unw_dyn_info_t *di, + unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern int dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, + char *path, unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip); +extern void dwarf_put_unwind_info (unw_addr_space_t as, + unw_proc_info_t *pi, void *arg); +extern int dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr, + unw_word_t len, unw_word_t *valp, + int *is_register); +extern int dwarf_extract_proc_info_from_fde (unw_addr_space_t as, + unw_accessors_t *a, + unw_word_t *fde_addr, + unw_proc_info_t *pi, + int need_unwind_info, + unw_word_t base, + void *arg); +extern int dwarf_find_save_locs (struct dwarf_cursor *c); +extern int dwarf_create_state_record (struct dwarf_cursor *c, + dwarf_state_record_t *sr); +extern int dwarf_make_proc_info (struct dwarf_cursor *c); +extern int dwarf_read_encoded_pointer (unw_addr_space_t as, + unw_accessors_t *a, + unw_word_t *addr, + unsigned char encoding, + const unw_proc_info_t *pi, + unw_word_t *valp, void *arg); +extern int dwarf_step (struct dwarf_cursor *c); + +#endif /* dwarf_h */ diff --git a/sdk/cpprt/linux/libunwind/include/dwarf_i.h b/sdk/cpprt/linux/libunwind/include/dwarf_i.h new file mode 100644 index 0000000000..bc0bc84e09 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/dwarf_i.h @@ -0,0 +1,490 @@ +#ifndef DWARF_I_H +#define DWARF_I_H + +/* This file contains definitions that cannot be used in code outside + of libunwind. In particular, most inline functions are here + because otherwise they'd generate unresolved references when the + files are compiled with inlining disabled. */ + +#include "dwarf.h" +#include "libunwind_i.h" + +/* Unless we are told otherwise, assume that a "machine address" is + the size of an unw_word_t. */ +#ifndef dwarf_addr_size +# define dwarf_addr_size(as) (sizeof (unw_word_t)) +#endif + +#define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map) + +extern uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH]; + +/* REG is evaluated multiple times; it better be side-effects free! */ +#define dwarf_to_unw_regnum(reg) \ + (((reg) <= DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0) + +#ifdef UNW_LOCAL_ONLY + +/* In the local-only case, we can let the compiler directly access + memory and don't need to worry about differing byte-order. */ + +union __attribute__ ((packed)) _dwarf_misaligned_value_t + { + int8_t s8; + int16_t s16; + int32_t s32; + int64_t s64; + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; + void *ptr; + }; +typedef union _dwarf_misaligned_value_t dwarf_misaligned_value_t; + +static inline int +dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int8_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->s8; + *addr += sizeof (mvp->s8); + return 0; +} + +static inline int +dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int16_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->s16; + *addr += sizeof (mvp->s16); + return 0; +} + +static inline int +dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int32_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->s32; + *addr += sizeof (mvp->s32); + return 0; +} + +static inline int +dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int64_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->s64; + *addr += sizeof (mvp->s64); + return 0; +} + +static inline int +dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint8_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->u8; + *addr += sizeof (mvp->u8); + return 0; +} + +static inline int +dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint16_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->u16; + *addr += sizeof (mvp->u16); + return 0; +} + +static inline int +dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint32_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->u32; + *addr += sizeof (mvp->u32); + return 0; +} + +static inline int +dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint64_t *val, void *arg) +{ + dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; + + *val = mvp->u64; + *addr += sizeof (mvp->u64); + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ + +static inline int +dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint8_t *valp, void *arg) +{ + unw_word_t val, aligned_addr = *addr & -sizeof (unw_word_t); + unw_word_t off = *addr - aligned_addr; + int ret; + + *addr += 1; + ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg); +#if __BYTE_ORDER == __LITTLE_ENDIAN + val >>= 8*off; +#else + val >>= 8*(sizeof (unw_word_t) - 1 - off); +#endif + *valp = (uint8_t) val; + return ret; +} + +static inline int +dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint16_t *val, void *arg) +{ + uint8_t v0, v1; + int ret; + + if ((ret = dwarf_readu8 (as, a, addr, &v0, arg)) < 0 + || (ret = dwarf_readu8 (as, a, addr, &v1, arg)) < 0) + return ret; + + if (tdep_big_endian (as)) + *val = (uint16_t) v0 << 8 | v1; + else + *val = (uint16_t) v1 << 8 | v0; + return 0; +} + +static inline int +dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint32_t *val, void *arg) +{ + uint16_t v0, v1; + int ret; + + if ((ret = dwarf_readu16 (as, a, addr, &v0, arg)) < 0 + || (ret = dwarf_readu16 (as, a, addr, &v1, arg)) < 0) + return ret; + + if (tdep_big_endian (as)) + *val = (uint32_t) v0 << 16 | v1; + else + *val = (uint32_t) v1 << 16 | v0; + return 0; +} + +static inline int +dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + uint64_t *val, void *arg) +{ + uint32_t v0, v1; + int ret; + + if ((ret = dwarf_readu32 (as, a, addr, &v0, arg)) < 0 + || (ret = dwarf_readu32 (as, a, addr, &v1, arg)) < 0) + return ret; + + if (tdep_big_endian (as)) + *val = (uint64_t) v0 << 32 | v1; + else + *val = (uint64_t) v1 << 32 | v0; + return 0; +} + +static inline int +dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int8_t *val, void *arg) +{ + uint8_t uval; + int ret; + + if ((ret = dwarf_readu8 (as, a, addr, &uval, arg)) < 0) + return ret; + *val = (int8_t) uval; + return 0; +} + +static inline int +dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int16_t *val, void *arg) +{ + uint16_t uval; + int ret; + + if ((ret = dwarf_readu16 (as, a, addr, &uval, arg)) < 0) + return ret; + *val = (int16_t) uval; + return 0; +} + +static inline int +dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int32_t *val, void *arg) +{ + uint32_t uval; + int ret; + + if ((ret = dwarf_readu32 (as, a, addr, &uval, arg)) < 0) + return ret; + *val = (int32_t) uval; + return 0; +} + +static inline int +dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + int64_t *val, void *arg) +{ + uint64_t uval; + int ret; + + if ((ret = dwarf_readu64 (as, a, addr, &uval, arg)) < 0) + return ret; + *val = (int64_t) uval; + return 0; +} + +#endif /* !UNW_LOCAL_ONLY */ + +static inline int +dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + unw_word_t *val, void *arg) +{ + uint32_t u32; + uint64_t u64; + int ret; + + switch (dwarf_addr_size (as)) + { + case 4: + ret = dwarf_readu32 (as, a, addr, &u32, arg); + if (ret < 0) + return ret; + *val = u32; + return ret; + + case 8: + ret = dwarf_readu64 (as, a, addr, &u64, arg); + if (ret < 0) + return ret; + *val = u64; + return ret; + + default: + abort (); + } +} + +/* Read an unsigned "little-endian base 128" value. See Chapter 7.6 + of DWARF spec v3. */ + +static inline int +dwarf_read_uleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + unw_word_t *valp, void *arg) +{ + unw_word_t val = 0, shift = 0; + unsigned char byte; + int ret; + + do + { + if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0) + return ret; + + val |= ((unw_word_t) byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + *valp = val; + return 0; +} + +/* Read a signed "little-endian base 128" value. See Chapter 7.6 of + DWARF spec v3. */ + +static inline int +dwarf_read_sleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + unw_word_t *valp, void *arg) +{ + unw_word_t val = 0, shift = 0; + unsigned char byte; + int ret; + + do + { + if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0) + return ret; + + val |= ((unw_word_t) byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0) + /* sign-extend negative value */ + val |= ((unw_word_t) -1) << shift; + + *valp = val; + return 0; +} + +static ALWAYS_INLINE int +dwarf_read_encoded_pointer_inlined (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unsigned char encoding, + const unw_proc_info_t *pi, + unw_word_t *valp, void *arg) +{ + unw_word_t val, initial_addr = *addr; + uint16_t uval16; + uint32_t uval32; + uint64_t uval64; + int16_t sval16; + int32_t sval32; + int64_t sval64; + int ret; + + /* DW_EH_PE_omit and DW_EH_PE_aligned don't follow the normal + format/application encoding. Handle them first. */ + if (encoding == DW_EH_PE_omit) + { + *valp = 0; + return 0; + } + else if (encoding == DW_EH_PE_aligned) + { + int size = dwarf_addr_size (as); + *addr = (initial_addr + size - 1) & -size; + return dwarf_readw (as, a, addr, valp, arg); + } + + switch (encoding & DW_EH_PE_FORMAT_MASK) + { + case DW_EH_PE_ptr: + if ((ret = dwarf_readw (as, a, addr, &val, arg)) < 0) + return ret; + break; + + case DW_EH_PE_uleb128: + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + return ret; + break; + + case DW_EH_PE_udata2: + if ((ret = dwarf_readu16 (as, a, addr, &uval16, arg)) < 0) + return ret; + val = uval16; + break; + + case DW_EH_PE_udata4: + if ((ret = dwarf_readu32 (as, a, addr, &uval32, arg)) < 0) + return ret; + val = uval32; + break; + + case DW_EH_PE_udata8: + if ((ret = dwarf_readu64 (as, a, addr, &uval64, arg)) < 0) + return ret; + val = uval64; + break; + + case DW_EH_PE_sleb128: + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + return ret; + break; + + case DW_EH_PE_sdata2: + if ((ret = dwarf_reads16 (as, a, addr, &sval16, arg)) < 0) + return ret; + val = sval16; + break; + + case DW_EH_PE_sdata4: + if ((ret = dwarf_reads32 (as, a, addr, &sval32, arg)) < 0) + return ret; + val = sval32; + break; + + case DW_EH_PE_sdata8: + if ((ret = dwarf_reads64 (as, a, addr, &sval64, arg)) < 0) + return ret; + val = sval64; + break; + + default: + Debug (1, "unexpected encoding format 0x%x\n", + encoding & DW_EH_PE_FORMAT_MASK); + return -UNW_EINVAL; + } + + if (val == 0) + { + /* 0 is a special value and always absolute. */ + *valp = 0; + return 0; + } + + switch (encoding & DW_EH_PE_APPL_MASK) + { + case DW_EH_PE_absptr: + break; + + case DW_EH_PE_pcrel: + val += initial_addr; + break; + + case DW_EH_PE_datarel: + /* XXX For now, assume that data-relative addresses are relative + to the global pointer. */ + val += pi->gp; + break; + + case DW_EH_PE_funcrel: + val += pi->start_ip; + break; + + case DW_EH_PE_textrel: + /* XXX For now we don't support text-rel values. If there is a + platform which needs this, we probably would have to add a + "segbase" member to unw_proc_info_t. */ + default: + Debug (1, "unexpected application type 0x%x\n", + encoding & DW_EH_PE_APPL_MASK); + return -UNW_EINVAL; + } + + /* Trim off any extra bits. Assume that sign extension isn't + required; the only place it is needed is MIPS kernel space + addresses. */ + if (sizeof (val) > dwarf_addr_size (as)) + { + assert (dwarf_addr_size (as) == 4); + val = (uint32_t) val; + } + + if (encoding & DW_EH_PE_indirect) + { + unw_word_t indirect_addr = val; + + if ((ret = dwarf_readw (as, a, &indirect_addr, &val, arg)) < 0) + return ret; + } + + *valp = val; + return 0; +} + +#endif /* DWARF_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-arm.h b/sdk/cpprt/linux/libunwind/include/libunwind-arm.h new file mode 100644 index 0000000000..cba380f2e4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-arm.h @@ -0,0 +1,302 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET arm +#define UNW_TARGET_ARM 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +/* FIXME for ARM. Too big? What do other things use for similar tasks? */ +#define UNW_TDEP_CURSOR_LEN 4096 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_ARM_R0, + UNW_ARM_R1, + UNW_ARM_R2, + UNW_ARM_R3, + UNW_ARM_R4, + UNW_ARM_R5, + UNW_ARM_R6, + UNW_ARM_R7, + UNW_ARM_R8, + UNW_ARM_R9, + UNW_ARM_R10, + UNW_ARM_R11, + UNW_ARM_R12, + UNW_ARM_R13, + UNW_ARM_R14, + UNW_ARM_R15, + + /* VFPv2 s0-s31 (obsolescent numberings). */ + UNW_ARM_S0 = 64, + UNW_ARM_S1, + UNW_ARM_S2, + UNW_ARM_S3, + UNW_ARM_S4, + UNW_ARM_S5, + UNW_ARM_S6, + UNW_ARM_S7, + UNW_ARM_S8, + UNW_ARM_S9, + UNW_ARM_S10, + UNW_ARM_S11, + UNW_ARM_S12, + UNW_ARM_S13, + UNW_ARM_S14, + UNW_ARM_S15, + UNW_ARM_S16, + UNW_ARM_S17, + UNW_ARM_S18, + UNW_ARM_S19, + UNW_ARM_S20, + UNW_ARM_S21, + UNW_ARM_S22, + UNW_ARM_S23, + UNW_ARM_S24, + UNW_ARM_S25, + UNW_ARM_S26, + UNW_ARM_S27, + UNW_ARM_S28, + UNW_ARM_S29, + UNW_ARM_S30, + UNW_ARM_S31, + + /* FPA register numberings. */ + UNW_ARM_F0 = 96, + UNW_ARM_F1, + UNW_ARM_F2, + UNW_ARM_F3, + UNW_ARM_F4, + UNW_ARM_F5, + UNW_ARM_F6, + UNW_ARM_F7, + + /* iWMMXt GR register numberings. */ + UNW_ARM_wCGR0 = 104, + UNW_ARM_wCGR1, + UNW_ARM_wCGR2, + UNW_ARM_wCGR3, + UNW_ARM_wCGR4, + UNW_ARM_wCGR5, + UNW_ARM_wCGR6, + UNW_ARM_wCGR7, + + /* iWMMXt register numberings. */ + UNW_ARM_wR0 = 112, + UNW_ARM_wR1, + UNW_ARM_wR2, + UNW_ARM_wR3, + UNW_ARM_wR4, + UNW_ARM_wR5, + UNW_ARM_wR6, + UNW_ARM_wR7, + UNW_ARM_wR8, + UNW_ARM_wR9, + UNW_ARM_wR10, + UNW_ARM_wR11, + UNW_ARM_wR12, + UNW_ARM_wR13, + UNW_ARM_wR14, + UNW_ARM_wR15, + + /* Two-byte encodings from here on. */ + + /* SPSR. */ + UNW_ARM_SPSR = 128, + UNW_ARM_SPSR_FIQ, + UNW_ARM_SPSR_IRQ, + UNW_ARM_SPSR_ABT, + UNW_ARM_SPSR_UND, + UNW_ARM_SPSR_SVC, + + /* User mode registers. */ + UNW_ARM_R8_USR = 144, + UNW_ARM_R9_USR, + UNW_ARM_R10_USR, + UNW_ARM_R11_USR, + UNW_ARM_R12_USR, + UNW_ARM_R13_USR, + UNW_ARM_R14_USR, + + /* FIQ registers. */ + UNW_ARM_R8_FIQ = 151, + UNW_ARM_R9_FIQ, + UNW_ARM_R10_FIQ, + UNW_ARM_R11_FIQ, + UNW_ARM_R12_FIQ, + UNW_ARM_R13_FIQ, + UNW_ARM_R14_FIQ, + + /* IRQ registers. */ + UNW_ARM_R13_IRQ = 158, + UNW_ARM_R14_IRQ, + + /* ABT registers. */ + UNW_ARM_R13_ABT = 160, + UNW_ARM_R14_ABT, + + /* UND registers. */ + UNW_ARM_R13_UND = 162, + UNW_ARM_R14_UND, + + /* SVC registers. */ + UNW_ARM_R13_SVC = 164, + UNW_ARM_R14_SVC, + + /* iWMMXt control registers. */ + UNW_ARM_wC0 = 192, + UNW_ARM_wC1, + UNW_ARM_wC2, + UNW_ARM_wC3, + UNW_ARM_wC4, + UNW_ARM_wC5, + UNW_ARM_wC6, + UNW_ARM_wC7, + + /* VFPv3/Neon 64-bit registers. */ + UNW_ARM_D0 = 256, + UNW_ARM_D1, + UNW_ARM_D2, + UNW_ARM_D3, + UNW_ARM_D4, + UNW_ARM_D5, + UNW_ARM_D6, + UNW_ARM_D7, + UNW_ARM_D8, + UNW_ARM_D9, + UNW_ARM_D10, + UNW_ARM_D11, + UNW_ARM_D12, + UNW_ARM_D13, + UNW_ARM_D14, + UNW_ARM_D15, + UNW_ARM_D16, + UNW_ARM_D17, + UNW_ARM_D18, + UNW_ARM_D19, + UNW_ARM_D20, + UNW_ARM_D21, + UNW_ARM_D22, + UNW_ARM_D23, + UNW_ARM_D24, + UNW_ARM_D25, + UNW_ARM_D26, + UNW_ARM_D27, + UNW_ARM_D28, + UNW_ARM_D29, + UNW_ARM_D30, + UNW_ARM_D31, + + /* For ARM, the CFA is the value of SP (r13) at the call site in the + previous frame. */ + UNW_ARM_CFA, + + UNW_TDEP_LAST_REG = UNW_ARM_D31, + + UNW_TDEP_IP = UNW_ARM_R14, /* A little white lie. */ + UNW_TDEP_SP = UNW_ARM_R13, + UNW_TDEP_EH = UNW_ARM_R0 /* FIXME. */ + } +arm_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for ARM. */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On ARM, we define our own unw_tdep_context instead of using ucontext_t. + This allows us to support systems that don't support getcontext and + therefore do not define ucontext_t. */ +typedef struct unw_tdep_context + { + unsigned long regs[16]; + } +unw_tdep_context_t; + +/* There is no getcontext() on ARM. Use a stub version which only saves GP + registers. FIXME: Not ideal, may not be sufficient for all libunwind + use cases. Stores pc+8, which is only approximately correct, really. */ +#ifndef __thumb__ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ + __asm__ __volatile__ ( \ + "stmia %[base], {r0-r15}" \ + : : [base] "r" (unw_base) : "memory"); \ + }), 0) +#else /* __thumb__ */ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ + __asm__ __volatile__ ( \ + ".align 2\nbx pc\nnop\n.code 32\n" \ + "stmia %[base], {r0-r15}\n" \ + "orr %[base], pc, #1\nbx %[base]" \ + : [base] "+r" (unw_base) : : "memory", "cc"); \ + }), 0) +#endif + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no arm-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-common.h.in b/sdk/cpprt/linux/libunwind/include/libunwind-common.h.in new file mode 100644 index 0000000000..fa753ba153 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-common.h.in @@ -0,0 +1,257 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define UNW_VERSION_MAJOR @PKG_MAJOR@ +#define UNW_VERSION_MINOR @PKG_MINOR@ +#define UNW_VERSION_EXTRA @PKG_EXTRA@ + +#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min)) +#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR) + +#define UNW_PASTE2(x,y) x##y +#define UNW_PASTE(x,y) UNW_PASTE2(x,y) +#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn) +#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn) + +#ifdef UNW_LOCAL_ONLY +# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_) +#else /* !UNW_LOCAL_ONLY */ +# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_) +#endif /* !UNW_LOCAL_ONLY */ + +/* Error codes. The unwind routines return the *negated* values of + these error codes on error and a non-negative value on success. */ +typedef enum + { + UNW_ESUCCESS = 0, /* no error */ + UNW_EUNSPEC, /* unspecified (general) error */ + UNW_ENOMEM, /* out of memory */ + UNW_EBADREG, /* bad register number */ + UNW_EREADONLYREG, /* attempt to write read-only register */ + UNW_ESTOPUNWIND, /* stop unwinding */ + UNW_EINVALIDIP, /* invalid IP */ + UNW_EBADFRAME, /* bad frame */ + UNW_EINVAL, /* unsupported operation or bad value */ + UNW_EBADVERSION, /* unwind info has unsupported version */ + UNW_ENOINFO /* no unwind info found */ + } +unw_error_t; + +/* The following enum defines the indices for a couple of + (pseudo-)registers which have the same meaning across all + platforms. (RO) means read-only. (RW) means read-write. General + registers (aka "integer registers") are expected to start with + index 0. The number of such registers is architecture-dependent. + The remaining indices can be used as an architecture sees fit. The + last valid register index is given by UNW_REG_LAST. */ +typedef enum + { + UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */ + UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */ + UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */ + UNW_REG_LAST = UNW_TDEP_LAST_REG + } +unw_frame_regnum_t; + +/* Number of exception-handler argument registers: */ +#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS + +typedef enum + { + UNW_CACHE_NONE, /* no caching */ + UNW_CACHE_GLOBAL, /* shared global cache */ + UNW_CACHE_PER_THREAD /* per-thread caching */ + } +unw_caching_policy_t; + +typedef int unw_regnum_t; + +/* The unwind cursor starts at the youngest (most deeply nested) frame + and is used to track the frame state as the unwinder steps from + frame to frame. It is safe to make (shallow) copies of variables + of this type. */ +typedef struct unw_cursor + { + unw_word_t opaque[UNW_TDEP_CURSOR_LEN]; + } +unw_cursor_t; + +/* This type encapsulates the entire (preserved) machine-state. */ +typedef unw_tdep_context_t unw_context_t; + +/* unw_getcontext() fills the unw_context_t pointed to by UC with the + machine state as it exists at the call-site. For implementation + reasons, this needs to be a target-dependent macro. It's easiest + to think of unw_getcontext() as being identical to getcontext(). */ +#define unw_getcontext(uc) unw_tdep_getcontext(uc) + +/* Return 1 if register number R is a floating-point register, zero + otherwise. + This routine is signal-safe. */ +#define unw_is_fpreg(r) unw_tdep_is_fpreg(r) + +typedef unw_tdep_fpreg_t unw_fpreg_t; + +typedef struct unw_addr_space *unw_addr_space_t; + +/* Each target may define it's own set of flags, but bits 0-15 are + reserved for general libunwind-use. */ +#define UNW_PI_FLAG_FIRST_TDEP_BIT 16 +/* The information comes from a .debug_frame section. */ +#define UNW_PI_FLAG_DEBUG_FRAME 32 + +typedef struct unw_proc_info + { + unw_word_t start_ip; /* first IP covered by this procedure */ + unw_word_t end_ip; /* first IP NOT covered by this procedure */ + unw_word_t lsda; /* address of lang.-spec. data area (if any) */ + unw_word_t handler; /* optional personality routine */ + unw_word_t gp; /* global-pointer value for this procedure */ + unw_word_t flags; /* misc. flags */ + + int format; /* unwind-info format (arch-specific) */ + int unwind_info_size; /* size of the information (if applicable) */ + void *unwind_info; /* unwind-info (arch-specific) */ + unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */ + } +unw_proc_info_t; + +/* These are backend callback routines that provide access to the + state of a "remote" process. This can be used, for example, to + unwind another process through the ptrace() interface. */ +typedef struct unw_accessors + { + /* Look up the unwind info associated with instruction-pointer IP. + On success, the routine fills in the PROC_INFO structure. */ + int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *, + int, void *); + + /* Release any resources (e.g., memory) that were allocated for + the unwind info returned in by a previous call to + find_proc_info() with NEED_UNWIND_INFO set to 1. */ + void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *); + + /* Return the list-head of the dynamically registered unwind + info. */ + int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *); + + /* Access aligned word at address ADDR. The value is returned + according to the endianness of the host (e.g., if the host is + little-endian and the target is big-endian, access_mem() needs + to byte-swap the value before returning it). */ + int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int, + void *); + + /* Access register number REG at address ADDR. */ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int, + void *); + + /* Access register number REG at address ADDR. */ + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, + unw_fpreg_t *, int, void *); + + int (*resume) (unw_addr_space_t, unw_cursor_t *, void *); + + /* Optional call back to obtain the name of a (static) procedure. + Dynamically generated procedures are handled automatically by + libunwind. This callback is optional and may be set to + NULL. */ + int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t, + unw_word_t *, void *); + } +unw_accessors_t; + +typedef enum unw_save_loc_type + { + UNW_SLT_NONE, /* register is not saved ("not an l-value") */ + UNW_SLT_MEMORY, /* register has been saved in memory */ + UNW_SLT_REG /* register has been saved in (another) register */ + } +unw_save_loc_type_t; + +typedef struct unw_save_loc + { + unw_save_loc_type_t type; + union + { + unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */ + unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */ + } + u; + unw_tdep_save_loc_t extra; /* target-dependent additional information */ + } +unw_save_loc_t; + +/* These routines work both for local and remote unwinding. */ + +#define unw_local_addr_space UNW_OBJ(local_addr_space) +#define unw_create_addr_space UNW_OBJ(create_addr_space) +#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space) +#define unw_get_accessors UNW_ARCH_OBJ(get_accessors) +#define unw_init_local UNW_OBJ(init_local) +#define unw_init_remote UNW_OBJ(init_remote) +#define unw_step UNW_OBJ(step) +#define unw_resume UNW_OBJ(resume) +#define unw_get_proc_info UNW_OBJ(get_proc_info) +#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip) +#define unw_get_reg UNW_OBJ(get_reg) +#define unw_set_reg UNW_OBJ(set_reg) +#define unw_get_fpreg UNW_OBJ(get_fpreg) +#define unw_set_fpreg UNW_OBJ(set_fpreg) +#define unw_get_save_loc UNW_OBJ(get_save_loc) +#define unw_is_signal_frame UNW_OBJ(is_signal_frame) +#define unw_handle_signal_frame UNW_OBJ(handle_signal_frame) +#define unw_get_proc_name UNW_OBJ(get_proc_name) +#define unw_set_caching_policy UNW_OBJ(set_caching_policy) +#define unw_regname UNW_ARCH_OBJ(regname) +#define unw_flush_cache UNW_ARCH_OBJ(flush_cache) +#define unw_strerror UNW_ARCH_OBJ(strerror) + +extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int); +extern void unw_destroy_addr_space (unw_addr_space_t); +extern unw_accessors_t *unw_get_accessors (unw_addr_space_t); +extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t); +extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t); +extern const char *unw_regname (unw_regnum_t); + +extern int unw_init_local (unw_cursor_t *, unw_context_t *); +extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *); +extern int unw_step (unw_cursor_t *); +extern int unw_resume (unw_cursor_t *); +extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *); +extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t, + unw_proc_info_t *, void *); +extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *); +extern int unw_set_reg (unw_cursor_t *, int, unw_word_t); +extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *); +extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t); +extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *); +extern int unw_is_signal_frame (unw_cursor_t *); +extern int unw_handle_signal_frame (unw_cursor_t *); +extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *); +extern const char *unw_strerror (int); +extern int unw_backtrace (void **, int); + +extern unw_addr_space_t unw_local_addr_space; diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-coredump.h b/sdk/cpprt/linux/libunwind/include/libunwind-coredump.h new file mode 100644 index 0000000000..d2b05e71c2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-coredump.h @@ -0,0 +1,73 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef libunwind_coredump_h +#define libunwind_coredump_h + +#include + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* Helper routines which make it easy to use libunwind on a coredump. + They're available only if UNW_REMOTE_ONLY is _not_ defined and they + aren't really part of the libunwind API. They are implemented in a + archive library called libunwind-coredump.a. */ + +struct UCD_info; + +extern struct UCD_info *_UCD_create(const char *filename); +extern void _UCD_destroy(struct UCD_info *); + +extern int _UCD_get_num_threads(struct UCD_info *); +extern void _UCD_select_thread(struct UCD_info *, int); +extern pid_t _UCD_get_pid(struct UCD_info *); +extern int _UCD_get_cursig(struct UCD_info *); +extern int _UCD_add_backing_file_at_segment(struct UCD_info *, int phdr_no, const char *filename); +extern int _UCD_add_backing_file_at_vaddr(struct UCD_info *, + unsigned long vaddr, + const char *filename); + +extern int _UCD_find_proc_info (unw_addr_space_t, unw_word_t, + unw_proc_info_t *, int, void *); +extern void _UCD_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); +extern int _UCD_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, + void *); +extern int _UCD_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, + void *); +extern int _UCD_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int, void *); +extern int _UCD_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int, void *); +extern int _UCD_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, + unw_word_t *, void *); +extern int _UCD_resume (unw_addr_space_t, unw_cursor_t *, void *); +extern unw_accessors_t _UCD_accessors; + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* libunwind_coredump_h */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-dynamic.h b/sdk/cpprt/linux/libunwind/include/libunwind-dynamic.h new file mode 100644 index 0000000000..584f392c56 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-dynamic.h @@ -0,0 +1,210 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* This file defines the runtime-support routines for dynamically +generated code. Even though it is implemented as part of libunwind, +it is logically separate from the interface to perform the actual +unwinding. In particular, this interface is always used in the +context of the unwind target, whereas the rest of the unwind API is +used in context of the process that is doing the unwind (which may be +a debugger running on another machine, for example). + +Note that the data-structures declared here server a dual purpose: +when a program registers a dynamically generated procedure, it uses +these structures directly. On the other hand, with remote-unwinding, +the data-structures are read from the remote process's memory and +translated into internalized versions. To facilitate remote-access, +the following rules should be followed in declaring these structures: + + (1) Declare a member as a pointer only if the the information the + member points to needs to be internalized as well (e.g., a + string representing a procedure name should be declared as + "const char *", but the instruction pointer should be declared + as unw_word_t). + + (2) Provide sufficient padding to ensure that no implicit padding + will be needed on any of the supported target architectures. For + the time being, padding data structures with the assumption that + sizeof (unw_word_t) == 8 should be sufficient. (Note: it's not + impossible to internalize structures with internal padding, but + it does make the process a bit harder). + + (3) Don't declare members that contain bitfields or floating-point + values. + + (4) Don't declare members with enumeration types. Declare them as + int32_t instead. */ + +typedef enum + { + UNW_DYN_STOP = 0, /* end-of-unwind-info marker */ + UNW_DYN_SAVE_REG, /* save register to another register */ + UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */ + UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */ + UNW_DYN_ADD, /* add constant value to a register */ + UNW_DYN_POP_FRAMES, /* drop one or more stack frames */ + UNW_DYN_LABEL_STATE, /* name the current state */ + UNW_DYN_COPY_STATE, /* set the region's entry-state */ + UNW_DYN_ALIAS /* get unwind info from an alias */ + } +unw_dyn_operation_t; + +typedef enum + { + UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */ + UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */ + UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */ + UNW_INFO_FORMAT_ARM_EXIDX /* ARM specific unwind info */ + } +unw_dyn_info_format_t; + +typedef struct unw_dyn_op + { + int8_t tag; /* what operation? */ + int8_t qp; /* qualifying predicate register */ + int16_t reg; /* what register */ + int32_t when; /* when does it take effect? */ + unw_word_t val; /* auxiliary value */ + } +unw_dyn_op_t; + +typedef struct unw_dyn_region_info + { + struct unw_dyn_region_info *next; /* linked list of regions */ + int32_t insn_count; /* region length (# of instructions) */ + uint32_t op_count; /* length of op-array */ + unw_dyn_op_t op[1]; /* variable-length op-array */ + } +unw_dyn_region_info_t; + +typedef struct unw_dyn_proc_info + { + unw_word_t name_ptr; /* address of human-readable procedure name */ + unw_word_t handler; /* address of personality routine */ + uint32_t flags; + int32_t pad0; + unw_dyn_region_info_t *regions; + } +unw_dyn_proc_info_t; + +typedef struct unw_dyn_table_info + { + unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ + unw_word_t segbase; /* segment base */ + unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ + unw_word_t *table_data; + } +unw_dyn_table_info_t; + +typedef struct unw_dyn_remote_table_info + { + unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ + unw_word_t segbase; /* segment base */ + unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ + unw_word_t table_data; + } +unw_dyn_remote_table_info_t; + +typedef struct unw_dyn_info + { + /* doubly-linked list of dyn-info structures: */ + struct unw_dyn_info *next; + struct unw_dyn_info *prev; + unw_word_t start_ip; /* first IP covered by this entry */ + unw_word_t end_ip; /* first IP NOT covered by this entry */ + unw_word_t gp; /* global-pointer in effect for this entry */ + int32_t format; /* real type: unw_dyn_info_format_t */ + int32_t pad; + union + { + unw_dyn_proc_info_t pi; + unw_dyn_table_info_t ti; + unw_dyn_remote_table_info_t rti; + } + u; + } +unw_dyn_info_t; + +typedef struct unw_dyn_info_list + { + uint32_t version; + uint32_t generation; + unw_dyn_info_t *first; + } +unw_dyn_info_list_t; + +/* Return the size (in bytes) of an unw_dyn_region_info_t structure that can + hold OP_COUNT ops. */ +#define _U_dyn_region_info_size(op_count) \ + ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \ + - (char *) NULL) + +/* Register the unwind info for a single procedure. + This routine is NOT signal-safe. */ +extern void _U_dyn_register (unw_dyn_info_t *); + +/* Cancel the unwind info for a single procedure. + This routine is NOT signal-safe. */ +extern void _U_dyn_cancel (unw_dyn_info_t *); + + +/* Convenience routines. */ + +#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \ + ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) }) + +#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \ + (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst))) + +#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \ + (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \ + (offset))) + +#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \ + (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \ + (offset))) + +#define _U_dyn_op_add(op, qp, when, reg, value) \ + (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value))) + +#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \ + (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames))) + +#define _U_dyn_op_label_state(op, label) \ + (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label))) + +#define _U_dyn_op_copy_state(op, label) \ + (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label))) + +#define _U_dyn_op_alias(op, qp, when, addr) \ + (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr))) + +#define _U_dyn_op_stop(op) \ + (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0)) + +/* The target-dependent qualifying predicate which is always TRUE. On + IA-64, that's p0 (0), on non-predicated architectures, the value is + ignored. */ +#define _U_QP_TRUE _U_TDEP_QP_TRUE diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-hppa.h b/sdk/cpprt/linux/libunwind/include/libunwind-hppa.h new file mode 100644 index 0000000000..74ea70da6c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-hppa.h @@ -0,0 +1,125 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET hppa +#define UNW_TARGET_HPPA 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 511 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef union + { + struct { unw_word_t bits[2]; } raw; + double val; + } +unw_tdep_fpreg_t; + +typedef enum + { + /* Note: general registers are expected to start with index 0. + This convention facilitates architecture-independent + implementation of the C++ exception handling ABI. See + _Unwind_SetGR() and _Unwind_GetGR() for details. */ + UNW_HPPA_GR = 0, + UNW_HPPA_RP = 2, /* return pointer */ + UNW_HPPA_FP = 3, /* frame pointer */ + UNW_HPPA_SP = UNW_HPPA_GR + 30, + + UNW_HPPA_FR = UNW_HPPA_GR + 32, + + UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */ + + /* other "preserved" registers (fpsr etc.)... */ + + /* PA-RISC has 4 exception-argument registers but they're not + contiguous. To deal with this, we define 4 pseudo + exception-handling registers which we then alias to the actual + physical register. */ + + UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */ + UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */ + UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */ + UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */ + + /* frame info (read-only) */ + UNW_HPPA_CFA, + + UNW_TDEP_LAST_REG = UNW_HPPA_IP, + + UNW_TDEP_IP = UNW_HPPA_IP, + UNW_TDEP_SP = UNW_HPPA_SP, + UNW_TDEP_EH = UNW_HPPA_EH0 + } +hppa_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On PA-RISC, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32) + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no PA-RISC-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) +extern int unw_tdep_getcontext (unw_tdep_context_t *); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-ia64.h b/sdk/cpprt/linux/libunwind/include/libunwind-ia64.h new file mode 100644 index 0000000000..fb2fbfe520 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-ia64.h @@ -0,0 +1,194 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#include +#include + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#ifdef ia64 + /* This works around a bug in Intel's ECC v7.0 which defines "ia64" + as "1". */ +# undef ia64 +#endif + +#ifdef __hpux + /* On HP-UX, there is no hope of supporting UNW_LOCAL_ONLY, because + it's impossible to obtain the address of the members in the + sigcontext structure. */ +# undef UNW_LOCAL_ONLY +# define UNW_GENERIC_ONLY +#endif + +#define UNW_TARGET ia64 +#define UNW_TARGET_IA64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 511 + +/* If this bit is it indicates that the procedure saved all of ar.bsp, + ar.bspstore, and ar.rnat. If, additionally, ar.bsp != saved ar.bsp, + then this procedure has performed a register-backing-store switch. */ +#define UNW_PI_FLAG_IA64_RBS_SWITCH_BIT (UNW_PI_FLAG_FIRST_TDEP_BIT + 0) + +#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT) + +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; + +/* On IA-64, we want to access the contents of floating-point + registers as a pair of "words", but to ensure 16-byte alignment, we + make it a union that contains a "long double". This will do the + Right Thing on all known IA-64 platforms, including HP-UX. */ +typedef union + { + struct { unw_word_t bits[2]; } raw; + long double dummy; /* dummy to force 16-byte alignment */ + } +unw_tdep_fpreg_t; + +typedef struct + { + /* no ia64-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +typedef enum + { + /* Note: general registers are excepted to start with index 0. + This convention facilitates architecture-independent + implementation of the C++ exception handling ABI. See + _Unwind_SetGR() and _Unwind_GetGR() for details. */ + UNW_IA64_GR = 0, /* general registers (r0..r127) */ + UNW_IA64_GP = UNW_IA64_GR + 1, + UNW_IA64_TP = UNW_IA64_GR + 13, + + UNW_IA64_NAT = UNW_IA64_GR + 128, /* NaT registers (nat0..nat127) */ + + UNW_IA64_FR = UNW_IA64_NAT + 128, /* fp registers (f0..f127) */ + + UNW_IA64_AR = UNW_IA64_FR + 128, /* application registers (ar0..r127) */ + UNW_IA64_AR_RSC = UNW_IA64_AR + 16, + UNW_IA64_AR_BSP = UNW_IA64_AR + 17, + UNW_IA64_AR_BSPSTORE = UNW_IA64_AR + 18, + UNW_IA64_AR_RNAT = UNW_IA64_AR + 19, + UNW_IA64_AR_CSD = UNW_IA64_AR + 25, + UNW_IA64_AR_26 = UNW_IA64_AR + 26, + UNW_IA64_AR_SSD = UNW_IA64_AR_26, + UNW_IA64_AR_CCV = UNW_IA64_AR + 32, + UNW_IA64_AR_UNAT = UNW_IA64_AR + 36, + UNW_IA64_AR_FPSR = UNW_IA64_AR + 40, + UNW_IA64_AR_PFS = UNW_IA64_AR + 64, + UNW_IA64_AR_LC = UNW_IA64_AR + 65, + UNW_IA64_AR_EC = UNW_IA64_AR + 66, + + UNW_IA64_BR = UNW_IA64_AR + 128, /* branch registers (b0..p7) */ + UNW_IA64_RP = UNW_IA64_BR + 0, /* return pointer (rp) */ + UNW_IA64_PR = UNW_IA64_BR + 8, /* predicate registers (p0..p63) */ + UNW_IA64_CFM, + + /* frame info: */ + UNW_IA64_BSP, + UNW_IA64_IP, + UNW_IA64_SP, + + UNW_TDEP_LAST_REG = UNW_IA64_SP, + + UNW_TDEP_IP = UNW_IA64_IP, + UNW_TDEP_SP = UNW_IA64_SP, + UNW_TDEP_EH = UNW_IA64_GR + 15 + } +ia64_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 4 /* r15-r18 are exception args */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. On IA-64, + we use this to provide the bit number in which a NaT bit gets + saved. */ + uint8_t nat_bitnr; + + /* Padding reserved for future use. */ + uint8_t reserved[7]; + } +unw_tdep_save_loc_t; + +/* On IA-64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_IA64_FR) < 128) + +#include "libunwind-dynamic.h" +#include "libunwind-common.h" + +#ifdef __hpux + /* In theory, we could use _Uia64_getcontext() on HP-UX as well, but + the benefit of doing so would be marginal given that it can't + support UNW_LOCAL_ONLY. */ +# define unw_tdep_getcontext getcontext +#else +# define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) + extern int unw_tdep_getcontext (unw_tdep_context_t *); +#endif + +/* This is a helper routine to search an ia64 unwind table. If the + address-space argument AS points to something other than the local + address-space, the memory for the unwind-info will be allocated + with malloc(), and should be free()d during the put_unwind_info() + callback. This routine is signal-safe for the local-address-space + case ONLY. */ +#define unw_search_ia64_unwind_table UNW_OBJ(search_unwind_table) +extern int unw_search_ia64_unwind_table (unw_addr_space_t, unw_word_t, + unw_dyn_info_t *, unw_proc_info_t *, + int, void *); + +/* This is a helper routine which the get_dyn_info_list_addr() + callback can use to locate the special dynamic-info list entry in + an IA-64 unwind table. If the entry exists in the table, the + list-address is returned. In all other cases, 0 is returned. */ +extern unw_word_t _Uia64_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *, + void *); + +/* This is a helper routine to obtain the kernel-unwind info. It is + signal-safe. */ +extern int _Uia64_get_kernel_table (unw_dyn_info_t *); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-mips.h b/sdk/cpprt/linux/libunwind/include/libunwind-mips.h new file mode 100644 index 0000000000..91f70015b1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-mips.h @@ -0,0 +1,155 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#ifdef mips +# undef mips +#endif + +#define UNW_TARGET mips +#define UNW_TARGET_MIPS 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +/* FIXME for MIPS. Too big? What do other things use for similar tasks? */ +#define UNW_TDEP_CURSOR_LEN 4096 + +/* The size of a "word" varies on MIPS. This type is used for memory + addresses and register values. To allow a single library to support + multiple ABIs, and to support N32 at all, we must use a 64-bit type + even when addresses are only 32 bits. */ +typedef uint64_t unw_word_t; +typedef int32_t unw_sword_t; + +/* FIXME: MIPS ABIs. */ +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_MIPS_R0, + UNW_MIPS_R1, + UNW_MIPS_R2, + UNW_MIPS_R3, + UNW_MIPS_R4, + UNW_MIPS_R5, + UNW_MIPS_R6, + UNW_MIPS_R7, + UNW_MIPS_R8, + UNW_MIPS_R9, + UNW_MIPS_R10, + UNW_MIPS_R11, + UNW_MIPS_R12, + UNW_MIPS_R13, + UNW_MIPS_R14, + UNW_MIPS_R15, + UNW_MIPS_R16, + UNW_MIPS_R17, + UNW_MIPS_R18, + UNW_MIPS_R19, + UNW_MIPS_R20, + UNW_MIPS_R21, + UNW_MIPS_R22, + UNW_MIPS_R23, + UNW_MIPS_R24, + UNW_MIPS_R25, + UNW_MIPS_R26, + UNW_MIPS_R27, + UNW_MIPS_R28, + UNW_MIPS_R29, + UNW_MIPS_R30, + UNW_MIPS_R31, + + /* FIXME: Other registers! */ + + /* For MIPS, the CFA is the value of SP (r29) at the call site in the + previous frame. */ + UNW_MIPS_CFA, + + UNW_TDEP_LAST_REG = UNW_MIPS_R31, + + UNW_TDEP_IP = UNW_MIPS_R31, + UNW_TDEP_SP = UNW_MIPS_R29, + UNW_TDEP_EH = UNW_MIPS_R0 /* FIXME. */ + } +mips_regnum_t; + +typedef enum + { + UNW_MIPS_ABI_O32, + UNW_MIPS_ABI_N32, + UNW_MIPS_ABI_N64 + } +mips_abi_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for MIPS. */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On x86, we can directly use ucontext_t as the unwind context. FIXME for + MIPS. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no mips-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +/* There is no getcontext() on MIPS. Use a stub version which only saves GP + registers. FIXME: Not ideal, may not be sufficient for all libunwind + use cases. */ +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +extern int unw_tdep_getcontext (ucontext_t *uc); + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-ppc32.h b/sdk/cpprt/linux/libunwind/include/libunwind-ppc32.h new file mode 100644 index 0000000000..b40a84ef16 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-ppc32.h @@ -0,0 +1,207 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET ppc32 +#define UNW_TARGET_PPC32 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* + * This needs to be big enough to accommodate "struct cursor", while + * leaving some slack for future expansion. Changing this value will + * require recompiling all users of this library. Stack allocation is + * relatively cheap and unwind-state copying is relatively rare, so we want + * to err on making it rather too big than too small. + * + * To simplify this whole process, we are at least initially taking the + * tack that UNW_PPC32_* map straight across to the .eh_frame column register + * numbers. These register numbers come from gcc's source in + * gcc/config/rs6000/rs6000.h + * + * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115 + * elements in the loc array, each sized 2 * unw_word_t, plus the rest of + * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's + * round that up to 280. + */ + +#define UNW_TDEP_CURSOR_LEN 200 + +#if __WORDSIZE==32 +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; +#else +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; +#endif + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_PPC32_R0, + UNW_PPC32_R1, /* called STACK_POINTER in gcc */ + UNW_PPC32_R2, + UNW_PPC32_R3, + UNW_PPC32_R4, + UNW_PPC32_R5, + UNW_PPC32_R6, + UNW_PPC32_R7, + UNW_PPC32_R8, + UNW_PPC32_R9, + UNW_PPC32_R10, + UNW_PPC32_R11, /* called STATIC_CHAIN in gcc */ + UNW_PPC32_R12, + UNW_PPC32_R13, + UNW_PPC32_R14, + UNW_PPC32_R15, + UNW_PPC32_R16, + UNW_PPC32_R17, + UNW_PPC32_R18, + UNW_PPC32_R19, + UNW_PPC32_R20, + UNW_PPC32_R21, + UNW_PPC32_R22, + UNW_PPC32_R23, + UNW_PPC32_R24, + UNW_PPC32_R25, + UNW_PPC32_R26, + UNW_PPC32_R27, + UNW_PPC32_R28, + UNW_PPC32_R29, + UNW_PPC32_R30, + UNW_PPC32_R31, /* called HARD_FRAME_POINTER in gcc */ + + /* Count Register */ + UNW_PPC32_CTR = 32, + /* Fixed-Point Status and Control Register */ + UNW_PPC32_XER = 33, + /* Condition Register */ + UNW_PPC32_CCR = 34, + /* Machine State Register */ + //UNW_PPC32_MSR = 35, + /* MQ or SPR0, not part of generic Power, part of MPC601 */ + //UNW_PPC32_MQ = 36, + /* Link Register */ + UNW_PPC32_LR = 36, + /* Floating Pointer Status and Control Register */ + UNW_PPC32_FPSCR = 37, + + UNW_PPC32_F0 = 48, + UNW_PPC32_F1, + UNW_PPC32_F2, + UNW_PPC32_F3, + UNW_PPC32_F4, + UNW_PPC32_F5, + UNW_PPC32_F6, + UNW_PPC32_F7, + UNW_PPC32_F8, + UNW_PPC32_F9, + UNW_PPC32_F10, + UNW_PPC32_F11, + UNW_PPC32_F12, + UNW_PPC32_F13, + UNW_PPC32_F14, + UNW_PPC32_F15, + UNW_PPC32_F16, + UNW_PPC32_F17, + UNW_PPC32_F18, + UNW_PPC32_F19, + UNW_PPC32_F20, + UNW_PPC32_F21, + UNW_PPC32_F22, + UNW_PPC32_F23, + UNW_PPC32_F24, + UNW_PPC32_F25, + UNW_PPC32_F26, + UNW_PPC32_F27, + UNW_PPC32_F28, + UNW_PPC32_F29, + UNW_PPC32_F30, + UNW_PPC32_F31, + + UNW_TDEP_LAST_REG = UNW_PPC32_F31, + + UNW_TDEP_IP = UNW_PPC32_LR, + UNW_TDEP_SP = UNW_PPC32_R1, + UNW_TDEP_EH = UNW_PPC32_R12 + } +ppc32_regnum_t; + +/* + * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for + * passing parameters to exception handlers. + */ + +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On ppc, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +/* XXX this is not ideal: an application should not be prevented from + using the "getcontext" name just because it's using libunwind. We + can't just use __getcontext() either, because that isn't exported + by glibc... */ +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no ppc32-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-ppc64.h b/sdk/cpprt/linux/libunwind/include/libunwind-ppc64.h new file mode 100644 index 0000000000..66420b33ff --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-ppc64.h @@ -0,0 +1,264 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET ppc64 +#define UNW_TARGET_PPC64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* + * This needs to be big enough to accommodate "struct cursor", while + * leaving some slack for future expansion. Changing this value will + * require recompiling all users of this library. Stack allocation is + * relatively cheap and unwind-state copying is relatively rare, so we want + * to err on making it rather too big than too small. + * + * To simplify this whole process, we are at least initially taking the + * tack that UNW_PPC64_* map straight across to the .eh_frame column register + * numbers. These register numbers come from gcc's source in + * gcc/config/rs6000/rs6000.h + * + * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115 + * elements in the loc array, each sized 2 * unw_word_t, plus the rest of + * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's + * round that up to 280. + */ + +#define UNW_TDEP_CURSOR_LEN 280 + +#if __WORDSIZE==32 +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; +#else +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; +#endif + +typedef long double unw_tdep_fpreg_t; + +/* + * Vector register (in PowerPC64 used for AltiVec registers) + */ +typedef struct { + uint64_t halves[2]; +} unw_tdep_vreg_t; + +typedef enum + { + UNW_PPC64_R0, + UNW_PPC64_R1, /* called STACK_POINTER in gcc */ + UNW_PPC64_R2, + UNW_PPC64_R3, + UNW_PPC64_R4, + UNW_PPC64_R5, + UNW_PPC64_R6, + UNW_PPC64_R7, + UNW_PPC64_R8, + UNW_PPC64_R9, + UNW_PPC64_R10, + UNW_PPC64_R11, /* called STATIC_CHAIN in gcc */ + UNW_PPC64_R12, + UNW_PPC64_R13, + UNW_PPC64_R14, + UNW_PPC64_R15, + UNW_PPC64_R16, + UNW_PPC64_R17, + UNW_PPC64_R18, + UNW_PPC64_R19, + UNW_PPC64_R20, + UNW_PPC64_R21, + UNW_PPC64_R22, + UNW_PPC64_R23, + UNW_PPC64_R24, + UNW_PPC64_R25, + UNW_PPC64_R26, + UNW_PPC64_R27, + UNW_PPC64_R28, + UNW_PPC64_R29, + UNW_PPC64_R30, + UNW_PPC64_R31, /* called HARD_FRAME_POINTER in gcc */ + + UNW_PPC64_F0 = 32, + UNW_PPC64_F1, + UNW_PPC64_F2, + UNW_PPC64_F3, + UNW_PPC64_F4, + UNW_PPC64_F5, + UNW_PPC64_F6, + UNW_PPC64_F7, + UNW_PPC64_F8, + UNW_PPC64_F9, + UNW_PPC64_F10, + UNW_PPC64_F11, + UNW_PPC64_F12, + UNW_PPC64_F13, + UNW_PPC64_F14, + UNW_PPC64_F15, + UNW_PPC64_F16, + UNW_PPC64_F17, + UNW_PPC64_F18, + UNW_PPC64_F19, + UNW_PPC64_F20, + UNW_PPC64_F21, + UNW_PPC64_F22, + UNW_PPC64_F23, + UNW_PPC64_F24, + UNW_PPC64_F25, + UNW_PPC64_F26, + UNW_PPC64_F27, + UNW_PPC64_F28, + UNW_PPC64_F29, + UNW_PPC64_F30, + UNW_PPC64_F31, + /* Note that there doesn't appear to be an .eh_frame register column + for the FPSCR register. I don't know why this is. Since .eh_frame + info is what this implementation uses for unwinding, we have no way + to unwind this register, and so we will not expose an FPSCR register + number in the libunwind API. + */ + + UNW_PPC64_LR = 65, + UNW_PPC64_CTR = 66, + UNW_PPC64_ARG_POINTER = 67, + + UNW_PPC64_CR0 = 68, + UNW_PPC64_CR1, + UNW_PPC64_CR2, + UNW_PPC64_CR3, + UNW_PPC64_CR4, + /* CR5 .. CR7 are currently unused */ + UNW_PPC64_CR5, + UNW_PPC64_CR6, + UNW_PPC64_CR7, + + UNW_PPC64_XER = 76, + + UNW_PPC64_V0 = 77, + UNW_PPC64_V1, + UNW_PPC64_V2, + UNW_PPC64_V3, + UNW_PPC64_V4, + UNW_PPC64_V5, + UNW_PPC64_V6, + UNW_PPC64_V7, + UNW_PPC64_V8, + UNW_PPC64_V9, + UNW_PPC64_V10, + UNW_PPC64_V11, + UNW_PPC64_V12, + UNW_PPC64_V13, + UNW_PPC64_V14, + UNW_PPC64_V15, + UNW_PPC64_V16, + UNW_PPC64_V17, + UNW_PPC64_V18, + UNW_PPC64_V19, + UNW_PPC64_V20, + UNW_PPC64_V21, + UNW_PPC64_V22, + UNW_PPC64_V23, + UNW_PPC64_V24, + UNW_PPC64_V25, + UNW_PPC64_V26, + UNW_PPC64_V27, + UNW_PPC64_V28, + UNW_PPC64_V29, + UNW_PPC64_V30, + UNW_PPC64_V31, + + UNW_PPC64_VRSAVE = 109, + UNW_PPC64_VSCR = 110, + UNW_PPC64_SPE_ACC = 111, + UNW_PPC64_SPEFSCR = 112, + + /* frame info (read-only) */ + UNW_PPC64_FRAME_POINTER, + UNW_PPC64_NIP, + + + UNW_TDEP_LAST_REG = UNW_PPC64_NIP, + + UNW_TDEP_IP = UNW_PPC64_NIP, + UNW_TDEP_SP = UNW_PPC64_R1, + UNW_TDEP_EH = UNW_PPC64_R12 + } +ppc64_regnum_t; + +/* + * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for + * passing parameters to exception handlers. + */ + +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On ppc64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +/* XXX this is not ideal: an application should not be prevented from + using the "getcontext" name just because it's using libunwind. We + can't just use __getcontext() either, because that isn't exported + by glibc... */ +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no ppc64-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-ptrace.h b/sdk/cpprt/linux/libunwind/include/libunwind-ptrace.h new file mode 100644 index 0000000000..7fca205e50 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-ptrace.h @@ -0,0 +1,63 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef libunwind_ptrace_h +#define libunwind_ptrace_h + +#include + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* Helper routines which make it easy to use libunwind via ptrace(). + They're available only if UNW_REMOTE_ONLY is _not_ defined and they + aren't really part of the libunwind API. They are implemented in a + archive library called libunwind-ptrace.a. */ + +extern void *_UPT_create (pid_t); +extern void _UPT_destroy (void *); +extern int _UPT_find_proc_info (unw_addr_space_t, unw_word_t, + unw_proc_info_t *, int, void *); +extern void _UPT_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); +extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, + void *); +extern int _UPT_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, + void *); +extern int _UPT_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int, void *); +extern int _UPT_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int, void *); +extern int _UPT_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, + unw_word_t *, void *); +extern int _UPT_resume (unw_addr_space_t, unw_cursor_t *, void *); +extern unw_accessors_t _UPT_accessors; + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* libunwind_ptrace_h */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-x86.h b/sdk/cpprt/linux/libunwind/include/libunwind-x86.h new file mode 100644 index 0000000000..32533df976 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-x86.h @@ -0,0 +1,187 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET x86 +#define UNW_TARGET_X86 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 127 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef union { + struct { uint8_t b[4]; } val32; + struct { uint8_t b[10]; } val80; + struct { uint8_t b[16]; } val128; +} unw_tdep_fpreg_t; + +typedef enum + { + /* Note: general registers are expected to start with index 0. + This convention facilitates architecture-independent + implementation of the C++ exception handling ABI. See + _Unwind_SetGR() and _Unwind_GetGR() for details. + + The described register usage convention is based on "System V + Application Binary Interface, Intel386 Architecture Processor + Supplement, Fourth Edition" at + + http://www.linuxbase.org/spec/refspecs/elf/abi386-4.pdf + + It would have been nice to use the same register numbering as + DWARF, but that doesn't work because the libunwind requires + that the exception argument registers be consecutive, which the + wouldn't be with the DWARF numbering. */ + UNW_X86_EAX, /* scratch (exception argument 1) */ + UNW_X86_EDX, /* scratch (exception argument 2) */ + UNW_X86_ECX, /* scratch */ + UNW_X86_EBX, /* preserved */ + UNW_X86_ESI, /* preserved */ + UNW_X86_EDI, /* preserved */ + UNW_X86_EBP, /* (optional) frame-register */ + UNW_X86_ESP, /* (optional) frame-register */ + UNW_X86_EIP, /* frame-register */ + UNW_X86_EFLAGS, /* scratch (except for "direction", which is fixed */ + UNW_X86_TRAPNO, /* scratch */ + + /* MMX/stacked-fp registers */ + UNW_X86_ST0, /* fp return value */ + UNW_X86_ST1, /* scratch */ + UNW_X86_ST2, /* scratch */ + UNW_X86_ST3, /* scratch */ + UNW_X86_ST4, /* scratch */ + UNW_X86_ST5, /* scratch */ + UNW_X86_ST6, /* scratch */ + UNW_X86_ST7, /* scratch */ + + UNW_X86_FCW, /* scratch */ + UNW_X86_FSW, /* scratch */ + UNW_X86_FTW, /* scratch */ + UNW_X86_FOP, /* scratch */ + UNW_X86_FCS, /* scratch */ + UNW_X86_FIP, /* scratch */ + UNW_X86_FEA, /* scratch */ + UNW_X86_FDS, /* scratch */ + + /* SSE registers */ + UNW_X86_XMM0_lo, /* scratch */ + UNW_X86_XMM0_hi, /* scratch */ + UNW_X86_XMM1_lo, /* scratch */ + UNW_X86_XMM1_hi, /* scratch */ + UNW_X86_XMM2_lo, /* scratch */ + UNW_X86_XMM2_hi, /* scratch */ + UNW_X86_XMM3_lo, /* scratch */ + UNW_X86_XMM3_hi, /* scratch */ + UNW_X86_XMM4_lo, /* scratch */ + UNW_X86_XMM4_hi, /* scratch */ + UNW_X86_XMM5_lo, /* scratch */ + UNW_X86_XMM5_hi, /* scratch */ + UNW_X86_XMM6_lo, /* scratch */ + UNW_X86_XMM6_hi, /* scratch */ + UNW_X86_XMM7_lo, /* scratch */ + UNW_X86_XMM7_hi, /* scratch */ + + UNW_X86_MXCSR, /* scratch */ + + /* segment registers */ + UNW_X86_GS, /* special */ + UNW_X86_FS, /* special */ + UNW_X86_ES, /* special */ + UNW_X86_DS, /* special */ + UNW_X86_SS, /* special */ + UNW_X86_CS, /* special */ + UNW_X86_TSS, /* special */ + UNW_X86_LDT, /* special */ + + /* frame info (read-only) */ + UNW_X86_CFA, + + UNW_X86_XMM0, /* scratch */ + UNW_X86_XMM1, /* scratch */ + UNW_X86_XMM2, /* scratch */ + UNW_X86_XMM3, /* scratch */ + UNW_X86_XMM4, /* scratch */ + UNW_X86_XMM5, /* scratch */ + UNW_X86_XMM6, /* scratch */ + UNW_X86_XMM7, /* scratch */ + + UNW_TDEP_LAST_REG = UNW_X86_XMM7, + + UNW_TDEP_IP = UNW_X86_EIP, + UNW_TDEP_SP = UNW_X86_ESP, + UNW_TDEP_EH = UNW_X86_EAX + } +x86_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* eax and edx are exception args */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On x86, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no x86-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +extern int unw_tdep_getcontext (unw_tdep_context_t *); + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind-x86_64.h b/sdk/cpprt/linux/libunwind/include/libunwind-x86_64.h new file mode 100644 index 0000000000..526b1ea327 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind-x86_64.h @@ -0,0 +1,139 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET x86_64 +#define UNW_TARGET_X86_64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 127 + +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_X86_64_RAX, + UNW_X86_64_RDX, + UNW_X86_64_RCX, + UNW_X86_64_RBX, + UNW_X86_64_RSI, + UNW_X86_64_RDI, + UNW_X86_64_RBP, + UNW_X86_64_RSP, + UNW_X86_64_R8, + UNW_X86_64_R9, + UNW_X86_64_R10, + UNW_X86_64_R11, + UNW_X86_64_R12, + UNW_X86_64_R13, + UNW_X86_64_R14, + UNW_X86_64_R15, + UNW_X86_64_RIP, +#ifdef CONFIG_MSABI_SUPPORT + UNW_X86_64_XMM0, + UNW_X86_64_XMM1, + UNW_X86_64_XMM2, + UNW_X86_64_XMM3, + UNW_X86_64_XMM4, + UNW_X86_64_XMM5, + UNW_X86_64_XMM6, + UNW_X86_64_XMM7, + UNW_X86_64_XMM8, + UNW_X86_64_XMM9, + UNW_X86_64_XMM10, + UNW_X86_64_XMM11, + UNW_X86_64_XMM12, + UNW_X86_64_XMM13, + UNW_X86_64_XMM14, + UNW_X86_64_XMM15, + UNW_TDEP_LAST_REG = UNW_X86_64_XMM15, +#else + UNW_TDEP_LAST_REG = UNW_X86_64_RIP, +#endif + + /* XXX Add other regs here */ + + /* frame info (read-only) */ + UNW_X86_64_CFA, + + UNW_TDEP_IP = UNW_X86_64_RIP, + UNW_TDEP_SP = UNW_X86_64_RSP, + UNW_TDEP_BP = UNW_X86_64_RBP, + UNW_TDEP_EH = UNW_X86_64_RAX + } +x86_64_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On x86_64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +typedef struct + { + /* no x86-64-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-dynamic.h" +#include "libunwind-common.h" + +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) + +extern int unw_tdep_getcontext (unw_tdep_context_t *); +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind.h.in b/sdk/cpprt/linux/libunwind/include/libunwind.h.in new file mode 100644 index 0000000000..6ed4725293 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind.h.in @@ -0,0 +1,30 @@ +/* Provide a real file - not a symlink - as it would cause multiarch conflicts + when multiple different arch releases are installed simultaneously. */ + +#ifndef UNW_REMOTE_ONLY + +#if defined __arm__ +# include "libunwind-arm.h" +#elif defined __hppa__ +# include "libunwind-hppa.h" +#elif defined __ia64__ +# include "libunwind-ia64.h" +#elif defined __mips__ +# include "libunwind-mips.h" +#elif defined __powerpc__ && !defined __powerpc64__ +# include "libunwind-ppc32.h" +#elif defined __powerpc64__ +# include "libunwind-ppc64.h" +#elif defined __i386__ +# include "libunwind-x86.h" +#elif defined __x86_64__ +# include "libunwind-x86_64.h" +#else +# error "Unsupported arch" +#endif + +#else /* UNW_REMOTE_ONLY */ + +# include "libunwind-@arch@.h" + +#endif /* UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/include/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/libunwind_i.h new file mode 100644 index 0000000000..079e805bb5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/libunwind_i.h @@ -0,0 +1,377 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* This files contains libunwind-internal definitions which are + subject to frequent change and are not to be exposed to + libunwind-users. */ + +#ifndef libunwind_i_h +#define libunwind_i_h + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE___THREAD + /* For now, turn off per-thread caching. It uses up too much TLS + memory per thread even when the thread never uses libunwind at + all. */ +# undef HAVE___THREAD +#endif + +/* Platform-independent libunwind-internal declarations. */ + +#include /* HP-UX needs this before include of pthread.h */ + +#include +#include + +#if HAVE_SGX +#include "pthread_compat.h" +#else +#include +#include +#endif + +#include +#include +#include +#include +#include + +#if defined(HAVE_ENDIAN_H) +# include +#elif defined(HAVE_SYS_ENDIAN_H) +# include +#else +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# if defined(__hpux) +# define __BYTE_ORDER __BIG_ENDIAN +# else +# error Host has unknown byte-order. +# endif +#endif + +#ifdef __GNUC__ +# define UNUSED __attribute__((unused)) +# define NORETURN __attribute__((noreturn)) +# define ALIAS(name) __attribute__((alias (#name))) +# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) +# define ALWAYS_INLINE inline __attribute__((always_inline)) +# define HIDDEN __attribute__((visibility ("hidden"))) +# define PROTECTED __attribute__((visibility ("protected"))) +# else +# define ALWAYS_INLINE +# define HIDDEN +# define PROTECTED +# endif +# if (__GNUC__ >= 3) +# define likely(x) __builtin_expect ((x), 1) +# define unlikely(x) __builtin_expect ((x), 0) +# else +# define likely(x) (x) +# define unlikely(x) (x) +# endif +#else +# define ALWAYS_INLINE +# define UNUSED +# define NORETURN +# define ALIAS(name) +# define HIDDEN +# define PROTECTED +# define likely(x) (x) +# define unlikely(x) (x) +#endif + +#ifdef DEBUG +# define UNW_DEBUG 1 +#else +# define UNW_DEBUG 0 +#endif + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +/* Make it easy to write thread-safe code which may or may not be + linked against libpthread. The macros below can be used + unconditionally and if -lpthread is around, they'll call the + corresponding routines otherwise, they do nothing. */ + +#if HAVE_SGX +#define mutex_init(l) do { *l = PTHREAD_MUTEX_INITIALIZER; } while(0) +#define mutex_lock(l) do { if (pthread_mutex_lock ((l)) != 0) abort(); } while(0) +#define mutex_unlock(l) do { if (pthread_mutex_unlock ((l)) != 0) abort(); } while(0) +#else +#pragma weak pthread_mutex_init +#pragma weak pthread_mutex_lock +#pragma weak pthread_mutex_unlock + +#define mutex_init(l) \ + (pthread_mutex_init != 0 ? pthread_mutex_init ((l), 0) : 0) +#define mutex_lock(l) \ + (pthread_mutex_lock != 0 ? pthread_mutex_lock (l) : 0) +#define mutex_unlock(l) \ + (pthread_mutex_unlock != 0 ? pthread_mutex_unlock (l) : 0) +#endif + +#ifdef HAVE_ATOMIC_OPS_H +# include +static inline int +cmpxchg_ptr (void *addr, void *old, void *new) +{ + union + { + void *vp; + AO_t *aop; + } + u; + + u.vp = addr; + return AO_compare_and_swap(u.aop, (AO_t) old, (AO_t) new); +} +# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr) + /* GCC 3.2.0 on HP-UX crashes on cmpxchg_ptr() */ +# if !(defined(__hpux) && __GNUC__ == 3 && __GNUC_MINOR__ == 2) +# define HAVE_CMPXCHG +# endif +# define HAVE_FETCH_AND_ADD1 +#else +# ifdef HAVE_IA64INTRIN_H +# include +static inline int +cmpxchg_ptr (void *addr, void *old, void *new) +{ + union + { + void *vp; + long *vlp; + } + u; + + u.vp = addr; + return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new); +} +# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1) +# define HAVE_CMPXCHG +# define HAVE_FETCH_AND_ADD1 +# endif +#endif +#define atomic_read(ptr) (*(ptr)) + +#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn)) +#define UNWI_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_UI,UNW_TARGET),_), fn) + +#define unwi_full_mask UNWI_ARCH_OBJ(full_mask) + +/* Type of a mask that can be used to inhibit preemption. At the + userlevel, preemption is caused by signals and hence sigset_t is + appropriate. In constrast, the Linux kernel uses "unsigned long" + to hold the processor "flags" instead. */ +typedef sigset_t intrmask_t; + +extern intrmask_t unwi_full_mask; + +/* Silence compiler warnings about variables which are used only if libunwind + is configured in a certain way */ +static inline void mark_as_used(void *v) { +} + +#if defined(CONFIG_BLOCK_SIGNALS) +# define SIGPROCMASK(how, new_mask, old_mask) \ + sigprocmask((how), (new_mask), (old_mask)) +#else +# define SIGPROCMASK(how, new_mask, old_mask) mark_as_used(old_mask) +#endif + +#define define_lock(name) \ + pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +#define lock_init(l) mutex_init (l) +#define lock_acquire(l,m) \ +do { \ + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &(m)); \ + mutex_lock (l); \ +} while (0) +#define lock_release(l,m) \ +do { \ + mutex_unlock (l); \ + SIGPROCMASK (SIG_SETMASK, &(m), NULL); \ +} while (0) + +#define SOS_MEMORY_SIZE 16384 /* see src/mi/mempool.c */ + +#if HAVE_SGX /* Running inside Enclave */ +#define GET_MEMORY(mem, size) do { mem = malloc(size); } while (0) +#else /* Normal application */ +#ifndef MAP_ANONYMOUS +# define MAP_ANONYMOUS MAP_ANON +#endif +#define GET_MEMORY(mem, size) \ +do { \ + /* Hopefully, mmap() goes straight through to a system call stub... */ \ + mem = mmap (0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, \ + -1, 0); \ + if (mem == MAP_FAILED) \ + mem = NULL; \ +} while (0) +#endif + +#define unwi_find_dynamic_proc_info UNWI_OBJ(find_dynamic_proc_info) +#define unwi_extract_dynamic_proc_info UNWI_OBJ(extract_dynamic_proc_info) +#define unwi_put_dynamic_unwind_info UNWI_OBJ(put_dynamic_unwind_info) +#define unwi_dyn_remote_find_proc_info UNWI_OBJ(dyn_remote_find_proc_info) +#define unwi_dyn_remote_put_unwind_info UNWI_OBJ(dyn_remote_put_unwind_info) +#define unwi_dyn_validate_cache UNWI_OBJ(dyn_validate_cache) + +extern int unwi_find_dynamic_proc_info (unw_addr_space_t as, + unw_word_t ip, + unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern int unwi_extract_dynamic_proc_info (unw_addr_space_t as, + unw_word_t ip, + unw_proc_info_t *pi, + unw_dyn_info_t *di, + int need_unwind_info, + void *arg); +extern void unwi_put_dynamic_unwind_info (unw_addr_space_t as, + unw_proc_info_t *pi, void *arg); + +/* These handle the remote (cross-address-space) case of accessing + dynamic unwind info. */ + +extern int unwi_dyn_remote_find_proc_info (unw_addr_space_t as, + unw_word_t ip, + unw_proc_info_t *pi, + int need_unwind_info, + void *arg); +extern void unwi_dyn_remote_put_unwind_info (unw_addr_space_t as, + unw_proc_info_t *pi, + void *arg); +extern int unwi_dyn_validate_cache (unw_addr_space_t as, void *arg); + +extern unw_dyn_info_list_t _U_dyn_info_list; +extern pthread_mutex_t _U_dyn_info_list_lock; + +#if UNW_DEBUG && !HAVE_SGX +#define unwi_debug_level UNWI_ARCH_OBJ(debug_level) +extern long unwi_debug_level; + +# include +# define Debug(level,format...) \ +do { \ + if (unwi_debug_level >= level) \ + { \ + int _n = level; \ + if (_n > 16) \ + _n = 16; \ + fprintf (stderr, "%*c>%s: ", _n, ' ', __FUNCTION__); \ + fprintf (stderr, format); \ + } \ +} while (0) +# define Dprintf(format...) fprintf (stderr, format) +# ifdef __GNUC__ +# undef inline +# define inline UNUSED +# endif +#else +# define Debug(level,format...) +# define Dprintf(format...) +#endif + +static ALWAYS_INLINE void +print_error (const char *string) +{ +#if !HAVE_SGX + write (2, string, strlen (string)); +#endif +} + +#define mi_init UNWI_ARCH_OBJ(mi_init) + +extern void mi_init (void); /* machine-independent initializations */ +extern unw_word_t _U_dyn_info_list_addr (void); + +/* This is needed/used by ELF targets only. */ + +struct elf_image + { + void *image; /* pointer to mmap'd image */ + size_t size; /* (file-) size of the image */ + }; + +struct elf_dyn_info + { + struct elf_image ei; + unw_dyn_info_t di_cache; + unw_dyn_info_t di_debug; /* additional table info for .debug_frame */ +#if UNW_TARGET_IA64 + unw_dyn_info_t ktab; +#endif +#if UNW_TARGET_ARM + unw_dyn_info_t di_arm; /* additional table info for .ARM.exidx */ +#endif + }; + +static void inline invalidate_edi (struct elf_dyn_info *edi) +{ + if (edi->ei.image) +#if !HAVE_SGX + munmap (edi->ei.image, edi->ei.size); +#else /* to align with GET_MEMORY() */ + free(edi->ei.image); +#endif + memset (edi, 0, sizeof (*edi)); + edi->di_cache.format = -1; + edi->di_debug.format = -1; +#if UNW_TARGET_ARM + edi->di_arm.format = -1; +#endif +} + + +/* Provide a place holder for architecture to override for fast access + to memory when known not to need to validate and know the access + will be local to the process. A suitable override will improve + unw_tdep_trace() performance in particular. */ +#define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \ + do { (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); } \ + while (0) + +/* Define GNU and processor specific values for the Phdr p_type field in case + they aren't defined by . */ +#ifndef PT_GNU_EH_FRAME +# define PT_GNU_EH_FRAME 0x6474e550 +#endif /* !PT_GNU_EH_FRAME */ +#ifndef PT_ARM_EXIDX +# define PT_ARM_EXIDX 0x70000001 /* ARM unwind segment */ +#endif /* !PT_ARM_EXIDX */ + +#include "tdep/libunwind_i.h" + +#ifndef tdep_get_func_addr +# define tdep_get_func_addr(as,addr,v) (*(v) = addr, 0) +#endif + +#endif /* libunwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/include/mempool.h b/sdk/cpprt/linux/libunwind/include/mempool.h new file mode 100644 index 0000000000..4b55974ffd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/mempool.h @@ -0,0 +1,89 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef mempool_h +#define mempool_h + +/* Memory pools provide simple memory management of fixed-size + objects. Memory pools are used for two purposes: + + o To ensure a stack can be unwound even when a process + is out of memory. + + o To ensure a stack can be unwound at any time in a + multi-threaded process (e.g., even at a time when the normal + malloc-lock is taken, possibly by the very thread that is + being unwind). + + + To achieve the second objective, memory pools allocate memory + directly via mmap() system call (or an equivalent facility). + + The first objective is accomplished by reserving memory ahead of + time. Since the memory requirements of stack unwinding generally + depends on the complexity of the procedures being unwind, there is + no absolute guarantee that unwinding will always work, but in + practice, this should not be a serious problem. */ + +#include + +#include "libunwind_i.h" + +#define sos_alloc(s) UNWI_ARCH_OBJ(_sos_alloc)(s) +#define mempool_init(p,s,r) UNWI_ARCH_OBJ(_mempool_init)(p,s,r) +#define mempool_alloc(p) UNWI_ARCH_OBJ(_mempool_alloc)(p) +#define mempool_free(p,o) UNWI_ARCH_OBJ(_mempool_free)(p,o) + +/* The mempool structure should be treated as an opaque object. It's + declared here only to enable static allocation of mempools. */ +struct mempool + { + pthread_mutex_t lock; + size_t obj_size; /* object size (rounded up for alignment) */ + size_t chunk_size; /* allocation granularity */ + unsigned int reserve; /* minimum (desired) size of the free-list */ + unsigned int num_free; /* number of objects on the free-list */ + struct object + { + struct object *next; + } + *free_list; + }; + +/* Emergency allocation for one-time stuff that doesn't fit the memory + pool model. A limited amount of memory is available in this + fashion and once allocated, there is no way to free it. */ +extern void *sos_alloc (size_t size); + +/* Initialize POOL for an object size of OBJECT_SIZE bytes. RESERVE + is the number of objects that should be reserved for use under + tight memory situations. If it is zero, mempool attempts to pick a + reasonable default value. */ +extern void mempool_init (struct mempool *pool, + size_t obj_size, size_t reserve); +extern void *mempool_alloc (struct mempool *pool); +extern void mempool_free (struct mempool *pool, void *object); + +#endif /* mempool_h */ diff --git a/sdk/cpprt/linux/libunwind/include/remote.h b/sdk/cpprt/linux/libunwind/include/remote.h new file mode 100644 index 0000000000..9fb90c3dc6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/remote.h @@ -0,0 +1,127 @@ +#ifndef REMOTE_H +#define REMOTE_H + +/* Helper functions for accessing (remote) memory. These functions + assume that all addresses are naturally aligned (e.g., 32-bit + quantity is stored at a 32-bit-aligned address. */ + +#ifdef UNW_LOCAL_ONLY + +static inline int +fetch8 (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int8_t *valp, void *arg) +{ + *valp = *(int8_t *) (uintptr_t) *addr; + *addr += 1; + return 0; +} + +static inline int +fetch16 (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int16_t *valp, void *arg) +{ + *valp = *(int16_t *) (uintptr_t) *addr; + *addr += 2; + return 0; +} + +static inline int +fetch32 (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int32_t *valp, void *arg) +{ + *valp = *(int32_t *) (uintptr_t) *addr; + *addr += 4; + return 0; +} + +static inline int +fetchw (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unw_word_t *valp, void *arg) +{ + *valp = *(unw_word_t *) (uintptr_t) *addr; + *addr += sizeof (unw_word_t); + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ + +#define WSIZE (sizeof (unw_word_t)) + +static inline int +fetch8 (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int8_t *valp, void *arg) +{ + unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr; + int ret; + + *addr += 1; + + ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg); + +#if __BYTE_ORDER == __LITTLE_ENDIAN + val >>= 8*off; +#else + val >>= 8*(WSIZE - 1 - off); +#endif + *valp = val & 0xff; + return ret; +} + +static inline int +fetch16 (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int16_t *valp, void *arg) +{ + unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr; + int ret; + + assert ((off & 0x1) == 0); + + *addr += 2; + + ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg); + +#if __BYTE_ORDER == __LITTLE_ENDIAN + val >>= 8*off; +#else + val >>= 8*(WSIZE - 2 - off); +#endif + *valp = val & 0xffff; + return ret; +} + +static inline int +fetch32 (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int32_t *valp, void *arg) +{ + unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr; + int ret; + + assert ((off & 0x3) == 0); + + *addr += 4; + + ret = (*a->access_mem) (as, aligned_addr, &val, 0, arg); + +#if __BYTE_ORDER == __LITTLE_ENDIAN + val >>= 8*off; +#else + val >>= 8*(WSIZE - 4 - off); +#endif + *valp = val & 0xffffffff; + return ret; +} + +static inline int +fetchw (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unw_word_t *valp, void *arg) +{ + int ret; + + ret = (*a->access_mem) (as, *addr, valp, 0, arg); + *addr += WSIZE; + return ret; +} + +#endif /* !UNW_LOCAL_ONLY */ + +#endif /* REMOTE_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-arm/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-arm/dwarf-config.h new file mode 100644 index 0000000000..455d15f436 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-arm/dwarf-config.h @@ -0,0 +1,51 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not + explicitly defined. */ +#define DWARF_NUM_PRESERVED_REGS 128 + +/* FIXME: Probably unnecessary on ARM. See arm/Gglobal.c. */ +#define DWARF_REGNUM_MAP_LENGTH 16 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 0 + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-arm/ex_tables.h b/sdk/cpprt/linux/libunwind/include/tdep-arm/ex_tables.h new file mode 100644 index 0000000000..8906f13a22 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-arm/ex_tables.h @@ -0,0 +1,55 @@ +/* libunwind - a platform-independent unwind library + Copyright 2011 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef ARM_EX_TABLES_H +#define ARM_EX_TABLES_H + +typedef enum arm_exbuf_cmd { + ARM_EXIDX_CMD_FINISH, + ARM_EXIDX_CMD_DATA_PUSH, + ARM_EXIDX_CMD_DATA_POP, + ARM_EXIDX_CMD_REG_POP, + ARM_EXIDX_CMD_REG_TO_SP, + ARM_EXIDX_CMD_VFP_POP, + ARM_EXIDX_CMD_WREG_POP, + ARM_EXIDX_CMD_WCGR_POP, + ARM_EXIDX_CMD_RESERVED, + ARM_EXIDX_CMD_REFUSED, +} arm_exbuf_cmd_t; + +struct arm_exbuf_data +{ + arm_exbuf_cmd_t cmd; + uint32_t data; +}; + +#define arm_exidx_extract UNW_OBJ(arm_exidx_extract) +#define arm_exidx_decode UNW_OBJ(arm_exidx_decode) +#define arm_exidx_apply_cmd UNW_OBJ(arm_exidx_apply_cmd) + +int arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf); +int arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c); +int arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c); + +#endif // ARM_EX_TABLES_H diff --git a/sdk/cpprt/linux/libunwind/include/tdep-arm/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-arm/jmpbuf.h new file mode 100644 index 0000000000..499e7deb79 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-arm/jmpbuf.h @@ -0,0 +1,32 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +/* FIXME for ARM! */ + +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff --git a/sdk/cpprt/linux/libunwind/include/tdep-arm/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-arm/libunwind_i.h new file mode 100644 index 0000000000..af92f413f8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-arm/libunwind_i.h @@ -0,0 +1,298 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef ARM_LIBUNWIND_I_H +#define ARM_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf32.h" +#include "mempool.h" +#include "dwarf.h" +#include "ex_tables.h" + +typedef struct + { + /* no arm-specific fast trace */ + } +unw_tdep_frame_t; + +struct unw_addr_space + { + struct unw_accessors acc; + int big_endian; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; + }; + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + enum + { + ARM_SCF_NONE, /* no signal frame */ + ARM_SCF_LINUX_SIGFRAME, /* non-RT signal frame, kernel >=2.6.18 */ + ARM_SCF_LINUX_RT_SIGFRAME, /* RT signal frame, kernel >=2.6.18 */ + ARM_SCF_LINUX_OLD_SIGFRAME, /* non-RT signal frame, kernel < 2.6.18 */ + ARM_SCF_LINUX_OLD_RT_SIGFRAME /* RT signal frame, kernel < 2.6.18 */ + } + sigcontext_format; + unw_word_t sigcontext_addr; + unw_word_t sigcontext_sp; + unw_word_t sigcontext_pc; + }; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_word_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_word_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, + c->as_arg); +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, + 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init UNW_OBJ(init) +#define arm_find_proc_info UNW_OBJ(find_proc_info) +#define arm_put_unwind_info UNW_OBJ(put_unwind_info) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table UNW_OBJ(search_unwind_table) +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + arm_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + arm_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) ((as)->big_endian) + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, + void *arg); +extern void arm_put_unwind_info (unw_addr_space_t as, + unw_proc_info_t *pi, void *arg); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +/* unwinding method selection support */ +#define UNW_ARM_METHOD_ALL 0xFF +#define UNW_ARM_METHOD_DWARF 0x01 +#define UNW_ARM_METHOD_FRAME 0x02 +#define UNW_ARM_METHOD_EXIDX 0x04 + +#define unwi_unwind_method UNW_OBJ(unwind_method) +extern int unwi_unwind_method; + +#define UNW_TRY_METHOD(x) (unwi_unwind_method & x) + +#endif /* ARM_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-hppa/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-hppa/dwarf-config.h new file mode 100644 index 0000000000..29f9eee4b5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-hppa/dwarf-config.h @@ -0,0 +1,54 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* See DWARF_FRAME_REGNUM() macro in gcc/config/pa/pa32-regs.h: */ +#define dwarf_to_unw_regnum(reg) \ + (((reg) < DWARF_NUM_PRESERVED_REGS) ? (reg) : 0) + +/* This matches the value used by GCC (see + gcc/config/pa/pa32-regs.h:FIRST_PSEUDO_REGISTER), which leaves + plenty of room for expansion. */ +#define DWARF_NUM_PRESERVED_REGS 89 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 1 + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-hppa/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-hppa/jmpbuf.h new file mode 100644 index 0000000000..6735b21aff --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-hppa/jmpbuf.h @@ -0,0 +1,33 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +#ifndef JB_SP +# define JB_SP 19 +#endif +#define JB_RP 20 +#define JB_MASK_SAVED 21 +#define JB_MASK 22 diff --git a/sdk/cpprt/linux/libunwind/include/tdep-hppa/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-hppa/libunwind_i.h new file mode 100644 index 0000000000..f2168499af --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-hppa/libunwind_i.h @@ -0,0 +1,275 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef HPPA_LIBUNWIND_I_H +#define HPPA_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf32.h" +#include "dwarf.h" + +typedef struct + { + /* no hppa-specific fast trace */ + } +unw_tdep_frame_t; + +struct unw_addr_space + { + struct unw_accessors acc; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct unw_debug_frame_list *debug_frames; + }; + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + + /* Format of sigcontext structure and address at which it is + stored: */ + enum + { + HPPA_SCF_NONE, /* no signal frame encountered */ + HPPA_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ + } + sigcontext_format; + unw_word_t sigcontext_addr; + }; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_word_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_word_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, + c->as_arg); +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, + 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(c,pi) \ + dwarf_put_unwind_info((c)->as, (pi), (c)->as_arg) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(c,pi) \ + (*(c)->as->acc.put_unwind_info)((c)->as, (pi), (c)->as_arg) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 1 + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (ucontext_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +#endif /* HPPA_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ia64/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-ia64/jmpbuf.h new file mode 100644 index 0000000000..faa1f34407 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ia64/jmpbuf.h @@ -0,0 +1,32 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP and BSP: */ + +#define JB_SP 0 +#define JB_RP 8 +#define JB_BSP 17 +#define JB_MASK_SAVED 70 +#define JB_MASK 71 diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ia64/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-ia64/libunwind_i.h new file mode 100644 index 0000000000..71e4310ba6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ia64/libunwind_i.h @@ -0,0 +1,275 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef IA64_LIBUNWIND_I_H +#define IA64_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include "elf64.h" +#include "mempool.h" + +typedef struct + { + /* no ia64-specific fast trace */ + } +unw_tdep_frame_t; + +enum ia64_pregnum + { + /* primary unat: */ + IA64_REG_PRI_UNAT_GR, + IA64_REG_PRI_UNAT_MEM, + + /* memory stack (order matters: see build_script() */ + IA64_REG_PSP, /* previous memory stack pointer */ + /* register stack */ + IA64_REG_BSP, /* register stack pointer */ + IA64_REG_BSPSTORE, + IA64_REG_PFS, /* previous function state */ + IA64_REG_RNAT, + /* instruction pointer: */ + IA64_REG_IP, + + /* preserved registers: */ + IA64_REG_R4, IA64_REG_R5, IA64_REG_R6, IA64_REG_R7, + IA64_REG_NAT4, IA64_REG_NAT5, IA64_REG_NAT6, IA64_REG_NAT7, + IA64_REG_UNAT, IA64_REG_PR, IA64_REG_LC, IA64_REG_FPSR, + IA64_REG_B1, IA64_REG_B2, IA64_REG_B3, IA64_REG_B4, IA64_REG_B5, + IA64_REG_F2, IA64_REG_F3, IA64_REG_F4, IA64_REG_F5, + IA64_REG_F16, IA64_REG_F17, IA64_REG_F18, IA64_REG_F19, + IA64_REG_F20, IA64_REG_F21, IA64_REG_F22, IA64_REG_F23, + IA64_REG_F24, IA64_REG_F25, IA64_REG_F26, IA64_REG_F27, + IA64_REG_F28, IA64_REG_F29, IA64_REG_F30, IA64_REG_F31, + IA64_NUM_PREGS + }; + +#ifdef UNW_LOCAL_ONLY + +typedef unw_word_t ia64_loc_t; + +#else /* !UNW_LOCAL_ONLY */ + +typedef struct ia64_loc + { + unw_word_t w0, w1; + } +ia64_loc_t; + +#endif /* !UNW_LOCAL_ONLY */ + +#include "script.h" + +#define ABI_UNKNOWN 0 +#define ABI_LINUX 1 +#define ABI_HPUX 2 +#define ABI_FREEBSD 3 +#define ABI_OPENVMS 4 +#define ABI_NSK 5 /* Tandem/HP Non-Stop Kernel */ +#define ABI_WINDOWS 6 + +struct unw_addr_space + { + struct unw_accessors acc; + int big_endian; + int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */ + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ +#ifndef UNW_REMOTE_ONLY + unsigned long long shared_object_removals; +#endif + + struct ia64_script_cache global_cache; + }; + +/* Note: The ABI numbers in the ABI-markers (.unwabi directive) are + not the same as the above ABI numbers. */ +#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's') +#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i') +#define ABI_MARKER_HP_UX_SIGTRAMP ((1 << 8) | 1) +#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's') +#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i') + +struct cursor + { + void *as_arg; /* argument to address-space callbacks */ + unw_addr_space_t as; /* reference to per-address-space info */ + + /* IP, CFM, and predicate cache (these are always equal to the + values stored in ip_loc, cfm_loc, and pr_loc, + respectively). */ + unw_word_t ip; /* instruction pointer value */ + unw_word_t cfm; /* current frame mask */ + unw_word_t pr; /* current predicate values */ + + /* current frame info: */ + unw_word_t bsp; /* backing store pointer value */ + unw_word_t sp; /* stack pointer value */ + unw_word_t psp; /* previous sp value */ + ia64_loc_t cfm_loc; /* cfm save location (or NULL) */ + ia64_loc_t ec_loc; /* ar.ec save location (usually cfm_loc) */ + ia64_loc_t loc[IA64_NUM_PREGS]; + + unw_word_t eh_args[4]; /* exception handler arguments */ + unw_word_t sigcontext_addr; /* address of sigcontext or 0 */ + unw_word_t sigcontext_off; /* sigcontext-offset relative to signal sp */ + + short hint; + short prev_script; + + uint8_t nat_bitnr[4]; /* NaT bit numbers for r4-r7 */ + uint16_t abi_marker; /* abi_marker for current frame (if any) */ + uint16_t last_abi_marker; /* last abi_marker encountered so far */ + uint8_t eh_valid_mask; + + unsigned int pi_valid :1; /* is proc_info valid? */ + unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */ + unw_proc_info_t pi; /* info about current procedure */ + + /* In case of stack-discontiguities, such as those introduced by + signal-delivery on an alternate signal-stack (see + sigaltstack(2)), we use the following data-structure to keep + track of the register-backing-store areas across on which the + current frame may be backed up. Since there are at most 96 + stacked registers and since we only have to track the current + frame and only areas that are not empty, this puts an upper + limit on the # of backing-store areas we have to track. + + Note that the rbs-area indexed by rbs_curr identifies the + rbs-area that was in effect at the time AR.BSP had the value + c->bsp. However, this rbs area may not actually contain the + value in the register that c->bsp corresponds to because that + register may not have gotten spilled until much later, when a + possibly different rbs-area might have been in effect + already. */ + uint8_t rbs_curr; /* index of curr. rbs-area (contains c->bsp) */ + uint8_t rbs_left_edge; /* index of inner-most valid rbs-area */ + struct rbs_area + { + unw_word_t end; + unw_word_t size; + ia64_loc_t rnat_loc; + } + rbs_area[96 + 2]; /* 96 stacked regs + 1 extra stack on each side... */ +}; + +struct ia64_global_unwind_state + { + pthread_mutex_t lock; /* global data lock */ + + volatile char needs_initialization; + + /* Table of registers that prologues can save (and order in which + they're saved). */ + const unsigned char save_order[8]; + + /* + * uc_addr() may return pointers to these variables. We need to + * make sure they don't get written via ia64_put() or + * ia64_putfp(). To make it possible to test for these variables + * quickly, we collect them in a single sub-structure. + */ + struct + { + unw_word_t r0; /* r0 is byte-order neutral */ + unw_fpreg_t f0; /* f0 is byte-order neutral */ + unw_fpreg_t f1_le, f1_be; /* f1 is byte-order dependent */ + } + read_only; + unw_fpreg_t nat_val_le, nat_val_be; + unw_fpreg_t int_val_le, int_val_be; + + struct mempool reg_state_pool; + struct mempool labeled_state_pool; + +# if UNW_DEBUG + const char *preg_name[IA64_NUM_PREGS]; +# endif + }; + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization unw.needs_initialization +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table unw_search_ia64_unwind_table +#define tdep_find_unwind_table ia64_find_unwind_table +#define tdep_find_proc_info UNW_OBJ(find_proc_info) +#define tdep_uc_addr UNW_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_get_as(c) ((c)->as) +#define tdep_get_as_arg(c) ((c)->as_arg) +#define tdep_get_ip(c) ((c)->ip) +#define tdep_big_endian(as) ((c)->as->big_endian != 0) + +#ifndef UNW_LOCAL_ONLY +# define tdep_put_unwind_info UNW_OBJ(put_unwind_info) +#endif + +/* This can't be an UNW_ARCH_OBJ() because we need separate + unw.initialized flags for the local-only and generic versions of + the library. Also, if we wanted to have a single, shared global + data structure, we couldn't declare "unw" as HIDDEN/PROTECTED. */ +#define unw UNW_OBJ(data) + +extern void tdep_init (void); +extern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, + void *arg); +extern void tdep_put_unwind_info (unw_addr_space_t as, + unw_proc_info_t *pi, void *arg); +extern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum, + uint8_t *nat_bitnr); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +extern struct ia64_global_unwind_state unw; + +/* In user-level, we have no reasonable way of determining the base of + an arbitrary backing-store. We default to half the + address-space. */ +#define rbs_get_base(c,bspstore,rbs_basep) \ + (*(rbs_basep) = (bspstore) - (((unw_word_t) 1) << 63), 0) + +#endif /* IA64_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ia64/rse.h b/sdk/cpprt/linux/libunwind/include/tdep-ia64/rse.h new file mode 100644 index 0000000000..c5fe4b5894 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ia64/rse.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 1998, 1999, 2002, 2003, 2005 Hewlett-Packard Co + * David Mosberger-Tang + * + * Register stack engine related helper functions. This file may be + * used in applications, so be careful about the name-space and give + * some consideration to non-GNU C compilers (though __inline__ is + * fine). + */ +#ifndef RSE_H +#define RSE_H + +#include + +static inline uint64_t +rse_slot_num (uint64_t addr) +{ + return (addr >> 3) & 0x3f; +} + +/* + * Return TRUE if ADDR is the address of an RNAT slot. + */ +static inline uint64_t +rse_is_rnat_slot (uint64_t addr) +{ + return rse_slot_num (addr) == 0x3f; +} + +/* + * Returns the address of the RNAT slot that covers the slot at + * address SLOT_ADDR. + */ +static inline uint64_t +rse_rnat_addr (uint64_t slot_addr) +{ + return slot_addr | (0x3f << 3); +} + +/* + * Calculate the number of registers in the dirty partition starting at + * BSPSTORE and ending at BSP. This isn't simply (BSP-BSPSTORE)/8 + * because every 64th slot stores ar.rnat. + */ +static inline uint64_t +rse_num_regs (uint64_t bspstore, uint64_t bsp) +{ + uint64_t slots = (bsp - bspstore) >> 3; + + return slots - (rse_slot_num(bspstore) + slots)/0x40; +} + +/* + * The inverse of the above: given bspstore and the number of + * registers, calculate ar.bsp. + */ +static inline uint64_t +rse_skip_regs (uint64_t addr, long num_regs) +{ + long delta = rse_slot_num(addr) + num_regs; + + if (num_regs < 0) + delta -= 0x3e; + return addr + ((num_regs + delta/0x3f) << 3); +} + +#endif /* RSE_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ia64/script.h b/sdk/cpprt/linux/libunwind/include/tdep-ia64/script.h new file mode 100644 index 0000000000..48a9fe561f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ia64/script.h @@ -0,0 +1,85 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define IA64_LOG_UNW_CACHE_SIZE 7 +#define IA64_UNW_CACHE_SIZE (1 << IA64_LOG_UNW_CACHE_SIZE) + +#define IA64_LOG_UNW_HASH_SIZE (IA64_LOG_UNW_CACHE_SIZE + 1) +#define IA64_UNW_HASH_SIZE (1 << IA64_LOG_UNW_HASH_SIZE) + +typedef unsigned char unw_hash_index_t; + +struct ia64_script_insn + { + unsigned int opc; /* see enum ia64_script_insn_opcode */ + unsigned int dst; + unw_word_t val; + }; + +/* Updating each preserved register may result in one script + instruction each. At the end of the script, psp gets popped, + accounting for one more instruction. */ +#define IA64_MAX_SCRIPT_LEN (IA64_NUM_PREGS + 1) + +struct ia64_script + { + unw_word_t ip; /* ip this script is for */ + unw_word_t pr_mask; /* mask of predicates script depends on */ + unw_word_t pr_val; /* predicate values this script is for */ + unw_proc_info_t pi; /* info about underlying procedure */ + unsigned short lru_chain; /* used for least-recently-used chain */ + unsigned short coll_chain; /* used for hash collisions */ + unsigned short hint; /* hint for next script to try (or -1) */ + unsigned short count; /* number of instructions in script */ + unsigned short abi_marker; + struct ia64_script_insn insn[IA64_MAX_SCRIPT_LEN]; + }; + +struct ia64_script_cache + { +#ifdef HAVE_ATOMIC_OPS_H + AO_TS_t busy; /* is the script-cache busy? */ +#else + pthread_mutex_t lock; +#endif + unsigned short lru_head; /* index of lead-recently used script */ + unsigned short lru_tail; /* index of most-recently used script */ + + /* hash table that maps instruction pointer to script index: */ + unsigned short hash[IA64_UNW_HASH_SIZE]; + + uint32_t generation; /* generation number */ + + /* script cache: */ + struct ia64_script buckets[IA64_UNW_CACHE_SIZE]; + }; + +#define ia64_cache_proc_info UNW_OBJ(cache_proc_info) +#define ia64_get_cached_proc_info UNW_OBJ(get_cached_proc_info) + +struct cursor; /* forward declaration */ + +extern int ia64_cache_proc_info (struct cursor *c); +extern int ia64_get_cached_proc_info (struct cursor *c); diff --git a/sdk/cpprt/linux/libunwind/include/tdep-mips/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-mips/dwarf-config.h new file mode 100644 index 0000000000..250746f56a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-mips/dwarf-config.h @@ -0,0 +1,54 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not + explicitly defined. */ +#define DWARF_NUM_PRESERVED_REGS 188 + +/* FIXME: Probably unnecessary on MIPS. See mips/Gglobal.c. */ +#define DWARF_REGNUM_MAP_LENGTH 32 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) + +/* Return the size of an address, for DWARF purposes. */ +#define dwarf_addr_size(addr_space) ((addr_space)->addr_size) + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-mips/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-mips/jmpbuf.h new file mode 100644 index 0000000000..1adb2bca42 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-mips/jmpbuf.h @@ -0,0 +1,32 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +/* FIXME for MIPS! */ + +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff --git a/sdk/cpprt/linux/libunwind/include/tdep-mips/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-mips/libunwind_i.h new file mode 100644 index 0000000000..f2bc893666 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-mips/libunwind_i.h @@ -0,0 +1,329 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef MIPS_LIBUNWIND_I_H +#define MIPS_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#if !defined(UNW_REMOTE_ONLY) && _MIPS_SIM == _ABI64 +# include "elf64.h" +#else +# include "elf32.h" +#endif +#include "mempool.h" +#include "dwarf.h" + +typedef struct + { + /* no mips-specific fast trace */ + } +unw_tdep_frame_t; + +struct unw_addr_space + { + struct unw_accessors acc; + + int big_endian; + mips_abi_t abi; + unsigned int addr_size; + + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; +}; + +#define tdep_big_endian(as) ((as)->big_endian) + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + unw_word_t sigcontext_addr; + }; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifndef UNW_REMOTE_ONLY +# if _MIPS_SIM == _ABIN32 +typedef long long mips_reg_t; +# else +typedef long mips_reg_t; +# endif +#endif + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) + +/* FIXME: Implement these for the MIPS FPU. */ +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc) = val; + return 0; +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(mips_reg_t *) (intptr_t) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(mips_reg_t *) (intptr_t) DWARF_GET_LOC (loc) = val; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +static inline int +read_s32 (struct dwarf_cursor *c, unw_word_t addr, unw_word_t *val) +{ + int offset = addr & 4; + int ret; + unw_word_t memval; + + ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg); + if (ret < 0) + return ret; + + if ((offset != 0) == tdep_big_endian (c->as)) + *val = (int32_t) memval; + else + *val = (int32_t) (memval >> 32); + + return 0; +} + +static inline int +write_s32 (struct dwarf_cursor *c, unw_word_t addr, const unw_word_t *val) +{ + int offset = addr & 4; + int ret; + unw_word_t memval; + + ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg); + if (ret < 0) + return ret; + + if ((offset != 0) == tdep_big_endian (c->as)) + memval = (memval & ~0xffffffffLL) | (uint32_t) *val; + else + memval = (memval & 0xffffffffLL) | (uint32_t) (*val << 32); + + return (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 1, c->as_arg); +} + +/* FIXME: Implement these for the MIPS FPU. */ +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, + c->as_arg); +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, + 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else if (c->as->abi == UNW_MIPS_ABI_O32) + return read_s32 (c, DWARF_GET_LOC (loc), val); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else if (c->as->abi == UNW_MIPS_ABI_O32) + return write_s32 (c, DWARF_GET_LOC (loc), &val); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (ucontext_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +#endif /* MIPS_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ppc32/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-ppc32/dwarf-config.h new file mode 100644 index 0000000000..e2676a824f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ppc32/dwarf-config.h @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */ +#define DWARF_NUM_PRESERVED_REGS 115 + +#define DWARF_REGNUM_MAP_LENGTH 115 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 1 + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ppc32/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-ppc32/jmpbuf.h new file mode 100644 index 0000000000..3780d5b5e7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ppc32/jmpbuf.h @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +#define JB_SP 6 +#define JB_RP 7 +#define JB_MASK_SAVED 8 +#define JB_MASK 9 diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ppc32/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-ppc32/libunwind_i.h new file mode 100644 index 0000000000..7e66997770 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ppc32/libunwind_i.h @@ -0,0 +1,312 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef PPC32_LIBUNWIND_I_H +#define PPC32_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf32.h" +#include "mempool.h" +#include "dwarf.h" + +typedef struct + { + /* no ppc32-specific fast trace */ + } +unw_tdep_frame_t; + +struct unw_addr_space +{ + struct unw_accessors acc; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; + int validate; +}; + +struct cursor +{ + struct dwarf_cursor dwarf; /* must be first */ + + /* Format of sigcontext structure and address at which it is + stored: */ + enum + { + PPC_SCF_NONE, /* no signal frame encountered */ + PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ + } + sigcontext_format; + unw_word_t sigcontext_addr; +}; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_IS_FP_LOC(l) 0 +# define DWARF_IS_V_LOC(l) 0 +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +#else /* !UNW_LOCAL_ONLY */ + +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_LOC_TYPE_V (1 << 2) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) +# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_V)) + +#endif /* !UNW_LOCAL_ONLY */ + +static inline int +dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) +{ + unw_word_t *valp = (unw_word_t *) val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_V_LOC (loc)); + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 0, c->as_arg); +} + +static inline int +dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + unw_word_t *valp = (unw_word_t *) & val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_V_LOC (loc)); + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 1, c->as_arg); +} + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) +{ + unw_word_t *valp = (unw_word_t *) val; + unw_word_t addr; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 0, c->as_arg); + +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + unw_word_t *valp = (unw_word_t *) & val; + unw_word_t addr; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + + return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t * val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_get_func_addr UNW_OBJ(get_func_addr) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, + int need_unwind_info); + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 1 + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t * di, + unw_proc_info_t * pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (ucontext_t * uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t * valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t * valp, int write); +extern int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, + unw_word_t *entry_point); + +#endif /* PPC64_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ppc64/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-ppc64/dwarf-config.h new file mode 100644 index 0000000000..e2676a824f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ppc64/dwarf-config.h @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */ +#define DWARF_NUM_PRESERVED_REGS 115 + +#define DWARF_REGNUM_MAP_LENGTH 115 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 1 + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ppc64/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-ppc64/jmpbuf.h new file mode 100644 index 0000000000..3780d5b5e7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ppc64/jmpbuf.h @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +#define JB_SP 6 +#define JB_RP 7 +#define JB_MASK_SAVED 8 +#define JB_MASK 9 diff --git a/sdk/cpprt/linux/libunwind/include/tdep-ppc64/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-ppc64/libunwind_i.h new file mode 100644 index 0000000000..aa979b9641 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-ppc64/libunwind_i.h @@ -0,0 +1,312 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef PPC64_LIBUNWIND_I_H +#define PPC64_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf64.h" +#include "mempool.h" +#include "dwarf.h" + +typedef struct + { + /* no ppc64-specific fast trace */ + } +unw_tdep_frame_t; + +struct unw_addr_space +{ + struct unw_accessors acc; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; + int validate; +}; + +struct cursor +{ + struct dwarf_cursor dwarf; /* must be first */ + + /* Format of sigcontext structure and address at which it is + stored: */ + enum + { + PPC_SCF_NONE, /* no signal frame encountered */ + PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ + } + sigcontext_format; + unw_word_t sigcontext_addr; +}; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_IS_FP_LOC(l) 0 +# define DWARF_IS_V_LOC(l) 0 +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +#else /* !UNW_LOCAL_ONLY */ + +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_LOC_TYPE_V (1 << 2) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) +# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_V)) + +#endif /* !UNW_LOCAL_ONLY */ + +static inline int +dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) +{ + unw_word_t *valp = (unw_word_t *) val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_V_LOC (loc)); + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 0, c->as_arg); +} + +static inline int +dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + unw_word_t *valp = (unw_word_t *) & val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_V_LOC (loc)); + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 1, c->as_arg); +} + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) +{ + unw_word_t *valp = (unw_word_t *) val; + unw_word_t addr; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 0, c->as_arg); + +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + unw_word_t *valp = (unw_word_t *) & val; + unw_word_t addr; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + assert (DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + + return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t * val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + assert (!DWARF_IS_V_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_get_func_addr UNW_OBJ(get_func_addr) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, + int need_unwind_info); + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 1 + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t * di, + unw_proc_info_t * pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (ucontext_t * uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t * valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t * valp, int write); +extern int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, + unw_word_t *entry_point); + +#endif /* PPC64_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-x86/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-x86/dwarf-config.h new file mode 100644 index 0000000000..898ab796a9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-x86/dwarf-config.h @@ -0,0 +1,52 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* This matches the value used by GCC (see + gcc/config/i386.h:DWARF_FRAME_REGISTERS), which leaves plenty of + room for expansion. */ +#define DWARF_NUM_PRESERVED_REGS 17 + +#define DWARF_REGNUM_MAP_LENGTH 19 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 0 + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-x86/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-x86/jmpbuf.h new file mode 100644 index 0000000000..561495098b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-x86/jmpbuf.h @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +#if defined __linux__ + +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 + +#elif defined __FreeBSD__ + +#define JB_SP 2 +#define JB_RP 0 +#define JB_MASK_SAVED 11 +#define JB_MASK 7 + +#endif diff --git a/sdk/cpprt/linux/libunwind/include/tdep-x86/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-x86/libunwind_i.h new file mode 100644 index 0000000000..ddcdc10b19 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-x86/libunwind_i.h @@ -0,0 +1,291 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef X86_LIBUNWIND_I_H +#define X86_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf32.h" +#include "mempool.h" +#include "dwarf.h" + +typedef struct + { + /* no x86-specific fast trace */ + } +unw_tdep_frame_t; + +struct unw_addr_space + { + struct unw_accessors acc; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; + }; + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + + /* Format of sigcontext structure and address at which it is + stored: */ + enum + { + X86_SCF_NONE, /* no signal frame encountered */ + X86_SCF_LINUX_SIGFRAME, /* Linux x86 sigcontext */ + X86_SCF_LINUX_RT_SIGFRAME, /* POSIX ucontext_t */ + X86_SCF_FREEBSD_SIGFRAME, /* FreeBSD x86 sigcontext */ + X86_SCF_FREEBSD_SIGFRAME4, /* FreeBSD 4.x x86 sigcontext */ + X86_SCF_FREEBSD_OSIGFRAME, /* FreeBSD pre-4.x x86 sigcontext */ + X86_SCF_FREEBSD_SYSCALL, /* FreeBSD x86 syscall */ + } + sigcontext_format; + unw_word_t sigcontext_addr; + int validate; + ucontext_t *uc; + }; + +static inline ucontext_t * +dwarf_get_uc(const struct dwarf_cursor *cursor) +{ + const struct cursor *c = (struct cursor *) cursor->as_arg; + return c->uc; +} + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr(dwarf_get_uc(c), (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr(dwarf_get_uc(c), (r)), 0)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#else /* !UNW_LOCAL_ONLY */ +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, + c->as_arg); +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, + 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +#define tdep_getcontext_trace unw_getcontext +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 0 + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (ucontext_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +#endif /* X86_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-x86_64/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep-x86_64/dwarf-config.h new file mode 100644 index 0000000000..d3cbe7c27a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-x86_64/dwarf-config.h @@ -0,0 +1,59 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* copy of include/tdep-x86/dwarf-config.h, modified slightly for x86-64 + some consolidation is possible here */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* XXX need to verify if this value is correct */ +#ifdef CONFIG_MSABI_SUPPORT +#define DWARF_NUM_PRESERVED_REGS 33 +#else +#define DWARF_NUM_PRESERVED_REGS 17 +#endif + +#define DWARF_REGNUM_MAP_LENGTH DWARF_NUM_PRESERVED_REGS + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 0 + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep-x86_64/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep-x86_64/jmpbuf.h new file mode 100644 index 0000000000..44fcd69bee --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-x86_64/jmpbuf.h @@ -0,0 +1,43 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#if defined __linux__ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +#define JB_SP 6 +#define JB_RP 7 +#define JB_MASK_SAVED 8 +#define JB_MASK 9 + +#elif defined __FreeBSD__ + +#define JB_SP 2 +#define JB_RP 0 +/* Pretend the ip cannot be 0 and mask is always saved */ +#define JB_MASK_SAVED 0 +#define JB_MASK 9 + +#endif diff --git a/sdk/cpprt/linux/libunwind/include/tdep-x86_64/libunwind_i.h b/sdk/cpprt/linux/libunwind/include/tdep-x86_64/libunwind_i.h new file mode 100644 index 0000000000..29c1bb0eb6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep-x86_64/libunwind_i.h @@ -0,0 +1,259 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef X86_64_LIBUNWIND_I_H +#define X86_64_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf64.h" +#include "mempool.h" +#include "dwarf.h" + +typedef enum + { + UNW_X86_64_FRAME_STANDARD = -2, /* regular rbp, rsp +/- offset */ + UNW_X86_64_FRAME_SIGRETURN = -1, /* special sigreturn frame */ + UNW_X86_64_FRAME_OTHER = 0, /* not cacheable (special or unrecognised) */ + UNW_X86_64_FRAME_GUESSED = 1 /* guessed it was regular, but not known */ + } +unw_tdep_frame_type_t; + +typedef struct + { + uint64_t virtual_address; + int64_t frame_type : 2; /* unw_tdep_frame_type_t classification */ + int64_t last_frame : 1; /* non-zero if last frame in chain */ + int64_t cfa_reg_rsp : 1; /* cfa dwarf base register is rsp vs. rbp */ + int64_t cfa_reg_offset : 30; /* cfa is at this offset from base register value */ + int64_t rbp_cfa_offset : 15; /* rbp saved at this offset from cfa (-1 = not saved) */ + int64_t rsp_cfa_offset : 15; /* rsp saved at this offset from cfa (-1 = not saved) */ + } +unw_tdep_frame_t; + +struct unw_addr_space + { + struct unw_accessors acc; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; + }; + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + + unw_tdep_frame_t frame_info; /* quick tracing assist info */ + + /* Format of sigcontext structure and address at which it is + stored: */ + enum + { + X86_64_SCF_NONE, /* no signal frame encountered */ + X86_64_SCF_LINUX_RT_SIGFRAME, /* Linux ucontext_t */ + X86_64_SCF_FREEBSD_SIGFRAME, /* FreeBSD signal frame */ + X86_64_SCF_FREEBSD_SYSCALL, /* FreeBSD syscall */ + } + sigcontext_format; + unw_word_t sigcontext_addr; + int validate; + ucontext_t *uc; + }; + +static inline ucontext_t * +dwarf_get_uc(const struct dwarf_cursor *cursor) +{ + const struct cursor *c = (struct cursor *) cursor->as_arg; + return c->uc; +} + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) +#else /* !UNW_LOCAL_ONLY */ + +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +#endif /* !UNW_LOCAL_ONLY */ + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + abort (); +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + abort (); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) +#define tdep_needs_initialization UNW_OBJ(needs_initialization) +#define tdep_init_mem_validate UNW_OBJ(init_mem_validate) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#if __linux__ +# define tdep_fetch_frame UNW_OBJ(fetch_frame) +# define tdep_cache_frame UNW_OBJ(cache_frame) +# define tdep_reuse_frame UNW_OBJ(reuse_frame) +#else +# define tdep_fetch_frame(c,ip,n) do {} while(0) +# define tdep_cache_frame(c,rs) do {} while(0) +# define tdep_reuse_frame(c,rs) do {} while(0) +#endif +#define tdep_stash_frame UNW_OBJ(stash_frame) +#if HAVE_SGX +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#else +#define tdep_trace UNW_OBJ(tdep_trace) +#endif +#define x86_64_r_uc_addr UNW_OBJ(r_uc_addr) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 0 + +extern int tdep_needs_initialization; + +extern void tdep_init (void); +extern void tdep_init_mem_validate (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); +#if __linux__ +extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip, + int need_unwind_info); +extern void tdep_cache_frame (struct dwarf_cursor *c, + struct dwarf_reg_state *rs); +extern void tdep_reuse_frame (struct dwarf_cursor *c, + struct dwarf_reg_state *rs); +extern void tdep_stash_frame (struct dwarf_cursor *c, + struct dwarf_reg_state *rs); +#endif + +extern int tdep_getcontext_trace (unw_tdep_context_t *); + +#if (!HAVE_SGX) +extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n); +#endif + +#endif /* X86_64_LIBUNWIND_I_H */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep/dwarf-config.h b/sdk/cpprt/linux/libunwind/include/tdep/dwarf-config.h new file mode 100644 index 0000000000..ff5715f623 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep/dwarf-config.h @@ -0,0 +1,22 @@ +/* Provide a real file - not a symlink - as it would cause multiarch conflicts + when multiple different arch releases are installed simultaneously. */ + +#if defined __arm__ +# include "tdep-arm/dwarf-config.h" +#elif defined __hppa__ +# include "tdep-hppa/dwarf-config.h" +#elif defined __ia64__ +# include "tdep-ia64/dwarf-config.h" +#elif defined __mips__ +# include "tdep-mips/dwarf-config.h" +#elif defined __powerpc__ && !defined __powerpc64__ +# include "tdep-ppc32/dwarf-config.h" +#elif defined __powerpc64__ +# include "tdep-ppc64/dwarf-config.h" +#elif defined __i386__ +# include "tdep-x86/dwarf-config.h" +#elif defined __x86_64__ || defined __amd64__ +# include "tdep-x86_64/dwarf-config.h" +#else +# error "Unsupported arch" +#endif diff --git a/sdk/cpprt/linux/libunwind/include/tdep/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/tdep/jmpbuf.h new file mode 100644 index 0000000000..7d04a42c47 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep/jmpbuf.h @@ -0,0 +1,26 @@ +/* Provide a real file - not a symlink - as it would cause multiarch conflicts + when multiple different arch releases are installed simultaneously. */ + +#ifndef UNW_REMOTE_ONLY + +#if defined __arm__ +# include "tdep-arm/jmpbuf.h" +#elif defined __hppa__ +# include "tdep-hppa/jmpbuf.h" +#elif defined __ia64__ +# include "tdep-ia64/jmpbuf.h" +#elif defined __mips__ +# include "tdep-mips/jmpbuf.h" +#elif defined __powerpc__ && !defined __powerpc64__ +# include "tdep-ppc32/jmpbuf.h" +#elif defined __powerpc64__ +# include "tdep-ppc64/jmpbuf.h" +#elif defined __i386__ +# include "tdep-x86/jmpbuf.h" +#elif defined __x86_64__ +# include "tdep-x86_64/jmpbuf.h" +#else +# error "Unsupported arch" +#endif + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/include/tdep/libunwind_i.h.in b/sdk/cpprt/linux/libunwind/include/tdep/libunwind_i.h.in new file mode 100644 index 0000000000..96f49fb26e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/tdep/libunwind_i.h.in @@ -0,0 +1,31 @@ +/* Provide a real file - not a symlink - as it would cause multiarch conflicts + when multiple different arch releases are installed simultaneously. */ + +#ifndef UNW_REMOTE_ONLY + +#if defined __arm__ +# include "tdep-arm/libunwind_i.h" +#elif defined __hppa__ +# include "tdep-hppa/libunwind_i.h" +#elif defined __ia64__ +# include "tdep-ia64/libunwind_i.h" +#elif defined __mips__ +# include "tdep-mips/libunwind_i.h" +#elif defined __powerpc__ && !defined __powerpc64__ +# include "tdep-ppc32/libunwind_i.h" +#elif defined __powerpc64__ +# include "tdep-ppc64/libunwind_i.h" +#elif defined __i386__ +# include "tdep-x86/libunwind_i.h" +#elif defined __x86_64__ +# include "tdep-x86_64/libunwind_i.h" +#else +# error "Unsupported arch" +#endif + + +#else /* UNW_REMOTE_ONLY */ + +# include "tdep-@arch@/libunwind_i.h" + +#endif /* UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/include/unwind.h b/sdk/cpprt/linux/libunwind/include/unwind.h new file mode 100644 index 0000000000..f8d43d0d0e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/unwind.h @@ -0,0 +1,154 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +/* For uint64_t */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimal interface as per C++ ABI draft standard: + + http://www.codesourcery.com/cxx-abi/abi-eh.html */ + +typedef enum + { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 + } +_Unwind_Reason_Code; + +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 + +struct _Unwind_Context; /* opaque data-structure */ +struct _Unwind_Exception; /* forward-declaration */ + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, + uint64_t, + struct _Unwind_Exception *, + struct _Unwind_Context *, + void *); + +/* The C++ ABI requires exception_class, private_1, and private_2 to + be of type uint64 and the entire structure to be + double-word-aligned. Please note that exception_class stays 64-bit + even on 32-bit machines for gcc compatibility. */ +struct _Unwind_Exception + { + uint64_t exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + unsigned long private_1; + unsigned long private_2; + } __attribute__((__aligned__)); + +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, void *); +extern void _Unwind_Resume (struct _Unwind_Exception *); +extern void _Unwind_DeleteException (struct _Unwind_Exception *); +extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); +extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); +extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); +extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); +extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); +extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); + +#ifdef _GNU_SOURCE + +/* Callback for _Unwind_Backtrace(). The backtrace stops immediately + if the callback returns any value other than _URC_NO_REASON. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, + void *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why + _UA_END_OF_STACK exists. */ +# define _UA_END_OF_STACK 16 + +/* If the unwind was initiated due to a forced unwind, resume that + operation, else re-raise the exception. This is used by + __cxa_rethrow(). */ +extern _Unwind_Reason_Code + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why + _Unwind_GetBSP() exists. */ +extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); + +/* Return the "canonical frame address" for the given context. + This is used by NPTL... */ +extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); + +/* Return the base-address for data references. */ +extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); + +/* Return the base-address for text references. */ +extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); + +/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any + cleanup. The first frame for which the callback is invoked is the + one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() + returns _URC_END_OF_STACK when the backtrace stopped due to + reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it + stops for any other reason. */ +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* Find the start-address of the procedure containing the specified IP + or NULL if it cannot be found (e.g., because the function has no + unwind info). Note: there is not necessarily a one-to-one + correspondence between source-level functions and procedures: some + functions don't have unwind-info and others are split into multiple + procedures. */ +extern void *_Unwind_FindEnclosingFunction (void *); + +/* See also Linux Standard Base Spec: + http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ + +#endif /* _GNU_SOURCE */ + +#ifdef __cplusplus +}; +#endif + +#endif /* _UNWIND_H */ diff --git a/sdk/cpprt/linux/libunwind/include/x86/jmpbuf.h b/sdk/cpprt/linux/libunwind/include/x86/jmpbuf.h new file mode 100644 index 0000000000..a0eb072ee1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/include/x86/jmpbuf.h @@ -0,0 +1,31 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff --git a/sdk/cpprt/linux/libunwind/scripts/kernel-diff.sh b/sdk/cpprt/linux/libunwind/scripts/kernel-diff.sh new file mode 100755 index 0000000000..459194e15a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/scripts/kernel-diff.sh @@ -0,0 +1,10 @@ +kdir=${1:-../kernel} +scriptdir=$(dirname $0) +udir=$(dirname $scriptdir) +cat $scriptdir/kernel-files.txt | \ +(while read l r; do + left=$(eval echo $l) + right=$(eval echo $r) +# echo $left $right + diff -up $left $right +done) diff --git a/sdk/cpprt/linux/libunwind/scripts/kernel-files.txt b/sdk/cpprt/linux/libunwind/scripts/kernel-files.txt new file mode 100644 index 0000000000..d79e453a33 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/scripts/kernel-files.txt @@ -0,0 +1,19 @@ +$udir/include/tdep-ia64/rse.h $kdir/arch/ia64/unwind/rse.h +$udir/src/ia64/Ginit_local.c $kdir/arch/ia64/unwind/init_local.c +$udir/src/ia64/Gis_signal_frame.c $kdir/arch/ia64/unwind/is_signal_frame.c +$udir/src/ia64/Gparser.c $kdir/arch/ia64/unwind/parser.c +$udir/src/ia64/Grbs.c $kdir/arch/ia64/unwind/rbs.c +$udir/src/ia64/Gregs.c $kdir/arch/ia64/unwind/regs.c +$udir/src/ia64/Gscript.c $kdir/arch/ia64/unwind/script.c +$udir/src/ia64/Gstep.c $kdir/arch/ia64/unwind/step.c +$udir/src/ia64/init.h $kdir/arch/ia64/unwind/init.h +$udir/src/ia64/offsets.h $kdir/arch/ia64/unwind/offsets.h +$udir/src/ia64/regname.c $kdir/arch/ia64/unwind/regname.c +$udir/src/ia64/regs.h $kdir/arch/ia64/unwind/regs.h +$udir/src/ia64/unwind_decoder.h $kdir/arch/ia64/unwind/unwind_decoder.h +$udir/src/mi/Gget_fpreg.c $kdir/unwind/get_fpreg.c +$udir/src/mi/Gget_reg.c $kdir/unwind/get_reg.c +$udir/src/mi/Gset_fpreg.c $kdir/unwind/set_fpreg.c +$udir/src/mi/Gset_reg.c $kdir/unwind/set_reg.c +$udir/src/mi/flush_cache.c $kdir/unwind/flush_cache.c +$udir/src/mi/mempool.c $kdir/unwind/mempool.c diff --git a/sdk/cpprt/linux/libunwind/scripts/make-L-files b/sdk/cpprt/linux/libunwind/scripts/make-L-files new file mode 100755 index 0000000000..8280e3d76a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/scripts/make-L-files @@ -0,0 +1,30 @@ +#!/bin/sh +cwd=`pwd` +dir=`basename ${cwd}` +# +# When compiling a file that goes into libunwind, we only +# need to compile it when we really do support UNW_LOCAL_ONLY. +# In contrast, libunwind-tests should always get compiled. +# +if test $dir = "tests"; then + local_only_test="" +else + local_only_test="defined(UNW_LOCAL_ONLY) && " +fi +for gname in `ls G*.c G*.cxx G*.S 2>/dev/null`; do + lname="L$(expr $gname : '.\(.*\)')" + bk edit $lname >/dev/null 2>&1 + ext=$(expr $gname : '[^.]*[.]\(.*\)') + if [ "$ext" = "S" ]; then + include="" + else + include="#include " + fi + echo -e "\ +#define UNW_LOCAL_ONLY\n\ +$include\n\ +#if ${local_only_test}!defined(UNW_REMOTE_ONLY)\n\ +#include \"$gname\"\n\ +#endif" > $lname + echo created $lname +done diff --git a/sdk/cpprt/linux/libunwind/src/Makefile.am b/sdk/cpprt/linux/libunwind/src/Makefile.am new file mode 100644 index 0000000000..243ab08fdc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/Makefile.am @@ -0,0 +1,565 @@ +SOVERSION=8:0:0 # See comments at end of file. +SETJMP_SO_VERSION=0:0:0 +# +# Don't link with start-files since we don't use any constructors/destructors: +# +COMMON_SO_LDFLAGS = -XCClinker -nostartfiles + +lib_LIBRARIES = +lib_LTLIBRARIES = +if !REMOTE_ONLY +#lib_LIBRARIES += libunwind-ptrace.a libunwind-coredump.a +lib_LTLIBRARIES += libunwind.la +endif + +noinst_HEADERS = +noinst_LTLIBRARIES = + +### libunwind-ptrace: +libunwind_ptrace_a_SOURCES = \ + ptrace/_UPT_elf.c \ + ptrace/_UPT_accessors.c ptrace/_UPT_access_fpreg.c \ + ptrace/_UPT_access_mem.c ptrace/_UPT_access_reg.c \ + ptrace/_UPT_create.c ptrace/_UPT_destroy.c \ + ptrace/_UPT_find_proc_info.c ptrace/_UPT_get_dyn_info_list_addr.c \ + ptrace/_UPT_put_unwind_info.c ptrace/_UPT_get_proc_name.c \ + ptrace/_UPT_reg_offset.c ptrace/_UPT_resume.c +noinst_HEADERS += ptrace/_UPT_internal.h + +### libunwind-coredump: +libunwind_coredump_a_SOURCES = \ + coredump/_UCD_accessors.c \ + coredump/_UCD_create.c \ + coredump/_UCD_destroy.c \ + coredump/_UCD_access_mem.c \ + coredump/_UCD_elf_map_image.c \ + coredump/_UCD_find_proc_info.c \ + coredump/_UCD_get_proc_name.c \ + \ + coredump/_UPT_elf.c \ + coredump/_UPT_access_fpreg.c \ + coredump/_UPT_get_dyn_info_list_addr.c \ + coredump/_UPT_put_unwind_info.c \ + coredump/_UPT_resume.c +noinst_HEADERS += coredump/_UCD_internal.h + +### libunwind-setjmp: +libunwind_setjmp_la_LDFLAGS = $(COMMON_SO_LDFLAGS) \ + -version-info $(SETJMP_SO_VERSION) + +if USE_ELF32 +LIBUNWIND_ELF = libunwind-elf32.la +endif +if USE_ELF64 +LIBUNWIND_ELF = libunwind-elf64.la +endif +if USE_ELFXX +LIBUNWIND_ELF = libunwind-elfxx.la +endif + +libunwind_setjmp_la_LIBADD = $(LIBUNWIND_ELF) \ + libunwind-$(arch).la \ + libunwind.la -lc +libunwind_setjmp_la_SOURCES = setjmp/longjmp.c \ + setjmp/siglongjmp.c +noinst_HEADERS += setjmp/setjmp_i.h + +### libunwind: +libunwind_la_LIBADD = + +# List of arch-independent files needed by both local-only and generic +# libraries: +libunwind_la_SOURCES_common = \ + $(libunwind_la_SOURCES_os) \ + mi/init.c mi/flush_cache.c mi/mempool.c mi/strerror.c + +# List of arch-independent files needed by generic library (libunwind-$ARCH): +libunwind_la_SOURCES_generic = \ + mi/Gget_accessors.c \ + mi/Gput_dynamic_unwind_info.c mi/Gdestroy_addr_space.c \ + mi/Gget_reg.c mi/Gset_reg.c \ + mi/Gget_fpreg.c mi/Gset_fpreg.c \ + mi/Gset_caching_policy.c + +if SUPPORT_CXX_EXCEPTIONS +libunwind_la_SOURCES_local_unwind = \ + unwind/Backtrace.c unwind/DeleteException.c \ + unwind/FindEnclosingFunction.c unwind/ForcedUnwind.c \ + unwind/GetBSP.c unwind/GetCFA.c unwind/GetDataRelBase.c \ + unwind/GetGR.c unwind/GetIP.c unwind/GetLanguageSpecificData.c \ + unwind/GetRegionStart.c unwind/GetTextRelBase.c \ + unwind/RaiseException.c unwind/Resume.c \ + unwind/Resume_or_Rethrow.c unwind/SetGR.c unwind/SetIP.c \ + unwind/GetIPInfo.c + +# _ReadULEB()/_ReadSLEB() are needed for Intel C++ 8.0 compatibility +libunwind_la_SOURCES_os_linux_local = mi/_ReadULEB.c mi/_ReadSLEB.c +endif + +# List of arch-independent files needed by local-only library (libunwind): +libunwind_la_SOURCES_local_nounwind = \ + $(libunwind_la_SOURCES_os_local) \ + mi/backtrace.c \ + mi/dyn-info-list.c \ + mi/Ldyn-extract.c mi/Lfind_dynamic_proc_info.c \ + mi/Lget_accessors.c \ + mi/Lget_proc_info_by_ip.c mi/Lget_proc_name.c \ + mi/Lput_dynamic_unwind_info.c mi/Ldestroy_addr_space.c \ + mi/Lget_reg.c mi/Lset_reg.c \ + mi/Lget_fpreg.c mi/Lset_fpreg.c \ + mi/Lset_caching_policy.c + +libunwind_la_SOURCES_local = \ + $(libunwind_la_SOURCES_local_nounwind) \ + $(libunwind_la_SOURCES_local_unwind) + +noinst_HEADERS += os-linux.h +libunwind_la_SOURCES_os_linux = os-linux.c + +libunwind_la_SOURCES_os_hpux = os-hpux.c + +libunwind_la_SOURCES_os_freebsd = os-freebsd.c + +libunwind_dwarf_common_la_SOURCES = dwarf/global.c + +libunwind_dwarf_local_la_SOURCES = \ + dwarf/Lexpr.c dwarf/Lfde.c dwarf/Lparser.c dwarf/Lpe.c dwarf/Lstep.c \ + dwarf/Lfind_proc_info-lsb.c \ + dwarf/Lfind_unwind_table.c +libunwind_dwarf_local_la_LIBADD = libunwind-dwarf-common.la + +libunwind_dwarf_generic_la_SOURCES = \ + dwarf/Gexpr.c dwarf/Gfde.c dwarf/Gparser.c dwarf/Gpe.c dwarf/Gstep.c \ + dwarf/Gfind_unwind_table.c +libunwind_dwarf_generic_la_LIBADD = libunwind-dwarf-common.la + +if USE_DWARF + noinst_LTLIBRARIES += libunwind-dwarf-common.la libunwind-dwarf-generic.la +if !REMOTE_ONLY + noinst_LTLIBRARIES += libunwind-dwarf-local.la +endif + libunwind_la_LIBADD += libunwind-dwarf-local.la +endif + +noinst_HEADERS += elf32.h elf64.h elfxx.h + +libunwind_elf32_la_SOURCES = se-libc-stubs.c se-iterate-phdr.c +libunwind_elf64_la_SOURCES = se-libc-stubs.c se-iterate-phdr.c +libunwind_elfxx_la_SOURCES = elfxx.c + +noinst_LTLIBRARIES += $(LIBUNWIND_ELF) +libunwind_la_LIBADD += $(LIBUNWIND_ELF) + +# The list of files that go into libunwind and libunwind-arm: +noinst_HEADERS += arm/init.h arm/offsets.h arm/unwind_i.h +libunwind_la_SOURCES_arm_common = $(libunwind_la_SOURCES_common) \ + arm/is_fpreg.c arm/regname.c \ + arm/ex_tables.h + +# The list of files that go into libunwind: +libunwind_la_SOURCES_arm = $(libunwind_la_SOURCES_arm_common) \ + $(libunwind_la_SOURCES_local) \ + arm/getcontext.S \ + arm/Lcreate_addr_space.c arm/Lget_proc_info.c arm/Lget_save_loc.c \ + arm/Lglobal.c arm/Linit.c arm/Linit_local.c arm/Linit_remote.c \ + arm/Lis_signal_frame.c arm/Lregs.c arm/Lresume.c arm/Lstep.c \ + arm/Lex_tables.c + +libunwind_arm_la_SOURCES_arm = $(libunwind_la_SOURCES_arm_common) \ + $(libunwind_la_SOURCES_generic) \ + arm/Gcreate_addr_space.c arm/Gget_proc_info.c arm/Gget_save_loc.c \ + arm/Gglobal.c arm/Ginit.c arm/Ginit_local.c arm/Ginit_remote.c \ + arm/Gis_signal_frame.c arm/Gregs.c arm/Gresume.c arm/Gstep.c \ + arm/Gex_tables.c + +# The list of files that go both into libunwind and libunwind-ia64: +noinst_HEADERS += ia64/init.h ia64/offsets.h ia64/regs.h \ + ia64/ucontext_i.h ia64/unwind_decoder.h ia64/unwind_i.h +libunwind_la_SOURCES_ia64_common = $(libunwind_la_SOURCES_common) \ + ia64/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_ia64 = $(libunwind_la_SOURCES_ia64_common) \ + $(libunwind_la_SOURCES_local) \ + \ + ia64/dyn_info_list.S ia64/getcontext.S \ + \ + ia64/Lcreate_addr_space.c ia64/Lget_proc_info.c ia64/Lget_save_loc.c \ + ia64/Lglobal.c ia64/Linit.c ia64/Linit_local.c ia64/Linit_remote.c \ + ia64/Linstall_cursor.S ia64/Lis_signal_frame.c ia64/Lparser.c \ + ia64/Lrbs.c ia64/Lregs.c ia64/Lresume.c ia64/Lscript.c ia64/Lstep.c \ + ia64/Ltables.c ia64/Lfind_unwind_table.c + +# The list of files that go into libunwind-ia64: +libunwind_ia64_la_SOURCES_ia64 = $(libunwind_la_SOURCES_ia64_common) \ + $(libunwind_la_SOURCES_generic) \ + ia64/Gcreate_addr_space.c ia64/Gget_proc_info.c ia64/Gget_save_loc.c \ + ia64/Gglobal.c ia64/Ginit.c ia64/Ginit_local.c ia64/Ginit_remote.c \ + ia64/Ginstall_cursor.S ia64/Gis_signal_frame.c ia64/Gparser.c \ + ia64/Grbs.c ia64/Gregs.c ia64/Gresume.c ia64/Gscript.c ia64/Gstep.c \ + ia64/Gtables.c ia64/Gfind_unwind_table.c + +# The list of files that go both into libunwind and libunwind-hppa: +noinst_HEADERS += hppa/init.h hppa/offsets.h hppa/unwind_i.h +libunwind_la_SOURCES_hppa_common = $(libunwind_la_SOURCES_common) \ + hppa/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_hppa = $(libunwind_la_SOURCES_hppa_common) \ + $(libunwind_la_SOURCES_local) \ + hppa/getcontext.S hppa/setcontext.S \ + hppa/Lcreate_addr_space.c hppa/Lget_save_loc.c hppa/Lglobal.c \ + hppa/Linit.c hppa/Linit_local.c hppa/Linit_remote.c \ + hppa/Lis_signal_frame.c hppa/Lget_proc_info.c hppa/Lregs.c \ + hppa/Lresume.c hppa/Lstep.c + +# The list of files that go into libunwind-hppa: +libunwind_hppa_la_SOURCES_hppa = $(libunwind_la_SOURCES_hppa_common) \ + $(libunwind_la_SOURCES_generic) \ + hppa/Gcreate_addr_space.c hppa/Gget_save_loc.c hppa/Gglobal.c \ + hppa/Ginit.c hppa/Ginit_local.c hppa/Ginit_remote.c \ + hppa/Gis_signal_frame.c hppa/Gget_proc_info.c hppa/Gregs.c \ + hppa/Gresume.c hppa/Gstep.c + +# The list of files that go info libunwind and libunwind-mips: +noinst_HEADERS += mips/init.h mips/offsets.h +libunwind_la_SOURCES_mips_common = $(libunwind_la_SOURCES_common) \ + mips/is_fpreg.c mips/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_mips = $(libunwind_la_SOURCES_mips_common) \ + $(libunwind_la_SOURCES_local) \ + mips/getcontext.S \ + mips/Lcreate_addr_space.c mips/Lget_proc_info.c mips/Lget_save_loc.c \ + mips/Lglobal.c mips/Linit.c mips/Linit_local.c mips/Linit_remote.c \ + mips/Lis_signal_frame.c mips/Lregs.c mips/Lresume.c mips/Lstep.c + +libunwind_mips_la_SOURCES_mips = $(libunwind_la_SOURCES_mips_common) \ + $(libunwind_la_SOURCES_generic) \ + mips/Gcreate_addr_space.c mips/Gget_proc_info.c mips/Gget_save_loc.c \ + mips/Gglobal.c mips/Ginit.c mips/Ginit_local.c mips/Ginit_remote.c \ + mips/Gis_signal_frame.c mips/Gregs.c mips/Gresume.c mips/Gstep.c + +# The list of files that go both into libunwind and libunwind-x86: +noinst_HEADERS += x86/init.h x86/offsets.h x86/unwind_i.h +libunwind_la_SOURCES_x86_common = $(libunwind_la_SOURCES_common) \ + x86/is_fpreg.c x86/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_x86 = $(libunwind_la_SOURCES_x86_common) \ + $(libunwind_la_SOURCES_x86_os_local) \ + $(libunwind_la_SOURCES_local) \ + x86/Lcreate_addr_space.c x86/Lget_save_loc.c x86/Lglobal.c \ + x86/Linit.c x86/Linit_local.c x86/Linit_remote.c \ + x86/Lget_proc_info.c x86/Lregs.c \ + x86/Lresume.c x86/Lstep.c + +# The list of files that go into libunwind-x86: +libunwind_x86_la_SOURCES_x86 = $(libunwind_la_SOURCES_x86_common) \ + $(libunwind_la_SOURCES_x86_os) \ + $(libunwind_la_SOURCES_generic) \ + x86/Gcreate_addr_space.c x86/Gget_save_loc.c x86/Gglobal.c \ + x86/Ginit.c x86/Ginit_local.c x86/Ginit_remote.c \ + x86/Gget_proc_info.c x86/Gregs.c \ + x86/Gresume.c x86/Gstep.c + +# The list of files that go both into libunwind and libunwind-x86_64: +noinst_HEADERS += x86_64/offsets.h \ + x86_64/init.h x86_64/unwind_i.h x86_64/ucontext_i.h +libunwind_la_SOURCES_x86_64_common = $(libunwind_la_SOURCES_common) \ + x86_64/is_fpreg.c x86_64/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_x86_64 = $(libunwind_la_SOURCES_x86_64_common) \ + $(libunwind_la_SOURCES_x86_64_os_local) \ + $(libunwind_la_SOURCES_local) \ + x86_64/Lcreate_addr_space.c x86_64/Lget_save_loc.c x86_64/Lglobal.c \ + x86_64/Linit.c x86_64/Linit_local.c x86_64/Linit_remote.c \ + x86_64/Lget_proc_info.c x86_64/Lregs.c x86_64/Lresume.c \ + x86_64/Lstash_frame.c x86_64/Lstep.c x86_64/getcontext.S + +# The list of files that go into libunwind-x86_64: +libunwind_x86_64_la_SOURCES_x86_64 = $(libunwind_la_SOURCES_x86_64_common) \ + $(libunwind_la_SOURCES_x86_64_os) \ + $(libunwind_la_SOURCES_generic) \ + x86_64/Gcreate_addr_space.c x86_64/Gget_save_loc.c x86_64/Gglobal.c \ + x86_64/Ginit.c x86_64/Ginit_local.c x86_64/Ginit_remote.c \ + x86_64/Gget_proc_info.c x86_64/Gregs.c x86_64/Gresume.c \ + x86_64/Gstash_frame.c x86_64/Gstep.c + +# The list of local files that go to Power 64 and 32: +libunwind_la_SOURCES_ppc = ppc/Lcreate_addr_space.c \ + ppc/Lget_proc_info.c ppc/Lget_save_loc.c ppc/Linit_local.c \ + ppc/Linit_remote.c ppc/Lis_signal_frame.c + +# The list of generic files that go to Power 64 and 32: +libunwind_ppc_la_SOURCES_ppc_generic = ppc/Gcreate_addr_space.c \ + ppc/Gget_proc_info.c ppc/Gget_save_loc.c ppc/Ginit_local.c \ + ppc/Ginit_remote.c ppc/Gis_signal_frame.c + +# The list of files that go both into libunwind and libunwind-ppc32: +noinst_HEADERS += ppc32/init.h ppc32/unwind_i.h ppc32/ucontext_i.h +libunwind_la_SOURCES_ppc32_common = $(libunwind_la_SOURCES_common) \ + ppc32/is_fpreg.c ppc32/regname.c ppc32/get_func_addr.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_ppc32 = $(libunwind_la_SOURCES_ppc32_common) \ + $(libunwind_la_SOURCES_local) \ + $(libunwind_la_SOURCES_ppc) \ + ppc32/Lglobal.c ppc32/Linit.c \ + ppc32/Lregs.c ppc32/Lresume.c ppc32/Lstep.c + +# The list of files that go into libunwind-ppc32: +libunwind_ppc32_la_SOURCES_ppc32 = $(libunwind_la_SOURCES_ppc32_common) \ + $(libunwind_la_SOURCES_generic) \ + $(libunwind_ppc_la_SOURCES_ppc_generic) \ + ppc32/Gglobal.c ppc32/Ginit.c \ + ppc32/Gregs.c ppc32/Gresume.c ppc32/Gstep.c + +# The list of files that go both into libunwind and libunwind-ppc64: +noinst_HEADERS += ppc64/init.h ppc64/unwind_i.h ppc64/ucontext_i.h +libunwind_la_SOURCES_ppc64_common = $(libunwind_la_SOURCES_common) \ + ppc64/is_fpreg.c ppc64/regname.c ppc64/get_func_addr.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_ppc64 = $(libunwind_la_SOURCES_ppc64_common) \ + $(libunwind_la_SOURCES_local) \ + $(libunwind_la_SOURCES_ppc) \ + ppc64/Lglobal.c ppc64/Linit.c \ + ppc64/Lregs.c ppc64/Lresume.c ppc64/Lstep.c + +# The list of files that go into libunwind-ppc64: +libunwind_ppc64_la_SOURCES_ppc64 = $(libunwind_la_SOURCES_ppc64_common) \ + $(libunwind_la_SOURCES_generic) \ + $(libunwind_ppc_la_SOURCES_ppc_generic) \ + ppc64/Gglobal.c ppc64/Ginit.c \ + ppc64/Gregs.c ppc64/Gresume.c ppc64/Gstep.c + +if REMOTE_ONLY +install-exec-hook: +# Nothing to do here.... +else +# +# This is not ideal, but I know of no other way to install an +# alias for a library. For the shared version, we have to do +# a file check before creating the link, because it isn't going +# to be there if the user configured with --disable-shared. +# +install-exec-hook: + $(LN_S) -f libunwind-$(arch).a $(DESTDIR)$(libdir)/libunwind-generic.a + if test -f $(DESTDIR)$(libdir)/libunwind-$(arch).so; then \ + $(LN_S) -f libunwind-$(arch).so \ + $(DESTDIR)$(libdir)/libunwind-generic.so; \ + fi +endif + +if OS_LINUX + libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_linux) + libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_linux_local) + libunwind_la_SOURCES_x86_os = x86/Gos-linux.c + libunwind_x86_la_SOURCES_os = x86/getcontext-linux.S + libunwind_la_SOURCES_x86_os_local = x86/Los-linux.c + libunwind_la_SOURCES_x86_64_os = x86_64/Gos-linux.c + libunwind_la_SOURCES_x86_64_os_local = x86_64/Los-linux.c + libunwind_coredump_a_SOURCES += coredump/_UCD_access_reg_linux.c +endif + +if OS_HPUX + libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_hpux) + libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_hpux_local) +endif + +if OS_FREEBSD + libunwind_la_SOURCES_os = $(libunwind_la_SOURCES_os_freebsd) + libunwind_la_SOURCES_os_local = $(libunwind_la_SOURCES_os_freebsd_local) + libunwind_la_SOURCES_x86_os = x86/Gos-freebsd.c + libunwind_x86_la_SOURCES_os = x86/getcontext-freebsd.S + libunwind_la_SOURCES_x86_os_local = x86/Los-freebsd.c + libunwind_la_SOURCES_x86_64_os = x86_64/Gos-freebsd.c + libunwind_la_SOURCES_x86_64_os_local = x86_64/Los-freebsd.c + libunwind_coredump_a_SOURCES += coredump/_UCD_access_reg_freebsd.c +endif + +if ARCH_ARM + lib_LTLIBRARIES += libunwind-arm.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_arm) + libunwind_arm_la_SOURCES = $(libunwind_arm_la_SOURCES_arm) + libunwind_arm_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_arm_la_LIBADD = libunwind-dwarf-generic.la + libunwind_arm_la_LIBADD += libunwind-elf32.la +if !REMOTE_ONLY + libunwind_arm_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += arm/siglongjmp.S +else +if ARCH_IA64 + ia64_mk_Gcursor_i_SOURCES = ia64/mk_Gcursor_i.c + ia64_mk_Lcursor_i_SOURCES = ia64/mk_Lcursor_i.c + noinst_PROGRAMS = ia64/mk_Gcursor_i ia64/mk_Lcursor_i + BUILT_SOURCES = Gcursor_i.h Lcursor_i.h +Gcursor_i.h: ia64/mk_Gcursor_i + ia64/mk_Gcursor_i > $@ +Lcursor_i.h: ia64/mk_Lcursor_i + ia64/mk_Lcursor_i > $@ + + lib_LTLIBRARIES += libunwind-ia64.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_ia64) + libunwind_ia64_la_SOURCES = $(libunwind_ia64_la_SOURCES_ia64) + libunwind_ia64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_ia64_la_LIBADD = libunwind-elf64.la +if !REMOTE_ONLY + libunwind_ia64_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += ia64/setjmp.S ia64/sigsetjmp.S \ + ia64/longjmp.S ia64/siglongjmp.S +else +if ARCH_HPPA + lib_LTLIBRARIES += libunwind-hppa.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_hppa) + libunwind_hppa_la_SOURCES = $(libunwind_hppa_la_SOURCES_hppa) + libunwind_hppa_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_hppa_la_LIBADD = libunwind-dwarf-generic.la + libunwind_hppa_la_LIBADD += libunwind-elf32.la +if !REMOTE_ONLY + libunwind_hppa_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += hppa/siglongjmp.S +else +if ARCH_MIPS + lib_LTLIBRARIES += libunwind-mips.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_mips) + libunwind_mips_la_SOURCES = $(libunwind_mips_la_SOURCES_mips) + libunwind_mips_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_mips_la_LIBADD = libunwind-dwarf-generic.la + libunwind_mips_la_LIBADD += libunwind-elfxx.la +if !REMOTE_ONLY + libunwind_mips_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += mips/siglongjmp.S +else +if ARCH_X86 + lib_LTLIBRARIES += libunwind-x86.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86) $(libunwind_x86_la_SOURCES_os) + libunwind_x86_la_SOURCES = $(libunwind_x86_la_SOURCES_x86) + libunwind_x86_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_x86_la_LIBADD = libunwind-dwarf-generic.la + libunwind_x86_la_LIBADD += libunwind-elf32.la +if !REMOTE_ONLY + libunwind_x86_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += x86/longjmp.S x86/siglongjmp.S +else +if ARCH_X86_64 + lib_LTLIBRARIES += libunwind-x86_64.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_x86_64) + libunwind_x86_64_la_SOURCES = $(libunwind_x86_64_la_SOURCES_x86_64) + libunwind_x86_64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_x86_64_la_LIBADD = libunwind-dwarf-generic.la + libunwind_x86_64_la_LIBADD += libunwind-elf64.la +if !REMOTE_ONLY + libunwind_x86_64_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += x86_64/longjmp.S x86_64/siglongjmp.S +else +if ARCH_PPC32 + lib_LTLIBRARIES += libunwind-ppc32.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc32) + libunwind_ppc32_la_SOURCES = $(libunwind_ppc32_la_SOURCES_ppc32) + libunwind_ppc32_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_ppc32_la_LIBADD = libunwind-dwarf-generic.la + libunwind_ppc32_la_LIBADD += libunwind-elf32.la +if !REMOTE_ONLY + libunwind_ppc32_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += ppc/longjmp.S ppc/siglongjmp.S +else +if ARCH_PPC64 + lib_LTLIBRARIES += libunwind-ppc64.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_ppc64) + libunwind_ppc64_la_SOURCES = $(libunwind_ppc64_la_SOURCES_ppc64) + libunwind_ppc64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_ppc64_la_LIBADD = libunwind-dwarf-generic.la + libunwind_ppc64_la_LIBADD += libunwind-elf64.la +if !REMOTE_ONLY + libunwind_ppc64_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += ppc/longjmp.S ppc/siglongjmp.S + +endif # ARCH_PPC64 +endif # ARCH_PPC32 +endif # ARCH_X86_64 +endif # ARCH_X86 +endif # ARCH_MIPS +endif # ARCH_HPPA +endif # ARCH_IA64 +endif # ARCH_ARM + +# libunwind-setjmp depends on libunwind-$(arch). Therefore must be added +# at the end. +if !REMOTE_ONLY +lib_LTLIBRARIES += libunwind-setjmp.la +endif + +# +# Don't link with standard libraries, because those may mention +# libunwind already. +# +libunwind_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -XCClinker -nostdlib \ + $(LDFLAGS_STATIC_LIBCXA) -version-info $(SOVERSION) +libunwind_la_LIBADD += -lc $(LIBCRTS) + +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/tdep-$(arch) -I. +AM_CPPFLAGS+= -I../../../../../common/inc/ -I../../../../../sdk/trts/ +AM_CPPFLAGS+= -I../../../../../common/inc/internal +AM_CCASFLAGS = $(AM_CPPFLAGS) +noinst_HEADERS += unwind/unwind-internal.h + +EXTRA_DIST = $(libunwind_la_SOURCES_arm) \ + $(libunwind_la_SOURCES_hppa) \ + $(libunwind_la_SOURCES_ia64) \ + $(libunwind_la_SOURCES_mips) \ + $(libunwind_la_SOURCES_x86) \ + $(libunwind_la_SOURCES_os_freebsd) \ + $(libunwind_la_SOURCES_os_linux) \ + $(libunwind_la_SOURCES_os_hpux) \ + $(libunwind_la_SOURCES_common) \ + $(libunwind_la_SOURCES_local) \ + $(libunwind_la_SOURCES_generic) \ + $(libunwind_arm_la_SOURCES_arm) \ + $(libunwind_hppa_la_SOURCES_hppa) \ + $(libunwind_ia64_la_SOURCES_ia64) \ + $(libunwind_mips_la_SOURCES_mips) \ + $(libunwind_x86_la_SOURCES_x86) \ + $(libunwind_x86_64_la_SOURCES_x86_64) + +MAINTAINERCLEANFILES = Makefile.in + +# The -version-info flag accepts an argument of the form +# `current[:revision[:age]]'. So, passing `-version-info 3:12:1' sets +# current to 3, revision to 12, and age to 1. + +# If either revision or age are omitted, they default to 0. Also note +# that age must be less than or equal to the current interface number. + +# Here are a set of rules to help you update your library version +# information: + +# 1. Start with version information of `0:0:0' for each libtool +# library. + +# 2. Update the version information only immediately before a public +# release of your software. More frequent updates are unnecessary, +# and only guarantee that the current interface number gets larger +# faster. + +# 3. If the library source code has changed at all since the last +# update, then increment revision (`c:r:a' becomes `c:r+1:a'). + +# 4. If any interfaces have been added, removed, or changed since the +# last update, increment current, and set revision to 0. + +# 5. If any interfaces have been added since the last public release, +# then increment age. + +# 6. If any interfaces have been removed since the last public +# release, then set age to 0. diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/arm/Gcreate_addr_space.c new file mode 100644 index 0000000000..537464919a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gcreate_addr_space.c @@ -0,0 +1,62 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + /* + * ARM supports little-endian and big-endian. + */ + if (byte_order != 0 && byte_order != __LITTLE_ENDIAN + && byte_order != __BIG_ENDIAN) + { + free(as); + return NULL; + } + + /* Default to little-endian for ARM. */ + if (byte_order == 0 || byte_order == __LITTLE_ENDIAN) + as->big_endian = 0; + else + as->big_endian = 1; + + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gex_tables.c b/sdk/cpprt/linux/libunwind/src/arm/Gex_tables.c new file mode 100644 index 0000000000..d78fbaf482 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gex_tables.c @@ -0,0 +1,569 @@ +/* libunwind - a platform-independent unwind library + Copyright 2011 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* This file contains functionality for parsing and interpreting the ARM +specific unwind information. Documentation about the exception handling +ABI for the ARM architecture can be found at: +http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf +*/ + +#include "libunwind_i.h" + +#define ARM_EXBUF_START(x) (((x) >> 4) & 0x0f) +#define ARM_EXBUF_COUNT(x) ((x) & 0x0f) +#define ARM_EXBUF_END(x) (ARM_EXBUF_START(x) + ARM_EXBUF_COUNT(x)) + +#define ARM_EXIDX_CANT_UNWIND 0x00000001 +#define ARM_EXIDX_COMPACT 0x80000000 + +#define ARM_EXTBL_OP_FINISH 0xb0 + +enum arm_exbuf_cmd_flags { + ARM_EXIDX_VFP_SHIFT_16 = 1 << 16, + ARM_EXIDX_VFP_DOUBLE = 1 << 17, +}; + +struct arm_cb_data + { + /* in: */ + unw_word_t ip; /* instruction-pointer we're looking for */ + unw_proc_info_t *pi; /* proc-info pointer */ + /* out: */ + unw_dyn_info_t di; /* info about the ARM exidx segment */ + }; + +static inline uint32_t +prel31_read (uint32_t prel31) +{ + return ((int32_t)prel31 << 1) >> 1; +} + +static inline int +prel31_to_addr (unw_addr_space_t as, void *arg, unw_word_t prel31, + unw_word_t *val) +{ + unw_word_t offset; + + if ((*as->acc.access_mem)(as, prel31, &offset, 0, arg) < 0) + return -UNW_EINVAL; + + offset = ((long)offset << 1) >> 1; + *val = prel31 + offset; + + return 0; +} + +/** + * Applies the given command onto the new state to the given dwarf_cursor. + */ +HIDDEN int +arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c) +{ + int ret = 0; + unsigned i; + + switch (edata->cmd) + { + case ARM_EXIDX_CMD_FINISH: + /* Set LR to PC if not set already. */ + if (DWARF_IS_NULL_LOC (c->loc[UNW_ARM_R15])) + c->loc[UNW_ARM_R15] = c->loc[UNW_ARM_R14]; + /* Set IP. */ + dwarf_get (c, c->loc[UNW_ARM_R15], &c->ip); + break; + case ARM_EXIDX_CMD_DATA_PUSH: + Debug (2, "vsp = vsp - %d\n", edata->data); + c->cfa -= edata->data; + break; + case ARM_EXIDX_CMD_DATA_POP: + Debug (2, "vsp = vsp + %d\n", edata->data); + c->cfa += edata->data; + break; + case ARM_EXIDX_CMD_REG_POP: + for (i = 0; i < 16; i++) + if (edata->data & (1 << i)) + { + Debug (2, "pop {r%d}\n", i); + c->loc[UNW_ARM_R0 + i] = DWARF_LOC (c->cfa, 0); + c->cfa += 4; + } + /* Set cfa in case the SP got popped. */ + if (edata->data & (1 << 13)) + dwarf_get (c, c->loc[UNW_ARM_R13], &c->cfa); + break; + case ARM_EXIDX_CMD_REG_TO_SP: + assert (edata->data < 16); + Debug (2, "vsp = r%d\n", edata->data); + c->loc[UNW_ARM_R13] = c->loc[UNW_ARM_R0 + edata->data]; + dwarf_get (c, c->loc[UNW_ARM_R13], &c->cfa); + break; + case ARM_EXIDX_CMD_VFP_POP: + /* Skip VFP registers, but be sure to adjust stack */ + for (i = ARM_EXBUF_START (edata->data); i <= ARM_EXBUF_END (edata->data); + i++) + c->cfa += 8; + if (!(edata->data & ARM_EXIDX_VFP_DOUBLE)) + c->cfa += 4; + break; + case ARM_EXIDX_CMD_WREG_POP: + for (i = ARM_EXBUF_START (edata->data); i <= ARM_EXBUF_END (edata->data); + i++) + c->cfa += 8; + break; + case ARM_EXIDX_CMD_WCGR_POP: + for (i = 0; i < 4; i++) + if (edata->data & (1 << i)) + c->cfa += 4; + break; + case ARM_EXIDX_CMD_REFUSED: + case ARM_EXIDX_CMD_RESERVED: + ret = -1; + break; + } + return ret; +} + +/** + * Decodes the given unwind instructions into arm_exbuf_data and calls + * arm_exidx_apply_cmd that applies the command onto the dwarf_cursor. + */ +HIDDEN int +arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c) +{ +#define READ_OP() *buf++ + const uint8_t *end = buf + len; + int ret; + struct arm_exbuf_data edata; + + assert(buf != NULL); + assert(len > 0); + + while (buf < end) + { + uint8_t op = READ_OP (); + if ((op & 0xc0) == 0x00) + { + edata.cmd = ARM_EXIDX_CMD_DATA_POP; + edata.data = (((int)op & 0x3f) << 2) + 4; + } + else if ((op & 0xc0) == 0x40) + { + edata.cmd = ARM_EXIDX_CMD_DATA_PUSH; + edata.data = (((int)op & 0x3f) << 2) + 4; + } + else if ((op & 0xf0) == 0x80) + { + uint8_t op2 = READ_OP (); + if (op == 0x80 && op2 == 0x00) + edata.cmd = ARM_EXIDX_CMD_REFUSED; + else + { + edata.cmd = ARM_EXIDX_CMD_REG_POP; + edata.data = ((op & 0xf) << 8) | op2; + edata.data = edata.data << 4; + } + } + else if ((op & 0xf0) == 0x90) + { + if (op == 0x9d || op == 0x9f) + edata.cmd = ARM_EXIDX_CMD_RESERVED; + else + { + edata.cmd = ARM_EXIDX_CMD_REG_TO_SP; + edata.data = op & 0x0f; + } + } + else if ((op & 0xf0) == 0xa0) + { + unsigned end = (op & 0x07); + edata.data = (1 << (end + 1)) - 1; + edata.data = edata.data << 4; + if (op & 0x08) + edata.data |= 1 << 14; + edata.cmd = ARM_EXIDX_CMD_REG_POP; + } + else if (op == ARM_EXTBL_OP_FINISH) + { + edata.cmd = ARM_EXIDX_CMD_FINISH; + buf = end; + } + else if (op == 0xb1) + { + uint8_t op2 = READ_OP (); + if (op2 == 0 || (op2 & 0xf0)) + edata.cmd = ARM_EXIDX_CMD_RESERVED; + else + { + edata.cmd = ARM_EXIDX_CMD_REG_POP; + edata.data = op2 & 0x0f; + } + } + else if (op == 0xb2) + { + uint32_t offset = 0; + uint8_t byte, shift = 0; + do + { + byte = READ_OP (); + offset |= (byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + edata.data = offset * 4 + 0x204; + edata.cmd = ARM_EXIDX_CMD_DATA_POP; + } + else if (op == 0xb3 || op == 0xc8 || op == 0xc9) + { + edata.cmd = ARM_EXIDX_CMD_VFP_POP; + edata.data = READ_OP (); + if (op == 0xc8) + edata.data |= ARM_EXIDX_VFP_SHIFT_16; + if (op != 0xb3) + edata.data |= ARM_EXIDX_VFP_DOUBLE; + } + else if ((op & 0xf8) == 0xb8 || (op & 0xf8) == 0xd0) + { + edata.cmd = ARM_EXIDX_CMD_VFP_POP; + edata.data = 0x80 | (op & 0x07); + if ((op & 0xf8) == 0xd0) + edata.data |= ARM_EXIDX_VFP_DOUBLE; + } + else if (op >= 0xc0 && op <= 0xc5) + { + edata.cmd = ARM_EXIDX_CMD_WREG_POP; + edata.data = 0xa0 | (op & 0x07); + } + else if (op == 0xc6) + { + edata.cmd = ARM_EXIDX_CMD_WREG_POP; + edata.data = READ_OP (); + } + else if (op == 0xc7) + { + uint8_t op2 = READ_OP (); + if (op2 == 0 || (op2 & 0xf0)) + edata.cmd = ARM_EXIDX_CMD_RESERVED; + else + { + edata.cmd = ARM_EXIDX_CMD_WCGR_POP; + edata.data = op2 & 0x0f; + } + } + else + edata.cmd = ARM_EXIDX_CMD_RESERVED; + + ret = arm_exidx_apply_cmd (&edata, c); + if (ret < 0) + return ret; + } + return 0; +} + +/** + * Reads the entry from the given cursor and extracts the unwind instructions + * into buf. Returns the number of the extracted unwind insns or + * -UNW_ESTOPUNWIND if the special bit pattern ARM_EXIDX_CANT_UNWIND (0x1) was + * found. + */ +HIDDEN int +arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf) +{ + int nbuf = 0; + unw_word_t entry = (unw_word_t) c->pi.unwind_info; + unw_word_t addr; + uint32_t data; + + /* An ARM unwind entry consists of a prel31 offset to the start of a + function followed by 31bits of data: + * if set to 0x1: the function cannot be unwound (EXIDX_CANTUNWIND) + * if bit 31 is one: this is a table entry itself (ARM_EXIDX_COMPACT) + * if bit 31 is zero: this is a prel31 offset of the start of the + table entry for this function */ + if (prel31_to_addr(c->as, c->as_arg, entry, &addr) < 0) + return -UNW_EINVAL; + + if ((*c->as->acc.access_mem)(c->as, entry + 4, &data, 0, c->as_arg) < 0) + return -UNW_EINVAL; + + if (data == ARM_EXIDX_CANT_UNWIND) + { + Debug (2, "0x1 [can't unwind]\n"); + nbuf = -UNW_ESTOPUNWIND; + } + else if (data & ARM_EXIDX_COMPACT) + { + Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, + (data >> 24) & 0x7f, data); + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data; + } + else + { + unw_word_t extbl_data; + unsigned int n_table_words = 0; + + if (prel31_to_addr(c->as, c->as_arg, entry + 4, &extbl_data) < 0) + return -UNW_EINVAL; + + if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0, c->as_arg) < 0) + return -UNW_EINVAL; + + if (data & ARM_EXIDX_COMPACT) + { + int pers = (data >> 24) & 0x0f; + Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, pers, data); + if (pers == 1 || pers == 2) + { + n_table_words = (data >> 16) & 0xff; + extbl_data += 4; + } + else + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data; + } + else + { + unw_word_t pers; + if (prel31_to_addr (c->as, c->as_arg, extbl_data, &pers) < 0) + return -UNW_EINVAL; + Debug (2, "%p Personality routine: %8p\n", (void *)addr, + (void *)pers); + if ((*c->as->acc.access_mem)(c->as, extbl_data + 4, &data, 0, + c->as_arg) < 0) + return -UNW_EINVAL; + n_table_words = data >> 24; + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data; + extbl_data += 8; + } + assert (n_table_words <= 5); + unsigned j; + for (j = 0; j < n_table_words; j++) + { + if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0, + c->as_arg) < 0) + return -UNW_EINVAL; + extbl_data += 4; + buf[nbuf++] = data >> 24; + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data >> 0; + } + } + + if (nbuf > 0 && buf[nbuf - 1] != ARM_EXTBL_OP_FINISH) + buf[nbuf++] = ARM_EXTBL_OP_FINISH; + + return nbuf; +} + +PROTECTED int +tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX) + && di->format == UNW_INFO_FORMAT_ARM_EXIDX) + { + /* The .ARM.exidx section contains a sorted list of key-value pairs - + the unwind entries. The 'key' is a prel31 offset to the start of a + function. We binary search this section in order to find the + appropriate unwind entry. */ + unw_word_t first = di->u.rti.table_data; + unw_word_t last = di->u.rti.table_data + di->u.rti.table_len - 8; + unw_word_t entry, val; + + if (prel31_to_addr (as, arg, first, &val) < 0 || ip < val) + return -UNW_ENOINFO; + + if (prel31_to_addr (as, arg, last, &val) < 0) + return -UNW_EINVAL; + + if (ip >= val) + { + entry = last; + + if (prel31_to_addr (as, arg, last, &pi->start_ip) < 0) + return -UNW_EINVAL; + + pi->end_ip = di->end_ip -1; + } + else + { + while (first < last - 8) + { + entry = first + (((last - first) / 8 + 1) >> 1) * 8; + + if (prel31_to_addr (as, arg, entry, &val) < 0) + return -UNW_EINVAL; + + if (ip < val) + last = entry; + else + first = entry; + } + + entry = first; + + if (prel31_to_addr (as, arg, entry, &pi->start_ip) < 0) + return -UNW_EINVAL; + + if (prel31_to_addr (as, arg, entry + 8, &pi->end_ip) < 0) + return -UNW_EINVAL; + + pi->end_ip--; + } + + if (need_unwind_info) + { + pi->unwind_info_size = 8; + pi->unwind_info = (void *) entry; + pi->format = UNW_INFO_FORMAT_ARM_EXIDX; + } + return 0; + } + else if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) + && di->format != UNW_INFO_FORMAT_ARM_EXIDX) + return dwarf_search_unwind_table (as, ip, di, pi, need_unwind_info, arg); + + return -UNW_ENOINFO; +} + +#ifndef UNW_REMOTE_ONLY +/** + * Callback to dl_iterate_phdr to find infos about the ARM exidx segment. + */ +static int +arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data) +{ + struct arm_cb_data *cb_data = data; + const Elf_W(Phdr) *p_text = NULL; + const Elf_W(Phdr) *p_arm_exidx = NULL; + const Elf_W(Phdr) *phdr = info->dlpi_phdr; + long n; + + for (n = info->dlpi_phnum; --n >= 0; phdr++) + { + switch (phdr->p_type) + { + case PT_LOAD: + if (cb_data->ip >= phdr->p_vaddr + info->dlpi_addr && + cb_data->ip < phdr->p_vaddr + info->dlpi_addr + phdr->p_memsz) + p_text = phdr; + break; + + case PT_ARM_EXIDX: + p_arm_exidx = phdr; + break; + + default: + break; + } + } + + if (p_text && p_arm_exidx) + { + cb_data->di.format = UNW_INFO_FORMAT_ARM_EXIDX; + cb_data->di.start_ip = p_text->p_vaddr + info->dlpi_addr; + cb_data->di.end_ip = cb_data->di.start_ip + p_text->p_memsz; + cb_data->di.u.rti.name_ptr = (unw_word_t) info->dlpi_name; + cb_data->di.u.rti.table_data = p_arm_exidx->p_vaddr + info->dlpi_addr; + cb_data->di.u.rti.table_len = p_arm_exidx->p_memsz; + return 1; + } + + return 0; +} + +HIDDEN int +arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, void *arg) +{ + int ret = -1; + intrmask_t saved_mask; + + Debug (14, "looking for IP=0x%lx\n", (long) ip); + + if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) + { + struct dwarf_callback_data cb_data; + + memset (&cb_data, 0, sizeof (cb_data)); + cb_data.ip = ip; + cb_data.pi = pi; + cb_data.need_unwind_info = need_unwind_info; + cb_data.di.format = -1; + cb_data.di_debug.format = -1; + + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); + ret = dl_iterate_phdr (dwarf_callback, &cb_data); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); + + if (cb_data.single_fde) + /* already got the result in *pi */ + return 0; + + if (cb_data.di_debug.format != -1) + ret = tdep_search_unwind_table (as, ip, &cb_data.di_debug, pi, + need_unwind_info, arg); + else + ret = -UNW_ENOINFO; + } + + if (ret < 0 && UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX)) + { + struct arm_cb_data cb_data; + + memset (&cb_data, 0, sizeof (cb_data)); + cb_data.ip = ip; + cb_data.pi = pi; + cb_data.di.format = -1; + + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); + ret = dl_iterate_phdr (arm_phdr_cb, &cb_data); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); + + if (cb_data.di.format != -1) + ret = tdep_search_unwind_table (as, ip, &cb_data.di, pi, + need_unwind_info, arg); + else + ret = -UNW_ENOINFO; + } + + if (ret < 0) + Debug (14, "IP=0x%lx not found\n", (long) ip); + + return ret; +} + +HIDDEN void +arm_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} +#endif /* !UNW_REMOTE_ONLY */ + diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/arm/Gget_proc_info.c new file mode 100644 index 0000000000..acb78a4644 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gget_proc_info.c @@ -0,0 +1,41 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + /* We can only unwind using Dwarf into on ARM: return failure code + if it's not present. */ + ret = dwarf_make_proc_info (&c->dwarf); + if (ret < 0) + return ret; + + *pi = c->dwarf.pi; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/arm/Gget_save_loc.c new file mode 100644 index 0000000000..151ba0f9d2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gget_save_loc.c @@ -0,0 +1,81 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + loc = DWARF_NULL_LOC; /* default to "not saved" */ + + switch (reg) + { + case UNW_ARM_R0: + case UNW_ARM_R1: + case UNW_ARM_R2: + case UNW_ARM_R3: + case UNW_ARM_R4: + case UNW_ARM_R5: + case UNW_ARM_R6: + case UNW_ARM_R7: + case UNW_ARM_R8: + case UNW_ARM_R9: + case UNW_ARM_R10: + case UNW_ARM_R11: + case UNW_ARM_R12: + case UNW_ARM_R13: + case UNW_ARM_R14: + case UNW_ARM_R15: + loc = c->dwarf.loc[reg - UNW_ARM_R0]; + break; + + default: + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gglobal.c b/sdk/cpprt/linux/libunwind/src/arm/Gglobal.c new file mode 100644 index 0000000000..54dcd9d5fe --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gglobal.c @@ -0,0 +1,76 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN pthread_mutex_t arm_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +/* Unwinding methods to use. See UNW_METHOD_ enums */ +HIDDEN int unwi_unwind_method = UNW_ARM_METHOD_ALL; + +/* FIXME: I'm pretty sure we don't need this at all for ARM, but "generic" + code (include/dwarf_i.h) seems to expect it to be here at present. */ + +HIDDEN uint8_t dwarf_to_unw_regnum_map[16] = + { + /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 */ + UNW_ARM_R0, UNW_ARM_R1, UNW_ARM_R2, UNW_ARM_R3, UNW_ARM_R4, UNW_ARM_R5, + UNW_ARM_R6, UNW_ARM_R7, UNW_ARM_R8, UNW_ARM_R9, UNW_ARM_R10, UNW_ARM_R11, + UNW_ARM_R12, UNW_ARM_R13, UNW_ARM_R14, UNW_ARM_R15 + }; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + + lock_acquire (&arm_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + /* read ARM unwind method setting */ + const char* str = getenv ("UNW_ARM_UNWIND_METHOD"); + if (str) + { + unwi_unwind_method = atoi (str); + } + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + arm_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&arm_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Ginit.c b/sdk/cpprt/linux/libunwind/src/arm/Ginit.c new file mode 100644 index 0000000000..b6fabca6a1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Ginit.c @@ -0,0 +1,180 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +static inline void * +uc_addr (unw_tdep_context_t *uc, int reg) +{ + if (reg >= UNW_ARM_R0 && reg < UNW_ARM_R0 + 16) + return &uc->regs[reg - UNW_ARM_R0]; + else + return NULL; +} + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (unw_tdep_context_t *uc, int reg) +{ + return uc_addr (uc, reg); +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +/* XXX fix me: there is currently no way to locate the dyn-info list + by a remote unwinder. On ia64, this is done via a special + unwind-table entry. Perhaps something similar can be done with + DWARF2 unwind info. */ + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (16, "mem[%x] <- %x\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + *val = *(unw_word_t *) addr; + Debug (16, "mem[%x] -> %x\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + unw_tdep_context_t *uc = arg; + + if (unw_is_fpreg (reg)) + goto badreg; + +Debug (16, "reg = %s\n", unw_regname (reg)); + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- %x\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %x\n", unw_regname (reg), *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + unw_tdep_context_t *uc = arg; + unw_fpreg_t *addr; + + if (!unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +arm_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = arm_find_proc_info; + local_addr_space.acc.put_unwind_info = arm_put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = arm_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/arm/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/arm/Ginit_local.c new file mode 100644 index 0000000000..87d07a3728 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Ginit_local.c @@ -0,0 +1,55 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright 2011 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = uc; + + return common_init (c, 1); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/arm/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/arm/Ginit_remote.c new file mode 100644 index 0000000000..854f3b62f0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Ginit_remote.c @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/arm/Gis_signal_frame.c new file mode 100644 index 0000000000..e2e8cd673a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gis_signal_frame.c @@ -0,0 +1,84 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright 2011 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include "unwind_i.h" + +#ifdef __linux__ +#define ARM_NR_sigreturn 119 +#define ARM_NR_rt_sigreturn 173 +#define ARM_NR_OABI_SYSCALL_BASE 0x900000 + +/* ARM EABI sigreturn (the syscall number is loaded into r7) */ +#define MOV_R7_SIGRETURN (0xe3a07000UL | ARM_NR_sigreturn) +#define MOV_R7_RT_SIGRETURN (0xe3a07000UL | ARM_NR_rt_sigreturn) + +/* ARM OABI sigreturn (using SWI) */ +#define ARM_SIGRETURN \ + (0xef000000UL | ARM_NR_sigreturn | ARM_NR_OABI_SYSCALL_BASE) +#define ARM_RT_SIGRETURN \ + (0xef000000UL | ARM_NR_rt_sigreturn | ARM_NR_OABI_SYSCALL_BASE) + +/* Thumb sigreturn (two insns, syscall number is loaded into r7) */ +#define THUMB_SIGRETURN (0xdf00UL << 16 | 0x2700 | ARM_NR_sigreturn) +#define THUMB_RT_SIGRETURN (0xdf00UL << 16 | 0x2700 | ARM_NR_rt_sigreturn) +#endif /* __linux__ */ + +/* Returns 1 in case of a non-RT signal frame and 2 in case of a RT signal + frame. */ +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ +#ifdef __linux__ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors (as); + arg = c->dwarf.as_arg; + + ip = c->dwarf.ip; + + if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0) + return ret; + + /* Return 1 if the IP points to a non-RT sigreturn sequence. */ + if (w0 == MOV_R7_SIGRETURN || w0 == ARM_SIGRETURN || w0 == THUMB_SIGRETURN) + return 1; + /* Return 2 if the IP points to a RT sigreturn sequence. */ + else if (w0 == MOV_R7_RT_SIGRETURN || w0 == ARM_RT_SIGRETURN + || w0 == THUMB_RT_SIGRETURN) + return 2; + + return 0; +#else + printf ("%s: implement me\n", __FUNCTION__); + return -UNW_ENOINFO; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gregs.c b/sdk/cpprt/linux/libunwind/src/arm/Gregs.c new file mode 100644 index 0000000000..03693a27c8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gregs.c @@ -0,0 +1,81 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + + switch (reg) + { + case UNW_ARM_R0: + case UNW_ARM_R1: + case UNW_ARM_R2: + case UNW_ARM_R3: + case UNW_ARM_R4: + case UNW_ARM_R5: + case UNW_ARM_R6: + case UNW_ARM_R7: + case UNW_ARM_R8: + case UNW_ARM_R9: + case UNW_ARM_R10: + case UNW_ARM_R11: + case UNW_ARM_R12: + case UNW_ARM_R14: + case UNW_ARM_R15: + loc = c->dwarf.loc[reg - UNW_ARM_R0]; + break; + + case UNW_ARM_R13: + case UNW_ARM_CFA: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + /* FIXME: Initialise coprocessor & shadow registers? */ + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +/* FIXME for ARM. */ + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gresume.c b/sdk/cpprt/linux/libunwind/src/arm/Gresume.c new file mode 100644 index 0000000000..da45dec820 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gresume.c @@ -0,0 +1,147 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright 2011 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +#ifndef UNW_REMOTE_ONLY + +HIDDEN inline int +arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ +#ifdef __linux__ + struct cursor *c = (struct cursor *) cursor; + unw_tdep_context_t *uc = c->dwarf.as_arg; + + if (c->sigcontext_format == ARM_SCF_NONE) + { + /* Since there are no signals involved here we restore the non scratch + registers only. */ + unsigned long regs[10]; + regs[0] = uc->regs[4]; + regs[1] = uc->regs[5]; + regs[2] = uc->regs[6]; + regs[3] = uc->regs[7]; + regs[4] = uc->regs[8]; + regs[5] = uc->regs[9]; + regs[6] = uc->regs[10]; + regs[7] = uc->regs[11]; /* FP */ + regs[8] = uc->regs[13]; /* SP */ + regs[9] = uc->regs[14]; /* LR */ + + asm __volatile__ ( + "ldmia %0, {r4-r12, lr}\n" + "mov sp, r12\n" + "bx lr\n" + : : "r" (regs) + ); + } + else + { + /* In case a signal frame is involved, we're using its trampoline which + calls sigreturn. */ + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + sc->arm_r0 = uc->regs[0]; + sc->arm_r1 = uc->regs[1]; + sc->arm_r2 = uc->regs[2]; + sc->arm_r3 = uc->regs[3]; + sc->arm_r4 = uc->regs[4]; + sc->arm_r5 = uc->regs[5]; + sc->arm_r6 = uc->regs[6]; + sc->arm_r7 = uc->regs[7]; + sc->arm_r8 = uc->regs[8]; + sc->arm_r9 = uc->regs[9]; + sc->arm_r10 = uc->regs[10]; + sc->arm_fp = uc->regs[11]; /* FP */ + sc->arm_ip = uc->regs[12]; /* IP */ + sc->arm_sp = uc->regs[13]; /* SP */ + sc->arm_lr = uc->regs[14]; /* LR */ + sc->arm_pc = uc->regs[15]; /* PC */ + /* clear the ITSTATE bits. */ + sc->arm_cpsr &= 0xf9ff03ffUL; + + /* Set the SP and the PC in order to continue execution at the modified + trampoline which restores the signal mask and the registers. */ + asm __volatile__ ( + "mov sp, %0\n" + "bx %1\n" + : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc) + ); + } +#else + printf ("%s: implement me\n", __FUNCTION__); +#endif + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +static inline void +establish_machine_state (struct cursor *c) +{ + unw_addr_space_t as = c->dwarf.as; + void *arg = c->dwarf.as_arg; + unw_fpreg_t fpval; + unw_word_t val; + int reg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_REG_LAST; ++reg) + { + Debug (16, "copying %s %d\n", unw_regname (reg), reg); + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + as->acc.access_fpreg (as, reg, &fpval, 1, arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + as->acc.access_reg (as, reg, &val, 1, arg); + } + } +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + + Debug (1, "(cursor=%p)\n", c); + + if (!c->dwarf.ip) + { + /* This can happen easily when the frame-chain gets truncated + due to bad or missing unwind-info. */ + Debug (1, "refusing to resume execution at address 0\n"); + return -UNW_EINVAL; + } + + establish_machine_state (c); + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Gstep.c b/sdk/cpprt/linux/libunwind/src/arm/Gstep.c new file mode 100644 index 0000000000..3b7bdbe8d5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Gstep.c @@ -0,0 +1,264 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright 2011 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" +#include "ex_tables.h" + +#include + +#define arm_exidx_step UNW_OBJ(arm_exidx_step) + +static inline int +arm_exidx_step (struct cursor *c) +{ + unw_word_t old_ip, old_cfa; + uint8_t buf[32]; + int ret; + + old_ip = c->dwarf.ip; + old_cfa = c->dwarf.cfa; + + /* mark PC unsaved */ + c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC; + + if ((ret = tdep_find_proc_info (&c->dwarf, c->dwarf.ip, 1)) < 0) + return ret; + + if (c->dwarf.pi.format != UNW_INFO_FORMAT_ARM_EXIDX) + return -UNW_ENOINFO; + + ret = arm_exidx_extract (&c->dwarf, buf); + if (ret == -UNW_ESTOPUNWIND) + return 0; + else if (ret < 0) + return ret; + + ret = arm_exidx_decode (buf, ret, &c->dwarf); + if (ret < 0) + return ret; + + if (c->dwarf.ip == old_ip && c->dwarf.cfa == old_cfa) + { + Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n", + __FUNCTION__, (long) c->dwarf.ip); + return -UNW_EBADFRAME; + } + + return (c->dwarf.ip == 0) ? 0 : 1; +} + +PROTECTED int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa; + struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0); + + if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0) + return -UNW_EUNSPEC; + + /* Obtain signal frame type (non-RT or RT). */ + ret = unw_is_signal_frame (cursor); + + /* Save the SP and PC to be able to return execution at this point + later in time (unw_resume). */ + c->sigcontext_sp = c->dwarf.cfa; + c->sigcontext_pc = c->dwarf.ip; + + /* Since kernel version 2.6.18 the non-RT signal frame starts with a + ucontext while the RT signal frame starts with a siginfo, followed + by a sigframe whose first element is an ucontext. + Prior 2.6.18 the non-RT signal frame starts with a sigcontext while + the RT signal frame starts with two pointers followed by a siginfo + and an ucontext. The first pointer points to the start of the siginfo + structure and the second one to the ucontext structure. */ + + if (ret == 1) + { + /* Handle non-RT signal frames. Check if the first word on the stack + is the magic number. */ + if (sp == 0x5ac3c35a) + { + c->sigcontext_format = ARM_SCF_LINUX_SIGFRAME; + sc_addr = sp_addr + LINUX_UC_MCONTEXT_OFF; + } + else + { + c->sigcontext_format = ARM_SCF_LINUX_OLD_SIGFRAME; + sc_addr = sp_addr; + } + c->sigcontext_addr = sp_addr; + } + else if (ret == 2) + { + /* Handle RT signal frames. Check if the first word on the stack is a + pointer to the siginfo structure. */ + if (sp == sp_addr + 8) + { + c->sigcontext_format = ARM_SCF_LINUX_OLD_RT_SIGFRAME; + c->sigcontext_addr = sp_addr + 8 + sizeof (siginfo_t); + } + else + { + c->sigcontext_format = ARM_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = sp_addr + sizeof (siginfo_t); + } + sc_addr = c->sigcontext_addr + LINUX_UC_MCONTEXT_OFF; + } + else + return -UNW_EUNSPEC; + + /* Update the dwarf cursor. + Set the location of the registers to the corresponding addresses of the + uc_mcontext / sigcontext structure contents. */ + c->dwarf.loc[UNW_ARM_R0] = DWARF_LOC (sc_addr + LINUX_SC_R0_OFF, 0); + c->dwarf.loc[UNW_ARM_R1] = DWARF_LOC (sc_addr + LINUX_SC_R1_OFF, 0); + c->dwarf.loc[UNW_ARM_R2] = DWARF_LOC (sc_addr + LINUX_SC_R2_OFF, 0); + c->dwarf.loc[UNW_ARM_R3] = DWARF_LOC (sc_addr + LINUX_SC_R3_OFF, 0); + c->dwarf.loc[UNW_ARM_R4] = DWARF_LOC (sc_addr + LINUX_SC_R4_OFF, 0); + c->dwarf.loc[UNW_ARM_R5] = DWARF_LOC (sc_addr + LINUX_SC_R5_OFF, 0); + c->dwarf.loc[UNW_ARM_R6] = DWARF_LOC (sc_addr + LINUX_SC_R6_OFF, 0); + c->dwarf.loc[UNW_ARM_R7] = DWARF_LOC (sc_addr + LINUX_SC_R7_OFF, 0); + c->dwarf.loc[UNW_ARM_R8] = DWARF_LOC (sc_addr + LINUX_SC_R8_OFF, 0); + c->dwarf.loc[UNW_ARM_R9] = DWARF_LOC (sc_addr + LINUX_SC_R9_OFF, 0); + c->dwarf.loc[UNW_ARM_R10] = DWARF_LOC (sc_addr + LINUX_SC_R10_OFF, 0); + c->dwarf.loc[UNW_ARM_R11] = DWARF_LOC (sc_addr + LINUX_SC_FP_OFF, 0); + c->dwarf.loc[UNW_ARM_R12] = DWARF_LOC (sc_addr + LINUX_SC_IP_OFF, 0); + c->dwarf.loc[UNW_ARM_R13] = DWARF_LOC (sc_addr + LINUX_SC_SP_OFF, 0); + c->dwarf.loc[UNW_ARM_R14] = DWARF_LOC (sc_addr + LINUX_SC_LR_OFF, 0); + c->dwarf.loc[UNW_ARM_R15] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0); + + /* Set SP/CFA and PC/IP. */ + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R13], &c->dwarf.cfa); + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R15], &c->dwarf.ip); + + return 1; +} + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret = -UNW_EUNSPEC; + + Debug (1, "(cursor=%p)\n", c); + + /* Check if this is a signal frame. */ + if (unw_is_signal_frame (cursor)) + return unw_handle_signal_frame (cursor); + +#ifdef CONFIG_DEBUG_FRAME + /* First, try DWARF-based unwinding. */ + if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF)) + { + ret = dwarf_step (&c->dwarf); + Debug(1, "dwarf_step()=%d\n", ret); + + if (likely (ret > 0)) + return 1; + else if (unlikely (ret == -UNW_ESTOPUNWIND)) + return ret; + + if (ret < 0 && ret != -UNW_ENOINFO) + { + Debug (2, "returning %d\n", ret); + return ret; + } + } +#endif /* CONFIG_DEBUG_FRAME */ + + /* Next, try extbl-based unwinding. */ + if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX)) + { + ret = arm_exidx_step (c); + if (ret > 0) + return 1; + if (ret == -UNW_ESTOPUNWIND || ret == 0) + return ret; + } + + /* Fall back on APCS frame parsing. + Note: This won't work in case the ARM EABI is used. */ + if (unlikely (ret < 0)) + { + if (UNW_TRY_METHOD(UNW_ARM_METHOD_FRAME)) + { + ret = UNW_ESUCCESS; + /* DWARF unwinding failed, try to follow APCS/optimized APCS frame chain */ + unw_word_t instr, i; + Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret); + dwarf_loc_t ip_loc, fp_loc; + unw_word_t frame; + /* Mark all registers unsaved, since we don't know where + they are saved (if at all), except for the EBP and + EIP. */ + if (dwarf_get(&c->dwarf, c->dwarf.loc[UNW_ARM_R11], &frame) < 0) + { + return 0; + } + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) { + c->dwarf.loc[i] = DWARF_NULL_LOC; + } + if (frame) + { + if (dwarf_get(&c->dwarf, DWARF_LOC(frame, 0), &instr) < 0) + { + return 0; + } + instr -= 8; + if (dwarf_get(&c->dwarf, DWARF_LOC(instr, 0), &instr) < 0) + { + return 0; + } + if ((instr & 0xFFFFD800) == 0xE92DD800) + { + /* Standard APCS frame. */ + ip_loc = DWARF_LOC(frame - 4, 0); + fp_loc = DWARF_LOC(frame - 12, 0); + } + else + { + /* Codesourcery optimized normal frame. */ + ip_loc = DWARF_LOC(frame, 0); + fp_loc = DWARF_LOC(frame - 4, 0); + } + if (dwarf_get(&c->dwarf, ip_loc, &c->dwarf.ip) < 0) + { + return 0; + } + c->dwarf.loc[UNW_ARM_R12] = ip_loc; + c->dwarf.loc[UNW_ARM_R11] = fp_loc; + Debug(15, "ip=%lx\n", c->dwarf.ip); + } + else + { + ret = -UNW_ENOINFO; + } + } + } + return ret == -UNW_ENOINFO ? 0 : 1; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/arm/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lex_tables.c b/sdk/cpprt/linux/libunwind/src/arm/Lex_tables.c new file mode 100644 index 0000000000..4a4f925c9c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lex_tables.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gex_tables.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/arm/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/arm/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lglobal.c b/sdk/cpprt/linux/libunwind/src/arm/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Linit.c b/sdk/cpprt/linux/libunwind/src/arm/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Linit_local.c b/sdk/cpprt/linux/libunwind/src/arm/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/arm/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/arm/Lis_signal_frame.c new file mode 100644 index 0000000000..b9a7c4f51a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lregs.c b/sdk/cpprt/linux/libunwind/src/arm/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lresume.c b/sdk/cpprt/linux/libunwind/src/arm/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/Lstep.c b/sdk/cpprt/linux/libunwind/src/arm/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/gen-offsets.c b/sdk/cpprt/linux/libunwind/src/arm/gen-offsets.c new file mode 100644 index 0000000000..7d6bf2f1c5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/gen-offsets.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include + +#define UC(N,X) \ + printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X)) + +#define SC(N,X) \ + printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X)) + +int +main (void) +{ + printf ( +"/* Linux-specific definitions: */\n\n" + +"/* Define various structure offsets to simplify cross-compilation. */\n\n" + +"/* Offsets for ARM Linux \"ucontext_t\": */\n\n"); + + UC ("FLAGS", uc_flags); + UC ("LINK", uc_link); + UC ("STACK", uc_stack); + UC ("MCONTEXT", uc_mcontext); + UC ("SIGMASK", uc_sigmask); + UC ("REGSPACE", uc_regspace); + + printf ("\n/* Offsets for ARM Linux \"struct sigcontext\": */\n\n"); + + SC ("TRAPNO", trap_no); + SC ("ERRORCODE", error_code); + SC ("OLDMASK", oldmask); + SC ("R0", arm_r0); + SC ("R1", arm_r1); + SC ("R2", arm_r2); + SC ("R3", arm_r3); + SC ("R4", arm_r4); + SC ("R5", arm_r5); + SC ("R6", arm_r6); + SC ("R7", arm_r7); + SC ("R8", arm_r8); + SC ("R9", arm_r9); + SC ("R10", arm_r10); + SC ("FP", arm_fp); + SC ("IP", arm_ip); + SC ("SP", arm_sp); + SC ("LR", arm_lr); + SC ("PC", arm_pc); + SC ("CPSR", arm_cpsr); + SC ("FAULTADDR", fault_address); + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/getcontext.S b/sdk/cpprt/linux/libunwind/src/arm/getcontext.S new file mode 100644 index 0000000000..c52992bfb9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/getcontext.S @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" + + .text + .arm + + .global _Uarm_getcontext + .type _Uarm_getcontext, %function + @ This is a stub version of getcontext() for ARM which only stores core + @ registers. It must be called in a special way, not as a regular + @ function -- see also the libunwind-arm.h:unw_tdep_getcontext macro. +_Uarm_getcontext: + stmfd sp!, {r0, r1} + @ store r0 + str r0, [r0, #LINUX_UC_MCONTEXT_OFF + LINUX_SC_R0_OFF] + add r0, r0, #LINUX_UC_MCONTEXT_OFF + LINUX_SC_R0_OFF + @ store r1 to r12 + stmib r0, {r1-r12} + @ reconstruct r13 at call site, then store + add r1, sp, #12 + str r1, [r0, #13 * 4] + @ retrieve r14 from call site, then store + ldr r1, [sp, #8] + str r1, [r0, #14 * 4] + @ point lr to instruction after call site's stack adjustment + add r1, lr, #4 + str r1, [r0, #15 * 4] + ldmfd sp!, {r0, r1} + bx lr +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/init.h b/sdk/cpprt/linux/libunwind/src/arm/init.h new file mode 100644 index 0000000000..676c34072d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/init.h @@ -0,0 +1,78 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret, i; + + c->dwarf.loc[UNW_ARM_R0] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R0); + c->dwarf.loc[UNW_ARM_R1] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R1); + c->dwarf.loc[UNW_ARM_R2] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R2); + c->dwarf.loc[UNW_ARM_R3] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R3); + c->dwarf.loc[UNW_ARM_R4] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R4); + c->dwarf.loc[UNW_ARM_R5] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R5); + c->dwarf.loc[UNW_ARM_R6] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R6); + c->dwarf.loc[UNW_ARM_R7] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R7); + c->dwarf.loc[UNW_ARM_R8] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R8); + c->dwarf.loc[UNW_ARM_R9] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R9); + c->dwarf.loc[UNW_ARM_R10] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R10); + c->dwarf.loc[UNW_ARM_R11] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R11); + c->dwarf.loc[UNW_ARM_R12] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R12); + c->dwarf.loc[UNW_ARM_R13] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R13); + c->dwarf.loc[UNW_ARM_R14] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R14); + c->dwarf.loc[UNW_ARM_R15] = DWARF_REG_LOC (&c->dwarf, UNW_ARM_R15); + for (i = UNW_ARM_R15 + 1; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_ARM_R15], &c->dwarf.ip); + if (ret < 0) + return ret; + + /* FIXME: correct for ARM? */ + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_ARM_R13), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + c->sigcontext_format = ARM_SCF_NONE; + c->sigcontext_addr = 0; + c->sigcontext_sp = 0; + c->sigcontext_pc = 0; + + /* FIXME: Initialisation for other registers. */ + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/is_fpreg.c b/sdk/cpprt/linux/libunwind/src/arm/is_fpreg.c new file mode 100644 index 0000000000..d8b17ae781 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/is_fpreg.c @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +/* FIXME: I'm not sure if libunwind's GP/FP register distinction is very useful + on ARM. Count all the FP or coprocessor registers we know about for now. */ + +PROTECTED int +unw_is_fpreg (int regnum) +{ + return ((regnum >= UNW_ARM_S0 && regnum <= UNW_ARM_S31) + || (regnum >= UNW_ARM_F0 && regnum <= UNW_ARM_F7) + || (regnum >= UNW_ARM_wCGR0 && regnum <= UNW_ARM_wCGR7) + || (regnum >= UNW_ARM_wR0 && regnum <= UNW_ARM_wR15) + || (regnum >= UNW_ARM_wC0 && regnum <= UNW_ARM_wC7) + || (regnum >= UNW_ARM_D0 && regnum <= UNW_ARM_D31)); +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/offsets.h b/sdk/cpprt/linux/libunwind/src/arm/offsets.h new file mode 100644 index 0000000000..0593685ce3 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/offsets.h @@ -0,0 +1,36 @@ +/* Linux-specific definitions: */ + +/* Define various structure offsets to simplify cross-compilation. */ + +/* Offsets for ARM Linux "ucontext_t": */ + +#define LINUX_UC_FLAGS_OFF 0x00 +#define LINUX_UC_LINK_OFF 0x04 +#define LINUX_UC_STACK_OFF 0x08 +#define LINUX_UC_MCONTEXT_OFF 0x14 +#define LINUX_UC_SIGMASK_OFF 0x68 +#define LINUX_UC_REGSPACE_OFF 0xE8 + +/* Offsets for ARM Linux "struct sigcontext": */ + +#define LINUX_SC_TRAPNO_OFF 0x00 +#define LINUX_SC_ERRORCODE_OFF 0x04 +#define LINUX_SC_OLDMASK_OFF 0x08 +#define LINUX_SC_R0_OFF 0x0C +#define LINUX_SC_R1_OFF 0x10 +#define LINUX_SC_R2_OFF 0x14 +#define LINUX_SC_R3_OFF 0x18 +#define LINUX_SC_R4_OFF 0x1C +#define LINUX_SC_R5_OFF 0x20 +#define LINUX_SC_R6_OFF 0x24 +#define LINUX_SC_R7_OFF 0x28 +#define LINUX_SC_R8_OFF 0x2C +#define LINUX_SC_R9_OFF 0x30 +#define LINUX_SC_R10_OFF 0x34 +#define LINUX_SC_FP_OFF 0x38 +#define LINUX_SC_IP_OFF 0x3C +#define LINUX_SC_SP_OFF 0x40 +#define LINUX_SC_LR_OFF 0x44 +#define LINUX_SC_PC_OFF 0x48 +#define LINUX_SC_CPSR_OFF 0x4C +#define LINUX_SC_FAULTADDR_OFF 0x50 diff --git a/sdk/cpprt/linux/libunwind/src/arm/regname.c b/sdk/cpprt/linux/libunwind/src/arm/regname.c new file mode 100644 index 0000000000..474337a568 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/regname.c @@ -0,0 +1,90 @@ +#include "unwind_i.h" + +static const char *regname[] = + { + /* 0. */ + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + /* 8. */ + "r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc", + /* 16. Obsolete FPA names. */ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + /* 24. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 32. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 40. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 48. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 56. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 64. */ + "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", + /* 72. */ + "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", + /* 80. */ + "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", + /* 88. */ + "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", + /* 96. */ + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + /* 104. */ + "wCGR0", "wCGR1", "wCGR2", "wCGR3", "wCGR4", "wCGR5", "wCGR6", "wCGR7", + /* 112. */ + "wR0", "wR1", "wR2", "wR3", "wR4", "wR5", "wR6", "wR7", + /* 128. */ + "spsr", "spsr_fiq", "spsr_irq", "spsr_abt", "spsr_und", "spsr_svc", 0, 0, + /* 136. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 144. */ + "r8_usr", "r9_usr", "r10_usr", "r11_usr", "r12_usr", "r13_usr", "r14_usr", + /* 151. */ + "r8_fiq", "r9_fiq", "r10_fiq", "r11_fiq", "r12_fiq", "r13_fiq", "r14_fiq", + /* 158. */ + "r13_irq", "r14_irq", + /* 160. */ + "r13_abt", "r14_abt", + /* 162. */ + "r13_und", "r14_und", + /* 164. */ + "r13_svc", "r14_svc", 0, 0, + /* 168. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 176. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 184. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 192. */ + "wC0", "wC1", "wC2", "wC3", "wC4", "wC5", "wC6", "wC7", + /* 200. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 208. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 216. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 224. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 232. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 240. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 248. */ + 0, 0, 0, 0, 0, 0, 0, 0, + /* 256. */ + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", + /* 264. */ + "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", + /* 272. */ + "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23", + /* 280. */ + "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31", + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/arm/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/arm/siglongjmp.S new file mode 100644 index 0000000000..4df0736683 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/siglongjmp.S @@ -0,0 +1,12 @@ + /* Dummy implementation for now. */ + + .globl _UI_siglongjmp_cont + .globl _UI_longjmp_cont + +_UI_siglongjmp_cont: +_UI_longjmp_cont: + bx lr +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/arm/unwind_i.h b/sdk/cpprt/linux/libunwind/src/arm/unwind_i.h new file mode 100644 index 0000000000..61ab54521c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/arm/unwind_i.h @@ -0,0 +1,43 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include "libunwind_i.h" + +#define arm_lock UNW_OBJ(lock) +#define arm_local_resume UNW_OBJ(local_resume) +#define arm_local_addr_space_init UNW_OBJ(local_addr_space_init) + +extern void arm_local_addr_space_init (void); +extern int arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/coredump/README b/sdk/cpprt/linux/libunwind/src/coredump/README new file mode 100644 index 0000000000..204493c93e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/README @@ -0,0 +1,8 @@ +This code is based on "unwinding via ptrace" code from ptrace/ +directory. + +Files with names starting with _UCD_ are substantially changed +from their ptrace/_UPT_... progenitors. + +Files which still have _UPT_... names are either verbiatim copies +from ptrace/, or unimplemented stubs. diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_mem.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_mem.c new file mode 100644 index 0000000000..a58e5599bb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_mem.c @@ -0,0 +1,102 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +int +_UCD_access_mem(unw_addr_space_t as, unw_word_t addr, unw_word_t *val, + int write, void *arg) +{ + if (write) + { + Debug(0, "%s: write is not supported\n", __func__); + return -UNW_EINVAL; + } + + struct UCD_info *ui = arg; + + unw_word_t addr_last = addr + sizeof(*val)-1; + coredump_phdr_t *phdr; + unsigned i; + for (i = 0; i < ui->phdrs_count; i++) + { + phdr = &ui->phdrs[i]; + if (phdr->p_vaddr <= addr && addr_last < phdr->p_vaddr + phdr->p_memsz) + { + goto found; + } + } + Debug(1, "%s: addr 0x%llx is unmapped\n", + __func__, (unsigned long long)addr + ); + return -UNW_EINVAL; + + found: ; + + const char *filename; + off_t fileofs; + int fd; + if (addr_last >= phdr->p_vaddr + phdr->p_filesz) + { + /* This part of mapped address space is not present in coredump file */ + /* Do we have it in the backup file? */ + if (phdr->backing_fd < 0) + { + Debug(1, "%s: access to not-present data in phdr[%d]: addr:0x%llx\n", + __func__, i, (unsigned long long)addr + ); + return -UNW_EINVAL; + } + filename = phdr->backing_filename; + fileofs = addr - phdr->p_vaddr; + fd = phdr->backing_fd; + goto read; + } + + filename = ui->coredump_filename; + fileofs = phdr->p_offset + (addr - phdr->p_vaddr); + fd = ui->coredump_fd; + read: + if (lseek(fd, fileofs, SEEK_SET) != fileofs) + goto read_error; + if (read(fd, val, sizeof(*val)) != sizeof(*val)) + goto read_error; + + Debug(1, "%s: 0x%llx <- [addr:0x%llx fileofs:0x%llx]\n", + __func__, + (unsigned long long)(*val), + (unsigned long long)addr, + (unsigned long long)fileofs + ); + return 0; + + read_error: + Debug(1, "%s: access out of file: addr:0x%llx fileofs:%llx file:'%s'\n", + __func__, + (unsigned long long)addr, + (unsigned long long)fileofs, + filename + ); + return -UNW_EINVAL; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_freebsd.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_freebsd.c new file mode 100644 index 0000000000..d5b4e74f7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_freebsd.c @@ -0,0 +1,118 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" + +#include "_UCD_internal.h" + +int +_UCD_access_reg (unw_addr_space_t as, + unw_regnum_t regnum, unw_word_t *valp, + int write, void *arg) +{ + if (write) + { + Debug(0, "%s: write is not supported\n", __func__); + return -UNW_EINVAL; + } + + struct UCD_info *ui = arg; + +#if defined(UNW_TARGET_X86) + switch (regnum) { + case UNW_X86_EAX: + *valp = ui->prstatus->pr_reg.r_eax; + break; + case UNW_X86_EDX: + *valp = ui->prstatus->pr_reg.r_edx; + break; + case UNW_X86_ECX: + *valp = ui->prstatus->pr_reg.r_ecx; + break; + case UNW_X86_EBX: + *valp = ui->prstatus->pr_reg.r_ebx; + break; + case UNW_X86_ESI: + *valp = ui->prstatus->pr_reg.r_esi; + break; + case UNW_X86_EDI: + *valp = ui->prstatus->pr_reg.r_edi; + break; + case UNW_X86_EBP: + *valp = ui->prstatus->pr_reg.r_ebp; + break; + case UNW_X86_ESP: + *valp = ui->prstatus->pr_reg.r_esp; + break; + case UNW_X86_EIP: + *valp = ui->prstatus->pr_reg.r_eip; + break; + case UNW_X86_EFLAGS: + *valp = ui->prstatus->pr_reg.r_eflags; + break; + case UNW_X86_TRAPNO: + *valp = ui->prstatus->pr_reg.r_trapno; + break; + default: + Debug(0, "%s: bad regnum:%d\n", __func__, regnum); + return -UNW_EINVAL; + }; +#elif defined(UNW_TARGET_X86_64) + switch (regnum) { + case UNW_X86_64_RAX: + *valp = ui->prstatus->pr_reg.r_rax; + break; + case UNW_X86_64_RDX: + *valp = ui->prstatus->pr_reg.r_rdx; + break; + case UNW_X86_64_RCX: + *valp = ui->prstatus->pr_reg.r_rcx; + break; + case UNW_X86_64_RBX: + *valp = ui->prstatus->pr_reg.r_rbx; + break; + case UNW_X86_64_RSI: + *valp = ui->prstatus->pr_reg.r_rsi; + break; + case UNW_X86_64_RDI: + *valp = ui->prstatus->pr_reg.r_rdi; + break; + case UNW_X86_64_RBP: + *valp = ui->prstatus->pr_reg.r_rbp; + break; + case UNW_X86_64_RSP: + *valp = ui->prstatus->pr_reg.r_rsp; + break; + case UNW_X86_64_RIP: + *valp = ui->prstatus->pr_reg.r_rip; + break; + default: + Debug(0, "%s: bad regnum:%d\n", __func__, regnum); + return -UNW_EINVAL; + }; +#else +#error Port me +#endif + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_linux.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_linux.c new file mode 100644 index 0000000000..72b6e2299d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_access_reg_linux.c @@ -0,0 +1,90 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" + +#include "_UCD_internal.h" + +int +_UCD_access_reg (unw_addr_space_t as, + unw_regnum_t regnum, unw_word_t *valp, + int write, void *arg) +{ + if (write) + { + Debug(0, "%s: write is not supported\n", __func__); + return -UNW_EINVAL; + } + +#if defined(UNW_TARGET_X86) + static const uint8_t remap_regs[] = + { + /* names from libunwind-x86.h */ + [UNW_X86_EAX] = offsetof(struct user_regs_struct, eax) / sizeof(long), + [UNW_X86_EDX] = offsetof(struct user_regs_struct, edx) / sizeof(long), + [UNW_X86_ECX] = offsetof(struct user_regs_struct, ecx) / sizeof(long), + [UNW_X86_EBX] = offsetof(struct user_regs_struct, ebx) / sizeof(long), + [UNW_X86_ESI] = offsetof(struct user_regs_struct, esi) / sizeof(long), + [UNW_X86_EDI] = offsetof(struct user_regs_struct, edi) / sizeof(long), + [UNW_X86_EBP] = offsetof(struct user_regs_struct, ebp) / sizeof(long), + [UNW_X86_ESP] = offsetof(struct user_regs_struct, esp) / sizeof(long), + [UNW_X86_EIP] = offsetof(struct user_regs_struct, eip) / sizeof(long), + [UNW_X86_EFLAGS] = offsetof(struct user_regs_struct, eflags) / sizeof(long), + [UNW_X86_TRAPNO] = offsetof(struct user_regs_struct, orig_eax) / sizeof(long), + }; +#elif defined(UNW_TARGET_X86_64) + static const int8_t remap_regs[] = + { + [UNW_X86_64_RAX] = offsetof(struct user_regs_struct, rax) / sizeof(long), + [UNW_X86_64_RDX] = offsetof(struct user_regs_struct, rdx) / sizeof(long), + [UNW_X86_64_RCX] = offsetof(struct user_regs_struct, rcx) / sizeof(long), + [UNW_X86_64_RBX] = offsetof(struct user_regs_struct, rbx) / sizeof(long), + [UNW_X86_64_RSI] = offsetof(struct user_regs_struct, rsi) / sizeof(long), + [UNW_X86_64_RDI] = offsetof(struct user_regs_struct, rdi) / sizeof(long), + [UNW_X86_64_RBP] = offsetof(struct user_regs_struct, rbp) / sizeof(long), + [UNW_X86_64_RSP] = offsetof(struct user_regs_struct, rsp) / sizeof(long), + [UNW_X86_64_RIP] = offsetof(struct user_regs_struct, rip) / sizeof(long), + }; +#else +#error Port me +#endif + + struct UCD_info *ui = arg; + if (regnum < 0 || regnum >= (unw_regnum_t)ARRAY_SIZE(remap_regs)) + { + Debug(0, "%s: bad regnum:%d\n", __func__, regnum); + return -UNW_EINVAL; + } + regnum = remap_regs[regnum]; + + /* pr_reg is a long[] array, but it contains struct user_regs_struct's + * image. + */ + Debug(1, "pr_reg[%d]:%ld (0x%lx)", regnum, + (long)ui->prstatus->pr_reg[regnum], + (long)ui->prstatus->pr_reg[regnum] + ); + *valp = ui->prstatus->pr_reg[regnum]; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_accessors.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_accessors.c new file mode 100644 index 0000000000..9bbe34e1b2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_accessors.c @@ -0,0 +1,36 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_internal.h" + +PROTECTED unw_accessors_t _UCD_accessors = + { + .find_proc_info = _UCD_find_proc_info, + .put_unwind_info = _UCD_put_unwind_info, + .get_dyn_info_list_addr = _UCD_get_dyn_info_list_addr, + .access_mem = _UCD_access_mem, + .access_reg = _UCD_access_reg, + .access_fpreg = _UCD_access_fpreg, + .resume = _UCD_resume, + .get_proc_name = _UCD_get_proc_name + }; diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_create.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_create.c new file mode 100644 index 0000000000..0f791af860 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_create.c @@ -0,0 +1,417 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +/* Endian detection */ +#include +#if defined(HAVE_BYTESWAP_H) +#include +#endif +#if defined(HAVE_ENDIAN_H) +# include +#elif defined(HAVE_SYS_ENDIAN_H) +# include +#endif +#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN +# define WE_ARE_BIG_ENDIAN 1 +# define WE_ARE_LITTLE_ENDIAN 0 +#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN +# define WE_ARE_BIG_ENDIAN 0 +# define WE_ARE_LITTLE_ENDIAN 1 +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN +# define WE_ARE_BIG_ENDIAN 1 +# define WE_ARE_LITTLE_ENDIAN 0 +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN +# define WE_ARE_BIG_ENDIAN 0 +# define WE_ARE_LITTLE_ENDIAN 1 +#elif defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN +# define WE_ARE_BIG_ENDIAN 1 +# define WE_ARE_LITTLE_ENDIAN 0 +#elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN +# define WE_ARE_BIG_ENDIAN 0 +# define WE_ARE_LITTLE_ENDIAN 1 +#elif defined(__386__) +# define WE_ARE_BIG_ENDIAN 0 +# define WE_ARE_LITTLE_ENDIAN 1 +#else +# error "Can't determine endianness" +#endif + +#include +#include /* struct elf_prstatus */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +#define NOTE_DATA(_hdr) STRUCT_MEMBER_P((_hdr), sizeof (Elf32_Nhdr) + ALIGN((_hdr)->n_namesz, 4)) +#define NOTE_SIZE(_hdr) (sizeof (Elf32_Nhdr) + ALIGN((_hdr)->n_namesz, 4) + (_hdr)->n_descsz) +#define NOTE_NEXT(_hdr) STRUCT_MEMBER_P((_hdr), NOTE_SIZE(_hdr)) +#define NOTE_FITS_IN(_hdr, _size) ((_size) >= sizeof (Elf32_Nhdr) && (_size) >= NOTE_SIZE (_hdr)) +#define NOTE_FITS(_hdr, _end) NOTE_FITS_IN((_hdr), (unsigned long)((char *)(_end) - (char *)(_hdr))) + +struct UCD_info * +_UCD_create(const char *filename) +{ + union + { + Elf32_Ehdr h32; + Elf64_Ehdr h64; + } elf_header; +#define elf_header32 elf_header.h32 +#define elf_header64 elf_header.h64 + bool _64bits; + + struct UCD_info *ui = memset(malloc(sizeof(*ui)), 0, sizeof(*ui)); + ui->edi.di_cache.format = -1; + ui->edi.di_debug.format = -1; +#if UNW_TARGET_IA64 + ui->edi.ktab.format = -1; +#endif + + int fd = ui->coredump_fd = open(filename, O_RDONLY); + if (fd < 0) + goto err; + ui->coredump_filename = strdup(filename); + + /* No sane ELF32 file is going to be smaller then ELF64 _header_, + * so let's just read 64-bit sized one. + */ + if (read(fd, &elf_header64, sizeof(elf_header64)) != sizeof(elf_header64)) + { + Debug(0, "'%s' is not an ELF file\n", filename); + goto err; + } + + if (memcmp(&elf_header32, "\x7f""ELF", 4) != 0) + { + Debug(0, "'%s' is not an ELF file\n", filename); + goto err; + } + + if (elf_header32.e_ident[EI_CLASS] != ELFCLASS32 + && elf_header32.e_ident[EI_CLASS] != ELFCLASS64) + { + Debug(0, "'%s' is not a 32/64 bit ELF file\n", filename); + goto err; + } + + if (WE_ARE_LITTLE_ENDIAN != (elf_header32.e_ident[EI_DATA] == ELFDATA2LSB)) + { + Debug(0, "'%s' is endian-incompatible\n", filename); + goto err; + } + + _64bits = (elf_header32.e_ident[EI_CLASS] == ELFCLASS64); + if (_64bits && sizeof(elf_header64.e_entry) > sizeof(off_t)) + { + Debug(0, "Can't process '%s': 64-bit file " + "while only %ld bits are supported", + filename, 8L * sizeof(off_t)); + goto err; + } + + /* paranoia check */ + if (_64bits + ? 0 /* todo: (elf_header64.e_ehsize != NN || elf_header64.e_phentsize != NN) */ + : (elf_header32.e_ehsize != 52 || elf_header32.e_phentsize != 32) + ) + { + Debug(0, "'%s' has wrong e_ehsize or e_phentsize\n", filename); + goto err; + } + + off_t ofs = (_64bits ? elf_header64.e_phoff : elf_header32.e_phoff); + if (lseek(fd, ofs, SEEK_SET) != ofs) + { + Debug(0, "Can't read phdrs from '%s'\n", filename); + goto err; + } + unsigned size = ui->phdrs_count = (_64bits ? elf_header64.e_phnum : elf_header32.e_phnum); + coredump_phdr_t *phdrs = ui->phdrs = memset(malloc(size * sizeof(phdrs[0])), 0, size * sizeof(phdrs[0])); + if (_64bits) + { + coredump_phdr_t *cur = phdrs; + unsigned i = 0; + while (i < size) + { + Elf64_Phdr hdr64; + if (read(fd, &hdr64, sizeof(hdr64)) != sizeof(hdr64)) + { + Debug(0, "Can't read phdrs from '%s'\n", filename); + goto err; + } + cur->p_type = hdr64.p_type ; + cur->p_flags = hdr64.p_flags ; + cur->p_offset = hdr64.p_offset; + cur->p_vaddr = hdr64.p_vaddr ; + /*cur->p_paddr = hdr32.p_paddr ; always 0 */ +//TODO: check that and abort if it isn't? + cur->p_filesz = hdr64.p_filesz; + cur->p_memsz = hdr64.p_memsz ; + cur->p_align = hdr64.p_align ; + /* cur->backing_filename = NULL; - done by memset */ + cur->backing_fd = -1; + cur->backing_filesize = hdr64.p_filesz; + i++; + cur++; + } + } else { + coredump_phdr_t *cur = phdrs; + unsigned i = 0; + while (i < size) + { + Elf32_Phdr hdr32; + if (read(fd, &hdr32, sizeof(hdr32)) != sizeof(hdr32)) + { + Debug(0, "Can't read phdrs from '%s'\n", filename); + goto err; + } + cur->p_type = hdr32.p_type ; + cur->p_flags = hdr32.p_flags ; + cur->p_offset = hdr32.p_offset; + cur->p_vaddr = hdr32.p_vaddr ; + /*cur->p_paddr = hdr32.p_paddr ; always 0 */ + cur->p_filesz = hdr32.p_filesz; + cur->p_memsz = hdr32.p_memsz ; + cur->p_align = hdr32.p_align ; + /* cur->backing_filename = NULL; - done by memset */ + cur->backing_fd = -1; + cur->backing_filesize = hdr32.p_memsz; + i++; + cur++; + } + } + + unsigned i = 0; + coredump_phdr_t *cur = phdrs; + while (i < size) + { + Debug(2, "phdr[%03d]: type:%d", i, cur->p_type); + if (cur->p_type == PT_NOTE) + { + Elf32_Nhdr *note_hdr, *note_end; + unsigned n_threads; + + ui->note_phdr = malloc(cur->p_filesz); + if (lseek(fd, cur->p_offset, SEEK_SET) != (off_t)cur->p_offset + || (uoff_t)read(fd, ui->note_phdr, cur->p_filesz) != cur->p_filesz) + { + Debug(0, "Can't read PT_NOTE from '%s'\n", filename); + goto err; + } + + note_end = STRUCT_MEMBER_P (ui->note_phdr, cur->p_filesz); + + /* Count number of threads */ + n_threads = 0; + note_hdr = (Elf32_Nhdr *)ui->note_phdr; + while (NOTE_FITS (note_hdr, note_end)) + { + if (note_hdr->n_type == NT_PRSTATUS) + n_threads++; + + note_hdr = NOTE_NEXT (note_hdr); + } + + ui->n_threads = n_threads; + ui->threads = malloc(sizeof (void *) * n_threads); + + n_threads = 0; + note_hdr = (Elf32_Nhdr *)ui->note_phdr; + while (NOTE_FITS (note_hdr, note_end)) + { + if (note_hdr->n_type == NT_PRSTATUS) + ui->threads[n_threads++] = NOTE_DATA (note_hdr); + + note_hdr = NOTE_NEXT (note_hdr); + } + } + if (cur->p_type == PT_LOAD) + { + Debug(2, " ofs:%08llx va:%08llx filesize:%08llx memsize:%08llx flg:%x", + (unsigned long long) cur->p_offset, + (unsigned long long) cur->p_vaddr, + (unsigned long long) cur->p_filesz, + (unsigned long long) cur->p_memsz, + cur->p_flags + ); + if (cur->p_filesz < cur->p_memsz) + Debug(2, " partial"); + if (cur->p_flags & PF_X) + Debug(2, " executable"); + } + Debug(2, "\n"); + i++; + cur++; + } + + if (ui->n_threads == 0) + { + Debug(0, "No NT_PRSTATUS note found in '%s'\n", filename); + goto err; + } + + ui->prstatus = ui->threads[0]; + + return ui; + + err: + _UCD_destroy(ui); + return NULL; +} + +int _UCD_get_num_threads(struct UCD_info *ui) +{ + return ui->n_threads; +} + +void _UCD_select_thread(struct UCD_info *ui, int n) +{ + if (n >= 0 && n < ui->n_threads) + ui->prstatus = ui->threads[n]; +} + +pid_t _UCD_get_pid(struct UCD_info *ui) +{ + return ui->prstatus->pr_pid; +} + +int _UCD_get_cursig(struct UCD_info *ui) +{ + return ui->prstatus->pr_cursig; +} + +int _UCD_add_backing_file_at_segment(struct UCD_info *ui, int phdr_no, const char *filename) +{ + if ((unsigned)phdr_no >= ui->phdrs_count) + { + Debug(0, "There is no segment %d in this coredump\n", phdr_no); + return -1; + } + + struct coredump_phdr *phdr = &ui->phdrs[phdr_no]; + if (phdr->backing_filename) + { + Debug(0, "Backing file already added to segment %d\n", phdr_no); + return -1; + } + + int fd = open(filename, O_RDONLY); + if (fd < 0) + { + Debug(0, "Can't open '%s'\n", filename); + return -1; + } + + phdr->backing_fd = fd; + phdr->backing_filename = strdup(filename); + + struct stat statbuf; + if (fstat(fd, &statbuf) != 0) + { + Debug(0, "Can't stat '%s'\n", filename); + goto err; + } + phdr->backing_filesize = (uoff_t)statbuf.st_size; + + if (phdr->p_flags != (PF_X | PF_R)) + Debug(1, "Note: phdr[%u] is not r-x: flags are 0x%x\n", phdr_no, phdr->p_flags); + + if (phdr->backing_filesize > phdr->p_memsz) + { + /* This is expected */ + Debug(2, "Note: phdr[%u] is %lld bytes, file is larger: %lld bytes\n", + phdr_no, + (unsigned long long)phdr->p_memsz, + (unsigned long long)phdr->backing_filesize + ); + } +//TODO: else loudly complain? Maybe even fail? + + if (phdr->p_filesz != 0) + { +//TODO: loop and compare in smaller blocks + char *core_buf = malloc(phdr->p_filesz); + char *file_buf = malloc(phdr->p_filesz); + if (lseek(ui->coredump_fd, phdr->p_offset, SEEK_SET) != (off_t)phdr->p_offset + || (uoff_t)read(ui->coredump_fd, core_buf, phdr->p_filesz) != phdr->p_filesz + ) + { + Debug(0, "Error reading from coredump file\n"); + err_read: + free(core_buf); + free(file_buf); + goto err; + } + if ((uoff_t)read(fd, file_buf, phdr->p_filesz) != phdr->p_filesz) + { + Debug(0, "Error reading from '%s'\n", filename); + goto err_read; + } + int r = memcmp(core_buf, file_buf, phdr->p_filesz); + free(core_buf); + free(file_buf); + if (r != 0) + { + Debug(1, "Note: phdr[%u] first %lld bytes in core dump and in file do not match\n", + phdr_no, (unsigned long long)phdr->p_filesz + ); + } else { + Debug(1, "Note: phdr[%u] first %lld bytes in core dump and in file match\n", + phdr_no, (unsigned long long)phdr->p_filesz + ); + } + } + + /* Success */ + return 0; + + err: + if (phdr->backing_fd >= 0) + { + close(phdr->backing_fd); + phdr->backing_fd = -1; + } + free(phdr->backing_filename); + phdr->backing_filename = NULL; + return -1; +} + +int _UCD_add_backing_file_at_vaddr(struct UCD_info *ui, + unsigned long vaddr, + const char *filename) +{ + unsigned i; + for (i = 0; i < ui->phdrs_count; i++) + { + struct coredump_phdr *phdr = &ui->phdrs[i]; + if (phdr->p_vaddr != vaddr) + continue; + /* It seems to match. Add it. */ + return _UCD_add_backing_file_at_segment(ui, i, filename); + } + return -1; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_destroy.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_destroy.c new file mode 100644 index 0000000000..5aff989ccc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_destroy.c @@ -0,0 +1,50 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_internal.h" + +void +_UCD_destroy (struct UCD_info *ui) +{ + if (!ui) + return; + + if (ui->coredump_fd >= 0) + close(ui->coredump_fd); + free(ui->coredump_filename); + + invalidate_edi (&ui->edi); + + unsigned i; + for (i = 0; i < ui->phdrs_count; i++) + { + struct coredump_phdr *phdr = &ui->phdrs[i]; + free(phdr->backing_filename); + if (phdr->backing_fd >= 0) + close(phdr->backing_fd); + } + + free(ui->note_phdr); + + free(ui); +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_elf_map_image.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_elf_map_image.c new file mode 100644 index 0000000000..63eb22a918 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_elf_map_image.c @@ -0,0 +1,98 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +static coredump_phdr_t * +CD_elf_map_image(struct UCD_info *ui, coredump_phdr_t *phdr) +{ + struct elf_image *ei = &ui->edi.ei; + + if (phdr->backing_fd < 0) + { + /* Note: coredump file contains only phdr->p_filesz bytes. + * We want to map bigger area (phdr->p_memsz bytes) to make sure + * these pages are allocated, but non-accessible. + */ + /* addr, length, prot, flags, fd, fd_offset */ + ei->image = mmap(NULL, phdr->p_memsz, PROT_READ, MAP_PRIVATE, ui->coredump_fd, phdr->p_offset); + if (ei->image == MAP_FAILED) + { + ei->image = NULL; + return NULL; + } + ei->size = phdr->p_filesz; + size_t remainder_len = phdr->p_memsz - phdr->p_filesz; + if (remainder_len > 0) + { + void *remainder_base = (char*) ei->image + phdr->p_filesz; + munmap(remainder_base, remainder_len); + } + } else { + /* We have a backing file for this segment. + * This file is always longer than phdr->p_memsz, + * and if phdr->p_filesz !=0, first phdr->p_filesz bytes in coredump + * are the same as first bytes in the file. (Thus no need to map coredump) + * We map the entire file: + * unwinding may need data which is past phdr->p_memsz bytes. + */ + /* addr, length, prot, flags, fd, fd_offset */ + ei->image = mmap(NULL, phdr->backing_filesize, PROT_READ, MAP_PRIVATE, phdr->backing_fd, 0); + if (ei->image == MAP_FAILED) + { + ei->image = NULL; + return NULL; + } + ei->size = phdr->backing_filesize; + } + + /* Check ELF header for sanity */ + if (!elf_w(valid_object)(ei)) + { + munmap(ei->image, ei->size); + ei->image = NULL; + ei->size = 0; + return NULL; + } + + return phdr; +} + +HIDDEN coredump_phdr_t * +_UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip) +{ + unsigned i; + for (i = 0; i < ui->phdrs_count; i++) + { + coredump_phdr_t *phdr = &ui->phdrs[i]; + if (phdr->p_vaddr <= ip && ip < phdr->p_vaddr + phdr->p_memsz) + { + phdr = CD_elf_map_image(ui, phdr); + return phdr; + } + } + return NULL; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_find_proc_info.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_find_proc_info.c new file mode 100644 index 0000000000..b727ea9073 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_find_proc_info.c @@ -0,0 +1,163 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +static int +get_unwind_info(struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip) +{ + unsigned long segbase, mapoff; + +#if UNW_TARGET_IA64 && defined(__linux) + if (!ui->edi.ktab.start_ip && _Uia64_get_kernel_table (&ui->edi.ktab) < 0) + return -UNW_ENOINFO; + + if (ui->edi.ktab.format != -1 && ip >= ui->edi.ktab.start_ip && ip < ui->edi.ktab.end_ip) + return 0; +#endif + + if ((ui->edi.di_cache.format != -1 + && ip >= ui->edi.di_cache.start_ip && ip < ui->edi.di_cache.end_ip) +#if UNW_TARGET_ARM + || (ui->edi.di_debug.format != -1 + && ip >= ui->edi.di_arm.start_ip && ip < ui->edi.di_arm.end_ip) +#endif + || (ui->edi.di_debug.format != -1 + && ip >= ui->edi.di_debug.start_ip && ip < ui->edi.di_debug.end_ip)) + return 0; + + invalidate_edi (&ui->edi); + + /* Used to be tdep_get_elf_image() in ptrace unwinding code */ + coredump_phdr_t *phdr = _UCD_get_elf_image(ui, ip); + if (!phdr) + { + Debug(1, "%s returns error: _UCD_get_elf_image failed\n", __func__); + return -UNW_ENOINFO; + } + /* segbase: where it is mapped in virtual memory */ + /* mapoff: offset in the file */ + segbase = phdr->p_vaddr; + /*mapoff = phdr->p_offset; WRONG! phdr->p_offset is the offset in COREDUMP file */ + mapoff = 0; +///FIXME. text segment is USUALLY, not always, at offset 0 in the binary/.so file. +// ensure that at initialization. + + /* Here, SEGBASE is the starting-address of the (mmap'ped) segment + which covers the IP we're looking for. */ + if (dwarf_find_unwind_table(&ui->edi, as, phdr->backing_filename, segbase, mapoff, ip) < 0) + { + Debug(1, "%s returns error: dwarf_find_unwind_table failed\n", __func__); + return -UNW_ENOINFO; + } + + /* This can happen in corner cases where dynamically generated + code falls into the same page that contains the data-segment + and the page-offset of the code is within the first page of + the executable. */ + if (ui->edi.di_cache.format != -1 + && (ip < ui->edi.di_cache.start_ip || ip >= ui->edi.di_cache.end_ip)) + ui->edi.di_cache.format = -1; + + if (ui->edi.di_debug.format != -1 + && (ip < ui->edi.di_debug.start_ip || ip >= ui->edi.di_debug.end_ip)) + ui->edi.di_debug.format = -1; + + if (ui->edi.di_cache.format == -1 +#if UNW_TARGET_ARM + && ui->edi.di_arm.format == -1 +#endif + && ui->edi.di_debug.format == -1) + { + Debug(1, "%s returns error: all formats are -1\n", __func__); + return -UNW_ENOINFO; + } + + Debug(1, "%s returns success\n", __func__); + return 0; +} + +int +_UCD_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + struct UCD_info *ui = arg; + + Debug(1, "%s: entering\n", __func__); + + int ret = -UNW_ENOINFO; + + if (get_unwind_info(ui, as, ip) < 0) { + Debug(1, "%s returns error: get_unwind_info failed\n", __func__); + return -UNW_ENOINFO; + } + +#if UNW_TARGET_IA64 + if (ui->edi.ktab.format != -1) + { + /* The kernel unwind table resides in local memory, so we have + to use the local address space to search it. Since + _UCD_put_unwind_info() has no easy way of detecting this + case, we simply make a copy of the unwind-info, so + _UCD_put_unwind_info() can always free() the unwind-info + without ill effects. */ + ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi, + need_unwind_info, arg); + if (ret >= 0) + { + if (!need_unwind_info) + pi->unwind_info = NULL; + else + { + void *mem = malloc (pi->unwind_info_size); + + if (!mem) + return -UNW_ENOMEM; + memcpy (mem, pi->unwind_info, pi->unwind_info_size); + pi->unwind_info = mem; + } + } + } +#endif + + if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1) + ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache, + pi, need_unwind_info, arg); + +#if UNW_TARGET_ARM + if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1) + ret = tdep_search_unwind_table (as, ip, &ui->edi.di_arm, pi, + need_unwind_info, arg); +#endif + + if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1) + ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi, + need_unwind_info, arg); + + Debug(1, "%s: returns %d\n", __func__, ret); + + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_get_proc_name.c b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_get_proc_name.c new file mode 100644 index 0000000000..b13cd932f4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_get_proc_name.c @@ -0,0 +1,70 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + + +/* Find the ELF image that contains IP and return the "closest" + procedure name, if there is one. With some caching, this could be + sped up greatly, but until an application materializes that's + sensitive to the performance of this routine, why bother... */ +static int +elf_w (CD_get_proc_name) (struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp) +{ + unsigned long segbase, mapoff; + int ret; + + /* Used to be tdep_get_elf_image() in ptrace unwinding code */ + coredump_phdr_t *cphdr = _UCD_get_elf_image(ui, ip); + if (!cphdr) + { + Debug(1, "%s returns error: _UCD_get_elf_image failed\n", __func__); + return -UNW_ENOINFO; + } + /* segbase: where it is mapped in virtual memory */ + /* mapoff: offset in the file */ + segbase = cphdr->p_vaddr; + /*mapoff = phdr->p_offset; WRONG! phdr->p_offset is the offset in COREDUMP file */ + mapoff = 0; + + ret = elf_w (get_proc_name_in_image) (as, &ui->edi.ei, segbase, mapoff, ip, buf, buf_len, offp); + + return ret; +} + +int +_UCD_get_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, void *arg) +{ + struct UCD_info *ui = arg; + +#if ELF_CLASS == ELFCLASS64 + return _Uelf64_CD_get_proc_name (ui, as, ip, buf, buf_len, offp); +#elif ELF_CLASS == ELFCLASS32 + return _Uelf32_CD_get_proc_name (ui, as, ip, buf, buf_len, offp); +#else + return -UNW_ENOINFO; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_internal.h b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_internal.h new file mode 100644 index 0000000000..5e92777503 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_internal.h @@ -0,0 +1,106 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UCD_internal_h +#define _UCD_internal_h + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_PROCFS_H +#include /* struct elf_prstatus */ +#endif +#include +#include +#include +#include +#include + +#include + +#include "libunwind_i.h" + + +#if SIZEOF_OFF_T == 4 +typedef uint32_t uoff_t; +#elif SIZEOF_OFF_T == 8 +typedef uint64_t uoff_t; +#else +# error Unknown size of off_t! +#endif + + +/* Similar to ELF phdrs. p_paddr element is absent, + * since it's always 0 in coredumps. + */ +struct coredump_phdr + { + uint32_t p_type; + uint32_t p_flags; + uoff_t p_offset; + uoff_t p_vaddr; + uoff_t p_filesz; + uoff_t p_memsz; + uoff_t p_align; + /* Data for backing file. If backing_fd < 0, there is no file */ + uoff_t backing_filesize; + char *backing_filename; /* for error meesages only */ + int backing_fd; + }; + +typedef struct coredump_phdr coredump_phdr_t; + +#if defined(HAVE_STRUCT_ELF_PRSTATUS) +#define PRSTATUS_STRUCT elf_prstatus +#elif defined(HAVE_STRUCT_PRSTATUS) +#define PRSTATUS_STRUCT prstatus +#else +#define PRSTATUS_STRUCT non_existent +#endif + +struct UCD_info + { + int big_endian; /* bool */ + int coredump_fd; + char *coredump_filename; /* for error meesages only */ + coredump_phdr_t *phdrs; /* array, allocated */ + unsigned phdrs_count; + void *note_phdr; /* allocated or NULL */ + struct PRSTATUS_STRUCT *prstatus; /* points inside note_phdr */ + int n_threads; + struct PRSTATUS_STRUCT **threads; + + struct elf_dyn_info edi; + }; + +extern coredump_phdr_t * _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip); + +#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL)) +#define STRUCT_MEMBER_P(struct_p, struct_offset) ((void *) ((char*) (struct_p) + (long) (struct_offset))) +#define STRUCT_MEMBER(member_type, struct_p, struct_offset) (*(member_type*) STRUCT_MEMBER_P ((struct_p), (struct_offset))) + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UCD_lib.h b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_lib.h new file mode 100644 index 0000000000..22be32ed1e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UCD_lib.h @@ -0,0 +1,57 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UCD_lib_h +#define _UCD_lib_h + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UPT_access_fpreg.c b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_access_fpreg.c new file mode 100644 index 0000000000..a578af1703 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_access_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +int +_UCD_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + print_error (__func__); + print_error (" not implemented\n"); + return -UNW_EINVAL; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UPT_elf.c b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_elf.c new file mode 100644 index 0000000000..8f30c695f0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_elf.c @@ -0,0 +1,5 @@ +/* We need to get a separate copy of the ELF-code into + libunwind-coredump since it cannot (and must not) have any ELF + dependencies on libunwind. */ +#include "libunwind_i.h" /* get ELFCLASS defined */ +#include "../elfxx.c" diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c new file mode 100644 index 0000000000..f1e6568199 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_get_dyn_info_list_addr.c @@ -0,0 +1,108 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +#if UNW_TARGET_IA64 && defined(__linux) +# include "elf64.h" +# include "os-linux.h" + +static inline int +get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, + int *countp) +{ + unsigned long lo, hi, off; + struct UPT_info *ui = arg; + struct map_iterator mi; + char path[PATH_MAX]; + unw_dyn_info_t *di; + unw_word_t res; + int count = 0; + + maps_init (&mi, ui->pid); + while (maps_next (&mi, &lo, &hi, &off)) + { + if (off) + continue; + + invalidate_edi (&ui->edi); + + if (elf_map_image (&ui->ei, path) < 0) + /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */ + continue; + + Debug (16, "checking object %s\n", path); + + di = dwarf_find_unwind_table (&ui->edi, as, path, lo, off); + if (di) + { + res = _Uia64_find_dyn_list (as, di, arg); + if (res && count++ == 0) + { + Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); + *dil_addr = res; + } + } + } + maps_close (&mi); + *countp = count; + return 0; +} + +#else + +static inline int +get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, + int *countp) +{ +# warning Implement get_list_addr(), please. + *countp = 0; + return 0; +} + +#endif + +int +_UCD_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, + void *arg) +{ + int count, ret; + + Debug (12, "looking for dyn_info list\n"); + + if ((ret = get_list_addr (as, dil_addr, arg, &count)) < 0) + return ret; + + /* If multiple dynamic-info list addresses are found, we would have + to determine which was is the one actually in use (since the + dynamic name resolution algorithm will pick one "winner"). + Perhaps we'd have to track them all until we find one that's + non-empty. Hopefully, this case simply will never arise, since + only libunwind defines the dynamic info list head. */ + assert (count <= 1); + + return (count > 0) ? 0 : -UNW_ENOINFO; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UPT_put_unwind_info.c b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_put_unwind_info.c new file mode 100644 index 0000000000..2f5a6476ba --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_put_unwind_info.c @@ -0,0 +1,36 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +void +_UCD_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg) +{ + if (!pi->unwind_info) + return; + free (pi->unwind_info); + pi->unwind_info = NULL; +} diff --git a/sdk/cpprt/linux/libunwind/src/coredump/_UPT_resume.c b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_resume.c new file mode 100644 index 0000000000..368aae112c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/coredump/_UPT_resume.c @@ -0,0 +1,35 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UCD_lib.h" +#include "_UCD_internal.h" + +int +_UCD_resume (unw_addr_space_t as, unw_cursor_t *c, void *arg) +{ + print_error (__func__); + print_error (" not implemented\n"); + return -UNW_EINVAL; +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gexpr.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gexpr.c new file mode 100644 index 0000000000..4a01215825 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gexpr.c @@ -0,0 +1,647 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "dwarf_i.h" +#include "libunwind_i.h" + +/* The "pick" operator provides an index range of 0..255 indicating + that the stack could at least have a depth of up to 256 elements, + but the GCC unwinder restricts the depth to 64, which seems + reasonable so we use the same value here. */ +#define MAX_EXPR_STACK_SIZE 64 + +#define NUM_OPERANDS(signature) (((signature) >> 6) & 0x3) +#define OPND1_TYPE(signature) (((signature) >> 3) & 0x7) +#define OPND2_TYPE(signature) (((signature) >> 0) & 0x7) + +#define OPND_SIGNATURE(n, t1, t2) (((n) << 6) | ((t1) << 3) | ((t2) << 0)) +#define OPND1(t1) OPND_SIGNATURE(1, t1, 0) +#define OPND2(t1, t2) OPND_SIGNATURE(2, t1, t2) + +#define VAL8 0x0 +#define VAL16 0x1 +#define VAL32 0x2 +#define VAL64 0x3 +#define ULEB128 0x4 +#define SLEB128 0x5 +#define OFFSET 0x6 /* 32-bit offset for 32-bit DWARF, 64-bit otherwise */ +#define ADDR 0x7 /* Machine address. */ + +static uint8_t operands[256] = + { + [DW_OP_addr] = OPND1 (ADDR), + [DW_OP_const1u] = OPND1 (VAL8), + [DW_OP_const1s] = OPND1 (VAL8), + [DW_OP_const2u] = OPND1 (VAL16), + [DW_OP_const2s] = OPND1 (VAL16), + [DW_OP_const4u] = OPND1 (VAL32), + [DW_OP_const4s] = OPND1 (VAL32), + [DW_OP_const8u] = OPND1 (VAL64), + [DW_OP_const8s] = OPND1 (VAL64), + [DW_OP_pick] = OPND1 (VAL8), + [DW_OP_plus_uconst] = OPND1 (ULEB128), + [DW_OP_skip] = OPND1 (VAL16), + [DW_OP_bra] = OPND1 (VAL16), + [DW_OP_breg0 + 0] = OPND1 (SLEB128), + [DW_OP_breg0 + 1] = OPND1 (SLEB128), + [DW_OP_breg0 + 2] = OPND1 (SLEB128), + [DW_OP_breg0 + 3] = OPND1 (SLEB128), + [DW_OP_breg0 + 4] = OPND1 (SLEB128), + [DW_OP_breg0 + 5] = OPND1 (SLEB128), + [DW_OP_breg0 + 6] = OPND1 (SLEB128), + [DW_OP_breg0 + 7] = OPND1 (SLEB128), + [DW_OP_breg0 + 8] = OPND1 (SLEB128), + [DW_OP_breg0 + 9] = OPND1 (SLEB128), + [DW_OP_breg0 + 10] = OPND1 (SLEB128), + [DW_OP_breg0 + 11] = OPND1 (SLEB128), + [DW_OP_breg0 + 12] = OPND1 (SLEB128), + [DW_OP_breg0 + 13] = OPND1 (SLEB128), + [DW_OP_breg0 + 14] = OPND1 (SLEB128), + [DW_OP_breg0 + 15] = OPND1 (SLEB128), + [DW_OP_breg0 + 16] = OPND1 (SLEB128), + [DW_OP_breg0 + 17] = OPND1 (SLEB128), + [DW_OP_breg0 + 18] = OPND1 (SLEB128), + [DW_OP_breg0 + 19] = OPND1 (SLEB128), + [DW_OP_breg0 + 20] = OPND1 (SLEB128), + [DW_OP_breg0 + 21] = OPND1 (SLEB128), + [DW_OP_breg0 + 22] = OPND1 (SLEB128), + [DW_OP_breg0 + 23] = OPND1 (SLEB128), + [DW_OP_breg0 + 24] = OPND1 (SLEB128), + [DW_OP_breg0 + 25] = OPND1 (SLEB128), + [DW_OP_breg0 + 26] = OPND1 (SLEB128), + [DW_OP_breg0 + 27] = OPND1 (SLEB128), + [DW_OP_breg0 + 28] = OPND1 (SLEB128), + [DW_OP_breg0 + 29] = OPND1 (SLEB128), + [DW_OP_breg0 + 30] = OPND1 (SLEB128), + [DW_OP_breg0 + 31] = OPND1 (SLEB128), + [DW_OP_regx] = OPND1 (ULEB128), + [DW_OP_fbreg] = OPND1 (SLEB128), + [DW_OP_bregx] = OPND2 (ULEB128, SLEB128), + [DW_OP_piece] = OPND1 (ULEB128), + [DW_OP_deref_size] = OPND1 (VAL8), + [DW_OP_xderef_size] = OPND1 (VAL8), + [DW_OP_call2] = OPND1 (VAL16), + [DW_OP_call4] = OPND1 (VAL32), + [DW_OP_call_ref] = OPND1 (OFFSET) + }; + +static inline unw_sword_t +sword (unw_addr_space_t as, unw_word_t val) +{ + switch (dwarf_addr_size (as)) + { + case 1: return (int8_t) val; + case 2: return (int16_t) val; + case 4: return (int32_t) val; + case 8: return (int64_t) val; + default: abort (); + } +} + +static inline unw_word_t +read_operand (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, int operand_type, unw_word_t *val, void *arg) +{ + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; + int ret; + + if (operand_type == ADDR) + switch (dwarf_addr_size (as)) + { + case 1: operand_type = VAL8; break; + case 2: operand_type = VAL16; break; + case 4: operand_type = VAL32; break; + case 8: operand_type = VAL64; break; + default: abort (); + } + + switch (operand_type) + { + case VAL8: + ret = dwarf_readu8 (as, a, addr, &u8, arg); + if (ret < 0) + return ret; + *val = u8; + break; + + case VAL16: + ret = dwarf_readu16 (as, a, addr, &u16, arg); + if (ret < 0) + return ret; + *val = u16; + break; + + case VAL32: + ret = dwarf_readu32 (as, a, addr, &u32, arg); + if (ret < 0) + return ret; + *val = u32; + break; + + case VAL64: + ret = dwarf_readu64 (as, a, addr, &u64, arg); + if (ret < 0) + return ret; + *val = u64; + break; + + case ULEB128: + ret = dwarf_read_uleb128 (as, a, addr, val, arg); + break; + + case SLEB128: + ret = dwarf_read_sleb128 (as, a, addr, val, arg); + break; + + case OFFSET: /* only used by DW_OP_call_ref, which we don't implement */ + default: + Debug (1, "Unexpected operand type %d\n", operand_type); + ret = -UNW_EINVAL; + } + return ret; +} + +HIDDEN int +dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr, unw_word_t len, + unw_word_t *valp, int *is_register) +{ + unw_word_t operand1 = 0, operand2 = 0, tmp1, tmp2, tmp3, end_addr; + uint8_t opcode, operands_signature, u8; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + unw_word_t stack[MAX_EXPR_STACK_SIZE]; + unsigned int tos = 0; + uint16_t u16; + uint32_t u32; + uint64_t u64; + int ret; +# define pop() \ +({ \ + if ((tos - 1) >= MAX_EXPR_STACK_SIZE) \ + { \ + Debug (1, "Stack underflow\n"); \ + return -UNW_EINVAL; \ + } \ + stack[--tos]; \ +}) +# define push(x) \ +do { \ + if (tos >= MAX_EXPR_STACK_SIZE) \ + { \ + Debug (1, "Stack overflow\n"); \ + return -UNW_EINVAL; \ + } \ + stack[tos++] = (x); \ +} while (0) +# define pick(n) \ +({ \ + unsigned int _index = tos - 1 - (n); \ + if (_index >= MAX_EXPR_STACK_SIZE) \ + { \ + Debug (1, "Out-of-stack pick\n"); \ + return -UNW_EINVAL; \ + } \ + stack[_index]; \ +}) + + as = c->as; + arg = c->as_arg; + a = unw_get_accessors (as); + end_addr = *addr + len; + *is_register = 0; + + Debug (14, "len=%lu, pushing cfa=0x%lx\n", + (unsigned long) len, (unsigned long) c->cfa); + + push (c->cfa); /* push current CFA as required by DWARF spec */ + + while (*addr < end_addr) + { + if ((ret = dwarf_readu8 (as, a, addr, &opcode, arg)) < 0) + return ret; + + operands_signature = operands[opcode]; + + if (unlikely (NUM_OPERANDS (operands_signature) > 0)) + { + if ((ret = read_operand (as, a, addr, + OPND1_TYPE (operands_signature), + &operand1, arg)) < 0) + return ret; + if (NUM_OPERANDS (operands_signature > 1)) + if ((ret = read_operand (as, a, addr, + OPND2_TYPE (operands_signature), + &operand2, arg)) < 0) + return ret; + } + + switch ((dwarf_expr_op_t) opcode) + { + case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2: + case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5: + case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8: + case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11: + case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14: + case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17: + case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20: + case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23: + case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26: + case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29: + case DW_OP_lit30: case DW_OP_lit31: + Debug (15, "OP_lit(%d)\n", (int) opcode - DW_OP_lit0); + push (opcode - DW_OP_lit0); + break; + + case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2: + case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5: + case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8: + case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11: + case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14: + case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17: + case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20: + case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23: + case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26: + case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29: + case DW_OP_breg30: case DW_OP_breg31: + Debug (15, "OP_breg(r%d,0x%lx)\n", + (int) opcode - DW_OP_breg0, (unsigned long) operand1); + if ((ret = unw_get_reg (dwarf_to_cursor (c), + dwarf_to_unw_regnum (opcode - DW_OP_breg0), + &tmp1)) < 0) + return ret; + push (tmp1 + operand1); + break; + + case DW_OP_bregx: + Debug (15, "OP_bregx(r%d,0x%lx)\n", + (int) operand1, (unsigned long) operand2); + if ((ret = unw_get_reg (dwarf_to_cursor (c), + dwarf_to_unw_regnum (operand1), &tmp1)) < 0) + return ret; + push (tmp1 + operand2); + break; + + case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2: + case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5: + case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8: + case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11: + case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14: + case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17: + case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20: + case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23: + case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26: + case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29: + case DW_OP_reg30: case DW_OP_reg31: + Debug (15, "OP_reg(r%d)\n", (int) opcode - DW_OP_reg0); + *valp = dwarf_to_unw_regnum (opcode - DW_OP_reg0); + *is_register = 1; + return 0; + + case DW_OP_regx: + Debug (15, "OP_regx(r%d)\n", (int) operand1); + *valp = dwarf_to_unw_regnum (operand1); + *is_register = 1; + return 0; + + case DW_OP_addr: + case DW_OP_const1u: + case DW_OP_const2u: + case DW_OP_const4u: + case DW_OP_const8u: + case DW_OP_constu: + case DW_OP_const8s: + case DW_OP_consts: + Debug (15, "OP_const(0x%lx)\n", (unsigned long) operand1); + push (operand1); + break; + + case DW_OP_const1s: + if (operand1 & 0x80) + operand1 |= ((unw_word_t) -1) << 8; + Debug (15, "OP_const1s(%ld)\n", (long) operand1); + push (operand1); + break; + + case DW_OP_const2s: + if (operand1 & 0x8000) + operand1 |= ((unw_word_t) -1) << 16; + Debug (15, "OP_const2s(%ld)\n", (long) operand1); + push (operand1); + break; + + case DW_OP_const4s: + if (operand1 & 0x80000000) + operand1 |= (((unw_word_t) -1) << 16) << 16; + Debug (15, "OP_const4s(%ld)\n", (long) operand1); + push (operand1); + break; + + case DW_OP_deref: + Debug (15, "OP_deref\n"); + tmp1 = pop (); + if ((ret = dwarf_readw (as, a, &tmp1, &tmp2, arg)) < 0) + return ret; + push (tmp2); + break; + + case DW_OP_deref_size: + Debug (15, "OP_deref_size(%d)\n", (int) operand1); + tmp1 = pop (); + switch (operand1) + { + default: + Debug (1, "Unexpected DW_OP_deref_size size %d\n", + (int) operand1); + return -UNW_EINVAL; + + case 1: + if ((ret = dwarf_readu8 (as, a, &tmp1, &u8, arg)) < 0) + return ret; + tmp2 = u8; + break; + + case 2: + if ((ret = dwarf_readu16 (as, a, &tmp1, &u16, arg)) < 0) + return ret; + tmp2 = u16; + break; + + case 3: + case 4: + if ((ret = dwarf_readu32 (as, a, &tmp1, &u32, arg)) < 0) + return ret; + tmp2 = u32; + if (operand1 == 3) + { + if (dwarf_is_big_endian (as)) + tmp2 >>= 8; + else + tmp2 &= 0xffffff; + } + break; + case 5: + case 6: + case 7: + case 8: + if ((ret = dwarf_readu64 (as, a, &tmp1, &u64, arg)) < 0) + return ret; + tmp2 = u64; + if (operand1 != 8) + { + if (dwarf_is_big_endian (as)) + tmp2 >>= 64 - 8 * operand1; + else + tmp2 &= (~ (unw_word_t) 0) << (8 * operand1); + } + break; + } + push (tmp2); + break; + + case DW_OP_dup: + Debug (15, "OP_dup\n"); + push (pick (0)); + break; + + case DW_OP_drop: + Debug (15, "OP_drop\n"); + pop (); + break; + + case DW_OP_pick: + Debug (15, "OP_pick(%d)\n", (int) operand1); + push (pick (operand1)); + break; + + case DW_OP_over: + Debug (15, "OP_over\n"); + push (pick (1)); + break; + + case DW_OP_swap: + Debug (15, "OP_swap\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1); + push (tmp2); + break; + + case DW_OP_rot: + Debug (15, "OP_rot\n"); + tmp1 = pop (); + tmp2 = pop (); + tmp3 = pop (); + push (tmp1); + push (tmp3); + push (tmp2); + break; + + case DW_OP_abs: + Debug (15, "OP_abs\n"); + tmp1 = pop (); + if (tmp1 & ((unw_word_t) 1 << (8 * dwarf_addr_size (as) - 1))) + tmp1 = -tmp1; + push (tmp1); + break; + + case DW_OP_and: + Debug (15, "OP_and\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 & tmp2); + break; + + case DW_OP_div: + Debug (15, "OP_div\n"); + tmp1 = pop (); + tmp2 = pop (); + if (tmp1) + tmp1 = sword (as, tmp2) / sword (as, tmp1); + push (tmp1); + break; + + case DW_OP_minus: + Debug (15, "OP_minus\n"); + tmp1 = pop (); + tmp2 = pop (); + tmp1 = tmp2 - tmp1; + push (tmp1); + break; + + case DW_OP_mod: + Debug (15, "OP_mod\n"); + tmp1 = pop (); + tmp2 = pop (); + if (tmp1) + tmp1 = tmp2 % tmp1; + push (tmp1); + break; + + case DW_OP_mul: + Debug (15, "OP_mul\n"); + tmp1 = pop (); + tmp2 = pop (); + if (tmp1) + tmp1 = tmp2 * tmp1; + push (tmp1); + break; + + case DW_OP_neg: + Debug (15, "OP_neg\n"); + push (-pop ()); + break; + + case DW_OP_not: + Debug (15, "OP_not\n"); + push (~pop ()); + break; + + case DW_OP_or: + Debug (15, "OP_or\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 | tmp2); + break; + + case DW_OP_plus: + Debug (15, "OP_plus\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 + tmp2); + break; + + case DW_OP_plus_uconst: + Debug (15, "OP_plus_uconst(%lu)\n", (unsigned long) operand1); + tmp1 = pop (); + push (tmp1 + operand1); + break; + + case DW_OP_shl: + Debug (15, "OP_shl\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp2 << tmp1); + break; + + case DW_OP_shr: + Debug (15, "OP_shr\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp2 >> tmp1); + break; + + case DW_OP_shra: + Debug (15, "OP_shra\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) >> tmp1); + break; + + case DW_OP_xor: + Debug (15, "OP_xor\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 ^ tmp2); + break; + + case DW_OP_le: + Debug (15, "OP_le\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp1) <= sword (as, tmp2)); + break; + + case DW_OP_ge: + Debug (15, "OP_ge\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp1) >= sword (as, tmp2)); + break; + + case DW_OP_eq: + Debug (15, "OP_eq\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp1) == sword (as, tmp2)); + break; + + case DW_OP_lt: + Debug (15, "OP_lt\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp1) < sword (as, tmp2)); + break; + + case DW_OP_gt: + Debug (15, "OP_gt\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp1) > sword (as, tmp2)); + break; + + case DW_OP_ne: + Debug (15, "OP_ne\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp1) != sword (as, tmp2)); + break; + + case DW_OP_skip: + Debug (15, "OP_skip(%d)\n", (int16_t) operand1); + *addr += (int16_t) operand1; + break; + + case DW_OP_bra: + Debug (15, "OP_skip(%d)\n", (int16_t) operand1); + tmp1 = pop (); + if (tmp1) + *addr += (int16_t) operand1; + break; + + case DW_OP_nop: + Debug (15, "OP_nop\n"); + break; + + case DW_OP_call2: + case DW_OP_call4: + case DW_OP_call_ref: + case DW_OP_fbreg: + case DW_OP_piece: + case DW_OP_push_object_address: + case DW_OP_xderef: + case DW_OP_xderef_size: + default: + Debug (1, "Unexpected opcode 0x%x\n", opcode); + return -UNW_EINVAL; + } + } + *valp = pop (); + Debug (14, "final value = 0x%lx\n", (unsigned long) *valp); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gfde.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gfde.c new file mode 100644 index 0000000000..8659624b03 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gfde.c @@ -0,0 +1,357 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "dwarf_i.h" + +static inline int +is_cie_id (unw_word_t val, int is_debug_frame) +{ + /* The CIE ID is normally 0xffffffff (for 32-bit ELF) or + 0xffffffffffffffff (for 64-bit ELF). However, .eh_frame + uses 0. */ + if (is_debug_frame) + return (val == - (uint32_t) 1 || val == - (uint64_t) 1); + else + return (val == 0); +} + +/* Note: we don't need to keep track of more than the first four + characters of the augmentation string, because we (a) ignore any + augmentation string contents once we find an unrecognized character + and (b) those characters that we do recognize, can't be + repeated. */ +static inline int +parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, + const unw_proc_info_t *pi, struct dwarf_cie_info *dci, + unw_word_t base, void *arg) +{ + uint8_t version, ch, augstr[5], fde_encoding, handler_encoding; + unw_word_t len, cie_end_addr, aug_size; + uint32_t u32val; + uint64_t u64val; + size_t i; + int ret; +# define STR2(x) #x +# define STR(x) STR2(x) + + /* Pick appropriate default for FDE-encoding. DWARF spec says + start-IP (initial_location) and the code-size (address_range) are + "address-unit sized constants". The `R' augmentation can be used + to override this, but by default, we pick an address-sized unit + for fde_encoding. */ + switch (dwarf_addr_size (as)) + { + case 4: fde_encoding = DW_EH_PE_udata4; break; + case 8: fde_encoding = DW_EH_PE_udata8; break; + default: fde_encoding = DW_EH_PE_omit; break; + } + + dci->lsda_encoding = DW_EH_PE_omit; + dci->handler = 0; + + if ((ret = dwarf_readu32 (as, a, &addr, &u32val, arg)) < 0) + return ret; + + if (u32val != 0xffffffff) + { + /* the CIE is in the 32-bit DWARF format */ + uint32_t cie_id; + /* DWARF says CIE id should be 0xffffffff, but in .eh_frame, it's 0 */ + const uint32_t expected_id = (base) ? 0xffffffff : 0; + + len = u32val; + cie_end_addr = addr + len; + if ((ret = dwarf_readu32 (as, a, &addr, &cie_id, arg)) < 0) + return ret; + if (cie_id != expected_id) + { + Debug (1, "Unexpected CIE id %x\n", cie_id); + return -UNW_EINVAL; + } + } + else + { + /* the CIE is in the 64-bit DWARF format */ + uint64_t cie_id; + /* DWARF says CIE id should be 0xffffffffffffffff, but in + .eh_frame, it's 0 */ + const uint64_t expected_id = (base) ? 0xffffffffffffffffull : 0; + + if ((ret = dwarf_readu64 (as, a, &addr, &u64val, arg)) < 0) + return ret; + len = u64val; + cie_end_addr = addr + len; + if ((ret = dwarf_readu64 (as, a, &addr, &cie_id, arg)) < 0) + return ret; + if (cie_id != expected_id) + { + Debug (1, "Unexpected CIE id %llx\n", (long long) cie_id); + return -UNW_EINVAL; + } + } + dci->cie_instr_end = cie_end_addr; + + if ((ret = dwarf_readu8 (as, a, &addr, &version, arg)) < 0) + return ret; + + if (version != 1 && version != DWARF_CIE_VERSION) + { + Debug (1, "Got CIE version %u, expected version 1 or " + STR (DWARF_CIE_VERSION) "\n", version); + return -UNW_EBADVERSION; + } + + /* read and parse the augmentation string: */ + memset (augstr, 0, sizeof (augstr)); + for (i = 0;;) + { + if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) + return ret; + + if (!ch) + break; /* end of augmentation string */ + + if (i < sizeof (augstr) - 1) + augstr[i++] = ch; + } + + if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->code_align, arg)) < 0 + || (ret = dwarf_read_sleb128 (as, a, &addr, &dci->data_align, arg)) < 0) + return ret; + + /* Read the return-address column either as a u8 or as a uleb128. */ + if (version == 1) + { + if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) + return ret; + dci->ret_addr_column = ch; + } + else if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->ret_addr_column, + arg)) < 0) + return ret; + + i = 0; + if (augstr[0] == 'z') + { + dci->sized_augmentation = 1; + if ((ret = dwarf_read_uleb128 (as, a, &addr, &aug_size, arg)) < 0) + return ret; + i++; + } + + for (; i < sizeof (augstr) && augstr[i]; ++i) + switch (augstr[i]) + { + case 'L': + /* read the LSDA pointer-encoding format. */ + if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) + return ret; + dci->lsda_encoding = ch; + break; + + case 'R': + /* read the FDE pointer-encoding format. */ + if ((ret = dwarf_readu8 (as, a, &addr, &fde_encoding, arg)) < 0) + return ret; + break; + + case 'P': + /* read the personality-routine pointer-encoding format. */ + if ((ret = dwarf_readu8 (as, a, &addr, &handler_encoding, arg)) < 0) + return ret; + if ((ret = dwarf_read_encoded_pointer (as, a, &addr, handler_encoding, + pi, &dci->handler, arg)) < 0) + return ret; + break; + + case 'S': + /* This is a signal frame. */ + dci->signal_frame = 1; + + /* Temporarily set it to one so dwarf_parse_fde() knows that + it should fetch the actual ABI/TAG pair from the FDE. */ + dci->have_abi_marker = 1; + break; + + default: + Debug (1, "Unexpected augmentation string `%s'\n", augstr); + if (dci->sized_augmentation) + /* If we have the size of the augmentation body, we can skip + over the parts that we don't understand, so we're OK. */ + goto done; + else + return -UNW_EINVAL; + } + done: + dci->fde_encoding = fde_encoding; + dci->cie_instr_start = addr; + Debug (15, "CIE parsed OK, augmentation = \"%s\", handler=0x%lx\n", + augstr, (long) dci->handler); + return 0; +} + +/* Extract proc-info from the FDE starting at adress ADDR. + + Pass BASE as zero for eh_frame behaviour, or a pointer to + debug_frame base for debug_frame behaviour. */ + +HIDDEN int +dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addrp, unw_proc_info_t *pi, + int need_unwind_info, unw_word_t base, + void *arg) +{ + unw_word_t fde_end_addr, cie_addr, cie_offset_addr, aug_end_addr = 0; + unw_word_t start_ip, ip_range, aug_size, addr = *addrp; + int ret, ip_range_encoding; + struct dwarf_cie_info dci; + uint64_t u64val; + uint32_t u32val; + + Debug (12, "FDE @ 0x%lx\n", (long) addr); + + memset (&dci, 0, sizeof (dci)); + + if ((ret = dwarf_readu32 (as, a, &addr, &u32val, arg)) < 0) + return ret; + + if (u32val != 0xffffffff) + { + int32_t cie_offset; + + /* In some configurations, an FDE with a 0 length indicates the + end of the FDE-table. */ + if (u32val == 0) + return -UNW_ENOINFO; + + /* the FDE is in the 32-bit DWARF format */ + + *addrp = fde_end_addr = addr + u32val; + cie_offset_addr = addr; + + if ((ret = dwarf_reads32 (as, a, &addr, &cie_offset, arg)) < 0) + return ret; + + if (is_cie_id (cie_offset, base != 0)) + /* ignore CIEs (happens during linear searches) */ + return 0; + + if (base != 0) + cie_addr = base + cie_offset; + else + /* DWARF says that the CIE_pointer in the FDE is a + .debug_frame-relative offset, but the GCC-generated .eh_frame + sections instead store a "pcrelative" offset, which is just + as fine as it's self-contained. */ + cie_addr = cie_offset_addr - cie_offset; + } + else + { + int64_t cie_offset; + + /* the FDE is in the 64-bit DWARF format */ + + if ((ret = dwarf_readu64 (as, a, &addr, &u64val, arg)) < 0) + return ret; + + *addrp = fde_end_addr = addr + u64val; + cie_offset_addr = addr; + + if ((ret = dwarf_reads64 (as, a, &addr, &cie_offset, arg)) < 0) + return ret; + + if (is_cie_id (cie_offset, base != 0)) + /* ignore CIEs (happens during linear searches) */ + return 0; + + if (base != 0) + cie_addr = base + cie_offset; + else + /* DWARF says that the CIE_pointer in the FDE is a + .debug_frame-relative offset, but the GCC-generated .eh_frame + sections instead store a "pcrelative" offset, which is just + as fine as it's self-contained. */ + cie_addr = (unw_word_t) ((uint64_t) cie_offset_addr - cie_offset); + } + + Debug (15, "looking for CIE at address %lx\n", (long) cie_addr); + + if ((ret = parse_cie (as, a, cie_addr, pi, &dci, base, arg)) < 0) + return ret; + + /* IP-range has same encoding as FDE pointers, except that it's + always an absolute value: */ + ip_range_encoding = dci.fde_encoding & DW_EH_PE_FORMAT_MASK; + + if ((ret = dwarf_read_encoded_pointer (as, a, &addr, dci.fde_encoding, + pi, &start_ip, arg)) < 0 + || (ret = dwarf_read_encoded_pointer (as, a, &addr, ip_range_encoding, + pi, &ip_range, arg)) < 0) + return ret; + pi->start_ip = start_ip; + pi->end_ip = start_ip + ip_range; + pi->handler = dci.handler; + + if (dci.sized_augmentation) + { + if ((ret = dwarf_read_uleb128 (as, a, &addr, &aug_size, arg)) < 0) + return ret; + aug_end_addr = addr + aug_size; + } + + if ((ret = dwarf_read_encoded_pointer (as, a, &addr, dci.lsda_encoding, + pi, &pi->lsda, arg)) < 0) + return ret; + + Debug (15, "FDE covers IP 0x%lx-0x%lx, LSDA=0x%lx\n", + (long) pi->start_ip, (long) pi->end_ip, (long) pi->lsda); + + if (need_unwind_info) + { + pi->format = UNW_INFO_FORMAT_TABLE; + pi->unwind_info_size = sizeof (dci); + pi->unwind_info = mempool_alloc (&dwarf_cie_info_pool); + if (!pi->unwind_info) + return -UNW_ENOMEM; + + if (dci.have_abi_marker) + { + if ((ret = dwarf_readu16 (as, a, &addr, &dci.abi, arg)) < 0 + || (ret = dwarf_readu16 (as, a, &addr, &dci.tag, arg)) < 0) + return ret; + Debug (13, "Found ABI marker = (abi=%u, tag=%u)\n", + dci.abi, dci.tag); + } + + if (dci.sized_augmentation) + dci.fde_instr_start = aug_end_addr; + else + dci.fde_instr_start = addr; + dci.fde_instr_end = fde_end_addr; + + memcpy (pi->unwind_info, &dci, sizeof (dci)); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gfind_proc_info-lsb.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gfind_proc_info-lsb.c new file mode 100644 index 0000000000..bdce9efafc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gfind_proc_info-lsb.c @@ -0,0 +1,942 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Locate an FDE via the ELF data-structures defined by LSB v1.3 + (http://www.linuxbase.org/spec/). */ + +#ifndef UNW_REMOTE_ONLY +#include +#endif /* !UNW_REMOTE_ONLY */ +#include +#include +#include + +#include "dwarf_i.h" +#include "dwarf-eh.h" +#include "libunwind_i.h" + +struct table_entry + { + int32_t start_ip_offset; + int32_t fde_offset; + }; + +#ifndef UNW_REMOTE_ONLY + +#ifdef __linux +#include "os-linux.h" +#endif + +static int +linear_search (unw_addr_space_t as, unw_word_t ip, + unw_word_t eh_frame_start, unw_word_t eh_frame_end, + unw_word_t fde_count, + unw_proc_info_t *pi, int need_unwind_info, void *arg) +{ + unw_accessors_t *a = unw_get_accessors (unw_local_addr_space); + unw_word_t i = 0, fde_addr, addr = eh_frame_start; + int ret; + + while (i++ < fde_count && addr < eh_frame_end) + { + fde_addr = addr; + if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi, 0, 0, arg)) + < 0) + return ret; + + if (ip >= pi->start_ip && ip < pi->end_ip) + { + if (!need_unwind_info) + return 1; + addr = fde_addr; + if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi, + need_unwind_info, 0, + arg)) + < 0) + return ret; + return 1; + } + } + return -UNW_ENOINFO; +} +#endif /* !UNW_REMOTE_ONLY */ + +#ifdef CONFIG_DEBUG_FRAME +/* Load .debug_frame section from FILE. Allocates and returns space + in *BUF, and sets *BUFSIZE to its size. IS_LOCAL is 1 if using the + local process, in which case we can search the system debug file + directory; 0 for other address spaces, in which case we do not; or + -1 for recursive calls following .gnu_debuglink. Returns 0 on + success, 1 on error. Succeeds even if the file contains no + .debug_frame. */ +/* XXX: Could use mmap; but elf_map_image keeps tons mapped in. */ + +static int +load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local) +{ + FILE *f; + Elf_W (Ehdr) ehdr; + Elf_W (Half) shstrndx; + Elf_W (Shdr) *sec_hdrs = NULL; + char *stringtab = NULL; + unsigned int i; + size_t linksize = 0; + char *linkbuf = NULL; + + *buf = NULL; + *bufsize = 0; + + f = fopen (file, "r"); + + if (!f) + return 1; + + if (fread (&ehdr, sizeof (Elf_W (Ehdr)), 1, f) != 1) + goto file_error; + + shstrndx = ehdr.e_shstrndx; + + Debug (4, "opened file '%s'. Section header at offset %d\n", + file, (int) ehdr.e_shoff); + + fseek (f, ehdr.e_shoff, SEEK_SET); + sec_hdrs = calloc (ehdr.e_shnum, sizeof (Elf_W (Shdr))); + if (fread (sec_hdrs, sizeof (Elf_W (Shdr)), ehdr.e_shnum, f) != ehdr.e_shnum) + goto file_error; + + Debug (4, "loading string table of size %zd\n", + sec_hdrs[shstrndx].sh_size); + stringtab = malloc (sec_hdrs[shstrndx].sh_size); + fseek (f, sec_hdrs[shstrndx].sh_offset, SEEK_SET); + if (fread (stringtab, 1, sec_hdrs[shstrndx].sh_size, f) != sec_hdrs[shstrndx].sh_size) + goto file_error; + + for (i = 1; i < ehdr.e_shnum && *buf == NULL; i++) + { + char *secname = &stringtab[sec_hdrs[i].sh_name]; + + if (strcmp (secname, ".debug_frame") == 0) + { + *bufsize = sec_hdrs[i].sh_size; + *buf = malloc (*bufsize); + + fseek (f, sec_hdrs[i].sh_offset, SEEK_SET); + if (fread (*buf, 1, *bufsize, f) != *bufsize) + goto file_error; + + Debug (4, "read %zd bytes of .debug_frame from offset %zd\n", + *bufsize, sec_hdrs[i].sh_offset); + } + else if (strcmp (secname, ".gnu_debuglink") == 0) + { + linksize = sec_hdrs[i].sh_size; + linkbuf = malloc (linksize); + + fseek (f, sec_hdrs[i].sh_offset, SEEK_SET); + if (fread (linkbuf, 1, linksize, f) != linksize) + goto file_error; + + Debug (4, "read %zd bytes of .gnu_debuglink from offset %zd\n", + linksize, sec_hdrs[i].sh_offset); + } + } + + free (stringtab); + free (sec_hdrs); + + fclose (f); + + /* Ignore separate debug files which contain a .gnu_debuglink section. */ + if (linkbuf && is_local == -1) + { + free (linkbuf); + return 1; + } + + if (*buf == NULL && linkbuf != NULL && memchr (linkbuf, 0, linksize) != NULL) + { + char *newname, *basedir, *p; + static const char *debugdir = "/usr/lib/debug"; + int ret; + + /* XXX: Don't bother with the checksum; just search for the file. */ + basedir = malloc (strlen (file) + 1); + newname = malloc (strlen (linkbuf) + strlen (debugdir) + + strlen (file) + 9); + + p = strrchr (file, '/'); + if (p != NULL) + { + memcpy (basedir, file, p - file); + basedir[p - file] = '\0'; + } + else + basedir[0] = 0; + + strcpy (newname, basedir); + strcat (newname, "/"); + strcat (newname, linkbuf); + ret = load_debug_frame (newname, buf, bufsize, -1); + + if (ret == 1) + { + strcpy (newname, basedir); + strcat (newname, "/.debug/"); + strcat (newname, linkbuf); + ret = load_debug_frame (newname, buf, bufsize, -1); + } + + if (ret == 1 && is_local == 1) + { + strcpy (newname, debugdir); + strcat (newname, basedir); + strcat (newname, "/"); + strcat (newname, linkbuf); + ret = load_debug_frame (newname, buf, bufsize, -1); + } + + free (basedir); + free (newname); + } + free (linkbuf); + + return 0; + +/* An error reading image file. Release resources and return error code */ +file_error: + if (stringtab) free(stringtab); + if (sec_hdrs) free(sec_hdrs); + if (linkbuf) free(linkbuf); + fclose(f); + + return 1; +} + +/* Locate the binary which originated the contents of address ADDR. Return + the name of the binary in *name (space is allocated by the caller) + Returns 0 if a binary is successfully found, or 1 if an error occurs. */ + +static int +find_binary_for_address (unw_word_t ip, char *name, size_t name_size) +{ +#if defined(__linux) && (!UNW_REMOTE_ONLY) && (!HAVE_SGX) + struct map_iterator mi; + int found = 0; + int pid = getpid (); + unsigned long segbase, mapoff, hi; + + maps_init (&mi, pid); + while (maps_next (&mi, &segbase, &hi, &mapoff)) + if (ip >= segbase && ip < hi) + { + size_t len = strlen (mi.path); + + if (len + 1 <= name_size) + { + memcpy (name, mi.path, len + 1); + found = 1; + } + break; + } + maps_close (&mi); + return !found; +#endif + + return 1; +} + +/* Locate and/or try to load a debug_frame section for address ADDR. Return + pointer to debug frame descriptor, or zero if not found. */ + +static struct unw_debug_frame_list * +locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname, + unw_word_t start, unw_word_t end) +{ + struct unw_debug_frame_list *w, *fdesc = 0; + char path[PATH_MAX]; + char *name = path; + int err; + char *buf; + size_t bufsize; + + /* First, see if we loaded this frame already. */ + + for (w = as->debug_frames; w; w = w->next) + { + Debug (4, "checking %p: %lx-%lx\n", w, (long)w->start, (long)w->end); + if (addr >= w->start && addr < w->end) + return w; + } + + /* If the object name we receive is blank, there's still a chance of locating + the file by parsing /proc/self/maps. */ + + if (strcmp (dlname, "") == 0) + { + err = find_binary_for_address (addr, name, sizeof(path)); + if (err) + { + Debug (15, "tried to locate binary for 0x%" PRIx64 ", but no luck\n", + (uint64_t) addr); + return 0; + } + } + else + name = (char*) dlname; + + err = load_debug_frame (name, &buf, &bufsize, as == unw_local_addr_space); + + if (!err) + { + fdesc = malloc (sizeof (struct unw_debug_frame_list)); + + fdesc->start = start; + fdesc->end = end; + fdesc->debug_frame = buf; + fdesc->debug_frame_size = bufsize; + fdesc->index = NULL; + fdesc->next = as->debug_frames; + + as->debug_frames = fdesc; + } + + return fdesc; +} + +struct debug_frame_tab + { + struct table_entry *tab; + uint32_t length; + uint32_t size; + }; + +static struct debug_frame_tab * +debug_frame_tab_new (unsigned int base_size) +{ + struct debug_frame_tab *tab = malloc (sizeof (struct debug_frame_tab)); + + tab->tab = calloc (base_size, sizeof (struct table_entry)); + tab->length = 0; + tab->size = base_size; + + return tab; +} + +static void +debug_frame_tab_append (struct debug_frame_tab *tab, + unw_word_t fde_offset, unw_word_t start_ip) +{ + unsigned int length = tab->length; + + if (length == tab->size) + { + tab->size *= 2; + tab->tab = realloc (tab->tab, sizeof (struct table_entry) * tab->size); + } + + tab->tab[length].fde_offset = fde_offset; + tab->tab[length].start_ip_offset = start_ip; + + tab->length = length + 1; +} + +static void +debug_frame_tab_shrink (struct debug_frame_tab *tab) +{ + if (tab->size > tab->length) + { + tab->tab = realloc (tab->tab, sizeof (struct table_entry) * tab->length); + tab->size = tab->length; + } +} + +static int +debug_frame_tab_compare (const void *a, const void *b) +{ + const struct table_entry *fa = a, *fb = b; + + if (fa->start_ip_offset > fb->start_ip_offset) + return 1; + else if (fa->start_ip_offset < fb->start_ip_offset) + return -1; + else + return 0; +} + +PROTECTED int +dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, unw_word_t ip, + unw_word_t segbase, const char* obj_name, + unw_word_t start, unw_word_t end) +{ + unw_dyn_info_t *di; + struct unw_debug_frame_list *fdesc = 0; + unw_accessors_t *a; + unw_word_t addr; + + Debug (15, "Trying to find .debug_frame for %s\n", obj_name); + di = di_debug; + + fdesc = locate_debug_info (unw_local_addr_space, ip, obj_name, start, end); + + if (!fdesc) + { + Debug (15, "couldn't load .debug_frame\n"); + return found; + } + else + { + char *buf; + size_t bufsize; + unw_word_t item_start, item_end = 0; + uint32_t u32val = 0; + uint64_t cie_id = 0; + struct debug_frame_tab *tab; + + Debug (15, "loaded .debug_frame\n"); + + buf = fdesc->debug_frame; + bufsize = fdesc->debug_frame_size; + + if (bufsize == 0) + { + Debug (15, "zero-length .debug_frame\n"); + return found; + } + + /* Now create a binary-search table, if it does not already exist. */ + if (!fdesc->index) + { + addr = (unw_word_t) (uintptr_t) buf; + + a = unw_get_accessors (unw_local_addr_space); + + /* Find all FDE entries in debug_frame, and make into a sorted + index. */ + + tab = debug_frame_tab_new (16); + + while (addr < (unw_word_t) (uintptr_t) (buf + bufsize)) + { + uint64_t id_for_cie; + item_start = addr; + + dwarf_readu32 (unw_local_addr_space, a, &addr, &u32val, NULL); + + if (u32val == 0) + break; + else if (u32val != 0xffffffff) + { + uint32_t cie_id32 = 0; + item_end = addr + u32val; + dwarf_readu32 (unw_local_addr_space, a, &addr, &cie_id32, + NULL); + cie_id = cie_id32; + id_for_cie = 0xffffffff; + } + else + { + uint64_t u64val = 0; + /* Extended length. */ + dwarf_readu64 (unw_local_addr_space, a, &addr, &u64val, NULL); + item_end = addr + u64val; + + dwarf_readu64 (unw_local_addr_space, a, &addr, &cie_id, NULL); + id_for_cie = 0xffffffffffffffffull; + } + + /*Debug (1, "CIE/FDE id = %.8x\n", (int) cie_id);*/ + + if (cie_id == id_for_cie) + ; + /*Debug (1, "Found CIE at %.8x.\n", item_start);*/ + else + { + unw_word_t fde_addr = item_start; + unw_proc_info_t this_pi; + int err; + + /*Debug (1, "Found FDE at %.8x\n", item_start);*/ + + err = dwarf_extract_proc_info_from_fde (unw_local_addr_space, + a, &fde_addr, + &this_pi, 0, + (uintptr_t) buf, + NULL); + if (err == 0) + { + Debug (15, "start_ip = %lx, end_ip = %lx\n", + (long) this_pi.start_ip, (long) this_pi.end_ip); + debug_frame_tab_append (tab, + item_start - (unw_word_t) (uintptr_t) buf, + this_pi.start_ip); + } + /*else + Debug (1, "FDE parse failed\n");*/ + } + + addr = item_end; + } + + debug_frame_tab_shrink (tab); + qsort (tab->tab, tab->length, sizeof (struct table_entry), + debug_frame_tab_compare); + /* for (i = 0; i < tab->length; i++) + { + fprintf (stderr, "ip %x, fde offset %x\n", + (int) tab->tab[i].start_ip_offset, + (int) tab->tab[i].fde_offset); + }*/ + fdesc->index = tab->tab; + fdesc->index_size = tab->length; + free (tab); + } + + di->format = UNW_INFO_FORMAT_TABLE; + di->start_ip = fdesc->start; + di->end_ip = fdesc->end; + di->u.ti.name_ptr = (unw_word_t) (uintptr_t) obj_name; + di->u.ti.table_data = (unw_word_t *) fdesc; + di->u.ti.table_len = sizeof (*fdesc) / sizeof (unw_word_t); + di->u.ti.segbase = segbase; + + found = 1; + Debug (15, "found debug_frame table `%s': segbase=0x%lx, len=%lu, " + "gp=0x%lx, table_data=0x%lx\n", + (char *) (uintptr_t) di->u.ti.name_ptr, + (long) di->u.ti.segbase, (long) di->u.ti.table_len, + (long) di->gp, (long) di->u.ti.table_data); + } + return found; +} + +#endif /* CONFIG_DEBUG_FRAME */ + +#ifndef UNW_REMOTE_ONLY + +/* ptr is a pointer to a dwarf_callback_data structure and, on entry, + member ip contains the instruction-pointer we're looking + for. */ +HIDDEN int +dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) +{ + struct dwarf_callback_data *cb_data = ptr; + unw_dyn_info_t *di = &cb_data->di; + const Elf_W(Phdr) *phdr, *p_eh_hdr, *p_dynamic, *p_text; + unw_word_t addr, eh_frame_start, eh_frame_end, fde_count, ip; + Elf_W(Addr) load_base, max_load_addr = 0; + int ret, need_unwind_info = cb_data->need_unwind_info; + unw_proc_info_t *pi = cb_data->pi; + struct dwarf_eh_frame_hdr *hdr; + unw_accessors_t *a; + long n; + int found = 0; +#ifdef CONFIG_DEBUG_FRAME + unw_word_t start, end; +#endif /* CONFIG_DEBUG_FRAME*/ + + ip = cb_data->ip; + + /* Make sure struct dl_phdr_info is at least as big as we need. */ + if (size < offsetof (struct dl_phdr_info, dlpi_phnum) + + sizeof (info->dlpi_phnum)) + return -1; + + Debug (15, "checking %s, base=0x%lx)\n", + info->dlpi_name, (long) info->dlpi_addr); + + phdr = info->dlpi_phdr; + load_base = info->dlpi_addr; + p_text = NULL; + p_eh_hdr = NULL; + p_dynamic = NULL; + + /* See if PC falls into one of the loaded segments. Find the + eh-header segment at the same time. */ + for (n = info->dlpi_phnum; --n >= 0; phdr++) + { + if (phdr->p_type == PT_LOAD) + { + Elf_W(Addr) vaddr = phdr->p_vaddr + load_base; + + if (ip >= vaddr && ip < vaddr + phdr->p_memsz) + p_text = phdr; + + if (vaddr + phdr->p_filesz > max_load_addr) + max_load_addr = vaddr + phdr->p_filesz; + } + else if (phdr->p_type == PT_GNU_EH_FRAME) + p_eh_hdr = phdr; + else if (phdr->p_type == PT_DYNAMIC) + p_dynamic = phdr; + } + + if (!p_text) + return 0; + + if (p_eh_hdr) + { + if (p_dynamic) + { + /* For dynamicly linked executables and shared libraries, + DT_PLTGOT is the value that data-relative addresses are + relative to for that object. We call this the "gp". */ + Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(p_dynamic->p_vaddr + load_base); + for (; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_PLTGOT) + { + /* Assume that _DYNAMIC is writable and GLIBC has + relocated it (true for x86 at least). */ + di->gp = dyn->d_un.d_ptr; + break; + } + } + else + /* Otherwise this is a static executable with no _DYNAMIC. Assume + that data-relative addresses are relative to 0, i.e., + absolute. */ + di->gp = 0; + pi->gp = di->gp; + + hdr = (struct dwarf_eh_frame_hdr *) (p_eh_hdr->p_vaddr + load_base); + if (hdr->version != DW_EH_VERSION) + { + Debug (1, "table `%s' has unexpected version %d\n", + info->dlpi_name, hdr->version); + return 0; + } + + a = unw_get_accessors (unw_local_addr_space); + addr = (unw_word_t) (uintptr_t) (hdr + 1); + + /* (Optionally) read eh_frame_ptr: */ + if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, + &addr, hdr->eh_frame_ptr_enc, pi, + &eh_frame_start, NULL)) < 0) + return ret; + + /* (Optionally) read fde_count: */ + if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, + &addr, hdr->fde_count_enc, pi, + &fde_count, NULL)) < 0) + return ret; + + if (hdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4)) + { + /* If there is no search table or it has an unsupported + encoding, fall back on linear search. */ + if (hdr->table_enc == DW_EH_PE_omit) + Debug (4, "table `%s' lacks search table; doing linear search\n", + info->dlpi_name); + else + Debug (4, "table `%s' has encoding 0x%x; doing linear search\n", + info->dlpi_name, hdr->table_enc); + + eh_frame_end = max_load_addr; /* XXX can we do better? */ + + if (hdr->fde_count_enc == DW_EH_PE_omit) + fde_count = ~0UL; + if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit) + abort (); + + /* XXX we know how to build a local binary search table for + .debug_frame, so we could do that here too. */ + cb_data->single_fde = 1; + found = linear_search (unw_local_addr_space, ip, + eh_frame_start, eh_frame_end, fde_count, + pi, need_unwind_info, NULL); + if (found != 1) + found = 0; + } + else + { + di->format = UNW_INFO_FORMAT_REMOTE_TABLE; + di->start_ip = p_text->p_vaddr + load_base; + di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz; + di->u.rti.name_ptr = (unw_word_t) (uintptr_t) info->dlpi_name; + di->u.rti.table_data = addr; + assert (sizeof (struct table_entry) % sizeof (unw_word_t) == 0); + di->u.rti.table_len = (fde_count * sizeof (struct table_entry) + / sizeof (unw_word_t)); + /* For the binary-search table in the eh_frame_hdr, data-relative + means relative to the start of that section... */ + di->u.rti.segbase = (unw_word_t) (uintptr_t) hdr; + + found = 1; + Debug (15, "found table `%s': segbase=0x%lx, len=%lu, gp=0x%lx, " + "table_data=0x%lx\n", (char *) (uintptr_t) di->u.rti.name_ptr, + (long) di->u.rti.segbase, (long) di->u.rti.table_len, + (long) di->gp, (long) di->u.rti.table_data); + } + } + +#ifdef CONFIG_DEBUG_FRAME + /* Find the start/end of the described region by parsing the phdr_info + structure. */ + start = (unw_word_t) -1; + end = 0; + + for (n = 0; n < info->dlpi_phnum; n++) + { + if (info->dlpi_phdr[n].p_type == PT_LOAD) + { + unw_word_t seg_start = info->dlpi_addr + info->dlpi_phdr[n].p_vaddr; + unw_word_t seg_end = seg_start + info->dlpi_phdr[n].p_memsz; + + if (seg_start < start) + start = seg_start; + + if (seg_end > end) + end = seg_end; + } + } + + found = dwarf_find_debug_frame (found, &cb_data->di_debug, ip, + info->dlpi_addr, info->dlpi_name, start, + end); +#endif /* CONFIG_DEBUG_FRAME */ + + return found; +} + +HIDDEN int +dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, void *arg) +{ + struct dwarf_callback_data cb_data; + intrmask_t saved_mask; + int ret; + + Debug (14, "looking for IP=0x%lx\n", (long) ip); + + memset (&cb_data, 0, sizeof (cb_data)); + cb_data.ip = ip; + cb_data.pi = pi; + cb_data.need_unwind_info = need_unwind_info; + cb_data.di.format = -1; + cb_data.di_debug.format = -1; + + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); + ret = dl_iterate_phdr (dwarf_callback, &cb_data); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); + + if (ret <= 0) + { + Debug (14, "IP=0x%lx not found\n", (long) ip); + return -UNW_ENOINFO; + } + + if (cb_data.single_fde) + /* already got the result in *pi */ + return 0; + + /* search the table: */ + if (cb_data.di.format != -1) + ret = dwarf_search_unwind_table (as, ip, &cb_data.di, + pi, need_unwind_info, arg); + else + ret = -UNW_ENOINFO; + + if (ret == -UNW_ENOINFO && cb_data.di_debug.format != -1) + ret = dwarf_search_unwind_table (as, ip, &cb_data.di_debug, pi, + need_unwind_info, arg); + return ret; +} + +static inline const struct table_entry * +lookup (const struct table_entry *table, size_t table_size, int32_t rel_ip) +{ + unsigned long table_len = table_size / sizeof (struct table_entry); + const struct table_entry *e = 0; + unsigned long lo, hi, mid; + + /* do a binary search for right entry: */ + for (lo = 0, hi = table_len; lo < hi;) + { + mid = (lo + hi) / 2; + e = table + mid; + Debug (15, "e->start_ip_offset = %lx\n", (long) e->start_ip_offset); + if (rel_ip < e->start_ip_offset) + hi = mid; + else + lo = mid + 1; + } + if (hi <= 0) + return NULL; + e = table + hi - 1; + return e; +} + +#endif /* !UNW_REMOTE_ONLY */ + +#ifndef UNW_LOCAL_ONLY + +/* Lookup an unwind-table entry in remote memory. Returns 1 if an + entry is found, 0 if no entry is found, negative if an error + occurred reading remote memory. */ +static int +remote_lookup (unw_addr_space_t as, + unw_word_t table, size_t table_size, int32_t rel_ip, + struct table_entry *e, void *arg) +{ + unsigned long table_len = table_size / sizeof (struct table_entry); + unw_accessors_t *a = unw_get_accessors (as); + unsigned long lo, hi, mid; + unw_word_t e_addr = 0; + int32_t start; + int ret; + + /* do a binary search for right entry: */ + for (lo = 0, hi = table_len; lo < hi;) + { + mid = (lo + hi) / 2; + e_addr = table + mid * sizeof (struct table_entry); + if ((ret = dwarf_reads32 (as, a, &e_addr, &start, arg)) < 0) + return ret; + + if (rel_ip < start) + hi = mid; + else + lo = mid + 1; + } + if (hi <= 0) + return 0; + e_addr = table + (hi - 1) * sizeof (struct table_entry); + if ((ret = dwarf_reads32 (as, a, &e_addr, &e->start_ip_offset, arg)) < 0 + || (ret = dwarf_reads32 (as, a, &e_addr, &e->fde_offset, arg)) < 0) + return ret; + return 1; +} + +#endif /* !UNW_LOCAL_ONLY */ + +PROTECTED int +dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + const struct table_entry *e = NULL, *table; + unw_word_t segbase = 0, fde_addr; + unw_accessors_t *a; +#ifndef UNW_LOCAL_ONLY + struct table_entry ent; +#endif + int ret; + unw_word_t debug_frame_base; + size_t table_len; + +#ifdef UNW_REMOTE_ONLY + assert (di->format == UNW_INFO_FORMAT_REMOTE_TABLE); +#else + assert (di->format == UNW_INFO_FORMAT_REMOTE_TABLE + || di->format == UNW_INFO_FORMAT_TABLE); +#endif + assert (ip >= di->start_ip && ip < di->end_ip); + + if (di->format == UNW_INFO_FORMAT_REMOTE_TABLE) + { + table = (const struct table_entry *) (uintptr_t) di->u.rti.table_data; + table_len = di->u.rti.table_len * sizeof (unw_word_t); + debug_frame_base = 0; + } + else + { +#ifndef UNW_REMOTE_ONLY + struct unw_debug_frame_list *fdesc = (void *) di->u.ti.table_data; + + /* UNW_INFO_FORMAT_TABLE (i.e. .debug_frame) is read from local address + space. Both the index and the unwind tables live in local memory, but + the address space to check for properties like the address size and + endianness is the target one. */ + as = unw_local_addr_space; + table = fdesc->index; + table_len = fdesc->index_size * sizeof (struct table_entry); + debug_frame_base = (uintptr_t) fdesc->debug_frame; +#endif + } + + a = unw_get_accessors (as); + +#ifndef UNW_REMOTE_ONLY + if (as == unw_local_addr_space) + { + segbase = di->u.rti.segbase; + e = lookup (table, table_len, ip - segbase); + } + else +#endif + { +#ifndef UNW_LOCAL_ONLY + segbase = di->u.rti.segbase; + if ((ret = remote_lookup (as, (uintptr_t) table, table_len, + ip - segbase, &ent, arg)) < 0) + return ret; + if (ret) + e = &ent; + else + e = NULL; /* no info found */ +#endif + } + if (!e) + { + Debug (1, "IP %lx inside range %lx-%lx, but no explicit unwind info found\n", + (long) ip, (long) di->start_ip, (long) di->end_ip); + /* IP is inside this table's range, but there is no explicit + unwind info. */ + return -UNW_ENOINFO; + } + Debug (15, "ip=0x%lx, start_ip=0x%lx\n", + (long) ip, (long) (e->start_ip_offset)); + if (debug_frame_base) + fde_addr = e->fde_offset + debug_frame_base; + else + fde_addr = e->fde_offset + segbase; + Debug (1, "e->fde_offset = %lx, segbase = %lx, debug_frame_base = %lx, " + "fde_addr = %lx\n", (long) e->fde_offset, (long) segbase, + (long) debug_frame_base, (long) fde_addr); + if ((ret = dwarf_extract_proc_info_from_fde (as, a, &fde_addr, pi, + need_unwind_info, + debug_frame_base, arg)) < 0) + return ret; + + /* .debug_frame uses an absolute encoding that does not know about any + shared library relocation. */ + if (di->format == UNW_INFO_FORMAT_TABLE) + { + pi->start_ip += segbase; + pi->end_ip += segbase; + pi->flags = UNW_PI_FLAG_DEBUG_FRAME; + } + + if (ip < pi->start_ip || ip >= pi->end_ip) + return -UNW_ENOINFO; + + return 0; +} + +HIDDEN void +dwarf_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg) +{ + return; /* always a nop */ +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gfind_unwind_table.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gfind_unwind_table.c new file mode 100644 index 0000000000..ae70fc1b97 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gfind_unwind_table.c @@ -0,0 +1,228 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include +#include + +#include + +#include "libunwind_i.h" +#include "dwarf-eh.h" +#include "dwarf_i.h" + +int +dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, + char *path, unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip) +{ + Elf_W(Phdr) *phdr, *ptxt = NULL, *peh_hdr = NULL, *pdyn = NULL; + unw_word_t addr, eh_frame_start, fde_count, load_base; + unw_word_t max_load_addr = 0; + unw_word_t start_ip = (unw_word_t) -1; + unw_word_t end_ip = 0; + struct dwarf_eh_frame_hdr *hdr; + unw_proc_info_t pi; + unw_accessors_t *a; + Elf_W(Ehdr) *ehdr; +#if UNW_TARGET_ARM + const Elf_W(Phdr) *parm_exidx = NULL; +#endif + int i, ret, found = 0; + + /* XXX: Much of this code is Linux/LSB-specific. */ + + if (!elf_w(valid_object) (&edi->ei)) + return -UNW_ENOINFO; + + ehdr = edi->ei.image; + phdr = (Elf_W(Phdr) *) ((char *) edi->ei.image + ehdr->e_phoff); + + for (i = 0; i < ehdr->e_phnum; ++i) + { + switch (phdr[i].p_type) + { + case PT_LOAD: + if (phdr[i].p_vaddr < start_ip) + start_ip = phdr[i].p_vaddr; + + if (phdr[i].p_vaddr + phdr[i].p_memsz > end_ip) + end_ip = phdr[i].p_vaddr + phdr[i].p_memsz; + + if (phdr[i].p_offset == mapoff) + ptxt = phdr + i; + if ((uintptr_t) edi->ei.image + phdr->p_filesz > max_load_addr) + max_load_addr = (uintptr_t) edi->ei.image + phdr->p_filesz; + break; + + case PT_GNU_EH_FRAME: + peh_hdr = phdr + i; + break; + + case PT_DYNAMIC: + pdyn = phdr + i; + break; + +#if UNW_TARGET_ARM + case PT_ARM_EXIDX: + parm_exidx = phdr + i; + break; +#endif + + default: + break; + } + } + + if (!ptxt) + return 0; + + load_base = segbase - ptxt->p_vaddr; + start_ip += load_base; + end_ip += load_base; + + if (peh_hdr) + { + if (pdyn) + { + /* For dynamicly linked executables and shared libraries, + DT_PLTGOT is the value that data-relative addresses are + relative to for that object. We call this the "gp". */ + Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(pdyn->p_offset + + (char *) edi->ei.image); + for (; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_PLTGOT) + { + /* Assume that _DYNAMIC is writable and GLIBC has + relocated it (true for x86 at least). */ + edi->di_cache.gp = dyn->d_un.d_ptr; + break; + } + } + else + /* Otherwise this is a static executable with no _DYNAMIC. Assume + that data-relative addresses are relative to 0, i.e., + absolute. */ + edi->di_cache.gp = 0; + + hdr = (struct dwarf_eh_frame_hdr *) (peh_hdr->p_offset + + (char *) edi->ei.image); + if (hdr->version != DW_EH_VERSION) + { + Debug (1, "table `%s' has unexpected version %d\n", + path, hdr->version); + return -UNW_ENOINFO; + } + + a = unw_get_accessors (unw_local_addr_space); + addr = (unw_word_t) (hdr + 1); + + /* Fill in a dummy proc_info structure. We just need to fill in + enough to ensure that dwarf_read_encoded_pointer() can do it's + job. Since we don't have a procedure-context at this point, all + we have to do is fill in the global-pointer. */ + memset (&pi, 0, sizeof (pi)); + pi.gp = edi->di_cache.gp; + + /* (Optionally) read eh_frame_ptr: */ + if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, + &addr, hdr->eh_frame_ptr_enc, &pi, + &eh_frame_start, NULL)) < 0) + return -UNW_ENOINFO; + + /* (Optionally) read fde_count: */ + if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, + &addr, hdr->fde_count_enc, &pi, + &fde_count, NULL)) < 0) + return -UNW_ENOINFO; + + if (hdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4)) + { + #if 1 + abort (); + #else + unw_word_t eh_frame_end; + + /* If there is no search table or it has an unsupported + encoding, fall back on linear search. */ + if (hdr->table_enc == DW_EH_PE_omit) + Debug (4, "EH lacks search table; doing linear search\n"); + else + Debug (4, "EH table has encoding 0x%x; doing linear search\n", + hdr->table_enc); + + eh_frame_end = max_load_addr; /* XXX can we do better? */ + + if (hdr->fde_count_enc == DW_EH_PE_omit) + fde_count = ~0UL; + if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit) + abort (); + + return linear_search (unw_local_addr_space, ip, + eh_frame_start, eh_frame_end, fde_count, + pi, need_unwind_info, NULL); + #endif + } + + edi->di_cache.start_ip = start_ip; + edi->di_cache.end_ip = end_ip; + edi->di_cache.format = UNW_INFO_FORMAT_REMOTE_TABLE; + edi->di_cache.u.rti.name_ptr = 0; + /* two 32-bit values (ip_offset/fde_offset) per table-entry: */ + edi->di_cache.u.rti.table_len = (fde_count * 8) / sizeof (unw_word_t); + edi->di_cache.u.rti.table_data = ((load_base + peh_hdr->p_vaddr) + + (addr - (unw_word_t) edi->ei.image + - peh_hdr->p_offset)); + + /* For the binary-search table in the eh_frame_hdr, data-relative + means relative to the start of that section... */ + edi->di_cache.u.rti.segbase = ((load_base + peh_hdr->p_vaddr) + + ((unw_word_t) hdr - (unw_word_t) edi->ei.image + - peh_hdr->p_offset)); + found = 1; + } + +#if UNW_TARGET_ARM + if (parm_exidx) + { + edi->di_arm.format = UNW_INFO_FORMAT_ARM_EXIDX; + edi->di_arm.start_ip = start_ip; + edi->di_arm.end_ip = end_ip; + edi->di_arm.u.rti.name_ptr = (unw_word_t) path; + edi->di_arm.u.rti.table_data = load_base + parm_exidx->p_vaddr; + edi->di_arm.u.rti.table_len = parm_exidx->p_memsz; + found = 1; + } +#endif + +#ifdef CONFIG_DEBUG_FRAME + /* Try .debug_frame. */ + found = dwarf_find_debug_frame (found, &edi->edi.di_debug, ip, segbase, path, + start_ip, end_ip); +#endif + + return found; +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gparser.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gparser.c new file mode 100644 index 0000000000..ca26afb56c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gparser.c @@ -0,0 +1,908 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include "dwarf_i.h" +#include "libunwind_i.h" + +#define alloc_reg_state() (mempool_alloc (&dwarf_reg_state_pool)) +#define free_reg_state(rs) (mempool_free (&dwarf_reg_state_pool, rs)) + +static inline int +read_regnum (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + unw_word_t *valp, void *arg) +{ + int ret; + + if ((ret = dwarf_read_uleb128 (as, a, addr, valp, arg)) < 0) + return ret; + + if (*valp >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u\n", (unsigned int) *valp); + return -UNW_EBADREG; + } + return 0; +} + +static inline void +set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where, + unw_word_t val) +{ + sr->rs_current.reg[regnum].where = where; + sr->rs_current.reg[regnum].val = val; +} + +/* Run a CFI program to update the register state. */ +static int +run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr, + unw_word_t ip, unw_word_t *addr, unw_word_t end_addr, + struct dwarf_cie_info *dci) +{ + unw_word_t curr_ip, operand = 0, regnum, val, len, fde_encoding; + dwarf_reg_state_t *rs_stack = NULL, *new_rs, *old_rs; + unw_addr_space_t as; + unw_accessors_t *a; + uint8_t u8, op; + uint16_t u16; + uint32_t u32; + void *arg; + int ret; + + as = c->as; + arg = c->as_arg; + if (c->pi.flags & UNW_PI_FLAG_DEBUG_FRAME) + { + /* .debug_frame CFI is stored in local address space. */ + as = unw_local_addr_space; + arg = NULL; + } + a = unw_get_accessors (as); + curr_ip = c->pi.start_ip; + + /* Process everything up to and including the current 'ip', + including all the DW_CFA_advance_loc instructions. See + 'c->use_prev_instr' use in 'fetch_proc_info' for details. */ + while (curr_ip <= ip && *addr < end_addr) + { + if ((ret = dwarf_readu8 (as, a, addr, &op, arg)) < 0) + return ret; + + if (op & DWARF_CFA_OPCODE_MASK) + { + operand = op & DWARF_CFA_OPERAND_MASK; + op &= ~DWARF_CFA_OPERAND_MASK; + } + switch ((dwarf_cfa_t) op) + { + case DW_CFA_advance_loc: + curr_ip += operand * dci->code_align; + Debug (15, "CFA_advance_loc to 0x%lx\n", (long) curr_ip); + break; + + case DW_CFA_advance_loc1: + if ((ret = dwarf_readu8 (as, a, addr, &u8, arg)) < 0) + goto fail; + curr_ip += u8 * dci->code_align; + Debug (15, "CFA_advance_loc1 to 0x%lx\n", (long) curr_ip); + break; + + case DW_CFA_advance_loc2: + if ((ret = dwarf_readu16 (as, a, addr, &u16, arg)) < 0) + goto fail; + curr_ip += u16 * dci->code_align; + Debug (15, "CFA_advance_loc2 to 0x%lx\n", (long) curr_ip); + break; + + case DW_CFA_advance_loc4: + if ((ret = dwarf_readu32 (as, a, addr, &u32, arg)) < 0) + goto fail; + curr_ip += u32 * dci->code_align; + Debug (15, "CFA_advance_loc4 to 0x%lx\n", (long) curr_ip); + break; + + case DW_CFA_MIPS_advance_loc8: +#ifdef UNW_TARGET_MIPS + { + uint64_t u64; + + if ((ret = dwarf_readu64 (as, a, addr, &u64, arg)) < 0) + goto fail; + curr_ip += u64 * dci->code_align; + Debug (15, "CFA_MIPS_advance_loc8\n"); + break; + } +#else + Debug (1, "DW_CFA_MIPS_advance_loc8 on non-MIPS target\n"); + ret = -UNW_EINVAL; + goto fail; +#endif + + case DW_CFA_offset: + regnum = operand; + if (regnum >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u in DW_cfa_OFFSET\n", + (unsigned int) regnum); + ret = -UNW_EBADREG; + goto fail; + } + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); + Debug (15, "CFA_offset r%lu at cfa+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; + + case DW_CFA_offset_extended: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); + Debug (15, "CFA_offset_extended r%lu at cf+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; + + case DW_CFA_offset_extended_sf: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); + Debug (15, "CFA_offset_extended_sf r%lu at cf+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; + + case DW_CFA_restore: + regnum = operand; + if (regnum >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u in DW_CFA_restore\n", + (unsigned int) regnum); + ret = -UNW_EINVAL; + goto fail; + } + sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; + Debug (15, "CFA_restore r%lu\n", (long) regnum); + break; + + case DW_CFA_restore_extended: + if ((ret = dwarf_read_uleb128 (as, a, addr, ®num, arg)) < 0) + goto fail; + if (regnum >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u in " + "DW_CFA_restore_extended\n", (unsigned int) regnum); + ret = -UNW_EINVAL; + goto fail; + } + sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; + Debug (15, "CFA_restore_extended r%lu\n", (long) regnum); + break; + + case DW_CFA_nop: + break; + + case DW_CFA_set_loc: + fde_encoding = dci->fde_encoding; + if ((ret = dwarf_read_encoded_pointer (as, a, addr, fde_encoding, + &c->pi, &curr_ip, + arg)) < 0) + goto fail; + Debug (15, "CFA_set_loc to 0x%lx\n", (long) curr_ip); + break; + + case DW_CFA_undefined: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_UNDEF, 0); + Debug (15, "CFA_undefined r%lu\n", (long) regnum); + break; + + case DW_CFA_same_value: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_SAME, 0); + Debug (15, "CFA_same_value r%lu\n", (long) regnum); + break; + + case DW_CFA_register: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_REG, val); + Debug (15, "CFA_register r%lu to r%lu\n", (long) regnum, (long) val); + break; + + case DW_CFA_remember_state: + new_rs = alloc_reg_state (); + if (!new_rs) + { + Debug (1, "Out of memory in DW_CFA_remember_state\n"); + ret = -UNW_ENOMEM; + goto fail; + } + + memcpy (new_rs->reg, sr->rs_current.reg, sizeof (new_rs->reg)); + new_rs->next = rs_stack; + rs_stack = new_rs; + Debug (15, "CFA_remember_state\n"); + break; + + case DW_CFA_restore_state: + if (!rs_stack) + { + Debug (1, "register-state stack underflow\n"); + ret = -UNW_EINVAL; + goto fail; + } + memcpy (&sr->rs_current.reg, &rs_stack->reg, sizeof (rs_stack->reg)); + old_rs = rs_stack; + rs_stack = rs_stack->next; + free_reg_state (old_rs); + Debug (15, "CFA_restore_state\n"); + break; + + case DW_CFA_def_cfa: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */ + Debug (15, "CFA_def_cfa r%lu+0x%lx\n", (long) regnum, (long) val); + break; + + case DW_CFA_def_cfa_sf: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, + val * dci->data_align); /* factored! */ + Debug (15, "CFA_def_cfa_sf r%lu+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; + + case DW_CFA_def_cfa_register: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); + Debug (15, "CFA_def_cfa_register r%lu\n", (long) regnum); + break; + + case DW_CFA_def_cfa_offset: + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */ + Debug (15, "CFA_def_cfa_offset 0x%lx\n", (long) val); + break; + + case DW_CFA_def_cfa_offset_sf: + if ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, + val * dci->data_align); /* factored! */ + Debug (15, "CFA_def_cfa_offset_sf 0x%lx\n", + (long) (val * dci->data_align)); + break; + + case DW_CFA_def_cfa_expression: + /* Save the address of the DW_FORM_block for later evaluation. */ + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_EXPR, *addr); + + if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0) + goto fail; + + Debug (15, "CFA_def_cfa_expr @ 0x%lx [%lu bytes]\n", + (long) *addr, (long) len); + *addr += len; + break; + + case DW_CFA_expression: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + + /* Save the address of the DW_FORM_block for later evaluation. */ + set_reg (sr, regnum, DWARF_WHERE_EXPR, *addr); + + if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0) + goto fail; + + Debug (15, "CFA_expression r%lu @ 0x%lx [%lu bytes]\n", + (long) regnum, (long) addr, (long) len); + *addr += len; + break; + + case DW_CFA_GNU_args_size: + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + sr->args_size = val; + Debug (15, "CFA_GNU_args_size %lu\n", (long) val); + break; + + case DW_CFA_GNU_negative_offset_extended: + /* A comment in GCC says that this is obsoleted by + DW_CFA_offset_extended_sf, but that it's used by older + PowerPC code. */ + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, -(val * dci->data_align)); + Debug (15, "CFA_GNU_negative_offset_extended cfa+0x%lx\n", + (long) -(val * dci->data_align)); + break; + + case DW_CFA_GNU_window_save: +#ifdef UNW_TARGET_SPARC + /* This is a special CFA to handle all 16 windowed registers + on SPARC. */ + for (regnum = 16; regnum < 32; ++regnum) + set_reg (sr, regnum, DWARF_WHERE_CFAREL, + (regnum - 16) * sizeof (unw_word_t)); + Debug (15, "CFA_GNU_window_save\n"); + break; +#else + /* FALL THROUGH */ +#endif + case DW_CFA_lo_user: + case DW_CFA_hi_user: + Debug (1, "Unexpected CFA opcode 0x%x\n", op); + ret = -UNW_EINVAL; + goto fail; + } + } + ret = 0; + + fail: + /* Free the register-state stack, if not empty already. */ + while (rs_stack) + { + old_rs = rs_stack; + rs_stack = rs_stack->next; + free_reg_state (old_rs); + } + return ret; +} + +static int +fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info) +{ + int ret, dynamic = 1; + + /* The 'ip' can point either to the previous or next instruction + depending on what type of frame we have: normal call or a place + to resume execution (e.g. after signal frame). + + For a normal call frame we need to back up so we point within the + call itself; this is important because a) the call might be the + very last instruction of the function and the edge of the FDE, + and b) so that run_cfi_program() runs locations up to the call + but not more. + + For execution resume, we need to do the exact opposite and look + up using the current 'ip' value. That is where execution will + continue, and it's important we get this right, as 'ip' could be + right at the function entry and hence FDE edge, or at instruction + that manipulates CFA (push/pop). */ + if (c->use_prev_instr) + --ip; + + if (c->pi_valid && !need_unwind_info) + return 0; + + memset (&c->pi, 0, sizeof (c->pi)); + + /* check dynamic info first --- it overrides everything else */ + ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, need_unwind_info, + c->as_arg); + if (ret == -UNW_ENOINFO) + { + dynamic = 0; + if ((ret = tdep_find_proc_info (c, ip, need_unwind_info)) < 0) + return ret; + } + + if (c->pi.format != UNW_INFO_FORMAT_DYNAMIC + && c->pi.format != UNW_INFO_FORMAT_TABLE + && c->pi.format != UNW_INFO_FORMAT_REMOTE_TABLE) + return -UNW_ENOINFO; + + c->pi_valid = 1; + c->pi_is_dynamic = dynamic; + + /* Let system/machine-dependent code determine frame-specific attributes. */ + if (ret >= 0) + tdep_fetch_frame (c, ip, need_unwind_info); + + /* Update use_prev_instr for the next frame. */ + if (need_unwind_info) + { + assert(c->pi.unwind_info); + struct dwarf_cie_info *dci = c->pi.unwind_info; + c->use_prev_instr = ! dci->signal_frame; + } + + return ret; +} + +static int +parse_dynamic (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr) +{ + Debug (1, "Not yet implemented\n"); +#if 0 + /* Don't forget to set the ret_addr_column! */ + c->ret_addr_column = XXX; +#endif + return -UNW_ENOINFO; +} + +static inline void +put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi) +{ + if (!c->pi_valid) + return; + + if (c->pi_is_dynamic) + unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg); + else if (pi->unwind_info) + { + mempool_free (&dwarf_cie_info_pool, pi->unwind_info); + pi->unwind_info = NULL; + } +} + +static inline int +parse_fde (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr) +{ + struct dwarf_cie_info *dci; + unw_word_t addr; + int ret; + + dci = c->pi.unwind_info; + c->ret_addr_column = dci->ret_addr_column; + + addr = dci->cie_instr_start; + if ((ret = run_cfi_program (c, sr, ~(unw_word_t) 0, &addr, + dci->cie_instr_end, dci)) < 0) + return ret; + + memcpy (&sr->rs_initial, &sr->rs_current, sizeof (sr->rs_initial)); + + addr = dci->fde_instr_start; + if ((ret = run_cfi_program (c, sr, ip, &addr, dci->fde_instr_end, dci)) < 0) + return ret; + + return 0; +} + +static inline void +flush_rs_cache (struct dwarf_rs_cache *cache) +{ + int i; + + cache->lru_head = DWARF_UNW_CACHE_SIZE - 1; + cache->lru_tail = 0; + + for (i = 0; i < DWARF_UNW_CACHE_SIZE; ++i) + { + if (i > 0) + cache->buckets[i].lru_chain = (i - 1); + cache->buckets[i].coll_chain = -1; + cache->buckets[i].ip = 0; + cache->buckets[i].valid = 0; + } + for (i = 0; ihash[i] = -1; +} + +static inline struct dwarf_rs_cache * +get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp) +{ + struct dwarf_rs_cache *cache = &as->global_cache; + unw_caching_policy_t caching = as->caching_policy; + + if (caching == UNW_CACHE_NONE) + return NULL; + + if (likely (caching == UNW_CACHE_GLOBAL)) + { + Debug (16, "%s: acquiring lock\n", __FUNCTION__); + lock_acquire (&cache->lock, *saved_maskp); + } + + if (atomic_read (&as->cache_generation) != atomic_read (&cache->generation)) + { + flush_rs_cache (cache); + cache->generation = as->cache_generation; + } + + return cache; +} + +static inline void +put_rs_cache (unw_addr_space_t as, struct dwarf_rs_cache *cache, + intrmask_t *saved_maskp) +{ + assert (as->caching_policy != UNW_CACHE_NONE); + + Debug (16, "unmasking signals/interrupts and releasing lock\n"); + if (likely (as->caching_policy == UNW_CACHE_GLOBAL)) + lock_release (&cache->lock, *saved_maskp); +} + +static inline unw_hash_index_t +hash (unw_word_t ip) +{ + /* based on (sqrt(5)/2-1)*2^64 */ +# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL) + + return ip * magic >> ((sizeof(unw_word_t) * 8) - DWARF_LOG_UNW_HASH_SIZE); +} + +static inline long +cache_match (dwarf_reg_state_t *rs, unw_word_t ip) +{ + if (rs->valid && (ip == rs->ip)) + return 1; + return 0; +} + +static dwarf_reg_state_t * +rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c) +{ + dwarf_reg_state_t *rs = cache->buckets + c->hint; + unsigned short index; + unw_word_t ip; + + ip = c->ip; + + if (cache_match (rs, ip)) + return rs; + + index = cache->hash[hash (ip)]; + if (index >= DWARF_UNW_CACHE_SIZE) + return 0; + + rs = cache->buckets + index; + while (1) + { + if (cache_match (rs, ip)) + { + /* update hint; no locking needed: single-word writes are atomic */ + c->hint = cache->buckets[c->prev_rs].hint = + (rs - cache->buckets); + return rs; + } + if (rs->coll_chain >= DWARF_UNW_HASH_SIZE) + return 0; + rs = cache->buckets + rs->coll_chain; + } +} + +static inline dwarf_reg_state_t * +rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c) +{ + dwarf_reg_state_t *rs, *prev, *tmp; + unw_hash_index_t index; + unsigned short head; + + head = cache->lru_head; + rs = cache->buckets + head; + cache->lru_head = rs->lru_chain; + + /* re-insert rs at the tail of the LRU chain: */ + cache->buckets[cache->lru_tail].lru_chain = head; + cache->lru_tail = head; + + /* remove the old rs from the hash table (if it's there): */ + if (rs->ip) + { + index = hash (rs->ip); + tmp = cache->buckets + cache->hash[index]; + prev = 0; + while (1) + { + if (tmp == rs) + { + if (prev) + prev->coll_chain = tmp->coll_chain; + else + cache->hash[index] = tmp->coll_chain; + break; + } + else + prev = tmp; + if (tmp->coll_chain >= DWARF_UNW_CACHE_SIZE) + /* old rs wasn't in the hash-table */ + break; + tmp = cache->buckets + tmp->coll_chain; + } + } + + /* enter new rs in the hash table */ + index = hash (c->ip); + rs->coll_chain = cache->hash[index]; + cache->hash[index] = rs - cache->buckets; + + rs->hint = 0; + rs->ip = c->ip; + rs->valid = 1; + rs->ret_addr_column = c->ret_addr_column; + rs->signal_frame = 0; + tdep_cache_frame (c, rs); + + return rs; +} + +static int +create_state_record_for (struct dwarf_cursor *c, dwarf_state_record_t *sr, + unw_word_t ip) +{ + int i, ret; + + assert (c->pi_valid); + + memset (sr, 0, sizeof (*sr)); + for (i = 0; i < DWARF_NUM_PRESERVED_REGS + 2; ++i) + set_reg (sr, i, DWARF_WHERE_SAME, 0); + + switch (c->pi.format) + { + case UNW_INFO_FORMAT_TABLE: + case UNW_INFO_FORMAT_REMOTE_TABLE: + ret = parse_fde (c, ip, sr); + break; + + case UNW_INFO_FORMAT_DYNAMIC: + ret = parse_dynamic (c, ip, sr); + break; + + default: + Debug (1, "Unexpected unwind-info format %d\n", c->pi.format); + ret = -UNW_EINVAL; + } + return ret; +} + +static inline int +eval_location_expr (struct dwarf_cursor *c, unw_addr_space_t as, + unw_accessors_t *a, unw_word_t addr, + dwarf_loc_t *locp, void *arg) +{ + int ret, is_register; + unw_word_t len, val; + + /* read the length of the expression: */ + if ((ret = dwarf_read_uleb128 (as, a, &addr, &len, arg)) < 0) + return ret; + + /* evaluate the expression: */ + if ((ret = dwarf_eval_expr (c, &addr, len, &val, &is_register)) < 0) + return ret; + + if (is_register) + *locp = DWARF_REG_LOC (c, dwarf_to_unw_regnum (val)); + else + *locp = DWARF_MEM_LOC (c, val); + + return 0; +} + +static int +apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs) +{ + unw_word_t regnum, addr, cfa, ip; + unw_word_t prev_ip, prev_cfa; + unw_addr_space_t as; + dwarf_loc_t cfa_loc; + unw_accessors_t *a; + int i, ret; + void *arg; + + prev_ip = c->ip; + prev_cfa = c->cfa; + + as = c->as; + arg = c->as_arg; + a = unw_get_accessors (as); + + /* Evaluate the CFA first, because it may be referred to by other + expressions. */ + + if (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) + { + /* CFA is equal to [reg] + offset: */ + + /* As a special-case, if the stack-pointer is the CFA and the + stack-pointer wasn't saved, popping the CFA implicitly pops + the stack-pointer as well. */ + if ((rs->reg[DWARF_CFA_REG_COLUMN].val == UNW_TDEP_SP) + && (UNW_TDEP_SP < ARRAY_SIZE(rs->reg)) + && (rs->reg[UNW_TDEP_SP].where == DWARF_WHERE_SAME)) + cfa = c->cfa; + else + { + regnum = dwarf_to_unw_regnum (rs->reg[DWARF_CFA_REG_COLUMN].val); + if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0) + return ret; + } + cfa += rs->reg[DWARF_CFA_OFF_COLUMN].val; + } + else + { + /* CFA is equal to EXPR: */ + + assert (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_EXPR); + + addr = rs->reg[DWARF_CFA_REG_COLUMN].val; + if ((ret = eval_location_expr (c, as, a, addr, &cfa_loc, arg)) < 0) + return ret; + /* the returned location better be a memory location... */ + if (DWARF_IS_REG_LOC (cfa_loc)) + return -UNW_EBADFRAME; + cfa = DWARF_GET_LOC (cfa_loc); + } + + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + { + switch ((dwarf_where_t) rs->reg[i].where) + { + case DWARF_WHERE_UNDEF: + c->loc[i] = DWARF_NULL_LOC; + break; + + case DWARF_WHERE_SAME: + break; + + case DWARF_WHERE_CFAREL: + c->loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg[i].val); + break; + + case DWARF_WHERE_REG: + c->loc[i] = DWARF_REG_LOC (c, dwarf_to_unw_regnum (rs->reg[i].val)); + break; + + case DWARF_WHERE_EXPR: + addr = rs->reg[i].val; + if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0) + return ret; + break; + } + } + + c->cfa = cfa; + /* DWARF spec says undefined return address location means end of stack. */ + if (DWARF_IS_NULL_LOC (c->loc[c->ret_addr_column])) + c->ip = 0; + else + { + ret = dwarf_get (c, c->loc[c->ret_addr_column], &ip); + if (ret < 0) + return ret; + c->ip = ip; + } + + /* XXX: check for ip to be code_aligned */ + if (c->ip == prev_ip && c->cfa == prev_cfa) + { + Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n", + __FUNCTION__, (long) c->ip); + return -UNW_EBADFRAME; + } + + if (c->stash_frames) + tdep_stash_frame (c, rs); + + return 0; +} + +static int +uncached_dwarf_find_save_locs (struct dwarf_cursor *c) +{ + dwarf_state_record_t sr; + int ret; + + if ((ret = fetch_proc_info (c, c->ip, 1)) < 0) + return ret; + + if ((ret = create_state_record_for (c, &sr, c->ip)) < 0) + return ret; + + if ((ret = apply_reg_state (c, &sr.rs_current)) < 0) + return ret; + + put_unwind_info (c, &c->pi); + return 0; +} + +/* The function finds the saved locations and applies the register + state as well. */ +HIDDEN int +dwarf_find_save_locs (struct dwarf_cursor *c) +{ + dwarf_state_record_t sr; + dwarf_reg_state_t *rs, rs_copy; + struct dwarf_rs_cache *cache; + int ret = 0; + intrmask_t saved_mask; + + if (c->as->caching_policy == UNW_CACHE_NONE) + return uncached_dwarf_find_save_locs (c); + + cache = get_rs_cache(c->as, &saved_mask); + rs = rs_lookup(cache, c); + + if (rs) + { + c->ret_addr_column = rs->ret_addr_column; + c->use_prev_instr = ! rs->signal_frame; + } + else + { + if ((ret = fetch_proc_info (c, c->ip, 1)) < 0 || + (ret = create_state_record_for (c, &sr, c->ip)) < 0) + { + put_rs_cache (c->as, cache, &saved_mask); + return ret; + } + + rs = rs_new (cache, c); + memcpy(rs, &sr.rs_current, offsetof(struct dwarf_reg_state, ip)); + cache->buckets[c->prev_rs].hint = rs - cache->buckets; + + c->hint = rs->hint; + c->prev_rs = rs - cache->buckets; + + put_unwind_info (c, &c->pi); + } + + memcpy (&rs_copy, rs, sizeof (rs_copy)); + put_rs_cache (c->as, cache, &saved_mask); + + tdep_reuse_frame (c, &rs_copy); + if ((ret = apply_reg_state (c, &rs_copy)) < 0) + return ret; + + return 0; +} + +/* The proc-info must be valid for IP before this routine can be + called. */ +HIDDEN int +dwarf_create_state_record (struct dwarf_cursor *c, dwarf_state_record_t *sr) +{ + return create_state_record_for (c, sr, c->ip); +} + +HIDDEN int +dwarf_make_proc_info (struct dwarf_cursor *c) +{ +#if 0 + if (c->as->caching_policy == UNW_CACHE_NONE + || get_cached_proc_info (c) < 0) +#endif + /* Lookup it up the slow way... */ + return fetch_proc_info (c, c->ip, 0); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gpe.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gpe.c new file mode 100644 index 0000000000..c271d76343 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gpe.c @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "dwarf_i.h" +#include "libunwind_i.h" + +#include + +HIDDEN int +dwarf_read_encoded_pointer (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unsigned char encoding, + const unw_proc_info_t *pi, + unw_word_t *valp, void *arg) +{ + return dwarf_read_encoded_pointer_inlined (as, a, addr, encoding, + pi, valp, arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Gstep.c b/sdk/cpprt/linux/libunwind/src/dwarf/Gstep.c new file mode 100644 index 0000000000..7d899ded1c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Gstep.c @@ -0,0 +1,41 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "dwarf.h" +#include "libunwind_i.h" + +HIDDEN int +dwarf_step (struct dwarf_cursor *c) +{ + int ret; + + if ((ret = dwarf_find_save_locs (c)) >= 0) { + c->pi_valid = 0; + ret = 1; + } + + Debug (15, "returning %d\n", ret); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lexpr.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lexpr.c new file mode 100644 index 0000000000..245970c9e3 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lexpr.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gexpr.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lfde.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lfde.c new file mode 100644 index 0000000000..e779e8f192 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lfde.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gfde.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lfind_proc_info-lsb.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lfind_proc_info-lsb.c new file mode 100644 index 0000000000..27a5eeac18 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lfind_proc_info-lsb.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gfind_proc_info-lsb.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lfind_unwind_table.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lfind_unwind_table.c new file mode 100644 index 0000000000..68e269f1d7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lfind_unwind_table.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gfind_unwind_table.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lparser.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lparser.c new file mode 100644 index 0000000000..f23aaf48e9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lparser.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gparser.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lpe.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lpe.c new file mode 100644 index 0000000000..a672358f06 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lpe.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gpe.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/Lstep.c b/sdk/cpprt/linux/libunwind/src/dwarf/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/dwarf/global.c b/sdk/cpprt/linux/libunwind/src/dwarf/global.c new file mode 100644 index 0000000000..4658ccfe88 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/dwarf/global.c @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "dwarf_i.h" + +HIDDEN struct mempool dwarf_reg_state_pool; +HIDDEN struct mempool dwarf_cie_info_pool; + +HIDDEN int +dwarf_init (void) +{ + mempool_init (&dwarf_reg_state_pool, sizeof (dwarf_reg_state_t), 0); + mempool_init (&dwarf_cie_info_pool, sizeof (struct dwarf_cie_info), 0); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/elf32.c b/sdk/cpprt/linux/libunwind/src/elf32.c new file mode 100644 index 0000000000..a70bb58f24 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/elf32.c @@ -0,0 +1,4 @@ +#ifndef UNW_REMOTE_ONLY +# include "elf32.h" +# include "elfxx.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/elf32.h b/sdk/cpprt/linux/libunwind/src/elf32.h new file mode 100644 index 0000000000..63fef83637 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/elf32.h @@ -0,0 +1,9 @@ +#ifndef elf32_h +#define elf32_h + +#ifndef ELF_CLASS +#define ELF_CLASS ELFCLASS32 +#endif +#include "elfxx.h" + +#endif /* elf32_h */ diff --git a/sdk/cpprt/linux/libunwind/src/elf64.c b/sdk/cpprt/linux/libunwind/src/elf64.c new file mode 100644 index 0000000000..195b887948 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/elf64.c @@ -0,0 +1,4 @@ +#ifndef UNW_REMOTE_ONLY +# include "elf64.h" +# include "elfxx.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/elf64.h b/sdk/cpprt/linux/libunwind/src/elf64.h new file mode 100644 index 0000000000..fd10ed824c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/elf64.h @@ -0,0 +1,9 @@ +#ifndef elf64_h +#define elf64_h + +#ifndef ELF_CLASS +#define ELF_CLASS ELFCLASS64 +#endif +#include "elfxx.h" + +#endif /* elf64_h */ diff --git a/sdk/cpprt/linux/libunwind/src/elfxx.c b/sdk/cpprt/linux/libunwind/src/elfxx.c new file mode 100644 index 0000000000..844cc1c98a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/elfxx.c @@ -0,0 +1,174 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "libunwind_i.h" + +static int +elf_w (lookup_symbol) (unw_addr_space_t as, + unw_word_t ip, struct elf_image *ei, + Elf_W (Addr) load_offset, + char *buf, size_t buf_len, unw_word_t *offp) +{ + size_t syment_size; + Elf_W (Ehdr) *ehdr = ei->image; + Elf_W (Sym) *sym, *symtab, *symtab_end; + Elf_W (Off) soff, str_soff; + Elf_W (Shdr) *shdr, *str_shdr; + Elf_W (Addr) val, min_dist = ~(Elf_W (Addr))0; + int i, ret = 0; + char *strtab; + + if (!elf_w (valid_object) (ei)) + return -UNW_ENOINFO; + + soff = ehdr->e_shoff; + if (soff + ehdr->e_shnum * ehdr->e_shentsize > ei->size) + { + Debug (1, "section table outside of image? (%lu > %lu)\n", + (unsigned long) (soff + ehdr->e_shnum * ehdr->e_shentsize), + (unsigned long) ei->size); + return -UNW_ENOINFO; + } + + shdr = (Elf_W (Shdr) *) ((char *) ei->image + soff); + + for (i = 0; i < ehdr->e_shnum; ++i) + { + switch (shdr->sh_type) + { + case SHT_SYMTAB: + case SHT_DYNSYM: + symtab = (Elf_W (Sym) *) ((char *) ei->image + shdr->sh_offset); + symtab_end = (Elf_W (Sym) *) ((char *) symtab + shdr->sh_size); + syment_size = shdr->sh_entsize; + + str_soff = soff + (shdr->sh_link * ehdr->e_shentsize); + if (str_soff + ehdr->e_shentsize >= ei->size) + { + Debug (1, "string table outside of image? (%lu >= %lu)\n", + (unsigned long) (str_soff + ehdr->e_shentsize), + (unsigned long) ei->size); + break; + } + str_shdr = (Elf_W (Shdr) *) ((char *) ei->image + str_soff); + strtab = (char *) ei->image + str_shdr->sh_offset; + + Debug (16, "symtab=0x%lx[%d], strtab=0x%lx\n", + (long) shdr->sh_offset, shdr->sh_type, + (long) str_shdr->sh_offset); + + for (sym = symtab; + sym < symtab_end; + sym = (Elf_W (Sym) *) ((char *) sym + syment_size)) + { + if (ELF_W (ST_TYPE) (sym->st_info) == STT_FUNC + && sym->st_shndx != SHN_UNDEF) + { + if (tdep_get_func_addr (as, sym->st_value, &val) < 0) + continue; + if (sym->st_shndx != SHN_ABS) + val += load_offset; + Debug (16, "0x%016lx info=0x%02x %s\n", + (long) val, sym->st_info, strtab + sym->st_name); + + if ((Elf_W (Addr)) (ip - val) < min_dist) + { + min_dist = (Elf_W (Addr)) (ip - val); + strncpy (buf, strtab + sym->st_name, buf_len); + buf[buf_len - 1] = '\0'; + if (strlen (strtab + sym->st_name) >= buf_len) + ret = -UNW_ENOMEM; + } + } + } + break; + + default: + break; + } + shdr = (Elf_W (Shdr) *) (((char *) shdr) + ehdr->e_shentsize); + } + if (min_dist >= ei->size) + return -UNW_ENOINFO; /* not found */ + if (offp) + *offp = min_dist; + return ret; +} + +/* Find the ELF image that contains IP and return the "closest" + procedure name, if there is one. With some caching, this could be + sped up greatly, but until an application materializes that's + sensitive to the performance of this routine, why bother... */ + +HIDDEN int +elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei, + unsigned long segbase, + unsigned long mapoff, + unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp) +{ + Elf_W (Addr) load_offset = 0; + Elf_W (Ehdr) *ehdr; + Elf_W (Phdr) *phdr; + int i, ret; + + ehdr = ei->image; + phdr = (Elf_W (Phdr) *) ((char *) ei->image + ehdr->e_phoff); + + for (i = 0; i < ehdr->e_phnum; ++i) + if (phdr[i].p_type == PT_LOAD && phdr[i].p_offset == mapoff) + { + load_offset = segbase - phdr[i].p_vaddr; + break; + } + + ret = elf_w (lookup_symbol) (as, ip, ei, load_offset, buf, buf_len, offp); + + return ret; +} + +HIDDEN int +elf_w (get_proc_name) (unw_addr_space_t as, pid_t pid, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp) +{ + unsigned long segbase, mapoff; + struct elf_image ei; + int ret; + + ret = tdep_get_elf_image (&ei, pid, ip, &segbase, &mapoff, NULL, 0); + if (ret < 0) + return ret; + + ret = elf_w (get_proc_name_in_image) (as, &ei, segbase, mapoff, ip, buf, buf_len, offp); + + munmap (ei.image, ei.size); + ei.image = NULL; + + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/elfxx.h b/sdk/cpprt/linux/libunwind/src/elfxx.h new file mode 100644 index 0000000000..fd4ef4d926 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/elfxx.h @@ -0,0 +1,108 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003, 2005 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include + +#include +#include + +#if ELF_CLASS == ELFCLASS32 +# define ELF_W(x) ELF32_##x +# define Elf_W(x) Elf32_##x +# define elf_w(x) _Uelf32_##x +#else +# define ELF_W(x) ELF64_##x +# define Elf_W(x) Elf64_##x +# define elf_w(x) _Uelf64_##x +#endif + +#include "libunwind_i.h" + +extern int elf_w (get_proc_name) (unw_addr_space_t as, + pid_t pid, unw_word_t ip, + char *buf, size_t len, + unw_word_t *offp); + +extern int elf_w (get_proc_name_in_image) (unw_addr_space_t as, + struct elf_image *ei, + unsigned long segbase, + unsigned long mapoff, + unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp); + +extern int elf_w (get_proc_name) (unw_addr_space_t as, + pid_t pid, unw_word_t ip, + char *buf, size_t len, + unw_word_t *offp); + +static inline int +elf_w (valid_object) (struct elf_image *ei) +{ + if (ei->size <= EI_VERSION) + return 0; + + return (memcmp (ei->image, ELFMAG, SELFMAG) == 0 + && ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS + && ((uint8_t *) ei->image)[EI_VERSION] != EV_NONE + && ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT); +} + +static inline int +elf_map_image (struct elf_image *ei, const char *path) +{ +#if HAVE_SGX + return -1; +#else + struct stat stat; + int fd; + + fd = open (path, O_RDONLY); + if (fd < 0) + return -1; + + if (fstat (fd, &stat) < 0) + { + close (fd); + return -1; + } + + ei->size = stat.st_size; + ei->image = mmap (NULL, ei->size, PROT_READ, MAP_PRIVATE, fd, 0); + close (fd); + if (ei->image == MAP_FAILED) + return -1; + + if (!elf_w (valid_object) (ei)) + { + munmap(ei->image, ei->size); + return -1; + } + + return 0; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/hppa/Gcreate_addr_space.c new file mode 100644 index 0000000000..8f4301feb6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gcreate_addr_space.c @@ -0,0 +1,52 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + /* + * hppa supports only big-endian. + */ + if (byte_order != 0 && byte_order != __BIG_ENDIAN) + return NULL; + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/hppa/Gget_proc_info.c new file mode 100644 index 0000000000..8d2c1fd9df --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gget_proc_info.c @@ -0,0 +1,46 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + + if (dwarf_make_proc_info (&c->dwarf) < 0) + { + /* On hppa, some key routines such as _start() and _dl_start() + are missing DWARF unwind info. We don't want to fail in that + case, because those frames are uninteresting and just mark + the end of the frame-chain anyhow. */ + memset (pi, 0, sizeof (*pi)); + pi->start_ip = c->dwarf.ip; + pi->end_ip = c->dwarf.ip + 4; + return 0; + } + *pi = c->dwarf.pi; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/hppa/Gget_save_loc.c new file mode 100644 index 0000000000..1b2191911a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gget_save_loc.c @@ -0,0 +1,59 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + loc = DWARF_NULL_LOC; /* default to "not saved" */ + +#warning FIX ME! + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gglobal.c b/sdk/cpprt/linux/libunwind/src/hppa/Gglobal.c new file mode 100644 index 0000000000..f453a43b96 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gglobal.c @@ -0,0 +1,55 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + + lock_acquire (&hppa_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + hppa_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&hppa_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Ginit.c b/sdk/cpprt/linux/libunwind/src/hppa/Ginit.c new file mode 100644 index 0000000000..5326b82985 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Ginit.c @@ -0,0 +1,194 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2004 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +static inline void * +uc_addr (ucontext_t *uc, int reg) +{ + void *addr; + + if ((unsigned) (reg - UNW_HPPA_GR) < 32) + addr = &uc->uc_mcontext.sc_gr[reg - UNW_HPPA_GR]; + else if ((unsigned) (reg - UNW_HPPA_FR) < 32) + addr = &uc->uc_mcontext.sc_fr[reg - UNW_HPPA_FR]; + else + addr = NULL; + return addr; +} + +# ifdef UNW_LOCAL_ONLY + +void * +_Uhppa_uc_addr (ucontext_t *uc, int reg) +{ + return uc_addr (uc, reg); +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +/* XXX fix me: there is currently no way to locate the dyn-info list + by a remote unwinder. On ia64, this is done via a special + unwind-table entry. Perhaps something similar can be done with + DWARF2 unwind info. */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (12, "mem[%x] <- %x\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "mem[%x] -> %x\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = arg; + + if ((unsigned int) (reg - UNW_HPPA_FR) < 32) + goto badreg; + + addr = uc_addr (uc, reg); + if (!addr) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- %x\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %x\n", unw_regname (reg), *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if ((unsigned) (reg - UNW_HPPA_FR) > 32) + goto badreg; + + addr = uc_addr (uc, reg); + if (!addr) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08x.%08x\n", + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %08x.%08x\n", + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +hppa_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = hppa_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/hppa/Ginit_local.c new file mode 100644 index 0000000000..6d4dd3df92 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Ginit_local.c @@ -0,0 +1,54 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by ... + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = uc; + return common_init (c, 1); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/hppa/Ginit_remote.c new file mode 100644 index 0000000000..bd6093f10f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Ginit_remote.c @@ -0,0 +1,46 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/hppa/Gis_signal_frame.c new file mode 100644 index 0000000000..202b570332 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gis_signal_frame.c @@ -0,0 +1,74 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ +#ifdef __linux__ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, w1, w2, w3, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors (as); + arg = c->dwarf.as_arg; + + /* Check if IP points at sigreturn() sequence. On Linux, this normally is: + + rt_sigreturn: + 0x34190000 ldi 0, %r25 + 0x3414015a ldi __NR_rt_sigreturn,%r20 + 0xe4008200 be,l 0x100(%sr2,%r0),%sr0,%r31 + 0x08000240 nop + + When a signal interrupts a system call, the first word is instead: + + 0x34190002 ldi 1, %r25 + */ + ip = c->dwarf.ip; + if (!ip) + return 0; + if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 8, &w2, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 12, &w3, 0, arg)) < 0) + { + Debug (1, "failed to read sigreturn code (ret=%d)\n", ret); + return ret; + } + ret = ((w0 == 0x34190000 || w0 == 0x34190002) + && w1 == 0x3414015a && w2 == 0xe4008200 && w3 == 0x08000240); + Debug (1, "(cursor=%p, ip=0x%08lx) -> %d\n", c, (unsigned) ip, ret); + return ret; +#else + printf ("%s: implement me\n", __FUNCTION__); +#endif + return -UNW_ENOINFO; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gregs.c b/sdk/cpprt/linux/libunwind/src/hppa/Gregs.c new file mode 100644 index 0000000000..e6d84e32a2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gregs.c @@ -0,0 +1,87 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + struct dwarf_loc loc; + + switch (reg) + { + case UNW_HPPA_IP: + if (write) + c->dwarf.ip = *valp; /* update the IP cache */ + if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip + || *valp >= c->dwarf.pi.end_ip)) + c->dwarf.pi_valid = 0; /* new IP outside of current proc */ + break; + + case UNW_HPPA_CFA: + case UNW_HPPA_SP: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + /* Do the exception-handling register remapping: */ + case UNW_HPPA_EH0: reg = UNW_HPPA_GR + 20; break; + case UNW_HPPA_EH1: reg = UNW_HPPA_GR + 21; break; + case UNW_HPPA_EH2: reg = UNW_HPPA_GR + 22; break; + case UNW_HPPA_EH3: reg = UNW_HPPA_GR + 31; break; + + default: + break; + } + + if ((unsigned) (reg - UNW_HPPA_GR) >= 32) + return -UNW_EBADREG; + + loc = c->dwarf.loc[reg]; + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + struct dwarf_loc loc; + + if ((unsigned) (reg - UNW_HPPA_FR) >= 32) + return -UNW_EBADREG; + + loc = c->dwarf.loc[reg]; + + if (write) + return dwarf_putfp (&c->dwarf, loc, *valp); + else + return dwarf_getfp (&c->dwarf, loc, valp); +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gresume.c b/sdk/cpprt/linux/libunwind/src/hppa/Gresume.c new file mode 100644 index 0000000000..92d506dcea --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gresume.c @@ -0,0 +1,145 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +#ifndef UNW_REMOTE_ONLY + +#if defined(__linux) + +# include + +static NORETURN inline long +my_rt_sigreturn (void *new_sp, int in_syscall) +{ + register unsigned long r25 __asm__ ("r25") = (in_syscall != 0); + register unsigned long r20 __asm__ ("r20") = SYS_rt_sigreturn; + + __asm__ __volatile__ ("copy %0, %%sp\n" + "be,l 0x100(%%sr2,%%r0),%%sr0,%%r31\n" + "nop" + : + : "r"(new_sp), "r"(r20), "r"(r25) + : "memory"); + abort (); +} + +#endif /* __linux */ + +HIDDEN inline int +hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ +#if defined(__linux) + struct cursor *c = (struct cursor *) cursor; + ucontext_t *uc = c->dwarf.as_arg; + + /* Ensure c->pi is up-to-date. On PA-RISC, it's relatively common to be + missing DWARF unwind info. We don't want to fail in that case, + because the frame-chain still would let us do a backtrace at + least. */ + dwarf_make_proc_info (&c->dwarf); + + if (unlikely (c->sigcontext_format != HPPA_SCF_NONE)) + { + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + + Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc); + my_rt_sigreturn (sc, (sc->sc_flags & PARISC_SC_FLAG_IN_SYSCALL) != 0); + } + else + { + Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); + setcontext (uc); + } +#else +# warning Implement me! +#endif + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +/* This routine is responsible for copying the register values in + cursor C and establishing them as the current machine state. */ + +static inline int +establish_machine_state (struct cursor *c) +{ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int write, void *); + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int write, void *); + unw_addr_space_t as = c->dwarf.as; + void *arg = c->dwarf.as_arg; + unw_fpreg_t fpval; + unw_word_t val; + int reg; + + access_reg = as->acc.access_reg; + access_fpreg = as->acc.access_fpreg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_REG_LAST; ++reg) + { + Debug (16, "copying %s %d\n", unw_regname (reg), reg); + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } + } + return 0; +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + if (!c->dwarf.ip) + { + /* This can happen easily when the frame-chain gets truncated + due to bad or missing unwind-info. */ + Debug (1, "refusing to resume execution at address 0\n"); + return -UNW_EINVAL; + } + + if ((ret = establish_machine_state (c)) < 0) + return ret; + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Gstep.c b/sdk/cpprt/linux/libunwind/src/hppa/Gstep.c new file mode 100644 index 0000000000..abff456912 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Gstep.c @@ -0,0 +1,96 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret, i; + + Debug (1, "(cursor=%p, ip=0x%08x)\n", c, (unsigned) c->dwarf.ip); + + /* Try DWARF-based unwinding... */ + ret = dwarf_step (&c->dwarf); + + if (ret < 0 && ret != -UNW_ENOINFO) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + if (unlikely (ret < 0)) + { + /* DWARF failed, let's see if we can follow the frame-chain + or skip over the signal trampoline. */ + + Debug (13, "dwarf_step() failed (ret=%d), trying fallback\n", ret); + + if (unw_is_signal_frame (cursor)) + { +#ifdef __linux__ + /* Assume that the trampoline is at the beginning of the + sigframe. */ + unw_word_t ip, sc_addr = c->dwarf.ip + LINUX_RT_SIGFRAME_UC_OFF; + dwarf_loc_t iaoq_loc = DWARF_LOC (sc_addr + LINUX_SC_IAOQ_OFF, 0); + + c->sigcontext_format = HPPA_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = sc_addr; + c->dwarf.ret_addr_column = UNW_HPPA_RP; + + if ((ret = dwarf_get (&c->dwarf, iaoq_loc, &ip)) , 0) + { + Debug (2, "failed to read IAOQ[1] (ret=%d)\n", ret); + return ret; + } + c->dwarf.ip = ip & ~0x3; /* mask out the privilege level */ + + for (i = 0; i < 32; ++i) + { + c->dwarf.loc[UNW_HPPA_GR + i] + = DWARF_LOC (sc_addr + LINUX_SC_GR_OFF + 4*i, 0); + c->dwarf.loc[UNW_HPPA_FR + i] + = DWARF_LOC (sc_addr + LINUX_SC_FR_OFF + 4*i, 0); + } + + if ((ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_HPPA_SP], + &c->dwarf.cfa)) < 0) + { + Debug (2, "failed to read SP (ret=%d)\n", ret); + return ret; + } +#else +# error Implement me! +#endif + } + else + c->dwarf.ip = 0; + } + ret = (c->dwarf.ip == 0) ? 0 : 1; + Debug (2, "returning %d\n", ret); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/hppa/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/hppa/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/hppa/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lglobal.c b/sdk/cpprt/linux/libunwind/src/hppa/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Linit.c b/sdk/cpprt/linux/libunwind/src/hppa/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Linit_local.c b/sdk/cpprt/linux/libunwind/src/hppa/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/hppa/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/hppa/Lis_signal_frame.c new file mode 100644 index 0000000000..b9a7c4f51a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lregs.c b/sdk/cpprt/linux/libunwind/src/hppa/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lresume.c b/sdk/cpprt/linux/libunwind/src/hppa/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/Lstep.c b/sdk/cpprt/linux/libunwind/src/hppa/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/get_accessors.c b/sdk/cpprt/linux/libunwind/src/hppa/get_accessors.c new file mode 100644 index 0000000000..b6bd49a767 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/get_accessors.c @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by ... + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED unw_accessors_t * +unw_get_accessors (unw_addr_space_t as) +{ + if (hppa_needs_initialization) + { + hppa_needs_initialization = 0; + hppa_init (); + } + return &as->acc; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/getcontext.S b/sdk/cpprt/linux/libunwind/src/hppa/getcontext.S new file mode 100644 index 0000000000..ec7554a025 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/getcontext.S @@ -0,0 +1,74 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define SPILL(n) stw %r##n, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_GR_OFF+4*(n))(%r26) + +#include "offsets.h" + + .align 4 + .protected _Uhppa_getcontext + .global _Uhppa_getcontext + .proc + .callinfo +_Uhppa_getcontext: + SPILL (2) /* return-pointer */ + SPILL (3) /* frame pointer */ + SPILL (4) /* 2nd-ary frame pointer */ + SPILL (5) /* preserved register */ + SPILL (6) /* preserved register */ + SPILL (7) /* preserved register */ + SPILL (8) /* preserved register */ + SPILL (9) /* preserved register */ + SPILL (10) /* preserved register */ + SPILL (11) /* preserved register */ + SPILL (12) /* preserved register */ + SPILL (13) /* preserved register */ + SPILL (14) /* preserved register */ + SPILL (15) /* preserved register */ + SPILL (16) /* preserved register */ + SPILL (17) /* preserved register */ + SPILL (18) /* preserved register */ + SPILL (19) /* linkage-table register */ + SPILL (27) /* global-data pointer */ + SPILL (30) /* stack pointer */ + + ldo (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FR_OFF)(%r26), %r29 + fstds,ma %fr12, 8(%r29) + fstds,ma %fr13, 8(%r29) + fstds,ma %fr14, 8(%r29) + fstds,ma %fr15, 8(%r29) + fstds,ma %fr16, 8(%r29) + fstds,ma %fr17, 8(%r29) + fstds,ma %fr18, 8(%r29) + fstds,ma %fr19, 8(%r29) + fstds,ma %fr20, 8(%r29) + fstds %fr21, 8(%r29) + + bv,n %r0(%rp) + .procend +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/init.h b/sdk/cpprt/linux/libunwind/src/hppa/init.h new file mode 100644 index 0000000000..6fabb1543e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/init.h @@ -0,0 +1,47 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by ... + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret; + + c->ip_loc = HPPA_REG_LOC (c, UNW_HPPA_IP); + c->sp_loc = HPPA_REG_LOC (c, UNW_HPPA_SP); + + ret = hppa_get (c, c->ip_loc, &c->ip); + if (ret < 0) + return ret; + + ret = hppa_get (c, HPPA_REG_LOC (c, UNW_HPPA_SP), &c->sp); + if (ret < 0) + return ret; + + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/offsets.h b/sdk/cpprt/linux/libunwind/src/hppa/offsets.h new file mode 100644 index 0000000000..d824770b4a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/offsets.h @@ -0,0 +1,17 @@ +#define LINUX_UC_FLAGS_OFF 0x000 +#define LINUX_UC_LINK_OFF 0x004 +#define LINUX_UC_STACK_OFF 0x008 +#define LINUX_UC_MCONTEXT_OFF 0x018 +#define LINUX_UC_SIGMASK_OFF 0x1b8 + +#define LINUX_SC_FLAGS_OFF 0x000 +#define LINUX_SC_GR_OFF 0x004 +#define LINUX_SC_FR_OFF 0x088 +#define LINUX_SC_IASQ_OFF 0x188 +#define LINUX_SC_IAOQ_OFF 0x190 +#define LINUX_SC_SAR_OFF 0x198 + +/* The signal frame contains 4 words of space for the sigreturn + trampoline, the siginfo structure, and then the sigcontext + structure. See include/asm-parisc/compat_rt_sigframe.h. */ +#define LINUX_RT_SIGFRAME_UC_OFF 0xac diff --git a/sdk/cpprt/linux/libunwind/src/hppa/regname.c b/sdk/cpprt/linux/libunwind/src/hppa/regname.c new file mode 100644 index 0000000000..07cae8ed82 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/regname.c @@ -0,0 +1,50 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static const char *regname[] = + { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", + "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", + "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31", + "ip", + "eh0", "eh1", "eh2", "eh3", + "cfa" + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/setcontext.S b/sdk/cpprt/linux/libunwind/src/hppa/setcontext.S new file mode 100644 index 0000000000..a36ea35cc6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/setcontext.S @@ -0,0 +1,77 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* The setcontext() in glibc is a no-op (as of 4 Dec 2004), so we have + to implement something useful on our own here. */ + +#define FILL(n) ldw (LINUX_UC_MCONTEXT_OFF+LINUX_SC_GR_OFF+4*(n))(%r26),%r##n + +#include "offsets.h" + + .align 4 + .global _Uhppa_setcontext + .protected _Uhppa_setcontext + .proc + .callinfo +_Uhppa_setcontext: + FILL (2) /* return-pointer */ + FILL (3) /* frame pointer */ + FILL (4) /* 2nd-ary frame pointer */ + FILL (5) /* preserved register */ + FILL (6) /* preserved register */ + FILL (7) /* preserved register */ + FILL (8) /* preserved register */ + FILL (9) /* preserved register */ + FILL (10) /* preserved register */ + FILL (11) /* preserved register */ + FILL (12) /* preserved register */ + FILL (13) /* preserved register */ + FILL (14) /* preserved register */ + FILL (15) /* preserved register */ + FILL (16) /* preserved register */ + FILL (17) /* preserved register */ + FILL (18) /* preserved register */ + FILL (19) /* linkage-table register */ + FILL (27) /* global-data pointer */ + FILL (30) /* stack pointer */ + + ldo (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FR_OFF)(%r26), %r29 + fldds,ma 8(%r29), %fr12 + fldds,ma 8(%r29), %fr13 + fldds,ma 8(%r29), %fr14 + fldds,ma 8(%r29), %fr15 + fldds,ma 8(%r29), %fr16 + fldds,ma 8(%r29), %fr17 + fldds,ma 8(%r29), %fr18 + fldds,ma 8(%r29), %fr19 + fldds,ma 8(%r29), %fr20 + fldds 8(%r29), %fr21 + + bv,n %r0(%rp) + .procend +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/hppa/siglongjmp.S new file mode 100644 index 0000000000..34878dbe8f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/siglongjmp.S @@ -0,0 +1,16 @@ + /* Dummy implementation for now. */ + + .globl _UI_siglongjmp_cont + .globl _UI_longjmp_cont + +_UI_siglongjmp_cont: +_UI_longjmp_cont: + .proc + .callinfo +#warning fix me + bv %r0(%rp) + .procend +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/hppa/tables.c b/sdk/cpprt/linux/libunwind/src/hppa/tables.c new file mode 100644 index 0000000000..383b4495c9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/tables.c @@ -0,0 +1,43 @@ +#include "unwind_i.h" + +static inline int +is_local_addr_space (unw_addr_space_t as) +{ + extern unw_addr_space_t _ULhppa_local_addr_space; + + return (as == _Uhppa_local_addr_space +#ifndef UNW_REMOTE_ONLY + || as == _ULhppa_local_addr_space +#endif + ); +} + +HIDDEN int +tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, void *arg) +{ + printf ("%s: begging to get implemented...\n", __FUNCTION__); + return 0; +} + +HIDDEN int +tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, + unw_proc_info_t *pi, int need_unwind_info, void *arg) +{ + printf ("%s: the biggest beggar of them all...\n", __FUNCTION__); + return 0; +} + +HIDDEN void +tdep_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg) +{ + if (!pi->unwind_info) + return; + + if (!is_local_addr_space (as)) + { + free (pi->unwind_info); + pi->unwind_info = NULL; + } +} diff --git a/sdk/cpprt/linux/libunwind/src/hppa/unwind_i.h b/sdk/cpprt/linux/libunwind/src/hppa/unwind_i.h new file mode 100644 index 0000000000..d3c11be86f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/hppa/unwind_i.h @@ -0,0 +1,48 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include "libunwind_i.h" + +#define hppa_lock UNW_OBJ(lock) +#define hppa_local_resume UNW_OBJ(local_resume) +#define hppa_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define hppa_scratch_loc UNW_OBJ(scratch_loc) +#define setcontext UNW_ARCH_OBJ (setcontext) + +extern void hppa_local_addr_space_init (void); +extern int hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); +extern dwarf_loc_t hppa_scratch_loc (struct cursor *c, unw_regnum_t reg); +extern int setcontext (const ucontext_t *ucp); + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/ia64/Gcreate_addr_space.c new file mode 100644 index 0000000000..a3524a0ae9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gcreate_addr_space.c @@ -0,0 +1,63 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* + * IA-64 supports only big or little-endian, not weird stuff like + * PDP_ENDIAN. + */ + if (byte_order != 0 + && byte_order != __LITTLE_ENDIAN + && byte_order != __BIG_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + if (byte_order == 0) + /* use host default: */ + as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + else + as->big_endian = (byte_order == __BIG_ENDIAN); + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gfind_unwind_table.c b/sdk/cpprt/linux/libunwind/src/ia64/Gfind_unwind_table.c new file mode 100644 index 0000000000..f7d3168870 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gfind_unwind_table.c @@ -0,0 +1,143 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include +#include +#include +#include + +#include + +#include "libunwind_i.h" +#include "elf64.h" + +static unw_word_t +find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base) +{ + Elf64_Off soff, str_soff; + Elf64_Ehdr *ehdr = edi->ei.image; + Elf64_Shdr *shdr; + Elf64_Shdr *str_shdr; + Elf64_Addr gp = 0; + char *strtab; + int i; + + if (pdyn) + { + /* If we have a PT_DYNAMIC program header, fetch the gp-value + from the DT_PLTGOT entry. */ + Elf64_Dyn *dyn = (Elf64_Dyn *) (pdyn->p_offset + (char *) edi->ei.image); + for (; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_PLTGOT) + { + gp = (Elf64_Addr) dyn->d_un.d_ptr + load_base; + goto done; + } + } + + /* Without a PT_DYAMIC header, lets try to look for a non-empty .opd + section. If there is such a section, we know it's full of + function descriptors, and we can simply pick up the gp from the + second word of the first entry in this table. */ + + soff = ehdr->e_shoff; + str_soff = soff + (ehdr->e_shstrndx * ehdr->e_shentsize); + + if (soff + ehdr->e_shnum * ehdr->e_shentsize > edi->ei.size) + { + Debug (1, "section table outside of image? (%lu > %lu)", + soff + ehdr->e_shnum * ehdr->e_shentsize, + edi->ei.size); + goto done; + } + + shdr = (Elf64_Shdr *) ((char *) edi->ei.image + soff); + str_shdr = (Elf64_Shdr *) ((char *) edi->ei.image + str_soff); + strtab = (char *) edi->ei.image + str_shdr->sh_offset; + for (i = 0; i < ehdr->e_shnum; ++i) + { + if (strcmp (strtab + shdr->sh_name, ".opd") == 0 + && shdr->sh_size >= 16) + { + gp = ((Elf64_Addr *) ((char *) edi->ei.image + shdr->sh_offset))[1]; + goto done; + } + shdr = (Elf64_Shdr *) (((char *) shdr) + ehdr->e_shentsize); + } + + done: + Debug (16, "image at %p, gp = %lx\n", edi->ei.image, gp); + return gp; +} + +int +ia64_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, + char *path, unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip) +{ + Elf64_Phdr *phdr, *ptxt = NULL, *punw = NULL, *pdyn = NULL; + Elf64_Ehdr *ehdr; + int i; + + if (!_Uelf64_valid_object (&edi->ei)) + return -UNW_ENOINFO; + + ehdr = edi->ei.image; + phdr = (Elf64_Phdr *) ((char *) edi->ei.image + ehdr->e_phoff); + + for (i = 0; i < ehdr->e_phnum; ++i) + { + switch (phdr[i].p_type) + { + case PT_LOAD: + if (phdr[i].p_offset == mapoff) + ptxt = phdr + i; + break; + + case PT_IA_64_UNWIND: + punw = phdr + i; + break; + + case PT_DYNAMIC: + pdyn = phdr + i; + break; + + default: + break; + } + } + if (!ptxt || !punw) + return 0; + + edi->di_cache.start_ip = segbase; + edi->di_cache.end_ip = edi->di_cache.start_ip + ptxt->p_memsz; + edi->di_cache.gp = find_gp (edi, pdyn, segbase - ptxt->p_vaddr); + edi->di_cache.format = UNW_INFO_FORMAT_TABLE; + edi->di_cache.u.ti.name_ptr = 0; + edi->di_cache.u.ti.segbase = segbase; + edi->di_cache.u.ti.table_len = punw->p_memsz / sizeof (unw_word_t); + edi->di_cache.u.ti.table_data = (unw_word_t *) + ((char *) edi->ei.image + (punw->p_vaddr - ptxt->p_vaddr)); + return 1; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/ia64/Gget_proc_info.c new file mode 100644 index 0000000000..21015d4249 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gget_proc_info.c @@ -0,0 +1,38 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + if ((ret = ia64_make_proc_info (c)) < 0) + return ret; + *pi = c->pi; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/ia64/Gget_save_loc.c new file mode 100644 index 0000000000..49bdaba1bf --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gget_save_loc.c @@ -0,0 +1,168 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2003, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "rse.h" + +#include "offsets.h" +#include "regs.h" + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + ia64_loc_t loc, reg_loc; + uint8_t nat_bitnr; + int ret; + + loc = IA64_NULL_LOC; /* default to "not saved" */ + + switch (reg) + { + /* frame registers */ + case UNW_IA64_BSP: + case UNW_REG_SP: + default: + break; + + case UNW_REG_IP: + loc = c->loc[IA64_REG_IP]; + break; + + /* preserved registers: */ + case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7: + loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_GR + 4))]; + break; + + case UNW_IA64_NAT + 4 ... UNW_IA64_NAT + 7: + loc = c->loc[IA64_REG_NAT4 + (reg - (UNW_IA64_NAT + 4))]; + reg_loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_NAT + 4))]; + nat_bitnr = c->nat_bitnr[reg - (UNW_IA64_NAT + 4)]; + if (IA64_IS_FP_LOC (reg_loc)) + /* NaT bit saved as a NaTVal. */ + loc = reg_loc; + break; + + case UNW_IA64_FR + 2: loc = c->loc[IA64_REG_F2]; break; + case UNW_IA64_FR + 3: loc = c->loc[IA64_REG_F3]; break; + case UNW_IA64_FR + 4: loc = c->loc[IA64_REG_F4]; break; + case UNW_IA64_FR + 5: loc = c->loc[IA64_REG_F5]; break; + case UNW_IA64_FR + 16 ... UNW_IA64_FR + 31: + loc = c->loc[IA64_REG_F16 + (reg - (UNW_IA64_FR + 16))]; + break; + + case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break; + case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break; + case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break; + case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break; + case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break; + case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break; + case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break; + case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break; + case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break; + case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break; + case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break; + case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break; + case UNW_IA64_CFM: loc = c->cfm_loc; break; + case UNW_IA64_PR: loc = c->loc[IA64_REG_PR]; break; + + case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */ + reg = rotate_gr (c, reg - UNW_IA64_GR); + ret = ia64_get_stacked (c, reg, &loc, NULL); + if (ret < 0) + return ret; + break; + + case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */ + reg = rotate_gr (c, reg - UNW_IA64_NAT); + ret = ia64_get_stacked (c, reg, NULL, &loc); + break; + + case UNW_IA64_AR_EC: + loc = c->cfm_loc; + break; + + /* scratch & special registers: */ + + case UNW_IA64_GR + 0: + case UNW_IA64_GR + 1: /* global pointer */ + case UNW_IA64_NAT + 0: + case UNW_IA64_NAT + 1: /* global pointer */ + case UNW_IA64_FR + 0: + case UNW_IA64_FR + 1: + break; + + case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3: + case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31: + loc = ia64_scratch_loc (c, reg, &nat_bitnr); + break; + + case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 31: + case UNW_IA64_BR + 0: + case UNW_IA64_BR + 6: + case UNW_IA64_BR + 7: + case UNW_IA64_AR_RSC: + case UNW_IA64_AR_CSD: + case UNW_IA64_AR_SSD: + case UNW_IA64_AR_CCV: + loc = ia64_scratch_loc (c, reg, NULL); + break; + + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15: + loc = ia64_scratch_loc (c, reg, NULL); + break; + + case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127: + reg = rotate_fr (c, reg - UNW_IA64_FR) + UNW_IA64_FR; + loc = ia64_scratch_loc (c, reg, NULL); + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (IA64_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (IA64_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = IA64_GET_REG (loc); + sloc->extra.nat_bitnr = nat_bitnr; + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = IA64_GET_ADDR (loc); + sloc->extra.nat_bitnr = nat_bitnr; + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gglobal.c b/sdk/cpprt/linux/libunwind/src/ia64/Gglobal.c new file mode 100644 index 0000000000..b04a5783f4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gglobal.c @@ -0,0 +1,123 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +HIDDEN struct ia64_global_unwind_state unw = + { + .needs_initialization = 1, + .lock = PTHREAD_MUTEX_INITIALIZER, + .save_order = { + IA64_REG_IP, IA64_REG_PFS, IA64_REG_PSP, IA64_REG_PR, + IA64_REG_UNAT, IA64_REG_LC, IA64_REG_FPSR, IA64_REG_PRI_UNAT_GR + }, +#if UNW_DEBUG + .preg_name = { + "pri_unat_gr", "pri_unat_mem", "psp", "bsp", "bspstore", + "ar.pfs", "ar.rnat", "rp", + "r4", "r5", "r6", "r7", + "nat4", "nat5", "nat6", "nat7", + "ar.unat", "pr", "ar.lc", "ar.fpsr", + "b1", "b2", "b3", "b4", "b5", + "f2", "f3", "f4", "f5", + "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", + "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31" + } +#endif +}; + +HIDDEN void +tdep_init (void) +{ + uint8_t f1_bytes[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + uint8_t nat_val_bytes[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + uint8_t int_val_bytes[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x3e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + intrmask_t saved_mask; + uint8_t *lep, *bep; + long i; + + sigfillset (&unwi_full_mask); + + lock_acquire (&unw.lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + mempool_init (&unw.reg_state_pool, sizeof (struct ia64_reg_state), 0); + mempool_init (&unw.labeled_state_pool, + sizeof (struct ia64_labeled_state), 0); + + unw.read_only.r0 = 0; + unw.read_only.f0.raw.bits[0] = 0; + unw.read_only.f0.raw.bits[1] = 0; + + lep = (uint8_t *) &unw.read_only.f1_le + 16; + bep = (uint8_t *) &unw.read_only.f1_be; + for (i = 0; i < 16; ++i) + { + *--lep = f1_bytes[i]; + *bep++ = f1_bytes[i]; + } + + lep = (uint8_t *) &unw.nat_val_le + 16; + bep = (uint8_t *) &unw.nat_val_be; + for (i = 0; i < 16; ++i) + { + *--lep = nat_val_bytes[i]; + *bep++ = nat_val_bytes[i]; + } + + lep = (uint8_t *) &unw.int_val_le + 16; + bep = (uint8_t *) &unw.int_val_be; + for (i = 0; i < 16; ++i) + { + *--lep = int_val_bytes[i]; + *bep++ = int_val_bytes[i]; + } + + assert (8*sizeof(unw_hash_index_t) >= IA64_LOG_UNW_HASH_SIZE); + +#ifndef UNW_REMOTE_ONLY + ia64_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&unw.lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Ginit.c b/sdk/cpprt/linux/libunwind/src/ia64/Ginit.c new file mode 100644 index 0000000000..5afa9ab19b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Ginit.c @@ -0,0 +1,505 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +#ifdef HAVE_SYS_UC_ACCESS_H +# include +#endif + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +#ifdef HAVE_SYS_UC_ACCESS_H + +#else /* !HAVE_SYS_UC_ACCESS_H */ + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr) +{ + return inlined_uc_addr (uc, reg, nat_bitnr); +} + +#endif /* !HAVE_SYS_UC_ACCESS_H */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ +#ifndef UNW_LOCAL_ONLY +# pragma weak _U_dyn_info_list_addr + if (!_U_dyn_info_list_addr) + return -UNW_ENOINFO; +#endif + *dyn_info_list_addr = _U_dyn_info_list_addr (); + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (12, "mem[%lx] <- %lx\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "mem[%lx] -> %lx\n", addr, *val); + } + return 0; +} + +#ifdef HAVE_SYS_UC_ACCESS_H + +#define SYSCALL_CFM_SAVE_REG 11 /* on a syscall, ar.pfs is saved in r11 */ +#define REASON_SYSCALL 0 + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + ucontext_t *uc = arg; + unsigned int nat, mask; + uint64_t value; + uint16_t reason; + int ret; + + __uc_get_reason (uc, &reason); + + switch (reg) + { + case UNW_IA64_GR ... UNW_IA64_GR + 31: + if ((ret = __uc_get_grs (uc, (reg - UNW_IA64_GR), 1, &value, &nat))) + break; + + if (write) + ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, val, nat); + else + *val = value; + break; + + case UNW_IA64_NAT ... UNW_IA64_NAT + 31: + if ((ret = __uc_get_grs (uc, (reg - UNW_IA64_GR), 1, &value, &nat))) + break; + + mask = 1 << (reg - UNW_IA64_GR); + + if (write) + { + if (*val) + nat |= mask; + else + nat &= ~mask; + ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, &value, nat); + } + else + *val = (nat & mask) != 0; + break; + + case UNW_IA64_AR ... UNW_IA64_AR + 127: + if (reg == UNW_IA64_AR_BSP) + { + if (write) + ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val); + else + ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val); + } + else if (reg == UNW_IA64_AR_PFS && reason == REASON_SYSCALL) + { + /* As of HP-UX 11.22, getcontext() does not have unwind info + and because of that, we need to hack thins manually here. + Hopefully, this is OK because the HP-UX kernel also needs + to know where AR.PFS has been saved, so the use of + register r11 for this purpose is pretty much nailed + down. */ + if (write) + ret = __uc_set_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, 0); + else + ret = __uc_get_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, &nat); + } + else + { + if (write) + ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val); + else + ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val); + } + break; + + case UNW_IA64_BR ... UNW_IA64_BR + 7: + if (write) + ret = __uc_set_brs (uc, (reg - UNW_IA64_BR), 1, val); + else + ret = __uc_get_brs (uc, (reg - UNW_IA64_BR), 1, val); + break; + + case UNW_IA64_PR: + if (write) + ret = __uc_set_prs (uc, *val); + else + ret = __uc_get_prs (uc, val); + break; + + case UNW_IA64_IP: + if (write) + ret = __uc_set_ip (uc, *val); + else + ret = __uc_get_ip (uc, val); + break; + + case UNW_IA64_CFM: + if (write) + ret = __uc_set_cfm (uc, *val); + else + ret = __uc_get_cfm (uc, val); + break; + + case UNW_IA64_FR ... UNW_IA64_FR + 127: + default: + ret = EINVAL; + break; + } + + if (ret != 0) + { + Debug (1, "failed to %s %s (ret = %d)\n", + write ? "write" : "read", unw_regname (reg), ret); + return -UNW_EBADREG; + } + + if (write) + Debug (12, "%s <- %lx\n", unw_regname (reg), *val); + else + Debug (12, "%s -> %lx\n", unw_regname (reg), *val); + return 0; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + fp_regval_t fp_regval; + int ret; + + switch (reg) + { + case UNW_IA64_FR ... UNW_IA64_FR + 127: + if (write) + { + memcpy (&fp_regval, val, sizeof (fp_regval)); + ret = __uc_set_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval); + } + else + { + ret = __uc_get_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval); + memcpy (val, &fp_regval, sizeof (*val)); + } + break; + + default: + ret = EINVAL; + break; + } + if (ret != 0) + return -UNW_EBADREG; + + return 0; +} + +#else /* !HAVE_SYS_UC_ACCESS_H */ + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr, mask; + ucontext_t *uc = arg; + + if (reg >= UNW_IA64_NAT + 4 && reg <= UNW_IA64_NAT + 7) + { + mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT); + if (write) + { + if (*val) + uc->uc_mcontext.sc_nat |= mask; + else + uc->uc_mcontext.sc_nat &= ~mask; + } + else + *val = (uc->uc_mcontext.sc_nat & mask) != 0; + + if (write) + Debug (12, "%s <- %lx\n", unw_regname (reg), *val); + else + Debug (12, "%s -> %lx\n", unw_regname (reg), *val); + return 0; + } + + addr = tdep_uc_addr (uc, reg, NULL); + if (!addr) + goto badreg; + + if (write) + { + if (ia64_read_only_reg (addr)) + { + Debug (16, "attempt to write read-only register\n"); + return -UNW_EREADONLYREG; + } + *addr = *val; + Debug (12, "%s <- %lx\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %lx\n", unw_regname (reg), *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if (reg < UNW_IA64_FR || reg >= UNW_IA64_FR + 128) + goto badreg; + + addr = tdep_uc_addr (uc, reg, NULL); + if (!addr) + goto badreg; + + if (write) + { + if (ia64_read_only_reg (addr)) + { + Debug (16, "attempt to write read-only register\n"); + return -UNW_EREADONLYREG; + } + *addr = *val; + Debug (12, "%s <- %016lx.%016lx\n", + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %016lx.%016lx\n", + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +#endif /* !HAVE_SYS_UC_ACCESS_H */ + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +ia64_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN); +#if defined(__linux) + local_addr_space.abi = ABI_LINUX; +#elif defined(__hpux) + local_addr_space.abi = ABI_HPUX; +#endif + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = tdep_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = ia64_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ + +#ifndef UNW_LOCAL_ONLY + +HIDDEN int +ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, + int write) +{ +#ifdef HAVE_SYS_UC_ACCESS_H + unw_word_t uc_addr = IA64_GET_AUX_ADDR (loc); + ucontext_t *ucp; + int ret; + + Debug (16, "%s location %s\n", + write ? "writing" : "reading", ia64_strloc (loc)); + + if (c->as == unw_local_addr_space) + ucp = (ucontext_t *) uc_addr; + else + { + unw_word_t *dst, src; + + /* Need to copy-in ucontext_t first. */ + ucp = alloca (sizeof (ucontext_t)); + if (!ucp) + return -UNW_ENOMEM; + + /* For now, there is no non-HP-UX implementation of the + uc_access(3) interface. Because of that, we cannot, e.g., + unwind an HP-UX program from a Linux program. Should that + become possible at some point in the future, the + copy-in/copy-out needs to be adjusted to do byte-swapping if + necessary. */ + assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN)); + + dst = (unw_word_t *) ucp; + for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8) + if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg)) + < 0) + return ret; + } + + if (IA64_IS_REG_LOC (loc)) + ret = access_reg (unw_local_addr_space, IA64_GET_REG (loc), valp, write, + ucp); + else + { + /* Must be an access to the RSE backing store in ucontext_t. */ + unw_word_t addr = IA64_GET_ADDR (loc); + + if (write) + ret = __uc_set_rsebs (ucp, (uint64_t *) addr, 1, valp); + else + ret = __uc_get_rsebs (ucp, (uint64_t *) addr, 1, valp); + if (ret != 0) + ret = -UNW_EBADREG; + } + if (ret < 0) + return ret; + + if (write && c->as != unw_local_addr_space) + { + /* need to copy-out ucontext_t: */ + unw_word_t dst, *src = (unw_word_t *) ucp; + for (dst = uc_addr; dst < uc_addr + sizeof (ucontext_t); dst += 8) + if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg)) + < 0) + return ret; + } + return 0; +#else /* !HAVE_SYS_UC_ACCESS_H */ + return -UNW_EINVAL; +#endif /* !HAVE_SYS_UC_ACCESS_H */ +} + +HIDDEN int +ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp, + int write) +{ +#ifdef HAVE_SYS_UC_ACCESS_H + unw_word_t uc_addr = IA64_GET_AUX_ADDR (loc); + ucontext_t *ucp; + int ret; + + if (c->as == unw_local_addr_space) + ucp = (ucontext_t *) uc_addr; + else + { + unw_word_t *dst, src; + + /* Need to copy-in ucontext_t first. */ + ucp = alloca (sizeof (ucontext_t)); + if (!ucp) + return -UNW_ENOMEM; + + /* For now, there is no non-HP-UX implementation of the + uc_access(3) interface. Because of that, we cannot, e.g., + unwind an HP-UX program from a Linux program. Should that + become possible at some point in the future, the + copy-in/copy-out needs to be adjusted to do byte-swapping if + necessary. */ + assert (c->as->big_endian == (__BYTE_ORDER == __BIG_ENDIAN)); + + dst = (unw_word_t *) ucp; + for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8) + if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg)) + < 0) + return ret; + } + + if ((ret = access_fpreg (unw_local_addr_space, IA64_GET_REG (loc), valp, + write, ucp)) < 0) + return ret; + + if (write && c->as != unw_local_addr_space) + { + /* need to copy-out ucontext_t: */ + unw_word_t dst, *src = (unw_word_t *) ucp; + for (dst = uc_addr; dst < uc_addr + sizeof (ucontext_t); dst += 8) + if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg)) + < 0) + return ret; + } + return 0; +#else /* !HAVE_SYS_UC_ACCESS_H */ + return -UNW_EINVAL; +#endif /* !HAVE_SYS_UC_ACCESS_H */ +} + +#endif /* UNW_LOCAL_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/ia64/Ginit_local.c new file mode 100644 index 0000000000..42f8b1f069 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Ginit_local.c @@ -0,0 +1,110 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2003, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +static inline void +set_as_arg (struct cursor *c, unw_context_t *uc) +{ +#if defined(__linux) && defined(__KERNEL__) + c->task = current; + c->as_arg = &uc->sw; +#else + c->as_arg = uc; +#endif +} + +static inline int +get_initial_stack_pointers (struct cursor *c, unw_context_t *uc, + unw_word_t *sp, unw_word_t *bsp) +{ +#if defined(__linux) + unw_word_t sol, bspstore; + +#ifdef __KERNEL__ + sol = (uc->sw.ar_pfs >> 7) & 0x7f; + bspstore = uc->sw.ar_bspstore; + *sp = uc->ksp; +# else + sol = (uc->uc_mcontext.sc_ar_pfs >> 7) & 0x7f; + bspstore = uc->uc_mcontext.sc_ar_bsp; + *sp = uc->uc_mcontext.sc_gr[12]; +# endif + *bsp = rse_skip_regs (bspstore, -sol); +#elif defined(__hpux) + int ret; + + if ((ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_GR + 12), sp)) < 0 + || (ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_AR_BSP), bsp)) < 0) + return ret; +#else +# error Fix me. +#endif + return 0; +} + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t sp, bsp; + int ret; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->as = unw_local_addr_space; + set_as_arg (c, uc); + + if ((ret = get_initial_stack_pointers (c, uc, &sp, &bsp)) < 0) + return ret; + + Debug (4, "initial bsp=%lx, sp=%lx\n", bsp, sp); + + if ((ret = common_init (c, sp, bsp)) < 0) + return ret; + +#ifdef __hpux + /* On HP-UX, the context created by getcontext() points to the + getcontext() system call stub. Step over it: */ + ret = unw_step (cursor); +#endif + return ret; +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/ia64/Ginit_remote.c new file mode 100644 index 0000000000..ae0b718c04 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Ginit_remote.c @@ -0,0 +1,61 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + unw_word_t sp, bsp; + int ret; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + if (as == unw_local_addr_space) + /* This special-casing is unfortunate and shouldn't be needed; + however, both Linux and HP-UX need to adjust the context a bit + before it's usable. Try to think of a cleaner way of doing + this. Not sure it's possible though, as long as we want to be + able to use the context returned by getcontext() et al. */ + return unw_init_local (cursor, as_arg); + + c->as = as; + c->as_arg = as_arg; + + if ((ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_GR + 12), &sp)) < 0 + || (ret = ia64_get (c, IA64_REG_LOC (c, UNW_IA64_AR_BSP), &bsp)) < 0) + return ret; + + return common_init (c, sp, bsp); +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Ginstall_cursor.S b/sdk/cpprt/linux/libunwind/src/ia64/Ginstall_cursor.S new file mode 100644 index 0000000000..6fb4401faa --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Ginstall_cursor.S @@ -0,0 +1,348 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "ucontext_i.h" + +#ifdef UNW_LOCAL_ONLY +# include "Lcursor_i.h" +# define ia64_install_cursor _ULia64_install_cursor +#else +# include "Gcursor_i.h" +# define ia64_install_cursor _Uia64_install_cursor +#endif + +#define SYS_sigreturn 1181 + +#ifndef UNW_REMOTE_ONLY + +/* ia64_install_cursor (const cursor *c, long pri_unat, long *extra, + long bspstore, long dirty_size, long *dirty_partition, + long dirty_rnat) + + Restores the machine-state represented by C and thereby resumes execution + in that frame. If the frame or one of its descendants was interrupted + by a signal, all registers are restored (including the signal mask). + Otherwise, only the preserved registers, the global-pointer (r1), and + the exception-arguments (r15-r18) are restored. */ + +#define pRet p6 +#define pSig p7 + + .align 32 + .hidden ia64_install_cursor + .global ia64_install_cursor + .proc ia64_install_cursor +ia64_install_cursor: + alloc r3 = ar.pfs, 7, 0, 0, 0 + invala + add r2 = FR_LOC_OFF, in0 + ;; + + ld8 r16 = [r2], LOC_SIZE // r16 = loc[IA64_REG_FR16] + mov.m r10 = ar.rsc // (ar.rsc: ~ 12 cycle latency) + add r3 = FR_LOC_OFF + 16, in0 + ;; + + ld8 r17 = [r2], 2*LOC_SIZE // r17 = loc[IA64_REG_FR17] + ld8 r18 = [r3], 2*LOC_SIZE // r18 = loc[IA64_REG_FR18] + and r16 = -4, r16 + ;; + + ld8 r19 = [r2], 2*LOC_SIZE // r19 = loc[IA64_REG_FR19] + ld8 r20 = [r3], 2*LOC_SIZE // r20 = loc[IA64_REG_FR20] + and r17 = -4, r17 + ;; + + ldf.fill f16 = [r16] // f16 restored (don't touch no more) + ldf.fill f17 = [r17] // f17 restored (don't touch no more) + and r18 = -4, r18 + + ld8 r21 = [r2], 2*LOC_SIZE // r21 = loc[IA64_REG_FR21] + ld8 r22 = [r3], 2*LOC_SIZE // r22 = loc[IA64_REG_FR22] + and r19 = -4, r19 + ;; + + ldf.fill f18 = [r18] // f18 restored (don't touch no more) + ldf.fill f19 = [r19] // f19 restored (don't touch no more) + and r20 = -4, r20 + + ld8 r23 = [r2], 2*LOC_SIZE // r23 = loc[IA64_REG_FR23] + ld8 r24 = [r3], 2*LOC_SIZE // r24 = loc[IA64_REG_FR24] + and r21 = -4, r21 + ;; + + ldf.fill f20 = [r20] // f20 restored (don't touch no more) + ldf.fill f21 = [r21] // f21 restored (don't touch no more) + and r22 = -4, r22 + + ld8 r25 = [r2], 2*LOC_SIZE // r25 = loc[IA64_REG_FR25] + ld8 r26 = [r3], 2*LOC_SIZE // r26 = loc[IA64_REG_FR26] + and r23 = -4, r23 + ;; + + ldf.fill f22 = [r22] // f22 restored (don't touch no more) + ldf.fill f23 = [r23] // f23 restored (don't touch no more) + and r24 = -4, r24 + + ld8 r27 = [r2], 2*LOC_SIZE // r27 = loc[IA64_REG_FR27] + ld8 r28 = [r3], 2*LOC_SIZE // r28 = loc[IA64_REG_FR28] + and r25 = -4, r25 + ;; + + ldf.fill f24 = [r24] // f24 restored (don't touch no more) + ldf.fill f25 = [r25] // f25 restored (don't touch no more) + and r26 = -4, r26 + + ld8 r29 = [r2], 2*LOC_SIZE // r29 = loc[IA64_REG_FR29] + ld8 r30 = [r3], 2*LOC_SIZE // r30 = loc[IA64_REG_FR30] + and r27 = -4, r27 + ;; + + ldf.fill f26 = [r26] // f26 restored (don't touch no more) + ldf.fill f27 = [r27] // f27 restored (don't touch no more) + and r28 = -4, r28 + + ld8 r31 = [r2] // r31 = loc[IA64_REG_FR31] + mov.m ar.unat = in1 + and r29 = -4, r29 + ;; + + ldf.fill f28 = [r28] // f28 restored (don't touch no more) + ldf.fill f29 = [r29] // f29 restored (don't touch no more) + and r30 = -4, r30 + + ld8 r1 = [in2], 8 // gp restored (don't touch no more) + add r8 = SIGCONTEXT_ADDR_OFF, in0 + and r31 = -4, r31 + ;; + + ld8 r8 = [r8] // r8 = sigcontext_addr + and r11 = 0x1c, r10 // clear all but rsc.be and rsc.pl + add r2 = PFS_LOC_OFF, in0 + + ldf.fill f30 = [r30] // f30 restored (don't touch no more) + ldf.fill f31 = [r31] // f31 restored (don't touch no more) + add r3 = 8, in2 + ;; + + ld8.fill r4 = [in2], 16 // r4 restored (don't touch no more) + ld8.fill r5 = [r3], 16 // r5 restored (don't touch no more) + cmp.eq pRet, pSig = r0, r8 // sigcontext_addr == NULL? + ;; + ld8.fill r6 = [in2], 16 // r6 restored (don't touch no more) + ld8.fill r7 = [r3] // r7 restored (don't touch no more) + add r3 = IP_OFF, in0 + ;; + + ld8 r14 = [r2], (B1_LOC_OFF - PFS_LOC_OFF) // r14 = pfs_loc + ld8 r15 = [r3] // r15 = ip + add r3 = (B2_LOC_OFF - IP_OFF), r3 + ;; + + ld8 r16 = [r2], (B3_LOC_OFF - B1_LOC_OFF) // r16 = b1_loc + ld8 r17= [r3], (B4_LOC_OFF - B2_LOC_OFF) // r17 = b2_loc + and r14 = -4, r14 + ;; + + ld8 r18 = [r2], (B5_LOC_OFF - B3_LOC_OFF) // r18 = b3_loc + ld8 r19 = [r3], (F2_LOC_OFF - B4_LOC_OFF) // r19 = b4_loc + and r16 = -4, r16 + ;; + + ld8 r20 = [r2], (F3_LOC_OFF - B5_LOC_OFF) // r20 = b5_loc + ld8 r21 = [r3], (F4_LOC_OFF - F2_LOC_OFF) // r21 = f2_loc + and r17 = -4, r17 + ;; + + ld8 r16 = [r16] // r16 = *b1_loc + ld8 r17 = [r17] // r17 = *b2_loc + and r18 = -4, r18 + + ld8 r22 = [r2], (F5_LOC_OFF - F3_LOC_OFF) // r21 = f3_loc + ld8 r23 = [r3], (UNAT_LOC_OFF - F4_LOC_OFF) // r22 = f4_loc + and r19 = -4, r19 + ;; + + ld8 r18 = [r18] // r18 = *b3_loc + ld8 r19 = [r19] // r19 = *b4_loc + and r20 = -4, r20 + + ld8 r24 = [r2], (LC_LOC_OFF - F5_LOC_OFF) // r24 = f5_loc + ld8 r25 = [r3], (FPSR_LOC_OFF - UNAT_LOC_OFF) // r25 = unat_loc + and r21 = -4, r21 + ;; + + and r22 = -4, r22 + and r23 = -4, r23 + and r24 = -4, r24 + + ld8 r20 = [r20] // r20 = *b5_loc + ldf.fill f2 = [r21] // f2 restored (don't touch no more) + mov b1 = r16 // b1 restored (don't touch no more) + ;; + + ldf.fill f3 = [r22] // f3 restored (don't touch no more) + ldf.fill f4 = [r23] // f4 restored (don't touch no more) + mov b2 = r17 // b2 restored (don't touch no more) + + ld8 r26 = [r2], (RNAT_LOC_OFF - LC_LOC_OFF) // r26 = lc_loc + ld8 r27 = [r3] // r27 = fpsr_loc + and r25 = -4, r25 + + add r3 = (PSP_OFF - FPSR_LOC_OFF), r3 + nop 0 + nop 0 + ;; + + ldf.fill f5 = [r24] // f5 restored (don't touch no more) +(pRet) ld8 r25 = [r25] // r25 = *unat_loc + mov b3 = r18 // b3 restored (don't touch no more) + + ld8 r28 = [r2], (BSP_OFF - RNAT_LOC_OFF) // r28 = rnat_loc + ld8 r29 = [r3], (PR_OFF - PSP_OFF) // r29 = sp + mov b4 = r19 // b4 restored (don't touch no more) + + and r26 = -4, r26 + and r27 = -4, r27 + mov b5 = r20 // b5 restored (don't touch no more) + ;; + + ld8 r26 = [r26] // r26 = *lc_loc + ld8 r27 = [r27] // r27 = *fpsr_loc + and r28 = -4, r28 + + mov r30 = in3 // make backup-copy of new bsp + ld8 r31 = [r3] // r31 = pr + mov rp = r15 + ;; + + ld8 r28 = [r28] // r28 = rnat + mov.m ar.rsc = r11 // put RSE into enforced lazy mode + mov.i ar.lc = r26 // lc restored (don't touch no more) + ;; + + loadrs // drop dirty partition + mov r9 = in2 // make backup-copy of &extra[r16] + cmp.eq p8, p0 = in4, r0 // dirty-size == 0? +(p8) br.cond.dpnt.many .skip_load_dirty + + mov r2 = in4 // make backup-copy of dirty_size + mov r15 = in5 // make backup-copy of dirty_partition + mov r16 = in6 // make backup-copy of dirty_rnat + ;; + + alloc r3 = ar.pfs, 0, 0, 0, 0 // drop register frame + dep r11 = r2, r11, 16, 16 + ;; + mov.m ar.bspstore = r15 + ;; + mov.m ar.rnat = r16 + mov.m ar.rsc = r11 // 14 cycles latency to loadrs + ;; + loadrs // loadup new dirty partition + ;; + +.skip_load_dirty: + mov.m ar.bspstore = r30 // restore register backing-store + add r3 = 8, r9 // r3 = &extra[r16] + ;; + +(pRet) mov.m ar.fpsr = r27 // fpsr restored (don't touch no more) + mov.m ar.rnat = r28 +(pSig) br.cond.dpnt.many .next + +/****** Return via br.ret: */ + + ld8 r14 = [r14] // r14 = *pfs_loc + ld8 r15 = [r9], 16 // r15 restored (don't touch no more) + mov pr = r31, -1 // pr restored (don't touch no more) + ;; + + ld8 r16 = [r3], 16 // r16 restored (don't touch no more) + ld8 r17 = [r9] // r17 restored (don't touch no more) + nop.i 0 + ;; + + ld8 r18 = [r3] // r18 restored (don't touch no more) + mov.m ar.rsc = r10 // restore original ar.rsc + mov sp = r29 + + mov.m ar.unat = r25 // unat restored (don't touch no more) + mov.i ar.pfs = r14 + br.ret.sptk.many rp + ;; + +/****** Return via sigreturn(): */ + +.next: mov.m ar.rsc = r10 // restore original ar.rsc + add r2 = (SC_FR + 6*16), r8 + add r3 = (SC_FR + 7*16), r8 + ;; + + ldf.fill f6 = [r2], 32 + ldf.fill f7 = [r3], 32 + nop 0 + ;; + + ldf.fill f8 = [r2], 32 + ldf.fill f9 = [r3], 32 + nop 0 + ;; + + ldf.fill f10 = [r2], 32 + ldf.fill f11 = [r3], 32 + nop 0 + ;; + + ldf.fill f12 = [r2], 32 + ldf.fill f13 = [r3], 32 + nop 0 + ;; + + ldf.fill f14 = [r2], 32 + ldf.fill f15 = [r3], 32 + mov sp = r29 + ;; + +#if NEW_SYSCALL + add r2 = 8, tp;; + ld8 r2 = [r2] + mov r15 = SYS_sigreturn + mov b7 = r2 + br.call.sptk.many b6 = b7 + ;; +#else + mov r15 = SYS_sigreturn + break 0x100000 +#endif + break 0 // bug out if sigreturn() returns + + .endp ia64_install_cursor + +#endif /* !UNW_REMOTE_ONLY */ +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/ia64/Gis_signal_frame.c new file mode 100644 index 0000000000..cc69bd6336 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gis_signal_frame.c @@ -0,0 +1,54 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + struct ia64_state_record sr; + int ret; + + /* Crude and slow, but we need to peek ahead into the unwind + descriptors to find out if the current IP is inside the signal + trampoline. */ + ret = ia64_fetch_proc_info (c, c->ip, 1); + if (ret < 0) + return ret; + + ret = ia64_create_state_record (c, &sr); + if (ret < 0) + return ret; + + /* For now, we assume that any non-zero abi marker implies a signal frame. + This should get us pretty far. */ + ret = (sr.abi_marker != 0); + + ia64_free_state_record (&sr); + + Debug (1, "(cursor=%p, ip=0x%016lx) -> %d\n", c, c->ip, ret); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gparser.c b/sdk/cpprt/linux/libunwind/src/ia64/Gparser.c new file mode 100644 index 0000000000..88ea90f40a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gparser.c @@ -0,0 +1,1131 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* forward declaration: */ +static int create_state_record_for (struct cursor *c, + struct ia64_state_record *sr, + unw_word_t ip); + +typedef unsigned long unw_word; + +#define alloc_reg_state() (mempool_alloc (&unw.reg_state_pool)) +#define free_reg_state(rs) (mempool_free (&unw.reg_state_pool, rs)) +#define alloc_labeled_state() (mempool_alloc (&unw.labeled_state_pool)) +#define free_labeled_state(s) (mempool_free (&unw.labeled_state_pool, s)) + +/* Routines to manipulate the state stack. */ + +static inline void +push (struct ia64_state_record *sr) +{ + struct ia64_reg_state *rs; + + rs = alloc_reg_state (); + if (!rs) + { + print_error ("libunwind: cannot stack reg state!\n"); + return; + } + memcpy (rs, &sr->curr, sizeof (*rs)); + sr->curr.next = rs; +} + +static void +pop (struct ia64_state_record *sr) +{ + struct ia64_reg_state *rs = sr->curr.next; + + if (!rs) + { + print_error ("libunwind: stack underflow!\n"); + return; + } + memcpy (&sr->curr, rs, sizeof (*rs)); + free_reg_state (rs); +} + +/* Make a copy of the state stack. Non-recursive to avoid stack overflows. */ +static struct ia64_reg_state * +dup_state_stack (struct ia64_reg_state *rs) +{ + struct ia64_reg_state *copy, *prev = NULL, *first = NULL; + + while (rs) + { + copy = alloc_reg_state (); + if (!copy) + { + print_error ("unwind.dup_state_stack: out of memory\n"); + return NULL; + } + memcpy (copy, rs, sizeof (*copy)); + if (first) + prev->next = copy; + else + first = copy; + rs = rs->next; + prev = copy; + } + return first; +} + +/* Free all stacked register states (but not RS itself). */ +static void +free_state_stack (struct ia64_reg_state *rs) +{ + struct ia64_reg_state *p, *next; + + for (p = rs->next; p != NULL; p = next) + { + next = p->next; + free_reg_state (p); + } + rs->next = NULL; +} + +/* Unwind decoder routines */ + +static enum ia64_pregnum __attribute__ ((const)) +decode_abreg (unsigned char abreg, int memory) +{ + switch (abreg) + { + case 0x04 ... 0x07: + return IA64_REG_R4 + (abreg - 0x04); + case 0x22 ... 0x25: + return IA64_REG_F2 + (abreg - 0x22); + case 0x30 ... 0x3f: + return IA64_REG_F16 + (abreg - 0x30); + case 0x41 ... 0x45: + return IA64_REG_B1 + (abreg - 0x41); + case 0x60: + return IA64_REG_PR; + case 0x61: + return IA64_REG_PSP; + case 0x62: + return memory ? IA64_REG_PRI_UNAT_MEM : IA64_REG_PRI_UNAT_GR; + case 0x63: + return IA64_REG_IP; + case 0x64: + return IA64_REG_BSP; + case 0x65: + return IA64_REG_BSPSTORE; + case 0x66: + return IA64_REG_RNAT; + case 0x67: + return IA64_REG_UNAT; + case 0x68: + return IA64_REG_FPSR; + case 0x69: + return IA64_REG_PFS; + case 0x6a: + return IA64_REG_LC; + default: + break; + } + Dprintf ("libunwind: bad abreg=0x%x\n", abreg); + return IA64_REG_LC; +} + +static void +set_reg (struct ia64_reg_info *reg, enum ia64_where where, int when, + unsigned long val) +{ + reg->val = val; + reg->where = where; + if (reg->when == IA64_WHEN_NEVER) + reg->when = when; +} + +static void +alloc_spill_area (unsigned long *offp, unsigned long regsize, + struct ia64_reg_info *lo, struct ia64_reg_info *hi) +{ + struct ia64_reg_info *reg; + + for (reg = hi; reg >= lo; --reg) + { + if (reg->where == IA64_WHERE_SPILL_HOME) + { + reg->where = IA64_WHERE_PSPREL; + *offp -= regsize; + reg->val = *offp; + } + } +} + +static inline void +spill_next_when (struct ia64_reg_info **regp, struct ia64_reg_info *lim, + unw_word t) +{ + struct ia64_reg_info *reg; + + for (reg = *regp; reg <= lim; ++reg) + { + if (reg->where == IA64_WHERE_SPILL_HOME) + { + reg->when = t; + *regp = reg + 1; + return; + } + } + Dprintf ("libunwind: excess spill!\n"); +} + +static inline void +finish_prologue (struct ia64_state_record *sr) +{ + struct ia64_reg_info *reg; + unsigned long off; + int i; + + /* First, resolve implicit register save locations (see Section + "11.4.2.3 Rules for Using Unwind Descriptors", rule 3). */ + for (i = 0; i < (int) ARRAY_SIZE (unw.save_order); ++i) + { + reg = sr->curr.reg + unw.save_order[i]; + if (reg->where == IA64_WHERE_GR_SAVE) + { + reg->where = IA64_WHERE_GR; + reg->val = sr->gr_save_loc++; + } + } + + /* Next, compute when the fp, general, and branch registers get + saved. This must come before alloc_spill_area() because we need + to know which registers are spilled to their home locations. */ + + if (sr->imask) + { + unsigned char kind, mask = 0, *cp = sr->imask; + unsigned long t; + static const unsigned char limit[3] = + { + IA64_REG_F31, IA64_REG_R7, IA64_REG_B5 + }; + struct ia64_reg_info *(regs[3]); + + regs[0] = sr->curr.reg + IA64_REG_F2; + regs[1] = sr->curr.reg + IA64_REG_R4; + regs[2] = sr->curr.reg + IA64_REG_B1; + + for (t = 0; (int) t < sr->region_len; ++t) + { + if ((t & 3) == 0) + mask = *cp++; + kind = (mask >> 2 * (3 - (t & 3))) & 3; + if (kind > 0) + spill_next_when (®s[kind - 1], sr->curr.reg + limit[kind - 1], + sr->region_start + t); + } + } + + /* Next, lay out the memory stack spill area. */ + + if (sr->any_spills) + { + off = sr->spill_offset; + alloc_spill_area (&off, 16, sr->curr.reg + IA64_REG_F2, + sr->curr.reg + IA64_REG_F31); + alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_B1, + sr->curr.reg + IA64_REG_B5); + alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_R4, + sr->curr.reg + IA64_REG_R7); + } +} + +/* Region header descriptors. */ + +static void +desc_prologue (int body, unw_word rlen, unsigned char mask, + unsigned char grsave, struct ia64_state_record *sr) +{ + int i, region_start; + + if (!(sr->in_body || sr->first_region)) + finish_prologue (sr); + sr->first_region = 0; + + /* check if we're done: */ + if (sr->when_target < sr->region_start + sr->region_len) + { + sr->done = 1; + return; + } + + region_start = sr->region_start + sr->region_len; + + for (i = 0; i < sr->epilogue_count; ++i) + pop (sr); + sr->epilogue_count = 0; + sr->when_sp_restored = IA64_WHEN_NEVER; + + sr->region_start = region_start; + sr->region_len = rlen; + sr->in_body = body; + + if (!body) + { + push (sr); + + if (mask) + for (i = 0; i < 4; ++i) + { + if (mask & 0x8) + set_reg (sr->curr.reg + unw.save_order[i], IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, grsave++); + mask <<= 1; + } + sr->gr_save_loc = grsave; + sr->any_spills = 0; + sr->imask = 0; + sr->spill_offset = 0x10; /* default to psp+16 */ + } +} + +/* Prologue descriptors. */ + +static inline void +desc_abi (unsigned char abi, unsigned char context, + struct ia64_state_record *sr) +{ + sr->abi_marker = (abi << 8) | context; +} + +static inline void +desc_br_gr (unsigned char brmask, unsigned char gr, + struct ia64_state_record *sr) +{ + int i; + + for (i = 0; i < 5; ++i) + { + if (brmask & 1) + set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, gr++); + brmask >>= 1; + } +} + +static inline void +desc_br_mem (unsigned char brmask, struct ia64_state_record *sr) +{ + int i; + + for (i = 0; i < 5; ++i) + { + if (brmask & 1) + { + set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } + brmask >>= 1; + } +} + +static inline void +desc_frgr_mem (unsigned char grmask, unw_word frmask, + struct ia64_state_record *sr) +{ + int i; + + for (i = 0; i < 4; ++i) + { + if ((grmask & 1) != 0) + { + set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } + grmask >>= 1; + } + for (i = 0; i < 20; ++i) + { + if ((frmask & 1) != 0) + { + int base = (i < 4) ? IA64_REG_F2 : IA64_REG_F16 - 4; + set_reg (sr->curr.reg + base + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } + frmask >>= 1; + } +} + +static inline void +desc_fr_mem (unsigned char frmask, struct ia64_state_record *sr) +{ + int i; + + for (i = 0; i < 4; ++i) + { + if ((frmask & 1) != 0) + { + set_reg (sr->curr.reg + IA64_REG_F2 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } + frmask >>= 1; + } +} + +static inline void +desc_gr_gr (unsigned char grmask, unsigned char gr, + struct ia64_state_record *sr) +{ + int i; + + for (i = 0; i < 4; ++i) + { + if ((grmask & 1) != 0) + set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, gr++); + grmask >>= 1; + } +} + +static inline void +desc_gr_mem (unsigned char grmask, struct ia64_state_record *sr) +{ + int i; + + for (i = 0; i < 4; ++i) + { + if ((grmask & 1) != 0) + { + set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } + grmask >>= 1; + } +} + +static inline void +desc_mem_stack_f (unw_word t, unw_word size, struct ia64_state_record *sr) +{ + set_reg (sr->curr.reg + IA64_REG_PSP, IA64_WHERE_NONE, + sr->region_start + MIN ((int) t, sr->region_len - 1), 16 * size); +} + +static inline void +desc_mem_stack_v (unw_word t, struct ia64_state_record *sr) +{ + sr->curr.reg[IA64_REG_PSP].when = + sr->region_start + MIN ((int) t, sr->region_len - 1); +} + +static inline void +desc_reg_gr (unsigned char reg, unsigned char dst, + struct ia64_state_record *sr) +{ + set_reg (sr->curr.reg + reg, IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, dst); +} + +static inline void +desc_reg_psprel (unsigned char reg, unw_word pspoff, + struct ia64_state_record *sr) +{ + set_reg (sr->curr.reg + reg, IA64_WHERE_PSPREL, + sr->region_start + sr->region_len - 1, 0x10 - 4 * pspoff); +} + +static inline void +desc_reg_sprel (unsigned char reg, unw_word spoff, + struct ia64_state_record *sr) +{ + set_reg (sr->curr.reg + reg, IA64_WHERE_SPREL, + sr->region_start + sr->region_len - 1, 4 * spoff); +} + +static inline void +desc_rp_br (unsigned char dst, struct ia64_state_record *sr) +{ + sr->return_link_reg = dst; +} + +static inline void +desc_reg_when (unsigned char regnum, unw_word t, struct ia64_state_record *sr) +{ + struct ia64_reg_info *reg = sr->curr.reg + regnum; + + if (reg->where == IA64_WHERE_NONE) + reg->where = IA64_WHERE_GR_SAVE; + reg->when = sr->region_start + MIN ((int) t, sr->region_len - 1); +} + +static inline void +desc_spill_base (unw_word pspoff, struct ia64_state_record *sr) +{ + sr->spill_offset = 0x10 - 4 * pspoff; +} + +static inline unsigned char * +desc_spill_mask (unsigned char *imaskp, struct ia64_state_record *sr) +{ + sr->imask = imaskp; + return imaskp + (2 * sr->region_len + 7) / 8; +} + +/* Body descriptors. */ + +static inline void +desc_epilogue (unw_word t, unw_word ecount, struct ia64_state_record *sr) +{ + sr->when_sp_restored = sr->region_start + sr->region_len - 1 - t; + sr->epilogue_count = ecount + 1; +} + +static inline void +desc_copy_state (unw_word label, struct ia64_state_record *sr) +{ + struct ia64_labeled_state *ls; + + for (ls = sr->labeled_states; ls; ls = ls->next) + { + if (ls->label == label) + { + free_state_stack (&sr->curr); + memcpy (&sr->curr, &ls->saved_state, sizeof (sr->curr)); + sr->curr.next = dup_state_stack (ls->saved_state.next); + return; + } + } + print_error ("libunwind: failed to find labeled state\n"); +} + +static inline void +desc_label_state (unw_word label, struct ia64_state_record *sr) +{ + struct ia64_labeled_state *ls; + + ls = alloc_labeled_state (); + if (!ls) + { + print_error ("unwind.desc_label_state(): out of memory\n"); + return; + } + ls->label = label; + memcpy (&ls->saved_state, &sr->curr, sizeof (ls->saved_state)); + ls->saved_state.next = dup_state_stack (sr->curr.next); + + /* insert into list of labeled states: */ + ls->next = sr->labeled_states; + sr->labeled_states = ls; +} + +/* General descriptors. */ + +static inline int +desc_is_active (unsigned char qp, unw_word t, struct ia64_state_record *sr) +{ + if (sr->when_target <= sr->region_start + MIN ((int) t, sr->region_len - 1)) + return 0; + if (qp > 0) + { + if ((sr->pr_val & ((unw_word_t) 1 << qp)) == 0) + return 0; + sr->pr_mask |= ((unw_word_t) 1 << qp); + } + return 1; +} + +static inline void +desc_restore_p (unsigned char qp, unw_word t, unsigned char abreg, + struct ia64_state_record *sr) +{ + struct ia64_reg_info *r; + + if (!desc_is_active (qp, t, sr)) + return; + + r = sr->curr.reg + decode_abreg (abreg, 0); + r->where = IA64_WHERE_NONE; + r->when = IA64_WHEN_NEVER; + r->val = 0; +} + +static inline void +desc_spill_reg_p (unsigned char qp, unw_word t, unsigned char abreg, + unsigned char x, unsigned char ytreg, + struct ia64_state_record *sr) +{ + enum ia64_where where = IA64_WHERE_GR; + struct ia64_reg_info *r; + + if (!desc_is_active (qp, t, sr)) + return; + + if (x) + where = IA64_WHERE_BR; + else if (ytreg & 0x80) + where = IA64_WHERE_FR; + + r = sr->curr.reg + decode_abreg (abreg, 0); + r->where = where; + r->when = sr->region_start + MIN ((int) t, sr->region_len - 1); + r->val = (ytreg & 0x7f); +} + +static inline void +desc_spill_psprel_p (unsigned char qp, unw_word t, unsigned char abreg, + unw_word pspoff, struct ia64_state_record *sr) +{ + struct ia64_reg_info *r; + + if (!desc_is_active (qp, t, sr)) + return; + + r = sr->curr.reg + decode_abreg (abreg, 1); + r->where = IA64_WHERE_PSPREL; + r->when = sr->region_start + MIN ((int) t, sr->region_len - 1); + r->val = 0x10 - 4 * pspoff; +} + +static inline void +desc_spill_sprel_p (unsigned char qp, unw_word t, unsigned char abreg, + unw_word spoff, struct ia64_state_record *sr) +{ + struct ia64_reg_info *r; + + if (!desc_is_active (qp, t, sr)) + return; + + r = sr->curr.reg + decode_abreg (abreg, 1); + r->where = IA64_WHERE_SPREL; + r->when = sr->region_start + MIN ((int) t, sr->region_len - 1); + r->val = 4 * spoff; +} + +#define UNW_DEC_BAD_CODE(code) \ + print_error ("libunwind: unknown code encountered\n") + +/* Register names. */ +#define UNW_REG_BSP IA64_REG_BSP +#define UNW_REG_BSPSTORE IA64_REG_BSPSTORE +#define UNW_REG_FPSR IA64_REG_FPSR +#define UNW_REG_LC IA64_REG_LC +#define UNW_REG_PFS IA64_REG_PFS +#define UNW_REG_PR IA64_REG_PR +#define UNW_REG_RNAT IA64_REG_RNAT +#define UNW_REG_PSP IA64_REG_PSP +#define UNW_REG_RP IA64_REG_IP +#define UNW_REG_UNAT IA64_REG_UNAT + +/* Region headers. */ +#define UNW_DEC_PROLOGUE_GR(fmt,r,m,gr,arg) desc_prologue(0,r,m,gr,arg) +#define UNW_DEC_PROLOGUE(fmt,b,r,arg) desc_prologue(b,r,0,32,arg) + +/* Prologue descriptors. */ +#define UNW_DEC_ABI(fmt,a,c,arg) desc_abi(a,c,arg) +#define UNW_DEC_BR_GR(fmt,b,g,arg) desc_br_gr(b,g,arg) +#define UNW_DEC_BR_MEM(fmt,b,arg) desc_br_mem(b,arg) +#define UNW_DEC_FRGR_MEM(fmt,g,f,arg) desc_frgr_mem(g,f,arg) +#define UNW_DEC_FR_MEM(fmt,f,arg) desc_fr_mem(f,arg) +#define UNW_DEC_GR_GR(fmt,m,g,arg) desc_gr_gr(m,g,arg) +#define UNW_DEC_GR_MEM(fmt,m,arg) desc_gr_mem(m,arg) +#define UNW_DEC_MEM_STACK_F(fmt,t,s,arg) desc_mem_stack_f(t,s,arg) +#define UNW_DEC_MEM_STACK_V(fmt,t,arg) desc_mem_stack_v(t,arg) +#define UNW_DEC_REG_GR(fmt,r,d,arg) desc_reg_gr(r,d,arg) +#define UNW_DEC_REG_PSPREL(fmt,r,o,arg) desc_reg_psprel(r,o,arg) +#define UNW_DEC_REG_SPREL(fmt,r,o,arg) desc_reg_sprel(r,o,arg) +#define UNW_DEC_REG_WHEN(fmt,r,t,arg) desc_reg_when(r,t,arg) +#define UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) \ + desc_reg_when(IA64_REG_PRI_UNAT_GR,t,arg) +#define UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) \ + desc_reg_when(IA64_REG_PRI_UNAT_MEM,t,arg) +#define UNW_DEC_PRIUNAT_GR(fmt,r,arg) \ + desc_reg_gr(IA64_REG_PRI_UNAT_GR,r,arg) +#define UNW_DEC_PRIUNAT_PSPREL(fmt,o,arg) \ + desc_reg_psprel(IA64_REG_PRI_UNAT_MEM,o,arg) +#define UNW_DEC_PRIUNAT_SPREL(fmt,o,arg) \ + desc_reg_sprel(IA64_REG_PRI_UNAT_MEM,o,arg) +#define UNW_DEC_RP_BR(fmt,d,arg) desc_rp_br(d,arg) +#define UNW_DEC_SPILL_BASE(fmt,o,arg) desc_spill_base(o,arg) +#define UNW_DEC_SPILL_MASK(fmt,m,arg) (m = desc_spill_mask(m,arg)) + +/* Body descriptors. */ +#define UNW_DEC_EPILOGUE(fmt,t,c,arg) desc_epilogue(t,c,arg) +#define UNW_DEC_COPY_STATE(fmt,l,arg) desc_copy_state(l,arg) +#define UNW_DEC_LABEL_STATE(fmt,l,arg) desc_label_state(l,arg) + +/* General unwind descriptors. */ +#define UNW_DEC_SPILL_REG_P(f,p,t,a,x,y,arg) desc_spill_reg_p(p,t,a,x,y,arg) +#define UNW_DEC_SPILL_REG(f,t,a,x,y,arg) desc_spill_reg_p(0,t,a,x,y,arg) +#define UNW_DEC_SPILL_PSPREL_P(f,p,t,a,o,arg) \ + desc_spill_psprel_p(p,t,a,o,arg) +#define UNW_DEC_SPILL_PSPREL(f,t,a,o,arg) \ + desc_spill_psprel_p(0,t,a,o,arg) +#define UNW_DEC_SPILL_SPREL_P(f,p,t,a,o,arg) desc_spill_sprel_p(p,t,a,o,arg) +#define UNW_DEC_SPILL_SPREL(f,t,a,o,arg) desc_spill_sprel_p(0,t,a,o,arg) +#define UNW_DEC_RESTORE_P(f,p,t,a,arg) desc_restore_p(p,t,a,arg) +#define UNW_DEC_RESTORE(f,t,a,arg) desc_restore_p(0,t,a,arg) + +#include "unwind_decoder.h" + +#ifdef _U_dyn_op + +/* parse dynamic unwind info */ + +static struct ia64_reg_info * +lookup_preg (int regnum, int memory, struct ia64_state_record *sr) +{ + int preg; + + switch (regnum) + { + case UNW_IA64_AR_BSP: preg = IA64_REG_BSP; break; + case UNW_IA64_AR_BSPSTORE: preg = IA64_REG_BSPSTORE; break; + case UNW_IA64_AR_FPSR: preg = IA64_REG_FPSR; break; + case UNW_IA64_AR_LC: preg = IA64_REG_LC; break; + case UNW_IA64_AR_PFS: preg = IA64_REG_PFS; break; + case UNW_IA64_AR_RNAT: preg = IA64_REG_RNAT; break; + case UNW_IA64_AR_UNAT: preg = IA64_REG_UNAT; break; + case UNW_IA64_BR + 0: preg = IA64_REG_IP; break; + case UNW_IA64_PR: preg = IA64_REG_PR; break; + case UNW_IA64_SP: preg = IA64_REG_PSP; break; + + case UNW_IA64_NAT: + if (memory) + preg = IA64_REG_PRI_UNAT_MEM; + else + preg = IA64_REG_PRI_UNAT_GR; + break; + + case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7: + preg = IA64_REG_R4 + (regnum - (UNW_IA64_GR + 4)); + break; + + case UNW_IA64_BR + 1 ... UNW_IA64_BR + 5: + preg = IA64_REG_B1 + (regnum - UNW_IA64_BR); + break; + + case UNW_IA64_FR + 2 ... UNW_IA64_FR + 5: + preg = IA64_REG_F2 + (regnum - (UNW_IA64_FR + 2)); + break; + + case UNW_IA64_FR + 16 ... UNW_IA64_FR + 31: + preg = IA64_REG_F16 + (regnum - (UNW_IA64_FR + 16)); + break; + + default: + Dprintf ("%s: invalid register number %d\n", __FUNCTION__, regnum); + return NULL; + } + return sr->curr.reg + preg; +} + +/* An alias directive inside a region of length RLEN is interpreted to + mean that the region behaves exactly like the first RLEN + instructions at the aliased IP. RLEN=0 implies that the current + state matches exactly that of before the instruction at the aliased + IP is executed. */ + +static int +desc_alias (unw_dyn_op_t *op, struct cursor *c, struct ia64_state_record *sr) +{ + struct ia64_state_record orig_sr = *sr; + int i, ret, when, rlen = sr->region_len; + unw_word_t new_ip; + + when = MIN (sr->when_target, rlen); + new_ip = op->val + ((when / 3) * 16 + (when % 3)); + + if ((ret = ia64_fetch_proc_info (c, new_ip, 1)) < 0) + return ret; + + if ((ret = create_state_record_for (c, sr, new_ip)) < 0) + return ret; + + sr->first_region = orig_sr.first_region; + sr->done = 0; + sr->any_spills |= orig_sr.any_spills; + sr->in_body = orig_sr.in_body; + sr->region_start = orig_sr.region_start; + sr->region_len = orig_sr.region_len; + if (sr->when_sp_restored != IA64_WHEN_NEVER) + sr->when_sp_restored = op->when + MIN (orig_sr.when_sp_restored, rlen); + sr->epilogue_count = orig_sr.epilogue_count; + sr->when_target = orig_sr.when_target; + + for (i = 0; i < IA64_NUM_PREGS; ++i) + if (sr->curr.reg[i].when != IA64_WHEN_NEVER) + sr->curr.reg[i].when = op->when + MIN (sr->curr.reg[i].when, rlen); + + ia64_free_state_record (sr); + sr->labeled_states = orig_sr.labeled_states; + sr->curr.next = orig_sr.curr.next; + return 0; +} + +static inline int +parse_dynamic (struct cursor *c, struct ia64_state_record *sr) +{ + unw_dyn_info_t *di = c->pi.unwind_info; + unw_dyn_proc_info_t *proc = &di->u.pi; + unw_dyn_region_info_t *r; + struct ia64_reg_info *ri; + enum ia64_where where; + int32_t when, len; + unw_dyn_op_t *op; + unw_word_t val; + int memory, ret; + int8_t qp; + + for (r = proc->regions; r; r = r->next) + { + len = r->insn_count; + if (len < 0) + { + if (r->next) + { + Debug (1, "negative region length allowed in last region only!"); + return -UNW_EINVAL; + } + len = -len; + /* hack old region info to set the start where we need it: */ + sr->region_start = (di->end_ip - di->start_ip) / 0x10 * 3 - len; + sr->region_len = 0; + } + /* all regions are treated as prologue regions: */ + desc_prologue (0, len, 0, 0, sr); + + if (sr->done) + return 0; + + for (op = r->op; op < r->op + r->op_count; ++op) + { + when = op->when; + val = op->val; + qp = op->qp; + + if (!desc_is_active (qp, when, sr)) + continue; + + when = sr->region_start + MIN ((int) when, sr->region_len - 1); + + switch (op->tag) + { + case UNW_DYN_SAVE_REG: + memory = 0; + if ((unsigned) (val - UNW_IA64_GR) < 128) + where = IA64_WHERE_GR; + else if ((unsigned) (val - UNW_IA64_FR) < 128) + where = IA64_WHERE_FR; + else if ((unsigned) (val - UNW_IA64_BR) < 8) + where = IA64_WHERE_BR; + else + { + Dprintf ("%s: can't save to register number %d\n", + __FUNCTION__, (int) op->reg); + return -UNW_EBADREG; + } + /* fall through */ + update_reg_info: + ri = lookup_preg (op->reg, memory, sr); + if (!ri) + return -UNW_EBADREG; + ri->where = where; + ri->when = when; + ri->val = val; + break; + + case UNW_DYN_SPILL_FP_REL: + memory = 1; + where = IA64_WHERE_PSPREL; + val = 0x10 - val; + goto update_reg_info; + + case UNW_DYN_SPILL_SP_REL: + memory = 1; + where = IA64_WHERE_SPREL; + goto update_reg_info; + + case UNW_DYN_ADD: + if (op->reg == UNW_IA64_SP) + { + if (val & 0xf) + { + Dprintf ("%s: frame-size %ld not an integer " + "multiple of 16\n", + __FUNCTION__, (long) op->val); + return -UNW_EINVAL; + } + desc_mem_stack_f (when, -((int64_t) val / 16), sr); + } + else + { + Dprintf ("%s: can only ADD to stack-pointer\n", + __FUNCTION__); + return -UNW_EBADREG; + } + break; + + case UNW_DYN_POP_FRAMES: + sr->when_sp_restored = when; + sr->epilogue_count = op->val; + break; + + case UNW_DYN_LABEL_STATE: + desc_label_state (op->val, sr); + break; + + case UNW_DYN_COPY_STATE: + desc_copy_state (op->val, sr); + break; + + case UNW_DYN_ALIAS: + if ((ret = desc_alias (op, c, sr)) < 0) + return ret; + + case UNW_DYN_STOP: + goto end_of_ops; + } + } + end_of_ops: + ; + } + return 0; +} +#else +# define parse_dynamic(c,sr) (-UNW_EINVAL) +#endif /* _U_dyn_op */ + + +HIDDEN int +ia64_fetch_proc_info (struct cursor *c, unw_word_t ip, int need_unwind_info) +{ + int ret, dynamic = 1; + + if (c->pi_valid && !need_unwind_info) + return 0; + + /* check dynamic info first --- it overrides everything else */ + ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, need_unwind_info, + c->as_arg); + if (ret == -UNW_ENOINFO) + { + dynamic = 0; + ret = ia64_find_proc_info (c, ip, need_unwind_info); + } + + c->pi_valid = 1; + c->pi_is_dynamic = dynamic; + return ret; +} + +static inline void +put_unwind_info (struct cursor *c, unw_proc_info_t *pi) +{ + if (!c->pi_valid) + return; + + if (c->pi_is_dynamic) + unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg); + else + ia64_put_unwind_info (c, pi); +} + +static int +create_state_record_for (struct cursor *c, struct ia64_state_record *sr, + unw_word_t ip) +{ + unw_word_t predicates = c->pr; + struct ia64_reg_info *r; + uint8_t *dp, *desc_end; + int ret; + + assert (c->pi_valid); + + /* build state record */ + memset (sr, 0, sizeof (*sr)); + for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) + r->when = IA64_WHEN_NEVER; + sr->pr_val = predicates; + sr->first_region = 1; + + if (!c->pi.unwind_info) + { + /* No info, return default unwinder (leaf proc, no mem stack, no + saved regs), rp in b0, pfs in ar.pfs. */ + Debug (1, "no unwind info for ip=0x%lx (gp=%lx)\n", + (long) ip, (long) c->pi.gp); + sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR; + sr->curr.reg[IA64_REG_IP].when = -1; + sr->curr.reg[IA64_REG_IP].val = 0; + goto out; + } + + sr->when_target = (3 * ((ip & ~(unw_word_t) 0xf) - c->pi.start_ip) / 16 + + (ip & 0xf)); + + switch (c->pi.format) + { + case UNW_INFO_FORMAT_TABLE: + case UNW_INFO_FORMAT_REMOTE_TABLE: + dp = c->pi.unwind_info; + desc_end = dp + c->pi.unwind_info_size; + while (!sr->done && dp < desc_end) + dp = unw_decode (dp, sr->in_body, sr); + ret = 0; + break; + + case UNW_INFO_FORMAT_DYNAMIC: + ret = parse_dynamic (c, sr); + break; + + default: + ret = -UNW_EINVAL; + } + + put_unwind_info (c, &c->pi); + + if (ret < 0) + return ret; + + if (sr->when_target > sr->when_sp_restored) + { + /* sp has been restored and all values on the memory stack below + psp also have been restored. */ + sr->curr.reg[IA64_REG_PSP].val = 0; + sr->curr.reg[IA64_REG_PSP].where = IA64_WHERE_NONE; + sr->curr.reg[IA64_REG_PSP].when = IA64_WHEN_NEVER; + for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) + if ((r->where == IA64_WHERE_PSPREL && r->val <= 0x10) + || r->where == IA64_WHERE_SPREL) + { + r->val = 0; + r->where = IA64_WHERE_NONE; + r->when = IA64_WHEN_NEVER; + } + } + + /* If RP did't get saved, generate entry for the return link + register. */ + if (sr->curr.reg[IA64_REG_IP].when >= sr->when_target) + { + sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR; + sr->curr.reg[IA64_REG_IP].when = -1; + sr->curr.reg[IA64_REG_IP].val = sr->return_link_reg; + } + + if (sr->when_target > sr->curr.reg[IA64_REG_BSP].when + && sr->when_target > sr->curr.reg[IA64_REG_BSPSTORE].when + && sr->when_target > sr->curr.reg[IA64_REG_RNAT].when) + { + Debug (8, "func 0x%lx may switch the register-backing-store\n", + c->pi.start_ip); + c->pi.flags |= UNW_PI_FLAG_IA64_RBS_SWITCH; + } + out: +#if UNW_DEBUG + if (unwi_debug_level > 2) + { + Dprintf ("%s: state record for func 0x%lx, t=%u (flags=0x%lx):\n", + __FUNCTION__, + (long) c->pi.start_ip, sr->when_target, (long) c->pi.flags); + for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) + { + if (r->where != IA64_WHERE_NONE || r->when != IA64_WHEN_NEVER) + { + Dprintf (" %s <- ", unw.preg_name[r - sr->curr.reg]); + switch (r->where) + { + case IA64_WHERE_GR: + Dprintf ("r%lu", (long) r->val); + break; + case IA64_WHERE_FR: + Dprintf ("f%lu", (long) r->val); + break; + case IA64_WHERE_BR: + Dprintf ("b%lu", (long) r->val); + break; + case IA64_WHERE_SPREL: + Dprintf ("[sp+0x%lx]", (long) r->val); + break; + case IA64_WHERE_PSPREL: + Dprintf ("[psp+0x%lx]", (long) r->val); + break; + case IA64_WHERE_NONE: + Dprintf ("%s+0x%lx", + unw.preg_name[r - sr->curr.reg], (long) r->val); + break; + default: + Dprintf ("BADWHERE(%d)", r->where); + break; + } + Dprintf ("\t\t%d\n", r->when); + } + } + } +#endif + return 0; +} + +/* The proc-info must be valid for IP before this routine can be + called. */ +HIDDEN int +ia64_create_state_record (struct cursor *c, struct ia64_state_record *sr) +{ + return create_state_record_for (c, sr, c->ip); +} + +HIDDEN int +ia64_free_state_record (struct ia64_state_record *sr) +{ + struct ia64_labeled_state *ls, *next; + + /* free labeled register states & stack: */ + + for (ls = sr->labeled_states; ls; ls = next) + { + next = ls->next; + free_state_stack (&ls->saved_state); + free_labeled_state (ls); + } + free_state_stack (&sr->curr); + + return 0; +} + +HIDDEN int +ia64_make_proc_info (struct cursor *c) +{ + int ret, caching = c->as->caching_policy != UNW_CACHE_NONE; + + if (!caching || ia64_get_cached_proc_info (c) < 0) + { + /* Lookup it up the slow way... */ + if ((ret = ia64_fetch_proc_info (c, c->ip, 0)) < 0) + return ret; + if (caching) + ia64_cache_proc_info (c); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Grbs.c b/sdk/cpprt/linux/libunwind/src/ia64/Grbs.c new file mode 100644 index 0000000000..4230cf303e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Grbs.c @@ -0,0 +1,319 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Logically, we like to think of the stack as a contiguous region of +memory. Unfortunately, this logical view doesn't work for the +register backing store, because the RSE is an asynchronous engine and +because UNIX/Linux allow for stack-switching via sigaltstack(2). +Specifically, this means that any given stacked register may or may +not be backed up by memory in the current stack. If not, then the +backing memory may be found in any of the "more inner" (younger) +stacks. The routines in this file help manage the discontiguous +nature of the register backing store. The routines are completely +independent of UNIX/Linux, but each stack frame that switches the +backing store is expected to reserve 4 words for use by libunwind. For +example, in the Linux sigcontext, sc_fr[0] and sc_fr[1] serve this +purpose. */ + +#include "unwind_i.h" + +#if UNW_DEBUG + +HIDDEN const char * +ia64_strloc (ia64_loc_t loc) +{ + static char buf[128]; + + if (IA64_IS_NULL_LOC (loc)) + return ""; + + buf[0] = '\0'; + + if (IA64_IS_MEMSTK_NAT (loc)) + strcat (buf, "memstk_nat("); + if (IA64_IS_UC_LOC (loc)) + strcat (buf, "uc("); + if (IA64_IS_FP_LOC (loc)) + strcat (buf, "fp("); + + if (IA64_IS_REG_LOC (loc)) + sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc))); + else + sprintf (buf + strlen (buf), "0x%llx", + (unsigned long long) IA64_GET_ADDR (loc)); + + if (IA64_IS_FP_LOC (loc)) + strcat (buf, ")"); + if (IA64_IS_UC_LOC (loc)) + strcat (buf, ")"); + if (IA64_IS_MEMSTK_NAT (loc)) + strcat (buf, ")"); + + return buf; +} + +#endif /* UNW_DEBUG */ + +HIDDEN int +rbs_switch (struct cursor *c, + unw_word_t saved_bsp, unw_word_t saved_bspstore, + ia64_loc_t saved_rnat_loc) +{ + struct rbs_area *rbs = &c->rbs_area[c->rbs_curr]; + unw_word_t lo, ndirty, rbs_base; + int ret; + + Debug (10, "(left=%u, curr=%u)\n", c->rbs_left_edge, c->rbs_curr); + + /* Calculate address "lo" at which the backing store starts: */ + ndirty = rse_num_regs (saved_bspstore, saved_bsp); + lo = rse_skip_regs (c->bsp, -ndirty); + + rbs->size = (rbs->end - lo); + + /* If the previously-recorded rbs-area is empty we don't need to + track it and we can simply overwrite it... */ + if (rbs->size) + { + Debug (10, "inner=[0x%lx-0x%lx)\n", + (long) (rbs->end - rbs->size), (long) rbs->end); + + c->rbs_curr = (c->rbs_curr + 1) % ARRAY_SIZE (c->rbs_area); + rbs = c->rbs_area + c->rbs_curr; + + if (c->rbs_curr == c->rbs_left_edge) + c->rbs_left_edge = (c->rbs_left_edge + 1) % ARRAY_SIZE (c->rbs_area); + } + + if ((ret = rbs_get_base (c, saved_bspstore, &rbs_base)) < 0) + return ret; + + rbs->end = saved_bspstore; + rbs->size = saved_bspstore - rbs_base; + rbs->rnat_loc = saved_rnat_loc; + + c->bsp = saved_bsp; + + Debug (10, "outer=[0x%llx-0x%llx), rnat@%s\n", (long long) rbs_base, + (long long) rbs->end, ia64_strloc (rbs->rnat_loc)); + return 0; +} + +HIDDEN int +rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, + ia64_loc_t *locp, ia64_loc_t *rnat_locp) +{ + unw_word_t nregs, bsp = c->bsp, curr = c->rbs_curr, n; + unw_word_t left_edge = c->rbs_left_edge; +#if UNW_DEBUG + int reg = 32 + regs_to_skip; +#endif + + while (!rbs_contains (&c->rbs_area[curr], bsp)) + { + if (curr == left_edge) + { + Debug (1, "could not find register r%d!\n", reg); + return -UNW_EBADREG; + } + + n = rse_num_regs (c->rbs_area[curr].end, bsp); + curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) % ARRAY_SIZE (c->rbs_area); + bsp = rse_skip_regs (c->rbs_area[curr].end - c->rbs_area[curr].size, n); + } + + while (1) + { + nregs = rse_num_regs (bsp, c->rbs_area[curr].end); + + if (regs_to_skip < nregs) + { + /* found it: */ + unw_word_t addr; + + addr = rse_skip_regs (bsp, regs_to_skip); + if (locp) + *locp = rbs_loc (c->rbs_area + curr, addr); + if (rnat_locp) + *rnat_locp = rbs_get_rnat_loc (c->rbs_area + curr, addr); + return 0; + } + + if (curr == left_edge) + { + Debug (1, "could not find register r%d!\n", reg); + return -UNW_EBADREG; + } + + regs_to_skip -= nregs; + + curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) % ARRAY_SIZE (c->rbs_area); + bsp = c->rbs_area[curr].end - c->rbs_area[curr].size; + } +} + +#ifdef NEED_RBS_COVER_AND_FLUSH + +static inline int +get_rnat (struct cursor *c, struct rbs_area *rbs, unw_word_t bsp, + unw_word_t *__restrict rnatp) +{ + ia64_loc_t rnat_locp = rbs_get_rnat_loc (rbs, bsp); + + return ia64_get (c, rnat_locp, rnatp); +} + +/* Simulate the effect of "cover" followed by a "flushrs" for the + target-frame. However, since the target-frame's backing store + may not have space for the registers that got spilled onto other + rbs-areas, we save those registers to DIRTY_PARTITION where + we can then load them via a single "loadrs". + + This function returns the size of the dirty-partition that was + created or a negative error-code in case of error. + + Note: This does not modify the rbs_area[] structure in any way. */ +HIDDEN int +rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, + unw_word_t *dirty_partition, unw_word_t *dirty_rnat, + unw_word_t *bspstore) +{ + unw_word_t n, src_mask, dst_mask, bsp, *dst, src_rnat, dst_rnat = 0; + unw_word_t curr = c->rbs_curr, left_edge = c->rbs_left_edge; + struct rbs_area *rbs = c->rbs_area + curr; + int ret; + + bsp = c->bsp; + c->bsp = rse_skip_regs (bsp, nregs); + + if (likely (rbs_contains (rbs, bsp))) + { + /* at least _some_ registers are on rbs... */ + n = rse_num_regs (bsp, rbs->end); + if (likely (n >= nregs)) + { + /* common case #1: all registers are on current rbs... */ + /* got lucky: _all_ registers are on rbs... */ + ia64_loc_t rnat_loc = rbs_get_rnat_loc (rbs, c->bsp); + + *bspstore = c->bsp; + + if (IA64_IS_REG_LOC (rnat_loc)) + { + unw_word_t rnat_addr = (unw_word_t) + tdep_uc_addr (c->as_arg, UNW_IA64_AR_RNAT, NULL); + rnat_loc = IA64_LOC_ADDR (rnat_addr, 0); + } + c->loc[IA64_REG_RNAT] = rnat_loc; + return 0; /* all done */ + } + nregs -= n; /* account for registers already on the rbs */ + + assert (rse_skip_regs (c->bsp, -nregs) == rse_skip_regs (rbs->end, 0)); + } + else + /* Earlier frames also didn't get spilled; need to "loadrs" those, + too... */ + nregs += rse_num_regs (rbs->end, bsp); + + /* OK, we need to copy NREGS registers to the dirty partition. */ + + *bspstore = bsp = rbs->end; + c->loc[IA64_REG_RNAT] = rbs->rnat_loc; + assert (!IA64_IS_REG_LOC (rbs->rnat_loc)); + + dst = dirty_partition; + + while (nregs > 0) + { + if (unlikely (!rbs_contains (rbs, bsp))) + { + /* switch to next non-empty rbs-area: */ + do + { + if (curr == left_edge) + { + Debug (0, "rbs-underflow while flushing %lu regs, " + "bsp=0x%lx, dst=0x%p\n", (unsigned long) nregs, + (unsigned long) bsp, dst); + return -UNW_EBADREG; + } + + assert (rse_num_regs (rbs->end, bsp) == 0); + + curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) + % ARRAY_SIZE (c->rbs_area); + rbs = c->rbs_area + curr; + bsp = rbs->end - rbs->size; + } + while (rbs->size == 0); + + if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0) + return ret; + } + + if (unlikely (rse_is_rnat_slot (bsp))) + { + bsp += 8; + if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0) + return ret; + } + if (unlikely (rse_is_rnat_slot ((unw_word_t) dst))) + { + *dst++ = dst_rnat; + dst_rnat = 0; + } + + src_mask = ((unw_word_t) 1) << rse_slot_num (bsp); + dst_mask = ((unw_word_t) 1) << rse_slot_num ((unw_word_t) dst); + + if (src_rnat & src_mask) + dst_rnat |= dst_mask; + else + dst_rnat &= ~dst_mask; + + /* copy one slot: */ + if ((ret = ia64_get (c, rbs_loc (rbs, bsp), dst)) < 0) + return ret; + + /* advance to next slot: */ + --nregs; + bsp += 8; + ++dst; + } + if (unlikely (rse_is_rnat_slot ((unw_word_t) dst))) + { + /* The LOADRS instruction loads "the N bytes below the current + BSP" but BSP can never point to an RNaT slot so if the last + destination word happens to be an RNaT slot, we need to write + that slot now. */ + *dst++ = dst_rnat; + dst_rnat = 0; + } + *dirty_rnat = dst_rnat; + return (char *) dst - (char *) dirty_partition; +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gregs.c b/sdk/cpprt/linux/libunwind/src/ia64/Gregs.c new file mode 100644 index 0000000000..f3e40753af --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gregs.c @@ -0,0 +1,612 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" +#include "regs.h" +#include "unwind_i.h" + +static inline ia64_loc_t +linux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) +{ +#if !defined(UNW_LOCAL_ONLY) || defined(__linux) + unw_word_t addr = c->sigcontext_addr, flags, tmp_addr; + int i; + + if (ia64_get_abi_marker (c) == ABI_MARKER_LINUX_SIGTRAMP + || ia64_get_abi_marker (c) == ABI_MARKER_OLD_LINUX_SIGTRAMP) + { + switch (reg) + { + case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3: + case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31: + /* Linux sigcontext contains the NaT bit of scratch register + N in bit position N of the sc_nat member. */ + *nat_bitnr = (reg - UNW_IA64_NAT); + addr += LINUX_SC_NAT_OFF; + break; + + case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 31: + addr += LINUX_SC_GR_OFF + 8 * (reg - UNW_IA64_GR); + break; + + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15: + addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + + case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127: + if (ia64_get (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0), + &flags) < 0) + return IA64_NULL_LOC; + + if (!(flags & IA64_SC_FLAG_FPH_VALID)) + { + /* initialize fph partition: */ + tmp_addr = addr + LINUX_SC_FR_OFF + 32*16; + for (i = 32; i < 128; ++i, tmp_addr += 16) + if (ia64_putfp (c, IA64_LOC_ADDR (tmp_addr, 0), + unw.read_only.f0) < 0) + return IA64_NULL_LOC; + /* mark fph partition as valid: */ + if (ia64_put (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0), + flags | IA64_SC_FLAG_FPH_VALID) < 0) + return IA64_NULL_LOC; + } + + addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + + case UNW_IA64_BR + 0: addr += LINUX_SC_BR_OFF + 0; break; + case UNW_IA64_BR + 6: addr += LINUX_SC_BR_OFF + 6*8; break; + case UNW_IA64_BR + 7: addr += LINUX_SC_BR_OFF + 7*8; break; + case UNW_IA64_AR_RSC: addr += LINUX_SC_AR_RSC_OFF; break; + case UNW_IA64_AR_CSD: addr += LINUX_SC_AR_CSD_OFF; break; + case UNW_IA64_AR_SSD: addr += LINUX_SC_AR_SSD_OFF; break; + case UNW_IA64_AR_CCV: addr += LINUX_SC_AR_CCV; break; + + default: + if (unw_is_fpreg (reg)) + return IA64_FPREG_LOC (c, reg); + else + return IA64_REG_LOC (c, reg); + } + return IA64_LOC_ADDR (addr, 0); + } + else + { + int is_nat = 0; + + if ((unsigned) (reg - UNW_IA64_NAT) < 128) + { + is_nat = 1; + reg -= (UNW_IA64_NAT - UNW_IA64_GR); + } + if (ia64_get_abi_marker (c) == ABI_MARKER_LINUX_INTERRUPT) + { + switch (reg) + { + case UNW_IA64_BR + 6 ... UNW_IA64_BR + 7: + addr += LINUX_PT_B6_OFF + 8 * (reg - (UNW_IA64_BR + 6)); + break; + + case UNW_IA64_AR_CSD: addr += LINUX_PT_CSD_OFF; break; + case UNW_IA64_AR_SSD: addr += LINUX_PT_SSD_OFF; break; + + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11: + addr += LINUX_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8)); + break; + + case UNW_IA64_IP: addr += LINUX_PT_IIP_OFF; break; + case UNW_IA64_CFM: addr += LINUX_PT_IFS_OFF; break; + case UNW_IA64_AR_UNAT: addr += LINUX_PT_UNAT_OFF; break; + case UNW_IA64_AR_PFS: addr += LINUX_PT_PFS_OFF; break; + case UNW_IA64_AR_RSC: addr += LINUX_PT_RSC_OFF; break; + case UNW_IA64_AR_RNAT: addr += LINUX_PT_RNAT_OFF; break; + case UNW_IA64_AR_BSPSTORE: addr += LINUX_PT_BSPSTORE_OFF; break; + case UNW_IA64_PR: addr += LINUX_PT_PR_OFF; break; + case UNW_IA64_BR + 0: addr += LINUX_PT_B0_OFF; break; + + case UNW_IA64_GR + 1: + /* The saved r1 value is valid only in the frame in which + it was saved; for everything else we need to look up + the appropriate gp value. */ + if (c->sigcontext_addr != c->sp + 0x10) + return IA64_NULL_LOC; + addr += LINUX_PT_R1_OFF; + break; + + case UNW_IA64_GR + 12: addr += LINUX_PT_R12_OFF; break; + case UNW_IA64_GR + 13: addr += LINUX_PT_R13_OFF; break; + case UNW_IA64_AR_FPSR: addr += LINUX_PT_FPSR_OFF; break; + case UNW_IA64_GR + 15: addr += LINUX_PT_R15_OFF; break; + case UNW_IA64_GR + 14: addr += LINUX_PT_R14_OFF; break; + case UNW_IA64_GR + 2: addr += LINUX_PT_R2_OFF; break; + case UNW_IA64_GR + 3: addr += LINUX_PT_R3_OFF; break; + + case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31: + addr += LINUX_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16)); + break; + + case UNW_IA64_AR_CCV: addr += LINUX_PT_CCV_OFF; break; + + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 11: + addr += LINUX_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6)); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + + default: + if (unw_is_fpreg (reg)) + return IA64_FPREG_LOC (c, reg); + else + return IA64_REG_LOC (c, reg); + } + } + else if (ia64_get_abi_marker (c) == ABI_MARKER_OLD_LINUX_INTERRUPT) + { + switch (reg) + { + case UNW_IA64_GR + 1: + /* The saved r1 value is valid only in the frame in which + it was saved; for everything else we need to look up + the appropriate gp value. */ + if (c->sigcontext_addr != c->sp + 0x10) + return IA64_NULL_LOC; + addr += LINUX_OLD_PT_R1_OFF; + break; + + case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: + addr += LINUX_OLD_PT_R2_OFF + 8 * (reg - (UNW_IA64_GR + 2)); + break; + + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11: + addr += LINUX_OLD_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8)); + break; + + case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31: + addr += LINUX_OLD_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16)); + break; + + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 9: + addr += LINUX_OLD_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6)); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + + case UNW_IA64_BR + 0: addr += LINUX_OLD_PT_B0_OFF; break; + case UNW_IA64_BR + 6: addr += LINUX_OLD_PT_B6_OFF; break; + case UNW_IA64_BR + 7: addr += LINUX_OLD_PT_B7_OFF; break; + + case UNW_IA64_AR_RSC: addr += LINUX_OLD_PT_RSC_OFF; break; + case UNW_IA64_AR_CCV: addr += LINUX_OLD_PT_CCV_OFF; break; + + default: + if (unw_is_fpreg (reg)) + return IA64_FPREG_LOC (c, reg); + else + return IA64_REG_LOC (c, reg); + } + } + if (is_nat) + { + /* For Linux pt-regs structure, bit number is determined by + the UNaT slot number (as determined by st8.spill) and the + bits are saved wherever the (primary) UNaT was saved. */ + *nat_bitnr = ia64_unat_slot_num (addr); + return c->loc[IA64_REG_PRI_UNAT_MEM]; + } + return IA64_LOC_ADDR (addr, 0); + } +#endif + return IA64_NULL_LOC; +} + +static inline ia64_loc_t +hpux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) +{ +#if !defined(UNW_LOCAL_ONLY) || defined(__hpux) + return IA64_LOC_UC_REG (reg, c->sigcontext_addr); +#else + return IA64_NULL_LOC; +#endif +} + +HIDDEN ia64_loc_t +ia64_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) +{ + if (c->sigcontext_addr) + { + if (ia64_get_abi (c) == ABI_LINUX) + return linux_scratch_loc (c, reg, nat_bitnr); + else if (ia64_get_abi (c) == ABI_HPUX) + return hpux_scratch_loc (c, reg, nat_bitnr); + else + return IA64_NULL_LOC; + } + else + return IA64_REG_LOC (c, reg); +} + +static inline int +update_nat (struct cursor *c, ia64_loc_t nat_loc, unw_word_t mask, + unw_word_t *valp, int write) +{ + unw_word_t nat_word; + int ret; + + ret = ia64_get (c, nat_loc, &nat_word); + if (ret < 0) + return ret; + + if (write) + { + if (*valp) + nat_word |= mask; + else + nat_word &= ~mask; + ret = ia64_put (c, nat_loc, nat_word); + } + else + *valp = (nat_word & mask) != 0; + return ret; +} + +static int +access_nat (struct cursor *c, + ia64_loc_t nat_loc, ia64_loc_t reg_loc, uint8_t nat_bitnr, + unw_word_t *valp, int write) +{ + unw_word_t mask = 0; + unw_fpreg_t tmp; + int ret; + + if (IA64_IS_FP_LOC (reg_loc)) + { + /* NaT bit is saved as a NaTVal. This happens when a general + register is saved to a floating-point register. */ + if (write) + { + if (*valp) + { + if (ia64_is_big_endian (c)) + ret = ia64_putfp (c, reg_loc, unw.nat_val_be); + else + ret = ia64_putfp (c, reg_loc, unw.nat_val_le); + } + else + { + unw_word_t *src, *dst; + unw_fpreg_t tmp; + + ret = ia64_getfp (c, reg_loc, &tmp); + if (ret < 0) + return ret; + + /* Reset the exponent to 0x1003e so that the significand + will be interpreted as an integer value. */ + src = (unw_word_t *) &unw.int_val_be; + dst = (unw_word_t *) &tmp; + if (!ia64_is_big_endian (c)) + ++src, ++dst; + *dst = *src; + + ret = ia64_putfp (c, reg_loc, tmp); + } + } + else + { + ret = ia64_getfp (c, reg_loc, &tmp); + if (ret < 0) + return ret; + + if (ia64_is_big_endian (c)) + *valp = (memcmp (&tmp, &unw.nat_val_be, sizeof (tmp)) == 0); + else + *valp = (memcmp (&tmp, &unw.nat_val_le, sizeof (tmp)) == 0); + } + return ret; + } + + if ((IA64_IS_REG_LOC (nat_loc) + && (unsigned) (IA64_GET_REG (nat_loc) - UNW_IA64_NAT) < 128) + || IA64_IS_UC_LOC (reg_loc)) + { + if (write) + return ia64_put (c, nat_loc, *valp); + else + return ia64_get (c, nat_loc, valp); + } + + if (IA64_IS_NULL_LOC (nat_loc)) + { + /* NaT bit is not saved. This happens if a general register is + saved to a branch register. Since the NaT bit gets lost, we + need to drop it here, too. Note that if the NaT bit had been + set when the save occurred, it would have caused a NaT + consumption fault. */ + if (write) + { + if (*valp) + return -UNW_EBADREG; /* can't set NaT bit */ + } + else + *valp = 0; + return 0; + } + + mask = (unw_word_t) 1 << nat_bitnr; + return update_nat (c, nat_loc, mask, valp, write); +} + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + ia64_loc_t loc, reg_loc, nat_loc; + unw_word_t mask, val; + uint8_t nat_bitnr; + int ret; + + switch (reg) + { + /* frame registers: */ + + case UNW_IA64_BSP: + if (write) + c->bsp = *valp; + else + *valp = c->bsp; + return 0; + + case UNW_REG_SP: + if (write) + c->sp = *valp; + else + *valp = c->sp; + return 0; + + case UNW_REG_IP: + if (write) + { + c->ip = *valp; /* also update the IP cache */ + if (c->pi_valid && (*valp < c->pi.start_ip || *valp >= c->pi.end_ip)) + c->pi_valid = 0; /* new IP outside of current proc */ + } + loc = c->loc[IA64_REG_IP]; + break; + + /* preserved registers: */ + + case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7: + loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_GR + 4))]; + break; + + case UNW_IA64_NAT + 4 ... UNW_IA64_NAT + 7: + loc = c->loc[IA64_REG_NAT4 + (reg - (UNW_IA64_NAT + 4))]; + reg_loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_NAT + 4))]; + nat_bitnr = c->nat_bitnr[reg - (UNW_IA64_NAT + 4)]; + return access_nat (c, loc, reg_loc, nat_bitnr, valp, write); + + case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break; + case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break; + case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break; + case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break; + case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break; + case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break; + case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break; + case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break; + case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break; + case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break; + case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break; + case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break; + + case UNW_IA64_CFM: + if (write) + c->cfm = *valp; /* also update the CFM cache */ + loc = c->cfm_loc; + break; + + case UNW_IA64_PR: + /* + * Note: broad-side access to the predicates is NOT rotated + * (i.e., it is done as if CFM.rrb.pr == 0. + */ + if (write) + { + c->pr = *valp; /* update the predicate cache */ + return ia64_put (c, c->loc[IA64_REG_PR], *valp); + } + else + return ia64_get (c, c->loc[IA64_REG_PR], valp); + + case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */ + reg = rotate_gr (c, reg - UNW_IA64_GR); + if (reg < 0) + return -UNW_EBADREG; + ret = ia64_get_stacked (c, reg, &loc, NULL); + if (ret < 0) + return ret; + break; + + case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */ + reg = rotate_gr (c, reg - UNW_IA64_NAT); + if (reg < 0) + return -UNW_EBADREG; + ret = ia64_get_stacked (c, reg, &loc, &nat_loc); + if (ret < 0) + return ret; + assert (!IA64_IS_REG_LOC (loc)); + mask = (unw_word_t) 1 << rse_slot_num (IA64_GET_ADDR (loc)); + return update_nat (c, nat_loc, mask, valp, write); + + case UNW_IA64_AR_EC: + if ((ret = ia64_get (c, c->ec_loc, &val)) < 0) + return ret; + + if (write) + { + val = ((val & ~((unw_word_t) 0x3f << 52)) | ((*valp & 0x3f) << 52)); + return ia64_put (c, c->ec_loc, val); + } + else + { + *valp = (val >> 52) & 0x3f; + return 0; + } + + /* scratch & special registers: */ + + case UNW_IA64_GR + 0: + if (write) + return -UNW_EREADONLYREG; + *valp = 0; + return 0; + + case UNW_IA64_NAT + 0: + if (write) + return -UNW_EREADONLYREG; + *valp = 0; + return 0; + + case UNW_IA64_NAT + 1: + case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3: + case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31: + loc = ia64_scratch_loc (c, reg, &nat_bitnr); + if (IA64_IS_NULL_LOC (loc) && reg == UNW_IA64_NAT + 1) + { + /* access to GP */ + if (write) + return -UNW_EREADONLYREG; + *valp = 0; + return 0; + } + if (!(IA64_IS_REG_LOC (loc) || IA64_IS_UC_LOC (loc) + || IA64_IS_FP_LOC (loc))) + /* We're dealing with a NaT bit stored in memory. */ + return update_nat(c, loc, (unw_word_t) 1 << nat_bitnr, valp, write); + break; + + case UNW_IA64_GR + 15 ... UNW_IA64_GR + 18: + mask = 1 << (reg - (UNW_IA64_GR + 15)); + if (write) + { + c->eh_args[reg - (UNW_IA64_GR + 15)] = *valp; + c->eh_valid_mask |= mask; + return 0; + } + else if ((c->eh_valid_mask & mask) != 0) + { + *valp = c->eh_args[reg - (UNW_IA64_GR + 15)]; + return 0; + } + else + loc = ia64_scratch_loc (c, reg, NULL); + break; + + case UNW_IA64_GR + 1: /* global pointer */ + case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 14: + case UNW_IA64_GR + 19 ... UNW_IA64_GR + 31: + case UNW_IA64_BR + 0: + case UNW_IA64_BR + 6: + case UNW_IA64_BR + 7: + case UNW_IA64_AR_RSC: + case UNW_IA64_AR_CSD: + case UNW_IA64_AR_SSD: + case UNW_IA64_AR_CCV: + loc = ia64_scratch_loc (c, reg, NULL); + if (IA64_IS_NULL_LOC (loc) && reg == UNW_IA64_GR + 1) + { + /* access to GP */ + if (write) + return -UNW_EREADONLYREG; + + /* ensure c->pi is up-to-date: */ + if ((ret = ia64_make_proc_info (c)) < 0) + return ret; + *valp = c->pi.gp; + return 0; + } + break; + + default: + Debug (1, "bad register number %d\n", reg); + return -UNW_EBADREG; + } + + if (write) + return ia64_put (c, loc, *valp); + else + return ia64_get (c, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, int reg, unw_fpreg_t *valp, + int write) +{ + ia64_loc_t loc; + + switch (reg) + { + case UNW_IA64_FR + 0: + if (write) + return -UNW_EREADONLYREG; + *valp = unw.read_only.f0; + return 0; + + case UNW_IA64_FR + 1: + if (write) + return -UNW_EREADONLYREG; + + if (ia64_is_big_endian (c)) + *valp = unw.read_only.f1_be; + else + *valp = unw.read_only.f1_le; + return 0; + + case UNW_IA64_FR + 2: loc = c->loc[IA64_REG_F2]; break; + case UNW_IA64_FR + 3: loc = c->loc[IA64_REG_F3]; break; + case UNW_IA64_FR + 4: loc = c->loc[IA64_REG_F4]; break; + case UNW_IA64_FR + 5: loc = c->loc[IA64_REG_F5]; break; + + case UNW_IA64_FR + 16 ... UNW_IA64_FR + 31: + loc = c->loc[IA64_REG_F16 + (reg - (UNW_IA64_FR + 16))]; + break; + + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15: + loc = ia64_scratch_loc (c, reg, NULL); + break; + + case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127: + reg = rotate_fr (c, reg - UNW_IA64_FR) + UNW_IA64_FR; + loc = ia64_scratch_loc (c, reg, NULL); + break; + + default: + Debug (1, "bad register number %d\n", reg); + return -UNW_EBADREG; + } + + if (write) + return ia64_putfp (c, loc, *valp); + else + return ia64_getfp (c, loc, valp); +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gresume.c b/sdk/cpprt/linux/libunwind/src/ia64/Gresume.c new file mode 100644 index 0000000000..fe23f76651 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gresume.c @@ -0,0 +1,274 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" +#include "offsets.h" + +#ifndef UNW_REMOTE_ONLY + +static inline int +local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ +#if defined(__linux) + unw_word_t dirty_partition[2048]; /* AR.RSC.LOADRS is a 14-bit field */ + unw_word_t val, sol, sof, pri_unat, n, pfs, bspstore, dirty_rnat; + struct cursor *c = (struct cursor *) cursor; + struct + { + unw_word_t r1; + unw_word_t r4; + unw_word_t r5; + unw_word_t r6; + unw_word_t r7; + unw_word_t r15; + unw_word_t r16; + unw_word_t r17; + unw_word_t r18; + } + extra; + int ret, dirty_size; +# define GET_NAT(n) \ + do \ + { \ + ret = tdep_access_reg (c, UNW_IA64_NAT + (n), &val, 0); \ + if (ret < 0) \ + return ret; \ + if (val) \ + pri_unat |= (unw_word_t) 1 << n; \ + } \ + while (0) + + /* ensure c->pi is up-to-date: */ + if ((ret = ia64_make_proc_info (c)) < 0) + return ret; + + /* Copy contents of r4-r7 into "extra", so that their values end up + contiguous, so we can use a single (primary-) UNaT value. */ + if ((ret = ia64_get (c, c->loc[IA64_REG_R4], &extra.r4)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_R5], &extra.r5)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_R6], &extra.r6)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_R7], &extra.r7)) < 0) + return ret; + + /* Form the primary UNaT value: */ + pri_unat = 0; + GET_NAT (4); GET_NAT(5); + GET_NAT (6); GET_NAT(7); + n = (((uintptr_t) &extra.r4) / 8 - 4) % 64; + pri_unat = (pri_unat << n) | (pri_unat >> (64 - n)); + + if (unlikely (c->sigcontext_addr)) + { + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; +# define PR_SCRATCH 0xffc0 /* p6-p15 are scratch */ +# define PR_PRESERVED (~(PR_SCRATCH | 1)) + + /* We're returning to a frame that was (either directly or + indirectly) interrupted by a signal. We have to restore + _both_ "preserved" and "scratch" registers. That doesn't + leave us any registers to work with, and the only way we can + achieve this is by doing a sigreturn(). + + Note: it might be tempting to think that we don't have to + restore the scratch registers when returning to a frame that + was indirectly interrupted by a signal. However, that is not + safe because that frame and its descendants could have been + using a special convention that stores "preserved" state in + scratch registers. For example, the Linux fsyscall + convention does this with r11 (to save ar.pfs) and b6 (to + save "rp"). */ + + sc->sc_gr[12] = c->psp; + c->psp = c->sigcontext_addr - c->sigcontext_off; + + sof = (c->cfm & 0x7f); + if ((dirty_size = rbs_cover_and_flush (c, sof, dirty_partition, + &dirty_rnat, &bspstore)) < 0) + return dirty_size; + + /* Clear the "in-syscall" flag, because in general we won't be + returning to the interruption-point and we need all registers + restored. */ + sc->sc_flags &= ~IA64_SC_FLAG_IN_SYSCALL; + sc->sc_ip = c->ip; + sc->sc_cfm = c->cfm & (((unw_word_t) 1 << 38) - 1); + sc->sc_pr = (c->pr & ~PR_SCRATCH) | (sc->sc_pr & ~PR_PRESERVED); + if ((ret = ia64_get (c, c->loc[IA64_REG_PFS], &sc->sc_ar_pfs)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_FPSR], &sc->sc_ar_fpsr)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_UNAT], &sc->sc_ar_unat)) < 0) + return ret; + + sc->sc_gr[1] = c->pi.gp; + if (c->eh_valid_mask & 0x1) sc->sc_gr[15] = c->eh_args[0]; + if (c->eh_valid_mask & 0x2) sc->sc_gr[16] = c->eh_args[1]; + if (c->eh_valid_mask & 0x4) sc->sc_gr[17] = c->eh_args[2]; + if (c->eh_valid_mask & 0x8) sc->sc_gr[18] = c->eh_args[3]; + Debug (9, "sc: r15=%lx,r16=%lx,r17=%lx,r18=%lx\n", + (long) sc->sc_gr[15], (long) sc->sc_gr[16], + (long) sc->sc_gr[17], (long) sc->sc_gr[18]); + } + else + { + /* Account for the fact that _Uia64_install_context() will + return via br.ret, which will decrement bsp by size-of-locals. */ + if ((ret = ia64_get (c, c->loc[IA64_REG_PFS], &pfs)) < 0) + return ret; + sol = (pfs >> 7) & 0x7f; + if ((dirty_size = rbs_cover_and_flush (c, sol, dirty_partition, + &dirty_rnat, &bspstore)) < 0) + return dirty_size; + + extra.r1 = c->pi.gp; + extra.r15 = c->eh_args[0]; + extra.r16 = c->eh_args[1]; + extra.r17 = c->eh_args[2]; + extra.r18 = c->eh_args[3]; + Debug (9, "extra: r15=%lx,r16=%lx,r17=%lx,r18=%lx\n", + (long) extra.r15, (long) extra.r16, + (long) extra.r17, (long) extra.r18); + } + Debug (8, "resuming at ip=%lx\n", (long) c->ip); + ia64_install_cursor (c, pri_unat, (unw_word_t *) &extra, + bspstore, dirty_size, dirty_partition + dirty_size/8, + dirty_rnat); +#elif defined(__hpux) + struct cursor *c = (struct cursor *) cursor; + + setcontext (c->as_arg); /* should not return */ +#endif + return -UNW_EINVAL; +} + +HIDDEN int +ia64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + return local_resume (as, cursor, arg); +} + +#endif /* !UNW_REMOTE_ONLY */ + +#ifndef UNW_LOCAL_ONLY + +static inline int +remote_install_cursor (struct cursor *c) +{ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int write, void *); + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int write, void *); + unw_fpreg_t fpval; + unw_word_t val; + int reg; + +#if defined(__linux) && !defined(UNW_REMOTE_ONLY) + if (c->as == unw_local_addr_space) + { + /* Take a short-cut: we directly resume out of the cursor and + all we need to do is make sure that all locations point to + memory, not registers. Furthermore, R4-R7 and NAT4-NAT7 are + taken care of by ia64_local_resume() so they don't need to be + handled here. */ +# define MEMIFY(preg, reg) \ + do { \ + if (IA64_IS_REG_LOC (c->loc[(preg)])) \ + c->loc[(preg)] = IA64_LOC_ADDR ((unw_word_t) \ + tdep_uc_addr(c->as_arg, (reg), \ + NULL), 0); \ + } while (0) + MEMIFY (IA64_REG_PR, UNW_IA64_PR); + MEMIFY (IA64_REG_PFS, UNW_IA64_AR_PFS); + MEMIFY (IA64_REG_RNAT, UNW_IA64_AR_RNAT); + MEMIFY (IA64_REG_UNAT, UNW_IA64_AR_UNAT); + MEMIFY (IA64_REG_LC, UNW_IA64_AR_LC); + MEMIFY (IA64_REG_FPSR, UNW_IA64_AR_FPSR); + MEMIFY (IA64_REG_IP, UNW_IA64_BR + 0); + MEMIFY (IA64_REG_B1, UNW_IA64_BR + 1); + MEMIFY (IA64_REG_B2, UNW_IA64_BR + 2); + MEMIFY (IA64_REG_B3, UNW_IA64_BR + 3); + MEMIFY (IA64_REG_B4, UNW_IA64_BR + 4); + MEMIFY (IA64_REG_B5, UNW_IA64_BR + 5); + MEMIFY (IA64_REG_F2, UNW_IA64_FR + 2); + MEMIFY (IA64_REG_F3, UNW_IA64_FR + 3); + MEMIFY (IA64_REG_F4, UNW_IA64_FR + 4); + MEMIFY (IA64_REG_F5, UNW_IA64_FR + 5); + MEMIFY (IA64_REG_F16, UNW_IA64_FR + 16); + MEMIFY (IA64_REG_F17, UNW_IA64_FR + 17); + MEMIFY (IA64_REG_F18, UNW_IA64_FR + 18); + MEMIFY (IA64_REG_F19, UNW_IA64_FR + 19); + MEMIFY (IA64_REG_F20, UNW_IA64_FR + 20); + MEMIFY (IA64_REG_F21, UNW_IA64_FR + 21); + MEMIFY (IA64_REG_F22, UNW_IA64_FR + 22); + MEMIFY (IA64_REG_F23, UNW_IA64_FR + 23); + MEMIFY (IA64_REG_F24, UNW_IA64_FR + 24); + MEMIFY (IA64_REG_F25, UNW_IA64_FR + 25); + MEMIFY (IA64_REG_F26, UNW_IA64_FR + 26); + MEMIFY (IA64_REG_F27, UNW_IA64_FR + 27); + MEMIFY (IA64_REG_F28, UNW_IA64_FR + 28); + MEMIFY (IA64_REG_F29, UNW_IA64_FR + 29); + MEMIFY (IA64_REG_F30, UNW_IA64_FR + 30); + MEMIFY (IA64_REG_F31, UNW_IA64_FR + 31); + } + else +#endif /* __linux && !UNW_REMOTE_ONLY */ + { + access_reg = c->as->acc.access_reg; + access_fpreg = c->as->acc.access_fpreg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_REG_LAST; ++reg) + { + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (c->as, reg, &fpval, 1, c->as_arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (c->as, reg, &val, 1, c->as_arg); + } + } + } + return (*c->as->acc.resume) (c->as, (unw_cursor_t *) c, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + + Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->ip); + +#ifdef UNW_LOCAL_ONLY + return local_resume (c->as, cursor, c->as_arg); +#else + return remote_install_cursor (c); +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gscript.c b/sdk/cpprt/linux/libunwind/src/ia64/Gscript.c new file mode 100644 index 0000000000..b3e8ef6ebc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gscript.c @@ -0,0 +1,765 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" +#include "regs.h" +#include "unwind_i.h" + +enum ia64_script_insn_opcode + { + IA64_INSN_INC_PSP, /* psp += val */ + IA64_INSN_LOAD_PSP, /* psp = *psp_loc */ + IA64_INSN_ADD_PSP, /* s[dst] = (s.psp + val) */ + IA64_INSN_ADD_PSP_NAT, /* like above, but with NaT info */ + IA64_INSN_ADD_SP, /* s[dst] = (s.sp + val) */ + IA64_INSN_ADD_SP_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE, /* s[dst] = s[val] */ + IA64_INSN_MOVE_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE_NO_NAT, /* like above, but clear NaT info */ + IA64_INSN_MOVE_STACKED, /* s[dst] = rse_skip(*s.bsp_loc, val) */ + IA64_INSN_MOVE_STACKED_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE_SCRATCH, /* s[dst] = scratch reg "val" */ + IA64_INSN_MOVE_SCRATCH_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE_SCRATCH_NO_NAT /* like above, but clear NaT info */ + }; + +#ifdef HAVE___THREAD +static __thread struct ia64_script_cache ia64_per_thread_cache = + { +#ifdef HAVE_ATOMIC_OPS_H + .busy = AO_TS_INITIALIZER +#else + .lock = PTHREAD_MUTEX_INITIALIZER +#endif + }; +#endif + +static inline unw_hash_index_t +hash (unw_word_t ip) +{ + /* based on (sqrt(5)/2-1)*2^64 */ +# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL) + + return (ip >> 4) * magic >> (64 - IA64_LOG_UNW_HASH_SIZE); +} + +static inline long +cache_match (struct ia64_script *script, unw_word_t ip, unw_word_t pr) +{ + if (ip == script->ip && ((pr ^ script->pr_val) & script->pr_mask) == 0) + return 1; + return 0; +} + +static inline void +flush_script_cache (struct ia64_script_cache *cache) +{ + int i; + + cache->lru_head = IA64_UNW_CACHE_SIZE - 1; + cache->lru_tail = 0; + + for (i = 0; i < IA64_UNW_CACHE_SIZE; ++i) + { + if (i > 0) + cache->buckets[i].lru_chain = (i - 1); + cache->buckets[i].coll_chain = -1; + cache->buckets[i].ip = 0; + } + for (i = 0; ihash[i] = -1; +} + +static inline struct ia64_script_cache * +get_script_cache (unw_addr_space_t as, intrmask_t *saved_maskp) +{ + struct ia64_script_cache *cache = &as->global_cache; + unw_caching_policy_t caching = as->caching_policy; + + if (caching == UNW_CACHE_NONE) + return NULL; + +#ifdef HAVE_ATOMIC_H + if (!spin_trylock_irqsave (&cache->busy, *saved_maskp)) + return NULL; +#else +# ifdef HAVE___THREAD + if (as->caching_policy == UNW_CACHE_PER_THREAD) + cache = &ia64_per_thread_cache; +# endif +# ifdef HAVE_ATOMIC_OPS_H + if (AO_test_and_set (&cache->busy) == AO_TS_SET) + return NULL; +# else + if (likely (caching == UNW_CACHE_GLOBAL)) + { + Debug (16, "%s: acquiring lock\n", __FUNCTION__); + lock_acquire (&cache->lock, *saved_maskp); + } +# endif +#endif + + if (atomic_read (&as->cache_generation) != atomic_read (&cache->generation)) + { + flush_script_cache (cache); + cache->generation = as->cache_generation; + } + return cache; +} + +static inline void +put_script_cache (unw_addr_space_t as, struct ia64_script_cache *cache, + intrmask_t *saved_maskp) +{ + assert (as->caching_policy != UNW_CACHE_NONE); + + Debug (16, "unmasking signals/interrupts and releasing lock\n"); +#ifdef HAVE_ATOMIC_H + spin_unlock_irqrestore (&cache->busy, *saved_maskp); +#else +# ifdef HAVE_ATOMIC_OPS_H + AO_CLEAR (&cache->busy); +# else + if (likely (as->caching_policy == UNW_CACHE_GLOBAL)) + lock_release (&cache->lock, *saved_maskp); +# endif +#endif +} + +static struct ia64_script * +script_lookup (struct ia64_script_cache *cache, struct cursor *c) +{ + struct ia64_script *script = cache->buckets + c->hint; + unsigned short index; + unw_word_t ip, pr; + + ip = c->ip; + pr = c->pr; + + if (cache_match (script, ip, pr)) + return script; + + index = cache->hash[hash (ip)]; + if (index >= IA64_UNW_CACHE_SIZE) + return 0; + + script = cache->buckets + index; + while (1) + { + if (cache_match (script, ip, pr)) + { + /* update hint; no locking needed: single-word writes are atomic */ + c->hint = cache->buckets[c->prev_script].hint = + (script - cache->buckets); + return script; + } + if (script->coll_chain >= IA64_UNW_HASH_SIZE) + return 0; + script = cache->buckets + script->coll_chain; + } +} + +static inline void +script_init (struct ia64_script *script, unw_word_t ip) +{ + script->ip = ip; + script->hint = 0; + script->count = 0; + script->abi_marker = 0; +} + +static inline struct ia64_script * +script_new (struct ia64_script_cache *cache, unw_word_t ip) +{ + struct ia64_script *script, *prev, *tmp; + unw_hash_index_t index; + unsigned short head; + + head = cache->lru_head; + script = cache->buckets + head; + cache->lru_head = script->lru_chain; + + /* re-insert script at the tail of the LRU chain: */ + cache->buckets[cache->lru_tail].lru_chain = head; + cache->lru_tail = head; + + /* remove the old script from the hash table (if it's there): */ + if (script->ip) + { + index = hash (script->ip); + tmp = cache->buckets + cache->hash[index]; + prev = 0; + while (1) + { + if (tmp == script) + { + if (prev) + prev->coll_chain = tmp->coll_chain; + else + cache->hash[index] = tmp->coll_chain; + break; + } + else + prev = tmp; + if (tmp->coll_chain >= IA64_UNW_CACHE_SIZE) + /* old script wasn't in the hash-table */ + break; + tmp = cache->buckets + tmp->coll_chain; + } + } + + /* enter new script in the hash table */ + index = hash (ip); + script->coll_chain = cache->hash[index]; + cache->hash[index] = script - cache->buckets; + + script_init (script, ip); + return script; +} + +static inline void +script_finalize (struct ia64_script *script, struct cursor *c, + struct ia64_state_record *sr) +{ + script->pr_mask = sr->pr_mask; + script->pr_val = sr->pr_val; + script->pi = c->pi; +} + +static inline void +script_emit (struct ia64_script *script, struct ia64_script_insn insn) +{ + if (script->count >= IA64_MAX_SCRIPT_LEN) + { + Dprintf ("%s: script exceeds maximum size of %u instructions!\n", + __FUNCTION__, IA64_MAX_SCRIPT_LEN); + return; + } + script->insn[script->count++] = insn; +} + +static void +compile_reg (struct ia64_state_record *sr, int i, struct ia64_reg_info *r, + struct ia64_script *script) +{ + enum ia64_script_insn_opcode opc; + unsigned long val, rval; + struct ia64_script_insn insn; + long is_preserved_gr; + + if (r->where == IA64_WHERE_NONE || r->when >= sr->when_target) + return; + + opc = IA64_INSN_MOVE; + val = rval = r->val; + is_preserved_gr = (i >= IA64_REG_R4 && i <= IA64_REG_R7); + + if (r->where == IA64_WHERE_GR) + { + /* Handle most common case first... */ + if (rval >= 32) + { + /* register got spilled to a stacked register */ + if (is_preserved_gr) + opc = IA64_INSN_MOVE_STACKED_NAT; + else + opc = IA64_INSN_MOVE_STACKED; + val = rval; + } + else if (rval >= 4 && rval <= 7) + { + /* register got spilled to a preserved register */ + val = IA64_REG_R4 + (rval - 4); + if (is_preserved_gr) + opc = IA64_INSN_MOVE_NAT; + } + else + { + /* register got spilled to a scratch register */ + if (is_preserved_gr) + opc = IA64_INSN_MOVE_SCRATCH_NAT; + else + opc = IA64_INSN_MOVE_SCRATCH; + val = UNW_IA64_GR + rval; + } + } + else + { + switch (r->where) + { + case IA64_WHERE_FR: + /* Note: There is no need to handle NaT-bit info here + (indepent of is_preserved_gr), because for floating-point + NaTs are represented as NaTVal, so the NaT-info never + needs to be consulated. */ + if (rval >= 2 && rval <= 5) + val = IA64_REG_F2 + (rval - 2); + else if (rval >= 16 && rval <= 31) + val = IA64_REG_F16 + (rval - 16); + else + { + opc = IA64_INSN_MOVE_SCRATCH; + val = UNW_IA64_FR + rval; + } + break; + + case IA64_WHERE_BR: + if (rval >= 1 && rval <= 5) + { + val = IA64_REG_B1 + (rval - 1); + if (is_preserved_gr) + opc = IA64_INSN_MOVE_NO_NAT; + } + else + { + opc = IA64_INSN_MOVE_SCRATCH; + if (is_preserved_gr) + opc = IA64_INSN_MOVE_SCRATCH_NO_NAT; + val = UNW_IA64_BR + rval; + } + break; + + case IA64_WHERE_SPREL: + if (is_preserved_gr) + opc = IA64_INSN_ADD_SP_NAT; + else + { + opc = IA64_INSN_ADD_SP; + if (i >= IA64_REG_F2 && i <= IA64_REG_F31) + val |= IA64_LOC_TYPE_FP; + } + break; + + case IA64_WHERE_PSPREL: + if (is_preserved_gr) + opc = IA64_INSN_ADD_PSP_NAT; + else + { + opc = IA64_INSN_ADD_PSP; + if (i >= IA64_REG_F2 && i <= IA64_REG_F31) + val |= IA64_LOC_TYPE_FP; + } + break; + + default: + Dprintf ("%s: register %u has unexpected `where' value of %u\n", + __FUNCTION__, i, r->where); + break; + } + } + insn.opc = opc; + insn.dst = i; + insn.val = val; + script_emit (script, insn); + + if (i == IA64_REG_PSP) + { + /* c->psp must contain the _value_ of the previous sp, not it's + save-location. We get this by dereferencing the value we + just stored in loc[IA64_REG_PSP]: */ + insn.opc = IA64_INSN_LOAD_PSP; + script_emit (script, insn); + } +} + +/* Sort the registers which got saved in decreasing order of WHEN + value. This is needed to ensure that the save-locations are + updated in the proper order. For example, suppose r4 gets spilled + to memory and then r5 gets saved in r4. In this case, we need to + update the save location of r5 before the one of r4. */ + +static inline int +sort_regs (struct ia64_state_record *sr, int regorder[]) +{ + int r, i, j, max, max_reg, max_when, num_regs = 0; + + assert (IA64_REG_BSP == 3); + + for (r = IA64_REG_BSP; r < IA64_NUM_PREGS; ++r) + { + if (sr->curr.reg[r].where == IA64_WHERE_NONE + || sr->curr.reg[r].when >= sr->when_target) + continue; + + regorder[num_regs++] = r; + } + + /* Simple insertion-sort. Involves about N^2/2 comparisons and N + exchanges. N is often small (say, 2-5) so a fancier sorting + algorithm may not be worthwhile. */ + + for (i = max = 0; i < num_regs - 1; ++i) + { + max_reg = regorder[max]; + max_when = sr->curr.reg[max_reg].when; + + for (j = i + 1; j < num_regs; ++j) + if (sr->curr.reg[regorder[j]].when > max_when) + { + max = j; + max_reg = regorder[j]; + max_when = sr->curr.reg[max_reg].when; + } + if (i != max) + { + regorder[max] = regorder[i]; + regorder[i] = max_reg; + } + } + return num_regs; +} + +/* Build an unwind script that unwinds from state OLD_STATE to the + entrypoint of the function that called OLD_STATE. */ + +static inline int +build_script (struct cursor *c, struct ia64_script *script) +{ + int num_regs, i, ret, regorder[IA64_NUM_PREGS - 3]; + struct ia64_reg_info *pri_unat; + struct ia64_state_record sr; + struct ia64_script_insn insn; + + ret = ia64_create_state_record (c, &sr); + if (ret < 0) + return ret; + + /* First, compile the update for IA64_REG_PSP. This is important + because later save-locations may depend on it's correct (updated) + value. Fixed-size frames are handled specially and variable-size + frames get handled via the normal compile_reg(). */ + + if (sr.when_target > sr.curr.reg[IA64_REG_PSP].when + && (sr.curr.reg[IA64_REG_PSP].where == IA64_WHERE_NONE) + && sr.curr.reg[IA64_REG_PSP].val != 0) + { + /* new psp is psp plus frame size */ + insn.opc = IA64_INSN_INC_PSP; + insn.val = sr.curr.reg[IA64_REG_PSP].val; /* frame size */ + script_emit (script, insn); + } + else + compile_reg (&sr, IA64_REG_PSP, sr.curr.reg + IA64_REG_PSP, script); + + /* Second, compile the update for the primary UNaT, if any: */ + + if (sr.when_target >= sr.curr.reg[IA64_REG_PRI_UNAT_GR].when + || sr.when_target >= sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when) + { + if (sr.when_target < sr.curr.reg[IA64_REG_PRI_UNAT_GR].when) + /* (primary) NaT bits were saved to memory only */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM; + else if (sr.when_target < sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when) + /* (primary) NaT bits were saved to a register only */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR; + else if (sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when > + sr.curr.reg[IA64_REG_PRI_UNAT_GR].when) + /* (primary) NaT bits were last saved to memory */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM; + else + /* (primary) NaT bits were last saved to a register */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR; + + /* Note: we always store the final primary-UNaT location in UNAT_MEM. */ + compile_reg (&sr, IA64_REG_PRI_UNAT_MEM, pri_unat, script); + } + + /* Third, compile the other register in decreasing order of WHEN values. */ + + num_regs = sort_regs (&sr, regorder); + for (i = 0; i < num_regs; ++i) + compile_reg (&sr, regorder[i], sr.curr.reg + regorder[i], script); + + script->abi_marker = sr.abi_marker; + script_finalize (script, c, &sr); + + ia64_free_state_record (&sr); + return 0; +} + +static inline void +set_nat_info (struct cursor *c, unsigned long dst, + ia64_loc_t nat_loc, uint8_t bitnr) +{ + assert (dst >= IA64_REG_R4 && dst <= IA64_REG_R7); + + c->loc[dst - IA64_REG_R4 + IA64_REG_NAT4] = nat_loc; + c->nat_bitnr[dst - IA64_REG_R4] = bitnr; +} + +/* Apply the unwinding actions represented by OPS and update SR to + reflect the state that existed upon entry to the function that this + unwinder represents. */ + +static inline int +run_script (struct ia64_script *script, struct cursor *c) +{ + struct ia64_script_insn *ip, *limit, next_insn; + ia64_loc_t loc, nat_loc; + unsigned long opc, dst; + uint8_t nat_bitnr; + unw_word_t val; + int ret; + + c->pi = script->pi; + ip = script->insn; + limit = script->insn + script->count; + next_insn = *ip; + c->abi_marker = script->abi_marker; + + while (ip++ < limit) + { + opc = next_insn.opc; + dst = next_insn.dst; + val = next_insn.val; + next_insn = *ip; + + /* This is by far the most common operation: */ + if (likely (opc == IA64_INSN_MOVE_STACKED)) + { + if ((ret = ia64_get_stacked (c, val, &loc, NULL)) < 0) + return ret; + } + else + switch (opc) + { + case IA64_INSN_INC_PSP: + c->psp += val; + continue; + + case IA64_INSN_LOAD_PSP: + if ((ret = ia64_get (c, c->loc[IA64_REG_PSP], &c->psp)) < 0) + return ret; + continue; + + case IA64_INSN_ADD_PSP: + loc = IA64_LOC_ADDR (c->psp + val, (val & IA64_LOC_TYPE_FP)); + break; + + case IA64_INSN_ADD_SP: + loc = IA64_LOC_ADDR (c->sp + val, (val & IA64_LOC_TYPE_FP)); + break; + + case IA64_INSN_MOVE_NO_NAT: + set_nat_info (c, dst, IA64_NULL_LOC, 0); + case IA64_INSN_MOVE: + loc = c->loc[val]; + break; + + case IA64_INSN_MOVE_SCRATCH_NO_NAT: + set_nat_info (c, dst, IA64_NULL_LOC, 0); + case IA64_INSN_MOVE_SCRATCH: + loc = ia64_scratch_loc (c, val, NULL); + break; + + case IA64_INSN_ADD_PSP_NAT: + loc = IA64_LOC_ADDR (c->psp + val, 0); + assert (!IA64_IS_REG_LOC (loc)); + set_nat_info (c, dst, + c->loc[IA64_REG_PRI_UNAT_MEM], + ia64_unat_slot_num (IA64_GET_ADDR (loc))); + break; + + case IA64_INSN_ADD_SP_NAT: + loc = IA64_LOC_ADDR (c->sp + val, 0); + assert (!IA64_IS_REG_LOC (loc)); + set_nat_info (c, dst, + c->loc[IA64_REG_PRI_UNAT_MEM], + ia64_unat_slot_num (IA64_GET_ADDR (loc))); + break; + + case IA64_INSN_MOVE_NAT: + loc = c->loc[val]; + set_nat_info (c, dst, + c->loc[val - IA64_REG_R4 + IA64_REG_NAT4], + c->nat_bitnr[val - IA64_REG_R4]); + break; + + case IA64_INSN_MOVE_STACKED_NAT: + if ((ret = ia64_get_stacked (c, val, &loc, &nat_loc)) < 0) + return ret; + assert (!IA64_IS_REG_LOC (loc)); + set_nat_info (c, dst, nat_loc, rse_slot_num (IA64_GET_ADDR (loc))); + break; + + case IA64_INSN_MOVE_SCRATCH_NAT: + loc = ia64_scratch_loc (c, val, NULL); + nat_loc = ia64_scratch_loc (c, val + (UNW_IA64_NAT - UNW_IA64_GR), + &nat_bitnr); + set_nat_info (c, dst, nat_loc, nat_bitnr); + break; + } + c->loc[dst] = loc; + } + return 0; +} + +static int +uncached_find_save_locs (struct cursor *c) +{ + struct ia64_script script; + int ret = 0; + + if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0) + return ret; + + script_init (&script, c->ip); + if ((ret = build_script (c, &script)) < 0) + { + if (ret != -UNW_ESTOPUNWIND) + Dprintf ("%s: failed to build unwind script for ip %lx\n", + __FUNCTION__, (long) c->ip); + return ret; + } + return run_script (&script, c); +} + +HIDDEN int +ia64_find_save_locs (struct cursor *c) +{ + struct ia64_script_cache *cache = NULL; + struct ia64_script *script = NULL; + intrmask_t saved_mask; + int ret = 0; + + if (c->as->caching_policy == UNW_CACHE_NONE) + return uncached_find_save_locs (c); + + cache = get_script_cache (c->as, &saved_mask); + if (!cache) + { + Debug (1, "contention on script-cache; doing uncached lookup\n"); + return uncached_find_save_locs (c); + } + { + script = script_lookup (cache, c); + Debug (8, "ip %lx %s in script cache\n", (long) c->ip, + script ? "hit" : "missed"); + + if (!script || (script->count == 0 && !script->pi.unwind_info)) + { + if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0) + goto out; + } + + if (!script) + { + script = script_new (cache, c->ip); + if (!script) + { + Dprintf ("%s: failed to create unwind script\n", __FUNCTION__); + ret = -UNW_EUNSPEC; + goto out; + } + } + cache->buckets[c->prev_script].hint = script - cache->buckets; + + if (script->count == 0) + ret = build_script (c, script); + + assert (script->count > 0); + + c->hint = script->hint; + c->prev_script = script - cache->buckets; + + if (ret < 0) + { + if (ret != -UNW_ESTOPUNWIND) + Dprintf ("%s: failed to locate/build unwind script for ip %lx\n", + __FUNCTION__, (long) c->ip); + goto out; + } + + ret = run_script (script, c); + } + out: + put_script_cache (c->as, cache, &saved_mask); + return ret; +} + +HIDDEN void +ia64_validate_cache (unw_addr_space_t as, void *arg) +{ +#ifndef UNW_REMOTE_ONLY + if (as == unw_local_addr_space && ia64_local_validate_cache (as, arg) == 1) + return; +#endif + +#ifndef UNW_LOCAL_ONLY + /* local info is up-to-date, check dynamic info. */ + unwi_dyn_validate_cache (as, arg); +#endif +} + +HIDDEN int +ia64_cache_proc_info (struct cursor *c) +{ + struct ia64_script_cache *cache; + struct ia64_script *script; + intrmask_t saved_mask; + int ret = 0; + + cache = get_script_cache (c->as, &saved_mask); + if (!cache) + return ret; /* cache is busy */ + + /* Re-check to see if a cache entry has been added in the meantime: */ + script = script_lookup (cache, c); + if (script) + goto out; + + script = script_new (cache, c->ip); + if (!script) + { + Dprintf ("%s: failed to create unwind script\n", __FUNCTION__); + ret = -UNW_EUNSPEC; + goto out; + } + + script->pi = c->pi; + + out: + put_script_cache (c->as, cache, &saved_mask); + return ret; +} + +HIDDEN int +ia64_get_cached_proc_info (struct cursor *c) +{ + struct ia64_script_cache *cache; + struct ia64_script *script; + intrmask_t saved_mask; + + cache = get_script_cache (c->as, &saved_mask); + if (!cache) + return -UNW_ENOINFO; /* cache is busy */ + { + script = script_lookup (cache, c); + if (script) + c->pi = script->pi; + } + put_script_cache (c->as, cache, &saved_mask); + return script ? 0 : -UNW_ENOINFO; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gstep.c b/sdk/cpprt/linux/libunwind/src/ia64/Gstep.c new file mode 100644 index 0000000000..e63291078e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gstep.c @@ -0,0 +1,359 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" +#include "unwind_i.h" + +static inline int +linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, + unw_word_t *num_regsp) +{ +#if defined(UNW_LOCAL_ONLY) && !defined(__linux) + return -UNW_EINVAL; +#else + unw_word_t sc_addr; + int ret; + + if ((ret = ia64_get (c, IA64_LOC_ADDR (c->sp + 0x10 + + LINUX_SIGFRAME_ARG2_OFF, 0), + &sc_addr)) < 0) + return ret; + + c->sigcontext_addr = sc_addr; + + if (!IA64_IS_REG_LOC (c->loc[IA64_REG_IP]) + && IA64_GET_ADDR (c->loc[IA64_REG_IP]) == sc_addr + LINUX_SC_BR_OFF + 8) + { + /* Linux kernels before 2.4.19 and 2.5.10 had buggy + unwind info for sigtramp. Fix it up here. */ + c->loc[IA64_REG_IP] = IA64_LOC_ADDR (sc_addr + LINUX_SC_IP_OFF, 0); + c->cfm_loc = IA64_LOC_ADDR (sc_addr + LINUX_SC_CFM_OFF, 0); + } + + /* do what can't be described by unwind directives: */ + c->loc[IA64_REG_PFS] = IA64_LOC_ADDR (sc_addr + LINUX_SC_AR_PFS_OFF, 0); + c->ec_loc = prev_cfm_loc; + *num_regsp = c->cfm & 0x7f; /* size of frame */ + return 0; +#endif +} + +static inline int +linux_interrupt (struct cursor *c, ia64_loc_t prev_cfm_loc, + unw_word_t *num_regsp, int marker) +{ +#if defined(UNW_LOCAL_ONLY) && !(defined(__linux) && defined(__KERNEL__)) + return -UNW_EINVAL; +#else + unw_word_t sc_addr, num_regs; + ia64_loc_t pfs_loc; + + sc_addr = c->sigcontext_addr = c->sp + 0x10; + + if ((c->pr & (1UL << LINUX_PT_P_NONSYS)) != 0) + num_regs = c->cfm & 0x7f; + else + num_regs = 0; + + /* do what can't be described by unwind directives: */ + if (marker == ABI_MARKER_OLD_LINUX_INTERRUPT) + pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_OLD_PT_PFS_OFF, 0); + else + pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_PT_PFS_OFF, 0); + c->loc[IA64_REG_PFS] = pfs_loc; + c->ec_loc = prev_cfm_loc; + *num_regsp = num_regs; /* size of frame */ + return 0; +#endif +} + +static inline int +hpux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, + unw_word_t *num_regsp) +{ +#if defined(UNW_LOCAL_ONLY) && !defined(__hpux) + return -UNW_EINVAL; +#else + unw_word_t sc_addr, bsp, bspstore; + ia64_loc_t sc_loc; + int ret, i; + + /* HP-UX passes the address of ucontext_t in r32: */ + if ((ret = ia64_get_stacked (c, 32, &sc_loc, NULL)) < 0) + return ret; + if ((ret = ia64_get (c, sc_loc, &sc_addr)) < 0) + return ret; + + c->sigcontext_addr = sc_addr; + + /* Now mark all (preserved) registers as coming from the + signal context: */ + c->cfm_loc = IA64_LOC_UC_REG (UNW_IA64_CFM, sc_addr); + c->loc[IA64_REG_PRI_UNAT_MEM] = IA64_NULL_LOC; + c->loc[IA64_REG_PSP] = IA64_LOC_UC_REG (UNW_IA64_GR + 12, sc_addr); + c->loc[IA64_REG_BSP] = IA64_LOC_UC_REG (UNW_IA64_AR_BSP, sc_addr); + c->loc[IA64_REG_BSPSTORE] = IA64_LOC_UC_REG (UNW_IA64_AR_BSPSTORE, sc_addr); + c->loc[IA64_REG_PFS] = IA64_LOC_UC_REG (UNW_IA64_AR_PFS, sc_addr); + c->loc[IA64_REG_RNAT] = IA64_LOC_UC_REG (UNW_IA64_AR_RNAT, sc_addr); + c->loc[IA64_REG_IP] = IA64_LOC_UC_REG (UNW_IA64_IP, sc_addr); + c->loc[IA64_REG_R4] = IA64_LOC_UC_REG (UNW_IA64_GR + 4, sc_addr); + c->loc[IA64_REG_R5] = IA64_LOC_UC_REG (UNW_IA64_GR + 5, sc_addr); + c->loc[IA64_REG_R6] = IA64_LOC_UC_REG (UNW_IA64_GR + 6, sc_addr); + c->loc[IA64_REG_R7] = IA64_LOC_UC_REG (UNW_IA64_GR + 7, sc_addr); + c->loc[IA64_REG_NAT4] = IA64_LOC_UC_REG (UNW_IA64_NAT + 4, sc_addr); + c->loc[IA64_REG_NAT5] = IA64_LOC_UC_REG (UNW_IA64_NAT + 5, sc_addr); + c->loc[IA64_REG_NAT6] = IA64_LOC_UC_REG (UNW_IA64_NAT + 6, sc_addr); + c->loc[IA64_REG_NAT7] = IA64_LOC_UC_REG (UNW_IA64_NAT + 7, sc_addr); + c->loc[IA64_REG_UNAT] = IA64_LOC_UC_REG (UNW_IA64_AR_UNAT, sc_addr); + c->loc[IA64_REG_PR] = IA64_LOC_UC_REG (UNW_IA64_PR, sc_addr); + c->loc[IA64_REG_LC] = IA64_LOC_UC_REG (UNW_IA64_AR_LC, sc_addr); + c->loc[IA64_REG_FPSR] = IA64_LOC_UC_REG (UNW_IA64_AR_FPSR, sc_addr); + c->loc[IA64_REG_B1] = IA64_LOC_UC_REG (UNW_IA64_BR + 1, sc_addr); + c->loc[IA64_REG_B2] = IA64_LOC_UC_REG (UNW_IA64_BR + 2, sc_addr); + c->loc[IA64_REG_B3] = IA64_LOC_UC_REG (UNW_IA64_BR + 3, sc_addr); + c->loc[IA64_REG_B4] = IA64_LOC_UC_REG (UNW_IA64_BR + 4, sc_addr); + c->loc[IA64_REG_B5] = IA64_LOC_UC_REG (UNW_IA64_BR + 5, sc_addr); + c->loc[IA64_REG_F2] = IA64_LOC_UC_REG (UNW_IA64_FR + 2, sc_addr); + c->loc[IA64_REG_F3] = IA64_LOC_UC_REG (UNW_IA64_FR + 3, sc_addr); + c->loc[IA64_REG_F4] = IA64_LOC_UC_REG (UNW_IA64_FR + 4, sc_addr); + c->loc[IA64_REG_F5] = IA64_LOC_UC_REG (UNW_IA64_FR + 5, sc_addr); + for (i = 0; i < 16; ++i) + c->loc[IA64_REG_F16 + i] = IA64_LOC_UC_REG (UNW_IA64_FR + 16 + i, sc_addr); + + c->pi.flags |= UNW_PI_FLAG_IA64_RBS_SWITCH; + + /* update the CFM cache: */ + if ((ret = ia64_get (c, c->cfm_loc, &c->cfm)) < 0) + return ret; + /* update the PSP cache: */ + if ((ret = ia64_get (c, c->loc[IA64_REG_PSP], &c->psp)) < 0) + return ret; + + if ((ret = ia64_get (c, c->loc[IA64_REG_BSP], &bsp)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &bspstore)) < 0) + return ret; + if (bspstore < bsp) + /* Dirty partition got spilled into the ucontext_t structure + itself. We'll need to access it via uc_access(3). */ + rbs_switch (c, bsp, bspstore, IA64_LOC_UC_ADDR (bsp | 0x1f8, 0)); + + c->ec_loc = prev_cfm_loc; + + *num_regsp = 0; + return 0; +#endif +} + + +static inline int +check_rbs_switch (struct cursor *c) +{ + unw_word_t saved_bsp, saved_bspstore, loadrs, ndirty; + int ret = 0; + + saved_bsp = c->bsp; + if (c->pi.flags & UNW_PI_FLAG_IA64_RBS_SWITCH) + { + /* Got ourselves a frame that has saved ar.bspstore, ar.bsp, + and ar.rnat, so we're all set for rbs-switching: */ + if ((ret = ia64_get (c, c->loc[IA64_REG_BSP], &saved_bsp)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &saved_bspstore))) + return ret; + } + else if ((c->abi_marker == ABI_MARKER_LINUX_SIGTRAMP + || c->abi_marker == ABI_MARKER_OLD_LINUX_SIGTRAMP) + && !IA64_IS_REG_LOC (c->loc[IA64_REG_BSP]) + && (IA64_GET_ADDR (c->loc[IA64_REG_BSP]) + == c->sigcontext_addr + LINUX_SC_AR_BSP_OFF)) + { + /* When Linux delivers a signal on an alternate stack, it + does things a bit differently from what the unwind + conventions allow us to describe: instead of saving + ar.rnat, ar.bsp, and ar.bspstore, it saves the former two + plus the "loadrs" value. Because of this, we need to + detect & record a potential rbs-area switch + manually... */ + + /* If ar.bsp has been saved already AND the current bsp is + not equal to the saved value, then we know for sure that + we're past the point where the backing store has been + switched (and before the point where it's restored). */ + if ((ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr + + LINUX_SC_AR_BSP_OFF, 0), + &saved_bsp) < 0) + || (ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr + + LINUX_SC_LOADRS_OFF, 0), + &loadrs) < 0)) + return ret; + loadrs >>= 16; + ndirty = rse_num_regs (c->bsp - loadrs, c->bsp); + saved_bspstore = rse_skip_regs (saved_bsp, -ndirty); + } + + if (saved_bsp == c->bsp) + return 0; + + return rbs_switch (c, saved_bsp, saved_bspstore, c->loc[IA64_REG_RNAT]); +} + +static inline int +update_frame_state (struct cursor *c) +{ + unw_word_t prev_ip, prev_sp, prev_bsp, ip, num_regs; + ia64_loc_t prev_cfm_loc; + int ret; + + prev_cfm_loc = c->cfm_loc; + prev_ip = c->ip; + prev_sp = c->sp; + prev_bsp = c->bsp; + + /* Update the IP cache (do this first: if we reach the end of the + frame-chain, the rest of the info may not be valid/useful + anymore. */ + ret = ia64_get (c, c->loc[IA64_REG_IP], &ip); + if (ret < 0) + return ret; + c->ip = ip; + + if ((ip & 0xc) != 0) + { + /* don't let obviously bad addresses pollute the cache */ + Debug (1, "rejecting bad ip=0x%lx\n", (long) c->ip); + return -UNW_EINVALIDIP; + } + + c->cfm_loc = c->loc[IA64_REG_PFS]; + /* update the CFM cache: */ + ret = ia64_get (c, c->cfm_loc, &c->cfm); + if (ret < 0) + return ret; + + /* Normally, AR.EC is stored in the CFM save-location. That + save-location contains the full function-state as defined by + AR.PFS. However, interruptions only save the frame-marker, not + any other info in CFM. Instead, AR.EC gets saved on the first + call by the interruption-handler. Thus, interruption-related + frames need to track the _previous_ CFM save-location since + that's were AR.EC is saved. We support this by setting ec_loc to + cfm_loc by default and giving frames marked with an ABI-marker + the chance to override this value with prev_cfm_loc. */ + c->ec_loc = c->cfm_loc; + + num_regs = 0; + if (unlikely (c->abi_marker)) + { + c->last_abi_marker = c->abi_marker; + switch (ia64_get_abi_marker (c)) + { + case ABI_MARKER_LINUX_SIGTRAMP: + case ABI_MARKER_OLD_LINUX_SIGTRAMP: + ia64_set_abi (c, ABI_LINUX); + if ((ret = linux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0) + return ret; + break; + + case ABI_MARKER_OLD_LINUX_INTERRUPT: + case ABI_MARKER_LINUX_INTERRUPT: + ia64_set_abi (c, ABI_LINUX); + if ((ret = linux_interrupt (c, prev_cfm_loc, &num_regs, + c->abi_marker)) < 0) + return ret; + break; + + case ABI_MARKER_HP_UX_SIGTRAMP: + ia64_set_abi (c, ABI_HPUX); + if ((ret = hpux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0) + return ret; + break; + + default: + Debug (1, "unknown ABI marker: ABI=%u, context=%u\n", + c->abi_marker >> 8, c->abi_marker & 0xff); + return -UNW_EINVAL; + } + Debug (12, "sigcontext_addr=%lx (ret=%d)\n", + (unsigned long) c->sigcontext_addr, ret); + + c->sigcontext_off = c->sigcontext_addr - c->sp; + + /* update the IP cache: */ + if ((ret = ia64_get (c, c->loc[IA64_REG_IP], &ip)) < 0) + return ret; + c->ip = ip; + if (ip == 0) + /* end of frame-chain reached */ + return 0; + } + else + num_regs = (c->cfm >> 7) & 0x7f; /* size of locals */ + + if (!IA64_IS_NULL_LOC (c->loc[IA64_REG_BSP])) + { + ret = check_rbs_switch (c); + if (ret < 0) + return ret; + } + + c->bsp = rse_skip_regs (c->bsp, -num_regs); + + c->sp = c->psp; + c->abi_marker = 0; + + if (c->ip == prev_ip && c->sp == prev_sp && c->bsp == prev_bsp) + { + Dprintf ("%s: ip, sp, and bsp unchanged; stopping here (ip=0x%lx)\n", + __FUNCTION__, (long) ip); + return -UNW_EBADFRAME; + } + + /* as we unwind, the saved ar.unat becomes the primary unat: */ + c->loc[IA64_REG_PRI_UNAT_MEM] = c->loc[IA64_REG_UNAT]; + + /* restore the predicates: */ + ret = ia64_get (c, c->loc[IA64_REG_PR], &c->pr); + if (ret < 0) + return ret; + + c->pi_valid = 0; + return 0; +} + + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->ip); + + if ((ret = ia64_find_save_locs (c)) >= 0 + && (ret = update_frame_state (c)) >= 0) + ret = (c->ip == 0) ? 0 : 1; + + Debug (2, "returning %d (ip=0x%016lx)\n", ret, (unsigned long) c->ip); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Gtables.c b/sdk/cpprt/linux/libunwind/src/ia64/Gtables.c new file mode 100644 index 0000000000..5ed72f0a9f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Gtables.c @@ -0,0 +1,729 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2001-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include + +#include "unwind_i.h" + +#ifdef HAVE_IA64INTRIN_H +# include +#endif + +extern unw_addr_space_t _ULia64_local_addr_space; + +struct ia64_table_entry + { + uint64_t start_offset; + uint64_t end_offset; + uint64_t info_offset; + }; + +#ifdef UNW_LOCAL_ONLY + +static inline int +is_local_addr_space (unw_addr_space_t as) +{ + return 1; +} + +static inline int +read_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *valp, void *arg) +{ + *valp = *(unw_word_t *) addr; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ + +static inline int +is_local_addr_space (unw_addr_space_t as) +{ + return as == unw_local_addr_space; +} + +static inline int +read_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *valp, void *arg) +{ + unw_accessors_t *a = unw_get_accessors (as); + + return (*a->access_mem) (as, addr, valp, 0, arg); +} + +/* Helper macro for reading an ia64_table_entry from remote memory. */ +#define remote_read(addr, member) \ + (*a->access_mem) (as, (addr) + offsetof (struct ia64_table_entry, \ + member), &member, 0, arg) + +/* Lookup an unwind-table entry in remote memory. Returns 1 if an + entry is found, 0 if no entry is found, negative if an error + occurred reading remote memory. */ +static int +remote_lookup (unw_addr_space_t as, + unw_word_t table, size_t table_size, unw_word_t rel_ip, + struct ia64_table_entry *e, void *arg) +{ + unw_word_t e_addr = 0, start_offset, end_offset, info_offset; + unw_accessors_t *a = unw_get_accessors (as); + unsigned long lo, hi, mid; + int ret; + + /* do a binary search for right entry: */ + for (lo = 0, hi = table_size / sizeof (struct ia64_table_entry); lo < hi;) + { + mid = (lo + hi) / 2; + e_addr = table + mid * sizeof (struct ia64_table_entry); + if ((ret = remote_read (e_addr, start_offset)) < 0) + return ret; + + if (rel_ip < start_offset) + hi = mid; + else + { + if ((ret = remote_read (e_addr, end_offset)) < 0) + return ret; + + if (rel_ip >= end_offset) + lo = mid + 1; + else + break; + } + } + if (rel_ip < start_offset || rel_ip >= end_offset) + return 0; + e->start_offset = start_offset; + e->end_offset = end_offset; + + if ((ret = remote_read (e_addr, info_offset)) < 0) + return ret; + e->info_offset = info_offset; + return 1; +} + +HIDDEN void +tdep_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg) +{ + if (!pi->unwind_info) + return; + + if (is_local_addr_space (as)) + { + free (pi->unwind_info); + pi->unwind_info = NULL; + } +} + +PROTECTED unw_word_t +_Uia64_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg) +{ + unw_word_t hdr_addr, info_addr, hdr, directives, pers, cookie, off; + unw_word_t start_offset, end_offset, info_offset, segbase; + struct ia64_table_entry *e; + size_t table_size; + unw_word_t gp = di->gp; + int ret; + + switch (di->format) + { + case UNW_INFO_FORMAT_DYNAMIC: + default: + return 0; + + case UNW_INFO_FORMAT_TABLE: + e = (struct ia64_table_entry *) di->u.ti.table_data; + table_size = di->u.ti.table_len * sizeof (di->u.ti.table_data[0]); + segbase = di->u.ti.segbase; + if (table_size < sizeof (struct ia64_table_entry)) + return 0; + start_offset = e[0].start_offset; + end_offset = e[0].end_offset; + info_offset = e[0].info_offset; + break; + + case UNW_INFO_FORMAT_REMOTE_TABLE: + { + unw_accessors_t *a = unw_get_accessors (as); + unw_word_t e_addr = di->u.rti.table_data; + + table_size = di->u.rti.table_len * sizeof (unw_word_t); + segbase = di->u.rti.segbase; + if (table_size < sizeof (struct ia64_table_entry)) + return 0; + + if ( (ret = remote_read (e_addr, start_offset) < 0) + || (ret = remote_read (e_addr, end_offset) < 0) + || (ret = remote_read (e_addr, info_offset) < 0)) + return ret; + } + break; + } + + if (start_offset != end_offset) + /* dyn-list entry cover a zero-length "procedure" and should be + first entry (note: technically a binary could contain code + below the segment base, but this doesn't happen for normal + binaries and certainly doesn't happen when libunwind is a + separate shared object. For weird cases, the application may + have to provide its own (slower) version of this routine. */ + return 0; + + hdr_addr = info_offset + segbase; + info_addr = hdr_addr + 8; + + /* read the header word: */ + if ((ret = read_mem (as, hdr_addr, &hdr, arg)) < 0) + return ret; + + if (IA64_UNW_VER (hdr) != 1 + || IA64_UNW_FLAG_EHANDLER (hdr) || IA64_UNW_FLAG_UHANDLER (hdr)) + /* dyn-list entry must be version 1 and doesn't have ehandler + or uhandler */ + return 0; + + if (IA64_UNW_LENGTH (hdr) != 1) + /* dyn-list entry must consist of a single word of NOP directives */ + return 0; + + if ( ((ret = read_mem (as, info_addr, &directives, arg)) < 0) + || ((ret = read_mem (as, info_addr + 0x08, &pers, arg)) < 0) + || ((ret = read_mem (as, info_addr + 0x10, &cookie, arg)) < 0) + || ((ret = read_mem (as, info_addr + 0x18, &off, arg)) < 0)) + return 0; + + if (directives != 0 || pers != 0 + || (!as->big_endian && cookie != 0x7473696c2d6e7964ULL) + || ( as->big_endian && cookie != 0x64796e2d6c697374ULL)) + return 0; + + /* OK, we ran the gauntlet and found it: */ + return off + gp; +} + +#endif /* !UNW_LOCAL_ONLY */ + +static inline const struct ia64_table_entry * +lookup (struct ia64_table_entry *table, size_t table_size, unw_word_t rel_ip) +{ + const struct ia64_table_entry *e = 0; + unsigned long lo, hi, mid; + + /* do a binary search for right entry: */ + for (lo = 0, hi = table_size / sizeof (struct ia64_table_entry); lo < hi;) + { + mid = (lo + hi) / 2; + e = table + mid; + if (rel_ip < e->start_offset) + hi = mid; + else if (rel_ip >= e->end_offset) + lo = mid + 1; + else + break; + } + if (rel_ip < e->start_offset || rel_ip >= e->end_offset) + return NULL; + return e; +} + +PROTECTED int +unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + unw_word_t addr, hdr_addr, info_addr, info_end_addr, hdr, *wp; + const struct ia64_table_entry *e = NULL; + unw_word_t handler_offset, segbase = 0; + struct ia64_table_entry ent; + int ret, is_local; + + assert ((di->format == UNW_INFO_FORMAT_TABLE + || di->format == UNW_INFO_FORMAT_REMOTE_TABLE) + && (ip >= di->start_ip && ip < di->end_ip)); + + pi->flags = 0; + pi->unwind_info = 0; + pi->handler = 0; + + if (likely (di->format == UNW_INFO_FORMAT_TABLE)) + { + segbase = di->u.ti.segbase; + e = lookup ((struct ia64_table_entry *) di->u.ti.table_data, + di->u.ti.table_len * sizeof (unw_word_t), + ip - segbase); + } +#ifndef UNW_LOCAL_ONLY + else + { + segbase = di->u.rti.segbase; + if ((ret = remote_lookup (as, di->u.rti.table_data, + di->u.rti.table_len * sizeof (unw_word_t), + ip - segbase, &ent, arg)) < 0) + return ret; + if (ret) + e = &ent; + } +#endif + if (!e) + { + /* IP is inside this table's range, but there is no explicit + unwind info => use default conventions (i.e., this is NOT an + error). */ + memset (pi, 0, sizeof (*pi)); + pi->start_ip = 0; + pi->end_ip = 0; + pi->gp = di->gp; + pi->lsda = 0; + return 0; + } + + pi->start_ip = e->start_offset + segbase; + pi->end_ip = e->end_offset + segbase; + + hdr_addr = e->info_offset + segbase; + info_addr = hdr_addr + 8; + + /* Read the header word. Note: the actual unwind-info is always + assumed to reside in memory, independent of whether di->format is + UNW_INFO_FORMAT_TABLE or UNW_INFO_FORMAT_REMOTE_TABLE. */ + + if ((ret = read_mem (as, hdr_addr, &hdr, arg)) < 0) + return ret; + + if (IA64_UNW_VER (hdr) != 1) + { + Debug (1, "Unknown header version %ld (hdr word=0x%lx @ 0x%lx)\n", + IA64_UNW_VER (hdr), (unsigned long) hdr, + (unsigned long) hdr_addr); + return -UNW_EBADVERSION; + } + + info_end_addr = info_addr + 8 * IA64_UNW_LENGTH (hdr); + + is_local = is_local_addr_space (as); + + /* If we must have the unwind-info, return it. Also, if we are in + the local address-space, return the unwind-info because it's so + cheap to do so and it may come in handy later on. */ + if (need_unwind_info || is_local) + { + pi->unwind_info_size = 8 * IA64_UNW_LENGTH (hdr); + + if (is_local) + pi->unwind_info = (void *) (uintptr_t) info_addr; + else + { + /* Internalize unwind info. Note: since we're doing this + only for non-local address spaces, there is no + signal-safety issue and it is OK to use malloc()/free(). */ + pi->unwind_info = malloc (8 * IA64_UNW_LENGTH (hdr)); + if (!pi->unwind_info) + return -UNW_ENOMEM; + + wp = (unw_word_t *) pi->unwind_info; + for (addr = info_addr; addr < info_end_addr; addr += 8, ++wp) + { + if ((ret = read_mem (as, addr, wp, arg)) < 0) + { + free (pi->unwind_info); + return ret; + } + } + } + } + + if (IA64_UNW_FLAG_EHANDLER (hdr) || IA64_UNW_FLAG_UHANDLER (hdr)) + { + /* read the personality routine address (address is gp-relative): */ + if ((ret = read_mem (as, info_end_addr, &handler_offset, arg)) < 0) + return ret; + Debug (4, "handler ptr @ offset=%lx, gp=%lx\n", handler_offset, di->gp); + if ((read_mem (as, handler_offset + di->gp, &pi->handler, arg)) < 0) + return ret; + } + pi->lsda = info_end_addr + 8; + pi->gp = di->gp; + pi->format = di->format; + return 0; +} + +#ifndef UNW_REMOTE_ONLY + +# if defined(HAVE_DL_ITERATE_PHDR) +# include +# include + +# if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) \ + || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && !defined(DT_CONFIG)) +# error You need GLIBC 2.2.4 or later on IA-64 Linux +# endif + +# if defined(HAVE_GETUNWIND) + extern unsigned long getunwind (void *buf, size_t len); +# else /* HAVE_GETUNWIND */ +# include +# include +# ifndef __NR_getunwind +# define __NR_getunwind 1215 +# endif + +static unsigned long +getunwind (void *buf, size_t len) +{ + return syscall (SYS_getunwind, buf, len); +} + +# endif /* HAVE_GETUNWIND */ + +static unw_dyn_info_t kernel_table; + +static int +get_kernel_table (unw_dyn_info_t *di) +{ + struct ia64_table_entry *ktab, *etab; + size_t size; + + Debug (16, "getting kernel table"); + + size = getunwind (NULL, 0); + ktab = sos_alloc (size); + if (!ktab) + { + Dprintf (__FILE__".%s: failed to allocate %zu bytes", + __FUNCTION__, size); + return -UNW_ENOMEM; + } + getunwind (ktab, size); + + /* Determine length of kernel's unwind table & relocate its entries. */ + for (etab = ktab; etab->start_offset; ++etab) + etab->info_offset += (uint64_t) ktab; + + di->format = UNW_INFO_FORMAT_TABLE; + di->gp = 0; + di->start_ip = ktab[0].start_offset; + di->end_ip = etab[-1].end_offset; + di->u.ti.name_ptr = (unw_word_t) ""; + di->u.ti.segbase = 0; + di->u.ti.table_len = ((char *) etab - (char *) ktab) / sizeof (unw_word_t); + di->u.ti.table_data = (unw_word_t *) ktab; + + Debug (16, "found table `%s': [%lx-%lx) segbase=%lx len=%lu\n", + (char *) di->u.ti.name_ptr, di->start_ip, di->end_ip, + di->u.ti.segbase, di->u.ti.table_len); + return 0; +} + +# ifndef UNW_LOCAL_ONLY + +/* This is exported for the benefit of libunwind-ptrace.a. */ +PROTECTED int +_Uia64_get_kernel_table (unw_dyn_info_t *di) +{ + int ret; + + if (!kernel_table.u.ti.table_data) + if ((ret = get_kernel_table (&kernel_table)) < 0) + return ret; + + memcpy (di, &kernel_table, sizeof (*di)); + return 0; +} + +# endif /* !UNW_LOCAL_ONLY */ + +static inline unsigned long +current_gp (void) +{ +# if defined(__GNUC__) && !defined(__INTEL_COMPILER) + register unsigned long gp __asm__("gp"); + return gp; +# elif HAVE_IA64INTRIN_H + return __getReg (_IA64_REG_GP); +# else +# error Implement me. +# endif +} + +static int +callback (struct dl_phdr_info *info, size_t size, void *ptr) +{ + unw_dyn_info_t *di = ptr; + const Elf64_Phdr *phdr, *p_unwind, *p_dynamic, *p_text; + long n; + Elf64_Addr load_base, segbase = 0; + + /* Make sure struct dl_phdr_info is at least as big as we need. */ + if (size < offsetof (struct dl_phdr_info, dlpi_phnum) + + sizeof (info->dlpi_phnum)) + return -1; + + Debug (16, "checking `%s' (load_base=%lx)\n", + info->dlpi_name, info->dlpi_addr); + + phdr = info->dlpi_phdr; + load_base = info->dlpi_addr; + p_text = NULL; + p_unwind = NULL; + p_dynamic = NULL; + + /* See if PC falls into one of the loaded segments. Find the unwind + segment at the same time. */ + for (n = info->dlpi_phnum; --n >= 0; phdr++) + { + if (phdr->p_type == PT_LOAD) + { + Elf64_Addr vaddr = phdr->p_vaddr + load_base; + if (di->u.ti.segbase >= vaddr + && di->u.ti.segbase < vaddr + phdr->p_memsz) + p_text = phdr; + } + else if (phdr->p_type == PT_IA_64_UNWIND) + p_unwind = phdr; + else if (phdr->p_type == PT_DYNAMIC) + p_dynamic = phdr; + } + if (!p_text || !p_unwind) + return 0; + + if (likely (p_unwind->p_vaddr >= p_text->p_vaddr + && p_unwind->p_vaddr < p_text->p_vaddr + p_text->p_memsz)) + /* normal case: unwind table is inside text segment */ + segbase = p_text->p_vaddr + load_base; + else + { + /* Special case: unwind table is in some other segment; this + happens for the Linux kernel's gate DSO, for example. */ + phdr = info->dlpi_phdr; + for (n = info->dlpi_phnum; --n >= 0; phdr++) + { + if (phdr->p_type == PT_LOAD && p_unwind->p_vaddr >= phdr->p_vaddr + && p_unwind->p_vaddr < phdr->p_vaddr + phdr->p_memsz) + { + segbase = phdr->p_vaddr + load_base; + break; + } + } + } + + if (p_dynamic) + { + /* For dynamicly linked executables and shared libraries, + DT_PLTGOT is the gp value for that object. */ + Elf64_Dyn *dyn = (Elf64_Dyn *)(p_dynamic->p_vaddr + load_base); + for (; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_PLTGOT) + { + /* On IA-64, _DYNAMIC is writable and GLIBC has relocated it. */ + di->gp = dyn->d_un.d_ptr; + break; + } + } + else + /* Otherwise this is a static executable with no _DYNAMIC. + The gp is constant program-wide. */ + di->gp = current_gp(); + di->format = UNW_INFO_FORMAT_TABLE; + di->start_ip = p_text->p_vaddr + load_base; + di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz; + di->u.ti.name_ptr = (unw_word_t) info->dlpi_name; + di->u.ti.table_data = (void *) (p_unwind->p_vaddr + load_base); + di->u.ti.table_len = p_unwind->p_memsz / sizeof (unw_word_t); + di->u.ti.segbase = segbase; + + Debug (16, "found table `%s': segbase=%lx, len=%lu, gp=%lx, " + "table_data=%p\n", (char *) di->u.ti.name_ptr, di->u.ti.segbase, + di->u.ti.table_len, di->gp, di->u.ti.table_data); + return 1; +} + +# ifdef HAVE_DL_PHDR_REMOVALS_COUNTER + +static inline int +validate_cache (unw_addr_space_t as) +{ + /* Note: we don't need to serialize here with respect to + dl_iterate_phdr() because if somebody were to remove an object + that is required to complete the unwind on whose behalf we're + validating the cache here, we'd be hosed anyhow. What we're + guarding against here is the case where library FOO gets mapped, + unwind info for FOO gets cached, FOO gets unmapped, BAR gets + mapped in the place where FOO was and then we unwind across a + function in FOO. Since no thread can execute in BAR before FOO + has been removed, we are guaranteed that + dl_phdr_removals_counter() would have been incremented before we + get here. */ + unsigned long long removals = dl_phdr_removals_counter (); + + if (removals == as->shared_object_removals) + return 1; + + as->shared_object_removals = removals; + unw_flush_cache (as, 0, 0); + return -1; +} + +# else /* !HAVE_DL_PHDR_REMOVALS_COUNTER */ + +/* Check whether any phdrs have been removed since we last flushed the + cache. If so we flush the cache and return -1, if not, we do + nothing and return 1. */ + +static int +check_callback (struct dl_phdr_info *info, size_t size, void *ptr) +{ +# ifdef HAVE_STRUCT_DL_PHDR_INFO_DLPI_SUBS + unw_addr_space_t as = ptr; + + if (size < + offsetof (struct dl_phdr_info, dlpi_subs) + sizeof (info->dlpi_subs)) + /* It would be safer to flush the cache here, but that would + disable caching for older libc's which would be incompatible + with the behavior of older versions of libunwind so we return 1 + instead and hope nobody runs into stale cache info... */ + return 1; + + if (info->dlpi_subs == as->shared_object_removals) + return 1; + + as->shared_object_removals = info->dlpi_subs; + unw_flush_cache (as, 0, 0); + return -1; /* indicate that there were removals */ +# else + return 1; +# endif +} + +static inline int +validate_cache (unw_addr_space_t as) +{ + intrmask_t saved_mask; + int ret; + + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); + ret = dl_iterate_phdr (check_callback, as); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); + return ret; +} + +# endif /* HAVE_DL_PHDR_REMOVALS_COUNTER */ + +# elif defined(HAVE_DLMODINFO) + /* Support for HP-UX-style dlmodinfo() */ +# include + +static inline int +validate_cache (unw_addr_space_t as) +{ + return 1; +} + +# endif /* !HAVE_DLMODINFO */ + +HIDDEN int +tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, void *arg) +{ +# if defined(HAVE_DL_ITERATE_PHDR) + unw_dyn_info_t di, *dip = &di; + intrmask_t saved_mask; + int ret; + + di.u.ti.segbase = ip; /* this is cheap... */ + + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); + ret = dl_iterate_phdr (callback, &di); + SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); + + if (ret <= 0) + { + if (!kernel_table.u.ti.table_data) + { + if ((ret = get_kernel_table (&kernel_table)) < 0) + return ret; + } + if (ip < kernel_table.start_ip || ip >= kernel_table.end_ip) + return -UNW_ENOINFO; + dip = &kernel_table; + } +# elif defined(HAVE_DLMODINFO) +# define UNWIND_TBL_32BIT 0x8000000000000000 + struct load_module_desc lmd; + unw_dyn_info_t di, *dip = &di; + struct unwind_header + { + uint64_t header_version; + uint64_t start_offset; + uint64_t end_offset; + } + *uhdr; + + if (!dlmodinfo (ip, &lmd, sizeof (lmd), NULL, 0, 0)) + return -UNW_ENOINFO; + + di.format = UNW_INFO_FORMAT_TABLE; + di.start_ip = lmd.text_base; + di.end_ip = lmd.text_base + lmd.text_size; + di.gp = lmd.linkage_ptr; + di.u.ti.name_ptr = 0; /* no obvious table-name available */ + di.u.ti.segbase = lmd.text_base; + + uhdr = (struct unwind_header *) lmd.unwind_base; + + if ((uhdr->header_version & ~UNWIND_TBL_32BIT) != 1 + && (uhdr->header_version & ~UNWIND_TBL_32BIT) != 2) + { + Debug (1, "encountered unknown unwind header version %ld\n", + (long) (uhdr->header_version & ~UNWIND_TBL_32BIT)); + return -UNW_EBADVERSION; + } + if (uhdr->header_version & UNWIND_TBL_32BIT) + { + Debug (1, "32-bit unwind tables are not supported yet\n"); + return -UNW_EINVAL; + } + + di.u.ti.table_data = (unw_word_t *) (di.u.ti.segbase + uhdr->start_offset); + di.u.ti.table_len = ((uhdr->end_offset - uhdr->start_offset) + / sizeof (unw_word_t)); + + Debug (16, "found table `%s': segbase=%lx, len=%lu, gp=%lx, " + "table_data=%p\n", (char *) di.u.ti.name_ptr, di.u.ti.segbase, + di.u.ti.table_len, di.gp, di.u.ti.table_data); +# endif + + /* now search the table: */ + return tdep_search_unwind_table (as, ip, dip, pi, need_unwind_info, arg); +} + +/* Returns 1 if the cache is up-to-date or -1 if the cache contained + stale data and had to be flushed. */ + +HIDDEN int +ia64_local_validate_cache (unw_addr_space_t as, void *arg) +{ + return validate_cache (as); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/ia64/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lfind_unwind_table.c b/sdk/cpprt/linux/libunwind/src/ia64/Lfind_unwind_table.c new file mode 100644 index 0000000000..68e269f1d7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lfind_unwind_table.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gfind_unwind_table.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/ia64/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/ia64/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lglobal.c b/sdk/cpprt/linux/libunwind/src/ia64/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Linit.c b/sdk/cpprt/linux/libunwind/src/ia64/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Linit_local.c b/sdk/cpprt/linux/libunwind/src/ia64/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/ia64/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Linstall_cursor.S b/sdk/cpprt/linux/libunwind/src/ia64/Linstall_cursor.S new file mode 100644 index 0000000000..8c72339725 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Linstall_cursor.S @@ -0,0 +1,6 @@ +#define UNW_LOCAL_ONLY +#include "Ginstall_cursor.S" +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/ia64/Lis_signal_frame.c new file mode 100644 index 0000000000..b9a7c4f51a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lparser.c b/sdk/cpprt/linux/libunwind/src/ia64/Lparser.c new file mode 100644 index 0000000000..f23aaf48e9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lparser.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gparser.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lrbs.c b/sdk/cpprt/linux/libunwind/src/ia64/Lrbs.c new file mode 100644 index 0000000000..a91b5f2979 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lrbs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Grbs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lregs.c b/sdk/cpprt/linux/libunwind/src/ia64/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lresume.c b/sdk/cpprt/linux/libunwind/src/ia64/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lscript.c b/sdk/cpprt/linux/libunwind/src/ia64/Lscript.c new file mode 100644 index 0000000000..57b926bf80 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lscript.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gscript.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Lstep.c b/sdk/cpprt/linux/libunwind/src/ia64/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/Ltables.c b/sdk/cpprt/linux/libunwind/src/ia64/Ltables.c new file mode 100644 index 0000000000..876b0aac03 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/Ltables.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gtables.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/NOTES b/sdk/cpprt/linux/libunwind/src/ia64/NOTES new file mode 100644 index 0000000000..a5805e8345 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/NOTES @@ -0,0 +1,65 @@ +- the frame state consists of the following: + + - ip current instruction pointer + - sp current stack pointer value + - bsp current backing store pointer + - cfm current frame mask + + these are derived from the next younger (more deeply nested) frame + as follows: + + - ip == saved return-link (may be b0 or an alternate branch-reg) + - sp == if younger frame has a fixed-sized frame, sp + size-of-frame, + else saved sp + - cfm == saved ar.pfs + - bsp == if ar.bsp has been saved, saved ar.bsp, otherwise, + ar.bsp \ominus saved ar.pfs.pfm.sol + +The unwind cursor should represent the machine state as it existed at +the address contained in register ip. This state consists of the +*current* frame state and the save locations in the next younger +frame. + +An unwind script current takes the old save locations and updates them +for the next older frame. With the new setup, we need to update the +frame state first, without updating the other save locations. For this +to work, we need the following info: + + - save location of return-link + - save location of ar.pfs + - save location of bsp (if it has been saved) + - size of stack frame (fixed case) or save location of sp + + +setup: + + func: ... + ... + ... + br.call foo <-- call site + ... <-- ip + ... + +initial state: + + The unwind cursor represents the (preserved) machine state + as it existed at "ip". + + Evaluating the unwind descriptors for "ip" yields the following + info: + + - frame size at call site (or previous sp) + - what registers where saved where by func before + the call site was reached + + + Note that there is some procedure info that needs to be obtained + for the new "ip" which is contained in the unwind descriptors. + Specifically, the following is needed: + + - procedure's start address + - personality address + - pointer to language-specific data area + + This info is stored in a separate proc_info structure and needs + to be obtained right after running the unwind script for func. diff --git a/sdk/cpprt/linux/libunwind/src/ia64/dyn_info_list.S b/sdk/cpprt/linux/libunwind/src/ia64/dyn_info_list.S new file mode 100644 index 0000000000..31265f66a0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/dyn_info_list.S @@ -0,0 +1,26 @@ +#ifndef UNW_REMOTE_ONLY + +/* + * Create a special unwind-table entry which makes it easy for an + * unwinder to locate the dynamic registration list. The special + * entry covers address range [0-0) and is therefore guaranteed to be + * the first in the unwind-table. + */ + .global _U_dyn_info_list + .hidden _U_dyn_info_list + + .section .IA_64.unwind_info,"a","progbits" +.info: data8 (1<<48) | 1 /* v1, length==1 (8-byte word) */ + data8 0 /* 8 empty .prologue directives (nops) */ + data8 0 /* personality routine (ignored) */ + string "dyn-list" /* lsda */ + data8 @gprel(_U_dyn_info_list) + + .section .IA_64.unwind, "a", "progbits" + data8 0, 0, @segrel(.info) + +#endif +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/getcontext.S b/sdk/cpprt/linux/libunwind/src/ia64/getcontext.S new file mode 100644 index 0000000000..d8da732acc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/getcontext.S @@ -0,0 +1,177 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "ucontext_i.h" + +#define GR(n) (SC_GR + (n)*8) +#define BR(n) (SC_BR + (n)*8) +#define FR(n) (SC_FR + (n)*16) + +/* This should be compatible to the libc's getcontext(), except that + the sc->sc_mask field is always cleared and that the name is + prefixed with _Uia64_ so we don't step on the application's + name-space. */ + + .align 32 + .protected _Uia64_getcontext + .global _Uia64_getcontext + .proc _Uia64_getcontext +_Uia64_getcontext: + .prologue + alloc rPFS = ar.pfs, 1, 0, 0, 0 // M2 + mov rPR = pr // I0, 2 cycles + add r2 = GR(1), in0 // I1 + ;; + + .save ar.unat, rUNAT + mov.m rUNAT = ar.unat // M2, 5 cycles + .body + st8.spill [r2] = r1, (SC_FLAGS - GR(1)) // M3 + dep.z rFLAGS = -1, IA64_SC_FLAG_SYNCHRONOUS_BIT, 1 // I0, 1 cycle + ;; + + mov.m rRSC = ar.rsc // M2, 12 cyc. + st8 [r2] = rFLAGS, (SC_PR - SC_FLAGS) // M3 + add r3 = FR(2), in0 + ;; + + mov.m rBSP = ar.bsp // M2, 12 cyc. + st8 [r2] = rPR, (GR(12) - SC_PR) // M3 + add r8 = FR(16), in0 + ;; + + mov.m rFPSR = ar.fpsr // M2, 12 cyc. + st8.spill [r2] = r12, (GR(4) - GR(12)) // M3 + add r9 = FR(24), in0 + ;; + + stf.spill [r3] = f2 // M2 + stf.spill [r8] = f16 // M3 + add r3 = GR(7), in0 + ;; + + flushrs // M0 + stf.spill [r9] = f24, (FR(31) - FR(24)) // M2 + mov rB0 = b0 // I0, 2 cycles + ;; + + stf.spill [r9] = f31 // M2 + st8.spill [r2] = r4, (GR(5) - GR(4)) // M3, bank 1 + mov rB1 = b1 // I0, 2 cycles + ;; + +.mem.offset 0,0; st8.spill [r2] = r5, (GR(6) - GR(5)) // M4, bank 0 +.mem.offset 8,0; st8.spill [r3] = r7, (BR(0) - GR(7)) // M3, bank 0 + mov rB2 = b2 // I0, 2 cycles + ;; + + st8.spill [r2] = r6, (BR(1) - GR(6)) // M2, bank 1 + st8 [r3] = rB0, (BR(4) - BR(0)) // M3, bank 1 + mov rB4 = b4 // I0, 2 cycles + ;; + + mov.m rNAT = ar.unat // M2, 5 cycles + st8 [r2] = rB1, (BR(2) - BR(1)) // M3, bank 0 + mov rB3 = b3 + ;; + + st8 [r2] = rB2, (BR(3) - BR(2)) // M2, bank 1 + st8 [r3] = rB4, (SC_LC - BR(4)) // M3, bank 1 + mov rB5 = b5 // I0, 2 cycles + ;; + + and rTMP = ~0x3, rRSC // M0 + add rPOS = GR(0), in0 // rPOS <- &sc_gr[0] // M1 + mov.i rLC = ar.lc // I0, 2 cycles + ;; + + mov.m ar.rsc = rTMP // put RSE into lazy mode // M2, ? cycles + st8 [r2] = rB3, (BR(5) - BR(3)) // M3, bank 0 + extr.u rPOS = rPOS, 3, 6 // get NaT bitnr for r0 // I0 + ;; + + mov.m rRNAT = ar.rnat // M2, 5 cycles + st8 [r2] = rB5, (SC_PFS - BR(5)) // M3, bank 0 + sub rCPOS = 64, rPOS // I0 + ;; + + st8 [r2] = rPFS, (SC_UNAT - SC_PFS) // M2 + st8 [r3] = rLC, (SC_BSP - SC_LC) // M3 + shr.u rTMP = rNAT, rPOS // I0, 3 cycles + ;; + + st8 [r2] = rUNAT, (SC_FPSR - SC_UNAT) // M2 + st8 [r3] = rBSP // M3 + add r8 = FR(3), in0 + ;; + + st8 [r2] = rFPSR, (SC_RNAT - SC_FPSR) // M2 + stf.spill [r8] = f3, (FR(4) - FR(3)) // M3 + add r9 = FR(5), in0 + ;; + + stf.spill [r8] = f4, (FR(17) - FR(4)) // M2 + stf.spill [r9] = f5, (FR(19) - FR(5)) // M3 + shl rNAT = rNAT, rCPOS // I0, 3 cycles + ;; + + st8 [r2] = rRNAT, (SC_NAT - SC_RNAT) // M2 + stf.spill [r8] = f17, (FR(18) - FR(17)) // M3 + nop.i 0 + ;; + + stf.spill [r8] = f18, (FR(20) - FR(18)) // M2 + stf.spill [r9] = f19, (FR(21) - FR(19)) // M3 + nop.i 0 + ;; + + stf.spill [r8] = f20, (FR(22) - FR(20)) // M2 + stf.spill [r9] = f21, (FR(23) - FR(21)) // M3 + or rNAT = rNAT, rTMP // I0 + ;; + + st8 [r2] = rNAT // M2 + stf.spill [r8] = f22, (FR(25) - FR(22)) // M3 + ;; + stf.spill [r9] = f23, (FR(26) - FR(23)) // M2 + stf.spill [r8] = f25, (FR(27) - FR(25)) // M3 + ;; + stf.spill [r9] = f26, (FR(28) - FR(26)) // M2 + stf.spill [r8] = f27, (FR(29) - FR(27)) // M3 + ;; + mov.m ar.rsc = rRSC // restore RSE mode // M2 + stf.spill [r9] = f28, (FR(30) - FR(28)) // M3 + ;; + mov.m ar.unat = rUNAT // restore caller's UNaT // M2 + stf.spill [r8] = f29 // M3 + ;; + stf.spill [r9] = f30 // M2 + mov r8 = 0 + br.ret.sptk.many rp + .endp _Uia64_getcontext +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/init.h b/sdk/cpprt/linux/libunwind/src/ia64/init.h new file mode 100644 index 0000000000..d6a1b2277f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/init.h @@ -0,0 +1,134 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static ALWAYS_INLINE int +common_init (struct cursor *c, unw_word_t sp, unw_word_t bsp) +{ + unw_word_t bspstore, rbs_base; + uint8_t *natp; + int ret; + + if (c->as->caching_policy != UNW_CACHE_NONE) + /* ensure cache doesn't have any stale contents: */ + ia64_validate_cache (c->as, c->as_arg); + + c->cfm_loc = IA64_REG_LOC (c, UNW_IA64_CFM); + c->loc[IA64_REG_BSP] = IA64_NULL_LOC; + c->loc[IA64_REG_BSPSTORE] = IA64_REG_LOC (c, UNW_IA64_AR_BSPSTORE); + c->loc[IA64_REG_PFS] = IA64_REG_LOC (c, UNW_IA64_AR_PFS); + c->loc[IA64_REG_RNAT] = IA64_REG_LOC (c, UNW_IA64_AR_RNAT); + c->loc[IA64_REG_IP] = IA64_REG_LOC (c, UNW_IA64_IP); + c->loc[IA64_REG_PRI_UNAT_MEM] = IA64_NULL_LOC; /* no primary UNaT location */ + c->loc[IA64_REG_UNAT] = IA64_REG_LOC (c, UNW_IA64_AR_UNAT); + c->loc[IA64_REG_PR] = IA64_REG_LOC (c, UNW_IA64_PR); + c->loc[IA64_REG_LC] = IA64_REG_LOC (c, UNW_IA64_AR_LC); + c->loc[IA64_REG_FPSR] = IA64_REG_LOC (c, UNW_IA64_AR_FPSR); + + c->loc[IA64_REG_R4] = IA64_REG_LOC (c, UNW_IA64_GR + 4); + c->loc[IA64_REG_R5] = IA64_REG_LOC (c, UNW_IA64_GR + 5); + c->loc[IA64_REG_R6] = IA64_REG_LOC (c, UNW_IA64_GR + 6); + c->loc[IA64_REG_R7] = IA64_REG_LOC (c, UNW_IA64_GR + 7); + + natp = c->nat_bitnr; + c->loc[IA64_REG_NAT4] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 4, &natp[0]); + c->loc[IA64_REG_NAT5] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 5, &natp[1]); + c->loc[IA64_REG_NAT6] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 6, &natp[2]); + c->loc[IA64_REG_NAT7] = IA64_REG_NAT_LOC (c, UNW_IA64_NAT + 7, &natp[3]); + + c->loc[IA64_REG_B1] = IA64_REG_LOC (c, UNW_IA64_BR + 1); + c->loc[IA64_REG_B2] = IA64_REG_LOC (c, UNW_IA64_BR + 2); + c->loc[IA64_REG_B3] = IA64_REG_LOC (c, UNW_IA64_BR + 3); + c->loc[IA64_REG_B4] = IA64_REG_LOC (c, UNW_IA64_BR + 4); + c->loc[IA64_REG_B5] = IA64_REG_LOC (c, UNW_IA64_BR + 5); + + c->loc[IA64_REG_F2] = IA64_FPREG_LOC (c, UNW_IA64_FR + 2); + c->loc[IA64_REG_F3] = IA64_FPREG_LOC (c, UNW_IA64_FR + 3); + c->loc[IA64_REG_F4] = IA64_FPREG_LOC (c, UNW_IA64_FR + 4); + c->loc[IA64_REG_F5] = IA64_FPREG_LOC (c, UNW_IA64_FR + 5); + c->loc[IA64_REG_F16] = IA64_FPREG_LOC (c, UNW_IA64_FR + 16); + c->loc[IA64_REG_F17] = IA64_FPREG_LOC (c, UNW_IA64_FR + 17); + c->loc[IA64_REG_F18] = IA64_FPREG_LOC (c, UNW_IA64_FR + 18); + c->loc[IA64_REG_F19] = IA64_FPREG_LOC (c, UNW_IA64_FR + 19); + c->loc[IA64_REG_F20] = IA64_FPREG_LOC (c, UNW_IA64_FR + 20); + c->loc[IA64_REG_F21] = IA64_FPREG_LOC (c, UNW_IA64_FR + 21); + c->loc[IA64_REG_F22] = IA64_FPREG_LOC (c, UNW_IA64_FR + 22); + c->loc[IA64_REG_F23] = IA64_FPREG_LOC (c, UNW_IA64_FR + 23); + c->loc[IA64_REG_F24] = IA64_FPREG_LOC (c, UNW_IA64_FR + 24); + c->loc[IA64_REG_F25] = IA64_FPREG_LOC (c, UNW_IA64_FR + 25); + c->loc[IA64_REG_F26] = IA64_FPREG_LOC (c, UNW_IA64_FR + 26); + c->loc[IA64_REG_F27] = IA64_FPREG_LOC (c, UNW_IA64_FR + 27); + c->loc[IA64_REG_F28] = IA64_FPREG_LOC (c, UNW_IA64_FR + 28); + c->loc[IA64_REG_F29] = IA64_FPREG_LOC (c, UNW_IA64_FR + 29); + c->loc[IA64_REG_F30] = IA64_FPREG_LOC (c, UNW_IA64_FR + 30); + c->loc[IA64_REG_F31] = IA64_FPREG_LOC (c, UNW_IA64_FR + 31); + + ret = ia64_get (c, c->loc[IA64_REG_IP], &c->ip); + if (ret < 0) + return ret; + + ret = ia64_get (c, c->cfm_loc, &c->cfm); + if (ret < 0) + return ret; + + ret = ia64_get (c, c->loc[IA64_REG_PR], &c->pr); + if (ret < 0) + return ret; + + c->sp = c->psp = sp; + c->bsp = bsp; + + ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &bspstore); + if (ret < 0) + return ret; + + c->rbs_curr = c->rbs_left_edge = 0; + + /* Try to find a base of the register backing-store. We may default + to a reasonable value (e.g., half the address-space down from + bspstore). If the BSPSTORE looks corrupt, we fail. */ + if ((ret = rbs_get_base (c, bspstore, &rbs_base)) < 0) + return ret; + + c->rbs_area[0].end = bspstore; + c->rbs_area[0].size = bspstore - rbs_base; + c->rbs_area[0].rnat_loc = IA64_REG_LOC (c, UNW_IA64_AR_RNAT); + Debug (10, "initial rbs-area: [0x%llx-0x%llx), rnat@%s\n", + (long long) rbs_base, (long long) c->rbs_area[0].end, + ia64_strloc (c->rbs_area[0].rnat_loc)); + + c->pi.flags = 0; + + c->sigcontext_addr = 0; + c->abi_marker = 0; + c->last_abi_marker = 0; + + c->hint = 0; + c->prev_script = 0; + c->eh_valid_mask = 0; + c->pi_valid = 0; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/longjmp.S b/sdk/cpprt/linux/libunwind/src/ia64/longjmp.S new file mode 100644 index 0000000000..2a2f286594 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/longjmp.S @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .global _UI_longjmp_cont + + .align 32 + .proc longjmp_continuation +longjmp_continuation: +_UI_longjmp_cont: // non-function label for {sig,}longjmp.c + .prologue + .save rp, r15 + .body + mov rp = r15 + mov r8 = r16 + br.sptk.many rp + .endp longjmp_continuation +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/mk_Gcursor_i.c b/sdk/cpprt/linux/libunwind/src/ia64/mk_Gcursor_i.c new file mode 100644 index 0000000000..51cb0f4088 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/mk_Gcursor_i.c @@ -0,0 +1,106 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Utility to generate cursor_i.h. */ + +#include + +#include "libunwind_i.h" + +#ifdef offsetof +# undef offsetof +#endif + +#define offsetof(type,field) ((char *) &((type *) 0)->field - (char *) 0) + +static struct + { + const char name[256]; + unsigned long value; + } +tab[] = + { + { "IP_OFF", offsetof (struct cursor, ip) }, + { "PR_OFF", offsetof (struct cursor, pr) }, + { "BSP_OFF", offsetof (struct cursor, bsp) }, + { "PSP_OFF", offsetof (struct cursor, psp) }, + { "PFS_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_PFS]) }, + { "RNAT_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_RNAT]) }, + { "UNAT_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_UNAT]) }, + { "LC_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_LC]) }, + { "FPSR_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_FPSR]) }, + { "B1_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B1]) }, + { "B2_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B2]) }, + { "B3_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B3]) }, + { "B4_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B4]) }, + { "B5_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B5]) }, + { "F2_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F2]) }, + { "F3_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F3]) }, + { "F4_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F4]) }, + { "F5_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F5]) }, + { "FR_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F16]) }, + { "LOC_SIZE", + (offsetof (struct cursor, loc[1]) - offsetof (struct cursor, loc[0])) + }, + { "SIGCONTEXT_ADDR_OFF", offsetof (struct cursor, sigcontext_addr) }, +}; + +static const char *tabs = "\t\t\t\t\t\t\t\t\t\t"; + +int +main (int argc, char **argv) +{ + const char *space; + int i, num_tabs; + size_t len; + + printf ("#ifndef cursor_i_h\n"); + printf ("#define cursor_i_h\n\n"); + + printf ("/*\n * DO NOT MODIFY\n *\n * This file was generated by " + "%s.\n *\n */\n\n", argv[0]); + + for (i = 0; i < (int) (sizeof (tab) / sizeof (tab[0])); ++i) + { + if (tab[i].name[0] == '\0') + printf ("\n"); + else + { + len = strlen (tab[i].name); + + num_tabs = (40 - len) / 8; + if (num_tabs <= 0) + space = " "; + else + space = strchr(tabs, '\0') - (40 - len) / 8; + + printf ("#define %s%s%lu\t/* 0x%lx */\n", + tab[i].name, space, tab[i].value, tab[i].value); + } + } + + printf ("\n#endif /* cursor_i_h */\n"); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/mk_Lcursor_i.c b/sdk/cpprt/linux/libunwind/src/ia64/mk_Lcursor_i.c new file mode 100644 index 0000000000..aee2e7eeb8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/mk_Lcursor_i.c @@ -0,0 +1,2 @@ +#define UNW_LOCAL_ONLY +#include "mk_Gcursor_i.c" diff --git a/sdk/cpprt/linux/libunwind/src/ia64/offsets.h b/sdk/cpprt/linux/libunwind/src/ia64/offsets.h new file mode 100644 index 0000000000..b169933b8d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/offsets.h @@ -0,0 +1,137 @@ +/* Linux-specific definitions: */ + +/* Define various structure offsets to simplify cross-compilation. */ + +/* The first three 64-bit words in a signal frame contain the signal + number, siginfo pointer, and sigcontext pointer passed to the + signal handler. We use this to locate the sigcontext pointer. */ + +#define LINUX_SIGFRAME_ARG2_OFF 0x10 + +#define LINUX_SC_FLAGS_OFF 0x000 +#define LINUX_SC_NAT_OFF 0x008 +#define LINUX_SC_STACK_OFF 0x010 +#define LINUX_SC_IP_OFF 0x028 +#define LINUX_SC_CFM_OFF 0x030 +#define LINUX_SC_UM_OFF 0x038 +#define LINUX_SC_AR_RSC_OFF 0x040 +#define LINUX_SC_AR_BSP_OFF 0x048 +#define LINUX_SC_AR_RNAT_OFF 0x050 +#define LINUX_SC_AR_CCV 0x058 +#define LINUX_SC_AR_UNAT_OFF 0x060 +#define LINUX_SC_AR_FPSR_OFF 0x068 +#define LINUX_SC_AR_PFS_OFF 0x070 +#define LINUX_SC_AR_LC_OFF 0x078 +#define LINUX_SC_PR_OFF 0x080 +#define LINUX_SC_BR_OFF 0x088 +#define LINUX_SC_GR_OFF 0x0c8 +#define LINUX_SC_FR_OFF 0x1d0 +#define LINUX_SC_RBS_BASE_OFF 0x9d0 +#define LINUX_SC_LOADRS_OFF 0x9d8 +#define LINUX_SC_AR_CSD_OFF 0x9e0 +#define LINUX_SC_AR_SSD_OFF 0x9e8 +#define LINUX_SC_MASK 0xa50 + +/* Layout of old Linux kernel interrupt frame (struct pt_regs). */ + +#define LINUX_OLD_PT_IPSR_OFF 0x000 +#define LINUX_OLD_PT_IIP_OFF 0x008 +#define LINUX_OLD_PT_IFS_OFF 0x010 +#define LINUX_OLD_PT_UNAT_OFF 0x018 +#define LINUX_OLD_PT_PFS_OFF 0x020 +#define LINUX_OLD_PT_RSC_OFF 0x028 +#define LINUX_OLD_PT_RNAT_OFF 0x030 +#define LINUX_OLD_PT_BSPSTORE_OFF 0x038 +#define LINUX_OLD_PT_PR_OFF 0x040 +#define LINUX_OLD_PT_B6_OFF 0x048 +#define LINUX_OLD_PT_LOADRS_OFF 0x050 +#define LINUX_OLD_PT_R1_OFF 0x058 +#define LINUX_OLD_PT_R2_OFF 0x060 +#define LINUX_OLD_PT_R3_OFF 0x068 +#define LINUX_OLD_PT_R12_OFF 0x070 +#define LINUX_OLD_PT_R13_OFF 0x078 +#define LINUX_OLD_PT_R14_OFF 0x080 +#define LINUX_OLD_PT_R15_OFF 0x088 +#define LINUX_OLD_PT_R8_OFF 0x090 +#define LINUX_OLD_PT_R9_OFF 0x098 +#define LINUX_OLD_PT_R10_OFF 0x0a0 +#define LINUX_OLD_PT_R11_OFF 0x0a8 +#define LINUX_OLD_PT_R16_OFF 0x0b0 +#define LINUX_OLD_PT_R17_OFF 0x0b8 +#define LINUX_OLD_PT_R18_OFF 0x0c0 +#define LINUX_OLD_PT_R19_OFF 0x0c8 +#define LINUX_OLD_PT_R20_OFF 0x0d0 +#define LINUX_OLD_PT_R21_OFF 0x0d8 +#define LINUX_OLD_PT_R22_OFF 0x0e0 +#define LINUX_OLD_PT_R23_OFF 0x0e8 +#define LINUX_OLD_PT_R24_OFF 0x0f0 +#define LINUX_OLD_PT_R25_OFF 0x0f8 +#define LINUX_OLD_PT_R26_OFF 0x100 +#define LINUX_OLD_PT_R27_OFF 0x108 +#define LINUX_OLD_PT_R28_OFF 0x110 +#define LINUX_OLD_PT_R29_OFF 0x118 +#define LINUX_OLD_PT_R30_OFF 0x120 +#define LINUX_OLD_PT_R31_OFF 0x128 +#define LINUX_OLD_PT_CCV_OFF 0x130 +#define LINUX_OLD_PT_FPSR_OFF 0x138 +#define LINUX_OLD_PT_B0_OFF 0x140 +#define LINUX_OLD_PT_B7_OFF 0x148 +#define LINUX_OLD_PT_F6_OFF 0x150 +#define LINUX_OLD_PT_F7_OFF 0x160 +#define LINUX_OLD_PT_F8_OFF 0x170 +#define LINUX_OLD_PT_F9_OFF 0x180 + +/* Layout of new Linux kernel interrupt frame (struct pt_regs). */ + +#define LINUX_PT_B6_OFF 0 +#define LINUX_PT_B7_OFF 8 +#define LINUX_PT_CSD_OFF 16 +#define LINUX_PT_SSD_OFF 24 +#define LINUX_PT_R8_OFF 32 +#define LINUX_PT_R9_OFF 40 +#define LINUX_PT_R10_OFF 48 +#define LINUX_PT_R11_OFF 56 +#define LINUX_PT_IPSR_OFF 64 +#define LINUX_PT_IIP_OFF 72 +#define LINUX_PT_IFS_OFF 80 +#define LINUX_PT_UNAT_OFF 88 +#define LINUX_PT_PFS_OFF 96 +#define LINUX_PT_RSC_OFF 104 +#define LINUX_PT_RNAT_OFF 112 +#define LINUX_PT_BSPSTORE_OFF 120 +#define LINUX_PT_PR_OFF 128 +#define LINUX_PT_B0_OFF 136 +#define LINUX_PT_LOADRS_OFF 144 +#define LINUX_PT_R1_OFF 152 +#define LINUX_PT_R12_OFF 160 +#define LINUX_PT_R13_OFF 168 +#define LINUX_PT_FPSR_OFF 176 +#define LINUX_PT_R15_OFF 184 +#define LINUX_PT_R14_OFF 192 +#define LINUX_PT_R2_OFF 200 +#define LINUX_PT_R3_OFF 208 +#define LINUX_PT_R16_OFF 216 +#define LINUX_PT_R17_OFF 224 +#define LINUX_PT_R18_OFF 232 +#define LINUX_PT_R19_OFF 240 +#define LINUX_PT_R20_OFF 248 +#define LINUX_PT_R21_OFF 256 +#define LINUX_PT_R22_OFF 264 +#define LINUX_PT_R23_OFF 272 +#define LINUX_PT_R24_OFF 280 +#define LINUX_PT_R25_OFF 288 +#define LINUX_PT_R26_OFF 296 +#define LINUX_PT_R27_OFF 304 +#define LINUX_PT_R28_OFF 312 +#define LINUX_PT_R29_OFF 320 +#define LINUX_PT_R30_OFF 328 +#define LINUX_PT_R31_OFF 336 +#define LINUX_PT_CCV_OFF 344 +#define LINUX_PT_F6_OFF 352 +#define LINUX_PT_F7_OFF 368 +#define LINUX_PT_F8_OFF 384 +#define LINUX_PT_F9_OFF 400 +#define LINUX_PT_F10_OFF 416 +#define LINUX_PT_F11_OFF 432 + +#define LINUX_PT_P_NONSYS 5 /* must match pNonSys in entry.h */ diff --git a/sdk/cpprt/linux/libunwind/src/ia64/regname.c b/sdk/cpprt/linux/libunwind/src/ia64/regname.c new file mode 100644 index 0000000000..4936a3d20e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/regname.c @@ -0,0 +1,189 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Logically, we like to think of the stack as a contiguous region of +memory. Unfortunately, this logical view doesn't work for the +register backing store, because the RSE is an asynchronous engine and +because UNIX/Linux allow for stack-switching via sigaltstack(2). +Specifically, this means that any given stacked register may or may +not be backed up by memory in the current stack. If not, then the +backing memory may be found in any of the "more inner" (younger) +stacks. The routines in this file help manage the discontiguous +nature of the register backing store. The routines are completely +independent of UNIX/Linux, but each stack frame that switches the +backing store is expected to reserve 4 words for use by libunwind. For +example, in the Linux sigcontext, sc_fr[0] and sc_fr[1] serve this +purpose. */ + +#include "libunwind_i.h" + +/* Maintain the register names as a single string to keep the number + of dynamic relocations in the shared object to a minimum. */ + +#define regname_len 9 +#define regname_str \ + "r0\0\0\0\0\0\0\0r1\0\0\0\0\0\0\0r2\0\0\0\0\0\0\0r3\0\0\0\0\0\0\0" \ + "r4\0\0\0\0\0\0\0r5\0\0\0\0\0\0\0r6\0\0\0\0\0\0\0r7\0\0\0\0\0\0\0" \ + "r8\0\0\0\0\0\0\0r9\0\0\0\0\0\0\0r10\0\0\0\0\0\0r11\0\0\0\0\0\0" \ + "r12\0\0\0\0\0\0r13\0\0\0\0\0\0r14\0\0\0\0\0\0r15\0\0\0\0\0\0" \ + "r16\0\0\0\0\0\0r17\0\0\0\0\0\0r18\0\0\0\0\0\0r19\0\0\0\0\0\0" \ + "r20\0\0\0\0\0\0r21\0\0\0\0\0\0r22\0\0\0\0\0\0r23\0\0\0\0\0\0" \ + "r24\0\0\0\0\0\0r25\0\0\0\0\0\0r26\0\0\0\0\0\0r27\0\0\0\0\0\0" \ + "r28\0\0\0\0\0\0r29\0\0\0\0\0\0r30\0\0\0\0\0\0r31\0\0\0\0\0\0" \ + "r32\0\0\0\0\0\0r33\0\0\0\0\0\0r34\0\0\0\0\0\0r35\0\0\0\0\0\0" \ + "r36\0\0\0\0\0\0r37\0\0\0\0\0\0r38\0\0\0\0\0\0r39\0\0\0\0\0\0" \ + "r40\0\0\0\0\0\0r41\0\0\0\0\0\0r42\0\0\0\0\0\0r43\0\0\0\0\0\0" \ + "r44\0\0\0\0\0\0r45\0\0\0\0\0\0r46\0\0\0\0\0\0r47\0\0\0\0\0\0" \ + "r48\0\0\0\0\0\0r49\0\0\0\0\0\0r50\0\0\0\0\0\0r51\0\0\0\0\0\0" \ + "r52\0\0\0\0\0\0r53\0\0\0\0\0\0r54\0\0\0\0\0\0r55\0\0\0\0\0\0" \ + "r56\0\0\0\0\0\0r57\0\0\0\0\0\0r58\0\0\0\0\0\0r59\0\0\0\0\0\0" \ + "r60\0\0\0\0\0\0r61\0\0\0\0\0\0r62\0\0\0\0\0\0r63\0\0\0\0\0\0" \ + "r64\0\0\0\0\0\0r65\0\0\0\0\0\0r66\0\0\0\0\0\0r67\0\0\0\0\0\0" \ + "r68\0\0\0\0\0\0r69\0\0\0\0\0\0r70\0\0\0\0\0\0r71\0\0\0\0\0\0" \ + "r72\0\0\0\0\0\0r73\0\0\0\0\0\0r74\0\0\0\0\0\0r75\0\0\0\0\0\0" \ + "r76\0\0\0\0\0\0r77\0\0\0\0\0\0r78\0\0\0\0\0\0r79\0\0\0\0\0\0" \ + "r80\0\0\0\0\0\0r81\0\0\0\0\0\0r82\0\0\0\0\0\0r83\0\0\0\0\0\0" \ + "r84\0\0\0\0\0\0r85\0\0\0\0\0\0r86\0\0\0\0\0\0r87\0\0\0\0\0\0" \ + "r88\0\0\0\0\0\0r89\0\0\0\0\0\0r90\0\0\0\0\0\0r91\0\0\0\0\0\0" \ + "r92\0\0\0\0\0\0r93\0\0\0\0\0\0r94\0\0\0\0\0\0r95\0\0\0\0\0\0" \ + "r96\0\0\0\0\0\0r97\0\0\0\0\0\0r98\0\0\0\0\0\0r99\0\0\0\0\0\0" \ + "r100\0\0\0\0\0r101\0\0\0\0\0r102\0\0\0\0\0r103\0\0\0\0\0" \ + "r104\0\0\0\0\0r105\0\0\0\0\0r106\0\0\0\0\0r107\0\0\0\0\0" \ + "r108\0\0\0\0\0r109\0\0\0\0\0r110\0\0\0\0\0r111\0\0\0\0\0" \ + "r112\0\0\0\0\0r113\0\0\0\0\0r114\0\0\0\0\0r115\0\0\0\0\0" \ + "r116\0\0\0\0\0r117\0\0\0\0\0r118\0\0\0\0\0r119\0\0\0\0\0" \ + "r120\0\0\0\0\0r121\0\0\0\0\0r122\0\0\0\0\0r123\0\0\0\0\0" \ + "r124\0\0\0\0\0r125\0\0\0\0\0r126\0\0\0\0\0r127\0\0\0\0\0" \ + "nat0\0\0\0\0\0nat1\0\0\0\0\0nat2\0\0\0\0\0nat3\0\0\0\0\0" \ + "nat4\0\0\0\0\0nat5\0\0\0\0\0nat6\0\0\0\0\0nat7\0\0\0\0\0" \ + "nat8\0\0\0\0\0nat9\0\0\0\0\0nat10\0\0\0\0nat11\0\0\0\0" \ + "nat12\0\0\0\0nat13\0\0\0\0nat14\0\0\0\0nat15\0\0\0\0" \ + "nat16\0\0\0\0nat17\0\0\0\0nat18\0\0\0\0nat19\0\0\0\0" \ + "nat20\0\0\0\0nat21\0\0\0\0nat22\0\0\0\0nat23\0\0\0\0" \ + "nat24\0\0\0\0nat25\0\0\0\0nat26\0\0\0\0nat27\0\0\0\0" \ + "nat28\0\0\0\0nat29\0\0\0\0nat30\0\0\0\0nat31\0\0\0\0" \ + "nat32\0\0\0\0nat33\0\0\0\0nat34\0\0\0\0nat35\0\0\0\0" \ + "nat36\0\0\0\0nat37\0\0\0\0nat38\0\0\0\0nat39\0\0\0\0" \ + "nat40\0\0\0\0nat41\0\0\0\0nat42\0\0\0\0nat43\0\0\0\0" \ + "nat44\0\0\0\0nat45\0\0\0\0nat46\0\0\0\0nat47\0\0\0\0" \ + "nat48\0\0\0\0nat49\0\0\0\0nat50\0\0\0\0nat51\0\0\0\0" \ + "nat52\0\0\0\0nat53\0\0\0\0nat54\0\0\0\0nat55\0\0\0\0" \ + "nat56\0\0\0\0nat57\0\0\0\0nat58\0\0\0\0nat59\0\0\0\0" \ + "nat60\0\0\0\0nat61\0\0\0\0nat62\0\0\0\0nat63\0\0\0\0" \ + "nat64\0\0\0\0nat65\0\0\0\0nat66\0\0\0\0nat67\0\0\0\0" \ + "nat68\0\0\0\0nat69\0\0\0\0nat70\0\0\0\0nat71\0\0\0\0" \ + "nat72\0\0\0\0nat73\0\0\0\0nat74\0\0\0\0nat75\0\0\0\0" \ + "nat76\0\0\0\0nat77\0\0\0\0nat78\0\0\0\0nat79\0\0\0\0" \ + "nat80\0\0\0\0nat81\0\0\0\0nat82\0\0\0\0nat83\0\0\0\0" \ + "nat84\0\0\0\0nat85\0\0\0\0nat86\0\0\0\0nat87\0\0\0\0" \ + "nat88\0\0\0\0nat89\0\0\0\0nat90\0\0\0\0nat91\0\0\0\0" \ + "nat92\0\0\0\0nat93\0\0\0\0nat94\0\0\0\0nat95\0\0\0\0" \ + "nat96\0\0\0\0nat97\0\0\0\0nat98\0\0\0\0nat99\0\0\0\0" \ + "nat100\0\0\0nat101\0\0\0nat102\0\0\0nat103\0\0\0" \ + "nat104\0\0\0nat105\0\0\0nat106\0\0\0nat107\0\0\0" \ + "nat108\0\0\0nat109\0\0\0nat110\0\0\0nat111\0\0\0" \ + "nat112\0\0\0nat113\0\0\0nat114\0\0\0nat115\0\0\0" \ + "nat116\0\0\0nat117\0\0\0nat118\0\0\0nat119\0\0\0" \ + "nat120\0\0\0nat121\0\0\0nat122\0\0\0nat123\0\0\0" \ + "nat124\0\0\0nat125\0\0\0nat126\0\0\0nat127\0\0\0" \ + "f0\0\0\0\0\0\0\0f1\0\0\0\0\0\0\0f2\0\0\0\0\0\0\0f3\0\0\0\0\0\0\0" \ + "f4\0\0\0\0\0\0\0f5\0\0\0\0\0\0\0f6\0\0\0\0\0\0\0f7\0\0\0\0\0\0\0" \ + "f8\0\0\0\0\0\0\0f9\0\0\0\0\0\0\0f10\0\0\0\0\0\0f11\0\0\0\0\0\0" \ + "f12\0\0\0\0\0\0f13\0\0\0\0\0\0f14\0\0\0\0\0\0f15\0\0\0\0\0\0" \ + "f16\0\0\0\0\0\0f17\0\0\0\0\0\0f18\0\0\0\0\0\0f19\0\0\0\0\0\0" \ + "f20\0\0\0\0\0\0f21\0\0\0\0\0\0f22\0\0\0\0\0\0f23\0\0\0\0\0\0" \ + "f24\0\0\0\0\0\0f25\0\0\0\0\0\0f26\0\0\0\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\0\0f94\0\0\0\0\0\0f95\0\0\0\0\0\0" \ + "f96\0\0\0\0\0\0f97\0\0\0\0\0\0f98\0\0\0\0\0\0f99\0\0\0\0\0\0" \ + "f100\0\0\0\0\0f101\0\0\0\0\0f102\0\0\0\0\0f103\0\0\0\0\0" \ + "f104\0\0\0\0\0f105\0\0\0\0\0f106\0\0\0\0\0f107\0\0\0\0\0" \ + "f108\0\0\0\0\0f109\0\0\0\0\0f110\0\0\0\0\0f111\0\0\0\0\0" \ + "f112\0\0\0\0\0f113\0\0\0\0\0f114\0\0\0\0\0f115\0\0\0\0\0" \ + "f116\0\0\0\0\0f117\0\0\0\0\0f118\0\0\0\0\0f119\0\0\0\0\0" \ + "f120\0\0\0\0\0f121\0\0\0\0\0f122\0\0\0\0\0f123\0\0\0\0\0" \ + "f124\0\0\0\0\0f125\0\0\0\0\0f126\0\0\0\0\0f127\0\0\0\0\0" \ + "ar0\0\0\0\0\0\0ar1\0\0\0\0\0\0ar2\0\0\0\0\0\0ar3\0\0\0\0\0\0" \ + "ar4\0\0\0\0\0\0ar5\0\0\0\0\0\0ar6\0\0\0\0\0\0ar7\0\0\0\0\0\0" \ + "ar8\0\0\0\0\0\0ar9\0\0\0\0\0\0ar10\0\0\0\0\0ar11\0\0\0\0\0" \ + "ar12\0\0\0\0\0ar13\0\0\0\0\0ar14\0\0\0\0\0ar15\0\0\0\0\0" \ + "rsc\0\0\0\0\0\0bsp\0\0\0\0\0\0bspstore\0rnat\0\0\0\0\0" \ + "ar20\0\0\0\0\0ar21\0\0\0\0\0ar22\0\0\0\0\0ar23\0\0\0\0\0" \ + "ar24\0\0\0\0\0ar25\0\0\0\0\0ar26\0\0\0\0\0ar27\0\0\0\0\0" \ + "ar28\0\0\0\0\0ar29\0\0\0\0\0ar30\0\0\0\0\0ar31\0\0\0\0\0" \ + "ccv\0\0\0\0\0\0ar33\0\0\0\0\0ar34\0\0\0\0\0ar35\0\0\0\0\0" \ + "unat\0\0\0\0\0ar37\0\0\0\0\0ar38\0\0\0\0\0ar39\0\0\0\0\0" \ + "fpsr\0\0\0\0\0ar41\0\0\0\0\0ar42\0\0\0\0\0ar43\0\0\0\0\0" \ + "ar44\0\0\0\0\0ar45\0\0\0\0\0ar46\0\0\0\0\0ar47\0\0\0\0\0" \ + "ar48\0\0\0\0\0ar49\0\0\0\0\0ar50\0\0\0\0\0ar51\0\0\0\0\0" \ + "ar52\0\0\0\0\0ar53\0\0\0\0\0ar54\0\0\0\0\0ar55\0\0\0\0\0" \ + "ar56\0\0\0\0\0ar57\0\0\0\0\0ar58\0\0\0\0\0ar59\0\0\0\0\0" \ + "ar60\0\0\0\0\0ar61\0\0\0\0\0ar62\0\0\0\0\0ar63\0\0\0\0\0" \ + "pfs\0\0\0\0\0\0lc\0\0\0\0\0\0\0ec\0\0\0\0\0\0\0ar67\0\0\0\0\0" \ + "ar68\0\0\0\0\0ar69\0\0\0\0\0ar70\0\0\0\0\0ar71\0\0\0\0\0" \ + "ar72\0\0\0\0\0ar73\0\0\0\0\0ar74\0\0\0\0\0ar75\0\0\0\0\0" \ + "ar76\0\0\0\0\0ar77\0\0\0\0\0ar78\0\0\0\0\0ar79\0\0\0\0\0" \ + "ar80\0\0\0\0\0ar81\0\0\0\0\0ar82\0\0\0\0\0ar83\0\0\0\0\0" \ + "ar84\0\0\0\0\0ar85\0\0\0\0\0ar86\0\0\0\0\0ar87\0\0\0\0\0" \ + "ar88\0\0\0\0\0ar89\0\0\0\0\0ar90\0\0\0\0\0ar91\0\0\0\0\0" \ + "ar92\0\0\0\0\0ar93\0\0\0\0\0ar94\0\0\0\0\0ar95\0\0\0\0\0" \ + "ar96\0\0\0\0\0ar97\0\0\0\0\0ar98\0\0\0\0\0ar99\0\0\0\0\0" \ + "ar100\0\0\0\0ar101\0\0\0\0ar102\0\0\0\0ar103\0\0\0\0" \ + "ar104\0\0\0\0ar105\0\0\0\0ar106\0\0\0\0ar107\0\0\0\0" \ + "ar108\0\0\0\0ar109\0\0\0\0ar110\0\0\0\0ar111\0\0\0\0" \ + "ar112\0\0\0\0ar113\0\0\0\0ar114\0\0\0\0ar115\0\0\0\0" \ + "ar116\0\0\0\0ar117\0\0\0\0ar118\0\0\0\0ar119\0\0\0\0" \ + "ar120\0\0\0\0ar121\0\0\0\0ar122\0\0\0\0ar123\0\0\0\0" \ + "ar124\0\0\0\0ar125\0\0\0\0ar126\0\0\0\0ar127\0\0\0\0" \ + "rp\0\0\0\0\0\0\0b1\0\0\0\0\0\0\0b2\0\0\0\0\0\0\0b3\0\0\0\0\0\0\0" \ + "b4\0\0\0\0\0\0\0b5\0\0\0\0\0\0\0b6\0\0\0\0\0\0\0b7\0\0\0\0\0\0\0" \ + "pr\0\0\0\0\0\0\0cfm\0\0\0\0\0\0bsp\0\0\0\0\0\0ip\0\0\0\0\0\0\0" \ + "sp\0\0\0\0\0\0\0" + +#define NREGS ((int) (sizeof (regname_str) - 1) / regname_len) + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < NREGS) + return regname_str + reg * regname_len; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/regs.h b/sdk/cpprt/linux/libunwind/src/ia64/regs.h new file mode 100644 index 0000000000..1e748bbe13 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/regs.h @@ -0,0 +1,73 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* Apply rotation to a general register. REG must be in the range 0-127. */ + +static inline int +rotate_gr (struct cursor *c, int reg) +{ + unsigned int rrb_gr, sor; + int preg; + + sor = 8 * ((c->cfm >> 14) & 0xf); + rrb_gr = (c->cfm >> 18) & 0x7f; + + if ((unsigned) (reg - 32) >= sor) + preg = reg; + else + { + preg = reg + rrb_gr; /* apply rotation */ + if ((unsigned) (preg - 32) >= sor) + preg -= sor; /* wrap around */ + } + if (sor) + Debug (15, "sor=%u rrb.gr=%u, r%d -> r%d\n", sor, rrb_gr, reg, preg); + return preg; +} + +/* Apply rotation to a floating-point register. The number REG must + be in the range of 0-127. */ + +static inline int +rotate_fr (struct cursor *c, int reg) +{ + unsigned int rrb_fr; + int preg; + + rrb_fr = (c->cfm >> 25) & 0x7f; + if (reg < 32) + preg = reg; /* register not part of the rotating partition */ + else + { + preg = reg + rrb_fr; /* apply rotation */ + if (preg > 127) + preg -= 96; /* wrap around */ + } + if (rrb_fr) + Debug (15, "rrb.fr=%u, f%d -> f%d\n", rrb_fr, reg, preg); + return preg; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/setjmp.S b/sdk/cpprt/linux/libunwind/src/ia64/setjmp.S new file mode 100644 index 0000000000..384615b840 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/setjmp.S @@ -0,0 +1,51 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "jmpbuf.h" + + .align 32 + + .global _setjmp + + .proc _setjmp + +_setjmp: + mov r2 = ar.bsp + st8 [r32] = r12 // jmp_buf[JB_SP] = sp + mov r3 = rp + + adds r16 = JB_RP*8, r32 + adds r17 = JB_BSP*8, r32 + mov r8 = 0 + ;; + st8 [r16] = r3 // jmp_buf[JB_RP] = rp + st8 [r17] = r2 // jmp_buf[JB_BSP] = bsp + br.ret.sptk.many rp + + .endp _setjmp +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/ia64/siglongjmp.S new file mode 100644 index 0000000000..d77b43753b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/siglongjmp.S @@ -0,0 +1,69 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define SIG_SETMASK 2 + + .global _UI_siglongjmp_cont + .global sigprocmask + + .align 32 + .proc siglongjmp_continuation +siglongjmp_continuation: +_UI_siglongjmp_cont: // non-function label for siglongjmp.c + .prologue + .save rp, r15 + .body + nop 0 + nop 0 + br.call.sptk.many b6 = .next + ;; + .prologue + .save ar.pfs, r33 +.next: alloc loc1 = ar.pfs, 0, 3, 3, 0 + /* + * Note: we can use the scratch stack are because the caller + * of sigsetjmp() by definition is not a leaf-procedure. + */ + st8 [sp] = r17 // store signal mask + .save rp, loc0 + mov loc0 = r15 // final continuation point + ;; + .body + mov loc2 = r16 // value to return in r8 + + mov out0 = SIG_SETMASK + mov out1 = sp + mov out2 = r0 + br.call.sptk.many rp = sigprocmask + ;; + mov rp = loc0 + mov ar.pfs = loc1 + mov r8 = loc2 + br.ret.sptk.many rp + .endp siglongjmp_continuation +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/sigsetjmp.S b/sdk/cpprt/linux/libunwind/src/ia64/sigsetjmp.S new file mode 100644 index 0000000000..02f7af4b37 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/sigsetjmp.S @@ -0,0 +1,69 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "jmpbuf.h" + +#define SIG_BLOCK 0 + + .align 32 + + .global __sigsetjmp + .global sigprocmask + + .proc __sigsetjmp + +__sigsetjmp: + .prologue + .save ar.pfs, r35 + alloc loc1 = ar.pfs, 2, 3, 3, 0 + add out2 = JB_MASK*8, in0 + .save rp, loc0 + mov loc0 = rp + mov out0 = SIG_BLOCK + .body + ;; + cmp.ne p6, p0 = in1, r0 + mov out1 = r0 + mov loc2 = ar.bsp +(p6) br.call.sptk.many rp = sigprocmask // sigjmp_buf[JB_MASK] = sigmask + ;; + + add r16 = JB_MASK_SAVED*8, in0 + st8 [in0] = sp, (JB_RP-JB_SP)*8 // sigjmp_buf[JB_SP] = sp + mov r8 = 0 + ;; + st8 [in0] = loc0, (JB_BSP-JB_RP)*8 // sigjmp_buf[JB_RP] = rp + st8 [r16] = in1 // sigjmp_buf[JB_MASK_SAVED] = savemask + mov rp = loc0 + ;; + st8 [in0] = loc2 // sigjmp_buf[JB_BSP] = bsp + mov.i ar.pfs = loc1 + br.ret.sptk.many rp + + .endp __sigsetjmp +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ia64/ucontext_i.h b/sdk/cpprt/linux/libunwind/src/ia64/ucontext_i.h new file mode 100644 index 0000000000..34171fdf58 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/ucontext_i.h @@ -0,0 +1,68 @@ +/* Copyright (C) 2002 Hewlett-Packard Co. + Contributed by David Mosberger-Tang . + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Constants shared between setcontext() and getcontext(). Don't + install this header file. */ + +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 + +#define IA64_SC_FLAG_SYNCHRONOUS_BIT 63 + +#define SC_FLAGS 0x000 +#define SC_NAT 0x008 +#define SC_BSP 0x048 +#define SC_RNAT 0x050 +#define SC_UNAT 0x060 +#define SC_FPSR 0x068 +#define SC_PFS 0x070 +#define SC_LC 0x078 +#define SC_PR 0x080 +#define SC_BR 0x088 +#define SC_GR 0x0c8 +#define SC_FR 0x1d0 +#define SC_MASK 0x9d0 + + +#define rTMP r10 +#define rPOS r11 +#define rCPOS r14 +#define rNAT r15 +#define rFLAGS r16 + +#define rB5 r18 +#define rB4 r19 +#define rB3 r20 +#define rB2 r21 +#define rB1 r22 +#define rB0 r23 +#define rRSC r24 +#define rBSP r25 +#define rRNAT r26 +#define rUNAT r27 +#define rFPSR r28 +#define rPFS r29 +#define rLC r30 +#define rPR r31 diff --git a/sdk/cpprt/linux/libunwind/src/ia64/unwind_decoder.h b/sdk/cpprt/linux/libunwind/src/ia64/unwind_decoder.h new file mode 100644 index 0000000000..f12c21d1b0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/unwind_decoder.h @@ -0,0 +1,477 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* + * Generic IA-64 unwind info decoder. + * + * This file is used both by the Linux kernel and objdump. Please keep + * the two copies of this file in sync. + * + * You need to customize the decoder by defining the following + * macros/constants before including this file: + * + * Types: + * unw_word Unsigned integer type with at least 64 bits + * + * Register names: + * UNW_REG_BSP + * UNW_REG_BSPSTORE + * UNW_REG_FPSR + * UNW_REG_LC + * UNW_REG_PFS + * UNW_REG_PR + * UNW_REG_RNAT + * UNW_REG_PSP + * UNW_REG_RP + * UNW_REG_UNAT + * + * Decoder action macros: + * UNW_DEC_BAD_CODE(code) + * UNW_DEC_ABI(fmt,abi,context,arg) + * UNW_DEC_BR_GR(fmt,brmask,gr,arg) + * UNW_DEC_BR_MEM(fmt,brmask,arg) + * UNW_DEC_COPY_STATE(fmt,label,arg) + * UNW_DEC_EPILOGUE(fmt,t,ecount,arg) + * UNW_DEC_FRGR_MEM(fmt,grmask,frmask,arg) + * UNW_DEC_FR_MEM(fmt,frmask,arg) + * UNW_DEC_GR_GR(fmt,grmask,gr,arg) + * UNW_DEC_GR_MEM(fmt,grmask,arg) + * UNW_DEC_LABEL_STATE(fmt,label,arg) + * UNW_DEC_MEM_STACK_F(fmt,t,size,arg) + * UNW_DEC_MEM_STACK_V(fmt,t,arg) + * UNW_DEC_PRIUNAT_GR(fmt,r,arg) + * UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) + * UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) + * UNW_DEC_PRIUNAT_WHEN_PSPREL(fmt,pspoff,arg) + * UNW_DEC_PRIUNAT_WHEN_SPREL(fmt,spoff,arg) + * UNW_DEC_PROLOGUE(fmt,body,rlen,arg) + * UNW_DEC_PROLOGUE_GR(fmt,rlen,mask,grsave,arg) + * UNW_DEC_REG_PSPREL(fmt,reg,pspoff,arg) + * UNW_DEC_REG_REG(fmt,src,dst,arg) + * UNW_DEC_REG_SPREL(fmt,reg,spoff,arg) + * UNW_DEC_REG_WHEN(fmt,reg,t,arg) + * UNW_DEC_RESTORE(fmt,t,abreg,arg) + * UNW_DEC_RESTORE_P(fmt,qp,t,abreg,arg) + * UNW_DEC_SPILL_BASE(fmt,pspoff,arg) + * UNW_DEC_SPILL_MASK(fmt,imaskp,arg) + * UNW_DEC_SPILL_PSPREL(fmt,t,abreg,pspoff,arg) + * UNW_DEC_SPILL_PSPREL_P(fmt,qp,t,abreg,pspoff,arg) + * UNW_DEC_SPILL_REG(fmt,t,abreg,x,ytreg,arg) + * UNW_DEC_SPILL_REG_P(fmt,qp,t,abreg,x,ytreg,arg) + * UNW_DEC_SPILL_SPREL(fmt,t,abreg,spoff,arg) + * UNW_DEC_SPILL_SPREL_P(fmt,qp,t,abreg,pspoff,arg) + */ + +static unw_word +unw_decode_uleb128 (unsigned char **dpp) +{ + unsigned shift = 0; + unw_word byte, result = 0; + unsigned char *bp = *dpp; + + while (1) + { + byte = *bp++; + result |= (byte & 0x7f) << shift; + if ((byte & 0x80) == 0) + break; + shift += 7; + } + *dpp = bp; + return result; +} + +static unsigned char * +unw_decode_x1 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char byte1, abreg; + unw_word t, off; + + byte1 = *dp++; + t = unw_decode_uleb128 (&dp); + off = unw_decode_uleb128 (&dp); + abreg = (byte1 & 0x7f); + if (byte1 & 0x80) + UNW_DEC_SPILL_SPREL(X1, t, abreg, off, arg); + else + UNW_DEC_SPILL_PSPREL(X1, t, abreg, off, arg); + return dp; +} + +static unsigned char * +unw_decode_x2 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char byte1, byte2, abreg, x, ytreg; + unw_word t; + + byte1 = *dp++; byte2 = *dp++; + t = unw_decode_uleb128 (&dp); + abreg = (byte1 & 0x7f); + ytreg = byte2; + x = (byte1 >> 7) & 1; + if ((byte1 & 0x80) == 0 && ytreg == 0) + UNW_DEC_RESTORE(X2, t, abreg, arg); + else + UNW_DEC_SPILL_REG(X2, t, abreg, x, ytreg, arg); + return dp; +} + +static unsigned char * +unw_decode_x3 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char byte1, byte2, abreg, qp; + unw_word t, off; + + byte1 = *dp++; byte2 = *dp++; + t = unw_decode_uleb128 (&dp); + off = unw_decode_uleb128 (&dp); + + qp = (byte1 & 0x3f); + abreg = (byte2 & 0x7f); + + if (byte1 & 0x80) + UNW_DEC_SPILL_SPREL_P(X3, qp, t, abreg, off, arg); + else + UNW_DEC_SPILL_PSPREL_P(X3, qp, t, abreg, off, arg); + return dp; +} + +static unsigned char * +unw_decode_x4 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char byte1, byte2, byte3, qp, abreg, x, ytreg; + unw_word t; + + byte1 = *dp++; byte2 = *dp++; byte3 = *dp++; + t = unw_decode_uleb128 (&dp); + + qp = (byte1 & 0x3f); + abreg = (byte2 & 0x7f); + x = (byte2 >> 7) & 1; + ytreg = byte3; + + if ((byte2 & 0x80) == 0 && byte3 == 0) + UNW_DEC_RESTORE_P(X4, qp, t, abreg, arg); + else + UNW_DEC_SPILL_REG_P(X4, qp, t, abreg, x, ytreg, arg); + return dp; +} + +static inline unsigned char * +unw_decode_r1 (unsigned char *dp, unsigned char code, void *arg) +{ + int body = (code & 0x20) != 0; + unw_word rlen; + + rlen = (code & 0x1f); + UNW_DEC_PROLOGUE(R1, body, rlen, arg); + return dp; +} + +static inline unsigned char * +unw_decode_r2 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char byte1, mask, grsave; + unw_word rlen; + + byte1 = *dp++; + + mask = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); + grsave = (byte1 & 0x7f); + rlen = unw_decode_uleb128 (&dp); + UNW_DEC_PROLOGUE_GR(R2, rlen, mask, grsave, arg); + return dp; +} + +static inline unsigned char * +unw_decode_r3 (unsigned char *dp, unsigned char code, void *arg) +{ + unw_word rlen; + + rlen = unw_decode_uleb128 (&dp); + UNW_DEC_PROLOGUE(R3, ((code & 0x3) == 1), rlen, arg); + return dp; +} + +static inline unsigned char * +unw_decode_p1 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char brmask = (code & 0x1f); + + UNW_DEC_BR_MEM(P1, brmask, arg); + return dp; +} + +static inline unsigned char * +unw_decode_p2_p5 (unsigned char *dp, unsigned char code, void *arg) +{ + if ((code & 0x10) == 0) + { + unsigned char byte1 = *dp++; + + UNW_DEC_BR_GR(P2, ((code & 0xf) << 1) | ((byte1 >> 7) & 1), + (byte1 & 0x7f), arg); + } + else if ((code & 0x08) == 0) + { + unsigned char byte1 = *dp++, r, dst; + + r = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); + dst = (byte1 & 0x7f); + switch (r) + { + case 0: UNW_DEC_REG_GR(P3, UNW_REG_PSP, dst, arg); break; + case 1: UNW_DEC_REG_GR(P3, UNW_REG_RP, dst, arg); break; + case 2: UNW_DEC_REG_GR(P3, UNW_REG_PFS, dst, arg); break; + case 3: UNW_DEC_REG_GR(P3, UNW_REG_PR, dst, arg); break; + case 4: UNW_DEC_REG_GR(P3, UNW_REG_UNAT, dst, arg); break; + case 5: UNW_DEC_REG_GR(P3, UNW_REG_LC, dst, arg); break; + case 6: UNW_DEC_RP_BR(P3, dst, arg); break; + case 7: UNW_DEC_REG_GR(P3, UNW_REG_RNAT, dst, arg); break; + case 8: UNW_DEC_REG_GR(P3, UNW_REG_BSP, dst, arg); break; + case 9: UNW_DEC_REG_GR(P3, UNW_REG_BSPSTORE, dst, arg); break; + case 10: UNW_DEC_REG_GR(P3, UNW_REG_FPSR, dst, arg); break; + case 11: UNW_DEC_PRIUNAT_GR(P3, dst, arg); break; + default: UNW_DEC_BAD_CODE(r); break; + } + } + else if ((code & 0x7) == 0) + UNW_DEC_SPILL_MASK(P4, dp, arg); + else if ((code & 0x7) == 1) + { + unw_word grmask, frmask, byte1, byte2, byte3; + + byte1 = *dp++; byte2 = *dp++; byte3 = *dp++; + grmask = ((byte1 >> 4) & 0xf); + frmask = ((byte1 & 0xf) << 16) | (byte2 << 8) | byte3; + UNW_DEC_FRGR_MEM(P5, grmask, frmask, arg); + } + else + UNW_DEC_BAD_CODE(code); + return dp; +} + +static inline unsigned char * +unw_decode_p6 (unsigned char *dp, unsigned char code, void *arg) +{ + int gregs = (code & 0x10) != 0; + unsigned char mask = (code & 0x0f); + + if (gregs) + UNW_DEC_GR_MEM(P6, mask, arg); + else + UNW_DEC_FR_MEM(P6, mask, arg); + return dp; +} + +static inline unsigned char * +unw_decode_p7_p10 (unsigned char *dp, unsigned char code, void *arg) +{ + unsigned char r, byte1, byte2; + unw_word t, size; + + if ((code & 0x10) == 0) + { + r = (code & 0xf); + t = unw_decode_uleb128 (&dp); + switch (r) + { + case 0: + size = unw_decode_uleb128 (&dp); + UNW_DEC_MEM_STACK_F(P7, t, size, arg); + break; + + case 1: UNW_DEC_MEM_STACK_V(P7, t, arg); break; + case 2: UNW_DEC_SPILL_BASE(P7, t, arg); break; + case 3: UNW_DEC_REG_SPREL(P7, UNW_REG_PSP, t, arg); break; + case 4: UNW_DEC_REG_WHEN(P7, UNW_REG_RP, t, arg); break; + case 5: UNW_DEC_REG_PSPREL(P7, UNW_REG_RP, t, arg); break; + case 6: UNW_DEC_REG_WHEN(P7, UNW_REG_PFS, t, arg); break; + case 7: UNW_DEC_REG_PSPREL(P7, UNW_REG_PFS, t, arg); break; + case 8: UNW_DEC_REG_WHEN(P7, UNW_REG_PR, t, arg); break; + case 9: UNW_DEC_REG_PSPREL(P7, UNW_REG_PR, t, arg); break; + case 10: UNW_DEC_REG_WHEN(P7, UNW_REG_LC, t, arg); break; + case 11: UNW_DEC_REG_PSPREL(P7, UNW_REG_LC, t, arg); break; + case 12: UNW_DEC_REG_WHEN(P7, UNW_REG_UNAT, t, arg); break; + case 13: UNW_DEC_REG_PSPREL(P7, UNW_REG_UNAT, t, arg); break; + case 14: UNW_DEC_REG_WHEN(P7, UNW_REG_FPSR, t, arg); break; + case 15: UNW_DEC_REG_PSPREL(P7, UNW_REG_FPSR, t, arg); break; + default: UNW_DEC_BAD_CODE(r); break; + } + } + else + { + switch (code & 0xf) + { + case 0x0: /* p8 */ + { + r = *dp++; + t = unw_decode_uleb128 (&dp); + switch (r) + { + case 1: UNW_DEC_REG_SPREL(P8, UNW_REG_RP, t, arg); break; + case 2: UNW_DEC_REG_SPREL(P8, UNW_REG_PFS, t, arg); break; + case 3: UNW_DEC_REG_SPREL(P8, UNW_REG_PR, t, arg); break; + case 4: UNW_DEC_REG_SPREL(P8, UNW_REG_LC, t, arg); break; + case 5: UNW_DEC_REG_SPREL(P8, UNW_REG_UNAT, t, arg); break; + case 6: UNW_DEC_REG_SPREL(P8, UNW_REG_FPSR, t, arg); break; + case 7: UNW_DEC_REG_WHEN(P8, UNW_REG_BSP, t, arg); break; + case 8: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSP, t, arg); break; + case 9: UNW_DEC_REG_SPREL(P8, UNW_REG_BSP, t, arg); break; + case 10: UNW_DEC_REG_WHEN(P8, UNW_REG_BSPSTORE, t, arg); break; + case 11: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSPSTORE, t, arg); break; + case 12: UNW_DEC_REG_SPREL(P8, UNW_REG_BSPSTORE, t, arg); break; + case 13: UNW_DEC_REG_WHEN(P8, UNW_REG_RNAT, t, arg); break; + case 14: UNW_DEC_REG_PSPREL(P8, UNW_REG_RNAT, t, arg); break; + case 15: UNW_DEC_REG_SPREL(P8, UNW_REG_RNAT, t, arg); break; + case 16: UNW_DEC_PRIUNAT_WHEN_GR(P8, t, arg); break; + case 17: UNW_DEC_PRIUNAT_PSPREL(P8, t, arg); break; + case 18: UNW_DEC_PRIUNAT_SPREL(P8, t, arg); break; + case 19: UNW_DEC_PRIUNAT_WHEN_MEM(P8, t, arg); break; + default: UNW_DEC_BAD_CODE(r); break; + } + } + break; + + case 0x1: + byte1 = *dp++; byte2 = *dp++; + UNW_DEC_GR_GR(P9, (byte1 & 0xf), (byte2 & 0x7f), arg); + break; + + case 0xf: /* p10 */ + byte1 = *dp++; byte2 = *dp++; + UNW_DEC_ABI(P10, byte1, byte2, arg); + break; + + case 0x9: + return unw_decode_x1 (dp, code, arg); + + case 0xa: + return unw_decode_x2 (dp, code, arg); + + case 0xb: + return unw_decode_x3 (dp, code, arg); + + case 0xc: + return unw_decode_x4 (dp, code, arg); + + default: + UNW_DEC_BAD_CODE(code); + break; + } + } + return dp; +} + +static inline unsigned char * +unw_decode_b1 (unsigned char *dp, unsigned char code, void *arg) +{ + unw_word label = (code & 0x1f); + + if ((code & 0x20) != 0) + UNW_DEC_COPY_STATE(B1, label, arg); + else + UNW_DEC_LABEL_STATE(B1, label, arg); + return dp; +} + +static inline unsigned char * +unw_decode_b2 (unsigned char *dp, unsigned char code, void *arg) +{ + unw_word t; + + t = unw_decode_uleb128 (&dp); + UNW_DEC_EPILOGUE(B2, t, (code & 0x1f), arg); + return dp; +} + +static inline unsigned char * +unw_decode_b3_x4 (unsigned char *dp, unsigned char code, void *arg) +{ + unw_word t, ecount, label; + + if ((code & 0x10) == 0) + { + t = unw_decode_uleb128 (&dp); + ecount = unw_decode_uleb128 (&dp); + UNW_DEC_EPILOGUE(B3, t, ecount, arg); + } + else if ((code & 0x07) == 0) + { + label = unw_decode_uleb128 (&dp); + if ((code & 0x08) != 0) + UNW_DEC_COPY_STATE(B4, label, arg); + else + UNW_DEC_LABEL_STATE(B4, label, arg); + } + else + switch (code & 0x7) + { + case 1: return unw_decode_x1 (dp, code, arg); + case 2: return unw_decode_x2 (dp, code, arg); + case 3: return unw_decode_x3 (dp, code, arg); + case 4: return unw_decode_x4 (dp, code, arg); + default: UNW_DEC_BAD_CODE(code); break; + } + return dp; +} + +typedef unsigned char *(*unw_decoder) (unsigned char *, unsigned char, void *); + +/* + * Decode one descriptor and return address of next descriptor. + */ +static inline unsigned char * +unw_decode (unsigned char *dp, int inside_body, void *arg) +{ + unsigned char code, primary; + + code = *dp++; + primary = code >> 5; + + if (primary < 2) + dp = unw_decode_r1 (dp, code, arg); + else if (primary == 2) + dp = unw_decode_r2 (dp, code, arg); + else if (primary == 3) + dp = unw_decode_r3 (dp, code, arg); + else if (inside_body) + switch (primary) + { + case 4: + case 5: dp = unw_decode_b1 (dp, code, arg); break; + case 6: dp = unw_decode_b2 (dp, code, arg); break; + case 7: dp = unw_decode_b3_x4 (dp, code, arg); break; + } + else + switch (primary) + { + case 4: dp = unw_decode_p1 (dp, code, arg); break; + case 5: dp = unw_decode_p2_p5 (dp, code, arg); break; + case 6: dp = unw_decode_p6 (dp, code, arg); break; + case 7: dp = unw_decode_p7_p10 (dp, code, arg); break; + } + return dp; +} diff --git a/sdk/cpprt/linux/libunwind/src/ia64/unwind_i.h b/sdk/cpprt/linux/libunwind/src/ia64/unwind_i.h new file mode 100644 index 0000000000..4643975227 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ia64/unwind_i.h @@ -0,0 +1,633 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include "rse.h" + +#include "libunwind_i.h" + +#define IA64_UNW_VER(x) ((x) >> 48) +#define IA64_UNW_FLAG_MASK ((unw_word_t) 0x0000ffff00000000ULL) +#define IA64_UNW_FLAG_OSMASK ((unw_word_t) 0x0000f00000000000ULL) +#define IA64_UNW_FLAG_EHANDLER(x) ((x) & (unw_word_t) 0x0000000100000000ULL) +#define IA64_UNW_FLAG_UHANDLER(x) ((x) & (unw_word_t) 0x0000000200000000ULL) +#define IA64_UNW_LENGTH(x) ((x) & (unw_word_t) 0x00000000ffffffffULL) + +#ifdef MIN +# undef MIN +#endif +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + +#if !defined(HAVE_SYS_UC_ACCESS_H) && !defined(UNW_REMOTE_ONLY) + +static ALWAYS_INLINE void * +inlined_uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr) +{ + unw_word_t reg_addr; + void *addr; + + switch (reg) + { + case UNW_IA64_GR + 0: addr = &unw.read_only.r0; break; + case UNW_IA64_NAT + 0: addr = &unw.read_only.r0; break; + case UNW_IA64_FR + 0: addr = &unw.read_only.f0; break; + case UNW_IA64_FR + 1: + if (__BYTE_ORDER == __BIG_ENDIAN) + addr = &unw.read_only.f1_be; + else + addr = &unw.read_only.f1_le; + break; + case UNW_IA64_IP: addr = &uc->uc_mcontext.sc_br[0]; break; + case UNW_IA64_CFM: addr = &uc->uc_mcontext.sc_ar_pfs; break; + case UNW_IA64_AR_RNAT: addr = &uc->uc_mcontext.sc_ar_rnat; break; + case UNW_IA64_AR_UNAT: addr = &uc->uc_mcontext.sc_ar_unat; break; + case UNW_IA64_AR_LC: addr = &uc->uc_mcontext.sc_ar_lc; break; + case UNW_IA64_AR_FPSR: addr = &uc->uc_mcontext.sc_ar_fpsr; break; + case UNW_IA64_PR: addr = &uc->uc_mcontext.sc_pr; break; + case UNW_IA64_AR_BSPSTORE: addr = &uc->uc_mcontext.sc_ar_bsp; break; + + case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7: + case UNW_IA64_GR + 12: + addr = &uc->uc_mcontext.sc_gr[reg - UNW_IA64_GR]; + break; + + case UNW_IA64_NAT + 4 ... UNW_IA64_NAT + 7: + case UNW_IA64_NAT + 12: + addr = &uc->uc_mcontext.sc_nat; + reg_addr = (unw_word_t) &uc->uc_mcontext.sc_gr[reg - UNW_IA64_NAT]; + *nat_bitnr = reg - UNW_IA64_NAT; + break; + + case UNW_IA64_BR + 1 ... UNW_IA64_BR + 5: + addr = &uc->uc_mcontext.sc_br[reg - UNW_IA64_BR]; + break; + + case UNW_IA64_FR+ 2 ... UNW_IA64_FR+ 5: + case UNW_IA64_FR+16 ... UNW_IA64_FR+31: + addr = &uc->uc_mcontext.sc_fr[reg - UNW_IA64_FR]; + break; + + default: + addr = NULL; + } + return addr; +} + +static inline void * +uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr) +{ + if (__builtin_constant_p (reg)) + return inlined_uc_addr (uc, reg, nat_bitnr); + else + return tdep_uc_addr (uc, reg, nat_bitnr); +} + +/* Return TRUE if ADDR points inside unw.read_only_reg. */ + +static inline long +ia64_read_only_reg (void *addr) +{ + return ((unsigned long) ((char *) addr - (char *) &unw.read_only) + < sizeof (unw.read_only)); +} + +#endif /* !defined(HAVE_SYS_UC_ACCESS_H) && !defined(UNW_REMOTE_ONLY) */ + +/* Bits 0 and 1 of a location are used to encode its type: + bit 0: set if location uses floating-point format. + bit 1: set if location is a NaT bit on memory stack. */ + +#define IA64_LOC_TYPE_FP (1 << 0) +#define IA64_LOC_TYPE_MEMSTK_NAT (1 << 1) + +#ifdef UNW_LOCAL_ONLY +#define IA64_LOC_REG(r,t) (((r) << 2) | (t)) +#define IA64_LOC_ADDR(a,t) (((a) & ~0x3) | (t)) +#define IA64_LOC_UC_ADDR(a,t) IA64_LOC_ADDR(a, t) +#define IA64_NULL_LOC (0) + +#define IA64_GET_REG(l) ((l) >> 2) +#define IA64_GET_ADDR(l) ((l) & ~0x3) +#define IA64_IS_NULL_LOC(l) ((l) == 0) +#define IA64_IS_FP_LOC(l) (((l) & IA64_LOC_TYPE_FP) != 0) +#define IA64_IS_MEMSTK_NAT(l) (((l) & IA64_LOC_TYPE_MEMSTK_NAT) != 0) +#define IA64_IS_REG_LOC(l) 0 +#define IA64_IS_UC_LOC(l) 0 + +#define IA64_REG_LOC(c,r) ((unw_word_t) uc_addr((c)->as_arg, r, NULL)) +#define IA64_REG_NAT_LOC(c,r,n) ((unw_word_t) uc_addr((c)->as_arg, r, n)) +#define IA64_FPREG_LOC(c,r) \ + ((unw_word_t) uc_addr((c)->as_arg, (r), NULL) | IA64_LOC_TYPE_FP) + +# define ia64_find_proc_info(c,ip,n) \ + tdep_find_proc_info(unw_local_addr_space, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define ia64_put_unwind_info(c, pi) do { ; } while (0) + +/* Note: the register accessors (ia64_{get,set}{,fp}()) must check for + NULL locations because uc_addr() returns NULL for unsaved + registers. */ + +static inline int +ia64_getfp (struct cursor *c, unw_word_t loc, unw_fpreg_t *val) +{ + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + *val = *(unw_fpreg_t *) IA64_GET_ADDR (loc); + return 0; +} + +static inline int +ia64_putfp (struct cursor *c, unw_word_t loc, unw_fpreg_t val) +{ + unw_fpreg_t *addr = (unw_fpreg_t *) IA64_GET_ADDR (loc); + + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + else if (ia64_read_only_reg (addr)) + { + Debug (16, "attempt to read-only register\n"); + return -UNW_EREADONLYREG; + } + *addr = val; + return 0; +} + +static inline int +ia64_get (struct cursor *c, unw_word_t loc, unw_word_t *val) +{ + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + *val = *(unw_word_t *) IA64_GET_ADDR (loc); + return 0; +} + +static inline int +ia64_put (struct cursor *c, unw_word_t loc, unw_word_t val) +{ + unw_word_t *addr = (unw_word_t *) IA64_GET_ADDR (loc); + + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + else if (ia64_read_only_reg (addr)) + { + Debug (16, "attempt to read-only register\n"); + return -UNW_EREADONLYREG; + } + *addr = val; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ + +/* Bits 0 and 1 of the second word (w1) of a location are used + to further distinguish what location we're dealing with: + + bit 0: set if the location is a register + bit 1: set of the location is accessed via uc_access(3) */ +#define IA64_LOC_TYPE_REG (1 << 0) +#define IA64_LOC_TYPE_UC (1 << 1) + +#define IA64_LOC_REG(r,t) ((ia64_loc_t) { ((r) << 2) | (t), \ + IA64_LOC_TYPE_REG }) +#define IA64_LOC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), 0 }) +#define IA64_LOC_UC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), \ + IA64_LOC_TYPE_UC }) +#define IA64_LOC_UC_REG(r,a) ((ia64_loc_t) { ((r) << 2), \ + ((a) | IA64_LOC_TYPE_REG \ + | IA64_LOC_TYPE_UC) }) +#define IA64_NULL_LOC ((ia64_loc_t) { 0, 0 }) + +#define IA64_GET_REG(l) ((l).w0 >> 2) +#define IA64_GET_ADDR(l) ((l).w0 & ~0x3) +#define IA64_GET_AUX_ADDR(l) ((l).w1 & ~0x3) +#define IA64_IS_NULL_LOC(l) (((l).w0 | (l).w1) == 0) +#define IA64_IS_FP_LOC(l) (((l).w0 & IA64_LOC_TYPE_FP) != 0) +#define IA64_IS_MEMSTK_NAT(l) (((l).w0 & IA64_LOC_TYPE_MEMSTK_NAT) != 0) +#define IA64_IS_REG_LOC(l) (((l).w1 & IA64_LOC_TYPE_REG) != 0) +#define IA64_IS_UC_LOC(l) (((l).w1 & IA64_LOC_TYPE_UC) != 0) + +#define IA64_REG_LOC(c,r) IA64_LOC_REG ((r), 0) +#define IA64_REG_NAT_LOC(c,r,n) IA64_LOC_REG ((r), 0) +#define IA64_FPREG_LOC(c,r) IA64_LOC_REG ((r), IA64_LOC_TYPE_FP) + +# define ia64_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define ia64_put_unwind_info(c,pi) \ + (*(c)->as->acc.put_unwind_info)((c)->as, (pi), (c)->as_arg) + +#define ia64_uc_access_reg UNW_OBJ(uc_access_reg) +#define ia64_uc_access_fpreg UNW_OBJ(uc_access_fpreg) + +extern int ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, + unw_word_t *valp, int write); +extern int ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, + unw_fpreg_t *valp, int write); + +static inline int +ia64_getfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *val) +{ + unw_word_t addr; + int ret; + + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + + if (IA64_IS_UC_LOC (loc)) + return ia64_uc_access_fpreg (c, loc, val, 0); + + if (IA64_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, IA64_GET_REG (loc), + val, 0, c->as_arg); + + addr = IA64_GET_ADDR (loc); + ret = (*c->as->acc.access_mem) (c->as, addr + 0, &val->raw.bits[0], 0, + c->as_arg); + if (ret < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 8, &val->raw.bits[1], 0, + c->as_arg); +} + +static inline int +ia64_putfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t val) +{ + unw_word_t addr; + int ret; + + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + + if (IA64_IS_UC_LOC (loc)) + return ia64_uc_access_fpreg (c, loc, &val, 1); + + if (IA64_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, IA64_GET_REG (loc), &val, 1, + c->as_arg); + + addr = IA64_GET_ADDR (loc); + ret = (*c->as->acc.access_mem) (c->as, addr + 0, &val.raw.bits[0], 1, + c->as_arg); + if (ret < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 8, &val.raw.bits[1], 1, + c->as_arg); +} + +/* Get the 64 data bits from location LOC. If bit 0 is cleared, LOC + is a memory address, otherwise it is a register number. If the + register is a floating-point register, the 64 bits are read from + the significand bits. */ + +static inline int +ia64_get (struct cursor *c, ia64_loc_t loc, unw_word_t *val) +{ + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + + if (IA64_IS_FP_LOC (loc)) + { + unw_fpreg_t tmp; + int ret; + + ret = ia64_getfp (c, loc, &tmp); + if (ret < 0) + return ret; + + if (c->as->big_endian) + *val = tmp.raw.bits[1]; + else + *val = tmp.raw.bits[0]; + return 0; + } + + if (IA64_IS_UC_LOC (loc)) + return ia64_uc_access_reg (c, loc, val, 0); + + if (IA64_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg)(c->as, IA64_GET_REG (loc), val, 0, + c->as_arg); + else + return (*c->as->acc.access_mem)(c->as, IA64_GET_ADDR (loc), val, 0, + c->as_arg); +} + +static inline int +ia64_put (struct cursor *c, ia64_loc_t loc, unw_word_t val) +{ + if (IA64_IS_NULL_LOC (loc)) + { + Debug (16, "access to unsaved register\n"); + return -UNW_EBADREG; + } + + if (IA64_IS_FP_LOC (loc)) + { + unw_fpreg_t tmp; + + memset (&tmp, 0, sizeof (tmp)); + if (c->as->big_endian) + tmp.raw.bits[1] = val; + else + tmp.raw.bits[0] = val; + return ia64_putfp (c, loc, tmp); + } + + if (IA64_IS_UC_LOC (loc)) + return ia64_uc_access_reg (c, loc, &val, 1); + + if (IA64_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg)(c->as, IA64_GET_REG (loc), &val, 1, + c->as_arg); + else + return (*c->as->acc.access_mem)(c->as, IA64_GET_ADDR (loc), &val, 1, + c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +struct ia64_unwind_block + { + unw_word_t header; + unw_word_t desc[0]; /* unwind descriptors */ + + /* Personality routine and language-specific data follow behind + descriptors. */ + }; + +enum ia64_where + { + IA64_WHERE_NONE, /* register isn't saved at all */ + IA64_WHERE_GR, /* register is saved in a general register */ + IA64_WHERE_FR, /* register is saved in a floating-point register */ + IA64_WHERE_BR, /* register is saved in a branch register */ + IA64_WHERE_SPREL, /* register is saved on memstack (sp-relative) */ + IA64_WHERE_PSPREL, /* register is saved on memstack (psp-relative) */ + + /* At the end of each prologue these locations get resolved to + IA64_WHERE_PSPREL and IA64_WHERE_GR, respectively: */ + + IA64_WHERE_SPILL_HOME, /* register is saved in its spill home */ + IA64_WHERE_GR_SAVE /* register is saved in next general register */ + }; + +#define IA64_WHEN_NEVER 0x7fffffff + +struct ia64_reg_info + { + unw_word_t val; /* save location: register number or offset */ + enum ia64_where where; /* where the register gets saved */ + int when; /* when the register gets saved */ + }; + +struct ia64_labeled_state; /* opaque structure */ + +struct ia64_reg_state + { + struct ia64_reg_state *next; /* next (outer) element on state stack */ + struct ia64_reg_info reg[IA64_NUM_PREGS]; /* register save locations */ + }; + +struct ia64_state_record + { + unsigned int first_region : 1; /* is this the first region? */ + unsigned int done : 1; /* are we done scanning descriptors? */ + unsigned int any_spills : 1; /* got any register spills? */ + unsigned int in_body : 1; /* are we inside prologue or body? */ + uint8_t *imask; /* imask of spill_mask record or NULL */ + uint16_t abi_marker; + + unw_word_t pr_val; /* predicate values */ + unw_word_t pr_mask; /* predicate mask */ + + long spill_offset; /* psp-relative offset for spill base */ + int region_start; + int region_len; + int when_sp_restored; + int epilogue_count; + int when_target; + + uint8_t gr_save_loc; /* next save register */ + uint8_t return_link_reg; /* branch register used as return pointer */ + + struct ia64_labeled_state *labeled_states; + struct ia64_reg_state curr; + }; + +struct ia64_labeled_state + { + struct ia64_labeled_state *next; /* next label (or NULL) */ + unsigned long label; /* label for this state */ + struct ia64_reg_state saved_state; + }; + +/* Convenience macros: */ +#define ia64_make_proc_info UNW_OBJ(make_proc_info) +#define ia64_fetch_proc_info UNW_OBJ(fetch_proc_info) +#define ia64_create_state_record UNW_OBJ(create_state_record) +#define ia64_free_state_record UNW_OBJ(free_state_record) +#define ia64_find_save_locs UNW_OBJ(find_save_locs) +#define ia64_validate_cache UNW_OBJ(ia64_validate_cache) +#define ia64_local_validate_cache UNW_OBJ(ia64_local_validate_cache) +#define ia64_per_thread_cache UNW_OBJ(per_thread_cache) +#define ia64_scratch_loc UNW_OBJ(scratch_loc) +#define ia64_local_resume UNW_OBJ(local_resume) +#define ia64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define ia64_strloc UNW_OBJ(strloc) +#define ia64_install_cursor UNW_OBJ(install_cursor) +#define rbs_switch UNW_OBJ(rbs_switch) +#define rbs_find_stacked UNW_OBJ(rbs_find_stacked) + +extern int ia64_make_proc_info (struct cursor *c); +extern int ia64_fetch_proc_info (struct cursor *c, unw_word_t ip, + int need_unwind_info); +/* The proc-info must be valid for IP before this routine can be + called: */ +extern int ia64_create_state_record (struct cursor *c, + struct ia64_state_record *sr); +extern int ia64_free_state_record (struct ia64_state_record *sr); +extern int ia64_find_save_locs (struct cursor *c); +extern void ia64_validate_cache (unw_addr_space_t as, void *arg); +extern int ia64_local_validate_cache (unw_addr_space_t as, void *arg); +extern void ia64_local_addr_space_init (void); +extern ia64_loc_t ia64_scratch_loc (struct cursor *c, unw_regnum_t reg, + uint8_t *nat_bitnr); + +extern NORETURN void ia64_install_cursor (struct cursor *c, + unw_word_t pri_unat, + unw_word_t *extra, + unw_word_t bspstore, + unw_word_t dirty_size, + unw_word_t *dirty_partition, + unw_word_t dirty_rnat); +extern int ia64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); +extern int rbs_switch (struct cursor *c, + unw_word_t saved_bsp, unw_word_t saved_bspstore, + ia64_loc_t saved_rnat_loc); +extern int rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, + ia64_loc_t *locp, ia64_loc_t *rnat_locp); + +#ifndef UNW_REMOTE_ONLY +# define NEED_RBS_COVER_AND_FLUSH +# define rbs_cover_and_flush UNW_OBJ(rbs_cover_and_flush) + extern int rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, + unw_word_t *dirty_partition, + unw_word_t *dirty_rnat, + unw_word_t *bspstore); +#endif + +/* Warning: ia64_strloc() is for debugging only and it is NOT re-entrant! */ +extern const char *ia64_strloc (ia64_loc_t loc); + +/* Return true if the register-backing store is inside a ucontext_t + that needs to be accessed via uc_access(3). */ + +static inline int +rbs_on_uc (struct rbs_area *rbs) +{ + return IA64_IS_UC_LOC (rbs->rnat_loc) && !IA64_IS_REG_LOC (rbs->rnat_loc); +} + +/* Return true if BSP points to a word that's stored on register + backing-store RBS. */ +static inline int +rbs_contains (struct rbs_area *rbs, unw_word_t bsp) +{ + int result; + + /* Caveat: this takes advantage of unsigned arithmetic. The full + test is (bsp >= rbs->end - rbs->size) && (bsp < rbs->end). We + take advantage of the fact that -n == ~n + 1. */ + result = bsp - rbs->end > ~rbs->size; + Debug (16, "0x%lx in [0x%lx-0x%lx) => %d\n", + (long) bsp, (long) (rbs->end - rbs->size), (long) rbs->end, result); + return result; +} + +static inline ia64_loc_t +rbs_get_rnat_loc (struct rbs_area *rbs, unw_word_t bsp) +{ + unw_word_t rnat_addr = rse_rnat_addr (bsp); + ia64_loc_t rnat_loc; + + if (rbs_contains (rbs, rnat_addr)) + { + if (rbs_on_uc (rbs)) + rnat_loc = IA64_LOC_UC_ADDR (rnat_addr, 0); + else + rnat_loc = IA64_LOC_ADDR (rnat_addr, 0); + } + else + rnat_loc = rbs->rnat_loc; + return rnat_loc; +} + +static inline ia64_loc_t +rbs_loc (struct rbs_area *rbs, unw_word_t bsp) +{ + if (rbs_on_uc (rbs)) + return IA64_LOC_UC_ADDR (bsp, 0); + else + return IA64_LOC_ADDR (bsp, 0); +} + +static inline int +ia64_get_stacked (struct cursor *c, unw_word_t reg, + ia64_loc_t *locp, ia64_loc_t *rnat_locp) +{ + struct rbs_area *rbs = c->rbs_area + c->rbs_curr; + unw_word_t addr, regs_to_skip = reg - 32; + int ret = 0; + + assert (reg >= 32 && reg < 128); + + addr = rse_skip_regs (c->bsp, regs_to_skip); + if (locp) + *locp = rbs_loc (rbs, addr); + if (rnat_locp) + *rnat_locp = rbs_get_rnat_loc (rbs, addr); + + if (!rbs_contains (rbs, addr)) + ret = rbs_find_stacked (c, regs_to_skip, locp, rnat_locp); + return ret; +} + +/* The UNaT slot # calculation is identical to the one for RNaT slots, + but for readability/clarity, we don't want to use + ia64_rnat_slot_num() directly. */ +#define ia64_unat_slot_num(addr) rse_slot_num(addr) + +/* The following are helper macros which makes it easier for libunwind + to be used in the kernel. They allow the kernel to optimize away + any unused code without littering everything with #ifdefs. */ +#define ia64_is_big_endian(c) ((c)->as->big_endian) +#define ia64_get_abi(c) ((c)->as->abi) +#define ia64_set_abi(c, v) ((c)->as->abi = (v)) +#define ia64_get_abi_marker(c) ((c)->last_abi_marker) + +/* XXX should be in glibc: */ +#ifndef IA64_SC_FLAG_ONSTACK +# define IA64_SC_FLAG_ONSTACK_BIT 0 /* running on signal stack? */ +# define IA64_SC_FLAG_IN_SYSCALL_BIT 1 /* did signal interrupt a syscall? */ +# define IA64_SC_FLAG_FPH_VALID_BIT 2 /* is state in f[32]-f[127] valid? */ + +# define IA64_SC_FLAG_ONSTACK (1 << IA64_SC_FLAG_ONSTACK_BIT) +# define IA64_SC_FLAG_IN_SYSCALL (1 << IA64_SC_FLAG_IN_SYSCALL_BIT) +# define IA64_SC_FLAG_FPH_VALID (1 << IA64_SC_FLAG_FPH_VALID_BIT) +#endif + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gdestroy_addr_space.c b/sdk/cpprt/linux/libunwind/src/mi/Gdestroy_addr_space.c new file mode 100644 index 0000000000..83a01b9204 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gdestroy_addr_space.c @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED void +unw_destroy_addr_space (unw_addr_space_t as) +{ +#ifndef UNW_LOCAL_ONLY +# if UNW_DEBUG + memset (as, 0, sizeof (*as)); +# endif + free (as); +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gdyn-extract.c b/sdk/cpprt/linux/libunwind/src/mi/Gdyn-extract.c new file mode 100644 index 0000000000..5258839f28 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gdyn-extract.c @@ -0,0 +1,62 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +HIDDEN int +unwi_extract_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, unw_dyn_info_t *di, + int need_unwind_info, void *arg) +{ + pi->start_ip = di->start_ip; + pi->end_ip = di->end_ip; + pi->gp = di->gp; + pi->format = di->format; + switch (di->format) + { + case UNW_INFO_FORMAT_DYNAMIC: + pi->handler = di->u.pi.handler; + pi->lsda = 0; + pi->flags = di->u.pi.flags; + pi->unwind_info_size = 0; + if (need_unwind_info) + pi->unwind_info = di; + else + pi->unwind_info = NULL; + return 0; + + case UNW_INFO_FORMAT_TABLE: + case UNW_INFO_FORMAT_REMOTE_TABLE: +#ifdef tdep_search_unwind_table + /* call platform-specific search routine: */ + return tdep_search_unwind_table (as, ip, di, pi, need_unwind_info, arg); +#else + /* fall through */ +#endif + default: + break; + } + return -UNW_EINVAL; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gdyn-remote.c b/sdk/cpprt/linux/libunwind/src/mi/Gdyn-remote.c new file mode 100644 index 0000000000..2bb5474557 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gdyn-remote.c @@ -0,0 +1,330 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "libunwind_i.h" +#include "remote.h" + +static void +free_regions (unw_dyn_region_info_t *region) +{ + if (region->next) + free_regions (region->next); + free (region); +} + +static int +intern_op (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, + unw_dyn_op_t *op, void *arg) +{ + int ret; + + if ((ret = fetch8 (as, a, addr, &op->tag, arg)) < 0 + || (ret = fetch8 (as, a, addr, &op->qp, arg)) < 0 + || (ret = fetch16 (as, a, addr, &op->reg, arg)) < 0 + || (ret = fetch32 (as, a, addr, &op->when, arg)) < 0 + || (ret = fetchw (as, a, addr, &op->val, arg)) < 0) + return ret; + return 0; +} + +static int +intern_regions (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unw_dyn_region_info_t **regionp, void *arg) +{ + uint32_t insn_count, op_count, i; + unw_dyn_region_info_t *region; + unw_word_t next_addr; + int ret; + + *regionp = NULL; + + if (!*addr) + return 0; /* NULL region-list */ + + if ((ret = fetchw (as, a, addr, &next_addr, arg)) < 0 + || (ret = fetch32 (as, a, addr, (int32_t *) &insn_count, arg)) < 0 + || (ret = fetch32 (as, a, addr, (int32_t *) &op_count, arg)) < 0) + return ret; + + region = calloc (1, _U_dyn_region_info_size (op_count)); + if (!region) + { + ret = -UNW_ENOMEM; + goto out; + } + + region->insn_count = insn_count; + region->op_count = op_count; + for (i = 0; i < op_count; ++i) + if ((ret = intern_op (as, a, addr, region->op + i, arg)) < 0) + goto out; + + if (next_addr) + if ((ret = intern_regions (as, a, &next_addr, ®ion->next, arg)) < 0) + goto out; + + *regionp = region; + return 0; + + out: + if (region) + free_regions (region); + return ret; +} + +static int +intern_array (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unw_word_t table_len, unw_word_t **table_data, + void *arg) +{ + unw_word_t i, *data = calloc (table_len, WSIZE); + int ret = 0; + + if (!data) + { + ret = -UNW_ENOMEM; + goto out; + } + + for (i = 0; i < table_len; ++i) + if (fetchw (as, a, addr, data + i, arg) < 0) + goto out; + + *table_data = data; + return 0; + + out: + if (data) + free (data); + return ret; +} + +static void +free_dyn_info (unw_dyn_info_t *di) +{ + switch (di->format) + { + case UNW_INFO_FORMAT_DYNAMIC: + if (di->u.pi.regions) + { + free_regions (di->u.pi.regions); + di->u.pi.regions = NULL; + } + break; + + case UNW_INFO_FORMAT_TABLE: + if (di->u.ti.table_data) + { + free (di->u.ti.table_data); + di->u.ti.table_data = NULL; + } + break; + + case UNW_INFO_FORMAT_REMOTE_TABLE: + default: + break; + } +} + +static int +intern_dyn_info (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t *addr, unw_dyn_info_t *di, void *arg) +{ + unw_word_t first_region; + int ret; + + switch (di->format) + { + case UNW_INFO_FORMAT_DYNAMIC: + if ((ret = fetchw (as, a, addr, &di->u.pi.name_ptr, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.pi.handler, arg)) < 0 + || (ret = fetch32 (as, a, addr, + (int32_t *) &di->u.pi.flags, arg)) < 0) + goto out; + *addr += 4; /* skip over pad0 */ + if ((ret = fetchw (as, a, addr, &first_region, arg)) < 0 + || (ret = intern_regions (as, a, &first_region, &di->u.pi.regions, + arg)) < 0) + goto out; + break; + + case UNW_INFO_FORMAT_TABLE: + if ((ret = fetchw (as, a, addr, &di->u.ti.name_ptr, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.ti.segbase, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.ti.table_len, arg)) < 0 + || (ret = intern_array (as, a, addr, di->u.ti.table_len, + &di->u.ti.table_data, arg)) < 0) + goto out; + break; + + case UNW_INFO_FORMAT_REMOTE_TABLE: + if ((ret = fetchw (as, a, addr, &di->u.rti.name_ptr, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.rti.segbase, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.rti.table_len, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.rti.table_data, arg)) < 0) + goto out; + break; + + default: + ret = -UNW_ENOINFO; + goto out; + } + return 0; + + out: + free_dyn_info (di); + return ret; +} + +HIDDEN int +unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + unw_accessors_t *a = unw_get_accessors (as); + unw_word_t dyn_list_addr, addr, next_addr, gen1, gen2, start_ip, end_ip; + unw_dyn_info_t *di = NULL; + int ret; + + if (as->dyn_info_list_addr) + dyn_list_addr = as->dyn_info_list_addr; + else + { + if ((*a->get_dyn_info_list_addr) (as, &dyn_list_addr, arg) < 0) + return -UNW_ENOINFO; + if (as->caching_policy != UNW_CACHE_NONE) + as->dyn_info_list_addr = dyn_list_addr; + } + + do + { + addr = dyn_list_addr; + + ret = -UNW_ENOINFO; + + if (fetchw (as, a, &addr, &gen1, arg) < 0 + || fetchw (as, a, &addr, &next_addr, arg) < 0) + break; + + for (addr = next_addr; addr != 0; addr = next_addr) + { + if (fetchw (as, a, &addr, &next_addr, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ + + addr += WSIZE; /* skip over prev_addr */ + + if (fetchw (as, a, &addr, &start_ip, arg) < 0 + || fetchw (as, a, &addr, &end_ip, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ + + if (ip >= start_ip && ip < end_ip) + { + if (!di) + { + di = calloc (1, sizeof (*di)); + if (!di) + return -UNW_ENOMEM; + } + + di->start_ip = start_ip; + di->end_ip = end_ip; + + if (fetchw (as, a, &addr, &di->gp, arg) < 0 + || fetch32 (as, a, &addr, &di->format, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ + + addr += 4; /* skip over padding */ + + if (need_unwind_info + && intern_dyn_info (as, a, &addr, di, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ + + if (unwi_extract_dynamic_proc_info (as, ip, pi, di, + need_unwind_info, arg) < 0) + { + free_dyn_info (di); + goto recheck; /* only fail if generation # didn't change */ + } + ret = 0; /* OK, found it */ + break; + } + } + + /* Re-check generation number to ensure the data we have is + consistent. */ + recheck: + addr = dyn_list_addr; + if (fetchw (as, a, &addr, &gen2, arg) < 0) + break; + } + while (gen1 != gen2); + + if (ret < 0 && di) + free (di); + + return ret; +} + +HIDDEN void +unwi_dyn_remote_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, + void *arg) +{ + if (!pi->unwind_info) + return; + + free_dyn_info (pi->unwind_info); + free (pi->unwind_info); + pi->unwind_info = NULL; +} + +/* Returns 1 if the cache is up-to-date or -1 if the cache contained + stale data and had to be flushed. */ + +HIDDEN int +unwi_dyn_validate_cache (unw_addr_space_t as, void *arg) +{ + unw_word_t addr, gen; + unw_accessors_t *a; + + if (!as->dyn_info_list_addr) + /* If we don't have the dyn_info_list_addr, we don't have anything + in the cache. */ + return 0; + + a = unw_get_accessors (as); + addr = as->dyn_info_list_addr; + + if (fetchw (as, a, &addr, &gen, arg) < 0) + return 1; + + if (gen == as->dyn_generation) + return 1; + + unw_flush_cache (as, 0, 0); + as->dyn_generation = gen; + return -1; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gfind_dynamic_proc_info.c b/sdk/cpprt/linux/libunwind/src/mi/Gfind_dynamic_proc_info.c new file mode 100644 index 0000000000..6cf3b4273d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gfind_dynamic_proc_info.c @@ -0,0 +1,91 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +static inline int +local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + return -UNW_ENOINFO; +} + +#else /* !UNW_REMOTE_ONLY */ + +static inline int +local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + unw_dyn_info_list_t *list; + unw_dyn_info_t *di; + +#ifndef UNW_LOCAL_ONLY +# pragma weak _U_dyn_info_list_addr + if (!_U_dyn_info_list_addr) + return -UNW_ENOINFO; +#endif + + list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr (); + for (di = list->first; di; di = di->next) + if (ip >= di->start_ip && ip < di->end_ip) + return unwi_extract_dynamic_proc_info (as, ip, pi, di, need_unwind_info, + arg); + return -UNW_ENOINFO; +} + +#endif /* !UNW_REMOTE_ONLY */ + +#ifdef UNW_LOCAL_ONLY + +static inline int +remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + return -UNW_ENOINFO; +} + +#else /* !UNW_LOCAL_ONLY */ + +static inline int +remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + return unwi_dyn_remote_find_proc_info (as, ip, pi, need_unwind_info, arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +HIDDEN int +unwi_find_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, int need_unwind_info, + void *arg) +{ + if (as == unw_local_addr_space) + return local_find_proc_info (as, ip, pi, need_unwind_info, arg); + else + return remote_find_proc_info (as, ip, pi, need_unwind_info, arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gget_accessors.c b/sdk/cpprt/linux/libunwind/src/mi/Gget_accessors.c new file mode 100644 index 0000000000..fb256d7094 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gget_accessors.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED unw_accessors_t * +unw_get_accessors (unw_addr_space_t as) +{ + if (tdep_needs_initialization) + tdep_init (); + return &as->acc; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gget_fpreg.c b/sdk/cpprt/linux/libunwind/src/mi/Gget_fpreg.c new file mode 100644 index 0000000000..a9ae9bf6dd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gget_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_get_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t *valp) +{ + struct cursor *c = (struct cursor *) cursor; + + return tdep_access_fpreg (c, regnum, valp, 0); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gget_proc_info_by_ip.c b/sdk/cpprt/linux/libunwind/src/mi/Gget_proc_info_by_ip.c new file mode 100644 index 0000000000..4c9de7702a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gget_proc_info_by_ip.c @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_get_proc_info_by_ip (unw_addr_space_t as, unw_word_t ip, + unw_proc_info_t *pi, void *as_arg) +{ + unw_accessors_t *a = unw_get_accessors (as); + int ret; + + ret = unwi_find_dynamic_proc_info (as, ip, pi, 0, as_arg); + if (ret == -UNW_ENOINFO) + ret = (*a->find_proc_info) (as, ip, pi, 0, as_arg); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gget_proc_name.c b/sdk/cpprt/linux/libunwind/src/mi/Gget_proc_name.c new file mode 100644 index 0000000000..7251c5910d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gget_proc_name.c @@ -0,0 +1,106 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" +#include "remote.h" + +static inline int +intern_string (unw_addr_space_t as, unw_accessors_t *a, + unw_word_t addr, char *buf, size_t buf_len, void *arg) +{ + size_t i; + int ret; + + for (i = 0; i < buf_len; ++i) + { + if ((ret = fetch8 (as, a, &addr, (int8_t *) buf + i, arg)) < 0) + return ret; + + if (buf[i] == '\0') + return 0; /* copied full string; return success */ + } + buf[buf_len - 1] = '\0'; /* ensure string is NUL terminated */ + return -UNW_ENOMEM; +} + +static inline int +get_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, void *arg) +{ + unw_accessors_t *a = unw_get_accessors (as); + unw_proc_info_t pi; + int ret; + + buf[0] = '\0'; /* always return a valid string, even if it's empty */ + + ret = unwi_find_dynamic_proc_info (as, ip, &pi, 1, arg); + if (ret == 0) + { + unw_dyn_info_t *di = pi.unwind_info; + + if (offp) + *offp = ip - pi.start_ip; + + switch (di->format) + { + case UNW_INFO_FORMAT_DYNAMIC: + ret = intern_string (as, a, di->u.pi.name_ptr, buf, buf_len, arg); + break; + + case UNW_INFO_FORMAT_TABLE: + case UNW_INFO_FORMAT_REMOTE_TABLE: + /* XXX should we create a fake name, e.g.: "tablenameN", + where N is the index of the function in the table??? */ + ret = -UNW_ENOINFO; + break; + + default: + ret = -UNW_EINVAL; + break; + } + unwi_put_dynamic_unwind_info (as, &pi, arg); + return ret; + } + + if (ret != -UNW_ENOINFO) + return ret; + + /* not a dynamic procedure, try to lookup static procedure name: */ + + if (a->get_proc_name) + return (*a->get_proc_name) (as, ip, buf, buf_len, offp, arg); + + return -UNW_ENOINFO; +} + +PROTECTED int +unw_get_proc_name (unw_cursor_t *cursor, char *buf, size_t buf_len, + unw_word_t *offp) +{ + struct cursor *c = (struct cursor *) cursor; + + return get_proc_name (tdep_get_as (c), tdep_get_ip (c), buf, buf_len, offp, + tdep_get_as_arg (c)); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gget_reg.c b/sdk/cpprt/linux/libunwind/src/mi/Gget_reg.c new file mode 100644 index 0000000000..021d913e73 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gget_reg.c @@ -0,0 +1,41 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_get_reg (unw_cursor_t *cursor, int regnum, unw_word_t *valp) +{ + struct cursor *c = (struct cursor *) cursor; + + // We can get the IP value directly without needing a lookup. + if (regnum == UNW_REG_IP) + { + *valp = tdep_get_ip (c); + return 0; + } + + return tdep_access_reg (c, regnum, valp, 0); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gput_dynamic_unwind_info.c b/sdk/cpprt/linux/libunwind/src/mi/Gput_dynamic_unwind_info.c new file mode 100644 index 0000000000..13a9c1abfc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gput_dynamic_unwind_info.c @@ -0,0 +1,55 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +HIDDEN void +unwi_put_dynamic_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, + void *arg) +{ + switch (pi->format) + { + case UNW_INFO_FORMAT_DYNAMIC: +#ifndef UNW_LOCAL_ONLY +# ifdef UNW_REMOTE_ONLY + unwi_dyn_remote_put_unwind_info (as, pi, arg); +# else + if (as != unw_local_addr_space) + unwi_dyn_remote_put_unwind_info (as, pi, arg); +# endif +#endif + break; + + case UNW_INFO_FORMAT_TABLE: + case UNW_INFO_FORMAT_REMOTE_TABLE: +#ifdef tdep_put_unwind_info + tdep_put_unwind_info (as, pi, arg); + break; +#endif + /* fall through */ + default: + break; + } +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gset_caching_policy.c b/sdk/cpprt/linux/libunwind/src/mi/Gset_caching_policy.c new file mode 100644 index 0000000000..52fc7e54e2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gset_caching_policy.c @@ -0,0 +1,46 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy) +{ + if (tdep_needs_initialization) + tdep_init (); + +#ifndef HAVE___THREAD + if (policy == UNW_CACHE_PER_THREAD) + policy = UNW_CACHE_GLOBAL; +#endif + + if (policy == as->caching_policy) + return 0; /* no change */ + + as->caching_policy = policy; + /* Ensure caches are empty (and initialized). */ + unw_flush_cache (as, 0, 0); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gset_fpreg.c b/sdk/cpprt/linux/libunwind/src/mi/Gset_fpreg.c new file mode 100644 index 0000000000..d3b202de1a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gset_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_set_fpreg (unw_cursor_t *cursor, int regnum, unw_fpreg_t val) +{ + struct cursor *c = (struct cursor *) cursor; + + return tdep_access_fpreg (c, regnum, &val, 1); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Gset_reg.c b/sdk/cpprt/linux/libunwind/src/mi/Gset_reg.c new file mode 100644 index 0000000000..09fa09a39f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Gset_reg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_set_reg (unw_cursor_t *cursor, int regnum, unw_word_t valp) +{ + struct cursor *c = (struct cursor *) cursor; + + return tdep_access_reg (c, regnum, &valp, 1); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/Ldestroy_addr_space.c b/sdk/cpprt/linux/libunwind/src/mi/Ldestroy_addr_space.c new file mode 100644 index 0000000000..5bf9364bc7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Ldestroy_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gdestroy_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Ldyn-extract.c b/sdk/cpprt/linux/libunwind/src/mi/Ldyn-extract.c new file mode 100644 index 0000000000..1802f865f7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Ldyn-extract.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gdyn-extract.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Ldyn-remote.c b/sdk/cpprt/linux/libunwind/src/mi/Ldyn-remote.c new file mode 100644 index 0000000000..260722a04b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Ldyn-remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gdyn-remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lfind_dynamic_proc_info.c b/sdk/cpprt/linux/libunwind/src/mi/Lfind_dynamic_proc_info.c new file mode 100644 index 0000000000..bc88e1c53f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lfind_dynamic_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gfind_dynamic_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lget_accessors.c b/sdk/cpprt/linux/libunwind/src/mi/Lget_accessors.c new file mode 100644 index 0000000000..555e37f30d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lget_accessors.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_accessors.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lget_fpreg.c b/sdk/cpprt/linux/libunwind/src/mi/Lget_fpreg.c new file mode 100644 index 0000000000..e3be441437 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lget_fpreg.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_fpreg.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lget_proc_info_by_ip.c b/sdk/cpprt/linux/libunwind/src/mi/Lget_proc_info_by_ip.c new file mode 100644 index 0000000000..96910d83e4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lget_proc_info_by_ip.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info_by_ip.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lget_proc_name.c b/sdk/cpprt/linux/libunwind/src/mi/Lget_proc_name.c new file mode 100644 index 0000000000..378097b57a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lget_proc_name.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_name.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lget_reg.c b/sdk/cpprt/linux/libunwind/src/mi/Lget_reg.c new file mode 100644 index 0000000000..effe8a8063 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lget_reg.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_reg.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lput_dynamic_unwind_info.c b/sdk/cpprt/linux/libunwind/src/mi/Lput_dynamic_unwind_info.c new file mode 100644 index 0000000000..99597cd5fa --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lput_dynamic_unwind_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gput_dynamic_unwind_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lset_caching_policy.c b/sdk/cpprt/linux/libunwind/src/mi/Lset_caching_policy.c new file mode 100644 index 0000000000..cc18816b37 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lset_caching_policy.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gset_caching_policy.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lset_fpreg.c b/sdk/cpprt/linux/libunwind/src/mi/Lset_fpreg.c new file mode 100644 index 0000000000..2497d404f4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lset_fpreg.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gset_fpreg.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/Lset_reg.c b/sdk/cpprt/linux/libunwind/src/mi/Lset_reg.c new file mode 100644 index 0000000000..c7a872b016 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/Lset_reg.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gset_reg.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mi/_ReadSLEB.c b/sdk/cpprt/linux/libunwind/src/mi/_ReadSLEB.c new file mode 100644 index 0000000000..ce08f3399d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/_ReadSLEB.c @@ -0,0 +1,25 @@ +#include + +unw_word_t +_ReadSLEB (unsigned char **dpp) +{ + unsigned shift = 0; + unw_word_t byte, result = 0; + unsigned char *bp = *dpp; + + while (1) + { + byte = *bp++; + result |= (byte & 0x7f) << shift; + shift += 7; + if ((byte & 0x80) == 0) + break; + } + + if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0) + /* sign-extend negative value */ + result |= ((unw_word_t) -1) << shift; + + *dpp = bp; + return result; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/_ReadULEB.c b/sdk/cpprt/linux/libunwind/src/mi/_ReadULEB.c new file mode 100644 index 0000000000..8952e6357d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/_ReadULEB.c @@ -0,0 +1,20 @@ +#include + +unw_word_t +_ReadULEB (unsigned char **dpp) +{ + unsigned shift = 0; + unw_word_t byte, result = 0; + unsigned char *bp = *dpp; + + while (1) + { + byte = *bp++; + result |= (byte & 0x7f) << shift; + if ((byte & 0x80) == 0) + break; + shift += 7; + } + *dpp = bp; + return result; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/backtrace.c b/sdk/cpprt/linux/libunwind/src/mi/backtrace.c new file mode 100644 index 0000000000..bd748aac18 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/backtrace.c @@ -0,0 +1,81 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef UNW_REMOTE_ONLY + +#define UNW_LOCAL_ONLY +#include +#include +#include + +/* See glibc manual for a description of this function. */ + +static ALWAYS_INLINE int +slow_backtrace (void **buffer, int size, unw_context_t *uc) +{ + unw_cursor_t cursor; + unw_word_t ip; + int n = 0; + + if (unlikely (unw_init_local (&cursor, uc) < 0)) + return 0; + + while (unw_step (&cursor) > 0) + { + if (n >= size) + return n; + + if (unw_get_reg (&cursor, UNW_REG_IP, &ip) < 0) + return n; + buffer[n++] = (void *) (uintptr_t) ip; + } + return n; +} + +int +unw_backtrace (void **buffer, int size) +{ + unw_cursor_t cursor; + unw_context_t uc; + int n = size; + + tdep_getcontext_trace (&uc); + + if (unlikely (unw_init_local (&cursor, &uc) < 0)) + return 0; + + if (unlikely (tdep_trace (&cursor, buffer, &n) < 0)) + { + unw_getcontext (&uc); + return slow_backtrace (buffer, size, &uc); + } + + return n; +} + +extern int backtrace (void **buffer, int size) + __attribute__((weak, alias("unw_backtrace"))); + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/mi/dyn-cancel.c b/sdk/cpprt/linux/libunwind/src/mi/dyn-cancel.c new file mode 100644 index 0000000000..e784317fc7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/dyn-cancel.c @@ -0,0 +1,46 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +void +_U_dyn_cancel (unw_dyn_info_t *di) +{ + mutex_lock (&_U_dyn_info_list_lock); + { + ++_U_dyn_info_list.generation; + + if (di->prev) + di->prev->next = di->next; + else + _U_dyn_info_list.first = di->next; + + if (di->next) + di->next->prev = di->prev; + } + mutex_unlock (&_U_dyn_info_list_lock); + + di->next = di->prev = NULL; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/dyn-info-list.c b/sdk/cpprt/linux/libunwind/src/mi/dyn-info-list.c new file mode 100644 index 0000000000..5a5e30ee0f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/dyn-info-list.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +PROTECTED unw_word_t +_U_dyn_info_list_addr (void) +{ + return (unw_word_t) (uintptr_t) &_U_dyn_info_list; +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/dyn-register.c b/sdk/cpprt/linux/libunwind/src/mi/dyn-register.c new file mode 100644 index 0000000000..a62d696eb7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/dyn-register.c @@ -0,0 +1,44 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +HIDDEN pthread_mutex_t _U_dyn_info_list_lock = PTHREAD_MUTEX_INITIALIZER; + +void +_U_dyn_register (unw_dyn_info_t *di) +{ + mutex_lock (&_U_dyn_info_list_lock); + { + ++_U_dyn_info_list.generation; + + di->next = _U_dyn_info_list.first; + di->prev = NULL; + if (di->next) + di->next->prev = di; + _U_dyn_info_list.first = di; + } + mutex_unlock (&_U_dyn_info_list_lock); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/flush_cache.c b/sdk/cpprt/linux/libunwind/src/mi/flush_cache.c new file mode 100644 index 0000000000..c5650ba874 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/flush_cache.c @@ -0,0 +1,59 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED void +unw_flush_cache (unw_addr_space_t as, unw_word_t lo, unw_word_t hi) +{ +#if !UNW_TARGET_IA64 + struct unw_debug_frame_list *w = as->debug_frames; +#endif + + /* clear dyn_info_list_addr cache: */ + as->dyn_info_list_addr = 0; + +#if !UNW_TARGET_IA64 + for (; w; w = w->next) + { + if (w->index) + free (w->index); + free (w->debug_frame); + } + as->debug_frames = NULL; +#endif + + /* This lets us flush caches lazily. The implementation currently + ignores the flush range arguments (lo-hi). This is OK because + unw_flush_cache() is allowed to flush more than the requested + range. */ + +#ifdef HAVE_FETCH_AND_ADD1 + fetch_and_add1 (&as->cache_generation); +#else +# warning unw_flush_cache(): need a way to atomically increment an integer. + ++as->cache_generation; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/init.c b/sdk/cpprt/linux/libunwind/src/mi/init.c new file mode 100644 index 0000000000..3bdf74b593 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/init.c @@ -0,0 +1,62 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +HIDDEN intrmask_t unwi_full_mask; + +static const char rcsid[] UNUSED = + "$Id: " PACKAGE_STRING " --- report bugs to " PACKAGE_BUGREPORT " $"; + +#if UNW_DEBUG + +/* Must not be declared HIDDEN/PROTECTED because libunwind.so and + libunwind-PLATFORM.so will both define their own copies of this + variable and we want to use only one or the other when both + libraries are loaded. */ +long unwi_debug_level; + +#endif /* UNW_DEBUG */ + +HIDDEN void +mi_init (void) +{ +#if !HAVE_SGX +#if UNW_DEBUG + const char *str = getenv ("UNW_DEBUG_LEVEL"); + + if (str) + unwi_debug_level = atoi (str); + + if (unwi_debug_level > 0) + { + setbuf (stdout, NULL); + setbuf (stderr, NULL); + } +#endif +#endif + + assert (sizeof (struct cursor) <= sizeof (unw_cursor_t)); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/mempool.c b/sdk/cpprt/linux/libunwind/src/mi/mempool.c new file mode 100644 index 0000000000..ef891bf6a6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/mempool.c @@ -0,0 +1,176 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2003, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +#define MAX_ALIGN (sizeof (long double)) + +static char sos_memory[SOS_MEMORY_SIZE]; +static char *sos_memp; +static size_t pg_size; + +HIDDEN void * +sos_alloc (size_t size) +{ + char *mem; + +#ifdef HAVE_CMPXCHG + char *old_mem; + + size = (size + MAX_ALIGN - 1) & -MAX_ALIGN; + if (!sos_memp) + cmpxchg_ptr (&sos_memp, 0, sos_memory); + do + { + old_mem = sos_memp; + + mem = (char *) (((unsigned long) old_mem + MAX_ALIGN - 1) & -MAX_ALIGN); + mem += size; + assert (mem < sos_memory + sizeof (sos_memory)); + } + while (!cmpxchg_ptr (&sos_memp, old_mem, mem)); +#else + static define_lock (sos_lock); + intrmask_t saved_mask; + + size = (size + MAX_ALIGN - 1) & -MAX_ALIGN; + + lock_acquire (&sos_lock, saved_mask); + { + if (!sos_memp) + sos_memp = sos_memory; + + mem = (char *) (((unsigned long) sos_memp + MAX_ALIGN - 1) & -MAX_ALIGN); + mem += size; + assert (mem < sos_memory + sizeof (sos_memory)); + sos_memp = mem; + } + lock_release (&sos_lock, saved_mask); +#endif + return mem; +} + +/* Must be called while holding the mempool lock. */ + +static void +free_object (struct mempool *pool, void *object) +{ + struct object *obj = object; + + obj->next = pool->free_list; + pool->free_list = obj; + ++pool->num_free; +} + +static void +add_memory (struct mempool *pool, char *mem, size_t size, size_t obj_size) +{ + char *obj; + + for (obj = mem; obj <= mem + size - obj_size; obj += obj_size) + free_object (pool, obj); +} + +static void +expand (struct mempool *pool) +{ + size_t size; + char *mem; + + size = pool->chunk_size; + GET_MEMORY (mem, size); + if (!mem) + { + size = (pool->obj_size + pg_size - 1) & -pg_size; + GET_MEMORY (mem, size); + if (!mem) + { + /* last chance: try to allocate one object from the SOS memory */ + size = pool->obj_size; + mem = sos_alloc (size); + } + } + add_memory (pool, mem, size, pool->obj_size); +} + +HIDDEN void +mempool_init (struct mempool *pool, size_t obj_size, size_t reserve) +{ + if (pg_size == 0) + pg_size = getpagesize (); + + memset (pool, 0, sizeof (*pool)); + + lock_init (&pool->lock); + + /* round object-size up to integer multiple of MAX_ALIGN */ + obj_size = (obj_size + MAX_ALIGN - 1) & -MAX_ALIGN; + + if (!reserve) + { + reserve = pg_size / obj_size / 4; + if (!reserve) + reserve = 16; + } + + pool->obj_size = obj_size; + pool->reserve = reserve; + pool->chunk_size = (2*reserve*obj_size + pg_size - 1) & -pg_size; + + expand (pool); +} + +HIDDEN void * +mempool_alloc (struct mempool *pool) +{ + intrmask_t saved_mask; + struct object *obj; + + lock_acquire (&pool->lock, saved_mask); + { + if (pool->num_free <= pool->reserve) + expand (pool); + + assert (pool->num_free > 0); + + --pool->num_free; + obj = pool->free_list; + pool->free_list = obj->next; + } + lock_release (&pool->lock, saved_mask); + return obj; +} + +HIDDEN void +mempool_free (struct mempool *pool, void *object) +{ + intrmask_t saved_mask; + + lock_acquire (&pool->lock, saved_mask); + { + free_object (pool, object); + } + lock_release (&pool->lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/mi/strerror.c b/sdk/cpprt/linux/libunwind/src/mi/strerror.c new file mode 100644 index 0000000000..ef647160b0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mi/strerror.c @@ -0,0 +1,51 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 BEA Systems + Contributed by Thomas Hallgren + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +/* Returns the text corresponding to the given err_code or the + text "invalid error code" if the err_code is invalid. */ +const char * +unw_strerror (int err_code) +{ + const char *cp; + unw_error_t error = (unw_error_t)-err_code; + switch (error) + { + case UNW_ESUCCESS: cp = "no error"; break; + case UNW_EUNSPEC: cp = "unspecified (general) error"; break; + case UNW_ENOMEM: cp = "out of memory"; break; + case UNW_EBADREG: cp = "bad register number"; break; + case UNW_EREADONLYREG: cp = "attempt to write read-only register"; break; + case UNW_ESTOPUNWIND: cp = "stop unwinding"; break; + case UNW_EINVALIDIP: cp = "invalid IP"; break; + case UNW_EBADFRAME: cp = "bad frame"; break; + case UNW_EINVAL: cp = "unsupported operation or bad value"; break; + case UNW_EBADVERSION: cp = "unwind info has unsupported version"; break; + case UNW_ENOINFO: cp = "no unwind info found"; break; + default: cp = "invalid error code"; + } + return cp; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/mips/Gcreate_addr_space.c new file mode 100644 index 0000000000..af084ef0e4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gcreate_addr_space.c @@ -0,0 +1,65 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + /* + * MIPS supports only big or little-endian, not weird stuff like + * PDP_ENDIAN. + */ + if (byte_order != 0 + && byte_order != __LITTLE_ENDIAN + && byte_order != __BIG_ENDIAN) + return NULL; + + if (byte_order == 0) + /* use host default: */ + as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + else + as->big_endian = (byte_order == __BIG_ENDIAN); + + /* FIXME! There is no way to specify the ABI. */ + as->abi = UNW_MIPS_ABI_O32; + as->addr_size = 4; + + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/mips/Gget_proc_info.c new file mode 100644 index 0000000000..973ddd979b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gget_proc_info.c @@ -0,0 +1,41 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + /* We can only unwind using Dwarf into on MIPS: return failure code + if it's not present. */ + ret = dwarf_make_proc_info (&c->dwarf); + if (ret < 0) + return ret; + + *pi = c->dwarf.pi; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/mips/Gget_save_loc.c new file mode 100644 index 0000000000..262e23ec06 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gget_save_loc.c @@ -0,0 +1,99 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* FIXME for MIPS. */ + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + loc = DWARF_NULL_LOC; /* default to "not saved" */ + + switch (reg) + { + case UNW_MIPS_R0: + case UNW_MIPS_R1: + case UNW_MIPS_R2: + case UNW_MIPS_R3: + case UNW_MIPS_R4: + case UNW_MIPS_R5: + case UNW_MIPS_R6: + case UNW_MIPS_R7: + case UNW_MIPS_R8: + case UNW_MIPS_R9: + case UNW_MIPS_R10: + case UNW_MIPS_R11: + case UNW_MIPS_R12: + case UNW_MIPS_R13: + case UNW_MIPS_R14: + case UNW_MIPS_R15: + case UNW_MIPS_R16: + case UNW_MIPS_R17: + case UNW_MIPS_R18: + case UNW_MIPS_R19: + case UNW_MIPS_R20: + case UNW_MIPS_R21: + case UNW_MIPS_R22: + case UNW_MIPS_R23: + case UNW_MIPS_R24: + case UNW_MIPS_R25: + case UNW_MIPS_R26: + case UNW_MIPS_R27: + case UNW_MIPS_R28: + case UNW_MIPS_R29: + case UNW_MIPS_R30: + case UNW_MIPS_R31: + loc = c->dwarf.loc[reg - UNW_MIPS_R0]; + break; + + default: + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gglobal.c b/sdk/cpprt/linux/libunwind/src/mips/Gglobal.c new file mode 100644 index 0000000000..1aa77eacbc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gglobal.c @@ -0,0 +1,64 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN pthread_mutex_t mips_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +/* FIXME: I'm pretty sure we don't need this at all for MIPS, but "generic" + code (include/dwarf_i.h) seems to expect it to be here at present. */ + +HIDDEN uint8_t dwarf_to_unw_regnum_map[] = + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 + }; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + + lock_acquire (&mips_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + mips_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&mips_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Ginit.c b/sdk/cpprt/linux/libunwind/src/mips/Ginit.c new file mode 100644 index 0000000000..6ffeabfaa0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Ginit.c @@ -0,0 +1,208 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +/* Return the address of the 64-bit slot in UC for REG (even for o32, + where registers are 32-bit, the slots are still 64-bit). */ + +static inline void * +uc_addr (ucontext_t *uc, int reg) +{ + if (reg >= UNW_MIPS_R0 && reg < UNW_MIPS_R0 + 32) + return &uc->uc_mcontext.gregs[reg - UNW_MIPS_R0]; + else + return NULL; +} + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg) +{ + char *addr = uc_addr (uc, reg); + + if (reg >= UNW_MIPS_R0 && reg <= UNW_MIPS_R31 + && tdep_big_endian (unw_local_addr_space) + && unw_local_addr_space->abi == UNW_MIPS_ABI_O32) + addr += 4; + + return addr; +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +/* XXX fix me: there is currently no way to locate the dyn-info list + by a remote unwinder. On ia64, this is done via a special + unwind-table entry. Perhaps something similar can be done with + DWARF2 unwind info. */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list; + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (16, "mem[%llx] <- %llx\n", (long long) addr, (long long) *val); + *(unw_word_t *) (intptr_t) addr = *val; + } + else + { + *val = *(unw_word_t *) (intptr_t) addr; + Debug (16, "mem[%llx] -> %llx\n", (long long) addr, (long long) *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = arg; + + if (unw_is_fpreg (reg)) + goto badreg; + + Debug (16, "reg = %s\n", unw_regname (reg)); + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + *(unw_word_t *) (intptr_t) addr = (mips_reg_t) *val; + Debug (12, "%s <- %llx\n", unw_regname (reg), (long long) *val); + } + else + { + *val = (mips_reg_t) *(unw_word_t *) (intptr_t) addr; + Debug (12, "%s -> %llx\n", unw_regname (reg), (long long) *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if (!unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + *(unw_fpreg_t *) (intptr_t) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) (intptr_t) addr; + Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + + return elf_w (get_proc_name) (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +mips_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN); +#if _MIPS_SIM == _ABIO32 + local_addr_space.abi = UNW_MIPS_ABI_O32; +#elif _MIPS_SIM == _ABIN32 + local_addr_space.abi = UNW_MIPS_ABI_N32; +#elif _MIPS_SIM == _ABI64 + local_addr_space.abi = UNW_MIPS_ABI_N64; +#else +# error Unsupported ABI +#endif + local_addr_space.addr_size = sizeof (void *); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = 0; /* mips_local_resume? FIXME! */ + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/mips/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/mips/Ginit_local.c new file mode 100644 index 0000000000..debf5bb58f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Ginit_local.c @@ -0,0 +1,53 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = uc; + return common_init (c, 1); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/mips/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/mips/Ginit_remote.c new file mode 100644 index 0000000000..854f3b62f0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Ginit_remote.c @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/mips/Gis_signal_frame.c new file mode 100644 index 0000000000..fef542b1b9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gis_signal_frame.c @@ -0,0 +1,35 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include + +/* FIXME for MIPS. */ + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + printf ("%s: implement me\n", __FUNCTION__); + return -UNW_ENOINFO; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gregs.c b/sdk/cpprt/linux/libunwind/src/mips/Gregs.c new file mode 100644 index 0000000000..9f37299ce0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gregs.c @@ -0,0 +1,99 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* FIXME: The following is probably unfinished and/or at least partly bogus. */ + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + + switch (reg) + { + case UNW_MIPS_R0: + case UNW_MIPS_R1: + case UNW_MIPS_R2: + case UNW_MIPS_R3: + case UNW_MIPS_R4: + case UNW_MIPS_R5: + case UNW_MIPS_R6: + case UNW_MIPS_R7: + case UNW_MIPS_R8: + case UNW_MIPS_R9: + case UNW_MIPS_R10: + case UNW_MIPS_R11: + case UNW_MIPS_R12: + case UNW_MIPS_R13: + case UNW_MIPS_R14: + case UNW_MIPS_R15: + case UNW_MIPS_R16: + case UNW_MIPS_R17: + case UNW_MIPS_R18: + case UNW_MIPS_R19: + case UNW_MIPS_R20: + case UNW_MIPS_R21: + case UNW_MIPS_R22: + case UNW_MIPS_R23: + case UNW_MIPS_R24: + case UNW_MIPS_R25: + case UNW_MIPS_R26: + case UNW_MIPS_R27: + case UNW_MIPS_R28: + case UNW_MIPS_R29: + case UNW_MIPS_R30: + case UNW_MIPS_R31: + loc = c->dwarf.loc[reg - UNW_MIPS_R0]; + break; + + case UNW_MIPS_CFA: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + /* FIXME: IP? Copro & shadow registers? */ + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +/* FIXME for MIPS. */ + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gresume.c b/sdk/cpprt/linux/libunwind/src/mips/Gresume.c new file mode 100644 index 0000000000..b822e24b0c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gresume.c @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* FIXME for MIPS. */ + +#include + +#include "unwind_i.h" + +#ifndef UNW_REMOTE_ONLY + +HIDDEN inline int +mips_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + return -UNW_EINVAL; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Gstep.c b/sdk/cpprt/linux/libunwind/src/mips/Gstep.c new file mode 100644 index 0000000000..bafeef1fc1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Gstep.c @@ -0,0 +1,48 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + /* Try DWARF-based unwinding... this is the only method likely to work for + MIPS. */ + ret = dwarf_step (&c->dwarf); + + if (unlikely (ret == -UNW_ESTOPUNWIND)) + return ret; + + /* Dwarf unwinding didn't work, stop. */ + if (unlikely (ret < 0)) + return 0; + + return (c->dwarf.ip == 0) ? 0 : 1; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/mips/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/mips/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/mips/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lglobal.c b/sdk/cpprt/linux/libunwind/src/mips/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Linit.c b/sdk/cpprt/linux/libunwind/src/mips/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Linit_local.c b/sdk/cpprt/linux/libunwind/src/mips/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/mips/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/mips/Lis_signal_frame.c new file mode 100644 index 0000000000..b9a7c4f51a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lregs.c b/sdk/cpprt/linux/libunwind/src/mips/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lresume.c b/sdk/cpprt/linux/libunwind/src/mips/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/Lstep.c b/sdk/cpprt/linux/libunwind/src/mips/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/elfxx.c b/sdk/cpprt/linux/libunwind/src/mips/elfxx.c new file mode 100644 index 0000000000..07d3d12b94 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/elfxx.c @@ -0,0 +1,27 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +#include "../src/elfxx.c" diff --git a/sdk/cpprt/linux/libunwind/src/mips/gen-offsets.c b/sdk/cpprt/linux/libunwind/src/mips/gen-offsets.c new file mode 100644 index 0000000000..448f694532 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/gen-offsets.c @@ -0,0 +1,30 @@ +#include +#include +#include + +#define UC(N,X) \ + printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X)) + +#define SC(N,X) \ + printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X)) + +int +main (void) +{ + printf ( +"/* Linux-specific definitions: */\n\n" + +"/* Define various structure offsets to simplify cross-compilation. */\n\n" + +"/* Offsets for MIPS Linux \"ucontext_t\": */\n\n"); + + UC ("FLAGS", uc_flags); + UC ("LINK", uc_link); + UC ("STACK", uc_stack); + UC ("MCONTEXT", uc_mcontext); + UC ("SIGMASK", uc_sigmask); + + UC ("MCONTEXT_GREGS", uc_mcontext.gregs); + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/getcontext.S b/sdk/cpprt/linux/libunwind/src/mips/getcontext.S new file mode 100644 index 0000000000..ad9e1f00a1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/getcontext.S @@ -0,0 +1,85 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" +#include + + .text + +#if _MIPS_SIM == _ABIO32 +# if __BYTE_ORDER == __BIG_ENDIAN +# define OFFSET 4 +# else +# define OFFSET 0 +# endif +# define SREG(X) \ + sw $X, (LINUX_UC_MCONTEXT_GREGS + 8 * X + OFFSET) ($4); \ + sra $1, $X, 31; \ + sw $1, (LINUX_UC_MCONTEXT_GREGS + 8 * X + 4 - OFFSET) ($4) +#else +# define SREG(X) sd $X, (LINUX_UC_MCONTEXT_GREGS + 8 * X) ($4) +#endif + + .global _Umips_getcontext + .type _Umips_getcontext, %function + # This is a stub version of getcontext() for MIPS which only stores core + # registers. +_Umips_getcontext: + .set noat + SREG (1) + SREG (0) + SREG (2) + SREG (3) + SREG (4) + SREG (5) + SREG (6) + SREG (7) + SREG (8) + SREG (9) + SREG (10) + SREG (11) + SREG (12) + SREG (13) + SREG (14) + SREG (15) + SREG (16) + SREG (17) + SREG (18) + SREG (19) + SREG (20) + SREG (21) + SREG (22) + SREG (23) + SREG (24) + SREG (25) + SREG (26) + SREG (27) + SREG (28) + SREG (29) + SREG (30) + SREG (31) + li $2, 0 + j $31 + + .size _Umips_getcontext, .-_Umips_getcontext diff --git a/sdk/cpprt/linux/libunwind/src/mips/init.h b/sdk/cpprt/linux/libunwind/src/mips/init.h new file mode 100644 index 0000000000..3a4bb00859 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/init.h @@ -0,0 +1,58 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret, i; + + for (i = 0; i < 32; i++) + c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, UNW_MIPS_R0 + i); + for (i = 32; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[31], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_MIPS_R29), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + /* FIXME: Initialisation for other registers. */ + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/is_fpreg.c b/sdk/cpprt/linux/libunwind/src/mips/is_fpreg.c new file mode 100644 index 0000000000..3acc6967a2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/is_fpreg.c @@ -0,0 +1,35 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +/* FIXME: I'm not sure if libunwind's GP/FP register distinction is very useful + on MIPS. */ + +PROTECTED int +unw_is_fpreg (int regnum) +{ + /* FIXME: Support FP. */ + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/offsets.h b/sdk/cpprt/linux/libunwind/src/mips/offsets.h new file mode 100644 index 0000000000..8040f6a51b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/offsets.h @@ -0,0 +1,39 @@ +/* Linux-specific definitions: */ + +/* Define various structure offsets to simplify cross-compilation. */ + +/* FIXME: Currently these are only used in getcontext.S, which is only used + for a local unwinder, so we can use the compile-time ABI. At a later date + we will want all three here, to use for signal handlers. Also, because + of the three ABIs, gen-offsets.c can not quite generate this file. */ + +/* Offsets for MIPS Linux "ucontext_t": */ + +#if _MIPS_SIM == _ABIO32 + +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x4 +# define LINUX_UC_STACK_OFF 0x8 +# define LINUX_UC_MCONTEXT_OFF 0x18 +# define LINUX_UC_SIGMASK_OFF 0x268 +# define LINUX_UC_MCONTEXT_GREGS 0x28 + +#elif _MIPS_SIM == _ABIN32 + +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x4 +# define LINUX_UC_STACK_OFF 0x8 +# define LINUX_UC_MCONTEXT_OFF 0x18 +# define LINUX_UC_SIGMASK_OFF 0x270 +# define LINUX_UC_MCONTEXT_GREGS 0x18 + +#elif _MIPS_SIM == _ABI64 + +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x8 +# define LINUX_UC_STACK_OFF 0x10 +# define LINUX_UC_MCONTEXT_OFF 0x28 +# define LINUX_UC_SIGMASK_OFF 0x280 +# define LINUX_UC_MCONTEXT_GREGS 0x28 + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/mips/regname.c b/sdk/cpprt/linux/libunwind/src/mips/regname.c new file mode 100644 index 0000000000..94000d496d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/regname.c @@ -0,0 +1,46 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static const char *regname[] = + { + /* 0. */ + "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", + /* 8. */ + "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", + /* 16. */ + "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", + /* 24. */ + "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/mips/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/mips/siglongjmp.S new file mode 100644 index 0000000000..9cbcf3dc01 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/siglongjmp.S @@ -0,0 +1,8 @@ + /* Dummy implementation for now. */ + + .globl _UI_siglongjmp_cont + .globl _UI_longjmp_cont + +_UI_siglongjmp_cont: +_UI_longjmp_cont: + j $31 diff --git a/sdk/cpprt/linux/libunwind/src/mips/unwind_i.h b/sdk/cpprt/linux/libunwind/src/mips/unwind_i.h new file mode 100644 index 0000000000..faf3237ffe --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/mips/unwind_i.h @@ -0,0 +1,48 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include "libunwind_i.h" + +/* +#define x86_lock UNW_OBJ(lock) +#define x86_local_resume UNW_OBJ(local_resume) +#define x86_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define x86_scratch_loc UNW_OBJ(scratch_loc) + +extern int x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); +extern dwarf_loc_t x86_scratch_loc (struct cursor *c, unw_regnum_t reg); +*/ + +extern void mips_local_addr_space_init (void); + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/os-freebsd.c b/sdk/cpprt/linux/libunwind/src/os-freebsd.c new file mode 100644 index 0000000000..76cdd23cc2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/os-freebsd.c @@ -0,0 +1,145 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include +#include +#include +#include +#include + +#include "libunwind_i.h" + +static void * +get_mem(size_t sz) +{ + void *res; + + res = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); + if (res == MAP_FAILED) + return (NULL); + return (res); +} + +static void +free_mem(void *ptr, size_t sz) +{ + munmap(ptr, sz); +} + +static int +get_pid_by_tid(int tid) +{ + int mib[3], error; + size_t len, len1; + char *buf; + struct kinfo_proc *kv; + int i, pid; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_ALL; + + error = sysctl(mib, 3, NULL, &len, NULL, 0); + if (error == -1) + return (-1); + len1 = len * 4 / 3; + buf = get_mem(len1); + if (buf == NULL) + return (-1); + len = len1; + error = sysctl(mib, 3, buf, &len, NULL, 0); + if (error == -1) { + free_mem(buf, len1); + return (-1); + } + pid = -1; + for (i = 0, kv = (struct kinfo_proc *)buf; i < len / sizeof(*kv); + i++, kv++) { + if (kv->ki_tid == tid) { + pid = kv->ki_pid; + break; + } + } + free_mem(buf, len1); + return (pid); +} + +PROTECTED int +tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen) +{ + int mib[4], error, ret; + size_t len, len1; + char *buf, *bp, *eb; + struct kinfo_vmentry *kv; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_VMMAP; + mib[3] = pid; + + error = sysctl(mib, 4, NULL, &len, NULL, 0); + if (error == -1) { + if (errno == ESRCH) { + mib[3] = get_pid_by_tid(pid); + if (mib[3] != -1) + error = sysctl(mib, 4, NULL, &len, NULL, 0); + if (error == -1) + return (-UNW_EUNSPEC); + } else + return (-UNW_EUNSPEC); + } + len1 = len * 4 / 3; + buf = get_mem(len1); + if (buf == NULL) + return (-UNW_EUNSPEC); + len = len1; + error = sysctl(mib, 4, buf, &len, NULL, 0); + if (error == -1) { + free_mem(buf, len1); + return (-UNW_EUNSPEC); + } + ret = -UNW_EUNSPEC; + for (bp = buf, eb = buf + len; bp < eb; bp += kv->kve_structsize) { + kv = (struct kinfo_vmentry *)(uintptr_t)bp; + if (ip < kv->kve_start || ip >= kv->kve_end) + continue; + if (kv->kve_type != KVME_TYPE_VNODE) + continue; + *segbase = kv->kve_start; + *mapoff = kv->kve_offset; + if (path) + { + strncpy(path, kv->kve_path, pathlen); + } + ret = elf_map_image (ei, kv->kve_path); + break; + } + free_mem(buf, len1); + return (ret); +} diff --git a/sdk/cpprt/linux/libunwind/src/os-hpux.c b/sdk/cpprt/linux/libunwind/src/os-hpux.c new file mode 100644 index 0000000000..11b1177cf6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/os-hpux.c @@ -0,0 +1,67 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include + +#include "libunwind_i.h" + +#include "elf64.h" + +HIDDEN int +tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen) +{ + struct load_module_desc lmd; + const char *path2; + + if (pid != getpid ()) + { + printf ("%s: remote case not implemented yet\n", __FUNCTION__); + return -UNW_ENOINFO; + } + + if (!dlmodinfo (ip, &lmd, sizeof (lmd), NULL, 0, 0)) + return -UNW_ENOINFO; + + *segbase = lmd.text_base; + *mapoff = 0; /* XXX fix me? */ + + path2 = dlgetname (&lmd, sizeof (lmd), NULL, 0, 0); + if (!path2) + return -UNW_ENOINFO; + if (path) + { + strncpy(path, path2, pathlen); + path[pathlen - 1] = '\0'; + if (strcmp(path, path2) != 0) + Debug(1, "buffer size (%d) not big enough to hold path\n", pathlen); + } + Debug(1, "segbase=%lx, mapoff=%lx, path=%s\n", *segbase, *mapoff, path); + + return elf_map_image (ei, path); +} diff --git a/sdk/cpprt/linux/libunwind/src/os-linux.c b/sdk/cpprt/linux/libunwind/src/os-linux.c new file mode 100644 index 0000000000..3a552608ba --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/os-linux.c @@ -0,0 +1,67 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "libunwind_i.h" +#include "os-linux.h" + +PROTECTED int +tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen) +{ +#if HAVE_SGX + return -1; +#else + struct map_iterator mi; + int found = 0, rc; + unsigned long hi; + + if (maps_init (&mi, pid) < 0) + return -1; + + while (maps_next (&mi, segbase, &hi, mapoff)) + if (ip >= *segbase && ip < hi) + { + found = 1; + break; + } + + if (!found) + { + maps_close (&mi); + return -1; + } + if (path) + { + strncpy(path, mi.path, pathlen); + } + rc = elf_map_image (ei, mi.path); + maps_close (&mi); + return rc; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/os-linux.h b/sdk/cpprt/linux/libunwind/src/os-linux.h new file mode 100644 index 0000000000..26b6cb3cfd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/os-linux.h @@ -0,0 +1,302 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef os_linux_h +#define os_linux_h + +struct map_iterator + { + off_t offset; + int fd; + size_t buf_size; + char *buf; + char *buf_end; + char *path; + }; + +static inline char * +ltoa (char *buf, long val) +{ + char *cp = buf, tmp; + ssize_t i, len; + + do + { + *cp++ = '0' + (val % 10); + val /= 10; + } + while (val); + + /* reverse the order of the digits: */ + len = cp - buf; + --cp; + for (i = 0; i < len / 2; ++i) + { + tmp = buf[i]; + buf[i] = cp[-i]; + cp[-i] = tmp; + } + return buf + len; +} + +static inline int +maps_init (struct map_iterator *mi, pid_t pid) +{ +#if !HAVE_SGX + char path[sizeof ("/proc/0123456789/maps")], *cp; + + memcpy (path, "/proc/", 6); + cp = ltoa (path + 6, pid); + assert (cp + 6 < path + sizeof (path)); + memcpy (cp, "/maps", 6); + + mi->fd = open (path, O_RDONLY); + if (mi->fd >= 0) + { + /* Try to allocate a page-sized buffer. */ + mi->buf_size = getpagesize (); + cp = mmap (0, mi->buf_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (cp == MAP_FAILED) + { + close(mi->fd); + mi->fd = -1; + return -1; + } + else + { + mi->offset = 0; + mi->buf = mi->buf_end = cp + mi->buf_size; + return 0; + } + } +#else + return -1; +#endif +} + +static inline char * +skip_whitespace (char *cp) +{ + if (!cp) + return NULL; + + while (*cp == ' ' || *cp == '\t') + ++cp; + return cp; +} + +static inline char * +scan_hex (char *cp, unsigned long *valp) +{ + unsigned long num_digits = 0, digit, val = 0; + + cp = skip_whitespace (cp); + if (!cp) + return NULL; + + while (1) + { + digit = *cp; + if ((digit - '0') <= 9) + digit -= '0'; + else if ((digit - 'a') < 6) + digit -= 'a' - 10; + else if ((digit - 'A') < 6) + digit -= 'A' - 10; + else + break; + val = (val << 4) | digit; + ++num_digits; + ++cp; + } + if (!num_digits) + return NULL; + *valp = val; + return cp; +} + +static inline char * +scan_dec (char *cp, unsigned long *valp) +{ + unsigned long num_digits = 0, digit, val = 0; + + if (!(cp = skip_whitespace (cp))) + return NULL; + + while (1) + { + digit = *cp; + if ((digit - '0') <= 9) + { + digit -= '0'; + ++cp; + } + else + break; + val = (10 * val) + digit; + ++num_digits; + } + if (!num_digits) + return NULL; + *valp = val; + return cp; +} + +static inline char * +scan_char (char *cp, char *valp) +{ + if (!cp) + return NULL; + + *valp = *cp; + + /* don't step over NUL terminator */ + if (*cp) + ++cp; + return cp; +} + +/* Scan a string delimited by white-space. Fails on empty string or + if string is doesn't fit in the specified buffer. */ +static inline char * +scan_string (char *cp, char *valp, size_t buf_size) +{ + size_t i = 0; + + if (!(cp = skip_whitespace (cp))) + return NULL; + + while (*cp != ' ' && *cp != '\t' && *cp != '\0') + { + if ((valp != NULL) && (i < buf_size - 1)) + valp[i++] = *cp; + ++cp; + } + if (i == 0 || i >= buf_size) + return NULL; + valp[i] = '\0'; + return cp; +} + +static inline int +maps_next (struct map_iterator *mi, + unsigned long *low, unsigned long *high, unsigned long *offset) +{ + char perm[16], dash = 0, colon = 0, *cp; + unsigned long major, minor, inum; + ssize_t i, nread; + + if (mi->fd < 0) + return 0; + + while (1) + { + ssize_t bytes_left = mi->buf_end - mi->buf; + char *eol = NULL; + + for (i = 0; i < bytes_left; ++i) + { + if (mi->buf[i] == '\n') + { + eol = mi->buf + i; + break; + } + else if (mi->buf[i] == '\0') + break; + } + if (!eol) + { + /* copy down the remaining bytes, if any */ + if (bytes_left > 0) + memmove (mi->buf_end - mi->buf_size, mi->buf, bytes_left); + + mi->buf = mi->buf_end - mi->buf_size; + nread = read (mi->fd, mi->buf + bytes_left, + mi->buf_size - bytes_left); + if (nread <= 0) + return 0; + else if ((size_t) (nread + bytes_left) < mi->buf_size) + { + /* Move contents to the end of the buffer so we + maintain the invariant that all bytes between + mi->buf and mi->buf_end are valid. */ + memmove (mi->buf_end - nread - bytes_left, mi->buf, + nread + bytes_left); + mi->buf = mi->buf_end - nread - bytes_left; + } + + eol = mi->buf + bytes_left + nread - 1; + + for (i = bytes_left; i < bytes_left + nread; ++i) + if (mi->buf[i] == '\n') + { + eol = mi->buf + i; + break; + } + } + cp = mi->buf; + mi->buf = eol + 1; + *eol = '\0'; + + /* scan: "LOW-HIGH PERM OFFSET MAJOR:MINOR INUM PATH" */ + cp = scan_hex (cp, low); + cp = scan_char (cp, &dash); + cp = scan_hex (cp, high); + cp = scan_string (cp, perm, sizeof (perm)); + cp = scan_hex (cp, offset); + cp = scan_hex (cp, &major); + cp = scan_char (cp, &colon); + cp = scan_hex (cp, &minor); + cp = scan_dec (cp, &inum); + cp = mi->path = skip_whitespace (cp); + if (!cp) + continue; + cp = scan_string (cp, NULL, 0); + if (dash != '-' || colon != ':') + continue; /* skip line with unknown or bad format */ + return 1; + } + return 0; +} + +static inline void +maps_close (struct map_iterator *mi) +{ +#if !HAVE_SGX + if (mi->fd < 0) + return; + close (mi->fd); + mi->fd = -1; + if (mi->buf) + { + munmap (mi->buf_end - mi->buf_size, mi->buf_size); + mi->buf = mi->buf_end = 0; + } +#endif +} + +#endif /* os_linux_h */ diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/ppc/Gcreate_addr_space.c new file mode 100644 index 0000000000..21ec10fcd8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Gcreate_addr_space.c @@ -0,0 +1,54 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + /* + * Linux ppc64 supports only big-endian. + */ + if (byte_order != 0 && byte_order != __BIG_ENDIAN) + return NULL; + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/ppc/Gget_proc_info.c new file mode 100644 index 0000000000..21be70c43a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Gget_proc_info.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + + Copied from src/x86_64/, modified slightly (or made empty stubs) for + building frysk successfully on ppc64, by Wu Zhou + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + /* XXX: empty stub. */ + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/ppc/Gget_save_loc.c new file mode 100644 index 0000000000..c5beb81d7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Gget_save_loc.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + + Copied from src/x86_64/, modified slightly (or made empty stubs) for + building frysk successfully on ppc64, by Wu Zhou + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + /* XXX: empty stub. */ + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/ppc/Ginit_local.c new file mode 100644 index 0000000000..b931b5b6a8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Ginit_local.c @@ -0,0 +1,65 @@ +/* libunwind - a platform-independent unwind library + + Copied from src/x86_64/, modified slightly (or made empty stubs) for + building frysk successfully on ppc64, by Wu Zhou + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#ifdef UNW_TARGET_PPC64 +#include "../ppc64/init.h" +#else +#include "../ppc32/init.h" +#endif + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + /* XXX: empty stub. */ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = uc; + #ifdef UNW_TARGET_PPC64 + return common_init_ppc64 (c, 1); + #else + return common_init_ppc32 (c, 1); + #endif +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/ppc/Ginit_remote.c new file mode 100644 index 0000000000..0f4b0fdb35 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Ginit_remote.c @@ -0,0 +1,60 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#ifdef UNW_TARGET_PPC64 +#include "../ppc64/init.h" +#else +#include "../ppc32/init.h" +#endif + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + + #ifdef UNW_TARGET_PPC64 + return common_init_ppc64 (c, 0); + #elif UNW_TARGET_PPC32 + return common_init_ppc32 (c, 0); + #else + #error init_remote :: NO VALID PPC ARCH! + #endif +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Gis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/ppc/Gis_signal_frame.c new file mode 100644 index 0000000000..4154429013 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Gis_signal_frame.c @@ -0,0 +1,66 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +PROTECTED int +unw_is_signal_frame (unw_cursor_t * cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, w1, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + as->validate = 1; /* Don't trust the ip */ + arg = c->dwarf.as_arg; + + /* Check if return address points at sigreturn sequence. + on ppc64 Linux that is (see libc.so): + 0x38210080 addi r1, r1, 128 // pop the stack + 0x380000ac li r0, 172 // invoke system service 172 + 0x44000002 sc + */ + + ip = c->dwarf.ip; + if (ip == 0) + return 0; + + /* Read up two 8-byte words at the IP. We are only looking at 3 + consecutive 32-bit words, so the second 8-byte word needs to be + shifted right by 32 bits (think big-endian) */ + + a = unw_get_accessors (as); + if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0) + return 0; + w1 >>= 32; + return (w0 == 0x38210080380000ac && w1 == 0x44000002); + +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/ppc/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/ppc/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/ppc/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Linit_local.c b/sdk/cpprt/linux/libunwind/src/ppc/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/ppc/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/Lis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/ppc/Lis_signal_frame.c new file mode 100644 index 0000000000..b9a7c4f51a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/longjmp.S b/sdk/cpprt/linux/libunwind/src/ppc/longjmp.S new file mode 100644 index 0000000000..d363aef222 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/longjmp.S @@ -0,0 +1,36 @@ +/* libunwind - a platform-independent unwind library + + Copied from src/x86_64/, modified slightly (or made empty stubs) for + building frysk successfully on ppc64, by Wu Zhou + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .globl _UI_longjmp_cont + + .type _UI_longjmp_cont, @function +_UI_longjmp_cont: + .size _UI_longjmp_cont, .-_UI_longjmp_cont + +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/ppc/siglongjmp.S new file mode 100644 index 0000000000..64be36ce17 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc/siglongjmp.S @@ -0,0 +1,31 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .globl _UI_siglongjmp_cont + + _UI_siglongjmp_cont: + +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Gglobal.c b/sdk/cpprt/linux/libunwind/src/ppc32/Gglobal.c new file mode 100644 index 0000000000..b7cebff51f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Gglobal.c @@ -0,0 +1,135 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN pthread_mutex_t ppc32_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +/* The API register numbers are exactly the same as the .eh_frame + registers, for now at least. */ +uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] = + { + [UNW_PPC32_R0]=UNW_PPC32_R0, + [UNW_PPC32_R1]=UNW_PPC32_R1, + [UNW_PPC32_R2]=UNW_PPC32_R2, + [UNW_PPC32_R3]=UNW_PPC32_R3, + [UNW_PPC32_R4]=UNW_PPC32_R4, + [UNW_PPC32_R5]=UNW_PPC32_R5, + [UNW_PPC32_R6]=UNW_PPC32_R6, + [UNW_PPC32_R7]=UNW_PPC32_R7, + [UNW_PPC32_R8]=UNW_PPC32_R8, + [UNW_PPC32_R9]=UNW_PPC32_R9, + [UNW_PPC32_R10]=UNW_PPC32_R10, + [UNW_PPC32_R11]=UNW_PPC32_R11, + [UNW_PPC32_R12]=UNW_PPC32_R12, + [UNW_PPC32_R13]=UNW_PPC32_R13, + [UNW_PPC32_R14]=UNW_PPC32_R14, + [UNW_PPC32_R15]=UNW_PPC32_R15, + [UNW_PPC32_R16]=UNW_PPC32_R16, + [UNW_PPC32_R17]=UNW_PPC32_R17, + [UNW_PPC32_R18]=UNW_PPC32_R18, + [UNW_PPC32_R19]=UNW_PPC32_R19, + [UNW_PPC32_R20]=UNW_PPC32_R20, + [UNW_PPC32_R21]=UNW_PPC32_R21, + [UNW_PPC32_R22]=UNW_PPC32_R22, + [UNW_PPC32_R23]=UNW_PPC32_R23, + [UNW_PPC32_R24]=UNW_PPC32_R24, + [UNW_PPC32_R25]=UNW_PPC32_R25, + [UNW_PPC32_R26]=UNW_PPC32_R26, + [UNW_PPC32_R27]=UNW_PPC32_R27, + [UNW_PPC32_R28]=UNW_PPC32_R28, + [UNW_PPC32_R29]=UNW_PPC32_R29, + [UNW_PPC32_R30]=UNW_PPC32_R30, + [UNW_PPC32_R31]=UNW_PPC32_R31, + + [UNW_PPC32_CTR]=UNW_PPC32_CTR, + [UNW_PPC32_XER]=UNW_PPC32_XER, + [UNW_PPC32_CCR]=UNW_PPC32_CCR, + [UNW_PPC32_LR]=UNW_PPC32_LR, + [UNW_PPC32_FPSCR]=UNW_PPC32_FPSCR, + + [UNW_PPC32_F0]=UNW_PPC32_F0, + [UNW_PPC32_F1]=UNW_PPC32_F1, + [UNW_PPC32_F2]=UNW_PPC32_F2, + [UNW_PPC32_F3]=UNW_PPC32_F3, + [UNW_PPC32_F4]=UNW_PPC32_F4, + [UNW_PPC32_F5]=UNW_PPC32_F5, + [UNW_PPC32_F6]=UNW_PPC32_F6, + [UNW_PPC32_F7]=UNW_PPC32_F7, + [UNW_PPC32_F8]=UNW_PPC32_F8, + [UNW_PPC32_F9]=UNW_PPC32_F9, + [UNW_PPC32_F10]=UNW_PPC32_F10, + [UNW_PPC32_F11]=UNW_PPC32_F11, + [UNW_PPC32_F12]=UNW_PPC32_F12, + [UNW_PPC32_F13]=UNW_PPC32_F13, + [UNW_PPC32_F14]=UNW_PPC32_F14, + [UNW_PPC32_F15]=UNW_PPC32_F15, + [UNW_PPC32_F16]=UNW_PPC32_F16, + [UNW_PPC32_F17]=UNW_PPC32_F17, + [UNW_PPC32_F18]=UNW_PPC32_F18, + [UNW_PPC32_F19]=UNW_PPC32_F19, + [UNW_PPC32_F20]=UNW_PPC32_F20, + [UNW_PPC32_F21]=UNW_PPC32_F21, + [UNW_PPC32_F22]=UNW_PPC32_F22, + [UNW_PPC32_F23]=UNW_PPC32_F23, + [UNW_PPC32_F24]=UNW_PPC32_F24, + [UNW_PPC32_F25]=UNW_PPC32_F25, + [UNW_PPC32_F26]=UNW_PPC32_F26, + [UNW_PPC32_F27]=UNW_PPC32_F27, + [UNW_PPC32_F28]=UNW_PPC32_F28, + [UNW_PPC32_F29]=UNW_PPC32_F29, + [UNW_PPC32_F30]=UNW_PPC32_F30, + [UNW_PPC32_F31]=UNW_PPC32_F31, +}; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + + lock_acquire (&ppc32_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + ppc32_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&ppc32_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Ginit.c b/sdk/cpprt/linux/libunwind/src/ppc32/Ginit.c new file mode 100644 index 0000000000..47c66f1195 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Ginit.c @@ -0,0 +1,221 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "ucontext_i.h" +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + + +#define PAGE_SIZE 4096 +#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) + + +static void * +uc_addr (ucontext_t *uc, int reg) +{ + void *addr; + + if ((unsigned) (reg - UNW_PPC32_R0) < 32) + addr = &uc->uc_mcontext.uc_regs->gregs[reg - UNW_PPC32_R0]; + + else + if ( ((unsigned) (reg - UNW_PPC32_F0) < 32) && + ((unsigned) (reg - UNW_PPC32_F0) >= 0) ) + addr = &uc->uc_mcontext.uc_regs->fpregs.fpregs[reg - UNW_PPC32_F0]; + + else + { + unsigned gregs_idx; + + switch (reg) + { + case UNW_PPC32_CTR: + gregs_idx = CTR_IDX; + break; + case UNW_PPC32_LR: + gregs_idx = LINK_IDX; + break; + case UNW_PPC32_XER: + gregs_idx = XER_IDX; + break; + case UNW_PPC32_CCR: + gregs_idx = CCR_IDX; + break; + default: + return NULL; + } + addr = &uc->uc_mcontext.uc_regs->gregs[gregs_idx]; + } + return addr; +} + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg) +{ + return uc_addr (uc, reg); +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (12, "mem[%lx] <- %lx\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "mem[%lx] -> %lx\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, + int write, void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = arg; + + if ( ((unsigned int) (reg - UNW_PPC32_F0) < 32) && + ((unsigned int) (reg - UNW_PPC32_F0) >= 0)) + goto badreg; + + addr = uc_addr (uc, reg); + if (!addr) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- %lx\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %lx\n", unw_regname (reg), *val); + } + return 0; + +badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if ((unsigned) (reg - UNW_PPC32_F0) < 0) + goto badreg; + + addr = uc_addr (uc, reg); + if (!addr) + goto badreg; + + if (write) + { + Debug (12, "%s <- %016Lf\n", unw_regname (reg), *val); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %016Lf\n", unw_regname (reg), *val); + } + return 0; + +badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +ppc32_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = ppc32_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Gregs.c b/sdk/cpprt/linux/libunwind/src/ppc32/Gregs.c new file mode 100644 index 0000000000..92be32164a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Gregs.c @@ -0,0 +1,90 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + struct dwarf_loc loc; + + switch (reg) + { + case UNW_TDEP_IP: + if (write) + { + c->dwarf.ip = *valp; /* update the IP cache */ + if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip + || *valp >= c->dwarf.pi.end_ip)) + c->dwarf.pi_valid = 0; /* new IP outside of current proc */ + } + else + *valp = c->dwarf.ip; + return 0; + + case UNW_TDEP_SP: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + + default: + break; + } + + /* make sure it's not an FP or VR register */ + if ((((unsigned) (reg - UNW_PPC32_F0)) <= 31)) + return -UNW_EBADREG; + + loc = c->dwarf.loc[reg]; + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + struct dwarf_loc loc; + + if ((unsigned) (reg - UNW_PPC32_F0) < 32) + { + loc = c->dwarf.loc[reg]; + if (write) + return dwarf_putfp (&c->dwarf, loc, *valp); + else + return dwarf_getfp (&c->dwarf, loc, valp); + } + + return -UNW_EBADREG; +} + diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Gresume.c b/sdk/cpprt/linux/libunwind/src/ppc32/Gresume.c new file mode 100644 index 0000000000..5446c9805c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Gresume.c @@ -0,0 +1,77 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford cjashfor@us.ibm.com + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +#ifndef UNW_REMOTE_ONLY + +#include + +/* sigreturn() is a no-op on x86_64 glibc. */ + +static NORETURN inline long +my_rt_sigreturn (void *new_sp) +{ + /* XXX: empty stub. */ + abort (); +} + +HIDDEN inline int +ppc32_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + /* XXX: empty stub. */ + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +/* This routine is responsible for copying the register values in + cursor C and establishing them as the current machine state. */ + +static inline int +establish_machine_state (struct cursor *c) +{ + /* XXX: empty stub. */ + return 0; +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + if ((ret = establish_machine_state (c)) < 0) + return ret; + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Gstep.c b/sdk/cpprt/linux/libunwind/src/ppc32/Gstep.c new file mode 100644 index 0000000000..d146e82dde --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Gstep.c @@ -0,0 +1,309 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "ucontext_i.h" +#include + +/* This definition originates in /usr/include/asm-ppc64/ptrace.h, but is + defined there only when __KERNEL__ is defined. We reproduce it here for + our use at the user level in order to locate the ucontext record, which + appears to be at this offset relative to the stack pointer when in the + context of the signal handler return trampoline code - + __kernel_sigtramp_rt64. */ +#define __SIGNAL_FRAMESIZE 128 + +/* This definition comes from the document "64-bit PowerPC ELF Application + Binary Interface Supplement 1.9", section 3.2.2. + http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK */ + +typedef struct +{ + long unsigned back_chain; + long unsigned lr_save; + /* many more fields here, but they are unused by this code */ +} stack_frame_t; + + +PROTECTED int +unw_step (unw_cursor_t * cursor) +{ + struct cursor *c = (struct cursor *) cursor; + stack_frame_t dummy; + unw_word_t back_chain_offset, lr_save_offset; + struct dwarf_loc back_chain_loc, lr_save_loc, sp_loc, ip_loc; + int ret; + + Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->dwarf.ip); + + if (c->dwarf.ip == 0) + { + /* Unless the cursor or stack is corrupt or uninitialized, + we've most likely hit the top of the stack */ + return 0; + } + + /* Try DWARF-based unwinding... */ + + ret = dwarf_step (&c->dwarf); + + if (ret < 0 && ret != -UNW_ENOINFO) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + if (unlikely (ret < 0)) + { + if (likely (!unw_is_signal_frame (cursor))) + { + /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode + produces the mandatory level of traceback record in the code, but + I get the impression that this is transitory, that eventually gcc + will not produce any traceback records at all. So, for now, we + won't bother to try to find and use these records. + + We can, however, attempt to unwind the frame by using the callback + chain. This is very crude, however, and won't be able to unwind + any registers besides the IP, SP, and LR . */ + + back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy); + lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy); + + back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0); + + if ((ret = + dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0) + { + Debug + ("Unable to retrieve CFA from back chain in stack frame - %d\n", + ret); + return ret; + } + if (c->dwarf.cfa == 0) + /* Unless the cursor or stack is corrupt or uninitialized we've most + likely hit the top of the stack */ + return 0; + + lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0); + + if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0) + { + Debug + ("Unable to retrieve IP from lr save in stack frame - %d\n", + ret); + return ret; + } + ret = 1; + } + else + { + /* Find the sigcontext record by taking the CFA and adjusting by + the dummy signal frame size. + + Note that there isn't any way to determined if SA_SIGINFO was + set in the sa_flags parameter to sigaction when the signal + handler was established. If it was not set, the ucontext + record is not required to be on the stack, in which case the + following code will likely cause a seg fault or other crash + condition. */ + + unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE; + + Debug (1, "signal frame, skip over trampoline\n"); + + c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = ucontext; + + sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); + + ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + /* Instead of just restoring the non-volatile registers, do all + of the registers for now. This will incur a performance hit, + but it's rare enough not to cause too much of a problem, and + might be useful in some cases. */ + c->dwarf.loc[UNW_PPC32_R0] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0); + c->dwarf.loc[UNW_PPC32_R1] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + c->dwarf.loc[UNW_PPC32_R2] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0); + c->dwarf.loc[UNW_PPC32_R3] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0); + c->dwarf.loc[UNW_PPC32_R4] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0); + c->dwarf.loc[UNW_PPC32_R5] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0); + c->dwarf.loc[UNW_PPC32_R6] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0); + c->dwarf.loc[UNW_PPC32_R7] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0); + c->dwarf.loc[UNW_PPC32_R8] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); + c->dwarf.loc[UNW_PPC32_R9] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); + c->dwarf.loc[UNW_PPC32_R10] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); + c->dwarf.loc[UNW_PPC32_R11] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); + c->dwarf.loc[UNW_PPC32_R12] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); + c->dwarf.loc[UNW_PPC32_R13] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); + c->dwarf.loc[UNW_PPC32_R14] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); + c->dwarf.loc[UNW_PPC32_R15] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); + c->dwarf.loc[UNW_PPC32_R16] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0); + c->dwarf.loc[UNW_PPC32_R17] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0); + c->dwarf.loc[UNW_PPC32_R18] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0); + c->dwarf.loc[UNW_PPC32_R19] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0); + c->dwarf.loc[UNW_PPC32_R20] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0); + c->dwarf.loc[UNW_PPC32_R21] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0); + c->dwarf.loc[UNW_PPC32_R22] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0); + c->dwarf.loc[UNW_PPC32_R23] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0); + c->dwarf.loc[UNW_PPC32_R24] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0); + c->dwarf.loc[UNW_PPC32_R25] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0); + c->dwarf.loc[UNW_PPC32_R26] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0); + c->dwarf.loc[UNW_PPC32_R27] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0); + c->dwarf.loc[UNW_PPC32_R28] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0); + c->dwarf.loc[UNW_PPC32_R29] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0); + c->dwarf.loc[UNW_PPC32_R30] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0); + c->dwarf.loc[UNW_PPC32_R31] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0); + + c->dwarf.loc[UNW_PPC32_LR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); + c->dwarf.loc[UNW_PPC32_CTR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0); + + /* This CR0 assignment is probably wrong. There are 8 dwarf columns + assigned to the CR registers, but only one CR register in the + mcontext structure */ + c->dwarf.loc[UNW_PPC32_CCR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0); + c->dwarf.loc[UNW_PPC32_XER] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0); + + c->dwarf.loc[UNW_PPC32_F0] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0); + c->dwarf.loc[UNW_PPC32_F1] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0); + c->dwarf.loc[UNW_PPC32_F2] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0); + c->dwarf.loc[UNW_PPC32_F3] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0); + c->dwarf.loc[UNW_PPC32_F4] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0); + c->dwarf.loc[UNW_PPC32_F5] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0); + c->dwarf.loc[UNW_PPC32_F6] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0); + c->dwarf.loc[UNW_PPC32_F7] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0); + c->dwarf.loc[UNW_PPC32_F8] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0); + c->dwarf.loc[UNW_PPC32_F9] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0); + c->dwarf.loc[UNW_PPC32_F10] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0); + c->dwarf.loc[UNW_PPC32_F11] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0); + c->dwarf.loc[UNW_PPC32_F12] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0); + c->dwarf.loc[UNW_PPC32_F13] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0); + c->dwarf.loc[UNW_PPC32_F14] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0); + c->dwarf.loc[UNW_PPC32_F15] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0); + c->dwarf.loc[UNW_PPC32_F16] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0); + c->dwarf.loc[UNW_PPC32_F17] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0); + c->dwarf.loc[UNW_PPC32_F18] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0); + c->dwarf.loc[UNW_PPC32_F19] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0); + c->dwarf.loc[UNW_PPC32_F20] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0); + c->dwarf.loc[UNW_PPC32_F21] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0); + c->dwarf.loc[UNW_PPC32_F22] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0); + c->dwarf.loc[UNW_PPC32_F23] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0); + c->dwarf.loc[UNW_PPC32_F24] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0); + c->dwarf.loc[UNW_PPC32_F25] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0); + c->dwarf.loc[UNW_PPC32_F26] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0); + c->dwarf.loc[UNW_PPC32_F27] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0); + c->dwarf.loc[UNW_PPC32_F28] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0); + c->dwarf.loc[UNW_PPC32_F29] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0); + c->dwarf.loc[UNW_PPC32_F30] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0); + c->dwarf.loc[UNW_PPC32_F31] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0); + + ret = 1; + } + } + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Lglobal.c b/sdk/cpprt/linux/libunwind/src/ppc32/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Linit.c b/sdk/cpprt/linux/libunwind/src/ppc32/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Lregs.c b/sdk/cpprt/linux/libunwind/src/ppc32/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Lresume.c b/sdk/cpprt/linux/libunwind/src/ppc32/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Lstep.c b/sdk/cpprt/linux/libunwind/src/ppc32/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/Make-arch.in b/sdk/cpprt/linux/libunwind/src/ppc32/Make-arch.in new file mode 100644 index 0000000000..947dd5fa03 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/Make-arch.in @@ -0,0 +1,11 @@ +# Word size. +ELFW = 64 +# Does use dwarf2 unwind info. +dwarf_target = true + +libunwind_setjmp_OBJS += \ + $(arch)/longjmp.o \ + $(arch)/siglongjmp.o + +libunwind_OBJS_common += \ + $(arch)/is_fpreg.o diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/get_func_addr.c b/sdk/cpprt/linux/libunwind/src/ppc32/get_func_addr.c new file mode 100644 index 0000000000..14797c9bdf --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/get_func_addr.c @@ -0,0 +1,36 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +int +tdep_get_func_addr (unw_addr_space_t as, unw_word_t symbol_val_addr, + unw_word_t *real_func_addr) +{ + *real_func_addr = symbol_val_addr; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/init.h b/sdk/cpprt/linux/libunwind/src/ppc32/init.h new file mode 100644 index 0000000000..4cb919205d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/init.h @@ -0,0 +1,73 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* Here is the "common" init, for remote and local debuging" */ + +static inline int +common_init_ppc32 (struct cursor *c, unsigned use_prev_instr) +{ + int ret; + int i; + + for (i = UNW_PPC32_R0; i <= UNW_PPC32_R31; i++) { + c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i); + } + for (i = UNW_PPC32_F0; i <= UNW_PPC32_F31; i++) { + c->dwarf.loc[i] = DWARF_FPREG_LOC (&c->dwarf, i); + } + + c->dwarf.loc[UNW_PPC32_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_CTR); + c->dwarf.loc[UNW_PPC32_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_XER); + c->dwarf.loc[UNW_PPC32_CCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_CCR); + c->dwarf.loc[UNW_PPC32_LR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_LR); + c->dwarf.loc[UNW_PPC32_FPSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC32_FPSCR); + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_PPC32_LR], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC32_R1), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + c->sigcontext_format = PPC_SCF_NONE; + c->sigcontext_addr = 0; + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/is_fpreg.c b/sdk/cpprt/linux/libunwind/src/ppc32/is_fpreg.c new file mode 100644 index 0000000000..cccc5112bc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/is_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_is_fpreg (int regnum) +{ + return (regnum >= UNW_PPC32_F0 && regnum <= UNW_PPC32_F31); +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/regname.c b/sdk/cpprt/linux/libunwind/src/ppc32/regname.c new file mode 100644 index 0000000000..79ba88aa56 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/regname.c @@ -0,0 +1,112 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static const char *regname[] = + { + [UNW_PPC32_R0]="GPR0", + [UNW_PPC32_R1]="GPR1", + [UNW_PPC32_R2]="GPR2", + [UNW_PPC32_R3]="GPR3", + [UNW_PPC32_R4]="GPR4", + [UNW_PPC32_R5]="GPR5", + [UNW_PPC32_R6]="GPR6", + [UNW_PPC32_R7]="GPR7", + [UNW_PPC32_R8]="GPR8", + [UNW_PPC32_R9]="GPR9", + [UNW_PPC32_R10]="GPR10", + [UNW_PPC32_R11]="GPR11", + [UNW_PPC32_R12]="GPR12", + [UNW_PPC32_R13]="GPR13", + [UNW_PPC32_R14]="GPR14", + [UNW_PPC32_R15]="GPR15", + [UNW_PPC32_R16]="GPR16", + [UNW_PPC32_R17]="GPR17", + [UNW_PPC32_R18]="GPR18", + [UNW_PPC32_R19]="GPR19", + [UNW_PPC32_R20]="GPR20", + [UNW_PPC32_R21]="GPR21", + [UNW_PPC32_R22]="GPR22", + [UNW_PPC32_R23]="GPR23", + [UNW_PPC32_R24]="GPR24", + [UNW_PPC32_R25]="GPR25", + [UNW_PPC32_R26]="GPR26", + [UNW_PPC32_R27]="GPR27", + [UNW_PPC32_R28]="GPR28", + [UNW_PPC32_R29]="GPR29", + [UNW_PPC32_R30]="GPR30", + [UNW_PPC32_R31]="GPR31", + + [UNW_PPC32_CTR]="CTR", + [UNW_PPC32_XER]="XER", + [UNW_PPC32_CCR]="CCR", + [UNW_PPC32_LR]="LR", + [UNW_PPC32_FPSCR]="FPSCR", + + [UNW_PPC32_F0]="FPR0", + [UNW_PPC32_F1]="FPR1", + [UNW_PPC32_F2]="FPR2", + [UNW_PPC32_F3]="FPR3", + [UNW_PPC32_F4]="FPR4", + [UNW_PPC32_F5]="FPR5", + [UNW_PPC32_F6]="FPR6", + [UNW_PPC32_F7]="FPR7", + [UNW_PPC32_F8]="FPR8", + [UNW_PPC32_F9]="FPR9", + [UNW_PPC32_F10]="FPR10", + [UNW_PPC32_F11]="FPR11", + [UNW_PPC32_F12]="FPR12", + [UNW_PPC32_F13]="FPR13", + [UNW_PPC32_F14]="FPR14", + [UNW_PPC32_F15]="FPR15", + [UNW_PPC32_F16]="FPR16", + [UNW_PPC32_F17]="FPR17", + [UNW_PPC32_F18]="FPR18", + [UNW_PPC32_F19]="FPR19", + [UNW_PPC32_F20]="FPR20", + [UNW_PPC32_F21]="FPR21", + [UNW_PPC32_F22]="FPR22", + [UNW_PPC32_F23]="FPR23", + [UNW_PPC32_F24]="FPR24", + [UNW_PPC32_F25]="FPR25", + [UNW_PPC32_F26]="FPR26", + [UNW_PPC32_F27]="FPR27", + [UNW_PPC32_F28]="FPR28", + [UNW_PPC32_F29]="FPR29", + [UNW_PPC32_F30]="FPR30", + [UNW_PPC32_F31]="FPR31" +}; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/setcontext.S b/sdk/cpprt/linux/libunwind/src/ppc32/setcontext.S new file mode 100644 index 0000000000..b54378a9dc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/setcontext.S @@ -0,0 +1,9 @@ + .global _UI_setcontext + +_UI_setcontext: + retq + +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/ucontext_i.h b/sdk/cpprt/linux/libunwind/src/ppc32/ucontext_i.h new file mode 100644 index 0000000000..52c3dc7e23 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/ucontext_i.h @@ -0,0 +1,128 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef ucontext_i_h +#define ucontext_i_h + +#include + +/* These values were derived by reading + /usr/src/linux-2.6.18-1.8/arch/um/include/sysdep-ppc/ptrace.h and + /usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h +*/ + +//#define NIP_IDX 32 +#define CTR_IDX 32 +#define XER_IDX 33 +#define CCR_IDX 34 +#define MSR_IDX 35 +//#define MQ_IDX 36 +#define LINK_IDX 36 + +/* These are dummy structures used only for obtaining the offsets of the + various structure members. */ +static ucontext_t dmy_ctxt; +static vrregset_t dmy_vrregset; + +#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[0] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[1] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[2] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[3] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[4] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[5] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[6] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[7] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[8] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[9] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[10] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[11] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[12] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[13] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[14] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[15] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[16] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[17] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[18] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[19] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[20] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[21] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[22] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[23] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[24] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[25] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[26] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[27] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[28] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[29] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[30] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[31] - (void *)&dmy_ctxt) + +#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[MSR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[CTR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[LINK_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[XER_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[CCR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[SOFTE_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[TRAP_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[DAR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[DSISR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[RESULT_IDX] - (void *)&dmy_ctxt) + +#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[0] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[1] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[2] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[3] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[4] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[5] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[6] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[7] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[8] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[9] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[10] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[11] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[12] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[13] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[14] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[15] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[16] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[17] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[18] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[19] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[20] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[21] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[22] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[23] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[24] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[25] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[26] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[27] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[28] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[29] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[30] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[31] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[32] - (void *)&dmy_ctxt) + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc32/unwind_i.h b/sdk/cpprt/linux/libunwind/src/ppc32/unwind_i.h new file mode 100644 index 0000000000..c3c3a57f76 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc32/unwind_i.h @@ -0,0 +1,47 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include +#include + +#define ppc32_lock UNW_OBJ(lock) +#define ppc32_local_resume UNW_OBJ(local_resume) +#define ppc32_local_addr_space_init UNW_OBJ(local_addr_space_init) + +extern void ppc32_local_addr_space_init (void); +extern int ppc32_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Gglobal.c b/sdk/cpprt/linux/libunwind/src/ppc64/Gglobal.c new file mode 100644 index 0000000000..64813571b9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Gglobal.c @@ -0,0 +1,182 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN pthread_mutex_t ppc64_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +/* The API register numbers are exactly the same as the .eh_frame + registers, for now at least. */ +uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] = + { + [UNW_PPC64_R0]=UNW_PPC64_R0, + [UNW_PPC64_R1]=UNW_PPC64_R1, + [UNW_PPC64_R2]=UNW_PPC64_R2, + [UNW_PPC64_R3]=UNW_PPC64_R3, + [UNW_PPC64_R4]=UNW_PPC64_R4, + [UNW_PPC64_R5]=UNW_PPC64_R5, + [UNW_PPC64_R6]=UNW_PPC64_R6, + [UNW_PPC64_R7]=UNW_PPC64_R7, + [UNW_PPC64_R8]=UNW_PPC64_R8, + [UNW_PPC64_R9]=UNW_PPC64_R9, + [UNW_PPC64_R10]=UNW_PPC64_R10, + [UNW_PPC64_R11]=UNW_PPC64_R11, + [UNW_PPC64_R12]=UNW_PPC64_R12, + [UNW_PPC64_R13]=UNW_PPC64_R13, + [UNW_PPC64_R14]=UNW_PPC64_R14, + [UNW_PPC64_R15]=UNW_PPC64_R15, + [UNW_PPC64_R16]=UNW_PPC64_R16, + [UNW_PPC64_R17]=UNW_PPC64_R17, + [UNW_PPC64_R18]=UNW_PPC64_R18, + [UNW_PPC64_R19]=UNW_PPC64_R19, + [UNW_PPC64_R20]=UNW_PPC64_R20, + [UNW_PPC64_R21]=UNW_PPC64_R21, + [UNW_PPC64_R22]=UNW_PPC64_R22, + [UNW_PPC64_R23]=UNW_PPC64_R23, + [UNW_PPC64_R24]=UNW_PPC64_R24, + [UNW_PPC64_R25]=UNW_PPC64_R25, + [UNW_PPC64_R26]=UNW_PPC64_R26, + [UNW_PPC64_R27]=UNW_PPC64_R27, + [UNW_PPC64_R28]=UNW_PPC64_R28, + [UNW_PPC64_R29]=UNW_PPC64_R29, + [UNW_PPC64_R30]=UNW_PPC64_R30, + [UNW_PPC64_R31]=UNW_PPC64_R31, + + [UNW_PPC64_F0]=UNW_PPC64_F0, + [UNW_PPC64_F1]=UNW_PPC64_F1, + [UNW_PPC64_F2]=UNW_PPC64_F2, + [UNW_PPC64_F3]=UNW_PPC64_F3, + [UNW_PPC64_F4]=UNW_PPC64_F4, + [UNW_PPC64_F5]=UNW_PPC64_F5, + [UNW_PPC64_F6]=UNW_PPC64_F6, + [UNW_PPC64_F7]=UNW_PPC64_F7, + [UNW_PPC64_F8]=UNW_PPC64_F8, + [UNW_PPC64_F9]=UNW_PPC64_F9, + [UNW_PPC64_F10]=UNW_PPC64_F10, + [UNW_PPC64_F11]=UNW_PPC64_F11, + [UNW_PPC64_F12]=UNW_PPC64_F12, + [UNW_PPC64_F13]=UNW_PPC64_F13, + [UNW_PPC64_F14]=UNW_PPC64_F14, + [UNW_PPC64_F15]=UNW_PPC64_F15, + [UNW_PPC64_F16]=UNW_PPC64_F16, + [UNW_PPC64_F17]=UNW_PPC64_F17, + [UNW_PPC64_F18]=UNW_PPC64_F18, + [UNW_PPC64_F19]=UNW_PPC64_F19, + [UNW_PPC64_F20]=UNW_PPC64_F20, + [UNW_PPC64_F21]=UNW_PPC64_F21, + [UNW_PPC64_F22]=UNW_PPC64_F22, + [UNW_PPC64_F23]=UNW_PPC64_F23, + [UNW_PPC64_F24]=UNW_PPC64_F24, + [UNW_PPC64_F25]=UNW_PPC64_F25, + [UNW_PPC64_F26]=UNW_PPC64_F26, + [UNW_PPC64_F27]=UNW_PPC64_F27, + [UNW_PPC64_F28]=UNW_PPC64_F28, + [UNW_PPC64_F29]=UNW_PPC64_F29, + [UNW_PPC64_F30]=UNW_PPC64_F30, + [UNW_PPC64_F31]=UNW_PPC64_F31, + + [UNW_PPC64_LR]=UNW_PPC64_LR, + [UNW_PPC64_CTR]=UNW_PPC64_CTR, + [UNW_PPC64_ARG_POINTER]=UNW_PPC64_ARG_POINTER, + + [UNW_PPC64_CR0]=UNW_PPC64_CR0, + [UNW_PPC64_CR1]=UNW_PPC64_CR1, + [UNW_PPC64_CR2]=UNW_PPC64_CR2, + [UNW_PPC64_CR3]=UNW_PPC64_CR3, + [UNW_PPC64_CR4]=UNW_PPC64_CR4, + [UNW_PPC64_CR5]=UNW_PPC64_CR5, + [UNW_PPC64_CR6]=UNW_PPC64_CR6, + [UNW_PPC64_CR7]=UNW_PPC64_CR7, + + [UNW_PPC64_XER]=UNW_PPC64_XER, + + [UNW_PPC64_V0]=UNW_PPC64_V0, + [UNW_PPC64_V1]=UNW_PPC64_V1, + [UNW_PPC64_V2]=UNW_PPC64_V2, + [UNW_PPC64_V3]=UNW_PPC64_V3, + [UNW_PPC64_V4]=UNW_PPC64_V4, + [UNW_PPC64_V5]=UNW_PPC64_V5, + [UNW_PPC64_V6]=UNW_PPC64_V6, + [UNW_PPC64_V7]=UNW_PPC64_V7, + [UNW_PPC64_V8]=UNW_PPC64_V8, + [UNW_PPC64_V9]=UNW_PPC64_V9, + [UNW_PPC64_V10]=UNW_PPC64_V10, + [UNW_PPC64_V11]=UNW_PPC64_V11, + [UNW_PPC64_V12]=UNW_PPC64_V12, + [UNW_PPC64_V13]=UNW_PPC64_V13, + [UNW_PPC64_V14]=UNW_PPC64_V14, + [UNW_PPC64_V15]=UNW_PPC64_V15, + [UNW_PPC64_V16]=UNW_PPC64_V16, + [UNW_PPC64_V17]=UNW_PPC64_V17, + [UNW_PPC64_V18]=UNW_PPC64_V18, + [UNW_PPC64_V19]=UNW_PPC64_V19, + [UNW_PPC64_V20]=UNW_PPC64_V20, + [UNW_PPC64_V21]=UNW_PPC64_V21, + [UNW_PPC64_V22]=UNW_PPC64_V22, + [UNW_PPC64_V23]=UNW_PPC64_V23, + [UNW_PPC64_V24]=UNW_PPC64_V24, + [UNW_PPC64_V25]=UNW_PPC64_V25, + [UNW_PPC64_V26]=UNW_PPC64_V26, + [UNW_PPC64_V27]=UNW_PPC64_V27, + [UNW_PPC64_V28]=UNW_PPC64_V28, + [UNW_PPC64_V29]=UNW_PPC64_V29, + [UNW_PPC64_V30]=UNW_PPC64_V30, + [UNW_PPC64_V31]=UNW_PPC64_V31, + + [UNW_PPC64_VRSAVE]=UNW_PPC64_VRSAVE, + [UNW_PPC64_VSCR]=UNW_PPC64_VSCR, + [UNW_PPC64_SPE_ACC]=UNW_PPC64_SPE_ACC, + [UNW_PPC64_SPEFSCR]=UNW_PPC64_SPEFSCR, + }; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + + lock_acquire (&ppc64_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + ppc64_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&ppc64_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Ginit.c b/sdk/cpprt/linux/libunwind/src/ppc64/Ginit.c new file mode 100644 index 0000000000..97c9d78cbd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Ginit.c @@ -0,0 +1,230 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "ucontext_i.h" +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + + +#define PAGE_SIZE 4096 +#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) + + +static void * +uc_addr (ucontext_t *uc, int reg) +{ + void *addr; + + if ((unsigned) (reg - UNW_PPC64_R0) < 32) + addr = &uc->uc_mcontext.gp_regs[reg - UNW_PPC64_R0]; + + else if ((unsigned) (reg - UNW_PPC64_F0) < 32) + addr = &uc->uc_mcontext.fp_regs[reg - UNW_PPC64_F0]; + + else if ((unsigned) (reg - UNW_PPC64_V0) < 32) + addr = (uc->uc_mcontext.v_regs == 0) ? NULL : &uc->uc_mcontext.v_regs->vrregs[reg - UNW_PPC64_V0][0]; + + else + { + unsigned gregs_idx; + + switch (reg) + { + case UNW_PPC64_NIP: + gregs_idx = NIP_IDX; + break; + case UNW_PPC64_CTR: + gregs_idx = CTR_IDX; + break; + case UNW_PPC64_LR: + gregs_idx = LINK_IDX; + break; + case UNW_PPC64_XER: + gregs_idx = XER_IDX; + break; + case UNW_PPC64_CR0: + gregs_idx = CCR_IDX; + break; + default: + return NULL; + } + addr = &uc->uc_mcontext.gp_regs[gregs_idx]; + } + return addr; +} + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg) +{ + return uc_addr (uc, reg); +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (12, "mem[%lx] <- %lx\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "mem[%lx] -> %lx\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, + int write, void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = arg; + + if ((unsigned int) (reg - UNW_PPC64_F0) < 32) + goto badreg; + if ((unsigned int) (reg - UNW_PPC64_V0) < 32) + goto badreg; + + addr = uc_addr (uc, reg); + if (!addr) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- %lx\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %lx\n", unw_regname (reg), *val); + } + return 0; + +badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if ((unsigned) (reg - UNW_PPC64_F0) < 0) + goto badreg; + + if ((unsigned) (reg - UNW_PPC64_V0) >= 32) + goto badreg; + + + addr = uc_addr (uc, reg); + if (!addr) + goto badreg; + + if (write) + { + Debug (12, "%s <- %016Lf\n", unw_regname (reg), *val); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %016Lf\n", unw_regname (reg), *val); + } + return 0; + +badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +ppc64_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = ppc64_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Gregs.c b/sdk/cpprt/linux/libunwind/src/ppc64/Gregs.c new file mode 100644 index 0000000000..b044504b44 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Gregs.c @@ -0,0 +1,100 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + struct dwarf_loc loc; + + switch (reg) + { + case UNW_TDEP_IP: + if (write) + { + c->dwarf.ip = *valp; /* update the IP cache */ + if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip + || *valp >= c->dwarf.pi.end_ip)) + c->dwarf.pi_valid = 0; /* new IP outside of current proc */ + } + else + *valp = c->dwarf.ip; + return 0; + + case UNW_TDEP_SP: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + + default: + break; + } + + /* make sure it's not an FP or VR register */ + if ((((unsigned) (reg - UNW_PPC64_F0)) <= 31) || + (((unsigned) (reg - UNW_PPC64_V0)) <= 31)) + return -UNW_EBADREG; + + loc = c->dwarf.loc[reg]; + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + struct dwarf_loc loc; + + if ((unsigned) (reg - UNW_PPC64_F0) < 32) + { + loc = c->dwarf.loc[reg]; + if (write) + return dwarf_putfp (&c->dwarf, loc, *valp); + else + return dwarf_getfp (&c->dwarf, loc, valp); + } + else + if ((unsigned) (reg - UNW_PPC64_V0) < 32) + { + loc = c->dwarf.loc[reg]; + if (write) + return dwarf_putvr (&c->dwarf, loc, *valp); + else + return dwarf_getvr (&c->dwarf, loc, valp); + } + + return -UNW_EBADREG; +} + diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Gresume.c b/sdk/cpprt/linux/libunwind/src/ppc64/Gresume.c new file mode 100644 index 0000000000..893ea63c50 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Gresume.c @@ -0,0 +1,77 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford cjashfor@us.ibm.com + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +#ifndef UNW_REMOTE_ONLY + +#include + +/* sigreturn() is a no-op on x86_64 glibc. */ + +static NORETURN inline long +my_rt_sigreturn (void *new_sp) +{ + /* XXX: empty stub. */ + abort (); +} + +HIDDEN inline int +ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + /* XXX: empty stub. */ + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +/* This routine is responsible for copying the register values in + cursor C and establishing them as the current machine state. */ + +static inline int +establish_machine_state (struct cursor *c) +{ + /* XXX: empty stub. */ + return 0; +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + if ((ret = establish_machine_state (c)) < 0) + return ret; + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Gstep.c b/sdk/cpprt/linux/libunwind/src/ppc64/Gstep.c new file mode 100644 index 0000000000..20b22b51cc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Gstep.c @@ -0,0 +1,436 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "ucontext_i.h" +#include + +/* This definition originates in /usr/include/asm-ppc64/ptrace.h, but is + defined there only when __KERNEL__ is defined. We reproduce it here for + our use at the user level in order to locate the ucontext record, which + appears to be at this offset relative to the stack pointer when in the + context of the signal handler return trampoline code - + __kernel_sigtramp_rt64. */ +#define __SIGNAL_FRAMESIZE 128 + +/* This definition comes from the document "64-bit PowerPC ELF Application + Binary Interface Supplement 1.9", section 3.2.2. + http://www.linux-foundation.org/spec/ELF/ppc64/PPC-elf64abi-1.9.html#STACK */ + +typedef struct +{ + long unsigned back_chain; + long unsigned cr_save; + long unsigned lr_save; + /* many more fields here, but they are unused by this code */ +} stack_frame_t; + + +PROTECTED int +unw_step (unw_cursor_t * cursor) +{ + struct cursor *c = (struct cursor *) cursor; + stack_frame_t dummy; + unw_word_t back_chain_offset, lr_save_offset, v_regs_ptr; + struct dwarf_loc back_chain_loc, lr_save_loc, sp_loc, ip_loc, v_regs_loc; + int ret; + + Debug (1, "(cursor=%p, ip=0x%016lx)\n", c, (unsigned long) c->dwarf.ip); + + if (c->dwarf.ip == 0) + { + /* Unless the cursor or stack is corrupt or uninitialized, + we've most likely hit the top of the stack */ + return 0; + } + + /* Try DWARF-based unwinding... */ + + ret = dwarf_step (&c->dwarf); + + if (ret < 0 && ret != -UNW_ENOINFO) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + if (unlikely (ret < 0)) + { + if (likely (!unw_is_signal_frame (cursor))) + { + /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode + produces the mandatory level of traceback record in the code, but + I get the impression that this is transitory, that eventually gcc + will not produce any traceback records at all. So, for now, we + won't bother to try to find and use these records. + + We can, however, attempt to unwind the frame by using the callback + chain. This is very crude, however, and won't be able to unwind + any registers besides the IP, SP, and LR . */ + + back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy); + lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy); + + back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0); + + if ((ret = + dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0) + { + Debug + ("Unable to retrieve CFA from back chain in stack frame - %d\n", + ret); + return ret; + } + if (c->dwarf.cfa == 0) + /* Unless the cursor or stack is corrupt or uninitialized we've most + likely hit the top of the stack */ + return 0; + + lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0); + + if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0) + { + Debug + ("Unable to retrieve IP from lr save in stack frame - %d\n", + ret); + return ret; + } + ret = 1; + } + else + { + /* Find the sigcontext record by taking the CFA and adjusting by + the dummy signal frame size. + + Note that there isn't any way to determined if SA_SIGINFO was + set in the sa_flags parameter to sigaction when the signal + handler was established. If it was not set, the ucontext + record is not required to be on the stack, in which case the + following code will likely cause a seg fault or other crash + condition. */ + + unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE; + + Debug (1, "signal frame, skip over trampoline\n"); + + c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = ucontext; + + sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0); + + ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + /* Instead of just restoring the non-volatile registers, do all + of the registers for now. This will incur a performance hit, + but it's rare enough not to cause too much of a problem, and + might be useful in some cases. */ + c->dwarf.loc[UNW_PPC64_R0] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0); + c->dwarf.loc[UNW_PPC64_R1] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + c->dwarf.loc[UNW_PPC64_R2] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0); + c->dwarf.loc[UNW_PPC64_R3] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0); + c->dwarf.loc[UNW_PPC64_R4] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0); + c->dwarf.loc[UNW_PPC64_R5] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0); + c->dwarf.loc[UNW_PPC64_R6] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0); + c->dwarf.loc[UNW_PPC64_R7] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0); + c->dwarf.loc[UNW_PPC64_R8] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); + c->dwarf.loc[UNW_PPC64_R9] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); + c->dwarf.loc[UNW_PPC64_R10] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); + c->dwarf.loc[UNW_PPC64_R11] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); + c->dwarf.loc[UNW_PPC64_R12] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); + c->dwarf.loc[UNW_PPC64_R13] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); + c->dwarf.loc[UNW_PPC64_R14] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); + c->dwarf.loc[UNW_PPC64_R15] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); + c->dwarf.loc[UNW_PPC64_R16] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0); + c->dwarf.loc[UNW_PPC64_R17] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0); + c->dwarf.loc[UNW_PPC64_R18] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0); + c->dwarf.loc[UNW_PPC64_R19] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0); + c->dwarf.loc[UNW_PPC64_R20] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0); + c->dwarf.loc[UNW_PPC64_R21] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0); + c->dwarf.loc[UNW_PPC64_R22] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0); + c->dwarf.loc[UNW_PPC64_R23] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0); + c->dwarf.loc[UNW_PPC64_R24] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0); + c->dwarf.loc[UNW_PPC64_R25] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0); + c->dwarf.loc[UNW_PPC64_R26] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0); + c->dwarf.loc[UNW_PPC64_R27] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0); + c->dwarf.loc[UNW_PPC64_R28] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0); + c->dwarf.loc[UNW_PPC64_R29] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0); + c->dwarf.loc[UNW_PPC64_R30] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0); + c->dwarf.loc[UNW_PPC64_R31] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0); + + c->dwarf.loc[UNW_PPC64_LR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); + c->dwarf.loc[UNW_PPC64_CTR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0); + /* This CR0 assignment is probably wrong. There are 8 dwarf columns + assigned to the CR registers, but only one CR register in the + mcontext structure */ + c->dwarf.loc[UNW_PPC64_CR0] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0); + c->dwarf.loc[UNW_PPC64_XER] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0); + c->dwarf.loc[UNW_PPC64_NIP] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0); + + /* TODO: Is there a way of obtaining the value of the + pseudo frame pointer (which is sp + some fixed offset, I + assume), based on the contents of the ucontext record + structure? For now, set this loc to null. */ + c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC; + + c->dwarf.loc[UNW_PPC64_F0] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0); + c->dwarf.loc[UNW_PPC64_F1] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0); + c->dwarf.loc[UNW_PPC64_F2] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0); + c->dwarf.loc[UNW_PPC64_F3] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0); + c->dwarf.loc[UNW_PPC64_F4] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0); + c->dwarf.loc[UNW_PPC64_F5] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0); + c->dwarf.loc[UNW_PPC64_F6] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0); + c->dwarf.loc[UNW_PPC64_F7] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0); + c->dwarf.loc[UNW_PPC64_F8] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0); + c->dwarf.loc[UNW_PPC64_F9] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0); + c->dwarf.loc[UNW_PPC64_F10] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0); + c->dwarf.loc[UNW_PPC64_F11] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0); + c->dwarf.loc[UNW_PPC64_F12] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0); + c->dwarf.loc[UNW_PPC64_F13] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0); + c->dwarf.loc[UNW_PPC64_F14] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0); + c->dwarf.loc[UNW_PPC64_F15] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0); + c->dwarf.loc[UNW_PPC64_F16] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0); + c->dwarf.loc[UNW_PPC64_F17] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0); + c->dwarf.loc[UNW_PPC64_F18] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0); + c->dwarf.loc[UNW_PPC64_F19] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0); + c->dwarf.loc[UNW_PPC64_F20] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0); + c->dwarf.loc[UNW_PPC64_F21] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0); + c->dwarf.loc[UNW_PPC64_F22] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0); + c->dwarf.loc[UNW_PPC64_F23] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0); + c->dwarf.loc[UNW_PPC64_F24] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0); + c->dwarf.loc[UNW_PPC64_F25] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0); + c->dwarf.loc[UNW_PPC64_F26] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0); + c->dwarf.loc[UNW_PPC64_F27] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0); + c->dwarf.loc[UNW_PPC64_F28] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0); + c->dwarf.loc[UNW_PPC64_F29] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0); + c->dwarf.loc[UNW_PPC64_F30] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0); + c->dwarf.loc[UNW_PPC64_F31] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0); + /* Note that there is no .eh_section register column for the + FPSCR register. I don't know why this is. */ + + v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0); + ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + if (v_regs_ptr != 0) + { + /* The v_regs_ptr is not null. Set all of the AltiVec locs */ + + c->dwarf.loc[UNW_PPC64_V0] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0); + c->dwarf.loc[UNW_PPC64_V1] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0); + c->dwarf.loc[UNW_PPC64_V2] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0); + c->dwarf.loc[UNW_PPC64_V3] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0); + c->dwarf.loc[UNW_PPC64_V4] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0); + c->dwarf.loc[UNW_PPC64_V5] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0); + c->dwarf.loc[UNW_PPC64_V6] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0); + c->dwarf.loc[UNW_PPC64_V7] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0); + c->dwarf.loc[UNW_PPC64_V8] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0); + c->dwarf.loc[UNW_PPC64_V9] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0); + c->dwarf.loc[UNW_PPC64_V10] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0); + c->dwarf.loc[UNW_PPC64_V11] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0); + c->dwarf.loc[UNW_PPC64_V12] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0); + c->dwarf.loc[UNW_PPC64_V13] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0); + c->dwarf.loc[UNW_PPC64_V14] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0); + c->dwarf.loc[UNW_PPC64_V15] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0); + c->dwarf.loc[UNW_PPC64_V16] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0); + c->dwarf.loc[UNW_PPC64_V17] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0); + c->dwarf.loc[UNW_PPC64_V18] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0); + c->dwarf.loc[UNW_PPC64_V19] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0); + c->dwarf.loc[UNW_PPC64_V20] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0); + c->dwarf.loc[UNW_PPC64_V21] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0); + c->dwarf.loc[UNW_PPC64_V22] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0); + c->dwarf.loc[UNW_PPC64_V23] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0); + c->dwarf.loc[UNW_PPC64_V24] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0); + c->dwarf.loc[UNW_PPC64_V25] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0); + c->dwarf.loc[UNW_PPC64_V26] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0); + c->dwarf.loc[UNW_PPC64_V27] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0); + c->dwarf.loc[UNW_PPC64_V28] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0); + c->dwarf.loc[UNW_PPC64_V29] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0); + c->dwarf.loc[UNW_PPC64_V30] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0); + c->dwarf.loc[UNW_PPC64_V31] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0); + c->dwarf.loc[UNW_PPC64_VRSAVE] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0); + c->dwarf.loc[UNW_PPC64_VSCR] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0); + } + else + { + c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC; + } + ret = 1; + } + } + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Lglobal.c b/sdk/cpprt/linux/libunwind/src/ppc64/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Linit.c b/sdk/cpprt/linux/libunwind/src/ppc64/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Lregs.c b/sdk/cpprt/linux/libunwind/src/ppc64/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Lresume.c b/sdk/cpprt/linux/libunwind/src/ppc64/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/Lstep.c b/sdk/cpprt/linux/libunwind/src/ppc64/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/get_func_addr.c b/sdk/cpprt/linux/libunwind/src/ppc64/get_func_addr.c new file mode 100644 index 0000000000..a9c828dc3e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/get_func_addr.c @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +int +tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, + unw_word_t *entry_point) +{ + unw_accessors_t *a; + int ret; + + a = unw_get_accessors (as); + /* Entry-point is stored in the 1st word of the function descriptor. + In case that changes in the future, we'd have to update the line + below and read the word at addr + offset: */ + ret = (*a->access_mem) (as, addr, entry_point, 0, NULL); + if (ret < 0) + return ret; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/init.h b/sdk/cpprt/linux/libunwind/src/ppc64/init.h new file mode 100644 index 0000000000..7503a7c70c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/init.h @@ -0,0 +1,83 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static inline int +common_init_ppc64 (struct cursor *c, unsigned use_prev_instr) +{ + int ret; + int i; + + for (i = UNW_PPC64_R0; i <= UNW_PPC64_R31; i++) { + c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i); + } + for (i = UNW_PPC64_F0; i <= UNW_PPC64_F31; i++) { + c->dwarf.loc[i] = DWARF_FPREG_LOC (&c->dwarf, i); + } + for (i = UNW_PPC64_V0; i <= UNW_PPC64_V31; i++) { + c->dwarf.loc[i] = DWARF_VREG_LOC (&c->dwarf, i); + } + + for (i = UNW_PPC64_CR0; i <= UNW_PPC64_CR7; i++) { + c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i); + } + c->dwarf.loc[UNW_PPC64_ARG_POINTER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_ARG_POINTER); + c->dwarf.loc[UNW_PPC64_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_CTR); + c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VSCR); + + c->dwarf.loc[UNW_PPC64_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_XER); + c->dwarf.loc[UNW_PPC64_LR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_LR); + c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VRSAVE); + c->dwarf.loc[UNW_PPC64_SPEFSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPEFSCR); + c->dwarf.loc[UNW_PPC64_SPE_ACC] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPE_ACC); + + c->dwarf.loc[UNW_PPC64_NIP] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_NIP); + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_PPC64_NIP], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R1), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + c->sigcontext_format = PPC_SCF_NONE; + c->sigcontext_addr = 0; + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/is_fpreg.c b/sdk/cpprt/linux/libunwind/src/ppc64/is_fpreg.c new file mode 100644 index 0000000000..b34bf8715c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/is_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_is_fpreg (int regnum) +{ + return (regnum >= UNW_PPC64_F0 && regnum <= UNW_PPC64_F31); +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/regname.c b/sdk/cpprt/linux/libunwind/src/ppc64/regname.c new file mode 100644 index 0000000000..7d648347e2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/regname.c @@ -0,0 +1,161 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static const char *regname[] = + { + [UNW_PPC64_R0]="GPR0", + [UNW_PPC64_R1]="GPR1", + [UNW_PPC64_R2]="GPR2", + [UNW_PPC64_R3]="GPR3", + [UNW_PPC64_R4]="GPR4", + [UNW_PPC64_R5]="GPR5", + [UNW_PPC64_R6]="GPR6", + [UNW_PPC64_R7]="GPR7", + [UNW_PPC64_R8]="GPR8", + [UNW_PPC64_R9]="GPR9", + [UNW_PPC64_R10]="GPR10", + [UNW_PPC64_R11]="GPR11", + [UNW_PPC64_R12]="GPR12", + [UNW_PPC64_R13]="GPR13", + [UNW_PPC64_R14]="GPR14", + [UNW_PPC64_R15]="GPR15", + [UNW_PPC64_R16]="GPR16", + [UNW_PPC64_R17]="GPR17", + [UNW_PPC64_R18]="GPR18", + [UNW_PPC64_R19]="GPR19", + [UNW_PPC64_R20]="GPR20", + [UNW_PPC64_R21]="GPR21", + [UNW_PPC64_R22]="GPR22", + [UNW_PPC64_R23]="GPR23", + [UNW_PPC64_R24]="GPR24", + [UNW_PPC64_R25]="GPR25", + [UNW_PPC64_R26]="GPR26", + [UNW_PPC64_R27]="GPR27", + [UNW_PPC64_R28]="GPR28", + [UNW_PPC64_R29]="GPR29", + [UNW_PPC64_R30]="GPR30", + [UNW_PPC64_R31]="GPR31", + + [UNW_PPC64_F0]="FPR0", + [UNW_PPC64_F1]="FPR1", + [UNW_PPC64_F2]="FPR2", + [UNW_PPC64_F3]="FPR3", + [UNW_PPC64_F4]="FPR4", + [UNW_PPC64_F5]="FPR5", + [UNW_PPC64_F6]="FPR6", + [UNW_PPC64_F7]="FPR7", + [UNW_PPC64_F8]="FPR8", + [UNW_PPC64_F9]="FPR9", + [UNW_PPC64_F10]="FPR10", + [UNW_PPC64_F11]="FPR11", + [UNW_PPC64_F12]="FPR12", + [UNW_PPC64_F13]="FPR13", + [UNW_PPC64_F14]="FPR14", + [UNW_PPC64_F15]="FPR15", + [UNW_PPC64_F16]="FPR16", + [UNW_PPC64_F17]="FPR17", + [UNW_PPC64_F18]="FPR18", + [UNW_PPC64_F19]="FPR19", + [UNW_PPC64_F20]="FPR20", + [UNW_PPC64_F21]="FPR21", + [UNW_PPC64_F22]="FPR22", + [UNW_PPC64_F23]="FPR23", + [UNW_PPC64_F24]="FPR24", + [UNW_PPC64_F25]="FPR25", + [UNW_PPC64_F26]="FPR26", + [UNW_PPC64_F27]="FPR27", + [UNW_PPC64_F28]="FPR28", + [UNW_PPC64_F29]="FPR29", + [UNW_PPC64_F30]="FPR30", + [UNW_PPC64_F31]="FPR31", + + [UNW_PPC64_LR]="LR", + [UNW_PPC64_CTR]="CTR", + [UNW_PPC64_ARG_POINTER]="ARG_POINTER", + + [UNW_PPC64_CR0]="CR0", + [UNW_PPC64_CR1]="CR1", + [UNW_PPC64_CR2]="CR2", + [UNW_PPC64_CR3]="CR3", + [UNW_PPC64_CR4]="CR4", + [UNW_PPC64_CR5]="CR5", + [UNW_PPC64_CR6]="CR6", + [UNW_PPC64_CR7]="CR7", + + [UNW_PPC64_XER]="XER", + + [UNW_PPC64_V0]="VR0", + [UNW_PPC64_V1]="VR1", + [UNW_PPC64_V2]="VR2", + [UNW_PPC64_V3]="VR3", + [UNW_PPC64_V4]="VR4", + [UNW_PPC64_V5]="VR5", + [UNW_PPC64_V6]="VR6", + [UNW_PPC64_V7]="VR7", + [UNW_PPC64_V8]="VR8", + [UNW_PPC64_V9]="VR9", + [UNW_PPC64_V10]="VR10", + [UNW_PPC64_V11]="VR11", + [UNW_PPC64_V12]="VR12", + [UNW_PPC64_V13]="VR13", + [UNW_PPC64_V14]="VR14", + [UNW_PPC64_V15]="VR15", + [UNW_PPC64_V16]="VR16", + [UNW_PPC64_V17]="VR17", + [UNW_PPC64_V18]="VR18", + [UNW_PPC64_V19]="VR19", + [UNW_PPC64_V20]="VR20", + [UNW_PPC64_V21]="VR21", + [UNW_PPC64_V22]="VR22", + [UNW_PPC64_V23]="VR23", + [UNW_PPC64_V24]="VR24", + [UNW_PPC64_V25]="VR25", + [UNW_PPC64_V26]="VR26", + [UNW_PPC64_V27]="VR27", + [UNW_PPC64_V28]="VR28", + [UNW_PPC64_V29]="VR29", + [UNW_PPC64_V30]="VR30", + [UNW_PPC64_V31]="VR31", + + [UNW_PPC64_VSCR]="VSCR", + + [UNW_PPC64_VRSAVE]="VRSAVE", + [UNW_PPC64_SPE_ACC]="SPE_ACC", + [UNW_PPC64_SPEFSCR]="SPEFSCR", + + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/setcontext.S b/sdk/cpprt/linux/libunwind/src/ppc64/setcontext.S new file mode 100644 index 0000000000..b54378a9dc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/setcontext.S @@ -0,0 +1,9 @@ + .global _UI_setcontext + +_UI_setcontext: + retq + +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/ucontext_i.h b/sdk/cpprt/linux/libunwind/src/ppc64/ucontext_i.h new file mode 100644 index 0000000000..245d66768b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/ucontext_i.h @@ -0,0 +1,173 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef ucontext_i_h +#define ucontext_i_h + +#include + +/* These values were derived by reading + /usr/src/linux-2.6.18-1.8/arch/um/include/sysdep-ppc/ptrace.h and + /usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h +*/ + +#define NIP_IDX 32 +#define MSR_IDX 33 +#define ORIG_GPR3_IDX 34 +#define CTR_IDX 35 +#define LINK_IDX 36 +#define XER_IDX 37 +#define CCR_IDX 38 +#define SOFTE_IDX 39 +#define TRAP_IDX 40 +#define DAR_IDX 41 +#define DSISR_IDX 42 +#define RESULT_IDX 43 + +#define VSCR_IDX 32 +#define VRSAVE_IDX 33 + +/* These are dummy structures used only for obtaining the offsets of the + various structure members. */ +static ucontext_t dmy_ctxt; +static vrregset_t dmy_vrregset; + +#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[0] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[1] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[2] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[3] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[4] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[5] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[6] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[7] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[8] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[9] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[10] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[11] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[12] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[13] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[14] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[15] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[16] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[17] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[18] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[19] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[20] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[21] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[22] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[23] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[24] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[25] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[26] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[27] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[28] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[29] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[30] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[31] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_NIP ((void *)&dmy_ctxt.uc_mcontext.gp_regs[NIP_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[MSR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.uc_mcontext.gp_regs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[CTR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.uc_mcontext.gp_regs[LINK_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.uc_mcontext.gp_regs[XER_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[CCR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.uc_mcontext.gp_regs[SOFTE_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.uc_mcontext.gp_regs[TRAP_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[DAR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.uc_mcontext.gp_regs[DSISR_IDX] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.uc_mcontext.gp_regs[RESULT_IDX] - (void *)&dmy_ctxt) + +#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[0] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[1] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[2] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[3] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[4] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[5] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[6] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[7] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[8] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[9] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[10] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[11] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[12] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[13] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[14] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[15] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[16] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[17] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[18] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[19] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[20] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[21] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[22] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[23] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[24] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[25] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[26] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[27] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[28] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[29] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[30] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.fp_regs[31] - (void *)&dmy_ctxt) +#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.uc_mcontext.fp_regs[32] - (void *)&dmy_ctxt) + +#define UC_MCONTEXT_V_REGS ((void *)&dmy_ctxt.uc_mcontext.v_regs - (void *)&dmy_ctxt) + +#define UC_MCONTEXT_VREGS_R0 ((void *)&dmy_vrregset.vrregs[0] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R1 ((void *)&dmy_vrregset.vrregs[1] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R2 ((void *)&dmy_vrregset.vrregs[2] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R3 ((void *)&dmy_vrregset.vrregs[3] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R4 ((void *)&dmy_vrregset.vrregs[4] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R5 ((void *)&dmy_vrregset.vrregs[5] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R6 ((void *)&dmy_vrregset.vrregs[6] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R7 ((void *)&dmy_vrregset.vrregs[7] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R8 ((void *)&dmy_vrregset.vrregs[8] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R9 ((void *)&dmy_vrregset.vrregs[9] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R10 ((void *)&dmy_vrregset.vrregs[10] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R11 ((void *)&dmy_vrregset.vrregs[11] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R12 ((void *)&dmy_vrregset.vrregs[12] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R13 ((void *)&dmy_vrregset.vrregs[13] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R14 ((void *)&dmy_vrregset.vrregs[14] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R15 ((void *)&dmy_vrregset.vrregs[15] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R16 ((void *)&dmy_vrregset.vrregs[16] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R17 ((void *)&dmy_vrregset.vrregs[17] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R18 ((void *)&dmy_vrregset.vrregs[18] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R19 ((void *)&dmy_vrregset.vrregs[19] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R20 ((void *)&dmy_vrregset.vrregs[20] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R21 ((void *)&dmy_vrregset.vrregs[21] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R22 ((void *)&dmy_vrregset.vrregs[22] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R23 ((void *)&dmy_vrregset.vrregs[23] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R24 ((void *)&dmy_vrregset.vrregs[24] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R25 ((void *)&dmy_vrregset.vrregs[25] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R26 ((void *)&dmy_vrregset.vrregs[26] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R27 ((void *)&dmy_vrregset.vrregs[27] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R28 ((void *)&dmy_vrregset.vrregs[28] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R29 ((void *)&dmy_vrregset.vrregs[29] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R30 ((void *)&dmy_vrregset.vrregs[30] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_R31 ((void *)&dmy_vrregset.vrregs[31] - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_VSCR ((void *)&dmy_vrregset.vscr - (void *)&dmy_vrregset) +#define UC_MCONTEXT_VREGS_VRSAVE ((void *)&dmy_vrregset.vrsave - (void *)&dmy_vrregset) + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ppc64/unwind_i.h b/sdk/cpprt/linux/libunwind/src/ppc64/unwind_i.h new file mode 100644 index 0000000000..056dc166b1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ppc64/unwind_i.h @@ -0,0 +1,53 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include +#include + +#define ppc64_lock UNW_OBJ(lock) +#define ppc64_local_resume UNW_OBJ(local_resume) +#define ppc64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#if 0 +#define ppc64_scratch_loc UNW_OBJ(scratch_loc) +#endif + +extern void ppc64_local_addr_space_init (void); +extern int ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); +#if 0 +extern dwarf_loc_t ppc64_scratch_loc (struct cursor *c, unw_regnum_t reg); +#endif + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_fpreg.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_fpreg.c new file mode 100644 index 0000000000..283dcd4f61 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_fpreg.c @@ -0,0 +1,105 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +#if HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE +int +_UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + unw_word_t *wp = (unw_word_t *) val; + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + int i; + + if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + return -UNW_EBADREG; + + errno = 0; + if (write) + for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i) + { +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg] + i * sizeof(wp[i]), + wp[i]); +#endif + if (errno) + return -UNW_EBADREG; + } + else + for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i) + { +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + wp[i] = ptrace (PTRACE_PEEKUSER, pid, + _UPT_reg_offset[reg] + i * sizeof(wp[i]), 0); +#endif + if (errno) + return -UNW_EBADREG; + } + return 0; +} +#elif HAVE_DECL_PT_GETFPREGS +int +_UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + fpregset_t fpreg; + + if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + return -UNW_EBADREG; + + if (ptrace(PT_GETFPREGS, pid, (caddr_t)&fpreg, 0) == -1) + return -UNW_EBADREG; + if (write) { +#if defined(__amd64__) + memcpy(&fpreg.fpr_xacc[reg], val, sizeof(unw_fpreg_t)); +#elif defined(__i386__) + memcpy(&fpreg.fpr_acc[reg], val, sizeof(unw_fpreg_t)); +#else +#error Fix me +#endif + if (ptrace(PT_SETFPREGS, pid, (caddr_t)&fpreg, 0) == -1) + return -UNW_EBADREG; + } else +#if defined(__amd64__) + memcpy(val, &fpreg.fpr_xacc[reg], sizeof(unw_fpreg_t)); +#elif defined(__i386__) + memcpy(val, &fpreg.fpr_acc[reg], sizeof(unw_fpreg_t)); +#else +#error Fix me +#endif + return 0; +} +#else +#error Fix me +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_mem.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_mem.c new file mode 100644 index 0000000000..b0c2ef04d5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_mem.c @@ -0,0 +1,85 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +#if HAVE_DECL_PTRACE_POKEDATA || HAVE_TTRACE +int +_UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, + int write, void *arg) +{ + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + + errno = 0; + if (write) + { + Debug (16, "mem[%lx] <- %lx\n", (long) addr, (long) *val); +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + ptrace (PTRACE_POKEDATA, pid, addr, *val); + if (errno) + return -UNW_EINVAL; +#endif + } + else + { +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + *val = ptrace (PTRACE_PEEKDATA, pid, addr, 0); + if (errno) + return -UNW_EINVAL; +#endif + Debug (16, "mem[%lx] -> %lx\n", (long) addr, (long) *val); + } + return 0; +} +#elif HAVE_DECL_PT_IO +int +_UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, + int write, void *arg) +{ + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + struct ptrace_io_desc iod; + + iod.piod_offs = (void *)addr; + iod.piod_addr = val; + iod.piod_len = sizeof(*val); + iod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D; + if (write) + Debug (16, "mem[%lx] <- %lx\n", (long) addr, (long) *val); + if (ptrace(PT_IO, pid, (caddr_t)&iod, 0) == -1) + return -UNW_EINVAL; + if (!write) + Debug (16, "mem[%lx] -> %lx\n", (long) addr, (long) *val); + return 0; +} +#else +#error Fix me +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_reg.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_reg.c new file mode 100644 index 0000000000..00ba0cc71c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_access_reg.c @@ -0,0 +1,293 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +#if UNW_TARGET_IA64 +# include +# ifdef HAVE_ASM_PTRACE_OFFSETS_H +# include +# endif +# include "tdep-ia64/rse.h" +#endif + +#if HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE +int +_UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, + int write, void *arg) +{ + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + +#if UNW_DEBUG + if (write) + Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val); +#endif + +#if UNW_TARGET_IA64 + if ((unsigned) reg - UNW_IA64_NAT < 32) + { + unsigned long nat_bits, mask; + + /* The Linux ptrace represents the statc NaT bits as a single word. */ + mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT); + errno = 0; +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + nat_bits = ptrace (PTRACE_PEEKUSER, pid, PT_NAT_BITS, 0); + if (errno) + goto badreg; +#endif + + if (write) + { + if (*val) + nat_bits |= mask; + else + nat_bits &= ~mask; +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_NAT_BITS, nat_bits); + if (errno) + goto badreg; +#endif + } + goto out; + } + else + switch (reg) + { + case UNW_IA64_GR + 0: + if (write) + goto badreg; + *val = 0; + return 0; + + case UNW_REG_IP: + { + unsigned long ip, psr; + + /* distribute bundle-addr. & slot-number across PT_IIP & PT_IPSR. */ +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + psr = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IPSR, 0); + if (errno) + goto badreg; +#endif + if (write) + { + ip = *val & ~0xfUL; + psr = (psr & ~0x3UL << 41) | (*val & 0x3); +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_CR_IIP, ip); + ptrace (PTRACE_POKEUSER, pid, PT_CR_IPSR, psr); + if (errno) + goto badreg; +#endif + } + else + { +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + ip = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IIP, 0); + if (errno) + goto badreg; +#endif + *val = ip + ((psr >> 41) & 0x3); + } + goto out; + } + + case UNW_IA64_AR_BSPSTORE: + reg = UNW_IA64_AR_BSP; + break; + + case UNW_IA64_AR_BSP: + case UNW_IA64_BSP: + { + unsigned long sof, cfm, bsp; + +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + /* Account for the fact that ptrace() expects bsp to point + _after_ the current register frame. */ + errno = 0; + cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0); + if (errno) + goto badreg; +#endif + sof = (cfm & 0x7f); + + if (write) + { + bsp = rse_skip_regs (*val, sof); +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, bsp); + if (errno) + goto badreg; +#endif + } + else + { +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0); + if (errno) + goto badreg; +#endif + *val = rse_skip_regs (bsp, -sof); + } + goto out; + } + + case UNW_IA64_CFM: + /* If we change CFM, we need to adjust ptrace's notion of bsp + accordingly, so that the real bsp remains unchanged. */ + if (write) + { + unsigned long new_sof, old_sof, cfm, bsp; + +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0); + cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0); +#endif + if (errno) + goto badreg; + old_sof = (cfm & 0x7f); + new_sof = (*val & 0x7f); + if (old_sof != new_sof) + { + bsp = rse_skip_regs (bsp, -old_sof + new_sof); +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, 0); + if (errno) + goto badreg; +#endif + } +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_CFM, *val); + if (errno) + goto badreg; +#endif + goto out; + } + break; + } +#endif + + if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + { + errno = EINVAL; + goto badreg; + } + +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#else + errno = 0; + if (write) + ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg], *val); + else + *val = ptrace (PTRACE_PEEKUSER, pid, _UPT_reg_offset[reg], 0); + if (errno) + goto badreg; +#endif + +#ifdef UNW_TARGET_IA64 + out: +#endif +#if UNW_DEBUG + if (!write) + Debug (16, "%s -> %lx\n", unw_regname (reg), (long) *val); +#endif + return 0; + + badreg: + Debug (1, "bad register number %u (error: %s)\n", reg, strerror (errno)); + return -UNW_EBADREG; +} +#elif HAVE_DECL_PT_GETREGS +int +_UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, + int write, void *arg) +{ + struct UPT_info *ui = arg; + pid_t pid = ui->pid; + gregset_t regs; + char *r; + +#if UNW_DEBUG + if (write) + Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val); +#endif + if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) + { + errno = EINVAL; + goto badreg; + } + r = (char *)®s + _UPT_reg_offset[reg]; + if (ptrace(PT_GETREGS, pid, (caddr_t)®s, 0) == -1) + goto badreg; + if (write) { + memcpy(r, val, sizeof(unw_word_t)); + if (ptrace(PT_SETREGS, pid, (caddr_t)®s, 0) == -1) + goto badreg; + } else + memcpy(val, r, sizeof(unw_word_t)); + return 0; + + badreg: + Debug (1, "bad register number %u (error: %s)\n", reg, strerror (errno)); + return -UNW_EBADREG; +} +#else +#error Port me +#endif diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_accessors.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_accessors.c new file mode 100644 index 0000000000..3feb60bc56 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_accessors.c @@ -0,0 +1,38 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +PROTECTED unw_accessors_t _UPT_accessors = + { + .find_proc_info = _UPT_find_proc_info, + .put_unwind_info = _UPT_put_unwind_info, + .get_dyn_info_list_addr = _UPT_get_dyn_info_list_addr, + .access_mem = _UPT_access_mem, + .access_reg = _UPT_access_reg, + .access_fpreg = _UPT_access_fpreg, + .resume = _UPT_resume, + .get_proc_name = _UPT_get_proc_name + }; diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_create.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_create.c new file mode 100644 index 0000000000..f6a4158365 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_create.c @@ -0,0 +1,46 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "_UPT_internal.h" + +void * +_UPT_create (pid_t pid) +{ + struct UPT_info *ui = malloc (sizeof (struct UPT_info)); + + if (!ui) + return NULL; + + memset (ui, 0, sizeof (*ui)); + ui->pid = pid; + ui->edi.di_cache.format = -1; + ui->edi.di_debug.format = -1; +#if UNW_TARGET_IA64 + ui->edi.ktab.format = -1; +#endif + return ui; +} diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_destroy.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_destroy.c new file mode 100644 index 0000000000..04ea22d2ba --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_destroy.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +void +_UPT_destroy (void *ptr) +{ + struct UPT_info *ui = (struct UPT_info *) ptr; + invalidate_edi (&ui->edi); + free (ptr); +} diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_elf.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_elf.c new file mode 100644 index 0000000000..cf0480f2a5 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_elf.c @@ -0,0 +1,5 @@ +/* We need to get a separate copy of the ELF-code into + libunwind-ptrace since it cannot (and must not) have any ELF + dependencies on libunwind. */ +#include "libunwind_i.h" /* get ELFCLASS defined */ +#include "../elfxx.c" diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_find_proc_info.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_find_proc_info.c new file mode 100644 index 0000000000..53dd1e7fcb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_find_proc_info.c @@ -0,0 +1,145 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include +#include + +#include + +#include "_UPT_internal.h" + +static int +get_unwind_info (struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_word_t ip) +{ + unsigned long segbase, mapoff; + char path[PATH_MAX]; + +#if UNW_TARGET_IA64 && defined(__linux) + if (!edi->ktab.start_ip && _Uia64_get_kernel_table (&edi->ktab) < 0) + return -UNW_ENOINFO; + + if (edi->ktab.format != -1 && ip >= edi->ktab.start_ip && ip < edi->ktab.end_ip) + return 0; +#endif + + if ((edi->di_cache.format != -1 + && ip >= edi->di_cache.start_ip && ip < edi->di_cache.end_ip) +#if UNW_TARGET_ARM + || (edi->di_debug.format != -1 + && ip >= edi->di_arm.start_ip && ip < edi->di_arm.end_ip) +#endif + || (edi->di_debug.format != -1 + && ip >= edi->di_debug.start_ip && ip < edi->di_debug.end_ip)) + return 0; + + invalidate_edi(edi); + + if (tdep_get_elf_image (&edi->ei, pid, ip, &segbase, &mapoff, path, + sizeof(path)) < 0) + return -UNW_ENOINFO; + + /* Here, SEGBASE is the starting-address of the (mmap'ped) segment + which covers the IP we're looking for. */ + if (tdep_find_unwind_table (edi, as, path, segbase, mapoff, ip) < 0) + return -UNW_ENOINFO; + + /* This can happen in corner cases where dynamically generated + code falls into the same page that contains the data-segment + and the page-offset of the code is within the first page of + the executable. */ + if (edi->di_cache.format != -1 + && (ip < edi->di_cache.start_ip || ip >= edi->di_cache.end_ip)) + edi->di_cache.format = -1; + + if (edi->di_debug.format != -1 + && (ip < edi->di_debug.start_ip || ip >= edi->di_debug.end_ip)) + edi->di_debug.format = -1; + + if (edi->di_cache.format == -1 +#if UNW_TARGET_ARM + && edi->di_arm.format == -1 +#endif + && edi->di_debug.format == -1) + return -UNW_ENOINFO; + + return 0; +} + +int +_UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, + int need_unwind_info, void *arg) +{ + struct UPT_info *ui = arg; + int ret = -UNW_ENOINFO; + + if (get_unwind_info (&ui->edi, ui->pid, as, ip) < 0) + return -UNW_ENOINFO; + +#if UNW_TARGET_IA64 + if (ui->edi.ktab.format != -1) + { + /* The kernel unwind table resides in local memory, so we have + to use the local address space to search it. Since + _UPT_put_unwind_info() has no easy way of detecting this + case, we simply make a copy of the unwind-info, so + _UPT_put_unwind_info() can always free() the unwind-info + without ill effects. */ + ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi, + need_unwind_info, arg); + if (ret >= 0) + { + if (!need_unwind_info) + pi->unwind_info = NULL; + else + { + void *mem = malloc (pi->unwind_info_size); + + if (!mem) + return -UNW_ENOMEM; + memcpy (mem, pi->unwind_info, pi->unwind_info_size); + pi->unwind_info = mem; + } + } + } +#endif + + if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1) + ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache, + pi, need_unwind_info, arg); + +#if UNW_TARGET_ARM + if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1) + ret = tdep_search_unwind_table (as, ip, &ui->edi.di_arm, pi, + need_unwind_info, arg); +#endif + + if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1) + ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi, + need_unwind_info, arg); + + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c new file mode 100644 index 0000000000..edc998fd6a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_dyn_info_list_addr.c @@ -0,0 +1,105 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +#if UNW_TARGET_IA64 && defined(__linux) +# include "elf64.h" +# include "os-linux.h" + +static inline int +get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, + int *countp) +{ + unsigned long lo, hi, off; + struct UPT_info *ui = arg; + struct map_iterator mi; + char path[PATH_MAX]; + unw_word_t res; + int count = 0; + + maps_init (&mi, ui->pid); + while (maps_next (&mi, &lo, &hi, &off)) + { + if (off) + continue; + + invalidate_edi(&ui->edi); + + if (elf_map_image (&ui->edi.ei, path) < 0) + /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */ + continue; + + Debug (16, "checking object %s\n", path); + + if (tdep_find_unwind_table (&ui->edi, as, path, lo, off, 0) > 0) + { + res = _Uia64_find_dyn_list (as, &ui->edi.di_cache, arg); + if (res && count++ == 0) + { + Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); + *dil_addr = res; + } + } + } + maps_close (&mi); + *countp = count; + return 0; +} + +#else + +static inline int +get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, + int *countp) +{ +# warning Implement get_list_addr(), please. + *countp = 0; + return 0; +} + +#endif + +int +_UPT_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, + void *arg) +{ + int count, ret; + + Debug (12, "looking for dyn_info list\n"); + + if ((ret = get_list_addr (as, dil_addr, arg, &count)) < 0) + return ret; + + /* If multiple dynamic-info list addresses are found, we would have + to determine which was is the one actually in use (since the + dynamic name resolution algorithm will pick one "winner"). + Perhaps we'd have to track them all until we find one that's + non-empty. Hopefully, this case simply will never arise, since + only libunwind defines the dynamic info list head. */ + assert (count <= 1); + + return (count > 0) ? 0 : -UNW_ENOINFO; +} diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_proc_name.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_proc_name.c new file mode 100644 index 0000000000..6ac85a0aa7 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_get_proc_name.c @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +int +_UPT_get_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, void *arg) +{ + struct UPT_info *ui = arg; + +#if ELF_CLASS == ELFCLASS64 + return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp); +#elif ELF_CLASS == ELFCLASS32 + return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp); +#else + return -UNW_ENOINFO; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_internal.h b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_internal.h new file mode 100644 index 0000000000..27149d36a4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_internal.h @@ -0,0 +1,59 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UPT_internal_h +#define _UPT_internal_h + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_PTRACE_H +#include +#endif +#ifdef HAVE_SYS_PROCFS_H +#include +#endif + +#include +#include +#include +#include +#include + +#include "libunwind_i.h" + +struct UPT_info + { + pid_t pid; /* the process-id of the child we're unwinding */ + struct elf_dyn_info edi; + }; + +extern int _UPT_reg_offset[UNW_REG_LAST + 1]; + +#endif /* _UPT_internal_h */ diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_put_unwind_info.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_put_unwind_info.c new file mode 100644 index 0000000000..852dd86817 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_put_unwind_info.c @@ -0,0 +1,35 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +void +_UPT_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg) +{ + if (!pi->unwind_info) + return; + free (pi->unwind_info); + pi->unwind_info = NULL; +} diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_reg_offset.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_reg_offset.c new file mode 100644 index 0000000000..d6e1274194 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_reg_offset.c @@ -0,0 +1,361 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +#include + +#ifdef HAVE_ASM_PTRACE_OFFSETS_H +# include +#endif + +int _UPT_reg_offset[UNW_REG_LAST + 1] = + { +#ifdef HAVE_ASM_PTRACE_OFFSETS_H +# ifndef PT_AR_CSD +# define PT_AR_CSD -1 /* this was introduced with rev 2.1 of ia64 */ +# endif + + [UNW_IA64_GR + 0] = -1, [UNW_IA64_GR + 1] = PT_R1, + [UNW_IA64_GR + 2] = PT_R2, [UNW_IA64_GR + 3] = PT_R3, + [UNW_IA64_GR + 4] = PT_R4, [UNW_IA64_GR + 5] = PT_R5, + [UNW_IA64_GR + 6] = PT_R6, [UNW_IA64_GR + 7] = PT_R7, + [UNW_IA64_GR + 8] = PT_R8, [UNW_IA64_GR + 9] = PT_R9, + [UNW_IA64_GR + 10] = PT_R10, [UNW_IA64_GR + 11] = PT_R11, + [UNW_IA64_GR + 12] = PT_R12, [UNW_IA64_GR + 13] = PT_R13, + [UNW_IA64_GR + 14] = PT_R14, [UNW_IA64_GR + 15] = PT_R15, + [UNW_IA64_GR + 16] = PT_R16, [UNW_IA64_GR + 17] = PT_R17, + [UNW_IA64_GR + 18] = PT_R18, [UNW_IA64_GR + 19] = PT_R19, + [UNW_IA64_GR + 20] = PT_R20, [UNW_IA64_GR + 21] = PT_R21, + [UNW_IA64_GR + 22] = PT_R22, [UNW_IA64_GR + 23] = PT_R23, + [UNW_IA64_GR + 24] = PT_R24, [UNW_IA64_GR + 25] = PT_R25, + [UNW_IA64_GR + 26] = PT_R26, [UNW_IA64_GR + 27] = PT_R27, + [UNW_IA64_GR + 28] = PT_R28, [UNW_IA64_GR + 29] = PT_R29, + [UNW_IA64_GR + 30] = PT_R30, [UNW_IA64_GR + 31] = PT_R31, + + [UNW_IA64_NAT+ 0] = -1, [UNW_IA64_NAT+ 1] = PT_NAT_BITS, + [UNW_IA64_NAT+ 2] = PT_NAT_BITS, [UNW_IA64_NAT+ 3] = PT_NAT_BITS, + [UNW_IA64_NAT+ 4] = PT_NAT_BITS, [UNW_IA64_NAT+ 5] = PT_NAT_BITS, + [UNW_IA64_NAT+ 6] = PT_NAT_BITS, [UNW_IA64_NAT+ 7] = PT_NAT_BITS, + [UNW_IA64_NAT+ 8] = PT_NAT_BITS, [UNW_IA64_NAT+ 9] = PT_NAT_BITS, + [UNW_IA64_NAT+ 10] = PT_NAT_BITS, [UNW_IA64_NAT+ 11] = PT_NAT_BITS, + [UNW_IA64_NAT+ 12] = PT_NAT_BITS, [UNW_IA64_NAT+ 13] = PT_NAT_BITS, + [UNW_IA64_NAT+ 14] = PT_NAT_BITS, [UNW_IA64_NAT+ 15] = PT_NAT_BITS, + [UNW_IA64_NAT+ 16] = PT_NAT_BITS, [UNW_IA64_NAT+ 17] = PT_NAT_BITS, + [UNW_IA64_NAT+ 18] = PT_NAT_BITS, [UNW_IA64_NAT+ 19] = PT_NAT_BITS, + [UNW_IA64_NAT+ 20] = PT_NAT_BITS, [UNW_IA64_NAT+ 21] = PT_NAT_BITS, + [UNW_IA64_NAT+ 22] = PT_NAT_BITS, [UNW_IA64_NAT+ 23] = PT_NAT_BITS, + [UNW_IA64_NAT+ 24] = PT_NAT_BITS, [UNW_IA64_NAT+ 25] = PT_NAT_BITS, + [UNW_IA64_NAT+ 26] = PT_NAT_BITS, [UNW_IA64_NAT+ 27] = PT_NAT_BITS, + [UNW_IA64_NAT+ 28] = PT_NAT_BITS, [UNW_IA64_NAT+ 29] = PT_NAT_BITS, + [UNW_IA64_NAT+ 30] = PT_NAT_BITS, [UNW_IA64_NAT+ 31] = PT_NAT_BITS, + + [UNW_IA64_FR + 0] = -1, [UNW_IA64_FR + 1] = -1, + [UNW_IA64_FR + 2] = PT_F2, [UNW_IA64_FR + 3] = PT_F3, + [UNW_IA64_FR + 4] = PT_F4, [UNW_IA64_FR + 5] = PT_F5, + [UNW_IA64_FR + 6] = PT_F6, [UNW_IA64_FR + 7] = PT_F7, + [UNW_IA64_FR + 8] = PT_F8, [UNW_IA64_FR + 9] = PT_F9, + [UNW_IA64_FR + 10] = PT_F10, [UNW_IA64_FR + 11] = PT_F11, + [UNW_IA64_FR + 12] = PT_F12, [UNW_IA64_FR + 13] = PT_F13, + [UNW_IA64_FR + 14] = PT_F14, [UNW_IA64_FR + 15] = PT_F15, + [UNW_IA64_FR + 16] = PT_F16, [UNW_IA64_FR + 17] = PT_F17, + [UNW_IA64_FR + 18] = PT_F18, [UNW_IA64_FR + 19] = PT_F19, + [UNW_IA64_FR + 20] = PT_F20, [UNW_IA64_FR + 21] = PT_F21, + [UNW_IA64_FR + 22] = PT_F22, [UNW_IA64_FR + 23] = PT_F23, + [UNW_IA64_FR + 24] = PT_F24, [UNW_IA64_FR + 25] = PT_F25, + [UNW_IA64_FR + 26] = PT_F26, [UNW_IA64_FR + 27] = PT_F27, + [UNW_IA64_FR + 28] = PT_F28, [UNW_IA64_FR + 29] = PT_F29, + [UNW_IA64_FR + 30] = PT_F30, [UNW_IA64_FR + 31] = PT_F31, + [UNW_IA64_FR + 32] = PT_F32, [UNW_IA64_FR + 33] = PT_F33, + [UNW_IA64_FR + 34] = PT_F34, [UNW_IA64_FR + 35] = PT_F35, + [UNW_IA64_FR + 36] = PT_F36, [UNW_IA64_FR + 37] = PT_F37, + [UNW_IA64_FR + 38] = PT_F38, [UNW_IA64_FR + 39] = PT_F39, + [UNW_IA64_FR + 40] = PT_F40, [UNW_IA64_FR + 41] = PT_F41, + [UNW_IA64_FR + 42] = PT_F42, [UNW_IA64_FR + 43] = PT_F43, + [UNW_IA64_FR + 44] = PT_F44, [UNW_IA64_FR + 45] = PT_F45, + [UNW_IA64_FR + 46] = PT_F46, [UNW_IA64_FR + 47] = PT_F47, + [UNW_IA64_FR + 48] = PT_F48, [UNW_IA64_FR + 49] = PT_F49, + [UNW_IA64_FR + 50] = PT_F50, [UNW_IA64_FR + 51] = PT_F51, + [UNW_IA64_FR + 52] = PT_F52, [UNW_IA64_FR + 53] = PT_F53, + [UNW_IA64_FR + 54] = PT_F54, [UNW_IA64_FR + 55] = PT_F55, + [UNW_IA64_FR + 56] = PT_F56, [UNW_IA64_FR + 57] = PT_F57, + [UNW_IA64_FR + 58] = PT_F58, [UNW_IA64_FR + 59] = PT_F59, + [UNW_IA64_FR + 60] = PT_F60, [UNW_IA64_FR + 61] = PT_F61, + [UNW_IA64_FR + 62] = PT_F62, [UNW_IA64_FR + 63] = PT_F63, + [UNW_IA64_FR + 64] = PT_F64, [UNW_IA64_FR + 65] = PT_F65, + [UNW_IA64_FR + 66] = PT_F66, [UNW_IA64_FR + 67] = PT_F67, + [UNW_IA64_FR + 68] = PT_F68, [UNW_IA64_FR + 69] = PT_F69, + [UNW_IA64_FR + 70] = PT_F70, [UNW_IA64_FR + 71] = PT_F71, + [UNW_IA64_FR + 72] = PT_F72, [UNW_IA64_FR + 73] = PT_F73, + [UNW_IA64_FR + 74] = PT_F74, [UNW_IA64_FR + 75] = PT_F75, + [UNW_IA64_FR + 76] = PT_F76, [UNW_IA64_FR + 77] = PT_F77, + [UNW_IA64_FR + 78] = PT_F78, [UNW_IA64_FR + 79] = PT_F79, + [UNW_IA64_FR + 80] = PT_F80, [UNW_IA64_FR + 81] = PT_F81, + [UNW_IA64_FR + 82] = PT_F82, [UNW_IA64_FR + 83] = PT_F83, + [UNW_IA64_FR + 84] = PT_F84, [UNW_IA64_FR + 85] = PT_F85, + [UNW_IA64_FR + 86] = PT_F86, [UNW_IA64_FR + 87] = PT_F87, + [UNW_IA64_FR + 88] = PT_F88, [UNW_IA64_FR + 89] = PT_F89, + [UNW_IA64_FR + 90] = PT_F90, [UNW_IA64_FR + 91] = PT_F91, + [UNW_IA64_FR + 92] = PT_F92, [UNW_IA64_FR + 93] = PT_F93, + [UNW_IA64_FR + 94] = PT_F94, [UNW_IA64_FR + 95] = PT_F95, + [UNW_IA64_FR + 96] = PT_F96, [UNW_IA64_FR + 97] = PT_F97, + [UNW_IA64_FR + 98] = PT_F98, [UNW_IA64_FR + 99] = PT_F99, + [UNW_IA64_FR +100] = PT_F100, [UNW_IA64_FR +101] = PT_F101, + [UNW_IA64_FR +102] = PT_F102, [UNW_IA64_FR +103] = PT_F103, + [UNW_IA64_FR +104] = PT_F104, [UNW_IA64_FR +105] = PT_F105, + [UNW_IA64_FR +106] = PT_F106, [UNW_IA64_FR +107] = PT_F107, + [UNW_IA64_FR +108] = PT_F108, [UNW_IA64_FR +109] = PT_F109, + [UNW_IA64_FR +110] = PT_F110, [UNW_IA64_FR +111] = PT_F111, + [UNW_IA64_FR +112] = PT_F112, [UNW_IA64_FR +113] = PT_F113, + [UNW_IA64_FR +114] = PT_F114, [UNW_IA64_FR +115] = PT_F115, + [UNW_IA64_FR +116] = PT_F116, [UNW_IA64_FR +117] = PT_F117, + [UNW_IA64_FR +118] = PT_F118, [UNW_IA64_FR +119] = PT_F119, + [UNW_IA64_FR +120] = PT_F120, [UNW_IA64_FR +121] = PT_F121, + [UNW_IA64_FR +122] = PT_F122, [UNW_IA64_FR +123] = PT_F123, + [UNW_IA64_FR +124] = PT_F124, [UNW_IA64_FR +125] = PT_F125, + [UNW_IA64_FR +126] = PT_F126, [UNW_IA64_FR +127] = PT_F127, + + [UNW_IA64_AR + 0] = -1, [UNW_IA64_AR + 1] = -1, + [UNW_IA64_AR + 2] = -1, [UNW_IA64_AR + 3] = -1, + [UNW_IA64_AR + 4] = -1, [UNW_IA64_AR + 5] = -1, + [UNW_IA64_AR + 6] = -1, [UNW_IA64_AR + 7] = -1, + [UNW_IA64_AR + 8] = -1, [UNW_IA64_AR + 9] = -1, + [UNW_IA64_AR + 10] = -1, [UNW_IA64_AR + 11] = -1, + [UNW_IA64_AR + 12] = -1, [UNW_IA64_AR + 13] = -1, + [UNW_IA64_AR + 14] = -1, [UNW_IA64_AR + 15] = -1, + [UNW_IA64_AR + 16] = PT_AR_RSC, [UNW_IA64_AR + 17] = PT_AR_BSP, + [UNW_IA64_AR + 18] = PT_AR_BSPSTORE,[UNW_IA64_AR + 19] = PT_AR_RNAT, + [UNW_IA64_AR + 20] = -1, [UNW_IA64_AR + 21] = -1, + [UNW_IA64_AR + 22] = -1, [UNW_IA64_AR + 23] = -1, + [UNW_IA64_AR + 24] = -1, [UNW_IA64_AR + 25] = PT_AR_CSD, + [UNW_IA64_AR + 26] = -1, [UNW_IA64_AR + 27] = -1, + [UNW_IA64_AR + 28] = -1, [UNW_IA64_AR + 29] = -1, + [UNW_IA64_AR + 30] = -1, [UNW_IA64_AR + 31] = -1, + [UNW_IA64_AR + 32] = PT_AR_CCV, [UNW_IA64_AR + 33] = -1, + [UNW_IA64_AR + 34] = -1, [UNW_IA64_AR + 35] = -1, + [UNW_IA64_AR + 36] = PT_AR_UNAT, [UNW_IA64_AR + 37] = -1, + [UNW_IA64_AR + 38] = -1, [UNW_IA64_AR + 39] = -1, + [UNW_IA64_AR + 40] = PT_AR_FPSR, [UNW_IA64_AR + 41] = -1, + [UNW_IA64_AR + 42] = -1, [UNW_IA64_AR + 43] = -1, + [UNW_IA64_AR + 44] = -1, [UNW_IA64_AR + 45] = -1, + [UNW_IA64_AR + 46] = -1, [UNW_IA64_AR + 47] = -1, + [UNW_IA64_AR + 48] = -1, [UNW_IA64_AR + 49] = -1, + [UNW_IA64_AR + 50] = -1, [UNW_IA64_AR + 51] = -1, + [UNW_IA64_AR + 52] = -1, [UNW_IA64_AR + 53] = -1, + [UNW_IA64_AR + 54] = -1, [UNW_IA64_AR + 55] = -1, + [UNW_IA64_AR + 56] = -1, [UNW_IA64_AR + 57] = -1, + [UNW_IA64_AR + 58] = -1, [UNW_IA64_AR + 59] = -1, + [UNW_IA64_AR + 60] = -1, [UNW_IA64_AR + 61] = -1, + [UNW_IA64_AR + 62] = -1, [UNW_IA64_AR + 63] = -1, + [UNW_IA64_AR + 64] = PT_AR_PFS, [UNW_IA64_AR + 65] = PT_AR_LC, + [UNW_IA64_AR + 66] = PT_AR_EC, [UNW_IA64_AR + 67] = -1, + [UNW_IA64_AR + 68] = -1, [UNW_IA64_AR + 69] = -1, + [UNW_IA64_AR + 70] = -1, [UNW_IA64_AR + 71] = -1, + [UNW_IA64_AR + 72] = -1, [UNW_IA64_AR + 73] = -1, + [UNW_IA64_AR + 74] = -1, [UNW_IA64_AR + 75] = -1, + [UNW_IA64_AR + 76] = -1, [UNW_IA64_AR + 77] = -1, + [UNW_IA64_AR + 78] = -1, [UNW_IA64_AR + 79] = -1, + [UNW_IA64_AR + 80] = -1, [UNW_IA64_AR + 81] = -1, + [UNW_IA64_AR + 82] = -1, [UNW_IA64_AR + 83] = -1, + [UNW_IA64_AR + 84] = -1, [UNW_IA64_AR + 85] = -1, + [UNW_IA64_AR + 86] = -1, [UNW_IA64_AR + 87] = -1, + [UNW_IA64_AR + 88] = -1, [UNW_IA64_AR + 89] = -1, + [UNW_IA64_AR + 90] = -1, [UNW_IA64_AR + 91] = -1, + [UNW_IA64_AR + 92] = -1, [UNW_IA64_AR + 93] = -1, + [UNW_IA64_AR + 94] = -1, [UNW_IA64_AR + 95] = -1, + [UNW_IA64_AR + 96] = -1, [UNW_IA64_AR + 97] = -1, + [UNW_IA64_AR + 98] = -1, [UNW_IA64_AR + 99] = -1, + [UNW_IA64_AR +100] = -1, [UNW_IA64_AR +101] = -1, + [UNW_IA64_AR +102] = -1, [UNW_IA64_AR +103] = -1, + [UNW_IA64_AR +104] = -1, [UNW_IA64_AR +105] = -1, + [UNW_IA64_AR +106] = -1, [UNW_IA64_AR +107] = -1, + [UNW_IA64_AR +108] = -1, [UNW_IA64_AR +109] = -1, + [UNW_IA64_AR +110] = -1, [UNW_IA64_AR +111] = -1, + [UNW_IA64_AR +112] = -1, [UNW_IA64_AR +113] = -1, + [UNW_IA64_AR +114] = -1, [UNW_IA64_AR +115] = -1, + [UNW_IA64_AR +116] = -1, [UNW_IA64_AR +117] = -1, + [UNW_IA64_AR +118] = -1, [UNW_IA64_AR +119] = -1, + [UNW_IA64_AR +120] = -1, [UNW_IA64_AR +121] = -1, + [UNW_IA64_AR +122] = -1, [UNW_IA64_AR +123] = -1, + [UNW_IA64_AR +124] = -1, [UNW_IA64_AR +125] = -1, + [UNW_IA64_AR +126] = -1, [UNW_IA64_AR +127] = -1, + + [UNW_IA64_BR + 0] = PT_B0, [UNW_IA64_BR + 1] = PT_B1, + [UNW_IA64_BR + 2] = PT_B2, [UNW_IA64_BR + 3] = PT_B3, + [UNW_IA64_BR + 4] = PT_B4, [UNW_IA64_BR + 5] = PT_B5, + [UNW_IA64_BR + 6] = PT_B6, [UNW_IA64_BR + 7] = PT_B7, + + [UNW_IA64_PR] = PT_PR, + [UNW_IA64_CFM] = PT_CFM, + [UNW_IA64_IP] = PT_CR_IIP +#elif defined(HAVE_TTRACE) +# warning No support for ttrace() yet. +#elif defined(UNW_TARGET_HPPA) + [UNW_HPPA_GR + 0] = 0x000, [UNW_HPPA_GR + 1] = 0x004, + [UNW_HPPA_GR + 2] = 0x008, [UNW_HPPA_GR + 3] = 0x00c, + [UNW_HPPA_GR + 4] = 0x010, [UNW_HPPA_GR + 5] = 0x014, + [UNW_HPPA_GR + 6] = 0x018, [UNW_HPPA_GR + 7] = 0x01c, + [UNW_HPPA_GR + 8] = 0x020, [UNW_HPPA_GR + 9] = 0x024, + [UNW_HPPA_GR + 10] = 0x028, [UNW_HPPA_GR + 11] = 0x02c, + [UNW_HPPA_GR + 12] = 0x030, [UNW_HPPA_GR + 13] = 0x034, + [UNW_HPPA_GR + 14] = 0x038, [UNW_HPPA_GR + 15] = 0x03c, + [UNW_HPPA_GR + 16] = 0x040, [UNW_HPPA_GR + 17] = 0x044, + [UNW_HPPA_GR + 18] = 0x048, [UNW_HPPA_GR + 19] = 0x04c, + [UNW_HPPA_GR + 20] = 0x050, [UNW_HPPA_GR + 21] = 0x054, + [UNW_HPPA_GR + 22] = 0x058, [UNW_HPPA_GR + 23] = 0x05c, + [UNW_HPPA_GR + 24] = 0x060, [UNW_HPPA_GR + 25] = 0x064, + [UNW_HPPA_GR + 26] = 0x068, [UNW_HPPA_GR + 27] = 0x06c, + [UNW_HPPA_GR + 28] = 0x070, [UNW_HPPA_GR + 29] = 0x074, + [UNW_HPPA_GR + 30] = 0x078, [UNW_HPPA_GR + 31] = 0x07c, + + [UNW_HPPA_FR + 0] = 0x080, [UNW_HPPA_FR + 1] = 0x088, + [UNW_HPPA_FR + 2] = 0x090, [UNW_HPPA_FR + 3] = 0x098, + [UNW_HPPA_FR + 4] = 0x0a0, [UNW_HPPA_FR + 5] = 0x0a8, + [UNW_HPPA_FR + 6] = 0x0b0, [UNW_HPPA_FR + 7] = 0x0b8, + [UNW_HPPA_FR + 8] = 0x0c0, [UNW_HPPA_FR + 9] = 0x0c8, + [UNW_HPPA_FR + 10] = 0x0d0, [UNW_HPPA_FR + 11] = 0x0d8, + [UNW_HPPA_FR + 12] = 0x0e0, [UNW_HPPA_FR + 13] = 0x0e8, + [UNW_HPPA_FR + 14] = 0x0f0, [UNW_HPPA_FR + 15] = 0x0f8, + [UNW_HPPA_FR + 16] = 0x100, [UNW_HPPA_FR + 17] = 0x108, + [UNW_HPPA_FR + 18] = 0x110, [UNW_HPPA_FR + 19] = 0x118, + [UNW_HPPA_FR + 20] = 0x120, [UNW_HPPA_FR + 21] = 0x128, + [UNW_HPPA_FR + 22] = 0x130, [UNW_HPPA_FR + 23] = 0x138, + [UNW_HPPA_FR + 24] = 0x140, [UNW_HPPA_FR + 25] = 0x148, + [UNW_HPPA_FR + 26] = 0x150, [UNW_HPPA_FR + 27] = 0x158, + [UNW_HPPA_FR + 28] = 0x160, [UNW_HPPA_FR + 29] = 0x168, + [UNW_HPPA_FR + 30] = 0x170, [UNW_HPPA_FR + 31] = 0x178, + + [UNW_HPPA_IP] = 0x1a8 /* IAOQ[0] */ +#elif defined(UNW_TARGET_X86) +#if defined __FreeBSD__ +#define UNW_R_OFF(R, r) \ + [UNW_X86_##R] = offsetof(gregset_t, r_##r), + UNW_R_OFF(EAX, eax) + UNW_R_OFF(EDX, edx) + UNW_R_OFF(ECX, ecx) + UNW_R_OFF(EBX, ebx) + UNW_R_OFF(ESI, esi) + UNW_R_OFF(EDI, edi) + UNW_R_OFF(EBP, ebp) + UNW_R_OFF(ESP, esp) + UNW_R_OFF(EIP, eip) +// UNW_R_OFF(CS, cs) +// UNW_R_OFF(EFLAGS, eflags) +// UNW_R_OFF(SS, ss) +#elif defined __linux__ + [UNW_X86_EAX] = 0x18, + [UNW_X86_EBX] = 0x00, + [UNW_X86_ECX] = 0x04, + [UNW_X86_EDX] = 0x08, + [UNW_X86_ESI] = 0x0c, + [UNW_X86_EDI] = 0x10, + [UNW_X86_EBP] = 0x14, + [UNW_X86_EIP] = 0x30, + [UNW_X86_ESP] = 0x3c +/* CS = 0x34, */ +/* DS = 0x1c, */ +/* ES = 0x20, */ +/* FS = 0x24, */ +/* GS = 0x28, */ +/* ORIG_EAX = 0x2c, */ +/* EFLAGS = 0x38, */ +/* SS = 0x40 */ +#else +#error Port me +#endif +#elif defined(UNW_TARGET_X86_64) +#if defined __FreeBSD__ +#define UNW_R_OFF(R, r) \ + [UNW_X86_64_##R] = offsetof(gregset_t, r_##r), + UNW_R_OFF(RAX, rax) + UNW_R_OFF(RDX, rdx) + UNW_R_OFF(RCX, rcx) + UNW_R_OFF(RBX, rbx) + UNW_R_OFF(RSI, rsi) + UNW_R_OFF(RDI, rdi) + UNW_R_OFF(RBP, rbp) + UNW_R_OFF(RSP, rsp) + UNW_R_OFF(R8, r8) + UNW_R_OFF(R9, r9) + UNW_R_OFF(R10, r10) + UNW_R_OFF(R11, r11) + UNW_R_OFF(R12, r12) + UNW_R_OFF(R13, r13) + UNW_R_OFF(R14, r14) + UNW_R_OFF(R15, r15) + UNW_R_OFF(RIP, rip) +// UNW_R_OFF(CS, cs) +// UNW_R_OFF(EFLAGS, rflags) +// UNW_R_OFF(SS, ss) +#undef UNW_R_OFF +#elif defined __linux__ + [UNW_X86_64_RAX] = 0x50, + [UNW_X86_64_RDX] = 0x60, + [UNW_X86_64_RCX] = 0x58, + [UNW_X86_64_RBX] = 0x28, + [UNW_X86_64_RSI] = 0x68, + [UNW_X86_64_RDI] = 0x70, + [UNW_X86_64_RBP] = 0x20, + [UNW_X86_64_RSP] = 0x98, + [UNW_X86_64_R8] = 0x48, + [UNW_X86_64_R9] = 0x40, + [UNW_X86_64_R10] = 0x38, + [UNW_X86_64_R11] = 0x30, + [UNW_X86_64_R12] = 0x18, + [UNW_X86_64_R13] = 0x10, + [UNW_X86_64_R14] = 0x08, + [UNW_X86_64_R15] = 0x00, + [UNW_X86_64_RIP] = 0x80 +// [UNW_X86_64_CS] = 0x88, +// [UNW_X86_64_EFLAGS] = 0x90, +// [UNW_X86_64_RSP] = 0x98, +// [UNW_X86_64_SS] = 0xa0 +#else +#error Port me +#endif +#elif defined(UNW_TARGET_PPC32) +#elif defined(UNW_TARGET_PPC64) +#elif defined(UNW_TARGET_ARM) + [UNW_ARM_R0] = 0x00, + [UNW_ARM_R1] = 0x04, + [UNW_ARM_R2] = 0x08, + [UNW_ARM_R3] = 0x0c, + [UNW_ARM_R4] = 0x10, + [UNW_ARM_R5] = 0x14, + [UNW_ARM_R6] = 0x18, + [UNW_ARM_R7] = 0x1c, + [UNW_ARM_R8] = 0x20, + [UNW_ARM_R9] = 0x24, + [UNW_ARM_R10] = 0x28, + [UNW_ARM_R11] = 0x2c, + [UNW_ARM_R12] = 0x30, + [UNW_ARM_R13] = 0x34, + [UNW_ARM_R14] = 0x38, + [UNW_ARM_R15] = 0x3c, +#elif defined(UNW_TARGET_MIPS) +#else +# error Fix me. +#endif + }; diff --git a/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_resume.c b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_resume.c new file mode 100644 index 0000000000..f419fed3a9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/ptrace/_UPT_resume.c @@ -0,0 +1,40 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "_UPT_internal.h" + +int +_UPT_resume (unw_addr_space_t as, unw_cursor_t *c, void *arg) +{ + struct UPT_info *ui = arg; + +#ifdef HAVE_TTRACE +# warning No support for ttrace() yet. +#elif HAVE_DECL_PTRACE_CONT + return ptrace (PTRACE_CONT, ui->pid, 0, 0); +#elif HAVE_DECL_PT_CONTINUE + return ptrace(PT_CONTINUE, ui->pid, (caddr_t)1, 0); +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/se-iterate-phdr.c b/sdk/cpprt/linux/libunwind/src/se-iterate-phdr.c new file mode 100644 index 0000000000..519a57a26d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/se-iterate-phdr.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifdef HAVE_SGX + +#include "global_data.h" +#include + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include + +/** + * This function is commonly provided by glibc for application to walk + * through list of shared objects. It is needed inside Enclave so that + * the libunwind code can work correctly. + */ +int dl_iterate_phdr( + int (*callback) (struct dl_phdr_info *info, + size_t size, void *data), + void *data) +{ + struct dl_phdr_info info; + ElfW(Ehdr) *ehdr; + + memset(&info, 0, sizeof(info)); + ehdr = (ElfW(Ehdr) *) &__ImageBase; + + info.dlpi_addr = (ElfW(Addr)) ehdr; + info.dlpi_name = ""; + info.dlpi_phdr = (ElfW(Phdr) *) ((char *)ehdr + ehdr->e_phoff); + info.dlpi_phnum = ehdr->e_phnum; + + /* No iteration here - the Enclave is merely one shared object. */ + return callback(&info, sizeof(info), data); +} + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/se-libc-stubs.c b/sdk/cpprt/linux/libunwind/src/se-libc-stubs.c new file mode 100644 index 0000000000..40bf414778 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/se-libc-stubs.c @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifdef HAVE_SGX + +#ifdef _GNU_SOURCE +#undef _GNU_SOURCE +#endif + +#include "arch.h" +#include "sgx_trts.h" + +#include +#include +#include +#include +#include + + +/** + * In SE, the page size is defined by macro `SE_PAGE_SIZE'. + */ +int getpagesize(void) +{ + return SE_PAGE_SIZE; +} + +int mincore(void *addr, size_t length, unsigned char *vec) +{ + assert(sgx_is_within_enclave(addr, length)); + + return 0; +} + +char *strdup(const char *s) +{ + size_t len = strlen(s) + 1; + void *mem = malloc(len); + + if (mem == NULL) + return mem; + + return memcpy(mem, s, len); +} + +/* When optimization is turned on (even with -O), a call to + * strdup() will be replaced by __strdup(), wich GCC. + */ +char * +__strdup(const char* s) __attribute__((weak, alias("strdup"))); + +#if defined(__x86_64__) || defined(__x86_64) || defined(__amd64) +int msync(void *addr, size_t length, int flags) +{ + return 0; +} +#endif + +#ifndef NDEBUG +/* FIXME: remove __assert_fail() + * Currently libunwind is built with glibc headers, to improve it + * we need to build it with SE tlibc headers. + */ +void __assert_fail (const char *__assertion, const char *__file, + unsigned int __line, __const char *__function) +{ + abort(); +} +#endif + +#endif +/* vim: set ts=4 sw=4 cin et: */ diff --git a/sdk/cpprt/linux/libunwind/src/setjmp/longjmp.c b/sdk/cpprt/linux/libunwind/src/setjmp/longjmp.c new file mode 100644 index 0000000000..97dcdff093 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/setjmp/longjmp.c @@ -0,0 +1,115 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define UNW_LOCAL_ONLY + +#undef _FORTIFY_SOURCE +#include +#include +#include +#include +#include + +#include "jmpbuf.h" +#include "setjmp_i.h" + +#if defined(__GLIBC__) +#if __GLIBC_PREREQ(2, 4) + +/* Starting with glibc-2.4, {sig,}setjmp in GLIBC obfuscates the + register values in jmp_buf by XORing them with a "random" + canary value. + + This makes it impossible to implement longjmp, as we + can never match wp[JB_SP], unless we decode the canary first. + + Doing so is possible, but doesn't appear to be worth the trouble, + so we simply defer to glibc longjmp here. */ +#define _longjmp __nonworking__longjmp +#define longjmp __nonworking_longjmp +static void _longjmp (jmp_buf env, int val); +static void longjmp (jmp_buf env, int val); +#endif +#endif /* __GLIBC__ */ + +void +_longjmp (jmp_buf env, int val) +{ + extern int _UI_longjmp_cont; + unw_context_t uc; + unw_cursor_t c; + unw_word_t sp; + unw_word_t *wp = (unw_word_t *) env; + + if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0) + abort (); + + do + { + if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) + abort (); +#ifdef __FreeBSD__ + if (sp != wp[JB_SP] + sizeof(unw_word_t)) +#else + if (sp != wp[JB_SP]) +#endif + continue; + + if (!bsp_match (&c, wp)) + continue; + + /* found the right frame: */ + + assert (UNW_NUM_EH_REGS >= 2); + + if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 + || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 + || unw_set_reg (&c, UNW_REG_IP, + (unw_word_t) (uintptr_t) &_UI_longjmp_cont)) + abort (); + + unw_resume (&c); + + abort (); + } + while (unw_step (&c) > 0); + + abort (); +} + +#ifdef __GNUC__ +#define STRINGIFY1(x) #x +#define STRINGIFY(x) STRINGIFY1(x) +void longjmp (jmp_buf env, int val) + __attribute__ ((alias (STRINGIFY(_longjmp)))); +#else + +void +longjmp (jmp_buf env, int val) +{ + _longjmp (env, val); +} + +#endif /* __GNUC__ */ diff --git a/sdk/cpprt/linux/libunwind/src/setjmp/setjmp.c b/sdk/cpprt/linux/libunwind/src/setjmp/setjmp.c new file mode 100644 index 0000000000..feb83f7722 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/setjmp/setjmp.c @@ -0,0 +1,49 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "jmpbuf.h" + +/* Why use K&R syntax here? setjmp() is often a macro and that + expands into a call to, say, __setjmp() and we need to define the + libunwind-version of setjmp() with the name of the actual function. + Using K&R syntax lets us keep the setjmp() macro while keeping the + syntax valid... This trick works provided setjmp() doesn't do + anything other than a function call. */ + +int +setjmp (env) + jmp_buf env; +{ + void **wp = (void **) env; + + /* this should work on most platforms, but may not be + performance-optimal; check the code! */ + wp[JB_SP] = __builtin_frame_address (0); + wp[JB_RP] = (void *) __builtin_return_address (0); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/setjmp/setjmp_i.h b/sdk/cpprt/linux/libunwind/src/setjmp/setjmp_i.h new file mode 100644 index 0000000000..1d7ca1584f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/setjmp/setjmp_i.h @@ -0,0 +1,118 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#if UNW_TARGET_IA64 + +#include "libunwind_i.h" +#include "tdep-ia64/rse.h" + +static inline int +bsp_match (unw_cursor_t *c, unw_word_t *wp) +{ + unw_word_t bsp, pfs, sol; + + if (unw_get_reg (c, UNW_IA64_BSP, &bsp) < 0 + || unw_get_reg (c, UNW_IA64_AR_PFS, &pfs) < 0) + abort (); + + /* simulate the effect of "br.call sigsetjmp" on ar.bsp: */ + sol = (pfs >> 7) & 0x7f; + bsp = rse_skip_regs (bsp, sol); + + if (bsp != wp[JB_BSP]) + return 0; + + if (unlikely (sol == 0)) + { + unw_word_t sp, prev_sp; + unw_cursor_t tmp = *c; + + /* The caller of {sig,}setjmp() cannot have a NULL-frame. If we + see a NULL-frame, we haven't reached the right target yet. + To have a NULL-frame, the number of locals must be zero and + the stack-frame must also be empty. */ + + if (unw_step (&tmp) < 0) + abort (); + + if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0 + || unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0) + abort (); + + if (sp == prev_sp) + /* got a NULL-frame; keep looking... */ + return 0; + } + return 1; +} + +/* On ia64 we cannot always call sigprocmask() at + _UI_siglongjmp_cont() because the signal may have switched stacks + and the old stack's register-backing store may have overflown, + leaving us no space to allocate the stacked registers needed to + call sigprocmask(). Fortunately, we can just let unw_resume() (via + sigreturn) take care of restoring the signal-mask. That's faster + anyhow. */ +static inline int +resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp) +{ + unw_word_t sc_addr = ((struct cursor *) c)->sigcontext_addr; + struct sigcontext *sc = (struct sigcontext *) sc_addr; + sigset_t current_mask; + void *mp; + + if (!sc_addr) + return 0; + + /* let unw_resume() install the desired signal mask */ + + if (wp[JB_MASK_SAVED]) + mp = &wp[JB_MASK]; + else + { + if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0) + abort (); + mp = ¤t_mask; + } + memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask)); + return 1; +} + +#else /* !UNW_TARGET_IA64 */ + +static inline int +bsp_match (unw_cursor_t *c, unw_word_t *wp) +{ + return 1; +} + +static inline int +resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp) +{ + /* We may want to do this analogously as for ia64... */ + return 0; +} + +#endif /* !UNW_TARGET_IA64 */ diff --git a/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c b/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c new file mode 100644 index 0000000000..4fee4010ae --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/setjmp/siglongjmp.c @@ -0,0 +1,127 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#define UNW_LOCAL_ONLY + +#include + +#include "libunwind_i.h" +#include "jmpbuf.h" +#include "setjmp_i.h" + +#if !defined(_NSIG) && defined(_SIG_MAXSIG) +# define _NSIG (_SIG_MAXSIG - 1) +#endif + +#if defined(__GLIBC__) +#if __GLIBC_PREREQ(2, 4) + +/* Starting with glibc-2.4, {sig,}setjmp in GLIBC obfuscates the + register values in jmp_buf by XORing them with a "random" + canary value. + + This makes it impossible to implement longjmp, as we + can never match wp[JB_SP], unless we decode the canary first. + + Doing so is possible, but doesn't appear to be worth the trouble, + so we simply defer to glibc siglongjmp here. */ + +#define siglongjmp __nonworking_siglongjmp +static void siglongjmp (sigjmp_buf env, int val); +#endif +#endif /* __GLIBC_PREREQ */ + +void +siglongjmp (sigjmp_buf env, int val) +{ + unw_word_t *wp = (unw_word_t *) env; + extern int _UI_siglongjmp_cont; + extern int _UI_longjmp_cont; + unw_context_t uc; + unw_cursor_t c; + unw_word_t sp; + int *cont; + + if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0) + abort (); + + do + { + if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) + abort (); +#ifdef __FreeBSD__ + if (sp != wp[JB_SP] + sizeof(unw_word_t)) +#else + if (sp != wp[JB_SP]) +#endif + continue; + + if (!bsp_match (&c, wp)) + continue; + + /* found the right frame: */ + + /* default to resuming without restoring signal-mask */ + cont = &_UI_longjmp_cont; + + /* Order of evaluation is important here: if unw_resume() + restores signal mask, we must set it up appropriately, even + if wp[JB_MASK_SAVED] is FALSE. */ + if (!resume_restores_sigmask (&c, wp) && wp[JB_MASK_SAVED]) + { + /* sigmask was saved */ +#if defined(__linux__) + if (UNW_NUM_EH_REGS < 4 || _NSIG > 16 * sizeof (unw_word_t)) + /* signal mask doesn't fit into EH arguments and we can't + put it on the stack without overwriting something + else... */ + abort (); + else + if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0 + || (_NSIG > 8 * sizeof (unw_word_t) + && unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0)) + abort (); +#elif defined(__FreeBSD__) + if (unw_set_reg (&c, UNW_REG_EH + 2, &wp[JB_MASK]) < 0) + abort(); +#else +#error Port me +#endif + cont = &_UI_siglongjmp_cont; + } + + if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 + || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 + || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) (uintptr_t) cont)) + abort (); + + unw_resume (&c); + + abort (); + } + while (unw_step (&c) > 0); + + abort (); +} diff --git a/sdk/cpprt/linux/libunwind/src/setjmp/sigsetjmp.c b/sdk/cpprt/linux/libunwind/src/setjmp/sigsetjmp.c new file mode 100644 index 0000000000..87df5ed8a0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/setjmp/sigsetjmp.c @@ -0,0 +1,50 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include +#include + +#include "jmpbuf.h" + +int +sigsetjmp (sigjmp_buf env, int savemask) +{ + unw_word_t *wp = (unw_word_t *) env; + + /* This should work on most platforms, but may not be + performance-optimal; check the code! */ + + wp[JB_SP] = (unw_word_t) __builtin_frame_address (0); + wp[JB_RP] = (unw_word_t) __builtin_return_address (0); + wp[JB_MASK_SAVED] = savemask; + + /* Note: we assume here that "wp" has same or better alignment as + sigset_t. */ + if (savemask + && sigprocmask (SIG_BLOCK, NULL, (sigset_t *) (wp + JB_MASK)) < 0) + abort (); + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/unwind/Backtrace.c b/sdk/cpprt/linux/libunwind/src/unwind/Backtrace.c new file mode 100644 index 0000000000..99c20fcc29 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/Backtrace.c @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED _Unwind_Reason_Code +_Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_parameter) +{ + struct _Unwind_Context context; + unw_context_t uc; + int ret; + + if (_Unwind_InitContext (&context, &uc) < 0) + return _URC_FATAL_PHASE1_ERROR; + + /* Phase 1 (search phase) */ + + while (1) + { + if ((ret = unw_step (&context.cursor)) <= 0) + { + if (ret == 0) + return _URC_END_OF_STACK; + else + return _URC_FATAL_PHASE1_ERROR; + } + + if ((*trace) (&context, trace_parameter) != _URC_NO_REASON) + return _URC_FATAL_PHASE1_ERROR; + } +} + +_Unwind_Reason_Code __libunwind_Unwind_Backtrace (_Unwind_Trace_Fn, void *) + ALIAS (_Unwind_Backtrace); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/DeleteException.c b/sdk/cpprt/linux/libunwind/src/unwind/DeleteException.c new file mode 100644 index 0000000000..5104b73bd3 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/DeleteException.c @@ -0,0 +1,38 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED void +_Unwind_DeleteException (struct _Unwind_Exception *exception_object) +{ + _Unwind_Exception_Cleanup_Fn cleanup = exception_object->exception_cleanup; + + if (cleanup) + (*cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exception_object); +} + +void __libunwind_Unwind_DeleteException (struct _Unwind_Exception *) + ALIAS (_Unwind_DeleteException); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/FindEnclosingFunction.c b/sdk/cpprt/linux/libunwind/src/unwind/FindEnclosingFunction.c new file mode 100644 index 0000000000..e639894cd1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/FindEnclosingFunction.c @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED void * +_Unwind_FindEnclosingFunction (void *ip) +{ + unw_proc_info_t pi; + + if (unw_get_proc_info_by_ip (unw_local_addr_space, + (unw_word_t) (uintptr_t) ip, &pi, 0) + < 0) + return NULL; + + return (void *) (uintptr_t) pi.start_ip; +} + +void *__libunwind_Unwind_FindEnclosingFunction (void *) + ALIAS (_Unwind_FindEnclosingFunction); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/ForcedUnwind.c b/sdk/cpprt/linux/libunwind/src/unwind/ForcedUnwind.c new file mode 100644 index 0000000000..bd334d35bb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/ForcedUnwind.c @@ -0,0 +1,52 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED _Unwind_Reason_Code +_Unwind_ForcedUnwind (struct _Unwind_Exception *exception_object, + _Unwind_Stop_Fn stop, void *stop_parameter) +{ + struct _Unwind_Context context; + unw_context_t uc; + + /* We check "stop" here to tell the compiler's inliner that + exception_object->private_1 isn't NULL when calling + _Unwind_Phase2(). */ + if (!stop) + return _URC_FATAL_PHASE2_ERROR; + + if (_Unwind_InitContext (&context, &uc) < 0) + return _URC_FATAL_PHASE2_ERROR; + + exception_object->private_1 = (unsigned long) stop; + exception_object->private_2 = (unsigned long) stop_parameter; + + return _Unwind_Phase2 (exception_object, &context); +} + +_Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind (struct _Unwind_Exception*, + _Unwind_Stop_Fn, void *) + ALIAS (_Unwind_ForcedUnwind); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetBSP.c b/sdk/cpprt/linux/libunwind/src/unwind/GetBSP.c new file mode 100644 index 0000000000..d53e40112c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetBSP.c @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetBSP (struct _Unwind_Context *context) +{ +#ifdef UNW_TARGET_IA64 + unw_word_t val; + + unw_get_reg (&context->cursor, UNW_IA64_BSP, &val); + return val; +#else + return 0; +#endif +} + +unsigned long __libunwind_Unwind_GetBSP (struct _Unwind_Context *) + ALIAS (_Unwind_GetBSP); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetCFA.c b/sdk/cpprt/linux/libunwind/src/unwind/GetCFA.c new file mode 100644 index 0000000000..bd8559b8cc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetCFA.c @@ -0,0 +1,38 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetCFA (struct _Unwind_Context *context) +{ + unw_word_t val; + + unw_get_reg (&context->cursor, UNW_REG_SP, &val); + return val; +} + +unsigned long __libunwind_Unwind_GetCFA (struct _Unwind_Context *) + ALIAS (_Unwind_GetCFA); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetDataRelBase.c b/sdk/cpprt/linux/libunwind/src/unwind/GetDataRelBase.c new file mode 100644 index 0000000000..cb604766e2 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetDataRelBase.c @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetDataRelBase (struct _Unwind_Context *context) +{ + unw_proc_info_t pi; + + pi.gp = 0; + unw_get_proc_info (&context->cursor, &pi); + return pi.gp; +} + +unsigned long __libunwind_Unwind_GetDataRelBase (struct _Unwind_Context *) + ALIAS (_Unwind_GetDataRelBase); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetGR.c b/sdk/cpprt/linux/libunwind/src/unwind/GetGR.c new file mode 100644 index 0000000000..3a875e808c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetGR.c @@ -0,0 +1,43 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetGR (struct _Unwind_Context *context, int index) +{ + unw_word_t val; + + if (index == UNW_REG_SP && context->end_of_stack) + /* _Unwind_ForcedUnwind() requires us to return a NULL + stack-pointer after reaching the end of the stack. */ + return 0; + + unw_get_reg (&context->cursor, index, &val); + return val; +} + +unsigned long __libunwind_Unwind_GetGR (struct _Unwind_Context *, int) + ALIAS (_Unwind_GetGR); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetIP.c b/sdk/cpprt/linux/libunwind/src/unwind/GetIP.c new file mode 100644 index 0000000000..6fd48a2edb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetIP.c @@ -0,0 +1,38 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetIP (struct _Unwind_Context *context) +{ + unw_word_t val; + + unw_get_reg (&context->cursor, UNW_REG_IP, &val); + return val; +} + +unsigned long __libunwind_Unwind_GetIP (struct _Unwind_Context *) + ALIAS (_Unwind_GetIP); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetIPInfo.c b/sdk/cpprt/linux/libunwind/src/unwind/GetIPInfo.c new file mode 100644 index 0000000000..b885ede237 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetIPInfo.c @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2009 Red Hat + Contributed by Jan Kratochvil + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +/* gcc/unwind-dw2.c: Retrieve the return address and flag whether that IP is + before or after first not yet fully executed instruction. */ + +PROTECTED unsigned long +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) +{ + unw_word_t val; + + unw_get_reg (&context->cursor, UNW_REG_IP, &val); + *ip_before_insn = unw_is_signal_frame (&context->cursor); + return val; +} + +unsigned long __libunwind_Unwind_GetIPInfo (struct _Unwind_Context *, int *) + ALIAS (_Unwind_GetIPInfo); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetLanguageSpecificData.c b/sdk/cpprt/linux/libunwind/src/unwind/GetLanguageSpecificData.c new file mode 100644 index 0000000000..eefcec75a8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetLanguageSpecificData.c @@ -0,0 +1,40 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) +{ + unw_proc_info_t pi; + + pi.lsda = 0; + unw_get_proc_info (&context->cursor, &pi); + return pi.lsda; +} + +unsigned long +__libunwind_Unwind_GetLanguageSpecificData (struct _Unwind_Context *) + ALIAS (_Unwind_GetLanguageSpecificData); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetRegionStart.c b/sdk/cpprt/linux/libunwind/src/unwind/GetRegionStart.c new file mode 100644 index 0000000000..11c346054b --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetRegionStart.c @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetRegionStart (struct _Unwind_Context *context) +{ + unw_proc_info_t pi; + + pi.start_ip = 0; + unw_get_proc_info (&context->cursor, &pi); + return pi.start_ip; +} + +unsigned long __libunwind_Unwind_GetRegionStart (struct _Unwind_Context *) + ALIAS (_Unwind_GetRegionStart); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/GetTextRelBase.c b/sdk/cpprt/linux/libunwind/src/unwind/GetTextRelBase.c new file mode 100644 index 0000000000..a53ca9b1fb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/GetTextRelBase.c @@ -0,0 +1,35 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED unsigned long +_Unwind_GetTextRelBase (struct _Unwind_Context *context) +{ + return 0; +} + +unsigned long __libunwind_Unwind_GetTextRelBase (struct _Unwind_Context *) + ALIAS (_Unwind_GetTextRelBase); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/RaiseException.c b/sdk/cpprt/linux/libunwind/src/unwind/RaiseException.c new file mode 100644 index 0000000000..66a681dbeb --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/RaiseException.c @@ -0,0 +1,103 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED _Unwind_Reason_Code +_Unwind_RaiseException (struct _Unwind_Exception *exception_object) +{ + uint64_t exception_class = exception_object->exception_class; + _Unwind_Personality_Fn personality; + struct _Unwind_Context context; + _Unwind_Reason_Code reason; + unw_proc_info_t pi; + unw_context_t uc; + unw_word_t ip; + int ret; + + Debug (1, "(exception_object=%p)\n", exception_object); + + if (_Unwind_InitContext (&context, &uc) < 0) + return _URC_FATAL_PHASE1_ERROR; + + /* Phase 1 (search phase) */ + + while (1) + { + if ((ret = unw_step (&context.cursor)) <= 0) + { + if (ret == 0) + { + Debug (1, "no handler found\n"); + return _URC_END_OF_STACK; + } + else + return _URC_FATAL_PHASE1_ERROR; + } + + if (unw_get_proc_info (&context.cursor, &pi) < 0) + return _URC_FATAL_PHASE1_ERROR; + + personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler; + if (personality) + { + reason = (*personality) (_U_VERSION, _UA_SEARCH_PHASE, + exception_class, exception_object, + &context); + if (reason != _URC_CONTINUE_UNWIND) + { + if (reason == _URC_HANDLER_FOUND) + break; + else + { + Debug (1, "personality returned %d\n", reason); + return _URC_FATAL_PHASE1_ERROR; + } + } + } + } + + /* Exceptions are associated with IP-ranges. If a given exception + is handled at a particular IP, it will _always_ be handled at + that IP. If this weren't true, we'd have to track the tuple + (IP,SP,BSP) to uniquely identify the stack frame that's handling + the exception. */ + if (unw_get_reg (&context.cursor, UNW_REG_IP, &ip) < 0) + return _URC_FATAL_PHASE1_ERROR; + exception_object->private_1 = 0; /* clear "stop" pointer */ + exception_object->private_2 = ip; /* save frame marker */ + + Debug (1, "found handler for IP=%lx; entering cleanup phase\n", (long) ip); + + /* Reset the cursor to the first frame: */ + if (unw_init_local (&context.cursor, &uc) < 0) + return _URC_FATAL_PHASE1_ERROR; + + return _Unwind_Phase2 (exception_object, &context); +} + +_Unwind_Reason_Code +__libunwind_Unwind_RaiseException (struct _Unwind_Exception *) + ALIAS (_Unwind_RaiseException); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/Resume.c b/sdk/cpprt/linux/libunwind/src/unwind/Resume.c new file mode 100644 index 0000000000..ddf9d2ccaa --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/Resume.c @@ -0,0 +1,42 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED void +_Unwind_Resume (struct _Unwind_Exception *exception_object) +{ + struct _Unwind_Context context; + unw_context_t uc; + + if (_Unwind_InitContext (&context, &uc) < 0) + abort (); + + _Unwind_Phase2 (exception_object, &context); + abort (); +} + +void __libunwind_Unwind_Resume (struct _Unwind_Exception *) + ALIAS (_Unwind_Resume); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/Resume_or_Rethrow.c b/sdk/cpprt/linux/libunwind/src/unwind/Resume_or_Rethrow.c new file mode 100644 index 0000000000..ece0ced395 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/Resume_or_Rethrow.c @@ -0,0 +1,47 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED _Unwind_Reason_Code +_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exception_object) +{ + struct _Unwind_Context context; + unw_context_t uc; + + if (exception_object->private_1) + { + if (_Unwind_InitContext (&context, &uc) < 0) + return _URC_FATAL_PHASE2_ERROR; + + return _Unwind_Phase2 (exception_object, &context); + } + else + return _Unwind_RaiseException (exception_object); +} + +_Unwind_Reason_Code +__libunwind_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *) + ALIAS (_Unwind_Resume_or_Rethrow); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/SetGR.c b/sdk/cpprt/linux/libunwind/src/unwind/SetGR.c new file mode 100644 index 0000000000..965336436e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/SetGR.c @@ -0,0 +1,47 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" +#ifdef UNW_TARGET_X86 +#include "dwarf_i.h" +#endif + +PROTECTED void +_Unwind_SetGR (struct _Unwind_Context *context, int index, + unsigned long new_value) +{ +#ifdef UNW_TARGET_X86 + index = dwarf_to_unw_regnum(index); +#endif + unw_set_reg (&context->cursor, index, new_value); +#ifdef UNW_TARGET_IA64 + if (index >= UNW_IA64_GR && index <= UNW_IA64_GR + 127) + /* Clear the NaT bit. */ + unw_set_reg (&context->cursor, UNW_IA64_NAT + (index - UNW_IA64_GR), 0); +#endif +} + +void __libunwind_Unwind_SetGR (struct _Unwind_Context *, int, unsigned long) + ALIAS (_Unwind_SetGR); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/SetIP.c b/sdk/cpprt/linux/libunwind/src/unwind/SetIP.c new file mode 100644 index 0000000000..0652a14a99 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/SetIP.c @@ -0,0 +1,35 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind-internal.h" + +PROTECTED void +_Unwind_SetIP (struct _Unwind_Context *context, unsigned long new_value) +{ + unw_set_reg (&context->cursor, UNW_REG_IP, new_value); +} + +void __libunwind_Unwind_SetIP (struct _Unwind_Context *, unsigned long) + ALIAS (_Unwind_SetIP); diff --git a/sdk/cpprt/linux/libunwind/src/unwind/unwind-internal.h b/sdk/cpprt/linux/libunwind/src/unwind/unwind-internal.h new file mode 100644 index 0000000000..130cb81ab1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/unwind/unwind-internal.h @@ -0,0 +1,140 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_internal_h +#define unwind_internal_h + +#define UNW_LOCAL_ONLY + +#include +#include +#include + +#include "libunwind_i.h" + +/* The version of the _Unwind_*() interface implemented by this code. */ +#define _U_VERSION 1 + +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) + (int, _Unwind_Action, uint64_t, struct _Unwind_Exception *, + struct _Unwind_Context *); + +struct _Unwind_Context { + unw_cursor_t cursor; + int end_of_stack; /* set to 1 if the end of stack was reached */ +}; + +/* This must be a macro because unw_getcontext() must be invoked from + the callee, even if optimization (and hence inlining) is turned + off. The macro arguments MUST NOT have any side-effects. */ +#define _Unwind_InitContext(context, uc) \ + ((context)->end_of_stack = 0, \ + ((unw_getcontext (uc) < 0 || unw_init_local (&(context)->cursor, uc) < 0) \ + ? -1 : 0)) + +static _Unwind_Reason_Code ALWAYS_INLINE +_Unwind_Phase2 (struct _Unwind_Exception *exception_object, + struct _Unwind_Context *context) +{ + _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) exception_object->private_1; + uint64_t exception_class = exception_object->exception_class; + void *stop_parameter = (void *) exception_object->private_2; + _Unwind_Personality_Fn personality; + _Unwind_Reason_Code reason; + _Unwind_Action actions; + unw_proc_info_t pi; + unw_word_t ip; + int ret; + + actions = _UA_CLEANUP_PHASE; + if (stop) + actions |= _UA_FORCE_UNWIND; + + while (1) + { + ret = unw_step (&context->cursor); + if (ret <= 0) + { + if (ret == 0) + { + actions |= _UA_END_OF_STACK; + context->end_of_stack = 1; + } + else + return _URC_FATAL_PHASE2_ERROR; + } + + if (stop) + { + reason = (*stop) (_U_VERSION, actions, exception_class, + exception_object, context, stop_parameter); + if (reason != _URC_NO_REASON) + /* Stop function may return _URC_FATAL_PHASE2_ERROR if + it's unable to handle end-of-stack condition or + _URC_FATAL_PHASE2_ERROR if something is wrong. Not + that it matters: the resulting state is indeterminate + anyhow so we must return _URC_FATAL_PHASE2_ERROR... */ + return _URC_FATAL_PHASE2_ERROR; + } + + if (context->end_of_stack + || unw_get_proc_info (&context->cursor, &pi) < 0) + return _URC_FATAL_PHASE2_ERROR; + + personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler; + if (personality) + { + if (!stop) + { + if (unw_get_reg (&context->cursor, UNW_REG_IP, &ip) < 0) + return _URC_FATAL_PHASE2_ERROR; + + if ((unsigned long) stop_parameter == ip) + actions |= _UA_HANDLER_FRAME; + } + + reason = (*personality) (_U_VERSION, actions, exception_class, + exception_object, context); + if (reason != _URC_CONTINUE_UNWIND) + { + if (reason == _URC_INSTALL_CONTEXT) + { + /* we may regain control via _Unwind_Resume() */ + unw_resume (&context->cursor); + abort (); + } + else + return _URC_FATAL_PHASE2_ERROR; + } + if (actions & _UA_HANDLER_FRAME) + /* The personality routine for the handler-frame changed + it's mind; that's a no-no... */ + abort (); + } + } + return _URC_FATAL_PHASE2_ERROR; /* shouldn't be reached */ +} + +#endif /* unwind_internal_h */ diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/x86/Gcreate_addr_space.c new file mode 100644 index 0000000000..f7cea64a09 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gcreate_addr_space.c @@ -0,0 +1,58 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +#if defined(_LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN) +#define __LITTLE_ENDIAN _LITTLE_ENDIAN +#endif + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* + * x86 supports only little-endian. + */ + if (byte_order != 0 && byte_order != __LITTLE_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + as->acc = *a; + + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/x86/Gget_proc_info.c new file mode 100644 index 0000000000..a53348303c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gget_proc_info.c @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + + if (dwarf_make_proc_info (&c->dwarf) < 0) + { + /* On x86, it's relatively common to be missing DWARF unwind + info. We don't want to fail in that case, because the + frame-chain still would let us do a backtrace at least. */ + memset (pi, 0, sizeof (*pi)); + pi->start_ip = c->dwarf.ip; + pi->end_ip = c->dwarf.ip + 1; + return 0; + } + *pi = c->dwarf.pi; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/x86/Gget_save_loc.c new file mode 100644 index 0000000000..e8cc79eefa --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gget_save_loc.c @@ -0,0 +1,133 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + loc = DWARF_NULL_LOC; /* default to "not saved" */ + + switch (reg) + { + case UNW_X86_EIP: loc = c->dwarf.loc[EIP]; break; + case UNW_X86_CFA: break; + case UNW_X86_EAX: loc = c->dwarf.loc[EAX]; break; + case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break; + case UNW_X86_EDX: loc = c->dwarf.loc[EDX]; break; + case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break; + case UNW_X86_ESP: loc = c->dwarf.loc[ESP]; break; + case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break; + case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break; + case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break; + case UNW_X86_EFLAGS: loc = c->dwarf.loc[EFLAGS]; break; + case UNW_X86_TRAPNO: loc = c->dwarf.loc[TRAPNO]; break; + case UNW_X86_ST0: loc = c->dwarf.loc[ST0]; break; + + case UNW_X86_FCW: + case UNW_X86_FSW: + case UNW_X86_FTW: + case UNW_X86_FOP: + case UNW_X86_FCS: + case UNW_X86_FIP: + case UNW_X86_FEA: + case UNW_X86_FDS: + case UNW_X86_MXCSR: + case UNW_X86_GS: + case UNW_X86_FS: + case UNW_X86_ES: + case UNW_X86_DS: + case UNW_X86_SS: + case UNW_X86_CS: + case UNW_X86_TSS: + case UNW_X86_LDT: + loc = x86_scratch_loc (c, reg); + break; + + /* stacked fp registers */ + case UNW_X86_ST1: + case UNW_X86_ST2: + case UNW_X86_ST3: + case UNW_X86_ST4: + case UNW_X86_ST5: + case UNW_X86_ST6: + case UNW_X86_ST7: + /* SSE fp registers */ + case UNW_X86_XMM0_lo: + case UNW_X86_XMM0_hi: + case UNW_X86_XMM1_lo: + case UNW_X86_XMM1_hi: + case UNW_X86_XMM2_lo: + case UNW_X86_XMM2_hi: + case UNW_X86_XMM3_lo: + case UNW_X86_XMM3_hi: + case UNW_X86_XMM4_lo: + case UNW_X86_XMM4_hi: + case UNW_X86_XMM5_lo: + case UNW_X86_XMM5_hi: + case UNW_X86_XMM6_lo: + case UNW_X86_XMM6_hi: + case UNW_X86_XMM7_lo: + case UNW_X86_XMM7_hi: + case UNW_X86_XMM0: + case UNW_X86_XMM1: + case UNW_X86_XMM2: + case UNW_X86_XMM3: + case UNW_X86_XMM4: + case UNW_X86_XMM5: + case UNW_X86_XMM6: + case UNW_X86_XMM7: + loc = x86_scratch_loc (c, reg); + break; + + default: + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gglobal.c b/sdk/cpprt/linux/libunwind/src/x86/Gglobal.c new file mode 100644 index 0000000000..fbb848be0e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gglobal.c @@ -0,0 +1,69 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN pthread_mutex_t x86_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */ + +HIDDEN uint8_t dwarf_to_unw_regnum_map[19] = + { + UNW_X86_EAX, UNW_X86_ECX, UNW_X86_EDX, UNW_X86_EBX, + UNW_X86_ESP, UNW_X86_EBP, UNW_X86_ESI, UNW_X86_EDI, + UNW_X86_EIP, UNW_X86_EFLAGS, UNW_X86_TRAPNO, + UNW_X86_ST0, UNW_X86_ST1, UNW_X86_ST2, UNW_X86_ST3, + UNW_X86_ST4, UNW_X86_ST5, UNW_X86_ST6, UNW_X86_ST7 + }; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + +#if (!HAVE_SGX) + sigfillset (&unwi_full_mask); +#endif + + lock_acquire (&x86_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + x86_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&x86_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Ginit.c b/sdk/cpprt/linux/libunwind/src/x86/Ginit.c new file mode 100644 index 0000000000..b9d5c5c15a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Ginit.c @@ -0,0 +1,248 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg) +{ + return x86_r_uc_addr (uc, reg); +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +/* XXX fix me: there is currently no way to locate the dyn-info list + by a remote unwinder. On ia64, this is done via a special + unwind-table entry. Perhaps something similar can be done with + DWARF2 unwind info. */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +#undef PAGE_SIZE +#define PAGE_SIZE 4096 +#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) + +/* Cache of already validated addresses */ +#define NLGA 4 +static unw_word_t last_good_addr[NLGA]; +static int lga_victim; + +static int +validate_mem (unw_word_t addr) +{ + int i, victim; +#ifdef HAVE_MINCORE + unsigned char mvec[2]; /* Unaligned access may cross page boundary */ +#endif + size_t len; + + if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr)) + len = PAGE_SIZE; + else + len = PAGE_SIZE * 2; + + addr = PAGE_START(addr); + + if (addr == 0) + return -1; + + for (i = 0; i < NLGA; i++) + { + if (last_good_addr[i] && (addr == last_good_addr[i])) + return 0; + } + +#ifdef HAVE_MINCORE + if (mincore ((void *) addr, len, mvec) == -1) +#else + if (msync ((void *) addr, len, MS_ASYNC) == -1) +#endif + return -1; + + victim = lga_victim; + for (i = 0; i < NLGA; i++) { + if (!last_good_addr[victim]) { + last_good_addr[victim] = addr; + return 0; + } + victim = (victim + 1) % NLGA; + } + + /* All slots full. Evict the victim. */ + last_good_addr[victim] = addr; + victim = (victim + 1) % NLGA; + lga_victim = victim; + + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (16, "mem[%x] <- %x\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + /* validate address */ + const struct cursor *c = (const struct cursor *)arg; + if (c && c->validate && validate_mem(addr)) + return -1; + *val = *(unw_word_t *) addr; + Debug (16, "mem[%x] -> %x\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = ((struct cursor *)arg)->uc; + + if (unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = x86_r_uc_addr (uc, reg))) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- %x\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %x\n", unw_regname (reg), *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = ((struct cursor *)arg)->uc; + unw_fpreg_t *addr; + + if (!unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = x86_r_uc_addr (uc, reg))) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ +#if HAVE_SGX + return -1; +#else + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +#endif +} + +HIDDEN void +x86_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = x86_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/x86/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/x86/Ginit_local.c new file mode 100644 index 0000000000..5e8b697250 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Ginit_local.c @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = c; + c->uc = uc; + c->validate = 0; + return common_init (c, 1); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/x86/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/x86/Ginit_remote.c new file mode 100644 index 0000000000..aa92405286 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Ginit_remote.c @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + if (as == unw_local_addr_space) + { + c->dwarf.as_arg = c; + c->uc = as_arg; + } + else + { + c->dwarf.as_arg = as_arg; + c->uc = 0; + } + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gos-freebsd.c b/sdk/cpprt/linux/libunwind/src/x86/Gos-freebsd.c new file mode 100644 index 0000000000..247c35fafc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gos-freebsd.c @@ -0,0 +1,364 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "unwind_i.h" +#include "offsets.h" + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, w1, w2, w3, w4, w5, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors (as); + arg = c->dwarf.as_arg; + + /* Check if EIP points at sigreturn() sequence. It can be: +sigcode+4: from amd64 freebsd32 environment +8d 44 24 20 lea 0x20(%esp),%eax +50 push %eax +b8 a1 01 00 00 mov $0x1a1,%eax +50 push %eax +cd 80 int $0x80 + +sigcode+4: from real i386 +8d 44 24 20 lea 0x20(%esp),%eax +50 push %eax +f7 40 54 00 02 00 testl $0x20000,0x54(%eax) +75 03 jne sigcode+21 +8e 68 14 mov 0x14(%eax),%gs +b8 a1 01 00 00 mov $0x1a1,%eax +50 push %eax +cd 80 int $0x80 + +freebsd4_sigcode+4: +XXX +osigcode: +XXX + */ + ip = c->dwarf.ip; + ret = X86_SCF_NONE; + c->sigcontext_format = ret; + if ((*a->access_mem) (as, ip, &w0, 0, arg) < 0 || + (*a->access_mem) (as, ip + 4, &w1, 0, arg) < 0 || + (*a->access_mem) (as, ip + 8, &w2, 0, arg) < 0 || + (*a->access_mem) (as, ip + 12, &w3, 0, arg) < 0) + return ret; + if (w0 == 0x2024448d && w1 == 0x01a1b850 && w2 == 0xcd500000 && + (w3 & 0xff) == 0x80) + ret = X86_SCF_FREEBSD_SIGFRAME; + else { + if ((*a->access_mem) (as, ip + 16, &w4, 0, arg) < 0 || + (*a->access_mem) (as, ip + 20, &w5, 0, arg) < 0) + return ret; + if (w0 == 0x2024448d && w1 == 0x5440f750 && w2 == 0x75000200 && + w3 == 0x14688e03 && w4 == 0x0001a1b8 && w5 == 0x80cd5000) + ret = X86_SCF_FREEBSD_SIGFRAME; + } + Debug (16, "returning %d\n", ret); + c->sigcontext_format = ret; + return (ret); +} + +PROTECTED int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + if (c->sigcontext_format == X86_SCF_FREEBSD_SIGFRAME) { + struct sigframe *sf; + uintptr_t uc_addr; + struct dwarf_loc esp_loc; + + sf = (struct sigframe *)c->dwarf.cfa; + uc_addr = (uintptr_t)&(sf->sf_uc); + c->sigcontext_addr = c->dwarf.cfa; + + esp_loc = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESP_OFF, 0); + ret = dwarf_get (&c->dwarf, esp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } + + c->dwarf.loc[EIP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EIP_OFF, 0); + c->dwarf.loc[ESP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESP_OFF, 0); + c->dwarf.loc[EAX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EAX_OFF, 0); + c->dwarf.loc[ECX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ECX_OFF, 0); + c->dwarf.loc[EDX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EDX_OFF, 0); + c->dwarf.loc[EBX] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EBX_OFF, 0); + c->dwarf.loc[EBP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EBP_OFF, 0); + c->dwarf.loc[ESI] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESI_OFF, 0); + c->dwarf.loc[EDI] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EDI_OFF, 0); + c->dwarf.loc[EFLAGS] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EFLAGS_OFF, 0); + c->dwarf.loc[TRAPNO] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_TRAPNO_OFF, 0); + c->dwarf.loc[ST0] = DWARF_NULL_LOC; + } else { + Debug (8, "Gstep: not handling frame format %d\n", c->sigcontext_format); + abort(); + } + return 0; +} + +HIDDEN dwarf_loc_t +x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg) +{ + unw_word_t addr = c->sigcontext_addr, off, xmm_off; + unw_word_t fpstate, fpformat; + int ret, is_fpstate = 0, is_xmmstate = 0; + + switch (c->sigcontext_format) + { + case X86_SCF_NONE: + return DWARF_REG_LOC (&c->dwarf, reg); + + case X86_SCF_FREEBSD_SIGFRAME: + addr += offsetof(struct sigframe, sf_uc) + FREEBSD_UC_MCONTEXT_OFF; + break; + + case X86_SCF_FREEBSD_SIGFRAME4: + abort(); + break; + + case X86_SCF_FREEBSD_OSIGFRAME: + /* XXXKIB */ + abort(); + break; + + case X86_SCF_FREEBSD_SYSCALL: + /* XXXKIB */ + abort(); + break; + + default: + /* XXXKIB */ + abort(); + break; + } + + off = 0; /* shut gcc warning */ + switch (reg) + { + case UNW_X86_GS: off = FREEBSD_UC_MCONTEXT_GS_OFF; break; + case UNW_X86_FS: off = FREEBSD_UC_MCONTEXT_FS_OFF; break; + case UNW_X86_ES: off = FREEBSD_UC_MCONTEXT_ES_OFF; break; + case UNW_X86_DS: off = FREEBSD_UC_MCONTEXT_SS_OFF; break; + case UNW_X86_EDI: off = FREEBSD_UC_MCONTEXT_EDI_OFF; break; + case UNW_X86_ESI: off = FREEBSD_UC_MCONTEXT_ESI_OFF; break; + case UNW_X86_EBP: off = FREEBSD_UC_MCONTEXT_EBP_OFF; break; + case UNW_X86_ESP: off = FREEBSD_UC_MCONTEXT_ESP_OFF; break; + case UNW_X86_EBX: off = FREEBSD_UC_MCONTEXT_EBX_OFF; break; + case UNW_X86_EDX: off = FREEBSD_UC_MCONTEXT_EDX_OFF; break; + case UNW_X86_ECX: off = FREEBSD_UC_MCONTEXT_ECX_OFF; break; + case UNW_X86_EAX: off = FREEBSD_UC_MCONTEXT_EAX_OFF; break; + case UNW_X86_TRAPNO: off = FREEBSD_UC_MCONTEXT_TRAPNO_OFF; break; + case UNW_X86_EIP: off = FREEBSD_UC_MCONTEXT_EIP_OFF; break; + case UNW_X86_CS: off = FREEBSD_UC_MCONTEXT_CS_OFF; break; + case UNW_X86_EFLAGS: off = FREEBSD_UC_MCONTEXT_EFLAGS_OFF; break; + case UNW_X86_SS: off = FREEBSD_UC_MCONTEXT_SS_OFF; break; + + case UNW_X86_FCW: + is_fpstate = 1; + off = FREEBSD_UC_MCONTEXT_CW_OFF; + xmm_off = FREEBSD_UC_MCONTEXT_CW_XMM_OFF; + break; + case UNW_X86_FSW: + is_fpstate = 1; + off = FREEBSD_UC_MCONTEXT_SW_OFF; + xmm_off = FREEBSD_UC_MCONTEXT_SW_XMM_OFF; + break; + case UNW_X86_FTW: + is_fpstate = 1; + xmm_off = FREEBSD_UC_MCONTEXT_TAG_XMM_OFF; + off = FREEBSD_UC_MCONTEXT_TAG_OFF; + break; + case UNW_X86_FCS: + is_fpstate = 1; + off = FREEBSD_UC_MCONTEXT_CSSEL_OFF; + xmm_off = FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF; + break; + case UNW_X86_FIP: + is_fpstate = 1; + off = FREEBSD_UC_MCONTEXT_IPOFF_OFF; + xmm_off = FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF; + break; + case UNW_X86_FEA: + is_fpstate = 1; + off = FREEBSD_UC_MCONTEXT_DATAOFF_OFF; + xmm_off = FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF; + break; + case UNW_X86_FDS: + is_fpstate = 1; + off = FREEBSD_US_MCONTEXT_DATASEL_OFF; + xmm_off = FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF; + break; + case UNW_X86_MXCSR: + is_fpstate = 1; + is_xmmstate = 1; + xmm_off = FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF; + break; + + /* stacked fp registers */ + case UNW_X86_ST0: case UNW_X86_ST1: case UNW_X86_ST2: case UNW_X86_ST3: + case UNW_X86_ST4: case UNW_X86_ST5: case UNW_X86_ST6: case UNW_X86_ST7: + is_fpstate = 1; + off = FREEBSD_UC_MCONTEXT_ST0_OFF + 10*(reg - UNW_X86_ST0); + xmm_off = FREEBSD_UC_MCONTEXT_ST0_XMM_OFF + 10*(reg - UNW_X86_ST0); + break; + + /* SSE fp registers */ + case UNW_X86_XMM0_lo: case UNW_X86_XMM0_hi: + case UNW_X86_XMM1_lo: case UNW_X86_XMM1_hi: + case UNW_X86_XMM2_lo: case UNW_X86_XMM2_hi: + case UNW_X86_XMM3_lo: case UNW_X86_XMM3_hi: + case UNW_X86_XMM4_lo: case UNW_X86_XMM4_hi: + case UNW_X86_XMM5_lo: case UNW_X86_XMM5_hi: + case UNW_X86_XMM6_lo: case UNW_X86_XMM6_hi: + case UNW_X86_XMM7_lo: case UNW_X86_XMM7_hi: + is_fpstate = 1; + is_xmmstate = 1; + xmm_off = FREEBSD_UC_MCONTEXT_XMM0_OFF + 8*(reg - UNW_X86_XMM0_lo); + break; + case UNW_X86_XMM0: + case UNW_X86_XMM1: + case UNW_X86_XMM2: + case UNW_X86_XMM3: + case UNW_X86_XMM4: + case UNW_X86_XMM5: + case UNW_X86_XMM6: + case UNW_X86_XMM7: + is_fpstate = 1; + is_xmmstate = 1; + xmm_off = FREEBSD_UC_MCONTEXT_XMM0_OFF + 16*(reg - UNW_X86_XMM0); + break; + + case UNW_X86_FOP: + case UNW_X86_TSS: + case UNW_X86_LDT: + default: + return DWARF_REG_LOC (&c->dwarf, reg); + } + + if (is_fpstate) + { + if ((ret = dwarf_get (&c->dwarf, + DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPSTATE_OFF), + &fpstate)) < 0) + return DWARF_NULL_LOC; + if (fpstate == FREEBSD_UC_MCONTEXT_FPOWNED_NONE) + return DWARF_NULL_LOC; + if ((ret = dwarf_get (&c->dwarf, + DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPFORMAT_OFF), + &fpformat)) < 0) + return DWARF_NULL_LOC; + if (fpformat == FREEBSD_UC_MCONTEXT_FPFMT_NODEV || + (is_xmmstate && fpformat != FREEBSD_UC_MCONTEXT_FPFMT_XMM)) + return DWARF_NULL_LOC; + if (is_xmmstate) + off = xmm_off; + } + + return DWARF_MEM_LOC (c, addr + off); +} + +#ifndef UNW_REMOTE_ONLY +HIDDEN void * +x86_r_uc_addr (ucontext_t *uc, int reg) +{ + void *addr; + + switch (reg) + { + case UNW_X86_GS: addr = &uc->uc_mcontext.mc_gs; break; + case UNW_X86_FS: addr = &uc->uc_mcontext.mc_fs; break; + case UNW_X86_ES: addr = &uc->uc_mcontext.mc_es; break; + case UNW_X86_DS: addr = &uc->uc_mcontext.mc_ds; break; + case UNW_X86_EAX: addr = &uc->uc_mcontext.mc_eax; break; + case UNW_X86_EBX: addr = &uc->uc_mcontext.mc_ebx; break; + case UNW_X86_ECX: addr = &uc->uc_mcontext.mc_ecx; break; + case UNW_X86_EDX: addr = &uc->uc_mcontext.mc_edx; break; + case UNW_X86_ESI: addr = &uc->uc_mcontext.mc_esi; break; + case UNW_X86_EDI: addr = &uc->uc_mcontext.mc_edi; break; + case UNW_X86_EBP: addr = &uc->uc_mcontext.mc_ebp; break; + case UNW_X86_EIP: addr = &uc->uc_mcontext.mc_eip; break; + case UNW_X86_ESP: addr = &uc->uc_mcontext.mc_esp; break; + case UNW_X86_TRAPNO: addr = &uc->uc_mcontext.mc_trapno; break; + case UNW_X86_CS: addr = &uc->uc_mcontext.mc_cs; break; + case UNW_X86_EFLAGS: addr = &uc->uc_mcontext.mc_eflags; break; + case UNW_X86_SS: addr = &uc->uc_mcontext.mc_ss; break; + + default: + addr = NULL; + } + return addr; +} + +HIDDEN int +x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + struct cursor *c = (struct cursor *) cursor; + ucontext_t *uc = c->uc; + + /* Ensure c->pi is up-to-date. On x86, it's relatively common to be + missing DWARF unwind info. We don't want to fail in that case, + because the frame-chain still would let us do a backtrace at + least. */ + dwarf_make_proc_info (&c->dwarf); + + if (c->sigcontext_format == X86_SCF_NONE) { + Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); + setcontext (uc); + abort(); + } else if (c->sigcontext_format == X86_SCF_FREEBSD_SIGFRAME) { + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + + Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc); + sigreturn((ucontext_t *)((const char *)sc + FREEBSD_SC_UCONTEXT_OFF)); + abort(); + } else { + Debug (8, "resuming at ip=%x for sigcontext format %d not implemented\n", + c->dwarf.ip, c->sigcontext_format); + abort(); + } + return -UNW_EINVAL; +} + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gos-linux.c b/sdk/cpprt/linux/libunwind/src/x86/Gos-linux.c new file mode 100644 index 0000000000..aceced5aef --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gos-linux.c @@ -0,0 +1,309 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, w1, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors (as); + arg = c->dwarf.as_arg; + + /* Check if EIP points at sigreturn() sequence. On Linux, this is: + + __restore: + 0x58 pop %eax + 0xb8 0x77 0x00 0x00 0x00 movl 0x77,%eax + 0xcd 0x80 int 0x80 + + without SA_SIGINFO, and + + __restore_rt: + 0xb8 0xad 0x00 0x00 0x00 movl 0xad,%eax + 0xcd 0x80 int 0x80 + 0x00 + + if SA_SIGINFO is specified. + */ + ip = c->dwarf.ip; + if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0) + return ret; + ret = ((w0 == 0x0077b858 && w1 == 0x80cd0000) + || (w0 == 0x0000adb8 && (w1 & 0xffffff) == 0x80cd00)); + Debug (16, "returning %d\n", ret); + return ret; +} + +PROTECTED int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + /* c->esp points at the arguments to the handler. Without + SA_SIGINFO, the arguments consist of a signal number + followed by a struct sigcontext. With SA_SIGINFO, the + arguments consist a signal number, a siginfo *, and a + ucontext *. */ + unw_word_t sc_addr; + unw_word_t siginfo_ptr_addr = c->dwarf.cfa + 4; + unw_word_t sigcontext_ptr_addr = c->dwarf.cfa + 8; + unw_word_t siginfo_ptr, sigcontext_ptr; + struct dwarf_loc esp_loc, siginfo_ptr_loc, sigcontext_ptr_loc; + + siginfo_ptr_loc = DWARF_LOC (siginfo_ptr_addr, 0); + sigcontext_ptr_loc = DWARF_LOC (sigcontext_ptr_addr, 0); + ret = (dwarf_get (&c->dwarf, siginfo_ptr_loc, &siginfo_ptr) + | dwarf_get (&c->dwarf, sigcontext_ptr_loc, &sigcontext_ptr)); + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } + if (siginfo_ptr < c->dwarf.cfa + || siginfo_ptr > c->dwarf.cfa + 256 + || sigcontext_ptr < c->dwarf.cfa + || sigcontext_ptr > c->dwarf.cfa + 256) + { + /* Not plausible for SA_SIGINFO signal */ + c->sigcontext_format = X86_SCF_LINUX_SIGFRAME; + c->sigcontext_addr = sc_addr = c->dwarf.cfa + 4; + } + else + { + /* If SA_SIGINFO were not specified, we actually read + various segment pointers instead. We believe that at + least fs and _fsh are always zero for linux, so it is + not just unlikely, but impossible that we would end + up here. */ + c->sigcontext_format = X86_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = sigcontext_ptr; + sc_addr = sigcontext_ptr + LINUX_UC_MCONTEXT_OFF; + } + esp_loc = DWARF_LOC (sc_addr + LINUX_SC_ESP_OFF, 0); + ret = dwarf_get (&c->dwarf, esp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } + + c->dwarf.loc[EAX] = DWARF_LOC (sc_addr + LINUX_SC_EAX_OFF, 0); + c->dwarf.loc[ECX] = DWARF_LOC (sc_addr + LINUX_SC_ECX_OFF, 0); + c->dwarf.loc[EDX] = DWARF_LOC (sc_addr + LINUX_SC_EDX_OFF, 0); + c->dwarf.loc[EBX] = DWARF_LOC (sc_addr + LINUX_SC_EBX_OFF, 0); + c->dwarf.loc[EBP] = DWARF_LOC (sc_addr + LINUX_SC_EBP_OFF, 0); + c->dwarf.loc[ESI] = DWARF_LOC (sc_addr + LINUX_SC_ESI_OFF, 0); + c->dwarf.loc[EDI] = DWARF_LOC (sc_addr + LINUX_SC_EDI_OFF, 0); + c->dwarf.loc[EFLAGS] = DWARF_NULL_LOC; + c->dwarf.loc[TRAPNO] = DWARF_NULL_LOC; + c->dwarf.loc[ST0] = DWARF_NULL_LOC; + c->dwarf.loc[EIP] = DWARF_LOC (sc_addr + LINUX_SC_EIP_OFF, 0); + c->dwarf.loc[ESP] = DWARF_LOC (sc_addr + LINUX_SC_ESP_OFF, 0); + + return 0; +} + +HIDDEN dwarf_loc_t +x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg) +{ + unw_word_t addr = c->sigcontext_addr, fpstate_addr, off; + int ret, is_fpstate = 0; + + switch (c->sigcontext_format) + { + case X86_SCF_NONE: + return DWARF_REG_LOC (&c->dwarf, reg); + + case X86_SCF_LINUX_SIGFRAME: + break; + + case X86_SCF_LINUX_RT_SIGFRAME: + addr += LINUX_UC_MCONTEXT_OFF; + break; + + default: + return DWARF_NULL_LOC; + } + + switch (reg) + { + case UNW_X86_GS: off = LINUX_SC_GS_OFF; break; + case UNW_X86_FS: off = LINUX_SC_FS_OFF; break; + case UNW_X86_ES: off = LINUX_SC_ES_OFF; break; + case UNW_X86_DS: off = LINUX_SC_DS_OFF; break; + case UNW_X86_EDI: off = LINUX_SC_EDI_OFF; break; + case UNW_X86_ESI: off = LINUX_SC_ESI_OFF; break; + case UNW_X86_EBP: off = LINUX_SC_EBP_OFF; break; + case UNW_X86_ESP: off = LINUX_SC_ESP_OFF; break; + case UNW_X86_EBX: off = LINUX_SC_EBX_OFF; break; + case UNW_X86_EDX: off = LINUX_SC_EDX_OFF; break; + case UNW_X86_ECX: off = LINUX_SC_ECX_OFF; break; + case UNW_X86_EAX: off = LINUX_SC_EAX_OFF; break; + case UNW_X86_TRAPNO: off = LINUX_SC_TRAPNO_OFF; break; + case UNW_X86_EIP: off = LINUX_SC_EIP_OFF; break; + case UNW_X86_CS: off = LINUX_SC_CS_OFF; break; + case UNW_X86_EFLAGS: off = LINUX_SC_EFLAGS_OFF; break; + case UNW_X86_SS: off = LINUX_SC_SS_OFF; break; + + /* The following is probably not correct for all possible cases. + Somebody who understands this better should review this for + correctness. */ + + case UNW_X86_FCW: is_fpstate = 1; off = LINUX_FPSTATE_CW_OFF; break; + case UNW_X86_FSW: is_fpstate = 1; off = LINUX_FPSTATE_SW_OFF; break; + case UNW_X86_FTW: is_fpstate = 1; off = LINUX_FPSTATE_TAG_OFF; break; + case UNW_X86_FCS: is_fpstate = 1; off = LINUX_FPSTATE_CSSEL_OFF; break; + case UNW_X86_FIP: is_fpstate = 1; off = LINUX_FPSTATE_IPOFF_OFF; break; + case UNW_X86_FEA: is_fpstate = 1; off = LINUX_FPSTATE_DATAOFF_OFF; break; + case UNW_X86_FDS: is_fpstate = 1; off = LINUX_FPSTATE_DATASEL_OFF; break; + case UNW_X86_MXCSR: is_fpstate = 1; off = LINUX_FPSTATE_MXCSR_OFF; break; + + /* stacked fp registers */ + case UNW_X86_ST0: case UNW_X86_ST1: case UNW_X86_ST2: case UNW_X86_ST3: + case UNW_X86_ST4: case UNW_X86_ST5: case UNW_X86_ST6: case UNW_X86_ST7: + is_fpstate = 1; + off = LINUX_FPSTATE_ST0_OFF + 10*(reg - UNW_X86_ST0); + break; + + /* SSE fp registers */ + case UNW_X86_XMM0_lo: case UNW_X86_XMM0_hi: + case UNW_X86_XMM1_lo: case UNW_X86_XMM1_hi: + case UNW_X86_XMM2_lo: case UNW_X86_XMM2_hi: + case UNW_X86_XMM3_lo: case UNW_X86_XMM3_hi: + case UNW_X86_XMM4_lo: case UNW_X86_XMM4_hi: + case UNW_X86_XMM5_lo: case UNW_X86_XMM5_hi: + case UNW_X86_XMM6_lo: case UNW_X86_XMM6_hi: + case UNW_X86_XMM7_lo: case UNW_X86_XMM7_hi: + is_fpstate = 1; + off = LINUX_FPSTATE_XMM0_OFF + 8*(reg - UNW_X86_XMM0_lo); + break; + case UNW_X86_XMM0: + case UNW_X86_XMM1: + case UNW_X86_XMM2: + case UNW_X86_XMM3: + case UNW_X86_XMM4: + case UNW_X86_XMM5: + case UNW_X86_XMM6: + case UNW_X86_XMM7: + is_fpstate = 1; + off = LINUX_FPSTATE_XMM0_OFF + 16*(reg - UNW_X86_XMM0); + break; + + case UNW_X86_FOP: + case UNW_X86_TSS: + case UNW_X86_LDT: + default: + return DWARF_REG_LOC (&c->dwarf, reg); + } + + if (is_fpstate) + { + if ((ret = dwarf_get (&c->dwarf, + DWARF_MEM_LOC (&c->dwarf, + addr + LINUX_SC_FPSTATE_OFF), + &fpstate_addr)) < 0) + return DWARF_NULL_LOC; + + if (!fpstate_addr) + return DWARF_NULL_LOC; + + return DWARF_MEM_LOC (c, fpstate_addr + off); + } + else + return DWARF_MEM_LOC (c, addr + off); +} + +#ifndef UNW_REMOTE_ONLY +HIDDEN void * +x86_r_uc_addr (ucontext_t *uc, int reg) +{ + void *addr; + + switch (reg) + { + case UNW_X86_GS: addr = &uc->uc_mcontext.gregs[REG_GS]; break; + case UNW_X86_FS: addr = &uc->uc_mcontext.gregs[REG_FS]; break; + case UNW_X86_ES: addr = &uc->uc_mcontext.gregs[REG_ES]; break; + case UNW_X86_DS: addr = &uc->uc_mcontext.gregs[REG_DS]; break; + case UNW_X86_EAX: addr = &uc->uc_mcontext.gregs[REG_EAX]; break; + case UNW_X86_EBX: addr = &uc->uc_mcontext.gregs[REG_EBX]; break; + case UNW_X86_ECX: addr = &uc->uc_mcontext.gregs[REG_ECX]; break; + case UNW_X86_EDX: addr = &uc->uc_mcontext.gregs[REG_EDX]; break; + case UNW_X86_ESI: addr = &uc->uc_mcontext.gregs[REG_ESI]; break; + case UNW_X86_EDI: addr = &uc->uc_mcontext.gregs[REG_EDI]; break; + case UNW_X86_EBP: addr = &uc->uc_mcontext.gregs[REG_EBP]; break; + case UNW_X86_EIP: addr = &uc->uc_mcontext.gregs[REG_EIP]; break; + case UNW_X86_ESP: addr = &uc->uc_mcontext.gregs[REG_ESP]; break; + case UNW_X86_TRAPNO: addr = &uc->uc_mcontext.gregs[REG_TRAPNO]; break; + case UNW_X86_CS: addr = &uc->uc_mcontext.gregs[REG_CS]; break; + case UNW_X86_EFLAGS: addr = &uc->uc_mcontext.gregs[REG_EFL]; break; + case UNW_X86_SS: addr = &uc->uc_mcontext.gregs[REG_SS]; break; + + default: + addr = NULL; + } + return addr; +} + +HIDDEN int +x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + struct cursor *c = (struct cursor *) cursor; + ucontext_t *uc = c->uc; + + /* Ensure c->pi is up-to-date. On x86, it's relatively common to be + missing DWARF unwind info. We don't want to fail in that case, + because the frame-chain still would let us do a backtrace at + least. */ + dwarf_make_proc_info (&c->dwarf); + + if (unlikely (c->sigcontext_format != X86_SCF_NONE)) + { +#if (!HAVE_SGX) + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + + Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc); + sigreturn (sc); +#endif + } + else + { + Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); + setcontext (uc); + } + return -UNW_EINVAL; +} +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gregs.c b/sdk/cpprt/linux/libunwind/src/x86/Gregs.c new file mode 100644 index 0000000000..05bc1a309e --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gregs.c @@ -0,0 +1,178 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" +#include "unwind_i.h" + +HIDDEN dwarf_loc_t +x86_scratch_loc (struct cursor *c, unw_regnum_t reg) +{ + if (c->sigcontext_addr) + return x86_get_scratch_loc (c, reg); + else + return DWARF_REG_LOC (&c->dwarf, reg); +} + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + unsigned int mask; + int arg_num; + + switch (reg) + { + + case UNW_X86_EIP: + if (write) + c->dwarf.ip = *valp; /* also update the EIP cache */ + loc = c->dwarf.loc[EIP]; + break; + + case UNW_X86_CFA: + case UNW_X86_ESP: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + case UNW_X86_EAX: + case UNW_X86_EDX: + arg_num = reg - UNW_X86_EAX; + mask = (1 << arg_num); + if (write) + { + c->dwarf.eh_args[arg_num] = *valp; + c->dwarf.eh_valid_mask |= mask; + return 0; + } + else if ((c->dwarf.eh_valid_mask & mask) != 0) + { + *valp = c->dwarf.eh_args[arg_num]; + return 0; + } + else + loc = c->dwarf.loc[(reg == UNW_X86_EAX) ? EAX : EDX]; + break; + + case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break; + case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break; + + case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break; + case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break; + case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break; + case UNW_X86_EFLAGS: loc = c->dwarf.loc[EFLAGS]; break; + case UNW_X86_TRAPNO: loc = c->dwarf.loc[TRAPNO]; break; + + case UNW_X86_FCW: + case UNW_X86_FSW: + case UNW_X86_FTW: + case UNW_X86_FOP: + case UNW_X86_FCS: + case UNW_X86_FIP: + case UNW_X86_FEA: + case UNW_X86_FDS: + case UNW_X86_MXCSR: + case UNW_X86_GS: + case UNW_X86_FS: + case UNW_X86_ES: + case UNW_X86_DS: + case UNW_X86_SS: + case UNW_X86_CS: + case UNW_X86_TSS: + case UNW_X86_LDT: + loc = x86_scratch_loc (c, reg); + break; + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + struct dwarf_loc loc = DWARF_NULL_LOC; + + switch (reg) + { + case UNW_X86_ST0: + loc = c->dwarf.loc[ST0]; + break; + + /* stacked fp registers */ + case UNW_X86_ST1: + case UNW_X86_ST2: + case UNW_X86_ST3: + case UNW_X86_ST4: + case UNW_X86_ST5: + case UNW_X86_ST6: + case UNW_X86_ST7: + /* SSE fp registers */ + case UNW_X86_XMM0: + case UNW_X86_XMM1: + case UNW_X86_XMM2: + case UNW_X86_XMM3: + case UNW_X86_XMM4: + case UNW_X86_XMM5: + case UNW_X86_XMM6: + case UNW_X86_XMM7: + case UNW_X86_XMM0_lo: + case UNW_X86_XMM0_hi: + case UNW_X86_XMM1_lo: + case UNW_X86_XMM1_hi: + case UNW_X86_XMM2_lo: + case UNW_X86_XMM2_hi: + case UNW_X86_XMM3_lo: + case UNW_X86_XMM3_hi: + case UNW_X86_XMM4_lo: + case UNW_X86_XMM4_hi: + case UNW_X86_XMM5_lo: + case UNW_X86_XMM5_hi: + case UNW_X86_XMM6_lo: + case UNW_X86_XMM6_hi: + case UNW_X86_XMM7_lo: + case UNW_X86_XMM7_hi: + loc = x86_scratch_loc (c, reg); + break; + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_putfp (&c->dwarf, loc, *valp); + else + return dwarf_getfp (&c->dwarf, loc, valp); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gresume.c b/sdk/cpprt/linux/libunwind/src/x86/Gresume.c new file mode 100644 index 0000000000..c39c58843a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gresume.c @@ -0,0 +1,82 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" +#include "offsets.h" + +/* This routine is responsible for copying the register values in + cursor C and establishing them as the current machine state. */ + +static inline int +establish_machine_state (struct cursor *c) +{ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int write, void *); + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int write, void *); + unw_addr_space_t as = c->dwarf.as; + void *arg = c->dwarf.as_arg; + unw_fpreg_t fpval; + unw_word_t val; + int reg; + + access_reg = as->acc.access_reg; + access_fpreg = as->acc.access_fpreg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_REG_LAST; ++reg) + { + Debug (16, "copying %s %d\n", unw_regname (reg), reg); + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } + } + return 0; +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + if ((ret = establish_machine_state (c)) < 0) + return ret; + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Gstep.c b/sdk/cpprt/linux/libunwind/src/x86/Gstep.c new file mode 100644 index 0000000000..0965db2fde --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Gstep.c @@ -0,0 +1,115 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret, i; + + Debug (1, "(cursor=%p, ip=0x%08x)\n", c, (unsigned) c->dwarf.ip); + + /* Try DWARF-based unwinding... */ + ret = dwarf_step (&c->dwarf); + + if (ret < 0 && ret != -UNW_ENOINFO) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + if (unlikely (ret < 0)) + { + /* DWARF failed, let's see if we can follow the frame-chain + or skip over the signal trampoline. */ + struct dwarf_loc ebp_loc, eip_loc; + + /* We could get here because of missing/bad unwind information. + Validate all addresses before dereferencing. */ + c->validate = 1; + + Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret); + + if (unw_is_signal_frame (cursor)) + { + ret = unw_handle_signal_frame(cursor); + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } + } + else + { + ret = dwarf_get (&c->dwarf, c->dwarf.loc[EBP], &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + Debug (13, "[EBP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EBP]), + c->dwarf.cfa); + + ebp_loc = DWARF_LOC (c->dwarf.cfa, 0); + eip_loc = DWARF_LOC (c->dwarf.cfa + 4, 0); + c->dwarf.cfa += 8; + + /* Mark all registers unsaved, since we don't know where + they are saved (if at all), except for the EBP and + EIP. */ + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + c->dwarf.loc[EBP] = ebp_loc; + c->dwarf.loc[EIP] = eip_loc; + } + c->dwarf.ret_addr_column = EIP; + + if (!DWARF_IS_NULL_LOC (c->dwarf.loc[EBP])) + { + ret = dwarf_get (&c->dwarf, c->dwarf.loc[EIP], &c->dwarf.ip); + if (ret < 0) + { + Debug (13, "dwarf_get([EIP=0x%x]) failed\n", DWARF_GET_LOC (c->dwarf.loc[EIP])); + Debug (2, "returning %d\n", ret); + return ret; + } + else + { + Debug (13, "[EIP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EIP]), + c->dwarf.ip); + } + } + else + c->dwarf.ip = 0; + } + ret = (c->dwarf.ip == 0) ? 0 : 1; + Debug (2, "returning %d\n", ret); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/x86/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/x86/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/x86/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lglobal.c b/sdk/cpprt/linux/libunwind/src/x86/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Linit.c b/sdk/cpprt/linux/libunwind/src/x86/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Linit_local.c b/sdk/cpprt/linux/libunwind/src/x86/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/x86/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Los-freebsd.c b/sdk/cpprt/linux/libunwind/src/x86/Los-freebsd.c new file mode 100644 index 0000000000..a75a205df1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Los-freebsd.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gos-freebsd.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Los-linux.c b/sdk/cpprt/linux/libunwind/src/x86/Los-linux.c new file mode 100644 index 0000000000..3cc18aabcc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Los-linux.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gos-linux.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lregs.c b/sdk/cpprt/linux/libunwind/src/x86/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lresume.c b/sdk/cpprt/linux/libunwind/src/x86/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/Lstep.c b/sdk/cpprt/linux/libunwind/src/x86/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86/getcontext-freebsd.S b/sdk/cpprt/linux/libunwind/src/x86/getcontext-freebsd.S new file mode 100644 index 0000000000..670eff1ae1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/getcontext-freebsd.S @@ -0,0 +1,112 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" + + .global _Ux86_getcontext + .type _Ux86_getcontext, @function +_Ux86_getcontext: + .cfi_startproc + pushl %eax + .cfi_adjust_cfa_offset 4 + mov 8(%esp),%eax /* ucontext_t* */ + popl FREEBSD_UC_MCONTEXT_EAX_OFF(%eax) + .cfi_adjust_cfa_offset 4 + movl %ebx, FREEBSD_UC_MCONTEXT_EBX_OFF(%eax) + movl %ecx, FREEBSD_UC_MCONTEXT_ECX_OFF(%eax) + movl %edx, FREEBSD_UC_MCONTEXT_EDX_OFF(%eax) + movl %edi, FREEBSD_UC_MCONTEXT_EDI_OFF(%eax) + movl %esi, FREEBSD_UC_MCONTEXT_ESI_OFF(%eax) + movl %ebp, FREEBSD_UC_MCONTEXT_EBP_OFF(%eax) + + movl (%esp), %ecx + movl %ecx, FREEBSD_UC_MCONTEXT_EIP_OFF(%eax) + + leal 4(%esp), %ecx /* Exclude the return address. */ + movl %ecx, FREEBSD_UC_MCONTEXT_ESP_OFF(%eax) + + xorl %ecx, %ecx + movw %fs, %cx + movl %ecx, FREEBSD_UC_MCONTEXT_FS_OFF(%eax) + movw %gs, %cx + movl %ecx, FREEBSD_UC_MCONTEXT_GS_OFF(%eax) + movw %ds, %cx + movl %ecx, FREEBSD_UC_MCONTEXT_DS_OFF(%eax) + movw %es, %cx + movl %ecx, FREEBSD_UC_MCONTEXT_ES_OFF(%eax) + movw %ss, %cx + movl %ecx, FREEBSD_UC_MCONTEXT_SS_OFF(%eax) + movw %cs, %cx + movl %ecx, FREEBSD_UC_MCONTEXT_CS_OFF(%eax) + + pushfl + .cfi_adjust_cfa_offset 4 + popl FREEBSD_UC_MCONTEXT_EFLAGS_OFF(%eax) + .cfi_adjust_cfa_offset -4 + + movl $0, FREEBSD_UC_MCONTEXT_TRAPNO_OFF(%eax) + + movl $FREEBSD_UC_MCONTEXT_FPOWNED_FPU,\ + FREEBSD_UC_MCONTEXT_OWNEDFP_OFF(%eax) + movl $FREEBSD_UC_MCONTEXT_FPFMT_XMM,\ + FREEBSD_UC_MCONTEXT_FPFORMAT_OFF(%eax) + + /* + * Require CPU with fxsave implemented, and enabled by OS. + * + * If passed ucontext is not aligned to 16-byte boundary, + * save fpu context into temporary aligned location on stack + * and then copy. + */ + leal FREEBSD_UC_MCONTEXT_FPSTATE_OFF(%eax), %edx + testl $0xf, %edx + jne 2f + fxsave (%edx) /* fast path, passed ucontext save area was aligned */ +1: movl $FREEBSD_UC_MCONTEXT_MC_LEN_VAL,\ + FREEBSD_UC_MCONTEXT_MC_LEN_OFF(%eax) + + xorl %eax, %eax + ret + +2: movl %edx, %edi /* not aligned, do the dance */ + subl $512 + 16, %esp /* save area and 16 bytes for alignment */ + .cfi_adjust_cfa_offset 512 + 16 + movl %esp, %edx + orl $0xf, %edx /* align *%edx to 16-byte up */ + incl %edx + fxsave (%edx) + movl %edx, %esi /* copy to the final destination */ + movl $512/4,%ecx + rep; movsl + addl $512 + 16, %esp /* restore the stack */ + .cfi_adjust_cfa_offset -512 - 16 + movl FREEBSD_UC_MCONTEXT_ESI_OFF(%eax), %esi + movl FREEBSD_UC_MCONTEXT_EDI_OFF(%eax), %edi + jmp 1b + + .cfi_endproc + .size _Ux86_getcontext, . - _Ux86_getcontext + + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86/getcontext-linux.S b/sdk/cpprt/linux/libunwind/src/x86/getcontext-linux.S new file mode 100644 index 0000000000..c469dadbac --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/getcontext-linux.S @@ -0,0 +1,74 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2009 Google, Inc + Contributed by Paul Pluzhnikov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "offsets.h" + +/* int _Ux86_getcontext (ucontext_t *ucp) + + Saves the machine context in UCP necessary for libunwind. + Unlike the libc implementation, we don't save the signal mask + and hence avoid the cost of a system call per unwind. + +*/ + + .global _Ux86_getcontext + .type _Ux86_getcontext, @function +_Ux86_getcontext: + .cfi_startproc + mov 4(%esp),%eax /* ucontext_t* */ + + /* EAX is not preserved. */ + movl $0, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EAX_OFF)(%eax) + + movl %ebx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EBX_OFF)(%eax) + movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ECX_OFF)(%eax) + movl %edx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EDX_OFF)(%eax) + movl %edi, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EDI_OFF)(%eax) + movl %esi, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ESI_OFF)(%eax) + movl %ebp, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EBP_OFF)(%eax) + + movl (%esp), %ecx + movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EIP_OFF)(%eax) + + leal 4(%esp), %ecx /* Exclude the return address. */ + movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ESP_OFF)(%eax) + + /* glibc getcontext saves FS, but not GS */ + xorl %ecx, %ecx + movw %fs, %cx + movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FS_OFF)(%eax) + + leal LINUX_UC_FPREGS_MEM_OFF(%eax), %ecx + movl %ecx, (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FPSTATE_OFF)(%eax) + fnstenv (%ecx) + fldenv (%ecx) + + xor %eax, %eax + ret + .cfi_endproc + .size _Ux86_getcontext, . - _Ux86_getcontext + + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86/init.h b/sdk/cpprt/linux/libunwind/src/x86/init.h new file mode 100644 index 0000000000..f35387d48a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/init.h @@ -0,0 +1,70 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret, i; + + c->dwarf.loc[EAX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EAX); + c->dwarf.loc[ECX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ECX); + c->dwarf.loc[EDX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EDX); + c->dwarf.loc[EBX] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EBX); + c->dwarf.loc[ESP] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ESP); + c->dwarf.loc[EBP] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EBP); + c->dwarf.loc[ESI] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ESI); + c->dwarf.loc[EDI] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EDI); + c->dwarf.loc[EIP] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EIP); + c->dwarf.loc[EFLAGS] = DWARF_REG_LOC (&c->dwarf, UNW_X86_EFLAGS); + c->dwarf.loc[TRAPNO] = DWARF_REG_LOC (&c->dwarf, UNW_X86_TRAPNO); + c->dwarf.loc[ST0] = DWARF_REG_LOC (&c->dwarf, UNW_X86_ST0); + for (i = ST0 + 1; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[EIP], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_X86_ESP), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + c->sigcontext_format = X86_SCF_NONE; + c->sigcontext_addr = 0; + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/is_fpreg.c b/sdk/cpprt/linux/libunwind/src/x86/is_fpreg.c new file mode 100644 index 0000000000..8f1536d1e9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/is_fpreg.c @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_is_fpreg (int regnum) +{ + return ((regnum >= UNW_X86_ST0 && regnum <= UNW_X86_ST7) + || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi) + || (regnum >= UNW_X86_XMM0 && regnum <= UNW_X86_XMM7)); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/longjmp.S b/sdk/cpprt/linux/libunwind/src/x86/longjmp.S new file mode 100644 index 0000000000..05173d0c10 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/longjmp.S @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .globl _UI_longjmp_cont + + .type _UI_longjmp_cont, @function +_UI_longjmp_cont: + .cfi_startproc + .cfi_register 8, 0 /* IP saved in EAX */ + push %eax /* push target IP as return address */ + .cfi_restore 8 + mov %edx, %eax /* set up return-value */ + ret + .cfi_endproc + .size _UI_siglongjmp_cont, .-_UI_longjmp_cont + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86/offsets.h b/sdk/cpprt/linux/libunwind/src/x86/offsets.h new file mode 100644 index 0000000000..538f8f5627 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/offsets.h @@ -0,0 +1,142 @@ +/* Linux-specific definitions: */ + +/* Define various structure offsets to simplify cross-compilation. */ + +/* Offsets for x86 Linux "ucontext_t": */ + +#define LINUX_UC_FLAGS_OFF 0x00 +#define LINUX_UC_LINK_OFF 0x04 +#define LINUX_UC_STACK_OFF 0x08 +#define LINUX_UC_MCONTEXT_OFF 0x14 +#define LINUX_UC_FPREGS_PTR_OFF 0x60 // LINUX_UC_MCONTEXT_OFF + sizeof(gregset_t) +#define LINUX_UC_SIGMASK_OFF 0x6c + +# define LINUX_UC_FPREGS_MEM_OFF 0xec + +/* The struct sigcontext is located at an offset of 4 + from the stack pointer in the signal frame. */ + +/* Offsets for x86 Linux "struct sigcontext": */ + +#define LINUX_SC_GS_OFF 0x00 +#define LINUX_SC_GSH_OFF 0x02 +#define LINUX_SC_FS_OFF 0x04 +#define LINUX_SC_FSH_OFF 0x06 +#define LINUX_SC_ES_OFF 0x08 +#define LINUX_SC_ESH_OFF 0x0a +#define LINUX_SC_DS_OFF 0x0c +#define LINUX_SC_DSH_OFF 0x0e +#define LINUX_SC_EDI_OFF 0x10 +#define LINUX_SC_ESI_OFF 0x14 +#define LINUX_SC_EBP_OFF 0x18 +#define LINUX_SC_ESP_OFF 0x1c +#define LINUX_SC_EBX_OFF 0x20 +#define LINUX_SC_EDX_OFF 0x24 +#define LINUX_SC_ECX_OFF 0x28 +#define LINUX_SC_EAX_OFF 0x2c +#define LINUX_SC_TRAPNO_OFF 0x30 +#define LINUX_SC_ERR_OFF 0x34 +#define LINUX_SC_EIP_OFF 0x38 +#define LINUX_SC_CS_OFF 0x3c +#define LINUX_SC_CSH_OFF 0x3e +#define LINUX_SC_EFLAGS_OFF 0x40 +#define LINUX_SC_ESP_AT_SIGNAL_OFF 0x44 +#define LINUX_SC_SS_OFF 0x48 +#define LINUX_SC_SSH_OFF 0x4a +#define LINUX_SC_FPSTATE_OFF 0x4c +#define LINUX_SC_OLDMASK_OFF 0x50 +#define LINUX_SC_CR2_OFF 0x54 + +/* Offsets for x86 Linux "struct _fpstate": */ + +#define LINUX_FPSTATE_CW_OFF 0x000 +#define LINUX_FPSTATE_SW_OFF 0x004 +#define LINUX_FPSTATE_TAG_OFF 0x008 +#define LINUX_FPSTATE_IPOFF_OFF 0x00c +#define LINUX_FPSTATE_CSSEL_OFF 0x010 +#define LINUX_FPSTATE_DATAOFF_OFF 0x014 +#define LINUX_FPSTATE_DATASEL_OFF 0x018 +#define LINUX_FPSTATE_ST0_OFF 0x01c +#define LINUX_FPSTATE_ST1_OFF 0x026 +#define LINUX_FPSTATE_ST2_OFF 0x030 +#define LINUX_FPSTATE_ST3_OFF 0x03a +#define LINUX_FPSTATE_ST4_OFF 0x044 +#define LINUX_FPSTATE_ST5_OFF 0x04e +#define LINUX_FPSTATE_ST6_OFF 0x058 +#define LINUX_FPSTATE_ST7_OFF 0x062 +#define LINUX_FPSTATE_STATUS_OFF 0x06c +#define LINUX_FPSTATE_MAGIC_OFF 0x06e +#define LINUX_FPSTATE_FXSR_ENV_OFF 0x070 +#define LINUX_FPSTATE_MXCSR_OFF 0x088 +#define LINUX_FPSTATE_FXSR_ST0_OFF 0x090 +#define LINUX_FPSTATE_FXSR_ST1_OFF 0x0a0 +#define LINUX_FPSTATE_FXSR_ST2_OFF 0x0b0 +#define LINUX_FPSTATE_FXSR_ST3_OFF 0x0c0 +#define LINUX_FPSTATE_FXSR_ST4_OFF 0x0d0 +#define LINUX_FPSTATE_FXSR_ST5_OFF 0x0e0 +#define LINUX_FPSTATE_FXSR_ST6_OFF 0x0f0 +#define LINUX_FPSTATE_FXSR_ST7_OFF 0x100 +#define LINUX_FPSTATE_XMM0_OFF 0x110 +#define LINUX_FPSTATE_XMM1_OFF 0x120 +#define LINUX_FPSTATE_XMM2_OFF 0x130 +#define LINUX_FPSTATE_XMM3_OFF 0x140 +#define LINUX_FPSTATE_XMM4_OFF 0x150 +#define LINUX_FPSTATE_XMM5_OFF 0x160 +#define LINUX_FPSTATE_XMM6_OFF 0x170 +#define LINUX_FPSTATE_XMM7_OFF 0x180 + +/* FreeBSD-specific definitions: */ + +#define FREEBSD_SC_UCONTEXT_OFF 0x20 +#define FREEBSD_UC_MCONTEXT_OFF 0x10 + +#define FREEBSD_UC_MCONTEXT_GS_OFF 0x14 +#define FREEBSD_UC_MCONTEXT_FS_OFF 0x18 +#define FREEBSD_UC_MCONTEXT_ES_OFF 0x1c +#define FREEBSD_UC_MCONTEXT_DS_OFF 0x20 +#define FREEBSD_UC_MCONTEXT_EDI_OFF 0x24 +#define FREEBSD_UC_MCONTEXT_ESI_OFF 0x28 +#define FREEBSD_UC_MCONTEXT_EBP_OFF 0x2c +#define FREEBSD_UC_MCONTEXT_EBX_OFF 0x34 +#define FREEBSD_UC_MCONTEXT_EDX_OFF 0x38 +#define FREEBSD_UC_MCONTEXT_ECX_OFF 0x3c +#define FREEBSD_UC_MCONTEXT_EAX_OFF 0x40 +#define FREEBSD_UC_MCONTEXT_TRAPNO_OFF 0x44 +#define FREEBSD_UC_MCONTEXT_EIP_OFF 0x4c +#define FREEBSD_UC_MCONTEXT_ESP_OFF 0x58 +#define FREEBSD_UC_MCONTEXT_CS_OFF 0x50 +#define FREEBSD_UC_MCONTEXT_EFLAGS_OFF 0x54 +#define FREEBSD_UC_MCONTEXT_SS_OFF 0x5c +#define FREEBSD_UC_MCONTEXT_MC_LEN_OFF 0x60 +#define FREEBSD_UC_MCONTEXT_FPFORMAT_OFF 0x64 +#define FREEBSD_UC_MCONTEXT_OWNEDFP_OFF 0x68 +#define FREEBSD_UC_MCONTEXT_FPSTATE_OFF 0x70 + +#define FREEBSD_UC_MCONTEXT_CW_OFF 0x70 +#define FREEBSD_UC_MCONTEXT_SW_OFF 0x74 +#define FREEBSD_UC_MCONTEXT_TAG_OFF 0x78 +#define FREEBSD_UC_MCONTEXT_IPOFF_OFF 0x7c +#define FREEBSD_UC_MCONTEXT_CSSEL_OFF 0x80 +#define FREEBSD_UC_MCONTEXT_DATAOFF_OFF 0x84 +#define FREEBSD_US_MCONTEXT_DATASEL_OFF 0x88 +#define FREEBSD_UC_MCONTEXT_ST0_OFF 0x8c + +#define FREEBSD_UC_MCONTEXT_CW_XMM_OFF 0x70 +#define FREEBSD_UC_MCONTEXT_SW_XMM_OFF 0x72 +#define FREEBSD_UC_MCONTEXT_TAG_XMM_OFF 0x74 +#define FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF 0x78 +#define FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF 0x7c +#define FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF 0x80 +#define FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF 0x84 +#define FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF 0x88 +#define FREEBSD_UC_MCONTEXT_ST0_XMM_OFF 0x90 +#define FREEBSD_UC_MCONTEXT_XMM0_OFF 0x110 + +#define FREEBSD_UC_MCONTEXT_MC_LEN_VAL 0x280 +#define FREEBSD_UC_MCONTEXT_FPFMT_NODEV 0x10000 +#define FREEBSD_UC_MCONTEXT_FPFMT_387 0x10001 +#define FREEBSD_UC_MCONTEXT_FPFMT_XMM 0x10002 +#define FREEBSD_UC_MCONTEXT_FPOWNED_NONE 0x20000 +#define FREEBSD_UC_MCONTEXT_FPOWNED_FPU 0x20001 +#define FREEBSD_UC_MCONTEXT_FPOWNED_PCB 0x20002 + diff --git a/sdk/cpprt/linux/libunwind/src/x86/regname.c b/sdk/cpprt/linux/libunwind/src/x86/regname.c new file mode 100644 index 0000000000..2228510a21 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/regname.c @@ -0,0 +1,27 @@ +#include "unwind_i.h" + +static const char *regname[] = + { + "eax", "edx", "ecx", "ebx", "esi", "edi", "ebp", "esp", "eip", + "eflags", "trapno", + "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7", + "fcw", "fsw", "ftw", "fop", "fcs", "fip", "fea", "fds", + "xmm0_lo", "xmm0_hi", "xmm1_lo", "xmm1_hi", + "xmm2_lo", "xmm2_hi", "xmm3_lo", "xmm3_hi", + "xmm4_lo", "xmm4_hi", "xmm5_lo", "xmm5_hi", + "xmm6_lo", "xmm6_hi", "xmm7_lo", "xmm7_hi", + "mxcsr", + "gs", "fs", "es", "ds", "ss", "cs", + "tss", "ldt", + "cfi", + "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/x86/siglongjmp.S new file mode 100644 index 0000000000..32bba3b3b6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/siglongjmp.S @@ -0,0 +1,92 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2011 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .globl _UI_siglongjmp_cont + +#if defined(__linux__) +#define SIG_SETMASK 2 +#elif defined(__FreeBSD__) +#define SIG_SETMASK 3 +#endif + + /* Stack layout at this point: + + +------------+ <- original $esp (at time of setjmp() call) + | sigmask[1] | + +------------+ + | sigmask[0] | + +------------+ + */ + + .type _UI_siglongjmp_cont, @function +_UI_siglongjmp_cont: + .cfi_startproc +#ifdef __linux__ + .cfi_register 8, 0 /* IP saved in EAX */ + .cfi_def_cfa_offset 8 + mov %esp, %ecx /* pass address of signal mask in 3rd sc arg */ + push %eax /* save target IP */ + .cfi_adjust_cfa_offset 4 + .cfi_offset 8, -12 + push %edx /* save return value */ + .cfi_adjust_cfa_offset 4 + push %ebx /* save %ebx (preserved) */ + .cfi_adjust_cfa_offset 4 + .cfi_offset 3, -20 + mov $SIG_SETMASK, %ebx /* 1st syscall arg (how) */ + xor %edx, %edx /* pass NULL as 3rd syscall arg (old maskp) */ + int $0x80 + pop %ebx /* restore %ebx */ + .cfi_adjust_cfa_offset -4 + .cfi_restore 3 + pop %eax /* fetch return value */ + .cfi_adjust_cfa_offset -4 + pop %edx /* pop target IP */ + .cfi_adjust_cfa_offset -4 + .cfi_register 8, 2 /* saved IP is now n EDX */ + lea 8(%esp), %esp /* pop sigmask */ + .cfi_adjust_cfa_offset -4 + jmp *%edx +#elif defined(__FreeBSD__) + pushl %eax + pushl %edx + pushl $0 + pushl %ecx + pushl $SIG_SETMASK + movl $340,%eax + pushl %eax + int $0x80 + addl $16,%esp + popl %eax + popl %edx + jmp *%edx +#else +#error Port me +#endif + .cfi_endproc + .size _UI_siglongjmp_cont, .-_UI_siglongjmp_cont + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86/unwind_i.h b/sdk/cpprt/linux/libunwind/src/x86/unwind_i.h new file mode 100644 index 0000000000..6d1d5e9f94 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86/unwind_i.h @@ -0,0 +1,64 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include "libunwind_i.h" + +/* DWARF column numbers: */ +#define EAX 0 +#define ECX 1 +#define EDX 2 +#define EBX 3 +#define ESP 4 +#define EBP 5 +#define ESI 6 +#define EDI 7 +#define EIP 8 +#define EFLAGS 9 +#define TRAPNO 10 +#define ST0 11 + +#define x86_lock UNW_OBJ(lock) +#define x86_local_resume UNW_OBJ(local_resume) +#define x86_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define x86_scratch_loc UNW_OBJ(scratch_loc) +#define x86_get_scratch_loc UNW_OBJ(get_scratch_loc) +#define x86_r_uc_addr UNW_OBJ(r_uc_addr) + +extern void x86_local_addr_space_init (void); +extern int x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); +extern dwarf_loc_t x86_scratch_loc (struct cursor *c, unw_regnum_t reg); +extern dwarf_loc_t x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg); +extern void *x86_r_uc_addr (ucontext_t *uc, int reg); + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gcreate_addr_space.c new file mode 100644 index 0000000000..fbdb1e8758 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gcreate_addr_space.c @@ -0,0 +1,59 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "unwind_i.h" + +#if defined(_LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN) +#define __LITTLE_ENDIAN _LITTLE_ENDIAN +#endif + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* + * x86_64 supports only little-endian. + */ + if (byte_order != 0 && byte_order != __LITTLE_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + as->acc = *a; + + return as; +#endif +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gget_proc_info.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gget_proc_info.c new file mode 100644 index 0000000000..213666e0ff --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gget_proc_info.c @@ -0,0 +1,48 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + + if (dwarf_make_proc_info (&c->dwarf) < 0) + { + /* On x86-64, some key routines such as _start() and _dl_start() + are missing DWARF unwind info. We don't want to fail in that + case, because those frames are uninteresting and just mark + the end of the frame-chain anyhow. */ + memset (pi, 0, sizeof (*pi)); + pi->start_ip = c->dwarf.ip; + pi->end_ip = c->dwarf.ip + 1; + return 0; + } + *pi = c->dwarf.pi; + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gget_save_loc.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gget_save_loc.c new file mode 100644 index 0000000000..20b14a5b10 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gget_save_loc.c @@ -0,0 +1,73 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + loc = DWARF_NULL_LOC; /* default to "not saved" */ + + switch (reg) + { + case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break; + case UNW_X86_64_RSP: loc = c->dwarf.loc[RSP]; break; + case UNW_X86_64_RBP: loc = c->dwarf.loc[RBP]; break; + case UNW_X86_64_R12: loc = c->dwarf.loc[R12]; break; + case UNW_X86_64_R13: loc = c->dwarf.loc[R13]; break; + case UNW_X86_64_R14: loc = c->dwarf.loc[R14]; break; + case UNW_X86_64_R15: loc = c->dwarf.loc[R15]; break; + + default: + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gglobal.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gglobal.c new file mode 100644 index 0000000000..6d28b75021 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gglobal.c @@ -0,0 +1,103 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN pthread_mutex_t x86_64_lock = PTHREAD_MUTEX_INITIALIZER; +HIDDEN int tdep_needs_initialization = 1; + +/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */ + +HIDDEN uint8_t dwarf_to_unw_regnum_map[DWARF_NUM_PRESERVED_REGS] = + { + UNW_X86_64_RAX, + UNW_X86_64_RDX, + UNW_X86_64_RCX, + UNW_X86_64_RBX, + UNW_X86_64_RSI, + UNW_X86_64_RDI, + UNW_X86_64_RBP, + UNW_X86_64_RSP, + UNW_X86_64_R8, + UNW_X86_64_R9, + UNW_X86_64_R10, + UNW_X86_64_R11, + UNW_X86_64_R12, + UNW_X86_64_R13, + UNW_X86_64_R14, + UNW_X86_64_R15, + UNW_X86_64_RIP, +#ifdef CONFIG_MSABI_SUPPORT + UNW_X86_64_XMM0, + UNW_X86_64_XMM1, + UNW_X86_64_XMM2, + UNW_X86_64_XMM3, + UNW_X86_64_XMM4, + UNW_X86_64_XMM5, + UNW_X86_64_XMM6, + UNW_X86_64_XMM7, + UNW_X86_64_XMM8, + UNW_X86_64_XMM9, + UNW_X86_64_XMM10, + UNW_X86_64_XMM11, + UNW_X86_64_XMM12, + UNW_X86_64_XMM13, + UNW_X86_64_XMM14, + UNW_X86_64_XMM15 +#endif + }; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + +#if (!HAVE_SGX) + sigfillset (&unwi_full_mask); +#endif + + lock_acquire (&x86_64_lock, saved_mask); + { + if (!tdep_needs_initialization) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + + tdep_init_mem_validate (); + +#ifndef UNW_REMOTE_ONLY + x86_64_local_addr_space_init (); +#endif + tdep_needs_initialization = 0; /* signal that we're initialized... */ + } + out: + lock_release (&x86_64_lock, saved_mask); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Ginit.c b/sdk/cpprt/linux/libunwind/src/x86_64/Ginit.c new file mode 100644 index 0000000000..f9eceaa3da --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Ginit.c @@ -0,0 +1,273 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Copyright (C) 2007 David Mosberger-Tang + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +/* XXX fix me: there is currently no way to locate the dyn-info list + by a remote unwinder. On ia64, this is done via a special + unwind-table entry. Perhaps something similar can be done with + DWARF2 unwind info. */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +#define PAGE_SIZE 4096 +#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) + +static int (*mem_validate_func) (void *addr, size_t len); +static int msync_validate (void *addr, size_t len) +{ + return msync (addr, len, MS_ASYNC); +} + +#ifdef HAVE_MINCORE +static int mincore_validate (void *addr, size_t len) +{ + unsigned char mvec[2]; /* Unaligned access may cross page boundary */ + return mincore (addr, len, mvec); +} +#endif + +/* Initialise memory validation method. On linux kernels <2.6.21, + mincore() returns incorrect value for MAP_PRIVATE mappings, + such as stacks. If mincore() was available at compile time, + check if we can actually use it. If not, use msync() instead. */ +HIDDEN void +tdep_init_mem_validate (void) +{ +#ifdef HAVE_MINCORE + unsigned char present = 1; + if (mincore (&present, 1, &present) == 0) + { + Debug(1, "using mincore to validate memory\n"); + mem_validate_func = mincore_validate; + } + else +#endif + { + Debug(1, "using msync to validate memory\n"); + mem_validate_func = msync_validate; + } +} + +/* Cache of already validated addresses */ +#define NLGA 4 +static unw_word_t last_good_addr[NLGA]; +static int lga_victim; + +static int +validate_mem (unw_word_t addr) +{ + int i, victim; + size_t len; + + if (PAGE_START(addr + sizeof (unw_word_t) - 1) == PAGE_START(addr)) + len = PAGE_SIZE; + else + len = PAGE_SIZE * 2; + + addr = PAGE_START(addr); + + if (addr == 0) + return -1; + + for (i = 0; i < NLGA; i++) + { + if (last_good_addr[i] && (addr == last_good_addr[i])) + return 0; + } + + if (mem_validate_func ((void *) addr, len) == -1) + return -1; + + victim = lga_victim; + for (i = 0; i < NLGA; i++) { + if (!last_good_addr[victim]) { + last_good_addr[victim] = addr; + return 0; + } + victim = (victim + 1) % NLGA; + } + + /* All slots full. Evict the victim. */ + last_good_addr[victim] = addr; + victim = (victim + 1) % NLGA; + lga_victim = victim; + + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (unlikely (write)) + { + Debug (16, "mem[%016lx] <- %lx\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + /* validate address */ + const struct cursor *c = (const struct cursor *)arg; + if (likely (c != 0) && unlikely (c->validate) + && unlikely (validate_mem (addr))) + return -1; + *val = *(unw_word_t *) addr; + Debug (16, "mem[%016lx] -> %lx\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = ((struct cursor *)arg)->uc; + + if (unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = x86_64_r_uc_addr (uc, reg))) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- 0x%016lx\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> 0x%016lx\n", unw_regname (reg), *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = ((struct cursor *)arg)->uc; + unw_fpreg_t *addr; + + if (!unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = x86_64_r_uc_addr (uc, reg))) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ +#if HAVE_SGX + return -1; +#else + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +#endif +} + +HIDDEN void +x86_64_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = x86_64_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); + + memset (last_good_addr, 0, sizeof (unw_word_t) * NLGA); + lga_victim = 0; +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Ginit_local.c b/sdk/cpprt/linux/libunwind/src/x86_64/Ginit_local.c new file mode 100644 index 0000000000..54b4fcdb74 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Ginit_local.c @@ -0,0 +1,58 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (unlikely (tdep_needs_initialization)) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = c; + c->uc = uc; + c->validate = 0; + return common_init (c, 1); +} + +#endif /* !UNW_REMOTE_ONLY */ diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Ginit_remote.c b/sdk/cpprt/linux/libunwind/src/x86_64/Ginit_remote.c new file mode 100644 index 0000000000..25dd686000 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Ginit_remote.c @@ -0,0 +1,57 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (tdep_needs_initialization) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + if (as == unw_local_addr_space) + { + c->dwarf.as_arg = c; + c->uc = as_arg; + } + else + { + c->dwarf.as_arg = as_arg; + c->uc = 0; + } + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gos-freebsd.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gos-freebsd.c new file mode 100644 index 0000000000..71695c6588 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gos-freebsd.c @@ -0,0 +1,199 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include "unwind_i.h" +#include "ucontext_i.h" + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + /* XXXKIB */ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, w1, w2, b0, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors (as); + arg = c->dwarf.as_arg; + + /* Check if RIP points at sigreturn sequence. +48 8d 7c 24 10 lea SIGF_UC(%rsp),%rdi +6a 00 pushq $0 +48 c7 c0 a1 01 00 00 movq $SYS_sigreturn,%rax +0f 05 syscall +f4 0: hlt +eb fd jmp 0b + */ + + ip = c->dwarf.ip; + c->sigcontext_format = X86_64_SCF_NONE; + if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0 + || (ret = (*a->access_mem) (as, ip + 16, &w2, 0, arg)) < 0) + return 0; + w2 &= 0xffffff; + if (w0 == 0x48006a10247c8d48 && + w1 == 0x050f000001a1c0c7 && + w2 == 0x0000000000fdebf4) + { + c->sigcontext_format = X86_64_SCF_FREEBSD_SIGFRAME; + return (c->sigcontext_format); + } + /* Check if RIP points at standard syscall sequence. +49 89 ca mov %rcx,%r10 +0f 05 syscall + */ + if ((ret = (*a->access_mem) (as, ip - 5, &b0, 0, arg)) < 0) + return (0); + Debug (12, "b0 0x%lx\n", b0); + if ((b0 & 0xffffffffffffff) == 0x050fca89490000 || + (b0 & 0xffffffffff) == 0x050fca8949) + { + c->sigcontext_format = X86_64_SCF_FREEBSD_SYSCALL; + return (c->sigcontext_format); + } + return (X86_64_SCF_NONE); +} + +PROTECTED int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t ucontext; + int ret; + + if (c->sigcontext_format == X86_64_SCF_FREEBSD_SIGFRAME) + { + ucontext = c->dwarf.cfa + offsetof(struct sigframe, sf_uc); + c->sigcontext_addr = c->dwarf.cfa; + Debug(1, "signal frame, skip over trampoline\n"); + + struct dwarf_loc rsp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSP, 0); + ret = dwarf_get (&c->dwarf, rsp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + c->dwarf.loc[RAX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RAX, 0); + c->dwarf.loc[RDX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RDX, 0); + c->dwarf.loc[RCX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RCX, 0); + c->dwarf.loc[RBX] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RBX, 0); + c->dwarf.loc[RSI] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSI, 0); + c->dwarf.loc[RDI] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RDI, 0); + c->dwarf.loc[RBP] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RBP, 0); + c->dwarf.loc[RSP] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSP, 0); + c->dwarf.loc[ R8] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); + c->dwarf.loc[ R9] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); + c->dwarf.loc[R10] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); + c->dwarf.loc[R11] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); + c->dwarf.loc[R12] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); + c->dwarf.loc[R13] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); + c->dwarf.loc[R14] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); + c->dwarf.loc[R15] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); + c->dwarf.loc[RIP] = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RIP, 0); + + return 0; + } + else if (c->sigcontext_format == X86_64_SCF_FREEBSD_SYSCALL) + { + c->dwarf.loc[RCX] = c->dwarf.loc[R10]; + /* rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0); */ + /* rbp_loc = c->dwarf.loc[RBP]; */ + c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0); + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); + Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n", + (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), + (unsigned long long) c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + c->dwarf.cfa += 8; + return 1; + } + else + return -UNW_EBADFRAME; + +} + +#ifndef UNW_REMOTE_ONLY +HIDDEN void * +x86_64_r_uc_addr (ucontext_t *uc, int reg) +{ + /* NOTE: common_init() in init.h inlines these for fast path access. */ + void *addr; + + switch (reg) + { + case UNW_X86_64_R8: addr = &uc->uc_mcontext.mc_r8; break; + case UNW_X86_64_R9: addr = &uc->uc_mcontext.mc_r9; break; + case UNW_X86_64_R10: addr = &uc->uc_mcontext.mc_r10; break; + case UNW_X86_64_R11: addr = &uc->uc_mcontext.mc_r11; break; + case UNW_X86_64_R12: addr = &uc->uc_mcontext.mc_r12; break; + case UNW_X86_64_R13: addr = &uc->uc_mcontext.mc_r13; break; + case UNW_X86_64_R14: addr = &uc->uc_mcontext.mc_r14; break; + case UNW_X86_64_R15: addr = &uc->uc_mcontext.mc_r15; break; + case UNW_X86_64_RDI: addr = &uc->uc_mcontext.mc_rdi; break; + case UNW_X86_64_RSI: addr = &uc->uc_mcontext.mc_rsi; break; + case UNW_X86_64_RBP: addr = &uc->uc_mcontext.mc_rbp; break; + case UNW_X86_64_RBX: addr = &uc->uc_mcontext.mc_rbx; break; + case UNW_X86_64_RDX: addr = &uc->uc_mcontext.mc_rdx; break; + case UNW_X86_64_RAX: addr = &uc->uc_mcontext.mc_rax; break; + case UNW_X86_64_RCX: addr = &uc->uc_mcontext.mc_rcx; break; + case UNW_X86_64_RSP: addr = &uc->uc_mcontext.mc_rsp; break; + case UNW_X86_64_RIP: addr = &uc->uc_mcontext.mc_rip; break; + + default: + addr = NULL; + } + return addr; +} + +HIDDEN NORETURN void +x86_64_sigreturn (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + ucontext_t *uc = (ucontext_t *)(c->sigcontext_addr + + offsetof(struct sigframe, sf_uc)); + + Debug (8, "resuming at ip=%llx via sigreturn(%p)\n", + (unsigned long long) c->dwarf.ip, uc); + sigreturn(uc); + abort(); +} +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gos-linux.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gos-linux.c new file mode 100644 index 0000000000..a0ecce2217 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gos-linux.c @@ -0,0 +1,154 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "ucontext_i.h" + +#include + +HIDDEN void +tdep_fetch_frame (struct dwarf_cursor *dw, unw_word_t ip, int need_unwind_info) +{ + struct cursor *c = (struct cursor *) dw; + assert(! need_unwind_info || dw->pi_valid); + assert(! need_unwind_info || dw->pi.unwind_info); + if (dw->pi_valid + && dw->pi.unwind_info + && ((struct dwarf_cie_info *) dw->pi.unwind_info)->signal_frame) + c->sigcontext_format = X86_64_SCF_LINUX_RT_SIGFRAME; + else + c->sigcontext_format = X86_64_SCF_NONE; + + Debug(5, "fetch frame ip=0x%lx cfa=0x%lx format=%d\n", + dw->ip, dw->cfa, c->sigcontext_format); +} + +HIDDEN void +tdep_cache_frame (struct dwarf_cursor *dw, struct dwarf_reg_state *rs) +{ + struct cursor *c = (struct cursor *) dw; + rs->signal_frame = c->sigcontext_format; + + Debug(5, "cache frame ip=0x%lx cfa=0x%lx format=%d\n", + dw->ip, dw->cfa, c->sigcontext_format); +} + +HIDDEN void +tdep_reuse_frame (struct dwarf_cursor *dw, struct dwarf_reg_state *rs) +{ + struct cursor *c = (struct cursor *) dw; + c->sigcontext_format = rs->signal_frame; + if (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME) + { + c->frame_info.frame_type = UNW_X86_64_FRAME_SIGRETURN; + /* Offset from cfa to ucontext_t in signal frame. */ + c->frame_info.cfa_reg_offset = 0; + c->sigcontext_addr = dw->cfa; + } + else + c->sigcontext_addr = 0; + + Debug(5, "reuse frame ip=0x%lx cfa=0x%lx format=%d addr=0x%lx offset=%+d\n", + dw->ip, dw->cfa, c->sigcontext_format, c->sigcontext_addr, + (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME + ? c->frame_info.cfa_reg_offset : 0)); +} + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + return c->sigcontext_format != X86_64_SCF_NONE; +} + +PROTECTED int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ +#if UNW_DEBUG /* To silence compiler warnings */ + /* Should not get here because we now use kernel-provided dwarf + information for the signal trampoline and dwarf_step() works. + Hence unw_step() should never call this function. Maybe + restore old non-dwarf signal handling here, but then the + gating on unw_is_signal_frame() needs to be removed. */ + struct cursor *c = (struct cursor *) cursor; + Debug(1, "old format signal frame? format=%d addr=0x%lx cfa=0x%lx\n", + c->sigcontext_format, c->sigcontext_addr, c->dwarf.cfa); +#endif + return -UNW_EBADFRAME; +} + +#ifndef UNW_REMOTE_ONLY +HIDDEN void * +x86_64_r_uc_addr (ucontext_t *uc, int reg) +{ + /* NOTE: common_init() in init.h inlines these for fast path access. */ + void *addr; + + switch (reg) + { + case UNW_X86_64_R8: addr = &uc->uc_mcontext.gregs[REG_R8]; break; + case UNW_X86_64_R9: addr = &uc->uc_mcontext.gregs[REG_R9]; break; + case UNW_X86_64_R10: addr = &uc->uc_mcontext.gregs[REG_R10]; break; + case UNW_X86_64_R11: addr = &uc->uc_mcontext.gregs[REG_R11]; break; + case UNW_X86_64_R12: addr = &uc->uc_mcontext.gregs[REG_R12]; break; + case UNW_X86_64_R13: addr = &uc->uc_mcontext.gregs[REG_R13]; break; + case UNW_X86_64_R14: addr = &uc->uc_mcontext.gregs[REG_R14]; break; + case UNW_X86_64_R15: addr = &uc->uc_mcontext.gregs[REG_R15]; break; + case UNW_X86_64_RDI: addr = &uc->uc_mcontext.gregs[REG_RDI]; break; + case UNW_X86_64_RSI: addr = &uc->uc_mcontext.gregs[REG_RSI]; break; + case UNW_X86_64_RBP: addr = &uc->uc_mcontext.gregs[REG_RBP]; break; + case UNW_X86_64_RBX: addr = &uc->uc_mcontext.gregs[REG_RBX]; break; + case UNW_X86_64_RDX: addr = &uc->uc_mcontext.gregs[REG_RDX]; break; + case UNW_X86_64_RAX: addr = &uc->uc_mcontext.gregs[REG_RAX]; break; + case UNW_X86_64_RCX: addr = &uc->uc_mcontext.gregs[REG_RCX]; break; + case UNW_X86_64_RSP: addr = &uc->uc_mcontext.gregs[REG_RSP]; break; + case UNW_X86_64_RIP: addr = &uc->uc_mcontext.gregs[REG_RIP]; break; + + default: + addr = NULL; + } + return addr; +} + +/* sigreturn() is a no-op on x86_64 glibc. */ +HIDDEN NORETURN void +x86_64_sigreturn (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + + Debug (8, "resuming at ip=%llx via sigreturn(%p)\n", + (unsigned long long) c->dwarf.ip, sc); + __asm__ __volatile__ ("mov %0, %%rsp;" + "mov %1, %%rax;" + "syscall" + :: "r"(sc), "i"(SYS_rt_sigreturn) + : "memory"); + abort(); +} + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gregs.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gregs.c new file mode 100644 index 0000000000..5dd7b0b6bd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gregs.c @@ -0,0 +1,138 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +#if 0 +static inline dwarf_loc_t +linux_scratch_loc (struct cursor *c, unw_regnum_t reg) +{ + unw_word_t addr = c->sigcontext_addr; + + switch (c->sigcontext_format) + { + case X86_64_SCF_NONE: + return DWARF_REG_LOC (&c->dwarf, reg); + + case X86_64_SCF_LINUX_RT_SIGFRAME: + addr += LINUX_UC_MCONTEXT_OFF; + break; + + case X86_64_SCF_FREEBSD_SIGFRAME: + addr += FREEBSD_UC_MCONTEXT_OFF; + break; + } + + return DWARF_REG_LOC (&c->dwarf, reg); + +} + +HIDDEN dwarf_loc_t +x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg) +{ + if (c->sigcontext_addr) + return linux_scratch_loc (c, reg); + else + return DWARF_REG_LOC (&c->dwarf, reg); +} +#endif + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + unsigned int mask; + int arg_num; + + switch (reg) + { + + case UNW_X86_64_RIP: + if (write) + c->dwarf.ip = *valp; /* also update the RIP cache */ + loc = c->dwarf.loc[RIP]; + break; + + case UNW_X86_64_CFA: + case UNW_X86_64_RSP: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + case UNW_X86_64_RAX: + case UNW_X86_64_RDX: + arg_num = reg - UNW_X86_64_RAX; + mask = (1 << arg_num); + if (write) + { + c->dwarf.eh_args[arg_num] = *valp; + c->dwarf.eh_valid_mask |= mask; + return 0; + } + else if ((c->dwarf.eh_valid_mask & mask) != 0) + { + *valp = c->dwarf.eh_args[arg_num]; + return 0; + } + else + loc = c->dwarf.loc[(reg == UNW_X86_64_RAX) ? RAX : RDX]; + break; + + case UNW_X86_64_RCX: loc = c->dwarf.loc[RCX]; break; + case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break; + + case UNW_X86_64_RBP: loc = c->dwarf.loc[RBP]; break; + case UNW_X86_64_RSI: loc = c->dwarf.loc[RSI]; break; + case UNW_X86_64_RDI: loc = c->dwarf.loc[RDI]; break; + case UNW_X86_64_R8: loc = c->dwarf.loc[R8]; break; + case UNW_X86_64_R9: loc = c->dwarf.loc[R9]; break; + case UNW_X86_64_R10: loc = c->dwarf.loc[R10]; break; + case UNW_X86_64_R11: loc = c->dwarf.loc[R11]; break; + case UNW_X86_64_R12: loc = c->dwarf.loc[R12]; break; + case UNW_X86_64_R13: loc = c->dwarf.loc[R13]; break; + case UNW_X86_64_R14: loc = c->dwarf.loc[R14]; break; + case UNW_X86_64_R15: loc = c->dwarf.loc[R15]; break; + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + return -UNW_EBADREG; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gresume.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gresume.c new file mode 100644 index 0000000000..d5239fc150 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gresume.c @@ -0,0 +1,114 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include "offsets.h" +#include "unwind_i.h" + +#ifndef UNW_REMOTE_ONLY + +HIDDEN inline int +x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + struct cursor *c = (struct cursor *) cursor; + ucontext_t *uc = c->uc; + + /* Ensure c->pi is up-to-date. On x86-64, it's relatively common to + be missing DWARF unwind info. We don't want to fail in that + case, because the frame-chain still would let us do a backtrace + at least. */ + dwarf_make_proc_info (&c->dwarf); + + if (unlikely (c->sigcontext_format != X86_64_SCF_NONE)) + { + x86_64_sigreturn(cursor); + abort(); + } + else + { + Debug (8, "resuming at ip=%llx via setcontext()\n", + (unsigned long long) c->dwarf.ip); + setcontext (uc); + } + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +/* This routine is responsible for copying the register values in + cursor C and establishing them as the current machine state. */ + +static inline int +establish_machine_state (struct cursor *c) +{ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int write, void *); + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int write, void *); + unw_addr_space_t as = c->dwarf.as; + void *arg = c->dwarf.as_arg; + unw_fpreg_t fpval; + unw_word_t val; + int reg; + + access_reg = as->acc.access_reg; + access_fpreg = as->acc.access_fpreg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_REG_LAST; ++reg) + { + Debug (16, "copying %s %d\n", unw_regname (reg), reg); + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } + } + return 0; +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + if ((ret = establish_machine_state (c)) < 0) + return ret; + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gstash_frame.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gstash_frame.c new file mode 100644 index 0000000000..962b103f95 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gstash_frame.c @@ -0,0 +1,98 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "ucontext_i.h" + +HIDDEN void +tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) +{ + struct cursor *c = (struct cursor *) dwarf_to_cursor (d); + unw_tdep_frame_t *f = &c->frame_info; + + Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld" + " ra=0x%lx rbp [where=%d val=%ld @0x%lx] rsp [where=%d val=%ld @0x%lx]\n", + d->ip, d->cfa, f->frame_type, + rs->reg[DWARF_CFA_REG_COLUMN].where, + rs->reg[DWARF_CFA_REG_COLUMN].val, + rs->reg[DWARF_CFA_OFF_COLUMN].val, + DWARF_GET_LOC(d->loc[d->ret_addr_column]), + rs->reg[RBP].where, rs->reg[RBP].val, DWARF_GET_LOC(d->loc[RBP]), + rs->reg[RSP].where, rs->reg[RSP].val, DWARF_GET_LOC(d->loc[RSP])); + + /* A standard frame is defined as: + - CFA is register-relative offset off RBP or RSP; + - Return address is saved at CFA-8; + - RBP is unsaved or saved at CFA+offset, offset != -1; + - RSP is unsaved or saved at CFA+offset, offset != -1. */ + if (f->frame_type == UNW_X86_64_FRAME_OTHER + && (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) + && (rs->reg[DWARF_CFA_REG_COLUMN].val == RBP + || rs->reg[DWARF_CFA_REG_COLUMN].val == RSP) + && labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29) + && DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8 + && (rs->reg[RBP].where == DWARF_WHERE_UNDEF + || rs->reg[RBP].where == DWARF_WHERE_SAME + || (rs->reg[RBP].where == DWARF_WHERE_CFAREL + && labs(rs->reg[RBP].val) < (1 << 14) + && rs->reg[RBP].val+1 != 0)) + && (rs->reg[RSP].where == DWARF_WHERE_UNDEF + || rs->reg[RSP].where == DWARF_WHERE_SAME + || (rs->reg[RSP].where == DWARF_WHERE_CFAREL + && labs(rs->reg[RSP].val) < (1 << 14) + && rs->reg[RSP].val+1 != 0))) + { + /* Save information for a standard frame. */ + f->frame_type = UNW_X86_64_FRAME_STANDARD; + f->cfa_reg_rsp = (rs->reg[DWARF_CFA_REG_COLUMN].val == RSP); + f->cfa_reg_offset = rs->reg[DWARF_CFA_OFF_COLUMN].val; + if (rs->reg[RBP].where == DWARF_WHERE_CFAREL) + f->rbp_cfa_offset = rs->reg[RBP].val; + if (rs->reg[RSP].where == DWARF_WHERE_CFAREL) + f->rsp_cfa_offset = rs->reg[RSP].val; + Debug (4, " standard frame\n"); + } + + /* Signal frame was detected via augmentation in tdep_fetch_frame() */ + else if (f->frame_type == UNW_X86_64_FRAME_SIGRETURN) + { + /* Later we are going to fish out {RBP,RSP,RIP} from sigcontext via + their ucontext_t offsets. Confirm DWARF info agrees with the + offsets we expect. */ + +#ifndef NDEBUG + const unw_word_t uc = c->sigcontext_addr; + + assert (DWARF_GET_LOC(d->loc[RIP]) - uc == UC_MCONTEXT_GREGS_RIP); + assert (DWARF_GET_LOC(d->loc[RBP]) - uc == UC_MCONTEXT_GREGS_RBP); + assert (DWARF_GET_LOC(d->loc[RSP]) - uc == UC_MCONTEXT_GREGS_RSP); +#endif + + Debug (4, " sigreturn frame\n"); + } + + /* PLT and guessed RBP-walked frames are handled in unw_step(). */ + else + Debug (4, " unusual frame\n"); +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gstep.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gstep.c new file mode 100644 index 0000000000..e05fcae34c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gstep.c @@ -0,0 +1,222 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include + +/* Recognise PLT entries such as: + 3bdf0: ff 25 e2 49 13 00 jmpq *0x1349e2(%rip) + 3bdf6: 68 ae 03 00 00 pushq $0x3ae + 3bdfb: e9 00 c5 ff ff jmpq 38300 <_init+0x18> */ +static int +is_plt_entry (struct dwarf_cursor *c) +{ + unw_word_t w0, w1; + unw_accessors_t *a; + int ret; + + a = unw_get_accessors (c->as); + if ((ret = (*a->access_mem) (c->as, c->ip, &w0, 0, c->as_arg)) < 0 + || (ret = (*a->access_mem) (c->as, c->ip + 8, &w1, 0, c->as_arg)) < 0) + return 0; + + ret = (((w0 & 0xffff) == 0x25ff) + && (((w0 >> 48) & 0xff) == 0x68) + && (((w1 >> 24) & 0xff) == 0xe9)); + + Debug (14, "ip=0x%lx => 0x%016lx 0x%016lx, ret = %d\n", c->ip, w0, w1, ret); + return ret; +} + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret, i; + +#if CONSERVATIVE_CHECKS + int val = c->validate; + c->validate = 1; +#endif + + Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx)\n", + c, c->dwarf.ip, c->dwarf.cfa); + + /* Try DWARF-based unwinding... */ + c->sigcontext_format = X86_64_SCF_NONE; + ret = dwarf_step (&c->dwarf); + +#if CONSERVATIVE_CHECKS + c->validate = val; +#endif + + if (ret < 0 && ret != -UNW_ENOINFO) + { + Debug (2, "returning %d\n", ret); + return ret; + } + + if (likely (ret >= 0)) + { + /* x86_64 ABI specifies that end of call-chain is marked with a + NULL RBP. */ + if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP])) + { + c->dwarf.ip = 0; + ret = 0; + } + } + else + { + /* DWARF failed. There isn't much of a usable frame-chain on x86-64, + but we do need to handle two special-cases: + + (i) signal trampoline: Old kernels and older libcs don't + export the vDSO needed to get proper unwind info for the + trampoline. Recognize that case by looking at the code + and filling in things by hand. + + (ii) PLT (shared-library) call-stubs: PLT stubs are invoked + via CALLQ. Try this for all non-signal trampoline + code. */ + + unw_word_t prev_ip = c->dwarf.ip, prev_cfa = c->dwarf.cfa; + struct dwarf_loc rbp_loc, rsp_loc, rip_loc; + + /* We could get here because of missing/bad unwind information. + Validate all addresses before dereferencing. */ + c->validate = 1; + + Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret); + + if (unw_is_signal_frame (cursor)) + { + ret = unw_handle_signal_frame(cursor); + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } + } + else if (is_plt_entry (&c->dwarf)) + { + /* Like regular frame, CFA = RSP+8, RA = [CFA-8], no regs saved. */ + Debug (2, "found plt entry\n"); + c->frame_info.cfa_reg_offset = 8; + c->frame_info.cfa_reg_rsp = -1; + c->frame_info.frame_type = UNW_X86_64_FRAME_STANDARD; + c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0); + c->dwarf.cfa += 8; + } + else if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP])) + { + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + } + else + { + unw_word_t rbp; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RBP], &rbp); + if (ret < 0) + { + Debug (2, "returning %d [RBP=0x%lx]\n", ret, + DWARF_GET_LOC (c->dwarf.loc[RBP])); + return ret; + } + + if (!rbp) + { + /* Looks like we may have reached the end of the call-chain. */ + rbp_loc = DWARF_NULL_LOC; + rsp_loc = DWARF_NULL_LOC; + rip_loc = DWARF_NULL_LOC; + } + else + { + unw_word_t rbp1 = 0; + rbp_loc = DWARF_LOC(rbp, 0); + rsp_loc = DWARF_NULL_LOC; + rip_loc = DWARF_LOC (rbp + 8, 0); + ret = dwarf_get (&c->dwarf, rbp_loc, &rbp1); + Debug (1, "[RBP=0x%lx] = 0x%lx (cfa = 0x%lx) -> 0x%lx\n", + (unsigned long) DWARF_GET_LOC (c->dwarf.loc[RBP]), + rbp, c->dwarf.cfa, rbp1); + + /* Heuristic to determine incorrect guess. For RBP to be a + valid frame it needs to be above current CFA, but don't + let it go more than a little. Note that we can't deduce + anything about new RBP (rbp1) since it may not be a frame + pointer in the frame above. Just check we get the value. */ + if (ret < 0 + || rbp <= c->dwarf.cfa + || (rbp - c->dwarf.cfa) > 0x4000) + { + rip_loc = DWARF_NULL_LOC; + rbp_loc = DWARF_NULL_LOC; + } + + c->frame_info.frame_type = UNW_X86_64_FRAME_GUESSED; + c->frame_info.cfa_reg_rsp = 0; + c->frame_info.cfa_reg_offset = 16; + c->frame_info.rbp_cfa_offset = -16; + c->dwarf.cfa += 16; + } + + /* Mark all registers unsaved */ + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + c->dwarf.loc[RBP] = rbp_loc; + c->dwarf.loc[RSP] = rsp_loc; + c->dwarf.loc[RIP] = rip_loc; + } + + c->dwarf.ret_addr_column = RIP; + + if (!DWARF_IS_NULL_LOC (c->dwarf.loc[RIP])) + { + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); + Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n", + (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), + (unsigned long long) c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + ret = 1; + } + else + c->dwarf.ip = 0; + + if (c->dwarf.ip == prev_ip && c->dwarf.cfa == prev_cfa) + return -UNW_EBADFRAME; + } + Debug (2, "returning %d\n", ret); + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Gtrace.c b/sdk/cpprt/linux/libunwind/src/x86_64/Gtrace.c new file mode 100644 index 0000000000..446610cbdf --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Gtrace.c @@ -0,0 +1,533 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "ucontext_i.h" +#include +#include + +#pragma weak pthread_once +#pragma weak pthread_key_create +#pragma weak pthread_getspecific +#pragma weak pthread_setspecific + +/* Initial hash table size. Table expands by 2 bits (times four). */ +#define HASH_MIN_BITS 14 + +typedef struct +{ + unw_tdep_frame_t *frames; + size_t log_size; + size_t used; + size_t dtor_count; /* Counts how many times our destructor has already + been called. */ +} unw_trace_cache_t; + +static const unw_tdep_frame_t empty_frame = { 0, UNW_X86_64_FRAME_OTHER, -1, -1, 0, -1, -1 }; +static pthread_mutex_t trace_init_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_once_t trace_cache_once = PTHREAD_ONCE_INIT; +static sig_atomic_t trace_cache_once_happen; +static pthread_key_t trace_cache_key; +static struct mempool trace_cache_pool; +static __thread unw_trace_cache_t *tls_cache; +static __thread int tls_cache_destroyed; + +/* Free memory for a thread's trace cache. */ +static void +trace_cache_free (void *arg) +{ + unw_trace_cache_t *cache = arg; + if (++cache->dtor_count < PTHREAD_DESTRUCTOR_ITERATIONS) + { + /* Not yet our turn to get destroyed. Re-install ourselves into the key. */ + pthread_setspecific(trace_cache_key, cache); + Debug(5, "delayed freeing cache %p (%zx to go)\n", cache, + PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); + return; + } + tls_cache_destroyed = 1; + tls_cache = NULL; + munmap (cache->frames, (1u << cache->log_size) * sizeof(unw_tdep_frame_t)); + mempool_free (&trace_cache_pool, cache); + Debug(5, "freed cache %p\n", cache); +} + +/* Initialise frame tracing for threaded use. */ +static void +trace_cache_init_once (void) +{ + pthread_key_create (&trace_cache_key, &trace_cache_free); + mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0); + trace_cache_once_happen = 1; +} + +static unw_tdep_frame_t * +trace_cache_buckets (size_t n) +{ + unw_tdep_frame_t *frames; + size_t i; + + GET_MEMORY(frames, n * sizeof (unw_tdep_frame_t)); + if (likely(frames != 0)) + for (i = 0; i < n; ++i) + frames[i] = empty_frame; + + return frames; +} + +/* Allocate and initialise hash table for frame cache lookups. + Returns the cache initialised with (1u << HASH_LOW_BITS) hash + buckets, or NULL if there was a memory allocation problem. */ +static unw_trace_cache_t * +trace_cache_create (void) +{ + unw_trace_cache_t *cache; + + if (tls_cache_destroyed) + { + /* The current thread is in the process of exiting. Don't recreate + cache, as we wouldn't have another chance to free it. */ + Debug(5, "refusing to reallocate cache: " + "thread-locals are being deallocated\n"); + return NULL; + } + + if (! (cache = mempool_alloc(&trace_cache_pool))) + { + Debug(5, "failed to allocate cache\n"); + return NULL; + } + + if (! (cache->frames = trace_cache_buckets(1u << HASH_MIN_BITS))) + { + Debug(5, "failed to allocate buckets\n"); + mempool_free(&trace_cache_pool, cache); + return NULL; + } + + cache->log_size = HASH_MIN_BITS; + cache->used = 0; + cache->dtor_count = 0; + tls_cache_destroyed = 0; /* Paranoia: should already be 0. */ + Debug(5, "allocated cache %p\n", cache); + return cache; +} + +/* Expand the hash table in the frame cache if possible. This always + quadruples the hash size, and clears all previous frame entries. */ +static int +trace_cache_expand (unw_trace_cache_t *cache) +{ + size_t old_size = (1u << cache->log_size); + size_t new_log_size = cache->log_size + 2; + unw_tdep_frame_t *new_frames = trace_cache_buckets (1u << new_log_size); + + if (unlikely(! new_frames)) + { + Debug(5, "failed to expand cache to 2^%lu buckets\n", new_log_size); + return -UNW_ENOMEM; + } + + Debug(5, "expanded cache from 2^%lu to 2^%lu buckets\n", cache->log_size, new_log_size); + munmap(cache->frames, old_size * sizeof(unw_tdep_frame_t)); + cache->frames = new_frames; + cache->log_size = new_log_size; + cache->used = 0; + return 0; +} + +static unw_trace_cache_t * +trace_cache_get_unthreaded (void) +{ + unw_trace_cache_t *cache; + intrmask_t saved_mask; + static unw_trace_cache_t *global_cache = 0; + lock_acquire (&trace_init_lock, saved_mask); + if (! global_cache) + { + mempool_init (&trace_cache_pool, sizeof (unw_trace_cache_t), 0); + global_cache = trace_cache_create (); + } + cache = global_cache; + lock_release (&trace_init_lock, saved_mask); + Debug(5, "using cache %p\n", cache); + return cache; +} + +/* Get the frame cache for the current thread. Create it if there is none. */ +static unw_trace_cache_t * +trace_cache_get (void) +{ + unw_trace_cache_t *cache; + if (likely (pthread_once != 0)) + { + pthread_once(&trace_cache_once, &trace_cache_init_once); + if (!trace_cache_once_happen) + { + return trace_cache_get_unthreaded(); + } + if (! (cache = tls_cache)) + { + cache = trace_cache_create(); + pthread_setspecific(trace_cache_key, cache); + tls_cache = cache; + } + Debug(5, "using cache %p\n", cache); + return cache; + } + else + { + return trace_cache_get_unthreaded(); + } +} + +/* Initialise frame properties for address cache slot F at address + RIP using current CFA, RBP and RSP values. Modifies CURSOR to + that location, performs one unw_step(), and fills F with what + was discovered about the location. Returns F. + + FIXME: This probably should tell DWARF handling to never evaluate + or use registers other than RBP, RSP and RIP in case there is + highly unusual unwind info which uses these creatively. */ +static unw_tdep_frame_t * +trace_init_addr (unw_tdep_frame_t *f, + unw_cursor_t *cursor, + unw_word_t cfa, + unw_word_t rip, + unw_word_t rbp, + unw_word_t rsp) +{ + struct cursor *c = (struct cursor *) cursor; + struct dwarf_cursor *d = &c->dwarf; + int ret = -UNW_EINVAL; + + /* Initialise frame properties: unknown, not last. */ + f->virtual_address = rip; + f->frame_type = UNW_X86_64_FRAME_OTHER; + f->last_frame = 0; + f->cfa_reg_rsp = -1; + f->cfa_reg_offset = 0; + f->rbp_cfa_offset = -1; + f->rsp_cfa_offset = -1; + + /* Reinitialise cursor to this instruction - but undo next/prev RIP + adjustment because unw_step will redo it - and force RIP, RBP + RSP into register locations (=~ ucontext we keep), then set + their desired values. Then perform the step. */ + d->ip = rip + d->use_prev_instr; + d->cfa = cfa; + d->loc[UNW_X86_64_RIP] = DWARF_REG_LOC (d, UNW_X86_64_RIP); + d->loc[UNW_X86_64_RBP] = DWARF_REG_LOC (d, UNW_X86_64_RBP); + d->loc[UNW_X86_64_RSP] = DWARF_REG_LOC (d, UNW_X86_64_RSP); + c->frame_info = *f; + + if (likely(dwarf_put (d, d->loc[UNW_X86_64_RIP], rip) >= 0) + && likely(dwarf_put (d, d->loc[UNW_X86_64_RBP], rbp) >= 0) + && likely(dwarf_put (d, d->loc[UNW_X86_64_RSP], rsp) >= 0) + && likely((ret = unw_step (cursor)) >= 0)) + *f = c->frame_info; + + /* If unw_step() stopped voluntarily, remember that, even if it + otherwise could not determine anything useful. This avoids + failing trace if we hit frames without unwind info, which is + common for the outermost frame (CRT stuff) on many systems. + This avoids failing trace in very common circumstances; failing + to unw_step() loop wouldn't produce any better result. */ + if (ret == 0) + f->last_frame = -1; + + Debug (3, "frame va %lx type %d last %d cfa %s+%d rbp @ cfa%+d rsp @ cfa%+d\n", + f->virtual_address, f->frame_type, f->last_frame, + f->cfa_reg_rsp ? "rsp" : "rbp", f->cfa_reg_offset, + f->rbp_cfa_offset, f->rsp_cfa_offset); + + return f; +} + +/* Look up and if necessary fill in frame attributes for address RIP + in CACHE using current CFA, RBP and RSP values. Uses CURSOR to + perform any unwind steps necessary to fill the cache. Returns the + frame cache slot which describes RIP. */ +static unw_tdep_frame_t * +trace_lookup (unw_cursor_t *cursor, + unw_trace_cache_t *cache, + unw_word_t cfa, + unw_word_t rip, + unw_word_t rbp, + unw_word_t rsp) +{ + /* First look up for previously cached information using cache as + linear probing hash table with probe step of 1. Majority of + lookups should be completed within few steps, but it is very + important the hash table does not fill up, or performance falls + off the cliff. */ + uint64_t i, addr; + uint64_t cache_size = 1u << cache->log_size; + uint64_t slot = ((rip * 0x9e3779b97f4a7c16) >> 43) & (cache_size-1); + unw_tdep_frame_t *frame; + + for (i = 0; i < 16; ++i) + { + frame = &cache->frames[slot]; + addr = frame->virtual_address; + + /* Return if we found the address. */ + if (likely(addr == rip)) + { + Debug (4, "found address after %ld steps\n", i); + return frame; + } + + /* If slot is empty, reuse it. */ + if (likely(! addr)) + break; + + /* Linear probe to next slot candidate, step = 1. */ + if (++slot >= cache_size) + slot -= cache_size; + } + + /* If we collided after 16 steps, or if the hash is more than half + full, force the hash to expand. Fill the selected slot, whether + it's free or collides. Note that hash expansion drops previous + contents; further lookups will refill the hash. */ + Debug (4, "updating slot %lu after %ld steps, replacing 0x%lx\n", slot, i, addr); + if (unlikely(addr || cache->used >= cache_size / 2)) + { + if (unlikely(trace_cache_expand (cache) < 0)) + return NULL; + + cache_size = 1u << cache->log_size; + slot = ((rip * 0x9e3779b97f4a7c16) >> 43) & (cache_size-1); + frame = &cache->frames[slot]; + addr = frame->virtual_address; + } + + if (! addr) + ++cache->used; + + return trace_init_addr (frame, cursor, cfa, rip, rbp, rsp); +} + +/* Fast stack backtrace for x86-64. + + This is used by backtrace() implementation to accelerate frequent + queries for current stack, without any desire to unwind. It fills + BUFFER with the call tree from CURSOR upwards for at most SIZE + stack levels. The first frame, backtrace itself, is omitted. When + called, SIZE should give the maximum number of entries that can be + stored into BUFFER. Uses an internal thread-specific cache to + accelerate queries. + + The caller should fall back to a unw_step() loop if this function + fails by returning -UNW_ESTOPUNWIND, meaning the routine hit a + stack frame that is too complex to be traced in the fast path. + + This function is tuned for clients which only need to walk the + stack to get the call tree as fast as possible but without any + other details, for example profilers sampling the stack thousands + to millions of times per second. The routine handles the most + common x86-64 ABI stack layouts: CFA is RBP or RSP plus/minus + constant offset, return address is at CFA-8, and RBP and RSP are + either unchanged or saved on stack at constant offset from the CFA; + the signal return frame; and frames without unwind info provided + they are at the outermost (final) frame or can conservatively be + assumed to be frame-pointer based. + + Any other stack layout will cause the routine to give up. There + are only a handful of relatively rarely used functions which do + not have a stack in the standard form: vfork, longjmp, setcontext + and _dl_runtime_profile on common linux systems for example. + + On success BUFFER and *SIZE reflect the trace progress up to *SIZE + stack levels or the outermost frame, which ever is less. It may + stop short of outermost frame if unw_step() loop would also do so, + e.g. if there is no more unwind information; this is not reported + as an error. + + The function returns a negative value for errors, -UNW_ESTOPUNWIND + if tracing stopped because of an unusual frame unwind info. The + BUFFER and *SIZE reflect tracing progress up to the error frame. + + Callers of this function would normally look like this: + + unw_cursor_t cur; + unw_context_t ctx; + void addrs[128]; + int depth = 128; + int ret; + + unw_getcontext(&ctx); + unw_init_local(&cur, &ctx); + if ((ret = unw_tdep_trace(&cur, addrs, &depth)) < 0) + { + depth = 0; + unw_getcontext(&ctx); + unw_init_local(&cur, &ctx); + while ((ret = unw_step(&cur)) > 0 && depth < 128) + { + unw_word_t ip; + unw_get_reg(&cur, UNW_REG_IP, &ip); + addresses[depth++] = (void *) ip; + } + } +*/ +HIDDEN int +tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) +{ + struct cursor *c = (struct cursor *) cursor; + struct dwarf_cursor *d = &c->dwarf; + unw_trace_cache_t *cache; + unw_word_t rbp, rsp, rip, cfa; + int maxdepth = 0; + int depth = 0; + int ret; + + /* Check input parametres. */ + if (unlikely(! cursor || ! buffer || ! size || (maxdepth = *size) <= 0)) + return -UNW_EINVAL; + + Debug (1, "begin ip 0x%lx cfa 0x%lx\n", d->ip, d->cfa); + + /* Tell core dwarf routines to call back to us. */ + d->stash_frames = 1; + + /* Determine initial register values. These are direct access safe + because we know they come from the initial machine context. */ + rip = d->ip; + rsp = cfa = d->cfa; + ACCESS_MEM_FAST(ret, 0, d, DWARF_GET_LOC(d->loc[UNW_X86_64_RBP]), rbp); + assert(ret == 0); + + /* Get frame cache. */ + if (unlikely(! (cache = trace_cache_get()))) + { + Debug (1, "returning %d, cannot get trace cache\n", -UNW_ENOMEM); + *size = 0; + d->stash_frames = 0; + return -UNW_ENOMEM; + } + + /* Trace the stack upwards, starting from current RIP. Adjust + the RIP address for previous/next instruction as the main + unwinding logic would also do. We undo this before calling + back into unw_step(). */ + while (depth < maxdepth) + { + rip -= d->use_prev_instr; + Debug (2, "depth %d cfa 0x%lx rip 0x%lx rsp 0x%lx rbp 0x%lx\n", + depth, cfa, rip, rsp, rbp); + + /* See if we have this address cached. If not, evaluate enough of + the dwarf unwind information to fill the cache line data, or to + decide this frame cannot be handled in fast trace mode. We + cache negative results too to prevent unnecessary dwarf parsing + for common failures. */ + unw_tdep_frame_t *f = trace_lookup (cursor, cache, cfa, rip, rbp, rsp); + + /* If we don't have information for this frame, give up. */ + if (unlikely(! f)) + { + ret = -UNW_ENOINFO; + break; + } + + Debug (3, "frame va %lx type %d last %d cfa %s+%d rbp @ cfa%+d rsp @ cfa%+d\n", + f->virtual_address, f->frame_type, f->last_frame, + f->cfa_reg_rsp ? "rsp" : "rbp", f->cfa_reg_offset, + f->rbp_cfa_offset, f->rsp_cfa_offset); + + assert (f->virtual_address == rip); + + /* Stop if this was the last frame. In particular don't evaluate + new register values as it may not be safe - we don't normally + run with full validation on, and do not want to - and there's + enough bad unwind info floating around that we need to trust + what unw_step() previously said, in potentially bogus frames. */ + if (f->last_frame) + break; + + /* Evaluate CFA and registers for the next frame. */ + switch (f->frame_type) + { + case UNW_X86_64_FRAME_GUESSED: + /* Fall thru to standard processing after forcing validation. */ + c->validate = 1; + + case UNW_X86_64_FRAME_STANDARD: + /* Advance standard traceable frame. */ + cfa = (f->cfa_reg_rsp ? rsp : rbp) + f->cfa_reg_offset; + ACCESS_MEM_FAST(ret, c->validate, d, cfa - 8, rip); + if (likely(ret >= 0) && likely(f->rbp_cfa_offset != -1)) + ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->rbp_cfa_offset, rbp); + + /* Don't bother reading RSP from DWARF, CFA becomes new RSP. */ + rsp = cfa; + + /* Next frame needs to back up for unwind info lookup. */ + d->use_prev_instr = 1; + break; + + case UNW_X86_64_FRAME_SIGRETURN: + cfa = cfa + f->cfa_reg_offset; /* cfa now points to ucontext_t. */ + + ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RIP, rip); + if (likely(ret >= 0)) + ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RBP, rbp); + if (likely(ret >= 0)) + ACCESS_MEM_FAST(ret, c->validate, d, cfa + UC_MCONTEXT_GREGS_RSP, rsp); + + /* Resume stack at signal restoration point. The stack is not + necessarily continuous here, especially with sigaltstack(). */ + cfa = rsp; + + /* Next frame should not back up. */ + d->use_prev_instr = 0; + break; + + default: + /* We cannot trace through this frame, give up and tell the + caller we had to stop. Data collected so far may still be + useful to the caller, so let it know how far we got. */ + ret = -UNW_ESTOPUNWIND; + break; + } + + Debug (4, "new cfa 0x%lx rip 0x%lx rsp 0x%lx rbp 0x%lx\n", + cfa, rip, rsp, rbp); + + /* If we failed or ended up somewhere bogus, stop. */ + if (unlikely(ret < 0 || rip < 0x4000)) + break; + + /* Record this address in stack trace. We skipped the first address. */ + buffer[depth++] = (void *) (rip - d->use_prev_instr); + } + +#if UNW_DEBUG + Debug (1, "returning %d, depth %d\n", ret, depth); +#endif + *size = depth; + return ret; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lcreate_addr_space.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lcreate_addr_space.c new file mode 100644 index 0000000000..0f2dc6be90 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lget_proc_info.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lget_proc_info.c new file mode 100644 index 0000000000..69028b019f --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lget_save_loc.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lget_save_loc.c new file mode 100644 index 0000000000..9ea048a907 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lglobal.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lglobal.c new file mode 100644 index 0000000000..6d7b489e14 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Linit.c b/sdk/cpprt/linux/libunwind/src/x86_64/Linit.c new file mode 100644 index 0000000000..e9abfdd46a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Linit_local.c b/sdk/cpprt/linux/libunwind/src/x86_64/Linit_local.c new file mode 100644 index 0000000000..68a1687e85 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Linit_remote.c b/sdk/cpprt/linux/libunwind/src/x86_64/Linit_remote.c new file mode 100644 index 0000000000..58cb04ab7c --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lis_signal_frame.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lis_signal_frame.c new file mode 100644 index 0000000000..b9a7c4f51a --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Los-freebsd.c b/sdk/cpprt/linux/libunwind/src/x86_64/Los-freebsd.c new file mode 100644 index 0000000000..a75a205df1 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Los-freebsd.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gos-freebsd.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Los-linux.c b/sdk/cpprt/linux/libunwind/src/x86_64/Los-linux.c new file mode 100644 index 0000000000..3cc18aabcc --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Los-linux.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gos-linux.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lregs.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lregs.c new file mode 100644 index 0000000000..2c9c75cd7d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lresume.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lresume.c new file mode 100644 index 0000000000..41a8cf003d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lstash_frame.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lstash_frame.c new file mode 100644 index 0000000000..77587803d0 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lstash_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstash_frame.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Lstep.c b/sdk/cpprt/linux/libunwind/src/x86_64/Lstep.c new file mode 100644 index 0000000000..c1ac3c7547 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/Ltrace.c b/sdk/cpprt/linux/libunwind/src/x86_64/Ltrace.c new file mode 100644 index 0000000000..fcd3f239c9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/Ltrace.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gtrace.c" +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/getcontext.S b/sdk/cpprt/linux/libunwind/src/x86_64/getcontext.S new file mode 100644 index 0000000000..7a8b5664bd --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/getcontext.S @@ -0,0 +1,134 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 Google, Inc + Contributed by Paul Pluzhnikov + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "ucontext_i.h" + +/* int _Ux86_64_getcontext (ucontext_t *ucp) + + Saves the machine context in UCP necessary for libunwind. + Unlike the libc implementation, we don't save the signal mask + and hence avoid the cost of a system call per unwind. + +*/ + + .global _Ux86_64_getcontext + .type _Ux86_64_getcontext, @function +_Ux86_64_getcontext: + .cfi_startproc + + /* Callee saved: RBX, RBP, R12-R15 */ + movq %r12, UC_MCONTEXT_GREGS_R12(%rdi) + movq %r13, UC_MCONTEXT_GREGS_R13(%rdi) + movq %r14, UC_MCONTEXT_GREGS_R14(%rdi) + movq %r15, UC_MCONTEXT_GREGS_R15(%rdi) + movq %rbp, UC_MCONTEXT_GREGS_RBP(%rdi) + movq %rbx, UC_MCONTEXT_GREGS_RBX(%rdi) + + /* Save argument registers (not strictly needed, but setcontext + restores them, so don't restore garbage). */ + movq %r8, UC_MCONTEXT_GREGS_R8(%rdi) + movq %r9, UC_MCONTEXT_GREGS_R9(%rdi) + movq %rdi, UC_MCONTEXT_GREGS_RDI(%rdi) + movq %rsi, UC_MCONTEXT_GREGS_RSI(%rdi) + movq %rdx, UC_MCONTEXT_GREGS_RDX(%rdi) + movq %rax, UC_MCONTEXT_GREGS_RAX(%rdi) + movq %rcx, UC_MCONTEXT_GREGS_RCX(%rdi) + +#if defined __linux__ + /* Save fp state (not needed, except for setcontext not + restoring garbage). */ + leaq UC_MCONTEXT_FPREGS_MEM(%rdi),%r8 + movq %r8, UC_MCONTEXT_FPREGS_PTR(%rdi) + fnstenv (%r8) + stmxcsr FPREGS_OFFSET_MXCSR(%r8) +#elif defined __FreeBSD__ + fxsave UC_MCONTEXT_FPSTATE(%rdi) + movq $UC_MCONTEXT_FPOWNED_FPU,UC_MCONTEXT_OWNEDFP(%rdi) + movq $UC_MCONTEXT_FPFMT_XMM,UC_MCONTEXT_FPFORMAT(%rdi) + /* Save rflags and segment registers, so that sigreturn(2) + does not complain. */ + pushfq + .cfi_adjust_cfa_offset 8 + popq UC_MCONTEXT_RFLAGS(%rdi) + .cfi_adjust_cfa_offset -8 + movl $0, UC_MCONTEXT_FLAGS(%rdi) + movw %cs, UC_MCONTEXT_CS(%rdi) + movw %ss, UC_MCONTEXT_SS(%rdi) +#if 0 + /* Setting the flags to 0 above disables restore of segment + registers from the context */ + movw %ds, UC_MCONTEXT_DS(%rdi) + movw %es, UC_MCONTEXT_ES(%rdi) + movw %fs, UC_MCONTEXT_FS(%rdi) + movw %gs, UC_MCONTEXT_GS(%rdi) +#endif + movq $UC_MCONTEXT_MC_LEN_VAL, UC_MCONTEXT_MC_LEN(%rdi) +#else +#error Port me +#endif + + leaq 8(%rsp), %rax /* exclude this call. */ + movq %rax, UC_MCONTEXT_GREGS_RSP(%rdi) + + movq 0(%rsp), %rax + movq %rax, UC_MCONTEXT_GREGS_RIP(%rdi) + + xorq %rax, %rax + retq + .cfi_endproc + .size _Ux86_64_getcontext, . - _Ux86_64_getcontext + +/* int _Ux86_64_getcontext_trace (ucontext_t *ucp) + + Saves limited machine context in UCP necessary for libunwind. + Unlike _Ux86_64_getcontext, saves only the parts needed for + fast trace. If fast trace fails, caller will have to get the + full context. +*/ + + .global _Ux86_64_getcontext_trace + .hidden _Ux86_64_getcontext_trace + .type _Ux86_64_getcontext_trace, @function +_Ux86_64_getcontext_trace: + .cfi_startproc + + /* Save only RBP, RBX, RSP, RIP - exclude this call. */ + movq %rbp, UC_MCONTEXT_GREGS_RBP(%rdi) + movq %rbx, UC_MCONTEXT_GREGS_RBX(%rdi) + + leaq 8(%rsp), %rax + movq %rax, UC_MCONTEXT_GREGS_RSP(%rdi) + + movq 0(%rsp), %rax + movq %rax, UC_MCONTEXT_GREGS_RIP(%rdi) + + xorq %rax, %rax + retq + .cfi_endproc + .size _Ux86_64_getcontext_trace, . - _Ux86_64_getcontext_trace + + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/init.h b/sdk/cpprt/linux/libunwind/src/x86_64/init.h new file mode 100644 index 0000000000..e80e553331 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/init.h @@ -0,0 +1,89 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* Avoid a trip to x86_64_r_uc_addr() for purely local initialisation. */ +#if defined UNW_LOCAL_ONLY && defined __linux +# define REG_INIT_LOC(c, rlc, ruc) \ + DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.gregs[REG_ ## ruc], 0) + +#elif defined UNW_LOCAL_ONLY && defined __FreeBSD__ +# define REG_INIT_LOC(c, rlc, ruc) \ + DWARF_LOC ((unw_word_t) &c->uc->uc_mcontext.mc_ ## rlc, 0) + +#else +# define REG_INIT_LOC(c, rlc, ruc) \ + DWARF_REG_LOC (&c->dwarf, UNW_X86_64_ ## ruc) +#endif + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret; + + c->dwarf.loc[RAX] = REG_INIT_LOC(c, rax, RAX); + c->dwarf.loc[RDX] = REG_INIT_LOC(c, rdx, RDX); + c->dwarf.loc[RCX] = REG_INIT_LOC(c, rcx, RCX); + c->dwarf.loc[RBX] = REG_INIT_LOC(c, rbx, RBX); + c->dwarf.loc[RSI] = REG_INIT_LOC(c, rsi, RSI); + c->dwarf.loc[RDI] = REG_INIT_LOC(c, rdi, RDI); + c->dwarf.loc[RBP] = REG_INIT_LOC(c, rbp, RBP); + c->dwarf.loc[RSP] = REG_INIT_LOC(c, rsp, RSP); + c->dwarf.loc[R8] = REG_INIT_LOC(c, r8, R8); + c->dwarf.loc[R9] = REG_INIT_LOC(c, r9, R9); + c->dwarf.loc[R10] = REG_INIT_LOC(c, r10, R10); + c->dwarf.loc[R11] = REG_INIT_LOC(c, r11, R11); + c->dwarf.loc[R12] = REG_INIT_LOC(c, r12, R12); + c->dwarf.loc[R13] = REG_INIT_LOC(c, r13, R13); + c->dwarf.loc[R14] = REG_INIT_LOC(c, r14, R14); + c->dwarf.loc[R15] = REG_INIT_LOC(c, r15, R15); + c->dwarf.loc[RIP] = REG_INIT_LOC(c, rip, RIP); + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_X86_64_RSP), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + c->sigcontext_format = X86_64_SCF_NONE; + c->sigcontext_addr = 0; + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = RIP; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/is_fpreg.c b/sdk/cpprt/linux/libunwind/src/x86_64/is_fpreg.c new file mode 100644 index 0000000000..030dd71214 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/is_fpreg.c @@ -0,0 +1,38 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_is_fpreg (int regnum) +{ +#if 0 + return ((regnum >= UNW_X86_ST0 && regnum <= UNW_X86_ST7) + || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi)); +#endif + return 0; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/longjmp.S b/sdk/cpprt/linux/libunwind/src/x86_64/longjmp.S new file mode 100644 index 0000000000..274778fd80 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/longjmp.S @@ -0,0 +1,34 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .globl _UI_longjmp_cont + .type _UI_longjmp_cont, @function +_UI_longjmp_cont: + push %rax /* push target IP as return address */ + mov %rdx, %rax /* set up return-value */ + retq + .size _UI_longjmp_cont, .-_UI_longjmp_cont + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/offsets.h b/sdk/cpprt/linux/libunwind/src/x86_64/offsets.h new file mode 100644 index 0000000000..80cfe3617d --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/offsets.h @@ -0,0 +1,3 @@ +/* FreeBSD specific definitions */ + +#define FREEBSD_UC_MCONTEXT_OFF 0x10 diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/regname.c b/sdk/cpprt/linux/libunwind/src/x86_64/regname.c new file mode 100644 index 0000000000..6c0e2f35e4 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/regname.c @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + + Contributed by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static const char *regname[] = + { + "RAX", + "RDX", + "RCX", + "RBX", + "RSI", + "RDI", + "RBP", + "RSP", + "R8", + "R9", + "R10", + "R11", + "R12", + "R13", + "R14", + "R15", + "RIP", + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else + return "???"; +} diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/siglongjmp.S b/sdk/cpprt/linux/libunwind/src/x86_64/siglongjmp.S new file mode 100644 index 0000000000..32489e53a9 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/siglongjmp.S @@ -0,0 +1,32 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + .globl _UI_siglongjmp_cont + .type _UI_siglongjmp_cont, @function +_UI_siglongjmp_cont: + retq + .size _UI_siglongjmp_cont, . - _UI_siglongjmp_cont + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/ucontext_i.h b/sdk/cpprt/linux/libunwind/src/x86_64/ucontext_i.h new file mode 100644 index 0000000000..c1249bf6b8 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/ucontext_i.h @@ -0,0 +1,82 @@ +/* Copyright (C) 2004 Hewlett-Packard Co. + Contributed by David Mosberger-Tang . + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#if defined __linux__ +#define UC_MCONTEXT_GREGS_R8 0x28 +#define UC_MCONTEXT_GREGS_R9 0x30 +#define UC_MCONTEXT_GREGS_R10 0x38 +#define UC_MCONTEXT_GREGS_R11 0x40 +#define UC_MCONTEXT_GREGS_R12 0x48 +#define UC_MCONTEXT_GREGS_R13 0x50 +#define UC_MCONTEXT_GREGS_R14 0x58 +#define UC_MCONTEXT_GREGS_R15 0x60 +#define UC_MCONTEXT_GREGS_RDI 0x68 +#define UC_MCONTEXT_GREGS_RSI 0x70 +#define UC_MCONTEXT_GREGS_RBP 0x78 +#define UC_MCONTEXT_GREGS_RBX 0x80 +#define UC_MCONTEXT_GREGS_RDX 0x88 +#define UC_MCONTEXT_GREGS_RAX 0x90 +#define UC_MCONTEXT_GREGS_RCX 0x98 +#define UC_MCONTEXT_GREGS_RSP 0xa0 +#define UC_MCONTEXT_GREGS_RIP 0xa8 +#define UC_MCONTEXT_FPREGS_PTR 0x1a8 +#define UC_MCONTEXT_FPREGS_MEM 0xe0 +#define UC_SIGMASK 0x128 +#define FPREGS_OFFSET_MXCSR 0x18 +#elif defined __FreeBSD__ +#define UC_SIGMASK 0x0 +#define UC_MCONTEXT_GREGS_RDI 0x18 +#define UC_MCONTEXT_GREGS_RSI 0x20 +#define UC_MCONTEXT_GREGS_RDX 0x28 +#define UC_MCONTEXT_GREGS_RCX 0x30 +#define UC_MCONTEXT_GREGS_R8 0x38 +#define UC_MCONTEXT_GREGS_R9 0x40 +#define UC_MCONTEXT_GREGS_RAX 0x48 +#define UC_MCONTEXT_GREGS_RBX 0x50 +#define UC_MCONTEXT_GREGS_RBP 0x58 +#define UC_MCONTEXT_GREGS_R10 0x60 +#define UC_MCONTEXT_GREGS_R11 0x68 +#define UC_MCONTEXT_GREGS_R12 0x70 +#define UC_MCONTEXT_GREGS_R13 0x78 +#define UC_MCONTEXT_GREGS_R14 0x80 +#define UC_MCONTEXT_GREGS_R15 0x88 +#define UC_MCONTEXT_FS 0x94 +#define UC_MCONTEXT_GS 0x96 +#define UC_MCONTEXT_FLAGS 0xa0 +#define UC_MCONTEXT_ES 0xa4 +#define UC_MCONTEXT_DS 0xa6 +#define UC_MCONTEXT_GREGS_RIP 0xb0 +#define UC_MCONTEXT_CS 0xb8 +#define UC_MCONTEXT_RFLAGS 0xc0 +#define UC_MCONTEXT_GREGS_RSP 0xc8 +#define UC_MCONTEXT_SS 0xd0 +#define UC_MCONTEXT_MC_LEN 0xd8 +#define UC_MCONTEXT_FPFORMAT 0xe0 +#define UC_MCONTEXT_OWNEDFP 0xe8 +#define UC_MCONTEXT_FPSTATE 0xf0 +#define UC_MCONTEXT_FPOWNED_FPU 0x20001 +#define UC_MCONTEXT_FPFMT_XMM 0x10002 +#define UC_MCONTEXT_MC_LEN_VAL 0x320 + +#endif diff --git a/sdk/cpprt/linux/libunwind/src/x86_64/unwind_i.h b/sdk/cpprt/linux/libunwind/src/x86_64/unwind_i.h new file mode 100644 index 0000000000..1e55a766c6 --- /dev/null +++ b/sdk/cpprt/linux/libunwind/src/x86_64/unwind_i.h @@ -0,0 +1,92 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002, 2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include +#include + +#include + +#include "libunwind_i.h" +#include + +/* DWARF column numbers for x86_64: */ +#define RAX 0 +#define RDX 1 +#define RCX 2 +#define RBX 3 +#define RSI 4 +#define RDI 5 +#define RBP 6 +#define RSP 7 +#define R8 8 +#define R9 9 +#define R10 10 +#define R11 11 +#define R12 12 +#define R13 13 +#define R14 14 +#define R15 15 +#define RIP 16 + +#define x86_64_lock UNW_OBJ(lock) +#define x86_64_local_resume UNW_OBJ(local_resume) +#define x86_64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define setcontext UNW_ARCH_OBJ (setcontext) +#if 0 +#define x86_64_scratch_loc UNW_OBJ(scratch_loc) +#endif +#define x86_64_r_uc_addr UNW_OBJ(r_uc_addr) +#define x86_64_sigreturn UNW_OBJ(sigreturn) + +/* By-pass calls to access_mem() when known to be safe. */ +#ifdef UNW_LOCAL_ONLY +# undef ACCESS_MEM_FAST +# define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \ + do { \ + if (unlikely(validate)) \ + (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); \ + else \ + (ret) = 0, (to) = *(unw_word_t *)(addr); \ + } while (0) +#endif + +extern void x86_64_local_addr_space_init (void); +extern int x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); +extern int setcontext (const ucontext_t *ucp); + +#if 0 +extern dwarf_loc_t x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg); +#endif + +extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg); +extern NORETURN void x86_64_sigreturn (unw_cursor_t *cursor); + +#endif /* unwind_i_h */ diff --git a/sdk/cpprt/linux/pthread_compat.h b/sdk/cpprt/linux/pthread_compat.h new file mode 100644 index 0000000000..e9ea3590cb --- /dev/null +++ b/sdk/cpprt/linux/pthread_compat.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// file: pthread_compat.h +// +// This header file serves as an abstraction layer for compatibility. + +#ifndef PTHREAD_COMPAT_H +#define PTHREAD_COMPAT_H + +#include "sgx_spinlock.h" + +#define pthread_mutex_t sgx_spinlock_t +#define PTHREAD_MUTEX_INITIALIZER SGX_SPINLOCK_INITIALIZER + +#define pthread_mutex_lock sgx_spin_lock +#define pthread_mutex_unlock sgx_spin_unlock + +#if 0 +#define pthread_mutex_init sgx_thread_mutex_init + +#define pthread_cond_t sgx_thread_cond_t +#define PTHREAD_COND_INITIALIZER SGX_THREAD_COND_INITIALIZER + +#define pthread_cond_wait sgx_thread_cond_wait +#define pthread_cond_signal sgx_thread_cond_signal +#endif + +#endif diff --git a/sdk/cpprt/linux/stdexcept.cc b/sdk/cpprt/linux/stdexcept.cc new file mode 100644 index 0000000000..6b63ad48d0 --- /dev/null +++ b/sdk/cpprt/linux/stdexcept.cc @@ -0,0 +1,96 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * stdexcept.cc - provides stub implementations of the exceptions required by the runtime. + */ +#include +#include +#include "se_cdefs.h" + +SGX_ACCESS_VERSION(tstdcxx, 5) + +namespace std { + +exception::exception() throw() {} +exception::~exception() {} +exception::exception(const exception&) throw() {} +exception& exception::operator=(const exception&) throw() +{ + return *this; +} +const char* exception::what() const throw() +{ + return "std::exception"; +} + +bad_exception::bad_exception() throw() {} +bad_exception::~bad_exception() throw() {} +const char* bad_exception::what() const throw() +{ + return "std::bad_exception"; +} + +bad_alloc::bad_alloc() throw() {} +bad_alloc::~bad_alloc() {} +bad_alloc::bad_alloc(const bad_alloc&) throw() {} +bad_alloc& bad_alloc::operator=(const bad_alloc&) throw() +{ + return *this; +} +const char* bad_alloc::what() const throw() +{ + return "cxxrt::bad_alloc"; +} + +bad_cast::bad_cast() throw() {} +bad_cast::~bad_cast() {} +bad_cast::bad_cast(const bad_cast&) throw() {} +bad_cast& bad_cast::operator=(const bad_cast&) throw() +{ + return *this; +} + +const char* bad_cast::what() const throw() +{ + return "std::bad_cast"; +} + +bad_typeid::bad_typeid() throw() {} +bad_typeid::~bad_typeid() {} +bad_typeid::bad_typeid(const bad_typeid &__rhs) throw() {} +bad_typeid& bad_typeid::operator=(const bad_typeid &__rhs) throw() +{ + return *this; +} + +const char* bad_typeid::what() const throw() +{ + return "std::bad_typeid"; +} + +} // namespace std + diff --git a/sdk/cpprt/linux/terminate.cc b/sdk/cpprt/linux/terminate.cc new file mode 100644 index 0000000000..2f0fa67eca --- /dev/null +++ b/sdk/cpprt/linux/terminate.cc @@ -0,0 +1,43 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "se_cdefs.h" + +SGX_ACCESS_VERSION(tstdcxx, 6) + +namespace std +{ + /** + * Stub implementation of std::terminate. Used when the STL implementation + * doesn't provide one. + */ + __attribute__((weak)) + void terminate() + { + abort(); + } +} diff --git a/sdk/cpprt/linux/typeinfo.cc b/sdk/cpprt/linux/typeinfo.cc new file mode 100644 index 0000000000..0d28e6d431 --- /dev/null +++ b/sdk/cpprt/linux/typeinfo.cc @@ -0,0 +1,126 @@ +/* + * Copyright 2010-2012 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "typeinfo.h" +#include +#include +#include +#include "se_cdefs.h" + +SGX_ACCESS_VERSION(tstdcxx, 4) + +using std::type_info; + +type_info::~type_info() {} + +bool type_info::operator==(const type_info &other) const +{ + return __type_name == other.__type_name; +} +bool type_info::operator!=(const type_info &other) const +{ + return __type_name != other.__type_name; +} +bool type_info::before(const type_info &other) const +{ + return __type_name < other.__type_name; +} +const char* type_info::name() const +{ + return __type_name; +} +type_info::type_info (const type_info& rhs) +{ + __type_name = rhs.__type_name; +} +type_info& type_info::operator= (const type_info& rhs) +{ + return *new type_info(rhs); +} + +__cxxabiv1::__fundamental_type_info::~__fundamental_type_info() {} +__cxxabiv1::__array_type_info::~__array_type_info() {} +__cxxabiv1::__function_type_info::~__function_type_info() {} +__cxxabiv1::__enum_type_info::~__enum_type_info() {} +__cxxabiv1::__class_type_info::~__class_type_info() {} +__cxxabiv1::__si_class_type_info::~__si_class_type_info() {} +__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info() {} +__cxxabiv1::__pbase_type_info::~__pbase_type_info() {} +__cxxabiv1::__pointer_type_info::~__pointer_type_info() {} +__cxxabiv1::__pointer_to_member_type_info::~__pointer_to_member_type_info() {} + +#if 0 +// From libelftc +extern "C" char *__cxa_demangle_gnu3(const char *); + +extern "C" char* __cxa_demangle(const char* mangled_name, + char* buf, + size_t* n, + int* status) +{ + // TODO: We should probably just be linking against libelf-tc, rather than + // copying their code. This requires them to do an actual release, + // however, and for our changes to be pushed upstream. We also need to + // call a different demangling function here depending on the ABI (e.g. + // ARM). + char *demangled = __cxa_demangle_gnu3(mangled_name); + if (NULL != demangled) + { + size_t len = strlen(demangled); + buf = (char*)realloc(buf, len+1); + if (0 != buf) + { + memcpy(buf, demangled, len); + buf[len] = 0; + if (n) + { + *n = len; + } + if (status) + { + *status = 0; + } + } + else + { + if (status) + { + *status = -1; + } + } + free(demangled); + } + else + { + if (status) + { + *status = -2; + } + return NULL; + } + return buf; +} +#endif diff --git a/sdk/cpprt/linux/typeinfo.h b/sdk/cpprt/linux/typeinfo.h new file mode 100644 index 0000000000..b3d19c703d --- /dev/null +++ b/sdk/cpprt/linux/typeinfo.h @@ -0,0 +1,234 @@ +/* + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "abi_namespace.h" + +namespace ABI_NAMESPACE +{ + /** + * Primitive type info, for intrinsic types. + */ + struct __fundamental_type_info : public std::type_info + { + virtual ~__fundamental_type_info(); + }; + /** + * Type info for arrays. + */ + struct __array_type_info : public std::type_info + { + virtual ~__array_type_info(); + }; + /** + * Type info for functions. + */ + struct __function_type_info : public std::type_info + { + virtual ~__function_type_info(); + virtual bool __is_function_p() const { return true; } + }; + /** + * Type info for enums. + */ + struct __enum_type_info : public std::type_info + { + virtual ~__enum_type_info(); + }; + + /** + * Base class for class type info. Used only for tentative definitions. + */ + struct __class_type_info : public std::type_info + { + virtual ~__class_type_info(); + /** + * Function implementing dynamic casts. + */ + virtual void *cast_to(void *obj, const struct __class_type_info *other) const; + virtual bool __do_upcast(const ABI_NAMESPACE:: + __class_type_info *target, + void **thrown_object) const + { + return this == target; + } + }; + + /** + * Single-inheritance class type info. This is used for classes containing + * a single non-virtual base class at offset 0. + */ + struct __si_class_type_info : public __class_type_info + { + virtual ~__si_class_type_info(); + const __class_type_info *__base_type; + virtual bool __do_upcast( + const __cxxabiv1::__class_type_info *target, + void **thrown_object) const; + virtual void *cast_to(void *obj, const struct __class_type_info *other) const; + }; + + /** + * Type info for base classes. Classes with multiple bases store an array + * of these, one for each superclass. + */ + struct __base_class_type_info + { + const __class_type_info *__base_type; + private: + /** + * The high __offset_shift bits of this store the (signed) offset + * of the base class. The low bits store flags from + * __offset_flags_masks. + */ + long __offset_flags; + /** + * Flags used in the low bits of __offset_flags. + */ + enum __offset_flags_masks + { + /** This base class is virtual. */ + __virtual_mask = 0x1, + /** This base class is public. */ + __public_mask = 0x2, + /** The number of bits reserved for flags. */ + __offset_shift = 8 + }; + public: + /** + * Returns the offset of the base class. + */ + long offset() const + { + return __offset_flags >> __offset_shift; + } + /** + * Returns the flags. + */ + long flags() const + { + return __offset_flags & ((1 << __offset_shift) - 1); + } + /** + * Returns whether this is a public base class. + */ + bool isPublic() const { return flags() & __public_mask; } + /** + * Returns whether this is a virtual base class. + */ + bool isVirtual() const { return flags() & __virtual_mask; } + }; + + /** + * Type info for classes with virtual bases or multiple superclasses. + */ + struct __vmi_class_type_info : public __class_type_info + { + virtual ~__vmi_class_type_info(); + /** Flags describing this class. Contains values from __flags_masks. */ + unsigned int __flags; + /** The number of base classes. */ + unsigned int __base_count; + /** + * Array of base classes - this actually has __base_count elements, not + * 1. + */ + __base_class_type_info __base_info[1]; + + /** + * Flags used in the __flags field. + */ + enum __flags_masks + { + /** The class has non-diamond repeated inheritance. */ + __non_diamond_repeat_mask = 0x1, + /** The class is diamond shaped. */ + __diamond_shaped_mask = 0x2 + }; + virtual bool __do_upcast( + const __cxxabiv1::__class_type_info *target, + void **thrown_object) const; + virtual void *cast_to(void *obj, const struct __class_type_info *other) const; + }; + + /** + * Base class used for both pointer and pointer-to-member type info. + */ + struct __pbase_type_info : public std::type_info + { + virtual ~__pbase_type_info(); + /** + * Flags. Values from __masks. + */ + unsigned int __flags; + /** + * The type info for the pointee. + */ + const std::type_info *__pointee; + + /** + * Masks used for qualifiers on the pointer. + */ + enum __masks + { + /** Pointer has const qualifier. */ + __const_mask = 0x1, + /** Pointer has volatile qualifier. */ + __volatile_mask = 0x2, + /** Pointer has restrict qualifier. */ + __restrict_mask = 0x4, + /** Pointer points to an incomplete type. */ + __incomplete_mask = 0x8, + /** Pointer is a pointer to a member of an incomplete class. */ + __incomplete_class_mask = 0x10 + }; + virtual bool __is_pointer_p() const { return true; } + virtual bool __do_catch(const type_info *thrown_type, + void **thrown_object, + unsigned outer) const; + }; + + /** + * Pointer type info. + */ + struct __pointer_type_info : public __pbase_type_info + { + virtual ~__pointer_type_info(); + }; + + /** + * Pointer to member type info. + */ + struct __pointer_to_member_type_info : public __pbase_type_info + { + virtual ~__pointer_to_member_type_info(); + /** + * Pointer to the class containing this member. + */ + const __class_type_info *__context; + }; + +} diff --git a/sdk/cpprt/linux/unwind-arm.h b/sdk/cpprt/linux/unwind-arm.h new file mode 100644 index 0000000000..8c1fa16263 --- /dev/null +++ b/sdk/cpprt/linux/unwind-arm.h @@ -0,0 +1,223 @@ +/* + * Copyright 2012 David Chisnall. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * ARM-specific unwind definitions. These are taken from the ARM EHABI + * specification. + */ + typedef enum +{ + _URC_OK = 0, /* operation completed successfully */ + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8, + _URC_FAILURE = 9, /* unspecified failure of some kind */ + _URC_FATAL_PHASE1_ERROR = _URC_FAILURE +} _Unwind_Reason_Code; + +typedef uint32_t _Unwind_State; +#ifdef __clang__ +static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0; +static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1; +static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2; +#else // GCC fails at knowing what a constant expression is +# define _US_VIRTUAL_UNWIND_FRAME 0 +# define _US_UNWIND_FRAME_STARTING 1 +# define _US_UNWIND_FRAME_RESUME 2 +#endif + +typedef struct _Unwind_Context _Unwind_Context; + +typedef uint32_t _Unwind_EHT_Header; + +struct _Unwind_Exception +{ + uint64_t exception_class; + void (*exception_cleanup)(_Unwind_Reason_Code, struct _Unwind_Exception *); + /* Unwinder cache, private fields for the unwinder's use */ + struct + { + uint32_t reserved1; + uint32_t reserved2; + uint32_t reserved3; + uint32_t reserved4; + uint32_t reserved5; + /* init reserved1 to 0, then don't touch */ + } unwinder_cache; + /* Propagation barrier cache (valid after phase 1): */ + struct + { + uint32_t sp; + uint32_t bitpattern[5]; + } barrier_cache; + /* Cleanup cache (preserved over cleanup): */ + struct + { + uint32_t bitpattern[4]; + } cleanup_cache; + /* Pr cache (for pr's benefit): */ + struct + { + /** function start address */ + uint32_t fnstart; + /** pointer to EHT entry header word */ + _Unwind_EHT_Header *ehtp; + /** additional data */ + uint32_t additional; + uint32_t reserved1; + } pr_cache; + /** Force alignment of next item to 8-byte boundary */ + long long int :0; +}; + +/* Unwinding functions */ +_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); +void _Unwind_Resume(struct _Unwind_Exception *ucbp); +void _Unwind_Complete(struct _Unwind_Exception *ucbp); +void _Unwind_DeleteException(struct _Unwind_Exception *ucbp); +void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context*); + +typedef enum +{ + _UVRSR_OK = 0, + _UVRSR_NOT_IMPLEMENTED = 1, + _UVRSR_FAILED = 2 +} _Unwind_VRS_Result; +typedef enum +{ + _UVRSC_CORE = 0, + _UVRSC_VFP = 1, + _UVRSC_WMMXD = 3, + _UVRSC_WMMXC = 4 +} _Unwind_VRS_RegClass; +typedef enum +{ + _UVRSD_UINT32 = 0, + _UVRSD_VFPX = 1, + _UVRSD_UINT64 = 3, + _UVRSD_FLOAT = 4, + _UVRSD_DOUBLE = 5 +} _Unwind_VRS_DataRepresentation; + +_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + uint32_t regno, + _Unwind_VRS_DataRepresentation representation, + void *valuep); +_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + uint32_t regno, + _Unwind_VRS_DataRepresentation representation, + void *valuep); + +/* Return the base-address for data references. */ +extern unsigned long _Unwind_GetDataRelBase(struct _Unwind_Context *); + +/* Return the base-address for text references. */ +extern unsigned long _Unwind_GetTextRelBase(struct _Unwind_Context *); +extern unsigned long _Unwind_GetRegionStart(struct _Unwind_Context *); + +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, + void *); +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); +extern _Unwind_Reason_Code + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/** + * The next set of functions are compatibility extensions, implementing Itanium + * ABI functions on top of ARM ones. + */ + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 + +static inline unsigned long _Unwind_GetGR(struct _Unwind_Context *context, int reg) +{ + unsigned long val; + _Unwind_VRS_Get(context, _UVRSC_CORE, reg, _UVRSD_UINT32, &val); + return val; +} +static inline void _Unwind_SetGR(struct _Unwind_Context *context, int reg, unsigned long val) +{ + _Unwind_VRS_Set(context, _UVRSC_CORE, reg, _UVRSD_UINT32, &val); +} +static inline unsigned long _Unwind_GetIP(_Unwind_Context *context) +{ + // Low bit store the thumb state - discard it + return _Unwind_GetGR(context, 15) & ~1; +} +static inline void _Unwind_SetIP(_Unwind_Context *context, unsigned long val) +{ + // The lowest bit of the instruction pointer indicates whether we're in + // thumb or ARM mode. This is assumed to be fixed throughout a function, + // so must be propagated when setting the program counter. + unsigned long thumbState = _Unwind_GetGR(context, 15) & 1; + _Unwind_SetGR(context, 15, (val | thumbState)); +} + +/** GNU API function that unwinds the frame */ +_Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception*, struct _Unwind_Context*); + + +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); + +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{\ + int version = 1;\ + uint64_t exceptionClass = exceptionObject->exception_class;\ + int actions;\ + switch (state)\ + {\ + default: return _URC_FAILURE;\ + case _US_VIRTUAL_UNWIND_FRAME:\ + {\ + actions = _UA_SEARCH_PHASE;\ + break;\ + }\ + case _US_UNWIND_FRAME_STARTING:\ + {\ + actions = _UA_CLEANUP_PHASE;\ + if (exceptionObject->barrier_cache.sp == _Unwind_GetGR(context, 13))\ + {\ + actions |= _UA_HANDLER_FRAME;\ + }\ + break;\ + }\ + case _US_UNWIND_FRAME_RESUME:\ + {\ + return continueUnwinding(exceptionObject, context);\ + break;\ + }\ + }\ + _Unwind_SetGR (context, 12, (unsigned long)exceptionObject);\ + +#define CALL_PERSONALITY_FUNCTION(name) name(state,exceptionObject,context) diff --git a/sdk/cpprt/linux/unwind-itanium.h b/sdk/cpprt/linux/unwind-itanium.h new file mode 100644 index 0000000000..16b3eed6d7 --- /dev/null +++ b/sdk/cpprt/linux/unwind-itanium.h @@ -0,0 +1,170 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +/* For uint64_t */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimal interface as per C++ ABI draft standard: + + http://www.codesourcery.com/cxx-abi/abi-eh.html */ + +typedef enum + { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 + } +_Unwind_Reason_Code; + +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 + +struct _Unwind_Context; /* opaque data-structure */ +struct _Unwind_Exception; /* forward-declaration */ + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, + uint64_t, + struct _Unwind_Exception *, + struct _Unwind_Context *, + void *); + +/* The C++ ABI requires exception_class, private_1, and private_2 to + be of type uint64 and the entire structure to be + double-word-aligned. Please note that exception_class stays 64-bit + even on 32-bit machines for gcc compatibility. */ +struct _Unwind_Exception + { + uint64_t exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + unsigned long private_1; + unsigned long private_2; + } __attribute__((__aligned__)); + +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, void *); +extern void _Unwind_Resume (struct _Unwind_Exception *); +extern void _Unwind_DeleteException (struct _Unwind_Exception *); +extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); +extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); +extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); +extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); +extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); +extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); + +#ifdef _GNU_SOURCE + +/* Callback for _Unwind_Backtrace(). The backtrace stops immediately + if the callback returns any value other than _URC_NO_REASON. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, + void *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why + _UA_END_OF_STACK exists. */ +# define _UA_END_OF_STACK 16 + +/* If the unwind was initiated due to a forced unwind, resume that + operation, else re-raise the exception. This is used by + __cxa_rethrow(). */ +extern _Unwind_Reason_Code + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why + _Unwind_GetBSP() exists. */ +extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); + +/* Return the "canonical frame address" for the given context. + This is used by NPTL... */ +extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); + +/* Return the base-address for data references. */ +extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); + +/* Return the base-address for text references. */ +extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); + +/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any + cleanup. The first frame for which the callback is invoked is the + one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() + returns _URC_END_OF_STACK when the backtrace stopped due to + reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it + stops for any other reason. */ +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* Find the start-address of the procedure containing the specified IP + or NULL if it cannot be found (e.g., because the function has no + unwind info). Note: there is not necessarily a one-to-one + correspondence between source-level functions and procedures: some + functions don't have unwind-info and others are split into multiple + procedures. */ +extern void *_Unwind_FindEnclosingFunction (void *); + +/* See also Linux Standard Base Spec: + http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ + +#endif /* _GNU_SOURCE */ + +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(int version,\ + _Unwind_Action actions,\ + uint64_t exceptionClass,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(int version,\ + _Unwind_Action actions,\ + uint64_t exceptionClass,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{ + +#define CALL_PERSONALITY_FUNCTION(name) name(version, actions, exceptionClass, exceptionObject, context) + +#ifdef __cplusplus +} +#endif + +#endif /* _UNWIND_H */ diff --git a/sdk/cpprt/linux/unwind.h b/sdk/cpprt/linux/unwind.h new file mode 100644 index 0000000000..e463a2a781 --- /dev/null +++ b/sdk/cpprt/linux/unwind.h @@ -0,0 +1,40 @@ +/* + * Copyright 2012 David Chisnall. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef UNWIND_H_INCLUDED +#define UNWIND_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __arm__ +#include "unwind-arm.h" +#else +#include "unwind-itanium.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/cpprt/memory_manage/delete1.cpp b/sdk/cpprt/memory_manage/delete1.cpp new file mode 100644 index 0000000000..b5c62f2c8f --- /dev/null +++ b/sdk/cpprt/memory_manage/delete1.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/se_cdefs.h" + +//deallocate the memory block pointed by ptr (if not-null) +SGX_WEAK void SGXAPI operator delete (void* ptr) throw () +{ + free(ptr); +} diff --git a/sdk/cpprt/memory_manage/delete2.cpp b/sdk/cpprt/memory_manage/delete2.cpp new file mode 100644 index 0000000000..81fc388f1f --- /dev/null +++ b/sdk/cpprt/memory_manage/delete2.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/util.h" + +SGX_WEAK void SGXAPI operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() +{ + UNUSED(nothrow_constant); + + free(ptr); +} diff --git a/sdk/cpprt/memory_manage/delete3.cpp b/sdk/cpprt/memory_manage/delete3.cpp new file mode 100644 index 0000000000..bb80ddba72 --- /dev/null +++ b/sdk/cpprt/memory_manage/delete3.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/util.h" + +SGX_WEAK void SGXAPI operator delete (void* ptr, void* voidptr2) throw() +{ + UNUSED(ptr); + UNUSED(voidptr2); + //doing nothing here +} diff --git a/sdk/cpprt/memory_manage/delete4.cpp b/sdk/cpprt/memory_manage/delete4.cpp new file mode 100644 index 0000000000..b8a7d713b8 --- /dev/null +++ b/sdk/cpprt/memory_manage/delete4.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/se_cdefs.h" + +//Deallocate storage space of array +SGX_WEAK void SGXAPI operator delete[] (void* ptr) throw () +{ + operator delete(ptr); +} diff --git a/sdk/cpprt/memory_manage/delete5.cpp b/sdk/cpprt/memory_manage/delete5.cpp new file mode 100644 index 0000000000..8194c03ba1 --- /dev/null +++ b/sdk/cpprt/memory_manage/delete5.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/se_cdefs.h" + +SGX_WEAK void SGXAPI operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) throw() +{ + operator delete(ptr, nothrow_constant); +} diff --git a/sdk/cpprt/memory_manage/delete6.cpp b/sdk/cpprt/memory_manage/delete6.cpp new file mode 100644 index 0000000000..ace2c7473c --- /dev/null +++ b/sdk/cpprt/memory_manage/delete6.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/util.h" + +SGX_WEAK void SGXAPI operator delete[] (void* ptr, void* voidptr2) throw() +{ + UNUSED(ptr); + UNUSED(voidptr2); + //doing nothing here +} diff --git a/sdk/cpprt/memory_manage/new1.cpp b/sdk/cpprt/memory_manage/new1.cpp new file mode 100644 index 0000000000..3b52133fc2 --- /dev/null +++ b/sdk/cpprt/memory_manage/new1.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/se_cdefs.h" +#include "internal/cpprt_internal.h" + +//allocates size bytes of storage space. +//aligned to represent an object of that size +//and returns a non-null pointer to the first byte of this block. +//On failure, it throws a bad_alloc exception. +SGX_WEAK void* SGXAPI operator new(size_t dwBytes) throw(std::bad_alloc) +{ + void* address = malloc(dwBytes); + while ( address == NULL ){ + if ( !call_newh() ){ + throw std::bad_alloc(); + } + address = malloc(dwBytes); + } + return address; +} diff --git a/sdk/cpprt/memory_manage/new2.cpp b/sdk/cpprt/memory_manage/new2.cpp new file mode 100644 index 0000000000..2851882a11 --- /dev/null +++ b/sdk/cpprt/memory_manage/new2.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/util.h" +#include "internal/cpprt_internal.h" + +//nothrow version. +//on failure it returns a null pointer instead of throwing an exception. +SGX_WEAK void* SGXAPI operator new (size_t dwBytes, const std::nothrow_t& nothrow_constant) throw() +{ + UNUSED(nothrow_constant); + + void* address = malloc(dwBytes); + while( address == NULL ){ + try { + if ( !call_newh() ){ + return NULL; + } + }catch(...){ + return NULL; + } + address = malloc(dwBytes); + } + return address; +} diff --git a/sdk/cpprt/memory_manage/new3.cpp b/sdk/cpprt/memory_manage/new3.cpp new file mode 100644 index 0000000000..580284c217 --- /dev/null +++ b/sdk/cpprt/memory_manage/new3.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/util.h" + +//placement version +//that does not allocate memory - it simply returns ptr. +//Notice though that the constructor for the object (if any) will still be called by the operator expression. +SGX_WEAK void* SGXAPI operator new (size_t dwBytes, void* ptr) throw() +{ + if( !sgx_is_within_enclave(ptr, dwBytes) ){ + //compiler will check the pointer before call object construct, so it is OK to return NULL here + return NULL; + } + return ptr; +} diff --git a/sdk/cpprt/memory_manage/new4.cpp b/sdk/cpprt/memory_manage/new4.cpp new file mode 100644 index 0000000000..73f5e589b7 --- /dev/null +++ b/sdk/cpprt/memory_manage/new4.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/se_cdefs.h" + +//Allocate storage space for array +SGX_WEAK void* SGXAPI operator new[](size_t dwBytes) throw(std::bad_alloc) +{ + return operator new(dwBytes); +} diff --git a/sdk/cpprt/memory_manage/new5.cpp b/sdk/cpprt/memory_manage/new5.cpp new file mode 100644 index 0000000000..8588534912 --- /dev/null +++ b/sdk/cpprt/memory_manage/new5.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/se_cdefs.h" + +SGX_WEAK void* SGXAPI operator new[] (size_t dwBytes, const std::nothrow_t& nothrow_constant) throw() +{ + return operator new(dwBytes, nothrow_constant); +} diff --git a/sdk/cpprt/memory_manage/new6.cpp b/sdk/cpprt/memory_manage/new6.cpp new file mode 100644 index 0000000000..c477133480 --- /dev/null +++ b/sdk/cpprt/memory_manage/new6.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_defs.h" +#include "sgx_trts.h" +#include "internal/util.h" + +SGX_WEAK void* SGXAPI operator new[] (size_t dwBytes, void* ptr) throw() +{ + if( !sgx_is_within_enclave(ptr, dwBytes) ){ + //compiler will check the pointer before call object construct, so it is OK to return NULL here + return NULL; + } + return ptr; +} diff --git a/sdk/cpprt/memory_manage/new_handler.cpp b/sdk/cpprt/memory_manage/new_handler.cpp new file mode 100644 index 0000000000..2e82c8ba2f --- /dev/null +++ b/sdk/cpprt/memory_manage/new_handler.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include "sgx_trts.h" +#include "sgx_spinlock.h" +#include "internal/se_cdefs.h" + +namespace std{ + static sgx_spinlock_t handler_lock = SGX_SPINLOCK_INITIALIZER; + //default hanlder is NULL + static new_handler new_handl = NULL; + + // set_new_handler() + // Sets new_p as the new handler function. + // The new handler function is the function that is called by functions + // operator new or operator new[] when they are not successful + // in an attempt to allocate memory. + // Parameter + // handler - a pointer to the handler to be called. + // The function can make more storage available or throw an exception or terminate the program. + // new_handler is a function pointer type taking no parameters and returning void. + // Return Value + // new_handler - The value of the current new_handler function if this has been previously set by this function + // NULL -if this is the first call to set_new_handler + new_handler set_new_handler(new_handler handle) throw() + { + sgx_spin_lock(&handler_lock); + new_handler retHandle = new_handl; + if ( handle == NULL ){ + new_handl = NULL; + } else if ( sgx_is_within_enclave((void *)handle, 0) ){ + //only set the handler when handler address is inside enclave + new_handl = handle; + } + sgx_spin_unlock(&handler_lock); + return retHandle; + } +}; + +using namespace std; + +//call new_handl function when new memory failed +int call_newh() +{ + int ret = 0; + sgx_spin_lock(&handler_lock); + new_handler handler = new_handl; + //unlock the handler here because new_handl may call set_new_handler again, will cause dead lock. + sgx_spin_unlock(&handler_lock); + + // call new handler + if ( handler != NULL ){ + handler(); + ret = 1; + } + + return ret; +} diff --git a/sdk/cpprt/tstdcxx_version.cpp b/sdk/cpprt/tstdcxx_version.cpp new file mode 100644 index 0000000000..3d04efd5c6 --- /dev/null +++ b/sdk/cpprt/tstdcxx_version.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_TSTDCXX_VERSION_STR __CONCAT("SGX_TSTDCXX_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_tstdcxx_version = SGX_TSTDCXX_VERSION_STR; + +#ifdef __cplusplus +} +#endif diff --git a/sdk/debugger_interface/linux/Makefile b/sdk/debugger_interface/linux/Makefile new file mode 100644 index 0000000000..0c4acbba7b --- /dev/null +++ b/sdk/debugger_interface/linux/Makefile @@ -0,0 +1,89 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +#Don't CFLAGS +=, because it depend on gdb is m32 or m64 +CFLAGS := + +CPPFLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal/ + +CFLAGS += -W -Wall -Werror -D_GNU_SOURCE -fpic -fstack-protector +LDLIBS += -ldl + +ifdef DEBUG + CFLAGS += -g -DSE_DEBUG=1 +endif + +OBJ1 := se_memory.o se_trace.o +OBJ2 := se_ptrace.o ptrace_version.o + +OBJS := $(OBJ1) $(OBJ2) + + +GDB_PLUGINS_FILES := gdb-sgx-plugin/sgx_emmt.py \ + gdb-sgx-plugin/gdb_sgx_cmd \ + gdb-sgx-plugin/gdb_sgx_plugin.py \ + gdb-sgx-plugin/load_symbol_cmd.py \ + gdb-sgx-plugin/readelf.py + +GDB_OUT_DIR := $(BUILD_DIR)/gdb-sgx-plugin +TARGET := libsgx_ptrace.so + + +.PHONY: all +all: $(TARGET) install + +.PHONY:install +install: | $(GDB_OUT_DIR) $(GDB_PLUGINS_FILES) + $(CP) $(GDB_PLUGINS_FILES) $(GDB_OUT_DIR) + $(CP) $(TARGET) $(BUILD_DIR) + +$(TARGET): $(OBJS) + $(CC) -shared -o $@ $^ $(LDLIBS) $(CFLAGS) + +$(OBJ1): %.o: $(COMMON_DIR)/src/%.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +$(OBJ2): %.o: %.c + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +$(GDB_OUT_DIR): + @$(MKDIR) $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + @$(RM) $(TARGET) $(OBJS) $(BUILD_DIR)/$(TARGET) + @$(RM) -r $(GDB_OUT_DIR) diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_cmd b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_cmd new file mode 100644 index 0000000000..46f0488b36 --- /dev/null +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_cmd @@ -0,0 +1,35 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +# the path can be specified by directory command +define hook-detach +detach_enclaves +end diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py new file mode 100755 index 0000000000..77f35f3ae5 --- /dev/null +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py @@ -0,0 +1,597 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +from __future__ import print_function +import gdb +import struct +import os.path +from ctypes import create_string_buffer +import load_symbol_cmd +import sgx_emmt + +# Calculate the bit mode of current debuggee project +SIZE = gdb.parse_and_eval("sizeof(long)") + +ET_SIM = 0x1 +ET_DEBUG = 0x2 +PAGE_SIZE = 0x1000 +# The following definitions should strictly align with the structure of +# debug_enclave_info_t in uRTS. +# Here we only care about the first 7 items in the structure. +# pointer: next_enclave_info, start_addr, tcs_list, lpFileName, +# g_peak_heap_used_addr +# int32_t: enclave_type, file_name_size +ENCLAVE_INFO_SIZE = 5 * 8 + 2 * 4 +INFO_FMT = 'QQQIIQQ' +ENCLAVES_ADDR = {} + +# The following definitions should strictly align with the struct of +# tcs_t +# Here we only care about the first 8 items in the structure +# uint64_t: state, flags, ossa, oentry, aep, ofs_base +# uint32_t: nssa, cssa +ENCLAVE_TCS_INFO_SIZE = 6*8 + 2*4 +TCS_INFO_FMT = 'QQQIIQQQ' + +def get_inferior(): + """Get current inferior""" + try: + if len(gdb.inferiors()) == 0: + print ("No gdb inferior could be found.") + return -1 + else: + inferior = gdb.inferiors()[0] + return inferior + except AttributeError: + print ("This gdb's python support is too old, please update first.") + exit() + +def read_from_memory(addr, size): + """Read data with specified size from the specified meomory""" + inferior = get_inferior() + # actually we can check the addr more securely + # ( check the address is inside the enclave) + if inferior == -1 or addr == 0: + print ("Error happens in read_from_memory: addr = {0:x}".format(int(addr))) + return None + try: + string = inferior.read_memory(addr, size) + return string + except gdb.MemoryError: + print ("Can't access memory at {0:x}.".format(int(addr))) + return None + +def write_to_memory(addr, buf): + """Write a specified buffer to the specified memory""" + inferior = get_inferior() + if inferior == -1 or addr == 0: + print ("Error happens in write_to_memory: addr = {0:x}".format(int(addr))) + return -1 + try: + inferior.write_memory(addr, buf) + return 0 + except gdb.MemoryError: + print ("Can't access memory at {0:x}.".format(int(addr))) + return -1 + +def target_path_to_host_path(target_path): + so_name = os.path.basename(target_path) + strpath = gdb.execute("show solib-search-path", False, True) + path = strpath.split()[-1] + strlen = len(path) + path = path[0:strlen-1] + host_path = path + "/" + so_name + #strlen = len(host_path) + #host_path = host_path[0:strlen-7] + return host_path + +class enclave_info: + """Class to contain the enclave inforation, + such as start address, stack addresses, stack size, etc. + The enclave information is for one enclave.""" + def __init__(self, _next_ei, _start_addr, _enclave_type, _stack_addr_list, \ + _stack_size, _enclave_path, _heap_addr, _tcs_addr_list): + self.next_ei = _next_ei + self.start_addr = _start_addr + self.enclave_type = _enclave_type + self.stack_addr_list = _stack_addr_list + self.stack_size = _stack_size + self.enclave_path = _enclave_path + self.heap_addr = _heap_addr + self.tcs_addr_list = _tcs_addr_list + def __str__(self): + print ("stack address list = {0:s}".format(self.stack_addr_list)) + return "start_addr = %#x, enclave_path = \"%s\", stack_size = %d" \ + % (self.start_addr, self.enclave_path, self.stack_size) + def __eq__(self, other): + if other == None: + return False + if self.start_addr == other.start_addr: + return True + else: + return False + def init_enclave_debug(self): + # Only product HW enclave can't be debugged + if (self.enclave_type & ET_SIM) != ET_SIM and (self.enclave_type & ET_DEBUG) != ET_DEBUG: + print ('Warning: {0:s} is a product hardware enclave. It can\'t be debugged and sgx_emmt doesn\'t work'.format(self.enclave_path)) + return -1 + # set TCS debug flag + for tcs_addr in self.tcs_addr_list: + string = read_from_memory(tcs_addr + 8, 4) + if string == None: + return 0 + flag = struct.unpack('I', string)[0] + flag |= 1 + gdb_cmd = "set *(unsigned int *)%#x = %#x" %(tcs_addr + 8, flag) + gdb.execute(gdb_cmd, False, True) + #If it is a product enclave, won't reach here. + #load enclave symbol + if os.path.exists(self.enclave_path) == True: + enclave_path = self.enclave_path + else: + enclave_path = target_path_to_host_path(self.enclave_path) + gdb_cmd = load_symbol_cmd.GetLoadSymbolCommand(enclave_path, str(self.start_addr)) + if gdb_cmd == -1: + return 0 + print (gdb_cmd) + gdb.execute(gdb_cmd, False, True) + global ENCLAVES_ADDR + ENCLAVES_ADDR[self.start_addr] = gdb_cmd.split()[2] + return 0 + + def get_peak_heap_used(self): + """Get the peak value of the heap used""" + if self.heap_addr == 0: + return -2 + # read the peak_heap_used value + string = read_from_memory(self.heap_addr, SIZE) + if string == None: + return -1 + if SIZE == 4: + fmt = 'I' + elif SIZE == 8: + fmt = "Q" + peak_heap_used = struct.unpack(fmt, string)[0] + return peak_heap_used + + def internal_compare (self, a, b): + return (a > b) - (a < b) + + def find_boundary_page_index(self, stack_addr, stack_size): + """Find the unused page index of the boundary for the used and unused pages + with the binary search algorithm""" + page_index = -1 #record the last unused page index + low = 0 + high = (stack_size>>12) - 1 + mid = 0 + # Read the mid page and check if it is used or not + # If the mid page is used, then continue to search [mid+1, high] + while low <= high: + #print "low = %x, high = %x, mid = %x" % (low, high, mid) + mid = (low + high)>>1 + string = read_from_memory(stack_addr + mid*PAGE_SIZE + (PAGE_SIZE>>1), PAGE_SIZE>>1) + if string == None: + return -2 + dirty_flag = 0 + for i in range(0, PAGE_SIZE>>4): + temp = struct.unpack_from("Q", string, ((PAGE_SIZE>>4) - 1 - i)*8)[0] + if (self.internal_compare(temp, 0xcccccccccccccccc)) != 0: + dirty_flag = 1 + break + if dirty_flag == 0: + low = mid + 1 + page_index = mid + else: + high = mid -1 + return page_index + + + def get_peak_stack_used(self): + """Get the peak value of the stack used""" + peak_stack_used = 0 + for stack_addr in self.stack_addr_list: + page_index = self.find_boundary_page_index(stack_addr, self.stack_size) + if page_index == (self.stack_size)/PAGE_SIZE - 1: + continue + elif page_index == -2: + return -1 + else: + string = read_from_memory(stack_addr + (page_index+1) * PAGE_SIZE, PAGE_SIZE) + if string == None: + return -1 + for i in range(0, len(string)): + temp = struct.unpack_from("B", string, i)[0] + if (self.internal_compare(temp, 0xcc)) != 0: + if peak_stack_used < (self.stack_size - (page_index+1) * PAGE_SIZE - i): + peak_stack_used = self.stack_size- (page_index+1) * PAGE_SIZE - i + break # go to the top for loop + return peak_stack_used + + def show_emmt(self): + ret = gdb.execute("show sgx_emmt", False, True) + if ret.strip() == "sgx_emmt enabled": + print ("Enclave: \"{0:s}\"".format(self.enclave_path)) + peak_stack_used = self.get_peak_stack_used() + if peak_stack_used == -1: + print ("Failed to collect the stack usage information for \"{0:s}\"".format(self.enclave_path)) + else: + print (" [Peak stack used]: {0:x}".format(peak_stack_used)) + peak_heap_used = self.get_peak_heap_used() + if peak_heap_used == -1: + print ("Failed to collect the heap usage information for \"{0:s}\"".format(self.enclave_path)) + elif peak_heap_used == -2: + print (" [Can't get peak heap used]: You may use version script to control symbol export. Please export \'g_peak_heap_used\' in your version script.") + else: + print (" [Peak heap used]: {0:x}".format(peak_heap_used)) + + def fini_enclave_debug(self): + # If it is HW product enclave, nothing to do + if (self.enclave_type & ET_SIM) != ET_SIM and (self.enclave_type & ET_DEBUG) != ET_DEBUG: + return -2 + self.show_emmt() + try: + # clear TCS debug flag + for tcs_addr in self.tcs_addr_list: + string = read_from_memory(tcs_addr + 8, 4) + if string == None: + return -2 + flag = struct.unpack('I', string)[0] + flag &= (~1) + gdb_cmd = "set *(unsigned int *)%#x = %#x" %(tcs_addr + 8, flag) + gdb.execute(gdb_cmd, False, True) + #unload symbol + if os.path.exists(self.enclave_path) == True: + enclave_path = self.enclave_path + else: + enclave_path = target_path_to_host_path(self.enclave_path) + gdb_cmd = load_symbol_cmd.GetUnloadSymbolCommand(enclave_path, str(self.start_addr)) + if gdb_cmd == -1: + return -1 + print (gdb_cmd) + try: + gdb.execute(gdb_cmd, False, True) + global ENCLAVES_ADDR + del ENCLAVES_ADDR[self.start_addr] + except gdb.error: + print ("Old gdb doesn't support remove-file-symbol command") + return 0 + ##It is possible enclave has been destroyed, so may raise exception on memory access + except gdb.MemoryError: + return -1 + except: + return -1 + +def retrieve_enclave_info(info_addr = 0): + """retrieve one enclave info""" + # Step 1: find the enclave info address + if info_addr == 0: + if SIZE == 4: + info_addr = gdb.parse_and_eval("$eax") + elif SIZE == 8: + info_addr = gdb.parse_and_eval("$rdi") + + # Step 2: retrieve the enclave info + info_str = read_from_memory(info_addr, ENCLAVE_INFO_SIZE) + if info_str == None: + return None + info_tuple = struct.unpack_from(INFO_FMT, info_str, 0) + # (next_enclave_info,start_addr,tcs_list,enclave_type,file_name_size, + # lpFileName,g_peak_heap_used_addr) + #print "next_addr: %#x, start_addr: %#x, tcs_list: %#x, enclave_type:%#x, file_name_size: %#x," \ + # % (info_tuple[0], info_tuple[1], info_tuple[2], info_tuple[3], info_tuple[4]) + #print "name_addr: %#x, peak_heap_used_addr: %#x" \ + # % (info_tuple[5], info_tuple[6]) + #get enclave path + name_str = read_from_memory(info_tuple[5], info_tuple[4]) + if name_str == None: + return None + fmt = str(info_tuple[4]) + 's' + enclave_path = struct.unpack_from(fmt, name_str)[0].decode(encoding='UTF-8') + # get the stack addr list + stack_addr_list = [] + tcs_addr_list = [] + if SIZE == 4: + fmt = '3I' + elif SIZE == 8: + fmt = '3Q' + tcs_info_addr = info_tuple[2] + if tcs_info_addr == 0: + print ("Error: tcs info address = {0:x}".format(tcs_info_addr)) + return None + + while tcs_info_addr is not 0: + tcs_info_str = read_from_memory(tcs_info_addr, 3*SIZE) + if tcs_info_str == None: + return None + tcs_info_tuple = struct.unpack_from(fmt, tcs_info_str) + + #get tcs struct data + tcs_t_str = read_from_memory(tcs_info_tuple[1], ENCLAVE_TCS_INFO_SIZE) + if tcs_t_str == None: + return None + tcs_t_tuple = struct.unpack_from(TCS_INFO_FMT, tcs_t_str) + + if SIZE == 4: + td_fmt = '4I' + elif SIZE == 8: + td_fmt = '4Q' + + #get thread_data_t address + td_addr = tcs_t_tuple[7] + info_tuple[1] #thread_data_t = tcs.of_base + debug_enclave_info.start_addr + td_str = read_from_memory(td_addr, (4*SIZE)) + if td_str == None: + return None + td_tuple = struct.unpack_from(td_fmt, td_str) + #print ("thread_info:%#x, last_sp:%#x, stack_base_addr:%#x, stack_limit_addr:%#x" \ + # % (td_tuple[0], td_tuple[1], td_tuple[2], td_tuple[3])); + + stacksize = td_tuple[2] - td_tuple[3] #stack size = stack_base_addr - stack_limit_addr + stack_addr_list.append(td_tuple[3]) #use stack limit addr as stack base address + tcs_addr_list.append(tcs_info_tuple[1]) + tcs_info_addr = tcs_info_tuple[0] + + last_ocall_frame = tcs_info_tuple[2] + last_frame = last_ocall_frame + + #print ("last_ocall_frame = {0:x}".format(last_ocall_frame)) + + while last_ocall_frame is not 0: + if SIZE == 4: + of_fmt = '4I' + elif SIZE == 8: + of_fmt = '4Q' + + ocall_frame = read_from_memory(last_ocall_frame, 4*SIZE) + + if ocall_frame == None: + return None + ocall_frame_tuple = struct.unpack_from(of_fmt, ocall_frame) + last_frame = ocall_frame_tuple[0] + + last_trusted_ocall_frame = td_tuple[1] + #print ("last_trusted_ocall_frame = {0:x}".format(last_trusted_ocall_frame)) + #print ("td_tuple[2] = {0:x}".format(td_tuple[2])) + #break + + while last_trusted_ocall_frame != td_tuple[2]: + if SIZE == 4: + oc_fmt = '20I' + elif SIZE == 8: + oc_fmt = '20Q' + + oc_str = read_from_memory(last_trusted_ocall_frame, 20*SIZE) + if oc_str == None: + return None + oc_tuple = struct.unpack_from(oc_fmt, oc_str) + + last_trusted_ocall_frame = oc_tuple[6] + + #print ("last_trusted_ocall_frame = {0:x}".format(last_trusted_ocall_frame)) + #print ("ocall_frame_tuple[1] = {0:x}".format(ocall_frame_tuple[1])) + #print ("oc_tuple[18] = {0:x}".format(oc_tuple[18])) + #break + + if ocall_frame_tuple[1] == oc_tuple[18]: + #ocall_frame.pre_last_frame = 0 + #ocall_frame.ret = ocall_context.ocall_ret + #ocall_frame.xbp = ocall_context.xbp + gdb_cmd = "set *(uintptr_t *)%#x = 0" %(last_ocall_frame) + gdb.execute(gdb_cmd, False, True) + gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(last_ocall_frame+(2*SIZE), oc_tuple[11]) + gdb.execute(gdb_cmd, False, True) + gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(last_ocall_frame+(3*SIZE), oc_tuple[19]) + gdb.execute(gdb_cmd, False, True) + break + + last_ocall_frame = last_frame + + node = enclave_info(info_tuple[0], info_tuple[1], info_tuple[3], stack_addr_list, \ + stacksize, enclave_path, info_tuple[6], tcs_addr_list) + return node + +def handle_load_event(): + """Handle the enclave loading event. + Firstly, retrieve the enclave info node from register + """ + node = retrieve_enclave_info() + if node != None: + node.init_enclave_debug() + else: + return + +def handle_unload_event(): + node = retrieve_enclave_info() + if node != None: + node.fini_enclave_debug() + else: + return + +def is_bp_in_urts(): + try: + ip = gdb.parse_and_eval("$pc") + solib_name = gdb.solib_name(int(str(ip).split()[0], 16)) + if(solib_name.find("libsgx_urts.so") == -1 and solib_name.find("libsgx_urts_sim.so") == -1 and solib_name.find("libsgx_aesm_service.so") == -1): + return False + else: + return True + #If exception happens, just assume it is bp in uRTS. + except: + return True + +def init_enclaves_debug(): + enclave_info_addr = gdb.parse_and_eval("*(void**)&g_debug_enclave_info_list") + while enclave_info_addr != 0: + node = retrieve_enclave_info(enclave_info_addr) + if node != None: + node.init_enclave_debug() + else: + return + enclave_info_addr = node.next_ei + return + +class detach_enclaves (gdb.Command): + def __init__ (self): + gdb.Command.__init__ (self, "detach_enclaves", gdb.COMMAND_NONE) + + def invoke (self, arg, from_tty): + #We reject the command from the input of terminal + if from_tty == True: + return + try: + enclave_info_addr = gdb.parse_and_eval("*(void**)&g_debug_enclave_info_list") + except: + return + while enclave_info_addr != 0: + node = retrieve_enclave_info(enclave_info_addr) + if node != None: + node.fini_enclave_debug() + else: + return + enclave_info_addr = node.next_ei + +class UpdateOcallFrame(gdb.Breakpoint): + def __init__(self): + gdb.Breakpoint.__init__ (self, spec="notify_gdb_to_update", internal=1) + + def stop(self): + bp_in_urts = is_bp_in_urts() + + if bp_in_urts == True: + + if SIZE == 4: + base_addr = gdb.parse_and_eval("base") + tcs_addr = gdb.parse_and_eval("tcs") + ocall_frame = gdb.parse_and_eval("of") + elif SIZE == 8: + base_addr = gdb.parse_and_eval("$rdi") + tcs_addr = gdb.parse_and_eval("$rsi") + ocall_frame = gdb.parse_and_eval("$rdx") + + #print ("base_addr = {0:x}".format(int(base_addr))) + #print ("tcs_addr = {0:x}".format(int(tcs_addr))) + #print ("ocall_frame = {0:x}".format(int(ocall_frame))) + + tcs_str = read_from_memory(tcs_addr, ENCLAVE_TCS_INFO_SIZE) + if tcs_str == None: + return False + tcs_tuple = struct.unpack_from(TCS_INFO_FMT, tcs_str) + offset = tcs_tuple[7] + + if SIZE == 4: + td_fmt = '4I' + elif SIZE == 8: + td_fmt = '4Q' + + td_str = read_from_memory(base_addr+offset, (4*SIZE)) + if td_str == None: + return False + td_tuple = struct.unpack_from(td_fmt, td_str) + + if SIZE == 4: + trusted_of_fmt = '20I' + elif SIZE == 8: + trusted_of_fmt = '20Q' + + last_sp = td_tuple[1] + + trusted_ocall_frame = read_from_memory(last_sp, (20*SIZE)) + if trusted_ocall_frame == None: + return False + trusted_ocall_frame_tuple = struct.unpack_from(trusted_of_fmt, trusted_ocall_frame) + + gdb_cmd = "set *(uintptr_t *)%#x = 0" %(ocall_frame) + gdb.execute(gdb_cmd, False, True) + gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(ocall_frame+(2*SIZE), trusted_ocall_frame_tuple[11]) + gdb.execute(gdb_cmd, False, True) + gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(ocall_frame+(3*SIZE), trusted_ocall_frame_tuple[19]) + gdb.execute(gdb_cmd, False, True) + + return False + +class LoadEventBreakpoint(gdb.Breakpoint): + def __init__(self): + gdb.Breakpoint.__init__ (self, spec="sgx_debug_load_state_add_element", internal=1) + + def stop(self): + bp_in_urts = is_bp_in_urts() + + if bp_in_urts == True: + handle_load_event() + return False + +class UnloadEventBreakpoint(gdb.Breakpoint): + def __init__(self): + gdb.Breakpoint.__init__ (self, spec="sgx_debug_unload_state_remove_element", internal=1) + + def stop(self): + bp_in_urts = is_bp_in_urts() + + if bp_in_urts == True: + handle_unload_event() + return False + +def sgx_debugger_init(): + print ("detect urts is loaded, initializing") + global SIZE + SIZE = gdb.parse_and_eval("sizeof(long)") + inited = 0 + bps = gdb.breakpoints() + if None != bps: + for bp in bps: + if bp.location == "sgx_debug_load_state_add_element": + inited = 1 + break + if inited == 0: + detach_enclaves() + gdb.execute("source gdb_sgx_cmd", False, True) + UpdateOcallFrame() + LoadEventBreakpoint() + UnloadEventBreakpoint() + gdb.events.exited.connect(exit_handler) + init_enclaves_debug() + + +def exit_handler(event): + # When the inferior exited, remove all enclave symbol + for key in ENCLAVES_ADDR.keys(): + gdb.execute("remove-symbol-file -a %s" % (ENCLAVES_ADDR[key]), False, True) + ENCLAVES_ADDR.clear() + +def newobj_handler(event): + solib_name = os.path.basename(event.new_objfile.filename) + if solib_name == 'libsgx_urts.so' or solib_name == 'libsgx_urts_sim.so' or solib_name == 'libsgx_aesm_service.so': + sgx_debugger_init() + return + +if __name__ == "__main__": + gdb.events.new_objfile.connect(newobj_handler) + sgx_emmt.init_emmt() diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py new file mode 100755 index 0000000000..9909a5a514 --- /dev/null +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/load_symbol_cmd.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +try: + from cStringIO import StringIO +except ImportError: + from io import StringIO + +import traceback, errno, string, re, sys, time, readelf; + +def GetLoadSymbolCommand(EnclaveFile, Base): + text = readelf.ReadElf(EnclaveFile) + if text == None: + return -1 + SegsFile = StringIO(text) + + try: + FileList = SegsFile.readlines() + n=4; + m=100; + Out = [[[] for ni in range(n)] for mi in range(m)] + i=0; + Out[99][2] = '0'; + # Parse the readelf output file to extract the section names and + # their offsets and add the Proj base address. + for line in FileList: + list = line.split(); + if(len(list) > 0): + SegOffset = -1; + # The readelf will put a space after the open bracket for single + # digit section numbers. This causes the line.split to create + # an extra element in the array for these lines. + if(re.match('\[\s*[0-9]+\]',list[0])): + SegOffset = 0; + if(re.match('\s*[0-9]+\]',list[1])): + SegOffset = 1; + + if(SegOffset != -1): + if (list[SegOffset+1][0] == '.'): + # If it is the .text section, put it in a special place in the array + # because the 'add-symbol-file' command treats it differently. + #print "%#08x" % (int(list[SegOffset+3], 16)) + if(list[SegOffset+1].find(".text") != -1): + Out[99][0] = "-s"; + Out[99][1] = list[SegOffset+1]; + Out[99][2] = str(int(list[SegOffset+3], 16) + int(Base, 10)); + Out[99][3] = " "; + elif(int(list[SegOffset+3], 16) != 0): + Out[i][0] = "-s"; + Out[i][1] = list[SegOffset+1]; + Out[i][2] = str(int(list[SegOffset+3], 16) + int(Base, 10)); + Out[i][3] = " "; + i = i+1; + if('0' != Out[99][2]): + # The last section must not have the '\' line continuation character. + Out[i-1][3] = ''; + + # Write the GDB 'add-symbol-file' command with all the arguments to the setup GDB command file. + # Note: The mandatory argument for the 'add-symbol-file' command is the .text section without a + # '-s .SectionName'. All other sections need the '-s .SectionName'. + gdbcmd = "add-symbol-file '" + EnclaveFile + "' " + '%(Location)#08x' % {'Location':int(Out[99][2])} + " -readnow " + for j in range(i): + gdbcmd += Out[j][0] + " " + Out[j][1] + " " + '%(Location)#08x' % {'Location' : int(Out[j][2])} + " " + Out[j][3] + else: + return -1 + + return gdbcmd + + except: + print ("Error parsing enclave file. Check format of file.") + return -1 + +def GetUnloadSymbolCommand(EnclaveFile, Base): + text = readelf.ReadElf(EnclaveFile) + if text == None: + return -1 + SegsFile = StringIO(text) + + try: + FileList = SegsFile.readlines() + # Parse the readelf output file to extract the section names and + # their offsets and add the Proj base address. + for line in FileList: + list = line.split(); + if(len(list) > 0): + SegOffset = -1; + # The readelf will put a space after the open bracket for single + # digit section numbers. This causes the line.split to create + # an extra element in the array for these lines. + if(re.match('\[\s*[0-9]+\]',list[0])): + SegOffset = 0; + if(re.match('\s*[0-9]+\]',list[1])): + SegOffset = 1; + + if(SegOffset != -1): + if (list[SegOffset+1][0] == '.'): + # If it is the .text section, get the .text start address and plus enclave start address + if(list[SegOffset+1].find(".text") != -1): + return "remove-symbol-file -a " + str(int(list[SegOffset+3], 16) + int(Base, 10)) + + except: + print ("Error parsing enclave file. Check format of file.") + return -1 diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py new file mode 100755 index 0000000000..48c62e9fe2 --- /dev/null +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/readelf.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +import gdb, subprocess +def ReadElf(EnclaveFile): + prefix = gdb.execute("get_tc_prefix", False, True) + readelf_cmd = 'readelf' + + if prefix.strip() != 'None': + readelf_cmd = prefix.strip() + 'readelf' + try: + text = subprocess.check_output([readelf_cmd, + '-W', + '-S', + EnclaveFile], + universal_newlines=True + ) + except subprocess.CalledProcessError as e: + text = None + + return text diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py new file mode 100755 index 0000000000..ac3098f0e7 --- /dev/null +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/sgx_emmt.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +import gdb + +ENABLE_EMMT = 0 +TC_PREFIX = None +TC_PREFIX_DONE = False + +class enable_emmt (gdb.Command): + def __init__ (self): + gdb.Command.__init__ (self, "enable sgx_emmt", gdb.COMMAND_RUNNING) + + def invoke (self, arg, from_tty): + global ENABLE_EMMT + ENABLE_EMMT = 1 + +class disable_emmt (gdb.Command): + def __init__ (self): + gdb.Command.__init__ (self, "disable sgx_emmt", gdb.COMMAND_RUNNING) + + def invoke (self, arg, from_tty): + global ENABLE_EMMT + ENABLE_EMMT = 0 + +class show_emmt (gdb.Command): + def __init__ (self): + gdb.Command.__init__ (self, "show sgx_emmt", gdb.COMMAND_RUNNING) + + def invoke (self, arg, from_tty): + global ENABLE_EMMT + if ENABLE_EMMT == 1: + print ("sgx_emmt enabled") + if ENABLE_EMMT == 0: + print ("sgx_emmt disabled") + +class set_tc_prefix(gdb.Command): + def __init__ (self): + gdb.Command.__init__ (self, "set_tc_prefix", gdb.COMMAND_NONE) + + def invoke (self, arg, from_tty): + global TC_PREFIX, TC_PREFIX_DONE + #For internal use, and don't allow input by gdb user + if TC_PREFIX_DONE == True: + return + TC_PREFIX = arg + TC_PREFIX_DONE = True + +class get_tc_prefix(gdb.Command): + def __init__ (self): + gdb.Command.__init__ (self, "get_tc_prefix", gdb.COMMAND_NONE) + + def invoke (self, arg, from_tty): + global TC_PREFIX + #For internal use, and don't allow output to tty + if from_tty == True: + return + print (TC_PREFIX) + +def init_emmt(): + enable_emmt() + disable_emmt() + show_emmt() + set_tc_prefix() + get_tc_prefix() diff --git a/sdk/debugger_interface/linux/ptrace_version.c b/sdk/debugger_interface/linux/ptrace_version.c new file mode 100644 index 0000000000..ff37115de7 --- /dev/null +++ b/sdk/debugger_interface/linux/ptrace_version.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" +#include "se_cdefs.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_PTRACE_VERSION_STR __CONCAT("SGX_PTRACE_VERSION_", STRFILEVER) + +__attribute__((visibility("default"))) +const char * sgx_ptrace_version = SGX_PTRACE_VERSION_STR; + + +SGX_ACCESS_VERSION(ptrace, 1) diff --git a/sdk/debugger_interface/linux/se_ptrace.c b/sdk/debugger_interface/linux/se_ptrace.c new file mode 100644 index 0000000000..6d23bd989c --- /dev/null +++ b/sdk/debugger_interface/linux/se_ptrace.c @@ -0,0 +1,594 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "arch.h" +#include "thread_data.h" +#include "util.h" +#include "se_trace.h" +#include "se_memory.h" +#include +#include +#include +#include +#include +#include + #include + #include +#include +#include +#include +#include +#include + +//NOTE: Need align with thread_data_t in RTS. +#define ELF32_SSA_FS_OFFSET 0x34 + +#ifdef __x86_64__ +#define SSA2USER_REG(to, from, name) to->r##name = from.r##name +#define USER_REG2SSA(to, from, name) to.r##name = from->r##name +#else +#define SSA2USER_REG(to, from, name) to->e##name = from.e##name +#define USER_REG2SSA(to, from, name) to.e##name = from->e##name +#endif + +#define XSTATE_MAX_SIZE 832 + +typedef enum _direction_t +{ + FORWARD, + BACKWARD +} direction_t; + + +typedef long int (* ptrace_t)(enum __ptrace_request request, pid_t pid, + void *addr, void *data); + +static ptrace_t g_sys_ptrace = NULL; +__attribute__((constructor)) void init() +{ + g_sys_ptrace = (ptrace_t)dlsym(RTLD_NEXT, "ptrace"); +} + +#ifdef SE_DEBUG +static void dump_ssa_gregs(ssa_gpr_t* gpr) __attribute__((unused)); +void dump_ssa_gregs(ssa_gpr_t* gpr) +{ + SE_TRACE(SE_TRACE_DEBUG, "ssa generic registers:\n"); + SE_TRACE(SE_TRACE_DEBUG, "xbx = %#lx\t", gpr->REG(bx)); + SE_TRACE(SE_TRACE_DEBUG, "xcx = %#lx\t", gpr->REG(cx)); + SE_TRACE(SE_TRACE_DEBUG, "xdx = %#lx\t", gpr->REG(dx)); + SE_TRACE(SE_TRACE_DEBUG, "xsi = %#lx\t", gpr->REG(si)); + SE_TRACE(SE_TRACE_DEBUG, "xdi = %#lx\t", gpr->REG(di)); + SE_TRACE(SE_TRACE_DEBUG, "xbp = %#lx\t", gpr->REG(bp)); + SE_TRACE(SE_TRACE_DEBUG, "xax = %#lx\t", gpr->REG(ax)); + SE_TRACE(SE_TRACE_DEBUG, "xip = %#lx\t", gpr->REG(ip)); + SE_TRACE(SE_TRACE_DEBUG, "xflags = %#lx\t", gpr->REG(flags)); + SE_TRACE(SE_TRACE_DEBUG, "xsp = %#lx\t", gpr->REG(sp)); +} + +static void dump_regs(struct user_regs_struct *regs) __attribute__((unused)); +void dump_regs(struct user_regs_struct *regs) +{ + SE_TRACE(SE_TRACE_DEBUG, "user regisers:\n"); + SE_TRACE(SE_TRACE_DEBUG, "xbx = %#x\t", regs->REG(bx)); + SE_TRACE(SE_TRACE_DEBUG, "xcx = %#x\t", regs->REG(cx)); + SE_TRACE(SE_TRACE_DEBUG, "xdx = %#x\t", regs->REG(dx)); + SE_TRACE(SE_TRACE_DEBUG, "xsi = %#x\t", regs->REG(si)); + SE_TRACE(SE_TRACE_DEBUG, "xdi = %#x\t", regs->REG(di)); + SE_TRACE(SE_TRACE_DEBUG, "xbp = %#x\t", regs->REG(bp)); + SE_TRACE(SE_TRACE_DEBUG, "xax = %#x\t", regs->REG(ax)); + SE_TRACE(SE_TRACE_DEBUG, "xip = %#x\t", regs->REG(ip)); + SE_TRACE(SE_TRACE_DEBUG, "xflags = %#x\t", regs->eflags); + SE_TRACE(SE_TRACE_DEBUG, "xsp = %#x\t", regs->REG(sp)); +} + +#else + +#define dump_ssa_gregs(gpr) +#define dump_regs(regs) + +#endif + +#ifdef __x86_64__ +static int get_exec_class(pid_t pid) +{ + char filename[64]; + int fd = -1; + unsigned char e_ident[EI_NIDENT]; + + snprintf(filename, 64, "/proc/%d/exe", pid); + fd = open(filename, O_RDONLY | O_LARGEFILE); + if(fd == -1) + return ELFCLASSNONE; + if(-1 == read(fd, e_ident, EI_NIDENT)) + { + return ELFCLASSNONE; + } + + close(fd); + + return e_ident[EI_CLASS]; +} +#endif + +static inline uint32_t get_ssa_frame_size(pid_t pid, thread_data_t* td) +{ + uint32_t ssa_frame_size = td->ssa_frame_size; +#ifdef __x86_64__ + //on x64, we may debug elf32 enclave, we need refer to different offset in td field. + if(ELFCLASS32 == get_exec_class(pid)) + { + ssa_frame_size = *GET_PTR(uint32_t, td, ELF32_SSA_FS_OFFSET); + } +#else + UNUSED(pid); +#endif + + //When debug trts, ssa_frame_size in TD is not initialized, so the value will be 0. + //It is a limitation to debug trts. As work around, the default size is 1 page, so + //we can debug enclave from the start of enclave_entry. + if(0 == ssa_frame_size) + ssa_frame_size = 1; + + return ssa_frame_size; +} + +/* + *This function get the position/offset with SSA + * @pid, process id + * @tcs_addr, TCS start address + * @dir, calculate the position from start of SSA or from the end of SSA + * @offset, offset from the start + * @size, size of data from the postion that is going to be accessed + * @pos, the result of postion that the function output + * @return, TRUE on success, FALSE on fail. The result is copied to parameter pos + * */ +static int get_ssa_pos(pid_t pid, long tcs_addr, direction_t dir, long offset, long size, long *pos) +{ + tcs_t tcs; + thread_data_t td; + uint32_t ssa_frame_size = 0; + long addr = 0; + + //read TCS; + if(!se_read_process_mem(pid, (void *)tcs_addr, (void *)&tcs, 72, NULL)) + return FALSE; + + //Align with RTS. We assume TD is next to TCS + long ssa_start = tcs_addr + TCS_SIZE; + //ossa point to the start address of SSA, and fs/gs point to the start address of TD. + long td_start = ssa_start - tcs.ossa + tcs.ofs_base; + //Read thread data; On x64, sizeof(thread_data_t) of elf64 is larger than elf32, + //so it won't miss any field if it is elf32 executable; + if(!se_read_process_mem(pid, (void *)td_start, (void *)&td, sizeof(thread_data_t), NULL)) + return FALSE; + ssa_frame_size = get_ssa_frame_size(pid, &td); + //The request should not exceed ssa frame boundary. + if((offset + size) > (long)ssa_frame_size * SE_PAGE_SIZE) + return FALSE; + + assert(tcs.cssa > 0); + //If it is required to calculate from the start of SSA + if(FORWARD == dir) + { + addr = ssa_start + (tcs.cssa - 1) * ssa_frame_size * SE_PAGE_SIZE + offset; + + } + //If it is required to calculate from the end of SSA + else if(BACKWARD == dir) + { + addr = ssa_start + tcs.cssa * ssa_frame_size * SE_PAGE_SIZE - offset; + } + else + return FALSE; + + *pos = addr; + return TRUE; +} + +static inline int read_ssa(pid_t pid, long tcs_addr, direction_t dir, long offset, long size, void *buf) +{ + long addr = 0; + + if(!get_ssa_pos(pid, tcs_addr, dir, offset, size, &addr)) + return FALSE; + + //read the content of ssa + if(!se_read_process_mem(pid, (void *)addr, buf, size, NULL)) + return FALSE; + + return TRUE; +} + +static inline int write_ssa(pid_t pid, long tcs_addr, direction_t dir, long offset, long size, void *buf) +{ + long addr = 0; + + if(!get_ssa_pos(pid, tcs_addr, dir, offset, size, &addr)) + return FALSE; + + //write the content of ssa + if(!se_write_process_mem(pid, (void *)addr, buf, size, NULL)) + return FALSE; + + return TRUE; +} + +static inline int get_ssa_gpr(pid_t pid, long tcs_addr, ssa_gpr_t* gpr) +{ + //read general registers. ssa_gpr_t is elf32/elf64 independent. + return read_ssa(pid, tcs_addr, BACKWARD, sizeof(ssa_gpr_t), sizeof(ssa_gpr_t), (void *)gpr); +} + +static inline int set_ssa_gpr(pid_t pid, long tcs_addr, ssa_gpr_t* gpr) +{ + //read general registers. ssa_gpr_t is elf32/elf64 independent. + return write_ssa(pid, tcs_addr, BACKWARD, sizeof(ssa_gpr_t), sizeof(ssa_gpr_t), (void *)gpr); +} + +static inline int get_ssa_fpregs(pid_t pid, long tcs_addr, struct user_fpregs_struct* fpregs) +{ + return read_ssa(pid, tcs_addr, FORWARD, 0, sizeof(struct user_fpregs_struct), (void *)fpregs); +} + +static inline int set_ssa_fpregs(pid_t pid, long tcs_addr, struct user_fpregs_struct* fpregs) +{ + return write_ssa(pid, tcs_addr, FORWARD, 0, sizeof(struct user_fpregs_struct), (void *)fpregs); +} + +#if !defined(__x86_64__) && !defined(__x86_64) +static inline int get_ssa_fpxregs(pid_t pid, long tcs_addr, struct user_fpxregs_struct* fpxregs) +{ + return read_ssa(pid, tcs_addr, FORWARD, 0, sizeof(struct user_fpxregs_struct), (void *)fpxregs); +} + +static inline int set_ssa_fpxregs(pid_t pid, long tcs_addr, struct user_fpxregs_struct* fpxregs) +{ + return write_ssa(pid, tcs_addr, FORWARD, 0, sizeof(struct user_fpxregs_struct), (void *)fpxregs); +} +#else +#define get_ssa_fpxregs get_ssa_fpregs +#define set_ssa_fpxregs set_ssa_fpregs +#define user_fpxregs_struct user_fpregs_struct +#endif + +static inline int get_ssa_xstate(pid_t pid, long tcs_addr, int len, char *buf) +{ + return read_ssa(pid, tcs_addr, FORWARD, 0, len, buf); +} + +static inline int set_ssa_xstate(pid_t pid, long tcs_addr, int len, char *buf) +{ + return write_ssa(pid, tcs_addr, FORWARD, 0, len, buf); +} + +static int get_enclave_gregs(pid_t pid, struct user_regs_struct *regs, long tcs_addr) +{ + ssa_gpr_t gpr; + if(!get_ssa_gpr(pid, tcs_addr, &gpr)) + return -1; + + //convert gpr to user_regs_struct. + SSA2USER_REG(regs, gpr, bx); + SSA2USER_REG(regs, gpr, cx); + SSA2USER_REG(regs, gpr, dx); + SSA2USER_REG(regs, gpr, si); + SSA2USER_REG(regs, gpr, di); + SSA2USER_REG(regs, gpr, bp); + SSA2USER_REG(regs, gpr, ax); + SSA2USER_REG(regs, gpr, ip); + regs->eflags = gpr.REG(flags); + SSA2USER_REG(regs, gpr, sp); +#ifdef __x86_64__ + SSA2USER_REG(regs, gpr, 8); + SSA2USER_REG(regs, gpr, 9); + SSA2USER_REG(regs, gpr, 10); + SSA2USER_REG(regs, gpr, 11); + SSA2USER_REG(regs, gpr, 12); + SSA2USER_REG(regs, gpr, 13); + SSA2USER_REG(regs, gpr, 14); + SSA2USER_REG(regs, gpr, 15); +#endif + return 0; +} + +static int set_enclave_gregs(pid_t pid, struct user_regs_struct *regs, long tcs_addr) +{ + ssa_gpr_t gpr; + + //Since there is some field won't be written, we need save it first + if(!get_ssa_gpr(pid, tcs_addr, &gpr)) + return -1; + + //convert gpr to user_regs_struct. + USER_REG2SSA(gpr, regs, bx); + USER_REG2SSA(gpr, regs, cx); + USER_REG2SSA(gpr, regs, dx); + USER_REG2SSA(gpr, regs, si); + USER_REG2SSA(gpr, regs, di); + USER_REG2SSA(gpr, regs, bp); + USER_REG2SSA(gpr, regs, ax); + USER_REG2SSA(gpr, regs, ip); + gpr.REG(flags) = regs->eflags; + USER_REG2SSA(gpr, regs, sp); +#ifdef __x86_64__ + USER_REG2SSA(gpr, regs, 8); + USER_REG2SSA(gpr, regs, 9); + USER_REG2SSA(gpr, regs, 10); + USER_REG2SSA(gpr, regs, 11); + USER_REG2SSA(gpr, regs, 12); + USER_REG2SSA(gpr, regs, 13); + USER_REG2SSA(gpr, regs, 14); + USER_REG2SSA(gpr, regs, 15); +#endif + + //write general registers to ssa + if(!set_ssa_gpr(pid, tcs_addr, &gpr)) + return -1; + + return 0; +} + +static int is_eresume(pid_t pid, struct user_regs_struct *regs) +{ + unsigned int instr; + + if(!se_read_process_mem(pid, (void *)regs->REG(ip), (char *)&instr, sizeof(instr), NULL)) + return FALSE; + if((ENCLU == (instr & 0xffffff)) + && (SE_ERESUME == regs->REG(ax))) + return TRUE; + return FALSE; +} + +static long int get_regs(pid_t pid, void* addr, void* data) +{ + int ret = 0; + + if(!data) + return -1; + struct user_regs_struct *regs = (struct user_regs_struct *)data; + if(-1 == (ret = g_sys_ptrace(PTRACE_GETREGS, pid, addr, data))) + return -1; + if(is_eresume(pid, regs)) + { + //If it is ERESUME instruction, set the real register value + if(-1 == get_enclave_gregs(pid, regs, regs->REG(bx))) + return -1; + else + { + return ret; + } + } + + return ret; +} + +static long int set_regs(pid_t pid, void* addr, void* data) +{ + int ret = 0; + struct user_regs_struct aep_regs; + + if(!data) + return -1; + if(-1 == g_sys_ptrace(PTRACE_GETREGS, pid, 0, (void*)&aep_regs)) + return -1; + if(is_eresume(pid, &aep_regs)) + { + struct user_regs_struct *regs = (struct user_regs_struct *)data; + //get tcs address + if(-1 == (ret = set_enclave_gregs(pid, regs, aep_regs.REG(bx)))) + return -1; + else + return ret; + } + else + { + return g_sys_ptrace(PTRACE_SETREGS, pid, addr, data); + } +} + +static long int get_fpregs(pid_t pid, void* addr, void* data, int extend) +{ + int ret = 0; + + if(!data) + return -1; + struct user_regs_struct regs; + if(-1 == (ret = g_sys_ptrace(PTRACE_GETREGS, pid, 0, ®s))) + return -1; + if(is_eresume(pid, ®s)) + { + if(extend) + ret = get_ssa_fpxregs(pid, regs.REG(bx), (struct user_fpxregs_struct *)data); + else + ret = get_ssa_fpregs(pid, regs.REG(bx), (struct user_fpregs_struct *)data); + if(ret) + return 0; + else + return -1; + } + else + { + return g_sys_ptrace(PTRACE_GETFPREGS, pid, addr, data); + } +} + +static long int set_fpregs(pid_t pid, void* addr, void* data, int extend) +{ + int ret = 0; + + if(!data) + return -1; + struct user_regs_struct regs; + if(-1 == (ret = g_sys_ptrace(PTRACE_GETREGS, pid, 0, ®s))) + return -1; + if(is_eresume(pid, ®s)) + { + if(extend) + ret = set_ssa_fpxregs(pid, regs.REG(bx), (struct user_fpxregs_struct *)data); + else + ret = set_ssa_fpregs(pid, regs.REG(bx), (struct user_fpregs_struct *)data); + if(ret) + return 0; + else + return -1; + } + else + { + return g_sys_ptrace(PTRACE_GETFPREGS, pid, addr, data); + } +} + +static long int get_regset(pid_t pid, void* addr, void* data) +{ + int ret = 0; + unsigned long type = (unsigned long)addr; + + if(!data) + return -1; + struct user_regs_struct regs; + if(-1 == (ret = g_sys_ptrace(PTRACE_GETREGS, pid, 0, ®s))) + return -1; + + if(is_eresume(pid, ®s)) + { + if(NT_X86_XSTATE != type) + { + SE_TRACE(SE_TRACE_WARNING, "unexpected type for PTRACE_GETREGSET\n"); + return -1; + } + struct iovec *iov = (struct iovec *)data; + if(iov->iov_base && iov->iov_len + && get_ssa_xstate(pid, regs.REG(bx), iov->iov_len, (char *)iov->iov_base)) + { + return 0; + } + else + return -1; + } + else + { + return g_sys_ptrace(PTRACE_GETREGSET, pid, addr, data); + } +} + +static long int set_regset(pid_t pid, void* addr, void* data) +{ + int ret = 0; + unsigned long type = (unsigned long)addr; + + if(!data) + return -1; + struct user_regs_struct regs; + if(-1 == (ret = g_sys_ptrace(PTRACE_GETREGS, pid, 0, ®s))) + return -1; + + if(is_eresume(pid, ®s)) + { + if(NT_X86_XSTATE != type) + { + SE_TRACE(SE_TRACE_WARNING, "unexpected type for PTRACE_SETREGSET\n"); + return -1; + } + struct iovec *iov = (struct iovec *)data; + if(iov->iov_base && iov->iov_len + && set_ssa_xstate(pid, regs.REG(bx), iov->iov_len, (char *)iov->iov_base)) + { + return 0; + } + else + return -1; + } + else + { + return g_sys_ptrace(PTRACE_SETREGSET, pid, addr, data); + } +} + +long int ptrace (enum __ptrace_request __request, ...) +{ + pid_t pid; + void *addr, *data; + va_list ap; + + va_start(ap, __request); + pid = va_arg(ap, pid_t); + addr = va_arg(ap, void *); + data = va_arg(ap, void *); + va_end(ap); + + if(__request == PTRACE_GETREGS) + { + return get_regs(pid, addr, data); + } + else if(__request == PTRACE_SETREGS) + { + return set_regs(pid, addr, data); + } +#if 0 + //some old system may require this command to get register + else if(__request == PTRACE_PEEKUSER) + { + + } +#endif + else if(__request == PTRACE_GETFPREGS) + { + return get_fpregs(pid, addr, data, FALSE); + } + else if(__request == PTRACE_SETFPREGS) + { + return set_fpregs(pid, addr, data, FALSE); + + } + else if(__request == PTRACE_GETFPXREGS) + { + return get_fpregs(pid, addr, data, TRUE); + } + else if(__request == PTRACE_SETFPXREGS) + { + return set_fpregs(pid, addr, data, TRUE); + } + + //xstave for avx + else if(__request == PTRACE_GETREGSET) + { + return get_regset(pid, addr, data); + } + else if(__request == PTRACE_SETREGSET) + { + return set_regset(pid, addr, data); + } + //For other request just forward it to real ptrace call; + return g_sys_ptrace(__request, pid, addr, data); +} diff --git a/sdk/ec_dh_lib/Makefile b/sdk/ec_dh_lib/Makefile new file mode 100644 index 0000000000..f552dcd72a --- /dev/null +++ b/sdk/ec_dh_lib/Makefile @@ -0,0 +1,67 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR := ../.. +include $(TOP_DIR)/buildenv.mk + +CFLAGS += -Werror +CXXFLAGS += -Werror + +INCLUDE += -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc + +vpath %.cpp $(COMMON_DIR)/src + +CXXFLAGS += -fno-exceptions -fno-rtti $(ENCLAVE_CXXFLAGS) + +SRC := ec_dh.cpp \ + ecp.cpp + +OBJ := $(SRC:.cpp=.o) + +LIBNAME := libsgx_dh.a + +.PHONY: all + +all: $(OBJ) + $(AR) rcs $(LIBNAME) $^ + +$(OBJ): %.o :%.cpp + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ + +.PHONY: clean +clean: + @$(RM) *.o + @$(RM) $(LIBNAME) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/ec_dh_lib/ec_dh.cpp b/sdk/ec_dh_lib/ec_dh.cpp new file mode 100644 index 0000000000..11b39a0bfc --- /dev/null +++ b/sdk/ec_dh_lib/ec_dh.cpp @@ -0,0 +1,821 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "stdlib.h" +#include "string.h" +#include "sgx.h" +#include "sgx_defs.h" +#include "sgx_utils.h" +#include "sgx_ecp_types.h" +#include "sgx_key.h" +#include "sgx_report.h" +#include "sgx_attributes.h" +#include "sgx_trts.h" +#include "ecp_interface.h" +#include "sgx_dh_internal.h" + +#define NONCE_SIZE 16 +#define MSG_BUF_LEN (static_cast(sizeof(sgx_ec256_public_t)*2)) +#define MSG_HASH_SZ 32 + +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} +#endif + +static sgx_status_t verify_cmac128( + const sgx_ec_key_128bit_t mac_key, + const uint8_t* data_buf, + uint32_t buf_size, + const uint8_t* mac_buf) +{ + uint8_t data_mac[SGX_CMAC_MAC_SIZE]; + sgx_status_t se_ret = SGX_SUCCESS; + + if(!data_buf || !mac_buf || !mac_key) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + se_ret = sgx_rijndael128_cmac_msg((const sgx_cmac_128bit_key_t*)mac_key, + data_buf, + buf_size, + (sgx_cmac_128bit_tag_t *)data_mac); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + if(consttime_memequal(mac_buf, data_mac, SGX_CMAC_MAC_SIZE) == 0) + { + return SGX_ERROR_MAC_MISMATCH; + } + + return se_ret; +} + +static sgx_status_t dh_generate_message1(sgx_dh_msg1_t *msg1, sgx_internal_dh_session_t *context) +{ + sgx_report_t temp_report; + sgx_report_data_t report_data = {{0}}; + sgx_target_info_t target; + sgx_status_t se_ret; + sgx_ecc_state_handle_t ecc_state = NULL; + + if(!msg1 || !context) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + memset(&temp_report, 0, sizeof(temp_report)); + memset(&target, 0, sizeof(target)); + + //Create Report to get target info which targeted towards the initiator of the session + se_ret = sgx_create_report(&target, &report_data,&temp_report); + if(se_ret != SGX_SUCCESS) + { + return se_ret; + } + + memcpy(&msg1->target.mr_enclave, + &temp_report.body.mr_enclave, + sizeof(sgx_measurement_t)); + memcpy(&msg1->target.attributes, + &temp_report.body.attributes, + sizeof(sgx_attributes_t)); + msg1->target.misc_select = temp_report.body.misc_select; + + //Initialize ECC context to prepare for creating key pair + se_ret = sgx_ecc256_open_context(&ecc_state); + if(se_ret != SGX_SUCCESS) + { + return se_ret; + } + //Generate the public key private key pair for Session Responder + se_ret = sgx_ecc256_create_key_pair((sgx_ec256_private_t*)&context->responder.prv_key, + (sgx_ec256_public_t*)&context->responder.pub_key, + ecc_state); + if(se_ret != SGX_SUCCESS) + { + sgx_ecc256_close_context(ecc_state); + return se_ret; + } + + //Copying public key to g^a + memcpy(&msg1->g_a, + &context->responder.pub_key, + sizeof(sgx_ec256_public_t)); + + se_ret = sgx_ecc256_close_context(ecc_state); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + return SGX_SUCCESS; +} + +static sgx_status_t dh_generate_message2(const sgx_dh_msg1_t *msg1, + const sgx_ec256_public_t *g_b, + const sgx_key_128bit_t *dh_smk, + sgx_dh_msg2_t *msg2) +{ + sgx_report_t temp_report; + sgx_report_data_t report_data; + + sgx_status_t se_ret; + + uint8_t msg_buf[MSG_BUF_LEN] = {0}; + uint8_t msg_hash[MSG_HASH_SZ] = {0}; + + if(!msg1 || !g_b || !dh_smk || !msg2) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + memset(msg2, 0, sizeof(sgx_dh_msg2_t)); + memcpy(&msg2->g_b, g_b, sizeof(sgx_ec256_public_t)); + + memcpy(msg_buf, + &msg1->g_a, + sizeof(sgx_ec256_public_t)); + memcpy(msg_buf + sizeof(sgx_ec256_public_t), + &msg2->g_b, + sizeof(sgx_ec256_public_t)); + + se_ret = sgx_sha256_msg(msg_buf, + MSG_BUF_LEN, + (sgx_sha256_hash_t *)msg_hash); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + // Get REPORT with sha256(msg1->g_a | msg2->g_b) || kdf_id as user data + // 2-byte little-endian KDF-ID: 0x0001 AES-CMAC Entropy Extraction and Key Derivation + memset(&report_data, 0, sizeof(sgx_report_data_t)); + memcpy(&report_data, &msg_hash, sizeof(msg_hash)); + + uint16_t *kdf_id = (uint16_t *)&report_data.d[sizeof(msg_hash)]; + *kdf_id = AES_CMAC_KDF_ID; + + // Generate Report targeted towards Session Responder + se_ret = sgx_create_report(&msg1->target, &report_data, &temp_report); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + memcpy(&msg2->report, &temp_report, sizeof(sgx_report_t)); + + //Calculate the MAC for Message 2 + se_ret = sgx_rijndael128_cmac_msg(dh_smk, + (uint8_t *)(&msg2->report), + sizeof(sgx_report_t), + (sgx_cmac_128bit_tag_t *)msg2->cmac); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + return SGX_SUCCESS; +} + +static sgx_status_t dh_verify_message2(const sgx_dh_msg2_t *msg2, + const sgx_ec256_public_t *g_a, + const sgx_key_128bit_t *dh_smk) +{ + sgx_report_t temp_report; + sgx_status_t se_ret; + + uint8_t msg_buf[MSG_BUF_LEN] = {0}; + uint8_t msg_hash[MSG_HASH_SZ] = {0}; + + if(!msg2 || !g_a || !dh_smk) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + /* report_data = SHA256(g_a || g_b) || kdf_id + * Verify kdf_id first. + * 2-byte little-endian KDF-ID: 0x0001 AES-CMAC Entropy Extraction and Key Derivation + */ + uint16_t *kdf_id = (uint16_t *)&msg2->report.body.report_data.d[sizeof(msg_hash)]; + if (*kdf_id != AES_CMAC_KDF_ID) + { + return SGX_ERROR_KDF_MISMATCH; + } + + //Verify the MAC of message 2 obtained from the Session Initiator + se_ret = verify_cmac128((const uint8_t*)dh_smk, (const uint8_t*)(&msg2->report), sizeof(sgx_report_t), msg2->cmac); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + memcpy(&temp_report,&msg2->report,sizeof(sgx_report_t)); + + // Verify message 2 report obtained from the Session Initiator + se_ret = sgx_verify_report(&temp_report); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + memcpy(msg_buf, g_a, sizeof(sgx_ec256_public_t)); + memcpy(msg_buf + sizeof(sgx_ec256_public_t), &msg2->g_b, sizeof(sgx_ec256_public_t)); + + se_ret = sgx_sha256_msg(msg_buf, + MSG_BUF_LEN, + (sgx_sha256_hash_t *)msg_hash); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + // report_data = SHA256(g_a || g_b) || kdf_id + // Verify SHA256(g_a || g_b) + if (0 != memcmp(msg_hash, + &msg2->report.body.report_data, + sizeof(msg_hash))) + { + return SGX_ERROR_MAC_MISMATCH; + } + + return SGX_SUCCESS; +} + +static sgx_status_t dh_generate_message3(const sgx_dh_msg2_t *msg2, + const sgx_ec256_public_t *g_a, + const sgx_key_128bit_t *dh_smk, + sgx_dh_msg3_t *msg3, + uint32_t msg3_additional_prop_len) +{ + sgx_report_t temp_report; + sgx_report_data_t report_data; + sgx_status_t se_ret = SGX_SUCCESS; + uint32_t maced_size; + + uint8_t msg_buf[MSG_BUF_LEN] = {0}; + uint8_t msg_hash[MSG_HASH_SZ] = {0}; + + sgx_target_info_t target; + + if(!msg2 || !g_a || !dh_smk || !msg3) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + maced_size = static_cast(sizeof(sgx_dh_msg3_body_t)) + msg3_additional_prop_len; + + memset(msg3, 0, sizeof(sgx_dh_msg3_t)); // Don't clear the additional property since the content of the property is provided by caller. + + memcpy(msg_buf, &msg2->g_b, sizeof(sgx_ec256_public_t)); + memcpy(msg_buf + sizeof(sgx_ec256_public_t), g_a, sizeof(sgx_ec256_public_t)); + + se_ret = sgx_sha256_msg(msg_buf, + MSG_BUF_LEN, + (sgx_sha256_hash_t *)msg_hash); + if(se_ret != SGX_SUCCESS) + { + return se_ret; + } + + memset(&target, 0, sizeof(sgx_target_info_t)); + + // Get REPORT with SHA256(g_b||g_a) as user data + memset(&report_data, 0, sizeof(sgx_report_data_t)); + memcpy(&report_data, &msg_hash, sizeof(msg_hash)); + + memcpy(&target.attributes, + &msg2->report.body.attributes, + sizeof(sgx_attributes_t)); + memcpy(&target.mr_enclave, + &msg2->report.body.mr_enclave, + sizeof(sgx_measurement_t)); + target.misc_select = msg2->report.body.misc_select; + + // Generate Report targeted towards Session Initiator + se_ret = sgx_create_report(&target, &report_data, &temp_report); + if(se_ret != SGX_SUCCESS) + { + return se_ret; + } + + memcpy(&msg3->msg3_body.report, + &temp_report, + sizeof(sgx_report_t)); + + msg3->msg3_body.additional_prop_length = msg3_additional_prop_len; + + //Calculate the MAC for Message 3 + se_ret = sgx_rijndael128_cmac_msg(dh_smk, + (uint8_t *)&msg3->msg3_body, + maced_size, + (sgx_cmac_128bit_tag_t *)msg3->cmac); + if(se_ret != SGX_SUCCESS) + { + return se_ret; + } + + return SGX_SUCCESS; +} + +static sgx_status_t dh_verify_message3(const sgx_dh_msg3_t *msg3, + const sgx_ec256_public_t *g_a, + const sgx_ec256_public_t *g_b, + const sgx_key_128bit_t *dh_smk) +{ + sgx_report_t temp_report; + uint32_t maced_size; + sgx_status_t se_ret; + + uint8_t msg_buf[MSG_BUF_LEN] = {0}; + uint8_t msg_hash[MSG_HASH_SZ] = {0}; + + if(!msg3 || !g_a || !g_b || !dh_smk) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + maced_size = static_cast(sizeof(sgx_dh_msg3_body_t)) + msg3->msg3_body.additional_prop_length; + + //Verify the MAC of message 3 obtained from the Session Responder + se_ret = verify_cmac128((const uint8_t*)dh_smk, (const uint8_t*)&msg3->msg3_body, maced_size, msg3->cmac); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + memcpy(&temp_report, &msg3->msg3_body.report, sizeof(sgx_report_t)); + + // Verify message 3 report + se_ret = sgx_verify_report(&temp_report); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + memcpy(msg_buf, + g_b, + sizeof(sgx_ec256_public_t)); + memcpy(msg_buf + sizeof(sgx_ec256_public_t), + g_a, + sizeof(sgx_ec256_public_t)); + + se_ret = sgx_sha256_msg(msg_buf, + MSG_BUF_LEN, + (sgx_sha256_hash_t *)msg_hash); + if(SGX_SUCCESS != se_ret) + { + return se_ret; + } + + // Verify message 3 report data + if (0 != memcmp(msg_hash, + &msg3->msg3_body.report.body.report_data, + sizeof(msg_hash))) + { + return SGX_ERROR_MAC_MISMATCH; + } + + return SGX_SUCCESS; +} + +// sgx_status_t sgx_dh_init_session() +// @role indicates whether the caller is a Initiator (starting the session negotiation) or a Responder (responding to the intial session negotiation request). +// @sgx_dh_session is the context of the session. +sgx_status_t sgx_dh_init_session(sgx_dh_session_role_t role, sgx_dh_session_t* sgx_dh_session) +{ + sgx_internal_dh_session_t* session = (sgx_internal_dh_session_t*)sgx_dh_session; + + if(!session || 0 == sgx_is_within_enclave(session, sizeof(sgx_internal_dh_session_t))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + if(SGX_DH_SESSION_INITIATOR != role && SGX_DH_SESSION_RESPONDER != role) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + + if(SGX_DH_SESSION_INITIATOR == role) + { + session->initiator.state = SGX_DH_SESSION_INITIATOR_WAIT_M1; + } + else + { + session->responder.state = SGX_DH_SESSION_STATE_RESET; + } + + session->role = role; + + return SGX_SUCCESS; +} + + +// Function sgx_dh_responder_gen_msg1 generates M1 message and makes update to the context of the session. +sgx_status_t sgx_dh_responder_gen_msg1(sgx_dh_msg1_t* msg1, sgx_dh_session_t* sgx_dh_session) +{ + sgx_status_t se_ret; + sgx_internal_dh_session_t* session = (sgx_internal_dh_session_t*)sgx_dh_session; + + // validate session + if(!session || + 0 == sgx_is_within_enclave(session, sizeof(sgx_internal_dh_session_t))) // session must be in enclave + { + return SGX_ERROR_INVALID_PARAMETER; + } + + if(!msg1 || + 0 == sgx_is_within_enclave(msg1, sizeof(sgx_dh_msg1_t)) || + SGX_DH_SESSION_RESPONDER != session->role) + { + se_ret = SGX_ERROR_INVALID_PARAMETER; + goto error; + } + + if(SGX_DH_SESSION_STATE_RESET != session->responder.state) + { + se_ret = SGX_ERROR_INVALID_STATE; + goto error; + } + + se_ret = dh_generate_message1(msg1, session); + if(SGX_SUCCESS != se_ret) + { + // return selected error to upper layer + INTERNAL_SGX_ERROR_CODE_CONVERTOR(se_ret) + goto error; + } + + session->responder.state = SGX_DH_SESSION_RESPONDER_WAIT_M2; + + return SGX_SUCCESS; +error: + // clear session + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->responder.state = SGX_DH_SESSION_STATE_ERROR; + return se_ret; +} + +//sgx_dh_initiator_proc_msg1 processes M1 message, generates M2 message and makes update to the context of the session. +sgx_status_t sgx_dh_initiator_proc_msg1(const sgx_dh_msg1_t* msg1, sgx_dh_msg2_t* msg2, sgx_dh_session_t* sgx_dh_session) +{ + sgx_status_t se_ret; + + sgx_ec256_public_t pub_key; + sgx_ec256_private_t priv_key; + sgx_ec256_dh_shared_t shared_key; + sgx_key_128bit_t dh_smk; + + sgx_internal_dh_session_t* session = (sgx_internal_dh_session_t*) sgx_dh_session; + + // validate session + if(!session || + 0 == sgx_is_within_enclave(session, sizeof(sgx_internal_dh_session_t))) // session must be in enclave + { + return SGX_ERROR_INVALID_PARAMETER; + } + + if( !msg1 || + !msg2 || + 0 == sgx_is_within_enclave(msg1, sizeof(sgx_dh_msg1_t)) || + 0 == sgx_is_within_enclave(msg2, sizeof(sgx_dh_msg2_t)) || + SGX_DH_SESSION_INITIATOR != session->role) + { + // clear secret when encounter error + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_INVALID_PARAMETER; + } + + if(SGX_DH_SESSION_INITIATOR_WAIT_M1 != session->initiator.state) + { + // clear secret + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_INVALID_STATE; + } + + //create ECC context + sgx_ecc_state_handle_t ecc_state = NULL; + se_ret = sgx_ecc256_open_context(&ecc_state); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + // generate private key and public key + se_ret = sgx_ecc256_create_key_pair((sgx_ec256_private_t*)&priv_key, + (sgx_ec256_public_t*)&pub_key, + ecc_state); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + //generate shared_key + se_ret = sgx_ecc256_compute_shared_dhkey( + (sgx_ec256_private_t *)const_cast(&priv_key), + (sgx_ec256_public_t *)const_cast(&msg1->g_a), + (sgx_ec256_dh_shared_t *)&shared_key, + ecc_state); + + // clear private key for defense in depth + memset_s(&priv_key, sizeof(sgx_ec256_private_t), 0, sizeof(sgx_ec256_private_t)); + + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + se_ret = derive_key(&shared_key, "SMK", (uint32_t)(sizeof("SMK") -1), &dh_smk); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + se_ret = dh_generate_message2(msg1, &pub_key, &dh_smk, msg2); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + memcpy(&session->initiator.pub_key, &pub_key, sizeof(sgx_ec256_public_t)); + memcpy(&session->initiator.peer_pub_key, &msg1->g_a, sizeof(sgx_ec256_public_t)); + memcpy(&session->initiator.smk_aek, &dh_smk, sizeof(sgx_key_128bit_t)); + memcpy(&session->initiator.shared_key, &shared_key, sizeof(sgx_ec256_dh_shared_t)); + // clear shared key and SMK + memset_s(&shared_key, sizeof(sgx_ec256_dh_shared_t), 0, sizeof(sgx_ec256_dh_shared_t)); + memset_s(&dh_smk, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + + if(SGX_SUCCESS != sgx_ecc256_close_context(ecc_state)) + { + // clear session + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + // set error state + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_UNEXPECTED; + } + + session->initiator.state = SGX_DH_SESSION_INITIATOR_WAIT_M3; + return SGX_SUCCESS; + +error: + sgx_ecc256_close_context(ecc_state); + + // clear shared key and SMK + memset_s(&shared_key, sizeof(sgx_ec256_dh_shared_t), 0, sizeof(sgx_ec256_dh_shared_t)); + memset_s(&dh_smk, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + + // return selected error to upper layer + INTERNAL_SGX_ERROR_CODE_CONVERTOR(se_ret) + + return se_ret; +} + +//sgx_dh_responder_proc_msg2 processes M2 message, generates M3 message, and returns the session key AEK. +sgx_status_t sgx_dh_responder_proc_msg2(const sgx_dh_msg2_t* msg2, + sgx_dh_msg3_t* msg3, + sgx_dh_session_t* sgx_dh_session, + sgx_key_128bit_t* aek, + sgx_dh_session_enclave_identity_t* initiator_identity) +{ + sgx_status_t se_ret; + + sgx_ec256_dh_shared_t shared_key; + sgx_key_128bit_t dh_smk; + + sgx_internal_dh_session_t* session = (sgx_internal_dh_session_t*)sgx_dh_session; + + // validate session + if(!session || + 0 == sgx_is_within_enclave(session, sizeof(sgx_internal_dh_session_t))) // session must be in enclave + { + return SGX_ERROR_INVALID_PARAMETER; + } + + if(!msg3 || + msg3->msg3_body.additional_prop_length > (UINT_MAX - sizeof(sgx_dh_msg3_t)) || // check msg3 length overflow + 0 == sgx_is_within_enclave(msg3, (sizeof(sgx_dh_msg3_t)+msg3->msg3_body.additional_prop_length)) || // must be in enclave + !msg2 || + 0 == sgx_is_within_enclave(msg2, sizeof(sgx_dh_msg2_t)) || // must be in enclave + !aek || + 0 == sgx_is_within_enclave(aek, sizeof(sgx_key_128bit_t)) || // must be in enclave + !initiator_identity || + 0 == sgx_is_within_enclave(initiator_identity, sizeof(sgx_dh_session_enclave_identity_t)) || // must be in enclave + SGX_DH_SESSION_RESPONDER != session->role) + { + // clear secret when encounter error + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->responder.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_INVALID_PARAMETER; + } + + if(SGX_DH_SESSION_RESPONDER_WAIT_M2 != session->responder.state) // protocol state must be SGX_DH_SESSION_RESPONDER_WAIT_M2 + { + // clear secret + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->responder.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_INVALID_STATE; + } + + //create ECC context, and the ECC parameter is + //NIST standard P-256 elliptic curve. + sgx_ecc_state_handle_t ecc_state = NULL; + se_ret = sgx_ecc256_open_context(&ecc_state); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + //generate shared key, which should be identical with enclave side, + //from PSE private key and enclave public key + se_ret = sgx_ecc256_compute_shared_dhkey((sgx_ec256_private_t *)&session->responder.prv_key, + (sgx_ec256_public_t *)const_cast(&msg2->g_b), + (sgx_ec256_dh_shared_t *)&shared_key, + ecc_state); + + // For defense-in-depth purpose, responder clears its private key from its enclave memory, as it's not needed anymore. + memset_s(&session->responder.prv_key, sizeof(sgx_ec256_private_t), 0, sizeof(sgx_ec256_private_t)); + + if(se_ret != SGX_SUCCESS) + { + goto error; + } + + + //derive keys from session shared key + se_ret = derive_key(&shared_key, "SMK", (uint32_t)(sizeof("SMK") -1), &dh_smk); + if(se_ret != SGX_SUCCESS) + { + goto error; + } + // Verify message 2 from Session Initiator and also Session Initiator's identity + se_ret = dh_verify_message2(msg2, &session->responder.pub_key, &dh_smk); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + initiator_identity->isv_svn = msg2->report.body.isv_svn; + initiator_identity->isv_prod_id = msg2->report.body.isv_prod_id; + memcpy(&initiator_identity->attributes, &msg2->report.body.attributes, sizeof(sgx_attributes_t)); + memcpy(&initiator_identity->mr_signer, &msg2->report.body.mr_signer, sizeof(sgx_measurement_t)); + memcpy(&initiator_identity->mr_enclave, &msg2->report.body.mr_enclave, sizeof(sgx_measurement_t)); + + // Generate message 3 to send back to initiator + se_ret = dh_generate_message3(msg2, + &session->responder.pub_key, + &dh_smk, + msg3, + msg3->msg3_body.additional_prop_length); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + // derive session key + se_ret = derive_key(&shared_key, "AEK", (uint32_t)(sizeof("AEK") -1), aek); + if(se_ret != SGX_SUCCESS) + { + goto error; + } + + // clear secret + memset_s(&shared_key, sizeof(sgx_ec256_dh_shared_t), 0, sizeof(sgx_ec256_dh_shared_t)); + memset_s(&dh_smk, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + // clear session + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + + se_ret = sgx_ecc256_close_context(ecc_state); + if(SGX_SUCCESS != se_ret) + { + // set error state + session->responder.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_UNEXPECTED; + } + + // set state + session->responder.state = SGX_DH_SESSION_ACTIVE; + + return SGX_SUCCESS; + +error: + sgx_ecc256_close_context(ecc_state); + // clear secret + memset_s(&shared_key, sizeof(sgx_ec256_dh_shared_t), 0, sizeof(sgx_ec256_dh_shared_t)); + memset_s(&dh_smk, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + // set error state + session->responder.state = SGX_DH_SESSION_STATE_ERROR; + // return selected error to upper layer + if (se_ret != SGX_ERROR_OUT_OF_MEMORY && + se_ret != SGX_ERROR_KDF_MISMATCH) + { + se_ret = SGX_ERROR_UNEXPECTED; + } + return se_ret; +} + +//sgx_dh_initiator_proc_msg3 processes M3 message, and returns the session key AEK. +sgx_status_t sgx_dh_initiator_proc_msg3(const sgx_dh_msg3_t* msg3, + sgx_dh_session_t* sgx_dh_session, + sgx_key_128bit_t* aek, + sgx_dh_session_enclave_identity_t* responder_identity) +{ + sgx_status_t se_ret; + sgx_internal_dh_session_t* session = (sgx_internal_dh_session_t*)sgx_dh_session; + + // validate session + if(!session || + 0 == sgx_is_within_enclave(session, sizeof(sgx_internal_dh_session_t))) // session must be in enclave + { + return SGX_ERROR_INVALID_PARAMETER; + } + + if(!msg3 || + msg3->msg3_body.additional_prop_length > (UINT_MAX - sizeof(sgx_dh_msg3_t)) || // check msg3 length overflow + 0 == sgx_is_within_enclave(msg3, (sizeof(sgx_dh_msg3_t)+msg3->msg3_body.additional_prop_length)) || // msg3 buffer must be in enclave + !aek || + 0 == sgx_is_within_enclave(aek, sizeof(sgx_key_128bit_t)) || // aek buffer must be in enclave + !responder_identity || + 0 == sgx_is_within_enclave(responder_identity, sizeof(sgx_dh_session_enclave_identity_t)) || // responder_identity buffer must be in enclave + SGX_DH_SESSION_INITIATOR != session->role) // role must be SGX_DH_SESSION_INITIATOR + { + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_INVALID_PARAMETER; + } + + if(SGX_DH_SESSION_INITIATOR_WAIT_M3 != session->initiator.state) // protocol state must be SGX_DH_SESSION_INITIATOR_WAIT_M3 + { + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + return SGX_ERROR_INVALID_STATE; + } + + se_ret = dh_verify_message3(msg3, + &session->initiator.peer_pub_key, + &session->initiator.pub_key, + &session->initiator.smk_aek); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + // derive AEK + se_ret = derive_key(&session->initiator.shared_key, "AEK", (uint32_t)(sizeof("AEK") -1), aek); + if(SGX_SUCCESS != se_ret) + { + goto error; + } + + // clear session + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_ACTIVE; + + // copy the common fields between REPORT and the responder enclave identity + memcpy(responder_identity, &msg3->msg3_body.report.body, sizeof(sgx_dh_session_enclave_identity_t)); + + return SGX_SUCCESS; + +error: + memset_s(session, sizeof(sgx_internal_dh_session_t), 0, sizeof(sgx_internal_dh_session_t)); + session->initiator.state = SGX_DH_SESSION_STATE_ERROR; + INTERNAL_SGX_ERROR_CODE_CONVERTOR(se_ret) + return se_ret; +} + diff --git a/sdk/ec_dh_lib/sgx_dh_internal.h b/sdk/ec_dh_lib/sgx_dh_internal.h new file mode 100644 index 0000000000..66c7af67c9 --- /dev/null +++ b/sdk/ec_dh_lib/sgx_dh_internal.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SGX_DH_INTERNAL_H_ +#define _SGX_DH_INTERNAL_H_ + +#include "sgx.h" +#include "sgx_defs.h" +#include "sgx_ecp_types.h" +#include "sgx_dh.h" + +#pragma pack(push, 1) + +typedef enum _sgx_dh_session_state_t +{ + SGX_DH_SESSION_STATE_ERROR, + SGX_DH_SESSION_STATE_RESET, + SGX_DH_SESSION_RESPONDER_WAIT_M2, + SGX_DH_SESSION_INITIATOR_WAIT_M1, + SGX_DH_SESSION_INITIATOR_WAIT_M3, + SGX_DH_SESSION_ACTIVE +} sgx_dh_session_state_t; + +typedef struct _sgx_dh_responder_t{ + sgx_dh_session_state_t state; /*Responder State Machine State */ + sgx_ec256_private_t prv_key; /* 256bit EC private key */ + sgx_ec256_public_t pub_key; /* 512 bit EC public key */ +} sgx_dh_responder_t; + +typedef struct _sgx_dh_initator_t{ + sgx_dh_session_state_t state; /* Initiator State Machine State */ + union{ + sgx_ec256_private_t prv_key; /* 256bit EC private key */ + sgx_key_128bit_t smk_aek; /* 128bit SMK or AEK. Depending on the State */ + }; + sgx_ec256_public_t pub_key; /* 512 bit EC public key */ + sgx_ec256_public_t peer_pub_key; /* 512 bit EC public key from the Responder */ + sgx_ec256_dh_shared_t shared_key; +} sgx_dh_initator_t; + +typedef struct _sgx_internal_dh_session_t{ + sgx_dh_session_role_t role; /* Initiator or Responder */ + union{ + sgx_dh_responder_t responder; + sgx_dh_initator_t initiator; + }; +} sgx_internal_dh_session_t; + +static_assert(sizeof(sgx_internal_dh_session_t) == SGX_DH_SESSION_DATA_SIZE, "size mismatch on sgx_internal_dh_session_t and sgx_dh_session_t"); + +#pragma pack(pop) + +#endif + + + diff --git a/sdk/edger8r/linux/Ast.ml b/sdk/edger8r/linux/Ast.ml new file mode 100644 index 0000000000..3bc15aae27 --- /dev/null +++ b/sdk/edger8r/linux/Ast.ml @@ -0,0 +1,251 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +(* Available types. *) +type signedness = Signed | Unsigned +type shortness = IShort | ILong | INone + +type int_attr = { + ia_signedness : signedness; + ia_shortness : shortness; +} + +type atype = + | Char of signedness + | Long of signedness + | LLong of signedness + | Int of int_attr + | Float | Double | LDouble + | Int8 | Int16 | Int32 | Int64 + | UInt8 | UInt16 | UInt32 | UInt64 + | Void | WChar | SizeT + | Struct of string + | Union of string + | Enum of string + | Foreign of string + | Ptr of atype + +(* Pointer parameter direction *) +type ptr_direction = + | PtrIn | PtrOut | PtrInOut | PtrNoDirection + +(* It holds possible values for a given attribute. *) +type attr_value = + | AString of string + | ANumber of int + +type ptr_size = { + ps_size : attr_value option; + ps_sizefunc : string option; + ps_count : attr_value option; +} + +let empty_ptr_size = { + ps_size = None; + ps_sizefunc = None; + ps_count = None; +} + +(* Pointers have several special attributes. *) +type ptr_attr = { + pa_direction : ptr_direction; + pa_size : ptr_size; + pa_isptr : bool; (* If a foreign type is a pointer type *) + pa_isary : bool; (* If a foreign type is an array *) + pa_isstr : bool; + pa_iswstr : bool; + pa_rdonly : bool; (* If the pointer is 'const' qualified *) + pa_chkptr : bool; (* Whether to generate code to check pointer *) +} + +(* parameter type *) +type parameter_type = + | PTVal of atype (* Passed by value *) + | PTPtr of atype * ptr_attr (* Passed by address *) + +type call_conv = CC_CDECL | CC_STDCALL | CC_FASTCALL | CC_NONE + +let get_call_conv_str (cc: call_conv) = + match cc with + CC_CDECL -> "CDECL" + | CC_STDCALL -> "STDCALL" + | CC_FASTCALL -> "FASTCALL" + | CC_NONE -> "NOCONVENTION" + +(* function attribute - only for untrusted functions *) +type func_attr = { + fa_dllimport : bool; (* use 'dllimport'? *) + fa_convention: call_conv; (* the calling convention *) +} + +(* A declarator can be an identifier or an identifier with array form. + * For a simlpe identifier, the `array_dims' is an empty list `[]'. + * A dimension with size -1 means that user explicitly declared `ary[]'. + *) +type declarator = { + identifier : string; + array_dims : int list; +} + +let is_array (declr: declarator) = declr.array_dims <> [] + +(* Parameter declaration. *) +type pdecl = parameter_type * declarator + +(* Structure member declaration *) +type mdecl = atype * declarator + +(* Definition of a struct or union *) +type struct_def = { + sname : string; (* structure name. *) + mlist : mdecl list; (* structure members. *) +} + +(* Definition of a enum *) +type enum_val = EnumValNone | EnumVal of attr_value +type enum_ele = string * enum_val + +type enum_def = { + enname: string; (* enum name - "" for anonymous enum *) + enbody: enum_ele list; (* elements of enum *) +} + +(* Composite type - the form for struct/union definition are the same. *) +type composite_type = + StructDef of struct_def + | UnionDef of struct_def + | EnumDef of enum_def + +(* Function declaration. *) +type func_decl = { + fname : string; (* function name. *) + rtype : atype; (* return type. *) + plist : pdecl list; (* parameter list. *) +} + +(* The untrusted functions might have a string list that specifying + * trusted ECALLs possibly to be made. While the trusted functions + * have a bool tag to identify whether it is private or not (private + * means it can only be accessed by an OCALL). + *) +type trusted_func = { + tf_fdecl : func_decl; + tf_is_priv : bool; +} + +type untrusted_func = { + uf_fdecl : func_decl; + uf_fattr : func_attr; + uf_allow_list : string list; + uf_propagate_errno : bool; +} + +type enclave_func = + | Trusted of trusted_func + | Untrusted of untrusted_func + +(* Module import declaration. *) +type import_decl = { + mname : string; (* from which to import functions. *) + flist : string list; (* a list of functions to be imported. *) +} + +(* All valid expressions. *) +type expr = + | Interface of enclave_func list + | Composite of composite_type + | Importing of import_decl + | Include of string + +(* The definition of an Enclave *) +type enclave = { + ename : string; (* enclave name. *) + eexpr : expr list; (* expressions inside enclave. *) +} + +(* ------------------------------------------------------------------- + * Some utility function to manupulate types defined in AST. + * ------------------------------------------------------------------- + *) + +(* Get the string representation of a type. *) +let rec get_tystr (ty: atype) = + match ty with + | Char sn -> + (match sn with + Signed -> "char" + | Unsigned -> "unsigned char") + | Long sn -> + (match sn with + Signed -> "long" + | Unsigned -> "unsigned long") + | LLong sn -> + (match sn with + Signed -> "long long" + | Unsigned -> "unsigned long long") + | Int ia -> + Printf.sprintf "%s%sint" + (if ia.ia_signedness = Unsigned then "unsigned " else "") + (match ia.ia_shortness with + IShort -> "short " + | ILong -> "long " + | INone -> "") + | Float -> "float" + | Double -> "double" + | LDouble -> "long double" + | Int8 -> "int8_t" + | Int16 -> "int16_t" + | Int32 -> "int32_t" + | Int64 -> "int64_t" + | UInt8 -> "uint8_t" + | UInt16 -> "uint16_t" + | UInt32 -> "uint32_t" + | UInt64 -> "uint64_t" + | Void -> "void" + | SizeT -> "size_t" + | WChar -> "wchar_t" + | Struct id -> "struct " ^ id + | Union id -> "union " ^ id + | Enum id -> "enum " ^ id + | Foreign s -> s + | Ptr ty -> get_tystr(ty) ^ "*" + +(* Get the plain `atype' from a `parameter_type'. *) +let get_param_atype (pt: parameter_type) = + match pt with + | PTVal t -> t + | PTPtr (t, _) -> t + +(* Convert attr_value to string *) +let attr_value_to_string (attr: attr_value) = + match attr with + ANumber n -> Printf.sprintf "%d" n + | AString s -> s diff --git a/sdk/edger8r/linux/CodeGen.ml b/sdk/edger8r/linux/CodeGen.ml new file mode 100644 index 0000000000..f7e2074aad --- /dev/null +++ b/sdk/edger8r/linux/CodeGen.ml @@ -0,0 +1,1552 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +open Printf +open Util (* for failwithf *) + +(* -------------------------------------------------------------------- + * We first introduce a `parse_enclave_ast' function (see below) to + * parse a value of type `Ast.enclave' into a `enclave_content' record. + * -------------------------------------------------------------------- + *) + +(* This record type is used to better organize a value of Ast.enclave *) +type enclave_content = { + file_shortnm : string; (* the short name of original EDL file *) + enclave_name : string; (* the normalized C identifier *) + + include_list : string list; + import_exprs : Ast.import_decl list; + comp_defs : Ast.composite_type list; + tfunc_decls : Ast.trusted_func list; + ufunc_decls : Ast.untrusted_func list; +} + +(* Whether to prefix untrusted proxy with Enclave name *) +let g_use_prefix = ref false +let g_untrusted_dir = ref "." +let g_trusted_dir = ref "." + +let empty_ec = + { file_shortnm = ""; + enclave_name = ""; + include_list = []; + import_exprs = []; + comp_defs = []; + tfunc_decls = []; + ufunc_decls = []; } + +let get_tf_fname (tf: Ast.trusted_func) = + tf.Ast.tf_fdecl.Ast.fname + +let is_priv_ecall (tf: Ast.trusted_func) = + tf.Ast.tf_is_priv + +let get_uf_fname (uf: Ast.untrusted_func) = + uf.Ast.uf_fdecl.Ast.fname + +let get_trusted_func_names (ec: enclave_content) = + List.map get_tf_fname ec.tfunc_decls + +let get_untrusted_func_names (ec: enclave_content) = + List.map get_uf_fname ec.ufunc_decls + +let tf_list_to_fd_list (tfs: Ast.trusted_func list) = + List.map (fun (tf: Ast.trusted_func) -> tf.Ast.tf_fdecl) tfs + +let tf_list_to_priv_list (tfs: Ast.trusted_func list) = + List.map is_priv_ecall tfs + +(* Get a list of names of all private ECALLs *) +let get_priv_ecall_names (tfs: Ast.trusted_func list) = + List.filter is_priv_ecall tfs |> List.map get_tf_fname + +let uf_list_to_fd_list (ufs: Ast.untrusted_func list) = + List.map (fun (uf: Ast.untrusted_func) -> uf.Ast.uf_fdecl) ufs + +(* Get a list of names of all allowed ECALLs from `allow(...)' *) +let get_allowed_names (ufs: Ast.untrusted_func list) = + let allow_lists = + List.map (fun (uf: Ast.untrusted_func) -> uf.Ast.uf_allow_list) ufs + in + List.flatten allow_lists |> dedup_list + +(* With `parse_enclave_ast', each enclave AST is traversed only once. *) +let parse_enclave_ast (e: Ast.enclave) = + let ac_include_list = ref [] in + let ac_import_exprs = ref [] in + let ac_comp_defs = ref [] in + let ac_tfunc_decls = ref [] in + let ac_ufunc_decls = ref [] in + List.iter (fun ex -> + match ex with + Ast.Composite x -> ac_comp_defs := x :: !ac_comp_defs + | Ast.Include x -> ac_include_list := x :: !ac_include_list + | Ast.Importing x -> ac_import_exprs := x :: !ac_import_exprs + | Ast.Interface xs -> + List.iter (fun ef -> + match ef with + Ast.Trusted f -> + ac_tfunc_decls := f :: !ac_tfunc_decls + | Ast.Untrusted f -> + ac_ufunc_decls := f :: !ac_ufunc_decls) xs + ) e.Ast.eexpr; + { file_shortnm = e.Ast.ename; + enclave_name = Util.to_c_identifier e.Ast.ename; + include_list = List.rev !ac_include_list; + import_exprs = List.rev !ac_import_exprs; + comp_defs = List.rev !ac_comp_defs; + tfunc_decls = List.rev !ac_tfunc_decls; + ufunc_decls = List.rev !ac_ufunc_decls; } + +let is_foreign_array (pt: Ast.parameter_type) = + match pt with + Ast.PTVal _ -> false + | Ast.PTPtr(t, a) -> + match t with + Ast.Foreign _ -> a.Ast.pa_isary + | _ -> false + +(* A naked function has neither parameters nor return value. *) +let is_naked_func (fd: Ast.func_decl) = + fd.Ast.rtype = Ast.Void && fd.Ast.plist = [] + +(* + * If user only defined a trusted function w/o neither parameter nor + * return value, the generated trusted bridge will not call any tRTS + * routines. If the real trusted function doesn't call tRTS function + * either (highly possible), then the MSVC linker will not link tRTS + * into the result enclave. + *) +let tbridge_gen_dummy_variable (ec: enclave_content) = + let _dummy_variable = + sprintf "\n#ifdef _MSC_VER\n\ +\t/* In case enclave `%s' doesn't call any tRTS function. */\n\ +\tvolatile int force_link_trts = sgx_is_within_enclave(NULL, 0);\n\ +\t(void) force_link_trts; /* avoid compiler warning */\n\ +#endif\n\n" ec.enclave_name + in + if ec.ufunc_decls <> [] then "" + else + if List.for_all (fun tfd -> is_naked_func tfd.Ast.tf_fdecl) ec.tfunc_decls + then _dummy_variable + else "" + +(* This function is used to convert Array form into Pointer form. + * e.g.: int array[10][20] => [count = 200] int* array + * + * This function is called when generating proxy/bridge code and + * the marshaling structure. + *) +let conv_array_to_ptr (pd: Ast.pdecl): Ast.pdecl = + let (pt, declr) = pd in + let get_count_attr ilist = + (* XXX: assume the size of each dimension will be > 0. *) + Ast.ANumber (List.fold_left (fun acc i -> acc*i) 1 ilist) + in + match pt with + Ast.PTVal _ -> (pt, declr) + | Ast.PTPtr(aty, pa) -> + if Ast.is_array declr then + let tmp_declr = { declr with Ast.array_dims = [] } in + let tmp_aty = Ast.Ptr aty in + let tmp_cnt = get_count_attr declr.Ast.array_dims in + let tmp_pa = { pa with Ast.pa_size = { Ast.empty_ptr_size with Ast.ps_count = Some tmp_cnt } } + in (Ast.PTPtr(tmp_aty, tmp_pa), tmp_declr) + else (pt, declr) + +(* ------------------------------------------------------------------ + * Code generation for edge-routines. + * ------------------------------------------------------------------ + *) + +(* Little functions for naming of a struct and its members etc *) +let retval_name = "retval" +let retval_declr = { Ast.identifier = retval_name; Ast.array_dims = []; } +let eid_name = "eid" +let ms_ptr_name = "pms" +let ms_struct_val = "ms" +let mk_ms_member_name (pname: string) = "ms_" ^ pname +let mk_ms_struct_name (fname: string) = "ms_" ^ fname ^ "_t" +let ms_retval_name = mk_ms_member_name retval_name +let mk_tbridge_name (fname: string) = "sgx_" ^ fname +let mk_parm_accessor name = sprintf "%s->%s" ms_struct_val (mk_ms_member_name name) +let mk_tmp_var name = "_tmp_" ^ name +let mk_len_var name = "_len_" ^ name +let mk_in_var name = "_in_" ^ name +let mk_ocall_table_name enclave_name = "ocall_table_" ^ enclave_name + +(* Un-trusted bridge name is prefixed with enclave file short name. *) +let mk_ubridge_name (file_shortnm: string) (funcname: string) = + sprintf "%s_%s" file_shortnm funcname + +let mk_ubridge_proto (file_shortnm: string) (funcname: string) = + sprintf "static sgx_status_t SGX_CDECL %s(void* %s)" + (mk_ubridge_name file_shortnm funcname) ms_ptr_name + +(* Common macro definitions. *) +let common_macros = "#include /* for size_t */\n\n\ +#define SGX_CAST(type, item) ((type)(item))\n\n\ +#ifdef __cplusplus\n\ +extern \"C\" {\n\ +#endif\n" + +(* Header footer *) +let header_footer = "\n#ifdef __cplusplus\n}\n#endif /* __cplusplus */\n\n#endif\n" + +(* Little functions for generating file names. *) +let get_uheader_short_name (file_shortnm: string) = file_shortnm ^ "_u.h" +let get_uheader_name (file_shortnm: string) = + !g_untrusted_dir ^ separator_str ^ (get_uheader_short_name file_shortnm) + +let get_usource_name (file_shortnm: string) = + !g_untrusted_dir ^ separator_str ^ file_shortnm ^ "_u.c" + +let get_theader_short_name (file_shortnm: string) = file_shortnm ^ "_t.h" +let get_theader_name (file_shortnm: string) = + !g_trusted_dir ^ separator_str ^ (get_theader_short_name file_shortnm) + +let get_tsource_name (file_shortnm: string) = + !g_trusted_dir ^ separator_str ^ file_shortnm ^ "_t.c" + +(* Construct the string of structure definition *) +let mk_struct_decl (fs: string) (name: string) = + sprintf "typedef struct %s {\n%s} %s;\n" name fs name + +(* Construct the string of union definition *) +let mk_union_decl (fs: string) (name: string) = + sprintf "typedef union %s {\n%s} %s;\n" name fs name + +(* Generate a definition of enum *) +let mk_enum_def (e: Ast.enum_def) = + let gen_enum_ele_str (ele: Ast.enum_ele) = + let k, v = ele in + match v with + Ast.EnumValNone -> k + | Ast.EnumVal ev -> sprintf "%s = %s" k (Ast.attr_value_to_string ev) + in + let enname = e.Ast.enname in + let enbody = e.Ast.enbody in + let enbody_str = + if enbody = [] then "" + else List.fold_left (fun acc ele -> + acc ^ "\t" ^ gen_enum_ele_str ele ^ ",\n") "" enbody + in + if enname = "" then sprintf "enum {\n%s};\n" enbody_str + else sprintf "typedef enum %s {\n%s} %s;\n" enname enbody_str enname + +let get_array_dims (ns: int list) = + (* Get the array declaration from a list of array dimensions. + * Empty `ns' indicates the corresponding declarator is a simple identifier. + * Element of value -1 means that user does not specify the dimension size. + *) + let get_dim n = if n = -1 then "[]" else sprintf "[%d]" n + in + if ns = [] then "" + else List.fold_left (fun acc n -> acc ^ get_dim n) "" ns + +let get_typed_declr_str (ty: Ast.atype) (declr: Ast.declarator) = + let tystr = Ast.get_tystr ty in + let dmstr = get_array_dims declr.Ast.array_dims in + sprintf "%s %s%s" tystr declr.Ast.identifier dmstr + +(* Construct a member declaration string *) +let mk_member_decl (ty: Ast.atype) (declr: Ast.declarator) = + sprintf "\t%s;\n" (get_typed_declr_str ty declr) + +(* Note that, for a foreign array type `foo_array_t' we will generate + * foo_array_t* ms_field; + * in the marshaling data structure to keep the pass-by-address scheme + * as in the C programming language. +*) +let mk_ms_member_decl (pt: Ast.parameter_type) (declr: Ast.declarator) = + let aty = Ast.get_param_atype pt in + let tystr = Ast.get_tystr aty in + let ptr = if is_foreign_array pt then "* " else "" in + let field = mk_ms_member_name declr.Ast.identifier in + let dmstr = get_array_dims declr.Ast.array_dims in + sprintf "\t%s%s %s%s;\n" tystr ptr field dmstr + +(* Generate data structure definition *) +let gen_comp_def (st: Ast.composite_type) = + let gen_member_list mlist = + List.fold_left (fun acc (ty, declr) -> + acc ^ mk_member_decl ty declr) "" mlist + in + match st with + Ast.StructDef s -> mk_struct_decl (gen_member_list s.Ast.mlist) s.Ast.sname + | Ast.UnionDef u -> mk_union_decl (gen_member_list u.Ast.mlist) u.Ast.sname + | Ast.EnumDef e -> mk_enum_def e + +(* Generate a list of '#include' *) +let gen_include_list (xs: string list) = + List.fold_left (fun acc s -> acc ^ sprintf "#include \"%s\"\n" s) "" xs + +(* Get the type string from 'parameter_type' *) +let get_param_tystr (pt: Ast.parameter_type) = + Ast.get_tystr (Ast.get_param_atype pt) + +(* Generate marshaling structure definition *) +let gen_marshal_struct (fd: Ast.func_decl) (errno: string) = + let member_list_str = errno ^ + let new_param_list = List.map conv_array_to_ptr fd.Ast.plist in + List.fold_left (fun acc (pt, declr) -> + acc ^ mk_ms_member_decl pt declr) "" new_param_list in + let struct_name = mk_ms_struct_name fd.Ast.fname in + match fd.Ast.rtype with + (* A function w/o return value and parameters doesn't need + a marshaling struct. *) + Ast.Void -> if fd.Ast.plist = [] && errno = "" then "" + else mk_struct_decl member_list_str struct_name + | _ -> let rv_str = mk_ms_member_decl (Ast.PTVal fd.Ast.rtype) retval_declr + in mk_struct_decl (rv_str ^ member_list_str) struct_name + +let gen_ecall_marshal_struct (tf: Ast.trusted_func) = + gen_marshal_struct tf.Ast.tf_fdecl "" + +let gen_ocall_marshal_struct (uf: Ast.untrusted_func) = + let errno_decl = if uf.Ast.uf_propagate_errno then "\tint ocall_errno;\n" else "" in + gen_marshal_struct uf.Ast.uf_fdecl errno_decl + +(* Check whether given parameter is `const' specified. *) +let is_const_ptr (pt: Ast.parameter_type) = + let aty = Ast.get_param_atype pt in + match pt with + Ast.PTVal _ -> false + | Ast.PTPtr(_, pa) -> + if not pa.Ast.pa_rdonly then false + else + match aty with + Ast.Foreign _ -> false + | _ -> true + +(* Generate parameter representation. *) +let gen_parm_str (p: Ast.pdecl) = + let (pt, (declr : Ast.declarator)) = p in + let aty = Ast.get_param_atype pt in + let str = get_typed_declr_str aty declr in + if is_const_ptr pt then "const " ^ str else str + +(* Generate parameter representation of return value. *) +let gen_parm_retval (rt: Ast.atype) = + if rt = Ast.Void then "" + else Ast.get_tystr rt ^ "* " ^ retval_name + +(* ---------------------------------------------------------------------- *) + +(* `gen_ecall_table' is used to generate ECALL table with the following form: + SGX_EXTERNC const struct { + size_t nr_ecall; /* number of ECALLs */ + struct { + void *ecall_addr; + uint8_t is_priv; + } ecall_table [nr_ecall]; + } g_ecall_table = { + 2, { {sgx_foo, 1}, {sgx_bar, 0} } + }; +*) +let gen_ecall_table (tfs: Ast.trusted_func list) = + let ecall_table_name = "g_ecall_table" in + let ecall_table_size = List.length tfs in + let trusted_fds = tf_list_to_fd_list tfs in + let priv_bits = tf_list_to_priv_list tfs in + let tbridge_names = List.map (fun (fd: Ast.func_decl) -> + mk_tbridge_name fd.Ast.fname) trusted_fds in + let ecall_table = + let bool_to_int b = if b then 1 else 0 in + let inner_table = + List.fold_left2 (fun acc s b -> + sprintf "%s\t\t{(void*)(uintptr_t)%s, %d},\n" acc s (bool_to_int b)) "" tbridge_names priv_bits + in "\t{\n" ^ inner_table ^ "\t}\n" + in + sprintf "SGX_EXTERNC const struct {\n\ +\tsize_t nr_ecall;\n\ +\tstruct {void* ecall_addr; uint8_t is_priv;} ecall_table[%d];\n\ +} %s = {\n\ +\t%d,\n\ +%s};\n" ecall_table_size + ecall_table_name + ecall_table_size + (if ecall_table_size = 0 then "" else ecall_table) + +(* `gen_entry_table' is used to generate Dynamic Entry Table with the form: + SGX_EXTERNC const struct { + /* number of OCALLs (number of ECALLs can be found in ECALL table) */ + size_t nr_ocall; + + /* entry_table[m][n] = 1 iff. ECALL n is allowed in the OCALL m. */ + uint8_t entry_table[NR_OCALL][NR_ECALL]; + } g_dyn_entry_table = { + 3, {{0, 0}, {0, 1}, {1, 0}} + }; +*) +let gen_entry_table (ec: enclave_content) = + let dyn_entry_table_name = "g_dyn_entry_table" in + let ocall_table_size = List.length ec.ufunc_decls in + let trusted_func_names = get_trusted_func_names ec in + let ecall_table_size = List.length trusted_func_names in + let get_entry_array (allowed_ecalls: string list) = + List.fold_left (fun acc name -> + acc ^ (if List.exists (fun x -> x=name) allowed_ecalls + then "1" + else "0") ^ ", ") "" trusted_func_names in + let entry_table = + let inner_table = + List.fold_left (fun acc (uf: Ast.untrusted_func) -> + let entry_array = get_entry_array uf.Ast.uf_allow_list + in acc ^ "\t\t{" ^ entry_array ^ "},\n") "" ec.ufunc_decls + in + "\t{\n" ^ inner_table ^ "\t}\n" + in + (* Generate dynamic entry table iff. both sgx_ecall/ocall_table_size > 0 *) + let gen_table_p = (ecall_table_size > 0) && (ocall_table_size > 0) in + (* When NR_ECALL is 0, or NR_OCALL is 0, there will be no entry table field. *) + let entry_table_field = + if gen_table_p then + sprintf "\tuint8_t entry_table[%d][%d];\n" ocall_table_size ecall_table_size + else + "" + in + sprintf "SGX_EXTERNC const struct {\n\ +\tsize_t nr_ocall;\n%s\ +} %s = {\n\ +\t%d,\n\ +%s};\n" entry_table_field + dyn_entry_table_name + ocall_table_size + (if gen_table_p then entry_table else "") + +(* ---------------------------------------------------------------------- *) + +(* Generate the function prototype for untrusted proxy in COM style. + * For example, un-trusted functions + * int foo(double d); + * void bar(float f); + * + * will have an untrusted proxy like below: + * sgx_status_t foo(int* retval, double d); + * sgx_status_t bar(float f); + *) +let gen_tproxy_proto (fd: Ast.func_decl) = + let parm_list = + match fd.Ast.plist with + [] -> "" + | x :: xs -> + List.fold_left (fun acc pd -> + acc ^ ", " ^ gen_parm_str pd) (gen_parm_str x) xs + in + let retval_parm_str = gen_parm_retval fd.Ast.rtype in + if fd.Ast.plist = [] then + sprintf "sgx_status_t SGX_CDECL %s(%s)" fd.Ast.fname retval_parm_str + else if fd.Ast.rtype = Ast.Void then + sprintf "sgx_status_t SGX_CDECL %s(%s)" fd.Ast.fname parm_list + else + sprintf "sgx_status_t SGX_CDECL %s(%s, %s)" fd.Ast.fname retval_parm_str parm_list + +(* Generate the function prototype for untrusted proxy in COM style. + * For example, trusted functions + * int foo(double d); + * void bar(float f); + * + * will have an untrusted proxy like below: + * sgx_status_t foo(sgx_enclave_id_t eid, int* retval, double d); + * sgx_status_t foo(sgx_enclave_id_t eid, float f); + * + * When `g_use_prefix' is true, the untrusted proxy name is prefixed + * with the `prefix' parameter. + * + *) +let gen_uproxy_com_proto (fd: Ast.func_decl) (prefix: string) = + let retval_parm_str = gen_parm_retval fd.Ast.rtype in + + let eid_parm_str = + if fd.Ast.rtype = Ast.Void then sprintf "(sgx_enclave_id_t %s" eid_name + else sprintf "(sgx_enclave_id_t %s, " eid_name in + let parm_list = + List.fold_left (fun acc pd -> acc ^ ", " ^ gen_parm_str pd) + retval_parm_str fd.Ast.plist in + let fname = + if !g_use_prefix then sprintf "%s_%s" prefix fd.Ast.fname + else fd.Ast.fname + in "sgx_status_t " ^ fname ^ eid_parm_str ^ parm_list ^ ")" + +let get_ret_tystr (fd: Ast.func_decl) = Ast.get_tystr fd.Ast.rtype +let get_plist_str (fd: Ast.func_decl) = + if fd.Ast.plist = [] then "" + else List.fold_left (fun acc pd -> acc ^ ", " ^ gen_parm_str pd) + (gen_parm_str (List.hd fd.Ast.plist)) + (List.tl fd.Ast.plist) + +(* Generate the function prototype as is. *) +let gen_func_proto (fd: Ast.func_decl) = + let ret_tystr = get_ret_tystr fd in + let plist_str = get_plist_str fd in + sprintf "%s %s(%s)" ret_tystr fd.Ast.fname plist_str + +(* Generate prototypes for untrusted function. *) +let gen_ufunc_proto (uf: Ast.untrusted_func) = + let dllimport = if uf.Ast.uf_fattr.Ast.fa_dllimport then "SGX_DLLIMPORT " else "" in + let ret_tystr = get_ret_tystr uf.Ast.uf_fdecl in + let cconv_str = "SGX_" ^ Ast.get_call_conv_str uf.Ast.uf_fattr.Ast.fa_convention in + let func_name = uf.Ast.uf_fdecl.Ast.fname in + let plist_str = get_plist_str uf.Ast.uf_fdecl in + sprintf "%s%s SGX_UBRIDGE(%s, %s, (%s))" + dllimport ret_tystr cconv_str func_name plist_str + +(* The preemble contains common include expressions. *) +let gen_uheader_preemble (guard: string) (inclist: string)= + let grd_hdr = sprintf "#ifndef %s\n#define %s\n\n" guard guard in + let inc_exp = "#include \n\ +#include \n\ +#include \n\ +#include \n\ +#include \"sgx_edger8r.h\" /* for sgx_satus_t etc. */\n" in + grd_hdr ^ inc_exp ^ "\n" ^ inclist ^ "\n" ^ common_macros + +let ms_writer out_chan ec = + let ms_struct_ecall = List.map gen_ecall_marshal_struct ec.tfunc_decls in + let ms_struct_ocall = List.map gen_ocall_marshal_struct ec.ufunc_decls in + List.iter (fun s -> output_string out_chan (s ^ "\n")) ms_struct_ecall; + List.iter (fun s -> output_string out_chan (s ^ "\n")) ms_struct_ocall + + +(* Generate untrusted header for enclave *) +let gen_untrusted_header (ec: enclave_content) = + let header_fname = get_uheader_name ec.file_shortnm in + let guard_macro = sprintf "%s_U_H__" (String.uppercase ec.enclave_name) in + let preemble_code = + let include_list = gen_include_list (ec.include_list @ !untrusted_headers) in + gen_uheader_preemble guard_macro include_list + in + let comp_def_list = List.map gen_comp_def ec.comp_defs in + let func_proto_ufunc = List.map gen_ufunc_proto ec.ufunc_decls in + let uproxy_com_proto = + List.map (fun (tf: Ast.trusted_func) -> + gen_uproxy_com_proto tf.Ast.tf_fdecl ec.enclave_name) + ec.tfunc_decls + in + let out_chan = open_out header_fname in + output_string out_chan (preemble_code ^ "\n"); + List.iter (fun s -> output_string out_chan (s ^ "\n")) comp_def_list; + List.iter (fun s -> output_string out_chan (s ^ ";\n")) func_proto_ufunc; + output_string out_chan "\n"; + List.iter (fun s -> output_string out_chan (s ^ ";\n")) uproxy_com_proto; + output_string out_chan header_footer; + close_out out_chan + +(* It generates preemble for trusted header file. *) +let gen_theader_preemble (guard: string) (inclist: string) = + let grd_hdr = sprintf "#ifndef %s\n#define %s\n\n" guard guard in + let inc_exp = "#include \n\ +#include \n\ +#include \n\ +#include \"sgx_edger8r.h\" /* for sgx_ocall etc. */\n\n" in + grd_hdr ^ inc_exp ^ inclist ^ "\n" ^ common_macros + + +(* Generate function prototype for functions used by `sizefunc' attribute. *) +let gen_sizefunc_proto out_chan (ec: enclave_content) = + let tfunc_decls = tf_list_to_fd_list ec.tfunc_decls in + let ufunc_decls = uf_list_to_fd_list ec.ufunc_decls in + + let dict = Hashtbl.create 4 in + let get_sizefunc_proto s = + let (pt, ns) = Hashtbl.find dict s in + let tmpdeclr = { Ast.identifier = "val"; Ast.array_dims = ns; } in + sprintf "size_t %s(const %s);\n" s (get_typed_declr_str pt tmpdeclr) + in + + let add_item (fname: string) (ty: Ast.atype * int list) = + try + let v = Hashtbl.find dict fname + in + if v <> ty then + failwithf "`%s' requires different parameter types" fname + with Not_found -> Hashtbl.add dict fname ty + in + let fill_dict (pd: Ast.pdecl) = + let (pt, declr) = pd in + match pt with + Ast.PTVal _ -> () + | Ast.PTPtr(aty, pattr) -> + match pattr.Ast.pa_size.Ast.ps_sizefunc with + Some s -> add_item s (aty, declr.Ast.array_dims) + | _ -> () + in + List.iter (fun (fd: Ast.func_decl) -> + List.iter fill_dict fd.Ast.plist) (tfunc_decls @ ufunc_decls); + Hashtbl.iter (fun x y -> + output_string out_chan (get_sizefunc_proto x)) dict; + output_string out_chan "\n" + +(* Generate trusted header for enclave *) +let gen_trusted_header (ec: enclave_content) = + let header_fname = get_theader_name ec.file_shortnm in + let guard_macro = sprintf "%s_T_H__" (String.uppercase ec.enclave_name) in + let guard_code = + let include_list = gen_include_list (ec.include_list @ !trusted_headers) in + gen_theader_preemble guard_macro include_list in + let comp_def_list = List.map gen_comp_def ec.comp_defs in + let func_proto_list = List.map gen_func_proto (tf_list_to_fd_list ec.tfunc_decls) in + let func_tproxy_list= List.map gen_tproxy_proto (uf_list_to_fd_list ec.ufunc_decls) in + + let out_chan = open_out header_fname in + output_string out_chan (guard_code ^ "\n"); + List.iter (fun s -> output_string out_chan (s ^ "\n")) comp_def_list; + gen_sizefunc_proto out_chan ec; + List.iter (fun s -> output_string out_chan (s ^ ";\n")) func_proto_list; + output_string out_chan "\n"; + List.iter (fun s -> output_string out_chan (s ^ ";\n")) func_tproxy_list; + output_string out_chan header_footer; + close_out out_chan + +(* It generates function invocation expression. *) +let mk_parm_name_raw (pt: Ast.parameter_type) (declr: Ast.declarator) = + let cast_expr = + if Ast.is_array declr && List.length declr.Ast.array_dims > 1 + then + let tystr = get_param_tystr pt in + let dims = get_array_dims (List.tl declr.Ast.array_dims) in + sprintf "(%s (*)%s)" tystr dims + else "" + in + cast_expr ^ mk_parm_accessor declr.Ast.identifier + +(* We passed foreign array `foo_array_t foo' as `&foo[0]', thus we + * need to get back `foo' by '* array_ptr' where + * array_ptr = &foo[0] +*) +let add_foreign_array_ptrref + (f: Ast.parameter_type -> Ast.declarator -> string) + (pt: Ast.parameter_type) + (declr: Ast.declarator) = + let arg = f pt declr in + if is_foreign_array pt + then sprintf "(%s != NULL) ? (*%s) : NULL" arg arg + else arg + +let mk_parm_name_ubridge (pt: Ast.parameter_type) (declr: Ast.declarator) = + add_foreign_array_ptrref mk_parm_name_raw pt declr + +let mk_parm_name_ext (pt: Ast.parameter_type) (declr: Ast.declarator) = + let name = declr.Ast.identifier in + match pt with + Ast.PTVal _ -> mk_parm_name_raw pt declr + | Ast.PTPtr (_, attr) -> + match attr.Ast.pa_direction with + | Ast.PtrNoDirection -> mk_parm_name_raw pt declr + | _ -> mk_in_var name + +let gen_func_invoking (fd: Ast.func_decl) + (mk_parm_name: Ast.parameter_type -> Ast.declarator -> string) = + let gen_parm_str pt declr = + let parm_name = mk_parm_name pt declr in + let tystr = get_param_tystr pt in + if is_const_ptr pt then sprintf "(const %s)%s" tystr parm_name else parm_name + in + match fd.Ast.plist with + [] -> sprintf "%s();" fd.Ast.fname + | (pt, (declr : Ast.declarator)) :: ps -> + sprintf "%s(%s);" + fd.Ast.fname + (let p0 = gen_parm_str pt declr in + List.fold_left (fun acc (pty, dlr) -> + acc ^ ", " ^ gen_parm_str pty dlr) p0 ps) + +(* Generate untrusted bridge code for a given untrusted function. *) +let gen_func_ubridge (file_shortnm: string) (ufunc: Ast.untrusted_func) = + let fd = ufunc.Ast.uf_fdecl in + let propagate_errno = ufunc.Ast.uf_propagate_errno in + let func_open = sprintf "%s\n{\n" (mk_ubridge_proto file_shortnm fd.Ast.fname) in + let func_close = "\treturn SGX_SUCCESS;\n}\n" in + let set_errno = if propagate_errno then "\tms->ocall_errno = errno;" else "" in + let ms_struct_name = mk_ms_struct_name fd.Ast.fname in + let declare_ms_ptr = sprintf "%s* %s = SGX_CAST(%s*, %s);" + ms_struct_name + ms_struct_val + ms_struct_name + ms_ptr_name in + let call_with_pms = + let invoke_func = gen_func_invoking fd mk_parm_name_ubridge in + if fd.Ast.rtype = Ast.Void then invoke_func + else sprintf "%s = %s" (mk_parm_accessor retval_name) invoke_func + in + if (is_naked_func fd) && (propagate_errno = false) then + let check_pms = + sprintf "if (%s != NULL) return SGX_ERROR_INVALID_PARAMETER;" ms_ptr_name + in + sprintf "%s\t%s\n\t%s\n%s" func_open check_pms call_with_pms func_close + else + sprintf "%s\t%s\n\t%s\n%s\n%s" func_open declare_ms_ptr call_with_pms set_errno func_close + +let fill_ms_field (isptr: bool) (pd: Ast.pdecl) = + let accessor = if isptr then "->" else "." in + let (pt, declr) = pd in + let param_name = declr.Ast.identifier in + let ms_member_name = mk_ms_member_name param_name in + let assignment_str (use_cast: bool) (aty: Ast.atype) = + let cast_str = if use_cast then sprintf "(%s)" (Ast.get_tystr aty) else "" + in + sprintf "%s%s%s = %s%s;" ms_struct_val accessor ms_member_name cast_str param_name + in + let gen_setup_foreign_array aty = + sprintf "%s%s%s = (%s *)&%s[0];" + ms_struct_val accessor ms_member_name (Ast.get_tystr aty) param_name + in + if declr.Ast.array_dims = [] then + match pt with + Ast.PTVal(aty) -> assignment_str false aty + | Ast.PTPtr(aty, pattr) -> + if pattr.Ast.pa_isary + then gen_setup_foreign_array aty + else + if pattr.Ast.pa_rdonly then assignment_str true aty + else assignment_str false aty + else + (* Arrays are passed by address. *) + let tystr = Ast.get_tystr (Ast.Ptr (Ast.get_param_atype pt)) in + sprintf "%s%s%s = (%s)%s;" ms_struct_val accessor ms_member_name tystr param_name + +(* Generate untrusted proxy code for a given trusted function. *) +let gen_func_uproxy (fd: Ast.func_decl) (idx: int) (ec: enclave_content) = + let func_open = + gen_uproxy_com_proto fd ec.enclave_name ^ + "\n{\n\tsgx_status_t status;\n" + in + let func_close = "\treturn status;\n}\n" in + let ocall_table_name = mk_ocall_table_name ec.enclave_name in + let ms_struct_name = mk_ms_struct_name fd.Ast.fname in + let declare_ms_expr = sprintf "%s %s;" ms_struct_name ms_struct_val in + let ocall_table_ptr = + sprintf "&%s" ocall_table_name in + + (* Normal case - do ECALL with marshaling structure*) + let ecall_with_ms = sprintf "status = sgx_ecall(%s, %d, %s, &%s);" + eid_name idx ocall_table_ptr ms_struct_val in + + (* Rare case - the trusted function doesn't have parameter nor return value. + * In this situation, no marshaling structure is required - passing in NULL. + *) + let ecall_null = sprintf "status = sgx_ecall(%s, %d, %s, NULL);" + eid_name idx ocall_table_ptr + in + let update_retval = sprintf "if (status == SGX_SUCCESS && %s) *%s = %s.%s;" + retval_name retval_name ms_struct_val ms_retval_name in + let func_body = ref [] in + if is_naked_func fd then + sprintf "%s\t%s\n%s" func_open ecall_null func_close + else + begin + func_body := declare_ms_expr :: !func_body; + List.iter (fun pd -> func_body := fill_ms_field false pd :: !func_body) fd.Ast.plist; + func_body := ecall_with_ms :: !func_body; + if fd.Ast.rtype <> Ast.Void then func_body := update_retval :: !func_body; + List.fold_left (fun acc s -> acc ^ "\t" ^ s ^ "\n") func_open (List.rev !func_body) ^ func_close + end + +(* Generate an expression to check the pointers. *) +let mk_check_ptr (name: string) (lenvar: string) = + let checker = "CHECK_UNIQUE_POINTER" + in sprintf "\t%s(%s, %s);\n" checker name lenvar + +(* Pointer to marshaling structure should never be NULL. *) +let mk_check_pms (fname: string) = + let lenvar = sprintf "sizeof(%s)" (mk_ms_struct_name fname) + in sprintf "\t%s(%s, %s);\n" "CHECK_REF_POINTER" ms_ptr_name lenvar + +(* Generate code to get the size of the pointer. *) +let gen_ptr_size (ty: Ast.atype) (pattr: Ast.ptr_attr) (name: string) (get_parm: string -> string) = + let len_var = mk_len_var name in + let parm_name = get_parm name in + + let mk_len_size v = + match v with + Ast.AString s -> get_parm s + | Ast.ANumber n -> sprintf "%d" n in + + let mk_len_count v size_str = + match v with + Ast.AString s -> sprintf "%s * %s" (get_parm s) size_str + | Ast.ANumber n -> sprintf "%d * %s" n size_str in + + let mk_len_sizefunc s = sprintf "((%s) ? %s(%s) : 0)" parm_name s parm_name in + + (* Note, during the parsing stage, we already eliminated the case that + * user specified both 'size' and 'sizefunc' attribute. + *) + let do_attribute (pattr: Ast.ptr_attr) = + let do_ps_attribute (sattr: Ast.ptr_size) = + let size_str = + match sattr.Ast.ps_size with + Some a -> mk_len_size a + | None -> + match sattr.Ast.ps_sizefunc with + None -> sprintf "sizeof(*%s)" parm_name + | Some a -> mk_len_sizefunc a + in + match sattr.Ast.ps_count with + None -> size_str + | Some a -> mk_len_count a size_str + in + if pattr.Ast.pa_isstr then + sprintf "%s ? strlen(%s) + 1 : 0" parm_name parm_name + else if pattr.Ast.pa_iswstr then + sprintf "%s ? (wcslen(%s) + 1) * sizeof(wchar_t) : 0" parm_name parm_name + else + do_ps_attribute pattr.Ast.pa_size + in + sprintf "size_t %s = %s;\n" + len_var + (if pattr.Ast.pa_isary + then sprintf "sizeof(%s)" (Ast.get_tystr ty) + else do_attribute pattr) + +(* Find the data type of a parameter. *) +let find_param_type (name: string) (plist: Ast.pdecl list) = + try + let (pt, _) = List.find (fun (pd: Ast.pdecl) -> + let (pt, declr) = pd + in declr.Ast.identifier = name) plist + in get_param_tystr pt + with + Not_found -> failwithf "parameter `%s' not found." name + +(* Generate code to check the length of buffers. *) +let gen_check_tbridge_length_overflow (plist: Ast.pdecl list) = + let gen_check_length (ty: Ast.atype) (attr: Ast.ptr_attr) (declr: Ast.declarator) = + let name = declr.Ast.identifier in + let tmp_ptr_name= mk_tmp_var name in + + let mk_len_size v = + match v with + Ast.AString s -> mk_tmp_var s + | Ast.ANumber n -> sprintf "%d" n in + + let mk_len_sizefunc s = sprintf "((%s) ? %s(%s) : 0)" tmp_ptr_name s tmp_ptr_name in + + let gen_check_overflow cnt size_str = + let if_statement = + match cnt with + Ast.AString s -> sprintf "\tif ((size_t)%s > (SIZE_MAX / %s)) {\n" (mk_tmp_var s) size_str + | Ast.ANumber n -> sprintf "\tif (%d > (SIZE_MAX / %s)) {\n" n size_str + in + sprintf "%s\t\tstatus = SGX_ERROR_INVALID_PARAMETER;\n\t\tgoto err;\n\t}" if_statement + in + let size_str = + match attr.Ast.pa_size.Ast.ps_size with + Some a -> mk_len_size a + | None -> + match attr.Ast.pa_size.Ast.ps_sizefunc with + None -> sprintf "sizeof(*%s)" tmp_ptr_name + | Some a -> mk_len_sizefunc a + in + match attr.Ast.pa_size.Ast.ps_count with + None -> "" + | Some a -> sprintf "%s\n\n" (gen_check_overflow a size_str) + in + List.fold_left + (fun acc (pty, declr) -> + match pty with + Ast.PTVal _ -> acc + | Ast.PTPtr(ty, attr) -> acc ^ gen_check_length ty attr declr) "" plist + +(* Generate code to check all function parameters which are pointers. *) +let gen_check_tbridge_ptr_parms (plist: Ast.pdecl list) = + let gen_check_ptr (ty: Ast.atype) (pattr: Ast.ptr_attr) (declr: Ast.declarator) = + if not pattr.Ast.pa_chkptr then "" + else + let name = declr.Ast.identifier in + let len_var = mk_len_var name in + let parm_name = mk_tmp_var name in + if pattr.Ast.pa_chkptr + then mk_check_ptr parm_name len_var + else "" + in + let new_param_list = List.map conv_array_to_ptr plist + in + List.fold_left + (fun acc (pty, declr) -> + match pty with + Ast.PTVal _ -> acc + | Ast.PTPtr(ty, attr) -> acc ^ gen_check_ptr ty attr declr) "" new_param_list + +(* If a foreign type is a readonly pointer, we cast it to 'void*' for memcpy() and free() *) +let mk_in_ptr_dst_name (rdonly: bool) (ptr_name: string) = + if rdonly then "(void*)" ^ ptr_name + else ptr_name + +(* Generate the code to handle function pointer parameter direction, + * which is to be inserted before actually calling the trusted function. + *) +let gen_parm_ptr_direction_pre (plist: Ast.pdecl list) = + let clone_in_ptr (ty: Ast.atype) (attr: Ast.ptr_attr) (declr: Ast.declarator) = + let name = declr.Ast.identifier in + let is_ary = (Ast.is_array declr || attr.Ast.pa_isary) in + let in_ptr_name = mk_in_var name in + let in_ptr_type = sprintf "%s%s" (Ast.get_tystr ty) (if is_ary then "*" else "") in + let len_var = mk_len_var name in + let in_ptr_dst_name = mk_in_ptr_dst_name attr.Ast.pa_rdonly in_ptr_name in + let tmp_ptr_name= mk_tmp_var name in + + let check_sizefunc_ptr (fn: string) = + sprintf "\t\t/* check whether the pointer is modified. */\n\ +\t\tif (%s(%s) != %s) {\n\ +\t\t\tstatus = SGX_ERROR_INVALID_PARAMETER;\n\ +\t\t\tgoto err;\n\ +\t\t}" fn in_ptr_name len_var + in + let malloc_and_copy pre_indent = + match attr.Ast.pa_direction with + Ast.PtrIn | Ast.PtrInOut -> + let code_template = [ + sprintf "if (%s != NULL) {" tmp_ptr_name; + sprintf "\t%s = (%s)malloc(%s);" in_ptr_name in_ptr_type len_var; + sprintf "\tif (%s == NULL) {" in_ptr_name; + "\t\tstatus = SGX_ERROR_OUT_OF_MEMORY;"; + "\t\tgoto err;"; + "\t}\n"; + sprintf "\tmemcpy(%s, %s, %s);" in_ptr_dst_name tmp_ptr_name len_var; + ] + in + let s1 = List.fold_left (fun acc s -> acc ^ pre_indent ^ s ^ "\n") "" code_template in + let s2 = + if attr.Ast.pa_isstr + then sprintf "%s\t\t%s[%s - 1] = '\\0';\n" s1 in_ptr_name len_var + else if attr.Ast.pa_iswstr + then sprintf "%s\t\t%s[(%s - sizeof(wchar_t))/sizeof(wchar_t)] = (wchar_t)0;\n" s1 in_ptr_name len_var + else s1 in + let s3 = + match attr.Ast.pa_size.Ast.ps_sizefunc with + None -> s2 + | Some s -> sprintf "%s\n%s\n" s2 (check_sizefunc_ptr(s)) + in sprintf "%s\t}\n" s3 + | Ast.PtrOut -> + let code_template = [ + sprintf "if (%s != NULL) {" tmp_ptr_name; + sprintf "\tif ((%s = (%s)malloc(%s)) == NULL) {" in_ptr_name in_ptr_type len_var; + "\t\tstatus = SGX_ERROR_OUT_OF_MEMORY;"; + "\t\tgoto err;"; + "\t}\n"; + sprintf "\tmemset((void*)%s, 0, %s);" in_ptr_name len_var; + "}"] + in + List.fold_left (fun acc s -> acc ^ pre_indent ^ s ^ "\n") "" code_template + | _ -> "" + in + malloc_and_copy "\t" + in List.fold_left + (fun acc (pty, declr) -> + match pty with + Ast.PTVal _ -> acc + | Ast.PTPtr (ty, attr) -> acc ^ clone_in_ptr ty attr declr) "" plist + +(* Generate the code to handle function pointer parameter direction, + * which is to be inserted after finishing calling the trusted function. + *) +let gen_parm_ptr_direction_post (plist: Ast.pdecl list) = + let copy_and_free (attr: Ast.ptr_attr) (declr: Ast.declarator) = + let name = declr.Ast.identifier in + let in_ptr_name = mk_in_var name in + let len_var = mk_len_var name in + let in_ptr_dst_name = mk_in_ptr_dst_name attr.Ast.pa_rdonly in_ptr_name in + match attr.Ast.pa_direction with + Ast.PtrIn -> sprintf "\tif (%s) free(%s);\n" in_ptr_name in_ptr_dst_name + | Ast.PtrInOut | Ast.PtrOut -> + sprintf "\tif (%s) {\n\t\tmemcpy(%s, %s, %s);\n\t\tfree(%s);\n\t}\n" + in_ptr_name + (mk_tmp_var name) + in_ptr_name + len_var + in_ptr_name + | _ -> "" + in List.fold_left + (fun acc (pty, declr) -> + match pty with + Ast.PTVal _ -> acc + | Ast.PTPtr (ty, attr) -> acc ^ copy_and_free attr declr) "" plist + + +(* Generate an "err:" goto mark if necessary. *) +let gen_err_mark (plist: Ast.pdecl list) = + let has_inout_p (attr: Ast.ptr_attr): bool = + attr.Ast.pa_direction <> Ast.PtrNoDirection + in + if List.exists (fun (pt, name) -> + match pt with + Ast.PTVal _ -> false + | Ast.PTPtr(_, attr) -> has_inout_p attr) plist + then "err:" + else "" + +(* It is used to save the parameters used as the value of size/count attribute. *) +let param_cache = Hashtbl.create 1 +let is_in_param_cache s = Hashtbl.mem param_cache s + +(* Try to generate a temporary value to save the size of the buffer. *) +let gen_tmp_size (pattr: Ast.ptr_attr) (plist: Ast.pdecl list) = + let do_gen_temp_var (s: string) = + if is_in_param_cache s then "" + else + let param_tystr = find_param_type s plist in + let tmp_var = mk_tmp_var s in + let parm_str = mk_parm_accessor s in + Hashtbl.add param_cache s true; + sprintf "\t%s %s = %s;\n" param_tystr tmp_var parm_str + in + let gen_temp_var (v: Ast.attr_value) = + match v with + Ast.ANumber _ -> "" + | Ast.AString s -> do_gen_temp_var s + in + let tmp_size_str = + match pattr.Ast.pa_size.Ast.ps_size with + Some v -> gen_temp_var v + | None -> "" + in + let tmp_count_str = + match pattr.Ast.pa_size.Ast.ps_count with + Some v -> gen_temp_var v + | None -> "" + in + sprintf "%s%s" tmp_size_str tmp_count_str + +let is_ptr (pt: Ast.parameter_type) = + match pt with + Ast.PTVal _ -> false + | Ast.PTPtr _ -> true + +let is_ptr_type (aty: Ast.atype) = + match aty with + Ast.Ptr _ -> true + | _ -> false + +let ptr_has_direction (pt: Ast.parameter_type) = + match pt with + Ast.PTVal _ -> false + | Ast.PTPtr(_, a) -> a.Ast.pa_direction <> Ast.PtrNoDirection + +let tbridge_mk_parm_name_ext (pt: Ast.parameter_type) (declr: Ast.declarator) = + if is_in_param_cache declr.Ast.identifier || (is_ptr pt && (not (is_foreign_array pt))) + then + if ptr_has_direction pt + then mk_in_var declr.Ast.identifier + else mk_tmp_var declr.Ast.identifier + else mk_parm_name_ext pt declr + +let mk_parm_name_tbridge (pt: Ast.parameter_type) (declr: Ast.declarator) = + add_foreign_array_ptrref tbridge_mk_parm_name_ext pt declr + +(* Generate local variables required for the trusted bridge. *) +let gen_tbridge_local_vars (plist: Ast.pdecl list) = + let status_var = "\tsgx_status_t status = SGX_SUCCESS;\n" in + let do_gen_local_var (ty: Ast.atype) (attr: Ast.ptr_attr) (name: string) = + let tmp_var = + (* Save a copy of pointer in case it might be modified in the marshaling structure. *) + sprintf "\t%s %s = %s;\n" (Ast.get_tystr ty) (mk_tmp_var name) (mk_parm_accessor name) + in + let len_var = + if not attr.Ast.pa_chkptr then "" + else gen_tmp_size attr plist ^ "\t" ^ gen_ptr_size ty attr name mk_tmp_var in + let in_ptr = + match attr.Ast.pa_direction with + Ast.PtrNoDirection -> "" + | _ -> sprintf "\t%s %s = NULL;\n" (Ast.get_tystr ty) (mk_in_var name) + in + tmp_var ^ len_var ^ in_ptr + in + let gen_local_var_for_foreign_array (ty: Ast.atype) (attr: Ast.ptr_attr) (name: string) = + let tystr = Ast.get_tystr ty in + let tmp_var = + sprintf "\t%s* %s = %s;\n" tystr (mk_tmp_var name) (mk_parm_accessor name) + in + let len_var = sprintf "\tsize_t %s = sizeof(%s);\n" (mk_len_var name) tystr + in + let in_ptr = sprintf "\t%s* %s = NULL;\n" tystr (mk_in_var name) + in + match attr.Ast.pa_direction with + Ast.PtrNoDirection -> "" + | _ -> tmp_var ^ len_var ^ in_ptr + in + let gen_local_var (pd: Ast.pdecl) = + let (pty, declr) = pd in + match pty with + Ast.PTVal _ -> "" + | Ast.PTPtr (ty, attr) -> + if is_foreign_array pty + then gen_local_var_for_foreign_array ty attr declr.Ast.identifier + else do_gen_local_var ty attr declr.Ast.identifier + in + let new_param_list = List.map conv_array_to_ptr plist + in + Hashtbl.clear param_cache; + List.fold_left (fun acc pd -> acc ^ gen_local_var pd) status_var new_param_list + +(* It generates trusted bridge code for a trusted function. *) +let gen_func_tbridge (fd: Ast.func_decl) (dummy_var: string) = + let func_open = sprintf "static sgx_status_t SGX_CDECL %s(void* %s)\n{\n" + (mk_tbridge_name fd.Ast.fname) + ms_ptr_name in + let local_vars = gen_tbridge_local_vars fd.Ast.plist in + let func_close = "\treturn status;\n}\n" in + + let ms_struct_name = mk_ms_struct_name fd.Ast.fname in + let declare_ms_ptr = sprintf "%s* %s = SGX_CAST(%s*, %s);" + ms_struct_name + ms_struct_val + ms_struct_name + ms_ptr_name in + + let invoke_func = gen_func_invoking fd mk_parm_name_tbridge in + let update_retval = sprintf "%s = %s" + (mk_parm_accessor retval_name) + invoke_func in + + if is_naked_func fd then + let check_pms = + sprintf "if (%s != NULL) return SGX_ERROR_INVALID_PARAMETER;" ms_ptr_name + in + sprintf "%s%s%s\t%s\n\t%s\n%s" func_open local_vars dummy_var check_pms invoke_func func_close + else + sprintf "%s\t%s\n%s\n%s%s%s\n%s\t%s\n%s\n%s\n%s" + func_open + declare_ms_ptr + local_vars + (gen_check_tbridge_length_overflow fd.Ast.plist) + (mk_check_pms fd.Ast.fname) + (gen_check_tbridge_ptr_parms fd.Ast.plist) + (gen_parm_ptr_direction_pre fd.Ast.plist) + (if fd.Ast.rtype <> Ast.Void then update_retval else invoke_func) + (gen_err_mark fd.Ast.plist) + (gen_parm_ptr_direction_post fd.Ast.plist) + func_close + +let tproxy_fill_ms_field (pd: Ast.pdecl) = + let (pt, declr) = pd in + let name = declr.Ast.identifier in + let len_var = mk_len_var name in + let parm_accessor = mk_parm_accessor name in + match pt with + Ast.PTVal _ -> fill_ms_field true pd + | Ast.PTPtr(ty, attr) -> + let is_ary = (Ast.is_array declr || attr.Ast.pa_isary) in + let tystr = sprintf "%s%s" (get_param_tystr pt) (if is_ary then "*" else "") in + if is_ary && is_ptr_type ty then + sprintf "\n#pragma message(\"Pointer array `%s' in trusted proxy `\"\ + __FUNCTION__ \"' is dangerous. No code generated.\")\n" name + else + let in_ptr_dst_name = mk_in_ptr_dst_name attr.Ast.pa_rdonly parm_accessor in + if not attr.Ast.pa_chkptr (* [user_check] specified *) + then sprintf "%s = SGX_CAST(%s, %s);" parm_accessor tystr name + else + match attr.Ast.pa_direction with + Ast.PtrOut -> + let code_template = + [sprintf "if (%s != NULL && sgx_is_within_enclave(%s, %s)) {" name name len_var; + sprintf "\t%s = (%s)__tmp;" parm_accessor tystr; + sprintf "\t__tmp = (void *)((size_t)__tmp + %s);" len_var; + sprintf "\tmemset(%s, 0, %s);" in_ptr_dst_name len_var; + sprintf "} else if (%s == NULL) {" name; + sprintf "\t%s = NULL;" parm_accessor; + "} else {"; + "\tsgx_ocfree();"; + "\treturn SGX_ERROR_INVALID_PARAMETER;"; + "}" + ] + in List.fold_left (fun acc s -> acc ^ s ^ "\n\t") "" code_template + | _ -> + let code_template = + [sprintf "if (%s != NULL && sgx_is_within_enclave(%s, %s)) {" name name len_var; + sprintf "\t%s = (%s)__tmp;" parm_accessor tystr; + sprintf "\t__tmp = (void *)((size_t)__tmp + %s);" len_var; + sprintf "\tmemcpy(%s, %s, %s);" in_ptr_dst_name name len_var; + sprintf "} else if (%s == NULL) {" name; + sprintf "\t%s = NULL;" parm_accessor; + "} else {"; + "\tsgx_ocfree();"; + "\treturn SGX_ERROR_INVALID_PARAMETER;"; + "}" + ] + in List.fold_left (fun acc s -> acc ^ s ^ "\n\t") "" code_template + +(* Generate local variables required for the trusted proxy. *) +let gen_tproxy_local_vars (plist: Ast.pdecl list) = + let status_var = "sgx_status_t status = SGX_SUCCESS;\n" in + let do_gen_local_var (ty: Ast.atype) (attr: Ast.ptr_attr) (name: string) = + if not attr.Ast.pa_chkptr then "" + else "\t" ^ gen_ptr_size ty attr name (fun x -> x) + in + let gen_local_var (pd: Ast.pdecl) = + let (pty, declr) = pd in + match pty with + Ast.PTVal _ -> "" + | Ast.PTPtr (ty, attr) -> do_gen_local_var ty attr declr.Ast.identifier + in + let new_param_list = List.map conv_array_to_ptr plist + in + List.fold_left (fun acc pd -> acc ^ gen_local_var pd) status_var new_param_list + +(* Generate only one ocalloc block required for the trusted proxy. *) +let gen_ocalloc_block (fname: string) (plist: Ast.pdecl list) = + let ms_struct_name = mk_ms_struct_name fname in + let local_vars_block = sprintf "%s* %s = NULL;\n\tsize_t ocalloc_size = sizeof(%s);\n\tvoid *__tmp = NULL;\n\n" ms_struct_name ms_struct_val ms_struct_name in + let count_ocalloc_size (ty: Ast.atype) (attr: Ast.ptr_attr) (name: string) = + if not attr.Ast.pa_chkptr then "" + else sprintf "\tocalloc_size += (%s != NULL && sgx_is_within_enclave(%s, %s)) ? %s : 0;\n" name name (mk_len_var name) (mk_len_var name) + in + let do_count_ocalloc_size (pd: Ast.pdecl) = + let (pty, declr) = pd in + match pty with + Ast.PTVal _ -> "" + | Ast.PTPtr (ty, attr) -> count_ocalloc_size ty attr declr.Ast.identifier + in + let do_gen_ocalloc_block = [ + "\n\t__tmp = sgx_ocalloc(ocalloc_size);\n"; + "\tif (__tmp == NULL) {\n"; + "\t\tsgx_ocfree();\n"; + "\t\treturn SGX_ERROR_UNEXPECTED;\n"; + "\t}\n"; + sprintf "\t%s = (%s*)__tmp;\n" ms_struct_val ms_struct_name; + sprintf "\t__tmp = (void *)((size_t)__tmp + sizeof(%s));\n" ms_struct_name; + ] + in + let new_param_list = List.map conv_array_to_ptr plist + in + let s1 = List.fold_left (fun acc pd -> acc ^ do_count_ocalloc_size pd) local_vars_block new_param_list in + List.fold_left (fun acc s -> acc ^ s) s1 do_gen_ocalloc_block + +(* Generate trusted proxy code for a given untrusted function. *) +let gen_func_tproxy (ufunc: Ast.untrusted_func) (idx: int) = + let fd = ufunc.Ast.uf_fdecl in + let propagate_errno = ufunc.Ast.uf_propagate_errno in + let func_open = sprintf "%s\n{\n" (gen_tproxy_proto fd) in + let local_vars = gen_tproxy_local_vars fd.Ast.plist in + let ocalloc_ms_struct = gen_ocalloc_block fd.Ast.fname fd.Ast.plist in + let gen_ocfree rtype plist = + if rtype = Ast.Void && plist = [] then "" else "\tsgx_ocfree();\n" + in + let handle_out_ptr plist = + let copy_memory (attr: Ast.ptr_attr) (declr: Ast.declarator) = + let name = declr.Ast.identifier in + match attr.Ast.pa_direction with + Ast.PtrInOut | Ast.PtrOut -> + sprintf "\tif (%s) memcpy((void*)%s, %s, %s);\n" name name (mk_parm_accessor name) (mk_len_var name) + | _ -> "" + in List.fold_left (fun acc (pty, declr) -> + match pty with + Ast.PTVal _ -> acc + | Ast.PTPtr(ty, attr) -> acc ^ copy_memory attr declr) "" plist in + + let set_errno = if propagate_errno then "\terrno = ms->ocall_errno;" else "" in + let func_close = sprintf "%s%s\n%s%s\n" + (handle_out_ptr fd.Ast.plist) + set_errno + (gen_ocfree fd.Ast.rtype fd.Ast.plist) + "\treturn status;\n}" in + let ocall_null = sprintf "status = sgx_ocall(%d, NULL);\n" idx in + let ocall_with_ms = sprintf "status = sgx_ocall(%d, %s);\n" + idx ms_struct_val in + let update_retval = sprintf "if (%s) *%s = %s;" + retval_name retval_name (mk_parm_accessor retval_name) in + let func_body = ref [] in + if (is_naked_func fd) && (propagate_errno = false) then + sprintf "%s\t%s\t%s%s" func_open local_vars ocall_null func_close + else + begin + func_body := local_vars :: !func_body; + func_body := ocalloc_ms_struct:: !func_body; + List.iter (fun pd -> func_body := tproxy_fill_ms_field pd :: !func_body) fd.Ast.plist; + func_body := ocall_with_ms :: !func_body; + if fd.Ast.rtype <> Ast.Void then func_body := update_retval :: !func_body; + List.fold_left (fun acc s -> acc ^ "\t" ^ s ^ "\n") func_open (List.rev !func_body) ^ func_close + end + +(* It generates OCALL table and the untrusted proxy to setup OCALL table. *) +let gen_ocall_table (ec: enclave_content) = + let func_proto_ubridge = List.map (fun (uf: Ast.untrusted_func) -> + let fd : Ast.func_decl = uf.Ast.uf_fdecl in + mk_ubridge_name ec.file_shortnm fd.Ast.fname) + ec.ufunc_decls in + let nr_ocall = List.length ec.ufunc_decls in + let ocall_table_name = mk_ocall_table_name ec.enclave_name in + let ocall_table = + let ocall_members = + List.fold_left + (fun acc proto -> acc ^ "\t\t(void*)" ^ proto ^ ",\n") "" func_proto_ubridge + in "\t{\n" ^ ocall_members ^ "\t}\n" + in + sprintf "static const struct {\n\ +\tsize_t nr_ocall;\n\ +\tvoid * table[%d];\n\ +} %s = {\n\ +\t%d,\n\ +%s};\n" (max nr_ocall 1) + ocall_table_name + nr_ocall + (if nr_ocall <> 0 then ocall_table else "\t{ NULL },\n") + +(* It generates untrusted code to be saved in a `.c' file. *) +let gen_untrusted_source (ec: enclave_content) = + let code_fname = get_usource_name ec.file_shortnm in + let include_hd = "#include \"" ^ get_uheader_short_name ec.file_shortnm ^ "\"\n" in + let include_errno = "#include \n" in + let uproxy_list = + List.map2 (fun fd ecall_idx -> gen_func_uproxy fd ecall_idx ec) + (tf_list_to_fd_list ec.tfunc_decls) + (Util.mk_seq 0 (List.length ec.tfunc_decls - 1)) + in + let ubridge_list = + List.map (fun fd -> gen_func_ubridge ec.file_shortnm fd) + (ec.ufunc_decls) in + let out_chan = open_out code_fname in + output_string out_chan (include_hd ^ include_errno ^ "\n"); + ms_writer out_chan ec; + List.iter (fun s -> output_string out_chan (s ^ "\n")) ubridge_list; + output_string out_chan (gen_ocall_table ec); + List.iter (fun s -> output_string out_chan (s ^ "\n")) uproxy_list; + close_out out_chan + +(* It generates trusted code to be saved in a `.c' file. *) +let gen_trusted_source (ec: enclave_content) = + let code_fname = get_tsource_name ec.file_shortnm in + let include_hd = "#include \"" ^ get_theader_short_name ec.file_shortnm ^ "\"\n\n\ +#include \"sgx_trts.h\" /* for sgx_ocalloc, sgx_is_outside_enclave */\n\n\ +#include \n\ +#include /* for memcpy etc */\n\ +#include /* for malloc/free etc */\n\ +\n\ +#define CHECK_REF_POINTER(ptr, siz) do {\t\\\n\ +\tif (!(ptr) || ! sgx_is_outside_enclave((ptr), (siz)))\t\\\n\ +\t\treturn SGX_ERROR_INVALID_PARAMETER;\\\n\ +} while (0)\n\ +\n\ +#define CHECK_UNIQUE_POINTER(ptr, siz) do {\t\\\n\ +\tif ((ptr) && ! sgx_is_outside_enclave((ptr), (siz)))\t\\\n\ +\t\treturn SGX_ERROR_INVALID_PARAMETER;\\\n\ +} while (0)\n\ +\n" in + let trusted_fds = tf_list_to_fd_list ec.tfunc_decls in + let tbridge_list = + let dummy_var = tbridge_gen_dummy_variable ec in + List.map (fun tfd -> gen_func_tbridge tfd dummy_var) trusted_fds in + let ecall_table = gen_ecall_table ec.tfunc_decls in + let entry_table = gen_entry_table ec in + let tproxy_list = List.map2 + (fun fd idx -> gen_func_tproxy fd idx) + (ec.ufunc_decls) + (Util.mk_seq 0 (List.length ec.ufunc_decls - 1)) in + let out_chan = open_out code_fname in + output_string out_chan (include_hd ^ "\n"); + ms_writer out_chan ec; + List.iter (fun s -> output_string out_chan (s ^ "\n")) tbridge_list; + output_string out_chan (ecall_table ^ "\n"); + output_string out_chan (entry_table ^ "\n"); + output_string out_chan "\n"; + List.iter (fun s -> output_string out_chan (s ^ "\n")) tproxy_list; + close_out out_chan + +(* We use a stack to keep record of imported files. + * + * A file will be pushed to the stack before we parsing it, + * and we will pop the stack after each `parse_import_file'. + *) +let already_read = SimpleStack.create () +let save_file fullpath = + if SimpleStack.mem fullpath already_read + then failwithf "detected circled import for `%s'" fullpath + else SimpleStack.push fullpath already_read + +(* The entry point of the Edger8r parser front-end. + * ------------------------------------------------ + *) +let start_parsing (fname: string) : Ast.enclave = + let set_initial_pos lexbuf filename = + lexbuf.Lexing.lex_curr_p <- { + lexbuf.Lexing.lex_curr_p with Lexing.pos_fname = fname; + } + in + try + let chan = + let fullpath = Util.get_file_path fname + in save_file fullpath; open_in fullpath in + let lexbuf = Lexing.from_channel chan in + try + set_initial_pos lexbuf fname; + let e : Ast.enclave = Parser.start_parsing Lexer.tokenize lexbuf in + let short_name = Util.get_short_name fname in + if short_name = "" + then (eprintf "error: %s: file short name is empty\n" fname; exit 1;) + else + let res = { e with Ast.ename = short_name } in + if Util.is_c_identifier short_name then res + else (eprintf "warning: %s: file short name `%s' is not a valid C identifier\n" fname short_name; res) + with exn -> close_in chan; + begin match exn with + | Parsing.Parse_error -> + let curr = lexbuf.Lexing.lex_curr_p in + let line = curr.Lexing.pos_lnum in + let cnum = curr.Lexing.pos_cnum - curr.Lexing.pos_bol in + let tok = Lexing.lexeme lexbuf in + failwithf "%s:%d:%d: unexpected token: %s\n" fname line cnum tok + | _ -> raise exn + end + with Sys_error s -> failwithf "%s\n" s + +(* Check duplicated ECALL/OCALL names. + * + * This is a pretty simple implementation - to improve it, the + * location information of each token should be carried to AST. + *) +let check_duplication (ec: enclave_content) = + let dict = Hashtbl.create 10 in + let trusted_fds = tf_list_to_fd_list ec.tfunc_decls in + let untrusted_fds = uf_list_to_fd_list ec.ufunc_decls in + let check_and_add fname = + if Hashtbl.mem dict fname then + failwithf "Multiple definition of function \"%s\" detected." fname + else + Hashtbl.add dict fname true + in + List.iter (fun (fd: Ast.func_decl) -> + check_and_add fd.Ast.fname) (trusted_fds @ untrusted_fds) + +(* For each untrusted functions, check that allowed ECALL does exist. *) +let check_allow_list (ec: enclave_content) = + let trusted_func_names = get_trusted_func_names ec in + let do_check_allow_list fname allowed_ecalls = + List.iter (fun trusted_func -> + if List.exists (fun x -> x = trusted_func) trusted_func_names + then () + else + failwithf "\"%s\" declared to allow unknown function \"%s\"." + fname trusted_func) allowed_ecalls + in + List.iter (fun (uf: Ast.untrusted_func) -> + let fd = uf.Ast.uf_fdecl in + let allowed_ecalls = uf.Ast.uf_allow_list in + do_check_allow_list fd.Ast.fname allowed_ecalls) ec.ufunc_decls + +(* Report private ECALL not used in any "allow(...)" expression. *) +let report_orphaned_priv_ecall (ec: enclave_content) = + let priv_ecall_names = get_priv_ecall_names ec.tfunc_decls in + let allowed_names = get_allowed_names ec.ufunc_decls in + let check_ecall n = if List.mem n allowed_names then () + else eprintf "warning: private ECALL `%s' is not used by any OCALL\n" n + in + List.iter check_ecall priv_ecall_names + +(* Check that there is at least one public ECALL function. *) +let check_priv_funcs (ec: enclave_content) = + let priv_bits = tf_list_to_priv_list ec.tfunc_decls in + if List.for_all (fun is_priv -> is_priv) priv_bits + then failwithf "the enclave `%s' contains no public root ECALL.\n" ec.file_shortnm + else report_orphaned_priv_ecall ec + +(* When generating edge-routines, it need first to check whether there + * are `import' expressions inside EDL. If so, it will parse the given + * importing file to get an `enclave_content' record, recursively. + * + * `ec' is the toplevel `enclave_content' record. + + * Here, a tree reduce algorithm is used. `ec' is the root-node, each + * `import' expression is considerred as a children. + *) +let reduce_import (ec: enclave_content) = + let combine (ec1: enclave_content) (ec2: enclave_content) = + { ec1 with + include_list = ec1.include_list @ ec2.include_list; + import_exprs = []; + comp_defs = ec1.comp_defs @ ec2.comp_defs; + tfunc_decls = ec1.tfunc_decls @ ec2.tfunc_decls; + ufunc_decls = ec1.ufunc_decls @ ec2.ufunc_decls; } + in + let parse_import_file fname = + let ec = parse_enclave_ast (start_parsing fname) + in + match ec.import_exprs with + [] -> (SimpleStack.pop already_read |> ignore; ec ) + | _ -> ec + in + let check_funs funcs (ec: enclave_content) = + (* Check whether `funcs' are listed in `ec'. It returns a + production (x, y), where: + x - functions not listed in `ec'; + y - a new `ec' that contains functions from `funcs' listed in `ec'. + *) + let enclave_funcs = + let trusted_func_names = get_trusted_func_names ec in + let untrusted_func_names = get_untrusted_func_names ec in + trusted_func_names @ untrusted_func_names + in + let in_ec_def name = List.exists (fun x -> x = name) enclave_funcs in + let in_import_list name = List.exists (fun x -> x = name) funcs in + let x = List.filter (fun name -> not (in_ec_def name)) funcs in + let y = + { empty_ec with + tfunc_decls = List.filter (fun tf -> + in_import_list (get_tf_fname tf)) ec.tfunc_decls; + ufunc_decls = List.filter (fun uf -> + in_import_list (get_uf_fname uf)) ec.ufunc_decls; } + in (x, y) + in + (* Import functions listed in `funcs' from `importee'. *) + let rec import_funcs (funcs: string list) (importee: enclave_content) = + (* A `*' means importing all the functions. *) + if List.exists (fun x -> x = "*") funcs + then + List.fold_left (fun acc (ipd: Ast.import_decl) -> + let next_ec = parse_import_file ipd.Ast.mname + in combine acc (import_funcs ipd.Ast.flist next_ec)) importee importee.import_exprs + else + let (x, y) = check_funs funcs importee + in + if x = [] then y (* Resolved all importings *) + else + match importee.import_exprs with + [] -> failwithf "import failed - functions `%s' not found" (List.hd x) + | ex -> List.fold_left (fun acc (ipd: Ast.import_decl) -> + let next_ec = parse_import_file ipd.Ast.mname + in combine acc (import_funcs x next_ec)) y ex + in + import_funcs ["*"] ec + +(* Generate the Enclave code. *) +let gen_enclave_code (e: Ast.enclave) (ep: edger8r_params) = + let ec = reduce_import (parse_enclave_ast e) in + g_use_prefix := ep.use_prefix; + g_untrusted_dir := ep.untrusted_dir; + g_trusted_dir := ep.trusted_dir; + create_dir ep.untrusted_dir; + create_dir ep.trusted_dir; + check_duplication ec; + check_allow_list ec; + (if not ep.header_only then check_priv_funcs ec); + (if ep.gen_untrusted then (gen_untrusted_header ec; if not ep.header_only then gen_untrusted_source ec)); + (if ep.gen_trusted then (gen_trusted_header ec; if not ep.header_only then gen_trusted_source ec)) diff --git a/sdk/edger8r/linux/Edger8r.ml b/sdk/edger8r/linux/Edger8r.ml new file mode 100644 index 0000000000..76d587e309 --- /dev/null +++ b/sdk/edger8r/linux/Edger8r.ml @@ -0,0 +1,46 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + + +let _ = + let progname = Sys.argv.(0) in + let argc = Array.length Sys.argv in + let args = if argc = 1 then [||] else Array.sub Sys.argv 1 (argc-1) in + let cmd_params = Util.parse_cmdline progname (Array.to_list args) in + + let real_ast_handler fname = + try + CodeGen.gen_enclave_code (CodeGen.start_parsing fname) cmd_params + with + Failure s -> (Printf.eprintf "error: %s\n" s; exit (-1)) + in + if cmd_params.Util.input_files = [] then Util.usage progname + else List.iter real_ast_handler cmd_params.Util.input_files diff --git a/sdk/edger8r/linux/Lexer.mll b/sdk/edger8r/linux/Lexer.mll new file mode 100644 index 0000000000..0eb7c16ec2 --- /dev/null +++ b/sdk/edger8r/linux/Lexer.mll @@ -0,0 +1,124 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +{ +open Parser + +let string_to_int32 s = int_of_string s +} + +(* These are some regular expression definitions *) +let open_comment = "/*" +let close_comment = "*/" +let line_comment = "//" + +let space = [' ' '\t'] +let newline = ('\n' | '\r' '\n') +let digit = ['0' - '9'] +let ident = ['_' 'a' - 'z' 'A' - 'Z'] +let identifier = ident(ident|digit)* +let number = digit+ +let string = '"' [^'"']* '"' (* No embedded '\"' *) + +rule tokenize = parse + (* space and newline *) + | space { tokenize lexbuf } + | newline { Lexing.new_line lexbuf; tokenize lexbuf } + + (* data types *) + | "char" { Tchar } + | "short" { Tshort } + | "unsigned" { Tunsigned } + | "int" { Tint } + | "float" { Tfloat } + | "double" { Tdouble } + + | "int8_t" { Tint8 } + | "int16_t" { Tint16 } + | "int32_t" { Tint32 } + | "int64_t" { Tint64 } + + | "uint8_t" { Tuint8 } + | "uint16_t" { Tuint16 } + | "uint32_t" { Tuint32 } + | "uint64_t" { Tuint64 } + + | "size_t" { Tsizet } + | "wchar_t" { Twchar } + | "long" { Tlong } + | "void" { Tvoid } + + | "struct" { Tstruct } + | "union" { Tunion } + | "enum" { Tenum } + + (* specifier *) + | "enclave" { Tenclave } + | "trusted" { Ttrusted } + | "untrusted" { Tuntrusted } + | "from" { Tfrom } + | "import" { Timport } + | "allow" { Tallow } + | "public" { Tpublic } + | "include" { Tinclude } + | "propagate_errno" { Tpropagate_errno } + + (* Type qualifier *) + | "const" { Tconst } + + (* symbols *) + | '{' { TLBrace } + | '}' { TRBrace } + | '(' { TLParen } + | ')' { TRParen } + | '[' { TLBrack } + | ']' { TRBrack } + | '*' { TPtr } + | '.' { TDot } + | ',' { TComma } + | ';' { TSemicolon } + | '=' { TEqual } + | identifier { Tidentifier(Lexing.lexeme lexbuf) } + | number { Tnumber(string_to_int32(Lexing.lexeme lexbuf)) } + | string { let s = Lexing.lexeme lexbuf in Tstring(String.sub s 1 (String.length s - 2)) } + + (* comments *) + | line_comment { eat_until_nl lexbuf } + | open_comment { comment lexbuf } + | eof { EOF } + | _ { failwith ("Invalid token: " ^ Lexing.lexeme(lexbuf)) } +and eat_until_nl = parse + | newline { Lexing.new_line lexbuf; tokenize lexbuf } + | _ { eat_until_nl lexbuf } +and comment = parse (* comments can't be nested *) + close_comment { tokenize lexbuf } + | newline { Lexing.new_line lexbuf; comment lexbuf } + | _ { comment lexbuf } diff --git a/sdk/edger8r/linux/Makefile b/sdk/edger8r/linux/Makefile new file mode 100644 index 0000000000..007117b2be --- /dev/null +++ b/sdk/edger8r/linux/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +.PHONY: all +all: build | $(BUILD_DIR) + @$(CP) $(CUR_DIR)/_build/Edger8r.native $(BUILD_DIR)/sgx_edger8r + +.PHONY: build +build: + ocamlbuild -no-links -libs str,unix Edger8r.native + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: +clean: + @ocamlbuild Edger8r.native -clean + @$(RM) $(BUILD_DIR)/sgx_edger8r diff --git a/sdk/edger8r/linux/Parser.mly b/sdk/edger8r/linux/Parser.mly new file mode 100644 index 0000000000..a5dabc3368 --- /dev/null +++ b/sdk/edger8r/linux/Parser.mly @@ -0,0 +1,606 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +%{ +open Util (* for failwithf *) + +(* Here we defined some helper routines to check attributes. + * + * An alternative approach is to code these rules in Lexer/Parser but + * it has several drawbacks: + * + * 1. Bad extensibility; + * 2. It grows the table size and down-graded the parsing time; + * 3. It makes error reporting rigid this way. + *) + +let get_string_from_attr (v: Ast.attr_value) (err_func: int -> string) = + match v with + Ast.AString s -> s + | Ast.ANumber n -> err_func n + +(* Check whether 'size' or 'sizefunc' is specified. *) +let has_size (sattr: Ast.ptr_size) = + sattr.Ast.ps_size <> None || sattr.Ast.ps_sizefunc <> None + +(* Pointers can have the following attributes: + * + * 'size' - specifies the size of the pointer. + * e.g. size = 4, size = val ('val' is a parameter); + * + * 'count' - indicates how many of items is managed by the pointer + * e.g. count = 100, count = n ('n' is a parameter); + * + * 'sizefunc' - use a function to compute the size of the pointer. + * e.g. sizefunc = get_ptr_size + * + * 'string' - indicate the pointer is managing a C string; + * 'wstring' - indicate the pointer is managing a wide char string. + * + * 'isptr' - to specify that the foreign type is a pointer. + * 'isary' - to specify that the foreign type is an array. + * 'readonly' - to specify that the foreign type has a 'const' qualifier. + * + * 'user_check' - inhibit Edger8r from generating code to check the pointer. + * + * 'in' - the pointer is used as input + * 'out' - the pointer is used as output + * + * Note that 'size' and 'sizefunc' are mutual exclusive (but they can + * be used together with 'count'. 'string' and 'wstring' indicates 'isptr', + * and they cannot use with only an 'out' attribute. + *) +let get_ptr_attr (attr_list: (string * Ast.attr_value) list) = + let get_new_dir (cds: string) (cda: Ast.ptr_direction) (old: Ast.ptr_direction) = + if old = Ast.PtrNoDirection then cda + else if old = Ast.PtrInOut then failwithf "duplicated attribute: `%s'" cds + else if old = cda then failwithf "duplicated attribute: `%s'" cds + else Ast.PtrInOut + in + let update_attr (key: string) (value: Ast.attr_value) (res: Ast.ptr_attr) = + match key with + "size" -> + { res with Ast.pa_size = { res.Ast.pa_size with Ast.ps_size = Some value }} + | "count" -> + { res with Ast.pa_size = { res.Ast.pa_size with Ast.ps_count = Some value }} + | "sizefunc" -> + let efn n = failwithf "invalid function name (%d) for `sizefunc'" n in + let funcname = get_string_from_attr value efn + in { res with Ast.pa_size = + { res.Ast.pa_size with Ast.ps_sizefunc = Some funcname }} + | "string" -> { res with Ast.pa_isptr = true; Ast.pa_isstr = true; } + | "wstring" -> { res with Ast.pa_isptr = true; Ast.pa_iswstr = true; } + | "isptr" -> { res with Ast.pa_isptr = true } + | "isary" -> { res with Ast.pa_isary = true } + + | "readonly" -> { res with Ast.pa_rdonly = true } + | "user_check" -> { res with Ast.pa_chkptr = false } + + | "in" -> + let newdir = get_new_dir "in" Ast.PtrIn res.Ast.pa_direction + in { res with Ast.pa_direction = newdir } + | "out" -> + let newdir = get_new_dir "out" Ast.PtrOut res.Ast.pa_direction + in { res with Ast.pa_direction = newdir } + | _ -> failwithf "unknown attribute: %s" key + in + let rec do_get_ptr_attr alist res_attr = + match alist with + [] -> res_attr + | (k,v) :: xs -> do_get_ptr_attr xs (update_attr k v res_attr) + in + let has_str_attr (pattr: Ast.ptr_attr) = + if pattr.Ast.pa_isstr && pattr.Ast.pa_iswstr + then failwith "`string' and `wstring' are mutual exclusive" + else (pattr.Ast.pa_isstr || pattr.Ast.pa_iswstr) + in + let check_invalid_ptr_size (pattr: Ast.ptr_attr) = + let ps = pattr.Ast.pa_size in + if ps.Ast.ps_size <> None && ps.Ast.ps_sizefunc <> None + then failwith "`size' and `sizefunc' cannot be used at the same time" + else + if ps <> Ast.empty_ptr_size && has_str_attr pattr + then failwith "size attributes are mutual exclusive with (w)string attribute" + else + if (ps <> Ast.empty_ptr_size || has_str_attr pattr) && + pattr.Ast.pa_direction = Ast.PtrNoDirection + then failwith "size/string attributes must be used with pointer direction" + else pattr + in + let check_ptr_dir (pattr: Ast.ptr_attr) = + if pattr.Ast.pa_direction <> Ast.PtrNoDirection && pattr.Ast.pa_chkptr = false + then failwith "pointer direction and `user_check' are mutual exclusive" + else + if pattr.Ast.pa_direction = Ast.PtrNoDirection && pattr.Ast.pa_chkptr + then failwith "pointer/array should have direction attribute or `user_check'" + else + if pattr.Ast.pa_direction = Ast.PtrOut && (has_str_attr pattr || pattr.Ast.pa_size.Ast.ps_sizefunc <> None) + then failwith "string/wstring/sizefunc should be used with an `in' attribute" + else pattr + in + let check_invalid_ary_attr (pattr: Ast.ptr_attr) = + if pattr.Ast.pa_size <> Ast.empty_ptr_size + then failwith "Pointer size attributes cannot be used with foreign array" + else + if not pattr.Ast.pa_isptr + then + (* 'pa_chkptr' is default to true unless user specifies 'user_check' *) + if pattr.Ast.pa_chkptr && pattr.Ast.pa_direction = Ast.PtrNoDirection + then failwith "array must have direction attribute or `user_check'" + else pattr + else + if has_str_attr pattr + then failwith "`isary' cannot be used with `string/wstring' together" + else failwith "`isary' cannot be used with `isptr' together" + in + let pattr = do_get_ptr_attr attr_list { Ast.pa_direction = Ast.PtrNoDirection; + Ast.pa_size = Ast.empty_ptr_size; + Ast.pa_isptr = false; + Ast.pa_isary = false; + Ast.pa_isstr = false; + Ast.pa_iswstr = false; + Ast.pa_rdonly = false; + Ast.pa_chkptr = true; + } + in + if pattr.Ast.pa_isary + then check_invalid_ary_attr pattr + else check_invalid_ptr_size pattr |> check_ptr_dir + +(* Untrusted functions can have these attributes: + * + * a. 3 mutual exclusive calling convention specifier: + * 'stdcall', 'fastcall', 'cdecl'. + * + * b. 'dllimport' - to import a public symbol. + *) +let get_func_attr (attr_list: (string * Ast.attr_value) list) = + let get_new_callconv (key: string) (cur: Ast.call_conv) (old: Ast.call_conv) = + if old <> Ast.CC_NONE then + failwithf "unexpected `%s', conflict with `%s'." key (Ast.get_call_conv_str old) + else cur + in + let update_attr (key: string) (value: Ast.attr_value) (res: Ast.func_attr) = + match key with + | "stdcall" -> + let callconv = get_new_callconv key Ast.CC_STDCALL res.Ast.fa_convention + in { res with Ast.fa_convention = callconv} + | "fastcall" -> + let callconv = get_new_callconv key Ast.CC_FASTCALL res.Ast.fa_convention + in { res with Ast.fa_convention = callconv} + | "cdecl" -> + let callconv = get_new_callconv key Ast.CC_CDECL res.Ast.fa_convention + in { res with Ast.fa_convention = callconv} + | "dllimport" -> + if res.Ast.fa_dllimport then failwith "duplicated attribute: `dllimport'" + else { res with Ast.fa_dllimport = true } + | _ -> failwithf "invalid function attribute: %s" key + in + let rec do_get_func_attr alist res_attr = + match alist with + [] -> res_attr + | (k,v) :: xs -> do_get_func_attr xs (update_attr k v res_attr) + in do_get_func_attr attr_list { Ast.fa_dllimport = false; + Ast.fa_convention= Ast.CC_NONE; + } + +(* Some syntax checking against pointer attributes. + * range: (Lexing.position * Lexing.position) + *) +let check_ptr_attr (fd: Ast.func_decl) range = + let fname = fd.Ast.fname in + let check_const (pattr: Ast.ptr_attr) (identifier: string) = + let raise_err_direction (direction:string) = + failwithf "`%s': `%s' is readonly - cannot be used with `%s'" + fname identifier direction + in + if pattr.Ast.pa_rdonly + then + match pattr.Ast.pa_direction with + Ast.PtrOut | Ast.PtrInOut -> raise_err_direction "out" + | _ -> () + else () + in + let check_void_ptr_size (pattr: Ast.ptr_attr) (identifier: string) = + if pattr.Ast.pa_chkptr && (not (has_size pattr.Ast.pa_size)) + then failwithf "`%s': void pointer `%s' - buffer size unknown" fname identifier + else () + in + let checker (pd: Ast.pdecl) = + let pt, declr = pd in + let identifier = declr.Ast.identifier in + match pt with + Ast.PTVal _ -> () + | Ast.PTPtr(atype, pattr) -> + if atype <> Ast.Ptr(Ast.Void) then check_const pattr identifier + else (* 'void' pointer, check there is a size or 'user_check' *) + check_void_ptr_size pattr identifier + in + List.iter checker fd.Ast.plist +%} + +%token EOF +%token TDot TComma TSemicolon TPtr TEqual +%token TLParen TRParen +%token TLBrace TRBrace +%token TLBrack TRBrack +%token Tpublic +%token Tinclude +%token Tconst +%token Tidentifier +%token Tnumber +%token Tstring +%token Tchar Tshort Tunsigned Tint Tfloat Tdouble + Tint8 Tint16 Tint32 Tint64 + Tuint8 Tuint16 Tuint32 Tuint64 + Tsizet Twchar Tvoid Tlong Tstruct Tunion Tenum +%token Tenclave Tfrom Timport Ttrusted Tuntrusted Tallow Tpropagate_errno + +%start start_parsing +%type start_parsing + +/* Grammar follows */ +%% + +/* Type definitions + * ------------------------------------------------------------------------ + */ +char_type: Tchar { Ast.Char Ast.Signed } + | Tunsigned Tchar { Ast.Char Ast.Unsigned } + ; + +/* Explicit shortness. */ +ex_shortness: Tshort { Ast.IShort } + | Tlong { Ast.ILong } + ; + +longlong: Tlong Tlong { Ast.LLong Ast.Signed } + | Tunsigned Tlong Tlong { Ast.LLong Ast.Unsigned } + +shortness: /* empty */ { Ast.INone } + | ex_shortness { $1 } + ; + +int_type: shortness Tint { + Ast.Int { Ast.ia_signedness = Ast.Signed; Ast.ia_shortness = $1 } + } + | Tunsigned shortness Tint { + Ast.Int { Ast.ia_signedness = Ast.Unsigned; Ast.ia_shortness = $2 } + } + | Tunsigned shortness { + Ast.Int { Ast.ia_signedness = Ast.Unsigned; Ast.ia_shortness = $2 } + } + | longlong { $1 } + | ex_shortness { + Ast.Int { Ast.ia_signedness = Ast.Signed; Ast.ia_shortness = $1 } + } + ; + +type_spec: + char_type { $1 } + | int_type { $1 } + + | Tfloat { Ast.Float } + | Tdouble { Ast.Double } + | Tlong Tdouble { Ast.LDouble } + + | Tint8 { Ast.Int8 } + | Tint16 { Ast.Int16 } + | Tint32 { Ast.Int32 } + | Tint64 { Ast.Int64 } + | Tuint8 { Ast.UInt8 } + | Tuint16 { Ast.UInt16 } + | Tuint32 { Ast.UInt32 } + | Tuint64 { Ast.UInt64 } + | Tsizet { Ast.SizeT } + | Twchar { Ast.WChar } + | Tvoid { Ast.Void } + + | struct_specifier { $1 } + | union_specifier { $1 } + | enum_specifier { $1 } + | Tidentifier { Ast.Foreign($1) } /* User defined types in C header */ + ; + +pointer: TPtr { fun ii -> Ast.Ptr(ii) } + | pointer TPtr { fun ii -> Ast.Ptr($1 ii) } + ; + +empty_dimension: TLBrack TRBrack { failwith "Flexible array is not supported." } +fixed_dimension: TLBrack Tnumber TRBrack { if $2 <> 0 then [$2] + else failwith "Zero-length array is not supported." } + +fixed_size_array: fixed_dimension { $1 } + | fixed_size_array fixed_dimension { $1 @ $2 } + ; + +array_size: fixed_size_array { $1 } + | empty_dimension { $1 } + | empty_dimension fixed_size_array { $1 @ $2 } + ; + +all_type: type_spec { $1 } + | type_spec pointer { $2 $1 } + ; + +declarator: Tidentifier { { Ast.identifier = $1; Ast.array_dims = []; } } + | Tidentifier array_size { { Ast.identifier = $1; Ast.array_dims = $2; } } + ; + +/* Available types as parameter. + * + * Instead of returning an value of 'Ast.parameter_type', we return + * a lambda which wraps the actual type since so far there is no way + * to tell whether the identifier is followed by array dimensions. +*/ +param_type: attr_block all_type { + match $2 with + Ast.Ptr _ -> fun x -> Ast.PTPtr($2, get_ptr_attr $1) + | _ -> + if $1 <> [] then + let attr = get_ptr_attr $1 in + match $2 with + Ast.Foreign s -> + if attr.Ast.pa_isptr || attr.Ast.pa_isary then fun x -> Ast.PTPtr($2, attr) + else + (* thinking about 'user_defined_type var[4]' *) + fun is_ary -> + if is_ary then Ast.PTPtr($2, attr) + else failwithf "`%s' is considerred plain type but decorated with pointer attributes" s + | _ -> + fun is_ary -> + if is_ary then Ast.PTPtr($2, attr) + else failwithf "unexpected pointer attributes for `%s'" (Ast.get_tystr $2) + else + fun is_ary -> + if is_ary then Ast.PTPtr($2, get_ptr_attr []) + else Ast.PTVal $2 + } + | all_type { + match $1 with + Ast.Ptr _ -> fun x -> Ast.PTPtr($1, get_ptr_attr []) + | _ -> + fun is_ary -> + if is_ary then Ast.PTPtr($1, get_ptr_attr []) + else Ast.PTVal $1 + } + | attr_block Tconst type_spec pointer { + let attr = get_ptr_attr $1 + in fun x -> Ast.PTPtr($4 $3, { attr with Ast.pa_rdonly = true }) + } + | Tconst type_spec pointer { + let attr = get_ptr_attr [] + in fun x -> Ast.PTPtr($3 $2, { attr with Ast.pa_rdonly = true }) + } + ; + + +attr_block: TLBrack TRBrack { failwith "no attribute specified." } + | TLBrack key_val_pairs TRBrack { $2 } + ; + +key_val_pairs: key_val_pair { [$1] } + | key_val_pairs TComma key_val_pair { $3 :: $1 } + ; + +key_val_pair: Tidentifier TEqual Tidentifier { ($1, Ast.AString($3)) } + | Tidentifier TEqual Tnumber { ($1, Ast.ANumber($3)) } + | Tidentifier { ($1, Ast.AString("")) } + ; + +struct_specifier: Tstruct Tidentifier { Ast.Struct($2) } +union_specifier: Tunion Tidentifier { Ast.Union($2) } +enum_specifier: Tenum Tidentifier { Ast.Enum($2) } + +struct_definition: struct_specifier TLBrace member_list TRBrace { + let s = { Ast.sname = (match $1 with Ast.Struct s -> s | _ -> ""); + Ast.mlist = List.rev $3; } + in Ast.StructDef(s) + } + +union_definition: union_specifier TLBrace member_list TRBrace { + let s = { Ast.sname = (match $1 with Ast.Union s -> s | _ -> ""); + Ast.mlist = List.rev $3; } + in Ast.UnionDef(s) + } + +/* enum can be anonymous. */ +enum_definition: Tenum TLBrace enum_body TRBrace { + let e = { Ast.enname = ""; Ast.enbody = $3; } + in Ast.EnumDef(e) + } + | enum_specifier TLBrace enum_body TRBrace { + let e = { Ast.enname = (match $1 with Ast.Enum s -> s | _ -> ""); + Ast.enbody = $3; } + in Ast.EnumDef(e) + } + ; + +enum_body: /* empty */ { [] } + | enum_eles { List.rev $1 } + ; + +enum_eles: enum_ele { [$1] } + | enum_eles TComma enum_ele { $3 :: $1 } + ; + +enum_ele: Tidentifier { ($1, Ast.EnumValNone) } + | Tidentifier TEqual Tidentifier { ($1, Ast.EnumVal (Ast.AString $3)) } + | Tidentifier TEqual Tnumber { ($1, Ast.EnumVal (Ast.ANumber $3)) } + ; + +composite_defs: struct_definition { $1 } + | union_definition { $1 } + | enum_definition { $1 } + ; + +member_list: member_def TSemicolon { [$1] } + | member_list member_def TSemicolon { $2 :: $1 } + ; + +member_def: all_type declarator { ($1, $2) } + +/* Importing declarations. + * ------------------------------------------------------------------------ + */ +func_list: Tidentifier { [$1] } + | func_list TComma Tidentifier { $3 :: $1 } + ; + +module_path: Tstring { $1 } + +import_declaration: Tfrom module_path Timport func_list { + { Ast.mname = $2; Ast.flist = List.rev $4; } + } + | Tfrom module_path Timport TPtr { + { Ast.mname = $2; Ast.flist = ["*"]; } + } + ; + +include_declaration: Tinclude Tstring { $2 } + +include_declarations: include_declaration { [$1] } + | include_declarations include_declaration { $2 :: $1 } + ; + +/* Enclave function declarations. + * ------------------------------------------------------------------------ + */ +enclave_functions: Ttrusted TLBrace trusted_block TRBrace TSemicolon { + List.rev $3 + } + | Tuntrusted TLBrace untrusted_block TRBrace TSemicolon { + List.rev $3 + } + ; + +trusted_block: trusted_functions { $1 } + | include_declarations trusted_functions { + trusted_headers := !trusted_headers @ List.rev $1; $2 + } + ; + +untrusted_block: untrusted_functions { $1 } + | include_declarations untrusted_functions { + untrusted_headers := !untrusted_headers @ List.rev $1; $2 + } + ; + +/* is_priv? Default to true. */ +access_modifier: /* nothing */ { true } + | Tpublic { false } + ; + +trusted_functions: /* nothing */ { [] } + | trusted_functions access_modifier func_def TSemicolon { + check_ptr_attr $3 (symbol_start_pos(), symbol_end_pos()); + Ast.Trusted { Ast.tf_fdecl = $3; Ast.tf_is_priv = $2 } :: $1 + } + ; + +untrusted_functions: /* nothing */ { [] } + | untrusted_functions untrusted_func_def TSemicolon { $2 :: $1 } + ; + +func_def: all_type Tidentifier parameter_list { + { Ast.fname = $2; Ast.rtype = $1; Ast.plist = List.rev $3 ; } + } + | all_type array_size Tidentifier parameter_list { + failwithf "%s: returning an array is not supported - use pointer instead." $3 + } + ; + +parameter_list: TLParen TRParen { [] } + | TLParen Tvoid TRParen { [] } /* Make C programers comfortable */ + | TLParen parameter_defs TRParen { $2 } + ; + +parameter_defs: parameter_def { [$1] } + | parameter_defs TComma parameter_def { $3 :: $1 } + ; + +parameter_def: param_type declarator { + let pt = $1 (Ast.is_array $2) in + let is_void = + match pt with + Ast.PTVal v -> v = Ast.Void + | _ -> false + in + if is_void then + failwithf "parameter `%s' has `void' type." $2.Ast.identifier + else + (pt, $2) + } + +/* propagate_errno? Default to false. */ +propagate_errno: /* nothing */ { false } + | Tpropagate_errno { true } + ; + +untrusted_func_def: attr_block func_def allow_list propagate_errno { + check_ptr_attr $2 (symbol_start_pos(), symbol_end_pos()); + let fattr = get_func_attr $1 in + Ast.Untrusted { Ast.uf_fdecl = $2; Ast.uf_fattr = fattr; Ast.uf_allow_list = $3; Ast.uf_propagate_errno = $4 } + } + | func_def allow_list propagate_errno { + check_ptr_attr $1 (symbol_start_pos(), symbol_end_pos()); + let fattr = get_func_attr [] in + Ast.Untrusted { Ast.uf_fdecl = $1; Ast.uf_fattr = fattr; Ast.uf_allow_list = $2; Ast.uf_propagate_errno = $3 } + } + ; + +allow_list: /* nothing */ { [] } + | Tallow TLParen TRParen { [] } + | Tallow TLParen func_list TRParen { $3 } + ; + +/* Enclave definition + * ------------------------------------------------------------------------ + */ +expressions: /* nothing */ { [] } + | expressions include_declaration { Ast.Include($2) :: $1 } + | expressions import_declaration TSemicolon { Ast.Importing($2) :: $1 } + | expressions composite_defs TSemicolon { Ast.Composite($2) :: $1 } + | expressions enclave_functions { Ast.Interface($2) :: $1 } + ; + +enclave_def: Tenclave TLBrace expressions TRBrace { + { Ast.ename = ""; + Ast.eexpr = List.rev $3 } + } + ; + +/* The entry point of parser. + * ------------------------------------------------------------------------ + */ +start_parsing: enclave_def TSemicolon EOF { $1 } + +%% diff --git a/sdk/edger8r/linux/SimpleStack.ml b/sdk/edger8r/linux/SimpleStack.ml new file mode 100644 index 0000000000..07806c1b51 --- /dev/null +++ b/sdk/edger8r/linux/SimpleStack.ml @@ -0,0 +1,40 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +type 'a t = { mutable c : 'a list } +exception Empty +let create () = { c = [] } +let push x s = s.c <- x :: s.c +let pop s = + match s.c with + hd::tl -> s.c <- tl; hd + | [] -> raise Empty +let mem x s = List.mem x s.c diff --git a/sdk/edger8r/linux/Util.ml b/sdk/edger8r/linux/Util.ml new file mode 100644 index 0000000000..0c01f41ed5 --- /dev/null +++ b/sdk/edger8r/linux/Util.ml @@ -0,0 +1,308 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +open Printf + +(* It contains some utility functions. *) +let failwithf fmt = kprintf failwith fmt;; +let splitwith chr = Str.split (Str.regexp_string (Char.escaped chr)) + +(* For compatibility with F#. *) +let (|>) a f = f a + +(* Generate a list of sequent number. + * ---------------------------------- + * + * mk_seq 1 0 -> [] + * mk_seq 1 1 -> [1] + * mk_seq 1 5 -> [1; 2; 3; 4; 5] + *) +let rec mk_seq from_num to_num = + if from_num > to_num then [] + else from_num :: mk_seq (from_num + 1) to_num + +(* Return a list without duplicated elements. *) +let dedup_list lst = + let rec do_dedup acc rst = + match rst with + [] -> acc + | h::t -> if List.mem h acc then do_dedup acc t + else do_dedup (h :: acc) t + in do_dedup [] lst + +(* Print the usage of this program. *) +let usage (progname: string) = + eprintf "usage: %s [options] ...\n" progname; + eprintf "\n[options]\n\ +--search-path Specify the search path of EDL files\n\ +--use-prefix Prefix untrusted proxy with Enclave name\n\ +--header-only Only generate header files\n\ +--untrusted Generate untrusted proxy and bridge\n\ +--trusted Generate trusted proxy and bridge\n\ +--untrusted-dir Specify the directory for saving untrusted code\n\ +--trusted-dir Specify the directory for saving trusted code\n\ +--help Print this help message\n"; + eprintf "\n\ +If neither `--untrusted' nor `--trusted' is specified, generate both.\n"; + exit 1 + + +(* Command line parsing facilities. *) +type edger8r_params = { + input_files : string list; + use_prefix : bool; + header_only : bool; + gen_untrusted : bool; (* User specified `--untrusted' *) + gen_trusted : bool; (* User specified `--trusted' *) + untrusted_dir : string; (* Directory to save untrusted code *) + trusted_dir : string; (* Directory to save trusted code *) +} + +(* The search paths are recored in the array below. + * W/o extra search paths specified, edger8r searchs from current directory. + *) +let search_paths = ref [|"."|] + +(* The path separator is usually ':' on Linux and ';' on Windows. + * Concerning that we might compile this code with OCaml on Windows, + * we'd better don't assume that ':' is always used. + *) +let path_separator : char = + match Sys.os_type with + "Win32" -> ';' + | _ -> ':' (* "Unix" or "Cygwin" *) + +(* Parse the command line and return a record of `edger8r_params'. *) +let rec parse_cmdline (progname: string) (cmdargs: string list) = + let use_pref = ref false in + let hd_only = ref false in + let untrusted= ref false in + let trusted = ref false in + let u_dir = ref "." in + let t_dir = ref "." in + let files = ref [] in + + let rec local_parser (args: string list) = + match args with + [] -> () + | op :: ops -> + match String.lowercase op with + "--use-prefix" -> use_pref := true; local_parser ops + | "--header-only"-> hd_only := true; local_parser ops + | "--untrusted" -> untrusted := true; local_parser ops + | "--trusted" -> trusted := true; local_parser ops + | "--untrusted-dir" -> + (match ops with + [] -> usage progname + | x::xs -> u_dir := x; local_parser xs) + | "--trusted-dir" -> + (match ops with + [] -> usage progname + | x::xs -> t_dir := x; local_parser xs) + | "--help" -> usage progname + | "--search-path" -> + if ops = [] then usage progname + else + let search_path_str = List.hd ops in + let extra_paths = splitwith path_separator search_path_str in + let extra_path_arry = Array.of_list extra_paths in + search_paths := Array.append extra_path_arry !search_paths; + local_parser (List.tl ops) + | _ -> files := op :: !files; local_parser ops + in + local_parser cmdargs; + let opt = + { input_files = List.rev !files; use_prefix = !use_pref; + header_only = !hd_only; gen_untrusted = true; gen_trusted = true; + untrusted_dir = !u_dir; trusted_dir = !t_dir; + } + in + if !untrusted || !trusted (* User specified '--untrusted' or '--trusted' *) + then { opt with gen_trusted = !trusted; gen_untrusted = !untrusted } + else opt + +let separator_str : string = Filename.dir_sep + +(* Search the file within given search pathes. + * ------------------------------------------- + * + * The second parameter is read from the global variable `search_paths'. + * + * get_file_path "Util.fs" [|"."|] -> "./Ast.fs" + * get_file_path "Util.fs" [|"misc/dir"; "../Edger8r"|] -> "../Edger8r/Ast.fs" + * get_file_path "Util.fs" [|"misc/dir"; "another/dir"|] -> Not_found + *) +let get_file_path (fname: string) = + let get_full_name path = + if Filename.is_relative fname then path ^ separator_str ^ fname + else fname + in + let targets = Array.map get_full_name !search_paths in + let fn_list = Array.to_list targets in + try + List.find Sys.file_exists fn_list + with + Not_found -> failwithf "File not found within search paths: %s\n" fname + +(* Get the short name of the given file name. + * ------------------------------------------ + * + * get_short_name "Util.fs" -> "Util" + * get_short_name "./Util.fs" -> "Util" + * get_short_name "misc/Util.fs" -> "Util" + *) +let get_short_name (fname: string) = + let bn = Filename.basename fname in + try Filename.chop_extension bn + with Invalid_argument _ -> bn + +(* Helper functions that are not contained in OCaml standard library *) +let isdigit = function '0' | '1' .. '9' -> true | _ -> false +let isalpha = function 'a' .. 'z' | 'A' .. 'Z' -> true | _ -> false +let isalnum c = isdigit c || isalpha c + +let str_map f s = + let len = String.length s in + let res = String.create len in + for i = 0 to len - 1 do + String.set res i (f (String.get s i)) + done; + res + +let str_to_list s = + let rec iter i lst = + if i < 0 then lst else iter (i - 1) (s.[i] :: lst) + in + iter (String.length s - 1) [] + +let str_forall p s = List.for_all p (str_to_list s) + +(* Compute a string that conforms to C identifier. + * + * to_c_identifier "this foo" => "this_foo" + * to_c_identifier "3this" => "_this" + * + * The algorithm is simple, filter invalid characters to `_'. +*) +let to_c_identifier (s: string) = + let convert_char ch = + if isalnum ch then ch else '_' + in + let first_ch = + let ch = s.[0] in + if isalnum ch then ch else '_' + in + let rest_str = + String.sub s 1 (String.length s - 1) + in + Char.escaped first_ch ^ str_map convert_char rest_str + + +(* Check whether given string is a valid C identifier. + * + * is_c_identifier "this foo" => false + * is_c_identifier "3this" => false + * is_c_identifier "_this" => true +*) +let is_c_identifier(s: string) = + let first_ch = s.[0] in + let rest_str = String.sub s 1 (String.length s - 1) in + if isalpha first_ch || first_ch = '_' + then str_forall (fun ch -> isalnum ch || ch = '_') rest_str + else false + +(* ocamlyacc doesn't expose definitions in header section, + * as a quick work-around, we put them here. + *) +let trusted_headers : string list ref = ref [] +let untrusted_headers: string list ref = ref [] + +(* Create directory specified by `d'. *) +let create_dir (d: string) = + let curr_dir = Unix.getcwd () in + + (* `get_root_dir' will be called with the head element of a list of + * sub-directories starting from root directory. + * The list will look like - + * ["home", "guest", ...] on Linux, while + * ["c:\\", "Users", ...] on Windows. + *) + let get_root_dir (dirs: string list) = + match Sys.os_type with + "Win32" -> List.hd dirs + | _ -> Filename.dir_sep + in + (* If we have a directory list like ["c:", ...], change the first element + * to "c:\\". Due to the fact that: + * Sys.file_exists "c:" => false + * Sys.file_exists "c:\\" => true + *) + let normalize (ds: string list) = + if Sys.os_type <> "Win32" then ds + else + let d = List.hd ds in + if String.length d = 2 && d.[1] = ':' + then (d ^ Filename.dir_sep) :: List.tl ds + else ds + in + let dir_exist_p dir = + if Sys.file_exists dir then + let stats = Unix.stat dir in + match stats.Unix.st_kind with + | Unix.S_DIR -> true + (* No need handle S_LNK because 'stat' will follow link. *) + | _ -> false + else false + in + let __do_create_and_goto_dir dir = + (if dir_exist_p dir then () else Unix.mkdir dir 0o755); + Unix.chdir dir + in + let do_create_dir () = + let rec do_create_dir_recursively dirs = + match dirs with + [] -> () + | x::xs -> + __do_create_and_goto_dir x; do_create_dir_recursively xs + in + (* After splitting, we will get a list of all sub-directories. + * "/home/guest/some/path" -> ["home", "guest", "some", "path"]; + * "c:\Users\guest\some\path" -> ["c:", "Users", "guest", "some", "path"]. + *) + let dirs = normalize (Str.split (Str.regexp separator_str) d) in + let start_dir = if Filename.is_relative d then curr_dir else get_root_dir dirs in + Unix.chdir start_dir; + (* In case of continuous dir_sep in path string, we filter out empty strings. *) + do_create_dir_recursively (List.filter (fun s -> s <> "") dirs); + Unix.chdir curr_dir; + in + try do_create_dir () + with exn -> (eprintf "error: failed to create directory: `%s'\n" d; exit 1) diff --git a/sdk/sample_libcrypto/Makefile b/sdk/sample_libcrypto/Makefile new file mode 100644 index 0000000000..7b113c203f --- /dev/null +++ b/sdk/sample_libcrypto/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +include ../../buildenv.mk + +CRYPTO_PATH = $(LINUX_EXTERNAL_DIR)/crypto_px + +CXXFLAGS += -Werror -fno-rtti -fno-exceptions -fPIC + +CPPFLAGS := -isystem $(CRYPTO_PATH)/include \ + -I$(COMMON_DIR)/inc/internal/ + +IPPFLAGS := -Wl,--start-group \ + $(CRYPTO_PATH)/libcrypto_px.a \ + -Wl,--end-group + +OBJS := sample_libcrypto.o + +LIBSAMPLECRYPTO := libsample_libcrypto.so + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: all +all: $(LIBSAMPLECRYPTO) | $(BUILD_DIR) + @$(CP) $< $| + +libcrypto_px: + $(MAKE) -C $(CRYPTO_PATH) + +# It's important that the IPPFLAGS go AFTER the .o / .cpp file(s) +$(LIBSAMPLECRYPTO): $(OBJS) libcrypto_px + $(CXX) $(CXXFLAGS) -shared -Bdynamic -Wl,-soname,$(LIBSAMPLECRYPTO) $< -o $@ $(IPPFLAGS) -Wl,--version-script,sample_libcrypto.lds + +$(OBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + $(MAKE) -C $(CRYPTO_PATH) clean + @$(RM) $(OBJS) $(LIBSAMPLECRYPTO) $(BUILD_DIR)/$(LIBSAMPLECRYPTO) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/sample_libcrypto/sample_libcrypto.cpp b/sdk/sample_libcrypto/sample_libcrypto.cpp new file mode 100644 index 0000000000..4b6b6f18e9 --- /dev/null +++ b/sdk/sample_libcrypto/sample_libcrypto.cpp @@ -0,0 +1,931 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * This sample cryptopgraphy library was intended to be used in a limited + * manner. Its cryptographic strength is very weak. It should not be + * used by any production code. Its scope is limited to assist in the + * development of the remote attestation sample application. +**/ + +#include +#include +#include + +#include "ippcp.h" + + +#include "sgx_memset_s.h" +#include "se_memcpy.h" + +#include "sample_libcrypto.h" +#include + +#ifdef __linux__ +/* + * __memset_vp is a volatile pointer to a function. + * It is initialised to point to memset, and should never be changed. + */ +static void * (* const volatile __memset_vp)(void *, int, size_t) + = (memset); + +#undef memset_s /* in case it was defined as a macro */ + +extern "C" int memset_s(void *s, size_t smax, int c, size_t n) +{ + int err = 0; + + if (s == NULL) { + err = EINVAL; + goto out; + } + + if (n > smax) { + err = EOVERFLOW; + n = smax; + } + + /* Calling through a volatile pointer should never be optimised away. */ + (*__memset_vp)(s, c, n); + + out: + if (err == 0) + return 0; + else { + errno = err; + /* XXX call runtime-constraint handler */ + return err; + } +} +#endif + +#ifndef ERROR_BREAK +#define ERROR_BREAK(x) if(x){break;} +#endif + +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr) = NULL;}} +#endif + +#ifndef ROUND_TO +#define ROUND_TO(x, align) (((x) + (align-1)) & ~(align-1)) +#endif + +#ifndef UNUSED +#define UNUSED(val) (void)(val) +#endif + + +// We are using this very non-random definition for reproducibility / debugging purposes. +static uint32_t seed = (uint32_t)(9); + +static inline sample_status_t __do_get_rand32(uint32_t* rand_num) +{ + // A better source of entropy would be the "time" function or something like that + *rand_num = seed; + return SAMPLE_SUCCESS; +} + +static inline IppStatus check_copy_size(size_t target_size, size_t source_size) +{ + if(target_size < source_size) + return ippStsSizeErr; + return ippStsNoErr; +} + +/* The function should generate a random number properly, and the pseudo-rand + implementation is only for demo purpose. */ +sample_status_t sample_read_rand(unsigned char *rand, size_t length_in_bytes) +{ + // check parameters + if(!rand || !length_in_bytes) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + // loop to rdrand + while(length_in_bytes > 0) + { + uint32_t rand_num = 0; + sample_status_t status = __do_get_rand32(&rand_num); + if(status != SAMPLE_SUCCESS) + { + return status; + } + size_t size = (length_in_bytes < sizeof(rand_num)) + ? length_in_bytes : sizeof(rand_num); + if(memcpy_s(rand, size, &rand_num, size)) + { + return status; + } + + rand += size; + length_in_bytes -= size; + } + return SAMPLE_SUCCESS; +} + +static IppStatus sgx_ipp_newBN(const Ipp32u *p_data, int size_in_bytes, IppsBigNumState **p_new_BN) +{ + IppsBigNumState *pBN=0; + int bn_size = 0; + + if(p_new_BN == NULL || (size_in_bytes <= 0) || ((size_in_bytes % sizeof(Ipp32u)) != 0)) + return ippStsBadArgErr; + + // Get the size of the IppsBigNumState context in bytes + IppStatus error_code = ippsBigNumGetSize(size_in_bytes/(int)sizeof(Ipp32u), &bn_size); + if(error_code != ippStsNoErr) + { + *p_new_BN = 0; + return error_code; + } + pBN = (IppsBigNumState *) malloc(bn_size); + if(!pBN) + { + error_code = ippStsMemAllocErr; + *p_new_BN = 0; + return error_code; + } + // Initialize context and partition allocated buffer + error_code = ippsBigNumInit(size_in_bytes/(int)sizeof(Ipp32u), pBN); + if(error_code != ippStsNoErr) + { + free(pBN); + *p_new_BN = 0; + return error_code; + } + if(p_data) + { + error_code = ippsSet_BN(IppsBigNumPOS, size_in_bytes/(int)sizeof(Ipp32u), p_data, pBN); + if(error_code != ippStsNoErr) + { + *p_new_BN = 0; + free(pBN); + return error_code; + } + } + + + *p_new_BN = pBN; + return error_code; +} + +static void sample_ipp_secure_free_BN(IppsBigNumState *pBN, int size_in_bytes) +{ + if(pBN == NULL || size_in_bytes <= 0 || size_in_bytes/sizeof(Ipp32u) <= 0) + { + if(pBN) + { + free(pBN); + } + return; + } + int bn_size = 0; + + // Get the size of the IppsBigNumState context in bytes + // Since we have checked the size_in_bytes before and the &bn_size is not NULL, ippsBigNumGetSize never returns failure + ippsBigNumGetSize(size_in_bytes/(int)sizeof(Ipp32u), &bn_size); + if (bn_size <= 0) + { + free(pBN); + return; + } + // Clear the buffer before free. + memset_s(pBN, bn_size, 0, bn_size); + free(pBN); + return; +} + +IppStatus __STDCALL sample_ipp_DRNGen(Ipp32u* pRandBNU, int nBits, void* pCtx_unused) +{ + sample_status_t sample_ret; + UNUSED(pCtx_unused); + + if(0 != nBits%8) + { + // Must be byte aligned + return ippStsSizeErr; + } + + if(!pRandBNU) + { + return ippStsNullPtrErr; + } + sample_ret = sample_read_rand((uint8_t*)pRandBNU, (uint32_t)nBits/8); + if(SAMPLE_SUCCESS != sample_ret) + { + return ippStsErr; + } + return ippStsNoErr; +} + + + +/* Rijndael AES-GCM +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_aes_gcm_128bit_key_t *p_key - Pointer to key used in encryption/decryption operation +* uint8_t *p_src - Pointer to input stream to be encrypted/decrypted +* uint32_t src_len - Length of input stream to be encrypted/decrypted +* uint8_t *p_iv - Pointer to initialization vector to use +* uint32_t iv_len - Length of initialization vector +* uint8_t *p_aad - Pointer to input stream of additional authentication data +* uint32_t aad_len - Length of additional authentication data stream +* sample_aes_gcm_128bit_tag_t *p_in_mac - Pointer to expected MAC in decryption process +* Output: uint8_t *p_dst - Pointer to cipher text. Size of buffer should be >= src_len. +* sample_aes_gcm_128bit_tag_t *p_out_mac - Pointer to MAC generated from encryption process +* NOTE: Wrapper is responsible for confirming decryption tag matches encryption tag */ +sample_status_t sample_rijndael128GCM_encrypt(const sample_aes_gcm_128bit_key_t *p_key, const uint8_t *p_src, uint32_t src_len, + uint8_t *p_dst, const uint8_t *p_iv, uint32_t iv_len, const uint8_t *p_aad, uint32_t aad_len, + sample_aes_gcm_128bit_tag_t *p_out_mac) +{ + IppStatus error_code = ippStsNoErr; + IppsAES_GCMState* pState = NULL; + int ippStateSize = 0; + + if ((p_key == NULL) || ((src_len > 0) && (p_dst == NULL)) || ((src_len > 0) && (p_src == NULL)) + || (p_out_mac == NULL) || (iv_len != SAMPLE_AESGCM_IV_SIZE) || ((aad_len > 0) && (p_aad == NULL)) + || (p_iv == NULL) || ((p_src == NULL) && (p_aad == NULL))) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + error_code = ippsAES_GCMGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + return SAMPLE_ERROR_UNEXPECTED; + } + pState = (IppsAES_GCMState*)malloc(ippStateSize); + if(pState == NULL) + { + return SAMPLE_ERROR_OUT_OF_MEMORY; + } + error_code = ippsAES_GCMInit((const Ipp8u *)p_key, SAMPLE_AESGCM_KEY_SIZE, pState, ippStateSize); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsMemAllocErr: return SAMPLE_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_GCMStart(p_iv, SAMPLE_AESGCM_IV_SIZE, p_aad, aad_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + if (src_len > 0) { + error_code = ippsAES_GCMEncrypt(p_src, p_dst, src_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + } + error_code = ippsAES_GCMGetTag((Ipp8u *)p_out_mac, SAMPLE_AESGCM_MAC_SIZE, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + return SAMPLE_SUCCESS; +} + + +/* Message Authentication - Rijndael 128 CMAC +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_cmac_128bit_key_t *p_key - Pointer to key used in encryption/decryption operation +* uint8_t *p_src - Pointer to input stream to be MACed +* uint32_t src_len - Length of input stream to be MACed +* Output: sample_cmac_gcm_128bit_tag_t *p_mac - Pointer to resultant MAC */ +sample_status_t sample_rijndael128_cmac_msg(const sample_cmac_128bit_key_t *p_key, const uint8_t *p_src, + uint32_t src_len, sample_cmac_128bit_tag_t *p_mac) +{ + IppsAES_CMACState* pState = NULL; + int ippStateSize = 0; + IppStatus error_code = ippStsNoErr; + + if ((p_key == NULL) || (p_src == NULL) || (p_mac == NULL)) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + error_code = ippsAES_CMACGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + return SAMPLE_ERROR_UNEXPECTED; + } + pState = (IppsAES_CMACState*)malloc(ippStateSize); + if(pState == NULL) + { + return SAMPLE_ERROR_OUT_OF_MEMORY; + } + error_code = ippsAES_CMACInit((const Ipp8u *)p_key, SAMPLE_CMAC_KEY_SIZE, pState, ippStateSize); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsMemAllocErr: return SAMPLE_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_CMACUpdate((const Ipp8u *)p_src, src_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_CMACFinal((Ipp8u *)p_mac, SAMPLE_CMAC_MAC_SIZE, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + return SAMPLE_SUCCESS; +} + +extern "C" int some_function() +{ + return 1234; +} + +/* +* Elliptic Curve Crytpography - Based on GF(p), 256 bit +*/ +/* Allocates and initializes ecc context +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Output: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system */ +sample_status_t sample_ecc256_open_context(sample_ecc_state_handle_t* ecc_handle) +{ + IppStatus ipp_ret = ippStsNoErr; + IppsECCPState* p_ecc_state = NULL; + // default use 256r1 parameter + int ctx_size = 0; + + if (ecc_handle == NULL) + return SAMPLE_ERROR_INVALID_PARAMETER; + ipp_ret = ippsECCPGetSize(256, &ctx_size); + if (ipp_ret != ippStsNoErr) + return SAMPLE_ERROR_UNEXPECTED; + p_ecc_state = (IppsECCPState*)(malloc(ctx_size)); + if (p_ecc_state == NULL) + return SAMPLE_ERROR_OUT_OF_MEMORY; + ipp_ret = ippsECCPInit(256, p_ecc_state); + if (ipp_ret != ippStsNoErr) + { + SAFE_FREE(p_ecc_state); + *ecc_handle = NULL; + return SAMPLE_ERROR_UNEXPECTED; + } + ipp_ret = ippsECCPSetStd(IppECCPStd256r1, p_ecc_state); + if (ipp_ret != ippStsNoErr) + { + SAFE_FREE(p_ecc_state); + *ecc_handle = NULL; + return SAMPLE_ERROR_UNEXPECTED; + } + *ecc_handle = p_ecc_state; + return SAMPLE_SUCCESS; +} + +/* Cleans up ecc context +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Output: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system */ +sample_status_t sample_ecc256_close_context(sample_ecc_state_handle_t ecc_handle) +{ + if (ecc_handle == NULL) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + int ctx_size = 0; + IppStatus ipp_ret = ippsECCPGetSize(256, &ctx_size); + if (ipp_ret != ippStsNoErr) + { + free(p_ecc_state); + return SAMPLE_SUCCESS; + } + memset_s(p_ecc_state, ctx_size, 0, ctx_size); + free(p_ecc_state); + return SAMPLE_SUCCESS; +} + +/* Populates private/public key pair - caller code allocates memory +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* Outputs: sample_ec256_private_t *p_private - Pointer to the private key +* sample_ec256_public_t *p_public - Pointer to the public key */ +sample_status_t sample_ecc256_create_key_pair(sample_ec256_private_t *p_private, + sample_ec256_public_t *p_public, + sample_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private == NULL) || (p_public == NULL)) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + + IppsBigNumState* dh_priv_BN = NULL; + IppsECCPPointState* point_pub = NULL; + IppsBigNumState* pub_gx = NULL; + IppsBigNumState* pub_gy = NULL; + IppStatus ipp_ret = ippStsNoErr; + int ecPointSize = 0; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + + do + { + //init eccp point + ipp_ret = ippsECCPPointGetSize(256, &ecPointSize); + ERROR_BREAK(ipp_ret); + point_pub = (IppsECCPPointState*)( malloc(ecPointSize) ); + if(!point_pub) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point_pub); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, SAMPLE_ECP256_KEY_SIZE, &dh_priv_BN); + ERROR_BREAK(ipp_ret); + // Use the true random number (DRNG) + ipp_ret = ippsECCPGenKeyPair(dh_priv_BN, point_pub, p_ecc_state, (IppBitSupplier)sample_ipp_DRNGen, NULL); + ERROR_BREAK(ipp_ret); + + //convert point_result to oct string + ipp_ret = sgx_ipp_newBN(NULL, SAMPLE_ECP256_KEY_SIZE, &pub_gx); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, SAMPLE_ECP256_KEY_SIZE, &pub_gy); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPGetPoint(pub_gx, pub_gy, point_pub, p_ecc_state); + ERROR_BREAK(ipp_ret); + + IppsBigNumSGN sgn = IppsBigNumPOS; + Ipp32u *pdata = NULL; + // ippsRef_BN is in bits not bytes (versus old ippsGet_BN) + int length = 0; + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, pub_gx); + ERROR_BREAK(ipp_ret); + memset(p_public->gx, 0, sizeof(p_public->gx)); + ipp_ret = check_copy_size(sizeof(p_public->gx), ROUND_TO(length, 8)/8); + ERROR_BREAK(ipp_ret); + memcpy(p_public->gx, pdata, ROUND_TO(length, 8)/8); + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, pub_gy); + ERROR_BREAK(ipp_ret); + memset(p_public->gy, 0, sizeof(p_public->gy)); + ipp_ret = check_copy_size(sizeof(p_public->gy), ROUND_TO(length, 8)/8); + ERROR_BREAK(ipp_ret); + memcpy(p_public->gy, pdata, ROUND_TO(length, 8)/8); + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, dh_priv_BN); + ERROR_BREAK(ipp_ret); + memset(p_private->r, 0, sizeof(p_private->r)); + ipp_ret = check_copy_size(sizeof(p_private->r), ROUND_TO(length, 8)/8); + ERROR_BREAK(ipp_ret); + memcpy(p_private->r, pdata, ROUND_TO(length, 8)/8); + }while(0); + + //Clear temp buffer before free. + if(point_pub) memset_s(point_pub, ecPointSize, 0, ecPointSize); + SAFE_FREE(point_pub); + sample_ipp_secure_free_BN(pub_gx, SAMPLE_ECP256_KEY_SIZE); + sample_ipp_secure_free_BN(pub_gy, SAMPLE_ECP256_KEY_SIZE); + sample_ipp_secure_free_BN(dh_priv_BN, SAMPLE_ECP256_KEY_SIZE); + + switch (ipp_ret) + { + case ippStsNoErr: return SAMPLE_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SAMPLE_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } +} + + + + +/* Computes DH shared key based on private B key (local) and remote public Ga Key +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sample_ec256_private_t *p_private_b - Pointer to the local private key - LITTLE ENDIAN +* sample_ec256_public_t *p_public_ga - Pointer to the remote public key - LITTLE ENDIAN +* Output: sample_ec256_dh_shared_t *p_shared_key - Pointer to the shared DH key - LITTLE ENDIAN +*x-coordinate of (privKeyB - pubKeyA) */ +sample_status_t sample_ecc256_compute_shared_dhkey(sample_ec256_private_t *p_private_b, + sample_ec256_public_t *p_public_ga, + sample_ec256_dh_shared_t *p_shared_key, + sample_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private_b == NULL) || (p_public_ga == NULL) || (p_shared_key == NULL)) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + + IppsBigNumState* BN_dh_privB = NULL; + IppsBigNumState* BN_dh_share = NULL; + IppsBigNumState* pubA_gx = NULL; + IppsBigNumState* pubA_gy = NULL; + IppsECCPPointState* point_pubA = NULL; + IppStatus ipp_ret = ippStsNoErr; + int ecPointSize = 0; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + IppECResult ipp_result = ippECValid; + + do + { + ipp_ret = sgx_ipp_newBN((Ipp32u*)p_private_b->r, sizeof(sample_ec256_private_t), &BN_dh_privB); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((uint32_t*)p_public_ga->gx, sizeof(p_public_ga->gx), &pubA_gx); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((uint32_t*)p_public_ga->gy, sizeof(p_public_ga->gy), &pubA_gy); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPPointGetSize(256, &ecPointSize); + ERROR_BREAK(ipp_ret); + point_pubA = (IppsECCPPointState*)( malloc(ecPointSize) ); + if(!point_pubA) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point_pubA); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetPoint(pubA_gx, pubA_gy, point_pubA, p_ecc_state); + ERROR_BREAK(ipp_ret); + + // Check to see if the point is a valid point on the Elliptic curve and is not infinity + ipp_ret = ippsECCPCheckPoint(point_pubA, &ipp_result, p_ecc_state); + if (ipp_result != ippECValid) + { + break; + } + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, sizeof(sample_ec256_dh_shared_t), &BN_dh_share); + ERROR_BREAK(ipp_ret); + /* This API generates shareA = x-coordinate of (privKeyB - pubKeyA) */ + ipp_ret = ippsECCPSharedSecretDH(BN_dh_privB, point_pubA, BN_dh_share, p_ecc_state); + ERROR_BREAK(ipp_ret); + IppsBigNumSGN sgn = IppsBigNumPOS; + int length = 0; + Ipp32u * pdata = NULL; + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, BN_dh_share); + ERROR_BREAK(ipp_ret); + memset(p_shared_key->s, 0, sizeof(p_shared_key->s)); + ipp_ret = check_copy_size(sizeof(p_shared_key->s), ROUND_TO(length, 8)/8); + ERROR_BREAK(ipp_ret); + memcpy(p_shared_key->s, pdata, ROUND_TO(length, 8)/8); + }while(0); + + // Clear temp buffer before free. + if(point_pubA) + memset_s(point_pubA, ecPointSize, 0, ecPointSize); + SAFE_FREE(point_pubA); + sample_ipp_secure_free_BN(pubA_gx, sizeof(p_public_ga->gx)); + sample_ipp_secure_free_BN(pubA_gy, sizeof(p_public_ga->gy)); + sample_ipp_secure_free_BN(BN_dh_privB, sizeof(sample_ec256_private_t)); + sample_ipp_secure_free_BN(BN_dh_share, sizeof(sample_ec256_dh_shared_t)); + + + if (ipp_result != ippECValid) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + switch (ipp_ret) + { + case ippStsNoErr: return SAMPLE_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SAMPLE_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } +} + + +const uint32_t sample_nistp256_r[] = { + 0xFC632551, 0xF3B9CAC2, 0xA7179E84, 0xBCE6FAAD, 0xFFFFFFFF, 0xFFFFFFFF, + 0x00000000, 0xFFFFFFFF}; + +#include + +/* Computes signature for data based on private key +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS, SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sample_ec256_private_t *p_private - Pointer to the private key - LITTLE ENDIAN +* sample_uint8_t *p_data - Pointer to the data to be signed +* uint32_t data_size - Size of the data to be signed +* Output: sample_ec256_signature_t *p_signature - Pointer to the signature - LITTLE ENDIAN */ +sample_status_t sample_ecdsa_sign(const uint8_t *p_data, + uint32_t data_size, + sample_ec256_private_t *p_private, + sample_ec256_signature_t *p_signature, + sample_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private == NULL) || (p_signature == NULL) || (p_data == NULL) || (data_size < 1)) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + + IppStatus ipp_ret = ippStsNoErr; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + IppsBigNumState* p_ecp_order = NULL; + IppsBigNumState* p_hash_bn = NULL; + IppsBigNumState* p_msg_bn = NULL; + IppsBigNumState* p_eph_priv_bn = NULL; + IppsECCPPointState* p_eph_pub = NULL; + IppsBigNumState* p_reg_priv_bn = NULL; + IppsBigNumState* p_signx_bn = NULL; + IppsBigNumState* p_signy_bn = NULL; + Ipp32u *p_sigx = NULL; + Ipp32u *p_sigy = NULL; + int ecp_size = 0; + const int order_size = sizeof(sample_nistp256_r); + uint32_t hash[8] = {0}; + + do + { + + ipp_ret = sgx_ipp_newBN(sample_nistp256_r, order_size, &p_ecp_order); + ERROR_BREAK(ipp_ret); + + // Prepare the message used to sign. + ipp_ret = ippsHashMessage(p_data, data_size, (Ipp8u*)hash, IPP_ALG_HASH_SHA256); + ERROR_BREAK(ipp_ret); + /* Byte swap in creation of Big Number from SHA256 hash output */ + ipp_ret = sgx_ipp_newBN(NULL, sizeof(hash), &p_hash_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsSetOctString_BN((Ipp8u*)hash, sizeof(hash), p_hash_bn); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_msg_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsMod_BN(p_hash_bn, p_ecp_order, p_msg_bn); + ERROR_BREAK(ipp_ret); + + // Get ephemeral key pair. + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_eph_priv_bn); + ERROR_BREAK(ipp_ret); + //init eccp point + ipp_ret = ippsECCPPointGetSize(256, &ecp_size); + ERROR_BREAK(ipp_ret); + p_eph_pub = (IppsECCPPointState*)(malloc(ecp_size)); + if(!p_eph_pub) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, p_eph_pub); + ERROR_BREAK(ipp_ret); + // generate ephemeral key pair for signing operation + ipp_ret = ippsECCPGenKeyPair(p_eph_priv_bn, p_eph_pub, p_ecc_state, + (IppBitSupplier)sample_ipp_DRNGen, NULL); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetKeyPair(p_eph_priv_bn, p_eph_pub, ippFalse, p_ecc_state); + ERROR_BREAK(ipp_ret); + + // Set the regular private key. + ipp_ret = sgx_ipp_newBN((uint32_t *)p_private->r, sizeof(p_private->r), + &p_reg_priv_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_signx_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_signy_bn); + ERROR_BREAK(ipp_ret); + + // Sign the message. + ipp_ret = ippsECCPSignDSA(p_msg_bn, p_reg_priv_bn, p_signx_bn, p_signy_bn, + p_ecc_state); + ERROR_BREAK(ipp_ret); + + IppsBigNumSGN sign; + int length; + ipp_ret = ippsRef_BN(&sign, &length,(Ipp32u**) &p_sigx, p_signx_bn); + ERROR_BREAK(ipp_ret); + memset(p_signature->x, 0, sizeof(p_signature->x)); + ipp_ret = check_copy_size(sizeof(p_signature->x), ROUND_TO(length, 8)/8); + ERROR_BREAK(ipp_ret); + memcpy(p_signature->x, p_sigx, ROUND_TO(length, 8)/8); + memset_s(p_sigx, sizeof(p_signature->x), 0, ROUND_TO(length, 8)/8); + ipp_ret = ippsRef_BN(&sign, &length,(Ipp32u**) &p_sigy, p_signy_bn); + ERROR_BREAK(ipp_ret); + memset(p_signature->y, 0, sizeof(p_signature->y)); + ipp_ret = check_copy_size(sizeof(p_signature->y), ROUND_TO(length, 8)/8); + ERROR_BREAK(ipp_ret); + memcpy(p_signature->y, p_sigy, ROUND_TO(length, 8)/8); + memset_s(p_sigy, sizeof(p_signature->y), 0, ROUND_TO(length, 8)/8); + + }while(0); + + // Clear buffer before free. + if(p_eph_pub) + memset_s(p_eph_pub, ecp_size, 0, ecp_size); + SAFE_FREE(p_eph_pub); + sample_ipp_secure_free_BN(p_ecp_order, order_size); + sample_ipp_secure_free_BN(p_hash_bn, sizeof(hash)); + sample_ipp_secure_free_BN(p_msg_bn, order_size); + sample_ipp_secure_free_BN(p_eph_priv_bn, order_size); + sample_ipp_secure_free_BN(p_reg_priv_bn, sizeof(p_private->r)); + sample_ipp_secure_free_BN(p_signx_bn, order_size); + sample_ipp_secure_free_BN(p_signy_bn, order_size); + + switch (ipp_ret) + { + case ippStsNoErr: return SAMPLE_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SAMPLE_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } +} + +/* Allocates and initializes sha256 state +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Output: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state */ +sample_status_t sample_sha256_init(sample_sha_state_handle_t* p_sha_handle) +{ + IppStatus ipp_ret = ippStsNoErr; + IppsHashState* p_temp_state = NULL; + + if (p_sha_handle == NULL) + return SAMPLE_ERROR_INVALID_PARAMETER; + + int ctx_size = 0; + ipp_ret = ippsHashGetSize(&ctx_size); + if (ipp_ret != ippStsNoErr) + return SAMPLE_ERROR_UNEXPECTED; + p_temp_state = (IppsHashState*)(malloc(ctx_size)); + if (p_temp_state == NULL) + return SAMPLE_ERROR_OUT_OF_MEMORY; + ipp_ret = ippsHashInit(p_temp_state, IPP_ALG_HASH_SHA256); + if (ipp_ret != ippStsNoErr) + { + SAFE_FREE(p_temp_state); + *p_sha_handle = NULL; + switch (ipp_ret) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } + } + + *p_sha_handle = p_temp_state; + return SAMPLE_SUCCESS; +} + +/* Updates sha256 has calculation based on the input message +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Input: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state +* uint8_t *p_src - Pointer to the input stream to be hashed +* uint32_t src_len - Length of the input stream to be hashed */ +sample_status_t sample_sha256_update(const uint8_t *p_src, uint32_t src_len, sample_sha_state_handle_t sha_handle) +{ + if ((p_src == NULL) || (sha_handle == NULL)) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + IppStatus ipp_ret = ippStsNoErr; + ipp_ret = ippsHashUpdate(p_src, src_len, (IppsHashState*)sha_handle); + switch (ipp_ret) + { + case ippStsNoErr: return SAMPLE_SUCCESS; + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } +} + +/* Returns Hash calculation +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Input: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state +* Output: sample_sha256_hash_t *p_hash - Resultant hash from operation */ +sample_status_t sample_sha256_get_hash(sample_sha_state_handle_t sha_handle, sample_sha256_hash_t *p_hash) +{ + if ((sha_handle == NULL) || (p_hash == NULL)) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + IppStatus ipp_ret = ippStsNoErr; + ipp_ret = ippsHashGetTag((Ipp8u*)p_hash, SAMPLE_SHA256_HASH_SIZE, (IppsHashState*)sha_handle); + switch (ipp_ret) + { + case ippStsNoErr: return SAMPLE_SUCCESS; + case ippStsNullPtrErr: + case ippStsLengthErr: return SAMPLE_ERROR_INVALID_PARAMETER; + default: return SAMPLE_ERROR_UNEXPECTED; + } +} + +/* Cleans up sha state +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Input: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state */ +sample_status_t sample_sha256_close(sample_sha_state_handle_t sha_handle) +{ + if (sha_handle == NULL) + { + return SAMPLE_ERROR_INVALID_PARAMETER; + } + SAFE_FREE(sha_handle); + return SAMPLE_SUCCESS; +} + + diff --git a/sdk/sample_libcrypto/sample_libcrypto.h b/sdk/sample_libcrypto/sample_libcrypto.h new file mode 100644 index 0000000000..bd907cf9b9 --- /dev/null +++ b/sdk/sample_libcrypto/sample_libcrypto.h @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** +* File: sample_libcrypto.h +* Description: +* Interface for generic crypto library APIs. This library does NOT have +* production quality crypto implementations. +* Some methods have been constructed to facilitate reproduceable results to +* aid in the debugging of the sample application. +*/ + +#ifndef SAMPLE_LIBCRYPTO_H +#define SAMPLE_LIBCRYPTO_H + +#include + +typedef enum sample_status_t +{ + SAMPLE_SUCCESS = 0, + + SAMPLE_ERROR_UNEXPECTED , // Unexpected error + SAMPLE_ERROR_INVALID_PARAMETER , // The parameter is incorrect + SAMPLE_ERROR_OUT_OF_MEMORY , // Not enough memory is available to complete this operation + +} sample_status_t; + +#define SAMPLE_SHA256_HASH_SIZE 32 +#define SAMPLE_ECP256_KEY_SIZE 32 +#define SAMPLE_NISTP_ECP256_KEY_SIZE (SAMPLE_ECP256_KEY_SIZE/sizeof(uint32_t)) +#define SAMPLE_AESGCM_IV_SIZE 12 +#define SAMPLE_AESGCM_KEY_SIZE 16 +#define SAMPLE_AESGCM_MAC_SIZE 16 +#define SAMPLE_CMAC_KEY_SIZE 16 +#define SAMPLE_CMAC_MAC_SIZE 16 +#define SAMPLE_AESCTR_KEY_SIZE 16 + +typedef struct sample_ec256_dh_shared_t +{ + uint8_t s[SAMPLE_ECP256_KEY_SIZE]; +} sample_ec256_dh_shared_t; + +typedef struct sample_ec256_private_t +{ + uint8_t r[SAMPLE_ECP256_KEY_SIZE]; +} sample_ec256_private_t; + +typedef struct sample_ec256_public_t +{ + uint8_t gx[SAMPLE_ECP256_KEY_SIZE]; + uint8_t gy[SAMPLE_ECP256_KEY_SIZE]; +} sample_ec256_public_t; + +typedef struct sample_ec256_signature_t +{ + uint32_t x[SAMPLE_NISTP_ECP256_KEY_SIZE]; + uint32_t y[SAMPLE_NISTP_ECP256_KEY_SIZE]; +} sample_ec256_signature_t; + +typedef void* sample_sha_state_handle_t; +typedef void* sample_cmac_state_handle_t; +typedef void* sample_ecc_state_handle_t; + +typedef uint8_t sample_sha256_hash_t[SAMPLE_SHA256_HASH_SIZE]; + +typedef uint8_t sample_aes_gcm_128bit_key_t[SAMPLE_AESGCM_KEY_SIZE]; +typedef uint8_t sample_aes_gcm_128bit_tag_t[SAMPLE_AESGCM_MAC_SIZE]; +typedef uint8_t sample_cmac_128bit_key_t[SAMPLE_CMAC_KEY_SIZE]; +typedef uint8_t sample_cmac_128bit_tag_t[SAMPLE_CMAC_MAC_SIZE]; +typedef uint8_t sample_aes_ctr_128bit_key_t[SAMPLE_AESCTR_KEY_SIZE]; + +#ifdef __cplusplus + #define EXTERN_C extern "C" +#else + #define EXTERN_C +#endif + + #define SAMPLE_LIBCRYPTO_API EXTERN_C + +/* Rijndael AES-GCM +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_aes_gcm_128bit_key_t *p_key - Pointer to key used in encryption/decryption operation +* uint8_t *p_src - Pointer to input stream to be encrypted/decrypted +* uint32_t src_len - Length of input stream to be encrypted/decrypted +* uint8_t *p_iv - Pointer to initialization vector to use +* uint32_t iv_len - Length of initialization vector +* uint8_t *p_aad - Pointer to input stream of additional authentication data +* uint32_t aad_len - Length of additional authentication data stream +* sample_aes_gcm_128bit_tag_t *p_in_mac - Pointer to expected MAC in decryption process +* Output: uint8_t *p_dst - Pointer to cipher text. Size of buffer should be >= src_len. +* sample_aes_gcm_128bit_tag_t *p_out_mac - Pointer to MAC generated from encryption process +* NOTE: Wrapper is responsible for confirming decryption tag matches encryption tag */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_rijndael128GCM_encrypt(const sample_aes_gcm_128bit_key_t *p_key, const uint8_t *p_src, uint32_t src_len, + uint8_t *p_dst, const uint8_t *p_iv, uint32_t iv_len, const uint8_t *p_aad, uint32_t aad_len, + sample_aes_gcm_128bit_tag_t *p_out_mac); + +/* Message Authentication - Rijndael 128 CMAC +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_cmac_128bit_key_t *p_key - Pointer to key used in encryption/decryption operation +* uint8_t *p_src - Pointer to input stream to be MAC +* uint32_t src_len - Length of input stream to be MAC +* Output: sample_cmac_gcm_128bit_tag_t *p_mac - Pointer to resultant MAC */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_rijndael128_cmac_msg(const sample_cmac_128bit_key_t *p_key, const uint8_t *p_src, + uint32_t src_len, sample_cmac_128bit_tag_t *p_mac); + + + +/* +* Elliptic Curve Crytpography - Based on GF(p), 256 bit +*/ +/* Allocates and initializes ecc context +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS or failure as defined SAMPLE_Error.h. +* Output: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_ecc256_open_context(sample_ecc_state_handle_t* ecc_handle); + +/* Cleans up ecc context +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS or failure as defined SAMPLE_Error.h. +* Output: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_ecc256_close_context(sample_ecc_state_handle_t ecc_handle); + +/* Populates private/public key pair - caller code allocates memory +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* Outputs: sample_ec256_private_t *p_private - Pointer to the private key +* sample_ec256_public_t *p_public - Pointer to the public key */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_ecc256_create_key_pair(sample_ec256_private_t *p_private, + sample_ec256_public_t *p_public, + sample_ecc_state_handle_t ecc_handle); + +/* Computes DH shared key based on private B key (local) and remote public Ga Key +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Inputs: sample_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sample_ec256_private_t *p_private_b - Pointer to the local private key - LITTLE ENDIAN +* sample_ec256_public_t *p_public_ga - Pointer to the remote public key - LITTLE ENDIAN +* Output: sample_ec256_dh_shared_t *p_shared_key - Pointer to the shared DH key - LITTLE ENDIAN +x-coordinate of (privKeyB - pubKeyA) */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_ecc256_compute_shared_dhkey(sample_ec256_private_t *p_private_b, + sample_ec256_public_t *p_public_ga, + sample_ec256_dh_shared_t *p_shared_key, + sample_ecc_state_handle_t ecc_handle); + + +/* Computes signature for data based on private key +* +* A message digest is a fixed size number derived from the original message with +* an applied hash function over the binary code of the message. (SHA256 in this case) +* The signer's private key and the message digest are used to create a signature. +* +* A digital signature over a message consists of a pair of large numbers, 256-bits each, +* which the given function computes. +* +* The scheme used for computing a digital signature is of the ECDSA scheme, +* an elliptic curve of the DSA scheme. +* +* The keys can be generated and set up by the function: sgx_ecc256_create_key_pair. +* +* The elliptic curve domain parameters must be created by function: +* sample_ecc256_open_context +* +* Return: If context, private key, signature or data pointer is NULL, +* SAMPLE_ERROR_INVALID_PARAMETER is returned. +* If the signature creation process fails then SAMPLE_ERROR_UNEXPECTED is returned. +* +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS, success, error code otherwise. +* Inputs: sample_ecc_state_handle_t ecc_handle - Handle to the ECC crypto system +* sample_ec256_private_t *p_private - Pointer to the private key - LITTLE ENDIAN +* uint8_t *p_data - Pointer to the data to be signed +* uint32_t data_size - Size of the data to be signed +* Output: ec256_signature_t *p_signature - Pointer to the signature - LITTLE ENDIAN */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_ecdsa_sign(const uint8_t *p_data, + uint32_t data_size, + sample_ec256_private_t *p_private, + sample_ec256_signature_t *p_signature, + sample_ecc_state_handle_t ecc_handle); + +/* Allocates and initializes sha256 state +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Output: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_sha256_init(sample_sha_state_handle_t* p_sha_handle); + +/* Updates sha256 has calculation based on the input message +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS or failure. +* Input: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state +* uint8_t *p_src - Pointer to the input stream to be hashed +* uint32_t src_len - Length of the input stream to be hashed */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_sha256_update(const uint8_t *p_src, uint32_t src_len, sample_sha_state_handle_t sha_handle); + +/* Returns Hash calculation +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Input: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state +* Output: sample_sha256_hash_t *p_hash - Resultant hash from operation */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_sha256_get_hash(sample_sha_state_handle_t sha_handle, sample_sha256_hash_t *p_hash); + +/* Cleans up sha state +* Parameters: +* Return: sample_status_t - SAMPLE_SUCCESS on success, error code otherwise. +* Input: sample_sha_state_handle_t sha_handle - Handle to the SHA256 state */ +SAMPLE_LIBCRYPTO_API sample_status_t sample_sha256_close(sample_sha_state_handle_t sha_handle); + +#endif diff --git a/sdk/sample_libcrypto/sample_libcrypto.lds b/sdk/sample_libcrypto/sample_libcrypto.lds new file mode 100644 index 0000000000..87ca100760 --- /dev/null +++ b/sdk/sample_libcrypto/sample_libcrypto.lds @@ -0,0 +1,23 @@ +/*** +* See http://sourceware.org/binutils/docs/ld/VERSION.html#VERSION for more info. +* // Comments don't work in this file. +***/ + +{ +global: + sample_ecc256_close_context; + sample_ecc256_compute_shared_dhkey; + sample_ecc256_create_key_pair; + sample_ecc256_open_context; + sample_ecdsa_sign; + sample_rijndael128GCM_encrypt; + sample_rijndael128_cmac_msg; + sample_sha256_close; + sample_sha256_get_hash; + sample_sha256_init; + sample_sha256_update; + +local: + *; +}; + diff --git a/sdk/selib/linux/Makefile b/sdk/selib/linux/Makefile new file mode 100644 index 0000000000..49aa5dbbc7 --- /dev/null +++ b/sdk/selib/linux/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -Werror -fno-rtti -fno-exceptions + +CPPLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal/ \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(LINUX_SDK_DIR)/selib + + +SRC := $(wildcard ../*.cpp) +OBJS := $(SRC:.cpp=.o) + +LIBSELIB := libselib.a + +.PHONY: all +all: $(LIBSELIB) + +$(LIBSELIB): $(OBJS) + $(AR) rcsD $@ $^ + +$(OBJS): %.o:%.cpp + $(CXX) -c $(CXXFLAGS) $(CPPLAGS) $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(OBJS) $(LIBSELIB) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/selib/sgx_create_report.cpp b/sdk/selib/sgx_create_report.cpp new file mode 100644 index 0000000000..6d4e9e9f97 --- /dev/null +++ b/sdk/selib/sgx_create_report.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: sgx_create_report.cpp + * Description: + * Wrapper for EREPORT instruction + */ + +#include "sgx_utils.h" +#include "util.h" +#include +#include +#include "se_memcpy.h" +#include "sgx_trts.h" +#include "trts_inst.h" +#include "se_cdefs.h" + +// add a version to tservice. +SGX_ACCESS_VERSION(tservice, 1) + +sgx_status_t sgx_create_report(const sgx_target_info_t *target_info, const sgx_report_data_t *report_data, sgx_report_t *report) +{ + int i = 0; + // check parameters + // + // target_info is allowed to be NULL, but if it is not NULL, it must be within the enclave + if(target_info) + { + if (!sgx_is_within_enclave(target_info, sizeof(*target_info))) + return SGX_ERROR_INVALID_PARAMETER; + + for(i=0; ireserved1[i] != 0) + return SGX_ERROR_INVALID_PARAMETER; + } + + for(i=0; ireserved2[i] != 0) + return SGX_ERROR_INVALID_PARAMETER; + } + } + // report_data is allowed to be NULL, but if it is not NULL, it must be within the enclave + if(report_data && !sgx_is_within_enclave(report_data, sizeof(*report_data))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // report must be within the enclave + if(!report || !sgx_is_within_enclave(report, sizeof(*report))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // allocate memory + // + // To minimize the effort of memory management, the three elements allocation + // are combined in a single malloc. The calculation for the required size has + // an assumption, that + // the elements should be allocated in descending order of the alignment size. + // + // If the alignment requirements are changed, the allocation order needs to + // change accordingly. + // + // Current allocation order is: + // report -> target_info -> report_data + // + // target_info: 512-byte aligned, 512-byte length + // report_data: 128-byte aligned, 64-byte length + // report: 512-byte aligned, 432-byte length + // + size_t size = ROUND_TO(sizeof(sgx_target_info_t), TARGET_INFO_ALIGN_SIZE) + + ROUND_TO(sizeof(sgx_report_data_t), REPORT_DATA_ALIGN_SIZE) + + ROUND_TO(sizeof(sgx_report_t), REPORT_ALIGN_SIZE); + size += MAX(MAX(TARGET_INFO_ALIGN_SIZE, REPORT_DATA_ALIGN_SIZE), REPORT_ALIGN_SIZE) - 1; + + void *buffer = malloc(size); + if(buffer == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(buffer, 0, size); + size_t buf_ptr = reinterpret_cast(buffer); + + buf_ptr = ROUND_TO(buf_ptr, REPORT_ALIGN_SIZE); + sgx_report_t *tmp_report = reinterpret_cast(buf_ptr); + buf_ptr += sizeof(*tmp_report); + + buf_ptr = ROUND_TO(buf_ptr, TARGET_INFO_ALIGN_SIZE); + sgx_target_info_t *tmp_target_info = reinterpret_cast(buf_ptr); + buf_ptr += sizeof(*tmp_target_info); + + buf_ptr = ROUND_TO(buf_ptr, REPORT_DATA_ALIGN_SIZE); + sgx_report_data_t *tmp_report_data = reinterpret_cast(buf_ptr); + + // Copy data from user buffer to the aligned memory + if(target_info) + { + memcpy_s(tmp_target_info, sizeof(*tmp_target_info), target_info, sizeof(*target_info)); + } + if(report_data) + { + memcpy_s(tmp_report_data, sizeof(*tmp_report_data), report_data, sizeof(*report_data)); + } + + // Do EREPORT + do_ereport(tmp_target_info, tmp_report_data, tmp_report); + + // Copy data to the user buffer + memcpy_s(report, sizeof(*report), tmp_report, sizeof(*tmp_report)); + + // cleanup + memset_s(buffer, size, 0, size); + free(buffer); + + return SGX_SUCCESS; +} + + + diff --git a/sdk/selib/sgx_get_key.cpp b/sdk/selib/sgx_get_key.cpp new file mode 100644 index 0000000000..f1c8d8d5ab --- /dev/null +++ b/sdk/selib/sgx_get_key.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: sgx_get_key.cpp + * Description: + * Wrapper for EGETKEY instruction + */ + +#include "sgx_utils.h" +#include "util.h" +#include +#include +#include "se_memcpy.h" +#include "trts_inst.h" +#include "sgx_trts.h" +#include "se_cdefs.h" + +// add a version to tservice. +SGX_ACCESS_VERSION(tservice, 2) + +sgx_status_t sgx_get_key(const sgx_key_request_t *key_request, sgx_key_128bit_t *key) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + void *buffer = NULL; + size_t size = 0, buf_ptr =0; + sgx_key_request_t *tmp_key_request = NULL; + sgx_key_128bit_t *tmp_key = NULL; + egetkey_status_t egetkey_status = EGETKEY_SUCCESS; + int i = 0; + + // check parameters + // + // key_request must be within the enclave + if(!key_request || !sgx_is_within_enclave(key_request, sizeof(*key_request))) + { + err = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + + if (key_request->reserved1 != 0) + { + err = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + + for (i=0; ireserved2[i] != 0) + { + err = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + } + + // key must be within the enclave + if(!key || !sgx_is_within_enclave(key, sizeof(*key))) + { + err = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + // check key_request->key_policy reserved bits + if(key_request->key_policy & ~(SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) + { + err = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + + // allocate memory + // + // To minimize the effort of memory management, the two elements allocation + // are combined in a single malloc. The calculation for the required size has + // an assumption, that + // the elements should be allocated in descending order of the alignment size. + // + // If the alignment requirements are changed, the allocation order needs to + // change accordingly. + // + // Current allocation order is: + // key_request -> key + // + // key_request: 512-byte aligned, 512-byte length + // key: 16-byte aligned, 16-byte length + size = ROUND_TO(sizeof(*key_request), KEY_REQUEST_ALIGN_SIZE) + ROUND_TO(sizeof(*key), KEY_ALIGN_SIZE); + size += MAX(KEY_REQUEST_ALIGN_SIZE, KEY_ALIGN_SIZE) - 1; + + buffer = malloc(size); + if(buffer == NULL) + { + err = SGX_ERROR_OUT_OF_MEMORY; + goto CLEANUP; + } + memset(buffer, 0, size); + buf_ptr = reinterpret_cast(buffer); + + buf_ptr = ROUND_TO(buf_ptr, KEY_REQUEST_ALIGN_SIZE); + tmp_key_request = reinterpret_cast(buf_ptr); + buf_ptr += sizeof(*tmp_key_request); + + buf_ptr = ROUND_TO(buf_ptr, KEY_ALIGN_SIZE); + tmp_key = reinterpret_cast(buf_ptr); + + // Copy data from user buffer to the aligned memory + memcpy_s(tmp_key_request, sizeof(*tmp_key_request), key_request, sizeof(*key_request)); + + // Do EGETKEY + egetkey_status = (egetkey_status_t) do_egetkey(tmp_key_request, tmp_key); + switch(egetkey_status) + { + case EGETKEY_SUCCESS: + err = SGX_SUCCESS; + break; + case EGETKEY_INVALID_ATTRIBUTE: + err = SGX_ERROR_INVALID_ATTRIBUTE; + break; + case EGETKEY_INVALID_CPUSVN: + err = SGX_ERROR_INVALID_CPUSVN; + break; + case EGETKEY_INVALID_ISVSVN: + err = SGX_ERROR_INVALID_ISVSVN; + break; + case EGETKEY_INVALID_KEYNAME: + err = SGX_ERROR_INVALID_KEYNAME; + break; + default: + err = SGX_ERROR_UNEXPECTED; + break; + } + + +CLEANUP: + if((SGX_SUCCESS != err) && (NULL != key)) + { + // The key buffer should be filled with random number. + // If sgx_read_rand returns failure, let the key buffer untouched + sgx_read_rand(reinterpret_cast(key), sizeof(*key)); + } + else if(NULL != key) + { + // Copy data to the user buffer + memcpy_s(key, sizeof(*key), tmp_key, sizeof(*tmp_key)); + } + + // cleanup + if(buffer) + { + memset_s(buffer, size, 0, size); + free(buffer); + } + + return err; +} diff --git a/sdk/selib/sgx_verify_report.cpp b/sdk/selib/sgx_verify_report.cpp new file mode 100644 index 0000000000..1828d8a7ae --- /dev/null +++ b/sdk/selib/sgx_verify_report.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: sgx_verify_report.cpp + * Description: + * API for report verification + */ + +#include "sgx_utils.h" +#include "util.h" +#include +#include +#include "se_memcpy.h" +#include "sgx_trts.h" +#include "sgx_tcrypto.h" +#include "se_cdefs.h" + +// add a version to tservice. +SGX_ACCESS_VERSION(tservice, 3) + +sgx_status_t sgx_verify_report(const sgx_report_t *report) +{ + sgx_mac_t mac; + sgx_key_request_t key_request; + sgx_key_128bit_t key; + sgx_status_t err = SGX_ERROR_UNEXPECTED; + //check parameter + if(!report||!sgx_is_within_enclave(report, sizeof(*report))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + memset(&mac, 0, sizeof(sgx_mac_t)); + memset(&key_request, 0, sizeof(sgx_key_request_t)); + memset(&key, 0, sizeof(sgx_key_128bit_t)); + + //prepare the key_request + key_request.key_name = SGX_KEYSELECT_REPORT; + memcpy_s(&key_request.key_id, sizeof(key_request.key_id), &report->key_id, sizeof(report->key_id)); + + //get the report key + // Since the key_request is not an input parameter by caller, + // we suppose sgx_get_key would never return the following error code: + // SGX_ERROR_INVALID_PARAMETER + // SGX_ERROR_INVALID_ATTRIBUTE + // SGX_ERROR_INVALID_CPUSVN + // SGX_ERROR_INVALID_ISVSVN + // SGX_ERROR_INVALID_KEYNAME + err = sgx_get_key(&key_request, &key); + if(err != SGX_SUCCESS) + { + return err; // err must be SGX_ERROR_OUT_OF_MEMORY or SGX_ERROR_UNEXPECTED + } + //get the report mac + err = sgx_rijndael128_cmac_msg((sgx_cmac_128bit_key_t*)&key, (const uint8_t *)(&report->body), sizeof(sgx_report_body_t), &mac); + memset_s (&key, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + if (SGX_SUCCESS != err) + { + if(err != SGX_ERROR_OUT_OF_MEMORY) + err = SGX_ERROR_UNEXPECTED; + return err; + } + if(consttime_memequal(mac, report->mac, sizeof(sgx_mac_t)) == 0) + { + return SGX_ERROR_MAC_MISMATCH; + } + else + { + return SGX_SUCCESS; + } +} diff --git a/sdk/selib/tservice_version.cpp b/sdk/selib/tservice_version.cpp new file mode 100644 index 0000000000..643c51902e --- /dev/null +++ b/sdk/selib/tservice_version.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_TSERVICE_VERSION_STR __CONCAT("SGX_TSERVICE_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_tservice_version = SGX_TSERVICE_VERSION_STR; + +#ifdef __cplusplus +} +#endif diff --git a/sdk/sign_tool/SignTool/Makefile b/sdk/sign_tool/SignTool/Makefile new file mode 100644 index 0000000000..5797756cb0 --- /dev/null +++ b/sdk/sign_tool/SignTool/Makefile @@ -0,0 +1,109 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +CXXFLAGS += -Werror +CFLAGS += -Werror + +CXXFLAGS += $(ADDED_INC) +CPPFLAGS += -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc/internal/linux/ \ + -I$(LINUX_PSW_DIR)/urts \ + -I$(LINUX_PSW_DIR)/urts/linux \ + -I$(LINUX_EXTERNAL_DIR)/tinyxml \ + -I$(LINUX_EXTERNAL_DIR)/crypto_px/include \ + -I$(LINUX_PSW_DIR)/urts/parser + +IPP_LIBS := -lcrypto_px +IPP_PATH := -L$(LINUX_EXTERNAL_DIR)/crypto_px + +DIR1 := $(LINUX_EXTERNAL_DIR)/tinyxml/ +DIR2 := $(COMMON_DIR)/src/ +DIR3 := $(LINUX_PSW_DIR)/urts/ +DIR4 := $(LINUX_PSW_DIR)/urts/linux +DIR5 := $(LINUX_PSW_DIR)/urts/parser +DIR6 := $(LINUX_PSW_DIR)/psw/urts/parser/linux + +OBJ1 := manage_metadata.o \ + enclave_creator_sign.o \ + sign_tool.o \ + parse_key_file.o \ + util_st.o + +OBJ2 := ipp_bn.o ipp_rsa_key.o ipp_rsa_pub_key.o sgx_memset_s.o + +OBJ3 := tinystr.o \ + tinyxml.o \ + tinyxmlerror.o \ + tinyxmlparser.o + +OBJ4 := loader.o \ + se_detect.o + +CPP_OBJS := $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) +C_OBJS := se_trace.o se_map.o +OBJS := $(CPP_OBJS) $(C_OBJS) + +vpath %.cpp $(DIR1):$(DIR2):$(DIR3):$(DIR4):$(DIR5):$(DIR6) + +.PHONY: all +all: sgx_sign | $(BUILD_DIR) + @$(CP) $< $| + +$(BUILD_DIR): + @$(MKDIR) $@ + +sgx_sign: PRIVATE_LDLIBS := $(IPP_LIBS) -lpthread -lenclaveparser +sgx_sign: PRIVATE_LDFLAGS := $(IPP_PATH) -L$(LINUX_PSW_DIR)/urts/parser +sgx_sign: $(OBJS) enclaveparser libcrypto_px + $(CXX) $(CXXFLAGS) $(OBJS) $(PRIVATE_LDFLAGS) $(PRIVATE_LDLIBS) -o $@ + +$(CPP_OBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +$(C_OBJS): %.o: $(DIR2)%.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + $(RM) *~ *.o sgx_sign $(BUILD_DIR)/sgx_sign + $(MAKE) -C $(LINUX_PSW_DIR)/urts/parser/ clean + $(MAKE) -C $(LINUX_EXTERNAL_DIR)/crypto_px/ clean + +.PHONY: enclaveparser +enclaveparser: + $(MAKE) -C $(LINUX_PSW_DIR)/urts/parser/ + +.PHONY: libcrypto_px +libcrypto_px: + $(MAKE) -C $(LINUX_EXTERNAL_DIR)/crypto_px/ diff --git a/sdk/sign_tool/SignTool/README.txt b/sdk/sign_tool/SignTool/README.txt new file mode 100644 index 0000000000..8007090bdf --- /dev/null +++ b/sdk/sign_tool/SignTool/README.txt @@ -0,0 +1,27 @@ +The sgx_sign generates the enclave signature and meta-data, and inserts the +information into the enclave file. +Meanwhile, the sgx_sign checks the enclave compatibility and provides the detail +information to users. + +Usage: + sgx_sign [options] file... + Commands: + sign Sign the enclave using the private key. + gendata Generate enclave signing material to be signed. + catsig Generate the signed enclave with the input signature + file, the public key and the enclave signing material. + Options: + -enclave Specify the enclave file to be signed. + It is a required option for the listed sgx_sign commands. + -key Specify the key file. + It is a required option for the sign and catsig commands. + -config Specify the configuration for the enclave. + -out Specify the output file. + It is a required option for the listed sgx_sign commands. + -sig Specify the signature file for the enclave signing + material. + It is a required option for the catsig command. + -unsigned Specify the enclave signing material generated by the + gendata command. + It is a required option for the catsig command. + diff --git a/sdk/sign_tool/SignTool/elf_helper.h b/sdk/sign_tool/SignTool/elf_helper.h new file mode 100644 index 0000000000..0f3bc05aef --- /dev/null +++ b/sdk/sign_tool/SignTool/elf_helper.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ELF_HELPER_H_ +#define _ELF_HELPER_H_ + +#include +#include + +#include "elf32parser.h" +#include "elf64parser.h" + +static void dump_textrel(const uint64_t& offset) +{ + using namespace std; + + cerr << "warning: TEXTRELs found at offset: " + << hex << showbase /* show the '0x' prefix */ + << offset << endl; +} + +template +struct ParserType +{ +}; + +template <> +struct ParserType<32> +{ + typedef Elf32Parser elf_parser_t; + typedef Elf32_Rel elf_rel_t; +}; + +template <> +struct ParserType<64> +{ + typedef Elf64Parser elf_parser_t; + typedef Elf64_Rela elf_rel_t; +}; + +template +class ElfHelper +{ + typedef typename ParserType::elf_parser_t elf_parser_t; + typedef typename ParserType::elf_rel_t elf_rel_t; + +public: + +#define get_rel_entry_addr(p, rel_entry_offset) \ + ((elf_rel_t *)const_cast(p->get_start_addr() + rel_entry_offset)) + + static uint64_t get_r_offset_from_entry(const elf_parser_t* p, + uint64_t offsets) + { + const elf_rel_t *rel = get_rel_entry_addr(p, offsets); + return (uint64_t)rel->r_offset; + } + + static void dump_textrels(BinParser *bp) + { + vector offsets; + + /* The dynamic_cast<> shouldn't fail. */ + elf_parser_t * p = dynamic_cast(bp); + if (p == NULL) + return; + + /* Warn user of TEXTRELs */ + p->get_reloc_entry_offset(".text", offsets); + for (size_t idx = 0; idx < offsets.size(); ++idx) + { + dump_textrel(get_r_offset_from_entry(p, offsets[idx])); + } + } +}; + +#endif diff --git a/sdk/sign_tool/SignTool/enclave_creator_sign.cpp b/sdk/sign_tool/SignTool/enclave_creator_sign.cpp new file mode 100644 index 0000000000..ebd6ac3fb7 --- /dev/null +++ b/sdk/sign_tool/SignTool/enclave_creator_sign.cpp @@ -0,0 +1,278 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** +* File: +* enclave_creator_sign.cpp +* Description: +* Measure the necessary information of the enclave +* to calculate the HASH value using SHA256 algorithm. +*/ + +#include "enclave_creator.h" +#include "sgx_eid.h" +#include "enclave_creator_sign.h" +#include "ipp_wrapper.h" +#include "se_trace.h" +#include "sgx_error.h" +#include "util_st.h" +#include "util.h" +#include "se_page_attr.h" + +#include +#include +#include + +#define DATA_BLOCK_SIZE 64 +#define EID 0x44444444 + +EnclaveCreatorST::EnclaveCreatorST() +{ + m_hash_valid_flag = false; + memset(m_enclave_hash, 0, SGX_HASH_SIZE); + m_ctx = NULL; + m_eid = EID; +} + +EnclaveCreatorST::~EnclaveCreatorST() +{ + SAFE_FREE_MM(m_ctx); +} + +int EnclaveCreatorST::create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae) +{ + if(!secs || !enclave_id || !start_addr) + { + se_trace(SE_TRACE_DEBUG, "ERROR: Bad pointer.\n"); + return SGX_ERROR_UNEXPECTED; + } + + UNUSED(ae); + + memset(m_enclave_hash, 0, SGX_HASH_SIZE); + int size_in_byte = 0; + IppStatus error_code = ippsHashGetSize(&size_in_byte); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR:ippsHashGetSize() failed in the enclave measurement process.\n"); + return SGX_ERROR_UNEXPECTED; + } + m_ctx = (IppsHashState *)malloc(size_in_byte); + if(m_ctx == NULL) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + return SGX_ERROR_OUT_OF_MEMORY; + } + error_code = ippsHashInit(m_ctx, IPP_ALG_HASH_SHA256); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR:ippsHashInit() failed in the enclave measurement process.\n"); + return SGX_ERROR_UNEXPECTED; + } + uint8_t ecreat_val[SIZE_NAMED_VALUE] = "ECREATE"; + + uint8_t data_block[DATA_BLOCK_SIZE]; + size_t offset = 0; + memset(data_block, 0, DATA_BLOCK_SIZE); + memcpy_s(data_block, sizeof(data_block), ecreat_val, SIZE_NAMED_VALUE); + offset += SIZE_NAMED_VALUE; + memcpy_s(&data_block[offset], sizeof(data_block)-offset, &secs->ssa_frame_size, sizeof(secs->ssa_frame_size)); + offset += sizeof(secs->ssa_frame_size); + memcpy_s(&data_block[offset], sizeof(data_block)-offset, &secs->size, sizeof(secs->size)); + error_code = ippsHashUpdate((Ipp8u *)&data_block, DATA_BLOCK_SIZE, m_ctx); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR:ippsHashUpdate() failed in the enclave measurement(ECREATE) process.\n"); + return SGX_ERROR_UNEXPECTED; + } + + *enclave_id = m_eid; + *start_addr = secs->base; + return SGX_SUCCESS; +} + +int EnclaveCreatorST::add_enclave_page(sgx_enclave_id_t enclave_id, void *src, uint64_t offset, const sec_info_t &sinfo, uint32_t attr) +{ + assert(m_ctx!=NULL); + UNUSED(enclave_id); + void* source = src; + uint8_t color_page[SE_PAGE_SIZE]; + if(!source) + { + memset(color_page, 0, SE_PAGE_SIZE); + source = reinterpret_cast(&color_page); + } + + for(unsigned int i = 0; i< sizeof(sinfo.reserved)/sizeof(sinfo.reserved[0]); i++) + { + if(sinfo.reserved[i] != 0) + return SGX_ERROR_UNEXPECTED; + } + /* sinfo.flags[64:16] should be 0 */ + if((sinfo.flags & (~SI_FLAGS_EXTERNAL)) != 0) + { + return SGX_ERROR_UNEXPECTED; + } + + /* Check the page attributes: must be ADD only or ADD+EXTEND */ + if (!(attr & (ADD_PAGE_ONLY)) || (attr & (~(ADD_EXTEND_PAGE)))) + { + return SGX_ERROR_UNEXPECTED; + } + + uint64_t page_offset = (uint64_t)offset; + uint8_t eadd_val[SIZE_NAMED_VALUE] = "EADD\0\0\0"; + + uint8_t data_block[DATA_BLOCK_SIZE]; + size_t db_offset = 0; + memset(data_block, 0, DATA_BLOCK_SIZE); + memcpy_s(data_block, sizeof(data_block), eadd_val, SIZE_NAMED_VALUE); + db_offset += SIZE_NAMED_VALUE; + memcpy_s(data_block+db_offset, sizeof(data_block)-db_offset, &page_offset, sizeof(page_offset)); + db_offset += sizeof(page_offset); + memcpy_s(data_block+db_offset, sizeof(data_block)-db_offset, &sinfo, sizeof(data_block)-db_offset); + IppStatus error_code = ippsHashUpdate((Ipp8u *)&data_block, DATA_BLOCK_SIZE, m_ctx); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR::ippsHashUpdate() failed in the enclave measurement(EADD) process.\n"); + return SGX_ERROR_UNEXPECTED; + } + + /* If the page need to eextend, do eextend. */ + if((attr & ADD_EXTEND_PAGE) == ADD_EXTEND_PAGE) + { + uint8_t *pdata = (uint8_t *)source; + uint8_t eextend_val[SIZE_NAMED_VALUE] = "EEXTEND"; + +#define EEXTEND_TIME 4 + for(int i = 0; i < SE_PAGE_SIZE; i += (DATA_BLOCK_SIZE * EEXTEND_TIME)) + { + db_offset = 0; + memset(data_block, 0, DATA_BLOCK_SIZE); + memcpy_s(data_block, sizeof(data_block), eextend_val, SIZE_NAMED_VALUE); + db_offset += SIZE_NAMED_VALUE; + memcpy_s(data_block+db_offset, sizeof(data_block)-db_offset, &page_offset, sizeof(page_offset)); + + error_code = ippsHashUpdate((Ipp8u *)&data_block, DATA_BLOCK_SIZE, m_ctx); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR:ippsHashUpdate() failed in the enclave measurement(EEXTEND) process.\n"); + return SGX_ERROR_UNEXPECTED; + } + + for(int j = 0; j < EEXTEND_TIME; j++) + { + memcpy_s(data_block, sizeof(data_block), pdata, DATA_BLOCK_SIZE); + error_code = ippsHashUpdate((Ipp8u *)&data_block, DATA_BLOCK_SIZE, m_ctx); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR:ippsHashUpdate() failed in the enclave measurement(EEXTEND) process.\n"); + return SGX_ERROR_UNEXPECTED; + } + pdata += DATA_BLOCK_SIZE; + page_offset += DATA_BLOCK_SIZE; + } + } + } + return SGX_SUCCESS; +} + +int EnclaveCreatorST::init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file) +{ + assert(m_ctx != NULL); + UNUSED(enclave_id), UNUSED(enclave_css), UNUSED(lc), UNUSED(prd_css_file); + + uint8_t temp_hash[SGX_HASH_SIZE]; + memset(temp_hash, 0, SGX_HASH_SIZE); + + /* Complete computation of the SHA256 digest and store the result into the hash. */ + IppStatus error_code = ippsHashFinal((Ipp8u *)temp_hash, m_ctx); + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ERROR:ippsHashFinal() failed in the enclave measurement process.\n"); + return SGX_ERROR_UNEXPECTED; + } + + for (int i = 0; i< SGX_HASH_SIZE; i++) + { + m_enclave_hash[i] = temp_hash[i]; + } + m_hash_valid_flag = true; + return SGX_SUCCESS; +} + +int EnclaveCreatorST::get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag) +{ + UNUSED(metadata), UNUSED(lc), UNUSED(flag); + memset(sgx_misc_attr, 0, sizeof(sgx_misc_attribute_t)); + return SGX_SUCCESS; +} + +int EnclaveCreatorST::destroy_enclave(sgx_enclave_id_t enclave_id) +{ + UNUSED(enclave_id); + SAFE_FREE_MM(m_ctx); + return SGX_SUCCESS; +} + +bool EnclaveCreatorST::get_plat_cap(sgx_misc_attribute_t *se_attr) +{ + UNUSED(se_attr); + return false; +} + +int EnclaveCreatorST::initialize(sgx_enclave_id_t enclave_id) +{ + UNUSED(enclave_id); + return SGX_SUCCESS; +} + +bool EnclaveCreatorST::use_se_hw() const +{ + return false; +} + +int EnclaveCreatorST::get_enclave_info(uint8_t *hash, int size) +{ + if(hash == NULL || size != SGX_HASH_SIZE || m_hash_valid_flag == false) + { + se_trace(SE_TRACE_DEBUG, "ERROR: something went wrong in the function get_enclave_hash().\n"); + return SGX_ERROR_UNEXPECTED; + } + else + { + memcpy_s(hash, size, m_enclave_hash, SGX_HASH_SIZE); + } + return SGX_SUCCESS; +} + +static EnclaveCreatorST g_enclave_creator_st; +EnclaveCreator* g_enclave_creator = &g_enclave_creator_st; diff --git a/sdk/sign_tool/SignTool/enclave_creator_sign.h b/sdk/sign_tool/SignTool/enclave_creator_sign.h new file mode 100644 index 0000000000..64fe6ea589 --- /dev/null +++ b/sdk/sign_tool/SignTool/enclave_creator_sign.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _ENCLAVE_CREATOR_SIGN_H_ +#define _ENCLAVE_CREATOR_SIGN_H_ + +#include "ippcp.h" + +#include "enclave_creator.h" +#include "sgx_eid.h" + +#define SIZE_NAMED_VALUE 8 + +class EnclaveCreatorST : public EnclaveCreator +{ +public: + EnclaveCreatorST(); + virtual ~EnclaveCreatorST(); + int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae); + int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr); + int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file); + int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag); + bool get_plat_cap(sgx_misc_attribute_t *se_attr); + int destroy_enclave(sgx_enclave_id_t enclave_id); + int initialize(sgx_enclave_id_t enclave_id); + bool use_se_hw() const; + + int get_enclave_info(uint8_t *hash, int size); + +private: + uint8_t m_enclave_hash[SGX_HASH_SIZE]; + IppsHashState *m_ctx; + bool m_hash_valid_flag; + sgx_enclave_id_t m_eid; +}; + +#endif diff --git a/sdk/sign_tool/SignTool/manage_metadata.cpp b/sdk/sign_tool/SignTool/manage_metadata.cpp new file mode 100644 index 0000000000..7ae747d4af --- /dev/null +++ b/sdk/sign_tool/SignTool/manage_metadata.cpp @@ -0,0 +1,662 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** +* File: +* manage_metadata.cpp +* Description: +* Parse the xml file to get the metadata and generate the output DLL +* with metadata. +*/ + +#include "metadata.h" +#include "tinyxml.h" +#include "manage_metadata.h" +#include "se_trace.h" +#include "util_st.h" +#include "section.h" +#include "se_page_attr.h" +#include "elf_util.h" + +#include +#include +#include +#include +#include + + +#define ALIGN_SIZE 0x1000 + +static bool traverser_parameter(const char *temp_name, const char *temp_text, xml_parameter_t *parameter, int parameter_count) +{ + assert(temp_name != NULL && parameter != NULL); + uint32_t temp_value=0; + if(temp_text == NULL) + { + se_trace(SE_TRACE_ERROR, LACK_VALUE_FOR_ELEMENT_ERROR, temp_name); + return false; + } + else + { + if(strchr(temp_text, '-')) + { + se_trace(SE_TRACE_ERROR, INVALID_VALUE_FOR_ELEMENT_ERROR, temp_name); + return false; + } + + errno = 0; + char* endptr = NULL; + temp_value = (uint32_t)strtoul(temp_text, &endptr, 0); + if(*endptr!='\0'||errno!=0) //Invalid value or valid value but out of the representable range + { + se_trace(SE_TRACE_ERROR, INVALID_VALUE_FOR_ELEMENT_ERROR, temp_name); + return false; + } + } + + //Look for the matched one + int i=0; + for(;i=parameter_count) //no matched, return false + { + se_trace(SE_TRACE_ERROR, UNREC_ELEMENT_ERROR, temp_name); + return false; + } + //found one matched + if(parameter[i].flag==1) //repeated definition of XML element, return false + { + se_trace(SE_TRACE_ERROR, REPEATED_DEFINE_ERROR, temp_name); + return false; + } + parameter[i].flag = 1; + if((temp_valueparameter[i].max_value)) // the value is invalid, return false + { + se_trace(SE_TRACE_ERROR, VALUE_OUT_OF_RANGE_ERROR, temp_name); + return false; + } + parameter[i].value = temp_value; + return true; +} + +bool parse_metadata_file(const char *xmlpath, xml_parameter_t *parameter, int parameter_count) +{ + const char* temp_name=NULL; + + assert(parameter != NULL); + if(xmlpath == NULL) // user didn't define the metadata xml file. + { + se_trace(SE_TRACE_NOTICE, "Use default metadata...\n"); + return true; + } + //use the metadata file that user gives us. parse xml file + TiXmlDocument doc(xmlpath); + bool loadOkay = doc.LoadFile(); + if(!loadOkay) + { + if(doc.ErrorId() == TiXmlBase::TIXML_ERROR_OPENING_FILE) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, xmlpath); + } + else + { + se_trace(SE_TRACE_ERROR, XML_FORMAT_ERROR); + } + return false; + } + doc.Print();//Write the document to standard out using formatted printing ("pretty print"). + + TiXmlNode *pmetadata_node = doc.FirstChild("EnclaveConfiguration"); + if(!pmetadata_node) + { + se_trace(SE_TRACE_ERROR, XML_FORMAT_ERROR); + return false; + } + TiXmlNode *sub_node = NULL; + sub_node = pmetadata_node->FirstChild(); + const char *temp_text = NULL; + + while(sub_node)//parse xml node + { + switch(sub_node->Type()) + { + case TiXmlNode::TINYXML_ELEMENT: + if(sub_node->ToElement()->FirstAttribute() != NULL) + { + se_trace(SE_TRACE_ERROR, XML_FORMAT_ERROR); + return false; + } + + temp_name = sub_node->ToElement()->Value(); + temp_text = sub_node->ToElement()->GetText(); + + //traverse every node. Compare with the default value. + if(traverser_parameter(temp_name, temp_text, parameter, parameter_count) == false) + { + se_trace(SE_TRACE_ERROR, XML_FORMAT_ERROR); + return false; + } + break; + case TiXmlNode::TINYXML_DECLARATION: + case TiXmlNode::TINYXML_COMMENT: + break; + + default: + se_trace(SE_TRACE_ERROR, XML_FORMAT_ERROR); + return false; + } + sub_node=pmetadata_node->IterateChildren(sub_node); + } + + return true; +} + +CMetadata::CMetadata(metadata_t *metadata, BinParser *parser) + : m_metadata(metadata) + , m_parser(parser) +{ + memset(m_metadata, 0, sizeof(metadata_t)); + memset(&m_create_param, 0, sizeof(m_create_param)); +} +CMetadata::~CMetadata() +{ +} +bool CMetadata::build_metadata(const xml_parameter_t *parameter) +{ + if(!modify_metadata(parameter)) + { + return false; + } + // layout table + if(!build_layout_table()) + { + return false; + } + // patch table + if(!build_patch_table()) + { + return false; + } + return true; +} +bool CMetadata::modify_metadata(const xml_parameter_t *parameter) +{ + assert(parameter != NULL); + m_metadata->version = META_DATA_MAKE_VERSION(MAJOR_VERSION,MINOR_VERSION ); + m_metadata->size = offsetof(metadata_t, data); + m_metadata->tcs_policy = parameter[TCSPOLICY].value; + m_metadata->ssa_frame_size = SSA_FRAME_SIZE; + //stack/heap must be page-align + if(parameter[STACKMAXSIZE].value % ALIGN_SIZE) + { + se_trace(SE_TRACE_ERROR, SET_STACK_SIZE_ERROR); + return false; + } + if(parameter[HEAPMAXSIZE].value % ALIGN_SIZE) + { + se_trace(SE_TRACE_ERROR, SET_HEAP_SIZE_ERROR); + return false; + } + // LE setting: HW != 0, Licensekey = 1 + // Other enclave setting: HW = 0, Licensekey = 0 + if((parameter[HW].value == 0 && parameter[LAUNCHKEY].value != 0) || + (parameter[HW].value != 0 && parameter[LAUNCHKEY].value == 0)) + { + se_trace(SE_TRACE_ERROR, SET_HW_LE_ERROR); + return false; + } + + m_metadata->max_save_buffer_size = MAX_SAVE_BUF_SIZE; + m_metadata->magic_num = METADATA_MAGIC; + m_metadata->desired_misc_select = 0; + m_metadata->enclave_css.body.misc_select = parameter[MISCSELECT].value; + m_metadata->enclave_css.body.misc_mask = parameter[MISCMASK].value; + + m_create_param.heap_max_size = parameter[HEAPMAXSIZE].value; + m_create_param.ssa_frame_size = SSA_FRAME_SIZE; + m_create_param.stack_max_size = parameter[STACKMAXSIZE].value; + m_create_param.tcs_max_num = parameter[TCSNUM].value; + m_create_param.tcs_policy = m_metadata->tcs_policy; + return true; +} + +void *CMetadata::alloc_buffer_from_metadata(uint32_t size) +{ + void *addr = GET_PTR(void, m_metadata, m_metadata->size); + m_metadata->size += size; + if((m_metadata->size < size) || (m_metadata->size > METADATA_SIZE)) + { + return NULL; + } + return addr; +} + +bool CMetadata::build_layout_entries(vector &layouts) +{ + uint32_t size = (uint32_t)(layouts.size() * sizeof(layout_t)); + layout_t *layout_table = (layout_t *) alloc_buffer_from_metadata(size); + if(layout_table == NULL) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + m_metadata->dirs[DIR_LAYOUT].offset = (uint32_t)PTR_DIFF(layout_table, m_metadata); + m_metadata->dirs[DIR_LAYOUT].size = size; + + uint64_t rva = calculate_sections_size(); + for(uint32_t i = 0; i < layouts.size(); i++) + { + memcpy_s(layout_table, sizeof(layout_t), &layouts[i], sizeof(layout_t)); + + if(!IS_GROUP_ID(layouts[i].entry.id)) + { + layout_table->entry.rva = rva; + rva += (uint64_t)(layouts[i].entry.page_count << SE_PAGE_SHIFT); + } + else + { + for (uint32_t j = 0; j < layouts[i].group.entry_count; j++) + { + layout_table->group.load_step += layouts[i-j-1].entry.page_count << SE_PAGE_SHIFT; + } + rva += layouts[i].group.load_times * layout_table->group.load_step; + } + layout_table++; + } + // enclave virtual size + m_metadata->enclave_size = calculate_enclave_size(rva); + if(m_metadata->enclave_size == (uint64_t)-1) + { + se_trace(SE_TRACE_ERROR, OUT_OF_EPC_ERROR); + return false; + } + // the last guard page entry to round the enclave size to power of 2 + if(m_metadata->enclave_size - rva > 0) + { + layout_table = (layout_t *)alloc_buffer_from_metadata(sizeof(layout_t)); + if(layout_table == NULL) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + layout_table->entry.id = LAYOUT_ID_GUARD; + layout_table->entry.rva = rva; + layout_table->entry.page_count = (uint32_t)((m_metadata->enclave_size - rva) >> SE_PAGE_SHIFT); + m_metadata->dirs[DIR_LAYOUT].size += (uint32_t)sizeof(layout_t); + } + return true; +} + +bool CMetadata::build_layout_table() +{ + vector layouts; + layout_t layout; + memset(&layout, 0, sizeof(layout)); + + layout_t guard_page; + memset(&guard_page, 0, sizeof(guard_page)); + guard_page.entry.id = LAYOUT_ID_GUARD; + guard_page.entry.page_count = SE_GUARD_PAGE_SIZE >> SE_PAGE_SHIFT; + + // heap + layout.entry.id = LAYOUT_ID_HEAP; + layout.entry.page_count = (uint32_t)(m_create_param.heap_max_size >> SE_PAGE_SHIFT); + layout.entry.attributes = ADD_PAGE_ONLY; + layout.entry.si_flags = SI_FLAGS_RW; + layouts.push_back(layout); + + // thread context memory layout + // guard page | stack | TCS | SSA | guard page | TLS + + // guard page + layouts.push_back(guard_page); + + // stack + layout.entry.id = LAYOUT_ID_STACK; + layout.entry.page_count = (uint32_t)(m_create_param.stack_max_size >> SE_PAGE_SHIFT); + layout.entry.attributes = ADD_EXTEND_PAGE; + layout.entry.si_flags = SI_FLAGS_RW; + layout.entry.content_size = 0xCCCCCCCC; + layouts.push_back(layout); + + // guard page + layouts.push_back(guard_page); + + // tcs + layout.entry.id = LAYOUT_ID_TCS; + layout.entry.page_count = TCS_SIZE >> SE_PAGE_SHIFT; + layout.entry.attributes = ADD_EXTEND_PAGE; + layout.entry.si_flags = SI_FLAGS_TCS; + tcs_t *tcs_template = (tcs_t *) alloc_buffer_from_metadata(TCS_TEMPLATE_SIZE); + if(tcs_template == NULL) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + layout.entry.content_offset = (uint32_t)PTR_DIFF(tcs_template, m_metadata), + layout.entry.content_size = TCS_TEMPLATE_SIZE; + layouts.push_back(layout); + memset(&layout, 0, sizeof(layout)); + + // ssa + layout.entry.id = LAYOUT_ID_SSA; + layout.entry.page_count = SSA_FRAME_SIZE * SSA_NUM; + layout.entry.attributes = ADD_EXTEND_PAGE; + layout.entry.si_flags = SI_FLAGS_RW; + layouts.push_back(layout); + + // guard page + layouts.push_back(guard_page); + + // td + layout.entry.id = LAYOUT_ID_TD; + layout.entry.page_count = 1; + const Section *section = m_parser->get_tls_section(); + if(section) + { + layout.entry.page_count += (uint32_t)(ROUND_TO_PAGE(section->virtual_size()) >> SE_PAGE_SHIFT); + } + layout.entry.attributes = ADD_EXTEND_PAGE; + layout.entry.si_flags = SI_FLAGS_RW; + layouts.push_back(layout); + + // group for thread context + if (m_create_param.tcs_max_num > 1) + { + memset(&layout, 0, sizeof(layout)); + layout.group.id = LAYOUT_ID_THREAD_GROUP; + layout.group.entry_count = (uint16_t) (layouts.size() - 1); + layout.group.load_times = m_create_param.tcs_max_num-1; + layouts.push_back(layout); + } + // build layout table + if(false == build_layout_entries(layouts)) + { + return false; + } + + // tcs template + if(false == build_tcs_template(tcs_template)) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + return true; +} +bool CMetadata::build_patch_entries(vector &patches) +{ + uint32_t size = (uint32_t)(patches.size() * sizeof(patch_entry_t)); + patch_entry_t *patch_table = (patch_entry_t *) alloc_buffer_from_metadata(size); + if(patch_table == NULL) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + m_metadata->dirs[DIR_PATCH].offset = (uint32_t)PTR_DIFF(patch_table, m_metadata); + m_metadata->dirs[DIR_PATCH].size = size; + + for(uint32_t i = 0; i < patches.size(); i++) + { + memcpy_s(patch_table, sizeof(patch_entry_t), &patches[i], sizeof(patch_entry_t)); + patch_table++; + } + return true; +} +bool CMetadata::build_patch_table() +{ + const uint8_t *base_addr = (const uint8_t *)m_parser->get_start_addr(); + vector patches; + patch_entry_t patch; + memset(&patch, 0, sizeof(patch)); + + // td template + uint8_t buf[200]; + uint32_t size = 200; + memset(buf, 0, size); + if(false == build_gd_template(buf, &size)) + { + return false; + } + uint8_t *gd_template = (uint8_t *)alloc_buffer_from_metadata(size); + if(gd_template == NULL) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + memcpy_s(gd_template, size, buf, size); + + uint64_t rva = m_parser->get_symbol_rva("g_global_data"); + if(0 == rva) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + + patch.dst = (uint64_t)PTR_DIFF(get_rawdata_by_rva(rva), base_addr); + patch.src = (uint32_t)PTR_DIFF(gd_template, m_metadata); + patch.size = size; + patches.push_back(patch); + + // patch the image header + uint64_t *zero = (uint64_t *)alloc_buffer_from_metadata(sizeof(*zero)); + if(zero == NULL) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + return false; + } + *zero = 0; + bin_fmt_t bf = m_parser->get_bin_format(); + if(bf == BF_ELF32) + { + Elf32_Ehdr *elf_hdr = (Elf32_Ehdr *)base_addr; + patch.dst = (uint64_t)PTR_DIFF(&elf_hdr->e_shnum, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(elf_hdr->e_shnum); + patches.push_back(patch); + + patch.dst = (uint64_t)PTR_DIFF(&elf_hdr->e_shoff, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(elf_hdr->e_shoff); + patches.push_back(patch); + + patch.dst = (uint64_t)PTR_DIFF(&elf_hdr->e_shstrndx, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(elf_hdr->e_shstrndx); + patches.push_back(patch); + + // Modify GNU_RELRO info to eliminate the impact of enclave measurement. + Elf32_Phdr *prg_hdr = GET_PTR(Elf32_Phdr, base_addr, elf_hdr->e_phoff); + for (unsigned idx = 0; idx < elf_hdr->e_phnum; ++idx, ++prg_hdr) + { + if(prg_hdr->p_type == PT_GNU_RELRO) + { + patch.dst = (uint64_t)PTR_DIFF(prg_hdr, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(Elf32_Phdr); + patches.push_back(patch); + break; + } + } + } + else if(bf == BF_ELF64) + { + Elf64_Ehdr *elf_hdr = (Elf64_Ehdr *)base_addr; + + patch.dst = (uint64_t)PTR_DIFF(&elf_hdr->e_shnum, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(elf_hdr->e_shnum); + patches.push_back(patch); + + patch.dst = (uint64_t)PTR_DIFF(&elf_hdr->e_shoff, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(elf_hdr->e_shoff); + patches.push_back(patch); + + patch.dst = (uint64_t)PTR_DIFF(&elf_hdr->e_shstrndx, base_addr); + patch.src = (uint32_t)PTR_DIFF(zero, m_metadata); + patch.size = (uint32_t)sizeof(elf_hdr->e_shstrndx); + patches.push_back(patch); + } + if(false == build_patch_entries(patches)) + { + return false; + } + return true; +} +layout_entry_t *CMetadata::get_entry_by_id(uint16_t id) +{ + layout_entry_t *layout_start = GET_PTR(layout_entry_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset); + layout_entry_t *layout_end = GET_PTR(layout_entry_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset + m_metadata->dirs[DIR_LAYOUT].size); + for (layout_entry_t *layout = layout_start; layout < layout_end; layout++) + { + if(layout->id == id) + return layout; + } + assert(false); + return NULL; +} +bool CMetadata::build_gd_template(uint8_t *data, uint32_t *data_size) +{ + m_create_param.stack_limit_addr = get_entry_by_id(LAYOUT_ID_STACK)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva; + m_create_param.stack_base_addr = (get_entry_by_id(LAYOUT_ID_STACK)->page_count << SE_PAGE_SHIFT) + m_create_param.stack_limit_addr; + m_create_param.first_ssa_gpr = get_entry_by_id(LAYOUT_ID_SSA)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva + + SSA_FRAME_SIZE * SE_PAGE_SIZE - (uint64_t)sizeof(ssa_gpr_t); + m_create_param.enclave_size = m_metadata->enclave_size; + m_create_param.heap_offset = get_entry_by_id(LAYOUT_ID_HEAP)->rva; + + uint64_t tmp_tls_addr = get_entry_by_id(LAYOUT_ID_TD)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva; + m_create_param.td_addr = tmp_tls_addr + ((get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); + + const Section *section = m_parser->get_tls_section(); + if(section) + { + /* adjust the tls_addr to be the pointer to the actual TLS data area */ + m_create_param.tls_addr = m_create_param.td_addr - section->virtual_size(); + assert(TRIM_TO_PAGE(m_create_param.tls_addr) == tmp_tls_addr); + } + else + m_create_param.tls_addr = tmp_tls_addr; + + if(false == m_parser->update_global_data(&m_create_param, data, data_size)) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); // metadata structure doesnot have enough memory for global_data template + return false; + } + return true; +} + +bool CMetadata::build_tcs_template(tcs_t *tcs) +{ + tcs->oentry = m_parser->get_symbol_rva("enclave_entry"); + if(tcs->oentry == 0) + { + return false; + } + tcs->nssa = SSA_NUM; + tcs->cssa = 0; + tcs->ossa = get_entry_by_id(LAYOUT_ID_SSA)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva; + //fs/gs pointer at TLS/TD + tcs->ofs_base = tcs->ogs_base = get_entry_by_id(LAYOUT_ID_TD)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva + (uint64_t)((get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); + tcs->ofs_limit = tcs->ogs_limit = (uint32_t)-1; + return true; +} + +void* CMetadata::get_rawdata_by_rva(uint64_t rva) +{ + std::vector sections = m_parser->get_sections(); + + for(unsigned int i = 0; i < sections.size() ; i++) + { + uint64_t start_rva = TRIM_TO_PAGE(sections[i]->get_rva()); + uint64_t end_rva = ROUND_TO_PAGE(sections[i]->get_rva() + sections[i]->virtual_size()); + if(start_rva <= rva && rva < end_rva) + { + uint64_t offset = rva - sections[i]->get_rva(); + if (offset > sections[i]->raw_data_size()) + { + return 0; + } + return GET_PTR(void, sections[i]->raw_data(), offset); + } + } + + return 0; +} + +uint64_t CMetadata::calculate_sections_size() +{ + std::vector sections = m_parser->get_sections(); + uint64_t max_rva = 0; + Section *last_section = NULL; + + for(unsigned int i = 0; i < sections.size() ; i++) + { + if(sections[i]->get_rva() > max_rva) { + max_rva = sections[i]->get_rva(); + last_section = sections[i]; + } + } + + uint64_t size = (NULL == last_section) ? (0) : (last_section->get_rva() + last_section->virtual_size()); + size = ROUND_TO_PAGE(size); + + return size; +} + +uint64_t CMetadata::calculate_enclave_size(uint64_t size) +{ + uint64_t enclave_max_size = m_parser->get_enclave_max_size(); + + if(size > enclave_max_size) + return (uint64_t)-1; + + uint64_t round_size = 1; + while (round_size < size) + { + round_size <<=1; + if(!round_size) + return (uint64_t)-1; + } + + if(round_size > enclave_max_size) + return (uint64_t)-1; + + return round_size; +} + +bool update_metadata(const char *path, const metadata_t *metadata, uint64_t meta_offset) +{ + assert(path != NULL && metadata != NULL); + + return write_data_to_file(path, std::ios::in | std::ios::binary| std::ios::out, + reinterpret_cast(const_cast( metadata)), metadata->size, (long)meta_offset); +} + diff --git a/sdk/sign_tool/SignTool/manage_metadata.h b/sdk/sign_tool/SignTool/manage_metadata.h new file mode 100644 index 0000000000..b6033fd0a7 --- /dev/null +++ b/sdk/sign_tool/SignTool/manage_metadata.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _MANAGE_METADATA_H_ +#define _MANAGE_METADATA_H_ + +#include "metadata.h" +#include "uncopyable.h" +#include "loader.h" +#include "binparser.h" + +#define MAX_BUFFER_SIZE 4096 +#define TCS_TEMPLATE_SIZE 72 + +#define STRCMP strcmp +#define STRNCMP strncmp + +#define SSA_NUM 2 +#define SSA_FRAME_SIZE 1 + +typedef enum _para_type_t +{ + PRODID = 0, + ISVSVN, + RELEASETYPE, + INTELSIGNED, + PROVISIONKEY, + LAUNCHKEY, + DISABLEDEBUG, + HW, + TCSNUM, + TCSPOLICY, + STACKMAXSIZE, + HEAPMAXSIZE, + MISCSELECT, + MISCMASK +} para_type_t; + +typedef struct _xml_parameter_t +{ + const char* name; //the element name + uint32_t max_value; + uint32_t min_value; + uint32_t value; //parameter value. Initialized with the default value. + uint32_t flag; //Show whether it has been matched +} xml_parameter_t; + + +bool parse_metadata_file(const char *xmlpath, xml_parameter_t *parameter, int parameter_count); +bool update_metadata(const char *path, const metadata_t *metadata, uint64_t meta_offset); + +class CMetadata: private Uncopyable +{ +public: + CMetadata(metadata_t *metadata, BinParser *parser); + ~CMetadata(); + bool build_metadata(const xml_parameter_t *parameter); +private: + bool modify_metadata(const xml_parameter_t *parameter); + void *alloc_buffer_from_metadata(uint32_t size); + bool build_layout_table(); + bool build_patch_table(); + bool build_layout_entries(vector &layouts); + bool build_patch_entries(vector &patches); + + layout_entry_t *get_entry_by_id(uint16_t id); + bool build_tcs_template(tcs_t *tcs); + bool build_gd_template(uint8_t *data, uint32_t *data_size); + + uint64_t calculate_sections_size(); + uint64_t calculate_enclave_size(uint64_t size); + void* get_rawdata_by_rva(uint64_t rva); + + metadata_t *m_metadata; + BinParser *m_parser; + create_param_t m_create_param; +}; +#endif diff --git a/sdk/sign_tool/SignTool/parse_key_file.cpp b/sdk/sign_tool/SignTool/parse_key_file.cpp new file mode 100644 index 0000000000..bc8aa45f0b --- /dev/null +++ b/sdk/sign_tool/SignTool/parse_key_file.cpp @@ -0,0 +1,517 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** +* File: +* parse_key_file.cpp +* Description: +* Parse the RSA key file that user inputs +* to get the key type and rsa structure. +*/ + +#include "parse_key_file.h" +#include "se_trace.h" +#include "arch.h" +#include "util_st.h" + +#include +#include +#include +#include + +#include +#include +#include + + +//N_SIZE+E_SIZE+D_SIZE+P_SIZE+Q_SIZE+DMP1_SIZE+DMQ1_SIZE+sizeof(inverseQ) +#define PRI_COMPONENTS_SIZE (N_SIZE_IN_BYTES + E_SIZE_IN_BYTES + D_SIZE_IN_BYTES + P_SIZE_IN_BYTES *5) +#define PUB_CONPONENTS_SIZE (N_SIZE_IN_BYTES + E_SIZE_IN_BYTES) //N_SIZE+E_SIZE + + +#define CHECK_RETRUN(value) {if(0 == (value)) return 0;} + + +//base64Decode +// to decode the base64 string and put it to the result. +//Parameters +// [IN] aSrc: the source string coded in base64 +// srcLen: length of the source string +// [OUT] result: point to the decoded string +//Return Value +// int---The length of the decoded string +static int base64_decode(const unsigned char* aSrc, size_t srcLen, unsigned char* result) +{ + static char index_64[256] = { + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, + 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, + 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 + }; + + CHECK_RETRUN(aSrc); + CHECK_RETRUN(srcLen); + CHECK_RETRUN(result); + + + unsigned char ch1 = 0, ch2 = 0, ch3 = 0, ch4 = 0; + unsigned char *ptr = result; + + for (unsigned int i = 0; i < srcLen; ++i) + { + ch1 = index_64[aSrc[i]]; + if(ch1 == 64) + continue; + ch2 = index_64[aSrc[++i]]; + if(ch2 == 64) + continue; + *(ptr++) = (unsigned char)(ch1<<2 | ch2>>4); + ch3 = index_64[aSrc[++i]]; + if(aSrc[i] == '=' || ch3 == 64) + continue; + *(ptr++) = (unsigned char)(ch2<<4 | ch3>>2); + ch4 = index_64[aSrc[++i]]; + if(aSrc[i] == '=' || ch4 == 64) + continue; + *(ptr++) = (unsigned char)(ch3<<6 | ch4); + } + return (int)(ptr - result); +} + +static void convert_string(unsigned char *str, int len) +{ + assert(str != NULL&&len>0); + char temp = 0; + for(int i=0; in, sizeof(rsa->n), psrc+index, N_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->n, sizeof(rsa->n)); + + //get EXPONENT + index += N_SIZE_IN_BYTES; + if(!((unsigned int)psrc[index] == 0x02 &&(unsigned int)psrc[index+1] == 0x01)) //"0x01" indicates the size of e is 1 byte + { + se_trace(SE_TRACE_ERROR, "Only '3' is accepted as the Exponent value.\n"); + return false; + } + index += 2; + unsigned int temp = *(psrc+index); + if(temp != 0x03) + { + se_trace(SE_TRACE_ERROR, "Key Exponent is %#x. Only '3' is accepted as the Exponent value.\n", temp); + return false; + } + temp = temp&0x0f; + memcpy_s(rsa->e, sizeof(rsa->e), &temp, sizeof(unsigned int)); + + //get D + index += 1; + if((unsigned int)psrc[index]!=0x02) + { + return false; + } + + index = index+4; + if((int)psrc[index] == 0) + index += 1; + memcpy_s(rsa->d, sizeof(rsa->d), psrc+index, D_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->d, sizeof(rsa->d)); + + //get P + index += D_SIZE_IN_BYTES; + if((unsigned int)psrc[index]!=0x02) + { + return false; + } + index = index+4; + if((int)psrc[index] == 0) + index += 1; + memcpy_s(rsa->p, sizeof(rsa->p), psrc+index, P_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->p, sizeof(rsa->p)); + + //get Q + index += P_SIZE_IN_BYTES; + if((unsigned int)psrc[index]!=0x02) + { + return false; + } + + index = index+4; + if((int)psrc[index] == 0) + index += 1; + memcpy_s(rsa->q, sizeof(rsa->q), psrc+index, Q_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->q, sizeof(rsa->q)); + + //get DMP1 + index += Q_SIZE_IN_BYTES; + if((unsigned int)psrc[index]!=0x02) + { + return false; + } + index += 4; + if((int)psrc[index] == 0) + index += 1; + memcpy_s(rsa->dmp1, sizeof(rsa->dmp1), psrc+index, DMP1_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->dmp1, sizeof(rsa->dmp1)); + + //get DMQ1 + index += DMP1_SIZE_IN_BYTES; + if((unsigned int)psrc[index]!=0x02) + { + return false; + } + index += 4; + if((int)psrc[index] == 0) + index += 1; + memcpy_s(rsa->dmq1, sizeof(rsa->dmq1), psrc+index, DMQ1_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->dmq1, sizeof(rsa->dmq1)); + + //get IQMP + index += DMQ1_SIZE_IN_BYTES; + if((unsigned int)psrc[index]!=0x02) + { + return false; + } + index += 3; + if((int)psrc[index] == 0) + index += 1; + memcpy_s(rsa->iqmp, sizeof(rsa->iqmp), psrc+index, IQMP_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->iqmp, sizeof(rsa->iqmp)); + + return true; +} + +static bool convert_from_pub_key(const unsigned char *psrc, unsigned int slen, rsa_params_t *rsa) +{ + assert(NULL != psrc && NULL != rsa); + if(slenn, sizeof(rsa->n), psrc+index, N_SIZE_IN_BYTES); + convert_string((unsigned char *)rsa->n, sizeof(rsa->n)); + + //get EXPONENT + index += N_SIZE_IN_BYTES; + if(!((unsigned int)psrc[index] == 0x02 &&(unsigned int)psrc[index+1] == 0x01)) //"0x01" indicates the size of e is 1 byte + { + se_trace(SE_TRACE_ERROR, "Only '3' is accepted as the Exponent value.\n"); + return false; + } + index += 2; + unsigned int temp = *(psrc+index); + if(temp != 0x03) + { + se_trace(SE_TRACE_ERROR, "Key Exponent is %#x. Only '3' is accepted as the Exponent value.\n", temp); + return false; + } + temp = temp&0x0f; + memcpy_s(rsa->e, sizeof(rsa->e), &temp, sizeof(unsigned int)); + return true; +} + +static unsigned char* decode_key_body(unsigned char *buffer, size_t slen, int *key_type, int *rlen) +{ + assert(buffer!=NULL && key_type!=NULL && rlen!=NULL); + + const char pri_key_header[] = "-----BEGINRSAPRIVATEKEY-----" ; + const char pri_key_end[] = "-----ENDRSAPRIVATEKEY-----\n"; + const char pub_key_header[] = "-----BEGINPUBLICKEY-----"; + const char pub_key_end[] = "-----ENDPUBLICKEY-----\n"; + + int ktype = UNIDENTIFIABLE_KEY; + int offset_pri = (int)(slen - strlen(pri_key_end)); + int offset_pub = (int)(slen - strlen(pub_key_end)); + + if(offset_pub<=0 || offset_pri<=0) + { + se_trace(SE_TRACE_ERROR, KEY_FORMAT_ERROR); + *key_type = UNIDENTIFIABLE_KEY; + return NULL; + } + + //check the file header and footer to get the key type + if(!strncmp((const char *)buffer, pri_key_header, strlen(pri_key_header))) + { + //make sure the key file isn't an emcrypted PEM private key file. + if((!strncmp((const char *)(buffer+offset_pri), pri_key_end, strlen(pri_key_end))) && + !strstr((const char *)buffer, "Proc-Type: 4, ENCRYPTED")) + { + *(buffer+offset_pri-1) = '\0'; //remove the pri_key_end string + ktype = PRIVATE_KEY; + } + else + { + ktype = UNIDENTIFIABLE_KEY; + } + } + else if(!strncmp((const char *)buffer, pub_key_header, strlen(pub_key_header))) + { + if(!strncmp((const char *)(buffer+offset_pub), pub_key_end, strlen(pub_key_end))) + { + *(buffer + offset_pub-1) = '\0'; + ktype = PUBLIC_KEY; + } + else + { + ktype = UNIDENTIFIABLE_KEY; + } + } + else + { + ktype = UNIDENTIFIABLE_KEY; + } + //get the body contents of the key file + size_t body_size = 0, body_offset = 0; + if(ktype == PRIVATE_KEY) + { + body_size = strlen((const char *)buffer) - strlen(pri_key_header); + body_offset = strlen(pri_key_header)+1; + } + else if(ktype == PUBLIC_KEY) + { + body_size = strlen((const char *)buffer) - strlen(pub_key_header); + body_offset = strlen(pub_key_header)+1; + } + else + { + se_trace(SE_TRACE_ERROR, KEY_FORMAT_ERROR); + *key_type = ktype; + return NULL; + } + unsigned char *decoded_string = (unsigned char *)malloc(sizeof(char)*body_size); + if(!decoded_string) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + *key_type = ktype; + return NULL; + } + memset(decoded_string, 0, body_size); + int retlen = base64_decode(buffer+body_offset, body_size, decoded_string); + if(retlen == 0) + { + se_trace(SE_TRACE_ERROR, KEY_FORMAT_ERROR); + *key_type = ktype; + free(decoded_string); + return NULL; + } + *key_type = ktype; + *rlen = retlen; + return decoded_string; +} + +//read_key_file +// read the input file line by line and trim the blank characters for each line +//Parameters +// [IN] key_path: the file required to be read +static std::string read_key_file(const char *key_path) +{ + assert(key_path != NULL); + + std::ifstream ifs(key_path, std::ios::in | std::ios::binary); + if(!ifs.good()) + { + se_trace(SE_TRACE_ERROR, READ_FILE_ERROR, key_path); + return ""; + } + std::string file_content; + std::string str; + while(std::getline(ifs, str)) + { + str.erase(std::remove_if(str.begin(), str.end(), ::isspace), str.end()); + if(str.length() != 0) + { + file_content += str; + file_content += "\n"; // Add '\n' for each line + } + } + ifs.close(); + return file_content; +} + +//parse_key_file(): +// parse the RSA key file +//Parameters: +// [IN] key_path: the key file name user inputs +// [OUT] prsa: the rsa structure parsed from the key file +// pkey_type: the key type +//Return Value: +// true: success +// false: fail +bool parse_key_file(const char *key_path, rsa_params_t *prsa, int *pkey_type) +{ + assert(prsa != NULL && pkey_type != NULL); + + if(key_path == NULL) + { + *pkey_type = NO_KEY; + return false; + } + + //read and trim the file content + std::string file_content = read_key_file(key_path); + if(file_content.empty() == true) + { + *pkey_type = UNIDENTIFIABLE_KEY; + return false; + } + const unsigned char *buffer = (const unsigned char *)file_content.c_str(); + + //decode the buffer to decoded_string + size_t result = strlen((const char *)buffer); + int retlen = 0; + int key_type = UNIDENTIFIABLE_KEY; + unsigned char *decoded_string = decode_key_body(const_cast(buffer), result, &key_type, &retlen); + if(!decoded_string) + { + *pkey_type = key_type; + return false; + } + + //get RSA from the decoded string + bool ret = false; + if(key_type == PRIVATE_KEY) + { + ret = convert_from_pri_key(decoded_string, retlen, prsa); + } + else + { + ret = convert_from_pub_key(decoded_string, retlen, prsa); + } + if(ret == false) + { + se_trace(SE_TRACE_ERROR, KEY_FORMAT_ERROR); + free(decoded_string); + *pkey_type = key_type; + return false; + } + else + { + se_trace(SE_TRACE_DEBUG, "Parsing key file is OK.\n"); + } + + *pkey_type = key_type; + free(decoded_string); + return true; +} diff --git a/sdk/sign_tool/SignTool/parse_key_file.h b/sdk/sign_tool/SignTool/parse_key_file.h new file mode 100644 index 0000000000..aca34c204e --- /dev/null +++ b/sdk/sign_tool/SignTool/parse_key_file.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + +#ifndef _PARSE_KEY_FILE_H_ +#define _PARSE_KEY_FILE_H_ + + +#define N_SIZE_IN_BYTES 384 +#define E_SIZE_IN_BYTES 4 +#define D_SIZE_IN_BYTES 384 +#define P_SIZE_IN_BYTES 192 +#define Q_SIZE_IN_BYTES 192 +#define DMP1_SIZE_IN_BYTES 192 +#define DMQ1_SIZE_IN_BYTES 192 +#define IQMP_SIZE_IN_BYTES 192 + +#define N_SIZE_IN_UINT N_SIZE_IN_BYTES/sizeof(unsigned int) +#define E_SIZE_IN_UINT E_SIZE_IN_BYTES/sizeof(unsigned int) +#define D_SIZE_IN_UINT D_SIZE_IN_BYTES/sizeof(unsigned int) +#define P_SIZE_IN_UINT P_SIZE_IN_BYTES/sizeof(unsigned int) +#define Q_SIZE_IN_UINT Q_SIZE_IN_BYTES/sizeof(unsigned int) +#define DMP1_SIZE_IN_UINT DMP1_SIZE_IN_BYTES/sizeof(unsigned int) +#define DMQ1_SIZE_IN_UINT DMQ1_SIZE_IN_BYTES/sizeof(unsigned int) +#define IQMP_SIZE_IN_UINT IQMP_SIZE_IN_BYTES/sizeof(unsigned int) + +typedef enum _key_type_t +{ + UNIDENTIFIABLE_KEY = -1, + NO_KEY = 0, + PRIVATE_KEY, + PUBLIC_KEY +} key_type_t; + +typedef struct _rsa_params_t +{ + unsigned int n[N_SIZE_IN_UINT]; + unsigned int e[E_SIZE_IN_UINT]; + unsigned int d[D_SIZE_IN_UINT]; + unsigned int p[P_SIZE_IN_UINT]; + unsigned int q[Q_SIZE_IN_UINT]; + unsigned int dmp1[DMP1_SIZE_IN_UINT]; + unsigned int dmq1[DMQ1_SIZE_IN_UINT]; + unsigned int iqmp[IQMP_SIZE_IN_UINT]; +}rsa_params_t; + + +bool parse_key_file(const char *key_path, rsa_params_t *prsa, int *pkey_type); + +#endif diff --git a/sdk/sign_tool/SignTool/sign_tool.cpp b/sdk/sign_tool/SignTool/sign_tool.cpp new file mode 100644 index 0000000000..5f6d66e93b --- /dev/null +++ b/sdk/sign_tool/SignTool/sign_tool.cpp @@ -0,0 +1,1177 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// SignTool.cpp : Defines the entry point for the console application. +// + +/** +* File: +* sign_tool.cpp +*Description: +* Defines the entry point for the application. +* +*/ + +#include "ippcp.h" +#include "ippcore.h" + +#include "metadata.h" +#include "manage_metadata.h" +#include "ipp_wrapper.h" +#include "parse_key_file.h" +#include "enclave_creator_sign.h" +#include "util_st.h" + +#include "se_trace.h" +#include "sgx_error.h" + +#include "se_map.h" +#include "loader.h" +#include "parserfactory.h" +#include "elf_helper.h" + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#define SIGNATURE_SIZE 384 + +typedef enum _command_mode_t +{ + SIGN = 0, + GENDATA, + CATSIG, + COMPARE +} command_mode_t; + +typedef enum _file_path_t +{ + DLL = 0, + XML = 1, + KEY, + OUTPUT, + SIG, + UNSIGNED, + REVIEW_ENCLAVE +} file_path_t; + +static bool get_time(uint32_t *date) +{ + assert(date != NULL); + + time_t rawtime = 0; + if(time( &rawtime) == -1) + return false; + struct tm *timeinfo = gmtime(&rawtime); + if(timeinfo == NULL) + return false; + uint32_t tmp_date = (timeinfo->tm_year+1900)*10000 + (timeinfo->tm_mon+1)*100 + timeinfo->tm_mday; + stringstream ss; + ss<<"0x"<>hex>>tmp_date; + *date = tmp_date; + return true; +} + +static int load_enclave(BinParser *parser, metadata_t *metadata) +{ + std::unique_ptr ploader(new CLoader(const_cast(parser->get_start_addr()), *parser)); + return ploader->load_enclave_ex(NULL, 0, metadata, NULL); +} + + +#define THE_INVALID_HANDLE (-1) + +static int open_file(const char* dllpath) +{ + FILE *fp = fopen(dllpath, "rb"); + if (fp == NULL) + return THE_INVALID_HANDLE; + + return fileno(fp); +} + +static void close_handle(int fd) +{ + close(fd); +} + + +static bool get_enclave_info(BinParser *parser, bin_fmt_t *bf, uint64_t * meta_offset) +{ + uint64_t meta_rva = parser->get_metadata_offset(); + const uint8_t *base_addr = parser->get_start_addr(); + metadata_t *metadata = GET_PTR(metadata_t, base_addr, meta_rva); + + if(metadata->magic_num == METADATA_MAGIC) + { + se_trace(SE_TRACE_ERROR, ENCLAVE_ALREADY_SIGNED_ERROR); + return false; + } + + *bf = parser->get_bin_format(); + *meta_offset = meta_rva; + return true; +} + +// measure_enclave(): +// 1. Get the enclave hash by loading enclave +// 2. Get the enclave info - metadata offset and enclave file format +static bool measure_enclave(uint8_t *hash, const char *dllpath, const xml_parameter_t *parameter, metadata_t *metadata, bin_fmt_t *bin_fmt, uint64_t *meta_offset) +{ + assert(hash && dllpath && metadata && bin_fmt && meta_offset); + bool res = false; + uint32_t file_size = 0; + + se_file_handle_t fh = open_file(dllpath); + if (fh == THE_INVALID_HANDLE) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, dllpath); + return false; + } + + // Probably we can use `decltype' if all major supported compilers support that. + std::unique_ptr mh(map_file(fh, &file_size), unmap_file); + if (!mh) + { + close_handle(fh); + return false; + } + // Parse enclave + std::unique_ptr parser(binparser::get_parser(mh->base_addr, (size_t)file_size)); + assert(parser != NULL); + + sgx_status_t status = parser->run_parser(); + if (status != SGX_SUCCESS) + { + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + close_handle(fh); + return false; + } + + // generate metadata + CMetadata meta(metadata, parser.get()); + if(meta.build_metadata(parameter) == false) + { + close_handle(fh); + return false; + } + + // Collect enclave info + if(get_enclave_info(parser.get(), bin_fmt, meta_offset) == false) + { + close_handle(fh); + return false; + } + + if (*bin_fmt == BF_ELF64) + { + ElfHelper<64>::dump_textrels(parser.get()); + } + else if (*bin_fmt == BF_ELF32) + { + ElfHelper<32>::dump_textrels(parser.get()); + } + + // Load enclave to get enclave hash + int ret = load_enclave(parser.release(), metadata); + close_handle(fh); + + switch(ret) + { + case SGX_ERROR_INVALID_METADATA: + se_trace(SE_TRACE_ERROR, OUT_OF_EPC_ERROR); + res = false; + break; + case SGX_ERROR_INVALID_VERSION: + se_trace(SE_TRACE_ERROR, META_VERSION_ERROR); + res = false; + break; + case SGX_ERROR_INVALID_ENCLAVE: + se_trace(SE_TRACE_ERROR, INVALID_ENCLAVE_ERROR); + res = false; + break; + case SGX_SUCCESS: + ret = dynamic_cast(get_enclave_creator())->get_enclave_info(hash, SGX_HASH_SIZE); + if(ret != SGX_SUCCESS) + { + res = false; + break; + } + res = true; + break; + default: + res = false; + break; + } + + return res; +} + +static void set_meta_attributes(metadata_t *meta) +{ + assert(meta != NULL); + //set metadata.attributes + //low 64 bit: it's the same as enclave_css + memset(&meta->attributes, 0, sizeof(sgx_attributes_t)); + meta->attributes.flags = meta->enclave_css.body.attributes.flags; + //high 64 bit + //set bits that will not be checked + meta->attributes.xfrm = ~meta->enclave_css.body.attribute_mask.xfrm; + //set bits that have been set '1' and need to be checked + meta->attributes.xfrm |= (meta->enclave_css.body.attributes.xfrm & meta->enclave_css.body.attribute_mask.xfrm); + return; +} + +//fill_enclave_css() +// file the enclave_css_t structure with the parameter, enclave_hash +// If the RSA_key is not null, fill the key part +// If RSA_key == NULL, fill the header and body(GENDATA mode) +// If the path[UNSIGNED] != NULL, update the header.date(CATSIG mode) +static bool fill_enclave_css(const IppsRSAPublicKeyState *pub_key, const xml_parameter_t *para, const uint8_t *enclave_hash, + const char **path, enclave_css_t *css, bin_fmt_t bf) +{ + assert(para != NULL && enclave_hash != NULL && path != NULL && css != NULL); + + enclave_css_t enclave_css; + memset(&enclave_css, 0, sizeof(enclave_css_t)); + + uint32_t date = 0; + if(false == get_time(&date)) + return false; + + //*****fill the header******************* + uint8_t header[12] = {6, 0, 0, 0, 0xE1, 0, 0, 0, 0, 0, 1, 0}; + uint8_t header2[16] = {1, 1, 0, 0, 0x60, 0, 0, 0, 0x60, 0, 0, 0, 1, 0, 0, 0}; + memcpy_s(&enclave_css.header.header, sizeof(enclave_css.header.header), &header, sizeof(header)); + memcpy_s(&enclave_css.header.header2, sizeof(enclave_css.header.header2), &header2, sizeof(header2)); + + // For 'type', signing tool clears the bit 31 for product enclaves + // and set the bit 31 for debug enclaves + enclave_css.header.type = (para[RELEASETYPE].value & 0x01) ? (1<<31) : 0; + enclave_css.header.module_vendor = (para[INTELSIGNED].value&0x01) ? 0x8086 : 0; + enclave_css.header.date = date; + + //if pub_key is not NULL, fill the key part + if(pub_key) + { + int exponent_size = 0; + int modulus_size = 0; + IppStatus error_code = get_pub_key(pub_key, &exponent_size, + (Ipp32u *)&enclave_css.key.exponent, + &modulus_size, + (Ipp32u *)&enclave_css.key.modulus); + if(error_code != ippStsNoErr) + { + return false; + } + exponent_size = (uint32_t)(ROUND_TO(exponent_size, sizeof(Ipp32u)) / sizeof(Ipp32u)); + modulus_size = (uint32_t)(ROUND_TO(modulus_size, sizeof(Ipp32u)) / sizeof(Ipp32u)); + assert(enclave_css.key.exponent[0] == 0x03); + assert(exponent_size == 0x1); + assert(modulus_size == 0x60); + } + + //hardware version + enclave_css.header.hw_version = para[HW].value; + + //****************************fill the body*********************** + // Misc_select/Misc_mask + enclave_css.body.misc_select = para[MISCSELECT].value; + enclave_css.body.misc_mask = para[MISCMASK].value; + //low 64 bit + enclave_css.body.attributes.flags = 0; + enclave_css.body.attribute_mask.flags = ~SGX_FLAGS_DEBUG; + if(para[DISABLEDEBUG].value == 1) + { + enclave_css.body.attributes.flags &= ~SGX_FLAGS_DEBUG; + enclave_css.body.attribute_mask.flags |= SGX_FLAGS_DEBUG; + } + if(para[PROVISIONKEY].value == 1) + { + enclave_css.body.attributes.flags |= SGX_FLAGS_PROVISION_KEY; + enclave_css.body.attribute_mask.flags |= SGX_FLAGS_PROVISION_KEY; + } + if(para[LAUNCHKEY].value == 1) + { + enclave_css.body.attributes.flags |= SGX_FLAGS_LICENSE_KEY; + enclave_css.body.attribute_mask.flags |= SGX_FLAGS_LICENSE_KEY; + } + if(bf == BF_PE64 || bf == BF_ELF64) + { + enclave_css.body.attributes.flags |= SGX_FLAGS_MODE64BIT; + enclave_css.body.attribute_mask.flags |= SGX_FLAGS_MODE64BIT; + } + // high 64 bit + //default setting + enclave_css.body.attributes.xfrm = SGX_XFRM_LEGACY; + enclave_css.body.attribute_mask.xfrm = SGX_XFRM_LEGACY | SGX_XFRM_RESERVED; // LEGACY and reserved bits would be checked. + + memcpy_s(&enclave_css.body.enclave_hash, sizeof(enclave_css.body.enclave_hash), enclave_hash, SGX_HASH_SIZE); + enclave_css.body.isv_prod_id = (uint16_t)para[PRODID].value; + enclave_css.body.isv_svn = (uint16_t)para[ISVSVN].value; + + //Copy the css to output css buffer + memcpy_s(css, sizeof(enclave_css_t), &enclave_css, sizeof(enclave_css_t)); + + if(path[UNSIGNED] != NULL) + { + // In catsig mode, update the header.date as the time when the unsigned file is generated. + memset(&enclave_css, 0, sizeof(enclave_css)); + size_t fsize = get_file_size(path[UNSIGNED]); + if(fsize != sizeof(enclave_css.header) + sizeof(enclave_css.body)) + { + se_trace(SE_TRACE_ERROR, UNSIGNED_FILE_ERROR, path[UNSIGNED]); + return false; + } + uint8_t *buf = new uint8_t[fsize]; + memset(buf, 0, fsize); + if(read_file_to_buf(path[UNSIGNED], buf, fsize) == false) + { + se_trace(SE_TRACE_ERROR, READ_FILE_ERROR, path[UNSIGNED]); + return false; + } + memcpy_s(&enclave_css.header, sizeof(enclave_css.header), buf, sizeof(enclave_css.header)); + memcpy_s(&enclave_css.body, sizeof(enclave_css.body), buf + sizeof(enclave_css.header), fsize - sizeof(enclave_css.header)); + delete [] buf; + css->header.date = enclave_css.header.date; + // Verify the header and body read from the unsigned file to make sure it's the same as that generated from xml file + if(memcmp(&enclave_css.header, &css->header, sizeof(enclave_css.header)) || memcmp(&enclave_css.body, &css->body, sizeof(enclave_css.body))) + { + se_trace(SE_TRACE_ERROR, UNSIGNED_FILE_XML_MISMATCH); + return false; + } + } + return true; +} + +static IppStatus calc_RSAq1q2(int length_s, const Ipp32u *data_s, int length_m, const Ipp32u *data_m, + int *length_q1, Ipp32u *data_q1, int *length_q2, Ipp32u *data_q2) +{ + IppStatus error_code = ippStsSAReservedErr1; + IppsBigNumState *pM=0, *pS=0, *pQ1=0, *pQ2=0, *ptemp1=0, *ptemp2=0; + IppsBigNumSGN sgn = IppsBigNumPOS; + int length_in_bit = 0; + Ipp32u *pdata = NULL; + + //create 6 big number + + if(!data_s || !data_m || !length_q1 || !data_q1 || !length_q2 + || !data_q2 || length_s <= 0 || length_m <= 0) + { + error_code = ippStsBadArgErr; + goto clean_return; + } + + error_code = newBN(data_s, length_s, &pS); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = newBN(data_m, length_m, &pM); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = newBN(0, length_m, &pQ1); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = newBN(0, length_m, &pQ2); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = newBN(0, length_m*2, &ptemp1); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = newBN(0, length_m, &ptemp2); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + + //signed big number operation + //multiplies pS and pS, ptemp1 is the multiplication result + error_code = ippsMul_BN(pS, pS, ptemp1); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + + //ptemp1: dividend, pM: divisor, pQ1: qutient, ptemp2: remainder + error_code = ippsDiv_BN(ptemp1, pM, pQ1, ptemp2); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = ippsMul_BN(pS, ptemp2, ptemp1); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + error_code = ippsDiv_BN(ptemp1, pM, pQ2, ptemp2); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + //extract the sign and value of the integer big number from the input structure(pQ1) + + error_code = ippsRef_BN(&sgn, &length_in_bit, &pdata, pQ1); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + *length_q1 = ROUND_TO(length_in_bit, 8)/8; + memset(data_q1, 0, *length_q1); + memcpy_s(data_q1, *length_q1, pdata, *length_q1); + + error_code = ippsRef_BN(&sgn, &length_in_bit, &pdata, pQ2); + if(error_code != ippStsNoErr) + { + goto clean_return; + } + *length_q2 = ROUND_TO(length_in_bit, 8)/8; + memset(data_q2, 0, *length_q2); + memcpy_s(data_q2, *length_q2, pdata, *length_q2); + goto clean_return; + +clean_return: + secure_free_BN(pM, length_m); + secure_free_BN(pS, length_s); + secure_free_BN(pQ1, length_m); + secure_free_BN(pQ2, length_m); + secure_free_BN(ptemp1, length_m*2); + secure_free_BN(ptemp2, length_m); + + return error_code; +} + +static bool create_signature(const IppsRSAPrivateKeyState *pri_key1, const char *sigpath, enclave_css_t *enclave_css) +{ + IppStatus error_code = ippStsNoErr; + assert(enclave_css != NULL); + assert(!(pri_key1 == NULL && sigpath == NULL) && !(pri_key1 != NULL && sigpath != NULL)); + + uint8_t signature[SIGNATURE_SIZE]; // keep the signature in big endian + memset(signature, 0, SIGNATURE_SIZE); + //**********get the signature********* + if(sigpath != NULL)//CATSIG mode + { + if(get_file_size(sigpath) != SIGNATURE_SIZE) + { + se_trace(SE_TRACE_ERROR, SIG_FILE_ERROR, sigpath); + return false; + } + if(read_file_to_buf(sigpath, signature, SIGNATURE_SIZE) == false) + { + se_trace(SE_TRACE_ERROR, READ_FILE_ERROR, sigpath); + return false; + } + } + else //SIGN mode + { + size_t buffer_size = sizeof(enclave_css->header) + sizeof(enclave_css->body); + Ipp8u * temp_buffer = (Ipp8u *)malloc(buffer_size * sizeof(char)); + if(NULL == temp_buffer) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + return false; + } + memcpy_s(temp_buffer, buffer_size, &enclave_css->header, sizeof(enclave_css->header)); + memcpy_s(temp_buffer + sizeof(enclave_css->header), buffer_size - sizeof(enclave_css->header), + &enclave_css->body, sizeof(enclave_css->body)); + int pri1_size = 0; + if(ippsRSA_GetBufferSizePrivateKey(&pri1_size, pri_key1) != ippStsNoErr) + { + free(temp_buffer); + return false; + } + Ipp8u *scratch_buf = (Ipp8u *)malloc(pri1_size); + if(NULL == scratch_buf) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + free(temp_buffer); + return false; + } + memset(scratch_buf, 0, pri1_size); + error_code = ippsRSASign_PKCS1v15((const Ipp8u *)temp_buffer, (int)buffer_size, (Ipp8u *)signature, pri_key1, NULL, ippHashAlg_SHA256, scratch_buf); + free(scratch_buf); + free(temp_buffer); + + if(error_code != ippStsNoErr) + { + return false; + } + } + for(int i = 0; ikey.signature)[i] = signature[SIGNATURE_SIZE-1-i]; + } + //************************calculate q1 and q2********************* + int length_q1 = 0, length_q2 = 0; + error_code = calc_RSAq1q2(sizeof(enclave_css->key.signature), + (Ipp32u *)&enclave_css->key.signature, + sizeof(enclave_css->key.modulus), + (Ipp32u *)&enclave_css->key.modulus, + &length_q1, + (Ipp32u *)&enclave_css->buffer.q1, + &length_q2, + (Ipp32u *)&enclave_css->buffer.q2); + if(error_code != ippStsNoErr) + { + return false; + } + return true; +} + +static bool verify_signature(const rsa_params_t *rsa, const enclave_css_t *enclave_css, int *signature_verified) +{ + assert(rsa != NULL && enclave_css != NULL && signature_verified != NULL); + IppsRSAPublicKeyState *pub_key = NULL; + IppStatus error_code = create_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, rsa->n, rsa->e, &pub_key); + if(error_code != ippStsNoErr) + { + return false; + } + size_t buffer_size = sizeof(enclave_css->header) + sizeof(enclave_css->body); + Ipp8u * temp_buffer = (Ipp8u *)malloc(buffer_size * sizeof(char)); + if(NULL == temp_buffer) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + return false; + } + memcpy_s(temp_buffer, buffer_size, &enclave_css->header, sizeof(enclave_css->header)); + memcpy_s(temp_buffer + sizeof(enclave_css->header), buffer_size-sizeof(enclave_css->header), + &enclave_css->body, sizeof(enclave_css->body)); + uint8_t signature[SIGNATURE_SIZE]; + for(int i=0; ikey.signature[SIGNATURE_SIZE-1-i]; + } + int pub_size = 0; + if(ippsRSA_GetBufferSizePublicKey(&pub_size, pub_key) != ippStsNoErr) + { + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + free(temp_buffer); + return false; + } + Ipp8u *scratch_buf = (Ipp8u *)malloc(pub_size); + if(NULL == scratch_buf) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + free(temp_buffer); + return false; + } + memset(scratch_buf, 0, pub_size); + error_code = ippsRSAVerify_PKCS1v15((const Ipp8u *)temp_buffer, (int)buffer_size, (Ipp8u *)signature, signature_verified, pub_key, ippHashAlg_SHA256, scratch_buf); + free(temp_buffer); + free(scratch_buf); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + + if(error_code != ippStsNoErr) + { + se_trace(SE_TRACE_DEBUG, "ippsRSASSAVerify_SHA256_PKCSv15() returns failure. The ipperrorCode is %d \n", error_code); + return false; + } + else + { + se_trace(SE_TRACE_DEBUG, "RSAVerify() returns success. The signature_verified is %d\n", *signature_verified); + return true; + } +} + +static bool gen_enclave_signing_file(const enclave_css_t *enclave_css, const char *outpath) +{ + assert(enclave_css != NULL); + size_t size = sizeof(enclave_css->header) + sizeof(enclave_css->body); + uint8_t *buffer = (uint8_t *)malloc(size); + if(buffer == NULL) + { + se_trace(SE_TRACE_ERROR, NO_MEMORY_ERROR); + return false; + } + memcpy_s(buffer, sizeof(enclave_css->header), &enclave_css->header, sizeof(enclave_css->header)); + memcpy_s(buffer + sizeof(enclave_css->header), sizeof(enclave_css->body), &enclave_css->body, sizeof(enclave_css->body)); + + if(write_data_to_file(outpath, std::ios::out|std::ios::binary, buffer, size) == false) + { + free(buffer); + return false; + } + free(buffer); + return true; +} + +static bool cmdline_parse(unsigned int argc, char *argv[], int *mode, const char **path) +{ + assert(mode!=NULL && path != NULL); + if(argc<2) + { + se_trace(SE_TRACE_ERROR, LACK_PARA_ERROR); + return false; + } + if(argc == 2 && !STRCMP(argv[1], "-help")) + { + se_trace(SE_TRACE_ERROR, USAGE_STRING); + *mode = -1; + return true; + } + + enum { PAR_REQUIRED, PAR_OPTIONAL, PAR_INVALID }; + typedef struct _param_struct_{ + const char *name; //options + char *value; //keep the path + int flag; //indicate this parameter is required(0), optional(1) or invalid(2) + }param_struct_t; //keep the parameter pairs + + param_struct_t params_sign[] = { + {"-enclave", NULL, PAR_REQUIRED}, + {"-config", NULL, PAR_OPTIONAL}, + {"-key", NULL, PAR_REQUIRED}, + {"-out", NULL, PAR_REQUIRED}, + {"-sig", NULL, PAR_INVALID}, + {"-unsigned", NULL, PAR_INVALID}, + {"-review_enclave", NULL, PAR_INVALID}}; + param_struct_t params_gendata[] = { + {"-enclave", NULL, PAR_REQUIRED}, + {"-config", NULL, PAR_OPTIONAL}, + {"-key", NULL, PAR_INVALID}, + {"-out", NULL, PAR_REQUIRED}, + {"-sig", NULL, PAR_INVALID}, + {"-unsigned", NULL, PAR_INVALID}, + {"-review_enclave", NULL, PAR_INVALID}}; + param_struct_t params_catsig[] = { + {"-enclave", NULL, PAR_REQUIRED}, + {"-config", NULL, PAR_OPTIONAL}, + {"-key", NULL, PAR_REQUIRED}, + {"-out", NULL, PAR_REQUIRED}, + {"-sig", NULL, PAR_REQUIRED}, + {"-unsigned", NULL, PAR_REQUIRED}, + {"-review_enclave", NULL, PAR_INVALID}}; + param_struct_t params_compare[] = { + {"-enclave", NULL, PAR_REQUIRED}, + {"-config", NULL, PAR_OPTIONAL}, + {"-key", NULL, PAR_INVALID}, + {"-out", NULL, PAR_INVALID}, + {"-sig", NULL, PAR_INVALID}, + {"-unsigned", NULL, PAR_REQUIRED}, + {"-review_enclave", NULL, PAR_REQUIRED}}; + + + const char *mode_m[] ={"sign", "gendata","catsig", "compare"}; + param_struct_t *params[] = {params_sign, params_gendata, params_catsig, params_compare}; + unsigned int tempidx=0; + for(; tempidx=sizeof(mode_m)/sizeof(mode_m[0])) + { + se_trace(SE_TRACE_ERROR, UNREC_CMD_ERROR, argv[1]); + return false; + } + + unsigned int params_count = (unsigned)(sizeof(params_sign)/sizeof(params_sign[0])); + unsigned int params_count_min = 0; + unsigned int params_count_max =0; + for(unsigned int i=0; i< params_count; i++) + { + params_count_max ++; + if(params[tempmode][i].flag == PAR_REQUIRED) + params_count_min ++; + } + unsigned int additional_param = 2; + if(argcparams_count_max * 2 + additional_param) + return false; + + for(unsigned int i=2; i=params_count_max) + { + return false; + } + } + for(unsigned int i = 0; i < params_count; i ++) + { + if(params[tempmode][i].flag == PAR_REQUIRED && params[tempmode][i].value == NULL) + { + se_trace(SE_TRACE_ERROR, LACK_REQUIRED_OPTION_ERROR, params[tempmode][i].name, mode_m[tempmode]); + return false; + } + if(params[tempmode][i].flag == PAR_INVALID && params[tempmode][i].value != NULL) + { + se_trace(SE_TRACE_ERROR, GIVE_INVALID_OPTION_ERROR, params[tempmode][i].name, mode_m[tempmode]); + return false; + } + } + for(unsigned int i = 0; i < params_count; i++) + { + path[i] = params[tempmode][i].value; + } + *mode = tempmode; + return true; + +} + +static bool fill_meta_without_signature(const IppsRSAPublicKeyState *pub_key, const char **path, const uint8_t *enclave_hash, + const xml_parameter_t *para, metadata_t *metadata, bin_fmt_t bf) +{ + assert(path && enclave_hash && para && metadata); + if(false == fill_enclave_css(pub_key, para, enclave_hash, path, &metadata->enclave_css, bf)) + { + return false; + } + set_meta_attributes(metadata); + + return true; +} + +//generate_output: +// To generate the final output file +// SIGN- need to fill the enclave_css_t(key part included), sign the header and body and +// update the metadata in the out file +// GENDATA- need to fill the enclave_css_t(key part excluded), get the body and header, +// and then write the whole out file with body+header+hash +// CATSIG- need to fill the enclave_css_t(include key), read the signature from the sigpath, +// and then update the metadata in the out file +static bool generate_output(int mode, int ktype, const uint8_t *enclave_hash, const xml_parameter_t *para, const rsa_params_t *rsa, metadata_t *metadata, + const char **path, bin_fmt_t bf, uint64_t meta_offset) +{ + assert(enclave_hash != NULL && para != NULL && metadata != NULL && path != NULL && rsa != NULL); + IppsRSAPrivateKeyState *pri_key1 = NULL; + IppsRSAPublicKeyState *pub_key = NULL; + int validate_result = IS_INVALID_KEY; + IppStatus error_code = ippStsNoErr; + + switch(mode) + { + case SIGN: + { + if(ktype != PRIVATE_KEY) + { + se_trace(SE_TRACE_ERROR, LACK_PRI_KEY_ERROR); + return false; + } + + error_code = create_validate_rsa_key_pair(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, rsa->n, rsa->d, rsa->e, + rsa->p, rsa->q, rsa->dmp1, rsa->dmq1, rsa->iqmp, &pri_key1, &pub_key, &validate_result); + if(error_code != ippStsNoErr || validate_result != IS_VALID_KEY) + { + se_trace(SE_TRACE_ERROR, KEY_FORMAT_ERROR); + secure_free_rsa_pri1_key(N_SIZE_IN_BYTES, D_SIZE_IN_BYTES, pri_key1); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + return false; + } + + if(false == fill_meta_without_signature(pub_key, path, enclave_hash, para, metadata, bf)) + { + secure_free_rsa_pri1_key(N_SIZE_IN_BYTES, D_SIZE_IN_BYTES, pri_key1); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + return false; + } + if(false == create_signature(pri_key1, NULL, &(metadata->enclave_css))) + { + secure_free_rsa_pri1_key(N_SIZE_IN_BYTES, D_SIZE_IN_BYTES, pri_key1); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + return false; + } + secure_free_rsa_pri1_key(N_SIZE_IN_BYTES, D_SIZE_IN_BYTES, pri_key1); + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + + if(false == update_metadata(path[OUTPUT], metadata, meta_offset)) + { + return false; + } + break; + } + case GENDATA: + { + if(false == fill_meta_without_signature(NULL, path, enclave_hash, para, metadata, bf)) + { + return false; + } + if(false == gen_enclave_signing_file(&(metadata->enclave_css), path[OUTPUT])) + { + return false; + } + break; + } + case CATSIG: + { + if(ktype != PUBLIC_KEY) + { + se_trace(SE_TRACE_ERROR, LACK_PUB_KEY_ERROR); + return false; + } + + if(create_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, rsa->n, rsa->e, &pub_key) != ippStsNoErr) + { + se_trace(SE_TRACE_ERROR, KEY_FORMAT_ERROR); + return false; + } + if(false == fill_meta_without_signature(pub_key, path, enclave_hash, para, metadata, bf)) + { + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + return false; + } + secure_free_rsa_pub_key(N_SIZE_IN_BYTES, E_SIZE_IN_BYTES, pub_key); + + if(false == create_signature(NULL, path[SIG], &(metadata->enclave_css))) + { + return false; + } + if(false == update_metadata(path[OUTPUT], metadata, meta_offset)) + { + return false; + } + break; + } + default: + { + return false; + } + } + return true; +} +//compare two enclaves +static bool compare_enclave(const char **path, const xml_parameter_t *para) +{ + assert(path != NULL && para != NULL); + bool res = false; + int ret = SGX_SUCCESS; + sgx_status_t status1 = SGX_SUCCESS, status2 = SGX_SUCCESS; + uint32_t file_size1 =0 , file_size2 = 0; + size_t file_size = 0; + bin_fmt_t bin_fmt1 = BF_UNKNOWN, bin_fmt2 = BF_UNKNOWN; + uint8_t enclave_hash[SGX_HASH_SIZE] = {0}; + uint8_t *buf = NULL; + CMetadata *meta = NULL; + metadata_t metadata; + enclave_diff_info_t enclave_diff_info1, enclave_diff_info2; + enclave_css_t enclave_css; + memset(&enclave_css, 0, sizeof(enclave_css_t)); + memset(&enclave_diff_info1, 0, sizeof(enclave_diff_info_t)); + memset(&enclave_diff_info2, 0, sizeof(enclave_diff_info_t)); + memset(&metadata, 0, sizeof(metadata_t)); + + se_file_handle_t fh1 = open_file(path[DLL]); + if (fh1 == THE_INVALID_HANDLE) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, path[DLL]); + return false; + } + + se_file_handle_t fh2 = open_file(path[REVIEW_ENCLAVE]); + if (fh2 == THE_INVALID_HANDLE) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, path[REVIEW_ENCLAVE]); + close_handle(fh1); + return false; + } + + + std::unique_ptr mh1(map_file(fh1, &file_size1), unmap_file); + if (!mh1) + { + close_handle(fh1); + close_handle(fh2); + return false; + } + std::unique_ptr mh2(map_file(fh2, &file_size2), unmap_file); + if (!mh2) + { + close_handle(fh1); + close_handle(fh2); + return false; + } + + //check if file_size is the same + if(file_size1 != file_size2) + { + close_handle(fh1); + close_handle(fh2); + return false; + } + + // Parse enclave + std::unique_ptr parser1(binparser::get_parser(mh1->base_addr, (size_t)file_size1)); + assert(parser1 != NULL); + std::unique_ptr parser2(binparser::get_parser(mh2->base_addr, (size_t)file_size2)); + assert(parser2 != NULL); + + status1 = parser1->run_parser(); + if (status1 != SGX_SUCCESS) + { + goto clear_return; + } + + status2 = parser2->run_parser(); + if (status2 != SGX_SUCCESS) + { + goto clear_return; + } + + // Collect enclave info + bin_fmt1 = parser1->get_bin_format(); + bin_fmt2 = parser2->get_bin_format(); + //two enclave should have same format + if(bin_fmt1 != bin_fmt2) + { + goto clear_return; + } + + //modify some info of enclave: timestamp etc. + status1 = parser1->get_info(&enclave_diff_info1); + if(status1 != SGX_SUCCESS) + { + goto clear_return; + } + status2 = parser2->get_info(&enclave_diff_info2); + if(status2 != SGX_SUCCESS) + { + goto clear_return; + } + status2 = parser2->modify_info(&enclave_diff_info1); + if(status2 != SGX_SUCCESS) + { + goto clear_return; + } + + //get enclave hash from unsigned file + file_size = get_file_size(path[UNSIGNED]); + if (file_size != sizeof(enclave_css.header) + sizeof(enclave_css.body) && + file_size != sizeof(enclave_css.header) + sizeof(enclave_css.body) + sizeof(enclave_css.key)) + { + goto clear_return; + } + + buf = (uint8_t *)malloc(file_size); + if (buf == NULL) + { + goto clear_return; + } + memset(buf, 0, file_size); + if(read_file_to_buf(path[UNSIGNED], buf, file_size) == false) + { + free(buf); + goto clear_return; + } + memcpy_s(&enclave_css.header, sizeof(enclave_css.header), buf, sizeof(enclave_css.header)); + memcpy_s(&enclave_css.body, sizeof(enclave_css.body), buf + (file_size - sizeof(enclave_css.body)), sizeof(enclave_css.body)); + free(buf); + + // Load enclave to get enclave hash + meta = new CMetadata(&metadata, parser2.get()); + if(meta->build_metadata(para) == false) + { + delete meta; + goto clear_return; + } + delete meta; + + ret = load_enclave(parser2.release(), &metadata); + if(ret != SGX_SUCCESS) + { + goto clear_return; + } + ret = dynamic_cast(get_enclave_creator())->get_enclave_info(enclave_hash, SGX_HASH_SIZE); + if(ret != SGX_SUCCESS) + { + goto clear_return; + } + + //make path[UNSIGNED] = NULL, so fill_meta_without_signature won't treat it as catsig + path[UNSIGNED] = NULL; + if(false == fill_meta_without_signature(NULL, path, enclave_hash, para, &metadata, bin_fmt2)) + { + goto clear_return; + } + + //compare + metadata.enclave_css.header.date = 0; + enclave_css.header.date = 0; + if(memcmp(&metadata.enclave_css.header, &enclave_css.header, sizeof(enclave_css.header)) != 0) + { + goto clear_return; + } + if(memcmp(&metadata.enclave_css.body, &enclave_css.body, sizeof(enclave_css.body)) != 0) + { + goto clear_return; + } + + res = true; +clear_return: + close_handle(fh1); + close_handle(fh2); + return res; +} + +int main(int argc, char* argv[]) +{ + xml_parameter_t parameter[] = {{"ProdID", 0xFFFF, 0, 0, 0}, + {"ISVSVN", 0xFFFF, 0, 0, 0}, + {"ReleaseType", 1, 0, 0, 0}, + {"IntelSigned", 1, 0, 0, 0}, + {"ProvisionKey",1,0,0,0}, + {"LaunchKey",1,0,0,0}, + {"DisableDebug",1,0,0,0}, + {"HW", 0x10,0,0,0}, + {"TCSNum",0xFFFFFFFF,TCS_NUM_MIN,1,0}, + {"TCSPolicy",TCS_POLICY_UNBIND,TCS_POLICY_BIND,TCS_POLICY_UNBIND,0}, + {"StackMaxSize",0xFFFFFFFF,STACK_SIZE_MIN,0x40000,0}, + {"HeapMaxSize",0xFFFFFFFF,HEAP_SIZE_MIN,0x100000,0}, + {"MiscSelect", 0xFFFFFFFF, 0, DEFAULT_MISC_SELECT, 0}, + {"MiscMask", 0xFFFFFFFF, 0, DEFAULT_MISC_MASK, 0}}; + + const char *path[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; + uint8_t enclave_hash[SGX_HASH_SIZE] = {0}; + metadata_t metadata; + int res = -1, mode = -1; + int key_type = UNIDENTIFIABLE_KEY; //indicate the type of the input key file + size_t parameter_count = sizeof(parameter)/sizeof(parameter[0]); + bin_fmt_t bin_fmt = BF_UNKNOWN; + uint64_t meta_offset = 0; + rsa_params_t rsa; + + memset(&rsa, 0, sizeof(rsa)); + memset(&metadata, 0, sizeof(metadata)); + + + //Parse command line + if(cmdline_parse(argc, argv, &mode, path) == false) + { + se_trace(SE_TRACE_ERROR, USAGE_STRING); + goto clear_return; + } + if(mode == -1) // User only wants to get the help info + { + return 0; + } + + //Parse the xml file to get the metadata + if(parse_metadata_file(path[XML], parameter, (int)parameter_count) == false) + { + goto clear_return; + } + //Parse the key file + if(parse_key_file(path[KEY], &rsa, &key_type) == false && key_type != NO_KEY) + { + goto clear_return; + } + //compare two enclave + if(mode == COMPARE) + { + if(compare_enclave(path, parameter) == false) + { + se_trace(SE_TRACE_ERROR, "The two enclaves are not matched\n"); + return -1; + } + se_trace(SE_TRACE_ERROR, "The two enclaves are matched\n"); + return 0; + } + if(copy_file(path[DLL], path[OUTPUT]) == false) + { + se_trace(SE_TRACE_ERROR, OVERALL_ERROR); + goto clear_return; + } + + if(measure_enclave(enclave_hash, path[OUTPUT], parameter, &metadata, &bin_fmt, &meta_offset) == false) + { + se_trace(SE_TRACE_ERROR, OVERALL_ERROR); + goto clear_return; + } + + if((generate_output(mode, key_type, enclave_hash, parameter, &rsa, &metadata, path, bin_fmt, meta_offset)) == false) + { + se_trace(SE_TRACE_ERROR, OVERALL_ERROR); + goto clear_return; + } + //to verify + if(mode == SIGN || mode == CATSIG) + { + int signature_verified = ippFalse; + if(verify_signature(&rsa, &(metadata.enclave_css), &signature_verified) == false || signature_verified != ippTrue) + { + se_trace(SE_TRACE_ERROR, OVERALL_ERROR); + goto clear_return; + } + } + + se_trace(SE_TRACE_ERROR, SUCCESS_EXIT); + res = 0; + +clear_return: + if(res == -1 && path[OUTPUT]) + remove(path[OUTPUT]); + return res; +} diff --git a/sdk/sign_tool/SignTool/util_st.cpp b/sdk/sign_tool/SignTool/util_st.cpp new file mode 100644 index 0000000000..95816ec93d --- /dev/null +++ b/sdk/sign_tool/SignTool/util_st.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "util_st.h" +#include "se_trace.h" +#include +#include + +extern "C" bool write_data_to_file(const char *filename, std::ios_base::openmode mode, + uint8_t *buf, size_t bsize, long offset) +{ + if(filename == NULL || (buf == NULL && bsize != 0) || (buf != NULL && bsize == 0)) + return false; + std::ofstream ofs(filename, mode); + if(!ofs.good()) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, filename); + return false; + } + ofs.seekp(offset, std::ios::beg); + ofs.write(reinterpret_cast(buf), bsize); + if(ofs.fail()) + { + se_trace(SE_TRACE_ERROR, WRITE_FILE_ERROR, filename); + return false; + } + return true; +} + +extern "C" long get_file_size(const char *filename) +{ + std::ifstream ifs(filename, std::ios::in | std::ios::binary); + if(!ifs.good()) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, filename); + return -1; + } + ifs.seekg(0, std::ios::end); + size_t size = (size_t)ifs.tellg(); + return size; +} + +extern "C" bool read_file_to_buf(const char *filename, uint8_t *buf, size_t bsize) +{ + if(filename == NULL || buf == NULL || bsize == 0) + return false; + std::ifstream ifs(filename, std::ios::binary|std::ios::in); + if(!ifs.good()) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, filename); + return false; + } + ifs.read(reinterpret_cast (buf), bsize); + if(ifs.fail()) + { + return false; + } + return true; + +} + +extern "C" bool copy_file(const char *source_path, const char *dest_path) +{ + std::ifstream ifs(source_path, std::ios::binary|std::ios::in); + if(!ifs.good()) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, source_path); + return false; + } + + std::ofstream ofs(dest_path, std::ios::binary|std::ios::out); + if(!ofs.good()) + { + se_trace(SE_TRACE_ERROR, OPEN_FILE_ERROR, dest_path); + return false; + } + ofs << ifs.rdbuf(); + return true; +} + diff --git a/sdk/sign_tool/SignTool/util_st.h b/sdk/sign_tool/SignTool/util_st.h new file mode 100644 index 0000000000..78912c165f --- /dev/null +++ b/sdk/sign_tool/SignTool/util_st.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _UTIL_ST_H_ +#define _UTIL_ST_H_ + +#include "se_cdefs.h" +#include "se_memcpy.h" +#include + + +#define USAGE_STRING \ + "Usage: sgx_sign [options] file...\n"\ + "Commands:\n"\ + " sign Sign the enclave using the private key\n"\ + " gendata Generate enclave signing material to be signed\n"\ + " catsig Generate the signed enclave with the input signature file, the\n"\ + " public key and the enclave signing material\n"\ + "Options:\n"\ + " -enclave Specify the enclave file to be signed\n"\ + " It is a required option for the three commands\n"\ + " -key Specify the key file\n"\ + " It is a required option for \"sign\" and \"catsig\"\n"\ + " -config Specify the configuration for the enclave\n"\ + " -out Specify the output file\n"\ + " It is a required option for the three commands\n"\ + " -sig Specify the signature file for the enclave signing material\n" \ + " It is a required option for \"catsig\"\n"\ + " -unsigned Specify the enclave signing material generated by \"gendata\"\n" \ + " It is a required option for \"catsig\"\n" + +// General error message +#define OVERALL_ERROR "Error happened while signing the enclave.\n" +#define KEY_FORMAT_ERROR "Key file format is not correct.\n" +#define XML_FORMAT_ERROR "Configure file format is not correct.\n" +#define NO_MEMORY_ERROR "Out of memory.\n" +#define OPEN_FILE_ERROR "Failed to open file \"%s\".\n" +#define READ_FILE_ERROR "Failed to read file \"%s\".\n" +#define WRITE_FILE_ERROR "Failed to write file \"%s\".\n" + +// error message for measure_enclave() +#define OUT_OF_EPC_ERROR "The required memory is too large. Please check TCSNum/HeapMaxSize/StackMaxSize.\n" +#define META_VERSION_ERROR "Metadata version is mismatched between uRTS and sgx_sign.\n" +#define INVALID_ENCLAVE_ERROR "The input enclave file is not correct.\n" +#define REQUIRED_ENCLAVE_SIZE "The required memory is 0x%x.\n" + +// error message for fill_enclave_css() +#define UNSIGNED_FILE_ERROR "The unsigned file \"%s\" is not correct.\n" +#define UNSIGNED_FILE_XML_MISMATCH "The unsigned file content doesn't match the configuration file.\n" + +// error message for create_signature() +#define SIG_FILE_ERROR "The signature file \"%s\" is not correct.\n" + +// error message for cmdline_parse() +#define LACK_PARA_ERROR "Lack of parameters.\n" +#define UNREC_CMD_ERROR "Cannot recognize the command \"%s\".\nCommand \"sign/gendata/catsig\" is required.\n" +#define REPEAT_OPTION_ERROR "Repeatly specified \"%s\" option.\n" +#define INVALID_FILE_NAME_ERROR "The File name is not correct for \"%s\" option.\n" +#define LACK_REQUIRED_OPTION_ERROR "Option \"%s\" is required for the command \"%s\".\n" +#define GIVE_INVALID_OPTION_ERROR "Option \"%s\" is invalid for the command \"%s\".\n" + +// error message for generate_output() +#define LACK_PRI_KEY_ERROR "Private key is required for the \"sign\" command.\n" +#define LACK_PUB_KEY_ERROR "Public key is required for the \"catsig\" command.\n" + +// error message for main() +#define INIT_IPP_LIBRARY_ERROR "Failed to initialize the IPP library.\n" +#define ENCLAVE_ALREADY_SIGNED_ERROR "The enclave has been signed already.\n" +#define SUCCESS_EXIT "Succeed.\n" + +// error message for traverser_parameter() +#define LACK_VALUE_FOR_ELEMENT_ERROR "No value for the element \"%s\".\n" +#define INVALID_VALUE_FOR_ELEMENT_ERROR "Invalid value for the element\"%s\".\n" +#define UNREC_ELEMENT_ERROR "Element is not recognized - \"%s\".\n" +#define REPEATED_DEFINE_ERROR "Defined \"%s\" too many times.\n" +#define VALUE_OUT_OF_RANGE_ERROR "The value of \"%s\" is out of range.\n" + +// error message for modify_metadata() +#define SET_STACK_SIZE_ERROR "Stack size setting is not correct.\n" +#define SET_HEAP_SIZE_ERROR "Heap size setting is not correct.\n" +#define SET_HW_LE_ERROR "Conflicting setting between the 'HW' and 'LaunchKey'.\n" + +// error message for compare_enclave() +#define PDB_PATH_ERROR "The two enclaves' pdb path are not equal. The pdb path of \"%s\" is \"%s\", while the pdb path of \"%s\" is \"%s\".\n" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +long get_file_size(const char *filename); +bool read_file_to_buf(const char *filename, uint8_t *buffer, size_t bsize); +bool write_data_to_file(const char *filename, std::ios_base::openmode mode, uint8_t *buf, size_t bsize, long offset = 0); +bool copy_file(const char *source_path, const char *dest_path); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/Makefile b/sdk/simulation/Makefile new file mode 100644 index 0000000000..9507f62061 --- /dev/null +++ b/sdk/simulation/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +DIRS := assembly \ + uinst \ + tinst \ + driver_api \ + tae_service_sim \ + uae_service_sim/linux \ + urtssim \ + trtssim \ + SEConfigureCPUSVN/linux + +TARGETS := all clean +.PHONY: $(TARGETS) + +$(TARGETS): $(DIRS) + +all: TARGET := all +clean: TARGET := clean + +.PHONY: $(DIRS) +$(DIRS): + $(MAKE) -C $@ $(TARGET) diff --git a/sdk/simulation/SEConfigureCPUSVN/linux/Makefile b/sdk/simulation/SEConfigureCPUSVN/linux/Makefile new file mode 100644 index 0000000000..9354fb27f9 --- /dev/null +++ b/sdk/simulation/SEConfigureCPUSVN/linux/Makefile @@ -0,0 +1,72 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +SIM_DIR := $(CUR_DIR)/../.. + +CXXFLAGS += -Werror +CPPFLAGS := -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(SIM_DIR)/urtssim \ + -I$(SIM_DIR)/tinst + +SRCS := $(wildcard ./*.cpp) +SRCS += $(SIM_DIR)/urtssim/cpusvn_util.cpp + +OBJS := $(SRCS:.cpp=.o) + +WRAPPER_LIB_DIR := $(COMMON_DIR)/se_wrapper +LDFLAGS := -L$(WRAPPER_LIB_DIR) +LDLIBS := -lwrapper + +TARGET := sgx_config_cpusvn + +.PHONY: all +all: $(TARGET) | $(BUILD_DIR) + @$(CP) $< $| + +$(TARGET): $(OBJS) $(LDLIBS) + $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) + +$(OBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +$(LDLIBS): + $(MAKE) -C $(WRAPPER_LIB_DIR) + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + $(MAKE) -C $(WRAPPER_LIB_DIR) clean + @$(RM) $(TARGET) $(BUILD_DIR)/$(TARGET) $(OBJS) diff --git a/sdk/simulation/SEConfigureCPUSVN/linux/config_cpusvn.cpp b/sdk/simulation/SEConfigureCPUSVN/linux/config_cpusvn.cpp new file mode 100644 index 0000000000..a352d76286 --- /dev/null +++ b/sdk/simulation/SEConfigureCPUSVN/linux/config_cpusvn.cpp @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** +* File: config_cpusvn.cpp +* Description: +* Implemente the CPUSVN upgrade/downgrade/reset simulation +*/ + +#include "cpusvn_helper.h" +#include "cpusvn_util.h" +#include "se_trace.h" +#include "rts_sim.h" +#include "se_wrapper.h" + +#include +#include +#include +#include +#include +#include + +using namespace std; + +static void convert_cpusvn_to_string(sgx_cpu_svn_t &cpusvn, string &str) +{ + uint32_t buffer[4]; + memcpy_s(&buffer, sizeof(uint32_t)*4, &cpusvn, sizeof(sgx_cpu_svn_t)); + stringstream ss; + for(int i=0; i<4; i++) + { + buffer[i] = __builtin_bswap32(buffer[i]); + ss<\n" \ + "command:\n" \ + " -upgrade: Simulate CPUSVN upgrade\n"\ + " -downgrade: Simulate CPUSVN downgrade\n" \ + " -reset: Restore CPUSVN to the default value\n" \ + " -help: Print this help message\n" + +#endif + diff --git a/sdk/simulation/assembly/Makefile b/sdk/simulation/assembly/Makefile new file mode 100644 index 0000000000..7be00c3675 --- /dev/null +++ b/sdk/simulation/assembly/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +.PHONY: all +all: + $(MAKE) -C linux + +.PHONY: clean +clean: + $(MAKE) -C linux clean diff --git a/sdk/simulation/assembly/linux/Makefile b/sdk/simulation/assembly/linux/Makefile new file mode 100644 index 0000000000..ace98da30f --- /dev/null +++ b/sdk/simulation/assembly/linux/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +ASFLAGS += -Werror $(CFLAGS) +CPPFLAGS += -Werror -I$(COMMON_DIR)/inc/internal + +.PHONY: all +all: lowlib.o sgxsim.o + +.PHONY: clean +clean: + @$(RM) *.o diff --git a/sdk/simulation/assembly/linux/gnu_tls.h b/sdk/simulation/assembly/linux/gnu_tls.h new file mode 100644 index 0000000000..4539eece66 --- /dev/null +++ b/sdk/simulation/assembly/linux/gnu_tls.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef GNU_TLS_H__ +#define GNU_TLS_H__ + +#include + + +/* Type for the dtv. */ +typedef union +{ + size_t counter; + struct + { + void *val; + int is_static; + } pointer; +} dtv_t; + + +typedef struct +{ + void *tcb; /* Pointer to the TCB. Not necessarily the + thread descriptor used by libpthread. */ + dtv_t *dtv; + void *self; /* Pointer to the thread descriptor. */ + + /* We are not interested in the other fields. */ +} tcbhead_t; + +/* ------------------------------------------------------------ */ + +#if defined(__amd64) || defined(__amd64__) || defined (__x86_64) +/* x86_64 uses %fs as the thread register */ +#define GET_DTV() \ + ({ dtv_t* __dtv; \ + asm ("mov %%fs:%c1, %0" : "=r"(__dtv) \ + : "i" (offsetof (tcbhead_t, dtv))); \ + __dtv; }) + +#define GET_FS_GS_0() \ + ({ uintptr_t __orig; \ + asm volatile ("mov %%fs:0x0, %0" : "=r"(__orig)); \ + __orig; }) + +#define SET_FS_GS_0(val) \ + ({ asm volatile ("mov %0, %%fs:0x0" : :"r"(val));}) + +#elif defined(__i386) || defined(__i386__) +/* IA32 uses %gs as the thread register */ +#define GET_DTV() \ + ({ dtv_t* __dtv; \ + asm ("mov %%gs:%c1, %0" : "=r"(__dtv) \ + : "i" (offsetof (tcbhead_t, dtv))); \ + __dtv; }) + +#define GET_FS_GS_0() \ + ({ uintptr_t __orig; \ + asm volatile ("mov %%gs:0x0, %0" : "=r"(__orig)); \ + __orig; }) + +#define SET_FS_GS_0(val) \ + ({ asm volatile ("mov %0, %%gs:0x0" : :"r"(val));}) + +#endif + +#define read_dtv_val(dtv) (dtv->pointer.val) +#define set_dtv_val(dtv, v) \ + do { dtv->pointer.val = (void*)(size_t)v; } while (0) + + +#endif /* !GNU_TLS_H__ */ diff --git a/sdk/simulation/assembly/linux/lowlib.S b/sdk/simulation/assembly/linux/lowlib.S new file mode 100644 index 0000000000..def050a024 --- /dev/null +++ b/sdk/simulation/assembly/linux/lowlib.S @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "linux/linux-regs.h" + + .file "lowlib.S" + + .text + +DECLARE_LOCAL_FUNC get_bp + mov %xbp, %xax + ret + +#define reg_xax (0 * SE_WORDSIZE) +#define reg_xbx (1 * SE_WORDSIZE) +#define reg_xcx (2 * SE_WORDSIZE) +#define reg_xdx (3 * SE_WORDSIZE) +#define reg_xsi (4 * SE_WORDSIZE) +#define reg_xdi (5 * SE_WORDSIZE) +#define reg_xbp (6 * SE_WORDSIZE) +#define reg_xsp (7 * SE_WORDSIZE) +#define reg_xip (8 * SE_WORDSIZE) + +DECLARE_LOCAL_FUNC load_regs + mov naked_arg0, %xdx + mov reg_xax(%xdx), %xax + mov reg_xbx(%xdx), %xbx + mov reg_xcx(%xdx), %xcx + mov reg_xsi(%xdx), %xsi + mov reg_xdi(%xdx), %xdi + mov reg_xbp(%xdx), %xbp + mov reg_xsp(%xdx), %xsp + mov reg_xax(%xdx), %xax + push reg_xip(%xdx) + mov reg_xdx(%xdx), %xdx + ret diff --git a/sdk/simulation/assembly/linux/sgxsim.S b/sdk/simulation/assembly/linux/sgxsim.S new file mode 100644 index 0000000000..25901e501c --- /dev/null +++ b/sdk/simulation/assembly/linux/sgxsim.S @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sw_emu.h" + + .file "sgxsim.S" + + .text + +/* DoECREATE_SW, DoEADD_SW, DoEINIT_SW, DoEREMOVE, ... */ +DoSW ECREATE +DoSW EADD +DoSW EINIT +DoSW EREMOVE diff --git a/sdk/simulation/assembly/linux/sw_emu.h b/sdk/simulation/assembly/linux/sw_emu.h new file mode 100644 index 0000000000..e46a1fb25d --- /dev/null +++ b/sdk/simulation/assembly/linux/sw_emu.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: sw_emu.h + * Description: + * This file defined macros which hide hardware differences. + */ + +#ifndef _SW_EMU_H_ +#define _SW_EMU_H_ + +#include "linux/linux-regs.h" + +/*******************************************************************/ + +#define SE0func _SE0 +.type SE0func, @function +.protected SE0func + +#if defined LINUX64 + +.macro SE0_SW leafcode + movabsq $\leafcode, %rax + + pushq %rax + pushq %rbx + pushq %rcx + pushq %rdx + pushq %rsi + pushq %rdi + + /* 64bit ABI: parameter passing with registers */ + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + + call SE0func +.endm + +#elif defined LINUX32 + +.macro SE0_SW leafcode + movl $\leafcode, %eax + + pushl %edi + pushl %esi + pushl %edx + pushl %ecx + pushl %ebx + pushl %eax + + call SE0func + add $(SE_WORDSIZE * 6), %esp +.endm + +#endif + +/*******************************************************************/ + +.macro ECREATE_SW + SE0_SW SE_ECREATE +.endm + +.macro EADD_SW + SE0_SW SE_EADD +.endm + +.macro EINIT_SW + SE0_SW SE_EINIT +.endm + +.macro EREMOVE_SW + SE0_SW SE_EREMOVE +.endm + +/*******************************************************************/ + +/* This macro is used to generate simulation functions like: + * DoECREATE_SW, DoEADD_SW, ... +*/ +.macro DoSW inst +DECLARE_LOCAL_FUNC Do\()\inst\()_SW + SE_PROLOG + \inst\()_SW + SE_EPILOG +.endm + +#endif diff --git a/sdk/simulation/assembly/lowlib.h b/sdk/simulation/assembly/lowlib.h new file mode 100644 index 0000000000..4051b90f63 --- /dev/null +++ b/sdk/simulation/assembly/lowlib.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: lowlib.h + * Description: + * This file declared some functions written in assembly. + */ +#ifndef _LOW_LIB_H_ +#define _LOW_LIB_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uintptr_t get_bp(void); + +typedef struct _enclu_regs_t +{ + uintptr_t xax; + uintptr_t xbx; + uintptr_t xcx; + uintptr_t xdx; + uintptr_t xsi; + uintptr_t xdi; + uintptr_t xbp; + uintptr_t xsp; + uintptr_t xip; +} enclu_regs_t; + +void load_regs(enclu_regs_t *regs); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/assembly/sgxsim.h b/sdk/simulation/assembly/sgxsim.h new file mode 100644 index 0000000000..99d3652f03 --- /dev/null +++ b/sdk/simulation/assembly/sgxsim.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: sgxsim.h + * Description: + * This file declared simulation routines written in assembly (for uRTS). + */ +#ifndef _SGX_SIM_H_ +#define _SGX_SIM_H_ + +#include "arch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uintptr_t DoECREATE_SW(const page_info_t* pinfo); + +uintptr_t DoEADD_SW(const page_info_t* pi, void *epc_lin_addr); + +uintptr_t DoEINIT_SW(secs_t* secs, enclave_css_t *css, + token_t *launch); + +uintptr_t DoEREMOVE_SW(uintptr_t unused_xbx, void* epc_lin_addr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/driver_api/Makefile b/sdk/simulation/driver_api/Makefile new file mode 100644 index 0000000000..f6578dd84e --- /dev/null +++ b/sdk/simulation/driver_api/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +SIM_DIR := $(CUR_DIR)/.. + +CPPFLAGS += $(ADDED_INC) +CPPFLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal \ + -I$(SIM_DIR)/assembly/ \ + -I$(SIM_DIR)/uinst \ + -I$(SIM_DIR)/urtssim \ + -I$(SIM_DIR)/tinst \ + -I$(LINUX_PSW_DIR)/urts + +CXXFLAGS += -fPIC -Werror + +.PHONY: all +all: driver_api.o + +.PHONY: clean +clean: + @$(RM) *.o diff --git a/sdk/simulation/driver_api/driver_api.cpp b/sdk/simulation/driver_api/driver_api.cpp new file mode 100644 index 0000000000..45626b6e65 --- /dev/null +++ b/sdk/simulation/driver_api/driver_api.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include + +#include "se_wrapper.h" +#include "util.h" +#include "enclave.h" + +#include "enclave_mngr.h" +#include "sgxsim.h" +#include "driver_api.h" + +#define TO_STR(e) #e + +#define BUG_ON(cond, rv) do { \ + if (cond) { \ + SE_TRACE(SE_TRACE_DEBUG, "*** BUG ***: %s\n", TO_STR(cond)); \ + return rv; \ + } \ +} while (0) + + +/* Allocate linear address space. */ +int create_enclave(secs_t *secs, + sgx_enclave_id_t *enclave_id, + void **start_addr) +{ + CEnclaveSim *ce; + sec_info_t sinfo; + page_info_t pinfo; + + BUG_ON(secs == NULL, SGX_ERROR_UNEXPECTED); + BUG_ON(enclave_id == NULL, SGX_ERROR_UNEXPECTED); + BUG_ON(start_addr == NULL, SGX_ERROR_UNEXPECTED); + + memset(&sinfo, 0, sizeof(sinfo)); + sinfo.flags = SI_FLAGS_SECS; + + memset(&pinfo, 0, sizeof(pinfo)); + pinfo.src_page = secs; + pinfo.sec_info = &sinfo; + + ce = reinterpret_cast(DoECREATE_SW(&pinfo)); + if (ce == NULL) { + SE_TRACE(SE_TRACE_DEBUG, "out of memory.\n"); + return SGX_ERROR_OUT_OF_MEMORY; + } + + *start_addr = ce->get_secs()->base; + *enclave_id = ce->get_enclave_id(); + secs->base = *start_addr; + + return SGX_SUCCESS; +} + +int add_enclave_page(sgx_enclave_id_t enclave_id, + void *source, + size_t offset, + const sec_info_t &secinfo, + uint32_t attr) +{ + sec_info_t sinfo; + page_info_t pinfo; + CEnclaveMngr *mngr; + CEnclaveSim *ce; + + UNUSED(attr); + + mngr = CEnclaveMngr::get_instance(); + ce = mngr->get_enclave(enclave_id); + if (ce == NULL) { + SE_TRACE(SE_TRACE_DEBUG, + "enclave (id = %llu) not found.\n", + enclave_id); + return SGX_ERROR_INVALID_ENCLAVE_ID; + } + memset(&sinfo, 0, sizeof(sec_info_t)); + sinfo.flags = secinfo.flags; + if(memcmp(&sinfo, &secinfo, sizeof(sec_info_t))) + return SGX_ERROR_UNEXPECTED; + + memset(&pinfo, 0, sizeof(pinfo)); + pinfo.secs = ce->get_secs(); + pinfo.lin_addr = (char*)ce->get_secs()->base + offset; + pinfo.src_page = source; + pinfo.sec_info = &sinfo; + + /* Passing NULL here when there is no EPC mgmt. */ + return (int)DoEADD_SW(&pinfo, GET_PTR(void, ce->get_secs()->base, offset)); +} + +int init_enclave(sgx_enclave_id_t enclave_id, + enclave_css_t *enclave_css, + token_t *launch) +{ + CEnclaveMngr* mngr = CEnclaveMngr::get_instance(); + CEnclaveSim* ce = mngr->get_enclave(enclave_id); + + if (ce == NULL) { + SE_TRACE(SE_TRACE_DEBUG, + "enclave (id = %llu) not found.\n", + enclave_id); + return SGX_ERROR_INVALID_ENCLAVE_ID; + } + + return (int)DoEINIT_SW(ce->get_secs(), enclave_css, launch); +} + +int destroy_enclave(sgx_enclave_id_t enclave_id) +{ + CEnclaveMngr* mngr = CEnclaveMngr::get_instance(); + CEnclaveSim* ce = mngr->get_enclave(enclave_id); + if (ce == NULL) { + SE_TRACE(SE_TRACE_DEBUG, + "enclave (id = %llu) not found.\n", + enclave_id); + return SGX_ERROR_INVALID_ENCLAVE_ID; + } + + /* In simulation mode, all allocated pages will be freed upon the later + `delete ce'. Just remove the first page here. */ + DoEREMOVE_SW(0, ce->get_secs()->base); + + mngr->remove(ce); + delete ce; + + return SGX_SUCCESS; +} diff --git a/sdk/simulation/tae_service_sim/Makefile b/sdk/simulation/tae_service_sim/Makefile new file mode 100644 index 0000000000..d99e1faff5 --- /dev/null +++ b/sdk/simulation/tae_service_sim/Makefile @@ -0,0 +1,122 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR := ../../.. +include $(TOP_DIR)/buildenv.mk + +CFLAGS += -Werror $(ENCLAVE_CFLAGS) +CXXFLAGS += -Werror $(ENCLAVE_CXXFLAGS) + +INCLUDE += -I$(COMMON_DIR) \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(LINUX_EXTERNAL_DIR)/crypto_px/include \ + -I$(LINUX_PSW_DIR)/ae/inc \ + -I$(LINUX_PSW_DIR)/ae/inc/internal \ + -I$(TOP_DIR)/common/inc \ + -I$(TOP_DIR)/common/inc/internal + +TSERVICE_SIM_LIB := libsgx_tservice_sim.a +TAE_SERVICE_SIM_LIB := libtae_service_sim.a +EDLFILE := $(TOP_DIR)/common/inc/sgx_tae_service.edl + +TSEAL_LIB_DIR := $(LINUX_SDK_DIR)/tseal/linux +TSEAL_LIB := $(TSEAL_LIB_DIR)/libtSeal.a + +SE_LIB_DIR := $(LINUX_SDK_DIR)/selib/linux +SE_LIB := $(SE_LIB_DIR)/libselib.a + +EC_DH_LIB_DIR := $(LINUX_SDK_DIR)/ec_dh_lib +EC_DH_LIB := $(EC_DH_LIB_DIR)/libsgx_dh.a + +EDGER8R_DIR := $(LINUX_SDK_DIR)/edger8r/linux +EDGER8R := $(EDGER8R_DIR)/_build/Edger8r.native + +SRC := $(wildcard *.cpp) +SRC += $(TOP_DIR)/common/src/dh.cpp +C_OBJ := $(OBJ:.c=.o) +CXX_OBJ := $(SRC:.cpp=.o) + +OBJS := $(CXX_OBJ) $(C_OBJ) + +.PHONY: all +all: $(TSERVICE_SIM_LIB) | $(BUILD_DIR) + $(CP) $^ $| + +$(TAE_SERVICE_SIM_LIB): sgx_tae_service_t.h $(OBJS) + $(AR) rcsD $@ $(OBJS) + +$(TSERVICE_SIM_LIB): $(TAE_SERVICE_SIM_LIB) $(EC_DH_LIB) $(TSEAL_LIB) $(SE_LIB) + @$(MKDIR) $(BUILD_DIR)/.tservice_sim + @$(RM) -f $(BUILD_DIR)/.tservice_sim/* + cd $(BUILD_DIR)/.tservice_sim && $(AR) x $(EC_DH_LIB) + cd $(BUILD_DIR)/.tservice_sim && $(AR) x $(TSEAL_LIB) + cd $(BUILD_DIR)/.tservice_sim && $(AR) x $(SE_LIB) + cp $(TAE_SERVICE_SIM_LIB) $@ + $(AR) rsD $@ $(BUILD_DIR)/.tservice_sim/*.o + @$(RM) -rf $(BUILD_DIR)/.tservice_sim + +sgx_tae_service_t.h: $(EDLFILE) $(EDGER8R) + $(EDGER8R) --trusted --header-only --search-path $(TOP_DIR)/common/inc $< + +$(CXX_OBJ): %.o: %.cpp + $(CXX) $(CXXFLAGS) -fno-exceptions -fno-rtti $(INCLUDE) $(DEFINES) -c $< -o $@ + +$(C_OBJ): %.o: %.c + $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c $< -o $@ + +$(EDGER8R): + $(MAKE) -C $(EDGER8R_DIR) + +$(EC_DH_LIB): + $(MAKE) -C $(EC_DH_LIB_DIR) + +$(TSEAL_LIB): + $(MAKE) -C $(TSEAL_LIB_DIR) + +$(SE_LIB): + $(MAKE) -C $(SE_LIB_DIR) + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + $(MAKE) -C $(EDGER8R_DIR) clean + $(MAKE) -C $(EC_DH_LIB_DIR) clean + $(MAKE) -C $(TSEAL_LIB_DIR) clean + $(MAKE) -C $(SE_LIB_DIR) clean + @$(RM) *.o $(TSERVICE_SIM_LIB) $(TAE_SERVICE_SIM_LIB) $(BUILD_DIR)/$(TSERVICE_SIM_LIB) + @$(RM) $(COMMON_DIR)/src/*.o + @$(RM) sgx_tae_service_*.c + @$(RM) sgx_tae_service_*.h + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/simulation/tae_service_sim/tae_service_sim.cpp b/sdk/simulation/tae_service_sim/tae_service_sim.cpp new file mode 100644 index 0000000000..ab2f45acaa --- /dev/null +++ b/sdk/simulation/tae_service_sim/tae_service_sim.cpp @@ -0,0 +1,485 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +//tae_service_sim.cpp : Defines the exported functions +// + +#include "sgx_tae_service.h" +#include "tae_service_internal.h" +#include "pse_types.h" +#include "stdlib.h" +#include "string.h" +#include "sgx_spinlock.h" +#include "sgx_tae_service_t.h" + +#define RETRY_TIMES 2 +#define DEFAULT_VMC_ATTRIBUTE_MASK 0xFFFFFFFFFFFFFFCB +#define DEFAULT_VMC_XFRM_MASK 0x0 + +#ifdef _DEBUG +//wait for 10min at most for debug +#define DEFAULT_AESM_TIMEOUT 600000 +#else +//wait for 10sec at most +#define DEFAULT_AESM_TIMEOUT 10000 +#endif + +static sgx_spinlock_t g_spin_lock; +static bool g_b_session_established = false; + +sgx_status_t sgx_create_pse_session() +{ + sgx_spin_lock(&g_spin_lock); + if(!g_b_session_established) + g_b_session_established = true; + sgx_spin_unlock(&g_spin_lock); + return SGX_SUCCESS; +} + +sgx_status_t sgx_close_pse_session() +{ + sgx_spin_lock(&g_spin_lock); + if(g_b_session_established) + g_b_session_established = false; + sgx_spin_unlock(&g_spin_lock); + return SGX_SUCCESS; +} + +sgx_status_t sgx_get_ps_sec_prop(sgx_ps_sec_prop_desc_t *p_security_property) +{ + sgx_status_t ret = SGX_SUCCESS; + if(!p_security_property) + return SGX_ERROR_INVALID_PARAMETER; + if (!g_b_session_established){ + return SGX_ERROR_AE_SESSION_INVALID; + } + else + { + se_ps_sec_prop_desc_internal_t *p_security_property_internal = (se_ps_sec_prop_desc_internal_t*)p_security_property; + p_security_property_internal->desc_type = 0; + p_security_property_internal->pse_miscselect = 0; + p_security_property_internal->reserved1 = 0; + memset(p_security_property_internal->reserved2, 0, sizeof(p_security_property_internal->reserved2)); + p_security_property_internal->pse_prod_id = 2; + p_security_property_internal->pse_isvsvn = 1; + p_security_property_internal->pse_attributes.flags = SGX_FLAGS_INITTED; + p_security_property_internal->pse_attributes.xfrm = SGX_XFRM_LEGACY; + memset(&(p_security_property_internal->pse_mr_signer), 0xEE, + sizeof(p_security_property_internal->pse_mr_signer)); + p_security_property_internal->cse_sec_prop.gid_cse = 0; + p_security_property_internal->cse_sec_prop.prvrl_version = 1; + p_security_property_internal->cse_sec_prop.sigrl_version = 1; + p_security_property_internal->cse_sec_prop.sec_info_type = 0; + memset(&p_security_property_internal->cse_sec_prop.ca_id_cse, 0, sizeof(p_security_property_internal->cse_sec_prop.ca_id_cse)); + memset(&p_security_property_internal->cse_sec_prop.sec_info, 0, sizeof(p_security_property_internal->cse_sec_prop.sec_info)); + } + return ret; +} + +sgx_status_t sgx_get_trusted_time +( + sgx_time_t *p_current_time, + sgx_time_source_nonce_t *p_time_source_nonce) +{ + if(!p_current_time || !p_time_source_nonce) + return SGX_ERROR_INVALID_PARAMETER; + if (!g_b_session_established){ + return SGX_ERROR_AE_SESSION_INVALID; + } + + pse_message_t *p_req_msg = + (pse_message_t *)malloc(PSE_TIMER_READ_REQ_SIZE); + if(!p_req_msg){ + return SGX_ERROR_OUT_OF_MEMORY; + } + pse_message_t *p_resp_msg = + (pse_message_t *)malloc(PSE_TIMER_READ_RESP_SIZE); + if(!p_resp_msg){ + free(p_req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + p_req_msg->exp_resp_size = sizeof(pse_timer_read_resp_t); + p_req_msg->payload_size = sizeof(pse_timer_read_req_t); + + pse_timer_read_req_t *p_timer_req + = (pse_timer_read_req_t *)p_req_msg->payload; + p_timer_req->req_hdr.service_id = PSE_TRUSTED_TIME_SERVICE; + p_timer_req->req_hdr.service_cmd = PSE_TIMER_READ; + + pse_timer_read_resp_t *p_timer_resp + = (pse_timer_read_resp_t *)p_resp_msg->payload; + + sgx_status_t status = SGX_SUCCESS; + sgx_status_t ret = SGX_SUCCESS; + int retry = RETRY_TIMES; + do { + status = invoke_service_ocall(&ret, + (uint8_t *)p_req_msg, + PSE_TIMER_READ_REQ_SIZE, + (uint8_t *)p_resp_msg, + PSE_TIMER_READ_RESP_SIZE, + DEFAULT_AESM_TIMEOUT); + if(status != SGX_SUCCESS || ret != SGX_SUCCESS){ + status = SGX_ERROR_UNEXPECTED; + continue; + } + + if(p_timer_resp->resp_hdr.service_id != PSE_TRUSTED_TIME_SERVICE + || p_timer_resp->resp_hdr.service_cmd != PSE_TIMER_READ + || p_timer_resp->resp_hdr.status != PSE_SUCCESS){ + status = SGX_ERROR_UNEXPECTED; + } else { + memcpy(p_current_time, &p_timer_resp->timestamp, sizeof(sgx_time_t)); + memcpy(p_time_source_nonce, p_timer_resp->time_source_nonce, + sizeof(sgx_time_source_nonce_t)); + status = SGX_SUCCESS; + break; + } + } while(retry--); + free(p_req_msg); + free(p_resp_msg); + return status; +} + +sgx_status_t sgx_create_monotonic_counter_ex( + uint16_t owner_policy, + const sgx_attributes_t* owner_attribute_mask, + sgx_mc_uuid_t *p_counter_uuid, + uint32_t *p_counter_value) +{ + if(!p_counter_value || !p_counter_uuid || !owner_attribute_mask){ + return SGX_ERROR_INVALID_PARAMETER; + } + if (0!= (~(MC_POLICY_SIGNER | MC_POLICY_ENCLAVE) & owner_policy) + || 0 == ((MC_POLICY_SIGNER | MC_POLICY_ENCLAVE)& owner_policy)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if (!g_b_session_established){ + return SGX_ERROR_AE_SESSION_INVALID; + } + + pse_message_t *p_req_msg = (pse_message_t *)malloc(PSE_CREATE_MC_REQ_SIZE); + if(!p_req_msg){ + return SGX_ERROR_OUT_OF_MEMORY; + } + pse_message_t *p_resp_msg = (pse_message_t *)malloc(PSE_CREATE_MC_RESP_SIZE); + if(!p_resp_msg){ + free(p_req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + p_req_msg->exp_resp_size = sizeof(pse_mc_create_resp_t); + p_req_msg->payload_size = sizeof(pse_mc_create_req_t); + + pse_mc_create_req_t *p_mc_req + = (pse_mc_create_req_t *)p_req_msg->payload; + p_mc_req->req_hdr.service_id = PSE_MC_SERVICE; + p_mc_req->req_hdr.service_cmd = PSE_MC_CREATE; + p_mc_req->policy = owner_policy; + memcpy(p_mc_req->attr_mask , owner_attribute_mask, sizeof(p_mc_req->attr_mask)); + + pse_mc_create_resp_t *p_mc_resp + = (pse_mc_create_resp_t *)p_resp_msg->payload; + + sgx_status_t status = SGX_SUCCESS; + sgx_status_t ret = SGX_SUCCESS; + int retry = RETRY_TIMES; + do { + sgx_spin_lock(&g_spin_lock); + status = invoke_service_ocall(&ret, + (uint8_t *)p_req_msg, + PSE_CREATE_MC_REQ_SIZE, + (uint8_t *)p_resp_msg, + PSE_CREATE_MC_RESP_SIZE, + DEFAULT_AESM_TIMEOUT); + sgx_spin_unlock(&g_spin_lock); + if(status != SGX_SUCCESS || ret != SGX_SUCCESS){ + status = SGX_ERROR_UNEXPECTED; + continue; + } + + if(p_mc_resp->resp_hdr.service_id != PSE_MC_SERVICE + || p_mc_resp->resp_hdr.service_cmd != PSE_MC_CREATE + || p_mc_resp->resp_hdr.status != PSE_SUCCESS){ + status = SGX_ERROR_UNEXPECTED; + } else { + memcpy(p_counter_uuid->counter_id, + &p_mc_resp->counter_id, + sizeof(p_counter_uuid->counter_id)); + memcpy(p_counter_uuid->nonce, + &p_mc_resp->nonce, + sizeof(p_counter_uuid->nonce)); + *p_counter_value = 0; + status = SGX_SUCCESS; + break; + } + } while(retry--); + free(p_req_msg); + free(p_resp_msg); + return status; +} + +sgx_status_t sgx_increment_monotonic_counter( + const sgx_mc_uuid_t *p_counter_uuid, + uint32_t *p_counter_value) +{ + if(!p_counter_value || !p_counter_uuid ){ + return SGX_ERROR_INVALID_PARAMETER; + } + if (!g_b_session_established){ + return SGX_ERROR_AE_SESSION_INVALID; + } + + pse_message_t *p_req_msg = (pse_message_t *)malloc(PSE_INC_MC_REQ_SIZE); + if(!p_req_msg){ + return SGX_ERROR_OUT_OF_MEMORY; + } + pse_message_t *p_resp_msg = (pse_message_t *)malloc(PSE_INC_MC_RESP_SIZE); + if(!p_resp_msg){ + free(p_req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + p_req_msg->exp_resp_size = sizeof(pse_mc_inc_resp_t); + p_req_msg->payload_size = sizeof(pse_mc_inc_req_t); + + pse_mc_inc_req_t *p_mc_req + = (pse_mc_inc_req_t *)p_req_msg->payload; + memcpy(p_mc_req->counter_id, + p_counter_uuid->counter_id, + sizeof(p_mc_req->counter_id)); + memcpy(p_mc_req->nonce, + p_counter_uuid->nonce, + sizeof(p_mc_req->nonce)); + p_mc_req->req_hdr.service_id = PSE_MC_SERVICE; + p_mc_req->req_hdr.service_cmd = PSE_MC_INC; + + pse_mc_inc_resp_t *p_mc_resp + = (pse_mc_inc_resp_t *)p_resp_msg->payload; + + sgx_status_t status = SGX_SUCCESS; + sgx_status_t ret = SGX_SUCCESS; + int retry = RETRY_TIMES; + do { + sgx_spin_lock(&g_spin_lock); + status = invoke_service_ocall(&ret, + (uint8_t *)p_req_msg, + PSE_INC_MC_REQ_SIZE, + (uint8_t *)p_resp_msg, + PSE_INC_MC_RESP_SIZE, + DEFAULT_AESM_TIMEOUT); + sgx_spin_unlock(&g_spin_lock); + if(status != SGX_SUCCESS || ret != SGX_SUCCESS){ + if(SGX_ERROR_MC_NOT_FOUND != ret) + status = SGX_ERROR_UNEXPECTED; + else + status = SGX_ERROR_MC_NOT_FOUND; + continue; + } + + if(p_mc_resp->resp_hdr.service_id != PSE_MC_SERVICE + || p_mc_resp->resp_hdr.service_cmd != PSE_MC_INC + || p_mc_resp->resp_hdr.status != PSE_SUCCESS){ + if(PSE_ERROR_MC_NOT_FOUND == p_mc_resp->resp_hdr.status) + status = SGX_ERROR_MC_NOT_FOUND; + else + status = SGX_ERROR_UNEXPECTED; + } else + { + *p_counter_value = p_mc_resp->counter_value; + status = SGX_SUCCESS; + break; + } + } while(retry--); + free(p_req_msg); + free(p_resp_msg); + return status; +} + +sgx_status_t sgx_read_monotonic_counter( + const sgx_mc_uuid_t *p_counter_uuid, + uint32_t *p_counter_value) +{ + if(!p_counter_value || !p_counter_uuid){ + return SGX_ERROR_INVALID_PARAMETER; + } + if (!g_b_session_established){ + return SGX_ERROR_AE_SESSION_INVALID; + } + + pse_message_t *p_req_msg = (pse_message_t *)malloc(PSE_READ_MC_REQ_SIZE); + if(!p_req_msg){ + return SGX_ERROR_OUT_OF_MEMORY; + } + pse_message_t *p_resp_msg = (pse_message_t *)malloc(PSE_READ_MC_RESP_SIZE); + if(!p_resp_msg){ + free(p_req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + p_req_msg->exp_resp_size = sizeof(pse_mc_read_resp_t); + p_req_msg->payload_size = sizeof(pse_mc_read_req_t); + + pse_mc_read_req_t *p_mc_req + = (pse_mc_read_req_t *)p_req_msg->payload; + memcpy(p_mc_req->counter_id, + p_counter_uuid->counter_id, + sizeof(p_mc_req->counter_id)); + memcpy(p_mc_req->nonce, + p_counter_uuid->nonce, + sizeof(p_mc_req->nonce)); + p_mc_req->req_hdr.service_id = PSE_MC_SERVICE; + p_mc_req->req_hdr.service_cmd = PSE_MC_READ; + + pse_mc_read_resp_t *p_mc_resp + = (pse_mc_read_resp_t *)p_resp_msg->payload; + + sgx_status_t status = SGX_SUCCESS; + sgx_status_t ret = SGX_SUCCESS; + int retry = RETRY_TIMES; + do { + sgx_spin_lock(&g_spin_lock); + status = invoke_service_ocall(&ret, + (uint8_t *)p_req_msg, + PSE_READ_MC_REQ_SIZE, + (uint8_t *)p_resp_msg, + PSE_READ_MC_RESP_SIZE, + DEFAULT_AESM_TIMEOUT); + sgx_spin_unlock(&g_spin_lock); + if(status != SGX_SUCCESS || ret != SGX_SUCCESS){ + if(SGX_ERROR_MC_NOT_FOUND != ret) + status = SGX_ERROR_UNEXPECTED; + else + status = SGX_ERROR_MC_NOT_FOUND; + continue; + } + + if(p_mc_resp->resp_hdr.service_id != PSE_MC_SERVICE + || p_mc_resp->resp_hdr.service_cmd != PSE_MC_READ + || p_mc_resp->resp_hdr.status != PSE_SUCCESS){ + if(PSE_ERROR_MC_NOT_FOUND == p_mc_resp->resp_hdr.status) + status = SGX_ERROR_MC_NOT_FOUND; + else + status = SGX_ERROR_UNEXPECTED; + } else { + *p_counter_value = p_mc_resp->counter_value; + status = SGX_SUCCESS; + break; + } + } while(retry--); + free(p_req_msg); + free(p_resp_msg); + return status; +} + +sgx_status_t sgx_create_monotonic_counter( + sgx_mc_uuid_t *p_counter_uuid, + uint32_t *p_counter_value) +{ + //Default attribute mask + sgx_attributes_t attr_mask; + attr_mask.flags = DEFAULT_VMC_ATTRIBUTE_MASK; + attr_mask.xfrm = DEFAULT_VMC_XFRM_MASK; + + return sgx_create_monotonic_counter_ex(MC_POLICY_SIGNER, + &attr_mask, + p_counter_uuid, + p_counter_value); +} + +sgx_status_t sgx_destroy_monotonic_counter(const sgx_mc_uuid_t *p_counter_uuid) +{ + if(!p_counter_uuid){ + return SGX_ERROR_INVALID_PARAMETER; + } + if (!g_b_session_established){ + return SGX_ERROR_AE_SESSION_INVALID; + } + + pse_message_t *p_req_msg = (pse_message_t *)malloc(PSE_DEL_MC_REQ_SIZE); + if(!p_req_msg){ + return SGX_ERROR_OUT_OF_MEMORY; + } + pse_message_t *p_resp_msg = (pse_message_t *)malloc(PSE_DEL_MC_RESP_SIZE); + if(!p_resp_msg){ + free(p_req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + p_req_msg->exp_resp_size = sizeof(pse_mc_del_resp_t); + p_req_msg->payload_size = sizeof(pse_mc_del_req_t); + + pse_mc_del_req_t *p_mc_req + = (pse_mc_del_req_t *)p_req_msg->payload; + memcpy(p_mc_req->counter_id, + p_counter_uuid->counter_id, + sizeof(p_mc_req->counter_id)); + memcpy(p_mc_req->nonce, + p_counter_uuid->nonce, + sizeof(p_mc_req->nonce)); + p_mc_req->req_hdr.service_id = PSE_MC_SERVICE; + p_mc_req->req_hdr.service_cmd = PSE_MC_DEL; + + pse_mc_del_resp_t *p_mc_resp + = (pse_mc_del_resp_t *)p_resp_msg->payload; + + sgx_status_t status = SGX_SUCCESS; + sgx_status_t ret = SGX_SUCCESS; + int retry = RETRY_TIMES; + do { + status = invoke_service_ocall(&ret, + (uint8_t *)p_req_msg, + PSE_DEL_MC_REQ_SIZE, + (uint8_t *)p_resp_msg, + PSE_DEL_MC_RESP_SIZE, + DEFAULT_AESM_TIMEOUT); + if(status != SGX_SUCCESS || ret != SGX_SUCCESS){ + if(SGX_ERROR_MC_NOT_FOUND != ret) + status = SGX_ERROR_UNEXPECTED; + else + status = SGX_ERROR_MC_NOT_FOUND; + continue; + } + + if(p_mc_resp->resp_hdr.service_id != PSE_MC_SERVICE + || p_mc_resp->resp_hdr.service_cmd != PSE_MC_DEL + || p_mc_resp->resp_hdr.status != PSE_SUCCESS){ + if(PSE_ERROR_MC_NOT_FOUND == p_mc_resp->resp_hdr.status) + status = SGX_ERROR_MC_NOT_FOUND; + else + status = SGX_ERROR_UNEXPECTED; + } else { + status = SGX_SUCCESS; + break; + } + } while(retry--); + free(p_req_msg); + free(p_resp_msg); + return status; +} + diff --git a/sdk/simulation/tinst/Makefile b/sdk/simulation/tinst/Makefile new file mode 100644 index 0000000000..8b45aa092e --- /dev/null +++ b/sdk/simulation/tinst/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +SIM_DIR := $(CUR_DIR)/.. + +CPPFLAGS += $(ADDED_INC) # for unbuntu 11 and later version +CPPFLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(SIM_DIR)/assembly/ \ + -I$(SIM_DIR)/assembly/linux \ + -I$(SIM_DIR)/uinst/ \ + -I$(LINUX_SDK_DIR)/selib + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -Werror -fno-exceptions -fno-rtti + +LIBSESIMU_T := libsesimu_t.a + +OBJS := deriv.o t_instructions.o + +.PHONY:all +all: $(LIBSESIMU_T) + +$(LIBSESIMU_T): $(OBJS) + $(AR) rcs $@ $^ + +# Explicitly disable optimization for 't_instructions.cpp', +# since the '_SE3' function has assumptions on stack layout. +t_instructions.o: CXXFLAGS += -O0 + +.PHONY: clean +clean: + @$(RM) $(OBJS) $(LIBSESIMU_T) diff --git a/sdk/simulation/tinst/deriv.cpp b/sdk/simulation/tinst/deriv.cpp new file mode 100644 index 0000000000..de2425911d --- /dev/null +++ b/sdk/simulation/tinst/deriv.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "deriv.h" +#include "sgx_tcrypto.h" + +// The built-in seal key in simulation mode +static const uint8_t BASE_SEAL_KEY[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, +}; + +// The built-in report key in simulation mode +static const uint8_t BASE_REPORT_KEY[] = { + 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, +}; + +// The built-in license key in simulation mode +static const uint8_t BASE_LICENSE_KEY[] = { + 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, +}; + +// The built-in provision key in simulation mode +static const uint8_t BASE_PROVISION_KEY[] = { + 0xbb, 0xaa, 0xbb, 0xee, 0xff, 0x00, 0x00, 0xdd, + 0xbb, 0xaa, 0xbb, 0xee, 0xff, 0x00, 0x00, 0xdd, +}; + +// The built-in provision-seal key in simulation mode +static const uint8_t BASE_PROV_SEAL_KEY[] = { + 0x50, 0x52, 0x4f, 0x56, 0x49, 0x53, 0x49, 0x4f, + 0x4e, 0x53, 0x45, 0x41, 0x4c, 0x4b, 0x45, 0x59, +}; + +const uint8_t* get_base_key(uint16_t key_name) +{ + switch (key_name) { + case SGX_KEYSELECT_SEAL: return BASE_SEAL_KEY; + case SGX_KEYSELECT_REPORT: return BASE_REPORT_KEY; + case SGX_KEYSELECT_LICENSE: return BASE_LICENSE_KEY; + case SGX_KEYSELECT_PROVISION: return BASE_PROVISION_KEY; + case SGX_KEYSELECT_PROVISION_SEAL: return BASE_PROV_SEAL_KEY; + } + + // Should not come here - error should have been reported + // when the key name is not supported in the caller. + return (uint8_t*)0; +} + +// Compute the CMAC of derivation data with corresponding base key +// and save it to `okey'. +void derive_key(const derivation_data_t* dd, sgx_key_128bit_t okey) +{ + sgx_rijndael128_cmac_msg((const sgx_cmac_128bit_key_t*)(get_base_key(dd->key_name)), + dd->ddbuf, dd->size, (sgx_cmac_128bit_tag_t*)okey); +} + +// Compute the CMAC of a `buf' with a given `key'. +void cmac(const sgx_key_128bit_t *key, const uint8_t* buf, int buf_len, sgx_mac_t* cmac) +{ + sgx_rijndael128_cmac_msg((const sgx_cmac_128bit_key_t*)key, buf, buf_len, cmac); +} diff --git a/sdk/simulation/tinst/deriv.h b/sdk/simulation/tinst/deriv.h new file mode 100644 index 0000000000..ca629a7deb --- /dev/null +++ b/sdk/simulation/tinst/deriv.h @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* deriv.h - it defines C++ interfaces for derivation data. */ +#ifndef DERIVE_H__ +#define DERIVE_H__ + +#include "arch.h" +#include "sgx_key.h" +#include "sgx_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define OWNEREPOCH_SIZE 16 +typedef uint8_t se_owner_epoch_t[OWNEREPOCH_SIZE]; + +/* Derive data for seal key */ +typedef struct { + uint16_t key_name; /* should always be 'SGX_KEYSELECT_SEAL' */ + sgx_attributes_t tmp_attr; + sgx_attributes_t attribute_mask; /* attribute mask from KEYREQUEST */ + se_owner_epoch_t csr_owner_epoch; + sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ + sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ + sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ + sgx_measurement_t mrenclave; + sgx_measurement_t mrsigner; + sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ +} dd_seal_key_t; + +/* Derive data for report key */ +typedef struct { + uint16_t key_name; /* should always be 'SGX_KEYSELECT_REPORT' */ + sgx_attributes_t attributes; /* attributes from SECS */ + se_owner_epoch_t csr_owner_epoch; + sgx_measurement_t mrenclave; + sgx_cpu_svn_t cpu_svn; /* CPUSVN from CPUSVN register */ + sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ +} dd_report_key_t; + +/* Derive data for license key */ +typedef struct { + uint16_t key_name; /* should always be 'SGX_KEYSELECT_LICENSE' */ + sgx_attributes_t attributes; /* attributes from SECS */ + se_owner_epoch_t csr_owner_epoch; + sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ + sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ + sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ + sgx_key_id_t key_id; /* KEYID from KEYREQUEST */ +} dd_license_key_t; + +/* Derive data for provision key */ +typedef struct { + uint16_t key_name; /* should always be 'SGX_KEYSELECT_PROVISION' */ + sgx_attributes_t tmp_attr; + sgx_attributes_t attribute_mask; /* attribute mask from KEYREQUEST */ + sgx_cpu_svn_t cpu_svn; /* CPUSVN from KEYREQUEST */ + sgx_isv_svn_t isv_svn; /* ISVSVN from KEYREQUEST */ + sgx_prod_id_t isv_prod_id; /* ISV PRODID from SECS */ + sgx_measurement_t mrsigner; +} dd_provision_key_t; + +/* The derivation data. */ +typedef struct { + int size; /* the size of derivation data */ + + union { + /* key_name is the first field of all the following derivation data */ + uint16_t key_name; + uint8_t ddbuf[1]; + + dd_seal_key_t ddsk; + dd_report_key_t ddrk; + dd_license_key_t ddlk; + dd_provision_key_t ddpk; + }; +} derivation_data_t; + +/** + * Get the internal CPU keys. + * + * @param key_name - the key name + * @return NULL for invalid key name. + */ +const uint8_t* get_base_key(uint16_t key_name); + +/** The internal routine to derive requested key. Parameter checking + * is done in the caller. + * + * @param dd - the pointer to derive data + * @param okey - the output derived key + */ +void derive_key(const derivation_data_t* dd, sgx_key_128bit_t okey); + +/** Compute the CMAC of a buffer. + * @param key - the key used to compute the CMAC + * @param buf - the buf to be digested + * @param buf_len - length of the buffer in Bytes + * @param cmac - the pointer to the output buffer to store CMAC + */ +void cmac(const sgx_key_128bit_t *key, const uint8_t* buf, int buf_len, sgx_mac_t* cmac); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/tinst/rts_sim.h b/sdk/simulation/tinst/rts_sim.h new file mode 100644 index 0000000000..a9c56eeb94 --- /dev/null +++ b/sdk/simulation/tinst/rts_sim.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _RTS_SIM_H_ +#define _RTS_SIM_H_ + +#include "arch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +const sgx_cpu_svn_t DEFAULT_CPUSVN = { + { + 0x48, 0x20, 0xf3, 0x37, 0x6a, 0xe6, 0xb2, 0xf2, + 0x03, 0x4d, 0x3b, 0x7a, 0x4b, 0x48, 0xa7, 0x78 + } +}; +const sgx_cpu_svn_t UPGRADED_CPUSVN = { + { + 0x53, 0x39, 0xae, 0x8c, 0x93, 0xae, 0x8f, 0x3c, + 0xe4, 0x32, 0xdb, 0x92, 0x4d, 0x0f, 0x07, 0x33 + } +}; + +const sgx_cpu_svn_t DOWNGRADED_CPUSVN = { + { + 0x64, 0xea, 0x4f, 0x3f, 0xa0, 0x03, 0x0c, 0x36, + 0x38, 0x3c, 0x32, 0x2d, 0x4f, 0x3a, 0x8d, 0x4f + } +}; + + +typedef struct _global_data_sim_t +{ + secs_t* secs_ptr; + sgx_cpu_svn_t cpusvn_sim; + uint32_t seed; /* to initialize the PRNG */ +} global_data_sim_t; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/tinst/t_instructions.cpp b/sdk/simulation/tinst/t_instructions.cpp new file mode 100644 index 0000000000..8e5c861220 --- /dev/null +++ b/sdk/simulation/tinst/t_instructions.cpp @@ -0,0 +1,351 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// t_instructions.cpp -- It simulates Enclave instructions. +#include +#include + +#include "arch.h" +#include "util.h" +#include "lowlib.h" +#include "sgx_trts.h" +#include "trts_inst.h" + +#include "deriv.h" +#include "t_instructions.h" +#include "td_mngr.h" + +//////////////////////////////////////////////////////////////////////// +global_data_sim_t g_global_data_sim = {NULL, {{0}}, 0}; + +#define GP() abort() +#define GP_ON(cond) do { if (unlikely(cond)) GP(); } while (0) + +//////////////////////////////////////////////////////////////////////// +// Simulation for EGETKEY +//////////////////////////////////////////////////////////////////////// + +// The hard-coded OwnerEpoch. +static const se_owner_epoch_t SIMU_OWNER_EPOCH_MSR = { + 0x54, 0x48, 0x49, 0x53, 0x49, 0x53, 0x4f, 0x57, + 0x4e, 0x45, 0x52, 0x45, 0x50, 0x4f, 0x43, 0x48, +}; + + +#define check_cpu_svn(kr) do { \ + if(memcmp(&kr->cpu_svn, &UPGRADED_CPUSVN, sizeof(UPGRADED_CPUSVN)) && \ + memcmp(&kr->cpu_svn, &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)) && \ + memcmp(&kr->cpu_svn, &DOWNGRADED_CPUSVN, sizeof(DOWNGRADED_CPUSVN))){ \ + return EGETKEY_INVALID_CPUSVN; \ + } \ + if ( (!memcmp(&g_global_data_sim.cpusvn_sim, &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)) && \ + !memcmp(&kr->cpu_svn, &UPGRADED_CPUSVN, sizeof(UPGRADED_CPUSVN))) || \ + (!memcmp(&g_global_data_sim.cpusvn_sim, &DOWNGRADED_CPUSVN, sizeof(DOWNGRADED_CPUSVN)) && \ + memcmp(&kr->cpu_svn, &DOWNGRADED_CPUSVN, sizeof(DOWNGRADED_CPUSVN)))){ \ + return EGETKEY_INVALID_CPUSVN; \ + } \ + } while(0) + +#define check_isv_svn(kr, secs) do { \ + if (kr->isv_svn > secs->isv_svn) { \ + return EGETKEY_INVALID_ISVSVN; \ + } \ +} while(0) + +#define check_attr_flag(secs, flag) do { \ + if ((secs->attributes.flags & flag) == 0) { \ + return EGETKEY_INVALID_ATTRIBUTE; \ + } \ +} while(0) + + +// The hardware EGETKEY instruction will set ZF on failure. +// +// In simulation mode, we can not guarentee that the ZF is always set +// between _EGETKEY ending its life and tRTS testing ZF. Since there +// are additional assembly code in between. +// +// In simulation mode, we check return code instead of ZF. +// c.f. do_egetkey() in trts/linux/trts_pic.S + +static int _EGETKEY(sgx_key_request_t* kr, sgx_key_128bit_t okey) +{ + // check alignment of KEYREQUEST + GP_ON(((size_t)kr & (KEY_REQUEST_ALIGN_SIZE - 1)) != 0); + + // check to see if KEYREQEUST is inside the current enclave + GP_ON(!sgx_is_within_enclave(kr, sizeof(sgx_key_request_t))); + + // check alignment of OUTPUTDATA + GP_ON(((size_t)okey & (KEY_ALIGN_SIZE - 1)) != 0); + + // check to see if OUTPUTDATA is inside the current enclave + GP_ON(!sgx_is_within_enclave(okey, sizeof(sgx_key_128bit_t))); + + // check reserved bits are not set + GP_ON((kr->key_policy & ~(SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) != 0); + + // check to see if reserved space in KEYREQUEST are valid + const uint8_t* u8ptr = (uint8_t *)(&(kr->reserved1)); + for (unsigned i = 0; i < sizeof(kr->reserved1); ++i) + GP_ON(u8ptr[i] != (uint8_t)0); + + u8ptr = (uint8_t *)(&(kr->reserved2)); + for (unsigned i = 0; i < sizeof(kr->reserved2); ++i) + GP_ON(u8ptr[i] != (uint8_t)0); + + secs_t* cur_secs = g_global_data_sim.secs_ptr; + sgx_attributes_t tmp_attr; + derivation_data_t dd; + + memset(&dd, 0, sizeof(dd)); + dd.key_name = kr->key_name; + + // Determine which enclave attributes that must be included in the key. + // Attributes that must always be included INIT & DEBUG. + memset(&tmp_attr, 0, sizeof(tmp_attr)); + tmp_attr.flags = kr->attribute_mask.flags | SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG; + tmp_attr.flags &= cur_secs->attributes.flags; + tmp_attr.xfrm = kr->attribute_mask.xfrm & cur_secs->attributes.xfrm; + // HW supports CPUSVN to be set as 0. + // To be consistent with HW behaviour, we replace the cpusvn as DEFAULT_CPUSVN if the input cpusvn is 0. + if(!memcmp(&kr->cpu_svn, &dd.ddpk.cpu_svn, sizeof(sgx_cpu_svn_t))) + { + memcpy(&kr->cpu_svn, &DEFAULT_CPUSVN, sizeof(sgx_cpu_svn_t)); + } + + switch (kr->key_name) { + case SGX_KEYSELECT_SEAL: + check_isv_svn(kr, cur_secs); + check_cpu_svn(kr); + + // assemble derivation data + dd.size = sizeof(dd_seal_key_t); + if (kr->key_policy & SGX_KEYPOLICY_MRENCLAVE) { + memcpy(&dd.ddsk.mrenclave, &cur_secs->mr_enclave, sizeof(sgx_measurement_t)); + } + + if (kr->key_policy & SGX_KEYPOLICY_MRSIGNER) { + memcpy(&dd.ddsk.mrsigner, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); + } + + memcpy(&dd.ddsk.tmp_attr, &tmp_attr, sizeof(sgx_attributes_t)); + memcpy(&dd.ddsk.attribute_mask, &kr->attribute_mask, sizeof(sgx_attributes_t)); + memcpy(dd.ddsk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); + memcpy(&dd.ddsk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); + dd.ddsk.isv_svn = kr->isv_svn; + dd.ddsk.isv_prod_id = cur_secs->isv_prod_id; + memcpy(&dd.ddsk.key_id, &kr->key_id, sizeof(sgx_key_id_t)); + break; + + case SGX_KEYSELECT_REPORT: + // assemble derivation data + dd.size = sizeof(dd_report_key_t); + memcpy(&dd.ddrk.attributes, &cur_secs->attributes, sizeof(sgx_attributes_t)); + memcpy(dd.ddrk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); + memcpy(&dd.ddrk.cpu_svn,&(g_global_data_sim.cpusvn_sim),sizeof(sgx_cpu_svn_t)); + memcpy(&dd.ddrk.mrenclave, &cur_secs->mr_enclave, sizeof(sgx_measurement_t)); + memcpy(&dd.ddrk.key_id, &kr->key_id, sizeof(sgx_key_id_t)); + break; + + case SGX_KEYSELECT_LICENSE: + check_attr_flag(cur_secs, SGX_FLAGS_LICENSE_KEY); + check_isv_svn(kr, cur_secs); + check_cpu_svn(kr); + + // assemble derivation data + dd.size = sizeof(dd_license_key_t); + memcpy(&dd.ddlk.attributes, &cur_secs->attributes, sizeof(sgx_attributes_t)); + memcpy(dd.ddlk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); + memcpy(&dd.ddlk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); + dd.ddlk.isv_svn = kr->isv_svn; + dd.ddlk.isv_prod_id = cur_secs->isv_prod_id; + memcpy(&dd.ddlk.key_id, &kr->key_id, sizeof(sgx_key_id_t)); + break; + + case SGX_KEYSELECT_PROVISION: // Pass through. Only key_name differs. + case SGX_KEYSELECT_PROVISION_SEAL: + check_attr_flag(cur_secs, SGX_FLAGS_PROVISION_KEY); + check_isv_svn(kr, cur_secs); + check_cpu_svn(kr); + + // assemble derivation data + dd.size = sizeof(dd_provision_key_t); + memcpy(&dd.ddpk.tmp_attr, &tmp_attr, sizeof(sgx_attributes_t)); + memcpy(&dd.ddpk.attribute_mask, &kr->attribute_mask, sizeof(sgx_attributes_t)); + memcpy(&dd.ddpk.cpu_svn,&kr->cpu_svn,sizeof(sgx_cpu_svn_t)); + dd.ddpk.isv_svn = kr->isv_svn; + dd.ddpk.isv_prod_id = cur_secs->isv_prod_id; + memcpy(&dd.ddpk.mrsigner, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); + break; + + default: + return EGETKEY_INVALID_KEYNAME; + } + + derive_key(&dd, okey); + return 0; +} + +//////////////////////////////////////////////////////////////////////// +// Simulation for EREPORT +//////////////////////////////////////////////////////////////////////// + +static void _EREPORT(const sgx_target_info_t* ti, const sgx_report_data_t* rd, sgx_report_t* report) +{ + // check alignment of TARGETINFO + GP_ON(((size_t)ti & (TARGET_INFO_ALIGN_SIZE - 1)) != 0); + + // check to see if TARGETINFO is inside the current enclave + GP_ON(!sgx_is_within_enclave(ti, sizeof(sgx_target_info_t))); + + // check alignment of REPORTDATA + GP_ON(((size_t)rd & (REPORT_DATA_ALIGN_SIZE - 1)) != 0); + + // check to see if REPORTDATA is inside the current enclave + GP_ON(!sgx_is_within_enclave(rd, sizeof(sgx_report_data_t))); + + // check alignment of OUTPUTDATA + GP_ON(((size_t)report & (REPORT_ALIGN_SIZE - 1)) != 0); + + // check to see if OUTPUTDATA is inside the current enclave + GP_ON(!sgx_is_within_enclave(report, sizeof(sgx_report_t))); + + secs_t* cur_secs = g_global_data_sim.secs_ptr; + SE_DECLSPEC_ALIGN(REPORT_ALIGN_SIZE) sgx_report_t tmp_report; + + // assemble REPORT Data + memset(&tmp_report, 0, sizeof(tmp_report)); + memcpy(&tmp_report.body.cpu_svn,&(g_global_data_sim.cpusvn_sim),sizeof(sgx_cpu_svn_t)); + tmp_report.body.isv_prod_id = cur_secs->isv_prod_id; + tmp_report.body.isv_svn = cur_secs->isv_svn; + memcpy(&tmp_report.body.attributes, &cur_secs->attributes, sizeof(sgx_attributes_t)); + memcpy(&tmp_report.body.report_data, rd, sizeof(sgx_report_data_t)); + memcpy(&tmp_report.body.mr_enclave, &cur_secs->mr_enclave, sizeof(sgx_measurement_t)); + memcpy(&tmp_report.body.mr_signer, &cur_secs->mr_signer, sizeof(sgx_measurement_t)); + memcpy(&tmp_report.key_id, get_base_key(SGX_KEYSELECT_REPORT), sizeof(sgx_key_id_t)/2); + + // derive the report key + derivation_data_t dd; + memset(&dd, 0, sizeof(dd)); + dd.size = sizeof(dd_report_key_t); + + dd.key_name = SGX_KEYSELECT_REPORT; + memcpy(&dd.ddrk.mrenclave, &ti->mr_enclave, sizeof(sgx_measurement_t)); + memcpy(&dd.ddrk.attributes, &ti->attributes, sizeof(sgx_attributes_t)); + memcpy(dd.ddrk.csr_owner_epoch, SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t)); + memcpy(&dd.ddrk.cpu_svn,&(g_global_data_sim.cpusvn_sim),sizeof(sgx_cpu_svn_t)); + memcpy(&dd.ddrk.key_id, &tmp_report.key_id, sizeof(sgx_key_id_t)); + + // calculate the derived key + sgx_key_128bit_t tmp_report_key; + memset(tmp_report_key, 0, sizeof(tmp_report_key)); + + derive_key(&dd, tmp_report_key); + + // call cryptographic CMAC function + // CMAC data are *NOT* including MAC and KEYID + cmac(&tmp_report_key, reinterpret_cast(&tmp_report.body), + sizeof(tmp_report.body), &tmp_report.mac); + + memcpy(report, &tmp_report, sizeof(sgx_report_t)); +} + +//////////////////////////////////////////////////////////////////////// + + +static void +_EEXIT(uintptr_t dest, uintptr_t xcx, uintptr_t xdx, uintptr_t xsi, uintptr_t xdi) +{ + // By simulator convention, XDX contains XBP and XCX contains XSP. + + enclu_regs_t regs; + // when the code jump back to the ip after EENTER, the simulation code unwind the stack + // by adding 6*sizeof(uintptr_t), so we substract it in advance. + regs.xsp = xcx - 6 * sizeof(uintptr_t); + regs.xbp = xdx; + regs.xip = dest; + + tcs_t *tcs = GET_TCS_PTR(xdx); + GP_ON(tcs == NULL); + + // restore the used _tls_array + GP_ON(td_mngr_restore_td(tcs) == false); + + // check thread is in use or not + tcs_sim_t *tcs_sim = reinterpret_cast(tcs->reserved); + GP_ON(tcs_sim->tcs_state != TCS_STATE_ACTIVE); + tcs_sim->tcs_state = TCS_STATE_INACTIVE; + + regs.xax = 0; + regs.xbx = dest; + regs.xcx = tcs_sim->saved_aep; + regs.xsi = xsi; + regs.xdi = xdi; + + load_regs(®s); + + // Never returns..... +} + + +// Master entry functions + +#pragma GCC push_options +#pragma GCC optimize ("O0") + +uintptr_t _SE3(uintptr_t xax, uintptr_t xbx, uintptr_t xcx, + uintptr_t xdx, uintptr_t xsi, uintptr_t xdi) +{ + switch (xax) + { + case SE_EEXIT: + _EEXIT(xbx, xcx, xdx, xsi, xdi); + // never reach here + return 0; + + case SE_EGETKEY: + return _EGETKEY(reinterpret_cast(xbx), + reinterpret_cast(xcx)); + + case SE_EREPORT: + _EREPORT(reinterpret_cast(xbx), + reinterpret_cast(xcx), + reinterpret_cast(xdx)); + return 0; + } + + GP(); + return (uintptr_t)-1; +} + +#pragma GCC pop_options diff --git a/sdk/simulation/tinst/t_instructions.h b/sdk/simulation/tinst/t_instructions.h new file mode 100644 index 0000000000..05ad132884 --- /dev/null +++ b/sdk/simulation/tinst/t_instructions.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _TINSTRUCTIONS_H +#define _TINSTRUCTIONS_H + +#include "se_types.h" +#include "rts_sim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern SE_DECLSPEC_EXPORT global_data_sim_t g_global_data_sim; + +uintptr_t _SE3(uintptr_t xax, uintptr_t xbx, uintptr_t xcx, + uintptr_t xdx, uintptr_t xsi, uintptr_t xdi); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/trtssim/Makefile b/sdk/simulation/trtssim/Makefile new file mode 100644 index 0000000000..5e02f9ac6c --- /dev/null +++ b/sdk/simulation/trtssim/Makefile @@ -0,0 +1,37 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +.PHONY: all clean +all: + $(MAKE) -C linux + +clean: + $(MAKE) -C linux clean diff --git a/sdk/simulation/trtssim/linux/Makefile b/sdk/simulation/trtssim/linux/Makefile new file mode 100644 index 0000000000..fc11d1599a --- /dev/null +++ b/sdk/simulation/trtssim/linux/Makefile @@ -0,0 +1,134 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +CPPFLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/tlibc/ \ + -I$(COMMON_DIR)/inc/internal \ + -I$(LINUX_SDK_DIR)/trts/ + +CFLAGS += $(ENCLAVE_CFLAGS) +ASFLAGS := -DSE_SIM -Werror $(CFLAGS) +CFLAGS += -DSE_SIM -Werror -fasynchronous-unwind-tables +CXXFLAGS += -DSE_SIM -Werror $(ENCLAVE_CXXFLAGS)\ + -fno-exceptions -fno-rtti + + +SIM_DIR := $(CUR_DIR)/../.. +# The sources from tRTS - shared by both Sim/HW mode +TRTS_DIR := $(LINUX_SDK_DIR)/trts/ +# The sources for SE0 instruction simulation +TINST_DIR := $(SIM_DIR)/tinst/ +# The sources for low-level API used by instruction simulation +LOWLIB_DIR := $(SIM_DIR)/assembly/linux/ +# The sources for TLS support +TLS_DIR := $(SIM_DIR)/uinst/linux/ +# The source for trusted loader +TLDR_DIR := $(LINUX_SDK_DIR)/trts/linux/ +# Support for platform dependent 'setcontext' +SC_DIR := $(LINUX_SDK_DIR)/trts/linux/$(ARCH)/ + +TRTS_OBJS := init_enclave.o \ + trts.o \ + trts_ecall.o \ + trts_ocall.o \ + trts_util.o \ + trts_veh.o \ + trts_xsave.o \ + init_optimized_lib.o + +TINST_OBJS := t_instructions.o \ + deriv.o + +LOWLIB_OBJS := lowlib.o + +TLS_OBJS := get_tcs.o \ + restore_tls.o + +TLDR_ASM_OBJS := trts_pic.o \ + metadata_sec.o + +TLDR_C_OBJS := elf_parser.o \ + global_init.o \ + tls_support.o + +TLDR_OBJS := $(TLDR_ASM_OBJS) $(TLDR_C_OBJS) + +SC_OBJ := setcontext.o + +LIBTRTS := libsgx_trts_sim.a + +vpath %.cpp $(TRTS_DIR):$(TINST_DIR) +vpath %.S $(LOWLIB_DIR):$(TLDR_DIR):$(SC_DIR) +vpath %.c $(TLS_DIR):$(TLDR_DIR) + +# ------------------------------------------------------------ +.PHONY: all +all: $(LIBTRTS) | $(BUILD_DIR) + $(CP) $< $| + +$(LIBTRTS): $(TRTS_OBJS) $(TINST_OBJS) $(LOWLIB_OBJS) $(TLS_OBJS) $(TLDR_OBJS) $(SC_OBJ) + $(AR) rcsD $@ $(TRTS_OBJS) $(TINST_OBJS) $(LOWLIB_OBJS) $(TLS_OBJS) $(TLDR_OBJS) $(SC_OBJ) + +# ------------------------------------------------------------ +$(TRTS_OBJS): CPPFLAGS += -I$(COMMON_DIR)/inc/tlibc \ + -I$(SIM_DIR)/tinst/ + +# Explicitly disable optimization for tRTS simulation library, +# since the '_SE3' function has assumptions on stack layout. +# c.f. ../../tinst/Makefile +$(TINST_OBJS): CPPFLAGS += -I$(SIM_DIR)/assembly/ \ + -I$(SIM_DIR)/assembly/linux \ + -I$(SIM_DIR)/uinst/ \ + -I$(LINUX_SDK_DIR)/selib/ \ + -O0 + +$(TLS_OBJS): CPPFLAGS += -I$(SIM_DIR)/assembly/ \ + -I$(SIM_DIR)/assembly/linux \ + -I$(SIM_DIR)/uinst/ + +$(TLDR_C_OBJS): CPPFLAGS += -I$(COMMON_DIR)/inc/internal/linux/ \ + -I$(SIM_DIR)/assembly/ + +$(TLDR_ASM_OBJS): ASFLAGS += -I$(SIM_DIR)/assembly/ + +$(SC_OBJ): ASFLAGS += -I$(LINUX_SDK_DIR)/cpprt/linux/libunwind/src/$(ARCH) -DISE=1 + +$(BUILD_DIR): + $(MKDIR) $@ + +.PHONY: clean +clean: + @$(RM) *.o $(LIBTRTS) $(BUILD_DIR)/$(LIBTRTS) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/simulation/uae_service_sim/licensing_sim.cpp b/sdk/simulation/uae_service_sim/licensing_sim.cpp new file mode 100644 index 0000000000..c12d3b0196 --- /dev/null +++ b/sdk/simulation/uae_service_sim/licensing_sim.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "ae_ipp.h" +#include "se_memcpy.h" +#include "util.h" +#include "uae_service_internal.h" + +/* This hard code depends on enclaveSinger private key of PvE, an Intel Generic +Enclave Signing Key currently: +trunk/psw/ae/common/sgx_qe_pve_private_key.pem */ +static const uint8_t PVE_PUBLIC_KEY[] = { + 0XAB, 0X93, 0XBB, 0XF7, 0X4A, 0XA2, 0XDF, 0X51, + 0X91, 0X46, 0X57, 0X93, 0X1D, 0XB0, 0XC, 0XDB, + 0X24, 0X1E, 0XF4, 0X91, 0X38, 0X3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, 0X60, 0XF4, 0XC3, 0XFC, 0XC2 +}; + + +static sgx_status_t get_launch_token_internal( + const enclave_css_t *p_signature, + const sgx_attributes_t *p_attributes, + token_t *p_token) +{ + memset(p_token, 0xEE, sizeof(token_t)); + memset(&(p_token->body.reserved1), 0, + sizeof(p_token->body.reserved1)); + memset(&(p_token->reserved2), 0, + sizeof(p_token->reserved2)); + + p_token->body.valid = 1; + // In spec, lic_token.cpu_svn = 1, which 1 should be the least significate one. + memset(&p_token->cpu_svn_le, 0, sizeof(p_token->cpu_svn_le)); + memset(&p_token->cpu_svn_le, 1, 1); + p_token->isv_svn_le = 1; + if(memcpy_s(&(p_token->body.attributes), + sizeof(p_token->body.attributes), + p_attributes, + sizeof(sgx_attributes_t))){ + return SGX_ERROR_UNEXPECTED; + } + if(memcpy_s(&(p_token->body.mr_enclave), + sizeof(p_token->body.mr_enclave), + &(p_signature->body.enclave_hash), + sizeof(p_signature->body.enclave_hash))){ + return SGX_ERROR_UNEXPECTED; + } + p_token->attributes_le.flags = SGX_FLAGS_INITTED; + p_token->attributes_le.xfrm = SGX_XFRM_LEGACY; + + IppStatus ipp_ret = ippStsNoErr; + ipp_ret = ippsHashMessage((const Ipp8u *)&(p_signature->key.modulus), + sizeof(p_signature->key.modulus), + (Ipp8u *)&(p_token->body.mr_signer), IPP_ALG_HASH_SHA256); + if(ipp_ret != ippStsNoErr){ + return SGX_ERROR_UNEXPECTED; + } + + return SGX_SUCCESS; +} + +sgx_status_t get_launch_token( + const enclave_css_t *p_signature, + const sgx_attributes_t *p_attribute, + sgx_launch_token_t *p_launch_token) +{ + if(!p_signature || !p_attribute || !p_launch_token){ + return SGX_ERROR_INVALID_PARAMETER; + } + + if(((p_attribute->flags) & SGX_FLAGS_PROVISION_KEY) && + memcmp(PVE_PUBLIC_KEY, &p_signature->key.modulus, + sizeof(PVE_PUBLIC_KEY))) + return SGX_ERROR_SERVICE_INVALID_PRIVILEGE; + + return get_launch_token_internal(p_signature, + p_attribute, + (token_t *)p_launch_token); +} diff --git a/sdk/simulation/uae_service_sim/linux/Makefile b/sdk/simulation/uae_service_sim/linux/Makefile new file mode 100644 index 0000000000..24d931f4e7 --- /dev/null +++ b/sdk/simulation/uae_service_sim/linux/Makefile @@ -0,0 +1,124 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR = ../../../.. +include $(TOP_DIR)/buildenv.mk + +INCLUDES := -I.. \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(LINUX_SDK_DIR)/tseal \ + -I$(LINUX_SDK_DIR)/simulation/tinst \ + -I$(LINUX_SDK_DIR)/simulation/urtssim \ + -I$(LINUX_EXTERNAL_DIR)/crypto_px/include \ + -I$(LINUX_EXTERNAL_DIR)/epid/inc \ + -I$(LINUX_EXTERNAL_DIR)/rdrand/ \ + -I$(LINUX_PSW_DIR)/ae/inc \ + -I$(LINUX_PSW_DIR)/ae/inc/internal \ + -I$(LINUX_PSW_DIR)/ae/common + +CXXFLAGS += -Wall -fPIC $(INCLUDES) -Werror +CFLAGS := $(filter-out -fPIC -Werror, $(CFLAGS)) -Wall $(INCLUDES) + +VERSION_SCRIPT = $(shell pwd)/uae_service_sim.linux.version +LD_OPT_WITHVER = -Wl,--version-script=$(VERSION_SCRIPT) + +IPP_LIBDIR := $(LINUX_EXTERNAL_DIR)/crypto_px/ +RDRAND_LIBDIR := $(LINUX_EXTERNAL_DIR)/rdrand/src +RDRAND_MAKEFILE := $(RDRAND_LIBDIR)/Makefile + +EXTERNAL_LIB += -L$(IPP_LIBDIR) -lcrypto_px +EXTERNAL_LIB += -L$(RDRAND_LIBDIR) -lrdrand +EXTERNAL_LIB += -L$(RDRAND_LIBDIR) -lrt +EXTERNAL_LIB += -ldl + +vpath %.cpp $(LINUX_PSW_DIR)/ae/common \ + $(LINUX_SDK_DIR)/simulation/urtssim \ + $(COMMON_DIR)/src + +vpath %.c $(COMMON_DIR)/src + +CPP_SRC := $(wildcard *.cpp ../*.cpp) se_sig_rl.cpp cpusvn_util.cpp sgx_read_rand.cpp +C_SRC := se_trace.c se_thread.c + +OBJ := $(CPP_SRC:.cpp=.o) \ + $(C_SRC:.c=.o) + +DLLNAME = libsgx_uae_service_sim.so +LIBUAE_SERVICE_DEPLOY := libsgx_uae_service_deploy.so + +.PHONY: all +all: $(DLLNAME) $(LIBUAE_SERVICE_DEPLOY) | $(BUILD_DIR) + $(CP) $(DLLNAME) $| + $(CP) $(LIBUAE_SERVICE_DEPLOY) $| + +$(DLLNAME): $(OBJ) -lrdrand -lcrypto_px + $(CXX) $(CXXFLAGS) $(OBJ) -shared $(EXTERNAL_LIB) -o $@ $(LD_OPT_WITHVER) + +%.o: %.c + $(CC) $(CFLAGS) -Werror -fPIC -c $< -o $@ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +-lcrypto_px: + $(MAKE) -C $(IPP_LIBDIR) + +-lrdrand: $(RDRAND_MAKEFILE) + $(MAKE) -C $(RDRAND_LIBDIR) + + +$(RDRAND_MAKEFILE): +ifeq ($(ARCH), x86) + @cd $(RDRAND_LIBDIR);./configure +else + @cd $(RDRAND_LIBDIR);./configure CFLAGS=-fPIC +endif + +$(LIBUAE_SERVICE_DEPLOY): ../uae_service_deploy.c + $(CC) -shared -Wl,-soname=libsgx_uae_service.so $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + @$(RM) *.o + @$(RM) ../*.o + @$(RM) $(DLLNAME) $(BUILD_DIR)/$(DLLNAME) + @$(RM) $(LIBUAE_SERVICE_DEPLOY) $(BUILD_DIR)/$(LIBUAE_SERVICE_DEPLOY) + @$(MAKE) -C $(IPP_LIBDIR) clean +ifeq ($(RDRAND_MAKEFILE), $(wildcard $(RDRAND_MAKEFILE))) + @$(MAKE) distclean -C $(RDRAND_LIBDIR) +endif + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/simulation/uae_service_sim/linux/platform_service_sim.cpp b/sdk/simulation/uae_service_sim/linux/platform_service_sim.cpp new file mode 100644 index 0000000000..c9608026dc --- /dev/null +++ b/sdk/simulation/uae_service_sim/linux/platform_service_sim.cpp @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "../uae_service_sim.h" + +#define SE_DATA_FOLDER1 "intel/" +#define SE_DATA_FOLDER2 "intelsgxpsw/" +#define MAX_PATH 260 +#include +#include +#include +#include +#define __STDC_FORMAT_MACROS +#include +#include "ae_ipp.h" + +static Mutex g_pse_sim_lock; + +__attribute__((constructor)) +// Initializer of the uae_service_sim. +static void init_ipp(void) +{ +} + +static char g_vmc_base_path[] = "/var/tmp/"; + + +sgx_status_t get_counter_id(vmc_sim_t *p_vmc_sim) +{ + uint32_t i = 0; + int random_int = 0; + unsigned int a, d; + asm volatile("rdtsc" : "=a" (a), "=d" (d)); + for(i = 0; i < sizeof(p_vmc_sim->counter_id); i++, random_int >>= 8) + { + if(!(i % 4)) + { + random_int = rand_r(&a); + } + p_vmc_sim->counter_id[i] = (uint8_t)(random_int & 0xFF); + } + for(i = 0; i < sizeof(p_vmc_sim->nonce); i++, random_int >>= 8) + { + if(!(i % 4)) + { + random_int = rand_r(&a); + } + p_vmc_sim->nonce[i] = (uint8_t)(random_int & 0xFF); + } + return SGX_SUCCESS; +} + +sgx_status_t del_vmc_sim(const vmc_sim_t *p_vmc_sim) +{ + char path[MAX_PATH] = {0}; + int ret = 0; + + uint64_t temp_value = 0; + memcpy_s(&temp_value, sizeof(temp_value), + p_vmc_sim->nonce, sizeof(temp_value)); + + char *p_buf = g_vmc_base_path; + + ret = snprintf(path, sizeof(path), "%s%s%s%" PRIx64".dat", + p_buf, SE_DATA_FOLDER1, SE_DATA_FOLDER2, temp_value); + if(-1 == ret){ + return SGX_ERROR_UNEXPECTED; + } + if(remove(path)){ + return SGX_ERROR_MC_NOT_FOUND; + } + + return SGX_SUCCESS; +} + +sgx_status_t store_vmc_sim(const vmc_sim_t *p_vmc_sim) +{ + char path[MAX_PATH] = {0}; + int ret = 0; + + uint64_t temp_value = 0; + memcpy_s(&temp_value, sizeof(temp_value), + p_vmc_sim->nonce, sizeof(temp_value)); + + char *p_buf = g_vmc_base_path; + + ret = snprintf(path, sizeof(path), "%s%s", + p_buf, + SE_DATA_FOLDER1); + if(-1 == ret){ + return SGX_ERROR_UNEXPECTED; + } + + g_pse_sim_lock.lock(); + ret = mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR); + if(0 == ret){ + ret = chmod(path, S_IRUSR|S_IWUSR|S_IXUSR + |S_IRGRP|S_IWGRP|S_IXGRP + |S_IROTH|S_IWOTH|S_IXOTH); + if(0 != ret){ + g_pse_sim_lock.unlock(); + return SGX_ERROR_UNEXPECTED; + } + }else if(EEXIST != errno){ + g_pse_sim_lock.unlock(); + return SGX_ERROR_UNEXPECTED; + } + g_pse_sim_lock.unlock(); + + ret = snprintf(path, sizeof(path), "%s%s%s", + p_buf, + SE_DATA_FOLDER1, + SE_DATA_FOLDER2); + if(-1 == ret){ + return SGX_ERROR_UNEXPECTED; + } + + g_pse_sim_lock.lock(); + ret = mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR); + if(0 == ret){ + ret = chmod(path, S_IRUSR|S_IWUSR|S_IXUSR + |S_IRGRP|S_IWGRP|S_IXGRP + |S_IROTH|S_IWOTH|S_IXOTH); + if(0 != ret){ + g_pse_sim_lock.unlock(); + return SGX_ERROR_UNEXPECTED; + } + }else if(EEXIST != errno){ + g_pse_sim_lock.unlock(); + return SGX_ERROR_UNEXPECTED; + } + g_pse_sim_lock.unlock(); + + ret = snprintf(path, sizeof(path), "%s%s%s%" PRIx64".dat", + p_buf, SE_DATA_FOLDER1, SE_DATA_FOLDER2, temp_value); + if(-1 == ret){ + return SGX_ERROR_UNEXPECTED; + } + FILE *fp = NULL; + fp = fopen(path, "wb"); + if(!fp){ + return SGX_ERROR_MC_NOT_FOUND; + } + size_t wt_count = 0; + wt_count = fwrite(p_vmc_sim, sizeof(vmc_sim_t), 1, fp); + if(!wt_count){ + fclose(fp); + return SGX_ERROR_UNEXPECTED; + } + fclose(fp); + return SGX_SUCCESS; +} + +sgx_status_t load_vmc_sim(vmc_sim_t *p_vmc_sim) +{ + char path[MAX_PATH] = {0}; + int ret = 0; + + uint64_t temp_value = 0; + memcpy_s(&temp_value, sizeof(temp_value), + p_vmc_sim->nonce, sizeof(temp_value)); + + char *p_buf = g_vmc_base_path; + + ret = snprintf(path, sizeof(path), "%s%s%s%" PRIx64".dat", + p_buf, SE_DATA_FOLDER1, SE_DATA_FOLDER2, temp_value); + if(-1 == ret){ + return SGX_ERROR_UNEXPECTED; + } + FILE *fp = NULL; + fp = fopen(path, "rb"); + if(!fp){ + return SGX_ERROR_MC_NOT_FOUND; + } + size_t rd_count = 0; + rd_count = fread(p_vmc_sim, sizeof(vmc_sim_t), 1, fp); + if(!rd_count){ + fclose(fp); + return SGX_ERROR_UNEXPECTED; + } + fclose(fp); + return SGX_SUCCESS; +} diff --git a/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version b/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version new file mode 100644 index 0000000000..c31c0ded9d --- /dev/null +++ b/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version @@ -0,0 +1,15 @@ +{ +global: + get_launch_token; + sgx_init_quote; + sgx_get_quote_size; + sgx_get_quote; + sgx_get_ps_cap; + sgx_report_attestation_status; + create_session_ocall; + exchange_report_ocall; + close_session_ocall; + invoke_service_ocall; +local: + *; +}; diff --git a/sdk/simulation/uae_service_sim/platform_service_sim_com.cpp b/sdk/simulation/uae_service_sim/platform_service_sim_com.cpp new file mode 100644 index 0000000000..64fdad5a10 --- /dev/null +++ b/sdk/simulation/uae_service_sim/platform_service_sim_com.cpp @@ -0,0 +1,363 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "uae_service_sim.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static const uint8_t TIME_SOURCE_NONCE_SIM[32] = { + 0x9d, 0x7c, 0x25, 0x07, 0x38, 0x53, 0x23, 0xb1, + 0x9f, 0xba, 0xc8, 0x7b, 0xc0, 0x89, 0xde, 0x2d, + 0x2b, 0x5f, 0x34, 0x6d, 0x9c, 0x35, 0xf5, 0xbc, + 0xcd, 0x34, 0x7f, 0x75, 0x96, 0xc8, 0x27, 0xcc}; + +sgx_status_t pse_mc_create_sim( + uint8_t *p_req_payload, + uint8_t *p_resp_payload) +{ + UNUSED(p_req_payload); + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + pse_mc_create_resp_t *p_create_resp + = (pse_mc_create_resp_t *)p_resp_payload; + + //initial create_resp + p_create_resp->resp_hdr.service_id = PSE_MC_SERVICE; + p_create_resp->resp_hdr.service_cmd = PSE_MC_CREATE; + p_create_resp->resp_hdr.status = PSE_ERROR_INTERNAL; + memset(p_create_resp->counter_id, 0xFF, sizeof(p_create_resp->counter_id)); + memset(p_create_resp->nonce, 0xFF, sizeof(p_create_resp->nonce)); + + vmc_sim_t temp_vmc = {{0}, {0}, 0}; + ret = get_counter_id(&temp_vmc); + if(SGX_SUCCESS != ret){ + return ret; + } + ret = store_vmc_sim(&temp_vmc); + if(SGX_SUCCESS != ret){ + return ret; + } + + p_create_resp->resp_hdr.status = PSE_SUCCESS; + if(memcpy_s(p_create_resp->counter_id, + sizeof(p_create_resp->counter_id), + temp_vmc.counter_id, + sizeof(temp_vmc.counter_id))){ + return SGX_ERROR_UNEXPECTED; + } + if(memcpy_s(p_create_resp->nonce, + sizeof(p_create_resp->nonce), + temp_vmc.nonce, + sizeof(temp_vmc.nonce))){ + return SGX_ERROR_UNEXPECTED; + } + + return ret; +} + +sgx_status_t pse_mc_read_sim( + uint8_t *p_req_payload, + uint8_t *p_resp_payload) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + pse_mc_read_req_t *p_read_req = (pse_mc_read_req_t *)p_req_payload; + pse_mc_read_resp_t *p_read_resp = (pse_mc_read_resp_t *)p_resp_payload; + + //initial create_resp + p_read_resp->counter_value = 0; + p_read_resp->resp_hdr.service_id = PSE_MC_SERVICE; + p_read_resp->resp_hdr.service_cmd = PSE_MC_READ; + p_read_resp->resp_hdr.status = PSE_ERROR_INTERNAL; + + vmc_sim_t temp_vmc = {{0}, {0}, 0}; + if(memcpy_s(&temp_vmc.counter_id, + sizeof(temp_vmc.counter_id), + p_read_req->counter_id, + sizeof(p_read_req->counter_id))){ + return SGX_ERROR_UNEXPECTED; + } + if(memcpy_s(&temp_vmc.nonce, + sizeof(temp_vmc.nonce), + p_read_req->nonce, + sizeof(p_read_req->nonce))){ + return SGX_ERROR_UNEXPECTED; + } + ret = load_vmc_sim(&temp_vmc); + if(SGX_SUCCESS != ret){ + memset(&p_read_resp->counter_value, 0xFF, + sizeof(p_read_resp->counter_value)); + return ret; + } + + p_read_resp->resp_hdr.status = PSE_SUCCESS; + if(memcpy_s(&p_read_resp->counter_value, + sizeof(p_read_resp->counter_value), + &temp_vmc.counter_value, + sizeof(temp_vmc.counter_value))){ + return SGX_ERROR_UNEXPECTED; + } + + return ret; +} + +sgx_status_t pse_mc_inc_sim( + uint8_t *p_req_payload, + uint8_t *p_resp_payload) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + pse_mc_inc_req_t *p_inc_req = (pse_mc_inc_req_t *)p_req_payload; + pse_mc_inc_resp_t *p_inc_resp = (pse_mc_inc_resp_t *)p_resp_payload; + + //initial create_resp + p_inc_resp->counter_value = 0; + p_inc_resp->resp_hdr.service_id = PSE_MC_SERVICE; + p_inc_resp->resp_hdr.service_cmd = PSE_MC_INC; + p_inc_resp->resp_hdr.status = PSE_ERROR_INTERNAL; + + vmc_sim_t temp_vmc = {{0}, {0}, 0}; + if(memcpy_s(&temp_vmc.counter_id, + sizeof(temp_vmc.counter_id), + p_inc_req->counter_id, + sizeof(p_inc_req->counter_id))){ + return SGX_ERROR_UNEXPECTED; + } + if(memcpy_s(&temp_vmc.nonce, + sizeof(temp_vmc.nonce), + p_inc_req->nonce, + sizeof(p_inc_req->nonce))){ + return SGX_ERROR_UNEXPECTED; + } + ret = load_vmc_sim(&temp_vmc); + if(SGX_SUCCESS != ret){ + return ret; + } + temp_vmc.counter_value++; + ret = store_vmc_sim(&temp_vmc); + if(SGX_SUCCESS != ret){ + return ret; + } + + p_inc_resp->resp_hdr.status = PSE_SUCCESS; + if(memcpy_s(&p_inc_resp->counter_value, + sizeof(p_inc_resp->counter_value), + &temp_vmc.counter_value, + sizeof(temp_vmc.counter_value))){ + return SGX_ERROR_UNEXPECTED; + } + + return ret; +} + +sgx_status_t pse_mc_del_sim( + uint8_t *p_req_payload, + uint8_t *p_resp_payload) +{ + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + pse_mc_del_req_t *p_del_req = (pse_mc_del_req_t *)p_req_payload; + pse_mc_del_resp_t *p_del_resp = (pse_mc_del_resp_t *)p_resp_payload; + + //initial create_resp + p_del_resp->resp_hdr.service_id = PSE_MC_SERVICE; + p_del_resp->resp_hdr.service_cmd = PSE_MC_DEL; + p_del_resp->resp_hdr.status = PSE_ERROR_INTERNAL; + + vmc_sim_t temp_vmc = {{0}, {0}, 0}; + if(memcpy_s(&temp_vmc.counter_id, + sizeof(temp_vmc.counter_id), + p_del_req->counter_id, + sizeof(p_del_req->counter_id))){ + return SGX_ERROR_UNEXPECTED; + } + if(memcpy_s(&temp_vmc.nonce, + sizeof(temp_vmc.nonce), + p_del_req->nonce, + sizeof(p_del_req->nonce))){ + return SGX_ERROR_UNEXPECTED; + } + ret = del_vmc_sim(&temp_vmc); + if(SGX_SUCCESS != ret){ + return ret; + } + + p_del_resp->resp_hdr.status = PSE_SUCCESS; + return ret; +} + +sgx_status_t pse_read_timer_sim( + uint8_t *p_req_payload, + uint8_t *p_resp_payload) +{ + UNUSED(p_req_payload); + pse_timer_read_resp_t *p_time_resp + = (pse_timer_read_resp_t *)p_resp_payload; + + time_t t = time(0); + p_time_resp->resp_hdr.service_id = PSE_TRUSTED_TIME_SERVICE; + p_time_resp->resp_hdr.service_cmd = PSE_TIMER_READ; + p_time_resp->timestamp = (uint64_t)t; + if(memcpy_s(p_time_resp->time_source_nonce, + sizeof(p_time_resp->time_source_nonce), + TIME_SOURCE_NONCE_SIM, sizeof(p_time_resp->time_source_nonce))){ + return SGX_ERROR_UNEXPECTED; + } + p_time_resp->resp_hdr.status = PSE_SUCCESS; + return SGX_SUCCESS; +} + +typedef sgx_status_t (*srv_pfn_t)(uint8_t *, uint8_t *); +static const struct service_handler_t { + uint16_t service_id; + uint16_t service_cmd; + uint16_t req_msg_size; + uint16_t resp_msg_size; + srv_pfn_t srv_pfn; +} SERVICE_HANDLER[] = { + {PSE_MC_SERVICE, PSE_MC_CREATE, sizeof(pse_mc_create_req_t), + sizeof(pse_mc_create_resp_t), pse_mc_create_sim}, + {PSE_MC_SERVICE, PSE_MC_READ, sizeof(pse_mc_read_req_t), + sizeof(pse_mc_read_resp_t), pse_mc_read_sim}, + {PSE_MC_SERVICE, PSE_MC_INC, sizeof(pse_mc_inc_req_t), + sizeof(pse_mc_inc_resp_t), pse_mc_inc_sim}, + {PSE_MC_SERVICE, PSE_MC_DEL, sizeof(pse_mc_del_req_t), + sizeof(pse_mc_del_resp_t), pse_mc_del_sim}, + {PSE_TRUSTED_TIME_SERVICE, PSE_TIMER_READ, sizeof(pse_timer_read_req_t), + sizeof(pse_timer_read_resp_t), pse_read_timer_sim} +}; + +static sgx_status_t invoke_service( + const uint8_t *p_pse_message_req, + size_t pse_message_req_size, + uint8_t *p_pse_message_resp, + size_t pse_message_resp_size, + unsigned long timeout) +{ + UNUSED(timeout); + sgx_status_t ret = SGX_SUCCESS; + if(!p_pse_message_req || !p_pse_message_resp){ + return SGX_ERROR_INVALID_PARAMETER; + } + + const pse_message_t *p_req_msg = (const pse_message_t *)p_pse_message_req; + pse_message_t *p_resp_msg = (pse_message_t *)p_pse_message_resp; + + if(pse_message_req_size != sizeof(pse_message_t) + + p_req_msg->payload_size){ + return SGX_ERROR_INVALID_PARAMETER; + } + if(pse_message_resp_size < sizeof(pse_message_t) + + p_resp_msg->exp_resp_size){ + return SGX_ERROR_INVALID_PARAMETER; + } + + const uint8_t *p_req_payload = p_req_msg->payload; + uint8_t *p_resp_payload = p_resp_msg->payload; + const pse_req_hdr_t *p_req_hdr = (const pse_req_hdr_t *)p_req_payload; + for(unsigned int i = 0; + i < sizeof(SERVICE_HANDLER) / sizeof(service_handler_t); i++) + { + if(p_req_hdr->service_id == SERVICE_HANDLER[i].service_id + && p_req_hdr->service_cmd == SERVICE_HANDLER[i].service_cmd){ + if(p_req_msg->payload_size != SERVICE_HANDLER[i].req_msg_size + || p_req_msg->exp_resp_size != SERVICE_HANDLER[i].resp_msg_size) + { + ret = SGX_ERROR_UNEXPECTED; + break; + } + + memset(p_resp_payload, 0, p_req_msg->exp_resp_size); + ret = SERVICE_HANDLER[i].srv_pfn(const_cast(p_req_payload), p_resp_payload); + + p_resp_msg->payload_size = p_req_msg->exp_resp_size; + break; + } + } + + return ret; +} + +sgx_status_t create_session_ocall(uint32_t *p_sid, uint8_t *p_dh_msg1, + uint32_t dh_msg1_size, uint32_t timeout) +{ + UNUSED(p_sid); + UNUSED(p_dh_msg1); + UNUSED(dh_msg1_size); + UNUSED(timeout); + return SGX_SUCCESS; +} + +sgx_status_t exchange_report_ocall(uint32_t sid, + const uint8_t *p_dh_msg2, + uint32_t dh_msg2_size, + uint8_t *p_dh_msg3, + uint32_t dh_msg3_size, + uint32_t timeout) +{ + UNUSED(sid); + UNUSED(p_dh_msg2); + UNUSED(dh_msg2_size); + UNUSED(p_dh_msg3); + UNUSED(dh_msg3_size); + UNUSED(timeout); + return SGX_SUCCESS; +} + +sgx_status_t close_session_ocall(uint32_t sid, uint32_t timeout) +{ + UNUSED(sid); + UNUSED(timeout); + return SGX_SUCCESS; +} + +sgx_status_t invoke_service_ocall( + const uint8_t* pse_message_req, uint32_t pse_message_req_size, + uint8_t* pse_message_resp, uint32_t pse_message_resp_size, + uint32_t timeout + ) +{ + return invoke_service(pse_message_req, pse_message_req_size, + pse_message_resp, pse_message_resp_size, timeout); +} + +sgx_status_t sgx_get_ps_cap( + sgx_ps_cap_t* p_sgx_ps_cap) +{ + if (!p_sgx_ps_cap) + return SGX_ERROR_INVALID_PARAMETER; + + p_sgx_ps_cap->ps_cap0 = 0x7; + p_sgx_ps_cap->ps_cap1 = 0; + return SGX_SUCCESS; +} + +#ifdef __cplusplus +} +#endif diff --git a/sdk/simulation/uae_service_sim/quoting_sim.cpp b/sdk/simulation/uae_service_sim/quoting_sim.cpp new file mode 100644 index 0000000000..0a918fefb9 --- /dev/null +++ b/sdk/simulation/uae_service_sim/quoting_sim.cpp @@ -0,0 +1,462 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "uae_service_sim.h" +#include "epid_types.h" +#include "se_sig_rl.h" +#include "se_quote_internal.h" +#include "ippcp.h" +#include "deriv.h" +#include "cpusvn_util.h" + +/* The EPID group certificate */ +static const uint8_t EPID_GROUP_CERT[] = { + 0x00, 0x00, 0x00, 0x0B, 0xB3, 0x6F, 0xFF, 0x81, 0xE2, 0x1B, 0x17, 0xEB, + 0x3D, 0x75, 0x3D, 0x61, 0x7E, 0x27, 0xB0, 0xCB, 0xD0, 0x6D, 0x8F, 0x9D, + 0x64, 0xCE, 0xE3, 0xCE, 0x43, 0x4C, 0x62, 0xFD, 0xB5, 0x80, 0xE0, 0x99, + 0x3A, 0x07, 0x56, 0x80, 0xE0, 0x88, 0x59, 0xA4, 0xFD, 0xB5, 0xB7, 0x9D, + 0xE9, 0x4D, 0xAE, 0x9C, 0xEE, 0x3D, 0x66, 0x42, 0x82, 0x45, 0x7E, 0x7F, + 0xD8, 0x69, 0x3E, 0xA1, 0x74, 0xF4, 0x59, 0xEE, 0xD2, 0x74, 0x2E, 0x9F, + 0x63, 0xC2, 0x51, 0x8E, 0xD5, 0xDB, 0xCA, 0x1C, 0x54, 0x74, 0x10, 0x7B, + 0xDC, 0x99, 0xED, 0x42, 0xD5, 0x5B, 0xA7, 0x04, 0x29, 0x66, 0x61, 0x63, + 0xBC, 0xDD, 0x7F, 0xE1, 0x76, 0x5D, 0xC0, 0x6E, 0xE3, 0x14, 0xAC, 0x72, + 0x48, 0x12, 0x0A, 0xA6, 0xE8, 0x5B, 0x08, 0x7B, 0xDA, 0x3F, 0x51, 0x7D, + 0xDE, 0x4C, 0xEA, 0xCB, 0x93, 0xA5, 0x6E, 0xCC, 0xE7, 0x8E, 0x10, 0x84, + 0xBD, 0x19, 0x5A, 0x95, 0xE2, 0x0F, 0xCA, 0x1C, 0x50, 0x71, 0x94, 0x51, + 0x40, 0x1B, 0xA5, 0xB6, 0x78, 0x87, 0x53, 0xF6, 0x6A, 0x95, 0xCA, 0xC6, + 0x8D, 0xCD, 0x36, 0x88, 0x07, 0x28, 0xE8, 0x96, 0xCA, 0x78, 0x11, 0x5B, + 0xB8, 0x6A, 0xE7, 0xE5, 0xA6, 0x65, 0x7A, 0x68, 0x15, 0xD7, 0x75, 0xF8, + 0x24, 0x14, 0xCF, 0xD1, 0x0F, 0x6C, 0x56, 0xF5, 0x22, 0xD9, 0xFD, 0xE0, + 0xE2, 0xF4, 0xB3, 0xA1, 0x90, 0x21, 0xA7, 0xE0, 0xE8, 0xB3, 0xC7, 0x25, + 0xBC, 0x07, 0x72, 0x30, 0x5D, 0xEE, 0xF5, 0x6A, 0x89, 0x88, 0x46, 0xDD, + 0x89, 0xC2, 0x39, 0x9C, 0x0A, 0x3B, 0x58, 0x96, 0x57, 0xE4, 0xF3, 0x3C, + 0x79, 0x51, 0x69, 0x36, 0x1B, 0xB6, 0xF7, 0x05, 0x5D, 0x0A, 0x88, 0xDB, + 0x1F, 0x3D, 0xEA, 0xA2, 0xBA, 0x6B, 0xF0, 0xDA, 0x8E, 0x25, 0xC6, 0xAD, + 0x83, 0x7D, 0x3E, 0x31, 0xEE, 0x11, 0x40, 0xA9 +}; + +/* The report key is the same as BASE_REPORT_KEY in + /trunk/sdk/simulation/tinst/deriv.cpp, which is used in simulation + create_report and verify_report. deriv.cpp is used inside enclave. + So only import this structure. */ +static const uint8_t BASE_REPORT_KEY[] = { + 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, +}; +// The hard-coded OwnerEpoch. +static const se_owner_epoch_t SIMU_OWNER_EPOCH_MSR = { + 0x54, 0x48, 0x49, 0x53, 0x49, 0x53, 0x4f, 0x57, + 0x4e, 0x45, 0x52, 0x45, 0x50, 0x4f, 0x43, 0x48, +}; + +//simulated QE ISVSVN +static const sgx_isv_svn_t QE_ISVSVN = 1; + +#if !defined(ntohl) +#define ntohl(u32) \ + ((uint32_t)(((((unsigned char*)&(u32))[0]) << 24) \ + + ((((unsigned char*)&(u32))[1]) << 16) \ + + ((((unsigned char*)&(u32))[2]) << 8) \ + + (((unsigned char*)&(u32))[3]))) +#endif + + +sgx_status_t sgx_init_quote( + sgx_target_info_t *p_target_info, + sgx_epid_group_id_t *p_gid) +{ + if(!p_target_info || !p_gid){ + return SGX_ERROR_INVALID_PARAMETER; + } + + p_target_info->attributes.flags = SGX_FLAGS_INITTED; + p_target_info->attributes.xfrm = SGX_XFRM_LEGACY; + memset(&(p_target_info->mr_enclave), 0xEE, sizeof(sgx_measurement_t)); + + //Make sure the size of prebuilt data are the same with target buffer. + static_assert(sizeof(EPID_GROUP_CERT) == sizeof(GroupPubKey), + "Group cert size changed!"); + + //Copy hard coded gid into output buffer. + GroupPubKey *p_epid_group_cert = (GroupPubKey *)const_cast(EPID_GROUP_CERT); + + ((uint8_t *)p_gid)[0] = p_epid_group_cert->gid.data[3]; + ((uint8_t *)p_gid)[1] = p_epid_group_cert->gid.data[2]; + ((uint8_t *)p_gid)[2] = p_epid_group_cert->gid.data[1]; + ((uint8_t *)p_gid)[3] = p_epid_group_cert->gid.data[0]; + + return SGX_SUCCESS; +} + +static sgx_status_t create_qe_report(const sgx_report_t *p_report, + const sgx_quote_nonce_t* p_quote_nonce, + const uint8_t* p_quote, + uint32_t quote_size, + const sgx_cpu_svn_t* cpusvn, + sgx_report_t *p_qe_report) +{ + sgx_report_t temp_qe_report; + // assemble REPORT + memset(&temp_qe_report, 0, sizeof(sgx_report_t)); + //QE_REPORT.BODY.CPUSVN = CPUSVN + if(memcpy_s(&temp_qe_report.body.cpu_svn, + sizeof(temp_qe_report.body.cpu_svn), + cpusvn, sizeof(sgx_cpu_svn_t))) + return SGX_ERROR_UNEXPECTED; + //ProdID same as QE + temp_qe_report.body.isv_prod_id = 1; + //set ISVSVN + temp_qe_report.body.isv_svn = QE_ISVSVN; + //QE_REPORT.BODY.ATTRIBUTES = 0x30000000000000001 + temp_qe_report.body.attributes.flags = SGX_FLAGS_INITTED; + temp_qe_report.body.attributes.xfrm = SGX_XFRM_LEGACY; + //QE_REPORT.BODY.MRENCLAVE = 64 0xEE bytes + memset(&temp_qe_report.body.mr_enclave, 0xEE, sizeof(sgx_measurement_t)); + //QE_REPORT.BODY.MRSIGNER = random value + if(SGX_SUCCESS != sgx_read_rand((uint8_t *)(&temp_qe_report.body.mr_signer), + sizeof(sgx_measurement_t))) + return SGX_ERROR_UNEXPECTED; + //QE_REPORT.KEYID = + if(SGX_SUCCESS != sgx_read_rand((unsigned char *)&temp_qe_report.key_id, + sizeof(sgx_key_id_t))) + return SGX_ERROR_UNEXPECTED; + + //QE_REPORT.BODY.REPORTDATA = SHA256(NONCE || QUOTE) + int sha256_size = 0; + IppsHashState *p_sha_state = NULL; + sgx_status_t sgx_ret = SGX_ERROR_UNEXPECTED; + IppsAES_CMACState* p_cmac_state = NULL; + int ippStateSize = 0; + IppStatus ipp_ret = ippStsNoErr; + + //prepare reprot_data + do + { + IppStatus ret; + ret = ippsHashGetSize(&sha256_size); + if(ret)break; + // p_sha_state need to be freed when exit. + p_sha_state = (IppsHashState *)malloc(sha256_size); + if(!p_sha_state) + { + sgx_ret = SGX_ERROR_OUT_OF_MEMORY; + break; + } + ret = ippsHashInit(p_sha_state, IPP_ALG_HASH_SHA256); + if(ret)break; + ret = ippsHashUpdate((uint8_t *)const_cast(p_quote_nonce), + sizeof(sgx_quote_nonce_t), + p_sha_state); + if(ret)break; + + ret = ippsHashUpdate(p_quote, + quote_size, + p_sha_state); + if(ret)break; + + //sha256 final, QE_REPORT.BODY.REPORTDATA = SHA256(NONCE || QUOTE) + ret = ippsHashFinal((uint8_t*)&temp_qe_report.body.report_data, + p_sha_state); + if(ret)break; + + /* calculate CMAC using the report key, same as BASE_REPORT_KEY in + sdk/simulation/tinst/deriv.cpp */ + derivation_data_t dd; + memset(&dd, 0, sizeof(dd)); + dd.size = sizeof(dd_report_key_t); + + dd.key_name = SGX_KEYSELECT_REPORT; + if(memcpy_s(&dd.ddrk.mrenclave,sizeof(dd.ddrk.mrenclave), + &p_report->body.mr_enclave, sizeof(sgx_measurement_t))) + break; + if(memcpy_s(&dd.ddrk.attributes, sizeof(dd.ddrk.attributes), + &p_report->body.attributes, sizeof(sgx_attributes_t))) + break; + if(memcpy_s(&dd.ddrk.csr_owner_epoch, sizeof(dd.ddrk.csr_owner_epoch), + SIMU_OWNER_EPOCH_MSR, sizeof(se_owner_epoch_t))) + break; + if(memcpy_s(&dd.ddrk.cpu_svn, sizeof(dd.ddrk.cpu_svn), + cpusvn, sizeof(sgx_cpu_svn_t))) + break; + if(memcpy_s(&dd.ddrk.key_id, sizeof(dd.ddrk.key_id), + &temp_qe_report.key_id, sizeof(sgx_key_id_t))) + break; + + ipp_ret = ippsAES_CMACGetSize(&ippStateSize); + if(ipp_ret != ippStsNoErr)break; + + p_cmac_state = (IppsAES_CMACState*)malloc(ippStateSize); + if(p_cmac_state == NULL) + { + sgx_ret = SGX_ERROR_OUT_OF_MEMORY; + break; + } + + // calculate the derived key + ipp_ret = ippsAES_CMACInit((const Ipp8u *)BASE_REPORT_KEY, 16, + p_cmac_state, ippStateSize); + if(ipp_ret != ippStsNoErr) + { + if(ipp_ret == ippStsMemAllocErr) + { + sgx_ret = SGX_ERROR_OUT_OF_MEMORY; + break; + } + else + { + sgx_ret = SGX_ERROR_UNEXPECTED; + break; + } + } + + ipp_ret = ippsAES_CMACUpdate((const Ipp8u *)dd.ddbuf, + dd.size, p_cmac_state); + if(ipp_ret != ippStsNoErr)break; + + sgx_key_128bit_t tmp_report_key; + memset(tmp_report_key, 0, sizeof(tmp_report_key)); + ipp_ret = ippsAES_CMACFinal((Ipp8u *)&tmp_report_key, + sizeof(tmp_report_key), p_cmac_state); + if(ipp_ret != ippStsNoErr)break; + + // call cryptographic CMAC function + // CMAC data are *NOT* including MAC and KEYID + ipp_ret = ippsAES_CMACInit((const Ipp8u *)tmp_report_key, 16, + p_cmac_state, ippStateSize); + if(ipp_ret != ippStsNoErr) + { + if(ipp_ret == ippStsMemAllocErr) + { + sgx_ret = SGX_ERROR_OUT_OF_MEMORY; + break; + } + else + { + sgx_ret = SGX_ERROR_UNEXPECTED; + break; + } + } + + ipp_ret = ippsAES_CMACUpdate((const Ipp8u *)&temp_qe_report.body, + sizeof(temp_qe_report.body), + p_cmac_state); + if(ipp_ret != ippStsNoErr)break; + + ipp_ret = ippsAES_CMACFinal((Ipp8u *)&temp_qe_report.mac, + sizeof(temp_qe_report.mac), p_cmac_state); + if(ipp_ret != ippStsNoErr)break; + + if(memcpy_s(p_qe_report, sizeof(*p_qe_report), + &temp_qe_report, sizeof(temp_qe_report))) + break; + sgx_ret = SGX_SUCCESS; + }while(0); + if (p_cmac_state) + free(p_cmac_state); + if(p_sha_state) + free(p_sha_state); + return sgx_ret; +} + + +/* +* For quote with SIG-RL +* |--------------------------------------------------------------------| +* |sgx_quote_t|wrap_key_t|iv|payload_size|basic_sig|rl_ver|n2|nrp..|mac| +* |--------------------------------------------------------------------| +* For quote without SIG-RL +* |--------------------------------------------------------------| +* |sgx_quote_t|wrap_key_t|iv|payload_size|basic_sig|rl_ver|n2|mac| +* |--------------------------------------------------------------| +*/ +sgx_status_t sgx_get_quote( + const sgx_report_t *p_report, + sgx_quote_sign_type_t quote_type, + const sgx_spid_t *p_spid, + const sgx_quote_nonce_t *p_nonce, + const uint8_t *p_sig_rl, + uint32_t sig_rl_size, + sgx_report_t *p_qe_report, + sgx_quote_t *p_quote, + uint32_t quote_size) +{ + sgx_status_t ret = SGX_SUCCESS; + GroupPubKey *p_epid_group_cert = (GroupPubKey *)const_cast(EPID_GROUP_CERT); + unsigned int rl_entry_count = 0; + sgx_basename_t basename = {{0}}; + uint64_t required_buffer_size = 0; + se_encrypted_sign_t *p_signature = NULL; + sgx_cpu_svn_t cpusvn = {{0}}; + uint8_t *p_mac = NULL; + + + if(!p_report || !p_spid || !p_quote || !quote_size) + return SGX_ERROR_INVALID_PARAMETER; + if(!p_nonce && p_qe_report) + return SGX_ERROR_INVALID_PARAMETER; + if(p_nonce && !p_qe_report) + return SGX_ERROR_INVALID_PARAMETER; + if(p_sig_rl && sig_rl_size < sizeof(se_sig_rl_t)) + return SGX_ERROR_INVALID_PARAMETER; + if(!p_sig_rl && sig_rl_size) + return SGX_ERROR_INVALID_PARAMETER; + if(quote_type != SGX_UNLINKABLE_SIGNATURE + && quote_type != SGX_LINKABLE_SIGNATURE) + return SGX_ERROR_INVALID_PARAMETER; + + if(p_sig_rl){ + //Check the size of SIG-RL. + se_sig_rl_t *p_sig_rl_temp = (se_sig_rl_t *)const_cast(p_sig_rl); + uint64_t required_sig_rl_size = se_get_sig_rl_size(p_sig_rl_temp); + rl_entry_count = ntohl(p_sig_rl_temp->sig_rl.n2); + if(required_sig_rl_size > sig_rl_size) + { + ret = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + } + + se_static_assert(sizeof(basename) > sizeof(sgx_spid_t)); + /* Because basename has already been zerod, + so we don't need to concatenating with 0s.*/ + if(memcpy_s(&basename, sizeof(basename), p_spid, sizeof(sgx_spid_t))) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + if(SGX_UNLINKABLE_SIGNATURE == quote_type) + { + uint8_t *p = (uint8_t *)&basename + sizeof(sgx_spid_t); + if(SGX_SUCCESS != sgx_read_rand(p, + sizeof(basename) - sizeof(sgx_spid_t))) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + } + + /* sign_size returned from epidMember_signMessage including the RLver + and n2. */ + required_buffer_size = sizeof(sgx_quote_t) + + sizeof(se_wrap_key_t) + + 12 // size of payload_iv + + 4 // size of payload_size + + sizeof(BasicSignature) + + sizeof(RLver_t) + + sizeof(RLCount) + + 16; // size of payload_mac + if(p_sig_rl){ + required_buffer_size += (sizeof(NRProof) * rl_entry_count); + } + + /* If the p_quote is not NULL, then we should make sure the buffer size is + * correct. */ + if(quote_size < required_buffer_size){ + ret = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + + if(SGX_SUCCESS != get_cpusvn(&cpusvn)) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + if(memcmp(&cpusvn, &((const sgx_report_t *)p_report)->body.cpu_svn, + sizeof(sgx_cpu_svn_t))) + { + ret = SGX_ERROR_INVALID_PARAMETER; + goto CLEANUP; + } + + /* Copy the data in the report into quote body. */ + memset(p_quote, 0xEE, quote_size); + p_quote->version = 1; + p_quote->sign_type = (uint16_t)quote_type; + + p_quote->epid_group_id[0] = p_epid_group_cert->gid.data[3]; + p_quote->epid_group_id[1] = p_epid_group_cert->gid.data[2]; + p_quote->epid_group_id[2] = p_epid_group_cert->gid.data[1]; + p_quote->epid_group_id[3] = p_epid_group_cert->gid.data[0]; + + p_quote->qe_svn = QE_ISVSVN; + if(memcpy_s(&p_quote->basename, sizeof(sgx_basename_t), + &basename, sizeof(basename))){ + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + if(memcpy_s(&p_quote->report_body, sizeof(p_quote->report_body), + &((const sgx_report_t *)p_report)->body, sizeof(sgx_report_body_t))) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + p_quote->signature_len = (uint32_t)(required_buffer_size - sizeof(sgx_quote_t)); + + // Set the payload_size + p_signature = (se_encrypted_sign_t *)(p_quote->signature); + p_signature->payload_size = (uint32_t)(sizeof(BasicSignature) + + sizeof(RLver_t) + + sizeof(RLCount) + + (sizeof(NRProof) * rl_entry_count)); + + if(SGX_SUCCESS != sgx_read_rand(p_signature->iv, sizeof(p_signature->iv))) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + p_mac = (uint8_t *)(&p_signature->basic_sign) + p_signature->payload_size; + if(SGX_SUCCESS != sgx_read_rand(p_mac, 16)) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + + if(p_qe_report) + ret = create_qe_report(p_report, p_nonce, (uint8_t*)p_quote, + quote_size, &cpusvn, p_qe_report); + +CLEANUP: + return ret; +} //sgx_get_quote + +sgx_status_t SGXAPI sgx_report_attestation_status( + const sgx_platform_info_t *p_platform_info, + int attestation_status, + sgx_update_info_bit_t *p_update_info) +{ + UNUSED(p_platform_info); + UNUSED(attestation_status); + memset(p_update_info, 0, sizeof(sgx_update_info_bit_t)); + return SGX_SUCCESS; +} + diff --git a/sdk/simulation/uae_service_sim/uae_service_deploy.c b/sdk/simulation/uae_service_sim/uae_service_deploy.c new file mode 100644 index 0000000000..ddb7b05e54 --- /dev/null +++ b/sdk/simulation/uae_service_sim/uae_service_deploy.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +void Java_com_voidel_security_sgx_uae_SGX_1AEServices_initializeNativeAEServices(){} +void sgx_get_quote(){} +void sgx_get_quote_size(){} +void sgx_init_quote(){} +void get_launch_token(){} +void close_session_ocall(){} +void create_session_ocall(){} +void exchange_report_ocall(){} +void invoke_service_ocall(){} +void sgx_report_remote_attestation_failure(){} +void sgx_get_ps_cap(){} diff --git a/sdk/simulation/uae_service_sim/uae_service_sim.h b/sdk/simulation/uae_service_sim/uae_service_sim.h new file mode 100644 index 0000000000..a85827eaf6 --- /dev/null +++ b/sdk/simulation/uae_service_sim/uae_service_sim.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef UAE_SERVICE_SIM_H +#define UAE_SERVICE_SIM_H + +#include +#include +#include +#include + +#include "arch.h" +#include "sgx_uae_service.h" +#include "uae_service_internal.h" +#include "pse_types.h" +#include "sgx_tseal.h" +#include "util.h" +#include "se_memcpy.h" +#include "sgx_dh.h" +#include "sgx_read_rand.h" +#include "se_lock.hpp" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _vmc_sim_t { + uint8_t counter_id[3]; + uint8_t nonce[13]; + uint32_t counter_value; +} vmc_sim_t; + +sgx_status_t get_counter_id(vmc_sim_t *p_vmc_sim); +sgx_status_t del_vmc_sim(const vmc_sim_t *p_vmc_sim); + +sgx_status_t store_vmc_sim(const vmc_sim_t *p_vmc_sim); + +sgx_status_t load_vmc_sim(vmc_sim_t *p_vmc_sim); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/sdk/simulation/uinst/Makefile b/sdk/simulation/uinst/Makefile new file mode 100644 index 0000000000..77b45f4b2f --- /dev/null +++ b/sdk/simulation/uinst/Makefile @@ -0,0 +1,77 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +SIM_DIR := $(CUR_DIR)/.. + +ifndef DEBUG +CXXFLAGS += -DDISABLE_TRACE +CFLAGS += -DDISABLE_TRACE +endif + +CPPFLAGS += $(ADDED_INC) +CPPFLAGS += -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal \ + -I$(SIM_DIR)/assembly/ \ + -I$(SIM_DIR)/assembly/linux \ + -I$(LINUX_PSW_DIR)/urts \ + -I$(LINUX_EXTERNAL_DIR)/crypto_px/include + +CXXFLAGS += -Werror -fPIC + +OBJ1 := linux/set_tls.o \ + linux/restore_tls.o + +LIBSESIMU_U := libsesimu_u.a + +.PHONY:all +all: $(LIBSESIMU_U) + +enclave_mngr.o: enclave_mngr.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +# Explicitly disable optimization for 'u_instructions.cpp', +# since the '_SE3' function has assumptions on stack layout. +# +u_instructions.o: u_instructions.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -O0 -c $< -o $@ + +$(LIBSESIMU_U): u_instructions.o enclave_mngr.o $(OBJ1) + $(AR) rcs $@ $^ + +$(OBJ1): + $(MAKE) -C linux + +.PHONY: clean +clean: + $(MAKE) -C linux clean + @$(RM) *.o *.a *.so diff --git a/sdk/simulation/uinst/enclave_mngr.cpp b/sdk/simulation/uinst/enclave_mngr.cpp new file mode 100644 index 0000000000..c41ea62d5c --- /dev/null +++ b/sdk/simulation/uinst/enclave_mngr.cpp @@ -0,0 +1,253 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "se_memory.h" +#include "se_memcpy.h" +#include "util.h" +#include "enclave_mngr.h" +#include "se_atomic.h" + + +static uint32_t atomic_inc32(uint32_t volatile *val) +{ + return se_atomic_inc(val); +} + +uint32_t CEnclaveSim::m_counter = 1; + +sgx_enclave_id_t CEnclaveSim::gen_enclave_id(void) +{ + //getpid() is to simulate fork() scenario, refer to do_ecall in sig_handler.cpp + sgx_enclave_id_t id = ((uint64_t)getpid() << 32) | atomic_inc32(&m_counter); + return id; +} + +CEnclaveSim::CEnclaveSim(const secs_t* secs) +{ + m_cpages = static_cast(secs->size >> SE_PAGE_SHIFT); + m_flags = new si_flags_t[m_cpages]; + + // pages flags are initialized to -1 + memset(m_flags, 0xff, m_cpages * sizeof(si_flags_t)); + + memcpy_s(&m_secs, sizeof(m_secs), secs, sizeof(*secs)); + + m_enclave_id = gen_enclave_id(); +} + +CEnclaveSim::~CEnclaveSim() +{ + delete[] m_flags; + se_virtual_free(m_secs.base, (size_t)m_secs.size, MEM_RELEASE); +} + +sgx_enclave_id_t CEnclaveSim::get_enclave_id() const +{ + return m_enclave_id; +} + +secs_t* CEnclaveSim::get_secs() +{ + return &m_secs; +} + +size_t CEnclaveSim::get_pg_idx(const void* pgaddr) const +{ + return PTR_DIFF(pgaddr, m_secs.base) >> SE_PAGE_SHIFT; +} + + +bool CEnclaveSim::validate_pg_and_flags(const void* addr, si_flags_t flags) +{ + // Must be page aligned + if (!IS_PAGE_ALIGNED(addr)) + return false; + + size_t page_idx = get_pg_idx(addr); + // Must be within enclave address space + + if (page_idx >= m_cpages) + return false; + + // Requested flags should only set those visible by instuctions + if ((flags & (~SI_FLAGS_EXTERNAL))) + return false; + + return true; +} + + +bool CEnclaveSim::add_page(const void* addr, si_flags_t flags) +{ + if (!validate_pg_and_flags(addr, flags)) + return false; + + // We only deal with these flags + flags &= static_cast(SI_FLAGS_EXTERNAL); + + // Must not have been added yet + size_t page_idx = get_pg_idx(addr); + + if (m_flags[page_idx] != (si_flags_t)-1) + return false; + + m_flags[page_idx] = flags; + + return true; +} + +bool CEnclaveSim::remove_page(const void* epc_lin_addr) +{ + size_t page_idx = get_pg_idx(epc_lin_addr); + + if (m_flags[page_idx] != (si_flags_t)-1) { + m_flags[page_idx] = (si_flags_t)-1; + return true; + } + + return false; +} +bool CEnclaveSim::is_tcs_page(const void* addr) const +{ + // Must be page aligned + if (!IS_PAGE_ALIGNED(addr)) + return false; + + size_t page_idx = get_pg_idx(addr); + + // Must be within enclave address space + if (page_idx >= m_cpages) + return false; + + return (m_flags[page_idx] & SI_FLAG_PT_MASK) == SI_FLAG_TCS; +} + + +////////////////////////////////////////////////////////////////////// +CEnclaveMngr::CEnclaveMngr() +{ + se_mutex_init(&m_list_lock); +} + +CEnclaveMngr::~CEnclaveMngr() +{ + se_mutex_destroy(&m_list_lock); + + std::list::iterator it = m_enclave_list.begin(); + for (; it != m_enclave_list.end(); ++it) + { + delete (*it); + } +} + +// Note: this singleton implemenation is not multi-threading safe. +CEnclaveMngr* CEnclaveMngr::get_instance() +{ + static CEnclaveMngr mngr; + return &mngr; +} + +// Use constructor attribute to make sure that the later calling of +// CEnclaveMngr::get_instance() is MT-safe. +__attribute__ ((__constructor__)) static void build_mngr_instance() +{ + CEnclaveMngr::get_instance(); +} + +void CEnclaveMngr::add(CEnclaveSim* ce) +{ + if (ce != NULL) + { + se_mutex_lock(&m_list_lock); + m_enclave_list.push_back(ce); + se_mutex_unlock(&m_list_lock); + } +} + +void CEnclaveMngr::remove(CEnclaveSim* ce) +{ + if (ce != NULL) + { + se_mutex_lock(&m_list_lock); + m_enclave_list.remove(ce); + se_mutex_unlock(&m_list_lock); + } +} + +CEnclaveSim* CEnclaveMngr::get_enclave(const sgx_enclave_id_t id) +{ + CEnclaveSim* ce = NULL; + + se_mutex_lock(&m_list_lock); + + std::list::iterator it = m_enclave_list.begin(); + for (; it != m_enclave_list.end(); ++it) + { + if ((*it)->get_enclave_id() == id) + { + ce = *it; + break; + } + } + + se_mutex_unlock(&m_list_lock); + return ce; +} + +CEnclaveSim* CEnclaveMngr::get_enclave(const void* base_addr) +{ + CEnclaveSim* ce = NULL; + + se_mutex_lock(&m_list_lock); + + std::list::iterator it = m_enclave_list.begin(); + for (; it != m_enclave_list.end(); ++it) + { + secs_t* secs = (*it)->get_secs(); + if (base_addr >= secs->base && + PTR_DIFF(base_addr, secs->base) < secs->size) + { + ce = *it; + break; + } + } + + se_mutex_unlock(&m_list_lock); + return ce; +} + +CEnclaveSim* CEnclaveMngr::get_enclave(const secs_t* secs) +{ + // The pEnclaveSECS field might not have been initialized yet. + return get_enclave(secs->base); +} diff --git a/sdk/simulation/uinst/enclave_mngr.h b/sdk/simulation/uinst/enclave_mngr.h new file mode 100644 index 0000000000..2e7cde5114 --- /dev/null +++ b/sdk/simulation/uinst/enclave_mngr.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SE_ENCLAVE_MNGR_H_ +#define _SE_ENCLAVE_MNGR_H_ + +#include + +#include "arch.h" +#include "sgx_eid.h" +#include "se_thread.h" + +class CEnclaveSim +{ +public: + CEnclaveSim(const secs_t* secs); + virtual ~CEnclaveSim(void); + + // The following functions are declared virtual so that they can + // be called from the tRTS instruction simulation functions. + + virtual sgx_enclave_id_t get_enclave_id() const; + virtual secs_t* get_secs(); + + virtual size_t get_pg_idx(const void* pgaddr) const; + virtual bool add_page(const void* pgaddr, si_flags_t flags); + virtual bool remove_page(const void* epc_lin_addr); + virtual bool is_tcs_page(const void* pgaddr) const; + +private: + secs_t m_secs; + si_flags_t* m_flags; // memory managed by CEnclaveSim + size_t m_cpages; // page count + + sgx_enclave_id_t m_enclave_id; // an unique Id for the enclave + static uint32_t m_counter; // enclave counter + + sgx_enclave_id_t gen_enclave_id(void); + bool validate_pg_and_flags(const void* pgaddr, si_flags_t flags); + + CEnclaveSim(const CEnclaveSim& es); + CEnclaveSim& operator=(const CEnclaveSim& es); +}; + + +class CEnclaveMngr +{ +public: + + // The factory method for CEnclaveMngr. + // + // Note: this factory is not thread-safe. + + static CEnclaveMngr* get_instance(); + ~CEnclaveMngr(); + + void add(CEnclaveSim* ce); + void remove(CEnclaveSim* ce); + + CEnclaveSim* get_enclave(const sgx_enclave_id_t id); + CEnclaveSim* get_enclave(const secs_t* secs); + CEnclaveSim* get_enclave(const void* base_addr); + +private: + std::list m_enclave_list; + + // to protect the access to m_enclave_list + se_mutex_t m_list_lock; + + CEnclaveMngr(); + CEnclaveMngr(const CEnclaveMngr& em); + CEnclaveMngr& operator=(const CEnclaveMngr& em); +}; + +#endif diff --git a/sdk/simulation/uinst/linux/Makefile b/sdk/simulation/uinst/linux/Makefile new file mode 100644 index 0000000000..6e5eaa9b79 --- /dev/null +++ b/sdk/simulation/uinst/linux/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +SIM_DIR := $(CUR_DIR)/../.. + +ifndef DEBUG +CXXFLAGS += -DDISABLE_TRACE +CFLAGS += -DDISABLE_TRACE +endif + +CFLAGS += -Werror -fPIC + +CPPFLAGS += $(ADDED_INC) # for ubuntu 11 and later version +CPPFLAGS += -I.. \ + -I$(SIM_DIR)/assembly \ + -I$(SIM_DIR)/assembly/linux \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal + +SOURCE := $(wildcard *.c) +OBJECT := $(SOURCE:.c=.o) + +.PHONY: all +all: $(OBJECT) + +.PHONY: clean +clean: + @$(RM) *.o *~ diff --git a/sdk/simulation/uinst/linux/get_tcs.c b/sdk/simulation/uinst/linux/get_tcs.c new file mode 100644 index 0000000000..3b85097c00 --- /dev/null +++ b/sdk/simulation/uinst/linux/get_tcs.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "td_mngr.h" + +/* + * Get the TD address - this function needs to be called + * when the DTV value has not been restored yet. + */ +void* get_td_addr(void) +{ + dtv_t* dtv = GET_DTV(); + return read_dtv_val(dtv); +} + +/* vim: set ts=4 sw=4 cin et: */ + diff --git a/sdk/simulation/uinst/linux/restore_tls.c b/sdk/simulation/uinst/linux/restore_tls.c new file mode 100644 index 0000000000..329682ffd0 --- /dev/null +++ b/sdk/simulation/uinst/linux/restore_tls.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * restore_tls.c + * Implemente the TLS support in simulation mode + */ + +#include "td_mngr.h" + +/* + * Restore the old DTV value. + */ +int td_mngr_restore_td(tcs_t *tcs) +{ + dtv_t* dtv __attribute__((unused)); + tcs_sim_t *tcs_sim; + + if (!tcs) + return 0; + + dtv = GET_DTV(); + tcs_sim = (tcs_sim_t *)tcs->reserved; + set_dtv_val(dtv, tcs_sim->saved_dtv); + SET_FS_GS_0(tcs_sim->saved_fs_gs_0); + return 1; +} + +/* vim: set ts=4 sw=4 cin et: */ diff --git a/sdk/simulation/uinst/linux/set_tls.c b/sdk/simulation/uinst/linux/set_tls.c new file mode 100644 index 0000000000..3bd5134ccd --- /dev/null +++ b/sdk/simulation/uinst/linux/set_tls.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * set_tls.c + * Implemente the TLS support in simulation mode + */ + +#include "td_mngr.h" +#include "util.h" + +int td_mngr_set_td(void *enclave_base, tcs_t *tcs) +{ + dtv_t* dtv; + tcs_sim_t *tcs_sim; + + if (!tcs) + return 0; + + /* save the old DTV[0].pointer->val */ + dtv = GET_DTV(); + tcs_sim = (tcs_sim_t *)tcs->reserved; + tcs_sim->saved_dtv = (uintptr_t)read_dtv_val(dtv); + + /* save the old fs:0x0 or gs:0x0 value */ + tcs_sim->saved_fs_gs_0 = GET_FS_GS_0(); + + /* set the DTV[0].pointer->val to TLS address */ + uintptr_t *tib = GET_PTR(uintptr_t, enclave_base, tcs->ofs_base); + set_dtv_val(dtv, tib); + + /* set the fs:0x0 or gs:0x0 to TLS address */ + SET_FS_GS_0(tib); + return 1; +} + +/* vim: set ts=4 sw=4 cin et: */ diff --git a/sdk/simulation/uinst/td_mngr.h b/sdk/simulation/uinst/td_mngr.h new file mode 100644 index 0000000000..336023df8e --- /dev/null +++ b/sdk/simulation/uinst/td_mngr.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _TD_MNGR_H_ +#define _TD_MNGR_H_ + +#include "arch.h" +#include "rts.h" + +// use tcs->reserved field to save some information +typedef struct _tcs_sim_t +{ + uintptr_t saved_aep; + size_t tcs_state; + uintptr_t saved_dtv; + uintptr_t saved_fs_gs_0; +} tcs_sim_t; + +#define TCS_STATE_INACTIVE 0 //The TCS is available for a normal EENTER +#define TCS_STATE_ACTIVE 1 //A Processor is currently executing in the context of this TCS + +// The 1st parameter of enter_enclave function (enclave_enclave.S) is tcs. +// If the parameter is changed, or EENTER_PROLOG is changed, the macro should be updated accordingly. +#ifdef SE_GNU64 +#define GET_TCS_PTR(xbp) (tcs_t *)(*(uintptr_t *)((size_t)(xbp) - 10 * sizeof(uintptr_t))) +#else +#define GET_TCS_PTR(xbp) (tcs_t *)(*(uintptr_t *)((size_t)(xbp) + 2 * sizeof(uintptr_t))) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +//Add the implementation to get the _tls_array pointer in GNU here. +#include "gnu_tls.h" +extern uint8_t __ImageBase; +int td_mngr_set_td(void *enclave_base, tcs_t *tcs); +int td_mngr_restore_td(tcs_t *tcs); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/uinst/u_instructions.cpp b/sdk/simulation/uinst/u_instructions.cpp new file mode 100644 index 0000000000..c7a438af6d --- /dev/null +++ b/sdk/simulation/uinst/u_instructions.cpp @@ -0,0 +1,320 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// u_instructions.cpp -- It simulates Enclave instructions. +#include +#include + +#include +#include + +#include "arch.h" +#include "util.h" +#include "se_memory.h" +#include "se_memcpy.h" +#include "se_trace.h" +#include "enclave.h" +#include "td_mngr.h" + +#include "lowlib.h" +#include "sgxsim.h" +#include "enclave_mngr.h" +#include "u_instructions.h" + +#include "ippcp.h" + + +static uintptr_t _EINIT(secs_t* secs, enclave_css_t* css, token_t* launch); +static uintptr_t _ECREATE (page_info_t* pi); +static uintptr_t _EADD (page_info_t* pi, void* epc_lin_addr); +static uintptr_t _EREMOVE(const void* epc_lin_addr); + +//////////////////////////////////////////////////////////////////////// +#define __GP__() exit(EXIT_FAILURE) + +#define GP() do { \ + SE_TRACE(SE_TRACE_DEBUG, "#GP on %s, line: %d\n", __FILE__, __LINE__); \ + __GP__(); \ + } while (0) + +#define GP_ON(cond) if (cond) GP() + +#define GP_ON_EENTER GP_ON + +#define mcp_same_size(dst_ptr, src_ptr, size) memcpy_s(dst_ptr, size, src_ptr, size) + +uintptr_t _EINIT(secs_t* secs, enclave_css_t *css, token_t *launch) +{ + CEnclaveMngr *mngr = CEnclaveMngr::get_instance(); + assert(mngr != NULL); + + CEnclaveSim* ce = mngr->get_enclave(secs); + GP_ON(ce == NULL); + + GP_ON((ce->get_secs()->attributes.flags & SGX_FLAGS_INITTED) != 0); + + // Fill MREnclave, MRSigner, ISVPRODID, ISVSVN + secs_t* this_secs = ce->get_secs(); + if (css != NULL) { + // Check signature + if ((css->body.attribute_mask.xfrm & this_secs->attributes.xfrm) + != (css->body.attribute_mask.xfrm & css->body.attributes.xfrm)) + { + SE_TRACE(SE_TRACE_DEBUG, + "SECS attributes.xfrm does NOT match signature attributes.xfrm\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + if ((css->body.attribute_mask.flags & this_secs->attributes.flags) + != (css->body.attribute_mask.flags & css->body.attributes.flags)) + { + SE_TRACE(SE_TRACE_DEBUG, + "SECS attributes.flag does NOT match signature attributes.flag\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + mcp_same_size(&this_secs->mr_enclave, &css->body.enclave_hash, sizeof(sgx_measurement_t)); + this_secs->isv_prod_id = css->body.isv_prod_id; + this_secs->isv_svn = css->body.isv_svn; + + ippsHashMessage(css->key.modulus, SE_KEY_SIZE, (Ipp8u*)&this_secs->mr_signer, IPP_ALG_HASH_SHA256); + } + + // Check launch token + if (launch != NULL && launch->body.valid) { + if (memcmp(&launch->body.attributes, &this_secs->attributes, sizeof(sgx_attributes_t))) + { + SE_TRACE(SE_TRACE_DEBUG, + "SECS attributes does NOT match launch token attribuets\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + } + + // Mark it initialized + this_secs->attributes.flags |= SGX_FLAGS_INITTED; + + return SGX_SUCCESS; +} + +static inline bool is_power_of_two(size_t n) +{ + return (n != 0) && (!(n & (n - 1))); +} + +// Returns the pointer to the Enclave instance on success. +uintptr_t _ECREATE(page_info_t* pi) +{ + secs_t* secs = reinterpret_cast(pi->src_page); + + // Enclave size must be at least 2 pages and a power of 2. + GP_ON(!is_power_of_two((size_t)secs->size)); + GP_ON(secs->size < (SE_PAGE_SIZE << 1)); + + CEnclaveSim* ce = new CEnclaveSim(secs); + void* addr; + + // `ce' is not checked against NULL, since it is not + // allocated with new(std::no_throw). + addr = se_virtual_alloc(NULL, (size_t)secs->size, MEM_COMMIT); + if (addr == NULL) { + delete ce; + return 0; + } + + // Mark all the memory inaccessible. + se_virtual_protect(addr, (size_t)secs->size, SGX_PROT_NONE); + ce->get_secs()->base = addr; + + CEnclaveMngr::get_instance()->add(ce); + return reinterpret_cast(ce); +} + +uintptr_t _EADD(page_info_t* pi, void *epc_lin_addr) +{ + void *src_page = pi->src_page; + CEnclaveMngr *mngr = CEnclaveMngr::get_instance(); + CEnclaveSim *ce = mngr->get_enclave(pi->lin_addr); + + if (ce == NULL) { + SE_TRACE(SE_TRACE_DEBUG, "failed to get enclave instance\n"); + return SGX_ERROR_UNEXPECTED; + } + + GP_ON(!IS_PAGE_ALIGNED(epc_lin_addr)); + GP_ON((ce->get_secs()->attributes.flags & SGX_FLAGS_INITTED) != 0); + + // Make the page writable before doing memcpy() + se_virtual_protect(epc_lin_addr, SE_PAGE_SIZE, SI_FLAGS_RW); + + mcp_same_size(epc_lin_addr, src_page, SE_PAGE_SIZE); + + se_virtual_protect(epc_lin_addr, SE_PAGE_SIZE, (uint32_t)pi->sec_info->flags); + + GP_ON(!ce->add_page(pi->lin_addr, pi->sec_info->flags)); + return SGX_SUCCESS; +} + +uintptr_t _EREMOVE(const void *epc_lin_addr) +{ + CEnclaveMngr *mngr = CEnclaveMngr::get_instance(); + CEnclaveSim *ce = mngr->get_enclave(epc_lin_addr); + + GP_ON(!ce); + GP_ON(!IS_PAGE_ALIGNED(epc_lin_addr)); + + return ce->remove_page(epc_lin_addr) ? 0 : -1; +} + +//////////////////////////////////////////////////////////////////////// + +// Master entry functions + + +void _SE3(uintptr_t xax, uintptr_t xbx, + uintptr_t xcx, uintptr_t xdx, + uintptr_t xsi, uintptr_t xdi) +{ + UNUSED(xdx); + + switch (xax) + { + case SE_EENTER: + uintptr_t xip; + void * enclave_base_addr; + se_pt_regs_t* p_pt_regs; + tcs_t* tcs; + tcs_sim_t* tcs_sim; + ssa_gpr_t* p_ssa_gpr; + secs_t* secs; + CEnclaveMngr* mngr; + CEnclaveSim* ce; + + // xbx contains the address of a TCS + tcs = reinterpret_cast(xbx); + + // Is TCS pointer page-aligned? + GP_ON_EENTER(!IS_PAGE_ALIGNED(tcs)); + + mngr = CEnclaveMngr::get_instance(); + assert(mngr != NULL); + + // Is it really a TCS? + ce = mngr->get_enclave(tcs); + GP_ON_EENTER(ce == NULL); + GP_ON_EENTER(!ce->is_tcs_page(tcs)); + + // Check the EntryReason + tcs_sim = reinterpret_cast(tcs->reserved); + GP_ON_EENTER(tcs_sim->tcs_state != TCS_STATE_INACTIVE); + GP_ON_EENTER(tcs->cssa >= tcs->nssa); + + secs = ce->get_secs(); + enclave_base_addr = secs->base; + + p_ssa_gpr = reinterpret_cast(reinterpret_cast(enclave_base_addr) + static_cast(tcs->ossa) + + secs->ssa_frame_size * SE_PAGE_SIZE + - sizeof(ssa_gpr_t)); + + tcs_sim->saved_aep = xcx; + + p_pt_regs = reinterpret_cast(get_bp()); + p_ssa_gpr->REG(bp_u) = p_pt_regs->xbp; + + p_ssa_gpr->REG(sp_u) = reinterpret_cast(p_pt_regs + 1); + xcx = p_pt_regs->xip; + + xip = reinterpret_cast(enclave_base_addr); + GP_ON_EENTER(xip == 0); + + //set the _tls_array to point to the self_addr of TLS section inside the enclave + GP_ON_EENTER(td_mngr_set_td(enclave_base_addr, tcs) == false); + + // Destination depends on STATE + xip += (uintptr_t)tcs->oentry; + tcs_sim->tcs_state = TCS_STATE_ACTIVE; + + // Link the TCS to the thread + GP_ON_EENTER((secs->attributes.flags & SGX_FLAGS_INITTED) == 0); + + // Replace the return address on the stack with the enclave entry, + // so that when we return from this function, we'll enter the enclave. + enclu_regs_t regs; + regs.xax = tcs->cssa; + regs.xbx = reinterpret_cast(tcs); + regs.xcx = xcx; + regs.xdx = 0; + regs.xsi = xsi; + regs.xdi = xdi; + regs.xbp = p_ssa_gpr->REG(bp_u); + regs.xsp = p_ssa_gpr->REG(sp_u); + regs.xip = xip; + + load_regs(®s); + + // Returning from this function enters the enclave + return; + default: + // There's only 1 ring 3 instruction outside the enclave: EENTER. + GP(); + } +} + +uintptr_t _SE0(uintptr_t xax, uintptr_t xbx, + uintptr_t xcx, uintptr_t xdx, + uintptr_t xsi, uintptr_t xdi) +{ + UNUSED(xsi), UNUSED(xdi); + + switch (xax) + { + case SE_ECREATE: + return _ECREATE(reinterpret_cast(xbx)); + + case SE_EADD: + return _EADD(reinterpret_cast(xbx), + reinterpret_cast(xcx)); + + case SE_EINIT: + return _EINIT(reinterpret_cast(xbx), + reinterpret_cast(xcx), + reinterpret_cast(xdx)); + + case SE_EREMOVE: + return _EREMOVE(reinterpret_cast(xcx)); + + default: + GP(); + } + + return 0; +} + diff --git a/sdk/simulation/uinst/u_instructions.h b/sdk/simulation/uinst/u_instructions.h new file mode 100644 index 0000000000..a35a9a1201 --- /dev/null +++ b/sdk/simulation/uinst/u_instructions.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _UINSTRUCTIONS_H__ +#define _UINSTRUCTIONS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// this struct defines the way the registers are stored on the +// stack during an EENTER. +typedef struct _se_pt_regs_t { +#if defined(__x86_64__) + uintptr_t xbp; + uintptr_t xip; +#else + uintptr_t xbp; + uintptr_t xip; + uintptr_t xax; + uintptr_t xbx; + uintptr_t xcx; + uintptr_t xdx; + uintptr_t xsi; + uintptr_t xdi; +#endif +} se_pt_regs_t; + +uintptr_t _SE0(uintptr_t xax, uintptr_t xbx, + uintptr_t xcx, uintptr_t xdx, + uintptr_t xsi, uintptr_t xdi); + +void _SE3(uintptr_t xax, uintptr_t xbx, + uintptr_t xcx, uintptr_t xdx, + uintptr_t xsi, uintptr_t xdi); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/urtssim/Makefile b/sdk/simulation/urtssim/Makefile new file mode 100644 index 0000000000..5e02f9ac6c --- /dev/null +++ b/sdk/simulation/urtssim/Makefile @@ -0,0 +1,37 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +.PHONY: all clean +all: + $(MAKE) -C linux + +clean: + $(MAKE) -C linux clean diff --git a/sdk/simulation/urtssim/cpusvn_util.cpp b/sdk/simulation/urtssim/cpusvn_util.cpp new file mode 100644 index 0000000000..4669888fba --- /dev/null +++ b/sdk/simulation/urtssim/cpusvn_util.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "cpusvn_util.h" +#include "se_wrapper.h" +#include "sgx_error.h" +#include "rts_sim.h" + +#include +#include +#include +#include +#include +#include + +#define MAX_FILE_PATH 260 + +extern "C" bool get_file_path(char *config_path, uint32_t length) +{ + if(config_path == NULL || length == 0) + { + return false; + } + + char *local_path = getenv(ENV_PAR); + if(local_path == NULL) + return false; + snprintf(config_path, length, "%s%s", local_path, FILE_NAME); + + return true; +} + + +extern "C" bool write_cpusvn_file(const char *file_path, const sgx_cpu_svn_t *cpusvn) +{ + if(file_path == NULL || cpusvn == NULL) + { + return false; + } + FILE *fp = NULL; + if(NULL == (fp = fopen(file_path, "wb"))) + { + return false; + } + if(fwrite(cpusvn, 1, sizeof(sgx_cpu_svn_t), fp) != sizeof(sgx_cpu_svn_t)) + { + fclose(fp); + return false; + } + fclose(fp); + return true; +} + + +extern "C" bool read_cpusvn_file(const char *config_path, sgx_cpu_svn_t *cpusvn_ptr) +{ + if(config_path == NULL || cpusvn_ptr == NULL) + return false; + + FILE *fp = NULL; + long fsize = 0; + sgx_cpu_svn_t temp_cpusvn = {{0}}; + size_t result = 0; + + if(NULL == (fp = fopen(config_path, "rb"))) + { + SE_TRACE(SE_TRACE_DEBUG, "Couldn't find/open the configuration file %s.\n", config_path); + memcpy_s(cpusvn_ptr, sizeof(sgx_cpu_svn_t), &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)); + return true; + } + + //check and read configure file format + if(fseek(fp, 0, SEEK_END)) + { + memcpy_s(&temp_cpusvn, sizeof(temp_cpusvn), &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)); + goto clean_return; + } + + fsize = ftell(fp); + rewind(fp); + + if(fsize != sizeof(sgx_cpu_svn_t)) + { + SE_TRACE(SE_TRACE_DEBUG, "The configuration file format is not correct. Using default CPUSVN value.\n"); + memcpy_s(&temp_cpusvn, sizeof(temp_cpusvn), &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)); + goto clean_return; + } + + result = fread(&temp_cpusvn, 1, fsize, fp); + if(result != (size_t)fsize) + { + SE_TRACE(SE_TRACE_DEBUG, "Failed to read configuration file. Using default CPUSVN value.\n"); + memcpy_s(&temp_cpusvn, sizeof(temp_cpusvn), &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)); + goto clean_return; + } + + if(memcmp(&temp_cpusvn, &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)) && + memcmp(&temp_cpusvn, &UPGRADED_CPUSVN, sizeof(UPGRADED_CPUSVN)) && + memcmp(&temp_cpusvn, &DOWNGRADED_CPUSVN, sizeof(DOWNGRADED_CPUSVN))) + { + SE_TRACE(SE_TRACE_DEBUG, "The configuration file format is not correct. Using default CPUSVN value.\n"); + memcpy_s(&temp_cpusvn, sizeof(temp_cpusvn), &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)); + goto clean_return; + } + +clean_return: + fclose(fp); + memcpy_s(cpusvn_ptr, sizeof(*cpusvn_ptr), &temp_cpusvn, sizeof(temp_cpusvn)); + return true; + } + + +extern "C" int get_cpusvn(sgx_cpu_svn_t *cpu_svn) +{ + if( cpu_svn == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + sgx_cpu_svn_t temp_cpusvn = {{0}}; + + char config_path[MAX_FILE_PATH]; + memset(config_path, 0, MAX_FILE_PATH); + + if((get_file_path(config_path, MAX_FILE_PATH)) == false) + { + SE_TRACE(SE_TRACE_DEBUG, "Get configuration file path failed. Using default CPUSVN value\n"); + memcpy_s(cpu_svn, sizeof(*cpu_svn), &DEFAULT_CPUSVN, sizeof(DEFAULT_CPUSVN)); + return SGX_SUCCESS; + } + + bool r = read_cpusvn_file(config_path, &temp_cpusvn); + (void)r, assert (r); + + memcpy_s(cpu_svn, sizeof(*cpu_svn), &temp_cpusvn, sizeof(temp_cpusvn)); + + return SGX_SUCCESS; +} + diff --git a/sdk/simulation/urtssim/cpusvn_util.h b/sdk/simulation/urtssim/cpusvn_util.h new file mode 100644 index 0000000000..4284671ce5 --- /dev/null +++ b/sdk/simulation/urtssim/cpusvn_util.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef CPUSVN_UTIL_H_ +#define CPUSVN_UTIL_H_ + +#include "arch.h" + +#define ENV_PAR "HOME" +#define FILE_NAME "/.cpusvn.conf" + +#ifdef __cplusplus +extern "C" { +#endif + +bool get_file_path(char *config_path, uint32_t length); +bool write_cpusvn_file(const char *config_path, const sgx_cpu_svn_t *cpusvn); +bool read_cpusvn_file(const char *config_path, sgx_cpu_svn_t *cpusvn_ptr); +int get_cpusvn(sgx_cpu_svn_t *cpu_svn); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/simulation/urtssim/enclave_creator_sim.cpp b/sdk/simulation/urtssim/enclave_creator_sim.cpp new file mode 100644 index 0000000000..3f92291f24 --- /dev/null +++ b/sdk/simulation/urtssim/enclave_creator_sim.cpp @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "enclave_creator_sim.h" +#include "enclave_mngr.h" +#include "se_detect.h" +#include "driver_api.h" +#include "enclave.h" +#include "rts.h" +#include "routine.h" +#include "cpu_features.h" +#include "se_error_internal.h" +#include "util.h" +#include "cpusvn_util.h" +#include "rts_sim.h" +#include +#include + +EnclaveCreator* g_enclave_creator = new EnclaveCreatorSim(); + +int EnclaveCreatorSim::create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae) +{ + UNUSED(ae); + return ::create_enclave(secs, enclave_id, start_addr); +} +int EnclaveCreatorSim::add_enclave_page(sgx_enclave_id_t enclave_id, void *src, uint64_t offset, const sec_info_t &sinfo, uint32_t attr) +{ + void* source = src; + uint8_t color_page[SE_PAGE_SIZE]; + if(!source) + { + memset(color_page, 0, SE_PAGE_SIZE); + source = reinterpret_cast(&color_page); + } + return ::add_enclave_page(enclave_id, source, (size_t)offset, sinfo, attr); +} +int EnclaveCreatorSim::init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file) +{ + UNUSED(prd_css_file); + sgx_launch_token_t token; + memset(token, 0, sizeof(sgx_launch_token_t)); + + int ret = lc->get_launch_token(&token); + if(ret != SGX_SUCCESS) + return ret; + + return ::init_enclave(enclave_id, enclave_css, reinterpret_cast(token)); +} + +int EnclaveCreatorSim::get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t debug_flag) +{ + sgx_attributes_t *required_attr; + enclave_css_t *enclave_css; + sgx_attributes_t *secs_attr; + uint64_t xcr0 = 0; + + assert(sgx_misc_attr != NULL); + assert(metadata != NULL); + + required_attr = &metadata->attributes; + enclave_css = &metadata->enclave_css; + secs_attr = &sgx_misc_attr->secs_attr; + + // Make sure that FP/SSE is set. + if (SGX_XFRM_LEGACY != (required_attr->xfrm & SGX_XFRM_LEGACY)) + { + SE_TRACE(SE_TRACE_WARNING, "FP/SSE are must-have attributes\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + if (debug_flag) + { + //If enclave is signed as product enclave, but is launched as debug enclave, we need report specific error code. + if((enclave_css->body.attribute_mask.flags & SGX_FLAGS_DEBUG) + && !(enclave_css->body.attributes.flags & SGX_FLAGS_DEBUG) + ) + { + return SGX_ERROR_NDEBUG_ENCLAVE; + } + required_attr->flags |= SGX_FLAGS_DEBUG; + } + else + required_attr->flags &= (~SGX_FLAGS_DEBUG); + + secs_attr->flags = required_attr->flags; + if (! try_read_xcr0(&xcr0)) + { + // read_xcr0() failed + secs_attr->xfrm = SGX_XFRM_LEGACY; + } + else + { + secs_attr->xfrm = xcr0 & required_attr->xfrm; + } + + // Check the signature structure xfrm attribute restrictions. + if((enclave_css->body.attribute_mask.xfrm & secs_attr->xfrm) + != (enclave_css->body.attribute_mask.xfrm & enclave_css->body.attributes.xfrm)) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes.xfrm does NOT match signature attributes.xfrm\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + // Check the signature structure flags attribute restrictions. + if((enclave_css->body.attribute_mask.flags & secs_attr->flags) + != (enclave_css->body.attribute_mask.flags & enclave_css->body.attributes.flags)) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes.flag does NOT match signature attributes.flag\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + + if(lc != NULL) + { + sgx_launch_token_t token; + memset(&token, 0, sizeof(token)); + if(lc->get_launch_token(&token) != SGX_SUCCESS) + return SGX_ERROR_UNEXPECTED; + token_t *launch = (token_t *)token; + + if( 1 == launch->body.valid) + { + // Debug launch enclave cannot launch production enclave + if( !(secs_attr->flags & SGX_FLAGS_DEBUG) + && (launch->attributes_le.flags & SGX_FLAGS_DEBUG) ) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes is non-debug, \n"); + return SE_ERROR_INVALID_LAUNCH_TOKEN; + } + + // Verify attributes in lictoken are the same as the enclave + if(memcmp(&launch->body.attributes, secs_attr, sizeof(sgx_attributes_t))) + { + SE_TRACE(SE_TRACE_WARNING, "secs attributes does NOT match launch token attributes\n"); + return SGX_ERROR_INVALID_ATTRIBUTE; + } + } + } + return SGX_SUCCESS; +} + +int EnclaveCreatorSim::destroy_enclave(sgx_enclave_id_t enclave_id) +{ + CEnclave *enclave = CEnclavePool::instance()->get_enclave(enclave_id); + + if(enclave == NULL) + return SGX_ERROR_INVALID_ENCLAVE_ID; + + return ::destroy_enclave(enclave_id); +} + +int EnclaveCreatorSim::initialize(sgx_enclave_id_t enclave_id) +{ + CEnclave *enclave = CEnclavePool::instance()->get_enclave(enclave_id); + + if(enclave == NULL) + { + SE_TRACE(SE_TRACE_WARNING, "enclave (id = %llu) not found.\n", enclave_id); + return SGX_ERROR_INVALID_ENCLAVE_ID; + } + + // Save the SECS address (EGETKEY/EREPORT needs to know SECS). + CEnclaveMngr *mngr = CEnclaveMngr::get_instance(); + CEnclaveSim *ce = mngr->get_enclave(enclave_id); + if (ce == NULL) + { + SE_TRACE(SE_TRACE_WARNING, "enclave (id = %llu) not found.\n", enclave_id); + return SGX_ERROR_INVALID_ENCLAVE_ID; + } + + global_data_sim_t *global_data_sim_ptr = (global_data_sim_t *)enclave->get_symbol_address("g_global_data_sim"); + //We have check the symbol of "g_global_data_sim" in urts_com.h::_create_enclave(), so here global_data_sim_ptr won't be NULL. + assert(global_data_sim_ptr != NULL); + + // Initialize the `seed' to `g_global_data_sim'. + global_data_sim_ptr->seed = (uint32_t)time(NULL); + + global_data_sim_ptr->secs_ptr = ce->get_secs(); + sgx_cpu_svn_t temp_cpusvn = {{0}}; + + int status = get_cpusvn(&temp_cpusvn); + assert(status == SGX_SUCCESS); + + memcpy_s(&(global_data_sim_ptr->cpusvn_sim),sizeof(global_data_sim_ptr->cpusvn_sim), &temp_cpusvn, sizeof(temp_cpusvn)); + + + //Since CPUID instruction is NOT supported within enclave, we emuerate the cpu features here and send to tRTS. + cpu_sdk_info_t info; + info.cpu_features = 0; + get_cpu_features(&info.cpu_features); + info.version = SDK_VERSION_1_5; + status = enclave->ecall(ECMD_INIT_ENCLAVE, NULL, reinterpret_cast(&info)); + //free the tcs used by initialization; + enclave->get_thread_pool()->reset(); + if(SGX_SUCCESS == status) + { + return SGX_SUCCESS; + } + else + { + SE_TRACE(SE_TRACE_WARNING, "initialize enclave failed\n"); + return SGX_ERROR_UNEXPECTED; + } +} + +bool EnclaveCreatorSim::use_se_hw() const +{ + return false; +} + +bool EnclaveCreatorSim::get_plat_cap(sgx_misc_attribute_t *se_attr) +{ + UNUSED(se_attr); + return false; +} diff --git a/sdk/simulation/urtssim/enclave_creator_sim.h b/sdk/simulation/urtssim/enclave_creator_sim.h new file mode 100644 index 0000000000..4732183dda --- /dev/null +++ b/sdk/simulation/urtssim/enclave_creator_sim.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _ENCLAVE_CREATOR_H_ +#define _ENCLAVE_CREATOR_H_ + +#include "enclave_creator.h" +#include "sgx_eid.h" + +// simulation mode +class EnclaveCreatorSim : public EnclaveCreator +{ +public: + int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae); + int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr); + int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *launch, le_prd_css_file_t *prd_css_file); + virtual int destroy_enclave(sgx_enclave_id_t enclave_id); + int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag); + bool get_plat_cap(sgx_misc_attribute_t *se_attr); + int initialize(sgx_enclave_id_t enclave_id); + bool use_se_hw() const; +}; + +#endif diff --git a/sdk/simulation/urtssim/linux/Makefile b/sdk/simulation/urtssim/linux/Makefile new file mode 100644 index 0000000000..780fbb8343 --- /dev/null +++ b/sdk/simulation/urtssim/linux/Makefile @@ -0,0 +1,173 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +SIM_DIR := $(LINUX_SDK_DIR)/simulation +VTUNE_DIR = $(LINUX_EXTERNAL_DIR)/vtune/linux + +ifndef DEBUG +CXXFLAGS += -DDISABLE_TRACE +CFLAGS += -DDISABLE_TRACE +endif + +CXXFLAGS += -fPIC -DSE_SIM -Werror +CFLAGS += -fPIC -DSE_SIM -Werror + +CPPFLAGS += $(ADDED_INC) #for ubuntu 11 and later version +CPPFLAGS += -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal/linux \ + -I$(LINUX_PSW_DIR)/urts \ + -I$(LINUX_PSW_DIR)/urts/parser \ + -I$(VTUNE_DIR)/include \ + -I$(VTUNE_DIR)/sdk/src/ittnotify + +CPPFLAGS += -I$(COMMON_DIR)/inc/internal \ + -I$(LINUX_PSW_DIR)/urts/linux \ + -I$(SIM_DIR)/tinst \ + -I$(SIM_DIR)/uinst + +DIR1 := $(LINUX_PSW_DIR)/urts/ +DIR2 := $(LINUX_PSW_DIR)/urts/linux/ +DIR3 := $(LINUX_PSW_DIR)/urts/parser/ +DIR4 := ../ + +LDFLAGS += -L$(COMMON_DIR)/se_wrapper \ + -L$(SIM_DIR)/uae_service_sim/linux + +LDFLAGS += -L$(VTUNE_DIR)/sdk/src/ittnotify/ -littnotify -ldl + +OBJ1 := enclave.o \ + tcs.o \ + loader.o \ + se_detect.o \ + enclave_mutex.o \ + routine.o \ + urts_xsave.o \ + se_ocalls.o \ + cpu_features.o \ + node.o \ + launch_checker.o + +OBJ2 := urts.o \ + misc.o \ + sig_handler.o \ + debugger_support.o \ + get_thread_id.o + +OBJ3 := section.o \ + elfparser.o + +OBJ4 := enter_enclave.o + +OBJ5 := enclave_creator_sim.o \ + cpusvn_util.o + +OBJ6 := $(SIM_DIR)/driver_api/driver_api.o \ + $(SIM_DIR)/assembly/linux/lowlib.o \ + $(SIM_DIR)/assembly/linux/sgxsim.o \ + $(SIM_DIR)/uinst/u_instructions.o \ + $(SIM_DIR)/uinst/enclave_mngr.o \ + $(SIM_DIR)/uinst/linux/set_tls.o \ + $(SIM_DIR)/uinst/linux/restore_tls.o + +CPP_OBJ := $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ5) +OBJ := $(CPP_OBJ) $(OBJ4) + +vpath %.cpp .:$(DIR1):$(DIR2):$(DIR3):$(DIR4) + +LDFLAGS += -L$(LINUX_EXTERNAL_DIR)/crypto_px + +LIBURTSSIM_SHARED := libsgx_urts_sim.so +LIBURTS_DEPLOY := libsgx_urts_deploy.so + +LDLIBS += -lwrapper -lcrypto_px -Wl,-Bdynamic -Wl,-Bsymbolic -lsgx_uae_service_sim +SONAME = $(LIBURTSSIM_SHARED) + +.PHONY: all +all: $(LIBURTSSIM_SHARED) $(LIBURTS_DEPLOY)| $(BUILD_DIR) + $(CP) $^ $| + + +$(LIBURTSSIM_SHARED): simasm uinst driver_api wrapper uae_service_sim $(OBJ) $(OBJ6) -lcrypto_px ittnotify + $(CXX) $(CXXFLAGS) -shared -Wl,-soname=$(SONAME) $(OBJ) $(OBJ6) $(LDFLAGS) $(LDLIBS) -o $@ + + +$(BUILD_DIR): + @$(MKDIR) $@ + +$(OBJ4): %.o: $(DIR2)/%.S + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + +$(CPP_OBJ): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + +-lcrypto_px: + $(MAKE) -C $(LINUX_EXTERNAL_DIR)/crypto_px + +.PHONY: wrapper +wrapper: + $(MAKE) -C $(COMMON_DIR)/se_wrapper/ + +.PHONY: driver_api +driver_api: + $(MAKE) -C $(SIM_DIR)/driver_api/ + +.PHONY: simasm +simasm: + $(MAKE) -C $(SIM_DIR)/assembly/ + +.PHONY: uinst +uinst: + $(MAKE) -C $(SIM_DIR)/uinst/ + +.PHONY: uae_service_sim +uae_service_sim: + $(MAKE) -C $(SIM_DIR)/uae_service_sim/linux + +.PHONY: ittnotify +ittnotify: + $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify/ + +$(LIBURTS_DEPLOY):../urts_deploy.c + $(CC) -I$(COMMON_DIR)/inc -shared -fPIC -Wl,-soname=libsgx_urts.so $< -o $@ + +.PHONY: clean +clean:: + @$(RM) *.o $(LIBURTSSIM_SHARED) $(LIBURTS_DEPLOY) + @$(RM) $(BUILD_DIR)/$(LIBURTSSIM_SHARED) $(BUILD_DIR)/$(LIBURTS_DEPLOY) + $(MAKE) -C $(COMMON_DIR)/se_wrapper clean + $(MAKE) -C $(SIM_DIR)/driver_api/ clean + $(MAKE) -C $(SIM_DIR)/assembly/ clean + $(MAKE) -C $(SIM_DIR)/uinst/ clean + $(MAKE) -C $(SIM_DIR)/uae_service_sim/linux clean + $(MAKE) -C $(LINUX_EXTERNAL_DIR)/crypto_px clean + $(MAKE) -C $(VTUNE_DIR)/sdk/src/ittnotify/ clean diff --git a/sdk/simulation/urtssim/urts_deploy.c b/sdk/simulation/urtssim/urts_deploy.c new file mode 100644 index 0000000000..e58ee6c505 --- /dev/null +++ b/sdk/simulation/urtssim/urts_deploy.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "sgx_error.h" + +sgx_status_t sgx_create_enclave() +{ + printf("Please use the correct uRTS library from PSW package.\n"); + return SGX_ERROR_UNEXPECTED; +} + +void sgx_debug_load_state_add_element(){}; +void sgx_debug_unload_state_remove_element(){}; +void sgx_destroy_enclave(){}; +void sgx_ecall(){}; +void sgx_oc_cpuidex(){}; +void sgx_ocall(){}; +void sgx_thread_set_multiple_untrusted_events_ocall(){}; +void sgx_thread_set_untrusted_event_ocall(){}; +void sgx_thread_setwait_untrusted_events_ocall(){}; +void sgx_thread_wait_untrusted_event_ocall(){}; + diff --git a/sdk/simulation/urtssim/urts_sim.h b/sdk/simulation/urtssim/urts_sim.h new file mode 100644 index 0000000000..46c7c65981 --- /dev/null +++ b/sdk/simulation/urtssim/urts_sim.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _URTS_SIM_H_ +#define _URTS_SIM_H_ +#include "sgx_urts.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +uint64_t get_urts_version(); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/sdk/tae_service/Makefile b/sdk/tae_service/Makefile new file mode 100644 index 0000000000..3d06fb8bd8 --- /dev/null +++ b/sdk/tae_service/Makefile @@ -0,0 +1,97 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR = ../.. +include $(TOP_DIR)/buildenv.mk + +AENAME = sgx_tae_service +EDLFILE = $(TOP_DIR)/common/inc/$(AENAME).edl + +INCLUDE += -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc + +INCLUDE += -I$(LINUX_PSW_DIR)/ae/data/constants/linux + +INCLUDE += -I$(LINUX_PSW_DIR)/ae/common \ + -I$(LINUX_PSW_DIR)/ae/inc \ + -I$(LINUX_PSW_DIR)/ae/inc/internal +# -I$(LINUX_PSW_DIR)/ae/pse/pse_op + +INCLUDE += -I$(LINUX_EXTERNAL_DIR)/crypto_px/include + +vpath %.cpp $(COMMON_DIR)/src:\ + $(LINUX_PSW_DIR)/ae/common:\ + $(TOP_DIR)/src + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) + +EDGER8R_DIR := $(LINUX_SDK_DIR)/edger8r/linux +EDGER8R := $(EDGER8R_DIR)/_build/Edger8r.native + +EC_DH_LIB_DIR := $(TOP_DIR)/sdk/ec_dh_lib +EC_DH_LIB := $(EC_DH_LIB_DIR)/libsgx_dh.a + +SRC := $(wildcard *.cpp) +SRC += dh.cpp + +OBJ := $(SRC:.cpp=.o) + +LIBNAME := libtae_service.a + +.PHONY: all +all: $(LIBNAME) + +$(AENAME)_t.h: $(EDLFILE) $(EDGER8R) + $(EDGER8R) --trusted --header-only --search-path $(TOP_DIR)/common/inc $< + +$(EDGER8R): + $(MAKE) -C $(EDGER8R_DIR) + +$(LIBNAME): $(AENAME)_t.h $(OBJ) + $(MAKE) -C $(EC_DH_LIB_DIR) + $(CP) $(EC_DH_LIB) $@ + $(AR) rs $@ $(OBJ) + +$(OBJ): %.o :%.cpp + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ + +.PHONY: clean +clean: + @$(RM) *.o + @$(RM) $(COMMON_DIR)/src/*.o + @$(RM) *_t.* *_u.* + @$(RM) $(LIBNAME) + $(MAKE) -C $(EC_DH_LIB_DIR) clean + $(MAKE) -C $(EDGER8R_DIR) clean + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/tae_service/tae_config.h b/sdk/tae_service/tae_config.h new file mode 100644 index 0000000000..99f4b172ef --- /dev/null +++ b/sdk/tae_service/tae_config.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _TAE_CONFIG_H_ +#define _TAE_CONFIG_H_ + +#include "sgx.h" + +#ifdef _DEBUG +//wait for 10min at most for debug +#define SGX_PSE_LATENCY 600000 +#else +//long enough to do long-term pairing, PSE Provisioning, update RPDATA and commit the VMC database +#define SGX_PSE_LATENCY 20000 +#endif + + +#define SE_CREATE_SESSION_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_EXCHANGE_REPORT_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_CLOSE_SESSION_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_GET_TRUSTED_TIME_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_CREATE_MONOTONIC_COUNTER_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_READ_MONOTONIC_COUNTER_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_INCREMENT_MONOTONIC_COUNTER_TIMEOUT_MSEC (SGX_PSE_LATENCY) +#define SE_DESTROY_MONOTONIC_COUNTER_TIMEOUT_MSEC (SGX_PSE_LATENCY) + +#define RETRY_TIMES 2 +#define DEFAULT_VMC_ATTRIBUTE_MASK 0xFFFFFFFFFFFFFFCB +#define DEFAULT_VMC_XFRM_MASK 0x0 + +#include "service_enclave_mrsigner.hh" +#include "pse_op_prod_id.hh" +#include "pse_op_isv_svn_min.hh" +#endif diff --git a/sdk/tae_service/tae_service.cpp b/sdk/tae_service/tae_service.cpp new file mode 100644 index 0000000000..b7d0669d9b --- /dev/null +++ b/sdk/tae_service/tae_service.cpp @@ -0,0 +1,729 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_types.h" +#include "sgx_trts.h" +#include "sgx_utils.h" +#include "arch.h" +#include "sgx_tae_service.h" +#include "tae_service_internal.h" +#include "dh.h" +#include "sgx_dh.h" +#include "sgx_spinlock.h" +#include "sgx_thread.h" +#include "uncopyable.h" + +#include "tae_config.h" + +#include "sgx_tae_service_t.h" + +#define ERROR_BREAK(x) if(SGX_SUCCESS != (x)){break;} +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} + +#define INVALID_SESSION_ID (-1U) + +typedef struct _session_t +{ + uint32_t session_id; + sgx_key_128bit_t authenticated_encryption_key; + se_ps_sec_prop_desc_internal_t ps_security_property;//!ref i205169 + uint32_t transaction_number;//valid transaction_number is from 0 to 0x7FFFFFFF + //seq_num in request message is transaction_number*2 and seq_num in response message is expected to be transaction_number*2+1 + bool session_inited; +}session_t; + +static session_t g_pse_session; + +class Mutex :private Uncopyable{ +public: + Mutex() {sgx_thread_mutex_init(&m_mutex, NULL);} + ~Mutex() { sgx_thread_mutex_destroy(&m_mutex);} + void lock() { sgx_thread_mutex_lock(&m_mutex); } + void unlock() { sgx_thread_mutex_unlock(&m_mutex); } +private: + sgx_thread_mutex_t m_mutex; +}; +//mutex for change g_pse_session, create_pse_session, close_pse_session and crypt_invoke locks it. +static Mutex g_session_mutex; + +static sgx_status_t uae_create_session( + uint32_t* session_id, + sgx_dh_msg1_t* se_dh_msg1, + uint32_t timeout + ) +{ + sgx_status_t status; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + status = create_session_ocall(&ret, session_id, (uint8_t*)se_dh_msg1, sizeof(sgx_dh_msg1_t), timeout); + if (status!=SGX_SUCCESS) + return status; + return ret; +} + +static sgx_status_t uae_close_session( + uint32_t session_id, + uint32_t timeout + ) +{ + sgx_status_t status; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + status = close_session_ocall(&ret, session_id, timeout); + if (status!=SGX_SUCCESS) + return status; + return ret; +} + +static sgx_status_t uae_exchange_report( + uint32_t session_id, + sgx_dh_msg2_t* se_dh_msg2, + sgx_dh_msg3_t* se_dh_msg3, + uint32_t timeout + ) +{ + sgx_status_t status; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + status = exchange_report_ocall(&ret, session_id, (uint8_t*)se_dh_msg2, static_cast(sizeof(sgx_dh_msg2_t)), + (uint8_t*)se_dh_msg3, static_cast(sizeof(sgx_dh_msg3_t)+sizeof(cse_sec_prop_t)),timeout); + if (status!=SGX_SUCCESS) + return status; + return ret; +} + +static sgx_status_t uae_invoke_service( + uint8_t* pse_message_req, uint32_t pse_message_req_size, + uint8_t* pse_message_resp, uint32_t pse_message_resp_size, + uint32_t timeout + ) +{ + sgx_status_t status; + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + status = invoke_service_ocall(&ret, pse_message_req, pse_message_req_size, pse_message_resp, pse_message_resp_size, timeout); + if (status!=SGX_SUCCESS) + return status; + return ret; +} + +static sgx_status_t close_pse_session_within_mutex() +{ + sgx_status_t status = SGX_SUCCESS; + if (g_pse_session.session_inited) + { + g_pse_session.session_inited = false; + memset_s(&g_pse_session.authenticated_encryption_key,sizeof(&g_pse_session.authenticated_encryption_key), 0, sizeof(sgx_key_128bit_t)); + uint32_t session_id = g_pse_session.session_id; + //Ocall uae_service close_session + status = uae_close_session(session_id, SE_CLOSE_SESSION_TIMEOUT_MSEC); + + if (status == SGX_ERROR_AE_SESSION_INVALID) + { + //means session is closed by PSE, it's acceptable + status = SGX_SUCCESS; + } + } + return status; +} + +sgx_status_t sgx_close_pse_session() +{ + sgx_status_t status = SGX_SUCCESS; + g_session_mutex.lock(); + //check session status again after mutex lock got. + status = close_pse_session_within_mutex(); + g_session_mutex.unlock(); + return status; +} + +static sgx_status_t verify_pse(sgx_dh_session_enclave_identity_t* dh_id) +{ + + //verify dh_id->mr_signer same as hard-coded PSE MRSIGNER. + if(0!=memcmp(&dh_id->mr_signer, &G_SERVICE_ENCLAVE_MRSIGNER, sizeof(sgx_measurement_t))) + { + return SGX_ERROR_UNEXPECTED; + } + //verify dh_id->isv_prod_id same as hard-coded prod_id of PSE. + if(PSE_PROD_ID != dh_id->isv_prod_id) + { + return SGX_ERROR_UNEXPECTED; + } + //verify dh_id->isv_svn bigger or same as hard-coded minimal value if minimal value is not zero + //check PSE_ISV_SVN_MIN against 0 first to avoid "pointless comparison of unsigned integer with zero" + //compiler error on Windows and Linux + if(PSE_ISV_SVN_MIN != 0 && !(dh_id->isv_svn >= PSE_ISV_SVN_MIN)) + { + return SGX_ERROR_UNEXPECTED; + } + //make sure debug flag is not set + if(dh_id->attributes.flags & SGX_FLAGS_DEBUG) + { + return SGX_ERROR_UNEXPECTED; + } + return SGX_SUCCESS; +} +static sgx_status_t create_pse_session_within_mutex() +{ + if (g_pse_session.session_inited) + { + return SGX_SUCCESS; + } + + sgx_dh_msg3_t* se_dh_msg3 = NULL; + //set invalid session id + uint32_t session_id = INVALID_SESSION_ID; + sgx_status_t status = SGX_ERROR_UNEXPECTED; + + //for pse session + sgx_dh_msg1_t se_dh_msg1; + sgx_dh_msg2_t se_dh_msg2; + + //for dh session + sgx_dh_session_t dh_session_context; + sgx_key_128bit_t dh_aek; + sgx_dh_session_enclave_identity_t dh_id; + + + //set start status + status = sgx_dh_init_session(SGX_DH_SESSION_INITIATOR, &dh_session_context); + if (SGX_ERROR_OUT_OF_MEMORY == status) + return SGX_ERROR_OUT_OF_MEMORY; + if(status!=SGX_SUCCESS) + return SGX_ERROR_UNEXPECTED; + + se_dh_msg3 = (sgx_dh_msg3_t*)malloc(sizeof(sgx_dh_msg3_t)+sizeof(cse_sec_prop_t)); + if(!se_dh_msg3) + return SGX_ERROR_OUT_OF_MEMORY; + + do{ + //Ocall uae_service create_session, get session_id and se_dh_msg1 from PSE + status = uae_create_session(&session_id,&se_dh_msg1, SE_CREATE_SESSION_TIMEOUT_MSEC); + if (SGX_ERROR_INVALID_PARAMETER == status) + status = SGX_ERROR_UNEXPECTED; + ERROR_BREAK(status); + + //process msg1 and generate msg2 + status = sgx_dh_initiator_proc_msg1(&se_dh_msg1, &se_dh_msg2, &dh_session_context); + if (SGX_ERROR_OUT_OF_MEMORY == status) + break; + if(status!=SGX_SUCCESS) + { + status = SGX_ERROR_UNEXPECTED; + break; + } + + //Ocall uae_service exchange_report, give se_dh_msg2, get se_dh_msg3 + status = uae_exchange_report(session_id,&se_dh_msg2, se_dh_msg3, SE_EXCHANGE_REPORT_TIMEOUT_MSEC); + if (SGX_ERROR_INVALID_PARAMETER == status) + status = SGX_ERROR_UNEXPECTED; + ERROR_BREAK(status); + + //proc msg3 to get AEK + status = sgx_dh_initiator_proc_msg3(se_dh_msg3, &dh_session_context, &dh_aek, &dh_id); + if (SGX_ERROR_OUT_OF_MEMORY == status) + break; + if(status!=SGX_SUCCESS) + { + status = SGX_ERROR_UNEXPECTED; + break; + } + + //verify PSE same as hard-coded attributes + status = verify_pse(&dh_id); + ERROR_BREAK(status); + + status = sgx_verify_report(&se_dh_msg3->msg3_body.report); + if (SGX_ERROR_OUT_OF_MEMORY == status) + break; + if(status!=SGX_SUCCESS) + { + status = SGX_ERROR_UNEXPECTED; + break; + } + + + //fill g_pse_session + g_pse_session.session_id = session_id; + memcpy(&g_pse_session.authenticated_encryption_key , &dh_aek, sizeof(sgx_key_128bit_t)); + g_pse_session.ps_security_property.pse_miscselect = dh_id.misc_select; + g_pse_session.ps_security_property.reserved1 = 0; + memset(g_pse_session.ps_security_property.reserved2, 0, sizeof(g_pse_session.ps_security_property.reserved2)); + memcpy(&g_pse_session.ps_security_property.pse_attributes, &dh_id.attributes, sizeof(sgx_attributes_t)); + memcpy(&g_pse_session.ps_security_property.pse_isvsvn, &dh_id.isv_svn, sizeof(sgx_isv_svn_t)); + memcpy(&g_pse_session.ps_security_property.pse_mr_signer, &dh_id.mr_signer, sizeof(sgx_measurement_t)); + memcpy(&g_pse_session.ps_security_property.pse_prod_id, &dh_id.isv_prod_id, sizeof(sgx_prod_id_t)); + //copy CSE_SEC_PROP of SE_DH_MSG3 to g_pse_session.ps_security_property + pse_dh_msg3_t* pse_dh_msg3 = (pse_dh_msg3_t*)se_dh_msg3; + memcpy(&g_pse_session.ps_security_property.cse_sec_prop, &pse_dh_msg3->cse_sec_prop, sizeof(cse_sec_prop_t)); + g_pse_session.session_inited = true; + //reset transaction_number to 0 + g_pse_session.transaction_number = 0; + status = SGX_SUCCESS; + break; + }while(0); + SAFE_FREE(se_dh_msg3); + if(status != SGX_SUCCESS && session_id != INVALID_SESSION_ID) + uae_close_session(session_id, SE_CLOSE_SESSION_TIMEOUT_MSEC);//we can do nothing if close_session fails + return status; +} + +sgx_status_t sgx_create_pse_session() +{ + sgx_status_t status= SGX_ERROR_UNEXPECTED; + //lock mutex, only one thread can create session, others must wait. + g_session_mutex.lock(); + status = create_pse_session_within_mutex(); + //unlock the session mutex + g_session_mutex.unlock(); + return status; +} + +sgx_status_t sgx_get_ps_sec_prop(sgx_ps_sec_prop_desc_t* ps_security_property) +{ + sgx_status_t ret; + if(!ps_security_property) + return SGX_ERROR_INVALID_PARAMETER; + //lock mutex to read session status + g_session_mutex.lock(); + if (g_pse_session.session_inited == true) + { + memcpy(ps_security_property,&g_pse_session.ps_security_property,sizeof(sgx_ps_sec_prop_desc_t)); + ret = SGX_SUCCESS; + } + else + ret = SGX_ERROR_AE_SESSION_INVALID; + //unlock the session mutex + g_session_mutex.unlock(); + return ret; +} + +static sgx_status_t verify_msg_hdr(pse_req_hdr_t* req_payload_hdr, pse_resp_hdr_t* resp_payload_hdr) +{ + sgx_status_t ret = SGX_SUCCESS; + if(resp_payload_hdr->service_id != req_payload_hdr->service_id || + resp_payload_hdr->service_cmd != req_payload_hdr->service_cmd || + //resp seq_num increases one by PSE + resp_payload_hdr->seq_num != req_payload_hdr->seq_num+1|| + //transaction_number has increase one after setting seq_num + g_pse_session.transaction_number != resp_payload_hdr->seq_num/2 +1) + { + ret = SGX_ERROR_UNEXPECTED; + } + else if(resp_payload_hdr->status != PSE_SUCCESS) + { + switch (resp_payload_hdr->status) + { + case PSE_ERROR_INTERNAL: + ret = SGX_ERROR_UNEXPECTED; + break; + case PSE_ERROR_BUSY: + ret = SGX_ERROR_BUSY; + break; + case PSE_ERROR_MC_NOT_FOUND: + ret = SGX_ERROR_MC_NOT_FOUND; + break; + case PSE_ERROR_MC_NO_ACCESS_RIGHT: + ret = SGX_ERROR_MC_NO_ACCESS_RIGHT; + break; + case PSE_ERROR_UNKNOWN_REQ: + ret = SGX_ERROR_INVALID_PARAMETER; + break; + case PSE_ERROR_CAP_NOT_AVAILABLE: + ret = SGX_ERROR_SERVICE_UNAVAILABLE; + break; + case PSE_ERROR_MC_USED_UP: + ret = SGX_ERROR_MC_USED_UP; + break; + case PSE_ERROR_MC_OVER_QUOTA: + ret = SGX_ERROR_MC_OVER_QUOTA; + break; + case PSE_ERROR_INVALID_POLICY: + ret = SGX_ERROR_INVALID_PARAMETER; + break; + default: + ret = SGX_ERROR_UNEXPECTED; + break; + } + } + return ret; +} + +//increase nonce, build msg, encrypt msg, call invoke_service, decrypt msg, verify msg format +static sgx_status_t crypt_invoke(pse_message_t* req_msg, uint32_t req_msg_size, + pse_req_hdr_t* req_payload_hdr, + uint32_t timeout, + pse_message_t* resp_msg, uint32_t resp_msg_size, + pse_resp_hdr_t* resp_payload_hdr + ) +{ + + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + int retry = RETRY_TIMES; + //lock transaction_number + g_session_mutex.lock(); + //don't need to lock g_pse_session.sgx_spin_lock, g_pse_session only changes when g_session_mutex is locked. + if (!g_pse_session.session_inited) + { + g_session_mutex.unlock(); + return SGX_ERROR_AE_SESSION_INVALID; + } + //retry only when return value of uae_invoke_service is SGX_ERROR_AE_SESSION_INVALID, + //which means that session is closed by PSE or transaction_number is out of order. + //In these situation, session needs to reestablish and retry the invoke_service. + while(retry --) + { + //prevent transaction_number from rolling over. 0x7fffffff and below is valid + if(g_pse_session.transaction_number > 0x7fffffff){ + //if unexpected failure of following close_pse_session_within_mutex() and create_pse_session_within_mutex() + //return SGX_ERROR_AE_SESSION_INVALID to user + ret = SGX_ERROR_AE_SESSION_INVALID; + //need to close current session and create a new session + //create_pse_session_within_mutex will reset the g_pse_session.transaction_number + //close_session failure will always return SGX_ERROR_AE_SESSION_INVALID + ERROR_BREAK(close_pse_session_within_mutex()); + //create_session failure will return SGX_ERROR_BUSY on SGX_ERROR_BUSY, SGX_ERROR_OUT_OF_MEMORY on SGX_ERROR_OUT_OF_MEMORY, + //and SGX_ERROR_AE_SESSION_INVALID on other error code + sgx_status_t aesm_status = create_pse_session_within_mutex(); + switch (aesm_status) + { + case SGX_ERROR_BUSY: + ret = SGX_ERROR_BUSY; + break; + case SGX_ERROR_OUT_OF_MEMORY: + ret = SGX_ERROR_OUT_OF_MEMORY; + break; + default: + break; + } + ERROR_BREAK(aesm_status); + } + //set seq_num + req_payload_hdr->seq_num = g_pse_session.transaction_number*2; + //increase transaction_number + g_pse_session.transaction_number++; + + //set request message session id + req_msg->session_id = g_pse_session.session_id; + + + //encrypt_msg with authenticated_encryption_key of the session + if (!encrypt_msg(req_msg, (uint8_t*)req_payload_hdr, &g_pse_session.authenticated_encryption_key)) + { + ret = SGX_ERROR_UNEXPECTED; + break; + } + //ocall invoke_service + ret = uae_invoke_service((uint8_t*)req_msg, (req_msg_size), + (uint8_t*)resp_msg, resp_msg_size, timeout); + if (SGX_ERROR_AE_SESSION_INVALID == ret) + { + //close_session failure will always return SGX_ERROR_AE_SESSION_INVALID + ERROR_BREAK(close_pse_session_within_mutex()); + //recreating session + sgx_status_t aesm_status = create_pse_session_within_mutex(); + if(SGX_SUCCESS == aesm_status) + continue; + switch (aesm_status) + { + case SGX_ERROR_BUSY: + ret = SGX_ERROR_BUSY; + break; + case SGX_ERROR_OUT_OF_MEMORY: + ret = SGX_ERROR_OUT_OF_MEMORY; + break; + default: + break; + } + } + ERROR_BREAK(ret); + //decrypt_msg with authenticated_encryption_key of the session + if(!decrypt_msg(resp_msg, (uint8_t*)resp_payload_hdr, &g_pse_session.authenticated_encryption_key)) + { + ret = SGX_ERROR_UNEXPECTED; + break; + } + ret = verify_msg_hdr(req_payload_hdr,resp_payload_hdr); + break; + } + g_session_mutex.unlock(); + return ret; +} + + + +sgx_status_t sgx_get_trusted_time( + sgx_time_t* current_time, + sgx_time_source_nonce_t* time_source_nonce + ) +{ + if(!current_time || !time_source_nonce) + return SGX_ERROR_INVALID_PARAMETER; + + pse_message_t* req_msg = (pse_message_t*)malloc(PSE_TIMER_READ_REQ_SIZE); + if (!req_msg) + return SGX_ERROR_OUT_OF_MEMORY; + pse_message_t* resp_msg = (pse_message_t*)malloc(PSE_TIMER_READ_RESP_SIZE); + if (!resp_msg) + { + free(req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(req_msg, 0, PSE_TIMER_READ_REQ_SIZE); + memset(resp_msg, 0, PSE_TIMER_READ_RESP_SIZE); + req_msg->exp_resp_size = sizeof(pse_timer_read_resp_t); + req_msg->payload_size = sizeof(pse_timer_read_req_t); + + pse_timer_read_req_t timer_req; + timer_req.req_hdr.service_id = PSE_TRUSTED_TIME_SERVICE; + timer_req.req_hdr.service_cmd = PSE_TIMER_READ; + + pse_timer_read_resp_t timer_resp; + memset(&timer_resp, 0, sizeof(pse_timer_read_resp_t)); + + sgx_status_t status; + status = crypt_invoke(req_msg, PSE_TIMER_READ_REQ_SIZE, &timer_req.req_hdr, SE_GET_TRUSTED_TIME_TIMEOUT_MSEC, + resp_msg, PSE_TIMER_READ_RESP_SIZE, &timer_resp.resp_hdr); + if (status==SGX_SUCCESS) + { + memcpy(current_time, &timer_resp.timestamp, sizeof(sgx_time_t)); + memcpy(time_source_nonce,timer_resp.time_source_nonce,sizeof(sgx_time_source_nonce_t)); + } + //error condition + free(req_msg); + free(resp_msg); + return status; +} + +se_static_assert(SGX_MC_POLICY_SIGNER == MC_POLICY_SIGNER); +se_static_assert(SGX_MC_POLICY_ENCLAVE == MC_POLICY_ENCLAVE); +sgx_status_t sgx_create_monotonic_counter_ex( + uint16_t owner_policy, + const sgx_attributes_t* owner_attribute_mask, + sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ) +{ + if (!counter_value || !counter_uuid || !owner_attribute_mask) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ( 0!= (~(MC_POLICY_SIGNER | MC_POLICY_ENCLAVE) & owner_policy) || + 0 == ((MC_POLICY_SIGNER | MC_POLICY_ENCLAVE)& owner_policy)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + pse_message_t* req_msg = (pse_message_t*)malloc(PSE_CREATE_MC_REQ_SIZE); + if (!req_msg) + return SGX_ERROR_OUT_OF_MEMORY; + pse_message_t* resp_msg = (pse_message_t*)malloc(PSE_CREATE_MC_RESP_SIZE); + if (!resp_msg) + { + free(req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(req_msg, 0, PSE_CREATE_MC_REQ_SIZE); + memset(resp_msg, 0, PSE_CREATE_MC_RESP_SIZE); + req_msg->exp_resp_size = sizeof(pse_mc_create_resp_t); + req_msg->payload_size = sizeof(pse_mc_create_req_t); + + pse_mc_create_req_t mc_req; + mc_req.req_hdr.service_id = PSE_MC_SERVICE; + mc_req.req_hdr.service_cmd = PSE_MC_CREATE; + mc_req.policy = owner_policy; + memcpy(mc_req.attr_mask, owner_attribute_mask, sizeof(mc_req.attr_mask)); + + pse_mc_create_resp_t mc_resp; + memset(&mc_resp, 0, sizeof(pse_mc_create_resp_t)); + + sgx_status_t status; + status = crypt_invoke(req_msg, PSE_CREATE_MC_REQ_SIZE, &mc_req.req_hdr, SE_CREATE_MONOTONIC_COUNTER_TIMEOUT_MSEC, + resp_msg, PSE_CREATE_MC_RESP_SIZE, &mc_resp.resp_hdr); + if (status == SGX_SUCCESS) + { + memcpy(counter_uuid->counter_id, &mc_resp.counter_id,sizeof(counter_uuid->counter_id)); + memcpy(counter_uuid->nonce, &mc_resp.nonce,sizeof(counter_uuid->nonce)); + //align with initial counter_value hard-coded in PSE + *counter_value = 0; + } + //error condition + free(req_msg); + free(resp_msg); + return status; +} + +sgx_status_t sgx_create_monotonic_counter( + sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ) +{ + // Default attribute mask + sgx_attributes_t attr_mask; + attr_mask.flags = DEFAULT_VMC_ATTRIBUTE_MASK; + attr_mask.xfrm = DEFAULT_VMC_XFRM_MASK; + + return sgx_create_monotonic_counter_ex(MC_POLICY_SIGNER, + &attr_mask, + counter_uuid, + counter_value + ); +} + +sgx_status_t sgx_destroy_monotonic_counter(const sgx_mc_uuid_t* counter_uuid) +{ + if (!counter_uuid) + { + return SGX_ERROR_INVALID_PARAMETER; + } + pse_message_t* req_msg = (pse_message_t*)malloc(PSE_DEL_MC_REQ_SIZE); + if (!req_msg) + return SGX_ERROR_OUT_OF_MEMORY; + pse_message_t* resp_msg = (pse_message_t*)malloc(PSE_DEL_MC_RESP_SIZE); + if (!resp_msg) + { + free(req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(req_msg, 0, PSE_DEL_MC_REQ_SIZE); + memset(resp_msg, 0, PSE_DEL_MC_RESP_SIZE); + req_msg->exp_resp_size = sizeof(pse_mc_del_resp_t); + req_msg->payload_size = sizeof(pse_mc_del_req_t); + + pse_mc_del_req_t mc_req; + memcpy(mc_req.counter_id, counter_uuid->counter_id, sizeof(mc_req.counter_id)); + memcpy(mc_req.nonce, counter_uuid->nonce, sizeof(mc_req.nonce)); + mc_req.req_hdr.service_id = PSE_MC_SERVICE; + mc_req.req_hdr.service_cmd = PSE_MC_DEL; + + pse_mc_del_resp_t mc_resp; + memset(&mc_resp, 0, sizeof(pse_mc_del_resp_t)); + + sgx_status_t status; + status = crypt_invoke(req_msg, PSE_DEL_MC_REQ_SIZE, &mc_req.req_hdr, SE_DESTROY_MONOTONIC_COUNTER_TIMEOUT_MSEC, + resp_msg, PSE_DEL_MC_RESP_SIZE, &mc_resp.resp_hdr); + //error condition + free(req_msg); + free(resp_msg); + return status; +} + + +sgx_status_t sgx_increment_monotonic_counter( + const sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ) +{ + if (!counter_value || !counter_uuid) + { + return SGX_ERROR_INVALID_PARAMETER; + } + pse_message_t* req_msg = (pse_message_t*)malloc(PSE_INC_MC_REQ_SIZE); + if (!req_msg) + return SGX_ERROR_OUT_OF_MEMORY; + pse_message_t* resp_msg = (pse_message_t*)malloc(PSE_INC_MC_RESP_SIZE); + if (!resp_msg) + { + free(req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(req_msg, 0, PSE_INC_MC_REQ_SIZE); + memset(resp_msg, 0, PSE_INC_MC_RESP_SIZE); + req_msg->exp_resp_size = sizeof(pse_mc_inc_resp_t); + req_msg->payload_size = sizeof(pse_mc_inc_req_t); + + pse_mc_inc_req_t mc_req; + memcpy(mc_req.counter_id, counter_uuid->counter_id, sizeof(mc_req.counter_id)); + memcpy(mc_req.nonce, counter_uuid->nonce, sizeof(mc_req.nonce)); + mc_req.req_hdr.service_id = PSE_MC_SERVICE; + mc_req.req_hdr.service_cmd = PSE_MC_INC; + + pse_mc_inc_resp_t mc_resp; + memset(&mc_resp, 0, sizeof(pse_mc_inc_resp_t)); + + sgx_status_t status; + status = crypt_invoke(req_msg, PSE_INC_MC_REQ_SIZE, &mc_req.req_hdr, SE_INCREMENT_MONOTONIC_COUNTER_TIMEOUT_MSEC, + resp_msg, PSE_INC_MC_RESP_SIZE, &mc_resp.resp_hdr); + if (status == SGX_SUCCESS) + { + *counter_value = mc_resp.counter_value; + } + //error condition + free(req_msg); + free(resp_msg); + return status; +} + + +sgx_status_t sgx_read_monotonic_counter( + const sgx_mc_uuid_t* counter_uuid, + uint32_t* counter_value + ) +{ + if (!counter_value || !counter_uuid) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + pse_message_t* req_msg = (pse_message_t*)malloc(PSE_READ_MC_REQ_SIZE); + if (!req_msg) + return SGX_ERROR_OUT_OF_MEMORY; + pse_message_t* resp_msg = (pse_message_t*)malloc(PSE_READ_MC_RESP_SIZE); + if (!resp_msg) + { + free(req_msg); + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(req_msg, 0, PSE_READ_MC_REQ_SIZE); + memset(resp_msg, 0, PSE_READ_MC_RESP_SIZE); + req_msg->exp_resp_size = sizeof(pse_mc_read_resp_t); + req_msg->payload_size = sizeof(pse_mc_read_req_t); + + pse_mc_read_req_t mc_req; + memcpy(mc_req.counter_id, counter_uuid->counter_id, sizeof(mc_req.counter_id)); + memcpy(mc_req.nonce, counter_uuid->nonce, sizeof(mc_req.nonce)); + mc_req.req_hdr.service_id = PSE_MC_SERVICE; + mc_req.req_hdr.service_cmd = PSE_MC_READ; + + pse_mc_read_resp_t mc_resp; + memset(&mc_resp, 0, sizeof(pse_mc_read_resp_t)); + + sgx_status_t status; + status = crypt_invoke(req_msg, PSE_READ_MC_REQ_SIZE, &mc_req.req_hdr, SE_READ_MONOTONIC_COUNTER_TIMEOUT_MSEC, + resp_msg, PSE_READ_MC_RESP_SIZE, &mc_resp.resp_hdr); + if (status == SGX_SUCCESS) + { + *counter_value = mc_resp.counter_value; + } + //error condition + free(req_msg); + free(resp_msg); + return status; +} + diff --git a/sdk/tkey_exchange/Makefile b/sdk/tkey_exchange/Makefile new file mode 100644 index 0000000000..a4bddc27b2 --- /dev/null +++ b/sdk/tkey_exchange/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR = ../.. +include $(TOP_DIR)/buildenv.mk + +CFLAGS += -Werror +CXXFLAGS += -Werror + +INCLUDE += -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc + +INCLUDE += -I$(LINUX_PSW_DIR)/ae/inc \ + -I$(LINUX_PSW_DIR)/ae/inc/internal \ + -I$(LINUX_PSW_DIR)/ae/common \ + -I$(LINUX_PSW_DIR)/ae/ + +INCLUDE += -I$(LINUX_EXTERNAL_DIR)/crypto_px/include \ + -I$(LINUX_EXTERNAL_DIR)/epid/inc + +INCLUDE += -I$(LINUX_SDK_DIR)/tlibstdcxx/stlport + +vpath %.cpp $(COMMON_DIR)/src:$(LINUX_PSW_DIR)/ae/common +vpath %.edl $(COMMON_DIR)/inc + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) + +SRC := $(wildcard *.cpp) +SRC += ecp.cpp + +OBJ := $(SRC:.cpp=.o) + +EDGER8R = $(LINUX_SDK_DIR)/edger8r/linux/_build/Edger8r.native +LIBNAME := libsgx_tkey_exchange.a + +.PHONY: all +all: $(LIBNAME) | $(BUILD_DIR) + @$(CP) $< $| + @$(CP) sgx_tkey_exchange_t.h sgx_tkey_exchange_u.h $(COMMON_DIR)/inc/ + @$(CP) sgx_tkey_exchange_t.c sgx_tkey_exchange_u.c $(COMMON_DIR)/src/ + +$(LIBNAME): $(OBJ) + $(AR) rcsD $@ $^ + +tkey_exchange.o: $(COMMON_DIR)/inc/sgx_tkey_exchange_t.h + +$(COMMON_DIR)/inc/sgx_tkey_exchange_t.h: $(COMMON_DIR)/inc/sgx_tkey_exchange.edl + $(EDGER8R) --search-path $(TOP_DIR)/common/inc sgx_tkey_exchange.edl + +$(OBJ): %.o :%.cpp + $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $(BUILD_DIR) + +.PHONY: clean +clean: + @$(RM) $(OBJ) + @$(RM) $(LIBNAME) $(BUILD_DIR)/$(LIBNAME) + @$(RM) $(COMMON_DIR)/inc/sgx_tkey_exchange_t.h $(COMMON_DIR)/inc/sgx_tkey_exchange_u.h + @$(RM) $(COMMON_DIR)/src/sgx_tkey_exchange_t.c $(COMMON_DIR)/src/sgx_tkey_exchange_u.c + @$(RM) sgx_tkey_exchange_t.* sgx_tkey_exchange_u.* + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/tkey_exchange/simple_vector.cpp b/sdk/tkey_exchange/simple_vector.cpp new file mode 100644 index 0000000000..12c8150e61 --- /dev/null +++ b/sdk/tkey_exchange/simple_vector.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include +#include "simple_vector.h" + +//initial vector capacity when fisrt item is added to vector +#define INIT_SIZE 10 + +//max vector capacity of a vector +#define MAX_SIZE 10000 + +//init vector to all zero +void vector_init(simple_vector* v) +{ + if (v) + { + v->size = 0; + v->capacity = 0; + v->data = NULL; + } +} + +//return current number of items the vector holds +uint32_t vector_size(const simple_vector* v) +{ + if (v) + return v->size; + else + return 0; +} + +//push a pointer to the end of the vector +//return 0 if success, return 1 if memory malloc failure. +errno_t vector_push_back(simple_vector* v, const void* data) +{ + if (v) + { + if (v->capacity == 0) { + //first item + v->data = (void**)malloc(sizeof(void*) * INIT_SIZE); + if (v->data ==NULL) + return 1; + v->capacity = INIT_SIZE; + memset(v->data, '\0', sizeof(void*) * INIT_SIZE); + } + else if (v->size == v->capacity) { + void** new_data; + if( v->capacity >= MAX_SIZE - INIT_SIZE) + return 1; + //increate size by INIT_SIZE + new_data = (void**)realloc(v->data, sizeof(void*) *( v->capacity + INIT_SIZE)); + if (new_data ==NULL) + return 1; + memset(&new_data[v->capacity], '\0', sizeof(void*) * INIT_SIZE); + v->data = new_data; + v->capacity += INIT_SIZE; + } + //assign new item + v->data[v->size] = const_cast(data); + v->size++; + return 0; + } + return 1; +} + +//get the item pointer in the vector +//return 0 if success, return 1 if index is out of range or data pointer is invalid. +errno_t vector_get(const simple_vector* v, uint32_t index, void** data) +{ + if (!v || index >= v->size || !data) + return 1; + *data = v->data[index]; + return 0; +} + +//set the pointer in the vector +//return 0 if success, return 1 if index is out of range. +errno_t vector_set(simple_vector* v, uint32_t index, const void* data) +{ + if (!v || index >= v->size) + return 1; + v->data[index] = const_cast(data); + return 0; +} + +//release memory used by the vector +void vector_free(simple_vector* v) +{ + if (v) + { + v->size = 0; + v->capacity = 0; + if(v->data) + { + free(v->data); + v->data = NULL; + } + } +} diff --git a/sdk/tkey_exchange/simple_vector.h b/sdk/tkey_exchange/simple_vector.h new file mode 100644 index 0000000000..d1da3b33b1 --- /dev/null +++ b/sdk/tkey_exchange/simple_vector.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SIMPLE_VECOTR_H +#define _SIMPLE_VECOTR_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _simple_vector +{ + uint32_t size; + uint32_t capacity; + void** data; +}simple_vector; + +//call vector_init first or set all field to 0 to use a simple_vector +void vector_init(simple_vector* vector); + +//get number of elements in simple_vector +uint32_t vector_size(const simple_vector* vector); + +//insert an element to the end of simple_vector, the element can only be pointer +errno_t vector_push_back(simple_vector* vector, const void* data); + +//get an element +errno_t vector_get(const simple_vector* v, uint32_t index, void** data); + +//set an element content +errno_t vector_set(simple_vector* v, uint32_t index, const void* data); + +//free the simple_vector allocated memory +void vector_free(simple_vector* vector); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tkey_exchange/tkey_exchange.cpp b/sdk/tkey_exchange/tkey_exchange.cpp new file mode 100644 index 0000000000..32681d263d --- /dev/null +++ b/sdk/tkey_exchange/tkey_exchange.cpp @@ -0,0 +1,698 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include "sgx_tkey_exchange.h" +#include "sgx_trts.h" +#include "sgx_utils.h" +#include "ecp_interface.h" +#include "util.h" +#include "string.h" +#include "stdlib.h" +#include "sgx_spinlock.h" +#include "sgx_tkey_exchange_t.h" +#include "simple_vector.h" +#include "se_cdefs.h" + +// Add a version to tkey_exchange. +SGX_ACCESS_VERSION(tkey_exchange, 1) + +#define ERROR_BREAK(sgx_status) if(SGX_SUCCESS!=sgx_status){break;} +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} + +#pragma pack(push, 1) + +// any call to sgx_ra_init will reset the input pubkey related ra_db_item_t.ra_state to ra_inited +// only sgx_ra_get_ga can change ra_inited to ra_get_gaed +// only sgx_ra_proc_msg2_trusted can change ra_get_gaed to ra_proc_msg2ed +// sgx_ra_get_msg3_trusted and sgx_ra_get_keys will check ra_state whether to be ra_proc_msg2ed + +typedef enum _ra_state +{ + ra_inited= 0, + ra_get_gaed, + ra_proc_msg2ed +}ra_state; + +typedef struct _ra_db_item_t +{ + sgx_ec256_public_t g_a; + sgx_ec256_public_t g_b; + sgx_ec_key_128bit_t vk_key; + sgx_ec256_public_t sp_pubkey; + sgx_ec256_private_t a; + sgx_ps_sec_prop_desc_t ps_sec_prop; + sgx_ec_key_128bit_t mk_key; + sgx_ec_key_128bit_t sk_key; + sgx_ec_key_128bit_t smk_key; + sgx_quote_nonce_t quote_nonce; //to verify quote report data + sgx_target_info_t qe_target; //to verify quote report + ra_state state; + sgx_spinlock_t item_lock; +}ra_db_item_t; + +#pragma pack(pop) + +static simple_vector g_ra_db = {0, 0, NULL}; +static sgx_spinlock_t g_ra_db_lock; + +extern "C" sgx_status_t sgx_ra_get_ga( + sgx_ra_context_t context, + sgx_ec256_public_t *g_a) +{ + sgx_status_t se_ret; + if(vector_size(&g_ra_db) <= context||!g_a) + return SGX_ERROR_INVALID_PARAMETER; + ra_db_item_t* item = NULL; + if(0 != vector_get(&g_ra_db, context, reinterpret_cast(&item)) || item == NULL ) + return SGX_ERROR_INVALID_PARAMETER; + + + sgx_ecc_state_handle_t ecc_state = NULL; + sgx_ec256_public_t pub_key; + sgx_ec256_private_t priv_key; + + memset(&pub_key, 0, sizeof(pub_key)); + memset(&priv_key, 0, sizeof(priv_key)); + + + sgx_spin_lock(&item->item_lock); + do + { + //sgx_ra_init must have been called + if (item->state != ra_inited) + { + se_ret = SGX_ERROR_INVALID_STATE; + break; + } + // ecc_state should be closed when exit. + se_ret = sgx_ecc256_open_context(&ecc_state); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + se_ret = sgx_ecc256_create_key_pair(&priv_key, &pub_key, ecc_state); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + memcpy(&item->a, &priv_key, sizeof(item->a)); + memcpy(&item->g_a, &pub_key, sizeof(item->g_a)); + memcpy(g_a, &pub_key, sizeof(sgx_ec256_public_t)); + item->state = ra_get_gaed; + //clear local private key to defense in depth + memset_s(&priv_key,sizeof(priv_key),0,sizeof(sgx_ec256_private_t)); + }while(0); + sgx_spin_unlock(&item->item_lock); + if(ecc_state!=NULL) + sgx_ecc256_close_context(ecc_state); + return se_ret; +} + +extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( + sgx_ra_context_t context, + const sgx_ra_msg2_t *p_msg2, //(g_b||spid||quote_type|| KDF_ID ||sign_gb_ga||cmac||sig_rl_size||sig_rl) + const sgx_target_info_t *p_qe_target, + sgx_report_t *p_report, + sgx_quote_nonce_t* p_nonce) +{ + sgx_status_t se_ret = SGX_ERROR_UNEXPECTED; + //p_msg2[in] p_qe_target[in] p_report[out] p_nonce[out] in EDL file + if(vector_size(&g_ra_db) <= context + || !p_msg2 + || !p_qe_target + || !p_report + || !p_nonce) + return SGX_ERROR_INVALID_PARAMETER; + + ra_db_item_t* item = NULL; + if(0 != vector_get(&g_ra_db, context, reinterpret_cast(&item)) || item == NULL ) + return SGX_ERROR_INVALID_PARAMETER; + + sgx_ec256_private_t a; + memset(&a, 0, sizeof(a)); + // Create gb_ga + sgx_ec256_public_t gb_ga[2]; + sgx_ec256_public_t sp_pubkey; + memset(&gb_ga[0], 0, sizeof(gb_ga)); + sgx_spin_lock(&item->item_lock); + //sgx_ra_get_ga must have been called + if (item->state != ra_get_gaed) + { + sgx_spin_unlock(&item->item_lock); + return SGX_ERROR_INVALID_STATE; + } + memcpy(&a, &item->a, sizeof(a)); + memcpy(&gb_ga[1], &item->g_a, sizeof(gb_ga[1])); + memcpy(&sp_pubkey, &item->sp_pubkey, sizeof(sp_pubkey)); + sgx_spin_unlock(&item->item_lock); + memcpy(&gb_ga[0], &p_msg2->g_b, sizeof(gb_ga[0])); + + sgx_ecc_state_handle_t ecc_state = NULL; + + // ecc_state need to be freed when exit. + se_ret = sgx_ecc256_open_context(&ecc_state); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + return se_ret; + } + + sgx_ec256_dh_shared_t dh_key; + memset(&dh_key, 0, sizeof(dh_key)); + sgx_ec256_public_t* p_msg2_g_b = const_cast(&p_msg2->g_b); + se_ret = sgx_ecc256_compute_shared_dhkey(&a, + (sgx_ec256_public_t*)p_msg2_g_b, + (sgx_ec256_dh_shared_t*)&dh_key, ecc_state); + if(SGX_SUCCESS != se_ret) + { + if (SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + sgx_ecc256_close_context(ecc_state); + return se_ret; + } + // Verify signature of gb_ga + uint8_t result; + sgx_ec256_signature_t* p_msg2_sign_gb_ga = const_cast(&p_msg2->sign_gb_ga); + se_ret = sgx_ecdsa_verify((uint8_t *)&gb_ga, sizeof(gb_ga), + &sp_pubkey, + p_msg2_sign_gb_ga, + &result, ecc_state); + if(SGX_SUCCESS != se_ret) + { + if (SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + sgx_ecc256_close_context(ecc_state); + return se_ret; + } + if(SGX_EC_VALID != result) + { + sgx_ecc256_close_context(ecc_state); + return SGX_ERROR_INVALID_SIGNATURE; + } + sgx_ec_key_128bit_t smkey = {0}; + sgx_ec_key_128bit_t skey = {0}; + sgx_ec_key_128bit_t mkey = {0}; + sgx_ec_key_128bit_t vkey = {0}; + do + { + if (p_msg2->kdf_id == 0x0001) + { + se_ret = derive_key(&dh_key, "SMK", (uint32_t)(sizeof("SMK") -1), &smkey); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + sgx_cmac_128bit_tag_t mac; + uint32_t maced_size = offsetof(sgx_ra_msg2_t, mac); + + se_ret = sgx_rijndael128_cmac_msg(&smkey, (const uint8_t *)p_msg2, maced_size, &mac); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + //Check mac + if(0 == consttime_memequal(mac, p_msg2->mac, sizeof(mac))) + { + se_ret = SGX_ERROR_MAC_MISMATCH; + break; + } + + se_ret = derive_key((sgx_ec256_dh_shared_t*)&dh_key, "SK", (uint32_t )(sizeof("SK") -1), &skey); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + se_ret = derive_key((sgx_ec256_dh_shared_t*)&dh_key, "MK", (uint32_t)(sizeof("MK") -1), &mkey); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + se_ret = derive_key((sgx_ec256_dh_shared_t*)&dh_key, "VK", (uint32_t)(sizeof("VK") -1), &vkey); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + break; + } + } + else + { + se_ret = SGX_ERROR_KDF_MISMATCH; + break; + } + + //create a random nonce + se_ret =sgx_read_rand((uint8_t*)p_nonce, sizeof(sgx_quote_nonce_t)); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + sgx_spin_lock(&item->item_lock); + //sgx_ra_get_ga must have been called + if (item->state != ra_get_gaed) + { + se_ret = SGX_ERROR_INVALID_STATE; + sgx_spin_unlock(&item->item_lock); + break; + } + memcpy(&item->g_b, &p_msg2->g_b, sizeof(item->g_b)); + memcpy(&item->smk_key, smkey, sizeof(item->smk_key)); + memcpy(&item->sk_key, skey, sizeof(item->sk_key)); + memcpy(&item->mk_key, mkey, sizeof(item->mk_key)); + memcpy(&item->vk_key, vkey, sizeof(item->vk_key)); + memcpy(&item->qe_target, p_qe_target, sizeof(sgx_target_info_t)); + memcpy(&item->quote_nonce, p_nonce, sizeof(sgx_quote_nonce_t)); + sgx_report_data_t report_data = {{0}}; + se_static_assert(sizeof(sgx_report_data_t)>=sizeof(sgx_sha256_hash_t)); + // H = SHA256(ga || gb || VK_CMAC) + uint32_t sha256ed_size = offsetof(ra_db_item_t, sp_pubkey); + //report_data is 512bits, H is 256bits. The H is in the lower 256 bits of report data while the higher 256 bits are all zeros. + se_ret = sgx_sha256_msg((uint8_t *)&item->g_a, sha256ed_size, + (sgx_sha256_hash_t *)&report_data); + if(SGX_SUCCESS != se_ret) + { + if (SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + sgx_spin_unlock(&item->item_lock); + break; + } + //REPORTDATA = H + se_ret = sgx_create_report(p_qe_target, &report_data, p_report); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + sgx_spin_unlock(&item->item_lock); + break; + } + item->state = ra_proc_msg2ed; + sgx_spin_unlock(&item->item_lock); + }while(0); + memset_s(&dh_key, sizeof(dh_key), 0, sizeof(dh_key)); + sgx_ecc256_close_context(ecc_state); + memset_s(&a, sizeof(sgx_ec256_private_t),0, sizeof(sgx_ec256_private_t)); + memset_s(smkey, sizeof(sgx_ec_key_128bit_t),0, sizeof(sgx_ec_key_128bit_t)); + memset_s(skey, sizeof(sgx_ec_key_128bit_t),0, sizeof(sgx_ec_key_128bit_t)); + memset_s(mkey, sizeof(sgx_ec_key_128bit_t),0, sizeof(sgx_ec_key_128bit_t)); + memset_s(vkey, sizeof(sgx_ec_key_128bit_t),0, sizeof(sgx_ec_key_128bit_t)); + return se_ret; +} + + +/* the caller is supposed to fill the quote field in emp_msg3 before calling + * this function.*/ +extern "C" sgx_status_t sgx_ra_get_msg3_trusted( + sgx_ra_context_t context, + uint32_t quote_size, + sgx_report_t* qe_report, + sgx_ra_msg3_t *emp_msg3, //(mac||g_a||ps_sec_prop||quote) + uint32_t msg3_size) +{ + if(vector_size(&g_ra_db) <= context ||!quote_size || !qe_report || !emp_msg3) + return SGX_ERROR_INVALID_PARAMETER; + + ra_db_item_t* item = NULL; + if(0 != vector_get(&g_ra_db, context, reinterpret_cast(&item)) || item == NULL ) + return SGX_ERROR_INVALID_PARAMETER; + + //check integer overflow of msg3_size and quote_size + if (UINTPTR_MAX - reinterpret_cast(emp_msg3) < msg3_size || + UINT32_MAX - quote_size < sizeof(sgx_ra_msg3_t) || + sizeof(sgx_ra_msg3_t) + quote_size != msg3_size) + return SGX_ERROR_INVALID_PARAMETER; + + if (!sgx_is_outside_enclave(emp_msg3, msg3_size)) + return SGX_ERROR_INVALID_PARAMETER; + + sgx_status_t se_ret = SGX_ERROR_UNEXPECTED; + + //verify qe report + se_ret = sgx_verify_report(qe_report); + if(se_ret != SGX_SUCCESS) + { + if (SGX_ERROR_MAC_MISMATCH != se_ret && + SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + return se_ret; + } + + sgx_spin_lock(&item->item_lock); + //sgx_ra_proc_msg2_trusted must have been called + if (item->state != ra_proc_msg2ed) + { + sgx_spin_unlock(&item->item_lock); + return SGX_ERROR_INVALID_STATE; + } + //verify qe_report attributes and mr_enclave same as quoting enclave + if( memcmp( &qe_report->body.attributes, &item->qe_target.attributes, sizeof(sgx_attributes_t)) || + memcmp( &qe_report->body.mr_enclave, &item->qe_target.mr_enclave, sizeof(sgx_measurement_t)) ) + { + sgx_spin_unlock(&item->item_lock); + return SGX_ERROR_INVALID_PARAMETER; + } + + sgx_ra_msg3_t msg3_except_quote_in; + sgx_cmac_128bit_key_t smk_key; + memcpy(&msg3_except_quote_in.g_a, &item->g_a, sizeof(msg3_except_quote_in.g_a)); + memcpy(&msg3_except_quote_in.ps_sec_prop, &item->ps_sec_prop, + sizeof(msg3_except_quote_in.ps_sec_prop)); + memcpy(&smk_key, &item->smk_key, sizeof(smk_key)); + sgx_spin_unlock(&item->item_lock); + + sgx_sha_state_handle_t sha_handle = NULL; + sgx_cmac_state_handle_t cmac_handle = NULL; + + + //SHA256(NONCE || emp_quote) + sgx_sha256_hash_t hash = {0}; + se_ret = sgx_sha256_init(&sha_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + return se_ret; + } + if (NULL == sha_handle) + { + return SGX_ERROR_UNEXPECTED; + } + do + { + se_ret = sgx_sha256_update((uint8_t *)&item->quote_nonce, + sizeof(item->quote_nonce), + sha_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + //cmac M := ga || PS_SEC_PROP_DESC(all zero if unused) ||emp_quote + sgx_cmac_128bit_tag_t mac; + se_ret = sgx_cmac128_init(&smk_key, &cmac_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + if (NULL == cmac_handle) + { + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + se_ret = sgx_cmac128_update((uint8_t*)&msg3_except_quote_in.g_a, + sizeof(msg3_except_quote_in.g_a), cmac_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + se_ret = sgx_cmac128_update((uint8_t*)&msg3_except_quote_in.ps_sec_prop, + sizeof(msg3_except_quote_in.ps_sec_prop), cmac_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + // sha256 and cmac quote + uint8_t quote_piece[32]; + const uint8_t* emp_quote_piecemeal = emp_msg3->quote; + uint32_t quote_piece_size = static_cast(sizeof(quote_piece)); + + while (emp_quote_piecemeal < emp_msg3->quote + quote_size) + { + //caculate size of one piece, the size of them are sizeof(quote_piece) except for the last one. + if (static_cast(emp_msg3->quote + quote_size - emp_quote_piecemeal) < quote_piece_size) + quote_piece_size = static_cast(emp_msg3->quote - emp_quote_piecemeal) + quote_size ; + memcpy(quote_piece, emp_quote_piecemeal, quote_piece_size); + se_ret = sgx_sha256_update(quote_piece, + quote_piece_size, + sha_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + se_ret = sgx_cmac128_update(quote_piece, + quote_piece_size, + cmac_handle); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + emp_quote_piecemeal += sizeof(quote_piece); + } + ERROR_BREAK(se_ret); + + //get sha256 hash value + se_ret = sgx_sha256_get_hash(sha_handle, &hash); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + //get cmac value + se_ret = sgx_cmac128_final(cmac_handle, &mac); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + //verify qe_report->body.report_data == SHA256(NONCE || emp_quote) + if(0 != memcmp(&qe_report->body.report_data, &hash, sizeof(hash))) + { + se_ret = SGX_ERROR_MAC_MISMATCH; + break; + } + + memcpy(&msg3_except_quote_in.mac, mac, sizeof(mac)); + memcpy(emp_msg3, &msg3_except_quote_in, offsetof(sgx_ra_msg3_t, quote)); + se_ret = SGX_SUCCESS; + }while(0); + memset_s(&smk_key, sizeof(smk_key), 0, sizeof(smk_key)); + (void)sgx_sha256_close(sha_handle); + if(cmac_handle != NULL) + sgx_cmac128_close(cmac_handle); + return se_ret; +} + +// TKE interface for isv enclaves +sgx_status_t sgx_ra_init( + const sgx_ec256_public_t *p_pub_key, + int b_pse, + sgx_ra_context_t *p_context) +{ + int valid = 0; + sgx_status_t ret = SGX_SUCCESS; + sgx_ecc_state_handle_t ecc_state = NULL; + + if(!p_pub_key || !p_context) + return SGX_ERROR_INVALID_PARAMETER; + + if(!sgx_is_within_enclave(p_pub_key, sizeof(sgx_ec256_public_t))) + return SGX_ERROR_INVALID_PARAMETER; + + ret = sgx_ecc256_open_context(&ecc_state); + if(SGX_SUCCESS != ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != ret) + ret = SGX_ERROR_UNEXPECTED; + return ret; + } + + ret = sgx_ecc256_check_point((const sgx_ec256_public_t *)p_pub_key, + ecc_state, &valid); + if(SGX_SUCCESS != ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != ret) + ret = SGX_ERROR_UNEXPECTED; + sgx_ecc256_close_context(ecc_state); + return ret; + } + if(!valid) + { + sgx_ecc256_close_context(ecc_state); + return SGX_ERROR_INVALID_PARAMETER; + } + sgx_ecc256_close_context(ecc_state); + + //add new item to g_ra_db + ra_db_item_t* new_item = (ra_db_item_t*)malloc(sizeof(ra_db_item_t)); + if (!new_item) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + memset(new_item,0, sizeof(ra_db_item_t)); + memcpy(&new_item->sp_pubkey, p_pub_key, sizeof(new_item->sp_pubkey)); + if(b_pse) + { + //sgx_create_pse_session() must have been called + ret = sgx_get_ps_sec_prop(&new_item->ps_sec_prop); + if (ret!=SGX_SUCCESS) + { + SAFE_FREE(new_item); + return ret; + } + } + new_item->state = ra_inited; + + //find first empty slot in g_ra_db + int first_empty = -1; + ra_db_item_t* item = NULL; + sgx_spin_lock(&g_ra_db_lock); + uint32_t size = vector_size(&g_ra_db); + for (uint32_t i = 0; i < size; i++) + { + if(0 != vector_get(&g_ra_db, i, reinterpret_cast(&item))) + { + sgx_spin_unlock(&g_ra_db_lock); + SAFE_FREE(new_item); + return SGX_ERROR_UNEXPECTED; + } + if(item == NULL) + { + first_empty = i; + break; + } + } + //if there is a empty slot, use it + if (first_empty >= 0) + { + errno_t vret = vector_set(&g_ra_db, first_empty, new_item); + UNUSED(vret); + assert(vret == 0); + *p_context = first_empty; + } + //if there are no empty slots, add a new item to g_ra_db + else + { + if(size >= INT32_MAX) + { + //overflow + sgx_spin_unlock(&g_ra_db_lock); + SAFE_FREE(new_item); + return SGX_ERROR_OUT_OF_MEMORY; + } + if(0 != vector_push_back(&g_ra_db, new_item)) + { + sgx_spin_unlock(&g_ra_db_lock); + SAFE_FREE(new_item); + return SGX_ERROR_OUT_OF_MEMORY; + } + *p_context = size; + } + sgx_spin_unlock(&g_ra_db_lock); + return SGX_SUCCESS; +} + +// TKE interface for isv enclaves +sgx_status_t sgx_ra_get_keys( + sgx_ra_context_t context, + sgx_ra_key_type_t type, + sgx_ra_key_128_t *p_key) +{ + if(vector_size(&g_ra_db) <= context || !p_key) + return SGX_ERROR_INVALID_PARAMETER; + ra_db_item_t* item = NULL; + if(0 != vector_get(&g_ra_db, context, reinterpret_cast(&item)) || item == NULL ) + return SGX_ERROR_INVALID_PARAMETER; + + if(!sgx_is_within_enclave(p_key, sizeof(sgx_ra_key_128_t))) + return SGX_ERROR_INVALID_PARAMETER; + + sgx_status_t ret = SGX_SUCCESS; + sgx_spin_lock(&item->item_lock); + //sgx_ra_proc_msg2_trusted fill the keys, so keys are available after it's called. + if (item->state != ra_proc_msg2ed) + ret = SGX_ERROR_INVALID_STATE; + else if(SGX_RA_KEY_MK == type) + memcpy(p_key, item->mk_key, sizeof(sgx_ra_key_128_t)); + else if(SGX_RA_KEY_SK == type) + memcpy(p_key, item->sk_key, sizeof(sgx_ra_key_128_t)); + else + ret = SGX_ERROR_INVALID_PARAMETER; + sgx_spin_unlock(&item->item_lock); + return ret; +} + + +// TKE interface for isv enclaves +sgx_status_t SGXAPI sgx_ra_close( + sgx_ra_context_t context) +{ + if(vector_size(&g_ra_db) <= context) + return SGX_ERROR_INVALID_PARAMETER; + ra_db_item_t* item = NULL; + if(0 != vector_get(&g_ra_db, context, reinterpret_cast(&item)) || item == NULL ) + return SGX_ERROR_INVALID_PARAMETER; + sgx_spin_lock(&g_ra_db_lock); + //safe clear private key and RA key before free memory to defense in depth + memset_s(&item->a,sizeof(item->a),0,sizeof(sgx_ec256_private_t)); + memset_s(&item->vk_key,sizeof(item->vk_key),0,sizeof(sgx_ec_key_128bit_t)); + memset_s(&item->mk_key,sizeof(item->mk_key),0,sizeof(sgx_ec_key_128bit_t)); + memset_s(&item->sk_key,sizeof(item->sk_key),0,sizeof(sgx_ec_key_128bit_t)); + memset_s(&item->smk_key,sizeof(item->smk_key),0,sizeof(sgx_ec_key_128bit_t)); + SAFE_FREE(item); + vector_set(&g_ra_db, context, NULL); + sgx_spin_unlock(&g_ra_db_lock); + return SGX_SUCCESS; +} diff --git a/sdk/tkey_exchange/tkey_exchange_version.cpp b/sdk/tkey_exchange/tkey_exchange_version.cpp new file mode 100644 index 0000000000..04273263e0 --- /dev/null +++ b/sdk/tkey_exchange/tkey_exchange_version.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_TKEY_EXCHANGE_VERSION_STR __CONCAT("SGX_TKEY_EXCHANGE_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_tkey_exchange_version = SGX_TKEY_EXCHANGE_VERSION_STR; + +#ifdef __cplusplus +} +#endif diff --git a/sdk/tlibc/Makefile b/sdk/tlibc/Makefile new file mode 100644 index 0000000000..bada08a704 --- /dev/null +++ b/sdk/tlibc/Makefile @@ -0,0 +1,77 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CFLAGS += $(ENCLAVE_CFLAGS) +ASFLAGS := $(CFLAGS) +CFLAGS += -std=c99 +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -fno-exceptions -fno-rtti + +CPPFLAGS += -I. \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(LINUX_SDK_DIR)/trts \ + -I./gdtoa \ + +LIBC_C_SRCS := $(wildcard gen/*.c gdtoa/*.c locale/*.c math/*.c stdlib/*.c string/*.c stdio/*.c time/*.c) + +LIBC_CPP_SRCS := $(wildcard gen/*.cpp) tstdc_version.cpp +LIBC_ASM_SRCS := $(wildcard gen/*.S) + +LIBC_OBJS := $(LIBC_C_SRCS:.c=.o) +LIBC_OBJS += $(LIBC_CPP_SRCS:.cpp=.o) +LIBC_OBJS += $(LIBC_ASM_SRCS:.S=.o) + +LIBC_NAME := libtlibc.a + +.PHONY: all +all: $(LIBC_NAME) + +$(LIBC_NAME): $(LIBC_OBJS) + $(AR) rcs $@ $^ + +string/consttime_memequal.o: string/consttime_memequal.c + $(CC) $(filter-out -O2,$(CFLAGS)) -O1 $(CPPFLAGS) -c $< -o $@ + +%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +%.o: %.S + $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(LIBC_NAME) $(LIBC_OBJS) diff --git a/sdk/tlibc/gdtoa/arith.h b/sdk/tlibc/gdtoa/arith.h new file mode 100644 index 0000000000..e6db1fa834 --- /dev/null +++ b/sdk/tlibc/gdtoa/arith.h @@ -0,0 +1,16 @@ +#define IEEE_8087 +#define Arith_Kind_ASL 1 +//#define Bad_float_h + +#ifdef __x86_64__ +#define Long int +#define Intcast (int)(long) +#define Double_Align +#define X64_bit_pointers +#endif + +#define INFNAN_CHECK +#define MULTIPLE_THREADS +#define NO_FENV_H +//#define USE_LOCALE +#define NO_LONG_LONG diff --git a/sdk/tlibc/gdtoa/dmisc.c b/sdk/tlibc/gdtoa/dmisc.c new file mode 100644 index 0000000000..a5795cfb79 --- /dev/null +++ b/sdk/tlibc/gdtoa/dmisc.c @@ -0,0 +1,224 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + +#ifndef MULTIPLE_THREADS + char *dtoa_result; +#endif + + char * +#ifdef KR_headers +rv_alloc(i) int i; +#else +rv_alloc(int i) +#endif +{ + int j, k, *r; + + j = sizeof(ULong); + for(k = 0; + sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i; + j <<= 1) + k++; + r = (int*)Balloc(k); + if (r == NULL) + return ( +#ifndef MULTIPLE_THREADS + dtoa_result = +#endif + NULL); + *r = k; + return +#ifndef MULTIPLE_THREADS + dtoa_result = +#endif + (char *)(r+1); + } + + char * +#ifdef KR_headers +nrv_alloc(s, rve, n) char *s, **rve; int n; +#else +nrv_alloc(char *s, char **rve, int n) +#endif +{ + char *rv, *t; + + t = rv = rv_alloc(n); + if (t == NULL) + return (NULL); + while((*t = *s++) !=0) + t++; + if (rve) + *rve = t; + return rv; + } + +/* freedtoa(s) must be used to free values s returned by dtoa + * when MULTIPLE_THREADS is #defined. It should be used in all cases, + * but for consistency with earlier versions of dtoa, it is optional + * when MULTIPLE_THREADS is not defined. + */ + + void +#ifdef KR_headers +freedtoa(s) char *s; +#else +freedtoa(char *s) +#endif +{ + Bigint *b = (Bigint *)((int *)s - 1); + b->maxwds = 1 << (b->k = *(int*)b); + Bfree(b); +#ifndef MULTIPLE_THREADS + if (s == dtoa_result) + dtoa_result = 0; +#endif + } + + int +quorem +#ifdef KR_headers + (b, S) Bigint *b, *S; +#else + (Bigint *b, Bigint *S) +#endif +{ + int n; + ULong *bx, *bxe, q, *sx, *sxe; +#ifdef ULLong + ULLong borrow, carry, y, ys; +#else + ULong borrow, carry, y, ys; +#ifdef Pack_32 + ULong si, z, zs; +#endif +#endif + + n = S->wds; +#ifdef DEBUG + /*debug*/ if (b->wds > n) + /*debug*/ Bug("oversize b in quorem"); +#endif + if (b->wds < n) + return 0; + sx = S->x; + sxe = sx + --n; + bx = b->x; + bxe = bx + n; + q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ +#ifdef DEBUG + /*debug*/ if (q > 9) + /*debug*/ Bug("oversized quotient in quorem"); +#endif + if (q) { + borrow = 0; + carry = 0; + do { +#ifdef ULLong + ys = *sx++ * (ULLong)q + carry; + carry = ys >> 32; + y = *bx - (ys & 0xffffffffUL) - borrow; + borrow = y >> 32 & 1UL; + *bx++ = y & 0xffffffffUL; +#else +#ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) * q + carry; + zs = (si >> 16) * q + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) - borrow; + borrow = (y & 0x10000) >> 16; + z = (*bx >> 16) - (zs & 0xffff) - borrow; + borrow = (z & 0x10000) >> 16; + Storeinc(bx, z, y); +#else + ys = *sx++ * q + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) - borrow; + borrow = (y & 0x10000) >> 16; + *bx++ = y & 0xffff; +#endif +#endif + } + while(sx <= sxe); + if (!*bxe) { + bx = b->x; + while(--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + if (cmp(b, S) >= 0) { + q++; + borrow = 0; + carry = 0; + bx = b->x; + sx = S->x; + do { +#ifdef ULLong + ys = *sx++ + carry; + carry = ys >> 32; + y = *bx - (ys & 0xffffffffUL) - borrow; + borrow = y >> 32 & 1UL; + *bx++ = y & 0xffffffffUL; +#else +#ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) + carry; + zs = (si >> 16) + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) - borrow; + borrow = (y & 0x10000) >> 16; + z = (*bx >> 16) - (zs & 0xffff) - borrow; + borrow = (z & 0x10000) >> 16; + Storeinc(bx, z, y); +#else + ys = *sx++ + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) - borrow; + borrow = (y & 0x10000) >> 16; + *bx++ = y & 0xffff; +#endif +#endif + } + while(sx <= sxe); + bx = b->x; + bxe = bx + n; + if (!*bxe) { + while(--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + return q; + } diff --git a/sdk/tlibc/gdtoa/dtoa.c b/sdk/tlibc/gdtoa/dtoa.c new file mode 100644 index 0000000000..668f7b50b2 --- /dev/null +++ b/sdk/tlibc/gdtoa/dtoa.c @@ -0,0 +1,839 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 1999 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + +/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. + * + * Inspired by "How to Print Floating-Point Numbers Accurately" by + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. + * + * Modifications: + * 1. Rather than iterating, we use a simple numeric overestimate + * to determine k = floor(log10(d)). We scale relevant + * quantities using O(log2(k)) rather than O(k) multiplications. + * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't + * try to generate digits strictly left to right. Instead, we + * compute with fewer bits and propagate the carry if necessary + * when rounding the final digit up. This is often faster. + * 3. Under the assumption that input will be rounded nearest, + * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. + * That is, we allow equality in stopping tests when the + * round-nearest rule will give the same floating-point value + * as would satisfaction of the stopping test with strict + * inequality. + * 4. We remove common factors of powers of 2 from relevant + * quantities. + * 5. When converting floating-point integers less than 1e16, + * we use floating-point arithmetic rather than resorting + * to multiple-precision integers. + * 6. When asked to produce fewer than 15 digits, we first try + * to get by with floating-point arithmetic; we resort to + * multiple-precision integer arithmetic only if we cannot + * guarantee that the floating-point calculation has given + * the correctly rounded result. For k requested digits and + * "uniformly" distributed input, the probability is + * something like 10^(k-15) that we must resort to the Long + * calculation. + */ + +#ifdef Honor_FLT_ROUNDS +#undef Check_FLT_ROUNDS +#define Check_FLT_ROUNDS +#else +#define Rounding Flt_Rounds +#endif + + char * +dtoa +#ifdef KR_headers + (d0, mode, ndigits, decpt, sign, rve) + double d0; int mode, ndigits, *decpt, *sign; char **rve; +#else + (double d0, int mode, int ndigits, int *decpt, int *sign, char **rve) +#endif +{ + /* Arguments ndigits, decpt, sign are similar to those + of ecvt and fcvt; trailing zeros are suppressed from + the returned string. If not null, *rve is set to point + to the end of the return value. If d is +-Infinity or NaN, + then *decpt is set to 9999. + + mode: + 0 ==> shortest string that yields d when read in + and rounded to nearest. + 1 ==> like 0, but with Steele & White stopping rule; + e.g. with IEEE P754 arithmetic , mode 0 gives + 1e23 whereas mode 1 gives 9.999999999999999e22. + 2 ==> max(1,ndigits) significant digits. This gives a + return value similar to that of ecvt, except + that trailing zeros are suppressed. + 3 ==> through ndigits past the decimal point. This + gives a return value similar to that from fcvt, + except that trailing zeros are suppressed, and + ndigits can be negative. + 4,5 ==> similar to 2 and 3, respectively, but (in + round-nearest mode) with the tests of mode 0 to + possibly return a shorter string that rounds to d. + With IEEE arithmetic and compilation with + -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same + as modes 2 and 3 when FLT_ROUNDS != 1. + 6-9 ==> Debugging modes similar to mode - 4: don't try + fast floating-point estimate (if applicable). + + Values of mode other than 0-9 are treated as mode 0. + + Sufficient space is allocated to the return value + to hold the suppressed trailing zeros. + */ + + int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, + j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, + spec_case, try_quick; + Long L; +#ifndef Sudden_Underflow + int denorm; + ULong x; +#endif + Bigint *b, *b1, *delta, *mlo, *mhi, *S; + U d, d2, eps; + double ds; + char *s, *s0; +#ifdef SET_INEXACT + int inexact, oldinexact; +#endif +#ifdef Honor_FLT_ROUNDS /*{*/ + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ +#endif /*}*/ + +#ifndef MULTIPLE_THREADS + if (dtoa_result) { + freedtoa(dtoa_result); + dtoa_result = 0; + } +#endif + d.d = d0; + if (word0(&d) & Sign_bit) { + /* set sign for everything, including 0's and NaNs */ + *sign = 1; + word0(&d) &= ~Sign_bit; /* clear sign bit */ + } + else + *sign = 0; + +#if defined(IEEE_Arith) + defined(VAX) +#ifdef IEEE_Arith + if ((word0(&d) & Exp_mask) == Exp_mask) +#else + if (word0(&d) == 0x8000) +#endif + { + /* Infinity or NaN */ + *decpt = 9999; +#ifdef IEEE_Arith + if (!word1(&d) && !(word0(&d) & 0xfffff)) + return nrv_alloc("Infinity", rve, 8); +#endif + return nrv_alloc("NaN", rve, 3); + } +#endif +#ifdef IBM + dval(&d) += 0; /* normalize */ +#endif + if (!dval(&d)) { + *decpt = 1; + return nrv_alloc("0", rve, 1); + } + +#ifdef SET_INEXACT + try_quick = oldinexact = get_inexact(); + inexact = 1; +#endif +#ifdef Honor_FLT_ROUNDS + if (Rounding >= 2) { + if (*sign) + Rounding = Rounding == 2 ? 0 : 2; + else + if (Rounding != 2) + Rounding = 0; + } +#endif + + b = d2b(dval(&d), &be, &bbits); + if (b == NULL) + return (NULL); +#ifdef Sudden_Underflow + i = (int)(word0(&d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); +#else + if (( i = (int)(word0(&d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)) )!=0) { +#endif + dval(&d2) = dval(&d); + word0(&d2) &= Frac_mask1; + word0(&d2) |= Exp_11; +#ifdef IBM + if (( j = 11 - hi0bits(word0(&d2) & Frac_mask) )!=0) + dval(&d2) /= 1 << j; +#endif + + /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 + * log10(x) = log(x) / log(10) + * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) + * log10(&d) = (i-Bias)*log(2)/log(10) + log10(&d2) + * + * This suggests computing an approximation k to log10(&d) by + * + * k = (i - Bias)*0.301029995663981 + * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); + * + * We want k to be too large rather than too small. + * The error in the first-order Taylor series approximation + * is in our favor, so we just round up the constant enough + * to compensate for any error in the multiplication of + * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, + * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, + * adding 1e-13 to the constant term more than suffices. + * Hence we adjust the constant term to 0.1760912590558. + * (We could get a more accurate k by invoking log10, + * but this is probably not worthwhile.) + */ + + i -= Bias; +#ifdef IBM + i <<= 2; + i += j; +#endif +#ifndef Sudden_Underflow + denorm = 0; + } + else { + /* d is denormalized */ + + i = bbits + be + (Bias + (P-1) - 1); + x = i > 32 ? word0(&d) << (64 - i) | word1(&d) >> (i - 32) + : word1(&d) << (32 - i); + dval(&d2) = x; + word0(&d2) -= 31*Exp_msk1; /* adjust exponent */ + i -= (Bias + (P-1) - 1) + 1; + denorm = 1; + } +#endif + ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + k = (int)ds; + if (ds < 0. && ds != k) + k--; /* want k = floor(ds) */ + k_check = 1; + if (k >= 0 && k <= Ten_pmax) { + if (dval(&d) < tens[k]) + k--; + k_check = 0; + } + j = bbits - i - 1; + if (j >= 0) { + b2 = 0; + s2 = j; + } + else { + b2 = -j; + s2 = 0; + } + if (k >= 0) { + b5 = 0; + s5 = k; + s2 += k; + } + else { + b2 -= k; + b5 = -k; + s5 = 0; + } + if (mode < 0 || mode > 9) + mode = 0; + +#ifndef SET_INEXACT +#ifdef Check_FLT_ROUNDS + try_quick = Rounding == 1; +#else + try_quick = 1; +#endif +#endif /*SET_INEXACT*/ + + if (mode > 5) { + mode -= 4; + try_quick = 0; + } + leftright = 1; + ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ + /* silence erroneous "gcc -Wall" warning. */ + switch(mode) { + case 0: + case 1: + i = 18; + ndigits = 0; + break; + case 2: + leftright = 0; + /* no break */ + case 4: + if (ndigits <= 0) + ndigits = 1; + ilim = ilim1 = i = ndigits; + break; + case 3: + leftright = 0; + /* no break */ + case 5: + i = ndigits + k + 1; + ilim = i; + ilim1 = i - 1; + if (i <= 0) + i = 1; + } + s = s0 = rv_alloc(i); + if (s == NULL) + return (NULL); + +#ifdef Honor_FLT_ROUNDS + if (mode > 1 && Rounding != 1) + leftright = 0; +#endif + + if (ilim >= 0 && ilim <= Quick_max && try_quick) { + + /* Try to get by with floating-point arithmetic. */ + + i = 0; + dval(&d2) = dval(&d); + k0 = k; + ilim0 = ilim; + ieps = 2; /* conservative */ + if (k > 0) { + ds = tens[k&0xf]; + j = k >> 4; + if (j & Bletch) { + /* prevent overflows */ + j &= Bletch - 1; + dval(&d) /= bigtens[n_bigtens-1]; + ieps++; + } + for(; j; j >>= 1, i++) + if (j & 1) { + ieps++; + ds *= bigtens[i]; + } + dval(&d) /= ds; + } + else if (( j1 = -k )!=0) { + dval(&d) *= tens[j1 & 0xf]; + for(j = j1 >> 4; j; j >>= 1, i++) + if (j & 1) { + ieps++; + dval(&d) *= bigtens[i]; + } + } + if (k_check && dval(&d) < 1. && ilim > 0) { + if (ilim1 <= 0) + goto fast_failed; + ilim = ilim1; + k--; + dval(&d) *= 10.; + ieps++; + } + dval(&eps) = ieps*dval(&d) + 7.; + word0(&eps) -= (P-1)*Exp_msk1; + if (ilim == 0) { + S = mhi = 0; + dval(&d) -= 5.; + if (dval(&d) > dval(&eps)) + goto one_digit; + if (dval(&d) < -dval(&eps)) + goto no_digits; + goto fast_failed; + } +#ifndef No_leftright + if (leftright) { + /* Use Steele & White method of only + * generating digits needed. + */ + dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); + for(i = 0;;) { + L = dval(&d); + dval(&d) -= L; + *s++ = '0' + (int)L; + if (dval(&d) < dval(&eps)) + goto ret1; + if (1. - dval(&d) < dval(&eps)) + goto bump_up; + if (++i >= ilim) + break; + dval(&eps) *= 10.; + dval(&d) *= 10.; + } + } + else { +#endif + /* Generate ilim digits, then fix them up. */ + dval(&eps) *= tens[ilim-1]; + for(i = 1;; i++, dval(&d) *= 10.) { + L = (Long)(dval(&d)); + if (!(dval(&d) -= L)) + ilim = i; + *s++ = '0' + (int)L; + if (i == ilim) { + if (dval(&d) > 0.5 + dval(&eps)) + goto bump_up; + else if (dval(&d) < 0.5 - dval(&eps)) { + while(*--s == '0'); + s++; + goto ret1; + } + break; + } + } +#ifndef No_leftright + } +#endif + fast_failed: + s = s0; + dval(&d) = dval(&d2); + k = k0; + ilim = ilim0; + } + + /* Do we have a "small" integer? */ + + if (be >= 0 && k <= Int_max) { + /* Yes. */ + ds = tens[k]; + if (ndigits < 0 && ilim <= 0) { + S = mhi = 0; + if (ilim < 0 || dval(&d) <= 5*ds) + goto no_digits; + goto one_digit; + } + for(i = 1;; i++, dval(&d) *= 10.) { + L = (Long)(dval(&d) / ds); + dval(&d) -= L*ds; +#ifdef Check_FLT_ROUNDS + /* If FLT_ROUNDS == 2, L will usually be high by 1 */ + if (dval(&d) < 0) { + L--; + dval(&d) += ds; + } +#endif + *s++ = '0' + (int)L; + if (!dval(&d)) { +#ifdef SET_INEXACT + inexact = 0; +#endif + break; + } + if (i == ilim) { +#ifdef Honor_FLT_ROUNDS + if (mode > 1) + switch(Rounding) { + case 0: goto ret1; + case 2: goto bump_up; + } +#endif + dval(&d) += dval(&d); +#ifdef ROUND_BIASED + if (dval(&d) >= ds) +#else + if (dval(&d) > ds || (dval(&d) == ds && L & 1)) +#endif + { + bump_up: + while(*--s == '9') + if (s == s0) { + k++; + *s = '0'; + break; + } + ++*s++; + } + break; + } + } + goto ret1; + } + + m2 = b2; + m5 = b5; + mhi = mlo = 0; + if (leftright) { + i = +#ifndef Sudden_Underflow + denorm ? be + (Bias + (P-1) - 1 + 1) : +#endif +#ifdef IBM + 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); +#else + 1 + P - bbits; +#endif + b2 += i; + s2 += i; + mhi = i2b(1); + if (mhi == NULL) + return (NULL); + } + if (m2 > 0 && s2 > 0) { + i = m2 < s2 ? m2 : s2; + b2 -= i; + m2 -= i; + s2 -= i; + } + if (b5 > 0) { + if (leftright) { + if (m5 > 0) { + mhi = pow5mult(mhi, m5); + if (mhi == NULL) + return (NULL); + b1 = mult(mhi, b); + if (b1 == NULL) + return (NULL); + Bfree(b); + b = b1; + } + if (( j = b5 - m5 )!=0) { + b = pow5mult(b, j); + if (b == NULL) + return (NULL); + } + } + else { + b = pow5mult(b, b5); + if (b == NULL) + return (NULL); + } + } + S = i2b(1); + if (S == NULL) + return (NULL); + if (s5 > 0) { + S = pow5mult(S, s5); + if (S == NULL) + return (NULL); + } + + /* Check for special case that d is a normalized power of 2. */ + + spec_case = 0; + if ((mode < 2 || leftright) +#ifdef Honor_FLT_ROUNDS + && Rounding == 1 +#endif + ) { + if (!word1(&d) && !(word0(&d) & Bndry_mask) +#ifndef Sudden_Underflow + && word0(&d) & (Exp_mask & ~Exp_msk1) +#endif + ) { + /* The special case */ + b2 += Log2P; + s2 += Log2P; + spec_case = 1; + } + } + + /* Arrange for convenient computation of quotients: + * shift left if necessary so divisor has 4 leading 0 bits. + * + * Perhaps we should just compute leading 28 bits of S once + * and for all and pass them and a shift to quorem, so it + * can do shifts and ors to compute the numerator for q. + */ +#ifdef Pack_32 + if (( i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f )!=0) + i = 32 - i; +#else + if (( i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf )!=0) + i = 16 - i; +#endif + if (i > 4) { + i -= 4; + b2 += i; + m2 += i; + s2 += i; + } + else if (i < 4) { + i += 28; + b2 += i; + m2 += i; + s2 += i; + } + if (b2 > 0) { + b = lshift(b, b2); + if (b == NULL) + return (NULL); + } + if (s2 > 0) { + S = lshift(S, s2); + if (S == NULL) + return (NULL); + } + if (k_check) { + if (cmp(b,S) < 0) { + k--; + b = multadd(b, 10, 0); /* we botched the k estimate */ + if (b == NULL) + return (NULL); + if (leftright) { + mhi = multadd(mhi, 10, 0); + if (mhi == NULL) + return (NULL); + } + ilim = ilim1; + } + } + if (ilim <= 0 && (mode == 3 || mode == 5)) { + S = multadd(S,5,0); + if (S == NULL) + return (NULL); + if (ilim < 0 || cmp(b,S) <= 0) { + /* no digits, fcvt style */ + no_digits: + k = -1 - ndigits; + goto ret; + } + one_digit: + *s++ = '1'; + k++; + goto ret; + } + if (leftright) { + if (m2 > 0) { + mhi = lshift(mhi, m2); + if (mhi == NULL) + return (NULL); + } + + /* Compute mlo -- check for special case + * that d is a normalized power of 2. + */ + + mlo = mhi; + if (spec_case) { + mhi = Balloc(mhi->k); + if (mhi == NULL) + return (NULL); + Bcopy(mhi, mlo); + mhi = lshift(mhi, Log2P); + if (mhi == NULL) + return (NULL); + } + + for(i = 1;;i++) { + dig = quorem(b,S) + '0'; + /* Do we yet have the shortest decimal string + * that will round to d? + */ + j = cmp(b, mlo); + delta = diff(S, mhi); + if (delta == NULL) + return (NULL); + j1 = delta->sign ? 1 : cmp(b, delta); + Bfree(delta); +#ifndef ROUND_BIASED + if (j1 == 0 && mode != 1 && !(word1(&d) & 1) +#ifdef Honor_FLT_ROUNDS + && Rounding >= 1 +#endif + ) { + if (dig == '9') + goto round_9_up; + if (j > 0) + dig++; +#ifdef SET_INEXACT + else if (!b->x[0] && b->wds <= 1) + inexact = 0; +#endif + *s++ = dig; + goto ret; + } +#endif + if (j < 0 || (j == 0 && mode != 1 +#ifndef ROUND_BIASED + && !(word1(&d) & 1) +#endif + )) { + if (!b->x[0] && b->wds <= 1) { +#ifdef SET_INEXACT + inexact = 0; +#endif + goto accept_dig; + } +#ifdef Honor_FLT_ROUNDS + if (mode > 1) + switch(Rounding) { + case 0: goto accept_dig; + case 2: goto keep_dig; + } +#endif /*Honor_FLT_ROUNDS*/ + if (j1 > 0) { + b = lshift(b, 1); + if (b == NULL) + return (NULL); + j1 = cmp(b, S); +#ifdef ROUND_BIASED + if (j1 >= 0 /*)*/ +#else + if ((j1 > 0 || (j1 == 0 && dig & 1)) +#endif + && dig++ == '9') + goto round_9_up; + } + accept_dig: + *s++ = dig; + goto ret; + } + if (j1 > 0) { +#ifdef Honor_FLT_ROUNDS + if (!Rounding) + goto accept_dig; +#endif + if (dig == '9') { /* possible if i == 1 */ + round_9_up: + *s++ = '9'; + goto roundoff; + } + *s++ = dig + 1; + goto ret; + } +#ifdef Honor_FLT_ROUNDS + keep_dig: +#endif + *s++ = dig; + if (i == ilim) + break; + b = multadd(b, 10, 0); + if (b == NULL) + return (NULL); + if (mlo == mhi) { + mlo = mhi = multadd(mhi, 10, 0); + if (mlo == NULL) + return (NULL); + } + else { + mlo = multadd(mlo, 10, 0); + if (mlo == NULL) + return (NULL); + mhi = multadd(mhi, 10, 0); + if (mhi == NULL) + return (NULL); + } + } + } + else + for(i = 1;; i++) { + *s++ = dig = quorem(b,S) + '0'; + if (!b->x[0] && b->wds <= 1) { +#ifdef SET_INEXACT + inexact = 0; +#endif + goto ret; + } + if (i >= ilim) + break; + b = multadd(b, 10, 0); + if (b == NULL) + return (NULL); + } + + /* Round off last digit */ + +#ifdef Honor_FLT_ROUNDS + switch(Rounding) { + case 0: goto trimzeros; + case 2: goto roundoff; + } +#endif + b = lshift(b, 1); + if (b == NULL) + return (NULL); + j = cmp(b, S); +#ifdef ROUND_BIASED + if (j >= 0) +#else + if (j > 0 || (j == 0 && dig & 1)) +#endif + { + roundoff: + while(*--s == '9') + if (s == s0) { + k++; + *s++ = '1'; + goto ret; + } + ++*s++; + } + else { +#ifdef Honor_FLT_ROUNDS + trimzeros: +#endif + while(*--s == '0'); + s++; + } + ret: + Bfree(S); + if (mhi) { + if (mlo && mlo != mhi) + Bfree(mlo); + Bfree(mhi); + } + ret1: +#ifdef SET_INEXACT + if (inexact) { + if (!oldinexact) { + word0(&d) = Exp_1 + (70 << Exp_shift); + word1(&d) = 0; + dval(&d) += 1.; + } + } + else if (!oldinexact) + clear_inexact(); +#endif + Bfree(b); + *s = 0; + *decpt = k + 1; + if (rve) + *rve = s; + return s0; + } diff --git a/sdk/tlibc/gdtoa/gd_qnan.h b/sdk/tlibc/gdtoa/gd_qnan.h new file mode 100644 index 0000000000..87eba8fb31 --- /dev/null +++ b/sdk/tlibc/gdtoa/gd_qnan.h @@ -0,0 +1,12 @@ +#define f_QNAN 0xffc00000 +#define d_QNAN0 0x0 +#define d_QNAN1 0xfff80000 +#define ld_QNAN0 0x0 +#define ld_QNAN1 0xc0000000 +#define ld_QNAN2 0xffff +#define ld_QNAN3 0x0 +#define ldus_QNAN0 0x0 +#define ldus_QNAN1 0x0 +#define ldus_QNAN2 0x0 +#define ldus_QNAN3 0xc000 +#define ldus_QNAN4 0xffff diff --git a/sdk/tlibc/gdtoa/gdtoa.c b/sdk/tlibc/gdtoa/gdtoa.c new file mode 100644 index 0000000000..fd11de5600 --- /dev/null +++ b/sdk/tlibc/gdtoa/gdtoa.c @@ -0,0 +1,829 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 1999 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + static Bigint * +#ifdef KR_headers +bitstob(bits, nbits, bbits) ULong *bits; int nbits; int *bbits; +#else +bitstob(ULong *bits, int nbits, int *bbits) +#endif +{ + int i, k; + Bigint *b; + ULong *be, *x, *x0; + + i = ULbits; + k = 0; + while(i < nbits) { + i <<= 1; + k++; + } +#ifndef Pack_32 + if (!k) + k = 1; +#endif + b = Balloc(k); + if (b == NULL) + return (NULL); + be = bits + ((nbits - 1) >> kshift); + x = x0 = b->x; + do { + *x++ = *bits & ALL_ON; +#ifdef Pack_16 + *x++ = (*bits >> 16) & ALL_ON; +#endif + } while(++bits <= be); + i = x - x0; + while(!x0[--i]) + if (!i) { + b->wds = 0; + *bbits = 0; + goto ret; + } + b->wds = i + 1; + *bbits = i*ULbits + 32 - hi0bits(b->x[i]); + ret: + return b; + } + +/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. + * + * Inspired by "How to Print Floating-Point Numbers Accurately" by + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. + * + * Modifications: + * 1. Rather than iterating, we use a simple numeric overestimate + * to determine k = floor(log10(d)). We scale relevant + * quantities using O(log2(k)) rather than O(k) multiplications. + * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't + * try to generate digits strictly left to right. Instead, we + * compute with fewer bits and propagate the carry if necessary + * when rounding the final digit up. This is often faster. + * 3. Under the assumption that input will be rounded nearest, + * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. + * That is, we allow equality in stopping tests when the + * round-nearest rule will give the same floating-point value + * as would satisfaction of the stopping test with strict + * inequality. + * 4. We remove common factors of powers of 2 from relevant + * quantities. + * 5. When converting floating-point integers less than 1e16, + * we use floating-point arithmetic rather than resorting + * to multiple-precision integers. + * 6. When asked to produce fewer than 15 digits, we first try + * to get by with floating-point arithmetic; we resort to + * multiple-precision integer arithmetic only if we cannot + * guarantee that the floating-point calculation has given + * the correctly rounded result. For k requested digits and + * "uniformly" distributed input, the probability is + * something like 10^(k-15) that we must resort to the Long + * calculation. + */ + + char * +gdtoa +#ifdef KR_headers + (fpi, be, bits, kindp, mode, ndigits, decpt, rve) + FPI *fpi; int be; ULong *bits; + int *kindp, mode, ndigits, *decpt; char **rve; +#else + (FPI *fpi, int be, ULong *bits, int *kindp, int mode, int ndigits, int *decpt, char **rve) +#endif +{ + /* Arguments ndigits and decpt are similar to the second and third + arguments of ecvt and fcvt; trailing zeros are suppressed from + the returned string. If not null, *rve is set to point + to the end of the return value. If d is +-Infinity or NaN, + then *decpt is set to 9999. + be = exponent: value = (integer represented by bits) * (2 to the power of be). + + mode: + 0 ==> shortest string that yields d when read in + and rounded to nearest. + 1 ==> like 0, but with Steele & White stopping rule; + e.g. with IEEE P754 arithmetic , mode 0 gives + 1e23 whereas mode 1 gives 9.999999999999999e22. + 2 ==> max(1,ndigits) significant digits. This gives a + return value similar to that of ecvt, except + that trailing zeros are suppressed. + 3 ==> through ndigits past the decimal point. This + gives a return value similar to that from fcvt, + except that trailing zeros are suppressed, and + ndigits can be negative. + 4-9 should give the same return values as 2-3, i.e., + 4 <= mode <= 9 ==> same return as mode + 2 + (mode & 1). These modes are mainly for + debugging; often they run slower but sometimes + faster than modes 2-3. + 4,5,8,9 ==> left-to-right digit generation. + 6-9 ==> don't try fast floating-point estimate + (if applicable). + + Values of mode other than 0-9 are treated as mode 0. + + Sufficient space is allocated to the return value + to hold the suppressed trailing zeros. + */ + + int bbits, b2, b5, be0, dig, i, ieps, ilim, ilim0, ilim1, inex; + int j, j1, k, k0, k_check, kind, leftright, m2, m5, nbits; + int rdir, s2, s5, spec_case, try_quick; + Long L; + Bigint *b, *b1, *delta, *mlo, *mhi, *mhi1, *S; + double d2, ds; + char *s, *s0; + U d, eps; + +#ifndef MULTIPLE_THREADS + if (dtoa_result) { + freedtoa(dtoa_result); + dtoa_result = 0; + } +#endif + inex = 0; + kind = *kindp &= ~STRTOG_Inexact; + switch(kind & STRTOG_Retmask) { + case STRTOG_Zero: + goto ret_zero; + case STRTOG_Normal: + case STRTOG_Denormal: + break; + case STRTOG_Infinite: + *decpt = -32768; + return nrv_alloc("Infinity", rve, 8); + case STRTOG_NaN: + *decpt = -32768; + return nrv_alloc("NaN", rve, 3); + default: + return 0; + } + b = bitstob(bits, nbits = fpi->nbits, &bbits); + if (b == NULL) + return (NULL); + be0 = be; + if ( (i = trailz(b)) !=0) { + rshift(b, i); + be += i; + bbits -= i; + } + if (!b->wds) { + Bfree(b); + ret_zero: + *decpt = 1; + return nrv_alloc("0", rve, 1); + } + + dval(&d) = b2d(b, &i); + i = be + bbits - 1; + word0(&d) &= Frac_mask1; + word0(&d) |= Exp_11; +#ifdef IBM + if ( (j = 11 - hi0bits(word0(&d) & Frac_mask)) !=0) + dval(&d) /= 1 << j; +#endif + + /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 + * log10(x) = log(x) / log(10) + * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) + * log10(&d) = (i-Bias)*log(2)/log(10) + log10(d2) + * + * This suggests computing an approximation k to log10(&d) by + * + * k = (i - Bias)*0.301029995663981 + * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); + * + * We want k to be too large rather than too small. + * The error in the first-order Taylor series approximation + * is in our favor, so we just round up the constant enough + * to compensate for any error in the multiplication of + * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, + * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, + * adding 1e-13 to the constant term more than suffices. + * Hence we adjust the constant term to 0.1760912590558. + * (We could get a more accurate k by invoking log10, + * but this is probably not worthwhile.) + */ +#ifdef IBM + i <<= 2; + i += j; +#endif + ds = (dval(&d)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + + /* correct assumption about exponent range */ + if ((j = i) < 0) + j = -j; + if ((j -= 1077) > 0) + ds += j * 7e-17; + + k = (int)ds; + if (ds < 0. && ds != k) + k--; /* want k = floor(ds) */ + k_check = 1; +#ifdef IBM + j = be + bbits - 1; + if ( (j1 = j & 3) !=0) + dval(&d) *= 1 << j1; + word0(&d) += j << Exp_shift - 2 & Exp_mask; +#else + word0(&d) += (be + bbits - 1) << Exp_shift; +#endif + if (k >= 0 && k <= Ten_pmax) { + if (dval(&d) < tens[k]) + k--; + k_check = 0; + } + j = bbits - i - 1; + if (j >= 0) { + b2 = 0; + s2 = j; + } + else { + b2 = -j; + s2 = 0; + } + if (k >= 0) { + b5 = 0; + s5 = k; + s2 += k; + } + else { + b2 -= k; + b5 = -k; + s5 = 0; + } + if (mode < 0 || mode > 9) + mode = 0; + try_quick = 1; + if (mode > 5) { + mode -= 4; + try_quick = 0; + } + else if (i >= -4 - Emin || i < Emin) + try_quick = 0; + leftright = 1; + ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ + /* silence erroneous "gcc -Wall" warning. */ + switch(mode) { + case 0: + case 1: + i = (int)(nbits * .30103) + 3; + ndigits = 0; + break; + case 2: + leftright = 0; + /* no break */ + case 4: + if (ndigits <= 0) + ndigits = 1; + ilim = ilim1 = i = ndigits; + break; + case 3: + leftright = 0; + /* no break */ + case 5: + i = ndigits + k + 1; + ilim = i; + ilim1 = i - 1; + if (i <= 0) + i = 1; + } + s = s0 = rv_alloc(i); + if (s == NULL) + return (NULL); + + if ( (rdir = fpi->rounding - 1) !=0) { + if (rdir < 0) + rdir = 2; + if (kind & STRTOG_Neg) + rdir = 3 - rdir; + } + + /* Now rdir = 0 ==> round near, 1 ==> round up, 2 ==> round down. */ + + if (ilim >= 0 && ilim <= Quick_max && try_quick && !rdir +#ifndef IMPRECISE_INEXACT + && k == 0 +#endif + ) { + + /* Try to get by with floating-point arithmetic. */ + + i = 0; + d2 = dval(&d); +#ifdef IBM + if ( (j = 11 - hi0bits(word0(&d) & Frac_mask)) !=0) + dval(&d) /= 1 << j; +#endif + k0 = k; + ilim0 = ilim; + ieps = 2; /* conservative */ + if (k > 0) { + ds = tens[k&0xf]; + j = k >> 4; + if (j & Bletch) { + /* prevent overflows */ + j &= Bletch - 1; + dval(&d) /= bigtens[n_bigtens-1]; + ieps++; + } + for(; j; j >>= 1, i++) + if (j & 1) { + ieps++; + ds *= bigtens[i]; + } + } + else { + ds = 1.; + if ( (j1 = -k) !=0) { + dval(&d) *= tens[j1 & 0xf]; + for(j = j1 >> 4; j; j >>= 1, i++) + if (j & 1) { + ieps++; + dval(&d) *= bigtens[i]; + } + } + } + if (k_check && dval(&d) < 1. && ilim > 0) { + if (ilim1 <= 0) + goto fast_failed; + ilim = ilim1; + k--; + dval(&d) *= 10.; + ieps++; + } + dval(&eps) = ieps*dval(&d) + 7.; + word0(&eps) -= (P-1)*Exp_msk1; + if (ilim == 0) { + S = mhi = 0; + dval(&d) -= 5.; + if (dval(&d) > dval(&eps)) + goto one_digit; + if (dval(&d) < -dval(&eps)) + goto no_digits; + goto fast_failed; + } +#ifndef No_leftright + if (leftright) { + /* Use Steele & White method of only + * generating digits needed. + */ + dval(&eps) = ds*0.5/tens[ilim-1] - dval(&eps); + for(i = 0;;) { + L = (Long)(dval(&d)/ds); + dval(&d) -= L*ds; + *s++ = '0' + (int)L; + if (dval(&d) < dval(&eps)) { + if (dval(&d)) + inex = STRTOG_Inexlo; + goto ret1; + } + if (ds - dval(&d) < dval(&eps)) + goto bump_up; + if (++i >= ilim) + break; + dval(&eps) *= 10.; + dval(&d) *= 10.; + } + } + else { +#endif + /* Generate ilim digits, then fix them up. */ + dval(&eps) *= tens[ilim-1]; + for(i = 1;; i++, dval(&d) *= 10.) { + if ( (L = (Long)(dval(&d)/ds)) !=0) + dval(&d) -= L*ds; + *s++ = '0' + (int)L; + if (i == ilim) { + ds *= 0.5; + if (dval(&d) > ds + dval(&eps)) + goto bump_up; + else if (dval(&d) < ds - dval(&eps)) { + if (dval(&d)) + inex = STRTOG_Inexlo; + goto clear_trailing0; + } + break; + } + } +#ifndef No_leftright + } +#endif + fast_failed: + s = s0; + dval(&d) = d2; + k = k0; + ilim = ilim0; + } + + /* Do we have a "small" integer? */ + + if (be >= 0 && k <= Int_max) { + /* Yes. */ + ds = tens[k]; + if (ndigits < 0 && ilim <= 0) { + S = mhi = 0; + if (ilim < 0 || dval(&d) <= 5*ds) + goto no_digits; + goto one_digit; + } + for(i = 1;; i++, dval(&d) *= 10.) { + L = dval(&d) / ds; + dval(&d) -= L*ds; +#ifdef Check_FLT_ROUNDS + /* If FLT_ROUNDS == 2, L will usually be high by 1 */ + if (dval(&d) < 0) { + L--; + dval(&d) += ds; + } +#endif + *s++ = '0' + (int)L; + if (dval(&d) == 0.) + break; + if (i == ilim) { + if (rdir) { + if (rdir == 1) + goto bump_up; + inex = STRTOG_Inexlo; + goto ret1; + } + dval(&d) += dval(&d); +#ifdef ROUND_BIASED + if (dval(&d) >= ds) +#else + if (dval(&d) > ds || (dval(&d) == ds && L & 1)) +#endif + { + bump_up: + inex = STRTOG_Inexhi; + while(*--s == '9') + if (s == s0) { + k++; + *s = '0'; + break; + } + ++*s++; + } + else { + inex = STRTOG_Inexlo; + clear_trailing0: + while(*--s == '0'){} + ++s; + } + break; + } + } + goto ret1; + } + + m2 = b2; + m5 = b5; + mhi = mlo = 0; + if (leftright) { + i = nbits - bbits; + if (be - i++ < fpi->emin && mode != 3 && mode != 5) { + /* denormal */ + i = be - fpi->emin + 1; + if (mode >= 2 && ilim > 0 && ilim < i) + goto small_ilim; + } + else if (mode >= 2) { + small_ilim: + j = ilim - 1; + if (m5 >= j) + m5 -= j; + else { + s5 += j -= m5; + b5 += j; + m5 = 0; + } + if ((i = ilim) < 0) { + m2 -= i; + i = 0; + } + } + b2 += i; + s2 += i; + mhi = i2b(1); + if (mhi == NULL) + return (NULL); + } + if (m2 > 0 && s2 > 0) { + i = m2 < s2 ? m2 : s2; + b2 -= i; + m2 -= i; + s2 -= i; + } + if (b5 > 0) { + if (leftright) { + if (m5 > 0) { + mhi = pow5mult(mhi, m5); + if (mhi == NULL) + return (NULL); + b1 = mult(mhi, b); + if (b1 == NULL) + return (NULL); + Bfree(b); + b = b1; + } + if ( (j = b5 - m5) !=0) { + b = pow5mult(b, j); + if (b == NULL) + return (NULL); + } + } + else { + b = pow5mult(b, b5); + if (b == NULL) + return (NULL); + } + } + S = i2b(1); + if (S == NULL) + return (NULL); + if (s5 > 0) { + S = pow5mult(S, s5); + if (S == NULL) + return (NULL); + } + + /* Check for special case that d is a normalized power of 2. */ + + spec_case = 0; + if (mode < 2) { + if (bbits == 1 && be0 > fpi->emin + 1) { + /* The special case */ + b2++; + s2++; + spec_case = 1; + } + } + + /* Arrange for convenient computation of quotients: + * shift left if necessary so divisor has 4 leading 0 bits. + * + * Perhaps we should just compute leading 28 bits of S once + * and for all and pass them and a shift to quorem, so it + * can do shifts and ors to compute the numerator for q. + */ + i = ((s5 ? hi0bits(S->x[S->wds-1]) : ULbits - 1) - s2 - 4) & kmask; + m2 += i; + if ((b2 += i) > 0) { + b = lshift(b, b2); + if (b == NULL) + return (NULL); + } + if ((s2 += i) > 0) { + S = lshift(S, s2); + if (S == NULL) + return (NULL); + } + if (k_check) { + if (cmp(b,S) < 0) { + k--; + b = multadd(b, 10, 0); /* we botched the k estimate */ + if (b == NULL) + return (NULL); + if (leftright) { + mhi = multadd(mhi, 10, 0); + if (mhi == NULL) + return (NULL); + } + ilim = ilim1; + } + } + if (ilim <= 0 && mode > 2) { + S = multadd(S,5,0); + if (S == NULL) + return (NULL); + if (ilim < 0 || cmp(b,S) <= 0) { + /* no digits, fcvt style */ + no_digits: + k = -1 - ndigits; + inex = STRTOG_Inexlo; + goto ret; + } + one_digit: + inex = STRTOG_Inexhi; + *s++ = '1'; + k++; + goto ret; + } + if (leftright) { + if (m2 > 0) { + mhi = lshift(mhi, m2); + if (mhi == NULL) + return (NULL); + } + + /* Compute mlo -- check for special case + * that d is a normalized power of 2. + */ + + mlo = mhi; + if (spec_case) { + mhi = Balloc(mhi->k); + if (mhi == NULL) + return (NULL); + Bcopy(mhi, mlo); + mhi = lshift(mhi, 1); + if (mhi == NULL) + return (NULL); + } + + for(i = 1;;i++) { + dig = quorem(b,S) + '0'; + /* Do we yet have the shortest decimal string + * that will round to d? + */ + j = cmp(b, mlo); + delta = diff(S, mhi); + if (delta == NULL) + return (NULL); + j1 = delta->sign ? 1 : cmp(b, delta); + Bfree(delta); +#ifndef ROUND_BIASED + if (j1 == 0 && !mode && !(bits[0] & 1) && !rdir) { + if (dig == '9') + goto round_9_up; + if (j <= 0) { + if (b->wds > 1 || b->x[0]) + inex = STRTOG_Inexlo; + } + else { + dig++; + inex = STRTOG_Inexhi; + } + *s++ = dig; + goto ret; + } +#endif + if (j < 0 || (j == 0 && !mode +#ifndef ROUND_BIASED + && !(bits[0] & 1) +#endif + )) { + if (rdir && (b->wds > 1 || b->x[0])) { + if (rdir == 2) { + inex = STRTOG_Inexlo; + goto accept; + } + while (cmp(S,mhi) > 0) { + *s++ = dig; + mhi1 = multadd(mhi, 10, 0); + if (mhi1 == NULL) + return (NULL); + if (mlo == mhi) + mlo = mhi1; + mhi = mhi1; + b = multadd(b, 10, 0); + if (b == NULL) + return (NULL); + dig = quorem(b,S) + '0'; + } + if (dig++ == '9') + goto round_9_up; + inex = STRTOG_Inexhi; + goto accept; + } + if (j1 > 0) { + b = lshift(b, 1); + if (b == NULL) + return (NULL); + j1 = cmp(b, S); +#ifdef ROUND_BIASED + if (j1 >= 0 /*)*/ +#else + if ((j1 > 0 || (j1 == 0 && dig & 1)) +#endif + && dig++ == '9') + goto round_9_up; + inex = STRTOG_Inexhi; + } + if (b->wds > 1 || b->x[0]) + inex = STRTOG_Inexlo; + accept: + *s++ = dig; + goto ret; + } + if (j1 > 0 && rdir != 2) { + if (dig == '9') { /* possible if i == 1 */ + round_9_up: + *s++ = '9'; + inex = STRTOG_Inexhi; + goto roundoff; + } + inex = STRTOG_Inexhi; + *s++ = dig + 1; + goto ret; + } + *s++ = dig; + if (i == ilim) + break; + b = multadd(b, 10, 0); + if (b == NULL) + return (NULL); + if (mlo == mhi) { + mlo = mhi = multadd(mhi, 10, 0); + if (mlo == NULL) + return (NULL); + } + else { + mlo = multadd(mlo, 10, 0); + if (mlo == NULL) + return (NULL); + mhi = multadd(mhi, 10, 0); + if (mhi == NULL) + return (NULL); + } + } + } + else + for(i = 1;; i++) { + *s++ = dig = quorem(b,S) + '0'; + if (i >= ilim) + break; + b = multadd(b, 10, 0); + if (b == NULL) + return (NULL); + } + + /* Round off last digit */ + + if (rdir) { + if (rdir == 2 || (b->wds <= 1 && !b->x[0])) + goto chopzeros; + goto roundoff; + } + b = lshift(b, 1); + if (b == NULL) + return (NULL); + j = cmp(b, S); +#ifdef ROUND_BIASED + if (j >= 0) +#else + if (j > 0 || (j == 0 && dig & 1)) +#endif + { + roundoff: + inex = STRTOG_Inexhi; + while(*--s == '9') + if (s == s0) { + k++; + *s++ = '1'; + goto ret; + } + ++*s++; + } + else { + chopzeros: + if (b->wds > 1 || b->x[0]) + inex = STRTOG_Inexlo; + while(*--s == '0'){} + ++s; + } + ret: + Bfree(S); + if (mhi) { + if (mlo && mlo != mhi) + Bfree(mlo); + Bfree(mhi); + } + ret1: + Bfree(b); + *s = 0; + *decpt = k + 1; + if (rve) + *rve = s; + *kindp |= inex; + return s0; + } diff --git a/sdk/tlibc/gdtoa/gdtoa.h b/sdk/tlibc/gdtoa/gdtoa.h new file mode 100644 index 0000000000..d587bcba49 --- /dev/null +++ b/sdk/tlibc/gdtoa/gdtoa.h @@ -0,0 +1,118 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#ifndef GDTOA_H_INCLUDED +#define GDTOA_H_INCLUDED + +#include "arith.h" +#include /* for size_t */ + +#ifndef Long +#define Long int +#endif +#ifndef ULong +typedef unsigned Long ULong; +#endif +#ifndef UShort +typedef unsigned short UShort; +#endif + +#ifndef ANSI +#ifdef KR_headers +#define ANSI(x) () +#define Void /*nothing*/ +#else +#define ANSI(x) x +#define Void void +#endif +#endif /* ANSI */ + +#ifndef CONST +#ifdef KR_headers +#define CONST /* blank */ +#else +#define CONST const +#endif +#endif /* CONST */ + + enum { /* return values from strtodg */ + STRTOG_Zero = 0x000, + STRTOG_Normal = 0x001, + STRTOG_Denormal = 0x002, + STRTOG_Infinite = 0x003, + STRTOG_NaN = 0x004, + STRTOG_NaNbits = 0x005, + STRTOG_NoNumber = 0x006, + STRTOG_NoMemory = 0x007, + STRTOG_Retmask = 0x00f, + + /* The following may be or-ed into one of the above values. */ + + STRTOG_Inexlo = 0x010, /* returned result rounded toward zero */ + STRTOG_Inexhi = 0x020, /* returned result rounded away from zero */ + STRTOG_Inexact = 0x030, + STRTOG_Underflow= 0x040, + STRTOG_Overflow = 0x080, + STRTOG_Neg = 0x100 /* does not affect STRTOG_Inexlo or STRTOG_Inexhi */ + }; + + typedef struct +FPI { + int nbits; + int emin; + int emax; + int rounding; + int sudden_underflow; + } FPI; + +enum { /* FPI.rounding values: same as FLT_ROUNDS */ + FPI_Round_zero = 0, + FPI_Round_near = 1, + FPI_Round_up = 2, + FPI_Round_down = 3 + }; + +#ifdef __cplusplus +extern "C" { +#endif + +extern char* __dtoa ANSI((double d, int mode, int ndigits, int *decpt, + int *sign, char **rve)); +extern char* __gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp, + int mode, int ndigits, int *decpt, char **rve)); +extern void __freedtoa ANSI((char*)); +extern int __strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*)); +extern int __strtorx ANSI((CONST char*, char**, int, void*)); + +#ifdef __cplusplus +} +#endif +#endif /* GDTOA_H_INCLUDED */ diff --git a/sdk/tlibc/gdtoa/gdtoaimp.h b/sdk/tlibc/gdtoa/gdtoaimp.h new file mode 100644 index 0000000000..a309ee65db --- /dev/null +++ b/sdk/tlibc/gdtoa/gdtoaimp.h @@ -0,0 +1,627 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998-2000 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* This is a variation on dtoa.c that converts arbitary binary + floating-point formats to and from decimal notation. It uses + double-precision arithmetic internally, so there are still + various #ifdefs that adapt the calculations to the native + double-precision arithmetic (any of IEEE, VAX D_floating, + or IBM mainframe arithmetic). + + Please send bug reports to David M. Gay (dmg at acm dot org, + with " at " changed at "@" and " dot " changed to "."). + */ + +/* On a machine with IEEE extended-precision registers, it is + * necessary to specify double-precision (53-bit) rounding precision + * before invoking strtod or dtoa. If the machine uses (the equivalent + * of) Intel 80x87 arithmetic, the call + * _control87(PC_53, MCW_PC); + * does this with many compilers. Whether this or another call is + * appropriate depends on the compiler; for this to work, it may be + * necessary to #include "float.h" or another system-dependent header + * file. + */ + +/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. + * + * This strtod returns a nearest machine number to the input decimal + * string (or sets errno to ERANGE). With IEEE arithmetic, ties are + * broken by the IEEE round-even rule. Otherwise ties are broken by + * biased rounding (add half and chop). + * + * Inspired loosely by William D. Clinger's paper "How to Read Floating + * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 112-126]. + * + * Modifications: + * + * 1. We only require IEEE, IBM, or VAX double-precision + * arithmetic (not IEEE double-extended). + * 2. We get by with floating-point arithmetic in a case that + * Clinger missed -- when we're computing d * 10^n + * for a small integer d and the integer n is not too + * much larger than 22 (the maximum integer k for which + * we can represent 10^k exactly), we may be able to + * compute (d*10^k) * 10^(e-k) with just one roundoff. + * 3. Rather than a bit-at-a-time adjustment of the binary + * result in the hard case, we use floating-point + * arithmetic to determine the adjustment to within + * one bit; only in really hard cases do we need to + * compute a second residual. + * 4. Because of 3., we don't need a large table of powers of 10 + * for ten-to-e (just some small tables, e.g. of 10^k + * for 0 <= k <= 22). + */ + +/* + * #define IEEE_8087 for IEEE-arithmetic machines where the least + * significant byte has the lowest address. + * #define IEEE_MC68k for IEEE-arithmetic machines where the most + * significant byte has the lowest address. + * #define Long int on machines with 32-bit ints and 64-bit longs. + * #define Sudden_Underflow for IEEE-format machines without gradual + * underflow (i.e., that flush to zero on underflow). + * #define IBM for IBM mainframe-style floating-point arithmetic. + * #define VAX for VAX-style floating-point arithmetic (D_floating). + * #define No_leftright to omit left-right logic in fast floating-point + * computation of dtoa and gdtoa. This will cause modes 4 and 5 to be + * treated the same as modes 2 and 3 for some inputs. + * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3. + * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines + * that use extended-precision instructions to compute rounded + * products and quotients) with IBM. + * #define ROUND_BIASED for IEEE-format with biased rounding and arithmetic + * that rounds toward +Infinity. + * #define ROUND_BIASED_without_Round_Up for IEEE-format with biased + * rounding when the underlying floating-point arithmetic uses + * unbiased rounding. This prevent using ordinary floating-point + * arithmetic when the result could be computed with one rounding error. + * #define Inaccurate_Divide for IEEE-format with correctly rounded + * products but inaccurate quotients, e.g., for Intel i860. + * #define NO_LONG_LONG on machines that do not have a "long long" + * integer type (of >= 64 bits). On such machines, you can + * #define Just_16 to store 16 bits per 32-bit Long when doing + * high-precision integer arithmetic. Whether this speeds things + * up or slows things down depends on the machine and the number + * being converted. If long long is available and the name is + * something other than "long long", #define Llong to be the name, + * and if "unsigned Llong" does not work as an unsigned version of + * Llong, #define #ULLong to be the corresponding unsigned type. + * #define KR_headers for old-style C function headers. + * #define Bad_float_h if your system lacks a float.h or if it does not + * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, + * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. + * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) + * if memory is available and otherwise does something you deem + * appropriate. If MALLOC is undefined, malloc will be invoked + * directly -- and assumed always to succeed. Similarly, if you + * want something other than the system's free() to be called to + * recycle memory acquired from MALLOC, #define FREE to be the + * name of the alternate routine. (FREE or free is only called in + * pathological cases, e.g., in a gdtoa call after a gdtoa return in + * mode 3 with thousands of digits requested.) + * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making + * memory allocations from a private pool of memory when possible. + * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes, + * unless #defined to be a different length. This default length + * suffices to get rid of MALLOC calls except for unusual cases, + * such as decimal-to-binary conversion of a very long string of + * digits. When converting IEEE double precision values, the + * longest string gdtoa can return is about 751 bytes long. For + * conversions by strtod of strings of 800 digits and all gdtoa + * conversions of IEEE doubles in single-threaded executions with + * 8-byte pointers, PRIVATE_MEM >= 7400 appears to suffice; with + * 4-byte pointers, PRIVATE_MEM >= 7112 appears adequate. + * #define NO_INFNAN_CHECK if you do not wish to have INFNAN_CHECK + * #defined automatically on IEEE systems. On such systems, + * when INFNAN_CHECK is #defined, strtod checks + * for Infinity and NaN (case insensitively). + * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, + * strtodg also accepts (case insensitively) strings of the form + * NaN(x), where x is a string of hexadecimal digits (optionally + * preceded by 0x or 0X) and spaces; if there is only one string + * of hexadecimal digits, it is taken for the fraction bits of the + * resulting NaN; if there are two or more strings of hexadecimal + * digits, each string is assigned to the next available sequence + * of 32-bit words of fractions bits (starting with the most + * significant), right-aligned in each sequence. + * Unless GDTOA_NON_PEDANTIC_NANCHECK is #defined, input "NaN(...)" + * is consumed even when ... has the wrong form (in which case the + * "(...)" is consumed but ignored). + * #define MULTIPLE_THREADS if the system offers preemptively scheduled + * multiple threads. In this case, you must provide (or suitably + * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed + * by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed + * in pow5mult, ensures lazy evaluation of only one copy of high + * powers of 5; omitting this lock would introduce a small + * probability of wasting memory, but would otherwise be harmless.) + * You must also invoke freedtoa(s) to free the value s returned by + * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined. + * #define IMPRECISE_INEXACT if you do not care about the setting of + * the STRTOG_Inexact bits in the special case of doing IEEE double + * precision conversions (which could also be done by the strtod in + * dtoa.c). + * #define NO_HEX_FP to disable recognition of C9x's hexadecimal + * floating-point constants. + * #define -DNO_ERRNO to suppress setting errno (in strtod.c and + * strtodg.c). + * #define NO_STRING_H to use private versions of memcpy. + * On some K&R systems, it may also be necessary to + * #define DECLARE_SIZE_T in this case. + * #define USE_LOCALE to use the current locale's decimal_point value. + */ + +#ifndef GDTOAIMP_H_INCLUDED +#define GDTOAIMP_H_INCLUDED +#include "gdtoa.h" +#include "gd_qnan.h" +#ifdef Honor_FLT_ROUNDS +#include +#endif + +#ifdef DEBUG +#include "stdio.h" +#define Bug(x) //{fprintf(stderr, "%s\n", x); exit(1);} +#endif + +#include "stdlib.h" +#include "string.h" + +#ifdef KR_headers +#define Char char +#else +#define Char void +#endif + +#ifdef MALLOC +extern Char *MALLOC ANSI((size_t)); +#else +#define MALLOC malloc +#endif + +#undef IEEE_Arith +#undef Avoid_Underflow +#ifdef IEEE_MC68k +#define IEEE_Arith +#endif +#ifdef IEEE_8087 +#define IEEE_Arith +#endif + +#include "errno.h" +#ifdef Bad_float_h + +#ifdef IEEE_Arith +#define DBL_DIG 15 +#define DBL_MAX_10_EXP 308 +#define DBL_MAX_EXP 1024 +#define FLT_RADIX 2 +#define DBL_MAX 1.7976931348623157e+308 +#endif + +#ifdef IBM +#define DBL_DIG 16 +#define DBL_MAX_10_EXP 75 +#define DBL_MAX_EXP 63 +#define FLT_RADIX 16 +#define DBL_MAX 7.2370055773322621e+75 +#endif + +#ifdef VAX +#define DBL_DIG 16 +#define DBL_MAX_10_EXP 38 +#define DBL_MAX_EXP 127 +#define FLT_RADIX 2 +#define DBL_MAX 1.7014118346046923e+38 +#define n_bigtens 2 +#endif + +#ifndef LONG_MAX +#define LONG_MAX 2147483647 +#endif + +#else /* ifndef Bad_float_h */ +#include "float.h" +#endif /* Bad_float_h */ + +#ifdef IEEE_Arith +#define Scale_Bit 0x10 +#define n_bigtens 5 +#endif + +#ifdef IBM +#define n_bigtens 3 +#endif + +#ifdef VAX +#define n_bigtens 2 +#endif + +#ifndef __MATH_H__ +#include "math.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 +Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. +#endif + +typedef union { double d; ULong L[2]; } U; + +#ifdef IEEE_8087 +#define word0(x) (x)->L[1] +#define word1(x) (x)->L[0] +#else +#define word0(x) (x)->L[0] +#define word1(x) (x)->L[1] +#endif +#define dval(x) (x)->d + +/* The following definition of Storeinc is appropriate for MIPS processors. + * An alternative that might be better on some machines is + * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) + */ +#if defined(IEEE_8087) + defined(VAX) +#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ +((unsigned short *)a)[0] = (unsigned short)c, a++) +#else +#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ +((unsigned short *)a)[1] = (unsigned short)c, a++) +#endif + +/* #define P DBL_MANT_DIG */ +/* Ten_pmax = floor(P*log(2)/log(5)) */ +/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ +/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ +/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ + +#ifdef IEEE_Arith +#define Exp_shift 20 +#define Exp_shift1 20 +#define Exp_msk1 0x100000 +#define Exp_msk11 0x100000 +#define Exp_mask 0x7ff00000 +#define P 53 +#define Bias 1023 +#define Emin (-1022) +#define Exp_1 0x3ff00000 +#define Exp_11 0x3ff00000 +#define Ebits 11 +#define Frac_mask 0xfffff +#define Frac_mask1 0xfffff +#define Ten_pmax 22 +#define Bletch 0x10 +#define Bndry_mask 0xfffff +#define Bndry_mask1 0xfffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 1 +#define Tiny0 0 +#define Tiny1 1 +#define Quick_max 14 +#define Int_max 14 + +#ifndef Flt_Rounds +#ifdef FLT_ROUNDS +#define Flt_Rounds FLT_ROUNDS +#else +#define Flt_Rounds 1 +#endif +#endif /*Flt_Rounds*/ + +#else /* ifndef IEEE_Arith */ +#undef Sudden_Underflow +#define Sudden_Underflow +#ifdef IBM +#undef Flt_Rounds +#define Flt_Rounds 0 +#define Exp_shift 24 +#define Exp_shift1 24 +#define Exp_msk1 0x1000000 +#define Exp_msk11 0x1000000 +#define Exp_mask 0x7f000000 +#define P 14 +#define Bias 65 +#define Exp_1 0x41000000 +#define Exp_11 0x41000000 +#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ +#define Frac_mask 0xffffff +#define Frac_mask1 0xffffff +#define Bletch 4 +#define Ten_pmax 22 +#define Bndry_mask 0xefffff +#define Bndry_mask1 0xffffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 4 +#define Tiny0 0x100000 +#define Tiny1 0 +#define Quick_max 14 +#define Int_max 15 +#else /* VAX */ +#undef Flt_Rounds +#define Flt_Rounds 1 +#define Exp_shift 23 +#define Exp_shift1 7 +#define Exp_msk1 0x80 +#define Exp_msk11 0x800000 +#define Exp_mask 0x7f80 +#define P 56 +#define Bias 129 +#define Emin (-127) +#define Exp_1 0x40800000 +#define Exp_11 0x4080 +#define Ebits 8 +#define Frac_mask 0x7fffff +#define Frac_mask1 0xffff007f +#define Ten_pmax 24 +#define Bletch 2 +#define Bndry_mask 0xffff007f +#define Bndry_mask1 0xffff007f +#define LSB 0x10000 +#define Sign_bit 0x8000 +#define Log2P 1 +#define Tiny0 0x80 +#define Tiny1 0 +#define Quick_max 15 +#define Int_max 15 +#endif /* IBM, VAX */ +#endif /* IEEE_Arith */ + +#ifndef IEEE_Arith +#define ROUND_BIASED +#else +#ifdef ROUND_BIASED_without_Round_Up +#undef ROUND_BIASED +#define ROUND_BIASED +#endif +#endif + +#ifdef RND_PRODQUOT +#define rounded_product(a,b) a = rnd_prod(a, b) +#define rounded_quotient(a,b) a = rnd_quot(a, b) +#ifdef KR_headers +extern double rnd_prod(), rnd_quot(); +#else +extern double rnd_prod(double, double), rnd_quot(double, double); +#endif +#else +#define rounded_product(a,b) a *= b +#define rounded_quotient(a,b) a /= b +#endif + +#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) +#define Big1 0xffffffff + +#undef Pack_16 +#ifndef Pack_32 +#define Pack_32 +#endif + +#ifdef NO_LONG_LONG +#undef ULLong +#ifdef Just_16 +#undef Pack_32 +#define Pack_16 +/* When Pack_32 is not defined, we store 16 bits per 32-bit Long. + * This makes some inner loops simpler and sometimes saves work + * during multiplications, but it often seems to make things slightly + * slower. Hence the default is now to store 32 bits per Long. + */ +#endif +#else /* long long available */ +#ifndef Llong +#define Llong long long +#endif +#ifndef ULLong +#define ULLong unsigned Llong +#endif +#endif /* NO_LONG_LONG */ + +#ifdef Pack_32 +#define ULbits 32 +#define kshift 5 +#define kmask 31 +#define ALL_ON 0xffffffff +#else +#define ULbits 16 +#define kshift 4 +#define kmask 15 +#define ALL_ON 0xffff +#endif + +#ifndef MULTIPLE_THREADS +#define ACQUIRE_DTOA_LOCK(n) /*nothing*/ +#define FREE_DTOA_LOCK(n) /*nothing*/ +#else +#include "sgx_spinlock.h" +extern sgx_spinlock_t __dtoa_locks[]; +#define ACQUIRE_DTOA_LOCK(n) sgx_spin_lock(&__dtoa_locks[n]) +#define FREE_DTOA_LOCK(n) sgx_spin_unlock(&__dtoa_locks[n]) +#endif + +#define Kmax 9 + + struct +Bigint { + struct Bigint *next; + int k, maxwds, sign, wds; + ULong x[1]; + }; + + typedef struct Bigint Bigint; + +#ifdef NO_STRING_H +#ifdef DECLARE_SIZE_T +typedef unsigned int size_t; +#endif +extern void memcpy_D2A ANSI((void*, const void*, size_t)); +#define Bcopy(x,y) memcpy_D2A(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int)) +#else /* !NO_STRING_H */ +#define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int)) +#endif /* NO_STRING_H */ + +#define dtoa __dtoa +#define gdtoa __gdtoa +#define freedtoa __freedtoa +#define strtodg __strtodg +#define strtorx __strtorx + +#define Balloc __Balloc_D2A +#define Bfree __Bfree_D2A +#define ULtod __ULtod_D2A +#define ULtox __ULtox_D2A +#define any_on __any_on_D2A +#define b2d __b2d_D2A +#define bigtens __bigtens_D2A +#define cmp __cmp_D2A +#define copybits __copybits_D2A +#define d2b __d2b_D2A +#define decrement __decrement_D2A +#define diff __diff_D2A +#define dtoa_result __dtoa_result_D2A +#define gethex __gethex_D2A +#define hexdig __hexdig_D2A +#define hexnan __hexnan_D2A +#define hi0bits(x) __hi0bits_D2A((ULong)(x)) +#define hi0bits_D2A __hi0bits_D2A +#define i2b __i2b_D2A +#define increment __increment_D2A +#define lo0bits __lo0bits_D2A +#define lshift __lshift_D2A +#define match __match_D2A +#define mult __mult_D2A +#define multadd __multadd_D2A +#define nrv_alloc __nrv_alloc_D2A +#define pow5mult __pow5mult_D2A +#define quorem __quorem_D2A +#define ratio __ratio_D2A +#define rshift __rshift_D2A +#define rv_alloc __rv_alloc_D2A +#define s2b __s2b_D2A +#define set_ones __set_ones_D2A +#define sum __sum_D2A +#define tens __tens_D2A +#define tinytens __tinytens_D2A +#define trailz __trailz_D2A +#define ulp __ulp_D2A + + extern char *dtoa_result; + extern CONST double bigtens[], tens[], tinytens[]; + extern unsigned char hexdig[]; + + extern Bigint *Balloc ANSI((int)); + extern void Bfree ANSI((Bigint*)); + extern void ULtod ANSI((ULong*, ULong*, Long, int)); + extern void ULtox ANSI((UShort*, ULong*, Long, int)); + extern ULong any_on ANSI((Bigint*, int)); + extern double b2d ANSI((Bigint*, int*)); + extern int cmp ANSI((Bigint*, Bigint*)); + extern void copybits ANSI((ULong*, int, Bigint*)); + extern Bigint *d2b ANSI((double, int*, int*)); + extern void decrement ANSI((Bigint*)); + extern Bigint *diff ANSI((Bigint*, Bigint*)); + extern char *dtoa ANSI((double d, int mode, int ndigits, + int *decpt, int *sign, char **rve)); + extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int)); + extern void hexdig_init_D2A(Void); + extern int hexnan ANSI((CONST char**, FPI*, ULong*)); + extern int hi0bits_D2A ANSI((ULong)); + extern Bigint *i2b ANSI((int)); + extern Bigint *increment ANSI((Bigint*)); + extern int lo0bits ANSI((ULong*)); + extern Bigint *lshift ANSI((Bigint*, int)); + extern int match ANSI((CONST char**, char*)); + extern Bigint *mult ANSI((Bigint*, Bigint*)); + extern Bigint *multadd ANSI((Bigint*, int, int)); + extern char *nrv_alloc ANSI((char*, char **, int)); + extern Bigint *pow5mult ANSI((Bigint*, int)); + extern int quorem ANSI((Bigint*, Bigint*)); + extern double ratio ANSI((Bigint*, Bigint*)); + extern void rshift ANSI((Bigint*, int)); + extern char *rv_alloc ANSI((int)); + extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int)); + extern Bigint *set_ones ANSI((Bigint*, int)); + extern double strtod ANSI((const char *s00, char **se)); + extern Bigint *sum ANSI((Bigint*, Bigint*)); + extern int trailz ANSI((Bigint*)); + extern double ulp ANSI((U*)); + +#ifdef __cplusplus +} +#endif +/* + * NAN_WORD0 and NAN_WORD1 are only referenced in strtod.c. Prior to + * 20050115, they used to be hard-wired here (to 0x7ff80000 and 0, + * respectively), but now are determined by compiling and running + * qnan.c to generate gd_qnan.h, which specifies d_QNAN0 and d_QNAN1. + * Formerly gdtoaimp.h recommended supplying suitable -DNAN_WORD0=... + * and -DNAN_WORD1=... values if necessary. This should still work. + * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) + */ +#ifdef IEEE_Arith +#ifndef NO_INFNAN_CHECK +#undef INFNAN_CHECK +#define INFNAN_CHECK +#endif +#ifdef IEEE_MC68k +#define _0 0 +#define _1 1 +#ifndef NAN_WORD0 +#define NAN_WORD0 d_QNAN0 +#endif +#ifndef NAN_WORD1 +#define NAN_WORD1 d_QNAN1 +#endif +#else +#define _0 1 +#define _1 0 +#ifndef NAN_WORD0 +#define NAN_WORD0 d_QNAN1 +#endif +#ifndef NAN_WORD1 +#define NAN_WORD1 d_QNAN0 +#endif +#endif +#else +#undef INFNAN_CHECK +#endif + +#undef SI +#ifdef Sudden_Underflow +#define SI 1 +#else +#define SI 0 +#endif + +/* Disable warnings */ + +#endif /* GDTOAIMP_H_INCLUDED */ diff --git a/sdk/tlibc/gdtoa/gethex.c b/sdk/tlibc/gdtoa/gethex.c new file mode 100644 index 0000000000..7ace0fa4cd --- /dev/null +++ b/sdk/tlibc/gdtoa/gethex.c @@ -0,0 +1,360 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + +#ifdef USE_LOCALE +#include "locale.h" +#endif + + int +#ifdef KR_headers +gethex(sp, fpi, exp, bp, sign) + CONST char **sp; FPI *fpi; Long *exp; Bigint **bp; int sign; +#else +gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) +#endif +{ + Bigint *b; + CONST unsigned char *decpt, *s0, *s, *s1; + int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret; + ULong L, lostbits, *x; + Long e, e1; +#ifdef USE_LOCALE + int i; +#ifdef NO_LOCALE_CACHE + const unsigned char *decimalpoint = (unsigned char*)localeconv()->decimal_point; +#else + const unsigned char *decimalpoint; + static unsigned char *decimalpoint_cache; + if (!(s0 = decimalpoint_cache)) { + s0 = (unsigned char*)localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strlcpy(decimalpoint_cache, s0, strlen(s0) + 1); + s0 = decimalpoint_cache; + } + } + decimalpoint = s0; +#endif +#endif + + if (!hexdig['0']) + hexdig_init_D2A(); + *bp = 0; + havedig = 0; + s0 = *(CONST unsigned char **)sp + 2; + while(s0[havedig] == '0') + havedig++; + s0 += havedig; + s = s0; + decpt = 0; + zret = 0; + e = 0; + if (hexdig[*s]) + havedig++; + else { + zret = 1; +#ifdef USE_LOCALE + for(i = 0; decimalpoint[i]; ++i) { + if (s[i] != decimalpoint[i]) + goto pcheck; + } + decpt = s += i; +#else + if (*s != '.') + goto pcheck; + decpt = ++s; +#endif + if (!hexdig[*s]) + goto pcheck; + while(*s == '0') + s++; + if (hexdig[*s]) + zret = 0; + havedig = 1; + s0 = s; + } + while(hexdig[*s]) + s++; +#ifdef USE_LOCALE + if (*s == *decimalpoint && !decpt) { + for(i = 1; decimalpoint[i]; ++i) { + if (s[i] != decimalpoint[i]) + goto pcheck; + } + decpt = s += i; +#else + if (*s == '.' && !decpt) { + decpt = ++s; +#endif + while(hexdig[*s]) + s++; + }/*}*/ + if (decpt) + e = -(((Long)(s-decpt)) << 2); + pcheck: + s1 = s; + big = esign = 0; + switch(*s) { + case 'p': + case 'P': + switch(*++s) { + case '-': + esign = 1; + /* no break */ + case '+': + s++; + } + if ((n = hexdig[*s]) == 0 || n > 0x19) { + s = s1; + break; + } + e1 = n - 0x10; + while((n = hexdig[*++s]) !=0 && n <= 0x19) { + if (e1 & 0xf8000000) + big = 1; + e1 = 10*e1 + n - 0x10; + } + if (esign) + e1 = -e1; + e += e1; + } + *sp = (char*)s; + if (!havedig) + *sp = (char*)s0 - 1; + if (zret) + return STRTOG_Zero; + if (big) { + if (esign) { + switch(fpi->rounding) { + case FPI_Round_up: + if (sign) + break; + goto ret_tiny; + case FPI_Round_down: + if (!sign) + break; + goto ret_tiny; + } + goto retz; + ret_tiny: + b = Balloc(0); + if (b == NULL) + return (STRTOG_NoMemory); + b->wds = 1; + b->x[0] = 1; + goto dret; + } + switch(fpi->rounding) { + case FPI_Round_near: + goto ovfl1; + case FPI_Round_up: + if (!sign) + goto ovfl1; + goto ret_big; + case FPI_Round_down: + if (sign) + goto ovfl1; + goto ret_big; + } + ret_big: + nbits = fpi->nbits; + n0 = n = nbits >> kshift; + if (nbits & kmask) + ++n; + for(j = n, k = 0; j >>= 1; ++k); + *bp = b = Balloc(k); + if (*bp == NULL) + return (STRTOG_NoMemory); + b->wds = n; + for(j = 0; j < n0; ++j) + b->x[j] = ALL_ON; + if (n > n0) + b->x[j] = ULbits >> (ULbits - (nbits & kmask)); + *exp = fpi->emin; + return STRTOG_Normal | STRTOG_Inexlo; + } + n = s1 - s0 - 1; + for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1) + k++; + b = Balloc(k); + if (b == NULL) + return (STRTOG_NoMemory); + x = b->x; + n = 0; + L = 0; +#ifdef USE_LOCALE + for(i = 0; decimalpoint[i+1]; ++i); +#endif + while(s1 > s0) { +#ifdef USE_LOCALE + if (*--s1 == decimalpoint[i]) { + s1 -= i; + continue; + } +#else + if (*--s1 == '.') + continue; +#endif + if (n == ULbits) { + *x++ = L; + L = 0; + n = 0; + } + L |= (hexdig[*s1] & 0x0f) << n; + n += 4; + } + *x++ = L; + b->wds = n = x - b->x; + n = ULbits*n - hi0bits(L); + nbits = fpi->nbits; + lostbits = 0; + x = b->x; + if (n > nbits) { + n -= nbits; + if (any_on(b,n)) { + lostbits = 1; + k = n - 1; + if (x[k>>kshift] & 1 << (k & kmask)) { + lostbits = 2; + if (k > 0 && any_on(b,k)) + lostbits = 3; + } + } + rshift(b, n); + e += n; + } + else if (n < nbits) { + n = nbits - n; + b = lshift(b, n); + if (b == NULL) + return (STRTOG_NoMemory); + e -= n; + x = b->x; + } + if (e > fpi->emax) { + ovfl: + Bfree(b); + ovfl1: +#ifndef NO_ERRNO + errno = ERANGE; +#endif + return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; + } + irv = STRTOG_Normal; + if (e < fpi->emin) { + irv = STRTOG_Denormal; + n = fpi->emin - e; + if (n >= nbits) { + switch (fpi->rounding) { + case FPI_Round_near: + if (n == nbits && (n < 2 || any_on(b,n-1))) + goto one_bit; + break; + case FPI_Round_up: + if (!sign) + goto one_bit; + break; + case FPI_Round_down: + if (sign) { + one_bit: + x[0] = b->wds = 1; + dret: + *bp = b; + *exp = fpi->emin; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + return STRTOG_Denormal | STRTOG_Inexhi + | STRTOG_Underflow; + } + } + Bfree(b); + retz: +#ifndef NO_ERRNO + errno = ERANGE; +#endif + return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow; + } + k = n - 1; + if (lostbits) + lostbits = 1; + else if (k > 0) + lostbits = any_on(b,k); + if (x[k>>kshift] & 1 << (k & kmask)) + lostbits |= 2; + nbits -= n; + rshift(b,n); + e = fpi->emin; + } + if (lostbits) { + up = 0; + switch(fpi->rounding) { + case FPI_Round_zero: + break; + case FPI_Round_near: + if (lostbits & 2 + && (lostbits | x[0]) & 1) + up = 1; + break; + case FPI_Round_up: + up = 1 - sign; + break; + case FPI_Round_down: + up = sign; + } + if (up) { + k = b->wds; + b = increment(b); + if (b == NULL) + return (STRTOG_NoMemory); + x = b->x; + if (irv == STRTOG_Denormal) { + if (nbits == fpi->nbits - 1 + && x[nbits >> kshift] & 1 << (nbits & kmask)) + irv = STRTOG_Normal; + } + else if (b->wds > k + || ((n = nbits & kmask) !=0 + && hi0bits(x[k-1]) < 32-n)) { + rshift(b,1); + if (++e > fpi->emax) + goto ovfl; + } + irv |= STRTOG_Inexhi; + } + else + irv |= STRTOG_Inexlo; + } + *bp = b; + *exp = e; + return irv; + } diff --git a/sdk/tlibc/gdtoa/gmisc.c b/sdk/tlibc/gdtoa/gmisc.c new file mode 100644 index 0000000000..8270ef9447 --- /dev/null +++ b/sdk/tlibc/gdtoa/gmisc.c @@ -0,0 +1,86 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + void +#ifdef KR_headers +rshift(b, k) Bigint *b; int k; +#else +rshift(Bigint *b, int k) +#endif +{ + ULong *x, *x1, *xe, y; + int n; + + x = x1 = b->x; + n = k >> kshift; + if (n < b->wds) { + xe = x + b->wds; + x += n; + if (k &= kmask) { + n = ULbits - k; + y = *x++ >> k; + while(x < xe) { + *x1++ = (y | (*x << n)) & ALL_ON; + y = *x++ >> k; + } + if ((*x1 = y) !=0) + x1++; + } + else + while(x < xe) + *x1++ = *x++; + } + if ((b->wds = x1 - b->x) == 0) + b->x[0] = 0; + } + + int +#ifdef KR_headers +trailz(b) Bigint *b; +#else +trailz(Bigint *b) +#endif +{ + ULong L, *x, *xe; + int n = 0; + + x = b->x; + xe = x + b->wds; + for(n = 0; x < xe && !*x; x++) + n += ULbits; + if (x < xe) { + L = *x; + n += lo0bits(&L); + } + return n; + } diff --git a/sdk/tlibc/gdtoa/hd_init.c b/sdk/tlibc/gdtoa/hd_init.c new file mode 100644 index 0000000000..fa6e18dee8 --- /dev/null +++ b/sdk/tlibc/gdtoa/hd_init.c @@ -0,0 +1,55 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 2000 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + unsigned char hexdig[256]; + + static void +#ifdef KR_headers +htinit(h, s, inc) unsigned char *h; unsigned char *s; int inc; +#else +htinit(unsigned char *h, unsigned char *s, int inc) +#endif +{ + int i, j; + for(i = 0; (j = s[i]) !=0; i++) + h[j] = i + inc; + } + + void +hexdig_init_D2A(Void) +{ +#define USC (unsigned char *) + htinit(hexdig, USC "0123456789", 0x10); + htinit(hexdig, USC "abcdef", 0x10 + 10); + htinit(hexdig, USC "ABCDEF", 0x10 + 10); + } diff --git a/sdk/tlibc/gdtoa/hdtoa.c b/sdk/tlibc/gdtoa/hdtoa.c new file mode 100644 index 0000000000..07181a3d10 --- /dev/null +++ b/sdk/tlibc/gdtoa/hdtoa.c @@ -0,0 +1,332 @@ +/* $OpenBSD: hdtoa.c,v 1.2 2009/10/16 12:15:03 martynas Exp $ */ +/*- + * Copyright (c) 2004, 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include "gdtoaimp.h" + +/* Strings values used by dtoa() */ +#define INFSTR "Infinity" +#define NANSTR "NaN" + +#define DBL_ADJ (DBL_MAX_EXP - 2 + ((DBL_MANT_DIG - 1) % 4)) +#define LDBL_ADJ (LDBL_MAX_EXP - 2 + ((LDBL_MANT_DIG - 1) % 4)) + +/* + * Round up the given digit string. If the digit string is fff...f, + * this procedure sets it to 100...0 and returns 1 to indicate that + * the exponent needs to be bumped. Otherwise, 0 is returned. + */ +static int +roundup(char *s0, int ndigits) +{ + char *s; + + for (s = s0 + ndigits - 1; *s == 0xf; s--) { + if (s == s0) { + *s = 1; + return (1); + } + *s = 0; + } + ++*s; + return (0); +} + +/* + * Round the given digit string to ndigits digits according to the + * current rounding mode. Note that this could produce a string whose + * value is not representable in the corresponding floating-point + * type. The exponent pointed to by decpt is adjusted if necessary. + */ +static void +dorounding(char *s0, int ndigits, int sign, int *decpt) +{ + int adjust = 0; /* do we need to adjust the exponent? */ + + switch (FLT_ROUNDS) { + case 0: /* toward zero */ + default: /* implementation-defined */ + break; + case 1: /* to nearest, halfway rounds to even */ + if ((s0[ndigits] > 8) || + (s0[ndigits] == 8 && s0[ndigits + 1] & 1)) + adjust = roundup(s0, ndigits); + break; + case 2: /* toward +inf */ + if (sign == 0) + adjust = roundup(s0, ndigits); + break; + case 3: /* toward -inf */ + if (sign != 0) + adjust = roundup(s0, ndigits); + break; + } + + if (adjust) + *decpt += 4; +} + +/* + * This procedure converts a double-precision number in IEEE format + * into a string of hexadecimal digits and an exponent of 2. Its + * behavior is bug-for-bug compatible with dtoa() in mode 2, with the + * following exceptions: + * + * - An ndigits < 0 causes it to use as many digits as necessary to + * represent the number exactly. + * - The additional xdigs argument should point to either the string + * "0123456789ABCDEF" or the string "0123456789abcdef", depending on + * which case is desired. + * - This routine does not repeat dtoa's mistake of setting decpt + * to 9999 in the case of an infinity or NaN. INT_MAX is used + * for this purpose instead. + * + * Note that the C99 standard does not specify what the leading digit + * should be for non-zero numbers. For instance, 0x1.3p3 is the same + * as 0x2.6p2 is the same as 0x4.cp3. This implementation chooses the + * first digit so that subsequent digits are aligned on nibble + * boundaries (before rounding). + * + * Inputs: d, xdigs, ndigits + * Outputs: decpt, sign, rve + */ +char * +__hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, + char **rve) +{ + static const int sigfigs = (DBL_MANT_DIG + 3) / 4; + struct ieee_double *p = (struct ieee_double *)&d; + char *s, *s0; + int bufsize; + + *sign = p->dbl_sign; + + switch (fpclassify(d)) { + case FP_NORMAL: + *decpt = p->dbl_exp - DBL_ADJ; + break; + case FP_ZERO: + *decpt = 1; + return (nrv_alloc("0", rve, 1)); + case FP_SUBNORMAL: + d *= 5.363123171977039e+154; /* = 0x1p514 */ + *decpt = p->dbl_exp - (514 + DBL_ADJ); + break; + case FP_INFINITE: + *decpt = INT_MAX; + return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1)); + case FP_NAN: + *decpt = INT_MAX; + return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1)); + default: + abort(); + } + + /* FP_NORMAL or FP_SUBNORMAL */ + + if (ndigits == 0) /* dtoa() compatibility */ + ndigits = 1; + + /* + * For simplicity, we generate all the digits even if the + * caller has requested fewer. + */ + bufsize = (sigfigs > ndigits) ? sigfigs : ndigits; + s0 = rv_alloc(bufsize); + if (s0 == NULL) + return (NULL); + + /* + * We work from right to left, first adding any requested zero + * padding, then the least significant portion of the + * mantissa, followed by the most significant. The buffer is + * filled with the byte values 0x0 through 0xf, which are + * converted to xdigs[0x0] through xdigs[0xf] after the + * rounding phase. + */ + for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--) + *s = 0; + for (; s > s0 + sigfigs - (DBL_FRACLBITS / 4) - 1 && s > s0; s--) { + *s = p->dbl_fracl & 0xf; + p->dbl_fracl >>= 4; + } + for (; s > s0; s--) { + *s = p->dbl_frach & 0xf; + p->dbl_frach >>= 4; + } + + /* + * At this point, we have snarfed all the bits in the + * mantissa, with the possible exception of the highest-order + * (partial) nibble, which is dealt with by the next + * statement. We also tack on the implicit normalization bit. + */ + *s = p->dbl_frach | (1U << ((DBL_MANT_DIG - 1) % 4)); + + /* If ndigits < 0, we are expected to auto-size the precision. */ + if (ndigits < 0) { + for (ndigits = sigfigs; s0[ndigits - 1] == 0; ndigits--) + ; + } + + if (sigfigs > ndigits && s0[ndigits] != 0) + dorounding(s0, ndigits, p->dbl_sign, decpt); + + s = s0 + ndigits; + if (rve != NULL) + *rve = s; + *s-- = '\0'; + for (; s >= s0; s--) + *s = xdigs[(unsigned int)*s]; + + return (s0); +} + +#if (LDBL_MANT_DIG > DBL_MANT_DIG) + +/* + * This is the long double version of __hdtoa(). + */ +char * +__hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign, + char **rve) +{ + static const int sigfigs = (LDBL_MANT_DIG + 3) / 4; + struct ieee_ext *p = (struct ieee_ext *)&e; + char *s, *s0; + int bufsize; + + *sign = p->ext_sign; + + switch (fpclassify(e)) { + case FP_NORMAL: + *decpt = p->ext_exp - LDBL_ADJ; + break; + case FP_ZERO: + *decpt = 1; + return (nrv_alloc("0", rve, 1)); + case FP_SUBNORMAL: + e *= 0x1p514L; + *decpt = p->ext_exp - (514 + LDBL_ADJ); + break; + case FP_INFINITE: + *decpt = INT_MAX; + return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1)); + case FP_NAN: + *decpt = INT_MAX; + return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1)); + default: + abort(); + } + + /* FP_NORMAL or FP_SUBNORMAL */ + + if (ndigits == 0) /* dtoa() compatibility */ + ndigits = 1; + + /* + * For simplicity, we generate all the digits even if the + * caller has requested fewer. + */ + bufsize = (sigfigs > ndigits) ? sigfigs : ndigits; + s0 = rv_alloc(bufsize); + if (s0 == NULL) + return (NULL); + + /* + * We work from right to left, first adding any requested zero + * padding, then the least significant portion of the + * mantissa, followed by the most significant. The buffer is + * filled with the byte values 0x0 through 0xf, which are + * converted to xdigs[0x0] through xdigs[0xf] after the + * rounding phase. + */ + for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--) + *s = 0; + for (; s > s0 + sigfigs - (EXT_FRACLBITS / 4) - 1 && s > s0; s--) { + *s = p->ext_fracl & 0xf; + p->ext_fracl >>= 4; + } +#ifdef EXT_FRACHMBITS + for (; s > s0; s--) { + *s = p->ext_frachm & 0xf; + p->ext_frachm >>= 4; + } +#endif +#ifdef EXT_FRACLMBITS + for (; s > s0; s--) { + *s = p->ext_fraclm & 0xf; + p->ext_fraclm >>= 4; + } +#endif + for (; s > s0; s--) { + *s = p->ext_frach & 0xf; + p->ext_frach >>= 4; + } + + /* + * At this point, we have snarfed all the bits in the + * mantissa, with the possible exception of the highest-order + * (partial) nibble, which is dealt with by the next + * statement. We also tack on the implicit normalization bit. + */ + *s = p->ext_frach | (1U << ((LDBL_MANT_DIG - 1) % 4)); + + /* If ndigits < 0, we are expected to auto-size the precision. */ + if (ndigits < 0) { + for (ndigits = sigfigs; s0[ndigits - 1] == 0; ndigits--) + ; + } + + if (sigfigs > ndigits && s0[ndigits] != 0) + dorounding(s0, ndigits, p->ext_sign, decpt); + + s = s0 + ndigits; + if (rve != NULL) + *rve = s; + *s-- = '\0'; + for (; s >= s0; s--) + *s = xdigs[(unsigned int)*s]; + + return (s0); +} + +#else /* (LDBL_MANT_DIG == DBL_MANT_DIG) */ + +char * +__hldtoa(long double e, const char *xdigs, int ndigits, int *decpt, int *sign, + char **rve) +{ + return (__hdtoa((double)e, xdigs, ndigits, decpt, sign, rve)); +} + +#endif /* (LDBL_MANT_DIG == DBL_MANT_DIG) */ diff --git a/sdk/tlibc/gdtoa/hexnan.c b/sdk/tlibc/gdtoa/hexnan.c new file mode 100644 index 0000000000..a443721f52 --- /dev/null +++ b/sdk/tlibc/gdtoa/hexnan.c @@ -0,0 +1,150 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 2000 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + static void +#ifdef KR_headers +L_shift(x, x1, i) ULong *x; ULong *x1; int i; +#else +L_shift(ULong *x, ULong *x1, int i) +#endif +{ + int j; + + i = 8 - i; + i <<= 2; + j = ULbits - i; + do { + *x |= x[1] << j; + x[1] >>= i; + } while(++x < x1); + } + + int +#ifdef KR_headers +hexnan(sp, fpi, x0) + CONST char **sp; FPI *fpi; ULong *x0; +#else +hexnan( CONST char **sp, FPI *fpi, ULong *x0) +#endif +{ + ULong c, h, *x, *x1, *xe; + CONST char *s; + int havedig, hd0, i, nbits; + + if (!hexdig['0']) + hexdig_init_D2A(); + nbits = fpi->nbits; + x = x0 + (nbits >> kshift); + if (nbits & kmask) + x++; + *--x = 0; + x1 = xe = x; + havedig = hd0 = i = 0; + s = *sp; + /* allow optional initial 0x or 0X */ + while((c = *(CONST unsigned char*)(s+1)) && c <= ' ') + ++s; + if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X') + && *(CONST unsigned char*)(s+3) > ' ') + s += 2; + while((c = *(CONST unsigned char*)++s)) { + if (!(h = hexdig[c])) { + if (c <= ' ') { + if (hd0 < havedig) { + if (x < x1 && i < 8) + L_shift(x, x1, i); + if (x <= x0) { + i = 8; + continue; + } + hd0 = havedig; + *--x = 0; + x1 = x; + i = 0; + } + while(*(CONST unsigned char*)(s+1) <= ' ') + ++s; + if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X') + && *(CONST unsigned char*)(s+3) > ' ') + s += 2; + continue; + } + if (/*(*/ c == ')' && havedig) { + *sp = s + 1; + break; + } +#ifndef GDTOA_NON_PEDANTIC_NANCHECK + do { + if (/*(*/ c == ')') { + *sp = s + 1; + break; + } + } while((c = *++s)); +#endif + return STRTOG_NaN; + } + havedig++; + if (++i > 8) { + if (x <= x0) + continue; + i = 1; + *--x = 0; + } + *x = (*x << 4) | (h & 0xf); + } + if (!havedig) + return STRTOG_NaN; + if (x < x1 && i < 8) + L_shift(x, x1, i); + if (x > x0) { + x1 = x0; + do *x1++ = *x++; + while(x <= xe); + do *x1++ = 0; + while(x1 <= xe); + } + else { + /* truncate high-order word if necessary */ + if ( (i = nbits & (ULbits-1)) !=0) + *xe &= ((ULong)0xffffffff) >> (ULbits - i); + } + for(x1 = xe;; --x1) { + if (*x1 != 0) + break; + if (x1 == x0) { + *x1 = 1; + break; + } + } + return STRTOG_NaNbits; + } diff --git a/sdk/tlibc/gdtoa/ldtoa.c b/sdk/tlibc/gdtoa/ldtoa.c new file mode 100644 index 0000000000..67d920587e --- /dev/null +++ b/sdk/tlibc/gdtoa/ldtoa.c @@ -0,0 +1,124 @@ +/* $OpenBSD: ldtoa.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/*- + * Copyright (c) 2003 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#ifndef __vax__ +#include +#endif /* !__vax__ */ +#include +#include +#include +#include +#include +#include "gdtoaimp.h" + +#if (LDBL_MANT_DIG > DBL_MANT_DIG) + +/* + * ldtoa() is a wrapper for gdtoa() that makes it smell like dtoa(), + * except that the floating point argument is passed by reference. + * When dtoa() is passed a NaN or infinity, it sets expt to 9999. + * However, a long double could have a valid exponent of 9999, so we + * use INT_MAX in ldtoa() instead. + */ +char * +__ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign, + char **rve) +{ + FPI fpi = { + LDBL_MANT_DIG, /* nbits */ + LDBL_MIN_EXP - LDBL_MANT_DIG, /* emin */ + LDBL_MAX_EXP - LDBL_MANT_DIG, /* emax */ + FLT_ROUNDS, /* rounding */ +#ifdef Sudden_Underflow /* unused, but correct anyway */ + 1 +#else + 0 +#endif + }; + int be, kind; + char *ret; + struct ieee_ext *p = (struct ieee_ext *)ld; + uint32_t bits[(LDBL_MANT_DIG + 31) / 32]; + void *vbits = bits; + + /* + * gdtoa doesn't know anything about the sign of the number, so + * if the number is negative, we need to swap rounding modes of + * 2 (upwards) and 3 (downwards). + */ + *sign = p->ext_sign; + fpi.rounding ^= (fpi.rounding >> 1) & p->ext_sign; + + be = p->ext_exp - (LDBL_MAX_EXP - 1) - (LDBL_MANT_DIG - 1); + EXT_TO_ARRAY32(p, bits); + + switch (fpclassify(*ld)) { + case FP_NORMAL: + kind = STRTOG_Normal; +#ifdef EXT_IMPLICIT_NBIT + bits[LDBL_MANT_DIG / 32] |= 1 << ((LDBL_MANT_DIG - 1) % 32); +#endif /* EXT_IMPLICIT_NBIT */ + break; + case FP_ZERO: + kind = STRTOG_Zero; + break; + case FP_SUBNORMAL: + kind = STRTOG_Denormal; + be++; + break; + case FP_INFINITE: + kind = STRTOG_Infinite; + break; + case FP_NAN: + kind = STRTOG_NaN; + break; + default: + abort(); + } + + ret = gdtoa(&fpi, be, vbits, &kind, mode, ndigits, decpt, rve); + if (*decpt == -32768) + *decpt = INT_MAX; + return ret; +} + +#else /* (LDBL_MANT_DIG == DBL_MANT_DIG) */ + +char * +__ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign, + char **rve) +{ + char *ret; + + ret = dtoa((double)*ld, mode, ndigits, decpt, sign, rve); + if (*decpt == 9999) + *decpt = INT_MAX; + return ret; +} + +#endif /* (LDBL_MANT_DIG == DBL_MANT_DIG) */ diff --git a/sdk/tlibc/gdtoa/locks.c b/sdk/tlibc/gdtoa/locks.c new file mode 100644 index 0000000000..c59a620ab1 --- /dev/null +++ b/sdk/tlibc/gdtoa/locks.c @@ -0,0 +1,7 @@ +/* $OpenBSD: locks.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ + +/* Written by Martynas Venckus. Public Domain. */ + +#include + +sgx_spinlock_t __dtoa_locks[] = { SGX_SPINLOCK_INITIALIZER, SGX_SPINLOCK_INITIALIZER }; diff --git a/sdk/tlibc/gdtoa/misc.c b/sdk/tlibc/gdtoa/misc.c new file mode 100644 index 0000000000..364de38a0d --- /dev/null +++ b/sdk/tlibc/gdtoa/misc.c @@ -0,0 +1,895 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 1999 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + static Bigint *freelist[Kmax+1]; +#ifndef Omit_Private_Memory +#ifndef PRIVATE_MEM +#define PRIVATE_MEM 2304 +#endif +#define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double)) +static double private_mem[PRIVATE_mem], *pmem_next = private_mem; +#endif + + Bigint * +Balloc +#ifdef KR_headers + (k) int k; +#else + (int k) +#endif +{ + int x; + Bigint *rv; +#ifndef Omit_Private_Memory + unsigned int len; +#endif + + ACQUIRE_DTOA_LOCK(0); + /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ + /* but this case seems very unlikely. */ + if (k <= Kmax && (rv = freelist[k]) !=0) { + freelist[k] = rv->next; + } + else { + x = 1 << k; +#ifdef Omit_Private_Memory + rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); + if (rv == NULL) + return (NULL); +#else + len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) + /sizeof(double); + if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { + rv = (Bigint*)pmem_next; + pmem_next += len; + } + else { + rv = (Bigint*)MALLOC(len*sizeof(double)); + if (rv == NULL) + return (NULL); + } +#endif + rv->k = k; + rv->maxwds = x; + } + FREE_DTOA_LOCK(0); + rv->sign = rv->wds = 0; + return rv; + } + + void +Bfree +#ifdef KR_headers + (v) Bigint *v; +#else + (Bigint *v) +#endif +{ + if (v) { + if (v->k > Kmax) +#ifdef FREE + FREE((void*)v); +#else + free((void*)v); +#endif + else { + ACQUIRE_DTOA_LOCK(0); + v->next = freelist[v->k]; + freelist[v->k] = v; + FREE_DTOA_LOCK(0); + } + } + } + + int +lo0bits +#ifdef KR_headers + (y) ULong *y; +#else + (ULong *y) +#endif +{ + int k; + ULong x = *y; + + if (x & 7) { + if (x & 1) + return 0; + if (x & 2) { + *y = x >> 1; + return 1; + } + *y = x >> 2; + return 2; + } + k = 0; + if (!(x & 0xffff)) { + k = 16; + x >>= 16; + } + if (!(x & 0xff)) { + k += 8; + x >>= 8; + } + if (!(x & 0xf)) { + k += 4; + x >>= 4; + } + if (!(x & 0x3)) { + k += 2; + x >>= 2; + } + if (!(x & 1)) { + k++; + x >>= 1; + if (!x) + return 32; + } + *y = x; + return k; + } + + Bigint * +multadd +#ifdef KR_headers + (b, m, a) Bigint *b; int m, a; +#else + (Bigint *b, int m, int a) /* multiply by m and add a */ +#endif +{ + int i, wds; +#ifdef ULLong + ULong *x; + ULLong carry, y; +#else + ULong carry, *x, y; +#ifdef Pack_32 + ULong xi, z; +#endif +#endif + Bigint *b1; + + wds = b->wds; + x = b->x; + i = 0; + carry = a; + do { +#ifdef ULLong + y = *x * (ULLong)m + carry; + carry = y >> 32; + *x++ = y & 0xffffffffUL; +#else +#ifdef Pack_32 + xi = *x; + y = (xi & 0xffff) * m + carry; + z = (xi >> 16) * m + (y >> 16); + carry = z >> 16; + *x++ = (z << 16) + (y & 0xffff); +#else + y = *x * m + carry; + carry = y >> 16; + *x++ = y & 0xffff; +#endif +#endif + } + while(++i < wds); + if (carry) { + if (wds >= b->maxwds) { + b1 = Balloc(b->k+1); + if (b1 == NULL) + return (NULL); + Bcopy(b1, b); + Bfree(b); + b = b1; + } + b->x[wds++] = carry; + b->wds = wds; + } + return b; + } + + int +hi0bits_D2A +#ifdef KR_headers + (x) ULong x; +#else + (ULong x) +#endif +{ + int k = 0; + + if (!(x & 0xffff0000)) { + k = 16; + x <<= 16; + } + if (!(x & 0xff000000)) { + k += 8; + x <<= 8; + } + if (!(x & 0xf0000000)) { + k += 4; + x <<= 4; + } + if (!(x & 0xc0000000)) { + k += 2; + x <<= 2; + } + if (!(x & 0x80000000)) { + k++; + if (!(x & 0x40000000)) + return 32; + } + return k; + } + + Bigint * +i2b +#ifdef KR_headers + (i) int i; +#else + (int i) +#endif +{ + Bigint *b; + + b = Balloc(1); + if (b == NULL) + return (NULL); + b->x[0] = i; + b->wds = 1; + return b; + } + + Bigint * +mult +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + Bigint *c; + int k, wa, wb, wc; + ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; + ULong y; +#ifdef ULLong + ULLong carry, z; +#else + ULong carry, z; +#ifdef Pack_32 + ULong z2; +#endif +#endif + + if (a->wds < b->wds) { + c = a; + a = b; + b = c; + } + k = a->k; + wa = a->wds; + wb = b->wds; + wc = wa + wb; + if (wc > a->maxwds) + k++; + c = Balloc(k); + if (c == NULL) + return (NULL); + for(x = c->x, xa = x + wc; x < xa; x++) + *x = 0; + xa = a->x; + xae = xa + wa; + xb = b->x; + xbe = xb + wb; + xc0 = c->x; +#ifdef ULLong + for(; xb < xbe; xc0++) { + if ( (y = *xb++) !=0) { + x = xa; + xc = xc0; + carry = 0; + do { + z = *x++ * (ULLong)y + *xc + carry; + carry = z >> 32; + *xc++ = z & 0xffffffffUL; + } + while(x < xae); + *xc = carry; + } + } +#else +#ifdef Pack_32 + for(; xb < xbe; xb++, xc0++) { + if ( (y = *xb & 0xffff) !=0) { + x = xa; + xc = xc0; + carry = 0; + do { + z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; + carry = z >> 16; + z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; + carry = z2 >> 16; + Storeinc(xc, z2, z); + } + while(x < xae); + *xc = carry; + } + if ( (y = *xb >> 16) !=0) { + x = xa; + xc = xc0; + carry = 0; + z2 = *xc; + do { + z = (*x & 0xffff) * y + (*xc >> 16) + carry; + carry = z >> 16; + Storeinc(xc, z, z2); + z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; + carry = z2 >> 16; + } + while(x < xae); + *xc = z2; + } + } +#else + for(; xb < xbe; xc0++) { + if ( (y = *xb++) !=0) { + x = xa; + xc = xc0; + carry = 0; + do { + z = *x++ * y + *xc + carry; + carry = z >> 16; + *xc++ = z & 0xffff; + } + while(x < xae); + *xc = carry; + } + } +#endif +#endif + for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; + c->wds = wc; + return c; + } + + static Bigint *p5s; + + Bigint * +pow5mult +#ifdef KR_headers + (b, k) Bigint *b; int k; +#else + (Bigint *b, int k) +#endif +{ + Bigint *b1, *p5, *p51; + int i; + static int p05[3] = { 5, 25, 125 }; + + if ( (i = k & 3) !=0) { + b = multadd(b, p05[i-1], 0); + if (b == NULL) + return (NULL); + } + + if (!(k >>= 2)) + return b; + if ((p5 = p5s) == 0) { + /* first time */ +#ifdef MULTIPLE_THREADS + ACQUIRE_DTOA_LOCK(1); + if (!(p5 = p5s)) { + p5 = p5s = i2b(625); + if (p5 == NULL) + return (NULL); + p5->next = 0; + } + FREE_DTOA_LOCK(1); +#else + p5 = p5s = i2b(625); + if (p5 == NULL) + return (NULL); + p5->next = 0; +#endif + } + for(;;) { + if (k & 1) { + b1 = mult(b, p5); + if (b1 == NULL) + return (NULL); + Bfree(b); + b = b1; + } + if (!(k >>= 1)) + break; + if ((p51 = p5->next) == 0) { +#ifdef MULTIPLE_THREADS + ACQUIRE_DTOA_LOCK(1); + if (!(p51 = p5->next)) { + p51 = p5->next = mult(p5,p5); + if (p51 == NULL) + return (NULL); + p51->next = 0; + } + FREE_DTOA_LOCK(1); +#else + p51 = p5->next = mult(p5,p5); + if (p51 == NULL) + return (NULL); + p51->next = 0; +#endif + } + p5 = p51; + } + return b; + } + + Bigint * +lshift +#ifdef KR_headers + (b, k) Bigint *b; int k; +#else + (Bigint *b, int k) +#endif +{ + int i, k1, n, n1; + Bigint *b1; + ULong *x, *x1, *xe, z; + + n = k >> kshift; + k1 = b->k; + n1 = n + b->wds + 1; + for(i = b->maxwds; n1 > i; i <<= 1) + k1++; + b1 = Balloc(k1); + if (b1 == NULL) + return (NULL); + x1 = b1->x; + for(i = 0; i < n; i++) + *x1++ = 0; + x = b->x; + xe = x + b->wds; + if (k &= kmask) { +#ifdef Pack_32 + k1 = 32 - k; + z = 0; + do { + *x1++ = *x << k | z; + z = *x++ >> k1; + } + while(x < xe); + if ((*x1 = z) !=0) + ++n1; +#else + k1 = 16 - k; + z = 0; + do { + *x1++ = *x << k & 0xffff | z; + z = *x++ >> k1; + } + while(x < xe); + if (*x1 = z) + ++n1; +#endif + } + else do + *x1++ = *x++; + while(x < xe); + b1->wds = n1 - 1; + Bfree(b); + return b1; + } + + int +cmp +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + ULong *xa, *xa0, *xb, *xb0; + int i, j; + + i = a->wds; + j = b->wds; +#ifdef DEBUG + if (i > 1 && !a->x[i-1]) + Bug("cmp called with a->x[a->wds-1] == 0"); + if (j > 1 && !b->x[j-1]) + Bug("cmp called with b->x[b->wds-1] == 0"); +#endif + if (i -= j) + return i; + xa0 = a->x; + xa = xa0 + j; + xb0 = b->x; + xb = xb0 + j; + for(;;) { + if (*--xa != *--xb) + return *xa < *xb ? -1 : 1; + if (xa <= xa0) + break; + } + return 0; + } + + Bigint * +diff +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + Bigint *c; + int i, wa, wb; + ULong *xa, *xae, *xb, *xbe, *xc; +#ifdef ULLong + ULLong borrow, y; +#else + ULong borrow, y; +#ifdef Pack_32 + ULong z; +#endif +#endif + + i = cmp(a,b); + if (!i) { + c = Balloc(0); + if (c == NULL) + return (NULL); + c->wds = 1; + c->x[0] = 0; + return c; + } + if (i < 0) { + c = a; + a = b; + b = c; + i = 1; + } + else + i = 0; + c = Balloc(a->k); + if (c == NULL) + return (NULL); + c->sign = i; + wa = a->wds; + xa = a->x; + xae = xa + wa; + wb = b->wds; + xb = b->x; + xbe = xb + wb; + xc = c->x; + borrow = 0; +#ifdef ULLong + do { + y = (ULLong)*xa++ - *xb++ - borrow; + borrow = y >> 32 & 1UL; + *xc++ = y & 0xffffffffUL; + } + while(xb < xbe); + while(xa < xae) { + y = *xa++ - borrow; + borrow = y >> 32 & 1UL; + *xc++ = y & 0xffffffffUL; + } +#else +#ifdef Pack_32 + do { + y = (*xa & 0xffff) - (*xb & 0xffff) - borrow; + borrow = (y & 0x10000) >> 16; + z = (*xa++ >> 16) - (*xb++ >> 16) - borrow; + borrow = (z & 0x10000) >> 16; + Storeinc(xc, z, y); + } + while(xb < xbe); + while(xa < xae) { + y = (*xa & 0xffff) - borrow; + borrow = (y & 0x10000) >> 16; + z = (*xa++ >> 16) - borrow; + borrow = (z & 0x10000) >> 16; + Storeinc(xc, z, y); + } +#else + do { + y = *xa++ - *xb++ - borrow; + borrow = (y & 0x10000) >> 16; + *xc++ = y & 0xffff; + } + while(xb < xbe); + while(xa < xae) { + y = *xa++ - borrow; + borrow = (y & 0x10000) >> 16; + *xc++ = y & 0xffff; + } +#endif +#endif + while(!*--xc) + wa--; + c->wds = wa; + return c; + } + + double +b2d +#ifdef KR_headers + (a, e) Bigint *a; int *e; +#else + (Bigint *a, int *e) +#endif +{ + ULong *xa, *xa0, w, y, z; + int k; + U d; +#ifdef VAX + ULong d0, d1; +#else +#define d0 word0(&d) +#define d1 word1(&d) +#endif + + xa0 = a->x; + xa = xa0 + a->wds; + y = *--xa; +#ifdef DEBUG + if (!y) Bug("zero y in b2d"); +#endif + k = hi0bits(y); + *e = 32 - k; +#ifdef Pack_32 + if (k < Ebits) { + d0 = Exp_1 | y >> (Ebits - k); + w = xa > xa0 ? *--xa : 0; + d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); + goto ret_d; + } + z = xa > xa0 ? *--xa : 0; + if (k -= Ebits) { + d0 = Exp_1 | y << k | z >> (32 - k); + y = xa > xa0 ? *--xa : 0; + d1 = z << k | y >> (32 - k); + } + else { + d0 = Exp_1 | y; + d1 = z; + } +#else + if (k < Ebits + 16) { + z = xa > xa0 ? *--xa : 0; + d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; + w = xa > xa0 ? *--xa : 0; + y = xa > xa0 ? *--xa : 0; + d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; + goto ret_d; + } + z = xa > xa0 ? *--xa : 0; + w = xa > xa0 ? *--xa : 0; + k -= Ebits + 16; + d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; + y = xa > xa0 ? *--xa : 0; + d1 = w << k + 16 | y << k; +#endif + ret_d: +#ifdef VAX + word0(&d) = d0 >> 16 | d0 << 16; + word1(&d) = d1 >> 16 | d1 << 16; +#endif + return dval(&d); + } +#undef d0 +#undef d1 + + Bigint * +d2b +#ifdef KR_headers + (dd, e, bits) double dd; int *e, *bits; +#else + (double dd, int *e, int *bits) +#endif +{ + Bigint *b; + U d; +#ifndef Sudden_Underflow + int i; +#endif + int de, k; + ULong *x, y, z; +#ifdef VAX + ULong d0, d1; +#else +#define d0 word0(&d) +#define d1 word1(&d) +#endif + d.d = dd; +#ifdef VAX + d0 = word0(&d) >> 16 | word0(&d) << 16; + d1 = word1(&d) >> 16 | word1(&d) << 16; +#endif + +#ifdef Pack_32 + b = Balloc(1); +#else + b = Balloc(2); +#endif + if (b == NULL) + return (NULL); + x = b->x; + + z = d0 & Frac_mask; + d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ +#ifdef Sudden_Underflow + de = (int)(d0 >> Exp_shift); +#ifndef IBM + z |= Exp_msk11; +#endif +#else + if ( (de = (int)(d0 >> Exp_shift)) !=0) + z |= Exp_msk1; +#endif +#ifdef Pack_32 + if ( (y = d1) !=0) { + if ( (k = lo0bits(&y)) !=0) { + x[0] = y | z << (32 - k); + z >>= k; + } + else + x[0] = y; +#ifndef Sudden_Underflow + i = +#endif + b->wds = (x[1] = z) !=0 ? 2 : 1; + } + else { + k = lo0bits(&z); + x[0] = z; +#ifndef Sudden_Underflow + i = +#endif + b->wds = 1; + k += 32; + } +#else + if ( (y = d1) !=0) { + if ( (k = lo0bits(&y)) !=0) + if (k >= 16) { + x[0] = y | z << 32 - k & 0xffff; + x[1] = z >> k - 16 & 0xffff; + x[2] = z >> k; + i = 2; + } + else { + x[0] = y & 0xffff; + x[1] = y >> 16 | z << 16 - k & 0xffff; + x[2] = z >> k & 0xffff; + x[3] = z >> k+16; + i = 3; + } + else { + x[0] = y & 0xffff; + x[1] = y >> 16; + x[2] = z & 0xffff; + x[3] = z >> 16; + i = 3; + } + } + else { +#ifdef DEBUG + if (!z) + Bug("Zero passed to d2b"); +#endif + k = lo0bits(&z); + if (k >= 16) { + x[0] = z; + i = 0; + } + else { + x[0] = z & 0xffff; + x[1] = z >> 16; + i = 1; + } + k += 32; + } + while(!x[i]) + --i; + b->wds = i + 1; +#endif +#ifndef Sudden_Underflow + if (de) { +#endif +#ifdef IBM + *e = (de - Bias - (P-1) << 2) + k; + *bits = 4*P + 8 - k - hi0bits(word0(&d) & Frac_mask); +#else + *e = de - Bias - (P-1) + k; + *bits = P - k; +#endif +#ifndef Sudden_Underflow + } + else { + *e = de - Bias - (P-1) + 1 + k; +#ifdef Pack_32 + *bits = 32*i - hi0bits(x[i-1]); +#else + *bits = (i+2)*16 - hi0bits(x[i]); +#endif + } +#endif + return b; + } +#undef d0 +#undef d1 + + CONST double +#ifdef IEEE_Arith +bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; +CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 + }; +#else +#ifdef IBM +bigtens[] = { 1e16, 1e32, 1e64 }; +CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 }; +#else +bigtens[] = { 1e16, 1e32 }; +CONST double tinytens[] = { 1e-16, 1e-32 }; +#endif +#endif + + CONST double +tens[] = { + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22 +#ifdef VAX + , 1e23, 1e24 +#endif + }; + +#ifdef NO_STRING_H + + Char * +#ifdef KR_headers +memcpy_D2A(a, b, len) Char *a; Char *b; size_t len; +#else +memcpy_D2A(void *a1, void *b1, size_t len) +#endif +{ + char *a = (char*)a1, *ae = a + len; + char *b = (char*)b1, *a0 = a; + while(a < ae) + *a++ = *b++; + return a0; + } + +#endif /* NO_STRING_H */ diff --git a/sdk/tlibc/gdtoa/smisc.c b/sdk/tlibc/gdtoa/smisc.c new file mode 100644 index 0000000000..d063a38db2 --- /dev/null +++ b/sdk/tlibc/gdtoa/smisc.c @@ -0,0 +1,201 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 1999 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + Bigint * +s2b +#ifdef KR_headers + (s, nd0, nd, y9, dplen) CONST char *s; int dplen, nd0, nd; ULong y9; +#else + (CONST char *s, int nd0, int nd, ULong y9, int dplen) +#endif +{ + Bigint *b; + int i, k; + Long x, y; + + x = (nd + 8) / 9; + for(k = 0, y = 1; x > y; y <<= 1, k++) ; +#ifdef Pack_32 + b = Balloc(k); + if (b == NULL) + return (NULL); + b->x[0] = y9; + b->wds = 1; +#else + b = Balloc(k+1); + if (b == NULL) + return (NULL); + b->x[0] = y9 & 0xffff; + b->wds = (b->x[1] = y9 >> 16) ? 2 : 1; +#endif + + i = 9; + if (9 < nd0) { + s += 9; + do { + b = multadd(b, 10, *s++ - '0'); + if (b == NULL) + return (NULL); + } while(++i < nd0); + s += dplen; + } + else + s += dplen + 9; + for(; i < nd; i++) { + b = multadd(b, 10, *s++ - '0'); + if (b == NULL) + return (NULL); + } + return b; + } + + double +ratio +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + U da, db; + int k, ka, kb; + + dval(&da) = b2d(a, &ka); + dval(&db) = b2d(b, &kb); + k = ka - kb + ULbits*(a->wds - b->wds); +#ifdef IBM + if (k > 0) { + word0(&da) += (k >> 2)*Exp_msk1; + if (k &= 3) + dval(&da) *= 1 << k; + } + else { + k = -k; + word0(&db) += (k >> 2)*Exp_msk1; + if (k &= 3) + dval(&db) *= 1 << k; + } +#else + if (k > 0) + word0(&da) += k*Exp_msk1; + else { + k = -k; + word0(&db) += k*Exp_msk1; + } +#endif + return dval(&da) / dval(&db); + } + +#ifdef INFNAN_CHECK + + int +match +#ifdef KR_headers + (sp, t) char **sp, *t; +#else + (CONST char **sp, char *t) +#endif +{ + int c, d; + CONST char *s = *sp; + + while( (d = *t++) !=0) { + if ((c = *++s) >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c != d) + return 0; + } + *sp = s + 1; + return 1; + } +#endif /* INFNAN_CHECK */ + + void +#ifdef KR_headers +copybits(c, n, b) ULong *c; int n; Bigint *b; +#else +copybits(ULong *c, int n, Bigint *b) +#endif +{ + ULong *ce, *x, *xe; +#ifdef Pack_16 + int nw, nw1; +#endif + + ce = c + ((n-1) >> kshift) + 1; + x = b->x; +#ifdef Pack_32 + xe = x + b->wds; + while(x < xe) + *c++ = *x++; +#else + nw = b->wds; + nw1 = nw & 1; + for(xe = x + (nw - nw1); x < xe; x += 2) + Storeinc(c, x[1], x[0]); + if (nw1) + *c++ = *x; +#endif + while(c < ce) + *c++ = 0; + } + + ULong +#ifdef KR_headers +any_on(b, k) Bigint *b; int k; +#else +any_on(Bigint *b, int k) +#endif +{ + int n, nwds; + ULong *x, *x0, x1, x2; + + x = b->x; + nwds = b->wds; + n = k >> kshift; + if (n > nwds) + n = nwds; + else if (n < nwds && (k &= kmask)) { + x1 = x2 = x[n]; + x1 >>= k; + x1 <<= k; + if (x1 != x2) + return 1; + } + x0 = x; + x += n; + while(x > x0) + if (*--x) + return 1; + return 0; + } diff --git a/sdk/tlibc/gdtoa/strtod.c b/sdk/tlibc/gdtoa/strtod.c new file mode 100644 index 0000000000..ded47d8624 --- /dev/null +++ b/sdk/tlibc/gdtoa/strtod.c @@ -0,0 +1,1105 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998-2001 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" +#ifndef NO_FENV_H +#include +#endif + +#ifdef USE_LOCALE +#include "locale.h" +#endif + +#ifdef IEEE_Arith +#ifndef NO_IEEE_Scale +#define Avoid_Underflow +#undef tinytens +/* The factor of 2^106 in tinytens[4] helps us avoid setting the underflow */ +/* flag unnecessarily. It leads to a song and dance at the end of strtod. */ +static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, + 9007199254740992.*9007199254740992.e-256 + }; +#endif +#endif + +#ifdef Honor_FLT_ROUNDS +#undef Check_FLT_ROUNDS +#define Check_FLT_ROUNDS +#else +#define Rounding Flt_Rounds +#endif + +#ifdef Avoid_Underflow /*{*/ + static double +sulp +#ifdef KR_headers + (x, scale) U *x; int scale; +#else + (U *x, int scale) +#endif +{ + U u; + double rv; + int i; + + rv = ulp(x); + if (!scale || (i = 2*P + 1 - ((word0(x) & Exp_mask) >> Exp_shift)) <= 0) + return rv; /* Is there an example where i <= 0 ? */ + word0(&u) = Exp_1 + (i << Exp_shift); + word1(&u) = 0; + return rv * u.d; + } +#endif /*}*/ + + double +strtod +#ifdef KR_headers + (s00, se) CONST char *s00; char **se; +#else + (CONST char *s00, char **se) +#endif +{ +#ifdef Avoid_Underflow + int scale; +#endif + int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign, + e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; + CONST char *s, *s0, *s1; + double aadj; + Long L; + U adj, aadj1, rv, rv0; + ULong y, z; + Bigint *bb = NULL, *bb1, *bd = NULL, *bd0 = NULL, *bs = NULL, *delta = NULL; +#ifdef Avoid_Underflow + ULong Lsb, Lsb1; +#endif +#ifdef SET_INEXACT + int inexact, oldinexact; +#endif +#ifdef USE_LOCALE /*{{*/ +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv()->decimal_point; + int dplen = strlen(decimalpoint); +#else + char *decimalpoint; + static char *decimalpoint_cache; + static int dplen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strlcpy(decimalpoint_cache, s0, strlen(s0) + 1); + s0 = decimalpoint_cache; + } + dplen = strlen(s0); + } + decimalpoint = (char*)s0; +#endif /*NO_LOCALE_CACHE*/ +#else /*USE_LOCALE}{*/ +#define dplen 1 +#endif /*USE_LOCALE}}*/ + +#ifdef Honor_FLT_ROUNDS /*{*/ + int Rounding; +#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ + Rounding = Flt_Rounds; +#else /*}{*/ + Rounding = 1; + switch(fegetround()) { + case FE_TOWARDZERO: Rounding = 0; break; + case FE_UPWARD: Rounding = 2; break; + case FE_DOWNWARD: Rounding = 3; + } +#endif /*}}*/ +#endif /*}*/ + + sign = nz0 = nz = decpt = 0; + dval(&rv) = 0.; + for(s = s00;;s++) switch(*s) { + case '-': + sign = 1; + /* no break */ + case '+': + if (*++s) + goto break2; + /* no break */ + case 0: + goto ret0; + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case ' ': + continue; + default: + goto break2; + } + break2: + if (*s == '0') { +#ifndef NO_HEX_FP /*{*/ + { + static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; + Long exp; + ULong bits[2]; + switch(s[1]) { + case 'x': + case 'X': + { +#ifdef Honor_FLT_ROUNDS + FPI fpi1 = fpi; + fpi1.rounding = Rounding; +#else +#define fpi1 fpi +#endif + switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) { + case STRTOG_NoMemory: + goto ovfl; + case STRTOG_NoNumber: + s = s00; + sign = 0; + case STRTOG_Zero: + break; + default: + if (bb) { + copybits(bits, fpi.nbits, bb); + Bfree(bb); + } + ULtod(((U*)&rv)->L, bits, exp, i); + }} + goto ret; + } + } +#endif /*}*/ + nz0 = 1; + while(*++s == '0') ; + if (!*s) + goto ret; + } + s0 = s; + y = z = 0; + for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) + if (nd < 9) + y = 10*y + c - '0'; + else if (nd < 16) + z = 10*z + c - '0'; + nd0 = nd; +#ifdef USE_LOCALE + if (c == *decimalpoint) { + for(i = 1; decimalpoint[i]; ++i) + if (s[i] != decimalpoint[i]) + goto dig_done; + s += i; + c = *s; +#else + if (c == '.') { + c = *++s; +#endif + decpt = 1; + if (!nd) { + for(; c == '0'; c = *++s) + nz++; + if (c > '0' && c <= '9') { + s0 = s; + nf += nz; + nz = 0; + goto have_dig; + } + goto dig_done; + } + for(; c >= '0' && c <= '9'; c = *++s) { + have_dig: + nz++; + if (c -= '0') { + nf += nz; + for(i = 1; i < nz; i++) + if (nd++ < 9) + y *= 10; + else if (nd <= DBL_DIG + 1) + z *= 10; + if (nd++ < 9) + y = 10*y + c; + else if (nd <= DBL_DIG + 1) + z = 10*z + c; + nz = 0; + } + } + }/*}*/ + dig_done: + e = 0; + if (c == 'e' || c == 'E') { + if (!nd && !nz && !nz0) { + goto ret0; + } + s00 = s; + esign = 0; + switch(c = *++s) { + case '-': + esign = 1; + case '+': + c = *++s; + } + if (c >= '0' && c <= '9') { + while(c == '0') + c = *++s; + if (c > '0' && c <= '9') { + L = c - '0'; + s1 = s; + while((c = *++s) >= '0' && c <= '9') + L = 10*L + c - '0'; + if (s - s1 > 8 || L > 19999) + /* Avoid confusion from exponents + * so large that e might overflow. + */ + e = 19999; /* safe for 16 bit ints */ + else + e = (int)L; + if (esign) + e = -e; + } + else + e = 0; + } + else + s = s00; + } + if (!nd) { + if (!nz && !nz0) { +#ifdef INFNAN_CHECK + /* Check for Nan and Infinity */ + ULong bits[2]; + static FPI fpinan = /* only 52 explicit bits */ + { 52, 1-1023-53+1, 2046-1023-53+1, 1, SI }; + if (!decpt) + switch(c) { + case 'i': + case 'I': + if (match(&s,"nf")) { + --s; + if (!match(&s,"inity")) + ++s; + word0(&rv) = 0x7ff00000; + word1(&rv) = 0; + goto ret; + } + break; + case 'n': + case 'N': + if (match(&s, "an")) { +#ifndef No_Hex_NaN + if (*s == '(' /*)*/ + && hexnan(&s, &fpinan, bits) + == STRTOG_NaNbits) { + word0(&rv) = 0x7ff00000 | bits[1]; + word1(&rv) = bits[0]; + } + else { +#endif + word0(&rv) = NAN_WORD0; + word1(&rv) = NAN_WORD1; +#ifndef No_Hex_NaN + } +#endif + goto ret; + } + } +#endif /* INFNAN_CHECK */ + ret0: + s = s00; + sign = 0; + } + goto ret; + } + e1 = e -= nf; + + /* Now we have nd0 digits, starting at s0, followed by a + * decimal point, followed by nd-nd0 digits. The number we're + * after is the integer represented by those digits times + * 10**e */ + + if (!nd0) + nd0 = nd; + k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; + dval(&rv) = y; + if (k > 9) { +#ifdef SET_INEXACT + if (k > DBL_DIG) + oldinexact = get_inexact(); +#endif + dval(&rv) = tens[k - 9] * dval(&rv) + z; + } + if (nd <= DBL_DIG +#ifndef RND_PRODQUOT +#ifndef Honor_FLT_ROUNDS + && Flt_Rounds == 1 +#endif +#endif + ) { + if (!e) + goto ret; +#ifndef ROUND_BIASED_without_Round_Up + if (e > 0) { + if (e <= Ten_pmax) { +#ifdef VAX + goto vax_ovfl_check; +#else +#ifdef Honor_FLT_ROUNDS + /* round correctly FLT_ROUNDS = 2 or 3 */ + if (sign) { + rv.d = -rv.d; + sign = 0; + } +#endif + /* rv = */ rounded_product(dval(&rv), tens[e]); + goto ret; +#endif + } + i = DBL_DIG - nd; + if (e <= Ten_pmax + i) { + /* A fancier test would sometimes let us do + * this for larger i values. + */ +#ifdef Honor_FLT_ROUNDS + /* round correctly FLT_ROUNDS = 2 or 3 */ + if (sign) { + rv.d = -rv.d; + sign = 0; + } +#endif + e -= i; + dval(&rv) *= tens[i]; +#ifdef VAX + /* VAX exponent range is so narrow we must + * worry about overflow here... + */ + vax_ovfl_check: + word0(&rv) -= P*Exp_msk1; + /* rv = */ rounded_product(dval(&rv), tens[e]); + if ((word0(&rv) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) + goto ovfl; + word0(&rv) += P*Exp_msk1; +#else + /* rv = */ rounded_product(dval(&rv), tens[e]); +#endif + goto ret; + } + } +#ifndef Inaccurate_Divide + else if (e >= -Ten_pmax) { +#ifdef Honor_FLT_ROUNDS + /* round correctly FLT_ROUNDS = 2 or 3 */ + if (sign) { + rv.d = -rv.d; + sign = 0; + } +#endif + /* rv = */ rounded_quotient(dval(&rv), tens[-e]); + goto ret; + } +#endif +#endif /* ROUND_BIASED_without_Round_Up */ + } + e1 += nd - k; + +#ifdef IEEE_Arith +#ifdef SET_INEXACT + inexact = 1; + if (k <= DBL_DIG) + oldinexact = get_inexact(); +#endif +#ifdef Avoid_Underflow + scale = 0; +#endif +#ifdef Honor_FLT_ROUNDS + if (Rounding >= 2) { + if (sign) + Rounding = Rounding == 2 ? 0 : 2; + else + if (Rounding != 2) + Rounding = 0; + } +#endif +#endif /*IEEE_Arith*/ + + /* Get starting approximation = rv * 10**e1 */ + + if (e1 > 0) { + if ( (i = e1 & 15) !=0) + dval(&rv) *= tens[i]; + if (e1 &= ~15) { + if (e1 > DBL_MAX_10_EXP) { + ovfl: + /* Can't trust HUGE_VAL */ +#ifdef IEEE_Arith +#ifdef Honor_FLT_ROUNDS + switch(Rounding) { + case 0: /* toward 0 */ + case 3: /* toward -infinity */ + word0(&rv) = Big0; + word1(&rv) = Big1; + break; + default: + word0(&rv) = Exp_mask; + word1(&rv) = 0; + } +#else /*Honor_FLT_ROUNDS*/ + word0(&rv) = Exp_mask; + word1(&rv) = 0; +#endif /*Honor_FLT_ROUNDS*/ +#ifdef SET_INEXACT + /* set overflow bit */ + dval(&rv0) = 1e300; + dval(&rv0) *= dval(&rv0); +#endif +#else /*IEEE_Arith*/ + word0(&rv) = Big0; + word1(&rv) = Big1; +#endif /*IEEE_Arith*/ + range_err: + if (bd0) { + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); + } +#ifndef NO_ERRNO + errno = ERANGE; +#endif + goto ret; + } + e1 >>= 4; + for(j = 0; e1 > 1; j++, e1 >>= 1) + if (e1 & 1) + dval(&rv) *= bigtens[j]; + /* The last multiplication could overflow. */ + word0(&rv) -= P*Exp_msk1; + dval(&rv) *= bigtens[j]; + if ((z = word0(&rv) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-P)) + goto ovfl; + if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { + /* set to largest number */ + /* (Can't trust DBL_MAX) */ + word0(&rv) = Big0; + word1(&rv) = Big1; + } + else + word0(&rv) += P*Exp_msk1; + } + } + else if (e1 < 0) { + e1 = -e1; + if ( (i = e1 & 15) !=0) + dval(&rv) /= tens[i]; + if (e1 >>= 4) { + if (e1 >= 1 << n_bigtens) + goto undfl; +#ifdef Avoid_Underflow + if (e1 & Scale_Bit) + scale = 2*P; + for(j = 0; e1 > 0; j++, e1 >>= 1) + if (e1 & 1) + dval(&rv) *= tinytens[j]; + if (scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask) + >> Exp_shift)) > 0) { + /* scaled rv is denormal; zap j low bits */ + if (j >= 32) { + word1(&rv) = 0; + if (j >= 53) + word0(&rv) = (P+2)*Exp_msk1; + else + word0(&rv) &= 0xffffffff << (j-32); + } + else + word1(&rv) &= 0xffffffff << j; + } +#else + for(j = 0; e1 > 1; j++, e1 >>= 1) + if (e1 & 1) + dval(&rv) *= tinytens[j]; + /* The last multiplication could underflow. */ + dval(&rv0) = dval(&rv); + dval(&rv) *= tinytens[j]; + if (!dval(&rv)) { + dval(&rv) = 2.*dval(&rv0); + dval(&rv) *= tinytens[j]; +#endif + if (!dval(&rv)) { + undfl: + dval(&rv) = 0.; + goto range_err; + } +#ifndef Avoid_Underflow + word0(&rv) = Tiny0; + word1(&rv) = Tiny1; + /* The refinement below will clean + * this approximation up. + */ + } +#endif + } + } + + /* Now the hard part -- adjusting rv to the correct value.*/ + + /* Put digits into bd: true value = bd * 10^e */ + + bd0 = s2b(s0, nd0, nd, y, dplen); + if (bd0 == NULL) + goto ovfl; + + for(;;) { + bd = Balloc(bd0->k); + if (bd == NULL) + goto ovfl; + Bcopy(bd, bd0); + bb = d2b(dval(&rv), &bbe, &bbbits); /* rv = bb * 2^bbe */ + if (bb == NULL) + goto ovfl; + bs = i2b(1); + if (bs == NULL) + goto ovfl; + + if (e >= 0) { + bb2 = bb5 = 0; + bd2 = bd5 = e; + } + else { + bb2 = bb5 = -e; + bd2 = bd5 = 0; + } + if (bbe >= 0) + bb2 += bbe; + else + bd2 -= bbe; + bs2 = bb2; +#ifdef Honor_FLT_ROUNDS + if (Rounding != 1) + bs2++; +#endif +#ifdef Avoid_Underflow + Lsb = LSB; + Lsb1 = 0; + j = bbe - scale; + i = j + bbbits - 1; /* logb(rv) */ + j = P + 1 - bbbits; + if (i < Emin) { /* denormal */ + i = Emin - i; + j -= i; + if (i < 32) + Lsb <<= i; + else + Lsb1 = Lsb << (i-32); + } +#else /*Avoid_Underflow*/ +#ifdef Sudden_Underflow +#ifdef IBM + j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); +#else + j = P + 1 - bbbits; +#endif +#else /*Sudden_Underflow*/ + j = bbe; + i = j + bbbits - 1; /* logb(&rv) */ + if (i < Emin) /* denormal */ + j += P - Emin; + else + j = P + 1 - bbbits; +#endif /*Sudden_Underflow*/ +#endif /*Avoid_Underflow*/ + bb2 += j; + bd2 += j; +#ifdef Avoid_Underflow + bd2 += scale; +#endif + i = bb2 < bd2 ? bb2 : bd2; + if (i > bs2) + i = bs2; + if (i > 0) { + bb2 -= i; + bd2 -= i; + bs2 -= i; + } + if (bb5 > 0) { + bs = pow5mult(bs, bb5); + if (bs == NULL) + goto ovfl; + bb1 = mult(bs, bb); + if (bb1 == NULL) + goto ovfl; + Bfree(bb); + bb = bb1; + } + if (bb2 > 0) { + bb = lshift(bb, bb2); + if (bb == NULL) + goto ovfl; + } + if (bd5 > 0) { + bd = pow5mult(bd, bd5); + if (bd == NULL) + goto ovfl; + } + if (bd2 > 0) { + bd = lshift(bd, bd2); + if (bd == NULL) + goto ovfl; + } + if (bs2 > 0) { + bs = lshift(bs, bs2); + if (bs == NULL) + goto ovfl; + } + delta = diff(bb, bd); + if (delta == NULL) + goto ovfl; + dsign = delta->sign; + delta->sign = 0; + i = cmp(delta, bs); +#ifdef Honor_FLT_ROUNDS + if (Rounding != 1) { + if (i < 0) { + /* Error is less than an ulp */ + if (!delta->x[0] && delta->wds <= 1) { + /* exact */ +#ifdef SET_INEXACT + inexact = 0; +#endif + break; + } + if (Rounding) { + if (dsign) { + dval(&adj) = 1.; + goto apply_adj; + } + } + else if (!dsign) { + dval(&adj) = -1.; + if (!word1(&rv) + && !(word0(&rv) & Frac_mask)) { + y = word0(&rv) & Exp_mask; +#ifdef Avoid_Underflow + if (!scale || y > 2*P*Exp_msk1) +#else + if (y) +#endif + { + delta = lshift(delta,Log2P); + if (delta == NULL) + goto ovfl; + if (cmp(delta, bs) <= 0) + dval(&adj) = -0.5; + } + } + apply_adj: +#ifdef Avoid_Underflow + if (scale && (y = word0(&rv) & Exp_mask) + <= 2*P*Exp_msk1) + word0(&adj) += (2*P+1)*Exp_msk1 - y; +#else +#ifdef Sudden_Underflow + if ((word0(&rv) & Exp_mask) <= + P*Exp_msk1) { + word0(&rv) += P*Exp_msk1; + dval(&rv) += adj*ulp(&rv); + word0(&rv) -= P*Exp_msk1; + } + else +#endif /*Sudden_Underflow*/ +#endif /*Avoid_Underflow*/ + dval(&rv) += adj.d*ulp(&rv); + } + break; + } + dval(&adj) = ratio(delta, bs); + if (adj.d < 1.) + dval(&adj) = 1.; + if (adj.d <= 0x7ffffffe) { + /* dval(&adj) = Rounding ? ceil(&adj) : floor(&adj); */ + y = adj.d; + if (y != adj.d) { + if (!((Rounding>>1) ^ dsign)) + y++; + dval(&adj) = y; + } + } +#ifdef Avoid_Underflow + if (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) + word0(&adj) += (2*P+1)*Exp_msk1 - y; +#else +#ifdef Sudden_Underflow + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { + word0(&rv) += P*Exp_msk1; + dval(&adj) *= ulp(&rv); + if (dsign) + dval(&rv) += adj; + else + dval(&rv) -= adj; + word0(&rv) -= P*Exp_msk1; + goto cont; + } +#endif /*Sudden_Underflow*/ +#endif /*Avoid_Underflow*/ + dval(&adj) *= ulp(&rv); + if (dsign) { + if (word0(&rv) == Big0 && word1(&rv) == Big1) + goto ovfl; + dval(&rv) += adj.d; + } + else + dval(&rv) -= adj.d; + goto cont; + } +#endif /*Honor_FLT_ROUNDS*/ + + if (i < 0) { + /* Error is less than half an ulp -- check for + * special case of mantissa a power of two. + */ + if (dsign || word1(&rv) || word0(&rv) & Bndry_mask +#ifdef IEEE_Arith +#ifdef Avoid_Underflow + || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1 +#else + || (word0(&rv) & Exp_mask) <= Exp_msk1 +#endif +#endif + ) { +#ifdef SET_INEXACT + if (!delta->x[0] && delta->wds <= 1) + inexact = 0; +#endif + break; + } + if (!delta->x[0] && delta->wds <= 1) { + /* exact result */ +#ifdef SET_INEXACT + inexact = 0; +#endif + break; + } + delta = lshift(delta,Log2P); + if (delta == NULL) + goto ovfl; + if (cmp(delta, bs) > 0) + goto drop_down; + break; + } + if (i == 0) { + /* exactly half-way between */ + if (dsign) { + if ((word0(&rv) & Bndry_mask1) == Bndry_mask1 + && word1(&rv) == ( +#ifdef Avoid_Underflow + (scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) + ? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : +#endif + 0xffffffff)) { + /*boundary case -- increment exponent*/ + if (word0(&rv) == Big0 && word1(&rv) == Big1) + goto ovfl; + word0(&rv) = (word0(&rv) & Exp_mask) + + Exp_msk1 +#ifdef IBM + | Exp_msk1 >> 4 +#endif + ; + word1(&rv) = 0; +#ifdef Avoid_Underflow + dsign = 0; +#endif + break; + } + } + else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) { + drop_down: + /* boundary case -- decrement exponent */ +#ifdef Sudden_Underflow /*{{*/ + L = word0(&rv) & Exp_mask; +#ifdef IBM + if (L < Exp_msk1) +#else +#ifdef Avoid_Underflow + if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1)) +#else + if (L <= Exp_msk1) +#endif /*Avoid_Underflow*/ +#endif /*IBM*/ + goto undfl; + L -= Exp_msk1; +#else /*Sudden_Underflow}{*/ +#ifdef Avoid_Underflow + if (scale) { + L = word0(&rv) & Exp_mask; + if (L <= (2*P+1)*Exp_msk1) { + if (L > (P+2)*Exp_msk1) + /* round even ==> */ + /* accept rv */ + break; + /* rv = smallest denormal */ + goto undfl; + } + } +#endif /*Avoid_Underflow*/ + L = (word0(&rv) & Exp_mask) - Exp_msk1; +#endif /*Sudden_Underflow}}*/ + word0(&rv) = L | Bndry_mask1; + word1(&rv) = 0xffffffff; +#ifdef IBM + goto cont; +#else + break; +#endif + } +#ifndef ROUND_BIASED +#ifdef Avoid_Underflow + if (Lsb1) { + if (!(word0(&rv) & Lsb1)) + break; + } + else if (!(word1(&rv) & Lsb)) + break; +#else + if (!(word1(&rv) & LSB)) + break; +#endif +#endif + if (dsign) +#ifdef Avoid_Underflow + dval(&rv) += sulp(&rv, scale); +#else + dval(&rv) += ulp(&rv); +#endif +#ifndef ROUND_BIASED + else { +#ifdef Avoid_Underflow + dval(&rv) -= sulp(&rv, scale); +#else + dval(&rv) -= ulp(&rv); +#endif +#ifndef Sudden_Underflow + if (!dval(&rv)) + goto undfl; +#endif + } +#ifdef Avoid_Underflow + dsign = 1 - dsign; +#endif +#endif + break; + } + if ((aadj = ratio(delta, bs)) <= 2.) { + if (dsign) + aadj = dval(&aadj1) = 1.; + else if (word1(&rv) || word0(&rv) & Bndry_mask) { +#ifndef Sudden_Underflow + if (word1(&rv) == Tiny1 && !word0(&rv)) + goto undfl; +#endif + aadj = 1.; + dval(&aadj1) = -1.; + } + else { + /* special case -- power of FLT_RADIX to be */ + /* rounded down... */ + + if (aadj < 2./FLT_RADIX) + aadj = 1./FLT_RADIX; + else + aadj *= 0.5; + dval(&aadj1) = -aadj; + } + } + else { + aadj *= 0.5; + dval(&aadj1) = dsign ? aadj : -aadj; +#ifdef Check_FLT_ROUNDS + switch(Rounding) { + case 2: /* towards +infinity */ + dval(&aadj1) -= 0.5; + break; + case 0: /* towards 0 */ + case 3: /* towards -infinity */ + dval(&aadj1) += 0.5; + } +#else + if (Flt_Rounds == 0) + dval(&aadj1) += 0.5; +#endif /*Check_FLT_ROUNDS*/ + } + y = word0(&rv) & Exp_mask; + + /* Check for overflow */ + + if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { + dval(&rv0) = dval(&rv); + word0(&rv) -= P*Exp_msk1; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += dval(&adj); + if ((word0(&rv) & Exp_mask) >= + Exp_msk1*(DBL_MAX_EXP+Bias-P)) { + if (word0(&rv0) == Big0 && word1(&rv0) == Big1) + goto ovfl; + word0(&rv) = Big0; + word1(&rv) = Big1; + goto cont; + } + else + word0(&rv) += P*Exp_msk1; + } + else { +#ifdef Avoid_Underflow + if (scale && y <= 2*P*Exp_msk1) { + if (aadj <= 0x7fffffff) { + if ((z = aadj) <= 0) + z = 1; + aadj = z; + dval(&aadj1) = dsign ? aadj : -aadj; + } + word0(&aadj1) += (2*P+1)*Exp_msk1 - y; + } + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += dval(&adj); +#else +#ifdef Sudden_Underflow + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) { + dval(&rv0) = dval(&rv); + word0(&rv) += P*Exp_msk1; + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += dval(&adj); +#ifdef IBM + if ((word0(&rv) & Exp_mask) < P*Exp_msk1) +#else + if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) +#endif + { + if (word0(&rv0) == Tiny0 + && word1(&rv0) == Tiny1) + goto undfl; + word0(&rv) = Tiny0; + word1(&rv) = Tiny1; + goto cont; + } + else + word0(&rv) -= P*Exp_msk1; + } + else { + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += dval(&adj); + } +#else /*Sudden_Underflow*/ + /* Compute dval(&adj) so that the IEEE rounding rules will + * correctly round rv + dval(&adj) in some half-way cases. + * If rv * ulp(&rv) is denormalized (i.e., + * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid + * trouble from bits lost to denormalization; + * example: 1.2e-307 . + */ + if (y <= (P-1)*Exp_msk1 && aadj > 1.) { + dval(&aadj1) = (double)(int)(aadj + 0.5); + if (!dsign) + dval(&aadj1) = -dval(&aadj1); + } + dval(&adj) = dval(&aadj1) * ulp(&rv); + dval(&rv) += adj; +#endif /*Sudden_Underflow*/ +#endif /*Avoid_Underflow*/ + } + z = word0(&rv) & Exp_mask; +#ifndef SET_INEXACT +#ifdef Avoid_Underflow + if (!scale) +#endif + if (y == z) { + /* Can we stop now? */ + L = (Long)aadj; + aadj -= L; + /* The tolerances below are conservative. */ + if (dsign || word1(&rv) || word0(&rv) & Bndry_mask) { + if (aadj < .4999999 || aadj > .5000001) + break; + } + else if (aadj < .4999999/FLT_RADIX) + break; + } +#endif + cont: + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(delta); + } + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); +#ifdef SET_INEXACT + if (inexact) { + if (!oldinexact) { + word0(&rv0) = Exp_1 + (70 << Exp_shift); + word1(&rv0) = 0; + dval(&rv0) += 1.; + } + } + else if (!oldinexact) + clear_inexact(); +#endif +#ifdef Avoid_Underflow + if (scale) { + word0(&rv0) = Exp_1 - 2*P*Exp_msk1; + word1(&rv0) = 0; + dval(&rv) *= dval(&rv0); +#ifndef NO_ERRNO + /* try to avoid the bug of testing an 8087 register value */ +#ifdef IEEE_Arith + if (!(word0(&rv) & Exp_mask)) +#else + if (word0(&rv) == 0 && word1(&rv) == 0) +#endif + errno = ERANGE; +#endif + } +#endif /* Avoid_Underflow */ +#ifdef SET_INEXACT + if (inexact && !(word0(&rv) & Exp_mask)) { + /* set underflow bit */ + dval(&rv0) = 1e-300; + dval(&rv0) *= dval(&rv0); + } +#endif + ret: + if (se) + *se = (char *)s; + return sign ? -dval(&rv) : dval(&rv); + } + diff --git a/sdk/tlibc/gdtoa/strtodg.c b/sdk/tlibc/gdtoa/strtodg.c new file mode 100644 index 0000000000..8542a222e9 --- /dev/null +++ b/sdk/tlibc/gdtoa/strtodg.c @@ -0,0 +1,1156 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998-2001 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + +#ifdef USE_LOCALE +#include "locale.h" +#endif + + static CONST int +fivesbits[] = { 0, 3, 5, 7, 10, 12, 14, 17, 19, 21, + 24, 26, 28, 31, 33, 35, 38, 40, 42, 45, + 47, 49, 52 +#ifdef VAX + , 54, 56 +#endif + }; + + Bigint * +#ifdef KR_headers +increment(b) Bigint *b; +#else +increment(Bigint *b) +#endif +{ + ULong *x, *xe; + Bigint *b1; +#ifdef Pack_16 + ULong carry = 1, y; +#endif + + x = b->x; + xe = x + b->wds; +#ifdef Pack_32 + do { + if (*x < (ULong)0xffffffffL) { + ++*x; + return b; + } + *x++ = 0; + } while(x < xe); +#else + do { + y = *x + carry; + carry = y >> 16; + *x++ = y & 0xffff; + if (!carry) + return b; + } while(x < xe); + if (carry) +#endif + { + if (b->wds >= b->maxwds) { + b1 = Balloc(b->k+1); + if (b1 == NULL) + return (NULL); + Bcopy(b1,b); + Bfree(b); + b = b1; + } + b->x[b->wds++] = 1; + } + return b; + } + + void +#ifdef KR_headers +decrement(b) Bigint *b; +#else +decrement(Bigint *b) +#endif +{ + ULong *x, *xe; +#ifdef Pack_16 + ULong borrow = 1, y; +#endif + + x = b->x; + xe = x + b->wds; +#ifdef Pack_32 + do { + if (*x) { + --*x; + break; + } + *x++ = 0xffffffffL; + } + while(x < xe); +#else + do { + y = *x - borrow; + borrow = (y & 0x10000) >> 16; + *x++ = y & 0xffff; + } while(borrow && x < xe); +#endif + } + + static int +#ifdef KR_headers +all_on(b, n) Bigint *b; int n; +#else +all_on(Bigint *b, int n) +#endif +{ + ULong *x, *xe; + + x = b->x; + xe = x + (n >> kshift); + while(x < xe) + if ((*x++ & ALL_ON) != ALL_ON) + return 0; + if (n &= kmask) + return ((*x | (ALL_ON << n)) & ALL_ON) == ALL_ON; + return 1; + } + + Bigint * +#ifdef KR_headers +set_ones(b, n) Bigint *b; int n; +#else +set_ones(Bigint *b, int n) +#endif +{ + int k; + ULong *x, *xe; + + k = (n + ((1 << kshift) - 1)) >> kshift; + if (b->k < k) { + Bfree(b); + b = Balloc(k); + if (b == NULL) + return (NULL); + } + k = n >> kshift; + if (n &= kmask) + k++; + b->wds = k; + x = b->x; + xe = x + k; + while(x < xe) + *x++ = ALL_ON; + if (n) + x[-1] >>= ULbits - n; + return b; + } + + static int +rvOK +#ifdef KR_headers + (d, fpi, exp, bits, exact, rd, irv) + U *d; FPI *fpi; Long *exp; ULong *bits; int exact, rd, *irv; +#else + (U *d, FPI *fpi, Long *exp, ULong *bits, int exact, int rd, int *irv) +#endif +{ + Bigint *b; + ULong carry, inex, lostbits; + int bdif, e, j, k, k1, nb, rv; + + carry = rv = 0; + b = d2b(dval(d), &e, &bdif); + if (b == NULL) { + *irv = STRTOG_NoMemory; + return (1); + } + bdif -= nb = fpi->nbits; + e += bdif; + if (bdif <= 0) { + if (exact) + goto trunc; + goto ret; + } + if (P == nb) { + if ( +#ifndef IMPRECISE_INEXACT + exact && +#endif + fpi->rounding == +#ifdef RND_PRODQUOT + FPI_Round_near +#else + Flt_Rounds +#endif + ) goto trunc; + goto ret; + } + switch(rd) { + case 1: /* round down (toward -Infinity) */ + goto trunc; + case 2: /* round up (toward +Infinity) */ + break; + default: /* round near */ + k = bdif - 1; + if (k < 0) + goto trunc; + if (!k) { + if (!exact) + goto ret; + if (b->x[0] & 2) + break; + goto trunc; + } + if (b->x[k>>kshift] & ((ULong)1 << (k & kmask))) + break; + goto trunc; + } + /* "break" cases: round up 1 bit, then truncate; bdif > 0 */ + carry = 1; + trunc: + inex = lostbits = 0; + if (bdif > 0) { + if ( (lostbits = any_on(b, bdif)) !=0) + inex = STRTOG_Inexlo; + rshift(b, bdif); + if (carry) { + inex = STRTOG_Inexhi; + b = increment(b); + if (b == NULL) { + *irv = STRTOG_NoMemory; + return (1); + } + if ( (j = nb & kmask) !=0) + j = ULbits - j; + if (hi0bits(b->x[b->wds - 1]) != j) { + if (!lostbits) + lostbits = b->x[0] & 1; + rshift(b, 1); + e++; + } + } + } + else if (bdif < 0) { + b = lshift(b, -bdif); + if (b == NULL) { + *irv = STRTOG_NoMemory; + return (1); + } + } + if (e < fpi->emin) { + k = fpi->emin - e; + e = fpi->emin; + if (k > nb || fpi->sudden_underflow) { + b->wds = inex = 0; + *irv = STRTOG_Underflow | STRTOG_Inexlo; + } + else { + k1 = k - 1; + if (k1 > 0 && !lostbits) + lostbits = any_on(b, k1); + if (!lostbits && !exact) + goto ret; + lostbits |= + carry = b->x[k1>>kshift] & (1 << (k1 & kmask)); + rshift(b, k); + *irv = STRTOG_Denormal; + if (carry) { + b = increment(b); + if (b == NULL) { + *irv = STRTOG_NoMemory; + return (1); + } + inex = STRTOG_Inexhi | STRTOG_Underflow; + } + else if (lostbits) + inex = STRTOG_Inexlo | STRTOG_Underflow; + } + } + else if (e > fpi->emax) { + e = fpi->emax + 1; + *irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + b->wds = inex = 0; + } + *exp = e; + copybits(bits, nb, b); + *irv |= inex; + rv = 1; + ret: + Bfree(b); + return rv; + } + + static int +#ifdef KR_headers +mantbits(d) U *d; +#else +mantbits(U *d) +#endif +{ + ULong L; +#ifdef VAX + L = word1(d) << 16 | word1(d) >> 16; + if (L) +#else + if ( (L = word1(d)) !=0) +#endif + return P - lo0bits(&L); +#ifdef VAX + L = word0(d) << 16 | word0(d) >> 16 | Exp_msk11; +#else + L = word0(d) | Exp_msk1; +#endif + return P - 32 - lo0bits(&L); + } + + int +strtodg +#ifdef KR_headers + (s00, se, fpi, exp, bits) + CONST char *s00; char **se; FPI *fpi; Long *exp; ULong *bits; +#else + (CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits) +#endif +{ + int abe, abits, asub; + int bb0, bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, denorm; + int dsign, e, e1, e2, emin, esign, finished, i, inex, irv; + int j, k, nbits, nd, nd0, nf, nz, nz0, rd, rvbits, rve, rve1, sign; + int sudden_underflow; + CONST char *s, *s0, *s1; + double adj0, tol; + Long L; + U adj, rv; + ULong *b, *be, y, z; + Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0; +#ifdef USE_LOCALE /*{{*/ +#ifdef NO_LOCALE_CACHE + char *decimalpoint = localeconv()->decimal_point; + int dplen = strlen(decimalpoint); +#else + char *decimalpoint; + static char *decimalpoint_cache; + static int dplen; + if (!(s0 = decimalpoint_cache)) { + s0 = localeconv()->decimal_point; + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { + strlcpy(decimalpoint_cache, s0, strlen(s0) + 1); + s0 = decimalpoint_cache; + } + dplen = strlen(s0); + } + decimalpoint = (char*)s0; +#endif /*NO_LOCALE_CACHE*/ +#else /*USE_LOCALE}{*/ +#define dplen 1 +#endif /*USE_LOCALE}}*/ + + irv = STRTOG_Zero; + denorm = sign = nz0 = nz = 0; + dval(&rv) = 0.; + rvb = 0; + nbits = fpi->nbits; + for(s = s00;;s++) switch(*s) { + case '-': + sign = 1; + /* no break */ + case '+': + if (*++s) + goto break2; + /* no break */ + case 0: + sign = 0; + irv = STRTOG_NoNumber; + s = s00; + goto ret; + case '\t': + case '\n': + case '\v': + case '\f': + case '\r': + case ' ': + continue; + default: + goto break2; + } + break2: + if (*s == '0') { +#ifndef NO_HEX_FP + switch(s[1]) { + case 'x': + case 'X': + irv = gethex(&s, fpi, exp, &rvb, sign); + if (irv == STRTOG_NoMemory) + return (STRTOG_NoMemory); + if (irv == STRTOG_NoNumber) { + s = s00; + sign = 0; + } + goto ret; + } +#endif + nz0 = 1; + while(*++s == '0') ; + if (!*s) + goto ret; + } + sudden_underflow = fpi->sudden_underflow; + s0 = s; + y = z = 0; + for(decpt = nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) + if (nd < 9) + y = 10*y + c - '0'; + else if (nd < 16) + z = 10*z + c - '0'; + nd0 = nd; +#ifdef USE_LOCALE + if (c == *decimalpoint) { + for(i = 1; decimalpoint[i]; ++i) + if (s[i] != decimalpoint[i]) + goto dig_done; + s += i; + c = *s; +#else + if (c == '.') { + c = *++s; +#endif + decpt = 1; + if (!nd) { + for(; c == '0'; c = *++s) + nz++; + if (c > '0' && c <= '9') { + s0 = s; + nf += nz; + nz = 0; + goto have_dig; + } + goto dig_done; + } + for(; c >= '0' && c <= '9'; c = *++s) { + have_dig: + nz++; + if (c -= '0') { + nf += nz; + for(i = 1; i < nz; i++) + if (nd++ < 9) + y *= 10; + else if (nd <= DBL_DIG + 1) + z *= 10; + if (nd++ < 9) + y = 10*y + c; + else if (nd <= DBL_DIG + 1) + z = 10*z + c; + nz = 0; + } + } + }/*}*/ + dig_done: + e = 0; + if (c == 'e' || c == 'E') { + if (!nd && !nz && !nz0) { + irv = STRTOG_NoNumber; + s = s00; + goto ret; + } + s00 = s; + esign = 0; + switch(c = *++s) { + case '-': + esign = 1; + case '+': + c = *++s; + } + if (c >= '0' && c <= '9') { + while(c == '0') + c = *++s; + if (c > '0' && c <= '9') { + L = c - '0'; + s1 = s; + while((c = *++s) >= '0' && c <= '9') + L = 10*L + c - '0'; + if (s - s1 > 8 || L > 19999) + /* Avoid confusion from exponents + * so large that e might overflow. + */ + e = 19999; /* safe for 16 bit ints */ + else + e = (int)L; + if (esign) + e = -e; + } + else + e = 0; + } + else + s = s00; + } + if (!nd) { + if (!nz && !nz0) { +#ifdef INFNAN_CHECK + /* Check for Nan and Infinity */ + if (!decpt) + switch(c) { + case 'i': + case 'I': + if (match(&s,"nf")) { + --s; + if (!match(&s,"inity")) + ++s; + irv = STRTOG_Infinite; + goto infnanexp; + } + break; + case 'n': + case 'N': + if (match(&s, "an")) { + irv = STRTOG_NaN; + *exp = fpi->emax + 1; +#ifndef No_Hex_NaN + if (*s == '(') /*)*/ + irv = hexnan(&s, fpi, bits); +#endif + goto infnanexp; + } + } +#endif /* INFNAN_CHECK */ + irv = STRTOG_NoNumber; + s = s00; + } + goto ret; + } + + irv = STRTOG_Normal; + e1 = e -= nf; + rd = 0; + switch(fpi->rounding & 3) { + case FPI_Round_up: + rd = 2 - sign; + break; + case FPI_Round_zero: + rd = 1; + break; + case FPI_Round_down: + rd = 1 + sign; + } + + /* Now we have nd0 digits, starting at s0, followed by a + * decimal point, followed by nd-nd0 digits. The number we're + * after is the integer represented by those digits times + * 10**e */ + + if (!nd0) + nd0 = nd; + k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; + dval(&rv) = y; + if (k > 9) + dval(&rv) = tens[k - 9] * dval(&rv) + z; + bd0 = 0; + if (nbits <= P && nd <= DBL_DIG) { + if (!e) { + if (rvOK(&rv, fpi, exp, bits, 1, rd, &irv)) { + if (irv == STRTOG_NoMemory) + return (STRTOG_NoMemory); + goto ret; + } + } + else if (e > 0) { + if (e <= Ten_pmax) { +#ifdef VAX + goto vax_ovfl_check; +#else + i = fivesbits[e] + mantbits(&rv) <= P; + /* rv = */ rounded_product(dval(&rv), tens[e]); + if (rvOK(&rv, fpi, exp, bits, i, rd, &irv)) { + if (irv == STRTOG_NoMemory) + return (STRTOG_NoMemory); + goto ret; + } + e1 -= e; + goto rv_notOK; +#endif + } + i = DBL_DIG - nd; + if (e <= Ten_pmax + i) { + /* A fancier test would sometimes let us do + * this for larger i values. + */ + e2 = e - i; + e1 -= i; + dval(&rv) *= tens[i]; +#ifdef VAX + /* VAX exponent range is so narrow we must + * worry about overflow here... + */ + vax_ovfl_check: + dval(&adj) = dval(&rv); + word0(&adj) -= P*Exp_msk1; + /* adj = */ rounded_product(dval(&adj), tens[e2]); + if ((word0(&adj) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) + goto rv_notOK; + word0(&adj) += P*Exp_msk1; + dval(&rv) = dval(&adj); +#else + /* rv = */ rounded_product(dval(&rv), tens[e2]); +#endif + if (rvOK(&rv, fpi, exp, bits, 0, rd, &irv)) { + if (irv == STRTOG_NoMemory) + return (STRTOG_NoMemory); + goto ret; + } + e1 -= e2; + } + } +#ifndef Inaccurate_Divide + else if (e >= -Ten_pmax) { + /* rv = */ rounded_quotient(dval(&rv), tens[-e]); + if (rvOK(&rv, fpi, exp, bits, 0, rd, &irv)) { + if (irv == STRTOG_NoMemory) + return (STRTOG_NoMemory); + goto ret; + } + e1 -= e; + } +#endif + } + rv_notOK: + e1 += nd - k; + + /* Get starting approximation = rv * 10**e1 */ + + e2 = 0; + if (e1 > 0) { + if ( (i = e1 & 15) !=0) + dval(&rv) *= tens[i]; + if (e1 &= ~15) { + e1 >>= 4; + while(e1 >= (1 << (n_bigtens-1))) { + e2 += ((word0(&rv) & Exp_mask) + >> Exp_shift1) - Bias; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; + dval(&rv) *= bigtens[n_bigtens-1]; + e1 -= 1 << (n_bigtens-1); + } + e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; + for(j = 0; e1 > 0; j++, e1 >>= 1) + if (e1 & 1) + dval(&rv) *= bigtens[j]; + } + } + else if (e1 < 0) { + e1 = -e1; + if ( (i = e1 & 15) !=0) + dval(&rv) /= tens[i]; + if (e1 &= ~15) { + e1 >>= 4; + while(e1 >= (1 << (n_bigtens-1))) { + e2 += ((word0(&rv) & Exp_mask) + >> Exp_shift1) - Bias; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; + dval(&rv) *= tinytens[n_bigtens-1]; + e1 -= 1 << (n_bigtens-1); + } + e2 += ((word0(&rv) & Exp_mask) >> Exp_shift1) - Bias; + word0(&rv) &= ~Exp_mask; + word0(&rv) |= Bias << Exp_shift1; + for(j = 0; e1 > 0; j++, e1 >>= 1) + if (e1 & 1) + dval(&rv) *= tinytens[j]; + } + } +#ifdef IBM + /* e2 is a correction to the (base 2) exponent of the return + * value, reflecting adjustments above to avoid overflow in the + * native arithmetic. For native IBM (base 16) arithmetic, we + * must multiply e2 by 4 to change from base 16 to 2. + */ + e2 <<= 2; +#endif + rvb = d2b(dval(&rv), &rve, &rvbits); /* rv = rvb * 2^rve */ + if (rvb == NULL) + return (STRTOG_NoMemory); + rve += e2; + if ((j = rvbits - nbits) > 0) { + rshift(rvb, j); + rvbits = nbits; + rve += j; + } + bb0 = 0; /* trailing zero bits in rvb */ + e2 = rve + rvbits - nbits; + if (e2 > fpi->emax + 1) + goto huge; + rve1 = rve + rvbits - nbits; + if (e2 < (emin = fpi->emin)) { + denorm = 1; + j = rve - emin; + if (j > 0) { + rvb = lshift(rvb, j); + if (rvb == NULL) + return (STRTOG_NoMemory); + rvbits += j; + } + else if (j < 0) { + rvbits += j; + if (rvbits <= 0) { + if (rvbits < -1) { + ufl: + rvb->wds = 0; + rvb->x[0] = 0; + *exp = emin; + irv = STRTOG_Underflow | STRTOG_Inexlo; + goto ret; + } + rvb->x[0] = rvb->wds = rvbits = 1; + } + else + rshift(rvb, -j); + } + rve = rve1 = emin; + if (sudden_underflow && e2 + 1 < emin) + goto ufl; + } + + /* Now the hard part -- adjusting rv to the correct value.*/ + + /* Put digits into bd: true value = bd * 10^e */ + + bd0 = s2b(s0, nd0, nd, y, dplen); + if (bd0 == NULL) + return (STRTOG_NoMemory); + + for(;;) { + bd = Balloc(bd0->k); + if (bd == NULL) + return (STRTOG_NoMemory); + Bcopy(bd, bd0); + bb = Balloc(rvb->k); + if (bb == NULL) + return (STRTOG_NoMemory); + Bcopy(bb, rvb); + bbbits = rvbits - bb0; + bbe = rve + bb0; + bs = i2b(1); + if (bs == NULL) + return (STRTOG_NoMemory); + + if (e >= 0) { + bb2 = bb5 = 0; + bd2 = bd5 = e; + } + else { + bb2 = bb5 = -e; + bd2 = bd5 = 0; + } + if (bbe >= 0) + bb2 += bbe; + else + bd2 -= bbe; + bs2 = bb2; + j = nbits + 1 - bbbits; + i = bbe + bbbits - nbits; + if (i < emin) /* denormal */ + j += i - emin; + bb2 += j; + bd2 += j; + i = bb2 < bd2 ? bb2 : bd2; + if (i > bs2) + i = bs2; + if (i > 0) { + bb2 -= i; + bd2 -= i; + bs2 -= i; + } + if (bb5 > 0) { + bs = pow5mult(bs, bb5); + if (bs == NULL) + return (STRTOG_NoMemory); + bb1 = mult(bs, bb); + if (bb1 == NULL) + return (STRTOG_NoMemory); + Bfree(bb); + bb = bb1; + } + bb2 -= bb0; + if (bb2 > 0) { + bb = lshift(bb, bb2); + if (bb == NULL) + return (STRTOG_NoMemory); + } + else if (bb2 < 0) + rshift(bb, -bb2); + if (bd5 > 0) { + bd = pow5mult(bd, bd5); + if (bd == NULL) + return (STRTOG_NoMemory); + } + if (bd2 > 0) { + bd = lshift(bd, bd2); + if (bd == NULL) + return (STRTOG_NoMemory); + } + if (bs2 > 0) { + bs = lshift(bs, bs2); + if (bs == NULL) + return (STRTOG_NoMemory); + } + asub = 1; + inex = STRTOG_Inexhi; + delta = diff(bb, bd); + if (delta == NULL) + return (STRTOG_NoMemory); + if (delta->wds <= 1 && !delta->x[0]) + break; + dsign = delta->sign; + delta->sign = finished = 0; + L = 0; + i = cmp(delta, bs); + if (rd && i <= 0) { + irv = STRTOG_Normal; + if ( (finished = dsign ^ (rd&1)) !=0) { + if (dsign != 0) { + irv |= STRTOG_Inexhi; + goto adj1; + } + irv |= STRTOG_Inexlo; + if (rve1 == emin) + goto adj1; + for(i = 0, j = nbits; j >= ULbits; + i++, j -= ULbits) { + if (rvb->x[i] & ALL_ON) + goto adj1; + } + if (j > 1 && lo0bits(rvb->x + i) < j - 1) + goto adj1; + rve = rve1 - 1; + rvb = set_ones(rvb, rvbits = nbits); + if (rvb == NULL) + return (STRTOG_NoMemory); + break; + } + irv |= dsign ? STRTOG_Inexlo : STRTOG_Inexhi; + break; + } + if (i < 0) { + /* Error is less than half an ulp -- check for + * special case of mantissa a power of two. + */ + irv = dsign + ? STRTOG_Normal | STRTOG_Inexlo + : STRTOG_Normal | STRTOG_Inexhi; + if (dsign || bbbits > 1 || denorm || rve1 == emin) + break; + delta = lshift(delta,1); + if (delta == NULL) + return (STRTOG_NoMemory); + if (cmp(delta, bs) > 0) { + irv = STRTOG_Normal | STRTOG_Inexlo; + goto drop_down; + } + break; + } + if (i == 0) { + /* exactly half-way between */ + if (dsign) { + if (denorm && all_on(rvb, rvbits)) { + /*boundary case -- increment exponent*/ + rvb->wds = 1; + rvb->x[0] = 1; + rve = emin + nbits - (rvbits = 1); + irv = STRTOG_Normal | STRTOG_Inexhi; + denorm = 0; + break; + } + irv = STRTOG_Normal | STRTOG_Inexlo; + } + else if (bbbits == 1) { + irv = STRTOG_Normal; + drop_down: + /* boundary case -- decrement exponent */ + if (rve1 == emin) { + irv = STRTOG_Normal | STRTOG_Inexhi; + if (rvb->wds == 1 && rvb->x[0] == 1) + sudden_underflow = 1; + break; + } + rve -= nbits; + rvb = set_ones(rvb, rvbits = nbits); + if (rvb == NULL) + return (STRTOG_NoMemory); + break; + } + else + irv = STRTOG_Normal | STRTOG_Inexhi; + if ((bbbits < nbits && !denorm) || !(rvb->x[0] & 1)) + break; + if (dsign) { + rvb = increment(rvb); + if (rvb == NULL) + return (STRTOG_NoMemory); + j = kmask & (ULbits - (rvbits & kmask)); + if (hi0bits(rvb->x[rvb->wds - 1]) != j) + rvbits++; + irv = STRTOG_Normal | STRTOG_Inexhi; + } + else { + if (bbbits == 1) + goto undfl; + decrement(rvb); + irv = STRTOG_Normal | STRTOG_Inexlo; + } + break; + } + if ((dval(&adj) = ratio(delta, bs)) <= 2.) { + adj1: + inex = STRTOG_Inexlo; + if (dsign) { + asub = 0; + inex = STRTOG_Inexhi; + } + else if (denorm && bbbits <= 1) { + undfl: + rvb->wds = 0; + rve = emin; + irv = STRTOG_Underflow | STRTOG_Inexlo; + break; + } + adj0 = dval(&adj) = 1.; + } + else { + adj0 = dval(&adj) *= 0.5; + if (dsign) { + asub = 0; + inex = STRTOG_Inexlo; + } + if (dval(&adj) < 2147483647.) { + L = adj0; + adj0 -= L; + switch(rd) { + case 0: + if (adj0 >= .5) + goto inc_L; + break; + case 1: + if (asub && adj0 > 0.) + goto inc_L; + break; + case 2: + if (!asub && adj0 > 0.) { + inc_L: + L++; + inex = STRTOG_Inexact - inex; + } + } + dval(&adj) = L; + } + } + y = rve + rvbits; + + /* adj *= ulp(dval(&rv)); */ + /* if (asub) rv -= adj; else rv += adj; */ + + if (!denorm && rvbits < nbits) { + rvb = lshift(rvb, j = nbits - rvbits); + if (rvb == NULL) + return (STRTOG_NoMemory); + rve -= j; + rvbits = nbits; + } + ab = d2b(dval(&adj), &abe, &abits); + if (ab == NULL) + return (STRTOG_NoMemory); + if (abe < 0) + rshift(ab, -abe); + else if (abe > 0) { + ab = lshift(ab, abe); + if (ab == NULL) + return (STRTOG_NoMemory); + } + rvb0 = rvb; + if (asub) { + /* rv -= adj; */ + j = hi0bits(rvb->x[rvb->wds-1]); + rvb = diff(rvb, ab); + if (rvb == NULL) + return (STRTOG_NoMemory); + k = rvb0->wds - 1; + if (denorm) + /* do nothing */; + else if (rvb->wds <= k + || hi0bits( rvb->x[k]) > + hi0bits(rvb0->x[k])) { + /* unlikely; can only have lost 1 high bit */ + if (rve1 == emin) { + --rvbits; + denorm = 1; + } + else { + rvb = lshift(rvb, 1); + if (rvb == NULL) + return (STRTOG_NoMemory); + --rve; + --rve1; + L = finished = 0; + } + } + } + else { + rvb = sum(rvb, ab); + if (rvb == NULL) + return (STRTOG_NoMemory); + k = rvb->wds - 1; + if (k >= rvb0->wds + || hi0bits(rvb->x[k]) < hi0bits(rvb0->x[k])) { + if (denorm) { + if (++rvbits == nbits) + denorm = 0; + } + else { + rshift(rvb, 1); + rve++; + rve1++; + L = 0; + } + } + } + Bfree(ab); + Bfree(rvb0); + if (finished) + break; + + z = rve + rvbits; + if (y == z && L) { + /* Can we stop now? */ + tol = dval(&adj) * 5e-16; /* > max rel error */ + dval(&adj) = adj0 - .5; + if (dval(&adj) < -tol) { + if (adj0 > tol) { + irv |= inex; + break; + } + } + else if (dval(&adj) > tol && adj0 < 1. - tol) { + irv |= inex; + break; + } + } + bb0 = denorm ? 0 : trailz(rvb); + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(delta); + } + if (!denorm && (j = nbits - rvbits)) { + if (j > 0) { + rvb = lshift(rvb, j); + if (rvb == NULL) + return (STRTOG_NoMemory); + } + else + rshift(rvb, -j); + rve -= j; + } + *exp = rve; + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); + if (rve > fpi->emax) { + switch(fpi->rounding & 3) { + case FPI_Round_near: + goto huge; + case FPI_Round_up: + if (!sign) + goto huge; + break; + case FPI_Round_down: + if (sign) + goto huge; + } + /* Round to largest representable magnitude */ + Bfree(rvb); + rvb = 0; + irv = STRTOG_Normal | STRTOG_Inexlo; + *exp = fpi->emax; + b = bits; + be = b + ((fpi->nbits + 31) >> 5); + while(b < be) + *b++ = -1; + if ((j = fpi->nbits & 0x1f)) + *--be >>= (32 - j); + goto ret; + huge: + rvb->wds = 0; + irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + infnanexp: + *exp = fpi->emax + 1; + } + ret: + if (denorm) { + if (sudden_underflow) { + if (!rvb) abort(); + rvb->wds = 0; + irv = STRTOG_Underflow | STRTOG_Inexlo; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + } + else { + if (!rvb) abort(); + irv = (irv & ~STRTOG_Retmask) | + (rvb->wds > 0 ? STRTOG_Denormal : STRTOG_Zero); + if (irv & STRTOG_Inexact) { + irv |= STRTOG_Underflow; +#ifndef NO_ERRNO + errno = ERANGE; +#endif + } + } + } + if (se) + *se = (char *)s; + if (sign) + irv |= STRTOG_Neg; + if (rvb) { + copybits(bits, nbits, rvb); + Bfree(rvb); + } + return irv; + } diff --git a/sdk/tlibc/gdtoa/strtof.c b/sdk/tlibc/gdtoa/strtof.c new file mode 100644 index 0000000000..224491b50f --- /dev/null +++ b/sdk/tlibc/gdtoa/strtof.c @@ -0,0 +1,81 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 2000 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + float +#ifdef KR_headers +strtof(s, sp) CONST char *s; char **sp; +#else +strtof(CONST char *s, char **sp) +#endif +{ + static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI }; + ULong bits[1]; + Long exp; + int k; + union { ULong L[1]; float f; } u; +#ifdef Honor_FLT_ROUNDS +#include "gdtoa_fltrnds.h" +#else +#define fpi &fpi0 +#endif + + k = strtodg(s, sp, fpi, &exp, bits); + switch(k & STRTOG_Retmask) { + case STRTOG_NoNumber: + case STRTOG_Zero: + u.L[0] = 0; + break; + + case STRTOG_Normal: + case STRTOG_NaNbits: + u.L[0] = (bits[0] & 0x7fffff) | ((exp + 0x7f + 23) << 23); + break; + + case STRTOG_Denormal: + u.L[0] = bits[0]; + break; + + case STRTOG_NoMemory: + errno = ERANGE; + /* FALLTHROUGH */ + case STRTOG_Infinite: + u.L[0] = 0x7f800000; + break; + + case STRTOG_NaN: + u.L[0] = f_QNAN; + } + if (k & STRTOG_Neg) + u.L[0] |= 0x80000000L; + return u.f; + } diff --git a/sdk/tlibc/gdtoa/strtold.c b/sdk/tlibc/gdtoa/strtold.c new file mode 100644 index 0000000000..0de6d88c00 --- /dev/null +++ b/sdk/tlibc/gdtoa/strtold.c @@ -0,0 +1,40 @@ +/* $OpenBSD: strtold.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */ +/*- + * Copyright (c) 2003 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Machine-dependent glue to integrate David Gay's gdtoa + * package into libc for architectures where a long double + * is the same as a double, such as the Alpha. + */ + +#include "gdtoaimp.h" + +long double +strtold(const char * __restrict s, char ** __restrict sp) +{ + return strtod(s, sp); +} diff --git a/sdk/tlibc/gdtoa/strtord.c b/sdk/tlibc/gdtoa/strtord.c new file mode 100644 index 0000000000..dd22fb51a6 --- /dev/null +++ b/sdk/tlibc/gdtoa/strtord.c @@ -0,0 +1,73 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 2000 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + void +#ifdef KR_headers +ULtod(L, bits, exp, k) ULong *L; ULong *bits; Long exp; int k; +#else +ULtod(ULong *L, ULong *bits, Long exp, int k) +#endif +{ + switch(k & STRTOG_Retmask) { + case STRTOG_NoNumber: + case STRTOG_Zero: + L[0] = L[1] = 0; + break; + + case STRTOG_Denormal: + L[_1] = bits[0]; + L[_0] = bits[1]; + break; + + case STRTOG_Normal: + case STRTOG_NaNbits: + L[_1] = bits[0]; + L[_0] = (bits[1] & ~0x100000) | ((exp + 0x3ff + 52) << 20); + break; + + case STRTOG_NoMemory: + errno = ERANGE; + /* FALLTHROUGH */ + case STRTOG_Infinite: + L[_0] = 0x7ff00000; + L[_1] = 0; + break; + + case STRTOG_NaN: + L[0] = d_QNAN0; + L[1] = d_QNAN1; + } + if (k & STRTOG_Neg) + L[_0] |= 0x80000000L; + } + diff --git a/sdk/tlibc/gdtoa/strtorx.c b/sdk/tlibc/gdtoa/strtorx.c new file mode 100644 index 0000000000..473642cfa0 --- /dev/null +++ b/sdk/tlibc/gdtoa/strtorx.c @@ -0,0 +1,123 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 2000 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + +#undef _0 +#undef _1 + +/* one or the other of IEEE_MC68k or IEEE_8087 should be #defined */ + +#ifdef IEEE_MC68k +#define _0 0 +#define _1 1 +#define _2 2 +#define _3 3 +#define _4 4 +#endif +#ifdef IEEE_8087 +#define _0 4 +#define _1 3 +#define _2 2 +#define _3 1 +#define _4 0 +#endif + + void +#ifdef KR_headers +ULtox(L, bits, exp, k) UShort *L; ULong *bits; Long exp; int k; +#else +ULtox(UShort *L, ULong *bits, Long exp, int k) +#endif +{ + switch(k & STRTOG_Retmask) { + case STRTOG_NoNumber: + case STRTOG_Zero: + L[0] = L[1] = L[2] = L[3] = L[4] = 0; + break; + + case STRTOG_Denormal: + L[_0] = 0; + goto normal_bits; + + case STRTOG_Normal: + case STRTOG_NaNbits: + L[_0] = exp + 0x3fff + 63; + normal_bits: + L[_4] = (UShort)bits[0]; + L[_3] = (UShort)(bits[0] >> 16); + L[_2] = (UShort)bits[1]; + L[_1] = (UShort)(bits[1] >> 16); + break; + + case STRTOG_NoMemory: + errno = ERANGE; + /* FALLTHROUGH */ + case STRTOG_Infinite: + L[_0] = 0x7fff; + L[_1] = 0x8000; + L[_2] = L[_3] = L[_4] = 0; + break; + + case STRTOG_NaN: + L[0] = ldus_QNAN0; + L[1] = ldus_QNAN1; + L[2] = ldus_QNAN2; + L[3] = ldus_QNAN3; + L[4] = ldus_QNAN4; + } + if (k & STRTOG_Neg) + L[_0] |= 0x8000; + } + + int +#ifdef KR_headers +strtorx(s, sp, rounding, L) CONST char *s; char **sp; int rounding; void *L; +#else +strtorx(CONST char *s, char **sp, int rounding, void *L) +#endif +{ + static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI }; + FPI *fpi, fpi1; + ULong bits[2]; + Long exp; + int k; + + fpi = &fpi0; + if (rounding != FPI_Round_near) { + fpi1 = fpi0; + fpi1.rounding = rounding; + fpi = &fpi1; + } + k = strtodg(s, sp, fpi, &exp, bits); + ULtox((UShort*)L, bits, exp, k); + return k; + } diff --git a/sdk/tlibc/gdtoa/sum.c b/sdk/tlibc/gdtoa/sum.c new file mode 100644 index 0000000000..c6eb954f04 --- /dev/null +++ b/sdk/tlibc/gdtoa/sum.c @@ -0,0 +1,102 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + Bigint * +#ifdef KR_headers +sum(a, b) Bigint *a; Bigint *b; +#else +sum(Bigint *a, Bigint *b) +#endif +{ + Bigint *c; + ULong carry, *xc, *xa, *xb, *xe, y; +#ifdef Pack_32 + ULong z; +#endif + + if (a->wds < b->wds) { + c = b; b = a; a = c; + } + c = Balloc(a->k); + if (c == NULL) + return (NULL); + c->wds = a->wds; + carry = 0; + xa = a->x; + xb = b->x; + xc = c->x; + xe = xc + b->wds; +#ifdef Pack_32 + do { + y = (*xa & 0xffff) + (*xb & 0xffff) + carry; + carry = (y & 0x10000) >> 16; + z = (*xa++ >> 16) + (*xb++ >> 16) + carry; + carry = (z & 0x10000) >> 16; + Storeinc(xc, z, y); + } + while(xc < xe); + xe += a->wds - b->wds; + while(xc < xe) { + y = (*xa & 0xffff) + carry; + carry = (y & 0x10000) >> 16; + z = (*xa++ >> 16) + carry; + carry = (z & 0x10000) >> 16; + Storeinc(xc, z, y); + } +#else + do { + y = *xa++ + *xb++ + carry; + carry = (y & 0x10000) >> 16; + *xc++ = y & 0xffff; + } + while(xc < xe); + xe += a->wds - b->wds; + while(xc < xe) { + y = *xa++ + carry; + carry = (y & 0x10000) >> 16; + *xc++ = y & 0xffff; + } +#endif + if (carry) { + if (c->wds == c->maxwds) { + b = Balloc(c->k + 1); + if (b == NULL) + return (NULL); + Bcopy(b, c); + Bfree(c); + c = b; + } + c->x[c->wds++] = 1; + } + return c; + } diff --git a/sdk/tlibc/gdtoa/ulp.c b/sdk/tlibc/gdtoa/ulp.c new file mode 100644 index 0000000000..17e9f862c4 --- /dev/null +++ b/sdk/tlibc/gdtoa/ulp.c @@ -0,0 +1,70 @@ +/**************************************************************** + +The author of this software is David M. Gay. + +Copyright (C) 1998, 1999 by Lucent Technologies +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that the copyright notice and this +permission notice and warranty disclaimer appear in supporting +documentation, and that the name of Lucent or any of its entities +not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. + +LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. +IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER +IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +****************************************************************/ + +/* Please send bug reports to David M. Gay (dmg at acm dot org, + * with " at " changed at "@" and " dot " changed to "."). */ + +#include "gdtoaimp.h" + + double +ulp +#ifdef KR_headers + (x) U *x; +#else + (U *x) +#endif +{ + Long L; + U a; + + L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; +#ifndef Sudden_Underflow + if (L > 0) { +#endif +#ifdef IBM + L |= Exp_msk1 >> 4; +#endif + word0(&a) = L; + word1(&a) = 0; +#ifndef Sudden_Underflow + } + else { + L = -L >> Exp_shift; + if (L < Exp_shift) { + word0(&a) = 0x80000 >> L; + word1(&a) = 0; + } + else { + word0(&a) = 0; + L -= Exp_shift; + word1(&a) = L >= 31 ? 1 : 1 << (31 - L); + } + } +#endif + return dval(&a); + } diff --git a/sdk/tlibc/gen/__memcpy_chk.cpp b/sdk/tlibc/gen/__memcpy_chk.cpp new file mode 100644 index 0000000000..6bffe1b514 --- /dev/null +++ b/sdk/tlibc/gen/__memcpy_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __memcpy_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" void *__memcpy_chk(void *dest, const void *src, + size_t copy_amount, size_t dest_len) +{ + if (__predict_false(copy_amount > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return memcpy(dest, src, copy_amount); +} diff --git a/sdk/tlibc/gen/__memmove_chk.cpp b/sdk/tlibc/gen/__memmove_chk.cpp new file mode 100644 index 0000000000..6b3dbad063 --- /dev/null +++ b/sdk/tlibc/gen/__memmove_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____memmove_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" void *__memmove_chk (void *dest, const void *src, + size_t len, size_t dest_len) +{ + if (__predict_false(len > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return memmove(dest, src, len); +} diff --git a/sdk/tlibc/gen/__mempcpy_chk.cpp b/sdk/tlibc/gen/__mempcpy_chk.cpp new file mode 100644 index 0000000000..4842ad4a5f --- /dev/null +++ b/sdk/tlibc/gen/__mempcpy_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __mempcpy_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" void *__mempcpy_chk(void *dest, const void *src, + size_t copy_amount, size_t dest_len) +{ + if (__predict_false(copy_amount > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return mempcpy(dest, src, copy_amount); +} diff --git a/sdk/tlibc/gen/__memset_chk.cpp b/sdk/tlibc/gen/__memset_chk.cpp new file mode 100644 index 0000000000..399ebbd646 --- /dev/null +++ b/sdk/tlibc/gen/__memset_chk.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____memset_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" void *__memset_chk (void *dest, int c, size_t n, size_t dest_len) +{ + if (__predict_false(n > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return memset(dest, c, n); +} diff --git a/sdk/tlibc/gen/__stpcpy_chk.cpp b/sdk/tlibc/gen/__stpcpy_chk.cpp new file mode 100644 index 0000000000..07717acc28 --- /dev/null +++ b/sdk/tlibc/gen/__stpcpy_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____stpcpy_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" char *__stpcpy_chk (char *dest, const char *src, size_t dest_len) { + // TODO: optimize so we don't scan src twice. + size_t src_len = strlen(src) + 1; + if (__predict_false(src_len > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return stpncpy(dest, src, src_len-1); +} diff --git a/sdk/tlibc/gen/__stpncpy_chk.cpp b/sdk/tlibc/gen/__stpncpy_chk.cpp new file mode 100644 index 0000000000..256c320c0f --- /dev/null +++ b/sdk/tlibc/gen/__stpncpy_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____stpncpy_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" char *__stpncpy_chk (char *dest, const char *src, + size_t len, size_t dest_len) +{ + if (__predict_false(len > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return stpncpy(dest, src, len); +} diff --git a/sdk/tlibc/gen/__strcat_chk.cpp b/sdk/tlibc/gen/__strcat_chk.cpp new file mode 100644 index 0000000000..729250c770 --- /dev/null +++ b/sdk/tlibc/gen/__strcat_chk.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____strcat_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" size_t __strlen_chk(const char *s, size_t s_len); +extern "C" char *__strcat_chk (char *dest, const char *src, size_t dest_buf_size) { + char* save = dest; + size_t dest_len = __strlen_chk(dest, dest_buf_size); + + dest += dest_len; + dest_buf_size -= dest_len; + + while ((*dest++ = *src++) != '\0') { + dest_buf_size--; + if (__predict_false(dest_buf_size == 0)) { + /* TODO: add runtime error massage */ + abort(); + } + } + + return save; +} diff --git a/sdk/tlibc/gen/__strcpy_chk.cpp b/sdk/tlibc/gen/__strcpy_chk.cpp new file mode 100644 index 0000000000..ab30e4accd --- /dev/null +++ b/sdk/tlibc/gen/__strcpy_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____strcpy_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" char *__strcpy_chk (char *dest, const char *src, size_t dest_len) { + // TODO: optimize so we don't scan src twice. + size_t src_len = strlen(src) + 1; + if (__predict_false(src_len > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return strncpy(dest, src, src_len-1); +} diff --git a/sdk/tlibc/gen/__strlen_chk.cpp b/sdk/tlibc/gen/__strlen_chk.cpp new file mode 100644 index 0000000000..2d11eb5230 --- /dev/null +++ b/sdk/tlibc/gen/__strlen_chk.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __strlen_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + * This strlen check is called if _FORTIFY_SOURCE is defined and + * greater than 0. + * + * This test is designed to detect code such as: + * + * int main() { + * char buf[10]; + * memcpy(buf, "1234567890", sizeof(buf)); + * size_t len = strlen(buf); // segfault here with _FORTIFY_SOURCE + * printf("%d\n", len); + * return 0; + * } + * + * or anytime strlen reads beyond an object boundary. + */ +extern "C" size_t __strlen_chk(const char *s, size_t s_len) { + size_t ret = strlen(s); + + if (__predict_false(ret >= s_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return ret; +} \ No newline at end of file diff --git a/sdk/tlibc/gen/__strncat_chk.cpp b/sdk/tlibc/gen/__strncat_chk.cpp new file mode 100644 index 0000000000..ac3e72f335 --- /dev/null +++ b/sdk/tlibc/gen/__strncat_chk.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____strncat_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" size_t __strlen_chk(const char *s, size_t s_len); +extern "C" char *__strncat_chk (char *dest, const char *src, + size_t len, size_t dest_buf_size) +{ + if (len == 0) { + return dest; + } + + size_t dest_len = __strlen_chk(dest, dest_buf_size); + char *d = dest + dest_len; + dest_buf_size -= dest_len; + + while (*src != '\0') { + *d++ = *src++; + len--; dest_buf_size--; + + if (__predict_false(dest_buf_size == 0)) { + /* TODO: add runtime error massage */ + abort(); + } + + if (len == 0) { + break; + } + } + + *d = '\0'; + return dest; +} diff --git a/sdk/tlibc/gen/__strncpy_chk.cpp b/sdk/tlibc/gen/__strncpy_chk.cpp new file mode 100644 index 0000000000..306f4bdd20 --- /dev/null +++ b/sdk/tlibc/gen/__strncpy_chk.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Runtime implementation of __builtin____strncpy_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" char *__strncpy_chk (char *dest, const char *src, + size_t len, size_t dest_len) +{ + if (__predict_false(len > dest_len)) { + /* TODO: add runtime error massage */ + abort(); + } + + return strncpy(dest, src, len); +} diff --git a/sdk/tlibc/gen/__vsnprintf_chk.cpp b/sdk/tlibc/gen/__vsnprintf_chk.cpp new file mode 100644 index 0000000000..02c72cd116 --- /dev/null +++ b/sdk/tlibc/gen/__vsnprintf_chk.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* + * Runtime implementation of __builtin____vsnprintf_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" int __vsnprintf_chk( + char *dest, + size_t supplied_size, + int /*flags*/, + size_t dest_len_from_compiler, + const char *format, + va_list va) +{ + if (__predict_false(supplied_size > dest_len_from_compiler)) { + /* TODO: add runtime error massage */ + abort(); + } + + return vsnprintf(dest, supplied_size, format, va); +} + +/* + * Runtime implementation of __builtin____snprintf_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" int __snprintf_chk( + char *dest, + size_t supplied_size, + int flags, + size_t dest_len_from_compiler, + const char *format, ...) +{ + va_list va; + int retval; + + va_start(va, format); + retval = __vsnprintf_chk(dest, supplied_size, flags, + dest_len_from_compiler, format, va); + va_end(va); + + return retval; +} diff --git a/sdk/tlibc/gen/__vsprintf_chk.cpp b/sdk/tlibc/gen/__vsprintf_chk.cpp new file mode 100644 index 0000000000..68e65d06ef --- /dev/null +++ b/sdk/tlibc/gen/__vsprintf_chk.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* + * Runtime implementation of __builtin____vsprintf_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" int __vsprintf_chk( + char *dest, + int /*flags*/, + size_t dest_len_from_compiler, + const char *format, + va_list va) +{ + int ret = vsnprintf(dest, dest_len_from_compiler, format, va); + + if ((size_t) ret >= dest_len_from_compiler) { + /* TODO: add runtime error massage */ + abort(); + } + + return ret; +} + +/* + * Runtime implementation of __builtin____sprintf_chk. + * + * See + * http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html + * http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html + * for details. + * + */ +extern "C" int __sprintf_chk( + char *dest, + int flags, + size_t dest_len_from_compiler, + const char *format, ...) +{ + va_list va; + int retval; + + va_start(va, format); + retval = __vsprintf_chk(dest, flags, + dest_len_from_compiler, format, va); + va_end(va); + + return retval; +} diff --git a/sdk/tlibc/gen/alloca.S b/sdk/tlibc/gen/alloca.S new file mode 100644 index 0000000000..255e604f24 --- /dev/null +++ b/sdk/tlibc/gen/alloca.S @@ -0,0 +1,67 @@ +/* $OpenBSD: alloca.S,v 1.6 2005/08/07 11:30:38 espie Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* like alloc, but automatic free in return */ + +#define _C_LABEL(x) x +#ifdef __i386__ +#define _ALIGN_TEXT .align 2, 0x90 +#else /* __x86_64__ */ +#define _ALIGN_TEXT .align 16, 0x90 +#endif +#define _ENTRY(x) .text; _ALIGN_TEXT; .globl x; .type x,@function; x: +#define ENTRY(y) _ENTRY(_C_LABEL(y)); + +ENTRY(alloca) +#ifdef __i386__ + popl %edx /* pop return addr */ + popl %eax /* pop amount to allocate */ + movl %esp,%ecx + addl $3,%eax /* round up to next word */ + andl $-4,%eax + subl %eax,%esp + movl %esp,%eax /* base of newly allocated space */ + pushl 8(%ecx) /* copy possible saved registers */ + pushl 4(%ecx) + pushl 0(%ecx) + pushl %eax /* dummy to pop at callsite */ + jmp *%edx /* "return" */ +#else /* __x86_64__ */ + popq %rdx + movq %rsp,%rcx + addq $15,%rdi /* round up to 16 bytes */ + andq $~15,%rdi + subq %rdi,%rsp + movq %rsp,%rax + jmp *%rdx +#endif diff --git a/sdk/tlibc/gen/assert.c b/sdk/tlibc/gen/assert.c new file mode 100644 index 0000000000..06a6b79b15 --- /dev/null +++ b/sdk/tlibc/gen/assert.c @@ -0,0 +1,52 @@ +/* $OpenBSD: assert.c,v 1.8 2005/08/08 08:05:33 espie Exp $ */ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +void +__assert(const char *file, int line, const char *func, const char *failedexpr) +{ +#if 0 + (void)fprintf(stderr, + "assertion \"%s\" failed: file \"%s\", line %d, function \"%s\"\n", + failedexpr, file, line, func); +#else + (void)(file); + (void)(line); + (void)(func); + (void)(failedexpr); +#endif + + abort(); + /* NOTREACHED */ +} diff --git a/sdk/tlibc/gen/ctype_.c b/sdk/tlibc/gen/ctype_.c new file mode 100644 index 0000000000..378d9db911 --- /dev/null +++ b/sdk/tlibc/gen/ctype_.c @@ -0,0 +1,77 @@ +/* $OpenBSD: ctype_.c,v 1.10 2011/09/22 09:06:10 stsp Exp $ */ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include "ctype_private.h" + + +const char _C_ctype_[1 + CTYPE_NUM_CHARS] = { + 0, + _C, _C, _C, _C, _C, _C, _C, _C, + _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, + _C, _C, _C, _C, _C, _C, _C, _C, + _C, _C, _C, _C, _C, _C, _C, _C, + _S|(char)_B, _P, _P, _P, _P, _P, _P, _P, + _P, _P, _P, _P, _P, _P, _P, _P, + _N, _N, _N, _N, _N, _N, _N, _N, + _N, _N, _P, _P, _P, _P, _P, _P, + _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, + _U, _U, _U, _U, _U, _U, _U, _U, + _U, _U, _U, _U, _U, _U, _U, _U, + _U, _U, _U, _P, _P, _P, _P, _P, + _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, + _L, _L, _L, _L, _L, _L, _L, _L, + _L, _L, _L, _L, _L, _L, _L, _L, + _L, _L, _L, _P, _P, _P, _P, _C, + + 0, 0, 0, 0, 0, 0, 0, 0, /* 80 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 88 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 90 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 98 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* A0 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* A8 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* B0 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* B8 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* C0 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* C8 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* D0 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* D8 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* E0 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* E8 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* F0 */ + 0, 0, 0, 0, 0, 0, 0, 0 /* F8 */ +}; + +const char *_ctype_ = _C_ctype_; diff --git a/sdk/tlibc/gen/ctype_private.h b/sdk/tlibc/gen/ctype_private.h new file mode 100644 index 0000000000..516e79e666 --- /dev/null +++ b/sdk/tlibc/gen/ctype_private.h @@ -0,0 +1,21 @@ +/* $OpenBSD: ctype_private.h,v 1.1 2005/08/08 05:53:00 espie Exp $ */ +/* Written by Marc Espie, public domain */ + +#define _U 0x01 +#define _L 0x02 +#define _N 0x04 +#define _S 0x08 +#define _P 0x10 +#define _C 0x20 +#define _X 0x40 +#define _B 0x80 + +#define CTYPE_NUM_CHARS 256 +extern const char _C_ctype_[]; +extern const short _C_toupper_[]; +extern const short _C_tolower_[]; + +extern const char *_ctype_; +extern const short *_tolower_tab_; +extern const short *_toupper_tab_; + diff --git a/sdk/tlibc/gen/errlist.c b/sdk/tlibc/gen/errlist.c new file mode 100644 index 0000000000..2852d1fc52 --- /dev/null +++ b/sdk/tlibc/gen/errlist.c @@ -0,0 +1,148 @@ +/* $OpenBSD: errlist.c,v 1.14 2009/11/24 09:22:22 guenther Exp $ */ +/* + * Copyright (c) 1982, 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _sys_errlist sys_errlist +#define _sys_nerr sys_nerr + +const char *const + _sys_errlist[] = { + "Undefined error: 0", /* 0 - ENOERROR */ + "Operation not permitted", /* 1 - EPERM */ + "No such file or directory", /* 2 - ENOENT */ + "No such process", /* 3 - ESRCH */ + "Interrupted system call", /* 4 - EINTR */ + "Input/output error", /* 5 - EIO */ + "Device not configured", /* 6 - ENXIO */ + "Argument list too long", /* 7 - E2BIG */ + "Exec format error", /* 8 - ENOEXEC */ + "Bad file descriptor", /* 9 - EBADF */ + "No child processes", /* 10 - ECHILD */ + "Resource deadlock avoided", /* 11 - EDEADLK */ + "Cannot allocate memory", /* 12 - ENOMEM */ + "Permission denied", /* 13 - EACCES */ + "Bad address", /* 14 - EFAULT */ + "Block device required", /* 15 - ENOTBLK */ + "Device busy", /* 16 - EBUSY */ + "File exists", /* 17 - EEXIST */ + "Cross-device link", /* 18 - EXDEV */ + "Operation not supported by device", /* 19 - ENODEV */ + "Not a directory", /* 20 - ENOTDIR */ + "Is a directory", /* 21 - EISDIR */ + "Invalid argument", /* 22 - EINVAL */ + "Too many open files in system", /* 23 - ENFILE */ + "Too many open files", /* 24 - EMFILE */ + "Inappropriate ioctl for device", /* 25 - ENOTTY */ + "Text file busy", /* 26 - ETXTBSY */ + "File too large", /* 27 - EFBIG */ + "No space left on device", /* 28 - ENOSPC */ + "Illegal seek", /* 29 - ESPIPE */ + "Read-only file system", /* 30 - EROFS */ + "Too many links", /* 31 - EMLINK */ + "Broken pipe", /* 32 - EPIPE */ + +/* math software */ + "Numerical argument out of domain", /* 33 - EDOM */ + "Result too large", /* 34 - ERANGE */ + +/* non-blocking and interrupt i/o */ + "Resource temporarily unavailable", /* 35 - EAGAIN */ + /* 35 - EWOULDBLOCK */ + "Operation now in progress", /* 36 - EINPROGRESS */ + "Operation already in progress", /* 37 - EALREADY */ + +/* ipc/network software -- argument errors */ + "Socket operation on non-socket", /* 38 - ENOTSOCK */ + "Destination address required", /* 39 - EDESTADDRREQ */ + "Message too long", /* 40 - EMSGSIZE */ + "Protocol wrong type for socket", /* 41 - EPROTOTYPE */ + "Protocol not available", /* 42 - ENOPROTOOPT */ + "Protocol not supported", /* 43 - EPROTONOSUPPORT */ + "Socket type not supported", /* 44 - ESOCKTNOSUPPORT */ + "Operation not supported", /* 45 - EOPNOTSUPP */ + "Protocol family not supported", /* 46 - EPFNOSUPPORT */ + /* 47 - EAFNOSUPPORT */ + "Address family not supported by protocol family", + "Address already in use", /* 48 - EADDRINUSE */ + "Can't assign requested address", /* 49 - EADDRNOTAVAIL */ + +/* ipc/network software -- operational errors */ + "Network is down", /* 50 - ENETDOWN */ + "Network is unreachable", /* 51 - ENETUNREACH */ + "Network dropped connection on reset", /* 52 - ENETRESET */ + "Software caused connection abort", /* 53 - ECONNABORTED */ + "Connection reset by peer", /* 54 - ECONNRESET */ + "No buffer space available", /* 55 - ENOBUFS */ + "Socket is already connected", /* 56 - EISCONN */ + "Socket is not connected", /* 57 - ENOTCONN */ + "Can't send after socket shutdown", /* 58 - ESHUTDOWN */ + "Too many references: can't splice", /* 59 - ETOOMANYREFS */ + "Operation timed out", /* 60 - ETIMEDOUT */ + "Connection refused", /* 61 - ECONNREFUSED */ + + "Too many levels of symbolic links", /* 62 - ELOOP */ + "File name too long", /* 63 - ENAMETOOLONG */ + +/* should be rearranged */ + "Host is down", /* 64 - EHOSTDOWN */ + "No route to host", /* 65 - EHOSTUNREACH */ + "Directory not empty", /* 66 - ENOTEMPTY */ + +/* quotas & mush */ + "Too many processes", /* 67 - EPROCLIM */ + "Too many users", /* 68 - EUSERS */ + "Disk quota exceeded", /* 69 - EDQUOT */ + +/* Network File System */ + "Stale NFS file handle", /* 70 - ESTALE */ + "Too many levels of remote in path", /* 71 - EREMOTE */ + "RPC struct is bad", /* 72 - EBADRPC */ + "RPC version wrong", /* 73 - ERPCMISMATCH */ + "RPC prog. not avail", /* 74 - EPROGUNAVAIL */ + "Program version wrong", /* 75 - EPROGMISMATCH */ + "Bad procedure for program", /* 76 - EPROCUNAVAIL */ + + "No locks available", /* 77 - ENOLCK */ + "Function not implemented", /* 78 - ENOSYS */ + "Inappropriate file type or format", /* 79 - EFTYPE */ + "Authentication error", /* 80 - EAUTH */ + "Need authenticator", /* 81 - ENEEDAUTH */ + "IPsec processing failure", /* 82 - EIPSEC */ + "Attribute not found", /* 83 - ENOATTR */ + "Illegal byte sequence", /* 84 - EILSEQ */ + "No medium found", /* 85 - ENOMEDIUM */ + "Wrong medium type", /* 86 - EMEDIUMTYPE */ + /* 87 - EOVERFLOW */ + "Value too large to be stored in data type", + "Operation canceled", /* 88 - ECANCELED */ + "Identifier removed", /* 89 - EIDRM */ + "No message of desired type", /* 90 - ENOMSG */ + "Not supported", /* 91 - ENOTSUP */ +}; +int _sys_nerr = { sizeof _sys_errlist/sizeof _sys_errlist[0] }; diff --git a/sdk/tlibc/gen/errno.c b/sdk/tlibc/gen/errno.c new file mode 100644 index 0000000000..9dc338d2e5 --- /dev/null +++ b/sdk/tlibc/gen/errno.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +extern int *get_errno_addr(void); + +int *__errno(void) +{ +/* + * get errno's address from TD section. + */ + return get_errno_addr(); +} + +#define __weak_alias(alias,sym) \ + __asm__(".weak " __STRING(alias) " ; " \ + __STRING(alias) " = " __STRING(sym)) +__weak_alias(__errno_location, __errno); diff --git a/sdk/tlibc/gen/infinity.c b/sdk/tlibc/gen/infinity.c new file mode 100644 index 0000000000..9a792d837a --- /dev/null +++ b/sdk/tlibc/gen/infinity.c @@ -0,0 +1,8 @@ +/* $OpenBSD: infinity.c,v 1.4 2005/08/07 11:30:38 espie Exp $ */ +/* infinity.c */ + +#include + +/* bytes for +Infinity on a 387 */ +char __infinity[] __attribute__((__aligned__(sizeof(double)))) = + { 0, 0, 0, 0, 0, 0, (char)0xf0, 0x7f }; diff --git a/sdk/tlibc/gen/isctype.c b/sdk/tlibc/gen/isctype.c new file mode 100644 index 0000000000..667987434e --- /dev/null +++ b/sdk/tlibc/gen/isctype.c @@ -0,0 +1,124 @@ +/* $OpenBSD: isctype.c,v 1.11 2005/08/08 08:05:34 espie Exp $ */ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include "ctype_private.h" + +#undef isalnum +int +isalnum(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N))); +} + +#undef isalpha +int +isalpha(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L))); +} + +#undef isblank +int +isblank(int c) +{ + return (c == ' ' || c == '\t'); +} + +#undef iscntrl +int +iscntrl(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _C)); +} + +#undef isdigit +int +isdigit(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N)); +} + +#undef isgraph +int +isgraph(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N))); +} + +#undef islower +int +islower(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _L)); +} + +#undef isprint +int +isprint(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B))); +} + +#undef ispunct +int +ispunct(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _P)); +} + +#undef isspace +int +isspace(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _S)); +} + +#undef isupper +int +isupper(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _U)); +} + +#undef isxdigit +int +isxdigit(int c) +{ + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X))); +} + diff --git a/sdk/tlibc/gen/nan.c b/sdk/tlibc/gen/nan.c new file mode 100644 index 0000000000..e0bcb52834 --- /dev/null +++ b/sdk/tlibc/gen/nan.c @@ -0,0 +1,9 @@ +/* $OpenBSD: nan.c,v 1.1 2008/07/24 09:31:06 martynas Exp $ */ + +/* Written by Martynas Venckus. Public Domain. */ + +#include + +/* bytes for qNaN on an i386/amd64 (IEEE single format) */ +char __nan[] __attribute__((__aligned__(sizeof(float)))) = + { 0, 0, 0xc0, 0x7f }; diff --git a/sdk/tlibc/gen/sbrk.c b/sdk/tlibc/gen/sbrk.c new file mode 100644 index 0000000000..ac632438b0 --- /dev/null +++ b/sdk/tlibc/gen/sbrk.c @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +#include "trts_util.h" + + +SE_DECLSPEC_EXPORT size_t g_peak_heap_used = 0; +/* Please be aware of: sbrk is not thread safe by default. */ + +void* sbrk(intptr_t n) +{ + static size_t heap_used; + void *heap_ptr = NULL; + + void *heap_base = get_heap_base(); + size_t heap_size = get_heap_size(); + + if (!heap_base) + return (void *)(~(size_t)0); + + /* shrink the heap */ + if (n < 0) { + + if (heap_used <= INTPTR_MAX && ((intptr_t)heap_used + n) < 0) + return (void *)(~(size_t)0); + + heap_used += n; + heap_ptr = (void *)((size_t)heap_base + (size_t)heap_used); + + return heap_ptr; + } + + /* extend the heap */ + if ((heap_used + n) > heap_size) + return (void *)(~(size_t)0); + + heap_ptr = (void *)((size_t)heap_base + (size_t)heap_used); + heap_used += n; + + /* update g_peak_heap_used */ + g_peak_heap_used = (g_peak_heap_used < heap_used) ? heap_used : g_peak_heap_used; + + return heap_ptr; +} diff --git a/sdk/tlibc/gen/se_cpuid.c b/sdk/tlibc/gen/se_cpuid.c new file mode 100644 index 0000000000..d1255bdfd2 --- /dev/null +++ b/sdk/tlibc/gen/se_cpuid.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** + * File: sgx_cpuid.c + * Description: + * Get CPU info via Ocalls. + */ + +#include +#include + +#include "sgx_trts.h" +#include "sgx_cpuid.h" +#include "sgx_error.h" + +sgx_status_t sgx_oc_cpuidex(int cpuinfo[4], int leaf, int subleaf); + +sgx_status_t sgx_cpuidex(int cpuinfo[4], int leaf, int subleaf) +{ + if (cpuinfo == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + return sgx_oc_cpuidex(cpuinfo, leaf, subleaf); +} + +sgx_status_t sgx_cpuid(int cpuinfo[4], int leaf) +{ + return sgx_cpuidex(cpuinfo, leaf, 0); +} diff --git a/sdk/tlibc/gen/spinlock.c b/sdk/tlibc/gen/spinlock.c new file mode 100644 index 0000000000..8eb1799769 --- /dev/null +++ b/sdk/tlibc/gen/spinlock.c @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +static inline void _mm_pause(void) __attribute__((always_inline)); +static inline int _InterlockedExchange(int volatile * dst, int val) __attribute__((always_inline)); + +static inline void _mm_pause(void) +{ + __asm __volatile( + "pause" + ); +} + +static inline int _InterlockedExchange(int volatile * dst, int val) +{ + int res; + + __asm __volatile( + "lock xchg %2, %1;" + "mov %2, %0" + : "=m" (res) + : "m" (*dst), + "r" (val) + : "memory" + ); + + return (res); + +} + +uint32_t sgx_spin_lock(sgx_spinlock_t *lock) +{ + while(_InterlockedExchange((volatile int *)lock, 1) != 0) { + while (*lock) { + /* tell cpu we are spinning */ + _mm_pause(); + } + } + + return (0); +} + +uint32_t sgx_spin_unlock(sgx_spinlock_t *lock) +{ + *lock = 0; + + return (0); +} + diff --git a/sdk/tlibc/gen/tolower_.c b/sdk/tlibc/gen/tolower_.c new file mode 100644 index 0000000000..c48cd0ceb1 --- /dev/null +++ b/sdk/tlibc/gen/tolower_.c @@ -0,0 +1,56 @@ +/* $OpenBSD: tolower_.c,v 1.9 2005/08/08 08:05:34 espie Exp $ */ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include +#include +#include "ctype_private.h" + +const short _C_tolower_[1 + CTYPE_NUM_CHARS] = { + EOF, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +const short *_tolower_tab_ = _C_tolower_; + +#undef tolower +int +tolower(int c) +{ + if ((unsigned int)c > 255) + return(c); + return((_tolower_tab_ + 1)[c]); +} diff --git a/sdk/tlibc/gen/toupper_.c b/sdk/tlibc/gen/toupper_.c new file mode 100644 index 0000000000..759404d99b --- /dev/null +++ b/sdk/tlibc/gen/toupper_.c @@ -0,0 +1,57 @@ +/* $OpenBSD: toupper_.c,v 1.10 2005/08/09 08:36:48 kevlo Exp $ */ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#include +#include + +#include "ctype_private.h" + +const short _C_toupper_[1 + CTYPE_NUM_CHARS] = { + EOF, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +const short *_toupper_tab_ = _C_toupper_; + +#undef toupper +int +toupper(int c) +{ + if ((unsigned int)c > 255) + return(c); + return((_toupper_tab_ + 1)[c]); +} diff --git a/sdk/tlibc/locale/btowc.c b/sdk/tlibc/locale/btowc.c new file mode 100644 index 0000000000..d6c1c195d8 --- /dev/null +++ b/sdk/tlibc/locale/btowc.c @@ -0,0 +1,54 @@ +/* $OpenBSD: btowc.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002, 2003 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include + +wint_t btowc(int c) +{ + mbstate_t mbs; + char cc; + wchar_t wc; + + /* align with actual outputs of glibc btowc */ + if (c < 0 || c > SCHAR_MAX || c == EOF) + return (WEOF); + /* + * We expect mbrtowc() to return 0 or 1, hence the check for n > 1 + * which detects error return values as well as "impossible" byte + * counts. + */ + memset(&mbs, 0, sizeof(mbs)); + cc = (char)c; + if (mbrtowc(&wc, &cc, 1, &mbs) > 1) + return (WEOF); + return (wc); +} diff --git a/sdk/tlibc/locale/mblen.c b/sdk/tlibc/locale/mblen.c new file mode 100644 index 0000000000..259e8f582e --- /dev/null +++ b/sdk/tlibc/locale/mblen.c @@ -0,0 +1,48 @@ +/* $OpenBSD: mblen.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +int +mblen(const char *s, size_t n) +{ + static mbstate_t mbs; + size_t rval; + + if (s == NULL) { + /* No support for state dependent encodings. */ + memset(&mbs, 0, sizeof(mbs)); + return (0); + } + rval = mbrtowc(NULL, s, n, &mbs); + if (rval == (size_t)-1 || rval == (size_t)-2) + return (-1); + return ((int)rval); +} diff --git a/sdk/tlibc/locale/mbrlen.c b/sdk/tlibc/locale/mbrlen.c new file mode 100644 index 0000000000..0f05bd0721 --- /dev/null +++ b/sdk/tlibc/locale/mbrlen.c @@ -0,0 +1,39 @@ +/* $OpenBSD: mbrlen.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +size_t +mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps) +{ + static mbstate_t mbs; + + if (ps == NULL) + ps = &mbs; + return (mbrtowc(NULL, s, n, ps)); +} diff --git a/sdk/tlibc/locale/mbstowcs.c b/sdk/tlibc/locale/mbstowcs.c new file mode 100644 index 0000000000..b3699361f0 --- /dev/null +++ b/sdk/tlibc/locale/mbstowcs.c @@ -0,0 +1,43 @@ +/* $OpenBSD: mbstowcs.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +size_t +mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n) +{ + mbstate_t mbs; + const char *sp; + + memset(&mbs, 0, sizeof(mbs)); + sp = s; + return (mbsrtowcs(pwcs, &sp, n, &mbs)); +} diff --git a/sdk/tlibc/locale/mbtowc.c b/sdk/tlibc/locale/mbtowc.c new file mode 100644 index 0000000000..e2e6300fa8 --- /dev/null +++ b/sdk/tlibc/locale/mbtowc.c @@ -0,0 +1,49 @@ +/* $OpenBSD: mbtowc.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +int +mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n) +{ + static mbstate_t mbs; + size_t rval; + + if (s == NULL) { + /* No support for state dependent encodings. */ + memset(&mbs, 0, sizeof(mbs)); + return (0); + } + rval = mbrtowc(pwc, s, n, &mbs); + if (rval == (size_t)-1 || rval == (size_t)-2) + return (-1); + return ((int)rval); +} diff --git a/sdk/tlibc/locale/multibyte_citrus_none.c b/sdk/tlibc/locale/multibyte_citrus_none.c new file mode 100644 index 0000000000..d0f80509cb --- /dev/null +++ b/sdk/tlibc/locale/multibyte_citrus_none.c @@ -0,0 +1,179 @@ +/* $OpenBSD: multibyte_citrus.c,v 1.4 2012/12/05 23:20:00 deraadt Exp $ */ +/* $NetBSD: multibyte_amd1.c,v 1.7 2009/01/11 02:46:28 christos Exp $ */ +/* $OpenBSD: citrus_none.c,v 1.5 2013/03/07 18:12:31 stsp Exp $ */ +/* $NetBSD: citrus_none.c,v 1.18 2008/06/14 16:01:07 tnozaki Exp $ */ + +/*- + * Copyright (c)2002 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "internal/util.h" + +size_t mbsnrtowcs(wchar_t *, const char **, size_t, size_t, mbstate_t *); +size_t wcsnrtombs(char *, const wchar_t **, size_t, size_t, mbstate_t *); + +/* + * Convert an unsigned char value into a char value without relying on + * signed overflow behavior. + */ +static __inline char +wrapv(unsigned char ch) +{ + if (ch >= 0x80) + return ((int)ch - 0x100); + else + return (ch); +} + +int +mbsinit(const mbstate_t *ps) +{ + UNUSED(ps); + return (1); /* always initial state */ +} + +size_t +mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) +{ + /* pwc may be NULL */ + /* s may be NULL */ + /* ps appears to be unused */ + + UNUSED(ps); + + if (s == NULL) + return 0; + if (n == 0) + return (size_t)-2; + if (pwc) + *pwc = (wchar_t)(unsigned char)*s; + return (*s != '\0'); +} + +size_t +mbsrtowcs(wchar_t *dst, const char **src, size_t len, mbstate_t *ps) +{ + return (mbsnrtowcs(dst, src, SIZE_MAX, len, ps)); +} + +size_t +mbsnrtowcs(wchar_t *dst, const char **src, size_t nmc, size_t len, + mbstate_t *ps) +{ + size_t i; + + /* dst may be NULL */ + /* ps appears to be unused */ + + UNUSED(ps); + + if (dst == NULL) + return strnlen(*src, nmc); + + for (i = 0; i < nmc && i < len; i++) + if ((dst[i] = (wchar_t)(unsigned char)(*src)[i]) == L'\0') { + *src = NULL; + return (i); + } + + *src += i; + return (i); +} + +size_t +wcrtomb(char *s, wchar_t wc, mbstate_t *ps) +{ + /* s may be NULL */ + /* ps appears to be unused */ + + UNUSED(ps); + + if (s == NULL) + return (1); + + if (wc < 0 || wc > 0xff) { + errno = EILSEQ; + return (-1); + } + + *s = wrapv(wc); + return (1); +} + +size_t +wcsrtombs(char *dst, const wchar_t **src, size_t len, mbstate_t *ps) +{ + return (wcsnrtombs(dst, src, SIZE_MAX, len, ps)); +} + +size_t +wcsnrtombs(char *dst, const wchar_t **src, size_t nwc, size_t len, + mbstate_t *ps) +{ + size_t i; + + /* dst may be NULL */ + /* ps appears to be unused */ + + UNUSED(ps); + + if (dst == NULL) { + for (i = 0; i < nwc; i++) { + wchar_t wc = (*src)[i]; + if (wc < 0 || wc > 0xff) { + errno = EILSEQ; + return (-1); + } + if (wc == L'\0') + return (i); + } + return (i); + } + + for (i = 0; i < nwc && i < len; i++) { + wchar_t wc = (*src)[i]; + if (wc < 0 || wc > 0xff) { + *src += i; + errno = EILSEQ; + return (-1); + } + dst[i] = wrapv(wc); + if (wc == L'\0') { + *src = NULL; + return (i); + } + } + *src += i; + return (i); +} diff --git a/sdk/tlibc/locale/runetype.h b/sdk/tlibc/locale/runetype.h new file mode 100644 index 0000000000..8c362fe927 --- /dev/null +++ b/sdk/tlibc/locale/runetype.h @@ -0,0 +1,45 @@ +#ifndef _NB_RUNETYPE_H_ +#define _NB_RUNETYPE_H_ + +/* $OpenBSD: runetype.h,v 1.7 2012/12/05 23:20:00 deraadt Exp $ */ +/* $NetBSD: runetype.h,v 1.18 2003/08/07 16:43:04 agc Exp $ */ +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Paul Borman at Krystal Technologies. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)runetype.h 8.1 (Berkeley) 6/2/93 + */ + +#include + +typedef uint32_t rune_t; + + +#endif diff --git a/sdk/tlibc/locale/wcscoll.c b/sdk/tlibc/locale/wcscoll.c new file mode 100644 index 0000000000..a898e433ec --- /dev/null +++ b/sdk/tlibc/locale/wcscoll.c @@ -0,0 +1,41 @@ +/* $OpenBSD: wcscoll.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ +/* $NetBSD: wcscoll.c,v 1.1 2003/03/02 22:18:16 tshiozak Exp $ */ + +/*- + * Copyright (c)2003 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +/* + * Compare strings with using collating information. + */ +int +wcscoll(const wchar_t *s1, const wchar_t *s2) +{ + /* XXX: LC_COLLATE should be implemented. */ + return (wcscmp(s1, s2)); +} diff --git a/sdk/tlibc/locale/wcstombs.c b/sdk/tlibc/locale/wcstombs.c new file mode 100644 index 0000000000..e8054c401b --- /dev/null +++ b/sdk/tlibc/locale/wcstombs.c @@ -0,0 +1,43 @@ +/* $OpenBSD: wcstombs.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +size_t +wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) +{ + mbstate_t mbs; + const wchar_t *pwcsp; + + memset(&mbs, 0, sizeof(mbs)); + pwcsp = pwcs; + return (wcsrtombs(s, &pwcsp, n, &mbs)); +} diff --git a/sdk/tlibc/locale/wcsxfrm.c b/sdk/tlibc/locale/wcsxfrm.c new file mode 100644 index 0000000000..ab1bfdf2d5 --- /dev/null +++ b/sdk/tlibc/locale/wcsxfrm.c @@ -0,0 +1,44 @@ +/* $OpenBSD: wcsxfrm.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ +/* $OpenBSD: wcsxfrm.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ +/* $NetBSD: multibyte_sb.c,v 1.4 2003/08/07 16:43:04 agc Exp $ */ + +/* + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +extern size_t wcslcpy(wchar_t *, const wchar_t *, size_t); + +size_t +wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n) +{ + if (n == 0) + return wcslen(src); + return wcslcpy(dest, src, n); +} diff --git a/sdk/tlibc/locale/wctob.c b/sdk/tlibc/locale/wctob.c new file mode 100644 index 0000000000..ea1f40c58a --- /dev/null +++ b/sdk/tlibc/locale/wctob.c @@ -0,0 +1,43 @@ +/* $OpenBSD: wctob.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +int +wctob(wint_t c) +{ + mbstate_t mbs; + char buf[MB_LEN_MAX]; + + memset(&mbs, 0, sizeof(mbs)); + if (c == WEOF || wcrtomb(buf, c, &mbs) != 1) + return (EOF); + return ((unsigned char)*buf); +} diff --git a/sdk/tlibc/locale/wctomb.c b/sdk/tlibc/locale/wctomb.c new file mode 100644 index 0000000000..39f7a7c769 --- /dev/null +++ b/sdk/tlibc/locale/wctomb.c @@ -0,0 +1,47 @@ +/* $OpenBSD: wctomb.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */ + +/*- + * Copyright (c) 2002-2004 Tim J. Robbins. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +int +wctomb(char *s, wchar_t wchar) +{ + static mbstate_t mbs; + size_t rval; + + if (s == NULL) { + /* No support for state dependent encodings. */ + memset(&mbs, 0, sizeof(mbs)); + return (0); + } + if ((rval = wcrtomb(s, wchar, &mbs)) == (size_t)-1) + return (-1); + return ((int)rval); +} diff --git a/sdk/tlibc/math/w_drem.c b/sdk/tlibc/math/w_drem.c new file mode 100644 index 0000000000..5038f5c409 --- /dev/null +++ b/sdk/tlibc/math/w_drem.c @@ -0,0 +1,14 @@ +/* + * drem() wrapper for remainder(). + * + * Written by J.T. Conklin, + * Placed into the Public Domain, 1994. + */ + +#include + +double +drem(double x, double y) +{ + return remainder(x, y); +} diff --git a/sdk/tlibc/math/w_dremf.c b/sdk/tlibc/math/w_dremf.c new file mode 100644 index 0000000000..f14d98f840 --- /dev/null +++ b/sdk/tlibc/math/w_dremf.c @@ -0,0 +1,14 @@ +/* + * dremf() wrapper for remainderf(). + * + * Written by J.T. Conklin, + * Placed into the Public Domain, 1994. + */ + +#include "math.h" + +float +dremf(float x, float y) +{ + return remainderf(x, y); +} diff --git a/sdk/tlibc/math/w_dreml.c b/sdk/tlibc/math/w_dreml.c new file mode 100644 index 0000000000..5537f164cd --- /dev/null +++ b/sdk/tlibc/math/w_dreml.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +#if (LDBL_MANT_DIG > DBL_MANT_DIG) + +long double dreml(long double x, long double y) +{ + return remainderl(x, y); +} + +#endif diff --git a/sdk/tlibc/math/w_pow10.c b/sdk/tlibc/math/w_pow10.c new file mode 100644 index 0000000000..cc63e92e58 --- /dev/null +++ b/sdk/tlibc/math/w_pow10.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +double +pow10(double x) +{ + return pow(10, x); +} + diff --git a/sdk/tlibc/math/w_pow10f.c b/sdk/tlibc/math/w_pow10f.c new file mode 100644 index 0000000000..eb335fefdd --- /dev/null +++ b/sdk/tlibc/math/w_pow10f.c @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +float +pow10f(float x) +{ + return powf(10, x); +} + diff --git a/sdk/tlibc/math/w_pow10l.c b/sdk/tlibc/math/w_pow10l.c new file mode 100644 index 0000000000..f191c5155f --- /dev/null +++ b/sdk/tlibc/math/w_pow10l.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +#if (LDBL_MANT_DIG > DBL_MANT_DIG) + +long double pow10l(long double x) +{ + return powl(10, x); +} + +#endif diff --git a/sdk/tlibc/stdio/fileext.h b/sdk/tlibc/stdio/fileext.h new file mode 100644 index 0000000000..2d07043024 --- /dev/null +++ b/sdk/tlibc/stdio/fileext.h @@ -0,0 +1,54 @@ +/* $OpenBSD: fileext.h,v 1.2 2005/06/17 20:40:32 espie Exp $ */ +/* $NetBSD: fileext.h,v 1.5 2003/07/18 21:46:41 nathanw Exp $ */ + +/*- + * Copyright (c)2001 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Citrus$ + */ + +/* + * file extension + */ +struct __sfileext { + struct __sbuf _ub; /* ungetc buffer */ + struct wchar_io_data _wcio; /* wide char io status */ +}; + +#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base)) +#define _UB(fp) _EXT(fp)->_ub + +#define _FILEEXT_INIT(fp) \ +do { \ + _UB(fp)._base = NULL; \ + _UB(fp)._size = 0; \ + WCIO_INIT(fp); \ +} while (0) + +#define _FILEEXT_SETUP(f, fext) \ +do { \ + (f)->_ext._base = (unsigned char *)(fext); \ + _FILEEXT_INIT(f); \ +} while (0) diff --git a/sdk/tlibc/stdio/floatio.h b/sdk/tlibc/stdio/floatio.h new file mode 100644 index 0000000000..9769030844 --- /dev/null +++ b/sdk/tlibc/stdio/floatio.h @@ -0,0 +1,58 @@ +/* $OpenBSD: floatio.h,v 1.4 2008/09/07 20:36:08 martynas Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Floating point scanf/printf (input/output) definitions. + */ + +/* 11-bit exponent (VAX G floating point) is 308 decimal digits */ +#define MAXEXP 308 +/* 128 bit fraction takes up 39 decimal digits; max reasonable precision */ +#define MAXFRACT 39 + +/* + * MAXEXPDIG is the maximum number of decimal digits needed to store a + * floating point exponent in the largest supported format. It should + * be ceil(log10(LDBL_MAX_10_EXP)) or, if hexadecimal floating point + * conversions are supported, ceil(log10(LDBL_MAX_EXP)). But since it + * is presently never greater than 5 in practice, we fudge it. + */ +#define MAXEXPDIG 6 +#if LDBL_MAX_EXP > 999999 +#error "floating point buffers too small" +#endif + +char *__hdtoa(double, const char *, int, int *, int *, char **); +char *__hldtoa(long double, const char *, int, int *, int *, char **); +char *__ldtoa(long double *, int, int, int *, int *, char **); diff --git a/sdk/tlibc/stdio/fvwrite.c b/sdk/tlibc/stdio/fvwrite.c new file mode 100644 index 0000000000..ff4dfaaed9 --- /dev/null +++ b/sdk/tlibc/stdio/fvwrite.c @@ -0,0 +1,217 @@ +/* $OpenBSD: fvwrite.c,v 1.17 2009/11/09 00:18:27 kurt Exp $ */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include "local.h" +#include "fvwrite.h" + +/* + * Write some memory regions. Return zero on success, EOF on error. + * + * This routine is large and unsightly, but most of the ugliness due + * to the three different kinds of output buffering is handled here. + */ +int +__sfvwrite(FILE *fp, struct __suio *uio) +{ + size_t len; + char *p; + struct __siov *iov; + int w, s; + char *nl; + int nlknown, nldist; + + if ((len = uio->uio_resid) == 0) + return (0); + /* make sure we can write */ + if (cantwrite(fp)) { + errno = EBADF; + return (EOF); + } + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n)) + + iov = uio->uio_iov; + p = iov->iov_base; + len = iov->iov_len; + iov++; +#define GETIOV(extra_work) \ + while (len == 0) { \ + extra_work; \ + p = iov->iov_base; \ + len = iov->iov_len; \ + iov++; \ + } + if (fp->_flags & __SNBF) { + goto err; + #if 0 + /* + * Unbuffered: write up to BUFSIZ bytes at a time. + */ + do { + GETIOV(;); + w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ)); + if (w <= 0) + goto err; + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + #endif + } else if ((fp->_flags & __SLBF) == 0) { + /* + * Fully buffered: fill partially full buffer, if any, + * and then flush. If there is no partial buffer, write + * one _bf._size byte chunk directly (without copying). + * + * String output is a special case: write as many bytes + * as fit, but pretend we wrote everything. This makes + * snprintf() return the number of bytes needed, rather + * than the number used, and avoids its write function + * (so that the write function can be invalid). + */ + do { + GETIOV(;); + if ((fp->_flags & (__SALC | __SSTR)) == + (__SALC | __SSTR) && fp->_w < len) { + size_t blen = fp->_p - fp->_bf._base; + unsigned char *_base; + int _size; + + /* Allocate space exponentially. */ + _size = fp->_bf._size; + do { + _size = (_size << 1) + 1; + } while (_size < blen + len); + _base = realloc(fp->_bf._base, _size + 1); + if (_base == NULL) + goto err; + fp->_w += _size - fp->_bf._size; + fp->_bf._base = _base; + fp->_bf._size = _size; + fp->_p = _base + blen; + } + w = fp->_w; + if (fp->_flags & __SSTR) { + if (len < w) + w = len; + COPY(w); /* copy MIN(fp->_w,len), */ + fp->_w -= w; + fp->_p += w; + w = len; /* but pretend copied all */ + } else if (fp->_p > fp->_bf._base && len > w) { + #if 0 + /* fill and flush */ + COPY(w); + /* fp->_w -= w; */ /* unneeded */ + fp->_p += w; + if (__sflush(fp)) + #endif + goto err; + } else if (len >= (w = fp->_bf._size)) { + #if 0 + /* write directly */ + w = (*fp->_write)(fp->_cookie, p, w); + if (w <= 0) + #endif + goto err; + } else { + /* fill and done */ + w = len; + COPY(w); + fp->_w -= w; + fp->_p += w; + } + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + } else { + /* + * Line buffered: like fully buffered, but we + * must check for newlines. Compute the distance + * to the first newline (including the newline), + * or `infinity' if there is none, then pretend + * that the amount to write is MIN(len,nldist). + */ + nlknown = 0; + nldist = 0; /* XXX just to keep gcc happy */ + do { + GETIOV(nlknown = 0); + if (!nlknown) { + nl = memchr((void *)p, '\n', len); + nldist = nl ? nl + 1 - p : len + 1; + nlknown = 1; + } + s = MIN(len, nldist); + w = fp->_w + fp->_bf._size; + if (fp->_p > fp->_bf._base && s > w) { + #if 0 + COPY(w); + /* fp->_w -= w; */ + fp->_p += w; + if (__sflush(fp)) + #endif + goto err; + } else if (s >= (w = fp->_bf._size)) { + #if 0 + w = (*fp->_write)(fp->_cookie, p, w); + if (w <= 0) + #endif + goto err; + } else { + w = s; + COPY(w); + fp->_w -= w; + fp->_p += w; + } + if ((nldist -= w) == 0) { + #if 0 + /* copied the newline: flush and forget */ + if (__sflush(fp)) + #endif + goto err; + //nlknown = 0; + } + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + } + return (0); + +err: + fp->_flags |= __SERR; + return (EOF); +} diff --git a/sdk/tlibc/stdio/fvwrite.h b/sdk/tlibc/stdio/fvwrite.h new file mode 100644 index 0000000000..928414e004 --- /dev/null +++ b/sdk/tlibc/stdio/fvwrite.h @@ -0,0 +1,49 @@ +/* $OpenBSD: fvwrite.h,v 1.6 2013/11/12 07:04:35 deraadt Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * I/O descriptors for __sfvwrite(). + */ +struct __siov { + void *iov_base; + size_t iov_len; +}; +struct __suio { + struct __siov *uio_iov; + int uio_iovcnt; + int uio_resid; +}; + +extern int __sfvwrite(FILE *, struct __suio *); + diff --git a/sdk/tlibc/stdio/local.h b/sdk/tlibc/stdio/local.h new file mode 100644 index 0000000000..39c52d0e3e --- /dev/null +++ b/sdk/tlibc/stdio/local.h @@ -0,0 +1,102 @@ +/* $OpenBSD: local.h,v 1.20 2011/11/08 18:30:42 guenther Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Information local to this implementation of stdio, + * in particular, macros and private variables. + */ + +#include +#include "wcio.h" + +#include "internal/arch.h" /* for SE_PAGE_SIZE */ + +#define FLOATING_POINT 1 +#define PRINTF_WIDE_CHAR 1 + +/* + * NB: to fit things in six character monocase externals, the stdio + * code uses the prefix `__s' for stdio objects, typically followed + * by a three-character attempt at a mnemonic. + */ + +/* stdio buffers */ +struct __sbuf { + unsigned char *_base; + int _size; +}; + +/* + * stdio state variables. + */ +typedef struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + + /* operations */ + int (*_read)(void *, char *, int); /* may for sscanf */ + + /* extension data, to avoid further ABI breakage */ + struct __sbuf _ext; +} FILE; + +#define __SLBF 0x0001 /* line buffered */ +#define __SNBF 0x0002 /* unbuffered */ +#define __SRD 0x0004 /* OK to read */ +#define __SWR 0x0008 /* OK to write */ +/* RD and WR are never simultaneously asserted */ +#define __SRW 0x0010 /* open for reading & writing */ +#define __SEOF 0x0020 /* found EOF */ +#define __SERR 0x0040 /* found error */ +#define __SMBF 0x0080 /* _buf is from malloc */ +#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ +#define __SALC 0x4000 /* allocate string space dynamically */ + +#include "fileext.h" + +int __vfprintf(FILE *, const char *, __va_list); +int __vfwprintf(FILE *, const wchar_t *, __va_list); + +#define __sferror(p) (((p)->_flags & __SERR) != 0) + +/* + * Return true if the given FILE cannot be written now. + */ +#define cantwrite(fp) 0 /* alreays writable for char array APIs */ + +/* Disable warnings */ diff --git a/sdk/tlibc/stdio/snprintf.c b/sdk/tlibc/stdio/snprintf.c new file mode 100644 index 0000000000..7b087e95dd --- /dev/null +++ b/sdk/tlibc/stdio/snprintf.c @@ -0,0 +1,68 @@ +/* $OpenBSD: snprintf.c,v 1.18 2011/05/30 18:48:33 martynas Exp $ */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include "local.h" + +/* PRINTFLIKE3 */ +int +snprintf(char *str, size_t n, const char *fmt, ...) +{ + va_list ap; + int ret; + char dummy; + FILE f; + struct __sfileext fext; + + /* While snprintf(3) specifies size_t stdio uses an int internally */ + if (n > INT_MAX) + n = INT_MAX; + /* Stdio internals do not deal correctly with zero length buffer */ + if (n == 0) { + str = &dummy; + n = 1; + } + _FILEEXT_SETUP(&f, &fext); + f._file = -1; + f._flags = __SWR | __SSTR; + f._bf._base = f._p = (unsigned char *)str; + f._bf._size = f._w = n - 1; + va_start(ap, fmt); + ret = __vfprintf(&f, fmt, ap); + va_end(ap); + *f._p = '\0'; + return (ret); +} diff --git a/sdk/tlibc/stdio/swprintf.c b/sdk/tlibc/stdio/swprintf.c new file mode 100644 index 0000000000..c3480436ef --- /dev/null +++ b/sdk/tlibc/stdio/swprintf.c @@ -0,0 +1,45 @@ +/* $OpenBSD: swprintf.c,v 1.5 2012/12/05 23:20:01 deraadt Exp $ */ +/* $NetBSD: swprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */ + +/*- + * Copyright (c) 2002 Tim J. Robbins + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +int +swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vswprintf(s, n, fmt, ap); + va_end(ap); + + return (ret); +} diff --git a/sdk/tlibc/stdio/vfprintf.c b/sdk/tlibc/stdio/vfprintf.c new file mode 100644 index 0000000000..1cfc2168e6 --- /dev/null +++ b/sdk/tlibc/stdio/vfprintf.c @@ -0,0 +1,1517 @@ +/* $OpenBSD: vfprintf.c,v 1.64 2013/11/01 19:05:10 guenther Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Actual printf innards. + * + * This code is large and complicated... + */ + +#include +//#include + +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "local.h" +#include "fvwrite.h" + +union arg { + int intarg; + unsigned int uintarg; + long longarg; + unsigned long ulongarg; + long long longlongarg; + unsigned long long ulonglongarg; + ptrdiff_t ptrdiffarg; + size_t sizearg; + ssize_t ssizearg; + intmax_t intmaxarg; + uintmax_t uintmaxarg; + void *pvoidarg; + char *pchararg; + signed char *pschararg; + short *pshortarg; + int *pintarg; + long *plongarg; + long long *plonglongarg; + ptrdiff_t *pptrdiffarg; + ssize_t *pssizearg; + intmax_t *pintmaxarg; +#ifdef FLOATING_POINT + double doublearg; + long double longdoublearg; +#endif +#ifdef PRINTF_WIDE_CHAR + wint_t wintarg; + wchar_t *pwchararg; +#endif +}; + +static int __find_arguments(const char *fmt0, va_list ap, union arg **argtable, + size_t *argtablesiz); +static int __grow_type_table(unsigned char **typetable, int *tablesize); + +/* + * Flush out all the vectors defined by the given uio, + * then reset it so that it can be reused. + */ +static int +__sprint(FILE *fp, struct __suio *uio) +{ + int err; + + if (uio->uio_resid == 0) { + uio->uio_iovcnt = 0; + return (0); + } + err = __sfvwrite(fp, uio); + uio->uio_resid = 0; + uio->uio_iovcnt = 0; + return (err); +} + +#ifdef PRINTF_WIDE_CHAR +/* + * Convert a wide character string argument for the %ls format to a multibyte + * string representation. If not -1, prec specifies the maximum number of + * bytes to output, and also means that we can't assume that the wide char + * string is null-terminated. + */ +static char * +__wcsconv(wchar_t *wcsarg, int prec) +{ + mbstate_t mbs; + char buf[MB_LEN_MAX]; + wchar_t *p; + char *convbuf; + size_t clen, nbytes; + + /* Allocate space for the maximum number of bytes we could output. */ + if (prec < 0) { + memset(&mbs, 0, sizeof(mbs)); + p = wcsarg; + nbytes = wcsrtombs(NULL, (const wchar_t **)&p, 0, &mbs); + if (nbytes == (size_t)-1) { + errno = EILSEQ; + return (NULL); + } + } else { + /* + * Optimisation: if the output precision is small enough, + * just allocate enough memory for the maximum instead of + * scanning the string. + */ + if (prec < 128) + nbytes = prec; + else { + nbytes = 0; + p = wcsarg; + memset(&mbs, 0, sizeof(mbs)); + for (;;) { + clen = wcrtomb(buf, *p++, &mbs); + if (clen == 0 || clen == (size_t)-1 || + nbytes + clen > (size_t)prec) + break; + nbytes += clen; + } + if (clen == (size_t)-1) { + errno = EILSEQ; + return (NULL); + } + } + } + if ((convbuf = (char *)malloc(nbytes + 1)) == NULL) + return (NULL); + + /* Fill the output buffer. */ + p = wcsarg; + memset(&mbs, 0, sizeof(mbs)); + if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p, + nbytes, &mbs)) == (size_t)-1) { + free(convbuf); + errno = EILSEQ; + return (NULL); + } + convbuf[nbytes] = '\0'; + return (convbuf); +} +#endif + +#ifdef FLOATING_POINT +#include +//#include +#include +#include "floatio.h" + +#define DEFPREC 6 + +extern char *__dtoa(double, int, int, int *, int *, char **); +extern void __freedtoa(char *); +static int exponent(char *, int, int); +#endif /* FLOATING_POINT */ + +/* + * The size of the buffer we use as scratch space for integer + * conversions, among other things. Technically, we would need the + * most space for base 10 conversions with thousands' grouping + * characters between each pair of digits. 100 bytes is a + * conservative overestimate even for a 128-bit uintmax_t. + */ +#define BUF 100 + +#define STATIC_ARG_TBL_SIZE 8 /* Size of static argument table. */ + + +/* + * Macros for converting digits to letters and vice versa + */ +#define to_digit(c) ((c) - '0') +#define is_digit(c) ((unsigned)to_digit(c) <= 9) +#define to_char(n) ((n) + '0') + +/* + * Flags used during conversion. + */ +#define ALT 0x0001 /* alternate form */ +#define LADJUST 0x0004 /* left adjustment */ +#define LONGDBL 0x0008 /* long double */ +#define LONGINT 0x0010 /* long integer */ +#define LLONGINT 0x0020 /* long long integer */ +#define SHORTINT 0x0040 /* short integer */ +#define ZEROPAD 0x0080 /* zero (as opposed to blank) pad */ +#define FPT 0x0100 /* Floating point number */ +#define PTRINT 0x0200 /* (unsigned) ptrdiff_t */ +#define SIZEINT 0x0400 /* (signed) size_t */ +#define CHARINT 0x0800 /* 8 bit integer */ +#define MAXINT 0x1000 /* largest integer size (intmax_t) */ + +int +__vfprintf(FILE *fp, const char *fmt0, __va_list ap) +{ + char *fmt; /* format string */ + int ch; /* character from fmt */ + int n, n2; /* handy integers (short term usage) */ + char *cp; /* handy char pointer (short term usage) */ + struct __siov *iovp; /* for PRINT macro */ + int flags; /* flags as above */ + int ret; /* return value accumulator */ + int width; /* width from format (%8d), or 0 */ + int prec; /* precision from format; <0 for N/A */ + char sign; /* sign prefix (' ', '+', '-', or \0) */ + wchar_t wc; + mbstate_t ps; +#ifdef FLOATING_POINT + /* + * We can decompose the printed representation of floating + * point numbers into several parts, some of which may be empty: + * + * [+|-| ] [0x|0X] MMM . NNN [e|E|p|P] [+|-] ZZ + * A B ---C--- D E F + * + * A: 'sign' holds this value if present; '\0' otherwise + * B: ox[1] holds the 'x' or 'X'; '\0' if not hexadecimal + * C: cp points to the string MMMNNN. Leading and trailing + * zeros are not in the string and must be added. + * D: expchar holds this character; '\0' if no exponent, e.g. %f + * F: at least two digits for decimal, at least one digit for hex + */ + char *decimal_point = "."; + int signflag; /* true if float is negative */ + union { /* floating point arguments %[aAeEfFgG] */ + double dbl; + long double ldbl; + } fparg; + int expt; /* integer value of exponent */ + char expchar; /* exponent character: [eEpP\0] */ + char *dtoaend; /* pointer to end of converted digits */ + int expsize; /* character count for expstr */ + int lead; /* sig figs before decimal or group sep */ + int ndig; /* actual number of digits returned by dtoa */ + char expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */ + char *dtoaresult = NULL; +#endif + + uintmax_t _umax; /* integer arguments %[diouxX] */ + enum { OCT, DEC, HEX } base; /* base for %[diouxX] conversion */ + int dprec; /* a copy of prec if %[diouxX], 0 otherwise */ + int realsz; /* field size expanded by dprec */ + int size; /* size of converted field or string */ + const char *xdigs; /* digits for %[xX] conversion */ +#define NIOV 8 + struct __suio uio; /* output information: summary */ + struct __siov iov[NIOV];/* ... and individual io vectors */ + char buf[BUF]; /* buffer with space for digits of uintmax_t */ + char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */ + union arg *argtable; /* args, built due to positional arg */ + union arg statargtable[STATIC_ARG_TBL_SIZE]; + size_t argtablesiz; + int nextarg; /* 1-based argument index */ + va_list orgap; /* original argument pointer */ +#ifdef PRINTF_WIDE_CHAR + char *convbuf; /* buffer for wide to multi-byte conversion */ +#endif + + /* + * Choose PADSIZE to trade efficiency vs. size. If larger printf + * fields occur frequently, increase PADSIZE and make the initialisers + * below longer. + */ +#define PADSIZE 16 /* pad chunk size */ + static char blanks[PADSIZE] = + {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; + static char zeroes[PADSIZE] = + {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; + + static const char xdigs_lower[16] = "0123456789abcdef"; + static const char xdigs_upper[16] = "0123456789ABCDEF"; + + /* + * BEWARE, these `goto error' on error, and PAD uses `n'. + */ +#define PRINT(ptr, len) do { \ + iovp->iov_base = (ptr); \ + iovp->iov_len = (len); \ + uio.uio_resid += (len); \ + iovp++; \ + if (++uio.uio_iovcnt >= NIOV) { \ + if (__sprint(fp, &uio)) \ + goto error; \ + iovp = iov; \ + } \ +} while (0) +#define PAD(howmany, with) do { \ + if ((n = (howmany)) > 0) { \ + while (n > PADSIZE) { \ + PRINT(with, PADSIZE); \ + n -= PADSIZE; \ + } \ + PRINT(with, n); \ + } \ +} while (0) +#define PRINTANDPAD(p, ep, len, with) do { \ + n2 = (ep) - (p); \ + if (n2 > (len)) \ + n2 = (len); \ + if (n2 > 0) \ + PRINT((p), n2); \ + PAD((len) - (n2 > 0 ? n2 : 0), (with)); \ +} while(0) +#define FLUSH() do { \ + if (uio.uio_resid && __sprint(fp, &uio)) \ + goto error; \ + uio.uio_iovcnt = 0; \ + iovp = iov; \ +} while (0) + + /* + * To extend shorts properly, we need both signed and unsigned + * argument extraction methods. + */ +#define SARG() \ + ((intmax_t)(flags&MAXINT ? GETARG(intmax_t) : \ + flags&LLONGINT ? GETARG(long long) : \ + flags&LONGINT ? GETARG(long) : \ + flags&PTRINT ? GETARG(ptrdiff_t) : \ + flags&SIZEINT ? GETARG(ssize_t) : \ + flags&SHORTINT ? (short)GETARG(int) : \ + flags&CHARINT ? (signed char)GETARG(int) : \ + GETARG(int))) +#define UARG() \ + ((uintmax_t)(flags&MAXINT ? GETARG(uintmax_t) : \ + flags&LLONGINT ? GETARG(unsigned long long) : \ + flags&LONGINT ? GETARG(unsigned long) : \ + flags&PTRINT ? (uintptr_t)GETARG(ptrdiff_t) : /* XXX */ \ + flags&SIZEINT ? GETARG(size_t) : \ + flags&SHORTINT ? (unsigned short)GETARG(int) : \ + flags&CHARINT ? (unsigned char)GETARG(int) : \ + GETARG(unsigned int))) + + /* + * Append a digit to a value and check for overflow. + */ +#define APPEND_DIGIT(val, dig) do { \ + if ((val) > INT_MAX / 10) \ + goto overflow; \ + (val) *= 10; \ + if ((val) > INT_MAX - to_digit((dig))) \ + goto overflow; \ + (val) += to_digit((dig)); \ +} while (0) + + /* + * Get * arguments, including the form *nn$. Preserve the nextarg + * that the argument can be gotten once the type is determined. + */ +#define GETASTER(val) \ + n2 = 0; \ + cp = fmt; \ + while (is_digit(*cp)) { \ + APPEND_DIGIT(n2, *cp); \ + cp++; \ + } \ + if (*cp == '$') { \ + int hold = nextarg; \ + if (argtable == NULL) { \ + argtable = statargtable; \ + __find_arguments(fmt0, orgap, &argtable, &argtablesiz); \ + } \ + nextarg = n2; \ + val = GETARG(int); \ + nextarg = hold; \ + fmt = ++cp; \ + } else { \ + val = GETARG(int); \ + } + +/* +* Get the argument indexed by nextarg. If the argument table is +* built, use it to get the argument. If its not, get the next +* argument (and arguments must be gotten sequentially). +*/ +#define GETARG(type) \ + ((argtable != NULL) ? *((type*)(&argtable[nextarg++])) : \ + (nextarg++, va_arg(ap, type))) + + _SET_ORIENTATION(fp, -1); + /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ + if (cantwrite(fp)) { + errno = EBADF; + return (EOF); + } + + /* optimise fprintf(stderr) (and other unbuffered Unix files) */ + if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && + fp->_file >= 0) { + //return (__sbprintf(fp, fmt0, ap)); + errno = EBADF; + return (EOF); + } + + fmt = (char *)fmt0; + argtable = NULL; + nextarg = 1; + va_copy(orgap, ap); + uio.uio_iov = iovp = iov; + uio.uio_resid = 0; + uio.uio_iovcnt = 0; + ret = 0; +#ifdef PRINTF_WIDE_CHAR + convbuf = NULL; +#endif + + memset(&ps, 0, sizeof(ps)); + /* + * Scan the format for conversions (`%' character). + */ + for (;;) { + cp = fmt; + while ((n = mbrtowc(&wc, fmt, MB_CUR_MAX, &ps)) > 0) { + fmt += n; + if (wc == '%') { + fmt--; + break; + } + } + if (fmt != cp) { + ptrdiff_t m = fmt - cp; + if (m < 0 || m > INT_MAX - ret) + goto overflow; + PRINT(cp, m); + ret += m; + } + if (n <= 0) + goto done; + fmt++; /* skip over '%' */ + + flags = 0; + dprec = 0; + width = 0; + prec = -1; + sign = '\0'; + ox[1] = '\0'; + +rflag: ch = *fmt++; +reswitch: switch (ch) { + case ' ': + /* + * ``If the space and + flags both appear, the space + * flag will be ignored.'' + * -- ANSI X3J11 + */ + if (!sign) + sign = ' '; + goto rflag; + case '#': + flags |= ALT; + goto rflag; + case '\'': + /* grouping not implemented */ + goto rflag; + case '*': + /* + * ``A negative field width argument is taken as a + * - flag followed by a positive field width.'' + * -- ANSI X3J11 + * They don't exclude field widths read from args. + */ + GETASTER(width); + if (width >= 0) + goto rflag; + if (width == INT_MIN) + goto overflow; + width = -width; + /* FALLTHROUGH */ + case '-': + flags |= LADJUST; + goto rflag; + case '+': + sign = '+'; + goto rflag; + case '.': + if ((ch = *fmt++) == '*') { + GETASTER(n); + prec = n < 0 ? -1 : n; + goto rflag; + } + n = 0; + while (is_digit(ch)) { + APPEND_DIGIT(n, ch); + ch = *fmt++; + } + if (ch == '$') { + nextarg = n; + if (argtable == NULL) { + argtable = statargtable; + __find_arguments(fmt0, orgap, + &argtable, &argtablesiz); + } + goto rflag; + } + prec = n; + goto reswitch; + case '0': + /* + * ``Note that 0 is taken as a flag, not as the + * beginning of a field width.'' + * -- ANSI X3J11 + */ + flags |= ZEROPAD; + goto rflag; + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + n = 0; + do { + APPEND_DIGIT(n, ch); + ch = *fmt++; + } while (is_digit(ch)); + if (ch == '$') { + nextarg = n; + if (argtable == NULL) { + argtable = statargtable; + __find_arguments(fmt0, orgap, + &argtable, &argtablesiz); + } + goto rflag; + } + width = n; + goto reswitch; +#ifdef FLOATING_POINT + case 'L': + flags |= LONGDBL; + goto rflag; +#endif + case 'h': + if (*fmt == 'h') { + fmt++; + flags |= CHARINT; + } else { + flags |= SHORTINT; + } + goto rflag; + case 'j': + flags |= MAXINT; + goto rflag; + case 'l': + if (*fmt == 'l') { + fmt++; + flags |= LLONGINT; + } else { + flags |= LONGINT; + } + goto rflag; + case 'q': + flags |= LLONGINT; + goto rflag; + case 't': + flags |= PTRINT; + goto rflag; + case 'z': + flags |= SIZEINT; + goto rflag; + case 'c': +#ifdef PRINTF_WIDE_CHAR + if (flags & LONGINT) { + mbstate_t mbs; + size_t mbseqlen; + + memset(&mbs, 0, sizeof(mbs)); + mbseqlen = wcrtomb(buf, + (wchar_t)GETARG(wint_t), &mbs); + if (mbseqlen == (size_t)-1) { + fp->_flags |= __SERR; + errno = EILSEQ; + goto error; + } + cp = buf; + size = (int)mbseqlen; + } else { +#endif + *(cp = buf) = GETARG(int); + size = 1; +#ifdef PRINTF_WIDE_CHAR + } +#endif + sign = '\0'; + break; + case 'D': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'd': + case 'i': + _umax = SARG(); + if ((intmax_t)_umax < 0) { + _umax = -_umax; + sign = '-'; + } + base = DEC; + goto number; +#ifdef FLOATING_POINT + case 'a': + case 'A': + if (ch == 'a') { + ox[1] = 'x'; + xdigs = xdigs_lower; + expchar = 'p'; + } else { + ox[1] = 'X'; + xdigs = xdigs_upper; + expchar = 'P'; + } + if (prec >= 0) + prec++; + if (dtoaresult) + __freedtoa(dtoaresult); + if (flags & LONGDBL) { + fparg.ldbl = GETARG(long double); + dtoaresult = cp = + __hldtoa(fparg.ldbl, xdigs, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + } else { + fparg.dbl = GETARG(double); + dtoaresult = cp = + __hdtoa(fparg.dbl, xdigs, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + } + if (prec < 0) + prec = dtoaend - cp; + if (expt == INT_MAX) + ox[1] = '\0'; + goto fp_common; + case 'e': + case 'E': + expchar = ch; + if (prec < 0) /* account for digit before decpt */ + prec = DEFPREC + 1; + else + prec++; + goto fp_begin; + case 'f': + case 'F': + expchar = '\0'; + goto fp_begin; + case 'g': + case 'G': + expchar = ch - ('g' - 'e'); + if (prec == 0) + prec = 1; +fp_begin: + if (prec < 0) + prec = DEFPREC; + if (dtoaresult) + __freedtoa(dtoaresult); + if (flags & LONGDBL) { + fparg.ldbl = GETARG(long double); + dtoaresult = cp = + __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + } else { + fparg.dbl = GETARG(double); + dtoaresult = cp = + __dtoa(fparg.dbl, expchar ? 2 : 3, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + if (expt == 9999) + expt = INT_MAX; + } +fp_common: + if (signflag) + sign = '-'; + if (expt == INT_MAX) { /* inf or nan */ + if (*cp == 'N') { + cp = (ch >= 'a') ? "nan" : "NAN"; + sign = '\0'; + } else + cp = (ch >= 'a') ? "inf" : "INF"; + size = 3; + flags &= ~ZEROPAD; + break; + } + flags |= FPT; + ndig = dtoaend - cp; + if (ch == 'g' || ch == 'G') { + if (expt > -4 && expt <= prec) { + /* Make %[gG] smell like %[fF] */ + expchar = '\0'; + if (flags & ALT) + prec -= expt; + else + prec = ndig - expt; + if (prec < 0) + prec = 0; + } else { + /* + * Make %[gG] smell like %[eE], but + * trim trailing zeroes if no # flag. + */ + if (!(flags & ALT)) + prec = ndig; + } + } + if (expchar) { + expsize = exponent(expstr, expt - 1, expchar); + size = expsize + prec; + if (prec > 1 || flags & ALT) + ++size; + } else { + /* space for digits before decimal point */ + if (expt > 0) + size = expt; + else /* "0" */ + size = 1; + /* space for decimal pt and following digits */ + if (prec || flags & ALT) + size += prec + 1; + lead = expt; + } + break; +#endif /* FLOATING_POINT */ + case 'n': + abort(); +#if 0 + if (flags & LLONGINT) + *GETARG(long long *) = ret; + else if (flags & LONGINT) + *GETARG(long *) = ret; + else if (flags & SHORTINT) + *GETARG(short *) = ret; + else if (flags & CHARINT) + *GETARG(signed char *) = ret; + else if (flags & PTRINT) + *GETARG(ptrdiff_t *) = ret; + else if (flags & SIZEINT) + *GETARG(ssize_t *) = ret; + else if (flags & MAXINT) + *GETARG(intmax_t *) = ret; + else + *GETARG(int *) = ret; + continue; /* no output */ +#endif + case 'O': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'o': + _umax = UARG(); + base = OCT; + goto nosign; + case 'p': + /* + * ``The argument shall be a pointer to void. The + * value of the pointer is converted to a sequence + * of printable characters, in an implementation- + * defined manner.'' + * -- ANSI X3J11 + */ + /* NOSTRICT */ + _umax = (size_t)GETARG(void *); + base = HEX; + xdigs = xdigs_lower; + ox[1] = 'x'; + goto nosign; + case 's': +#ifdef PRINTF_WIDE_CHAR + if (flags & LONGINT) { + wchar_t *wcp; + + if (convbuf != NULL) { + free(convbuf); + convbuf = NULL; + } + if ((wcp = GETARG(wchar_t *)) == NULL) { + cp = "(null)"; + } else { + convbuf = __wcsconv(wcp, prec); + if (convbuf == NULL) { + fp->_flags = __SERR; + goto error; + } + cp = convbuf; + } + } else +#endif /* PRINTF_WIDE_CHAR */ + if ((cp = GETARG(char *)) == NULL) + cp = "(null)"; + if (prec >= 0) { + /* + * can't use strlen; can only look for the + * NUL in the first `prec' characters, and + * strlen() will go further. + */ + char *p = (char *)memchr(cp, 0, prec); + + size = p ? (p - cp) : prec; + } else { + size_t len; + + if ((len = strlen(cp)) > INT_MAX) + goto overflow; + size = (int)len; + } + sign = '\0'; + break; + case 'U': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'u': + _umax = UARG(); + base = DEC; + goto nosign; + case 'X': + xdigs = xdigs_upper; + goto hex; + case 'x': + xdigs = xdigs_lower; +hex: _umax = UARG(); + base = HEX; + /* leading 0x/X only if non-zero */ + if (flags & ALT && _umax != 0) + ox[1] = ch; + + /* unsigned conversions */ +nosign: sign = '\0'; + /* + * ``... diouXx conversions ... if a precision is + * specified, the 0 flag will be ignored.'' + * -- ANSI X3J11 + */ +number: if ((dprec = prec) >= 0) + flags &= ~ZEROPAD; + + /* + * ``The result of converting a zero value with an + * explicit precision of zero is no characters.'' + * -- ANSI X3J11 + */ + cp = buf + BUF; + if (_umax != 0 || prec != 0) { + /* + * Unsigned mod is hard, and unsigned mod + * by a constant is easier than that by + * a variable; hence this switch. + */ + switch (base) { + case OCT: + do { + *--cp = to_char(_umax & 7); + _umax >>= 3; + } while (_umax); + /* handle octal leading 0 */ + if (flags & ALT && *cp != '0') + *--cp = '0'; + break; + + case DEC: + /* many numbers are 1 digit */ + while (_umax >= 10) { + *--cp = to_char(_umax % 10); + _umax /= 10; + } + *--cp = to_char(_umax); + break; + + case HEX: + do { + *--cp = xdigs[_umax & 15]; + _umax >>= 4; + } while (_umax); + break; + + default: + cp = "bug in vfprintf: bad base"; + size = strlen(cp); + goto skipsize; + } + } + size = buf + BUF - cp; + if (size > BUF) /* should never happen */ + abort(); + skipsize: + break; + default: /* "%?" prints ?, unless ? is NUL */ + if (ch == '\0') + goto done; + /* pretend it was %c with argument ch */ + cp = buf; + *cp = ch; + size = 1; + sign = '\0'; + break; + } + + /* + * All reasonable formats wind up here. At this point, `cp' + * points to a string which (if not flags&LADJUST) should be + * padded out to `width' places. If flags&ZEROPAD, it should + * first be prefixed by any sign or other prefix; otherwise, + * it should be blank padded before the prefix is emitted. + * After any left-hand padding and prefixing, emit zeroes + * required by a decimal %[diouxX] precision, then print the + * string proper, then emit zeroes required by any leftover + * floating precision; finally, if LADJUST, pad with blanks. + * + * Compute actual size, so we know how much to pad. + * size excludes decimal prec; realsz includes it. + */ + realsz = dprec > size ? dprec : size; + if (sign) + realsz++; + if (ox[1]) + realsz+= 2; + + /* right-adjusting blank padding */ + if ((flags & (LADJUST|ZEROPAD)) == 0) + PAD(width - realsz, blanks); + + /* prefix */ + if (sign) + PRINT(&sign, 1); + if (ox[1]) { /* ox[1] is either x, X, or \0 */ + ox[0] = '0'; + PRINT(ox, 2); + } + + /* right-adjusting zero padding */ + if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) + PAD(width - realsz, zeroes); + + /* leading zeroes from decimal precision */ + PAD(dprec - size, zeroes); + + /* the string or number proper */ +#ifdef FLOATING_POINT + if ((flags & FPT) == 0) { + PRINT(cp, size); + } else { /* glue together f_p fragments */ + if (!expchar) { /* %[fF] or sufficiently short %[gG] */ + if (expt <= 0) { + PRINT(zeroes, 1); + if (prec || flags & ALT) + PRINT(decimal_point, 1); + PAD(-expt, zeroes); + /* already handled initial 0's */ + prec += expt; + } else { + PRINTANDPAD(cp, dtoaend, lead, zeroes); + cp += lead; + if (prec || flags & ALT) + PRINT(decimal_point, 1); + } + PRINTANDPAD(cp, dtoaend, prec, zeroes); + } else { /* %[eE] or sufficiently long %[gG] */ + if (prec > 1 || flags & ALT) { + buf[0] = *cp++; + buf[1] = *decimal_point; + PRINT(buf, 2); + PRINT(cp, ndig-1); + PAD(prec - ndig, zeroes); + } else { /* XeYYY */ + PRINT(cp, 1); + } + PRINT(expstr, expsize); + } + } +#else + PRINT(cp, size); +#endif + /* left-adjusting padding (always blank) */ + if (flags & LADJUST) + PAD(width - realsz, blanks); + + /* finally, adjust ret */ + if (width < realsz) + width = realsz; + if (width > INT_MAX - ret) + goto overflow; + ret += width; + + FLUSH(); /* copy out the I/O vectors */ + } +done: + FLUSH(); +error: + va_end(orgap); + if (__sferror(fp)) + ret = -1; + goto finish; + +overflow: + errno = ENOMEM; + ret = -1; + +finish: +#ifdef PRINTF_WIDE_CHAR + if (convbuf) + free(convbuf); +#endif +#ifdef FLOATING_POINT + if (dtoaresult) + __freedtoa(dtoaresult); +#endif + if (argtable != NULL && argtable != statargtable) { + free(argtable); + argtable = NULL; + } + return (ret); +} + +/* + * Type ids for argument type table. + */ +#define T_UNUSED 0 +#define T_SHORT 1 +#define T_U_SHORT 2 +#define TP_SHORT 3 +#define T_INT 4 +#define T_U_INT 5 +#define TP_INT 6 +#define T_LONG 7 +#define T_U_LONG 8 +#define TP_LONG 9 +#define T_LLONG 10 +#define T_U_LLONG 11 +#define TP_LLONG 12 +#define T_DOUBLE 13 +#define T_LONG_DOUBLE 14 +#define TP_CHAR 15 +#define TP_VOID 16 +#define T_PTRINT 17 +#define TP_PTRINT 18 +#define T_SIZEINT 19 +#define T_SSIZEINT 20 +#define TP_SSIZEINT 21 +#define T_MAXINT 22 +#define T_MAXUINT 23 +#define TP_MAXINT 24 +#define T_CHAR 25 +#define T_U_CHAR 26 +#define T_WINT 27 +#define TP_WCHAR 28 + +/* + * Find all arguments when a positional parameter is encountered. Returns a + * table, indexed by argument number, of pointers to each arguments. The + * initial argument table should be an array of STATIC_ARG_TBL_SIZE entries. + * It will be replaced with a mmap-ed one if it overflows (malloc cannot be + * used since we are attempting to make snprintf thread safe, and alloca is + * problematic since we have nested functions..) + */ +static int +__find_arguments(const char *fmt0, va_list ap, union arg **argtable, + size_t *argtablesiz) +{ + char *fmt; /* format string */ + int ch; /* character from fmt */ + int n, n2; /* handy integer (short term usage) */ + char *cp; /* handy char pointer (short term usage) */ + int flags; /* flags as above */ + unsigned char *typetable; /* table of types */ + unsigned char stattypetable[STATIC_ARG_TBL_SIZE]; + int tablesize; /* current size of type table */ + int tablemax; /* largest used index in table */ + int nextarg; /* 1-based argument index */ + int ret = 0; /* return value */ + int rc = 0; /* save return code from __grow_type_table */ + wchar_t wc; + mbstate_t ps; + +#define check_rc(rc) if (rc == -1) goto overflow + + /* + * Add an argument type to the table, expanding if necessary. + */ +#define ADDTYPE(type) \ + ((nextarg >= tablesize) ? \ + rc = __grow_type_table(&typetable, &tablesize) : 0, \ + (nextarg > tablemax) ? tablemax = nextarg : 0, \ + rc == -1 ? 0 : (typetable[nextarg++] = type)) + +#define ADDTYPE_CHECK(type) \ + ADDTYPE(type); check_rc(rc) + +#define ADDSARG() \ + ((flags&MAXINT) ? ADDTYPE(T_MAXINT) : \ + ((flags&PTRINT) ? ADDTYPE(T_PTRINT) : \ + ((flags&SIZEINT) ? ADDTYPE(T_SSIZEINT) : \ + ((flags&LLONGINT) ? ADDTYPE(T_LLONG) : \ + ((flags&LONGINT) ? ADDTYPE(T_LONG) : \ + ((flags&SHORTINT) ? ADDTYPE(T_SHORT) : \ + ((flags&CHARINT) ? ADDTYPE(T_CHAR) : ADDTYPE(T_INT)))))))); \ + check_rc(rc); + +#define ADDUARG() \ + ((flags&MAXINT) ? ADDTYPE(T_MAXUINT) : \ + ((flags&PTRINT) ? ADDTYPE(T_PTRINT) : \ + ((flags&SIZEINT) ? ADDTYPE(T_SIZEINT) : \ + ((flags&LLONGINT) ? ADDTYPE(T_U_LLONG) : \ + ((flags&LONGINT) ? ADDTYPE(T_U_LONG) : \ + ((flags&SHORTINT) ? ADDTYPE(T_U_SHORT) : \ + ((flags&CHARINT) ? ADDTYPE(T_U_CHAR) : ADDTYPE(T_U_INT)))))))); \ + check_rc(rc); + + /* + * Add * arguments to the type array. + */ +#define ADDASTER() \ + n2 = 0; \ + cp = fmt; \ + while (is_digit(*cp)) { \ + APPEND_DIGIT(n2, *cp); \ + cp++; \ + } \ + if (*cp == '$') { \ + int hold = nextarg; \ + nextarg = n2; \ + ADDTYPE_CHECK(T_INT); \ + nextarg = hold; \ + fmt = ++cp; \ + } else { \ + ADDTYPE_CHECK(T_INT); \ + } + fmt = (char *)fmt0; + typetable = stattypetable; + tablesize = STATIC_ARG_TBL_SIZE; + tablemax = 0; + nextarg = 1; + memset(typetable, T_UNUSED, STATIC_ARG_TBL_SIZE); + memset(&ps, 0, sizeof(ps)); + + /* + * Scan the format for conversions (`%' character). + */ + for (;;) { + cp = fmt; + while ((n = mbrtowc(&wc, fmt, MB_CUR_MAX, &ps)) > 0) { + fmt += n; + if (wc == '%') { + fmt--; + break; + } + } + if (n <= 0) + goto done; + fmt++; /* skip over '%' */ + + flags = 0; + +rflag: ch = *fmt++; +reswitch: switch (ch) { + case ' ': + case '#': + case '\'': + goto rflag; + case '*': + ADDASTER(); + goto rflag; + case '-': + case '+': + goto rflag; + case '.': + if ((ch = *fmt++) == '*') { + ADDASTER(); + goto rflag; + } + while (is_digit(ch)) { + ch = *fmt++; + } + goto reswitch; + case '0': + goto rflag; + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + n = 0; + do { + APPEND_DIGIT(n ,ch); + ch = *fmt++; + } while (is_digit(ch)); + if (ch == '$') { + nextarg = n; + goto rflag; + } + goto reswitch; +#ifdef FLOATING_POINT + case 'L': + flags |= LONGDBL; + goto rflag; +#endif + case 'h': + if (*fmt == 'h') { + fmt++; + flags |= CHARINT; + } else { + flags |= SHORTINT; + } + goto rflag; + case 'j': + flags |= MAXINT; + goto rflag; + case 'l': + if (*fmt == 'l') { + fmt++; + flags |= LLONGINT; + } else { + flags |= LONGINT; + } + goto rflag; + case 'q': + flags |= LLONGINT; + goto rflag; + case 't': + flags |= PTRINT; + goto rflag; + case 'z': + flags |= SIZEINT; + goto rflag; + case 'c': +#ifdef PRINTF_WIDE_CHAR + if (flags & LONGINT) + ADDTYPE_CHECK(T_WINT); + else +#endif + ADDTYPE_CHECK(T_INT); + break; + case 'D': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'd': + case 'i': + ADDSARG(); + break; +#ifdef FLOATING_POINT + case 'a': + case 'A': + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + if (flags & LONGDBL) + ADDTYPE_CHECK(T_LONG_DOUBLE); + else + ADDTYPE_CHECK(T_DOUBLE); + break; +#endif /* FLOATING_POINT */ + case 'n': + if (flags & LLONGINT) + ADDTYPE_CHECK(TP_LLONG); + else if (flags & LONGINT) + ADDTYPE_CHECK(TP_LONG); + else if (flags & SHORTINT) + ADDTYPE_CHECK(TP_SHORT); + else if (flags & PTRINT) + ADDTYPE_CHECK(TP_PTRINT); + else if (flags & SIZEINT) + ADDTYPE_CHECK(TP_SSIZEINT); + else if (flags & MAXINT) + ADDTYPE_CHECK(TP_MAXINT); + else + ADDTYPE_CHECK(TP_INT); + continue; /* no output */ + case 'O': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'o': + ADDUARG(); + break; + case 'p': + ADDTYPE_CHECK(TP_VOID); + break; + case 's': +#ifdef PRINTF_WIDE_CHAR + if (flags & LONGINT) + ADDTYPE_CHECK(TP_WCHAR); + else +#endif + ADDTYPE_CHECK(TP_CHAR); + break; + case 'U': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'u': + case 'X': + case 'x': + ADDUARG(); + break; + default: /* "%?" prints ?, unless ? is NUL */ + if (ch == '\0') + goto done; + break; + } + } +done: + /* + * Build the argument table. + */ + if (tablemax >= STATIC_ARG_TBL_SIZE) { + *argtablesiz = sizeof(union arg) * (tablemax + 1); + *argtable = (union arg *)malloc(*argtablesiz); + if (*argtable == NULL) + goto overflow; //return (-1); + } + +#if 0 + /* XXX is this required? */ + (*argtable)[0].intarg = 0; +#endif + for (n = 1; n <= tablemax; n++) { + switch (typetable[n]) { + case T_UNUSED: + case T_CHAR: + case T_U_CHAR: + case T_SHORT: + case T_U_SHORT: + case T_INT: + (*argtable)[n].intarg = va_arg(ap, int); + break; + case TP_SHORT: + (*argtable)[n].pshortarg = va_arg(ap, short *); + break; + case T_U_INT: + (*argtable)[n].uintarg = va_arg(ap, unsigned int); + break; + case TP_INT: + (*argtable)[n].pintarg = va_arg(ap, int *); + break; + case T_LONG: + (*argtable)[n].longarg = va_arg(ap, long); + break; + case T_U_LONG: + (*argtable)[n].ulongarg = va_arg(ap, unsigned long); + break; + case TP_LONG: + (*argtable)[n].plongarg = va_arg(ap, long *); + break; + case T_LLONG: + (*argtable)[n].longlongarg = va_arg(ap, long long); + break; + case T_U_LLONG: + (*argtable)[n].ulonglongarg = va_arg(ap, unsigned long long); + break; + case TP_LLONG: + (*argtable)[n].plonglongarg = va_arg(ap, long long *); + break; +#ifdef FLOATING_POINT + case T_DOUBLE: + (*argtable)[n].doublearg = va_arg(ap, double); + break; + case T_LONG_DOUBLE: + (*argtable)[n].longdoublearg = va_arg(ap, long double); + break; +#endif + case TP_CHAR: + (*argtable)[n].pchararg = va_arg(ap, char *); + break; + case TP_VOID: + (*argtable)[n].pvoidarg = va_arg(ap, void *); + break; + case T_PTRINT: + (*argtable)[n].ptrdiffarg = va_arg(ap, ptrdiff_t); + break; + case TP_PTRINT: + (*argtable)[n].pptrdiffarg = va_arg(ap, ptrdiff_t *); + break; + case T_SIZEINT: + (*argtable)[n].sizearg = va_arg(ap, size_t); + break; + case T_SSIZEINT: + (*argtable)[n].ssizearg = va_arg(ap, ssize_t); + break; + case TP_SSIZEINT: + (*argtable)[n].pssizearg = va_arg(ap, ssize_t *); + break; + case T_MAXINT: + (*argtable)[n].intmaxarg = va_arg(ap, intmax_t); + break; + case T_MAXUINT: + (*argtable)[n].uintmaxarg = va_arg(ap, uintmax_t); + break; + case TP_MAXINT: + (*argtable)[n].pintmaxarg = va_arg(ap, intmax_t *); + break; +#ifdef PRINTF_WIDE_CHAR + case T_WINT: + (*argtable)[n].wintarg = va_arg(ap, wint_t); + break; + case TP_WCHAR: + (*argtable)[n].pwchararg = va_arg(ap, wchar_t *); + break; +#endif + } + } + goto finish; + +overflow: + errno = ENOMEM; + ret = -1; + +finish: + if (typetable != NULL && typetable != stattypetable) { + free(typetable); + typetable = NULL; + } + return (ret); +} + +/* + * Increase the size of the type table. + */ +static int +__grow_type_table(unsigned char **typetable, int *tablesize) +{ + unsigned char *oldtable = *typetable; + int newsize = *tablesize * 2; + + if (newsize < SE_PAGE_SIZE) + newsize = SE_PAGE_SIZE; + + if (*tablesize == STATIC_ARG_TBL_SIZE) { + *typetable = (unsigned char *)malloc(newsize); + if (*typetable == NULL) + return (-1); + memmove(*typetable, oldtable, *tablesize); + } else { + unsigned char *new1 = (unsigned char *)malloc(newsize); + if (new1 == NULL) + return (-1); + memmove(new1, *typetable, *tablesize); + free(*typetable); + *typetable = new1; + } + memset(*typetable + *tablesize, T_UNUSED, (newsize - *tablesize)); + + *tablesize = newsize; + return (0); +} + + +#ifdef FLOATING_POINT +static int +exponent(char *p0, int exp, int fmtch) +{ + char *p, *t; + char expbuf[MAXEXPDIG]; + + p = p0; + *p++ = fmtch; + if (exp < 0) { + exp = -exp; + *p++ = '-'; + } else + *p++ = '+'; + t = expbuf + MAXEXPDIG; + if (exp > 9) { + do { + *--t = to_char(exp % 10); + } while ((exp /= 10) > 9); + *--t = to_char(exp); + for (; t < expbuf + MAXEXPDIG; *p++ = *t++) + /* nothing */; + } else { + /* + * Exponents for decimal floating point conversions + * (%[eEgG]) must be at least two characters long, + * whereas exponents for hexadecimal conversions can + * be only one character long. + */ + if (fmtch == 'e' || fmtch == 'E') + *p++ = '0'; + *p++ = to_char(exp); + } + return (p - p0); +} +#endif /* FLOATING_POINT */ diff --git a/sdk/tlibc/stdio/vfwprintf.c b/sdk/tlibc/stdio/vfwprintf.c new file mode 100644 index 0000000000..4526680ed1 --- /dev/null +++ b/sdk/tlibc/stdio/vfwprintf.c @@ -0,0 +1,1487 @@ +/* $OpenBSD: vfwprintf.c,v 1.8 2013/11/12 07:04:35 deraadt Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Actual wprintf innards. + * + * This code is large and complicated... + */ + +#include +//#include + +#include +//#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "local.h" +#include "fvwrite.h" + +union arg { + int intarg; + unsigned int uintarg; + long longarg; + unsigned long ulongarg; + long long longlongarg; + unsigned long long ulonglongarg; + ptrdiff_t ptrdiffarg; + size_t sizearg; + ssize_t ssizearg; + intmax_t intmaxarg; + uintmax_t uintmaxarg; + void *pvoidarg; + char *pchararg; + signed char *pschararg; + short *pshortarg; + int *pintarg; + long *plongarg; + long long *plonglongarg; + ptrdiff_t *pptrdiffarg; + ssize_t *pssizearg; + intmax_t *pintmaxarg; +#ifdef FLOATING_POINT + double doublearg; + long double longdoublearg; +#endif + wint_t wintarg; + wchar_t *pwchararg; +}; + +static int __find_arguments(const wchar_t *fmt0, va_list ap, union arg **argtable, + size_t *argtablesiz); +static int __grow_type_table(unsigned char **typetable, int *tablesize); + +/* + * Like __fputwc_unlock, but handles fake string (__SSTR) files properly. + * File must already be locked. + */ +static wint_t +__xfputwc(wchar_t wc, FILE *fp) +{ + mbstate_t mbs; + char buf[MB_LEN_MAX]; + struct __suio uio; + struct __siov iov; + size_t len; + + //if ((fp->_flags & __SSTR) == 0) + // return (__fputwc_unlock(wc, fp)); + + memset(&mbs, 0x0, sizeof(mbs)); + len = wcrtomb(buf, wc, &mbs); + if (len == (size_t)-1) { + fp->_flags |= __SERR; + errno = EILSEQ; + return (WEOF); + } + uio.uio_iov = &iov; + uio.uio_resid = len; + uio.uio_iovcnt = 1; + iov.iov_base = buf; + iov.iov_len = len; + return (__sfvwrite(fp, &uio) != EOF ? (wint_t)wc : WEOF); +} + +/* + * Convert a multibyte character string argument for the %s format to a wide + * string representation. ``prec'' specifies the maximum number of bytes + * to output. If ``prec'' is greater than or equal to zero, we can't assume + * that the multibyte character string ends in a null character. + * + * Returns NULL on failure. + * To find out what happened check errno for ENOMEM, EILSEQ and EINVAL. + */ +static wchar_t * +__mbsconv(char *mbsarg, int prec) +{ + mbstate_t mbs; + wchar_t *convbuf, *wcp; + const char *p; + size_t insize, nchars, nconv; + + if (mbsarg == NULL) + return (NULL); + + /* + * Supplied argument is a multibyte string; convert it to wide + * characters first. + */ + if (prec >= 0) { + /* + * String is not guaranteed to be NUL-terminated. Find the + * number of characters to print. + */ + p = mbsarg; + insize = nchars = nconv = 0; + memset(&mbs, 0x0, sizeof(mbs)); + while (nchars != (size_t)prec) { + nconv = mbrlen(p, MB_CUR_MAX, &mbs); + if (nconv == (size_t)0 || nconv == (size_t)-1 || + nconv == (size_t)-2) + break; + p += nconv; + nchars++; + insize += nconv; + } + if (nconv == (size_t)-1 || nconv == (size_t)-2) + return (NULL); + } else + insize = strlen(mbsarg); + + /* + * Allocate buffer for the result and perform the conversion, + * converting at most `size' bytes of the input multibyte string to + * wide characters for printing. + */ + convbuf = calloc(insize + 1, sizeof(*convbuf)); + if (convbuf == NULL) + return (NULL); + wcp = convbuf; + p = mbsarg; + memset(&mbs, 0x0, sizeof(mbs)); + nconv = 0; + while (insize != 0) { + nconv = mbrtowc(wcp, p, insize, &mbs); + if (nconv == 0 || nconv == (size_t)-1 || nconv == (size_t)-2) + break; + wcp++; + p += nconv; + insize -= nconv; + } + if (nconv == (size_t)-1 || nconv == (size_t)-2) { + free(convbuf); + return (NULL); + } + *wcp = '\0'; + + return (convbuf); +} + +#ifdef FLOATING_POINT +#include +//#include +#include +#include "floatio.h" +#include "gdtoa.h" + +#define DEFPREC 6 + +static int exponent(wchar_t *, int, int); +#endif /* FLOATING_POINT */ + +/* + * The size of the buffer we use as scratch space for integer + * conversions, among other things. Technically, we would need the + * most space for base 10 conversions with thousands' grouping + * characters between each pair of digits. 100 bytes is a + * conservative overestimate even for a 128-bit uintmax_t. + */ +#define BUF 100 + +#define STATIC_ARG_TBL_SIZE 8 /* Size of static argument table. */ + + +/* + * Macros for converting digits to letters and vice versa + */ +#define to_digit(c) ((c) - '0') +#define is_digit(c) ((unsigned)to_digit(c) <= 9) +#define to_char(n) ((wchar_t)((n) + '0')) + +/* + * Flags used during conversion. + */ +#define ALT 0x0001 /* alternate form */ +#define LADJUST 0x0004 /* left adjustment */ +#define LONGDBL 0x0008 /* long double */ +#define LONGINT 0x0010 /* long integer */ +#define LLONGINT 0x0020 /* long long integer */ +#define SHORTINT 0x0040 /* short integer */ +#define ZEROPAD 0x0080 /* zero (as opposed to blank) pad */ +#define FPT 0x0100 /* Floating point number */ +#define PTRINT 0x0200 /* (unsigned) ptrdiff_t */ +#define SIZEINT 0x0400 /* (signed) size_t */ +#define CHARINT 0x0800 /* 8 bit integer */ +#define MAXINT 0x1000 /* largest integer size (intmax_t) */ + +int +__vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap) +{ + wchar_t *fmt; /* format string */ + wchar_t ch; /* character from fmt */ + int n, n2, n3; /* handy integers (short term usage) */ + wchar_t *cp; /* handy char pointer (short term usage) */ + int flags; /* flags as above */ + int ret; /* return value accumulator */ + int width; /* width from format (%8d), or 0 */ + int prec; /* precision from format; <0 for N/A */ + wchar_t sign; /* sign prefix (' ', '+', '-', or \0) */ +#ifdef FLOATING_POINT + /* + * We can decompose the printed representation of floating + * point numbers into several parts, some of which may be empty: + * + * [+|-| ] [0x|0X] MMM . NNN [e|E|p|P] [+|-] ZZ + * A B ---C--- D E F + * + * A: 'sign' holds this value if present; '\0' otherwise + * B: ox[1] holds the 'x' or 'X'; '\0' if not hexadecimal + * C: cp points to the string MMMNNN. Leading and trailing + * zeros are not in the string and must be added. + * D: expchar holds this character; '\0' if no exponent, e.g. %f + * F: at least two digits for decimal, at least one digit for hex + */ + char *decimal_point = "."; + int signflag; /* true if float is negative */ + union { /* floating point arguments %[aAeEfFgG] */ + double dbl; + long double ldbl; + } fparg; + int expt; /* integer value of exponent */ + char expchar; /* exponent character: [eEpP\0] */ + char *dtoaend; /* pointer to end of converted digits */ + int expsize; /* character count for expstr */ + int lead; /* sig figs before decimal or group sep */ + int ndig; /* actual number of digits returned by dtoa */ + wchar_t expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */ + char *dtoaresult = NULL; +#endif + + uintmax_t _umax; /* integer arguments %[diouxX] */ + enum { OCT, DEC, HEX } base; /* base for %[diouxX] conversion */ + int dprec; /* a copy of prec if %[diouxX], 0 otherwise */ + int realsz; /* field size expanded by dprec */ + int size; /* size of converted field or string */ + const char *xdigs; /* digits for %[xX] conversion */ +#define NIOV 8 + struct __suio uio; /* output information: summary */ + struct __siov iov[NIOV];/* ... and individual io vectors */ + wchar_t buf[BUF]; /* buffer with space for digits of uintmax_t */ + wchar_t ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */ + union arg *argtable; /* args, built due to positional arg */ + union arg statargtable[STATIC_ARG_TBL_SIZE]; + size_t argtablesiz; + int nextarg; /* 1-based argument index */ + va_list orgap; /* original argument pointer */ + wchar_t *convbuf; /* buffer for multibyte to wide conversion */ + + /* + * Choose PADSIZE to trade efficiency vs. size. If larger printf + * fields occur frequently, increase PADSIZE and make the initialisers + * below longer. + */ +#define PADSIZE 16 /* pad chunk size */ + static wchar_t blanks[PADSIZE] = + {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; + static wchar_t zeroes[PADSIZE] = + {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; + + static const char xdigs_lower[16] = "0123456789abcdef"; + static const char xdigs_upper[16] = "0123456789ABCDEF"; + + /* + * BEWARE, these `goto error' on error, PRINT uses 'n3', + * PAD uses `n' and 'n3', and PRINTANDPAD uses 'n', 'n2', and 'n3'. + */ +#define PRINT(ptr, len) do { \ + for (n3 = 0; n3 < (len); n3++) { \ + if ((__xfputwc((ptr)[n3], fp)) == WEOF) \ + goto error; \ + } \ +} while (0) +#define PAD(howmany, with) do { \ + if ((n = (howmany)) > 0) { \ + while (n > PADSIZE) { \ + PRINT(with, PADSIZE); \ + n -= PADSIZE; \ + } \ + PRINT(with, n); \ + } \ +} while (0) +#define PRINTANDPAD(p, ep, len, with) do { \ + n2 = (ep) - (p); \ + if (n2 > (len)) \ + n2 = (len); \ + if (n2 > 0) \ + PRINT((p), n2); \ + PAD((len) - (n2 > 0 ? n2 : 0), (with)); \ +} while(0) + + /* + * To extend shorts properly, we need both signed and unsigned + * argument extraction methods. + */ +#define SARG() \ + ((intmax_t)(flags&MAXINT ? GETARG(intmax_t) : \ + flags&LLONGINT ? GETARG(long long) : \ + flags&LONGINT ? GETARG(long) : \ + flags&PTRINT ? GETARG(ptrdiff_t) : \ + flags&SIZEINT ? GETARG(ssize_t) : \ + flags&SHORTINT ? (short)GETARG(int) : \ + flags&CHARINT ? (signed char)GETARG(int) : \ + GETARG(int))) +#define UARG() \ + ((uintmax_t)(flags&MAXINT ? GETARG(uintmax_t) : \ + flags&LLONGINT ? GETARG(unsigned long long) : \ + flags&LONGINT ? GETARG(unsigned long) : \ + flags&PTRINT ? (uintptr_t)GETARG(ptrdiff_t) : /* XXX */ \ + flags&SIZEINT ? GETARG(size_t) : \ + flags&SHORTINT ? (unsigned short)GETARG(int) : \ + flags&CHARINT ? (unsigned char)GETARG(int) : \ + GETARG(unsigned int))) + + /* + * Append a digit to a value and check for overflow. + */ +#define APPEND_DIGIT(val, dig) do { \ + if ((val) > INT_MAX / 10) \ + goto overflow; \ + (val) *= 10; \ + if ((val) > INT_MAX - to_digit((dig))) \ + goto overflow; \ + (val) += to_digit((dig)); \ +} while (0) + + /* + * Get * arguments, including the form *nn$. Preserve the nextarg + * that the argument can be gotten once the type is determined. + */ +#define GETASTER(val) \ + n2 = 0; \ + cp = fmt; \ + while (is_digit(*cp)) { \ + APPEND_DIGIT(n2, *cp); \ + cp++; \ + } \ + if (*cp == '$') { \ + int hold = nextarg; \ + if (argtable == NULL) { \ + argtable = statargtable; \ + __find_arguments(fmt0, orgap, &argtable, &argtablesiz); \ + } \ + nextarg = n2; \ + val = GETARG(int); \ + nextarg = hold; \ + fmt = ++cp; \ + } else { \ + val = GETARG(int); \ + } + +/* +* Get the argument indexed by nextarg. If the argument table is +* built, use it to get the argument. If its not, get the next +* argument (and arguments must be gotten sequentially). +*/ +#define GETARG(type) \ + ((argtable != NULL) ? *((type*)(&argtable[nextarg++])) : \ + (nextarg++, va_arg(ap, type))) + + _SET_ORIENTATION(fp, 1); + /* sorry, fwprintf(read_only_file, "") returns EOF, not 0 */ + if (cantwrite(fp)) { + errno = EBADF; + return (EOF); + } + + /* optimise fwprintf(stderr) (and other unbuffered Unix files) */ + if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && + fp->_file >= 0) { + //return (__sbprintf(fp, fmt0, ap)); + errno = EBADF; + return (EOF); + } + + fmt = (wchar_t *)fmt0; + argtable = NULL; + nextarg = 1; + va_copy(orgap, ap); + uio.uio_iov = iov; + uio.uio_resid = 0; + uio.uio_iovcnt = 0; + ret = 0; + convbuf = NULL; + + /* + * Scan the format for conversions (`%' character). + */ + for (;;) { + for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++) + continue; + if (fmt != cp) { + ptrdiff_t m = fmt - cp; + if (m < 0 || m > INT_MAX - ret) + goto overflow; + PRINT(cp, m); + ret += m; + } + if (ch == '\0') + goto done; + fmt++; /* skip over '%' */ + + flags = 0; + dprec = 0; + width = 0; + prec = -1; + sign = '\0'; + ox[1] = '\0'; + +rflag: ch = *fmt++; +reswitch: switch (ch) { + case ' ': + /* + * ``If the space and + flags both appear, the space + * flag will be ignored.'' + * -- ANSI X3J11 + */ + if (!sign) + sign = ' '; + goto rflag; + case '#': + flags |= ALT; + goto rflag; + case '\'': + /* grouping not implemented */ + goto rflag; + case '*': + /* + * ``A negative field width argument is taken as a + * - flag followed by a positive field width.'' + * -- ANSI X3J11 + * They don't exclude field widths read from args. + */ + GETASTER(width); + if (width >= 0) + goto rflag; + if (width == INT_MIN) + goto overflow; + width = -width; + /* FALLTHROUGH */ + case '-': + flags |= LADJUST; + goto rflag; + case '+': + sign = '+'; + goto rflag; + case '.': + if ((ch = *fmt++) == '*') { + GETASTER(n); + prec = n < 0 ? -1 : n; + goto rflag; + } + n = 0; + while (is_digit(ch)) { + APPEND_DIGIT(n, ch); + ch = *fmt++; + } + if (ch == '$') { + nextarg = n; + if (argtable == NULL) { + argtable = statargtable; + __find_arguments(fmt0, orgap, + &argtable, &argtablesiz); + } + goto rflag; + } + prec = n; + goto reswitch; + case '0': + /* + * ``Note that 0 is taken as a flag, not as the + * beginning of a field width.'' + * -- ANSI X3J11 + */ + flags |= ZEROPAD; + goto rflag; + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + n = 0; + do { + APPEND_DIGIT(n, ch); + ch = *fmt++; + } while (is_digit(ch)); + if (ch == '$') { + nextarg = n; + if (argtable == NULL) { + argtable = statargtable; + __find_arguments(fmt0, orgap, + &argtable, &argtablesiz); + } + goto rflag; + } + width = n; + goto reswitch; +#ifdef FLOATING_POINT + case 'L': + flags |= LONGDBL; + goto rflag; +#endif + case 'h': + if (*fmt == 'h') { + fmt++; + flags |= CHARINT; + } else { + flags |= SHORTINT; + } + goto rflag; + case 'j': + flags |= MAXINT; + goto rflag; + case 'l': + if (*fmt == 'l') { + fmt++; + flags |= LLONGINT; + } else { + flags |= LONGINT; + } + goto rflag; + case 'q': + flags |= LLONGINT; + goto rflag; + case 't': + flags |= PTRINT; + goto rflag; + case 'z': + flags |= SIZEINT; + goto rflag; + case 'C': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'c': + if (flags & LONGINT) + *(cp = buf) = (wchar_t)GETARG(wint_t); + else + *(cp = buf) = (wchar_t)btowc(GETARG(int)); + size = 1; + sign = '\0'; + break; + case 'D': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'd': + case 'i': + _umax = SARG(); + if ((intmax_t)_umax < 0) { + _umax = -_umax; + sign = '-'; + } + base = DEC; + goto number; +#ifdef FLOATING_POINT + case 'a': + case 'A': + if (ch == 'a') { + ox[1] = 'x'; + xdigs = xdigs_lower; + expchar = 'p'; + } else { + ox[1] = 'X'; + xdigs = xdigs_upper; + expchar = 'P'; + } + if (prec >= 0) + prec++; + if (dtoaresult) + __freedtoa(dtoaresult); + if (flags & LONGDBL) { + fparg.ldbl = GETARG(long double); + dtoaresult = + __hldtoa(fparg.ldbl, xdigs, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + } else { + fparg.dbl = GETARG(double); + dtoaresult = + __hdtoa(fparg.dbl, xdigs, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + } + if (prec < 0) + prec = dtoaend - dtoaresult; + if (expt == INT_MAX) + ox[1] = '\0'; + if (convbuf) { + free(convbuf); + convbuf = NULL; + } + cp = convbuf = __mbsconv(dtoaresult, -1); + if (cp == NULL) + goto error; + ndig = dtoaend - dtoaresult; + goto fp_common; + case 'e': + case 'E': + expchar = ch; + if (prec < 0) /* account for digit before decpt */ + prec = DEFPREC + 1; + else + prec++; + goto fp_begin; + case 'f': + case 'F': + expchar = '\0'; + goto fp_begin; + case 'g': + case 'G': + expchar = ch - ('g' - 'e'); + if (prec == 0) + prec = 1; +fp_begin: + if (prec < 0) + prec = DEFPREC; + if (dtoaresult) + __freedtoa(dtoaresult); + if (flags & LONGDBL) { + fparg.ldbl = GETARG(long double); + dtoaresult = + __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + } else { + fparg.dbl = GETARG(double); + dtoaresult = + __dtoa(fparg.dbl, expchar ? 2 : 3, prec, + &expt, &signflag, &dtoaend); + if (dtoaresult == NULL) { + errno = ENOMEM; + goto error; + } + if (expt == 9999) + expt = INT_MAX; + } + if (convbuf) { + free(convbuf); + convbuf = NULL; + } + cp = convbuf = __mbsconv(dtoaresult, -1); + if (cp == NULL) + goto error; + ndig = dtoaend - dtoaresult; +fp_common: + if (signflag) + sign = '-'; + if (expt == INT_MAX) { /* inf or nan */ + if (*cp == 'N') { + cp = (ch >= 'a') ? L"nan" : L"NAN"; + sign = '\0'; + } else + cp = (ch >= 'a') ? L"inf" : L"INF"; + size = 3; + flags &= ~ZEROPAD; + break; + } + flags |= FPT; + if (ch == 'g' || ch == 'G') { + if (expt > -4 && expt <= prec) { + /* Make %[gG] smell like %[fF] */ + expchar = '\0'; + if (flags & ALT) + prec -= expt; + else + prec = ndig - expt; + if (prec < 0) + prec = 0; + } else { + /* + * Make %[gG] smell like %[eE], but + * trim trailing zeroes if no # flag. + */ + if (!(flags & ALT)) + prec = ndig; + } + } + if (expchar) { + expsize = exponent(expstr, expt - 1, expchar); + size = expsize + prec; + if (prec > 1 || flags & ALT) + ++size; + } else { + /* space for digits before decimal point */ + if (expt > 0) + size = expt; + else /* "0" */ + size = 1; + /* space for decimal pt and following digits */ + if (prec || flags & ALT) + size += prec + 1; + lead = expt; + } + break; +#endif /* FLOATING_POINT */ + case 'n': + abort(); +#if 0 + if (flags & LLONGINT) + *GETARG(long long *) = ret; + else if (flags & LONGINT) + *GETARG(long *) = ret; + else if (flags & SHORTINT) + *GETARG(short *) = ret; + else if (flags & CHARINT) + *GETARG(signed char *) = ret; + else if (flags & PTRINT) + *GETARG(ptrdiff_t *) = ret; + else if (flags & SIZEINT) + *GETARG(ssize_t *) = ret; + else if (flags & MAXINT) + *GETARG(intmax_t *) = ret; + else + *GETARG(int *) = ret; + continue; /* no output */ +#endif + case 'O': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'o': + _umax = UARG(); + base = OCT; + goto nosign; + case 'p': + /* + * ``The argument shall be a pointer to void. The + * value of the pointer is converted to a sequence + * of printable characters, in an implementation- + * defined manner.'' + * -- ANSI X3J11 + */ + /* NOSTRICT */ + _umax = (size_t)GETARG(void *); + base = HEX; + xdigs = xdigs_lower; + ox[1] = 'x'; + goto nosign; + case 'S': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 's': + if (flags & LONGINT) { + if ((cp = GETARG(wchar_t *)) == NULL) + cp = L"(null)"; + } else { + char *mbsarg; + if ((mbsarg = GETARG(char *)) == NULL) + mbsarg = "(null)"; + if (convbuf) { + free(convbuf); + convbuf = NULL; + } + convbuf = __mbsconv(mbsarg, prec); + if (convbuf == NULL) { + fp->_flags |= __SERR; + goto error; + } else + cp = convbuf; + } + if (prec >= 0) { + /* + * can't use wcslen; can only look for the + * NUL in the first `prec' characters, and + * wcslen() will go further. + */ + wchar_t *p = wmemchr(cp, 0, prec); + + size = p ? (p - cp) : prec; + } else { + size_t len; + + if ((len = wcslen(cp)) > INT_MAX) + goto overflow; + size = (int)len; + } + sign = '\0'; + break; + case 'U': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'u': + _umax = UARG(); + base = DEC; + goto nosign; + case 'X': + xdigs = xdigs_upper; + goto hex; + case 'x': + xdigs = xdigs_lower; +hex: _umax = UARG(); + base = HEX; + /* leading 0x/X only if non-zero */ + if (flags & ALT && _umax != 0) + ox[1] = ch; + + /* unsigned conversions */ +nosign: sign = '\0'; + /* + * ``... diouXx conversions ... if a precision is + * specified, the 0 flag will be ignored.'' + * -- ANSI X3J11 + */ +number: if ((dprec = prec) >= 0) + flags &= ~ZEROPAD; + + /* + * ``The result of converting a zero value with an + * explicit precision of zero is no characters.'' + * -- ANSI X3J11 + */ + cp = buf + BUF; + if (_umax != 0 || prec != 0) { + /* + * Unsigned mod is hard, and unsigned mod + * by a constant is easier than that by + * a variable; hence this switch. + */ + switch (base) { + case OCT: + do { + *--cp = to_char(_umax & 7); + _umax >>= 3; + } while (_umax); + /* handle octal leading 0 */ + if (flags & ALT && *cp != '0') + *--cp = '0'; + break; + + case DEC: + /* many numbers are 1 digit */ + while (_umax >= 10) { + *--cp = to_char(_umax % 10); + _umax /= 10; + } + *--cp = to_char(_umax); + break; + + case HEX: + do { + *--cp = xdigs[_umax & 15]; + _umax >>= 4; + } while (_umax); + break; + + default: + cp = L"bug in vfwprintf: bad base"; + size = wcslen(cp); + goto skipsize; + } + } + size = buf + BUF - cp; + if (size > BUF) /* should never happen */ + abort(); + skipsize: + break; + default: /* "%?" prints ?, unless ? is NUL */ + if (ch == '\0') + goto done; + /* pretend it was %c with argument ch */ + cp = buf; + *cp = ch; + size = 1; + sign = '\0'; + break; + } + + /* + * All reasonable formats wind up here. At this point, `cp' + * points to a string which (if not flags&LADJUST) should be + * padded out to `width' places. If flags&ZEROPAD, it should + * first be prefixed by any sign or other prefix; otherwise, + * it should be blank padded before the prefix is emitted. + * After any left-hand padding and prefixing, emit zeroes + * required by a decimal %[diouxX] precision, then print the + * string proper, then emit zeroes required by any leftover + * floating precision; finally, if LADJUST, pad with blanks. + * + * Compute actual size, so we know how much to pad. + * size excludes decimal prec; realsz includes it. + */ + realsz = dprec > size ? dprec : size; + if (sign) + realsz++; + if (ox[1]) + realsz+= 2; + + /* right-adjusting blank padding */ + if ((flags & (LADJUST|ZEROPAD)) == 0) + PAD(width - realsz, blanks); + + /* prefix */ + if (sign) + PRINT(&sign, 1); + if (ox[1]) { /* ox[1] is either x, X, or \0 */ + ox[0] = '0'; + PRINT(ox, 2); + } + + /* right-adjusting zero padding */ + if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) + PAD(width - realsz, zeroes); + + /* leading zeroes from decimal precision */ + PAD(dprec - size, zeroes); + + /* the string or number proper */ +#ifdef FLOATING_POINT + if ((flags & FPT) == 0) { + PRINT(cp, size); + } else { /* glue together f_p fragments */ + if (!expchar) { /* %[fF] or sufficiently short %[gG] */ + if (expt <= 0) { + PRINT(zeroes, 1); + if (prec || flags & ALT) + PRINT(decimal_point, 1); + PAD(-expt, zeroes); + /* already handled initial 0's */ + prec += expt; + } else { + PRINTANDPAD(cp, convbuf + ndig, + lead, zeroes); + cp += lead; + if (prec || flags & ALT) + PRINT(decimal_point, 1); + } + PRINTANDPAD(cp, convbuf + ndig, prec, zeroes); + } else { /* %[eE] or sufficiently long %[gG] */ + if (prec > 1 || flags & ALT) { + buf[0] = *cp++; + buf[1] = *decimal_point; + PRINT(buf, 2); + PRINT(cp, ndig-1); + PAD(prec - ndig, zeroes); + } else { /* XeYYY */ + PRINT(cp, 1); + } + PRINT(expstr, expsize); + } + } +#else + PRINT(cp, size); +#endif + /* left-adjusting padding (always blank) */ + if (flags & LADJUST) + PAD(width - realsz, blanks); + + /* finally, adjust ret */ + if (width < realsz) + width = realsz; + if (width > INT_MAX - ret) + goto overflow; + ret += width; + } +done: +error: + va_end(orgap); + if (__sferror(fp)) + ret = -1; + goto finish; + +overflow: + errno = ENOMEM; + ret = -1; + +finish: + if (convbuf) + free(convbuf); +#ifdef FLOATING_POINT + if (dtoaresult) + __freedtoa(dtoaresult); +#endif + if (argtable != NULL && argtable != statargtable) { + free(argtable); + argtable = NULL; + } + return (ret); +} + +/* + * Type ids for argument type table. + */ +#define T_UNUSED 0 +#define T_SHORT 1 +#define T_U_SHORT 2 +#define TP_SHORT 3 +#define T_INT 4 +#define T_U_INT 5 +#define TP_INT 6 +#define T_LONG 7 +#define T_U_LONG 8 +#define TP_LONG 9 +#define T_LLONG 10 +#define T_U_LLONG 11 +#define TP_LLONG 12 +#define T_DOUBLE 13 +#define T_LONG_DOUBLE 14 +#define TP_CHAR 15 +#define TP_VOID 16 +#define T_PTRINT 17 +#define TP_PTRINT 18 +#define T_SIZEINT 19 +#define T_SSIZEINT 20 +#define TP_SSIZEINT 21 +#define T_MAXINT 22 +#define T_MAXUINT 23 +#define TP_MAXINT 24 +#define T_CHAR 25 +#define T_U_CHAR 26 +#define T_WINT 27 +#define TP_WCHAR 28 + +/* + * Find all arguments when a positional parameter is encountered. Returns a + * table, indexed by argument number, of pointers to each arguments. The + * initial argument table should be an array of STATIC_ARG_TBL_SIZE entries. + * It will be replaced with a mmap-ed one if it overflows (malloc cannot be + * used since we are attempting to make snprintf thread safe, and alloca is + * problematic since we have nested functions..) + */ +static int +__find_arguments(const wchar_t *fmt0, va_list ap, union arg **argtable, + size_t *argtablesiz) +{ + wchar_t *fmt; /* format string */ + int ch; /* character from fmt */ + int n, n2; /* handy integer (short term usage) */ + wchar_t *cp; /* handy char pointer (short term usage) */ + int flags; /* flags as above */ + unsigned char *typetable; /* table of types */ + unsigned char stattypetable[STATIC_ARG_TBL_SIZE]; + int tablesize; /* current size of type table */ + int tablemax; /* largest used index in table */ + int nextarg; /* 1-based argument index */ + int ret = 0; /* return value */ + int rc = 0; /* save return code from __grow_type_table */ + +#define check_rc(rc) if (rc == -1) goto overflow + + /* + * Add an argument type to the table, expanding if necessary. + */ +#define ADDTYPE(type) \ + ((nextarg >= tablesize) ? \ + rc = __grow_type_table(&typetable, &tablesize) : 0, \ + (nextarg > tablemax) ? tablemax = nextarg : 0, \ + rc == -1 ? 0 : (typetable[nextarg++] = type)) + +#define ADDTYPE_CHECK(type) \ + ADDTYPE(type); check_rc(rc) + +#define ADDSARG() \ + ((flags&MAXINT) ? ADDTYPE(T_MAXINT) : \ + ((flags&PTRINT) ? ADDTYPE(T_PTRINT) : \ + ((flags&SIZEINT) ? ADDTYPE(T_SSIZEINT) : \ + ((flags&LLONGINT) ? ADDTYPE(T_LLONG) : \ + ((flags&LONGINT) ? ADDTYPE(T_LONG) : \ + ((flags&SHORTINT) ? ADDTYPE(T_SHORT) : \ + ((flags&CHARINT) ? ADDTYPE(T_CHAR) : ADDTYPE(T_INT)))))))); \ + check_rc(rc); + +#define ADDUARG() \ + ((flags&MAXINT) ? ADDTYPE(T_MAXUINT) : \ + ((flags&PTRINT) ? ADDTYPE(T_PTRINT) : \ + ((flags&SIZEINT) ? ADDTYPE(T_SIZEINT) : \ + ((flags&LLONGINT) ? ADDTYPE(T_U_LLONG) : \ + ((flags&LONGINT) ? ADDTYPE(T_U_LONG) : \ + ((flags&SHORTINT) ? ADDTYPE(T_U_SHORT) : \ + ((flags&CHARINT) ? ADDTYPE(T_U_CHAR) : ADDTYPE(T_U_INT)))))))); \ + check_rc(rc); + + /* + * Add * arguments to the type array. + */ +#define ADDASTER() \ + n2 = 0; \ + cp = fmt; \ + while (is_digit(*cp)) { \ + APPEND_DIGIT(n2, *cp); \ + cp++; \ + } \ + if (*cp == '$') { \ + int hold = nextarg; \ + nextarg = n2; \ + ADDTYPE_CHECK(T_INT); \ + nextarg = hold; \ + fmt = ++cp; \ + } else { \ + ADDTYPE_CHECK(T_INT); \ + } + fmt = (wchar_t *)fmt0; + typetable = stattypetable; + tablesize = STATIC_ARG_TBL_SIZE; + tablemax = 0; + nextarg = 1; + memset(typetable, T_UNUSED, STATIC_ARG_TBL_SIZE); + + /* + * Scan the format for conversions (`%' character). + */ + for (;;) { + for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++) + continue; + if (ch == '\0') + goto done; + fmt++; /* skip over '%' */ + + flags = 0; + +rflag: ch = *fmt++; +reswitch: switch (ch) { + case ' ': + case '#': + case '\'': + goto rflag; + case '*': + ADDASTER(); + goto rflag; + case '-': + case '+': + goto rflag; + case '.': + if ((ch = *fmt++) == '*') { + ADDASTER(); + goto rflag; + } + while (is_digit(ch)) { + ch = *fmt++; + } + goto reswitch; + case '0': + goto rflag; + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + n = 0; + do { + APPEND_DIGIT(n ,ch); + ch = *fmt++; + } while (is_digit(ch)); + if (ch == '$') { + nextarg = n; + goto rflag; + } + goto reswitch; +#ifdef FLOATING_POINT + case 'L': + flags |= LONGDBL; + goto rflag; +#endif + case 'h': + if (*fmt == 'h') { + fmt++; + flags |= CHARINT; + } else { + flags |= SHORTINT; + } + goto rflag; + case 'l': + if (*fmt == 'l') { + fmt++; + flags |= LLONGINT; + } else { + flags |= LONGINT; + } + goto rflag; + case 'q': + flags |= LLONGINT; + goto rflag; + case 't': + flags |= PTRINT; + goto rflag; + case 'z': + flags |= SIZEINT; + goto rflag; + case 'C': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'c': + if (flags & LONGINT) + ADDTYPE_CHECK(T_WINT); + else + ADDTYPE_CHECK(T_INT); + break; + case 'D': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'd': + case 'i': + ADDSARG(); + break; +#ifdef FLOATING_POINT + case 'a': + case 'A': + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + if (flags & LONGDBL) + ADDTYPE_CHECK(T_LONG_DOUBLE); + else + ADDTYPE_CHECK(T_DOUBLE); + break; +#endif /* FLOATING_POINT */ + case 'n': + if (flags & LLONGINT) + ADDTYPE_CHECK(TP_LLONG); + else if (flags & LONGINT) + ADDTYPE_CHECK(TP_LONG); + else if (flags & SHORTINT) + ADDTYPE_CHECK(TP_SHORT); + else if (flags & PTRINT) + ADDTYPE_CHECK(TP_PTRINT); + else if (flags & SIZEINT) + ADDTYPE_CHECK(TP_SSIZEINT); + else if (flags & MAXINT) + ADDTYPE_CHECK(TP_MAXINT); + else + ADDTYPE_CHECK(TP_INT); + continue; /* no output */ + case 'O': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'o': + ADDUARG(); + break; + case 'p': + ADDTYPE_CHECK(TP_VOID); + break; + case 'S': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 's': + if (flags & LONGINT) + ADDTYPE_CHECK(TP_CHAR); + else + ADDTYPE_CHECK(TP_WCHAR); + break; + case 'U': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'u': + case 'X': + case 'x': + ADDUARG(); + break; + default: /* "%?" prints ?, unless ? is NUL */ + if (ch == '\0') + goto done; + break; + } + } +done: + /* + * Build the argument table. + */ + if (tablemax >= STATIC_ARG_TBL_SIZE) { + *argtablesiz = sizeof(union arg) * (tablemax + 1); + *argtable = (union arg *)malloc(*argtablesiz); + if (*argtable == NULL) + goto overflow; //return (-1); + } + +#if 0 + /* XXX is this required? */ + (*argtable)[0].intarg = 0; +#endif + for (n = 1; n <= tablemax; n++) { + switch (typetable[n]) { + case T_UNUSED: + case T_CHAR: + case T_U_CHAR: + case T_SHORT: + case T_U_SHORT: + case T_INT: + (*argtable)[n].intarg = va_arg(ap, int); + break; + case TP_SHORT: + (*argtable)[n].pshortarg = va_arg(ap, short *); + break; + case T_U_INT: + (*argtable)[n].uintarg = va_arg(ap, unsigned int); + break; + case TP_INT: + (*argtable)[n].pintarg = va_arg(ap, int *); + break; + case T_LONG: + (*argtable)[n].longarg = va_arg(ap, long); + break; + case T_U_LONG: + (*argtable)[n].ulongarg = va_arg(ap, unsigned long); + break; + case TP_LONG: + (*argtable)[n].plongarg = va_arg(ap, long *); + break; + case T_LLONG: + (*argtable)[n].longlongarg = va_arg(ap, long long); + break; + case T_U_LLONG: + (*argtable)[n].ulonglongarg = va_arg(ap, unsigned long long); + break; + case TP_LLONG: + (*argtable)[n].plonglongarg = va_arg(ap, long long *); + break; +#ifdef FLOATING_POINT + case T_DOUBLE: + (*argtable)[n].doublearg = va_arg(ap, double); + break; + case T_LONG_DOUBLE: + (*argtable)[n].longdoublearg = va_arg(ap, long double); + break; +#endif + case TP_CHAR: + (*argtable)[n].pchararg = va_arg(ap, char *); + break; + case TP_VOID: + (*argtable)[n].pvoidarg = va_arg(ap, void *); + break; + case T_PTRINT: + (*argtable)[n].ptrdiffarg = va_arg(ap, ptrdiff_t); + break; + case TP_PTRINT: + (*argtable)[n].pptrdiffarg = va_arg(ap, ptrdiff_t *); + break; + case T_SIZEINT: + (*argtable)[n].sizearg = va_arg(ap, size_t); + break; + case T_SSIZEINT: + (*argtable)[n].ssizearg = va_arg(ap, ssize_t); + break; + case TP_SSIZEINT: + (*argtable)[n].pssizearg = va_arg(ap, ssize_t *); + break; + case TP_MAXINT: + (*argtable)[n].intmaxarg = va_arg(ap, intmax_t); + break; + case T_WINT: + (*argtable)[n].wintarg = va_arg(ap, wint_t); + break; + case TP_WCHAR: + (*argtable)[n].pwchararg = va_arg(ap, wchar_t *); + break; + } + } + goto finish; + +overflow: + errno = ENOMEM; + ret = -1; + +finish: + if (typetable != NULL && typetable != stattypetable) { + free(typetable); + typetable = NULL; + } + return (ret); +} + +/* + * Increase the size of the type table. + */ +static int +__grow_type_table(unsigned char **typetable, int *tablesize) +{ + unsigned char *oldtable = *typetable; + int newsize = *tablesize * 2; + + if (newsize < SE_PAGE_SIZE) + newsize = SE_PAGE_SIZE; + + if (*tablesize == STATIC_ARG_TBL_SIZE) { + *typetable = (unsigned char *)malloc(newsize); + if (*typetable == NULL) + return (-1); + memmove(*typetable, oldtable, *tablesize); + } else { + unsigned char *new1 = (unsigned char *)malloc(newsize); + if (new1 == NULL) + return (-1); + memmove(new1, *typetable, *tablesize); + free(*typetable); + *typetable = new1; + } + memset(*typetable + *tablesize, T_UNUSED, (newsize - *tablesize)); + + *tablesize = newsize; + return (0); +} + + +#ifdef FLOATING_POINT +static int +exponent(wchar_t *p0, int exp, int fmtch) +{ + wchar_t *p, *t; + wchar_t expbuf[MAXEXPDIG]; + + p = p0; + *p++ = fmtch; + if (exp < 0) { + exp = -exp; + *p++ = '-'; + } else + *p++ = '+'; + t = expbuf + MAXEXPDIG; + if (exp > 9) { + do { + *--t = to_char(exp % 10); + } while ((exp /= 10) > 9); + *--t = to_char(exp); + for (; t < expbuf + MAXEXPDIG; *p++ = *t++) + /* nothing */; + } else { + /* + * Exponents for decimal floating point conversions + * (%[eEgG]) must be at least two characters long, + * whereas exponents for hexadecimal conversions can + * be only one character long. + */ + if (fmtch == 'e' || fmtch == 'E') + *p++ = '0'; + *p++ = to_char(exp); + } + return (p - p0); +} +#endif /* FLOATING_POINT */ diff --git a/sdk/tlibc/stdio/vsnprintf.c b/sdk/tlibc/stdio/vsnprintf.c new file mode 100644 index 0000000000..8b1a088da8 --- /dev/null +++ b/sdk/tlibc/stdio/vsnprintf.c @@ -0,0 +1,64 @@ +/* $OpenBSD: vsnprintf.c,v 1.15 2009/11/09 00:18:28 kurt Exp $ */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include "local.h" + +int +vsnprintf(char *str, size_t n, const char *fmt, __va_list ap) +{ + int ret; + char dummy; + FILE f; + struct __sfileext fext; + + _FILEEXT_SETUP(&f, &fext); + + /* While snprintf(3) specifies size_t stdio uses an int internally */ + if (n > INT_MAX) + n = INT_MAX; + /* Stdio internals do not deal correctly with zero length buffer */ + if (n == 0) { + str = &dummy; + n = 1; + } + f._file = -1; + f._flags = __SWR | __SSTR; + f._bf._base = f._p = (unsigned char *)str; + f._bf._size = f._w = n - 1; + ret = __vfprintf(&f, fmt, ap); + *f._p = '\0'; + return (ret); +} diff --git a/sdk/tlibc/stdio/vswprintf.c b/sdk/tlibc/stdio/vswprintf.c new file mode 100644 index 0000000000..28a6b0912e --- /dev/null +++ b/sdk/tlibc/stdio/vswprintf.c @@ -0,0 +1,97 @@ +/* $OpenBSD: vswprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ +/* $NetBSD: vswprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */ + +/* + * Copyright (c) 1997 Todd C. Miller + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include "local.h" + +int +vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, + __va_list ap) +{ + mbstate_t mbs; + FILE f; + char *mbp; + int ret, sverrno; + size_t nwc; + struct __sfileext fext; + + if (n == 0) { + errno = EINVAL; + return (-1); + } + + _FILEEXT_SETUP(&f, &fext); + f._file = -1; + f._flags = __SWR | __SSTR | __SALC; + f._bf._base = f._p = (unsigned char *)malloc(128); + if (f._bf._base == NULL) { + errno = ENOMEM; + return (-1); + } + f._bf._size = f._w = 127; /* Leave room for the NUL */ + ret = __vfwprintf(&f, fmt, ap); + if (ret < 0) { + sverrno = errno; + free(f._bf._base); + errno = sverrno; + return (-1); + } + if (ret == 0) { + s[0] = L'\0'; + free(f._bf._base); + return (0); + } + *f._p = '\0'; + mbp = (char *)f._bf._base; + /* + * XXX Undo the conversion from wide characters to multibyte that + * fputwc() did in __vfwprintf(). + */ + memset(&mbs, 0x0, sizeof(mbs)); + nwc = mbsrtowcs(s, (const char **)&mbp, n, &mbs); + free(f._bf._base); + if (nwc == (size_t)-1) { + errno = EILSEQ; + return (-1); + } + if (nwc == n) { + s[n - 1] = L'\0'; + errno = EOVERFLOW; + return (-1); + } + + return (ret); +} diff --git a/sdk/tlibc/stdio/wcio.h b/sdk/tlibc/stdio/wcio.h new file mode 100644 index 0000000000..4462528da5 --- /dev/null +++ b/sdk/tlibc/stdio/wcio.h @@ -0,0 +1,61 @@ +/* $OpenBSD: wcio.h,v 1.1 2005/06/17 20:40:32 espie Exp $ */ +/* $NetBSD: wcio.h,v 1.3 2003/01/18 11:30:00 thorpej Exp $ */ + +/*- + * Copyright (c)2001 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Citrus$ + */ + +#ifndef _WCIO_H_ +#define _WCIO_H_ + +/* minimal requirement of SUSv2 */ +#define WCIO_UNGETWC_BUFSIZE 1 + +struct wchar_io_data { + mbstate_t wcio_mbstate_in; + mbstate_t wcio_mbstate_out; + + wchar_t wcio_ungetwc_buf[WCIO_UNGETWC_BUFSIZE]; + size_t wcio_ungetwc_inbuf; + + int wcio_mode; /* orientation */ +}; + +#define WCIO_GET(fp) \ + (_EXT(fp) ? &(_EXT(fp)->_wcio) : (struct wchar_io_data *)0) + +#define _SET_ORIENTATION(fp, mode) \ +do {\ + struct wchar_io_data *_wcio = WCIO_GET(fp); \ + if (_wcio && _wcio->wcio_mode == 0) \ + _wcio->wcio_mode = (mode);\ +} while (0) + +#define WCIO_INIT(fp) \ + memset(WCIO_GET(fp), 0, sizeof(struct wchar_io_data)) + +#endif /*_WCIO_H_*/ diff --git a/sdk/tlibc/stdlib/abs.c b/sdk/tlibc/stdlib/abs.c new file mode 100644 index 0000000000..5d2fbae69f --- /dev/null +++ b/sdk/tlibc/stdlib/abs.c @@ -0,0 +1,37 @@ +/* $OpenBSD: abs.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +int +abs(int j) +{ + return(j < 0 ? -j : j); +} diff --git a/sdk/tlibc/stdlib/atof.c b/sdk/tlibc/stdlib/atof.c new file mode 100644 index 0000000000..d14b58b070 --- /dev/null +++ b/sdk/tlibc/stdlib/atof.c @@ -0,0 +1,37 @@ +/* $OpenBSD: atof.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1988 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +double +atof(const char *ascii) +{ + return(strtod(ascii, (char **)NULL)); +} diff --git a/sdk/tlibc/stdlib/atoi.c b/sdk/tlibc/stdlib/atoi.c new file mode 100644 index 0000000000..b0842678e2 --- /dev/null +++ b/sdk/tlibc/stdlib/atoi.c @@ -0,0 +1,37 @@ +/* $OpenBSD: atoi.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +int +atoi(const char *str) +{ + return((int)strtol(str, (char **)NULL, 10)); +} diff --git a/sdk/tlibc/stdlib/atol.c b/sdk/tlibc/stdlib/atol.c new file mode 100644 index 0000000000..1970804401 --- /dev/null +++ b/sdk/tlibc/stdlib/atol.c @@ -0,0 +1,37 @@ +/* $OpenBSD: atol.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +long +atol(const char *str) +{ + return(strtol(str, (char **)NULL, 10)); +} diff --git a/sdk/tlibc/stdlib/atoll.c b/sdk/tlibc/stdlib/atoll.c new file mode 100644 index 0000000000..7dad703ffa --- /dev/null +++ b/sdk/tlibc/stdlib/atoll.c @@ -0,0 +1,37 @@ +/* $OpenBSD: atoll.c,v 1.3 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +long long +atoll(const char *str) +{ + return(strtoll(str, (char **)NULL, 10)); +} diff --git a/sdk/tlibc/stdlib/bsearch.c b/sdk/tlibc/stdlib/bsearch.c new file mode 100644 index 0000000000..2d4dbbe5c6 --- /dev/null +++ b/sdk/tlibc/stdlib/bsearch.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Perform a binary search. + * + * The code below is a bit sneaky. After a comparison fails, we + * divide the work in half by moving either left or right. If lim + * is odd, moving left simply involves halving lim: e.g., when lim + * is 5 we look at item 2, so we change lim to 2 so that we will + * look at items 0 & 1. If lim is even, the same applies. If lim + * is odd, moving right again involves halving lim, this time moving + * the base up one item past p: e.g., when lim is 5 we change base + * to item 3 and make lim 2 so that we will look at items 3 and 4. + * If lim is even, however, we have to shrink it by one before + * halving: e.g., when lim is 4, we still looked at item 2, so we + * have to make lim 3, then halve, obtaining 1, so that we will only + * look at item 3. + */ + +/* Disable warnings */ + +void * +bsearch(const void *key, const void *base0, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)) +{ + const char *base = (const char *)base0; + size_t lim; + int cmp; + const void *p; + + for (lim = nmemb; lim != 0; lim >>= 1) { + p = base + (lim >> 1) * size; + cmp = (*compar)(key, p); + if (cmp == 0) + return ((void *)p); + if (cmp > 0) { /* key > p: move right */ + base = (char *)p + size; + lim--; + } /* else move left */ + } + return (NULL); +} diff --git a/sdk/tlibc/stdlib/div.c b/sdk/tlibc/stdlib/div.c new file mode 100644 index 0000000000..f7ac2db4b0 --- /dev/null +++ b/sdk/tlibc/stdlib/div.c @@ -0,0 +1,71 @@ +/* $OpenBSD: div.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include /* div_t */ + +div_t +div(int num, int denom) +{ + div_t r; + + r.quot = num / denom; + r.rem = num % denom; + /* + * The ANSI standard says that |r.quot| <= |n/d|, where + * n/d is to be computed in infinite precision. In other + * words, we should always truncate the quotient towards + * 0, never -infinity. + * + * Machine division and remainer may work either way when + * one or both of n or d is negative. If only one is + * negative and r.quot has been truncated towards -inf, + * r.rem will have the same sign as denom and the opposite + * sign of num; if both are negative and r.quot has been + * truncated towards -inf, r.rem will be positive (will + * have the opposite sign of num). These are considered + * `wrong'. + * + * If both are num and denom are positive, r will always + * be positive. + * + * This all boils down to: + * if num >= 0, but r.rem < 0, we got the wrong answer. + * In that case, to get the right answer, add 1 to r.quot and + * subtract denom from r.rem. + */ + if (num >= 0 && r.rem < 0) { + r.quot++; + r.rem -= denom; + } + return (r); +} diff --git a/sdk/tlibc/stdlib/imaxabs.c b/sdk/tlibc/stdlib/imaxabs.c new file mode 100644 index 0000000000..b7e910eefd --- /dev/null +++ b/sdk/tlibc/stdlib/imaxabs.c @@ -0,0 +1,38 @@ +/* $OpenBSD: imaxabs.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +intmax_t +imaxabs(intmax_t j) +{ + return (j < 0 ? -j : j); +} diff --git a/sdk/tlibc/stdlib/imaxdiv.c b/sdk/tlibc/stdlib/imaxdiv.c new file mode 100644 index 0000000000..0515a94b96 --- /dev/null +++ b/sdk/tlibc/stdlib/imaxdiv.c @@ -0,0 +1,50 @@ +/* $OpenBSD: imaxdiv.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include /* imaxdiv_t */ + +imaxdiv_t +imaxdiv(intmax_t num, intmax_t denom) +{ + imaxdiv_t r; + + /* see div.c for comments */ + + r.quot = num / denom; + r.rem = num % denom; + if (num >= 0 && r.rem < 0) { + r.quot++; + r.rem -= denom; + } + return (r); +} diff --git a/sdk/tlibc/stdlib/labs.c b/sdk/tlibc/stdlib/labs.c new file mode 100644 index 0000000000..ca60b9aba2 --- /dev/null +++ b/sdk/tlibc/stdlib/labs.c @@ -0,0 +1,37 @@ +/* $OpenBSD: labs.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +long +labs(long j) +{ + return(j < 0 ? -j : j); +} diff --git a/sdk/tlibc/stdlib/ldiv.c b/sdk/tlibc/stdlib/ldiv.c new file mode 100644 index 0000000000..775065f525 --- /dev/null +++ b/sdk/tlibc/stdlib/ldiv.c @@ -0,0 +1,50 @@ +/* $OpenBSD: ldiv.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include /* ldiv_t */ + +ldiv_t +ldiv(long num, long denom) +{ + ldiv_t r; + + /* see div.c for comments */ + + r.quot = num / denom; + r.rem = num % denom; + if (num >= 0 && r.rem < 0) { + r.quot++; + r.rem -= denom; + } + return (r); +} diff --git a/sdk/tlibc/stdlib/llabs.c b/sdk/tlibc/stdlib/llabs.c new file mode 100644 index 0000000000..fc2cd8261c --- /dev/null +++ b/sdk/tlibc/stdlib/llabs.c @@ -0,0 +1,38 @@ +/* $OpenBSD: llabs.c,v 1.3 2007/01/08 19:39:25 deraadt Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +long long +llabs(long long j) +{ + return (j < 0 ? -j : j); +} diff --git a/sdk/tlibc/stdlib/lldiv.c b/sdk/tlibc/stdlib/lldiv.c new file mode 100644 index 0000000000..e8d6c978b3 --- /dev/null +++ b/sdk/tlibc/stdlib/lldiv.c @@ -0,0 +1,50 @@ +/* $OpenBSD: lldiv.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include /* lldiv_t */ + +lldiv_t +lldiv(long long num, long long denom) +{ + lldiv_t r; + + /* see div.c for comments */ + + r.quot = num / denom; + r.rem = num % denom; + if (num >= 0 && r.rem < 0) { + r.quot++; + r.rem -= denom; + } + return (r); +} diff --git a/sdk/tlibc/stdlib/malloc.c b/sdk/tlibc/stdlib/malloc.c new file mode 100755 index 0000000000..c222e6553b --- /dev/null +++ b/sdk/tlibc/stdlib/malloc.c @@ -0,0 +1,6363 @@ +/* + This is a version (aka dlmalloc) of malloc/free/realloc written by + Doug Lea and released to the public domain, as explained at + http://creativecommons.org/publicdomain/zero/1.0/ Send questions, + comments, complaints, performance data, etc to dl@cs.oswego.edu + +* Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea + Note: There may be an updated version of this malloc obtainable at + ftp://gee.cs.oswego.edu/pub/misc/malloc.c + Check before installing! + +* Quickstart + + This library is all in one file to simplify the most common usage: + ftp it, compile it (-O3), and link it into another program. All of + the compile-time options default to reasonable values for use on + most platforms. You might later want to step through various + compile-time and dynamic tuning options. + + For convenience, an include file for code using this malloc is at: + ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.6.h + You don't really need this .h file unless you call functions not + defined in your system include files. The .h file contains only the + excerpts from this file needed for using this malloc on ANSI C/C++ + systems, so long as you haven't changed compile-time options about + naming and tuning parameters. If you do, then you can create your + own malloc.h that does include all settings by cutting at the point + indicated below. Note that you may already by default be using a C + library containing a malloc that is based on some version of this + malloc (for example in linux). You might still want to use the one + in this file to customize settings or to avoid overheads associated + with library versions. + +* Vital statistics: + + Supported pointer/size_t representation: 4 or 8 bytes + size_t MUST be an unsigned type of the same width as + pointers. (If you are using an ancient system that declares + size_t as a signed type, or need it to be a different width + than pointers, you can use a previous release of this malloc + (e.g. 2.7.2) supporting these.) + + Alignment: 8 bytes (minimum) + This suffices for nearly all current machines and C compilers. + However, you can define MALLOC_ALIGNMENT to be wider than this + if necessary (up to 128bytes), at the expense of using more space. + + Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) + 8 or 16 bytes (if 8byte sizes) + Each malloced chunk has a hidden word of overhead holding size + and status information, and additional cross-check word + if FOOTERS is defined. + + Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) + 8-byte ptrs: 32 bytes (including overhead) + + Even a request for zero bytes (i.e., malloc(0)) returns a + pointer to something of the minimum allocatable size. + The maximum overhead wastage (i.e., number of extra bytes + allocated than were requested in malloc) is less than or equal + to the minimum size, except for requests >= mmap_threshold that + are serviced via mmap(), where the worst case wastage is about + 32 bytes plus the remainder from a system page (the minimal + mmap unit); typically 4096 or 8192 bytes. + + Security: static-safe; optionally more or less + The "security" of malloc refers to the ability of malicious + code to accentuate the effects of errors (for example, freeing + space that is not currently malloc'ed or overwriting past the + ends of chunks) in code that calls malloc. This malloc + guarantees not to modify any memory locations below the base of + heap, i.e., static variables, even in the presence of usage + errors. The routines additionally detect most improper frees + and reallocs. All this holds as long as the static bookkeeping + for malloc itself is not corrupted by some other means. This + is only one aspect of security -- these checks do not, and + cannot, detect all possible programming errors. + + If FOOTERS is defined nonzero, then each allocated chunk + carries an additional check word to verify that it was malloced + from its space. These check words are the same within each + execution of a program using malloc, but differ across + executions, so externally crafted fake chunks cannot be + freed. This improves security by rejecting frees/reallocs that + could corrupt heap memory, in addition to the checks preventing + writes to statics that are always on. This may further improve + security at the expense of time and space overhead. (Note that + FOOTERS may also be worth using with MSPACES.) + + By default detected errors cause the program to abort (calling + "abort()"). You can override this to instead proceed past + errors by defining PROCEED_ON_ERROR. In this case, a bad free + has no effect, and a malloc that encounters a bad address + caused by user overwrites will ignore the bad address by + dropping pointers and indices to all known memory. This may + be appropriate for programs that should continue if at all + possible in the face of programming errors, although they may + run out of memory because dropped memory is never reclaimed. + + If you don't like either of these options, you can define + CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything + else. And if if you are sure that your program using malloc has + no errors or vulnerabilities, you can define INSECURE to 1, + which might (or might not) provide a small performance improvement. + + It is also possible to limit the maximum total allocatable + space, using malloc_set_footprint_limit. This is not + designed as a security feature in itself (calls to set limits + are not screened or privileged), but may be useful as one + aspect of a secure implementation. + + Thread-safety: NOT thread-safe unless USE_LOCKS defined non-zero + When USE_LOCKS is defined, each public call to malloc, free, + etc is surrounded with a lock. By default, this uses a plain + pthread mutex, win32 critical section, or a spin-lock if if + available for the platform and not disabled by setting + USE_SPIN_LOCKS=0. However, if USE_RECURSIVE_LOCKS is defined, + recursive versions are used instead (which are not required for + base functionality but may be needed in layered extensions). + Using a global lock is not especially fast, and can be a major + bottleneck. It is designed only to provide minimal protection + in concurrent environments, and to provide a basis for + extensions. If you are using malloc in a concurrent program, + consider instead using nedmalloc + (http://www.nedprod.com/programs/portable/nedmalloc/) or + ptmalloc (See http://www.malloc.de), which are derived from + versions of this malloc. + + System requirements: Any combination of MORECORE and/or MMAP/MUNMAP + This malloc can use unix sbrk or any emulation (invoked using + the CALL_MORECORE macro) and/or mmap/munmap or any emulation + (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system + memory. On most unix systems, it tends to work best if both + MORECORE and MMAP are enabled. On Win32, it uses emulations + based on VirtualAlloc. It also uses common C library functions + like memset. + + Compliance: I believe it is compliant with the Single Unix Specification + (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably + others as well. + +* Overview of algorithms + + This is not the fastest, most space-conserving, most portable, or + most tunable malloc ever written. However it is among the fastest + while also being among the most space-conserving, portable and + tunable. Consistent balance across these factors results in a good + general-purpose allocator for malloc-intensive programs. + + In most ways, this malloc is a best-fit allocator. Generally, it + chooses the best-fitting existing chunk for a request, with ties + broken in approximately least-recently-used order. (This strategy + normally maintains low fragmentation.) However, for requests less + than 256bytes, it deviates from best-fit when there is not an + exactly fitting available chunk by preferring to use space adjacent + to that used for the previous small request, as well as by breaking + ties in approximately most-recently-used order. (These enhance + locality of series of small allocations.) And for very large requests + (>= 256Kb by default), it relies on system memory mapping + facilities, if supported. (This helps avoid carrying around and + possibly fragmenting memory used only for large chunks.) + + All operations (except malloc_stats and mallinfo) have execution + times that are bounded by a constant factor of the number of bits in + a size_t, not counting any clearing in calloc or copying in realloc, + or actions surrounding MORECORE and MMAP that have times + proportional to the number of non-contiguous regions returned by + system allocation routines, which is often just 1. In real-time + applications, you can optionally suppress segment traversals using + NO_SEGMENT_TRAVERSAL, which assures bounded execution even when + system allocators return non-contiguous spaces, at the typical + expense of carrying around more memory and increased fragmentation. + + The implementation is not very modular and seriously overuses + macros. Perhaps someday all C compilers will do as good a job + inlining modular code as can now be done by brute-force expansion, + but now, enough of them seem not to. + + Some compilers issue a lot of warnings about code that is + dead/unreachable only on some platforms, and also about intentional + uses of negation on unsigned types. All known cases of each can be + ignored. + + For a longer but out of date high-level description, see + http://gee.cs.oswego.edu/dl/html/malloc.html + +* MSPACES + If MSPACES is defined, then in addition to malloc, free, etc., + this file also defines mspace_malloc, mspace_free, etc. These + are versions of malloc routines that take an "mspace" argument + obtained using create_mspace, to control all internal bookkeeping. + If ONLY_MSPACES is defined, only these versions are compiled. + So if you would like to use this allocator for only some allocations, + and your system malloc for others, you can compile with + ONLY_MSPACES and then do something like... + static mspace mymspace = create_mspace(0,0); // for example + #define mymalloc(bytes) mspace_malloc(mymspace, bytes) + + (Note: If you only need one instance of an mspace, you can instead + use "USE_DL_PREFIX" to relabel the global malloc.) + + You can similarly create thread-local allocators by storing + mspaces as thread-locals. For example: + static __thread mspace tlms = 0; + void* tlmalloc(size_t bytes) { + if (tlms == 0) tlms = create_mspace(0, 0); + return mspace_malloc(tlms, bytes); + } + void tlfree(void* mem) { mspace_free(tlms, mem); } + + Unless FOOTERS is defined, each mspace is completely independent. + You cannot allocate from one and free to another (although + conformance is only weakly checked, so usage errors are not always + caught). If FOOTERS is defined, then each chunk carries around a tag + indicating its originating mspace, and frees are directed to their + originating spaces. Normally, this requires use of locks. + + ------------------------- Compile-time options --------------------------- + +Be careful in setting #define values for numerical constants of type +size_t. On some systems, literal values are not automatically extended +to size_t precision unless they are explicitly casted. You can also +use the symbolic values MAX_SIZE_T, SIZE_T_ONE, etc below. + +WIN32 default: defined if _WIN32 defined + Defining WIN32 sets up defaults for MS environment and compilers. + Otherwise defaults are for unix. Beware that there seem to be some + cases where this malloc might not be a pure drop-in replacement for + Win32 malloc: Random-looking failures from Win32 GDI API's (eg; + SetDIBits()) may be due to bugs in some video driver implementations + when pixel buffers are malloc()ed, and the region spans more than + one VirtualAlloc()ed region. Because dlmalloc uses a small (64Kb) + default granularity, pixel buffers may straddle virtual allocation + regions more often than when using the Microsoft allocator. You can + avoid this by using VirtualAlloc() and VirtualFree() for all pixel + buffers rather than using malloc(). If this is not possible, + recompile this malloc with a larger DEFAULT_GRANULARITY. Note: + in cases where MSC and gcc (cygwin) are known to differ on WIN32, + conditions use _MSC_VER to distinguish them. + +DLMALLOC_EXPORT default: extern + Defines how public APIs are declared. If you want to export via a + Windows DLL, you might define this as + #define DLMALLOC_EXPORT extern __declspec(dllexport) + If you want a POSIX ELF shared object, you might use + #define DLMALLOC_EXPORT extern __attribute__((visibility("default"))) + +MALLOC_ALIGNMENT default: (size_t)(2 * sizeof(void *)) + Controls the minimum alignment for malloc'ed chunks. It must be a + power of two and at least 8, even on machines for which smaller + alignments would suffice. It may be defined as larger than this + though. Note however that code and data structures are optimized for + the case of 8-byte alignment. + +MSPACES default: 0 (false) + If true, compile in support for independent allocation spaces. + This is only supported if HAVE_MMAP is true. + +ONLY_MSPACES default: 0 (false) + If true, only compile in mspace versions, not regular versions. + +USE_LOCKS default: 0 (false) + Causes each call to each public routine to be surrounded with + pthread or WIN32 mutex lock/unlock. (If set true, this can be + overridden on a per-mspace basis for mspace versions.) If set to a + non-zero value other than 1, locks are used, but their + implementation is left out, so lock functions must be supplied manually, + as described below. + +USE_SPIN_LOCKS default: 1 iff USE_LOCKS and spin locks available + If true, uses custom spin locks for locking. This is currently + supported only gcc >= 4.1, older gccs on x86 platforms, and recent + MS compilers. Otherwise, posix locks or win32 critical sections are + used. + +USE_RECURSIVE_LOCKS default: not defined + If defined nonzero, uses recursive (aka reentrant) locks, otherwise + uses plain mutexes. This is not required for malloc proper, but may + be needed for layered allocators such as nedmalloc. + +LOCK_AT_FORK default: not defined + If defined nonzero, performs pthread_atfork upon initialization + to initialize child lock while holding parent lock. The implementation + assumes that pthread locks (not custom locks) are being used. In other + cases, you may need to customize the implementation. + +FOOTERS default: 0 + If true, provide extra checking and dispatching by placing + information in the footers of allocated chunks. This adds + space and time overhead. + +INSECURE default: 0 + If true, omit checks for usage errors and heap space overwrites. + +USE_DL_PREFIX default: NOT defined + Causes compiler to prefix all public routines with the string 'dl'. + This can be useful when you only want to use this malloc in one part + of a program, using your regular system malloc elsewhere. + +MALLOC_INSPECT_ALL default: NOT defined + If defined, compiles malloc_inspect_all and mspace_inspect_all, that + perform traversal of all heap space. Unless access to these + functions is otherwise restricted, you probably do not want to + include them in secure implementations. + +ABORT default: defined as abort() + Defines how to abort on failed checks. On most systems, a failed + check cannot die with an "assert" or even print an informative + message, because the underlying print routines in turn call malloc, + which will fail again. Generally, the best policy is to simply call + abort(). It's not very useful to do more than this because many + errors due to overwriting will show up as address faults (null, odd + addresses etc) rather than malloc-triggered checks, so will also + abort. Also, most compilers know that abort() does not return, so + can better optimize code conditionally calling it. + +PROCEED_ON_ERROR default: defined as 0 (false) + Controls whether detected bad addresses cause them to bypassed + rather than aborting. If set, detected bad arguments to free and + realloc are ignored. And all bookkeeping information is zeroed out + upon a detected overwrite of freed heap space, thus losing the + ability to ever return it from malloc again, but enabling the + application to proceed. If PROCEED_ON_ERROR is defined, the + static variable malloc_corruption_error_count is compiled in + and can be examined to see if errors have occurred. This option + generates slower code than the default abort policy. + +DEBUG default: NOT defined + The DEBUG setting is mainly intended for people trying to modify + this code or diagnose problems when porting to new platforms. + However, it may also be able to better isolate user errors than just + using runtime checks. The assertions in the check routines spell + out in more detail the assumptions and invariants underlying the + algorithms. The checking is fairly extensive, and will slow down + execution noticeably. Calling malloc_stats or mallinfo with DEBUG + set will attempt to check every non-mmapped allocated and free chunk + in the course of computing the summaries. + +ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) + Debugging assertion failures can be nearly impossible if your + version of the assert macro causes malloc to be called, which will + lead to a cascade of further failures, blowing the runtime stack. + ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), + which will usually make debugging easier. + +MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 + The action to take before "return 0" when malloc fails to be able to + return memory because there is none available. + +HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES + True if this system supports sbrk or an emulation of it. + +MORECORE default: sbrk + The name of the sbrk-style system routine to call to obtain more + memory. See below for guidance on writing custom MORECORE + functions. The type of the argument to sbrk/MORECORE varies across + systems. It cannot be size_t, because it supports negative + arguments, so it is normally the signed type of the same width as + size_t (sometimes declared as "intptr_t"). It doesn't much matter + though. Internally, we only call it with arguments less than half + the max value of a size_t, which should work across all reasonable + possibilities, although sometimes generating compiler warnings. + +MORECORE_CONTIGUOUS default: 1 (true) if HAVE_MORECORE + If true, take advantage of fact that consecutive calls to MORECORE + with positive arguments always return contiguous increasing + addresses. This is true of unix sbrk. It does not hurt too much to + set it true anyway, since malloc copes with non-contiguities. + Setting it false when definitely non-contiguous saves time + and possibly wasted space it would take to discover this though. + +MORECORE_CANNOT_TRIM default: NOT defined + True if MORECORE cannot release space back to the system when given + negative arguments. This is generally necessary only if you are + using a hand-crafted MORECORE function that cannot handle negative + arguments. + +NO_SEGMENT_TRAVERSAL default: 0 + If non-zero, suppresses traversals of memory segments + returned by either MORECORE or CALL_MMAP. This disables + merging of segments that are contiguous, and selectively + releasing them to the OS if unused, but bounds execution times. + +HAVE_MMAP default: 1 (true) + True if this system supports mmap or an emulation of it. If so, and + HAVE_MORECORE is not true, MMAP is used for all system + allocation. If set and HAVE_MORECORE is true as well, MMAP is + primarily used to directly allocate very large blocks. It is also + used as a backup strategy in cases where MORECORE fails to provide + space from system. Note: A single call to MUNMAP is assumed to be + able to unmap memory that may have be allocated using multiple calls + to MMAP, so long as they are adjacent. + +HAVE_MREMAP default: 1 on linux, else 0 + If true realloc() uses mremap() to re-allocate large blocks and + extend or shrink allocation spaces. + +MMAP_CLEARS default: 1 except on WINCE. + True if mmap clears memory so calloc doesn't need to. This is true + for standard unix mmap using /dev/zero and on WIN32 except for WINCE. + +USE_BUILTIN_FFS default: 0 (i.e., not used) + Causes malloc to use the builtin ffs() function to compute indices. + Some compilers may recognize and intrinsify ffs to be faster than the + supplied C version. Also, the case of x86 using gcc is special-cased + to an asm instruction, so is already as fast as it can be, and so + this setting has no effect. Similarly for Win32 under recent MS compilers. + (On most x86s, the asm version is only slightly faster than the C version.) + +malloc_getpagesize default: derive from system includes, or 4096. + The system page size. To the extent possible, this malloc manages + memory from the system in page-size units. This may be (and + usually is) a function rather than a constant. This is ignored + if WIN32, where page size is determined using getSystemInfo during + initialization. + +USE_DEV_RANDOM default: 0 (i.e., not used) + Causes malloc to use /dev/random to initialize secure magic seed for + stamping footers. Otherwise, the current time is used. + +NO_MALLINFO default: 0 + If defined, don't compile "mallinfo". This can be a simple way + of dealing with mismatches between system declarations and + those in this file. + +MALLINFO_FIELD_TYPE default: size_t + The type of the fields in the mallinfo struct. This was originally + defined as "int" in SVID etc, but is more usefully defined as + size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set + +NO_MALLOC_STATS default: 0 + If defined, don't compile "malloc_stats". This avoids calls to + fprintf and bringing in stdio dependencies you might not want. + +REALLOC_ZERO_BYTES_FREES default: not defined + This should be set if a call to realloc with zero bytes should + be the same as a call to free. Some people think it should. Otherwise, + since this malloc returns a unique pointer for malloc(0), so does + realloc(p, 0). + +LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H +LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H +LACKS_STDLIB_H LACKS_SCHED_H LACKS_TIME_H default: NOT defined unless on WIN32 + Define these if your system does not have these header files. + You might need to manually insert some of the declarations they provide. + +DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, + system_info.dwAllocationGranularity in WIN32, + otherwise 64K. + Also settable using mallopt(M_GRANULARITY, x) + The unit for allocating and deallocating memory from the system. On + most systems with contiguous MORECORE, there is no reason to + make this more than a page. However, systems with MMAP tend to + either require or encourage larger granularities. You can increase + this value to prevent system allocation functions to be called so + often, especially if they are slow. The value must be at least one + page and must be a power of two. Setting to 0 causes initialization + to either page size or win32 region size. (Note: In previous + versions of malloc, the equivalent of this option was called + "TOP_PAD") + +DEFAULT_TRIM_THRESHOLD default: 2MB + Also settable using mallopt(M_TRIM_THRESHOLD, x) + The maximum amount of unused top-most memory to keep before + releasing via malloc_trim in free(). Automatic trimming is mainly + useful in long-lived programs using contiguous MORECORE. Because + trimming via sbrk can be slow on some systems, and can sometimes be + wasteful (in cases where programs immediately afterward allocate + more large chunks) the value should be high enough so that your + overall system performance would improve by releasing this much + memory. As a rough guide, you might set to a value close to the + average size of a process (program) running on your system. + Releasing this much memory would allow such a process to run in + memory. Generally, it is worth tuning trim thresholds when a + program undergoes phases where several large chunks are allocated + and released in ways that can reuse each other's storage, perhaps + mixed with phases where there are no such chunks at all. The trim + value must be greater than page size to have any useful effect. To + disable trimming completely, you can set to MAX_SIZE_T. Note that the trick + some people use of mallocing a huge space and then freeing it at + program startup, in an attempt to reserve system memory, doesn't + have the intended effect under automatic trimming, since that memory + will immediately be returned to the system. + +DEFAULT_MMAP_THRESHOLD default: 256K + Also settable using mallopt(M_MMAP_THRESHOLD, x) + The request size threshold for using MMAP to directly service a + request. Requests of at least this size that cannot be allocated + using already-existing space will be serviced via mmap. (If enough + normal freed space already exists it is used instead.) Using mmap + segregates relatively large chunks of memory so that they can be + individually obtained and released from the host system. A request + serviced through mmap is never reused by any other request (at least + not directly; the system may just so happen to remap successive + requests to the same locations). Segregating space in this way has + the benefits that: Mmapped space can always be individually released + back to the system, which helps keep the system level memory demands + of a long-lived program low. Also, mapped memory doesn't become + `locked' between other chunks, as can happen with normally allocated + chunks, which means that even trimming via malloc_trim would not + release them. However, it has the disadvantage that the space + cannot be reclaimed, consolidated, and then used to service later + requests, as happens with normal chunks. The advantages of mmap + nearly always outweigh disadvantages for "large" chunks, but the + value of "large" may vary across systems. The default is an + empirically derived value that works well in most systems. You can + disable mmap by setting to MAX_SIZE_T. + +MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP + The number of consolidated frees between checks to release + unused segments when freeing. When using non-contiguous segments, + especially with multiple mspaces, checking only for topmost space + doesn't always suffice to trigger trimming. To compensate for this, + free() will, with a period of MAX_RELEASE_CHECK_RATE (or the + current number of segments, if greater) try to release unused + segments to the OS when freeing chunks that result in + consolidation. The best value for this parameter is a compromise + between slowing down frees with relatively costly checks that + rarely trigger versus holding on to unused memory. To effectively + disable, set to MAX_SIZE_T. This may lead to a very slight speed + improvement at the expense of carrying around more memory. +*/ + +/* Version identifier to allow people to support multiple versions */ +#ifndef DLMALLOC_VERSION +#define DLMALLOC_VERSION 20806 +#endif /* DLMALLOC_VERSION */ + +#ifndef DLMALLOC_EXPORT +#define DLMALLOC_EXPORT extern +#endif + +#ifndef _TLIBC_ +#define _TLIBC_ +#endif + +#ifdef _TLIBC_ /* tlibc configurations */ +#define HAVE_MMAP 0 +#define HAVE_MREMAP 0 +#define HAVE_MORECORE 1 +#define MMAP_CLEARS 0 +#define MALLOC_ALIGNMENT ((size_t)8U) +#define LACKS_TIME_H +#define LACKS_SYS_PARAM_H +#define LACKS_SYS_MMAN_H +#define LACKS_STRINGS_H +#define LACKS_SCHED_H +#ifdef _MSC_VER +typedef unsigned long DWORD; +typedef int LONG; +#endif +#define USE_LOCKS 1 +#define USE_SPIN_LOCKS 1 +#define FOOTERS 1 +#define REALLOC_ZERO_BYTES_FREES 1 +#include "sgx_trts.h" /* sgx_read_rand */ +#include "sgx_error.h" /* SGX_SUCCESS */ +#endif /* _TLIBC_ */ + +#ifndef WIN32 +#ifdef _WIN32 +#define WIN32 1 +#endif /* _WIN32 */ +#ifdef _WIN32_WCE +#define LACKS_FCNTL_H +#define WIN32 1 +#endif /* _WIN32_WCE */ +#endif /* WIN32 */ +#if defined(WIN32) && !defined(_TLIBC_) +#define WIN32_LEAN_AND_MEAN +#include +#include +#define HAVE_MMAP 1 +#define HAVE_MORECORE 0 +#define LACKS_UNISTD_H +#define LACKS_SYS_PARAM_H +#define LACKS_SYS_MMAN_H +#define LACKS_STRING_H +#define LACKS_STRINGS_H +#define LACKS_SYS_TYPES_H +#define LACKS_ERRNO_H +#define LACKS_SCHED_H +#ifndef MALLOC_FAILURE_ACTION +#define MALLOC_FAILURE_ACTION +#endif /* MALLOC_FAILURE_ACTION */ +#ifndef MMAP_CLEARS +#ifdef _WIN32_WCE /* WINCE reportedly does not clear */ +#define MMAP_CLEARS 0 +#else +#define MMAP_CLEARS 1 +#endif /* _WIN32_WCE */ +#endif /*MMAP_CLEARS */ +#endif /* WIN32 && !_TLIBC_*/ + +#if defined(DARWIN) || defined(_DARWIN) +/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ +#ifndef HAVE_MORECORE +#define HAVE_MORECORE 0 +#define HAVE_MMAP 1 +/* OSX allocators provide 16 byte alignment */ +#ifndef MALLOC_ALIGNMENT +#define MALLOC_ALIGNMENT ((size_t)16U) +#endif +#endif /* HAVE_MORECORE */ +#endif /* DARWIN */ + +#ifndef LACKS_SYS_TYPES_H +#include /* For size_t */ +#endif /* LACKS_SYS_TYPES_H */ + +/* The maximum possible size_t value has all bits set */ +#define MAX_SIZE_T (~(size_t)0) + +#ifndef USE_LOCKS /* ensure true if spin or recursive locks set */ +#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \ + (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)) +#endif /* USE_LOCKS */ + +#if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */ +#if ((defined(__GNUC__) && \ + ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) || \ + defined(__i386__) || defined(__x86_64__))) || \ + (defined(_MSC_VER) && _MSC_VER>=1310)) +#ifndef USE_SPIN_LOCKS +#define USE_SPIN_LOCKS 1 +#endif /* USE_SPIN_LOCKS */ +#elif USE_SPIN_LOCKS +#error "USE_SPIN_LOCKS defined without implementation" +#endif /* ... locks available... */ +#elif !defined(USE_SPIN_LOCKS) +#define USE_SPIN_LOCKS 0 +#endif /* USE_LOCKS */ + +#ifndef ONLY_MSPACES +#define ONLY_MSPACES 0 +#endif /* ONLY_MSPACES */ +#ifndef MSPACES +#if ONLY_MSPACES +#define MSPACES 1 +#else /* ONLY_MSPACES */ +#define MSPACES 0 +#endif /* ONLY_MSPACES */ +#endif /* MSPACES */ +#ifndef MALLOC_ALIGNMENT +#define MALLOC_ALIGNMENT ((size_t)(2 * sizeof(void *))) +#endif /* MALLOC_ALIGNMENT */ +#ifndef FOOTERS +#define FOOTERS 0 +#endif /* FOOTERS */ +#ifndef ABORT +#define ABORT abort() +#endif /* ABORT */ +#ifndef ABORT_ON_ASSERT_FAILURE +#define ABORT_ON_ASSERT_FAILURE 1 +#endif /* ABORT_ON_ASSERT_FAILURE */ +#ifndef PROCEED_ON_ERROR +#define PROCEED_ON_ERROR 0 +#endif /* PROCEED_ON_ERROR */ + +#ifndef INSECURE +#define INSECURE 0 +#endif /* INSECURE */ +#ifndef MALLOC_INSPECT_ALL +#define MALLOC_INSPECT_ALL 0 +#endif /* MALLOC_INSPECT_ALL */ +#ifndef HAVE_MMAP +#define HAVE_MMAP 1 +#endif /* HAVE_MMAP */ +#ifndef MMAP_CLEARS +#define MMAP_CLEARS 1 +#endif /* MMAP_CLEARS */ +#ifndef HAVE_MREMAP +#ifdef linux +#define HAVE_MREMAP 1 +#define _GNU_SOURCE /* Turns on mremap() definition */ +#else /* linux */ +#define HAVE_MREMAP 0 +#endif /* linux */ +#endif /* HAVE_MREMAP */ +#ifndef MALLOC_FAILURE_ACTION +#define MALLOC_FAILURE_ACTION errno = ENOMEM; +#endif /* MALLOC_FAILURE_ACTION */ +#ifndef HAVE_MORECORE +#if ONLY_MSPACES +#define HAVE_MORECORE 0 +#else /* ONLY_MSPACES */ +#define HAVE_MORECORE 1 +#endif /* ONLY_MSPACES */ +#endif /* HAVE_MORECORE */ +#if !HAVE_MORECORE +#define MORECORE_CONTIGUOUS 0 +#else /* !HAVE_MORECORE */ +#define MORECORE_DEFAULT sbrk +#ifndef MORECORE_CONTIGUOUS +#define MORECORE_CONTIGUOUS 1 +#endif /* MORECORE_CONTIGUOUS */ +#endif /* HAVE_MORECORE */ +#ifndef DEFAULT_GRANULARITY +#if (MORECORE_CONTIGUOUS || defined(WIN32)) +#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ +#else /* MORECORE_CONTIGUOUS */ +#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) +#endif /* MORECORE_CONTIGUOUS */ +#endif /* DEFAULT_GRANULARITY */ +#ifndef DEFAULT_TRIM_THRESHOLD +#ifndef MORECORE_CANNOT_TRIM +#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) +#else /* MORECORE_CANNOT_TRIM */ +#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T +#endif /* MORECORE_CANNOT_TRIM */ +#endif /* DEFAULT_TRIM_THRESHOLD */ +#ifndef DEFAULT_MMAP_THRESHOLD +#if HAVE_MMAP +#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) +#else /* HAVE_MMAP */ +#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T +#endif /* HAVE_MMAP */ +#endif /* DEFAULT_MMAP_THRESHOLD */ +#ifndef MAX_RELEASE_CHECK_RATE +#if HAVE_MMAP +#define MAX_RELEASE_CHECK_RATE 4095 +#else +#define MAX_RELEASE_CHECK_RATE MAX_SIZE_T +#endif /* HAVE_MMAP */ +#endif /* MAX_RELEASE_CHECK_RATE */ +#ifndef USE_BUILTIN_FFS +#define USE_BUILTIN_FFS 0 +#endif /* USE_BUILTIN_FFS */ +#ifndef USE_DEV_RANDOM +#define USE_DEV_RANDOM 0 +#endif /* USE_DEV_RANDOM */ +#ifndef NO_MALLINFO +#define NO_MALLINFO 0 +#endif /* NO_MALLINFO */ +#ifndef MALLINFO_FIELD_TYPE +#define MALLINFO_FIELD_TYPE size_t +#endif /* MALLINFO_FIELD_TYPE */ +#ifndef NO_MALLOC_STATS +#define NO_MALLOC_STATS 0 +#endif /* NO_MALLOC_STATS */ +#ifndef NO_SEGMENT_TRAVERSAL +#define NO_SEGMENT_TRAVERSAL 0 +#endif /* NO_SEGMENT_TRAVERSAL */ + +/* + mallopt tuning options. SVID/XPG defines four standard parameter + numbers for mallopt, normally defined in malloc.h. None of these + are used in this malloc, so setting them has no effect. But this + malloc does support the following options. +*/ + +#define M_TRIM_THRESHOLD (-1) +#define M_GRANULARITY (-2) +#define M_MMAP_THRESHOLD (-3) + +/* ------------------------ Mallinfo declarations ------------------------ */ + +#if !NO_MALLINFO +/* + This version of malloc supports the standard SVID/XPG mallinfo + routine that returns a struct containing usage properties and + statistics. It should work on any system that has a + /usr/include/malloc.h defining struct mallinfo. The main + declaration needed is the mallinfo struct that is returned (by-copy) + by mallinfo(). The malloinfo struct contains a bunch of fields that + are not even meaningful in this version of malloc. These fields are + are instead filled by mallinfo() with other numbers that might be of + interest. + + HAVE_USR_INCLUDE_MALLOC_H should be set if you have a + /usr/include/malloc.h file that includes a declaration of struct + mallinfo. If so, it is included; else a compliant version is + declared below. These must be precisely the same for mallinfo() to + work. The original SVID version of this struct, defined on most + systems with mallinfo, declares all fields as ints. But some others + define as unsigned long. If your system defines the fields using a + type of different width than listed here, you MUST #include your + system version and #define HAVE_USR_INCLUDE_MALLOC_H. +*/ + +/* #define HAVE_USR_INCLUDE_MALLOC_H */ + +#ifdef HAVE_USR_INCLUDE_MALLOC_H +#include "/usr/include/malloc.h" +#else /* HAVE_USR_INCLUDE_MALLOC_H */ +#ifndef STRUCT_MALLINFO_DECLARED +/* HP-UX (and others?) redefines mallinfo unless _STRUCT_MALLINFO is defined */ +#define _STRUCT_MALLINFO +#define STRUCT_MALLINFO_DECLARED 1 +struct mallinfo { + MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ + MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ + MALLINFO_FIELD_TYPE smblks; /* always 0 */ + MALLINFO_FIELD_TYPE hblks; /* always 0 */ + MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ + MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ + MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ + MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ + MALLINFO_FIELD_TYPE fordblks; /* total free space */ + MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ +}; +#endif /* STRUCT_MALLINFO_DECLARED */ +#endif /* HAVE_USR_INCLUDE_MALLOC_H */ +#endif /* NO_MALLINFO */ + +/* + Try to persuade compilers to inline. The most critical functions for + inlining are defined as macros, so these aren't used for them. +*/ + +#ifndef FORCEINLINE + #if defined(__GNUC__) +#define FORCEINLINE __inline __attribute__ ((always_inline)) + #elif defined(_MSC_VER) + #define FORCEINLINE __forceinline + #endif +#endif +#ifndef NOINLINE + #if defined(__GNUC__) + #define NOINLINE __attribute__ ((noinline)) + #elif defined(_MSC_VER) + #define NOINLINE __declspec(noinline) + #else + #define NOINLINE + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#ifndef FORCEINLINE + #define FORCEINLINE inline +#endif +#endif /* __cplusplus */ +#ifndef FORCEINLINE + #define FORCEINLINE +#endif + +#if !ONLY_MSPACES + +/* ------------------- Declarations of public routines ------------------- */ + +#ifndef USE_DL_PREFIX +#define dlcalloc calloc +#define dlfree free +#define dlmalloc malloc +#define dlmemalign memalign +#define dlrealloc realloc +#define dlmallinfo mallinfo +#ifdef USE_MALLOC_DEPRECATED +#define dlposix_memalign posix_memalign +#define dlrealloc_in_place realloc_in_place +#define dlvalloc valloc +#define dlpvalloc pvalloc +#define dlmallopt mallopt +#define dlmalloc_trim malloc_trim +#define dlmalloc_stats malloc_stats +#define dlmalloc_usable_size malloc_usable_size +#define dlmalloc_footprint malloc_footprint +#define dlmalloc_max_footprint malloc_max_footprint +#define dlmalloc_footprint_limit malloc_footprint_limit +#define dlmalloc_set_footprint_limit malloc_set_footprint_limit +#define dlmalloc_inspect_all malloc_inspect_all +#define dlindependent_calloc independent_calloc +#define dlindependent_comalloc independent_comalloc +#define dlbulk_free bulk_free +#endif /* USE_MALLOC_DEPRECATED */ +#endif /* USE_DL_PREFIX */ + +/* + malloc(size_t n) + Returns a pointer to a newly allocated chunk of at least n bytes, or + null if no space is available, in which case errno is set to ENOMEM + on ANSI C systems. + + If n is zero, malloc returns a minimum-sized chunk. (The minimum + size is 16 bytes on most 32bit systems, and 32 bytes on 64bit + systems.) Note that size_t is an unsigned type, so calls with + arguments that would be negative if signed are interpreted as + requests for huge amounts of space, which will often fail. The + maximum supported value of n differs across systems, but is in all + cases less than the maximum representable value of a size_t. +*/ +DLMALLOC_EXPORT void* dlmalloc(size_t); + +/* + free(void* p) + Releases the chunk of memory pointed to by p, that had been previously + allocated using malloc or a related routine such as realloc. + It has no effect if p is null. If p was not malloced or already + freed, free(p) will by default cause the current program to abort. +*/ +DLMALLOC_EXPORT void dlfree(void*); + +/* + calloc(size_t n_elements, size_t element_size); + Returns a pointer to n_elements * element_size bytes, with all locations + set to zero. +*/ +DLMALLOC_EXPORT void* dlcalloc(size_t, size_t); + +/* + realloc(void* p, size_t n) + Returns a pointer to a chunk of size n that contains the same data + as does chunk p up to the minimum of (n, p's size) bytes, or null + if no space is available. + + The returned pointer may or may not be the same as p. The algorithm + prefers extending p in most cases when possible, otherwise it + employs the equivalent of a malloc-copy-free sequence. + + If p is null, realloc is equivalent to malloc. + + If space is not available, realloc returns null, errno is set (if on + ANSI) and p is NOT freed. + + if n is for fewer bytes than already held by p, the newly unused + space is lopped off and freed if possible. realloc with a size + argument of zero (re)allocates a minimum-sized chunk. + + The old unix realloc convention of allowing the last-free'd chunk + to be used as an argument to realloc is not supported. +*/ +DLMALLOC_EXPORT void* dlrealloc(void*, size_t); + +#ifdef USE_MALLOC_DEPRECATED +/* + realloc_in_place(void* p, size_t n) + Resizes the space allocated for p to size n, only if this can be + done without moving p (i.e., only if there is adjacent space + available if n is greater than p's current allocated size, or n is + less than or equal to p's size). This may be used instead of plain + realloc if an alternative allocation strategy is needed upon failure + to expand space; for example, reallocation of a buffer that must be + memory-aligned or cleared. You can use realloc_in_place to trigger + these alternatives only when needed. + + Returns p if successful; otherwise null. +*/ +DLMALLOC_EXPORT void* dlrealloc_in_place(void*, size_t); +#endif + +/* + memalign(size_t alignment, size_t n); + Returns a pointer to a newly allocated chunk of n bytes, aligned + in accord with the alignment argument. + + The alignment argument should be a power of two. If the argument is + not a power of two, the nearest greater power is used. + 8-byte alignment is guaranteed by normal malloc calls, so don't + bother calling memalign with an argument of 8 or less. + + Overreliance on memalign is a sure way to fragment space. +*/ +DLMALLOC_EXPORT void* dlmemalign(size_t, size_t); + +#ifdef USE_MALLOC_DEPRECATED +/* + int posix_memalign(void** pp, size_t alignment, size_t n); + Allocates a chunk of n bytes, aligned in accord with the alignment + argument. Differs from memalign only in that it (1) assigns the + allocated memory to *pp rather than returning it, (2) fails and + returns EINVAL if the alignment is not a power of two (3) fails and + returns ENOMEM if memory cannot be allocated. +*/ +DLMALLOC_EXPORT int dlposix_memalign(void**, size_t, size_t); + +/* + valloc(size_t n); + Equivalent to memalign(pagesize, n), where pagesize is the page + size of the system. If the pagesize is unknown, 4096 is used. +*/ +DLMALLOC_EXPORT void* dlvalloc(size_t); + +/* + mallopt(int parameter_number, int parameter_value) + Sets tunable parameters The format is to provide a + (parameter-number, parameter-value) pair. mallopt then sets the + corresponding parameter to the argument value if it can (i.e., so + long as the value is meaningful), and returns 1 if successful else + 0. To workaround the fact that mallopt is specified to use int, + not size_t parameters, the value -1 is specially treated as the + maximum unsigned size_t value. + + SVID/XPG/ANSI defines four standard param numbers for mallopt, + normally defined in malloc.h. None of these are use in this malloc, + so setting them has no effect. But this malloc also supports other + options in mallopt. See below for details. Briefly, supported + parameters are as follows (listed defaults are for "typical" + configurations). + + Symbol param # default allowed param values + M_TRIM_THRESHOLD -1 2*1024*1024 any (-1 disables) + M_GRANULARITY -2 page size any power of 2 >= page size + M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) +*/ +DLMALLOC_EXPORT int dlmallopt(int, int); + +/* + malloc_footprint(); + Returns the number of bytes obtained from the system. The total + number of bytes allocated by malloc, realloc etc., is less than this + value. Unlike mallinfo, this function returns only a precomputed + result, so can be called frequently to monitor memory consumption. + Even if locks are otherwise defined, this function does not use them, + so results might not be up to date. +*/ +DLMALLOC_EXPORT size_t dlmalloc_footprint(void); + +/* + malloc_max_footprint(); + Returns the maximum number of bytes obtained from the system. This + value will be greater than current footprint if deallocated space + has been reclaimed by the system. The peak number of bytes allocated + by malloc, realloc etc., is less than this value. Unlike mallinfo, + this function returns only a precomputed result, so can be called + frequently to monitor memory consumption. Even if locks are + otherwise defined, this function does not use them, so results might + not be up to date. +*/ +DLMALLOC_EXPORT size_t dlmalloc_max_footprint(void); + +/* + malloc_footprint_limit(); + Returns the number of bytes that the heap is allowed to obtain from + the system, returning the last value returned by + malloc_set_footprint_limit, or the maximum size_t value if + never set. The returned value reflects a permission. There is no + guarantee that this number of bytes can actually be obtained from + the system. +*/ +DLMALLOC_EXPORT size_t dlmalloc_footprint_limit(); + +/* + malloc_set_footprint_limit(); + Sets the maximum number of bytes to obtain from the system, causing + failure returns from malloc and related functions upon attempts to + exceed this value. The argument value may be subject to page + rounding to an enforceable limit; this actual value is returned. + Using an argument of the maximum possible size_t effectively + disables checks. If the argument is less than or equal to the + current malloc_footprint, then all future allocations that require + additional system memory will fail. However, invocation cannot + retroactively deallocate existing used memory. +*/ +DLMALLOC_EXPORT size_t dlmalloc_set_footprint_limit(size_t bytes); + +#if MALLOC_INSPECT_ALL +/* + malloc_inspect_all(void(*handler)(void *start, + void *end, + size_t used_bytes, + void* callback_arg), + void* arg); + Traverses the heap and calls the given handler for each managed + region, skipping all bytes that are (or may be) used for bookkeeping + purposes. Traversal does not include include chunks that have been + directly memory mapped. Each reported region begins at the start + address, and continues up to but not including the end address. The + first used_bytes of the region contain allocated data. If + used_bytes is zero, the region is unallocated. The handler is + invoked with the given callback argument. If locks are defined, they + are held during the entire traversal. It is a bad idea to invoke + other malloc functions from within the handler. + + For example, to count the number of in-use chunks with size greater + than 1000, you could write: + static int count = 0; + void count_chunks(void* start, void* end, size_t used, void* arg) { + if (used >= 1000) ++count; + } + then: + malloc_inspect_all(count_chunks, NULL); + + malloc_inspect_all is compiled only if MALLOC_INSPECT_ALL is defined. +*/ +DLMALLOC_EXPORT void dlmalloc_inspect_all(void(*handler)(void*, void *, size_t, void*), + void* arg); + +#endif /* MALLOC_INSPECT_ALL */ + +#endif /* USE_MALLOC_DEPRECATED */ + +#if !NO_MALLINFO +/* + mallinfo() + Returns (by copy) a struct containing various summary statistics: + + arena: current total non-mmapped bytes allocated from system + ordblks: the number of free chunks + smblks: always zero. + hblks: current number of mmapped regions + hblkhd: total bytes held in mmapped regions + usmblks: the maximum total allocated space. This will be greater + than current total if trimming has occurred. + fsmblks: always zero + uordblks: current total allocated space (normal or mmapped) + fordblks: total free space + keepcost: the maximum number of bytes that could ideally be released + back to system via malloc_trim. ("ideally" means that + it ignores page restrictions etc.) + + Because these fields are ints, but internal bookkeeping may + be kept as longs, the reported values may wrap around zero and + thus be inaccurate. +*/ +DLMALLOC_EXPORT struct mallinfo dlmallinfo(void); +#endif /* NO_MALLINFO */ + +#ifdef USE_MALLOC_DEPRECATED +/* + independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); + + independent_calloc is similar to calloc, but instead of returning a + single cleared space, it returns an array of pointers to n_elements + independent elements that can hold contents of size elem_size, each + of which starts out cleared, and can be independently freed, + realloc'ed etc. The elements are guaranteed to be adjacently + allocated (this is not guaranteed to occur with multiple callocs or + mallocs), which may also improve cache locality in some + applications. + + The "chunks" argument is optional (i.e., may be null, which is + probably the most typical usage). If it is null, the returned array + is itself dynamically allocated and should also be freed when it is + no longer needed. Otherwise, the chunks array must be of at least + n_elements in length. It is filled in with the pointers to the + chunks. + + In either case, independent_calloc returns this pointer array, or + null if the allocation failed. If n_elements is zero and "chunks" + is null, it returns a chunk representing an array with zero elements + (which should be freed if not wanted). + + Each element must be freed when it is no longer needed. This can be + done all at once using bulk_free. + + independent_calloc simplifies and speeds up implementations of many + kinds of pools. It may also be useful when constructing large data + structures that initially have a fixed number of fixed-sized nodes, + but the number is not known at compile time, and some of the nodes + may later need to be freed. For example: + + struct Node { int item; struct Node* next; }; + + struct Node* build_list() { + struct Node** pool; + int n = read_number_of_nodes_needed(); + if (n <= 0) return 0; + pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); + if (pool == 0) die(); + // organize into a linked list... + struct Node* first = pool[0]; + for (i = 0; i < n-1; ++i) + pool[i]->next = pool[i+1]; + free(pool); // Can now free the array (or not, if it is needed later) + return first; + } +*/ +DLMALLOC_EXPORT void** dlindependent_calloc(size_t, size_t, void**); + +/* + independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); + + independent_comalloc allocates, all at once, a set of n_elements + chunks with sizes indicated in the "sizes" array. It returns + an array of pointers to these elements, each of which can be + independently freed, realloc'ed etc. The elements are guaranteed to + be adjacently allocated (this is not guaranteed to occur with + multiple callocs or mallocs), which may also improve cache locality + in some applications. + + The "chunks" argument is optional (i.e., may be null). If it is null + the returned array is itself dynamically allocated and should also + be freed when it is no longer needed. Otherwise, the chunks array + must be of at least n_elements in length. It is filled in with the + pointers to the chunks. + + In either case, independent_comalloc returns this pointer array, or + null if the allocation failed. If n_elements is zero and chunks is + null, it returns a chunk representing an array with zero elements + (which should be freed if not wanted). + + Each element must be freed when it is no longer needed. This can be + done all at once using bulk_free. + + independent_comallac differs from independent_calloc in that each + element may have a different size, and also that it does not + automatically clear elements. + + independent_comalloc can be used to speed up allocation in cases + where several structs or objects must always be allocated at the + same time. For example: + + struct Head { ... } + struct Foot { ... } + + void send_message(char* msg) { + int msglen = strlen(msg); + size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; + void* chunks[3]; + if (independent_comalloc(3, sizes, chunks) == 0) + die(); + struct Head* head = (struct Head*)(chunks[0]); + char* body = (char*)(chunks[1]); + struct Foot* foot = (struct Foot*)(chunks[2]); + // ... + } + + In general though, independent_comalloc is worth using only for + larger values of n_elements. For small values, you probably won't + detect enough difference from series of malloc calls to bother. + + Overuse of independent_comalloc can increase overall memory usage, + since it cannot reuse existing noncontiguous small chunks that + might be available for some of the elements. +*/ +DLMALLOC_EXPORT void** dlindependent_comalloc(size_t, size_t*, void**); + +/* + bulk_free(void* array[], size_t n_elements) + Frees and clears (sets to null) each non-null pointer in the given + array. This is likely to be faster than freeing them one-by-one. + If footers are used, pointers that have been allocated in different + mspaces are not freed or cleared, and the count of all such pointers + is returned. For large arrays of pointers with poor locality, it + may be worthwhile to sort this array before calling bulk_free. +*/ +DLMALLOC_EXPORT size_t dlbulk_free(void**, size_t n_elements); + +/* + pvalloc(size_t n); + Equivalent to valloc(minimum-page-that-holds(n)), that is, + round up n to nearest pagesize. + */ +DLMALLOC_EXPORT void* dlpvalloc(size_t); + +/* + malloc_trim(size_t pad); + + If possible, gives memory back to the system (via negative arguments + to sbrk) if there is unused memory at the `high' end of the malloc + pool or in unused MMAP segments. You can call this after freeing + large blocks of memory to potentially reduce the system-level memory + requirements of a program. However, it cannot guarantee to reduce + memory. Under some allocation patterns, some large free blocks of + memory will be locked between two used chunks, so they cannot be + given back to the system. + + The `pad' argument to malloc_trim represents the amount of free + trailing space to leave untrimmed. If this argument is zero, only + the minimum amount of memory to maintain internal data structures + will be left. Non-zero arguments can be supplied to maintain enough + trailing space to service future expected allocations without having + to re-obtain memory from the system. + + Malloc_trim returns 1 if it actually released any memory, else 0. +*/ +DLMALLOC_EXPORT int dlmalloc_trim(size_t); + +/* + malloc_stats(); + Prints on stderr the amount of space obtained from the system (both + via sbrk and mmap), the maximum amount (which may be more than + current if malloc_trim and/or munmap got called), and the current + number of bytes allocated via malloc (or realloc, etc) but not yet + freed. Note that this is the number of bytes allocated, not the + number requested. It will be larger than the number requested + because of alignment and bookkeeping overhead. Because it includes + alignment wastage as being in use, this figure may be greater than + zero even when no user-level chunks are allocated. + + The reported current and maximum system memory can be inaccurate if + a program makes other calls to system memory allocation functions + (normally sbrk) outside of malloc. + + malloc_stats prints only the most commonly interesting statistics. + More information can be obtained by calling mallinfo. +*/ +DLMALLOC_EXPORT void dlmalloc_stats(void); + +/* + malloc_usable_size(void* p); + + Returns the number of bytes you can actually use in + an allocated chunk, which may be more than you requested (although + often not) due to alignment and minimum size constraints. + You can use this many bytes without worrying about + overwriting other allocated objects. This is not a particularly great + programming practice. malloc_usable_size can be more useful in + debugging and assertions, for example: + + p = malloc(n); + assert(malloc_usable_size(p) >= 256); +*/ +size_t dlmalloc_usable_size(void*); + +#endif /* USE_MALLOC_DEPRECATED */ + +#endif /* ONLY_MSPACES */ + +#if MSPACES + +/* + mspace is an opaque type representing an independent + region of space that supports mspace_malloc, etc. +*/ +typedef void* mspace; + +/* + create_mspace creates and returns a new independent space with the + given initial capacity, or, if 0, the default granularity size. It + returns null if there is no system memory available to create the + space. If argument locked is non-zero, the space uses a separate + lock to control access. The capacity of the space will grow + dynamically as needed to service mspace_malloc requests. You can + control the sizes of incremental increases of this space by + compiling with a different DEFAULT_GRANULARITY or dynamically + setting with mallopt(M_GRANULARITY, value). +*/ +DLMALLOC_EXPORT mspace create_mspace(size_t capacity, int locked); + +/* + destroy_mspace destroys the given space, and attempts to return all + of its memory back to the system, returning the total number of + bytes freed. After destruction, the results of access to all memory + used by the space become undefined. +*/ +DLMALLOC_EXPORT size_t destroy_mspace(mspace msp); + +/* + create_mspace_with_base uses the memory supplied as the initial base + of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this + space is used for bookkeeping, so the capacity must be at least this + large. (Otherwise 0 is returned.) When this initial space is + exhausted, additional memory will be obtained from the system. + Destroying this space will deallocate all additionally allocated + space (if possible) but not the initial base. +*/ +DLMALLOC_EXPORT mspace create_mspace_with_base(void* base, size_t capacity, int locked); + +/* + mspace_track_large_chunks controls whether requests for large chunks + are allocated in their own untracked mmapped regions, separate from + others in this mspace. By default large chunks are not tracked, + which reduces fragmentation. However, such chunks are not + necessarily released to the system upon destroy_mspace. Enabling + tracking by setting to true may increase fragmentation, but avoids + leakage when relying on destroy_mspace to release all memory + allocated using this space. The function returns the previous + setting. +*/ +DLMALLOC_EXPORT int mspace_track_large_chunks(mspace msp, int enable); + + +/* + mspace_malloc behaves as malloc, but operates within + the given space. +*/ +DLMALLOC_EXPORT void* mspace_malloc(mspace msp, size_t bytes); + +/* + mspace_free behaves as free, but operates within + the given space. + + If compiled with FOOTERS==1, mspace_free is not actually needed. + free may be called instead of mspace_free because freed chunks from + any space are handled by their originating spaces. +*/ +DLMALLOC_EXPORT void mspace_free(mspace msp, void* mem); + +/* + mspace_realloc behaves as realloc, but operates within + the given space. + + If compiled with FOOTERS==1, mspace_realloc is not actually + needed. realloc may be called instead of mspace_realloc because + realloced chunks from any space are handled by their originating + spaces. +*/ +DLMALLOC_EXPORT void* mspace_realloc(mspace msp, void* mem, size_t newsize); + +/* + mspace_calloc behaves as calloc, but operates within + the given space. +*/ +DLMALLOC_EXPORT void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); + +/* + mspace_memalign behaves as memalign, but operates within + the given space. +*/ +DLMALLOC_EXPORT void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); + +/* + mspace_independent_calloc behaves as independent_calloc, but + operates within the given space. +*/ +DLMALLOC_EXPORT void** mspace_independent_calloc(mspace msp, size_t n_elements, + size_t elem_size, void* chunks[]); + +/* + mspace_independent_comalloc behaves as independent_comalloc, but + operates within the given space. +*/ +DLMALLOC_EXPORT void** mspace_independent_comalloc(mspace msp, size_t n_elements, + size_t sizes[], void* chunks[]); + +/* + mspace_footprint() returns the number of bytes obtained from the + system for this space. +*/ +DLMALLOC_EXPORT size_t mspace_footprint(mspace msp); + +/* + mspace_max_footprint() returns the peak number of bytes obtained from the + system for this space. +*/ +DLMALLOC_EXPORT size_t mspace_max_footprint(mspace msp); + + +#if !NO_MALLINFO +/* + mspace_mallinfo behaves as mallinfo, but reports properties of + the given space. +*/ +DLMALLOC_EXPORT struct mallinfo mspace_mallinfo(mspace msp); +#endif /* NO_MALLINFO */ + +/* + malloc_usable_size(void* p) behaves the same as malloc_usable_size; +*/ +DLMALLOC_EXPORT size_t mspace_usable_size(const void* mem); + +/* + mspace_malloc_stats behaves as malloc_stats, but reports + properties of the given space. +*/ +DLMALLOC_EXPORT void mspace_malloc_stats(mspace msp); + +/* + mspace_trim behaves as malloc_trim, but + operates within the given space. +*/ +DLMALLOC_EXPORT int mspace_trim(mspace msp, size_t pad); + +/* + An alias for mallopt. +*/ +DLMALLOC_EXPORT int mspace_mallopt(int, int); + +#endif /* MSPACES */ + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif /* __cplusplus */ + +/* + ======================================================================== + To make a fully customizable malloc.h header file, cut everything + above this line, put into file malloc.h, edit to suit, and #include it + on the next line, as well as in programs that use this malloc. + ======================================================================== +*/ + +/* #include "malloc.h" */ + +/*------------------------------ internal #includes ---------------------- */ + +#ifdef _MSC_VER +#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ +#endif /* _MSC_VER */ +#if !NO_MALLOC_STATS +#include /* for printing in malloc_stats */ +#endif /* NO_MALLOC_STATS */ +#ifndef LACKS_ERRNO_H +#include /* for MALLOC_FAILURE_ACTION */ +#endif /* LACKS_ERRNO_H */ +#ifdef DEBUG +#if ABORT_ON_ASSERT_FAILURE +#undef assert +#define assert(x) if(!(x)) ABORT +#else /* ABORT_ON_ASSERT_FAILURE */ +#include +#endif /* ABORT_ON_ASSERT_FAILURE */ +#else /* DEBUG */ +#ifndef assert +#define assert(x) +#endif +#define DEBUG 0 +#endif /* DEBUG */ +#if !defined(WIN32) && !defined(LACKS_TIME_H) +#include /* for magic initialization */ +#endif /* WIN32 */ +#ifndef LACKS_STDLIB_H +#include /* for abort() */ +#endif /* LACKS_STDLIB_H */ +#ifndef LACKS_STRING_H +#include /* for memset etc */ +#endif /* LACKS_STRING_H */ +#if USE_BUILTIN_FFS +#ifndef LACKS_STRINGS_H +#include /* for ffs */ +#endif /* LACKS_STRINGS_H */ +#endif /* USE_BUILTIN_FFS */ +#if HAVE_MMAP +#ifndef LACKS_SYS_MMAN_H +/* On some versions of linux, mremap decl in mman.h needs __USE_GNU set */ +#if (defined(linux) && !defined(__USE_GNU)) +#define __USE_GNU 1 +#include /* for mmap */ +#undef __USE_GNU +#else +#include /* for mmap */ +#endif /* linux */ +#endif /* LACKS_SYS_MMAN_H */ +#ifndef LACKS_FCNTL_H +#include +#endif /* LACKS_FCNTL_H */ +#endif /* HAVE_MMAP */ +#ifndef LACKS_UNISTD_H +#include /* for sbrk, sysconf */ +#else /* LACKS_UNISTD_H */ +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) +extern void* sbrk(ptrdiff_t); +#endif /* FreeBSD etc */ +#endif /* LACKS_UNISTD_H */ + +/* Declarations for locking */ +#if USE_LOCKS +#ifndef WIN32 +#if defined (__SVR4) && defined (__sun) /* solaris */ +#include +#elif !defined(LACKS_SCHED_H) +#include +#endif /* solaris or LACKS_SCHED_H */ +#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) || !USE_SPIN_LOCKS +#include +#endif /* USE_RECURSIVE_LOCKS ... */ +#elif defined(_MSC_VER) +#ifndef _M_AMD64 +/* These are already defined on AMD64 builds */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +LONG __cdecl _InterlockedCompareExchange(LONG volatile *Dest, LONG Exchange, LONG Comp); +LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* _M_AMD64 */ +#ifndef __ICL +#pragma intrinsic (_InterlockedCompareExchange) +#pragma intrinsic (_InterlockedExchange) +#endif /* __ICL */ +#define interlockedcompareexchange _InterlockedCompareExchange +#define interlockedexchange _InterlockedExchange +#elif defined(WIN32) && defined(__GNUC__) +#define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b) +#define interlockedexchange __sync_lock_test_and_set +#endif /* Win32 */ +#else /* USE_LOCKS */ +#endif /* USE_LOCKS */ + +#ifndef LOCK_AT_FORK +#define LOCK_AT_FORK 0 +#endif + +/* Declarations for bit scanning on win32 */ +#if defined(_MSC_VER) && _MSC_VER>=1300 +#ifndef BitScanForward /* Try to avoid pulling in WinNT.h */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +unsigned char _BitScanForward(unsigned long *index, unsigned long mask); +unsigned char _BitScanReverse(unsigned long *index, unsigned long mask); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#define BitScanForward _BitScanForward +#define BitScanReverse _BitScanReverse +#ifndef __ICL +#pragma intrinsic(_BitScanForward) +#pragma intrinsic(_BitScanReverse) +#endif /* __ICL */ +#endif /* BitScanForward */ +#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */ + +#ifdef _TLIBC_ +#include "internal/arch.h" +# define malloc_getpagesize ((size_t)TCS_SIZE) +#else +#ifndef WIN32 +#ifndef malloc_getpagesize +# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ +# ifndef _SC_PAGE_SIZE +# define _SC_PAGE_SIZE _SC_PAGESIZE +# endif +# endif +# ifdef _SC_PAGE_SIZE +# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) +# else +# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) + extern size_t getpagesize(); +# define malloc_getpagesize getpagesize() +# else +# ifdef WIN32 /* use supplied emulation of getpagesize */ +# define malloc_getpagesize getpagesize() +# else +# ifndef LACKS_SYS_PARAM_H +# include +# endif +# ifdef EXEC_PAGESIZE +# define malloc_getpagesize EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define malloc_getpagesize NBPG +# else +# define malloc_getpagesize (NBPG * CLSIZE) +# endif +# else +# ifdef NBPC +# define malloc_getpagesize NBPC +# else +# ifdef PAGESIZE +# define malloc_getpagesize PAGESIZE +# else /* just guess */ +# define malloc_getpagesize ((size_t)4096U) +# endif +# endif +# endif +# endif +# endif +# endif +# endif +#endif +#endif +#endif /* _TLIBC_ */ + +/* ------------------- size_t and alignment properties -------------------- */ + +/* The byte and bit size of a size_t */ +#define SIZE_T_SIZE (sizeof(size_t)) +#define SIZE_T_BITSIZE (sizeof(size_t) << 3) + +/* Some constants coerced to size_t */ +/* Annoying but necessary to avoid errors on some platforms */ +#define SIZE_T_ZERO ((size_t)0) +#define SIZE_T_ONE ((size_t)1) +#define SIZE_T_TWO ((size_t)2) +#define SIZE_T_FOUR ((size_t)4) +#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) +#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) +#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) +#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) + +/* The bit mask value corresponding to MALLOC_ALIGNMENT */ +#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) + +/* True if address a has acceptable alignment */ +#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) + +/* the number of bytes to offset an address to align it */ +#define align_offset(A)\ + ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ + ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) + +/* -------------------------- MMAP preliminaries ------------------------- */ + +/* + If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and + checks to fail so compiler optimizer can delete code rather than + using so many "#if"s. +*/ + + +/* MORECORE and MMAP must return MFAIL on failure */ +#define MFAIL ((void*)(MAX_SIZE_T)) +#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ + +#if HAVE_MMAP + +#ifndef WIN32 +#define MUNMAP_DEFAULT(a, s) munmap((a), (s)) +#define MMAP_PROT (PROT_READ|PROT_WRITE) +#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +#define MAP_ANONYMOUS MAP_ANON +#endif /* MAP_ANON */ +#ifdef MAP_ANONYMOUS +#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) +#define MMAP_DEFAULT(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) +#else /* MAP_ANONYMOUS */ +/* + Nearly all versions of mmap support MAP_ANONYMOUS, so the following + is unlikely to be needed, but is supplied just in case. +*/ +#define MMAP_FLAGS (MAP_PRIVATE) +static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ +#define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \ + (dev_zero_fd = open("/dev/zero", O_RDWR), \ + mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ + mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) +#endif /* MAP_ANONYMOUS */ + +#define DIRECT_MMAP_DEFAULT(s) MMAP_DEFAULT(s) + +#else /* WIN32 */ + +/* Win32 MMAP via VirtualAlloc */ +static FORCEINLINE void* win32mmap(size_t size) { + void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + return (ptr != 0)? ptr: MFAIL; +} + +/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ +static FORCEINLINE void* win32direct_mmap(size_t size) { + void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, + PAGE_READWRITE); + return (ptr != 0)? ptr: MFAIL; +} + +/* This function supports releasing coalesed segments */ +static FORCEINLINE int win32munmap(void* ptr, size_t size) { + MEMORY_BASIC_INFORMATION minfo; + char* cptr = (char*)ptr; + while (size) { + if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) + return -1; + if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || + minfo.State != MEM_COMMIT || minfo.RegionSize > size) + return -1; + if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) + return -1; + cptr += minfo.RegionSize; + size -= minfo.RegionSize; + } + return 0; +} + +#define MMAP_DEFAULT(s) win32mmap(s) +#define MUNMAP_DEFAULT(a, s) win32munmap((a), (s)) +#define DIRECT_MMAP_DEFAULT(s) win32direct_mmap(s) +#endif /* WIN32 */ +#endif /* HAVE_MMAP */ + +#if HAVE_MREMAP +#ifndef WIN32 +#define MREMAP_DEFAULT(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) +#endif /* WIN32 */ +#endif /* HAVE_MREMAP */ + +/** + * Define CALL_MORECORE + */ +#if HAVE_MORECORE + #ifdef MORECORE + #define CALL_MORECORE(S) MORECORE(S) + #else /* MORECORE */ + #define CALL_MORECORE(S) MORECORE_DEFAULT(S) + #endif /* MORECORE */ +#else /* HAVE_MORECORE */ + #define CALL_MORECORE(S) MFAIL +#endif /* HAVE_MORECORE */ + +/** + * Define CALL_MMAP/CALL_MUNMAP/CALL_DIRECT_MMAP + */ +#if HAVE_MMAP + #define USE_MMAP_BIT (SIZE_T_ONE) + + #ifdef MMAP + #define CALL_MMAP(s) MMAP(s) + #else /* MMAP */ + #define CALL_MMAP(s) MMAP_DEFAULT(s) + #endif /* MMAP */ + #ifdef MUNMAP + #define CALL_MUNMAP(a, s) MUNMAP((a), (s)) + #else /* MUNMAP */ + #define CALL_MUNMAP(a, s) MUNMAP_DEFAULT((a), (s)) + #endif /* MUNMAP */ + #ifdef DIRECT_MMAP + #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s) + #else /* DIRECT_MMAP */ + #define CALL_DIRECT_MMAP(s) DIRECT_MMAP_DEFAULT(s) + #endif /* DIRECT_MMAP */ +#else /* HAVE_MMAP */ + #define USE_MMAP_BIT (SIZE_T_ZERO) + + #define MMAP(s) MFAIL + #define MUNMAP(a, s) (-1) + #define DIRECT_MMAP(s) MFAIL + #define CALL_DIRECT_MMAP(s) DIRECT_MMAP(s) + #define CALL_MMAP(s) MMAP(s) + #define CALL_MUNMAP(a, s) MUNMAP((a), (s)) +#endif /* HAVE_MMAP */ + +/** + * Define CALL_MREMAP + */ +#if HAVE_MMAP && HAVE_MREMAP + #ifdef MREMAP + #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP((addr), (osz), (nsz), (mv)) + #else /* MREMAP */ + #define CALL_MREMAP(addr, osz, nsz, mv) MREMAP_DEFAULT((addr), (osz), (nsz), (mv)) + #endif /* MREMAP */ +#else /* HAVE_MMAP && HAVE_MREMAP */ + #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL +#endif /* HAVE_MMAP && HAVE_MREMAP */ + +/* mstate bit set if continguous morecore disabled or failed */ +#define USE_NONCONTIGUOUS_BIT (4U) + +/* segment bit set in create_mspace_with_base */ +#define EXTERN_BIT (8U) + + +/* --------------------------- Lock preliminaries ------------------------ */ + +/* + When locks are defined, there is one global lock, plus + one per-mspace lock. + + The global lock_ensures that mparams.magic and other unique + mparams values are initialized only once. It also protects + sequences of calls to MORECORE. In many cases sys_alloc requires + two calls, that should not be interleaved with calls by other + threads. This does not protect against direct calls to MORECORE + by other threads not using this lock, so there is still code to + cope the best we can on interference. + + Per-mspace locks surround calls to malloc, free, etc. + By default, locks are simple non-reentrant mutexes. + + Because lock-protected regions generally have bounded times, it is + OK to use the supplied simple spinlocks. Spinlocks are likely to + improve performance for lightly contended applications, but worsen + performance under heavy contention. + + If USE_LOCKS is > 1, the definitions of lock routines here are + bypassed, in which case you will need to define the type MLOCK_T, + and at least INITIAL_LOCK, DESTROY_LOCK, ACQUIRE_LOCK, RELEASE_LOCK + and TRY_LOCK. You must also declare a + static MLOCK_T malloc_global_mutex = { initialization values };. + +*/ + +#if !USE_LOCKS +#define USE_LOCK_BIT (0U) +#define INITIAL_LOCK(l) (0) +#define DESTROY_LOCK(l) (0) +#define ACQUIRE_MALLOC_GLOBAL_LOCK() +#define RELEASE_MALLOC_GLOBAL_LOCK() + +#else +#if USE_LOCKS > 1 +/* ----------------------- User-defined locks ------------------------ */ +/* Define your own lock implementation here */ +/* #define INITIAL_LOCK(lk) ... */ +/* #define DESTROY_LOCK(lk) ... */ +/* #define ACQUIRE_LOCK(lk) ... */ +/* #define RELEASE_LOCK(lk) ... */ +/* #define TRY_LOCK(lk) ... */ +/* static MLOCK_T malloc_global_mutex = ... */ + +#elif USE_SPIN_LOCKS + +/* First, define CAS_LOCK and CLEAR_LOCK on ints */ +/* Note CAS_LOCK defined to return 0 on success */ + +#if defined(__GNUC__)&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) +#define CAS_LOCK(sl) __sync_lock_test_and_set(sl, 1) +#define CLEAR_LOCK(sl) __sync_lock_release(sl) + +#elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) +/* Custom spin locks for older gcc on x86 */ +static FORCEINLINE int x86_cas_lock(int *sl) { + int ret; + int val = 1; + int cmp = 0; + __asm__ __volatile__ ("lock; cmpxchgl %1, %2" + : "=a" (ret) + : "r" (val), "m" (*(sl)), "0"(cmp) + : "memory", "cc"); + return ret; +} + +static FORCEINLINE void x86_clear_lock(int* sl) { + assert(*sl != 0); + int prev = 0; + int ret; + __asm__ __volatile__ ("lock; xchgl %0, %1" + : "=r" (ret) + : "m" (*(sl)), "0"(prev) + : "memory"); +} + +#define CAS_LOCK(sl) x86_cas_lock(sl) +#define CLEAR_LOCK(sl) x86_clear_lock(sl) + +#else /* Win32 MSC */ +#define CAS_LOCK(sl) interlockedexchange(sl, (LONG)1) +#define CLEAR_LOCK(sl) interlockedexchange (sl, (LONG)0) + +#endif /* ... gcc spins locks ... */ + +/* How to yield for a spin lock */ +#define SPINS_PER_YIELD 63 +#if defined(_MSC_VER) && !defined(_TLIBC_) +#define SLEEP_EX_DURATION 50 /* delay for yield/sleep */ +#define SPIN_LOCK_YIELD SleepEx(SLEEP_EX_DURATION, FALSE) +#elif defined (__SVR4) && defined (__sun) /* solaris */ +#define SPIN_LOCK_YIELD thr_yield(); +#elif !defined(LACKS_SCHED_H) +#define SPIN_LOCK_YIELD sched_yield(); +#else +#define SPIN_LOCK_YIELD +#endif /* ... yield ... */ + +#if !defined(USE_RECURSIVE_LOCKS) || USE_RECURSIVE_LOCKS == 0 +/* Plain spin locks use single word (embedded in malloc_states) */ +static int spin_acquire_lock(int *sl) { + int spins = 0; + while (*(volatile int *)sl != 0 || CAS_LOCK(sl)) { + if ((++spins & SPINS_PER_YIELD) == 0) { + SPIN_LOCK_YIELD; + } + } + return 0; +} + +#define MLOCK_T int +#define TRY_LOCK(sl) !CAS_LOCK(sl) +#define RELEASE_LOCK(sl) CLEAR_LOCK(sl) +#define ACQUIRE_LOCK(sl) (CAS_LOCK(sl)? spin_acquire_lock(sl) : 0) +#define INITIAL_LOCK(sl) (*sl = 0) +#define DESTROY_LOCK(sl) (0) +static MLOCK_T malloc_global_mutex = 0; + +#else /* USE_RECURSIVE_LOCKS */ +/* types for lock owners */ +#ifdef WIN32 +#define THREAD_ID_T DWORD +#define CURRENT_THREAD GetCurrentThreadId() +#define EQ_OWNER(X,Y) ((X) == (Y)) +#else +/* + Note: the following assume that pthread_t is a type that can be + initialized to (casted) zero. If this is not the case, you will need to + somehow redefine these or not use spin locks. +*/ +#define THREAD_ID_T pthread_t +#define CURRENT_THREAD pthread_self() +#define EQ_OWNER(X,Y) pthread_equal(X, Y) +#endif + +struct malloc_recursive_lock { + int sl; + unsigned int c; + THREAD_ID_T threadid; +}; + +#define MLOCK_T struct malloc_recursive_lock +static MLOCK_T malloc_global_mutex = { 0, 0, (THREAD_ID_T)0}; + +static FORCEINLINE void recursive_release_lock(MLOCK_T *lk) { + assert(lk->sl != 0); + if (--lk->c == 0) { + CLEAR_LOCK(&lk->sl); + } +} + +static FORCEINLINE int recursive_acquire_lock(MLOCK_T *lk) { + THREAD_ID_T mythreadid = CURRENT_THREAD; + int spins = 0; + for (;;) { + if (*((volatile int *)(&lk->sl)) == 0) { + if (!CAS_LOCK(&lk->sl)) { + lk->threadid = mythreadid; + lk->c = 1; + return 0; + } + } + else if (EQ_OWNER(lk->threadid, mythreadid)) { + ++lk->c; + return 0; + } + if ((++spins & SPINS_PER_YIELD) == 0) { + SPIN_LOCK_YIELD; + } + } +} + +static FORCEINLINE int recursive_try_lock(MLOCK_T *lk) { + THREAD_ID_T mythreadid = CURRENT_THREAD; + if (*((volatile int *)(&lk->sl)) == 0) { + if (!CAS_LOCK(&lk->sl)) { + lk->threadid = mythreadid; + lk->c = 1; + return 1; + } + } + else if (EQ_OWNER(lk->threadid, mythreadid)) { + ++lk->c; + return 1; + } + return 0; +} + +#define RELEASE_LOCK(lk) recursive_release_lock(lk) +#define TRY_LOCK(lk) recursive_try_lock(lk) +#define ACQUIRE_LOCK(lk) recursive_acquire_lock(lk) +#define INITIAL_LOCK(lk) ((lk)->threadid = (THREAD_ID_T)0, (lk)->sl = 0, (lk)->c = 0) +#define DESTROY_LOCK(lk) (0) +#endif /* USE_RECURSIVE_LOCKS */ + +#elif defined(WIN32) /* Win32 critical sections */ +#define MLOCK_T CRITICAL_SECTION +#define ACQUIRE_LOCK(lk) (EnterCriticalSection(lk), 0) +#define RELEASE_LOCK(lk) LeaveCriticalSection(lk) +#define TRY_LOCK(lk) TryEnterCriticalSection(lk) +#define INITIAL_LOCK(lk) (!InitializeCriticalSectionAndSpinCount((lk), 0x80000000|4000)) +#define DESTROY_LOCK(lk) (DeleteCriticalSection(lk), 0) +#define NEED_GLOBAL_LOCK_INIT + +static MLOCK_T malloc_global_mutex; +static volatile LONG malloc_global_mutex_status; + +/* Use spin loop to initialize global lock */ +static void init_malloc_global_mutex() { + for (;;) { + long stat = malloc_global_mutex_status; + if (stat > 0) + return; + /* transition to < 0 while initializing, then to > 0) */ + if (stat == 0 && + interlockedcompareexchange(&malloc_global_mutex_status, (LONG)-1, (LONG)0) == 0) { + InitializeCriticalSection(&malloc_global_mutex); + interlockedexchange(&malloc_global_mutex_status, (LONG)1); + return; + } + SleepEx(0, FALSE); + } +} + +#else /* pthreads-based locks */ +#define MLOCK_T pthread_mutex_t +#define ACQUIRE_LOCK(lk) pthread_mutex_lock(lk) +#define RELEASE_LOCK(lk) pthread_mutex_unlock(lk) +#define TRY_LOCK(lk) (!pthread_mutex_trylock(lk)) +#define INITIAL_LOCK(lk) pthread_init_lock(lk) +#define DESTROY_LOCK(lk) pthread_mutex_destroy(lk) + +#if defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0 && defined(linux) && !defined(PTHREAD_MUTEX_RECURSIVE) +/* Cope with old-style linux recursive lock initialization by adding */ +/* skipped internal declaration from pthread.h */ +extern int pthread_mutexattr_setkind_np __P ((pthread_mutexattr_t *__attr, + int __kind)); +#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP +#define pthread_mutexattr_settype(x,y) pthread_mutexattr_setkind_np(x,y) +#endif /* USE_RECURSIVE_LOCKS ... */ + +static MLOCK_T malloc_global_mutex = PTHREAD_MUTEX_INITIALIZER; + +static int pthread_init_lock (MLOCK_T *lk) { + pthread_mutexattr_t attr; + if (pthread_mutexattr_init(&attr)) return 1; +#if defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0 + if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) return 1; +#endif + if (pthread_mutex_init(lk, &attr)) return 1; + if (pthread_mutexattr_destroy(&attr)) return 1; + return 0; +} + +#endif /* ... lock types ... */ + +/* Common code for all lock types */ +#define USE_LOCK_BIT (2U) + +#ifndef ACQUIRE_MALLOC_GLOBAL_LOCK +#define ACQUIRE_MALLOC_GLOBAL_LOCK() ACQUIRE_LOCK(&malloc_global_mutex); +#endif + +#ifndef RELEASE_MALLOC_GLOBAL_LOCK +#define RELEASE_MALLOC_GLOBAL_LOCK() RELEASE_LOCK(&malloc_global_mutex); +#endif + +#endif /* USE_LOCKS */ + +/* ----------------------- Chunk representations ------------------------ */ + +/* + (The following includes lightly edited explanations by Colin Plumb.) + + The malloc_chunk declaration below is misleading (but accurate and + necessary). It declares a "view" into memory allowing access to + necessary fields at known offsets from a given base. + + Chunks of memory are maintained using a `boundary tag' method as + originally described by Knuth. (See the paper by Paul Wilson + ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such + techniques.) Sizes of free chunks are stored both in the front of + each chunk and at the end. This makes consolidating fragmented + chunks into bigger chunks fast. The head fields also hold bits + representing whether chunks are free or in use. + + Here are some pictures to make it clearer. They are "exploded" to + show that the state of a chunk can be thought of as extending from + the high 31 bits of the head field of its header through the + prev_foot and PINUSE_BIT bit of the following chunk header. + + A chunk that's in use looks like: + + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk (if P = 0) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| + | Size of this chunk 1| +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +- -+ + | | + +- -+ + | : + +- size - sizeof(size_t) available payload bytes -+ + : | + chunk-> +- -+ + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| + | Size of next chunk (may or may not be in use) | +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + And if it's free, it looks like this: + + chunk-> +- -+ + | User payload (must be in use, or we would have merged!) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| + | Size of this chunk 0| +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next pointer | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Prev pointer | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | : + +- size - sizeof(struct chunk) unused bytes -+ + : | + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of this chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| + | Size of next chunk (must be in use, or we would have merged)| +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | : + +- User payload -+ + : | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |0| + +-+ + Note that since we always merge adjacent free chunks, the chunks + adjacent to a free chunk must be in use. + + Given a pointer to a chunk (which can be derived trivially from the + payload pointer) we can, in O(1) time, find out whether the adjacent + chunks are free, and if so, unlink them from the lists that they + are on and merge them with the current chunk. + + Chunks always begin on even word boundaries, so the mem portion + (which is returned to the user) is also on an even word boundary, and + thus at least double-word aligned. + + The P (PINUSE_BIT) bit, stored in the unused low-order bit of the + chunk size (which is always a multiple of two words), is an in-use + bit for the *previous* chunk. If that bit is *clear*, then the + word before the current chunk size contains the previous chunk + size, and can be used to find the front of the previous chunk. + The very first chunk allocated always has this bit set, preventing + access to non-existent (or non-owned) memory. If pinuse is set for + any given chunk, then you CANNOT determine the size of the + previous chunk, and might even get a memory addressing fault when + trying to do so. + + The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of + the chunk size redundantly records whether the current chunk is + inuse (unless the chunk is mmapped). This redundancy enables usage + checks within free and realloc, and reduces indirection when freeing + and consolidating chunks. + + Each freshly allocated chunk must have both cinuse and pinuse set. + That is, each allocated chunk borders either a previously allocated + and still in-use chunk, or the base of its memory arena. This is + ensured by making all allocations from the `lowest' part of any + found chunk. Further, no free chunk physically borders another one, + so each free chunk is known to be preceded and followed by either + inuse chunks or the ends of memory. + + Note that the `foot' of the current chunk is actually represented + as the prev_foot of the NEXT chunk. This makes it easier to + deal with alignments etc but can be very confusing when trying + to extend or adapt this code. + + The exceptions to all this are + + 1. The special chunk `top' is the top-most available chunk (i.e., + the one bordering the end of available memory). It is treated + specially. Top is never included in any bin, is used only if + no other chunk is available, and is released back to the + system if it is very large (see M_TRIM_THRESHOLD). In effect, + the top chunk is treated as larger (and thus less well + fitting) than any other available chunk. The top chunk + doesn't update its trailing size field since there is no next + contiguous chunk that would have to index off it. However, + space is still allocated for it (TOP_FOOT_SIZE) to enable + separation or merging when space is extended. + + 3. Chunks allocated via mmap, have both cinuse and pinuse bits + cleared in their head fields. Because they are allocated + one-by-one, each must carry its own prev_foot field, which is + also used to hold the offset this chunk has within its mmapped + region, which is needed to preserve alignment. Each mmapped + chunk is trailed by the first two fields of a fake next-chunk + for sake of usage checks. + +*/ + +struct malloc_chunk { + size_t prev_foot; /* Size of previous chunk (if free). */ + size_t head; /* Size and inuse bits. */ + struct malloc_chunk* fd; /* double links -- used only if free. */ + struct malloc_chunk* bk; +}; + +typedef struct malloc_chunk mchunk; +typedef struct malloc_chunk* mchunkptr; +typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ +typedef unsigned int bindex_t; /* Described below */ +typedef unsigned int binmap_t; /* Described below */ +typedef unsigned int flag_t; /* The type of various bit flag sets */ + +/* ------------------- Chunks sizes and alignments ----------------------- */ + +#define MCHUNK_SIZE (sizeof(mchunk)) + +#if FOOTERS +#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) +#else /* FOOTERS */ +#define CHUNK_OVERHEAD (SIZE_T_SIZE) +#endif /* FOOTERS */ + +/* MMapped chunks need a second word of overhead ... */ +#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) +/* ... and additional padding for fake next-chunk at foot */ +#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) + +/* The smallest size we can malloc is an aligned minimal chunk */ +#define MIN_CHUNK_SIZE\ + ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) + +/* conversion from malloc headers to user pointers, and back */ +#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) +#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) +/* chunk associated with aligned address A */ +#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) + +/* Bounds on request (not chunk) sizes. */ +#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) +#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) + +/* pad request bytes into a usable size */ +#define pad_request(req) \ + (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) + +/* pad request, checking for minimum (but not maximum) */ +#define request2size(req) \ + (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) + + +/* ------------------ Operations on head and foot fields ----------------- */ + +/* + The head field of a chunk is or'ed with PINUSE_BIT when previous + adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in + use, unless mmapped, in which case both bits are cleared. + + FLAG4_BIT is not used by this malloc, but might be useful in extensions. +*/ + +#define PINUSE_BIT (SIZE_T_ONE) +#define CINUSE_BIT (SIZE_T_TWO) +#define FLAG4_BIT (SIZE_T_FOUR) +#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) +#define FLAG_BITS (PINUSE_BIT|CINUSE_BIT|FLAG4_BIT) + +/* Head value for fenceposts */ +#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) + +/* extraction of fields from head words */ +#define cinuse(p) ((p)->head & CINUSE_BIT) +#define pinuse(p) ((p)->head & PINUSE_BIT) +#define flag4inuse(p) ((p)->head & FLAG4_BIT) +#define is_inuse(p) (((p)->head & INUSE_BITS) != PINUSE_BIT) +#define is_mmapped(p) (((p)->head & INUSE_BITS) == 0) + +#define chunksize(p) ((p)->head & ~(FLAG_BITS)) + +#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) +#define set_flag4(p) ((p)->head |= FLAG4_BIT) +#define clear_flag4(p) ((p)->head &= ~FLAG4_BIT) + +/* Treat space at ptr +/- offset as a chunk */ +#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) +#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) + +/* Ptr to next or previous physical malloc_chunk. */ +#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~FLAG_BITS))) +#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) + +/* extract next chunk's pinuse bit */ +#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) + +/* Get/set size at footer */ +#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) +#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) + +/* Set size, pinuse bit, and foot */ +#define set_size_and_pinuse_of_free_chunk(p, s)\ + ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) + +/* Set size, pinuse bit, foot, and clear next pinuse */ +#define set_free_with_pinuse(p, s, n)\ + (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) + +/* Get the internal overhead associated with chunk p */ +#define overhead_for(p)\ + (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) + +/* Return true if malloced space is not necessarily cleared */ +#if MMAP_CLEARS +#define calloc_must_clear(p) (!is_mmapped(p)) +#else /* MMAP_CLEARS */ +#define calloc_must_clear(p) (1) +#endif /* MMAP_CLEARS */ + +/* ---------------------- Overlaid data structures ----------------------- */ + +/* + When chunks are not in use, they are treated as nodes of either + lists or trees. + + "Small" chunks are stored in circular doubly-linked lists, and look + like this: + + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `head:' | Size of chunk, in bytes |P| + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Forward pointer to next chunk in list | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Back pointer to previous chunk in list | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Unused space (may be 0 bytes long) . + . . + . | +nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `foot:' | Size of chunk, in bytes | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Larger chunks are kept in a form of bitwise digital trees (aka + tries) keyed on chunksizes. Because malloc_tree_chunks are only for + free chunks greater than 256 bytes, their size doesn't impose any + constraints on user chunk sizes. Each node looks like: + + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `head:' | Size of chunk, in bytes |P| + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Forward pointer to next chunk of same size | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Back pointer to previous chunk of same size | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Pointer to left child (child[0]) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Pointer to right child (child[1]) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Pointer to parent | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | bin index of this chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Unused space . + . | +nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `foot:' | Size of chunk, in bytes | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Each tree holding treenodes is a tree of unique chunk sizes. Chunks + of the same size are arranged in a circularly-linked list, with only + the oldest chunk (the next to be used, in our FIFO ordering) + actually in the tree. (Tree members are distinguished by a non-null + parent pointer.) If a chunk with the same size an an existing node + is inserted, it is linked off the existing node using pointers that + work in the same way as fd/bk pointers of small chunks. + + Each tree contains a power of 2 sized range of chunk sizes (the + smallest is 0x100 <= x < 0x180), which is is divided in half at each + tree level, with the chunks in the smaller half of the range (0x100 + <= x < 0x140 for the top nose) in the left subtree and the larger + half (0x140 <= x < 0x180) in the right subtree. This is, of course, + done by inspecting individual bits. + + Using these rules, each node's left subtree contains all smaller + sizes than its right subtree. However, the node at the root of each + subtree has no particular ordering relationship to either. (The + dividing line between the subtree sizes is based on trie relation.) + If we remove the last chunk of a given size from the interior of the + tree, we need to replace it with a leaf node. The tree ordering + rules permit a node to be replaced by any leaf below it. + + The smallest chunk in a tree (a common operation in a best-fit + allocator) can be found by walking a path to the leftmost leaf in + the tree. Unlike a usual binary tree, where we follow left child + pointers until we reach a null, here we follow the right child + pointer any time the left one is null, until we reach a leaf with + both child pointers null. The smallest chunk in the tree will be + somewhere along that path. + + The worst case number of steps to add, find, or remove a node is + bounded by the number of bits differentiating chunks within + bins. Under current bin calculations, this ranges from 6 up to 21 + (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case + is of course much better. +*/ + +struct malloc_tree_chunk { + /* The first four fields must be compatible with malloc_chunk */ + size_t prev_foot; + size_t head; + struct malloc_tree_chunk* fd; + struct malloc_tree_chunk* bk; + + struct malloc_tree_chunk* child[2]; + struct malloc_tree_chunk* parent; + bindex_t index; +}; + +typedef struct malloc_tree_chunk tchunk; +typedef struct malloc_tree_chunk* tchunkptr; +typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ + +/* A little helper macro for trees */ +#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) + +/* ----------------------------- Segments -------------------------------- */ + +/* + Each malloc space may include non-contiguous segments, held in a + list headed by an embedded malloc_segment record representing the + top-most space. Segments also include flags holding properties of + the space. Large chunks that are directly allocated by mmap are not + included in this list. They are instead independently created and + destroyed without otherwise keeping track of them. + + Segment management mainly comes into play for spaces allocated by + MMAP. Any call to MMAP might or might not return memory that is + adjacent to an existing segment. MORECORE normally contiguously + extends the current space, so this space is almost always adjacent, + which is simpler and faster to deal with. (This is why MORECORE is + used preferentially to MMAP when both are available -- see + sys_alloc.) When allocating using MMAP, we don't use any of the + hinting mechanisms (inconsistently) supported in various + implementations of unix mmap, or distinguish reserving from + committing memory. Instead, we just ask for space, and exploit + contiguity when we get it. It is probably possible to do + better than this on some systems, but no general scheme seems + to be significantly better. + + Management entails a simpler variant of the consolidation scheme + used for chunks to reduce fragmentation -- new adjacent memory is + normally prepended or appended to an existing segment. However, + there are limitations compared to chunk consolidation that mostly + reflect the fact that segment processing is relatively infrequent + (occurring only when getting memory from system) and that we + don't expect to have huge numbers of segments: + + * Segments are not indexed, so traversal requires linear scans. (It + would be possible to index these, but is not worth the extra + overhead and complexity for most programs on most platforms.) + * New segments are only appended to old ones when holding top-most + memory; if they cannot be prepended to others, they are held in + different segments. + + Except for the top-most segment of an mstate, each segment record + is kept at the tail of its segment. Segments are added by pushing + segment records onto the list headed by &mstate.seg for the + containing mstate. + + Segment flags control allocation/merge/deallocation policies: + * If EXTERN_BIT set, then we did not allocate this segment, + and so should not try to deallocate or merge with others. + (This currently holds only for the initial segment passed + into create_mspace_with_base.) + * If USE_MMAP_BIT set, the segment may be merged with + other surrounding mmapped segments and trimmed/de-allocated + using munmap. + * If neither bit is set, then the segment was obtained using + MORECORE so can be merged with surrounding MORECORE'd segments + and deallocated/trimmed using MORECORE with negative arguments. +*/ + +struct malloc_segment { + char* base; /* base address */ + size_t size; /* allocated size */ + struct malloc_segment* next; /* ptr to next segment */ + flag_t sflags; /* mmap and extern flag */ +}; + +#define is_mmapped_segment(S) ((S)->sflags & USE_MMAP_BIT) +#define is_extern_segment(S) ((S)->sflags & EXTERN_BIT) + +typedef struct malloc_segment msegment; +typedef struct malloc_segment* msegmentptr; + +/* ---------------------------- malloc_state ----------------------------- */ + +/* + A malloc_state holds all of the bookkeeping for a space. + The main fields are: + + Top + The topmost chunk of the currently active segment. Its size is + cached in topsize. The actual size of topmost space is + topsize+TOP_FOOT_SIZE, which includes space reserved for adding + fenceposts and segment records if necessary when getting more + space from the system. The size at which to autotrim top is + cached from mparams in trim_check, except that it is disabled if + an autotrim fails. + + Designated victim (dv) + This is the preferred chunk for servicing small requests that + don't have exact fits. It is normally the chunk split off most + recently to service another small request. Its size is cached in + dvsize. The link fields of this chunk are not maintained since it + is not kept in a bin. + + SmallBins + An array of bin headers for free chunks. These bins hold chunks + with sizes less than MIN_LARGE_SIZE bytes. Each bin contains + chunks of all the same size, spaced 8 bytes apart. To simplify + use in double-linked lists, each bin header acts as a malloc_chunk + pointing to the real first node, if it exists (else pointing to + itself). This avoids special-casing for headers. But to avoid + waste, we allocate only the fd/bk pointers of bins, and then use + repositioning tricks to treat these as the fields of a chunk. + + TreeBins + Treebins are pointers to the roots of trees holding a range of + sizes. There are 2 equally spaced treebins for each power of two + from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything + larger. + + Bin maps + There is one bit map for small bins ("smallmap") and one for + treebins ("treemap). Each bin sets its bit when non-empty, and + clears the bit when empty. Bit operations are then used to avoid + bin-by-bin searching -- nearly all "search" is done without ever + looking at bins that won't be selected. The bit maps + conservatively use 32 bits per map word, even if on 64bit system. + For a good description of some of the bit-based techniques used + here, see Henry S. Warren Jr's book "Hacker's Delight" (and + supplement at http://hackersdelight.org/). Many of these are + intended to reduce the branchiness of paths through malloc etc, as + well as to reduce the number of memory locations read or written. + + Segments + A list of segments headed by an embedded malloc_segment record + representing the initial space. + + Address check support + The least_addr field is the least address ever obtained from + MORECORE or MMAP. Attempted frees and reallocs of any address less + than this are trapped (unless INSECURE is defined). + + Magic tag + A cross-check field that should always hold same value as mparams.magic. + + Max allowed footprint + The maximum allowed bytes to allocate from system (zero means no limit) + + Flags + Bits recording whether to use MMAP, locks, or contiguous MORECORE + + Statistics + Each space keeps track of current and maximum system memory + obtained via MORECORE or MMAP. + + Trim support + Fields holding the amount of unused topmost memory that should trigger + trimming, and a counter to force periodic scanning to release unused + non-topmost segments. + + Locking + If USE_LOCKS is defined, the "mutex" lock is acquired and released + around every public call using this mspace. + + Extension support + A void* pointer and a size_t field that can be used to help implement + extensions to this malloc. +*/ + +/* Bin types, widths and sizes */ +#define NSMALLBINS (32U) +#define NTREEBINS (32U) +#define SMALLBIN_SHIFT (3U) +#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) +#define TREEBIN_SHIFT (8U) +#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) +#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) +#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) + +struct malloc_state { + binmap_t smallmap; + binmap_t treemap; + size_t dvsize; + size_t topsize; + char* least_addr; + mchunkptr dv; + mchunkptr top; + size_t trim_check; + size_t release_checks; + size_t magic; + mchunkptr smallbins[(NSMALLBINS+1)*2]; + tbinptr treebins[NTREEBINS]; + size_t footprint; + size_t max_footprint; + size_t footprint_limit; /* zero means no limit */ + flag_t mflags; +#if USE_LOCKS + MLOCK_T mutex; /* locate lock among fields that rarely change */ +#endif /* USE_LOCKS */ + msegment seg; + void* extp; /* Unused but available for extensions */ + size_t exts; +}; + +typedef struct malloc_state* mstate; + +/* ------------- Global malloc_state and malloc_params ------------------- */ + +/* + malloc_params holds global properties, including those that can be + dynamically set using mallopt. There is a single instance, mparams, + initialized in init_mparams. Note that the non-zeroness of "magic" + also serves as an initialization flag. +*/ + +struct malloc_params { + size_t magic; + size_t page_size; + size_t granularity; + size_t mmap_threshold; + size_t trim_threshold; + flag_t default_mflags; +}; + +static struct malloc_params mparams; + +/* Ensure mparams initialized */ +#define ensure_initialization() (void)(mparams.magic != 0 || init_mparams()) + +#if !ONLY_MSPACES + +/* The global malloc_state used for all non-"mspace" calls */ +static struct malloc_state _gm_; +#define gm (&_gm_) +#define is_global(M) ((M) == &_gm_) + +#endif /* !ONLY_MSPACES */ + +#define is_initialized(M) ((M)->top != 0) + +/* -------------------------- system alloc setup ------------------------- */ + +/* Operations on mflags */ + +#define use_lock(M) ((M)->mflags & USE_LOCK_BIT) +#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) +#if USE_LOCKS +#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) +#else +#define disable_lock(M) +#endif + +#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) +#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) +#if HAVE_MMAP +#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) +#else +#define disable_mmap(M) +#endif + +#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) +#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) + +#define set_lock(M,L)\ + ((M)->mflags = (L)?\ + ((M)->mflags | USE_LOCK_BIT) :\ + ((M)->mflags & ~USE_LOCK_BIT)) + +/* page-align a size */ +#define page_align(S)\ + (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE)) + +/* granularity-align a size */ +#define granularity_align(S)\ + (((S) + (mparams.granularity - SIZE_T_ONE))\ + & ~(mparams.granularity - SIZE_T_ONE)) + + +/* For mmap, use granularity alignment on windows, else page-align */ +#ifdef WIN32 +#define mmap_align(S) granularity_align(S) +#else +#define mmap_align(S) page_align(S) +#endif + +/* For sys_alloc, enough padding to ensure can malloc request on success */ +#define SYS_ALLOC_PADDING (TOP_FOOT_SIZE + MALLOC_ALIGNMENT) + +#define is_page_aligned(S)\ + (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) +#define is_granularity_aligned(S)\ + (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) + +/* True if segment S holds address A */ +#define segment_holds(S, A)\ + ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) + +/* Return segment holding given address */ +static msegmentptr segment_holding(mstate m, char* addr) { + msegmentptr sp = &m->seg; + for (;;) { + if (addr >= sp->base && addr < sp->base + sp->size) + return sp; + if ((sp = sp->next) == 0) + return 0; + } +} + +/* Return true if segment contains a segment link */ +static int has_segment_link(mstate m, msegmentptr ss) { + msegmentptr sp = &m->seg; + for (;;) { + if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) + return 1; + if ((sp = sp->next) == 0) + return 0; + } +} + +#ifndef MORECORE_CANNOT_TRIM +#define should_trim(M,s) ((s) > (M)->trim_check) +#else /* MORECORE_CANNOT_TRIM */ +#define should_trim(M,s) (0) +#endif /* MORECORE_CANNOT_TRIM */ + +/* + TOP_FOOT_SIZE is padding at the end of a segment, including space + that may be needed to place segment records and fenceposts when new + noncontiguous segments are added. +*/ +#define TOP_FOOT_SIZE\ + (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) + + +/* ------------------------------- Hooks -------------------------------- */ + +/* + PREACTION should be defined to return 0 on success, and nonzero on + failure. If you are not using locking, you can redefine these to do + anything you like. +*/ + +#if USE_LOCKS +#define PREACTION(M) ((use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) +#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } +#else /* USE_LOCKS */ + +#ifndef PREACTION +#define PREACTION(M) (0) +#endif /* PREACTION */ + +#ifndef POSTACTION +#define POSTACTION(M) +#endif /* POSTACTION */ + +#endif /* USE_LOCKS */ + +/* + CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. + USAGE_ERROR_ACTION is triggered on detected bad frees and + reallocs. The argument p is an address that might have triggered the + fault. It is ignored by the two predefined actions, but might be + useful in custom actions that try to help diagnose errors. +*/ + +#if PROCEED_ON_ERROR + +/* A count of the number of corruption errors causing resets */ +int malloc_corruption_error_count; + +/* default corruption action */ +static void reset_on_error(mstate m); + +#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) +#define USAGE_ERROR_ACTION(m, p) + +#else /* PROCEED_ON_ERROR */ + +#ifndef CORRUPTION_ERROR_ACTION +#define CORRUPTION_ERROR_ACTION(m) ABORT +#endif /* CORRUPTION_ERROR_ACTION */ + +#ifndef USAGE_ERROR_ACTION +#define USAGE_ERROR_ACTION(m,p) ABORT +#endif /* USAGE_ERROR_ACTION */ + +#endif /* PROCEED_ON_ERROR */ + + +/* -------------------------- Debugging setup ---------------------------- */ + +#if ! DEBUG + +#define check_free_chunk(M,P) +#define check_inuse_chunk(M,P) +#define check_malloced_chunk(M,P,N) +#define check_mmapped_chunk(M,P) +#define check_malloc_state(M) +#define check_top_chunk(M,P) + +#else /* DEBUG */ +#define check_free_chunk(M,P) do_check_free_chunk(M,P) +#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) +#define check_top_chunk(M,P) do_check_top_chunk(M,P) +#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) +#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) +#define check_malloc_state(M) do_check_malloc_state(M) + +static void do_check_any_chunk(mstate m, mchunkptr p); +static void do_check_top_chunk(mstate m, mchunkptr p); +static void do_check_mmapped_chunk(mstate m, mchunkptr p); +static void do_check_inuse_chunk(mstate m, mchunkptr p); +static void do_check_free_chunk(mstate m, mchunkptr p); +static void do_check_malloced_chunk(mstate m, void* mem, size_t s); +static void do_check_tree(mstate m, tchunkptr t); +static void do_check_treebin(mstate m, bindex_t i); +static void do_check_smallbin(mstate m, bindex_t i); +static void do_check_malloc_state(mstate m); +static int bin_find(mstate m, mchunkptr x); +static size_t traverse_and_check(mstate m); +#endif /* DEBUG */ + +/* ---------------------------- Indexing Bins ---------------------------- */ + +#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) +#define small_index(s) (bindex_t)((s) >> SMALLBIN_SHIFT) +#define small_index2size(i) ((i) << SMALLBIN_SHIFT) +#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) + +/* addressing by index. See above about smallbin repositioning */ +#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) +#define treebin_at(M,i) (&((M)->treebins[i])) + +/* assign tree index for size S to variable I. Use x86 asm if possible */ +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +#define compute_tree_index(S, I)\ +{\ + unsigned int X = S >> TREEBIN_SHIFT;\ + if (X == 0)\ + I = 0;\ + else if (X > 0xFFFF)\ + I = NTREEBINS-1;\ + else {\ + unsigned int K = (unsigned) sizeof(X)*__CHAR_BIT__ - 1 - (unsigned) __builtin_clz(X); \ + I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ + }\ +} + +#elif defined (__INTEL_COMPILER) +#define compute_tree_index(S, I)\ +{\ + size_t X = S >> TREEBIN_SHIFT;\ + if (X == 0)\ + I = 0;\ + else if (X > 0xFFFF)\ + I = NTREEBINS-1;\ + else {\ + unsigned int K = _bit_scan_reverse (X); \ + I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ + }\ +} + +#elif defined(_MSC_VER) && _MSC_VER>=1300 +#define compute_tree_index(S, I)\ +{\ + size_t X = S >> TREEBIN_SHIFT;\ + if (X == 0)\ + I = 0;\ + else if (X > 0xFFFF)\ + I = NTREEBINS-1;\ + else {\ + unsigned int K;\ + _BitScanReverse((DWORD *) &K, (DWORD) X);\ + I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ + }\ +} + +#else /* GNUC */ +#define compute_tree_index(S, I)\ +{\ + size_t X = S >> TREEBIN_SHIFT;\ + if (X == 0)\ + I = 0;\ + else if (X > 0xFFFF)\ + I = NTREEBINS-1;\ + else {\ + unsigned int Y = (unsigned int)X;\ + unsigned int N = ((Y - 0x100) >> 16) & 8;\ + unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ + N += K;\ + N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ + K = 14 - N + ((Y <<= K) >> 15);\ + I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ + }\ +} +#endif /* GNUC */ + +/* Bit representing maximum resolved size in a treebin at i */ +#define bit_for_tree_index(i) \ + (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) + +/* Shift placing maximum resolved bit in a treebin at i as sign bit */ +#define leftshift_for_tree_index(i) \ + ((i == NTREEBINS-1)? 0 : \ + ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) + +/* The size of the smallest chunk held in bin with index i */ +#define minsize_for_tree_index(i) \ + ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ + (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) + + +/* ------------------------ Operations on bin maps ----------------------- */ + +/* bit corresponding to given index */ +#define idx2bit(i) ((binmap_t)(1) << (i)) + +/* Mark/Clear bits with given index */ +#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) +#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) +#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) + +#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) +#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) +#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) + +/* isolate the least set bit of a bitmap */ +#define least_bit(x) ((x) & -(x)) + +/* mask with all bits to left of least bit of x on */ +#define left_bits(x) ((x<<1) | -(x<<1)) + +/* mask with all bits to left of or equal to least bit of x on */ +#define same_or_left_bits(x) ((x) | -(x)) + +/* index corresponding to given bit. Use x86 asm if possible */ + +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +#define compute_bit2idx(X, I)\ +{\ + unsigned int J;\ + J = __builtin_ctz(X); \ + I = (bindex_t)J;\ +} + +#elif defined (__INTEL_COMPILER) +#define compute_bit2idx(X, I)\ +{\ + unsigned int J;\ + J = _bit_scan_forward (X); \ + I = (bindex_t)J;\ +} + +#elif defined(_MSC_VER) && _MSC_VER>=1300 +#define compute_bit2idx(X, I)\ +{\ + unsigned int J;\ + _BitScanForward((DWORD *) &J, X);\ + I = (bindex_t)J;\ +} + +#elif USE_BUILTIN_FFS +#define compute_bit2idx(X, I) I = ffs(X)-1 + +#else +#define compute_bit2idx(X, I)\ +{\ + unsigned int Y = X - 1;\ + unsigned int K = Y >> (16-4) & 16;\ + unsigned int N = K; Y >>= K;\ + N += K = Y >> (8-3) & 8; Y >>= K;\ + N += K = Y >> (4-2) & 4; Y >>= K;\ + N += K = Y >> (2-1) & 2; Y >>= K;\ + N += K = Y >> (1-0) & 1; Y >>= K;\ + I = (bindex_t)(N + Y);\ +} +#endif /* GNUC */ + + +/* ----------------------- Runtime Check Support ------------------------- */ + +/* + For security, the main invariant is that malloc/free/etc never + writes to a static address other than malloc_state, unless static + malloc_state itself has been corrupted, which cannot occur via + malloc (because of these checks). In essence this means that we + believe all pointers, sizes, maps etc held in malloc_state, but + check all of those linked or offsetted from other embedded data + structures. These checks are interspersed with main code in a way + that tends to minimize their run-time cost. + + When FOOTERS is defined, in addition to range checking, we also + verify footer fields of inuse chunks, which can be used guarantee + that the mstate controlling malloc/free is intact. This is a + streamlined version of the approach described by William Robertson + et al in "Run-time Detection of Heap-based Overflows" LISA'03 + http://www.usenix.org/events/lisa03/tech/robertson.html The footer + of an inuse chunk holds the xor of its mstate and a random seed, + that is checked upon calls to free() and realloc(). This is + (probabalistically) unguessable from outside the program, but can be + computed by any code successfully malloc'ing any chunk, so does not + itself provide protection against code that has already broken + security through some other means. Unlike Robertson et al, we + always dynamically check addresses of all offset chunks (previous, + next, etc). This turns out to be cheaper than relying on hashes. +*/ + +#if !INSECURE +/* Check if address a is at least as high as any from MORECORE or MMAP */ +#define ok_address(M, a) ((char*)(a) >= (M)->least_addr) +/* Check if address of next chunk n is higher than base chunk p */ +#define ok_next(p, n) ((char*)(p) < (char*)(n)) +/* Check if p has inuse status */ +#define ok_inuse(p) is_inuse(p) +/* Check if p has its pinuse bit on */ +#define ok_pinuse(p) pinuse(p) + +#else /* !INSECURE */ +#define ok_address(M, a) (1) +#define ok_next(b, n) (1) +#define ok_inuse(p) (1) +#define ok_pinuse(p) (1) +#endif /* !INSECURE */ + +#if (FOOTERS && !INSECURE) +/* Check if (alleged) mstate m has expected magic field */ +#define ok_magic(M) ((M)->magic == mparams.magic) +#else /* (FOOTERS && !INSECURE) */ +#define ok_magic(M) (1) +#endif /* (FOOTERS && !INSECURE) */ + +/* In gcc, use __builtin_expect to minimize impact of checks */ +#if !INSECURE +#if defined(__GNUC__) && __GNUC__ >= 3 +#define RTCHECK(e) __builtin_expect(e, 1) +#else /* GNUC */ +#define RTCHECK(e) (e) +#endif /* GNUC */ +#else /* !INSECURE */ +#define RTCHECK(e) (1) +#endif /* !INSECURE */ + +/* macros to set up inuse chunks with or without footers */ + +#if !FOOTERS + +#define mark_inuse_foot(M,p,s) + +/* Macros for setting head/foot of non-mmapped chunks */ + +/* Set cinuse bit and pinuse bit of next chunk */ +#define set_inuse(M,p,s)\ + ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ + ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) + +/* Set cinuse and pinuse of this chunk and pinuse of next chunk */ +#define set_inuse_and_pinuse(M,p,s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ + ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) + +/* Set size, cinuse and pinuse bit of this chunk */ +#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) + +#else /* FOOTERS */ + +/* Set foot of inuse chunk to be xor of mstate and seed */ +#define mark_inuse_foot(M,p,s)\ + (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) + +#define get_mstate_for(p)\ + ((mstate)(((mchunkptr)((char*)(p) +\ + (chunksize(p))))->prev_foot ^ mparams.magic)) + +#define set_inuse(M,p,s)\ + ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ + (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ + mark_inuse_foot(M,p,s)) + +#define set_inuse_and_pinuse(M,p,s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ + (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ + mark_inuse_foot(M,p,s)) + +#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ + mark_inuse_foot(M, p, s)) + +#endif /* !FOOTERS */ + +/* check if allocated memory falls into trusted heap range */ +#ifdef _TLIBC_ +#include "trts_util.h" +#define ok_heap_range(p, b) \ + (((p) >= get_heap_base()) && \ + ((b) <= (SIZE_MAX - (size_t)(p))) && \ + ((void *)((size_t)(p) + (b)) <= sbrk(0))) +#else +#define ok_heap_range(p, b) (1) +#endif + +/* ---------------------------- setting mparams -------------------------- */ + +#if LOCK_AT_FORK +static void pre_fork(void) { ACQUIRE_LOCK(&(gm)->mutex); } +static void post_fork_parent(void) { RELEASE_LOCK(&(gm)->mutex); } +static void post_fork_child(void) { INITIAL_LOCK(&(gm)->mutex); } +#endif /* LOCK_AT_FORK */ + +/* Initialize mparams */ +static int init_mparams(void) { +#ifdef NEED_GLOBAL_LOCK_INIT + if (malloc_global_mutex_status <= 0) + init_malloc_global_mutex(); +#endif + + ACQUIRE_MALLOC_GLOBAL_LOCK(); + if (mparams.magic == 0) { + size_t magic; + size_t psize; + size_t gsize; + +#if !defined(WIN32) || defined(_TLIBC_) + psize = malloc_getpagesize; + gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize); +#else /* WIN32 */ + { + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + psize = system_info.dwPageSize; + gsize = ((DEFAULT_GRANULARITY != 0)? + DEFAULT_GRANULARITY : system_info.dwAllocationGranularity); + } +#endif /* WIN32 */ + + /* Sanity-check configuration: + size_t must be unsigned and as wide as pointer type. + ints must be at least 4 bytes. + alignment must be at least 8. + Alignment, min chunk size, and page size must all be powers of 2. + */ + if ((sizeof(size_t) != sizeof(char*)) || + (MAX_SIZE_T < MIN_CHUNK_SIZE) || + (sizeof(int) < 4) || + (MALLOC_ALIGNMENT < (size_t)8U) || + ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || + ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || + ((gsize & (gsize-SIZE_T_ONE)) != 0) || + ((psize & (psize-SIZE_T_ONE)) != 0)) + ABORT; + mparams.granularity = gsize; + mparams.page_size = psize; + mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; + mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; +#if MORECORE_CONTIGUOUS + mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; +#else /* MORECORE_CONTIGUOUS */ + mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; +#endif /* MORECORE_CONTIGUOUS */ + +#if !ONLY_MSPACES + /* Set up lock for main malloc area */ + gm->mflags = mparams.default_mflags; + (void)INITIAL_LOCK(&gm->mutex); +#endif +#if LOCK_AT_FORK + pthread_atfork(&pre_fork, &post_fork_parent, &post_fork_child); +#endif + + { +#if USE_DEV_RANDOM + int fd; + unsigned char buf[sizeof(size_t)]; + /* Try to use /dev/urandom, else fall back on using time */ + if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && + read(fd, buf, sizeof(buf)) == sizeof(buf)) { + magic = *((size_t *) buf); + close(fd); + } + else +#endif /* USE_DEV_RANDOM */ +#if defined(WIN32) && !defined(_TLIBC_) + magic = (size_t)(GetTickCount() ^ (size_t)0x55555555U); +#elif defined(LACKS_TIME_H) + if (SGX_SUCCESS != sgx_read_rand((unsigned char *)&magic, sizeof(size_t))) + ABORT; + magic = (size_t)(magic ^ (size_t)0x55555555U); +#else + magic = (size_t)(time(0) ^ (size_t)0x55555555U); +#endif + magic |= (size_t)8U; /* ensure nonzero */ + magic &= ~(size_t)7U; /* improve chances of fault for bad values */ + /* Until memory modes commonly available, use volatile-write */ + (*(volatile size_t *)(&(mparams.magic))) = magic; + } + } + + RELEASE_MALLOC_GLOBAL_LOCK(); + return 1; +} + +/* support for mallopt */ +static int change_mparam(int param_number, int value) { + size_t val; + ensure_initialization(); + val = (value == -1)? MAX_SIZE_T : (size_t)value; + switch(param_number) { + case M_TRIM_THRESHOLD: + mparams.trim_threshold = val; + return 1; + case M_GRANULARITY: + if (val >= mparams.page_size && ((val & (val-1)) == 0)) { + mparams.granularity = val; + return 1; + } + else + return 0; + case M_MMAP_THRESHOLD: + mparams.mmap_threshold = val; + return 1; + default: + return 0; + } +} + +#if DEBUG +/* ------------------------- Debugging Support --------------------------- */ + +/* Check properties of any chunk, whether free, inuse, mmapped etc */ +static void do_check_any_chunk(mstate m, mchunkptr p) { + assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); + assert(ok_address(m, p)); +} + +/* Check properties of top chunk */ +static void do_check_top_chunk(mstate m, mchunkptr p) { + msegmentptr sp = segment_holding(m, (char*)p); + size_t sz = p->head & ~INUSE_BITS; /* third-lowest bit can be set! */ + assert(sp != 0); + assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); + assert(ok_address(m, p)); + assert(sz == m->topsize); + assert(sz > 0); + assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); + assert(pinuse(p)); + assert(!pinuse(chunk_plus_offset(p, sz))); +} + +/* Check properties of (inuse) mmapped chunks */ +static void do_check_mmapped_chunk(mstate m, mchunkptr p) { + size_t sz = chunksize(p); + size_t len = (sz + (p->prev_foot) + MMAP_FOOT_PAD); + assert(is_mmapped(p)); + assert(use_mmap(m)); + assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); + assert(ok_address(m, p)); + assert(!is_small(sz)); + assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); + assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); + assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); +} + +/* Check properties of inuse chunks */ +static void do_check_inuse_chunk(mstate m, mchunkptr p) { + do_check_any_chunk(m, p); + assert(is_inuse(p)); + assert(next_pinuse(p)); + /* If not pinuse and not mmapped, previous chunk has OK offset */ + assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); + if (is_mmapped(p)) + do_check_mmapped_chunk(m, p); +} + +/* Check properties of free chunks */ +static void do_check_free_chunk(mstate m, mchunkptr p) { + size_t sz = chunksize(p); + mchunkptr next = chunk_plus_offset(p, sz); + do_check_any_chunk(m, p); + assert(!is_inuse(p)); + assert(!next_pinuse(p)); + assert (!is_mmapped(p)); + if (p != m->dv && p != m->top) { + if (sz >= MIN_CHUNK_SIZE) { + assert((sz & CHUNK_ALIGN_MASK) == 0); + assert(is_aligned(chunk2mem(p))); + assert(next->prev_foot == sz); + assert(pinuse(p)); + assert (next == m->top || is_inuse(next)); + assert(p->fd->bk == p); + assert(p->bk->fd == p); + } + else /* markers are always of size SIZE_T_SIZE */ + assert(sz == SIZE_T_SIZE); + } +} + +/* Check properties of malloced chunks at the point they are malloced */ +static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + size_t sz = p->head & ~INUSE_BITS; + do_check_inuse_chunk(m, p); + assert((sz & CHUNK_ALIGN_MASK) == 0); + assert(sz >= MIN_CHUNK_SIZE); + assert(sz >= s); + /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ + assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); + } +} + +/* Check a tree and its subtrees. */ +static void do_check_tree(mstate m, tchunkptr t) { + tchunkptr head = 0; + tchunkptr u = t; + bindex_t tindex = t->index; + size_t tsize = chunksize(t); + bindex_t idx; + compute_tree_index(tsize, idx); + assert(tindex == idx); + assert(tsize >= MIN_LARGE_SIZE); + assert(tsize >= minsize_for_tree_index(idx)); + assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); + + do { /* traverse through chain of same-sized nodes */ + do_check_any_chunk(m, ((mchunkptr)u)); + assert(u->index == tindex); + assert(chunksize(u) == tsize); + assert(!is_inuse(u)); + assert(!next_pinuse(u)); + assert(u->fd->bk == u); + assert(u->bk->fd == u); + if (u->parent == 0) { + assert(u->child[0] == 0); + assert(u->child[1] == 0); + } + else { + assert(head == 0); /* only one node on chain has parent */ + head = u; + assert(u->parent != u); + assert (u->parent->child[0] == u || + u->parent->child[1] == u || + *((tbinptr*)(u->parent)) == u); + if (u->child[0] != 0) { + assert(u->child[0]->parent == u); + assert(u->child[0] != u); + do_check_tree(m, u->child[0]); + } + if (u->child[1] != 0) { + assert(u->child[1]->parent == u); + assert(u->child[1] != u); + do_check_tree(m, u->child[1]); + } + if (u->child[0] != 0 && u->child[1] != 0) { + assert(chunksize(u->child[0]) < chunksize(u->child[1])); + } + } + u = u->fd; + } while (u != t); + assert(head != 0); +} + +/* Check all the chunks in a treebin. */ +static void do_check_treebin(mstate m, bindex_t i) { + tbinptr* tb = treebin_at(m, i); + tchunkptr t = *tb; + int empty = (m->treemap & (1U << i)) == 0; + if (t == 0) + assert(empty); + if (!empty) + do_check_tree(m, t); +} + +/* Check all the chunks in a smallbin. */ +static void do_check_smallbin(mstate m, bindex_t i) { + sbinptr b = smallbin_at(m, i); + mchunkptr p = b->bk; + unsigned int empty = (m->smallmap & (1U << i)) == 0; + if (p == b) + assert(empty); + if (!empty) { + for (; p != b; p = p->bk) { + size_t size = chunksize(p); + mchunkptr q; + /* each chunk claims to be free */ + do_check_free_chunk(m, p); + /* chunk belongs in bin */ + assert(small_index(size) == i); + assert(p->bk == b || chunksize(p->bk) == chunksize(p)); + /* chunk is followed by an inuse chunk */ + q = next_chunk(p); + if (q->head != FENCEPOST_HEAD) + do_check_inuse_chunk(m, q); + } + } +} + +/* Find x in a bin. Used in other check functions. */ +static int bin_find(mstate m, mchunkptr x) { + size_t size = chunksize(x); + if (is_small(size)) { + bindex_t sidx = small_index(size); + sbinptr b = smallbin_at(m, sidx); + if (smallmap_is_marked(m, sidx)) { + mchunkptr p = b; + do { + if (p == x) + return 1; + } while ((p = p->fd) != b); + } + } + else { + bindex_t tidx; + compute_tree_index(size, tidx); + if (treemap_is_marked(m, tidx)) { + tchunkptr t = *treebin_at(m, tidx); + size_t sizebits = size << leftshift_for_tree_index(tidx); + while (t != 0 && chunksize(t) != size) { + t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; + sizebits <<= 1; + } + if (t != 0) { + tchunkptr u = t; + do { + if (u == (tchunkptr)x) + return 1; + } while ((u = u->fd) != t); + } + } + } + return 0; +} + +/* Traverse each chunk and check it; return total */ +static size_t traverse_and_check(mstate m) { + size_t sum = 0; + if (is_initialized(m)) { + msegmentptr s = &m->seg; + sum += m->topsize + TOP_FOOT_SIZE; + while (s != 0) { + mchunkptr q = align_as_chunk(s->base); + mchunkptr lastq = 0; + assert(pinuse(q)); + while (segment_holds(s, q) && + q != m->top && q->head != FENCEPOST_HEAD) { + sum += chunksize(q); + if (is_inuse(q)) { + assert(!bin_find(m, q)); + do_check_inuse_chunk(m, q); + } + else { + assert(q == m->dv || bin_find(m, q)); + assert(lastq == 0 || is_inuse(lastq)); /* Not 2 consecutive free */ + do_check_free_chunk(m, q); + } + lastq = q; + q = next_chunk(q); + } + s = s->next; + } + } + return sum; +} + + +/* Check all properties of malloc_state. */ +static void do_check_malloc_state(mstate m) { + bindex_t i; + size_t total; + /* check bins */ + for (i = 0; i < NSMALLBINS; ++i) + do_check_smallbin(m, i); + for (i = 0; i < NTREEBINS; ++i) + do_check_treebin(m, i); + + if (m->dvsize != 0) { /* check dv chunk */ + do_check_any_chunk(m, m->dv); + assert(m->dvsize == chunksize(m->dv)); + assert(m->dvsize >= MIN_CHUNK_SIZE); + assert(bin_find(m, m->dv) == 0); + } + + if (m->top != 0) { /* check top chunk */ + do_check_top_chunk(m, m->top); + /*assert(m->topsize == chunksize(m->top)); redundant */ + assert(m->topsize > 0); + assert(bin_find(m, m->top) == 0); + } + + total = traverse_and_check(m); + assert(total <= m->footprint); + assert(m->footprint <= m->max_footprint); +} +#endif /* DEBUG */ + +/* ----------------------------- statistics ------------------------------ */ + +#if !NO_MALLINFO +static struct mallinfo internal_mallinfo(mstate m) { + struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + ensure_initialization(); + if (!PREACTION(m)) { + check_malloc_state(m); + if (is_initialized(m)) { + size_t nfree = SIZE_T_ONE; /* top always free */ + size_t mfree = m->topsize + TOP_FOOT_SIZE; + size_t sum = mfree; + msegmentptr s = &m->seg; + while (s != 0) { + mchunkptr q = align_as_chunk(s->base); + while (segment_holds(s, q) && + q != m->top && q->head != FENCEPOST_HEAD) { + size_t sz = chunksize(q); + sum += sz; + if (!is_inuse(q)) { + mfree += sz; + ++nfree; + } + q = next_chunk(q); + } + s = s->next; + } + + nm.arena = sum; + nm.ordblks = nfree; + nm.hblkhd = m->footprint - sum; + nm.usmblks = m->max_footprint; + nm.uordblks = m->footprint - mfree; + nm.fordblks = mfree; + nm.keepcost = m->topsize; + } + + POSTACTION(m); + } + return nm; +} +#endif /* !NO_MALLINFO */ + +#if !NO_MALLOC_STATS +static void internal_malloc_stats(mstate m) { + ensure_initialization(); + if (!PREACTION(m)) { + size_t maxfp = 0; + size_t fp = 0; + size_t used = 0; + check_malloc_state(m); + if (is_initialized(m)) { + msegmentptr s = &m->seg; + maxfp = m->max_footprint; + fp = m->footprint; + used = fp - (m->topsize + TOP_FOOT_SIZE); + + while (s != 0) { + mchunkptr q = align_as_chunk(s->base); + while (segment_holds(s, q) && + q != m->top && q->head != FENCEPOST_HEAD) { + if (!is_inuse(q)) + used -= chunksize(q); + q = next_chunk(q); + } + s = s->next; + } + } + POSTACTION(m); /* drop lock */ +#ifndef _TLIBC_ + fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); + fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); + fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); +#endif + } +} +#endif /* NO_MALLOC_STATS */ + +/* ----------------------- Operations on smallbins ----------------------- */ + +/* + Various forms of linking and unlinking are defined as macros. Even + the ones for trees, which are very long but have very short typical + paths. This is ugly but reduces reliance on inlining support of + compilers. +*/ + +/* Link a free chunk into a smallbin */ +#define insert_small_chunk(M, P, S) {\ + bindex_t I = small_index(S);\ + mchunkptr B = smallbin_at(M, I);\ + mchunkptr F = B;\ + assert(S >= MIN_CHUNK_SIZE);\ + if (!smallmap_is_marked(M, I))\ + mark_smallmap(M, I);\ + else if (RTCHECK(ok_address(M, B->fd)))\ + F = B->fd;\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + B->fd = P;\ + F->bk = P;\ + P->fd = F;\ + P->bk = B;\ +} + +/* Unlink a chunk from a smallbin */ +#define unlink_small_chunk(M, P, S) {\ + mchunkptr F = P->fd;\ + mchunkptr B = P->bk;\ + bindex_t I = small_index(S);\ + assert(P != B);\ + assert(P != F);\ + assert(chunksize(P) == small_index2size(I));\ + if (RTCHECK(F == smallbin_at(M,I) || (ok_address(M, F) && F->bk == P))) { \ + if (B == F) {\ + clear_smallmap(M, I);\ + }\ + else if (RTCHECK(B == smallbin_at(M,I) ||\ + (ok_address(M, B) && B->fd == P))) {\ + F->bk = B;\ + B->fd = F;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ +} + +/* Unlink the first chunk from a smallbin */ +#define unlink_first_small_chunk(M, B, P, I) {\ + mchunkptr F = P->fd;\ + assert(P != B);\ + assert(P != F);\ + assert(chunksize(P) == small_index2size(I));\ + if (B == F) {\ + clear_smallmap(M, I);\ + }\ + else if (RTCHECK(ok_address(M, F) && F->bk == P)) {\ + F->bk = B;\ + B->fd = F;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ +} + +/* Replace dv node, binning the old one */ +/* Used only when dvsize known to be small */ +#define replace_dv(M, P, S) {\ + size_t DVS = M->dvsize;\ + assert(is_small(DVS));\ + if (DVS != 0) {\ + mchunkptr DV = M->dv;\ + insert_small_chunk(M, DV, DVS);\ + }\ + M->dvsize = S;\ + M->dv = P;\ +} + +/* ------------------------- Operations on trees ------------------------- */ + +/* Insert chunk into tree */ +#define insert_large_chunk(M, X, S) {\ + tbinptr* H;\ + bindex_t I;\ + compute_tree_index(S, I);\ + H = treebin_at(M, I);\ + X->index = I;\ + X->child[0] = X->child[1] = 0;\ + if (!treemap_is_marked(M, I)) {\ + mark_treemap(M, I);\ + *H = X;\ + X->parent = (tchunkptr)H;\ + X->fd = X->bk = X;\ + }\ + else {\ + tchunkptr T = *H;\ + size_t K = S << leftshift_for_tree_index(I);\ + for (;;) {\ + if (chunksize(T) != S) {\ + tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ + K <<= 1;\ + if (*C != 0)\ + T = *C;\ + else if (RTCHECK(ok_address(M, C))) {\ + *C = X;\ + X->parent = T;\ + X->fd = X->bk = X;\ + break;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + break;\ + }\ + }\ + else {\ + tchunkptr F = T->fd;\ + if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ + T->fd = F->bk = X;\ + X->fd = F;\ + X->bk = T;\ + X->parent = 0;\ + break;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + break;\ + }\ + }\ + }\ + }\ +} + +/* + Unlink steps: + + 1. If x is a chained node, unlink it from its same-sized fd/bk links + and choose its bk node as its replacement. + 2. If x was the last node of its size, but not a leaf node, it must + be replaced with a leaf node (not merely one with an open left or + right), to make sure that lefts and rights of descendents + correspond properly to bit masks. We use the rightmost descendent + of x. We could use any other leaf, but this is easy to locate and + tends to counteract removal of leftmosts elsewhere, and so keeps + paths shorter than minimally guaranteed. This doesn't loop much + because on average a node in a tree is near the bottom. + 3. If x is the base of a chain (i.e., has parent links) relink + x's parent and children to x's replacement (or null if none). +*/ + +#define unlink_large_chunk(M, X) {\ + tchunkptr XP = X->parent;\ + tchunkptr R;\ + if (X->bk != X) {\ + tchunkptr F = X->fd;\ + R = X->bk;\ + if (RTCHECK(ok_address(M, F) && F->bk == X && R->fd == X)) {\ + F->bk = R;\ + R->fd = F;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + else {\ + tchunkptr* RP;\ + if (((R = *(RP = &(X->child[1]))) != 0) ||\ + ((R = *(RP = &(X->child[0]))) != 0)) {\ + tchunkptr* CP;\ + while ((*(CP = &(R->child[1])) != 0) ||\ + (*(CP = &(R->child[0])) != 0)) {\ + R = *(RP = CP);\ + }\ + if (RTCHECK(ok_address(M, RP)))\ + *RP = 0;\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + }\ + if (XP != 0) {\ + tbinptr* H = treebin_at(M, X->index);\ + if (X == *H) {\ + if ((*H = R) == 0) \ + clear_treemap(M, X->index);\ + }\ + else if (RTCHECK(ok_address(M, XP))) {\ + if (XP->child[0] == X) \ + XP->child[0] = R;\ + else \ + XP->child[1] = R;\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + if (R != 0) {\ + if (RTCHECK(ok_address(M, R))) {\ + tchunkptr C0, C1;\ + R->parent = XP;\ + if ((C0 = X->child[0]) != 0) {\ + if (RTCHECK(ok_address(M, C0))) {\ + R->child[0] = C0;\ + C0->parent = R;\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + if ((C1 = X->child[1]) != 0) {\ + if (RTCHECK(ok_address(M, C1))) {\ + R->child[1] = C1;\ + C1->parent = R;\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ +} + +/* Relays to large vs small bin operations */ + +#define insert_chunk(M, P, S)\ + if (is_small(S)) insert_small_chunk(M, P, S)\ + else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } + +#define unlink_chunk(M, P, S)\ + if (is_small(S)) unlink_small_chunk(M, P, S)\ + else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } + + +/* Relays to internal calls to malloc/free from realloc, memalign etc */ + +#if ONLY_MSPACES +#define internal_malloc(m, b) mspace_malloc(m, b) +#define internal_free(m, mem) mspace_free(m,mem); +#else /* ONLY_MSPACES */ +#if MSPACES +#define internal_malloc(m, b)\ + ((m == gm)? dlmalloc(b) : mspace_malloc(m, b)) +#define internal_free(m, mem)\ + if (m == gm) dlfree(mem); else mspace_free(m,mem); +#else /* MSPACES */ +#define internal_malloc(m, b) dlmalloc(b) +#define internal_free(m, mem) dlfree(mem) +#endif /* MSPACES */ +#endif /* ONLY_MSPACES */ + +/* ----------------------- Direct-mmapping chunks ----------------------- */ + +/* + Directly mmapped chunks are set up with an offset to the start of + the mmapped region stored in the prev_foot field of the chunk. This + allows reconstruction of the required argument to MUNMAP when freed, + and also allows adjustment of the returned chunk to meet alignment + requirements (especially in memalign). +*/ + +/* Malloc using mmap */ +static void* mmap_alloc(mstate m, size_t nb) { + size_t mmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); + if (m->footprint_limit != 0) { + size_t fp = m->footprint + mmsize; + if (fp <= m->footprint || fp > m->footprint_limit) + return 0; + } + if (mmsize > nb) { /* Check for wrap around 0 */ + char* mm = (char*)(CALL_DIRECT_MMAP(mmsize)); + if (mm != CMFAIL) { + size_t offset = align_offset(chunk2mem(mm)); + size_t psize = mmsize - offset - MMAP_FOOT_PAD; + mchunkptr p = (mchunkptr)(mm + offset); + p->prev_foot = offset; + p->head = psize; + mark_inuse_foot(m, p, psize); + chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; + chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; + + if (m->least_addr == 0 || mm < m->least_addr) + m->least_addr = mm; + if ((m->footprint += mmsize) > m->max_footprint) + m->max_footprint = m->footprint; + assert(is_aligned(chunk2mem(p))); + check_mmapped_chunk(m, p); + return chunk2mem(p); + } + } + return 0; +} + +/* Realloc using mmap */ +static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb, int flags) { + size_t oldsize = chunksize(oldp); + (void)flags; /* placate people compiling -Wunused */ + if (is_small(nb)) /* Can't shrink mmap regions below small size */ + return 0; + /* Keep old chunk if big enough but not too big */ + if (oldsize >= nb + SIZE_T_SIZE && + (oldsize - nb) <= (mparams.granularity << 1)) + return oldp; + else { + size_t offset = oldp->prev_foot; + size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; + size_t newmmsize = mmap_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); + char* cp = (char*)CALL_MREMAP((char*)oldp - offset, + oldmmsize, newmmsize, flags); + if (cp != CMFAIL) { + mchunkptr newp = (mchunkptr)(cp + offset); + size_t psize = newmmsize - offset - MMAP_FOOT_PAD; + newp->head = psize; + mark_inuse_foot(m, newp, psize); + chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; + chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; + + if (cp < m->least_addr) + m->least_addr = cp; + if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) + m->max_footprint = m->footprint; + check_mmapped_chunk(m, newp); + return newp; + } + } + return 0; +} + + +/* -------------------------- mspace management -------------------------- */ + +/* Initialize top chunk and its size */ +static void init_top(mstate m, mchunkptr p, size_t psize) { + /* Ensure alignment */ + size_t offset = align_offset(chunk2mem(p)); + p = (mchunkptr)((char*)p + offset); + psize -= offset; + + m->top = p; + m->topsize = psize; + p->head = psize | PINUSE_BIT; + /* set size of fake trailing chunk holding overhead space only once */ + chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; + m->trim_check = mparams.trim_threshold; /* reset on each update */ +} + +/* Initialize bins for a new mstate that is otherwise zeroed out */ +static void init_bins(mstate m) { + /* Establish circular links for smallbins */ + bindex_t i; + for (i = 0; i < NSMALLBINS; ++i) { + sbinptr bin = smallbin_at(m,i); + bin->fd = bin->bk = bin; + } +} + +#if PROCEED_ON_ERROR + +/* default corruption action */ +static void reset_on_error(mstate m) { + int i; + ++malloc_corruption_error_count; + /* Reinitialize fields to forget about all memory */ + m->smallmap = m->treemap = 0; + m->dvsize = m->topsize = 0; + m->seg.base = 0; + m->seg.size = 0; + m->seg.next = 0; + m->top = m->dv = 0; + for (i = 0; i < NTREEBINS; ++i) + *treebin_at(m, i) = 0; + init_bins(m); +} +#endif /* PROCEED_ON_ERROR */ + +/* Allocate chunk and prepend remainder with chunk in successor base. */ +static void* prepend_alloc(mstate m, char* newbase, char* oldbase, + size_t nb) { + mchunkptr p = align_as_chunk(newbase); + mchunkptr oldfirst = align_as_chunk(oldbase); + size_t psize = (char*)oldfirst - (char*)p; + mchunkptr q = chunk_plus_offset(p, nb); + size_t qsize = psize - nb; + set_size_and_pinuse_of_inuse_chunk(m, p, nb); + + assert((char*)oldfirst > (char*)q); + assert(pinuse(oldfirst)); + assert(qsize >= MIN_CHUNK_SIZE); + + /* consolidate remainder with first chunk of old base */ + if (oldfirst == m->top) { + size_t tsize = m->topsize += qsize; + m->top = q; + q->head = tsize | PINUSE_BIT; + check_top_chunk(m, q); + } + else if (oldfirst == m->dv) { + size_t dsize = m->dvsize += qsize; + m->dv = q; + set_size_and_pinuse_of_free_chunk(q, dsize); + } + else { + if (!is_inuse(oldfirst)) { + size_t nsize = chunksize(oldfirst); + unlink_chunk(m, oldfirst, nsize); + oldfirst = chunk_plus_offset(oldfirst, nsize); + qsize += nsize; + } + set_free_with_pinuse(q, qsize, oldfirst); + insert_chunk(m, q, qsize); + check_free_chunk(m, q); + } + + check_malloced_chunk(m, chunk2mem(p), nb); + return chunk2mem(p); +} + +/* Add a segment to hold a new noncontiguous region */ +static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { + /* Determine locations and sizes of segment, fenceposts, old top */ + char* old_top = (char*)m->top; + msegmentptr oldsp = segment_holding(m, old_top); + char* old_end = oldsp->base + oldsp->size; + size_t ssize = pad_request(sizeof(struct malloc_segment)); + char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); + size_t offset = align_offset(chunk2mem(rawsp)); + char* asp = rawsp + offset; + char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; + mchunkptr sp = (mchunkptr)csp; + msegmentptr ss = (msegmentptr)(chunk2mem(sp)); + mchunkptr tnext = chunk_plus_offset(sp, ssize); + mchunkptr p = tnext; + int nfences = 0; + + /* reset top to new space */ + init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); + + /* Set up segment record */ + assert(is_aligned(ss)); + set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); + *ss = m->seg; /* Push current record */ + m->seg.base = tbase; + m->seg.size = tsize; + m->seg.sflags = mmapped; + m->seg.next = ss; + + /* Insert trailing fenceposts */ + for (;;) { + mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); + p->head = FENCEPOST_HEAD; + ++nfences; + if ((char*)(&(nextp->head)) < old_end) + p = nextp; + else + break; + } + assert(nfences >= 2); + + /* Insert the rest of old top into a bin as an ordinary free chunk */ + if (csp != old_top) { + mchunkptr q = (mchunkptr)old_top; + size_t psize = csp - old_top; + mchunkptr tn = chunk_plus_offset(q, psize); + set_free_with_pinuse(q, psize, tn); + insert_chunk(m, q, psize); + } + + check_top_chunk(m, m->top); +} + +/* -------------------------- System allocation -------------------------- */ + +/* Get memory from system using MORECORE or MMAP */ +static void* sys_alloc(mstate m, size_t nb) { + char* tbase = CMFAIL; + size_t tsize = 0; + flag_t mmap_flag = 0; + size_t asize; /* allocation size */ + + ensure_initialization(); + + /* Directly map large chunks, but only if already initialized */ + if (use_mmap(m) && nb >= mparams.mmap_threshold && m->topsize != 0) { + void* mem = mmap_alloc(m, nb); + if (mem != 0) + return mem; + } + + asize = granularity_align(nb + SYS_ALLOC_PADDING); + if (asize <= nb) + return 0; /* wraparound */ + if (m->footprint_limit != 0) { + size_t fp = m->footprint + asize; + if (fp <= m->footprint || fp > m->footprint_limit) + return 0; + } + + /* + Try getting memory in any of three ways (in most-preferred to + least-preferred order): + 1. A call to MORECORE that can normally contiguously extend memory. + (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or + or main space is mmapped or a previous contiguous call failed) + 2. A call to MMAP new space (disabled if not HAVE_MMAP). + Note that under the default settings, if MORECORE is unable to + fulfill a request, and HAVE_MMAP is true, then mmap is + used as a noncontiguous system allocator. This is a useful backup + strategy for systems with holes in address spaces -- in this case + sbrk cannot contiguously expand the heap, but mmap may be able to + find space. + 3. A call to MORECORE that cannot usually contiguously extend memory. + (disabled if not HAVE_MORECORE) + + In all cases, we need to request enough bytes from system to ensure + we can malloc nb bytes upon success, so pad with enough space for + top_foot, plus alignment-pad to make sure we don't lose bytes if + not on boundary, and round this up to a granularity unit. + */ + + if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { + char* br = CMFAIL; + size_t ssize = asize; /* sbrk call size */ + msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); + ACQUIRE_MALLOC_GLOBAL_LOCK(); + + if (ss == 0) { /* First time through or recovery */ + char* base = (char*)CALL_MORECORE(0); + if (base != CMFAIL) { + size_t fp; + /* Adjust to end on a page boundary */ + if (!is_page_aligned(base)) + ssize += (page_align((size_t)base) - (size_t)base); + fp = m->footprint + ssize; /* recheck limits */ + if (ssize > nb && ssize < HALF_MAX_SIZE_T && + (m->footprint_limit == 0 || + (fp > m->footprint && fp <= m->footprint_limit)) && + (br = (char*)(CALL_MORECORE(ssize))) == base) { + tbase = base; + tsize = ssize; + } + } + } + else { + /* Subtract out existing available top space from MORECORE request. */ + ssize = granularity_align(nb - m->topsize + SYS_ALLOC_PADDING); + /* Use mem here only if it did continuously extend old space */ + if (ssize < HALF_MAX_SIZE_T && + (br = (char*)(CALL_MORECORE(ssize))) == ss->base+ss->size) { + tbase = br; + tsize = ssize; + } + } + + if (tbase == CMFAIL) { /* Cope with partial failure */ + if (br != CMFAIL) { /* Try to use/extend the space we did get */ + if (ssize < HALF_MAX_SIZE_T && + ssize < nb + SYS_ALLOC_PADDING) { + size_t esize = granularity_align(nb + SYS_ALLOC_PADDING - ssize); + if (esize < HALF_MAX_SIZE_T) { + char* end = (char*)CALL_MORECORE(esize); + if (end != CMFAIL) + ssize += esize; + else { /* Can't use; try to release */ + (void) CALL_MORECORE(-ssize); + br = CMFAIL; + } + } + } + } + if (br != CMFAIL) { /* Use the space we did get */ + tbase = br; + tsize = ssize; + } +#ifndef _TLIBC_ /* Always try contiguous path in tlibc */ + else + disable_contiguous(m); /* Don't try contiguous path in the future */ +#endif + } + + RELEASE_MALLOC_GLOBAL_LOCK(); + } + + if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ + char* mp = (char*)(CALL_MMAP(asize)); + if (mp != CMFAIL) { + tbase = mp; + tsize = asize; + mmap_flag = USE_MMAP_BIT; + } + } + + if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ + if (asize < HALF_MAX_SIZE_T) { + char* br = CMFAIL; + char* end = CMFAIL; + ACQUIRE_MALLOC_GLOBAL_LOCK(); + br = (char*)(CALL_MORECORE(asize)); + end = (char*)(CALL_MORECORE(0)); + RELEASE_MALLOC_GLOBAL_LOCK(); + if (br != CMFAIL && end != CMFAIL && br < end) { + size_t ssize = end - br; + if (ssize > nb + TOP_FOOT_SIZE) { + tbase = br; + tsize = ssize; + } + } + } + } + + if (tbase != CMFAIL) { + + if ((m->footprint += tsize) > m->max_footprint) + m->max_footprint = m->footprint; + + if (!is_initialized(m)) { /* first-time initialization */ + if (m->least_addr == 0 || tbase < m->least_addr) + m->least_addr = tbase; + m->seg.base = tbase; + m->seg.size = tsize; + m->seg.sflags = mmap_flag; + m->magic = mparams.magic; + m->release_checks = MAX_RELEASE_CHECK_RATE; + init_bins(m); +#if !ONLY_MSPACES + if (is_global(m)) + init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); + else +#endif + { + /* Offset top by embedded malloc_state */ + mchunkptr mn = next_chunk(mem2chunk(m)); + init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); + } + } + + else { + /* Try to merge with an existing segment */ + msegmentptr sp = &m->seg; + /* Only consider most recent segment if traversal suppressed */ + while (sp != 0 && tbase != sp->base + sp->size) + sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next; + if (sp != 0 && + !is_extern_segment(sp) && + (sp->sflags & USE_MMAP_BIT) == mmap_flag && + segment_holds(sp, m->top)) { /* append */ + sp->size += tsize; + init_top(m, m->top, m->topsize + tsize); + } + else { + if (tbase < m->least_addr) + m->least_addr = tbase; + sp = &m->seg; + while (sp != 0 && sp->base != tbase + tsize) + sp = (NO_SEGMENT_TRAVERSAL) ? 0 : sp->next; + if (sp != 0 && + !is_extern_segment(sp) && + (sp->sflags & USE_MMAP_BIT) == mmap_flag) { + char* oldbase = sp->base; + sp->base = tbase; + sp->size += tsize; + return prepend_alloc(m, tbase, oldbase, nb); + } + else + add_segment(m, tbase, tsize, mmap_flag); + } + } + + if (nb < m->topsize) { /* Allocate from new or extended top space */ + size_t rsize = m->topsize -= nb; + mchunkptr p = m->top; + mchunkptr r = m->top = chunk_plus_offset(p, nb); + r->head = rsize | PINUSE_BIT; + set_size_and_pinuse_of_inuse_chunk(m, p, nb); + check_top_chunk(m, m->top); + check_malloced_chunk(m, chunk2mem(p), nb); + return chunk2mem(p); + } + } + + MALLOC_FAILURE_ACTION; + return 0; +} + +/* ----------------------- system deallocation -------------------------- */ + +/* Unmap and unlink any mmapped segments that don't contain used chunks */ +static size_t release_unused_segments(mstate m) { + size_t released = 0; + int nsegs = 0; + msegmentptr pred = &m->seg; + msegmentptr sp = pred->next; + while (sp != 0) { + char* base = sp->base; + size_t size = sp->size; + msegmentptr next = sp->next; + ++nsegs; + if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { + mchunkptr p = align_as_chunk(base); + size_t psize = chunksize(p); + /* Can unmap if first chunk holds entire segment and not pinned */ + if (!is_inuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { + tchunkptr tp = (tchunkptr)p; + assert(segment_holds(sp, (char*)sp)); + if (p == m->dv) { + m->dv = 0; + m->dvsize = 0; + } + else { + unlink_large_chunk(m, tp); + } + if (CALL_MUNMAP(base, size) == 0) { + released += size; + m->footprint -= size; + /* unlink obsoleted record */ + sp = pred; + sp->next = next; + } + else { /* back out if cannot unmap */ + insert_large_chunk(m, tp, psize); + } + } + } + if (NO_SEGMENT_TRAVERSAL) /* scan only first segment */ + break; + pred = sp; + sp = next; + } + /* Reset check counter */ + m->release_checks = (((size_t) nsegs > (size_t) MAX_RELEASE_CHECK_RATE)? + (size_t) nsegs : (size_t) MAX_RELEASE_CHECK_RATE); + return released; +} + +static int sys_trim(mstate m, size_t pad) { + size_t released = 0; + ensure_initialization(); + if (pad < MAX_REQUEST && is_initialized(m)) { + pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ + + if (m->topsize > pad) { + /* Shrink top space in granularity-size units, keeping at least one */ + size_t unit = mparams.granularity; + size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - + SIZE_T_ONE) * unit; + msegmentptr sp = segment_holding(m, (char*)m->top); + + if (!is_extern_segment(sp)) { + if (is_mmapped_segment(sp)) { + if (HAVE_MMAP && + sp->size >= extra && + !has_segment_link(m, sp)) { /* can't shrink if pinned */ + size_t newsize = sp->size - extra; + (void)newsize; /* placate people compiling -Wunused-variable */ + /* Prefer mremap, fall back to munmap */ + if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || + (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { + released = extra; + } + } + } + else if (HAVE_MORECORE) { + if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ + extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; + ACQUIRE_MALLOC_GLOBAL_LOCK(); + { + /* Make sure end of memory is where we last set it. */ + char* old_br = (char*)(CALL_MORECORE(0)); + if (old_br == sp->base + sp->size) { + char* rel_br = (char*)(CALL_MORECORE(-extra)); + char* new_br = (char*)(CALL_MORECORE(0)); + if (rel_br != CMFAIL && new_br < old_br) + released = old_br - new_br; + } + } + RELEASE_MALLOC_GLOBAL_LOCK(); + } + } + + if (released != 0) { + sp->size -= released; + m->footprint -= released; + init_top(m, m->top, m->topsize - released); + check_top_chunk(m, m->top); + } + } + + /* Unmap any unused mmapped segments */ + if (HAVE_MMAP) + released += release_unused_segments(m); + + /* On failure, disable autotrim to avoid repeated failed future calls */ + if (released == 0 && m->topsize > m->trim_check) + m->trim_check = MAX_SIZE_T; + } + + return (released != 0)? 1 : 0; +} + +/* Consolidate and bin a chunk. Differs from exported versions + of free mainly in that the chunk need not be marked as inuse. +*/ +static void dispose_chunk(mstate m, mchunkptr p, size_t psize) { + mchunkptr next = chunk_plus_offset(p, psize); + if (!pinuse(p)) { + mchunkptr prev; + size_t prevsize = p->prev_foot; + if (is_mmapped(p)) { + psize += prevsize + MMAP_FOOT_PAD; + if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) + m->footprint -= psize; + return; + } + prev = chunk_minus_offset(p, prevsize); + psize += prevsize; + p = prev; + if (RTCHECK(ok_address(m, prev))) { /* consolidate backward */ + if (p != m->dv) { + unlink_chunk(m, p, prevsize); + } + else if ((next->head & INUSE_BITS) == INUSE_BITS) { + m->dvsize = psize; + set_free_with_pinuse(p, psize, next); + return; + } + } + else { + CORRUPTION_ERROR_ACTION(m); + return; + } + } + if (RTCHECK(ok_address(m, next))) { + if (!cinuse(next)) { /* consolidate forward */ + if (next == m->top) { + size_t tsize = m->topsize += psize; + m->top = p; + p->head = tsize | PINUSE_BIT; + if (p == m->dv) { + m->dv = 0; + m->dvsize = 0; + } + return; + } + else if (next == m->dv) { + size_t dsize = m->dvsize += psize; + m->dv = p; + set_size_and_pinuse_of_free_chunk(p, dsize); + return; + } + else { + size_t nsize = chunksize(next); + psize += nsize; + unlink_chunk(m, next, nsize); + set_size_and_pinuse_of_free_chunk(p, psize); + if (p == m->dv) { + m->dvsize = psize; + return; + } + } + } + else { + set_free_with_pinuse(p, psize, next); + } + insert_chunk(m, p, psize); + } + else { + CORRUPTION_ERROR_ACTION(m); + } +} + +/* ---------------------------- malloc --------------------------- */ + +/* allocate a large request from the best fitting chunk in a treebin */ +static void* tmalloc_large(mstate m, size_t nb) { + tchunkptr v = 0; + size_t rsize = -nb; /* Unsigned negation */ + tchunkptr t; + bindex_t idx; + compute_tree_index(nb, idx); + if ((t = *treebin_at(m, idx)) != 0) { + /* Traverse tree for this bin looking for node with size == nb */ + size_t sizebits = nb << leftshift_for_tree_index(idx); + tchunkptr rst = 0; /* The deepest untaken right subtree */ + for (;;) { + tchunkptr rt; + size_t trem = chunksize(t) - nb; + if (trem < rsize) { + v = t; + if ((rsize = trem) == 0) + break; + } + rt = t->child[1]; + t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; + if (rt != 0 && rt != t) + rst = rt; + if (t == 0) { + t = rst; /* set t to least subtree holding sizes > nb */ + break; + } + sizebits <<= 1; + } + } + if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ + binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; + if (leftbits != 0) { + bindex_t i; + binmap_t leastbit = least_bit(leftbits); + compute_bit2idx(leastbit, i); + t = *treebin_at(m, i); + } + } + + while (t != 0) { /* find smallest of tree or subtree */ + size_t trem = chunksize(t) - nb; + if (trem < rsize) { + rsize = trem; + v = t; + } + t = leftmost_child(t); + } + + /* If dv is a better fit, return 0 so malloc will use it */ + if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { + if (RTCHECK(ok_address(m, v))) { /* split */ + mchunkptr r = chunk_plus_offset(v, nb); + assert(chunksize(v) == rsize + nb); + if (RTCHECK(ok_next(v, r))) { + unlink_large_chunk(m, v); + if (rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(m, v, (rsize + nb)); + else { + set_size_and_pinuse_of_inuse_chunk(m, v, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + insert_chunk(m, r, rsize); + } + return chunk2mem(v); + } + } + CORRUPTION_ERROR_ACTION(m); + } + return 0; +} + +/* allocate a small request from the best fitting chunk in a treebin */ +static void* tmalloc_small(mstate m, size_t nb) { + tchunkptr t, v; + size_t rsize; + bindex_t i; + binmap_t leastbit = least_bit(m->treemap); + compute_bit2idx(leastbit, i); + v = t = *treebin_at(m, i); + rsize = chunksize(t) - nb; + + while ((t = leftmost_child(t)) != 0) { + size_t trem = chunksize(t) - nb; + if (trem < rsize) { + rsize = trem; + v = t; + } + } + + if (RTCHECK(ok_address(m, v))) { + mchunkptr r = chunk_plus_offset(v, nb); + assert(chunksize(v) == rsize + nb); + if (RTCHECK(ok_next(v, r))) { + unlink_large_chunk(m, v); + if (rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(m, v, (rsize + nb)); + else { + set_size_and_pinuse_of_inuse_chunk(m, v, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + replace_dv(m, r, rsize); + } + return chunk2mem(v); + } + } + + CORRUPTION_ERROR_ACTION(m); + return 0; +} + +#if !ONLY_MSPACES + +void* dlmalloc(size_t bytes) { + /* + Basic algorithm: + If a small request (< 256 bytes minus per-chunk overhead): + 1. If one exists, use a remainderless chunk in associated smallbin. + (Remainderless means that there are too few excess bytes to + represent as a chunk.) + 2. If it is big enough, use the dv chunk, which is normally the + chunk adjacent to the one used for the most recent small request. + 3. If one exists, split the smallest available chunk in a bin, + saving remainder in dv. + 4. If it is big enough, use the top chunk. + 5. If available, get memory from system and use it + Otherwise, for a large request: + 1. Find the smallest available binned chunk that fits, and use it + if it is better fitting than dv chunk, splitting if necessary. + 2. If better fitting than any binned chunk, use the dv chunk. + 3. If it is big enough, use the top chunk. + 4. If request size >= mmap threshold, try to directly mmap this chunk. + 5. If available, get memory from system and use it + + The ugly goto's here ensure that postaction occurs along all paths. + */ + +#if USE_LOCKS + ensure_initialization(); /* initialize in sys_alloc if not using locks */ +#endif + + if (!PREACTION(gm)) { + void* mem; + size_t nb; + if (bytes <= MAX_SMALL_REQUEST) { + bindex_t idx; + binmap_t smallbits; + nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); + idx = small_index(nb); + smallbits = gm->smallmap >> idx; + + if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ + mchunkptr b, p; + idx += ~smallbits & 1; /* Uses next bin if idx empty */ + b = smallbin_at(gm, idx); + p = b->fd; + assert(chunksize(p) == small_index2size(idx)); + unlink_first_small_chunk(gm, b, p, idx); + set_inuse_and_pinuse(gm, p, small_index2size(idx)); + mem = chunk2mem(p); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + else if (nb > gm->dvsize) { + if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ + mchunkptr b, p, r; + size_t rsize; + bindex_t i; + binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); + binmap_t leastbit = least_bit(leftbits); + compute_bit2idx(leastbit, i); + b = smallbin_at(gm, i); + p = b->fd; + assert(chunksize(p) == small_index2size(i)); + unlink_first_small_chunk(gm, b, p, i); + rsize = small_index2size(i) - nb; + /* Fit here cannot be remainderless if 4byte sizes */ + if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(gm, p, small_index2size(i)); + else { + set_size_and_pinuse_of_inuse_chunk(gm, p, nb); + r = chunk_plus_offset(p, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + replace_dv(gm, r, rsize); + } + mem = chunk2mem(p); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + } + } + else if (bytes >= MAX_REQUEST) + nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ + else { + nb = pad_request(bytes); + if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + } + + if (nb <= gm->dvsize) { + size_t rsize = gm->dvsize - nb; + mchunkptr p = gm->dv; + if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ + mchunkptr r = gm->dv = chunk_plus_offset(p, nb); + gm->dvsize = rsize; + set_size_and_pinuse_of_free_chunk(r, rsize); + set_size_and_pinuse_of_inuse_chunk(gm, p, nb); + } + else { /* exhaust dv */ + size_t dvs = gm->dvsize; + gm->dvsize = 0; + gm->dv = 0; + set_inuse_and_pinuse(gm, p, dvs); + } + mem = chunk2mem(p); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + else if (nb < gm->topsize) { /* Split top */ + size_t rsize = gm->topsize -= nb; + mchunkptr p = gm->top; + mchunkptr r = gm->top = chunk_plus_offset(p, nb); + r->head = rsize | PINUSE_BIT; + set_size_and_pinuse_of_inuse_chunk(gm, p, nb); + mem = chunk2mem(p); + check_top_chunk(gm, gm->top); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + mem = sys_alloc(gm, nb); + + postaction: + if (mem != 0 && !ok_heap_range(mem, bytes)) ABORT; + POSTACTION(gm); + return mem; + } + + return 0; +} + +/* ---------------------------- free --------------------------- */ + +void dlfree(void* mem) { + /* + Consolidate freed chunks with preceeding or succeeding bordering + free chunks, if they exist, and then place in a bin. Intermixed + with special cases for top, dv, mmapped chunks, and usage errors. + */ + + if (mem != 0) { + mchunkptr p = mem2chunk(mem); +#if FOOTERS + mstate fm = get_mstate_for(p); + if (!ok_magic(fm)) { + USAGE_ERROR_ACTION(fm, p); + return; + } +#else /* FOOTERS */ +#define fm gm +#endif /* FOOTERS */ + if (!PREACTION(fm)) { + check_inuse_chunk(fm, p); + if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) { + size_t psize = chunksize(p); + mchunkptr next = chunk_plus_offset(p, psize); + if (!pinuse(p)) { + size_t prevsize = p->prev_foot; + if (is_mmapped(p)) { + psize += prevsize + MMAP_FOOT_PAD; + if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) + fm->footprint -= psize; + goto postaction; + } + else { + mchunkptr prev = chunk_minus_offset(p, prevsize); + psize += prevsize; + p = prev; + if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ + if (p != fm->dv) { + unlink_chunk(fm, p, prevsize); + } + else if ((next->head & INUSE_BITS) == INUSE_BITS) { + fm->dvsize = psize; + set_free_with_pinuse(p, psize, next); + goto postaction; + } + } + else + goto erroraction; + } + } + + if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { + if (!cinuse(next)) { /* consolidate forward */ + if (next == fm->top) { + size_t tsize = fm->topsize += psize; + fm->top = p; + p->head = tsize | PINUSE_BIT; + if (p == fm->dv) { + fm->dv = 0; + fm->dvsize = 0; + } + if (should_trim(fm, tsize)) + sys_trim(fm, 0); + goto postaction; + } + else if (next == fm->dv) { + size_t dsize = fm->dvsize += psize; + fm->dv = p; + set_size_and_pinuse_of_free_chunk(p, dsize); + goto postaction; + } + else { + size_t nsize = chunksize(next); + psize += nsize; + unlink_chunk(fm, next, nsize); + set_size_and_pinuse_of_free_chunk(p, psize); + if (p == fm->dv) { + fm->dvsize = psize; + goto postaction; + } + } + } + else + set_free_with_pinuse(p, psize, next); + + if (is_small(psize)) { + insert_small_chunk(fm, p, psize); + check_free_chunk(fm, p); + } + else { + tchunkptr tp = (tchunkptr)p; + insert_large_chunk(fm, tp, psize); + check_free_chunk(fm, p); + if (--fm->release_checks == 0) + release_unused_segments(fm); + } + goto postaction; + } + } + erroraction: + USAGE_ERROR_ACTION(fm, p); + postaction: + POSTACTION(fm); + } + } +#if !FOOTERS +#undef fm +#endif /* FOOTERS */ +} + +void* dlcalloc(size_t n_elements, size_t elem_size) { + void* mem; + size_t req = 0; + if (n_elements != 0) { + req = n_elements * elem_size; + if (((n_elements | elem_size) & ~(size_t)0xffff) && + (req / n_elements != elem_size)) + req = MAX_SIZE_T; /* force downstream failure on overflow */ + } + mem = dlmalloc(req); + if (mem != 0 && calloc_must_clear(mem2chunk(mem))) + memset(mem, 0, req); + return mem; +} + +#endif /* !ONLY_MSPACES */ + +/* ------------ Internal support for realloc, memalign, etc -------------- */ + +/* Try to realloc; only in-place unless can_move true */ +static mchunkptr try_realloc_chunk(mstate m, mchunkptr p, size_t nb, + int can_move) { + mchunkptr newp = 0; + size_t oldsize = chunksize(p); + mchunkptr next = chunk_plus_offset(p, oldsize); + if (RTCHECK(ok_address(m, p) && ok_inuse(p) && + ok_next(p, next) && ok_pinuse(next))) { + if (is_mmapped(p)) { + newp = mmap_resize(m, p, nb, can_move); + } + else if (oldsize >= nb) { /* already big enough */ + size_t rsize = oldsize - nb; + if (rsize >= MIN_CHUNK_SIZE) { /* split off remainder */ + mchunkptr r = chunk_plus_offset(p, nb); + set_inuse(m, p, nb); + set_inuse(m, r, rsize); +#ifdef _TLIBC_ + /* Zero recycled chunk */ + memset(chunk2mem(r), 0, rsize - overhead_for(r)); +#endif + dispose_chunk(m, r, rsize); + } + newp = p; + } + else if (next == m->top) { /* extend into top */ + if (oldsize + m->topsize > nb) { + size_t newsize = oldsize + m->topsize; + size_t newtopsize = newsize - nb; + mchunkptr newtop = chunk_plus_offset(p, nb); + set_inuse(m, p, nb); + newtop->head = newtopsize |PINUSE_BIT; + m->top = newtop; + m->topsize = newtopsize; + newp = p; + } + } + else if (next == m->dv) { /* extend into dv */ + size_t dvs = m->dvsize; + if (oldsize + dvs >= nb) { + size_t dsize = oldsize + dvs - nb; + if (dsize >= MIN_CHUNK_SIZE) { + mchunkptr r = chunk_plus_offset(p, nb); + mchunkptr n = chunk_plus_offset(r, dsize); + set_inuse(m, p, nb); + set_size_and_pinuse_of_free_chunk(r, dsize); + clear_pinuse(n); + m->dvsize = dsize; + m->dv = r; + } + else { /* exhaust dv */ + size_t newsize = oldsize + dvs; + set_inuse(m, p, newsize); + m->dvsize = 0; + m->dv = 0; + } + newp = p; + } + } + else if (!cinuse(next)) { /* extend into next free chunk */ + size_t nextsize = chunksize(next); + if (oldsize + nextsize >= nb) { + size_t rsize = oldsize + nextsize - nb; + unlink_chunk(m, next, nextsize); + if (rsize < MIN_CHUNK_SIZE) { + size_t newsize = oldsize + nextsize; + set_inuse(m, p, newsize); + } + else { + mchunkptr r = chunk_plus_offset(p, nb); + set_inuse(m, p, nb); + set_inuse(m, r, rsize); + dispose_chunk(m, r, rsize); + } + newp = p; + } + } + } + else { + USAGE_ERROR_ACTION(m, chunk2mem(p)); + } + return newp; +} + +static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { + void* mem = 0; + if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ + alignment = MIN_CHUNK_SIZE; + if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ + size_t a = MALLOC_ALIGNMENT << 1; + while (a < alignment) a <<= 1; + alignment = a; + } + if (bytes >= MAX_REQUEST - alignment) { + if (m != 0) { /* Test isn't needed but avoids compiler warning */ + MALLOC_FAILURE_ACTION; + } + } + else { + size_t nb = request2size(bytes); + size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; + mem = internal_malloc(m, req); + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + if (PREACTION(m)) + return 0; + if ((((size_t)(mem)) & (alignment - 1)) != 0) { /* misaligned */ + /* + Find an aligned spot inside chunk. Since we need to give + back leading space in a chunk of at least MIN_CHUNK_SIZE, if + the first calculation places us at a spot with less than + MIN_CHUNK_SIZE leader, we can move to the next aligned spot. + We've allocated enough total room so that this is always + possible. + */ + char* br = (char*)mem2chunk((size_t)(((size_t)((char*)mem + alignment - + SIZE_T_ONE)) & + -alignment)); + char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? + br : br+alignment; + mchunkptr newp = (mchunkptr)pos; + size_t leadsize = pos - (char*)(p); + size_t newsize = chunksize(p) - leadsize; + + if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ + newp->prev_foot = p->prev_foot + leadsize; + newp->head = newsize; + } + else { /* Otherwise, give back leader, use the rest */ + set_inuse(m, newp, newsize); + set_inuse(m, p, leadsize); + dispose_chunk(m, p, leadsize); + } + p = newp; + } + + /* Give back spare room at the end */ + if (!is_mmapped(p)) { + size_t size = chunksize(p); + if (size > nb + MIN_CHUNK_SIZE) { + size_t remainder_size = size - nb; + mchunkptr remainder = chunk_plus_offset(p, nb); + set_inuse(m, p, nb); + set_inuse(m, remainder, remainder_size); + dispose_chunk(m, remainder, remainder_size); + } + } + + mem = chunk2mem(p); + assert (chunksize(p) >= nb); + assert(((size_t)mem & (alignment - 1)) == 0); + check_inuse_chunk(m, p); + POSTACTION(m); + } + } + return mem; +} + +#ifdef USE_MALLOC_DEPRECATED +/* + Common support for independent_X routines, handling + all of the combinations that can result. + The opts arg has: + bit 0 set if all elements are same size (using sizes[0]) + bit 1 set if elements should be zeroed +*/ +static void** ialloc(mstate m, + size_t n_elements, + size_t* sizes, + int opts, + void* chunks[]) { + + size_t element_size; /* chunksize of each element, if all same */ + size_t contents_size; /* total size of elements */ + size_t array_size; /* request size of pointer array */ + void* mem; /* malloced aggregate space */ + mchunkptr p; /* corresponding chunk */ + size_t remainder_size; /* remaining bytes while splitting */ + void** marray; /* either "chunks" or malloced ptr array */ + mchunkptr array_chunk; /* chunk for malloced ptr array */ + flag_t was_enabled; /* to disable mmap */ + size_t size; + size_t i; + + ensure_initialization(); + /* compute array length, if needed */ + if (chunks != 0) { + if (n_elements == 0) + return chunks; /* nothing to do */ + marray = chunks; + array_size = 0; + } + else { + /* if empty req, must still return chunk representing empty array */ + if (n_elements == 0) + return (void**)internal_malloc(m, 0); + marray = 0; + array_size = request2size(n_elements * (sizeof(void*))); + } + + /* compute total element size */ + if (opts & 0x1) { /* all-same-size */ + element_size = request2size(*sizes); + contents_size = n_elements * element_size; + } + else { /* add up all the sizes */ + element_size = 0; + contents_size = 0; + for (i = 0; i != n_elements; ++i) + contents_size += request2size(sizes[i]); + } + + size = contents_size + array_size; + + /* + Allocate the aggregate chunk. First disable direct-mmapping so + malloc won't use it, since we would not be able to later + free/realloc space internal to a segregated mmap region. + */ + was_enabled = use_mmap(m); + disable_mmap(m); + mem = internal_malloc(m, size - CHUNK_OVERHEAD); + if (was_enabled) + enable_mmap(m); + if (mem == 0) + return 0; + + if (PREACTION(m)) return 0; + p = mem2chunk(mem); + remainder_size = chunksize(p); + + assert(!is_mmapped(p)); + + if (opts & 0x2) { /* optionally clear the elements */ + memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); + } + + /* If not provided, allocate the pointer array as final part of chunk */ + if (marray == 0) { + size_t array_chunk_size; + array_chunk = chunk_plus_offset(p, contents_size); + array_chunk_size = remainder_size - contents_size; + marray = (void**) (chunk2mem(array_chunk)); + set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); + remainder_size = contents_size; + } + + /* split out elements */ + for (i = 0; ; ++i) { + marray[i] = chunk2mem(p); + if (i != n_elements-1) { + if (element_size != 0) + size = element_size; + else + size = request2size(sizes[i]); + remainder_size -= size; + set_size_and_pinuse_of_inuse_chunk(m, p, size); + p = chunk_plus_offset(p, size); + } + else { /* the final element absorbs any overallocation slop */ + set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); + break; + } + } + +#if DEBUG + if (marray != chunks) { + /* final element must have exactly exhausted chunk */ + if (element_size != 0) { + assert(remainder_size == element_size); + } + else { + assert(remainder_size == request2size(sizes[i])); + } + check_inuse_chunk(m, mem2chunk(marray)); + } + for (i = 0; i != n_elements; ++i) + check_inuse_chunk(m, mem2chunk(marray[i])); + +#endif /* DEBUG */ + + POSTACTION(m); + return marray; +} + +/* Try to free all pointers in the given array. + Note: this could be made faster, by delaying consolidation, + at the price of disabling some user integrity checks, We + still optimize some consolidations by combining adjacent + chunks before freeing, which will occur often if allocated + with ialloc or the array is sorted. +*/ +static size_t internal_bulk_free(mstate m, void* array[], size_t nelem) { + size_t unfreed = 0; + if (!PREACTION(m)) { + void** a; + void** fence = &(array[nelem]); + for (a = array; a != fence; ++a) { + void* mem = *a; + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + size_t psize = chunksize(p); +#if FOOTERS + if (get_mstate_for(p) != m) { + ++unfreed; + continue; + } +#endif + check_inuse_chunk(m, p); + *a = 0; + if (RTCHECK(ok_address(m, p) && ok_inuse(p))) { + void ** b = a + 1; /* try to merge with next chunk */ + mchunkptr next = next_chunk(p); + if (b != fence && *b == chunk2mem(next)) { + size_t newsize = chunksize(next) + psize; + set_inuse(m, p, newsize); + *b = chunk2mem(p); + } + else + dispose_chunk(m, p, psize); + } + else { + CORRUPTION_ERROR_ACTION(m); + break; + } + } + } + if (should_trim(m, m->topsize)) + sys_trim(m, 0); + POSTACTION(m); + } + return unfreed; +} +#endif /* USE_MALLOC_DEPRECATED */ + +/* Traversal */ +#if MALLOC_INSPECT_ALL +static void internal_inspect_all(mstate m, + void(*handler)(void *start, + void *end, + size_t used_bytes, + void* callback_arg), + void* arg) { + if (is_initialized(m)) { + mchunkptr top = m->top; + msegmentptr s; + for (s = &m->seg; s != 0; s = s->next) { + mchunkptr q = align_as_chunk(s->base); + while (segment_holds(s, q) && q->head != FENCEPOST_HEAD) { + mchunkptr next = next_chunk(q); + size_t sz = chunksize(q); + size_t used; + void* start; + if (is_inuse(q)) { + used = sz - CHUNK_OVERHEAD; /* must not be mmapped */ + start = chunk2mem(q); + } + else { + used = 0; + if (is_small(sz)) { /* offset by possible bookkeeping */ + start = (void*)((char*)q + sizeof(struct malloc_chunk)); + } + else { + start = (void*)((char*)q + sizeof(struct malloc_tree_chunk)); + } + } + if (start < (void*)next) /* skip if all space is bookkeeping */ + handler(start, next, used, arg); + if (q == top) + break; + q = next; + } + } + } +} +#endif /* MALLOC_INSPECT_ALL */ + +/* ------------------ Exported realloc, memalign, etc -------------------- */ + +#if !ONLY_MSPACES + +void* dlrealloc(void* oldmem, size_t bytes) { + void* mem = 0; + if (oldmem == 0) { + mem = dlmalloc(bytes); + } + else if (bytes >= MAX_REQUEST) { + MALLOC_FAILURE_ACTION; + } +#ifdef REALLOC_ZERO_BYTES_FREES + else if (bytes == 0) { + dlfree(oldmem); + } +#endif /* REALLOC_ZERO_BYTES_FREES */ + else { + size_t nb = request2size(bytes); + mchunkptr oldp = mem2chunk(oldmem); +#if ! FOOTERS + mstate m = gm; +#else /* FOOTERS */ + mstate m = get_mstate_for(oldp); + if (!ok_magic(m)) { + USAGE_ERROR_ACTION(m, oldmem); + return 0; + } +#endif /* FOOTERS */ + if (!PREACTION(m)) { + mchunkptr newp = try_realloc_chunk(m, oldp, nb, 1); + POSTACTION(m); + if (newp != 0) { + check_inuse_chunk(m, newp); + mem = chunk2mem(newp); + } + else { + mem = internal_malloc(m, bytes); + if (mem != 0) { + size_t oc = chunksize(oldp) - overhead_for(oldp); + memcpy(mem, oldmem, (oc < bytes)? oc : bytes); +#ifdef _TLIBC_ + /* Zero recycled chunk */ + memset(oldmem, 0, oc); +#endif + internal_free(m, oldmem); + } + } + } + } + return mem; +} + +#ifdef USE_MALLOC_DEPRECATED +void* dlrealloc_in_place(void* oldmem, size_t bytes) { + void* mem = 0; + if (oldmem != 0) { + if (bytes >= MAX_REQUEST) { + MALLOC_FAILURE_ACTION; + } + else { + size_t nb = request2size(bytes); + mchunkptr oldp = mem2chunk(oldmem); +#if ! FOOTERS + mstate m = gm; +#else /* FOOTERS */ + mstate m = get_mstate_for(oldp); + if (!ok_magic(m)) { + USAGE_ERROR_ACTION(m, oldmem); + return 0; + } +#endif /* FOOTERS */ + if (!PREACTION(m)) { + mchunkptr newp = try_realloc_chunk(m, oldp, nb, 0); + POSTACTION(m); + if (newp == oldp) { + check_inuse_chunk(m, newp); + mem = oldmem; + } + } + } + } + return mem; +} +#endif + +void* dlmemalign(size_t alignment, size_t bytes) { + if (alignment <= MALLOC_ALIGNMENT) { + return dlmalloc(bytes); + } + return internal_memalign(gm, alignment, bytes); +} + +#ifdef USE_MALLOC_DEPRECATED +int dlposix_memalign(void** pp, size_t alignment, size_t bytes) { + void* mem = 0; + if (alignment == MALLOC_ALIGNMENT) + mem = dlmalloc(bytes); + else { + size_t d = alignment / sizeof(void*); + size_t r = alignment % sizeof(void*); + if (r != 0 || d == 0 || (d & (d-SIZE_T_ONE)) != 0) + return EINVAL; + else if (bytes <= MAX_REQUEST - alignment) { + if (alignment < MIN_CHUNK_SIZE) + alignment = MIN_CHUNK_SIZE; + mem = internal_memalign(gm, alignment, bytes); + } + } + if (mem == 0) + return ENOMEM; + else { + *pp = mem; + return 0; + } +} + +void* dlvalloc(size_t bytes) { + size_t pagesz; + ensure_initialization(); + pagesz = mparams.page_size; + return dlmemalign(pagesz, bytes); +} + +void* dlpvalloc(size_t bytes) { + size_t pagesz; + ensure_initialization(); + pagesz = mparams.page_size; + return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); +} + +void** dlindependent_calloc(size_t n_elements, size_t elem_size, + void* chunks[]) { + size_t sz = elem_size; /* serves as 1-element array */ + return ialloc(gm, n_elements, &sz, 3, chunks); +} + +void** dlindependent_comalloc(size_t n_elements, size_t sizes[], + void* chunks[]) { + return ialloc(gm, n_elements, sizes, 0, chunks); +} + +size_t dlbulk_free(void* array[], size_t nelem) { + return internal_bulk_free(gm, array, nelem); +} + +#if MALLOC_INSPECT_ALL +void dlmalloc_inspect_all(void(*handler)(void *start, + void *end, + size_t used_bytes, + void* callback_arg), + void* arg) { + ensure_initialization(); + if (!PREACTION(gm)) { + internal_inspect_all(gm, handler, arg); + POSTACTION(gm); + } +} +#endif /* MALLOC_INSPECT_ALL */ + +int dlmalloc_trim(size_t pad) { + int result = 0; + ensure_initialization(); + if (!PREACTION(gm)) { + result = sys_trim(gm, pad); + POSTACTION(gm); + } + return result; +} + +size_t dlmalloc_footprint(void) { + return gm->footprint; +} + +size_t dlmalloc_max_footprint(void) { + return gm->max_footprint; +} + +size_t dlmalloc_footprint_limit(void) { + size_t maf = gm->footprint_limit; + return maf == 0 ? MAX_SIZE_T : maf; +} + +size_t dlmalloc_set_footprint_limit(size_t bytes) { + size_t result; /* invert sense of 0 */ + if (bytes == 0) + result = granularity_align(1); /* Use minimal size */ + if (bytes == MAX_SIZE_T) + result = 0; /* disable */ + else + result = granularity_align(bytes); + return gm->footprint_limit = result; +} + +#endif /* USE_MALLOC_DEPRECATED */ + +#if !NO_MALLINFO +struct mallinfo dlmallinfo(void) { + return internal_mallinfo(gm); +} +#endif /* NO_MALLINFO */ + +#ifdef USE_MALLOC_DEPRECATED + +#if !NO_MALLOC_STATS +void dlmalloc_stats() { + internal_malloc_stats(gm); +} +#endif /* NO_MALLOC_STATS */ + +int dlmallopt(int param_number, int value) { + return change_mparam(param_number, value); +} + +size_t dlmalloc_usable_size(void* mem) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + if (is_inuse(p)) + return chunksize(p) - overhead_for(p); + } + return 0; +} + +#endif /* USE_MALLOC_DEPRECATED */ + +#endif /* !ONLY_MSPACES */ + +/* ----------------------------- user mspaces ---------------------------- */ + +#if MSPACES + +static mstate init_user_mstate(char* tbase, size_t tsize) { + size_t msize = pad_request(sizeof(struct malloc_state)); + mchunkptr mn; + mchunkptr msp = align_as_chunk(tbase); + mstate m = (mstate)(chunk2mem(msp)); + memset(m, 0, msize); + (void)INITIAL_LOCK(&m->mutex); + msp->head = (msize|INUSE_BITS); + m->seg.base = m->least_addr = tbase; + m->seg.size = m->footprint = m->max_footprint = tsize; + m->magic = mparams.magic; + m->release_checks = MAX_RELEASE_CHECK_RATE; + m->mflags = mparams.default_mflags; + m->extp = 0; + m->exts = 0; + disable_contiguous(m); + init_bins(m); + mn = next_chunk(mem2chunk(m)); + init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); + check_top_chunk(m, m->top); + return m; +} + +mspace create_mspace(size_t capacity, int locked) { + mstate m = 0; + size_t msize; + ensure_initialization(); + msize = pad_request(sizeof(struct malloc_state)); + if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { + size_t rs = ((capacity == 0)? mparams.granularity : + (capacity + TOP_FOOT_SIZE + msize)); + size_t tsize = granularity_align(rs); + char* tbase = (char*)(CALL_MMAP(tsize)); + if (tbase != CMFAIL) { + m = init_user_mstate(tbase, tsize); + m->seg.sflags = USE_MMAP_BIT; + set_lock(m, locked); + } + } + return (mspace)m; +} + +mspace create_mspace_with_base(void* base, size_t capacity, int locked) { + mstate m = 0; + size_t msize; + ensure_initialization(); + msize = pad_request(sizeof(struct malloc_state)); + if (capacity > msize + TOP_FOOT_SIZE && + capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { + m = init_user_mstate((char*)base, capacity); + m->seg.sflags = EXTERN_BIT; + set_lock(m, locked); + } + return (mspace)m; +} + +int mspace_track_large_chunks(mspace msp, int enable) { + int ret = 0; + mstate ms = (mstate)msp; + if (!PREACTION(ms)) { + if (!use_mmap(ms)) { + ret = 1; + } + if (!enable) { + enable_mmap(ms); + } else { + disable_mmap(ms); + } + POSTACTION(ms); + } + return ret; +} + +size_t destroy_mspace(mspace msp) { + size_t freed = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + msegmentptr sp = &ms->seg; + (void)DESTROY_LOCK(&ms->mutex); /* destroy before unmapped */ + while (sp != 0) { + char* base = sp->base; + size_t size = sp->size; + flag_t flag = sp->sflags; + (void)base; /* placate people compiling -Wunused-variable */ + sp = sp->next; + if ((flag & USE_MMAP_BIT) && !(flag & EXTERN_BIT) && + CALL_MUNMAP(base, size) == 0) + freed += size; + } + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return freed; +} + +/* + mspace versions of routines are near-clones of the global + versions. This is not so nice but better than the alternatives. +*/ + +void* mspace_malloc(mspace msp, size_t bytes) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + if (!PREACTION(ms)) { + void* mem; + size_t nb; + if (bytes <= MAX_SMALL_REQUEST) { + bindex_t idx; + binmap_t smallbits; + nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); + idx = small_index(nb); + smallbits = ms->smallmap >> idx; + + if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ + mchunkptr b, p; + idx += ~smallbits & 1; /* Uses next bin if idx empty */ + b = smallbin_at(ms, idx); + p = b->fd; + assert(chunksize(p) == small_index2size(idx)); + unlink_first_small_chunk(ms, b, p, idx); + set_inuse_and_pinuse(ms, p, small_index2size(idx)); + mem = chunk2mem(p); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + else if (nb > ms->dvsize) { + if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ + mchunkptr b, p, r; + size_t rsize; + bindex_t i; + binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); + binmap_t leastbit = least_bit(leftbits); + compute_bit2idx(leastbit, i); + b = smallbin_at(ms, i); + p = b->fd; + assert(chunksize(p) == small_index2size(i)); + unlink_first_small_chunk(ms, b, p, i); + rsize = small_index2size(i) - nb; + /* Fit here cannot be remainderless if 4byte sizes */ + if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(ms, p, small_index2size(i)); + else { + set_size_and_pinuse_of_inuse_chunk(ms, p, nb); + r = chunk_plus_offset(p, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + replace_dv(ms, r, rsize); + } + mem = chunk2mem(p); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + } + } + else if (bytes >= MAX_REQUEST) + nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ + else { + nb = pad_request(bytes); + if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + } + + if (nb <= ms->dvsize) { + size_t rsize = ms->dvsize - nb; + mchunkptr p = ms->dv; + if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ + mchunkptr r = ms->dv = chunk_plus_offset(p, nb); + ms->dvsize = rsize; + set_size_and_pinuse_of_free_chunk(r, rsize); + set_size_and_pinuse_of_inuse_chunk(ms, p, nb); + } + else { /* exhaust dv */ + size_t dvs = ms->dvsize; + ms->dvsize = 0; + ms->dv = 0; + set_inuse_and_pinuse(ms, p, dvs); + } + mem = chunk2mem(p); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + else if (nb < ms->topsize) { /* Split top */ + size_t rsize = ms->topsize -= nb; + mchunkptr p = ms->top; + mchunkptr r = ms->top = chunk_plus_offset(p, nb); + r->head = rsize | PINUSE_BIT; + set_size_and_pinuse_of_inuse_chunk(ms, p, nb); + mem = chunk2mem(p); + check_top_chunk(ms, ms->top); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + mem = sys_alloc(ms, nb); + + postaction: + POSTACTION(ms); + return mem; + } + + return 0; +} + +void mspace_free(mspace msp, void* mem) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); +#if FOOTERS + mstate fm = get_mstate_for(p); + (void)msp; /* placate people compiling -Wunused */ +#else /* FOOTERS */ + mstate fm = (mstate)msp; +#endif /* FOOTERS */ + if (!ok_magic(fm)) { + USAGE_ERROR_ACTION(fm, p); + return; + } + if (!PREACTION(fm)) { + check_inuse_chunk(fm, p); + if (RTCHECK(ok_address(fm, p) && ok_inuse(p))) { + size_t psize = chunksize(p); + mchunkptr next = chunk_plus_offset(p, psize); + if (!pinuse(p)) { + size_t prevsize = p->prev_foot; + if (is_mmapped(p)) { + psize += prevsize + MMAP_FOOT_PAD; + if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) + fm->footprint -= psize; + goto postaction; + } + else { + mchunkptr prev = chunk_minus_offset(p, prevsize); + psize += prevsize; + p = prev; + if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ + if (p != fm->dv) { + unlink_chunk(fm, p, prevsize); + } + else if ((next->head & INUSE_BITS) == INUSE_BITS) { + fm->dvsize = psize; + set_free_with_pinuse(p, psize, next); + goto postaction; + } + } + else + goto erroraction; + } + } + + if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { + if (!cinuse(next)) { /* consolidate forward */ + if (next == fm->top) { + size_t tsize = fm->topsize += psize; + fm->top = p; + p->head = tsize | PINUSE_BIT; + if (p == fm->dv) { + fm->dv = 0; + fm->dvsize = 0; + } + if (should_trim(fm, tsize)) + sys_trim(fm, 0); + goto postaction; + } + else if (next == fm->dv) { + size_t dsize = fm->dvsize += psize; + fm->dv = p; + set_size_and_pinuse_of_free_chunk(p, dsize); + goto postaction; + } + else { + size_t nsize = chunksize(next); + psize += nsize; + unlink_chunk(fm, next, nsize); + set_size_and_pinuse_of_free_chunk(p, psize); + if (p == fm->dv) { + fm->dvsize = psize; + goto postaction; + } + } + } + else + set_free_with_pinuse(p, psize, next); + + if (is_small(psize)) { + insert_small_chunk(fm, p, psize); + check_free_chunk(fm, p); + } + else { + tchunkptr tp = (tchunkptr)p; + insert_large_chunk(fm, tp, psize); + check_free_chunk(fm, p); + if (--fm->release_checks == 0) + release_unused_segments(fm); + } + goto postaction; + } + } + erroraction: + USAGE_ERROR_ACTION(fm, p); + postaction: + POSTACTION(fm); + } + } +} + +void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { + void* mem; + size_t req = 0; + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + if (n_elements != 0) { + req = n_elements * elem_size; + if (((n_elements | elem_size) & ~(size_t)0xffff) && + (req / n_elements != elem_size)) + req = MAX_SIZE_T; /* force downstream failure on overflow */ + } + mem = internal_malloc(ms, req); + if (mem != 0 && calloc_must_clear(mem2chunk(mem))) + memset(mem, 0, req); + return mem; +} + +void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { + void* mem = 0; + if (oldmem == 0) { + mem = mspace_malloc(msp, bytes); + } + else if (bytes >= MAX_REQUEST) { + MALLOC_FAILURE_ACTION; + } +#ifdef REALLOC_ZERO_BYTES_FREES + else if (bytes == 0) { + mspace_free(msp, oldmem); + } +#endif /* REALLOC_ZERO_BYTES_FREES */ + else { + size_t nb = request2size(bytes); + mchunkptr oldp = mem2chunk(oldmem); +#if ! FOOTERS + mstate m = (mstate)msp; +#else /* FOOTERS */ + mstate m = get_mstate_for(oldp); + if (!ok_magic(m)) { + USAGE_ERROR_ACTION(m, oldmem); + return 0; + } +#endif /* FOOTERS */ + if (!PREACTION(m)) { + mchunkptr newp = try_realloc_chunk(m, oldp, nb, 1); + POSTACTION(m); + if (newp != 0) { + check_inuse_chunk(m, newp); + mem = chunk2mem(newp); + } + else { + mem = mspace_malloc(m, bytes); + if (mem != 0) { + size_t oc = chunksize(oldp) - overhead_for(oldp); + memcpy(mem, oldmem, (oc < bytes)? oc : bytes); + mspace_free(m, oldmem); + } + } + } + } + return mem; +} + +void* mspace_realloc_in_place(mspace msp, void* oldmem, size_t bytes) { + void* mem = 0; + if (oldmem != 0) { + if (bytes >= MAX_REQUEST) { + MALLOC_FAILURE_ACTION; + } + else { + size_t nb = request2size(bytes); + mchunkptr oldp = mem2chunk(oldmem); +#if ! FOOTERS + mstate m = (mstate)msp; +#else /* FOOTERS */ + mstate m = get_mstate_for(oldp); + (void)msp; /* placate people compiling -Wunused */ + if (!ok_magic(m)) { + USAGE_ERROR_ACTION(m, oldmem); + return 0; + } +#endif /* FOOTERS */ + if (!PREACTION(m)) { + mchunkptr newp = try_realloc_chunk(m, oldp, nb, 0); + POSTACTION(m); + if (newp == oldp) { + check_inuse_chunk(m, newp); + mem = oldmem; + } + } + } + } + return mem; +} + +void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + if (alignment <= MALLOC_ALIGNMENT) + return mspace_malloc(msp, bytes); + return internal_memalign(ms, alignment, bytes); +} + +void** mspace_independent_calloc(mspace msp, size_t n_elements, + size_t elem_size, void* chunks[]) { + size_t sz = elem_size; /* serves as 1-element array */ + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + return ialloc(ms, n_elements, &sz, 3, chunks); +} + +void** mspace_independent_comalloc(mspace msp, size_t n_elements, + size_t sizes[], void* chunks[]) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + return ialloc(ms, n_elements, sizes, 0, chunks); +} + +size_t mspace_bulk_free(mspace msp, void* array[], size_t nelem) { + return internal_bulk_free((mstate)msp, array, nelem); +} + +#if MALLOC_INSPECT_ALL +void mspace_inspect_all(mspace msp, + void(*handler)(void *start, + void *end, + size_t used_bytes, + void* callback_arg), + void* arg) { + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + if (!PREACTION(ms)) { + internal_inspect_all(ms, handler, arg); + POSTACTION(ms); + } + } + else { + USAGE_ERROR_ACTION(ms,ms); + } +} +#endif /* MALLOC_INSPECT_ALL */ + +int mspace_trim(mspace msp, size_t pad) { + int result = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + if (!PREACTION(ms)) { + result = sys_trim(ms, pad); + POSTACTION(ms); + } + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return result; +} + +#if !NO_MALLOC_STATS +void mspace_malloc_stats(mspace msp) { + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + internal_malloc_stats(ms); + } + else { + USAGE_ERROR_ACTION(ms,ms); + } +} +#endif /* NO_MALLOC_STATS */ + +size_t mspace_footprint(mspace msp) { + size_t result = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + result = ms->footprint; + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return result; +} + +size_t mspace_max_footprint(mspace msp) { + size_t result = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + result = ms->max_footprint; + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return result; +} + +size_t mspace_footprint_limit(mspace msp) { + size_t result = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + size_t maf = ms->footprint_limit; + result = (maf == 0) ? MAX_SIZE_T : maf; + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return result; +} + +size_t mspace_set_footprint_limit(mspace msp, size_t bytes) { + size_t result = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + if (bytes == 0) + result = granularity_align(1); /* Use minimal size */ + if (bytes == MAX_SIZE_T) + result = 0; /* disable */ + else + result = granularity_align(bytes); + ms->footprint_limit = result; + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return result; +} + +#if !NO_MALLINFO +struct mallinfo mspace_mallinfo(mspace msp) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + } + return internal_mallinfo(ms); +} +#endif /* NO_MALLINFO */ + +size_t mspace_usable_size(const void* mem) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + if (is_inuse(p)) + return chunksize(p) - overhead_for(p); + } + return 0; +} + +int mspace_mallopt(int param_number, int value) { + return change_mparam(param_number, value); +} + +#endif /* MSPACES */ + + +/* -------------------- Alternative MORECORE functions ------------------- */ + +/* + Guidelines for creating a custom version of MORECORE: + + * For best performance, MORECORE should allocate in multiples of pagesize. + * MORECORE may allocate more memory than requested. (Or even less, + but this will usually result in a malloc failure.) + * MORECORE must not allocate memory when given argument zero, but + instead return one past the end address of memory from previous + nonzero call. + * For best performance, consecutive calls to MORECORE with positive + arguments should return increasing addresses, indicating that + space has been contiguously extended. + * Even though consecutive calls to MORECORE need not return contiguous + addresses, it must be OK for malloc'ed chunks to span multiple + regions in those cases where they do happen to be contiguous. + * MORECORE need not handle negative arguments -- it may instead + just return MFAIL when given negative arguments. + Negative arguments are always multiples of pagesize. MORECORE + must not misinterpret negative args as large positive unsigned + args. You can suppress all such calls from even occurring by defining + MORECORE_CANNOT_TRIM, + + As an example alternative MORECORE, here is a custom allocator + kindly contributed for pre-OSX macOS. It uses virtually but not + necessarily physically contiguous non-paged memory (locked in, + present and won't get swapped out). You can use it by uncommenting + this section, adding some #includes, and setting up the appropriate + defines above: + + #define MORECORE osMoreCore + + There is also a shutdown routine that should somehow be called for + cleanup upon program exit. + + #define MAX_POOL_ENTRIES 100 + #define MINIMUM_MORECORE_SIZE (64 * 1024U) + static int next_os_pool; + void *our_os_pools[MAX_POOL_ENTRIES]; + + void *osMoreCore(int size) + { + void *ptr = 0; + static void *sbrk_top = 0; + + if (size > 0) + { + if (size < MINIMUM_MORECORE_SIZE) + size = MINIMUM_MORECORE_SIZE; + if (CurrentExecutionLevel() == kTaskLevel) + ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); + if (ptr == 0) + { + return (void *) MFAIL; + } + // save ptrs so they can be freed during cleanup + our_os_pools[next_os_pool] = ptr; + next_os_pool++; + ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); + sbrk_top = (char *) ptr + size; + return ptr; + } + else if (size < 0) + { + // we don't currently support shrink behavior + return (void *) MFAIL; + } + else + { + return sbrk_top; + } + } + + // cleanup any allocated memory pools + // called as last thing before shutting down driver + + void osCleanupMem(void) + { + void **ptr; + + for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) + if (*ptr) + { + PoolDeallocate(*ptr); + *ptr = 0; + } + } + +*/ + + +/* ----------------------------------------------------------------------- +History: + v2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea + * fix bad comparison in dlposix_memalign + * don't reuse adjusted asize in sys_alloc + * add LOCK_AT_FORK -- thanks to Kirill Artamonov for the suggestion + * reduce compiler warnings -- thanks to all who reported/suggested these + + v2.8.5 Sun May 22 10:26:02 2011 Doug Lea (dl at gee) + * Always perform unlink checks unless INSECURE + * Add posix_memalign. + * Improve realloc to expand in more cases; expose realloc_in_place. + Thanks to Peter Buhr for the suggestion. + * Add footprint_limit, inspect_all, bulk_free. Thanks + to Barry Hayes and others for the suggestions. + * Internal refactorings to avoid calls while holding locks + * Use non-reentrant locks by default. Thanks to Roland McGrath + for the suggestion. + * Small fixes to mspace_destroy, reset_on_error. + * Various configuration extensions/changes. Thanks + to all who contributed these. + + V2.8.4a Thu Apr 28 14:39:43 2011 (dl at gee.cs.oswego.edu) + * Update Creative Commons URL + + V2.8.4 Wed May 27 09:56:23 2009 Doug Lea (dl at gee) + * Use zeros instead of prev foot for is_mmapped + * Add mspace_track_large_chunks; thanks to Jean Brouwers + * Fix set_inuse in internal_realloc; thanks to Jean Brouwers + * Fix insufficient sys_alloc padding when using 16byte alignment + * Fix bad error check in mspace_footprint + * Adaptations for ptmalloc; thanks to Wolfram Gloger. + * Reentrant spin locks; thanks to Earl Chew and others + * Win32 improvements; thanks to Niall Douglas and Earl Chew + * Add NO_SEGMENT_TRAVERSAL and MAX_RELEASE_CHECK_RATE options + * Extension hook in malloc_state + * Various small adjustments to reduce warnings on some compilers + * Various configuration extensions/changes for more platforms. Thanks + to all who contributed these. + + V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) + * Add max_footprint functions + * Ensure all appropriate literals are size_t + * Fix conditional compilation problem for some #define settings + * Avoid concatenating segments with the one provided + in create_mspace_with_base + * Rename some variables to avoid compiler shadowing warnings + * Use explicit lock initialization. + * Better handling of sbrk interference. + * Simplify and fix segment insertion, trimming and mspace_destroy + * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x + * Thanks especially to Dennis Flanagan for help on these. + + V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) + * Fix memalign brace error. + + V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) + * Fix improper #endif nesting in C++ + * Add explicit casts needed for C++ + + V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) + * Use trees for large bins + * Support mspaces + * Use segments to unify sbrk-based and mmap-based system allocation, + removing need for emulation on most platforms without sbrk. + * Default safety checks + * Optional footer checks. Thanks to William Robertson for the idea. + * Internal code refactoring + * Incorporate suggestions and platform-specific changes. + Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, + Aaron Bachmann, Emery Berger, and others. + * Speed up non-fastbin processing enough to remove fastbins. + * Remove useless cfree() to avoid conflicts with other apps. + * Remove internal memcpy, memset. Compilers handle builtins better. + * Remove some options that no one ever used and rename others. + + V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) + * Fix malloc_state bitmap array misdeclaration + + V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) + * Allow tuning of FIRST_SORTED_BIN_SIZE + * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. + * Better detection and support for non-contiguousness of MORECORE. + Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger + * Bypass most of malloc if no frees. Thanks To Emery Berger. + * Fix freeing of old top non-contiguous chunk im sysmalloc. + * Raised default trim and map thresholds to 256K. + * Fix mmap-related #defines. Thanks to Lubos Lunak. + * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. + * Branch-free bin calculation + * Default trim and mmap thresholds now 256K. + + V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) + * Introduce independent_comalloc and independent_calloc. + Thanks to Michael Pachos for motivation and help. + * Make optional .h file available + * Allow > 2GB requests on 32bit systems. + * new WIN32 sbrk, mmap, munmap, lock code from . + Thanks also to Andreas Mueller , + and Anonymous. + * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for + helping test this.) + * memalign: check alignment arg + * realloc: don't try to shift chunks backwards, since this + leads to more fragmentation in some programs and doesn't + seem to help in any others. + * Collect all cases in malloc requiring system memory into sysmalloc + * Use mmap as backup to sbrk + * Place all internal state in malloc_state + * Introduce fastbins (although similar to 2.5.1) + * Many minor tunings and cosmetic improvements + * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK + * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS + Thanks to Tony E. Bennett and others. + * Include errno.h to support default failure action. + + V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) + * return null for negative arguments + * Added Several WIN32 cleanups from Martin C. Fong + * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' + (e.g. WIN32 platforms) + * Cleanup header file inclusion for WIN32 platforms + * Cleanup code to avoid Microsoft Visual C++ compiler complaints + * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing + memory allocation routines + * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) + * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to + usage of 'assert' in non-WIN32 code + * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to + avoid infinite loop + * Always call 'fREe()' rather than 'free()' + + V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) + * Fixed ordering problem with boundary-stamping + + V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) + * Added pvalloc, as recommended by H.J. Liu + * Added 64bit pointer support mainly from Wolfram Gloger + * Added anonymously donated WIN32 sbrk emulation + * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen + * malloc_extend_top: fix mask error that caused wastage after + foreign sbrks + * Add linux mremap support code from HJ Liu + + V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) + * Integrated most documentation with the code. + * Add support for mmap, with help from + Wolfram Gloger (Gloger@lrz.uni-muenchen.de). + * Use last_remainder in more cases. + * Pack bins using idea from colin@nyx10.cs.du.edu + * Use ordered bins instead of best-fit threshhold + * Eliminate block-local decls to simplify tracing and debugging. + * Support another case of realloc via move into top + * Fix error occuring when initial sbrk_base not word-aligned. + * Rely on page size for units instead of SBRK_UNIT to + avoid surprises about sbrk alignment conventions. + * Add mallinfo, mallopt. Thanks to Raymond Nijssen + (raymond@es.ele.tue.nl) for the suggestion. + * Add `pad' argument to malloc_trim and top_pad mallopt parameter. + * More precautions for cases where other routines call sbrk, + courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). + * Added macros etc., allowing use in linux libc from + H.J. Lu (hjl@gnu.ai.mit.edu) + * Inverted this history list + + V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) + * Re-tuned and fixed to behave more nicely with V2.6.0 changes. + * Removed all preallocation code since under current scheme + the work required to undo bad preallocations exceeds + the work saved in good cases for most test programs. + * No longer use return list or unconsolidated bins since + no scheme using them consistently outperforms those that don't + given above changes. + * Use best fit for very large chunks to prevent some worst-cases. + * Added some support for debugging + + V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) + * Removed footers when chunks are in use. Thanks to + Paul Wilson (wilson@cs.texas.edu) for the suggestion. + + V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) + * Added malloc_trim, with help from Wolfram Gloger + (wmglo@Dent.MED.Uni-Muenchen.DE). + + V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) + + V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) + * realloc: try to expand in both directions + * malloc: swap order of clean-bin strategy; + * realloc: only conditionally expand backwards + * Try not to scavenge used bins + * Use bin counts as a guide to preallocation + * Occasionally bin return list chunks in first scan + * Add a few optimizations from colin@nyx10.cs.du.edu + + V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) + * faster bin computation & slightly different binning + * merged all consolidations to one part of malloc proper + (eliminating old malloc_find_space & malloc_clean_bin) + * Scan 2 returns chunks (not just 1) + * Propagate failure in realloc if malloc returns 0 + * Add stuff to allow compilation on non-ANSI compilers + from kpv@research.att.com + + V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) + * removed potential for odd address access in prev_chunk + * removed dependency on getpagesize.h + * misc cosmetics and a bit more internal documentation + * anticosmetics: mangled names in macros to evade debugger strangeness + * tested on sparc, hp-700, dec-mips, rs6000 + with gcc & native cc (hp, dec only) allowing + Detlefs & Zorn comparison study (in SIGPLAN Notices.) + + Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) + * Based loosely on libg++-1.2X malloc. (It retains some of the overall + structure of old version, but most details differ.) + +*/ diff --git a/sdk/tlibc/stdlib/qsort.c b/sdk/tlibc/stdlib/qsort.c new file mode 100644 index 0000000000..8a8b978534 --- /dev/null +++ b/sdk/tlibc/stdlib/qsort.c @@ -0,0 +1,164 @@ +/* $OpenBSD: qsort.c,v 1.11 2010/02/08 11:04:07 otto Exp $ */ +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +static __inline char *med3(char *, char *, char *, int (*)(const void *, const void *)); +static __inline void swapfunc(char *, char *, size_t, int); + +#define min(a, b) (a) < (b) ? a : b + +/* + * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". + */ +#define swapcode(TYPE, parmi, parmj, n) { \ + size_t i = (n) / sizeof (TYPE); \ + TYPE *pi = (TYPE *) (parmi); \ + TYPE *pj = (TYPE *) (parmj); \ + do { \ + TYPE t = *pi; \ + *pi++ = *pj; \ + *pj++ = t; \ + } while (--i > 0); \ +} + +#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ + es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; + +static __inline void +swapfunc(char *a, char *b, size_t n, int swaptype) +{ + if (swaptype <= 1) + swapcode(long, a, b, n) + else + swapcode(char, a, b, n) +} + +#define swap(a, b) \ + if (swaptype == 0) { \ + long t = *(long *)(a); \ + *(long *)(a) = *(long *)(b); \ + *(long *)(b) = t; \ + } else \ + swapfunc(a, b, es, swaptype) + +#define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) + +static __inline char * +med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *)) +{ + return cmp(a, b) < 0 ? + (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) + :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c )); +} + +/* Disable warnings */ + +void +qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *)) +{ + char *pa, *pb, *pc, *pd, *pl, *pm, *pn; + int cmp_result, swaptype, swap_cnt; + size_t d, r; + char *a = (char *)aa; + +loop: SWAPINIT(a, es); + swap_cnt = 0; + if (n < 7) { + for (pm = (char *)a + es; pm < (char *) a + n * es; pm += es) + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; + pl -= es) + swap(pl, pl - es); + return; + } + pm = (char *)a + (n / 2) * es; + if (n > 7) { + pl = (char *)a; + pn = (char *)a + (n - 1) * es; + if (n > 40) { + d = (n / 8) * es; + pl = med3(pl, pl + d, pl + 2 * d, cmp); + pm = med3(pm - d, pm, pm + d, cmp); + pn = med3(pn - 2 * d, pn - d, pn, cmp); + } + pm = med3(pl, pm, pn, cmp); + } + swap(a, pm); + pa = pb = (char *)a + es; + + pc = pd = (char *)a + (n - 1) * es; + for (;;) { + while (pb <= pc && (cmp_result = cmp(pb, a)) <= 0) { + if (cmp_result == 0) { + swap_cnt = 1; + swap(pa, pb); + pa += es; + } + pb += es; + } + while (pb <= pc && (cmp_result = cmp(pc, a)) >= 0) { + if (cmp_result == 0) { + swap_cnt = 1; + swap(pc, pd); + pd -= es; + } + pc -= es; + } + if (pb > pc) + break; + swap(pb, pc); + swap_cnt = 1; + pb += es; + pc -= es; + } + if (swap_cnt == 0) { /* Switch to insertion sort */ + for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; + pl -= es) + swap(pl, pl - es); + return; + } + + pn = (char *)a + n * es; + r = min(pa - (char *)a, pb - pa); + vecswap(a, pb - r, r); + r = min(pd - pc, pn - pd - es); + vecswap(pb, pn - r, r); + if ((r = pb - pa) > es) + qsort(a, r / es, es, cmp); + if ((r = pd - pc) > es) { + /* Iterate rather than recurse to save stack space */ + a = pn - r; + n = r / es; + goto loop; + } +/* qsort(pn - r, r / es, es, cmp);*/ +} diff --git a/sdk/tlibc/stdlib/strtoimax.c b/sdk/tlibc/stdlib/strtoimax.c new file mode 100644 index 0000000000..2c77f41650 --- /dev/null +++ b/sdk/tlibc/stdlib/strtoimax.c @@ -0,0 +1,140 @@ +/* $OpenBSD: strtoimax.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ + +/*- + * Copyright (c) 1992 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* + * Convert a string to an intmax_t + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +intmax_t +strtoimax(const char *nptr, char **endptr, int base) +{ + const char *s; + intmax_t acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for intmax_t is + * [-9223372036854775808..9223372036854775807] and the input base + * is 10, cutoff will be set to 922337203685477580 and cutlim to + * either 7 (neg==0) or 8 (neg==1), meaning that if we have + * accumulated a value > 922337203685477580, or equal but the + * next digit is > 7 (or 8), the number is too big, and we will + * return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? INTMAX_MIN : INTMAX_MAX; + cutlim = cutoff % base; + cutoff /= base; + if (neg) { + if (cutlim > 0) { + cutlim -= base; + cutoff += 1; + } + cutlim = -cutlim; + } + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (neg) { + if (acc < cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = INTMAX_MIN; + errno = ERANGE; + } else { + any = 1; + acc *= base; + acc -= c; + } + } else { + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = INTMAX_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= base; + acc += c; + } + } + } + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} diff --git a/sdk/tlibc/stdlib/strtol.c b/sdk/tlibc/stdlib/strtol.c new file mode 100644 index 0000000000..dc2cf8871c --- /dev/null +++ b/sdk/tlibc/stdlib/strtol.c @@ -0,0 +1,151 @@ +/* $OpenBSD: strtol.c,v 1.9 2013/04/17 17:40:35 tedu Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + + +/* + * Convert a string to a long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +long +strtol(const char *nptr, char **endptr, int base) +{ + const char *s; + long acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * Ensure that base is between 2 and 36 inclusive, or the special + * value of 0. + */ + if (base != 0 && (base < 2 || base > 36)) { + if (endptr != 0) + *endptr = (char *)nptr; + errno = EINVAL; + return 0; + } + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? LONG_MIN : LONG_MAX; + cutlim = cutoff % base; + cutoff /= base; + if (neg) { + if (cutlim > 0) { + cutlim -= base; + cutoff += 1; + } + cutlim = -cutlim; + } + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (neg) { + if (acc < cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = LONG_MIN; + errno = ERANGE; + } else { + any = 1; + acc *= base; + acc -= c; + } + } else { + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = LONG_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= base; + acc += c; + } + } + } + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} diff --git a/sdk/tlibc/stdlib/strtoll.c b/sdk/tlibc/stdlib/strtoll.c new file mode 100644 index 0000000000..ffb4eb526a --- /dev/null +++ b/sdk/tlibc/stdlib/strtoll.c @@ -0,0 +1,143 @@ +/* $OpenBSD: strtoll.c,v 1.7 2013/03/28 18:09:38 martynas Exp $ */ +/*- + * Copyright (c) 1992 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +/* + * Convert a string to a long long. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +long long +strtoll(const char *nptr, char **endptr, int base) +{ + const char *s; + long long acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for long longs is + * [-9223372036854775808..9223372036854775807] and the input base + * is 10, cutoff will be set to 922337203685477580 and cutlim to + * either 7 (neg==0) or 8 (neg==1), meaning that if we have + * accumulated a value > 922337203685477580, or equal but the + * next digit is > 7 (or 8), the number is too big, and we will + * return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? LLONG_MIN : LLONG_MAX; + cutlim = cutoff % base; + cutoff /= base; + if (neg) { + if (cutlim > 0) { + cutlim -= base; + cutoff += 1; + } + cutlim = -cutlim; + } + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (neg) { + if (acc < cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = LLONG_MIN; + errno = ERANGE; + } else { + any = 1; + acc *= base; + acc -= c; + } + } else { + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = LLONG_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= base; + acc += c; + } + } + } + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} + diff --git a/sdk/tlibc/stdlib/strtoul.c b/sdk/tlibc/stdlib/strtoul.c new file mode 100644 index 0000000000..f33c818510 --- /dev/null +++ b/sdk/tlibc/stdlib/strtoul.c @@ -0,0 +1,104 @@ +/* $OpenBSD: strtoul.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */ +/* + * Copyright (c) 1990 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +/* Disable warnings */ + +/* + * Convert a string to an unsigned long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +unsigned long +strtoul(const char *nptr, char **endptr, int base) +{ + const char *s; + unsigned long acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * See strtol for comments as to the logic used. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + cutoff = ULONG_MAX / (unsigned long)base; + cutlim = ULONG_MAX % (unsigned long)base; + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = ULONG_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= (unsigned long)base; + acc += c; + } + } + if (neg && any > 0) + acc = -acc; + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} diff --git a/sdk/tlibc/stdlib/strtoull.c b/sdk/tlibc/stdlib/strtoull.c new file mode 100644 index 0000000000..9bb4477486 --- /dev/null +++ b/sdk/tlibc/stdlib/strtoull.c @@ -0,0 +1,107 @@ +/* $OpenBSD: strtoull.c,v 1.6 2013/03/28 18:09:38 martynas Exp $ */ +/*- + * Copyright (c) 1992 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +/* Disable warnings */ + +/* + * Convert a string to an unsigned long long. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +unsigned long long +strtoull(const char *nptr, char **endptr, int base) +{ + const char *s; + unsigned long long acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * See strtoq for comments as to the logic used. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + cutoff = ULLONG_MAX / (unsigned long long)base; + cutlim = ULLONG_MAX % (unsigned long long)base; + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = ULLONG_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= (unsigned long long)base; + acc += c; + } + } + if (neg && any > 0) + acc = -acc; + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} + diff --git a/sdk/tlibc/stdlib/strtoumax.c b/sdk/tlibc/stdlib/strtoumax.c new file mode 100644 index 0000000000..f4dab52391 --- /dev/null +++ b/sdk/tlibc/stdlib/strtoumax.c @@ -0,0 +1,104 @@ +/* $OpenBSD: strtoumax.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ + +/*- + * Copyright (c) 1992 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* Disable warnings */ + +/* + * Convert a string to a uintmax_t. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ +uintmax_t +strtoumax(const char *nptr, char **endptr, int base) +{ + const char *s; + uintmax_t acc, cutoff; + int c; + int neg, any, cutlim; + + /* + * See strtoq for comments as to the logic used. + */ + s = nptr; + do { + c = (unsigned char) *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + cutoff = UINTMAX_MAX / (uintmax_t)base; + cutlim = UINTMAX_MAX % (uintmax_t)base; + for (acc = 0, any = 0;; c = (unsigned char) *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0) + continue; + if (acc > cutoff || (acc == cutoff && c > cutlim)) { + any = -1; + acc = UINTMAX_MAX; + errno = ERANGE; + } else { + any = 1; + acc *= (uintmax_t)base; + acc += c; + } + } + if (neg && any > 0) + acc = -acc; + if (endptr != 0) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} diff --git a/sdk/tlibc/string/bcmp.c b/sdk/tlibc/string/bcmp.c new file mode 100644 index 0000000000..79a2382aee --- /dev/null +++ b/sdk/tlibc/string/bcmp.c @@ -0,0 +1,51 @@ +/* $OpenBSD: bcmp.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */ + +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * bcmp -- vax cmpc3 instruction + */ +int +bcmp(const void *b1, const void *b2, size_t length) +{ + char *p1, *p2; + + if (length == 0) + return (0); + p1 = (char *)b1; + p2 = (char *)b2; + do + if (*p1++ != *p2++) + return (1); + while (--length); + return (0); +} diff --git a/sdk/tlibc/string/bcopy.c b/sdk/tlibc/string/bcopy.c new file mode 100644 index 0000000000..d9195c1fdf --- /dev/null +++ b/sdk/tlibc/string/bcopy.c @@ -0,0 +1,112 @@ +/* $OpenBSD: bcopy.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef long word; /* "word" used for optimal copy speed */ + +#define wsize sizeof(word) +#define wmask (wsize - 1) + +/* + * Copy a block of memory, handling overlap. + */ +void +bcopy(const void *src0, void *dst0, size_t length) +{ + char *dst = dst0; + const char *src = src0; + size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#define TLOOP(s) if (t) TLOOP1(s) +#define TLOOP1(s) do { s; } while (--t) + + if ((unsigned long)dst < (unsigned long)src) { + /* + * Copy forward. + */ + t = (long)src; /* only need low bits */ + if ((t | (long)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (long)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); + } else { + /* + * Copy backwards. Otherwise essentially the same. + * Alignment works as before, except that it takes + * (t&wmask) bytes to align, not wsize-(t&wmask). + */ + src += length; + dst += length; + t = (long)src; + if ((t | (long)dst) & wmask) { + if ((t ^ (long)dst) & wmask || length <= wsize) + t = length; + else + t &= wmask; + length -= t; + TLOOP1(*--dst = *--src); + } + t = length / wsize; + TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + t = length & wmask; + TLOOP(*--dst = *--src); + } +done: + return; +} diff --git a/sdk/tlibc/string/bzero.c b/sdk/tlibc/string/bzero.c new file mode 100644 index 0000000000..79bfcf3443 --- /dev/null +++ b/sdk/tlibc/string/bzero.c @@ -0,0 +1,44 @@ +/* $OpenBSD: bzero.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ + +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * bzero -- vax movc5 instruction + */ +void +bzero(void *b, size_t length) +{ + char *p; + + for (p =(char *) b; length--;) + *p++ = '\0'; +} diff --git a/sdk/tlibc/string/consttime_memequal.c b/sdk/tlibc/string/consttime_memequal.c new file mode 100644 index 0000000000..d10a5092dc --- /dev/null +++ b/sdk/tlibc/string/consttime_memequal.c @@ -0,0 +1,29 @@ +/* $NetBSD: consttime_memequal.c,v 1.6 2015/03/18 20:11:35 riastradh Exp $ */ + +/* + * Written by Matthias Drochner . + * Public domain. + */ + +#include + +int +consttime_memequal(const void *b1, const void *b2, size_t len) +{ + const unsigned char *c1 = b1, *c2 = b2; + unsigned int res = 0; + + while (len--) + res |= *c1++ ^ *c2++; + + /* + * Map 0 to 1 and [1, 256) to 0 using only constant-time + * arithmetic. + * + * This is not simply `!res' because although many CPUs support + * branchless conditional moves and many compilers will take + * advantage of them, certain compilers generate branches on + * certain CPUs for `!res'. + */ + return (1 & ((res - 1) >> 8)); +} diff --git a/sdk/tlibc/string/ffs.c b/sdk/tlibc/string/ffs.c new file mode 100644 index 0000000000..794d4028a3 --- /dev/null +++ b/sdk/tlibc/string/ffs.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +/* + * Find first set bit in an integer + */ +int ffs(int mask) +{ + return __builtin_ffs(mask); +} diff --git a/sdk/tlibc/string/ffsl.c b/sdk/tlibc/string/ffsl.c new file mode 100644 index 0000000000..0ae742fbff --- /dev/null +++ b/sdk/tlibc/string/ffsl.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +/* + * Find first set bit in Long + */ +int ffsl(long int mask) +{ + return __builtin_ffsl(mask); +} diff --git a/sdk/tlibc/string/ffsll.c b/sdk/tlibc/string/ffsll.c new file mode 100644 index 0000000000..443ff895a4 --- /dev/null +++ b/sdk/tlibc/string/ffsll.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +/* + * Find first set bit in LongLong + */ +int ffsll(long long int mask) +{ + return __builtin_ffsll(mask); +} diff --git a/sdk/tlibc/string/index.c b/sdk/tlibc/string/index.c new file mode 100644 index 0000000000..ff57250b17 --- /dev/null +++ b/sdk/tlibc/string/index.c @@ -0,0 +1,38 @@ +/* $OpenBSD: index.c,v 1.5 2005/08/08 08:05:37 espie Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +char * +index(const char *p, int ch) +{ + return strchr(p, ch); +} + diff --git a/sdk/tlibc/string/memchr.c b/sdk/tlibc/string/memchr.c new file mode 100644 index 0000000000..e97652b12d --- /dev/null +++ b/sdk/tlibc/string/memchr.c @@ -0,0 +1,48 @@ +/* $OpenBSD: memchr.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +void * +memchr(const void *s, int c, size_t n) +{ + if (n != 0) { + const unsigned char *p = (const unsigned char *)s; + + do { + if (*p++ == (unsigned char)c) + return ((void *)(p - 1)); + } while (--n != 0); + } + return (NULL); +} diff --git a/sdk/tlibc/string/memcmp.c b/sdk/tlibc/string/memcmp.c new file mode 100644 index 0000000000..3e9fc2536c --- /dev/null +++ b/sdk/tlibc/string/memcmp.c @@ -0,0 +1,59 @@ +/* $OpenBSD: memcmp.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +/* + * Compare memory regions. + */ +int +__memcmp(const void *s1, const void *s2, size_t n) +{ + if (n != 0) { + const unsigned char *p1 = (const unsigned char *)s1; + const unsigned char *p2 = (const unsigned char *)s2; + + do { + if (*p1++ != *p2++) + return (*--p1 - *--p2); + } while (--n != 0); + } + return (0); +} + +int +memcmp(const void *s1, const void *s2, size_t n) +{ + return __memcmp(s1, s2, n); +} diff --git a/sdk/tlibc/string/memcpy.c b/sdk/tlibc/string/memcpy.c new file mode 100644 index 0000000000..758ddd25f9 --- /dev/null +++ b/sdk/tlibc/string/memcpy.c @@ -0,0 +1,105 @@ +/* $OpenBSD: memcpy.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef long word; /* "word" used for optimal copy speed */ + +#define wsize sizeof(word) +#define wmask (wsize - 1) + + +/* + * Copy a block of memory, not handling overlap. + */ +void * +__memcpy(void *dst0, const void *src0, size_t length) +{ + char *dst = (char *)dst0; + const char *src = (const char *)src0; + size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + if ((dst < src && dst + length > src) || + (src < dst && src + length > dst)) { + /* backwards memcpy */ + abort(); + } + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#define TLOOP(s) if (t) TLOOP1(s) +#define TLOOP1(s) do { s; } while (--t) + + /* + * Copy forward. + */ + t = (long)src; /* only need low bits */ + if ((t | (long)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (long)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); +done: + return (dst0); +} + + +void * +memcpy(void *dst0, const void *src0, size_t length) +{ + return __memcpy(dst0, src0, length); +} diff --git a/sdk/tlibc/string/memmove.c b/sdk/tlibc/string/memmove.c new file mode 100644 index 0000000000..c08e13c93f --- /dev/null +++ b/sdk/tlibc/string/memmove.c @@ -0,0 +1,112 @@ +/* $OpenBSD: memmove.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef long word; /* "word" used for optimal copy speed */ + +#define wsize sizeof(word) +#define wmask (wsize - 1) + +/* + * Copy a block of memory, handling overlap. + */ +void * +memmove(void *dst0, const void *src0, size_t length) +{ + char *dst = dst0; + const char *src = src0; + size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#define TLOOP(s) if (t) TLOOP1(s) +#define TLOOP1(s) do { s; } while (--t) + + if ((unsigned long)dst < (unsigned long)src) { + /* + * Copy forward. + */ + t = (long)src; /* only need low bits */ + if ((t | (long)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (long)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); + } else { + /* + * Copy backwards. Otherwise essentially the same. + * Alignment works as before, except that it takes + * (t&wmask) bytes to align, not wsize-(t&wmask). + */ + src += length; + dst += length; + t = (long)src; + if ((t | (long)dst) & wmask) { + if ((t ^ (long)dst) & wmask || length <= wsize) + t = length; + else + t &= wmask; + length -= t; + TLOOP1(*--dst = *--src); + } + t = length / wsize; + TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + t = length & wmask; + TLOOP(*--dst = *--src); + } +done: + return (dst0); +} diff --git a/sdk/tlibc/string/mempcpy.c b/sdk/tlibc/string/mempcpy.c new file mode 100644 index 0000000000..6d2568630f --- /dev/null +++ b/sdk/tlibc/string/mempcpy.c @@ -0,0 +1,2 @@ +#define MEMPCPY +#include "./memcpy.c" diff --git a/sdk/tlibc/string/memset.c b/sdk/tlibc/string/memset.c new file mode 100644 index 0000000000..e5f3f421c5 --- /dev/null +++ b/sdk/tlibc/string/memset.c @@ -0,0 +1,56 @@ +/* $OpenBSD: memset.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +void * +__memset(void *dst, int c, size_t n) +{ + if (n != 0) { + unsigned char *d = dst; + + do + *d++ = (unsigned char)c; + while (--n != 0); + } + return (dst); + + +} + +void * +memset(void *dst, int c, size_t n) +{ + return __memset(dst, c, n); +} diff --git a/sdk/tlibc/string/memset_s.c b/sdk/tlibc/string/memset_s.c new file mode 100644 index 0000000000..4fc1333e1a --- /dev/null +++ b/sdk/tlibc/string/memset_s.c @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Alan Barrett + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * ISO/IEC 9899:2011 section K.3.7.4.1 The memset_s function + */ + +#include + +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#include +#include + +/* + * __memset_vp is a volatile pointer to a function. + * It is initialised to point to memset, and should never be changed. + */ +static void * (* const volatile __memset_vp)(void *, int, size_t) + = (memset); + +#undef memset_s /* in case it was defined as a macro */ + +errno_t +memset_s(void *s, size_t smax, int c, size_t n) +{ + errno_t err = 0; + + if (s == NULL) { + err = EINVAL; + goto out; + } + if (smax > SIZE_MAX) { + err = E2BIG; + goto out; + } + if (n > SIZE_MAX) { + err = E2BIG; + n = smax; + } + if (n > smax) { + err = EOVERFLOW; + n = smax; + } + + /* Calling through a volatile pointer should never be optimised away. */ + (*__memset_vp)(s, c, n); + + out: + if (err == 0) + return 0; + else { + errno = err; + /* XXX call runtime-constraint handler */ + return err; + } +} \ No newline at end of file diff --git a/sdk/tlibc/string/rindex.c b/sdk/tlibc/string/rindex.c new file mode 100644 index 0000000000..bb8cb061d4 --- /dev/null +++ b/sdk/tlibc/string/rindex.c @@ -0,0 +1,37 @@ +/* $OpenBSD: rindex.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +char * +rindex(const char *p, int ch) +{ + return strrchr(p, ch); +} diff --git a/sdk/tlibc/string/se_string_init.c b/sdk/tlibc/string/se_string_init.c new file mode 100644 index 0000000000..f5d62380fc --- /dev/null +++ b/sdk/tlibc/string/se_string_init.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "stdint.h" +#include "se_cpu_feature.h" +#include "se_cdefs.h" + +// add a version to tlibc. +SGX_ACCESS_VERSION(tstdc, 1) + +int sgx_init_string_lib(uint64_t cpu_feature_indicator) +{ + (void)cpu_feature_indicator; + return 0; +} diff --git a/sdk/tlibc/string/stpncpy.c b/sdk/tlibc/string/stpncpy.c new file mode 100644 index 0000000000..d56a27b881 --- /dev/null +++ b/sdk/tlibc/string/stpncpy.c @@ -0,0 +1,56 @@ +/* $OpenBSD: stpncpy.c,v 1.2 2012/07/11 10:44:59 naddy Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +char * +stpncpy(char *dst, const char *src, size_t n) +{ + if (n != 0) { + char *d = dst; + const char *s = src; + + dst = &dst[n]; + do { + if ((*d++ = *s++) == 0) { + dst = d - 1; + /* NUL pad the remaining n-1 bytes */ + while (--n != 0) + *d++ = 0; + break; + } + } while (--n != 0); + } + return (dst); +} diff --git a/sdk/tlibc/string/strcasecmp.c b/sdk/tlibc/string/strcasecmp.c new file mode 100644 index 0000000000..08eb3739d0 --- /dev/null +++ b/sdk/tlibc/string/strcasecmp.c @@ -0,0 +1,105 @@ +/* $OpenBSD: strcasecmp.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ + +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +typedef unsigned char u_char; + +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +static const u_char charmap[] = { + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', + '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', + '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', + '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', +}; + +int +strcasecmp(const char *s1, const char *s2) +{ + const u_char *cm = charmap; + const u_char *us1 = (const u_char *)s1; + const u_char *us2 = (const u_char *)s2; + + while (cm[*us1] == cm[*us2++]) + if (*us1++ == '\0') + return (0); + return (cm[*us1] - cm[*--us2]); +} + +int +strncasecmp(const char *s1, const char *s2, size_t n) +{ + if (n != 0) { + const u_char *cm = charmap; + const u_char *us1 = (const u_char *)s1; + const u_char *us2 = (const u_char *)s2; + + do { + if (cm[*us1] != cm[*us2++]) + return (cm[*us1] - cm[*--us2]); + if (*us1++ == '\0') + break; + } while (--n != 0); + } + return (0); +} diff --git a/sdk/tlibc/string/strchr.c b/sdk/tlibc/string/strchr.c new file mode 100644 index 0000000000..531e0ffd87 --- /dev/null +++ b/sdk/tlibc/string/strchr.c @@ -0,0 +1,48 @@ +/* $OpenBSD: strchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +__weak_alias(index, strchr); + + + +char * +strchr(const char *p, int ch) +{ + char c = ch; + for (;; ++p) { + if (*p == c) + return((char *)p); + if (!*p) + return ((char *)NULL); + } + /* NOTREACHED */ +} diff --git a/sdk/tlibc/string/strcmp.c b/sdk/tlibc/string/strcmp.c new file mode 100644 index 0000000000..5fba8a9d97 --- /dev/null +++ b/sdk/tlibc/string/strcmp.c @@ -0,0 +1,48 @@ +/* $OpenBSD: strcmp.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +/* + * Compare strings. + */ +int +strcmp(const char *s1, const char *s2) +{ + while (*s1 == *s2++) + if (*s1++ == 0) + return (0); + return (*(const unsigned char *)s1 - *(const unsigned char *)--s2); +} diff --git a/sdk/tlibc/string/strcoll.c b/sdk/tlibc/string/strcoll.c new file mode 100644 index 0000000000..2569f5074b --- /dev/null +++ b/sdk/tlibc/string/strcoll.c @@ -0,0 +1,44 @@ +/* $OpenBSD: strcoll.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Compare strings according to LC_COLLATE category of current locale. + */ +int +strcoll(const char *s1, const char *s2) +{ + /* LC_COLLATE is unimplemented, hence always "C" */ + return (strcmp(s1, s2)); +} diff --git a/sdk/tlibc/string/strcspn.c b/sdk/tlibc/string/strcspn.c new file mode 100644 index 0000000000..08a1065f77 --- /dev/null +++ b/sdk/tlibc/string/strcspn.c @@ -0,0 +1,65 @@ +/* $OpenBSD: strcspn.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +/* + * Span the complement of string s2. + */ +size_t +__strcspn(const char *s1, const char *s2) +{ + const char *p, *spanp; + char c, sc; + + /* + * Stop as soon as we find any character from s2. Note that there + * must be a NUL in s2; it suffices to stop when we find that, too. + */ + for (p = s1;;) { + c = *p++; + spanp = s2; + do { + if ((sc = *spanp++) == c) + return (p - 1 - s1); + } while (sc != 0); + } + /* NOTREACHED */ +} + +size_t +strcspn(const char *s1, const char *s2) +{ + return __strcspn(s1, s2); +} diff --git a/sdk/tlibc/string/strerror.c b/sdk/tlibc/string/strerror.c new file mode 100644 index 0000000000..a9339f5da7 --- /dev/null +++ b/sdk/tlibc/string/strerror.c @@ -0,0 +1,44 @@ +/* $OpenBSD: strerror.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + + +#define NL_TEXTMAX 2048 + +char * +strerror(int num) +{ + static char _TLIBC_THREAD_ buf[NL_TEXTMAX]; + + (void)strerror_r(num, buf, sizeof(buf)); + return (buf); +} diff --git a/sdk/tlibc/string/strerror_r.c b/sdk/tlibc/string/strerror_r.c new file mode 100644 index 0000000000..0c5f3cbe05 --- /dev/null +++ b/sdk/tlibc/string/strerror_r.c @@ -0,0 +1,100 @@ +/* $OpenBSD: strerror_r.c,v 1.8 2013/06/01 21:26:18 stsp Exp $ */ +/* Public Domain */ + +#include +#include +#include +extern int sys_nerr; +extern const char *const sys_errlist[]; + +static size_t +__digits10(unsigned int num) +{ + size_t i = 0; + + do { + num /= 10; + i++; + } while (num != 0); + + return i; +} + +static int +__itoa(int num, int sign, char *buffer, size_t start, size_t end) +{ + size_t pos; + unsigned int a; + int neg; + + if (sign && num < 0) { + a = -num; + neg = 1; + } + else { + a = num; + neg = 0; + } + + pos = start + __digits10(a); + if (neg) + pos++; + + if (pos < end) + buffer[pos] = '\0'; + else + return ERANGE; + pos--; + do { + buffer[pos] = (a % 10) + '0'; + pos--; + a /= 10; + } while (a != 0); + if (neg) + buffer[pos] = '-'; + return 0; +} + + +static int +__num2string(int num, int sign, int setid, char *buf, size_t buflen, + const char *const list[], size_t max, const char *def) +{ + int ret = 0; + size_t len; + + (void *)&setid; + if (0 <= num && num < max) { + len = strlcpy(buf, list[num], buflen); + if (len >= buflen) + ret = ERANGE; + } else { + len = strlcpy(buf, def, buflen); + if (len >= buflen) + ret = ERANGE; + else { + ret = __itoa(num, sign, buf, len, buflen); + if (ret == 0) + ret = EINVAL; + } + } + + return ret; +} + +#define UPREFIX "Unknown error: " + +int +strerror_r(int errnum, char *strerrbuf, size_t buflen) +{ + int save_errno; + int ret_errno; + + save_errno = errno; + + ret_errno = __num2string(errnum, 1, 1, strerrbuf, buflen, + sys_errlist, sys_nerr, UPREFIX); + + errno = ret_errno ? ret_errno : save_errno; + return (ret_errno); +} diff --git a/sdk/tlibc/string/strlcpy.c b/sdk/tlibc/string/strlcpy.c new file mode 100644 index 0000000000..630167489b --- /dev/null +++ b/sdk/tlibc/string/strlcpy.c @@ -0,0 +1,50 @@ +/* $OpenBSD: strlcpy.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ + +/* + * Copyright (c) 1998, 2015 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +/* + * Copy string src to buffer dst of size dsize. At most dsize-1 + * chars will be copied. Always NUL terminates (unless dsize == 0). + * Returns strlen(src); if retval >= dsize, truncation occurred. + */ +size_t +strlcpy(char *dst, const char *src, size_t dsize) +{ + const char *osrc = src; + size_t nleft = dsize; + + /* Copy as many bytes as will fit. */ + if (nleft != 0) { + while (--nleft != 0) { + if ((*dst++ = *src++) == '\0') + break; + } + } + + /* Not enough room in dst, add NUL and traverse rest of src. */ + if (nleft == 0) { + if (dsize != 0) + *dst = '\0'; /* NUL-terminate dst */ + while (*src++) + ; + } + + return(src - osrc - 1); /* count does not include NUL */ +} diff --git a/sdk/tlibc/string/strlen.c b/sdk/tlibc/string/strlen.c new file mode 100644 index 0000000000..a100ff3b4c --- /dev/null +++ b/sdk/tlibc/string/strlen.c @@ -0,0 +1,44 @@ +/* $OpenBSD: strlen.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +size_t +strlen(const char *str) +{ + const char *s; + + for (s = str; *s; ++s) + ; + return (s - str); +} + diff --git a/sdk/tlibc/string/strncat.c b/sdk/tlibc/string/strncat.c new file mode 100644 index 0000000000..a74ae68929 --- /dev/null +++ b/sdk/tlibc/string/strncat.c @@ -0,0 +1,59 @@ +/* $OpenBSD: strncat.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes + * are written at dst (at most n+1 bytes being appended). Return dst. + */ + + +char * +strncat(char *dst, const char *src, size_t n) +{ + if (n != 0) { + char *d = dst; + const char *s = src; + + while (*d != 0) + d++; + do { + if ((*d = *s++) == 0) + break; + d++; + } while (--n != 0); + *d = 0; + } + return (dst); +} diff --git a/sdk/tlibc/string/strncmp.c b/sdk/tlibc/string/strncmp.c new file mode 100644 index 0000000000..b3c88858af --- /dev/null +++ b/sdk/tlibc/string/strncmp.c @@ -0,0 +1,47 @@ +/* $OpenBSD: strncmp.c,v 1.9 2015/08/31 02:53:57 guenther Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +int +strncmp(const char *s1, const char *s2, size_t n) +{ + if (n == 0) + return (0); + do { + if (*s1 != *s2++) + return (*(unsigned char *)s1 - *(unsigned char *)--s2); + if (*s1++ == 0) + break; + } while (--n != 0); + return (0); +} diff --git a/sdk/tlibc/string/strncpy.c b/sdk/tlibc/string/strncpy.c new file mode 100644 index 0000000000..e47462b5fa --- /dev/null +++ b/sdk/tlibc/string/strncpy.c @@ -0,0 +1,60 @@ +/* $OpenBSD: strncpy.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Copy src to dst, truncating or null-padding to always copy n bytes. + * Return dst. + */ + + +char * +strncpy(char *dst, const char *src, size_t n) +{ + if (n != 0) { + char *d = dst; + const char *s = src; + + do { + if ((*d++ = *s++) == 0) { + /* NUL pad the remaining n-1 bytes */ + while (--n != 0) + *d++ = 0; + break; + } + } while (--n != 0); + } + return (dst); +} diff --git a/sdk/tlibc/string/strndup.c b/sdk/tlibc/string/strndup.c new file mode 100644 index 0000000000..f43ba6592f --- /dev/null +++ b/sdk/tlibc/string/strndup.c @@ -0,0 +1,39 @@ +/* $OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */ + +/* + * Copyright (c) 2010 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include +#include +#include + +char * +strndup(const char *str, size_t maxlen) +{ + char *copy; + size_t len; + + len = strnlen(str, maxlen); + copy = malloc(len + 1); + if (copy != NULL) { + (void)memcpy(copy, str, len); + copy[len] = '\0'; + } + + return copy; +} diff --git a/sdk/tlibc/string/strnlen.c b/sdk/tlibc/string/strnlen.c new file mode 100644 index 0000000000..6aca3c6b79 --- /dev/null +++ b/sdk/tlibc/string/strnlen.c @@ -0,0 +1,32 @@ +/* $OpenBSD: strnlen.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ + +/* + * Copyright (c) 2010 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include + +size_t +strnlen(const char *str, size_t maxlen) +{ + const char *cp; + + for (cp = str; maxlen != 0 && *cp != '\0'; cp++, maxlen--) + ; + + return (size_t)(cp - str); +} diff --git a/sdk/tlibc/string/strpbrk.c b/sdk/tlibc/string/strpbrk.c new file mode 100644 index 0000000000..f6d3a22b4d --- /dev/null +++ b/sdk/tlibc/string/strpbrk.c @@ -0,0 +1,56 @@ +/* $OpenBSD: strpbrk.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Find the first occurrence in s1 of a character in s2 (excluding NUL). + */ +char * +__strpbrk(const char *s1, const char *s2) +{ + const char *scanp; + int c, sc; + + while ((c = *s1++) != 0) { + for (scanp = s2; (sc = *scanp++) != 0;) + if (sc == c) + return ((char *)(s1 - 1)); + } + return (NULL); +} + + +char * +strpbrk(const char *s1, const char *s2) +{ + return __strpbrk(s1, s2); +} + diff --git a/sdk/tlibc/string/strrchr.c b/sdk/tlibc/string/strrchr.c new file mode 100644 index 0000000000..71b5eec708 --- /dev/null +++ b/sdk/tlibc/string/strrchr.c @@ -0,0 +1,50 @@ +/* $OpenBSD: strrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#include + + + +__weak_alias(rindex, strrchr); + +char * +strrchr(const char *p, int ch) +{ + char *save; + + for (save = NULL;; ++p) { + if (*p == ch) + save = (char *)p; + if (!*p) + return(save); + } + /* NOTREACHED */ +} diff --git a/sdk/tlibc/string/strspn.c b/sdk/tlibc/string/strspn.c new file mode 100644 index 0000000000..45b95ba2f5 --- /dev/null +++ b/sdk/tlibc/string/strspn.c @@ -0,0 +1,59 @@ +/* $OpenBSD: strspn.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + + +/* + * Span the string s2 (skip characters that are in s2). + */ +size_t +__strspn(const char *s1, const char *s2) +{ + const char *p = s1, *spanp; + char c, sc; + + /* + * Skip any characters in s2, excluding the terminating \0. + */ +cont: + c = *p++; + for (spanp = s2; (sc = *spanp++) != 0;) + if (sc == c) + goto cont; + return (p - 1 - s1); +} + + +size_t +strspn(const char *s1, const char *s2) +{ + return __strspn(s1, s2); +} diff --git a/sdk/tlibc/string/strstr.c b/sdk/tlibc/string/strstr.c new file mode 100644 index 0000000000..ff6939ace8 --- /dev/null +++ b/sdk/tlibc/string/strstr.c @@ -0,0 +1,56 @@ +/* $OpenBSD: strstr.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Find the first occurrence of find in s. + */ +char * +strstr(const char *s, const char *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} diff --git a/sdk/tlibc/string/strtok.c b/sdk/tlibc/string/strtok.c new file mode 100644 index 0000000000..abc364ac39 --- /dev/null +++ b/sdk/tlibc/string/strtok.c @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +char * +strtok_r(char *s, const char *delim, char **last) +{ + const char *spanp; + int c, sc; + char *tok; + + + if (s == NULL && (s = *last) == NULL) + return (NULL); + + /* + * Skip (span) leading delimiters (s += strspn(s, delim), sort of). + */ +cont: + c = *s++; + for (spanp = delim; (sc = *spanp++) != 0;) { + if (c == sc) + goto cont; + } + + if (c == 0) { /* no non-delimiter characters */ + *last = NULL; + return (NULL); + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) { + c = *s++; + spanp = delim; + do { + if ((sc = *spanp++) == c) { + if (c == 0) + s = NULL; + else + s[-1] = '\0'; + *last = s; + return (tok); + } + } while (sc != 0); + } + /* NOTREACHED */ +} + + +char * +strtok(char *s, const char *delim) +{ + static _TLIBC_THREAD_ char *last = NULL; + return strtok_r(s, delim, &last); +} diff --git a/sdk/tlibc/string/strxfrm.c b/sdk/tlibc/string/strxfrm.c new file mode 100644 index 0000000000..c747a36d4e --- /dev/null +++ b/sdk/tlibc/string/strxfrm.c @@ -0,0 +1,51 @@ +/* $OpenBSD: strxfrm.c,v 1.7 2015/08/31 02:53:57 guenther Exp $ */ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +/* + * Transform src, storing the result in dst, such that + * strcmp() on transformed strings returns what strcoll() + * on the original untransformed strings would return. + */ +size_t +strxfrm(char *dst, const char *src, size_t n) +{ + + /* + * Since locales are unimplemented, this is just a copy. + */ + if (n == 0) + return (strlen(src)); + return (strlcpy(dst, src, n)); +} diff --git a/sdk/tlibc/string/wcschr.c b/sdk/tlibc/string/wcschr.c new file mode 100644 index 0000000000..48d864b059 --- /dev/null +++ b/sdk/tlibc/string/wcschr.c @@ -0,0 +1,49 @@ +/* $OpenBSD: wcschr.c,v 1.6 2015/10/01 02:32:07 guenther Exp $ */ +/* $NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcschr.c,v 1.2 2000/12/21 05:07:25 itojun Exp + */ + +#include + +wchar_t * +wcschr(const wchar_t *s, wchar_t c) +{ + const wchar_t *p; + + p = s; + for (;;) { + if (*p == c) { + return (wchar_t *)p; + } + if (!*p) + return NULL; + p++; + } + /* NOTREACHED */ +} diff --git a/sdk/tlibc/string/wcscmp.c b/sdk/tlibc/string/wcscmp.c new file mode 100644 index 0000000000..bf76aac25c --- /dev/null +++ b/sdk/tlibc/string/wcscmp.c @@ -0,0 +1,51 @@ +/* $OpenBSD: wcscmp.c,v 1.5 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include "locale/runetype.h" + +/* + * Compare strings. + */ +int +wcscmp(const wchar_t *s1, const wchar_t *s2) +{ + + while (*s1 == *s2++) + if (*s1++ == 0) + return (0); + /* XXX assumes wchar_t = int */ + return (*(const rune_t *)s1 - *(const rune_t *)--s2); +} diff --git a/sdk/tlibc/string/wcscspn.c b/sdk/tlibc/string/wcscspn.c new file mode 100644 index 0000000000..613360a00b --- /dev/null +++ b/sdk/tlibc/string/wcscspn.c @@ -0,0 +1,53 @@ +/* $OpenBSD: wcscspn.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcscspn.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp + */ + +#include + +size_t +wcscspn(const wchar_t *s, const wchar_t *set) +{ + const wchar_t *p; + const wchar_t *q; + + p = s; + while (*p) { + q = set; + while (*q) { + if (*p == *q) + goto done; + q++; + } + p++; + } + +done: + return (p - s); +} diff --git a/sdk/tlibc/string/wcslcpy.c b/sdk/tlibc/string/wcslcpy.c new file mode 100644 index 0000000000..169971a94a --- /dev/null +++ b/sdk/tlibc/string/wcslcpy.c @@ -0,0 +1,50 @@ +/* $OpenBSD: wcslcpy.c,v 1.7 2015/09/12 16:23:14 guenther Exp $ */ + +/* + * Copyright (c) 1998, 2015 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +/* + * Copy string src to buffer dst of size dsize. At most dsize-1 + * chars will be copied. Always NUL terminates (unless dsize == 0). + * Returns wcslen(src); if retval >= dsize, truncation occurred. + */ +size_t +wcslcpy(wchar_t *dst, const wchar_t *src, size_t dsize) +{ + const wchar_t *osrc = src; + size_t nleft = dsize; + + /* Copy as many bytes as will fit. */ + if (nleft != 0) { + while (--nleft != 0) { + if ((*dst++ = *src++) == L'\0') + break; + } + } + + /* Not enough room in dst, add NUL and traverse rest of src. */ + if (nleft == 0) { + if (dsize != 0) + *dst = L'\0'; /* NUL-terminate dst */ + while (*src++) + ; + } + + return(src - osrc - 1); /* count does not include NUL */ +} diff --git a/sdk/tlibc/string/wcslen.c b/sdk/tlibc/string/wcslen.c new file mode 100644 index 0000000000..9484501e6e --- /dev/null +++ b/sdk/tlibc/string/wcslen.c @@ -0,0 +1,44 @@ +/* $OpenBSD: wcslen.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp + */ + +#include + +size_t +wcslen(const wchar_t *s) +{ + const wchar_t *p; + + p = s; + while (*p) + p++; + + return p - s; +} diff --git a/sdk/tlibc/string/wcsncat.c b/sdk/tlibc/string/wcsncat.c new file mode 100644 index 0000000000..869ba08576 --- /dev/null +++ b/sdk/tlibc/string/wcsncat.c @@ -0,0 +1,52 @@ +/* $OpenBSD: wcsncat.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcsncat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp + */ + +#include + +wchar_t * +wcsncat(wchar_t *s1, const wchar_t *s2, size_t n) +{ + wchar_t *p; + wchar_t *q; + const wchar_t *r; + + p = s1; + while (*p) + p++; + q = p; + r = s2; + while (*r && n) { + *q++ = *r++; + n--; + } + *q = '\0'; + return s1; +} diff --git a/sdk/tlibc/string/wcsncmp.c b/sdk/tlibc/string/wcsncmp.c new file mode 100644 index 0000000000..1dbf737998 --- /dev/null +++ b/sdk/tlibc/string/wcsncmp.c @@ -0,0 +1,52 @@ +/* $OpenBSD: wcsncmp.c,v 1.5 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include "locale/runetype.h" + +int +wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) +{ + + if (n == 0) + return (0); + do { + if (*s1 != *s2++) { + /* XXX assumes wchar_t = int */ + return (*(const rune_t *)s1 - + *(const rune_t *)--s2); + } + if (*s1++ == 0) + break; + } while (--n != 0); + return (0); +} diff --git a/sdk/tlibc/string/wcsncpy.c b/sdk/tlibc/string/wcsncpy.c new file mode 100644 index 0000000000..07a536d352 --- /dev/null +++ b/sdk/tlibc/string/wcsncpy.c @@ -0,0 +1,50 @@ +/* $OpenBSD: wcsncpy.c,v 1.5 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcsncpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcsncpy.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp + */ + +#include + +wchar_t * +wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n) +{ + wchar_t *p; + + p = s1; + while (n && *s2) { + *p++ = *s2++; + n--; + } + while (n) { + *p++ = L'\0'; + n--; + } + + return s1; +} diff --git a/sdk/tlibc/string/wcspbrk.c b/sdk/tlibc/string/wcspbrk.c new file mode 100644 index 0000000000..f41b481084 --- /dev/null +++ b/sdk/tlibc/string/wcspbrk.c @@ -0,0 +1,52 @@ +/* $OpenBSD: wcspbrk.c,v 1.5 2015/10/01 02:32:07 guenther Exp $ */ +/* $NetBSD: wcspbrk.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcspbrk.c,v 1.2 2000/12/21 05:07:25 itojun Exp + */ + +#include + +wchar_t * +wcspbrk(const wchar_t *s, const wchar_t *set) +{ + const wchar_t *p; + const wchar_t *q; + + p = s; + while (*p) { + q = set; + while (*q) { + if (*p == *q) { + return (wchar_t *)p; + } + q++; + } + p++; + } + return NULL; +} diff --git a/sdk/tlibc/string/wcsrchr.c b/sdk/tlibc/string/wcsrchr.c new file mode 100644 index 0000000000..6e484d1bec --- /dev/null +++ b/sdk/tlibc/string/wcsrchr.c @@ -0,0 +1,49 @@ +/* $OpenBSD: wcsrchr.c,v 1.5 2015/10/01 02:32:07 guenther Exp $ */ +/* $NetBSD: wcsrchr.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcsrchr.c,v 1.2 2000/12/21 05:07:25 itojun Exp + */ + +#include + +wchar_t * +wcsrchr(const wchar_t *s, wchar_t c) +{ + const wchar_t *p; + + p = s; + while (*p) + p++; + while (s <= p) { + if (*p == c) { + return (wchar_t *)p; + } + p--; + } + return NULL; +} diff --git a/sdk/tlibc/string/wcsspn.c b/sdk/tlibc/string/wcsspn.c new file mode 100644 index 0000000000..8b26960204 --- /dev/null +++ b/sdk/tlibc/string/wcsspn.c @@ -0,0 +1,55 @@ +/* $OpenBSD: wcsspn.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wcsspn.c,v 1.3 2001/09/21 16:09:15 yamt Exp $ */ + +/*- + * Copyright (c)1999,2001 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Citrus: xpg4dl/FreeBSD/lib/libc/string/wcsspn.c,v 1.3 2001/09/21 16:06:43 yamt Exp $ + */ + +#include + +size_t +wcsspn(const wchar_t *s, const wchar_t *set) +{ + const wchar_t *p; + const wchar_t *q; + + p = s; + while (*p) { + q = set; + while (*q) { + if (*p == *q) + break; + q++; + } + if (!*q) + goto done; + p++; + } + +done: + return (p - s); +} diff --git a/sdk/tlibc/string/wcsstr.c b/sdk/tlibc/string/wcsstr.c new file mode 100644 index 0000000000..daabc8c213 --- /dev/null +++ b/sdk/tlibc/string/wcsstr.c @@ -0,0 +1,68 @@ +/* $OpenBSD: wcsstr.c,v 1.5 2015/10/01 02:32:07 guenther Exp $ */ +/* $NetBSD: wcsstr.c,v 1.3 2003/03/05 20:18:17 tshiozak Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wcsstr.c,v 1.2 2000/12/21 05:07:25 itojun Exp + */ + +#include + +wchar_t * +#ifdef WCSWCS +wcswcs(const wchar_t *big, const wchar_t *little) +#else +wcsstr(const wchar_t *big, const wchar_t *little) +#endif +{ + const wchar_t *p; + const wchar_t *q; + const wchar_t *r; + + if (!*little) { + return (wchar_t *)big; + } + if (wcslen(big) < wcslen(little)) + return NULL; + + p = big; + q = little; + while (*p) { + q = little; + r = p; + while (*q) { + if (*r != *q) + break; + q++; + r++; + } + if (!*q) { + return (wchar_t *)p; + } + p++; + } + return NULL; +} diff --git a/sdk/tlibc/string/wcstok.c b/sdk/tlibc/string/wcstok.c new file mode 100644 index 0000000000..bc1ac3e8cb --- /dev/null +++ b/sdk/tlibc/string/wcstok.c @@ -0,0 +1,93 @@ +/* $OpenBSD: wcstok.c,v 1.3 2005/08/08 08:05:37 espie Exp $ */ +/* $NetBSD: wcstok.c,v 1.3 2003/07/10 08:50:48 tshiozak Exp $ */ + +/*- + * Copyright (c) 1998 Softweyr LLC. All rights reserved. + * + * strtok_r, from Berkeley strtok + * Oct 13, 1998 by Wes Peters + * + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notices, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notices, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Softweyr LLC, the + * University of California, Berkeley, and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE + * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Original version ID: + * FreeBSD: src/lib/libc/string/wcstok.c,v 1.1 2002/09/07 08:16:57 tjr Exp + */ + +#include + +wchar_t * +wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim, + wchar_t ** __restrict last) +{ + const wchar_t *spanp; + wchar_t c, sc; + wchar_t *tok; + + if (s == NULL && (s = *last) == NULL) + return (NULL); + + /* + * Skip (span) leading delimiters (s += wcsspn(s, delim), sort of). + */ +cont: + c = *s++; + for (spanp = delim; (sc = *spanp++) != L'\0';) { + if (c == sc) + goto cont; + } + + if (c == L'\0') { /* no non-delimiter characters */ + *last = NULL; + return (NULL); + } + tok = s - 1; + + /* + * Scan token (scan for delimiters: s += wcscspn(s, delim), sort of). + * Note that delim must have one NUL; we stop if we see that, too. + */ + for (;;) { + c = *s++; + spanp = delim; + do { + if ((sc = *spanp++) == c) { + if (c == L'\0') + s = NULL; + else + s[-1] = L'\0'; + *last = s; + return (tok); + } + } while (sc != L'\0'); + } + /* NOTREACHED */ +} diff --git a/sdk/tlibc/string/wcswcs.c b/sdk/tlibc/string/wcswcs.c new file mode 100644 index 0000000000..bd35605547 --- /dev/null +++ b/sdk/tlibc/string/wcswcs.c @@ -0,0 +1,5 @@ +/* $OpenBSD: wcswcs.c,v 1.1 2005/04/13 16:35:58 espie Exp $ */ +/* $NetBSD: wcswcs.c,v 1.1 2003/03/05 20:18:17 tshiozak Exp $ */ + +#define WCSWCS +#include "wcsstr.c" diff --git a/sdk/tlibc/string/wmemchr.c b/sdk/tlibc/string/wmemchr.c new file mode 100644 index 0000000000..c4a910a1fa --- /dev/null +++ b/sdk/tlibc/string/wmemchr.c @@ -0,0 +1,46 @@ +/* $OpenBSD: wmemchr.c,v 1.5 2015/10/01 02:32:07 guenther Exp $ */ +/* $NetBSD: wmemchr.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp + */ + +#include + +wchar_t * +wmemchr(const wchar_t *s, wchar_t c, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) { + if (*s == c) { + return (wchar_t *)s; + } + s++; + } + return NULL; +} diff --git a/sdk/tlibc/string/wmemcmp.c b/sdk/tlibc/string/wmemcmp.c new file mode 100644 index 0000000000..d123d221d5 --- /dev/null +++ b/sdk/tlibc/string/wmemcmp.c @@ -0,0 +1,50 @@ +/* $OpenBSD: wmemcmp.c,v 1.5 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp + */ + +#include +#include "locale/runetype.h" + +int +wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) { + if (*s1 != *s2) { + /* wchar might be unsigned */ + return *(const rune_t *)s1 > + *(const rune_t *)s2 ? 1 : -1; + } + s1++; + s2++; + } + return 0; +} diff --git a/sdk/tlibc/string/wmemcpy.c b/sdk/tlibc/string/wmemcpy.c new file mode 100644 index 0000000000..9780f01a8a --- /dev/null +++ b/sdk/tlibc/string/wmemcpy.c @@ -0,0 +1,40 @@ +/* $OpenBSD: wmemcpy.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wmemcpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp + */ + +#include +#include + +wchar_t * +wmemcpy(wchar_t *d, const wchar_t *s, size_t n) +{ + + return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t)); +} diff --git a/sdk/tlibc/string/wmemmove.c b/sdk/tlibc/string/wmemmove.c new file mode 100644 index 0000000000..9056081764 --- /dev/null +++ b/sdk/tlibc/string/wmemmove.c @@ -0,0 +1,40 @@ +/* $OpenBSD: wmemmove.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wmemmove.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp + */ + +#include +#include + +wchar_t * +wmemmove(wchar_t *d, const wchar_t *s, size_t n) +{ + + return (wchar_t *)memmove(d, s, n * sizeof(wchar_t)); +} diff --git a/sdk/tlibc/string/wmemset.c b/sdk/tlibc/string/wmemset.c new file mode 100644 index 0000000000..0dda958670 --- /dev/null +++ b/sdk/tlibc/string/wmemset.c @@ -0,0 +1,46 @@ +/* $OpenBSD: wmemset.c,v 1.4 2015/09/12 16:23:14 guenther Exp $ */ +/* $NetBSD: wmemset.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */ + +/*- + * Copyright (c)1999 Citrus Project, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp + */ + +#include + +wchar_t * +wmemset(wchar_t *s, wchar_t c, size_t n) +{ + size_t i; + wchar_t *p; + + p = s; + for (i = 0; i < n; i++) { + *p = c; + p++; + } + return s; +} diff --git a/sdk/tlibc/time/asctime.c b/sdk/tlibc/time/asctime.c new file mode 100644 index 0000000000..fd3186ef98 --- /dev/null +++ b/sdk/tlibc/time/asctime.c @@ -0,0 +1,154 @@ +/* $OpenBSD: asctime.c,v 1.16 2010/08/23 22:35:34 millert Exp $ */ +/* +** This file is in the public domain, so clarified as of +** 1996-06-05 by Arthur David Olson. +*/ + +/* +** Avoid the temptation to punt entirely to strftime; +** the output of strftime is supposed to be locale specific +** whereas the output of asctime is supposed to be constant. +*/ + +/*LINTLIBRARY*/ + +#include "private.h" +#include "tzfile.h" +//#include "thread_private.h" +#include "internal/se_cdefs.h" + +/* +** Some systems only handle "%.2d"; others only handle "%02d"; +** "%02.2d" makes (most) everybody happy. +** At least some versions of gcc warn about the %02.2d; +** we conditionalize below to avoid the warning. +*/ +/* +** All years associated with 32-bit time_t values are exactly four digits long; +** some years associated with 64-bit time_t values are not. +** Vintage programs are coded for years that are always four digits long +** and may assume that the newline always lands in the same place. +** For years that are less than four digits, we pad the output with +** leading zeroes to get the newline in the traditional place. +** The -4 ensures that we get four characters of output even if +** we call a strftime variant that produces fewer characters for some years. +** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year, +** but many implementations pad anyway; most likely the standards are buggy. +*/ +#ifdef __GNUC__ +#define ASCTIME_FMT "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n" +#else /* !defined __GNUC__ */ +#define ASCTIME_FMT "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n" +#endif /* !defined __GNUC__ */ +/* +** For years that are more than four digits we put extra spaces before the year +** so that code trying to overwrite the newline won't end up overwriting +** a digit within a year and truncating the year (operating on the assumption +** that no output is better than wrong output). +*/ +#ifdef __GNUC__ +#define ASCTIME_FMT_B "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %s\n" +#else /* !defined __GNUC__ */ +#define ASCTIME_FMT_B "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s\n" +#endif /* !defined __GNUC__ */ + +#define STD_ASCTIME_BUF_SIZE 26 +/* +** Big enough for something such as +** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n +** (two three-character abbreviations, five strings denoting integers, +** seven explicit spaces, two explicit colons, a newline, +** and a trailing ASCII nul). +** The values above are for systems where an int is 32 bits and are provided +** as an example; the define below calculates the maximum for the system at +** hand. +*/ +#define MAX_ASCTIME_BUF_SIZE (2*3+5*INT_STRLEN_MAXIMUM(int)+7+2+1+1) + +static char * +asctime3(timeptr, buf, bufsize) +register const struct tm * timeptr; +char * buf; +int bufsize; +{ + static const char wday_name[][4] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static const char mon_name[][4] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + register const char * wn; + register const char * mn; + char year[INT_STRLEN_MAXIMUM(int) + 2]; + int len; + + if (timeptr == NULL) { + errno = EINVAL; + strlcpy(buf, "??? ??? ?? ??:??:?? ????\n", bufsize); + return buf; + } + if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK) + wn = "???"; + else wn = wday_name[timeptr->tm_wday]; + if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR) + mn = "???"; + else mn = mon_name[timeptr->tm_mon]; + /* + ** Use strftime's %Y to generate the year, to avoid overflow problems + ** when computing timeptr->tm_year + TM_YEAR_BASE. + ** Assume that strftime is unaffected by other out-of-range members + ** (e.g., timeptr->tm_mday) when processing "%Y". + */ + (void) strftime(year, sizeof year, "%Y", timeptr); + len = snprintf(buf, bufsize, + ((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B), + wn, mn, + timeptr->tm_mday, timeptr->tm_hour, + timeptr->tm_min, timeptr->tm_sec, + year); + if (len != -1 && len < bufsize) { + return buf; + } else { +#ifdef EOVERFLOW + errno = EOVERFLOW; +#else /* !defined EOVERFLOW */ + errno = EINVAL; +#endif /* !defined EOVERFLOW */ + return NULL; + } +} + +/* +** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition. +*/ + +/* + ** Enable asctime_r implementation at Windows platform for + ** sample code needs this implementation at Windows platform + */ +//#ifdef __GNUC__ /* Not for Windows */ +char * +asctime_r(timeptr, buf) +register const struct tm * timeptr; +char * buf; +{ + /* + ** P1003 8.3.5.2 says that asctime_r() can only assume at most + ** a 26 byte buffer. + */ + return asctime3(timeptr, buf, STD_ASCTIME_BUF_SIZE); +} +//#endif + +/* +** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition. +*/ + +char * +asctime(timeptr) +const struct tm * timeptr; +{ + static _TLIBC_THREAD_ char result[MAX_ASCTIME_BUF_SIZE]; + return asctime3(timeptr, result, (int)sizeof(result)); +} diff --git a/sdk/tlibc/time/difftime.c b/sdk/tlibc/time/difftime.c new file mode 100644 index 0000000000..8521a60110 --- /dev/null +++ b/sdk/tlibc/time/difftime.c @@ -0,0 +1,60 @@ +/* $OpenBSD: difftime.c,v 1.9 2005/08/08 08:05:38 espie Exp $ */ +/* +** This file is in the public domain, so clarified as of +** 1996-06-05 by Arthur David Olson. +*/ + +/*LINTLIBRARY*/ + +#include "private.h" /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */ + +double +difftime(time1, time0) +const time_t time1; +const time_t time0; +{ + /* + ** If (sizeof (double) > sizeof (time_t)) simply convert and subtract + ** (assuming that the larger type has more precision). + ** This is the common real-world case circa 2004. + */ + if (sizeof (double) > sizeof (time_t)) + return (double) time1 - (double) time0; + if (!TYPE_INTEGRAL(time_t)) { + /* + ** time_t is floating. + */ + return time1 - time0; + } + if (!TYPE_SIGNED(time_t)) { + /* + ** time_t is integral and unsigned. + ** The difference of two unsigned values can't overflow + ** if the minuend is greater than or equal to the subtrahend. + */ + if (time1 >= time0) + return time1 - time0; + else return -((double) (time0 - time1)); + } + /* + ** time_t is integral and signed. + ** Handle cases where both time1 and time0 have the same sign + ** (meaning that their difference cannot overflow). + */ + if ((time1 < 0) == (time0 < 0)) + return time1 - time0; + /* + ** time1 and time0 have opposite signs. + ** Punt if unsigned long is too narrow. + */ + if (sizeof (unsigned long) < sizeof (time_t)) + return (double) time1 - (double) time0; + /* + ** Stay calm...decent optimizers will eliminate the complexity below. + */ + if (time1 >= 0 /* && time0 < 0 */) + return (unsigned long) time1 + + (unsigned long) (-(time0 + 1)) + 1; + return -(double) ((unsigned long) time0 + + (unsigned long) (-(time1 + 1)) + 1); +} diff --git a/sdk/tlibc/time/private.h b/sdk/tlibc/time/private.h new file mode 100644 index 0000000000..846063e5bd --- /dev/null +++ b/sdk/tlibc/time/private.h @@ -0,0 +1,65 @@ +/* $OpenBSD: private.h,v 1.25 2012/09/13 11:14:20 millert Exp $ */ +#ifndef PRIVATE_H + +#define PRIVATE_H + +/* +** This file is in the public domain, so clarified as of +** 1996-06-05 by Arthur David Olson. +*/ + +/* +** Nested includes +*/ + +#include "sys/types.h" /* for time_t */ +#include "stdio.h" +#include "errno.h" +#include "string.h" +#include "limits.h" /* for CHAR_BIT et al. */ +#include "time.h" + +/* +** Finally, some convenience items. +*/ + +#ifndef TRUE +#define TRUE 1 +#endif /* !defined TRUE */ + +#ifndef FALSE +#define FALSE 0 +#endif /* !defined FALSE */ + +#ifndef TYPE_BIT +#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) +#endif /* !defined TYPE_BIT */ + +#ifndef TYPE_SIGNED +#define TYPE_SIGNED(type) (((type) -1) < 0) +#endif /* !defined TYPE_SIGNED */ + +/* +** Since the definition of TYPE_INTEGRAL contains floating point numbers, +** it cannot be used in preprocessor directives. +*/ + +#ifndef TYPE_INTEGRAL +#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5) +#endif /* !defined TYPE_INTEGRAL */ + +#ifndef INT_STRLEN_MAXIMUM +/* +** 302 / 1000 is log10(2.0) rounded up. +** Subtract one for the sign bit if the type is signed; +** add one for integer division truncation; +** add one more for a minus sign if the type is signed. +*/ +#define INT_STRLEN_MAXIMUM(type) \ + ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ + 1 + TYPE_SIGNED(type)) +#endif /* !defined INT_STRLEN_MAXIMUM */ + +/* Disable warnings */ + +#endif /* !defined PRIVATE_H */ diff --git a/sdk/tlibc/time/strftime.c b/sdk/tlibc/time/strftime.c new file mode 100644 index 0000000000..411d575e01 --- /dev/null +++ b/sdk/tlibc/time/strftime.c @@ -0,0 +1,763 @@ +/* $OpenBSD: strftime.c,v 1.21 2012/09/13 11:14:20 millert Exp $ */ +#include "private.h" + +/* +** Copyright (c) 1989, 1993 +** The Regents of the University of California. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. Neither the name of the University nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +*/ + +#include "tzfile.h" +//#include "fcntl.h" +//#include "locale.h" + +struct lc_time_T { + const char * mon[MONSPERYEAR]; + const char * month[MONSPERYEAR]; + const char * wday[DAYSPERWEEK]; + const char * weekday[DAYSPERWEEK]; + const char * X_fmt; + const char * x_fmt; + const char * c_fmt; + const char * am; + const char * pm; + const char * date_fmt; +}; + +#ifdef LOCALE_HOME +#include "sys/stat.h" +static struct lc_time_T localebuf; +static struct lc_time_T * _loc(void); +#define Locale _loc() +#endif /* defined LOCALE_HOME */ +#ifndef LOCALE_HOME +#define Locale (&C_time_locale) +#endif /* !defined LOCALE_HOME */ + +static const struct lc_time_T C_time_locale = { + { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }, { + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + }, { + "Sun", "Mon", "Tue", "Wed", + "Thu", "Fri", "Sat" + }, { + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday" + }, + + /* X_fmt */ + "%H:%M:%S", + + /* + ** x_fmt + ** C99 requires this format. + ** Using just numbers (as here) makes Quakers happier; + ** it's also compatible with SVR4. + */ + "%m/%d/%y", + + /* + ** c_fmt + ** C99 requires this format. + ** Previously this code used "%D %X", but we now conform to C99. + ** Note that + ** "%a %b %d %H:%M:%S %Y" + ** is used by Solaris 2.3. + */ + "%a %b %e %T %Y", + + /* am */ + "AM", + + /* pm */ + "PM", + + /* date_fmt */ + "%a %b %e %H:%M:%S %Z %Y" +}; + +static char * _add(const char *, char *, const char *); +static char * _conv(int, const char *, char *, const char *); +static char * _fmt(const char *, const struct tm *, char *, const char *, + int *); +static char * _yconv(int, int, int, int, char *, const char *); + +//extern char * tzname[]; + +#ifndef YEAR_2000_NAME +#define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS" +#endif /* !defined YEAR_2000_NAME */ + +#define IN_NONE 0 +#define IN_SOME 1 +#define IN_THIS 2 +#define IN_ALL 3 + +size_t +strftime(s, maxsize, format, t) +char * const s; +const size_t maxsize; +const char * const format; +const struct tm * const t; +{ + char * p; + int warn; + + //tzset(); +#ifdef LOCALE_HOME + localebuf.mon[0] = 0; +#endif /* defined LOCALE_HOME */ + warn = IN_NONE; + p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn); + if (p == s + maxsize) { + if (maxsize > 0) + s[maxsize - 1] = '\0'; + return 0; + } + *p = '\0'; + return p - s; +} + +static char * +_fmt(format, t, pt, ptlim, warnp) +const char * format; +const struct tm * const t; +char * pt; +const char * const ptlim; +int * warnp; +{ + for ( ; *format; ++format) { + if (*format == '%') { +label: + switch (*++format) { + case '\0': + --format; + break; + case 'A': + pt = _add((t->tm_wday < 0 || + t->tm_wday >= DAYSPERWEEK) ? + "?" : Locale->weekday[t->tm_wday], + pt, ptlim); + continue; + case 'a': + pt = _add((t->tm_wday < 0 || + t->tm_wday >= DAYSPERWEEK) ? + "?" : Locale->wday[t->tm_wday], + pt, ptlim); + continue; + case 'B': + pt = _add((t->tm_mon < 0 || + t->tm_mon >= MONSPERYEAR) ? + "?" : Locale->month[t->tm_mon], + pt, ptlim); + continue; + case 'b': + case 'h': + pt = _add((t->tm_mon < 0 || + t->tm_mon >= MONSPERYEAR) ? + "?" : Locale->mon[t->tm_mon], + pt, ptlim); + continue; + case 'C': + /* + ** %C used to do a... + ** _fmt("%a %b %e %X %Y", t); + ** ...whereas now POSIX 1003.2 calls for + ** something completely different. + ** (ado, 1993-05-24) + */ + pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0, + pt, ptlim); + continue; + case 'c': + { + int warn2 = IN_SOME; + + pt = _fmt(Locale->c_fmt, t, pt, ptlim, &warn2); + if (warn2 == IN_ALL) + warn2 = IN_THIS; + if (warn2 > *warnp) + *warnp = warn2; + } + continue; + case 'D': + pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp); + continue; + case 'd': + pt = _conv(t->tm_mday, "%02d", pt, ptlim); + continue; + case 'E': + case 'O': + /* + ** C99 locale modifiers. + ** The sequences + ** %Ec %EC %Ex %EX %Ey %EY + ** %Od %oe %OH %OI %Om %OM + ** %OS %Ou %OU %OV %Ow %OW %Oy + ** are supposed to provide alternate + ** representations. + */ + goto label; + case 'e': + pt = _conv(t->tm_mday, "%2d", pt, ptlim); + continue; + case 'F': + pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp); + continue; + case 'H': + pt = _conv(t->tm_hour, "%02d", pt, ptlim); + continue; + case 'I': + pt = _conv((t->tm_hour % 12) ? + (t->tm_hour % 12) : 12, + "%02d", pt, ptlim); + continue; + case 'j': + pt = _conv(t->tm_yday + 1, "%03d", pt, ptlim); + continue; + case 'k': + /* + ** This used to be... + ** _conv(t->tm_hour % 12 ? + ** t->tm_hour % 12 : 12, 2, ' '); + ** ...and has been changed to the below to + ** match SunOS 4.1.1 and Arnold Robbins' + ** strftime version 3.0. That is, "%k" and + ** "%l" have been swapped. + ** (ado, 1993-05-24) + */ + pt = _conv(t->tm_hour, "%2d", pt, ptlim); + continue; +#ifdef KITCHEN_SINK + case 'K': + /* + ** After all this time, still unclaimed! + */ + pt = _add("kitchen sink", pt, ptlim); + continue; +#endif /* defined KITCHEN_SINK */ + case 'l': + /* + ** This used to be... + ** _conv(t->tm_hour, 2, ' '); + ** ...and has been changed to the below to + ** match SunOS 4.1.1 and Arnold Robbin's + ** strftime version 3.0. That is, "%k" and + ** "%l" have been swapped. + ** (ado, 1993-05-24) + */ + pt = _conv((t->tm_hour % 12) ? + (t->tm_hour % 12) : 12, + "%2d", pt, ptlim); + continue; + case 'M': + pt = _conv(t->tm_min, "%02d", pt, ptlim); + continue; + case 'm': + pt = _conv(t->tm_mon + 1, "%02d", pt, ptlim); + continue; + case 'n': + pt = _add("\n", pt, ptlim); + continue; + case 'p': + pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ? + Locale->pm : + Locale->am, + pt, ptlim); + continue; + case 'R': + pt = _fmt("%H:%M", t, pt, ptlim, warnp); + continue; + case 'r': + pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp); + continue; + case 'S': + pt = _conv(t->tm_sec, "%02d", pt, ptlim); + continue; + case 's': + #if 0 + { + struct tm tm; + char buf[INT_STRLEN_MAXIMUM( + time_t) + 1]; + time_t mkt; + + tm = *t; + mkt = mktime(&tm); + if (TYPE_SIGNED(time_t)) + (void) snprintf(buf, sizeof buf, + "%ld", (long) mkt); + else (void) snprintf(buf, sizeof buf, + "%lu", (unsigned long) mkt); + pt = _add(buf, pt, ptlim); + } + #endif + continue; + case 'T': + pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp); + continue; + case 't': + pt = _add("\t", pt, ptlim); + continue; + case 'U': + pt = _conv((t->tm_yday + DAYSPERWEEK - + t->tm_wday) / DAYSPERWEEK, + "%02d", pt, ptlim); + continue; + case 'u': + /* + ** From Arnold Robbins' strftime version 3.0: + ** "ISO 8601: Weekday as a decimal number + ** [1 (Monday) - 7]" + ** (ado, 1993-05-24) + */ + pt = _conv((t->tm_wday == 0) ? + DAYSPERWEEK : t->tm_wday, + "%d", pt, ptlim); + continue; + case 'V': /* ISO 8601 week number */ + case 'G': /* ISO 8601 year (four digits) */ + case 'g': /* ISO 8601 year (two digits) */ +/* +** From Arnold Robbins' strftime version 3.0: "the week number of the +** year (the first Monday as the first day of week 1) as a decimal number +** (01-53)." +** (ado, 1993-05-24) +** +** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn: +** "Week 01 of a year is per definition the first week which has the +** Thursday in this year, which is equivalent to the week which contains +** the fourth day of January. In other words, the first week of a new year +** is the week which has the majority of its days in the new year. Week 01 +** might also contain days from the previous year and the week before week +** 01 of a year is the last week (52 or 53) of the previous year even if +** it contains days from the new year. A week starts with Monday (day 1) +** and ends with Sunday (day 7). For example, the first week of the year +** 1997 lasts from 1996-12-30 to 1997-01-05..." +** (ado, 1996-01-02) +*/ + { + int year; + int base; + int yday; + int wday; + int w; + + year = t->tm_year; + base = TM_YEAR_BASE; + yday = t->tm_yday; + wday = t->tm_wday; + for ( ; ; ) { + int len; + int bot; + int top; + + len = isleap_sum(year, base) ? + DAYSPERLYEAR : + DAYSPERNYEAR; + /* + ** What yday (-3 ... 3) does + ** the ISO year begin on? + */ + bot = ((yday + 11 - wday) % + DAYSPERWEEK) - 3; + /* + ** What yday does the NEXT + ** ISO year begin on? + */ + top = bot - + (len % DAYSPERWEEK); + if (top < -3) + top += DAYSPERWEEK; + top += len; + if (yday >= top) { + ++base; + w = 1; + break; + } + if (yday >= bot) { + w = 1 + ((yday - bot) / + DAYSPERWEEK); + break; + } + --base; + yday += isleap_sum(year, base) ? + DAYSPERLYEAR : + DAYSPERNYEAR; + } +#ifdef XPG4_1994_04_09 + if ((w == 52 && + t->tm_mon == TM_JANUARY) || + (w == 1 && + t->tm_mon == TM_DECEMBER)) + w = 53; +#endif /* defined XPG4_1994_04_09 */ + if (*format == 'V') + pt = _conv(w, "%02d", + pt, ptlim); + else if (*format == 'g') { + *warnp = IN_ALL; + pt = _yconv(year, base, 0, 1, + pt, ptlim); + } else pt = _yconv(year, base, 1, 1, + pt, ptlim); + } + continue; + case 'v': + /* + ** From Arnold Robbins' strftime version 3.0: + ** "date as dd-bbb-YYYY" + ** (ado, 1993-05-24) + */ + pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp); + continue; + case 'W': + pt = _conv((t->tm_yday + DAYSPERWEEK - + (t->tm_wday ? + (t->tm_wday - 1) : + (DAYSPERWEEK - 1))) / DAYSPERWEEK, + "%02d", pt, ptlim); + continue; + case 'w': + pt = _conv(t->tm_wday, "%d", pt, ptlim); + continue; + case 'X': + pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp); + continue; + case 'x': + { + int warn2 = IN_SOME; + + pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2); + if (warn2 == IN_ALL) + warn2 = IN_THIS; + if (warn2 > *warnp) + *warnp = warn2; + } + continue; + case 'y': + *warnp = IN_ALL; + pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1, + pt, ptlim); + continue; + case 'Y': + pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1, + pt, ptlim); + continue; + case 'Z': + #if 0 +#ifdef TM_ZONE + if (t->TM_ZONE != NULL) + pt = _add(t->TM_ZONE, pt, ptlim); + else +#endif /* defined TM_ZONE */ + if (t->tm_isdst >= 0) + pt = _add(tzname[t->tm_isdst != 0], + pt, ptlim); + #endif + /* + ** C99 says that %Z must be replaced by the + ** empty string if the time zone is not + ** determinable. + */ + continue; + case 'z': + #if 0 + { + int diff; + char const * sign; + + if (t->tm_isdst < 0) + continue; +#ifdef TM_GMTOFF + diff = t->TM_GMTOFF; +#else /* !defined TM_GMTOFF */ + /* + ** C99 says that the UTC offset must + ** be computed by looking only at + ** tm_isdst. This requirement is + ** incorrect, since it means the code + ** must rely on magic (in this case + ** altzone and timezone), and the + ** magic might not have the correct + ** offset. Doing things correctly is + ** tricky and requires disobeying C99; + ** see GNU C strftime for details. + ** For now, punt and conform to the + ** standard, even though it's incorrect. + ** + ** C99 says that %z must be replaced by the + ** empty string if the time zone is not + ** determinable, so output nothing if the + ** appropriate variables are not available. + */ + if (t->tm_isdst == 0) +#ifdef USG_COMPAT + diff = -timezone; +#else /* !defined USG_COMPAT */ + continue; +#endif /* !defined USG_COMPAT */ + else +#ifdef ALTZONE + diff = -altzone; +#else /* !defined ALTZONE */ + continue; +#endif /* !defined ALTZONE */ +#endif /* !defined TM_GMTOFF */ + if (diff < 0) { + sign = "-"; + diff = -diff; + } else sign = "+"; + pt = _add(sign, pt, ptlim); + diff /= SECSPERMIN; + diff = (diff / MINSPERHOUR) * 100 + + (diff % MINSPERHOUR); + pt = _conv(diff, "%04d", pt, ptlim); + } + #endif + continue; + case '+': + pt = _fmt(Locale->date_fmt, t, pt, ptlim, + warnp); + continue; + case '%': + /* + ** X311J/88-090 (4.12.3.5): if conversion char is + ** undefined, behavior is undefined. Print out the + ** character itself as printf(3) also does. + */ + default: + break; + } + } + if (pt == ptlim) + break; + *pt++ = *format; + } + return pt; +} + +static char * +_conv(n, format, pt, ptlim) +const int n; +const char * const format; +char * const pt; +const char * const ptlim; +{ + char buf[INT_STRLEN_MAXIMUM(int) + 1]; + + (void) snprintf(buf, sizeof buf, format, n); + return _add(buf, pt, ptlim); +} + +static char * +_add(str, pt, ptlim) +const char * str; +char * pt; +const char * const ptlim; +{ + while (pt < ptlim && (*pt = *str++) != '\0') + ++pt; + return pt; +} + +/* +** POSIX and the C Standard are unclear or inconsistent about +** what %C and %y do if the year is negative or exceeds 9999. +** Use the convention that %C concatenated with %y yields the +** same output as %Y, and that %Y contains at least 4 bytes, +** with more only if necessary. +*/ + +static char * +_yconv(a, b, convert_top, convert_yy, pt, ptlim) +const int a; +const int b; +const int convert_top; +const int convert_yy; +char * pt; +const char * const ptlim; +{ + register int lead; + register int trail; + +#define DIVISOR 100 + trail = a % DIVISOR + b % DIVISOR; + lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR; + trail %= DIVISOR; + if (trail < 0 && lead > 0) { + trail += DIVISOR; + --lead; + } else if (lead < 0 && trail > 0) { + trail -= DIVISOR; + ++lead; + } + if (convert_top) { + if (lead == 0 && trail < 0) + pt = _add("-0", pt, ptlim); + else pt = _conv(lead, "%02d", pt, ptlim); + } + if (convert_yy) + pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim); + return pt; +} + +#ifdef LOCALE_HOME +static struct lc_time_T * +_loc(void) +{ + static const char locale_home[] = LOCALE_HOME; + static const char lc_time[] = "LC_TIME"; + static char * locale_buf; + + int fd; + int oldsun; /* "...ain't got nothin' to do..." */ + int len; + char * lbuf; + char * nlbuf; + char * name; + char * p; + const char ** ap; + const char * plim; + char filename[FILENAME_MAX]; + struct stat st; + size_t namesize; + size_t bufsize; + + /* + ** Use localebuf.mon[0] to signal whether locale is already set up. + */ + if (localebuf.mon[0]) + return &localebuf; + name = setlocale(LC_TIME, (char *) NULL); + if (name == NULL || *name == '\0') + goto no_locale; + /* + ** If the locale name is the same as our cache, use the cache. + */ + lbuf = locale_buf; + if (lbuf != NULL && strcmp(name, lbuf) == 0) { + p = lbuf; + for (ap = (const char **) &localebuf; + ap < (const char **) (&localebuf + 1); + ++ap) + *ap = p += strlen(p) + 1; + return &localebuf; + } + /* + ** Slurp the locale file into the cache. + */ + namesize = strlen(name) + 1; + if (sizeof filename < + ((sizeof locale_home) + namesize + (sizeof lc_time))) + goto no_locale; + oldsun = 0; + len = snprintf(filename, sizeof filename, "%s/%s/%s", locale_home, + name, lc_time); + if (len < 0 || len >= sizeof filename) + goto no_locale; + fd = open(filename, O_RDONLY); + if (fd < 0) { + /* + ** Old Sun systems have a different naming and data convention. + */ + oldsun = 1; + len = snprintf(filename, sizeof filename, "%s/%s/%s", + locale_home, lc_time, name); + if (len < 0 || len >= sizeof filename) + goto no_locale; + fd = open(filename, O_RDONLY); + if (fd < 0) + goto no_locale; + } + if (fstat(fd, &st) != 0) + goto bad_locale; + if (st.st_size <= 0) + goto bad_locale; + bufsize = namesize + st.st_size; + locale_buf = NULL; + nlbuf = (lbuf == NULL) ? malloc(bufsize) : realloc(lbuf, bufsize); + if (nlbuf == NULL) { + if (lbuf) + free(lbuf); + lbuf = NULL; + goto bad_locale; + } + lbuf = nlbuf; + (void) strlcpy(lbuf, name, bufsize); + p = lbuf + namesize; + plim = p + st.st_size; + if (read(fd, p, (size_t) st.st_size) != st.st_size) + goto bad_lbuf; + if (close(fd) != 0) + goto bad_lbuf; + /* + ** Parse the locale file into localebuf. + */ + if (plim[-1] != '\n') + goto bad_lbuf; + for (ap = (const char **) &localebuf; + ap < (const char **) (&localebuf + 1); + ++ap) { + if (p == plim) + goto bad_lbuf; + *ap = p; + while (*p != '\n') + ++p; + *p++ = '\0'; + } + if (oldsun) { + /* + ** SunOS 4 used an obsolescent format; see localdtconv(3). + ** c_fmt had the ``short format for dates and times together'' + ** (SunOS 4 date, "%a %b %e %T %Z %Y" in the C locale); + ** date_fmt had the ``long format for dates'' + ** (SunOS 4 strftime %C, "%A, %B %e, %Y" in the C locale). + ** Discard the latter in favor of the former. + */ + localebuf.date_fmt = localebuf.c_fmt; + } + /* + ** Record the successful parse in the cache. + */ + locale_buf = lbuf; + + return &localebuf; + +bad_lbuf: + free(lbuf); +bad_locale: + (void) close(fd); +no_locale: + localebuf = C_time_locale; + locale_buf = NULL; + return &localebuf; +} +#endif /* defined LOCALE_HOME */ diff --git a/sdk/tlibc/time/tzfile.h b/sdk/tlibc/time/tzfile.h new file mode 100644 index 0000000000..f2316855ca --- /dev/null +++ b/sdk/tlibc/time/tzfile.h @@ -0,0 +1,72 @@ +/* $OpenBSD: tzfile.h,v 1.8 2007/02/06 19:35:16 millert Exp $ */ + +#ifndef TZFILE_H + +#define TZFILE_H + +/* +** This file is in the public domain, so clarified as of +** 1996-06-05 by Arthur David Olson. +*/ + +/* +** This header is for use ONLY with the time conversion code. +** There is no guarantee that it will remain unchanged, +** or that it will remain at all. +** Do NOT copy it to any system include directory. +** Thank you! +*/ + +#define SECSPERMIN 60 +#define MINSPERHOUR 60 +#define HOURSPERDAY 24 +#define DAYSPERWEEK 7 +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) +#define MONSPERYEAR 12 + +#define TM_SUNDAY 0 +#define TM_MONDAY 1 +#define TM_TUESDAY 2 +#define TM_WEDNESDAY 3 +#define TM_THURSDAY 4 +#define TM_FRIDAY 5 +#define TM_SATURDAY 6 + +#define TM_JANUARY 0 +#define TM_FEBRUARY 1 +#define TM_MARCH 2 +#define TM_APRIL 3 +#define TM_MAY 4 +#define TM_JUNE 5 +#define TM_JULY 6 +#define TM_AUGUST 7 +#define TM_SEPTEMBER 8 +#define TM_OCTOBER 9 +#define TM_NOVEMBER 10 +#define TM_DECEMBER 11 + +#define TM_YEAR_BASE 1900 + +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY TM_THURSDAY + +#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + +/* +** Since everything in isleap is modulo 400 (or a factor of 400), we know that +** isleap(y) == isleap(y % 400) +** and so +** isleap(a + b) == isleap((a + b) % 400) +** or +** isleap(a + b) == isleap(a % 400 + b % 400) +** This is true even if % means modulo rather than Fortran remainder +** (which is allowed by C89 but not C99). +** We use this to avoid addition overflow problems. +*/ + +#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) + +#endif /* !defined TZFILE_H */ diff --git a/sdk/tlibc/tstdc_version.cpp b/sdk/tlibc/tstdc_version.cpp new file mode 100644 index 0000000000..4fba487614 --- /dev/null +++ b/sdk/tlibc/tstdc_version.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_TSTDC_VERSION_STR __CONCAT("SGX_TSTDC_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_tstdc_version = SGX_TSTDC_VERSION_STR; + +#ifdef __cplusplus +} +#endif diff --git a/sdk/tlibcrypto/Makefile b/sdk/tlibcrypto/Makefile new file mode 100644 index 0000000000..32a29627e1 --- /dev/null +++ b/sdk/tlibcrypto/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CRYPTO_PATH = $(LINUX_EXTERNAL_DIR)/crypto_px + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -Werror -fno-exceptions -fno-rtti + +CPPFLAGS := -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(CRYPTO_PATH)/include + +OBJ = init_crypto_lib.o sgx_aes_ctr.o sgx_aes_gcm.o sgx_cmac128.o sgx_ecc256.o sgx_ecc256_common.o sgx_ecc256_ecdsa.o sgx_sha256.o sgx_sha256_msg.o tcrypto_version.o + +TARGET := libsgx_tcrypto.a + +libcrypto_px: + $(MAKE) -C $(CRYPTO_PATH) + +$(TARGET): $(OBJ) libcrypto_px + @$(CP) $(CRYPTO_PATH)/libcrypto_px.a $@ + $(AR) rsD $@ $(OBJ) + +$(OBJ): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: all +all: $(TARGET) | $(BUILD_DIR) + @$(CP) $< $| + +.PHONY: clean +clean: + $(MAKE) -C $(CRYPTO_PATH) clean + @$(RM) *.o $(TARGET) $(BUILD_DIR)/$(TARGET) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/tlibcrypto/init_crypto_lib.cpp b/sdk/tlibcrypto/init_crypto_lib.cpp new file mode 100644 index 0000000000..fe983f1d9d --- /dev/null +++ b/sdk/tlibcrypto/init_crypto_lib.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tcrypto.h" +#include "ippcore.h" +#include "ippcp.h" +#include "se_cpu_feature.h" +#include "se_cdefs.h" + +// add a version to tcrypto. +SGX_ACCESS_VERSION(tcrypto, 1) + + +extern "C" sgx_status_t sgx_init_crypto_lib(uint64_t cpu_feature_indicator) +{ + (void) cpu_feature_indicator; + return SGX_SUCCESS; +} + diff --git a/sdk/tlibcrypto/sgx_aes_ctr.cpp b/sdk/tlibcrypto/sgx_aes_ctr.cpp new file mode 100644 index 0000000000..296fbc3764 --- /dev/null +++ b/sdk/tlibcrypto/sgx_aes_ctr.cpp @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tcrypto.h" +#include "ippcp.h" +#include "stdlib.h" +#include "string.h" + +/* AES-CTR 128-bit + * Parameters: + * Return: + * sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h + * Inputs: + * sgx_aes_128bit_key_t *p_key - Pointer to the key used in encryption/decryption operation + * uint8_t *p_src - Pointer to the input stream to be encrypted/decrypted + * uint32_t src_len - Length of the input stream to be encrypted/decrypted + * uint8_t *p_ctr - Pointer to the counter block + * uint32_t ctr_inc_bits - Number of bits in counter to be incremented + * Output: + * uint8_t *p_dst - Pointer to the cipher text. Size of buffer should be >= src_len. + */ +sgx_status_t sgx_aes_ctr_encrypt(const sgx_aes_ctr_128bit_key_t *p_key, const uint8_t *p_src, + const uint32_t src_len, uint8_t *p_ctr, const uint32_t ctr_inc_bits, + uint8_t *p_dst) +{ + IppStatus error_code = ippStsNoErr; + IppsAESSpec* ptr_ctx = NULL; + int ctx_size = 0; + + if ((p_key == NULL) || (p_src == NULL) || (p_ctr == NULL) || (p_dst == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // AES-CTR-128 encryption + error_code = ippsAESGetSize(&ctx_size); + if (error_code != ippStsNoErr) + { + return SGX_ERROR_UNEXPECTED; + } + ptr_ctx = (IppsAESSpec*)malloc(ctx_size); + if (ptr_ctx == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + + // Init + error_code = ippsAESInit((const Ipp8u*)p_key, SGX_AESCTR_KEY_SIZE, ptr_ctx, ctx_size); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(ptr_ctx, ctx_size, 0, ctx_size); + free(ptr_ctx); + switch (error_code) + { + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + error_code = ippsAESEncryptCTR(p_src, p_dst, src_len, ptr_ctx, p_ctr, ctr_inc_bits); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(ptr_ctx, ctx_size, 0, ctx_size); + free(ptr_ctx); + switch (error_code) + { + case ippStsCTRSizeErr: + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(ptr_ctx, ctx_size, 0, ctx_size); + free(ptr_ctx); + return SGX_SUCCESS; +} + +sgx_status_t sgx_aes_ctr_decrypt(const sgx_aes_ctr_128bit_key_t *p_key, const uint8_t *p_src, + const uint32_t src_len, uint8_t *p_ctr, const uint32_t ctr_inc_bits, + uint8_t *p_dst) +{ + IppStatus error_code = ippStsNoErr; + IppsAESSpec* ptr_ctx = NULL; + int ctx_size = 0; + + if ((p_key == NULL) || (p_src == NULL) || (p_ctr == NULL) || (p_dst == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // AES-CTR-128 encryption + error_code = ippsAESGetSize(&ctx_size); + if (error_code != ippStsNoErr) + { + return SGX_ERROR_UNEXPECTED; + } + ptr_ctx = (IppsAESSpec*)malloc(ctx_size); + if (ptr_ctx == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + + // Init + error_code = ippsAESInit((const Ipp8u*)p_key, SGX_AESCTR_KEY_SIZE, ptr_ctx, ctx_size); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(ptr_ctx, ctx_size, 0, ctx_size); + free(ptr_ctx); + switch (error_code) + { + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + error_code = ippsAESDecryptCTR(p_src, p_dst, src_len, ptr_ctx, p_ctr, ctr_inc_bits); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(ptr_ctx, ctx_size, 0, ctx_size); + free(ptr_ctx); + switch (error_code) + { + case ippStsCTRSizeErr: + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(ptr_ctx, ctx_size, 0, ctx_size); + free(ptr_ctx); + return SGX_SUCCESS; +} diff --git a/sdk/tlibcrypto/sgx_aes_gcm.cpp b/sdk/tlibcrypto/sgx_aes_gcm.cpp new file mode 100644 index 0000000000..3590542d85 --- /dev/null +++ b/sdk/tlibcrypto/sgx_aes_gcm.cpp @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tcrypto.h" +#include "ippcp.h" +#include "stdlib.h" +#include "string.h" + +/* Rijndael AES-GCM +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_aes_gcm_128bit_key_t *p_key - Pointer to key used in encryption/decryption operation +* uint8_t *p_src - Pointer to input stream to be encrypted/decrypted +* uint32_t src_len - Length of input stream to be encrypted/decrypted +* uint8_t *p_iv - Pointer to initialization vector to use +* uint32_t iv_len - Length of initialization vector +* uint8_t *p_aad - Pointer to input stream of additional authentication data +* uint32_t aad_len - Length of additional authentication data stream +* sgx_aes_gcm_128bit_tag_t *p_in_mac - Pointer to expected MAC in decryption process +* Output: uint8_t *p_dst - Pointer to cipher text. Size of buffer should be >= src_len. +* sgx_aes_gcm_128bit_tag_t *p_out_mac - Pointer to MAC generated from encryption process +* NOTE: Wrapper is responsible for confirming decryption tag matches encryption tag */ +sgx_status_t sgx_rijndael128GCM_encrypt(const sgx_aes_gcm_128bit_key_t *p_key, const uint8_t *p_src, uint32_t src_len, + uint8_t *p_dst, const uint8_t *p_iv, uint32_t iv_len, const uint8_t *p_aad, uint32_t aad_len, + sgx_aes_gcm_128bit_tag_t *p_out_mac) +{ + IppStatus error_code = ippStsNoErr; + IppsAES_GCMState* pState = NULL; + int ippStateSize = 0; + + if ((p_key == NULL) || ((src_len > 0) && (p_dst == NULL)) || ((src_len > 0) && (p_src == NULL)) + || (p_out_mac == NULL) || (iv_len != SGX_AESGCM_IV_SIZE) || ((aad_len > 0) && (p_aad == NULL)) + || (p_iv == NULL) || ((p_src == NULL) && (p_aad == NULL))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + error_code = ippsAES_GCMGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + return SGX_ERROR_UNEXPECTED; + } + pState = (IppsAES_GCMState*)malloc(ippStateSize); + if (pState == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + error_code = ippsAES_GCMInit((const Ipp8u *)p_key, SGX_AESGCM_KEY_SIZE, pState, ippStateSize); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_GCMStart(p_iv, SGX_AESGCM_IV_SIZE, p_aad, aad_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + if (src_len > 0) { + error_code = ippsAES_GCMEncrypt(p_src, p_dst, src_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + } + error_code = ippsAES_GCMGetTag((Ipp8u *)p_out_mac, SGX_AESGCM_MAC_SIZE, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(p_dst, src_len, 0, src_len); + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + return SGX_SUCCESS; +} + +sgx_status_t sgx_rijndael128GCM_decrypt(const sgx_aes_gcm_128bit_key_t *p_key, const uint8_t *p_src, + uint32_t src_len, uint8_t *p_dst, const uint8_t *p_iv, uint32_t iv_len, + const uint8_t *p_aad, uint32_t aad_len, const sgx_aes_gcm_128bit_tag_t *p_in_mac) +{ + IppStatus error_code = ippStsNoErr; + uint8_t l_tag[SGX_AESGCM_MAC_SIZE]; + IppsAES_GCMState* pState = NULL; + int ippStateSize = 0; + + if ((p_key == NULL) || ((src_len > 0) && (p_dst == NULL)) || ((src_len > 0) && (p_src == NULL)) + || (p_in_mac == NULL) || (iv_len != SGX_AESGCM_IV_SIZE) || ((aad_len > 0) && (p_aad == NULL)) + || (p_iv == NULL) || ((p_src == NULL) && (p_aad == NULL))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // Autenthication Tag returned by Decrypt to be compared with Tag created during seal + memset(&l_tag, 0, SGX_AESGCM_MAC_SIZE); + error_code = ippsAES_GCMGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + return SGX_ERROR_UNEXPECTED; + } + pState = (IppsAES_GCMState*)malloc(ippStateSize); + if (pState == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + error_code = ippsAES_GCMInit((const Ipp8u *)p_key, SGX_AESGCM_KEY_SIZE, pState, ippStateSize); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_GCMStart(p_iv, SGX_AESGCM_IV_SIZE, p_aad, aad_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + if (src_len > 0) { + error_code = ippsAES_GCMDecrypt(p_src, p_dst, src_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + } + error_code = ippsAES_GCMGetTag((Ipp8u *)l_tag, SGX_AESGCM_MAC_SIZE, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(p_dst, src_len, 0, src_len); + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + + // Verify current data tag = data tag generated when sealing the data blob + if (consttime_memequal(p_in_mac, &l_tag, SGX_AESGCM_MAC_SIZE) == 0) + { + memset_s(p_dst, src_len, 0, src_len); + memset_s(&l_tag, SGX_AESGCM_MAC_SIZE, 0, SGX_AESGCM_MAC_SIZE); + return SGX_ERROR_MAC_MISMATCH; + } + + memset_s(&l_tag, SGX_AESGCM_MAC_SIZE, 0, SGX_AESGCM_MAC_SIZE); + return SGX_SUCCESS; +} + diff --git a/sdk/tlibcrypto/sgx_cmac128.cpp b/sdk/tlibcrypto/sgx_cmac128.cpp new file mode 100644 index 0000000000..c532a648c4 --- /dev/null +++ b/sdk/tlibcrypto/sgx_cmac128.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tcrypto.h" +#include "ippcp.h" +#include "stdlib.h" +#include "string.h" + + +/* Message Authentication - Rijndael 128 CMAC +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_cmac_128bit_key_t *p_key - Pointer to key used in encryption/decryption operation +* uint8_t *p_src - Pointer to input stream to be MACed +* uint32_t src_len - Length of input stream to be MACed +* Output: sgx_cmac_gcm_128bit_tag_t *p_mac - Pointer to resultant MAC */ +sgx_status_t sgx_rijndael128_cmac_msg(const sgx_cmac_128bit_key_t *p_key, const uint8_t *p_src, + uint32_t src_len, sgx_cmac_128bit_tag_t *p_mac) +{ + IppsAES_CMACState* pState = NULL; + int ippStateSize = 0; + IppStatus error_code = ippStsNoErr; + + if ((p_key == NULL) || (p_src == NULL) || (p_mac == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + error_code = ippsAES_CMACGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + return SGX_ERROR_UNEXPECTED; + } + pState = (IppsAES_CMACState*)malloc(ippStateSize); + if (pState == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + error_code = ippsAES_CMACInit((const Ipp8u *)p_key, SGX_CMAC_KEY_SIZE, pState, ippStateSize); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_CMACUpdate((const Ipp8u *)p_src, src_len, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + error_code = ippsAES_CMACFinal((Ipp8u *)p_mac, SGX_CMAC_MAC_SIZE, pState); + if (error_code != ippStsNoErr) + { + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + switch (error_code) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + // Clear temp State before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + return SGX_SUCCESS; +} + +static void sgx_secure_free_cmac128_state(IppsAES_CMACState *pState) +{ + if (pState == NULL) + return; + int ippStateSize = 0; + IppStatus error_code = ippStsNoErr; + error_code = ippsAES_CMACGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + free(pState); + return; + } + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + return; +} + +/* Allocates and initializes CMAC state +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h +* Inputs: sgx_cmac_128bit_key_t *p_key - Pointer to the key used in encryption/decryption operation +* Output: sgx_cmac_state_handle_t *p_cmac_handle - Pointer to the handle of the CMAC state */ +sgx_status_t sgx_cmac128_init(const sgx_cmac_128bit_key_t *p_key, sgx_cmac_state_handle_t* p_cmac_handle) +{ + if ((p_key == NULL) || (p_cmac_handle == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppsAES_CMACState* pState = NULL; + int ippStateSize = 0; + IppStatus error_code = ippStsNoErr; + error_code = ippsAES_CMACGetSize(&ippStateSize); + if (error_code != ippStsNoErr) + { + return SGX_ERROR_UNEXPECTED; + } + pState = (IppsAES_CMACState*)malloc(ippStateSize); + if (pState == NULL) + { + return SGX_ERROR_OUT_OF_MEMORY; + } + error_code = ippsAES_CMACInit((const Ipp8u *)p_key, SGX_CMAC_KEY_SIZE, pState, ippStateSize); + if (error_code != ippStsNoErr) + { + // Clear state before free. + memset_s(pState, ippStateSize, 0, ippStateSize); + free(pState); + *p_cmac_handle = NULL; + switch (error_code) + { + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + *p_cmac_handle = pState; + return SGX_SUCCESS; +} + +/* Updates CMAC hash calculation based on the input message +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error. +* Input: sgx_cmac_state_handle_t cmac_handle - Handle to the CMAC state +* uint8_t *p_src - Pointer to the input stream to be hashed +* uint32_t src_len - Length of the input stream to be hashed */ +sgx_status_t sgx_cmac128_update(const uint8_t *p_src, uint32_t src_len, sgx_cmac_state_handle_t cmac_handle) +{ + if ((p_src == NULL) || (cmac_handle == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + IppStatus error_code = ippStsNoErr; + error_code = ippsAES_CMACUpdate(p_src, src_len, (IppsAES_CMACState*)cmac_handle); + switch (error_code) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Returns Hash calculation +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h +* Input: sgx_cmac_state_handle_t cmac_handle - Handle to the CMAC state +* Output: sgx_cmac_128bit_tag_t *p_hash - Resultant hash from operation */ +sgx_status_t sgx_cmac128_final(sgx_cmac_state_handle_t cmac_handle, sgx_cmac_128bit_tag_t *p_hash) +{ + if ((cmac_handle == NULL) || (p_hash == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + IppStatus error_code = ippStsNoErr; + error_code = ippsAES_CMACFinal((Ipp8u *)p_hash, SGX_CMAC_MAC_SIZE, (IppsAES_CMACState*)cmac_handle); + switch (error_code) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + + +/* Clean up the CMAC state +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h +* Input: sgx_cmac_state_handle_t cmac_handle - Handle to the CMAC state */ +sgx_status_t sgx_cmac128_close(sgx_cmac_state_handle_t cmac_handle) +{ + if (cmac_handle == NULL) + return SGX_ERROR_INVALID_PARAMETER; + sgx_secure_free_cmac128_state((IppsAES_CMACState*)cmac_handle); + return SGX_SUCCESS; +} diff --git a/sdk/tlibcrypto/sgx_ecc256.cpp b/sdk/tlibcrypto/sgx_ecc256.cpp new file mode 100644 index 0000000000..c459f761c0 --- /dev/null +++ b/sdk/tlibcrypto/sgx_ecc256.cpp @@ -0,0 +1,484 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_ecc256_common.h" + + +/* +* Elliptic Curve Crytpography - Based on GF(p), 256 bit +*/ +/* Allocates and initializes ecc context +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Output: sgx_ecc_state_handle_t *p_ecc_handle - Pointer to the handle of ECC crypto system */ +sgx_status_t sgx_ecc256_open_context(sgx_ecc_state_handle_t* p_ecc_handle) +{ + IppStatus ipp_ret = ippStsNoErr; + IppsECCPState* p_ecc_state = NULL; + // default use 256r1 parameter + int ctx_size = 0; + + if (p_ecc_handle == NULL) + return SGX_ERROR_INVALID_PARAMETER; + ipp_ret = ippsECCPGetSize(256, &ctx_size); + if (ipp_ret != ippStsNoErr) + return SGX_ERROR_UNEXPECTED; + p_ecc_state = (IppsECCPState*)(malloc(ctx_size)); + if (p_ecc_state == NULL) + return SGX_ERROR_OUT_OF_MEMORY; + ipp_ret = ippsECCPInit(256, p_ecc_state); + if (ipp_ret != ippStsNoErr) + { + SAFE_FREE(p_ecc_state); + *p_ecc_handle = NULL; + return SGX_ERROR_UNEXPECTED; + } + ipp_ret = ippsECCPSetStd(IppECCPStd256r1, p_ecc_state); + if (ipp_ret != ippStsNoErr) + { + SAFE_FREE(p_ecc_state); + *p_ecc_handle = NULL; + return SGX_ERROR_UNEXPECTED; + } + *p_ecc_handle = p_ecc_state; + return SGX_SUCCESS; +} + +/* Cleans up ecc context +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Output: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system */ +sgx_status_t sgx_ecc256_close_context(sgx_ecc_state_handle_t ecc_handle) +{ + if (ecc_handle == NULL) + { + return SGX_ERROR_INVALID_PARAMETER; + } + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + int ctx_size = 0; + IppStatus ipp_ret = ippsECCPGetSize(256, &ctx_size); + if (ipp_ret != ippStsNoErr) + { + free(p_ecc_state); + return SGX_SUCCESS; + } + memset_s(p_ecc_state, ctx_size, 0, ctx_size); + free(p_ecc_state); + return SGX_SUCCESS; +} + +/* Populates private/public key pair - caller code allocates memory +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* Outputs: sgx_ec256_private_t *p_private - Pointer to the private key +* sgx_ec256_public_t *p_public - Pointer to the public key */ +sgx_status_t sgx_ecc256_create_key_pair(sgx_ec256_private_t *p_private, + sgx_ec256_public_t *p_public, + sgx_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private == NULL) || (p_public == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppsBigNumState* dh_priv_BN = NULL; + IppsECCPPointState* point_pub = NULL; + IppsBigNumState* pub_gx = NULL; + IppsBigNumState* pub_gy = NULL; + IppStatus ipp_ret = ippStsNoErr; + int ecPointSize = 0; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + + do + { + //init eccp point + ipp_ret = ippsECCPPointGetSize(256, &ecPointSize); + ERROR_BREAK(ipp_ret); + point_pub = (IppsECCPPointState*)(malloc(ecPointSize)); + if (!point_pub) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point_pub); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, SGX_ECP256_KEY_SIZE, &dh_priv_BN); + ERROR_BREAK(ipp_ret); + // Use the true random number (DRNG) + // Notice that IPP ensures the private key generated is non-zero + ipp_ret = ippsECCPGenKeyPair(dh_priv_BN, point_pub, p_ecc_state, (IppBitSupplier)sgx_ipp_DRNGen, NULL); + ERROR_BREAK(ipp_ret); + + //convert point_result to oct string + ipp_ret = sgx_ipp_newBN(NULL, SGX_ECP256_KEY_SIZE, &pub_gx); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, SGX_ECP256_KEY_SIZE, &pub_gy); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPGetPoint(pub_gx, pub_gy, point_pub, p_ecc_state); + ERROR_BREAK(ipp_ret); + + IppsBigNumSGN sgn = IppsBigNumPOS; + Ipp32u *pdata = NULL; + // ippsRef_BN is in bits not bytes (versus old ippsGet_BN) + int length = 0; + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, pub_gx); + ERROR_BREAK(ipp_ret); + memset(p_public->gx, 0, sizeof(p_public->gx)); + ipp_ret = check_copy_size(sizeof(p_public->gx), ROUND_TO(length, 8) / 8); + ERROR_BREAK(ipp_ret); + memcpy(p_public->gx, pdata, ROUND_TO(length, 8) / 8); + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, pub_gy); + ERROR_BREAK(ipp_ret); + memset(p_public->gy, 0, sizeof(p_public->gy)); + ipp_ret = check_copy_size(sizeof(p_public->gy), ROUND_TO(length, 8) / 8); + ERROR_BREAK(ipp_ret); + memcpy(p_public->gy, pdata, ROUND_TO(length, 8) / 8); + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, dh_priv_BN); + ERROR_BREAK(ipp_ret); + memset(p_private->r, 0, sizeof(p_private->r)); + ipp_ret = check_copy_size(sizeof(p_private->r), ROUND_TO(length, 8) / 8); + ERROR_BREAK(ipp_ret); + memcpy(p_private->r, pdata, ROUND_TO(length, 8) / 8); + } while (0); + + //Clear temp buffer before free. + if (point_pub) memset_s(point_pub, ecPointSize, 0, ecPointSize); + SAFE_FREE(point_pub); + sgx_ipp_secure_free_BN(pub_gx, SGX_ECP256_KEY_SIZE); + sgx_ipp_secure_free_BN(pub_gy, SGX_ECP256_KEY_SIZE); + sgx_ipp_secure_free_BN(dh_priv_BN, SGX_ECP256_KEY_SIZE); + + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Checks whether the input point is a valid point on the given elliptic curve +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sgx_ec256_public_t *p_point - Pointer to perform validity check on - LITTLE ENDIAN +* Output: int *p_valid - Return 0 if the point is an invalid point on ECC curve */ +sgx_status_t sgx_ecc256_check_point(const sgx_ec256_public_t *p_point, + const sgx_ecc_state_handle_t ecc_handle, + int *p_valid) +{ + if ((ecc_handle == NULL) || (p_point == NULL) || (p_valid == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppsECCPPointState* point2check = NULL; + IppStatus ipp_ret = ippStsNoErr; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + IppECResult ipp_result = ippECValid; + int ecPointSize = 0; + IppsBigNumState* BN_gx = NULL; + IppsBigNumState* BN_gy = NULL; + + // Intialize return to false + *p_valid = 0; + + do + { + ipp_ret = ippsECCPPointGetSize(256, &ecPointSize); + ERROR_BREAK(ipp_ret); + point2check = (IppsECCPPointState*)malloc(ecPointSize); + if (!point2check) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point2check); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN((const Ipp32u *)p_point->gx, sizeof(p_point->gx), &BN_gx); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((const Ipp32u *)p_point->gy, sizeof(p_point->gy), &BN_gy); + ERROR_BREAK(ipp_ret); + + ipp_ret = ippsECCPSetPoint(BN_gx, BN_gy, point2check, p_ecc_state); + ERROR_BREAK(ipp_ret); + + // Check to see if the point is a valid point on the Elliptic curve and is not infinity + ipp_ret = ippsECCPCheckPoint(point2check, &ipp_result, p_ecc_state); + ERROR_BREAK(ipp_ret); + if (ipp_result == ippECValid) + { + *p_valid = 1; + } + } while (0); + + // Clear temp buffer before free. + if (point2check) + memset_s(point2check, ecPointSize, 0, ecPointSize); + SAFE_FREE(point2check); + + sgx_ipp_secure_free_BN(BN_gx, sizeof(p_point->gx)); + sgx_ipp_secure_free_BN(BN_gy, sizeof(p_point->gy)); + + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Computes DH shared key based on private B key (local) and remote public Ga Key +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sgx_ec256_private_t *p_private_b - Pointer to the local private key - LITTLE ENDIAN +* sgx_ec256_public_t *p_public_ga - Pointer to the remote public key - LITTLE ENDIAN +* Output: sgx_ec256_dh_shared_t *p_shared_key - Pointer to the shared DH key - LITTLE ENDIAN +x-coordinate of (privKeyB - pubKeyA) */ +sgx_status_t sgx_ecc256_compute_shared_dhkey(sgx_ec256_private_t *p_private_b, + sgx_ec256_public_t *p_public_ga, + sgx_ec256_dh_shared_t *p_shared_key, + sgx_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private_b == NULL) || (p_public_ga == NULL) || (p_shared_key == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppsBigNumState* BN_dh_privB = NULL; + IppsBigNumState* BN_dh_share = NULL; + IppsBigNumState* pubA_gx = NULL; + IppsBigNumState* pubA_gy = NULL; + IppsECCPPointState* point_pubA = NULL; + IppStatus ipp_ret = ippStsNoErr; + int ecPointSize = 0; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + IppECResult ipp_result = ippECValid; + + do + { + ipp_ret = sgx_ipp_newBN((Ipp32u*)p_private_b->r, sizeof(sgx_ec256_private_t), &BN_dh_privB); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((uint32_t*)p_public_ga->gx, sizeof(p_public_ga->gx), &pubA_gx); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((uint32_t*)p_public_ga->gy, sizeof(p_public_ga->gy), &pubA_gy); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPPointGetSize(256, &ecPointSize); + ERROR_BREAK(ipp_ret); + point_pubA = (IppsECCPPointState*)(malloc(ecPointSize)); + if (!point_pubA) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point_pubA); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetPoint(pubA_gx, pubA_gy, point_pubA, p_ecc_state); + ERROR_BREAK(ipp_ret); + + // Check to see if the point is a valid point on the Elliptic curve and is not infinity + ipp_ret = ippsECCPCheckPoint(point_pubA, &ipp_result, p_ecc_state); + if (ipp_result != ippECValid) + { + break; + } + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, sizeof(sgx_ec256_dh_shared_t), &BN_dh_share); + ERROR_BREAK(ipp_ret); + /* This API generates shareA = x-coordinate of (privKeyB*pubKeyA) */ + ipp_ret = ippsECCPSharedSecretDH(BN_dh_privB, point_pubA, BN_dh_share, p_ecc_state); + ERROR_BREAK(ipp_ret); + IppsBigNumSGN sgn = IppsBigNumPOS; + int length = 0; + Ipp32u * pdata = NULL; + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, BN_dh_share); + ERROR_BREAK(ipp_ret); + memset(p_shared_key->s, 0, sizeof(p_shared_key->s)); + ipp_ret = check_copy_size(sizeof(p_shared_key->s), ROUND_TO(length, 8) / 8); + ERROR_BREAK(ipp_ret); + memcpy(p_shared_key->s, pdata, ROUND_TO(length, 8) / 8); + } while (0); + + // Clear temp buffer before free. + if (point_pubA) memset_s(point_pubA, ecPointSize, 0, ecPointSize); + SAFE_FREE(point_pubA); + sgx_ipp_secure_free_BN(pubA_gx, sizeof(p_public_ga->gx)); + sgx_ipp_secure_free_BN(pubA_gy, sizeof(p_public_ga->gy)); + sgx_ipp_secure_free_BN(BN_dh_privB, sizeof(sgx_ec256_private_t)); + sgx_ipp_secure_free_BN(BN_dh_share, sizeof(sgx_ec256_dh_shared_t)); + + + if (ipp_result != ippECValid) + { + return SGX_ERROR_INVALID_PARAMETER; + } + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Computes 512-bit DH shared key based on private B key (local) and remote public Ga Key +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sgx_ec256_private_t *p_private_b - Pointer to the local private key - LITTLE ENDIAN +* sgx_ec256_public_t *p_public_ga - Pointer to the remote public key - LITTLE ENDIAN +* Output: sgx_ec256_dh_shared_t *p_shared_key - Pointer to the shared DH key - LITTLE ENDIAN +x-coordinate of (privKeyB - pubKeyA) */ +sgx_status_t sgx_ecc256_compute_shared_dhkey512(sgx_ec256_private_t *p_private_b, + sgx_ec256_public_t *p_public_ga, + sgx_ec256_dh_shared512_t *p_shared_key, + sgx_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private_b == NULL) || (p_public_ga == NULL) || (p_shared_key == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppsBigNumState* BN_dh_privB = NULL; + IppsBigNumState* BN_dh_share512_x = NULL; + IppsBigNumState* BN_dh_share512_y = NULL; + IppsBigNumState* pubA_gx = NULL; + IppsBigNumState* pubA_gy = NULL; + IppsECCPPointState* point_pubA = NULL; + IppsECCPPointState* point_R = NULL; + IppStatus ipp_ret = ippStsNoErr; + int ecPointSize = 0; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + + do + { + ipp_ret = sgx_ipp_newBN((Ipp32u*)p_private_b->r, sizeof(sgx_ec256_private_t), &BN_dh_privB); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((uint32_t*)p_public_ga->gx, sizeof(p_public_ga->gx), &pubA_gx); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((uint32_t*)p_public_ga->gy, sizeof(p_public_ga->gy), &pubA_gy); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPPointGetSize(256, &ecPointSize); + ERROR_BREAK(ipp_ret); + point_pubA = (IppsECCPPointState*)( malloc(ecPointSize) ); + if(!point_pubA) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point_pubA); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetPoint(pubA_gx, pubA_gy, point_pubA, p_ecc_state); + ERROR_BREAK(ipp_ret); + + point_R = (IppsECCPPointState*)( malloc(ecPointSize) ); + if(!point_R) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, point_R); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, sizeof(sgx_ec256_dh_shared_t), &BN_dh_share512_x); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, sizeof(sgx_ec256_dh_shared_t), &BN_dh_share512_y); + ERROR_BREAK(ipp_ret); + + ipp_ret = ippsECCPMulPointScalar(point_pubA, BN_dh_privB, point_R, p_ecc_state); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPGetPoint(BN_dh_share512_x, BN_dh_share512_y, point_R, p_ecc_state); + ERROR_BREAK(ipp_ret); + + IppsBigNumSGN sgn = IppsBigNumPOS; + int length = 0; + Ipp32u *pdata = NULL; + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, BN_dh_share512_x); + ERROR_BREAK(ipp_ret); + memset(p_shared_key->x, 0, sizeof(p_shared_key->x)); + memcpy(p_shared_key->x, pdata, ROUND_TO(length, 8)/8); + // Clear memory securely + memset_s(pdata, sizeof(p_shared_key->x), 0, ROUND_TO(length, 8)/8); + + ipp_ret = ippsRef_BN(&sgn, &length, &pdata, BN_dh_share512_y); + ERROR_BREAK(ipp_ret); + memset(p_shared_key->y, 0, sizeof(p_shared_key->y)); + memcpy(p_shared_key->y, pdata, ROUND_TO(length, 8)/8); + // Clear memory securely + memset_s(pdata, sizeof(p_shared_key->x), 0, ROUND_TO(length, 8)/8); + }while(0); + + // Clear temp buffer before free. + if (point_pubA) memset_s(point_pubA, ecPointSize, 0, ecPointSize); + SAFE_FREE(point_pubA); + if (point_R) memset_s(point_R, ecPointSize, 0, ecPointSize); + SAFE_FREE(point_R); + sgx_ipp_secure_free_BN(pubA_gx, sizeof(p_public_ga->gx)); + sgx_ipp_secure_free_BN(pubA_gy, sizeof(p_public_ga->gy)); + sgx_ipp_secure_free_BN(BN_dh_privB, sizeof(sgx_ec256_private_t)); + sgx_ipp_secure_free_BN(BN_dh_share512_x, sizeof(sgx_ec256_dh_shared_t)); + sgx_ipp_secure_free_BN(BN_dh_share512_y, sizeof(sgx_ec256_dh_shared_t)); + + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} diff --git a/sdk/tlibcrypto/sgx_ecc256_common.cpp b/sdk/tlibcrypto/sgx_ecc256_common.cpp new file mode 100644 index 0000000000..6c5bdb994d --- /dev/null +++ b/sdk/tlibcrypto/sgx_ecc256_common.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_ecc256_common.h" + + +IppStatus sgx_ipp_newBN(const Ipp32u *p_data, int size_in_bytes, IppsBigNumState **p_new_BN) +{ + IppsBigNumState *pBN = 0; + int bn_size = 0; + + if (p_new_BN == NULL || (size_in_bytes <= 0) || ((size_in_bytes % sizeof(Ipp32u)) != 0)) + return ippStsBadArgErr; + + // Get the size of the IppsBigNumState context in bytes + IppStatus error_code = ippsBigNumGetSize(size_in_bytes/(int)sizeof(Ipp32u), &bn_size); + if (error_code != ippStsNoErr) + { + *p_new_BN = 0; + return error_code; + } + pBN = (IppsBigNumState *)malloc(bn_size); + if (!pBN) + { + error_code = ippStsMemAllocErr; + *p_new_BN = 0; + return error_code; + } + // Initialize context and partition allocated buffer + error_code = ippsBigNumInit(size_in_bytes/(int)sizeof(Ipp32u), pBN); + if (error_code != ippStsNoErr) + { + free(pBN); + *p_new_BN = 0; + return error_code; + } + if (p_data) + { + error_code = ippsSet_BN(IppsBigNumPOS, size_in_bytes/(int)sizeof(Ipp32u), p_data, pBN); + if (error_code != ippStsNoErr) + { + *p_new_BN = 0; + free(pBN); + return error_code; + } + } + + + *p_new_BN = pBN; + return error_code; +} + +void sgx_ipp_secure_free_BN(IppsBigNumState *pBN, int size_in_bytes) +{ + if (pBN == NULL || size_in_bytes <= 0 || ((size_in_bytes % sizeof(Ipp32u)) != 0)) + { + if (pBN) + { + free(pBN); + } + return; + } + int bn_size = 0; + + // Get the size of the IppsBigNumState context in bytes + // Since we have checked the size_in_bytes before and the &bn_size is not NULL, ippsBigNumGetSize never returns failure + IppStatus error_code = ippsBigNumGetSize(size_in_bytes/(int)sizeof(Ipp32u), &bn_size); + if (error_code != ippStsNoErr) + { + free(pBN); + return; + } + // Clear the buffer before free. + memset_s(pBN, bn_size, 0, bn_size); + free(pBN); + return; +} + +IppStatus __STDCALL sgx_ipp_DRNGen(Ipp32u* pRandBNU, int nBits, void* pCtx) +{ + sgx_status_t sgx_ret; + UNUSED(pCtx); + + if (0 != nBits % 8) + { + // Must be byte aligned + return ippStsSizeErr; + } + + if (!pRandBNU) + { + return ippStsNullPtrErr; + } + sgx_ret = sgx_read_rand((uint8_t*)pRandBNU, (uint32_t)nBits / 8); + if (SGX_SUCCESS != sgx_ret) + { + return ippStsErr; + } + return ippStsNoErr; +} diff --git a/sdk/tlibcrypto/sgx_ecc256_common.h b/sdk/tlibcrypto/sgx_ecc256_common.h new file mode 100644 index 0000000000..cf6512c81f --- /dev/null +++ b/sdk/tlibcrypto/sgx_ecc256_common.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _SGX_ECC256_COMMON_H_ +#define _SGX_ECC256_COMMON_H_ + +#include "sgx_trts.h" +#include "sgx_tcrypto.h" +#include "sgx_tcrypto_internal.h" +#include "ippcp.h" +#include "util.h" +#include "stdlib.h" +#include "string.h" + +#ifndef ERROR_BREAK +#define ERROR_BREAK(x) if(x != ippStsNoErr){break;} +#endif +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} +#endif + +IppStatus sgx_ipp_newBN(const Ipp32u *p_data, int size_in_bytes, IppsBigNumState **p_new_BN); +void sgx_ipp_secure_free_BN(IppsBigNumState *pBN, int size_in_bytes); +IppStatus __STDCALL sgx_ipp_DRNGen(Ipp32u* pRandBNU, int nBits, void* pCtx); + + + +static inline IppStatus check_copy_size(size_t target_size, size_t source_size) +{ + if(target_size < source_size) + return ippStsSizeErr; + return ippStsNoErr; +} + +#endif diff --git a/sdk/tlibcrypto/sgx_ecc256_ecdsa.cpp b/sdk/tlibcrypto/sgx_ecc256_ecdsa.cpp new file mode 100644 index 0000000000..dd5a6790a7 --- /dev/null +++ b/sdk/tlibcrypto/sgx_ecc256_ecdsa.cpp @@ -0,0 +1,299 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_ecc256_common.h" + + +const uint32_t sgx_nistp256_r[] = { + 0xFC632551, 0xF3B9CAC2, 0xA7179E84, 0xBCE6FAAD, 0xFFFFFFFF, 0xFFFFFFFF, + 0x00000000, 0xFFFFFFFF }; + + +/* Computes signature for data based on private key +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sgx_ec256_private_t *p_private - Pointer to the private key - LITTLE ENDIAN +* sgx_uint8_t *p_data - Pointer to the data to be signed +* uint32_t data_size - Size of the data to be signed +* Output: sgx_ec256_signature_t *p_signature - Pointer to the signature - LITTLE ENDIAN */ +sgx_status_t sgx_ecdsa_sign(const uint8_t *p_data, + uint32_t data_size, + sgx_ec256_private_t *p_private, + sgx_ec256_signature_t *p_signature, + sgx_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_private == NULL) || (p_signature == NULL) || (p_data == NULL) || (data_size < 1)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppStatus ipp_ret = ippStsNoErr; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + IppsBigNumState* p_ecp_order = NULL; + IppsBigNumState* p_hash_bn = NULL; + IppsBigNumState* p_msg_bn = NULL; + IppsBigNumState* p_eph_priv_bn = NULL; + IppsECCPPointState* p_eph_pub = NULL; + IppsBigNumState* p_reg_priv_bn = NULL; + IppsBigNumState* p_signx_bn = NULL; + IppsBigNumState* p_signy_bn = NULL; + Ipp32u *p_sigx = NULL; + Ipp32u *p_sigy = NULL; + int ecp_size = 0; + const int order_size = sizeof(sgx_nistp256_r); + uint32_t hash[8] = { 0 }; + + do + { + + ipp_ret = sgx_ipp_newBN(sgx_nistp256_r, order_size, &p_ecp_order); + ERROR_BREAK(ipp_ret); + + // Prepare the message used to sign. + ipp_ret = ippsHashMessage(p_data, data_size, (Ipp8u*)hash, IPP_ALG_HASH_SHA256); + ERROR_BREAK(ipp_ret); + /* Byte swap in creation of Big Number from SHA256 hash output */ + ipp_ret = sgx_ipp_newBN(NULL, sizeof(hash), &p_hash_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsSetOctString_BN((Ipp8u*)hash, sizeof(hash), p_hash_bn); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_msg_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsMod_BN(p_hash_bn, p_ecp_order, p_msg_bn); + ERROR_BREAK(ipp_ret); + + // Get ephemeral key pair. + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_eph_priv_bn); + ERROR_BREAK(ipp_ret); + //init eccp point + ipp_ret = ippsECCPPointGetSize(256, &ecp_size); + ERROR_BREAK(ipp_ret); + p_eph_pub = (IppsECCPPointState*)(malloc(ecp_size)); + if (!p_eph_pub) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, p_eph_pub); + ERROR_BREAK(ipp_ret); + // Generate ephemeral key pair for signing operation + // Notice that IPP ensures the private key generated is non-zero + ipp_ret = ippsECCPGenKeyPair(p_eph_priv_bn, p_eph_pub, p_ecc_state, + (IppBitSupplier)sgx_ipp_DRNGen, NULL); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetKeyPair(p_eph_priv_bn, p_eph_pub, ippFalse, p_ecc_state); + ERROR_BREAK(ipp_ret); + + // Set the regular private key. + ipp_ret = sgx_ipp_newBN((uint32_t *)p_private->r, sizeof(p_private->r), + &p_reg_priv_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_signx_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_signy_bn); + ERROR_BREAK(ipp_ret); + + // Sign the message. + ipp_ret = ippsECCPSignDSA(p_msg_bn, p_reg_priv_bn, p_signx_bn, p_signy_bn, + p_ecc_state); + ERROR_BREAK(ipp_ret); + + IppsBigNumSGN sign; + int length; + ipp_ret = ippsRef_BN(&sign, &length,(Ipp32u**) &p_sigx, p_signx_bn); + ERROR_BREAK(ipp_ret); + memset(p_signature->x, 0, sizeof(p_signature->x)); + ipp_ret = check_copy_size(sizeof(p_signature->x), ROUND_TO(length, 8) / 8); + ERROR_BREAK(ipp_ret); + memcpy(p_signature->x, p_sigx, ROUND_TO(length, 8) / 8); + memset_s(p_sigx, sizeof(p_signature->x), 0, ROUND_TO(length, 8) / 8); + ipp_ret = ippsRef_BN(&sign, &length,(Ipp32u**) &p_sigy, p_signy_bn); + ERROR_BREAK(ipp_ret); + memset(p_signature->y, 0, sizeof(p_signature->y)); + ipp_ret = check_copy_size(sizeof(p_signature->y), ROUND_TO(length, 8) / 8); + ERROR_BREAK(ipp_ret); + memcpy(p_signature->y, p_sigy, ROUND_TO(length, 8) / 8); + memset_s(p_sigy, sizeof(p_signature->y), 0, ROUND_TO(length, 8) / 8); + } while (0); + + // Clear buffer before free. + if (p_eph_pub) + memset_s(p_eph_pub, ecp_size, 0, ecp_size); + SAFE_FREE(p_eph_pub); + sgx_ipp_secure_free_BN(p_ecp_order, order_size); + sgx_ipp_secure_free_BN(p_hash_bn, sizeof(hash)); + sgx_ipp_secure_free_BN(p_msg_bn, order_size); + sgx_ipp_secure_free_BN(p_eph_priv_bn, order_size); + sgx_ipp_secure_free_BN(p_reg_priv_bn, sizeof(p_private->r)); + sgx_ipp_secure_free_BN(p_signx_bn, order_size); + sgx_ipp_secure_free_BN(p_signy_bn, order_size); + + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Verifies the signature for the given data based on the public key +* +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: sgx_ecc_state_handle_t ecc_handle - Handle to ECC crypto system +* sgx_ec256_public_t *p_public - Pointer to the public key - LITTLE ENDIAN +* uint8_t *p_data - Pointer to the data to be signed +* uint32_t data_size - Size of the data to be signed +* sgx_ec256_signature_t *p_signature - Pointer to the signature - LITTLE ENDIAN +* Output: uint8_t *p_result - Pointer to the result of verification check */ +sgx_status_t sgx_ecdsa_verify(const uint8_t *p_data, + uint32_t data_size, + const sgx_ec256_public_t *p_public, + sgx_ec256_signature_t *p_signature, + uint8_t *p_result, + sgx_ecc_state_handle_t ecc_handle) +{ + if ((ecc_handle == NULL) || (p_public == NULL) || (p_signature == NULL) || + (p_data == NULL) || (data_size < 1) || (p_result == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppStatus ipp_ret = ippStsNoErr; + IppsECCPState* p_ecc_state = (IppsECCPState*)ecc_handle; + IppECResult result = ippECInvalidSignature; + *p_result = SGX_EC_INVALID_SIGNATURE; + + IppsBigNumState* p_ecp_order = NULL; + IppsBigNumState* p_hash_bn = NULL; + IppsBigNumState* p_msg_bn = NULL; + IppsECCPPointState* p_reg_pub = NULL; + IppsBigNumState* p_reg_pubx_bn = NULL; + IppsBigNumState* p_reg_puby_bn = NULL; + IppsBigNumState* p_signx_bn = NULL; + IppsBigNumState* p_signy_bn = NULL; + const int order_size = sizeof(sgx_nistp256_r); + uint32_t hash[8] = { 0 }; + int ecp_size = 0; + + do + { + ipp_ret = sgx_ipp_newBN(sgx_nistp256_r, order_size, &p_ecp_order); + ERROR_BREAK(ipp_ret); + + // Prepare the message used to sign. + ipp_ret = ippsHashMessage(p_data, data_size, (Ipp8u*)hash, IPP_ALG_HASH_SHA256); + ERROR_BREAK(ipp_ret); + /* Byte swap in creation of Big Number from SHA256 hash output */ + ipp_ret = sgx_ipp_newBN(NULL, sizeof(hash), &p_hash_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsSetOctString_BN((Ipp8u*)hash, sizeof(hash), p_hash_bn); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(NULL, order_size, &p_msg_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsMod_BN(p_hash_bn, p_ecp_order, p_msg_bn); + ERROR_BREAK(ipp_ret); + + //Init eccp point + ipp_ret = ippsECCPPointGetSize(256, &ecp_size); + ERROR_BREAK(ipp_ret); + p_reg_pub = (IppsECCPPointState*)(malloc(ecp_size)); + if (!p_reg_pub) + { + ipp_ret = ippStsNoMemErr; + break; + } + ipp_ret = ippsECCPPointInit(256, p_reg_pub); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((const uint32_t *)p_public->gx, sizeof(p_public->gx), + &p_reg_pubx_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN((const uint32_t *)p_public->gy, sizeof(p_public->gy), + &p_reg_puby_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetPoint(p_reg_pubx_bn, p_reg_puby_bn, p_reg_pub, + p_ecc_state); + ERROR_BREAK(ipp_ret); + ipp_ret = ippsECCPSetKeyPair(NULL, p_reg_pub, ippTrue, p_ecc_state); + ERROR_BREAK(ipp_ret); + + ipp_ret = sgx_ipp_newBN(p_signature->x, order_size, &p_signx_bn); + ERROR_BREAK(ipp_ret); + ipp_ret = sgx_ipp_newBN(p_signature->y, order_size, &p_signy_bn); + ERROR_BREAK(ipp_ret); + + // Verify the message. + ipp_ret = ippsECCPVerifyDSA(p_msg_bn, p_signx_bn, p_signy_bn, &result, + p_ecc_state); + ERROR_BREAK(ipp_ret); + } while (0); + + // Clear buffer before free. + if (p_reg_pub) + memset_s(p_reg_pub, ecp_size, 0, ecp_size); + SAFE_FREE(p_reg_pub); + sgx_ipp_secure_free_BN(p_ecp_order, order_size); + sgx_ipp_secure_free_BN(p_hash_bn, sizeof(hash)); + sgx_ipp_secure_free_BN(p_msg_bn, order_size); + sgx_ipp_secure_free_BN(p_reg_pubx_bn, sizeof(p_public->gx)); + sgx_ipp_secure_free_BN(p_reg_puby_bn, sizeof(p_public->gy)); + sgx_ipp_secure_free_BN(p_signx_bn, order_size); + sgx_ipp_secure_free_BN(p_signy_bn, order_size); + + switch (result) { + case ippECValid: *p_result = SGX_EC_VALID; break; /* validation pass successfully */ + case ippECInvalidSignature: *p_result = SGX_EC_INVALID_SIGNATURE; break; /* invalid signature */ + default: *p_result = SGX_EC_INVALID_SIGNATURE; break; + } + + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNoMemErr: + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: + case ippStsOutOfRangeErr: + case ippStsSizeErr: + case ippStsBadArgErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} diff --git a/sdk/tlibcrypto/sgx_sha256.cpp b/sdk/tlibcrypto/sgx_sha256.cpp new file mode 100644 index 0000000000..8edc2ab1ea --- /dev/null +++ b/sdk/tlibcrypto/sgx_sha256.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tcrypto.h" +#include "ippcp.h" +#include "stdlib.h" + +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} +#endif + + +/* Allocates and initializes sha256 state +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h +* Output: sgx_sha_state_handle_t *p_sha_handle - Pointer to the handle of the SHA256 state */ +sgx_status_t sgx_sha256_init(sgx_sha_state_handle_t* p_sha_handle) +{ + IppStatus ipp_ret = ippStsNoErr; + IppsHashState* p_temp_state = NULL; + + if (p_sha_handle == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + int ctx_size = 0; + ipp_ret = ippsHashGetSize(&ctx_size); + if (ipp_ret != ippStsNoErr) + return SGX_ERROR_UNEXPECTED; + p_temp_state = (IppsHashState*)(malloc(ctx_size)); + if (p_temp_state == NULL) + return SGX_ERROR_OUT_OF_MEMORY; + ipp_ret = ippsHashInit(p_temp_state, IPP_ALG_HASH_SHA256); + if (ipp_ret != ippStsNoErr) + { + SAFE_FREE(p_temp_state); + *p_sha_handle = NULL; + switch (ipp_ret) + { + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } + } + + *p_sha_handle = p_temp_state; + return SGX_SUCCESS; +} + +/* Updates sha256 has calculation based on the input message +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error. +* Input: sgx_sha_state_handle_t sha_handle - Handle to the SHA256 state +* uint8_t *p_src - Pointer to the input stream to be hashed +* uint32_t src_len - Length of the input stream to be hashed */ +sgx_status_t sgx_sha256_update(const uint8_t *p_src, uint32_t src_len, sgx_sha_state_handle_t sha_handle) +{ + if ((p_src == NULL) || (sha_handle == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + IppStatus ipp_ret = ippStsNoErr; + ipp_ret = ippsHashUpdate(p_src, src_len, (IppsHashState*)sha_handle); + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Returns Hash calculation +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h +* Input: sgx_sha_state_handle_t sha_handle - Handle to the SHA256 state +* Output: sgx_sha256_hash_t *p_hash - Resultant hash from operation */ +sgx_status_t sgx_sha256_get_hash(sgx_sha_state_handle_t sha_handle, sgx_sha256_hash_t *p_hash) +{ + if ((sha_handle == NULL) || (p_hash == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + IppStatus ipp_ret = ippStsNoErr; + ipp_ret = ippsHashGetTag((Ipp8u*)p_hash, SGX_SHA256_HASH_SIZE, (IppsHashState*)sha_handle); + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} + +/* Cleans up sha state +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined in sgx_error.h +* Input: sgx_sha_state_handle_t sha_handle - Handle to the SHA256 state */ +sgx_status_t sgx_sha256_close(sgx_sha_state_handle_t sha_handle) +{ + if (sha_handle == NULL) + { + return SGX_ERROR_INVALID_PARAMETER; + } + SAFE_FREE(sha_handle); + return SGX_SUCCESS; +} diff --git a/sdk/tlibcrypto/sgx_sha256_msg.cpp b/sdk/tlibcrypto/sgx_sha256_msg.cpp new file mode 100644 index 0000000000..a8d9a04d9e --- /dev/null +++ b/sdk/tlibcrypto/sgx_sha256_msg.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tcrypto.h" +#include "ippcp.h" +#include "stdlib.h" + +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} +#endif + + +/* SHA Hashing functions +* Parameters: +* Return: sgx_status_t - SGX_SUCCESS or failure as defined sgx_error.h +* Inputs: uint8_t *p_src - Pointer to input stream to be hashed +* uint32_t src_len - Length of input stream to be hashed +* Output: sgx_sha256_hash_t *p_hash - Resultant hash from operation */ +sgx_status_t sgx_sha256_msg(const uint8_t *p_src, uint32_t src_len, sgx_sha256_hash_t *p_hash) +{ + if ((p_src == NULL) || (p_hash == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + IppStatus ipp_ret = ippStsNoErr; + ipp_ret = ippsHashMessage((const Ipp8u *) p_src, src_len, (Ipp8u *)p_hash, IPP_ALG_HASH_SHA256); + switch (ipp_ret) + { + case ippStsNoErr: return SGX_SUCCESS; + case ippStsMemAllocErr: return SGX_ERROR_OUT_OF_MEMORY; + case ippStsNullPtrErr: + case ippStsLengthErr: return SGX_ERROR_INVALID_PARAMETER; + default: return SGX_ERROR_UNEXPECTED; + } +} diff --git a/sdk/tlibcrypto/tcrypto_version.cpp b/sdk/tlibcrypto/tcrypto_version.cpp new file mode 100644 index 0000000000..609f08b610 --- /dev/null +++ b/sdk/tlibcrypto/tcrypto_version.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_TCRYPTO_VERSION_STR __CONCAT("SGX_TCRYPTO_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_tcrypto_version = SGX_TCRYPTO_VERSION_STR; + +#ifdef __cplusplus +} +#endif diff --git a/sdk/tlibstdcxx/Makefile b/sdk/tlibstdcxx/Makefile new file mode 100644 index 0000000000..e35a394d08 --- /dev/null +++ b/sdk/tlibstdcxx/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + + +include ../../buildenv.mk + +CPPFLAGS += -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc \ + -I./stlport + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) + +SRCS := src/string.cpp \ + src/complex.cpp \ + src/complex_trig.cpp + +OBJS := $(SRCS:.cpp=.o) + +LIBNAME_AR = libtlibstdcxx.a + +.PHONY:all +all: $(LIBNAME_AR) + +$(LIBNAME_AR): $(OBJS) + $(AR) rcs $(LIBNAME_AR) $^ + +$(OBJS): %.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(LIBNAME_AR) $(OBJS) diff --git a/sdk/tlibstdcxx/README.sgx b/sdk/tlibstdcxx/README.sgx new file mode 100644 index 0000000000..a74551a45c --- /dev/null +++ b/sdk/tlibstdcxx/README.sgx @@ -0,0 +1,22 @@ +Version: 5.2.1 + +Changes: + + * Move unsupported STL headers to stlport/deprecated folder + * Do not include ctime in stlport_prefix.h + * Inlude __Named_exception imple. in stlport static library + * Fix warnings under MSVC and GCC, and most of them are issues of unused parameters + * Use sgx_read_rand for generating rand numbers + * Replace unique(...) in _algo.h with LLVM imple. + * Add no storage (zero-length) bitset in _bitset.h + * Disable features rely on I/O operations + * Disable wchar support + * Define _NOTHREADS, _STLP_NO_THREADS, _STLP_USE_NEWALLOC, _STLP_NO_EXTENSIONS by default + * Use SGX C++ runtime library instead + * Disable unsupported data types and interfaces in _cstdio.h, _cstdlib.h, _ctime.h, _cwchar.h, etc. + * Add using _STLP_VENDOR_EXCEPT_STD::bad_alloc + * Let _STLP_THROW_BAD_ALLOC call _STLP_ABORT() directly, do not use puts() and exit(1) + * Do not use puts() in _STLP_THROW_MSG() + * Use SGX spinlock instead + * Add _sgx.h for SGX configurations + * Do not include Windows/Linux system headers directly diff --git a/sdk/tlibstdcxx/etc/stlport.natvis b/sdk/tlibstdcxx/etc/stlport.natvis new file mode 100755 index 0000000000..57d1a44b21 --- /dev/null +++ b/sdk/tlibstdcxx/etc/stlport.natvis @@ -0,0 +1,524 @@ + + + + + + + + + + + + + + {_M_start_of_storage._M_data, s} + _M_start_of_storage._M_data, s + + _M_start_of_storage._M_data, s + _M_finish - _M_start_of_storage._M_data + _DEFAULT_SIZE + _M_buffers._M_end_of_storage - _M_start_of_storage._M_data + + _M_finish - _M_start_of_storage._M_data + _M_start_of_storage._M_data + + + + + + + + + + + + + + + + + + + + + {_M_start_of_storage._M_data, su} + _M_start_of_storage._M_data, su + + _M_start_of_storage._M_data, su + _M_finish - _M_start_of_storage._M_data + _DEFAULT_SIZE + _M_buffers._M_end_of_storage - _M_start_of_storage._M_data + + _M_finish - _M_start_of_storage._M_data + _M_start_of_storage._M_data + + + + + + + + + {_M_non_dbg_impl} + _M_non_dbg_impl + + _M_non_dbg_impl + + + + + + + + + + + + + {{ size = {(_M_finish._M_p - _M_start._M_p) * sizeof(unsigned int) * 8 + _M_finish._M_offset} }} + + _M_start._M_p, x + (_M_finish._M_p - _M_start._M_p) * sizeof(unsigned int) * 8 + _M_finish._M_offset + + + (_M_finish._M_p - _M_start._M_p) * sizeof(unsigned int) * 8 + _M_finish._M_offset + (bool)((_M_start._M_p[$i / (sizeof(unsigned int) * 8)] >> ($i % (sizeof(unsigned int) * 8))) & 1) + + + + + + + + + + + + + {(bool)(((*_M_p) >> _M_offset) & 1)} + + (bool)(((*_M_p) >> _M_offset) & 1) + + + + + + + + + + + + {{ size = {_M_finish - _M_start} }} + + _M_finish - _M_start + _M_end_of_storage._M_data - _M_start + + _M_finish - _M_start + _M_start + + + + + + + + + {_M_non_dbg_impl} + + _M_non_dbg_impl + + + + + + + + + + + + + + {{ size = {((_M_finish._M_node - _M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - (_M_start._M_cur - _M_start._M_first) - (_M_finish._M_last - _M_finish._M_cur)} }} + {{ size = {_M_finish._M_node - _M_start._M_node} }} + + ((_M_finish._M_node - _M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - (_M_start._M_cur - _M_start._M_first) - (_M_finish._M_last - _M_finish._M_cur) + _M_finish._M_node - _M_start._M_node + (_M_finish._M_node - _M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1)) - 1 + _M_finish._M_node - _M_start._M_node + + ((_M_finish._M_node - _M_start._M_node + 1) * (_MAX_BYTES / sizeof($T1))) - (_M_start._M_cur - _M_start._M_first) - (_M_finish._M_last - _M_finish._M_cur) + _M_finish._M_node - _M_start._M_node + *(*(_M_start._M_node + (($i + (_M_start._M_cur - _M_start._M_first)) / (_MAX_BYTES / sizeof($T1)))) + (($i + (_M_start._M_cur - _M_start._M_first)) % (_MAX_BYTES / sizeof($T1)))) + **(_M_start._M_node + $i) + + + + + + + + + + + + + {*_M_cur} + + _M_cur, x + *(_M_cur) + + + + + + + + {_M_non_dbg_impl} + + _M_non_dbg_impl + + + + + + + + + + + + + {{ size= ':(' }} + + + + _M_node._M_data._M_next + _M_next + *($T1 *)(this + 1) + + + + + + + + + + + + + {*($T1 *)(_M_node + 1)} + + ($T1 *)(_M_node + 1), x + *($T1 *)(_M_node + 1) + + + + + + + + {_M_non_dbg_impl} + + _M_non_dbg_impl + + + + + + + + + + + + + + + ({first}, {second}) + + first + second + + + + + + + + + + + + + + + + + + + + + {{ size = {_M_t._M_node_count} }} + + _M_t._M_node_count + _M_t + + + + + + + + + + + + + + + + + + + + {{ size = {_M_t._M_non_dbg_impl._M_node_count} }} + + _M_t._M_non_dbg_impl._M_node_count + _M_t._M_non_dbg_impl + + + + + + + + + + + + + + {*($T3 *)(&(_M_header._M_data) + 1)} + + + _M_node_count + _M_header._M_data._M_parent + _M_left + _M_right + *($T3 *)(this + 1) + + + + + + + + + + + + + {*($T1 *)(_M_node + 1)} + + ($T1 *)(_M_node + 1), x + *($T1 *)(_M_node + 1) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {c} + + c + + + + + + + + + + + + + {_M_iterator} + {"undefined"} + + _M_iterator + true + false + + + + + + + + + + + + + {{ size = {$T1} }} + + + $T1 + (((_WordT)_M_w) >> ($i % (sizeof(_WordT) * 8))) & 1, d + + + $T1 + (((_WordT *)_M_w)[$i / (sizeof(_WordT) * 8)] >> ($i % (sizeof(_WordT) * 8))) & 1, d + + + + + + + + + + + + + {{ size = 0 }} + + + + + + + + + + + + + + {(*(_M_wp) >> _M_bpos) & 1, d} + + _M_wp + _M_bpos + + + + + + + + + + + + + + {*($T1 *)_M_p} + {"null"} + + ($T1 *)_M_p, x + *($T1 *)_M_p + + + + + + + + + + + + + {_M_re} + {_M_re}+i*{_M_im} + {_M_re}-i*{-_M_im} + i*{_M_im} + -i*{-_M_im} + + _M_re + _M_im + + + + + + + + + + + + + {{ size = {_M_size} }} + + + _M_size + _M_first + + + + + + + + + + + + + {{ start = {_M_start}, size = {_M_length}, stride = {_M_stride} }} + + _M_start + _M_length + _M_stride + + + + + + + + + + + + {{ start = {_M_start}, sizes = {_M_lengths}, strides = {_M_strides} }} + + _M_start + _M_lengths + _M_strides + + + + diff --git a/sdk/tlibstdcxx/src/_stdio_file.h b/sdk/tlibstdcxx/src/_stdio_file.h new file mode 100644 index 0000000000..d913fc4484 --- /dev/null +++ b/sdk/tlibstdcxx/src/_stdio_file.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STDIO_FILE_H +#define _STLP_STDIO_FILE_H + +/* This file provides a low-level interface between the internal + * representation of struct FILE, from the C stdio library, and + * the C++ I/O library. */ + +#ifndef _STLP_CSTDIO +# include +#endif +#ifndef _STLP_CSTDDEF +# include +#endif + +#if defined (__MSL__) +# include /* get the definition of fileno */ +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_WCE) + +inline int _FILE_fd(const FILE *__f) { + /* Check if FILE is one of the three standard streams + We do this check first, because invoking _fileno() on one of them + causes a terminal window to be created. This also happens if you do + any IO on them, but merely retrieving the filedescriptor shouldn't + already do that. + + Obviously this is pretty implementation-specific because it requires + that indeed the first three FDs are always the same, but that is not + only common but almost guaranteed. */ + for (int __fd = 0; __fd != 3; ++__fd) { + if (__f == _getstdfilex(__fd)) + return __fd; + } + + /* Normal files. */ + return (int)::_fileno((FILE*)__f); +} + +# elif defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) + +inline int _FILE_fd(const FILE *__f) { return __f->__file; } + +# elif defined (__sun) && defined (_LP64) + +inline int _FILE_fd(const FILE *__f) { return (int) __f->__pad[2]; } + +#elif defined (__hpux) /* && defined(__hppa) && defined(__HP_aCC)) */ || \ + defined (__MVS__) || \ + defined (_STLP_USE_UCLIBC) /* should be before _STLP_USE_GLIBC */ + +inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE*, __f)); } + +#elif defined (_STLP_USE_GLIBC) + +inline int _FILE_fd(const FILE *__f) { return __f->_fileno; } + +#elif defined (__BORLANDC__) + +inline int _FILE_fd(const FILE *__f) { return __f->fd; } + +#elif defined (__MWERKS__) + +/* using MWERKS-specific defines here to detect other OS targets + * dwa: I'm not sure they provide fileno for all OS's, but this should + * work for Win32 and WinCE + + * Hmm, at least for Novell NetWare __dest_os == __mac_os true too.. + * May be both __dest_os and __mac_os defined and empty? - ptr */ +# if __dest_os == __mac_os +inline int _FILE_fd(const FILE *__f) { return ::fileno(__CONST_CAST(FILE*, __f)); } +# else +inline int _FILE_fd(const FILE *__f) { return ::_fileno(__CONST_CAST(FILE*, __f)); } +# endif + +#elif defined (__QNXNTO__) || defined (__WATCOMC__) || defined (__EMX__) + +inline int _FILE_fd(const FILE *__f) { return __f->_handle; } + +#elif defined (__Lynx__) + +/* the prototypes are taken from LynxOS patch for STLport 4.0 */ +inline int _FILE_fd(const FILE *__f) { return __f->_fd; } + +#else /* The most common access to file descriptor. */ + +inline int _FILE_fd(const FILE *__f) { return __f->_file; } + +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_STDIO_FILE_H */ + +/* Local Variables: + * mode:C++ + * End: */ diff --git a/sdk/tlibstdcxx/src/acquire_release.h b/sdk/tlibstdcxx/src/acquire_release.h new file mode 100644 index 0000000000..5ea73da1a1 --- /dev/null +++ b/sdk/tlibstdcxx/src/acquire_release.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef ACQUIRE_RELEASE_H +#define ACQUIRE_RELEASE_H + +#include "c_locale.h" + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +_Locale_ctype* _STLP_CALL __acquire_ctype(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code); +_Locale_codecvt* _STLP_CALL __acquire_codecvt(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code); +_Locale_numeric* _STLP_CALL __acquire_numeric(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code); +_Locale_collate* _STLP_CALL __acquire_collate(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code); +_Locale_monetary* _STLP_CALL __acquire_monetary(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code); +_Locale_time* _STLP_CALL __acquire_time(const char* &name, char *buf, _Locale_name_hint*, int *__err_code); +_Locale_messages* _STLP_CALL __acquire_messages(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code); + +void _STLP_CALL __release_ctype(_Locale_ctype* cat); +void _STLP_CALL __release_codecvt(_Locale_codecvt* cat); +void _STLP_CALL __release_numeric(_Locale_numeric* cat); +void _STLP_CALL __release_collate(_Locale_collate* cat); +void _STLP_CALL __release_monetary(_Locale_monetary* cat); +void _STLP_CALL __release_time(_Locale_time* __time); +void _STLP_CALL __release_messages(_Locale_messages* cat); + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +#endif /* ACQUIRE_RELEASE_H */ diff --git a/sdk/tlibstdcxx/src/aligned_buffer.h b/sdk/tlibstdcxx/src/aligned_buffer.h new file mode 100644 index 0000000000..6ff6ca6b90 --- /dev/null +++ b/sdk/tlibstdcxx/src/aligned_buffer.h @@ -0,0 +1,21 @@ +#ifndef ALIGNED_BUFFER_H +#define ALIGNED_BUFFER_H + +_STLP_BEGIN_NAMESPACE +// this is for fake initialization +template +union _Stl_aligned_buffer { + char buf[sizeof(T)]; + struct { double a; double b; } padding; + + T* operator&() { + return __REINTERPRET_CAST(T*, this); + } + + T const* operator&() const { + return __REINTERPRET_CAST(T const*, this); + } +}; +_STLP_END_NAMESPACE + +#endif diff --git a/sdk/tlibstdcxx/src/allocators.cpp b/sdk/tlibstdcxx/src/allocators.cpp new file mode 100644 index 0000000000..8bbcca86ba --- /dev/null +++ b/sdk/tlibstdcxx/src/allocators.cpp @@ -0,0 +1,1121 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include + +#if defined (__GNUC__) && (defined (__CYGWIN__) || defined (__MINGW32__)) +# include +#endif + +#if defined (_STLP_PTHREADS) && !defined (_STLP_NO_THREADS) +# include +# include +#endif + +#include + +#include "lock_free_slist.h" + +#if defined (__WATCOMC__) +# pragma warning 13 9 +# pragma warning 367 9 +# pragma warning 368 9 +#endif + +#if defined (_STLP_SGI_THREADS) + // We test whether threads are in use before locking. + // Perhaps this should be moved into stl_threads.h, but that + // probably makes it harder to avoid the procedure call when + // it isn't needed. +extern "C" { + extern int __us_rsthread_malloc; +} +#endif + +// Specialised debug form of new operator which does not provide "false" +// memory leaks when run with debug CRT libraries. +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1020 && defined (_STLP_DEBUG_ALLOC)) && !defined (_STLP_WCE) +# include +inline char* __stlp_new_chunk(size_t __bytes) { + void *__chunk = _STLP_CHECK_NULL_ALLOC(::operator new(__bytes, __FILE__, __LINE__)); + return __STATIC_CAST(char*, __chunk); +} +inline void __stlp_delete_chunck(void* __p) { ::operator delete(__p, __FILE__, __LINE__); } +#else +# ifdef _STLP_NODE_ALLOC_USE_MALLOC +# include +inline char* __stlp_new_chunk(size_t __bytes) { + // do not use _STLP_CHECK_NULL_ALLOC, this macro is dedicated to new operator. + void *__chunk = _STLP_VENDOR_CSTD::malloc(__bytes); + if (__chunk == 0) { + _STLP_THROW_BAD_ALLOC; + } + return __STATIC_CAST(char*, __chunk); +} +inline void __stlp_delete_chunck(void* __p) { _STLP_VENDOR_CSTD::free(__p); } +# else +inline char* __stlp_new_chunk(size_t __bytes) +{ return __STATIC_CAST(char*, _STLP_STD::__stl_new(__bytes)); } +inline void __stlp_delete_chunck(void* __p) { _STLP_STD::__stl_delete(__p); } +# endif +#endif + +/* This is an additional atomic operations to the ones already defined in + * stl/_threads.h, platform should try to support it to improve performance. + * __add_atomic_t _STLP_ATOMIC_ADD(volatile __add_atomic_t* __target, __add_atomic_t __val) : + * does *__target = *__target + __val and returns the old *__target value */ +typedef long __add_atomic_t; +typedef unsigned long __uadd_atomic_t; + +#if defined (__GNUC__) && defined (__i386__) +inline long _STLP_atomic_add_gcc_x86(long volatile* p, long addend) { + long result; + __asm__ __volatile__ + ("lock; xaddl %1, %0;" + :"=m" (*p), "=r" (result) + :"m" (*p), "1" (addend) + :"cc"); + return result + addend; +} +# define _STLP_ATOMIC_ADD(__dst, __val) _STLP_atomic_add_gcc_x86(__dst, __val) +#elif defined (_STLP_WIN32THREADS) +// The Win32 API function InterlockedExchangeAdd is not available on Windows 95. +# if !defined (_STLP_WIN95_LIKE) +# if defined (_STLP_NEW_PLATFORM_SDK) +# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__dst, __val) +# else +# define _STLP_ATOMIC_ADD(__dst, __val) InterlockedExchangeAdd(__CONST_CAST(__add_atomic_t*, __dst), __val) +# endif +# endif +#endif + +#if defined (__OS400__) +// dums 02/05/2007: is it really necessary ? +enum { _ALIGN = 16, _ALIGN_SHIFT = 4 }; +#else +enum { _ALIGN = 2 * sizeof(void*), _ALIGN_SHIFT = 2 + sizeof(void*) / 4 }; +#endif + +#define _S_FREELIST_INDEX(__bytes) ((__bytes - size_t(1)) >> (int)_ALIGN_SHIFT) + +_STLP_BEGIN_NAMESPACE + +// malloc_alloc out-of-memory handling +static __oom_handler_type __oom_handler = __STATIC_CAST(__oom_handler_type, 0); + +#ifdef _STLP_THREADS +_STLP_mutex __oom_handler_lock; +#endif + +void* _STLP_CALL __malloc_alloc::allocate(size_t __n) +{ + void *__result = malloc(__n); + if ( 0 == __result ) { + __oom_handler_type __my_malloc_handler; + + for (;;) { + { +#ifdef _STLP_THREADS + _STLP_auto_lock _l( __oom_handler_lock ); +#endif + __my_malloc_handler = __oom_handler; + } + if ( 0 == __my_malloc_handler) { + _STLP_THROW_BAD_ALLOC; + } + (*__my_malloc_handler)(); + __result = malloc(__n); + if ( __result ) + return __result; + } + } + return __result; +} + +__oom_handler_type _STLP_CALL __malloc_alloc::set_malloc_handler(__oom_handler_type __f) +{ +#ifdef _STLP_THREADS + _STLP_auto_lock _l( __oom_handler_lock ); +#endif + __oom_handler_type __old = __oom_handler; + __oom_handler = __f; + return __old; +} + +// ******************************************************* +// Default node allocator. +// With a reasonable compiler, this should be roughly as fast as the +// original STL class-specific allocators, but with less fragmentation. +// +// Important implementation properties: +// 1. If the client request an object of size > _MAX_BYTES, the resulting +// object will be obtained directly from malloc. +// 2. In all other cases, we allocate an object of size exactly +// _S_round_up(requested_size). Thus the client has enough size +// information that we can return the object to the proper free list +// without permanently losing part of the object. +// + +#define _STLP_NFREELISTS 16 + +#if defined (_STLP_LEAKS_PEDANTIC) && defined (_STLP_USE_DYNAMIC_LIB) +/* + * We can only do cleanup of the node allocator memory pool if we are + * sure that the STLport library is used as a shared one as it guaranties + * the unicity of the node allocator instance. Without that guaranty node + * allocator instances might exchange memory blocks making the implementation + * of a cleaning process much more complicated. + */ +# define _STLP_DO_CLEAN_NODE_ALLOC +#endif + +/* When STLport is used without multi threaded safety we use the node allocator + * implementation with locks as locks becomes no-op. The lock free implementation + * always use system specific atomic operations which are slower than 'normal' + * ones. + */ +#if defined (_STLP_THREADS) && \ + defined (_STLP_HAS_ATOMIC_FREELIST) && defined (_STLP_ATOMIC_ADD) +/* + * We have an implementation of the atomic freelist (_STLP_atomic_freelist) + * for this architecture and compiler. That means we can use the non-blocking + * implementation of the node-allocation engine.*/ +# define _STLP_USE_LOCK_FREE_IMPLEMENTATION +#endif + +#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +# if defined (_STLP_THREADS) + +class _Node_Alloc_Lock { + static _STLP_STATIC_MUTEX& _S_Mutex() { + static _STLP_STATIC_MUTEX mutex _STLP_MUTEX_INITIALIZER; + return mutex; + } +public: + _Node_Alloc_Lock() { +# if defined (_STLP_SGI_THREADS) + if (__us_rsthread_malloc) +# endif + _S_Mutex()._M_acquire_lock(); + } + + ~_Node_Alloc_Lock() { +# if defined (_STLP_SGI_THREADS) + if (__us_rsthread_malloc) +# endif + _S_Mutex()._M_release_lock(); + } +}; + +# else + +class _Node_Alloc_Lock { +public: + _Node_Alloc_Lock() { } + ~_Node_Alloc_Lock() { } +}; + +# endif + +struct _Node_alloc_obj { + _Node_alloc_obj * _M_next; +}; +#endif + +class __node_alloc_impl { + static inline size_t _STLP_CALL _S_round_up(size_t __bytes) + { return (((__bytes) + (size_t)_ALIGN-1) & ~((size_t)_ALIGN - 1)); } + +#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) + typedef _STLP_atomic_freelist::item _Obj; + typedef _STLP_atomic_freelist _Freelist; + typedef _STLP_atomic_freelist _ChunkList; + + // Header of blocks of memory that have been allocated as part of + // a larger chunk but have not yet been chopped up into nodes. + struct _FreeBlockHeader : public _STLP_atomic_freelist::item { + char* _M_end; // pointer to end of free memory + }; +#else + typedef _Node_alloc_obj _Obj; + typedef _Obj* _STLP_VOLATILE _Freelist; + typedef _Obj* _ChunkList; +#endif + +private: + // Returns an object of size __n, and optionally adds to size __n free list. + static _Obj* _S_refill(size_t __n); + // Allocates a chunk for nobjs of size __p_size. nobjs may be reduced + // if it is inconvenient to allocate the requested number. + static char* _S_chunk_alloc(size_t __p_size, int& __nobjs); + // Chunk allocation state. + static _Freelist _S_free_list[_STLP_NFREELISTS]; + // Amount of total allocated memory +#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) + static _STLP_VOLATILE __add_atomic_t _S_heap_size; +#else + static size_t _S_heap_size; +#endif + +#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) + // List of blocks of free memory + static _STLP_atomic_freelist _S_free_mem_blocks; +#else + // Start of the current free memory buffer + static char* _S_start_free; + // End of the current free memory buffer + static char* _S_end_free; +#endif + +#if defined (_STLP_DO_CLEAN_NODE_ALLOC) +public: + // Methods to report alloc/dealloc calls to the counter system. +# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) + typedef _STLP_VOLATILE __stl_atomic_t _AllocCounter; +# else + typedef __stl_atomic_t _AllocCounter; +# endif + static _AllocCounter& _STLP_CALL _S_alloc_counter(); + static void _S_alloc_call(); + static void _S_dealloc_call(); + +private: + // Free all the allocated chuncks of memory + static void _S_chunk_dealloc(); + // Beginning of the linked list of allocated chunks of memory + static _ChunkList _S_chunks; +#endif /* _STLP_DO_CLEAN_NODE_ALLOC */ + +public: + /* __n must be > 0 */ + static void* _M_allocate(size_t& __n); + /* __p may not be 0 */ + static void _M_deallocate(void *__p, size_t __n); +}; + +#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +void* __node_alloc_impl::_M_allocate(size_t& __n) { + __n = _S_round_up(__n); + _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); + _Obj *__r; + + // Acquire the lock here with a constructor call. + // This ensures that it is released in exit or during stack + // unwinding. + _Node_Alloc_Lock __lock_instance; + + if ( (__r = *__my_free_list) != 0 ) { + *__my_free_list = __r->_M_next; + } else { + __r = _S_refill(__n); + } +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + _S_alloc_call(); +# endif + // lock is released here + return __r; +} + +void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) { + _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); + _Obj * __pobj = __STATIC_CAST(_Obj*, __p); + + // acquire lock + _Node_Alloc_Lock __lock_instance; + __pobj->_M_next = *__my_free_list; + *__my_free_list = __pobj; + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + _S_dealloc_call(); +# endif + // lock is released here +} + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) +# define _STLP_OFFSET sizeof(_Obj) +# else +# define _STLP_OFFSET 0 +# endif + +/* We allocate memory in large chunks in order to avoid fragmenting */ +/* the malloc heap too much. */ +/* We assume that size is properly aligned. */ +/* We hold the allocation lock. */ +char* __node_alloc_impl::_S_chunk_alloc(size_t _p_size, int& __nobjs) { + char* __result; + size_t __total_bytes = _p_size * __nobjs; + size_t __bytes_left = _S_end_free - _S_start_free; + + if (__bytes_left > 0) { + if (__bytes_left >= __total_bytes) { + __result = _S_start_free; + _S_start_free += __total_bytes; + return __result; + } + + if (__bytes_left >= _p_size) { + __nobjs = (int)(__bytes_left / _p_size); + __total_bytes = _p_size * __nobjs; + __result = _S_start_free; + _S_start_free += __total_bytes; + return __result; + } + + // Try to make use of the left-over piece. + _Obj* _STLP_VOLATILE* __my_free_list = _S_free_list + _S_FREELIST_INDEX(__bytes_left); + __REINTERPRET_CAST(_Obj*, _S_start_free)->_M_next = *__my_free_list; + *__my_free_list = __REINTERPRET_CAST(_Obj*, _S_start_free); + _S_start_free = _S_end_free = 0; + } + + size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size) + _STLP_OFFSET; + + _STLP_TRY { + _S_start_free = __stlp_new_chunk(__bytes_to_get); + } +#if defined (_STLP_USE_EXCEPTIONS) + catch (const _STLP_STD::bad_alloc&) { + _Obj* _STLP_VOLATILE* __my_free_list; + _Obj* __p; + // Try to do with what we have. That can't hurt. + // We do not try smaller requests, since that tends + // to result in disaster on multi-process machines. + for (size_t __i = _p_size; __i <= (size_t)_MAX_BYTES; __i += (size_t)_ALIGN) { + __my_free_list = _S_free_list + _S_FREELIST_INDEX(__i); + __p = *__my_free_list; + if (0 != __p) { + *__my_free_list = __p -> _M_next; + _S_start_free = __REINTERPRET_CAST(char*, __p); + _S_end_free = _S_start_free + __i; + return _S_chunk_alloc(_p_size, __nobjs); + // Any leftover piece will eventually make it to the + // right free list. + } + } + __bytes_to_get = __total_bytes + _STLP_OFFSET; + _S_start_free = __stlp_new_chunk(__bytes_to_get); + } +#endif + + _S_heap_size += __bytes_to_get >> 4; +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + __REINTERPRET_CAST(_Obj*, _S_start_free)->_M_next = _S_chunks; + _S_chunks = __REINTERPRET_CAST(_Obj*, _S_start_free); +# endif + _S_end_free = _S_start_free + __bytes_to_get; + _S_start_free += _STLP_OFFSET; + return _S_chunk_alloc(_p_size, __nobjs); +} + +/* Returns an object of size __n, and optionally adds to size __n free list.*/ +/* We assume that __n is properly aligned. */ +/* We hold the allocation lock. */ +_Node_alloc_obj* __node_alloc_impl::_S_refill(size_t __n) { + int __nobjs = 20; + char* __chunk = _S_chunk_alloc(__n, __nobjs); + + if (1 == __nobjs) return __REINTERPRET_CAST(_Obj*, __chunk); + + _Obj* _STLP_VOLATILE* __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); + _Obj* __result; + _Obj* __current_obj; + _Obj* __next_obj; + + /* Build free list in chunk */ + __result = __REINTERPRET_CAST(_Obj*, __chunk); + *__my_free_list = __next_obj = __REINTERPRET_CAST(_Obj*, __chunk + __n); + for (--__nobjs; --__nobjs; ) { + __current_obj = __next_obj; + __next_obj = __REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __next_obj) + __n); + __current_obj->_M_next = __next_obj; + } + __next_obj->_M_next = 0; + return __result; +} + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) +void __node_alloc_impl::_S_alloc_call() +{ ++_S_alloc_counter(); } + +void __node_alloc_impl::_S_dealloc_call() { + __stl_atomic_t &counter = _S_alloc_counter(); + if (--counter == 0) + { _S_chunk_dealloc(); } +} + +/* We deallocate all the memory chunks */ +void __node_alloc_impl::_S_chunk_dealloc() { + _Obj *__pcur = _S_chunks, *__pnext; + while (__pcur != 0) { + __pnext = __pcur->_M_next; + __stlp_delete_chunck(__pcur); + __pcur = __pnext; + } + _S_chunks = 0; + _S_start_free = _S_end_free = 0; + _S_heap_size = 0; + memset(__REINTERPRET_CAST(char*, __CONST_CAST(_Obj**, &_S_free_list[0])), 0, _STLP_NFREELISTS * sizeof(_Obj*)); +} +# endif + +#else + +void* __node_alloc_impl::_M_allocate(size_t& __n) { + __n = _S_round_up(__n); + _Obj* __r = _S_free_list[_S_FREELIST_INDEX(__n)].pop(); + if (__r == 0) + { __r = _S_refill(__n); } + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + _S_alloc_call(); +# endif + return __r; +} + +void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) { + _S_free_list[_S_FREELIST_INDEX(__n)].push(__STATIC_CAST(_Obj*, __p)); + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + _S_dealloc_call(); +# endif +} + +/* Returns an object of size __n, and optionally adds additional ones to */ +/* freelist of objects of size __n. */ +/* We assume that __n is properly aligned. */ +__node_alloc_impl::_Obj* __node_alloc_impl::_S_refill(size_t __n) { + int __nobjs = 20; + char* __chunk = _S_chunk_alloc(__n, __nobjs); + + if (__nobjs <= 1) + return __REINTERPRET_CAST(_Obj*, __chunk); + + // Push all new nodes (minus first one) onto freelist + _Obj* __result = __REINTERPRET_CAST(_Obj*, __chunk); + _Obj* __cur_item = __result; + _Freelist* __my_freelist = _S_free_list + _S_FREELIST_INDEX(__n); + for (--__nobjs; __nobjs != 0; --__nobjs) { + __cur_item = __REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __cur_item) + __n); + __my_freelist->push(__cur_item); + } + return __result; +} + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) +# define _STLP_OFFSET _ALIGN +# else +# define _STLP_OFFSET 0 +# endif + +/* We allocate memory in large chunks in order to avoid fragmenting */ +/* the malloc heap too much. */ +/* We assume that size is properly aligned. */ +char* __node_alloc_impl::_S_chunk_alloc(size_t _p_size, int& __nobjs) { +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + //We are going to add a small memory block to keep all the allocated blocks + //address, we need to do so respecting the memory alignment. The following + //static assert checks that the reserved block is big enough to store a pointer. + _STLP_STATIC_ASSERT(sizeof(_Obj) <= _ALIGN) +# endif + char* __result = 0; + __add_atomic_t __total_bytes = __STATIC_CAST(__add_atomic_t, _p_size) * __nobjs; + + _FreeBlockHeader* __block = __STATIC_CAST(_FreeBlockHeader*, _S_free_mem_blocks.pop()); + if (__block != 0) { + // We checked a block out and can now mess with it with impugnity. + // We'll put the remainder back into the list if we're done with it below. + char* __buf_start = __REINTERPRET_CAST(char*, __block); + __add_atomic_t __bytes_left = __block->_M_end - __buf_start; + + if ((__bytes_left < __total_bytes) && (__bytes_left >= __STATIC_CAST(__add_atomic_t, _p_size))) { + // There's enough left for at least one object, but not as much as we wanted + __result = __buf_start; + __nobjs = (int)(__bytes_left/_p_size); + __total_bytes = __STATIC_CAST(__add_atomic_t, _p_size) * __nobjs; + __bytes_left -= __total_bytes; + __buf_start += __total_bytes; + } + else if (__bytes_left >= __total_bytes) { + // The block has enough left to satisfy all that was asked for + __result = __buf_start; + __bytes_left -= __total_bytes; + __buf_start += __total_bytes; + } + + if (__bytes_left != 0) { + // There is still some memory left over in block after we satisfied our request. + if ((__result != 0) && (__bytes_left >= (__add_atomic_t)sizeof(_FreeBlockHeader))) { + // We were able to allocate at least one object and there is still enough + // left to put remainder back into list. + _FreeBlockHeader* __newblock = __REINTERPRET_CAST(_FreeBlockHeader*, __buf_start); + __newblock->_M_end = __block->_M_end; + _S_free_mem_blocks.push(__newblock); + } + else { + // We were not able to allocate enough for at least one object. + // Shove into freelist of nearest (rounded-down!) size. + size_t __rounded_down = _S_round_up(__bytes_left + 1) - (size_t)_ALIGN; + if (__rounded_down > 0) + _S_free_list[_S_FREELIST_INDEX(__rounded_down)].push((_Obj*)__buf_start); + } + } + if (__result != 0) + return __result; + } + + // We couldn't satisfy it from the list of free blocks, get new memory. + __add_atomic_t __bytes_to_get = 2 * __total_bytes + + __STATIC_CAST(__add_atomic_t, + _S_round_up(__STATIC_CAST(__uadd_atomic_t, _STLP_ATOMIC_ADD(&_S_heap_size, 0)))) + + _STLP_OFFSET; + _STLP_TRY { + __result = __stlp_new_chunk(__bytes_to_get); + } +#if defined (_STLP_USE_EXCEPTIONS) + catch (const bad_alloc&) { + // Allocation failed; try to canibalize from freelist of a larger object size. + for (size_t __i = _p_size; __i <= (size_t)_MAX_BYTES; __i += (size_t)_ALIGN) { + _Obj* __p = _S_free_list[_S_FREELIST_INDEX(__i)].pop(); + if (0 != __p) { + if (__i < sizeof(_FreeBlockHeader)) { + // Not enough to put into list of free blocks, divvy it up here. + // Use as much as possible for this request and shove remainder into freelist. + __nobjs = (int)(__i/_p_size); + __total_bytes = __nobjs * __STATIC_CAST(__add_atomic_t, _p_size); + size_t __bytes_left = __i - __total_bytes; + size_t __rounded_down = _S_round_up(__bytes_left+1) - (size_t)_ALIGN; + if (__rounded_down > 0) { + _S_free_list[_S_FREELIST_INDEX(__rounded_down)].push(__REINTERPRET_CAST(_Obj*, __REINTERPRET_CAST(char*, __p) + __total_bytes)); + } + return __REINTERPRET_CAST(char*, __p); + } + else { + // Add node to list of available blocks and recursively allocate from it. + _FreeBlockHeader* __newblock = (_FreeBlockHeader*)__p; + __newblock->_M_end = __REINTERPRET_CAST(char*, __p) + __i; + _S_free_mem_blocks.push(__newblock); + return _S_chunk_alloc(_p_size, __nobjs); + } + } + } + + // We were not able to find something in a freelist, try to allocate a smaller amount. + __bytes_to_get = __total_bytes + _STLP_OFFSET; + __result = __stlp_new_chunk(__bytes_to_get); + + // This should either throw an exception or remedy the situation. + // Thus we assume it succeeded. + } +#endif + // Alignment check + _STLP_VERBOSE_ASSERT(((__REINTERPRET_CAST(size_t, __result) & __STATIC_CAST(size_t, _ALIGN - 1)) == 0), + _StlMsg_DBA_DELETED_TWICE) + _STLP_ATOMIC_ADD(&_S_heap_size, __bytes_to_get >> 4); + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) + // We have to track the allocated memory chunks for release on exit. + _S_chunks.push(__REINTERPRET_CAST(_Obj*, __result)); + __result += _ALIGN; + __bytes_to_get -= _ALIGN; +# endif + + if (__bytes_to_get > __total_bytes) { + // Push excess memory allocated in this chunk into list of free memory blocks + _FreeBlockHeader* __freeblock = __REINTERPRET_CAST(_FreeBlockHeader*, __result + __total_bytes); + __freeblock->_M_end = __result + __bytes_to_get; + _S_free_mem_blocks.push(__freeblock); + } + return __result; +} + +# if defined (_STLP_DO_CLEAN_NODE_ALLOC) +void __node_alloc_impl::_S_alloc_call() +{ _STLP_ATOMIC_INCREMENT(&_S_alloc_counter()); } + +void __node_alloc_impl::_S_dealloc_call() { + _STLP_VOLATILE __stl_atomic_t *pcounter = &_S_alloc_counter(); + if (_STLP_ATOMIC_DECREMENT(pcounter) == 0) + _S_chunk_dealloc(); +} + +/* We deallocate all the memory chunks */ +void __node_alloc_impl::_S_chunk_dealloc() { + // Note: The _Node_alloc_helper class ensures that this function + // will only be called when the (shared) library is unloaded or the + // process is shutdown. It's thus not possible that another thread + // is currently trying to allocate a node (we're not thread-safe here). + // + + // Clear the free blocks and all freelistst. This makes sure that if + // for some reason more memory is allocated again during shutdown + // (it'd also be really nasty to leave references to deallocated memory). + _S_free_mem_blocks.clear(); + _S_heap_size = 0; + + for (size_t __i = 0; __i < _STLP_NFREELISTS; ++__i) { + _S_free_list[__i].clear(); + } + + // Detach list of chunks and free them all + _Obj* __chunk = _S_chunks.clear(); + while (__chunk != 0) { + _Obj* __next = __chunk->_M_next; + __stlp_delete_chunck(__chunk); + __chunk = __next; + } +} +# endif + +#endif + +#if defined (_STLP_DO_CLEAN_NODE_ALLOC) +struct __node_alloc_cleaner { + ~__node_alloc_cleaner() + { __node_alloc_impl::_S_dealloc_call(); } +}; + +# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +_STLP_VOLATILE __stl_atomic_t& _STLP_CALL +# else +__stl_atomic_t& _STLP_CALL +# endif +__node_alloc_impl::_S_alloc_counter() { + static _AllocCounter _S_counter = 1; + static __node_alloc_cleaner _S_node_alloc_cleaner; + return _S_counter; +} +#endif + +#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +_Node_alloc_obj * _STLP_VOLATILE +__node_alloc_impl::_S_free_list[_STLP_NFREELISTS] += {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +// The 16 zeros are necessary to make version 4.1 of the SunPro +// compiler happy. Otherwise it appears to allocate too little +// space for the array. +#else +_STLP_atomic_freelist __node_alloc_impl::_S_free_list[_STLP_NFREELISTS]; +_STLP_atomic_freelist __node_alloc_impl::_S_free_mem_blocks; +#endif + +#if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +char *__node_alloc_impl::_S_start_free = 0; +char *__node_alloc_impl::_S_end_free = 0; +#endif + +#if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +_STLP_VOLATILE __add_atomic_t +#else +size_t +#endif +__node_alloc_impl::_S_heap_size = 0; + +#if defined (_STLP_DO_CLEAN_NODE_ALLOC) +# if defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) +_STLP_atomic_freelist __node_alloc_impl::_S_chunks; +# else +_Node_alloc_obj* __node_alloc_impl::_S_chunks = 0; +# endif +#endif + +void * _STLP_CALL __node_alloc::_M_allocate(size_t& __n) +{ return __node_alloc_impl::_M_allocate(__n); } + +void _STLP_CALL __node_alloc::_M_deallocate(void *__p, size_t __n) +{ __node_alloc_impl::_M_deallocate(__p, __n); } + +#if defined (_STLP_PTHREADS) && !defined (_STLP_NO_THREADS) + +# define _STLP_DATA_ALIGNMENT 8 + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// ******************************************************* +// __perthread_alloc implementation +union _Pthread_alloc_obj { + union _Pthread_alloc_obj * __free_list_link; + char __client_data[_STLP_DATA_ALIGNMENT]; /* The client sees this. */ +}; + +// Pthread allocators don't appear to the client to have meaningful +// instances. We do in fact need to associate some state with each +// thread. That state is represented by _Pthread_alloc_per_thread_state. + +struct _Pthread_alloc_per_thread_state { + typedef _Pthread_alloc_obj __obj; + enum { _S_NFREELISTS = _MAX_BYTES / _STLP_DATA_ALIGNMENT }; + + // Free list link for list of available per thread structures. + // When one of these becomes available for reuse due to thread + // termination, any objects in its free list remain associated + // with it. The whole structure may then be used by a newly + // created thread. + _Pthread_alloc_per_thread_state() : __next(0) + { memset((void *)__CONST_CAST(_Pthread_alloc_obj**, __free_list), 0, (size_t)_S_NFREELISTS * sizeof(__obj *)); } + // Returns an object of size __n, and possibly adds to size n free list. + void *_M_refill(size_t __n); + + _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS]; + _Pthread_alloc_per_thread_state *__next; + // this data member is only to be used by per_thread_allocator, which returns memory to the originating thread. + _STLP_mutex _M_lock; +}; + +// Pthread-specific allocator. +class _Pthread_alloc_impl { +public: // but only for internal use: + typedef _Pthread_alloc_per_thread_state __state_type; + typedef char value_type; + + // Allocates a chunk for nobjs of size size. nobjs may be reduced + // if it is inconvenient to allocate the requested number. + static char *_S_chunk_alloc(size_t __size, size_t &__nobjs, __state_type*); + + enum {_S_ALIGN = _STLP_DATA_ALIGNMENT}; + + static size_t _S_round_up(size_t __bytes) + { return (((__bytes) + (int)_S_ALIGN - 1) & ~((int)_S_ALIGN - 1)); } + static size_t _S_freelist_index(size_t __bytes) + { return (((__bytes) + (int)_S_ALIGN - 1) / (int)_S_ALIGN - 1); } + +private: + // Chunk allocation state. And other shared state. + // Protected by _S_chunk_allocator_lock. + static _STLP_STATIC_MUTEX _S_chunk_allocator_lock; + static char *_S_start_free; + static char *_S_end_free; + static size_t _S_heap_size; + static __state_type *_S_free_per_thread_states; + static pthread_key_t _S_key; + static bool _S_key_initialized; + // Pthread key under which per thread state is stored. + // Allocator instances that are currently unclaimed by any thread. + static void _S_destructor(void *instance); + // Function to be called on thread exit to reclaim per thread + // state. + static __state_type *_S_new_per_thread_state(); +public: + // Return a recycled or new per thread state. + static __state_type *_S_get_per_thread_state(); +private: + // ensure that the current thread has an associated + // per thread state. + class _M_lock; + friend class _M_lock; + class _M_lock { + public: + _M_lock () { _S_chunk_allocator_lock._M_acquire_lock(); } + ~_M_lock () { _S_chunk_allocator_lock._M_release_lock(); } + }; + +public: + + /* n must be > 0 */ + static void * allocate(size_t& __n); + + /* p may not be 0 */ + static void deallocate(void *__p, size_t __n); + + // boris : versions for per_thread_allocator + /* n must be > 0 */ + static void * allocate(size_t& __n, __state_type* __a); + + /* p may not be 0 */ + static void deallocate(void *__p, size_t __n, __state_type* __a); + + static void * reallocate(void *__p, size_t __old_sz, size_t& __new_sz); +}; + +/* Returns an object of size n, and optionally adds to size n free list.*/ +/* We assume that n is properly aligned. */ +/* We hold the allocation lock. */ +void *_Pthread_alloc_per_thread_state::_M_refill(size_t __n) { + typedef _Pthread_alloc_obj __obj; + size_t __nobjs = 128; + char * __chunk = _Pthread_alloc_impl::_S_chunk_alloc(__n, __nobjs, this); + __obj * volatile * __my_free_list; + __obj * __result; + __obj * __current_obj, * __next_obj; + size_t __i; + + if (1 == __nobjs) { + return __chunk; + } + + __my_free_list = __free_list + _Pthread_alloc_impl::_S_freelist_index(__n); + + /* Build free list in chunk */ + __result = (__obj *)__chunk; + *__my_free_list = __next_obj = (__obj *)(__chunk + __n); + for (__i = 1; ; ++__i) { + __current_obj = __next_obj; + __next_obj = (__obj *)((char *)__next_obj + __n); + if (__nobjs - 1 == __i) { + __current_obj -> __free_list_link = 0; + break; + } else { + __current_obj -> __free_list_link = __next_obj; + } + } + return __result; +} + +void _Pthread_alloc_impl::_S_destructor(void *__instance) { + _M_lock __lock_instance; // Need to acquire lock here. + _Pthread_alloc_per_thread_state* __s = (_Pthread_alloc_per_thread_state*)__instance; + __s -> __next = _S_free_per_thread_states; + _S_free_per_thread_states = __s; +} + +_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_new_per_thread_state() { + /* lock already held here. */ + if (0 != _S_free_per_thread_states) { + _Pthread_alloc_per_thread_state *__result = _S_free_per_thread_states; + _S_free_per_thread_states = _S_free_per_thread_states -> __next; + return __result; + } + else { + return new _Pthread_alloc_per_thread_state; + } +} + +_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_get_per_thread_state() { + int __ret_code; + __state_type* __result; + + if (_S_key_initialized && (__result = (__state_type*) pthread_getspecific(_S_key))) + return __result; + + /*REFERENCED*/ + _M_lock __lock_instance; // Need to acquire lock here. + if (!_S_key_initialized) { + if (pthread_key_create(&_S_key, _S_destructor)) { + _STLP_THROW_BAD_ALLOC; // failed + } + _S_key_initialized = true; + } + + __result = _S_new_per_thread_state(); + __ret_code = pthread_setspecific(_S_key, __result); + if (__ret_code) { + if (__ret_code == ENOMEM) { + _STLP_THROW_BAD_ALLOC; + } else { + // EINVAL + _STLP_ABORT(); + } + } + return __result; +} + +/* We allocate memory in large chunks in order to avoid fragmenting */ +/* the malloc heap too much. */ +/* We assume that size is properly aligned. */ +char *_Pthread_alloc_impl::_S_chunk_alloc(size_t __p_size, size_t &__nobjs, _Pthread_alloc_per_thread_state *__a) { + typedef _Pthread_alloc_obj __obj; + { + char * __result; + size_t __total_bytes; + size_t __bytes_left; + /*REFERENCED*/ + _M_lock __lock_instance; // Acquire lock for this routine + + __total_bytes = __p_size * __nobjs; + __bytes_left = _S_end_free - _S_start_free; + if (__bytes_left >= __total_bytes) { + __result = _S_start_free; + _S_start_free += __total_bytes; + return __result; + } else if (__bytes_left >= __p_size) { + __nobjs = __bytes_left/__p_size; + __total_bytes = __p_size * __nobjs; + __result = _S_start_free; + _S_start_free += __total_bytes; + return __result; + } else { + size_t __bytes_to_get = 2 * __total_bytes + _S_round_up(_S_heap_size); + // Try to make use of the left-over piece. + if (__bytes_left > 0) { + __obj * volatile * __my_free_list = __a->__free_list + _S_freelist_index(__bytes_left); + ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list; + *__my_free_list = (__obj *)_S_start_free; + } +# ifdef _SGI_SOURCE + // Try to get memory that's aligned on something like a + // cache line boundary, so as to avoid parceling out + // parts of the same line to different threads and thus + // possibly different processors. + { + const int __cache_line_size = 128; // probable upper bound + __bytes_to_get &= ~(__cache_line_size-1); + _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get); + if (0 == _S_start_free) { + _S_start_free = (char *)__malloc_alloc::allocate(__bytes_to_get); + } + } +# else /* !SGI_SOURCE */ + _S_start_free = (char *)__malloc_alloc::allocate(__bytes_to_get); +# endif + _S_heap_size += __bytes_to_get >> 4; + _S_end_free = _S_start_free + __bytes_to_get; + } + } + // lock is released here + return _S_chunk_alloc(__p_size, __nobjs, __a); +} + + +/* n must be > 0 */ +void *_Pthread_alloc_impl::allocate(size_t& __n) { + typedef _Pthread_alloc_obj __obj; + __obj * volatile * __my_free_list; + __obj * __result; + __state_type* __a; + + if (__n > _MAX_BYTES) { + return __malloc_alloc::allocate(__n); + } + + __n = _S_round_up(__n); + __a = _S_get_per_thread_state(); + + __my_free_list = __a->__free_list + _S_freelist_index(__n); + __result = *__my_free_list; + if (__result == 0) { + void *__r = __a->_M_refill(__n); + return __r; + } + *__my_free_list = __result->__free_list_link; + return __result; +}; + +/* p may not be 0 */ +void _Pthread_alloc_impl::deallocate(void *__p, size_t __n) { + typedef _Pthread_alloc_obj __obj; + __obj *__q = (__obj *)__p; + __obj * volatile * __my_free_list; + __state_type* __a; + + if (__n > _MAX_BYTES) { + __malloc_alloc::deallocate(__p, __n); + return; + } + + __a = _S_get_per_thread_state(); + + __my_free_list = __a->__free_list + _S_freelist_index(__n); + __q -> __free_list_link = *__my_free_list; + *__my_free_list = __q; +} + +// boris : versions for per_thread_allocator +/* n must be > 0 */ +void *_Pthread_alloc_impl::allocate(size_t& __n, __state_type* __a) { + typedef _Pthread_alloc_obj __obj; + __obj * volatile * __my_free_list; + __obj * __result; + + if (__n > _MAX_BYTES) { + return __malloc_alloc::allocate(__n); + } + __n = _S_round_up(__n); + + // boris : here, we have to lock per thread state, as we may be getting memory from + // different thread pool. + _STLP_auto_lock __lock(__a->_M_lock); + + __my_free_list = __a->__free_list + _S_freelist_index(__n); + __result = *__my_free_list; + if (__result == 0) { + void *__r = __a->_M_refill(__n); + return __r; + } + *__my_free_list = __result->__free_list_link; + return __result; +}; + +/* p may not be 0 */ +void _Pthread_alloc_impl::deallocate(void *__p, size_t __n, __state_type* __a) { + typedef _Pthread_alloc_obj __obj; + __obj *__q = (__obj *)__p; + __obj * volatile * __my_free_list; + + if (__n > _MAX_BYTES) { + __malloc_alloc::deallocate(__p, __n); + return; + } + + // boris : here, we have to lock per thread state, as we may be returning memory from + // different thread. + _STLP_auto_lock __lock(__a->_M_lock); + + __my_free_list = __a->__free_list + _S_freelist_index(__n); + __q -> __free_list_link = *__my_free_list; + *__my_free_list = __q; +} + +void *_Pthread_alloc_impl::reallocate(void *__p, size_t __old_sz, size_t& __new_sz) { + void * __result; + size_t __copy_sz; + + if (__old_sz > _MAX_BYTES && __new_sz > _MAX_BYTES) { + return realloc(__p, __new_sz); + } + + if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return __p; + __result = allocate(__new_sz); + __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; + memcpy(__result, __p, __copy_sz); + deallocate(__p, __old_sz); + return __result; +} + +_Pthread_alloc_per_thread_state* _Pthread_alloc_impl::_S_free_per_thread_states = 0; +pthread_key_t _Pthread_alloc_impl::_S_key = 0; +_STLP_STATIC_MUTEX _Pthread_alloc_impl::_S_chunk_allocator_lock _STLP_MUTEX_INITIALIZER; +bool _Pthread_alloc_impl::_S_key_initialized = false; +char *_Pthread_alloc_impl::_S_start_free = 0; +char *_Pthread_alloc_impl::_S_end_free = 0; +size_t _Pthread_alloc_impl::_S_heap_size = 0; + +void * _STLP_CALL _Pthread_alloc::allocate(size_t& __n) +{ return _Pthread_alloc_impl::allocate(__n); } +void _STLP_CALL _Pthread_alloc::deallocate(void *__p, size_t __n) +{ _Pthread_alloc_impl::deallocate(__p, __n); } +void * _STLP_CALL _Pthread_alloc::allocate(size_t& __n, __state_type* __a) +{ return _Pthread_alloc_impl::allocate(__n, __a); } +void _STLP_CALL _Pthread_alloc::deallocate(void *__p, size_t __n, __state_type* __a) +{ _Pthread_alloc_impl::deallocate(__p, __n, __a); } +void * _STLP_CALL _Pthread_alloc::reallocate(void *__p, size_t __old_sz, size_t& __new_sz) +{ return _Pthread_alloc_impl::reallocate(__p, __old_sz, __new_sz); } +_Pthread_alloc_per_thread_state* _STLP_CALL _Pthread_alloc::_S_get_per_thread_state() +{ return _Pthread_alloc_impl::_S_get_per_thread_state(); } + +_STLP_MOVE_TO_STD_NAMESPACE + +#endif + +_STLP_END_NAMESPACE + +#undef _S_FREELIST_INDEX diff --git a/sdk/tlibstdcxx/src/bitset.cpp b/sdk/tlibstdcxx/src/bitset.cpp new file mode 100644 index 0000000000..90f1799157 --- /dev/null +++ b/sdk/tlibstdcxx/src/bitset.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// ------------------------------------------------------------ +// Lookup tables for find and count operations. + +size_t _Bs_G::_S_count(const unsigned char *__first, + const unsigned char *__last) +{ + static const unsigned char _bit_count[256] = { + 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ + 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ + 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ + 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */ + 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */ + 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */ + 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */ + 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */ + 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */ + 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */ + 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */ + 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */ + 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */ + 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */ + 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */ + 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */ + 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */ + 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */ + 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */ + 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */ + 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */ + 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */ + 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */ + 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */ + 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */ + 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */ + 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */ + 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */ + 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */ + 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */ + 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */ + 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */ + 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */ + 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */ + 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */ + 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */ + 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */ + 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */ + 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */ + 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */ + 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */ + 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */ + 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */ + 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */ + 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */ + 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */ + 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */ + 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */ + 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */ + 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ + 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ + 8 /* 255 */ + }; + + size_t __result(0); + while ( __first < __last ) { + __result += _bit_count[*(__first++)]; + } + return __result; +} + +unsigned char _Bs_G::_S_first_one(unsigned char __byte) +{ + static const unsigned char _first_one[256] = { + 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ + 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ + 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ + 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */ + 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */ + 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */ + 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */ + 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */ + 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */ + 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */ + 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */ + 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */ + 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */ + 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */ + 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */ + 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */ + 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */ + 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */ + 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */ + 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */ + 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */ + 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */ + 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */ + 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */ + 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */ + 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */ + 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */ + 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */ + 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */ + 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */ + 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */ + 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */ + 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */ + 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */ + 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */ + 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */ + 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */ + 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */ + 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */ + 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */ + 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */ + 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */ + 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */ + 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */ + 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */ + 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */ + 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */ + 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */ + 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */ + 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ + 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ + 0, /* 255 */ + }; + return _first_one[__byte]; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/c_locale.c b/sdk/tlibstdcxx/src/c_locale.c new file mode 100644 index 0000000000..376e22e493 --- /dev/null +++ b/sdk/tlibstdcxx/src/c_locale.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include "c_locale.h" + +#if defined (_STLP_WIN32) && !defined (_STLP_WCE) +# include "c_locale_win32/c_locale_win32.c" +#elif defined (_STLP_USE_GLIBC2_LOCALIZATION) +# include "c_locale_glibc/c_locale_glibc2.c" /* glibc 2.2 and newer */ +#else +# include "c_locale_dummy/c_locale_dummy.c" +#endif diff --git a/sdk/tlibstdcxx/src/c_locale.h b/sdk/tlibstdcxx/src/c_locale.h new file mode 100644 index 0000000000..36d9961128 --- /dev/null +++ b/sdk/tlibstdcxx/src/c_locale.h @@ -0,0 +1,450 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * It is impossible to write the C++ locale library in terms of locales + * as defined in the C standard. Instead, we write the C++ locale and I/O + * library in terms of a low level C-like interface. This file defines + * that interface. + * + * The low-level locale interface can't be written portably; there + * must be a version of it for each platform that the C++ library + * is ported to. On many systems this interface may be a thin wrapper + * for existing functionality. + */ + +#ifndef _STLP_C_LOCALE_IMPL_H +#define _STLP_C_LOCALE_IMPL_H + +#include "stlport_prefix.h" + +#include /* for mbstate_t */ +#include + +struct _Locale_name_hint; + +#if defined (_GNU_SOURCE) && defined (__GLIBC__) && \ + ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) +# define _STLP_USE_GLIBC2_LOCALIZATION +# include +typedef nl_catd nl_catd_type; +#else +typedef int nl_catd_type; +#endif + +/* + * A number: the maximum length of a simple locale name. + * (i.e. a name like like en_US, as opposed to a name like + * en_US/de_AT/de_AT/es_MX/en_US/en_US) */ +#define _Locale_MAX_SIMPLE_NAME 256 + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Typedefs: + */ +typedef unsigned short int _Locale_mask_t; + +/* Function called during STLport library load phase. Might contain any + * code necessary to the platform localization layer. + */ +void _Locale_init(void); + +/* Function called during STLport library unload. Might contain any + * code necessary to the platform localization layer. + */ +void _Locale_final(void); + +/* Create a category of the locale with the given name. + * + * The char* argument is a simple (not a composite) locale name, which may + * neither be an empty string nor a null pointer. + * + * These functions return NULL to indicate failure. Failure reason should be reported + * using the __err_code pointer. + */ +struct _Locale_ctype* _Locale_ctype_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); +struct _Locale_codecvt* _Locale_codecvt_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); +struct _Locale_numeric* _Locale_numeric_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); +struct _Locale_time* _Locale_time_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); +struct _Locale_collate* _Locale_collate_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); +struct _Locale_monetary* _Locale_monetary_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); +struct _Locale_messages* _Locale_messages_create(const char *, struct _Locale_name_hint*, int * /* __err_code */); + +/* Give error reason on failure of one of the _Locale_*_create functions. Available + * reasons are: + * 0: No specific error reason has been reported. + * 1: No platform support for the given facet. + * 2: Unknown locale name + * 3: No platform API for localization support. + * 4: No more memory + */ +#define _STLP_LOC_UNDEFINED 0 +#define _STLP_LOC_UNSUPPORTED_FACET_CATEGORY 1 +#define _STLP_LOC_UNKNOWN_NAME 2 +#define _STLP_LOC_NO_PLATFORM_SUPPORT 3 +#define _STLP_LOC_NO_MEMORY 4 + +/* Release a category of a locale + * + * These functions are used to release a category acquired with the + * according _Locale_*_create() functions. + */ +void _Locale_ctype_destroy(struct _Locale_ctype *); +void _Locale_codecvt_destroy(struct _Locale_codecvt *); +void _Locale_numeric_destroy(struct _Locale_numeric *); +void _Locale_time_destroy(struct _Locale_time *); +void _Locale_collate_destroy(struct _Locale_collate *); +void _Locale_monetary_destroy(struct _Locale_monetary *); +void _Locale_messages_destroy(struct _Locale_messages *); + +/* + * Returns the name of the user's default locale in each + * category, as a null-terminated string. A NULL value + * means the default "C" locale. + */ +const char * _Locale_ctype_default(char * __buf); +const char * _Locale_numeric_default(char * __buf); +const char * _Locale_time_default(char * __buf); +const char * _Locale_collate_default(char * __buf); +const char * _Locale_monetary_default(char * __buf); +const char * _Locale_messages_default(char * __buf); + +/* Retrieve the name of the given category + * + * __buf points to a buffer that can hold at least _Locale_MAX_SIMPLE_NAME + * characters. These functions store the name, as a null-terminated + * string, in __buf. This function can't fail, at worst name is truncated. + */ +char const* _Locale_ctype_name(const struct _Locale_ctype *, char* __buf); +char const* _Locale_codecvt_name(const struct _Locale_codecvt *, char* __buf); +char const* _Locale_numeric_name(const struct _Locale_numeric *, char* __buf); +char const* _Locale_time_name(const struct _Locale_time *, char* __buf); +char const* _Locale_collate_name(const struct _Locale_collate *, char* __buf); +char const* _Locale_monetary_name(const struct _Locale_monetary *, char* __buf); +char const* _Locale_messages_name(const struct _Locale_messages *, char* __buf); + +/* + * cname is a (possibly composite) locale name---i.e. a name that can + * be passed to setlocale. __buf points to an array large enough to + * store at least _Locale_MAX_SIMPLE_NAME characters, and each of these + * functions extracts the name of a single category, stores it in buf + * as a null-terminated string, and returns buf. + */ +char const* _Locale_extract_ctype_name(const char *cname, char *__buf, + struct _Locale_name_hint* __hint, int *__err_code); +char const* _Locale_extract_numeric_name(const char *cname, char *__buf, + struct _Locale_name_hint* __hint, int *__err_code); +char const* _Locale_extract_time_name(const char *cname, char *__buf, + struct _Locale_name_hint* __hint, int *__err_code); +char const* _Locale_extract_collate_name(const char *cname, char *__buf, + struct _Locale_name_hint* __hint, int *__err_code); +char const* _Locale_extract_monetary_name(const char *cname, char *__buf, + struct _Locale_name_hint* __hint, int *__err_code); +char const* _Locale_extract_messages_name(const char *cname, char *__buf, + struct _Locale_name_hint* __hint, int *__err_code); + +/* Functions to improve locale creation process. For some locale API (Win32) + * you need to find a locale identification from the name which can be a + * rather expensive operation especially if you do so for all facets of a + * locale. Those functions can be used to extract from a API dependent facet + * struct the information necessary to skip this lookup process for other + * facets creation. If not supported those function should return NULL. + */ +struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype*); +struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric*); +struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time*); +struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate*); +struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary*); +struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages*); + +/* + * FUNCTIONS THAT USE CTYPE + */ + +/* + * Narrow character functions: + */ + +/* + * Returns a pointer to the beginning of the ctype table. The table is + * at least 257 bytes long; if p is the pointer returned by this + * function, then p[c] is valid if c is EOF or if p is any value of + * type unsigned char. + */ +const _Locale_mask_t * _Locale_ctype_table(struct _Locale_ctype *); + +/* + * c is either EOF, or an unsigned char value. + */ +int _Locale_toupper(struct _Locale_ctype *, int /* c */); +int _Locale_tolower(struct _Locale_ctype *, int /* c */); + + +#ifndef _STLP_NO_WCHAR_T +/* + * Wide character functions: + */ +_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *, wint_t, _Locale_mask_t); +wint_t _WLocale_tolower(struct _Locale_ctype *, wint_t); +wint_t _WLocale_toupper(struct _Locale_ctype *, wint_t); + +/* + * Multibyte functions: + */ + +/* + * Returns the number of bytes of the longest allowed multibyte + * character in the current encoding. + */ +int _WLocale_mb_cur_max(struct _Locale_codecvt *); + +/* + * Returns the number of bytes of the shortest allowed multibyte + * character in the current encoding. + */ +int _WLocale_mb_cur_min(struct _Locale_codecvt *); + +/* + * Returns 1 if the current multibyte encoding is stateless + * and does not require the use of an mbstate_t value. + */ +int _WLocale_is_stateless(struct _Locale_codecvt *); + +/* + * Almost identical to mbrtowc, from 4.6.5.3.2 of NA1. The only + * important difference is that mbrtowc treats null wide characters + * as special, and we don't. Specifically: examines the characters + * in [from, from + n), extracts a single wide character, and stores + * it in *to. Modifies shift_state if appropriate. The return value, + * which is always positive, is the number of characters extracted from + * the input sequence. Return value is (size_t) -1 if there was an + * encoding error in the input sequence, and (size_t) -2 if + * [from, from + n) is correct but not complete. None of the pointer + * arguments may be null pointers. + */ +size_t _WLocale_mbtowc(struct _Locale_codecvt *, + wchar_t * /* to */, + const char * /* from */, size_t /* n */, + mbstate_t *); + +/* + * Again, very similar to wcrtomb. The differences are that (1) it + * doesn't treat null characters as special; and (2) it stores at most + * n characters. Converts c to a multibyte sequence, stores that + * sequence in the array 'to', and returns the length of the sequence. + * Modifies shift_state if appropriate. The return value is (size_t) -1 + * if c is not a valid wide character, and (size_t) -2 if the length of + * the multibyte character sequence is greater than n. + */ +size_t _WLocale_wctomb(struct _Locale_codecvt *, + char *, size_t, + const wchar_t, + mbstate_t *); + +/* + * Inserts whatever characters are necessary to restore st to an + * initial shift state. Sets *next to buf + m, where m is the number + * of characters inserted. (0 <= m <= n.) Returns m to indicate + * success, (size_t) -1 to indicate error, (size_t) -2 to indicate + * partial success (more than n characters needed). For success or partial + * success, sets *next to buf + m. + */ +size_t _WLocale_unshift(struct _Locale_codecvt *, + mbstate_t *, + char *, size_t, char **); +#endif + +/* + * FUNCTIONS THAT USE COLLATE + */ + +/* + * Compares the two sequences [s1, s1 + n1) and [s2, s2 + n2). Neither + * sequence is assumed to be null-terminated, and null characters + * aren't special. If the two sequences are the same up through + * min(n1, n2), then the sequence that compares less is whichever one + * is shorter. + */ +int _Locale_strcmp(struct _Locale_collate *, + const char * /* s1 */, size_t /* n1 */, + const char * /* s2 */, size_t /* n2 */); +#ifndef _STLP_NO_WCHAR_T +int _WLocale_strcmp(struct _Locale_collate *, + const wchar_t * /* s1 */, size_t /* n1 */, + const wchar_t * /* s2 */, size_t /* n2 */); +#endif + +/* + * Creates a transformed version of the string [s2, s2 + n2). The + * string may contain embedded null characters; nulls aren't special. + * The transformed string begins at s1, and contains at most n1 + * characters. The return value is the length of the transformed + * string. If the return value is greater than n1 then this is an + * error condition: it indicates that there wasn't enough space. In + * that case, the contents of [s1, s1 + n1) is unspecified. +*/ +size_t _Locale_strxfrm(struct _Locale_collate *, + char * /* s1 */, size_t /* n1 */, + const char * /* s2 */, size_t /* n2 */); + +#ifndef _STLP_NO_WCHAR_T +size_t _WLocale_strxfrm(struct _Locale_collate *, + wchar_t * /* s1 */, size_t /* n1 */, + const wchar_t * /* s2 */, size_t /* n2 */); +#endif + + +/* + * FUNCTIONS THAT USE NUMERIC + */ + +/* + * Equivalent to the first three fields in struct lconv. (C standard, + * section 7.4.) + */ +char _Locale_decimal_point(struct _Locale_numeric *); +char _Locale_thousands_sep(struct _Locale_numeric *); +const char * _Locale_grouping(struct _Locale_numeric *); + +#ifndef _STLP_NO_WCHAR_T +wchar_t _WLocale_decimal_point(struct _Locale_numeric *); +wchar_t _WLocale_thousands_sep(struct _Locale_numeric *); +#endif + +/* + * Return "true" and "false" in English locales, and something + * appropriate in non-English locales. + */ +const char * _Locale_true(struct _Locale_numeric *); +const char * _Locale_false(struct _Locale_numeric *); + +#ifndef _STLP_NO_WCHAR_T +const wchar_t * _WLocale_true(struct _Locale_numeric *, wchar_t* /* buf */, size_t /* bufSize */); +const wchar_t * _WLocale_false(struct _Locale_numeric *, wchar_t* /* buf */, size_t /* bufSize */); +#endif + +/* + * FUNCTIONS THAT USE MONETARY + */ + +/* + * Return the obvious fields of struct lconv. + */ +const char * _Locale_int_curr_symbol(struct _Locale_monetary *); +const char * _Locale_currency_symbol(struct _Locale_monetary *); +char _Locale_mon_decimal_point(struct _Locale_monetary *); +char _Locale_mon_thousands_sep(struct _Locale_monetary *); +const char * _Locale_mon_grouping(struct _Locale_monetary *); +const char * _Locale_positive_sign(struct _Locale_monetary *); +const char * _Locale_negative_sign(struct _Locale_monetary *); +char _Locale_int_frac_digits(struct _Locale_monetary *); +char _Locale_frac_digits(struct _Locale_monetary *); +int _Locale_p_cs_precedes(struct _Locale_monetary *); +int _Locale_p_sep_by_space(struct _Locale_monetary *); +int _Locale_p_sign_posn(struct _Locale_monetary *); +int _Locale_n_cs_precedes(struct _Locale_monetary *); +int _Locale_n_sep_by_space(struct _Locale_monetary *); +int _Locale_n_sign_posn(struct _Locale_monetary *); + +#ifndef _STLP_NO_WCHAR_T +const wchar_t * _WLocale_int_curr_symbol(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */); +const wchar_t * _WLocale_currency_symbol(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */); +wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary *); +wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary *); +const wchar_t * _WLocale_positive_sign(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */); +const wchar_t * _WLocale_negative_sign(struct _Locale_monetary *, wchar_t* /* buf */, size_t /* bufSize */); +#endif + +/* + * FUNCTIONS THAT USE TIME + */ + +/* + * month is in the range [0, 12). + */ +const char * _Locale_full_monthname(struct _Locale_time *, int /* month */); +const char * _Locale_abbrev_monthname(struct _Locale_time *, int /* month */); + +#ifndef _STLP_NO_WCHAR_T +const wchar_t * _WLocale_full_monthname(struct _Locale_time *, int /* month */, + wchar_t* /* buf */, size_t /* bufSize */); +const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time *, int /* month */, + wchar_t* /* buf */, size_t /* bufSize */); +#endif + +/* + * day is in the range [0, 7). Sunday is 0. + */ +const char * _Locale_full_dayofweek(struct _Locale_time *, int /* day */); +const char * _Locale_abbrev_dayofweek(struct _Locale_time *, int /* day */); + +#ifndef _STLP_NO_WCHAR_T +const wchar_t * _WLocale_full_dayofweek(struct _Locale_time *, int /* day */, + wchar_t* /* buf */, size_t /* bufSize */); +const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time *, int /* day */, + wchar_t* /* buf */, size_t /* bufSize */); +#endif + +const char * _Locale_d_t_fmt(struct _Locale_time *); +const char * _Locale_d_fmt(struct _Locale_time *); +const char * _Locale_t_fmt(struct _Locale_time *); +const char * _Locale_long_d_t_fmt(struct _Locale_time*); +const char * _Locale_long_d_fmt(struct _Locale_time*); + +const char * _Locale_am_str(struct _Locale_time *); +const char * _Locale_pm_str(struct _Locale_time *); + +#ifndef _STLP_NO_WCHAR_T +const wchar_t * _WLocale_am_str(struct _Locale_time *, + wchar_t* /* buf */, size_t /* bufSize */); +const wchar_t * _WLocale_pm_str(struct _Locale_time *, + wchar_t* /* buf */, size_t /* bufSize */); +#endif + +/* + * FUNCTIONS THAT USE MESSAGES + */ + +/* + * Very similar to catopen, except that it uses the given message + * category to determine which catalog to open. + */ +nl_catd_type _Locale_catopen(struct _Locale_messages*, const char*); + +/* Complementary to _Locale_catopen. + * The catalog must be a value that was returned by a previous call + * to _Locale_catopen. + */ +void _Locale_catclose(struct _Locale_messages*, nl_catd_type); + +/* + * Returns a string, identified by a set index and a message index, + * from an opened message catalog. Returns the supplied default if + * no such string exists. + */ +const char * _Locale_catgets(struct _Locale_messages *, nl_catd_type, + int, int,const char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _STLP_C_LOCALE_IMPL_H */ diff --git a/sdk/tlibstdcxx/src/c_locale_dummy/c_locale_dummy.c b/sdk/tlibstdcxx/src/c_locale_dummy/c_locale_dummy.c new file mode 100644 index 0000000000..be48f23063 --- /dev/null +++ b/sdk/tlibstdcxx/src/c_locale_dummy/c_locale_dummy.c @@ -0,0 +1,485 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* This is a "stub" implementation of the "c_locale.h" interface, + intended for operating systems where we have not yet written + a real implementation. A C++ library using this stub implementation + is still standard-conforming, since the C++ standard does not require + that any locales other than "C" be supported. +*/ + +#include +#include +#include +#include +#include + +#if defined (_STLP_USE_SAFE_STRING_FUNCTIONS) +# define _STLP_STRNCPY(D, DS, S, C) strncpy_s(D, DS, S, C) +# if !defined (_STLP_NO_WCHAR_T) +# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy_s(D, DS, S, C) +# endif +#else +# define _STLP_STRNCPY(D, DS, S, C) strncpy(D, S, C) +# if !defined (_STLP_NO_WCHAR_T) +# define _STLP_WCSNCPY(D, DS, S, C) wcsncpy(D, S, C) +# endif +#endif + +static const char *_C_name = "C"; +static const char *_empty_str = ""; +#ifndef _STLP_NO_WCHAR_T +static const wchar_t *_empty_wstr = L""; +#endif + +static _Locale_mask_t ctable[256]; + +/* Framework functions */ + +void _Locale_init(void) { + /* Ctype table for the ASCII character set. */ + char c; + /* We might never reach 128 when char is signed. */ + for (c = 0; /* c != 128 */; ++c) { + if (isalpha(c)) ctable[(unsigned char)c] |= _Locale_ALPHA; + if (iscntrl(c)) ctable[(unsigned char)c] |= _Locale_CNTRL; + if (isdigit(c)) ctable[(unsigned char)c] |= _Locale_DIGIT; + if (isprint(c)) ctable[(unsigned char)c] |= _Locale_PRINT; + if (ispunct(c)) ctable[(unsigned char)c] |= _Locale_PUNCT; + if (isspace(c)) ctable[(unsigned char)c] |= _Locale_SPACE; + if (isxdigit(c)) ctable[(unsigned char)c] |= _Locale_XDIGIT; + if (isupper(c)) ctable[(unsigned char)c] |= _Locale_UPPER; + if (islower(c)) ctable[(unsigned char)c] |= _Locale_LOWER; + if (c == 127) break; + } + + /* ASCII is a 7-bit code, so everything else is non-ASCII. */ + memset(&(ctable[128]), 0, 128 * sizeof(_Locale_mask_t)); +} + +void _Locale_final(void) +{} + +void* _Locale_create(const char* name, int *__err_code) { + if (name[0] == 'C' && name[1] == 0) + { return (void*)0x1; } + *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0; +} + +struct _Locale_ctype* _Locale_ctype_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_ctype*)_Locale_create(name, __err_code); } + +struct _Locale_codecvt* _Locale_codecvt_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_codecvt*)_Locale_create(name, __err_code); } + +struct _Locale_numeric* _Locale_numeric_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_numeric*)_Locale_create(name, __err_code); } + +struct _Locale_time* _Locale_time_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_time*)_Locale_create(name, __err_code); } + +struct _Locale_collate* _Locale_collate_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_collate*)_Locale_create(name, __err_code); } + +struct _Locale_monetary* _Locale_monetary_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_monetary*)_Locale_create(name, __err_code); } + +struct _Locale_messages* _Locale_messages_create(const char *name, + struct _Locale_name_hint* hint, int *__err_code) +{ return (struct _Locale_messages*)_Locale_create(name, __err_code); } + +const char *_Locale_ctype_default(char* buf) { return _C_name; } +const char *_Locale_numeric_default(char * buf) { return _C_name; } +const char *_Locale_time_default(char* buf) { return _C_name; } +const char *_Locale_collate_default(char* buf) { return _C_name; } +const char *_Locale_monetary_default(char* buf) { return _C_name; } +const char *_Locale_messages_default(char* buf) { return _C_name; } + +char const* _Locale_ctype_name(const struct _Locale_ctype *lctype, char* buf) +{ return _C_name; } + +char const* _Locale_codecvt_name(const struct _Locale_codecvt *lcodecvt, char* buf) +{ return _C_name; } + +char const* _Locale_numeric_name(const struct _Locale_numeric *lnum, char* buf) +{ return _C_name; } + +char const* _Locale_time_name(const struct _Locale_time *ltime, char* buf) +{ return _C_name; } + +char const* _Locale_collate_name(const struct _Locale_collate *lcol, char* buf) +{ return _C_name; } + +char const* _Locale_monetary_name(const struct _Locale_monetary *lmon, char* buf) +{ return _C_name; } + +char const* _Locale_messages_name(const struct _Locale_messages *lmes, char* buf) +{ return _C_name; } + +void _Locale_ctype_destroy(struct _Locale_ctype *lctype) {} +void _Locale_codecvt_destroy(struct _Locale_codecvt *lcodecvt) {} +void _Locale_numeric_destroy(struct _Locale_numeric *lnum) {} +void _Locale_time_destroy(struct _Locale_time *ltime) {} +void _Locale_collate_destroy(struct _Locale_collate *lcol) {} +void _Locale_monetary_destroy(struct _Locale_monetary *lmon) {} +void _Locale_messages_destroy(struct _Locale_messages *lmes) {} + +static char const* _Locale_extract_name(const char* name, int *__err_code) { + // When the request is the default locale or the "C" locale we answer "C". + if (name[0] == 0 || + (name[0] == 'C' && name[1] == 0)) + { return _C_name; } + *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0; +} + +char const* _Locale_extract_ctype_name(const char *name, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return _Locale_extract_name(name, __err_code); } + +char const* _Locale_extract_numeric_name(const char *name, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return _Locale_extract_name(name, __err_code); } + +char const* _Locale_extract_time_name(const char*name, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return _Locale_extract_name(name, __err_code); } + +char const* _Locale_extract_collate_name(const char *name, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return _Locale_extract_name(name, __err_code); } + +char const* _Locale_extract_monetary_name(const char *name, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return _Locale_extract_name(name, __err_code); } + +char const* _Locale_extract_messages_name(const char *name, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return _Locale_extract_name(name, __err_code); } + +struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype) +{ return 0; } +struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric) +{ return 0; } +struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time) +{ return 0; } +struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate) +{ return 0; } +struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary) +{ return 0; } +struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages) +{ return 0; } + +/* ctype */ +const _Locale_mask_t* _Locale_ctype_table(struct _Locale_ctype* lctype) { + _STLP_MARK_PARAMETER_AS_UNUSED(lctype) + return ctable; +} + +int _Locale_toupper(struct _Locale_ctype*lctype, int c) +{ return toupper(c); } + +int _Locale_tolower(struct _Locale_ctype*lctype, int c) +{ return tolower(c); } + +#ifndef _STLP_NO_WCHAR_T +_Locale_mask_t _WLocale_ctype(struct _Locale_ctype *lctype, wint_t wc, _Locale_mask_t mask) { + _Locale_mask_t ret = 0; + if ((mask & _Locale_ALPHA) != 0 && iswalpha(wc)) + ret |= _Locale_ALPHA; + + if ((mask & _Locale_CNTRL) != 0 && iswcntrl(wc)) + ret |= _Locale_CNTRL; + + if ((mask & _Locale_DIGIT) != 0 && iswdigit(wc)) + ret |= _Locale_DIGIT; + + if ((mask & _Locale_PRINT) != 0 && iswprint(wc)) + ret |= _Locale_PRINT; + + if ((mask & _Locale_PUNCT) != 0 && iswpunct(wc)) + ret |= _Locale_PUNCT; + + if ((mask & _Locale_SPACE) != 0 && iswspace(wc)) + ret |= _Locale_SPACE; + + if ((mask & _Locale_XDIGIT) != 0 && iswxdigit(wc)) + ret |= _Locale_XDIGIT; + + if ((mask & _Locale_UPPER) != 0 && iswupper(wc)) + ret |= _Locale_UPPER; + + if ((mask & _Locale_LOWER) != 0 && iswlower(wc)) + ret |= _Locale_LOWER; + + return ret; +} + +wint_t _WLocale_tolower(struct _Locale_ctype *lctype, wint_t wc) +{ return towlower(wc); } + +wint_t _WLocale_toupper(struct _Locale_ctype *lctype, wint_t wc) +{ return towupper(wc); } + +int _WLocale_mb_cur_max (struct _Locale_codecvt *lcodecvt) { return 1; } +int _WLocale_mb_cur_min (struct _Locale_codecvt *lcodecvt) { return 1; } +int _WLocale_is_stateless (struct _Locale_codecvt *lcodecvt) { return 1; } + +size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt, + wchar_t *to, + const char *from, size_t n, + mbstate_t *st) +{ *to = *from; return 1; } + +size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt, + char *to, size_t n, + const wchar_t c, + mbstate_t *st) +{ *to = (char)c; return 1; } + +size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt, + mbstate_t *st, + char *buf, size_t n, char ** next) +{ *next = buf; return 0; } +#endif + +/* Collate */ + int _Locale_strcmp(struct _Locale_collate* lcol, + const char* s1, size_t n1, const char* s2, size_t n2) { + int ret = 0; + char buf1[64], buf2[64]; + while (n1 > 0 || n2 > 0) { + size_t bufsize1 = n1 < 63 ? n1 : 63; + size_t bufsize2 = n2 < 63 ? n2 : 63; + _STLP_STRNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0; + _STLP_STRNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0; + + ret = strcmp(buf1, buf2); + if (ret != 0) return ret < 0 ? -1 : 1; + s1 += bufsize1; n1 -= bufsize1; + s2 += bufsize2; n2 -= bufsize2; + } + return ret == 0 ? 0 : (ret < 0 ? -1 : 1); +} + +#ifndef _STLP_NO_WCHAR_T + +int _WLocale_strcmp(struct _Locale_collate* lcol, + const wchar_t* s1, size_t n1, const wchar_t* s2, size_t n2) { + int ret = 0; + wchar_t buf1[64], buf2[64]; + while (n1 > 0 || n2 > 0) { + size_t bufsize1 = n1 < 63 ? n1 : 63; + size_t bufsize2 = n2 < 63 ? n2 : 63; + _STLP_WCSNCPY(buf1, 64, s1, bufsize1); buf1[bufsize1] = 0; + _STLP_WCSNCPY(buf2, 64, s2, bufsize2); buf2[bufsize2] = 0; + + ret = wcscmp(buf1, buf2); + if (ret != 0) return ret < 0 ? -1 : 1; + s1 += bufsize1; n1 -= bufsize1; + s2 += bufsize2; n2 -= bufsize2; + } + return ret == 0 ? 0 : (ret < 0 ? -1 : 1); +} + +#endif + +size_t _Locale_strxfrm(struct _Locale_collate* lcol, + char* dest, size_t dest_n, + const char* src, size_t src_n) { + if (dest != 0) { + _STLP_STRNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0; + } + return src_n; +} + +#ifndef _STLP_NO_WCHAR_T + +size_t _WLocale_strxfrm(struct _Locale_collate* lcol, + wchar_t* dest, size_t dest_n, + const wchar_t* src, size_t src_n) { + if (dest != 0) { + _STLP_WCSNCPY(dest, dest_n, src, dest_n - 1); dest[dest_n - 1] = 0; + } + return src_n; +} + +#endif + +/* Numeric */ + +char _Locale_decimal_point(struct _Locale_numeric* lnum) +{ return '.'; } +char _Locale_thousands_sep(struct _Locale_numeric* lnum) +{ return ','; } +const char* _Locale_grouping(struct _Locale_numeric * lnum) +{ return _empty_str; } +const char * _Locale_true(struct _Locale_numeric * lnum) +{ return "true"; } +const char * _Locale_false(struct _Locale_numeric * lnum) +{ return "false"; } + +#ifndef _STLP_NO_WCHAR_T +wchar_t _WLocale_decimal_point(struct _Locale_numeric* lnum) +{ return L'.'; } +wchar_t _WLocale_thousands_sep(struct _Locale_numeric* lnum) +{ return L','; } +const wchar_t * _WLocale_true(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize) +{ return L"true"; } +const wchar_t * _WLocale_false(struct _Locale_numeric* lnum, wchar_t* buf, size_t bufSize) +{ return L"false"; } +#endif + +/* Monetary */ + +const char* _Locale_int_curr_symbol(struct _Locale_monetary * lmon) +{ return _empty_str; } +const char* _Locale_currency_symbol(struct _Locale_monetary * lmon) +{ return _empty_str; } +char _Locale_mon_decimal_point(struct _Locale_monetary * lmon) +{ return '.'; } +char _Locale_mon_thousands_sep(struct _Locale_monetary * lmon) +{ return ','; } +const char* _Locale_mon_grouping(struct _Locale_monetary * lmon) +{ return _empty_str; } +const char* _Locale_positive_sign(struct _Locale_monetary * lmon) +{ return _empty_str; } +const char* _Locale_negative_sign(struct _Locale_monetary * lmon) +{ return _empty_str; } +char _Locale_int_frac_digits(struct _Locale_monetary * lmon) +{ return 0; } +char _Locale_frac_digits(struct _Locale_monetary * lmon) +{ return 0; } +int _Locale_p_cs_precedes(struct _Locale_monetary * lmon) +{ return CHAR_MAX; } +int _Locale_p_sep_by_space(struct _Locale_monetary * lmon) +{ return CHAR_MAX; } +int _Locale_p_sign_posn(struct _Locale_monetary * lmon) +{ return CHAR_MAX; } +int _Locale_n_cs_precedes(struct _Locale_monetary * lmon) +{ return CHAR_MAX; } +int _Locale_n_sep_by_space(struct _Locale_monetary * lmon) +{ return CHAR_MAX; } +int _Locale_n_sign_posn(struct _Locale_monetary * lmon) +{ return CHAR_MAX; } + +#ifndef _STLP_NO_WCHAR_T +const wchar_t* _WLocale_int_curr_symbol(struct _Locale_monetary * lmon, + wchar_t* buf, size_t bufSize) +{ return _empty_wstr; } +const wchar_t* _WLocale_currency_symbol(struct _Locale_monetary * lmon, + wchar_t* buf, size_t bufSize) +{ return _empty_wstr; } +wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * lmon) +{ return L'.'; } +wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * lmon) +{ return L','; } +const wchar_t* _WLocale_positive_sign(struct _Locale_monetary * lmon, + wchar_t* buf, size_t bufSize) +{ return _empty_wstr; } +const wchar_t* _WLocale_negative_sign(struct _Locale_monetary * lmon, + wchar_t* buf, size_t bufSize) +{ return _empty_wstr; } +#endif + +/* Time */ +static const char* full_monthname[] = +{ "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" }; +const char * _Locale_full_monthname(struct _Locale_time * ltime, int n) +{ return full_monthname[n]; } + +static const char* abbrev_monthname[] = +{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; +const char * _Locale_abbrev_monthname(struct _Locale_time * ltime, int n) +{ return abbrev_monthname[n]; } + +static const char* full_dayname[] = +{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; +const char * _Locale_full_dayofweek(struct _Locale_time * ltime, int n) +{ return full_dayname[n]; } + +static const char* abbrev_dayname[] = +{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; +const char * _Locale_abbrev_dayofweek(struct _Locale_time * ltime, int n) +{ return abbrev_dayname[n]; } + +const char* _Locale_d_t_fmt(struct _Locale_time* ltime) +{ return "%m/%d/%y"; } +const char* _Locale_d_fmt(struct _Locale_time* ltime) +{ return "%m/%d/%y"; } +const char* _Locale_t_fmt(struct _Locale_time* ltime) +{ return "%H:%M:%S"; } +const char* _Locale_long_d_t_fmt(struct _Locale_time* ltime) +{ return _empty_str; } +const char* _Locale_long_d_fmt(struct _Locale_time* ltime) +{ return _empty_str; } +const char* _Locale_am_str(struct _Locale_time* ltime) +{ return "AM"; } +const char* _Locale_pm_str(struct _Locale_time* ltime) +{ return "PM"; } + +#ifndef _STLP_NO_WCHAR_T +static const wchar_t* full_wmonthname[] = +{ L"January", L"February", L"March", L"April", L"May", L"June", + L"July", L"August", L"September", L"October", L"November", L"December" }; +const wchar_t * _WLocale_full_monthname(struct _Locale_time * ltime, int n, + wchar_t* buf, size_t bufSize) +{ return full_wmonthname[n]; } + +static const wchar_t* abbrev_wmonthname[] = +{ L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun", + L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec" }; +const wchar_t * _WLocale_abbrev_monthname(struct _Locale_time * ltime, int n, + wchar_t* buf, size_t bufSize) +{ return abbrev_wmonthname[n]; } + +static const wchar_t* full_wdayname[] = +{ L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", L"Friday", L"Saturday" }; +const wchar_t * _WLocale_full_dayofweek(struct _Locale_time * ltime, int n, + wchar_t* buf, size_t bufSize) +{ return full_wdayname[n]; } + +static const wchar_t* abbrev_wdayname[] = +{ L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat" }; +const wchar_t * _WLocale_abbrev_dayofweek(struct _Locale_time * ltime, int n, + wchar_t* buf, size_t bufSize) +{ return abbrev_wdayname[n]; } + +const wchar_t* _WLocale_am_str(struct _Locale_time* ltime, + wchar_t* buf, size_t bufSize) +{ return L"AM"; } +const wchar_t* _WLocale_pm_str(struct _Locale_time* ltime, + wchar_t* buf, size_t bufSize) +{ return L"PM"; } +#endif + +/* Messages */ + +nl_catd_type _Locale_catopen(struct _Locale_messages* lmes, const char* name) +{ return -1; } +void _Locale_catclose(struct _Locale_messages* lmes, nl_catd_type cat) {} +const char* _Locale_catgets(struct _Locale_messages* lmes, nl_catd_type cat, + int setid, int msgid, const char *dfault) +{ return dfault; } diff --git a/sdk/tlibstdcxx/src/c_locale_glibc/c_locale_glibc2.c b/sdk/tlibstdcxx/src/c_locale_glibc/c_locale_glibc2.c new file mode 100644 index 0000000000..0cf8279d5b --- /dev/null +++ b/sdk/tlibstdcxx/src/c_locale_glibc/c_locale_glibc2.c @@ -0,0 +1,705 @@ +#include +#include +#include +#include +#include +#include +#include + +static const char *_empty_str = ""; +static const char *_C_name = "C"; + +static wchar_t* _ToWChar(const char* buf, wchar_t *wbuf, size_t wbufSize) { + wchar_t *wcur = wbuf; + wchar_t *wend = wbuf + wbufSize - 1; + for (; wcur != wend && *buf != 0; ++buf, ++wcur) + *wcur = *buf; + *wcur = 0; + return wbuf; +} + +#if 0 +struct _Locale_ctype +{ + locale_t __cloc; +}; + +struct _Locale_numeric +{ + locale_t __cloc; +}; + +struct _Locale_time +{ + locale_t __cloc; +}; + +struct _Locale_collate +{ + locale_t __cloc; +}; + +struct _Locale_monetary +{ + locale_t __cloc; +}; + +struct _Locale_messages +{ + locale_t __cloc; +}; +#endif + +void _Locale_init() +{} + +void _Locale_final() +{} + +struct _Locale_ctype *_Locale_ctype_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + *__err_code = _STLP_LOC_UNKNOWN_NAME; + return (struct _Locale_ctype*)newlocale(LC_CTYPE_MASK, nm, NULL); +} + +struct _Locale_codecvt *_Locale_codecvt_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + // Glibc do not support multibyte manipulation for the moment, it simply implements "C". + if (nm[0] == 'C' && nm[1] == 0) + { return (struct _Locale_codecvt*)0x01; } + *__err_code = _STLP_LOC_NO_PLATFORM_SUPPORT; return 0; +} + +struct _Locale_numeric *_Locale_numeric_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + *__err_code = _STLP_LOC_UNKNOWN_NAME; + return (struct _Locale_numeric*)newlocale(LC_NUMERIC_MASK, nm, NULL); +} + +struct _Locale_time *_Locale_time_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + *__err_code = _STLP_LOC_UNKNOWN_NAME; + return (struct _Locale_time*)newlocale(LC_TIME_MASK, nm, NULL); +} + +struct _Locale_collate *_Locale_collate_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + *__err_code = _STLP_LOC_UNKNOWN_NAME; + return (struct _Locale_collate*)newlocale(LC_COLLATE_MASK, nm, NULL); +} + +struct _Locale_monetary *_Locale_monetary_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + *__err_code = _STLP_LOC_UNKNOWN_NAME; + return (struct _Locale_monetary*)newlocale(LC_MONETARY_MASK, nm, NULL); +} + +struct _Locale_messages *_Locale_messages_create(const char *nm, struct _Locale_name_hint* hint, + int *__err_code) { + *__err_code = _STLP_LOC_UNKNOWN_NAME; + return (struct _Locale_messages*)newlocale(LC_MESSAGES_MASK, nm, NULL); +} + +/* + try to see locale category LC should be used from environment; + according POSIX, the order is + 1. LC_ALL + 2. category (LC_CTYPE, LC_NUMERIC, ... ) + 3. LANG + If set nothing, return "C" (this really implementation-specific). +*/ +static const char *_Locale_aux_default( const char *LC, char *nm ) +{ + char *name = getenv( "LC_ALL" ); + + if ( name != NULL && *name != 0 ) { + return name; + } + name = getenv( LC ); + if ( name != NULL && *name != 0 ) { + return name; + } + name = getenv( "LANG" ); + if ( name != NULL && *name != 0 ) { + return name; + } + + return _C_name; +} + +const char *_Locale_ctype_default( char *nm ) +{ + return _Locale_aux_default( "LC_CTYPE", nm ); +} + +const char *_Locale_numeric_default( char *nm ) +{ + return _Locale_aux_default( "LC_NUMERIC", nm ); +} + +const char *_Locale_time_default( char *nm ) +{ + return _Locale_aux_default( "LC_TIME", nm ); +} + +const char *_Locale_collate_default( char *nm ) +{ + return _Locale_aux_default( "LC_COLLATE", nm ); +} + +const char *_Locale_monetary_default( char *nm ) +{ + return _Locale_aux_default( "LC_MONETARY", nm ); +} + +const char *_Locale_messages_default( char *nm ) +{ + return _Locale_aux_default( "LC_MESSAGES", nm ); +} + +char const*_Locale_ctype_name( const struct _Locale_ctype *__loc, char *buf ) +{ + return ((locale_t)__loc)->__names[LC_CTYPE]; +} + +char const*_Locale_codecvt_name( const struct _Locale_codecvt *__loc, char *buf ) +{ + return _C_name; +} + +char const*_Locale_numeric_name( const struct _Locale_numeric *__loc, char *buf ) +{ + return ((locale_t)__loc)->__names[LC_NUMERIC]; +} + +char const*_Locale_time_name( const struct _Locale_time *__loc, char *buf ) +{ + return ((locale_t)__loc)->__names[LC_TIME]; +} + +char const*_Locale_collate_name( const struct _Locale_collate *__loc, char *buf ) +{ + return ((locale_t)__loc)->__names[LC_COLLATE]; +} + +char const*_Locale_monetary_name( const struct _Locale_monetary *__loc, char *buf ) +{ + return ((locale_t)__loc)->__names[LC_MONETARY]; +} + +char const*_Locale_messages_name( const struct _Locale_messages *__loc, char *buf ) +{ + return ((locale_t)__loc)->__names[LC_MESSAGES]; +} + +void _Locale_ctype_destroy( struct _Locale_ctype *__loc ) +{ freelocale((locale_t)__loc); } + +void _Locale_codecvt_destroy( struct _Locale_codecvt *__loc ) +{} + +void _Locale_numeric_destroy( struct _Locale_numeric *__loc ) +{ freelocale((locale_t)__loc); } + +void _Locale_time_destroy( struct _Locale_time *__loc ) +{ freelocale((locale_t)__loc); } + +void _Locale_collate_destroy( struct _Locale_collate *__loc ) +{ freelocale((locale_t)__loc); } + +void _Locale_monetary_destroy( struct _Locale_monetary *__loc ) +{ freelocale((locale_t)__loc); } + +void _Locale_messages_destroy( struct _Locale_messages* __loc ) +{ freelocale((locale_t)__loc); } + +/* + * locale loc expected either locale name indeed (platform-specific) + * or string like "LC_CTYPE=LocaleNameForCType;LC_NUMERIC=LocaleNameForNum;" + * + */ + +static char const*__Extract_locale_name( const char *loc, const char *category, char *buf ) +{ + char *expr; + size_t len_name; + + if( loc[0]=='L' && loc[1]=='C' && loc[2]=='_') { + expr = strstr( (char*)loc, category ); + if ( expr == NULL ) + return NULL; /* Category not found. */ + ++expr; + len_name = strcspn( expr, ";" ); + len_name = len_name >= _Locale_MAX_SIMPLE_NAME ? _Locale_MAX_SIMPLE_NAME - 1 : len_name; + strncpy( buf, expr, len_name ); + buf[len_name] = 0; + return buf; + } + return loc; +} + +char const*_Locale_extract_ctype_name(const char *loc, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return __Extract_locale_name( loc, "LC_CTYPE=", buf ); } + +char const*_Locale_extract_numeric_name(const char *loc, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return __Extract_locale_name( loc, "LC_NUMERIC=", buf ); } + +char const*_Locale_extract_time_name(const char *loc, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return __Extract_locale_name( loc, "LC_TIME=", buf ); } + +char const*_Locale_extract_collate_name(const char *loc, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return __Extract_locale_name( loc, "LC_COLLATE=", buf ); } + +char const*_Locale_extract_monetary_name(const char *loc, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return __Extract_locale_name( loc, "LC_MONETARY=", buf ); } + +char const*_Locale_extract_messages_name(const char *loc, char *buf, + struct _Locale_name_hint* hint, int *__err_code) +{ return __Extract_locale_name( loc, "LC_MESSAGES=", buf ); } + +struct _Locale_name_hint* _Locale_get_ctype_hint(struct _Locale_ctype* ctype) +{ return 0; } +struct _Locale_name_hint* _Locale_get_numeric_hint(struct _Locale_numeric* numeric) +{ return 0; } +struct _Locale_name_hint* _Locale_get_time_hint(struct _Locale_time* time) +{ return 0; } +struct _Locale_name_hint* _Locale_get_collate_hint(struct _Locale_collate* collate) +{ return 0; } +struct _Locale_name_hint* _Locale_get_monetary_hint(struct _Locale_monetary* monetary) +{ return 0; } +struct _Locale_name_hint* _Locale_get_messages_hint(struct _Locale_messages* messages) +{ return 0; } + +/* ctype */ + +const _Locale_mask_t *_Locale_ctype_table( struct _Locale_ctype *__loc ) +{ + /* return table with masks (upper, lower, alpha, etc.) */ + _STLP_STATIC_ASSERT( sizeof(_Locale_mask_t) == sizeof(((locale_t)__loc)->__ctype_b[0]) ) + return ((locale_t)__loc)->__ctype_b; +} + +int _Locale_toupper( struct _Locale_ctype *__loc, int c ) +{ return ((locale_t)__loc)->__ctype_toupper[c]; } + +int _Locale_tolower( struct _Locale_ctype *__loc, int c ) +{ return ((locale_t)__loc)->__ctype_tolower[c]; } + +#if !defined (_STLP_NO_WCHAR_T) +_Locale_mask_t _WLocale_ctype( struct _Locale_ctype *__loc, wint_t wc, _Locale_mask_t __mask ) +{ + _Locale_mask_t ret = 0; + if ((__mask & _Locale_ALPHA) != 0 && iswalpha_l(wc, (locale_t)__loc)) + ret |= _Locale_ALPHA; + + if ((__mask & _Locale_CNTRL) != 0 && iswcntrl_l(wc, (locale_t)__loc)) + ret |= _Locale_CNTRL; + + if ((__mask & _Locale_DIGIT) != 0 && iswdigit_l(wc, (locale_t)__loc)) + ret |= _Locale_DIGIT; + + if ((__mask & _Locale_PRINT) != 0 && iswprint_l(wc, (locale_t)__loc)) + ret |= _Locale_PRINT; + + if ((__mask & _Locale_PUNCT) != 0 && iswpunct_l(wc, (locale_t)__loc)) + ret |= _Locale_PUNCT; + + if ((__mask & _Locale_SPACE) != 0 && iswspace_l(wc, (locale_t)__loc)) + ret |= _Locale_SPACE; + + if ((__mask & _Locale_XDIGIT) != 0 && iswxdigit_l(wc, (locale_t)__loc)) + ret |= _Locale_XDIGIT; + + if ((__mask & _Locale_UPPER) != 0 && iswupper_l(wc, (locale_t)__loc)) + ret |= _Locale_UPPER; + + if ((__mask & _Locale_LOWER) != 0 && iswlower_l(wc, (locale_t)__loc)) + ret |= _Locale_LOWER; + + return ret; +} + +wint_t _WLocale_tolower( struct _Locale_ctype *__loc, wint_t c ) +{ + return towlower_l( c, ((locale_t)__loc) ); +} + +wint_t _WLocale_toupper( struct _Locale_ctype *__loc, wint_t c ) +{ + return towupper_l( c, ((locale_t)__loc) ); +} +#endif + +int _WLocale_mb_cur_max( struct _Locale_codecvt * lcodecvt) { return 1; } +int _WLocale_mb_cur_min( struct _Locale_codecvt * lcodecvt) { return 1; } +int _WLocale_is_stateless( struct _Locale_codecvt * lcodecvt) { return 1; } + +#if !defined (_STLP_NO_WCHAR_T) +size_t _WLocale_mbtowc(struct _Locale_codecvt *lcodecvt, + wchar_t *to, + const char *from, size_t n, + mbstate_t *st) +{ *to = *from; return 1; } + +size_t _WLocale_wctomb(struct _Locale_codecvt *lcodecvt, + char *to, size_t n, + const wchar_t c, + mbstate_t *st) +{ *to = (char)c; return 1; } +#endif + +size_t _WLocale_unshift(struct _Locale_codecvt *lcodecvt, + mbstate_t *st, + char *buf, size_t n, char ** next) +{ *next = buf; return 0; } + +/* Collate */ +int _Locale_strcmp(struct _Locale_collate * __loc, + const char *s1, size_t n1, + const char *s2, size_t n2) { + int ret = 0; + char buf1[64], buf2[64]; + while (n1 > 0 || n2 > 0) { + size_t bufsize1 = n1 < 63 ? n1 : 63; + size_t bufsize2 = n2 < 63 ? n2 : 63; + strncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0; + strncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0; + + ret = strcoll_l(buf1, buf2, (locale_t)__loc); + if (ret != 0) return ret; + s1 += bufsize1; n1 -= bufsize1; + s2 += bufsize2; n2 -= bufsize2; + } + return ret; +} + +#if !defined (_STLP_NO_WCHAR_T) +int _WLocale_strcmp(struct _Locale_collate *__loc, + const wchar_t *s1, size_t n1, + const wchar_t *s2, size_t n2) { + int ret = 0; + wchar_t buf1[64], buf2[64]; + while (n1 > 0 || n2 > 0) { + size_t bufsize1 = n1 < 63 ? n1 : 63; + size_t bufsize2 = n2 < 63 ? n2 : 63; + wcsncpy(buf1, s1, bufsize1); buf1[bufsize1] = 0; + wcsncpy(buf2, s2, bufsize2); buf2[bufsize2] = 0; + + ret = wcscoll_l(buf1, buf2, (locale_t)__loc); + if (ret != 0) return ret; + s1 += bufsize1; n1 -= bufsize1; + s2 += bufsize2; n2 -= bufsize2; + } + return ret; +} + +#endif + +size_t _Locale_strxfrm(struct _Locale_collate *__loc, + char *dest, size_t dest_n, + const char *src, size_t src_n ) +{ + const char *real_src; + char *buf = NULL; + size_t result; + + if (src_n == 0) + { + if (dest != NULL) dest[0] = 0; + return 0; + } + if (src[src_n] != 0) { + buf = malloc(src_n + 1); + strncpy(buf, src, src_n); + buf[src_n] = 0; + real_src = buf; + } + else + real_src = src; + result = strxfrm_l(dest, real_src, dest_n, (locale_t)__loc); + if (buf != NULL) free(buf); + return result; +} + +# ifndef _STLP_NO_WCHAR_T + +size_t _WLocale_strxfrm( struct _Locale_collate *__loc, + wchar_t *dest, size_t dest_n, + const wchar_t *src, size_t src_n ) +{ + const wchar_t *real_src; + wchar_t *buf = NULL; + size_t result; + + if (src_n == 0) + { + if (dest != NULL) dest[0] = 0; + return 0; + } + if (src[src_n] != 0) { + buf = malloc((src_n + 1) * sizeof(wchar_t)); + wcsncpy(buf, src, src_n); + buf[src_n] = 0; + real_src = buf; + } + else + real_src = src; + result = wcsxfrm_l(dest, real_src, dest_n, (locale_t)__loc); + if (buf != NULL) free(buf); + return result; +} + +# endif + +/* Numeric */ + +char _Locale_decimal_point(struct _Locale_numeric *__loc) +{ + return *(nl_langinfo_l(RADIXCHAR, (locale_t)__loc)); +} + +char _Locale_thousands_sep(struct _Locale_numeric *__loc) +{ + return *(nl_langinfo_l(THOUSEP, (locale_t)__loc)); +} + +const char* _Locale_grouping(struct _Locale_numeric *__loc) +{ + return (_Locale_thousands_sep(__loc) != 0 ) ? (nl_langinfo_l(GROUPING, (locale_t)__loc)) : _empty_str; +} + +const char *_Locale_true(struct _Locale_numeric *__loc) +{ + return nl_langinfo_l(YESSTR, (locale_t)__loc); +} + +const char *_Locale_false(struct _Locale_numeric *__loc) +{ + return nl_langinfo_l(NOSTR, (locale_t)__loc); +} + +#ifndef _STLP_NO_WCHAR_T +wchar_t _WLocale_decimal_point(struct _Locale_numeric *__loc) +{ return (wchar_t)_Locale_decimal_point(__loc); } +wchar_t _WLocale_thousands_sep(struct _Locale_numeric *__loc) +{ return (wchar_t)_Locale_thousands_sep(__loc); } +const wchar_t *_WLocale_true(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_true(__loc), buf, bufSize); } +const wchar_t *_WLocale_false(struct _Locale_numeric *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_false(__loc), buf, bufSize); } +#endif + +/* Monetary */ + +const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc) +{ + return nl_langinfo_l(INT_CURR_SYMBOL, (locale_t)__loc); +} + +const char *_Locale_currency_symbol(struct _Locale_monetary *__loc) +{ + return nl_langinfo_l(CURRENCY_SYMBOL, (locale_t)__loc); +} + +char _Locale_mon_decimal_point(struct _Locale_monetary * __loc) +{ + return *(nl_langinfo_l(MON_DECIMAL_POINT,(locale_t)__loc)); +} + +char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(MON_THOUSANDS_SEP, (locale_t)__loc)); +} + +#ifndef _STLP_NO_WCHAR_T +const wchar_t *_WLocale_int_curr_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_int_curr_symbol(__loc), buf, bufSize); } +const wchar_t *_WLocale_currency_symbol(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_currency_symbol(__loc), buf, bufSize); } +wchar_t _WLocale_mon_decimal_point(struct _Locale_monetary * __loc) +{ return (wchar_t)_Locale_mon_decimal_point(__loc); } +wchar_t _WLocale_mon_thousands_sep(struct _Locale_monetary * __loc) +{ return (wchar_t)_Locale_mon_thousands_sep(__loc); } +const wchar_t *_WLocale_positive_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_positive_sign(__loc), buf, bufSize); } +const wchar_t *_WLocale_negative_sign(struct _Locale_monetary *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_negative_sign(__loc), buf, bufSize); } +#endif + +const char *_Locale_mon_grouping(struct _Locale_monetary *__loc) +{ + return (_Locale_mon_thousands_sep( __loc ) != 0 ) ? nl_langinfo_l(MON_GROUPING, (locale_t)__loc) : _empty_str; +} + +const char *_Locale_positive_sign(struct _Locale_monetary *__loc) +{ + return nl_langinfo_l(POSITIVE_SIGN, (locale_t)__loc); +} + +const char *_Locale_negative_sign(struct _Locale_monetary *__loc) +{ + return nl_langinfo_l(NEGATIVE_SIGN, (locale_t)__loc); +} + +char _Locale_int_frac_digits(struct _Locale_monetary *__loc) +{ + /* We are forced to manually handled the "C" locale for consistency with + * the default implementation in STLport. */ + const char* lname = ((locale_t)__loc)->__names[LC_MONETARY]; + if (lname[0] == 'C' && lname[1] == 0) + return 0; + return *(nl_langinfo_l(INT_FRAC_DIGITS, (locale_t)__loc)); +} + +char _Locale_frac_digits(struct _Locale_monetary *__loc) +{ + /* We are forced to manually handled the "C" locale for consistency with + * the default implementation in STLport. */ + const char* lname = ((locale_t)__loc)->__names[LC_MONETARY]; + if (lname[0] == 'C' && lname[1] == 0) + return 0; + return *(nl_langinfo_l(FRAC_DIGITS, (locale_t)__loc)); +} + +/* 1 if currency_symbol precedes a positive value, 0 if succeeds */ +int _Locale_p_cs_precedes(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(P_CS_PRECEDES, (locale_t)__loc)); +} + +/* 1 if a space separates currency_symbol from a positive value. */ +int _Locale_p_sep_by_space(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(P_SEP_BY_SPACE, (locale_t)__loc)); +} + +/* + * 0 Parentheses surround the quantity and currency_symbol + * 1 The sign string precedes the quantity and currency_symbol + * 2 The sign string succeeds the quantity and currency_symbol. + * 3 The sign string immediately precedes the currency_symbol. + * 4 The sign string immediately succeeds the currency_symbol. + */ +int _Locale_p_sign_posn(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(P_SIGN_POSN, (locale_t)__loc)); +} + +/* 1 if currency_symbol precedes a negative value, 0 if succeeds */ +int _Locale_n_cs_precedes(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(N_CS_PRECEDES, (locale_t)__loc)); +} + +/* 1 if a space separates currency_symbol from a negative value. */ +int _Locale_n_sep_by_space(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(N_SEP_BY_SPACE, (locale_t)__loc)); +} + +/* + * 0 Parentheses surround the quantity and currency_symbol + * 1 The sign string precedes the quantity and currency_symbol + * 2 The sign string succeeds the quantity and currency_symbol. + * 3 The sign string immediately precedes the currency_symbol. + * 4 The sign string immediately succeeds the currency_symbol. + */ +int _Locale_n_sign_posn(struct _Locale_monetary *__loc) +{ + return *(nl_langinfo_l(N_SIGN_POSN, (locale_t)__loc)); +} + + +/* Time */ +const char *_Locale_full_monthname(struct _Locale_time *__loc, int _m ) +{ + return nl_langinfo_l(MON_1 + _m, (locale_t)__loc); +} + +const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m ) +{ + return nl_langinfo_l(ABMON_1 + _m, (locale_t)__loc); +} + +const char *_Locale_full_dayofweek(struct _Locale_time *__loc, int _d ) +{ + return nl_langinfo_l(DAY_1 + _d, (locale_t)__loc); +} + +const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d ) +{ + return nl_langinfo_l(ABDAY_1 + _d, (locale_t)__loc); +} + +const char *_Locale_d_t_fmt(struct _Locale_time *__loc) +{ + return nl_langinfo_l(D_T_FMT, (locale_t)__loc); +} + +const char *_Locale_d_fmt(struct _Locale_time *__loc ) +{ + return nl_langinfo_l(D_FMT, (locale_t)__loc); +} + +const char *_Locale_t_fmt(struct _Locale_time *__loc ) +{ + return nl_langinfo_l(T_FMT, (locale_t)__loc); +} + +const char *_Locale_long_d_t_fmt(struct _Locale_time *__loc ) +{ + return nl_langinfo_l(ERA_D_T_FMT, (locale_t)__loc); +} + +const char *_Locale_long_d_fmt(struct _Locale_time *__loc ) +{ + return nl_langinfo_l(ERA_D_FMT, (locale_t)__loc); +} + +const char *_Locale_am_str(struct _Locale_time *__loc ) +{ + return nl_langinfo_l(AM_STR, (locale_t)__loc); +} + +const char *_Locale_pm_str(struct _Locale_time* __loc ) +{ + return nl_langinfo_l(PM_STR, (locale_t)__loc); +} + +#ifndef _STLP_NO_WCHAR_T +const wchar_t *_WLocale_full_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_full_monthname(__loc, _m), buf, bufSize); } +const wchar_t *_WLocale_abbrev_monthname(struct _Locale_time *__loc, int _m, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_abbrev_monthname(__loc, _m), buf, bufSize); } +const wchar_t *_WLocale_full_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_full_dayofweek(__loc, _d), buf, bufSize); } +const wchar_t *_WLocale_abbrev_dayofweek(struct _Locale_time *__loc, int _d, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_abbrev_dayofweek(__loc, _d), buf, bufSize); } +const wchar_t *_WLocale_am_str(struct _Locale_time *__loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_am_str(__loc), buf, bufSize); } +const wchar_t *_WLocale_pm_str(struct _Locale_time* __loc, wchar_t *buf, size_t bufSize) +{ return _ToWChar(_Locale_pm_str(__loc), buf, bufSize); } +#endif + +/* Messages */ + +nl_catd_type _Locale_catopen(struct _Locale_messages *__loc, const char *__cat_name ) +{ + return catopen( __cat_name, NL_CAT_LOCALE ); +} + +void _Locale_catclose(struct _Locale_messages *__loc, nl_catd_type __cat ) +{ + catclose( __cat ); +} + +const char *_Locale_catgets(struct _Locale_messages *__loc, nl_catd_type __cat, + int __setid, int __msgid, const char *dfault) +{ + return catgets( __cat, __setid, __msgid, dfault ); +} diff --git a/sdk/tlibstdcxx/src/codecvt.cpp b/sdk/tlibstdcxx/src/codecvt.cpp new file mode 100644 index 0000000000..113a262340 --- /dev/null +++ b/sdk/tlibstdcxx/src/codecvt.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// codecvt + +codecvt::~codecvt() {} + +int codecvt::do_length(state_type&, + const char* from, + const char* end, + size_t mx) const +{ return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); } + +int codecvt::do_max_length() const _STLP_NOTHROW +{ return 1; } + +bool +codecvt::do_always_noconv() const _STLP_NOTHROW +{ return true; } + +int +codecvt::do_encoding() const _STLP_NOTHROW +{ return 1; } + +codecvt_base::result +codecvt::do_unshift(state_type& /* __state */, + char* __to, + char* /* __to_limit */, + char*& __to_next) const +{ __to_next = __to; return noconv; } + +codecvt_base::result +codecvt::do_in (state_type& /* __state */ , + const char* __from, + const char* /* __from_end */, + const char*& __from_next, + char* __to, + char* /* __to_end */, + char*& __to_next) const +{ __from_next = __from; __to_next = __to; return noconv; } + +codecvt_base::result +codecvt::do_out(state_type& /* __state */, + const char* __from, + const char* /* __from_end */, + const char*& __from_next, + char* __to, + char* /* __to_limit */, + char*& __to_next) const +{ __from_next = __from; __to_next = __to; return noconv; } + + +#if !defined (_STLP_NO_WCHAR_T) +//---------------------------------------------------------------------- +// codecvt + +codecvt::~codecvt() {} + + +codecvt::result +codecvt::do_out(state_type& /* state */, + const intern_type* from, + const intern_type* from_end, + const intern_type*& from_next, + extern_type* to, + extern_type* to_limit, + extern_type*& to_next) const { + ptrdiff_t len = (min) (from_end - from, to_limit - to); + copy(from, from + len, to); + from_next = from + len; + to_next = to + len; + return ok; +} + +codecvt::result +codecvt::do_in (state_type& /* state */, + const extern_type* from, + const extern_type* from_end, + const extern_type*& from_next, + intern_type* to, + intern_type* to_limit, + intern_type*& to_next) const { + ptrdiff_t len = (min) (from_end - from, to_limit - to); + copy(__REINTERPRET_CAST(const unsigned char*, from), + __REINTERPRET_CAST(const unsigned char*, from) + len, to); + from_next = from + len; + to_next = to + len; + return ok; +} + +codecvt::result +codecvt::do_unshift(state_type& /* state */, + extern_type* to, + extern_type* , + extern_type*& to_next) const { + to_next = to; + return noconv; +} + +int codecvt::do_encoding() const _STLP_NOTHROW +{ return 1; } + +bool codecvt::do_always_noconv() const _STLP_NOTHROW +{ return true; } + +int codecvt::do_length(state_type&, + const extern_type* from, + const extern_type* end, + size_t mx) const +{ return (int)(min) ((size_t) (end - from), mx); } + +int codecvt::do_max_length() const _STLP_NOTHROW +{ return 1; } +#endif /* wchar_t */ + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/src/collate.cpp b/sdk/tlibstdcxx/src/collate.cpp new file mode 100644 index 0000000000..ee5540dfed --- /dev/null +++ b/sdk/tlibstdcxx/src/collate.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include + +_STLP_BEGIN_NAMESPACE + +// collate + +collate::~collate() {} + +int collate::do_compare(const char* low1, const char* high1, + const char* low2, const char* high2) const +{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); } + +string collate::do_transform(const char* low, const char* high) const +{ return string(low, high); } + +long collate::do_hash(const char* low, const char* high) const { + unsigned long result = 0; + for ( ; low < high; ++low) + result = 5 * result + *low; + return result; +} + +#if !defined (_STLP_NO_WCHAR_T) +// collate + +collate::~collate() {} + +int +collate::do_compare(const wchar_t* low1, const wchar_t* high1, + const wchar_t* low2, const wchar_t* high2) const +{ return _STLP_PRIV __lexicographical_compare_3way(low1, high1, low2, high2); } + +wstring collate::do_transform(const wchar_t* low, const wchar_t* high) const +{ return wstring(low, high); } + +long collate::do_hash(const wchar_t* low, const wchar_t* high) const { + unsigned long result = 0; + for ( ; low < high; ++low) + result = 5 * result + *low; + return result; +} +#endif + +_STLP_END_NAMESPACE + + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/src/complex.cpp b/sdk/tlibstdcxx/src/complex.cpp new file mode 100644 index 0000000000..50f310ca5a --- /dev/null +++ b/sdk/tlibstdcxx/src/complex.cpp @@ -0,0 +1,347 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include +#include + +#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB >= 1400) +// hypot is deprecated. +# if defined (_STLP_MSVC) +# pragma warning (disable : 4996) +# elif defined (__ICL) +# pragma warning (disable : 1478) +# endif +#endif + +_STLP_BEGIN_NAMESPACE + +// Complex division and square roots. + +// Absolute value +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC float _STLP_CALL abs(const complex& __z) +{ return ::hypot(__z._M_re, __z._M_im); } +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC double _STLP_CALL abs(const complex& __z) +{ return ::hypot(__z._M_re, __z._M_im); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC long double _STLP_CALL abs(const complex& __z) +{ return ::hypot(__z._M_re, __z._M_im); } +#endif + +// Phase + +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC float _STLP_CALL arg(const complex& __z) +{ return ::atan2(__z._M_im, __z._M_re); } + +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC double _STLP_CALL arg(const complex& __z) +{ return ::atan2(__z._M_im, __z._M_re); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC long double _STLP_CALL arg(const complex& __z) +{ return ::atan2(__z._M_im, __z._M_re); } +#endif + +// Construct a complex number from polar representation +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const float& __rho, const float& __phi) +{ return complex(__rho * ::cos(__phi), __rho * ::sin(__phi)); } +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const double& __rho, const double& __phi) +{ return complex(__rho * ::cos(__phi), __rho * ::sin(__phi)); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const long double& __rho, const long double& __phi) +{ return complex(__rho * ::cos(__phi), __rho * ::sin(__phi)); } +#endif + +// Division +template +static void _divT(const _Tp& __z1_r, const _Tp& __z1_i, + const _Tp& __z2_r, const _Tp& __z2_i, + _Tp& __res_r, _Tp& __res_i) { + _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r; + _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i; + + if (__ar <= __ai) { + _Tp __ratio = __z2_r / __z2_i; + _Tp __denom = __z2_i * (1 + __ratio * __ratio); + __res_r = (__z1_r * __ratio + __z1_i) / __denom; + __res_i = (__z1_i * __ratio - __z1_r) / __denom; + } + else { + _Tp __ratio = __z2_i / __z2_r; + _Tp __denom = __z2_r * (1 + __ratio * __ratio); + __res_r = (__z1_r + __z1_i * __ratio) / __denom; + __res_i = (__z1_i - __z1_r * __ratio) / __denom; + } +} + +template +static void _divT(const _Tp& __z1_r, + const _Tp& __z2_r, const _Tp& __z2_i, + _Tp& __res_r, _Tp& __res_i) { + _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r; + _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i; + + if (__ar <= __ai) { + _Tp __ratio = __z2_r / __z2_i; + _Tp __denom = __z2_i * (1 + __ratio * __ratio); + __res_r = (__z1_r * __ratio) / __denom; + __res_i = - __z1_r / __denom; + } + else { + _Tp __ratio = __z2_i / __z2_r; + _Tp __denom = __z2_r * (1 + __ratio * __ratio); + __res_r = __z1_r / __denom; + __res_i = - (__z1_r * __ratio) / __denom; + } +} + +void _STLP_CALL +complex::_div(const float& __z1_r, const float& __z1_i, + const float& __z2_r, const float& __z2_i, + float& __res_r, float& __res_i) +{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); } + +void _STLP_CALL +complex::_div(const float& __z1_r, + const float& __z2_r, const float& __z2_i, + float& __res_r, float& __res_i) +{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); } + + +void _STLP_CALL +complex::_div(const double& __z1_r, const double& __z1_i, + const double& __z2_r, const double& __z2_i, + double& __res_r, double& __res_i) +{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); } + +void _STLP_CALL +complex::_div(const double& __z1_r, + const double& __z2_r, const double& __z2_i, + double& __res_r, double& __res_i) +{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +void _STLP_CALL +complex::_div(const long double& __z1_r, const long double& __z1_i, + const long double& __z2_r, const long double& __z2_i, + long double& __res_r, long double& __res_i) +{ _divT(__z1_r, __z1_i, __z2_r, __z2_i, __res_r, __res_i); } + +void _STLP_CALL +complex::_div(const long double& __z1_r, + const long double& __z2_r, const long double& __z2_i, + long double& __res_r, long double& __res_i) +{ _divT(__z1_r, __z2_r, __z2_i, __res_r, __res_i); } +#endif + +//---------------------------------------------------------------------- +// Square root +template +static complex<_Tp> sqrtT(const complex<_Tp>& z) { + _Tp re = z._M_re; + _Tp im = z._M_im; + _Tp mag = ::hypot(re, im); + complex<_Tp> result; + + if (mag == 0.f) { + result._M_re = result._M_im = 0.f; + } else if (re > 0.f) { + result._M_re = ::sqrt(0.5f * (mag + re)); + result._M_im = im/result._M_re/2.f; + } else { + result._M_im = ::sqrt(0.5f * (mag - re)); + if (im < 0.f) + result._M_im = - result._M_im; + result._M_re = im/result._M_im/2.f; + } + return result; +} + +complex _STLP_CALL +sqrt(const complex& z) { return sqrtT(z); } + +complex _STLP_CALL +sqrt(const complex& z) { return sqrtT(z); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +complex _STLP_CALL +sqrt(const complex& z) { return sqrtT(z); } +#endif + +// exp, log, pow for complex, complex, and complex +//---------------------------------------------------------------------- +// exp +template +static complex<_Tp> expT(const complex<_Tp>& z) { + _Tp expx = ::exp(z._M_re); + return complex<_Tp>(expx * ::cos(z._M_im), + expx * ::sin(z._M_im)); +} +_STLP_DECLSPEC complex _STLP_CALL exp(const complex& z) +{ return expT(z); } + +_STLP_DECLSPEC complex _STLP_CALL exp(const complex& z) +{ return expT(z); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL exp(const complex& z) +{ return expT(z); } +#endif + +//---------------------------------------------------------------------- +// log10 +template +static complex<_Tp> log10T(const complex<_Tp>& z, const _Tp& ln10_inv) { + complex<_Tp> r; + + r._M_im = ::atan2(z._M_im, z._M_re) * ln10_inv; + r._M_re = ::log10(::hypot(z._M_re, z._M_im)); + return r; +} + +static const float LN10_INVF = 1.f / ::log(10.f); +_STLP_DECLSPEC complex _STLP_CALL log10(const complex& z) +{ return log10T(z, LN10_INVF); } + +static const double LN10_INV = 1. / ::log10(10.); +_STLP_DECLSPEC complex _STLP_CALL log10(const complex& z) +{ return log10T(z, LN10_INV); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +static const long double LN10_INVL = 1.l / ::log(10.l); +_STLP_DECLSPEC complex _STLP_CALL log10(const complex& z) +{ return log10T(z, LN10_INVL); } +#endif + +//---------------------------------------------------------------------- +// log +template +static complex<_Tp> logT(const complex<_Tp>& z) { + complex<_Tp> r; + + r._M_im = ::atan2(z._M_im, z._M_re); + r._M_re = ::log(::hypot(z._M_re, z._M_im)); + return r; +} +_STLP_DECLSPEC complex _STLP_CALL log(const complex& z) +{ return logT(z); } + +_STLP_DECLSPEC complex _STLP_CALL log(const complex& z) +{ return logT(z); } + +#ifndef _STLP_NO_LONG_DOUBLE +_STLP_DECLSPEC complex _STLP_CALL log(const complex& z) +{ return logT(z); } +# endif + +//---------------------------------------------------------------------- +// pow +template +static complex<_Tp> powT(const _Tp& a, const complex<_Tp>& b) { + _Tp logr = ::log(a); + _Tp x = ::exp(logr * b._M_re); + _Tp y = logr * b._M_im; + + return complex<_Tp>(x * ::cos(y), x * ::sin(y)); +} + +template +static complex<_Tp> powT(const complex<_Tp>& z_in, int n) { + complex<_Tp> z = z_in; + z = _STLP_PRIV __power(z, (n < 0 ? -n : n), multiplies< complex<_Tp> >()); + if (n < 0) + return _Tp(1.0) / z; + else + return z; +} + +template +static complex<_Tp> powT(const complex<_Tp>& a, const _Tp& b) { + _Tp logr = ::log(::hypot(a._M_re,a._M_im)); + _Tp logi = ::atan2(a._M_im, a._M_re); + _Tp x = ::exp(logr * b); + _Tp y = logi * b; + + return complex<_Tp>(x * ::cos(y), x * ::sin(y)); +} + +template +static complex<_Tp> powT(const complex<_Tp>& a, const complex<_Tp>& b) { + _Tp logr = ::log(::hypot(a._M_re,a._M_im)); + _Tp logi = ::atan2(a._M_im, a._M_re); + _Tp x = ::exp(logr * b._M_re - logi * b._M_im); + _Tp y = logr * b._M_im + logi * b._M_re; + + return complex<_Tp>(x * ::cos(y), x * ::sin(y)); +} + +_STLP_DECLSPEC complex _STLP_CALL pow(const float& a, const complex& b) +{ return powT(a, b); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& z_in, int n) +{ return powT(z_in, n); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& a, const float& b) +{ return powT(a, b); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& a, const complex& b) +{ return powT(a, b); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const double& a, const complex& b) +{ return powT(a, b); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& z_in, int n) +{ return powT(z_in, n); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& a, const double& b) +{ return powT(a, b); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& a, const complex& b) +{ return powT(a, b); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL pow(const long double& a, + const complex& b) +{ return powT(a, b); } + + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& z_in, int n) +{ return powT(z_in, n); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& a, + const long double& b) +{ return powT(a, b); } + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex& a, + const complex& b) +{ return powT(a, b); } +#endif + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/complex_io.cpp b/sdk/tlibstdcxx/src/complex_io.cpp new file mode 100644 index 0000000000..4cb6636f63 --- /dev/null +++ b/sdk/tlibstdcxx/src/complex_io.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include + +_STLP_BEGIN_NAMESPACE + +// Specializations for narrow characters; lets us avoid the nuisance of +// widening. +_STLP_OPERATOR_SPEC +basic_ostream >& _STLP_CALL +operator<< (basic_ostream >& __os, const complex& __z) +{ return __os << '(' << (double)__z.real() << ',' << (double)__z.imag() << ')'; } + +_STLP_OPERATOR_SPEC +basic_ostream >& _STLP_CALL +operator<< (basic_ostream >& __os, const complex& __z) +{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; } + +#ifndef _STLP_NO_LONG_DOUBLE +_STLP_OPERATOR_SPEC +basic_ostream >& _STLP_CALL +operator<< (basic_ostream >& __os, const complex& __z) +{ return __os << '(' << __z.real() << ',' << __z.imag() << ')'; } +#endif + +// Specialization for narrow characters; lets us avoid widen. +_STLP_OPERATOR_SPEC +basic_istream >& _STLP_CALL +operator>>(basic_istream >& __is, complex& __z) { + float __re = 0; + float __im = 0; + + char __c; + + __is >> __c; + if (__c == '(') { + __is >> __re >> __c; + if (__c == ',') + __is >> __im >> __c; + if (__c != ')') + __is.setstate(ios_base::failbit); + } + else { + __is.putback(__c); + __is >> __re; + } + + if (__is) + __z = complex(__re, __im); + return __is; +} + +_STLP_OPERATOR_SPEC +basic_istream >& _STLP_CALL +operator>>(basic_istream >& __is, complex& __z) { + double __re = 0; + double __im = 0; + + char __c; + + __is >> __c; + if (__c == '(') { + __is >> __re >> __c; + if (__c == ',') + __is >> __im >> __c; + if (__c != ')') + __is.setstate(ios_base::failbit); + } + else { + __is.putback(__c); + __is >> __re; + } + + if (__is) + __z = complex(__re, __im); + return __is; +} + +#ifndef _STLP_NO_LONG_DOUBLE +_STLP_OPERATOR_SPEC +basic_istream >& _STLP_CALL +operator>>(basic_istream >& __is, complex& __z) { + long double __re = 0; + long double __im = 0; + + char __c; + + __is >> __c; + if (__c == '(') { + __is >> __re >> __c; + if (__c == ',') + __is >> __im >> __c; + if (__c != ')') + __is.setstate(ios_base::failbit); + } + else { + __is.putback(__c); + __is >> __re; + } + + if (__is) + __z = complex(__re, __im); + return __is; +} +#endif + +// Force instantiation of complex I/O functions +#if !(defined (_STLP_NO_FORCE_INSTANTIATE) || defined (_STLP_NO_WCHAR_T)) + +_STLP_OPERATOR_SPEC basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); + +_STLP_OPERATOR_SPEC basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); + +#ifndef _STLP_NO_LONG_DOUBLE +_STLP_OPERATOR_SPEC basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); + +_STLP_OPERATOR_SPEC basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); +#endif + +_STLP_OPERATOR_SPEC basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); + +_STLP_OPERATOR_SPEC basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); + +#endif /* _STLP_NO_WCHAR_T */ + +_STLP_END_NAMESPACE + + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/src/complex_trig.cpp b/sdk/tlibstdcxx/src/complex_trig.cpp new file mode 100644 index 0000000000..f566fe9913 --- /dev/null +++ b/sdk/tlibstdcxx/src/complex_trig.cpp @@ -0,0 +1,192 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + + +// Trigonometric and hyperbolic functions for complex, +// complex, and complex +#include +#include +#include + +_STLP_BEGIN_NAMESPACE + + +//---------------------------------------------------------------------- +// helpers +#if defined (__sgi) + static const union { unsigned int i; float f; } float_ulimit = { 0x42b2d4fc }; + static const float float_limit = float_ulimit.f; + static union { + struct { unsigned int h; unsigned int l; } w; + double d; + } double_ulimit = { 0x408633ce, 0x8fb9f87d }; + static const double double_limit = double_ulimit.d; + static union { + struct { unsigned int h[2]; unsigned int l[2]; } w; + long double ld; + } ldouble_ulimit = {0x408633ce, 0x8fb9f87e, 0xbd23b659, 0x4e9bd8b1}; +# if !defined (_STLP_NO_LONG_DOUBLE) + static const long double ldouble_limit = ldouble_ulimit.ld; +# endif +#else +# if defined (M_LN2) && defined (FLT_MAX_EXP) + static const float float_limit = float(M_LN2 * FLT_MAX_EXP); + static const double double_limit = M_LN2 * DBL_MAX_EXP; +# else + static const float float_limit = ::log(FLT_MAX); + static const double double_limit = ::log(DBL_MAX); +# endif +# if !defined (_STLP_NO_LONG_DOUBLE) +# if defined (M_LN2l) + static const long double ldouble_limit = M_LN2l * LDBL_MAX_EXP; +# else + static const long double ldouble_limit = ::log(LDBL_MAX); +# endif +# endif +#endif + + +//---------------------------------------------------------------------- +// sin +template +static complex<_Tp> sinT(const complex<_Tp>& z) { + return complex<_Tp>(::sin(z._M_re) * ::cosh(z._M_im), + ::cos(z._M_re) * ::sinh(z._M_im)); +} + +_STLP_DECLSPEC complex _STLP_CALL sin(const complex& z) +{ return sinT(z); } + +_STLP_DECLSPEC complex _STLP_CALL sin(const complex& z) +{ return sinT(z); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL sin(const complex& z) +{ return sinT(z); } +#endif + +//---------------------------------------------------------------------- +// cos +template +static complex<_Tp> cosT(const complex<_Tp>& z) { + return complex<_Tp>(::cos(z._M_re) * ::cosh(z._M_im), + -::sin(z._M_re) * ::sinh(z._M_im)); +} + +_STLP_DECLSPEC complex _STLP_CALL cos(const complex& z) +{ return cosT(z); } + +_STLP_DECLSPEC complex _STLP_CALL cos(const complex& z) +{ return cosT(z); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL cos(const complex& z) +{ return cosT(z); } +#endif + +//---------------------------------------------------------------------- +// tan +template +static complex<_Tp> tanT(const complex<_Tp>& z, const _Tp& Tp_limit) { + _Tp re2 = 2.f * z._M_re; + _Tp im2 = 2.f * z._M_im; + + if (::abs(im2) > Tp_limit) + return complex<_Tp>(0.f, (im2 > 0 ? 1.f : -1.f)); + else { + _Tp den = ::cos(re2) + ::cosh(im2); + return complex<_Tp>(::sin(re2) / den, ::sinh(im2) / den); + } +} + +_STLP_DECLSPEC complex _STLP_CALL tan(const complex& z) +{ return tanT(z, float_limit); } + +_STLP_DECLSPEC complex _STLP_CALL tan(const complex& z) +{ return tanT(z, double_limit); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL tan(const complex& z) +{ return tanT(z, ldouble_limit); } +#endif + +//---------------------------------------------------------------------- +// sinh +template +static complex<_Tp> sinhT(const complex<_Tp>& z) { + return complex<_Tp>(::sinh(z._M_re) * ::cos(z._M_im), + ::cosh(z._M_re) * ::sin(z._M_im)); +} + +_STLP_DECLSPEC complex _STLP_CALL sinh(const complex& z) +{ return sinhT(z); } + +_STLP_DECLSPEC complex _STLP_CALL sinh(const complex& z) +{ return sinhT(z); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL sinh(const complex& z) +{ return sinhT(z); } +#endif + +//---------------------------------------------------------------------- +// cosh +template +static complex<_Tp> coshT(const complex<_Tp>& z) { + return complex<_Tp>(::cosh(z._M_re) * ::cos(z._M_im), + ::sinh(z._M_re) * ::sin(z._M_im)); +} + +_STLP_DECLSPEC complex _STLP_CALL cosh(const complex& z) +{ return coshT(z); } + +_STLP_DECLSPEC complex _STLP_CALL cosh(const complex& z) +{ return coshT(z); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL cosh(const complex& z) +{ return coshT(z); } +#endif + +//---------------------------------------------------------------------- +// tanh +template +static complex<_Tp> tanhT(const complex<_Tp>& z, const _Tp& Tp_limit) { + _Tp re2 = 2.f * z._M_re; + _Tp im2 = 2.f * z._M_im; + if (::abs(re2) > Tp_limit) + return complex<_Tp>((re2 > 0 ? 1.f : -1.f), 0.f); + else { + _Tp den = ::cosh(re2) + ::cos(im2); + return complex<_Tp>(::sinh(re2) / den, ::sin(im2) / den); + } +} + +_STLP_DECLSPEC complex _STLP_CALL tanh(const complex& z) +{ return tanhT(z, float_limit); } + +_STLP_DECLSPEC complex _STLP_CALL tanh(const complex& z) +{ return tanhT(z, double_limit); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL tanh(const complex& z) +{ return tanhT(z, ldouble_limit); } +#endif + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/ctype.cpp b/sdk/tlibstdcxx/src/ctype.cpp new file mode 100644 index 0000000000..b1e84b1568 --- /dev/null +++ b/sdk/tlibstdcxx/src/ctype.cpp @@ -0,0 +1,486 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include +#include + +#include "c_locale.h" + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// ctype + +// The classic table: static data members. + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) +//*TY 02/25/2000 - added workaround for MPW compilers; they confuse on in-class static const +const size_t ctype::table_size; +#endif + +// This macro is specifically for platforms where isprint() relies +// on separate flag + +const ctype_base::mask* +ctype::classic_table() _STLP_NOTHROW { + /* Ctype table for the ASCII character set. */ + static const ctype_base::mask _S_classic_table[table_size] = { + cntrl /* null */, + cntrl /* ^A */, + cntrl /* ^B */, + cntrl /* ^C */, + cntrl /* ^D */, + cntrl /* ^E */, + cntrl /* ^F */, + cntrl /* ^G */, + cntrl /* ^H */, + ctype_base::mask(space | cntrl) /* tab */, + ctype_base::mask(space | cntrl) /* LF */, + ctype_base::mask(space | cntrl) /* ^K */, + ctype_base::mask(space | cntrl) /* FF */, + ctype_base::mask(space | cntrl) /* ^M */, + cntrl /* ^N */, + cntrl /* ^O */, + cntrl /* ^P */, + cntrl /* ^Q */, + cntrl /* ^R */, + cntrl /* ^S */, + cntrl /* ^T */, + cntrl /* ^U */, + cntrl /* ^V */, + cntrl /* ^W */, + cntrl /* ^X */, + cntrl /* ^Y */, + cntrl /* ^Z */, + cntrl /* esc */, + cntrl /* ^\ */, + cntrl /* ^] */, + cntrl /* ^^ */, + cntrl /* ^_ */, + ctype_base::mask(space | print) /* */, + ctype_base::mask(punct | print) /* ! */, + ctype_base::mask(punct | print) /* " */, + ctype_base::mask(punct | print) /* # */, + ctype_base::mask(punct | print) /* $ */, + ctype_base::mask(punct | print) /* % */, + ctype_base::mask(punct | print) /* & */, + ctype_base::mask(punct | print) /* ' */, + ctype_base::mask(punct | print) /* ( */, + ctype_base::mask(punct | print) /* ) */, + ctype_base::mask(punct | print) /* * */, + ctype_base::mask(punct | print) /* + */, + ctype_base::mask(punct | print) /* , */, + ctype_base::mask(punct | print) /* - */, + ctype_base::mask(punct | print) /* . */, + ctype_base::mask(punct | print) /* / */, + ctype_base::mask(digit | print | xdigit) /* 0 */, + ctype_base::mask(digit | print | xdigit) /* 1 */, + ctype_base::mask(digit | print | xdigit) /* 2 */, + ctype_base::mask(digit | print | xdigit) /* 3 */, + ctype_base::mask(digit | print | xdigit) /* 4 */, + ctype_base::mask(digit | print | xdigit) /* 5 */, + ctype_base::mask(digit | print | xdigit) /* 6 */, + ctype_base::mask(digit | print | xdigit) /* 7 */, + ctype_base::mask(digit | print | xdigit) /* 8 */, + ctype_base::mask(digit | print | xdigit) /* 9 */, + ctype_base::mask(punct | print) /* : */, + ctype_base::mask(punct | print) /* ; */, + ctype_base::mask(punct | print) /* < */, + ctype_base::mask(punct | print) /* = */, + ctype_base::mask(punct | print) /* > */, + ctype_base::mask(punct | print) /* ? */, + ctype_base::mask(punct | print) /* ! */, + ctype_base::mask(alpha | print | upper | xdigit) /* A */, + ctype_base::mask(alpha | print | upper | xdigit) /* B */, + ctype_base::mask(alpha | print | upper | xdigit) /* C */, + ctype_base::mask(alpha | print | upper | xdigit) /* D */, + ctype_base::mask(alpha | print | upper | xdigit) /* E */, + ctype_base::mask(alpha | print | upper | xdigit) /* F */, + ctype_base::mask(alpha | print | upper) /* G */, + ctype_base::mask(alpha | print | upper) /* H */, + ctype_base::mask(alpha | print | upper) /* I */, + ctype_base::mask(alpha | print | upper) /* J */, + ctype_base::mask(alpha | print | upper) /* K */, + ctype_base::mask(alpha | print | upper) /* L */, + ctype_base::mask(alpha | print | upper) /* M */, + ctype_base::mask(alpha | print | upper) /* N */, + ctype_base::mask(alpha | print | upper) /* O */, + ctype_base::mask(alpha | print | upper) /* P */, + ctype_base::mask(alpha | print | upper) /* Q */, + ctype_base::mask(alpha | print | upper) /* R */, + ctype_base::mask(alpha | print | upper) /* S */, + ctype_base::mask(alpha | print | upper) /* T */, + ctype_base::mask(alpha | print | upper) /* U */, + ctype_base::mask(alpha | print | upper) /* V */, + ctype_base::mask(alpha | print | upper) /* W */, + ctype_base::mask(alpha | print | upper) /* X */, + ctype_base::mask(alpha | print | upper) /* Y */, + ctype_base::mask(alpha | print | upper) /* Z */, + ctype_base::mask(punct | print) /* [ */, + ctype_base::mask(punct | print) /* \ */, + ctype_base::mask(punct | print) /* ] */, + ctype_base::mask(punct | print) /* ^ */, + ctype_base::mask(punct | print) /* _ */, + ctype_base::mask(punct | print) /* ` */, + ctype_base::mask(alpha | print | lower | xdigit) /* a */, + ctype_base::mask(alpha | print | lower | xdigit) /* b */, + ctype_base::mask(alpha | print | lower | xdigit) /* c */, + ctype_base::mask(alpha | print | lower | xdigit) /* d */, + ctype_base::mask(alpha | print | lower | xdigit) /* e */, + ctype_base::mask(alpha | print | lower | xdigit) /* f */, + ctype_base::mask(alpha | print | lower) /* g */, + ctype_base::mask(alpha | print | lower) /* h */, + ctype_base::mask(alpha | print | lower) /* i */, + ctype_base::mask(alpha | print | lower) /* j */, + ctype_base::mask(alpha | print | lower) /* k */, + ctype_base::mask(alpha | print | lower) /* l */, + ctype_base::mask(alpha | print | lower) /* m */, + ctype_base::mask(alpha | print | lower) /* n */, + ctype_base::mask(alpha | print | lower) /* o */, + ctype_base::mask(alpha | print | lower) /* p */, + ctype_base::mask(alpha | print | lower) /* q */, + ctype_base::mask(alpha | print | lower) /* r */, + ctype_base::mask(alpha | print | lower) /* s */, + ctype_base::mask(alpha | print | lower) /* t */, + ctype_base::mask(alpha | print | lower) /* u */, + ctype_base::mask(alpha | print | lower) /* v */, + ctype_base::mask(alpha | print | lower) /* w */, + ctype_base::mask(alpha | print | lower) /* x */, + ctype_base::mask(alpha | print | lower) /* y */, + ctype_base::mask(alpha | print | lower) /* z */, + ctype_base::mask(punct | print) /* { */, + ctype_base::mask(punct | print) /* | */, + ctype_base::mask(punct | print) /* } */, + ctype_base::mask(punct | print) /* ~ */, + cntrl /* del (0x7f)*/, + /* ASCII is a 7-bit code, so everything else is non-ASCII */ + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), + ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0), ctype_base::mask(0) + }; + return _S_classic_table; +} + +// For every c in the range 0 <= c < 256, _S_upper[c] is the +// uppercased version of c and _S_lower[c] is the lowercased +// version. As before, these two tables assume the ASCII character +// set. + +const unsigned char _S_upper[ctype::table_size] = +{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +const unsigned char _S_lower[ctype::table_size] = +{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +//An helper struct to check wchar_t index without generating warnings +//under some compilers (gcc) because of a limited range of value +//(when wchar_t is unsigned) +template +struct _WCharIndexT; + +#if !(defined (__BORLANDC__) && !defined(__linux__)) && \ + !(defined (__GNUC__) && (defined (__MINGW32__) || defined (__CYGWIN__))) && \ + !defined (__ICL) +_STLP_TEMPLATE_NULL +struct _WCharIndexT { + static bool in_range(wchar_t c, size_t upperBound) { + return c >= 0 && size_t(c) < upperBound; + } +}; +#endif + +_STLP_TEMPLATE_NULL +struct _WCharIndexT { + static bool in_range(wchar_t c, size_t upperBound) { + return size_t(c) < upperBound; + } +}; + +typedef _WCharIndexT _WCharIndex; + +// Some helper functions used in ctype<>::scan_is and scan_is_not. + +struct _Ctype_is_mask : public unary_function { + ctype_base::mask _Mask; + const ctype_base::mask* _M_table; + + _Ctype_is_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {} + bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) != 0; } +}; + +struct _Ctype_not_mask : public unary_function { + ctype_base::mask _Mask; + const ctype_base::mask* _M_table; + + _Ctype_not_mask(ctype_base::mask __m, const ctype_base::mask* __t) : _Mask(__m), _M_table(__t) {} + bool operator()(char __c) const { return (_M_table[(unsigned char) __c] & _Mask) == 0; } +}; + +ctype::ctype(const ctype_base::mask * __tab, bool __del, size_t __refs) : + locale::facet(__refs), + _M_ctype_table(__tab ? __tab : classic_table()), + _M_delete(__tab && __del) +{} + +ctype::~ctype() { + if (_M_delete) + delete[] __CONST_CAST(ctype_base::mask *, _M_ctype_table); +} + +const char* +#if defined (__DMC__) +_STLP_DECLSPEC +#endif +ctype::scan_is(ctype_base::mask __m, const char* __low, const char* __high) const +{ return _STLP_STD::find_if(__low, __high, _Ctype_is_mask(__m, _M_ctype_table)); } + +const char* +#if defined (__DMC__) +_STLP_DECLSPEC +#endif +ctype::scan_not(ctype_base::mask __m, const char* __low, const char* __high) const +{ return _STLP_STD::find_if(__low, __high, _Ctype_not_mask(__m, _M_ctype_table)); } + +char ctype::do_toupper(char __c) const +{ return (char) _S_upper[(unsigned char) __c]; } +char ctype::do_tolower(char __c) const +{ return (char) _S_lower[(unsigned char) __c]; } + +const char* ctype::do_toupper(char* __low, const char* __high) const { + for ( ; __low < __high; ++__low) + *__low = (char) _S_upper[(unsigned char) *__low]; + return __high; +} +const char* ctype::do_tolower(char* __low, const char* __high) const { + for ( ; __low < __high; ++__low) + *__low = (char) _S_lower[(unsigned char) *__low]; + return __high; +} + +char +ctype::do_widen(char __c) const { return __c; } + +const char* +ctype::do_widen(const char* __low, const char* __high, + char* __to) const { + _STLP_PRIV __copy_trivial(__low, __high, __to); + return __high; +} +char +ctype::do_narrow(char __c, char /* dfault */ ) const { return __c; } +const char* +ctype::do_narrow(const char* __low, const char* __high, + char /* dfault */, char* __to) const { + _STLP_PRIV __copy_trivial(__low, __high, __to); + return __high; +} + + +#if !defined (_STLP_NO_WCHAR_T) + +struct _Ctype_w_is_mask : public unary_function { + ctype_base::mask M; + const ctype_base::mask* table; + + _Ctype_w_is_mask(ctype_base::mask m, const ctype_base::mask* t) + : M(m), table(t) {} + bool operator()(wchar_t c) const + { return _WCharIndex::in_range(c, ctype::table_size) && (table[c] & M); } +}; + +//---------------------------------------------------------------------- +// ctype + +ctype::~ctype() {} + + +bool ctype::do_is(ctype_base::mask m, wchar_t c) const { + const ctype_base::mask * table = ctype::classic_table(); + return _WCharIndex::in_range(c, ctype::table_size) && (m & table[c]); +} + +const wchar_t* ctype::do_is(const wchar_t* low, const wchar_t* high, + ctype_base::mask * vec) const { + // boris : not clear if this is the right thing to do... + const ctype_base::mask * table = ctype::classic_table(); + wchar_t c; + for ( ; low < high; ++low, ++vec) { + c = *low; + *vec = _WCharIndex::in_range(c, ctype::table_size) ? table[c] : ctype_base::mask(0); + } + return high; +} + +const wchar_t* +ctype::do_scan_is(ctype_base::mask m, + const wchar_t* low, const wchar_t* high) const { + return find_if(low, high, _Ctype_w_is_mask(m, ctype::classic_table())); +} + + +const wchar_t* +ctype::do_scan_not(ctype_base::mask m, + const wchar_t* low, const wchar_t* high) const { + return find_if(low, high, not1(_Ctype_w_is_mask(m, ctype::classic_table()))); +} + +wchar_t ctype::do_toupper(wchar_t c) const { + return _WCharIndex::in_range(c, ctype::table_size) ? (wchar_t)_S_upper[c] + : c; +} + +const wchar_t* +ctype::do_toupper(wchar_t* low, const wchar_t* high) const { + for ( ; low < high; ++low) { + wchar_t c = *low; + *low = _WCharIndex::in_range(c, ctype::table_size) ? (wchar_t)_S_upper[c] + : c; + } + return high; +} + +wchar_t ctype::do_tolower(wchar_t c) const { + return _WCharIndex::in_range(c, ctype::table_size) ? (wchar_t)_S_lower[c] + : c; +} + +const wchar_t* +ctype::do_tolower(wchar_t* low, const wchar_t* high) const { + for ( ; low < high; ++low) { + wchar_t c = *low; + *low = _WCharIndex::in_range(c, ctype::table_size) ? (wchar_t)_S_lower[c] + : c; + } + return high; +} + +wchar_t ctype::do_widen(char c) const { + return (wchar_t)(unsigned char)c; +} + +const char* +ctype::do_widen(const char* low, const char* high, + wchar_t* dest) const { + while (low != high) + *dest++ = (wchar_t)(unsigned char)*low++; + return high; +} + +char ctype::do_narrow(wchar_t c, char dfault) const +{ return (unsigned char)c == c ? (char)c : dfault; } + +const wchar_t* ctype::do_narrow(const wchar_t* low, + const wchar_t* high, + char dfault, char* dest) const { + while (low != high) { + wchar_t c = *low++; + *dest++ = (unsigned char)c == c ? (char)c : dfault; + } + + return high; +} + +# endif +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/src/cxa.c b/sdk/tlibstdcxx/src/cxa.c new file mode 100644 index 0000000000..998170e0f1 --- /dev/null +++ b/sdk/tlibstdcxx/src/cxa.c @@ -0,0 +1,198 @@ +#include "stlport_prefix.h" + +#if defined(__unix) && defined(__GNUC__) + +#ifdef __FreeBSD__ +# include +#endif + +#if (defined(__FreeBSD__) && (__FreeBSD_version < 503001)) || defined(__sun) || defined (__hpux) +/* Note: __cxa_finalize and __cxa_atexit present in libc in FreeBSD 5.3 */ + +#include +#include +#include + +/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@" "STLPORT_5_0_0"); */ +/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */ + +/* Not atomic! */ +/* But we can use static mutexes here: I hope that performance issue isn't very + significant on unloading (for only few calls, ~10) - ptr */ + +/* +#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ + ({ __typeof (mem) __gmemp = (mem); \ + __typeof (*mem) __gnewval = (newval); \ + \ + *__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; }) +*/ + +enum { + ef_free, /* `ef_free' MUST be zero! */ + ef_us, + ef_on, + ef_at, + ef_cxa +}; + +struct exit_function +{ + /* `flavour' should be of type of the `enum' above but since we need + this element in an atomic operation we have to use `long int'. */ + long int flavor; + union { + void (*at)(void); + struct { + void (*fn)(int status, void *arg); + void *arg; + } on; + struct { + void (*fn)(void *arg, int status); + void *arg; + void *dso_handle; + } cxa; + } func; +}; + +struct exit_function_list +{ + struct exit_function_list *next; + size_t idx; + struct exit_function fns[32]; +}; + +struct exit_function *__new_exitfn (void); + +/* Register a function to be called by exit or when a shared library + is unloaded. This function is only called from code generated by + the C++ compiler. */ +int __cxa_atexit(void (*func)(void *), void *arg, void *d) +{ + struct exit_function *new = __new_exitfn (); + + if ( new == NULL ) + return -1; + + new->flavor = ef_cxa; + new->func.cxa.fn = (void (*) (void *, int)) func; + new->func.cxa.arg = arg; + new->func.cxa.dso_handle = d; + return 0; +} + + +/* We change global data, so we need locking. */ +#ifdef __linux__ +static pthread_mutex_t lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +#endif +/* #ifdef __FreeBSD__ */ +#if 0 +static pthread_mutex_t lock = + { PTHREAD_MUTEX_RECURSIVE /* PTHREAD_MUTEX_DEFAULT */, PTHREAD_PRIO_NONE, {NULL,NULL}, + NULL, { NULL }, /* MUTEX_FLAGS_PRIVATE */ 0x1, 0, 0, 0, {NULL, NULL}, + { 0, 0, 0, 0 } }; +#endif +#ifdef __sun +static pthread_mutex_t lock = + {{0, 0, 0, PTHREAD_MUTEX_RECURSIVE, _MUTEX_MAGIC}, {{{0}}}, 0}; +#endif +#ifdef __hpux +static pthread_mutex_t lock = PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP; +# ifdef __ia64 +void *__dso_handle = (void *) &__dso_handle; +# endif +#endif + + +static struct exit_function_list initial; +struct exit_function_list *__exit_funcs = &initial; + +struct exit_function *__new_exitfn(void) +{ + struct exit_function_list *l; + size_t i = 0; + +#ifndef __FreeBSD__ + pthread_mutex_lock( &lock ); +#endif + + for (l = __exit_funcs; l != NULL; l = l->next) { + for (i = 0; i < l->idx; ++i) + if (l->fns[i].flavor == ef_free) + break; + if ( i < l->idx ) + break; + + if (l->idx < sizeof (l->fns) / sizeof (l->fns[0])) { + i = l->idx++; + break; + } + } + + if (l == NULL) { + l = (struct exit_function_list *)malloc( sizeof(struct exit_function_list) ); + if (l != NULL) { + l->next = __exit_funcs; + __exit_funcs = l; + + l->idx = 1; + i = 0; + } + } + + /* Mark entry as used, but we don't know the flavor now. */ + if ( l != NULL ) + l->fns[i].flavor = ef_us; + +#ifndef __FreeBSD__ + pthread_mutex_unlock( &lock ); +#endif + + return l == NULL ? NULL : &l->fns[i]; +} + +/* If D is non-NULL, call all functions registered with `__cxa_atexit' + with the same dso handle. Otherwise, if D is NULL, call all of the + registered handlers. */ + +/* + * Note, that original __cxa_finalize don't use lock, but use __exit_funcs + * i.e. global data. + */ +void __cxa_finalize(void *d) +{ + struct exit_function_list *funcs; + +#ifndef __FreeBSD__ + pthread_mutex_lock( &lock ); +#endif + + for (funcs = __exit_funcs; funcs; funcs = funcs->next) { + struct exit_function *f; + + for (f = &funcs->fns[funcs->idx - 1]; f >= &funcs->fns[0]; --f) { + if ( (d == NULL || d == f->func.cxa.dso_handle) && (f->flavor == ef_cxa) ) { + f->flavor = ef_free; + (*f->func.cxa.fn) (f->func.cxa.arg, 0); + } + } + } + + /* Remove the registered fork handlers. We do not have to + unregister anything if the program is going to terminate anyway. */ +#ifdef UNREGISTER_ATFORK + if (d != NULL) + UNREGISTER_ATFORK (d); +#endif +#ifndef __FreeBSD__ + pthread_mutex_unlock( &lock ); +#endif +} + +/* __asm__ (".symver " "__cxa_finalize" "," "__cxa_finalize" "@@" "STLPORT_5_0_0"); */ +/* void __cxa_finalize(void *d) __attribute__ ((weak)); */ + +#endif /* OS name */ +#endif /* __unix */ + diff --git a/sdk/tlibstdcxx/src/details/fstream_stdio.cpp b/sdk/tlibstdcxx/src/details/fstream_stdio.cpp new file mode 100644 index 0000000000..8392ffdebc --- /dev/null +++ b/sdk/tlibstdcxx/src/details/fstream_stdio.cpp @@ -0,0 +1,387 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if defined (__SUNPPRO_CC) && !defined (_STLP_NO_NEW_C_HEADERS) +# include +// For sunpro, it chokes if time.h is included through stat.h +#endif + +#include + +#ifdef __CYGWIN__ +# define __int64 long long +#endif + +#include +#if !defined(__ISCPP__) +extern "C" { +# include +} +#endif + +#if defined( __MSL__ ) +# include +#endif + +#if defined(__ISCPP__) +# include +#endif + +#if defined(__BEOS__) && defined(__INTEL__) +# include +# include // For _fstat +#endif + +#if defined (_STLP_MSVC) || defined (__MINGW32__) +# include +# define S_IREAD _S_IREAD +# define S_IWRITE _S_IWRITE +# define S_IFREG _S_IFREG + // map permission masks +# ifndef S_IRUSR +# define S_IRUSR _S_IREAD +# define S_IWUSR _S_IWRITE +# endif +# ifndef S_IRGRP +# define S_IRGRP _S_IREAD +# define S_IWGRP _S_IWRITE +# endif +# ifndef S_IROTH +# define S_IROTH _S_IREAD +# define S_IWOTH _S_IWRITE +# endif + +# ifndef O_RDONLY +# define O_RDONLY _O_RDONLY +# define O_WRONLY _O_WRONLY +# define O_RDWR _O_RDWR +# define O_APPEND _O_APPEND +# define O_CREAT _O_CREAT +# define O_TRUNC _O_TRUNC +# define O_TEXT _O_TEXT +# define O_BINARY _O_BINARY +# endif + +# ifndef O_ACCMODE +# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +# endif +#endif + +const _STLP_fd INVALID_STLP_FD = -1; + + +# ifdef __MSL__ +# define _O_TEXT 0x0 +# if !defined( O_TEXT ) +# define O_TEXT _O_TEXT +# endif +# define _S_IFREG S_IFREG +# define S_IREAD S_IRUSR +# define S_IWRITE S_IWUSR +# define S_IEXEC S_IXUSR +# define _S_IWRITE S_IWRITE +# define _S_IREAD S_IREAD +# define _open open +# define _close close +# define _read read +# define _write write +# endif + +_STLP_BEGIN_NAMESPACE + +// Compare with streamoff definition in stl/char_traits.h! + +#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \ + (!defined(_LARGEFILE_SOURCE) && !defined(_LARGEFILE64_SOURCE)) +# define FOPEN fopen +# define FSEEK fseek +# define FSTAT fstat +# define STAT stat +# define FTELL ftell +#else +# define FOPEN fopen64 +# define FSEEK fseeko64 +# define FSTAT fstat64 +# define STAT stat64 +# define FTELL ftello64 +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Helper functions for _Filebuf_base. + +static bool __is_regular_file(_STLP_fd fd) { + struct STAT buf; + return FSTAT(fd, &buf) == 0 && (buf.st_mode & S_IFREG) != 0 ; +} + +// Number of characters in the file. +static streamoff __file_size(_STLP_fd fd) { + streamoff ret = 0; + + struct STAT buf; + if (FSTAT(fd, &buf) == 0 && (buf.st_mode & S_IFREG) != 0) + ret = buf.st_size > 0 ? buf.st_size : 0; + + return ret; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +// All version of Unix have mmap and lseek system calls. Some also have +// longer versions of those system calls to accommodate 64-bit offsets. +// If we're on a Unix system, define some macros to encapsulate those +// differences. + +size_t _Filebuf_base::_M_page_size = 4096; + +_Filebuf_base::_Filebuf_base() + : _M_file_id(INVALID_STLP_FD), + _M_openmode(0), + _M_is_open(false), + _M_should_close(false) +{} + +void _Filebuf_base::_S_initialize() +{ + +} + +// Return the size of the file. This is a wrapper for stat. +// Returns zero if the size cannot be determined or is ill-defined. +streamoff _Filebuf_base::_M_file_size() +{ + return _STLP_PRIV __file_size(_M_file_id); +} + +bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode, + long permission) +{ + _STLP_fd file_no; + + if (_M_is_open) + return false; + + // use FILE-based i/o + const char* flags; + + switch (openmode & (~ios_base::ate)) { + case ios_base::out: + case ios_base::out | ios_base::trunc: + flags = "w"; + break; + + case ios_base::out | ios_base::binary: + case ios_base::out | ios_base::trunc | ios_base::binary: + flags = "wb"; + break; + + case ios_base::out | ios_base::app: + flags = "a"; + break; + + case ios_base::out | ios_base::app | ios_base::binary: + flags = "ab"; + break; + + case ios_base::in: + flags = "r"; + break; + + case ios_base::in | ios_base::binary: + flags = "rb"; + break; + + case ios_base::in | ios_base::out: + flags = "r+"; + break; + + case ios_base::in | ios_base::out | ios_base::binary: + flags = "r+b"; + break; + + case ios_base::in | ios_base::out | ios_base::trunc: + flags = "w+"; + break; + + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: + flags = "w+b"; + break; + + default: // The above are the only combinations of + return false; // flags allowed by the C++ standard. + } + + // fbp : TODO : set permissions ! + (void)permission; // currently unused //*TY 02/26/2000 - added to suppress warning message + _M_file = FOPEN(name, flags); + + if (_M_file) { + file_no = fileno(_M_file); + } else { + return false; + } + + // unset buffering immediately + setbuf(_M_file, 0); + + _M_is_open = true; + + if (openmode & ios_base::ate) { + if (FSEEK(_M_file, 0, SEEK_END) != 0) + _M_is_open = false; + } + + _M_file_id = file_no; + _M_should_close = _M_is_open; + _M_openmode = openmode; + + if (_M_is_open) + _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id); + + return (_M_is_open != 0); +} + + +bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode) +{ + // This doesn't really grant everyone in the world read/write + // access. On Unix, file-creation system calls always clear + // bits that are set in the umask from the permissions flag. + return this->_M_open(name, openmode, S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH); +} + +// Associated the filebuf with a file descriptor pointing to an already- +// open file. Mode is set to be consistent with the way that the file +// was opened. +bool _Filebuf_base::_M_open( int file_no, ios_base::openmode ) +{ + if (_M_is_open || file_no < 0) + return false; + + struct STAT buf; + if (FSTAT(file_no, &buf) != 0) + return false; + int mode = buf.st_mode; + + switch ( mode & (S_IWRITE | S_IREAD) ) { + case S_IREAD: + _M_openmode = ios_base::in; + break; + case S_IWRITE: + _M_openmode = ios_base::out; + break; + case (S_IWRITE | S_IREAD): + _M_openmode = ios_base::in | ios_base::out; + break; + default: + return false; + } + _M_file_id = file_no; + _M_is_open = true; + _M_should_close = false; + _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id); + return true; +} + +bool _Filebuf_base::_M_close() +{ + if (!_M_is_open) + return false; + + bool ok = _M_should_close ? (fclose(_M_file) == 0) : true; + + _M_is_open = _M_should_close = false; + _M_openmode = 0; + return ok; +} + +// Read up to n characters into a buffer. Return value is number of +// characters read. +ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n) { + return fread(buf, 1, n, _M_file); +} + +// Write n characters from a buffer. Return value: true if we managed +// to write the entire buffer, false if we didn't. +bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n) +{ + for (;;) { + ptrdiff_t written = fwrite(buf, 1, n, _M_file); + + if (n == written) { + return true; + } + + if (written > 0 && written < n) { + n -= written; + buf += written; + } else { + return false; + } + } +} + +// Wrapper for lseek or the like. +streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir) +{ + int whence; + + switch ( dir ) { + case ios_base::beg: + if (offset < 0 /* || offset > _M_file_size() */ ) + return streamoff(-1); + whence = SEEK_SET; + break; + case ios_base::cur: + whence = SEEK_CUR; + break; + case ios_base::end: + if (/* offset > 0 || */ -offset > _M_file_size() ) + return streamoff(-1); + whence = SEEK_END; + break; + default: + return streamoff(-1); + } + + if ( FSEEK(_M_file, offset, whence) == 0 ) { + return FTELL(_M_file); + } + + return streamoff(-1); +} + + +// Attempts to memory-map len bytes of the current file, starting +// at position offset. Precondition: offset is a multiple of the +// page size. Postcondition: return value is a null pointer if the +// memory mapping failed. Otherwise the return value is a pointer to +// the memory-mapped file and the file position is set to offset. +void *_Filebuf_base::_M_mmap(streamoff, streamoff ) +{ + return 0; +} + +void _Filebuf_base::_M_unmap(void*, streamoff) +{ + // precondition : there is a valid mapping at the moment +} + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/details/fstream_unistd.cpp b/sdk/tlibstdcxx/src/details/fstream_unistd.cpp new file mode 100644 index 0000000000..744088302f --- /dev/null +++ b/sdk/tlibstdcxx/src/details/fstream_unistd.cpp @@ -0,0 +1,347 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if defined (__SUNPPRO_CC) && !defined (_STLP_NO_NEW_C_HEADERS) +# include +// For sunpro, it chokes if time.h is included through stat.h +#endif + +#include + +#ifdef __CYGWIN__ +# define __int64 long long +#endif + +extern "C" { +// open/close/read/write +#include // For stat +#if !defined (_CRAY) && ! defined (__EMX__) +# include // For mmap +#endif + +// on HP-UX 11, this one contradicts with pthread.h on pthread_atfork, unless we unset this +#if defined (__hpux) && defined (__GNUC__) +# undef _INCLUDE_POSIX1C_SOURCE +#endif + +#include +#include +} + +#ifdef __APPLE__ +# include +#endif + +const _STLP_fd INVALID_STLP_FD = -1; + +#ifndef O_ACCMODE +# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#endif + +// Compare with streamoff definition in stl/char_traits.h! +#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \ + (!defined(_LARGEFILE_SOURCE) && !defined (_LARGEFILE64_SOURCE)) +# define FSTAT fstat +# define STAT stat +# define LSEEK lseek +# define MMAP mmap +# define OPEN open +#else +# define FSTAT fstat64 +# define STAT stat64 +# define LSEEK lseek64 +# define MMAP mmap64 +# define OPEN open64 +#endif + +#ifndef MAP_FAILED /* MMAP failure return code */ +# define MAP_FAILED -1 +#endif + +_STLP_BEGIN_NAMESPACE + +static ios_base::openmode flag_to_openmode(int mode) +{ + ios_base::openmode ret = ios_base::__default_mode; + + switch ( mode & O_ACCMODE ) { + case O_RDONLY: + ret = ios_base::in; + break; + case O_WRONLY: + ret = ios_base::out; + break; + case O_RDWR: + ret = ios_base::in | ios_base::out; + break; + } + + if ( mode & O_APPEND ) + ret |= ios_base::app; + + return ret; +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Helper functions for _Filebuf_base. + +static bool __is_regular_file(_STLP_fd fd) { + struct STAT buf; + return FSTAT(fd, &buf) == 0 && S_ISREG(buf.st_mode); +} + +// Number of characters in the file. +static streamoff __file_size(_STLP_fd fd) { + streamoff ret = 0; + + struct STAT buf; + if (FSTAT(fd, &buf) == 0 && S_ISREG(buf.st_mode)) + ret = buf.st_size > 0 ? buf.st_size : 0; + + return ret; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +size_t _Filebuf_base::_M_page_size = 4096; + +_Filebuf_base::_Filebuf_base() + : _M_file_id(INVALID_STLP_FD), + _M_openmode(0), + _M_is_open(false), + _M_should_close(false) +{} + +void _Filebuf_base::_S_initialize() +{ +#if defined (__APPLE__) + int mib[2]; + size_t pagesize, len; + mib[0] = CTL_HW; + mib[1] = HW_PAGESIZE; + len = sizeof(pagesize); + sysctl(mib, 2, &pagesize, &len, NULL, 0); + _M_page_size = pagesize; +#elif defined (__DJGPP) && defined (_CRAY) + _M_page_size = BUFSIZ; +#else + _M_page_size = sysconf(_SC_PAGESIZE); +#endif +} + +// Return the size of the file. This is a wrapper for stat. +// Returns zero if the size cannot be determined or is ill-defined. +streamoff _Filebuf_base::_M_file_size() +{ + return _STLP_PRIV __file_size(_M_file_id); +} + +bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode, + long permission) +{ + _STLP_fd file_no; + + if (_M_is_open) + return false; + + int flags = 0; + + // Unix makes no distinction between text and binary files. + switch ( openmode & (~ios_base::ate & ~ios_base::binary) ) { + case ios_base::out: + case ios_base::out | ios_base::trunc: + flags = O_WRONLY | O_CREAT | O_TRUNC; + break; + case ios_base::app: + case ios_base::out | ios_base::app: + flags = O_WRONLY | O_CREAT | O_APPEND; + break; + case ios_base::in: + flags = O_RDONLY; + permission = 0; // Irrelevant unless we're writing. + break; + case ios_base::in | ios_base::out: + flags = O_RDWR; + break; + case ios_base::in | ios_base::out | ios_base::trunc: + flags = O_RDWR | O_CREAT | O_TRUNC; + break; + case ios_base::in | ios_base::app: + case ios_base::in | ios_base::out | ios_base::app: + flags = O_RDWR | O_CREAT | O_APPEND; + break; + default: // The above are the only combinations of + return false; // flags allowed by the C++ standard. + } + + file_no = OPEN(name, flags, permission); + + if (file_no < 0) + return false; + + _M_is_open = true; + + if ((openmode & (ios_base::ate | ios_base::app)) && (LSEEK(file_no, 0, SEEK_END) == -1)) { + _M_is_open = false; + } + + _M_file_id = file_no; + _M_should_close = _M_is_open; + _M_openmode = openmode; + + if (_M_is_open) + _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id); + + return (_M_is_open != 0); +} + + +bool _Filebuf_base::_M_open(const char* name, ios_base::openmode openmode) +{ + // This doesn't really grant everyone in the world read/write + // access. On Unix, file-creation system calls always clear + // bits that are set in the umask from the permissions flag. + return this->_M_open(name, openmode, S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH); +} + +// Associated the filebuf with a file descriptor pointing to an already- +// open file. Mode is set to be consistent with the way that the file +// was opened. +bool _Filebuf_base::_M_open(int file_no, ios_base::openmode) +{ + if (_M_is_open || file_no < 0) + return false; + + int mode = fcntl(file_no, F_GETFL); + + if (mode == -1) + return false; + + _M_openmode = flag_to_openmode(mode); + _M_file_id = file_no; + + _M_is_open = true; + _M_should_close = false; + _M_regular_file = _STLP_PRIV __is_regular_file(_M_file_id); + return true; +} + +bool _Filebuf_base::_M_close() +{ + if (!_M_is_open) + return false; + + bool ok = _M_should_close ? (close(_M_file_id) == 0) : true; + + _M_is_open = _M_should_close = false; + _M_openmode = 0; + return ok; +} + +// Read up to n characters into a buffer. Return value is number of +// characters read. +ptrdiff_t _Filebuf_base::_M_read(char* buf, ptrdiff_t n) +{ + return read(_M_file_id, buf, n); +} + +// Write n characters from a buffer. Return value: true if we managed +// to write the entire buffer, false if we didn't. +bool _Filebuf_base::_M_write(char* buf, ptrdiff_t n) +{ + for (;;) { + ptrdiff_t written = write(_M_file_id, buf, n); + + if (n == written) { + return true; + } + + if (written > 0 && written < n) { + n -= written; + buf += written; + } else { + return false; + } + } +} + +// Wrapper for lseek or the like. +streamoff _Filebuf_base::_M_seek(streamoff offset, ios_base::seekdir dir) +{ + int whence; + + switch ( dir ) { + case ios_base::beg: + if (offset < 0 /* || offset > _M_file_size() */ ) + return streamoff(-1); + whence = SEEK_SET; + break; + case ios_base::cur: + whence = SEEK_CUR; + break; + case ios_base::end: + if (/* offset > 0 || */ -offset > _M_file_size() ) + return streamoff(-1); + whence = SEEK_END; + break; + default: + return streamoff(-1); + } + + return LSEEK(_M_file_id, offset, whence); +} + +// Attempts to memory-map len bytes of the current file, starting +// at position offset. Precondition: offset is a multiple of the +// page size. Postcondition: return value is a null pointer if the +// memory mapping failed. Otherwise the return value is a pointer to +// the memory-mapped file and the file position is set to offset. +void* _Filebuf_base::_M_mmap(streamoff offset, streamoff len) +{ + void* base; +#if !defined (__DJGPP) && !defined (_CRAY) + base = MMAP(0, len, PROT_READ, MAP_PRIVATE, _M_file_id, offset); + if (base != (void*)MAP_FAILED) { + if (LSEEK(_M_file_id, offset + len, SEEK_SET) < 0) { + this->_M_unmap(base, len); + base = 0; + } + } else + base =0; +#else + _STLP_MARK_PARAMETER_AS_UNUSED(&offset) + _STLP_MARK_PARAMETER_AS_UNUSED(&len) + base = 0; +#endif + return base; +} + +void _Filebuf_base::_M_unmap(void* base, streamoff len) +{ + // precondition : there is a valid mapping at the moment +#if !defined (__DJGPP) && !defined (_CRAY) + munmap((char*)base, len); +#else + _STLP_MARK_PARAMETER_AS_UNUSED(&len) + _STLP_MARK_PARAMETER_AS_UNUSED(base) +#endif +} + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/dll_main.cpp b/sdk/tlibstdcxx/src/dll_main.cpp new file mode 100644 index 0000000000..faaa721a70 --- /dev/null +++ b/sdk/tlibstdcxx/src/dll_main.cpp @@ -0,0 +1,262 @@ + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION + +#include "stlport_prefix.h" + +#if !defined (_STLP_DEBUG) && ! defined (_STLP_ASSERTIONS) +# if !defined (__APPLE__) || !defined (__GNUC__) || (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)) +/* dums: Please if the following code was being uncommented please explain why + * as for the moment it only looks like a source of inconsistency in the way + * STLport different translation units are compiled. + */ +//# define _STLP_ASSERTIONS 1 +# endif +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined (__DMC__) +// for rope static members +# include +#endif + +#include + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS) +exception::exception() _STLP_NOTHROW {} +exception::~exception() _STLP_NOTHROW {} +bad_exception::bad_exception() _STLP_NOTHROW {} +bad_exception::~bad_exception() _STLP_NOTHROW {} +const char* exception::what() const _STLP_NOTHROW { return "class exception"; } +const char* bad_exception::what() const _STLP_NOTHROW { return "class bad_exception"; } +#endif + +#if defined (_STLP_OWN_STDEXCEPT) +# include + +// boris : those are needed to force typeinfo nodes to be created in here only +logic_error::~logic_error() _STLP_NOTHROW_INHERENTLY {} +runtime_error::~runtime_error() _STLP_NOTHROW_INHERENTLY {} +domain_error::~domain_error() _STLP_NOTHROW_INHERENTLY {} +invalid_argument::~invalid_argument() _STLP_NOTHROW_INHERENTLY {} +length_error::~length_error() _STLP_NOTHROW_INHERENTLY {} +out_of_range::~out_of_range() _STLP_NOTHROW_INHERENTLY {} +range_error::~range_error() _STLP_NOTHROW_INHERENTLY {} +overflow_error::~overflow_error() _STLP_NOTHROW_INHERENTLY {} +underflow_error::~underflow_error() _STLP_NOTHROW_INHERENTLY {} + +#endif + +#if !defined(_STLP_WCE_EVC3) +# if defined (_STLP_NO_BAD_ALLOC) +const nothrow_t nothrow /* = {} */; +# endif +#endif + +#if !defined (_STLP_NO_FORCE_INSTANTIATE) + +# if defined (_STLP_DEBUG) || defined (_STLP_ASSERTIONS) +_STLP_MOVE_TO_PRIV_NAMESPACE +template class _STLP_CLASS_DECLSPEC __stl_debug_engine; +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +template class _STLP_CLASS_DECLSPEC __debug_alloc<__node_alloc>; +template class _STLP_CLASS_DECLSPEC __debug_alloc<__new_alloc>; + +//Export of the types used to represent buckets in the hashtable implementation. +/* + * For the vector class we do not use any MSVC6 workaround even if we export it from + * the STLport dynamic libraries because we know what methods are called and none is + * a template method. Moreover the exported class is an instanciation of vector with + * _Slist_node_base struct that is an internal STLport class that no user should ever + * use. + */ +# if !defined (_STLP_USE_PTR_SPECIALIZATIONS) +template class _STLP_CLASS_DECLSPEC allocator<_STLP_PRIV _Slist_node_base*>; + +_STLP_MOVE_TO_PRIV_NAMESPACE +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*, + allocator<_Slist_node_base*> >; +template class _STLP_CLASS_DECLSPEC _Vector_base<_Slist_node_base*, + allocator<_Slist_node_base*> >; +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +# if defined (_STLP_DEBUG) +_STLP_MOVE_TO_PRIV_NAMESPACE +template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_NAME(vector)<_Slist_node_base*, + allocator<_Slist_node_base*> >; +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +template class _STLP_CLASS_DECLSPEC vector<_STLP_PRIV _Slist_node_base*, + allocator<_STLP_PRIV _Slist_node_base*> >; +//End of hashtable bucket types export. + +//Export of _Locale_impl facets container: +# if !defined (_STLP_USE_PTR_SPECIALIZATIONS) +template class _STLP_CLASS_DECLSPEC allocator; + +_STLP_MOVE_TO_PRIV_NAMESPACE +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy >; +template class _STLP_CLASS_DECLSPEC _Vector_base >; +_STLP_MOVE_TO_STD_NAMESPACE + +# endif +# if defined (_STLP_DEBUG) +_STLP_MOVE_TO_PRIV_NAMESPACE +# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector) +template class _STLP_CLASS_DECLSPEC __construct_checker<_STLP_PRIV _STLP_NON_DBG_VECTOR > >; +template class _STLP_CLASS_DECLSPEC _STLP_NON_DBG_VECTOR >; +# undef _STLP_NON_DBG_VECTOR +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +template class _STLP_CLASS_DECLSPEC vector >; +//End of export of _Locale_impl facets container. + +# if defined (_STLP_USE_PTR_SPECIALIZATIONS) +template class _STLP_CLASS_DECLSPEC allocator; + +typedef _STLP_PRIV _List_node _VoidPtr_Node; +template class _STLP_CLASS_DECLSPEC allocator<_VoidPtr_Node>; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy >; +template class _STLP_CLASS_DECLSPEC _Vector_base >; +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(vector) >; + +template class _STLP_CLASS_DECLSPEC _List_node; +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_List_node_base, _VoidPtr_Node, allocator<_VoidPtr_Node> >; +template class _STLP_CLASS_DECLSPEC _List_base >; +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(list) >; + +template class _STLP_CLASS_DECLSPEC _Slist_node; +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy<_Slist_node_base, _Slist_node, allocator<_Slist_node > >; +template class _STLP_CLASS_DECLSPEC _Slist_base >; +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(slist) >; + +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy >; +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy >; +template struct _STLP_CLASS_DECLSPEC _Deque_iterator >; +template class _STLP_CLASS_DECLSPEC _Deque_base >; +template class _STLP_CLASS_DECLSPEC _STLP_PTR_IMPL_NAME(deque) >; + +_STLP_MOVE_TO_STD_NAMESPACE + +# endif /* _STLP_USE_PTR_SPECIALIZATIONS */ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template class _STLP_CLASS_DECLSPEC _Rb_global; +template class _STLP_CLASS_DECLSPEC _List_global; + +template class _STLP_CLASS_DECLSPEC _Sl_global; +template class _STLP_CLASS_DECLSPEC _Stl_prime; + +template class _STLP_CLASS_DECLSPEC _LimG; + +_STLP_MOVE_TO_STD_NAMESPACE + +#endif /* _STLP_NO_FORCE_INSTANTIATE */ + +_STLP_END_NAMESPACE + +#if defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) +extern "C" void _STLP_DECLSPEC _STLP_CALL _STLP_SIGNAL_RUNTIME_COMPATIBILITY() {} +#endif + +#define FORCE_SYMBOL extern + +#if defined (_WIN32) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_USE_STATIC_LIB) +// stlportmt.cpp : Defines the entry point for the DLL application. +// +# undef FORCE_SYMBOL +# define FORCE_SYMBOL APIENTRY + +extern "C" { + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID) { + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls((HINSTANCE)hModule); + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +} /* extern "C" */ + +#if !defined (_STLP_MSVC) && !defined (__MINGW32__) +_STLP_BEGIN_NAMESPACE + +static void FORCE_SYMBOL +force_link() { + set::iterator iter; + // _M_increment; _M_decrement instantiation + ++iter; + --iter; +} + +_STLP_END_NAMESPACE +#endif + +#endif /* _WIN32 */ + +#if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300) +# undef std + +namespace std +{ + void _STLP_CALL unexpected() { + unexpected_handler hdl; + set_unexpected(hdl = set_unexpected((unexpected_handler)0)); + hdl(); + } +} +#endif diff --git a/sdk/tlibstdcxx/src/facets_byname.cpp b/sdk/tlibstdcxx/src/facets_byname.cpp new file mode 100644 index 0000000000..07d1a3d67c --- /dev/null +++ b/sdk/tlibstdcxx/src/facets_byname.cpp @@ -0,0 +1,1057 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include + +#include +#include + +#include +#include + +#include "c_locale.h" +#include "locale_impl.h" +#include "acquire_release.h" + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// ctype_byname + +#if defined (__DMC__) +_STLP_DECLSPEC +#endif +ctype_byname::ctype_byname(const char* name, size_t refs) + : ctype( 0, false, refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_ctype = _STLP_PRIV __acquire_ctype(name, buf, 0, &__err_code); + if (!_M_ctype) + locale::_M_throw_on_creation_failure(__err_code, name, "ctype"); + + _M_init(); +} + +void ctype_byname::_M_init() { + _M_ctype_table = _M_byname_table; + + // We have to do this, instead of just pointer twiddling, because + // ctype_base::mask isn't the same type as _Locale_mask_t. + const _Locale_mask_t* p = _Locale_ctype_table(_M_ctype); + for (size_t i = 0; i != table_size; ++i) { + _M_byname_table[i] = ctype_base::mask(p[i]); + } +} + +ctype_byname::~ctype_byname() +{ _STLP_PRIV __release_ctype(_M_ctype); } + +char ctype_byname::do_toupper(char c) const +{ return (char)_Locale_toupper(_M_ctype, c); } + +char ctype_byname::do_tolower(char c) const +{ return (char)_Locale_tolower(_M_ctype, c); } + +const char* +ctype_byname::do_toupper(char* first, const char* last) const { + for ( ; first != last ; ++first) + *first = (char)_Locale_toupper(_M_ctype, *first); + return last; +} + +const char* +ctype_byname::do_tolower(char* first, const char* last) const { + for ( ; first != last ; ++first) + *first = (char)_Locale_tolower(_M_ctype, *first); + return last; +} + + +// Some helper functions used in ctype<>::scan_is and scan_is_not. +#if !defined (_STLP_NO_WCHAR_T) + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// ctype_byname + +struct _Ctype_byname_w_is_mask : public unary_function { + _Locale_mask_t M; + _Locale_ctype* M_ctp; + + _Ctype_byname_w_is_mask(_Locale_mask_t m, _Locale_ctype* c) + : M(m), M_ctp(c) {} + bool operator()(wchar_t c) const + { return _WLocale_ctype(M_ctp, c, M) != 0; } +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (__DMC__) +_STLP_DECLSPEC +#endif +ctype_byname::ctype_byname(const char* name, size_t refs) + : ctype(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_ctype = _STLP_PRIV __acquire_ctype(name, buf, 0, &__err_code); + if (!_M_ctype) + locale::_M_throw_on_creation_failure(__err_code, name, "ctype"); +} + +ctype_byname::~ctype_byname() +{ _STLP_PRIV __release_ctype(_M_ctype); } + +bool ctype_byname::do_is(ctype_base::mask m, wchar_t c) const +{ return _WLocale_ctype(_M_ctype, c, (_Locale_mask_t)m) != 0; } + +const wchar_t* +ctype_byname::do_is(const wchar_t* low, const wchar_t* high, + ctype_base::mask * m) const { + _Locale_mask_t all_bits = _Locale_mask_t(ctype_base::space | + ctype_base::print | + ctype_base::cntrl | + ctype_base::upper | + ctype_base::lower | + ctype_base::alpha | + ctype_base::digit | + ctype_base::punct | + ctype_base::xdigit); + + for ( ; low < high; ++low, ++m) + *m = ctype_base::mask (_WLocale_ctype(_M_ctype, *low, all_bits)); + return high; +} + +const wchar_t* +ctype_byname + ::do_scan_is(ctype_base::mask m, const wchar_t* low, const wchar_t* high) const +{ return find_if(low, high, _STLP_PRIV _Ctype_byname_w_is_mask(m, _M_ctype)); } + +const wchar_t* +ctype_byname + ::do_scan_not(ctype_base::mask m, const wchar_t* low, const wchar_t* high) const +{ return find_if(low, high, not1(_STLP_PRIV _Ctype_byname_w_is_mask(m, _M_ctype))); } + +wchar_t ctype_byname::do_toupper(wchar_t c) const +{ return _WLocale_toupper(_M_ctype, c); } + +const wchar_t* +ctype_byname::do_toupper(wchar_t* low, const wchar_t* high) const { + for ( ; low < high; ++low) + *low = _WLocale_toupper(_M_ctype, *low); + return high; +} + +wchar_t ctype_byname::do_tolower(wchar_t c) const +{ return _WLocale_tolower(_M_ctype, c); } + +const wchar_t* +ctype_byname::do_tolower(wchar_t* low, const wchar_t* high) const { + for ( ; low < high; ++low) + *low = _WLocale_tolower(_M_ctype, *low); + return high; +} + +#endif /* WCHAR_T */ + +// collate_byname +#if defined (__DMC__) +_STLP_DECLSPEC +#endif +collate_byname::collate_byname(const char* name, size_t refs) + : collate(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_collate = _STLP_PRIV __acquire_collate(name, buf, 0, &__err_code); + if (!_M_collate) + locale::_M_throw_on_creation_failure(__err_code, name, "collate"); +} + +collate_byname::~collate_byname() +{ _STLP_PRIV __release_collate(_M_collate); } + +int collate_byname::do_compare(const char* __low1, + const char* __high1, + const char* __low2, + const char* __high2) const { + return _Locale_strcmp(_M_collate, + __low1, __high1 - __low1, + __low2, __high2 - __low2); +} + +collate_byname::string_type +collate_byname::do_transform(const char* low, const char* high) const { + if (low == high) + return string_type(); + + size_t n = _Locale_strxfrm(_M_collate, NULL, 0, low, high - low); + + // NOT PORTABLE. What we're doing relies on internal details of the + // string implementation. (Contiguity of string elements and presence + // of trailing zero.) + string_type buf(n, 0); + _Locale_strxfrm(_M_collate, &(*buf.begin()), n + 1, low, high - low); + return buf; +} + + +#if !defined (_STLP_NO_WCHAR_T) + +// collate_byname + +#if defined (__DMC__) +_STLP_DECLSPEC +#endif +collate_byname::collate_byname(const char* name, size_t refs) + : collate(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_collate = _STLP_PRIV __acquire_collate(name, buf, 0, &__err_code); + if (!_M_collate) + locale::_M_throw_on_creation_failure(__err_code, name, "collate"); +} + +collate_byname::~collate_byname() +{ _STLP_PRIV __release_collate(_M_collate); } + +int collate_byname::do_compare(const wchar_t* low1, + const wchar_t* high1, + const wchar_t* low2, + const wchar_t* high2) const { + return _WLocale_strcmp(_M_collate, + low1, high1 - low1, + low2, high2 - low2); +} + +collate_byname::string_type +collate_byname::do_transform(const wchar_t* low, + const wchar_t* high) const { + if (low == high) + return string_type(); + + size_t n = _WLocale_strxfrm(_M_collate, NULL, 0, low, high - low); + + // NOT PORTABLE. What we're doing relies on internal details of the + // string implementation. (Contiguity of string elements and presence + // of trailing zero.) + string_type buf(n, 0); + _WLocale_strxfrm(_M_collate, &(*buf.begin()), n + 1, low, high - low); + return buf; +} + +#endif /* _STLP_NO_WCHAR_T */ + +//---------------------------------------------------------------------- +// codecvt_byname + +codecvt_byname + ::codecvt_byname(const char* name, size_t refs) + : codecvt(refs) { + if (!name) + locale::_M_throw_on_null_name(); +} + +codecvt_byname::~codecvt_byname() {} + + +#if !defined (_STLP_NO_WCHAR_T) + +//---------------------------------------------------------------------- +// codecvt_byname +codecvt_byname::codecvt_byname(const char* name, size_t refs) + : codecvt(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_codecvt = _STLP_PRIV __acquire_codecvt(name, buf, 0, &__err_code); + if (!_M_codecvt) + locale::_M_throw_on_creation_failure(__err_code, name, "ctype"); +} + +codecvt_byname::~codecvt_byname() +{ _STLP_PRIV __release_codecvt(_M_codecvt); } + +codecvt::result +codecvt_byname::do_out(state_type& state, + const intern_type* from, + const intern_type* from_end, + const intern_type*& from_next, + extern_type* to, + extern_type* to_limit, + extern_type*& to_next) const { + while (from != from_end && to != to_limit) { + size_t chars_stored = _WLocale_wctomb(_M_codecvt, + to, to_limit - to, *from, + &state); + if (chars_stored == (size_t) -1) { + from_next = from; + to_next = to; + return error; + } + else if (chars_stored == (size_t) -2) { + from_next = from; + to_next = to; + return partial; + } + + ++from; + to += chars_stored; + } + + from_next = from; + to_next = to; + return ok; +} + +codecvt::result +codecvt_byname::do_in(state_type& state, + const extern_type* from, + const extern_type* from_end, + const extern_type*& from_next, + intern_type* to, + intern_type* to_end, + intern_type*& to_next) const { + while (from != from_end && to != to_end) { + size_t chars_read = _WLocale_mbtowc(_M_codecvt, + to, from, from_end - from, + &state); + if (chars_read == (size_t) -1) { + from_next = from; + to_next = to; + return error; + } + + if (chars_read == (size_t) -2) { + from_next = from; + to_next = to; + return partial; + } + + from += chars_read; + to++; + } + + from_next = from; + to_next = to; + return ok; +} + +codecvt::result +codecvt_byname::do_unshift(state_type& state, + extern_type* to, + extern_type* to_limit, + extern_type*& to_next) const { + to_next = to; + size_t result = _WLocale_unshift(_M_codecvt, &state, + to, to_limit - to, &to_next); + if (result == (size_t) -1) + return error; + else if (result == (size_t) -2) + return partial; + else +# if defined (__ISCPP__) + return /*to_next == to ? noconv :*/ ok; +# else + return to_next == to ? noconv : ok; +# endif +} + +int +codecvt_byname::do_encoding() const _STLP_NOTHROW { + if (_WLocale_is_stateless(_M_codecvt)) { + int max_width = _WLocale_mb_cur_max(_M_codecvt); + int min_width = _WLocale_mb_cur_min(_M_codecvt); + return min_width == max_width ? min_width : 0; + } + else + return -1; +} + +bool +codecvt_byname::do_always_noconv() const _STLP_NOTHROW +{ return false; } + +int +codecvt_byname::do_length(state_type& state, + const extern_type* from, + const extern_type* end, + size_t mx) const { + size_t __count = 0; + while (from != end && mx--) { + intern_type __dummy; + size_t chars_read = _WLocale_mbtowc(_M_codecvt, + &__dummy, from, end - from, + &state); + if ((chars_read == (size_t) -1) || (chars_read == (size_t) -2)) // error or partial + break; + __count += chars_read; + from += chars_read; + } + return int(__count); +} + +int +codecvt_byname::do_max_length() const _STLP_NOTHROW +{ return _WLocale_mb_cur_max(_M_codecvt); } +#endif + +// numpunct_byname +numpunct_byname::numpunct_byname(const char* name, size_t refs) +: numpunct(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_numeric = _STLP_PRIV __acquire_numeric(name, buf, 0, &__err_code); + if (!_M_numeric) + locale::_M_throw_on_creation_failure(__err_code, name, "numpunct"); +} + +numpunct_byname::~numpunct_byname() +{ _STLP_PRIV __release_numeric(_M_numeric); } + +char numpunct_byname::do_decimal_point() const +{ return _Locale_decimal_point(_M_numeric); } + +char numpunct_byname::do_thousands_sep() const +{ return _Locale_thousands_sep(_M_numeric); } + +string numpunct_byname::do_grouping() const { + const char * __grouping = _Locale_grouping(_M_numeric); + if (__grouping != NULL && __grouping[0] == CHAR_MAX) + __grouping = ""; + return __grouping; +} + +string numpunct_byname::do_truename() const +{ return _Locale_true(_M_numeric); } + +string numpunct_byname::do_falsename() const +{ return _Locale_false(_M_numeric); } + +//---------------------------------------------------------------------- +// numpunct + +#if !defined (_STLP_NO_WCHAR_T) + +// numpunct_byname + +numpunct_byname::numpunct_byname(const char* name, size_t refs) +: numpunct(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_numeric = _STLP_PRIV __acquire_numeric(name, buf, 0, &__err_code); + if (!_M_numeric) + locale::_M_throw_on_creation_failure(__err_code, name, "numpunct"); +} + +numpunct_byname::~numpunct_byname() +{ _STLP_PRIV __release_numeric(_M_numeric); } + +wchar_t numpunct_byname::do_decimal_point() const +{ return _WLocale_decimal_point(_M_numeric); } + +wchar_t numpunct_byname::do_thousands_sep() const +{ return _WLocale_thousands_sep(_M_numeric); } + +string numpunct_byname::do_grouping() const { + const char * __grouping = _Locale_grouping(_M_numeric); + if (__grouping != NULL && __grouping[0] == CHAR_MAX) + __grouping = ""; + return __grouping; +} + +wstring numpunct_byname::do_truename() const { + wchar_t buf[16]; + return _WLocale_true(_M_numeric, _STLP_ARRAY_AND_SIZE(buf)); +} + +wstring numpunct_byname::do_falsename() const { + wchar_t buf[16]; + return _WLocale_false(_M_numeric, _STLP_ARRAY_AND_SIZE(buf)); +} + +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +static void _Init_monetary_formats(money_base::pattern& pos_format, + money_base::pattern& neg_format, + _Locale_monetary * monetary) { + switch (_Locale_p_sign_posn(monetary)) { + case 0: // Parentheses surround the quantity and currency symbol + case 1: // The sign string precedes the quantity and currency symbol + pos_format.field[0] = (char) money_base::sign; + if (_Locale_p_cs_precedes(monetary)) { + // 1 if currency symbol precedes a positive value + pos_format.field[1] = (char) money_base::symbol; + if (_Locale_p_sep_by_space(monetary)) { + // a space separates currency symbol from a positive value. + pos_format.field[2] = (char) money_base::space; + pos_format.field[3] = (char) money_base::value; + } else { + // a space not separates currency symbol from a positive value. + pos_format.field[2] = (char) money_base::value; + pos_format.field[3] = (char) money_base::none; + } + } else { + // 0 if currency symbol succeeds a positive value + pos_format.field[1] = (char) money_base::value; + if (_Locale_p_sep_by_space(monetary)) { + // a space separates currency symbol from a positive value. + pos_format.field[2] = (char) money_base::space; + pos_format.field[3] = (char) money_base::symbol; + } else { + // a space not separates currency symbol from a positive value. + pos_format.field[2] = (char) money_base::symbol; + pos_format.field[3] = (char) money_base::none; + } + } + break; + case 2: // The sign string succeeds the quantity and currency symbol. + if (_Locale_p_cs_precedes(monetary)) { + // 1 if currency symbol precedes a positive value + pos_format.field[0] = (char) money_base::symbol; + if (_Locale_p_sep_by_space(monetary)) { + // a space separates currency symbol from a positive value. + pos_format.field[1] = (char) money_base::space; + pos_format.field[2] = (char) money_base::value; + pos_format.field[3] = (char) money_base::sign; + } else { + // a space not separates currency symbol from a positive value. + pos_format.field[1] = (char) money_base::value; + pos_format.field[2] = (char) money_base::sign; + pos_format.field[3] = (char) money_base::none; + } + } else { + // 0 if currency symbol succeeds a positive value + pos_format.field[0] = (char) money_base::value; + if (_Locale_p_sep_by_space(monetary)) { + // a space separates currency symbol from a positive value. + pos_format.field[1] = (char) money_base::space; + pos_format.field[2] = (char) money_base::symbol; + pos_format.field[3] = (char) money_base::sign; + } else { + // a space not separates currency symbol from a positive value. + pos_format.field[1] = (char) money_base::symbol; + pos_format.field[2] = (char) money_base::sign; + pos_format.field[3] = (char) money_base::none; + } + } + break; + case 3: // The sign string immediately precedes the currency symbol. + if (_Locale_p_cs_precedes(monetary)) { + // 1 if currency symbol precedes a positive value + pos_format.field[0] = (char) money_base::sign; + pos_format.field[1] = (char) money_base::symbol; + if (_Locale_p_sep_by_space(monetary)) { + // a space separates currency symbol from a positive value. + pos_format.field[2] = (char) money_base::space; + pos_format.field[3] = (char) money_base::value; + } else { + // a space not separates currency symbol from a positive value. + pos_format.field[2] = (char) money_base::value; + pos_format.field[3] = (char) money_base::none; + } + } else { + // 0 if currency symbol succeeds a positive value + pos_format.field[0] = (char) money_base::value; + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::symbol; + pos_format.field[3] = (char) money_base::none; + } + break; + case 4: // The sign string immediately succeeds the currency symbol. + if (_Locale_p_cs_precedes(monetary)) { + // 1 if currency symbol precedes a positive value + pos_format.field[0] = (char) money_base::symbol; + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::value; + pos_format.field[3] = (char) money_base::none; + } else { + // 0 if currency symbol succeeds a positive value + pos_format.field[0] = (char) money_base::value; + if (_Locale_p_sep_by_space(monetary)) { + // a space separates currency symbol from a positive value. + pos_format.field[1] = (char) money_base::space; + pos_format.field[2] = (char) money_base::symbol; + pos_format.field[3] = (char) money_base::sign; + } else { + // a space not separates currency symbol from a positive value. + pos_format.field[1] = (char) money_base::symbol; + pos_format.field[2] = (char) money_base::sign; + pos_format.field[3] = (char) money_base::none; + } + } + break; + default: // Default C++ Standard format + pos_format.field[0] = (char) money_base::symbol; + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::none; + pos_format.field[3] = (char) money_base::value; + break; + } + + switch (_Locale_n_sign_posn(monetary)) { + case 0: // Parentheses surround the quantity and currency symbol + case 1: // The sign string precedes the quantity and currency symbol + neg_format.field[0] = (char) money_base::sign; + if (_Locale_n_cs_precedes(monetary)) { + // 1 if currency symbol precedes a negative value + neg_format.field[1] = (char) money_base::symbol; + if (_Locale_n_sep_by_space(monetary)) { + // a space separates currency symbol from a negative value. + neg_format.field[2] = (char) money_base::space; + neg_format.field[3] = (char) money_base::value; + } else { + // a space not separates currency symbol from a negative value. + neg_format.field[2] = (char) money_base::value; + neg_format.field[3] = (char) money_base::none; + } + } else { + // 0 if currency symbol succeeds a negative value + neg_format.field[1] = (char) money_base::value; + if (_Locale_n_sep_by_space(monetary)) { + // a space separates currency symbol from a negative value. + neg_format.field[2] = (char) money_base::space; + neg_format.field[3] = (char) money_base::symbol; + } else { + // a space not separates currency symbol from a negative value. + neg_format.field[2] = (char) money_base::symbol; + neg_format.field[3] = (char) money_base::none; + } + } + break; + case 2: // The sign string succeeds the quantity and currency symbol. + if (_Locale_n_cs_precedes(monetary)) { + // 1 if currency symbol precedes a negative value + neg_format.field[0] = (char) money_base::symbol; + if (_Locale_n_sep_by_space(monetary)) { + // a space separates currency symbol from a negative value. + neg_format.field[1] = (char) money_base::space; + neg_format.field[2] = (char) money_base::value; + neg_format.field[3] = (char) money_base::sign; + } else { + // a space not separates currency symbol from a negative value. + neg_format.field[1] = (char) money_base::value; + neg_format.field[2] = (char) money_base::sign; + neg_format.field[3] = (char) money_base::none; + } + } else { + // 0 if currency symbol succeeds a negative value + neg_format.field[0] = (char) money_base::value; + if (_Locale_n_sep_by_space(monetary)) { + // a space separates currency symbol from a negative value. + neg_format.field[1] = (char) money_base::space; + neg_format.field[2] = (char) money_base::symbol; + neg_format.field[3] = (char) money_base::sign; + } else { + // a space not separates currency symbol from a negative value. + neg_format.field[1] = (char) money_base::symbol; + neg_format.field[2] = (char) money_base::sign; + neg_format.field[3] = (char) money_base::none; + } + } + break; + case 3: // The sign string immediately precedes the currency symbol. + if (_Locale_n_cs_precedes(monetary)) { + // 1 if currency symbol precedes a negative value + neg_format.field[0] = (char) money_base::sign; + neg_format.field[1] = (char) money_base::symbol; + if (_Locale_n_sep_by_space(monetary)) { + // a space separates currency symbol from a negative value. + neg_format.field[2] = (char) money_base::space; + neg_format.field[3] = (char) money_base::value; + } else { + // a space not separates currency symbol from a negative value. + neg_format.field[2] = (char) money_base::value; + neg_format.field[3] = (char) money_base::none; + } + } else { + // 0 if currency symbol succeeds a negative value + neg_format.field[0] = (char) money_base::value; + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::symbol; + neg_format.field[3] = (char) money_base::none; + } + break; + case 4: // The sign string immediately succeeds the currency symbol. + if (_Locale_n_cs_precedes(monetary)) { + // 1 if currency symbol precedes a negative value + neg_format.field[0] = (char) money_base::symbol; + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::none; + neg_format.field[3] = (char) money_base::value; + } else { + // 0 if currency symbol succeeds a negative value + neg_format.field[0] = (char) money_base::value; + if (_Locale_n_sep_by_space(monetary)) { + // a space separates currency symbol from a negative value. + neg_format.field[1] = (char) money_base::space; + neg_format.field[2] = (char) money_base::symbol; + neg_format.field[3] = (char) money_base::sign; + } else { + // a space not separates currency symbol from a negative value. + neg_format.field[1] = (char) money_base::symbol; + neg_format.field[2] = (char) money_base::sign; + neg_format.field[3] = (char) money_base::none; + } + } + break; + default: // Default C++ Standard format + neg_format.field[0] = (char) money_base::symbol; + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::none; + neg_format.field[3] = (char) money_base::value; + break; + } +} + +// international variant of monetary + +/* + * int_curr_symbol + * + * The international currency symbol. The operand is a four-character + * string, with the first three characters containing the alphabetic + * international currency symbol in accordance with those specified + * in the ISO 4217 specification. The fourth character is the character used + * to separate the international currency symbol from the monetary quantity. + * + * (http://www.opengroup.org/onlinepubs/7990989775/xbd/locale.html) + */ + +/* + * Standards are unclear in the usage of international currency + * and monetary formats. + * But I am expect that international currency symbol should be the first + * (not depends upon where currency symbol situated in the national + * format). + * + * If this isn't so, let's see: + * 1 234.56 RUR + * GBP 1,234.56 + * USD 1,234.56 + * The situation really is worse than you see above: + * RUR typed wrong here---it prints '1 234.56 RUR ' (see space after RUR). + * This is due to intl_fmp.curr_symbol() == "RUR ". (see reference in comments + * above). + * + */ + +static void _Init_monetary_formats_int(money_base::pattern& pos_format, + money_base::pattern& neg_format, + _Locale_monetary * monetary) +{ + + switch (_Locale_p_sign_posn(monetary)) { + case 0: // Parentheses surround the quantity and currency symbol + case 1: // The sign string precedes the quantity and currency symbol + pos_format.field[0] = (char) money_base::symbol; + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::value; + pos_format.field[3] = (char) money_base::none; + break; + case 2: // The sign string succeeds the quantity and currency symbol. + pos_format.field[0] = (char) money_base::symbol; + pos_format.field[1] = (char) money_base::value; + pos_format.field[2] = (char) money_base::sign; + pos_format.field[3] = (char) money_base::none; + break; + case 3: // The sign string immediately precedes the currency symbol. + case 4: // The sign string immediately succeeds the currency symbol. + pos_format.field[0] = (char) money_base::symbol; + if (_Locale_p_cs_precedes(monetary)) { + // 1 if currency symbol precedes a positive value + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::value; + } else { + // 0 if currency symbol succeeds a positive value + pos_format.field[1] = (char) money_base::value; + pos_format.field[2] = (char) money_base::sign; + } + pos_format.field[3] = (char) money_base::none; + break; + default: // Default C++ Standard format + pos_format.field[0] = (char) money_base::symbol; + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::none; + pos_format.field[3] = (char) money_base::value; + break; + } + + + switch (_Locale_n_sign_posn(monetary)) { + case 0: // Parentheses surround the quantity and currency symbol + case 1: // The sign string precedes the quantity and currency symbol + neg_format.field[0] = (char) money_base::symbol; + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::value; + neg_format.field[3] = (char) money_base::none; + break; + case 2: // The sign string succeeds the quantity and currency symbol. + neg_format.field[0] = (char) money_base::symbol; + neg_format.field[1] = (char) money_base::value; + neg_format.field[2] = (char) money_base::sign; + neg_format.field[3] = (char) money_base::none; + break; + case 3: // The sign string immediately precedes the currency symbol. + case 4: // The sign string immediately succeeds the currency symbol. + neg_format.field[0] = (char) money_base::symbol; + if (_Locale_n_cs_precedes(monetary)) { + // 1 if currency symbol precedes a negative value + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::value; + } else { + // 0 if currency symbol succeeds a negative value + neg_format.field[1] = (char) money_base::value; + neg_format.field[2] = (char) money_base::sign; + } + neg_format.field[3] = (char) money_base::none; + break; + default: // Default C++ Standard format + neg_format.field[0] = (char) money_base::symbol; + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::none; + neg_format.field[3] = (char) money_base::value; + break; + } +} + +_STLP_MOVE_TO_STD_NAMESPACE + +// +// moneypunct_byname<> +// +moneypunct_byname::moneypunct_byname(const char * name, + size_t refs) + : moneypunct(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code); + if (!_M_monetary) + locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct"); + + _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::moneypunct_byname(_Locale_monetary *__mon) + : _M_monetary(__mon) { + _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::~moneypunct_byname() +{ _STLP_PRIV __release_monetary(_M_monetary); } + +char moneypunct_byname::do_decimal_point() const +{ return _Locale_mon_decimal_point(_M_monetary); } + +char moneypunct_byname::do_thousands_sep() const +{ return _Locale_mon_thousands_sep(_M_monetary); } + +string moneypunct_byname::do_grouping() const +{ return _Locale_mon_grouping(_M_monetary); } + +string moneypunct_byname::do_curr_symbol() const +{ return _Locale_int_curr_symbol(_M_monetary); } + +string moneypunct_byname::do_positive_sign() const +{ return _Locale_positive_sign(_M_monetary); } + +string moneypunct_byname::do_negative_sign() const +{ return _Locale_negative_sign(_M_monetary); } + +int moneypunct_byname::do_frac_digits() const +{ return _Locale_int_frac_digits(_M_monetary); } + +moneypunct_byname::moneypunct_byname(const char * name, + size_t refs) + : moneypunct(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code); + if (!_M_monetary) + locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct"); + + _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::moneypunct_byname(_Locale_monetary *__mon) + : _M_monetary(__mon) { + _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::~moneypunct_byname() +{ _STLP_PRIV __release_monetary(_M_monetary); } + +char moneypunct_byname::do_decimal_point() const +{ return _Locale_mon_decimal_point(_M_monetary); } + +char moneypunct_byname::do_thousands_sep() const +{ return _Locale_mon_thousands_sep(_M_monetary); } + +string moneypunct_byname::do_grouping() const +{ return _Locale_mon_grouping(_M_monetary); } + +string moneypunct_byname::do_curr_symbol() const +{ return _Locale_currency_symbol(_M_monetary); } + +string moneypunct_byname::do_positive_sign() const +{ return _Locale_positive_sign(_M_monetary); } + +string moneypunct_byname::do_negative_sign() const +{ return _Locale_negative_sign(_M_monetary); } + +int moneypunct_byname::do_frac_digits() const +{ return _Locale_frac_digits(_M_monetary); } + +// +// moneypunct_byname +// +#if !defined (_STLP_NO_WCHAR_T) + +moneypunct_byname::moneypunct_byname(const char * name, + size_t refs) + : moneypunct(refs) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code); + if (!_M_monetary) + locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct"); + + _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::moneypunct_byname(_Locale_monetary *__mon) + : _M_monetary(__mon) { + _STLP_PRIV _Init_monetary_formats_int(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::~moneypunct_byname() +{ _STLP_PRIV __release_monetary(_M_monetary); } + +wchar_t moneypunct_byname::do_decimal_point() const +{ return _Locale_mon_decimal_point(_M_monetary); } + +wchar_t moneypunct_byname::do_thousands_sep() const +{ return _Locale_mon_thousands_sep(_M_monetary); } + +string moneypunct_byname::do_grouping() const +{ return _Locale_mon_grouping(_M_monetary); } + +inline wstring __do_widen (string const& str) { +#if defined (_STLP_NO_MEMBER_TEMPLATES) || defined (_STLP_MSVC) + wstring::_Reserve_t __Reserve; + size_t __size = str.size(); + wstring result(__Reserve, __size); + copy(str.begin(), str.end(), result.begin()); +#else + wstring result(str.begin(), str.end()); +#endif + return result; +} + +wstring moneypunct_byname::do_curr_symbol() const +{ wchar_t buf[16]; return _WLocale_int_curr_symbol(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); } + +wstring moneypunct_byname::do_positive_sign() const +{ wchar_t buf[16]; return _WLocale_positive_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); } + +wstring moneypunct_byname::do_negative_sign() const +{ wchar_t buf[16]; return _WLocale_negative_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); } + +int moneypunct_byname::do_frac_digits() const +{ return _Locale_int_frac_digits(_M_monetary); } + +moneypunct_byname::moneypunct_byname(const char * name, + size_t refs) + : moneypunct(refs) { + if (!name) + locale::_M_throw_on_null_name() ; + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_monetary = _STLP_PRIV __acquire_monetary(name, buf, 0, &__err_code); + if (!_M_monetary) + locale::_M_throw_on_creation_failure(__err_code, name, "moneypunct"); + + _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::moneypunct_byname(_Locale_monetary *__mon) + : _M_monetary(__mon) { + _STLP_PRIV _Init_monetary_formats(_M_pos_format, _M_neg_format, _M_monetary); +} + +moneypunct_byname::~moneypunct_byname() +{ _STLP_PRIV __release_monetary(_M_monetary); } + +wchar_t moneypunct_byname::do_decimal_point() const +{ return _Locale_mon_decimal_point(_M_monetary); } + +wchar_t moneypunct_byname::do_thousands_sep() const +{ return _Locale_mon_thousands_sep(_M_monetary); } + +string moneypunct_byname::do_grouping() const +{ return _Locale_mon_grouping(_M_monetary); } + +wstring moneypunct_byname::do_curr_symbol() const +{ wchar_t buf[16]; return _WLocale_currency_symbol(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); } + +wstring moneypunct_byname::do_positive_sign() const +{ wchar_t buf[16]; return _WLocale_positive_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); } + +wstring moneypunct_byname::do_negative_sign() const +{ wchar_t buf[16]; return _WLocale_negative_sign(_M_monetary, _STLP_ARRAY_AND_SIZE(buf)); } + +int moneypunct_byname::do_frac_digits() const +{ return _Locale_frac_digits(_M_monetary); } + +#endif + +_STLP_END_NAMESPACE + diff --git a/sdk/tlibstdcxx/src/fstream.cpp b/sdk/tlibstdcxx/src/fstream.cpp new file mode 100644 index 0000000000..81543bb828 --- /dev/null +++ b/sdk/tlibstdcxx/src/fstream.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#ifdef _STLP_USE_UNIX_IO +# include "details/fstream_unistd.cpp" +#elif defined(_STLP_USE_STDIO_IO) +# include "details/fstream_stdio.cpp" +#elif defined(_STLP_USE_WIN32_IO) +# include "details/fstream_win32io.cpp" +#else +# error "Can't recognize IO scheme to use" +#endif + +_STLP_BEGIN_NAMESPACE + +// fbp : let us map 1 MB maximum, just be sure not to trash VM +#define MMAP_CHUNK 0x100000L + +_Underflow< char, char_traits >::int_type _STLP_CALL +_Underflow< char, char_traits >::_M_doit(basic_filebuf >* __this) +{ + typedef char_traits traits_type; + typedef traits_type::int_type int_type; + + if (!__this->_M_in_input_mode) { + if (!__this->_M_switch_to_input_mode()) + return traits_type::eof(); + } + else if (__this->_M_in_putback_mode) { + __this->_M_exit_putback_mode(); + if (__this->gptr() != __this->egptr()) { + int_type __c = traits_type::to_int_type(*__this->gptr()); + return __c; + } + } + + // If it's a disk file, and if the internal and external character + // sequences are guaranteed to be identical, then try to use memory + // mapped I/O. Otherwise, revert to ordinary read. + if (__this->_M_base.__regular_file() + && __this->_M_always_noconv + && __this->_M_base._M_in_binary_mode()) { + // If we've mmapped part of the file already, then unmap it. + if (__this->_M_mmap_base) + __this->_M_base._M_unmap(__this->_M_mmap_base, __this->_M_mmap_len); + + // Determine the position where we start mapping. It has to be + // a multiple of the page size. + streamoff __cur = __this->_M_base._M_seek(0, ios_base::cur); + streamoff __size = __this->_M_base._M_file_size(); + if (__size > 0 && __cur >= 0 && __cur < __size) { + streamoff __offset = (__cur / __this->_M_base.__page_size()) * __this->_M_base.__page_size(); + streamoff __remainder = __cur - __offset; + + __this->_M_mmap_len = __size - __offset; + + if (__this->_M_mmap_len > MMAP_CHUNK) + __this->_M_mmap_len = MMAP_CHUNK; + + if ((__this->_M_mmap_base = __this->_M_base._M_mmap(__offset, __this->_M_mmap_len)) != 0) { + __this->setg(__STATIC_CAST(char*, __this->_M_mmap_base), + __STATIC_CAST(char*, __this->_M_mmap_base) + __STATIC_CAST(ptrdiff_t, __remainder), + __STATIC_CAST(char*, __this->_M_mmap_base) + __STATIC_CAST(ptrdiff_t, __this->_M_mmap_len)); + return traits_type::to_int_type(*__this->gptr()); + } + else + __this->_M_mmap_len = 0; + } + else { + __this->_M_mmap_base = 0; + __this->_M_mmap_len = 0; + } + } + + return __this->_M_underflow_aux(); +} + +//---------------------------------------------------------------------- +// Force instantiation of filebuf and fstream classes. +#if !defined(_STLP_NO_FORCE_INSTANTIATE) + +template class basic_filebuf >; +template class basic_ifstream >; +template class basic_ofstream >; +template class basic_fstream >; + +# if !defined (_STLP_NO_WCHAR_T) +template class _Underflow >; +template class basic_filebuf >; +template class basic_ifstream >; +template class basic_ofstream >; +template class basic_fstream >; +# endif /* _STLP_NO_WCHAR_T */ + +#endif + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/ios.cpp b/sdk/tlibstdcxx/src/ios.cpp new file mode 100644 index 0000000000..cb35e0b1b7 --- /dev/null +++ b/sdk/tlibstdcxx/src/ios.cpp @@ -0,0 +1,318 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include +#include +#include // for __get_ostreambuf definition + +#include "aligned_buffer.h" + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// ios_base members + +// class ios_base::failure, a subclass of exception. It's used solely +// for reporting errors. + +ios_base::failure::failure(const string& s) + : __Named_exception(s) +{} + +ios_base::failure::~failure() _STLP_NOTHROW_INHERENTLY {} + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) +// Definitions of ios_base's formatting flags. +const ios_base::fmtflags ios_base::left; +const ios_base::fmtflags ios_base::right; +const ios_base::fmtflags ios_base::internal; +const ios_base::fmtflags ios_base::dec; +const ios_base::fmtflags ios_base::hex; +const ios_base::fmtflags ios_base::oct; +const ios_base::fmtflags ios_base::fixed; +const ios_base::fmtflags ios_base::scientific; +const ios_base::fmtflags ios_base::boolalpha; +const ios_base::fmtflags ios_base::showbase; +const ios_base::fmtflags ios_base::showpoint; +const ios_base::fmtflags ios_base::showpos; +const ios_base::fmtflags ios_base::skipws; +const ios_base::fmtflags ios_base::unitbuf; +const ios_base::fmtflags ios_base::uppercase; +const ios_base::fmtflags ios_base::adjustfield; +const ios_base::fmtflags ios_base::basefield; +const ios_base::fmtflags ios_base::floatfield; + +// Definitions of ios_base's state flags. +const ios_base::iostate ios_base::goodbit; +const ios_base::iostate ios_base::badbit; +const ios_base::iostate ios_base::eofbit; +const ios_base::iostate ios_base::failbit; + +// Definitions of ios_base's openmode flags. +const ios_base::openmode ios_base::app; +const ios_base::openmode ios_base::ate; +const ios_base::openmode ios_base::binary; +const ios_base::openmode ios_base::in; +const ios_base::openmode ios_base::out; +const ios_base::openmode ios_base::trunc; + +// Definitions of ios_base's seekdir flags. +const ios_base::seekdir ios_base::beg; +const ios_base::seekdir ios_base::cur; +const ios_base::seekdir ios_base::end; + +#endif + +// Internal functions used for managing exponentially-growing arrays of +// POD types. + +// array is a pointer to N elements of type PODType. Expands the array, +// if necessary, so that array[index] is meaningful. All new elements are +// initialized to zero. Returns a pointer to the new array, and the new +// size. + +template +static pair +_Stl_expand_array(PODType* __array, size_t N, int index) { + if ((int)N < index + 1) { + size_t new_N = (max)(2 * N, size_t(index + 1)); + PODType* new_array + = __STATIC_CAST(PODType*,realloc(__array, new_N * sizeof(PODType))); + if (new_array) { + fill(new_array + N, new_array + new_N, PODType()); + return pair(new_array, new_N); + } + else + return pair(__STATIC_CAST(PODType*,0), 0); + } + else + return pair(__array, N); +} + +// array is a pointer to N elements of type PODType. Allocate a new +// array of N elements, copying the values from the old array to the new. +// Return a pointer to the new array. It is assumed that array is non-null +// and N is nonzero. +template +static PODType* _Stl_copy_array(const PODType* __array, size_t N) { + PODType* result = __STATIC_CAST(PODType*,malloc(N * sizeof(PODType))); + if (result) + copy(__array, __array + N, result); + return result; +} + +locale ios_base::imbue(const locale& loc) { + if (loc != _M_locale) { + locale previous = _M_locale; + _M_locale = loc; + _M_invoke_callbacks(imbue_event); + return previous; + } + else { + _M_invoke_callbacks(imbue_event); + return _M_locale; + } +} + +int _STLP_CALL ios_base::xalloc() { +#if defined (_STLP_THREADS) && \ + defined (_STLP_WIN32THREADS) && defined (_STLP_NEW_PLATFORM_SDK) + static volatile __stl_atomic_t _S_index = 0; + return _STLP_ATOMIC_INCREMENT(&_S_index); +#else + static int _S_index = 0; + static _STLP_STATIC_MUTEX __lock _STLP_MUTEX_INITIALIZER; + _STLP_auto_lock sentry(__lock); + return _S_index++; +#endif +} + +long& ios_base::iword(int index) { + static long dummy = 0; + + pair tmp = _Stl_expand_array(_M_iwords, _M_num_iwords, index); + if (tmp.first) { // The allocation, if any, succeeded. + _M_iwords = tmp.first; + _M_num_iwords = tmp.second; + return _M_iwords[index]; + } + else { + _M_setstate_nothrow(badbit); + _M_check_exception_mask(); + return dummy; + } +} + + +void*& ios_base::pword(int index) { + static void* dummy = 0; + + pair tmp = _Stl_expand_array(_M_pwords, _M_num_pwords, index); + if (tmp.first) { // The allocation, if any, succeeded. + _M_pwords = tmp.first; + _M_num_pwords = tmp.second; + return _M_pwords[index]; + } + else { + _M_setstate_nothrow(badbit); + _M_check_exception_mask(); + return dummy; + } +} + +void ios_base::register_callback(event_callback __fn, int index) { + pair*, size_t> tmp + = _Stl_expand_array(_M_callbacks, _M_num_callbacks, (int)_M_callback_index /* fbp: index ??? */ ); + if (tmp.first) { + _M_callbacks = tmp.first; + _M_num_callbacks = tmp.second; + _M_callbacks[_M_callback_index++] = make_pair(__fn, index); + } + else { + _M_setstate_nothrow(badbit); + _M_check_exception_mask(); + } +} + +// Invokes all currently registered callbacks for a particular event. +// Behaves correctly even if one of the callbacks adds a new callback. +void ios_base::_M_invoke_callbacks(event E) { + for (size_t i = _M_callback_index; i > 0; --i) { + event_callback f = _M_callbacks[i-1].first; + int n = _M_callbacks[i-1].second; + f(E, *this, n); + } +} + +// This function is called if the state, rdstate(), has a bit set +// that is also set in the exception mask exceptions(). +void ios_base::_M_throw_failure() { + const char* arg ; +# if 0 + char buffer[256]; + char* ptr; + strcpy(buffer, "ios failure: rdstate = 0x"); + ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_iostate)); + strcpy(ptr, " mask = 0x"); + ptr = __write_integer(buffer+strlen(buffer), ios_base::hex, __STATIC_CAST(unsigned long,_M_exception_mask)); + *ptr = 0; + arg = buffer; +# else + arg = "ios failure"; +# endif + +# ifndef _STLP_USE_EXCEPTIONS + fputs(arg, stderr); +# else + throw failure(arg); +# endif +} + +// Copy x's state to *this. This member function is used in the +// implementation of basic_ios::copyfmt. Does not copy _M_exception_mask +// or _M_iostate. +void ios_base::_M_copy_state(const ios_base& x) { + _M_fmtflags = x._M_fmtflags; // Copy the flags, except for _M_iostate + _M_openmode = x._M_openmode; // and _M_exception_mask. + _M_seekdir = x._M_seekdir; + _M_precision = x._M_precision; + _M_width = x._M_width; + _M_locale = x._M_locale; + + if (x._M_callbacks) { + pair* tmp = _Stl_copy_array(x._M_callbacks, x._M_callback_index); + if (tmp) { + free(_M_callbacks); + _M_callbacks = tmp; + _M_num_callbacks = _M_callback_index = x._M_callback_index; + } + else { + _M_setstate_nothrow(badbit); + _M_check_exception_mask(); + } + } + + if (x._M_iwords) { + long* tmp = _Stl_copy_array(x._M_iwords, x._M_num_iwords); + if (tmp) { + free(_M_iwords); + _M_iwords = tmp; + _M_num_iwords = x._M_num_iwords; + } + else { + _M_setstate_nothrow(badbit); + _M_check_exception_mask(); + } + } + + if (x._M_pwords) { + void** tmp = _Stl_copy_array(x._M_pwords, x._M_num_pwords); + if (tmp) { + free(_M_pwords); + _M_pwords = tmp; + _M_num_pwords = x._M_num_pwords; + } + else { + _M_setstate_nothrow(badbit); + _M_check_exception_mask(); + } + } +} + +// ios's (protected) default constructor. The standard says that all +// fields have indeterminate values; we initialize them to zero for +// simplicity. The only thing that really matters is that the arrays +// are all initially null pointers, and the array element counts are all +// initially zero. +ios_base::ios_base() + : _M_fmtflags(0), _M_iostate(0), _M_openmode(0), _M_seekdir(0), + _M_exception_mask(0), + _M_precision(0), _M_width(0), + _M_locale(), + _M_callbacks(0), _M_num_callbacks(0), _M_callback_index(0), + _M_iwords(0), _M_num_iwords(0), + _M_pwords(0), + _M_num_pwords(0) +{} + +// ios's destructor. +ios_base::~ios_base() { + _M_invoke_callbacks(erase_event); + free(_M_callbacks); + free(_M_iwords); + free(_M_pwords); +} + +//---------------------------------------------------------------------- +// Force instantiation of basic_ios +// For DLL exports, they are already instantiated. +#if !defined(_STLP_NO_FORCE_INSTANTIATE) +template class _STLP_CLASS_DECLSPEC basic_ios >; +# if !defined (_STLP_NO_WCHAR_T) +template class _STLP_CLASS_DECLSPEC basic_ios >; +# endif /* _STLP_NO_WCHAR_T */ +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/iostream.cpp b/sdk/tlibstdcxx/src/iostream.cpp new file mode 100644 index 0000000000..0d3329b53e --- /dev/null +++ b/sdk/tlibstdcxx/src/iostream.cpp @@ -0,0 +1,354 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include +#include +#if defined (_STLP_MSVC) || defined (__MWERKS__) || defined (__ICL) || defined (__ISCPP__) +# define _STLP_USE_NOT_INIT_SEGMENT +# include +#endif + +#include "stdio_streambuf.h" +#include "aligned_buffer.h" +#include "_stdio_file.h" +#include "c_locale.h" + +// boris : note this is repeated in +#ifndef _STLP_USE_NAMESPACES +// in case of SGI iostreams, we have to rename our streams not to clash with those +// provided in native lib +# define cin _STLP_cin +# define cout _STLP_cout +# define cerr _STLP_cerr +# define clog _STLP_clog +#endif + +_STLP_BEGIN_NAMESPACE + +// This file handles iostream initialization. It is inherently +// nonportable, since the C++ language definition provides no mechanism +// for controlling order of initialization of nonlocal objects. +// Initialization has three parts, which must be performed in the following +// order: +// (1) Initialize the locale system +// (2) Call the constructors for the eight global stream objects. +// (3) Create streambufs for the global stream objects, and initialize +// the stream objects by calling the init() member function. + + +#if defined (_STLP_USE_NOT_INIT_SEGMENT) + +// Definitions of the eight global I/O objects that are declared in +// . For some compilers we use pragmas to put the global I/O +// objects into an initialization segment that will not +// be executed. We then explicitly invoke the constructors +// with placement new in ios_base::_S_initialize() + +# if defined (__MWERKS__) +# pragma suppress_init_code on +# else +# pragma init_seg("STLPORT_NO_INIT") +# endif + +_STLP_DECLSPEC istream cin(0); +_STLP_DECLSPEC ostream cout(0); +_STLP_DECLSPEC ostream cerr(0); +_STLP_DECLSPEC ostream clog(0); + +# ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC wistream wcin(0); +_STLP_DECLSPEC wostream wcout(0); +_STLP_DECLSPEC wostream wcerr(0); +_STLP_DECLSPEC wostream wclog(0); +# endif + +# if defined (__MWERKS__) +# pragma suppress_init_code off +# endif + +#else + +// Definitions of the eight global I/O objects that are declared in +// . Disgusting hack: we deliberately define them with the +// wrong types so that the constructors don't get run automatically. +// We need special tricks to make sure that these objects are struct- +// aligned rather than byte-aligned. + +// This is not portable. Declaring a variable with different types in +// two translations units is "undefined", according to the C++ standard. +// Most compilers, however, silently accept this instead of diagnosing +// it as an error. + +# ifndef __DMC__ +_STLP_DECLSPEC _Stl_aligned_buffer cin; +_STLP_DECLSPEC _Stl_aligned_buffer cout; +_STLP_DECLSPEC _Stl_aligned_buffer cerr; +_STLP_DECLSPEC _Stl_aligned_buffer clog; +# else +_Stl_aligned_buffer cin; +_Stl_aligned_buffer cout; +_Stl_aligned_buffer cerr; +_Stl_aligned_buffer clog; + +# pragma alias("?cin@std@@3V?$basic_istream@std@DV?$char_traits@std@D@1@@1@A", "?cin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@DV?$char_traits@std@D@1@@1@@1@A") +# pragma alias("?cout@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A") +# pragma alias("?cerr@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?cerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A") +# pragma alias("?clog@std@@3V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@A", "?clog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@DV?$char_traits@std@D@1@@1@@1@A") +# endif + +# ifndef _STLP_NO_WCHAR_T + +# ifndef __DMC__ +_STLP_DECLSPEC _Stl_aligned_buffer wcin; +_STLP_DECLSPEC _Stl_aligned_buffer wcout; +_STLP_DECLSPEC _Stl_aligned_buffer wcerr; +_STLP_DECLSPEC _Stl_aligned_buffer wclog; +# else +_Stl_aligned_buffer wcin; +_Stl_aligned_buffer wcout; +_Stl_aligned_buffer wcerr; +_Stl_aligned_buffer wclog; + +# pragma alias("?wcin@std@@3V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcin@std@@3T?$_Stl_aligned_buffer@std@V?$basic_istream@std@_YV?$char_traits@std@_Y@1@@1@@1@A") +# pragma alias("?wcout@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcout@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A") +# pragma alias("?wcerr@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wcerr@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A") +# pragma alias("?wclog@std@@3V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@A", "?wclog@std@@3T?$_Stl_aligned_buffer@std@V?$basic_ostream@std@_YV?$char_traits@std@_Y@1@@1@@1@A") +# endif +# endif +#endif /* STL_MSVC || __MWERKS__ */ + +// Member functions from class ios_base and ios_base::Init + +long ios_base::Init::_S_count = 0; +// by default, those are synced +bool ios_base::_S_is_synced = true; + +ios_base::Init::Init() { + if (_S_count++ == 0) { + _Locale_init(); + ios_base::_S_initialize(); + _Filebuf_base::_S_initialize(); + } +} + +ios_base::Init::~Init() { + if (--_S_count == 0) { + ios_base::_S_uninitialize(); + _Locale_final(); + } +} + +static int _Stl_extract_open_param(FILE* f) +{ return _FILE_fd(f); } + +#ifdef _STLP_REDIRECT_STDSTREAMS +static const char* _Stl_extract_open_param(const char* name) +{ return name; } +#endif + +template +static filebuf* +_Stl_create_filebuf(_Tp x, ios_base::openmode mode ) { + auto_ptr result(new basic_filebuf >()); + result->open(_Stl_extract_open_param(x), mode); + + if (result->is_open()) + return result.release(); + + return 0; +} + +#if !defined (_STLP_NO_WCHAR_T) +static wfilebuf* +_Stl_create_wfilebuf(FILE* f, ios_base::openmode mode) { + auto_ptr result(new basic_filebuf >()); + result->_M_open(_FILE_fd(f), mode); + + if (result->is_open()) + return result.release(); + + return 0; +} +#endif + +void _STLP_CALL ios_base::_S_initialize() { +#if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE) + using _STLP_PRIV stdio_istreambuf; + using _STLP_PRIV stdio_ostreambuf; +#endif + + auto_ptr cin_buf; + auto_ptr cout_buf; + auto_ptr cerr_buf; + auto_ptr clog_buf; + + if (_S_is_synced) + cin_buf.reset(new stdio_istreambuf(stdin)); + else + cin_buf.reset(_Stl_create_filebuf(stdin, ios_base::in)); + + if (_S_is_synced) { +#ifdef _STLP_REDIRECT_STDSTREAMS + cout_buf.reset(_Stl_create_filebuf("/stdout.txt", ios::out)); + cerr_buf.reset(_Stl_create_filebuf("/stderr.txt", ios::out)); + clog_buf.reset(_Stl_create_filebuf("/stdlog.txt", ios::out)); +#else + cout_buf.reset(new stdio_ostreambuf(stdout)); + cerr_buf.reset(new stdio_ostreambuf(stderr)); + clog_buf.reset(new stdio_ostreambuf(stderr)); +#endif + } + else { + cout_buf.reset(_Stl_create_filebuf(stdout, ios_base::out)); + cerr_buf.reset(_Stl_create_filebuf(stderr, ios_base::out)); + clog_buf.reset(_Stl_create_filebuf(stderr, ios_base::out)); + } + + istream* ptr_cin = new(&cin) istream(cin_buf.get()); cin_buf.release(); + ostream* ptr_cout = new(&cout) ostream(cout_buf.get()); cout_buf.release(); + ostream* ptr_cerr = new(&cerr) ostream(cerr_buf.get()); cerr_buf.release(); + /*ostream* ptr_clog = */ new(&clog) ostream(clog_buf.get()); clog_buf.release(); + ptr_cin->tie(ptr_cout); + ptr_cerr->setf(ios_base::unitbuf); + +#ifndef _STLP_NO_WCHAR_T + auto_ptr win(_Stl_create_wfilebuf(stdin, ios_base::in)); + auto_ptr wout(_Stl_create_wfilebuf(stdout, ios_base::out)); + auto_ptr werr(_Stl_create_wfilebuf(stderr, ios_base::out)); + auto_ptr wlog(_Stl_create_wfilebuf(stderr, ios_base::out)); + + // Run constructors for the four wide stream objects. + wistream* ptr_wcin = new(&wcin) wistream(win.get()); win.release(); + wostream* ptr_wcout = new(&wcout) wostream(wout.get()); wout.release(); + wostream* ptr_wcerr = new(&wcerr) wostream(werr.get()); werr.release(); + /*wostream* ptr_wclog = */ new(&wclog) wostream(wlog.get()); wlog.release(); + + ptr_wcin->tie(ptr_wcout); + ptr_wcerr->setf(ios_base::unitbuf); +#endif +} + +void _STLP_CALL ios_base::_S_uninitialize() { + // Note that destroying output streambufs flushes the buffers. + istream* ptr_cin = &cin; + ostream* ptr_cout = &cout; + ostream* ptr_cerr = &cerr; + ostream* ptr_clog = &clog; + + // We don't want any exceptions being thrown here + ptr_cin->exceptions(0); + ptr_cout->exceptions(0); + ptr_cerr->exceptions(0); + ptr_clog->exceptions(0); + + delete ptr_cin->rdbuf(0); + delete ptr_cout->rdbuf(0); + delete ptr_cerr->rdbuf(0); + delete ptr_clog->rdbuf(0); + + _Destroy(ptr_cin); + _Destroy(ptr_cout); + _Destroy(ptr_cerr); + _Destroy(ptr_clog); + +#ifndef _STLP_NO_WCHAR_T + wistream* ptr_wcin = &wcin; + wostream* ptr_wcout = &wcout; + wostream* ptr_wcerr = &wcerr; + wostream* ptr_wclog = &wclog; + + // We don't want any exceptions being thrown here + ptr_wcin->exceptions(0); + ptr_wcout->exceptions(0); + ptr_wcerr->exceptions(0); + ptr_wclog->exceptions(0); + + delete ptr_wcin->rdbuf(0); + delete ptr_wcout->rdbuf(0); + delete ptr_wcerr->rdbuf(0); + delete ptr_wclog->rdbuf(0); + + _Destroy(ptr_wcin); + _Destroy(ptr_wcout); + _Destroy(ptr_wcerr); + _Destroy(ptr_wclog); +#endif +} + + +bool _STLP_CALL ios_base::sync_with_stdio(bool sync) { +# if !defined (_STLP_HAS_NO_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE) + using _STLP_PRIV stdio_istreambuf; + using _STLP_PRIV stdio_ostreambuf; +# endif + + if (sync == _S_is_synced) return sync; + + // if by any chance we got there before std streams initialization, + // just set the sync flag and exit + if (Init::_S_count == 0) { + _S_is_synced = sync; + return sync; + } + + auto_ptr cin_buf; + auto_ptr cout_buf; + auto_ptr cerr_buf; + auto_ptr clog_buf; + + if (sync) + cin_buf.reset(new stdio_istreambuf(stdin)); + else + cin_buf.reset(_Stl_create_filebuf(stdin, ios_base::in)); + + if (sync) { +#ifdef _STLP_REDIRECT_STDSTREAMS + cout_buf.reset(_Stl_create_filebuf("/stdout.txt", ios::out)); + cerr_buf.reset(_Stl_create_filebuf("/stderr.txt", ios::out)); + clog_buf.reset(_Stl_create_filebuf("/stdlog.txt", ios::out)); +#else + cout_buf.reset(new stdio_ostreambuf(stdout)); + cerr_buf.reset(new stdio_ostreambuf(stderr)); + clog_buf.reset(new stdio_ostreambuf(stderr)); +#endif + } + else { + cout_buf.reset(_Stl_create_filebuf(stdout, ios_base::out)); + cerr_buf.reset(_Stl_create_filebuf(stderr, ios_base::out)); + clog_buf.reset(_Stl_create_filebuf(stderr, ios_base::out)); + } + + if (cin_buf.get() != 0 && cout_buf.get() != 0 && cerr_buf.get() != 0 && clog_buf.get() != 0) { + // When streambuf passed to rdbuf is not null, rdbuf is exception safe: + delete (&cin)->rdbuf(cin_buf.release()); + delete (&cout)->rdbuf(cout_buf.release()); + delete (&cerr)->rdbuf(cerr_buf.release()); + delete (&clog)->rdbuf(clog_buf.release()); + _S_is_synced = sync; + } + + return _S_is_synced; +} + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/istream.cpp b/sdk/tlibstdcxx/src/istream.cpp new file mode 100644 index 0000000000..715364cd6c --- /dev/null +++ b/sdk/tlibstdcxx/src/istream.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +# include "stlport_prefix.h" + +#include + +_STLP_BEGIN_NAMESPACE + +#if !defined(_STLP_NO_FORCE_INSTANTIATE) + +// instantiations +# if defined (_STLP_USE_TEMPLATE_EXPORT) +template class _STLP_CLASS_DECLSPEC _Isentry >; +# endif + +template class _STLP_CLASS_DECLSPEC basic_iostream >; +template class _STLP_CLASS_DECLSPEC basic_istream >; + +# if !defined (_STLP_NO_WCHAR_T) +# if defined (_STLP_USE_TEMPLATE_EXPORT) +template class _STLP_CLASS_DECLSPEC _Isentry >; +# endif +template class _STLP_CLASS_DECLSPEC basic_istream >; +template class _STLP_CLASS_DECLSPEC basic_iostream >; +# endif /* !_STLP_NO_WCHAR_T */ + +#endif /* _STLP_NO_FORCE_INSTANTIATE */ + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/locale.cpp b/sdk/tlibstdcxx/src/locale.cpp new file mode 100644 index 0000000000..8df976b602 --- /dev/null +++ b/sdk/tlibstdcxx/src/locale.cpp @@ -0,0 +1,445 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include + +#include "c_locale.h" +#include "locale_impl.h" + +_STLP_BEGIN_NAMESPACE + +static const string _Nameless("*"); + +static inline bool is_C_locale_name (const char* name) +{ return ((name[0] == 'C') && (name[1] == 0)); } + +locale* _Stl_get_classic_locale(); +locale* _Stl_get_global_locale(); + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ + defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) +# define locale _STLP_NO_MEM_T_NAME(loc) +#endif + +locale::facet::~facet() {} + +#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) +// members that fail to be templates +bool locale::operator()(const string& __x, + const string& __y) const +{ return __locale_do_operator_call(*this, __x, __y); } + +# if !defined (_STLP_NO_WCHAR_T) +bool locale::operator()(const wstring& __x, + const wstring& __y) const +{ return __locale_do_operator_call(*this, __x, __y); } +# endif +#endif + +void _STLP_CALL locale::_M_throw_on_null_name() +{ _STLP_THROW(runtime_error("Invalid null locale name")); } + +void _STLP_CALL locale::_M_throw_on_combine_error(const string& name) { + string what = "Unable to find facet"; + what += " in "; + what += name.empty() ? "system" : name.c_str(); + what += " locale"; + _STLP_THROW(runtime_error(what.c_str())); +} + +void _STLP_CALL locale::_M_throw_on_creation_failure(int __err_code, + const char* name, const char* facet) { + string what; + switch (__err_code) { + case _STLP_LOC_UNSUPPORTED_FACET_CATEGORY: + what = "No platform localization support for "; + what += facet; + what += " facet category, unable to create facet for "; + what += name[0] == 0 ? "system" : name; + what += " locale"; + break; + case _STLP_LOC_NO_PLATFORM_SUPPORT: + what = "No platform localization support, unable to create "; + what += name[0] == 0 ? "system" : name; + what += " locale"; + break; + default: + case _STLP_LOC_UNKNOWN_NAME: + what = "Unable to create facet "; + what += facet; + what += " from name '"; + what += name; + what += "'"; + break; + case _STLP_LOC_NO_MEMORY: + _STLP_THROW_BAD_ALLOC; + break; + } + + _STLP_THROW(runtime_error(what.c_str())); +} + +// Takes a reference to a locale::id, assign a numeric index if not already +// affected and returns it. The returned index is always positive. +static const locale::id& _Stl_loc_get_index(locale::id& id) { + if (id._M_index == 0) { +#if defined (_STLP_ATOMIC_INCREMENT) && !defined (_STLP_WIN95_LIKE) + static _STLP_VOLATILE __stl_atomic_t _S_index = __STATIC_CAST(__stl_atomic_t, locale::id::_S_max); + id._M_index = _STLP_ATOMIC_INCREMENT(&_S_index); +#else + static _STLP_STATIC_MUTEX _Index_lock _STLP_MUTEX_INITIALIZER; + _STLP_auto_lock sentry(_Index_lock); + size_t new_index = locale::id::_S_max++; + id._M_index = new_index; +#endif + } + return id; +} + +// Default constructor: create a copy of the global locale. +locale::locale() _STLP_NOTHROW + : _M_impl(_get_Locale_impl(_Stl_get_global_locale()->_M_impl)) +{} + +// Copy constructor +locale::locale(const locale& L) _STLP_NOTHROW + : _M_impl( _get_Locale_impl( L._M_impl ) ) +{} + +void locale::_M_insert(facet* f, locale::id& n) { + if (f) + _M_impl->insert(f, _Stl_loc_get_index(n)); +} + +locale::locale( _Locale_impl* impl ) : + _M_impl( _get_Locale_impl( impl ) ) +{} + +// Create a locale from a name. +locale::locale(const char* name) + : _M_impl(0) { + if (!name) + _M_throw_on_null_name(); + + if (is_C_locale_name(name)) { + _M_impl = _get_Locale_impl( locale::classic()._M_impl ); + return; + } + + _Locale_impl* impl = 0; + _STLP_TRY { + impl = new _Locale_impl(locale::id::_S_max, name); + + // Insert categories one at a time. + _Locale_name_hint *hint = 0; + const char* ctype_name = name; + char ctype_buf[_Locale_MAX_SIMPLE_NAME]; + const char* numeric_name = name; + char numeric_buf[_Locale_MAX_SIMPLE_NAME]; + const char* time_name = name; + char time_buf[_Locale_MAX_SIMPLE_NAME]; + const char* collate_name = name; + char collate_buf[_Locale_MAX_SIMPLE_NAME]; + const char* monetary_name = name; + char monetary_buf[_Locale_MAX_SIMPLE_NAME]; + const char* messages_name = name; + char messages_buf[_Locale_MAX_SIMPLE_NAME]; + hint = impl->insert_ctype_facets(ctype_name, ctype_buf, hint); + hint = impl->insert_numeric_facets(numeric_name, numeric_buf, hint); + hint = impl->insert_time_facets(time_name, time_buf, hint); + hint = impl->insert_collate_facets(collate_name, collate_buf, hint); + hint = impl->insert_monetary_facets(monetary_name, monetary_buf, hint); + impl->insert_messages_facets(messages_name, messages_buf, hint); + + // Try to use a normalize locale name in order to have the == operator + // to behave correctly: + if (strcmp(ctype_name, numeric_name) == 0 && + strcmp(ctype_name, time_name) == 0 && + strcmp(ctype_name, collate_name) == 0 && + strcmp(ctype_name, monetary_name) == 0 && + strcmp(ctype_name, messages_name) == 0) { + impl->name = ctype_name; + } + // else we keep current name. + + // reassign impl + _M_impl = _get_Locale_impl( impl ); + } + _STLP_UNWIND(delete impl); +} + +static void _Stl_loc_combine_names_aux(_Locale_impl* L, + const char* name, + const char* ctype_name, const char* time_name, const char* numeric_name, + const char* collate_name, const char* monetary_name, const char* messages_name, + locale::category c) { + // This function is only called when names has been validated so using _Locale_extract_*_name + // can't fail. + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + L->name = string("LC_CTYPE=") + _Locale_extract_ctype_name((c & locale::ctype) ? ctype_name : name, buf, 0, &__err_code) + ";"; + L->name += string("LC_TIME=") + _Locale_extract_time_name((c & locale::time) ? time_name : name, buf, 0, &__err_code) + ";"; + L->name += string("LC_NUMERIC=") + _Locale_extract_numeric_name((c & locale::numeric) ? numeric_name : name, buf, 0, &__err_code) + ";"; + L->name += string("LC_COLLATE=") + _Locale_extract_collate_name((c & locale::collate) ? collate_name : name, buf, 0, &__err_code) + ";"; + L->name += string("LC_MONETARY=") + _Locale_extract_monetary_name((c & locale::monetary) ? monetary_name : name, buf, 0, &__err_code) + ";"; + L->name += string("LC_MESSAGES=") + _Locale_extract_messages_name((c & locale::messages) ? messages_name : name, buf, 0, &__err_code); +} + +// Give L a name where all facets except those in category c +// are taken from name1, and those in category c are taken from name2. +static void _Stl_loc_combine_names(_Locale_impl* L, + const char* name1, const char* name2, + locale::category c) { + if ((c & locale::all) == 0 || strcmp(name1, name1) == 0) + L->name = name1; + else if ((c & locale::all) == locale::all) + L->name = name2; + else { + _Stl_loc_combine_names_aux(L, name1, name2, name2, name2, name2, name2, name2, c); + } +} + +static void _Stl_loc_combine_names(_Locale_impl* L, + const char* name, + const char* ctype_name, const char* time_name, const char* numeric_name, + const char* collate_name, const char* monetary_name, const char* messages_name, + locale::category c) { + if ((c & locale::all) == 0 || (strcmp(name, ctype_name) == 0 && + strcmp(name, time_name) == 0 && + strcmp(name, numeric_name) == 0 && + strcmp(name, collate_name) == 0 && + strcmp(name, monetary_name) == 0 && + strcmp(name, messages_name) == 0)) + L->name = name; + else if ((c & locale::all) == locale::all && strcmp(ctype_name, time_name) == 0 && + strcmp(ctype_name, numeric_name) == 0 && + strcmp(ctype_name, collate_name) == 0 && + strcmp(ctype_name, monetary_name) == 0 && + strcmp(ctype_name, messages_name) == 0) + L->name = ctype_name; + else { + _Stl_loc_combine_names_aux(L, name, ctype_name, time_name, numeric_name, collate_name, monetary_name, messages_name, c); + } +} + + +// Create a locale that's a copy of L, except that all of the facets +// in category c are instead constructed by name. +locale::locale(const locale& L, const char* name, locale::category c) + : _M_impl(0) { + if (!name) + _M_throw_on_null_name(); + + if (_Nameless == name) + _STLP_THROW(runtime_error((string("Invalid locale name '") + _Nameless + "'").c_str())); + + _Locale_impl* impl = 0; + + _STLP_TRY { + impl = new _Locale_impl(*L._M_impl); + + _Locale_name_hint *hint = 0; + const char* ctype_name = name; + char ctype_buf[_Locale_MAX_SIMPLE_NAME]; + const char* numeric_name = name; + char numeric_buf[_Locale_MAX_SIMPLE_NAME]; + const char* time_name = name; + char time_buf[_Locale_MAX_SIMPLE_NAME]; + const char* collate_name = name; + char collate_buf[_Locale_MAX_SIMPLE_NAME]; + const char* monetary_name = name; + char monetary_buf[_Locale_MAX_SIMPLE_NAME]; + const char* messages_name = name; + char messages_buf[_Locale_MAX_SIMPLE_NAME]; + if (c & locale::ctype) + hint = impl->insert_ctype_facets(ctype_name, ctype_buf, hint); + if (c & locale::numeric) + hint = impl->insert_numeric_facets(numeric_name, numeric_buf, hint); + if (c & locale::time) + hint = impl->insert_time_facets(time_name, time_buf, hint); + if (c & locale::collate) + hint = impl->insert_collate_facets(collate_name, collate_buf, hint); + if (c & locale::monetary) + hint = impl->insert_monetary_facets(monetary_name, monetary_buf,hint); + if (c & locale::messages) + impl->insert_messages_facets(messages_name, messages_buf, hint); + + _Stl_loc_combine_names(impl, L._M_impl->name.c_str(), + ctype_name, time_name, numeric_name, + collate_name, monetary_name, messages_name, c); + _M_impl = _get_Locale_impl( impl ); + } + _STLP_UNWIND(delete impl) +} + +// Contruct a new locale where all facets that aren't in category c +// come from L1, and all those that are in category c come from L2. +locale::locale(const locale& L1, const locale& L2, category c) + : _M_impl(0) { + _Locale_impl* impl = new _Locale_impl(*L1._M_impl); + + _Locale_impl* i2 = L2._M_impl; + + if (L1.name() != _Nameless && L2.name() != _Nameless) + _Stl_loc_combine_names(impl, L1._M_impl->name.c_str(), L2._M_impl->name.c_str(), c); + else { + impl->name = _Nameless; + } + + if (c & collate) { + impl->insert( i2, _STLP_STD::collate::id); +# ifndef _STLP_NO_WCHAR_T + impl->insert( i2, _STLP_STD::collate::id); +# endif + } + if (c & ctype) { + impl->insert( i2, _STLP_STD::ctype::id); + impl->insert( i2, _STLP_STD::codecvt::id); +# ifndef _STLP_NO_WCHAR_T + impl->insert( i2, _STLP_STD::ctype::id); + impl->insert( i2, _STLP_STD::codecvt::id); +# endif + } + if (c & monetary) { + impl->insert( i2, _STLP_STD::moneypunct::id); + impl->insert( i2, _STLP_STD::moneypunct::id); + impl->insert( i2, _STLP_STD::money_get > >::id); + impl->insert( i2, _STLP_STD::money_put > >::id); +# ifndef _STLP_NO_WCHAR_T + impl->insert( i2, _STLP_STD::moneypunct::id); + impl->insert( i2, _STLP_STD::moneypunct::id); + impl->insert( i2, _STLP_STD::money_get > >::id); + impl->insert( i2, _STLP_STD::money_put > >::id); +# endif + } + if (c & numeric) { + impl->insert( i2, _STLP_STD::numpunct::id); + impl->insert( i2, _STLP_STD::num_get > >::id); + impl->insert( i2, _STLP_STD::num_put > >::id); +# ifndef _STLP_NO_WCHAR_T + impl->insert( i2, _STLP_STD::numpunct::id); + impl->insert( i2, _STLP_STD::num_get > >::id); + impl->insert( i2, _STLP_STD::num_put > >::id); +# endif + } + if (c & time) { + impl->insert( i2, _STLP_STD::time_get > >::id); + impl->insert( i2, _STLP_STD::time_put > >::id); +# ifndef _STLP_NO_WCHAR_T + impl->insert( i2, _STLP_STD::time_get > >::id); + impl->insert( i2, _STLP_STD::time_put > >::id); +# endif + } + if (c & messages) { + impl->insert( i2, _STLP_STD::messages::id); +# ifndef _STLP_NO_WCHAR_T + impl->insert( i2, _STLP_STD::messages::id); +# endif + } + _M_impl = _get_Locale_impl( impl ); +} + +// Destructor. +locale::~locale() _STLP_NOTHROW { + if (_M_impl) + _release_Locale_impl(_M_impl); +} + +// Assignment operator. Much like the copy constructor: just a bit of +// pointer twiddling. +const locale& locale::operator=(const locale& L) _STLP_NOTHROW { + if (this->_M_impl != L._M_impl) { + if (this->_M_impl) + _release_Locale_impl(this->_M_impl); + this->_M_impl = _get_Locale_impl(L._M_impl); + } + return *this; +} + +locale::facet* locale::_M_get_facet(const locale::id& n) const { + return n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0; +} + +locale::facet* locale::_M_use_facet(const locale::id& n) const { + locale::facet* f = (n._M_index < _M_impl->size() ? _M_impl->facets_vec[n._M_index] : 0); + if (!f) + _M_impl->_M_throw_bad_cast(); + return f; +} + +string locale::name() const { + return _M_impl->name; +} + +// Compare two locales for equality. +bool locale::operator==(const locale& L) const { + return this->_M_impl == L._M_impl || + (this->name() == L.name() && this->name() != _Nameless); +} + +bool locale::operator!=(const locale& L) const { + return !(*this == L); +} + +// static data members. + +const locale& _STLP_CALL locale::classic() { + return *_Stl_get_classic_locale(); +} + +#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +locale _STLP_CALL locale::global(const locale& L) { +#else +_Locale_impl* _STLP_CALL locale::global(const locale& L) { +#endif + locale old(_Stl_get_global_locale()->_M_impl); + if (_Stl_get_global_locale()->_M_impl != L._M_impl) { + _release_Locale_impl(_Stl_get_global_locale()->_M_impl); + // this assign should be atomic, should be fixed here: + _Stl_get_global_locale()->_M_impl = _get_Locale_impl(L._M_impl); + + // Set the global C locale, if appropriate. +#if !defined(_STLP_NO_LOCALE_SUPPORT) + if (L.name() != _Nameless) + setlocale(LC_ALL, L.name().c_str()); +#endif + } + +#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + return old; +#else + return old._M_impl; +#endif +} + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) +const locale::category locale::none; +const locale::category locale::collate; +const locale::category locale::ctype; +const locale::category locale::monetary; +const locale::category locale::numeric; +const locale::category locale::time; +const locale::category locale::messages; +const locale::category locale::all; +#endif + +_STLP_END_NAMESPACE + diff --git a/sdk/tlibstdcxx/src/locale_catalog.cpp b/sdk/tlibstdcxx/src/locale_catalog.cpp new file mode 100644 index 0000000000..31e672e838 --- /dev/null +++ b/sdk/tlibstdcxx/src/locale_catalog.cpp @@ -0,0 +1,288 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include + +#include +#include + +#include "c_locale.h" +#include "locale_impl.h" +#include "acquire_release.h" + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Those wrappers are needed to use locale functions in __acquire_category, +// all functions have to present the same prototype. + +static void* _Loc_ctype_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_ctype_create(s, hint, __err_code); } +static void* _Loc_codecvt_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_codecvt_create(s, hint, __err_code); } +static void* _Loc_numeric_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_numeric_create(s, hint, __err_code); } +static void* _Loc_time_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_time_create(s, hint, __err_code); } +static void* _Loc_collate_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_collate_create(s, hint, __err_code); } +static void* _Loc_monetary_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_monetary_create(s, hint, __err_code); } +static void* _Loc_messages_create(const char * s, _Locale_name_hint* hint, int *__err_code) +{ return _Locale_messages_create(s, hint, __err_code); } + +static char const* _Loc_ctype_name(void* l, char* s) +{ return _Locale_ctype_name((_Locale_ctype*)l, s); } +static char const* _Loc_codecvt_name(void* l, char* s) +{ return _Locale_codecvt_name((_Locale_codecvt*)l, s); } +static char const* _Loc_numeric_name(void* l, char* s) +{ return _Locale_numeric_name((_Locale_numeric*)l, s); } +static char const* _Loc_time_name(void* l, char* s) +{ return _Locale_time_name((_Locale_time*)l, s); } +static char const* _Loc_collate_name(void* l, char* s) +{ return _Locale_collate_name((_Locale_collate*)l, s); } +static char const* _Loc_monetary_name(void* l, char* s) +{ return _Locale_monetary_name((_Locale_monetary*)l, s); } +static char const* _Loc_messages_name(void* l, char* s) +{ return _Locale_messages_name((_Locale_messages*)l, s); } + +static const char* _Loc_ctype_default(char* p) +{ return _Locale_ctype_default(p); } +static const char* _Loc_numeric_default(char * p) +{ return _Locale_numeric_default(p); } +static const char* _Loc_time_default(char* p) +{ return _Locale_time_default(p); } +static const char* _Loc_collate_default(char* p) +{ return _Locale_collate_default(p); } +static const char* _Loc_monetary_default(char* p) +{ return _Locale_monetary_default(p); } +static const char* _Loc_messages_default(char* p) +{ return _Locale_messages_default(p); } + +static void _Loc_ctype_destroy(void* p) {_Locale_ctype_destroy((_Locale_ctype*)p); } +static void _Loc_codecvt_destroy(void* p) {_Locale_codecvt_destroy((_Locale_codecvt*)p); } +static void _Loc_numeric_destroy(void* p) {_Locale_numeric_destroy((_Locale_numeric*)p); } +static void _Loc_time_destroy(void* p) {_Locale_time_destroy((_Locale_time*)p);} +static void _Loc_collate_destroy(void* p) {_Locale_collate_destroy((_Locale_collate*)p);} +static void _Loc_monetary_destroy(void* p) {_Locale_monetary_destroy((_Locale_monetary*)p);} +static void _Loc_messages_destroy(void* p) {_Locale_messages_destroy((_Locale_messages*)p);} + +typedef void* (*loc_create_func_t)(const char *, _Locale_name_hint*, int *__err_code); +typedef char const* (*loc_name_func_t)(void* l, char* s); +typedef void (*loc_destroy_func_t)(void* l); +typedef const char* (*loc_default_name_func_t)(char* s); +typedef char const* (*loc_extract_name_func_t)(const char*, char*, _Locale_name_hint*, int *__err_code); + +//---------------------------------------------------------------------- +// Acquire and release low-level category objects. The whole point of +// this is so that we don't allocate (say) four different _Locale_ctype +// objects for a single locale. + +// Global hash tables for category objects. +typedef hash_map, hash, equal_to > Category_Map; + +// Look up a category by name +static Category_Map** ctype_hash() { + static Category_Map *_S_ctype_hash = 0; + return &_S_ctype_hash; +} +static Category_Map** codecvt_hash() { + static Category_Map *_S_codecvt_hash = 0; + return &_S_codecvt_hash; +} +static Category_Map** numeric_hash() { + static Category_Map *_S_numeric_hash = 0; + return &_S_numeric_hash; +} +static Category_Map** time_hash() { + static Category_Map *_S_time_hash = 0; + return &_S_time_hash; +} +static Category_Map** collate_hash() { + static Category_Map *_S_collate_hash = 0; + return &_S_collate_hash; +} +static Category_Map** monetary_hash() { + static Category_Map *_S_monetary_hash = 0; + return &_S_monetary_hash; +} +static Category_Map** messages_hash() { + static Category_Map *_S_messages_hash; + return &_S_messages_hash; +} + +// We have a single lock for all of the hash tables. We may wish to +// replace it with six different locks. +/* REFERENCED */ +static _STLP_STATIC_MUTEX& category_hash_mutex() { + static _STLP_STATIC_MUTEX lock _STLP_MUTEX_INITIALIZER; + return lock; +} + +static void* +__acquire_category(const char* &name, char *buf, _Locale_name_hint* hint, + loc_extract_name_func_t extract_name, + loc_create_func_t create_obj, loc_default_name_func_t default_name, + Category_Map ** M, int *__err_code) { +#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564) + typedef Category_Map::iterator Category_iterator; + pair result; +#else +# if !defined(_STLP_DEBUG) + pair<_Ht_iterator<_Slist_iterator >,_Nonconst_traits > > >,_NonLocalHashMapTraitsT > > >, bool> result; +# else + pair<_DBG_iter<_NonDbg_hashtable >,string,hash,_HashMapTraitsT > >,_Select1st > >,_DbgEqual >,allocator > > >,_DbgTraits<_NonLocalHashMapTraitsT > > > >, bool> result; +# endif +#endif + + *__err_code = _STLP_LOC_UNDEFINED; + + // Find what name to look for. Be careful if user requests the default. + if (name[0] == 0) { + name = default_name(buf); + if (name == 0 || name[0] == 0) + name = "C"; + } + else { + const char* cname = extract_name(name, buf, hint, __err_code); + if (cname == 0) { + return 0; + } + name = cname; + } + + Category_Map::value_type __e(name, pair((void*)0,size_t(0))); + + _STLP_auto_lock sentry(category_hash_mutex()); + + if (!*M) + *M = new Category_Map(); + + // Look for an existing entry with that name. + result = (*M)->insert_noresize(__e); + + if (result.second) { + // There was no entry in the map already. Create the category. + (*result.first).second.first = create_obj(name, hint, __err_code); + if (!(*result.first).second.first) { + (*M)->erase(result.first); +#if defined (_STLP_LEAKS_PEDANTIC) + if ((*M)->empty()) { + delete *M; + *M = 0; + } +#endif + return 0; + } + } + + // Increment the reference count. + ++((*result.first).second.second); + + return (*result.first).second.first; +} + +static void +__release_category(void* cat, + loc_destroy_func_t destroy_fun, + loc_name_func_t get_name, + Category_Map** M) { + Category_Map *pM = *M; + + if (cat && pM) { + // Find the name of the category object. + char buf[_Locale_MAX_SIMPLE_NAME + 1]; + char const* name = get_name(cat, buf); + + if (name != 0) { + _STLP_auto_lock sentry(category_hash_mutex()); + Category_Map::iterator it = pM->find(name); + if (it != pM->end()) { + // Decrement the ref count. If it goes to zero, delete this category + // from the map. + if (--((*it).second.second) == 0) { + void* cat1 = (*it).second.first; + destroy_fun(cat1); + pM->erase(it); +#if defined (_STLP_LEAKS_PEDANTIC) + if (pM->empty()) { + delete pM; + *M = 0; + } +#endif + } + } + } + } +} + +_Locale_ctype* _STLP_CALL __acquire_ctype(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_ctype*, __acquire_category(name, buf, hint, + _Locale_extract_ctype_name, _Loc_ctype_create, _Loc_ctype_default, + ctype_hash(), __err_code)); +} +_Locale_codecvt* _STLP_CALL __acquire_codecvt(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_codecvt*, __acquire_category(name, buf, hint, + _Locale_extract_ctype_name, _Loc_codecvt_create, _Loc_ctype_default, + codecvt_hash(), __err_code)); +} +_Locale_numeric* _STLP_CALL __acquire_numeric(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_numeric*, __acquire_category(name, buf, hint, + _Locale_extract_numeric_name, _Loc_numeric_create, _Loc_numeric_default, + numeric_hash(), __err_code)); +} +_Locale_time* _STLP_CALL __acquire_time(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_time*, __acquire_category(name, buf, hint, + _Locale_extract_time_name, _Loc_time_create, _Loc_time_default, + time_hash(), __err_code)); +} +_Locale_collate* _STLP_CALL __acquire_collate(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_collate*, __acquire_category(name, buf, hint, + _Locale_extract_collate_name, _Loc_collate_create, _Loc_collate_default, + collate_hash(), __err_code)); +} +_Locale_monetary* _STLP_CALL __acquire_monetary(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_monetary*, __acquire_category(name, buf, hint, + _Locale_extract_monetary_name, _Loc_monetary_create, _Loc_monetary_default, + monetary_hash(), __err_code)); +} +_Locale_messages* _STLP_CALL __acquire_messages(const char* &name, char *buf, _Locale_name_hint* hint, int *__err_code) { + return __REINTERPRET_CAST(_Locale_messages*, __acquire_category(name, buf, hint, + _Locale_extract_messages_name, _Loc_messages_create, _Loc_messages_default, + messages_hash(), __err_code)); +} + +void _STLP_CALL __release_ctype(_Locale_ctype* cat) +{ __release_category(cat, _Loc_ctype_destroy, _Loc_ctype_name, ctype_hash()); } +void _STLP_CALL __release_codecvt(_Locale_codecvt* cat) +{ __release_category(cat, _Loc_codecvt_destroy, _Loc_codecvt_name, codecvt_hash()); } +void _STLP_CALL __release_numeric(_Locale_numeric* cat) +{ __release_category(cat, _Loc_numeric_destroy, _Loc_numeric_name, numeric_hash()); } +void _STLP_CALL __release_time(_Locale_time* cat) +{ __release_category(cat, _Loc_time_destroy, _Loc_time_name, time_hash()); } +void _STLP_CALL __release_collate(_Locale_collate* cat) +{ __release_category(cat, _Loc_collate_destroy, _Loc_collate_name, collate_hash()); } +void _STLP_CALL __release_monetary(_Locale_monetary* cat) +{ __release_category(cat, _Loc_monetary_destroy, _Loc_monetary_name, monetary_hash()); } +void _STLP_CALL __release_messages(_Locale_messages* cat) +{ __release_category(cat, _Loc_messages_destroy, _Loc_messages_name, messages_hash()); } + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/locale_impl.cpp b/sdk/tlibstdcxx/src/locale_impl.cpp new file mode 100644 index 0000000000..103b60336f --- /dev/null +++ b/sdk/tlibstdcxx/src/locale_impl.cpp @@ -0,0 +1,765 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include +#include + +#include "c_locale.h" +#include "aligned_buffer.h" +#include "acquire_release.h" +#include "locale_impl.h" + +_STLP_BEGIN_NAMESPACE + +static const string _Nameless("*"); + +static inline bool is_C_locale_name (const char* name) +{ return ((name[0] == 'C') && (name[1] == 0)); } + +locale::facet * _STLP_CALL _get_facet(locale::facet *f) +{ + if (f != 0) + f->_M_incr(); + return f; +} + +void _STLP_CALL _release_facet(locale::facet *&f) +{ + if ((f != 0) && (f->_M_decr() == 0)) { + delete f; + f = 0; + } +} + +size_t locale::id::_S_max = 27; + +static void _Stl_loc_assign_ids(); + +static _Stl_aligned_buffer<_Locale_impl::Init> __Loc_init_buf; + +_Locale_impl::Init::Init() { + if (_M_count()._M_incr() == 1) { + _Locale_impl::_S_initialize(); + } +} + +_Locale_impl::Init::~Init() { + if (_M_count()._M_decr() == 0) { + _Locale_impl::_S_uninitialize(); + } +} + +_Refcount_Base& _Locale_impl::Init::_M_count() const { + static _Refcount_Base _S_count(0); + return _S_count; +} + +_Locale_impl::_Locale_impl(const char* s) + : _Refcount_Base(0), name(s), facets_vec() { + facets_vec.reserve( locale::id::_S_max ); + new (&__Loc_init_buf) Init(); +} + +_Locale_impl::_Locale_impl( _Locale_impl const& locimpl ) + : _Refcount_Base(0), name(locimpl.name), facets_vec() { + for_each( locimpl.facets_vec.begin(), locimpl.facets_vec.end(), _get_facet); + facets_vec = locimpl.facets_vec; + new (&__Loc_init_buf) Init(); +} + +_Locale_impl::_Locale_impl( size_t n, const char* s) + : _Refcount_Base(0), name(s), facets_vec(n, 0) { + new (&__Loc_init_buf) Init(); +} + +_Locale_impl::~_Locale_impl() { + (&__Loc_init_buf)->~Init(); + for_each( facets_vec.begin(), facets_vec.end(), _release_facet); +} + +// Initialization of the locale system. This must be called before +// any locales are constructed. (Meaning that it must be called when +// the I/O library itself is initialized.) +void _STLP_CALL _Locale_impl::_S_initialize() { + _Stl_loc_assign_ids(); + make_classic_locale(); +} + +// Release of the classic locale ressources. Has to be called after the last +// locale destruction and not only after the classic locale destruction as +// the facets can be shared between different facets. +void _STLP_CALL _Locale_impl::_S_uninitialize() { + //Not necessary anymore as classic facets are now 'normal' dynamically allocated + //facets with a reference counter telling to _release_facet when the facet can be + //deleted. + //free_classic_locale(); +} + +// _Locale_impl non-inline member functions. +void _STLP_CALL _Locale_impl::_M_throw_bad_cast() { + _STLP_THROW(bad_cast()); +} + +void _Locale_impl::insert(_Locale_impl *from, const locale::id& n) { + if (n._M_index > 0 && n._M_index < from->size()) { + this->insert(from->facets_vec[n._M_index], n); + } +} + +locale::facet* _Locale_impl::insert(locale::facet *f, const locale::id& n) { + if (f == 0 || n._M_index == 0) + return 0; + + if (n._M_index >= facets_vec.size()) { + facets_vec.resize(n._M_index + 1); + } + + if (f != facets_vec[n._M_index]) + { + _release_facet(facets_vec[n._M_index]); + facets_vec[n._M_index] = _get_facet(f); + } + + return f; +} + +// +// content which is dependent on the name +// + +/* Six functions, one for each category. Each of them takes a + * a name, constructs that appropriate category facets by name, + * and inserts them into the locale. */ +_Locale_name_hint* _Locale_impl::insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint) { + if (name[0] == 0) + name = _Locale_ctype_default(buf); + + if (name == 0 || name[0] == 0 || is_C_locale_name(name)) { + _Locale_impl* i2 = locale::classic()._M_impl; + this->insert(i2, ctype::id); + this->insert(i2, codecvt::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, ctype::id); + this->insert(i2, codecvt::id); +#endif + } else { + locale::facet* ct = 0; + locale::facet* cvt = 0; +#ifndef _STLP_NO_WCHAR_T + locale::facet* wct = 0; + locale::facet* wcvt = 0; +#endif + int __err_code; + _Locale_ctype *__lct = _STLP_PRIV __acquire_ctype(name, buf, hint, &__err_code); + if (!__lct) { + locale::_M_throw_on_creation_failure(__err_code, name, "ctype"); + return hint; + } + + if (hint == 0) hint = _Locale_get_ctype_hint(__lct); + + _STLP_TRY { + ct = new ctype_byname(__lct); + } + _STLP_UNWIND(_STLP_PRIV __release_ctype(__lct)); + + _STLP_TRY { + cvt = new codecvt_byname(name); + } + _STLP_UNWIND(delete ct); + +#ifndef _STLP_NO_WCHAR_T + _STLP_TRY { + _Locale_ctype *__lwct = _STLP_PRIV __acquire_ctype(name, buf, hint, &__err_code); + if (!__lwct) { + locale::_M_throw_on_creation_failure(__err_code, name, "ctype"); + return hint; + } + + _STLP_TRY { + wct = new ctype_byname(__lwct); + } + _STLP_UNWIND(_STLP_PRIV __release_ctype(__lwct)); + + _Locale_codecvt *__lwcvt = _STLP_PRIV __acquire_codecvt(name, buf, hint, &__err_code); + if (__lwcvt) { + _STLP_TRY { + wcvt = new codecvt_byname(__lwcvt); + } + _STLP_UNWIND(_STLP_PRIV __release_codecvt(__lwcvt); delete wct); + } + } + _STLP_UNWIND(delete cvt; delete ct); +#endif + + this->insert(ct, ctype::id); + this->insert(cvt, codecvt::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(wct, ctype::id); + if (wcvt) this->insert(wcvt, codecvt::id); +#endif + } + return hint; +} + +_Locale_name_hint* _Locale_impl::insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint) { + if (name[0] == 0) + name = _Locale_numeric_default(buf); + + _Locale_impl* i2 = locale::classic()._M_impl; + + // We first insert name independant facets taken from the classic locale instance: + this->insert(i2, + num_put > >::id); + this->insert(i2, + num_get > >::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, + num_get > >::id); + this->insert(i2, + num_put > >::id); +#endif + + if (name == 0 || name[0] == 0 || is_C_locale_name(name)) { + this->insert(i2, numpunct::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, numpunct::id); +#endif + } + else { + locale::facet* punct = 0; +#ifndef _STLP_NO_WCHAR_T + locale::facet* wpunct = 0; +#endif + + int __err_code; + _Locale_numeric *__lpunct = _STLP_PRIV __acquire_numeric(name, buf, hint, &__err_code); + if (!__lpunct) { + locale::_M_throw_on_creation_failure(__err_code, name, "numpunct"); + return hint; + } + + if (hint == 0) hint = _Locale_get_numeric_hint(__lpunct); + _STLP_TRY { + punct = new numpunct_byname(__lpunct); + } + _STLP_UNWIND(_STLP_PRIV __release_numeric(__lpunct)); + +#ifndef _STLP_NO_WCHAR_T + _Locale_numeric *__lwpunct = _STLP_PRIV __acquire_numeric(name, buf, hint, &__err_code); + if (!__lwpunct) { + delete punct; + locale::_M_throw_on_creation_failure(__err_code, name, "numpunct"); + return hint; + } + if (__lwpunct) { + _STLP_TRY { + wpunct = new numpunct_byname(__lwpunct); + } + _STLP_UNWIND(_STLP_PRIV __release_numeric(__lwpunct); delete punct); + } +#endif + + this->insert(punct, numpunct::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(wpunct, numpunct::id); +#endif + } + return hint; +} + +_Locale_name_hint* _Locale_impl::insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint) { + if (name[0] == 0) + name = _Locale_time_default(buf); + + if (name == 0 || name[0] == 0 || is_C_locale_name(name)) { + _Locale_impl* i2 = locale::classic()._M_impl; + this->insert(i2, + time_get > >::id); + this->insert(i2, + time_put > >::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, + time_get > >::id); + this->insert(i2, + time_put > >::id); +#endif + } else { + locale::facet *get = 0; + locale::facet *put = 0; +#ifndef _STLP_NO_WCHAR_T + locale::facet *wget = 0; + locale::facet *wput = 0; +#endif + + int __err_code; + _Locale_time *__time = _STLP_PRIV __acquire_time(name, buf, hint, &__err_code); + if (!__time) { + // time facets category is not mandatory for correct stream behavior so if platform + // do not support it we do not generate a runtime_error exception. + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + return hint; + } + + if (!hint) hint = _Locale_get_time_hint(__time); + _STLP_TRY { + get = new time_get_byname > >(__time); + put = new time_put_byname > >(__time); +#ifndef _STLP_NO_WCHAR_T + wget = new time_get_byname > >(__time); + wput = new time_put_byname > >(__time); +#endif + } +#ifndef _STLP_NO_WCHAR_T + _STLP_UNWIND(delete wget; delete put; delete get; _STLP_PRIV __release_time(__time)); +#else + _STLP_UNWIND(delete get; _STLP_PRIV __release_time(__time)); +#endif + + _STLP_PRIV __release_time(__time); + + this->insert(get, time_get > >::id); + this->insert(put, time_put > >::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(wget, time_get > >::id); + this->insert(wput, time_put > >::id); +#endif + } + return hint; +} + +_Locale_name_hint* _Locale_impl::insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint) { + if (name[0] == 0) + name = _Locale_collate_default(buf); + + if (name == 0 || name[0] == 0 || is_C_locale_name(name)) { + _Locale_impl* i2 = locale::classic()._M_impl; + this->insert(i2, collate::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, collate::id); +#endif + } + else { + locale::facet *col = 0; +#ifndef _STLP_NO_WCHAR_T + locale::facet *wcol = 0; +#endif + + int __err_code; + _Locale_collate *__coll = _STLP_PRIV __acquire_collate(name, buf, hint, &__err_code); + if (!__coll) { + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + return hint; + } + + if (hint == 0) hint = _Locale_get_collate_hint(__coll); + _STLP_TRY { + col = new collate_byname(__coll); + } + _STLP_UNWIND(_STLP_PRIV __release_collate(__coll)); + +#ifndef _STLP_NO_WCHAR_T + _Locale_collate *__wcoll = _STLP_PRIV __acquire_collate(name, buf, hint, &__err_code); + if (!__wcoll) { + if (__err_code == _STLP_LOC_NO_MEMORY) { + delete col; + _STLP_THROW_BAD_ALLOC; + } + } + if (__wcoll) { + _STLP_TRY { + wcol = new collate_byname(__wcoll); + } + _STLP_UNWIND(_STLP_PRIV __release_collate(__wcoll); delete col); + } +#endif + + this->insert(col, collate::id); +#ifndef _STLP_NO_WCHAR_T + if (wcol) this->insert(wcol, collate::id); +#endif + } + return hint; +} + +_Locale_name_hint* _Locale_impl::insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint) { + if (name[0] == 0) + name = _Locale_monetary_default(buf); + + _Locale_impl* i2 = locale::classic()._M_impl; + + // We first insert name independant facets taken from the classic locale instance: + this->insert(i2, money_get > >::id); + this->insert(i2, money_put > >::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, money_get > >::id); + this->insert(i2, money_put > >::id); +#endif + + if (name == 0 || name[0] == 0 || is_C_locale_name(name)) { + this->insert(i2, moneypunct::id); + this->insert(i2, moneypunct::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, moneypunct::id); + this->insert(i2, moneypunct::id); +#endif + } + else { + locale::facet *punct = 0; + locale::facet *ipunct = 0; + +#ifndef _STLP_NO_WCHAR_T + locale::facet* wpunct = 0; + locale::facet* wipunct = 0; +#endif + + int __err_code; + _Locale_monetary *__mon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code); + if (!__mon) { + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + return hint; + } + + if (hint == 0) hint = _Locale_get_monetary_hint(__mon); + + _STLP_TRY { + punct = new moneypunct_byname(__mon); + } + _STLP_UNWIND(_STLP_PRIV __release_monetary(__mon)); + + _Locale_monetary *__imon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code); + if (!__imon) { + delete punct; + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + return hint; + } + + _STLP_TRY { + ipunct = new moneypunct_byname(__imon); + } + _STLP_UNWIND(_STLP_PRIV __release_monetary(__imon); delete punct); + +#ifndef _STLP_NO_WCHAR_T + _STLP_TRY { + _Locale_monetary *__wmon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code); + if (!__wmon) { + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + } + + if (__wmon) { + _STLP_TRY { + wpunct = new moneypunct_byname(__wmon); + } + _STLP_UNWIND(_STLP_PRIV __release_monetary(__wmon)); + + _Locale_monetary *__wimon = _STLP_PRIV __acquire_monetary(name, buf, hint, &__err_code); + if (!__wimon) { + delete wpunct; + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + wpunct = 0; + } + else { + _STLP_TRY { + wipunct = new moneypunct_byname(__wimon); + } + _STLP_UNWIND(_STLP_PRIV __release_monetary(__wimon); delete wpunct); + } + } + } + _STLP_UNWIND(delete ipunct; delete punct); +#endif + + this->insert(punct, moneypunct::id); + this->insert(ipunct, moneypunct::id); +#ifndef _STLP_NO_WCHAR_T + if (wpunct) this->insert(wpunct, moneypunct::id); + if (wipunct) this->insert(wipunct, moneypunct::id); +#endif + } + return hint; +} + +_Locale_name_hint* _Locale_impl::insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint) { + if (name[0] == 0) + name = _Locale_messages_default(buf); + + if (name == 0 || name[0] == 0 || is_C_locale_name(name)) { + _Locale_impl* i2 = locale::classic()._M_impl; + this->insert(i2, messages::id); +#ifndef _STLP_NO_WCHAR_T + this->insert(i2, messages::id); +#endif + } + else { + locale::facet *msg = 0; +#ifndef _STLP_NO_WCHAR_T + locale::facet *wmsg = 0; +#endif + + int __err_code; + _Locale_messages *__msg = _STLP_PRIV __acquire_messages(name, buf, hint, &__err_code); + if (!__msg) { + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + return hint; + } + + _STLP_TRY { + msg = new messages_byname(__msg); + } + _STLP_UNWIND(_STLP_PRIV __release_messages(__msg)); + +#ifndef _STLP_NO_WCHAR_T + _STLP_TRY { + _Locale_messages *__wmsg = _STLP_PRIV __acquire_messages(name, buf, hint, &__err_code); + if (!__wmsg) { + if (__err_code == _STLP_LOC_NO_MEMORY) { + _STLP_THROW_BAD_ALLOC; + } + } + + if (__wmsg) { + _STLP_TRY { + wmsg = new messages_byname(__wmsg); + } + _STLP_UNWIND(_STLP_PRIV __release_messages(__wmsg)); + } + } + _STLP_UNWIND(delete msg); +#endif + + this->insert(msg, messages::id); +#ifndef _STLP_NO_WCHAR_T + if (wmsg) this->insert(wmsg, messages::id); +#endif + } + return hint; +} + +static void _Stl_loc_assign_ids() { + // This assigns ids to every facet that is a member of a category, + // and also to money_get/put, num_get/put, and time_get/put + // instantiated using ordinary pointers as the input/output + // iterators. (The default is [io]streambuf_iterator.) + + money_get > >::id._M_index = 8; + money_put > >::id._M_index = 9; + num_get > >::id._M_index = 10; + num_put > >::id._M_index = 11; + time_get > >::id._M_index = 12; + time_put > >::id._M_index = 13; + +#ifndef _STLP_NO_WCHAR_T + money_get > >::id._M_index = 21; + money_put > >::id._M_index = 22; + num_get > >::id._M_index = 23; + num_put > > ::id._M_index = 24; + time_get > >::id._M_index = 25; + time_put > >::id._M_index = 26; +#endif + // locale::id::_S_max = 27; +} + +// To access those static instance use the getter below, they guaranty +// a correct initialization. +static locale *_Stl_classic_locale = 0; +static locale *_Stl_global_locale = 0; + +locale* _Stl_get_classic_locale() { + static _Locale_impl::Init init; + return _Stl_classic_locale; +} + +locale* _Stl_get_global_locale() { + static _Locale_impl::Init init; + return _Stl_global_locale; +} + +#if defined (_STLP_MSVC) || defined (__ICL) || defined (__ISCPP__) || defined (__DMC__) +/* + * The following static variable needs to be initialized before STLport + * users static variable in order for him to be able to use Standard + * streams in its variable initialization. + * This variable is here because MSVC do not allow to change the initialization + * segment in a given translation unit, iostream.cpp already contains an + * initialization segment specification. + */ +# pragma warning (disable : 4073) +# pragma init_seg(lib) +#endif + +static ios_base::Init _IosInit; + +void _Locale_impl::make_classic_locale() { + // This funcion will be called once: during build classic _Locale_impl + + // The classic locale contains every facet that belongs to a category. + static _Stl_aligned_buffer<_Locale_impl> _Locale_classic_impl_buf; + _Locale_impl *classic = new(&_Locale_classic_impl_buf) _Locale_impl("C"); + + locale::facet* classic_facets[] = { + 0, + new collate(1), + new ctype(0, false, 1), + new codecvt(1), + new moneypunct(1), + new moneypunct(1), + new numpunct(1), + new messages(1), + new money_get > >(1), + new money_put > >(1), + new num_get > >(1), + new num_put > >(1), + new time_get > >(1), + new time_put > >(1), +#ifndef _STLP_NO_WCHAR_T + new collate(1), + new ctype(1), + new codecvt(1), + new moneypunct(1), + new moneypunct(1), + new numpunct(1), + new messages(1), + new money_get > >(1), + new money_put > >(1), + new num_get > >(1), + new num_put > >(1), + new time_get > >(1), + new time_put > >(1), +#endif + 0 + }; + + const size_t nb_classic_facets = sizeof(classic_facets) / sizeof(locale::facet *); + classic->facets_vec.reserve(nb_classic_facets); + classic->facets_vec.assign(&classic_facets[0], &classic_facets[0] + nb_classic_facets); + + static locale _Locale_classic(classic); + _Stl_classic_locale = &_Locale_classic; + + static locale _Locale_global(classic); + _Stl_global_locale = &_Locale_global; +} + +// Declarations of (non-template) facets' static data members +// size_t locale::id::_S_max = 27; // made before + +locale::id collate::id = { 1 }; +locale::id ctype::id = { 2 }; +locale::id codecvt::id = { 3 }; +locale::id moneypunct::id = { 4 }; +locale::id moneypunct::id = { 5 }; +locale::id numpunct::id = { 6 } ; +locale::id messages::id = { 7 }; + +#ifndef _STLP_NO_WCHAR_T +locale::id collate::id = { 14 }; +locale::id ctype::id = { 15 }; +locale::id codecvt::id = { 16 }; +locale::id moneypunct::id = { 17 } ; +locale::id moneypunct::id = { 18 } ; +locale::id numpunct::id = { 19 }; +locale::id messages::id = { 20 }; +#endif + +_STLP_DECLSPEC _Locale_impl* _STLP_CALL _get_Locale_impl(_Locale_impl *loc) +{ + _STLP_ASSERT( loc != 0 ); + loc->_M_incr(); + return loc; +} + +void _STLP_CALL _release_Locale_impl(_Locale_impl *& loc) +{ + _STLP_ASSERT( loc != 0 ); + if (loc->_M_decr() == 0) { + if (*loc != *_Stl_classic_locale) + delete loc; + else + loc->~_Locale_impl(); + loc = 0; + } +} + +_STLP_DECLSPEC _Locale_impl* _STLP_CALL _copy_Nameless_Locale_impl(_Locale_impl *loc) +{ + _STLP_ASSERT( loc != 0 ); + _Locale_impl *loc_new = new _Locale_impl(*loc); + loc_new->name = _Nameless; + return loc_new; +} + +/* _GetFacetId implementation have to be here in order to be in the same translation unit + * as where id are initialize (in _Stl_loc_assign_ids) */ +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get > >*) +{ return money_get > >::id; } +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put > >*) +{ return money_put > >::id; } +#ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get > >*) +{ return money_get > >::id; } +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put > >*) +{ return money_put > >::id; } +#endif + +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get > >*) +{ return num_get > >::id; } +#ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get > >*) +{ return num_get > >::id; } +#endif + +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put > >*) +{ return num_put > >::id; } +#ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put > >*) +{ return num_put > >::id; } +#endif + +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get > >*) +{ return time_get > >::id; } +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put > >*) +{ return time_put > >::id; } +#ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get > >*) +{ return time_get > >::id; } +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put > >*) +{ return time_put > >::id; } +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + diff --git a/sdk/tlibstdcxx/src/locale_impl.h b/sdk/tlibstdcxx/src/locale_impl.h new file mode 100644 index 0000000000..2aa694c99b --- /dev/null +++ b/sdk/tlibstdcxx/src/locale_impl.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef LOCALE_IMPL_H +#define LOCALE_IMPL_H + +#include // C locale header file. +#include +#include +#include +#include "c_locale.h" + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +//Export of _Locale_impl facets container: +# if !defined (_STLP_USE_PTR_SPECIALIZATIONS) +//If we are using pointer specialization, vector will use +//the already exported vector implementation. +_STLP_EXPORT_TEMPLATE_CLASS allocator; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; +_STLP_EXPORT_TEMPLATE_CLASS _Vector_base >; + +_STLP_MOVE_TO_STD_NAMESPACE +# endif +# if defined (_STLP_DEBUG) +_STLP_MOVE_TO_PRIV_NAMESPACE +# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector) +_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR > >; +_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR >; +# undef _STLP_NON_DBG_VECTOR +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +_STLP_EXPORT_TEMPLATE_CLASS vector >; +#endif + +//---------------------------------------------------------------------- +// Class _Locale_impl +// This is the base class which implements access only and is supposed to +// be used for classic locale only +class _STLP_CLASS_DECLSPEC _Locale_impl : public _Refcount_Base { + public: + _Locale_impl(const char* s); + _Locale_impl(const _Locale_impl&); + _Locale_impl(size_t n, const char* s); + + private: + ~_Locale_impl(); + + public: + size_t size() const { return facets_vec.size(); } + + basic_string, allocator > name; + + static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_bad_cast(); + + private: + void operator=(const _Locale_impl&); + + public: + class _STLP_CLASS_DECLSPEC Init { + public: + Init(); + ~Init(); + private: + _Refcount_Base& _M_count() const; + }; + + static void _STLP_CALL _S_initialize(); + static void _STLP_CALL _S_uninitialize(); + + static void make_classic_locale(); + static void free_classic_locale(); + + friend class Init; + + public: + // void remove(size_t index); + locale::facet* insert(locale::facet*, const locale::id& n); + void insert(_Locale_impl* from, const locale::id& n); + + // Helper functions for byname construction of locales. + _Locale_name_hint* insert_ctype_facets(const char* &name, char *buf, _Locale_name_hint* hint); + _Locale_name_hint* insert_numeric_facets(const char* &name, char *buf, _Locale_name_hint* hint); + _Locale_name_hint* insert_time_facets(const char* &name, char *buf, _Locale_name_hint* hint); + _Locale_name_hint* insert_collate_facets(const char* &name, char *buf, _Locale_name_hint* hint); + _Locale_name_hint* insert_monetary_facets(const char* &name, char *buf, _Locale_name_hint* hint); + _Locale_name_hint* insert_messages_facets(const char* &name, char *buf, _Locale_name_hint* hint); + + bool operator != (const locale& __loc) const { return __loc._M_impl != this; } + + private: + vector facets_vec; + + private: + friend _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl * ); + friend void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc ); +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ + defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) + friend class _STLP_NO_MEM_T_NAME(loc); +#else + friend class locale; +#endif +}; + +void _STLP_CALL _release_Locale_impl( _Locale_impl *& loc ); + +_STLP_END_NAMESPACE + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/lock_free_slist.h b/sdk/tlibstdcxx/src/lock_free_slist.h new file mode 100644 index 0000000000..7c753d17c5 --- /dev/null +++ b/sdk/tlibstdcxx/src/lock_free_slist.h @@ -0,0 +1,307 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_LOCK_FREE_SLIST_H +#define _STLP_LOCK_FREE_SLIST_H + +#if defined(_STLP_PTHREADS) +# include + +# if defined (__GNUC__) && defined (__i386__) + +# define _STLP_HAS_ATOMIC_FREELIST +/** + * Class that implements a non-blocking and thread-safe freelist. + * It is used for the lock-free node allocation engine. + * + * @author felixw@inin.com + */ +class _STLP_atomic_freelist { +public: + /** + * Type representing items of the freelist + */ + struct item { + item* _M_next; + }; + + _STLP_atomic_freelist() { + // Statically assert layout of member is as expected by assembly code + _STLP_STATIC_ASSERT(sizeof(_M) == 8) + _M._M_data._M_top = 0; + _M._M_data._M_sequence = 0; + } + + /** + * Atomically pushes the specified item onto the freelist. + * + * @param __item [in] Item to add to the front of the list + */ + void push(item* __item) { + // NOTE: GCC uses ebx as the PIC register for globals in shared libraries. + // The GCC version I'm using (3.4.1) won't temporarily spill it if it's + // used as input, output, or clobber. Instead, it complains with a + // "can't find a register in class `BREG' while reloading `asm'" error. + // This is probably a compiler bug, but as the cmpxchg8b instruction + // requires ebx, I work around this here by using ecx for the '__item' + // input and spilling ebx into edi. This also precludes us from using + // a "m" operand for the cmpxchg8b argument (GCC might think it can make + // it relative to ebx). Instead, we're using esi for the address of _M_data. + // + int __tmp1; // These dummy variables are used to tell GCC that the eax, ecx, + int __tmp2; // and edx registers will not have the same value as their input. + int __tmp3; // The optimizer will remove them as their values are not used. + __asm__ __volatile__ + (" movl %%ebx, %%edi\n\t" + " movl %%ecx, %%ebx\n\t" + "L1_%=: movl %%eax, (%%ebx)\n\t" // __item._M_next = _M._M_data._M_top + " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1 + "lock; cmpxchg8b (%%esi)\n\t" + " jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top) + " movl %%edi, %%ebx" + :"=a" (__tmp1), "=d" (__tmp2), "=c" (__tmp3) + :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "c" (__item), "S" (&_M._M_data) + :"edi", "memory", "cc"); + } + + /** + * Atomically removes the topmost item from the freelist and returns a + * pointer to it. Returns NULL if the list is empty. + * + * @return Item that was removed from front of list; NULL if list empty + */ + item* pop() { + item* __result; + int __tmp; + __asm__ __volatile__ + (" movl %%ebx, %%edi\n\t" + "L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL? + " je L2_%=\n\t" // If yes, we're done + " movl (%%eax), %%ebx\n\t" // new top = _M._M_data._M_top->_M_next + " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1 + "lock; cmpxchg8b (%%esi)\n\t" + " jne L1_%=\n\t" // We failed, retry! (edx:eax now contain most recent _M_sequence:_M_top) + "L2_%=: movl %%edi, %%ebx" + :"=a" (__result), "=d" (__tmp) + :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data) + :"edi", "ecx", "memory", "cc"); + return __result; + } + + /** + * Atomically detaches all items from the list and returns a pointer to the + * topmost item. The items are still chained and may be traversed safely as + * they're now "owned" by the calling thread. + * + * @return Pointer to topmost item in the list; NULL if list empty + */ + item* clear() { + item* __result; + int __tmp; + __asm__ __volatile__ + (" movl %%ebx, %%edi\n\t" + "L1_%=: testl %%eax, %%eax\n\t" // _M_top == NULL? + " je L2_%=\n\t" // If yes, we're done + " xorl %%ebx, %%ebx\n\t" // We're attempting to set _M_top to NULL + " leal 1(%%edx),%%ecx\n\t" // new sequence = _M._M_data._M_sequence + 1 + "lock; cmpxchg8b (%%esi)\n\t" + " jne L1_%=\n\t" // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top) + "L2_%=: movl %%edi, %%ebx" + :"=a" (__result), "=d" (__tmp) + :"a" (_M._M_data._M_top), "d" (_M._M_data._M_sequence), "S" (&_M._M_data) + :"edi", "ecx", "memory", "cc"); + return __result; + } + +private: + union { + long long _M_align; + struct { + item* _M_top; // Topmost element in the freelist + unsigned int _M_sequence; // Sequence counter to prevent "ABA problem" + } _M_data; + } _M; + + _STLP_atomic_freelist(const _STLP_atomic_freelist&); + _STLP_atomic_freelist& operator=(const _STLP_atomic_freelist&); +}; + +# endif /* if defined(__GNUC__) && defined(__i386__) */ + +#elif defined (_STLP_WIN32THREADS) + +# if !defined (_WIN64) +# define _STLP_USE_ASM_IMPLEMENTATION +# endif + +// Here are the compiler/platform requirements for the thread safe and +// lock free singly linked list implementation: +# if defined (_STLP_USE_ASM_IMPLEMENTATION) +// For the asm version: +# if defined (_STLP_MSVC) && defined (_M_IX86) && (_M_IX86 >= 500) +# define _STLP_HAS_ATOMIC_FREELIST +# endif +# else +// For the API based version: +# if defined (_STLP_NEW_PLATFORM_SDK) && (!defined (WINVER) || (WINVER >= 0x0501)) && \ + (!defined (_WIN32_WINNT) || (_WIN32_WINNT >= 0x0501)) +# define _STLP_HAS_ATOMIC_FREELIST +# endif +# endif + +# if defined (_STLP_HAS_ATOMIC_FREELIST) +# if defined (_STLP_USE_ASM_IMPLEMENTATION) +# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL) +# pragma warning (push) +# pragma warning (disable : 4035) //function has no return value +# endif +# endif +/** + * Class that implements a non-blocking and thread-safe freelist. + * It is used for the lock-free node allocation engine. + * + * @author felixw@inin.com + */ +class _STLP_atomic_freelist { +public: + /** + * Type representing items of the freelist + */ +# if defined (_STLP_USE_ASM_IMPLEMENTATION) + struct item { + item* _M_next; + }; +# else + typedef SLIST_ENTRY item; +# endif + + _STLP_atomic_freelist() { + // Statically assert layout of member is as expected by assembly code +# if defined (_STLP_USE_ASM_IMPLEMENTATION) + _STLP_STATIC_ASSERT((sizeof(item) == sizeof(item*)) && (sizeof(_M) == 8)) + _M._M_data._M_top = 0; + _M._M_data._M_sequence = 0; +# else + InitializeSListHead(&_M_head); +# endif + } + + /** + * Atomically pushes the specified item onto the freelist. + * + * @param __item [in] Item to add to the front of the list + */ + void push(item* __item) { +# if defined (_STLP_USE_ASM_IMPLEMENTATION) + __asm + { + mov esi, this + mov ebx, __item + mov eax, [esi] // _M._M_data._M_top + mov edx, [esi+4] // _M._M_data._M_sequence + L1: mov [ebx], eax // __item._M_next = _M._M_data._M_top + lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1 + lock cmpxchg8b qword ptr [esi] + jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top) + } +# else + InterlockedPushEntrySList(&_M_head, __item); +# endif + } + + /** + * Atomically removes the topmost item from the freelist and returns a + * pointer to it. Returns NULL if the list is empty. + * + * @return Item that was removed from front of list; NULL if list empty + */ + item* pop() { +# if defined (_STLP_USE_ASM_IMPLEMENTATION) + __asm + { + mov esi, this + mov eax, [esi] // _M._M_data._M_top + mov edx, [esi+4] // _M._M_data._M_sequence + L1: test eax, eax // _M_top == NULL? + je L2 // Yes, we're done + mov ebx, [eax] // new top = _M._M_data._M_top->_M_next + lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1 + lock cmpxchg8b qword ptr [esi] + jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top) + L2: + } +# else + return InterlockedPopEntrySList(&_M_head); +# endif + } + + /** + * Atomically detaches all items from the list and returns pointer to the + * topmost. The items are still chained and may be traversed safely as + * they're now "owned" by the calling thread. + * + * @return Pointer to topmost item in the list; NULL if list empty + */ + item* clear() { +# if defined (_STLP_USE_ASM_IMPLEMENTATION) + __asm + { + mov esi, this + mov eax, [esi] // _M._M_data._M_top + mov edx, [esi+4] // _M._M_data._M_sequence + L1: test eax, eax // _M_top == NULL? + je L2 // Yes, we're done + xor ebx,ebx // We're attempting to set _M._M_data._M_top to NULL + lea ecx, [edx+1] // new sequence = _M._M_data._M_sequence + 1 + lock cmpxchg8b qword ptr [esi] + jne L1 // Failed, retry! (edx:eax now contain most recent _M_sequence:_M_top) + L2: + } +# else + return InterlockedFlushSList(&_M_head); +# endif + } + +private: +# if defined (_STLP_USE_ASM_IMPLEMENTATION) + union { + __int64 _M_align; + struct { + item* _M_top; // Topmost element in the freelist + unsigned int _M_sequence; // Sequence counter to prevent "ABA problem" + } _M_data; + } _M; +# else + SLIST_HEADER _M_head; +# endif + + _STLP_atomic_freelist(const _STLP_atomic_freelist&); + _STLP_atomic_freelist& operator = (const _STLP_atomic_freelist&); +}; + +# if defined (_STLP_USE_ASM_IMPLEMENTATION) +# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) || defined (__ICL) +# pragma warning (pop) +# endif +# endif + +# endif /* _STLP_HAS_ATOMIC_FREELIST */ + +#endif + +#endif /* _STLP_LOCK_FREE_SLIST_H */ diff --git a/sdk/tlibstdcxx/src/message_facets.h b/sdk/tlibstdcxx/src/message_facets.h new file mode 100644 index 0000000000..946b5291b0 --- /dev/null +++ b/sdk/tlibstdcxx/src/message_facets.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef MESSAGE_FACETS_H +#define MESSAGE_FACETS_H + +#include +#include +#include + +#include "c_locale.h" + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Class _Catalog_locale_map. The reason for this is that, internally, +// a message string is always a char*. We need a ctype facet to convert +// a string to and from wchar_t, and the user is permitted to provide such +// a facet when calling open(). + +struct _Catalog_locale_map { + _Catalog_locale_map() : M(0) {} + ~_Catalog_locale_map() { if (M) delete M; } + + void insert(nl_catd_type key, const locale& L); + locale lookup(nl_catd_type key) const; + void erase(nl_catd_type key); + + typedef hash_map, equal_to, + allocator > > map_type; + map_type *M; + +private: // Invalidate copy constructor and assignment + _Catalog_locale_map(const _Catalog_locale_map&); + void operator=(const _Catalog_locale_map&); +}; + +/* + * In glibc nl_catd type is void *, but messages_base::catalog is defined as int + * by ISO/IEC 14882; The int may be too short to store pointer on 64-bit platforms; + * Another problem, is that do_open() may return negative value to indicate that no + * catalog open---this case can't be represented with pointers. + * The class _Catalog_nl_catd_map intended to make relation between + * messages_base::catalog and nl_catd handler. + * + */ + +#if defined (_STLP_USE_GLIBC2_LOCALIZATION) +# define _STLP_USE_NL_CATD_MAPPING +#else +/* If no mapping a message_base::catalog entry, int typedef according C++ Standard 22.2.7.1, + * has to be large enough to contain a nl_catd_type value. + */ +_STLP_STATIC_ASSERT(sizeof(nl_catd_type) <= sizeof(int)) +#endif + +class _STLP_CLASS_DECLSPEC _Catalog_nl_catd_map { +public: + _Catalog_nl_catd_map() + {} + ~_Catalog_nl_catd_map() + {} + + typedef hash_map, equal_to, + allocator > > map_type; + typedef hash_map, equal_to, + allocator > > rmap_type; + // typedef map map_type; + // typedef map rmap_type; + + messages_base::catalog insert(nl_catd_type cat) +#if !defined (_STLP_USE_NL_CATD_MAPPING) + { return (messages_base::catalog)cat; } +#else + ; +#endif + + void erase(messages_base::catalog) +#if !defined (_STLP_USE_NL_CATD_MAPPING) + {} +#else + ; +#endif + + nl_catd_type operator [] ( messages_base::catalog cat ) +#if !defined (_STLP_USE_NL_CATD_MAPPING) + { return cat; } +#else + { return cat < 0 ? 0 : M[cat]; } +#endif + +private: + _Catalog_nl_catd_map(const _Catalog_nl_catd_map&); + _Catalog_nl_catd_map& operator =(const _Catalog_nl_catd_map&); + +#if defined (_STLP_USE_NL_CATD_MAPPING) + map_type M; + rmap_type Mr; + static _STLP_VOLATILE __stl_atomic_t _count; +#endif +}; + +class _Messages { +public: + typedef messages_base::catalog catalog; + + _Messages(bool, const char *name); + _Messages(bool, _Locale_messages*); + + catalog do_open(const string& __fn, const locale& __loc) const; + string do_get(catalog __c, int __set, int __msgid, + const string& __dfault) const; +#if !defined (_STLP_NO_WCHAR_T) + wstring do_get(catalog __c, int __set, int __msgid, + const wstring& __dfault) const; +#endif + void do_close(catalog __c) const; + ~_Messages(); + +private: + _Locale_messages* _M_message_obj; + _Catalog_locale_map* _M_map; + mutable _Catalog_nl_catd_map _M_cat; + + //private definition to avoid warning (with ICL) + _Messages(const _Messages&); + _Messages& operator=(const _Messages&); +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/messages.cpp b/sdk/tlibstdcxx/src/messages.cpp new file mode 100644 index 0000000000..ae4669e5c8 --- /dev/null +++ b/sdk/tlibstdcxx/src/messages.cpp @@ -0,0 +1,247 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include + +#include "message_facets.h" +#include "acquire_release.h" + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +void _Catalog_locale_map::insert(nl_catd_type key, const locale& L) { + _STLP_TRY { +#if !defined (_STLP_NO_TYPEINFO) && !defined (_STLP_NO_RTTI) + // Don't bother to do anything unless we're using a non-default ctype facet +# ifdef _STLP_NO_WCHAR_T + typedef char _Char; +# else + typedef wchar_t _Char; +# endif + + typedef ctype<_Char> wctype; + wctype const& wct = use_facet(L); + if (typeid(wct) != typeid(wctype)) { +#endif + if (!M) + M = new map_type; + + M->insert(map_type::value_type(key, L)); +#if !defined (_STLP_NO_TYPEINFO) && !defined (_STLP_NO_RTTI) + } +#endif + } + _STLP_CATCH_ALL {} +} + +void _Catalog_locale_map::erase(nl_catd_type key) { + if (M) + M->erase(key); +} + +locale _Catalog_locale_map::lookup(nl_catd_type key) const { + if (M) { + map_type::const_iterator i = M->find(key); + return i != M->end() ? (*i).second : locale::classic(); + } + else + return locale::classic(); +} + + +#if defined (_STLP_USE_NL_CATD_MAPPING) +_STLP_VOLATILE __stl_atomic_t _Catalog_nl_catd_map::_count = 0; + +messages_base::catalog _Catalog_nl_catd_map::insert(nl_catd_type cat) { + messages_base::catalog &res = Mr[cat]; + if ( res == 0 ) { +#if defined (_STLP_ATOMIC_INCREMENT) + res = __STATIC_CAST(int, _STLP_ATOMIC_INCREMENT(&_count)); +#else + static _STLP_STATIC_MUTEX _Count_lock _STLP_MUTEX_INITIALIZER; + { + _STLP_auto_lock sentry(_Count_lock); + res = __STATIC_CAST(int, ++_count); + } +#endif + M[res] = cat; + } + return res; +} + +void _Catalog_nl_catd_map::erase(messages_base::catalog cat) { + map_type::iterator mit(M.find(cat)); + if (mit != M.end()) { + Mr.erase((*mit).second); + M.erase(mit); + } +} +#endif + +//---------------------------------------------------------------------- +// +_Messages::_Messages(bool is_wide, const char *name) : + _M_message_obj(0), _M_map(0) { + if (!name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _M_message_obj = _STLP_PRIV __acquire_messages(name, buf, 0, &__err_code); + if (!_M_message_obj) + locale::_M_throw_on_creation_failure(__err_code, name, "messages"); + + if (is_wide) + _M_map = new _Catalog_locale_map; +} + +_Messages::_Messages(bool is_wide, _Locale_messages* msg) : + _M_message_obj(msg), _M_map(is_wide ? new _Catalog_locale_map() : 0) +{} + +_Messages::~_Messages() { + __release_messages(_M_message_obj); + delete _M_map; +} + +_Messages::catalog _Messages::do_open(const string& filename, const locale& L) const { + nl_catd_type result = _M_message_obj ? _Locale_catopen(_M_message_obj, filename.c_str()) + : (nl_catd_type)(-1); + + if ( result != (nl_catd_type)(-1) ) { + if ( _M_map != 0 ) { + _M_map->insert(result, L); + } + return _STLP_MUTABLE(_Messages_impl, _M_cat).insert( result ); + } + + return -1; +} + +string _Messages::do_get(catalog cat, + int set, int p_id, const string& dfault) const { + return _M_message_obj != 0 && cat >= 0 + ? string(_Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[cat], + set, p_id, dfault.c_str())) + : dfault; +} + +#if !defined (_STLP_NO_WCHAR_T) + +wstring +_Messages::do_get(catalog thecat, + int set, int p_id, const wstring& dfault) const { + typedef ctype wctype; + const wctype& ct = use_facet(_M_map->lookup(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat])); + + const char* str = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, ""); + + // Verify that the lookup failed; an empty string might represent success. + if (!str) + return dfault; + else if (str[0] == '\0') { + const char* str2 = _Locale_catgets(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat], set, p_id, "*"); + if (!str2 || ((str2[0] == '*') && (str2[1] == '\0'))) + return dfault; + } + + // str is correct. Now we must widen it to get a wstring. + size_t n = strlen(str); + + // NOT PORTABLE. What we're doing relies on internal details of the + // string implementation. (Contiguity of string elements.) + wstring result(n, wchar_t(0)); + ct.widen(str, str + n, &*result.begin()); + return result; +} + +#endif + +void _Messages::do_close(catalog thecat) const { + if (_M_message_obj) + _Locale_catclose(_M_message_obj, _STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]); + if (_M_map) _M_map->erase(_STLP_MUTABLE(_Messages_impl, _M_cat)[thecat]); + _STLP_MUTABLE(_Messages_impl, _M_cat).erase( thecat ); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +//---------------------------------------------------------------------- +// messages +messages::messages(size_t refs) + : locale::facet(refs) {} + +messages_byname::messages_byname(const char *name, size_t refs) + : messages(refs), _M_impl(new _STLP_PRIV _Messages(false, name)) {} + +messages_byname::messages_byname(_Locale_messages* msg) + : messages(0), _M_impl(new _STLP_PRIV _Messages(false, msg)) {} + +messages_byname::~messages_byname() +{ delete _M_impl; } + +messages_byname::catalog +messages_byname::do_open(const string& filename, const locale& l) const +{ return _M_impl->do_open(filename, l); } + +string +messages_byname::do_get(catalog cat, int set, int p_id, + const string& dfault) const +{ return _M_impl->do_get(cat, set, p_id, dfault); } + +void messages_byname::do_close(catalog cat) const +{ _M_impl->do_close(cat); } + +#if !defined (_STLP_NO_WCHAR_T) + +//---------------------------------------------------------------------- +// messages + +messages::messages(size_t refs) + : locale::facet(refs) {} + +messages_byname::messages_byname(const char *name, size_t refs) + : messages(refs), _M_impl(new _STLP_PRIV _Messages(true, name)) {} + +messages_byname::messages_byname(_Locale_messages* msg) + : messages(0), _M_impl(new _STLP_PRIV _Messages(true, msg)) {} + +messages_byname::~messages_byname() +{ delete _M_impl; } + +messages_byname::catalog +messages_byname::do_open(const string& filename, const locale& L) const +{ return _M_impl->do_open(filename, L); } + +wstring +messages_byname::do_get(catalog thecat, + int set, int p_id, const wstring& dfault) const +{ return _M_impl->do_get(thecat, set, p_id, dfault); } + +void messages_byname::do_close(catalog cat) const +{ _M_impl->do_close(cat); } + +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/monetary.cpp b/sdk/tlibstdcxx/src/monetary.cpp new file mode 100644 index 0000000000..d9b213ac0b --- /dev/null +++ b/sdk/tlibstdcxx/src/monetary.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include + +_STLP_BEGIN_NAMESPACE + +static void _Init_monetary_formats(money_base::pattern& pos_format, + money_base::pattern& neg_format) { + pos_format.field[0] = (char) money_base::symbol; + pos_format.field[1] = (char) money_base::sign; + pos_format.field[2] = (char) money_base::none; + pos_format.field[3] = (char) money_base::value; + + neg_format.field[0] = (char) money_base::symbol; + neg_format.field[1] = (char) money_base::sign; + neg_format.field[2] = (char) money_base::none; + neg_format.field[3] = (char) money_base::value; +} + +// This is being used throughout the library +static const string _S_empty_string; +#ifndef _STLP_NO_WCHAR_T +static const wstring _S_empty_wstring; +#endif + +// +// moneypunct<> +// + +moneypunct::moneypunct(size_t __refs) : locale::facet(__refs) +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } +moneypunct::~moneypunct() {} + +char moneypunct::do_decimal_point() const {return ' ';} +char moneypunct::do_thousands_sep() const {return ' ';} +string moneypunct::do_grouping() const { return _S_empty_string; } +string moneypunct::do_curr_symbol() const { return _S_empty_string; } +string moneypunct::do_positive_sign() const { return _S_empty_string; } +string moneypunct::do_negative_sign() const { return _S_empty_string; } +money_base::pattern moneypunct::do_pos_format() const {return _M_pos_format;} +money_base::pattern moneypunct::do_neg_format() const {return _M_neg_format;} +int moneypunct::do_frac_digits() const {return 0;} + +moneypunct::moneypunct(size_t __refs) : locale::facet(__refs) +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } +moneypunct::~moneypunct() {} + +char moneypunct::do_decimal_point() const {return ' ';} +char moneypunct::do_thousands_sep() const {return ' ';} + +string moneypunct::do_grouping() const { return _S_empty_string; } +string moneypunct::do_curr_symbol() const { return _S_empty_string; } +string moneypunct::do_positive_sign() const { return _S_empty_string; } +string moneypunct::do_negative_sign() const { return _S_empty_string; } +money_base::pattern moneypunct::do_pos_format() const {return _M_pos_format;} +money_base::pattern moneypunct::do_neg_format() const {return _M_neg_format;} +int moneypunct::do_frac_digits() const {return 0;} + +#ifndef _STLP_NO_WCHAR_T +moneypunct::moneypunct(size_t __refs) : locale::facet(__refs) +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } +moneypunct::~moneypunct() {} + +wchar_t moneypunct::do_decimal_point() const {return L' ';} +wchar_t moneypunct::do_thousands_sep() const {return L' ';} +string moneypunct::do_grouping() const {return _S_empty_string;} + +wstring moneypunct::do_curr_symbol() const +{return _S_empty_wstring;} +wstring moneypunct::do_positive_sign() const +{return _S_empty_wstring;} +wstring moneypunct::do_negative_sign() const +{return _S_empty_wstring;} +int moneypunct::do_frac_digits() const {return 0;} +money_base::pattern moneypunct::do_pos_format() const +{return _M_pos_format;} +money_base::pattern moneypunct::do_neg_format() const +{return _M_neg_format;} + +moneypunct::moneypunct(size_t __refs) : locale::facet(__refs) +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); } +moneypunct::~moneypunct() {} + +wchar_t moneypunct::do_decimal_point() const {return L' ';} +wchar_t moneypunct::do_thousands_sep() const {return L' ';} +string moneypunct::do_grouping() const { return _S_empty_string;} +wstring moneypunct::do_curr_symbol() const +{return _S_empty_wstring;} +wstring moneypunct::do_positive_sign() const +{return _S_empty_wstring;} +wstring moneypunct::do_negative_sign() const +{return _S_empty_wstring;} +int moneypunct::do_frac_digits() const {return 0;} + +money_base::pattern moneypunct::do_pos_format() const +{return _M_pos_format;} +money_base::pattern moneypunct::do_neg_format() const +{return _M_neg_format;} + +#endif /* WCHAR_T */ + +// +// Instantiations +// + +#if !defined (_STLP_NO_FORCE_INSTANTIATE) + +template class _STLP_CLASS_DECLSPEC money_get > >; +template class _STLP_CLASS_DECLSPEC money_put > >; +// template class money_put; + +# ifndef _STLP_NO_WCHAR_T +template class _STLP_CLASS_DECLSPEC money_get > >; +template class _STLP_CLASS_DECLSPEC money_put > >; +// template class money_put; +// template class money_get; +# endif + +#endif + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) +const bool moneypunct::intl; +const bool moneypunct::intl; +# ifndef _STLP_NO_WCHAR_T +const bool moneypunct::intl; +const bool moneypunct::intl; +# endif +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/num_get.cpp b/sdk/tlibstdcxx/src/num_get.cpp new file mode 100644 index 0000000000..45901acff0 --- /dev/null +++ b/sdk/tlibstdcxx/src/num_get.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include +#include +#include + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +// __valid_grouping compares two strings, one representing the +// group sizes encountered when reading an integer, and the other +// representing the valid group sizes as returned by the numpunct +// grouping() member function. Both are interpreted right-to-left. +// The grouping string is treated as if it were extended indefinitely +// with its last value. For a grouping to be valid, each term in +// the first string must be equal to the corresponding term in the +// second, except for the last, which must be less than or equal. + +// boris : this takes reversed first string ! +bool _STLP_CALL +__valid_grouping(const char * first1, const char * last1, + const char * first2, const char * last2) { + if (first1 == last1 || first2 == last2) return true; + + --last1; --last2; + + while (first1 != last1) { + if (*last1 != *first2) + return false; + --last1; + if (first2 != last2) ++first2; + } + + return *last1 <= *first2; +} + +_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned __index) { + static const unsigned char __val_table[128] = { + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,10,11,12,13,14,15,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF + }; + + return __val_table[__index]; +} + +_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms() +{ return "+-0xX"; } + +// index is actually a char + +#if !defined (_STLP_NO_WCHAR_T) + +// Similar, except return the character itself instead of the numeric +// value. Used for floating-point input. +bool _STLP_CALL __get_fdigit(wchar_t& c, const wchar_t* digits) { + const wchar_t* p = find(digits, digits + 10, c); + if (p != digits + 10) { + c = (char)('0' + (p - digits)); + return true; + } + else + return false; +} + +bool _STLP_CALL __get_fdigit_or_sep(wchar_t& c, wchar_t sep, + const wchar_t * digits) { + if (c == sep) { + c = (char)','; + return true; + } + else + return __get_fdigit(c, digits); +} + +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +#if !defined(_STLP_NO_FORCE_INSTANTIATE) +//---------------------------------------------------------------------- +// Force instantiation of num_get<> +template class _STLP_CLASS_DECLSPEC istreambuf_iterator >; +// template class num_get; +template class num_get > >; + +# if !defined (_STLP_NO_WCHAR_T) +template class _STLP_CLASS_DECLSPEC istreambuf_iterator >; +template class num_get > >; +// template class num_get; +# endif +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/num_get_float.cpp b/sdk/tlibstdcxx/src/num_get_float.cpp new file mode 100644 index 0000000000..d26f58d45c --- /dev/null +++ b/sdk/tlibstdcxx/src/num_get_float.cpp @@ -0,0 +1,883 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include +#include + +#if (defined (__GNUC__) && !defined (__sun) && !defined (__hpux)) || \ + defined (__DMC__) +# include +#endif + +#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \ + defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC) + +# if defined (__BORLANDC__) +typedef unsigned int uint32_t; +typedef unsigned __int64 uint64_t; +# endif + +union _ll { + uint64_t i64; + struct { +# if defined (_STLP_BIG_ENDIAN) + uint32_t hi; + uint32_t lo; +# elif defined (_STLP_LITTLE_ENDIAN) + uint32_t lo; + uint32_t hi; +# else +# error Unknown endianess +# endif + } i32; +}; + +# if defined (__linux__) +# include +# else +union ieee854_long_double { + long double d; + + /* This is the IEEE 854 double-extended-precision format. */ + struct { + unsigned int mantissa1:32; + unsigned int mantissa0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty:16; + } ieee; +}; + +# define IEEE854_LONG_DOUBLE_BIAS 0x3fff +# endif +#endif + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +//---------------------------------------------------------------------- +// num_get + +// Helper functions for _M_do_get_float. + +#if !defined (_STLP_NO_WCHAR_T) +void _STLP_CALL +_Initialize_get_float( const ctype& ct, + wchar_t& Plus, wchar_t& Minus, + wchar_t& pow_e, wchar_t& pow_E, + wchar_t* digits) { + char ndigits[11] = "0123456789"; + Plus = ct.widen('+'); + Minus = ct.widen('-'); + pow_e = ct.widen('e'); + pow_E = ct.widen('E'); + ct.widen(ndigits + 0, ndigits + 10, digits); +} +#endif /* WCHAR_T */ + +/* + * __string_to_double is just lifted from atof, the difference being + * that we just use '.' for the decimal point, rather than let it + * be taken from the current C locale, which of course is not accessible + * to us. + */ +#if defined (_STLP_MSVC) || defined (__BORLANDC__) || defined (__ICL) +typedef unsigned long uint32; +typedef unsigned __int64 uint64; +# define ULL(x) x##Ui64 +#elif defined (__unix) || defined (__MINGW32__) || \ + (defined (__DMC__) && (__LONGLONG)) || defined (__WATCOMC__) +typedef uint32_t uint32; +typedef uint64_t uint64; +# define ULL(x) x##ULL +#else +# error There should be some unsigned 64-bit integer on the system! +#endif + +// Multiplication of two 64-bit integers, giving a 128-bit result. +// Taken from Algorithm M in Knuth section 4.3.1, with the loop +// hand-unrolled. +static void _Stl_mult64(const uint64 u, const uint64 v, + uint64& high, uint64& low) { + const uint64 low_mask = ULL(0xffffffff); + const uint64 u0 = u & low_mask; + const uint64 u1 = u >> 32; + const uint64 v0 = v & low_mask; + const uint64 v1 = v >> 32; + + uint64 t = u0 * v0; + low = t & low_mask; + + t = u1 * v0 + (t >> 32); + uint64 w1 = t & low_mask; + uint64 w2 = t >> 32; + + uint64 x = u0 * v1 + w1; + low += (x & low_mask) << 32; + high = u1 * v1 + w2 + (x >> 32); +} + +#ifndef __linux__ + +# define bit11 ULL(0x7ff) +# define exponent_mask (bit11 << 52) + +# if !defined (__GNUC__) || (__GNUC__ != 3) || (__GNUC_MINOR__ != 4) || \ + (!defined (__CYGWIN__) && !defined (__MINGW32__)) +//Generate bad code when compiled with -O2 option. +inline +# endif +void _Stl_set_exponent(uint64 &val, uint64 exp) +{ val = (val & ~exponent_mask) | ((exp & bit11) << 52); } + +#endif // __linux__ + +/* Power of ten fractions for tenscale*/ +/* The constants are factored so that at most two constants + * and two multiplies are needed. Furthermore, one of the constants + * is represented exactly - 10**n where 1<= n <= 27. + */ + +static const uint64 _Stl_tenpow[80] = { +ULL(0xa000000000000000), /* _Stl_tenpow[0]=(10**1)/(2**4) */ +ULL(0xc800000000000000), /* _Stl_tenpow[1]=(10**2)/(2**7) */ +ULL(0xfa00000000000000), /* _Stl_tenpow[2]=(10**3)/(2**10) */ +ULL(0x9c40000000000000), /* _Stl_tenpow[3]=(10**4)/(2**14) */ +ULL(0xc350000000000000), /* _Stl_tenpow[4]=(10**5)/(2**17) */ +ULL(0xf424000000000000), /* _Stl_tenpow[5]=(10**6)/(2**20) */ +ULL(0x9896800000000000), /* _Stl_tenpow[6]=(10**7)/(2**24) */ +ULL(0xbebc200000000000), /* _Stl_tenpow[7]=(10**8)/(2**27) */ +ULL(0xee6b280000000000), /* _Stl_tenpow[8]=(10**9)/(2**30) */ +ULL(0x9502f90000000000), /* _Stl_tenpow[9]=(10**10)/(2**34) */ +ULL(0xba43b74000000000), /* _Stl_tenpow[10]=(10**11)/(2**37) */ +ULL(0xe8d4a51000000000), /* _Stl_tenpow[11]=(10**12)/(2**40) */ +ULL(0x9184e72a00000000), /* _Stl_tenpow[12]=(10**13)/(2**44) */ +ULL(0xb5e620f480000000), /* _Stl_tenpow[13]=(10**14)/(2**47) */ +ULL(0xe35fa931a0000000), /* _Stl_tenpow[14]=(10**15)/(2**50) */ +ULL(0x8e1bc9bf04000000), /* _Stl_tenpow[15]=(10**16)/(2**54) */ +ULL(0xb1a2bc2ec5000000), /* _Stl_tenpow[16]=(10**17)/(2**57) */ +ULL(0xde0b6b3a76400000), /* _Stl_tenpow[17]=(10**18)/(2**60) */ +ULL(0x8ac7230489e80000), /* _Stl_tenpow[18]=(10**19)/(2**64) */ +ULL(0xad78ebc5ac620000), /* _Stl_tenpow[19]=(10**20)/(2**67) */ +ULL(0xd8d726b7177a8000), /* _Stl_tenpow[20]=(10**21)/(2**70) */ +ULL(0x878678326eac9000), /* _Stl_tenpow[21]=(10**22)/(2**74) */ +ULL(0xa968163f0a57b400), /* _Stl_tenpow[22]=(10**23)/(2**77) */ +ULL(0xd3c21bcecceda100), /* _Stl_tenpow[23]=(10**24)/(2**80) */ +ULL(0x84595161401484a0), /* _Stl_tenpow[24]=(10**25)/(2**84) */ +ULL(0xa56fa5b99019a5c8), /* _Stl_tenpow[25]=(10**26)/(2**87) */ +ULL(0xcecb8f27f4200f3a), /* _Stl_tenpow[26]=(10**27)/(2**90) */ + +ULL(0xd0cf4b50cfe20766), /* _Stl_tenpow[27]=(10**55)/(2**183) */ +ULL(0xd2d80db02aabd62c), /* _Stl_tenpow[28]=(10**83)/(2**276) */ +ULL(0xd4e5e2cdc1d1ea96), /* _Stl_tenpow[29]=(10**111)/(2**369) */ +ULL(0xd6f8d7509292d603), /* _Stl_tenpow[30]=(10**139)/(2**462) */ +ULL(0xd910f7ff28069da4), /* _Stl_tenpow[31]=(10**167)/(2**555) */ +ULL(0xdb2e51bfe9d0696a), /* _Stl_tenpow[32]=(10**195)/(2**648) */ +ULL(0xdd50f1996b947519), /* _Stl_tenpow[33]=(10**223)/(2**741) */ +ULL(0xdf78e4b2bd342cf7), /* _Stl_tenpow[34]=(10**251)/(2**834) */ +ULL(0xe1a63853bbd26451), /* _Stl_tenpow[35]=(10**279)/(2**927) */ +ULL(0xe3d8f9e563a198e5), /* _Stl_tenpow[36]=(10**307)/(2**1020) */ + +// /* _Stl_tenpow[36]=(10**335)/(2**) */ +// /* _Stl_tenpow[36]=(10**335)/(2**) */ + +ULL(0xfd87b5f28300ca0e), /* _Stl_tenpow[37]=(10**-28)/(2**-93) */ +ULL(0xfb158592be068d2f), /* _Stl_tenpow[38]=(10**-56)/(2**-186) */ +ULL(0xf8a95fcf88747d94), /* _Stl_tenpow[39]=(10**-84)/(2**-279) */ +ULL(0xf64335bcf065d37d), /* _Stl_tenpow[40]=(10**-112)/(2**-372) */ +ULL(0xf3e2f893dec3f126), /* _Stl_tenpow[41]=(10**-140)/(2**-465) */ +ULL(0xf18899b1bc3f8ca2), /* _Stl_tenpow[42]=(10**-168)/(2**-558) */ +ULL(0xef340a98172aace5), /* _Stl_tenpow[43]=(10**-196)/(2**-651) */ +ULL(0xece53cec4a314ebe), /* _Stl_tenpow[44]=(10**-224)/(2**-744) */ +ULL(0xea9c227723ee8bcb), /* _Stl_tenpow[45]=(10**-252)/(2**-837) */ +ULL(0xe858ad248f5c22ca), /* _Stl_tenpow[46]=(10**-280)/(2**-930) */ +ULL(0xe61acf033d1a45df), /* _Stl_tenpow[47]=(10**-308)/(2**-1023) */ +ULL(0xe3e27a444d8d98b8), /* _Stl_tenpow[48]=(10**-336)/(2**-1116) */ +ULL(0xe1afa13afbd14d6e) /* _Stl_tenpow[49]=(10**-364)/(2**-1209) */ +}; + +static const short _Stl_twoexp[80] = { +4,7,10,14,17,20,24,27,30,34,37,40,44,47,50,54,57,60,64,67,70,74,77,80,84,87,90, +183,276,369,462,555,648,741,834,927,1020, +-93,-186,-279,-372,-465,-558,-651,-744,-837,-930,-1023,-1116,-1209 +}; + +#define TEN_1 0 /* offset to 10 ** 1 */ +#define TEN_27 26 /* offset to 10 ** 27 */ +#define TEN_M28 37 /* offset to 10 ** -28 */ +#define NUM_HI_P 11 +#define NUM_HI_N 13 + +#define _Stl_HIBITULL (ULL(1) << 63) + +static void _Stl_norm_and_round(uint64& p, int& norm, uint64 prodhi, uint64 prodlo) { + norm = 0; + if ((prodhi & _Stl_HIBITULL) == 0) { + /* leading bit is a zero + * may have to normalize + */ + if ((prodhi == ~_Stl_HIBITULL) && + ((prodlo >> 62) == 0x3)) { /* normalization followed by round + * would cause carry to create + * extra bit, so don't normalize + */ + p = _Stl_HIBITULL; + return; + } + p = (prodhi << 1) | (prodlo >> 63); /* normalize */ + norm = 1; + prodlo <<= 1; + } + else { + p = prodhi; + } + + if ((prodlo & _Stl_HIBITULL) != 0) { /* first guard bit a one */ + if (((p & 0x1) != 0) || + prodlo != _Stl_HIBITULL ) { /* not borderline for round to even */ + /* round */ + ++p; + if (p == 0) + ++p; + } + } +} + +// Convert a 64-bitb fraction * 10^exp to a 64-bit fraction * 2^bexp. +// p: 64-bit fraction +// exp: base-10 exponent +// bexp: base-2 exponent (output parameter) +static void _Stl_tenscale(uint64& p, int exp, int& bexp) { + bexp = 0; + + if ( exp == 0 ) { /* no scaling needed */ + return; + } + + int exp_hi = 0, exp_lo = exp; /* exp = exp_hi*32 + exp_lo */ + int tlo = TEN_1, thi; /* offsets in power of ten table */ + int num_hi; /* number of high exponent powers */ + + if (exp > 0) { /* split exponent */ + if (exp_lo > 27) { + exp_lo++; + while (exp_lo > 27) { + exp_hi++; + exp_lo -= 28; + } + } + thi = TEN_27; + num_hi = NUM_HI_P; + } else { // exp < 0 + while (exp_lo < 0) { + exp_hi++; + exp_lo += 28; + } + thi = TEN_M28; + num_hi = NUM_HI_N; + } + + uint64 prodhi, prodlo; /* 128b product */ + int norm; /* number of bits of normalization */ + + int hi, lo; /* offsets in power of ten table */ + while (exp_hi) { /* scale */ + hi = (min) (exp_hi, num_hi); /* only a few large powers of 10 */ + exp_hi -= hi; /* could iterate in extreme case */ + hi += thi-1; + _Stl_mult64(p, _Stl_tenpow[hi], prodhi, prodlo); + _Stl_norm_and_round(p, norm, prodhi, prodlo); + bexp += _Stl_twoexp[hi] - norm; + } + + if (exp_lo) { + lo = tlo + exp_lo -1; + _Stl_mult64(p, _Stl_tenpow[lo], prodhi, prodlo); + _Stl_norm_and_round(p, norm, prodhi, prodlo); + bexp += _Stl_twoexp[lo] - norm; + } + + return; +} + +// First argument is a buffer of values from 0 to 9, NOT ascii. +// Second argument is number of digits in buffer, 1 <= digits <= 17. +// Third argument is base-10 exponent. + +/* IEEE representation */ +#if !defined (__linux__) + +union _Double_rep { + uint64 ival; + double val; +}; + +static double _Stl_atod(char *buffer, ptrdiff_t ndigit, int dexp) { + typedef numeric_limits limits; + _Double_rep drep; + uint64 &value = drep.ival; /* Value develops as follows: + * 1) decimal digits as an integer + * 2) left adjusted fraction + * 3) right adjusted fraction + * 4) exponent and fraction + */ + + uint32 guard; /* First guard bit */ + uint64 rest; /* Remaining guard bits */ + + int bexp; /* binary exponent */ + int nzero; /* number of non-zero bits */ + int sexp; /* scaling exponent */ + + char *bufferend; /* pointer to char after last digit */ + + /* Convert the decimal digits to a binary integer. */ + bufferend = buffer + ndigit; + value = 0; + + while (buffer < bufferend) { + value *= 10; + value += *buffer++; + } + + /* Check for zero and treat it as a special case */ + if (value == 0) { + return 0.0; + } + + /* Normalize value */ + bexp = 64; /* convert from 64b int to fraction */ + + /* Count number of non-zeroes in value */ + nzero = 0; + if ((value >> 32) != 0) { nzero = 32; } //*TY 03/25/2000 - added explicit comparison to zero to avoid uint64 to bool conversion operator + if ((value >> (16 + nzero)) != 0) { nzero += 16; } + if ((value >> ( 8 + nzero)) != 0) { nzero += 8; } + if ((value >> ( 4 + nzero)) != 0) { nzero += 4; } + if ((value >> ( 2 + nzero)) != 0) { nzero += 2; } + if ((value >> ( 1 + nzero)) != 0) { nzero += 1; } + if ((value >> ( nzero)) != 0) { nzero += 1; } + + /* Normalize */ + value <<= /*(uint64)*/ (64 - nzero); //*TY 03/25/2000 - removed extraneous cast to uint64 + bexp -= 64 - nzero; + + /* At this point we have a 64b fraction and a binary exponent + * but have yet to incorporate the decimal exponent. + */ + + /* multiply by 10^dexp */ + _Stl_tenscale(value, dexp, sexp); + bexp += sexp; + + if (bexp <= -1022) { /* HI denorm or underflow */ + bexp += 1022; + if (bexp < -53) { /* guaranteed underflow */ + value = 0; + } + else { /* denorm or possible underflow */ + int lead0 = 12 - bexp; /* 12 sign and exponent bits */ + + /* we must special case right shifts of more than 63 */ + if (lead0 > 64) { + rest = value; + guard = 0; + value = 0; + } + else if (lead0 == 64) { + rest = value & ((ULL(1)<< 63)-1); + guard = (uint32) ((value>> 63) & 1 ); + value = 0; + } + else { + rest = value & (((ULL(1) << lead0)-1)-1); + guard = (uint32) (((value>> lead0)-1) & 1); + value >>= /*(uint64)*/ lead0; /* exponent is zero */ + } + + /* Round */ + if (guard && ((value & 1) || rest) ) { + ++value; + if (value == (ULL(1) << (limits::digits - 1))) { /* carry created normal number */ + value = 0; + _Stl_set_exponent(value, 1); + } + } + } + } + else { /* not zero or denorm */ + /* Round to 53 bits */ + rest = value & ((1 << 10) - 1); + value >>= 10; + guard = (uint32) value & 1; + value >>= 1; + + /* value&1 guard rest Action + * + * dc 0 dc none + * 1 1 dc round + * 0 1 0 none + * 0 1 !=0 round + */ + if (guard) { + if (((value&1)!=0) || (rest!=0)) { + ++value; /* round */ + if ((value >> 53) != 0) { /* carry all the way across */ + value >>= 1; /* renormalize */ + ++bexp; + } + } + } + /* + * Check for overflow + * IEEE Double Precision Format + * (From Table 7-8 of Kane and Heinrich) + * + * Fraction bits 52 + * Emax +1023 + * Emin -1022 + * Exponent bias +1023 + * Exponent bits 11 + * Integer bit hidden + * Total width in bits 64 + */ + + if (bexp > limits::max_exponent) { /* overflow */ + return limits::infinity(); + } + else { /* value is normal */ + value &= ~(ULL(1) << (limits::digits - 1)); /* hide hidden bit */ + _Stl_set_exponent(value, bexp + 1022); /* add bias */ + } + } + + _STLP_STATIC_ASSERT(sizeof(uint64) >= sizeof(double)) + return drep.val; +} + +#endif + +#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \ + defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC) + +template +D _Stl_atodT(char *buffer, ptrdiff_t ndigit, int dexp) +{ + typedef numeric_limits limits; + + /* Convert the decimal digits to a binary integer. */ + char *bufferend = buffer + ndigit; /* pointer to char after last digit */ + _ll vv; + vv.i64 = 0L; + + while ( buffer < bufferend ) { + vv.i64 *= 10; + vv.i64 += *buffer++; + } + + if ( vv.i64 == ULL(0) ) { /* Check for zero and treat it as a special case */ + return D(0.0); + } + + /* Normalize value */ + + int bexp = 64; /* convert from 64b int to fraction */ + + /* Count number of non-zeroes in value */ + int nzero = 0; + if ((vv.i64 >> 32) != 0) { nzero = 32; } + if ((vv.i64 >> (16 + nzero)) != 0) { nzero += 16; } + if ((vv.i64 >> ( 8 + nzero)) != 0) { nzero += 8; } + if ((vv.i64 >> ( 4 + nzero)) != 0) { nzero += 4; } + if ((vv.i64 >> ( 2 + nzero)) != 0) { nzero += 2; } + if ((vv.i64 >> ( 1 + nzero)) != 0) { nzero += 1; } + if ((vv.i64 >> ( nzero)) != 0) { nzero += 1; } + + /* Normalize */ + nzero = 64 - nzero; + vv.i64 <<= nzero; // * TY 03/25/2000 - removed extraneous cast to uint64 + bexp -= nzero; + + /* At this point we have a 64b fraction and a binary exponent + * but have yet to incorporate the decimal exponent. + */ + + /* multiply by 10^dexp */ + int sexp; + _Stl_tenscale(vv.i64, dexp, sexp); + bexp += sexp; + + if ( bexp >= limits::min_exponent ) { /* not zero or denorm */ + if ( limits::digits < 64 ) { + /* Round to (64 - M + 1) bits */ + uint64_t rest = vv.i64 & ((~ULL(0) / ULL(2)) >> (limits::digits - 1)); + vv.i64 >>= M - 2; + uint32_t guard = (uint32) vv.i64 & 1; + vv.i64 >>= 1; + + /* value&1 guard rest Action + * + * dc 0 dc none + * 1 1 dc round + * 0 1 0 none + * 0 1 !=0 round + */ + + if (guard) { + if ( ((vv.i64 & 1) != 0) || (rest != 0) ) { + vv.i64++; /* round */ + if ( (vv.i64 >> (limits::digits < 64 ? limits::digits : 0)) != 0 ) { /* carry all the way across */ + vv.i64 >>= 1; /* renormalize */ + ++bexp; + } + } + } + + vv.i64 &= ~(ULL(1) << (limits::digits - 1)); /* hide hidden bit */ + } + /* + * Check for overflow + * IEEE Double Precision Format + * (From Table 7-8 of Kane and Heinrich) + * + * Fraction bits 52 + * Emax +1023 + * Emin -1022 + * Exponent bias +1023 + * Exponent bits 11 + * Integer bit hidden + * Total width in bits 64 + */ + + if (bexp > limits::max_exponent) { /* overflow */ + return limits::infinity(); + } + + /* value is normal */ + + IEEE v; + + v.ieee.mantissa0 = vv.i32.hi; + v.ieee.mantissa1 = vv.i32.lo; + v.ieee.negative = 0; + v.ieee.exponent = bexp + BIAS - 1; + + return v.d; + } + + /* HI denorm or underflow */ + bexp += BIAS - 1; + if (bexp < -limits::digits) { /* guaranteed underflow */ + vv.i64 = 0; + } else { /* denorm or possible underflow */ + + /* + * Problem point for long double: looks like this code reflect shareing of mantissa + * and exponent in 64b int; not so for long double + */ + + int lead0 = M - bexp; /* M = 12 sign and exponent bits */ + uint64_t rest; + uint32_t guard; + + /* we must special case right shifts of more than 63 */ + + if (lead0 > 64) { + rest = vv.i64; + guard = 0; + vv.i64 = 0; + } else if (lead0 == 64) { + rest = vv.i64 & ((ULL(1) << 63)-1); + guard = (uint32) ((vv.i64 >> 63) & 1 ); + vv.i64 = 0; + } else { + rest = vv.i64 & (((ULL(1) << lead0)-1)-1); + guard = (uint32) (((vv.i64 >> lead0)-1) & 1); + vv.i64 >>= /*(uint64)*/ lead0; /* exponent is zero */ + } + + /* Round */ + if (guard && ( (vv.i64 & 1) || rest)) { + vv.i64++; + if (vv.i64 == (ULL(1) << (limits::digits - 1))) { /* carry created normal number */ + IEEE v; + + v.ieee.mantissa0 = 0; + v.ieee.mantissa1 = 0; + v.ieee.negative = 0; + v.ieee.exponent = 1; + return v.d; + } + } + } + + IEEE v; + + v.ieee.mantissa0 = vv.i32.hi; + v.ieee.mantissa1 = vv.i32.lo; + v.ieee.negative = 0; + v.ieee.exponent = 0; + + return v.d; +} +#endif // __linux__ + +#ifndef __linux__ +static double _Stl_string_to_double(const char *s) { + typedef numeric_limits limits; + const int max_digits = limits::digits10 + 2; + unsigned c; + unsigned Negate, decimal_point; + char *d; + int exp; + int dpchar; + char digits[max_digits]; + + c = *s++; + + /* process sign */ + Negate = 0; + if (c == '+') { + c = *s++; + } else if (c == '-') { + Negate = 1; + c = *s++; + } + + d = digits; + dpchar = '.' - '0'; + decimal_point = 0; + exp = 0; + + for (;;) { + c -= '0'; + if (c < 10) { + if (d == digits + max_digits) { + /* ignore more than max_digits digits, but adjust exponent */ + exp += (decimal_point ^ 1); + } else { + if (c == 0 && d == digits) { + /* ignore leading zeros */ + } else { + *d++ = (char) c; + } + exp -= decimal_point; + } + } else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */ + decimal_point = 1; + } else { + break; + } + c = *s++; + } + + /* strtod cant return until it finds the end of the exponent */ + if (d == digits) { + return 0.0; + } + + if (c == 'e' - '0' || c == 'E' - '0') { + register unsigned negate_exp = 0; + register int e = 0; + c = *s++; + if (c == '+' || c == ' ') { + c = *s++; + } else if (c == '-') { + negate_exp = 1; + c = *s++; + } + if (c -= '0', c < 10) { + do { + e = e * 10 + (int)c; + c = *s++; + } while (c -= '0', c < 10); + + if (negate_exp) { + e = -e; + } + exp += e; + } + } + + double x; + ptrdiff_t n = d - digits; + if ((exp + n - 1) < limits::min_exponent10) { + x = 0; + } + else if ((exp + n - 1) > limits::max_exponent10) { + x = limits::infinity(); + } + else { + /* Let _Stl_atod diagnose under- and over-flows. + * If the input was == 0.0, we have already returned, + * so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW */ + x = _Stl_atod(digits, n, exp); + } + + if (Negate) { + x = -x; + } + + return x; +} + +#endif + +#if defined (__linux__) || defined (__MINGW32__) || defined (__CYGWIN__) || \ + defined (__BORLANDC__) || defined (__DMC__) || defined (__HP_aCC) + +template +D _Stl_string_to_doubleT(const char *s) +{ + typedef numeric_limits limits; + const int max_digits = limits::digits10; /* + 2 17 */; + unsigned c; + unsigned decimal_point; + char *d; + int exp; + D x; + int dpchar; + char digits[max_digits]; + + c = *s++; + + /* process sign */ + bool Negate = false; + if (c == '+') { + c = *s++; + } else if (c == '-') { + Negate = true; + c = *s++; + } + + d = digits; + dpchar = '.' - '0'; + decimal_point = 0; + exp = 0; + + for (;;) { + c -= '0'; + if (c < 10) { + if (d == digits + max_digits) { + /* ignore more than max_digits digits, but adjust exponent */ + exp += (decimal_point ^ 1); + } else { + if (c == 0 && d == digits) { + /* ignore leading zeros */ + } else { + *d++ = (char) c; + } + exp -= decimal_point; + } + } else if (c == (unsigned int) dpchar && !decimal_point) { /* INTERNATIONAL */ + decimal_point = 1; + } else { + break; + } + c = *s++; + } + /* strtod cant return until it finds the end of the exponent */ + if (d == digits) { + return D(0.0); + } + + if (c == 'e'-'0' || c == 'E'-'0') { + bool negate_exp = false; + register int e = 0; + c = *s++; + if (c == '+' || c == ' ') { + c = *s++; + } else if (c == '-') { + negate_exp = true; + c = *s++; + } + if (c -= '0', c < 10) { + do { + e = e * 10 + (int)c; + c = *s++; + } while (c -= '0', c < 10); + + if (negate_exp) { + e = -e; + } + exp += e; + } + } + + ptrdiff_t n = d - digits; + if ((exp + n - 1) < limits::min_exponent10) { + return D(0.0); // +0.0 is the same as -0.0 + } else if ((exp + n - 1) > limits::max_exponent10 ) { + // not good, because of x = -x below; this may lead to portability problems + x = limits::infinity(); + } else { + /* let _Stl_atod diagnose under- and over-flows */ + /* if the input was == 0.0, we have already returned, + so retval of +-Inf signals OVERFLOW, 0.0 UNDERFLOW + */ + x = _Stl_atodT(digits, n, exp); + } + + return Negate ? -x : x; +} + +#endif // __linux__ + +void _STLP_CALL +__string_to_float(const __iostring& v, float& val) +{ +#if !defined (__linux__) + val = (float)_Stl_string_to_double(v.c_str()); +#else + val = (float)_Stl_string_to_doubleT(v.c_str()); +#endif +} + +void _STLP_CALL +__string_to_float(const __iostring& v, double& val) +{ +#if !defined (__linux__) + val = _Stl_string_to_double(v.c_str()); +#else + val = _Stl_string_to_doubleT(v.c_str()); +#endif +} + +#if !defined (_STLP_NO_LONG_DOUBLE) +void _STLP_CALL +__string_to_float(const __iostring& v, long double& val) { +#if !defined (__linux__) && !defined (__MINGW32__) && !defined (__CYGWIN__) && \ + !defined (__BORLANDC__) && !defined (__DMC__) && !defined (__HP_aCC) + //The following function is valid only if long double is an alias for double. + _STLP_STATIC_ASSERT( sizeof(long double) <= sizeof(double) ) + val = _Stl_string_to_double(v.c_str()); +#else + val = _Stl_string_to_doubleT(v.c_str()); +#endif +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/num_put.cpp b/sdk/tlibstdcxx/src/num_put.cpp new file mode 100644 index 0000000000..e1235617db --- /dev/null +++ b/sdk/tlibstdcxx/src/num_put.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include + +_STLP_BEGIN_NAMESPACE + +// Note that grouping[0] is the number of digits in the *rightmost* group. +// We assume, without checking, that *last is null and that there is enough +// space in the buffer to extend the number past [first, last). +template +static ptrdiff_t +__insert_grouping_aux(Char* first, Char* last, const string& grouping, + Char separator, Char Plus, Char Minus, + int basechars) { + typedef string::size_type str_size; + + if (first == last) + return 0; + + int sign = 0; + + if (*first == Plus || *first == Minus) { + sign = 1; + ++first; + } + + first += basechars; + Char* cur_group = last; // Points immediately beyond the rightmost + // digit of the current group. + int groupsize = 0; // Size of the current group (if grouping.size() == 0, size + // of group unlimited: we force condition (groupsize <= 0)) + + for ( str_size n = 0; ; ) { // Index of the current group + if ( n < grouping.size() ) { + groupsize = __STATIC_CAST(int, grouping[n++] ); + } + + if ((groupsize <= 0) || (groupsize >= cur_group - first) || (groupsize == CHAR_MAX)) { + break; + } + + // Insert a separator character just before position cur_group - groupsize + cur_group -= groupsize; + ++last; + copy_backward(cur_group, last, last + 1); + *cur_group = separator; + } + + return (last - first) + sign + basechars; +} + +//Dynamic output buffer version. +template +static void +__insert_grouping_aux( /* __basic_iostring */ Str& iostr, size_t __group_pos, + const string& grouping, + Char separator, Char Plus, Char Minus, + int basechars) { + typedef string::size_type str_size; + + if (iostr.size() < __group_pos) + return; + + int __first_pos = 0; + Char __first = *iostr.begin(); + + if (__first == Plus || __first == Minus) { + ++__first_pos; + } + + __first_pos += basechars; + + typename Str::iterator cur_group(iostr.begin() + __group_pos); // Points immediately beyond the rightmost + // digit of the current group. + int groupsize = 0; // Size of the current group (if grouping.size() == 0, size + // of group unlimited: we force condition (groupsize <= 0)) + + for ( str_size n = 0; ; ) { // Index of the current group + if ( n < grouping.size() ) { + groupsize = __STATIC_CAST( int, grouping[n++] ); + } + + if ( (groupsize <= 0) || (groupsize >= ((cur_group - iostr.begin()) - __first_pos)) || + (groupsize == CHAR_MAX)) { + break; + } + + // Insert a separator character just before position cur_group - groupsize + cur_group -= groupsize; + cur_group = iostr.insert(cur_group, separator); + } +} + +//---------------------------------------------------------------------- +// num_put + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo() +{ return "0123456789abcdefx"; } + +_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi() +{ return "0123456789ABCDEFX"; } + +char* _STLP_CALL +__write_integer(char* buf, ios_base::fmtflags flags, long x) { + char tmp[64]; + char* bufend = tmp+64; + char* beg = __write_integer_backward(bufend, flags, x); + return copy(beg, bufend, buf); +} + +///------------------------------------- + +ptrdiff_t _STLP_CALL +__insert_grouping(char * first, char * last, const string& grouping, + char separator, char Plus, char Minus, int basechars) { + return __insert_grouping_aux(first, last, grouping, + separator, Plus, Minus, basechars); +} + +void _STLP_CALL +__insert_grouping(__iostring &str, size_t group_pos, const string& grouping, + char separator, char Plus, char Minus, int basechars) { + __insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars); +} + +#if !defined (_STLP_NO_WCHAR_T) +ptrdiff_t _STLP_CALL +__insert_grouping(wchar_t* first, wchar_t* last, const string& grouping, + wchar_t separator, wchar_t Plus, wchar_t Minus, + int basechars) { + return __insert_grouping_aux(first, last, grouping, separator, + Plus, Minus, basechars); +} + +void _STLP_CALL +__insert_grouping(__iowstring &str, size_t group_pos, const string& grouping, + wchar_t separator, wchar_t Plus, wchar_t Minus, + int basechars) { + __insert_grouping_aux(str, group_pos, grouping, separator, Plus, Minus, basechars); +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +//---------------------------------------------------------------------- +// Force instantiation of num_put<> +#if !defined(_STLP_NO_FORCE_INSTANTIATE) +template class _STLP_CLASS_DECLSPEC ostreambuf_iterator >; +// template class num_put; +template class num_put > >; +# ifndef _STLP_NO_WCHAR_T +template class ostreambuf_iterator >; +template class num_put > >; +// template class num_put; +# endif /* INSTANTIATE_WIDE_STREAMS */ +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/num_put_float.cpp b/sdk/tlibstdcxx/src/num_put_float.cpp new file mode 100644 index 0000000000..cb5c446860 --- /dev/null +++ b/sdk/tlibstdcxx/src/num_put_float.cpp @@ -0,0 +1,918 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include +#include + +#if defined (__DECCXX) +# define NDIG 400 +#else +# define NDIG 82 +#endif + +#define todigit(x) ((x)+'0') + +#if defined (_STLP_UNIX) + +# if defined (__sun) +# include +# endif + +# if defined (__sun) || defined (__digital__) || defined (__sgi) || defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) +// DEC, SGI & Solaris need this +# include +# include +# endif + +# if defined (__QNXNTO__) || ( defined(__GNUC__) && defined(__APPLE__) ) || defined(_STLP_USE_UCLIBC) /* 0.9.26 */ || \ + defined(__FreeBSD__) +# define USE_SPRINTF_INSTEAD +# endif + +# if defined (_AIX) // JFA 3-Aug-2000 +# include +# include +# endif + +# include +#endif + +#include +#include + +#if defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) || defined (__DJGPP) || \ + defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) +# include +#endif + +#if defined (__MRC__) || defined (__SC__) || defined (_CRAY) //*TY 02/24/2000 - added support for MPW +# include +#endif + +#if defined (__CYGWIN__) +# include +#endif + +#if defined (__MSL__) +# include // for atoi +# include // for snprintf +# include +# include +#endif + +#if defined (__ISCPP__) +# include +#endif + +#include + +#if defined (__DMC__) +# define snprintf _snprintf +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +#if defined (__MWERKS__) || defined(__BEOS__) +# define USE_SPRINTF_INSTEAD +#endif + +template +struct _Dig +{ + enum { dig = _Dig::dig + 1 }; +}; + +_STLP_TEMPLATE_NULL +struct _Dig<0> +{ + enum { dig = 0 }; +}; + +#ifdef _STLP_NO_LONG_DOUBLE +# define MAXEDIGITS int(_Dig::dig) +# define MAXFSIG DBL_DIG +# define MAXFCVT (DBL_DIG + 1) +#else +# define MAXEDIGITS int(_Dig::dig) +# define MAXFSIG LDBL_DIG +# define MAXFCVT (LDBL_DIG + 1) +#endif + +// Tests for infinity and NaN differ on different OSs. We encapsulate +// these differences here. +#if !defined (USE_SPRINTF_INSTEAD) +# if defined (__hpux) && defined (__GNUC__) +# define _STLP_USE_SIGN_HELPER +# elif defined (__DJGPP) || (defined (_STLP_USE_GLIBC) && ! defined (__MSL__)) || \ + defined (__CYGWIN__) || \ + defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__HP_aCC) +static inline bool _Stl_is_nan_or_inf(double x) +# if defined (isfinite) +{ return !isfinite(x); } +# else +{ return !finite(x); } +# endif +static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); } +static inline bool _Stl_is_inf(double x) { return isinf(x); } +// inline bool _Stl_is_neg_inf(double x) { return isinf(x) < 0; } +static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && x < 0; } +# elif (defined (__unix) || defined (__unix__)) && \ + !defined (__APPLE__) && !defined (__DJGPP) && !defined(__osf__) && \ + !defined (_CRAY) +static inline bool _Stl_is_nan_or_inf(double x) { return IsNANorINF(x); } +static inline bool _Stl_is_inf(double x) { return IsNANorINF(x) && IsINF(x); } +static inline bool _Stl_is_neg_inf(double x) { return (IsINF(x)) && (x < 0.0); } +static inline bool _Stl_is_neg_nan(double x) { return IsNegNAN(x); } +# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) +static inline bool _Stl_is_nan_or_inf(double x) { return !_finite(x); } +# if !defined (__BORLANDC__) +static inline bool _Stl_is_inf(double x) { + int fclass = _fpclass(x); + return fclass == _FPCLASS_NINF || fclass == _FPCLASS_PINF; +} +static inline bool _Stl_is_neg_inf(double x) { return _fpclass(x) == _FPCLASS_NINF; } +# else +static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && !_isnan(x);} +static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; } +# endif +static inline bool _Stl_is_neg_nan(double x) { return _isnan(x) && _copysign(1., x) < 0 ; } +# if defined (__BORLANDC__) +static inline bool _Stl_is_nan_or_inf(long double x) { return !_finitel(x); } +static inline bool _Stl_is_inf(long double x) { return _Stl_is_nan_or_inf(x) && !_isnanl(x);} +static inline bool _Stl_is_neg_inf(long double x) { return _Stl_is_inf(x) && x < 0 ; } +static inline bool _Stl_is_neg_nan(long double x) { return _isnanl(x) && _copysignl(1.l, x) < 0 ; } +# elif !defined (_STLP_NO_LONG_DOUBLE) +// Simply there to avoid warning long double -> double implicit conversion: +static inline bool _Stl_is_nan_or_inf(long double x) { return _Stl_is_nan_or_inf(__STATIC_CAST(double, x)); } +static inline bool _Stl_is_inf(long double x) { return _Stl_is_inf(__STATIC_CAST(double, x));} +static inline bool _Stl_is_neg_inf(long double x) { return _Stl_is_neg_inf(__STATIC_CAST(double, x)); } +static inline bool _Stl_is_neg_nan(long double x) { return _Stl_is_neg_nan(__STATIC_CAST(double, x)); } +# endif +# elif defined (__MRC__) || defined (__SC__) || defined (__DMC__) +static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !isfinite(x); } +static bool _Stl_is_inf(double x) { return !isfinite(x); } +static bool _Stl_is_neg_inf(double x) { return !isfinite(x) && signbit(x); } +static bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); } +# elif /* defined(__FreeBSD__) || defined(__OpenBSD__) || */ (defined(__GNUC__) && defined(__APPLE__)) +static inline bool _Stl_is_nan_or_inf(double x) { return !finite(x); } +static inline bool _Stl_is_inf(double x) { return _Stl_is_nan_or_inf(x) && ! isnan(x); } +static inline bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && x < 0 ; } +static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && copysign(1., x) < 0 ; } +# elif defined( _AIX ) // JFA 11-Aug-2000 +static bool _Stl_is_nan_or_inf(double x) { return isnan(x) || !finite(x); } +static bool _Stl_is_inf(double x) { return !finite(x); } +// bool _Stl_is_neg_inf(double x) { return _class(x) == FP_MINUS_INF; } +static bool _Stl_is_neg_inf(double x) { return _Stl_is_inf(x) && ( copysign(1., x) < 0 ); } +static bool _Stl_is_neg_nan(double x) { return isnan(x) && ( copysign(1., x) < 0 ); } +# elif defined (__ISCPP__) +static inline bool _Stl_is_nan_or_inf (double x) { return _fp_isINF(x) || _fp_isNAN(x); } +static inline bool _Stl_is_inf (double x) { return _fp_isINF(x); } +static inline bool _Stl_is_neg_inf (double x) { return _fp_isINF(x) && x < 0; } +static inline bool _Stl_is_neg_nan (double x) { return _fp_isNAN(x) && x < 0; } +# elif defined (_CRAY) +# if defined (_CRAYIEEE) +static inline bool _Stl_is_nan_or_inf(double x) { return isnan(x) || isinf(x); } +static inline bool _Stl_is_inf(double x) { return isinf(x); } +static inline bool _Stl_is_neg_inf(double x) { return isinf(x) && signbit(x); } +static inline bool _Stl_is_neg_nan(double x) { return isnan(x) && signbit(x); } +# else +static inline bool _Stl_is_nan_or_inf(double x) { return false; } +static inline bool _Stl_is_inf(double x) { return false; } +static inline bool _Stl_is_neg_inf(double x) { return false; } +static inline bool _Stl_is_neg_nan(double x) { return false; } +# endif +# else // nothing from above +# define USE_SPRINTF_INSTEAD +# endif +#endif // !USE_SPRINTF_INSTEAD + +#if !defined (USE_SPRINTF_INSTEAD) +// Reentrant versions of floating-point conversion functions. The argument +// lists look slightly different on different operating systems, so we're +// encapsulating the differences here. + +# if defined (__CYGWIN__) || defined(__DJGPP) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) +{ return ecvtbuf(x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) +{ return fcvtbuf(x, n, pt, sign, buf); } +# if !defined (_STLP_NO_LONG_DOUBLE) +# if defined (__CYGWIN__) +# define _STLP_EMULATE_LONG_DOUBLE_CVT +# else +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return ecvtbuf(x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return fcvtbuf(x, n, pt, sign, buf); } +# endif +# endif +# elif defined (_STLP_USE_GLIBC) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return ecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return fcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; } +# ifndef _STLP_NO_LONG_DOUBLE +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return qecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return qfcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0; } +# endif +# define _STLP_NEED_CVT_BUFFER_SIZE +# elif defined (__sun) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) +{ return econvert(x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) +{ return fconvert(x, n, pt, sign, buf); } +# ifndef _STLP_NO_LONG_DOUBLE +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return qeconvert(&x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return qfconvert(&x, n, pt, sign, buf); } +# endif +# elif defined (__DECCXX) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return (ecvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return (fcvt_r(x, n, pt, sign, buf, bsize) == 0 ? buf : 0); } +# ifndef _STLP_NO_LONG_DOUBLE +// fbp : no "long double" conversions ! +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return (ecvt_r((double)x, n, pt, sign, buf, bsize) == 0 ? buf : 0) ; } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf, size_t bsize) +{ return (fcvt_r((double)x, n, pt, sign, buf, bsize) == 0 ? buf : 0); } +# endif +# define _STLP_NEED_CVT_BUFFER_SIZE +# elif defined (__hpux) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign) +{ return ecvt(x, n, pt, sign); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign) +{ return fcvt(x, n, pt, sign); } +# if !defined (_STLP_NO_LONG_DOUBLE) +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign) +{ return _ldecvt(*(long_double*)&x, n, pt, sign); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign) +{ return _ldfcvt(*(long_double*)&x, n, pt, sign); } +# endif +# define _STLP_CVT_NEED_SYNCHRONIZATION +# elif defined (__unix) && !defined (__APPLE__) && !defined (_CRAY) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) +{ return ecvt_r(x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) +{ return fcvt_r(x, n, pt, sign, buf); } +# if !defined (_STLP_NO_LONG_DOUBLE) +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return qecvt_r(x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return qfcvt_r(x, n, pt, sign, buf); } +# endif +# elif defined (_STLP_MSVC_LIB) || defined (__MINGW32__) || defined (__BORLANDC__) +# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS) +# define _STLP_APPEND(a, b) a##b +# define _STLP_BUF_PARAMS , char* buf, size_t bsize +# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) _STLP_APPEND(F, _s)(buf, bsize, X, N, PT, SIGN); return buf +# else +# define _STLP_BUF_PARAMS +# define _STLP_SECURE_FUN(F, X, N, PT, SIGN) return F(X, N, PT, SIGN) +# define _STLP_CVT_NEED_SYNCHRONIZATION +# endif +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS) +{ _STLP_SECURE_FUN(_ecvt, x, n, pt, sign); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign _STLP_BUF_PARAMS) +{ _STLP_SECURE_FUN(_fcvt, x, n, pt, sign); } +# if !defined (_STLP_NO_LONG_DOUBLE) +# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS) +# define _STLP_PARAMS , buf, bsize +# else +# define _STLP_PARAMS +# endif +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS) +{ return _Stl_ecvtR(__STATIC_CAST(double, x), n, pt, sign _STLP_PARAMS); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign _STLP_BUF_PARAMS) +{ return _Stl_fcvtR(__STATIC_CAST(double, x), n, pt, sign _STLP_PARAMS); } +# undef _STLP_PARAMS +# endif +# undef _STLP_SECURE_FUN +# undef _STLP_BUF_PARAMS +# undef _STLP_APPEND +# if defined (__BORLANDC__) /* || defined (__GNUC__) MinGW do not support 'L' modifier so emulation do not work */ +# define _STLP_EMULATE_LONG_DOUBLE_CVT +# endif +# elif defined (__ISCPP__) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) +{ return _fp_ecvt( x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) +{ return _fp_fcvt(x, n, pt, sign, buf); } +# if !defined (_STLP_NO_LONG_DOUBLE) +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return _fp_ecvt( x, n, pt, sign, buf); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) +{ return _fp_fcvt(x, n, pt, sign, buf); } +# endif +# elif defined (_AIX) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || \ + defined (__MRC__) || defined (__SC__) || defined (_CRAY) || \ + defined (_STLP_SCO_OPENSERVER) || defined (__NCR_SVR) || \ + defined (__DMC__) +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign) +{ return ecvt(x, n, pt, sign ); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign) +{ return fcvt(x, n, pt, sign); } +# if !defined (_STLP_NO_LONG_DOUBLE) +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign) +{ return ecvt(x, n, pt, sign ); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign) +{ return fcvt(x, n, pt, sign); } +# endif +# define _STLP_CVT_NEED_SYNCHRONIZATION +# else +# error Missing _Stl_ecvtR and _Stl_fcvtR implementations. +# endif + +#if defined (_STLP_CVT_NEED_SYNCHRONIZATION) +/* STLport synchronize access to *cvt functions but those methods might + * be called from outside, in this case we will still have a race condition. */ +# if defined (_STLP_THREADS) +static _STLP_STATIC_MUTEX& put_float_mutex() { + static _STLP_STATIC_MUTEX __put_float_mutex _STLP_MUTEX_INITIALIZER; + return __put_float_mutex; +} +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char* buf) { + _STLP_auto_lock lock(put_float_mutex()); + strcpy(buf, _Stl_ecvtR(x, n, pt, sign)); return buf; +} +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char* buf) { + _STLP_auto_lock lock(put_float_mutex()); + strcpy(buf, _Stl_fcvtR(x, n, pt, sign)); return buf; +} +# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_EMULATE_LONG_DOUBLE_CVT) +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) { + _STLP_auto_lock lock(put_float_mutex()); + strcpy(buf, _Stl_ecvtR(x, n, pt, sign)); return buf; +} +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) { + _STLP_auto_lock lock(put_float_mutex()); + strcpy(buf, _Stl_fcvtR(x, n, pt, sign)); return buf; +} +# endif +# else +static inline char* _Stl_ecvtR(double x, int n, int* pt, int* sign, char*) +{ return _Stl_ecvtR(x, n, pt, sign); } +static inline char* _Stl_fcvtR(double x, int n, int* pt, int* sign, char*) +{ return _Stl_fcvtR(x, n, pt, sign); } +# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_EMULATE_LONG_DOUBLE_CVT) +static inline char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char*) +{ return _Stl_ecvtR(x, n, pt, sign); } +static inline char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char*) +{ return _Stl_fcvtR(x, n, pt, sign); } +# endif +# endif +#endif + +# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) && !defined (_STLP_NEED_CVT_BUFFER_SIZE) +# define _STLP_CVT_BUFFER(B) B +# else +# define _STLP_CVT_BUFFER(B) _STLP_ARRAY_AND_SIZE(B) +# endif + +# if defined (_STLP_EMULATE_LONG_DOUBLE_CVT) +static void __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier); + +// Emulation of ecvt/fcvt functions using sprintf: +static char* _Stl_ecvtR(long double x, int n, int* pt, int* sign, char* buf) { + // If long double value can be safely converted to double without losing precision + // we use the ecvt function for double: + double y = __STATIC_CAST(double, x); + if (x == y) + return _Stl_ecvtR(y, n, pt, sign, buf); + + char fmtbuf[32]; + __fill_fmtbuf(fmtbuf, 0, 'L'); + sprintf(buf, fmtbuf, n, x < 0.0l ? -x : x); + /* We are waiting for something having the form x.xxxe+yyyy */ + *pt = 0; + *sign = 0; + int i = -1; + int offset = 0; + while (buf[++i] != 0 && n != 0) { + if (buf[i] >= '0' && buf[i] <= '9') { + --n; + if (offset != 0) + buf[i - offset] = buf[i]; + } + else { + if (offset != 0) break; + ++offset; + *pt = i; + } + } + if (offset != 0) + buf[i - offset] = 0; + // Extract exponent part in point position: + int e = 0; + while (buf[++i] != 0) { + if (buf[i] >= '0' && buf[i] <= '9') { + e = e * 10 + (buf[i] - '0'); + } + } + *pt += e; + return buf; +} + +static char* _Stl_fcvtR(long double x, int n, int* pt, int* sign, char* buf) { + // If long double value can be safely converted to double without losing precision + // we use the fcvt function for double: + double y = __STATIC_CAST(double, x); + if (x == y) + return _Stl_fcvtR(y, n, pt, sign, buf); + + char fmtbuf[32]; + __fill_fmtbuf(fmtbuf, ios_base::fixed, 'L'); + sprintf(buf, fmtbuf, n, x < 0.0l ? -x : x); + *pt = 0; + *sign = 0; + int i = -1; + int offset = 0; + while (buf[++i] != 0 && (offset == 0 || n != 0)) { + if (buf[i] >= '0' && buf[i] <= '9') { + if (offset != 0) { + --n; + buf[i - offset] = buf[i]; + } + } + else { + ++offset; + *pt = i; + } + } + if (offset != 0) + buf[i - offset] = 0; + else + *pt = i; + return buf; +} +#endif + +//---------------------------------------------------------------------- +// num_put + +// __format_float formats a mantissa and exponent as returned by +// one of the conversion functions (ecvt_r, fcvt_r, qecvt_r, qfcvt_r) +// according to the specified precision and format flags. This is +// based on doprnt but is much simpler since it is concerned only +// with floating point input and does not consider all formats. It +// also does not deal with blank padding, which is handled by +// __copy_float_and_fill. + +static size_t __format_float_scientific( __iostring& buf, const char *bp, + int decpt, int sign, bool is_zero, + ios_base::fmtflags flags, + int precision) { + // sign if required + if (sign) + buf += '-'; + else if (flags & ios_base::showpos) + buf += '+'; + + // first digit of mantissa + buf += *bp++; + + // start of grouping position, grouping won't occur in scientific notation + // as it is impossible to have something like 1234.0e04 but we return a correct + // group position for coherency with __format_float_fixed. + size_t __group_pos = buf.size(); + + // decimal point if required + if (precision != 0 || flags & ios_base::showpoint) { + buf += '.'; + } + + // rest of mantissa + while (*bp != 0 && precision--) + buf += *bp++; + + // trailing 0 if needed + if (precision > 0) + buf.append(precision, '0'); + + // exponent size = number of digits + exponent sign + exponent symbol + trailing zero + char expbuf[MAXEDIGITS + 3]; + //We start filling at the buffer end + char *suffix = expbuf + MAXEDIGITS + 2; + *suffix = 0; + if (!is_zero) { + int nn = decpt - 1; + if (nn < 0) + nn = -nn; + for (; nn > 9; nn /= 10) + *--suffix = (char) todigit(nn % 10); + *--suffix = (char) todigit(nn); + } + + // prepend leading zeros to exponent + // C89 Standard says that it should be at least 2 digits, C99 Standard says that + // we stop prepend zeros if more than 3 digits. To repect both STLport prepend zeros + // until it is 2 digits. + while (suffix > &expbuf[MAXEDIGITS]) + *--suffix = '0'; + + // put in the exponent sign + *--suffix = (char) ((decpt > 0 || is_zero ) ? '+' : '-'); + + // put in the e + *--suffix = flags & ios_base::uppercase ? 'E' : 'e'; + + // copy the suffix + buf += suffix; + return __group_pos; +} + +static size_t __format_float_fixed( __iostring &buf, const char *bp, + int decpt, int sign, + ios_base::fmtflags flags, + int precision) { + if ( sign && (decpt > -precision) && (*bp != 0) ) + buf += '-'; + else if ( flags & ios_base::showpos ) + buf += '+'; + + // digits before decimal point + int nnn = decpt; + do { + buf += (nnn <= 0 || *bp == 0) ? '0' : *bp++; + } while ( --nnn > 0 ); + + // start of grouping position + size_t __group_pos = buf.size(); + + // decimal point if needed + if ( flags & ios_base::showpoint || precision > 0 ) { + buf += '.'; + } + + // digits after decimal point if any + while ( *bp != 0 && --precision >= 0 ) { + buf += (++decpt <= 0) ? '0' : *bp++; + } + + // trailing zeros if needed + if (precision > 0) + buf.append(precision, '0'); + + return __group_pos; +} + +#if defined (_STLP_USE_SIGN_HELPER) +template +struct float_sign_helper { + float_sign_helper(_FloatT __x) + { _M_number._num = __x; } + + bool is_negative() const { + const unsigned short sign_mask(1 << (sizeof(unsigned short) * CHAR_BIT - 1)); + return (get_sign_word() & sign_mask) != 0; + } +private: + union { + unsigned short _Words[8]; + _FloatT _num; + } _M_number; + + unsigned short get_word_higher() const _STLP_NOTHROW + { return _M_number._Words[0]; } + unsigned short get_word_lower() const _STLP_NOTHROW + { return _M_number._Words[(sizeof(_FloatT) >= 12 ? 10 : sizeof(_FloatT)) / sizeof(unsigned short) - 1]; } + unsigned short get_sign_word() const _STLP_NOTHROW +# if defined (_STLP_BIG_ENDIAN) + { return get_word_higher(); } +# else /* _STLP_LITTLE_ENDIAN */ + { return get_word_lower(); } +# endif +}; +#endif + +template +static size_t __format_nan_or_inf(__iostring& buf, _FloatT x, ios_base::fmtflags flags) { + static const char* inf[2] = { "inf", "Inf" }; + static const char* nan[2] = { "nan", "NaN" }; + const char** inf_or_nan; +#if !defined (_STLP_USE_SIGN_HELPER) + if (_Stl_is_inf(x)) { // Infinity + inf_or_nan = inf; + if (_Stl_is_neg_inf(x)) + buf += '-'; + else if (flags & ios_base::showpos) + buf += '+'; + } else { // NaN + inf_or_nan = nan; + if (_Stl_is_neg_nan(x)) + buf += '-'; + else if (flags & ios_base::showpos) + buf += '+'; + } +#else + typedef numeric_limits<_FloatT> limits; + if (x == limits::infinity() || x == -limits::infinity()) { + inf_or_nan = inf; + } else { // NaN + inf_or_nan = nan; + } + float_sign_helper<_FloatT> helper(x); + if (helper.is_negative()) + buf += '-'; + else if (flags & ios_base::showpos) + buf += '+'; +#endif + size_t ret = buf.size(); + buf += inf_or_nan[flags & ios_base::uppercase ? 1 : 0]; + return ret; +} + +static inline size_t __format_float(__iostring &buf, const char * bp, + int decpt, int sign, bool is_zero, + ios_base::fmtflags flags, + int precision) { + size_t __group_pos = 0; + switch (flags & ios_base::floatfield) { + case ios_base::scientific: + __group_pos = __format_float_scientific( buf, bp, decpt, sign, is_zero, + flags, precision); + break; + case ios_base::fixed: + __group_pos = __format_float_fixed( buf, bp, decpt, sign, + flags, precision); + break; + default: // g format + // establish default precision + if (flags & ios_base::showpoint || precision > 0) { + if (precision == 0) precision = 1; + } else + precision = 6; + + // reset exponent if value is zero + if (is_zero) + decpt = 1; + + int kk = precision; + if (!(flags & ios_base::showpoint)) { + size_t n = strlen(bp); + if (n < (size_t)kk) + kk = (int)n; + while (kk >= 1 && bp[kk-1] == '0') + --kk; + } + + if (decpt < -3 || decpt > precision) { + precision = kk - 1; + __group_pos = __format_float_scientific( buf, bp, decpt, sign, is_zero, + flags, precision); + } else { + precision = kk - decpt; + __group_pos = __format_float_fixed( buf, bp, decpt, sign, + flags, precision); + } + break; + } /* switch */ + return __group_pos; +} + +#endif + +#if defined (USE_SPRINTF_INSTEAD) || defined (_STLP_EMULATE_LONG_DOUBLE_CVT) +struct GroupPos { + bool operator () (char __c) const { + return __c == '.' || + __c == 'e' || __c == 'E'; + } +}; + +// Creates a format string for sprintf() +static void __fill_fmtbuf(char* fmtbuf, ios_base::fmtflags flags, char long_modifier) { + fmtbuf[0] = '%'; + int i = 1; + + if (flags & ios_base::showpos) + fmtbuf[i++] = '+'; + + if (flags & ios_base::showpoint) + fmtbuf[i++] = '#'; + + fmtbuf[i++] = '.'; + fmtbuf[i++] = '*'; + + if (long_modifier) + fmtbuf[i++] = long_modifier; + + switch (flags & ios_base::floatfield) + { + case ios_base::scientific: + fmtbuf[i++] = (flags & ios_base::uppercase) ? 'E' : 'e'; + break; + case ios_base::fixed: +# if defined (__FreeBSD__) + fmtbuf[i++] = 'f'; +# else + fmtbuf[i++] = (flags & ios_base::uppercase) ? 'F' : 'f'; +# endif + break; + default: + fmtbuf[i++] = (flags & ios_base::uppercase) ? 'G' : 'g'; + break; + } + + fmtbuf[i] = 0; +} + +#endif /* USE_SPRINTF_INSTEAD */ + +template +static size_t __write_floatT(__iostring &buf, ios_base::fmtflags flags, int precision, + _FloatT x +#if defined (USE_SPRINTF_INSTEAD) + , char modifier) { + /* In theory, if we want 'arbitrary' precision, we should use 'arbitrary' + * buffer size below, but really we limited by exponent part in double. + * - ptr + */ + typedef numeric_limits<_FloatT> limits; + char static_buf[limits::max_exponent10 + 6]; // 6: -xxx.yyyE-zzz (sign, dot, E, exp sign, \0) + char fmtbuf[32]; + __fill_fmtbuf(fmtbuf, flags, modifier); + snprintf(_STLP_ARRAY_AND_SIZE(static_buf), fmtbuf, precision, x); + buf = static_buf; + return find_if(buf.begin(), buf.end(), GroupPos()) - buf.begin(); +#else + ) { + typedef numeric_limits<_FloatT> limits; + //If numeric_limits support is correct we use the exposed values to detect NaN and infinity: + if (limits::has_infinity && limits::has_quiet_NaN) { + if (!(x == x) || // NaN check + (x == limits::infinity() || x == -limits::infinity())) { + return __format_nan_or_inf(buf, x, flags); + } + } + // numeric_limits support is not good enough, we rely on platform dependent function + // _Stl_is_nan_or_inf that do not support long double. + else if (_Stl_is_nan_or_inf(x)) { + return __format_nan_or_inf(buf, x, flags); + } +# if defined (__MINGW32__) + //For the moment MinGW is limited to display at most numeric_limits::max() + if (x > numeric_limits::max() || + x < -numeric_limits::max()) { + return __format_nan_or_inf(buf, x, flags); + } +# endif + + /* Buffer size is max number of digits which is the addition of: + * - max_exponent10: max number of digits in fixed mode + * - digits10 + 2: max number of significant digits + * - trailing '\0' + */ + char cvtbuf[limits::max_exponent10 + limits::digits10 + 2 + 1]; + char *bp; + int decpt, sign; + + switch (flags & ios_base::floatfield) { + case ios_base::fixed: + { + /* Here, number of digits represents digits _after_ decimal point. + * In order to limit static buffer size we have to give 2 different values depending on x value. + * For small values (abs(x) < 1) we need as many digits as requested by precision limited by the maximum number of digits + * which is min_exponent10 + digits10 + 2 + * For bigger values we won't have more than limits::digits10 + 2 digits after decimal point. */ + int digits10 = (x > -1.0 && x < 1.0 ? -limits::min_exponent10 + limits::digits10 + 2 + : limits::digits10 + 2); + bp = _Stl_fcvtR(x, (min) (precision, digits10), &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf) ); + } + break; + case ios_base::scientific: + default: + /* Here, number of digits is total number of digits which is limited to digits10 + 2. */ + { + int digits10 = limits::digits10 + 2; + bp = _Stl_ecvtR(x, (min) (precision, digits10), &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf) ); + } + break; + } + return __format_float(buf, bp, decpt, sign, x == 0.0, flags, precision); +#endif +} + +size_t _STLP_CALL +__write_float(__iostring &buf, ios_base::fmtflags flags, int precision, + double x) { + return __write_floatT(buf, flags, precision, x +#if defined (USE_SPRINTF_INSTEAD) + , 0 +#endif + ); +} + +#if !defined (_STLP_NO_LONG_DOUBLE) +size_t _STLP_CALL +__write_float(__iostring &buf, ios_base::fmtflags flags, int precision, + long double x) { + return __write_floatT(buf, flags, precision, x +#if defined (USE_SPRINTF_INSTEAD) + , 'L' +#endif + ); +} +#endif + +void _STLP_CALL __get_floor_digits(__iostring &out, _STLP_LONGEST_FLOAT_TYPE __x) { + typedef numeric_limits<_STLP_LONGEST_FLOAT_TYPE> limits; +#if defined (USE_SPRINTF_INSTEAD) + char cvtbuf[limits::max_exponent10 + 6]; +# if !defined (_STLP_NO_LONG_DOUBLE) + snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%Lf", __x); // check for 1234.56! +# else + snprintf(_STLP_ARRAY_AND_SIZE(cvtbuf), "%f", __x); // check for 1234.56! +# endif + char *p = strchr( cvtbuf, '.' ); + if ( p == 0 ) { + out.append( cvtbuf ); + } else { + out.append( cvtbuf, p ); + } +#else + char cvtbuf[limits::max_exponent10 + 1]; + char * bp; + int decpt, sign; + bp = _Stl_fcvtR(__x, 0, &decpt, &sign, _STLP_CVT_BUFFER(cvtbuf)); + + if (sign) { + out += '-'; + } + out.append(bp, bp + decpt); +#endif +} + + +#if !defined (_STLP_NO_WCHAR_T) +void _STLP_CALL __convert_float_buffer( __iostring const& str, __iowstring &out, + const ctype& ct, wchar_t dot, bool __check_dot) { + string::const_iterator str_ite(str.begin()), str_end(str.end()); + + //First loop, check the dot char + if (__check_dot) { + while (str_ite != str_end) { + if (*str_ite != '.') { + out += ct.widen(*str_ite++); + } else { + out += dot; + break; + } + } + } else { + if (str_ite != str_end) { + out += ct.widen(*str_ite); + } + } + + if (str_ite != str_end) { + //Second loop, dot has been found, no check anymore + while (++str_ite != str_end) { + out += ct.widen(*str_ite); + } + } +} + +#endif + +void _STLP_CALL +__adjust_float_buffer(__iostring &str, char dot) { + if ('.' != dot) { + size_t __dot_pos = str.find('.'); + if (__dot_pos != string::npos) { + str[__dot_pos] = dot; + } + } +} + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/numpunct.cpp b/sdk/tlibstdcxx/src/numpunct.cpp new file mode 100644 index 0000000000..cbadc7ab08 --- /dev/null +++ b/sdk/tlibstdcxx/src/numpunct.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// numpunct +char numpunct::do_decimal_point() const {return '.';} +char numpunct::do_thousands_sep() const { return ','; } +string numpunct::do_grouping() const { return string();} +string numpunct::do_truename() const { return "true";} +string numpunct::do_falsename() const { return "false"; } +numpunct::~numpunct() {} + +#if !defined (_STLP_NO_WCHAR_T) +wchar_t numpunct::do_decimal_point() const { return L'.'; } +wchar_t numpunct::do_thousands_sep() const { return L','; } +string numpunct::do_grouping() const { return string(); } +wstring numpunct::do_truename() const { return L"true"; } +wstring numpunct::do_falsename() const { return L"false"; } +numpunct::~numpunct() {} +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/ostream.cpp b/sdk/tlibstdcxx/src/ostream.cpp new file mode 100644 index 0000000000..96d4737409 --- /dev/null +++ b/sdk/tlibstdcxx/src/ostream.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include + +_STLP_BEGIN_NAMESPACE + +#if !defined(_STLP_NO_FORCE_INSTANTIATE) + +// instantiations +template class _STLP_CLASS_DECLSPEC basic_ostream >; + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +template class _STLP_CLASS_DECLSPEC _Osentry >; +# endif + +#ifndef _STLP_NO_WCHAR_T + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +template class _STLP_CLASS_DECLSPEC _Osentry >; +# endif +template class _STLP_CLASS_DECLSPEC basic_ostream >; +#endif + +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/sparc_atomic.s b/sdk/tlibstdcxx/src/sparc_atomic.s new file mode 100644 index 0000000000..67e41d6283 --- /dev/null +++ b/sdk/tlibstdcxx/src/sparc_atomic.s @@ -0,0 +1,68 @@ + .section ".text",#alloc,#execinstr + .align 8 + .skip 16 + + + /* + ** int _STLP_atomic_exchange (void *pvalue, int value) + */ + + .type _STLP_atomic_exchange,#function + .global _STLP_atomic_exchange + .align 8 + +_STLP_atomic_exchange: +0: + ld [%o0], %o2 ! Set the current value + mov %o1, %o3 ! Set the new value +! swap [%o0], %o3 ! Do the compare and swap + cas [%o0], %o2, %o3 + cmp %o2, %o3 ! Check whether successful + bne 0b ! Retry upon failure + stbar + mov %o2, %o0 ! Set the new value + retl ! return + nop + .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange) + + /* int _STLP_atomic_increment (void *pvalue) */ + + .type _STLP_atomic_increment,#function + .global _STLP_atomic_increment + .align 8 +_STLP_atomic_increment: +1: + ld [%o0], %o2 ! set the current + add %o2, 0x1, %o3 ! Increment and store current +! swap [%o0], %o3 ! Do the compare and swap + cas [%o0], %o2, %o3 + cmp %o3, %o2 ! Check whether successful + bne 1b ! Retry if we failed. + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before + ! returning + nop + retl ! return + nop + + .size _STLP_atomic_increment,(.-_STLP_atomic_increment) + + + /* int _STLP_atomic_decrement (void *pvalue) */ + .type _STLP_atomic_decrement,#function + .global _STLP_atomic_decrement + .align 8 + +_STLP_atomic_decrement: +2: + ld [%o0], %o2 ! set the current + sub %o2, 0x1, %o3 ! decrement and store current +! swap [%o0], %o3 ! Do the compare and swap + cas [%o0], %o2, %o3 + cmp %o3, %o2 ! Check whether successful + bne 2b ! Retry if we failed. + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before + nop + ! returning + retl ! return + nop + .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement) diff --git a/sdk/tlibstdcxx/src/sparc_atomic64.s b/sdk/tlibstdcxx/src/sparc_atomic64.s new file mode 100644 index 0000000000..ff2c42a82c --- /dev/null +++ b/sdk/tlibstdcxx/src/sparc_atomic64.s @@ -0,0 +1,65 @@ + .section ".text",#alloc,#execinstr + .align 8 + .skip 16 + +! int _STLP_atomic_exchange (void *pvalue, int value) +! + + .type _STLP_atomic_exchange,#function + .global _STLP_atomic_exchange + .align 8 + +_STLP_atomic_exchange: +1: + ldx [%o0], %o2 ! Set the current value + mov %o1, %o3 ! Set the new value + casx [%o0], %o2, %o3 ! Do the compare and swap + cmp %o2, %o3 ! Check whether successful + bne 1b ! Retry upon failure + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before + ! returning + retl ! return + mov %o2, %o0 ! Set the new value + .size _STLP_atomic_exchange,(.-_STLP_atomic_exchange) + + +! int _STLP_atomic_increment (void *pvalue) + + .type _STLP_atomic_increment,#function + .global _STLP_atomic_increment + .align 8 +_STLP_atomic_increment: +0: + ldx [%o0], %o2 ! set the current + addx %o2, 0x1, %o3 ! Increment and store current + casx [%o0], %o2, %o3 ! Do the compare and swap + cmp %o3, %o2 ! Check whether successful + bne 0b + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before + ! returning + retl ! return + mov %o1, %o0 ! Set the return value + + .size _STLP_atomic_increment,(.-_STLP_atomic_increment) + + +! /* int _STLP_atomic_decrement (void *pvalue) */ + .type _STLP_atomic_decrement,#function + .global _STLP_atomic_decrement + .align 8 + +_STLP_atomic_decrement: +0: + ldx [%o0], %o2 ! set the current + subx %o2, 0x1, %o3 ! decrement and store current + casx [%o0], %o2, %o3 ! Do the compare and swap + cmp %o3, %o2 ! Check whether successful + bne 0b + membar #LoadLoad | #LoadStore ! Ensure the cas finishes before + ! returning + retl ! return + nop + .size _STLP_atomic_decrement,(.-_STLP_atomic_decrement) + + + diff --git a/sdk/tlibstdcxx/src/sstream.cpp b/sdk/tlibstdcxx/src/sstream.cpp new file mode 100644 index 0000000000..2d1d652754 --- /dev/null +++ b/sdk/tlibstdcxx/src/sstream.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#include "stlport_prefix.h" + +#include + +_STLP_BEGIN_NAMESPACE + +#if !defined (_STLP_NO_FORCE_INSTANTIATE) + +// Force instantiation of stringstream classes. +template class _STLP_CLASS_DECLSPEC basic_stringbuf, allocator >; +template class _STLP_CLASS_DECLSPEC basic_ostringstream, allocator >; +template class _STLP_CLASS_DECLSPEC basic_istringstream, allocator >; +template class _STLP_CLASS_DECLSPEC basic_stringstream, allocator >; + +# if !defined (_STLP_NO_WCHAR_T) +template class _STLP_CLASS_DECLSPEC basic_stringbuf, allocator >; +template class _STLP_CLASS_DECLSPEC basic_ostringstream, allocator >; +template class _STLP_CLASS_DECLSPEC basic_istringstream, allocator >; +template class _STLP_CLASS_DECLSPEC basic_stringstream, allocator >; +# endif + +#endif + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/stdio_streambuf.cpp b/sdk/tlibstdcxx/src/stdio_streambuf.cpp new file mode 100644 index 0000000000..45aad790a6 --- /dev/null +++ b/sdk/tlibstdcxx/src/stdio_streambuf.cpp @@ -0,0 +1,239 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" +#include "stdio_streambuf.h" + +#ifdef _STLP_UNIX +# include +# include +#endif + +#include +#include + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Compare with streamoff definition in stl/char_traits.h! + +#if defined (_STLP_USE_DEFAULT_FILE_OFFSET) || \ + (!defined(_LARGEFILE_SOURCE) && !defined(_LARGEFILE64_SOURCE)) +# if !defined (_STLP_MSVC) || (_STLP_MSVC < 1400) || defined(_STLP_WCE) +# define FSEEK fseek +# else +# define FSEEK _fseeki64 +# endif +# define FSETPOS fsetpos +# define FGETPOS fgetpos +# define FPOS_T fpos_t +#else +# define FSEEK fseeko64 +# define FSETPOS fsetpos64 +# define FGETPOS fgetpos64 +# define FPOS_T fpos64_t +#endif + +//---------------------------------------------------------------------- +// Class stdio_streambuf_base + +stdio_streambuf_base::stdio_streambuf_base(FILE* file) + : /* _STLP_STD::FILE_basic_streambuf(file, 0), */ + _M_file(file) +{} + +stdio_streambuf_base::~stdio_streambuf_base() { + _STLP_VENDOR_CSTD::fflush(_M_file); +} + +_STLP_STD::streambuf* stdio_streambuf_base::setbuf(char* s, streamsize n) { +#ifdef _STLP_WCE + // no buffering in windows ce .NET +#else + size_t __n_size_t = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits::max)()), n)) + : __STATIC_CAST(size_t, n); + _STLP_VENDOR_CSTD::setvbuf(_M_file, s, (s == 0 && n == 0) ? _IONBF : _IOFBF, __n_size_t); +#endif + return this; +} + +stdio_streambuf_base::pos_type +stdio_streambuf_base::seekoff(off_type off, ios_base::seekdir dir, + ios_base::openmode /* mode */) { + int whence; + switch (dir) { + case ios_base::beg: + whence = SEEK_SET; + break; + case ios_base::cur: + whence = SEEK_CUR; + break; + case ios_base::end: + whence = SEEK_END; + break; + default: + return pos_type(-1); + } + + if (off <= numeric_limits::max() && FSEEK(_M_file, off, whence) == 0) { + FPOS_T pos; + FGETPOS(_M_file, &pos); + // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead + // of a primitive type +#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2)))) + return pos_type((streamoff)pos.__pos); +#elif defined (__ISCPP__) || defined (__MVS__) || defined (__OS400__) + return pos_type(pos.__fpos_elem[ 0 ]); +#elif defined (__EMX__) + return pos_type((streamoff)pos._pos); +#else + return pos_type(pos); +#endif + } + else + return pos_type(-1); +} + + +stdio_streambuf_base::pos_type +stdio_streambuf_base::seekpos(pos_type pos, ios_base::openmode /* mode */) { + // added 21 june 00 mdb,rjf,wjs: glibc 2.2 changed fpos_t to be a struct instead + // of a primitive type +#if (defined(__GLIBC__) && ( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2) ) ) ) + FPOS_T p; + p.__pos = pos; +# ifdef _STLP_USE_UCLIBC +# ifdef __STDIO_MBSTATE + memset( &(p.__mbstate), 0, sizeof(p.__mbstate) ); +# endif +# ifdef __STDIO_WIDE + p.mblen_pending = 0; +# endif +# else + memset( &(p.__state), 0, sizeof(p.__state) ); +# endif +#elif defined (__MVS__) || defined (__OS400__) + FPOS_T p; + p.__fpos_elem[0] = pos; +#elif defined (__EMX__) + FPOS_T p; + p._pos = pos; + memset( &(p._mbstate), 0, sizeof(p._mbstate) ); +#else + FPOS_T p(pos); +#endif + + return FSETPOS(_M_file, &p) == 0 ? pos : pos_type(-1); +} + +int stdio_streambuf_base::sync() { + return _STLP_VENDOR_CSTD::fflush(_M_file) == 0 ? 0 : -1; +} + +//---------------------------------------------------------------------- +// Class stdio_istreambuf + +stdio_istreambuf::~stdio_istreambuf() {} + +streamsize stdio_istreambuf::showmanyc() +{ return 0; } + +stdio_istreambuf::int_type stdio_istreambuf::underflow() +{ +#ifdef _STLP_WCE + int c = fgetc(_M_file); +#else + int c = getc(_M_file); +#endif + if (c != EOF) { + _STLP_VENDOR_CSTD::ungetc(c, _M_file); + return c; + } + else + return traits_type::eof(); +} + +stdio_istreambuf::int_type stdio_istreambuf::uflow() { +#ifdef _STLP_WCE + int c = fgetc(_M_file); +#else + int c = getc(_M_file); +#endif + return c != EOF ? c : traits_type::eof(); +} + +stdio_istreambuf::int_type stdio_istreambuf::pbackfail(int_type c) { + if (c != traits_type::eof()) { + int result = _STLP_VENDOR_CSTD::ungetc(c, _M_file); + return result != EOF ? result : traits_type::eof(); + } + else{ + if (this->eback() < this->gptr()) { + this->gbump(-1); + return traits_type::not_eof(c); + } + else + return traits_type::eof(); + } +} + +//---------------------------------------------------------------------- +// Class stdio_ostreambuf + +stdio_ostreambuf::~stdio_ostreambuf() {} + +streamsize stdio_ostreambuf::showmanyc() +{ return -1; } + +stdio_ostreambuf::int_type stdio_ostreambuf::overflow(int_type c) { + // Write the existing buffer, without writing any additional character. + if (c == traits_type::eof()) { + // Do we have a buffer to write? + ptrdiff_t unwritten = this->pptr() - this->pbase(); + if (unwritten != 0) { + _STLP_VENDOR_CSTD::fflush(_M_file); + // Test if the write succeeded. + if (this->pptr() - this->pbase() < unwritten) + return traits_type::not_eof(c); + else + return traits_type::eof(); + } + + // We always succeed if we don't have to do anything. + else + return traits_type::not_eof(c); + } + + // Write the character c, and whatever else might be in the buffer. + else { +#ifdef _STLP_WCE + int result = fputc(c, _M_file); +#else + int result = putc(c, _M_file); +#endif + return result != EOF ? result : traits_type::eof(); + } +} + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/src/stdio_streambuf.h b/sdk/tlibstdcxx/src/stdio_streambuf.h new file mode 100644 index 0000000000..33747b5136 --- /dev/null +++ b/sdk/tlibstdcxx/src/stdio_streambuf.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +// This header defines two streambufs: +// stdio_istreambuf, a read-only streambuf synchronized with a C stdio +// FILE object +// stdio_ostreambuf, a write-only streambuf synchronized with a C stdio +// FILE object. +// Note that neither stdio_istreambuf nor stdio_ostreambuf is a template; +// both classes are derived from basic_streambuf >. + +// Note: the imbue() member function is a no-op. In particular, these +// classes assume that codecvt is always an identity +// transformation. This is true of the default locale, and of all locales +// defined for the C I/O library. If you need to use a locale where +// the codecvt facet performs a nontrivial +// conversion, then you should use basic_filebuf<> instead of stdio_istreambuf +// or stdio_ostreambuf. (If you don't understand what any of this means, +// then it's not a feature you need to worry about. Locales where +// codecvt does something nontrivial are a rare +// corner case.) + + +#ifndef _STLP_STDIO_STREAMBUF +#define _STLP_STDIO_STREAMBUF + +#include +#include // For FILE. + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Base class for features common to stdio_istreambuf and stdio_ostreambuf +class stdio_streambuf_base : + public basic_streambuf > /* FILE_basic_streambuf */ { +public: // Constructor, destructor. + // The argument may not be null. It must be an open file pointer. + stdio_streambuf_base(FILE*); + + // The destructor flushes the stream, but does not close it. + ~stdio_streambuf_base(); + +protected: // Virtual functions from basic_streambuf. + streambuf* setbuf(char*, streamsize); + + pos_type seekoff(off_type, ios_base::seekdir, + ios_base::openmode + = ios_base::in | ios_base::out); + pos_type seekpos(pos_type, + ios_base::openmode + = ios_base::in | ios_base::out); + int sync(); + +protected: + FILE* _M_file; +}; + +class stdio_istreambuf : public stdio_streambuf_base { +public: // Constructor, destructor. + stdio_istreambuf(FILE* __f) : stdio_streambuf_base(__f) {} + ~stdio_istreambuf(); + +protected: // Virtual functions from basic_streambuf. + streamsize showmanyc(); + int_type underflow(); + int_type uflow(); + virtual int_type pbackfail(int_type c = traits_type::eof()); +}; + +class stdio_ostreambuf : public stdio_streambuf_base { +public: // Constructor, destructor. + stdio_ostreambuf(FILE* __f) : stdio_streambuf_base(__f) {} + ~stdio_ostreambuf(); + +protected: // Virtual functions from basic_streambuf. + streamsize showmanyc(); + int_type overflow(int_type c = traits_type::eof()); +}; + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +#endif /* _STLP_STDIO_STREAMBUF */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/stlport_prefix.h b/sdk/tlibstdcxx/src/stlport_prefix.h new file mode 100644 index 0000000000..e621603bde --- /dev/null +++ b/sdk/tlibstdcxx/src/stlport_prefix.h @@ -0,0 +1,48 @@ +#ifndef STLPORT_PREFIX_H +#define STLPORT_PREFIX_H + +#define __BUILDING_STLPORT 1 + +#if defined (_WIN32) || defined (WIN32) +# ifdef __cplusplus +# define WIN32_LEAN_AND_MEAN +# define NOSERVICE +# endif +#endif + +#undef _STLP_NO_FORCE_INSTANTIATE + +/* Please add extra compilation switches for particular compilers here */ + +#if defined (_MSC_VER) && !defined (__COMO__) && !defined (__MWERKS__) +# include "warning_disable.h" +#endif + +#include + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && defined (_STLP_USE_DECLSPEC) && !defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) +# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION +#endif + +#ifdef __cplusplus + +#if !defined (_STLP_SGX_CONFIG) + +# include +# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD) +using _STLP_VENDOR_CSTD::time_t; +# endif + +#endif /* !_STLP_SGX_CONFIG */ + +# if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +# define _STLP_OPERATOR_SPEC _STLP_DECLSPEC +# else +# define _STLP_OPERATOR_SPEC _STLP_TEMPLATE_NULL _STLP_DECLSPEC +# endif + +#endif /* __cplusplus */ + + +#endif /* PREFIX */ + diff --git a/sdk/tlibstdcxx/src/string.cpp b/sdk/tlibstdcxx/src/string.cpp new file mode 100644 index 0000000000..052c2a3c14 --- /dev/null +++ b/sdk/tlibstdcxx/src/string.cpp @@ -0,0 +1,94 @@ +#include "stlport_prefix.h" + +#include +#include /* include __Named_exception imple. in static lib */ + +_STLP_BEGIN_NAMESPACE + +#if defined(_STLP_USE_WIDE_INTERFACE) +_STLP_MOVE_TO_PRIV_NAMESPACE + +wstring __ASCIIToWide(const char *ascii) { + size_t size = strlen(ascii); + wchar_t* buff = new wchar_t[size+1]; + mbstowcs(buff, ascii, size); + buff[size] = 0x00; + wstring ret(buff); + delete[] buff; + return ret; +} +string __WideToASCII(const wchar_t *wide) { + size_t size = wcslen(wide); + char* buff = new char[size+1]; + wcstombs(buff, wide, size); + buff[size] = 0; + string ret(buff); + delete[] buff; + return ret; +} +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#if !defined (_STLP_NO_FORCE_INSTANTIATE) + +template class _STLP_CLASS_DECLSPEC allocator; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template class _STLP_CLASS_DECLSPEC _STLP_alloc_proxy >; +template class _STLP_CLASS_DECLSPEC _String_base >; + +# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define basic_string _STLP_NON_DBG_NAME(str) + +template class _STLP_CLASS_DECLSPEC basic_string, allocator >; +template class _STLP_CLASS_DECLSPEC __construct_checker, allocator > >; + +# undef basic_string +# endif + +# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define basic_string _STLP_NO_MEM_T_NAME(str) +# else +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +template class _STLP_CLASS_DECLSPEC basic_string, allocator >; + +# if defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +# undef basic_string +# endif + +# if !defined (_STLP_NO_WCHAR_T) +template class _STLP_CLASS_DECLSPEC allocator; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template class _STLP_CLASS_DECLSPEC _String_base >; + +# if defined (_STLP_DEBUG) && !defined (__SUNPRO_CC) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define basic_string _STLP_NON_DBG_NAME(str) + +template class _STLP_CLASS_DECLSPEC basic_string, allocator >; +template class _STLP_CLASS_DECLSPEC __construct_checker, allocator > >; + +# undef basic_string +# endif + +# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define basic_string _STLP_NO_MEM_T_NAME(str) +# else +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +template class _STLP_CLASS_DECLSPEC basic_string, allocator >; + +# if defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +# undef basic_string +# endif +# endif +#endif + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/strstream.cpp b/sdk/tlibstdcxx/src/strstream.cpp new file mode 100644 index 0000000000..740e01ea7b --- /dev/null +++ b/sdk/tlibstdcxx/src/strstream.cpp @@ -0,0 +1,391 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +// Implementation of the classes in header . +// WARNING: The classes defined in are DEPRECATED. This +// header is defined in section D.7.1 of the C++ standard, and it +// MAY BE REMOVED in a future standard revision. You should use the +// header instead. + +#include "stlport_prefix.h" + +#include +#include +#include + +_STLP_BEGIN_NAMESPACE + +// strstreambuf constructor, destructor. +strstreambuf::strstreambuf(streamsize initial_capacity) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(true), _M_frozen(false), _M_constant(false) { + size_t n = (sizeof(streamsize) > sizeof(size_t)) ? __STATIC_CAST(size_t, (min)(__STATIC_CAST(streamsize, (numeric_limits::max)()), + (max)(initial_capacity, streamsize(16)))) + : __STATIC_CAST(size_t, (max)(initial_capacity, streamsize(16))); + + char* buf = _M_alloc(n); + if (buf) { + setp(buf, buf + n); + setg(buf, buf, buf); + } +} + +strstreambuf::strstreambuf(__alloc_fn alloc_f, __free_fn free_f) + : _M_alloc_fun(alloc_f), _M_free_fun(free_f), + _M_dynamic(true), _M_frozen(false), _M_constant(false) { + size_t n = 16; + + char* buf = _M_alloc(n); + if (buf) { + setp(buf, buf + n); + setg(buf, buf, buf); + } +} + +strstreambuf::strstreambuf(char* get, streamsize n, char* put) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(false) { + _M_setup(get, put, n); +} + +strstreambuf::strstreambuf(signed char* get, streamsize n, signed char* put) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(false) { + _M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n); +} + +strstreambuf::strstreambuf(unsigned char* get, streamsize n, + unsigned char* put) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(false) { + _M_setup(__REINTERPRET_CAST(char*,get), __REINTERPRET_CAST(char*,put), n); +} + +strstreambuf::strstreambuf(const char* get, streamsize n) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(true) { + _M_setup(__CONST_CAST(char*,get), 0, n); +} + +strstreambuf::strstreambuf(const signed char* get, streamsize n) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(true) { + _M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(signed char*,get)), 0, n); +} + +strstreambuf::strstreambuf(const unsigned char* get, streamsize n) + : _M_alloc_fun(0), _M_free_fun(0), + _M_dynamic(false), _M_frozen(false), _M_constant(true) { + _M_setup(__REINTERPRET_CAST(char*, __CONST_CAST(unsigned char*,get)), 0, n); +} + +strstreambuf::~strstreambuf() { + if (_M_dynamic && !_M_frozen) + _M_free(eback()); +} + +void strstreambuf::freeze(bool frozenflag) { + if (_M_dynamic) + _M_frozen = frozenflag; +} + +char* strstreambuf::str() { + freeze(true); + return eback(); +} + +int strstreambuf::pcount() const { + return int(pptr() ? pptr() - pbase() : 0); +} + +strstreambuf::int_type strstreambuf::overflow(int_type c) { + if (c == traits_type::eof()) + return traits_type::not_eof(c); + + // Try to expand the buffer. + if (pptr() == epptr() && _M_dynamic && !_M_frozen && !_M_constant) { + ptrdiff_t old_size = epptr() - pbase(); + ptrdiff_t new_size = (max)(2 * old_size, ptrdiff_t(1)); + + char* buf = _M_alloc(new_size); + if (buf) { + memcpy(buf, pbase(), old_size); + + char* old_buffer = pbase(); + bool reposition_get = false; + ptrdiff_t old_get_offset; + if (gptr() != 0) { + reposition_get = true; + old_get_offset = gptr() - eback(); + } + + setp(buf, buf + new_size); + pbump((int)old_size); + + if (reposition_get) + setg(buf, buf + old_get_offset, buf + (max)(old_get_offset, old_size)); + + _M_free(old_buffer); + } + } + + if (pptr() != epptr()) { + *pptr() = traits_type::to_char_type(c); + pbump(1); + return c; + } + else + return traits_type::eof(); +} + +strstreambuf::int_type strstreambuf::pbackfail(int_type c) { + if (gptr() != eback()) { + if (c == traits_type::eof()) { + gbump(-1); + return traits_type::not_eof(c); + } + else if (c == gptr()[-1]) { + gbump(-1); + return c; + } + else if (!_M_constant) { + gbump(-1); + *gptr() = traits_type::to_char_type(c); + return c; + } + } + + return traits_type::eof(); +} + +strstreambuf::int_type strstreambuf::underflow() { + if (gptr() == egptr() && pptr() && pptr() > egptr()) + setg(eback(), gptr(), pptr()); + + if (gptr() != egptr()) + return (unsigned char) *gptr(); + else + return _Traits::eof(); +} + +basic_streambuf >* +strstreambuf::setbuf(char*, streamsize) { + return this; +} + +strstreambuf::pos_type +strstreambuf::seekoff(off_type off, + ios_base::seekdir dir, ios_base::openmode mode) { + bool do_get = false; + bool do_put = false; + + if ((mode & (ios_base::in | ios_base::out)) == + (ios_base::in | ios_base::out) && + (dir == ios_base::beg || dir == ios_base::end)) + do_get = do_put = true; + else if (mode & ios_base::in) + do_get = true; + else if (mode & ios_base::out) + do_put = true; + + // !gptr() is here because, according to D.7.1 paragraph 4, the seekable + // area is undefined if there is no get area. + if ((!do_get && !do_put) || (do_put && !pptr()) || !gptr()) + return pos_type(off_type(-1)); + + char* seeklow = eback(); + char* seekhigh = epptr() ? epptr() : egptr(); + + off_type newoff; + switch(dir) { + case ios_base::beg: + newoff = 0; + break; + case ios_base::end: + newoff = seekhigh - seeklow; + break; + case ios_base::cur: + newoff = do_put ? pptr() - seeklow : gptr() - seeklow; + break; + default: + return pos_type(off_type(-1)); + } + + off += newoff; + if (off < 0 || off > seekhigh - seeklow) + return pos_type(off_type(-1)); + + if (do_put) { + if (seeklow + __STATIC_CAST(ptrdiff_t, off) < pbase()) { + setp(seeklow, epptr()); + pbump((int)off); + } + else { + setp(pbase(), epptr()); + pbump((int)(off - (pbase() - seeklow))); + } + } + if (do_get) { + if (off <= egptr() - seeklow) + setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), egptr()); + else if (off <= pptr() - seeklow) + setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), pptr()); + else + setg(seeklow, seeklow + __STATIC_CAST(ptrdiff_t, off), epptr()); + } + + return pos_type(newoff); +} + +strstreambuf::pos_type +strstreambuf::seekpos(pos_type pos, ios_base::openmode mode) { + return seekoff(pos - pos_type(off_type(0)), ios_base::beg, mode); +} + + +char* strstreambuf::_M_alloc(size_t n) { + if (_M_alloc_fun) + return __STATIC_CAST(char*,_M_alloc_fun(n)); + else + return new char[n]; +} + +void strstreambuf::_M_free(char* p) { + if (p) { + if (_M_free_fun) + _M_free_fun(p); + else + delete[] p; + } +} + +void strstreambuf::_M_setup(char* get, char* put, streamsize n) { + if (get) { + size_t N = n > 0 ? size_t(n) : n == 0 ? strlen(get) : size_t(INT_MAX); + + if (put) { + setg(get, get, get + N); + setp(put, put + N); + } + else { + setg(get, get, get + N); + } + } +} + +//---------------------------------------------------------------------- +// Class istrstream + +istrstream::istrstream(char* s) + : basic_istream >(0), _M_buf(s, 0) { + this->init(&_M_buf); +} + +istrstream::istrstream(const char* s) + : basic_istream >(0), _M_buf(s, 0) { + this->init(&_M_buf); +} + +istrstream::istrstream(char* s, streamsize n) + : basic_istream >(0), _M_buf(s, n) { + this->init(&_M_buf); +} + +istrstream::istrstream(const char* s, streamsize n) + : basic_istream >(0), _M_buf(s, n) { + this->init(&_M_buf); +} + +istrstream::~istrstream() {} + +strstreambuf* istrstream::rdbuf() const { + return __CONST_CAST(strstreambuf*,&_M_buf); +} + +char* istrstream::str() { return _M_buf.str(); } + +//---------------------------------------------------------------------- +// Class ostrstream + +ostrstream::ostrstream() + : basic_ostream >(0), _M_buf() { + basic_ios >::init(&_M_buf); +} + +ostrstream::ostrstream(char* s, int n, ios_base::openmode mode) + : basic_ostream >(0), + _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) { + basic_ios >::init(&_M_buf); +} + +ostrstream::~ostrstream() {} + +strstreambuf* ostrstream::rdbuf() const { + return __CONST_CAST(strstreambuf*,&_M_buf); +} + +void ostrstream::freeze(bool freezeflag) { + _M_buf.freeze(freezeflag); +} + +char* ostrstream::str() { + return _M_buf.str(); +} + +int ostrstream::pcount() const { + return _M_buf.pcount(); +} + + +//---------------------------------------------------------------------- +// Class strstream + +strstream::strstream() + : basic_iostream >(0), _M_buf() { + basic_ios >::init(&_M_buf); +} + +strstream::strstream(char* s, int n, ios_base::openmode mode) + : basic_iostream >(0), + _M_buf(s, n, mode & ios_base::app ? s + strlen(s) : s) { + basic_ios >::init(&_M_buf); +} + +strstream::~strstream() {} + +strstreambuf* strstream::rdbuf() const { + return __CONST_CAST(strstreambuf*,&_M_buf); +} + +void strstream::freeze(bool freezeflag) { + _M_buf.freeze(freezeflag); +} + +int strstream::pcount() const { + return _M_buf.pcount(); +} + +char* strstream::str() { + return _M_buf.str(); +} + +_STLP_END_NAMESPACE + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/src/time_facets.cpp b/sdk/tlibstdcxx/src/time_facets.cpp new file mode 100644 index 0000000000..3e98c70d1f --- /dev/null +++ b/sdk/tlibstdcxx/src/time_facets.cpp @@ -0,0 +1,565 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#include "stlport_prefix.h" + +#include +#include +#include + +#include "c_locale.h" +#include "acquire_release.h" + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// default "C" values for month and day names + +const char default_dayname[][14] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", + "Friday", "Saturday"}; + +const char default_monthname[][24] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December"}; + +#ifndef _STLP_NO_WCHAR_T +const wchar_t default_wdayname[][14] = { + L"Sun", L"Mon", L"Tue", L"Wed", L"Thu", L"Fri", L"Sat", + L"Sunday", L"Monday", L"Tuesday", L"Wednesday", L"Thursday", + L"Friday", L"Saturday"}; + +const wchar_t default_wmonthname[][24] = { + L"Jan", L"Feb", L"Mar", L"Apr", L"May", L"Jun", + L"Jul", L"Aug", L"Sep", L"Oct", L"Nov", L"Dec", + L"January", L"February", L"March", L"April", L"May", L"June", + L"July", L"August", L"September", L"October", L"November", L"December"}; +#endif + +#if defined (__BORLANDC__) +_Time_Info time_init::_M_timeinfo; +# ifndef _STLP_NO_WCHAR_T +_WTime_Info time_init::_M_timeinfo; +# endif +#endif + +// _Init_time_info: initialize table with +// "C" values (note these are not defined in the C standard, so this +// is somewhat arbitrary). + +static void _Init_timeinfo_base(_Time_Info_Base& table) { + table._M_time_format = "%H:%M:%S"; + table._M_date_format = "%m/%d/%y"; + table._M_date_time_format = "%m/%d/%y"; +} + +static void _Init_timeinfo(_Time_Info& table) { + int i; + for (i = 0; i < 14; ++i) + table._M_dayname[i] = default_dayname[i]; + for (i = 0; i < 24; ++i) + table._M_monthname[i] = default_monthname[i]; + table._M_am_pm[0] = "AM"; + table._M_am_pm[1] = "PM"; + _Init_timeinfo_base(table); +} + +#ifndef _STLP_NO_WCHAR_T +static void _Init_timeinfo(_WTime_Info& table) { + int i; + for (i = 0; i < 14; ++i) + table._M_dayname[i] = default_wdayname[i]; + for (i = 0; i < 24; ++i) + table._M_monthname[i] = default_wmonthname[i]; + table._M_am_pm[0] = L"AM"; + table._M_am_pm[1] = L"PM"; + _Init_timeinfo_base(table); +} +#endif + +static void _Init_timeinfo_base(_Time_Info_Base& table, _Locale_time * time) { + table._M_time_format = _Locale_t_fmt(time); + if ( table._M_time_format == "%T" ) { + table._M_time_format = "%H:%M:%S"; + } else if ( table._M_time_format == "%r" ) { + table._M_time_format = "%I:%M:%S %p"; + } else if ( table._M_time_format == "%R" ) { + table._M_time_format = "%H:%M"; + } + table._M_date_format = _Locale_d_fmt(time); + table._M_date_time_format = _Locale_d_t_fmt(time); + table._M_long_date_format = _Locale_long_d_fmt(time); + table._M_long_date_time_format = _Locale_long_d_t_fmt(time); +} + +static void _Init_timeinfo(_Time_Info& table, _Locale_time * time) { + int i; + for (i = 0; i < 7; ++i) + table._M_dayname[i] = _Locale_abbrev_dayofweek(time, i); + for (i = 0; i < 7; ++i) + table._M_dayname[i+7] = _Locale_full_dayofweek(time, i); + for (i = 0; i < 12; ++i) + table._M_monthname[i] = _Locale_abbrev_monthname(time, i); + for (i = 0; i < 12; ++i) + table._M_monthname[i+12] = _Locale_full_monthname(time, i); + table._M_am_pm[0] = _Locale_am_str(time); + table._M_am_pm[1] = _Locale_pm_str(time); + _Init_timeinfo_base(table, time); +} + +#ifndef _STLP_NO_WCHAR_T +static void _Init_timeinfo(_WTime_Info& table, _Locale_time * time) { + wchar_t buf[128]; + int i; + for (i = 0; i < 7; ++i) + table._M_dayname[i] = _WLocale_abbrev_dayofweek(time, i, _STLP_ARRAY_AND_SIZE(buf)); + for (i = 0; i < 7; ++i) + table._M_dayname[i+7] = _WLocale_full_dayofweek(time, i, _STLP_ARRAY_AND_SIZE(buf)); + for (i = 0; i < 12; ++i) + table._M_monthname[i] = _WLocale_abbrev_monthname(time, i, _STLP_ARRAY_AND_SIZE(buf)); + for (i = 0; i < 12; ++i) + table._M_monthname[i+12] = _WLocale_full_monthname(time, i, _STLP_ARRAY_AND_SIZE(buf)); + table._M_am_pm[0] = _WLocale_am_str(time, _STLP_ARRAY_AND_SIZE(buf)); + table._M_am_pm[1] = _WLocale_pm_str(time, _STLP_ARRAY_AND_SIZE(buf)); + _Init_timeinfo_base(table, time); +} +#endif + +template +void __subformat(_STLP_BASIC_IOSTRING(_Ch) &buf, const ctype<_Ch>& ct, + const string& format, const _TimeInfo& table, const tm* t) { + const char * cp = format.data(); + const char * cp_end = cp + format.size(); + while (cp != cp_end) { + if (*cp == '%') { + char mod = 0; + ++cp; + if (*cp == '#') { + mod = *cp; ++cp; + } + __write_formatted_timeT(buf, ct, *cp++, mod, table, t); + } else + buf.append(1, *cp++); + } +} + +static void __append(__iostring &buf, const string& name) +{ buf.append(name.data(), name.data() + name.size()); } + +static void __append(__iowstring &buf, const wstring& name) +{ buf.append(name.data(), name.data() + name.size()); } + +static void __append(__iostring &buf, char *first, char *last, const ctype& /* ct */) +{ buf.append(first, last); } + +static void __append(__iowstring &buf, char *first, char *last, const ctype& ct) { + wchar_t _wbuf[64]; + ct.widen(first, last, _wbuf); + buf.append(_wbuf, _wbuf + (last - first)); +} + +#if defined (__GNUC__) +/* The number of days from the first day of the first ISO week of this + year to the year day YDAY with week day WDAY. ISO weeks start on + Monday; the first ISO week has the year's first Thursday. YDAY may + be as small as YDAY_MINIMUM. */ +# define __ISO_WEEK_START_WDAY 1 /* Monday */ +# define __ISO_WEEK1_WDAY 4 /* Thursday */ +# define __YDAY_MINIMUM (-366) +# define __TM_YEAR_BASE 1900 +static int +__iso_week_days(int yday, int wday) { + /* Add enough to the first operand of % to make it nonnegative. */ + int big_enough_multiple_of_7 = (-__YDAY_MINIMUM / 7 + 2) * 7; + return (yday + - (yday - wday + __ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7 + + __ISO_WEEK1_WDAY - __ISO_WEEK_START_WDAY); +} + +# define __is_leap(year)\ + ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) + +#endif + +#define __hour12(hour) \ + (((hour) % 12 == 0) ? (12) : (hour) % 12) + +#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) +# define _STLP_SPRINTF sprintf +#else +# define _STLP_SPRINTF sprintf_s +#endif + +template +void _STLP_CALL __write_formatted_timeT(_STLP_BASIC_IOSTRING(_Ch) &buf, + const ctype<_Ch>& ct, + char format, char modifier, + const _TimeInfo& table, const tm* t) { + char _buf[64]; + char *_bend; + + switch (format) { + case 'a': + __append(buf, table._M_dayname[t->tm_wday]); + break; + + case 'A': + __append(buf, table._M_dayname[t->tm_wday + 7]); + break; + + case 'b': + __append(buf, table._M_monthname[t->tm_mon]); + break; + + case 'B': + __append(buf, table._M_monthname[t->tm_mon + 12]); + break; + + case 'c': + __subformat(buf, ct, (modifier != '#') ? table._M_date_time_format + : table._M_long_date_time_format, table, t); + break; + + case 'd': + _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_mday); + __append(buf, _buf, ((long)t->tm_mday < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct); + break; + + case 'e': + _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_mday); + __append(buf, _buf, _buf + 2, ct); + break; + + case 'H': + _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_hour); + __append(buf, _buf, ((long)t->tm_hour < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct); + break; + + case 'I': + _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)__hour12(t->tm_hour)); + __append(buf, _buf, ((long)__hour12(t->tm_hour) < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct); + break; + + case 'j': + _bend = __write_integer(_buf, 0, (long)((long)t->tm_yday + 1)); + __append(buf, _buf, _bend, ct); + break; + + case 'm': + _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_mon + 1); + __append(buf, _buf, ((long)(t->tm_mon + 1) < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct); + break; + + case 'M': + _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_min); + __append(buf, _buf, ((long)t->tm_min < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct); + break; + + case 'p': + __append(buf, table._M_am_pm[t->tm_hour / 12]); + break; + + case 'S': // pad with zeros + _STLP_SPRINTF(_buf, (modifier != '#') ? "%.2ld" : "%ld", (long)t->tm_sec); + __append(buf, _buf, ((long)t->tm_sec < 10L && modifier == '#') ? _buf + 1 : _buf + 2, ct); + break; + + case 'U': + _bend = __write_integer(_buf, 0, long((t->tm_yday - t->tm_wday + 7) / 7)); + __append(buf, _buf, _bend, ct); + break; + + case 'w': + _bend = __write_integer(_buf, 0, (long)t->tm_wday); + __append(buf, _buf, _bend, ct); + break; + + case 'W': + _bend = __write_integer(_buf, 0, + (long)(t->tm_wday == 0 ? (t->tm_yday + 1) / 7 : + (t->tm_yday + 8 - t->tm_wday) / 7)); + __append(buf, _buf, _bend, ct); + break; + + case'x': + __subformat(buf, ct, (modifier != '#') ? table._M_date_format + : table._M_long_date_format, table, t); + break; + + case 'X': + __subformat(buf, ct, table._M_time_format, table, t); + break; + + case 'y': + _bend = __write_integer(_buf, 0, (long)((long)(t->tm_year + 1900) % 100)); + __append(buf, _buf, _bend, ct); + break; + + case 'Y': + _bend = __write_integer(_buf, 0, (long)((long)t->tm_year + 1900)); + __append(buf, _buf, _bend, ct); + break; + + case '%': + buf.append(1, ct.widen('%')); + break; + +#if defined (__GNUC__) + // fbp : at least on SUN +# if defined (_STLP_UNIX) && !defined (__linux__) +# define __USE_BSD 1 +# endif + + /********************************************* + * JGS, handle various extensions * + *********************************************/ + + case 'h': /* POSIX.2 extension */ + // same as 'b', abbrev month name + __append(buf, table._M_monthname[t->tm_mon]); + break; + case 'C': /* POSIX.2 extension */ + // same as 'd', the day + _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_mday); + __append(buf, _buf, _buf + 2, ct); + break; + + case 'D': /* POSIX.2 extension */ + // same as 'x' + __subformat(buf, ct, table._M_date_format, table, t); + break; + + case 'k': /* GNU extension */ + _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_hour); + __append(buf, _buf, _buf + 2, ct); + break; + + case 'l': /* GNU extension */ + _STLP_SPRINTF(_buf, "%2ld", (long)t->tm_hour % 12); + __append(buf, _buf, _buf + 2, ct); + break; + + case 'n': /* POSIX.2 extension */ + buf.append(1, ct.widen('\n')); + break; + + case 'R': /* GNU extension */ + __subformat(buf, ct, "%H:%M", table, t); + break; + + case 'r': /* POSIX.2 extension */ + __subformat(buf, ct, "%I:%M:%S %p", table, t); + break; + + case 'T': /* POSIX.2 extension. */ + __subformat(buf, ct, "%H:%M:%S", table, t); + break; + + case 't': /* POSIX.2 extension. */ + buf.append(1, ct.widen('\t')); + + case 'u': /* POSIX.2 extension. */ + _bend = __write_integer(_buf, 0, long((t->tm_wday - 1 + 7)) % 7 + 1); + __append(buf, _buf, _bend, ct); + break; + + case 's': { + time_t __t = mktime(__CONST_CAST(tm*, t)); + _bend = __write_integer(_buf, 0, (long)__t ); + __append(buf, _buf, _bend, ct); + break; + } + case 'g': /* GNU extension */ + case 'G': { + int year = t->tm_year + __TM_YEAR_BASE; + int days = __iso_week_days (t->tm_yday, t->tm_wday); + if (days < 0) { + /* This ISO week belongs to the previous year. */ + year--; + days = __iso_week_days (t->tm_yday + (365 + __is_leap (year)), t->tm_wday); + } + else { + int d = __iso_week_days (t->tm_yday - (365 + __is_leap (year)), t->tm_wday); + if (0 <= d) { + /* This ISO week belongs to the next year. */ + ++year; + days = d; + } + } + long val; + switch (format) { + case 'g': + val = (long)(year % 100 + 100) % 100; + break; + case 'G': + val = (long)year; + break; + default: + val = (long)days / 7 + 1; + break; + } + _bend = __write_integer(_buf, 0, val); + __append(buf, _buf, _bend, ct); + break; + } + +# if defined (_STLP_USE_GLIBC) + case 'z': /* GNU extension. */ + if (t->tm_isdst < 0) + break; + { + int diff; +# if defined (__USE_BSD) || defined (__BEOS__) + diff = t->tm_gmtoff; +# else + diff = t->__tm_gmtoff; +# endif + if (diff < 0) { + buf.append(1, ct.widen('-')); + diff = -diff; + } else + buf.append(1, ct.widen('+')); + diff /= 60; + _STLP_SPRINTF(_buf, "%.4d", (diff / 60) * 100 + diff % 60); + __append(buf, _buf, _buf + 4, ct); + break; + } +# endif /* __GLIBC__ */ +#endif /* __GNUC__ */ + + default: + break; + } +} + +void _STLP_CALL __write_formatted_time(__iostring &buf, const ctype& ct, + char format, char modifier, + const _Time_Info& table, const tm* t) +{ __write_formatted_timeT(buf, ct, format, modifier, table, t); } + +void _STLP_CALL __write_formatted_time(__iowstring &buf, const ctype& ct, + char format, char modifier, + const _WTime_Info& table, const tm* t) +{ __write_formatted_timeT(buf, ct, format, modifier, table, t); } + +static time_base::dateorder __get_date_order(_Locale_time* time) { + const char * fmt = _Locale_d_fmt(time); + char first, second, third; + + while (*fmt != 0 && *fmt != '%') ++fmt; + if (*fmt == 0) + return time_base::no_order; + first = *++fmt; + while (*fmt != 0 && *fmt != '%') ++fmt; + if (*fmt == 0) + return time_base::no_order; + second = *++fmt; + while (*fmt != 0 && *fmt != '%') ++fmt; + if (*fmt == 0) + return time_base::no_order; + third = *++fmt; + + switch (first) { + case 'd': + return (second == 'm' && third == 'y') ? time_base::dmy + : time_base::no_order; + case 'm': + return (second == 'd' && third == 'y') ? time_base::mdy + : time_base::no_order; + case 'y': + switch (second) { + case 'd': + return third == 'm' ? time_base::ydm : time_base::no_order; + case 'm': + return third == 'd' ? time_base::ymd : time_base::no_order; + default: + return time_base::no_order; + } + default: + return time_base::no_order; + } +} + +time_init::time_init() + : _M_dateorder(time_base::no_order) +{ _Init_timeinfo(_M_timeinfo); } + +time_init::time_init(const char* __name) { + if (!__name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _Locale_time *__time = __acquire_time(__name, buf, 0, &__err_code); + if (!__time) + locale::_M_throw_on_creation_failure(__err_code, __name, "time"); + + _Init_timeinfo(this->_M_timeinfo, __time); + _M_dateorder = __get_date_order(__time); + __release_time(__time); +} + +time_init::time_init(_Locale_time *__time) { + _Init_timeinfo(this->_M_timeinfo, __time); + _M_dateorder = __get_date_order(__time); +} + +#ifndef _STLP_NO_WCHAR_T +time_init::time_init() + : _M_dateorder(time_base::no_order) +{ _Init_timeinfo(_M_timeinfo); } + +time_init::time_init(const char* __name) { + if (!__name) + locale::_M_throw_on_null_name(); + + int __err_code; + char buf[_Locale_MAX_SIMPLE_NAME]; + _Locale_time *__time = __acquire_time(__name, buf, 0, &__err_code); + if (!__time) + locale::_M_throw_on_creation_failure(__err_code, __name, "time"); + + _Init_timeinfo(this->_M_timeinfo, __time); + _M_dateorder = __get_date_order(__time); + __release_time(__time); +} + +time_init::time_init(_Locale_time *__time) { + _Init_timeinfo(this->_M_timeinfo, __time); + _M_dateorder = __get_date_order(__time); +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +#if !defined (_STLP_NO_FORCE_INSTANTIATE) +template class time_get > >; +template class time_put > >; + +# ifndef _STLP_NO_WCHAR_T +template class time_get > >; +template class time_put > >; +# endif + +#endif + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/src/warning_disable.h b/sdk/tlibstdcxx/src/warning_disable.h new file mode 100644 index 0000000000..7f0c1c8470 --- /dev/null +++ b/sdk/tlibstdcxx/src/warning_disable.h @@ -0,0 +1,61 @@ +#if !defined (__ICL) +/* This header is used to turn off warnings of Microsoft compilers generated. + * while building STLport. + * For compiling user code, see stlport/config/_msvc_warnings_off.h. + */ + +# if (_MSC_VER < 1300) /* VC6/eVC4 */ +# pragma warning( disable : 4097 ) /* typedef-name used as based class of (...) */ +# pragma warning( disable : 4251 ) /* DLL interface needed */ +# pragma warning( disable : 4284 ) /* for -> operator */ +# pragma warning( disable : 4503 ) /* decorated name length exceeded, name was truncated */ +# pragma warning( disable : 4514 ) /* unreferenced inline function has been removed */ +# pragma warning( disable : 4660 ) /* template-class specialization '...' is already instantiated */ +# pragma warning( disable : 4701 ) /* local variable 'base' may be used without having been initialized */ +# pragma warning( disable : 4710 ) /* function (...) not inlined */ +# pragma warning( disable : 4786 ) /* identifier truncated to 255 characters */ +# endif + +# if (_MSC_VER <= 1310) +# pragma warning( disable : 4511 ) /* copy constructor cannot be generated */ +# endif + +# if (_MSC_VER < 1300) && defined (UNDER_CE) +# pragma warning( disable : 4201 ) /* nonstandard extension used : nameless struct/union */ +# pragma warning( disable : 4214 ) /* nonstandard extension used : bit field types other than int */ +# endif + +/* Suppress warnings emitted from Windows CE SDK headers. */ +# if (_MSC_VER >= 1400) && defined (UNDER_CE) +# pragma warning( disable : 4115 ) /* Named type definition in parentheses. */ +# pragma warning( disable : 4201 ) /* Nameless struct/union. */ +# pragma warning( disable : 4214 ) /* Bit field types other than int. */ +# pragma warning( disable : 4290 ) /* C++ exception specification ignored. */ +# pragma warning( disable : 4430 ) /* Missing type specifier, int assumed. */ +# pragma warning( disable : 4431 ) /* Missing type specifier, int assumed. */ +# endif + +# pragma warning( disable : 4075 ) /* initializers put in unrecognized initialization area */ +/* This warning is disable only for the c_locale_win32.c file compilation: */ +# pragma warning( disable : 4100 ) /* unreferenced formal parameter */ +# pragma warning( disable : 4127 ) /* conditional expression is constant */ +# pragma warning( disable : 4146 ) /* unary minus applied to unsigned type */ +# pragma warning( disable : 4245 ) /* conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch */ +# pragma warning( disable : 4244 ) /* implicit conversion: possible loss of data */ +# pragma warning( disable : 4512 ) /* assignment operator could not be generated */ +# pragma warning( disable : 4571 ) /* catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions */ +# pragma warning( disable : 4702 ) /* unreachable code (appears in release with warning level4) */ +#else +# pragma warning( disable : 69 ) /* integer conversion resulted in truncation */ +# pragma warning( disable : 174 ) /* expression has no effect */ +# pragma warning( disable : 279 ) /* controling expression is constant */ +# pragma warning( disable : 383 ) /* reference to temporary used */ +# pragma warning( disable : 444 ) /* destructor for base class "..." is not virtual*/ +# pragma warning( disable : 810 ) /* conversion from "int" to "char" may lose significant bits */ +# pragma warning( disable : 981 ) /* operands are evaluated in unspecified order */ +# pragma warning( disable : 1418 ) /* external definition with no prior declaration */ +# pragma warning( disable : 1419 ) /* external declaration in primary source file */ +# pragma warning( disable : 1572 ) /* floating-point equality and inequality comparisons are unreliable */ +# pragma warning( disable : 1682 ) /* implicit conversion of a 64-bit integral type to a smaller integral type */ +# pragma warning( disable : 1683 ) /* explicit conversion of a 64-bit integral type to a smaller integral type */ +#endif diff --git a/sdk/tlibstdcxx/stlport/algorithm b/sdk/tlibstdcxx/stlport/algorithm new file mode 100644 index 0000000000..c653d8c773 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/algorithm @@ -0,0 +1,62 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_ALGORITHM + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x1 +# include +# define _STLP_ALGORITHM +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x1) +# ifndef _STLP_INTERNAL_CSTDIO +// remove() conflicts, should always go first +# include +# endif + +# ifndef _STLP_INTERNAL_ALGO_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x1) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(algorithm) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x1 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_ALGORITHM */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/assert.h b/sdk/tlibstdcxx/stlport/assert.h new file mode 100644 index 0000000000..ac73de5fad --- /dev/null +++ b/sdk/tlibstdcxx/stlport/assert.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x202 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */ +#ifndef _STLP_WCE_EVC3 +# if !defined (assert) +# define _STLP_NATIVE_ASSERT_H_INCLUDED +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(assert.h) +# endif +# endif +# if !defined (_STLP_SGX_CONFIG) && !defined (_STLP_NATIVE_ASSERT_H_INCLUDED) +/* See errno.h for additional information about this #error */ +# error assert has been defined before inclusion of assert.h header. +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x202) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# endif +# undef _STLP_DONT_POP_HEADER_ID +#endif + +/* Local Variables: + * mode:C++ + * End: + */ diff --git a/sdk/tlibstdcxx/stlport/bitset b/sdk/tlibstdcxx/stlport/bitset new file mode 100644 index 0000000000..1d7fcf3ebb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/bitset @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_BITSET + +// This implementation of bitset<> has a second template parameter, +// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE +// THIS FEATURE*. It is experimental, and it may be removed in +// future releases. + +// A bitset of size N, using words of type _WordT, will have +// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high- +// order bits in the highest word.) It is a class invariant +// of class bitset<> that those unused bits are always zero. + +// Most of the actual code isn't contained in bitset<> itself, but in the +// base class _Base_bitset. The base class works with whole words, not with +// individual bits. This allows us to specialize _Base_bitset for the +// important special case where the bitset is only a single word. + +// The C++ standard does not define the precise semantics of operator[]. +// In this implementation the const version of operator[] is equivalent +// to test(), except that it does no range checking. The non-const version +// returns a reference to a bit, again without doing any range checking. + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x2 +# include +# define _STLP_BITSET +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x2) +# ifndef _STLP_INTERNAL_BITSET +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x2) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(bitset) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x2 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_BITSET */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cassert b/sdk/tlibstdcxx/stlport/cassert new file mode 100644 index 0000000000..aabd0b4ee5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cassert @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x103 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#if !defined (_STLP_WCE_EVC3) +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cassert) +# endif +# else +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x103 ) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cctype b/sdk/tlibstdcxx/stlport/cctype new file mode 100644 index 0000000000..513512e928 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cctype @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CCTYPE + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x104 +# define _STLP_CCTYPE +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x104 ) +# ifndef _STLP_INTERNAL_CCTYPE +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x104) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cctype) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x104 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CCTYPE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cerrno b/sdk/tlibstdcxx/stlport/cerrno new file mode 100644 index 0000000000..0d17faf5e1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cerrno @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CERRNO +#define _STLP_CERRNO + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x105 +# include +#endif + +#ifndef _STLP_WCE +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cerrno) +# endif +# else +# include +# endif +#endif + +#ifndef errno /* errno is not a macro */ +# if defined (_STLP_IMPORT_VENDOR_CSTD) +# if !defined (__IBMCPP__) && !defined (__hpux) && !defined (__MWERKS__) && !defined (_STLP_WCE) +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::errno; +_STLP_END_NAMESPACE +# endif +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x105 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CERRNO */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cfloat b/sdk/tlibstdcxx/stlport/cfloat new file mode 100644 index 0000000000..cb2e0cd002 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cfloat @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CFLOAT +#define _STLP_CFLOAT + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x106 +# include +#endif + +// Borland defines some implementation constants in std:: namespace, +// we do not want to import them. +#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cfloat) +# endif +#else +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x106 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CFLOAT */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/ciso646 b/sdk/tlibstdcxx/stlport/ciso646 new file mode 100644 index 0000000000..443449d6f5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/ciso646 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CISO646 +#define _STLP_CISO646 + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x107 +# include +#endif + +#if !defined(_STLP_WCE_EVC3) && !defined (__BORLANDC__) +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(ciso646) +# endif +# else +# include +# endif /* _STLP_USE_NEW_C_HEADERS */ +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x107 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CISO646 */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/climits b/sdk/tlibstdcxx/stlport/climits new file mode 100644 index 0000000000..86bc413c87 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/climits @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CLIMITS +# define _STLP_CLIMITS + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x108 +# include +#endif + +#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4)) +# include +#elif defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(climits) +# endif +#else +# if defined (__BORLANDC__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(limits.h) +# endif +# else +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x108 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CLIMITS */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cmath b/sdk/tlibstdcxx/stlport/cmath new file mode 100644 index 0000000000..46a8f52ec7 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cmath @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CMATH + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x110 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_CMATH +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID) +# ifndef _STLP_INTERNAL_CMATH +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x110) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cmath) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x110) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif /* _STLP_CMATH */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/complex b/sdk/tlibstdcxx/stlport/complex new file mode 100644 index 0000000000..6cfe6052f9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/complex @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_COMPLEX + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x10 +# define _STLP_COMPLEX +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x10) +// This header declares the template class complex, as described in +// in the C++ Standard. Single-precision complex numbers +// are complex, double-precision are complex, and +// quad precision are complex. + +// Note that the template class complex is declared within namespace +// std, as called for by the draft C++ standard +# ifndef _STLP_INTERNAL_COMPLEX +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x10) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(complex) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x10 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_COMPLEX */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cstdarg b/sdk/tlibstdcxx/stlport/cstdarg new file mode 100644 index 0000000000..6882bbdc07 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cstdarg @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CSTDARG + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x113 +# define _STLP_CSTDARG +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x113) +# ifndef _STLP_INTERNAL_CSTDARG +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x113) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdarg) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x113 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CSTDARG */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cstddef b/sdk/tlibstdcxx/stlport/cstddef new file mode 100644 index 0000000000..0a66f0e4d5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cstddef @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CSTDDEF + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x114 +# define _STLP_CSTDDEF +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x114) +# ifndef _STLP_INTERNAL_CSTDDEF +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x114) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstddef) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x114 ) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CSTDDEF */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cstdio b/sdk/tlibstdcxx/stlport/cstdio new file mode 100644 index 0000000000..e20c8fff79 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cstdio @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CSTDIO + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x15 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_CSTDIO +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID) +# ifndef _STLP_INTERNAL_CSTDIO +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x15) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdio) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x15) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cstdlib b/sdk/tlibstdcxx/stlport/cstdlib new file mode 100644 index 0000000000..20afa3563a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cstdlib @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CSTDLIB + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x116 +# define _STLP_CSTDLIB +# include +#endif + +# if defined (__GNUC__) && defined (__MINGW32__) +/* Native cstdlib includes stdlib.h using an include_next so STLport stdlib.h + * is not used and the workaround in this file must be duplicated here + * (see stdlib.h). */ +# include "errno.h" +# endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x116) +# ifndef _STLP_INTERNAL_CSTDLIB +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x116) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x116) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CSTDLIB */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cstring b/sdk/tlibstdcxx/stlport/cstring new file mode 100644 index 0000000000..d5cf58d017 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cstring @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CSTRING + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x117 +# define _STLP_CSTRING +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x117) +# ifndef _STLP_INTERNAL_CSTRING +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x117) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstring) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x117) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CSTRING */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/ctime b/sdk/tlibstdcxx/stlport/ctime new file mode 100644 index 0000000000..bafb7dd2e3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/ctime @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CTIME + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x118 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x118) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_CTIME +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x118) && !defined (_STLP_DONT_POP_HEADER_ID) +# ifndef _STLP_INTERNAL_CTIME +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x118) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(ctime) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x118) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif /* _STLP_CTIME */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/ctype.h b/sdk/tlibstdcxx/stlport/ctype.h new file mode 100644 index 0000000000..f9d10003e1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/ctype.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CTYPE_H + +/* Workaround for a "misbehaviour" when compiling resource scripts using + * eMbedded Visual C++. The standard .rc file includes windows header files, + * which in turn include ctype.h, which results in warnings and errors + */ +#if !defined(RC_INVOKED) + +# if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x219 +# include +# elif (_STLP_OUTERMOST_HEADER_ID == 0x219) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_CTYPE_H +# endif + +# if defined(_STLP_WCE_EVC3) +struct _exception; +# endif + +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(ctype.h) +# endif + +/* on evc4 including ctype.h also defines setjmp macro */ +# if defined (_STLP_WCE) +# define _STLP_NATIVE_SETJMP_H_INCLUDED +# endif + +# ifndef _STLP_CTYPE_H_SEEN +# define _STLP_CTYPE_H_SEEN + +/* Undef convenience interfaces */ +# undef isspace +# undef isprint +# undef iscntrl +# undef isupper +# undef islower +# undef isalpha +# undef isdigit +# undef ispunct +# undef isxdigit +# undef isalnum +# undef isgraph +# undef toupper +# undef tolower + +# if defined (UNDER_CE) + +# if (_WIN32_WCE < 300) /* Only wide chars for older versions */ +# define _isctype iswctype +# endif + +__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); } +__inline int (isupper)(int c) { return _isctype(c, _UPPER); } +__inline int (islower)(int c) { return _isctype(c, _LOWER); } +__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); } +__inline int (isxdigit)(int c) { return _isctype(c, _HEX); } +__inline int (isspace)(int c) { return _isctype(c, _SPACE); } +__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); } +__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); } +__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); } +__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); } +__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); } +__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); } + +# undef _isctype + +__inline int (iswalpha)(int c) { return iswctype((unsigned short)(c), _ALPHA); } +__inline int (iswupper)(int c) { return iswctype((unsigned short)(c), _UPPER); } +__inline int (iswlower)(int c) { return iswctype((unsigned short)(c), _LOWER); } +__inline int (iswdigit)(int c) { return iswctype((unsigned short)(c), _DIGIT); } +__inline int (iswxdigit)(int c) { return iswctype((unsigned short)(c), _HEX); } +__inline int (iswspace)(int c) { return iswctype((unsigned short)(c), _SPACE); } +__inline int (iswpunct)(int c) { return iswctype((unsigned short)(c), _PUNCT); } +__inline int (iswalnum)(int c) { return iswctype((unsigned short)(c), _ALPHA|_DIGIT); } +__inline int (iswprint)(int c) { return iswctype((unsigned short)(c), _BLANK|_PUNCT|_ALPHA|_DIGIT); } +__inline int (iswgraph)(int c) { return iswctype((unsigned short)(c), _PUNCT|_ALPHA|_DIGIT); } +__inline int (iswcntrl)(int c) { return iswctype((unsigned short)(c), _CONTROL); } +__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); } + +# endif /* UNDER_CE */ + +# endif /* _STLP_CTYPE_H_SEEN */ + +# if (_STLP_OUTERMOST_HEADER_ID == 0x219) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +# endif + +#endif /* RC_INVOKED */ + +#endif /* _STLP_CTYPE_H */ diff --git a/sdk/tlibstdcxx/stlport/cwchar b/sdk/tlibstdcxx/stlport/cwchar new file mode 100644 index 0000000000..0b3205474a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cwchar @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CWCHAR + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x120 +# define _STLP_CWCHAR +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x120) +# ifndef _STLP_INTERNAL_CWCHAR +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x120) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cwchar) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x120) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CWCHAR */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/cwctype b/sdk/tlibstdcxx/stlport/cwctype new file mode 100644 index 0000000000..0e86218e01 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/cwctype @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CWCTYPE + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x121 +# define _STLP_CWCTYPE +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x121) +# ifndef _STLP_INTERNAL_CWCTYPE +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x121) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cwctype) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x121) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_CWCTYPE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/deque b/sdk/tlibstdcxx/stlport/deque new file mode 100644 index 0000000000..448f159b7f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/deque @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_DEQUE + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x22 +# include +# define _STLP_DEQUE +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x22) +# ifndef _STLP_INTERNAL_DEQUE_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x22) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(deque) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x22) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_DEQUE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/errno.h b/sdk/tlibstdcxx/stlport/errno.h new file mode 100644 index 0000000000..0f8a15bff6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/errno.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x205 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#ifdef _STLP_WCE +/* only show message when directly including this file in a non-library build */ +# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205) +# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here") +# endif +#else +# ifndef errno +/* We define the following macro first to guaranty the header reentrancy: */ +# define _STLP_NATIVE_ERRNO_H_INCLUDED +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(errno.h) +# endif +# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x590) && defined (__cplusplus) +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::__errno; +_STLP_END_NAMESPACE +# endif +# endif /* errno */ + +# if !defined (_STLP_SGX_CONFIG) && !defined (_STLP_NATIVE_ERRNO_H_INCLUDED) +/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h + * becomes impossible because if: + * #define errno foo + * then + * #include _STLP_NATIVE_C_HEADER(errno.h) + * becomes: + * #include _STLP_NATIVE_C_HEADER(foo.h) + * + * To fix this problem you have to find where this definition comes from and include errno.h before it. + */ +# error errno has been defined before inclusion of errno.h header. +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x205) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# endif +# undef _STLP_DONT_POP_HEADER_ID +#endif + +/* Local Variables: + * mode: C + * End: + */ diff --git a/sdk/tlibstdcxx/stlport/exception b/sdk/tlibstdcxx/stlport/exception new file mode 100644 index 0000000000..47822e9154 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/exception @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +// This header exists solely for portability. Normally it just includes +// the native header . + +#ifndef _STLP_EXCEPTION + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x423 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x423) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_EXCEPTION +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x423) && !defined (_STLP_DONT_POP_HEADER_ID) +# ifndef _STLP_INTERNAL_EXCEPTION +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD) +/* If we are here it means that we are in an include called + * from the native lib which means that we can simply forward this + * call to the native exception header: + */ +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# if defined (__DMC__) && (_STLP_OUTERMOST_HEADER_ID == 0x874) +// Workaround to DMC harcoded typeinfo.h inclusion. +# include <../include/exception> +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception) +# endif +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x423) +# if !defined(_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif /* _STLP_EXCEPTION */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/float.h b/sdk/tlibstdcxx/stlport/float.h new file mode 100644 index 0000000000..70fe3ade9d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/float.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x203 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) +# error This header is only reentrant once, it should be modified if it has to be included more. +#endif + +#if defined (_STLP_WCE_EVC3) +struct _exception; +#endif + +#if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +#else +# include _STLP_NATIVE_C_HEADER(float.h) +#endif + +#if !defined (__linux__) +# if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560) +_STLP_BEGIN_NAMESPACE +using ::_max_dble; +using ::_max_flt; +using ::_max_ldble; +using ::_tiny_ldble; +_STLP_END_NAMESPACE +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x203) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# endif +# undef _STLP_DONT_POP_HEADER_ID +#endif diff --git a/sdk/tlibstdcxx/stlport/functional b/sdk/tlibstdcxx/stlport/functional new file mode 100644 index 0000000000..27e37ab983 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/functional @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_FUNCTIONAL + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x27 +# include +# define _STLP_FUNCTIONAL +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x27) +# ifndef _STLP_INTERNAL_FUNCTION_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x27) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(functional) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x27) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) + +#include +#include +#include +#include +#include + +namespace boost { + +template class reference_wrapper; +template reference_wrapper const ref(T &); +template inline reference_wrapper const cref(T const &); + +template struct result_of; + +namespace _mfi { +template class dm; +} + +template _mfi::dm mem_fn(R T::*f); + +} // namespace boost + +_STLP_BEGIN_NAMESPACE + +namespace tr1 { + +using ::boost::reference_wrapper; +using ::boost::ref; +using ::boost::cref; + +using ::boost::result_of; + +using ::boost::mem_fn; + +using ::boost::bind; + +namespace placeholders { + using ::_1; + using ::_2; + using ::_3; + using ::_4; + using ::_5; + using ::_6; + using ::_7; + using ::_8; + using ::_9; +} // placeholders + +} // namespace tr1 + +_STLP_END_NAMESPACE + +#endif // !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT + +#endif /* _STLP_FUNCTIONAL */ + +#if !defined(_STLP_FUNCTIONAL_FUN) && !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) + +#ifndef BOOST_FUNCTION_NUM_ARGS // avoid recursive includes + +// #ifdef BOOST_FUNCTION_BASE_HEADER +// #undef BOOST_FUNCTION_BASE_HEADER +// #endif + +// #ifdef BOOST_FUNCTION_PROLOGUE_HPP +// #undef BOOST_FUNCTION_PROLOGUE_HPP +// #endif + +#define _STLP_FUNCTIONAL_FUN + +#ifndef BOOST_FUNCTION_BASE_HEADER // avoid recursive includes +# include +#else +namespace boost { +class bad_function_call; +template +class function; +template +void swap(function& f1, function& f2); +} +#endif + +_STLP_BEGIN_NAMESPACE + +namespace tr1 { + +using ::boost::bad_function_call; +using ::boost::function; +using ::boost::swap; + +} // namespace tr1 + +_STLP_END_NAMESPACE + +#endif // !BOOST_FUNCTION_NUM_ARGS + +#endif // !_STLP_FUNCTIONAL_REF && !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/iso646.h b/sdk/tlibstdcxx/stlport/iso646.h new file mode 100644 index 0000000000..858863aef6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/iso646.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x204 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +/* evc3 doesn't have iso646.h */ +#if !defined (_STLP_WCE_EVC3) && !defined (__BORLANDC__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(iso646.h) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x204) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# endif +# undef _STLP_DONT_POP_HEADER_ID +#endif + diff --git a/sdk/tlibstdcxx/stlport/iterator b/sdk/tlibstdcxx/stlport/iterator new file mode 100644 index 0000000000..f8d3deee7c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/iterator @@ -0,0 +1,61 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_ITERATOR + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x38 +# include +# define _STLP_ITERATOR +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x38) +# ifndef _STLP_INTERNAL_ITERATOR_H +# include +# endif + +# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x38) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(iterator) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x38) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_ITERATOR */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/limits b/sdk/tlibstdcxx/stlport/limits new file mode 100644 index 0000000000..5333b14fdd --- /dev/null +++ b/sdk/tlibstdcxx/stlport/limits @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_LIMITS + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x39 +# include +# define _STLP_LIMITS +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x39) +# ifndef _STLP_INTERNAL_LIMITS +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x39) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(limits) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x39) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_LIMITS */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/limits.h b/sdk/tlibstdcxx/stlport/limits.h new file mode 100644 index 0000000000..aab553b654 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/limits.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x201 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#if defined(_STLP_WCE_EVC3) +struct _exception; +#endif + +#if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +#else +# include _STLP_NATIVE_C_HEADER(limits.h) +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x201) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# endif +# undef _STLP_DONT_POP_HEADER_ID +#endif diff --git a/sdk/tlibstdcxx/stlport/list b/sdk/tlibstdcxx/stlport/list new file mode 100644 index 0000000000..647a8be5d0 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/list @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_LIST + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x40 +# include +# define _STLP_LIST +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x40) +# ifndef _STLP_INTERNAL_LIST_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x40) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(list) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x40) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_LIST */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/map b/sdk/tlibstdcxx/stlport/map new file mode 100644 index 0000000000..f30c400c55 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/map @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_MAP + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x43 +# include +# define _STLP_MAP +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x43) +# ifndef _STLP_INTERNAL_MAP_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x43) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(map) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x43) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_MAP */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/math.h b/sdk/tlibstdcxx/stlport/math.h new file mode 100644 index 0000000000..32b666f05d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/math.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x244 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \ + !(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3) +# define _STLP_EXCEPTION_WAS_REDEFINED 1 +# define exception __math_exception +#endif + +#if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +#else +# include _STLP_NATIVE_C_HEADER(math.h) +#endif + +#if defined (_STLP_EXCEPTION_WAS_REDEFINED) +# undef exception +# undef _STLP_EXCEPTION_WAS_REDEFINED +#endif + +#ifdef _STLP_WCE_EVC3 +# undef _exception +# define _exception exception +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x244) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + diff --git a/sdk/tlibstdcxx/stlport/memory b/sdk/tlibstdcxx/stlport/memory new file mode 100644 index 0000000000..3c0ceb38bc --- /dev/null +++ b/sdk/tlibstdcxx/stlport/memory @@ -0,0 +1,130 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_MEMORY + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x46 +# include +# define _STLP_MEMORY +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x46) +# ifndef _STLP_INTERNAL_ALLOC_H +# include +# endif + +# ifndef _STLP_INTERNAL_TEMPBUF_H +# include +# endif + +# ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H +# include +# endif + +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x46) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (__MSL__) +# include _STLP_NATIVE_HEADER(limits) +# endif + +# if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) +# define BOOST_TR1_MEMORY_INCLUDED +# define BOOST_TR1_FULL_MEMORY_INCLUDED +# endif + +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(memory) +# endif + +# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201) +/* 980401 vss MSL 2.4 Pro 3 Release */ +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x46) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT) + +namespace boost { + +class bad_weak_ptr; +template class shared_ptr; +template class weak_ptr; +template class enable_shared_from_this; +template D * get_deleter(shared_ptr const & p); +template shared_ptr static_pointer_cast(shared_ptr const & r); +template shared_ptr const_pointer_cast(shared_ptr const & r); +template shared_ptr dynamic_pointer_cast(shared_ptr const & r); +template void swap(weak_ptr & a, weak_ptr & b); +template void swap(shared_ptr & a, shared_ptr & b); + +namespace detail{ +class shared_count; +class weak_count; +} + +} // namespace boost + +# ifndef BOOST_SHARED_PTR_HPP_INCLUDED +# include +# endif +# ifndef BOOST_WEAK_PTR_HPP_INCLUDED +# include +# endif +# ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED +# include +# endif + +_STLP_BEGIN_NAMESPACE + +namespace tr1 { + +using ::boost::bad_weak_ptr; +using ::boost::shared_ptr; +using ::boost::swap; +using ::boost::static_pointer_cast; +using ::boost::dynamic_pointer_cast; +using ::boost::const_pointer_cast; +using ::boost::get_deleter; +using ::boost::weak_ptr; +using ::boost::enable_shared_from_this; + +// shared_ptr IO +// weak_ptr IO + +} // namespace tr1 + +_STLP_END_NAMESPACE + +#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */ + +#endif /* _STLP_MEMORY */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/new b/sdk/tlibstdcxx/stlport/new new file mode 100644 index 0000000000..974ca4480f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/new @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_NEW_HEADER + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x447 +# define _STLP_NEW_HEADER +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x447) +# ifndef _STLP_NEW_H_HEADER +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x447) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x447) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_NEW */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/new.h b/sdk/tlibstdcxx/stlport/new.h new file mode 100644 index 0000000000..0a9bf33e88 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/new.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x848 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#if !defined(_STLP_NO_NEW_HEADER) +# if defined (__BORLANDC__) +# include +# elif defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER)) +# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h) +# else +# if defined (__GNUC__) && (__GNUC__ >= 3) +# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h) +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h) +# endif +# endif +#endif /* !defined(_STLP_NO_NEW_HEADER) */ + +#if (_STLP_OUTERMOST_HEADER_ID == 0x848) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/numeric b/sdk/tlibstdcxx/stlport/numeric new file mode 100644 index 0000000000..79e46471bd --- /dev/null +++ b/sdk/tlibstdcxx/stlport/numeric @@ -0,0 +1,54 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_NUMERIC + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x49 +# include +# define _STLP_NUMERIC +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x49) +# ifndef _STLP_INTERNAL_NUMERIC_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x49) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(numeric) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x49) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_NUMERIC */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/queue b/sdk/tlibstdcxx/stlport/queue new file mode 100644 index 0000000000..6acd63fdd0 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/queue @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_QUEUE + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x53 +# include +# define _STLP_QUEUE +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x53) +# ifndef _STLP_INTERNAL_QUEUE_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x53) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(queue) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x53) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_QUEUE */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/set b/sdk/tlibstdcxx/stlport/set new file mode 100644 index 0000000000..ed79d89fb1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/set @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_SET + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x55 +# include +# define _STLP_SET +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x55) +# ifndef _STLP_INTERNAL_SET_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x55) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(set) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x55) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_SET */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stack b/sdk/tlibstdcxx/stlport/stack new file mode 100644 index 0000000000..253b31d2f7 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stack @@ -0,0 +1,57 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STACK + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x60 +# include +# define _STLP_STACK +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x60) +# ifndef _STLP_INTERNAL_STACK_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x60) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(stack) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x60) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_STACK */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stdarg.h b/sdk/tlibstdcxx/stlport/stdarg.h new file mode 100644 index 0000000000..368e6724b3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stdarg.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* Workaround for a "misbehaviour" when compiling resource scripts using + * eMbedded Visual C++. The standard .rc file includes windows header files, + * which in turn include stdarg.h, which results in warnings and errors + */ +#if !defined (RC_INVOKED) + +# if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x261 +# include +# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# endif + +# if defined(_STLP_WCE_EVC3) +struct _exception; +# endif + +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(stdarg.h) +# endif + +# if (_STLP_OUTERMOST_HEADER_ID == 0x261) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +# endif +#endif /* RC_INVOKED */ diff --git a/sdk/tlibstdcxx/stlport/stddef.h b/sdk/tlibstdcxx/stlport/stddef.h new file mode 100644 index 0000000000..f959c23af4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stddef.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x262 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#if defined (_MSC_VER) || defined (__DMC__) +/* Native stddef.h contains errno macro definition making inclusion of native + * errno.h in STLport errno.h impossible. We are then forced to include errno.h + * first. + */ +# include "errno.h" +#endif + +#if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +#else +# include _STLP_NATIVE_C_HEADER(stddef.h) +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x262) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif diff --git a/sdk/tlibstdcxx/stlport/stdexcept b/sdk/tlibstdcxx/stlport/stdexcept new file mode 100644 index 0000000000..dbb96b9a91 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stdexcept @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STDEXCEPT + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x63 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_STDEXCEPT +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x63) +# ifndef _STLP_INTERNAL_STDEXCEPT +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(stdexcept) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x63) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif /* _STLP_STDEXCEPT */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stdio.h b/sdk/tlibstdcxx/stlport/stdio.h new file mode 100644 index 0000000000..e2dbdeae3a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stdio.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* Workaround for a "misbehaviour" when compiling resource scripts using + * eMbedded Visual C++. The standard .rc file includes windows header files, + * which in turn include stdarg.h, which results in warnings and errors + */ +#if !defined(RC_INVOKED) + +# ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x264 +# include +# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# endif + +# if defined(_STLP_WCE_EVC3) +struct _exception; +# endif +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(stdio.h) +# endif + +# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE) +# define _STRUCT_FILE +# endif + +# if defined (__BORLANDC__) && defined (__cplusplus) && !defined (__linux__) +_STLP_BEGIN_NAMESPACE +using __std_alias::_streams; +_STLP_END_NAMESPACE +# endif + +# if (_STLP_OUTERMOST_HEADER_ID == 0x264) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +# endif + +#endif /* RC_INVOKED */ diff --git a/sdk/tlibstdcxx/stlport/stdlib.h b/sdk/tlibstdcxx/stlport/stdlib.h new file mode 100644 index 0000000000..fd55f8a8fb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stdlib.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* Workaround for a "misbehaviour" when compiling resource scripts using + * eMbedded Visual C++. The standard .rc file includes windows header files, + * which in turn include stdlib.h, which results in warnings and errors + */ +#if !defined (RC_INVOKED) + +# if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x265 +# include +# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# endif + +# if defined (_STLP_MSVC_LIB) || (defined (__GNUC__) && defined (__MINGW32__)) || \ + defined (__BORLANDC__) || defined (__DMC__) || \ + (defined (__HP_aCC) && defined (_REENTRANT)) +/* Native stdlib.h contains errno macro definition making inclusion of native + * errno.h in STLport errno.h impossible. We are then forced to include errno.h + * first. + */ +# include "errno.h" +# endif + +/* + forward-declaration for _exception struct; prevents warning message + ../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses +*/ +# if defined(_STLP_WCE_EVC3) +struct _exception; +# endif + +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(stdlib.h) +# endif + +/* on evc3/evc4 including stdlib.h also defines setjmp macro */ +# if defined (_STLP_WCE) +# define _STLP_NATIVE_SETJMP_H_INCLUDED +# endif + +# if (_STLP_OUTERMOST_HEADER_ID == 0x265) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +# endif + +#endif /* RC_INVOKED */ diff --git a/sdk/tlibstdcxx/stlport/stl/_abbrevs.h b/sdk/tlibstdcxx/stlport/stl/_abbrevs.h new file mode 100644 index 0000000000..c4acac8b1f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_abbrevs.h @@ -0,0 +1,77 @@ +/* + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ABBREVS_H +# define _STLP_INTERNAL_ABBREVS_H + +// ugliness is intentional - to reduce conflicts +# define input_iterator_tag _In__ItT +# define output_iterator_tag _Ou__ItT +# define bidirectional_iterator_tag _Bd__ItT +# define random_access_iterator_tag _Ra__ItT +# define input_iterator _In__It +# define output_iterator _Ou__It +# define bidirectional_iterator _Bd__It +# define random_access_iterator _Ra__It +# define reverse_bidirectional_iterator _rBd__It +# define reverse_iterator _r__It +# define back_insert_iterator _bI__It +# define front_insert_iterator _fI__It +# define raw_storage_iterator _rS__It +# define _Const_traits _C_Tr +# define _Const_Const_traits _CC_Tr +# define _Nonconst_traits _N_Tr +# define _Nonconst_Const_traits _NC_Tr + +// ugliness is intentional - to reduce conflicts probability +# define __malloc_alloc M__A +# define __node_alloc D__A +# define __new_alloc N__A +# define __debug_alloc G__A +# define _STLP_alloc_proxy P__A + +# define _Deque_iterator_base _Dq__ItB +# define _Deque_iterator _Dq__It + +# define _Select1st _S1st +# define _Select2nd _S2nd +# define __move_source __m_s +# define _Vector_nonconst_traits _V_nct + +# define _Ht_iterator _Ht_It + +# define _List_node_base _L__NB +# define _List_iterator_base _L__ItB +# define _List_iterator _L__It + +# define _Slist_iterator_base _SL__ItB +# define _Slist_iterator _SL__It + +# define _Rb_tree_node_base _rbT__NB +# define _Rb_tree_node _rbT__N +# define _Rb_tree_base_iterator _rbT__It +# define _Rb_tree_base _rbT__B + +# if defined (__DMC__) && defined (_STLP_DEBUG) +# define _NonDbg_hashtable _Nd_Ht +# define _DBG_iter _d__It +# endif +#endif + diff --git a/sdk/tlibstdcxx/stlport/stl/_algo.c b/sdk/tlibstdcxx/stlport/stl/_algo.c new file mode 100644 index 0000000000..c92a7eeef9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_algo.c @@ -0,0 +1,2040 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_ALGO_C +#define _STLP_ALGO_C + +#if !defined (_STLP_INTERNAL_ALGO_H) +# include +#endif + +#ifndef _STLP_INTERNAL_TEMPBUF_H +# include +#endif + +#ifdef _STLP_SGX_CONFIG +# include "sgx_trts.h" +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void __merge_without_buffer(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2, + _Compare __comp); + + +template +_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, + _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, + _BidirectionalIter2 __last2, + _BidirectionalIter3 __result, + _Compare __comp); + +template +#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 )) +inline +#endif +const _Tp& __median(const _Tp& __a, const _Tp& __b, const _Tp& __c) { + if (__a < __b) + if (__b < __c) + return __b; + else if (__a < __c) + return __c; + else + return __a; + else if (__a < __c) + return __a; + else if (__b < __c) + return __c; + else + return __b; +} + +template +#if !(defined (__SUNPRO_CC) && (__SUNPRO_CC < 0x420 )) +inline +#endif +const _Tp& +__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp) { + if (__comp(__a, __b)) { + _STLP_VERBOSE_ASSERT(!__comp(__b, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + if (__comp(__b, __c)) { + _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return __b; + } + else if (__comp(__a, __c)) { + _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return __c; + } + else + return __a; + } + else if (__comp(__a, __c)) { + _STLP_VERBOSE_ASSERT(!__comp(__c, __a), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return __a; + } + else if (__comp(__b, __c)) { + _STLP_VERBOSE_ASSERT(!__comp(__c, __b), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return __c; + } + else + return __b; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + // Test for empty ranges + if (__first1 == __last1 || __first2 == __last2) + return __first1; + + // Test for a pattern of length 1. + _ForwardIter2 __p1(__first2); + + if ( ++__p1 == __last2 ) + return find(__first1, __last1, *__first2); + + // General case. + + for ( ; ; ) { // __first1 != __last1 will be checked in find below + __first1 = find(__first1, __last1, *__first2); + if (__first1 == __last1) + return __last1; + + _ForwardIter2 __p = __p1; + _ForwardIter1 __current = __first1; + if (++__current == __last1) + return __last1; + + while (*__current == *__p) { + if (++__p == __last2) + return __first1; + if (++__current == __last1) + return __last1; + } + + ++__first1; + } + return __first1; +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_RandomAccessIter __search_n(_RandomAccessIter __first, _RandomAccessIter __last, + _Integer __count, const _Tp& __val, _BinaryPred __pred, + _Distance*, const random_access_iterator_tag &) +{ + _Distance __tailSize = __last - __first; + const _Distance __pattSize = __count; + const _Distance __skipOffset = __pattSize - 1; + _RandomAccessIter __backTrack; + _Distance __remainder, __prevRemainder; + + for ( _RandomAccessIter __lookAhead = __first + __skipOffset; __tailSize >= __pattSize; __lookAhead += __pattSize ) { // the main loop... + //__lookAhead here is always pointing to the last element of next possible match. + __tailSize -= __pattSize; + + while ( !__pred(*__lookAhead, __val) ) { // the skip loop... + if (__tailSize < __pattSize) + return __last; + + __lookAhead += __pattSize; + __tailSize -= __pattSize; + } + + if ( __skipOffset == 0 ) { + return (__lookAhead - __skipOffset); //Success + } + + __remainder = __skipOffset; + + for (__backTrack = __lookAhead; __pred(*--__backTrack, __val); ) { + if (--__remainder == 0) + return (__lookAhead - __skipOffset); //Success + } + + if (__remainder > __tailSize) + return __last; //failure + + __lookAhead += __remainder; + __tailSize -= __remainder; + + while ( __pred(*__lookAhead, __val) ) { + __prevRemainder = __remainder; + __backTrack = __lookAhead; + + do { + if (--__remainder == 0) + return (__lookAhead - __skipOffset); //Success + } while (__pred(*--__backTrack, __val)); + + //adjust remainder for next comparison + __remainder += __pattSize - __prevRemainder; + + if (__remainder > __tailSize) + return __last; //failure + + __lookAhead += __remainder; + __tailSize -= __remainder; + } + + //__lookAhead here is always pointing to the element of the last mismatch. + } + + return __last; //failure +} + +template +_ForwardIter __search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val, _BinaryPred __pred, + _Distance*, const forward_iterator_tag &) { + for (; (__first != __last) && !__pred(*__first, __val); ++__first) {} + while (__first != __last) { + _Integer __n = __count - 1; + _ForwardIter __i = __first; + ++__i; + while (__i != __last && __n != 0 && __pred(*__i, __val)) { + ++__i; + --__n; + } + if (__n == 0) + return __first; + else if (__i != __last) + for (__first = ++__i; (__first != __last) && !__pred(*__first, __val); ++__first) {} + else + break; + } + return __last; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +// search_n. Search for __count consecutive copies of __val. +template +_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__count <= 0) + return __first; + if (__count == 1) + //We use find when __count == 1 to use potential find overload. + return find(__first, __last, __val); + return _STLP_PRIV __search_n(__first, __last, __count, __val, equal_to<_Tp>(), + _STLP_DISTANCE_TYPE(__first, _ForwardIter), + _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); +} + +template +_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val, + _BinaryPred __binary_pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__count <= 0) + return __first; + return _STLP_PRIV __search_n(__first, __last, __count, __val, __binary_pred, + _STLP_DISTANCE_TYPE(__first, _ForwardIter), + _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); +} + +template +_ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2, +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1), + _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2), +#else + forward_iterator_tag(), + forward_iterator_tag(), +#endif + _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _ForwardIter1)) + ); +} + +// unique and unique_copy +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP _OutputIterator +__unique_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, + _BinaryPredicate __binary_pred, _Tp*) { + _Tp __val = *__first; + *__result = __val; + while (++__first != __last) + if (!__binary_pred(__val, *__first)) { + __val = *__first; + *++__result = __val; + } + return ++__result; +} + +template +inline _OutputIter +__unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result, + _BinaryPredicate __binary_pred, const output_iterator_tag &) { + return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, + _STLP_VALUE_TYPE(__first, _InputIter)); +} + +template +_STLP_INLINE_LOOP _ForwardIter +__unique_copy(_InputIter __first, _InputIter __last, _ForwardIter __result, + _BinaryPredicate __binary_pred, const forward_iterator_tag &) { + *__result = *__first; + while (++__first != __last) + if (!__binary_pred(*__result, *__first)) *++__result = *__first; + return ++__result; +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline _BidirectionalIterator +__unique_copy(_InputIterator __first, _InputIterator __last, + _BidirectionalIterator __result, _BinaryPredicate __binary_pred, + const bidirectional_iterator_tag &) { + return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag()); +} + +template +inline _RandomAccessIterator +__unique_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result, _BinaryPredicate __binary_pred, + const random_access_iterator_tag &) { + return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, forward_iterator_tag()); +} +#endif /* _STLP_NONTEMPL_BASE_MATCH_BUG */ + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter +unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return __result; + return _STLP_PRIV __unique_copy(__first, __last, __result, + _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _InputIter)), + _STLP_ITERATOR_CATEGORY(__result, _OutputIter)); +} + +template +_OutputIter +unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result, + _BinaryPredicate __binary_pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return __result; + return _STLP_PRIV __unique_copy(__first, __last, __result, __binary_pred, + _STLP_ITERATOR_CATEGORY(__result, _OutputIter)); +} + +// rotate and rotate_copy, and their auxiliary functions +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __rotate_aux(_ForwardIter __first, + _ForwardIter __middle, + _ForwardIter __last, + _Distance*, + const forward_iterator_tag &) { + if (__first == __middle) + return __last; + if (__last == __middle) + return __first; + + _ForwardIter __first2 = __middle; + do { + _STLP_STD::swap(*__first++, *__first2++); + if (__first == __middle) + __middle = __first2; + } while (__first2 != __last); + + _ForwardIter __new_middle = __first; + + __first2 = __middle; + + while (__first2 != __last) { + _STLP_STD::swap (*__first++, *__first2++); + if (__first == __middle) + __middle = __first2; + else if (__first2 == __last) + __first2 = __middle; + } + + return __new_middle; +} + +template +_BidirectionalIter __rotate_aux(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance*, + const bidirectional_iterator_tag &) { + if (__first == __middle) + return __last; + if (__last == __middle) + return __first; + + _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag()); + _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag()); + + while (__first != __middle && __middle != __last) + _STLP_STD::swap(*__first++, *--__last); + + if (__first == __middle) { + _STLP_PRIV __reverse(__middle, __last, bidirectional_iterator_tag()); + return __last; + } + else { + _STLP_PRIV __reverse(__first, __middle, bidirectional_iterator_tag()); + return __first; + } +} + +// rotate and rotate_copy, and their auxiliary functions +template +_STLP_INLINE_LOOP +_EuclideanRingElement __gcd(_EuclideanRingElement __m, + _EuclideanRingElement __n) { + while (__n != 0) { + _EuclideanRingElement __t = __m % __n; + __m = __n; + __n = __t; + } + return __m; +} + +template +_RandomAccessIter __rotate_aux(_RandomAccessIter __first, + _RandomAccessIter __middle, + _RandomAccessIter __last, + _Distance *, _Tp *) { + + _Distance __n = __last - __first; + _Distance __k = __middle - __first; + _Distance __l = __n - __k; + _RandomAccessIter __result = __first + (__last - __middle); + + if (__k == 0) /* __first == middle */ + return __last; + + if (__k == __l) { + _STLP_STD::swap_ranges(__first, __middle, __middle); + return __result; + } + + _Distance __d = _STLP_PRIV __gcd(__n, __k); + + for (_Distance __i = 0; __i < __d; __i++) { + _Tp __tmp = *__first; + _RandomAccessIter __p = __first; + + if (__k < __l) { + for (_Distance __j = 0; __j < __l/__d; __j++) { + if (__p > __first + __l) { + *__p = *(__p - __l); + __p -= __l; + } + + *__p = *(__p + __k); + __p += __k; + } + } + + else { + for (_Distance __j = 0; __j < __k/__d - 1; __j ++) { + if (__p < __last - __k) { + *__p = *(__p + __k); + __p += __k; + } + + *__p = * (__p - __l); + __p -= __l; + } + } + + *__p = __tmp; + ++__first; + } + + return __result; +} + +template +inline _RandomAccessIter +__rotate_aux(_RandomAccessIter __first, _RandomAccessIter __middle, _RandomAccessIter __last, + _Distance * __dis, const random_access_iterator_tag &) { + return _STLP_PRIV __rotate_aux(__first, __middle, __last, + __dis, _STLP_VALUE_TYPE(__first, _RandomAccessIter)); +} + +template +_ForwardIter +__rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) { + _STLP_DEBUG_CHECK(__check_range(__first, __middle)) + _STLP_DEBUG_CHECK(__check_range(__middle, __last)) + return __rotate_aux(__first, __middle, __last, + _STLP_DISTANCE_TYPE(__first, _ForwardIter), + _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last) { + _STLP_PRIV __rotate(__first, __middle, __last); +} + +// Return a random number in the range [0, __n). This function encapsulates +// whether we're using rand (part of the standard C library) or lrand48 +// (not standard, but a much better choice whenever it's available). +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _Distance __random_number(_Distance __n) { +#ifdef _STLP_NO_DRAND48 +# ifdef _STLP_SGX_CONFIG + _Distance __rand; + if (SGX_SUCCESS != sgx_read_rand(__REINTERPRET_CAST(unsigned char*, &__rand), sizeof(__rand))) { + _STLP_ABORT(); + } + return abs(__rand) % __n; +# else + return rand() % __n; +# endif +#else + return lrand48() % __n; +#endif +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void random_shuffle(_RandomAccessIter __first, + _RandomAccessIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + iter_swap(__i, __first + _STLP_PRIV __random_number((__i - __first) + 1)); +} + +template +void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, + _RandomNumberGenerator &__rand) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + iter_swap(__i, __first + __rand((__i - __first) + 1)); +} + +#if !defined (_STLP_NO_EXTENSIONS) +// random_sample and random_sample_n (extensions, not part of the standard). +template +_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, + _OutputIter __out_ite, const _Distance __n) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Distance __remaining = _STLP_STD::distance(__first, __last); + _Distance __m = (min) (__n, __remaining); + + while (__m > 0) { + if (_STLP_PRIV __random_number(__remaining) < __m) { + *__out_ite = *__first; + ++__out_ite; + --__m; + } + + --__remaining; + ++__first; + } + return __out_ite; +} + + +template +_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, + _OutputIter __out_ite, const _Distance __n, + _RandomNumberGenerator& __rand) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Distance __remaining = _STLP_STD::distance(__first, __last); + _Distance __m = (min) (__n, __remaining); + + while (__m > 0) { + if (__rand(__remaining) < __m) { + *__out_ite = *__first; + ++__out_ite; + --__m; + } + + --__remaining; + ++__first; + } + return __out_ite; +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_ite, + const _Distance __n) { + _Distance __m = 0; + _Distance __t = __n; + for ( ; __first != __last && __m < __n; ++__m, ++__first) + __out_ite[__m] = *__first; + + while (__first != __last) { + ++__t; + _Distance __M = __random_number(__t); + if (__M < __n) + __out_ite[__M] = *__first; + ++__first; + } + + return __out_ite + __m; +} + +template +_RandomAccessIter __random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_ite, + _RandomNumberGenerator& __rand, + const _Distance __n) { + _Distance __m = 0; + _Distance __t = __n; + for ( ; __first != __last && __m < __n; ++__m, ++__first) + __out_ite[__m] = *__first; + + while (__first != __last) { + ++__t; + _Distance __M = __rand(__t); + if (__M < __n) + __out_ite[__M] = *__first; + ++__first; + } + + return __out_ite + __m; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_RandomAccessIter +random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_first, _RandomAccessIter __out_last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last)) + return _STLP_PRIV __random_sample(__first, __last, + __out_first, __out_last - __out_first); +} + +template +_RandomAccessIter +random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_first, _RandomAccessIter __out_last, + _RandomNumberGenerator& __rand) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__out_first, __out_last)) + return _STLP_PRIV __random_sample(__first, __last, + __out_first, __rand, + __out_last - __out_first); +} + +#endif /* _STLP_NO_EXTENSIONS */ + +// partition, stable_partition, and their auxiliary functions +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP _ForwardIter __partition(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred, + const forward_iterator_tag &) { + if (__first == __last) return __first; + + while (__pred(*__first)) + if (++__first == __last) return __first; + + _ForwardIter __next = __first; + + while (++__next != __last) { + if (__pred(*__next)) { + _STLP_STD::swap(*__first, *__next); + ++__first; + } + } + return __first; +} + +template +_STLP_INLINE_LOOP _BidirectionalIter __partition(_BidirectionalIter __first, + _BidirectionalIter __last, + _Predicate __pred, + const bidirectional_iterator_tag &) { + for (;;) { + for (;;) { + if (__first == __last) + return __first; + else if (__pred(*__first)) + ++__first; + else + break; + } + --__last; + for (;;) { + if (__first == __last) + return __first; + else if (!__pred(*__last)) + --__last; + else + break; + } + iter_swap(__first, __last); + ++__first; + } +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline +_BidirectionalIter __partition(_BidirectionalIter __first, + _BidirectionalIter __last, + _Predicate __pred, + const random_access_iterator_tag &) { + return __partition(__first, __last, __pred, bidirectional_iterator_tag()); +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __partition(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); +} + + +/* __pred_of_first: false if we know that __pred(*__first) is false, + * true when we don't know the result of __pred(*__first). + * __not_pred_of_before_last: true if we know that __pred(*--__last) is true, + * false when we don't know the result of __pred(*--__last). + */ +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __inplace_stable_partition(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred, _Distance __len, + bool __pred_of_first, bool __pred_of_before_last) { + if (__len == 1) + return (__pred_of_first && (__pred_of_before_last || __pred(*__first))) ? __last : __first; + _ForwardIter __middle = __first; + _Distance __half_len = __len / 2; + _STLP_STD::advance(__middle, __half_len); + return _STLP_PRIV __rotate(_STLP_PRIV __inplace_stable_partition(__first, __middle, __pred, __half_len, __pred_of_first, false), + __middle, + _STLP_PRIV __inplace_stable_partition(__middle, __last, __pred, __len - __half_len, true, __pred_of_before_last)); +} + +template +_ForwardIter __stable_partition_adaptive(_ForwardIter __first, + _ForwardIter __last, + _Predicate __pred, _Distance __len, + _Pointer __buffer, _Distance __buffer_size, + bool __pred_of_first, bool __pred_of_before_last) { + if (__len <= __buffer_size) { + _ForwardIter __result1 = __first; + _Pointer __result2 = __buffer; + if ((__first != __last) && (!__pred_of_first || __pred(*__first))) { + *__result2 = *__first; + ++__result2; ++__first; --__len; + } + for (; __first != __last ; ++__first, --__len) { + if (((__len == 1) && (__pred_of_before_last || __pred(*__first))) || + ((__len != 1) && __pred(*__first))){ + *__result1 = *__first; + ++__result1; + } + else { + *__result2 = *__first; + ++__result2; + } + } + _STLP_STD::copy(__buffer, __result2, __result1); + return __result1; + } + else { + _ForwardIter __middle = __first; + _Distance __half_len = __len / 2; + _STLP_STD::advance(__middle, __half_len); + return _STLP_PRIV __rotate(_STLP_PRIV __stable_partition_adaptive(__first, __middle, __pred, + __half_len, __buffer, __buffer_size, + __pred_of_first, false), + __middle, + _STLP_PRIV __stable_partition_adaptive(__middle, __last, __pred, + __len - __half_len, __buffer, __buffer_size, + true, __pred_of_before_last)); + } +} + +template +inline _ForwardIter +__stable_partition_aux_aux(_ForwardIter __first, _ForwardIter __last, + _Predicate __pred, _Tp*, _Distance*, bool __pred_of_before_last) { + _Temporary_buffer<_ForwardIter, _Tp> __buf(__first, __last); + _STLP_MPWFIX_TRY //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present + return (__buf.size() > 0) ? + __stable_partition_adaptive(__first, __last, __pred, + _Distance(__buf.requested_size()), + __buf.begin(), __buf.size(), + false, __pred_of_before_last) : + __inplace_stable_partition(__first, __last, __pred, + _Distance(__buf.requested_size()), + false, __pred_of_before_last); + _STLP_MPWFIX_CATCH //*TY 06/01/2000 - they forget to call dtor for _Temporary_buffer if no try/catch block is present +} + +template +_ForwardIter +__stable_partition_aux(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, + const forward_iterator_tag &) { + return __stable_partition_aux_aux(__first, __last, __pred, + _STLP_VALUE_TYPE(__first, _ForwardIter), + _STLP_DISTANCE_TYPE(__first, _ForwardIter), false); +} + +template +_BidirectIter +__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred, + const bidirectional_iterator_tag &) { + for (--__last;;) { + if (__first == __last) + return __first; + else if (!__pred(*__last)) + --__last; + else + break; + } + ++__last; + //Here we know that __pred(*--__last) is true + return __stable_partition_aux_aux(__first, __last, __pred, + _STLP_VALUE_TYPE(__first, _BidirectIter), + _STLP_DISTANCE_TYPE(__first, _BidirectIter), true); +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +_BidirectIter +__stable_partition_aux(_BidirectIter __first, _BidirectIter __last, _Predicate __pred, + const random_access_iterator_tag &) { + return __stable_partition_aux(__first, __last, __pred, bidirectional_iterator_tag()); +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_ForwardIter +stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for (;;) { + if (__first == __last) + return __first; + else if (__pred(*__first)) + ++__first; + else + break; + } + return _STLP_PRIV __stable_partition_aux(__first, __last, __pred, + _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_RandomAccessIter __unguarded_partition(_RandomAccessIter __first, + _RandomAccessIter __last, + _Tp __pivot, _Compare __comp) { + for (;;) { + while (__comp(*__first, __pivot)) { + _STLP_VERBOSE_ASSERT(!__comp(__pivot, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + ++__first; + } + --__last; + while (__comp(__pivot, *__last)) { + _STLP_VERBOSE_ASSERT(!__comp(*__last, __pivot), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + --__last; + } + if (!(__first < __last)) + return __first; + iter_swap(__first, __last); + ++__first; + } +} + +// sort() and its auxiliary functions. +#define __stl_threshold 16 + +template +void __unguarded_linear_insert(_RandomAccessIter __last, _Tp __val, + _Compare __comp) { + _RandomAccessIter __next = __last; + --__next; + while (__comp(__val, *__next)) { + _STLP_VERBOSE_ASSERT(!__comp(*__next, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *__last = *__next; + __last = __next; + --__next; + } + *__last = __val; +} + +template +inline void __linear_insert(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp __val, _Compare __comp) { + //*TY 12/26/1998 - added __val as a paramter + // _Tp __val = *__last; //*TY 12/26/1998 - __val supplied by caller + if (__comp(__val, *__first)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + copy_backward(__first, __last, __last + 1); + *__first = __val; + } + else + __unguarded_linear_insert(__last, __val, __comp); +} + +template +void __insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, + _Tp *, _Compare __comp) { + if (__first == __last) return; + for (_RandomAccessIter __i = __first + 1; __i != __last; ++__i) + __linear_insert<_RandomAccessIter, _Tp, _Compare>(__first, __i, *__i, __comp); //*TY 12/26/1998 - supply *__i as __val +} + +template +void __unguarded_insertion_sort_aux(_RandomAccessIter __first, + _RandomAccessIter __last, + _Tp*, _Compare __comp) { + for (_RandomAccessIter __i = __first; __i != __last; ++__i) + __unguarded_linear_insert<_RandomAccessIter, _Tp, _Compare>(__i, *__i, __comp); +} + +template +inline void __unguarded_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, + _Compare __comp) { + __unguarded_insertion_sort_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp); +} + +template +void __final_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + if (__last - __first > __stl_threshold) { + __insertion_sort(__first, __first + __stl_threshold, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); + __unguarded_insertion_sort(__first + __stl_threshold, __last, __comp); + } + else + __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); +} + +template +void __introsort_loop(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, + _Size __depth_limit, _Compare __comp) { + while (__last - __first > __stl_threshold) { + if (__depth_limit == 0) { + partial_sort(__first, __last, __last, __comp); + return; + } + --__depth_limit; + _RandomAccessIter __cut = + __unguarded_partition(__first, __last, + _Tp(__median(*__first, + *(__first + (__last - __first)/2), + *(__last - 1), __comp)), + __comp); + __introsort_loop(__cut, __last, (_Tp*) 0, __depth_limit, __comp); + __last = __cut; + } +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void sort(_RandomAccessIter __first, _RandomAccessIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first != __last) { + _STLP_PRIV __introsort_loop(__first, __last, + _STLP_VALUE_TYPE(__first, _RandomAccessIter), + _STLP_PRIV __lg(__last - __first) * 2, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); + _STLP_PRIV __final_insertion_sort(__first, __last, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); + } +} + +template +void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first != __last) { + _STLP_PRIV __introsort_loop(__first, __last, + _STLP_VALUE_TYPE(__first, _RandomAccessIter), + _STLP_PRIV __lg(__last - __first) * 2, __comp); + _STLP_PRIV __final_insertion_sort(__first, __last, __comp); + } +} + +// stable_sort() and its auxiliary functions. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void __inplace_stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + if (__last - __first < 15) { + __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); + return; + } + _RandomAccessIter __middle = __first + (__last - __first) / 2; + __inplace_stable_sort(__first, __middle, __comp); + __inplace_stable_sort(__middle, __last, __comp); + __merge_without_buffer(__first, __middle, __last, + __middle - __first, + __last - __middle, + __comp); +} + +template +void __merge_sort_loop(_RandomAccessIter1 __first, + _RandomAccessIter1 __last, + _RandomAccessIter2 __result, _Distance __step_size, + _Compare __comp) { + _Distance __two_step = 2 * __step_size; + + while (__last - __first >= __two_step) { + __result = merge(__first, __first + __step_size, + __first + __step_size, __first + __two_step, + __result, + __comp); + __first += __two_step; + } + __step_size = (min) (_Distance(__last - __first), __step_size); + + merge(__first, __first + __step_size, + __first + __step_size, __last, + __result, + __comp); +} + +const int __stl_chunk_size = 7; + +template +void __chunk_insertion_sort(_RandomAccessIter __first, + _RandomAccessIter __last, + _Distance __chunk_size, _Compare __comp) { + while (__last - __first >= __chunk_size) { + __insertion_sort(__first, __first + __chunk_size, + _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); + __first += __chunk_size; + } + __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); +} + +template +void __merge_sort_with_buffer(_RandomAccessIter __first, + _RandomAccessIter __last, _Pointer __buffer, + _Distance*, _Compare __comp) { + _Distance __len = __last - __first; + _Pointer __buffer_last = __buffer + __len; + + _Distance __step_size = __stl_chunk_size; + __chunk_insertion_sort(__first, __last, __step_size, __comp); + + while (__step_size < __len) { + __merge_sort_loop(__first, __last, __buffer, __step_size, __comp); + __step_size *= 2; + __merge_sort_loop(__buffer, __buffer_last, __first, __step_size, __comp); + __step_size *= 2; + } +} + +template +_BidirectionalIter1 __rotate_adaptive(_BidirectionalIter1 __first, + _BidirectionalIter1 __middle, + _BidirectionalIter1 __last, + _Distance __len1, _Distance __len2, + _BidirectionalIter2 __buffer, + _Distance __buffer_size) { + if (__len1 > __len2 && __len2 <= __buffer_size) { + _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__middle, __last, __buffer); + _STLP_STD::copy_backward(__first, __middle, __last); + return _STLP_STD::copy(__buffer, __buffer_end, __first); + } + else if (__len1 <= __buffer_size) { + _BidirectionalIter2 __buffer_end = _STLP_STD::copy(__first, __middle, __buffer); + _STLP_STD::copy(__middle, __last, __first); + return _STLP_STD::copy_backward(__buffer, __buffer_end, __last); + } + else + return _STLP_PRIV __rotate(__first, __middle, __last); +} + +template +void __merge_adaptive(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2, + _Pointer __buffer, _Distance __buffer_size, + _Compare __comp) { + if (__len1 <= __len2 && __len1 <= __buffer_size) { + _Pointer __buffer_end = _STLP_STD::copy(__first, __middle, __buffer); + _STLP_STD::merge(__buffer, __buffer_end, __middle, __last, __first, __comp); + } + else if (__len2 <= __buffer_size) { + _Pointer __buffer_end = _STLP_STD::copy(__middle, __last, __buffer); + _STLP_PRIV __merge_backward(__first, __middle, __buffer, __buffer_end, __last, + __comp); + } + else { + _BidirectionalIter __first_cut = __first; + _BidirectionalIter __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) { + __len11 = __len1 / 2; + _STLP_STD::advance(__first_cut, __len11); + __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp); + __len22 += _STLP_STD::distance(__middle, __second_cut); + } + else { + __len22 = __len2 / 2; + _STLP_STD::advance(__second_cut, __len22); + __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp); + __len11 += _STLP_STD::distance(__first, __first_cut); + } + _BidirectionalIter __new_middle = + __rotate_adaptive(__first_cut, __middle, __second_cut, __len1 - __len11, + __len22, __buffer, __buffer_size); + __merge_adaptive(__first, __first_cut, __new_middle, __len11, + __len22, __buffer, __buffer_size, __comp); + __merge_adaptive(__new_middle, __second_cut, __last, __len1 - __len11, + __len2 - __len22, __buffer, __buffer_size, __comp); + } +} + +template +void __stable_sort_adaptive(_RandomAccessIter __first, + _RandomAccessIter __last, _Pointer __buffer, + _Distance __buffer_size, _Compare __comp) { + _Distance __len = (__last - __first + 1) / 2; + _RandomAccessIter __middle = __first + __len; + if (__len > __buffer_size) { + __stable_sort_adaptive(__first, __middle, __buffer, __buffer_size, + __comp); + __stable_sort_adaptive(__middle, __last, __buffer, __buffer_size, + __comp); + } + else { + __merge_sort_with_buffer(__first, __middle, __buffer, (_Distance*)0, + __comp); + __merge_sort_with_buffer(__middle, __last, __buffer, (_Distance*)0, + __comp); + } + __merge_adaptive(__first, __middle, __last, _Distance(__middle - __first), + _Distance(__last - __middle), __buffer, __buffer_size, + __comp); +} + +template +void __stable_sort_aux(_RandomAccessIter __first, + _RandomAccessIter __last, _Tp*, _Distance*, + _Compare __comp) { + _Temporary_buffer<_RandomAccessIter, _Tp> buf(__first, __last); + if (buf.begin() == 0) + __inplace_stable_sort(__first, __last, __comp); + else + __stable_sort_adaptive(__first, __last, buf.begin(), + _Distance(buf.size()), + __comp); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_PRIV __stable_sort_aux(__first, __last, + _STLP_VALUE_TYPE(__first, _RandomAccessIter), + _STLP_DISTANCE_TYPE(__first, _RandomAccessIter), + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); +} + +template +void stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_PRIV __stable_sort_aux(__first, __last, + _STLP_VALUE_TYPE(__first, _RandomAccessIter), + _STLP_DISTANCE_TYPE(__first, _RandomAccessIter), + __comp); +} + +// partial_sort, partial_sort_copy, and auxiliary functions. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void __partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, + _RandomAccessIter __last, _Tp*, _Compare __comp) { + make_heap(__first, __middle, __comp); + for (_RandomAccessIter __i = __middle; __i < __last; ++__i) { + if (__comp(*__i, *__first)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __pop_heap(__first, __middle, __i, _Tp(*__i), __comp, + _STLP_DISTANCE_TYPE(__first, _RandomAccessIter)); + } + } + sort_heap(__first, __middle, __comp); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, + _RandomAccessIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) + _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); +} + +template +void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, + _RandomAccessIter __last, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) + _STLP_PRIV __partial_sort(__first, __middle, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_RandomAccessIter __partial_sort_copy(_InputIter __first, + _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last, + _Compare __comp, _Distance*, _Tp*) { + if (__result_first == __result_last) return __result_last; + _RandomAccessIter __result_real_last = __result_first; + while(__first != __last && __result_real_last != __result_last) { + *__result_real_last = *__first; + ++__result_real_last; + ++__first; + } + make_heap(__result_first, __result_real_last, __comp); + while (__first != __last) { + if (__comp(*__first, *__result_first)) { + _STLP_VERBOSE_ASSERT(!__comp(*__result_first, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __adjust_heap(__result_first, _Distance(0), + _Distance(__result_real_last - __result_first), + _Tp(*__first), + __comp); + } + ++__first; + } + sort_heap(__result_first, __result_real_last, __comp); + return __result_real_last; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_RandomAccessIter +partial_sort_copy(_InputIter __first, _InputIter __last, + _RandomAccessIter __result_first, _RandomAccessIter __result_last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last)) + return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _InputIter)), + _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter), + _STLP_VALUE_TYPE(__first, _InputIter)); +} + +template +_RandomAccessIter +partial_sort_copy(_InputIter __first, _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__result_first, __result_last)) + return _STLP_PRIV __partial_sort_copy(__first, __last, __result_first, __result_last, + __comp, + _STLP_DISTANCE_TYPE(__result_first, _RandomAccessIter), + _STLP_VALUE_TYPE(__first, _InputIter)); +} + +// nth_element() and its auxiliary functions. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void __nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last, _Tp*, _Compare __comp) { + while (__last - __first > 3) { + _RandomAccessIter __cut = + __unguarded_partition(__first, __last, + _Tp(__median(*__first, + *(__first + (__last - __first)/2), + *(__last - 1), + __comp)), + __comp); + if (__cut <= __nth) + __first = __cut; + else + __last = __cut; + } + __insertion_sort(__first, __last, _STLP_VALUE_TYPE(__first,_RandomAccessIter), __comp); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last)) + _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter))); +} + +template +void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __nth)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__nth, __last)) + _STLP_PRIV __nth_element(__first, __nth, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIter), __comp); +} + +// Binary search (lower_bound, upper_bound, equal_range, binary_search). +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare1 __comp1, _Compare2 __comp2, _Distance*) { + _Distance __len = _STLP_STD::distance(__first, __last); + _Distance __half; + + while (__len > 0) { + __half = __len >> 1; + _ForwardIter __middle = __first; + _STLP_STD::advance(__middle, __half); + if (__comp2(__val, *__middle)) { + _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __len = __half; + } + else { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + } + return __first; +} + +template +pair<_ForwardIter, _ForwardIter> +__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare1 __comp1, _Compare2 __comp2, _Distance* __dist) { + _Distance __len = _STLP_STD::distance(__first, __last); + _Distance __half; + + while (__len > 0) { + __half = __len >> 1; + _ForwardIter __middle = __first; + _STLP_STD::advance(__middle, __half); + if (__comp1(*__middle, __val)) { + _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else if (__comp2(__val, *__middle)) { + _STLP_VERBOSE_ASSERT(!__comp1(*__middle, __val), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __len = __half; + } + else { + _ForwardIter __left = _STLP_PRIV __lower_bound(__first, __middle, __val, __comp1, __comp2, __dist); + //Small optim: If lower_bound haven't found an equivalent value + //there is no need to call upper_bound. + if (__comp1(*__left, __val)) { + _STLP_VERBOSE_ASSERT(!__comp2(__val, *__left), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return pair<_ForwardIter, _ForwardIter>(__left, __left); + } + _STLP_STD::advance(__first, __len); + _ForwardIter __right = _STLP_PRIV __upper_bound(++__middle, __first, __val, __comp1, __comp2, __dist); + return pair<_ForwardIter, _ForwardIter>(__left, __right); + } + } + return pair<_ForwardIter, _ForwardIter>(__first, __first); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) { + if (*__first2 < *__first1) { + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + } + ++__result; + } + return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result)); +} + +template +_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first2, *__first1)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + } + ++__result; + } + return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result)); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void __merge_without_buffer(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, + _Distance __len1, _Distance __len2, + _Compare __comp) { + if (__len1 == 0 || __len2 == 0) + return; + if (__len1 + __len2 == 2) { + if (__comp(*__middle, *__first)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + iter_swap(__first, __middle); + } + return; + } + _BidirectionalIter __first_cut = __first; + _BidirectionalIter __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) { + __len11 = __len1 / 2; + _STLP_STD::advance(__first_cut, __len11); + __second_cut = _STLP_STD::lower_bound(__middle, __last, *__first_cut, __comp); + __len22 += _STLP_STD::distance(__middle, __second_cut); + } + else { + __len22 = __len2 / 2; + _STLP_STD::advance(__second_cut, __len22); + __first_cut = _STLP_STD::upper_bound(__first, __middle, *__second_cut, __comp); + __len11 += _STLP_STD::distance(__first, __first_cut); + } + _BidirectionalIter __new_middle + = _STLP_PRIV __rotate(__first_cut, __middle, __second_cut); + __merge_without_buffer(__first, __first_cut, __new_middle, __len11, __len22, + __comp); + __merge_without_buffer(__new_middle, __second_cut, __last, __len1 - __len11, + __len2 - __len22, __comp); +} + +template +_BidirectionalIter3 __merge_backward(_BidirectionalIter1 __first1, + _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, + _BidirectionalIter2 __last2, + _BidirectionalIter3 __result, + _Compare __comp) { + if (__first1 == __last1) + return copy_backward(__first2, __last2, __result); + if (__first2 == __last2) + return copy_backward(__first1, __last1, __result); + --__last1; + --__last2; + for (;;) { + if (__comp(*__last2, *__last1)) { + _STLP_VERBOSE_ASSERT(!__comp(*__last1, *__last2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *--__result = *__last1; + if (__first1 == __last1) + return copy_backward(__first2, ++__last2, __result); + --__last1; + } + else { + *--__result = *__last2; + if (__first2 == __last2) + return copy_backward(__first1, ++__last1, __result); + --__last2; + } + } +} + +template +inline void __inplace_merge_aux(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, _Tp*, _Distance*, + _Compare __comp) { + _Distance __len1 = _STLP_STD::distance(__first, __middle); + _Distance __len2 = _STLP_STD::distance(__middle, __last); + + _Temporary_buffer<_BidirectionalIter, _Tp> __buf(__first, __last); + if (__buf.begin() == 0) + __merge_without_buffer(__first, __middle, __last, __len1, __len2, __comp); + else + __merge_adaptive(__first, __middle, __last, __len1, __len2, + __buf.begin(), _Distance(__buf.size()), + __comp); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void inplace_merge(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) + if (__first == __middle || __middle == __last) + return; + _STLP_PRIV __inplace_merge_aux(__first, __middle, __last, + _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter), + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter))); +} + +template +void inplace_merge(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __middle)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__middle, __last)) + if (__first == __middle || __middle == __last) + return; + _STLP_PRIV __inplace_merge_aux(__first, __middle, __last, + _STLP_VALUE_TYPE(__first, _BidirectionalIter), _STLP_DISTANCE_TYPE(__first, _BidirectionalIter), + __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first2, *__first1)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return false; + } + else if (__comp(*__first1, *__first2)) + ++__first1; + else + ++__first1, ++__first2; + + return __first2 == __last2; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +bool includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, _Compare __comp) { + return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, __comp); +} + +template +bool includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) { + return _STLP_PRIV __includes(__first1, __last1, __first2, __last2, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIter __set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first1, *__first2)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *__result = *__first1; + ++__first1; + } + else if (__comp(*__first2, *__first1)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *__result = *__first2; + ++__first2; + } + else { + *__result = *__first1; + ++__first1; + ++__first2; + } + ++__result; + } + return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result)); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); +} + +template +_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + return _STLP_PRIV __set_union(__first1, __last1, __first2, __last2, __result, __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIter __set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first1, *__first2)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + ++__first1; + } + else if (__comp(*__first2, *__first1)) + ++__first2; + else { + *__result = *__first1; + ++__first1; + ++__first2; + ++__result; + } + return __result; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); +} + +template +_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + return _STLP_PRIV __set_intersection(__first1, __last1, __first2, __last2, __result, __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIter __set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) + if (__comp(*__first1, *__first2)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *__result = *__first1; + ++__first1; + ++__result; + } + else if (__comp(*__first2, *__first1)) + ++__first2; + else { + ++__first1; + ++__first2; + } + return _STLP_STD::copy(__first1, __last1, __result); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); +} + +template +_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + return _STLP_PRIV __set_difference(__first1, __last1, __first2, __last2, __result, __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIter +__set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first1, *__first2)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *__result = *__first1; + ++__first1; + ++__result; + } + else if (__comp(*__first2, *__first1)) { + *__result = *__first2; + ++__first2; + ++__result; + } + else { + ++__first1; + ++__first2; + } + } + return _STLP_STD::copy(__first2, __last2, _STLP_STD::copy(__first1, __last1, __result)); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter +set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result) { + return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first1, _InputIter1))); +} + +template +_OutputIter +set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, + _Compare __comp) { + return _STLP_PRIV __set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp); +} + +// min_element and max_element, with and without an explicitly supplied +// comparison function. + +template +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) + if (*__result < *__first) { + _STLP_VERBOSE_ASSERT(!(*__first < *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __result = __first; + } + return __result; +} + +template +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) { + if (__comp(*__result, *__first)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first, *__result), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __result = __first; + } + } + return __result; +} + +template +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) + if (*__first < *__result) { + _STLP_VERBOSE_ASSERT(!(*__result < *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __result = __first; + } + return __result; +} + +template +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) return __first; + _ForwardIter __result = __first; + while (++__first != __last) { + if (__comp(*__first, *__result)) { + _STLP_VERBOSE_ASSERT(!__comp(*__result, *__first), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __result = __first; + } + } + return __result; +} + +// next_permutation and prev_permutation, with and without an explicitly +// supplied comparison function. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) + return false; + _BidirectionalIter __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) { + _BidirectionalIter __ii = __i; + --__i; + if (__comp(*__i, *__ii)) { + _STLP_VERBOSE_ASSERT(!__comp(*__ii, *__i), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + _BidirectionalIter __j = __last; + while (!__comp(*__i, *--__j)) {} + iter_swap(__i, __j); + reverse(__ii, __last); + return true; + } + if (__i == __first) { + reverse(__first, __last); + return false; + } + } +#if defined (_STLP_NEED_UNREACHABLE_RETURN) + return false; +#endif +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __next_permutation(__first, __last, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter))); +} + +template +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __next_permutation(__first, __last, __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp) { + if (__first == __last) + return false; + _BidirectionalIter __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) { + _BidirectionalIter __ii = __i; + --__i; + if (__comp(*__ii, *__i)) { + _STLP_VERBOSE_ASSERT(!__comp(*__i, *__ii), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + _BidirectionalIter __j = __last; + while (!__comp(*--__j, *__i)) {} + iter_swap(__i, __j); + reverse(__ii, __last); + return true; + } + if (__i == __first) { + reverse(__first, __last); + return false; + } + } +#if defined (_STLP_NEED_UNREACHABLE_RETURN) + return false; +#endif +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __prev_permutation(__first, __last, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _BidirectionalIter))); +} + +template +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __prev_permutation(__first, __last, __comp); +} + +#if !defined (_STLP_NO_EXTENSIONS) + +// is_heap, a predicate testing whether or not a range is +// a heap. This function is an extension, not part of the C++ +// standard. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __is_heap(_RandomAccessIter __first, _StrictWeakOrdering __comp, + _Distance __n) { + _Distance __parent = 0; + for (_Distance __child = 1; __child < __n; ++__child) { + if (__comp(__first[__parent], __first[__child])) { + _STLP_VERBOSE_ASSERT(!__comp(__first[__child], __first[__parent]), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return false; + } + if ((__child & 1) == 0) + ++__parent; + } + return true; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __is_heap(__first, _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _RandomAccessIter)), __last - __first); +} + +template +bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, + _StrictWeakOrdering __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __is_heap(__first, __comp, __last - __first); +} + + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __is_sorted(_ForwardIter __first, _ForwardIter __last, + _StrictWeakOrdering __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) + return true; + + _ForwardIter __next = __first; + for (++__next; __next != __last; __first = __next, ++__next) { + if (__comp(*__next, *__first)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first, *__next), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return false; + } + } + + return true; +} + +_STLP_MOVE_TO_STD_NAMESPACE +#endif /* _STLP_NO_EXTENSIONS */ + +_STLP_END_NAMESPACE + +#undef __stl_threshold + +#endif /* _STLP_ALGO_C */ +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_algo.h b/sdk/tlibstdcxx/stlport/stl/_algo.h new file mode 100644 index 0000000000..7f67661e14 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_algo.h @@ -0,0 +1,777 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +// This file is partly from libc++/include/algorithm from LLVM project. +//===-------------------------- algorithm ---------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _STLP_INTERNAL_ALGO_H +#define _STLP_INTERNAL_ALGO_H + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_HEAP_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO) +// remove() conflict +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// for_each. Apply a function to every element of a range. +template +_STLP_INLINE_LOOP _Function +for_each(_InputIter __first, _InputIter __last, _Function __f) { + for ( ; __first != __last; ++__first) + __f(*__first); + return __f; +} + +// count_if +template +_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter) +count_if(_InputIter __first, _InputIter __last, _Predicate __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0; + for ( ; __first != __last; ++__first) { + if (__pred(*__first)) + ++__n; + } + return __n; +} + +// adjacent_find. + +template +_STLP_INLINE_LOOP _ForwardIter +adjacent_find(_ForwardIter __first, _ForwardIter __last, + _BinaryPredicate __binary_pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + if (__first == __last) + return __last; + _ForwardIter __next = __first; + while(++__next != __last) { + if (__binary_pred(*__first, *__next)) + return __first; + __first = __next; + } + return __last; +} + +template +_STLP_INLINE_LOOP _ForwardIter +adjacent_find(_ForwardIter __first, _ForwardIter __last) { + return adjacent_find(__first, __last, + _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter))); +} + +#if !defined (_STLP_NO_ANACHRONISMS) +template +_STLP_INLINE_LOOP void +count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + if (*__first == __val) + ++__n; +} + +template +_STLP_INLINE_LOOP void +count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + if (__pred(*__first)) + ++__n; +} +#endif + +template +_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2); + +// search_n. Search for __count consecutive copies of __val. +template +_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val); +template +_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last, + _Integer __count, const _Tp& __val, _BinaryPred __binary_pred); + +template +inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2); +} + +template +inline _InputIter +find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp); +} + +template +_ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2); + +// swap_ranges +template +_STLP_INLINE_LOOP _ForwardIter2 +swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + for ( ; __first1 != __last1; ++__first1, ++__first2) + iter_swap(__first1, __first2); + return __first2; +} + +// transform +template +_STLP_INLINE_LOOP _OutputIter +transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first, ++__result) + *__result = __opr(*__first); + return __result; +} +template +_STLP_INLINE_LOOP _OutputIter +transform(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result) + *__result = __binary_op(*__first1, *__first2); + return __result; +} + +// replace_if, replace_copy, replace_copy_if + +template +_STLP_INLINE_LOOP void +replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + if (__pred(*__first)) + *__first = __new_value; +} + +template +_STLP_INLINE_LOOP _OutputIter +replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result, + const _Tp& __old_value, const _Tp& __new_value) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first, ++__result) + *__result = *__first == __old_value ? __new_value : *__first; + return __result; +} + +template +_STLP_INLINE_LOOP _OutputIter +replace_copy_if(_Iterator __first, _Iterator __last, + _OutputIter __result, + _Predicate __pred, const _Tp& __new_value) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first, ++__result) + *__result = __pred(*__first) ? __new_value : *__first; + return __result; +} + +// generate and generate_n + +template +_STLP_INLINE_LOOP void +generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + *__first = __gen(); +} + +template +_STLP_INLINE_LOOP void +generate_n(_OutputIter __first, _Size __n, _Generator __gen) { + for ( ; __n > 0; --__n, ++__first) + *__first = __gen(); +} + +// remove, remove_if, remove_copy, remove_copy_if + +template +_STLP_INLINE_LOOP _OutputIter +remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) { + if (!(*__first == __val)) { + *__result = *__first; + ++__result; + } + } + return __result; +} + +template +_STLP_INLINE_LOOP _OutputIter +remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) { + if (!__pred(*__first)) { + *__result = *__first; + ++__result; + } + } + return __result; +} + +template +_STLP_INLINE_LOOP _ForwardIter +remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + __first = find(__first, __last, __val); + if (__first == __last) + return __first; + else { + _ForwardIter __next = __first; + return remove_copy(++__next, __last, __first, __val); + } +} + +template +_STLP_INLINE_LOOP _ForwardIter +remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + __first = find_if(__first, __last, __pred); + if ( __first == __last ) + return __first; + else { + _ForwardIter __next = __first; + return remove_copy_if(++__next, __last, __first, __pred); + } +} + +// unique and unique_copy +template +_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result); + +template +_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result, + _BinaryPredicate __binary_pred); + +template +inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) { + __first = adjacent_find(__first, __last); + + if (__first != __last) + { + // ... a a ? ... + // f i + _ForwardIter __i = __first; + for (++__i; ++__i != __last;) + if (!(*__first == *__i)) + *++__first = *__i; + ++__first; + } + return __first; +} + +template +inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last, + _BinaryPredicate __binary_pred) { + __first = adjacent_find(__first, __last, __binary_pred); + + if (__first != __last) + { + // ... a a ? ... + // f i + _ForwardIter __i = __first; + for (++__i; ++__i != __last;) + if (!__binary_pred(*__first, *__i)) + *++__first = *__i; + ++__first; + } + return __first; +} + +// reverse and reverse_copy, and their auxiliary functions + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP void +__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) { + for (; __first != __last && __first != --__last; ++__first) + _STLP_STD::iter_swap(__first,__last); +} + +template +_STLP_INLINE_LOOP void +__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) { + for (; __first < __last; ++__first) + _STLP_STD::iter_swap(__first, --__last); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void +reverse(_BidirectionalIter __first, _BidirectionalIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_PRIV __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter)); +} + +template +_STLP_INLINE_LOOP +_OutputIter reverse_copy(_BidirectionalIter __first, + _BidirectionalIter __last, + _OutputIter __result) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + while (__first != __last) { + --__last; + *__result = *__last; + ++__result; + } + return __result; +} + +template +void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last); + +template +inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle, + _ForwardIter __last, _OutputIter __result) { + return _STLP_STD::copy(__first, __middle, copy(__middle, __last, __result)); +} + +// random_shuffle + +template +void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last); + +template +void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last, + _RandomNumberGenerator& __rand); + +#if !defined (_STLP_NO_EXTENSIONS) +// random_sample and random_sample_n (extensions, not part of the standard). + +template +_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, + _OutputIter __out_ite, const _Distance __n); + +template +_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last, + _OutputIter __out_ite, const _Distance __n, + _RandomNumberGenerator& __rand); + +template +_RandomAccessIter +random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_first, _RandomAccessIter __out_last); + +template +_RandomAccessIter +random_sample(_InputIter __first, _InputIter __last, + _RandomAccessIter __out_first, _RandomAccessIter __out_last, + _RandomNumberGenerator& __rand); + +#endif /* _STLP_NO_EXTENSIONS */ + +// partition, stable_partition, and their auxiliary functions + +template +_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred); + +template +_ForwardIter +stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred); + +// sort() and its auxiliary functions. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _Size __lg(_Size __n) { + _Size __k; + for (__k = 0; __n != 1; __n >>= 1) ++__k; + return __k; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +void sort(_RandomAccessIter __first, _RandomAccessIter __last); +template +void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp); + +// stable_sort() and its auxiliary functions. +template +void stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last); + +template +void stable_sort(_RandomAccessIter __first, + _RandomAccessIter __last, _Compare __comp); + +// partial_sort, partial_sort_copy, and auxiliary functions. + +template +void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle, + _RandomAccessIter __last); + +template +void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle, + _RandomAccessIter __last, _Compare __comp); + +template +_RandomAccessIter +partial_sort_copy(_InputIter __first, _InputIter __last, + _RandomAccessIter __result_first, _RandomAccessIter __result_last); + +template +_RandomAccessIter +partial_sort_copy(_InputIter __first, _InputIter __last, + _RandomAccessIter __result_first, + _RandomAccessIter __result_last, _Compare __comp); + +// nth_element() and its auxiliary functions. +template +void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last); + +template +void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth, + _RandomAccessIter __last, _Compare __comp); + +// auxiliary class for lower_bound, etc. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct __less_2 { + bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; } +}; + +template +__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); } + +#if defined (_STLP_FUNCTION_PARTIAL_ORDER) +template +less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); } +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +// Binary search (lower_bound, upper_bound, equal_range, binary_search). +template +inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __lower_bound(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +template +inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare1 __comp1, _Compare2 __comp2, _Distance*); + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __upper_bound(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +template +inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +pair<_ForwardIter, _ForwardIter> +__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare1 __comp1, _Compare2 __comp2, _Distance*); + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline pair<_ForwardIter, _ForwardIter> +equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __equal_range(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +template +inline pair<_ForwardIter, _ForwardIter> +equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +template +inline bool binary_search(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, + _STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0), + _STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + return __i != __last && !(__val < *__i); +} + +template +inline bool binary_search(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp, + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); + return __i != __last && !__comp(__val, *__i); +} + +// merge, with and without an explicitly supplied comparison function. + +template +_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result); + +template +_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp); + + +// inplace_merge and its auxiliary functions. + + +template +void inplace_merge(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last) ; + +template +void inplace_merge(_BidirectionalIter __first, + _BidirectionalIter __middle, + _BidirectionalIter __last, _Compare __comp); + +// Set algorithms: includes, set_union, set_intersection, set_difference, +// set_symmetric_difference. All of these algorithms have the precondition +// that their input ranges are sorted and the postcondition that their output +// ranges are sorted. + +template +bool includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2); + +template +bool includes(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, _Compare __comp); + +template +_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result); + +template +_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp); + +template +_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result); + +template +_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp); + + + +template +_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result); + +template +_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, _Compare __comp); + +template +_OutputIter +set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result); + + +template +_OutputIter +set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _OutputIter __result, + _Compare __comp); + + +// min_element and max_element, with and without an explicitly supplied +// comparison function. + +template +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last); +template +_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last, + _Compare __comp); + +template +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last); + +template +_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last, + _Compare __comp); + +// next_permutation and prev_permutation, with and without an explicitly +// supplied comparison function. + +template +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last); + +template +bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp); + + +template +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last); + + +template +bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last, + _Compare __comp); + +#if !defined (_STLP_NO_EXTENSIONS) +// is_heap, a predicate testing whether or not a range is +// a heap. This function is an extension, not part of the C++ +// standard. + +template +bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last); + +template +bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last, + _StrictWeakOrdering __comp); + +// is_sorted, a predicated testing whether a range is sorted in +// nondescending order. This is an extension, not part of the C++ +// standard. +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __is_sorted(_ForwardIter __first, _ForwardIter __last, + _StrictWeakOrdering __comp); + +_STLP_MOVE_TO_STD_NAMESPACE +template +inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) { + return _STLP_PRIV __is_sorted(__first, __last, + _STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter))); +} + +template +inline bool is_sorted(_ForwardIter __first, _ForwardIter __last, + _StrictWeakOrdering __comp) { + return _STLP_PRIV __is_sorted(__first, __last, __comp); +} +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_ALGO_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_algobase.c b/sdk/tlibstdcxx/stlport/stl/_algobase.c new file mode 100644 index 0000000000..b3367d80a6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_algobase.c @@ -0,0 +1,484 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_ALGOBASE_C +#define _STLP_ALGOBASE_C + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + for ( ; __first1 != __last1 && __first2 != __last2 + ; ++__first1, ++__first2) { + if (*__first1 < *__first2) { + _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return true; + } + if (*__first2 < *__first1) + return false; + } + return __first1 == __last1 && __first2 != __last2; +} + +template +bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _Compare __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + for ( ; __first1 != __last1 && __first2 != __last2 + ; ++__first1, ++__first2) { + if (__comp(*__first1, *__first2)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1), + _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return true; + } + if (__comp(*__first2, *__first1)) + return false; + } + return __first1 == __last1 && __first2 != __last2; +} + +#if !defined (_STLP_NO_EXTENSIONS) +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) { + while (__first1 != __last1 && __first2 != __last2) { + if (*__first1 < *__first2) { + _STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + return -1; + } + if (*__first2 < *__first1) + return 1; + ++__first1; + ++__first2; + } + if (__first2 == __last2) { + return !(__first1 == __last1); + } + else { + return -1; + } +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2); +} +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last, + const _Tp& __val, + const random_access_iterator_tag &) { + _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2; + + for ( ; __trip_count > 0 ; --__trip_count) { + if (*__first == __val) return __first; + ++__first; + + if (*__first == __val) return __first; + ++__first; + + if (*__first == __val) return __first; + ++__first; + + if (*__first == __val) return __first; + ++__first; + } + + switch (__last - __first) { + case 3: + if (*__first == __val) return __first; + ++__first; + case 2: + if (*__first == __val) return __first; + ++__first; + case 1: + if (*__first == __val) return __first; + //++__first; + case 0: + default: + return __last; + } +} + +inline char* +__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) { + void *res = memchr(__first, __val, __last - __first); + return res != 0 ? __STATIC_CAST(char*, res) : __last; +} +inline const char* +__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) { + const void *res = memchr(__first, __val, __last - __first); + return res != 0 ? __STATIC_CAST(const char*, res) : __last; +} + +template +_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last, + _Predicate __pred, + const random_access_iterator_tag &) { + _STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2; + + for ( ; __trip_count > 0 ; --__trip_count) { + if (__pred(*__first)) return __first; + ++__first; + + if (__pred(*__first)) return __first; + ++__first; + + if (__pred(*__first)) return __first; + ++__first; + + if (__pred(*__first)) return __first; + ++__first; + } + + switch(__last - __first) { + case 3: + if (__pred(*__first)) return __first; + ++__first; + case 2: + if (__pred(*__first)) return __first; + ++__first; + case 1: + if (__pred(*__first)) return __first; + //++__first; + case 0: + default: + return __last; + } +} + +template +_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last, + const _Tp& __val, + const input_iterator_tag &) { + while (__first != __last && !(*__first == __val)) ++__first; + return __first; +} + +template +_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _InputIter __last, + _Predicate __pred, + const input_iterator_tag &) { + while (__first != __last && !__pred(*__first)) + ++__first; + return __first; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_InputIter find_if(_InputIter __first, _InputIter __last, + _Predicate __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); +} + +template +_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); +} + +template +_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + _BinaryPred __pred) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + // Test for empty ranges + if (__first1 == __last1 || __first2 == __last2) + return __first1; + + // Test for a pattern of length 1. + _ForwardIter2 __p1(__first2); + + if ( ++__p1 == __last2 ) { + while (__first1 != __last1 && !__pred(*__first1, *__first2)) { + ++__first1; + } + return __first1; + } + + // General case. + + for ( ; ; ) { // __first1 != __last1 will be checked below + while (__first1 != __last1 && !__pred(*__first1, *__first2)) { + ++__first1; + } + if (__first1 == __last1) { + return __last1; + } + _ForwardIter2 __p = __p1; + _ForwardIter1 __current = __first1; + if (++__current == __last1) return __last1; + + while (__pred(*__current, *__p)) { + if (++__p == __last2) + return __first1; + if (++__current == __last1) + return __last1; + } + ++__first1; + } + //return __first1; /* NOTREACHED */ +} + +_STLP_MOVE_TO_PRIV_NAMESPACE +template +struct _IsCharLikeType +{ typedef __false_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsCharLikeType +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsCharLikeType +{ typedef __true_type _Ret; }; + +# ifndef _STLP_NO_SIGNED_BUILTINS +_STLP_TEMPLATE_NULL struct _IsCharLikeType +{ typedef __true_type _Ret; }; +# endif + +template +inline bool __stlp_eq(_Tp1 __val1, _Tp2 __val2) +{ return __val1 == __val2; } + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +template +inline bool __stlp_eq(_Tp, _Tp) +{ return true; } +#endif + +template +inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + _Tp2*, _Predicate __pred, + const __true_type& /* _UseStrcspnLikeAlgo */) { + unsigned char __hints[(UCHAR_MAX + 1) / CHAR_BIT]; + memset(__hints, 0, sizeof(__hints) / sizeof(unsigned char)); + for (; __first2 != __last2; ++__first2) { + unsigned char __tmp = (unsigned char)*__first2; + __hints[__tmp / CHAR_BIT] |= (1 << (__tmp % CHAR_BIT)); + } + + for (; __first1 != __last1; ++__first1) { + _Tp2 __tmp = (_Tp2)*__first1; + if (__stlp_eq(*__first1, __tmp) && + __pred((__hints[(unsigned char)__tmp / CHAR_BIT] & (1 << ((unsigned char)__tmp % CHAR_BIT))) != 0)) + break; + } + return __first1; +} + +template +inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + _Tp2* /* __dummy */, _Predicate /* __pred */, + const __false_type& /* _UseStrcspnLikeAlgo */) { + return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, + _STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter))); +} + +template +inline _InputIter __find_first_of_aux1(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + _Tp1* __pt1, _Tp2* __pt2) { + typedef _STLP_TYPENAME _STLP_STD::_IsIntegral<_Tp1>::_Ret _IsIntegral; + typedef _STLP_TYPENAME _STLP_PRIV _IsCharLikeType<_Tp2>::_Ret _IsCharLike; + typedef _STLP_TYPENAME _STLP_STD::_Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo; + _STLP_MARK_PARAMETER_AS_UNUSED(__pt1); + return _STLP_PRIV __find_first_of_aux2(__first1, __last1, + __first2, __last2, + __pt2, _Identity(), _UseStrcspnLikeAlgo()); +} + +template +inline _InputIter __find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2) { + return _STLP_PRIV __find_first_of_aux1(__first1, __last1, __first2, __last2, + _STLP_VALUE_TYPE(__first1, _InputIter), + _STLP_VALUE_TYPE(__first2, _ForwardIter)); +} + +// find_first_of, with and without an explicitly supplied comparison function. +template +_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + _BinaryPredicate __comp) { + for ( ; __first1 != __last1; ++__first1) { + for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) { + if (__comp(*__first1, *__iter)) { + return __first1; + } + } + } + return __last1; +} + +// find_end, with and without an explicitly supplied comparison function. +// Search [first2, last2) as a subsequence in [first1, last1), and return +// the *last* possible match. Note that find_end for bidirectional iterators +// is much faster than for forward iterators. + +// find_end for forward iterators. +template +_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + const forward_iterator_tag &, const forward_iterator_tag &, + _BinaryPredicate __comp) { + if (__first2 == __last2) + return __last1; + else { + _ForwardIter1 __result = __last1; + for (;;) { + _ForwardIter1 __new_result = _STLP_STD::search(__first1, __last1, __first2, __last2, __comp); + if (__new_result == __last1) + return __result; + else { + __result = __new_result; + __first1 = __new_result; + ++__first1; + } + } + } +} + +_STLP_MOVE_TO_STD_NAMESPACE + +// find_end for bidirectional iterators. Requires partial specialization. +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + +# ifndef _STLP_INTERNAL_ITERATOR_H +_STLP_END_NAMESPACE +# include +_STLP_BEGIN_NAMESPACE +# endif /*_STLP_INTERNAL_ITERATOR_H*/ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_BidirectionalIter1 +__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1, + _BidirectionalIter2 __first2, _BidirectionalIter2 __last2, + const bidirectional_iterator_tag &, const bidirectional_iterator_tag &, + _BinaryPredicate __comp) { + typedef _STLP_STD::reverse_iterator<_BidirectionalIter1> _RevIter1; + typedef _STLP_STD::reverse_iterator<_BidirectionalIter2> _RevIter2; + + _RevIter1 __rlast1(__first1); + _RevIter2 __rlast2(__first2); + _RevIter1 __rresult = _STLP_STD::search(_RevIter1(__last1), __rlast1, + _RevIter2(__last2), __rlast2, + __comp); + + if (__rresult == __rlast1) + return __last1; + else { + _BidirectionalIter1 __result = __rresult.base(); + _STLP_STD::advance(__result, -_STLP_STD::distance(__first2, __last2)); + return __result; + } +} + +_STLP_MOVE_TO_STD_NAMESPACE +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +template +_ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + _BinaryPredicate __comp) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2, +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + _STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1), + _STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2), +#else + forward_iterator_tag(), + forward_iterator_tag(), +#endif + __comp); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + _Compare1 __comp1, _Compare2 __comp2, _Distance*) { + _Distance __len = _STLP_STD::distance(__first, __last); + _Distance __half; + _ForwardIter __middle; + + while (__len > 0) { + __half = __len >> 1; + __middle = __first; + _STLP_STD::advance(__middle, __half); + if (__comp1(*__middle, __val)) { + _STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_ALGOBASE_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_algobase.h b/sdk/tlibstdcxx/stlport/stl/_algobase.h new file mode 100644 index 0000000000..597dcbea3c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_algobase.h @@ -0,0 +1,728 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ALGOBASE_H +#define _STLP_INTERNAL_ALGOBASE_H + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +#ifndef _STLP_INTERNAL_CSTRING +# include +#endif + +#ifndef _STLP_CLIMITS +# include +#endif + +#ifndef _STLP_INTERNAL_CSTDLIB +# include +#endif + +#ifndef _STLP_INTERNAL_PAIR_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +#ifndef _STLP_TYPE_TRAITS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +_STLP_MOVE_TO_PRIV_NAMESPACE +template +inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) { + __a._M_swap_workaround(__b); +} + +template +inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) { + _Tp __tmp = __a; + __a = __b; + __b = __tmp; +} +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +// swap and iter_swap +template +inline void swap(_Tp& __a, _Tp& __b) { +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +# if !defined(__BORLANDC__) + typedef typename _SwapImplemented<_Tp>::_Ret _Implemented; +# else + enum { _Is = _SwapImplemented<_Tp>::_Is }; + typedef typename __bool2type<_Is>::_Ret _Implemented; +# endif + _STLP_PRIV __swap_aux(__a, __b, _Implemented()); +#else + _Tp __tmp = __a; + __a = __b; + __b = __tmp; +#endif +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) { + _Value tmp = *__i1; + *__i1 = *__i2; + *__i2 = tmp; +} + +template +inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) { + /* namespace specification breaks access to the right swap template overload (at least for gcc) */ + /*_STLP_STD::*/ swap(*__i1, *__i2); +} + +template +inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) { + _STLP_PRIV __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) ); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) { + _STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2), + _STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1), + _STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer()); +} + +//-------------------------------------------------- +// min and max + +#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE) +# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__) +//In not ANSI mode Borland import min/max in global namespace which conflict +//with STLport min/max when user does a 'using namespace std' in its code +//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max +//in STLport namespace. +using _STLP_VENDOR_STD::min; +using _STLP_VENDOR_STD::max; +# else +template +inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; } +template +inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; } +# endif +#endif + +# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE) +inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; } +inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; } +# endif + +# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x590) +template +inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) { + return __comp(__b, __a) ? __b : __a; +} + +template +inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) { + return __comp(__a, __b) ? __b : __a; +} +# else +template +inline const _Tp (min)(const _Tp __a, const _Tp __b, _Compare __comp) { + return __comp(__b, __a) ? __b : __a; +} + +template +inline const _Tp (max)(const _Tp __a, const _Tp __b, _Compare __comp) { + return __comp(__a, __b) ? __b : __a; +} +# endif + +//-------------------------------------------------- +// copy + +// All of these auxiliary functions serve two purposes. (1) Replace +// calls to copy with memmove whenever possible. (Memmove, not memcpy, +// because the input and output ranges are permitted to overlap.) +// (2) If we're using random access iterators, then write the loop as +// a for loop with an explicit count. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _OutputIter __copy(_InputIter __first, _InputIter __last, + _OutputIter __result, const input_iterator_tag &, _Distance*) { + for ( ; __first != __last; ++__result, ++__first) + *__result = *__first; + return __result; +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline _OutputIter __copy(_InputIter __first, _InputIter __last, + _OutputIter __result, const forward_iterator_tag &, _Distance* ) { + for ( ; __first != __last; ++__result, ++__first) + *__result = *__first; + return __result; +} + +template +inline _OutputIter __copy(_InputIter __first, _InputIter __last, + _OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) { + for ( ; __first != __last; ++__result, ++__first) + *__result = *__first; + return __result; +} +#endif + +template +inline _OutputIter +__copy(_RandomAccessIter __first, _RandomAccessIter __last, + _OutputIter __result, const random_access_iterator_tag &, _Distance*) { + for (_Distance __n = __last - __first; __n > 0; --__n) { + *__result = *__first; + ++__first; + ++__result; + } + return __result; +} + +inline void* +__copy_trivial(const void* __first, const void* __last, void* __result) { + size_t __n = (const char*)__last - (const char*)__first; + return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result; +} + +//-------------------------------------------------- +// copy_backward auxiliary functions + +template +inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first, + _BidirectionalIter1 __last, + _BidirectionalIter2 __result, + const bidirectional_iterator_tag &, + _Distance*) { + while (__first != __last) + *--__result = *--__last; + return __result; +} + +template +inline _BidirectionalIter __copy_backward(_RandomAccessIter __first, + _RandomAccessIter __last, + _BidirectionalIter __result, + const random_access_iterator_tag &, + _Distance*) { + for (_Distance __n = __last - __first; __n > 0; --__n) + *--__result = *--__last; + return __result; +} + +inline void* +__copy_trivial_backward(const void* __first, const void* __last, void* __result) { + const ptrdiff_t _Num = (const char*)__last - (const char*)__first; + return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ; +} + +template +inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, + const __false_type& /*IsOKToMemCpy*/) { + return _STLP_PRIV __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); +} +template +inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, + const __true_type& /*IsOKToMemCpy*/) { + // we know they all pointers, so this cast is OK + // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result)); + return (_OutputIter)_STLP_PRIV __copy_trivial(__first, __last, __result); +} + +template +inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, + const __true_type& /*BothPtrType*/) { + return _STLP_PRIV __copy_ptrs(__first, __last, __result, + _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter), + _STLP_VALUE_TYPE(__result, _OutputIter))._Answer()); +} + +template +inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, + const __false_type& /*BothPtrType*/) { + return _STLP_PRIV __copy(__first, __last, __result, + _STLP_ITERATOR_CATEGORY(__first, _InputIter), + _STLP_DISTANCE_TYPE(__first, _InputIter)); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer()); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last, + _OutputIter __result, const __false_type& /*TrivialAssignment*/) { + return _STLP_PRIV __copy_backward(__first, __last, __result, + _STLP_ITERATOR_CATEGORY(__first, _InputIter), + _STLP_DISTANCE_TYPE(__first, _InputIter)); +} +template +inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last, + _OutputIter __result, const __true_type& /*TrivialAssignment*/) { + return (_OutputIter)_STLP_PRIV __copy_trivial_backward(__first, __last, __result); +} + +template +inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) { + return _STLP_PRIV __copy_backward(__first, __last, __result, + _STLP_ITERATOR_CATEGORY(__first,_InputIter), + _STLP_DISTANCE_TYPE(__first, _InputIter)); +} + +template +inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) { + return _STLP_PRIV __copy_backward_ptrs(__first, __last, __result, + _UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter), + _STLP_VALUE_TYPE(__result, _OutputIter))._Answer()); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() ); +} + +#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) +# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \ +inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \ +{ return (_Tp*)_STLP_PRIV __copy_trivial(__first, __last, __result); } \ +inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \ +{ return (_Tp*)_STLP_PRIV __copy_trivial_backward(__first, __last, __result); } + +# if !defined (_STLP_NO_BOOL) +_STLP_DECLARE_COPY_TRIVIAL(bool) +# endif +_STLP_DECLARE_COPY_TRIVIAL(char) +# if !defined (_STLP_NO_SIGNED_BUILTINS) +_STLP_DECLARE_COPY_TRIVIAL(signed char) +# endif +_STLP_DECLARE_COPY_TRIVIAL(unsigned char) +_STLP_DECLARE_COPY_TRIVIAL(short) +_STLP_DECLARE_COPY_TRIVIAL(unsigned short) +_STLP_DECLARE_COPY_TRIVIAL(int) +_STLP_DECLARE_COPY_TRIVIAL(unsigned int) +_STLP_DECLARE_COPY_TRIVIAL(long) +_STLP_DECLARE_COPY_TRIVIAL(unsigned long) +# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT) +_STLP_DECLARE_COPY_TRIVIAL(wchar_t) +# endif +# if defined (_STLP_LONG_LONG) +_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG) +_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG) +# endif +_STLP_DECLARE_COPY_TRIVIAL(float) +_STLP_DECLARE_COPY_TRIVIAL(double) +# if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLARE_COPY_TRIVIAL(long double) +# endif +# undef _STLP_DECLARE_COPY_TRIVIAL +#endif + +//-------------------------------------------------- +// copy_n (not part of the C++ standard) + +#if !defined (_STLP_NO_EXTENSIONS) +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP _STLP_STD::pair<_InputIter, _OutputIter> +__copy_n(_InputIter __first, _Size __count, _OutputIter __result, + const input_iterator_tag &) { + for ( ; __count > 0; --__count) { + *__result = *__first; + ++__first; + ++__result; + } + return _STLP_STD::pair<_InputIter, _OutputIter>(__first, __result); +} + +template +inline _STLP_STD::pair<_RAIter, _OutputIter> +__copy_n(_RAIter __first, _Size __count, _OutputIter __result, + const random_access_iterator_tag &) { + _RAIter __last = __first + __count; + return _STLP_STD::pair<_RAIter, _OutputIter>(__last, _STLP_STD::copy(__first, __last, __result)); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline pair<_InputIter, _OutputIter> +copy_n(_InputIter __first, _Size __count, _OutputIter __result) { + _STLP_FIX_LITERAL_BUG(__first) + return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); +} +#endif + +//-------------------------------------------------- +// fill and fill_n +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP +void __fill_fwd(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { + for ( ; __first != __last; ++__first) + *__first = __val; +} + +template +inline void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + const input_iterator_tag &, _Distance*) { + _STLP_PRIV __fill_fwd(__first, __last, __val); +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +_STLP_INLINE_LOOP +void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + const forward_iterator_tag &, _Distance*) { + _STLP_PRIV __fill_fwd(__first, __last, __val); +} + +template +_STLP_INLINE_LOOP +void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val, + const bidirectional_iterator_tag &, _Distance*) { + _STLP_PRIV __fill_fwd(__first, __last, __val); +} +#endif + +template +_STLP_INLINE_LOOP +void __fill(_RandomAccessIter __first, _RandomAccessIter __last, const _Tp& __val, + const random_access_iterator_tag &, _Distance*) { + for (_Distance __n = __last - __first ; __n > 0; ++__first, --__n) + *__first = __val; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_PRIV __fill(__first, __last, __val, + _STLP_ITERATOR_CATEGORY(__first, _ForwardIter), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +// Specialization: for one-byte types we can use memset. +inline void fill(unsigned char* __first, unsigned char* __last, + const unsigned char& __val) { + unsigned char __tmp = __val; + memset(__first, __tmp, __last - __first); +} +#if !defined (_STLP_NO_SIGNED_BUILTINS) +inline void fill(signed char* __first, signed char* __last, + const signed char& __val) { + signed char __tmp = __val; + memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); +} +#endif +inline void fill(char* __first, char* __last, const char& __val) { + char __tmp = __val; + memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP +_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) { + _STLP_FIX_LITERAL_BUG(__first) + for ( ; __n > 0; --__n, ++__first) + *__first = __val; + return __first; +} + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +template +inline unsigned char* __fill_n(unsigned char* __first, _Size __n, + const unsigned char& __val) { + _STLP_STD::fill(__first, __first + __n, __val); + return __first + __n; +} +#if !defined (_STLP_NO_SIGNED_BUILTINS) +template +inline signed char* __fill_n(signed char* __first, _Size __n, + const signed char& __val) { + _STLP_STD::fill(__first, __first + __n, __val); + return __first + __n; +} +#endif +template +inline char* __fill_n(char* __first, _Size __n, + const char& __val) { + _STLP_STD::fill(__first, __first + __n, __val); + return __first + __n; +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) { + _STLP_FIX_LITERAL_BUG(__first) + _STLP_PRIV __fill_n(__first, __n, __val); +} + + +//-------------------------------------------------- +// equal and mismatch + +template +_STLP_INLINE_LOOP +_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, + _InputIter1 __last1, + _InputIter2 __first2) { + _STLP_FIX_LITERAL_BUG(__first2) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + while (__first1 != __last1 && *__first1 == *__first2) { + ++__first1; + ++__first2; + } + return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2); +} + +template +_STLP_INLINE_LOOP +_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1, + _InputIter1 __last1, + _InputIter2 __first2, + _BinaryPredicate __binary_pred) { + _STLP_FIX_LITERAL_BUG(__first2) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) { + ++__first1; + ++__first2; + } + return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2); +} + +template +_STLP_INLINE_LOOP +bool equal(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2) { + _STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + for ( ; __first1 != __last1; ++__first1, ++__first2) + if (!(*__first1 == *__first2)) + return false; + return true; +} + +template +_STLP_INLINE_LOOP +bool equal(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _BinaryPredicate __binary_pred) { + _STLP_FIX_LITERAL_BUG(__first2) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + for ( ; __first1 != __last1; ++__first1, ++__first2) + if (!__binary_pred(*__first1, *__first2)) + return false; + return true; +} + +//-------------------------------------------------- +// lexicographical_compare and lexicographical_compare_3way. +// (the latter is not part of the C++ standard.) + +template +bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2); + +template +bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _Compare __comp); + +inline bool +lexicographical_compare(const unsigned char* __first1, + const unsigned char* __last1, + const unsigned char* __first2, + const unsigned char* __last2) { + const size_t __len1 = __last1 - __first1; + const size_t __len2 = __last2 - __first2; + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + + const int __result = memcmp(__first1, __first2, (min) (__len1, __len2)); + return __result != 0 ? (__result < 0) : (__len1 < __len2); +} + + +#if !(CHAR_MAX == SCHAR_MAX) +inline bool lexicographical_compare(const char* __first1, const char* __last1, + const char* __first2, const char* __last2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2)) + + return lexicographical_compare((const unsigned char*) __first1, + (const unsigned char*) __last1, + (const unsigned char*) __first2, + (const unsigned char*) __last2); +} +#endif /* CHAR_MAX == SCHAR_MAX */ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2); + +inline int +__lexicographical_compare_3way(const unsigned char* __first1, + const unsigned char* __last1, + const unsigned char* __first2, + const unsigned char* __last2) { + const ptrdiff_t __len1 = __last1 - __first1; + const ptrdiff_t __len2 = __last2 - __first2; + const int __result = memcmp(__first1, __first2, (min) (__len1, __len2)); + return __result != 0 ? __result + : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); +} + + +#if !(CHAR_MAX == SCHAR_MAX) +inline int +__lexicographical_compare_3way(const char* __first1, const char* __last1, + const char* __first2, const char* __last2) { + return __lexicographical_compare_3way((const unsigned char*) __first1, + (const unsigned char*) __last1, + (const unsigned char*) __first2, + (const unsigned char*) __last2); +} +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +#if !defined (_STLP_NO_EXTENSIONS) +template +int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2); + +#endif + +// count +template +_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter) +count(_InputIter __first, _InputIter __last, const _Tp& __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DIFFERENCE_TYPE(_InputIter) __n = 0; + for ( ; __first != __last; ++__first) + if (*__first == __val) + ++__n; + return __n; +} + +// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available. +template +_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val); + +template +_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred); + +// search. +template +_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate); + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// find_first_of +template +_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2); + +template +_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, + _ForwardIter __first2, _ForwardIter __last2, + _BinaryPredicate __comp); + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_ForwardIter1 +find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, + _ForwardIter2 __first2, _ForwardIter2 __last2, + _BinaryPredicate __comp); + +// replace +template +_STLP_INLINE_LOOP void +replace(_ForwardIter __first, _ForwardIter __last, + const _Tp& __old_value, const _Tp& __new_value) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + if (*__first == __old_value) + *__first = __new_value; +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, + const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*); + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_ALGOBASE_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_alloc.c b/sdk/tlibstdcxx/stlport/stl/_alloc.c new file mode 100644 index 0000000000..467405b4b8 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_alloc.c @@ -0,0 +1,87 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_ALLOC_C +#define _STLP_ALLOC_C + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#if defined (__WATCOMC__) +# pragma warning 13 9 +# pragma warning 367 9 +# pragma warning 368 9 +#endif + +_STLP_BEGIN_NAMESPACE + +template +void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) { + size_t __total_extra = __extra_before_chunk() + __extra_after_chunk(); + size_t __real_n = __n + __total_extra; + if (__real_n < __n) { + //It means that we rolled on size_t, __n must be very large: + _STLP_THROW_BAD_ALLOC; + } + __alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n); + memset((char*)__result, __shred_byte, __real_n * sizeof(value_type)); + __result->__magic = __magic; + __result->__type_size = sizeof(value_type); + __result->_M_size = (_STLP_UINT32_T)__n; + return ((char*)__result) + (long)__extra_before; +} + +template +void _STLP_CALL +__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) { + __alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before); + // check integrity + _STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE) + _STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED) + _STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH) + _STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH) + // check pads on both sides + unsigned char* __tmp; + for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) { + _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN) + } + + size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk(); + + for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type); + __tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) { + _STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN) + } + + // that may be unfortunate, just in case + __real_p->__magic = __deleted_magic; + memset((char*)__p, __shred_byte, __n * sizeof(value_type)); + __allocator_type::deallocate(__real_p, __real_n); +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_ALLOC_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_alloc.h b/sdk/tlibstdcxx/stlport/stl/_alloc.h new file mode 100644 index 0000000000..a0529cd339 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_alloc.h @@ -0,0 +1,580 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ALLOC_H +#define _STLP_INTERNAL_ALLOC_H + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +#ifndef _STLP_INTERNAL_CSTDLIB +# include +#endif + +#ifndef _STLP_INTERNAL_CSTRING +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_NEW_HEADER +# include +#endif + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// Malloc-based allocator. Typically slower than default alloc below. +// Typically thread-safe and more storage efficient. + +#if !defined (_STLP_USE_NO_IOSTREAMS) +typedef void (* __oom_handler_type)(); +#endif + +class _STLP_CLASS_DECLSPEC __malloc_alloc { +public: + // this one is needed for proper simple_alloc wrapping + typedef char value_type; + static void* _STLP_CALL allocate(size_t __n) +#if !defined (_STLP_USE_NO_IOSTREAMS) + ; +#else + { + void *__result = malloc(__n); + if (__result == 0) { + _STLP_THROW_BAD_ALLOC; + } + return __result; + } +#endif + + static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); } +#if !defined (_STLP_USE_NO_IOSTREAMS) + static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f); +#endif +}; + +// New-based allocator. Typically slower than default alloc below. +// Typically thread-safe and more storage efficient. +class _STLP_CLASS_DECLSPEC __new_alloc { +public: + // this one is needed for proper simple_alloc wrapping + typedef char value_type; + static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); } + static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); } +}; + +// Allocator adaptor to check size arguments for debugging. +// Reports errors using assert. Checking can be disabled with +// NDEBUG, but it's far better to just use the underlying allocator +// instead when no checking is desired. +// There is some evidence that this can confuse Purify. +// This adaptor can only be applied to raw allocators + +template +class __debug_alloc : public _Alloc { +public: + typedef _Alloc __allocator_type; + typedef typename _Alloc::value_type value_type; +private: + struct __alloc_header { + size_t __magic: 16; + size_t __type_size:16; + _STLP_UINT32_T _M_size; + }; // that is 8 bytes for sure + // Sunpro CC has bug on enums, so extra_before/after set explicitly + enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd, + __shred_byte = _STLP_SHRED_BYTE }; + + enum { __extra_before = 16, __extra_after = 8 }; + // Size of space used to store size. Note + // that this must be large enough to preserve + // alignment. + static size_t _STLP_CALL __extra_before_chunk() { + return (long)__extra_before / sizeof(value_type) + + (size_t)((long)__extra_before % sizeof(value_type) > 0); + } + static size_t _STLP_CALL __extra_after_chunk() { + return (long)__extra_after / sizeof(value_type) + + (size_t)((long)__extra_after % sizeof(value_type) > 0); + } +public: + __debug_alloc() {} + ~__debug_alloc() {} + static void* _STLP_CALL allocate(size_t); + static void _STLP_CALL deallocate(void *, size_t); +}; + +# if defined (__OS400__) +// dums 02/05/2007: is it really necessary ? +enum { _MAX_BYTES = 256 }; +# else +enum { _MAX_BYTES = 32 * sizeof(void*) }; +# endif + +#if !defined (_STLP_USE_NO_IOSTREAMS) +// Default node allocator. +// With a reasonable compiler, this should be roughly as fast as the +// original STL class-specific allocators, but with less fragmentation. +class _STLP_CLASS_DECLSPEC __node_alloc { + static void * _STLP_CALL _M_allocate(size_t& __n); + /* __p may not be 0 */ + static void _STLP_CALL _M_deallocate(void *__p, size_t __n); + +public: + // this one is needed for proper simple_alloc wrapping + typedef char value_type; + /* __n must be > 0 */ + static void* _STLP_CALL allocate(size_t& __n) + { return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); } + /* __p may not be 0 */ + static void _STLP_CALL deallocate(void *__p, size_t __n) + { if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); } +}; + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>; +# endif + +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>; +_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>; +#endif + +/* macro to convert the allocator for initialization + * not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */ +#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is + * not used implicitly to convert allocator parameter, so let us do it explicitly */ +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS) +# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0) +# else +# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a +# endif +/* else convert, but only if partial specialization works, since else + * Container::allocator_type won't be different */ +#else +# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0) +#endif + +// Another allocator adaptor: _Alloc_traits. This serves two +// purposes. First, make it possible to write containers that can use +// either SGI-style allocators or standard-conforming allocator. + +// The fully general version. +template +struct _Alloc_traits { + typedef _Allocator _Orig; +#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) + typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type; + typedef typename _Rebind_type::other allocator_type; + static allocator_type create_allocator(const _Orig& __a) + { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); } +#else + // this is not actually true, used only to pass this type through + // to dynamic overload selection in _STLP_alloc_proxy methods + typedef _Allocator allocator_type; +#endif +}; + +#if defined (_STLP_USE_PERTHREAD_ALLOC) + +_STLP_END_NAMESPACE +// include additional header here +# include +_STLP_BEGIN_NAMESPACE + +typedef __pthread_alloc __alloc_type; +#elif defined (_STLP_USE_NEWALLOC) +typedef __new_alloc __alloc_type; +#elif defined (_STLP_USE_MALLOC) +typedef __malloc_alloc __alloc_type; +#else +typedef __node_alloc __alloc_type; +#endif + +#if defined (_STLP_DEBUG_ALLOC) +typedef __debug_alloc<__alloc_type> __sgi_alloc; +#else +typedef __alloc_type __sgi_alloc; +#endif + +#if !defined (_STLP_NO_ANACHRONISMS) +typedef __sgi_alloc __single_client_alloc; +typedef __sgi_alloc __multithreaded_alloc; +#endif + +// This implements allocators as specified in the C++ standard. +// +// Note that standard-conforming allocators use many language features +// that are not yet widely implemented. In particular, they rely on +// member templates, partial specialization, partial ordering of function +// templates, the typename keyword, and the use of the template keyword +// to refer to a template member of a dependent type. + +/* +template +struct _AllocatorAux { + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + + pointer address(reference __x) const {return &__x;} + const_pointer address(const_reference __x) const { return &__x; } +}; + +template +struct _AllocatorAux { + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + + const_pointer address(const_reference __x) const { return &__x; } +}; +*/ + +template +class allocator //: public _AllocatorAux<_Tp> +/* A small helper struct to recognize STLport allocator implementation + * from any user specialization one. + */ + : public __stlport_class > +{ +public: + typedef _Tp value_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template struct rebind { + typedef allocator<_Tp1> other; + }; +#endif + allocator() _STLP_NOTHROW {} +#if defined (_STLP_MEMBER_TEMPLATES) + template allocator(const allocator<_Tp1>&) _STLP_NOTHROW {} +#endif + allocator(const allocator<_Tp>&) _STLP_NOTHROW {} +#if !defined (_STLP_NO_MOVE_SEMANTIC) + allocator(__move_source > src) _STLP_NOTHROW { _STLP_MARK_PARAMETER_AS_UNUSED(&src); } +#endif + ~allocator() _STLP_NOTHROW {} + pointer address(reference __x) const {return &__x;} + const_pointer address(const_reference __x) const { return &__x; } + // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0. + _Tp* allocate(size_type __n, const void* = 0) { + if (__n > max_size()) { + _STLP_THROW_BAD_ALLOC; + } + if (__n != 0) { + size_type __buf_size = __n * sizeof(value_type); + _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size)); +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); +#endif + return __ret; + } + + return 0; + } + // __p is permitted to be a null pointer, only if n==0. + void deallocate(pointer __p, size_type __n) { + _STLP_ASSERT( (__p == 0) == (__n == 0) ) + if (__p != 0) { +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type)); +#endif + __sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type)); + } + } +#if !defined (_STLP_NO_ANACHRONISMS) + // backwards compatibility + void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); } +#endif + size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); } + void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); } + void destroy(pointer __p) { _STLP_STD::_Destroy(__p); } + +#if defined (_STLP_NO_EXTENSIONS) + /* STLport extension giving rounded size of an allocated memory buffer + * This method do not have to be part of a user defined allocator implementation + * and won't even be called if such a function was granted. + */ +protected: +#endif + _Tp* _M_allocate(size_type __n, size_type& __allocated_n) { + if (__n > max_size()) { + _STLP_THROW_BAD_ALLOC; + } + + if (__n != 0) { + size_type __buf_size = __n * sizeof(value_type); + _Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size)); +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); +#endif + __allocated_n = __buf_size / sizeof(value_type); + return __ret; + } + + return 0; + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(allocator<_Tp>& __other) {} +#endif +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC allocator { +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + typedef void value_type; +#endif +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template struct rebind { + typedef allocator<_Tp1> other; + }; +#endif +}; + +template +inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW +{ return true; } +template +inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW +{ return false; } + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS allocator; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS allocator; +# endif +# if defined (_STLP_USE_PTR_SPECIALIZATIONS) +_STLP_EXPORT_TEMPLATE_CLASS allocator; +# endif +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct __alloc_type_traits { +#if !defined (__BORLANDC__) + typedef typename _IsSTLportClass >::_Ret _STLportAlloc; +#else + enum { _Is = _IsSTLportClass >::_Is }; + typedef typename __bool2type<_Is>::_Ret _STLportAlloc; +#endif + //The default allocator implementation which is recognize thanks to the + //__stlport_class inheritance is a stateless object so: + typedef _STLportAlloc has_trivial_default_constructor; + typedef _STLportAlloc has_trivial_copy_constructor; + typedef _STLportAlloc has_trivial_assignment_operator; + typedef _STLportAlloc has_trivial_destructor; + typedef _STLportAlloc is_POD_type; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __type_traits > : _STLP_PRIV __alloc_type_traits<_Tp> {}; +#else +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __alloc_type_traits {}; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __alloc_type_traits {}; +# endif +# if defined (_STLP_USE_PTR_SPECIALIZATIONS) +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __alloc_type_traits {}; +# endif +#endif + + +#if !defined (_STLP_FORCE_ALLOCATORS) +# define _STLP_FORCE_ALLOCATORS(a,y) +#endif + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES) +// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes +template +struct _Alloc_traits<_Tp, allocator<_Tp1> > { + typedef allocator<_Tp1> _Orig; + typedef allocator<_Tp> allocator_type; + static allocator_type create_allocator(const allocator<_Tp1 >& __a) + { return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); } +}; +#endif + +#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES) +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL +__stl_alloc_create(const _Alloc& __a, const _Tp*) { + typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type; + return _Rebound_type(__a); +} +#else +// If custom allocators are being used without member template classes support : +// user (on purpose) is forced to define rebind/get operations !!! +template +inline allocator<_Tp2>& _STLP_CALL +__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); } +template +inline allocator<_Tp2> _STLP_CALL +__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); } +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// inheritance is being used for EBO optimization +template +class _STLP_alloc_proxy : public _MaybeReboundAlloc { +private: + typedef _MaybeReboundAlloc _Base; + typedef typename _Base::size_type size_type; + typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self; +public: + _Value _M_data; + + _STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) : + _MaybeReboundAlloc(__a), _M_data(__p) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _STLP_alloc_proxy (__move_source<_Self> src) : + _Base(_STLP_PRIV _AsMoveSource(src.get()._M_base())), + _M_data(_STLP_PRIV _AsMoveSource(src.get()._M_data)) {} + + _Base& _M_base() + { return *this; } +#endif + +private: + /* Following are helper methods to detect stateless allocators and avoid + * swap in this case. For some compilers (VC6) it is a workaround for a + * compiler bug in the Empty Base class Optimization feature, for others + * it is a small optimization or nothing if no EBO. */ + void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/) + {} + + void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) { + _MaybeReboundAlloc &__base_this = *this; + _MaybeReboundAlloc &__base_x = __x; + _STLP_STD::swap(__base_this, __base_x); + } + +public: + void _M_swap_alloc(_Self& __x) { +#if !defined (__BORLANDC__) + typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc; +#else + typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc; +#endif + _M_swap_alloc(__x, _StatelessAlloc()); + } + + /* We need to define the following swap implementation for allocator with state + * as those allocators might have implement a special swap function to correctly + * move datas from an instance to the oher, _STLP_alloc_proxy should not break + * this mecanism. */ + void swap(_Self& __x) { + _M_swap_alloc(__x); + _STLP_STD::swap(_M_data, __x._M_data); + } + + _Tp* allocate(size_type __n, size_type& __allocated_n) { +#if !defined (__BORLANDC__) + typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc; +#else + typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc; +#endif + return allocate(__n, __allocated_n, _STLportAlloc()); + } + + // Unified interface to perform allocate()/deallocate() with limited + // language support +#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) + // else it is rebound already, and allocate() member is accessible + _Tp* allocate(size_type __n) + { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); } + void deallocate(_Tp* __p, size_type __n) + { __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); } +private: + _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/) + { return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0))._M_allocate(__n, __allocated_n); } +#else + //Expose Standard allocate overload (using expression do not work for some compilers (Borland)) + _Tp* allocate(size_type __n) + { return _Base::allocate(__n); } +private: + _Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/) + { return _Base::_M_allocate(__n, __allocated_n); } +#endif + + _Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/) + { __allocated_n = __n; return allocate(__n); } +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; +# endif +# if defined (_STLP_USE_PTR_SPECIALIZATIONS) +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; +# endif +#endif + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_ALLOC_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_auto_ptr.h b/sdk/tlibstdcxx/stlport/stl/_auto_ptr.h new file mode 100644 index 0000000000..c750534a01 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_auto_ptr.h @@ -0,0 +1,133 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_AUTO_PTR_H +#define _STLP_AUTO_PTR_H + +_STLP_BEGIN_NAMESPACE +// implementation primitive +class __ptr_base { +public: + void* _M_p; + void __set(const volatile void* p) { _M_p = __CONST_CAST(void*,p); } + void __set(void* p) { _M_p = p; } +}; + +template +class auto_ptr_ref { +public: + __ptr_base& _M_r; + _Tp* const _M_p; + + auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { } + + _Tp* release() const { _M_r.__set(__STATIC_CAST(void*, 0)); return _M_p; } + +private: + //explicitely defined as private to avoid warnings: + typedef auto_ptr_ref<_Tp> _Self; + _Self& operator = (_Self const&); +}; + +template +class auto_ptr : public __ptr_base { +public: + typedef _Tp element_type; + typedef auto_ptr<_Tp> _Self; + + _Tp* release() _STLP_NOTHROW { + _Tp* __px = this->get(); + this->_M_p = 0; + return __px; + } + + void reset(_Tp* __px = 0) _STLP_NOTHROW { + _Tp* __pt = this->get(); + if (__px != __pt) + delete __pt; + this->__set(__px); + } + + _Tp* get() const _STLP_NOTHROW +#if !defined (__GNUC__) || (__GNUC__ > 2) + { return __STATIC_CAST(_Tp*, _M_p); } +#else + { return __REINTERPRET_CAST(_Tp*, _M_p); } +#endif + +#if !defined (_STLP_NO_ARROW_OPERATOR) + _Tp* operator->() const _STLP_NOTHROW { + _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL) + return get(); + } +#endif + _Tp& operator*() const _STLP_NOTHROW { + _STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL) + return *get(); + } + + explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS) + template auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW { + _Tp* __conversionCheck = __r.release(); + this->__set(__conversionCheck); + } +# endif + template auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW { + _Tp* __conversionCheck = __r.release(); + reset(__conversionCheck); + return *this; + } +#endif + + auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); } + + _Self& operator=(_Self& __r) _STLP_NOTHROW { + reset(__r.release()); + return *this; + } + + ~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); } + + auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW + { this->__set(__r.release()); } + + _Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW { + reset(__r.release()); + return *this; + } + +#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS) + template operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW + { return auto_ptr_ref<_Tp1>(*this, this->get()); } + template operator auto_ptr<_Tp1>() _STLP_NOTHROW + { return auto_ptr<_Tp1>(release()); } +#else + operator auto_ptr_ref<_Tp>() _STLP_NOTHROW + { return auto_ptr_ref<_Tp>(*this, this->get()); } +#endif +}; +_STLP_END_NAMESPACE + +#endif /* _STLP_AUTO_PTR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_bitset.c b/sdk/tlibstdcxx/stlport/stl/_bitset.c new file mode 100644 index 0000000000..82b9312d9a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_bitset.c @@ -0,0 +1,235 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_BITSET_C +#define _STLP_BITSET_C + +#ifndef _STLP_BITSET_H +# include +#endif + +#define __BITS_PER_WORD (CHAR_BIT * sizeof(unsigned long)) + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE +// +// Definitions of non-inline functions from _Base_bitset. +// +template +void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) { + if (__shift != 0) { + const size_t __wshift = __shift / __BITS_PER_WORD; + const size_t __offset = __shift % __BITS_PER_WORD; + + if (__offset == 0) + for (size_t __n = _Nw - 1; __n >= __wshift; --__n) + _M_w[__n] = _M_w[__n - __wshift]; + + else { + const size_t __sub_offset = __BITS_PER_WORD - __offset; + for (size_t __n = _Nw - 1; __n > __wshift; --__n) + _M_w[__n] = (_M_w[__n - __wshift] << __offset) | + (_M_w[__n - __wshift - 1] >> __sub_offset); + _M_w[__wshift] = _M_w[0] << __offset; + } + + fill(_M_w + 0, _M_w + __wshift, __STATIC_CAST(_WordT,0)); + } +} + +template +void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) { + if (__shift != 0) { + const size_t __wshift = __shift / __BITS_PER_WORD; + const size_t __offset = __shift % __BITS_PER_WORD; + const size_t __limit = _Nw - __wshift - 1; + + if (__offset == 0) + for (size_t __n = 0; __n <= __limit; ++__n) + _M_w[__n] = _M_w[__n + __wshift]; + + else { + const size_t __sub_offset = __BITS_PER_WORD - __offset; + for (size_t __n = 0; __n < __limit; ++__n) + _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | + (_M_w[__n + __wshift + 1] << __sub_offset); + _M_w[__limit] = _M_w[_Nw-1] >> __offset; + } + + fill(_M_w + __limit + 1, _M_w + _Nw, __STATIC_CAST(_WordT,0)); + } +} + +template +unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const { + for (size_t __i = 1; __i < _Nw; ++__i) + if (_M_w[__i]) + __stl_throw_overflow_error("bitset"); + return _M_w[0]; +} // End _M_do_to_ulong + +template +size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _WordT __thisword = _M_w[__i]; + if ( __thisword != __STATIC_CAST(_WordT,0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); + if ( __this_byte ) + return __i*__BITS_PER_WORD + __j*CHAR_BIT + + _Bs_G::_S_first_one(__this_byte); + + __thisword >>= CHAR_BIT; + } + } + } + // not found, so return an indication of failure. + return __not_found; +} + +template +size_t +_Base_bitset<_Nw>::_M_do_find_next(size_t __prev, + size_t __not_found) const { + // make bound inclusive + ++__prev; + + // check out of bounds + if ( __prev >= _Nw * __BITS_PER_WORD ) + return __not_found; + + // search first word + size_t __i = _S_whichword(__prev); + _WordT __thisword = _M_w[__i]; + + // mask off bits below bound + __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev); + + if ( __thisword != __STATIC_CAST(_WordT,0) ) { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); ++__j ) { + unsigned char __this_byte + = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); + if ( __this_byte ) + return __i*__BITS_PER_WORD + __j*CHAR_BIT + + _Bs_G::_S_first_one(__this_byte); + + __thisword >>= CHAR_BIT; + } + } + + // check subsequent words + ++__i; + for ( ; __i < _Nw; ++__i ) { + /* _WordT */ __thisword = _M_w[__i]; + if ( __thisword != __STATIC_CAST(_WordT,0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); ++__j ) { + unsigned char __this_byte + = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); + if ( __this_byte ) + return __i*__BITS_PER_WORD + __j*CHAR_BIT + + _Bs_G::_S_first_one(__this_byte); + + __thisword >>= CHAR_BIT; + } + } + } + + // not found, so return an indication of failure. + return __not_found; +} // end _M_do_find_next + +_STLP_MOVE_TO_STD_NAMESPACE + +#if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) + +# if !defined (_STLP_USE_NO_IOSTREAMS) + +_STLP_END_NAMESPACE + +#ifndef _STLP_STRING_IO_H +# include //includes _istream.h and _ostream.h +#endif + +_STLP_BEGIN_NAMESPACE + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { + basic_string<_CharT, _Traits> __tmp; + __tmp.reserve(_Nb); + + // Skip whitespace + typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + for (size_t __i = 0; __i < _Nb; ++__i) { + static typename _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) { + __is.setstate(ios_base::eofbit); + break; + } + else { + typename _Traits::char_type __c2 = _Traits::to_char_type(__c1); + char __c = __is.narrow(__c2, '*'); + + if (__c == '0' || __c == '1') + __tmp.push_back(__c); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { + __is.setstate(ios_base::failbit); + break; + } + } + } + + if (__tmp.empty()) + __is.setstate(ios_base::failbit); + else + __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb); + } + + return __is; +} + +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, + const bitset<_Nb>& __x) { + basic_string<_CharT, _Traits> __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; +} + +# endif /* !_STLP_USE_NO_IOSTREAMS */ + +#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ + +_STLP_END_NAMESPACE + +#undef __BITS_PER_WORD +#undef bitset + +#endif /* _STLP_BITSET_C */ diff --git a/sdk/tlibstdcxx/stlport/stl/_bitset.h b/sdk/tlibstdcxx/stlport/stl/_bitset.h new file mode 100644 index 0000000000..ee8e0472b0 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_bitset.h @@ -0,0 +1,928 @@ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_BITSET_H +#define _STLP_BITSET_H + +// A bitset of size N has N % (sizeof(unsigned long) * CHAR_BIT) unused +// bits. (They are the high- order bits in the highest word.) It is +// a class invariant of class bitset<> that those unused bits are +// always zero. + +// Most of the actual code isn't contained in bitset<> itself, but in the +// base class _Base_bitset. The base class works with whole words, not with +// individual bits. This allows us to specialize _Base_bitset for the +// important special case where the bitset is only a single word. + +// The C++ standard does not define the precise semantics of operator[]. +// In this implementation the const version of operator[] is equivalent +// to test(), except that it does no range checking. The non-const version +// returns a reference to a bit, again without doing any range checking. + + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_UNINITIALIZED_H +# include +#endif + +#ifndef _STLP_RANGE_ERRORS_H +# include +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +#define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long)) +#define __BITSET_WORDS(__n) ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD) + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// structure to aid in counting bits +class _STLP_CLASS_DECLSPEC _Bs_G +{ + public: + //returns the number of bit set within the buffer between __beg and __end. + static size_t _S_count(const unsigned char *__beg, const unsigned char *__end) +#if defined (_STLP_USE_NO_IOSTREAMS) + { + size_t __result = 0; + for (; __beg != __end; ++__beg) { + for (size_t i = 0; i < (sizeof(unsigned char) * 8); ++i) { + if ((*__beg & (1 << i)) != 0) { ++__result; } + } + } + return __result; + } +#else + ; +#endif + // Mapping from 8 bit unsigned integers to the index of the first one bit set: + static unsigned char _S_first_one(unsigned char __x) +#if defined (_STLP_USE_NO_IOSTREAMS) + { + for (unsigned char i = 0; i < (sizeof(unsigned char) * 8); ++i) { + if ((__x & (1 << i)) != 0) { return i; } + } + return 0; + } +#else + ; +#endif +}; + +// +// Base class: general case. +// + +template +struct _Base_bitset { + typedef unsigned long _WordT; + + _WordT _M_w[_Nw]; // 0 is the least significant word. + + _Base_bitset() { _M_do_reset(); } + + _Base_bitset(unsigned long __val) { + _M_do_reset(); + _M_w[0] = __val; + } + + static size_t _STLP_CALL _S_whichword( size_t __pos ) { + return __pos / __BITS_PER_WORD; + } + static size_t _STLP_CALL _S_whichbyte( size_t __pos ) { + return (__pos % __BITS_PER_WORD) / CHAR_BIT; + } + static size_t _STLP_CALL _S_whichbit( size_t __pos ) { + return __pos % __BITS_PER_WORD; + } + static _WordT _STLP_CALL _S_maskbit( size_t __pos ) { + return __STATIC_CAST(_WordT,1) << _S_whichbit(__pos); + } + + _WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; } + _WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; } + + _WordT& _M_hiword() { return _M_w[_Nw - 1]; } + _WordT _M_hiword() const { return _M_w[_Nw - 1]; } + + void _M_do_and(const _Base_bitset<_Nw>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] &= __x._M_w[__i]; + } + } + + void _M_do_or(const _Base_bitset<_Nw>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] |= __x._M_w[__i]; + } + } + + void _M_do_xor(const _Base_bitset<_Nw>& __x) { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] ^= __x._M_w[__i]; + } + } + + void _M_do_left_shift(size_t __shift); + + void _M_do_right_shift(size_t __shift); + + void _M_do_flip() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = ~_M_w[__i]; + } + } + + void _M_do_set() { + for ( size_t __i = 0; __i < _Nw; __i++ ) { + _M_w[__i] = ~__STATIC_CAST(_WordT,0); + } + } + + void _M_do_reset() { memset(_M_w, 0, _Nw * sizeof(_WordT)); } + + bool _M_is_equal(const _Base_bitset<_Nw>& __x) const { + for (size_t __i = 0; __i < _Nw; ++__i) { + if (_M_w[__i] != __x._M_w[__i]) + return false; + } + return true; + } + + bool _M_is_any() const { + for ( size_t __i = 0; __i < _Nw ; __i++ ) { + if ( _M_w[__i] != __STATIC_CAST(_WordT,0) ) + return true; + } + return false; + } + + size_t _M_do_count() const { + const unsigned char* __byte_ptr = (const unsigned char*)_M_w; + const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw); + + return _Bs_G::_S_count(__byte_ptr, __end_ptr); + } + + unsigned long _M_do_to_ulong() const; + + // find first "on" bit + size_t _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + size_t _M_do_find_next(size_t __prev, size_t __not_found) const; +}; + +// +// Base class: specialization for a single word. +// +_STLP_TEMPLATE_NULL +struct _Base_bitset<1UL> { + typedef unsigned long _WordT; + typedef _Base_bitset<1UL> _Self; + + _WordT _M_w; + + _Base_bitset( void ) : _M_w(0) {} + _Base_bitset(unsigned long __val) : _M_w(__val) {} + + static size_t _STLP_CALL _S_whichword( size_t __pos ) { + return __pos / __BITS_PER_WORD ; + } + static size_t _STLP_CALL _S_whichbyte( size_t __pos ) { + return (__pos % __BITS_PER_WORD) / CHAR_BIT; + } + static size_t _STLP_CALL _S_whichbit( size_t __pos ) { + return __pos % __BITS_PER_WORD; + } + static _WordT _STLP_CALL _S_maskbit( size_t __pos ) { + return (__STATIC_CAST(_WordT,1)) << _S_whichbit(__pos); + } + + _WordT& _M_getword(size_t) { return _M_w; } + _WordT _M_getword(size_t) const { return _M_w; } + + _WordT& _M_hiword() { return _M_w; } + _WordT _M_hiword() const { return _M_w; } + + void _M_do_and(const _Self& __x) { _M_w &= __x._M_w; } + void _M_do_or(const _Self& __x) { _M_w |= __x._M_w; } + void _M_do_xor(const _Self& __x) { _M_w ^= __x._M_w; } + void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; } + void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; } + void _M_do_flip() { _M_w = ~_M_w; } + void _M_do_set() { _M_w = ~__STATIC_CAST(_WordT,0); } + void _M_do_reset() { _M_w = 0; } + + bool _M_is_equal(const _Self& __x) const { + return _M_w == __x._M_w; + } + bool _M_is_any() const { + return _M_w != 0; + } + + size_t _M_do_count() const { + const unsigned char* __byte_ptr = (const unsigned char*)&_M_w; + const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w); + return _Bs_G::_S_count(__byte_ptr, __end_ptr); + } + + unsigned long _M_do_to_ulong() const { return _M_w; } + + inline size_t _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + inline size_t _M_do_find_next(size_t __prev, size_t __not_found) const; +}; + + +// ------------------------------------------------------------ +// +// Definitions of should-be-non-inline functions from the single-word version of +// _Base_bitset. +// +inline size_t +_Base_bitset<1UL>::_M_do_find_first(size_t __not_found) const { + // typedef unsigned long _WordT; + _WordT __thisword = _M_w; + + if ( __thisword != __STATIC_CAST(_WordT,0) ) { + // find byte within word + for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); + if ( __this_byte ) + return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte); + + __thisword >>= CHAR_BIT; + } + } + // not found, so return a value that indicates failure. + return __not_found; +} + +inline size_t +_Base_bitset<1UL>::_M_do_find_next(size_t __prev, + size_t __not_found ) const { + // make bound inclusive + ++__prev; + + // check out of bounds + if ( __prev >= __BITS_PER_WORD ) + return __not_found; + + // search first (and only) word + _WordT __thisword = _M_w; + + // mask off bits below bound + __thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev); + + if ( __thisword != __STATIC_CAST(_WordT,0) ) { + // find byte within word + // get first byte into place + __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; + for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { + unsigned char __this_byte + = __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0))); + if ( __this_byte ) + return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte); + + __thisword >>= CHAR_BIT; + } + } + + // not found, so return a value that indicates failure. + return __not_found; +} // end _M_do_find_next + +// +// Base class, specialization for no storage (zero-length %bitset). +// +_STLP_TEMPLATE_NULL +struct _Base_bitset<0UL> { + typedef unsigned long _WordT; + typedef _Base_bitset<0UL> _Self; + + _Base_bitset(void) {} + _Base_bitset(unsigned long) {} + + static size_t _STLP_CALL _S_whichword(size_t __pos) { + return __pos / __BITS_PER_WORD; + } + static size_t _STLP_CALL _S_whichbyte(size_t __pos) { + return (__pos % __BITS_PER_WORD) / CHAR_BIT; + } + static size_t _STLP_CALL _S_whichbit(size_t __pos) { + return __pos % __BITS_PER_WORD; + } + static _WordT _STLP_CALL _S_maskbit(size_t __pos) { + return (__STATIC_CAST(_WordT,1)) << _S_whichbit(__pos); + } + + _WordT& _M_getword(size_t) { + __stl_throw_out_of_range("_Base_bitset::_M_getword"); + return *new _WordT; + } + _WordT _M_getword(size_t) const { return 0; } + _WordT _M_hiword() const { return 0; } + + void _M_do_and(const _Self&) {} + void _M_do_or(const _Self&) {} + void _M_do_xor(const _Self&) {} + void _M_do_left_shift(size_t) {} + void _M_do_right_shift(size_t) {} + void _M_do_flip() {} + void _M_do_set() {} + void _M_do_reset() {} + + bool _M_is_equal(const _Self&) const { return true; } + bool _M_is_any() const { return false; } + + size_t _M_do_count() const { return 0; } + unsigned long _M_do_to_ulong() const { return 0; } + size_t _M_do_find_first(size_t) const { return 0; } + size_t _M_do_find_next(size_t, size_t) const { return 0; } +}; + +// ------------------------------------------------------------ +// Helper class to zero out the unused high-order bits in the highest word. + +template struct _Sanitize { + static void _STLP_CALL _M_do_sanitize(unsigned long& __val) + { __val &= ~((~__STATIC_CAST(unsigned long,0)) << _Extrabits); } +}; + +_STLP_TEMPLATE_NULL struct _Sanitize<0UL> { + static void _STLP_CALL _M_do_sanitize(unsigned long) {} +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +// ------------------------------------------------------------ +// Class bitset. +// _Nb may be any nonzero number of type size_t. +template +class bitset : public _STLP_PRIV _Base_bitset<__BITSET_WORDS(_Nb) > { +public: + enum { _Words = __BITSET_WORDS(_Nb) } ; + +private: + typedef _STLP_PRIV _Base_bitset< _Words > _Base; + + void _M_do_sanitize() { + _STLP_PRIV _Sanitize<_Nb%__BITS_PER_WORD >::_M_do_sanitize(this->_M_hiword()); + } +public: + typedef unsigned long _WordT; + struct reference; + friend struct reference; + + // bit reference: + struct reference { + typedef _STLP_PRIV _Base_bitset<_Words > _Bitset_base; + typedef bitset<_Nb> _Bitset; + // friend _Bitset; + _WordT *_M_wp; + size_t _M_bpos; + + // should be left undefined + reference() {} + + reference( _Bitset& __b, size_t __pos ) { + _M_wp = &__b._M_getword(__pos); + _M_bpos = _Bitset_base::_S_whichbit(__pos); + } + + public: + ~reference() {} + + // for b[i] = __x; + reference& operator=(bool __x) { + if ( __x ) + *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos); + + return *this; + } + + // for b[i] = b[__j]; + reference& operator=(const reference& __j) { + if ( (*(__j._M_wp) & _Bitset_base::_S_maskbit(__j._M_bpos)) ) + *_M_wp |= _Bitset_base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos); + + return *this; + } + + // flips the bit + bool operator~() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) == 0; } + + // for __x = b[i]; + operator bool() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) != 0; } + + // for b[i].flip(); + reference& flip() { + *_M_wp ^= _Bitset_base::_S_maskbit(_M_bpos); + return *this; + } + }; + + // 23.3.5.1 constructors: + bitset() {} + + bitset(unsigned long __val) : _STLP_PRIV _Base_bitset<_Words>(__val) { _M_do_sanitize(); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t __pos = 0) + : _STLP_PRIV _Base_bitset<_Words >() { + if (__pos > __s.size()) + __stl_throw_out_of_range("bitset"); + _M_copy_from_string(__s, __pos, + basic_string<_CharT, _Traits, _Alloc>::npos); + } + template + bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __pos, + size_t __n) + : _STLP_PRIV _Base_bitset<_Words >() { + if (__pos > __s.size()) + __stl_throw_out_of_range("bitset"); + _M_copy_from_string(__s, __pos, __n); + } +#else /* _STLP_MEMBER_TEMPLATES */ + explicit bitset(const string& __s, + size_t __pos = 0, + size_t __n = (size_t)-1) + : _STLP_PRIV _Base_bitset<_Words >() { + if (__pos > __s.size()) + __stl_throw_out_of_range("bitset"); + _M_copy_from_string(__s, __pos, __n); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + // 23.3.5.2 bitset operations: + bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) { + this->_M_do_and(__rhs); + return *this; + } + + bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) { + this->_M_do_or(__rhs); + return *this; + } + + bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) { + this->_M_do_xor(__rhs); + return *this; + } + + bitset<_Nb>& operator<<=(size_t __pos) { + this->_M_do_left_shift(__pos); + this->_M_do_sanitize(); + return *this; + } + + bitset<_Nb>& operator>>=(size_t __pos) { + this->_M_do_right_shift(__pos); + this->_M_do_sanitize(); + return *this; + } + + // + // Extension: + // Versions of single-bit set, reset, flip, test with no range checking. + // + + bitset<_Nb>& _Unchecked_set(size_t __pos) { + this->_M_getword(__pos) |= _STLP_PRIV _Base_bitset<_Words > ::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) { + if (__val) + this->_M_getword(__pos) |= this->_S_maskbit(__pos); + else + this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos); + + return *this; + } + + bitset<_Nb>& _Unchecked_reset(size_t __pos) { + this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& _Unchecked_flip(size_t __pos) { + this->_M_getword(__pos) ^= this->_S_maskbit(__pos); + return *this; + } + + bool _Unchecked_test(size_t __pos) const { + return (this->_M_getword(__pos) & this->_S_maskbit(__pos)) != __STATIC_CAST(_WordT,0); + } + + // Set, reset, and flip. + + bitset<_Nb>& set() { + this->_M_do_set(); + this->_M_do_sanitize(); + return *this; + } + + bitset<_Nb>& set(size_t __pos) { + if (__pos >= _Nb) + __stl_throw_out_of_range("bitset"); + return _Unchecked_set(__pos); + } + + bitset<_Nb>& set(size_t __pos, int __val) { + if (__pos >= _Nb) + __stl_throw_out_of_range("bitset"); + return _Unchecked_set(__pos, __val); + } + + bitset<_Nb>& reset() { + this->_M_do_reset(); + return *this; + } + + bitset<_Nb>& reset(size_t __pos) { + if (__pos >= _Nb) + __stl_throw_out_of_range("bitset"); + + return _Unchecked_reset(__pos); + } + + bitset<_Nb>& flip() { + this->_M_do_flip(); + this->_M_do_sanitize(); + return *this; + } + + bitset<_Nb>& flip(size_t __pos) { + if (__pos >= _Nb) + __stl_throw_out_of_range("bitset"); + + return _Unchecked_flip(__pos); + } + + bitset<_Nb> operator~() const { + return bitset<_Nb>(*this).flip(); + } + + // element access: + //for b[i]; + reference operator[](size_t __pos) { return reference(*this,__pos); } + bool operator[](size_t __pos) const { return _Unchecked_test(__pos); } + + unsigned long to_ulong() const { return this->_M_do_to_ulong(); } + +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) + template + basic_string<_CharT, _Traits, _Alloc> to_string() const { + basic_string<_CharT, _Traits, _Alloc> __result; + _M_copy_to_string(__result); + return __result; + } +#else + string to_string() const { + string __result; + _M_copy_to_string(__result); + return __result; + } +#endif /* _STLP_EXPLICIT_FUNCTION_TMPL_ARGS */ + + size_t count() const { return this->_M_do_count(); } + + size_t size() const { return _Nb; } + + bool operator==(const bitset<_Nb>& __rhs) const { + return this->_M_is_equal(__rhs); + } + bool operator!=(const bitset<_Nb>& __rhs) const { + return !this->_M_is_equal(__rhs); + } + + bool test(size_t __pos) const { + if (__pos >= _Nb) + __stl_throw_out_of_range("bitset"); + + return _Unchecked_test(__pos); + } + + bool any() const { return this->_M_is_any(); } + bool none() const { return !this->_M_is_any(); } + + bitset<_Nb> operator<<(size_t __pos) const { + bitset<_Nb> __result(*this); + __result <<= __pos ; return __result; + } + bitset<_Nb> operator>>(size_t __pos) const { + bitset<_Nb> __result(*this); + __result >>= __pos ; return __result; + } + +#if !defined (_STLP_NO_EXTENSIONS) + // + // EXTENSIONS: bit-find operations. These operations are + // experimental, and are subject to change or removal in future + // versions. + // + + // find the index of the first "on" bit + size_t _Find_first() const + { return this->_M_do_find_first(_Nb); } + + // find the index of the next "on" bit after prev + size_t _Find_next( size_t __prev ) const + { return this->_M_do_find_next(__prev, _Nb); } +#endif + +// +// Definitions of should-be non-inline member functions. +// +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s, + size_t __pos, size_t __n) { +#else + void _M_copy_from_string(const string& __s, + size_t __pos, size_t __n) { + typedef typename string::traits_type _Traits; +#endif + reset(); + size_t __tmp = _Nb; + const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos)); + for ( size_t __i= 0; __i < __Nbits; ++__i) { + typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]); + // boris : widen() ? + if (__k == '1') + set(__i); + else if (__k != '0') + __stl_throw_invalid_argument("bitset"); + } + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const +#else + void _M_copy_to_string(string& __s) const +#endif + { + __s.assign(_Nb, '0'); + + for (size_t __i = 0; __i < _Nb; ++__i) { + if (_Unchecked_test(__i)) + __s[_Nb - 1 - __i] = '1'; + } + } + +#if !defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_WCHAR_T) + void _M_copy_to_string(wstring& __s) const { + __s.assign(_Nb, '0'); + + for (size_t __i = 0; __i < _Nb; ++__i) { + if (_Unchecked_test(__i)) + __s[_Nb - 1 - __i] = '1'; + } + } +#endif + +#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) + bitset<_Nb> operator&(const bitset<_Nb>& __y) const { + bitset<_Nb> __result(*this); + __result &= __y; + return __result; + } + bitset<_Nb> operator|(const bitset<_Nb>& __y) const { + bitset<_Nb> __result(*this); + __result |= __y; + return __result; + } + bitset<_Nb> operator^(const bitset<_Nb>& __y) const { + bitset<_Nb> __result(*this); + __result ^= __y; + return __result; + } +#endif +}; + +// ------------------------------------------------------------ +// +// 23.3.5.3 bitset operations: +// +#if ! defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) +template +inline bitset<_Nb> _STLP_CALL +operator&(const bitset<_Nb>& __x, + const bitset<_Nb>& __y) { + bitset<_Nb> __result(__x); + __result &= __y; + return __result; +} + + +template +inline bitset<_Nb> _STLP_CALL +operator|(const bitset<_Nb>& __x, + const bitset<_Nb>& __y) { + bitset<_Nb> __result(__x); + __result |= __y; + return __result; +} + +template +inline bitset<_Nb> _STLP_CALL +operator^(const bitset<_Nb>& __x, + const bitset<_Nb>& __y) { + bitset<_Nb> __result(__x); + __result ^= __y; + return __result; +} + +#if !defined (_STLP_USE_NO_IOSTREAMS) + +_STLP_END_NAMESPACE + +# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) && \ + !(defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x500)) + +#ifndef _STLP_INTERNAL_IOSFWD +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x); + +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x); + +# else + +#ifndef _STLP_STRING_IO_H +# include //includes _istream.h and _ostream.h +#endif + +_STLP_BEGIN_NAMESPACE + +template +istream& _STLP_CALL +operator>>(istream& __is, bitset<_Nb>& __x) { + typedef typename string::traits_type _Traits; + string __tmp; + __tmp.reserve(_Nb); + + // Skip whitespace + typename istream::sentry __sentry(__is); + if (__sentry) { + streambuf* __buf = __is.rdbuf(); + for (size_t __i = 0; __i < _Nb; ++__i) { + static typename _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) { + __is.setstate(ios_base::eofbit); + break; + } + else { + typename _Traits::char_type __c2 = _Traits::to_char_type(__c1); + char __c = __is.narrow(__c2, '*'); + + if (__c == '0' || __c == '1') + __tmp.push_back(__c); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { + __is.setstate(ios_base::failbit); + break; + } + } + } + + if (__tmp.empty()) + __is.setstate(ios_base::failbit); + else + __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb); + } + + return __is; +} + +template +ostream& _STLP_CALL +operator<<(ostream& __os, const bitset<_Nb>& __x) { + string __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; +} + +# if !defined (_STLP_NO_WCHAR_T) + +template +wistream& _STLP_CALL +operator>>(wistream& __is, bitset<_Nb>& __x) { + typedef typename wstring::traits_type _Traits; + wstring __tmp; + __tmp.reserve(_Nb); + + // Skip whitespace + typename wistream::sentry __sentry(__is); + if (__sentry) { + wstreambuf* __buf = __is.rdbuf(); + for (size_t __i = 0; __i < _Nb; ++__i) { + static typename _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) { + __is.setstate(ios_base::eofbit); + break; + } + else { + typename _Traits::char_type __c2 = _Traits::to_char_type(__c1); + char __c = __is.narrow(__c2, '*'); + + if (__c == '0' || __c == '1') + __tmp.push_back(__c); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { + __is.setstate(ios_base::failbit); + break; + } + } + } + + if (__tmp.empty()) + __is.setstate(ios_base::failbit); + else + __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb); + } + + return __is; +} + +template +wostream& _STLP_CALL +operator<<(wostream& __os, const bitset<_Nb>& __x) { + wstring __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; +} + +# endif /* _STLP_NO_WCHAR_T */ +# endif +#endif + +#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ + +#undef bitset + +_STLP_END_NAMESPACE + +#undef __BITS_PER_WORD +#undef __BITSET_WORDS + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_BITSET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_bvector.h b/sdk/tlibstdcxx/stlport/stl/_bvector.h new file mode 100644 index 0000000000..bf417f179c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_bvector.h @@ -0,0 +1,841 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_BVECTOR_H +#define _STLP_INTERNAL_BVECTOR_H + +#ifndef _STLP_INTERNAL_VECTOR_H +# include +#endif + +#define _STLP_WORD_BIT (int(CHAR_BIT * sizeof(unsigned int))) + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +struct _Bit_reference { + unsigned int* _M_p; + unsigned int _M_mask; + _Bit_reference(unsigned int* __x, unsigned int __y) + : _M_p(__x), _M_mask(__y) {} + +public: + _Bit_reference() : _M_p(0), _M_mask(0) {} + + operator bool() const { + return !(!(*_M_p & _M_mask)); + } + _Bit_reference& operator = (bool __x) { + if (__x) *_M_p |= _M_mask; + else *_M_p &= ~_M_mask; + return *this; + } + _Bit_reference& operator = (const _Bit_reference& __x) { + return *this = bool(__x); + } + bool operator == (const _Bit_reference& __x) const { + return bool(*this) == bool(__x); + } + bool operator < (const _Bit_reference& __x) const { + return !bool(*this) && bool(__x); + } + + _Bit_reference& operator |= (bool __x) { + if (__x) + *_M_p |= _M_mask; + return *this; + } + _Bit_reference& operator &= (bool __x) { + if (!__x) + *_M_p &= ~_M_mask; + return *this; + } + void flip() { *_M_p ^= _M_mask; } +}; + + +_STLP_MOVE_TO_STD_NAMESPACE + +inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) { + bool __tmp = (bool)__x; + __x = __y; + __y = __tmp; +} + +// Might not be very useful but costs nothing! +_STLP_TEMPLATE_NULL +struct __type_traits<_STLP_PRIV _Bit_reference> { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __false_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +struct _Bit_iterator_base { + typedef ptrdiff_t difference_type; + + unsigned int* _M_p; + unsigned int _M_offset; + + void _M_bump_up() { + if (_M_offset++ == _STLP_WORD_BIT - 1) { + _M_offset = 0; + ++_M_p; + } + } + + void _M_bump_down() { + if (_M_offset-- == 0) { + _M_offset = _STLP_WORD_BIT - 1; + --_M_p; + } + } + + _Bit_iterator_base() : _M_p(0), _M_offset(0) {} + _Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {} +// see comment in doc/README.evc4 and doc/README.evc8 +#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG) + _Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {} +#endif + // _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; } + + void _M_advance (difference_type __i) { + difference_type __n = __i + _M_offset; + _M_p += __n / _STLP_WORD_BIT; + __n = __n % _STLP_WORD_BIT; + if (__n < 0) { + _M_offset = (unsigned int) __n + _STLP_WORD_BIT; + --_M_p; + } else + _M_offset = (unsigned int) __n; + } + + difference_type _M_subtract(const _Bit_iterator_base& __x) const { + return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset; + } +}; + +inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset; +} +inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset; +} + +inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset); +} + +inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return operator <(__y , __x); +} +inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return !(__y < __x); +} +inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) { + return !(__x < __y); +} + +template +struct _Bit_iter : public _Bit_iterator_base { + typedef _Ref reference; + typedef _Ptr pointer; + typedef _Bit_iter<_Ref, _Ptr> _Self; + typedef random_access_iterator_tag iterator_category; + typedef bool value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + + _Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {} + _Bit_iter() {} + + _Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x): + _Bit_iterator_base((const _Bit_iterator_base&)__x) {} + + // _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x) + // { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; } + + reference operator*() const { + return _Bit_reference(_M_p, 1UL << _M_offset); + } + _Self& operator++() { + _M_bump_up(); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + _M_bump_up(); + return __tmp; + } + _Self& operator--() { + _M_bump_down(); + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + _M_bump_down(); + return __tmp; + } + _Self& operator+=(difference_type __i) { + _M_advance(__i); + return *this; + } + _Self& operator-=(difference_type __i) { + *this += -__i; + return *this; + } + _Self operator+(difference_type __i) const { + _Self __tmp = *this; + return __tmp += __i; + } + _Self operator-(difference_type __i) const { + _Self __tmp = *this; + return __tmp -= __i; + } + difference_type operator-(const _Self& __x) const { + return _M_subtract(__x); + } + reference operator[](difference_type __i) { return *(*this + __i); } +}; + +template +inline _Bit_iter<_Ref,_Ptr> _STLP_CALL +operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) { + return __x + __n; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&) +{ return random_access_iterator_tag(); } +inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&) +{ return (ptrdiff_t*)0; } +inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&) +{ return (bool*)0; } +inline bool* value_type(const _STLP_PRIV _Bit_iter&) +{ return (bool*)0; } +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +typedef _Bit_iter _Bit_const_iterator; +typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator; + +// Bit-vector base class, which encapsulates the difference between +// old SGI-style allocators and standard-conforming allocators. +template +class _Bvector_base { + typedef _Bvector_base<_Alloc> _Self; +public: + _STLP_FORCE_ALLOCATORS(bool, _Alloc) + typedef _Alloc allocator_type; + typedef unsigned int __chunk_type; + typedef typename _Alloc_traits<__chunk_type, _Alloc>::allocator_type __chunk_allocator_type; + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR(__STATIC_CAST(const __chunk_allocator_type&, _M_end_of_storage), bool); } + + _Bvector_base(const allocator_type& __a) + : _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type), + (__chunk_type*)0) + {} +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Bvector_base(__move_source<_Self> src) + : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), + _M_end_of_storage(src.get()._M_end_of_storage) { + //Make the source destroyable + src.get()._M_start._M_p = 0; + } +#endif + + ~_Bvector_base() { + _M_deallocate(); + } + +protected: + + static size_t _M_bits_to_chunks(size_t __n_bits) + { return (__n_bits + _STLP_WORD_BIT - 1) / _STLP_WORD_BIT; } + + __chunk_type* _M_bit_alloc(size_t __n) + { return _M_end_of_storage.allocate(_M_bits_to_chunks(__n)); } + + void _M_deallocate() { + if (_M_start._M_p) + _M_end_of_storage.deallocate(_M_start._M_p, + _M_end_of_storage._M_data - _M_start._M_p); + } + + _Bit_iterator _M_start; + _Bit_iterator _M_finish; + _STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage; +}; + + +// The next few lines are confusing. What we're doing is declaring a +// partial specialization of vector if we have the necessary +// compiler support. Otherwise, we define a class bit_vector which uses +// the default allocator. + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC) +# define _STLP_VECBOOL_TEMPLATE +# define __BVEC_TMPL_HEADER template +#else +# undef _STLP_VECBOOL_TEMPLATE +# ifdef _STLP_NO_BOOL +# define __BVEC_TMPL_HEADER +# else +# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL +# endif +# define _Alloc allocator +#endif + +#if defined (_STLP_DEBUG) +# define vector _STLP_NON_DBG_NAME(vector) +#endif + +#ifdef _STLP_NO_BOOL +# define __BVECTOR_QUALIFIED bit_vector +# define __BVECTOR bit_vector +#else +# ifdef _STLP_VECBOOL_TEMPLATE +# define __BVECTOR_QUALIFIED vector +# else +# define __BVECTOR_QUALIFIED vector > +# endif +# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS) +# define __BVECTOR __BVECTOR_QUALIFIED +# else +# define __BVECTOR vector +# endif +#endif + +#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +__BVEC_TMPL_HEADER +class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc > +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG) + , public __stlport_class< __BVECTOR_QUALIFIED > +#endif +{ + typedef _STLP_PRIV _Bvector_base<_Alloc > _Base; + typedef __BVECTOR_QUALIFIED _Self; +public: + typedef bool value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _STLP_PRIV _Bit_reference reference; + typedef bool const_reference; + typedef _STLP_PRIV _Bit_reference* pointer; + typedef const bool* const_pointer; + typedef random_access_iterator_tag _Iterator_category; + + typedef _STLP_PRIV _Bit_iterator iterator; + typedef _STLP_PRIV _Bit_const_iterator const_iterator; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +#ifdef _STLP_VECBOOL_TEMPLATE + typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type; + typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type; +#else + typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type; + typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type; +#endif + +protected: + + void _M_initialize(size_type __n) { + __chunk_type* __q = this->_M_bit_alloc(__n); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n); + this->_M_start = iterator(__q, 0); + this->_M_finish = this->_M_start + difference_type(__n); + } + void _M_insert_aux(iterator __position, bool __x) { + if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) { + _STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1, + random_access_iterator_tag(), (difference_type*)0 ); + *__position = __x; + ++this->_M_finish; + } + else { + size_type __len = size() ? 2 * size() : _STLP_WORD_BIT; + __chunk_type* __q = this->_M_bit_alloc(__len); + iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0)); + *__i++ = __x; + this->_M_finish = _STLP_STD::copy(__position, end(), __i); + this->_M_deallocate(); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len); + this->_M_start = iterator(__q, 0); + } + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_initialize_range(_InputIterator __first, _InputIterator __last, + const input_iterator_tag &) { + this->_M_start = iterator(); + this->_M_finish = iterator(); + this->_M_end_of_storage._M_data = 0; + for ( ; __first != __last; ++__first) + push_back(*__first); + } + + template + void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { + size_type __n = _STLP_STD::distance(__first, __last); + _M_initialize(__n); + _STLP_STD::copy(__first, __last, this->_M_start); + } + + template + void _M_insert_range(iterator __pos, + _InputIterator __first, _InputIterator __last, + const input_iterator_tag &) { + for ( ; __first != __last; ++__first) { + __pos = insert(__pos, *__first); + ++__pos; + } + } + + template + void _M_insert_range(iterator __position, + _ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { + if (__first != __last) { + size_type __n = _STLP_STD::distance(__first, __last); + if (capacity() - size() >= __n) { + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n), + random_access_iterator_tag(), (difference_type*)0 ); + _STLP_STD::copy(__first, __last, __position); + this->_M_finish += difference_type(__n); + } + else { + size_type __len = size() + (max)(size(), __n); + __chunk_type* __q = this->_M_bit_alloc(__len); + iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0)); + __i = _STLP_STD::copy(__first, __last, __i); + this->_M_finish = _STLP_STD::copy(__position, end(), __i); + this->_M_deallocate(); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len); + this->_M_start = iterator(__q, 0); + } + } + } + +#endif /* _STLP_MEMBER_TEMPLATES */ + +public: + iterator begin() { return this->_M_start; } + const_iterator begin() const { return this->_M_start; } + iterator end() { return this->_M_finish; } + const_iterator end() const { return this->_M_finish; } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + size_type size() const { return size_type(end() - begin()); } + size_type max_size() const { return size_type(-1); } + size_type capacity() const { + return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin()); + } + bool empty() const { return begin() == end(); } + reference operator[](size_type __n) + { return *(begin() + difference_type(__n)); } + const_reference operator[](size_type __n) const + { return *(begin() + difference_type(__n)); } + + void _M_range_check(size_type __n) const { + if (__n >= this->size()) + __stl_throw_range_error("vector"); + } + + reference at(size_type __n) + { _M_range_check(__n); return (*this)[__n]; } + const_reference at(size_type __n) const + { _M_range_check(__n); return (*this)[__n]; } + + explicit __BVECTOR(const allocator_type& __a = allocator_type()) + : _STLP_PRIV _Bvector_base<_Alloc >(__a) {} + + __BVECTOR(size_type __n, bool __val, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _Bvector_base<_Alloc >(__a) { + _M_initialize(__n); + fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0); + } + + explicit __BVECTOR(size_type __n) + : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) { + _M_initialize(__n); + fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0); + } + + __BVECTOR(const _Self& __x) + : _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) { + _M_initialize(__x.size()); + _STLP_STD::copy(__x.begin(), __x.end(), this->_M_start); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) { + _M_initialize(__n); + fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0); + } + + template + void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); + } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + // Check whether it's an integral type. If so, it's not an iterator. + template + __BVECTOR(_InputIterator __first, _InputIterator __last) + : _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +# endif + template + __BVECTOR(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_PRIV _Bvector_base<_Alloc >(__a) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#else /* _STLP_MEMBER_TEMPLATES */ + __BVECTOR(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _Bvector_base<_Alloc >(__a) { + size_type __n = _STLP_STD::distance(__first, __last); + _M_initialize(__n); + _STLP_STD::copy(__first, __last, this->_M_start); + } + __BVECTOR(const bool* __first, const bool* __last, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _Bvector_base<_Alloc >(__a) { + size_type __n = _STLP_STD::distance(__first, __last); + _M_initialize(__n); + _STLP_STD::copy(__first, __last, this->_M_start); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + __BVECTOR(__move_source<_Self> src) + : _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {} +#endif + + ~__BVECTOR() {} + + __BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) { + if (&__x == this) return *this; + if (__x.size() > capacity()) { + this->_M_deallocate(); + _M_initialize(__x.size()); + } + _STLP_STD::copy(__x.begin(), __x.end(), begin()); + this->_M_finish = begin() + difference_type(__x.size()); + return *this; + } + + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void _M_fill_assign(size_t __n, bool __x) { + if (__n > size()) { + fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0); + insert(end(), __n - size(), __x); + } + else { + erase(begin() + __n, end()); + fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0); + } + } + void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + + template + void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&) + { _M_fill_assign((size_t) __n, (bool) __val); } + + template + void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&) + { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); } + + template + void _M_assign_aux(_InputIterator __first, _InputIterator __last, + const input_iterator_tag &) { + iterator __cur = begin(); + for ( ; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + erase(__cur, end()); + else + insert(end(), __first, __last); + } + + template + void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { + size_type __len = _STLP_STD::distance(__first, __last); + if (__len < size()) + erase(_STLP_STD::copy(__first, __last, begin()), end()); + else { + _ForwardIterator __mid = __first; + _STLP_STD::advance(__mid, size()); + _STLP_STD::copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + void reserve(size_type __n) { + if (capacity() < __n) { + if (max_size() < __n) + __stl_throw_length_error("vector"); + __chunk_type* __q = this->_M_bit_alloc(__n); + _STLP_PRIV _Bit_iterator __z(__q, 0); + this->_M_finish = _STLP_STD::copy(begin(), end(), __z); + this->_M_deallocate(); + this->_M_start = iterator(__q, 0); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n); + } + } + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(end() - 1); } + const_reference back() const { return *(end() - 1); } + void push_back(bool __x) { + if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) { + *(this->_M_finish) = __x; + ++this->_M_finish; + } + else + _M_insert_aux(end(), __x); + } + void swap(__BVECTOR_QUALIFIED& __x) { + _STLP_STD::swap(this->_M_start, __x._M_start); + _STLP_STD::swap(this->_M_finish, __x._M_finish); + this->_M_end_of_storage.swap(__x._M_end_of_storage); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(__BVECTOR_QUALIFIED& __x) { swap(__x); } +#endif + + iterator insert(iterator __position, bool __x = bool()) { + difference_type __n = __position - begin(); + if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) { + *(this->_M_finish) = __x; + ++this->_M_finish; + } + else + _M_insert_aux(__position, __x); + return begin() + __n; + } + +#if defined (_STLP_MEMBER_TEMPLATES) + + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + const __true_type&) { + _M_fill_insert(__pos, (size_type) __n, (bool) __x); + } + + template + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); + } + + // Check whether it's an integral type. If so, it's not an iterator. + template + void insert(iterator __position, + _InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } +#else /* _STLP_MEMBER_TEMPLATES */ + void insert(iterator __position, + const_iterator __first, const_iterator __last) { + if (__first == __last) return; + size_type __n = _STLP_STD::distance(__first, __last); + if (capacity() - size() >= __n) { + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n, + random_access_iterator_tag(), (difference_type*)0 ); + _STLP_STD::copy(__first, __last, __position); + this->_M_finish += __n; + } + else { + size_type __len = size() + (max)(size(), __n); + __chunk_type* __q = this->_M_bit_alloc(__len); + iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0)); + __i = _STLP_STD::copy(__first, __last, __i); + this->_M_finish = _STLP_STD::copy(__position, end(), __i); + this->_M_deallocate(); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len); + this->_M_start = iterator(__q, 0); + } + } + + void insert(iterator __position, const bool* __first, const bool* __last) { + if (__first == __last) return; + size_type __n = _STLP_STD::distance(__first, __last); + if (capacity() - size() >= __n) { + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n, + random_access_iterator_tag(), (difference_type*)0 ); + _STLP_STD::copy(__first, __last, __position); + this->_M_finish += __n; + } + else { + size_type __len = size() + (max)(size(), __n); + __chunk_type* __q = this->_M_bit_alloc(__len); + iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0)); + __i = _STLP_STD::copy(__first, __last, __i); + this->_M_finish = _STLP_STD::copy(__position, end(), __i); + this->_M_deallocate(); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len); + this->_M_start = iterator(__q, 0); + } + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + void _M_fill_insert(iterator __position, size_type __n, bool __x) { + if (__n == 0) return; + if (capacity() - size() >= __n) { + _STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n), + random_access_iterator_tag(), (difference_type*)0 ); + fill(__position, __position + difference_type(__n), __x); + this->_M_finish += difference_type(__n); + } + else { + size_type __len = size() + (max)(size(), __n); + __chunk_type* __q = this->_M_bit_alloc(__len); + iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0)); + fill_n(__i, __n, __x); + this->_M_finish = _STLP_STD::copy(__position, end(), __i + difference_type(__n)); + this->_M_deallocate(); + this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len); + this->_M_start = iterator(__q, 0); + } + } + + void insert(iterator __position, size_type __n, bool __x) { + _M_fill_insert(__position, __n, __x); + } + + void pop_back() { + --this->_M_finish; + } + iterator erase(iterator __position) { + if (__position + 1 != end()) + _STLP_STD::copy(__position + 1, end(), __position); + --this->_M_finish; + return __position; + } + iterator erase(iterator __first, iterator __last) { + this->_M_finish = _STLP_STD::copy(__last, end(), __first); + return __first; + } + void resize(size_type __new_size, bool __x = bool()) { + if (__new_size < size()) + erase(begin() + difference_type(__new_size), end()); + else + insert(end(), __new_size - size(), __x); + } + void flip() { + for (__chunk_type* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p) + *__p = ~*__p; + } + + void clear() { erase(begin(), end()); } +}; + +#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000) +# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER +# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED +# include +# undef _STLP_TEMPLATE_CONTAINER +# undef _STLP_TEMPLATE_HEADER +#endif /* NO_BOOL */ + +#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#undef vector +#undef _Alloc +#undef _STLP_VECBOOL_TEMPLATE +#undef __BVECTOR +#undef __BVECTOR_QUALIFIED +#undef __BVEC_TMPL_HEADER + +#undef _STLP_WORD_BIT + +#endif /* _STLP_INTERNAL_BVECTOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_carray.h b/sdk/tlibstdcxx/stlport/stl/_carray.h new file mode 100644 index 0000000000..560bab2957 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_carray.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2005 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_CARRAY_H +#define _STLP_CARRAY_H + +/* Purpose: Mimic a pur C array with the additionnal feature of + * being able to be used with type not default constructible. + */ + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _CArray { + _CArray (const _Tp& __val) { + for (size_t __i = 0; __i < _Nb; ++__i) { + _Copy_Construct(__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)), __val); + } + } + + ~_CArray() { + _Destroy_Range(__REINTERPRET_CAST(_Tp*, _M_data + 0), + __REINTERPRET_CAST(_Tp*, _M_data + _Nb * sizeof(_Tp))); + } + + _Tp& operator [] (size_t __i) { + _STLP_ASSERT(__i < _Nb) + return *__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)); + } + +private: + char _M_data[sizeof(_Tp) * _Nb]; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif //_STLP_CARRAY_H diff --git a/sdk/tlibstdcxx/stlport/stl/_cctype.h b/sdk/tlibstdcxx/stlport/stl/_cctype.h new file mode 100644 index 0000000000..cf82524ae2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cctype.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CCTYPE +#define _STLP_INTERNAL_CCTYPE + +#if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cctype) +# endif +#else +# include +#endif /* _STLP_USE_NEW_C_HEADERS */ + +#if ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +# if defined ( _STLP_IMPORT_VENDOR_CSTD ) +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::isalnum; +using _STLP_VENDOR_CSTD::isalpha; +using _STLP_VENDOR_CSTD::iscntrl; +using _STLP_VENDOR_CSTD::isdigit; +using _STLP_VENDOR_CSTD::isgraph; +using _STLP_VENDOR_CSTD::islower; +using _STLP_VENDOR_CSTD::isprint; +using _STLP_VENDOR_CSTD::ispunct; +using _STLP_VENDOR_CSTD::isspace; +using _STLP_VENDOR_CSTD::isupper; +using _STLP_VENDOR_CSTD::isxdigit; +using _STLP_VENDOR_CSTD::tolower; +using _STLP_VENDOR_CSTD::toupper; +_STLP_END_NAMESPACE +# endif /* _STLP_IMPORT_VENDOR_CSTD*/ +#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_clocale.h b/sdk/tlibstdcxx/stlport/stl/_clocale.h new file mode 100644 index 0000000000..091a9b6649 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_clocale.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CLOCALE +#define _STLP_INTERNAL_CLOCALE + +#if !defined (_STLP_WCE_EVC3) + +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(clocale) +# endif +# else +# include +# endif + +# if defined (_STLP_IMPORT_VENDOR_CSTD) +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::lconv; +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +using _STLP_VENDOR_CSTD::localeconv; +using _STLP_VENDOR_CSTD::setlocale; +# endif +_STLP_END_NAMESPACE +# endif + +#endif /* !_STLP_WCE_EVC3 */ + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_cmath.h b/sdk/tlibstdcxx/stlport/stl/_cmath.h new file mode 100644 index 0000000000..0ceb8005bc --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cmath.h @@ -0,0 +1,579 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CMATH +#define _STLP_INTERNAL_CMATH + +/* gcc do not like when a using directive appear after a function + * declaration. cmath have abs overloads and cstdlib a using directive + * so cstdlib has to be included first. + */ +#if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) +# endif +#endif + +#if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_NO_NAMESPACES) && !defined (exception) +# define exception __math_exception +# endif +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cmath) +# endif +# if defined (_STLP_HAS_NO_NAMESPACES) +# undef exception +# endif +#else +# include +#endif + +#if (defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) || \ + !(defined (__IBMCPP__) && (__IBMCPP__ >= 500) || !(defined(__HP_aCC) && (__HP_aCC >= 30000) )) +# if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC) +// All the other hypot stuff is going to be at file scope, so follow along here. +namespace std { +# endif +extern "C" double hypot(double x, double y); +# if !defined(_STLP_HAS_NO_NAMESPACES) && !defined(__SUNPRO_CC) +} +# endif + +#endif + +#if defined (__sun) && defined (__GNUC__) +extern "C" { + float __cosf(float v); + float __sinf(float v); + float __atan2f(float, float); + float __coshf(float v); + float __sinhf(float v); + float __sqrtf(float v); + float __expf(float v); + float __logf(float v); + float __log10f(float v); + + long double __cosl(long double v); + long double __sinl(long double v); + long double __atan2l(long double, long double); + long double __coshl(long double v); + long double __sinhl(long double v); + long double __sqrtl(long double v); + long double __expl(long double v); + long double __logl(long double v); + long double __log10l(long double v); +} + +extern "C" { + inline float cosf(float v) { return __cosf(v); } + inline float sinf(float v) { return __sinf(v); } + inline float atan2f(float v1, float v2) { return __atan2f(v1,v2); } + inline float coshf(float v) { return __coshf(v); } + inline float sinhf(float v) { return __sinhf(v); } + inline float sqrtf(float v) { return __sqrtf(v); } + inline float expf(float v) { return __expf(v); } + inline float logf(float v) { return __logf(v); } + inline float log10f(float v) { return __log10f(v); } + + inline long double cosl(long double v) { return __cosl(v); } + inline long double sinl(long double v) { return __sinl(v); } + inline long double atan2l(long double v1, long double v2) { return __atan2l(v1,v2); } + inline long double coshl(long double v) { return __coshl(v); } + inline long double sinhl(long double v) { return __sinhl(v); } + inline long double sqrtl(long double v) { return __sqrtl(v); } + inline long double expl(long double v) { return __expl(v); } + inline long double logl(long double v) { return __logl(v); } + inline long double log10l(long double v) { return __log10l(v); } +} +#endif // __sun && __GNUC__ + +#if defined (__sun) +extern "C" { +extern float __acosf(float); +extern float __asinf(float); +extern float __atanf(float); +extern float __atan2f(float, float); +extern float __ceilf(float); +extern float __cosf(float); +extern float __coshf(float); +extern float __expf(float); +extern float __fabsf(float); +extern float __floorf(float); +extern float __fmodf(float, float); +extern float __frexpf(float, int *); +extern float __ldexpf(float, int); +extern float __logf(float); +extern float __log10f(float); +extern float __modff(float, float *); +extern float __powf(float, float); +extern float __sinf(float); +extern float __sinhf(float); +extern float __sqrtf(float); +extern float __tanf(float); +extern float __tanhf(float); + +extern long double __acosl(long double); +extern long double __asinl(long double); +extern long double __atanl(long double); +extern long double __atan2l(long double, long double); +extern long double __ceill(long double); +extern long double __cosl(long double); +extern long double __coshl(long double); +extern long double __expl(long double); +extern long double __fabsl(long double); +extern long double __floorl(long double); +extern long double __fmodl(long double, long double); +extern long double __frexpl(long double, int *); +extern long double __ldexpl(long double, int); +extern long double __logl(long double); +extern long double __log10l(long double); +extern long double __modfl(long double, long double *); +extern long double __powl(long double, long double); +extern long double __sinl(long double); +extern long double __sinhl(long double); +extern long double __sqrtl(long double); +extern long double __tanl(long double); +extern long double __tanhl(long double); +} +#endif + +#if defined (__BORLANDC__) +# define _STLP_CMATH_FUNC_NAMESPACE _STLP_VENDOR_CSTD +#else +# define _STLP_CMATH_FUNC_NAMESPACE +#endif + +#if !defined (__sun) || defined (__GNUC__) +# define _STLP_MATH_INLINE(float_type, func, cfunc) \ + inline float_type func (float_type x) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x); } +# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \ + inline float_type func (float_type x, type y) { return _STLP_CMATH_FUNC_NAMESPACE::cfunc(x, y); } +# define _STLP_MATH_INLINE_D(float_type, func, cfunc) +# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) +#else +# ifdef __SUNPRO_CC +# define _STLP_MATH_INLINE(float_type, func, cfunc) \ + inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::__##cfunc(x); } +# define _STLP_MATH_INLINE_D(float_type, func, cfunc) \ + inline float_type func (float_type x) { return _STLP_VENDOR_CSTD::cfunc(x); } +# define _STLP_MATH_INLINE2(float_type, type, func, cfunc) \ + inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::__##cfunc(x,y); } +# define _STLP_MATH_INLINE2_D(float_type, type, func, cfunc) \ + inline float_type func (float_type x, type y) { return _STLP_VENDOR_CSTD::cfunc(x,y); } +# else +# error Unknown compiler for the Sun platform +# endif +#endif + +/** macros to define math functions +These macros (having an X somewhere in the name) forward to the C library's +double functions but cast the arguments and return values to the given type. */ + +#define _STLP_MATH_INLINEX(__type,func,cfunc) \ + inline __type func (__type x) \ + { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x)); } +#define _STLP_MATH_INLINE2X(__type1,__type2,func,cfunc) \ + inline __type1 func (__type1 x, __type2 y) \ + { return __STATIC_CAST(__type1, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, y)); } +#define _STLP_MATH_INLINE2PX(__type,func,cfunc) \ + inline __type func (__type x, __type *y) { \ + double tmp1, tmp2; \ + tmp1 = _STLP_CMATH_FUNC_NAMESPACE::cfunc(__STATIC_CAST(double, x), &tmp2); \ + *y = __STATIC_CAST(__type, tmp2); \ + return __STATIC_CAST(__type, tmp1); \ + } +#define _STLP_MATH_INLINE2XX(__type,func,cfunc) \ + inline __type func (__type x, __type y) \ + { return __STATIC_CAST(__type, _STLP_CMATH_FUNC_NAMESPACE::cfunc((double)x, (double)y)); } + + +/** rough characterization of compiler and native C library +For the compiler, it can either support long double or not. If it doesn't, the +macro _STLP_NO_LONG_DOUBLE is not defined and we don't define any long double +overloads. +For the native C library the question is whether it has variants with an 'f' +suffix (for float as opposed to double) or an 'l' suffix (for long double). If +the float variants are missing, _STLP_NO_VENDOR_MATH_F is defined, when the +long double variants are missing, _STLP_NO_VENDOR_MATH_L is defined. Of course +the latter doesn't make sense anyway when the compiler already has no long +double support. + +Those two traits determine a) which overloads get defined and b) how they are +defined. + +Meaning of suffixes: +"" : function returning and taking a float_type +"2" : function returning a float_type and taking to float_types +"2P" : function returning a float_type and taking a float_type and a float_type* +"2PI": function returning a float_type and taking a float_type and an int* +"2I" : function returning a float_type and taking a float_Type and an int +*/ + +#if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_NO_VENDOR_MATH_L) && !defined (_STLP_NO_VENDOR_MATH_F) + // long double support and both e.g. sinl(long double) and sinf(float) + // This is the default for a correct and complete native library. +# define _STLP_DEF_MATH_INLINE(func,cf) \ + _STLP_MATH_INLINE(float,func,cf##f) \ + _STLP_MATH_INLINE_D(double,func,cf) \ + _STLP_MATH_INLINE(long double,func,cf##l) +# define _STLP_DEF_MATH_INLINE2(func,cf) \ + _STLP_MATH_INLINE2(float,float,func,cf##f) \ + _STLP_MATH_INLINE2_D(double,double,func,cf) \ + _STLP_MATH_INLINE2(long double,long double,func,cf##l) +# define _STLP_DEF_MATH_INLINE2P(func,cf) \ + _STLP_MATH_INLINE2(float,float *,func,cf##f) \ + _STLP_MATH_INLINE2_D(double,double *,func,cf) \ + _STLP_MATH_INLINE2(long double,long double *,func,cf##l) +# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ + _STLP_MATH_INLINE2(float,int *,func,cf##f) \ + _STLP_MATH_INLINE2_D(double,int *,func,cf) \ + _STLP_MATH_INLINE2(long double,int *,func,cf##l) +# define _STLP_DEF_MATH_INLINE2I(func,cf) \ + _STLP_MATH_INLINE2(float,int,func,cf##f) \ + _STLP_MATH_INLINE2_D(double,int,func,cf) \ + _STLP_MATH_INLINE2(long double,int,func,cf##l) +#else +# if !defined (_STLP_NO_LONG_DOUBLE) +# if !defined (_STLP_NO_VENDOR_MATH_F) + // long double support and e.g. sinf(float) but not e.g. sinl(long double) +# define _STLP_DEF_MATH_INLINE(func,cf) \ + _STLP_MATH_INLINE(float,func,cf##f) \ + _STLP_MATH_INLINEX(long double,func,cf) +# define _STLP_DEF_MATH_INLINE2(func,cf) \ + _STLP_MATH_INLINE2(float,float,func,cf##f) \ + _STLP_MATH_INLINE2XX(long double,func,cf) +# define _STLP_DEF_MATH_INLINE2P(func,cf) \ + _STLP_MATH_INLINE2(float,float *,func,cf##f) \ + _STLP_MATH_INLINE2PX(long double,func,cf) +# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ + _STLP_MATH_INLINE2(float,int *,func,cf##f) \ + _STLP_MATH_INLINE2X(long double,int *,func,cf) +# define _STLP_DEF_MATH_INLINE2I(func,cf) \ + _STLP_MATH_INLINE2(float,int,func,cf##f) \ + _STLP_MATH_INLINE2X(long double,int,func,cf) +# elif !defined (_STLP_NO_VENDOR_MATH_L) + // long double support and e.g. sinl(long double) but not e.g. sinf(float) +# define _STLP_DEF_MATH_INLINE(func,cf) \ + _STLP_MATH_INLINEX(float,func,cf) \ + _STLP_MATH_INLINE(long double,func,cf##l) +# define _STLP_DEF_MATH_INLINE2(func,cf) \ + _STLP_MATH_INLINE2XX(float,func,cf) \ + _STLP_MATH_INLINE2(long double,long double,func,cf##l) +# define _STLP_DEF_MATH_INLINE2P(func,cf) \ + _STLP_MATH_INLINE2PX(float,func,cf) \ + _STLP_MATH_INLINE2(long double,long double *,func,cf##l) +# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ + _STLP_MATH_INLINE2X(float,int *,func,cf) \ + _STLP_MATH_INLINE2(long double,int *,func,cf##l) +# define _STLP_DEF_MATH_INLINE2I(func,cf) \ + _STLP_MATH_INLINE2X(float,int,func,cf) \ + _STLP_MATH_INLINE2(long double,int,func,cf##l) +# else +# define _STLP_DEF_MATH_INLINE(func,cf) \ + _STLP_MATH_INLINEX(float,func,cf) \ + _STLP_MATH_INLINEX(long double,func,cf) +# define _STLP_DEF_MATH_INLINE2(func,cf) \ + _STLP_MATH_INLINE2XX(float,func,cf) \ + _STLP_MATH_INLINE2XX(long double,func,cf) +# define _STLP_DEF_MATH_INLINE2P(func,cf) \ + _STLP_MATH_INLINE2PX(float,func,cf) \ + _STLP_MATH_INLINE2PX(long double,func,cf) +# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ + _STLP_MATH_INLINE2X(float,int *,func,cf) \ + _STLP_MATH_INLINE2X(long double,int *,func,cf) +# define _STLP_DEF_MATH_INLINE2I(func,cf) \ + _STLP_MATH_INLINE2X(float,int,func,cf) \ + _STLP_MATH_INLINE2X(long double,int,func,cf) +# endif +# else +# if !defined (_STLP_NO_VENDOR_MATH_F) +# define _STLP_DEF_MATH_INLINE(func,cf) \ + _STLP_MATH_INLINE(float,func,cf##f) +# define _STLP_DEF_MATH_INLINE2(func,cf) \ + _STLP_MATH_INLINE2(float,float,func,cf##f) +# define _STLP_DEF_MATH_INLINE2P(func,cf) \ + _STLP_MATH_INLINE2(float,float *,func,cf##f) +# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ + _STLP_MATH_INLINE2(float,int *,func,cf##f) +# define _STLP_DEF_MATH_INLINE2I(func,cf) \ + _STLP_MATH_INLINE2(float,int,func,cf##f) +# else // _STLP_NO_VENDOR_MATH_F + // neither long double support nor e.g. sinf(float) functions +# define _STLP_DEF_MATH_INLINE(func,cf) \ + _STLP_MATH_INLINEX(float,func,cf) +# define _STLP_DEF_MATH_INLINE2(func,cf) \ + _STLP_MATH_INLINE2XX(float,func,cf) +# define _STLP_DEF_MATH_INLINE2P(func,cf) \ + _STLP_MATH_INLINE2PX(float,func,cf) +# define _STLP_DEF_MATH_INLINE2PI(func,cf) \ + _STLP_MATH_INLINE2X(float,int *,func,cf) +# define _STLP_DEF_MATH_INLINE2I(func,cf) \ + _STLP_MATH_INLINE2X(float,int,func,cf) +# endif // _STLP_NO_VENDOR_MATH_F +# endif +#endif + +#if defined (_STLP_WCE) || \ + (defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) && defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */) +/* + * dums: VC6 has all the required C++ functions but only define them if + * _MSC_EXTENSIONS is not defined (a bug?). STLport just do the same + * thing also when _MSC_EXTENSIONS is defined. + * TODO: above check (_STLP_MSVC <= 1300) also catches VC7.0, is that intended? + */ +//We have to tell the compilers that abs, acos ... math functions are not intrinsic +//otherwise we have Internal Compiler Error in release mode... +# pragma warning(push) +# pragma warning(disable: 4162) // no function with C linkage found +# pragma warning(disable: 4163) // not available as an intrinsic function +# pragma function (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh) +# if defined (_STLP_WCE) +# pragma function (ceil, floor) +# endif +# define _STLP_RESTORE_FUNCTION_INTRINSIC +#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS + +#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS) +/* In this config Borland native lib only define functions in std namespace. + * In order to have all overloads in STLport namespace we need to add the + * double overload in global namespace. We do not use a using statement to avoid + * import of invalid overload. + */ +# define _STLP_DMATH_INLINE(func) _STLP_MATH_INLINE(double, func, func) +# define _STLP_DMATH_INLINE2(func) _STLP_MATH_INLINE2(double, double, func, func) + +_STLP_DMATH_INLINE(acos) +_STLP_DMATH_INLINE(asin) +_STLP_DMATH_INLINE(atan) +_STLP_DMATH_INLINE2(atan2) +_STLP_DMATH_INLINE(ceil) +_STLP_DMATH_INLINE(cos) +_STLP_DMATH_INLINE(cosh) +_STLP_DMATH_INLINE(exp) +_STLP_DMATH_INLINE(fabs) +_STLP_DMATH_INLINE(floor) +_STLP_DMATH_INLINE2(fmod) +_STLP_MATH_INLINE2X(double, int*, frexp, frexp) +_STLP_MATH_INLINE2X(double, int, ldexp, ldexp) +_STLP_DMATH_INLINE(log) +_STLP_DMATH_INLINE(log10) +_STLP_MATH_INLINE2PX(double, modf, modf) +_STLP_DMATH_INLINE(sin) +_STLP_DMATH_INLINE(sinh) +_STLP_DMATH_INLINE(sqrt) +_STLP_DMATH_INLINE(tan) +_STLP_DMATH_INLINE(tanh) +_STLP_DMATH_INLINE2(pow) +_STLP_DMATH_INLINE2(hypot) + +# undef _STLP_DMATH_INLINE +# undef _STLP_DMATH_INLINE2 +#endif + +#if defined (__DMC__) +# if defined (fabs) +inline double __stlp_fabs(double __x) { return fabs(__x); } +# undef fabs +inline double fabs(double __x) { return __stlp_fabs(__x); } +# endif +# if defined (cos) +inline double __stlp_cos(double __x) { return cos(__x); } +# undef cos +inline double cos(double __x) { return __stlp_cos(__x); } +# endif +# if defined (sin) +inline double __stlp_sin(double __x) { return sin(__x); } +# undef sin +inline double sin(double __x) { return __stlp_sin(__x); } +# endif +# if defined (sqrt) +inline double __stlp_sqrt(double __x) { return sqrt(__x); } +# undef sqrt +inline double sqrt(double __x) { return __stlp_sqrt(__x); } +# endif +# if defined (ldexp) +inline double __stlp_ldexp(double __x, int __y) { return ldexp(__x, __y); } +# undef ldexp +inline double ldexp(double __x, int __y) { return __stlp_ldexp(__x, __y); } +# endif +#endif + +/* MSVC native lib starting with .Net 2003 has already all math functions + * in global namespace. + * HP-UX native lib has math functions in the global namespace. + */ +#if defined (_STLP_SGX_CONFIG) || (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)) && \ + (!defined (__HP_aCC) || (__HP_aCC < 30000)) && \ + !defined (__WATCOMC__) +inline double abs(double __x) +{ return ::fabs(__x); } +# if !defined (__MVS__) +_STLP_DEF_MATH_INLINE(abs, fabs) +# else // __MVS__ has native long double abs? +inline float abs(float __x) { return ::fabsf(__x); } +# endif + +_STLP_DEF_MATH_INLINE(acos, acos) +_STLP_DEF_MATH_INLINE(asin, asin) +_STLP_DEF_MATH_INLINE(atan, atan) +_STLP_DEF_MATH_INLINE2(atan2, atan2) +_STLP_DEF_MATH_INLINE(ceil, ceil) +_STLP_DEF_MATH_INLINE(cos, cos) +_STLP_DEF_MATH_INLINE(cosh, cosh) +_STLP_DEF_MATH_INLINE(exp, exp) +_STLP_DEF_MATH_INLINE(fabs, fabs) +_STLP_DEF_MATH_INLINE(floor, floor) +_STLP_DEF_MATH_INLINE2(fmod, fmod) +_STLP_DEF_MATH_INLINE2PI(frexp, frexp) +_STLP_DEF_MATH_INLINE2I(ldexp, ldexp) +_STLP_DEF_MATH_INLINE(log, log) +_STLP_DEF_MATH_INLINE(log10, log10) +_STLP_DEF_MATH_INLINE2P(modf, modf) +_STLP_DEF_MATH_INLINE(sin, sin) +_STLP_DEF_MATH_INLINE(sinh, sinh) +_STLP_DEF_MATH_INLINE(sqrt, sqrt) +_STLP_DEF_MATH_INLINE(tan, tan) +_STLP_DEF_MATH_INLINE(tanh, tanh) +_STLP_DEF_MATH_INLINE2(pow, pow) + +# if defined (_STLP_SGX_CONFIG) || !defined(_STLP_MSVC) /* || (_STLP_MSVC > 1300) */ || defined(_STLP_WCE) || !defined (_MSC_EXTENSIONS) /* && !defined(_STLP_WCE_NET) */ +# ifndef _STLP_NO_VENDOR_MATH_F +# ifndef __sun +inline float pow(float __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powf(__x, __STATIC_CAST(float,__y)); } +# else +inline float pow(float __x, int __y) { return ::__powf(__x, __STATIC_CAST(float,__y)); } +# endif +# else +inline float pow(float __x, int __y) { return __STATIC_CAST(float, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(float,__y))); } +# endif +inline double pow(double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(double,__y)); } +# if !defined (_STLP_NO_LONG_DOUBLE) +# if !defined(_STLP_NO_VENDOR_MATH_L) +# ifndef __sun +inline long double pow(long double __x, int __y) { return _STLP_CMATH_FUNC_NAMESPACE::powl(__x, __STATIC_CAST(long double,__y)); } +# else +# ifndef __SUNPRO_CC +inline long double pow(long double __x, int __y) { return ::__powl(__x, __STATIC_CAST(long double,__y)); } +# else +inline long double pow(long double __x, int __y) { return _STLP_VENDOR_CSTD::__powl(__x, __STATIC_CAST(long double,__y)); } +# endif +# endif +# else +inline long double pow(long double __x, int __y) { return __STATIC_CAST(long double, _STLP_CMATH_FUNC_NAMESPACE::pow(__x, __STATIC_CAST(long double,__y))); } +# endif +# endif +# else +//The MS native pow version has a bugged overload so it is not imported +//in the STLport namespace. +//Here is the bugged version: +//inline double pow(int __x, int __y) { return (_Pow_int(__x, __y)); } +inline double pow(double __x, int __y) { return (_Pow_int(__x, __y)); } +inline float pow(float __x, int __y) { return (_Pow_int(__x, __y)); } +inline long double pow(long double __x, int __y) { return (_Pow_int(__x, __y)); } +# endif +#endif + +#if (defined (_STLP_MSVC) && !defined (_STLP_WCE)) || defined (__ICL) || defined (__sun) +# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400) +# pragma warning (push) +# pragma warning (disable : 4996) // hypot is deprecated. +# endif +_STLP_MATH_INLINE2XX(float, hypot, hypot) +inline long double hypot(long double x, long double y) { return sqrt(x * x + y * y); } +# if defined (_STLP_MSVC) && (_STLP_MSVC >= 1400) +# pragma warning (pop) +# endif +#else +# if defined (_STLP_USE_UCLIBC) +inline double hypot(double x, double y) { return sqrt(x * x + y * y); } +_STLP_DEF_MATH_INLINE2(hypot, hypot) +# elif defined (_STLP_WCE) + /* CE has a double _hypot(double,double) which we use */ +inline double hypot(double __x, double __y) { return _hypot(__x,__y); } +_STLP_DEF_MATH_INLINE2(hypot, _hypot) +# endif +#endif + +#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC) +//restoration of the default intrinsic status of those functions: +# pragma intrinsic (abs, acos, asin, atan, atan2, cos, cosh, exp, fabs, fmod, log, log10, sin, sinh, sqrt, tan, tanh) +# if defined (_STLP_WCE) +# pragma intrinsic (ceil, floor) +# endif +# pragma warning(pop) +# undef _STLP_RESTORE_FUNCTION_INTRINSIC +#endif // _STLP_MSVC && _STLP_MSVC <= 1300 && !_STLP_WCE && _MSC_EXTENSIONS + +/* C++ Standard is unclear about several call to 'using ::func' if new overloads + * of ::func appears between 2 successive 'using' calls. To avoid this potential + * problem we provide all abs overload before the 'using' call. + * Beware: This header inclusion has to be after all abs overload of this file. + * The first 'using ::abs' call is going to be in the other header. + */ +#ifndef _STLP_INTERNAL_CSTDLIB +# include +#endif + +#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +_STLP_BEGIN_NAMESPACE +using ::abs; +using ::acos; +using ::asin; +using ::atan; +using ::atan2; +using ::ceil; +using ::cos; +using ::cosh; +using ::exp; +using ::fabs; +using ::floor; +using ::fmod; +using ::frexp; +/* + Because of some weird interaction between STLport headers + and native HP-UX headers, when compiled with _STLP_DEBUG + macro defined with aC++, hypot() is not declared. + At some point we'll need to get to the bottom line of + this problem. +*/ +#if !(defined(__HP_aCC) && defined(_STLP_DEBUG)) +using ::hypot; +#endif +using ::ldexp; +using ::log; +using ::log10; +using ::modf; +using ::pow; +using ::sin; +using ::sinh; +using ::sqrt; +using ::tan; +using ::tanh; +_STLP_END_NAMESPACE +# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x560) && !defined (__linux__) +using _STLP_VENDOR_CSTD::_ecvt; +using _STLP_VENDOR_CSTD::_fcvt; +# endif +#endif + +#endif /* _STLP_INTERNAL_CMATH */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_codecvt.h b/sdk/tlibstdcxx/stlport/stl/_codecvt.h new file mode 100644 index 0000000000..29b408b2e4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_codecvt.h @@ -0,0 +1,442 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_CODECVT_H +#define _STLP_INTERNAL_CODECVT_H + +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +class _STLP_CLASS_DECLSPEC codecvt_base { +public: + enum result {ok, partial, error, noconv}; +}; + +template +class codecvt : public locale::facet, public codecvt_base { +public: + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef _StateT state_type; + +#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) + /* For the moment VC6 do not support this facet default implementation + * because of the static locale::id instance. When VC6 see this definition + * it goes crasy with locale::id static instances and all the has_facet tests + * unit tests are failing. + */ +}; +#else + explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} + + result out(state_type& __state, + const intern_type* __from, + const intern_type* __from_end, + const intern_type*& __from_next, + extern_type* __to, + extern_type* __to_limit, + extern_type*& __to_next) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_out(__state, + __from, __from_end, __from_next, + __to, __to_limit, __to_next); + } + + result unshift(state_type& __state, + extern_type* __to, + extern_type* __to_limit, + extern_type*& __to_next) const { + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_unshift(__state, __to, __to_limit, __to_next); + } + + result in(state_type& __state, + const extern_type* __from, + const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, + intern_type* __to_limit, + intern_type*& __to_next) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_in(__state, + __from, __from_end, __from_next, + __to, __to_limit, __to_next); + } + + int encoding() const _STLP_NOTHROW { return do_encoding(); } + + bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); } + + int length(state_type& __state, + const extern_type* __from, + const extern_type* __from_end, + size_t __max) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + return do_length(__state, __from, __from_end, __max); + } + + int max_length() const _STLP_NOTHROW { return do_max_length(); } + + static locale::id id; + +protected: + ~codecvt() {} + + virtual result do_out(state_type&, + const intern_type* __from, + const intern_type*, + const intern_type*& __from_next, + extern_type* __to, + extern_type*, + extern_type*& __to_next) const + { __from_next = __from; __to_next = __to; return noconv; } + + virtual result do_in (state_type&, + const extern_type* __from, + const extern_type*, + const extern_type*& __from_next, + intern_type* __to, + intern_type*, + intern_type*& __to_next) const + { __from_next = __from; __to_next = __to; return noconv; } + + virtual result do_unshift(state_type&, + extern_type* __to, + extern_type*, + extern_type*& __to_next) const + { __to_next = __to; return noconv; } + + virtual int do_encoding() const _STLP_NOTHROW + { return 1; } + + virtual bool do_always_noconv() const _STLP_NOTHROW + { return true; } + + virtual int do_length(state_type&, + const extern_type* __from, + const extern_type* __end, + size_t __max) const + { return (int)(min) ( __STATIC_CAST(size_t, (__end - __from)), __max); } + + virtual int do_max_length() const _STLP_NOTHROW + { return 1; } + +private: + codecvt(const codecvt&); + codecvt& operator = (const codecvt&); +}; + +# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590) +template +locale::id codecvt<_InternT, _ExternT, _StateT>::id; +# endif +# endif +#endif + +template +class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC codecvt + : public locale::facet, public codecvt_base { +public: + typedef char intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} + + result out(state_type& __state, + const char* __from, + const char* __from_end, + const char*& __from_next, + char* __to, + char* __to_limit, + char*& __to_next) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_out(__state, + __from, __from_end, __from_next, + __to, __to_limit, __to_next); + } + + result unshift(state_type& __state, + char* __to, char* __to_limit, char*& __to_next) const { + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_unshift(__state, __to, __to_limit, __to_next); + } + + result in(state_type& __state, + const char* __from, + const char* __from_end, + const char*& __from_next, + char* __to, + char* __to_limit, + char*& __to_next) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_in(__state, + __from, __from_end, __from_next, + __to, __to_limit, __to_next); + } + + int encoding() const _STLP_NOTHROW { return do_encoding(); } + + bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); } + + int length(state_type& __state, + const char* __from, const char* __from_end, + size_t __max) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + return do_length(__state, __from, __from_end, __max); + } + + int max_length() const _STLP_NOTHROW { return do_max_length(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~codecvt(); + + virtual result do_out(state_type& /* __state */, + const char* __from, + const char* /* __from_end */, + const char*& __from_next, + char* __to, + char* /* __to_limit */, + char*& __to_next) const; + + virtual result do_in (state_type& /* __state */ , + const char* __from, + const char* /* __from_end */, + const char*& __from_next, + char* __to, + char* /* __to_end */, + char*& __to_next) const; + + virtual result do_unshift(state_type& /* __state */, + char* __to, + char* /* __to_limit */, + char*& __to_next) const; + + virtual int do_encoding() const _STLP_NOTHROW; + virtual bool do_always_noconv() const _STLP_NOTHROW; + virtual int do_length(state_type& __state, + const char* __from, + const char* __end, + size_t __max) const; + virtual int do_max_length() const _STLP_NOTHROW; +private: + codecvt(const codecvt&); + codecvt& operator =(const codecvt&); +}; + +# ifndef _STLP_NO_WCHAR_T + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC codecvt + : public locale::facet, public codecvt_base { +public: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + explicit codecvt(size_t __refs = 0) : locale::facet(__refs) {} + + result out(state_type& __state, + const wchar_t* __from, + const wchar_t* __from_end, + const wchar_t*& __from_next, + char* __to, + char* __to_limit, + char*& __to_next) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_out(__state, + __from, __from_end, __from_next, + __to, __to_limit, __to_next); + } + + result unshift(state_type& __state, + char* __to, char* __to_limit, char*& __to_next) const { + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_unshift(__state, __to, __to_limit, __to_next); + } + + result in(state_type& __state, + const char* __from, + const char* __from_end, + const char*& __from_next, + wchar_t* __to, + wchar_t* __to_limit, + wchar_t*& __to_next) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(__to <= __to_limit, _StlMsg_INVALID_ARGUMENT) + return do_in(__state, + __from, __from_end, __from_next, + __to, __to_limit, __to_next); + } + + int encoding() const _STLP_NOTHROW { return do_encoding(); } + + bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); } + + int length(state_type& __state, + const char* __from, const char* __from_end, + size_t __max) const { + _STLP_VERBOSE_ASSERT(__from <= __from_end, _StlMsg_INVALID_ARGUMENT) + return do_length(__state, __from, __from_end, __max); + } + + int max_length() const _STLP_NOTHROW { return do_max_length(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~codecvt(); + + virtual result do_out(state_type& __state, + const wchar_t* __from, + const wchar_t* __from_end, + const wchar_t*& __from_next, + char* __to, + char* __to_limit, + char*& __to_next) const; + + virtual result do_in (state_type& __state, + const char* __from, + const char* __from_end, + const char*& __from_next, + wchar_t* __to, + wchar_t* __to_limit, + wchar_t*& __to_next) const; + + virtual result do_unshift(state_type& __state, + char* __to, + char* __to_limit, + char*& __to_next) const; + + virtual int do_encoding() const _STLP_NOTHROW; + + virtual bool do_always_noconv() const _STLP_NOTHROW; + + virtual int do_length(state_type& __state, + const char* __from, + const char* __end, + size_t __max) const; + + virtual int do_max_length() const _STLP_NOTHROW; + +private: + codecvt(const codecvt&); + codecvt& operator = (const codecvt&); +}; + +# endif + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC codecvt_byname + : public codecvt { +public: + explicit codecvt_byname(const char* __name, size_t __refs = 0); + ~codecvt_byname(); +private: + codecvt_byname(const codecvt_byname&); + codecvt_byname& operator =(const codecvt_byname&); +}; + +# ifndef _STLP_NO_WCHAR_T +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC codecvt_byname + : public codecvt { + friend class _Locale_impl; +public: + explicit codecvt_byname(const char * __name, size_t __refs = 0); + +protected: + ~codecvt_byname(); + + virtual result do_out(state_type& __state, + const wchar_t* __from, + const wchar_t* __from_end, + const wchar_t*& __from_next, + char* __to, + char* __to_limit, + char*& __to_next) const; + + virtual result do_in (state_type& __state, + const char* __from, + const char* __from_end, + const char*& __from_next, + wchar_t* __to, + wchar_t* __to_limit, + wchar_t*& __to_next) const; + + virtual result do_unshift(state_type& __state, + char* __to, + char* __to_limit, + char*& __to_next) const; + + virtual int do_encoding() const _STLP_NOTHROW; + + virtual bool do_always_noconv() const _STLP_NOTHROW; + + virtual int do_length(state_type& __state, + const char* __from, + const char* __end, + size_t __max) const; + + virtual int do_max_length() const _STLP_NOTHROW; + +private: + codecvt_byname(_Locale_codecvt* __cvt) + : _M_codecvt(__cvt) {} + + codecvt_byname(const codecvt_byname&); + codecvt_byname& operator =(const codecvt_byname&); + _Locale_codecvt* _M_codecvt; +}; + +# endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_CODECVT_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_collate.h b/sdk/tlibstdcxx/stlport/stl/_collate.h new file mode 100644 index 0000000000..4384f2e920 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_collate.h @@ -0,0 +1,176 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + +#ifndef _STLP_INTERNAL_COLLATE_H +#define _STLP_INTERNAL_COLLATE_H + +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template class collate {}; +template class collate_byname {}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC collate : public locale::facet { +public: + typedef char char_type; + typedef string string_type; + + explicit collate(size_t __refs = 0) : locale::facet(__refs) {} + + int compare(const char* __low1, const char* __high1, + const char* __low2, const char* __high2) const { + return do_compare( __low1, __high1, __low2, __high2); + } + + string_type transform(const char* __low, const char* __high) const { + return do_transform(__low, __high); + } + + long hash(const char* __low, const char* __high) const + { return do_hash(__low, __high); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~collate(); + + virtual int do_compare(const char*, const char*, + const char*, const char*) const; + virtual string_type do_transform(const char*, const char*) const; + virtual long do_hash(const char*, const char*) const; +private: + collate(const collate&); + collate& operator =(const collate&); +}; + +# ifndef _STLP_NO_WCHAR_T + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC collate : public locale::facet { +public: + typedef wchar_t char_type; + typedef wstring string_type; + + explicit collate(size_t __refs = 0) : locale::facet(__refs) {} + + int compare(const wchar_t* __low1, const wchar_t* __high1, + const wchar_t* __low2, const wchar_t* __high2) const { + return do_compare( __low1, __high1, __low2, __high2); + } + + string_type transform(const wchar_t* __low, const wchar_t* __high) const { + return do_transform(__low, __high); + } + + long hash(const wchar_t* __low, const wchar_t* __high) const + { return do_hash(__low, __high); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~collate(); + + virtual int do_compare(const wchar_t*, const wchar_t*, + const wchar_t*, const wchar_t*) const; + virtual string_type do_transform(const wchar_t*, const wchar_t*) const; + virtual long do_hash(const wchar_t* __low, const wchar_t* __high) const; +private: + collate(const collate&); + collate& operator = (const collate&); +}; + +# endif /* NO_WCHAR_T */ + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC collate_byname: public collate { + friend class _Locale_impl; +public: + explicit collate_byname(const char* __name, size_t __refs = 0); + +protected: + ~collate_byname(); + + virtual int do_compare(const char*, const char*, + const char*, const char*) const; + virtual string_type do_transform(const char*, const char*) const; + +private: + collate_byname(_Locale_collate *__coll) + : _M_collate(__coll) {} + _Locale_collate* _M_collate; + collate_byname(const collate_byname&); + collate_byname& operator =(const collate_byname&); +}; + +# ifndef _STLP_NO_WCHAR_T + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC collate_byname: public collate { + friend class _Locale_impl; +public: + explicit collate_byname(const char * __name, size_t __refs = 0); + +protected: + ~collate_byname(); + + virtual int do_compare(const wchar_t*, const wchar_t*, + const wchar_t*, const wchar_t*) const; + virtual string_type do_transform(const wchar_t*, const wchar_t*) const; + +private: + collate_byname(_Locale_collate *__coll) + : _M_collate(__coll) {} + _Locale_collate* _M_collate; + collate_byname(const collate_byname&); + collate_byname& operator =(const collate_byname&); +}; + +# endif /* NO_WCHAR_T */ + +template +bool +__locale_do_operator_call (const locale& __loc, + const basic_string<_CharT, _Traits, _Alloc>& __x, + const basic_string<_CharT, _Traits, _Alloc>& __y) { + collate<_CharT> const& __coll = use_facet >(__loc); + return __coll.compare(__x.data(), __x.data() + __x.size(), + __y.data(), __y.data() + __y.size()) < 0; +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_COLLATE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_complex.c b/sdk/tlibstdcxx/stlport/stl/_complex.c new file mode 100644 index 0000000000..204fa1ecf2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_complex.c @@ -0,0 +1,145 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_COMPLEX_C +#define _STLP_COMPLEX_C + +#ifndef _STLP_INTERNAL_COMPLEX +# include +#endif + +#if !defined (_STLP_USE_NO_IOSTREAMS) +# ifndef _STLP_INTERNAL_ISTREAM +# include +# endif + +# ifndef _STLP_INTERNAL_SSTREAM +# include +# endif + +# ifndef _STLP_STRING_IO_H +# include +# endif +#endif + +_STLP_BEGIN_NAMESPACE + +// Non-inline member functions. + +template +void complex<_Tp>::_div(const _Tp& __z1_r, const _Tp& __z1_i, + const _Tp& __z2_r, const _Tp& __z2_i, + _Tp& __res_r, _Tp& __res_i) { + _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r; + _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i; + + if (__ar <= __ai) { + _Tp __ratio = __z2_r / __z2_i; + _Tp __denom = __z2_i * (1 + __ratio * __ratio); + __res_r = (__z1_r * __ratio + __z1_i) / __denom; + __res_i = (__z1_i * __ratio - __z1_r) / __denom; + } + else { + _Tp __ratio = __z2_i / __z2_r; + _Tp __denom = __z2_r * (1 + __ratio * __ratio); + __res_r = (__z1_r + __z1_i * __ratio) / __denom; + __res_i = (__z1_i - __z1_r * __ratio) / __denom; + } +} + +template +void complex<_Tp>::_div(const _Tp& __z1_r, + const _Tp& __z2_r, const _Tp& __z2_i, + _Tp& __res_r, _Tp& __res_i) { + _Tp __ar = __z2_r >= 0 ? __z2_r : -__z2_r; + _Tp __ai = __z2_i >= 0 ? __z2_i : -__z2_i; + + if (__ar <= __ai) { + _Tp __ratio = __z2_r / __z2_i; + _Tp __denom = __z2_i * (1 + __ratio * __ratio); + __res_r = (__z1_r * __ratio) / __denom; + __res_i = - __z1_r / __denom; + } + else { + _Tp __ratio = __z2_i / __z2_r; + _Tp __denom = __z2_r * (1 + __ratio * __ratio); + __res_r = __z1_r / __denom; + __res_i = - (__z1_r * __ratio) / __denom; + } +} + +// I/O. +#if !defined (_STLP_USE_NO_IOSTREAMS) + +// Complex output, in the form (re,im). We use a two-step process +// involving stringstream so that we get the padding right. +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z) { + basic_ostringstream<_CharT, _Traits, allocator<_CharT> > __tmp; + __tmp.flags(__os.flags()); + __tmp.imbue(__os.getloc()); + __tmp.precision(__os.precision()); + __tmp << '(' << __z.real() << ',' << __z.imag() << ')'; + return __os << __tmp.str(); +} + +// Complex input from arbitrary streams. Note that results in some +// locales may be confusing, since the decimal character varies with +// locale and the separator between real and imaginary parts does not. + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z) { + _Tp __re = 0; + _Tp __im = 0; + + const ctype<_CharT>& __c_type = *__is._M_ctype_facet(); + + const char __punct[4] = "(,)"; + _CharT __wpunct[3]; + __c_type.widen(__punct, __punct + 3, __wpunct); + + _CharT __c; + + __is >> __c; + if (_Traits::eq(__c, __wpunct[0])) { // Left paren + __is >> __re >> __c; + if (_Traits::eq(__c, __wpunct[1])) // Comma + __is >> __im >> __c; + if (!_Traits::eq(__c, __wpunct[2])) // Right paren + __is.setstate(ios_base::failbit); + } + else { + __is.putback(__c); + __is >> __re; + } + + if (__is) + __z = complex<_Tp>(__re, __im); + return __is; +} + +#endif /* _STLP_USE_NO_IOSTREAMS */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_COMPLEX_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_complex.h b/sdk/tlibstdcxx/stlport/stl/_complex.h new file mode 100644 index 0000000000..5dba0ad401 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_complex.h @@ -0,0 +1,935 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_COMPLEX +#define _STLP_INTERNAL_COMPLEX + +// This header declares the template class complex, as described in +// in the draft C++ standard. Single-precision complex numbers +// are complex, double-precision are complex, and +// quad precision are complex. + +// Note that the template class complex is declared within namespace +// std, as called for by the draft C++ standard. + +#ifndef _STLP_INTERNAL_CMATH +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +struct complex { + typedef _Tp value_type; + typedef complex<_Tp> _Self; + + // Constructors, destructor, assignment operator. + complex() : _M_re(0), _M_im(0) {} + complex(const value_type& __x) + : _M_re(__x), _M_im(0) {} + complex(const value_type& __x, const value_type& __y) + : _M_re(__x), _M_im(__y) {} + complex(const _Self& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} + + _Self& operator=(const _Self& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + +#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + template + explicit complex(const complex<_Tp2>& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} + + template + _Self& operator=(const complex<_Tp2>& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + // Element access. + value_type real() const { return _M_re; } + value_type imag() const { return _M_im; } + + // Arithmetic op= operations involving one real argument. + + _Self& operator= (const value_type& __x) { + _M_re = __x; + _M_im = 0; + return *this; + } + _Self& operator+= (const value_type& __x) { + _M_re += __x; + return *this; + } + _Self& operator-= (const value_type& __x) { + _M_re -= __x; + return *this; + } + _Self& operator*= (const value_type& __x) { + _M_re *= __x; + _M_im *= __x; + return *this; + } + _Self& operator/= (const value_type& __x) { + _M_re /= __x; + _M_im /= __x; + return *this; + } + + // Arithmetic op= operations involving two complex arguments. + + static void _STLP_CALL _div(const value_type& __z1_r, const value_type& __z1_i, + const value_type& __z2_r, const value_type& __z2_i, + value_type& __res_r, value_type& __res_i); + + static void _STLP_CALL _div(const value_type& __z1_r, + const value_type& __z2_r, const value_type& __z2_i, + value_type& __res_r, value_type& __res_i); + +#if defined (_STLP_MEMBER_TEMPLATES) // && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + + template _Self& operator+= (const complex<_Tp2>& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + template _Self& operator-= (const complex<_Tp2>& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + template _Self& operator*= (const complex<_Tp2>& __z) { + value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; + value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + template _Self& operator/= (const complex<_Tp2>& __z) { + value_type __r; + value_type __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + _Self& operator+= (const _Self& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + _Self& operator-= (const _Self& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + _Self& operator*= (const _Self& __z) { + value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; + value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + _Self& operator/= (const _Self& __z) { + value_type __r; + value_type __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + + // Data members. + value_type _M_re; + value_type _M_im; +}; + +// Explicit specializations for float, double, long double. The only +// reason for these specializations is to enable automatic conversions +// from complex to complex, and complex to +// complex. + +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC complex { + typedef float value_type; + typedef complex _Self; + // Constructors, destructor, assignment operator. + + complex(value_type __x = 0.0f, value_type __y = 0.0f) + : _M_re(__x), _M_im(__y) {} + + complex(const complex& __z) : _M_re(__z._M_re), _M_im(__z._M_im) {} + + inline explicit complex(const complex& __z); +#ifndef _STLP_NO_LONG_DOUBLE + inline explicit complex(const complex& __z); +#endif + // Element access. + value_type real() const { return _M_re; } + value_type imag() const { return _M_im; } + + // Arithmetic op= operations involving one real argument. + + _Self& operator= (value_type __x) { + _M_re = __x; + _M_im = 0.0f; + return *this; + } + _Self& operator+= (value_type __x) { + _M_re += __x; + return *this; + } + _Self& operator-= (value_type __x) { + _M_re -= __x; + return *this; + } + _Self& operator*= (value_type __x) { + _M_re *= __x; + _M_im *= __x; + return *this; + } + _Self& operator/= (value_type __x) { + _M_re /= __x; + _M_im /= __x; + return *this; + } + + // Arithmetic op= operations involving two complex arguments. + + static void _STLP_CALL _div(const float& __z1_r, const float& __z1_i, + const float& __z2_r, const float& __z2_i, + float& __res_r, float& __res_i); + + static void _STLP_CALL _div(const float& __z1_r, + const float& __z2_r, const float& __z2_i, + float& __res_r, float& __res_i); + +#if defined (_STLP_MEMBER_TEMPLATES) + template + complex& operator=(const complex<_Tp2>& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + + template + complex& operator+= (const complex<_Tp2>& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + template + complex& operator-= (const complex<_Tp2>& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + template + complex& operator*= (const complex<_Tp2>& __z) { + float __r = _M_re * __z._M_re - _M_im * __z._M_im; + float __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + template + complex& operator/= (const complex<_Tp2>& __z) { + float __r; + float __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + +#endif /* _STLP_MEMBER_TEMPLATES */ + + _Self& operator=(const _Self& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + + _Self& operator+= (const _Self& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + _Self& operator-= (const _Self& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + _Self& operator*= (const _Self& __z) { + value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; + value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + _Self& operator/= (const _Self& __z) { + value_type __r; + value_type __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + + // Data members. + value_type _M_re; + value_type _M_im; +}; + +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC complex { + typedef double value_type; + typedef complex _Self; + + // Constructors, destructor, assignment operator. + + complex(value_type __x = 0.0, value_type __y = 0.0) + : _M_re(__x), _M_im(__y) {} + + complex(const complex& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} + inline complex(const complex& __z); +#if !defined (_STLP_NO_LONG_DOUBLE) + explicit inline complex(const complex& __z); +#endif + // Element access. + value_type real() const { return _M_re; } + value_type imag() const { return _M_im; } + + // Arithmetic op= operations involving one real argument. + + _Self& operator= (value_type __x) { + _M_re = __x; + _M_im = 0.0; + return *this; + } + _Self& operator+= (value_type __x) { + _M_re += __x; + return *this; + } + _Self& operator-= (value_type __x) { + _M_re -= __x; + return *this; + } + _Self& operator*= (value_type __x) { + _M_re *= __x; + _M_im *= __x; + return *this; + } + _Self& operator/= (value_type __x) { + _M_re /= __x; + _M_im /= __x; + return *this; + } + + // Arithmetic op= operations involving two complex arguments. + + static void _STLP_CALL _div(const double& __z1_r, const double& __z1_i, + const double& __z2_r, const double& __z2_i, + double& __res_r, double& __res_i); + static void _STLP_CALL _div(const double& __z1_r, + const double& __z2_r, const double& __z2_i, + double& __res_r, double& __res_i); + +#if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + template + complex& operator=(const complex<_Tp2>& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + + template + complex& operator+= (const complex<_Tp2>& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + template + complex& operator-= (const complex<_Tp2>& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + template + complex& operator*= (const complex<_Tp2>& __z) { + double __r = _M_re * __z._M_re - _M_im * __z._M_im; + double __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + template + complex& operator/= (const complex<_Tp2>& __z) { + double __r; + double __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + +#endif /* _STLP_MEMBER_TEMPLATES */ + + _Self& operator=(const _Self& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + + _Self& operator+= (const _Self& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + _Self& operator-= (const _Self& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + _Self& operator*= (const _Self& __z) { + value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; + value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + _Self& operator/= (const _Self& __z) { + value_type __r; + value_type __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + + // Data members. + value_type _M_re; + value_type _M_im; +}; + +#if !defined (_STLP_NO_LONG_DOUBLE) + +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC complex { + typedef long double value_type; + typedef complex _Self; + + // Constructors, destructor, assignment operator. + complex(value_type __x = 0.0l, value_type __y = 0.0l) + : _M_re(__x), _M_im(__y) {} + + complex(const complex& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} + inline complex(const complex& __z); + inline complex(const complex& __z); + + // Element access. + value_type real() const { return _M_re; } + value_type imag() const { return _M_im; } + + // Arithmetic op= operations involving one real argument. + + _Self& operator= (value_type __x) { + _M_re = __x; + _M_im = 0.0l; + return *this; + } + _Self& operator+= (value_type __x) { + _M_re += __x; + return *this; + } + _Self& operator-= (value_type __x) { + _M_re -= __x; + return *this; + } + _Self& operator*= (value_type __x) { + _M_re *= __x; + _M_im *= __x; + return *this; + } + _Self& operator/= (value_type __x) { + _M_re /= __x; + _M_im /= __x; + return *this; + } + + // Arithmetic op= operations involving two complex arguments. + + static void _STLP_CALL _div(const long double& __z1_r, const long double& __z1_i, + const long double& __z2_r, const long double& __z2_i, + long double& __res_r, long double& __res_i); + + static void _STLP_CALL _div(const long double& __z1_r, + const long double& __z2_r, const long double& __z2_i, + long double& __res_r, long double& __res_i); + +# if defined (_STLP_MEMBER_TEMPLATES) && defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + + template + complex& operator=(const complex<_Tp2>& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + + template + complex& operator+= (const complex<_Tp2>& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + template + complex& operator-= (const complex<_Tp2>& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + template + complex& operator*= (const complex<_Tp2>& __z) { + long double __r = _M_re * __z._M_re - _M_im * __z._M_im; + long double __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + template + complex& operator/= (const complex<_Tp2>& __z) { + long double __r; + long double __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + +# endif /* _STLP_MEMBER_TEMPLATES */ + + _Self& operator=(const _Self& __z) { + _M_re = __z._M_re; + _M_im = __z._M_im; + return *this; + } + + _Self& operator+= (const _Self& __z) { + _M_re += __z._M_re; + _M_im += __z._M_im; + return *this; + } + + _Self& operator-= (const _Self& __z) { + _M_re -= __z._M_re; + _M_im -= __z._M_im; + return *this; + } + + _Self& operator*= (const _Self& __z) { + value_type __r = _M_re * __z._M_re - _M_im * __z._M_im; + value_type __i = _M_re * __z._M_im + _M_im * __z._M_re; + _M_re = __r; + _M_im = __i; + return *this; + } + + _Self& operator/= (const _Self& __z) { + value_type __r; + value_type __i; + _div(_M_re, _M_im, __z._M_re, __z._M_im, __r, __i); + _M_re = __r; + _M_im = __i; + return *this; + } + + // Data members. + value_type _M_re; + value_type _M_im; +}; + +#endif /* _STLP_NO_LONG_DOUBLE */ + +// Converting constructors from one of these three specialized types +// to another. + +inline complex::complex(const complex& __z) + : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {} +inline complex::complex(const complex& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} +#ifndef _STLP_NO_LONG_DOUBLE +inline complex::complex(const complex& __z) + : _M_re((float)__z._M_re), _M_im((float)__z._M_im) {} +inline complex::complex(const complex& __z) + : _M_re((double)__z._M_re), _M_im((double)__z._M_im) {} +inline complex::complex(const complex& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} +inline complex::complex(const complex& __z) + : _M_re(__z._M_re), _M_im(__z._M_im) {} +#endif + +// Unary non-member arithmetic operators. + +template +inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z) +{ return __z; } + +template +inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z) +{ return complex<_Tp>(-__z._M_re, -__z._M_im); } + +// Non-member arithmetic operations involving one real argument. + +template +inline complex<_Tp> _STLP_CALL operator+(const _Tp& __x, const complex<_Tp>& __z) +{ return complex<_Tp>(__x + __z._M_re, __z._M_im); } + +template +inline complex<_Tp> _STLP_CALL operator+(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re + __x, __z._M_im); } + +template +inline complex<_Tp> _STLP_CALL operator-(const _Tp& __x, const complex<_Tp>& __z) +{ return complex<_Tp>(__x - __z._M_re, -__z._M_im); } + +template +inline complex<_Tp> _STLP_CALL operator-(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re - __x, __z._M_im); } + +template +inline complex<_Tp> _STLP_CALL operator*(const _Tp& __x, const complex<_Tp>& __z) +{ return complex<_Tp>(__x * __z._M_re, __x * __z._M_im); } + +template +inline complex<_Tp> _STLP_CALL operator*(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re * __x, __z._M_im * __x); } + +template +inline complex<_Tp> _STLP_CALL operator/(const _Tp& __x, const complex<_Tp>& __z) { + complex<_Tp> __result; + complex<_Tp>::_div(__x, + __z._M_re, __z._M_im, + __result._M_re, __result._M_im); + return __result; +} + +template +inline complex<_Tp> _STLP_CALL operator/(const complex<_Tp>& __z, const _Tp& __x) +{ return complex<_Tp>(__z._M_re / __x, __z._M_im / __x); } + +// Non-member arithmetic operations involving two complex arguments + +template +inline complex<_Tp> _STLP_CALL +operator+(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return complex<_Tp>(__z1._M_re + __z2._M_re, __z1._M_im + __z2._M_im); } + +template +inline complex<_Tp> _STLP_CALL +operator-(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return complex<_Tp>(__z1._M_re - __z2._M_re, __z1._M_im - __z2._M_im); } + +template +inline complex<_Tp> _STLP_CALL +operator*(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { + return complex<_Tp>(__z1._M_re * __z2._M_re - __z1._M_im * __z2._M_im, + __z1._M_re * __z2._M_im + __z1._M_im * __z2._M_re); +} + +template +inline complex<_Tp> _STLP_CALL +operator/(const complex<_Tp>& __z1, const complex<_Tp>& __z2) { + complex<_Tp> __result; + complex<_Tp>::_div(__z1._M_re, __z1._M_im, + __z2._M_re, __z2._M_im, + __result._M_re, __result._M_im); + return __result; +} + +// Comparison operators. + +template +inline bool _STLP_CALL operator==(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return __z1._M_re == __z2._M_re && __z1._M_im == __z2._M_im; } + +template +inline bool _STLP_CALL operator==(const complex<_Tp>& __z, const _Tp& __x) +{ return __z._M_re == __x && __z._M_im == 0; } + +template +inline bool _STLP_CALL operator==(const _Tp& __x, const complex<_Tp>& __z) +{ return __x == __z._M_re && 0 == __z._M_im; } + +//04/27/04 dums: removal of this check, if it is restablish +//please explain why the other operators are not macro guarded +//#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER + +template +inline bool _STLP_CALL operator!=(const complex<_Tp>& __z1, const complex<_Tp>& __z2) +{ return __z1._M_re != __z2._M_re || __z1._M_im != __z2._M_im; } + +//#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ + +template +inline bool _STLP_CALL operator!=(const complex<_Tp>& __z, const _Tp& __x) +{ return __z._M_re != __x || __z._M_im != 0; } + +template +inline bool _STLP_CALL operator!=(const _Tp& __x, const complex<_Tp>& __z) +{ return __x != __z._M_re || 0 != __z._M_im; } + +// Other basic arithmetic operations +template +inline _Tp _STLP_CALL real(const complex<_Tp>& __z) +{ return __z._M_re; } + +template +inline _Tp _STLP_CALL imag(const complex<_Tp>& __z) +{ return __z._M_im; } + +template +_Tp _STLP_CALL abs(const complex<_Tp>& __z); + +template +_Tp _STLP_CALL arg(const complex<_Tp>& __z); + +template +inline _Tp _STLP_CALL norm(const complex<_Tp>& __z) +{ return __z._M_re * __z._M_re + __z._M_im * __z._M_im; } + +template +inline complex<_Tp> _STLP_CALL conj(const complex<_Tp>& __z) +{ return complex<_Tp>(__z._M_re, -__z._M_im); } + +template +complex<_Tp> _STLP_CALL polar(const _Tp& __rho) +{ return complex<_Tp>(__rho, 0); } + +template +complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi); + +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC float _STLP_CALL abs(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC double _STLP_CALL abs(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC float _STLP_CALL arg(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC double _STLP_CALL arg(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const float& __rho, const float& __phi); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const double& __rho, const double& __phi); + +template +_Tp _STLP_CALL abs(const complex<_Tp>& __z) +{ return _Tp(abs(complex(double(__z.real()), double(__z.imag())))); } + +template +_Tp _STLP_CALL arg(const complex<_Tp>& __z) +{ return _Tp(arg(complex(double(__z.real()), double(__z.imag())))); } + +template +complex<_Tp> _STLP_CALL polar(const _Tp& __rho, const _Tp& __phi) { + complex __tmp = polar(double(__rho), double(__phi)); + return complex<_Tp>(_Tp(__tmp.real()), _Tp(__tmp.imag())); +} + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC long double _STLP_CALL arg(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC long double _STLP_CALL abs(const complex&); +_STLP_TEMPLATE_NULL +_STLP_DECLSPEC complex _STLP_CALL polar(const long double&, const long double&); +#endif + + +#if !defined (_STLP_USE_NO_IOSTREAMS) + +_STLP_END_NAMESPACE + +# ifndef _STLP_INTERNAL_IOSFWD +# include +# endif + +_STLP_BEGIN_NAMESPACE + +// Complex output, in the form (re,im). We use a two-step process +// involving stringstream so that we get the padding right. +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __z); + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __z); + +// Specializations for narrow characters; lets us avoid widen. + +_STLP_OPERATOR_TEMPLATE +_STLP_DECLSPEC basic_istream >& _STLP_CALL +operator>>(basic_istream >& __is, complex& __z); + +_STLP_OPERATOR_TEMPLATE +_STLP_DECLSPEC basic_istream >& _STLP_CALL +operator>>(basic_istream >& __is, complex& __z); + +_STLP_OPERATOR_TEMPLATE +_STLP_DECLSPEC basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __is, const complex& __z); + +_STLP_OPERATOR_TEMPLATE +_STLP_DECLSPEC basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __is, const complex& __z); + +# if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_OPERATOR_TEMPLATE +_STLP_DECLSPEC basic_istream >& _STLP_CALL +operator>>(basic_istream >& __is, complex& __z); + +_STLP_OPERATOR_TEMPLATE +_STLP_DECLSPEC basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __is, const complex& __z); + +# endif + +# if defined (_STLP_USE_TEMPLATE_EXPORT) && ! defined (_STLP_NO_WCHAR_T) + +_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); +_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); +_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); +_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); + +# if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_EXPORT_TEMPLATE basic_istream >& _STLP_CALL +operator>>(basic_istream >&, complex&); +_STLP_EXPORT_TEMPLATE basic_ostream >& _STLP_CALL +operator<<(basic_ostream >&, const complex&); +# endif +# endif +#endif + + +// Transcendental functions. These are defined only for float, +// double, and long double. (Sqrt isn't transcendental, of course, +// but it's included in this section anyway.) + +_STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL exp(const complex&); +_STLP_DECLSPEC complex _STLP_CALL log(const complex&); +_STLP_DECLSPEC complex _STLP_CALL log10(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, int); +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const float&); +_STLP_DECLSPEC complex _STLP_CALL pow(const float&, const complex&); +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sin(const complex&); +_STLP_DECLSPEC complex _STLP_CALL cos(const complex&); +_STLP_DECLSPEC complex _STLP_CALL tan(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); +_STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); +_STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL exp(const complex&); +_STLP_DECLSPEC complex _STLP_CALL log(const complex&); +_STLP_DECLSPEC complex _STLP_CALL log10(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, int); +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const double&); +_STLP_DECLSPEC complex _STLP_CALL pow(const double&, const complex&); +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sin(const complex&); +_STLP_DECLSPEC complex _STLP_CALL cos(const complex&); +_STLP_DECLSPEC complex _STLP_CALL tan(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); +_STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); +_STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); + +#if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_DECLSPEC complex _STLP_CALL sqrt(const complex&); +_STLP_DECLSPEC complex _STLP_CALL exp(const complex&); +_STLP_DECLSPEC complex _STLP_CALL log(const complex&); +_STLP_DECLSPEC complex _STLP_CALL log10(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, int); +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, const long double&); +_STLP_DECLSPEC complex _STLP_CALL pow(const long double&, const complex&); +_STLP_DECLSPEC complex _STLP_CALL pow(const complex&, + const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sin(const complex&); +_STLP_DECLSPEC complex _STLP_CALL cos(const complex&); +_STLP_DECLSPEC complex _STLP_CALL tan(const complex&); + +_STLP_DECLSPEC complex _STLP_CALL sinh(const complex&); +_STLP_DECLSPEC complex _STLP_CALL cosh(const complex&); +_STLP_DECLSPEC complex _STLP_CALL tanh(const complex&); +#endif + +_STLP_END_NAMESPACE + +#ifndef _STLP_LINK_TIME_INSTANTIATION +# include +#endif + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_config_compat_post.h b/sdk/tlibstdcxx/stlport/stl/_config_compat_post.h new file mode 100644 index 0000000000..e3b411172c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_config_compat_post.h @@ -0,0 +1,51 @@ +/*========================================== */ +#if 1 /* def _STLP_3_COMPATIBILITY */ + +# define __SGI_STL_PORT _STLPORT_VERSION + +# if defined (_STLP_DEBUG) && ! defined ( __STL_DEBUG ) +# define __STL_DEBUG _STLP_DEBUG +# endif + +# if defined (_STLP_USE_NAMESPACES) +# undef __STL_USE_NAMESPACES +# define __STL_USE_NAMESPACES _STLP_USE_NAMESPACES +# endif + +# if defined (_STLP_USE_EXCEPTIONS) +# undef __STL_USE_EXCEPTIONS +# define __STL_USE_EXCEPTIONS _STLP_USE_EXCEPTIONS +# endif + +# if defined (_STLP_BEGIN_NAMESPACE) && ! defined ( __STL_BEGIN_NAMESPACE ) +# define __STL_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE +# define __STL_END_NAMESPACE _STLP_END_NAMESPACE +# define __STL_VENDOR_STD _STLP_VENDOR_STD +# define __STL_VENDOR_CSTD _STLP_VENDOR_CSTD +# endif +# endif + +/* +# if defined (_STLP_XXX) && ! defined ( __STL_XXX ) +# define __STL_XXX _STLP_XXX +# endif +*/ + +/* 5.0 -> 4.6 compatibility section */ +#if 1 /* def _STLP_46_COMPATIBILITY */ + +/* provide a uniform way to access full functionality */ +# define __slist__ slist +# define __map__ map +# define __multimap__ multimap +# define __set__ set +# define __multiset__ multiset +# define __list__ list +# define __hash_map__ hash_map +# define __hash_multimap__ hash_multimap +# define __hash_set__ hash_set +# define __hash_multiset__ hash_multiset +# define __vector__ vector + +#endif + diff --git a/sdk/tlibstdcxx/stlport/stl/_construct.h b/sdk/tlibstdcxx/stlport/stl/_construct.h new file mode 100644 index 0000000000..5356b91d7b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_construct.h @@ -0,0 +1,289 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +#define _STLP_INTERNAL_CONSTRUCT_H + +#if !defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_INTERNAL_CSTRING) +# include +#endif + +#ifndef _STLP_INTERNAL_NEW +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +#ifndef _STLP_TYPE_TRAITS_H +# include +#endif + +#if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +inline void __destroy_aux(_Tp* __pointer, const __false_type& /*_Trivial_destructor*/) +{ __pointer->~_Tp(); } + +template +inline void __destroy_aux(_Tp*, const __true_type& /*_Trivial_destructor*/) {} + +template +inline void _Destroy(_Tp* __pointer) { + typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor; + __destroy_aux(__pointer, _Trivial_destructor()); +#if defined (_STLP_DEBUG_UNINITIALIZED) + memset(__REINTERPRET_CAST(char*, __pointer), _STLP_SHRED_BYTE, sizeof(_Tp)); +#endif +} + +template +inline void _Destroy_Moved(_Tp* __pointer) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::complete _Trivial_destructor; + __destroy_aux(__pointer, _Trivial_destructor()); +# if defined (_STLP_DEBUG_UNINITIALIZED) + memset((char*)__pointer, _STLP_SHRED_BYTE, sizeof(_Tp)); +# endif +#else + _Destroy(__pointer); +#endif +} + +#if defined (new) +# define _STLP_NEW_REDEFINE new +# undef new +#endif + +template +inline void _Construct_aux (_T1* __p, const __false_type&) { + new(__p) _T1(); +} + +template +inline void _Construct_aux (_T1* __p, const __true_type&) { +#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG) + *__p = _T1(0); +#else + // We use binary copying for POD types since it results + // in a considerably better code at least on MSVC. + *__p = _T1(); +#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */ +} + +template +inline void _Construct(_T1* __p) { +#if defined (_STLP_DEBUG_UNINITIALIZED) + memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1)); +#endif +#if defined (_STLP_DEF_CONST_PLCT_NEW_BUG) + _Construct_aux (__p, _HasDefaultZeroValue(__p)._Answer()); +#else + _Construct_aux (__p, _Is_POD(__p)._Answer()); +#endif /* _STLP_DEF_CONST_PLCT_NEW_BUG */ +} + +template +inline void _Copy_Construct_aux(_Tp* __p, const _Tp& __val, const __false_type&) { + ::new(__p) _Tp(__val); +} + +template +inline void _Copy_Construct_aux(_Tp* __p, const _Tp& __val, const __true_type&) { + // We use binary copying for POD types since it results + // in a considerably better code at least on MSVC. + *__p = __val; +} + +template +inline void _Copy_Construct(_Tp* __p, const _Tp& __val) { +#if defined (_STLP_DEBUG_UNINITIALIZED) + memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_Tp)); +#endif + _Copy_Construct_aux(__p, __val, _Is_POD(__p)._Answer()); +} + +template +inline void _Param_Construct_aux(_T1* __p, const _T2& __val, const __false_type&) { + new(__p) _T1(__val); +} + +template +inline void _Param_Construct_aux(_T1* __p, const _T2& __val, const __true_type&) { + // We use binary copying for POD types since it results + // in a considerably better code at least on MSVC. + *__p = _T1(__val); +} + +template +inline void _Param_Construct(_T1* __p, const _T2& __val) { +#if defined (_STLP_DEBUG_UNINITIALIZED) + memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1)); +#endif + _Param_Construct_aux(__p, __val, _Is_POD(__p)._Answer()); +} + +template +inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __false_type& /*_IsPOD*/) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + new(__p) _T1(_STLP_PRIV _AsMoveSource(__val)); +#else + _Param_Construct(__p, __val); +#endif +} + +template +inline void _Move_Construct_Aux(_T1* __p, _T2& __val, const __true_type& /*_IsPOD*/) { + // We use binary copying for POD types since it results + // in a considerably better code at least on MSVC. + *__p = _T1(__val); +} + +template +inline void _Move_Construct(_T1* __p, _T2& __val) { +#if defined (_STLP_DEBUG_UNINITIALIZED) + memset((char*)__p, _STLP_SHRED_BYTE, sizeof(_T1)); +#endif + _Move_Construct_Aux(__p, __val, _Is_POD(__p)._Answer()); +} + +#if defined(_STLP_NEW_REDEFINE) +# if defined (DEBUG_NEW) +# define new DEBUG_NEW +# endif +# undef _STLP_NEW_REDEFINE +#endif + +template +_STLP_INLINE_LOOP void +__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __false_type& /*_Trivial_destructor*/) { + for ( ; __first != __last; ++__first) { + __destroy_aux(&(*__first), __false_type()); +#if defined (_STLP_DEBUG_UNINITIALIZED) + memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp)); +#endif + } +} + +template +#if defined (_STLP_DEBUG_UNINITIALIZED) +_STLP_INLINE_LOOP void +__destroy_range_aux(_ForwardIterator __first, _ForwardIterator __last, _Tp*, const __true_type& /*_Trivial_destructor*/) { + for ( ; __first != __last; ++__first) + memset((char*)&(*__first), _STLP_SHRED_BYTE, sizeof(_Tp)); +} +#else +inline void +__destroy_range_aux(_ForwardIterator, _ForwardIterator, _Tp*, const __true_type& /*_Trivial_destructor*/) {} +#endif + +template +inline void +__destroy_range(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) { + typedef typename __type_traits<_Tp>::has_trivial_destructor _Trivial_destructor; + __destroy_range_aux(__first, __last, __ptr, _Trivial_destructor()); +} + +template +inline void _Destroy_Range(_ForwardIterator __first, _ForwardIterator __last) { + __destroy_range(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); +} + +inline void _Destroy_Range(char*, char*) {} +#if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97 +inline void _Destroy_Range(wchar_t*, wchar_t*) {} +inline void _Destroy_Range(const wchar_t*, const wchar_t*) {} +#endif + +#if !defined (_STLP_NO_MOVE_SEMANTIC) +template +inline void +__destroy_mv_srcs(_ForwardIterator __first, _ForwardIterator __last, _Tp *__ptr) { + typedef typename __move_traits<_Tp>::complete _CompleteMove; + __destroy_range_aux(__first, __last, __ptr, _CompleteMove()); +} +#endif + +template +inline void _Destroy_Moved_Range(_ForwardIterator __first, _ForwardIterator __last) +#if !defined (_STLP_NO_MOVE_SEMANTIC) +{ __destroy_mv_srcs(__first, __last, _STLP_VALUE_TYPE(__first, _ForwardIterator)); } +#else +{ _Destroy_Range(__first, __last); } +#endif + +#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG) +// Those adaptors are here to fix common compiler bug regarding builtins: +// expressions like int k = int() should initialize k to 0 +template +inline _Tp __default_constructed_aux(_Tp*, const __false_type&) { + return _Tp(); +} +template +inline _Tp __default_constructed_aux(_Tp*, const __true_type&) { + return _Tp(0); +} + +template +inline _Tp __default_constructed(_Tp* __p) { + return __default_constructed_aux(__p, _HasDefaultZeroValue(__p)._Answer()); +} + +# define _STLP_DEFAULT_CONSTRUCTED(_TTp) __default_constructed((_TTp*)0) +#else +# define _STLP_DEFAULT_CONSTRUCTED(_TTp) _TTp() +#endif /* _STLP_DEF_CONST_DEF_PARAM_BUG */ + + +#if !defined (_STLP_NO_ANACHRONISMS) +// -------------------------------------------------- +// Old names from the HP STL. + +template +inline void construct(_T1* __p, const _T2& __val) {_Param_Construct(__p, __val); } +template +inline void construct(_T1* __p) { _STLP_STD::_Construct(__p); } +template +inline void destroy(_Tp* __pointer) { _STLP_STD::_Destroy(__pointer); } +template +inline void destroy(_ForwardIterator __first, _ForwardIterator __last) { _STLP_STD::_Destroy_Range(__first, __last); } +#endif /* _STLP_NO_ANACHRONISMS */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_CONSTRUCT_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_cprolog.h b/sdk/tlibstdcxx/stlport/stl/_cprolog.h new file mode 100644 index 0000000000..1d276562cc --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cprolog.h @@ -0,0 +1,25 @@ +/* NOTE : this header has no guards and is MEANT for multiple inclusion! + * If you are using "header protection" option with your compiler, + * please also find #pragma which disables it and put it here, to + * allow reentrancy of this header. + */ + +#ifdef std +# undef std /* We undef "std" on entry , as STLport headers may include native ones. */ +#endif + +#ifdef _STLP_PROLOG_HEADER_INCLUDED +# error STlport prolog header can not be reincluded as long as epilog has not be included. +#endif + +#define _STLP_PROLOG_HEADER_INCLUDED + +#ifndef _STLP_FEATURES_H +# include +#endif + +/* If the platform provides any specific prolog actions, + * like #pragmas, do include platform-specific prolog file */ +#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) +# include +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_csetjmp.h b/sdk/tlibstdcxx/stlport/stl/_csetjmp.h new file mode 100644 index 0000000000..ca132c1101 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_csetjmp.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CSETJMP +#define _STLP_INTERNAL_CSETJMP + +// if the macro is on, the header is already there +#if !defined (setjmp) +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(csetjmp) +# endif +# else +# include +# endif +#endif + +#if defined (_STLP_IMPORT_VENDOR_CSTD) + +# if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS) +/* For Borland, even if stdjmp.h is included symbols won't be in global namespace + * so we need to reach them in vendor namespace: + */ +# undef _STLP_NATIVE_SETJMP_H_INCLUDED +# endif + +_STLP_BEGIN_NAMESPACE +# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED) +using _STLP_VENDOR_CSTD::jmp_buf; +# else +// if setjmp.h was included first, this is in global namespace, not in +// vendor's std. - 2005-08-04, ptr +using ::jmp_buf; +# endif +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +# if !defined (setjmp) +# if !defined (__MSL__) || ((__MSL__ > 0x7001) && (__MSL__ < 0x8000)) +# ifndef _STLP_NATIVE_SETJMP_H_INCLUDED +using _STLP_VENDOR_CSTD::setjmp; +# else +using ::setjmp; +# endif +# endif +# endif +# if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED) +using _STLP_VENDOR_CSTD::longjmp; +# else +using ::longjmp; +# endif +# endif +_STLP_END_NAMESPACE +#endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_csignal.h b/sdk/tlibstdcxx/stlport/stl/_csignal.h new file mode 100644 index 0000000000..551846b385 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_csignal.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CSIGNAL +#define _STLP_INTERNAL_CSIGNAL + +#if !defined (_STLP_WCE) +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(csignal) +# endif +# else +# include +# endif + +# if defined (_STLP_IMPORT_VENDOR_CSTD) +_STLP_BEGIN_NAMESPACE +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +using _STLP_VENDOR_CSTD::signal; +using _STLP_VENDOR_CSTD::raise; +# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ +using _STLP_VENDOR_CSTD::sig_atomic_t; +_STLP_END_NAMESPACE +# endif /* _STLP_IMPORT_VENDOR_CSTD */ +#endif + +#endif /* _STLP_INTERNAL_CSIGNAL */ diff --git a/sdk/tlibstdcxx/stlport/stl/_cstdarg.h b/sdk/tlibstdcxx/stlport/stl/_cstdarg.h new file mode 100644 index 0000000000..e98f31cd5a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cstdarg.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +#ifndef _STLP_INTERNAL_CSTDARG +#define _STLP_INTERNAL_CSTDARG + +#if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdarg) +# endif +#else +# include +#endif + +#ifdef _STLP_IMPORT_VENDOR_CSTD +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::va_list; +_STLP_END_NAMESPACE +#endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_cstddef.h b/sdk/tlibstdcxx/stlport/stl/_cstddef.h new file mode 100644 index 0000000000..35a585c4ee --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cstddef.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CSTDDEF +#define _STLP_INTERNAL_CSTDDEF + +# if (__GNUC__ >= 3) && defined (__CYGWIN__) // this total HACK is the only expedient way I could cygwin to work with GCC 3.0 +# define __need_wint_t // mostly because wint_t didn't seem to get defined otherwise :( +# define __need_wchar_t +# define __need_size_t +# define __need_ptrdiff_t +# define __need_NULL +# endif + +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstddef) +# endif +# else +# include +# endif + +# ifdef _STLP_IMPORT_VENDOR_CSTD +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::ptrdiff_t; +using _STLP_VENDOR_CSTD::size_t; +_STLP_END_NAMESPACE +# endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#endif /* _STLP_INTERNAL_CSTDDEF */ diff --git a/sdk/tlibstdcxx/stlport/stl/_cstdio.h b/sdk/tlibstdcxx/stlport/stl/_cstdio.h new file mode 100644 index 0000000000..e802b5844f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cstdio.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CSTDIO +#define _STLP_INTERNAL_CSTDIO + +#if defined (__Lynx__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(stdarg.h) +# endif +#endif + +#if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdio) +# endif +#else +# include +#endif + +#if defined (__MWERKS__) +# undef stdin +# undef stdout +# undef stderr +# define stdin (&_STLP_VENDOR_CSTD::__files[0]) +# define stdout (&_STLP_VENDOR_CSTD::__files[1]) +# define stderr (&_STLP_VENDOR_CSTD::__files[2]) +#endif + +#if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) +inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v) +{ return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); } +#endif + +#if !defined (_STLP_SGX_CONFIG) +#if defined (_STLP_IMPORT_VENDOR_CSTD ) +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::FILE; +using _STLP_VENDOR_CSTD::fpos_t; +using _STLP_VENDOR_CSTD::size_t; + +// undef obsolete macros +# undef putc +# undef getc +# undef getchar +# undef putchar +# undef feof +# undef ferror + +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +using _STLP_VENDOR_CSTD::clearerr; +using _STLP_VENDOR_CSTD::fclose; +using _STLP_VENDOR_CSTD::feof; +using _STLP_VENDOR_CSTD::ferror; +using _STLP_VENDOR_CSTD::fflush; +using _STLP_VENDOR_CSTD::fgetc; +using _STLP_VENDOR_CSTD::fgetpos; +using _STLP_VENDOR_CSTD::fgets; +using _STLP_VENDOR_CSTD::fopen; +using _STLP_VENDOR_CSTD::fprintf; +using _STLP_VENDOR_CSTD::fputc; +using _STLP_VENDOR_CSTD::fputs; +using _STLP_VENDOR_CSTD::fread; +# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) +using _STLP_VENDOR_CSTD::freopen; +# endif +using _STLP_VENDOR_CSTD::fscanf; +using _STLP_VENDOR_CSTD::fseek; +using _STLP_VENDOR_CSTD::fsetpos; +using _STLP_VENDOR_CSTD::ftell; +using _STLP_VENDOR_CSTD::fwrite; + +# if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500)) +# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) // Supplied as macros, TODO: use inline function to redirect to the macros? + using _STLP_VENDOR_CSTD::getc; + using _STLP_VENDOR_CSTD::putc; +# endif + using _STLP_VENDOR_CSTD::getchar; + using _STLP_VENDOR_CSTD::putchar; +# endif + +using _STLP_VENDOR_CSTD::gets; +# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) +using _STLP_VENDOR_CSTD::perror; +# endif +using _STLP_VENDOR_CSTD::printf; +using _STLP_VENDOR_CSTD::puts; +# if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) +using _STLP_VENDOR_CSTD::remove; +using _STLP_VENDOR_CSTD::rename; +using _STLP_VENDOR_CSTD::rewind; +using _STLP_VENDOR_CSTD::setbuf; +using _STLP_VENDOR_CSTD::tmpfile; +using _STLP_VENDOR_CSTD::tmpnam; +# endif +using _STLP_VENDOR_CSTD::scanf; +using _STLP_VENDOR_CSTD::setvbuf; +using _STLP_VENDOR_CSTD::sprintf; +using _STLP_VENDOR_CSTD::sscanf; +using _STLP_VENDOR_CSTD::ungetc; +using _STLP_VENDOR_CSTD::vfprintf; +using _STLP_VENDOR_CSTD::vprintf; +using _STLP_VENDOR_CSTD::vsprintf; +# if (defined (__MWERKS__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \ + (defined (__BORLANDC__))) +using _STLP_VENDOR_CSTD::vsnprintf; +# endif +# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ +_STLP_END_NAMESPACE +#endif /* _STLP_IMPORT_VENDOR_CSTD */ +#endif /* !STLP_SE1_CONFIG */ + +#endif /* _STLP_INTERNAL_CSTDIO */ diff --git a/sdk/tlibstdcxx/stlport/stl/_cstdlib.h b/sdk/tlibstdcxx/stlport/stl/_cstdlib.h new file mode 100644 index 0000000000..b5f0ee9df8 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cstdlib.h @@ -0,0 +1,188 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CSTDLIB +#define _STLP_INTERNAL_CSTDLIB + +#if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) +# endif +#else +# include +#endif + +#if defined (__BORLANDC__) && !defined (__linux__) +/* Borland process.h header do not bring anything here and is just included + * in order to avoid inclusion later. This header cannot be included later + * because Borland compiler consider that for instance the abort function + * defined as extern "C" cannot be overloaded and it finds 2 "overloads", + * once in native std namespace and the other in STLport namespace... + */ +# include +#endif + +/* on evc3/evc4 including stdlib.h also defines setjmp macro */ +#if defined (_STLP_WCE) +# define _STLP_NATIVE_SETJMP_H_INCLUDED +#endif + +#if defined (__MSL__) && (__MSL__ <= 0x5003) +namespace std { + typedef ::div_t div_t; + typedef ::ldiv_t ldiv_t; +# ifdef __MSL_LONGLONG_SUPPORT__ + typedef ::lldiv_t lldiv_t; +# endif +} +#endif + +#ifdef _STLP_IMPORT_VENDOR_CSTD +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::div_t; +using _STLP_VENDOR_CSTD::ldiv_t; +using _STLP_VENDOR_CSTD::size_t; + +# ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS +# ifndef _STLP_WCE +// these functions just don't exist on Windows CE +using _STLP_VENDOR_CSTD::abort; +#if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::getenv; +using _STLP_VENDOR_CSTD::mblen; +using _STLP_VENDOR_CSTD::mbtowc; +using _STLP_VENDOR_CSTD::system; +# endif /* !_STLP_SGX_CONFIG */ +using _STLP_VENDOR_CSTD::bsearch; +# endif +#if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::atexit; +using _STLP_VENDOR_CSTD::exit; +# endif /* !_STLP_SGX_CONFIG */ +using _STLP_VENDOR_CSTD::calloc; +using _STLP_VENDOR_CSTD::free; +using _STLP_VENDOR_CSTD::malloc; +using _STLP_VENDOR_CSTD::realloc; +using _STLP_VENDOR_CSTD::atof; +using _STLP_VENDOR_CSTD::atoi; +using _STLP_VENDOR_CSTD::atol; +#if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::mbstowcs; +# endif /* !_STLP_SGX_CONFIG */ +using _STLP_VENDOR_CSTD::strtod; +using _STLP_VENDOR_CSTD::strtol; +using _STLP_VENDOR_CSTD::strtoul; + +# if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_NATIVE_MBSTATE_T)) +using _STLP_VENDOR_CSTD::wcstombs; +# ifndef _STLP_WCE +using _STLP_VENDOR_CSTD::wctomb; +# endif +# endif +using _STLP_VENDOR_CSTD::qsort; +using _STLP_VENDOR_CSTD::labs; +using _STLP_VENDOR_CSTD::ldiv; +# if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L) +# if !defined(__sun) +using _STLP_VENDOR_CSTD::llabs; +using _STLP_VENDOR_CSTD::lldiv_t; +using _STLP_VENDOR_CSTD::lldiv; +# else +using ::llabs; +using ::lldiv_t; +using ::lldiv; +# endif +# endif +#if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::rand; +using _STLP_VENDOR_CSTD::srand; +# endif /* !_STLP_SGX_CONFIG */ +# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ +_STLP_END_NAMESPACE +#endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS) +//In this config bcc define everything in std namespace and not in +//the global one. +inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); } +inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); } +#endif + +#if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) +# define _STLP_RESTORE_FUNCTION_INTRINSIC +# pragma warning (push) +# pragma warning (disable: 4162) +# pragma function (abs) +#endif + +//HP-UX native lib has abs() and div() functions in global namespace +#if !defined (__SUNPRO_CC) && \ + (!defined (__HP_aCC) || (__HP_aCC < 30000)) + +//MSVC starting with .Net 2003 already define all math functions in global namespace: +# if defined (_STLP_SGX_CONFIG) || !defined (__WATCOMC__) && \ + (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined (UNDER_CE)) +inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); } +# endif + +/** VC since version 8 has this, the platform SDK and CE SDKs hanging behind. */ +# if defined (_STLP_SGX_CONFIG) || !defined (__WATCOMC__) && \ + (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined (UNDER_CE)) +inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); } +# endif + +#endif + +#if defined (_STLP_RESTORE_FUNCTION_INTRINSIC) +# pragma intrinsic (abs) +# pragma warning (pop) +# undef _STLP_RESTORE_FUNCTION_INTRINSIC +#endif + +#if defined (_STLP_LONG_LONG) +# if !defined (_STLP_NO_VENDOR_STDLIB_L) +# if !defined (__sun) +inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); } +inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); } +# else +inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); } +inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); } +# endif +# else +inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; } +# endif +#endif + +/* C++ Standard is unclear about several call to 'using ::func' if new overloads + * of ::func appears between 2 successive 'using' calls. To avoid this potential + * problem we provide all abs overload before the 'using' call. + * Beware: This header inclusion has to be after all abs overload of this file. + * The first 'using ::abs' call is going to be in the other header. + */ +#ifndef _STLP_INTERNAL_CMATH +# include +#endif + +#if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +// ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05 +_STLP_BEGIN_NAMESPACE +using ::abs; +using ::div; +_STLP_END_NAMESPACE +#endif + +#endif /* _STLP_INTERNAL_CSTDLIB */ diff --git a/sdk/tlibstdcxx/stlport/stl/_cstring.h b/sdk/tlibstdcxx/stlport/stl/_cstring.h new file mode 100644 index 0000000000..fe0fd5fe43 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cstring.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CSTRING +#define _STLP_INTERNAL_CSTRING + +#if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstring) +# endif +#else +# include +#endif + +#ifdef _STLP_IMPORT_VENDOR_CSTD +_STLP_BEGIN_NAMESPACE +# include +_STLP_END_NAMESPACE +#endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#endif /* _STLP_INTERNAL_CSTRING */ diff --git a/sdk/tlibstdcxx/stlport/stl/_ctime.h b/sdk/tlibstdcxx/stlport/stl/_ctime.h new file mode 100644 index 0000000000..27bb2664eb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ctime.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CTIME +#define _STLP_INTERNAL_CTIME + +#if !defined (_STLP_WCE_EVC3) + +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(ctime) +# endif +# else +# include +# endif + +# if defined (_STLP_IMPORT_VENDOR_CSTD) +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD::size_t; +using _STLP_VENDOR_CSTD::clock_t; +using _STLP_VENDOR_CSTD::time_t; +using _STLP_VENDOR_CSTD::tm; +# if !defined (_STLP_SGX_CONFIG) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +using _STLP_VENDOR_CSTD::clock; +using _STLP_VENDOR_CSTD::asctime; +using _STLP_VENDOR_CSTD::ctime; +using _STLP_VENDOR_CSTD::gmtime; + +# if !defined (_WIN32_WCE) || (_WIN32_WCE < 0x500) // CE5 stopped supplying this +using _STLP_VENDOR_CSTD::difftime; +# endif +using _STLP_VENDOR_CSTD::mktime; +using _STLP_VENDOR_CSTD::localtime; +using _STLP_VENDOR_CSTD::strftime; +using _STLP_VENDOR_CSTD::time; +# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ + +_STLP_END_NAMESPACE +# endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#endif + +#endif /* _STLP_INTERNAL_CTIME */ diff --git a/sdk/tlibstdcxx/stlport/stl/_ctraits_fns.h b/sdk/tlibstdcxx/stlport/stl/_ctraits_fns.h new file mode 100644 index 0000000000..e4a4af109b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ctraits_fns.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + +#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H +#define _STLP_INTERNAL_CTRAITS_FUNCTIONS_H + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +// This file contains a few small adapters that allow a character +// traits class to be used as a function object. + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Eq_traits + : public binary_function { + bool operator()(const typename _Traits::char_type& __x, + const typename _Traits::char_type& __y) const + { return _Traits::eq(__x, __y); } +}; + +template +struct _Eq_char_bound + : public unary_function { + typename _Traits::char_type __val; + _Eq_char_bound(typename _Traits::char_type __c) : __val(__c) {} + bool operator()(const typename _Traits::char_type& __x) const + { return _Traits::eq(__x, __val); } +}; + +template +struct _Neq_char_bound + : public unary_function +{ + typename _Traits::char_type __val; + _Neq_char_bound(typename _Traits::char_type __c) : __val(__c) {} + bool operator()(const typename _Traits::char_type& __x) const + { return !_Traits::eq(__x, __val); } +}; + +template +struct _Eq_int_bound + : public unary_function { + typename _Traits::int_type __val; + + _Eq_int_bound(typename _Traits::int_type __c) : __val(__c) {} + bool operator()(const typename _Traits::char_type& __x) const + { return _Traits::eq_int_type(_Traits::to_int_type(__x), __val); } +}; + +#if 0 +template +struct _Lt_traits + : public binary_function { + bool operator()(const typename _Traits::char_type& __x, + const typename _Traits::char_type& __y) const + { return _Traits::lt(__x, __y); } +}; +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_CTRAITS_FUNCTIONS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_ctype.h b/sdk/tlibstdcxx/stlport/stl/_ctype.h new file mode 100644 index 0000000000..33a5d3cbed --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ctype.h @@ -0,0 +1,280 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + +#ifndef _STLP_INTERNAL_CTYPE_H +#define _STLP_INTERNAL_CTYPE_H + +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +class _STLP_CLASS_DECLSPEC ctype_base { +public: + enum mask { + space = _Locale_SPACE, + print = _Locale_PRINT, + cntrl = _Locale_CNTRL, + upper = _Locale_UPPER, + lower = _Locale_LOWER, + alpha = _Locale_ALPHA, + digit = _Locale_DIGIT, + punct = _Locale_PUNCT, + xdigit = _Locale_XDIGIT, + alnum = alpha | digit, + graph = alnum | punct + }; +}; + +// ctype<> template + +template class ctype {}; +template class ctype_byname {}; + +//ctype specializations + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC ctype : public locale::facet, public ctype_base { +#ifndef _STLP_NO_WCHAR_T +# ifdef _STLP_MSVC + typedef ctype _Wctype; + friend _Wctype; +# else + friend class ctype; +# endif +#endif +public: + + typedef char char_type; + + explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0); + bool is(mask __m, char __c) const + { return ((*(_M_ctype_table+(unsigned char)__c)) & __m) != 0; } + + const char* is(const char* __low, const char* __high, mask* __vec) const { + for (const char* __p = __low;__p != __high; ++__p, ++__vec) { + *__vec = _M_ctype_table[(unsigned char)*__p]; + } + return __high; + } + + const char* scan_is(mask __m, const char* __low, const char* __high) const; + const char* scan_not(mask __m, const char* __low, const char* __high) const; + + char (toupper)(char __c) const { return do_toupper(__c); } + const char* (toupper)(char* __low, const char* __high) const { + return do_toupper(__low, __high); + } + + char (tolower)(char __c) const { return do_tolower(__c); } + const char* (tolower)(char* __low, const char* __high) const { + return do_tolower(__low, __high); + } + + char widen(char __c) const { return do_widen(__c); } + const char* widen(const char* __low, const char* __high, char* __to) const { + return do_widen(__low, __high, __to); + } + + char narrow(char __c, char __dfault) const { + return do_narrow(__c, __dfault); + } + const char* narrow(const char* __low, const char* __high, + char __dfault, char* __to) const { + return do_narrow(__low, __high, __dfault, __to); + } + + static _STLP_STATIC_DECLSPEC locale::id id; + _STLP_STATIC_CONSTANT(size_t, table_size = 256); + +protected: + const mask* table() const _STLP_NOTHROW { return _M_ctype_table; } + static const mask* _STLP_CALL classic_table() _STLP_NOTHROW; + + ~ctype(); + + virtual char do_toupper(char __c) const; + virtual char do_tolower(char __c) const; + virtual const char* do_toupper(char* __low, const char* __high) const; + virtual const char* do_tolower(char* __low, const char* __high) const; + virtual char do_widen(char __c) const; + virtual const char* do_widen(const char* __low, const char* __high, + char* __to) const; + virtual char do_narrow(char __c, char /* dfault */ ) const; + virtual const char* do_narrow(const char* __low, const char* __high, + char /* dfault */, char* __to) const; +private: + struct _Is_mask { + mask __m; + _Is_mask(mask __x): __m(__x) {} + bool operator()(char __c) {return (__m & (unsigned char) __c) != 0;} + }; + +protected: + const mask* _M_ctype_table; +private: + bool _M_delete; +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC ctype_byname: public ctype { + friend class _Locale_impl; +public: + explicit ctype_byname(const char*, size_t = 0); + ~ctype_byname(); + + virtual char do_toupper(char __c) const; + virtual char do_tolower(char __c) const; + + virtual const char* do_toupper(char*, const char*) const; + virtual const char* do_tolower(char*, const char*) const; + +private: + ctype_byname(_Locale_ctype* __ctype) + : _M_ctype(__ctype) + { _M_init(); } + + void _M_init(); + + //explicitely defined as private to avoid warnings: + typedef ctype_byname _Self; + ctype_byname(_Self const&); + _Self& operator = (_Self const&); + + mask _M_byname_table[table_size]; + _Locale_ctype* _M_ctype; +}; + +# ifndef _STLP_NO_WCHAR_T +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC ctype : public locale::facet, public ctype_base { +public: + typedef wchar_t char_type; + + explicit ctype(size_t __refs = 0) : locale::facet(__refs) {} + + bool is(mask __m, wchar_t __c) const + { return do_is(__m, __c); } + + const wchar_t* is(const wchar_t* __low, const wchar_t* __high, + mask* __vec) const + { return do_is(__low, __high, __vec); } + + const wchar_t* scan_is(mask __m, + const wchar_t* __low, const wchar_t* __high) const + { return do_scan_is(__m, __low, __high); } + + const wchar_t* scan_not (mask __m, + const wchar_t* __low, const wchar_t* __high) const + { return do_scan_not(__m, __low, __high); } + + wchar_t (toupper)(wchar_t __c) const { return do_toupper(__c); } + const wchar_t* (toupper)(wchar_t* __low, const wchar_t* __high) const + { return do_toupper(__low, __high); } + + wchar_t (tolower)(wchar_t __c) const { return do_tolower(__c); } + const wchar_t* (tolower)(wchar_t* __low, const wchar_t* __high) const + { return do_tolower(__low, __high); } + + wchar_t widen(char __c) const { return do_widen(__c); } + const char* widen(const char* __low, const char* __high, + wchar_t* __to) const + { return do_widen(__low, __high, __to); } + + char narrow(wchar_t __c, char __dfault) const + { return do_narrow(__c, __dfault); } + const wchar_t* narrow(const wchar_t* __low, const wchar_t* __high, + char __dfault, char* __to) const + { return do_narrow(__low, __high, __dfault, __to); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~ctype(); + + virtual bool do_is(mask __m, wchar_t __c) const; + virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const; + virtual const wchar_t* do_scan_is(mask, + const wchar_t*, const wchar_t*) const; + virtual const wchar_t* do_scan_not(mask, + const wchar_t*, const wchar_t*) const; + virtual wchar_t do_toupper(wchar_t __c) const; + virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const; + virtual wchar_t do_tolower(wchar_t c) const; + virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const; + virtual wchar_t do_widen(char c) const; + virtual const char* do_widen(const char*, const char*, wchar_t*) const; + virtual char do_narrow(wchar_t __c, char __dfault) const; + virtual const wchar_t* do_narrow(const wchar_t*, const wchar_t*, + char, char*) const; +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC ctype_byname: public ctype { + friend class _Locale_impl; +public: + explicit ctype_byname(const char* __name, size_t __refs = 0); + +protected: + ~ctype_byname(); + + virtual bool do_is(mask __m, wchar_t __c) const; + virtual const wchar_t* do_is(const wchar_t*, const wchar_t*, mask*) const; + virtual const wchar_t* do_scan_is(mask, + const wchar_t*, const wchar_t*) const; + virtual const wchar_t* do_scan_not(mask, + const wchar_t*, const wchar_t*) const; + virtual wchar_t do_toupper(wchar_t __c) const; + virtual const wchar_t* do_toupper(wchar_t*, const wchar_t*) const; + virtual wchar_t do_tolower(wchar_t c) const; + virtual const wchar_t* do_tolower(wchar_t*, const wchar_t*) const; + +private: + ctype_byname(_Locale_ctype* __ctype) + : _M_ctype(__ctype) {} + + //explicitely defined as private to avoid warnings: + typedef ctype_byname _Self; + ctype_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_ctype* _M_ctype; +}; + +# endif /* WCHAR_T */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_CTYPE_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_cwchar.h b/sdk/tlibstdcxx/stlport/stl/_cwchar.h new file mode 100644 index 0000000000..d99f2240fc --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cwchar.h @@ -0,0 +1,355 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CWCHAR +#define _STLP_INTERNAL_CWCHAR + +#if defined (_STLP_WCE_EVC3) +# ifndef _STLP_INTERNAL_MBSTATE_T +# include +# endif +#else +# if defined (__GNUC__) && defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cstddef) +# endif +# endif + +# if !defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cwchar) +# endif +# if defined (__OpenBSD__) +typedef _BSD_WINT_T_ wint_t; +# endif /* __OpenBSD__ */ + +# if defined (__DMC__) +# define __STDC_LIMIT_MACROS +# include // WCHAR_MIN, WCHAR_MAX +# endif +# elif defined (_STLP_NO_WCHAR_T) || \ + (defined (__BORLANDC__) && (__BORLANDC__ < 0x570)) || \ + defined (__OpenBSD__) || defined (__FreeBSD__) || \ + (defined (__GNUC__) && (defined (__APPLE__) || defined ( __Lynx__ ))) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(stddef.h) +# endif +# if defined (__Lynx__) +# ifndef _WINT_T +typedef long int wint_t; +# define _WINT_T +# endif /* _WINT_T */ +# endif +# if defined(__OpenBSD__) +typedef _BSD_WINT_T_ wint_t; +# endif /* __OpenBSD__ */ +# else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(wchar.h) +# endif + +# if defined (__sun) && (defined (_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4)) +extern wint_t btowc(); +extern int fwprintf(); +extern int fwscanf(); +extern int fwide(); +extern int mbsinit(); +extern size_t mbrlen(); +extern size_t mbrtowc(); +extern size_t mbsrtowcs(); +extern int swprintf(); +extern int swscanf(); +extern int vfwprintf(); +extern int vwprintf(); +extern int vswprintf(); +extern size_t wcrtomb(); +extern size_t wcsrtombs(); +extern wchar_t *wcsstr(); +extern int wctob(); +extern wchar_t *wmemchr(); +extern int wmemcmp(); +extern wchar_t *wmemcpy(); +extern wchar_t *wmemmove(); +extern wchar_t *wmemset(); +extern int wprintf(); +extern int wscanf(); +# endif +# endif + +# if defined (__MSL__) && (__MSL__ <= 0x51FF) /* dwa 2/28/99 - not yet implemented by MSL */ +# define _STLP_WCHAR_MSL_EXCLUDE 1 +namespace std { + extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr); +} +# define _STLP_NO_NATIVE_MBSTATE_T 1 +# elif defined (__BORLANDC__) +# if !defined (_STLP_USE_NO_IOSTREAMS) +# define _STLP_NO_NATIVE_MBSTATE_T +# endif +# define _STLP_WCHAR_BORLAND_EXCLUDE 1 +# endif + +# ifndef _STLP_INTERNAL_MBSTATE_T +# include +# endif + +# ifdef _STLP_SGX_CONFIG +# include /* WCHAR_MAX WCHAR_MIN */ +# endif + +# if !defined (_STLP_NO_WCHAR_T) +# ifndef WCHAR_MIN +# define WCHAR_MIN 0 +/* SUNpro has some bugs with casts. wchar_t is size of int there anyway. */ +# if defined (__SUNPRO_CC) || defined (__DJGPP) +# define WCHAR_MAX (~0) +# else +# define WCHAR_MAX ((wchar_t)~0) +# endif +# endif +# if defined (__DMC__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || defined(_WIN32_WCE) +/* Compilers that do not define WCHAR_MIN and WCHAR_MAX to be testable at + * preprocessing time. */ +# undef WCHAR_MIN +# define WCHAR_MIN 0 +# undef WCHAR_MAX +# define WCHAR_MAX 0xffff +# endif +# if defined (__GNUC__) && defined (__alpha__) +/* Definition of WCHAR_MIN and MAX are wrong for alpha platform + * as gcc consider wchar_t as an unsigned type but WCHAR_MIN is defined as + * a negative value. Static assertion is here to check that a future alpha + * SDK or a future gcc won't change the situation making this workaround + * useless. + */ +/* Check that gcc still consider wchar_t as unsigned */ +_STLP_STATIC_ASSERT(((wchar_t)-1 > 0)) +/* Check that WCHAR_MIN value hasn't been fixed */ +_STLP_STATIC_ASSERT((WCHAR_MIN < 0)) +# undef WCHAR_MIN +# define WCHAR_MIN 0 +# undef WCHAR_MAX +# define WCHAR_MAX 0xffffffff +# endif +# if defined(__HP_aCC) && (__HP_aCC >= 60000) +/* Starting with B.11.31, HP-UX/ia64 provides C99-compliant definitions + * of WCHAR_MIN/MAX macros without having to define + * _INCLUDE_STDC__SOURCE_199901 macro (which aCC compiler does not + * predefine). Let STLport provide B.11.31 definitions on any version of + * HP-UX/ia64. + */ +# undef WCHAR_MIN +# define WCHAR_MIN 0 +# undef WCHAR_MAX +# define WCHAR_MAX UINT_MAX +# endif +# endif + +# if defined (_STLP_IMPORT_VENDOR_CSTD) + +# if defined (__SUNPRO_CC) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) +using _STLP_VENDOR_CSTD::wint_t; +# endif + +_STLP_BEGIN_NAMESPACE +# if defined (_STLP_NO_WCHAR_T) +typedef int wint_t; +# else +// gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined +// __MWERKS__ has definition in wchar_t.h (MSL C++), but ones differ from definition +// in stdio.h; I prefer settings from last file. +# if (defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T)) +using ::wint_t; +# else +using _STLP_VENDOR_CSTD::wint_t; +# endif +# endif + +using _STLP_VENDOR_CSTD::size_t; + +# if !defined (_STLP_NO_NATIVE_MBSTATE_T) && !defined (_STLP_USE_OWN_MBSTATE_T) +using _STLP_VENDOR_MB_NAMESPACE::mbstate_t; + +# if !defined (_STLP_SGX_CONFIG) +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) && \ + (!defined(__MSL__) || __MSL__ > 0x6001) +# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \ + !(defined (__KCC) || defined (__GNUC__)) && !defined(_STLP_WCE_NET) +using _STLP_VENDOR_MB_NAMESPACE::btowc; +# if (!defined(__MSL__) || __MSL__ > 0x7001) +using _STLP_VENDOR_MB_NAMESPACE::mbsinit; +# endif +# endif +# if defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))) || \ + !defined (__GNUC__) && !defined(_STLP_WCE_NET) +using _STLP_VENDOR_MB_NAMESPACE::mbrlen; +using _STLP_VENDOR_MB_NAMESPACE::mbrtowc; +using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs; +using _STLP_VENDOR_MB_NAMESPACE::wcrtomb; +using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs; +# endif +# endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */ +# endif /* !_STLP_SGX_CONFIG */ +# endif /* _STLP_NO_NATIVE_MBSTATE_T */ + +# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) + +# if !defined (_STLP_SGX_CONFIG) && !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +using _STLP_VENDOR_CSTD::fgetwc; +using _STLP_VENDOR_CSTD::fgetws; +using _STLP_VENDOR_CSTD::fputwc; +using _STLP_VENDOR_CSTD::fputws; +# endif + +# if !defined (_STLP_SGX_CONFIG) && !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \ + defined(_STLP_WCHAR_HPACC_EXCLUDE) ) +# if !defined (__DECCXX) +using _STLP_VENDOR_CSTD::fwide; +# endif +using _STLP_VENDOR_CSTD::fwprintf; +using _STLP_VENDOR_CSTD::fwscanf; +using _STLP_VENDOR_CSTD::getwchar; +# endif + +# if !defined (_STLP_SGX_CONFIG) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) +# ifndef _STLP_WCE_NET +using _STLP_VENDOR_CSTD::getwc; +# endif +using _STLP_VENDOR_CSTD::ungetwc; +# ifndef _STLP_WCE_NET +using _STLP_VENDOR_CSTD::putwc; +# endif +using _STLP_VENDOR_CSTD::putwchar; +# endif + +# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) || \ + defined (_STLP_WCHAR_HPACC_EXCLUDE) ) +# if !defined (_STLP_SGX_CONFIG) +# if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB <= 1300) || \ + defined (__MINGW32__) +# undef swprintf +# define swprintf _snwprintf +# undef vswprintf +# define vswprintf _vsnwprintf +using ::swprintf; +using ::vswprintf; +# else +using _STLP_VENDOR_CSTD::swprintf; +using _STLP_VENDOR_CSTD::vswprintf; +# endif +using _STLP_VENDOR_CSTD::swscanf; +using _STLP_VENDOR_CSTD::vfwprintf; +using _STLP_VENDOR_CSTD::vwprintf; +# endif + +# if !defined (_STLP_SGX_CONFIG) && (!defined(__MSL__) || __MSL__ > 0x7001 ) && !defined(_STLP_WCE_NET) && \ + !defined(_STLP_USE_UCLIBC) /* at least in uClibc 0.9.26 */ + +using _STLP_VENDOR_CSTD::wcsftime; +# endif +using _STLP_VENDOR_CSTD::wcstok; + +# endif + +# if !defined (_STLP_WCE_NET) +using _STLP_VENDOR_CSTD::wcscoll; +using _STLP_VENDOR_CSTD::wcsxfrm; +# endif +# if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::wcscat; +# endif +using _STLP_VENDOR_CSTD::wcsrchr; +using _STLP_VENDOR_CSTD::wcscmp; + +# if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::wcscpy; +# endif +using _STLP_VENDOR_CSTD::wcscspn; + +using _STLP_VENDOR_CSTD::wcslen; +using _STLP_VENDOR_CSTD::wcsncat; +using _STLP_VENDOR_CSTD::wcsncmp; +using _STLP_VENDOR_CSTD::wcsncpy; +using _STLP_VENDOR_CSTD::wcspbrk; +using _STLP_VENDOR_CSTD::wcschr; + +using _STLP_VENDOR_CSTD::wcsspn; + +# if !defined (_STLP_SGX_CONFIG) && !defined (_STLP_WCHAR_BORLAND_EXCLUDE) +using _STLP_VENDOR_CSTD::wcstod; +using _STLP_VENDOR_CSTD::wcstol; +# endif + +# if !(defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_HPACC_EXCLUDE) ) +using _STLP_VENDOR_CSTD::wcsstr; +using _STLP_VENDOR_CSTD::wmemchr; + +# if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) +# if !defined (_STLP_SGX_CONFIG) && !defined (_STLP_WCE_NET) +using _STLP_VENDOR_CSTD::wctob; +# endif +# if !defined (__DMC__) +using _STLP_VENDOR_CSTD::wmemcmp; +using _STLP_VENDOR_CSTD::wmemmove; +# endif +# if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::wprintf; +using _STLP_VENDOR_CSTD::wscanf; +# endif +# endif + +# if defined (__BORLANDC__) && !defined (__linux__) +inline wchar_t* _STLP_wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n) +{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::wmemcpy(__wdst, __wsrc, __n)); } +inline wchar_t* _STLP_wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) +{ return __STATIC_CAST(wchar_t*, _STLP_VENDOR_CSTD::memset(__wdst, __wc, __n)); } +# undef wmemcpy +# undef wmemset +inline wchar_t* wmemcpy(wchar_t* __wdst, const wchar_t* __wsrc, size_t __n) +{ return _STLP_wmemcpy(__wdst, __wsrc, __n); } +inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) +{ return _STLP_wmemset(__wdst, __wc, __n); } +# elif defined (__DMC__) +inline wchar_t* wmemcpy(wchar_t* __RESTRICT __wdst, const wchar_t* __RESTRICT __wsrc, size_t __n) +{ return __STATIC_CAST(wchar_t*, memcpy(__wdst, __wsrc, __n * sizeof(wchar_t))); } +inline wchar_t* wmemmove(wchar_t* __RESTRICT __wdst, const wchar_t * __RESTRICT __wc, size_t __n) +{ return __STATIC_CAST(wchar_t*, memmove(__wdst, __wc, __n * sizeof(wchar_t))); } +inline wchar_t* wmemset(wchar_t* __wdst, wchar_t __wc, size_t __n) +{ for (size_t i = 0; i < __n; i++) __wdst[i] = __wc; return __wdst; } +# else +using _STLP_VENDOR_CSTD::wmemcpy; +using _STLP_VENDOR_CSTD::wmemset; +# endif +# endif + +# endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */ +_STLP_END_NAMESPACE + +# endif /* _STLP_IMPORT_VENDOR_CSTD */ + +# undef _STLP_WCHAR_SUNPRO_EXCLUDE +# undef _STLP_WCHAR_MSL_EXCLUDE + +# endif /* !defined(_STLP_WCE_EVC3) */ + +#endif /* _STLP_INTERNAL_CWCHAR */ diff --git a/sdk/tlibstdcxx/stlport/stl/_cwctype.h b/sdk/tlibstdcxx/stlport/stl/_cwctype.h new file mode 100644 index 0000000000..d9ade645e3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_cwctype.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_CWCTYPE +#define _STLP_INTERNAL_CWCTYPE + +#if defined (__BORLANDC__) && !defined (_STLP_INTERNAL_CCTYPE) +# include +#endif + +#if !defined (_STLP_WCE_EVC3) +# if defined (_STLP_USE_NEW_C_HEADERS) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_C_HEADER(cwctype) +# endif +# if defined (__MSL__) +namespace std { + typedef wchar_t wctrans_t; + wint_t towctrans(wint_t c, wctrans_t value); + wctrans_t wctrans(const char *name); +} +using std::wctrans_t; +using std::towctrans; +using std::wctrans; +# endif +# else +# include +# endif + +# if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (__hpux) + +# if defined (_STLP_USE_GLIBC) && !(defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCXX_USE_WCHAR_T)) || \ + defined (__sun) || defined (__FreeBSD__) || \ + defined (__CYGWIN__) || \ + defined (__MINGW32__) && ((__MINGW32_MAJOR_VERSION < 3) || (__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION <= 0)) +//We take wide functions from global namespace: +# define _STLP_VENDOR_CSTD_WFUNC +# else +# define _STLP_VENDOR_CSTD_WFUNC _STLP_VENDOR_CSTD +# endif + +_STLP_BEGIN_NAMESPACE +using _STLP_VENDOR_CSTD_WFUNC::wctype_t; +using _STLP_VENDOR_CSTD_WFUNC::wint_t; +# if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +# if !defined (__BORLANDC__) && !defined (__MSL__) +using _STLP_VENDOR_CSTD_WFUNC::wctrans_t; +# if !defined (_STLP_SGX_CONFIG) +# if !defined (__DMC__) && (!defined(_WIN32_WCE) || (_WIN32_WCE < 400)) +using _STLP_VENDOR_CSTD_WFUNC::towctrans; +using _STLP_VENDOR_CSTD_WFUNC::wctrans; +using _STLP_VENDOR_CSTD_WFUNC::wctype; +# endif +using _STLP_VENDOR_CSTD_WFUNC::iswctype; +# endif +# endif +# if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD_WFUNC::iswalnum; +using _STLP_VENDOR_CSTD_WFUNC::iswalpha; +using _STLP_VENDOR_CSTD_WFUNC::iswcntrl; + +using _STLP_VENDOR_CSTD_WFUNC::iswdigit; +using _STLP_VENDOR_CSTD_WFUNC::iswgraph; +using _STLP_VENDOR_CSTD_WFUNC::iswlower; +using _STLP_VENDOR_CSTD_WFUNC::iswprint; +using _STLP_VENDOR_CSTD_WFUNC::iswpunct; +using _STLP_VENDOR_CSTD_WFUNC::iswspace; +using _STLP_VENDOR_CSTD_WFUNC::iswupper; +using _STLP_VENDOR_CSTD_WFUNC::iswxdigit; + +using _STLP_VENDOR_CSTD_WFUNC::towlower; +using _STLP_VENDOR_CSTD_WFUNC::towupper; +# endif +# endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ +_STLP_END_NAMESPACE +# endif /* _STLP_IMPORT_VENDOR_CSTD */ +#endif /* _STLP_WCE_EVC3 */ + +#endif /* _STLP_INTERNAL_CWCTYPE */ diff --git a/sdk/tlibstdcxx/stlport/stl/_deque.c b/sdk/tlibstdcxx/stlport/stl/_deque.c new file mode 100644 index 0000000000..74e9ef61da --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_deque.c @@ -0,0 +1,823 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_DEQUE_C +#define _STLP_DEQUE_C + +#ifndef _STLP_INTERNAL_DEQUE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Non-inline member functions from _Deque_base. + +template +_Deque_base<_Tp,_Alloc >::~_Deque_base() { + if (_M_map._M_data) { + _M_destroy_nodes(_M_start._M_node, this->_M_finish._M_node + 1); + _M_map.deallocate(_M_map._M_data, _M_map_size._M_data); + } +} + +template +void _Deque_base<_Tp,_Alloc>::_M_initialize_map(size_t __num_elements) { + size_t __num_nodes = __num_elements / this->buffer_size() + 1 ; + + _M_map_size._M_data = (max)((size_t) _S_initial_map_size, __num_nodes + 2); + _M_map._M_data = _M_map.allocate(_M_map_size._M_data); + + _Tp** __nstart = _M_map._M_data + (_M_map_size._M_data - __num_nodes) / 2; + _Tp** __nfinish = __nstart + __num_nodes; + + _STLP_TRY { + _M_create_nodes(__nstart, __nfinish); + } + _STLP_UNWIND((_M_map.deallocate(_M_map._M_data, _M_map_size._M_data), + _M_map._M_data = 0, _M_map_size._M_data = 0)) + _M_start._M_set_node(__nstart); + this->_M_finish._M_set_node(__nfinish - 1); + _M_start._M_cur = _M_start._M_first; + this->_M_finish._M_cur = this->_M_finish._M_first + __num_elements % this->buffer_size(); +} + +template +void _Deque_base<_Tp,_Alloc>::_M_create_nodes(_Tp** __nstart, + _Tp** __nfinish) { + _Tp** __cur = __nstart; + _STLP_TRY { + for (; __cur < __nfinish; ++__cur) + *__cur = _M_map_size.allocate(this->buffer_size()); + } + _STLP_UNWIND(_M_destroy_nodes(__nstart, __cur)) +} + +template +void _Deque_base<_Tp,_Alloc>::_M_destroy_nodes(_Tp** __nstart, + _Tp** __nfinish) { + for (_Tp** __n = __nstart; __n < __nfinish; ++__n) + _M_map_size.deallocate(*__n, this->buffer_size()); +} + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define deque _STLP_PTR_IMPL_NAME(deque) +#elif defined (_STLP_DEBUG) +# define deque _STLP_NON_DBG_NAME(deque) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +// qualified references +# define __iterator__ _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > +# define const_iterator _Deque_iterator<_Tp, _Const_traits<_Tp> > +# define iterator __iterator__ +# define size_type size_t +# define value_type _Tp +#else +# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE deque<_Tp, _Alloc>::iterator +#endif + +template +deque<_Tp, _Alloc >& +deque<_Tp, _Alloc >::operator= (const deque<_Tp, _Alloc >& __x) { + const size_type __len = size(); + if (&__x != this) { + if (__len >= __x.size()) + erase(_STLP_STD::copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish); + else { + const_iterator __mid = __x.begin() + difference_type(__len); + _STLP_STD::copy(__x.begin(), __mid, this->_M_start); + insert(this->_M_finish, __mid, __x.end()); + } + } + return *this; +} + +template +void deque<_Tp, _Alloc >::_M_fill_insert(iterator __pos, + size_type __n, const value_type& __x) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + if (__pos._M_cur == this->_M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + _STLP_TRY { + uninitialized_fill(__new_start, this->_M_start, __x); + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + this->_M_start = __new_start; + } + else if (__pos._M_cur == this->_M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + _STLP_TRY { + uninitialized_fill(this->_M_finish, __new_finish, __x); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node+1, __new_finish._M_node+1)) + this->_M_finish = __new_finish; + } + else + _M_fill_insert_aux(__pos, __n, __x, _Movable()); +} + +#if !defined (_STLP_MEMBER_TEMPLATES) + +template +void deque<_Tp, _Alloc>::insert(iterator __pos, + const value_type* __first, const value_type* __last) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + size_type __n = __last - __first; + if (__pos._M_cur == this->_M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + _STLP_TRY { + _STLP_PRIV __ucopy(__first, __last, __new_start); + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + this->_M_start = __new_start; + } + else if (__pos._M_cur == this->_M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + _STLP_TRY { + _STLP_PRIV __ucopy(__first, __last, this->_M_finish); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, + __new_finish._M_node + 1)) + this->_M_finish = __new_finish; + } + else + _M_insert_range_aux(__pos, __first, __last, __n, _Movable()); +} + +template +void deque<_Tp,_Alloc>::insert(iterator __pos, + const_iterator __first, const_iterator __last) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + size_type __n = __last - __first; + if (__pos._M_cur == this->_M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + _STLP_TRY { + _STLP_PRIV __ucopy(__first, __last, __new_start); + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + this->_M_start = __new_start; + } + else if (__pos._M_cur == this->_M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + _STLP_TRY { + _STLP_PRIV __ucopy(__first, __last, this->_M_finish); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, + __new_finish._M_node + 1)) + this->_M_finish = __new_finish; + } + else + _M_insert_range_aux(__pos, __first, __last, __n, _Movable()); +} + +#endif /* _STLP_MEMBER_TEMPLATES */ + +template +__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos, + const __true_type& /*_Movable*/) { + difference_type __index = __pos - this->_M_start; + if (size_type(__index) < this->size() >> 1) { + //We move the start of the deque one position to the right + //starting from the rightmost element to move. + iterator __src = __pos, __dst = __pos; + _STLP_STD::_Destroy(&(*__dst)); + if (__src != this->_M_start) { + for (--__src; __dst != this->_M_start; --__src, --__dst) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + } + _M_pop_front_aux(); + } + else { + iterator __src = __pos, __dst = __pos; + _STLP_STD::_Destroy(&(*__dst)); + for (++__src; __src != this->_M_finish; ++__src, ++__dst) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + //Duplication of the pop_back code without the destroy which has already been done: + if (this->_M_finish._M_cur != this->_M_finish._M_first) { + --this->_M_finish._M_cur; + } + else { + _M_pop_back_aux(); + } + } + return this->_M_start + __index; +} + +template +__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __pos, + const __false_type& /*_Movable*/) { + iterator __next = __pos; + ++__next; + difference_type __index = __pos - this->_M_start; + if (size_type(__index) < this->size() >> 1) { + copy_backward(this->_M_start, __pos, __next); + pop_front(); + } + else { + _STLP_STD::copy(__next, this->_M_finish, __pos); + pop_back(); + } + return this->_M_start + __index; +} + +template +__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last, + const __true_type& /*_Movable*/) { + difference_type __n = __last - __first; + difference_type __elems_before = __first - this->_M_start; + if (__elems_before <= difference_type(this->size() - __n) / 2) { + iterator __src = __first, __dst = __last; + if (__src != this->_M_start) { + for (--__src, --__dst; (__src >= this->_M_start) && (__dst >= __first); --__src, --__dst) { + _STLP_STD::_Destroy(&(*__dst)); + _STLP_STD::_Move_Construct(&(*__dst), *__src); + } + if (__dst >= __first) { + //There are more elements to erase than elements to move + _STLP_STD::_Destroy_Range(__first, ++__dst); + _STLP_STD::_Destroy_Moved_Range(this->_M_start, __first); + } + else { + //There are more elements to move than elements to erase + for (; __src >= this->_M_start; --__src, --__dst) { + _STLP_STD::_Destroy_Moved(&(*__dst)); + _STLP_STD::_Move_Construct(&(*__dst), *__src); + } + _STLP_STD::_Destroy_Moved_Range(this->_M_start, ++__dst); + } + } + else { + _STLP_STD::_Destroy_Range(this->_M_start, __last); + } + iterator __new_start = this->_M_start + __n; + this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node); + this->_M_start = __new_start; + } + else { + if (__last != this->_M_finish) { + iterator __src = __last, __dst = __first; + for (; (__src != this->_M_finish) && (__dst != __last); ++__src, ++__dst) { + _STLP_STD::_Destroy(&(*__dst)); + _STLP_STD::_Move_Construct(&(*__dst), *__src); + } + if (__dst != __last) { + //There are more elements to erase than elements to move + _STLP_STD::_Destroy_Range(__dst, __last); + _STLP_STD::_Destroy_Moved_Range(__last, this->_M_finish); + } + else { + //There are more elements to move than elements to erase + for (; __src != this->_M_finish; ++__src, ++__dst) { + _STLP_STD::_Destroy_Moved(&(*__dst)); + _STLP_STD::_Move_Construct(&(*__dst), *__src); + } + _STLP_STD::_Destroy_Moved_Range(__dst, this->_M_finish); + } + } + else { + _STLP_STD::_Destroy_Range(__first, this->_M_finish); + } + iterator __new_finish = this->_M_finish - __n; + this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1); + this->_M_finish = __new_finish; + } + return this->_M_start + __elems_before; +} + +template +__iterator__ deque<_Tp,_Alloc>::_M_erase(iterator __first, iterator __last, + const __false_type& /*_Movable*/) { + difference_type __n = __last - __first; + difference_type __elems_before = __first - this->_M_start; + if (__elems_before <= difference_type(this->size() - __n) / 2) { + copy_backward(this->_M_start, __first, __last); + iterator __new_start = this->_M_start + __n; + _STLP_STD::_Destroy_Range(this->_M_start, __new_start); + this->_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node); + this->_M_start = __new_start; + } + else { + _STLP_STD::copy(__last, this->_M_finish, __first); + iterator __new_finish = this->_M_finish - __n; + _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish); + this->_M_destroy_nodes(__new_finish._M_node + 1, this->_M_finish._M_node + 1); + this->_M_finish = __new_finish; + } + return this->_M_start + __elems_before; +} + +template +void deque<_Tp,_Alloc>::clear() { + for (_Map_pointer __node = this->_M_start._M_node + 1; + __node < this->_M_finish._M_node; + ++__node) { + _STLP_STD::_Destroy_Range(*__node, *__node + this->buffer_size()); + this->_M_map_size.deallocate(*__node, this->buffer_size()); + } + + if (this->_M_start._M_node != this->_M_finish._M_node) { + _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_start._M_last); + _STLP_STD::_Destroy_Range(this->_M_finish._M_first, this->_M_finish._M_cur); + this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size()); + } + else + _STLP_STD::_Destroy_Range(this->_M_start._M_cur, this->_M_finish._M_cur); + + this->_M_finish = this->_M_start; +} + +// Precondition: this->_M_start and this->_M_finish have already been initialized, +// but none of the deque's elements have yet been constructed. +template +void deque<_Tp,_Alloc>::_M_fill_initialize(const value_type& __val, + const __false_type& /*_TrivialInit*/) { + _Map_pointer __cur = this->_M_start._M_node; + _STLP_TRY { + for (; __cur < this->_M_finish._M_node; ++__cur) + uninitialized_fill(*__cur, *__cur + this->buffer_size(), __val); + uninitialized_fill(this->_M_finish._M_first, this->_M_finish._M_cur, __val); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur, __cur))) +} + + +// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1. +template +void deque<_Tp,_Alloc>::_M_push_back_aux_v(const value_type& __t) { + _M_reserve_map_at_back(); + *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size()); + _STLP_TRY { + _Copy_Construct(this->_M_finish._M_cur, __t); + this->_M_finish._M_set_node(this->_M_finish._M_node + 1); + this->_M_finish._M_cur = this->_M_finish._M_first; + } + _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1), + this->buffer_size())) +} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) +// Called only if this->_M_finish._M_cur == this->_M_finish._M_last - 1. +template +void deque<_Tp,_Alloc>::_M_push_back_aux() { + _M_reserve_map_at_back(); + *(this->_M_finish._M_node + 1) = this->_M_map_size.allocate(this->buffer_size()); + _STLP_TRY { + _STLP_STD::_Construct(this->_M_finish._M_cur); + this->_M_finish._M_set_node(this->_M_finish._M_node + 1); + this->_M_finish._M_cur = this->_M_finish._M_first; + } + _STLP_UNWIND(this->_M_map_size.deallocate(*(this->_M_finish._M_node + 1), + this->buffer_size())) +} +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + +// Called only if this->_M_start._M_cur == this->_M_start._M_first. +template +void deque<_Tp,_Alloc>::_M_push_front_aux_v(const value_type& __t) { + _M_reserve_map_at_front(); + *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size()); + _STLP_TRY { + this->_M_start._M_set_node(this->_M_start._M_node - 1); + this->_M_start._M_cur = this->_M_start._M_last - 1; + _Copy_Construct(this->_M_start._M_cur, __t); + } + _STLP_UNWIND((++this->_M_start, + this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), this->buffer_size()))) +} + + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) +// Called only if this->_M_start._M_cur == this->_M_start._M_first. +template +void deque<_Tp,_Alloc>::_M_push_front_aux() { + _M_reserve_map_at_front(); + *(this->_M_start._M_node - 1) = this->_M_map_size.allocate(this->buffer_size()); + _STLP_TRY { + this->_M_start._M_set_node(this->_M_start._M_node - 1); + this->_M_start._M_cur = this->_M_start._M_last - 1; + _STLP_STD::_Construct(this->_M_start._M_cur); + } + _STLP_UNWIND((++this->_M_start, this->_M_map_size.deallocate(*(this->_M_start._M_node - 1), + this->buffer_size()))) +} +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + +// Called only if this->_M_finish._M_cur == this->_M_finish._M_first. +template +void deque<_Tp,_Alloc>::_M_pop_back_aux() { + this->_M_map_size.deallocate(this->_M_finish._M_first, this->buffer_size()); + this->_M_finish._M_set_node(this->_M_finish._M_node - 1); + this->_M_finish._M_cur = this->_M_finish._M_last - 1; +} + +// Note that if the deque has at least one element (a precondition for this member +// function), and if this->_M_start._M_cur == this->_M_start._M_last, then the deque +// must have at least two nodes. +template +void deque<_Tp,_Alloc>::_M_pop_front_aux() { + if (this->_M_start._M_cur != this->_M_start._M_last - 1) + ++this->_M_start._M_cur; + else { + this->_M_map_size.deallocate(this->_M_start._M_first, this->buffer_size()); + this->_M_start._M_set_node(this->_M_start._M_node + 1); + this->_M_start._M_cur = this->_M_start._M_first; + } +} + +template +__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n, + const value_type& __x, + const __true_type& /*_Movable*/) { + const difference_type __elems_before = __pos - this->_M_start; + size_type __length = this->size(); + value_type __x_copy = __x; + if (__elems_before <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __pos = this->_M_start + __elems_before; + _STLP_TRY { + iterator __dst = __new_start; + iterator __src = this->_M_start; + for (; __src != __pos; ++__dst, ++__src) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_start = __new_start; + uninitialized_fill(__dst, __src, __x_copy); + __pos = __dst; + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + const difference_type __elems_after = difference_type(__length) - __elems_before; + __pos = this->_M_finish - __elems_after; + _STLP_TRY { + iterator __dst = __new_finish; + iterator __src = this->_M_finish; + for (--__src, --__dst; __src >= __pos; --__src, --__dst) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_finish = __new_finish; + uninitialized_fill(__pos, __pos + __n, __x_copy); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } + return __pos; +} + +template +__iterator__ deque<_Tp,_Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n, + const value_type& __x, + const __false_type& /*_Movable*/) { + const difference_type __elems_before = __pos - this->_M_start; + size_type __length = this->size(); + value_type __x_copy = __x; + if (__elems_before <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = this->_M_start; + __pos = this->_M_start + __elems_before; + _STLP_TRY { + if (__elems_before >= difference_type(__n)) { + iterator __start_n = this->_M_start + difference_type(__n); + _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__start_n, __pos, __old_start); + _STLP_STD::fill(__pos - difference_type(__n), __pos, __x_copy); + __pos -= difference_type(__n); + } + else { + _STLP_PRIV __uninitialized_copy_fill(this->_M_start, __pos, __new_start, + this->_M_start, __x_copy); + this->_M_start = __new_start; + fill(__old_start, __pos, __x_copy); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = this->_M_finish; + const difference_type __elems_after = + difference_type(__length) - __elems_before; + __pos = this->_M_finish - __elems_after; + _STLP_TRY { + if (__elems_after > difference_type(__n)) { + iterator __finish_n = this->_M_finish - difference_type(__n); + _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + copy_backward(__pos, __finish_n, __old_finish); + fill(__pos, __pos + difference_type(__n), __x_copy); + } + else { + _STLP_PRIV __uninitialized_fill_copy(this->_M_finish, __pos + difference_type(__n), + __x_copy, __pos, this->_M_finish); + this->_M_finish = __new_finish; + fill(__pos, __old_finish, __x_copy); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } + return __pos; +} + +#if !defined (_STLP_MEMBER_TEMPLATES) +template +void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, + const value_type* __first, const value_type* __last, + size_type __n, const __true_type& /*_Movable*/) { + const difference_type __elems_before = __pos - this->_M_start; + size_type __length = size(); + if (__elems_before <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __pos = this->_M_start + __elems_before; + _STLP_TRY { + iterator __dst = __new_start; + iterator __src = this->_M_start; + for (; __src != __pos; ++__dst, ++__src) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_start = __new_start; + _STLP_PRIV __ucopy(__first, __last, __dst); + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + const difference_type __elems_after = difference_type(__length) - __elems_before; + __pos = this->_M_finish - __elems_after; + _STLP_TRY { + iterator __dst = __new_finish; + iterator __src = this->_M_finish; + for (--__src, --__dst; __src >= __pos; --__src, --__dst) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_finish = __new_finish; + _STLP_PRIV __ucopy(__first, __last, __pos); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } +} + +template +void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, + const value_type* __first, const value_type* __last, + size_type __n, const __false_type& /*_Movable*/) { + const difference_type __elems_before = __pos - this->_M_start; + size_type __length = size(); + if (__elems_before <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = this->_M_start; + __pos = this->_M_start + __elems_before; + _STLP_TRY { + if (__elems_before >= difference_type(__n)) { + iterator __start_n = this->_M_start + difference_type(__n); + _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__start_n, __pos, __old_start); + _STLP_STD::copy(__first, __last, __pos - difference_type(__n)); + } + else { + const value_type* __mid = __first + (difference_type(__n) - __elems_before); + _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__mid, __last, __old_start); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = this->_M_finish; + const difference_type __elems_after = + difference_type(__length) - __elems_before; + __pos = this->_M_finish - __elems_after; + _STLP_TRY { + + if (__elems_after > difference_type(__n)) { + iterator __finish_n = this->_M_finish - difference_type(__n); + _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + _STLP_STD::copy_backward(__pos, __finish_n, __old_finish); + _STLP_STD::copy(__first, __last, __pos); + } + else { + const value_type* __mid = __first + __elems_after; + _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + _STLP_STD::copy(__first, __mid, __pos); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } +} + +template +void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, + const_iterator __first, const_iterator __last, + size_type __n, const __true_type& /*_Movable*/) { + const difference_type __elems_before = __pos - this->_M_start; + size_type __length = size(); + if (__elems_before <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __pos = this->_M_start + __elems_before; + _STLP_TRY { + iterator __dst = __new_start; + iterator __src = this->_M_start; + for (; __src != __pos; ++__dst, ++__src) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_start = __new_start; + _STLP_PRIV __ucopy(__first, __last, __dst); + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + const difference_type __elems_after = difference_type(__length) - __elems_before; + __pos = this->_M_finish - __elems_after; + _STLP_TRY { + iterator __dst = __new_finish; + iterator __src = this->_M_finish; + for (--__src, --__dst; __src >= __pos; --__src, --__dst) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_finish = __new_finish; + _STLP_PRIV __ucopy(__first, __last, __pos); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } +} + +template +void deque<_Tp,_Alloc>::_M_insert_range_aux(iterator __pos, + const_iterator __first, const_iterator __last, + size_type __n, const __false_type& /*_Movable*/) { + const difference_type __elems_before = __pos - this->_M_start; + size_type __length = size(); + if (__elems_before < difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = this->_M_start; + __pos = this->_M_start + __elems_before; + _STLP_TRY { + if (__elems_before >= difference_type(__n)) { + iterator __start_n = this->_M_start + __n; + _STLP_PRIV __ucopy(this->_M_start, __start_n, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__start_n, __pos, __old_start); + _STLP_STD::copy(__first, __last, __pos - difference_type(__n)); + } + else { + const_iterator __mid = __first + (__n - __elems_before); + _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__mid, __last, __old_start); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = this->_M_finish; + const difference_type __elems_after = __length - __elems_before; + __pos = this->_M_finish - __elems_after; + _STLP_TRY { + if (__elems_after > difference_type(__n)) { + iterator __finish_n = this->_M_finish - difference_type(__n); + _STLP_PRIV __ucopy(__finish_n, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + _STLP_STD::copy_backward(__pos, __finish_n, __old_finish); + _STLP_STD::copy(__first, __last, __pos); + } + else { + const_iterator __mid = __first + __elems_after; + _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + _STLP_STD::copy(__first, __mid, __pos); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } +} +#endif /* _STLP_MEMBER_TEMPLATES */ + +template +void deque<_Tp,_Alloc>::_M_new_elements_at_front(size_type __new_elems) { + size_type __new_nodes + = (__new_elems + this->buffer_size() - 1) / this->buffer_size(); + _M_reserve_map_at_front(__new_nodes); + size_type __i = 1; + _STLP_TRY { + for (; __i <= __new_nodes; ++__i) + *(this->_M_start._M_node - __i) = this->_M_map_size.allocate(this->buffer_size()); + } + _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j) + this->_M_map_size.deallocate(*(this->_M_start._M_node - __j), this->buffer_size())) +} + +template +void deque<_Tp,_Alloc>::_M_new_elements_at_back(size_type __new_elems) { + size_type __new_nodes + = (__new_elems + this->buffer_size() - 1) / this->buffer_size(); + _M_reserve_map_at_back(__new_nodes); + size_type __i = 1; + _STLP_TRY { + for (; __i <= __new_nodes; ++__i) + *(this->_M_finish._M_node + __i) = this->_M_map_size.allocate(this->buffer_size()); + } + _STLP_UNWIND(for (size_type __j = 1; __j < __i; ++__j) + this->_M_map_size.deallocate(*(this->_M_finish._M_node + __j), this->buffer_size())) +} + +template +void deque<_Tp,_Alloc>::_M_reallocate_map(size_type __nodes_to_add, + bool __add_at_front) { + size_type __old_num_nodes = this->_M_finish._M_node - this->_M_start._M_node + 1; + size_type __new_num_nodes = __old_num_nodes + __nodes_to_add; + + _Map_pointer __new_nstart; + if (this->_M_map_size._M_data > 2 * __new_num_nodes) { + __new_nstart = this->_M_map._M_data + (this->_M_map_size._M_data - __new_num_nodes) / 2 + + (__add_at_front ? __nodes_to_add : 0); + if (__new_nstart < this->_M_start._M_node) + _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart); + else + _STLP_STD::copy_backward(this->_M_start._M_node, this->_M_finish._M_node + 1, + __new_nstart + __old_num_nodes); + } + else { + size_type __new_map_size = + this->_M_map_size._M_data + (max)((size_t)this->_M_map_size._M_data, __nodes_to_add) + 2; + + _Map_pointer __new_map = this->_M_map.allocate(__new_map_size); + __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2 + + (__add_at_front ? __nodes_to_add : 0); + _STLP_STD::copy(this->_M_start._M_node, this->_M_finish._M_node + 1, __new_nstart); + this->_M_map.deallocate(this->_M_map._M_data, this->_M_map_size._M_data); + + this->_M_map._M_data = __new_map; + this->_M_map_size._M_data = __new_map_size; + } + + this->_M_start._M_set_node(__new_nstart); + this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); +} + +#if defined (deque) +# undef deque +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#undef __iterator__ +#undef iterator +#undef const_iterator +#undef size_type +#undef value_type + +#endif /* _STLP_DEQUE_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_deque.h b/sdk/tlibstdcxx/stlport/stl/_deque.h new file mode 100644 index 0000000000..a8faeef286 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_deque.h @@ -0,0 +1,1115 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DEQUE_H +#define _STLP_INTERNAL_DEQUE_H + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_UNINITIALIZED_H +# include +#endif + +#ifndef _STLP_RANGE_ERRORS_H +# include +#endif + +/* Class invariants: + * For any nonsingular iterator i: + * i.node is the address of an element in the map array. The + * contents of i.node is a pointer to the beginning of a node. + * i.first == *(i.node) + * i.last == i.first + node_size + * i.cur is a pointer in the range [i.first, i.last). NOTE: + * the implication of this is that i.cur is always a dereferenceable + * pointer, even if i is a past-the-end iterator. + * Start and Finish are always nonsingular iterators. NOTE: this means + * that an empty deque must have one node, and that a deque + * with N elements, where N is the buffer size, must have two nodes. + * For every node other than start.node and finish.node, every element + * in the node is an initialized object. If start.node == finish.node, + * then [start.cur, finish.cur) are initialized objects, and + * the elements outside that range are uninitialized storage. Otherwise, + * [start.cur, start.last) and [finish.first, finish.cur) are initialized + * objects, and [start.first, start.cur) and [finish.cur, finish.last) + * are uninitialized storage. + * [map, map + map_size) is a valid, non-empty range. + * [start.node, finish.node] is a valid range contained within + * [map, map + map_size). + * A pointer in the range [map, map + map_size) points to an allocated node + * if and only if the pointer is in the range [start.node, finish.node]. + */ + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Deque_iterator_base { + + static size_t _S_buffer_size() { + const size_t blocksize = _MAX_BYTES; + return (sizeof(_Tp) < blocksize ? (blocksize / sizeof(_Tp)) : 1); + } + + typedef random_access_iterator_tag iterator_category; + + typedef _Tp value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef value_type** _Map_pointer; + + typedef _Deque_iterator_base< _Tp > _Self; + + value_type* _M_cur; + value_type* _M_first; + value_type* _M_last; + _Map_pointer _M_node; + + _Deque_iterator_base(value_type* __x, _Map_pointer __y) + : _M_cur(__x), _M_first(*__y), + _M_last(*__y + _S_buffer_size()), _M_node(__y) {} + + _Deque_iterator_base() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {} + +// see comment in doc/README.evc4 and doc/README.evc8 +#if defined (_STLP_MSVC) && (_STLP_MSVC <= 1401) && defined (MIPS) && defined (NDEBUG) + _Deque_iterator_base(_Deque_iterator_base const& __other) + : _M_cur(__other._M_cur), _M_first(__other._M_first), + _M_last(__other._M_last), _M_node(__other._M_node) {} +#endif + + difference_type _M_subtract(const _Self& __x) const { + return difference_type(_S_buffer_size()) * (_M_node - __x._M_node - 1) + + (_M_cur - _M_first) + (__x._M_last - __x._M_cur); + } + + void _M_increment() { + if (++_M_cur == _M_last) { + _M_set_node(_M_node + 1); + _M_cur = _M_first; + } + } + + void _M_decrement() { + if (_M_cur == _M_first) { + _M_set_node(_M_node - 1); + _M_cur = _M_last; + } + --_M_cur; + } + + void _M_advance(difference_type __n) { + const size_t buffersize = _S_buffer_size(); + difference_type __offset = __n + (_M_cur - _M_first); + if (__offset >= 0 && __offset < difference_type(buffersize)) + _M_cur += __n; + else { + difference_type __node_offset = + __offset > 0 ? __offset / buffersize + : -difference_type((-__offset - 1) / buffersize) - 1; + _M_set_node(_M_node + __node_offset); + _M_cur = _M_first + + + (__offset - __node_offset * difference_type(buffersize)); + } + } + + void _M_set_node(_Map_pointer __new_node) { + _M_last = (_M_first = *(_M_node = __new_node)) + difference_type(_S_buffer_size()); + } +}; + + +template +struct _Deque_iterator : public _Deque_iterator_base< _Tp> { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef value_type** _Map_pointer; + + typedef _Deque_iterator_base< _Tp > _Base; + typedef _Deque_iterator<_Tp, _Traits> _Self; + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef _Deque_iterator<_Tp, _NonConstTraits> iterator; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef _Deque_iterator<_Tp, _ConstTraits> const_iterator; + + _Deque_iterator(value_type* __x, _Map_pointer __y) : + _Deque_iterator_base(__x,__y) {} + + _Deque_iterator() {} + //copy constructor for iterator and constructor from iterator for const_iterator + _Deque_iterator(const iterator& __x) : + _Deque_iterator_base(__x) {} + + reference operator*() const { + return *this->_M_cur; + } + + _STLP_DEFINE_ARROW_OPERATOR + + difference_type operator-(const const_iterator& __x) const { return this->_M_subtract(__x); } + + _Self& operator++() { this->_M_increment(); return *this; } + _Self operator++(int) { + _Self __tmp = *this; + ++*this; + return __tmp; + } + + _Self& operator--() { this->_M_decrement(); return *this; } + _Self operator--(int) { + _Self __tmp = *this; + --*this; + return __tmp; + } + + _Self& operator+=(difference_type __n) { this->_M_advance(__n); return *this; } + _Self operator+(difference_type __n) const { + _Self __tmp = *this; + return __tmp += __n; + } + + _Self& operator-=(difference_type __n) { return *this += -__n; } + _Self operator-(difference_type __n) const { + _Self __tmp = *this; + return __tmp -= __n; + } + + reference operator[](difference_type __n) const { return *(*this + __n); } +}; + + +template +inline _Deque_iterator<_Tp, _Traits> _STLP_CALL +operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Traits>& __x) +{ return __x + __n; } + + +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) +template +inline bool _STLP_CALL +operator==(const _Deque_iterator_base<_Tp >& __x, + const _Deque_iterator_base<_Tp >& __y) +{ return __x._M_cur == __y._M_cur; } + +template +inline bool _STLP_CALL +operator < (const _Deque_iterator_base<_Tp >& __x, + const _Deque_iterator_base<_Tp >& __y) { + return (__x._M_node == __y._M_node) ? + (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); +} + +template +inline bool _STLP_CALL +operator!=(const _Deque_iterator_base<_Tp >& __x, + const _Deque_iterator_base<_Tp >& __y) +{ return __x._M_cur != __y._M_cur; } + +template +inline bool _STLP_CALL +operator>(const _Deque_iterator_base<_Tp >& __x, + const _Deque_iterator_base<_Tp >& __y) +{ return __y < __x; } + +template +inline bool _STLP_CALL operator>=(const _Deque_iterator_base<_Tp >& __x, + const _Deque_iterator_base<_Tp >& __y) +{ return !(__x < __y); } + +template +inline bool _STLP_CALL operator<=(const _Deque_iterator_base<_Tp >& __x, + const _Deque_iterator_base<_Tp >& __y) +{ return !(__y < __x); } + +#else /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +inline bool _STLP_CALL +operator==(const _Deque_iterator<_Tp, _Traits1 >& __x, + const _Deque_iterator<_Tp, _Traits2 >& __y) +{ return __x._M_cur == __y._M_cur; } + +template +inline bool _STLP_CALL +operator < (const _Deque_iterator<_Tp, _Traits1 >& __x, + const _Deque_iterator<_Tp, _Traits2 >& __y) { + return (__x._M_node == __y._M_node) ? + (__x._M_cur < __y._M_cur) : (__x._M_node < __y._M_node); +} + +template +inline bool _STLP_CALL +operator!=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, + const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) +{ return __x._M_cur != __y._M_cur; } + +template +inline bool _STLP_CALL +operator>(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, + const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) +{ return __y < __x; } + +template +inline bool _STLP_CALL +operator>=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, + const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) +{ return !(__x < __y); } + +template +inline bool _STLP_CALL +operator<=(const _Deque_iterator<_Tp, _Nonconst_traits<_Tp> >& __x, + const _Deque_iterator<_Tp, _Const_traits<_Tp> >& __y) +{ return !(__y < __x); } +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +_STLP_MOVE_TO_STD_NAMESPACE +template +struct __type_traits<_STLP_PRIV _Deque_iterator<_Tp, _Traits> > { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +_STLP_MOVE_TO_STD_NAMESPACE +template inline _Tp* _STLP_CALL +value_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return (_Tp*)0; } +template inline random_access_iterator_tag _STLP_CALL +iterator_category(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return random_access_iterator_tag(); } +template inline ptrdiff_t* _STLP_CALL +distance_type(const _STLP_PRIV _Deque_iterator<_Tp, _Traits >&) { return 0; } +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +/* Deque base class. It has two purposes. First, its constructor + * and destructor allocate (but don't initialize) storage. This makes + * exception safety easier. Second, the base class encapsulates all of + * the differences between SGI-style allocators and standard-conforming + * allocators. + */ + +template +class _Deque_base { + typedef _Deque_base<_Tp, _Alloc> _Self; +public: + typedef _Tp value_type; + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef _Alloc allocator_type; + typedef _STLP_alloc_proxy _Alloc_proxy; + + typedef typename _Alloc_traits<_Tp*, _Alloc>::allocator_type _Map_alloc_type; + typedef _STLP_alloc_proxy _Map_alloc_proxy; + + typedef _Deque_iterator<_Tp, _Nonconst_traits<_Tp> > iterator; + typedef _Deque_iterator<_Tp, _Const_traits<_Tp> > const_iterator; + + static size_t _STLP_CALL buffer_size() { return _Deque_iterator_base<_Tp>::_S_buffer_size(); } + + _Deque_base(const allocator_type& __a, size_t __num_elements) + : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0), + _M_map_size(__a, (size_t)0) + { _M_initialize_map(__num_elements); } + + _Deque_base(const allocator_type& __a) + : _M_start(), _M_finish(), _M_map(_STLP_CONVERT_ALLOCATOR(__a, _Tp*), 0), + _M_map_size(__a, (size_t)0) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Deque_base(__move_source<_Self> src) + : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), + _M_map(__move_source<_Map_alloc_proxy>(src.get()._M_map)), + _M_map_size(__move_source<_Alloc_proxy>(src.get()._M_map_size)) { + src.get()._M_map._M_data = 0; + src.get()._M_map_size._M_data = 0; + src.get()._M_finish = src.get()._M_start; + } +#endif + + ~_Deque_base(); + +protected: + void _M_initialize_map(size_t); + void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish); + void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish); + enum { _S_initial_map_size = 8 }; + +protected: + iterator _M_start; + iterator _M_finish; + _Map_alloc_proxy _M_map; + _Alloc_proxy _M_map_size; +}; + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define deque _STLP_PTR_IMPL_NAME(deque) +#elif defined (_STLP_DEBUG) +# define deque _STLP_NON_DBG_NAME(deque) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template ) > +class deque : protected _STLP_PRIV _Deque_base<_Tp, _Alloc> +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque) + , public __stlport_class > +#endif +{ + typedef _STLP_PRIV _Deque_base<_Tp, _Alloc> _Base; + typedef deque<_Tp, _Alloc> _Self; +public: // Basic types + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag _Iterator_category; + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef typename _Base::allocator_type allocator_type; + +public: // Iterators + typedef typename _Base::iterator iterator; + typedef typename _Base::const_iterator const_iterator; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +protected: // Internal typedefs + typedef pointer* _Map_pointer; +#if defined (_STLP_NO_MOVE_SEMANTIC) + typedef __false_type _Movable; +#endif + +public: // Basic accessors + iterator begin() { return this->_M_start; } + iterator end() { return this->_M_finish; } + const_iterator begin() const { return const_iterator(this->_M_start); } + const_iterator end() const { return const_iterator(this->_M_finish); } + + reverse_iterator rbegin() { return reverse_iterator(this->_M_finish); } + reverse_iterator rend() { return reverse_iterator(this->_M_start); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(this->_M_finish); } + const_reverse_iterator rend() const + { return const_reverse_iterator(this->_M_start); } + + reference operator[](size_type __n) + { return this->_M_start[difference_type(__n)]; } + const_reference operator[](size_type __n) const + { return this->_M_start[difference_type(__n)]; } + + void _M_range_check(size_type __n) const { + if (__n >= this->size()) + __stl_throw_out_of_range("deque"); + } + reference at(size_type __n) + { _M_range_check(__n); return (*this)[__n]; } + const_reference at(size_type __n) const + { _M_range_check(__n); return (*this)[__n]; } + + reference front() { return *this->_M_start; } + reference back() { + iterator __tmp = this->_M_finish; + --__tmp; + return *__tmp; + } + const_reference front() const { return *this->_M_start; } + const_reference back() const { + const_iterator __tmp = this->_M_finish; + --__tmp; + return *__tmp; + } + + size_type size() const { return this->_M_finish - this->_M_start; } + size_type max_size() const { return size_type(-1); } + bool empty() const { return this->_M_finish == this->_M_start; } + allocator_type get_allocator() const { return this->_M_map_size; } + +public: // Constructor, destructor. +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit deque(const allocator_type& __a = allocator_type()) +#else + deque() + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), 0) {} + deque(const allocator_type& __a) +#endif + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, 0) {} + + deque(const _Self& __x) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__x.get_allocator(), __x.size()) + { _STLP_PRIV __ucopy(__x.begin(), __x.end(), this->_M_start); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) +private: + void _M_initialize(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { + typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit; + _M_fill_initialize(__val, _TrivialInit()); + } +public: + explicit deque(size_type __n) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) + { _M_initialize(__n); } + deque(size_type __n, const value_type& __val, const allocator_type& __a = allocator_type()) +#else + explicit deque(size_type __n) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) { + typedef typename _TrivialInit<_Tp>::_Ret _TrivialInit; + _M_fill_initialize(_STLP_DEFAULT_CONSTRUCTED(_Tp), _TrivialInit()); + } + deque(size_type __n, const value_type& __val) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type(), __n) + { _M_fill_initialize(__val, __false_type()); } + deque(size_type __n, const value_type& __val, const allocator_type& __a) +#endif + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __n) + { _M_fill_initialize(__val, __false_type()); } + +#if defined (_STLP_MEMBER_TEMPLATES) +protected: + template + void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) { + this->_M_initialize_map(__n); + _M_fill_initialize(__x, __false_type()); + } + + template + void _M_initialize_dispatch(_InputIter __first, _InputIter __last, + const __false_type&) { + _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); + } + +public: + // Check whether it's an integral type. If so, it's not an iterator. + template + deque(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + deque(_InputIterator __first, _InputIterator __last) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(allocator_type()) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +# endif + +#else + deque(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type() ) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first) + { _STLP_PRIV __ucopy(__first, __last, this->_M_start); } + + deque(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type() ) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__a, __last - __first) + { _STLP_PRIV __ucopy(__first, __last, this->_M_start); } +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + deque(__move_source<_Self> src) + : _STLP_PRIV _Deque_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) + {} +#endif + + ~deque() + { _STLP_STD::_Destroy_Range(this->_M_start, this->_M_finish); } + + _Self& operator= (const _Self& __x); + + void swap(_Self& __x) { + _STLP_STD::swap(this->_M_start, __x._M_start); + _STLP_STD::swap(this->_M_finish, __x._M_finish); + this->_M_map.swap(__x._M_map); + this->_M_map_size.swap(__x._M_map_size); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +public: + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void _M_fill_assign(size_type __n, const _Tp& __val) { + if (__n > size()) { + _STLP_STD::fill(begin(), end(), __val); + insert(end(), __n - size(), __val); + } + else { + erase(begin() + __n, end()); + _STLP_STD::fill(begin(), end(), __val); + } + } + + void assign(size_type __n, const _Tp& __val) { + _M_fill_assign(__n, __val); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + +private: // helper functions for assign() + + template + void _M_assign_dispatch(_Integer __n, _Integer __val, + const __true_type& /*_IsIntegral*/) + { _M_fill_assign((size_type) __n, (_Tp) __val); } + + template + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + const __false_type& /*_IsIntegral*/) { + _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); + } + + template + void _M_assign_aux(_InputIter __first, _InputIter __last, const input_iterator_tag &) { + iterator __cur = begin(); + for ( ; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + erase(__cur, end()); + else + insert(end(), __first, __last); + } + + template + void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { +#else + void assign(const value_type *__first, const value_type *__last) { + size_type __size = size(); + size_type __len = __last - __first; + if (__len > __size) { + const value_type *__mid = __first + __size; + _STLP_STD::copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + else { + erase(_STLP_STD::copy(__first, __last, begin()), end()); + } + } + void assign(const_iterator __first, const_iterator __last) { + typedef const_iterator _ForwardIterator; +#endif /* _STLP_MEMBER_TEMPLATES */ + size_type __len = _STLP_STD::distance(__first, __last); + if (__len > size()) { + _ForwardIterator __mid = __first; + _STLP_STD::advance(__mid, size()); + _STLP_STD::copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + else { + erase(_STLP_STD::copy(__first, __last, begin()), end()); + } + } + + +public: // push_* and pop_* + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + void push_back(const value_type& __t) { +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) { + _Copy_Construct(this->_M_finish._M_cur, __t); + ++this->_M_finish._M_cur; + } + else + _M_push_back_aux_v(__t); + } +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + void push_front(const value_type& __t) { +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + if (this->_M_start._M_cur != this->_M_start._M_first) { + _Copy_Construct(this->_M_start._M_cur - 1, __t); + --this->_M_start._M_cur; + } + else + _M_push_front_aux_v(__t); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back() { + if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) { + _STLP_STD::_Construct(this->_M_finish._M_cur); + ++this->_M_finish._M_cur; + } + else + _M_push_back_aux(); + } + void push_front() { + if (this->_M_start._M_cur != this->_M_start._M_first) { + _STLP_STD::_Construct(this->_M_start._M_cur - 1); + --this->_M_start._M_cur; + } + else + _M_push_front_aux(); + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void pop_back() { + if (this->_M_finish._M_cur != this->_M_finish._M_first) { + --this->_M_finish._M_cur; + _STLP_STD::_Destroy(this->_M_finish._M_cur); + } + else { + _M_pop_back_aux(); + _STLP_STD::_Destroy(this->_M_finish._M_cur); + } + } + + void pop_front() { + _STLP_STD::_Destroy(this->_M_start._M_cur); + _M_pop_front_aux(); + } + +public: // Insert + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + iterator insert(iterator __pos, const value_type& __x) { +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + if (__pos._M_cur == this->_M_start._M_cur) { + push_front(__x); + return this->_M_start; + } + else if (__pos._M_cur == this->_M_finish._M_cur) { + push_back(__x); + iterator __tmp = this->_M_finish; + --__tmp; + return __tmp; + } + else { + return _M_fill_insert_aux(__pos, 1, __x, _Movable()); + } + } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos) + { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void insert(iterator __pos, size_type __n, const value_type& __x) + { _M_fill_insert(__pos, __n, __x); } + +protected: + iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __true_type& /*_Movable*/); + iterator _M_fill_insert_aux(iterator __pos, size_type __n, const value_type& __x, const __false_type& /*_Movable*/); + + void _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + const __true_type& /*_IsIntegral*/) { + _M_fill_insert(__pos, (size_type) __n, (value_type) __x); + } + + template + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type& /*_IsIntegral*/) { + _M_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); + } + +public: + // Check whether it's an integral type. If so, it's not an iterator. + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); + } + +#else /* _STLP_MEMBER_TEMPLATES */ + void _M_insert_range_aux(iterator __pos, + const value_type* __first, const value_type* __last, + size_type __n, const __true_type& /*_Movable*/); + void _M_insert_range_aux(iterator __pos, + const value_type* __first, const value_type* __last, + size_type __n, const __false_type& /*_Movable*/); + void _M_insert_range_aux(iterator __pos, + const_iterator __first, const_iterator __last, + size_type __n, const __true_type& /*_Movable*/); + void _M_insert_range_aux(iterator __pos, + const_iterator __first, const_iterator __last, + size_type __n, const __false_type& /*_Movable*/); +public: + void insert(iterator __pos, + const value_type* __first, const value_type* __last); + void insert(iterator __pos, + const_iterator __first, const_iterator __last); + +#endif /* _STLP_MEMBER_TEMPLATES */ + +public: +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, + const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + void resize(size_type __new_size, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const size_type __len = size(); + if (__new_size < __len) + erase(this->_M_start + __new_size, this->_M_finish); + else + insert(this->_M_finish, __new_size - __len, __x); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) + { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +protected: + iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/); + iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/); + + iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/); + iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/); +public: // Erase + iterator erase(iterator __pos) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + return _M_erase(__pos, _Movable()); + } + iterator erase(iterator __first, iterator __last) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + if (__first == this->_M_start && __last == this->_M_finish) { + clear(); + return this->_M_finish; + } + else { + if (__first == __last) + return __first; + return _M_erase(__first, __last, _Movable()); + } + } + void clear(); + +protected: // Internal construction/destruction + + void _M_fill_initialize(const value_type& __val, const __true_type& /*_TrivialInit*/) + {} + void _M_fill_initialize(const value_type& __val, const __false_type& /*_TrivialInit*/); + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_range_initialize(_InputIterator __first, _InputIterator __last, + const input_iterator_tag &) { + this->_M_initialize_map(0); + _STLP_TRY { + for ( ; __first != __last; ++__first) + push_back(*__first); + } + _STLP_UNWIND(clear()) + } + template + void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { + size_type __n = _STLP_STD::distance(__first, __last); + this->_M_initialize_map(__n); + _Map_pointer __cur_node = this->_M_start._M_node; + _STLP_TRY { + for (; __cur_node < this->_M_finish._M_node; ++__cur_node) { + _ForwardIterator __mid = __first; + _STLP_STD::advance(__mid, this->buffer_size()); + _STLP_STD::uninitialized_copy(__first, __mid, *__cur_node); + __first = __mid; + } + _STLP_STD::uninitialized_copy(__first, __last, this->_M_finish._M_first); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(this->_M_start, iterator(*__cur_node, __cur_node))) + } +#endif /* _STLP_MEMBER_TEMPLATES */ + +protected: // Internal push_* and pop_* + + void _M_push_back_aux_v(const value_type&); + void _M_push_front_aux_v(const value_type&); +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void _M_push_back_aux(); + void _M_push_front_aux(); +#endif /*_STLP_DONT_SUP_DFLT_PARAM !_STLP_NO_ANACHRONISMS*/ + void _M_pop_back_aux(); + void _M_pop_front_aux(); + +protected: // Internal insert functions + +#if defined (_STLP_MEMBER_TEMPLATES) + + template + void _M_insert(iterator __pos, + _InputIterator __first, + _InputIterator __last, + const input_iterator_tag &) { + _STLP_STD::copy(__first, __last, inserter(*this, __pos)); + } + + template + void _M_insert(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + size_type __n = _STLP_STD::distance(__first, __last); + if (__pos._M_cur == this->_M_start._M_cur) { + iterator __new_start = _M_reserve_elements_at_front(__n); + _STLP_TRY { + uninitialized_copy(__first, __last, __new_start); + this->_M_start = __new_start; + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else if (__pos._M_cur == this->_M_finish._M_cur) { + iterator __new_finish = _M_reserve_elements_at_back(__n); + _STLP_TRY { + uninitialized_copy(__first, __last, this->_M_finish); + this->_M_finish = __new_finish; + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } + else + _M_insert_range_aux(__pos, __first, __last, __n, _Movable()); + } + + template + void _M_insert_range_aux(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + size_type __n, const __true_type& /*_Movable*/) { + const difference_type __elemsbefore = __pos - this->_M_start; + size_type __length = size(); + if (__elemsbefore <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + __pos = this->_M_start + __elemsbefore; + _STLP_TRY { + iterator __dst = __new_start; + iterator __src = this->_M_start; + for (; __src != __pos; ++__dst, ++__src) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_start = __new_start; + uninitialized_copy(__first, __last, __dst); + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + const difference_type __elemsafter = difference_type(__length) - __elemsbefore; + __pos = this->_M_finish - __elemsafter; + _STLP_TRY { + iterator __dst = __new_finish; + iterator __src = this->_M_finish; + for (--__src, --__dst; __src >= __pos; --__src, --__dst) { + _STLP_STD::_Move_Construct(&(*__dst), *__src); + _STLP_STD::_Destroy_Moved(&(*__src)); + } + this->_M_finish = __new_finish; + uninitialized_copy(__first, __last, __pos); + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } + } + + template + void _M_insert_range_aux(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + size_type __n, const __false_type& /*_Movable*/) { + const difference_type __elemsbefore = __pos - this->_M_start; + size_type __length = size(); + if (__elemsbefore <= difference_type(__length / 2)) { + iterator __new_start = _M_reserve_elements_at_front(__n); + iterator __old_start = this->_M_start; + __pos = this->_M_start + __elemsbefore; + _STLP_TRY { + if (__elemsbefore >= difference_type(__n)) { + iterator __start_n = this->_M_start + difference_type(__n); + _STLP_STD::uninitialized_copy(this->_M_start, __start_n, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__start_n, __pos, __old_start); + _STLP_STD::copy(__first, __last, __pos - difference_type(__n)); + } + else { + _ForwardIterator __mid = __first; + _STLP_STD::advance(__mid, difference_type(__n) - __elemsbefore); + _STLP_PRIV __uninitialized_copy_copy(this->_M_start, __pos, __first, __mid, __new_start); + this->_M_start = __new_start; + _STLP_STD::copy(__mid, __last, __old_start); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node)) + } + else { + iterator __new_finish = _M_reserve_elements_at_back(__n); + iterator __old_finish = this->_M_finish; + const difference_type __elemsafter = difference_type(__length) - __elemsbefore; + __pos = this->_M_finish - __elemsafter; + _STLP_TRY { + if (__elemsafter > difference_type(__n)) { + iterator __finish_n = this->_M_finish - difference_type(__n); + _STLP_STD::uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + _STLP_STD::copy_backward(__pos, __finish_n, __old_finish); + _STLP_STD::copy(__first, __last, __pos); + } + else { + _ForwardIterator __mid = __first; + _STLP_STD::advance(__mid, __elemsafter); + _STLP_PRIV __uninitialized_copy_copy(__mid, __last, __pos, this->_M_finish, this->_M_finish); + this->_M_finish = __new_finish; + _STLP_STD::copy(__first, __mid, __pos); + } + } + _STLP_UNWIND(this->_M_destroy_nodes(this->_M_finish._M_node + 1, __new_finish._M_node + 1)) + } + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + iterator _M_reserve_elements_at_front(size_type __n) { + size_type __vacancies = this->_M_start._M_cur - this->_M_start._M_first; + if (__n > __vacancies) + _M_new_elements_at_front(__n - __vacancies); + return this->_M_start - difference_type(__n); + } + + iterator _M_reserve_elements_at_back(size_type __n) { + size_type __vacancies = (this->_M_finish._M_last - this->_M_finish._M_cur) - 1; + if (__n > __vacancies) + _M_new_elements_at_back(__n - __vacancies); + return this->_M_finish + difference_type(__n); + } + + void _M_new_elements_at_front(size_type __new_elements); + void _M_new_elements_at_back(size_type __new_elements); + +protected: // Allocation of _M_map and nodes + + // Makes sure the _M_map has space for new nodes. Does not actually + // add the nodes. Can invalidate _M_map pointers. (And consequently, + // deque iterators.) + + void _M_reserve_map_at_back (size_type __nodes_to_add = 1) { + if (__nodes_to_add + 1 > this->_M_map_size._M_data - (this->_M_finish._M_node - this->_M_map._M_data)) + _M_reallocate_map(__nodes_to_add, false); + } + + void _M_reserve_map_at_front (size_type __nodes_to_add = 1) { + if (__nodes_to_add > size_type(this->_M_start._M_node - this->_M_map._M_data)) + _M_reallocate_map(__nodes_to_add, true); + } + + void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); +}; + +#if defined (deque) +# undef deque +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# include +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define _STLP_TEMPLATE_CONTAINER deque<_Tp, _Alloc> +#define _STLP_TEMPLATE_HEADER template +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + typedef __true_type implemented; + typedef typename __move_traits<_Alloc>::complete complete; +}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_DEQUE_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_epilog.h b/sdk/tlibstdcxx/stlport/stl/_epilog.h new file mode 100644 index 0000000000..0747ae3204 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_epilog.h @@ -0,0 +1,42 @@ +/* NOTE : this header has no guards and is MEANT for multiple inclusion! + * If you are using "header protection" option with your compiler, + * please also find #pragma which disables it and put it here, to + * allow reentrancy of this header. + */ + +#ifndef _STLP_PROLOG_HEADER_INCLUDED +# error STLport epilog header can not be included as long as prolog has not be included. +#endif + +/* If the platform provides any specific epilog actions, + * like #pragmas, do include platform-specific prolog file + */ +#if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) +# include +#endif + +#if !defined (_STLP_NO_POST_COMPATIBLE_SECTION) +# include +#endif + +#if defined (_STLP_USE_OWN_NAMESPACE) + +# if !defined (_STLP_DONT_REDEFINE_STD) +/* We redefine "std" to STLPORT, so that user code may use std:: transparently + * The STLPORT macro contains the STLport namespace name containing all the std + * stuff. + */ +# if defined (std) +/* + * Looks like the compiler native library on which STLport rely defined the std macro. + * This might introduce major incompatibility so report the problem to the STLport + * forum or comment the following #error at your own risk. + */ +# error Incompatible native Std library. +# endif /* std */ +# define std STLPORT +# endif /* _STLP_DONT_REDEFINE_STD */ + +#endif + +#undef _STLP_PROLOG_HEADER_INCLUDED /* defined in _prolog.h */ diff --git a/sdk/tlibstdcxx/stlport/stl/_exception.h b/sdk/tlibstdcxx/stlport/stl/_exception.h new file mode 100644 index 0000000000..5432ba943b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_exception.h @@ -0,0 +1,194 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +// The header contains low-level functions that interact +// with a compiler's exception-handling mechanism. It is assumed to +// be supplied with the compiler, rather than with the library, because +// it is inherently tied very closely to the compiler itself. + +// On platforms where does not exist, this header defines +// an exception base class. This is *not* a substitute for everything +// in , but it suffices to support a bare minimum of STL +// functionality. + +#ifndef _STLP_INTERNAL_EXCEPTION +#define _STLP_INTERNAL_EXCEPTION + +#if !defined (_STLP_NO_EXCEPTION_HEADER) + +# if defined ( _UNCAUGHT_EXCEPTION ) +# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT +# endif + +# if defined (_STLP_BROKEN_EXCEPTION_CLASS) +# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS +# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS +# if defined (_STLP_NO_NEW_NEW_HEADER) +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h) +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception) +# endif +# undef exception +# undef bad_exception +# else +# if defined (_STLP_NO_NEW_NEW_HEADER) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h) +# endif +# else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception) +# endif +# endif +# endif + +# if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1300) +// dwa 02/04/00 +// The header which ships with vc6 and is included by its native +// actually turns on warnings, so we have to turn them back off. +# include +# endif + +# if defined (_STLP_USE_OWN_NAMESPACE) + +_STLP_BEGIN_NAMESPACE +# if !defined (_STLP_BROKEN_EXCEPTION_CLASS) +# if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64) +using _STLP_VENDOR_EXCEPT_STD::exception; +# else +using ::exception; +# endif +using _STLP_VENDOR_EXCEPT_STD::bad_alloc; +using _STLP_VENDOR_EXCEPT_STD::bad_exception; +# endif + +# if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) +// fbp : many platforms present strange mix of +// those in various namespaces +# if !defined (_STLP_VENDOR_UNEXPECTED_STD) +# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD +# else +/* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD + * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD + * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction. + */ +# if !defined (_STLP_VENDOR_TERMINATE_STD) +# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD +# endif +# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) +# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD +# endif +# endif +# if !defined (_STLP_VENDOR_TERMINATE_STD) +# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD +# endif +# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) +# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD +# endif +# if !defined (_STLP_VENDOR_TERMINATE_STD) +# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD +# endif +# if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) +# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD +# endif +// weird errors +# if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT) +# if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300) +//See config/_intel.h for reason about this workaround +using std::unexpected; +# else +using _STLP_VENDOR_UNEXPECTED_STD::unexpected; +# endif +using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler; +using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected; +# endif +using _STLP_VENDOR_TERMINATE_STD::terminate; +using _STLP_VENDOR_TERMINATE_STD::terminate_handler; +using _STLP_VENDOR_TERMINATE_STD::set_terminate; + +# if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) +using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception; +# endif +# endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */ +_STLP_END_NAMESPACE +# endif /* _STLP_OWN_NAMESPACE */ +#else /* _STLP_NO_EXCEPTION_HEADER */ + +/* fbp : absence of usually means that those + * functions are not going to be called by compiler. + * Still, define them for the user. + * dums: Policy modification, if the function do not behave like the Standard + * defined it we do not grant it in the STLport namespace. We will have + * compile time error rather than runtime error. + */ +#if 0 +/* +typedef void (*unexpected_handler)(); +unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY; +void unexpected(); + +typedef void (*terminate_handler)(); +terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY; +void terminate(); + +bool uncaught_exception(); // not implemented under mpw as of Jan/1999 +*/ +#endif + +#endif /* _STLP_NO_EXCEPTION_HEADER */ + +#if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS) +_STLP_BEGIN_NAMESPACE + +// section 18.6.1 +class _STLP_CLASS_DECLSPEC exception { +public: +# ifndef _STLP_USE_NO_IOSTREAMS + exception() _STLP_NOTHROW; + virtual ~exception() _STLP_NOTHROW; + virtual const char* what() const _STLP_NOTHROW; +# else + exception() _STLP_NOTHROW {} + virtual ~exception() _STLP_NOTHROW {} + virtual const char* what() const _STLP_NOTHROW {return "class exception";} +# endif +}; + +// section 18.6.2.1 +class _STLP_CLASS_DECLSPEC bad_exception : public exception { +public: +# ifndef _STLP_USE_NO_IOSTREAMS + bad_exception() _STLP_NOTHROW; + ~bad_exception() _STLP_NOTHROW; + const char* what() const _STLP_NOTHROW; +# else + bad_exception() _STLP_NOTHROW {} + ~bad_exception() _STLP_NOTHROW {} + const char* what() const _STLP_NOTHROW {return "class bad_exception";} +# endif +}; + +// forward declaration +class __Named_exception; +_STLP_END_NAMESPACE +#endif + +#endif /* _STLP_INTERNAL_EXCEPTION */ diff --git a/sdk/tlibstdcxx/stlport/stl/_facets_fwd.h b/sdk/tlibstdcxx/stlport/stl/_facets_fwd.h new file mode 100644 index 0000000000..d4c8451f53 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_facets_fwd.h @@ -0,0 +1,53 @@ +#ifndef _STLP_FACETS_FWD_H +#define _STLP_FACETS_FWD_H + + +#include + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class money_get; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class money_put; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class num_get; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class num_put; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_get; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_put; + +_STLP_END_NAMESPACE + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_fstream.c b/sdk/tlibstdcxx/stlport/stl/_fstream.c new file mode 100644 index 0000000000..f1548ae6a3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_fstream.c @@ -0,0 +1,766 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_FSTREAM_C +#define _STLP_FSTREAM_C + +#ifndef _STLP_INTERNAL_FSTREAM_H +# include +#endif + +#ifndef _STLP_INTERNAL_LIMITS +# include +#endif + +_STLP_BEGIN_NAMESPACE + +# if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) +// no wchar_t is supported for this mode +# define __BF_int_type__ int +# define __BF_pos_type__ streampos +# define __BF_off_type__ streamoff +# else +# define __BF_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type +# define __BF_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::pos_type +# define __BF_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::off_type +# endif + + +//---------------------------------------------------------------------- +// Public basic_filebuf<> member functions + +template +basic_filebuf<_CharT, _Traits>::basic_filebuf() + : basic_streambuf<_CharT, _Traits>(), _M_base(), + _M_constant_width(false), _M_always_noconv(false), + _M_int_buf_dynamic(false), + _M_in_input_mode(false), _M_in_output_mode(false), + _M_in_error_mode(false), _M_in_putback_mode(false), + _M_int_buf(0), _M_int_buf_EOS(0), + _M_ext_buf(0), _M_ext_buf_EOS(0), + _M_ext_buf_converted(0), _M_ext_buf_end(0), + _M_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)), + _M_end_state(_STLP_DEFAULT_CONSTRUCTED(_State_type)), + _M_mmap_base(0), _M_mmap_len(0), + _M_saved_eback(0), _M_saved_gptr(0), _M_saved_egptr(0), + _M_codecvt(0), + _M_width(1), _M_max_width(1) +{ + this->_M_setup_codecvt(locale(), false); +} + +template +basic_filebuf<_CharT, _Traits>::~basic_filebuf() { + this->close(); + _M_deallocate_buffers(); +} + + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_filebuf<_CharT, _Traits>::int_type +basic_filebuf<_CharT, _Traits>::underflow() { + return _Underflow<_CharT, _Traits>::_M_doit(this); +} + +template +basic_filebuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::close() { + bool __ok = this->is_open(); + + if (_M_in_output_mode) { + __ok = __ok && !_Traits::eq_int_type(this->overflow(traits_type::eof()), + traits_type::eof()); + __ok == __ok && this->_M_unshift(); + } + else if (_M_in_input_mode) + this->_M_exit_input_mode(); + + // Note order of arguments. We close the file even if __ok is false. + __ok = _M_base._M_close() && __ok; + + // Restore the initial state, except that we don't deallocate the buffer + // or mess with the cached codecvt information. + _M_state = _M_end_state = _State_type(); + _M_ext_buf_converted = _M_ext_buf_end = 0; + + _M_mmap_base = 0; + _M_mmap_len = 0; + + this->setg(0, 0, 0); + this->setp(0, 0); + + _M_saved_eback = _M_saved_gptr = _M_saved_egptr = 0; + + _M_in_input_mode = _M_in_output_mode = _M_in_error_mode = _M_in_putback_mode + = false; + + return __ok ? this : 0; +} + +// This member function is called whenever we exit input mode. +// It unmaps the memory-mapped file, if any, and sets +// _M_in_input_mode to false. +template +void basic_filebuf<_CharT, _Traits>::_M_exit_input_mode() { + if (_M_mmap_base != 0) { + _M_base._M_unmap(_M_mmap_base, _M_mmap_len); + _M_mmap_base = 0; + _M_mmap_len = 0; + } + _M_in_input_mode = false; +} + + +//---------------------------------------------------------------------- +// basic_filebuf<> overridden protected virtual member functions + +template +streamsize basic_filebuf<_CharT, _Traits>::showmanyc() { + // Is there any possibility that reads can succeed? + if (!this->is_open() || _M_in_output_mode || _M_in_error_mode) + return -1; + else if (_M_in_putback_mode) + return this->egptr() - this->gptr(); + else if (_M_constant_width) { + streamoff __pos = _M_base._M_seek(0, ios_base::cur); + streamoff __size = _M_base._M_file_size(); + return __pos >= 0 && __size > __pos ? __size - __pos : 0; + } + else + return 0; +} + + +// Make a putback position available, if necessary, by switching to a +// special internal buffer used only for putback. The buffer is +// [_M_pback_buf, _M_pback_buf + _S_pback_buf_size), but the base +// class only sees a piece of it at a time. (We want to make sure +// that we don't try to read a character that hasn't been initialized.) +// The end of the putback buffer is always _M_pback_buf + _S_pback_buf_size, +// but the beginning is usually not _M_pback_buf. +template +__BF_int_type__ +basic_filebuf<_CharT, _Traits>::pbackfail(int_type __c) { + const int_type __eof = traits_type::eof(); + + // If we aren't already in input mode, pushback is impossible. + if (!_M_in_input_mode) + return __eof; + + // We can use the ordinary get buffer if there's enough space, and + // if it's a buffer that we're allowed to write to. + if (this->gptr() != this->eback() && + (traits_type::eq_int_type(__c, __eof) || + traits_type::eq(traits_type::to_char_type(__c), this->gptr()[-1]) || + !_M_mmap_base)) { + this->gbump(-1); + if (traits_type::eq_int_type(__c, __eof) || + traits_type::eq(traits_type::to_char_type(__c), *this->gptr())) + return traits_type::to_int_type(*this->gptr()); + } + else if (!traits_type::eq_int_type(__c, __eof)) { + // Are we in the putback buffer already? + _CharT* __pback_end = _M_pback_buf + __STATIC_CAST(int,_S_pback_buf_size); + if (_M_in_putback_mode) { + // Do we have more room in the putback buffer? + if (this->eback() != _M_pback_buf) + this->setg(this->egptr() - 1, this->egptr() - 1, __pback_end); + else + return __eof; // No more room in the buffer, so fail. + } + else { // We're not yet in the putback buffer. + _M_saved_eback = this->eback(); + _M_saved_gptr = this->gptr(); + _M_saved_egptr = this->egptr(); + this->setg(__pback_end - 1, __pback_end - 1, __pback_end); + _M_in_putback_mode = true; + } + } + else + return __eof; + + // We have made a putback position available. Assign to it, and return. + *this->gptr() = traits_type::to_char_type(__c); + return __c; +} + +// This member function flushes the put area, and also outputs the +// character __c (unless __c is eof). Invariant: we always leave room +// in the internal buffer for one character more than the base class knows +// about. We see the internal buffer as [_M_int_buf, _M_int_buf_EOS), but +// the base class only sees [_M_int_buf, _M_int_buf_EOS - 1). +template +__BF_int_type__ +basic_filebuf<_CharT, _Traits>::overflow(int_type __c) { + // Switch to output mode, if necessary. + if (!_M_in_output_mode) + if (!_M_switch_to_output_mode()) + return traits_type::eof(); + + _CharT* __ibegin = this->_M_int_buf; + _CharT* __iend = this->pptr(); + this->setp(_M_int_buf, _M_int_buf_EOS - 1); + + // Put __c at the end of the internal buffer. + if (!traits_type::eq_int_type(__c, traits_type::eof())) + *__iend++ = _Traits::to_char_type(__c); + + // For variable-width encodings, output may take more than one pass. + while (__ibegin != __iend) { + const _CharT* __inext = __ibegin; + char* __enext = _M_ext_buf; + typename _Codecvt::result __status + = _M_codecvt->out(_M_state, __ibegin, __iend, __inext, + _M_ext_buf, _M_ext_buf_EOS, __enext); + if (__status == _Codecvt::noconv) { + return _Noconv_output<_Traits>::_M_doit(this, __ibegin, __iend) + ? traits_type::not_eof(__c) + : _M_output_error(); + } + + // For a constant-width encoding we know that the external buffer + // is large enough, so failure to consume the entire internal buffer + // or to produce the correct number of external characters, is an error. + // For a variable-width encoding, however, we require only that we + // consume at least one internal character + else if (__status != _Codecvt::error && + (((__inext == __iend) && + (__enext - _M_ext_buf == _M_width * (__iend - __ibegin))) || + (!_M_constant_width && __inext != __ibegin))) { + // We successfully converted part or all of the internal buffer. + ptrdiff_t __n = __enext - _M_ext_buf; + if (_M_write(_M_ext_buf, __n)) + __ibegin += __inext - __ibegin; + else + return _M_output_error(); + } + else + return _M_output_error(); + } + + return traits_type::not_eof(__c); +} + +// This member function must be called before any I/O has been +// performed on the stream, otherwise it has no effect. +// +// __buf == 0 && __n == 0 means to make this stream unbuffered. +// __buf != 0 && __n > 0 means to use __buf as the stream's internal +// buffer, rather than the buffer that would otherwise be allocated +// automatically. __buf must be a pointer to an array of _CharT whose +// size is at least __n. +template +basic_streambuf<_CharT, _Traits>* +basic_filebuf<_CharT, _Traits>::setbuf(_CharT* __buf, streamsize __n) { + if (!_M_in_input_mode &&! _M_in_output_mode && !_M_in_error_mode && + _M_int_buf == 0) { + if (__buf == 0 && __n == 0) + _M_allocate_buffers(0, 1); + else if (__buf != 0 && __n > 0) + _M_allocate_buffers(__buf, __n); + } + return this; +} + +#if defined (_STLP_ASSERTIONS) +// helper class. +template +struct _Filebuf_Tmp_Buf { + _CharT* _M_ptr; + _Filebuf_Tmp_Buf(ptrdiff_t __n) : _M_ptr(0) { _M_ptr = new _CharT[__n]; } + ~_Filebuf_Tmp_Buf() { delete[] _M_ptr; } +}; +#endif + +template +__BF_pos_type__ +basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, + ios_base::seekdir __whence, + ios_base::openmode /* dummy */) { + if (!this->is_open()) + return pos_type(-1); + + if (!_M_constant_width && __off != 0) + return pos_type(-1); + + if (!_M_seek_init(__off != 0 || __whence != ios_base::cur)) + return pos_type(-1); + + // Seek to beginning or end, regardless of whether we're in input mode. + if (__whence == ios_base::beg || __whence == ios_base::end) + return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence), + _State_type()); + + // Seek relative to current position. Complicated if we're in input mode. + _STLP_ASSERT(__whence == ios_base::cur) + if (!_M_in_input_mode) + return _M_seek_return(_M_base._M_seek(_M_width * __off, __whence), + _State_type()); + + if (_M_mmap_base != 0) { + // __off is relative to gptr(). We need to do a bit of arithmetic + // to get an offset relative to the external file pointer. + streamoff __adjust = _M_mmap_len - (this->gptr() - (_CharT*) _M_mmap_base); + + // if __off == 0, we do not need to exit input mode and to shift file pointer + return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __adjust) + : _M_seek_return(_M_base._M_seek(__off - __adjust, ios_base::cur), _State_type()); + } + + if (_M_constant_width) { // Get or set the position. + streamoff __iadj = _M_width * (this->gptr() - this->eback()); + + // Compensate for offset relative to gptr versus offset relative + // to external pointer. For a text-oriented stream, where the + // compensation is more than just pointer arithmetic, we may get + // but not set the current position. + + if (__iadj <= _M_ext_buf_end - _M_ext_buf) { + streamoff __eadj = _M_base._M_get_offset(_M_ext_buf + __STATIC_CAST(ptrdiff_t, __iadj), _M_ext_buf_end); + + return __off == 0 ? pos_type(_M_base._M_seek(0, ios_base::cur) - __eadj) + : _M_seek_return(_M_base._M_seek(__off - __eadj, ios_base::cur), _State_type()); + } + } + else { // Get the position. Encoding is var width. + // Get position in internal buffer. + ptrdiff_t __ipos = this->gptr() - this->eback(); + + // Get corresponding position in external buffer. + _State_type __state = _M_state; + int __epos = _M_codecvt->length(__state, _M_ext_buf, _M_ext_buf_converted, + __ipos); +#if defined (_STLP_ASSERTIONS) + // Sanity check (expensive): make sure __epos is the right answer. + _STLP_ASSERT(__epos >= 0) + _State_type __tmp_state = _M_state; + _Filebuf_Tmp_Buf<_CharT> __buf(__ipos); + _CharT* __ibegin = __buf._M_ptr; + _CharT* __inext = __ibegin; + const char* __dummy; + typename _Codecvt::result __status + = _M_codecvt->in(__tmp_state, + _M_ext_buf, _M_ext_buf + __epos, __dummy, + __ibegin, __ibegin + __ipos, __inext); + // The result code is necessarily ok because: + // - noconv: impossible for a variable encoding + // - error: length method is supposed to count until it reach max value or find an error so we cannot have + // an error again when decoding an external buffer up to length return value. + // - partial: idem error, it is also a reason for length to stop counting. + _STLP_ASSERT(__status == _Codecvt::ok) + _STLP_ASSERT(__inext == __ibegin + __ipos) + _STLP_ASSERT(equal(this->eback(), this->gptr(), __ibegin, _STLP_PRIV _Eq_traits())) +#endif + // Get the current position (at the end of the external buffer), + // then adjust it. Again, it might be a text-oriented stream. + streamoff __cur = _M_base._M_seek(0, ios_base::cur); + streamoff __adj = _M_base._M_get_offset(_M_ext_buf, _M_ext_buf + __epos) - + _M_base._M_get_offset(_M_ext_buf, _M_ext_buf_end); + if (__cur != -1 && __cur + __adj >= 0) + return __off == 0 ? pos_type(__cur + __adj) + : _M_seek_return(__cur + __adj, __state); + } + + return pos_type(-1); +} + + +template +__BF_pos_type__ +basic_filebuf<_CharT, _Traits>::seekpos(pos_type __pos, + ios_base::openmode /* dummy */) { + if (this->is_open()) { + if (!_M_seek_init(true)) + return pos_type(-1); + + streamoff __off = off_type(__pos); + if (__off != -1 && _M_base._M_seek(__off, ios_base::beg) != -1) { + _M_state = __pos.state(); + return _M_seek_return(__off, __pos.state()); + } + } + + return pos_type(-1); +} + + +template +int basic_filebuf<_CharT, _Traits>::sync() { + if (_M_in_output_mode) + return traits_type::eq_int_type(this->overflow(traits_type::eof()), + traits_type::eof()) ? -1 : 0; + return 0; +} + + +// Change the filebuf's locale. This member function has no effect +// unless it is called before any I/O is performed on the stream. +template +void basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc) { + if (!_M_in_input_mode && !_M_in_output_mode && !_M_in_error_mode) { + this->_M_setup_codecvt(__loc); + } +} + +//---------------------------------------------------------------------- +// basic_filebuf<> helper functions. + +//---------------------------------------- +// Helper functions for switching between modes. + +// This member function is called if we're performing the first I/O +// operation on a filebuf, or if we're performing an input operation +// immediately after a seek. +template +bool basic_filebuf<_CharT, _Traits>::_M_switch_to_input_mode() { + if (this->is_open() && (((int)_M_base.__o_mode() & (int)ios_base::in) !=0) + && (_M_in_output_mode == 0) && (_M_in_error_mode == 0)) { + if (!_M_int_buf && !_M_allocate_buffers()) + return false; + + _M_ext_buf_converted = _M_ext_buf; + _M_ext_buf_end = _M_ext_buf; + + _M_end_state = _M_state; + + _M_in_input_mode = true; + return true; + } + + return false; +} + + +// This member function is called if we're performing the first I/O +// operation on a filebuf, or if we're performing an output operation +// immediately after a seek. +template +bool basic_filebuf<_CharT, _Traits>::_M_switch_to_output_mode() { + if (this->is_open() && (_M_base.__o_mode() & (int)ios_base::out) && + _M_in_input_mode == 0 && _M_in_error_mode == 0) { + + if (!_M_int_buf && !_M_allocate_buffers()) + return false; + + // In append mode, every write does an implicit seek to the end + // of the file. Whenever leaving output mode, the end of file + // get put in the initial shift state. + if (_M_base.__o_mode() & ios_base::app) + _M_state = _State_type(); + + this->setp(_M_int_buf, _M_int_buf_EOS - 1); + _M_in_output_mode = true; + return true; + } + + return false; +} + + +//---------------------------------------- +// Helper functions for input + +// This member function is called if there is an error during input. +// It puts the filebuf in error mode, clear the get area buffer, and +// returns eof. +// returns eof. Error mode is sticky; it is cleared only by close or +// seek. + +template +__BF_int_type__ +basic_filebuf<_CharT, _Traits>::_M_input_error() { + this->_M_exit_input_mode(); + _M_in_output_mode = false; + _M_in_error_mode = true; + this->setg(0, 0, 0); + return traits_type::eof(); +} + +template +__BF_int_type__ +basic_filebuf<_CharT, _Traits>::_M_underflow_aux() { + // We have the state and file position from the end of the internal + // buffer. This round, they become the beginning of the internal buffer. + _M_state = _M_end_state; + + // Fill the external buffer. Start with any leftover characters that + // didn't get converted last time. + if (_M_ext_buf_end > _M_ext_buf_converted) + + _M_ext_buf_end = _STLP_STD::copy(_M_ext_buf_converted, _M_ext_buf_end, _M_ext_buf); + // boris : copy_backward did not work + //_M_ext_buf_end = copy_backward(_M_ext_buf_converted, _M_ext_buf_end, + //_M_ext_buf+ (_M_ext_buf_end - _M_ext_buf_converted)); + else + _M_ext_buf_end = _M_ext_buf; + + // Now fill the external buffer with characters from the file. This is + // a loop because occasionally we don't get enough external characters + // to make progress. + for (;;) { + ptrdiff_t __n = _M_base._M_read(_M_ext_buf_end, _M_ext_buf_EOS - _M_ext_buf_end); + if (__n < 0) { + // Read failed, maybe we should set err bit on associated stream... + this->setg(0, 0, 0); + return traits_type::eof(); + } + + _M_ext_buf_end += __n; + + // If external buffer is empty there is nothing to do. + if (_M_ext_buf == _M_ext_buf_end) { + this->setg(0, 0, 0); + return traits_type::eof(); + } + + // Convert the external buffer to internal characters. + const char* __enext; + _CharT* __inext; + + typename _Codecvt::result __status + = _M_codecvt->in(_M_end_state, + _M_ext_buf, _M_ext_buf_end, __enext, + _M_int_buf, _M_int_buf_EOS, __inext); + + /* Error conditions: + * (1) Return value of error. + * (2) Producing internal characters without consuming external characters. + * (3) In fixed-width encodings, producing an internal sequence whose length + * is inconsistent with that of the internal sequence. + * (4) Failure to produce any characters if we have enough characters in + * the external buffer, where "enough" means the largest possible width + * of a single character. */ + if (__status == _Codecvt::noconv) + return _Noconv_input<_Traits>::_M_doit(this); + else if (__status == _Codecvt::error || + (__inext != _M_int_buf && __enext == _M_ext_buf) || + (_M_constant_width && (__inext - _M_int_buf) * _M_width != (__enext - _M_ext_buf)) || + (__inext == _M_int_buf && __enext - _M_ext_buf >= _M_max_width)) + return _M_input_error(); + else if (__inext != _M_int_buf) { + _M_ext_buf_converted = _M_ext_buf + (__enext - _M_ext_buf); + this->setg(_M_int_buf, _M_int_buf, __inext); + return traits_type::to_int_type(*_M_int_buf); + } + /* We need to go around the loop again to get more external characters. + * But if the previous read failed then don't try again for now. + * Don't enter error mode for a failed read. Error mode is sticky, + * and we might succeed if we try again. */ + if (__n <= 0) { + this->setg(0, 0, 0); + return traits_type::eof(); + } + } +} + +//---------------------------------------- +// Helper functions for output + +// This member function is called if there is an error during output. +// It puts the filebuf in error mode, clear the put area buffer, and +// returns eof. Error mode is sticky; it is cleared only by close or +// seek. +template +__BF_int_type__ +basic_filebuf<_CharT, _Traits>::_M_output_error() { + _M_in_output_mode = false; + _M_in_input_mode = false; + _M_in_error_mode = true; + this->setp(0, 0); + return traits_type::eof(); +} + + +// Write whatever sequence of characters is necessary to get back to +// the initial shift state. This function overwrites the external +// buffer, changes the external file position, and changes the state. +// Precondition: the internal buffer is empty. +template +bool basic_filebuf<_CharT, _Traits>::_M_unshift() { + if (_M_in_output_mode && !_M_constant_width) { + typename _Codecvt::result __status; + do { + char* __enext = _M_ext_buf; + __status = _M_codecvt->unshift(_M_state, + _M_ext_buf, _M_ext_buf_EOS, __enext); + if (__status == _Codecvt::noconv || + (__enext == _M_ext_buf && __status == _Codecvt::ok)) + return true; + else if (__status == _Codecvt::error) + return false; + else if (!_M_write(_M_ext_buf, __enext - _M_ext_buf)) + return false; + } while (__status == _Codecvt::partial); + } + + return true; +} + + +//---------------------------------------- +// Helper functions for buffer allocation and deallocation + +// This member function is called when we're initializing a filebuf's +// internal and external buffers. The argument is the size of the +// internal buffer; the external buffer is sized using the character +// width in the current encoding. Preconditions: the buffers are currently +// null. __n >= 1. __buf is either a null pointer or a pointer to an +// array show size is at least __n. + +// We need __n >= 1 for two different reasons. For input, the base +// class always needs a buffer because of the semantics of underflow(). +// For output, we want to have an internal buffer that's larger by one +// element than the buffer that the base class knows about. (See +// basic_filebuf<>::overflow() for the reason.) +template +bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers(_CharT* __buf, streamsize __n) { + //The major hypothesis in the following implementation is that size_t is unsigned. + //We also need streamsize byte representation to be larger or equal to the int + //representation to correctly store the encoding information. + _STLP_STATIC_ASSERT(!numeric_limits::is_signed && + sizeof(streamsize) >= sizeof(int)) + + if (__buf == 0) { + streamsize __bufsize = __n * sizeof(_CharT); + //We first check that the streamsize representation can't overflow a size_t one. + //If it can, we check that __bufsize is not higher than the size_t max value. + if ((sizeof(streamsize) > sizeof(size_t)) && + (__bufsize > __STATIC_CAST(streamsize, (numeric_limits::max)()))) + return false; + _M_int_buf = __STATIC_CAST(_CharT*, malloc(__STATIC_CAST(size_t, __bufsize))); + if (!_M_int_buf) + return false; + _M_int_buf_dynamic = true; + } + else { + _M_int_buf = __buf; + _M_int_buf_dynamic = false; + } + + streamsize __ebufsiz = (max)(__n * __STATIC_CAST(streamsize, _M_width), + __STATIC_CAST(streamsize, _M_codecvt->max_length())); + + _M_ext_buf = 0; + if ((sizeof(streamsize) < sizeof(size_t)) || + ((sizeof(streamsize) == sizeof(size_t)) && numeric_limits::is_signed) || + (__ebufsiz <= __STATIC_CAST(streamsize, (numeric_limits::max)()))) { + _M_ext_buf = __STATIC_CAST(char*, malloc(__STATIC_CAST(size_t, __ebufsiz))); + } + + if (!_M_ext_buf) { + _M_deallocate_buffers(); + return false; + } + + _M_int_buf_EOS = _M_int_buf + __STATIC_CAST(ptrdiff_t, __n); + _M_ext_buf_EOS = _M_ext_buf + __STATIC_CAST(ptrdiff_t, __ebufsiz); + return true; +} + +// Abbreviation for the most common case. +template +bool basic_filebuf<_CharT, _Traits>::_M_allocate_buffers() { + // Choose a buffer that's at least 4096 characters long and that's a + // multiple of the page size. + streamsize __default_bufsiz = + ((_M_base.__page_size() + 4095UL) / _M_base.__page_size()) * _M_base.__page_size(); + return _M_allocate_buffers(0, __default_bufsiz); +} + +template +void basic_filebuf<_CharT, _Traits>::_M_deallocate_buffers() { + if (_M_int_buf_dynamic) + free(_M_int_buf); + free(_M_ext_buf); + _M_int_buf = 0; + _M_int_buf_EOS = 0; + _M_ext_buf = 0; + _M_ext_buf_EOS = 0; +} + + +//---------------------------------------- +// Helper functiosn for seek and imbue + +template +bool basic_filebuf<_CharT, _Traits>::_M_seek_init(bool __do_unshift) { + // If we're in error mode, leave it. + _M_in_error_mode = false; + + // Flush the output buffer if we're in output mode, and (conditionally) + // emit an unshift sequence. + if (_M_in_output_mode) { + bool __ok = !traits_type::eq_int_type(this->overflow(traits_type::eof()), + traits_type::eof()); + if (__do_unshift) + __ok = __ok && this->_M_unshift(); + if (!__ok) { + _M_in_output_mode = false; + _M_in_error_mode = true; + this->setp(0, 0); + return false; + } + } + + // Discard putback characters, if any. + if (_M_in_input_mode && _M_in_putback_mode) + _M_exit_putback_mode(); + + return true; +} + + +/* Change the filebuf's locale. This member function has no effect + * unless it is called before any I/O is performed on the stream. + * This function is called on construction and on an imbue call. In the + * case of the construction the codecvt facet might be a custom one if + * the basic_filebuf user has instanciate it with a custom char_traits. + * The user will have to call imbue before any I/O operation. + */ +template +void basic_filebuf<_CharT, _Traits>::_M_setup_codecvt(const locale& __loc, bool __on_imbue) { + if (has_facet<_Codecvt>(__loc)) { + _M_codecvt = &use_facet<_Codecvt>(__loc) ; + int __encoding = _M_codecvt->encoding(); + + _M_width = (max)(__encoding, 1); + _M_max_width = _M_codecvt->max_length(); + _M_constant_width = __encoding > 0; + _M_always_noconv = _M_codecvt->always_noconv(); + } + else { + _M_codecvt = 0; + _M_width = _M_max_width = 1; + _M_constant_width = _M_always_noconv = false; + if (__on_imbue) { + //This call will generate an exception reporting the problem. + use_facet<_Codecvt>(__loc); + } + } +} + +_STLP_END_NAMESPACE + +# undef __BF_int_type__ +# undef __BF_pos_type__ +# undef __BF_off_type__ + +#endif /* _STLP_FSTREAM_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_fstream.h b/sdk/tlibstdcxx/stlport/stl/_fstream.h new file mode 100644 index 0000000000..1945e41188 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_fstream.h @@ -0,0 +1,714 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// This header defines classes basic_filebuf, basic_ifstream, +// basic_ofstream, and basic_fstream. These classes represent +// streambufs and streams whose sources or destinations are files. + +#ifndef _STLP_INTERNAL_FSTREAM_H +#define _STLP_INTERNAL_FSTREAM_H + +#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS) +# error This header file requires the -LANG:std option +#endif + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAM +# include +#endif + +#ifndef _STLP_INTERNAL_CODECVT_H +# include +#endif + +#if defined (_STLP_USE_WIN32_IO) +typedef void* _STLP_fd; +#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO) +typedef int _STLP_fd; +#else +# error "Configure i/o !" +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Class _Filebuf_base, a private base class to factor out the system- +// dependent code from basic_filebuf<>. + +class _STLP_CLASS_DECLSPEC _Filebuf_base { +public: // Opening and closing files. + _Filebuf_base(); + + bool _M_open(const char*, ios_base::openmode, long __protection); + bool _M_open(const char*, ios_base::openmode); + bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode); +#if defined (_STLP_USE_WIN32_IO) + bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode); +#endif /* _STLP_USE_WIN32_IO */ + bool _M_close(); + +public: // Low-level I/O, like Unix read/write + ptrdiff_t _M_read(char* __buf, ptrdiff_t __n); + streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir); + streamoff _M_file_size(); + bool _M_write(char* __buf, ptrdiff_t __n); + +public: // Memory-mapped I/O. + void* _M_mmap(streamoff __offset, streamoff __len); + void _M_unmap(void* __mmap_base, streamoff __len); + +public: + // Returns a value n such that, if pos is the file pointer at the + // beginning of the range [first, last), pos + n is the file pointer at + // the end. On many operating systems n == __last - __first. + // In Unix, writing n characters always bumps the file position by n. + // In Windows text mode, however, it bumps the file position by n + m, + // where m is the number of newlines in the range. That's because an + // internal \n corresponds to an external two-character sequence. + streamoff _M_get_offset(char* __first, char* __last) { +#if defined (_STLP_UNIX) || defined (_STLP_MAC) + return __last - __first; +#else // defined (_STLP_WIN32) + return ( (_M_openmode & ios_base::binary) != 0 ) + ? (__last - __first) + : count(__first, __last, '\n') + (__last - __first); +#endif + } + + // Returns true if we're in binary mode or if we're using an OS or file + // system where there is no distinction between text and binary mode. + bool _M_in_binary_mode() const { +#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__) + return true; +#elif defined (_STLP_WIN32) || defined (_STLP_VM) + return (_M_openmode & ios_base::binary) != 0; +#else +# error "Port!" +#endif + } + + static void _S_initialize(); + +protected: // Static data members. + static size_t _M_page_size; + +protected: // Data members. + _STLP_fd _M_file_id; +#if defined (_STLP_USE_STDIO_IO) + // for stdio, the whole FILE* is being kept here + FILE* _M_file; +#endif + ios_base::openmode _M_openmode ; + unsigned char _M_is_open ; + unsigned char _M_should_close ; + unsigned char _M_regular_file ; + +#if defined (_STLP_USE_WIN32_IO) + _STLP_fd _M_view_id; +#endif + +public : + static size_t _STLP_CALL __page_size() { return _M_page_size; } + int __o_mode() const { return (int)_M_openmode; } + bool __is_open() const { return (_M_is_open !=0 ); } + bool __should_close() const { return (_M_should_close != 0); } + bool __regular_file() const { return (_M_regular_file != 0); } + _STLP_fd __get_fd() const { return _M_file_id; } +}; + +//---------------------------------------------------------------------- +// Class basic_filebuf<>. + +// Forward declaration of two helper classes. +template class _Noconv_input; +template class _Noconv_output; + +// There is a specialized version of underflow, for basic_filebuf, +// in fstream.cpp. +template +class _Underflow; + +template +class basic_filebuf : public basic_streambuf<_CharT, _Traits> { +public: // Types. + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef typename _Traits::state_type _State_type; + typedef basic_streambuf<_CharT, _Traits> _Base; + typedef basic_filebuf<_CharT, _Traits> _Self; + +public: // Constructors, destructor. + basic_filebuf(); + ~basic_filebuf(); + +public: // Opening and closing files. + bool is_open() const { return _M_base.__is_open(); } + + _Self* open(const char* __s, ios_base::openmode __m) { + return _M_base._M_open(__s, __m) ? this : 0; + } + +#if !defined (_STLP_NO_EXTENSIONS) + // These two version of open() and file descriptor getter are extensions. + _Self* open(const char* __s, ios_base::openmode __m, + long __protection) { + return _M_base._M_open(__s, __m, __protection) ? this : 0; + } + + _STLP_fd fd() const { return _M_base.__get_fd(); } + + _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) { + return this->_M_open(__id, _Init_mode); + } + +# if defined (_STLP_USE_WIN32_IO) + _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) { + return _M_base._M_open(__id, _Init_mode) ? this : 0; + } +# endif /* _STLP_USE_WIN32_IO */ + +#endif + + _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) { + return _M_base._M_open(__id, _Init_mode) ? this : 0; + } + + _Self* close(); + +protected: // Virtual functions from basic_streambuf. + virtual streamsize showmanyc(); + virtual int_type underflow(); + + virtual int_type pbackfail(int_type = traits_type::eof()); + virtual int_type overflow(int_type = traits_type::eof()); + + virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize); + virtual pos_type seekoff(off_type, ios_base::seekdir, + ios_base::openmode = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type, + ios_base::openmode = ios_base::in | ios_base::out); + + virtual int sync(); + virtual void imbue(const locale&); + +private: // Helper functions. + + // Precondition: we are currently in putback input mode. Effect: + // switches back to ordinary input mode. + void _M_exit_putback_mode() { + this->setg(_M_saved_eback, _M_saved_gptr, _M_saved_egptr); + _M_in_putback_mode = false; + } + bool _M_switch_to_input_mode(); + void _M_exit_input_mode(); + bool _M_switch_to_output_mode(); + + int_type _M_input_error(); + int_type _M_underflow_aux(); + friend class _Underflow<_CharT, _Traits>; + + int_type _M_output_error(); + bool _M_unshift(); + + bool _M_allocate_buffers(_CharT* __buf, streamsize __n); + bool _M_allocate_buffers(); + void _M_deallocate_buffers(); + + pos_type _M_seek_return(off_type __off, _State_type __state) { + if (__off != -1) { + if (_M_in_input_mode) + _M_exit_input_mode(); + _M_in_input_mode = false; + _M_in_output_mode = false; + _M_in_putback_mode = false; + _M_in_error_mode = false; + this->setg(0, 0, 0); + this->setp(0, 0); + } + + pos_type __result(__off); + __result.state(__state); + return __result; + } + + bool _M_seek_init(bool __do_unshift); + + void _M_setup_codecvt(const locale&, bool __on_imbue = true); + +private: // Data members used in all modes. + + _Filebuf_base _M_base; + +private: // Locale-related information. + + unsigned char _M_constant_width; + unsigned char _M_always_noconv; + + // private: // Mode flags. + unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated, + // false if it was supplied by the user. + unsigned char _M_in_input_mode; + unsigned char _M_in_output_mode; + unsigned char _M_in_error_mode; + unsigned char _M_in_putback_mode; + + // Internal buffer: characters seen by the filebuf's clients. + _CharT* _M_int_buf; + _CharT* _M_int_buf_EOS; + + // External buffer: characters corresponding to the external file. + char* _M_ext_buf; + char* _M_ext_buf_EOS; + + // The range [_M_ext_buf, _M_ext_buf_converted) contains the external + // characters corresponding to the sequence in the internal buffer. The + // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that + // have been read into the external buffer but have not been converted + // to an internal sequence. + char* _M_ext_buf_converted; + char* _M_ext_buf_end; + + // State corresponding to beginning of internal buffer. + _State_type _M_state; + +private: // Data members used only in input mode. + + // Similar to _M_state except that it corresponds to + // the end of the internal buffer instead of the beginning. + _State_type _M_end_state; + + // This is a null pointer unless we are in mmap input mode. + void* _M_mmap_base; + streamoff _M_mmap_len; + +private: // Data members used only in putback mode. + _CharT* _M_saved_eback; + _CharT* _M_saved_gptr; + _CharT* _M_saved_egptr; + + typedef codecvt<_CharT, char, _State_type> _Codecvt; + const _Codecvt* _M_codecvt; + + int _M_width; // Width of the encoding (if constant), else 1 + int _M_max_width; // Largest possible width of single character. + + + enum { _S_pback_buf_size = 8 }; + _CharT _M_pback_buf[_S_pback_buf_size]; + + // for _Noconv_output +public: + bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); } + +public: + int_type + _M_do_noconv_input() { + _M_ext_buf_converted = _M_ext_buf_end; + /* this-> */ _Base::setg((char_type*)_M_ext_buf, (char_type*)_M_ext_buf, (char_type*)_M_ext_buf_end); + return traits_type::to_int_type(*_M_ext_buf); + } +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf >; +# if ! defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_filebuf >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +// +// This class had to be designed very carefully to work +// with Visual C++. +// +template +class _Noconv_output { +public: + typedef typename _Traits::char_type char_type; + static bool _STLP_CALL _M_doit(basic_filebuf*, + char_type*, char_type*) + { return false; } +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC _Noconv_output< char_traits > { +public: + static bool _STLP_CALL + _M_doit(basic_filebuf >* __buf, + char* __first, char* __last) { + ptrdiff_t __n = __last - __first; + return (__buf->_M_write(__first, __n)); + } +}; + +//---------------------------------------------------------------------- +// basic_filebuf<> helper functions. + + +//---------------------------------------- +// Helper functions for switching between modes. + +// +// This class had to be designed very carefully to work +// with Visual C++. +// +template +class _Noconv_input { +public: + typedef typename _Traits::int_type int_type; + typedef typename _Traits::char_type char_type; + + static inline int_type _STLP_CALL + _M_doit(basic_filebuf*) + { return _Traits::eof(); } +}; + +_STLP_TEMPLATE_NULL +class _Noconv_input > { +public: + static inline int _STLP_CALL + _M_doit(basic_filebuf >* __buf) { + return __buf->_M_do_noconv_input(); + } +}; + +// underflow() may be called for one of two reasons. (1) We've +// been going through the special putback buffer, and we need to move back +// to the regular internal buffer. (2) We've exhausted the internal buffer, +// and we need to replentish it. +template +class _Underflow { +public: + typedef typename _Traits::int_type int_type; + typedef _Traits traits_type; + + // There is a specialized version of underflow, for basic_filebuf, + // in fstream.cpp. + static int_type _STLP_CALL _M_doit(basic_filebuf<_CharT, _Traits>* __this) { + if (!__this->_M_in_input_mode) { + if (!__this->_M_switch_to_input_mode()) + return traits_type::eof(); + } + else if (__this->_M_in_putback_mode) { + __this->_M_exit_putback_mode(); + if (__this->gptr() != __this->egptr()) { + int_type __c = traits_type::to_int_type(*__this->gptr()); + return __c; + } + } + + return __this->_M_underflow_aux(); + } +}; + +// Specialization of underflow: if the character type is char, maybe +// we can use mmap instead of read. +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC _Underflow< char, char_traits > +{ + public: + typedef char_traits::int_type int_type; + typedef char_traits traits_type; + static int_type _STLP_CALL _M_doit(basic_filebuf* __this); +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS _Underflow >; +#endif + +//---------------------------------------------------------------------- +// Class basic_ifstream<> + +template +class basic_ifstream : public basic_istream<_CharT, _Traits> { +public: // Types + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_ios<_CharT, _Traits> _Basic_ios; + typedef basic_istream<_CharT, _Traits> _Base; + typedef basic_filebuf<_CharT, _Traits> _Buf; + +public: // Constructors, destructor. + + basic_ifstream() : + basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + } + + explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) : + basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), + _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__s, __mod | ios_base::in)) + this->setstate(ios_base::failbit); + } + +#if !defined (_STLP_NO_EXTENSIONS) + explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) : + basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__id, __mod | ios_base::in)) + this->setstate(ios_base::failbit); + } + basic_ifstream(const char* __s, ios_base::openmode __m, + long __protection) : + basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__s, __m | ios_base::in, __protection)) + this->setstate(ios_base::failbit); + } + +# if defined (_STLP_USE_WIN32_IO) + explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) : + basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__id, __mod | ios_base::in)) + this->setstate(ios_base::failbit); + } +# endif /* _STLP_USE_WIN32_IO */ +#endif + + ~basic_ifstream() {} + +public: // File and buffer operations. + basic_filebuf<_CharT, _Traits>* rdbuf() const + { return __CONST_CAST(_Buf*,&_M_buf); } + + bool is_open() { + return this->rdbuf()->is_open(); + } + + void open(const char* __s, ios_base::openmode __mod = ios_base::in) { + if (!this->rdbuf()->open(__s, __mod | ios_base::in)) + this->setstate(ios_base::failbit); + } + + void close() { + if (!this->rdbuf()->close()) + this->setstate(ios_base::failbit); + } + +private: + basic_filebuf<_CharT, _Traits> _M_buf; +}; + + +//---------------------------------------------------------------------- +// Class basic_ofstream<> + +template +class basic_ofstream : public basic_ostream<_CharT, _Traits> { +public: // Types + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_ios<_CharT, _Traits> _Basic_ios; + typedef basic_ostream<_CharT, _Traits> _Base; + typedef basic_filebuf<_CharT, _Traits> _Buf; + +public: // Constructors, destructor. + basic_ofstream() : + basic_ios<_CharT, _Traits>(), + basic_ostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + } + explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out) + : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__s, __mod | ios_base::out)) + this->setstate(ios_base::failbit); + } + +#if !defined (_STLP_NO_EXTENSIONS) + explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out) + : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), + _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__id, __mod | ios_base::out)) + this->setstate(ios_base::failbit); + } + basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) : + basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__s, __m | ios_base::out, __protection)) + this->setstate(ios_base::failbit); + } +# if defined (_STLP_USE_WIN32_IO) + explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out) + : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), + _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__id, __mod | ios_base::out)) + this->setstate(ios_base::failbit); + } +# endif /* _STLP_USE_WIN32_IO */ +#endif + + ~basic_ofstream() {} + +public: // File and buffer operations. + basic_filebuf<_CharT, _Traits>* rdbuf() const + { return __CONST_CAST(_Buf*,&_M_buf); } + + bool is_open() { + return this->rdbuf()->is_open(); + } + + void open(const char* __s, ios_base::openmode __mod= ios_base::out) { + if (!this->rdbuf()->open(__s, __mod | ios_base::out)) + this->setstate(ios_base::failbit); + } + + void close() { + if (!this->rdbuf()->close()) + this->setstate(ios_base::failbit); + } + +private: + basic_filebuf<_CharT, _Traits> _M_buf; +}; + + +//---------------------------------------------------------------------- +// Class basic_fstream<> + +template +class basic_fstream : public basic_iostream<_CharT, _Traits> { +public: // Types + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_ios<_CharT, _Traits> _Basic_ios; + typedef basic_iostream<_CharT, _Traits> _Base; + typedef basic_filebuf<_CharT, _Traits> _Buf; + +public: // Constructors, destructor. + + basic_fstream() + : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + } + + explicit basic_fstream(const char* __s, + ios_base::openmode __mod = ios_base::in | ios_base::out) : + basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__s, __mod)) + this->setstate(ios_base::failbit); + } + +#if !defined (_STLP_NO_EXTENSIONS) + explicit basic_fstream(int __id, + ios_base::openmode __mod = ios_base::in | ios_base::out) : + basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__id, __mod)) + this->setstate(ios_base::failbit); + } + basic_fstream(const char* __s, ios_base::openmode __m, long __protection) : + basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__s, __m, __protection)) + this->setstate(ios_base::failbit); + } +# if defined (_STLP_USE_WIN32_IO) + explicit basic_fstream(_STLP_fd __id, + ios_base::openmode __mod = ios_base::in | ios_base::out) : + basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() { + this->init(&_M_buf); + if (!_M_buf.open(__id, __mod)) + this->setstate(ios_base::failbit); + } +# endif /* _STLP_USE_WIN32_IO */ +#endif + ~basic_fstream() {} + +public: // File and buffer operations. + + basic_filebuf<_CharT, _Traits>* rdbuf() const + { return __CONST_CAST(_Buf*,&_M_buf); } + + bool is_open() { + return this->rdbuf()->is_open(); + } + + void open(const char* __s, + ios_base::openmode __mod = + ios_base::in | ios_base::out) { + if (!this->rdbuf()->open(__s, __mod)) + this->setstate(ios_base::failbit); + } + + void close() { + if (!this->rdbuf()->close()) + this->setstate(ios_base::failbit); + } + +private: + basic_filebuf<_CharT, _Traits> _M_buf; + +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) + typedef basic_fstream<_CharT, _Traits> _Self; + //explicitely defined as private to avoid warnings: + basic_fstream(_Self const&); + _Self& operator = (_Self const&); +#endif +}; + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream >; +_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream >; +_STLP_EXPORT_TEMPLATE_CLASS basic_fstream >; +# if ! defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_ifstream >; +_STLP_EXPORT_TEMPLATE_CLASS basic_ofstream >; +_STLP_EXPORT_TEMPLATE_CLASS basic_fstream >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_FSTREAM */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_function.h b/sdk/tlibstdcxx/stlport/stl/_function.h new file mode 100644 index 0000000000..bf4ad3ee4b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_function.h @@ -0,0 +1,433 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_FUNCTION_H +#define _STLP_INTERNAL_FUNCTION_H + +#ifndef _STLP_TYPE_TRAITS_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +struct not_equal_to : public binary_function<_Tp, _Tp, bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } +}; + +template +struct greater : public binary_function<_Tp, _Tp, bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } +}; + +template +struct greater_equal : public binary_function<_Tp, _Tp, bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } +}; + +template +struct less_equal : public binary_function<_Tp, _Tp, bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } +}; + +template +struct divides : public binary_function<_Tp, _Tp, _Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } +}; + +template +struct modulus : public binary_function<_Tp, _Tp, _Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } +}; + +template +struct negate : public unary_function<_Tp, _Tp> { + _Tp operator()(const _Tp& __x) const { return -__x; } +}; + +template +struct logical_and : public binary_function<_Tp, _Tp, bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } +}; + +template +struct logical_or : public binary_function<_Tp, _Tp,bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } +}; + +template +struct logical_not : public unary_function<_Tp, bool> { + bool operator()(const _Tp& __x) const { return !__x; } +}; + +#if !defined (_STLP_NO_EXTENSIONS) +// identity_element (not part of the C++ standard). +template inline _Tp identity_element(plus<_Tp>) { return _Tp(0); } +template inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); } +#endif + +#if defined (_STLP_BASE_TYPEDEF_BUG) +// this workaround is needed for SunPro 4.0.1 +// suggested by "Martin Abernethy" : + +// We have to introduce the XXary_predicate_aux structures in order to +// access the argument and return types of predicate functions supplied +// as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters +// of the form 'name1::name2', where name1 is itself a type parameter. +template +struct __pair_aux : private _Pair { + typedef typename _Pair::first_type first_type; + typedef typename _Pair::second_type second_type; +}; + +template +struct __unary_fun_aux : private _Operation { + typedef typename _Operation::argument_type argument_type; + typedef typename _Operation::result_type result_type; +}; + +template +struct __binary_fun_aux : private _Operation { + typedef typename _Operation::first_argument_type first_argument_type; + typedef typename _Operation::second_argument_type second_argument_type; + typedef typename _Operation::result_type result_type; +}; + +# define __UNARY_ARG(__Operation,__type) __unary_fun_aux<__Operation>::__type +# define __BINARY_ARG(__Operation,__type) __binary_fun_aux<__Operation>::__type +# define __PAIR_ARG(__Pair,__type) __pair_aux<__Pair>::__type +#else +# define __UNARY_ARG(__Operation,__type) __Operation::__type +# define __BINARY_ARG(__Operation,__type) __Operation::__type +# define __PAIR_ARG(__Pair,__type) __Pair::__type +#endif + +template +class unary_negate + : public unary_function { + typedef unary_function _Base; +public: + typedef typename _Base::argument_type argument_type; +private: + typedef typename __call_traits::const_param_type _ArgParamType; +protected: + _Predicate _M_pred; +public: + explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {} + bool operator()(_ArgParamType __x) const { + return !_M_pred(__x); + } +}; + +template +inline unary_negate<_Predicate> +not1(const _Predicate& __pred) { + return unary_negate<_Predicate>(__pred); +} + +template +class binary_negate + : public binary_function { + typedef binary_function _Base; +public: + typedef typename _Base::first_argument_type first_argument_type; + typedef typename _Base::second_argument_type second_argument_type; +private: + typedef typename __call_traits::const_param_type _FstArgParamType; + typedef typename __call_traits::const_param_type _SndArgParamType; +protected: + _Predicate _M_pred; +public: + explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {} + bool operator()(_FstArgParamType __x, _SndArgParamType __y) const { + return !_M_pred(__x, __y); + } +}; + +template +inline binary_negate<_Predicate> +not2(const _Predicate& __pred) { + return binary_negate<_Predicate>(__pred); +} + +template +class binder1st : + public unary_function { + typedef unary_function _Base; +public: + typedef typename _Base::argument_type argument_type; + typedef typename _Base::result_type result_type; +private: + typedef typename __call_traits::param_type _ArgParamType; + typedef typename __call_traits::const_param_type _ConstArgParamType; + typedef typename __call_traits::const_param_type _ValueParamType; +protected: + //op is a Standard name (20.3.6.1), do no make it STLport naming convention compliant. + _Operation op; + typename _Operation::first_argument_type _M_value; +public: + binder1st(const _Operation& __x, _ValueParamType __y) + : op(__x), _M_value(__y) {} + + result_type operator()(_ConstArgParamType __x) const + { return op(_M_value, __x); } + // DR 109 Missing binders for non-const sequence elements + result_type operator()(_ArgParamType __x) const + { return op(_M_value, __x); } +}; + +template +inline binder1st<_Operation> +bind1st(const _Operation& __fn, const _Tp& __x) { + typedef typename _Operation::first_argument_type _Arg1_type; + return binder1st<_Operation>(__fn, _Arg1_type(__x)); +} + +template +class binder2nd + : public unary_function { + typedef unary_function _Base; +public: + typedef typename _Base::argument_type argument_type; + typedef typename _Base::result_type result_type; +private: + typedef typename __call_traits::param_type _ArgParamType; + typedef typename __call_traits::const_param_type _ConstArgParamType; + typedef typename __call_traits::const_param_type _ValueParamType; +protected: + //op is a Standard name (20.3.6.3), do no make it STLport naming convention compliant. + _Operation op; + typename _Operation::second_argument_type value; +public: + binder2nd(const _Operation& __x, _ValueParamType __y) + : op(__x), value(__y) {} + + result_type operator()(_ConstArgParamType __x) const + { return op(__x, value); } + // DR 109 Missing binders for non-const sequence elements + result_type operator()(_ArgParamType __x) const + { return op(__x, value); } +}; + +template +inline binder2nd<_Operation> +bind2nd(const _Operation& __fn, const _Tp& __x) { + typedef typename _Operation::second_argument_type _Arg2_type; + return binder2nd<_Operation>(__fn, _Arg2_type(__x)); +} + +#if !defined (_STLP_NO_EXTENSIONS) +// unary_compose and binary_compose (extensions, not part of the standard). + +template +class unary_compose : + public unary_function { + typedef unary_function _Base; +public: + typedef typename _Base::argument_type argument_type; + typedef typename _Base::result_type result_type; +private: + typedef typename __call_traits::const_param_type _ArgParamType; +protected: + _Operation1 _M_fn1; + _Operation2 _M_fn2; +public: + unary_compose(const _Operation1& __x, const _Operation2& __y) + : _M_fn1(__x), _M_fn2(__y) {} + + result_type operator()(_ArgParamType __x) const { + return _M_fn1(_M_fn2(__x)); + } +}; + +template +inline unary_compose<_Operation1,_Operation2> +compose1(const _Operation1& __fn1, const _Operation2& __fn2) { + return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); +} + +template +class binary_compose : + public unary_function { + typedef unary_function _Base; +public: + typedef typename _Base::argument_type argument_type; + typedef typename _Base::result_type result_type; +private: + typedef typename __call_traits::const_param_type _ArgParamType; +protected: + _Operation1 _M_fn1; + _Operation2 _M_fn2; + _Operation3 _M_fn3; +public: + binary_compose(const _Operation1& __x, const _Operation2& __y, + const _Operation3& __z) + : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } + + result_type operator()(_ArgParamType __x) const { + return _M_fn1(_M_fn2(__x), _M_fn3(__x)); + } +}; + +template +inline binary_compose<_Operation1, _Operation2, _Operation3> +compose2(const _Operation1& __fn1, const _Operation2& __fn2, + const _Operation3& __fn3) { + return binary_compose<_Operation1,_Operation2,_Operation3>(__fn1, __fn2, __fn3); +} + +// identity is an extension: it is not part of the standard. +template struct identity : public _STLP_PRIV _Identity<_Tp> {}; +// select1st and select2nd are extensions: they are not part of the standard. +template struct select1st : public _STLP_PRIV _Select1st<_Pair> {}; +template struct select2nd : public _STLP_PRIV _Select2nd<_Pair> {}; + +template +struct project1st : public _STLP_PRIV _Project1st<_Arg1, _Arg2> {}; + +template +struct project2nd : public _STLP_PRIV _Project2nd<_Arg1, _Arg2> {}; + + +// constant_void_fun, constant_unary_fun, and constant_binary_fun are +// extensions: they are not part of the standard. (The same, of course, +// is true of the helper functions constant0, constant1, and constant2.) + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Constant_void_fun { + typedef _Result result_type; + result_type _M_val; + + _Constant_void_fun(const result_type& __v) : _M_val(__v) {} + const result_type& operator()() const { return _M_val; } +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +template +struct constant_void_fun : public _STLP_PRIV _Constant_void_fun<_Result> { + constant_void_fun(const _Result& __v) + : _STLP_PRIV _Constant_void_fun<_Result>(__v) {} +}; + +template +struct constant_unary_fun : public _STLP_PRIV _Constant_unary_fun<_Result, _Argument> { + constant_unary_fun(const _Result& __v) + : _STLP_PRIV _Constant_unary_fun<_Result, _Argument>(__v) {} +}; + +template +struct constant_binary_fun + : public _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2> { + constant_binary_fun(const _Result& __v) + : _STLP_PRIV _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {} +}; + +template +inline constant_void_fun<_Result> constant0(const _Result& __val) { + return constant_void_fun<_Result>(__val); +} + +template +inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) { + return constant_unary_fun<_Result,_Result>(__val); +} + +template +inline constant_binary_fun<_Result,_Result,_Result> +constant2(const _Result& __val) { + return constant_binary_fun<_Result,_Result,_Result>(__val); +} + +// subtractive_rng is an extension: it is not part of the standard. +// Note: this code assumes that int is 32 bits. +class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> { +private: + _STLP_UINT32_T _M_table[55]; + _STLP_UINT32_T _M_index1; + _STLP_UINT32_T _M_index2; +public: + _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) { + _M_index1 = (_M_index1 + 1) % 55; + _M_index2 = (_M_index2 + 1) % 55; + _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2]; + return _M_table[_M_index1] % __limit; + } + + void _M_initialize(_STLP_UINT32_T __seed) { + _STLP_UINT32_T __k = 1; + _M_table[54] = __seed; + _STLP_UINT32_T __i; + for (__i = 0; __i < 54; __i++) { + _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1; + _M_table[__ii] = __k; + __k = __seed - __k; + __seed = _M_table[__ii]; + } + for (int __loop = 0; __loop < 4; __loop++) { + for (__i = 0; __i < 55; __i++) + _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55]; + } + _M_index1 = 0; + _M_index2 = 31; + } + + subtractive_rng(unsigned int __seed) { _M_initialize(__seed); } + subtractive_rng() { _M_initialize(161803398ul); } +}; + +#endif /* _STLP_NO_EXTENSIONS */ + +_STLP_END_NAMESPACE + +#include + +#endif /* _STLP_INTERNAL_FUNCTION_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_function_adaptors.h b/sdk/tlibstdcxx/stlport/stl/_function_adaptors.h new file mode 100644 index 0000000000..0da419b9ad --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_function_adaptors.h @@ -0,0 +1,783 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * Copyright (c) 2000 + * Pavel Kuznetsov + * + * Copyright (c) 2001 + * Meridian'93 + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +// This file has noo macro protection as it is meant to be included several times +// from other header. +// Adaptor function objects: pointers to member functions. + +// There are a total of 16 = 2^4 function objects in this family. +// (1) Member functions taking no arguments vs member functions taking +// one argument. +// (2) Call through pointer vs call through reference. +// (3) Member function with void return type vs member function with +// non-void return type. +// (4) Const vs non-const member function. + +// Note that choice (3) is nothing more than a workaround: according +// to the draft, compilers should handle void and non-void the same way. +// This feature is not yet widely implemented, though. You can only use +// member functions returning void if your compiler supports partial +// specialization. + +// All of this complexity is in the function objects themselves. You can +// ignore it by using the helper function mem_fun and mem_fun_ref, +// which create whichever type of adaptor is appropriate. + +_STLP_BEGIN_NAMESPACE + +//This implementation will only be used if needed, that is to say when there is the return void bug +//and when there is no partial template specialization +#if defined (_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_MEMBER_TEMPLATE_CLASSES) + +template +class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> { +protected: + typedef _Result (_Tp::*__fun_type) (); + explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> { +protected: + typedef _Result (_Tp::*__fun_type) (_Arg); + explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Const_mem_fun0_ptr : public unary_function { +protected: + typedef _Result (_Tp::*__fun_type) () const; + explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Const_mem_fun1_ptr : public binary_function { +protected: + typedef _Result (_Tp::*__fun_type) (_Arg) const; + explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(const _Tp* __p, _Arg __x) const { + return (__p->*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Mem_fun0_ref : public unary_function<_Tp,_Result> { +protected: + typedef _Result (_Tp::*__fun_type) (); + explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> { +protected: + typedef _Result (_Tp::*__fun_type) (_Arg); + explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Const_mem_fun0_ref : public unary_function<_Tp,_Result> { +protected: + typedef _Result (_Tp::*__fun_type) () const; + explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Const_mem_fun1_ref : public binary_function<_Tp,_Arg,_Result> { +protected: + typedef _Result (_Tp::*__fun_type) (_Arg) const; + explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +struct _Mem_fun_traits { + template + struct _Args0 { + typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr; + typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const; + typedef _Mem_fun0_ref<_Result,_Tp> _Ref; + typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const; + }; + + template + struct _Args1 { + typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr; + typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const; + typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref; + typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const; + }; +}; + +template +class _Ptr_fun1_base : public unary_function<_Arg, _Result> { +protected: + typedef _Result (*__fun_type) (_Arg); + explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator()(_Arg __x) const { return _M_f(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> { +protected: + typedef _Result (*__fun_type) (_Arg1, _Arg2); + explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {} + +public: + _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); } + +private: + __fun_type _M_f; +}; + +template +struct _Ptr_fun_traits { + template struct _Args1 { + typedef _Ptr_fun1_base<_Arg,_Result> _Fun; + }; + + template struct _Args2 { + typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun; + }; +}; + +/* Specializations for void return type */ +template +class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> { +protected: + typedef void (_Tp::*__fun_type) (); + explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(_Tp* __p) const { (__p->*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> { +protected: + typedef void (_Tp::*__fun_type) (_Arg); + explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Void_const_mem_fun0_ptr : public unary_function { +protected: + typedef void (_Tp::*__fun_type) () const; + explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(const _Tp* __p) const { (__p->*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Void_const_mem_fun1_ptr : public binary_function { +protected: + typedef void (_Tp::*__fun_type) (_Arg) const; + explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Void_mem_fun0_ref : public unary_function<_Tp,void> { +protected: + typedef void (_Tp::*__fun_type) (); + explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(_Tp& __p) const { (__p.*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Void_mem_fun1_ref : public binary_function<_Tp,_Arg,void> { +protected: + typedef void (_Tp::*__fun_type) (_Arg); + explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Void_const_mem_fun0_ref : public unary_function<_Tp,void> { +protected: + typedef void (_Tp::*__fun_type) () const; + explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(const _Tp& __p) const { (__p.*_M_f)(); } + +private: + __fun_type _M_f; +}; + +template +class _Void_const_mem_fun1_ref : public binary_function<_Tp,_Arg,void> { +protected: + typedef void (_Tp::*__fun_type) (_Arg) const; + explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {} + +public: + void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); } + +private: + __fun_type _M_f; +}; + +_STLP_TEMPLATE_NULL +struct _Mem_fun_traits { + template struct _Args0 { + typedef _Void_mem_fun0_ptr<_Tp> _Ptr; + typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const; + typedef _Void_mem_fun0_ref<_Tp> _Ref; + typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const; + }; + + template struct _Args1 { + typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr; + typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const; + typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref; + typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const; + }; +}; + +template +class _Ptr_void_fun1_base : public unary_function<_Arg, void> { +protected: + typedef void (*__fun_type) (_Arg); + explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {} + +public: + void operator()(_Arg __x) const { _M_f(__x); } + +private: + __fun_type _M_f; +}; + +template +class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> { +protected: + typedef void (*__fun_type) (_Arg1, _Arg2); + explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {} + +public: + void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); } + +private: + __fun_type _M_f; +}; + +_STLP_TEMPLATE_NULL +struct _Ptr_fun_traits { + template struct _Args1 { + typedef _Ptr_void_fun1_base<_Arg> _Fun; + }; + + template struct _Args2 { + typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun; + }; +}; + +// pavel: need extra level of inheritance here since MSVC++ does not +// accept traits-based fake partial specialization for template +// arguments other than first + +template +class _Ptr_fun1 : + public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun { +protected: + typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base; + explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class _Ptr_fun2 : + public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun { +protected: + typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base; + explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class mem_fun_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base; +public: + explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class const_mem_fun_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base; +public: + explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class mem_fun_ref_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base; +public: + explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class const_mem_fun_ref_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base; +public: + explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class mem_fun1_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base; +public: + explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class const_mem_fun1_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base; +public: + explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class mem_fun1_ref_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base; +public: + explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class const_mem_fun1_ref_t : + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const { + typedef typename + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base; +public: + explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {} +}; + +template +class pointer_to_unary_function : + public _Ptr_fun1<_Result,_Arg> { + typedef typename + _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type; +public: + explicit pointer_to_unary_function(__fun_type __f) + : _Ptr_fun1<_Result,_Arg>(__f) {} +}; + +template +class pointer_to_binary_function : + public _Ptr_fun2<_Result,_Arg1,_Arg2> { + typedef typename + _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type; +public: + explicit pointer_to_binary_function(__fun_type __f) + : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {} +}; + +#else + +template +class mem_fun_t : public unary_function<_Tp*,_Ret> { + typedef _Ret (_Tp::*__fun_type)(void); +public: + explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun_t : public unary_function { + typedef _Ret (_Tp::*__fun_type)(void) const; +public: + explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class mem_fun_ref_t : public unary_function<_Tp,_Ret> { + typedef _Ret (_Tp::*__fun_type)(void); +public: + explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> { + typedef _Ret (_Tp::*__fun_type)(void) const; +public: + explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> { + typedef _Ret (_Tp::*__fun_type)(_Arg); +public: + explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun1_t : public binary_function { + typedef _Ret (_Tp::*__fun_type)(_Arg) const; +public: + explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(const _Tp* __p, _Arg __x) const + { return (__p->*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> { + typedef _Ret (_Tp::*__fun_type)(_Arg); +public: + explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> { + typedef _Ret (_Tp::*__fun_type)(_Arg) const; +public: + explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {} + _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class pointer_to_unary_function : public unary_function<_Arg, _Result> { +protected: + _Result (*_M_ptr)(_Arg); +public: + pointer_to_unary_function() {} + explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {} + _Result operator()(_Arg __x) const { return _M_ptr(__x); } +}; + +template +class pointer_to_binary_function : + public binary_function<_Arg1,_Arg2,_Result> { +protected: + _Result (*_M_ptr)(_Arg1, _Arg2); +public: + pointer_to_binary_function() {} + explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) + : _M_ptr(__x) {} + _Result operator()(_Arg1 __x, _Arg2 __y) const { + return _M_ptr(__x, __y); + } +}; + +# if defined (_STLP_DONT_RETURN_VOID) && !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) +//Partial specializations for the void type +template +class mem_fun_t : public unary_function<_Tp*,void> { + typedef void (_Tp::*__fun_type)(void); +public: + explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} + void operator()(_Tp* __p) const { (__p->*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun_t : public unary_function { + typedef void (_Tp::*__fun_type)(void) const; +public: + explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} + void operator()(const _Tp* __p) const { (__p->*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class mem_fun_ref_t : public unary_function<_Tp,void> { + typedef void (_Tp::*__fun_type)(void); +public: + explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} + void operator()(_Tp& __r) const { (__r.*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun_ref_t : public unary_function<_Tp,void> { + typedef void (_Tp::*__fun_type)(void) const; +public: + explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {} + void operator()(const _Tp& __r) const { (__r.*_M_f)(); } +private: + __fun_type _M_f; +}; + +template +class mem_fun1_t : public binary_function<_Tp*,_Arg,void> { + typedef void (_Tp::*__fun_type)(_Arg); +public: + explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} + void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun1_t + : public binary_function { + typedef void (_Tp::*__fun_type)(_Arg) const; +public: + explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} + void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class mem_fun1_ref_t + : public binary_function<_Tp,_Arg,void> { + typedef void (_Tp::*__fun_type)(_Arg); +public: + explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} + void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class const_mem_fun1_ref_t + : public binary_function<_Tp,_Arg,void> { + typedef void (_Tp::*__fun_type)(_Arg) const; +public: + explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {} + void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); } +private: + __fun_type _M_f; +}; + +template +class pointer_to_unary_function<_Arg, void> : public unary_function<_Arg, void> { + typedef void (*__fun_type)(_Arg); + __fun_type _M_ptr; +public: + pointer_to_unary_function() {} + explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {} + void operator()(_Arg __x) const { _M_ptr(__x); } +}; + +template +class pointer_to_binary_function<_Arg1, _Arg2, void> : public binary_function<_Arg1,_Arg2,void> { + typedef void (*__fun_type)(_Arg1, _Arg2); + __fun_type _M_ptr; +public: + pointer_to_binary_function() {} + explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {} + void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); } +}; + +# endif + +#endif + +#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG) +// Mem_fun adaptor helper functions. There are only two: +// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref +// are provided for backward compatibility, but they are no longer +// part of the C++ standard.) + +template +inline mem_fun_t<_Result,_Tp> +mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); } + +template +inline const_mem_fun_t<_Result,_Tp> +mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); } + +template +inline mem_fun_ref_t<_Result,_Tp> +mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); } + +template +inline const_mem_fun_ref_t<_Result,_Tp> +mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); } + +template +inline mem_fun1_t<_Result,_Tp,_Arg> +mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); } + +template +inline const_mem_fun1_t<_Result,_Tp,_Arg> +mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); } + +template +inline mem_fun1_ref_t<_Result,_Tp,_Arg> +mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } + +template +inline const_mem_fun1_ref_t<_Result,_Tp,_Arg> +mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } + +# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS)) +// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard, +// but they are provided for backward compatibility. +template +inline mem_fun1_t<_Result,_Tp,_Arg> +mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); } + +template +inline const_mem_fun1_t<_Result,_Tp,_Arg> +mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); } + +template +inline mem_fun1_ref_t<_Result,_Tp,_Arg> +mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } + +template +inline const_mem_fun1_ref_t<_Result,_Tp,_Arg> +mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); } + +# endif + +#endif + +template +inline pointer_to_unary_function<_Arg, _Result> +ptr_fun(_Result (*__f)(_Arg)) +{ return pointer_to_unary_function<_Arg, _Result>(__f); } + +template +inline pointer_to_binary_function<_Arg1,_Arg2,_Result> +ptr_fun(_Result (*__f)(_Arg1, _Arg2)) +{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); } + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/stlport/stl/_function_base.h b/sdk/tlibstdcxx/stlport/stl/_function_base.h new file mode 100644 index 0000000000..1e7f4f5484 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_function_base.h @@ -0,0 +1,217 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +#define _STLP_INTERNAL_FUNCTION_BASE_H + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_TYPE_TRAITS_H) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +struct unary_function { + typedef _Arg argument_type; + typedef _Result result_type; +#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580) +protected: + /* This class purpose is to be derived but it is not polymorphic so users should never try + * to destroy an instance of it directly. The protected non-virtual destructor make this + * fact obvious at compilation time. */ + ~unary_function() {} +#endif +}; + +template +struct binary_function { + typedef _Arg1 first_argument_type; + typedef _Arg2 second_argument_type; + typedef _Result result_type; +#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x580) +protected: + /* See unary_function comment. */ + ~binary_function() {} +#endif +}; + +template +struct equal_to : public binary_function<_Tp, _Tp, bool> { + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } +}; + +template +struct less : public binary_function<_Tp,_Tp,bool> +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* less is the default template parameter for many STL containers, to fully use + * the move constructor feature we need to know that the default less is just a + * functor. + */ + , public __stlport_class > +#endif +{ + bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } + +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(less<_Tp>& __x) {} +#endif +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __type_traits > { +#if !defined (__BORLANDC__) + typedef typename _IsSTLportClass >::_Ret _STLportLess; +#else + enum { _Is = _IsSTLportClass >::_Is }; + typedef typename __bool2type<_Is>::_Ret _STLportLess; +#endif + typedef _STLportLess has_trivial_default_constructor; + typedef _STLportLess has_trivial_copy_constructor; + typedef _STLportLess has_trivial_assignment_operator; + typedef _STLportLess has_trivial_destructor; + typedef _STLportLess is_POD_type; +}; +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +less<_Tp> __less(_Tp* ) { return less<_Tp>(); } + +template +equal_to<_Tp> __equal_to(_Tp* ) { return equal_to<_Tp>(); } + +_STLP_MOVE_TO_STD_NAMESPACE + +template +struct plus : public binary_function<_Tp, _Tp, _Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } +}; + +template +struct minus : public binary_function<_Tp, _Tp, _Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } +}; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +plus<_Tp> __plus(_Tp* ) { return plus<_Tp>(); } + +template +minus<_Tp> __minus(_Tp* ) { return minus<_Tp>(); } + +_STLP_MOVE_TO_STD_NAMESPACE + +template +struct multiplies : public binary_function<_Tp, _Tp, _Tp> { + _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } +}; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { + const typename _Pair::first_type& operator()(const _Pair& __x) const { + return __x.first; + } +}; + +template +struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { + const typename _Pair::second_type& operator()(const _Pair& __x) const { + return __x.second; + } +}; + +// project1st and project2nd are extensions: they are not part of the standard +template +struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> { + _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; } +}; + +template +struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> { + _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; } +}; + +#if defined (_STLP_MULTI_CONST_TEMPLATE_ARG_BUG) +// fbp : sort of select1st just for maps +template +// JDJ (CW Pro1 doesn't like const when first_type is also const) +struct __Select1st_hint : public unary_function<_Pair, _Whatever> { + const _Whatever& operator () (const _Pair& __x) const { return __x.first; } +}; +# define _STLP_SELECT1ST(__x,__y) _STLP_PRIV __Select1st_hint< __x, __y > +#else +# define _STLP_SELECT1ST(__x, __y) _STLP_PRIV _Select1st< __x > +#endif + +template +struct _Identity : public unary_function<_Tp,_Tp> { + const _Tp& operator()(const _Tp& __x) const { return __x; } +}; + +template +struct _Constant_unary_fun { + typedef _Argument argument_type; + typedef _Result result_type; + result_type _M_val; + + _Constant_unary_fun(const result_type& __v) : _M_val(__v) {} + const result_type& operator()(const _Argument&) const { return _M_val; } +}; + +template +struct _Constant_binary_fun { + typedef _Arg1 first_argument_type; + typedef _Arg2 second_argument_type; + typedef _Result result_type; + _Result _M_val; + + _Constant_binary_fun(const _Result& __v) : _M_val(__v) {} + const result_type& operator()(const _Arg1&, const _Arg2&) const { + return _M_val; + } +}; + +// identity_element (not part of the C++ standard). +template inline _Tp __identity_element(plus<_Tp>) { return _Tp(0); } +template inline _Tp __identity_element(multiplies<_Tp>) { return _Tp(1); } + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_FUNCTION_BASE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_hash_fun.h b/sdk/tlibstdcxx/stlport/stl/_hash_fun.h new file mode 100644 index 0000000000..6197d7b2e6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_hash_fun.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_HASH_FUN_H +#define _STLP_HASH_FUN_H + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template struct hash { }; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +inline size_t __stl_hash_string(const char* __s) { + _STLP_FIX_LITERAL_BUG(__s) + unsigned long __h = 0; + for ( ; *__s; ++__s) + __h = 5*__h + *__s; + + return size_t(__h); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_TEMPLATE_NULL +struct hash { + size_t operator()(const char* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + return _STLP_PRIV __stl_hash_string(__s); + } +}; + +_STLP_TEMPLATE_NULL +struct hash { + size_t operator()(const char* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + return _STLP_PRIV __stl_hash_string(__s); + } +}; + +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(char __x) const { return __x; } +}; +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(unsigned char __x) const { return __x; } +}; +#if !defined (_STLP_NO_SIGNED_BUILTINS) +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(unsigned char __x) const { return __x; } +}; +#endif +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(short __x) const { return __x; } +}; +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(unsigned short __x) const { return __x; } +}; +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(int __x) const { return __x; } +}; + +#if !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) || defined (_WIN64) +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(unsigned int __x) const { return __x; } +}; +#else +/* MSVC .Net since 2002 has a 64 bits portability warning feature. typedef + * like size_t are tagged as potential 64 bits variables making them different from + * unsigned int. To avoid the warning when a hash container is instanciated with + * the size_t key we prefer to grant the size_t specialization rather than the + * unsigned int one. + */ +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(size_t __x) const { return __x; } +}; +#endif + +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(long __x) const { return __x; } +}; +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(unsigned long __x) const { return __x; } +}; + +#if defined (_STLP_LONG_LONG) +_STLP_TEMPLATE_NULL struct hash<_STLP_LONG_LONG> { + size_t operator()(_STLP_LONG_LONG x) const { return (size_t)x; } +}; +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(unsigned _STLP_LONG_LONG x) const { return (size_t)x; } +}; +#endif + +_STLP_TEMPLATE_NULL +struct hash +{ + union __vp { + size_t s; + void *p; + }; + + size_t operator()(void *__x) const + { + __vp vp; + vp.p = __x; + return vp.s; + } +}; + +_STLP_END_NAMESPACE + +#endif /* _STLP_HASH_FUN_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_hash_map.h b/sdk/tlibstdcxx/stlport/stl/_hash_map.h new file mode 100644 index 0000000000..cd4660315a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_hash_map.h @@ -0,0 +1,500 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_HASH_MAP_H +#define _STLP_INTERNAL_HASH_MAP_H + +#ifndef _STLP_INTERNAL_HASHTABLE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMapTraitsT, traits) + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) > +class hash_map +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ +private: + typedef hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; +public: + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<_STLP_CONST key_type, data_type> value_type; +private: + //Specific iterator traits creation + typedef _STLP_PRIV _HashMapTraitsT _HashMapTraits; + +public: + typedef hashtable _Ht; + + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) +public: + hash_map() : _M_ht(0, hasher(), key_equal(), allocator_type()) {} + explicit hash_map(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_map(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + hash_map(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) { + } +#endif + +#ifdef _STLP_MEMBER_TEMPLATES + template + hash_map(_InputIterator __f, _InputIterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template + hash_map(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template + hash_map(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS + template + hash_map(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql) + : _M_ht(__n, __hf, __eql, allocator_type()) + { _M_ht.insert_unique(__f, __l); } +# endif + template + hash_map(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + +#else + hash_map(const value_type* __f, const value_type* __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + + hash_map(const_iterator __f, const_iterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_map(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + +public: + pair insert(const value_type& __obj) + { return _M_ht.insert_unique(__obj); } +#ifdef _STLP_MEMBER_TEMPLATES + template + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_unique(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) + { _M_ht.insert_unique(__f,__l); } + void insert(const_iterator __f, const_iterator __l) + { _M_ht.insert_unique(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + pair insert_noresize(const value_type& __obj) + { return _M_ht.insert_unique_noresize(__obj); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + _Tp& operator[](const _KT& __key) { + iterator __it = _M_ht.find(__key); + return (__it == _M_ht.end() ? + _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second : + (*__it).second ); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type erase(const _KT& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultimapTraitsT, traits) + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey,equal_to<_Key>), + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) > +class hash_multimap +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ +private: + typedef hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; +public: + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<_STLP_CONST key_type, data_type> value_type; +private: + //Specific iterator traits creation + typedef _STLP_PRIV _HashMultimapTraitsT _HashMultimapTraits; + +public: + typedef hashtable _Ht; + + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) +public: + hash_multimap() : _M_ht(0, hasher(), key_equal(), allocator_type()) {} + explicit hash_multimap(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_multimap(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + hash_multimap(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) { + } +#endif + +#ifdef _STLP_MEMBER_TEMPLATES + template + hash_multimap(_InputIterator __f, _InputIterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS + template + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql) + : _M_ht(__n, __hf, __eql, allocator_type()) + { _M_ht.insert_equal(__f, __l); } +# endif + template + hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + +#else + hash_multimap(const value_type* __f, const value_type* __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + + hash_multimap(const_iterator __f, const_iterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multimap(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + +public: + iterator insert(const value_type& __obj) + { return _M_ht.insert_equal(__obj); } +#ifdef _STLP_MEMBER_TEMPLATES + template + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_equal(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) { + _M_ht.insert_equal(__f,__l); + } + void insert(const_iterator __f, const_iterator __l) + { _M_ht.insert_equal(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + iterator insert_noresize(const value_type& __obj) + { return _M_ht.insert_equal_noresize(__obj); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair + equal_range(const _KT& __key) { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair + equal_range(const _KT& __key) const { return _M_ht.equal_range(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type erase(const _KT& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + +public: + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#define _STLP_TEMPLATE_CONTAINER hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > : + _STLP_PRIV __move_traits_help::_Ht> +{}; + +template +struct __move_traits > : + _STLP_PRIV __move_traits_help::_Ht> +{}; +# endif + +// Specialization of insert_iterator so that it will work for hash_map +// and hash_multimap. +template +class insert_iterator > { +protected: + typedef hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template +class insert_iterator > { +protected: + typedef hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_HASH_MAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_hash_set.h b/sdk/tlibstdcxx/stlport/stl/_hash_set.h new file mode 100644 index 0000000000..29b168b8dd --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_hash_set.h @@ -0,0 +1,495 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_HASH_SET_H +#define _STLP_INTERNAL_HASH_SET_H + +#ifndef _STLP_INTERNAL_HASHTABLE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(HashSetTraitsT, Const_traits) + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) > +class hash_set +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self; + //Specific iterator traits creation + typedef _STLP_PRIV _HashSetTraitsT<_Value> _HashSetTraits; +public: + typedef hashtable<_Value, _Value, _HashFcn, + _HashSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; +public: + typedef typename _Ht::key_type key_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + hash_set() + : _M_ht(0, hasher(), key_equal(), allocator_type()) {} + explicit hash_set(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_set(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) +#else + hash_set(size_type __n, const hasher& __hf, const key_equal& __eql) + : _M_ht(__n, __hf, __eql, allocator_type()) {} + hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a) +#endif + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + hash_set(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + hash_set(_InputIterator __f, _InputIterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template + hash_set(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template + hash_set(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + template + hash_set(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + hash_set(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql) + : _M_ht(__n, __hf, __eql, allocator_type()) + { _M_ht.insert_unique(__f, __l); } +# endif +#else + hash_set(const value_type* __f, const value_type* __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + + hash_set(const_iterator __f, const_iterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_unique(__f, __l); } + hash_set(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + +public: + pair insert(const value_type& __obj) + { return _M_ht.insert_unique(__obj); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __f, _InputIterator __l) +#else + void insert(const_iterator __f, const_iterator __l) + {_M_ht.insert_unique(__f, __l); } + void insert(const value_type* __f, const value_type* __l) +#endif + { _M_ht.insert_unique(__f,__l); } + + pair insert_noresize(const value_type& __obj) + { return _M_ht.insert_unique_noresize(__obj); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type erase(const _KT& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + +public: + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(HashMultisetTraitsT, Const_traits) + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) > +class hash_multiset +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self; + //Specific iterator traits creation + typedef _STLP_PRIV _HashMultisetTraitsT<_Value> _HashMultisetTraits; +public: + typedef hashtable<_Value, _Value, _HashFcn, + _HashMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; + + typedef typename _Ht::key_type key_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_funct() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + hash_multiset() + : _M_ht(0, hasher(), key_equal(), allocator_type()) {} + explicit hash_multiset(size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) {} + hash_multiset(size_type __n, const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) {} + hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql) + : _M_ht(__n, __hf, __eql, allocator_type()) {} + hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, + const allocator_type& __a) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + hash_multiset(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + hash_multiset(_InputIterator __f, _InputIterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + template + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + + template + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql) + : _M_ht(__n, __hf, __eql, allocator_type()) + { _M_ht.insert_equal(__f, __l); } +# endif +#else + hash_multiset(const value_type* __f, const value_type* __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const value_type* __f, const value_type* __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const value_type* __f, const value_type* __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + + hash_multiset(const_iterator __f, const_iterator __l) + : _M_ht(0, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const_iterator __f, const_iterator __l, size_type __n) + : _M_ht(__n, hasher(), key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf) + : _M_ht(__n, __hf, key_equal(), allocator_type()) + { _M_ht.insert_equal(__f, __l); } + hash_multiset(const_iterator __f, const_iterator __l, size_type __n, + const hasher& __hf, const key_equal& __eql, + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + +public: + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& hs) { _M_ht.swap(hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + +public: + iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __f, _InputIterator __l) + { _M_ht.insert_equal(__f,__l); } +#else + void insert(const value_type* __f, const value_type* __l) + { _M_ht.insert_equal(__f,__l); } + void insert(const_iterator __f, const_iterator __l) + { _M_ht.insert_equal(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + iterator insert_noresize(const value_type& __obj) + { return _M_ht.insert_equal_noresize(__obj); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type erase(const _KT& __key) {return _M_ht.erase(__key); } + void erase(iterator __it) { _M_ht.erase(__it); } + void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + +public: + void resize(size_type __hint) { _M_ht.resize(__hint); } + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const + { return _M_ht.elems_in_bucket(__n); } +}; + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER hash_set<_Value,_HashFcn,_EqualKey,_Alloc> + +#include + +#undef _STLP_TEMPLATE_CONTAINER +#define _STLP_TEMPLATE_CONTAINER hash_multiset<_Value,_HashFcn,_EqualKey,_Alloc> +#include + +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +// Specialization of insert_iterator so that it will work for hash_set +// and hash_multiset. + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux::_Ht> +{}; + +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux::_Ht> +{}; +# endif + +template +class insert_iterator > { +protected: + typedef hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template +class insert_iterator > { +protected: + typedef hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_HASH_SET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_hashtable.c b/sdk/tlibstdcxx/stlport/stl/_hashtable.c new file mode 100644 index 0000000000..b743156e46 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_hashtable.c @@ -0,0 +1,553 @@ +/* + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_HASHTABLE_C +#define _STLP_HASHTABLE_C + +#ifndef _STLP_INTERNAL_HASHTABLE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) + +_STLP_MOVE_TO_PRIV_NAMESPACE + +# define __PRIME_LIST_BODY { \ + 7ul, 23ul, \ + 53ul, 97ul, 193ul, 389ul, 769ul, \ + 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \ + 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \ + 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \ + 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\ + 1610612741ul, 3221225473ul, 4294967291ul \ +} + +template +const size_t* _STLP_CALL +_Stl_prime<_Dummy>::_S_primes(size_t &__size) { + static const size_t _list[] = __PRIME_LIST_BODY; +# ifndef __MWERKS__ + __size = sizeof(_list) / sizeof(_list[0]); +# else + __size = 30; +# endif + return _list; +} + +template +size_t _STLP_CALL +_Stl_prime<_Dummy>::_S_max_nb_buckets() { + size_t __size; + const size_t* __first = _S_primes(__size); + return *(__first + __size - 1); +} + +template +size_t _STLP_CALL +_Stl_prime<_Dummy>::_S_next_size(size_t __n) { + size_t __size; + const size_t* __first = _S_primes(__size); + const size_t* __last = __first + __size; + const size_t* pos = __lower_bound(__first, __last, __n, + __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0); + return (pos == __last ? *(__last - 1) : *pos); +} + +template +void _STLP_CALL +_Stl_prime<_Dummy>::_S_prev_sizes(size_t __n, size_t const*&__begin, size_t const*&__pos) { + size_t __size; + __begin = _S_primes(__size); + const size_t* __last = __begin + __size; + __pos = __lower_bound(__begin, __last, __n, + __less((size_t*)0), __less((size_t*)0), (ptrdiff_t*)0); + + if (__pos== __last) + --__pos; + else if (*__pos == __n) { + if (__pos != __begin) + --__pos; + } +} + +# undef __PRIME_LIST_BODY + +_STLP_MOVE_TO_STD_NAMESPACE + +#endif + +#if defined (_STLP_DEBUG) +# define hashtable _STLP_NON_DBG_NAME(hashtable) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +// fbp: these defines are for outline methods definitions. +// needed to definitions to be portable. Should not be used in method bodies. + +#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) +# define __size_type__ size_t +# define size_type size_t +# define value_type _Val +# define key_type _Key +# define __reference__ _Val& + +# define __iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits, \ + _Key, _HF, _ExK, _EqK, _All> +# define __const_iterator__ _Ht_iterator<_Val, _STLP_HEADER_TYPENAME _Traits::_ConstTraits, \ + _Key, _HF, _ExK, _EqK, _All> +#else +# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::size_type +# define __reference__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::reference +# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::iterator +# define __const_iterator__ _STLP_TYPENAME_ON_RETURN_TYPE hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All>::const_iterator +#endif + +/* + * This method is too difficult to implement for hashtable that do not + * require a sorted operation on the stored type. +template +bool hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_equal( + const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht1, + const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht2) { + return __ht1._M_buckets == __ht2._M_buckets && + __ht1._M_elems == __ht2._M_elems; +} +*/ + +/* Returns the iterator before the first iterator of the bucket __n and set + * __n to the first previous bucket having the same first iterator as bucket + * __n. + */ +template +__iterator__ +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_before_begin(size_type &__n) const { + return _S_before_begin(_M_elems, _M_buckets, __n); +} + +template +__iterator__ +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets, + size_type &__n) { + _ElemsCont &__mutable_elems = __CONST_CAST(_ElemsCont&, __elems); + typename _BucketVector::const_iterator __bpos(__buckets.begin() + __n); + + _ElemsIte __pos(*__bpos); + if (__pos == __mutable_elems.begin()) { + __n = 0; + return __mutable_elems.before_begin(); + } + + typename _BucketVector::const_iterator __bcur(__bpos); + _BucketType *__pos_node = __pos._M_node; + for (--__bcur; __pos_node == *__bcur; --__bcur); + + __n = __bcur - __buckets.begin() + 1; + _ElemsIte __cur(*__bcur); + _ElemsIte __prev = __cur++; + for (; __cur != __pos; ++__prev, ++__cur); + return __prev; +} + + +template +__iterator__ +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_insert_noresize(size_type __n, const value_type& __obj) { + //We always insert this element as 1st in the bucket to not break + //the elements order as equal elements must be kept next to each other. + size_type __prev = __n; + _ElemsIte __pos = _M_before_begin(__prev)._M_ite; + + fill(_M_buckets.begin() + __prev, _M_buckets.begin() + __n + 1, + _M_elems.insert_after(__pos, __obj)._M_node); + ++_M_num_elements; + return iterator(_ElemsIte(_M_buckets[__n])); +} + +template +pair<__iterator__, bool> +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::insert_unique_noresize(const value_type& __obj) { + const size_type __n = _M_bkt_num(__obj); + _ElemsIte __cur(_M_buckets[__n]); + _ElemsIte __last(_M_buckets[__n + 1]); + + if (__cur != __last) { + for (; __cur != __last; ++__cur) { + if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) { + //We check that equivalent keys have equals hash code as otherwise, on resize, + //equivalent value might not be in the same bucket + _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj))) + return pair(iterator(__cur), false); + } + } + /* Here we do not rely on the _M_insert_noresize method as we know + * that we cannot break element orders, elements are unique, and + * insertion after the first bucket element is faster than what is + * done in _M_insert_noresize. + */ + __cur = _M_elems.insert_after(_ElemsIte(_M_buckets[__n]), __obj); + ++_M_num_elements; + return pair(iterator(__cur), true); + } + + return pair(_M_insert_noresize(__n, __obj), true); +} + +template +__iterator__ +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::insert_equal_noresize(const value_type& __obj) { + const size_type __n = _M_bkt_num(__obj); + { + _ElemsIte __cur(_M_buckets[__n]); + _ElemsIte __last(_M_buckets[__n + 1]); + + for (; __cur != __last; ++__cur) { + if (_M_equals(_M_get_key(*__cur), _M_get_key(__obj))) { + //We check that equivalent keys have equals hash code as otherwise, on resize, + //equivalent value might not be in the same bucket + _STLP_ASSERT(_M_hash(_M_get_key(*__cur)) == _M_hash(_M_get_key(__obj))) + ++_M_num_elements; + return _M_elems.insert_after(__cur, __obj); + } + } + } + + return _M_insert_noresize(__n, __obj); +} + +template +__reference__ +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_insert(const value_type& __obj) { + _M_enlarge(_M_num_elements + 1); + return *insert_unique_noresize(__obj).first; +} + +template +__size_type__ +hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::erase(const key_type& __key) { + const size_type __n = _M_bkt_num_key(__key); + + _ElemsIte __cur(_M_buckets[__n]); + _ElemsIte __last(_M_buckets[__n + 1]); + if (__cur == __last) + return 0; + + size_type __erased = 0; + if (_M_equals(_M_get_key(*__cur), __key)) { + //We look for the pos before __cur: + size_type __prev_b = __n; + _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite; + do { + __cur = _M_elems.erase_after(__prev); + ++__erased; + } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key)); + fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, __cur._M_node); + } + else { + _ElemsIte __prev = __cur++; + for (; __cur != __last; ++__prev, ++__cur) { + if (_M_equals(_M_get_key(*__cur), __key)) { + do { + __cur = _M_elems.erase_after(__prev); + ++__erased; + } while ((__cur != __last) && _M_equals(_M_get_key(*__cur), __key)); + break; + } + } + } + + _M_num_elements -= __erased; + _M_reduce(); + return __erased; +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::erase(const_iterator __it) { + const size_type __n = _M_bkt_num(*__it); + _ElemsIte __cur(_M_buckets[__n]); + + size_type __erased = 0; + if (__cur == __it._M_ite) { + size_type __prev_b = __n; + _ElemsIte __prev = _M_before_begin(__prev_b)._M_ite; + fill(_M_buckets.begin() + __prev_b, _M_buckets.begin() + __n + 1, + _M_elems.erase_after(__prev)._M_node); + ++__erased; + } + else { + _ElemsIte __prev = __cur++; + _ElemsIte __last(_M_buckets[__n + 1]); + for (; __cur != __last; ++__prev, ++__cur) { + if (__cur == __it._M_ite) { + _M_elems.erase_after(__prev); + ++__erased; + break; + } + } + } + + _M_num_elements -= __erased; + _M_reduce(); +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::erase(const_iterator __first, const_iterator __last) { + if (__first == __last) + return; + size_type __f_bucket = _M_bkt_num(*__first); + size_type __l_bucket = __last != end() ? _M_bkt_num(*__last) : (_M_buckets.size() - 1); + + _ElemsIte __cur(_M_buckets[__f_bucket]); + _ElemsIte __prev; + if (__cur == __first._M_ite) { + __prev = _M_before_begin(__f_bucket)._M_ite; + } + else { + _ElemsIte __last(_M_buckets[++__f_bucket]); + __prev = __cur++; + for (; (__cur != __last) && (__cur != __first._M_ite); ++__prev, ++__cur); + } + size_type __erased = 0; + //We do not use the slist::erase_after method taking a range to count the + //number of erased elements: + while (__cur != __last._M_ite) { + __cur = _M_elems.erase_after(__prev); + ++__erased; + } + fill(_M_buckets.begin() + __f_bucket, _M_buckets.begin() + __l_bucket + 1, __cur._M_node); + _M_num_elements -= __erased; + _M_reduce(); +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::rehash(size_type __num_buckets_hint) { + if (bucket_count() >= __num_buckets_hint) { + // We are trying to reduce number of buckets, we have to validate it: + size_type __limit_num_buckets = (size_type)((float)size() / max_load_factor()); + if (__num_buckets_hint < __limit_num_buckets) { + // Targetted number of buckets __num_buckets_hint would break + // load_factor() <= max_load_factor() rule. + return; + } + } + + _M_rehash(__num_buckets_hint); +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_enlarge(size_type __to_size) { + size_type __num_buckets = bucket_count(); + size_type __num_buckets_hint = (size_type)((float)__to_size / max_load_factor()); + if (__num_buckets_hint <= __num_buckets) { + return; + } + __num_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__num_buckets_hint); + + _M_rehash(__num_buckets); +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_reduce() { + size_type __num_buckets = bucket_count(); + // We only try to reduce the hashtable if the theorical load factor + // is lower than a fraction of the max load factor: + // 4 factor is coming from the fact that prime number list is almost a + // geometrical suite with reason 2, as we try to jump 2 levels is means + // a 4 factor. + if ((float)size() / (float)__num_buckets > max_load_factor() / 4.0f) + return; + + const size_type *__first; + const size_type *__prev; + _STLP_PRIV _Stl_prime_type::_S_prev_sizes(__num_buckets, __first, __prev); + + /* We are only going to reduce number of buckets if moving to yet the previous number + * of buckets in the prime numbers would respect the load rule. Otherwise algorithm + * successively removing and adding an element would each time perform an expensive + * rehash operation. */ + const size_type *__prev_prev = __prev; + if (__prev_prev != __first) { + --__prev_prev; + if ((float)size() / (float)*__prev_prev > max_load_factor()) + return; + } + else { + if (*__prev >= __num_buckets) + return; + } + + // Can we reduce further: + while (__prev_prev != __first) { + --__prev_prev; + if ((float)size() / (float)*__prev_prev > max_load_factor()) + // We cannot reduce further. + break; + --__prev; + } + + _M_rehash(*__prev); +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_resize() { + if (load_factor() > max_load_factor()) { + // We have to enlarge + _M_enlarge(size()); + } + else { + // We can try to reduce size: + _M_reduce(); + } +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_rehash(size_type __num_buckets) { +#if defined (_STLP_DEBUG) + _M_check(); +#endif + _ElemsCont __tmp_elems(_M_elems.get_allocator()); + _BucketVector __tmp(__num_buckets + 1, __STATIC_CAST(_BucketType*, 0), _M_buckets.get_allocator()); + _ElemsIte __cur, __last(_M_elems.end()); + while (!_M_elems.empty()) { + __cur = _M_elems.begin(); + size_type __new_bucket = _M_bkt_num(*__cur, __num_buckets); + _ElemsIte __ite(__cur), __before_ite(__cur); + for (++__ite; + __ite != __last && _M_equals(_M_get_key(*__cur), _M_get_key(*__ite)); + ++__ite, ++__before_ite); + size_type __prev_bucket = __new_bucket; + _ElemsIte __prev = _S_before_begin(__tmp_elems, __tmp, __prev_bucket)._M_ite; + __tmp_elems.splice_after(__prev, _M_elems, _M_elems.before_begin(), __before_ite); + fill(__tmp.begin() + __prev_bucket, __tmp.begin() + __new_bucket + 1, __cur._M_node); + } + _M_elems.swap(__tmp_elems); + _M_buckets.swap(__tmp); +} + +#if defined (_STLP_DEBUG) +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::_M_check() const { + //We check that hash code of stored keys haven't change and also that equivalent + //relation hasn't been modified + size_t __num_buckets = bucket_count(); + for (size_t __b = 0; __b < __num_buckets; ++__b) { + _ElemsIte __cur(_M_buckets[__b]), __last(_M_buckets[__b + 1]); + _ElemsIte __fst(__cur), __snd(__cur); + for (; __cur != __last; ++__cur) { + _STLP_ASSERT( _M_bkt_num(*__cur, __num_buckets) == __b ) + _STLP_ASSERT( !_M_equals(_M_get_key(*__fst), _M_get_key(*__cur)) || _M_equals(_M_get_key(*__snd), _M_get_key(*__cur)) ) + if (__fst != __snd) + ++__fst; + if (__snd != __cur) + ++__snd; + } + } +} +#endif + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>::clear() { + _M_elems.clear(); + _M_buckets.assign(_M_buckets.size(), __STATIC_CAST(_BucketType*, 0)); + _M_num_elements = 0; +} + +template +void hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> + ::_M_copy_from(const hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All>& __ht) { + _M_elems.clear(); + _M_elems.insert(_M_elems.end(), __ht._M_elems.begin(), __ht._M_elems.end()); + _M_buckets.resize(__ht._M_buckets.size()); + _ElemsConstIte __src(__ht._M_elems.begin()), __src_end(__ht._M_elems.end()); + _ElemsIte __dst(_M_elems.begin()); + typename _BucketVector::const_iterator __src_b(__ht._M_buckets.begin()), + __src_end_b(__ht._M_buckets.end()); + typename _BucketVector::iterator __dst_b(_M_buckets.begin()), __dst_end_b(_M_buckets.end()); + for (; __src != __src_end; ++__src, ++__dst) { + for (; __src_b != __src_end_b; ++__src_b, ++__dst_b) { + if (*__src_b == __src._M_node) { + *__dst_b = __dst._M_node; + } + else + break; + } + } + fill(__dst_b, __dst_end_b, __STATIC_CAST(_BucketType*, 0)); + _M_num_elements = __ht._M_num_elements; + _M_max_load_factor = __ht._M_max_load_factor; +} + +#undef __iterator__ +#undef const_iterator +#undef __size_type__ +#undef __reference__ +#undef size_type +#undef value_type +#undef key_type +#undef __stl_num_primes + +#if defined (_STLP_DEBUG) +# undef hashtable +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_HASHTABLE_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_hashtable.h b/sdk/tlibstdcxx/stlport/stl/_hashtable.h new file mode 100644 index 0000000000..1c8e2f5434 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_hashtable.h @@ -0,0 +1,658 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_HASHTABLE_H +#define _STLP_INTERNAL_HASHTABLE_H + +#ifndef _STLP_INTERNAL_VECTOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_SLIST_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_HASH_FUN_H +# include +#endif + +/* + * Hashtable class, used to implement the hashed associative containers + * hash_set, hash_map, hash_multiset, hash_multimap, + * unordered_set, unordered_map, unordered_multiset, unordered_multimap. + */ + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +//Export of the classes used to represent buckets in the hashtable implementation. +# if !defined (_STLP_USE_PTR_SPECIALIZATIONS) +//If pointer specialization is enabled vector<_Slist_node_base*> will use the void* +//storage type for which internal classes have already been exported. +_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _Slist_node_base*>; + +_STLP_MOVE_TO_PRIV_NAMESPACE +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base**, _Slist_node_base*, + allocator<_Slist_node_base*> >; +_STLP_EXPORT_TEMPLATE_CLASS _Vector_base<_Slist_node_base*, + allocator<_Slist_node_base*> >; +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +# if defined (_STLP_DEBUG) +_STLP_MOVE_TO_PRIV_NAMESPACE +# define _STLP_NON_DBG_VECTOR _STLP_NON_DBG_NAME(vector) +_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> > >; +_STLP_EXPORT_TEMPLATE_CLASS _STLP_NON_DBG_VECTOR<_Slist_node_base*, allocator<_Slist_node_base*> >; +# undef _STLP_NON_DBG_VECTOR +_STLP_MOVE_TO_STD_NAMESPACE +# endif + +_STLP_EXPORT_TEMPLATE_CLASS vector<_STLP_PRIV _Slist_node_base*, + allocator<_STLP_PRIV _Slist_node_base*> >; +#endif + +#if defined (_STLP_DEBUG) +# define hashtable _STLP_NON_DBG_NAME(hashtable) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +// some compilers require the names of template parameters to be the same +template +class hashtable; + +#if !defined (_STLP_DEBUG) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template +struct _Ht_iterator { + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef typename _Traits::_NonConstTraits _NonConstTraits; + + typedef _Ht_iterator<_BaseIte,_Traits> _Self; + + typedef typename _Traits::value_type value_type; + typedef typename _Traits::pointer pointer; + typedef typename _Traits::reference reference; + typedef forward_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + + typedef _Ht_iterator<_BaseIte, _NonConstTraits> iterator; + typedef _Ht_iterator<_BaseIte, _ConstTraits> const_iterator; + + _Ht_iterator() {} + //copy constructor for iterator and constructor from iterator for const_iterator + _Ht_iterator(const iterator& __it) : _M_ite(__it._M_ite) {} + _Ht_iterator(_BaseIte __it) : _M_ite(__it) {} + + reference operator*() const { + return *_M_ite; + } + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + ++_M_ite; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + ++*this; + return __tmp; + } + + bool operator == (const_iterator __rhs) const { + return _M_ite == __rhs._M_ite; + } + bool operator != (const_iterator __rhs) const { + return _M_ite != __rhs._M_ite; + } + + _BaseIte _M_ite; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __type_traits<_STLP_PRIV _Ht_iterator<_BaseIte, _Traits> > { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +template +inline +# if defined (_STLP_NESTED_TYPE_PARAM_BUG) +_STLP_TYPENAME_ON_RETURN_TYPE _Traits::value_type * +# else +_STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type * +# endif +value_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) { + typedef _STLP_TYPENAME _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>::value_type _Val; + return (_Val*) 0; +} +template +inline forward_iterator_tag iterator_category(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) +{ return forward_iterator_tag(); } +template +inline ptrdiff_t* distance_type(const _STLP_PRIV _Ht_iterator<_BaseIte,_Traits>&) +{ return (ptrdiff_t*) 0; } +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class _Stl_prime { + // Returns begining of primes list and size by reference. + static const size_t* _S_primes(size_t&); +public: + //Returns the maximum number of buckets handled by the hashtable implementation + static size_t _STLP_CALL _S_max_nb_buckets(); + + //Returns the bucket size next to a required size + static size_t _STLP_CALL _S_next_size(size_t); + + // Returns the bucket range containing sorted list of prime numbers <= __hint. + static void _STLP_CALL _S_prev_sizes(size_t __hint, const size_t *&__begin, const size_t *&__end); +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _Stl_prime; +#endif + +typedef _Stl_prime _Stl_prime_type; + +#if !defined (_STLP_DEBUG) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +/* + * Hashtables handle allocators a bit differently than other containers + * do. If we're using standard-conforming allocators, then a hashtable + * unconditionally has a member variable to hold its allocator, even if + * it so happens that all instances of the allocator type are identical. + * This is because, for hashtables, this extra storage is negligible. + * Additionally, a base class wouldn't serve any other purposes; it + * wouldn't, for example, simplify the exception-handling code. + */ +template +class hashtable { + typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self; + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits; + typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits; + +public: + typedef _Key key_type; + typedef _Val value_type; + typedef _HF hasher; + typedef _EqK key_equal; + + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef typename _NonConstTraits::pointer pointer; + typedef const value_type* const_pointer; + typedef typename _NonConstTraits::reference reference; + typedef const value_type& const_reference; + typedef forward_iterator_tag _Iterator_category; + + hasher hash_funct() const { return _M_hash; } + key_equal key_eq() const { return _M_equals; } + +private: + _STLP_FORCE_ALLOCATORS(_Val, _All) +#if defined (_STLP_DEBUG) + typedef _STLP_PRIV _STLP_NON_DBG_NAME(slist) _ElemsCont; +#else + typedef slist _ElemsCont; +#endif + typedef typename _ElemsCont::iterator _ElemsIte; + typedef typename _ElemsCont::const_iterator _ElemsConstIte; + typedef _STLP_PRIV _Slist_node_base _BucketType; + typedef typename _Alloc_traits<_BucketType*, _All>::allocator_type _BucketAllocType; + /* + * We are going to use vector of _Slist_node_base pointers for 2 reasons: + * - limit code bloat, all hashtable instanciation use the same buckets representation. + * - avoid _STLP_DEBUG performance trouble: with a vector of iterator on slist the resize + * method would be too slow because the slist::splice_after method become linear on + * the number of iterators in the buckets rather than constant in time as the iterator + * has to be move from a slist to the other. + */ +#if defined (_STLP_DEBUG) + typedef _STLP_PRIV _STLP_NON_DBG_NAME(vector)<_BucketType*, _BucketAllocType> _BucketVector; +#else + typedef vector<_BucketType*, _BucketAllocType> _BucketVector; +#endif + + hasher _M_hash; + key_equal _M_equals; + _ElemsCont _M_elems; + _BucketVector _M_buckets; + size_type _M_num_elements; + float _M_max_load_factor; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + + static const key_type& _M_get_key(const value_type& __val) { + _ExK k; + return k(__val); + } +public: + typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstTraits> iterator; + typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstTraits> const_iterator; + //TODO: Avoids this debug check and make the local_iterator different from + //iterator in debug mode too. +#if !defined (_STLP_DEBUG) + typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _NonConstLocalTraits> local_iterator; + typedef _STLP_PRIV _Ht_iterator<_ElemsIte, _ConstLocalTraits> const_local_iterator; +#else + typedef iterator local_iterator; + typedef const_iterator const_local_iterator; +#endif + + typedef _All allocator_type; + allocator_type get_allocator() const { return _M_elems.get_allocator(); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + hashtable(size_type __n, + const _HF& __hf, + const _EqK& __eql, + const allocator_type& __a = allocator_type()) +#else + hashtable(size_type __n, + const _HF& __hf, + const _EqK& __eql) + : _M_hash(__hf), + _M_equals(__eql), + _M_elems(allocator_type()), + _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)), + _M_num_elements(0), + _M_max_load_factor(1.0f) + { _M_initialize_buckets(__n); } + + hashtable(size_type __n, + const _HF& __hf, + const _EqK& __eql, + const allocator_type& __a) +#endif + : _M_hash(__hf), + _M_equals(__eql), + _M_elems(__a), + _M_buckets(_STLP_CONVERT_ALLOCATOR(__a, _BucketType*)), + _M_num_elements(0), + _M_max_load_factor(1.0f) + { _M_initialize_buckets(__n); } + + hashtable(const _Self& __ht) + : _M_hash(__ht._M_hash), + _M_equals(__ht._M_equals), + _M_elems(__ht.get_allocator()), + _M_buckets(_STLP_CONVERT_ALLOCATOR(__ht.get_allocator(), _BucketType*)), + _M_num_elements(0), + _M_max_load_factor(1.0f) + { _M_copy_from(__ht); } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + hashtable(__move_source<_Self> src) + : _M_hash(_STLP_PRIV _AsMoveSource(src.get()._M_hash)), + _M_equals(_STLP_PRIV _AsMoveSource(src.get()._M_equals)), + _M_elems(__move_source<_ElemsCont>(src.get()._M_elems)), + _M_buckets(__move_source<_BucketVector>(src.get()._M_buckets)), + _M_num_elements(src.get()._M_num_elements), + _M_max_load_factor(src.get()._M_max_load_factor) {} +#endif + + _Self& operator= (const _Self& __ht) { + if (&__ht != this) { + clear(); + _M_hash = __ht._M_hash; + _M_equals = __ht._M_equals; + _M_copy_from(__ht); + } + return *this; + } + + ~hashtable() { clear(); } + + size_type size() const { return _M_num_elements; } + size_type max_size() const { return size_type(-1); } + bool empty() const { return size() == 0; } + + void swap(_Self& __ht) { + _STLP_STD::swap(_M_hash, __ht._M_hash); + _STLP_STD::swap(_M_equals, __ht._M_equals); + _M_elems.swap(__ht._M_elems); + _M_buckets.swap(__ht._M_buckets); + _STLP_STD::swap(_M_num_elements, __ht._M_num_elements); + _STLP_STD::swap(_M_max_load_factor, __ht._M_max_load_factor); + } + + iterator begin() { return _M_elems.begin(); } + iterator end() { return _M_elems.end(); } + local_iterator begin(size_type __n) { return _ElemsIte(_M_buckets[__n]); } + local_iterator end(size_type __n) { return _ElemsIte(_M_buckets[__n + 1]); } + + const_iterator begin() const { return __CONST_CAST(_ElemsCont&, _M_elems).begin(); } + const_iterator end() const { return __CONST_CAST(_ElemsCont&, _M_elems).end(); } + const_local_iterator begin(size_type __n) const { return _ElemsIte(_M_buckets[__n]); } + const_local_iterator end(size_type __n) const { return _ElemsIte(_M_buckets[__n + 1]); } + + //static bool _STLP_CALL _M_equal (const _Self&, const _Self&); + +public: + //The number of buckets is size() - 1 because the last bucket always contains + //_M_elems.end() to make algo easier to implement. + size_type bucket_count() const { return _M_buckets.size() - 1; } + size_type max_bucket_count() const { return _STLP_PRIV _Stl_prime_type::_S_max_nb_buckets(); } + size_type elems_in_bucket(size_type __bucket) const + { return _STLP_STD::distance(_ElemsIte(_M_buckets[__bucket]), _ElemsIte(_M_buckets[__bucket + 1])); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type bucket(const _KT& __k) const { return _M_bkt_num_key(__k); } + + // hash policy + float load_factor() const { return (float)size() / (float)bucket_count(); } + float max_load_factor() const { return _M_max_load_factor; } + void max_load_factor(float __z) { + _M_max_load_factor = __z; + _M_resize(); + } + + pair insert_unique(const value_type& __obj) { + _M_enlarge(_M_num_elements + 1); + return insert_unique_noresize(__obj); + } + + iterator insert_equal(const value_type& __obj) { + _M_enlarge(_M_num_elements + 1); + return insert_equal_noresize(__obj); + } + +protected: + iterator _M_insert_noresize(size_type __n, const value_type& __obj); +public: + pair insert_unique_noresize(const value_type& __obj); + iterator insert_equal_noresize(const value_type& __obj); + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert_unique(_InputIterator __f, _InputIterator __l) + { insert_unique(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); } + + template + void insert_equal(_InputIterator __f, _InputIterator __l) + { insert_equal(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIterator)); } + + template + void insert_unique(_InputIterator __f, _InputIterator __l, + const input_iterator_tag &) { + for ( ; __f != __l; ++__f) + insert_unique(*__f); + } + + template + void insert_equal(_InputIterator __f, _InputIterator __l, + const input_iterator_tag &) { + for ( ; __f != __l; ++__f) + insert_equal(*__f); + } + + template + void insert_unique(_ForwardIterator __f, _ForwardIterator __l, + const forward_iterator_tag &) { + size_type __n = _STLP_STD::distance(__f, __l); + _M_enlarge(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + template + void insert_equal(_ForwardIterator __f, _ForwardIterator __l, + const forward_iterator_tag &) { + size_type __n = _STLP_STD::distance(__f, __l); + _M_enlarge(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } + +#else /* _STLP_MEMBER_TEMPLATES */ + void insert_unique(const value_type* __f, const value_type* __l) { + size_type __n = __l - __f; + _M_enlarge(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + void insert_equal(const value_type* __f, const value_type* __l) { + size_type __n = __l - __f; + _M_enlarge(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } + + void insert_unique(const_iterator __f, const_iterator __l) { + size_type __n = _STLP_STD::distance(__f, __l); + _M_enlarge(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + void insert_equal(const_iterator __f, const_iterator __l) { + size_type __n = _STLP_STD::distance(__f, __l); + _M_enlarge(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } +#endif /*_STLP_MEMBER_TEMPLATES */ + + //reference find_or_insert(const value_type& __obj); + +private: + _STLP_TEMPLATE_FOR_CONT_EXT + _ElemsIte _M_find(const _KT& __key) const { + size_type __n = _M_bkt_num_key(__key); + _ElemsIte __first(_M_buckets[__n]); + _ElemsIte __last(_M_buckets[__n + 1]); + for ( ; (__first != __last) && !_M_equals(_M_get_key(*__first), __key); ++__first); + if (__first != __last) + return __first; + else + return __CONST_CAST(_ElemsCont&, _M_elems).end(); + } + +public: + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { + const size_type __n = _M_bkt_num_key(__key); + + _ElemsIte __cur(_M_buckets[__n]); + _ElemsIte __last(_M_buckets[__n + 1]); + for (; __cur != __last; ++__cur) { + if (_M_equals(_M_get_key(*__cur), __key)) { + size_type __result = 1; + for (++__cur; + __cur != __last && _M_equals(_M_get_key(*__cur), __key); + ++__result, ++__cur); + return __result; + } + } + return 0; + } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) { + typedef pair _Pii; + const size_type __n = _M_bkt_num_key(__key); + + for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]); + __first != __last; ++__first) { + if (_M_equals(_M_get_key(*__first), __key)) { + _ElemsIte __cur(__first); + for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur); + return _Pii(__first, __cur); + } + } + return _Pii(end(), end()); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const { + typedef pair _Pii; + const size_type __n = _M_bkt_num_key(__key); + + for (_ElemsIte __first(_M_buckets[__n]), __last(_M_buckets[__n + 1]); + __first != __last; ++__first) { + if (_M_equals(_M_get_key(*__first), __key)) { + _ElemsIte __cur(__first); + for (++__cur; (__cur != __last) && _M_equals(_M_get_key(*__cur), __key); ++__cur); + return _Pii(__first, __cur); + } + } + return _Pii(end(), end()); + } + + size_type erase(const key_type& __key); + void erase(const_iterator __it); + void erase(const_iterator __first, const_iterator __last); + +private: + void _M_enlarge(size_type __n); + void _M_reduce(); + void _M_resize(); + void _M_rehash(size_type __num_buckets); +#if defined (_STLP_DEBUG) + void _M_check() const; +#endif + +public: + void rehash(size_type __num_buckets_hint); + void resize(size_type __num_buckets_hint) + { rehash(__num_buckets_hint); } + void clear(); + + // this is for hash_map::operator[] + reference _M_insert(const value_type& __obj); + +private: + //__n is set to the first bucket that has to be modified if any + //erase/insert operation is done after the returned iterator. + iterator _M_before_begin(size_type &__n) const; + + static iterator _S_before_begin(const _ElemsCont& __elems, const _BucketVector& __buckets, + size_type &__n); + + void _M_initialize_buckets(size_type __n) { + const size_type __n_buckets = _STLP_PRIV _Stl_prime_type::_S_next_size(__n) + 1; + _M_buckets.reserve(__n_buckets); + _M_buckets.assign(__n_buckets, __STATIC_CAST(_BucketType*, 0)); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type _M_bkt_num_key(const _KT& __key) const + { return _M_bkt_num_key(__key, bucket_count()); } + + size_type _M_bkt_num(const value_type& __obj) const + { return _M_bkt_num_key(_M_get_key(__obj)); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type _M_bkt_num_key(const _KT& __key, size_type __n) const + { return _M_hash(__key) % __n; } + + size_type _M_bkt_num(const value_type& __obj, size_t __n) const + { return _M_bkt_num_key(_M_get_key(__obj), __n); } + + void _M_copy_from(const _Self& __ht); +}; + +#if defined (_STLP_DEBUG) +# undef hashtable +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER hashtable<_Val,_Key,_HF,_Traits,_ExK,_EqK,_All> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + //Hashtables are movable: + typedef __true_type implemented; + + //Completeness depends on many template parameters, for the moment we consider it not complete: + typedef __false_type complete; +}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_HASHTABLE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_heap.c b/sdk/tlibstdcxx/stlport/stl/_heap.c new file mode 100644 index 0000000000..a4ab049fee --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_heap.c @@ -0,0 +1,246 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_HEAP_C +#define _STLP_HEAP_C + +#ifndef _STLP_INTERNAL_HEAP_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +_STLP_INLINE_LOOP +void +__push_heap(_RandomAccessIterator __first, + _Distance __holeIndex, _Distance __topIndex, _Tp __val) +{ + _Distance __parent = (__holeIndex - 1) / 2; + while (__holeIndex > __topIndex && *(__first + __parent) < __val) { + *(__first + __holeIndex) = *(__first + __parent); + __holeIndex = __parent; + __parent = (__holeIndex - 1) / 2; + } + *(__first + __holeIndex) = __val; +} + +template +inline void +__push_heap_aux(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Distance*, _Tp*) +{ + __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), + _Tp(*(__last - 1))); +} + +template +void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + __push_heap_aux(__first, __last, + _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator)); +} + + +template +_STLP_INLINE_LOOP +void +__push_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __topIndex, _Tp __val, _Compare __comp) +{ + _Distance __parent = (__holeIndex - 1) / 2; + while (__holeIndex > __topIndex && __comp(*(__first + __parent), __val)) { + _STLP_VERBOSE_ASSERT(!__comp(__val, *(__first + __parent)), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + *(__first + __holeIndex) = *(__first + __parent); + __holeIndex = __parent; + __parent = (__holeIndex - 1) / 2; + } + *(__first + __holeIndex) = __val; +} + +template +inline void +__push_heap_aux(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp, + _Distance*, _Tp*) +{ + __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0), + _Tp(*(__last - 1)), __comp); +} + +template +void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) +{ + __push_heap_aux(__first, __last, __comp, + _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator), _STLP_VALUE_TYPE(__first, _RandomAccessIterator)); +} + +template +void +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __val) { + _Distance __topIndex = __holeIndex; + _Distance __secondChild = 2 * __holeIndex + 2; + while (__secondChild < __len) { + if (*(__first + __secondChild) < *(__first + (__secondChild - 1))) + __secondChild--; + *(__first + __holeIndex) = *(__first + __secondChild); + __holeIndex = __secondChild; + __secondChild = 2 * (__secondChild + 1); + } + if (__secondChild == __len) { + *(__first + __holeIndex) = *(__first + (__secondChild - 1)); + __holeIndex = __secondChild - 1; + } + __push_heap(__first, __holeIndex, __topIndex, __val); +} + + +template +inline void +__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last, _Tp*) { + __pop_heap(__first, __last - 1, __last - 1, + _Tp(*(__last - 1)), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); +} + +template +void pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last) { + __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator)); +} + +template +void +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __val, _Compare __comp) +{ + _Distance __topIndex = __holeIndex; + _Distance __secondChild = 2 * __holeIndex + 2; + while (__secondChild < __len) { + if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1)))) { + _STLP_VERBOSE_ASSERT(!__comp(*(__first + (__secondChild - 1)), *(__first + __secondChild)), + _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __secondChild--; + } + *(__first + __holeIndex) = *(__first + __secondChild); + __holeIndex = __secondChild; + __secondChild = 2 * (__secondChild + 1); + } + if (__secondChild == __len) { + *(__first + __holeIndex) = *(__first + (__secondChild - 1)); + __holeIndex = __secondChild - 1; + } + __push_heap(__first, __holeIndex, __topIndex, __val, __comp); +} + + +template +inline void +__pop_heap_aux(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Tp*, _Compare __comp) +{ + __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp, + _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); +} + + +template +void +pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) +{ + __pop_heap_aux(__first, __last, _STLP_VALUE_TYPE(__first, _RandomAccessIterator), __comp); +} + +template +_STLP_INLINE_LOOP +void +__make_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Tp*, _Distance*) +{ + if (__last - __first < 2) return; + _Distance __len = __last - __first; + _Distance __parent = (__len - 2)/2; + + for (;;) { + __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent))); + if (__parent == 0) return; + __parent--; + } +} + +template +void +make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + __make_heap(__first, __last, + _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); +} + +template +_STLP_INLINE_LOOP +void +__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp, _Tp*, _Distance*) +{ + if (__last - __first < 2) return; + _Distance __len = __last - __first; + _Distance __parent = (__len - 2)/2; + + for (;;) { + __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)), + __comp); + if (__parent == 0) return; + __parent--; + } +} + +template +void +make_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) +{ + __make_heap(__first, __last, __comp, + _STLP_VALUE_TYPE(__first, _RandomAccessIterator), _STLP_DISTANCE_TYPE(__first, _RandomAccessIterator)); +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_HEAP_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_heap.h b/sdk/tlibstdcxx/stlport/stl/_heap.h new file mode 100644 index 0000000000..016dc490ee --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_heap.h @@ -0,0 +1,125 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_HEAP_H +#define _STLP_INTERNAL_HEAP_H + +_STLP_BEGIN_NAMESPACE + +// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap. + +template +void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last); + + +template +void +push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp); + +template +void +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __val); + +template +inline void +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _RandomAccessIterator __result, _Tp __val, _Distance*) +{ + *__result = *__first; + __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __val); +} + +template +void pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last); + +template +void +__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __val, _Compare __comp); + +template +inline void +__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _RandomAccessIterator __result, _Tp __val, _Compare __comp, + _Distance*) +{ + *__result = *__first; + __adjust_heap(__first, _Distance(0), _Distance(__last - __first), + __val, __comp); +} + +template +void +pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp); + +template +void +make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last); + +template +void +make_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp); + +template +_STLP_INLINE_LOOP +void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) +{ + while (__last - __first > 1) + pop_heap(__first, __last--); +} + +template +_STLP_INLINE_LOOP +void +sort_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) +{ + while (__last - __first > 1) + pop_heap(__first, __last--, __comp); +} + +_STLP_END_NAMESPACE + +# if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +# endif + +#endif /* _STLP_INTERNAL_HEAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_iomanip.h b/sdk/tlibstdcxx/stlport/stl/_iomanip.h new file mode 100644 index 0000000000..a27d95164c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_iomanip.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_IOMANIP +#define _STLP_INTERNAL_IOMANIP + +#ifndef _STLP_INTERNAL_ISTREAM +# include // Includes and +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +//---------------------------------------------------------------------- +// Machinery for defining manipulators. + +// Class that calls one of ios_base's single-argument member functions. +template +struct _Ios_Manip_1 { + typedef _Arg (ios_base::*__f_ptr_type)(_Arg); + + _Ios_Manip_1(__f_ptr_type __f, const _Arg& __arg) + : _M_f(__f), _M_arg(__arg) {} + + void operator()(ios_base& __ios) const + { (__ios.*_M_f)(_M_arg); } + + __f_ptr_type _M_f; + _Arg _M_arg; +}; + +// Class that calls one of ios_base's two-argument member functions. +struct _Ios_Setf_Manip { + ios_base::fmtflags _M_flag; + ios_base::fmtflags _M_mask; + bool _M_two_args; + + _Ios_Setf_Manip(ios_base::fmtflags __f) + : _M_flag(__f), _M_mask(0), _M_two_args(false) {} + + _Ios_Setf_Manip(ios_base::fmtflags __f, ios_base::fmtflags __m) + : _M_flag(__f), _M_mask(__m), _M_two_args(true) {} + + void operator()(ios_base& __ios) const { + if (_M_two_args) + __ios.setf(_M_flag, _M_mask); + else + __ios.setf(_M_flag); + } +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __istr, + const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) { + __f(__istr); + return __istr; +} + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, + const _STLP_PRIV _Ios_Manip_1<_Arg>& __f) { + __f(__os); + return __os; +} + +template +inline basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __istr, + const _STLP_PRIV _Ios_Setf_Manip& __f) { + __f(__istr); + return __istr; +} + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, + const _STLP_PRIV _Ios_Setf_Manip& __f) { + __f(__os); + return __os; +} + +//---------------------------------------------------------------------- +// The ios_base manipulators. +inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL resetiosflags(ios_base::fmtflags __mask) +{ return _STLP_PRIV _Ios_Setf_Manip(0, __mask); } + +inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag) +{ return _STLP_PRIV _Ios_Setf_Manip(__flag); } + +inline _STLP_PRIV _Ios_Setf_Manip _STLP_CALL setbase(int __n) { + ios_base::fmtflags __base = __n == 8 ? ios_base::oct : + __n == 10 ? ios_base::dec : + __n == 16 ? ios_base::hex : + ios_base::fmtflags(0); + return _STLP_PRIV _Ios_Setf_Manip(__base, ios_base::basefield); +} + +inline _STLP_PRIV _Ios_Manip_1 _STLP_CALL +setprecision(int __n) { + _STLP_PRIV _Ios_Manip_1::__f_ptr_type __f = &ios_base::precision; + return _STLP_PRIV _Ios_Manip_1(__f, __n); +} + +inline _STLP_PRIV _Ios_Manip_1 _STLP_CALL +setw(int __n) { + _STLP_PRIV _Ios_Manip_1::__f_ptr_type __f = &ios_base::width; + return _STLP_PRIV _Ios_Manip_1(__f, __n); +} + +//---------------------------------------------------------------------- +// setfill, a manipulator that operates on basic_ios<> instead of ios_base. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Setfill_Manip { + _Setfill_Manip(_CharT __c) : _M_c(__c) {} + _CharT _M_c; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, + const _STLP_PRIV _Setfill_Manip<_CharT2>& __m) { + __os.fill(__m._M_c); + return __os; +} + +template +inline basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __is, + const _STLP_PRIV _Setfill_Manip<_CharT2>& __m) { + __is.fill(__m._M_c); + return __is; +} + +template +inline _STLP_PRIV _Setfill_Manip<_CharT> _STLP_CALL setfill(_CharT __c) +{ return _STLP_PRIV _Setfill_Manip<_CharT>(__c); } + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_IOMANIP */ diff --git a/sdk/tlibstdcxx/stlport/stl/_ios.c b/sdk/tlibstdcxx/stlport/stl/_ios.c new file mode 100644 index 0000000000..7dec77f08d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ios.c @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_IOS_C +#define _STLP_IOS_C + +#ifndef _STLP_INTERNAL_IOS_H +# include +#endif + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +#ifndef _STLP_INTERNAL_NUMPUNCT_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// basic_ios<>'s non-inline member functions + +// Public constructor, taking a streambuf. +template +basic_ios<_CharT, _Traits> + ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf) + : ios_base(), _M_cached_ctype(0), + _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) { + basic_ios<_CharT, _Traits>::init(__streambuf); +} + +template +basic_streambuf<_CharT, _Traits>* +basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) { + basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf; + _M_streambuf = __buf; + this->clear(); + return __tmp; +} + +template +basic_ios<_CharT, _Traits>& +basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) { + _M_invoke_callbacks(erase_event); + _M_copy_state(__x); // Inherited from ios_base. + _M_cached_ctype = __x._M_cached_ctype; + _M_fill = __x._M_fill; + _M_tied_ostream = __x._M_tied_ostream; + _M_invoke_callbacks(copyfmt_event); + this->_M_set_exception_mask(__x.exceptions()); + return *this; +} + +template +locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { + locale __tmp = ios_base::imbue(__loc); + _STLP_TRY { + if (_M_streambuf) + _M_streambuf->pubimbue(__loc); + + // no throwing here + _M_cached_ctype = &use_facet >(__loc); + } + _STLP_CATCH_ALL { + __tmp = ios_base::imbue(__tmp); + _M_handle_exception(ios_base::failbit); + } + return __tmp; +} + +// Protected constructor and initialization functions. The default +// constructor creates an uninitialized basic_ios, and init() initializes +// all of the members to the values in Table 89 of the C++ standard. + +template +basic_ios<_CharT, _Traits>::basic_ios() + : ios_base(), + _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) +{} + +template +void +basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) +{ + this->rdbuf(__sb); + this->imbue(locale()); + this->tie(0); + this->_M_set_exception_mask(ios_base::goodbit); + this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit); + ios_base::flags(ios_base::skipws | ios_base::dec); + ios_base::width(0); + ios_base::precision(6); + this->fill(widen(' ')); + // We don't need to worry about any of the three arrays: they are + // initialized correctly in ios_base's constructor. +} + +// This is never called except from within a catch clause. +template +void basic_ios<_CharT, _Traits>::_M_handle_exception(ios_base::iostate __flag) +{ + this->_M_setstate_nothrow(__flag); + if (this->_M_get_exception_mask() & __flag) + _STLP_RETHROW; +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_IOS_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_ios.h b/sdk/tlibstdcxx/stlport/stl/_ios.h new file mode 100644 index 0000000000..20422f0eab --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ios.h @@ -0,0 +1,187 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_IOS_H +#define _STLP_INTERNAL_IOS_H + + +#ifndef _STLP_IOS_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_CTYPE_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUMPUNCT_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// ---------------------------------------------------------------------- + +// Class basic_ios, a subclass of ios_base. The only important difference +// between the two is that basic_ios is a class template, parameterized +// by the character type. ios_base exists to factor out all of the +// common properties that don't depend on the character type. + +// The second template parameter, _Traits, defaults to char_traits<_CharT>. +// The default is declared in header , and it isn't declared here +// because C++ language rules do not allow it to be declared twice. + +template +class basic_ios : public ios_base { + friend class ios_base; +public: // Synonyms for types. + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + +public: // Constructor, destructor. + explicit basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf); + virtual ~basic_ios() {} + +public: // Members from clause 27.4.4.2 + basic_ostream<_CharT, _Traits>* tie() const { + return _M_tied_ostream; + } + basic_ostream<_CharT, _Traits>* + tie(basic_ostream* __new_tied_ostream) { + basic_ostream* __tmp = _M_tied_ostream; + _M_tied_ostream = __new_tied_ostream; + return __tmp; + } + + basic_streambuf<_CharT, _Traits>* rdbuf() const + { return _M_streambuf; } + + basic_streambuf<_CharT, _Traits>* + rdbuf(basic_streambuf*); + + // Copies __x's state to *this. + basic_ios<_CharT, _Traits>& copyfmt(const basic_ios<_CharT, _Traits>& __x); + + char_type fill() const { return _M_fill; } + char_type fill(char_type __fill) { + char_type __tmp(_M_fill); + _M_fill = __fill; + return __tmp; + } + +public: // Members from 27.4.4.3. These four functions + // can almost be defined in ios_base. + + void clear(iostate __state = goodbit) { + _M_clear_nothrow(this->rdbuf() ? __state : iostate(__state|ios_base::badbit)); + _M_check_exception_mask(); + } + void setstate(iostate __state) { this->clear(rdstate() | __state); } + + iostate exceptions() const { return this->_M_get_exception_mask(); } + void exceptions(iostate __mask) { + this->_M_set_exception_mask(__mask); + this->clear(this->rdstate()); + } + +public: // Locale-related member functions. + locale imbue(const locale&); + + inline char narrow(_CharT, char) const ; + inline _CharT widen(char) const; + + // Helper function that makes testing for EOF more convenient. + static bool _STLP_CALL _S_eof(int_type __c) { + const int_type __eof = _Traits::eof(); + return _Traits::eq_int_type(__c, __eof); + } + +protected: + // Cached copy of the curent locale's ctype facet. Set by init() and imbue(). + const ctype* _M_cached_ctype; + +public: + // Equivalent to &use_facet< Facet >(getloc()), but faster. + const ctype* _M_ctype_facet() const { return _M_cached_ctype; } + +protected: + basic_ios(); + + void init(basic_streambuf<_CharT, _Traits>* __streambuf); + +public: + + // Helper function used in istream and ostream. It is called only from + // a catch clause. + void _M_handle_exception(ios_base::iostate __flag); + +private: // Data members + char_type _M_fill; // The fill character, used for padding. + + basic_streambuf<_CharT, _Traits>* _M_streambuf; + basic_ostream<_CharT, _Traits>* _M_tied_ostream; + +}; + + +template +inline char +basic_ios<_CharT, _Traits>::narrow(_CharT __c, char __default) const +{ return _M_ctype_facet()->narrow(__c, __default); } + +template +inline _CharT +basic_ios<_CharT, _Traits>::widen(char __c) const +{ return _M_ctype_facet()->widen(__c); } + +# if !defined (_STLP_NO_METHOD_SPECIALIZATION) +_STLP_TEMPLATE_NULL +inline char +basic_ios >::narrow(char __c, char) const +{ + return __c; +} + +_STLP_TEMPLATE_NULL +inline char +basic_ios >::widen(char __c) const +{ + return __c; +} +# endif /* _STLP_NO_METHOD_SPECIALIZATION */ + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_ios >; +# if ! defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_ios >; +# endif +# endif /* _STLP_USE_TEMPLATE_EXPORT */ + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_IOS */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_ios_base.h b/sdk/tlibstdcxx/stlport/stl/_ios_base.h new file mode 100644 index 0000000000..c9e10ad48e --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ios_base.h @@ -0,0 +1,345 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_IOS_BASE_H +#define _STLP_IOS_BASE_H + +#ifndef _STLP_INTERNAL_STDEXCEPT_BASE +# include +#endif + +#ifndef _STLP_INTERNAL_PAIR_H +# include +#endif + +#ifndef _STLP_INTERNAL_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// ---------------------------------------------------------------------- + +// Class ios_base. This is the base class of the ios hierarchy, which +// includes basic_istream and basic_ostream. Classes in the ios +// hierarchy are actually quite simple: they are just glorified +// wrapper classes. They delegate buffering and physical character +// manipulation to the streambuf classes, and they delegate most +// formatting tasks to a locale. + +class _STLP_CLASS_DECLSPEC ios_base { +public: + + class _STLP_CLASS_DECLSPEC failure : public __Named_exception { + public: + explicit failure(const string&); + virtual ~failure() _STLP_NOTHROW_INHERENTLY; + }; + + typedef int fmtflags; + typedef int iostate; + typedef int openmode; + typedef int seekdir; + +# ifndef _STLP_NO_ANACHRONISMS + typedef fmtflags fmt_flags; +# endif + + // Formatting flags. + _STLP_STATIC_CONSTANT(int, left = 0x0001); + _STLP_STATIC_CONSTANT(int, right = 0x0002); + _STLP_STATIC_CONSTANT(int, internal = 0x0004); + _STLP_STATIC_CONSTANT(int, dec = 0x0008); + _STLP_STATIC_CONSTANT(int, hex = 0x0010); + _STLP_STATIC_CONSTANT(int, oct = 0x0020); + _STLP_STATIC_CONSTANT(int, fixed = 0x0040); + _STLP_STATIC_CONSTANT(int, scientific = 0x0080); + _STLP_STATIC_CONSTANT(int, boolalpha = 0x0100); + _STLP_STATIC_CONSTANT(int, showbase = 0x0200); + _STLP_STATIC_CONSTANT(int, showpoint = 0x0400); + _STLP_STATIC_CONSTANT(int, showpos = 0x0800); + _STLP_STATIC_CONSTANT(int, skipws = 0x1000); + _STLP_STATIC_CONSTANT(int, unitbuf = 0x2000); + _STLP_STATIC_CONSTANT(int, uppercase = 0x4000); + _STLP_STATIC_CONSTANT(int, adjustfield = left | right | internal); + _STLP_STATIC_CONSTANT(int, basefield = dec | hex | oct); + _STLP_STATIC_CONSTANT(int, floatfield = scientific | fixed); + + // State flags. + _STLP_STATIC_CONSTANT(int, goodbit = 0x00); + _STLP_STATIC_CONSTANT(int, badbit = 0x01); + _STLP_STATIC_CONSTANT(int, eofbit = 0x02); + _STLP_STATIC_CONSTANT(int, failbit = 0x04); + + // Openmode flags. + _STLP_STATIC_CONSTANT(int, __default_mode = 0x0); /* implementation detail */ + _STLP_STATIC_CONSTANT(int, app = 0x01); + _STLP_STATIC_CONSTANT(int, ate = 0x02); + _STLP_STATIC_CONSTANT(int, binary = 0x04); + _STLP_STATIC_CONSTANT(int, in = 0x08); + _STLP_STATIC_CONSTANT(int, out = 0x10); + _STLP_STATIC_CONSTANT(int, trunc = 0x20); + + // Seekdir flags + _STLP_STATIC_CONSTANT(int, beg = 0x01); + _STLP_STATIC_CONSTANT(int, cur = 0x02); + _STLP_STATIC_CONSTANT(int, end = 0x04); + +public: // Flag-manipulation functions. + fmtflags flags() const { return _M_fmtflags; } + fmtflags flags(fmtflags __flags) { + fmtflags __tmp = _M_fmtflags; + _M_fmtflags = __flags; + return __tmp; + } + + fmtflags setf(fmtflags __flag) { + fmtflags __tmp = _M_fmtflags; + _M_fmtflags |= __flag; + return __tmp; + } + fmtflags setf(fmtflags __flag, fmtflags __mask) { + fmtflags __tmp = _M_fmtflags; + _M_fmtflags &= ~__mask; + _M_fmtflags |= __flag & __mask; + return __tmp; + } + void unsetf(fmtflags __mask) { _M_fmtflags &= ~__mask; } + + streamsize precision() const { return _M_precision; } + streamsize precision(streamsize __newprecision) { + streamsize __tmp = _M_precision; + _M_precision = __newprecision; + return __tmp; + } + + streamsize width() const { return _M_width; } + streamsize width(streamsize __newwidth) { + streamsize __tmp = _M_width; + _M_width = __newwidth; + return __tmp; + } + +public: // Locales + locale imbue(const locale&); + locale getloc() const { return _M_locale; } + +public: // Auxiliary storage. + static int _STLP_CALL xalloc(); + long& iword(int __index); + void*& pword(int __index); + +public: // Destructor. + virtual ~ios_base(); + +public: // Callbacks. + enum event { erase_event, imbue_event, copyfmt_event }; + typedef void (*event_callback)(event, ios_base&, int __index); + void register_callback(event_callback __fn, int __index); + +public: // This member function affects only + // the eight predefined ios objects: + // cin, cout, etc. + static bool _STLP_CALL sync_with_stdio(bool __sync = true); + +public: // The C++ standard requires only that these + // member functions be defined in basic_ios. + // We define them in the non-template + // base class to avoid code duplication. + operator void*() const { return !fail() ? (void*) __CONST_CAST(ios_base*,this) : (void*) 0; } + bool operator!() const { return fail(); } + + iostate rdstate() const { return _M_iostate; } + + bool good() const { return _M_iostate == 0; } + bool eof() const { return (_M_iostate & eofbit) != 0; } + bool fail() const { return (_M_iostate & (failbit | badbit)) != 0; } + bool bad() const { return (_M_iostate & badbit) != 0; } + +protected: // The functional protected interface. + + // Copies the state of __x to *this. This member function makes it + // possible to implement basic_ios::copyfmt without having to expose + // ios_base's private data members. Does not copy _M_exception_mask + // or _M_iostate. + void _M_copy_state(const ios_base& __x); + + void _M_setstate_nothrow(iostate __state) { _M_iostate |= __state; } + void _M_clear_nothrow(iostate __state) { _M_iostate = __state; } + iostate _M_get_exception_mask() const { return _M_exception_mask; } + void _M_set_exception_mask(iostate __mask) { _M_exception_mask = __mask; } + void _M_check_exception_mask() { + if (_M_iostate & _M_exception_mask) + _M_throw_failure(); + } + + void _M_invoke_callbacks(event); + void _STLP_FUNCTION_THROWS _M_throw_failure(); + + ios_base(); // Default constructor. + +protected: // Initialization of the I/O system + static void _STLP_CALL _S_initialize(); + static void _STLP_CALL _S_uninitialize(); + static bool _S_is_synced; + +private: // Invalidate the copy constructor and + // assignment operator. + ios_base(const ios_base&); + void operator=(const ios_base&); + +private: // Data members. + + fmtflags _M_fmtflags; // Flags + iostate _M_iostate; + openmode _M_openmode; + seekdir _M_seekdir; + iostate _M_exception_mask; + + streamsize _M_precision; + streamsize _M_width; + + locale _M_locale; + + pair* _M_callbacks; + size_t _M_num_callbacks; // Size of the callback array. + size_t _M_callback_index; // Index of the next available callback; + // initially zero. + + long* _M_iwords; // Auxiliary storage. The count is zero + size_t _M_num_iwords; // if and only if the pointer is null. + + void** _M_pwords; + size_t _M_num_pwords; + +public: + // ---------------------------------------------------------------------- + // Nested initializer class. This is an implementation detail, but it's + // prescribed by the standard. The static initializer object (on + // implementations where such a thing is required) is declared in + // + class _STLP_CLASS_DECLSPEC Init + { + public: + Init(); + ~Init(); + private: + static long _S_count; + friend class ios_base; + }; + + friend class Init; + +public: +# ifndef _STLP_NO_ANACHRONISMS + // 31.6 Old iostreams members [depr.ios.members] + typedef iostate io_state; + typedef openmode open_mode; + typedef seekdir seek_dir; + typedef _STLP_STD::streamoff streamoff; + typedef _STLP_STD::streampos streampos; +# endif +}; + +// ---------------------------------------------------------------------- +// ios_base manipulator functions, from section 27.4.5 of the C++ standard. +// All of them are trivial one-line wrapper functions. + +// fmtflag manipulators, section 27.4.5.1 +inline ios_base& _STLP_CALL boolalpha(ios_base& __s) + { __s.setf(ios_base::boolalpha); return __s;} + +inline ios_base& _STLP_CALL noboolalpha(ios_base& __s) + { __s.unsetf(ios_base::boolalpha); return __s;} + +inline ios_base& _STLP_CALL showbase(ios_base& __s) + { __s.setf(ios_base::showbase); return __s;} + +inline ios_base& _STLP_CALL noshowbase(ios_base& __s) + { __s.unsetf(ios_base::showbase); return __s;} + +inline ios_base& _STLP_CALL showpoint(ios_base& __s) + { __s.setf(ios_base::showpoint); return __s;} + +inline ios_base& _STLP_CALL noshowpoint(ios_base& __s) + { __s.unsetf(ios_base::showpoint); return __s;} + +inline ios_base& _STLP_CALL showpos(ios_base& __s) + { __s.setf(ios_base::showpos); return __s;} + +inline ios_base& _STLP_CALL noshowpos(ios_base& __s) + { __s.unsetf(ios_base::showpos); return __s;} + +inline ios_base& _STLP_CALL skipws(ios_base& __s) + { __s.setf(ios_base::skipws); return __s;} + +inline ios_base& _STLP_CALL noskipws(ios_base& __s) + { __s.unsetf(ios_base::skipws); return __s;} + +inline ios_base& _STLP_CALL uppercase(ios_base& __s) + { __s.setf(ios_base::uppercase); return __s;} + +inline ios_base& _STLP_CALL nouppercase(ios_base& __s) + { __s.unsetf(ios_base::uppercase); return __s;} + +inline ios_base& _STLP_CALL unitbuf(ios_base& __s) + { __s.setf(ios_base::unitbuf); return __s;} + +inline ios_base& _STLP_CALL nounitbuf(ios_base& __s) + { __s.unsetf(ios_base::unitbuf); return __s;} + + +// adjustfield manipulators, section 27.4.5.2 +inline ios_base& _STLP_CALL internal(ios_base& __s) + { __s.setf(ios_base::internal, ios_base::adjustfield); return __s; } + +inline ios_base& _STLP_CALL left(ios_base& __s) + { __s.setf(ios_base::left, ios_base::adjustfield); return __s; } + +inline ios_base& _STLP_CALL right(ios_base& __s) + { __s.setf(ios_base::right, ios_base::adjustfield); return __s; } + +// basefield manipulators, section 27.4.5.3 +inline ios_base& _STLP_CALL dec(ios_base& __s) + { __s.setf(ios_base::dec, ios_base::basefield); return __s; } + +inline ios_base& _STLP_CALL hex(ios_base& __s) + { __s.setf(ios_base::hex, ios_base::basefield); return __s; } + +inline ios_base& _STLP_CALL oct(ios_base& __s) + { __s.setf(ios_base::oct, ios_base::basefield); return __s; } + + +// floatfield manipulators, section 27.4.5.3 +inline ios_base& _STLP_CALL fixed(ios_base& __s) + { __s.setf(ios_base::fixed, ios_base::floatfield); return __s; } + +inline ios_base& _STLP_CALL scientific(ios_base& __s) + { __s.setf(ios_base::scientific, ios_base::floatfield); return __s; } + +_STLP_END_NAMESPACE + +#endif /* _STLP_IOS_BASE */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_ioserr.h b/sdk/tlibstdcxx/stlport/stl/_ioserr.h new file mode 100644 index 0000000000..83ba8775b6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ioserr.h @@ -0,0 +1,12 @@ +/* + * This file is included in every header that needs the STLport library to be + * built; the header files mostly are the iostreams-headers. The file checks for + * _STLP_USE_NO_IOSTREAMS or _STLP_NO_IOSTREAMS being not defined, so that the + * iostreams part of STLport cannot be used when the symbols were defined + * accidentally. + */ +#if defined (_STLP_NO_IOSTREAMS) +# error STLport iostreams header cannot be used; you chose not to use iostreams in the STLport configuration file (stlport/stl/config/user_config.h). +#elif defined (_STLP_USE_NO_IOSTREAMS ) +# error STLport iostreams header cannot be used; your compiler do not support it. +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_iosfwd.h b/sdk/tlibstdcxx/stlport/stl/_iosfwd.h new file mode 100644 index 0000000000..e31db319c8 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_iosfwd.h @@ -0,0 +1,159 @@ +#ifndef _STLP_INTERNAL_IOSFWD +#define _STLP_INTERNAL_IOSFWD + +#if defined (__sgi) && !defined (__GNUC__) && !defined (_STANDARD_C_PLUS_PLUS) +# error This header file requires the -LANG:std option +#endif + +// This file provides forward declarations of the most important I/O +// classes. Note that almost all of those classes are class templates, +// with default template arguments. According to the C++ standard, +// if a class template is declared more than once in the same scope +// then only one of those declarations may have default arguments. + +// contains the same declarations as other headers, and including +// both and (say) is permitted. This means that only +// one header may contain those default template arguments. + +// In this implementation, the declarations in contain default +// template arguments. All of the other I/O headers include . + +#ifndef _STLP_CHAR_TRAITS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +class ios_base; + +template ) > +class basic_ios; + +template ) > +class basic_streambuf; + +template ) > +class basic_istream; + +template ) > +class basic_ostream; + +template ) > +class basic_iostream; + +template ), + _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > +class basic_stringbuf; + +template ), + _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > +class basic_istringstream; + +template ), + _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > +class basic_ostringstream; + +template ), + _STLP_DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) > +class basic_stringstream; + +template ) > +class basic_filebuf; + +template ) > +class basic_ifstream; + +template ) > +class basic_ofstream; + +template ) > +class basic_fstream; + +template ) > +class istreambuf_iterator; + +template ) > +class ostreambuf_iterator; + +typedef basic_ios > ios; + +#if !defined (_STLP_NO_WCHAR_T) +typedef basic_ios > wios; +#endif + +// Forward declaration of class locale, and of the most important facets. +class locale; +template +#if defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) +struct _Use_facet { + const locale& __loc; + _Use_facet(const locale& __p_loc) : __loc(__p_loc) {} + inline const _Facet& operator *() const; +}; +# define use_facet *_Use_facet +#else +inline const _Facet& use_facet(const locale&); +#endif + +template class ctype; +template class ctype_byname; +template class collate; +template class collate_byname; + +_STLP_TEMPLATE_NULL class ctype; +_STLP_TEMPLATE_NULL class ctype_byname; +_STLP_TEMPLATE_NULL class collate; +_STLP_TEMPLATE_NULL class collate_byname; + +#if !defined (_STLP_NO_WCHAR_T) +_STLP_TEMPLATE_NULL class ctype; +_STLP_TEMPLATE_NULL class ctype_byname; +_STLP_TEMPLATE_NULL class collate; +_STLP_TEMPLATE_NULL class collate_byname; +#endif + +#if !(defined (__SUNPRO_CC) && __SUNPRO_CC < 0x500 ) +// Typedefs for ordinary (narrow-character) streams. +//_STLP_TEMPLATE_NULL class basic_streambuf >; +#endif + +typedef basic_istream > istream; +typedef basic_ostream > ostream; +typedef basic_iostream > iostream; +typedef basic_streambuf > streambuf; + +typedef basic_stringbuf, allocator > stringbuf; +typedef basic_istringstream, allocator > istringstream; +typedef basic_ostringstream, allocator > ostringstream; +typedef basic_stringstream, allocator > stringstream; + +typedef basic_filebuf > filebuf; +typedef basic_ifstream > ifstream; +typedef basic_ofstream > ofstream; +typedef basic_fstream > fstream; + +#if !defined (_STLP_NO_WCHAR_T) +// Typedefs for wide-character streams. +typedef basic_streambuf > wstreambuf; +typedef basic_istream > wistream; +typedef basic_ostream > wostream; +typedef basic_iostream > wiostream; + +typedef basic_stringbuf, allocator > wstringbuf; +typedef basic_istringstream, allocator > wistringstream; +typedef basic_ostringstream, allocator > wostringstream; +typedef basic_stringstream, allocator > wstringstream; + +typedef basic_filebuf > wfilebuf; +typedef basic_ifstream > wifstream; +typedef basic_ofstream > wofstream; +typedef basic_fstream > wfstream; +#endif + +_STLP_END_NAMESPACE + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_iostream_string.h b/sdk/tlibstdcxx/stlport/stl/_iostream_string.h new file mode 100644 index 0000000000..87656a4ce5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_iostream_string.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2004 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + + /* + * This is an internal string for the STLport own iostream implementation. + * The only diference rely on the allocator used to instanciate the basic_string. + * Its goals is to improve performance limitating the number of dynamic allocation + * that could occur when requesting a big float ouput for instance. This allocator + * is not standard conformant as it has an internal state (the static buffer) + */ + + +#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H +#define _STLP_INTERNAL_IOSTREAM_STRING_H + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif /* _STLP_INTERNAL_ALLOC_H */ + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif /* _STLP_INTERNAL_STRING_H */ + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class __iostring_allocator : public allocator<_CharT> { +public: + enum { _STR_SIZE = 256 }; + +private: + enum { _BUF_SIZE = _STR_SIZE + 1 }; + typedef allocator<_CharT> _Base; + _CharT _M_static_buf[_BUF_SIZE]; + +public: + typedef typename _Base::size_type size_type; + typedef typename _Base::pointer pointer; +#if defined (_STLP_MEMBER_TEMPLATE_CLASSES) + template struct rebind { +# if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) + typedef __iostring_allocator<_Tp1> other; +# else + typedef _STLP_PRIV __iostring_allocator<_Tp1> other; +# endif + }; +#endif + + _CharT* allocate(size_type __n, const void* __ptr = 0) { + if (__n > _BUF_SIZE) { + return _Base::allocate(__n, __ptr); + } + return _M_static_buf; + } + void deallocate(pointer __p, size_type __n) { + if (__p != _M_static_buf) _Base::deallocate(__p, __n); + } +}; + +#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) || !defined (_STLP_MEMBER_TEMPLATES) +/* + * As the __iostring_allocator allocator will only be used in the basic_string implementation + * we known that it is never going to be bound to another type that the one used to instantiate + * the basic_string. This is why the associated __stl_alloc_rebind has only one template + * parameter. + */ +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _STLP_PRIV __iostring_allocator<_Tp>& _STLP_CALL +__stl_alloc_rebind(_STLP_PRIV __iostring_allocator<_Tp>& __a, const _Tp*) +{ return __a; } +template +inline _STLP_PRIV __iostring_allocator<_Tp> _STLP_CALL +__stl_alloc_create(const _STLP_PRIV __iostring_allocator<_Tp>&, const _Tp*) +{ return _STLP_PRIV __iostring_allocator<_Tp>(); } + +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */ + +#if !defined (_STLP_DEBUG) +template +struct __basic_iostring : public basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > { + /* + * A consequence of the non standard conformant allocator is that a string using it + * must always be presized to the allocator static buffer size because the basic_string implementation + * do not manage an allocator returning always the same memory adress as long as the + * requested memory block size is under a certain value. + */ + typedef __basic_iostring<_CharT> _Self; + typedef basic_string<_CharT, char_traits<_CharT>, __iostring_allocator<_CharT> > _Base; + typedef typename _Base::_Reserve_t _Reserve_t; + + __basic_iostring() : _Base(_Reserve_t(), __iostring_allocator<_CharT>::_STR_SIZE) + {} + + _Self& operator=(const _CharT* __s) { + _Base::operator=(__s); + return *this; + } +}; + +typedef __basic_iostring __iostring; + +# if !defined (_STLP_NO_WCHAR_T) +typedef __basic_iostring __iowstring; +# endif + +# define _STLP_BASIC_IOSTRING(_CharT) _STLP_PRIV __basic_iostring<_CharT> + +#else + +typedef string __iostring; +# if !defined (_STLP_NO_WCHAR_T) +typedef wstring __iowstring; +# endif + +# define _STLP_BASIC_IOSTRING(_CharT) basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > + +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_IOSTREAM_STRING_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/_istream.c b/sdk/tlibstdcxx/stlport/stl/_istream.c new file mode 100644 index 0000000000..ab327b2969 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_istream.c @@ -0,0 +1,1429 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_ISTREAM_C +#define _STLP_ISTREAM_C + +#ifndef _STLP_INTERNAL_ISTREAM +# include +#endif + +#ifndef _STLP_INTERNAL_LIMITS +# include +#endif + +#ifndef _STLP_INTERNAL_NUM_GET_H +# include +#endif + +#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) +// no wchar_t is supported for this mode +# define __BIS_int_type__ int +# define __BIS_pos_type__ streampos +# define __BIS_off_type__ streamoff +#else +# define __BIS_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::int_type +# define __BIS_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::pos_type +# define __BIS_off_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_istream<_CharT, _Traits>::off_type +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Function object structs used by some member functions. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Is_not_wspace { + typedef typename _Traits::char_type argument_type; + typedef bool result_type; + + const ctype* _M_ctype; + + _Is_not_wspace(const ctype* __c_type) : _M_ctype(__c_type) {} + bool operator()(argument_type __c) const + { return !_M_ctype->is(ctype_base::space, __c); } +}; + +template +struct _Is_wspace_null { + typedef typename _Traits::char_type argument_type; + typedef bool result_type; + + const ctype* _M_ctype; + + _Is_wspace_null(const ctype* __c_type) : _M_ctype(__c_type) {} + bool operator()(argument_type __c) const { + return _Traits::eq(__c, argument_type()) || + _M_ctype->is(ctype_base::space, __c); + } +}; + +template +struct _Scan_for_wspace { + typedef typename _Traits::char_type char_type; + typedef char_type* first_argument_type; + typedef char_type* second_argument_type; + typedef char_type* result_type; + + const ctype* _M_ctype; + + _Scan_for_wspace(const ctype* __ctype) : _M_ctype(__ctype) {} + const char_type* + operator()(const char_type* __first, const char_type* __last) const { + return _M_ctype->scan_is(ctype_base::space, __first, __last); + } +}; + +template +struct _Scan_wspace_null { + typedef typename _Traits::char_type char_type; + typedef char_type* first_argument_type; + typedef char_type* second_argument_type; + typedef char_type* result_type; + + const ctype* _M_ctype; + + _Scan_wspace_null(const ctype* __c_type) : _M_ctype(__c_type) {} + const char_type* + operator()(const char_type* __first, const char_type* __last) const { + __last = find_if(__first, __last, + _Eq_char_bound<_Traits>(char_type())); + return _M_ctype->scan_is(ctype_base::space, __first, __last); + } +}; + +template +struct _Scan_for_not_wspace { + typedef typename _Traits::char_type char_type; + typedef char_type* first_argument_type; + typedef char_type* second_argument_type; + typedef char_type* result_type; + + const ctype* _M_ctype; + + _Scan_for_not_wspace(const ctype* __c_type) : _M_ctype(__c_type) {} + const char_type* + operator()(const char_type* __first, const char_type* __last) const { + return _M_ctype->scan_not(ctype_base::space, __first, __last); + } +}; + +template +struct _Scan_for_char_val { + typedef typename _Traits::char_type char_type; + typedef char_type* first_argument_type; + typedef char_type* second_argument_type; + typedef char_type* result_type; + + char_type _M_val; + + _Scan_for_char_val(char_type __val) : _M_val(__val) {} + + const char_type* + operator()(const char_type* __first, const char_type* __last) const { + return find_if(__first, __last, _Eq_char_bound<_Traits>(_M_val)); + } +}; + +template +struct _Scan_for_int_val { + typedef typename _Traits::char_type char_type; + typedef typename _Traits::int_type int_type; + typedef char_type* first_argument_type; + typedef char_type* second_argument_type; + typedef char_type* result_type; + + int_type _M_val; + + _Scan_for_int_val(int_type __val) : _M_val(__val) {} + + const char_type* + operator()(const char_type* __first, const char_type* __last) const { + return find_if(__first, __last, + _Eq_int_bound<_Traits>(_M_val)); + } +}; + +// Helper function: try to push back a character to a streambuf, +// return true if the pushback succeeded. Does not throw. + +template +bool _STLP_CALL +__pushback(basic_streambuf<_CharT, _Traits>* __buf, _CharT __c) { + bool ret; + _STLP_TRY { + const typename _Traits::int_type __eof = _Traits::eof(); + ret = !_Traits::eq_int_type(__buf->sputbackc(__c), __eof); + } + _STLP_CATCH_ALL { + ret = false; + } + return ret; +} + +//---------------------------------------------------------------------- +// Definitions of basic_istream<>'s noninline member functions. + +// Helper function for formatted input of numbers. +template +ios_base::iostate _STLP_CALL +__get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) { + typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; + ios_base::iostate __err = 0; + _Sentry __sentry( __that ); // Skip whitespace. + if (__sentry) { + typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get; + _STLP_TRY { + // Do not remove additional parenthesis around use_facet instanciation, some compilers (VC6) + // require it when building the library. + (use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()), + 0, __that, __err, __val); + } + _STLP_CATCH_ALL { + __that._M_handle_exception(ios_base::badbit); + } + if (__err) __that.setstate(__err); + } + return __err; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (short& __val) { + long __lval; + _STLP_PRIV __get_num(*this, __lval); + if ( this->fail() ) { + return *this; + } + short __tmp = __STATIC_CAST(short, __lval); + unsigned short __uval = __STATIC_CAST(unsigned short, __lval); + // check if we lose digits + // if ((__val != __lval) && ((unsigned short)__val != __lval)) + if ((__tmp != __lval) && ((long)__uval != __lval)) + this->setstate(ios_base::failbit); + else + __val = __tmp; + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (int& __val) { + long __lval; + _STLP_PRIV __get_num(*this, __lval); + if ( this->fail() ) { + return *this; + } + int __tmp = __lval; + unsigned int __uval = __lval; + // check if we lose digits + // if ((__val != __lval) && ((unsigned int)__val != __lval)) + if ((__tmp != __lval) && ((long)__uval != __lval)) + this->setstate(ios_base::failbit); + else + __val = __tmp; + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned short& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned int& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned long& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} + +#if defined (_STLP_LONG_LONG) +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (_STLP_LONG_LONG& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (unsigned _STLP_LONG_LONG& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} +#endif +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (float& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (double& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} +#if !defined (_STLP_NO_LONG_DOUBLE) +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (long double& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} +#endif +#if !defined (_STLP_NO_BOOL) +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (bool& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} +#endif + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::operator>> (void*& __val) { + _STLP_PRIV __get_num(*this, __val); + return *this; +} + +// Unformatted input + +template +__BIS_int_type__ +basic_istream<_CharT, _Traits>::peek() { + typename _Traits::int_type __tmp = _Traits::eof(); + + this->_M_gcount = 0; + sentry __sentry(*this, _No_Skip_WS()); + + if (__sentry) { + _STLP_TRY { + __tmp = this->rdbuf()->sgetc(); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + if (this->_S_eof(__tmp)) + this->setstate(ios_base::eofbit); + } + + return __tmp; +} + + +template +__BIS_int_type__ +basic_istream<_CharT, _Traits>::get() { + typename _Traits::int_type __tmp = _Traits::eof(); + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + _STLP_TRY { + __tmp = this->rdbuf()->sbumpc(); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + + if (!this->_S_eof(__tmp)) + this->_M_gcount = 1; + } + + if (_M_gcount == 0) + this->setstate(ios_base::eofbit | ios_base::failbit); + + return __tmp; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::get(_CharT& __c) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + typename _Traits::int_type __tmp = _Traits::eof(); + _STLP_TRY { + __tmp = this->rdbuf()->sbumpc(); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + + if (!this->_S_eof(__tmp)) { + this->_M_gcount = 1; + __c = _Traits::to_char_type(__tmp); + } + } + + if (this->_M_gcount == 0) + this->setstate(ios_base::eofbit | ios_base::failbit); + + return *this; +} + + +// Read characters and discard them. The standard specifies a single +// function with two arguments, each with a default. We instead use +// three overloded functions, because it's possible to implement the +// first two more efficiently than the fully general third version. +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + int_type __c; + _STLP_TRY { + __c = this->rdbuf()->sbumpc(); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + return *this; + } + + if (!this->_S_eof(__c)) + this->_M_gcount = 1; + else + this->setstate(ios_base::eofbit); + } + + return *this; +} + +// Putback + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::putback(_CharT __c) { + this->_M_gcount = 0; + sentry __sentry(*this, _No_Skip_WS()); + + if (__sentry) { + typename _Traits::int_type __tmp = _Traits::eof(); + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); +// if (!__buf || this->_S_eof(__buf->sputbackc(__c))) + if (__buf) { + _STLP_TRY { + __tmp = __buf->sputbackc(__c); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + } + if (this->_S_eof(__tmp)) + this->setstate(ios_base::badbit); + } + else + this->setstate(ios_base::failbit); + + return *this; +} + +template +basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() { + this->_M_gcount = 0; + + sentry __sentry(*this, _No_Skip_WS()); + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + // if (!__buf || _Traits::eq_int_type(__buf->sungetc(), _Traits::eof())) + if (__buf) { + _STLP_TRY { + if (this->_S_eof(__buf->sungetc())) + this->setstate(ios_base::badbit); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + } else + this->setstate(ios_base::badbit); + } + else + this->setstate(ios_base::failbit); + + return *this; +} + +// Positioning and buffer control. + +template +int basic_istream<_CharT, _Traits>::sync() { + sentry __sentry(*this, _No_Skip_WS()); + + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + if (__buf) { + if (__buf->pubsync() == -1) { + this->setstate(ios_base::badbit); + return -1; + } + else + return 0; + } + else + return -1; +} + +template +__BIS_pos_type__ +basic_istream<_CharT, _Traits>::tellg() { + sentry __sentry(*this, _No_Skip_WS()); + + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + return (__buf && !this->fail()) ? __buf->pubseekoff(0, ios_base::cur, ios_base::in) + : pos_type(-1); +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::seekg(pos_type __pos) { + sentry __sentry(*this, _No_Skip_WS()); + + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + if (!this->fail() && __buf) { + if (__buf->pubseekpos(__pos, ios_base::in) == pos_type(-1)) { + this->setstate(ios_base::failbit); + } + } + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir) { + sentry __sentry(*this, _No_Skip_WS()); + + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + if (!this->fail() && __buf) + __buf->pubseekoff(__off, __dir, ios_base::in); + return *this; +} + +// Formatted input of characters and character arrays. + +template +void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT& __c) { +// typename _Traits::int_type __tmp = _Traits::eof(); + + sentry __sentry(*this); // Skip whitespace. + + if (__sentry) { + typename _Traits::int_type __tmp;// = _Traits::eof(); + + _STLP_TRY { + __tmp = this->rdbuf()->sbumpc(); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + return; + } + + if (!this->_S_eof(__tmp)) + __c = _Traits::to_char_type(__tmp); + else + this->setstate(ios_base::eofbit | ios_base::failbit); + } +} + + +//--------------------------------------------------------------------------- +// istream's helper functions. + +// A generic function for unbuffered input. We stop when we reach EOF, +// or when we have extracted _Num characters, or when the function object +// __is_delim return true. In the last case, it extracts the character +// for which __is_delim is true, if and only if __extract_delim is true. +// It appends a null character to the end of the string; this means that +// it may store up to _Num + 1 characters. +// +// __is_getline governs two corner cases: reading _Num characters without +// encountering delim or eof (in which case failbit is set if __is_getline +// is true); and reading _Num characters where the _Num+1'st character is +// eof (in which case eofbit is set if __is_getline is true). +// +// It is assumed that __is_delim never throws. +// +// Return value is the number of characters extracted, including the +// delimiter if it is extracted. Note that the number of characaters +// extracted isn't necessarily the same as the number stored. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template < class _CharT, class _Traits, class _Is_Delim> +streamsize _STLP_CALL +__read_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf, + streamsize _Num, _CharT* __s, + _Is_Delim __is_delim, + bool __extract_delim, bool __append_null, + bool __is_getline) +{ + streamsize __n = 0; + ios_base::iostate __status = 0; + + typedef typename basic_istream<_CharT, _Traits>::int_type int_type; + // The operations that can potentially throw are sbumpc, snextc, and sgetc. + _STLP_TRY { + for (;;) { + if (__n == _Num) { + if (__is_getline) // didn't find delimiter as one of the _Num chars + __status |= ios_base::failbit; + break; + } + int_type __c = __buf->sbumpc(); // sschwarz + + if (__that->_S_eof(__c)) { + if (__n < _Num || __is_getline) + __status |= ios_base::eofbit; + break; + } else if (__is_delim(_Traits::to_char_type(__c))) { + if (__extract_delim) { // Extract and discard current character. + ++__n; + } else if ( !__pushback(__buf, _Traits::to_char_type(__c)) ) { // leave delimiter + __status |= ios_base::failbit; + } + break; + } + // regular character + *__s++ = _Traits::to_char_type(__c); + ++__n; + } + } + _STLP_CATCH_ALL { + __that->_M_handle_exception(ios_base::badbit); + *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT); + return __n; + } + + if (__append_null) + *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT); + if (__status) + __that->setstate(__status); // This might throw. + return __n; +} + +// Much like __read_unbuffered, but with one additional function object: +// __scan_delim(first, last) returns the first pointer p in [first, last) +// such that __is_delim(p) is true. + +template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim> +streamsize _STLP_CALL +__read_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __buf, + streamsize _Num, _CharT* __s, + _Is_Delim __is_delim, _Scan_Delim __scan_delim, + bool __extract_delim, bool __append_null, + bool __is_getline) { + streamsize __n = 0; + ios_base::iostate __status = 0; + bool __done = false; + + _STLP_TRY { + while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) { + const _CharT* __first = __buf->_M_gptr(); + const _CharT* __last = __buf->_M_egptr(); + //casting numeric_limits::max to streamsize only works is ptrdiff_t is signed or streamsize representation + //is larger than ptrdiff_t one. + _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) || + ((sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits::is_signed)) + ptrdiff_t __request = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), _Num - __n)); + + const _CharT* __p = __scan_delim(__first, __last); + ptrdiff_t __chunk = (min) (ptrdiff_t(__p - __first), __request); + _Traits::copy(__s, __first, __chunk); + __s += __chunk; + __n += __chunk; + __buf->_M_gbump((int)__chunk); + + // We terminated by finding delim. + if (__p != __last && __p - __first <= __request) { + if (__extract_delim) { + __n += 1; + __buf->_M_gbump(1); + } + __done = true; + } + + // We terminated by reading all the characters we were asked for. + else if (__n == _Num) { + + // Find out if we have reached eof. This matters for getline. + if (__is_getline) { + if (__chunk == __last - __first) { + if (__that->_S_eof(__buf->sgetc())) + __status |= ios_base::eofbit; + } + else + __status |= ios_base::failbit; + } + __done = true; + } + + // The buffer contained fewer than _Num - __n characters. Either we're + // at eof, or we should refill the buffer and try again. + else { + if (__that->_S_eof(__buf->sgetc())) { + __status |= ios_base::eofbit; + __done = true; + } + } + } // Close the while loop. + } + _STLP_CATCH_ALL { + __that->_M_handle_exception(ios_base::badbit); + __done = true; + } + + if (__done) { + if (__append_null) + *__s = _STLP_DEFAULT_CONSTRUCTED(_CharT); + if (__status != 0) + __that->setstate(__status); // This might throw. + return __n; + } + + // If execution has reached this point, then we have an empty buffer but + // we have not reached eof. What that means is that the streambuf has + // decided to switch from buffered to unbuffered input. We switch to + // to __read_unbuffered. + + return __n + __read_unbuffered(__that, __buf, _Num - __n, __s, __is_delim, + __extract_delim,__append_null,__is_getline); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::get(_CharT* __s, streamsize __n, + _CharT __delim) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + if (__n > 0) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + + if (__buf->egptr() != __buf->gptr()) + this->_M_gcount = + _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s, + _STLP_PRIV _Eq_char_bound<_Traits>(__delim), + _STLP_PRIV _Scan_for_char_val<_Traits>(__delim), + false, true, false); + else + this->_M_gcount = + _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s, + _STLP_PRIV _Eq_char_bound<_Traits>(__delim), + false, true, false); + } + } + + if (this->_M_gcount == 0) + this->setstate(ios_base::failbit); + + return *this; +} + +// Getline is essentially identical to get, except that it extracts +// the delimiter. +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::getline(_CharT* __s, streamsize __n, + _CharT __delim) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + if (__n > 0) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + this->_M_gcount = __buf->egptr() != __buf->gptr() + ? _STLP_PRIV __read_buffered(this, __buf, __n - 1, __s, + _STLP_PRIV _Eq_char_bound<_Traits>(__delim), + _STLP_PRIV _Scan_for_char_val<_Traits>(__delim), + true, true, true) + : _STLP_PRIV __read_unbuffered(this, __buf, __n - 1, __s, + _STLP_PRIV _Eq_char_bound<_Traits>(__delim), + true, true, true); + } + } + + if (this->_M_gcount == 0) + this->setstate(ios_base::failbit); + + return *this; +} + +// Read n characters. We don't look for any delimiter, and we don't +// put in a terminating null character. +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry && !this->eof()) { + basic_streambuf<_CharT, _Traits>*__buf = this->rdbuf(); + if (__buf->gptr() != __buf->egptr()) + _M_gcount + = _STLP_PRIV __read_buffered(this, __buf, __n, __s, + _STLP_PRIV _Constant_unary_fun(false), + _STLP_PRIV _Project2nd(), + false, false, false); + else + _M_gcount + = _STLP_PRIV __read_unbuffered(this, __buf, __n, __s, + _STLP_PRIV _Constant_unary_fun(false), + false, false, false); + } + else + this->setstate(ios_base::failbit); + + if (this->eof()) + this->setstate(ios_base::eofbit | ios_base::failbit); + + return *this; +} + + +// Read n or fewer characters. We don't look for any delimiter, and +// we don't put in a terminating null character. +template +streamsize +basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __nmax) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry && !this->eof() && __nmax >= 0) { + + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + streamsize __avail = __buf->in_avail(); + + // fbp : isn't full-blown setstate required here ? + if (__avail == -1) + this->_M_setstate_nothrow(ios_base::eofbit); + + else if (__avail != 0) { + + if (__buf->gptr() != __buf->egptr()) + _M_gcount + = _STLP_PRIV __read_buffered(this, __buf, (min) (__avail, __nmax), __s, + _STLP_PRIV _Constant_unary_fun(false), + _STLP_PRIV _Project2nd(), + false, false, false); + else + _M_gcount + = _STLP_PRIV __read_unbuffered(this, __buf, (min) (__avail, __nmax), __s, + _STLP_PRIV _Constant_unary_fun(false), + false, false, false); + } + } + else { + // fbp : changed so that failbit is set only there, to pass Dietmar's test + if (this->eof()) + this->setstate(ios_base::eofbit | ios_base::failbit); + else + this->setstate(ios_base::failbit); + } + + // if (this->eof()) + // this->setstate(ios_base::eofbit | ios_base::failbit); + + return _M_gcount; +} + +template +void basic_istream<_CharT, _Traits>::_M_formatted_get(_CharT* __s) { + sentry __sentry(*this); // Skip whitespace. + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + streamsize __nmax = this->width() > 0 + ? this->width() - 1 + : ((numeric_limits::max)() / sizeof(_CharT)) - 1; + + streamsize __n = __buf->gptr() != __buf->egptr() + ? _STLP_PRIV __read_buffered(this, __buf, __nmax, __s, + _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()), + _STLP_PRIV _Scan_wspace_null<_Traits>(this->_M_ctype_facet()), + false, true, false) + : _STLP_PRIV __read_unbuffered(this, __buf, __nmax, __s, + _STLP_PRIV _Is_wspace_null<_Traits>(this->_M_ctype_facet()), + false, true, false); + if (__n == 0) + this->setstate(ios_base::failbit); + } + this->width(0); +} + +// A generic unbuffered function for ignoring characters. We stop +// when we reach EOF, or when the function object __is_delim returns +// true. In the last case, it extracts the character for which +// __is_delim is true, if and only if __extract_delim is true. + +template < class _CharT, class _Traits, class _Is_Delim> +void _STLP_CALL +_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that, + basic_streambuf<_CharT, _Traits>* __buf, + _Is_Delim __is_delim, + bool __extract_delim, bool __set_failbit) { + bool __done = false; + ios_base::iostate __status = 0; + typedef typename basic_istream<_CharT, _Traits>::int_type int_type; + + _STLP_TRY { + while (!__done) { + int_type __c = __buf->sbumpc(); + + if (__that->_S_eof(__c)) { + __done = true; + __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit + : ios_base::eofbit; + } + + else if (__is_delim(_Traits::to_char_type(__c))) { + __done = true; + if (!__extract_delim) + if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c)))) + __status |= ios_base::failbit; + } + } + } + _STLP_CATCH_ALL { + __that->_M_handle_exception(ios_base::badbit); + } + + __that->setstate(__status); +} + +// A generic buffered function for ignoring characters. Much like +// _M_ignore_unbuffered, but with one additional function object: +// __scan_delim(first, last) returns the first pointer p in [first, +// last) such that __is_delim(p) is true. + +template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim> +void _STLP_CALL +_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that, + basic_streambuf<_CharT, _Traits>* __buf, + _Is_Delim __is_delim, _Scan_Delim __scan_delim, + bool __extract_delim, bool __set_failbit) { + bool __at_eof = false; + bool __found_delim = false; + + _STLP_TRY { + while (__buf->_M_egptr() != __buf->_M_gptr() && !__at_eof && !__found_delim) { + const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr()); + __buf->_M_gbump((int)(__p - __buf->_M_gptr())); + + if (__p != __buf->_M_egptr()) { // We found delim, so we're done. + if (__extract_delim) + __buf->_M_gbump(1); + __found_delim = true; + } + + else // No delim. Try to refil the buffer. + __at_eof = __that->_S_eof(__buf->sgetc()); + } // Close the while loop. + } + _STLP_CATCH_ALL { + __that->_M_handle_exception(ios_base::badbit); + return; + } + + if (__at_eof) { + __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit + : ios_base::eofbit); + return; + } + if (__found_delim) + return; + + // If execution has reached this point, then we have an empty buffer but + // we have not reached eof. What that means is that the streambuf has + // decided to switch from a buffered to an unbuffered mode. We switch + // to _M_ignore_unbuffered. + _M_ignore_unbuffered(__that, __buf, __is_delim, __extract_delim, __set_failbit); +} + +// Overloaded versions of _M_ignore_unbuffered and _M_ignore_unbuffered +// with an explicit count _Num. Return value is the number of +// characters extracted. +// +// The function object __max_chars takes two arguments, _Num and __n +// (the latter being the number of characters we have already read), +// and returns the maximum number of characters to read from the buffer. +// We parameterize _M_ignore_buffered so that we can use it for both +// bounded and unbounded input; for the former the function object should +// be minus<>, and for the latter it should return a constant maximum value. + +template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim> +streamsize _STLP_CALL +_M_ignore_unbuffered(basic_istream<_CharT, _Traits>* __that, + basic_streambuf<_CharT, _Traits>* __buf, + streamsize _Num, _Max_Chars __max_chars, + _Is_Delim __is_delim, + bool __extract_delim, bool __set_failbit) { + streamsize __n = 0; + ios_base::iostate __status = 0; + typedef typename basic_istream<_CharT, _Traits>::int_type int_type; + + _STLP_TRY { + while (__max_chars(_Num, __n) > 0) { + int_type __c = __buf->sbumpc(); + + if (__that->_S_eof(__c)) { + __status |= __set_failbit ? ios_base::eofbit | ios_base::failbit + : ios_base::eofbit; + break; + } + + else if (__is_delim(_Traits::to_char_type(__c))) { + if (__extract_delim) + ++__n; + else if (__that->_S_eof(__buf->sputbackc(_Traits::to_char_type(__c)))) + __status |= ios_base::failbit; + + break; + } + // fbp : added counter increment to pass Dietmar's test + ++__n; + } + } + _STLP_CATCH_ALL { + __that->_M_handle_exception(ios_base::badbit); + } + + if (__status) + __that->setstate(__status); // This might throw. + return __n; +} + +template < class _CharT, class _Traits, class _Max_Chars, class _Is_Delim, class _Scan_Delim> +streamsize _STLP_CALL +_M_ignore_buffered(basic_istream<_CharT, _Traits>* __that, + basic_streambuf<_CharT, _Traits>* __buf, + streamsize _Num, + _Max_Chars __max_chars, + _Is_Delim __is_delim, _Scan_Delim __scan_delim, + bool __extract_delim, bool __set_failbit) { + streamsize __n = 0; + bool __at_eof = false; + bool __done = false; + + _STLP_TRY { + while (__buf->_M_egptr() != __buf->_M_gptr() && !__done) { + ptrdiff_t __avail = __buf->_M_egptr() - __buf->_M_gptr(); + streamsize __m = __max_chars(_Num, __n); + + if (__avail >= __m) { // We have more characters than we need. + const _CharT* __last = __buf->_M_gptr() + __STATIC_CAST(ptrdiff_t, __m); + const _CharT* __p = __scan_delim(__buf->_M_gptr(), __last); + ptrdiff_t __chunk = __p - __buf->_M_gptr(); + __n += __chunk; + __buf->_M_gbump((int)__chunk); + + if (__extract_delim && __p != __last) { + __n += 1; + __buf->_M_gbump(1); + } + + __done = true; + } + + else { + const _CharT* __p = __scan_delim(__buf->_M_gptr(), __buf->_M_egptr()); + ptrdiff_t __chunk = __p - __buf->_M_gptr(); + __n += __chunk; + __buf->_M_gbump((int)__chunk); + + if (__p != __buf->_M_egptr()) { // We found delim. + if (__extract_delim) { + __n += 1; + __buf->_M_gbump(1); + } + + __done = true; + } + + // We didn't find delim. Try to refill the buffer. + else if (__that->_S_eof(__buf->sgetc())) { + __done = true; + __at_eof = true; + } + } + } // Close the while loop. + } + _STLP_CATCH_ALL { + __that->_M_handle_exception(ios_base::badbit); + return __n; + } + + if (__at_eof) + __that->setstate(__set_failbit ? ios_base::eofbit | ios_base::failbit + : ios_base::eofbit); + + if (__done) + return __n; + + // If execution has reached this point, then we have an empty buffer but + // we have not reached eof. What that means is that the streambuf has + // decided to switch from buffered to unbuffered input. We switch to + // to _M_ignore_unbuffered. + + return __n + _M_ignore_unbuffered(__that, __buf, _Num, __max_chars, + __is_delim, __extract_delim, __set_failbit); +} + + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::ignore(streamsize __n) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + typedef _STLP_PRIV _Constant_unary_fun _Const_bool; + typedef _STLP_PRIV _Constant_binary_fun _Const_streamsize; + const streamsize __maxss = (numeric_limits::max)(); + + if (__n == (numeric_limits::max)()) { + if (__buf->gptr() != __buf->egptr()) + _M_gcount = _M_ignore_buffered(this, __buf, + __maxss, _Const_streamsize(__maxss), + _Const_bool(false), + _STLP_PRIV _Project2nd(), + false, false); + else + _M_gcount = _M_ignore_unbuffered(this, __buf, + __maxss, _Const_streamsize(__maxss), + _Const_bool(false), false, false); + } + else { + if (__buf->gptr() != __buf->egptr()) + _M_gcount = _M_ignore_buffered(this, __buf, + __n, minus(), + _Const_bool(false), + _STLP_PRIV _Project2nd(), + false, false); + else + _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus(), + _Const_bool(false), false, false); + } + } + + return *this; +} + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + typedef _STLP_PRIV _Constant_unary_fun _Const_bool; + typedef _STLP_PRIV _Constant_binary_fun + _Const_streamsize; + const streamsize __maxss = (numeric_limits::max)(); + + if (__n == (numeric_limits::max)()) { + if (__buf->gptr() != __buf->egptr()) + _M_gcount = _M_ignore_buffered(this, __buf, + __maxss, _Const_streamsize(__maxss), + _STLP_PRIV _Eq_int_bound<_Traits>(__delim), + _STLP_PRIV _Scan_for_int_val<_Traits>(__delim), + true, false); + else + _M_gcount = _M_ignore_unbuffered(this, __buf, + __maxss, _Const_streamsize(__maxss), + _STLP_PRIV _Eq_int_bound<_Traits>(__delim), + true, false); + } + else { + if (__buf->gptr() != __buf->egptr()) + _M_gcount = _M_ignore_buffered(this, __buf, + __n, minus(), + _STLP_PRIV _Eq_int_bound<_Traits>(__delim), + _STLP_PRIV _Scan_for_int_val<_Traits>(__delim), + true, false); + else + _M_gcount = _M_ignore_unbuffered(this, __buf, __n, minus(), + _STLP_PRIV _Eq_int_bound<_Traits>(__delim), + true, false); + } + } + + return *this; +} + +// This member function does not construct a sentry object, because +// it is called from sentry's constructor. +template +void basic_istream<_CharT, _Traits>::_M_skip_whitespace(bool __set_failbit) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + if (!__buf) + this->setstate(ios_base::badbit); + else if (__buf->gptr() != __buf->egptr()) + _M_ignore_buffered(this, __buf, + _STLP_PRIV _Is_not_wspace<_Traits>(this->_M_ctype_facet()), + _STLP_PRIV _Scan_for_not_wspace<_Traits>(this->_M_ctype_facet()), + false, __set_failbit); + else + _M_ignore_unbuffered(this, __buf, + _STLP_PRIV _Is_not_wspace<_Traits>(this->_M_ctype_facet()), + false, __set_failbit); +} + + +// This is a very simple loop that reads characters from __src and puts +// them into __dest. It looks complicated because of the (standard- +// mandated) exception handling policy. +// +// We stop when we get an exception, when we fail to insert into the +// output streambuf, or when __is_delim is true. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template < class _CharT, class _Traits, class _Is_Delim> +streamsize _STLP_CALL +__copy_unbuffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src, + basic_streambuf<_CharT, _Traits>* __dest, + _Is_Delim __is_delim, + bool __extract_delim, bool __rethrow) { + streamsize __extracted = 0; + ios_base::iostate __status = 0; + typedef typename basic_istream<_CharT, _Traits>::int_type int_type; + int_type __c; + + _STLP_TRY { + for (;;) { + // Get a character. If there's an exception, catch and (maybe) rethrow it. + __c = __src->sbumpc(); + + // If we failed to get a character, then quit. + if (__that->_S_eof(__c)) { + __status |= ios_base::eofbit; + break; + } + // If it's the delimiter, then quit. + else if (__is_delim(_Traits::to_char_type(__c))) { + if (!__extract_delim && !__pushback(__src, _Traits::to_char_type(__c))) + __status |= ios_base::failbit; + break; + } + else { + // Try to put the character in the output streambuf. + bool __failed = false; + _STLP_TRY { + if (!__that->_S_eof(__dest->sputc(_Traits::to_char_type(__c)))) + ++__extracted; + else + __failed = true; + } + _STLP_CATCH_ALL { + __failed = true; + } + + // If we failed to put the character in the output streambuf, then + // try to push it back to the input streambuf. + if (__failed && !__pushback(__src, _Traits::to_char_type(__c))) + __status |= ios_base::failbit; + + // fbp : avoiding infinite loop in io-27-6-1-2-3.exp + if (__failed) + break; + } + + } /* for (;;) */ + + } + // fbp : this try/catch moved here in reasonable assumption + // __is_delim never throw (__pushback is guaranteed not to) + _STLP_CATCH_ALL { + // See 27.6.1.2.3, paragraph 13. + if (__rethrow && __extracted == 0) + __that->_M_handle_exception(ios_base::failbit); + } + __that->setstate(__status); + return __extracted; +} + +// Buffered copying from one streambuf to another. We copy the characters +// in chunks, rather than one at a time. We still have to worry about all +// of the error conditions we checked in __copy_unbuffered, plus one more: +// the streambuf might decide to switch from a buffered to an unbuffered mode. + +template < class _CharT, class _Traits, class _Is_Delim, class _Scan_Delim> +streamsize _STLP_CALL +__copy_buffered(basic_istream<_CharT, _Traits>* __that, basic_streambuf<_CharT, _Traits>* __src, + basic_streambuf<_CharT, _Traits>* __dest, + _Scan_Delim __scan_delim, _Is_Delim __is_delim, + bool __extract_delim, bool __rethrow) { + streamsize __extracted = 0; + ios_base::iostate __status = 0; + typedef typename basic_istream<_CharT, _Traits>::int_type int_type; + //Borland compiler generates a warning if assignment because value is never used: + int_type __c /*= _Traits::eof()*/; + _CharT* __first = __src->_M_gptr(); + ptrdiff_t __avail = __src->_M_egptr() - __first; + // fbp : introduced to move catch/try blocks out of the loop + bool __do_handle_exceptions = false; + + _STLP_TRY { + for (;;) { + const _CharT* __last = __scan_delim(__first, __src->_M_egptr()); + + // Try to copy the entire input buffer to the output buffer. + streamsize __n = __dest->sputn(__first, __extract_delim && __last != __src->_M_egptr() + ? (__last - __first) + 1 + : (__last - __first)); + __src->_M_gbump((int)__n); + __extracted += __n; + + // from this on, catch() will call _M_handle_exceptions() + __do_handle_exceptions = true; + + if (__n < __avail) // We found the delimiter, or else failed to + break; // copy some characters. + + __c = __src->sgetc(); + + // Three possibilities: we succeeded in refilling the buffer, or + // we got EOF, or the streambuf has switched to unbuffered mode. + __first = __src->_M_gptr(); + __avail = __src->_M_egptr() - __first; + + if (__avail > 0) + {} // dwa 1/16/00 -- suppress a Metrowerks warning + else if (__that->_S_eof(__c)) { + __status |= ios_base::eofbit; + break; + } + else { + return __extracted + __copy_unbuffered(__that, __src, __dest, __is_delim, + __extract_delim, __rethrow); + } + + __do_handle_exceptions = false; + } + } + + _STLP_CATCH_ALL { + // See 27.6.1.2.3, paragraph 13. + if (__rethrow && __do_handle_exceptions && __extracted == 0) + __that->_M_handle_exception(ios_base::failbit); + } + + if (__status) + __that->setstate(__status); // This might throw. + return __extracted; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits> + ::get(basic_streambuf<_CharT, _Traits>& __dest, _CharT __delim) { + sentry __sentry(*this, _No_Skip_WS()); + this->_M_gcount = 0; + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __src = this->rdbuf(); + + if (__src) + this->_M_gcount = __src->egptr() != __src->gptr() + ? _STLP_PRIV __copy_buffered(this, __src, &__dest, + _STLP_PRIV _Scan_for_char_val<_Traits>(__delim), + _STLP_PRIV _Eq_char_bound<_Traits>(__delim), + false, false) + : _STLP_PRIV __copy_unbuffered(this, __src, &__dest, + _STLP_PRIV _Eq_char_bound<_Traits>(__delim), + false, false); + } + + if (this->_M_gcount == 0) + this->setstate(ios_base::failbit); + + return *this; +} + +// Copying characters into a streambuf. +template +basic_istream<_CharT, _Traits>& +basic_istream<_CharT, _Traits> + ::operator>>(basic_streambuf<_CharT, _Traits>* __dest) { + streamsize __n = 0; + typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; + _Sentry __sentry(*this); + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __src = this->rdbuf(); + if (__src && __dest) + __n = __src->egptr() != __src->gptr() + ? _STLP_PRIV __copy_buffered(this, __src, __dest, + _STLP_PRIV _Project2nd(), + _STLP_PRIV _Constant_unary_fun(false), + false, true) + : _STLP_PRIV __copy_unbuffered(this, __src, __dest, + _STLP_PRIV _Constant_unary_fun(false), + false, true); + } + + if (__n == 0) + this->setstate(ios_base::failbit); + + return *this; +} + +// ---------------------------------------------------------------- +// basic_iostream<> class +// ---------------------------------------------------------------- + +template +basic_iostream<_CharT, _Traits> + ::basic_iostream(basic_streambuf<_CharT, _Traits>* __buf) + : basic_ios<_CharT, _Traits>(), + basic_istream<_CharT, _Traits>(__buf), + basic_ostream<_CharT, _Traits>(__buf) { + this->init(__buf); +} + +template +basic_iostream<_CharT, _Traits>::~basic_iostream() +{} + +_STLP_END_NAMESPACE + +#undef __BIS_int_type__ +#undef __BIS_pos_type__ +#undef __BIS_off_type__ + +#endif /* _STLP_ISTREAM_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_istream.h b/sdk/tlibstdcxx/stlport/stl/_istream.h new file mode 100644 index 0000000000..6b38d03c77 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_istream.h @@ -0,0 +1,359 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_ISTREAM +#define _STLP_INTERNAL_ISTREAM + +// this block is included by _ostream.h, we include it here to lower #include level +#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR) +# include +#endif + +#ifndef _STLP_INTERNAL_IOS_H +# include // For basic_ios<>. Includes . +#endif + +#ifndef _STLP_INTERNAL_OSTREAM_H +# include // Needed as a base class of basic_iostream. +#endif + +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H +# include +#endif + +#include // Helper functions that allow char traits + // to be used as function objects. +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +template +class _Isentry; +#endif + +struct _No_Skip_WS {}; // Dummy class used by sentry. + +template +bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr); +template +bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr); + +//---------------------------------------------------------------------- +// Class basic_istream, a class that performs formatted input through +// a stream buffer. + +// The second template parameter, _Traits, defaults to char_traits<_CharT>. +// The default is declared in header , and it isn't declared here +// because C++ language rules do not allow it to be declared twice. + +template +class basic_istream : virtual public basic_ios<_CharT, _Traits> { + typedef basic_istream<_CharT, _Traits> _Self; + +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) + //explicitely defined as private to avoid warnings: + basic_istream(_Self const&); + _Self& operator = (_Self const&); +#endif + +public: + // Types + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + typedef basic_ios<_CharT, _Traits> _Basic_ios; + + typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&); + typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&); + typedef _Self& (_STLP_CALL *__istream_fn)(_Self&); + +public: // Constructor and destructor. + explicit basic_istream(basic_streambuf<_CharT, _Traits>* __buf) : + basic_ios<_CharT, _Traits>(), _M_gcount(0) { + this->init(__buf); + } + ~basic_istream() {}; + +public: // Nested sentry class. + +public: // Hooks for manipulators. The arguments are + // function pointers. + _Self& operator>> (__istream_fn __f) { return __f(*this); } + _Self& operator>> (__ios_fn __f) { __f(*this); return *this; } + _Self& operator>> (__ios_base_fn __f) { __f(*this); return *this; } + +public: // Formatted input of numbers. + _Self& operator>> (short& __val); + _Self& operator>> (int& __val); + _Self& operator>> (unsigned short& __val); + _Self& operator>> (unsigned int& __val); + _Self& operator>> (long& __val); + _Self& operator>> (unsigned long& __val); +#ifdef _STLP_LONG_LONG + _Self& operator>> (_STLP_LONG_LONG& __val); + _Self& operator>> (unsigned _STLP_LONG_LONG& __val); +#endif + _Self& operator>> (float& __val); + _Self& operator>> (double& __val); +# ifndef _STLP_NO_LONG_DOUBLE + _Self& operator>> (long double& __val); +# endif +# ifndef _STLP_NO_BOOL + _Self& operator>> (bool& __val); +# endif + _Self& operator>> (void*& __val); + +public: // Copying characters into a streambuf. + _Self& operator>>(basic_streambuf<_CharT, _Traits>*); + +public: // Unformatted input. + streamsize gcount() const { return _M_gcount; } + int_type peek(); + +public: // get() for single characters + int_type get(); + _Self& get(char_type& __c); + +public: // get() for character arrays. + _Self& get(char_type* __s, streamsize __n, char_type __delim); + _Self& get(char_type* __s, streamsize __n) + { return get(__s, __n, this->widen('\n')); } + +public: // get() for streambufs + _Self& get(basic_streambuf<_CharT, _Traits>& __buf, + char_type __delim); + _Self& get(basic_streambuf<_CharT, _Traits>& __buf) + { return get(__buf, this->widen('\n')); } + +public: // getline() + _Self& getline(char_type* __s, streamsize __n, char_type delim); + _Self& getline(char_type* __s, streamsize __n) + { return getline(__s, __n, this->widen('\n')); } + +public: // read(), readsome(), ignore() + _Self& ignore(); + _Self& ignore(streamsize __n); + _Self& ignore(streamsize __n, int_type __delim); + + _Self& read(char_type* __s, streamsize __n); + streamsize readsome(char_type* __s, streamsize __n); + +public: // putback + _Self& putback(char_type __c); + _Self& unget(); + +public: // Positioning and buffer control. + int sync(); + + pos_type tellg(); + _Self& seekg(pos_type __pos); + _Self& seekg(off_type, ios_base::seekdir); + +public: // Helper functions for non-member extractors. + void _M_formatted_get(_CharT& __c); + void _M_formatted_get(_CharT* __s); + void _M_skip_whitespace(bool __set_failbit); + +private: // Number of characters extracted by the + streamsize _M_gcount; // most recent unformatted input function. + +public: + +#if defined (_STLP_USE_TEMPLATE_EXPORT) + // If we are using DLL specs, we have not to use inner classes + // end class declaration here + typedef _Isentry<_CharT, _Traits> sentry; +}; +# define sentry _Isentry +template +class _Isentry { + typedef _Isentry<_CharT, _Traits> _Self; +# else + class sentry { + typedef sentry _Self; +#endif + + private: + const bool _M_ok; + // basic_streambuf<_CharT, _Traits>* _M_buf; + + public: + typedef _Traits traits_type; + + explicit sentry(basic_istream<_CharT, _Traits>& __istr, + bool __noskipws = false) : + _M_ok((__noskipws || !(__istr.flags() & ios_base::skipws)) ? _M_init_noskip(__istr) : _M_init_skip(__istr) ) + /* , _M_buf(__istr.rdbuf()) */ + {} + + // Calling this constructor is the same as calling the previous one with + // __noskipws = true, except that it doesn't require a runtime test. + sentry(basic_istream<_CharT, _Traits>& __istr, _No_Skip_WS) : /* _M_buf(__istr.rdbuf()), */ + _M_ok(_M_init_noskip(__istr)) {} + + ~sentry() {} + + operator bool() const { return _M_ok; } + + private: // Disable assignment and copy constructor. + //Implementation is here only to avoid warning with some compilers. + sentry(const _Self&) : _M_ok(false) {} + _Self& operator=(const _Self&) { return *this; } + }; + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +# undef sentry +# else + // close basic_istream class definition here +}; +# endif + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _Isentry >; +_STLP_EXPORT_TEMPLATE_CLASS basic_istream >; +# if ! defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS _Isentry >; +_STLP_EXPORT_TEMPLATE_CLASS basic_istream >; +# endif +# endif /* _STLP_USE_TEMPLATE_EXPORT */ + +// Non-member character and string extractor functions. +template +inline basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT& __c) { + __in_str._M_formatted_get(__c); + return __in_str; +} + +template +inline basic_istream& _STLP_CALL +operator>>(basic_istream& __in_str, unsigned char& __c) { + __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c)); + return __in_str; +} + +template +inline basic_istream& _STLP_CALL +operator>>(basic_istream& __in_str, signed char& __c) { + __in_str._M_formatted_get(__REINTERPRET_CAST(char&,__c)); + return __in_str; +} + +template +inline basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __in_str, _CharT* __s) { + __in_str._M_formatted_get(__s); + return __in_str; +} + +template +inline basic_istream& _STLP_CALL +operator>>(basic_istream& __in_str, unsigned char* __s) { + __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s)); + return __in_str; +} + +template +inline basic_istream& _STLP_CALL +operator>>(basic_istream& __in_str, signed char* __s) { + __in_str._M_formatted_get(__REINTERPRET_CAST(char*,__s)); + return __in_str; +} + +//---------------------------------------------------------------------- +// istream manipulator. +template +basic_istream<_CharT, _Traits>& _STLP_CALL +ws(basic_istream<_CharT, _Traits>& __istr) { + if (!__istr.eof()) { + typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; + _Sentry __sentry(__istr, _No_Skip_WS()); // Don't skip whitespace. + if (__sentry) + __istr._M_skip_whitespace(false); + } + return __istr; +} + +// Helper functions for istream<>::sentry constructor. +template +inline bool _M_init_skip(basic_istream<_CharT, _Traits>& __istr) { + if (__istr.good()) { + if (__istr.tie()) + __istr.tie()->flush(); + + __istr._M_skip_whitespace(true); + } + + if (!__istr.good()) { + __istr.setstate(ios_base::failbit); + return false; + } else + return true; +} + +template +inline bool _M_init_noskip(basic_istream<_CharT, _Traits>& __istr) { + if (__istr.good()) { + if (__istr.tie()) + __istr.tie()->flush(); + + if (!__istr.rdbuf()) + __istr.setstate(ios_base::badbit); + } + else + __istr.setstate(ios_base::failbit); + return __istr.good(); +} + +//---------------------------------------------------------------------- +// Class iostream. +template +class basic_iostream + : public basic_istream<_CharT, _Traits>, + public basic_ostream<_CharT, _Traits> +{ +public: + typedef basic_ios<_CharT, _Traits> _Basic_ios; + + explicit basic_iostream(basic_streambuf<_CharT, _Traits>* __buf); + virtual ~basic_iostream(); +}; + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_iostream >; + +# if ! defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_iostream >; +# endif +# endif /* _STLP_USE_TEMPLATE_EXPORT */ + +template +basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& __istr) +{ return __istr.rdbuf(); } + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_ISTREAM */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_istreambuf_iterator.h b/sdk/tlibstdcxx/stlport/stl/_istreambuf_iterator.h new file mode 100644 index 0000000000..9f340cb517 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_istreambuf_iterator.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H +#define _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// defined in _istream.h +template +extern basic_streambuf<_CharT, _Traits>* _STLP_CALL _M_get_istreambuf(basic_istream<_CharT, _Traits>& ) ; + +// We do not read any characters until operator* is called. operator* calls sgetc +// unless the iterator is unchanged from the last call in which case a cached value is +// used. Calls to operator++ use sbumpc. + +template +class istreambuf_iterator : + public iterator +{ +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename _Traits::int_type int_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_istream<_CharT, _Traits> istream_type; + + typedef input_iterator_tag iterator_category; + typedef _CharT value_type; + typedef typename _Traits::off_type difference_type; + typedef const _CharT* pointer; + typedef const _CharT& reference; + +public: + istreambuf_iterator(streambuf_type* __p = 0) { this->_M_init(__p); } + // istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) { this->_M_init(_M_get_istreambuf(__is)); } + inline istreambuf_iterator(basic_istream<_CharT, _Traits>& __is); + + char_type operator*() const { this->_M_getc(); return _M_c; } + istreambuf_iterator<_CharT, _Traits>& operator++() { + _M_buf->sbumpc(); + _M_have_c = false; + return *this; + } + istreambuf_iterator<_CharT, _Traits> operator++(int); + + bool equal(const istreambuf_iterator<_CharT, _Traits>& __i) const { + if (this->_M_buf) + this->_M_getc(); + if (__i._M_buf) + __i._M_getc(); + return this->_M_eof == __i._M_eof; + } + +private: + void _M_init(streambuf_type* __p) { + _M_buf = __p; + _M_eof = (__p == 0); + _M_have_c = false; + } + + void _M_getc() const { + if (_M_have_c) + return; + int_type __c = _M_buf->sgetc(); + _STLP_MUTABLE(_Self, _M_c) = traits_type::to_char_type(__c); + _STLP_MUTABLE(_Self, _M_eof) = traits_type::eq_int_type(__c, traits_type::eof()); + _STLP_MUTABLE(_Self, _M_have_c) = true; + } + +private: + streambuf_type* _M_buf; + mutable _CharT _M_c; + mutable bool _M_eof; + mutable bool _M_have_c; +}; + +template +inline istreambuf_iterator<_CharT, _Traits>::istreambuf_iterator(basic_istream<_CharT, _Traits>& __is) +{ this->_M_init(_M_get_istreambuf(__is)); } + +template +inline bool _STLP_CALL operator==(const istreambuf_iterator<_CharT, _Traits>& __x, + const istreambuf_iterator<_CharT, _Traits>& __y) { + return __x.equal(__y); +} + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool _STLP_CALL operator!=(const istreambuf_iterator<_CharT, _Traits>& __x, + const istreambuf_iterator<_CharT, _Traits>& __y) { + return !__x.equal(__y); +} + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator >; +# if defined (INSTANTIATE_WIDE_STREAMS) +_STLP_EXPORT_TEMPLATE_CLASS istreambuf_iterator >; +# endif +# endif /* _STLP_USE_TEMPLATE_EXPORT */ + +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES +template +inline input_iterator_tag _STLP_CALL iterator_category(const istreambuf_iterator<_CharT, _Traits>&) { return input_iterator_tag(); } +template +inline streamoff* _STLP_CALL +distance_type(const istreambuf_iterator<_CharT, _Traits>&) { return (streamoff*)0; } +template +inline _CharT* _STLP_CALL value_type(const istreambuf_iterator<_CharT, _Traits>&) { return (_CharT*)0; } +# endif + +template +istreambuf_iterator<_CharT, _Traits> +istreambuf_iterator<_CharT, _Traits>::operator++(int) { + _M_getc(); // __tmp should avoid any future actions under + // underlined buffer---during call of operator *() + // (due to buffer for *this and __tmp are the same). + istreambuf_iterator<_CharT, _Traits> __tmp = *this; + _M_buf->sbumpc(); + _M_have_c = false; + return __tmp; +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_iterator.h b/sdk/tlibstdcxx/stlport/stl/_iterator.h new file mode 100644 index 0000000000..8e3b7b032a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_iterator.h @@ -0,0 +1,265 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ITERATOR_H +#define _STLP_INTERNAL_ITERATOR_H + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +// This is the new version of reverse_iterator, as defined in the +// draft C++ standard. It relies on the iterator_traits template, +// which in turn relies on partial specialization. The class +// reverse_bidirectional_iterator is no longer part of the draft +// standard, but it is retained for backward compatibility. + +template +class reverse_iterator : + public iterator::iterator_category, + typename iterator_traits<_Iterator>::value_type, + typename iterator_traits<_Iterator>::difference_type, + typename iterator_traits<_Iterator>::pointer, + typename iterator_traits<_Iterator>::reference> { +protected: + _Iterator current; + typedef reverse_iterator<_Iterator> _Self; +public: + typedef typename iterator_traits<_Iterator>::difference_type difference_type; + // pointer type required for arrow operator hidden behind _STLP_DEFINE_ARROW_OPERATOR: + typedef typename iterator_traits<_Iterator>::pointer pointer; + typedef typename iterator_traits<_Iterator>::reference reference; + typedef _Iterator iterator_type; +public: + reverse_iterator() {} + explicit reverse_iterator(iterator_type __x) : current(__x) {} + reverse_iterator(const _Self& __x) : current(__x.current) {} + _Self& operator = (const _Self& __x) { current = __x.base(); return *this; } +# if defined (_STLP_MEMBER_TEMPLATES) + template + reverse_iterator(const reverse_iterator<_Iter>& __x) : current(__x.base()) {} + template + _Self& operator = (const reverse_iterator<_Iter>& __x) { current = __x.base(); return *this; } +# endif /* _STLP_MEMBER_TEMPLATES */ + + iterator_type base() const { return current; } + reference operator*() const { + _Iterator __tmp = current; + return *--__tmp; + } + _STLP_DEFINE_ARROW_OPERATOR + _Self& operator++() { + --current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --current; + return __tmp; + } + _Self& operator--() { + ++current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++current; + return __tmp; + } + + _Self operator+(difference_type __n) const { return _Self(current - __n); } + _Self& operator+=(difference_type __n) { + current -= __n; + return *this; + } + _Self operator-(difference_type __n) const { return _Self(current + __n); } + _Self& operator-=(difference_type __n) { + current += __n; + return *this; + } + reference operator[](difference_type __n) const { return *(*this + __n); } +}; + +template +inline bool _STLP_CALL operator==(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return __x.base() == __y.base(); } + +template +inline bool _STLP_CALL operator<(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return __y.base() < __x.base(); } + +# if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) +template +inline bool _STLP_CALL operator!=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return !(__x == __y); } + +template +inline bool _STLP_CALL operator>(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return __y < __x; } + +template +inline bool _STLP_CALL operator<=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return !(__y < __x); } + +template +inline bool _STLP_CALL operator>=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return !(__x < __y); } +# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +# if defined (__SUNPRO_CC) +inline ptrdiff_t _STLP_CALL +# else +inline typename reverse_iterator<_Iterator>::difference_type _STLP_CALL +# endif +operator-(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) +{ return __y.base() - __x.base(); } + +template +inline reverse_iterator<_Iterator> _STLP_CALL +operator+(_DifferenceType n,const reverse_iterator<_Iterator>& x) +{ return x.operator+(n); } +#endif + +template +class back_insert_iterator + : public iterator { + typedef back_insert_iterator<_Container> _Self; +protected: + //c is a Standard name (24.4.2.1), do no make it STLport naming convention compliant. + _Container *container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + + explicit back_insert_iterator(_Container& __x) : container(&__x) {} + + _Self& operator=(const _Self& __other) { + container = __other.container; + return *this; + } + _Self& operator=(const typename _Container::value_type& __val) { + container->push_back(__val); + return *this; + } + _Self& operator*() { return *this; } + _Self& operator++() { return *this; } + _Self operator++(int) { return *this; } +}; + +template +inline back_insert_iterator<_Container> _STLP_CALL back_inserter(_Container& __x) +{ return back_insert_iterator<_Container>(__x); } + +template +class front_insert_iterator + : public iterator { + typedef front_insert_iterator<_Container> _Self; +protected: + //c is a Standard name (24.4.2.3), do no make it STLport naming convention compliant. + _Container *container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + explicit front_insert_iterator(_Container& __x) : container(&__x) {} + + _Self& operator=(const _Self& __other) { + container = __other.container; + return *this; + } + _Self& operator=(const typename _Container::value_type& __val) { + container->push_front(__val); + return *this; + } + _Self& operator*() { return *this; } + _Self& operator++() { return *this; } + _Self operator++(int) { return *this; } +}; + +template +inline front_insert_iterator<_Container> _STLP_CALL front_inserter(_Container& __x) +{ return front_insert_iterator<_Container>(__x); } + +template +class insert_iterator + : public iterator { + typedef insert_iterator<_Container> _Self; +protected: + //container is a Standard name (24.4.2.5), do no make it STLport naming convention compliant. + _Container *container; + typename _Container::iterator _M_iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + insert_iterator(_Container& __x, typename _Container::iterator __i) + : container(&__x), _M_iter(__i) {} + + _Self& operator=(_Self const& __other) { + container = __other.container; + _M_iter = __other._M_iter; + return *this; + } + _Self& operator=(const typename _Container::value_type& __val) { + _M_iter = container->insert(_M_iter, __val); + ++_M_iter; + return *this; + } + _Self& operator*() { return *this; } + _Self& operator++() { return *this; } + _Self& operator++(int) { return *this; } +}; + +template +inline insert_iterator<_Container> _STLP_CALL +inserter(_Container& __x, _Iterator __i) { + typedef typename _Container::iterator __iter; + return insert_iterator<_Container>(__x, __iter(__i)); +} + +_STLP_END_NAMESPACE + +#if ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +# include +#endif + +#endif /* _STLP_INTERNAL_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_iterator_base.h b/sdk/tlibstdcxx/stlport/stl/_iterator_base.h new file mode 100644 index 0000000000..2362ca1665 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_iterator_base.h @@ -0,0 +1,528 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +#define _STLP_INTERNAL_ITERATOR_BASE_H + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +//# if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD) +//_STLP_BEGIN_NAMESPACE +//using namespace _STLP_VENDOR_CSTD; +//_STLP_END_NAMESPACE +//#endif /* _STLP_IMPORT_VENDOR_CSTD */ + +#if !defined(_STLP_USE_OLD_HP_ITERATOR_QUERIES) && !defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) +# ifndef _STLP_TYPE_TRAITS_H +# include +# endif +#endif + +_STLP_BEGIN_NAMESPACE + +struct input_iterator_tag {}; +struct output_iterator_tag {}; +struct forward_iterator_tag : public input_iterator_tag {}; +struct bidirectional_iterator_tag : public forward_iterator_tag {}; +struct random_access_iterator_tag : public bidirectional_iterator_tag {}; + +template +struct iterator { + typedef _Category iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; + typedef _Pointer pointer; + typedef _Reference reference; +}; +_STLP_TEMPLATE_NULL +struct iterator { + typedef output_iterator_tag iterator_category; +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; +#endif +}; + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_category(_It) +# define _STLP_DISTANCE_TYPE(_It, _Tp) _STLP_STD::distance_type(_It) +# define _STLP_VALUE_TYPE(_It, _Tp) _STLP_STD::value_type(_It) +//Old HP iterator queries do not give information about the iterator +//associated reference type so we consider that it is not a real reference. +# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type() +#else +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# define _STLP_VALUE_TYPE(_It, _Tp) (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::value_type*)0 +# define _STLP_DISTANCE_TYPE(_It, _Tp) (_STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::difference_type*)0 +# if defined (__BORLANDC__) || defined (__SUNPRO_CC) || ( defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \ + (defined (__sgi) && defined (_COMPILER_VERSION)) || defined (__DMC__) +# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::iterator_traits< _Tp >::iterator_category() +# else +# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::iterator_category() +# endif +# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) _STLP_STD::_IsRefType< _STLP_TYPENAME _STLP_STD::iterator_traits< _Tp >::reference >::_Ret() +# else +# define _STLP_ITERATOR_CATEGORY(_It, _Tp) _STLP_STD::__iterator_category(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret()) +# define _STLP_DISTANCE_TYPE(_It, _Tp) _STLP_STD::__distance_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret()) +# define _STLP_VALUE_TYPE(_It, _Tp) _STLP_STD::__value_type(_It, _STLP_STD::_IsPtrType<_Tp>::_Ret()) +# define _STLP_IS_REF_TYPE_REAL_REF(_It, _Tp) __false_type() +# endif +#endif + +#if defined (_STLP_DONT_REDEFINE_STD) && defined (_STLP_WHOLE_NATIVE_STD) +/* In this mode we will see both STLport implementation and native + * one. To allow some interaction between both implementations through + * iterators we have to map std iterator categories to stlport ones. This + * way we will be able to initialize STLport containers with native + * iterators, the other side won't work except when STLport iterators are + * simple pointers. */ + +_STLP_END_NAMESPACE + +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(iterator) +# endif + +_STLP_BEGIN_NAMESPACE + +template +struct _CategoryMapping +{ typedef _IteCat _Tag; }; + +_STLP_TEMPLATE_NULL +struct _CategoryMapping<::std::input_iterator_tag> +{ typedef input_iterator_tag _Tag; }; +_STLP_TEMPLATE_NULL +struct _CategoryMapping<::std::output_iterator_tag> +{ typedef output_iterator_tag _Tag; }; +_STLP_TEMPLATE_NULL +struct _CategoryMapping<::std::forward_iterator_tag> +{ typedef forward_iterator_tag _Tag; }; +_STLP_TEMPLATE_NULL +struct _CategoryMapping<::std::bidirectional_iterator_tag> +{ typedef bidirectional_iterator_tag _Tag; }; +_STLP_TEMPLATE_NULL +struct _CategoryMapping<::std::random_access_iterator_tag> +{ typedef random_access_iterator_tag _Tag; }; + +template +struct iterator_traits { + typedef typename _Iterator::iterator_category _OriginalTag; + typedef typename _CategoryMapping<_OriginalTag>::_Tag iterator_category; +#else +template +struct iterator_traits { + typedef typename _Iterator::iterator_category iterator_category; +#endif + typedef typename _Iterator::value_type value_type; + typedef typename _Iterator::difference_type difference_type; + typedef typename _Iterator::pointer pointer; + typedef typename _Iterator::reference reference; +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (__SUNPRO_CC) +# define _STLP_DIFFERENCE_TYPE(_Iterator) typename iterator_traits<_Iterator>::difference_type +#else +# define _STLP_DIFFERENCE_TYPE(_Iterator) ptrdiff_t +#endif + +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION + +// fbp : this order keeps gcc happy +template +struct iterator_traits { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; +}; + +template +struct iterator_traits<_Tp*> { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; +}; + +# if defined (__BORLANDC__) +template +struct iterator_traits<_Tp* const> { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; +}; +# endif + +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE +#include +_STLP_BEGIN_NAMESPACE + +#ifndef _STLP_USE_OLD_HP_ITERATOR_QUERIES +// The overloaded functions iterator_category, distance_type, and +// value_type are not part of the C++ standard. (They have been +// replaced by struct iterator_traits.) They are included for +// backward compatibility with the HP STL. +// We introduce internal names for these functions. + +# ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION + +template +inline _STLP_STD::random_access_iterator_tag +__iterator_category(const _Tp*, const __true_type&) +{ return _STLP_STD::random_access_iterator_tag(); } + +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::iterator_category +__iterator_category(const _Iter&, const __false_type&) { + typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::iterator_category _Category; + return _Category(); +} + +template +inline ptrdiff_t* +__distance_type(const _Tp*, const __true_type&) +{ return __STATIC_CAST(ptrdiff_t*, 0); } + +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::difference_type* +__distance_type(const _Iter&, const __false_type&) { + typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::difference_type _diff_type; + return __STATIC_CAST(_diff_type*,0); +} + +template +inline _Tp* +__value_type(const _Tp*, const __true_type&) +{ return __STATIC_CAST(_Tp*, 0); } + +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_STD::iterator_traits<_Iter>::value_type* +__value_type(const _Iter&, const __false_type&) { + typedef _STLP_TYPENAME _STLP_STD::iterator_traits<_Iter>::value_type _value_type; + return __STATIC_CAST(_value_type*,0); +} + +# endif + +#else /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ +template +inline _Category _STLP_CALL iterator_category(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return _Category(); } +template +inline _Tp* _STLP_CALL value_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Tp*, 0); } +template +inline _Distance* _STLP_CALL distance_type(const iterator<_Category,_Tp,_Distance,_Pointer,_Reference>&) { return __STATIC_CAST(_Distance*, 0); } +template +inline random_access_iterator_tag _STLP_CALL iterator_category(const _Tp*) { return random_access_iterator_tag(); } +template +inline _Tp* _STLP_CALL value_type(const _Tp*) { return __STATIC_CAST(_Tp*, 0); } +template +inline ptrdiff_t* _STLP_CALL distance_type(const _Tp*) { return __STATIC_CAST(ptrdiff_t*, 0); } +#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ + +#if !defined (_STLP_NO_ANACHRONISMS) +// The base classes input_iterator, output_iterator, forward_iterator, +// bidirectional_iterator, and random_access_iterator are not part of +// the C++ standard. (They have been replaced by struct iterator.) +// They are included for backward compatibility with the HP STL. +template struct input_iterator : + public iterator {}; +struct output_iterator : public iterator {}; +template struct forward_iterator : + public iterator {}; +template struct bidirectional_iterator : + public iterator {}; +template struct random_access_iterator : + public iterator {}; + +# if defined (_STLP_BASE_MATCH_BUG) && defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +template +inline input_iterator_tag _STLP_CALL +iterator_category(const input_iterator<_Tp, _Distance>&) { return input_iterator_tag(); } +inline output_iterator_tag _STLP_CALL +iterator_category(const output_iterator&) { return output_iterator_tag(); } +template +inline forward_iterator_tag _STLP_CALL +iterator_category(const forward_iterator<_Tp, _Distance>&) { return forward_iterator_tag(); } +template +inline bidirectional_iterator_tag _STLP_CALL +iterator_category(const bidirectional_iterator<_Tp, _Distance>&) { return bidirectional_iterator_tag(); } +template +inline random_access_iterator_tag _STLP_CALL +iterator_category(const random_access_iterator<_Tp, _Distance>&) { return random_access_iterator_tag(); } +template +inline _Tp* _STLP_CALL value_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } +template +inline _Tp* _STLP_CALL value_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } +template +inline _Tp* _STLP_CALL value_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } +template +inline _Tp* _STLP_CALL value_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Tp*, 0); } +template +inline _Distance* _STLP_CALL distance_type(const input_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); } +template +inline _Distance* _STLP_CALL distance_type(const forward_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); } +template +inline _Distance* _STLP_CALL distance_type(const bidirectional_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0);} +template +inline _Distance* _STLP_CALL distance_type(const random_access_iterator<_Tp, _Distance>&) { return __STATIC_CAST(_Distance*, 0); } +# endif +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL +__distance(const _InputIterator& __first, const _InputIterator& __last, + const input_iterator_tag &) { + _STLP_DIFFERENCE_TYPE(_InputIterator) __n = 0; + _InputIterator __it(__first); + while (__it != __last) { + ++__it; ++__n; + } + return __n; +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline _STLP_DIFFERENCE_TYPE(_ForwardIterator) _STLP_CALL +__distance(const _ForwardIterator& __first, const _ForwardIterator& __last, + const forward_iterator_tag &) { + _STLP_DIFFERENCE_TYPE(_ForwardIterator) __n = 0; + _ForwardIterator __it(__first); + while (__it != __last) { + ++__it; ++__n; + } + return __n; +} + +template +_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) _STLP_CALL +__distance(const _BidirectionalIterator& __first, const _BidirectionalIterator& __last, + const bidirectional_iterator_tag &) { + _STLP_DIFFERENCE_TYPE(_BidirectionalIterator) __n = 0; + _BidirectionalIterator __it(__first); + while (__it != __last) { + ++__it; ++__n; + } + return __n; +} +#endif + +template +inline _STLP_DIFFERENCE_TYPE(_RandomAccessIterator) _STLP_CALL +__distance(const _RandomAccessIterator& __first, const _RandomAccessIterator& __last, + const random_access_iterator_tag &) +{ return __last - __first; } + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _STLP_DIFFERENCE_TYPE(_InputIterator) _STLP_CALL +distance(_InputIterator __first, _InputIterator __last) +{ return _STLP_PRIV __distance(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); } + +#if !defined (_STLP_NO_ANACHRONISMS) +template +inline void _STLP_CALL distance(const _InputIterator& __first, + const _InputIterator& __last, _Distance& __n) +{ __n += _STLP_STD::distance(__first, __last); } + +# if defined (_STLP_MSVC) +// MSVC specific +template +inline void _STLP_CALL _Distance(_InputIterator __first, + _InputIterator __last, _Dist& __n) +{ __n += _STLP_STD::distance(__first, __last); } +# endif +#endif + +// fbp: those are being used for iterator/const_iterator definitions everywhere +template +struct _Nonconst_traits; + +template +struct _Const_traits { + typedef _Tp value_type; + typedef const _Tp& reference; + typedef const _Tp* pointer; + typedef _Const_traits<_Tp> _ConstTraits; + typedef _Nonconst_traits<_Tp> _NonConstTraits; +}; + +template +struct _Nonconst_traits { + typedef _Tp value_type; + typedef _Tp& reference; + typedef _Tp* pointer; + typedef _Const_traits<_Tp> _ConstTraits; + typedef _Nonconst_traits<_Tp> _NonConstTraits; +}; + +/* + * dums: A special iterator/const_iterator traits for set and multiset for which even + * the iterator is not mutable + */ +template +struct _Nonconst_Const_traits; + +template +struct _Const_Const_traits { + typedef _Tp value_type; + typedef const _Tp& reference; + typedef const _Tp* pointer; + typedef _Const_Const_traits<_Tp> _ConstTraits; + typedef _Nonconst_Const_traits<_Tp> _NonConstTraits; +}; + +template +struct _Nonconst_Const_traits { + typedef _Tp value_type; + typedef const _Tp& reference; + typedef const _Tp* pointer; + typedef _Const_Const_traits<_Tp> _ConstTraits; + typedef _Nonconst_Const_traits<_Tp> _NonConstTraits; +}; + +/* + * A macro to generate a new iterator traits from one of the + * previous one. Changing the iterator traits type make iterators + * from different containers not comparable. + */ +#define _STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \ +template \ +struct _##Motif; \ +template \ +struct _Const##Motif : public _STLP_STD::_Const_##Traits<_Tp> { \ + typedef _Const##Motif<_Tp> _ConstTraits; \ + typedef _##Motif<_Tp> _NonConstTraits; \ +}; \ +template \ +struct _##Motif : public _STLP_STD::_Nonconst_##Traits<_Tp> { \ + typedef _Const##Motif<_Tp> _ConstTraits; \ + typedef _##Motif<_Tp> _NonConstTraits; \ +}; + +#define _STLP_CREATE_ITERATOR_TRAITS(Motif, Traits) \ +_STLP_MOVE_TO_PRIV_NAMESPACE \ +_STLP_CREATE_ITERATOR_TRAITS_BASE(Motif, Traits) \ +_STLP_MOVE_TO_STD_NAMESPACE + +#define _STLP_CREATE_HASH_ITERATOR_TRAITS(Motif, Traits) \ +_STLP_MOVE_TO_PRIV_NAMESPACE \ +_STLP_CREATE_ITERATOR_TRAITS_BASE(NonLocal##Motif, Traits) \ +_STLP_CREATE_ITERATOR_TRAITS_BASE(Local##Motif, Traits) \ +template \ +struct _##Motif { \ + typedef _ConstNonLocal##Motif<_Tp> _ConstTraits; \ + typedef _NonLocal##Motif<_Tp> _NonConstTraits; \ + typedef _ConstLocal##Motif<_Tp> _ConstLocalTraits; \ + typedef _Local##Motif<_Tp> _NonConstLocalTraits; \ +}; \ +_STLP_MOVE_TO_STD_NAMESPACE + +/* +# if defined (_STLP_BASE_TYPEDEF_BUG) +// this workaround is needed for SunPro 4.0.1 +template +struct __cnst_traits_aux : private _Traits { + typedef typename _Traits::value_type value_type; +}; +# define __TRAITS_VALUE_TYPE(_Traits) __cnst_traits_aux<_Traits>::value_type +# else +# define __TRAITS_VALUE_TYPE(_Traits) _Traits::value_type +# endif +*/ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP void _STLP_CALL +__advance(_InputIter& __i, _Distance __n, const input_iterator_tag &) +{ while (__n--) ++__i; } + +// fbp : added output iterator tag variant +template +_STLP_INLINE_LOOP void _STLP_CALL +__advance(_InputIter& __i, _Distance __n, const output_iterator_tag &) +{ while (__n--) ++__i; } + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +_STLP_INLINE_LOOP void _STLP_CALL +__advance(_ForwardIterator& i, _Distance n, const forward_iterator_tag &) +{ while (n--) ++i; } +#endif + +template +_STLP_INLINE_LOOP void _STLP_CALL +__advance(_BidirectionalIterator& __i, _Distance __n, + const bidirectional_iterator_tag &) { + if (__n > 0) + while (__n--) ++__i; + else + while (__n++) --__i; +} + +template +inline void _STLP_CALL +__advance(_RandomAccessIterator& __i, _Distance __n, + const random_access_iterator_tag &) +{ __i += __n; } + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void _STLP_CALL advance(_InputIterator& __i, _Distance __n) +{ + _STLP_DIFFERENCE_TYPE(_InputIterator) __d = __n; + _STLP_PRIV __advance(__i, __d, _STLP_ITERATOR_CATEGORY(__i, _InputIterator)); +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_ITERATOR_BASE_H */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_iterator_old.h b/sdk/tlibstdcxx/stlport/stl/_iterator_old.h new file mode 100644 index 0000000000..144b9ab388 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_iterator_old.h @@ -0,0 +1,334 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_ITERATOR_OLD_H +#define _STLP_INTERNAL_ITERATOR_OLD_H + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES + +template +inline output_iterator_tag _STLP_CALL +iterator_category(const back_insert_iterator<_Container>&) { return output_iterator_tag(); } +template +inline output_iterator_tag _STLP_CALL +iterator_category(const front_insert_iterator<_Container>&) { return output_iterator_tag(); } +template +inline output_iterator_tag _STLP_CALL +iterator_category(const insert_iterator<_Container>&) { return output_iterator_tag(); } + +#endif + +template +class reverse_bidirectional_iterator { + typedef reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, + Reference__, _Distance> _Self; + // friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& x, const _Self& y); +protected: + _BidirectionalIterator current; +public: + typedef bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; +# if defined (_STLP_MSVC50_COMPATIBILITY) + typedef _Pointer pointer; +# else + typedef _Tp* pointer; +# endif + typedef _Reference reference; + + reverse_bidirectional_iterator() {} + explicit reverse_bidirectional_iterator(_BidirectionalIterator __x) + : current(__x) {} + _BidirectionalIterator base() const { return current; } + _Reference operator*() const { + _BidirectionalIterator __tmp = current; + return *(--__tmp); + } + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + --current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --current; + return __tmp; + } + _Self& operator--() { + ++current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++current; + return __tmp; + } +}; + +#ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES +template +inline bidirectional_iterator_tag _STLP_CALL +iterator_category(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&) +{ return bidirectional_iterator_tag(); } +template +inline _Tp* _STLP_CALL +value_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&) +{ return (_Tp*) 0; } +template +inline _Distance* _STLP_CALL +distance_type(const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, Reference__, _Distance>&) +{ return (_Distance*) 0; } +#endif + +template +inline bool _STLP_CALL operator==( + const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_bidirectional_iterator<_BidirectionalIterator, _Tp, + Reference__, _Distance>& __y) +{ return __x.base() == __y.base(); } + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool _STLP_CALL operator!=( + const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __x, + const reverse_bidirectional_iterator<_BiIter, _Tp, Reference__, _Distance>& __y) +{ return !(__x == __y); } + +#endif + +#if !defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) + +// This is the old version of reverse_iterator, as found in the original +// HP STL. It does not use partial specialization. + +template +class reverse_iterator { + typedef reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance> _Self; +protected: + _RandomAccessIterator __current; +public: + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Distance difference_type; +# if defined (_STLP_MSVC50_COMPATIBILITY) + typedef _Pointer pointer; +# else + typedef _Tp* pointer; +# endif + typedef _Reference reference; + + reverse_iterator() {} + reverse_iterator(const _Self& __x) : __current(__x.base()) {} + explicit reverse_iterator(_RandomAccessIterator __x) : __current(__x) {} + _Self& operator=(const _Self& __x) {__current = __x.base(); return *this; } + + _RandomAccessIterator base() const { return __current; } + _Reference operator*() const { return *(__current - (difference_type)1); } + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + --__current; + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + --__current; + return __tmp; + } + _Self& operator--() { + ++__current; + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + ++__current; + return __tmp; + } + _Self operator+(_Distance __n) const { + return _Self(__current - __n); + } + _Self& operator+=(_Distance __n) { + __current -= __n; + return *this; + } + _Self operator-(_Distance __n) const { + return _Self(__current + __n); + } + _Self& operator-=(_Distance __n) { + __current += __n; + return *this; + } + _Reference operator[](_Distance __n) const { return *(*this + __n); } +}; + +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES +template +inline random_access_iterator_tag _STLP_CALL +iterator_category(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&) +{ return random_access_iterator_tag(); } +template +inline _Tp* _STLP_CALL value_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&) +{ return (_Tp*) 0; } +template +inline _Distance* _STLP_CALL +distance_type(const reverse_iterator<_RandomAccessIterator, _Tp, Reference__, _Distance>&) +{ return (_Distance*) 0; } +# endif + +template +inline bool _STLP_CALL +operator==(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) +{ + return __x.base() == __y.base(); +} + +template +inline bool _STLP_CALL +operator<(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) +{ + return __y.base() < __x.base(); +} + +# ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool _STLP_CALL +operator!=(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) { + return !(__x == __y); +} + +template +inline bool _STLP_CALL +operator>(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) { + return __y < __x; +} + +template +inline bool _STLP_CALL +operator<=(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) { + return !(__y < __x); +} + +template +inline bool _STLP_CALL +operator>=(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) { + return !(__x < __y); +} + +# endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +inline _Distance _STLP_CALL +operator-(const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __y) +{ + return __y.base() - __x.base(); +} + +template +inline reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance> _STLP_CALL +operator+(_Distance __n, + const reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>& __x) +{ + return reverse_iterator<_RandomAccessIterator, _Tp, + Reference__, _Distance>(__x.base() - __n); +} + +#endif /* ! defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_limits.c b/sdk/tlibstdcxx/stlport/stl/_limits.c new file mode 100644 index 0000000000..39380249eb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_limits.c @@ -0,0 +1,405 @@ +/* + * Copyright (c) 1998,1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_LIMITS_C +#define _STLP_LIMITS_C + +#ifndef _STLP_INTERNAL_LIMITS +# include +#endif + +//========================================================== +// numeric_limits static members +//========================================================== + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) + +# define __declare_numeric_base_member(__type, __mem) \ +template \ + const __type _Numeric_limits_base<__number>:: __mem + +__declare_numeric_base_member(bool, is_specialized); +__declare_numeric_base_member(int, digits); +__declare_numeric_base_member(int, digits10); +__declare_numeric_base_member(bool, is_signed); +__declare_numeric_base_member(bool, is_integer); +__declare_numeric_base_member(bool, is_exact); +__declare_numeric_base_member(int, radix); +__declare_numeric_base_member(int, min_exponent); +__declare_numeric_base_member(int, max_exponent); +__declare_numeric_base_member(int, min_exponent10); +__declare_numeric_base_member(int, max_exponent10); +__declare_numeric_base_member(bool, has_infinity); +__declare_numeric_base_member(bool, has_quiet_NaN); +__declare_numeric_base_member(bool, has_signaling_NaN); +__declare_numeric_base_member(float_denorm_style, has_denorm); +__declare_numeric_base_member(bool, has_denorm_loss); +__declare_numeric_base_member(bool, is_iec559); +__declare_numeric_base_member(bool, is_bounded); +__declare_numeric_base_member(bool, is_modulo); +__declare_numeric_base_member(bool, traps); +__declare_numeric_base_member(bool, tinyness_before); +__declare_numeric_base_member(float_round_style, round_style); + +# undef __declare_numeric_base_member + +# define __declare_integer_limits_member(__type, __mem) \ +template \ + const __type _Integer_limits<_Int, __imin, __imax, __idigits, __ismod>:: __mem + +__declare_integer_limits_member(bool, is_specialized); +__declare_integer_limits_member(int, digits); +__declare_integer_limits_member(int, digits10); +__declare_integer_limits_member(bool, is_signed); +__declare_integer_limits_member(bool, is_integer); +__declare_integer_limits_member(bool, is_exact); +__declare_integer_limits_member(int, radix); +__declare_integer_limits_member(bool, is_bounded); +__declare_integer_limits_member(bool, is_modulo); +# undef __declare_integer_limits_member + +# if defined (__GNUC__) && (__GNUC__ != 2 || __GNUC_MINOR__ > 96) && (__GNUC__ != 3 || __GNUC_MINOR__ == 0) && (__GNUC__ <= 3) +_STLP_MOVE_TO_STD_NAMESPACE + +# define __declare_numeric_limits_member(__integer) \ + _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits; \ + _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::digits10; \ + _STLP_TEMPLATE_NULL const int numeric_limits<__integer>::radix; \ + _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_specialized; \ + _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_signed; \ + _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_integer; \ + _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_exact; \ + _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_bounded; \ + _STLP_TEMPLATE_NULL const bool numeric_limits<__integer>::is_modulo + +__declare_numeric_limits_member(_STLP_LONG_LONG); +__declare_numeric_limits_member(unsigned _STLP_LONG_LONG); + +# undef __declare_numeric_limits_member + +_STLP_MOVE_TO_PRIV_NAMESPACE +# endif + +# define __declare_float_limits_member(__type, __mem) \ +template \ +const __type _Floating_limits< __number, __Digits, __Digits10, \ + __MinExp, __MaxExp, __MinExp10, __MaxExp10, \ + __IsIEC559, __DenormStyle, __RoundStyle>::\ + __mem + +__declare_float_limits_member(bool, is_specialized); +__declare_float_limits_member(int, digits); +__declare_float_limits_member(int, digits10); +__declare_float_limits_member(bool, is_signed); +__declare_float_limits_member(int, radix); +__declare_float_limits_member(int, min_exponent); +__declare_float_limits_member(int, max_exponent); +__declare_float_limits_member(int, min_exponent10); +__declare_float_limits_member(int, max_exponent10); +__declare_float_limits_member(bool, has_infinity); +__declare_float_limits_member(bool, has_quiet_NaN); +__declare_float_limits_member(bool, has_signaling_NaN); +__declare_float_limits_member(float_denorm_style, has_denorm); +__declare_float_limits_member(bool, has_denorm_loss); +__declare_float_limits_member(bool, is_iec559); +__declare_float_limits_member(bool, is_bounded); +__declare_float_limits_member(bool, traps); +__declare_float_limits_member(bool, tinyness_before); +__declare_float_limits_member(float_round_style, round_style); +# undef __declare_float_limits_member + +#endif + + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) + +# if defined (__GNUC__) || defined (__BORLANDC__) +# define _STLP_ADDITIONAL_OPEN_BRACKET { +# define _STLP_ADDITIONAL_CLOSE_BRACKET } +# else +# define _STLP_ADDITIONAL_OPEN_BRACKET +# define _STLP_ADDITIONAL_CLOSE_BRACKET +# endif + +/* The following code has been extracted from the boost libraries (www.boost.org) and + * adapted with the STLport portability macros. Advantage on previous technique is that + * computation of infinity and NaN values is only based on big/little endianess, compiler + * float, double or long double representation is taken into account thanks to the sizeof + * operator. */ +template +struct float_helper { + union _WordsNumber { + unsigned short _Words[8]; + _Number _num; + }; + static _Number get_word_higher() _STLP_NOTHROW { + _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET }; + return __tmp._num; + } + static _Number get_word_lower() _STLP_NOTHROW { + _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET }; + __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word; + return __tmp._num; + } + static _Number get_from_last_word() _STLP_NOTHROW { +# if defined (_STLP_BIG_ENDIAN) + return get_word_higher(); +# else /* _STLP_LITTLE_ENDIAN */ + return get_word_lower(); +# endif + } + static _Number get_from_first_word() _STLP_NOTHROW { +# if defined (_STLP_BIG_ENDIAN) + return get_word_lower(); +# else /* _STLP_LITTLE_ENDIAN */ + return get_word_higher(); +# endif + } +}; + +# if !defined (_STLP_NO_LONG_DOUBLE) && !defined (_STLP_BIG_ENDIAN) +template +struct float_helper2 { + union _WordsNumber { + unsigned short _Words[8]; + _Number _num; + }; + //static _Number get_word_higher() _STLP_NOTHROW { + // _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET _Word1, _Word2, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET }; + // return __tmp._num; + //} + static _Number get_word_lower() _STLP_NOTHROW { + _WordsNumber __tmp = { _STLP_ADDITIONAL_OPEN_BRACKET 0, 0, 0, 0, 0, 0, 0, 0 _STLP_ADDITIONAL_CLOSE_BRACKET }; + __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 2] = _Word1; + __tmp._Words[(sizeof(_Number) >= 12 ? 10 : sizeof(_Number)) / sizeof(unsigned short) - 1] = _Word2; + return __tmp._num; + } + static _Number get_from_last_word() _STLP_NOTHROW { +//# if defined (_STLP_BIG_ENDIAN) +// return get_word_higher(); +//# else /* _STLP_LITTLE_ENDIAN */ + return get_word_lower(); +//# endif + } +}; +# endif + +/* Former values kept in case moving to boost code has introduce a regression on + * some platform. */ +#if 0 +# if defined (_STLP_BIG_ENDIAN) +# if defined (__OS400__) +# define _STLP_FLOAT_INF_REP { 0x7f80, 0 } +# define _STLP_FLOAT_QNAN_REP { 0xffc0, 0 } +# define _STLP_FLOAT_SNAN_REP { 0xff80, 0 } +# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 } +# define _STLP_DOUBLE_QNAN_REP { 0xfff8, 0, 0, 0 } +# define _STLP_DOUBLE_SNAN_REP { 0xfff0, 0, 0, 0 } +# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 } +# define _STLP_LDOUBLE_QNAN_REP { 0xfff8, 0, 0, 0, 0, 0, 0, 0 } +# define _STLP_LDOUBLE_SNAN_REP { 0xfff0, 0, 0, 0, 0, 0, 0, 0 } +# else /* __OS400__ */ +# define _STLP_FLOAT_INF_REP { 0x7f80, 0 } +# define _STLP_FLOAT_QNAN_REP { 0x7fc1, 0 } +# define _STLP_FLOAT_SNAN_REP { 0x7f81, 0 } +# define _STLP_DOUBLE_INF_REP { 0x7ff0, 0, 0, 0 } +# define _STLP_DOUBLE_QNAN_REP { 0x7ff9, 0, 0, 0 } +# define _STLP_DOUBLE_SNAN_REP { 0x7ff1, 0, 0, 0 } +# define _STLP_LDOUBLE_INF_REP { 0x7ff0, 0, 0, 0, 0, 0, 0, 0 } +# define _STLP_LDOUBLE_QNAN_REP { 0x7ff1, 0, 0, 0, 0, 0, 0, 0 } +# define _STLP_LDOUBLE_SNAN_REP { 0x7ff9, 0, 0, 0, 0, 0, 0, 0 } +# endif /* __OS400__ */ +# else /* _STLP_LITTLE_ENDIAN */ +# if defined(__DECCXX) +# define _STLP_FLOAT_INF_REP { 0, 0x7f80 } +# define _STLP_FLOAT_QNAN_REP { 0, 0xffc0 } +# define _STLP_FLOAT_SNAN_REP { 0x5555, 0x7f85 } +# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 } +# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0xfff8 } +# define _STLP_DOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x7ff5 } +# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0, 0, 0, 0, 0x7fff } +# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0, 0, 0, 0x8000, 0xffff } +# define _STLP_LDOUBLE_SNAN_REP { 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x7fff} +# else +# define _STLP_FLOAT_INF_REP { 0, 0x7f80 } +# define _STLP_FLOAT_QNAN_REP { 0, 0x7fc0 } +# define _STLP_FLOAT_SNAN_REP { 0, 0x7fa0 } +# define _STLP_DOUBLE_INF_REP { 0, 0, 0, 0x7ff0 } +# define _STLP_DOUBLE_QNAN_REP { 0, 0, 0, 0x7ff8 } +# define _STLP_DOUBLE_SNAN_REP { 0, 0, 0, 0x7ff4 } +# if defined (_STLP_MSVC) || defined (__ICL) +# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x7FF0, 0 } +# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xFFF8, 0 } +# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xFFF8, 0 } +# elif defined (__BORLANDC__) +# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff } +# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xc000, 0x7fff } +# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xa000, 0x7fff } +# else +# define _STLP_LDOUBLE_INF_REP { 0, 0, 0, 0x8000, 0x7fff, 0 } +# define _STLP_LDOUBLE_QNAN_REP { 0, 0, 0, 0xa000, 0x7fff, 0 } +# define _STLP_LDOUBLE_SNAN_REP { 0, 0, 0, 0xc000, 0x7fff, 0 } +# endif +# endif +# endif + +union _F_rep { + unsigned short rep[2]; + float val; +}; +union _D_rep { + unsigned short rep[4]; + double val; +}; + +# ifndef _STLP_NO_LONG_DOUBLE +union _LD_rep { + unsigned short rep[8]; + long double val; +}; +# endif +#endif + +template +float _STLP_CALL _LimG<__dummy>::get_F_inf() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_last_word(); +} +template +float _STLP_CALL _LimG<__dummy>::get_F_qNaN() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_last_word(); +} +template +float _STLP_CALL _LimG<__dummy>::get_F_sNaN() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_last_word(); +} +template +float _STLP_CALL _LimG<__dummy>::get_F_denormMin() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_first_word(); +} + +template +class _NumericLimitsAccess; + +_STLP_TEMPLATE_NULL +class _NumericLimitsAccess<1> { +public: + static double get_inf() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_last_word(); + } + static double get_qNaN() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_last_word(); + } + static double get_sNaN() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_last_word(); + } +}; + +template +double _STLP_CALL _LimG<__dummy>::get_D_inf() +{ return _NumericLimitsAccess<1>::get_inf(); } +template +double _STLP_CALL _LimG<__dummy>::get_D_qNaN() +{ return _NumericLimitsAccess<1>::get_qNaN(); } +template +double _STLP_CALL _LimG<__dummy>::get_D_sNaN() +{ return _NumericLimitsAccess<1>::get_sNaN(); } +template +double _STLP_CALL _LimG<__dummy>::get_D_denormMin() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_first_word(); +} + +# if !defined (_STLP_NO_LONG_DOUBLE) +_STLP_TEMPLATE_NULL +class _NumericLimitsAccess<0> { +public: + static long double get_inf() { +# if defined (_STLP_BIG_ENDIAN) + typedef float_helper _FloatHelper; +# else + typedef float_helper2 _FloatHelper; +# endif + return _FloatHelper::get_from_last_word(); + } + static long double get_qNaN() { +# if defined (_STLP_BIG_ENDIAN) + typedef float_helper _FloatHelper; +# else + typedef float_helper2 _FloatHelper; +# endif + return _FloatHelper::get_from_last_word(); + } + static long double get_sNaN() { +# if defined (_STLP_BIG_ENDIAN) + typedef float_helper _FloatHelper; +# else + typedef float_helper2 _FloatHelper; +# endif + return _FloatHelper::get_from_last_word(); + } +}; + +template +long double _STLP_CALL _LimG<__dummy>::get_LD_inf() { + const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0; + return _NumericLimitsAccess<__use_double_limits>::get_inf(); +} +template +long double _STLP_CALL _LimG<__dummy>::get_LD_qNaN() { + const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0; + return _NumericLimitsAccess<__use_double_limits>::get_qNaN(); +} +template +long double _STLP_CALL _LimG<__dummy>::get_LD_sNaN() { + const int __use_double_limits = sizeof(double) == sizeof(long double) ? 1 : 0; + return _NumericLimitsAccess<__use_double_limits>::get_sNaN(); +} +template +long double _STLP_CALL _LimG<__dummy>::get_LD_denormMin() { + typedef float_helper _FloatHelper; + return _FloatHelper::get_from_first_word(); +} +# endif + +#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ + +#undef _STLP_LIMITS_MIN_TYPE +#undef _STLP_LIMITS_MAX_TYPE + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_LIMITS_C_INCLUDED */ diff --git a/sdk/tlibstdcxx/stlport/stl/_limits.h b/sdk/tlibstdcxx/stlport/stl/_limits.h new file mode 100644 index 0000000000..f5f840c984 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_limits.h @@ -0,0 +1,519 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This may be not portable code. Parts of numeric_limits<> are + * inherently machine-dependent. At present this file is suitable + * for the MIPS, SPARC, Alpha and ia32 architectures. + */ + +#ifndef _STLP_INTERNAL_LIMITS +#define _STLP_INTERNAL_LIMITS + +#ifndef _STLP_CLIMITS +# include +#endif + +#ifndef _STLP_CFLOAT +# include +#endif + +#if defined (_STLP_HAS_WCHAR_T) && !defined (_STLP_INTERNAL_CWCHAR) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +enum float_round_style { + round_indeterminate = -1, + round_toward_zero = 0, + round_to_nearest = 1, + round_toward_infinity = 2, + round_toward_neg_infinity = 3 +}; + +enum float_denorm_style { + denorm_indeterminate = -1, + denorm_absent = 0, + denorm_present = 1 +}; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Base class for all specializations of numeric_limits. +template +class _Numeric_limits_base { +public: + + static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); } + static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); } + + _STLP_STATIC_CONSTANT(int, digits = 0); + _STLP_STATIC_CONSTANT(int, digits10 = 0); + _STLP_STATIC_CONSTANT(int, radix = 0); + _STLP_STATIC_CONSTANT(int, min_exponent = 0); + _STLP_STATIC_CONSTANT(int, min_exponent10 = 0); + _STLP_STATIC_CONSTANT(int, max_exponent = 0); + _STLP_STATIC_CONSTANT(int, max_exponent10 = 0); + + _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = denorm_absent); + _STLP_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); + + _STLP_STATIC_CONSTANT(bool, is_specialized = false); + _STLP_STATIC_CONSTANT(bool, is_signed = false); + _STLP_STATIC_CONSTANT(bool, is_integer = false); + _STLP_STATIC_CONSTANT(bool, is_exact = false); + _STLP_STATIC_CONSTANT(bool, has_infinity = false); + _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false); + _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false); + _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false); + _STLP_STATIC_CONSTANT(bool, is_iec559 = false); + _STLP_STATIC_CONSTANT(bool, is_bounded = false); + _STLP_STATIC_CONSTANT(bool, is_modulo = false); + _STLP_STATIC_CONSTANT(bool, traps = false); + _STLP_STATIC_CONSTANT(bool, tinyness_before = false); + + static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); } + static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); } + + static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); } + static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); } + static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); } + static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); } +}; + +// Base class for integers. + +#ifdef _STLP_LIMITED_DEFAULT_TEMPLATES +# ifdef _STLP_LONG_LONG +# define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG +# define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG +# else +# define _STLP_LIMITS_MIN_TYPE long +# define _STLP_LIMITS_MAX_TYPE unsigned long +# endif +#else +# define _STLP_LIMITS_MIN_TYPE _Int +# define _STLP_LIMITS_MAX_TYPE _Int +#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ + +template +class _Integer_limits : public _Numeric_limits_base<_Int> { +public: + + static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; } + static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; } + + _STLP_STATIC_CONSTANT(int, digits = (__idigits < 0) ? ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1)) : (__idigits)); + _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000); + _STLP_STATIC_CONSTANT(int, radix = 2); + _STLP_STATIC_CONSTANT(bool, is_specialized = true); + _STLP_STATIC_CONSTANT(bool, is_signed = (__imin != 0)); + _STLP_STATIC_CONSTANT(bool, is_integer = true); + _STLP_STATIC_CONSTANT(bool, is_exact = true); + _STLP_STATIC_CONSTANT(bool, is_bounded = true); + _STLP_STATIC_CONSTANT(bool, is_modulo = __ismod); +}; + +// Base class for floating-point numbers. +template +class _Floating_limits : public _Numeric_limits_base<__number> { +public: + + _STLP_STATIC_CONSTANT(int, digits = __Digits); + _STLP_STATIC_CONSTANT(int, digits10 = __Digits10); + _STLP_STATIC_CONSTANT(int, radix = FLT_RADIX); + _STLP_STATIC_CONSTANT(int, min_exponent = __MinExp); + _STLP_STATIC_CONSTANT(int, max_exponent = __MaxExp); + _STLP_STATIC_CONSTANT(int, min_exponent10 = __MinExp10); + _STLP_STATIC_CONSTANT(int, max_exponent10 = __MaxExp10); + + _STLP_STATIC_CONSTANT(float_denorm_style, has_denorm = __DenormStyle); + _STLP_STATIC_CONSTANT(float_round_style, round_style = __RoundStyle); + + _STLP_STATIC_CONSTANT(bool, is_specialized = true); + _STLP_STATIC_CONSTANT(bool, is_signed = true); + + _STLP_STATIC_CONSTANT(bool, has_infinity = true); +#if (!defined (_STLP_MSVC) || (_STLP_MSVC > 1300)) && \ + (!defined (__BORLANDC__) || (__BORLANDC__ >= 0x590)) && \ + (!defined (_CRAY) || defined (_CRAYIEEE)) + _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = true); + _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = true); +#else + _STLP_STATIC_CONSTANT(bool, has_quiet_NaN = false); + _STLP_STATIC_CONSTANT(bool, has_signaling_NaN = false); +#endif + + _STLP_STATIC_CONSTANT(bool, is_iec559 = __IsIEC559 && has_infinity && has_quiet_NaN && has_signaling_NaN && (has_denorm == denorm_present)); + _STLP_STATIC_CONSTANT(bool, has_denorm_loss = false); + _STLP_STATIC_CONSTANT(bool, is_bounded = true); + _STLP_STATIC_CONSTANT(bool, traps = true); + _STLP_STATIC_CONSTANT(bool, tinyness_before = false); +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +// Class numeric_limits + +// The unspecialized class. + +template +class numeric_limits : public _STLP_PRIV _Numeric_limits_base<_Tp> {}; + +// Specializations for all built-in integral types. + +#if !defined (_STLP_NO_BOOL) +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; +#endif /* _STLP_NO_BOOL */ + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +#if !defined (_STLP_NO_SIGNED_BUILTINS) +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; +#endif + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +#if !(defined (_STLP_NO_WCHAR_T) || (!defined (_STLP_SGX_CONFIG) && defined (_STLP_WCHAR_T_IS_USHORT))) + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +#endif + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +#if defined (__xlC__) && (__xlC__ == 0x500) +# undef INT_MIN +# define INT_MIN -2147483648 +#endif + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; + +#if defined (_STLP_LONG_LONG) + +# if defined (_STLP_MSVC) || defined (__BORLANDC__) +# define LONGLONG_MAX 0x7fffffffffffffffi64 +# define LONGLONG_MIN (-LONGLONG_MAX-1i64) +# define ULONGLONG_MAX 0xffffffffffffffffUi64 +# else +# ifndef LONGLONG_MAX +# define LONGLONG_MAX 0x7fffffffffffffffLL +# endif +# ifndef LONGLONG_MIN +# define LONGLONG_MIN (-LONGLONG_MAX-1LL) +# endif +# ifndef ULONGLONG_MAX +# define ULONGLONG_MAX 0xffffffffffffffffULL +# endif +# endif + +# if !defined (__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 3) + +_STLP_TEMPLATE_NULL +class numeric_limits<_STLP_LONG_LONG> + : public _STLP_PRIV _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true> +{}; + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Integer_limits +{}; +# else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */ +/* + newest gcc has new mangling scheme, that has problem + with generating name [instantiated] of template specialization like + _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true> + ~~~~~~~~~~~~ ~~~~~~~~~~~~ + Below is code that solve this problem. + - ptr + */ +_STLP_TEMPLATE_NULL +class numeric_limits<_STLP_LONG_LONG> + : public _STLP_PRIV _Numeric_limits_base<_STLP_LONG_LONG> { +public: + + static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; } + static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; } + + _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1)); + _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000); + _STLP_STATIC_CONSTANT(int, radix = 2); + _STLP_STATIC_CONSTANT(bool, is_specialized = true); + _STLP_STATIC_CONSTANT(bool, is_signed = true); + _STLP_STATIC_CONSTANT(bool, is_integer = true); + _STLP_STATIC_CONSTANT(bool, is_exact = true); + _STLP_STATIC_CONSTANT(bool, is_bounded = true); + _STLP_STATIC_CONSTANT(bool, is_modulo = true); +}; + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Numeric_limits_base { +public: + + static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; } + static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; } + + _STLP_STATIC_CONSTANT(int, digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT))))); + _STLP_STATIC_CONSTANT(int, digits10 = (digits * 301UL) / 1000); + _STLP_STATIC_CONSTANT(int, radix = 2); + _STLP_STATIC_CONSTANT(bool, is_specialized = true); + _STLP_STATIC_CONSTANT(bool, is_signed = false); + _STLP_STATIC_CONSTANT(bool, is_integer = true); + _STLP_STATIC_CONSTANT(bool, is_exact = true); + _STLP_STATIC_CONSTANT(bool, is_bounded = true); + _STLP_STATIC_CONSTANT(bool, is_modulo = true); +}; + +# endif /* __GNUC__ > 2000-11-01 */ + +#endif /* _STLP_LONG_LONG */ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Specializations for all built-in floating-point types. +template +class _LimG { +public: + static float _STLP_CALL get_F_inf(); + static float _STLP_CALL get_F_qNaN(); + static float _STLP_CALL get_F_sNaN(); + static float _STLP_CALL get_F_denormMin(); + static double _STLP_CALL get_D_inf(); + static double _STLP_CALL get_D_qNaN(); + static double _STLP_CALL get_D_sNaN(); + static double _STLP_CALL get_D_denormMin(); + +#if !defined (_STLP_NO_LONG_DOUBLE) + static long double _STLP_CALL get_LD_inf(); + static long double _STLP_CALL get_LD_qNaN(); + static long double _STLP_CALL get_LD_sNaN(); + static long double _STLP_CALL get_LD_denormMin(); +#endif +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _LimG; +#endif + +#if defined (__GNUC__) +# if defined (__FLT_DENORM_MIN__) +# define _STLP_FLT_DENORM_MIN __FLT_DENORM_MIN__ +# else +# define _STLP_FLT_DENORM_STYLE denorm_absent +# endif +# if defined (__DBL_DENORM_MIN__) +# define _STLP_DBL_DENORM_MIN __DBL_DENORM_MIN__ +# else +# define _STLP_DBL_DENORM_STYLE denorm_absent +# endif +# if defined (__LDBL_DENORM_MIN__) +# define _STLP_LDBL_DENORM_MIN __LDBL_DENORM_MIN__ +# else +# define _STLP_LDBL_DENORM_STYLE denorm_absent +# endif +#endif + +/* If compiler do not expose thanks to some macro its status regarding + * denormalized floating point numbers, we consider that denormalization + * is present. Unit tests will tell us if compiler do not support them. */ +#if !defined (_STLP_FLT_DENORM_STYLE) +# define _STLP_FLT_DENORM_STYLE denorm_present +#endif + +#if !defined (_STLP_DBL_DENORM_STYLE) +# define _STLP_DBL_DENORM_STYLE denorm_present +#endif + +#if !defined (_STLP_LDBL_DENORM_STYLE) +# define _STLP_LDBL_DENORM_STYLE denorm_present +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Floating_limits { +public: + static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; } + static float _STLP_CALL denorm_min() _STLP_NOTHROW +#if defined (_STLP_FLT_DENORM_MIN) + { return _STLP_FLT_DENORM_MIN; } +#else + { return _STLP_FLT_DENORM_STYLE ? _STLP_PRIV _LimG::get_F_denormMin() : FLT_MIN; } +#endif + static float (_STLP_CALL max) () _STLP_NOTHROW { return FLT_MAX; } + static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; } + static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps. + static float _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_F_inf(); } + static float _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_F_qNaN(); } + static float _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_F_sNaN(); } +}; + +#undef _STLP_FLT_DENORM_MIN +#undef _STLP_FLT_DNORM_STYLE + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Floating_limits { +public: + static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; } + static double _STLP_CALL denorm_min() _STLP_NOTHROW +#if defined (_STLP_DBL_DENORM_MIN) + { return _STLP_DBL_DENORM_MIN; } +#else + { return _STLP_DBL_DENORM_STYLE ? _STLP_PRIV _LimG::get_D_denormMin() : DBL_MIN; } +#endif + static double (_STLP_CALL max)() _STLP_NOTHROW { return DBL_MAX; } + static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; } + static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps. + static double _STLP_CALL infinity() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_D_inf(); } + static double _STLP_CALL quiet_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_D_qNaN(); } + static double _STLP_CALL signaling_NaN() _STLP_NOTHROW { return _STLP_PRIV _LimG::get_D_sNaN(); } +}; + +#if !defined (_STLP_NO_LONG_DOUBLE) + +_STLP_TEMPLATE_NULL +class numeric_limits + : public _STLP_PRIV _Floating_limits { +public: + static long double (_STLP_CALL min) () _STLP_NOTHROW { return LDBL_MIN; } + static long double _STLP_CALL denorm_min() _STLP_NOTHROW +#if defined (_STLP_LDBL_DENORM_MIN) + { return _STLP_LDBL_DENORM_MIN; } +#else + { return _STLP_LDBL_DENORM_STYLE ? _STLP_PRIV _LimG::get_LD_denormMin() : LDBL_MIN; } +#endif + _STLP_STATIC_CONSTANT(bool, is_iec559 = false); + static long double (_STLP_CALL max) () _STLP_NOTHROW { return LDBL_MAX; } + static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; } + static long double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5l; } + static long double _STLP_CALL infinity() _STLP_NOTHROW + //For MSVC, long double is nothing more than an alias for double. +#if !defined (_STLP_MSVC) + { return _STLP_PRIV _LimG::get_LD_inf(); } +#else + { return _STLP_PRIV _LimG::get_D_inf(); } +#endif + static long double _STLP_CALL quiet_NaN() _STLP_NOTHROW +#if !defined (_STLP_MSVC) + { return _STLP_PRIV _LimG::get_LD_qNaN(); } +#else + { return _STLP_PRIV _LimG::get_D_qNaN(); } +#endif + static long double _STLP_CALL signaling_NaN() _STLP_NOTHROW +#if !defined (_STLP_MSVC) + { return _STLP_PRIV _LimG::get_LD_sNaN(); } +#else + { return _STLP_PRIV _LimG::get_D_sNaN(); } +#endif +}; + +#endif + +// We write special values (Inf and NaN) as bit patterns and +// cast the the appropriate floating-point types. +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_list.c b/sdk/tlibstdcxx/stlport/stl/_list.c new file mode 100644 index 0000000000..86e420b72d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_list.c @@ -0,0 +1,250 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_LIST_C +#define _STLP_LIST_C + +#ifndef _STLP_INTERNAL_LIST_H +# include +#endif + +#ifndef _STLP_CARRAY_H +# include +#endif + +#ifndef _STLP_RANGE_ERRORS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) +template +void _STLP_CALL +_List_global<_Dummy>::_Transfer(_List_node_base* __position, + _List_node_base* __first, _List_node_base* __last) { + if (__position != __last) { + // Remove [first, last) from its old position. + __last->_M_prev->_M_next = __position; + __first->_M_prev->_M_next = __last; + __position->_M_prev->_M_next = __first; + + // Splice [first, last) into its new position. + _Node_base* __tmp = __position->_M_prev; + __position->_M_prev = __last->_M_prev; + __last->_M_prev = __first->_M_prev; + __first->_M_prev = __tmp; + } +} +#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ + +template +void _List_base<_Tp,_Alloc>::clear() { + _Node* __cur = __STATIC_CAST(_Node*, _M_node._M_data._M_next); + while ( +#if defined (__BORLANDC__) // runtime error + __cur && +#endif + __cur != &(_M_node._M_data)) { + _Node* __tmp = __cur; + __cur = __STATIC_CAST(_Node*, __cur->_M_next); + _STLP_STD::_Destroy(&__tmp->_M_data); + this->_M_node.deallocate(__tmp, 1); + } + _M_node._M_data._M_next = &_M_node._M_data; + _M_node._M_data._M_prev = &_M_node._M_data; +} + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# define size_type size_t +#endif + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define list _STLP_PTR_IMPL_NAME(list) +#elif defined (_STLP_DEBUG) +# define list _STLP_NON_DBG_NAME(list) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template +void list<_Tp, _Alloc>::resize(size_type __new_size, const _Tp& __x) { + iterator __i = begin(); + size_type __len = 0; + for ( ; __i != end() && __len < __new_size; ++__i, ++__len); + + if (__len == __new_size) + erase(__i, end()); + else // __i == end() + insert(end(), __new_size - __len, __x); +} + +template +list<_Tp, _Alloc>& list<_Tp, _Alloc>::operator=(const list<_Tp, _Alloc>& __x) { + if (this != &__x) { + iterator __first1 = begin(); + iterator __last1 = end(); + const_iterator __first2 = __x.begin(); + const_iterator __last2 = __x.end(); + while (__first1 != __last1 && __first2 != __last2) + *__first1++ = *__first2++; + if (__first2 == __last2) + erase(__first1, __last1); + else + insert(__last1, __first2, __last2); + } + return *this; +} + +template +void list<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { + iterator __i = begin(); + for ( ; __i != end() && __n > 0; ++__i, --__n) + *__i = __val; + if (__n > 0) + insert(end(), __n, __val); + else + erase(__i, end()); +} + +#if !defined (list) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template +void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred) { + typedef typename list<_Tp, _Alloc>::iterator _Literator; + _Literator __first = __that.begin(); + _Literator __last = __that.end(); + while (__first != __last) { + _Literator __next = __first; + ++__next; + if (__pred(*__first)) __that.erase(__first); + __first = __next; + } +} + +template +void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred) { + typedef typename list<_Tp, _Alloc>::iterator _Literator; + _Literator __first = __that.begin(); + _Literator __last = __that.end(); + if (__first == __last) return; + _Literator __next = __first; + while (++__next != __last) { + if (__binary_pred(*__first, *__next)) + __that.erase(__next); + else + __first = __next; + __next = __first; + } +} + +template +void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x, + _StrictWeakOrdering __comp) { + typedef typename list<_Tp, _Alloc>::iterator _Literator; + _Literator __first1 = __that.begin(); + _Literator __last1 = __that.end(); + _Literator __first2 = __x.begin(); + _Literator __last2 = __x.end(); + if (__that.get_allocator() == __x.get_allocator()) { + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first2, *__first1)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + _Literator __next = __first2; + _List_global_inst::_Transfer(__first1._M_node, __first2._M_node, (++__next)._M_node); + __first2 = __next; + } + else + ++__first1; + } + if (__first2 != __last2) + _List_global_inst::_Transfer(__last1._M_node, __first2._M_node, __last2._M_node); + } + else { + while (__first1 != __last1 && __first2 != __last2) { + if (__comp(*__first2, *__first1)) { + _STLP_VERBOSE_ASSERT(!__comp(*__first1, *__first2), _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __first1 = __that.insert(__first1, *__first2); + } + else + ++__first1; + } + if (__first2 != __last2) { + __that.insert(__first1, __first2, __last2); + } + __x.clear(); + } +} + +template +void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) { + // Do nothing if the list has length 0 or 1. + if (__that._M_node._M_data._M_next == &__that._M_node._M_data || + __that._M_node._M_data._M_next->_M_next == &__that._M_node._M_data) + return; + + list<_Tp, _Alloc> __carry(__that.get_allocator()); + const int NB = 64; + _STLP_PRIV _CArray, NB> __counter(__carry); + int __fill = 0; + while (!__that.empty()) { + __carry.splice(__carry.begin(), __that, __that.begin()); + int __i = 0; + while (__i < __fill && !__counter[__i].empty()) { + _S_merge(__counter[__i], __carry, __comp); + __carry.swap(__counter[__i++]); + } + __carry.swap(__counter[__i]); + if (__i == __fill) { + ++__fill; + if (__fill >= NB) { + //Looks like the list has too many elements to be sorted with this algorithm: + __stl_throw_overflow_error("list::sort"); + } + } + } + + for (int __i = 1; __i < __fill; ++__i) + _S_merge(__counter[__i], __counter[__i - 1], __comp); + __that.swap(__counter[__fill - 1]); +} + +#if defined (list) +# undef list +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_LIST_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_list.h b/sdk/tlibstdcxx/stlport/stl/_list.h new file mode 100644 index 0000000000..6cd3f2b1a1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_list.h @@ -0,0 +1,742 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_LIST_IMPL_H +#define _STLP_INTERNAL_LIST_IMPL_H + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +struct _List_node_base { + _List_node_base* _M_next; + _List_node_base* _M_prev; +}; + +template +class _List_global { +public: + typedef _List_node_base _Node_base; + static void _STLP_CALL _Transfer(_Node_base* __pos, + _Node_base* __first, _Node_base* __last); +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _List_global; +#endif +typedef _List_global _List_global_inst; + +template +class _List_node : public _List_node_base { +public: + _Tp _M_data; + __TRIVIAL_STUFF(_List_node) +}; + +struct _List_iterator_base { + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef bidirectional_iterator_tag iterator_category; + + _List_node_base* _M_node; + + _List_iterator_base(_List_node_base* __x) : _M_node(__x) {} + + void _M_incr() { _M_node = _M_node->_M_next; } + void _M_decr() { _M_node = _M_node->_M_prev; } +}; + + +template +struct _List_iterator : public _List_iterator_base { + typedef _Tp value_type; + typedef typename _Traits::pointer pointer; + typedef typename _Traits::reference reference; + + typedef _List_iterator<_Tp, _Traits> _Self; + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef _List_iterator<_Tp, _NonConstTraits> iterator; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef _List_iterator<_Tp, _ConstTraits> const_iterator; + + typedef bidirectional_iterator_tag iterator_category; + typedef _List_node<_Tp> _Node; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + explicit _List_iterator(_List_node_base* __x) : _List_iterator_base(__x) {} + _List_iterator() : _List_iterator_base(0) {} + //copy constructor for iterator and constructor from iterator for const_iterator + _List_iterator(const iterator& __x) : _List_iterator_base(__x._M_node) {} + + reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; } + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + this->_M_incr(); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + this->_M_incr(); + return __tmp; + } + _Self& operator--() { + this->_M_decr(); + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + this->_M_decr(); + return __tmp; + } + bool operator==(const_iterator __y ) const { + return this->_M_node == __y._M_node; + } + bool operator!=(const_iterator __y ) const { + return this->_M_node != __y._M_node; + } +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +_STLP_MOVE_TO_STD_NAMESPACE +template +struct __type_traits<_STLP_PRIV _List_iterator<_Tp, _Traits> > { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +_STLP_MOVE_TO_STD_NAMESPACE +template +inline _Tp* value_type(const _STLP_PRIV _List_iterator<_Tp, _Traits>&) { return 0; } +inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _List_iterator_base&) { return bidirectional_iterator_tag();} +inline ptrdiff_t* distance_type(const _STLP_PRIV _List_iterator_base&) { return 0; } +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +// Base class that encapsulates details of allocators and helps +// to simplify EH + +template +class _List_base { +protected: + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef _List_node_base _Node_base; + typedef _List_node<_Tp> _Node; + typedef _List_base<_Tp, _Alloc> _Self; + typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _Node_allocator_type; +public: + typedef _STLP_alloc_proxy<_Node_base, _Node, _Node_allocator_type> _AllocProxy; + typedef _Alloc allocator_type; + + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR((const _Node_allocator_type&)_M_node, _Tp); } + + _List_base(const allocator_type& __a) : _M_node(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base()) + { _M_empty_initialize(); } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _List_base(__move_source<_Self> src) : + _M_node(__move_source<_AllocProxy>(src.get()._M_node)) { + if (src.get().empty()) + //We force this to empty. + _M_empty_initialize(); + else { + src.get()._M_empty_initialize(); + _M_node._M_data._M_prev->_M_next = _M_node._M_data._M_next->_M_prev = &_M_node._M_data; + } + } +#endif + + ~_List_base() + { clear(); } + + void clear(); + bool empty() const { return _M_node._M_data._M_next == &_M_node._M_data; } + + void _M_empty_initialize() { + _M_node._M_data._M_next = &_M_node._M_data; + _M_node._M_data._M_prev = _M_node._M_data._M_next; + } + +public: + _AllocProxy _M_node; +}; + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define list _STLP_PTR_IMPL_NAME(list) +#elif defined (_STLP_DEBUG) +# define list _STLP_NON_DBG_NAME(list) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template ) > +class list; + +#if !defined (list) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +// helper functions to reduce code duplication +template +void _S_remove_if(list<_Tp, _Alloc>& __that, _Predicate __pred); + +template +void _S_unique(list<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred); + +template +void _S_merge(list<_Tp, _Alloc>& __that, list<_Tp, _Alloc>& __x, + _StrictWeakOrdering __comp); + +template +void _S_sort(list<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp); + +#if !defined (list) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template +class list : public _STLP_PRIV _List_base<_Tp, _Alloc> +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list) + , public __stlport_class > +#endif +{ + typedef _STLP_PRIV _List_base<_Tp, _Alloc> _Base; + typedef list<_Tp, _Alloc> _Self; + typedef _STLP_PRIV _List_node<_Tp> _Node; + typedef _STLP_PRIV _List_node_base _Node_base; +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef typename _Base::allocator_type allocator_type; + typedef bidirectional_iterator_tag _Iterator_category; + +public: + typedef _STLP_PRIV _List_iterator<_Tp, _Nonconst_traits<_Tp> > iterator; + typedef _STLP_PRIV _List_iterator<_Tp, _Const_traits<_Tp> > const_iterator; + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; + +protected: +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + _Node_base* _M_create_node(const_reference __x = value_type()) { +#else + _Node_base* _M_create_node(const_reference __x) { +#endif + _Node* __p = this->_M_node.allocate(1); + _STLP_TRY { + _Copy_Construct(&__p->_M_data, __x); + } + _STLP_UNWIND(this->_M_node.deallocate(__p, 1)) + return __p; + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + _Node_base* _M_create_node() { + _Node* __p = this->_M_node.allocate(1); + _STLP_TRY { + _STLP_STD::_Construct(&__p->_M_data); + } + _STLP_UNWIND(this->_M_node.deallocate(__p, 1)) + return __p; + } +#endif + +public: +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit list(size_type __n, const_reference __val = _STLP_DEFAULT_CONSTRUCTED(value_type), + const allocator_type& __a = allocator_type()) +#else + explicit list(size_type __n) + : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) + { this->insert(begin(), __n, _STLP_DEFAULT_CONSTRUCTED(value_type)); } + list(size_type __n, const_reference __val) + : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) + { this->insert(begin(), __n, __val); } + list(size_type __n, const_reference __val, const allocator_type& __a) +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) + { this->insert(begin(), __n, __val); } + +#if defined (_STLP_MEMBER_TEMPLATES) + // We don't need any dispatching tricks here, because insert does all of + // that anyway. + template + list(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) + { _M_insert(begin(), __first, __last); } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + list(_InputIterator __first, _InputIterator __last) + : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) + { _M_insert(begin(), __first, __last); } +# endif +#else /* _STLP_MEMBER_TEMPLATES */ + list(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) + { _M_insert(begin(), __first, __last); } + list(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) + { _M_insert(begin(), __first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit list(const allocator_type& __a = allocator_type()) +#else + list() + : _STLP_PRIV _List_base<_Tp, _Alloc>(allocator_type()) {} + list(const allocator_type& __a) +#endif + : _STLP_PRIV _List_base<_Tp, _Alloc>(__a) {} + + list(const _Self& __x) : _STLP_PRIV _List_base<_Tp, _Alloc>(__x.get_allocator()) + { _M_insert(begin(), __x.begin(), __x.end()); } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + list(__move_source<_Self> src) + : _STLP_PRIV _List_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {} +#endif + + ~list() {} + + _Self& operator = (const _Self& __x); + + iterator begin() { return iterator(this->_M_node._M_data._M_next); } + const_iterator begin() const { return const_iterator(this->_M_node._M_data._M_next); } + + iterator end() { return iterator(&this->_M_node._M_data); } + const_iterator end() const { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_node._M_data)); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + size_type size() const { + size_type __result = _STLP_STD::distance(begin(), end()); + return __result; + } + size_type max_size() const { return size_type(-1); } + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(--end()); } + const_reference back() const { return *(--end()); } + +private: + void _M_swap_aux(_Self& __x) { + __x._M_node._M_swap_alloc(this->_M_node); + __x._M_node._M_data._M_next = this->_M_node._M_data._M_next; + __x._M_node._M_data._M_next->_M_prev = &__x._M_node._M_data; + __x._M_node._M_data._M_prev = this->_M_node._M_data._M_prev; + __x._M_node._M_data._M_prev->_M_next = &__x._M_node._M_data; + this->_M_empty_initialize(); + } + +public: + void swap(_Self& __x) { + if (__x.empty()) { + if (this->empty()) { + return; + } + this->_M_swap_aux(__x); + } else if (this->empty()) { + __x._M_swap_aux(*this); + } else { + this->_M_node.swap(__x._M_node); + _STLP_STD::swap(this->_M_node._M_data._M_prev->_M_next, __x._M_node._M_data._M_prev->_M_next); + _STLP_STD::swap(this->_M_node._M_data._M_next->_M_prev, __x._M_node._M_data._M_next->_M_prev); + } + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const_reference __x = value_type()) +#else + iterator insert(iterator __pos, const_reference __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { + _Node_base* __tmp = _M_create_node(__x); + _Node_base* __n = __pos._M_node; + _Node_base* __p = __n->_M_prev; + __tmp->_M_next = __n; + __tmp->_M_prev = __p; + __p->_M_next = __tmp; + __n->_M_prev = __tmp; + return iterator(__tmp); + } + +private: +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); + } + + // Check whether it's an integral type. If so, it's not an iterator. + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + const __true_type& /*_IsIntegral*/) { + _M_fill_insert(__pos, __n, __x); + } + template + void _M_insert_dispatch(iterator __pos, + _InputIter __first, _InputIter __last, + const __false_type& /*_IsIntegral*/) { +#else /* _STLP_MEMBER_TEMPLATES */ + void _M_insert(iterator __pos, const value_type* __first, const value_type* __last) { + for (; __first != __last; ++__first) + insert(__pos, *__first); + } + void _M_insert(iterator __pos, const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + //We use a temporary list to avoid the auto reference troubles (infinite loop) + for (; __first != __last; ++__first) + insert(__pos, *__first); + } + +public: +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_splice_insert_dispatch(__pos, __first, __last, _Integral()); + } + +private: + // Check whether it's an integral type. If so, it's not an iterator. + template + void _M_splice_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + const __true_type& /*_IsIntegral*/) { + _M_fill_insert(__pos, __n, __x); + } + template + void _M_splice_insert_dispatch(iterator __pos, + _InputIter __first, _InputIter __last, + const __false_type& /*_IsIntegral*/) { +#else /* _STLP_MEMBER_TEMPLATES */ + void insert(iterator __pos, const value_type* __first, const value_type* __last) { + _Self __tmp(__first, __last, this->get_allocator()); + _STLP_ASSERT(__tmp.get_allocator() == this->get_allocator()) + splice(__pos, __tmp); + } + void insert(iterator __pos, const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + //We use a temporary list to avoid the auto reference troubles (infinite loop) + _Self __tmp(__first, __last, this->get_allocator()); + splice(__pos, __tmp); + } + +public: + void insert(iterator __pos, size_type __n, const_reference __x) + { _M_fill_insert(__pos, __n, __x); } + +private: + void _M_fill_insert(iterator __pos, size_type __n, const_reference __x) { + for ( ; __n > 0; --__n) + insert(__pos, __x); + } + +public: + void push_front(const_reference __x) { insert(begin(), __x); } + void push_back (const_reference __x) { insert(end(), __x); } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos) + { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); } + void push_front() {insert(begin());} + void push_back() {insert(end());} +# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + iterator erase(iterator __pos) { + _Node_base* __next_node = __pos._M_node->_M_next; + _Node_base* __prev_node = __pos._M_node->_M_prev; + _Node* __n = __STATIC_CAST(_Node*, __pos._M_node); + __prev_node->_M_next = __next_node; + __next_node->_M_prev = __prev_node; + _STLP_STD::_Destroy(&__n->_M_data); + this->_M_node.deallocate(__n, 1); + return iterator(__next_node); + } + + iterator erase(iterator __first, iterator __last) { + while (__first != __last) + erase(__first++); + return __last; + } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const_reference __x = value_type()); +#else + void resize(size_type __new_size, const_reference __x); + void resize(size_type __new_size) + { this->resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); } +#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ + + void pop_front() { erase(begin()); } + void pop_back() { + iterator __tmp = end(); + erase(--__tmp); + } + +public: + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void assign(size_type __n, const_reference __val) { _M_fill_assign(__n, __val); } + + void _M_fill_assign(size_type __n, const_reference __val); + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + + template + void _M_assign_dispatch(_Integer __n, _Integer __val, + const __true_type& /*_IsIntegral*/) { + _M_fill_assign(__n, __val); + } + + template + void _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2, + const __false_type& /*_IsIntegral*/) { +#else + void assign(const value_type *__first2, const value_type *__last2) { + iterator __first1 = begin(); + iterator __last1 = end(); + for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) + *__first1 = *__first2; + if (__first2 == __last2) + erase(__first1, __last1); + else + insert(__last1, __first2, __last2); + } + void assign(const_iterator __first2, const_iterator __last2) { +#endif /* _STLP_MEMBER_TEMPLATES */ + iterator __first1 = begin(); + iterator __last1 = end(); + for ( ; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) + *__first1 = *__first2; + if (__first2 == __last2) + erase(__first1, __last1); + else + insert(__last1, __first2, __last2); + } + +public: + void splice(iterator __pos, _Self& __x) { + if (!__x.empty()) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __x.begin()._M_node, __x.end()._M_node); + } + else { + insert(__pos, __x.begin(), __x.end()); + __x.clear(); + } + } + } + void splice(iterator __pos, _Self& __x, iterator __i) { + iterator __j = __i; + ++__j; + if (__pos == __i || __pos == __j) return; + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __i._M_node, __j._M_node); + } + else { + insert(__pos, *__i); + __x.erase(__i); + } + } + void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { + if (__first != __last) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _List_global_inst::_Transfer(__pos._M_node, __first._M_node, __last._M_node); + } + else { + insert(__pos, __first, __last); + __x.erase(__first, __last); + } + } + } + + void remove(const_reference __val) { + iterator __first = begin(); + iterator __last = end(); + while (__first != __last) { + iterator __next = __first; + ++__next; + if (__val == *__first) erase(__first); + __first = __next; + } + } + + void unique() + { _STLP_PRIV _S_unique(*this, equal_to()); } + + void merge(_Self& __x) + { _STLP_PRIV _S_merge(*this, __x, less()); } + + void reverse() { + _Node_base* __p = &this->_M_node._M_data; + _Node_base* __tmp = __p; + do { + _STLP_STD::swap(__tmp->_M_next, __tmp->_M_prev); + __tmp = __tmp->_M_prev; // Old next node is now prev. + } while (__tmp != __p); + } + + void sort() + { _STLP_PRIV _S_sort(*this, less()); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void remove_if(_Predicate __pred) + { _STLP_PRIV _S_remove_if(*this, __pred); } + template + void unique(_BinaryPredicate __binary_pred) + { _STLP_PRIV _S_unique(*this, __binary_pred); } + + template + void merge(_Self& __x, + _StrictWeakOrdering __comp) { + _STLP_PRIV _S_merge(*this, __x, __comp); + } + + template + void sort(_StrictWeakOrdering __comp) + { _STLP_PRIV _S_sort(*this, __comp); } +#endif /* _STLP_MEMBER_TEMPLATES */ +}; + +#if defined (list) +# undef list +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# include +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +_STLP_INLINE_LOOP bool _STLP_CALL +operator==(const list<_Tp,_Alloc>& __x, const list<_Tp,_Alloc>& __y) { + typedef typename list<_Tp,_Alloc>::const_iterator const_iterator; + const_iterator __end1 = __x.end(); + const_iterator __end2 = __y.end(); + + const_iterator __i1 = __x.begin(); + const_iterator __i2 = __y.begin(); + while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { + ++__i1; + ++__i2; + } + return __i1 == __end1 && __i2 == __end2; +} + +#define _STLP_EQUAL_OPERATOR_SPECIALIZED +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER list<_Tp, _Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER +#undef _STLP_EQUAL_OPERATOR_SPECIALIZED + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + typedef __true_type implemented; + typedef typename __move_traits<_Alloc>::complete complete; +}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_LIST_IMPL_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_locale.h b/sdk/tlibstdcxx/stlport/stl/_locale.h new file mode 100644 index 0000000000..fd6d537dda --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_locale.h @@ -0,0 +1,364 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_LOCALE_H +#define _STLP_INTERNAL_LOCALE_H + +#ifndef _STLP_INTERNAL_CSTDLIB +# include +#endif + +#ifndef _STLP_INTERNAL_CWCHAR +# include +#endif + +#ifndef _STLP_INTERNAL_THREADS_H +# include +#endif + +#ifndef _STLP_STRING_FWD_H +# include +#endif + +#include + +_STLP_BEGIN_NAMESPACE + +class _Locale_impl; // Forward declaration of opaque type. +class locale; + +template +bool __locale_do_operator_call(const locale& __loc, + const basic_string<_CharT, _Traits, _Alloc>& __x, + const basic_string<_CharT, _Traits, _Alloc>& __y); + +_STLP_DECLSPEC _Locale_impl * _STLP_CALL _get_Locale_impl( _Locale_impl *locimpl ); +_STLP_DECLSPEC _Locale_impl * _STLP_CALL _copy_Nameless_Locale_impl( _Locale_impl *locimpl ); + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW; + +template +_Facet* _UseFacet(const locale& __loc, const _Facet* __facet); + +template +void _InsertFacet(locale& __loc, _Facet* __facet); + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ + defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) +# define locale _STLP_NO_MEM_T_NAME(loc) +#endif + +class _STLP_CLASS_DECLSPEC locale { +public: + // types: + class _STLP_CLASS_DECLSPEC facet : protected _Refcount_Base { + protected: + /* Here we filter __init_count user value to 0 or 1 because __init_count is a + * size_t instance and _Refcount_Base use __stl_atomic_t instances that might + * have lower sizeof and generate roll issues. 1 is enough to keep the facet + * alive when required. */ + explicit facet(size_t __init_count = 0) : _Refcount_Base( __init_count == 0 ? 0 : 1 ) {} + virtual ~facet(); + friend class locale; + friend class _Locale_impl; + friend facet * _STLP_CALL _get_facet( facet * ); + friend void _STLP_CALL _release_facet( facet *& ); + + private: // Invalidate assignment and copying. + facet(const facet& ) /* : _Refcount_Base(1) {} */; + void operator=(const facet&); + }; + +#if defined (__MVS__) || defined (__OS400__) + struct +#else + class +#endif + _STLP_CLASS_DECLSPEC id { + public: + size_t _M_index; + static size_t _S_max; + }; + + typedef int category; + _STLP_STATIC_CONSTANT(category, none = 0x000); + _STLP_STATIC_CONSTANT(category, collate = 0x010); + _STLP_STATIC_CONSTANT(category, ctype = 0x020); + _STLP_STATIC_CONSTANT(category, monetary = 0x040); + _STLP_STATIC_CONSTANT(category, numeric = 0x100); + _STLP_STATIC_CONSTANT(category, time = 0x200); + _STLP_STATIC_CONSTANT(category, messages = 0x400); + _STLP_STATIC_CONSTANT(category, all = collate | ctype | monetary | numeric | time | messages); + + // construct/copy/destroy: + locale() _STLP_NOTHROW; + locale(const locale&) _STLP_NOTHROW; + explicit locale(const char *); + locale(const locale&, const char*, category); + +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + locale(const locale& __loc, _Facet* __f) { + if ( __f != 0 ) { + this->_M_impl = _get_Locale_impl( _copy_Nameless_Locale_impl( __loc._M_impl ) ); + _STLP_PRIV _InsertFacet(*this, __f); + } else { + this->_M_impl = _get_Locale_impl( __loc._M_impl ); + } + } +#endif + +protected: + // those are for internal use + locale(_Locale_impl*); + +public: + locale(const locale&, const locale&, category); + const locale& operator=(const locale&) _STLP_NOTHROW; + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +protected: +#endif + ~locale() _STLP_NOTHROW; + +public: +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && \ + !defined(_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + locale combine(const locale& __loc) const { + _Facet *__facet = 0; + if (!_STLP_PRIV _HasFacet(__loc, __facet)) + _M_throw_on_combine_error(__loc.name()); + + return locale(*this, _STLP_PRIV _UseFacet(__loc, __facet)); + } +#endif + + // locale operations: + string name() const; + + bool operator==(const locale&) const; + bool operator!=(const locale&) const; + +#if !defined (_STLP_MEMBER_TEMPLATES) || defined (_STLP_INLINE_MEMBER_TEMPLATES) || (defined(__MWERKS__) && __MWERKS__ <= 0x2301) + bool operator()(const string& __x, const string& __y) const; +# ifndef _STLP_NO_WCHAR_T + bool operator()(const wstring& __x, const wstring& __y) const; +# endif +#elif !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x, + const basic_string<_CharT, _Traits, _Alloc>& __y) const + { return __locale_do_operator_call(*this, __x, __y); } +#endif + + // global locale objects: +#if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + static locale _STLP_CALL global(const locale&); +#else + static _Locale_impl* _STLP_CALL global(const locale&); +#endif + static const locale& _STLP_CALL classic(); + +//protected: // Helper functions for locale globals. + facet* _M_get_facet(const id&) const; + // same, but throws + facet* _M_use_facet(const id&) const; + static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_combine_error(const string& name); + static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_null_name(); + static void _STLP_FUNCTION_THROWS _STLP_CALL _M_throw_on_creation_failure(int __err_code, + const char* name, const char* facet); + +//protected: // More helper functions. + void _M_insert(facet* __f, id& __id); + + // friends: + friend class _Locale_impl; + +protected: // Data members + _Locale_impl* _M_impl; + _Locale_impl* _M_get_impl() const { return _M_impl; } +}; + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ + defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) +# undef locale +# define _Locale _STLP_NO_MEM_T_NAME(loc) + +class locale : public _Locale { +public: + + // construct/copy/destroy: + locale() _STLP_NOTHROW { +#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) + _STLP_CHECK_RUNTIME_COMPATIBILITY(); +#endif + } + locale(const locale& __loc) _STLP_NOTHROW : _Locale(__loc) {} + explicit locale(const char *__str) : _Locale(__str) {} + locale(const locale& __loc, const char* __str, category __cat) + : _Locale(__loc, __str, __cat) {} + + template + locale(const locale& __loc, _Facet* __f) + : _Locale(__f != 0 ? _copy_Nameless_Locale_impl(__loc._M_impl) : __loc._M_impl) { + if ( __f != 0 ) { + _STLP_PRIV _InsertFacet(*this, __f); + } + } + +private: + // those are for internal use + locale(_Locale_impl* __impl) : _Locale(__impl) {} + locale(const _Locale& __loc) : _Locale(__loc) {} + +public: + + locale(const locale& __loc1, const locale& __loc2, category __cat) + : _Locale(__loc1, __loc2, __cat) {} + + const locale& operator=(const locale& __loc) _STLP_NOTHROW { + _Locale::operator=(__loc); + return *this; + } + + template + locale combine(const locale& __loc) const { + _Facet *__facet = 0; + if (!_STLP_PRIV _HasFacet(__loc, __facet)) + _M_throw_on_combine_error(__loc.name()); + + return locale(*this, _STLP_PRIV _UseFacet(__loc, __facet)); + } + + // locale operations: + bool operator==(const locale& __loc) const { return _Locale::operator==(__loc); } + bool operator!=(const locale& __loc) const { return _Locale::operator!=(__loc); } + + template + bool operator()(const basic_string<_CharT, _Traits, _Alloc>& __x, + const basic_string<_CharT, _Traits, _Alloc>& __y) const + { return __locale_do_operator_call(*this, __x, __y); } + + // global locale objects: + static locale _STLP_CALL global(const locale& __loc) { + return _Locale::global(__loc); + } + static const locale& _STLP_CALL classic() { + return __STATIC_CAST(const locale&, _Locale::classic()); + } + + // friends: + friend class _Locale_impl; +}; + +# undef _Locale +#endif + +//---------------------------------------------------------------------- +// locale globals + +template +inline const _Facet& +#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS +_Use_facet<_Facet>::operator *() const +#else +use_facet(const locale& __loc) +#endif +{ + _Facet *__facet = 0; + return *(_STLP_PRIV _UseFacet(__loc, __facet)); +} + +template +#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS +struct has_facet { + const locale& __loc; + has_facet(const locale& __p_loc) : __loc(__p_loc) {} + operator bool() const _STLP_NOTHROW +#else +inline bool has_facet(const locale& __loc) _STLP_NOTHROW +#endif +{ + _Facet *__facet = 0; + return _STLP_PRIV _HasFacet(__loc, __facet); +} + +#ifdef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS +}; // close class definition +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +/* _GetFacetId is a helper function that allow delaying access to + * facet id static instance in the library source code to avoid + * the other static instances that many compilers are generating + * in all dynamic library or executable when instanciating facet + * template class. + */ +template +inline locale::id& _GetFacetId(const _Facet*) +{ return _Facet::id; } + +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put > >*); + +#ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_get > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const money_put > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_get > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const num_put > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_get > >*); +_STLP_DECLSPEC locale::id& _STLP_CALL _GetFacetId(const time_put > >*); +#endif + +template +inline bool _HasFacet(const locale& __loc, const _Facet* __facet) _STLP_NOTHROW +{ return (__loc._M_get_facet(_GetFacetId(__facet)) != 0); } + +template +inline _Facet* _UseFacet(const locale& __loc, const _Facet* __facet) +{ return __STATIC_CAST(_Facet*, __loc._M_use_facet(_GetFacetId(__facet))); } + +template +inline void _InsertFacet(locale& __loc, _Facet* __facet) +{ __loc._M_insert(__facet, _GetFacetId(__facet)); } + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_LOCALE_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_map.h b/sdk/tlibstdcxx/stlport/stl/_map.h new file mode 100644 index 0000000000..bf46a5ddd7 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_map.h @@ -0,0 +1,435 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_MAP_H +#define _STLP_INTERNAL_MAP_H + +#ifndef _STLP_INTERNAL_TREE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_ITERATOR_TRAITS(MapTraitsT, traits) + +template ), + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) > +class map +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef map<_Key, _Tp, _Compare, _Alloc> _Self; +public: + +// typedefs: + + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<_STLP_CONST _Key, _Tp> value_type; + typedef _Compare key_compare; + + class value_compare + : public binary_function { + friend class map<_Key,_Tp,_Compare,_Alloc>; + protected : + //c is a Standard name (23.3.1), do no make it STLport naming convention compliant. + _Compare comp; + value_compare(_Compare __c) : comp(__c) {} + public: + bool operator()(const value_type& __x, const value_type& __y) const + { return comp(__x.first, __y.first); } + }; + +protected: + typedef _STLP_PRIV _MapTraitsT _MapTraits; + +public: + //Following typedef have to be public for __move_traits specialization. + typedef _STLP_PRIV _Rb_tree _Rep_type; + + typedef typename _Rep_type::pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + +private: + _Rep_type _M_t; // red-black tree representing map + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + // allocation/deallocation + map() : _M_t(_Compare(), allocator_type()) {} +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit map(const _Compare& __comp, + const allocator_type& __a = allocator_type()) +#else + explicit map(const _Compare& __comp) + : _M_t(__comp, allocator_type()) {} + explicit map(const _Compare& __comp, const allocator_type& __a) +#endif + : _M_t(__comp, __a) {} + +#if defined (_STLP_MEMBER_TEMPLATES) + template + map(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + template + map(_InputIterator __first, _InputIterator __last, const _Compare& __comp, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + map(_InputIterator __first, _InputIterator __last, const _Compare& __comp) + : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); } +# endif + +#else + map(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + map(const value_type* __first, + const value_type* __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } + + map(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + map(const_iterator __first, const_iterator __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + map(const _Self& __x) : _M_t(__x._M_t) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + map(__move_source<_Self> src) + : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} +#endif + + _Self& operator=(const _Self& __x) { + _M_t = __x._M_t; + return *this; + } + + // accessors: + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return value_compare(_M_t.key_comp()); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() { return _M_t.begin(); } + const_iterator begin() const { return _M_t.begin(); } + iterator end() { return _M_t.end(); } + const_iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() { return _M_t.rbegin(); } + const_reverse_iterator rbegin() const { return _M_t.rbegin(); } + reverse_iterator rend() { return _M_t.rend(); } + const_reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + _STLP_TEMPLATE_FOR_CONT_EXT + _Tp& operator[](const _KT& __k) { + iterator __i = lower_bound(__k); + // __i->first is greater than or equivalent to __k. + if (__i == end() || key_comp()(__k, (*__i).first)) + __i = insert(__i, value_type(__k, _STLP_DEFAULT_CONSTRUCTED(_Tp))); + return (*__i).second; + } + void swap(_Self& __x) { _M_t.swap(__x._M_t); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + // insert/erase + pair insert(const value_type& __x) + { return _M_t.insert_unique(__x); } + iterator insert(iterator __pos, const value_type& __x) + { return _M_t.insert_unique(__pos, __x); } +#ifdef _STLP_MEMBER_TEMPLATES + template + void insert(_InputIterator __first, _InputIterator __last) + { _M_t.insert_unique(__first, __last); } +#else + void insert(const value_type* __first, const value_type* __last) + { _M_t.insert_unique(__first, __last); } + void insert(const_iterator __first, const_iterator __last) + { _M_t.insert_unique(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + void erase(iterator __pos) { _M_t.erase(__pos); } + size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); } + void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } + void clear() { _M_t.clear(); } + + // map operations: + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __x) { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __x) const { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) + { return _M_t.equal_range_unique(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const + { return _M_t.equal_range_unique(__x); } +}; + +//Specific iterator traits creation +_STLP_CREATE_ITERATOR_TRAITS(MultimapTraitsT, traits) + +template ), + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) > +class multimap +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef multimap<_Key, _Tp, _Compare, _Alloc> _Self; +public: + +// typedefs: + + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<_STLP_CONST _Key, _Tp> value_type; + typedef _Compare key_compare; + + class value_compare : public binary_function { + friend class multimap<_Key,_Tp,_Compare,_Alloc>; + protected: + //comp is a Standard name (23.3.2), do no make it STLport naming convention compliant. + _Compare comp; + value_compare(_Compare __c) : comp(__c) {} + public: + bool operator()(const value_type& __x, const value_type& __y) const + { return comp(__x.first, __y.first); } + }; + +protected: + //Specific iterator traits creation + typedef _STLP_PRIV _MultimapTraitsT _MultimapTraits; + +public: + //Following typedef have to be public for __move_traits specialization. + typedef _STLP_PRIV _Rb_tree _Rep_type; + + typedef typename _Rep_type::pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + +private: + _Rep_type _M_t; // red-black tree representing multimap + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + // allocation/deallocation + multimap() : _M_t(_Compare(), allocator_type()) { } + explicit multimap(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { } + +#ifdef _STLP_MEMBER_TEMPLATES + template + multimap(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } +# ifdef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS + template + multimap(_InputIterator __first, _InputIterator __last, + const _Compare& __comp) + : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); } +# endif + template + multimap(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } +#else + multimap(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + multimap(const value_type* __first, const value_type* __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } + + multimap(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + multimap(const_iterator __first, const_iterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + multimap(const _Self& __x) : _M_t(__x._M_t) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + multimap(__move_source<_Self> src) + : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} +#endif + + _Self& operator=(const _Self& __x) { + _M_t = __x._M_t; + return *this; + } + + // accessors: + + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return value_compare(_M_t.key_comp()); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() { return _M_t.begin(); } + const_iterator begin() const { return _M_t.begin(); } + iterator end() { return _M_t.end(); } + const_iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() { return _M_t.rbegin(); } + const_reverse_iterator rbegin() const { return _M_t.rbegin(); } + reverse_iterator rend() { return _M_t.rend(); } + const_reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(_Self& __x) { _M_t.swap(__x._M_t); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + // insert/erase + iterator insert(const value_type& __x) { return _M_t.insert_equal(__x); } + iterator insert(iterator __pos, const value_type& __x) { return _M_t.insert_equal(__pos, __x); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __first, _InputIterator __last) + { _M_t.insert_equal(__first, __last); } +#else + void insert(const value_type* __first, const value_type* __last) + { _M_t.insert_equal(__first, __last); } + void insert(const_iterator __first, const_iterator __last) + { _M_t.insert_equal(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + void erase(iterator __pos) { _M_t.erase(__pos); } + size_type erase(const key_type& __x) { return _M_t.erase(__x); } + void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last); } + void clear() { _M_t.clear(); } + + // multimap operations: + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __x) { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __x) const { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const { return _M_t.count(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) + { return _M_t.equal_range(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const + { return _M_t.equal_range(__x); } +}; + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER map<_Key,_Tp,_Compare,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#define _STLP_TEMPLATE_CONTAINER multimap<_Key,_Tp,_Compare,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux::_Rep_type> +{}; + +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux::_Rep_type> +{}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_MAP_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_mbstate_t.h b/sdk/tlibstdcxx/stlport/stl/_mbstate_t.h new file mode 100644 index 0000000000..e6a3e75bc3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_mbstate_t.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_MBSTATE_T +#define _STLP_INTERNAL_MBSTATE_T + +#if (defined (__OpenBSD__) || defined (__FreeBSD__) || defined (__hpux)) && defined (__GNUC__) && !defined (_GLIBCPP_HAVE_MBSTATE_T) +# define _STLP_CPP_MBSTATE_T /* mbstate_t defined in native , so not defined in C! */ +#endif + +#if defined (_STLP_NO_NATIVE_MBSTATE_T) || defined (_STLP_CPP_MBSTATE_T) && !defined (_MBSTATE_T) +# define _STLP_USE_OWN_MBSTATE_T +# define _MBSTATE_T +#endif + +#if defined (_STLP_USE_OWN_MBSTATE_T) +# if !defined (_STLP_CPP_MBSTATE_T) || !defined (__cplusplus) || !defined (_STLP_USE_NEW_C_HEADERS) +typedef int mbstate_t; +# endif + +# if !defined (_STLP_CPP_MBSTATE_T) && defined (__cplusplus) && defined (_STLP_USE_NAMESPACES) +_STLP_BEGIN_NAMESPACE +using ::mbstate_t; +_STLP_END_NAMESPACE +# endif + +#endif /* _STLP_USE_OWN_MBSTATE_T */ + +#endif /* _STLP_INTERNAL_MBSTATE_T */ diff --git a/sdk/tlibstdcxx/stlport/stl/_messages_facets.h b/sdk/tlibstdcxx/stlport/stl/_messages_facets.h new file mode 100644 index 0000000000..aca5596574 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_messages_facets.h @@ -0,0 +1,185 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_MESSAGES_H +#define _STLP_INTERNAL_MESSAGES_H + +#ifndef _STLP_IOS_BASE_H +# include +#endif + +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// messages facets + +class messages_base { + public: + typedef int catalog; +}; + +template class messages {}; + +_STLP_MOVE_TO_PRIV_NAMESPACE +class _Messages; +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC messages : public locale::facet, public messages_base { +public: + typedef messages_base::catalog catalog; + typedef char char_type; + typedef string string_type; + + explicit messages(size_t __refs = 0); + + catalog open(const string& __fn, const locale& __loc) const + { return do_open(__fn, __loc); } + string_type get(catalog __c, int __set, int __msgid, + const string_type& __dfault) const + { return do_get(__c, __set, __msgid, __dfault); } + inline void close(catalog __c) const + { do_close(__c); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~messages() {} + + virtual catalog do_open(const string& __fn, const locale& __loc) const + { return -1; } + virtual string_type do_get(catalog __c, int __set, int __msgid, + const string_type& __dfault) const + { return __dfault; } + virtual void do_close(catalog __c) const + {} +}; + +#if !defined (_STLP_NO_WCHAR_T) + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC messages : public locale::facet, public messages_base { +public: + typedef messages_base::catalog catalog; + typedef wchar_t char_type; + typedef wstring string_type; + + explicit messages(size_t __refs = 0); + + inline catalog open(const string& __fn, const locale& __loc) const + { return do_open(__fn, __loc); } + inline string_type get(catalog __c, int __set, int __msgid, + const string_type& __dfault) const + { return do_get(__c, __set, __msgid, __dfault); } + inline void close(catalog __c) const + { do_close(__c); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~messages() {} + + virtual catalog do_open(const string& __fn, const locale& __loc) const + { return -1; } + virtual string_type do_get(catalog __c, int __set, int __msgid, + const string_type& __dfault) const + { return __dfault; } + virtual void do_close(catalog __c) const + {} +}; + +#endif + +template class messages_byname {}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC messages_byname : public messages { + friend class _Locale_impl; +public: + typedef messages_base::catalog catalog; + typedef string string_type; + + explicit messages_byname(const char* __name, size_t __refs = 0); + +protected: + ~messages_byname(); + + virtual catalog do_open(const string& __fn, const locale& __loc) const; + virtual string_type do_get(catalog __c, int __set, int __msgid, + const string_type& __dfault) const; + virtual void do_close(catalog __c) const; + +private: + messages_byname(_Locale_messages*); + typedef messages_byname _Self; + //explicitely defined as private to avoid warnings: + messages_byname(_Self const&); + _Self& operator = (_Self const&); + + _STLP_PRIV _Messages* _M_impl; +}; + +#if !defined (_STLP_NO_WCHAR_T) +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC messages_byname : public messages { + friend class _Locale_impl; +public: + typedef messages_base::catalog catalog; + typedef wstring string_type; + + explicit messages_byname(const char* __name, size_t __refs = 0); + +protected: + ~messages_byname(); + + virtual catalog do_open(const string& __fn, const locale& __loc) const; + virtual string_type do_get(catalog __c, int __set, int __msgid, + const string_type& __dfault) const; + virtual void do_close(catalog __c) const; + +private: + messages_byname(_Locale_messages*); + typedef messages_byname _Self; + //explicitely defined as private to avoid warnings: + messages_byname(_Self const&); + _Self& operator = (_Self const&); + + _STLP_PRIV _Messages* _M_impl; +}; +#endif /* WCHAR_T */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_MESSAGES_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_monetary.c b/sdk/tlibstdcxx/stlport/stl/_monetary.c new file mode 100644 index 0000000000..3de937cbc1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_monetary.c @@ -0,0 +1,527 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_MONETARY_C +#define _STLP_MONETARY_C + +# ifndef _STLP_INTERNAL_MONETARY_H +# include +# endif + +#ifndef _STLP_INTERNAL_IOS_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUM_PUT_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUM_GET_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +locale::id money_get<_CharT, _InputIterator>::id; + +template +locale::id money_put<_CharT, _OutputIterator>::id; + +// money_get facets + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// helper functions for do_get +template +pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last, + _InIt2 __str_first, _InIt2 __str_last) { + while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) { + ++__first; + ++__str_first; + } + return make_pair(__first, __str_first == __str_last); +} + +template +bool +__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite, + const ctype<_CharT>& _c_type, + _CharT __point, int __frac_digits, _CharT __sep, + const string& __grouping, bool &__syntax_ok) { + if (__first == __last || !_c_type.is(ctype_base::digit, *__first)) + return false; + + char __group_sizes[128]; + char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes; + char __current_group_size = 0; + + while (__first != __last) { + if (_c_type.is(ctype_base::digit, *__first)) { + ++__current_group_size; + *__out_ite++ = *__first++; + } + else if (__group_sizes_end) { + if (*__first == __sep) { + *__group_sizes_end++ = __current_group_size; + __current_group_size = 0; + ++__first; + } + else break; + } + else + break; + } + + if (__grouping.empty()) + __syntax_ok = true; + else { + if (__group_sizes_end != __group_sizes) + *__group_sizes_end++ = __current_group_size; + + __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end, + __grouping.data(), __grouping.data()+ __grouping.size()); + + if (__first == __last || *__first != __point) { + for (int __digits = 0; __digits != __frac_digits; ++__digits) + *__out_ite++ = _CharT('0'); + return true; // OK not to have decimal point + } + } + + ++__first; + + int __digits = 0; + + while (__first != __last && _c_type.is(ctype_base::digit, *__first)) { + *__out_ite++ = *__first++; + ++__digits; + } + + __syntax_ok = __syntax_ok && (__digits == __frac_digits); + + return true; +} + + +template +_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) { + if (__s == __end) { + __err |= ios_base::eofbit; + return __s; + } + + typedef _CharT char_type; + typedef _StrType string_type; + typedef _InputIter iter_type; + typedef moneypunct _Punct; + typedef moneypunct _Punct_intl; + typedef ctype _Ctype; + + locale __loc = __str.getloc(); + const _Punct& __punct = use_facet<_Punct>(__loc) ; + const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ; + const _Ctype& __c_type = use_facet<_Ctype>(__loc) ; + + money_base::pattern __format = __intl ? __punct_intl.neg_format() + : __punct.neg_format(); + string_type __ns = __intl ? __punct_intl.negative_sign() + : __punct.negative_sign(); + string_type __ps = __intl ? __punct_intl.positive_sign() + : __punct.positive_sign(); + int __i; + bool __symbol_required = (__str.flags() & ios_base::showbase) != 0; + string_type __buf; + back_insert_iterator __out_ite(__buf); + + for (__i = 0; __i < 4; ++__i) { + switch (__format.field[__i]) { + case money_base::space: + if (!__c_type.is(ctype_base::space, *__s)) { + __err = ios_base::failbit; + return __s; + } + ++__s; + case money_base::none: + while (__s != __end && __c_type.is(ctype_base::space, *__s)) + ++__s; + break; + case money_base::symbol: { + string_type __curs = __intl ? __punct_intl.curr_symbol() + : __punct.curr_symbol(); + pair + __result = __get_string(__s, __end, __curs.begin(), __curs.end()); + if (!__result.second && __symbol_required) + __err = ios_base::failbit; + __s = __result.first; + break; + } + case money_base::sign: { + if (__s == __end) { + if (__ps.empty()) + break; + if (__ns.empty()) { + __is_positive = false; + break; + } + __err = ios_base::failbit; + return __s; + } + else { + if (__ps.empty()) { + if (__ns.empty()) + break; + if (*__s == __ns[0]) { + ++__s; + __is_positive = false; + } + break; + } + else { + if (*__s == __ps[0]) { + ++__s; + break; + } + if (__ns.empty()) + break; + if (*__s == __ns[0]) { + ++__s; + __is_positive = false; + break; + } + __err = ios_base::failbit; + } + } + return __s; + } + case money_base::value: { + char_type __point = __intl ? __punct_intl.decimal_point() + : __punct.decimal_point(); + int __frac_digits = __intl ? __punct_intl.frac_digits() + : __punct.frac_digits(); + string __grouping = __intl ? __punct_intl.grouping() + : __punct.grouping(); + bool __syntax_ok = true; + + bool __result; + + char_type __sep = __grouping.empty() ? char_type() : + __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep(); + + __result = __get_monetary_value(__s, __end, __out_ite, __c_type, + __point, __frac_digits, + __sep, + __grouping, __syntax_ok); + + if (!__syntax_ok) + __err |= ios_base::failbit; + if (!__result) { + __err = ios_base::failbit; + return __s; + } + break; + + } // Close money_base::value case + } // Close switch statement + } // Close for loop + + if (__is_positive) { + if (__ps.size() > 1) { + pair<_InputIter, bool> + __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end()); + __s = __result.first; + if (!__result.second) + __err |= ios::failbit; + } + if (!(__err & ios_base::failbit)) + __digits = __buf; + } + else { + if (__ns.size() > 1) { + pair<_InputIter, bool> + __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end()); + __s = __result.first; + if (!__result.second) + __err |= ios::failbit; + } + if (!(__err & ios::failbit)) { + __digits = __c_type.widen('-'); + __digits += __buf; + } + } + if (__s == __end) + __err |= ios::eofbit; + + return __s; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +//===== methods ====== +template +_InputIter +money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + _STLP_LONGEST_FLOAT_TYPE& __units) const { + string_type __buf; + bool __is_positive = true; + __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0); + + if (__err == ios_base::goodbit || __err == ios_base::eofbit) { + typename string_type::iterator __b = __buf.begin(), __e = __buf.end(); + + if (!__is_positive) ++__b; + // Can't use atold, since it might be wchar_t. Don't get confused by name below : + // it's perfectly capable of reading long double. + _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0); + + if (!__is_positive) { + __units = -__units; + } + } + + return __s; +} + +template +_InputIter +money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + string_type& __digits) const { + bool __is_positive = true; + return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0); +} + +// money_put facets + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str, + _CharT __fill, const _Str& __digits, bool __check_digits, + _Str_Type * /*__dummy*/) { + typedef _CharT char_type; + typedef _Str_Type string_type; + typedef ctype _Ctype; + typedef moneypunct _Punct; + typedef moneypunct _Punct_intl; + + locale __loc = __str.getloc(); + const _Ctype& __c_type = use_facet<_Ctype>(__loc) ; + const _Punct& __punct = use_facet<_Punct>(__loc) ; + const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ; + + // some special characters + char_type __minus = __c_type.widen('-'); + char_type __plus = __c_type.widen('+'); + char_type __space = __c_type.widen(' '); + char_type __zero = __c_type.widen('0'); + char_type __point = __intl ? __punct_intl.decimal_point() + : __punct.decimal_point(); + + char_type __sep = __intl ? __punct_intl.thousands_sep() + : __punct.thousands_sep(); + + string __grouping = __intl ? __punct_intl.grouping() + : __punct.grouping(); + + int __frac_digits = __intl ? __punct_intl.frac_digits() + : __punct.frac_digits(); + + string_type __curr_sym = __intl ? __punct_intl.curr_symbol() + : __punct.curr_symbol(); + + // if there are no digits we are going to return __s. If there + // are digits, but not enough to fill the frac_digits, we are + // going to add zeros. I don't know whether this is right or + // not. + if (__digits.empty()) + return __s; + + typename string_type::const_iterator __digits_first = __digits.begin(); + typename string_type::const_iterator __digits_last = __digits.end(); + + bool __is_negative = *__digits_first == __minus; + if (__is_negative) + ++__digits_first; + +#if !defined (__BORLANDC__) + string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign() + : __punct_intl.positive_sign() + : __is_negative ? __punct.negative_sign() + : __punct.positive_sign(); +#else + string_type __sign; + if (__intl) { + if (__is_negative) + __sign = __punct_intl.negative_sign(); + else + __sign = __punct_intl.positive_sign(); + } + else { + if (__is_negative) + __sign = __punct.negative_sign(); + else + __sign = __punct.positive_sign(); + } +#endif + + if (__check_digits) { + typename string_type::const_iterator __cp = __digits_first; + while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp)) + ++__cp; + if (__cp == __digits_first) + return __s; + __digits_last = __cp; + } + + // If grouping is required, we make a copy of __digits and + // insert the grouping. + _STLP_BASIC_IOSTRING(char_type) __new_digits; + if (!__grouping.empty()) { + __new_digits.assign(__digits_first, __digits_last); + __insert_grouping(__new_digits, + __new_digits.size() - __frac_digits, + __grouping, + __sep, __plus, __minus, 0); + __digits_first = __new_digits.begin(); // <<-- + __digits_last = __new_digits.end(); // <<-- + } + + // Determine the amount of padding required, if any. + streamsize __width = __str.width(); + +#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1)) + size_t __value_length = operator -(__digits_last, __digits_first); +#else + size_t __value_length = __digits_last - __digits_first; +#endif + + size_t __length = __value_length + __sign.size(); + + if (__frac_digits != 0) + ++__length; + + bool __generate_curr = (__str.flags() & ios_base::showbase) !=0; + if (__generate_curr) + __length += __curr_sym.size(); + money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format() + : __punct_intl.pos_format()) + : (__is_negative ? __punct.neg_format() + : __punct.pos_format()); + { + //For the moment the following is commented for decoding reason. + //No reason to add a space last if the money symbol do not have to be display + //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) { + // if (__format.field[2] == (char) money_base::space) { + // __format.field[2] = (char) money_base::none; + // } + //} + //space can only be second or third and only once (22.2.6.3-1): + if ((__format.field[1] == (char) money_base::space) || + (__format.field[2] == (char) money_base::space)) + ++__length; + } + + const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) || + ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width)))); + streamsize __fill_amt = __need_fill ? __width - __length : 0; + + ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield; + + if (__fill_amt != 0 && + !(__fill_pos & (ios_base::left | ios_base::internal))) + __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill); + + for (int __i = 0; __i < 4; ++__i) { + char __ffield = __format.field[__i]; + switch (__ffield) { + case money_base::space: + *__s++ = __space; + case money_base::none: + if (__fill_amt != 0 && __fill_pos == ios_base::internal) + __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill); + break; + case money_base::symbol: + if (__generate_curr) + __s = _STLP_STD::copy(__curr_sym.begin(), __curr_sym.end(), __s); + break; + case money_base::sign: + if (!__sign.empty()) + *__s++ = __sign[0]; + break; + case money_base::value: + if (__frac_digits == 0) { + __s = _STLP_STD::copy(__digits_first, __digits_last, __s); + } else { + if ((int)__value_length <= __frac_digits) { + // if we see '9' here, we should out 0.09 + *__s++ = __zero; // integer part is zero + *__s++ = __point; // decimal point + __s = _STLP_PRIV __fill_n(__s, __frac_digits - __value_length, __zero); // zeros + __s = _STLP_STD::copy(__digits_first, __digits_last, __s); // digits + } else { + __s = _STLP_STD::copy(__digits_first, __digits_last - __frac_digits, __s); + if (__frac_digits != 0) { + *__s++ = __point; + __s = _STLP_STD::copy(__digits_last - __frac_digits, __digits_last, __s); + } + } + } + break; + } //Close for switch + } // Close for loop + + // Ouput rest of sign if necessary. + if (__sign.size() > 1) + __s = _STLP_STD::copy(__sign.begin() + 1, __sign.end(), __s); + if (__fill_amt != 0 && + !(__fill_pos & (ios_base::right | ios_base::internal))) + __s = _STLP_PRIV __fill_n(__s, __fill_amt, __fill); + + return __s; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_OutputIter +money_put<_CharT, _OutputIter> + ::do_put(_OutputIter __s, bool __intl, ios_base& __str, + char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const { + _STLP_BASIC_IOSTRING(char_type) __digits; + _STLP_PRIV __get_money_digits(__digits, __str, __units); + return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0)); +} + +template +_OutputIter +money_put<_CharT, _OutputIter> + ::do_put(_OutputIter __s, bool __intl, ios_base& __str, + char_type __fill, const string_type& __digits) const { + return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0)); +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_MONETARY_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_monetary.h b/sdk/tlibstdcxx/stlport/stl/_monetary.h new file mode 100644 index 0000000000..7b9301076d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_monetary.h @@ -0,0 +1,435 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_MONETARY_H +#define _STLP_INTERNAL_MONETARY_H + +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H +# include +#endif + +#ifndef _STLP_FACETS_FWD_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +class money_base { +public: + enum part {none, space, symbol, sign, value}; + struct pattern { + char field[4]; + }; +}; + +// moneypunct facets: forward declaration +template class moneypunct {}; + +// money_get facets + +template +class money_get : public locale::facet { +public: + typedef _CharT char_type; + typedef _InputIter iter_type; + typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type; + + explicit money_get(size_t __refs = 0) : locale::facet(__refs) {} + iter_type get(iter_type __s, iter_type __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + _STLP_LONGEST_FLOAT_TYPE& __units) const + { return do_get(__s, __end, __intl, __str, __err, __units); } + iter_type get(iter_type __s, iter_type __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + string_type& __digits) const + { return do_get(__s, __end, __intl, __str, __err, __digits); } + + static locale::id id; + +protected: + ~money_get() {} + virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + _STLP_LONGEST_FLOAT_TYPE& __units) const; + virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl, + ios_base& __str, ios_base::iostate& __err, + string_type& __digits) const; +}; + + +// moneypunct facets: definition of specializations + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base { +public: + typedef char char_type; + typedef string string_type; + explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0); + + char decimal_point() const { return do_decimal_point(); } + char thousands_sep() const { return do_thousands_sep(); } + string grouping() const { return do_grouping(); } + string_type curr_symbol() const { return do_curr_symbol(); } + string_type positive_sign() const { return do_positive_sign(); } + string_type negative_sign() const { return do_negative_sign(); } + int frac_digits() const { return do_frac_digits(); } + pattern pos_format() const { return do_pos_format(); } + pattern neg_format() const { return do_neg_format(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + _STLP_STATIC_CONSTANT(bool, intl = true); + +protected: + pattern _M_pos_format; + pattern _M_neg_format; + + ~moneypunct _STLP_PSPEC2(char, true) (); + + virtual char do_decimal_point() const; + virtual char do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string do_curr_symbol() const; + + virtual string do_positive_sign() const; + virtual string do_negative_sign() const; + virtual int do_frac_digits() const; + virtual pattern do_pos_format() const; + virtual pattern do_neg_format() const; +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base { +public: + typedef char char_type; + typedef string string_type; + + explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0); + + char decimal_point() const { return do_decimal_point(); } + char thousands_sep() const { return do_thousands_sep(); } + string grouping() const { return do_grouping(); } + string_type curr_symbol() const { return do_curr_symbol(); } + string_type positive_sign() const { return do_positive_sign(); } + string_type negative_sign() const { return do_negative_sign(); } + int frac_digits() const { return do_frac_digits(); } + pattern pos_format() const { return do_pos_format(); } + pattern neg_format() const { return do_neg_format(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + _STLP_STATIC_CONSTANT(bool, intl = false); + +protected: + pattern _M_pos_format; + pattern _M_neg_format; + + ~moneypunct _STLP_PSPEC2(char, false) (); + + virtual char do_decimal_point() const; + virtual char do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string do_curr_symbol() const; + + virtual string do_positive_sign() const; + virtual string do_negative_sign() const; + virtual int do_frac_digits() const; + virtual pattern do_pos_format() const; + virtual pattern do_neg_format() const; +}; + + +#ifndef _STLP_NO_WCHAR_T + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base { +public: + typedef wchar_t char_type; + typedef wstring string_type; + explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0); + wchar_t decimal_point() const { return do_decimal_point(); } + wchar_t thousands_sep() const { return do_thousands_sep(); } + string grouping() const { return do_grouping(); } + string_type curr_symbol() const { return do_curr_symbol(); } + string_type positive_sign() const { return do_positive_sign(); } + string_type negative_sign() const { return do_negative_sign(); } + int frac_digits() const { return do_frac_digits(); } + pattern pos_format() const { return do_pos_format(); } + pattern neg_format() const { return do_neg_format(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + _STLP_STATIC_CONSTANT(bool, intl = true); + +protected: + pattern _M_pos_format; + pattern _M_neg_format; + + ~moneypunct _STLP_PSPEC2(wchar_t, true) (); + + virtual wchar_t do_decimal_point() const; + virtual wchar_t do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string_type do_curr_symbol() const; + + virtual string_type do_positive_sign() const; + virtual string_type do_negative_sign() const; + virtual int do_frac_digits() const; + virtual pattern do_pos_format() const; + virtual pattern do_neg_format() const; +}; + + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct : public locale::facet, public money_base { +public: + typedef wchar_t char_type; + typedef wstring string_type; + explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0); + wchar_t decimal_point() const { return do_decimal_point(); } + wchar_t thousands_sep() const { return do_thousands_sep(); } + string grouping() const { return do_grouping(); } + string_type curr_symbol() const { return do_curr_symbol(); } + string_type positive_sign() const { return do_positive_sign(); } + string_type negative_sign() const { return do_negative_sign(); } + int frac_digits() const { return do_frac_digits(); } + pattern pos_format() const { return do_pos_format(); } + pattern neg_format() const { return do_neg_format(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + _STLP_STATIC_CONSTANT(bool, intl = false); + +protected: + pattern _M_pos_format; + pattern _M_neg_format; + + ~moneypunct _STLP_PSPEC2(wchar_t, false) (); + + virtual wchar_t do_decimal_point() const; + virtual wchar_t do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string_type do_curr_symbol() const; + + virtual string_type do_positive_sign() const; + virtual string_type do_negative_sign() const; + virtual int do_frac_digits() const; + virtual pattern do_pos_format() const; + virtual pattern do_neg_format() const; +}; + +# endif + +template class moneypunct_byname {}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct { + friend class _Locale_impl; +public: + typedef money_base::pattern pattern; + typedef char char_type; + typedef string string_type; + + explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0); + +protected: + ~moneypunct_byname _STLP_PSPEC2(char, true) (); + virtual char do_decimal_point() const; + virtual char do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string_type do_curr_symbol() const; + + virtual string_type do_positive_sign() const; + virtual string_type do_negative_sign() const; + virtual int do_frac_digits() const; + +private: + moneypunct_byname _STLP_PSPEC2(char, true) (_Locale_monetary *__monetary); + + typedef moneypunct_byname _Self; + //explicitely defined as private to avoid warnings: + moneypunct_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_monetary* _M_monetary; +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct { + friend class _Locale_impl; +public: + typedef money_base::pattern pattern; + typedef char char_type; + typedef string string_type; + + explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0); + +protected: + ~moneypunct_byname _STLP_PSPEC2(char, false) (); + virtual char do_decimal_point() const; + virtual char do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string_type do_curr_symbol() const; + + virtual string_type do_positive_sign() const; + virtual string_type do_negative_sign() const; + virtual int do_frac_digits() const; + +private: + moneypunct_byname _STLP_PSPEC2(char, false) (_Locale_monetary *__monetary); + + typedef moneypunct_byname _Self; + //explicitely defined as private to avoid warnings: + moneypunct_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_monetary* _M_monetary; +}; + +#if !defined (_STLP_NO_WCHAR_T) +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct { + friend class _Locale_impl; +public: + typedef money_base::pattern pattern; + typedef wchar_t char_type; + typedef wstring string_type; + + explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0); + +protected: + ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) (); + virtual wchar_t do_decimal_point() const; + virtual wchar_t do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string_type do_curr_symbol() const; + + virtual string_type do_positive_sign() const; + virtual string_type do_negative_sign() const; + virtual int do_frac_digits() const; + +private: + moneypunct_byname _STLP_PSPEC2(wchar_t, true) (_Locale_monetary *__monetary); + + typedef moneypunct_byname _Self; + //explicitely defined as private to avoid warnings: + moneypunct_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_monetary* _M_monetary; +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC moneypunct_byname : public moneypunct { + friend class _Locale_impl; +public: + typedef money_base::pattern pattern; + typedef wchar_t char_type; + typedef wstring string_type; + + explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0); + +protected: + ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) (); + virtual wchar_t do_decimal_point() const; + virtual wchar_t do_thousands_sep() const; + virtual string do_grouping() const; + + virtual string_type do_curr_symbol() const; + + virtual string_type do_positive_sign() const; + virtual string_type do_negative_sign() const; + virtual int do_frac_digits() const; + +private: + moneypunct_byname _STLP_PSPEC2(wchar_t, false) (_Locale_monetary *__monetary); + + typedef moneypunct_byname _Self; + //explicitely defined as private to avoid warnings: + moneypunct_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_monetary* _M_monetary; +}; +#endif + +//===== methods ====== + + +// money_put facets + +template +class money_put : public locale::facet { +public: + typedef _CharT char_type; + typedef _OutputIter iter_type; + typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type; + + explicit money_put(size_t __refs = 0) : locale::facet(__refs) {} + iter_type put(iter_type __s, bool __intl, ios_base& __str, + char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const + { return do_put(__s, __intl, __str, __fill, __units); } + iter_type put(iter_type __s, bool __intl, ios_base& __str, + char_type __fill, + const string_type& __digits) const + { return do_put(__s, __intl, __str, __fill, __digits); } + + static locale::id id; + +protected: + ~money_put() {} + virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str, + char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const; + virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str, + char_type __fill, + const string_type& __digits) const; +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS money_get > >; +_STLP_EXPORT_TEMPLATE_CLASS money_put > >; +# if ! defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS money_get > >; +_STLP_EXPORT_TEMPLATE_CLASS money_put > >; +# endif +#endif + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_MONETARY_H */ + +// Local Variables: +// mode:C++ +// End: + + diff --git a/sdk/tlibstdcxx/stlport/stl/_move_construct_fwk.h b/sdk/tlibstdcxx/stlport/stl/_move_construct_fwk.h new file mode 100644 index 0000000000..4a85fe32de --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_move_construct_fwk.h @@ -0,0 +1,159 @@ +/* + * + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_MOVE_CONSTRUCT_FWK_H +#define _STLP_MOVE_CONSTRUCT_FWK_H + +#ifndef _STLP_TYPE_TRAITS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +/************************************************************* + * Move constructor framework + *************************************************************/ + +/************************************************************* + *Partial move: + *The source HAS to be a valid instance after the move! + *************************************************************/ +template +class __move_source { +public: + explicit __move_source (_Tp &_src) : _M_data(_src) + {} + + _Tp& get() const + { return _M_data; } +private: + _Tp &_M_data; + + //We explicitely forbid assignment to avoid warning: + typedef __move_source<_Tp> _Self; + _Self& operator = (_Self const&); +}; + +//Class used to signal move constructor support, implementation and type. +template +struct __move_traits { + /* + * implemented tells if a the special move constructor has to be called or the classic + * copy constructor is just fine. Most of the time the copy constructor is fine only + * if the following info is true. + */ +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && \ + !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \ + !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename _IsSTLportClass<_Tp>::_Ret implemented; +#else + typedef __false_type implemented; +#endif + /* + * complete tells if the move is complete or partial, that is to say, does the source + * needs to be destroyed once it has been moved. + */ +# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x564) + typedef __type_traits<_Tp>::has_trivial_destructor _TpMoveComplete; + typedef typename __bool2type<__type2bool<_TpMoveComplete>::_Ret>::_Ret complete; +# else + typedef typename __type_traits<_Tp>::has_trivial_destructor complete; +# endif +}; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +/* + * This struct should never be used if the user has not explicitely stipulated + * that its class support the full move concept. To check that the return type + * in such a case will be __invalid_source<_Tp> to generate a compile error + * revealing the configuration problem. + */ +template +struct _MoveSourceTraits { + typedef typename __move_traits<_Tp>::implemented _MvImpRet; +#if defined (__BORLANDC__) + typedef typename __selectT<_MvImpRet, +#else + enum {_MvImp = __type2bool<_MvImpRet>::_Ret}; + typedef typename __select<_MvImp, +#endif + __move_source<_Tp>, + _Tp const&>::_Ret _Type; +}; + +//The helper function +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits<_Tp>::_Type +_AsMoveSource (_Tp &src) { + typedef typename _MoveSourceTraits<_Tp>::_Type _SrcType; + return _SrcType(src); +} + +//Helper structs used for many class. +template +struct __move_traits_aux { + typedef typename __move_traits<_Tp>::implemented implemented; + typedef typename __move_traits<_Tp>::complete complete; +}; + +template +struct __move_traits_aux2 { + typedef __move_traits<_Tp1> _MoveTraits1; + typedef __move_traits<_Tp2> _MoveTraits2; + + typedef typename _Lor2::_Ret implemented; + typedef typename _Land2::_Ret complete; +}; + +/* + * Most of the time a class implement a move constructor but its use depends + * on a third party, this is what the following struct are for. + */ +template +struct __move_traits_help { + typedef __true_type implemented; + typedef typename __move_traits<_Tp>::complete complete; +}; + +template +struct __move_traits_help1 { + typedef __move_traits<_Tp1> _MoveTraits1; + typedef __move_traits<_Tp2> _MoveTraits2; + + typedef typename _Lor2::_Ret implemented; + typedef typename _Land2::_Ret complete; +}; + +template +struct __move_traits_help2 { + typedef __move_traits<_Tp1> _MoveTraits1; + typedef __move_traits<_Tp2> _MoveTraits2; + + typedef __true_type implemented; + typedef typename _Land2::_Ret complete; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_MOVE_CONSTRUCT_FWK_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/_new.h b/sdk/tlibstdcxx/stlport/stl/_new.h new file mode 100644 index 0000000000..25086375a3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_new.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_NEW +#define _STLP_INTERNAL_NEW + +#ifndef _STLP_INTERNAL_CSTDDEF +// size_t +# include +#endif + +#if defined (__BORLANDC__) && (__BORLANDC__ < 0x570) +// new.h uses ::malloc ;( +# include _STLP_NATIVE_CPP_C_HEADER(cstdlib) +using _STLP_VENDOR_CSTD::malloc; +#endif + +#if !defined (_STLP_NO_NEW_NEW_HEADER) +// eMbedded Visual C++ .NET unfortunately uses _INC_NEW for both and +// we undefine the symbol to get the stuff in the SDK's +# if defined (_STLP_WCE_NET) && defined (_INC_NEW) +# undef _INC_NEW +# endif + +# if defined (new) +/* STLport cannot replace native Std library new header if new is a macro, + * please define new macro after header inclusion. + */ +# error Cannot include native new header as new is a macro. +# endif + +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new) +# endif +#else +# include +#endif + +#if defined (_STLP_NO_BAD_ALLOC) && !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) +# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 +#endif + +#if defined (_STLP_USE_EXCEPTIONS) && defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) + +# ifndef _STLP_INTERNAL_EXCEPTION +# include +# endif + +_STLP_BEGIN_NAMESPACE + +# if defined (_STLP_NO_BAD_ALLOC) +struct nothrow_t {}; +# define nothrow nothrow_t() +# endif + +/* + * STLport own bad_alloc exception to be used if the native C++ library + * do not define it or when the new operator do not throw it to avoid + * a useless library dependency. + */ +class bad_alloc : public exception { +public: + bad_alloc () _STLP_NOTHROW_INHERENTLY { } + bad_alloc(const bad_alloc&) _STLP_NOTHROW_INHERENTLY { } + bad_alloc& operator=(const bad_alloc&) _STLP_NOTHROW_INHERENTLY {return *this;} + ~bad_alloc () _STLP_NOTHROW_INHERENTLY { } + const char* what() const _STLP_NOTHROW_INHERENTLY { return "bad alloc"; } +}; + +_STLP_END_NAMESPACE + +#endif /* _STLP_USE_EXCEPTIONS && (_STLP_NO_BAD_ALLOC || _STLP_NEW_DONT_THROW_BAD_ALLOC) */ + +#if defined (_STLP_USE_OWN_NAMESPACE) + +_STLP_BEGIN_NAMESPACE + +# if !defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) +using _STLP_VENDOR_EXCEPT_STD::bad_alloc; +# endif + +# if !defined (_STLP_NO_BAD_ALLOC) +using _STLP_VENDOR_EXCEPT_STD::nothrow_t; +using _STLP_VENDOR_EXCEPT_STD::nothrow; +# if defined (_STLP_GLOBAL_NEW_HANDLER) +using ::new_handler; +using ::set_new_handler; +# else +using _STLP_VENDOR_EXCEPT_STD::new_handler; +using _STLP_VENDOR_EXCEPT_STD::set_new_handler; +# endif +# endif /* !_STLP_NO_BAD_ALLOC */ + +_STLP_END_NAMESPACE +#endif /* _STLP_USE_OWN_NAMESPACE */ + +#ifndef _STLP_THROW_BAD_ALLOC +# if !defined (_STLP_USE_EXCEPTIONS) +# ifndef _STLP_INTERNAL_CSTDIO +# include +# endif +# define _STLP_THROW_BAD_ALLOC _STLP_ABORT(); //puts("out of memory\n"); exit(1) +# else +# define _STLP_THROW_BAD_ALLOC _STLP_THROW(_STLP_STD::bad_alloc()) +# endif +#endif + +#if defined (_STLP_NO_NEW_NEW_HEADER) || defined (_STLP_NEW_DONT_THROW_BAD_ALLOC) +# define _STLP_CHECK_NULL_ALLOC(__x) void* __y = __x; if (__y == 0) { _STLP_THROW_BAD_ALLOC; } return __y +#else +# define _STLP_CHECK_NULL_ALLOC(__x) return __x +#endif + +_STLP_BEGIN_NAMESPACE + +#if ((defined (__IBMCPP__) || defined (__OS400__) || defined (__xlC__) || defined (qTidyHeap)) && defined (_STLP_DEBUG_ALLOC)) +inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator new(__n, __FILE__, __LINE__)); } +inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p, __FILE__, __LINE__); } +#else +inline void* _STLP_CALL __stl_new(size_t __n) { _STLP_CHECK_NULL_ALLOC(::operator new(__n)); } +inline void _STLP_CALL __stl_delete(void* __p) { ::operator delete(__p); } +#endif +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_NEW */ + +/* + * Local Variables: + * mode:C++ + * End: + */ diff --git a/sdk/tlibstdcxx/stlport/stl/_num_get.c b/sdk/tlibstdcxx/stlport/stl/_num_get.c new file mode 100644 index 0000000000..1e7d23487e --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_num_get.c @@ -0,0 +1,623 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_NUM_GET_C +#define _STLP_NUM_GET_C + +#ifndef _STLP_INTERNAL_NUM_GET_H +# include +#endif + +#ifndef _STLP_INTERNAL_LIMITS +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_DECLSPEC unsigned char _STLP_CALL __digit_val_table(unsigned); +_STLP_DECLSPEC const char* _STLP_CALL __narrow_atoms(); + +// __do_get_integer, __do_get_float and its helper functions. + +inline bool _STLP_CALL __get_fdigit(char __c, const char*) +{ return __c >= '0' && __c <= '9'; } + +inline bool _STLP_CALL __get_fdigit_or_sep(char& __c, char __sep, const char *__digits) { + if (__c == __sep) { + __c = ',' ; + return true ; + } + else + return __get_fdigit(__c, __digits); +} + +inline int _STLP_CALL +__get_digit_from_table(unsigned __index) +{ return (__index > 127 ? 0xFF : __digit_val_table(__index)); } + +template +int +__get_base_or_zero(_InputIter& __in_ite, _InputIter& __end, + ios_base::fmtflags __flags, const ctype<_CharT>& __c_type) { + _CharT __atoms[5]; + __c_type.widen(__narrow_atoms(), __narrow_atoms() + 5, __atoms); + + bool __negative = false; + _CharT __c = *__in_ite; + + if (__c == __atoms[1] /* __xminus_char */ ) { + __negative = true; + ++__in_ite; + } + else if (__c == __atoms[0] /* __xplus_char */ ) + ++__in_ite; + + int __base; + int __valid_zero = 0; + + ios_base::fmtflags __basefield = __flags & ios_base::basefield; + + switch (__basefield) { + case ios_base::oct: + __base = 8; + break; + case ios_base::dec: + __base = 10; + break; + case ios_base::hex: + __base = 16; + if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) { + ++__in_ite; + if (__in_ite != __end && + (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) + ++__in_ite; + else + __valid_zero = 1; // That zero is valid by itself. + } + break; + default: + if (__in_ite != __end && *__in_ite == __atoms[2] /* __zero_char */ ) { + ++__in_ite; + if (__in_ite != __end && + (*__in_ite == __atoms[3] /* __x_char */ || *__in_ite == __atoms[4] /* __X_char */ )) { + ++__in_ite; + __base = 16; + } + else + { + __base = 8; + __valid_zero = 1; // That zero is still valid by itself. + } + } + else + __base = 10; + break; + } + return (__base << 2) | ((int)__negative << 1) | __valid_zero; +} + + +template +bool _STLP_CALL +__get_integer(_InputIter& __first, _InputIter& __last, + int __base, _Integer& __val, + int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __true_type& /*_IsSigned*/) { + bool __ovflow = false; + _Integer __result = 0; + bool __is_group = !__grouping.empty(); + char __group_sizes[64]; + char __current_group_size = 0; + char* __group_sizes_end = __group_sizes; + + _Integer __over_base = (numeric_limits<_Integer>::min)() / __STATIC_CAST(_Integer, __base); + + for ( ; __first != __last ; ++__first) { + + const _CharT __c = *__first; + + if (__is_group && __c == __separator) { + *__group_sizes_end++ = __current_group_size; + __current_group_size = 0; + continue; + } + + int __n = __get_digit_from_table(__c); + + if (__n >= __base) + break; + + ++__got; + ++__current_group_size; + + if (__result < __over_base) + __ovflow = true; // don't need to keep accumulating + else { + _Integer __next = __STATIC_CAST(_Integer, __base * __result - __n); + if (__result != 0) + __ovflow = __ovflow || __next >= __result; + __result = __next; + } + } + + if (__is_group && __group_sizes_end != __group_sizes) { + *__group_sizes_end++ = __current_group_size; + } + + // fbp : added to not modify value if nothing was read + if (__got > 0) { + __val = __ovflow ? __is_negative ? (numeric_limits<_Integer>::min)() + : (numeric_limits<_Integer>::max)() + : __is_negative ? __result + : __STATIC_CAST(_Integer, -__result); + } + // overflow is being treated as failure + return ((__got > 0) && !__ovflow) && + (__is_group == 0 || + __valid_grouping(__group_sizes, __group_sizes_end, + __grouping.data(), __grouping.data()+ __grouping.size())); +} + +template +bool _STLP_CALL +__get_integer(_InputIter& __first, _InputIter& __last, + int __base, _Integer& __val, + int __got, bool __is_negative, _CharT __separator, const string& __grouping, const __false_type& /*_IsSigned*/) { + bool __ovflow = false; + _Integer __result = 0; + bool __is_group = !__grouping.empty(); + char __group_sizes[64]; + char __current_group_size = 0; + char* __group_sizes_end = __group_sizes; + + _Integer __over_base = (numeric_limits<_Integer>::max)() / __STATIC_CAST(_Integer, __base); + + for ( ; __first != __last ; ++__first) { + + const _CharT __c = *__first; + + if (__is_group && __c == __separator) { + *__group_sizes_end++ = __current_group_size; + __current_group_size = 0; + continue; + } + + int __n = __get_digit_from_table(__c); + + if (__n >= __base) + break; + + ++__got; + ++__current_group_size; + + if (__result > __over_base) + __ovflow = true; //don't need to keep accumulating + else { + _Integer __next = __STATIC_CAST(_Integer, __base * __result + __n); + if (__result != 0) + __ovflow = __ovflow || __next <= __result; + __result = __next; + } + } + + if (__is_group && __group_sizes_end != __group_sizes) { + *__group_sizes_end++ = __current_group_size; + } + + // fbp : added to not modify value if nothing was read + if (__got > 0) { + __val = __ovflow ? (numeric_limits<_Integer>::max)() + : (__is_negative ? __STATIC_CAST(_Integer, -__result) + : __result); + } + + // overflow is being treated as failure + return ((__got > 0) && !__ovflow) && + (__is_group == 0 || + __valid_grouping(__group_sizes, __group_sizes_end, + __grouping.data(), __grouping.data()+ __grouping.size())); +} + + +template +bool _STLP_CALL +__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT* /*dummy*/) { + string __grp; + //Here there is no grouping so separator is not important, we just pass the default character. + return __get_integer(__first, __last, 10, __val, 0, false, _CharT() /*separator*/, __grp, __false_type()); +} + +template +_InputIter _STLP_CALL +__do_get_integer(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, + ios_base::iostate& __err, _Integer& __val, _CharT* /*__pc*/) { + locale __loc = __str.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + +#if defined (__HP_aCC) && (__HP_aCC == 1) + bool _IsSigned = !((_Integer)(-1) > 0); +#else + typedef typename __bool2type::is_signed>::_Ret _IsSigned; +#endif + + const int __base_or_zero = __get_base_or_zero(__in_ite, __end, __str.flags(), __ctype); + int __got = __base_or_zero & 1; + + bool __result; + + if (__in_ite == __end) { // We may have already read a 0. If so, + + if (__got > 0) { // the result is 0 even if we're at eof. + __val = 0; + __result = true; + } + else + __result = false; + } + else { + const numpunct<_CharT>& __np = use_facet >(__loc); + const bool __negative = (__base_or_zero & 2) != 0; + const int __base = __base_or_zero >> 2; + +#if defined (__HP_aCC) && (__HP_aCC == 1) + if (_IsSigned) + __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __true_type() ); + else + __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), __false_type() ); +#else + __result = __get_integer(__in_ite, __end, __base, __val, __got, __negative, __np.thousands_sep(), __np.grouping(), _IsSigned()); +# endif + } + + __err = __STATIC_CAST(ios_base::iostate, __result ? ios_base::goodbit : ios_base::failbit); + + if (__in_ite == __end) + __err |= ios_base::eofbit; + return __in_ite; +} + +// __read_float and its helper functions. +template +_InputIter _STLP_CALL +__copy_sign(_InputIter __first, _InputIter __last, __iostring& __v, + _CharT __xplus, _CharT __xminus) { + if (__first != __last) { + _CharT __c = *__first; + if (__c == __xplus) + ++__first; + else if (__c == __xminus) { + __v.push_back('-'); + ++__first; + } + } + return __first; +} + + +template +bool _STLP_CALL +__copy_digits(_InputIter& __first, _InputIter __last, + __iostring& __v, const _CharT* __digits) { + bool __ok = false; + + for ( ; __first != __last; ++__first) { + _CharT __c = *__first; + if (__get_fdigit(__c, __digits)) { + __v.push_back((char)__c); + __ok = true; + } + else + break; + } + return __ok; +} + +template +bool _STLP_CALL +__copy_grouped_digits(_InputIter& __first, _InputIter __last, + __iostring& __v, const _CharT * __digits, + _CharT __sep, const string& __grouping, + bool& __grouping_ok) { + bool __ok = false; + char __group_sizes[64]; + char*__group_sizes_end = __group_sizes; + char __current_group_size = 0; + + for ( ; __first != __last; ++__first) { + _CharT __c = *__first; + bool __tmp = __get_fdigit_or_sep(__c, __sep, __digits); + if (__tmp) { + if (__c == ',') { + *__group_sizes_end++ = __current_group_size; + __current_group_size = 0; + } + else { + __ok = true; + __v.push_back((char)__c); + ++__current_group_size; + } + } + else + break; + } + + if (__group_sizes_end != __group_sizes) + *__group_sizes_end++ = __current_group_size; + __grouping_ok = __valid_grouping(__group_sizes, __group_sizes_end, __grouping.data(), __grouping.data() + __grouping.size()); + return __ok; +} + + +template +bool _STLP_CALL +__read_float(__iostring& __buf, _InputIter& __in_ite, _InputIter& __end, + const ctype<_CharT> &__ct, const numpunct<_CharT> &__numpunct) { + // Create a string, copying characters of the form + // [+-]? [0-9]* .? [0-9]* ([eE] [+-]? [0-9]+)? + + string __grouping = __numpunct.grouping(); + bool __digits_before_dot /* = false */; + bool __digits_after_dot = false; + bool __ok; + + bool __grouping_ok = true; + + _CharT __dot = __numpunct.decimal_point(); + _CharT __sep = __numpunct.thousands_sep(); + + _CharT __digits[10]; + _CharT __xplus; + _CharT __xminus; + + _CharT __pow_e; + _CharT __pow_E; + + _Initialize_get_float(__ct, __xplus, __xminus, __pow_e, __pow_E, __digits); + + // Get an optional sign + __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus); + + // Get an optional string of digits. + if (!__grouping.empty()) + __digits_before_dot = __copy_grouped_digits(__in_ite, __end, __buf, __digits, + __sep, __grouping, __grouping_ok); + else + __digits_before_dot = __copy_digits(__in_ite, __end, __buf, __digits); + + // Get an optional decimal point, and an optional string of digits. + if (__in_ite != __end && *__in_ite == __dot) { + __buf.push_back('.'); + ++__in_ite; + __digits_after_dot = __copy_digits(__in_ite, __end, __buf, __digits); + } + + // There have to be some digits, somewhere. + __ok = __digits_before_dot || __digits_after_dot; + + // Get an optional exponent. + if (__ok && __in_ite != __end && (*__in_ite == __pow_e || *__in_ite == __pow_E)) { + __buf.push_back('e'); + ++__in_ite; + __in_ite = __copy_sign(__in_ite, __end, __buf, __xplus, __xminus); + __ok = __copy_digits(__in_ite, __end, __buf, __digits); + // If we have an exponent then the sign + // is optional but the digits aren't. + } + + return __ok; +} + +template +_InputIter _STLP_CALL +__do_get_float(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, + ios_base::iostate& __err, _Float& __val, _CharT* /*__pc*/) { + locale __loc = __str.getloc(); + const ctype<_CharT> &__ctype = use_facet >(__loc); + const numpunct<_CharT> &__numpunct = use_facet >(__loc); + + __iostring __buf ; + bool __ok = __read_float(__buf, __in_ite, __end, __ctype, __numpunct); + if (__ok) { + __string_to_float(__buf, __val); + __err = ios_base::goodbit; + } + else { + __err = ios_base::failbit; + } + if (__in_ite == __end) + __err |= ios_base::eofbit; + return __in_ite; +} + +template +_InputIter _STLP_CALL +__do_get_alphabool(_InputIter& __in_ite, _InputIter& __end, ios_base& __str, + ios_base::iostate& __err, bool& __x, _CharT* /*__pc*/) { + const numpunct<_CharT>& __np = use_facet >(__str.getloc()); + const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __truename = __np.truename(); + const basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __falsename = __np.falsename(); + bool __true_ok = true; + bool __false_ok = true; + + size_t __n = 0; + for ( ; __in_ite != __end; ++__in_ite) { + _CharT __c = *__in_ite; + __true_ok = __true_ok && (__c == __truename[__n]); + __false_ok = __false_ok && (__c == __falsename[__n]); + ++__n; + + if ((!__true_ok && !__false_ok) || + (__true_ok && __n >= __truename.size()) || + (__false_ok && __n >= __falsename.size())) { + ++__in_ite; + break; + } + } + if (__true_ok && __n < __truename.size()) __true_ok = false; + if (__false_ok && __n < __falsename.size()) __false_ok = false; + + if (__true_ok || __false_ok) { + __err = ios_base::goodbit; + __x = __true_ok; + } + else + __err = ios_base::failbit; + + if (__in_ite == __end) + __err |= ios_base::eofbit; + + return __in_ite; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +// +// num_get<>, num_put<> +// + +template +locale::id num_get<_CharT, _InputIterator>::id; + +#if !defined (_STLP_NO_BOOL) +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, + ios_base& __s, ios_base::iostate& __err, bool& __x) const { + if (__s.flags() & ios_base::boolalpha) { + return _STLP_PRIV __do_get_alphabool(__in_ite, __end, __s, __err, __x, (_CharT*)0); + } + else { + long __lx; + _InputIter __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __s, __err, __lx, (_CharT*)0 ); + if (!(__err & ios_base::failbit)) { + if (__lx == 0) + __x = false; + else if (__lx == 1) + __x = true; + else + __err |= ios_base::failbit; + } + return __tmp; + } +} +#endif + +#if defined (_STLP_FIX_LIBRARY_ISSUES) +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, short& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, int& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +#endif + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, long& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + unsigned short& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + unsigned int& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + unsigned long& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + float& __val) const +{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + double& __val) const +{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + long double& __val) const +{ return _STLP_PRIV __do_get_float(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } +#endif + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + void*& __p) const { +#if defined (_STLP_LONG_LONG) && !defined (__MRC__) //*ty 12/07/2001 - MrCpp can not cast from long long to void* + unsigned _STLP_LONG_LONG __val; +#else + unsigned long __val; +#endif + iter_type __tmp = _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); + if (!(__err & ios_base::failbit)) + __p = __REINTERPRET_CAST(void*, __val); + return __tmp; +} + +#if defined (_STLP_LONG_LONG) +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + _STLP_LONG_LONG& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } + +template +_InputIter +num_get<_CharT, _InputIter>::do_get(_InputIter __in_ite, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, + unsigned _STLP_LONG_LONG& __val) const +{ return _STLP_PRIV __do_get_integer(__in_ite, __end, __str, __err, __val, (_CharT*)0 ); } +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_NUMERIC_FACETS_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_num_get.h b/sdk/tlibstdcxx/stlport/stl/_num_get.h new file mode 100644 index 0000000000..95f7935f93 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_num_get.h @@ -0,0 +1,237 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_NUM_GET_H +#define _STLP_INTERNAL_NUM_GET_H + +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H +# include +#endif + +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUMPUNCT_H +# include +#endif + +#ifndef _STLP_INTERNAL_CTYPE_H +# include +#endif + +#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H +# include +#endif + +#ifndef _STLP_FACETS_FWD_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// num_get facets + +template +class num_get: public locale::facet { +public: + typedef _CharT char_type; + typedef _InputIter iter_type; + + explicit num_get(size_t __refs = 0): locale::facet(__refs) {} + +#if !defined (_STLP_NO_BOOL) + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, bool& __val) const + { return do_get(__ii, __end, __str, __err, __val); } +#endif + +#if defined (_STLP_FIX_LIBRARY_ISSUES) + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, short& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, int& __val) const + { return do_get(__ii, __end, __str, __err, __val); } +#endif + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, long& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned short& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned int& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned long& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + +#if defined (_STLP_LONG_LONG) + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, _STLP_LONG_LONG& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const + { return do_get(__ii, __end, __str, __err, __val); } +#endif /* _STLP_LONG_LONG */ + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, float& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, double& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + +#if !defined (_STLP_NO_LONG_DOUBLE) + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, long double& __val) const + { return do_get(__ii, __end, __str, __err, __val); } +# endif + + _InputIter get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, void*& __val) const + { return do_get(__ii, __end, __str, __err, __val); } + + static locale::id id; + +protected: + ~num_get() {} + + typedef string string_type; + typedef ctype<_CharT> _Ctype; + typedef numpunct<_CharT> _Numpunct; + +#if !defined (_STLP_NO_BOOL) + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, bool& __val) const; +#endif + + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, long& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned short& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned int& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned long& __val) const; + +#if defined (_STLP_FIX_LIBRARY_ISSUES) + // issue 118 : those are actually not supposed to be here + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, short& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, int& __val) const; +#endif + + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, float& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, double& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, void*& __p) const; + +#if !defined (_STLP_NO_LONG_DOUBLE) + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, long double& __val) const; +#endif + +#if defined (_STLP_LONG_LONG) + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, _STLP_LONG_LONG& __val) const; + virtual _InputIter do_get(_InputIter __ii, _InputIter __end, ios_base& __str, + ios_base::iostate& __err, unsigned _STLP_LONG_LONG& __val) const; +#endif + +}; + + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS num_get > >; +// _STLP_EXPORT_TEMPLATE_CLASS num_get; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS num_get > >; +// _STLP_EXPORT_TEMPLATE_CLASS num_get; +# endif +#endif + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_DECLSPEC bool _STLP_CALL __valid_grouping(const char*, const char*, const char*, const char*); + +template +bool _STLP_CALL +__get_decimal_integer(_InputIter& __first, _InputIter& __last, _Integer& __val, _CharT*); + +# if !defined (_STLP_NO_WCHAR_T) +bool _STLP_DECLSPEC _STLP_CALL __get_fdigit(wchar_t&, const wchar_t*); +bool _STLP_DECLSPEC _STLP_CALL __get_fdigit_or_sep(wchar_t&, wchar_t, const wchar_t*); +# endif + +inline void _STLP_CALL +_Initialize_get_float(const ctype&, + char& Plus, char& Minus, + char& pow_e, char& pow_E, + char*) { + Plus = '+'; + Minus = '-'; + pow_e = 'e'; + pow_E = 'E'; +} + +# if !defined (_STLP_NO_WCHAR_T) +void _STLP_DECLSPEC _STLP_CALL _Initialize_get_float(const ctype&, + wchar_t&, wchar_t&, wchar_t&, wchar_t&, wchar_t*); +# endif +void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, float&); +void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, double&); +# if !defined (_STLP_NO_LONG_DOUBLE) +void _STLP_DECLSPEC _STLP_CALL __string_to_float(const __iostring&, long double&); +# endif + +_STLP_MOVE_TO_STD_NAMESPACE + +#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */ + + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_NUM_GET_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_num_put.c b/sdk/tlibstdcxx/stlport/stl/_num_put.c new file mode 100644 index 0000000000..0c07838212 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_num_put.c @@ -0,0 +1,522 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_NUM_PUT_C +#define _STLP_NUM_PUT_C + +#ifndef _STLP_INTERNAL_NUM_PUT_H +# include +#endif + +#ifndef _STLP_INTERNAL_LIMITS +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// __do_put_float and its helper functions. Strategy: write the output +// to a buffer of char, transform the buffer to _CharT, and then copy +// it to the output. + +//---------------------------------------------------------------------- +// num_put facet + +template +_OutputIter _STLP_CALL +__copy_float_and_fill(const _CharT* __first, const _CharT* __last, + _OutputIter __oi, + ios_base::fmtflags __flags, + streamsize __width, _CharT __fill, + _CharT __xplus, _CharT __xminus) { + if (__width <= __last - __first) + return _STLP_STD::copy(__first, __last, __oi); + else { + streamsize __pad = __width - (__last - __first); + ios_base::fmtflags __dir = __flags & ios_base::adjustfield; + + if (__dir == ios_base::left) { + __oi = _STLP_STD::copy(__first, __last, __oi); + return _STLP_PRIV __fill_n(__oi, __pad, __fill); + } + else if (__dir == ios_base::internal && __first != __last && + (*__first == __xplus || *__first == __xminus)) { + *__oi++ = *__first++; + __oi = _STLP_PRIV __fill_n(__oi, __pad, __fill); + return _STLP_STD::copy(__first, __last, __oi); + } + else { + __oi = _STLP_PRIV __fill_n(__oi, __pad, __fill); + return _STLP_STD::copy(__first, __last, __oi); + } + } +} + +#if !defined (_STLP_NO_WCHAR_T) +// Helper routine for wchar_t +template +_OutputIter _STLP_CALL +__put_float(__iostring &__str, _OutputIter __oi, + ios_base& __f, wchar_t __fill, + wchar_t __decimal_point, wchar_t __sep, + size_t __group_pos, const string& __grouping) { + const ctype& __ct = use_facet >(__f.getloc()); + + __iowstring __wbuf; + __convert_float_buffer(__str, __wbuf, __ct, __decimal_point); + + if (!__grouping.empty()) { + __insert_grouping(__wbuf, __group_pos, __grouping, + __sep, __ct.widen('+'), __ct.widen('-'), 0); + } + + return __copy_float_and_fill(__wbuf.data(), __wbuf.data() + __wbuf.size(), __oi, + __f.flags(), __f.width(0), __fill, __ct.widen('+'), __ct.widen('-')); +} +#endif /* WCHAR_T */ + +// Helper routine for char +template +_OutputIter _STLP_CALL +__put_float(__iostring &__str, _OutputIter __oi, + ios_base& __f, char __fill, + char __decimal_point, char __sep, + size_t __group_pos, const string& __grouping) { + if ((__group_pos < __str.size()) && (__str[__group_pos] == '.')) { + __str[__group_pos] = __decimal_point; + } + + if (!__grouping.empty()) { + __insert_grouping(__str, __group_pos, + __grouping, __sep, '+', '-', 0); + } + + return __copy_float_and_fill(__str.data(), __str.data() + __str.size(), __oi, + __f.flags(), __f.width(0), __fill, '+', '-'); +} + +template +_OutputIter _STLP_CALL +__do_put_float(_OutputIter __s, ios_base& __f, + _CharT __fill, _Float __x) { + __iostring __buf; + + size_t __group_pos = __write_float(__buf, __f.flags(), (int)__f.precision(), __x); + + const numpunct<_CharT>& __np = use_facet >(__f.getloc()); + return __put_float(__buf, __s, __f, __fill, + __np.decimal_point(), __np.thousands_sep(), + __group_pos, __np.grouping()); +} + +inline void __get_money_digits_aux (__iostring &__buf, ios_base &, _STLP_LONGEST_FLOAT_TYPE __x) +{ __get_floor_digits(__buf, __x); } + +#if !defined (_STLP_NO_WCHAR_T) +inline void __get_money_digits_aux (__iowstring &__wbuf, ios_base &__f, _STLP_LONGEST_FLOAT_TYPE __x) { + __iostring __buf; + __get_floor_digits(__buf, __x); + + const ctype& __ct = use_facet >(__f.getloc()); + __convert_float_buffer(__buf, __wbuf, __ct, wchar_t(0), false); +} +#endif + +template +void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT) &__buf, ios_base& __f, _STLP_LONGEST_FLOAT_TYPE __x) +{ __get_money_digits_aux(__buf, __f, __x); } + +// _M_do_put_integer and its helper functions. + +template +_OutputIter _STLP_CALL +__copy_integer_and_fill(const _CharT* __buf, ptrdiff_t __len, + _OutputIter __oi, + ios_base::fmtflags __flg, streamsize __wid, _CharT __fill, + _CharT __xplus, _CharT __xminus) { + if (__len >= __wid) + return _STLP_STD::copy(__buf, __buf + __len, __oi); + else { + //casting numeric_limits::max to streamsize only works is ptrdiff_t is signed or streamsize representation + //is larger than ptrdiff_t one. + _STLP_STATIC_ASSERT((sizeof(streamsize) > sizeof(ptrdiff_t)) || + ((sizeof(streamsize) == sizeof(ptrdiff_t)) && numeric_limits::is_signed)) + ptrdiff_t __pad = __STATIC_CAST(ptrdiff_t, (min) (__STATIC_CAST(streamsize, (numeric_limits::max)()), + __STATIC_CAST(streamsize, __wid - __len))); + ios_base::fmtflags __dir = __flg & ios_base::adjustfield; + + if (__dir == ios_base::left) { + __oi = _STLP_STD::copy(__buf, __buf + __len, __oi); + return _STLP_PRIV __fill_n(__oi, __pad, __fill); + } + else if (__dir == ios_base::internal && __len != 0 && + (__buf[0] == __xplus || __buf[0] == __xminus)) { + *__oi++ = __buf[0]; + __oi = __fill_n(__oi, __pad, __fill); + return _STLP_STD::copy(__buf + 1, __buf + __len, __oi); + } + else if (__dir == ios_base::internal && __len >= 2 && + (__flg & ios_base::showbase) && + (__flg & ios_base::basefield) == ios_base::hex) { + *__oi++ = __buf[0]; + *__oi++ = __buf[1]; + __oi = __fill_n(__oi, __pad, __fill); + return _STLP_STD::copy(__buf + 2, __buf + __len, __oi); + } + else { + __oi = __fill_n(__oi, __pad, __fill); + return _STLP_STD::copy(__buf, __buf + __len, __oi); + } + } +} + +#if !defined (_STLP_NO_WCHAR_T) +// Helper function for wchar_t +template +_OutputIter _STLP_CALL +__put_integer(char* __buf, char* __iend, _OutputIter __s, + ios_base& __f, + ios_base::fmtflags __flags, wchar_t __fill) { + locale __loc = __f.getloc(); + const ctype& __ct = use_facet >(__loc); + + wchar_t __xplus = __ct.widen('+'); + wchar_t __xminus = __ct.widen('-'); + + wchar_t __wbuf[64]; + __ct.widen(__buf, __iend, __wbuf); + ptrdiff_t __len = __iend - __buf; + wchar_t* __eend = __wbuf + __len; + + const numpunct& __np = use_facet >(__loc); + const string& __grouping = __np.grouping(); + + if (!__grouping.empty()) { + int __basechars; + if (__flags & ios_base::showbase) + switch (__flags & ios_base::basefield) { + case ios_base::hex: __basechars = 2; break; + case ios_base::oct: __basechars = 1; break; + default: __basechars = 0; + } + else + __basechars = 0; + + __len = __insert_grouping(__wbuf, __eend, __grouping, __np.thousands_sep(), + __xplus, __xminus, __basechars); + } + + return __copy_integer_and_fill((wchar_t*)__wbuf, __len, __s, + __flags, __f.width(0), __fill, __xplus, __xminus); +} +#endif + +// Helper function for char +template +_OutputIter _STLP_CALL +__put_integer(char* __buf, char* __iend, _OutputIter __s, + ios_base& __f, ios_base::fmtflags __flags, char __fill) { + char __grpbuf[64]; + ptrdiff_t __len = __iend - __buf; + + const numpunct& __np = use_facet >(__f.getloc()); + const string& __grouping = __np.grouping(); + + if (!__grouping.empty()) { + int __basechars; + if (__flags & ios_base::showbase) + switch (__flags & ios_base::basefield) { + case ios_base::hex: __basechars = 2; break; + case ios_base::oct: __basechars = 1; break; + default: __basechars = 0; + } + else + __basechars = 0; + + // make sure there is room at the end of the buffer + // we pass to __insert_grouping + _STLP_STD::copy(__buf, __iend, (char *) __grpbuf); + __buf = __grpbuf; + __iend = __grpbuf + __len; + __len = __insert_grouping(__buf, __iend, __grouping, __np.thousands_sep(), + '+', '-', __basechars); + } + + return __copy_integer_and_fill(__buf, __len, __s, __flags, __f.width(0), __fill, '+', '-'); +} + +#if defined (_STLP_LONG_LONG) +typedef _STLP_LONG_LONG __max_int_t; +typedef unsigned _STLP_LONG_LONG __umax_int_t; +#else +typedef long __max_int_t; +typedef unsigned long __umax_int_t; +#endif + +_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_lo(); +_STLP_DECLSPEC const char* _STLP_CALL __hex_char_table_hi(); + +template +inline char* _STLP_CALL +__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __true_type& /* is_signed */) { + const bool __negative = __x < 0 ; + __max_int_t __temp = __x; + __umax_int_t __utemp = __negative?-__temp:__temp; + + for (; __utemp != 0; __utemp /= 10) + *--__ptr = (char)((int)(__utemp % 10) + '0'); + // put sign if needed or requested + if (__negative) + *--__ptr = '-'; + else if (__flags & ios_base::showpos) + *--__ptr = '+'; + return __ptr; +} + +template +inline char* _STLP_CALL +__write_decimal_backward(char* __ptr, _Integer __x, ios_base::fmtflags __flags, const __false_type& /* is_signed */) { + for (; __x != 0; __x /= 10) + *--__ptr = (char)((int)(__x % 10) + '0'); + // put sign if requested + if (__flags & ios_base::showpos) + *--__ptr = '+'; + return __ptr; +} + +template +char* _STLP_CALL +__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x) { + char* __ptr = __buf; + + if (__x == 0) { + *--__ptr = '0'; + if ((__flags & ios_base::showpos) && ((__flags & (ios_base::oct | ios_base::hex)) == 0)) + *--__ptr = '+'; + // oct or hex base shall not be added to the 0 value (see '#' flag in C formating strings) + } + else { + switch (__flags & ios_base::basefield) { + case ios_base::oct: + { + __umax_int_t __temp = __x; + // if the size of integer is less than 8, clear upper part + if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 ) + __temp &= 0xFFFFFFFF; + + for (; __temp != 0; __temp >>=3) + *--__ptr = (char)((((unsigned)__temp)& 0x7) + '0'); + + // put leading '0' if showbase is set + if (__flags & ios_base::showbase) + *--__ptr = '0'; + } + break; + case ios_base::hex: + { + const char* __table_ptr = (__flags & ios_base::uppercase) ? + __hex_char_table_hi() : __hex_char_table_lo(); + __umax_int_t __temp = __x; + // if the size of integer is less than 8, clear upper part + if ( sizeof(__x) < 8 && sizeof(__umax_int_t) >= 8 ) + __temp &= 0xFFFFFFFF; + + for (; __temp != 0; __temp >>=4) + *--__ptr = __table_ptr[((unsigned)__temp & 0xF)]; + + if (__flags & ios_base::showbase) { + *--__ptr = __table_ptr[16]; + *--__ptr = '0'; + } + } + break; + //case ios_base::dec: + default: + { +#if defined(__HP_aCC) && (__HP_aCC == 1) + bool _IsSigned = !((_Integer)-1 > 0); + if (_IsSigned) + __ptr = __write_decimal_backward(__ptr, __x, __flags, __true_type() ); + else + __ptr = __write_decimal_backward(__ptr, __x, __flags, __false_type() ); +#else + typedef typename __bool2type::is_signed>::_Ret _IsSigned; + __ptr = __write_decimal_backward(__ptr, __x, __flags, _IsSigned()); +#endif + } + break; + } + } + + // return pointer to beginning of the string + return __ptr; +} + +template +_OutputIter _STLP_CALL +__do_put_integer(_OutputIter __s, ios_base& __f, _CharT __fill, _Integer __x) { + // buffer size = number of bytes * number of digit necessary in the smallest Standard base (base 8, 3 digits/byte) + // plus the longest base representation '0x' + // Do not use __buf_size to define __buf static buffer, some compilers (HP aCC) do not accept const variable as + // the specification of a static buffer size. + char __buf[sizeof(_Integer) * 3 + 2]; + const ptrdiff_t __buf_size = sizeof(__buf) / sizeof(char); + ios_base::fmtflags __flags = __f.flags(); + char* __ibeg = __write_integer_backward((char*)__buf + __buf_size, __flags, __x); + return __put_integer(__ibeg, (char*)__buf + __buf_size, __s, __f, __flags, __fill); +} + +template +_OutputIter _STLP_CALL +__do_put_bool(_OutputIter __s, ios_base& __f, _CharT __fill, bool __x) { + const numpunct<_CharT>& __np = use_facet >(__f.getloc()); + + basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > __str = __x ? __np.truename() : __np.falsename(); + + streamsize __wid = __f.width(0); + if (__str.size() >= __STATIC_CAST(size_t, __wid)) + return _STLP_STD::copy(__str.begin(), __str.end(), __s); + else { + streamsize __pad = __wid - __str.size(); + ios_base::fmtflags __dir = __f.flags() & ios_base::adjustfield; + + if (__dir == ios_base::left) { + __s = _STLP_STD::copy(__str.begin(), __str.end(), __s); + return __fill_n(__s, __pad, __fill); + } + else /* covers right and internal padding */ { + __s = __fill_n(__s, __pad, __fill); + return _STLP_STD::copy(__str.begin(), __str.end(), __s); + } + } +} +_STLP_MOVE_TO_STD_NAMESPACE + +// +// num_put<> +// + +template +locale::id num_put<_CharT, _OutputIterator>::id; + +#if !defined (_STLP_NO_BOOL) +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + bool __val) const { + if (!(__f.flags() & ios_base::boolalpha)) + // 22.2.2.2.2.23: shall return do_put for int and not directly __do_put_integer. + return do_put(__s, __f, __fill, __STATIC_CAST(long, __val)); + + return _STLP_PRIV __do_put_bool(__s, __f, __fill, __val); +} +#endif + +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + long __val) const +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } + +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + unsigned long __val) const +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } + +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + double __val) const +{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); } + +#if !defined (_STLP_NO_LONG_DOUBLE) +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + long double __val) const +{ return _STLP_PRIV __do_put_float(__s, __f, __fill, __val); } +#endif + +#if defined (_STLP_LONG_LONG) +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + _STLP_LONG_LONG __val) const +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } + +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + unsigned _STLP_LONG_LONG __val) const +{ return _STLP_PRIV __do_put_integer(__s, __f, __fill, __val); } +#endif /* _STLP_LONG_LONG */ + + +// 22.2.2.2.2 Stage 1: "For conversion from void* the specifier is %p." +// This is not clear and I'm really don't follow this (below). +template +_OutputIter +num_put<_CharT, _OutputIter>::do_put(_OutputIter __s, ios_base& __f, _CharT /*__fill*/, + const void* __val) const { + const ctype<_CharT>& __c_type = use_facet >(__f.getloc()); + ios_base::fmtflags __save_flags = __f.flags(); + + __f.setf(ios_base::hex, ios_base::basefield); + __f.setf(ios_base::showbase); + __f.setf(ios_base::internal, ios_base::adjustfield); + __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix + if ( __val == 0 ) { + // base ('0x') not shown for null, but I really want to type it + // for pointer. Print it first in this case. + const char* __table_ptr = (__save_flags & ios_base::uppercase) ? + _STLP_PRIV __hex_char_table_hi() : _STLP_PRIV __hex_char_table_lo(); + __s++ = __c_type.widen( '0' ); + __s++ = __c_type.widen( __table_ptr[16] ); + __f.width((sizeof(void*) * 2)); // digits in pointer type + } else { + __f.width((sizeof(void*) * 2) + 2); // digits in pointer type plus '0x' prefix + } +#if defined (_STLP_MSVC) +# pragma warning (push) +# pragma warning (disable : 4311) //pointer truncation from 'const void*' to 'unsigned long' +#endif + _OutputIter result = +#ifdef _STLP_LONG_LONG + ( sizeof(void*) == sizeof(unsigned long) ) ? +#endif + _STLP_PRIV __do_put_integer(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned long,__val)) +#ifdef _STLP_LONG_LONG + : /* ( sizeof(void*) == sizeof(unsigned _STLP_LONG_LONG) ) ? */ + _STLP_PRIV __do_put_integer(__s, __f, __c_type.widen('0'), __REINTERPRET_CAST(unsigned _STLP_LONG_LONG,__val)) +#endif + ; +#if defined (_STLP_MSVC) +# pragma warning (pop) +#endif + __f.flags(__save_flags); + return result; +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_NUM_PUT_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_num_put.h b/sdk/tlibstdcxx/stlport/stl/_num_put.h new file mode 100644 index 0000000000..29bfc01cb5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_num_put.h @@ -0,0 +1,187 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_NUM_PUT_H +#define _STLP_INTERNAL_NUM_PUT_H + +#ifndef _STLP_INTERNAL_NUMPUNCT_H +# include +#endif + +#ifndef _STLP_INTERNAL_CTYPE_H +# include +#endif + +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H +# include +#endif + +#ifndef _STLP_FACETS_FWD_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// num_put facet + +template +class num_put: public locale::facet { +public: + typedef _CharT char_type; + typedef _OutputIter iter_type; + + explicit num_put(size_t __refs = 0) : locale::facet(__refs) {} + +#if !defined (_STLP_NO_BOOL) + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + bool __val) const { + return do_put(__s, __f, __fill, __val); + } +#endif + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + long __val) const { + return do_put(__s, __f, __fill, __val); + } + + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + unsigned long __val) const { + return do_put(__s, __f, __fill, __val); + } + +#if defined (_STLP_LONG_LONG) + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + _STLP_LONG_LONG __val) const { + return do_put(__s, __f, __fill, __val); + } + + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + unsigned _STLP_LONG_LONG __val) const { + return do_put(__s, __f, __fill, __val); + } +#endif + + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + double __val) const { + return do_put(__s, __f, __fill, (double)__val); + } + +#if !defined (_STLP_NO_LONG_DOUBLE) + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + long double __val) const { + return do_put(__s, __f, __fill, __val); + } +#endif + + iter_type put(iter_type __s, ios_base& __f, char_type __fill, + const void * __val) const { + return do_put(__s, __f, __fill, __val); + } + + static locale::id id; + +protected: + ~num_put() {} +#if !defined (_STLP_NO_BOOL) + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, bool __val) const; +#endif + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long __val) const; + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, unsigned long __val) const; + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, double __val) const; +#if !defined (_STLP_NO_LONG_DOUBLE) + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, long double __val) const; +#endif + +#if defined (_STLP_LONG_LONG) + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, _STLP_LONG_LONG __val) const; + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, + unsigned _STLP_LONG_LONG __val) const ; +#endif + virtual _OutputIter do_put(_OutputIter __s, ios_base& __f, _CharT __fill, const void* __val) const; +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS num_put > >; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS num_put > >; +# endif +#endif + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +char* _STLP_CALL +__write_integer_backward(char* __buf, ios_base::fmtflags __flags, _Integer __x); + +/* + * Returns the position on the right of the digits that has to be considered + * for the application of the grouping policy. + */ +extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, double); +# if !defined (_STLP_NO_LONG_DOUBLE) +extern size_t _STLP_CALL __write_float(__iostring&, ios_base::fmtflags, int, long double); +# endif + +/* + * Gets the digits of the integer part. + */ +void _STLP_CALL __get_floor_digits(__iostring&, _STLP_LONGEST_FLOAT_TYPE); + +template +void _STLP_CALL __get_money_digits(_STLP_BASIC_IOSTRING(_CharT)&, ios_base&, _STLP_LONGEST_FLOAT_TYPE); + +# if !defined (_STLP_NO_WCHAR_T) +extern void _STLP_CALL __convert_float_buffer(__iostring const&, __iowstring&, const ctype&, wchar_t, bool = true); +# endif +extern void _STLP_CALL __adjust_float_buffer(__iostring&, char); + +extern char* _STLP_CALL +__write_integer(char* buf, ios_base::fmtflags flags, long x); + +extern ptrdiff_t _STLP_CALL __insert_grouping(char* first, char* last, const string&, char, char, char, int); +extern void _STLP_CALL __insert_grouping(__iostring&, size_t, const string&, char, char, char, int); +# if !defined (_STLP_NO_WCHAR_T) +extern ptrdiff_t _STLP_CALL __insert_grouping(wchar_t*, wchar_t*, const string&, wchar_t, wchar_t, wchar_t, int); +extern void _STLP_CALL __insert_grouping(__iowstring&, size_t, const string&, wchar_t, wchar_t, wchar_t, int); +# endif + +_STLP_MOVE_TO_STD_NAMESPACE + +#endif /* _STLP_EXPOSE_STREAM_IMPLEMENTATION */ + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_NUMERIC_FACETS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_numeric.c b/sdk/tlibstdcxx/stlport/stl/_numeric.c new file mode 100644 index 0000000000..6bd07ff121 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_numeric.c @@ -0,0 +1,106 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_NUMERIC_C +#define _STLP_NUMERIC_C + +#ifndef _STLP_INTERNAL_NUMERIC_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIterator +__partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*, _BinaryOperation __binary_op) { + _STLP_DEBUG_CHECK(__check_range(__first, __last)) + if (__first == __last) return __result; + *__result = *__first; + + _Tp __val = *__first; + while (++__first != __last) { + __val = __binary_op(__val, *__first); + *++__result = __val; + } + return ++__result; +} + +template +_OutputIterator +__adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*, + _BinaryOperation __binary_op) { + _STLP_DEBUG_CHECK(__check_range(__first, __last)) + if (__first == __last) return __result; + *__result = *__first; + _Tp __val = *__first; + while (++__first != __last) { + _Tp __tmp = *__first; + *++__result = __binary_op(__tmp, __val); + __val = __tmp; + } + return ++__result; +} + + +template +_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr) { + _STLP_MPWFIX_TRY + if (__n == 0) + return __identity_element(__opr); + else { + while ((__n & 1) == 0) { + __n >>= 1; + __x = __opr(__x, __x); + } + _Tp __result = __x; + _STLP_MPWFIX_TRY + __n >>= 1; + while (__n != 0) { + __x = __opr(__x, __x); + if ((__n & 1) != 0) + __result = __opr(__result, __x); + __n >>= 1; + } + return __result; + _STLP_MPWFIX_CATCH + } + _STLP_MPWFIX_CATCH_ACTION(__x = _Tp()) +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_NUMERIC_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_numeric.h b/sdk/tlibstdcxx/stlport/stl/_numeric.h new file mode 100644 index 0000000000..4844da165a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_numeric.h @@ -0,0 +1,191 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_NUMERIC_H +#define _STLP_INTERNAL_NUMERIC_H + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +_STLP_INLINE_LOOP +_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + _Init = _Init + *__first; + return _Init; +} + +template +_STLP_INLINE_LOOP +_Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init, + _BinaryOperation __binary_op) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + for ( ; __first != __last; ++__first) + _Init = __binary_op(_Init, *__first); + return _Init; +} + +template +_STLP_INLINE_LOOP +_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp _Init) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + for ( ; __first1 != __last1; ++__first1, ++__first2) + _Init = _Init + (*__first1 * *__first2); + return _Init; +} + +template +_STLP_INLINE_LOOP +_Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp _Init, + _BinaryOperation1 __binary_op1, + _BinaryOperation2 __binary_op2) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1)) + for ( ; __first1 != __last1; ++__first1, ++__first2) + _Init = __binary_op1(_Init, __binary_op2(*__first1, *__first2)); + return _Init; +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIterator +__partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*, _BinaryOperation __binary_op); + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _OutputIterator +partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result) { + return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator), + _STLP_PRIV __plus(_STLP_VALUE_TYPE(__first, _InputIterator))); +} + +template +inline _OutputIterator +partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOperation __binary_op) { + return _STLP_PRIV __partial_sum(__first, __last, __result, _STLP_VALUE_TYPE(__first, _InputIterator), + __binary_op); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_OutputIterator +__adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp*, + _BinaryOperation __binary_op); + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _OutputIterator +adjacent_difference(_InputIterator __first, + _InputIterator __last, _OutputIterator __result) { + return _STLP_PRIV __adjacent_difference(__first, __last, __result, + _STLP_VALUE_TYPE(__first, _InputIterator), + _STLP_PRIV __minus(_STLP_VALUE_TYPE(__first, _InputIterator))); +} + +template +_OutputIterator +adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOperation __binary_op) { + return _STLP_PRIV __adjacent_difference(__first, __last, __result, + _STLP_VALUE_TYPE(__first, _InputIterator), + __binary_op); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_Tp __power(_Tp __x, _Integer __n, _MonoidOperation __opr); + +_STLP_MOVE_TO_STD_NAMESPACE + +#if !defined (_STLP_NO_EXTENSIONS) + +// Returns __x ** __n, where __n >= 0. _Note that "multiplication" +// is required to be associative, but not necessarily commutative. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _Tp __power(_Tp __x, _Integer __n) { + return __power(__x, __n, multiplies<_Tp>()); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +// Alias for the internal name __power. Note that power is an extension, +// not part of the C++ standard. +template +inline _Tp power(_Tp __x, _Integer __n, _MonoidOperation __opr) { + return _STLP_PRIV __power(__x, __n, __opr); +} + +template +inline _Tp power(_Tp __x, _Integer __n) { + return _STLP_PRIV __power(__x, __n, multiplies<_Tp>()); +} + +// iota is not part of the C++ standard. It is an extension. + +template +_STLP_INLINE_LOOP +void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __val) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + while (__first != __last) + *__first++ = __val++; +} +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_NUMERIC_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_numpunct.h b/sdk/tlibstdcxx/stlport/stl/_numpunct.h new file mode 100644 index 0000000000..c0d0ff4d58 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_numpunct.h @@ -0,0 +1,176 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_NUMPUNCT_H +#define _STLP_INTERNAL_NUMPUNCT_H + +#ifndef _STLP_IOS_BASE_H +# include +#endif + +# ifndef _STLP_C_LOCALE_H +# include +# endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// numpunct facets + +template class numpunct {}; +template class numpunct_byname {}; +template class num_get; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC numpunct : public locale::facet { +public: + typedef char char_type; + typedef string string_type; + + explicit numpunct(size_t __refs = 0) + : locale::facet(__refs) {} + + char decimal_point() const { return do_decimal_point(); } + char thousands_sep() const { return do_thousands_sep(); } + string grouping() const { return do_grouping(); } + string truename() const { return do_truename(); } + string falsename() const { return do_falsename(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~numpunct(); + + virtual char do_decimal_point() const; + virtual char do_thousands_sep() const; + virtual string do_grouping() const; + virtual string do_truename() const; + virtual string do_falsename() const; +}; + +# if ! defined (_STLP_NO_WCHAR_T) + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC numpunct : public locale::facet { +public: + typedef wchar_t char_type; + typedef wstring string_type; + + explicit numpunct(size_t __refs = 0) + : locale::facet(__refs) {} + + wchar_t decimal_point() const { return do_decimal_point(); } + wchar_t thousands_sep() const { return do_thousands_sep(); } + string grouping() const { return do_grouping(); } + wstring truename() const { return do_truename(); } + wstring falsename() const { return do_falsename(); } + + static _STLP_STATIC_DECLSPEC locale::id id; + +protected: + ~numpunct(); + + virtual wchar_t do_decimal_point() const; + virtual wchar_t do_thousands_sep() const; + virtual string do_grouping() const; + virtual wstring do_truename() const; + virtual wstring do_falsename() const; +}; + +# endif /* WCHAR_T */ + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC numpunct_byname : public numpunct { + friend class _Locale_impl; +public: + typedef char char_type; + typedef string string_type; + + explicit numpunct_byname(const char* __name, size_t __refs = 0); + +protected: + + ~numpunct_byname(); + + virtual char do_decimal_point() const; + virtual char do_thousands_sep() const; + virtual string do_grouping() const; + virtual string do_truename() const; + virtual string do_falsename() const; + +private: + numpunct_byname(_Locale_numeric *__numeric) + : _M_numeric(__numeric) {} + + //explicitely defined as private to avoid warnings: + typedef numpunct_byname _Self; + numpunct_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_numeric* _M_numeric; +}; + +# ifndef _STLP_NO_WCHAR_T +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC numpunct_byname: public numpunct { + friend class _Locale_impl; +public: + typedef wchar_t char_type; + typedef wstring string_type; + + explicit numpunct_byname(const char* __name, size_t __refs = 0); + +protected: + ~numpunct_byname(); + + virtual wchar_t do_decimal_point() const; + virtual wchar_t do_thousands_sep() const; + virtual string do_grouping() const; + virtual wstring do_truename() const; + virtual wstring do_falsename() const; + +private: + numpunct_byname(_Locale_numeric *__numeric) + : _M_numeric(__numeric) {} + + //explicitely defined as private to avoid warnings: + typedef numpunct_byname _Self; + numpunct_byname(_Self const&); + _Self& operator = (_Self const&); + + _Locale_numeric* _M_numeric; +}; + +# endif /* WCHAR_T */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_NUMPUNCT_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_ostream.c b/sdk/tlibstdcxx/stlport/stl/_ostream.c new file mode 100644 index 0000000000..faba6c272a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ostream.c @@ -0,0 +1,455 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_OSTREAM_C +#define _STLP_OSTREAM_C + +#ifndef _STLP_INTERNAL_OSTREAM_H +# include +#endif + +#if !defined (_STLP_INTERNAL_NUM_PUT_H) +# include // For basic_streambuf and iterators +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Definitions of non-inline member functions. + +// Constructor, destructor + +template +basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<_CharT, _Traits>* __buf) + : basic_ios<_CharT, _Traits>() { + this->init(__buf); +} + +template +basic_ostream<_CharT, _Traits>::~basic_ostream() +{} + +// Output directly from a streambuf. +template +basic_ostream<_CharT, _Traits>& +basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) { + sentry __sentry(*this); + if (__sentry) { + if (__from) { + bool __any_inserted = __from->gptr() != __from->egptr() + ? this->_M_copy_buffered(__from, this->rdbuf()) + : this->_M_copy_unbuffered(__from, this->rdbuf()); + if (!__any_inserted) + this->setstate(ios_base::failbit); + } + else + this->setstate(ios_base::badbit); + } + + return *this; +} + +// Helper functions for the streambuf version of operator<<. The +// exception-handling code is complicated because exceptions thrown +// while extracting characters are treated differently than exceptions +// thrown while inserting characters. + +template +bool basic_ostream<_CharT, _Traits> + ::_M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from, + basic_streambuf<_CharT, _Traits>* __to) { + bool __any_inserted = false; + + while (__from->egptr() != __from->gptr()) { + const ptrdiff_t __avail = __from->egptr() - __from->gptr(); + + streamsize __nwritten; + _STLP_TRY { + __nwritten = __to->sputn(__from->gptr(), __avail); + __from->gbump((int)__nwritten); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + return __any_inserted; + } + + if (__nwritten == __avail) { + _STLP_TRY { + if (this->_S_eof(__from->sgetc())) + return true; + else + __any_inserted = true; + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::failbit); + return false; + } + } + else if (__nwritten != 0) + return true; + else + return __any_inserted; + } + + // No characters are in the buffer, but we aren't at EOF. Switch to + // unbuffered mode. + return __any_inserted || this->_M_copy_unbuffered(__from, __to); +} + +/* + * Helper struct (guard) to put back a character in a streambuf + * whenever an exception or an eof occur. + */ +template +struct _SPutBackC { + typedef basic_streambuf<_CharT, _Traits> _StreamBuf; + typedef typename _StreamBuf::int_type int_type; + _SPutBackC(_StreamBuf *pfrom) + : __pfrom(pfrom), __c(0), __do_guard(false) {} + ~_SPutBackC() { + if (__do_guard) { + __pfrom->sputbackc(_Traits::to_char_type(__c)); + } + } + + void guard(int_type c) { + __c = c; + __do_guard = true; + } + void release() { + __do_guard = false; + } + +private: + _StreamBuf *__pfrom; + int_type __c; + bool __do_guard; +}; + +template +bool basic_ostream<_CharT, _Traits> + ::_M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from, + basic_streambuf<_CharT, _Traits>* __to) { + typedef _SPutBackC<_CharT, _Traits> _SPutBackCGuard; + bool __any_inserted = false; + int_type __c; + + _STLP_TRY { + _SPutBackCGuard __cguard(__from); + for (;;) { + _STLP_TRY { + __c = __from->sbumpc(); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::failbit); + break; + } + + if (this->_S_eof(__c)) + break; + + __cguard.guard(__c); +#if defined (__DMC__) + _STLP_TRY { +#endif + if (this->_S_eof(__to->sputc(_Traits::to_char_type(__c)))) + break; + +#if defined (__DMC__) + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + break; + } +#endif + __cguard.release(); + __any_inserted = true; + } + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + return __any_inserted; +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Helper function for numeric output. +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +__put_num(basic_ostream<_CharT, _Traits>& __os, _Number __x) { + typedef typename basic_ostream<_CharT, _Traits>::sentry _Sentry; + _Sentry __sentry(__os); + bool __failed = true; + + if (__sentry) { + _STLP_TRY { + typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > _NumPut; + __failed = (use_facet<_NumPut>(__os.getloc())).put(ostreambuf_iterator<_CharT, _Traits>(__os.rdbuf()), + __os, __os.fill(), + __x).failed(); + } + _STLP_CATCH_ALL { + __os._M_handle_exception(ios_base::badbit); + } + } + if (__failed) + __os.setstate(ios_base::badbit); + return __os; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +/* + * In the following operators we try to limit code bloat by limiting the + * number of __put_num instanciations. + */ +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __x) { + _STLP_STATIC_ASSERT( sizeof(short) <= sizeof(long) ) + long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ? + __STATIC_CAST(long, __STATIC_CAST(unsigned short, __x)): __x; + return _STLP_PRIV __put_num(*this, __tmp); +} + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __x) { + _STLP_STATIC_ASSERT( sizeof(unsigned short) <= sizeof(unsigned long) ) + return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x)); +} + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __x) { + _STLP_STATIC_ASSERT( sizeof(int) <= sizeof(long) ) + long __tmp = ((this->flags() & _Basic_ios::basefield) != ios_base::dec) ? + __STATIC_CAST(long, __STATIC_CAST(unsigned int, __x)): __x; + return _STLP_PRIV __put_num(*this, __tmp); +} + +template +#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __x) { + _STLP_STATIC_ASSERT( sizeof(unsigned int) <= sizeof(unsigned long) ) +#else +/* We define this operator with size_t rather than unsigned int to avoid + * 64 bits warning. + */ +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(size_t __x) { + _STLP_STATIC_ASSERT( sizeof(size_t) <= sizeof(unsigned long) ) +#endif + return _STLP_PRIV __put_num(*this, __STATIC_CAST(unsigned long,__x)); +} + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __x) +{ return _STLP_PRIV __put_num(*this, __x); } + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __x) +{ return _STLP_PRIV __put_num(*this, __x); } + +#ifdef _STLP_LONG_LONG +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (_STLP_LONG_LONG __x) +{ return _STLP_PRIV __put_num(*this, __x); } + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<< (unsigned _STLP_LONG_LONG __x) +{ return _STLP_PRIV __put_num(*this, __x); } +#endif + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __x) +{ return _STLP_PRIV __put_num(*this, __STATIC_CAST(double,__x)); } + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __x) +{ return _STLP_PRIV __put_num(*this, __x); } + +#ifndef _STLP_NO_LONG_DOUBLE +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __x) +{ return _STLP_PRIV __put_num(*this, __x); } +#endif + +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __x) +{ return _STLP_PRIV __put_num(*this, __x); } + +#ifndef _STLP_NO_BOOL +template +basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __x) +{ return _STLP_PRIV __put_num(*this, __x); } +#endif + +template +void basic_ostream<_CharT, _Traits>::_M_put_char(_CharT __c) { + sentry __sentry(*this); + if (__sentry) { + bool __failed = true; + _STLP_TRY { + streamsize __npad = this->width() > 0 ? this->width() - 1 : 0; + // if (__npad <= 1) + if (__npad == 0) + __failed = this->_S_eof(this->rdbuf()->sputc(__c)); + else if ((this->flags() & ios_base::adjustfield) == ios_base::left) { + __failed = this->_S_eof(this->rdbuf()->sputc(__c)); + __failed = __failed || + this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; + } + else { + __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; + __failed = __failed || this->_S_eof(this->rdbuf()->sputc(__c)); + } + + this->width(0); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + + if (__failed) + this->setstate(ios_base::badbit); + } +} + +template +void basic_ostream<_CharT, _Traits>::_M_put_nowiden(const _CharT* __s) { + sentry __sentry(*this); + if (__sentry) { + bool __failed = true; + streamsize __n = _Traits::length(__s); + streamsize __npad = this->width() > __n ? this->width() - __n : 0; + + _STLP_TRY { + if (__npad == 0) + __failed = this->rdbuf()->sputn(__s, __n) != __n; + else if ((this->flags() & ios_base::adjustfield) == ios_base::left) { + __failed = this->rdbuf()->sputn(__s, __n) != __n; + __failed = __failed || + this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; + } + else { + __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; + __failed = __failed || this->rdbuf()->sputn(__s, __n) != __n; + } + + this->width(0); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + + if (__failed) + this->setstate(ios_base::failbit); + } +} + +template +void basic_ostream<_CharT, _Traits>::_M_put_widen(const char* __s) { + sentry __sentry(*this); + if (__sentry) { + bool __failed = true; + streamsize __n = char_traits::length(__s); + streamsize __npad = this->width() > __n ? this->width() - __n : 0; + + _STLP_TRY { + if (__npad == 0) + __failed = !this->_M_put_widen_aux(__s, __n); + else if ((this->flags() & ios_base::adjustfield) == ios_base::left) { + __failed = !this->_M_put_widen_aux(__s, __n); + __failed = __failed || + this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; + } + else { + __failed = this->rdbuf()->_M_sputnc(this->fill(), __npad) != __npad; + __failed = __failed || !this->_M_put_widen_aux(__s, __n); + } + + this->width(0); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + + if (__failed) + this->setstate(ios_base::failbit); + } +} + +template +bool basic_ostream<_CharT, _Traits>::_M_put_widen_aux(const char* __s, + streamsize __n) { + basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); + + for ( ; __n > 0 ; --__n) + if (this->_S_eof(__buf->sputc(this->widen(*__s++)))) + return false; + return true; +} + +// Unformatted output of a single character. +template +basic_ostream<_CharT, _Traits>& +basic_ostream<_CharT, _Traits>::put(char_type __c) { + sentry __sentry(*this); + bool __failed = true; + + if (__sentry) { + _STLP_TRY { + __failed = this->_S_eof(this->rdbuf()->sputc(__c)); + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + } + + if (__failed) + this->setstate(ios_base::badbit); + + return *this; +} + +// Unformatted output of a single character. +template +basic_ostream<_CharT, _Traits>& +basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) { + sentry __sentry(*this); + bool __failed = true; + + if (__sentry) { + _STLP_TRY { + __failed = this->rdbuf()->sputn(__s, __n) != __n; + } + _STLP_CATCH_ALL { + this->_M_handle_exception(ios_base::badbit); + } + } + + if (__failed) + this->setstate(ios_base::badbit); + + return *this; +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_OSTREAM_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_ostream.h b/sdk/tlibstdcxx/stlport/stl/_ostream.h new file mode 100644 index 0000000000..3335b66f5e --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ostream.h @@ -0,0 +1,387 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + + +#ifndef _STLP_INTERNAL_OSTREAM_H +#define _STLP_INTERNAL_OSTREAM_H + +#ifndef _STLP_INTERNAL_IOS_H +# include // For basic_ios<>. Includes . +#endif + +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H +# include +#endif + +#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) && !defined (_STLP_INTERNAL_EXCEPTION) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +template +class _Osentry; +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +bool __init_bostr(basic_ostream<_CharT, _Traits>& __str); + +_STLP_MOVE_TO_STD_NAMESPACE + +//---------------------------------------------------------------------- +// class basic_ostream<> + +template +class basic_ostream : virtual public basic_ios<_CharT, _Traits> { + typedef basic_ostream<_CharT, _Traits> _Self; + +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) + //explicitely defined as private to avoid warnings: + basic_ostream(_Self const&); + _Self& operator = (_Self const&); +#endif + +public: // Types + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + typedef basic_ios<_CharT, _Traits> _Basic_ios; + +public: // Constructor and destructor. + explicit basic_ostream(basic_streambuf<_CharT, _Traits>* __buf); + ~basic_ostream(); + +public: // Hooks for manipulators. + typedef basic_ios<_CharT, _Traits>& (_STLP_CALL *__ios_fn)(basic_ios<_CharT, _Traits>&); + typedef ios_base& (_STLP_CALL *__ios_base_fn)(ios_base&); + typedef _Self& (_STLP_CALL *__ostream_fn)(_Self&); + _Self& operator<< (__ostream_fn __f) { return __f(*this); } + _Self & operator<< (__ios_base_fn __f) { __f(*this); return *this; } + _Self& operator<< (__ios_fn __ff) { __ff(*this); return *this; } + +private: + bool _M_copy_buffered(basic_streambuf<_CharT, _Traits>* __from, + basic_streambuf<_CharT, _Traits>* __to); + bool _M_copy_unbuffered(basic_streambuf<_CharT, _Traits>* __from, + basic_streambuf<_CharT, _Traits>* __to); + +public: + void _M_put_char(_CharT __c); + + void _M_put_nowiden(const _CharT* __s); + void _M_put_widen(const char* __s); + bool _M_put_widen_aux(const char* __s, streamsize __n); + +public: // Unformatted output. + _Self& put(char_type __c); + _Self& write(const char_type* __s, streamsize __n); + +public: // Formatted output. + // Formatted output from a streambuf. + _Self& operator<<(basic_streambuf<_CharT, _Traits>* __buf); +# ifndef _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER + // this is needed for compiling with option char = unsigned + _Self& operator<<(unsigned char __x) { _M_put_char(__x); return *this; } +# endif + _Self& operator<<(short __x); + _Self& operator<<(unsigned short __x); + _Self& operator<<(int __x); +#if defined (_WIN64) || !defined (_STLP_MSVC) || (_STLP_MSVC < 1300) + _Self& operator<<(unsigned int __x); +#else +/* We define this operator with size_t rather than unsigned int to avoid + * 64 bits warning. + */ + _Self& operator<<(size_t __x); +#endif + _Self& operator<<(long __x); + _Self& operator<<(unsigned long __x); +#ifdef _STLP_LONG_LONG + _Self& operator<< (_STLP_LONG_LONG __x); + _Self& operator<< (unsigned _STLP_LONG_LONG __x); +#endif + _Self& operator<<(float __x); + _Self& operator<<(double __x); +# ifndef _STLP_NO_LONG_DOUBLE + _Self& operator<<(long double __x); +# endif + _Self& operator<<(const void* __x); +# ifndef _STLP_NO_BOOL + _Self& operator<<(bool __x); +# endif + +public: // Buffer positioning and manipulation. + _Self& flush() { + if (this->rdbuf()) + if (this->rdbuf()->pubsync() == -1) + this->setstate(ios_base::badbit); + return *this; + } + + pos_type tellp() { + return this->rdbuf() && !this->fail() + ? this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out) + : pos_type(-1); + } + + _Self& seekp(pos_type __pos) { + if (this->rdbuf() && !this->fail()) { + if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) { + this->setstate(ios_base::failbit); + } + } + return *this; + } + + _Self& seekp(off_type __off, ios_base::seekdir __dir) { + if (this->rdbuf() && !this->fail()) + this->rdbuf()->pubseekoff(__off, __dir, ios_base::out); + return *this; + } + +#if defined (_STLP_USE_TEMPLATE_EXPORT) + // If we are using DLL specs, we have not to use inner classes + // end class declaration here + typedef _Osentry<_CharT, _Traits> sentry; +}; +# define sentry _Osentry + template + class _Osentry { + typedef _Osentry<_CharT, _Traits> _Self; +#else + class sentry { + typedef sentry _Self; +#endif + private: + basic_ostream<_CharT, _Traits>& _M_str; + // basic_streambuf<_CharT, _Traits>* _M_buf; + bool _M_ok; + public: + explicit sentry(basic_ostream<_CharT, _Traits>& __str) + : _M_str(__str), /* _M_buf(__str.rdbuf()), */ _M_ok(_STLP_PRIV __init_bostr(__str)) + {} + + ~sentry() { + if (_M_str.flags() & ios_base::unitbuf) +#if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) + if (!uncaught_exception()) +#endif + _M_str.flush(); + } + + operator bool() const { return _M_ok; } + private: // Disable assignment and copy constructor. + //Implementation is here only to avoid warning with some compilers. + sentry(const _Self& __s) : _M_str(__s._M_str) {} + _Self& operator=(const _Self&) { return *this; } + }; +#if defined (_STLP_USE_TEMPLATE_EXPORT) +# undef sentry +#else + // close basic_ostream class definition here +}; +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_ostream >; +_STLP_EXPORT_TEMPLATE_CLASS _Osentry >; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_ostream >; +_STLP_EXPORT_TEMPLATE_CLASS _Osentry >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Helper functions for istream<>::sentry constructor. +template +bool __init_bostr(basic_ostream<_CharT, _Traits>& __str) { + if (__str.good()) { + // boris : check if this is needed ! + if (!__str.rdbuf()) + __str.setstate(ios_base::badbit); + if (__str.tie()) + __str.tie()->flush(); + return __str.good(); + } + else + return false; +} + +template +inline basic_streambuf<_CharT, _Traits>* _STLP_CALL +__get_ostreambuf(basic_ostream<_CharT, _Traits>& __St) +{ return __St.rdbuf(); } + +_STLP_MOVE_TO_STD_NAMESPACE + +// Non-member functions. +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c){ + __os._M_put_char(__c); + return __os; +} + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s) { + __os._M_put_nowiden(__s); + return __os; +} + +#if defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) +// some specializations + +inline basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __os, char __c) { + __os._M_put_char(__c); + return __os; +} + +inline basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __os, signed char __c) { + __os._M_put_char(__c); + return __os; +} + +inline basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __os, unsigned char __c) { + __os._M_put_char(__c); + return __os; +} + +inline basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __os, const char* __s) { + __os._M_put_nowiden(__s); + return __os; +} + +inline basic_ostream >& _STLP_CALL +operator<<(basic_ostream >& __os, const signed char* __s) { + __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); + return __os; +} + +inline basic_ostream >& +operator<<(basic_ostream >& __os, const unsigned char* __s) { + __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); + return __os; +} + +#else + +// also for compilers who might use that +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, char __c) { + __os._M_put_char(__os.widen(__c)); + return __os; +} + +template +inline basic_ostream& _STLP_CALL +operator<<(basic_ostream& __os, char __c) { + __os._M_put_char(__c); + return __os; +} + +template +inline basic_ostream& _STLP_CALL +operator<<(basic_ostream& __os, signed char __c) { + __os._M_put_char(__c); + return __os; +} + +template +inline basic_ostream& _STLP_CALL +operator<<(basic_ostream& __os, unsigned char __c) { + __os._M_put_char(__c); + return __os; +} + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __s) { + __os._M_put_widen(__s); + return __os; +} + +template +inline basic_ostream& _STLP_CALL +operator<<(basic_ostream& __os, const char* __s) { + __os._M_put_nowiden(__s); + return __os; +} + +template +inline basic_ostream& _STLP_CALL +operator<<(basic_ostream& __os, const signed char* __s) { + __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); + return __os; +} + +template +inline basic_ostream& +operator<<(basic_ostream& __os, const unsigned char* __s) { + __os._M_put_nowiden(__REINTERPRET_CAST(const char*,__s)); + return __os; +} +#endif /* _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER */ + +//---------------------------------------------------------------------- +// basic_ostream manipulators. + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +endl(basic_ostream<_CharT, _Traits>& __os) { + __os.put(__os.widen('\n')); + __os.flush(); + return __os; +} + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +ends(basic_ostream<_CharT, _Traits>& __os) { + __os.put(_STLP_DEFAULT_CONSTRUCTED(_CharT)); + return __os; +} + +template +inline basic_ostream<_CharT, _Traits>& _STLP_CALL +flush(basic_ostream<_CharT, _Traits>& __os) { + __os.flush(); + return __os; +} + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_OSTREAM_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_ostreambuf_iterator.h b/sdk/tlibstdcxx/stlport/stl/_ostreambuf_iterator.h new file mode 100644 index 0000000000..d8865493c3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ostreambuf_iterator.h @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H +#define _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +extern basic_streambuf<_CharT, _Traits>* _STLP_CALL __get_ostreambuf(basic_ostream<_CharT, _Traits>&); + +_STLP_MOVE_TO_STD_NAMESPACE + +// The default template argument is declared in iosfwd +template +class ostreambuf_iterator : + public iterator { +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename _Traits::int_type int_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + +public: + ostreambuf_iterator(streambuf_type* __buf) _STLP_NOTHROW : _M_buf(__buf), _M_ok(__buf!=0) {} + // ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW : _M_buf(__get_ostreambuf(__o)), _M_ok(_M_buf != 0) {} + inline ostreambuf_iterator(ostream_type& __o) _STLP_NOTHROW; + + ostreambuf_iterator<_CharT, _Traits>& operator=(char_type __c) { + _M_ok = _M_ok && !traits_type::eq_int_type(_M_buf->sputc(__c), + traits_type::eof()); + return *this; + } + + ostreambuf_iterator<_CharT, _Traits>& operator*() { return *this; } + ostreambuf_iterator<_CharT, _Traits>& operator++() { return *this; } + ostreambuf_iterator<_CharT, _Traits>& operator++(int) { return *this; } + + bool failed() const { return !_M_ok; } + +private: + streambuf_type* _M_buf; + bool _M_ok; +}; + +template +inline ostreambuf_iterator<_CharT, _Traits>::ostreambuf_iterator(basic_ostream<_CharT, _Traits>& __o) _STLP_NOTHROW + : _M_buf(_STLP_PRIV __get_ostreambuf(__o)), _M_ok(_M_buf != 0) {} + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator >; +# if defined (INSTANTIATE_WIDE_STREAMS) +_STLP_EXPORT_TEMPLATE_CLASS ostreambuf_iterator >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +template +inline output_iterator_tag _STLP_CALL +iterator_category(const ostreambuf_iterator<_CharT, _Traits>&) { return output_iterator_tag(); } +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_pair.h b/sdk/tlibstdcxx/stlport/stl/_pair.h new file mode 100644 index 0000000000..7038bb1a15 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_pair.h @@ -0,0 +1,182 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_PAIR_H +#define _STLP_INTERNAL_PAIR_H + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# ifndef _STLP_TYPE_TRAITS_H +# include +# endif + +# if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC) +# include +# endif +#endif + +_STLP_BEGIN_NAMESPACE + +template +struct pair { + typedef _T1 first_type; + typedef _T2 second_type; + + _T1 first; + _T2 second; +#if defined (_STLP_CONST_CONSTRUCTOR_BUG) + pair() {} +#else + pair() : first(_T1()), second(_T2()) {} +#endif + pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} + +#if defined (_STLP_MEMBER_TEMPLATES) + template + pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} + + pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {} +#endif + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) + pair(__move_source > src) : first(_STLP_PRIV _AsMoveSource(src.get().first)), + second(_STLP_PRIV _AsMoveSource(src.get().second)) + {} +#endif + + __TRIVIAL_DESTRUCTOR(pair) +}; + +template +inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ return __x.first == __y.first && __x.second == __y.second; } + +template +inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { + return __x.first < __y.first || + (!(__y.first < __x.first) && __x.second < __y.second); +} + +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) +template +inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ return !(__x == __y); } + +template +inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ return __y < __x; } + +template +inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ return !(__y < __x); } + +template +inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) +{ return !(__x < __y); } +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS) +template +inline pair<_T1, _T2 const*> make_pair(_T1 const& __x, + _T2 const (&__y)[_Sz]) +{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); } + +template +inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz], + _T2 const& __y) +{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); } + +template +inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1], + _T2 const (&__y)[_Sz2]) { + return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x), + static_cast<_T2 const*>(__y)); +} +#endif + +template +inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y) +{ return pair<_T1, _T2>(__x, __y); } + +_STLP_END_NAMESPACE + +#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) +_STLP_BEGIN_RELOPS_NAMESPACE + +template +inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y) +{ return !(__x == __y); } + +template +inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y) +{ return __y < __x; } + +template +inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y) +{ return !(__y < __x); } + +template +inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y) +{ return !(__x < __y); } + +_STLP_END_RELOPS_NAMESPACE +#endif + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +_STLP_BEGIN_NAMESPACE + +template +struct __type_traits > { + typedef __type_traits<_T1> _T1Traits; + typedef __type_traits<_T2> _T2Traits; + typedef typename _Land2::_Ret has_trivial_default_constructor; + typedef typename _Land2::_Ret has_trivial_copy_constructor; + typedef typename _Land2::_Ret has_trivial_assignment_operator; + typedef typename _Land2::_Ret has_trivial_destructor; + typedef __false_type is_POD_type; +}; + +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > + : _STLP_PRIV __move_traits_help1<_T1, _T2> {}; +# endif + +_STLP_END_NAMESPACE +#endif + +#endif /* _STLP_INTERNAL_PAIR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_prolog.h b/sdk/tlibstdcxx/stlport/stl/_prolog.h new file mode 100644 index 0000000000..9705c2c674 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_prolog.h @@ -0,0 +1,18 @@ +/* NOTE : this header has no guards and is MEANT for multiple inclusion! + * If you are using "header protection" option with your compiler, + * please also find #pragma which disables it and put it here, to + * allow reentrancy of this header. + */ + +#include + +/* Get all debug things, potentially only empty macros if none of + * the debug features available in user config file is activated. */ + /* Thanks to _STLP_OUTERMOST_HEADER_ID we hide _debug.h when C standard + * headers are included as some platforms (Win32) include C standard headers + * in an 'extern "C"' scope which do not accept the templates exposed + * in _debug.h. */ +#if defined (__cplusplus) && !defined (_STLP_DEBUG_H) && \ + !((_STLP_OUTERMOST_HEADER_ID >= 0x200) && (_STLP_OUTERMOST_HEADER_ID <= 0x300)) +# include +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_pthread_alloc.h b/sdk/tlibstdcxx/stlport/stl/_pthread_alloc.h new file mode 100644 index 0000000000..f45d9497ba --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_pthread_alloc.h @@ -0,0 +1,461 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_PTHREAD_ALLOC_H +#define _STLP_PTHREAD_ALLOC_H + +/* + * Pthread-specific node allocator. + * This is similar to the default allocator, except that free-list + * information is kept separately for each thread, avoiding locking. + * This should be reasonably fast even in the presence of threads. + * The down side is that storage may not be well-utilized. + * It is not an error to allocate memory in thread A and deallocate + * it in thread B. But this effectively transfers ownership of the memory, + * so that it can only be reallocated by thread B. Thus this can effectively + * result in a storage leak if it's done on a regular basis. + * It can also result in frequent sharing of + * cache lines among processors, with potentially serious performance + * consequences. + */ + +#if !defined (_STLP_PTHREADS) +# error POSIX specific allocator implementation. Your system do not seems to \ +have this interface so please comment the _STLP_USE_PERTHREAD_ALLOC macro \ +or report to the STLport forum. +#endif + +#if defined (_STLP_USE_NO_IOSTREAMS) +# error You cannot use per thread allocator implementation without building \ +STLport libraries. +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +struct _Pthread_alloc_per_thread_state; + +// Pthread-specific allocator. +class _STLP_CLASS_DECLSPEC _Pthread_alloc { +public: // but only for internal use: + typedef _Pthread_alloc_per_thread_state __state_type; + typedef char value_type; + +public: + // Return a recycled or new per thread state. + static __state_type * _STLP_CALL _S_get_per_thread_state(); + + /* n must be > 0 */ + static void * _STLP_CALL allocate(size_t& __n); + + /* p may not be 0 */ + static void _STLP_CALL deallocate(void *__p, size_t __n); + + // boris : versions for per_thread_allocator + /* n must be > 0 */ + static void * _STLP_CALL allocate(size_t& __n, __state_type* __a); + + /* p may not be 0 */ + static void _STLP_CALL deallocate(void *__p, size_t __n, __state_type* __a); + + static void * _STLP_CALL reallocate(void *__p, size_t __old_sz, size_t& __new_sz); +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +typedef _STLP_PRIV _Pthread_alloc __pthread_alloc; +typedef __pthread_alloc pthread_alloc; + +template +class pthread_allocator : public __stlport_class > { + typedef pthread_alloc _S_Alloc; // The underlying allocator. +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + +#ifdef _STLP_MEMBER_TEMPLATE_CLASSES + template struct rebind { + typedef pthread_allocator<_NewType> other; + }; +#endif + + pthread_allocator() _STLP_NOTHROW {} + pthread_allocator(const pthread_allocator<_Tp>& a) _STLP_NOTHROW {} + +#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */ + template pthread_allocator(const pthread_allocator<_OtherType>&) + _STLP_NOTHROW {} +#endif + + ~pthread_allocator() _STLP_NOTHROW {} + + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + + // __n is permitted to be 0. The C++ standard says nothing about what + // the return value is when __n == 0. + _Tp* allocate(size_type __n, const void* = 0) { + if (__n > max_size()) { + _STLP_THROW_BAD_ALLOC; + } + if (__n != 0) { + size_type __buf_size = __n * sizeof(value_type); + _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size)); +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); +#endif + return __ret; + } + else + return 0; + } + + void deallocate(pointer __p, size_type __n) { + _STLP_ASSERT( (__p == 0) == (__n == 0) ) + if (__p != 0) { +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type)); +#endif + _S_Alloc::deallocate(__p, __n * sizeof(value_type)); + } + } + + size_type max_size() const _STLP_NOTHROW + { return size_t(-1) / sizeof(_Tp); } + + void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } + void destroy(pointer _p) { _p->~_Tp(); } + +#if defined (_STLP_NO_EXTENSIONS) + /* STLport extension giving rounded size of an allocated memory buffer + * This method do not have to be part of a user defined allocator implementation + * and won't even be called if such a function was granted. + */ +protected: +#endif + _Tp* allocate(size_type __n, size_type& __allocated_n) { + if (__n > max_size()) { + _STLP_THROW_BAD_ALLOC; + } + if (__n != 0) { + size_type __buf_size = __n * sizeof(value_type); + _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size)); +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); +#endif + __allocated_n = __buf_size / sizeof(value_type); + return __ret; + } + else + return 0; + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(pthread_allocator<_Tp>& __x) {} +#endif +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC pthread_allocator { +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; +#ifdef _STLP_MEMBER_TEMPLATE_CLASSES + template struct rebind { + typedef pthread_allocator<_NewType> other; + }; +#endif +}; + +template +inline bool operator==(const pthread_allocator<_T1>&, + const pthread_allocator<_T2>& a2) +{ return true; } + +#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER +template +inline bool operator!=(const pthread_allocator<_T1>&, + const pthread_allocator<_T2>&) +{ return false; } +#endif + + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + +template +struct _Alloc_traits<_Tp, pthread_allocator<_Atype> > +{ typedef pthread_allocator<_Tp> allocator_type; }; + +#endif + +#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) + +template +inline pthread_allocator<_Tp2>& +__stl_alloc_rebind(pthread_allocator<_Tp1>& __x, const _Tp2*) +{ return (pthread_allocator<_Tp2>&)__x; } + +template +inline pthread_allocator<_Tp2> +__stl_alloc_create(pthread_allocator<_Tp1>&, const _Tp2*) +{ return pthread_allocator<_Tp2>(); } + +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct __pthread_alloc_type_traits { + typedef typename _IsSTLportClass >::_Ret _STLportAlloc; + //The default allocator implementation which is recognize thanks to the + //__stlport_class inheritance is a stateless object so: + typedef _STLportAlloc has_trivial_default_constructor; + typedef _STLportAlloc has_trivial_copy_constructor; + typedef _STLportAlloc has_trivial_assignment_operator; + typedef _STLportAlloc has_trivial_destructor; + typedef _STLportAlloc is_POD_type; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits<_Tp> {}; +#else +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits {}; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits {}; +# endif +# if defined (_STLP_USE_PTR_SPECIALIZATIONS) +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __pthread_alloc_type_traits {}; +# endif +#endif + +// +// per_thread_allocator<> : this allocator always return memory to the same thread +// it was allocated from. +// + +template +class per_thread_allocator { + typedef pthread_alloc _S_Alloc; // The underlying allocator. + typedef pthread_alloc::__state_type __state_type; +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + +#ifdef _STLP_MEMBER_TEMPLATE_CLASSES + template struct rebind { + typedef per_thread_allocator<_NewType> other; + }; +#endif + + per_thread_allocator() _STLP_NOTHROW { + _M_state = _S_Alloc::_S_get_per_thread_state(); + } + per_thread_allocator(const per_thread_allocator<_Tp>& __a) _STLP_NOTHROW : _M_state(__a._M_state){} + +#if defined (_STLP_MEMBER_TEMPLATES) /* && defined (_STLP_FUNCTION_PARTIAL_ORDER) */ + template per_thread_allocator(const per_thread_allocator<_OtherType>& __a) + _STLP_NOTHROW : _M_state(__a._M_state) {} +#endif + + ~per_thread_allocator() _STLP_NOTHROW {} + + pointer address(reference __x) const { return &__x; } + const_pointer address(const_reference __x) const { return &__x; } + + // __n is permitted to be 0. The C++ standard says nothing about what + // the return value is when __n == 0. + _Tp* allocate(size_type __n, const void* = 0) { + if (__n > max_size()) { + _STLP_THROW_BAD_ALLOC; + } + if (__n != 0) { + size_type __buf_size = __n * sizeof(value_type); + _Tp* __ret = __REINTERPRET_CAST(_Tp*, _S_Alloc::allocate(__buf_size, _M_state)); +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); +#endif + return __ret; + } + else + return 0; + } + + void deallocate(pointer __p, size_type __n) { + _STLP_ASSERT( (__p == 0) == (__n == 0) ) + if (__p != 0) { +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type)); +#endif + _S_Alloc::deallocate(__p, __n * sizeof(value_type), _M_state); + } + } + + size_type max_size() const _STLP_NOTHROW + { return size_t(-1) / sizeof(_Tp); } + + void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } + void destroy(pointer _p) { _p->~_Tp(); } + + // state is being kept here + __state_type* _M_state; + +#if defined (_STLP_NO_EXTENSIONS) + /* STLport extension giving rounded size of an allocated memory buffer + * This method do not have to be part of a user defined allocator implementation + * and won't even be called if such a function was granted. + */ +protected: +#endif + _Tp* allocate(size_type __n, size_type& __allocated_n) { + if (__n > max_size()) { + _STLP_THROW_BAD_ALLOC; + } + if (__n != 0) { + size_type __buf_size = __n * sizeof(value_type); + _Tp* __ret = __REINTERPRET_CAST(value_type*, _S_Alloc::allocate(__buf_size, _M_state)); +#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC) + memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size); +#endif + __allocated_n = __buf_size / sizeof(value_type); + return __ret; + } + else + return 0; + } +}; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC per_thread_allocator { +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; +#ifdef _STLP_MEMBER_TEMPLATE_CLASSES + template struct rebind { + typedef per_thread_allocator<_NewType> other; + }; +#endif +}; + +template +inline bool operator==(const per_thread_allocator<_T1>& __a1, + const per_thread_allocator<_T2>& __a2) +{ return __a1._M_state == __a2._M_state; } + +#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER +template +inline bool operator!=(const per_thread_allocator<_T1>& __a1, + const per_thread_allocator<_T2>& __a2) +{ return __a1._M_state != __a2._M_state; } +#endif + + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + +template +struct _Alloc_traits<_Tp, per_thread_allocator<_Atype> > +{ typedef per_thread_allocator<_Tp> allocator_type; }; + +#endif + +#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) + +template +inline per_thread_allocator<_Tp2>& +__stl_alloc_rebind(per_thread_allocator<_Tp1>& __x, const _Tp2*) +{ return (per_thread_allocator<_Tp2>&)__x; } + +template +inline per_thread_allocator<_Tp2> +__stl_alloc_create(per_thread_allocator<_Tp1>&, const _Tp2*) +{ return per_thread_allocator<_Tp2>(); } + +#endif /* _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE */ + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct __perthread_alloc_type_traits { + typedef typename _IsSTLportClass >::_Ret _STLportAlloc; + //The default allocator implementation which is recognize thanks to the + //__stlport_class inheritance is a stateless object so: + typedef __false_type has_trivial_default_constructor; + typedef _STLportAlloc has_trivial_copy_constructor; + typedef _STLportAlloc has_trivial_assignment_operator; + typedef _STLportAlloc has_trivial_destructor; + typedef __false_type is_POD_type; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits<_Tp> {}; +#else +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits {}; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits {}; +# endif +# if defined (_STLP_USE_PTR_SPECIALIZATIONS) +_STLP_TEMPLATE_NULL +struct __type_traits > : _STLP_PRIV __perthread_alloc_type_traits {}; +# endif +#endif + + +_STLP_END_NAMESPACE + +#endif /* _STLP_PTHREAD_ALLOC */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_ptrs_specialize.h b/sdk/tlibstdcxx/stlport/stl/_ptrs_specialize.h new file mode 100644 index 0000000000..b9cb5d8867 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_ptrs_specialize.h @@ -0,0 +1,83 @@ +#ifndef _STLP_PTRS_SPECIALIZE_H +#define _STLP_PTRS_SPECIALIZE_H + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \ + (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && !defined (_STLP_NO_ARROW_OPERATOR)) +# define _STLP_POINTERS_SPECIALIZE( _TpP ) +# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); } +#else +# ifndef _STLP_TYPE_TRAITS_H +# include +# endif + +// the following is a workaround for arrow operator problems +# if defined ( _STLP_NO_ARROW_OPERATOR ) +// User wants to disable proxy -> operators +# define _STLP_DEFINE_ARROW_OPERATOR +# else +// Compiler can handle generic -> operator. +# if defined (__BORLANDC__) +# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); } +# elif defined(__WATCOMC__) +# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; } +# else +# define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); } +# endif +# endif /* _STLP_NO_ARROW_OPERATOR */ + +// Important pointers specializations + +# ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS +# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) +# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) +# else +# define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<__true_type> {}; +# define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \ +_STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***) +# endif + +# define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) + +_STLP_BEGIN_NAMESPACE + +# if !defined ( _STLP_NO_BOOL ) +_STLP_POINTERS_SPECIALIZE( bool ) +# endif +_STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void) +# ifndef _STLP_NO_SIGNED_BUILTINS + _STLP_POINTERS_SPECIALIZE( signed char ) +# endif + _STLP_POINTERS_SPECIALIZE( char ) + _STLP_POINTERS_SPECIALIZE( unsigned char ) + _STLP_POINTERS_SPECIALIZE( short ) + _STLP_POINTERS_SPECIALIZE( unsigned short ) + _STLP_POINTERS_SPECIALIZE( int ) + _STLP_POINTERS_SPECIALIZE( unsigned int ) + _STLP_POINTERS_SPECIALIZE( long ) + _STLP_POINTERS_SPECIALIZE( unsigned long ) + _STLP_POINTERS_SPECIALIZE( float ) + _STLP_POINTERS_SPECIALIZE( double ) +# if !defined ( _STLP_NO_LONG_DOUBLE ) + _STLP_POINTERS_SPECIALIZE( long double ) +# endif +# if defined ( _STLP_LONG_LONG) + _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG ) + _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG ) +# endif +# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT) + _STLP_POINTERS_SPECIALIZE( wchar_t ) +# endif + +_STLP_END_NAMESPACE + +# undef _STLP_ARROW_SPECIALIZE +# undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V + +#endif +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_queue.h b/sdk/tlibstdcxx/stlport/stl/_queue.h new file mode 100644 index 0000000000..5f3763c020 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_queue.h @@ -0,0 +1,268 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_QUEUE_H +#define _STLP_INTERNAL_QUEUE_H + +#ifndef _STLP_INTERNAL_DEQUE_H +# include +#endif + +#ifndef _STLP_INTERNAL_VECTOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_HEAP_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +# if ! defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) +template > +# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) +# define _STLP_QUEUE_ARGS _Tp +template +# else +template +# endif +class queue +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) +# if defined (_STLP_QUEUE_ARGS) + : public __stlport_class > +# else + : public __stlport_class > +# endif +#endif +{ +# if defined ( _STLP_QUEUE_ARGS ) + typedef deque<_Tp> _Sequence; + typedef queue<_Tp> _Self; +# else + typedef queue<_Tp, _Sequence> _Self; +# endif +public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; + +protected: + //c is a Standard name (23.2.3.1), do no make it STLport naming convention compliant. + _Sequence c; +public: + queue() : c() {} + explicit queue(const _Sequence& __c) : c(__c) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + queue(__move_source<_Self> src) + : c(_STLP_PRIV _AsMoveSource(src.get().c)) {} +#endif + + bool empty() const { return c.empty(); } + size_type size() const { return c.size(); } + reference front() { return c.front(); } + const_reference front() const { return c.front(); } + reference back() { return c.back(); } + const_reference back() const { return c.back(); } + void push(const value_type& __x) { c.push_back(__x); } + void pop() { c.pop_front(); } + const _Sequence& _Get_s() const { return c; } + +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { + _Sequence __tmp = c; + c = __x.c; + __x.c = __tmp; + } +#endif +}; + +#ifndef _STLP_QUEUE_ARGS +# define _STLP_QUEUE_ARGS _Tp, _Sequence +# define _STLP_QUEUE_HEADER_ARGS class _Tp, class _Sequence +#else +# define _STLP_QUEUE_HEADER_ARGS class _Tp +#endif + +template < _STLP_QUEUE_HEADER_ARGS > +inline bool _STLP_CALL +operator==(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) { + return __x._Get_s() == __y._Get_s(); +} + +template < _STLP_QUEUE_HEADER_ARGS > +inline bool _STLP_CALL +operator<(const queue<_STLP_QUEUE_ARGS >& __x, const queue<_STLP_QUEUE_ARGS >& __y) { + return __x._Get_s() < __y._Get_s(); +} + +_STLP_RELOPS_OPERATORS( template < _STLP_QUEUE_HEADER_ARGS >, queue<_STLP_QUEUE_ARGS > ) + +# if !(defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) || defined ( _STLP_TEMPLATE_PARAM_SUBTYPE_BUG )) +template , + class _Compare = less<_STLP_HEADER_TYPENAME _Sequence::value_type> > +# elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) +template +# else +template +# endif +class priority_queue +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) +# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) + : public __stlport_class > +# else + : public __stlport_class > +# endif +#endif +{ +# ifdef _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS + typedef vector<_Tp> _Sequence; + typedef less< typename vector<_Tp>::value_type> _Compare; + typedef priority_queue<_Tp> _Self; +# else + typedef priority_queue<_Tp, _Sequence, _Compare> _Self; +# endif +public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; +protected: + //c is a Standard name (23.2.3.2), do no make it STLport naming convention compliant. + _Sequence c; + _Compare comp; +public: + priority_queue() : c() {} + explicit priority_queue(const _Compare& __x) : c(), comp(__x) {} + priority_queue(const _Compare& __x, const _Sequence& __s) + : c(__s), comp(__x) + { make_heap(c.begin(), c.end(), comp); } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + priority_queue(__move_source<_Self> src) + : c(_STLP_PRIV _AsMoveSource(src.get().c)), + comp(_STLP_PRIV _AsMoveSource(src.get().comp)) {} +#endif + +#ifdef _STLP_MEMBER_TEMPLATES + template + priority_queue(_InputIterator __first, _InputIterator __last) + : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } + + template + priority_queue(_InputIterator __first, + _InputIterator __last, const _Compare& __x) + : c(__first, __last), comp(__x) + { make_heap(c.begin(), c.end(), comp); } + + template + priority_queue(_InputIterator __first, _InputIterator __last, + const _Compare& __x, const _Sequence& __s) + : c(__s), comp(__x) + { + c.insert(c.end(), __first, __last); + make_heap(c.begin(), c.end(), comp); + } + +#else /* _STLP_MEMBER_TEMPLATES */ + priority_queue(const value_type* __first, const value_type* __last) + : c(__first, __last) { make_heap(c.begin(), c.end(), comp); } + + priority_queue(const value_type* __first, const value_type* __last, + const _Compare& __x) + : c(__first, __last), comp(__x) + { make_heap(c.begin(), c.end(), comp); } + + priority_queue(const value_type* __first, const value_type* __last, + const _Compare& __x, const _Sequence& __c) + : c(__c), comp(__x) + { + c.insert(c.end(), __first, __last); + make_heap(c.begin(), c.end(), comp); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + bool empty() const { return c.empty(); } + size_type size() const { return c.size(); } + const_reference top() const { return c.front(); } + void push(const value_type& __x) { + _STLP_TRY { + c.push_back(__x); + push_heap(c.begin(), c.end(), comp); + } + _STLP_UNWIND(c.clear()) + } + void pop() { + _STLP_TRY { + pop_heap(c.begin(), c.end(), comp); + c.pop_back(); + } + _STLP_UNWIND(c.clear()) + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { + _Sequence __tmp = c; + c = __x.c; + __x.c = __tmp; + } +#endif +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux<_Sequence> +{}; + +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux2<_Sequence, _Compare> +{}; +#endif + +_STLP_END_NAMESPACE + +#undef _STLP_QUEUE_ARGS +#undef _STLP_QUEUE_HEADER_ARGS +#undef comp + +#endif /* _STLP_INTERNAL_QUEUE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_range_errors.c b/sdk/tlibstdcxx/stlport/stl/_range_errors.c new file mode 100644 index 0000000000..537e91a911 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_range_errors.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#if defined(_STLP_THROW_RANGE_ERRORS) +# if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_DONT_REDEFINE_STD) +// In this mode we are going to throw native exception so that catch of +// exception like std::runtime_error for instance will also catch exception +// thrown by STLport containers like stlport::vector or stlport::string. +# include +# include +# define _STLP_THROW_MSG(ex,msg) throw std::ex(msg) +# else +# if !defined (_STLP_SGX_CONFIG) && defined (__BUILDING_STLPORT) +# include +# include +# else +# ifndef _STLP_INTERNAL_STDEXCEPT +# include +# endif +# ifndef _STLP_INTERNAL_STRING_H +# include +# endif +# endif +# define _STLP_THROW_MSG(ex,msg) throw ex(msg) +# endif +#else +# if !defined (_STLP_SGX_CONFIG) && defined (__BUILDING_STLPORT) +# include +# include +# else +# ifndef _STLP_INTERNAL_CSTDLIB +# include +# endif +# ifndef _STLP_INTERNAL_CSTDIO +# include +# endif +# endif +# define _STLP_THROW_MSG(ex,msg) /*puts(msg),*/(void)(msg), _STLP_ABORT() +#endif + +// For mode without library and throwing range errors, include the +// stdexcept header and throw the appropriate exceptions directly. + +#if defined (_STLP_EXTERN_RANGE_ERRORS) +# define _STLP_THROW_FUNCT_SPEC void _STLP_DECLSPEC +#else +# define _STLP_THROW_FUNCT_SPEC inline void +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg) +{ _STLP_THROW_MSG(runtime_error, __msg); } + +_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_range_error(const char* __msg) +{ _STLP_THROW_MSG(range_error, __msg); } + +_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) +{ _STLP_THROW_MSG(out_of_range, __msg); } + +_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char* __msg) +{ _STLP_THROW_MSG(length_error, __msg); } + +_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) +{ _STLP_THROW_MSG(invalid_argument, __msg); } + +_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) +{ _STLP_THROW_MSG(overflow_error, __msg); } + +_STLP_END_NAMESPACE + +#undef _STLP_THROW_FUNCT_SPEC +#undef _STLP_THROW_MSG diff --git a/sdk/tlibstdcxx/stlport/stl/_range_errors.h b/sdk/tlibstdcxx/stlport/stl/_range_errors.h new file mode 100644 index 0000000000..80df26a465 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_range_errors.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +#ifndef _STLP_RANGE_ERRORS_H +#define _STLP_RANGE_ERRORS_H + +// A few places in the STL throw range errors, using standard exception +// classes defined in . This header file provides functions +// to throw those exception objects. + +// _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable +// this exception throwing. +#if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \ + !defined (_STLP_DONT_THROW_RANGE_ERRORS) +# define _STLP_THROW_RANGE_ERRORS +#endif + +// For the STLport iostreams, only declaration here, definition is in the lib +#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS) +# define _STLP_EXTERN_RANGE_ERRORS +#endif + +_STLP_BEGIN_NAMESPACE +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg); +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg); +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg); +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg); +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg); +void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg); + +#if defined (__DMC__) && !defined (_STLP_NO_EXCEPTIONS) +# pragma noreturn(__stl_throw_runtime_error) +# pragma noreturn(__stl_throw_range_error) +# pragma noreturn(__stl_throw_out_of_range) +# pragma noreturn(__stl_throw_length_error) +# pragma noreturn(__stl_throw_invalid_argument) +# pragma noreturn(__stl_throw_overflow_error) +#endif +_STLP_END_NAMESPACE + +#if !defined (_STLP_EXTERN_RANGE_ERRORS) +# include +#endif + +#endif /* _STLP_RANGE_ERRORS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_raw_storage_iter.h b/sdk/tlibstdcxx/stlport/stl/_raw_storage_iter.h new file mode 100644 index 0000000000..6e4bc2e9de --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_raw_storage_iter.h @@ -0,0 +1,80 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H +#define _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +class raw_storage_iterator + : public iterator +{ +protected: + _ForwardIterator _M_iter; +public: + typedef output_iterator_tag iterator_category; +# ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; +# endif + explicit raw_storage_iterator(_ForwardIterator __x) : _M_iter(__x) {} + raw_storage_iterator<_ForwardIterator, _Tp>& operator*() { return *this; } + raw_storage_iterator<_ForwardIterator, _Tp>& operator=(const _Tp& __element) { + _Param_Construct(&*_M_iter, __element); + return *this; + } + raw_storage_iterator<_ForwardIterator, _Tp>& operator++() { + ++_M_iter; + return *this; + } + raw_storage_iterator<_ForwardIterator, _Tp> operator++(int) { + raw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this; + ++_M_iter; + return __tmp; + } +}; + +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES +template +inline output_iterator_tag iterator_category(const raw_storage_iterator<_ForwardIterator, _Tp>&) { return output_iterator_tag(); } +#endif +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_RAW_STORAGE_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_relops_cont.h b/sdk/tlibstdcxx/stlport/stl/_relops_cont.h new file mode 100644 index 0000000000..cd8ec05043 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_relops_cont.h @@ -0,0 +1,29 @@ +// This is an implementation file which +// is intended to be included multiple times with different _STLP_ASSOCIATIVE_CONTAINER +// setting + +#if !defined (_STLP_EQUAL_OPERATOR_SPECIALIZED) +_STLP_TEMPLATE_HEADER +inline bool _STLP_CALL operator==(const _STLP_TEMPLATE_CONTAINER& __x, + const _STLP_TEMPLATE_CONTAINER& __y) { + return __x.size() == __y.size() && + equal(__x.begin(), __x.end(), __y.begin()); +} +#endif /* _STLP_EQUAL_OPERATOR_SPECIALIZED */ + +_STLP_TEMPLATE_HEADER +inline bool _STLP_CALL operator<(const _STLP_TEMPLATE_CONTAINER& __x, + const _STLP_TEMPLATE_CONTAINER& __y) { + return lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); +} + +_STLP_RELOPS_OPERATORS( _STLP_TEMPLATE_HEADER , _STLP_TEMPLATE_CONTAINER ) + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +_STLP_TEMPLATE_HEADER +inline void _STLP_CALL swap(_STLP_TEMPLATE_CONTAINER& __x, + _STLP_TEMPLATE_CONTAINER& __y) { + __x.swap(__y); +} +#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ diff --git a/sdk/tlibstdcxx/stlport/stl/_relops_hash_cont.h b/sdk/tlibstdcxx/stlport/stl/_relops_hash_cont.h new file mode 100644 index 0000000000..421c8050bf --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_relops_hash_cont.h @@ -0,0 +1,13 @@ +/* This is an implementation file which is intended to be included + * multiple times with different _STLP_TEMPLATE_CONTAINER settings. + */ + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + +_STLP_TEMPLATE_HEADER +inline void _STLP_CALL +swap(_STLP_TEMPLATE_CONTAINER& __hm1, _STLP_TEMPLATE_CONTAINER& __hm2) { + __hm1.swap(__hm2); +} + +#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ diff --git a/sdk/tlibstdcxx/stlport/stl/_rope.c b/sdk/tlibstdcxx/stlport/stl/_rope.c new file mode 100644 index 0000000000..196ee220b5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_rope.c @@ -0,0 +1,1407 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf +// if necessary. Assumes path_end[leaf_index] and leaf_pos are correct. +// Results in a valid buf_ptr if the iterator can be legitimately +// dereferenced. +#ifndef _STLP_ROPEIMPL_H +#define _STLP_ROPEIMPL_H + +#ifndef _STLP_INTERNAL_ROPE_H +# include +#endif + +#ifndef _STLP_INTERNAL_CSTDIO +# include +#endif + +#if !defined (_STLP_USE_NO_IOSTREAMS) +# ifndef _STLP_INTERNAL_OSTREAM_H +# include +# endif + +# ifndef _STLP_INTERNAL_ISTREAM +# include +# endif +#endif + +#include + +_STLP_BEGIN_NAMESPACE + +#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) +# define __allocator__ _Alloc +#else +# define __allocator__ allocator_type +#endif + +template +_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos) + : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr._M_data, __pos), + _M_root_rope(__r) { _RopeRep::_S_ref(this->_M_root); } + +template +_Rope_iterator<_CharT, _Alloc>::_Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos): + _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos), + _M_root_rope(&__r) { +#if !defined (__DMC__) + _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*this); +#else + _Rope_iterator_base<_CharT, _Alloc>* __x = this; + _RopeRep::_S_ref(this->_M_root); if (!(__r.empty()))_S_setcache(*__x); +#endif +} + +template +void _Rope_RopeRep<_CharT, _Alloc>::_M_free_c_string() { + _CharT* __cstr = _M_c_string; + if (0 != __cstr) { + size_t _p_size = _M_size._M_data + 1; + _STLP_STD::_Destroy_Range(__cstr, __cstr + _p_size); + _M_size.deallocate(__cstr, _p_size); + } +} + +// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf +// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct. +// Results in a valid buf_ptr if the iterator can be legitimately +// dereferenced. +template +void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( + _Rope_iterator_base<_CharT,_Alloc>& __x) { + const _RopeRep* __leaf = __x._M_path_end._M_data[__x._M_leaf_index]; + size_t __leaf_pos = __x._M_leaf_pos; + size_t __pos = __x._M_current_pos; + + switch(__leaf->_M_tag) { + case _RopeRep::_S_leaf: + typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf; + __x._M_buf_start = __STATIC_CAST(const _RopeLeaf*, __leaf)->_M_data; + __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos); + __x._M_buf_end = __x._M_buf_start + __leaf->_M_size._M_data; + break; + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + size_t __len = _S_iterator_buf_len; + size_t __buf_start_pos = __leaf_pos; + size_t __leaf_end = __leaf_pos + __leaf->_M_size._M_data; + typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction; + char_producer<_CharT>* __fn = __STATIC_CAST(const _RopeFunction*, __leaf)->_M_fn; + + if (__buf_start_pos + __len <= __pos) { + __buf_start_pos = __pos - __len/4; + if (__buf_start_pos + __len > __leaf_end) { + __buf_start_pos = __leaf_end - __len; + } + } + if (__buf_start_pos + __len > __leaf_end) { + __len = __leaf_end - __buf_start_pos; + } + (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf._M_data); + __x._M_buf_ptr = __x._M_tmp_buf._M_data + (__pos - __buf_start_pos); + __x._M_buf_start = __x._M_tmp_buf._M_data; + __x._M_buf_end = __x._M_tmp_buf._M_data + __len; + } + break; + default: + _STLP_ASSERT(0) + ; + } +} + +// Set path and buffer inside a rope iterator. We assume that +// pos and root are already set. +template +void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache( + _Rope_iterator_base<_CharT,_Alloc>& __x) { + const _RopeRep* __path[_RopeRep::_S_max_rope_depth+1]; + const _RopeRep* __curr_rope; + int __curr_depth = -1; /* index into path */ + size_t __curr_start_pos = 0; + size_t __pos = __x._M_current_pos; + unsigned char __dirns = 0; // Bit vector marking right turns in the path + + _STLP_ASSERT(__pos <= __x._M_root->_M_size._M_data) + if (__pos >= __x._M_root->_M_size._M_data) { + __x._M_buf_ptr = 0; + return; + } + __curr_rope = __x._M_root; + if (0 != __curr_rope->_M_c_string) { + /* Treat the root as a leaf. */ + __x._M_buf_start = __curr_rope->_M_c_string; + __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size._M_data; + __x._M_buf_ptr = __curr_rope->_M_c_string + __pos; + __x._M_path_end._M_data[0] = __curr_rope; + __x._M_leaf_index = 0; + __x._M_leaf_pos = 0; + return; + } + for(;;) { + ++__curr_depth; + _STLP_ASSERT(__curr_depth <= _RopeRep::_S_max_rope_depth) + __path[__curr_depth] = __curr_rope; + switch(__curr_rope->_M_tag) { + case _RopeRep::_S_leaf: + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + __x._M_leaf_pos = __curr_start_pos; + goto done; + case _RopeRep::_S_concat: + { + const _RopeConcat* __c = __STATIC_CAST(const _RopeConcat*, __curr_rope); + _RopeRep* __left = __c->_M_left; + size_t __left_len = __left->_M_size._M_data; + + __dirns <<= 1; + if (__pos >= __curr_start_pos + __left_len) { + __dirns |= 1; + __curr_rope = __c->_M_right; + __curr_start_pos += __left_len; + } else { + __curr_rope = __left; + } + } + break; + } + } +done: + // Copy last section of path into _M_path_end. + { + int __i = -1; + int __j = __curr_depth + 1 - _S_path_cache_len; + + if (__j < 0) __j = 0; + while (__j <= __curr_depth) { + __x._M_path_end._M_data[++__i] = __path[__j++]; + } + __x._M_leaf_index = __i; + } + __x._M_path_directions = __dirns; + _S_setbuf(__x); +} + +// Specialized version of the above. Assumes that +// the path cache is valid for the previous position. +template +void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr( +_Rope_iterator_base<_CharT,_Alloc>& __x) { + int __current_index = __x._M_leaf_index; + const _RopeRep* __current_node = __x._M_path_end._M_data[__current_index]; + size_t __len = __current_node->_M_size._M_data; + size_t __node_start_pos = __x._M_leaf_pos; + unsigned char __dirns = __x._M_path_directions; + const _RopeConcat* __c; + + _STLP_ASSERT(__x._M_current_pos <= __x._M_root->_M_size._M_data) + if (__x._M_current_pos - __node_start_pos < __len) { + /* More stuff in this leaf, we just didn't cache it. */ + _S_setbuf(__x); + return; + } + _STLP_ASSERT(__node_start_pos + __len == __x._M_current_pos) + // node_start_pos is starting position of last_node. + while (--__current_index >= 0) { + if (!(__dirns & 1) /* Path turned left */) + break; + __current_node = __x._M_path_end._M_data[__current_index]; + __c = __STATIC_CAST(const _RopeConcat*, __current_node); + // Otherwise we were in the right child. Thus we should pop + // the concatenation node. + __node_start_pos -= __c->_M_left->_M_size._M_data; + __dirns >>= 1; + } + if (__current_index < 0) { + // We underflowed the cache. Punt. + _S_setcache(__x); + return; + } + __current_node = __x._M_path_end._M_data[__current_index]; + __c = __STATIC_CAST(const _RopeConcat*, __current_node); + // current_node is a concatenation node. We are positioned on the first + // character in its right child. + // node_start_pos is starting position of current_node. + __node_start_pos += __c->_M_left->_M_size._M_data; + __current_node = __c->_M_right; + __x._M_path_end._M_data[++__current_index] = __current_node; + __dirns |= 1; + while (_RopeRep::_S_concat == __current_node->_M_tag) { + ++__current_index; + if (_S_path_cache_len == __current_index) { + int __i; + for (__i = 0; __i < _S_path_cache_len-1; ++__i) { + __x._M_path_end._M_data[__i] = __x._M_path_end._M_data[__i+1]; + } + --__current_index; + } + __current_node = __STATIC_CAST(const _RopeConcat*, __current_node)->_M_left; + __x._M_path_end._M_data[__current_index] = __current_node; + __dirns <<= 1; + // node_start_pos is unchanged. + } + __x._M_leaf_index = __current_index; + __x._M_leaf_pos = __node_start_pos; + __x._M_path_directions = __dirns; + _S_setbuf(__x); +} + +template +void _Rope_iterator_base<_CharT,_Alloc>::_M_incr(size_t __n) { + _M_current_pos += __n; + if (0 != _M_buf_ptr) { + size_t __chars_left = _M_buf_end - _M_buf_ptr; + if (__chars_left > __n) { + _M_buf_ptr += __n; + } else if (__chars_left == __n) { + _M_buf_ptr += __n; + _S_setcache_for_incr(*this); + } else { + _M_buf_ptr = 0; + } + } +} + +template +void _Rope_iterator_base<_CharT,_Alloc>::_M_decr(size_t __n) { + if (0 != _M_buf_ptr) { + size_t __chars_left = _M_buf_ptr - _M_buf_start; + if (__chars_left >= __n) { + _M_buf_ptr -= __n; + } else { + _M_buf_ptr = 0; + } + } + _M_current_pos -= __n; +} + +template +void _Rope_iterator<_CharT,_Alloc>::_M_check() { + if (_M_root_rope->_M_tree_ptr._M_data != this->_M_root) { + // _Rope was modified. Get things fixed up. + _RopeRep::_S_unref(this->_M_root); + this->_M_root = _M_root_rope->_M_tree_ptr._M_data; + _RopeRep::_S_ref(this->_M_root); + this->_M_buf_ptr = 0; + } +} + +// There are several reasons for not doing this with virtual destructors +// and a class specific delete operator: +// - A class specific delete operator can't easily get access to +// allocator instances if we need them. +// - Any virtual function would need a 4 or byte vtable pointer; +// this only requires a one byte tag per object. +template +void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree() { + switch (_M_tag) { + case _S_leaf: + { + typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf; + _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, this); + _STLP_STD::_Destroy(__l); // ->_Rope_RopeLeaf<_CharT,_Alloc>::~_Rope_RopeLeaf(); + _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size, + _RopeLeaf).deallocate(__l, 1); + break; + } + case _S_concat: + { + typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation; + _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, this); + _STLP_STD::_Destroy(__c); + _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size, + _RopeConcatenation).deallocate(__c, 1); + break; + } + case _S_function: + { + typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction; + _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, this); + _STLP_STD::_Destroy(__f); + _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size, + _RopeFunction).deallocate(__f, 1); + break; + } + case _S_substringfn: + { + typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring; + _RopeSubstring* __rss = __STATIC_CAST(_RopeSubstring*, this); + _STLP_STD::_Destroy(__rss); + _STLP_CREATE_ALLOCATOR(allocator_type, (const allocator_type&)_M_size, + _RopeSubstring).deallocate(__rss, 1); + break; + } + } +} + +# if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) +# define __RopeLeaf__ _Rope_RopeLeaf<_CharT,_Alloc> +# define __RopeRep__ _Rope_RopeRep<_CharT,_Alloc> +# define _RopeLeaf _Rope_RopeLeaf<_CharT,_Alloc> +# define _RopeRep _Rope_RopeRep<_CharT,_Alloc> +# define size_type size_t +# else +# define __RopeLeaf__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeLeaf +# define __RopeRep__ _STLP_TYPENAME_ON_RETURN_TYPE rope<_CharT,_Alloc>::_RopeRep +# endif + +template +void rope<_CharT, _Alloc>::_M_throw_out_of_range() const { + __stl_throw_out_of_range("rope"); +} + +// Concatenate a C string onto a leaf rope by copying the rope data. +// Used for short ropes. +template +__RopeLeaf__* +rope<_CharT,_Alloc>::_S_leaf_concat_char_iter ( + _RopeLeaf* __r, const _CharT* __iter, size_t __len) { + size_t __old_len = __r->_M_size._M_data; + _CharT* __new_data = __r->_M_size.allocate(_S_rounded_up_size(__old_len + __len)); + _RopeLeaf* __result; + + _STLP_PRIV __ucopy_n(__r->_M_data, __old_len, __new_data); + _STLP_PRIV __ucopy_n(__iter, __len, __new_data + __old_len); + _S_construct_null(__new_data + __old_len + __len); + _STLP_TRY { + __result = _S_new_RopeLeaf(__new_data, __old_len + __len, __r->get_allocator()); + } + _STLP_UNWIND(_RopeRep::_S_free_string(__new_data, __old_len + __len, + __r->get_allocator())) + return __result; +} + +template +void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r, + size_t __size, const __true_type& /*basic char type*/) { + _S_construct_null(__r->_M_data + __size); + _STLP_ASSERT(__r->_M_c_string == __r->_M_data) +} + +template +void _Terminate_RopeLeaf(_Rope_RopeLeaf<_CharT,_Alloc> *__r, + size_t, const __false_type& /*basic char type*/) { + if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string) { + __r->_M_free_c_string(); + __r->_M_c_string = 0; + } +} + +// As above, but it's OK to clobber original if refcount is 1 +template +__RopeLeaf__* +rope<_CharT,_Alloc>::_S_destr_leaf_concat_char_iter (_RopeLeaf* __r, const _CharT* __iter, size_t __len) { + //_STLP_ASSERT(__r->_M_ref_count >= 1) + if ( /* __r->_M_ref_count > 1 */ __r->_M_incr() > 2 ) { // - ptr + __r->_M_decr(); // - ptr + return _S_leaf_concat_char_iter(__r, __iter, __len); + } + __r->_M_decr(); // - ptr, __r->_M_ref_count == 1 or 0 + size_t __old_len = __r->_M_size._M_data; + if (_S_rounded_up_size(__old_len) == _S_rounded_up_size(__old_len + __len)) { + // The space has been partially initialized for the standard + // character types. But that doesn't matter for those types. + _STLP_PRIV __ucopy_n(__iter, __len, __r->_M_data + __old_len); + _Terminate_RopeLeaf(__r, __old_len + __len, _IsBasicCharType()); + __r->_M_size._M_data = __old_len + __len; + // _STLP_ASSERT(__r->_M_ref_count == 1) + // __r->_M_ref_count = 2; + __r->_M_incr(); // i.e. __r->_M_ref_count = 2 + return __r; + } else { + _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len); + //_STLP_ASSERT(__result->_M_ref_count == 1) + return __result; + } +} + +// Assumes left and right are not 0. +// Does not increment (nor decrement on exception) child reference counts. +// Result has ref count 1. +template +__RopeRep__* +rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) { + _RopeConcatenation* __result = + _S_new_RopeConcatenation(__left, __right, __left->get_allocator()); + size_t __depth = __result->_M_depth; + + _STLP_ASSERT(__left->get_allocator() == __right->get_allocator()) + if (__depth > 20 && (__result->_M_size._M_data < 1000 || + __depth > _RopeRep::_S_max_rope_depth)) { + _RopeRep* __balanced; + + _STLP_TRY { + __balanced = _S_balance(__result); + // _STLP_ASSERT(__result == __balanced || + // 1 == __result->_M_ref_count && + // 1 == __balanced->_M_ref_count) + __result->_M_unref_nonnil(); + } + _STLP_UNWIND((_STLP_CREATE_ALLOCATOR(allocator_type,(allocator_type&)__left->_M_size, + _RopeConcatenation).deallocate(__result,1))) + // In case of exception, we need to deallocate + // otherwise dangling result node. But caller + // still owns its children. Thus unref is + // inappropriate. + return __balanced; + } else { + return __result; + } +} + +template +__RopeRep__* +rope<_CharT,_Alloc>::_S_concat_char_iter (_RopeRep* __r, + const _CharT*__s, size_t __slen) { + _RopeRep* __result; + if (0 == __slen) { + _S_ref(__r); + return __r; + } + if (0 == __r) + return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator()); + if (_RopeRep::_S_leaf == __r->_M_tag && + __r->_M_size._M_data + __slen <= _S_copy_max) { + __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); + // _STLP_ASSERT(1 == __result->_M_ref_count) + return __result; + } + if (_RopeRep::_S_concat == __r->_M_tag && + _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) { + _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); + if (__right->_M_size._M_data + __slen <= _S_copy_max) { + _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; + _RopeRep* __nright = _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen); + __left->_M_ref_nonnil(); + _STLP_TRY { + __result = _S_tree_concat(__left, __nright); + } + _STLP_UNWIND(_S_unref(__left); _S_unref(__nright)) + // _STLP_ASSERT(1 == __result->_M_ref_count) + return __result; + } + } + _RopeRep* __nright = + _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator()); + _STLP_TRY { + __r->_M_ref_nonnil(); + __result = _S_tree_concat(__r, __nright); + } + _STLP_UNWIND(_S_unref(__r); _S_unref(__nright)) + // _STLP_ASSERT(1 == __result->_M_ref_count) + return __result; +} + +template +__RopeRep__* +rope<_CharT,_Alloc>::_S_destr_concat_char_iter( + _RopeRep* __r, const _CharT* __s, size_t __slen) { + _RopeRep* __result; + if (0 == __r) + return _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, + __r->get_allocator()); + // size_t __count = __r->_M_ref_count; + size_t __orig_size = __r->_M_size._M_data; + // _STLP_ASSERT(__count >= 1) + if ( /* __count > 1 */ __r->_M_incr() > 2 ) { + __r->_M_decr(); + return _S_concat_char_iter(__r, __s, __slen); + } + if (0 == __slen) { + return __r; + } + __r->_M_decr(); + if (__orig_size + __slen <= _S_copy_max && _RopeRep::_S_leaf == __r->_M_tag) { + return _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); + } + if (_RopeRep::_S_concat == __r->_M_tag) { + _RopeLeaf* __right = __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __r)->_M_right); + if (_RopeRep::_S_leaf == __right->_M_tag && + __right->_M_size._M_data + __slen <= _S_copy_max) { + _RopeRep* __new_right = _S_destr_leaf_concat_char_iter(__right, __s, __slen); + if (__right == __new_right) { + // _STLP_ASSERT(__new_right->_M_ref_count == 2) + // __new_right->_M_ref_count = 1; + __new_right->_M_decr(); + } else { + // _STLP_ASSERT(__new_right->_M_ref_count >= 1) + __right->_M_unref_nonnil(); + } + // _STLP_ASSERT(__r->_M_ref_count == 1) + // __r->_M_ref_count = 2; // One more than before. + __r->_M_incr(); + __STATIC_CAST(_RopeConcatenation*, __r)->_M_right = __new_right; + // E.Musser : moved below + // __r->_M_size._M_data = __orig_size + __slen; + if (0 != __r->_M_c_string) { + __r->_M_free_c_string(); + __r->_M_c_string = 0; + } + __r->_M_size._M_data = __orig_size + __slen; + return __r; + } + } + _RopeRep* __right = + _S_RopeLeaf_from_unowned_char_ptr(__s, __slen, __r->get_allocator()); + __r->_M_ref_nonnil(); + _STLP_TRY { + __result = _S_tree_concat(__r, __right); + } + _STLP_UNWIND(_S_unref(__r); _S_unref(__right)) + // _STLP_ASSERT(1 == __result->_M_ref_count) + return __result; +} + +template +__RopeRep__* +rope<_CharT,_Alloc>::_S_concat_rep(_RopeRep* __left, _RopeRep* __right) { + if (0 == __left) { + _S_ref(__right); + return __right; + } + if (0 == __right) { + __left->_M_ref_nonnil(); + return __left; + } + if (_RopeRep::_S_leaf == __right->_M_tag) { + if (_RopeRep::_S_leaf == __left->_M_tag) { + if (__right->_M_size._M_data + __left->_M_size._M_data <= _S_copy_max) { + return _S_leaf_concat_char_iter(__STATIC_CAST(_RopeLeaf*, __left), + __STATIC_CAST(_RopeLeaf*, __right)->_M_data, + __right->_M_size._M_data); + } + } else if (_RopeRep::_S_concat == __left->_M_tag && + _RopeRep::_S_leaf == __STATIC_CAST(_RopeConcatenation*, __left)->_M_right->_M_tag) { + _RopeLeaf* __leftright = + __STATIC_CAST(_RopeLeaf*, __STATIC_CAST(_RopeConcatenation*, __left)->_M_right); + if (__leftright->_M_size._M_data + __right->_M_size._M_data <= _S_copy_max) { + _RopeRep* __leftleft = __STATIC_CAST(_RopeConcatenation*, __left)->_M_left; + _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright, + __STATIC_CAST(_RopeLeaf*, __right)->_M_data, + __right->_M_size._M_data); + __leftleft->_M_ref_nonnil(); + _STLP_TRY { + return _S_tree_concat(__leftleft, __rest); + } + _STLP_UNWIND(_S_unref(__leftleft); _S_unref(__rest)) + } + } + } + __left->_M_ref_nonnil(); + __right->_M_ref_nonnil(); + _STLP_TRY { + return _S_tree_concat(__left, __right); + } + _STLP_UNWIND(_S_unref(__left); _S_unref(__right)) + _STLP_RET_AFTER_THROW(0) +} + +template +__RopeRep__* +rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base, + size_t __start, size_t __endp1) { + if (0 == __base) return 0; + size_t __len = __base->_M_size._M_data; + size_t __adj_endp1; + const size_t __lazy_threshold = 128; + + if (__endp1 >= __len) { + if (0 == __start) { + __base->_M_ref_nonnil(); + return __base; + } else { + __adj_endp1 = __len; + } + } else { + __adj_endp1 = __endp1; + } + switch(__base->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __base); + _RopeRep* __left = __c->_M_left; + _RopeRep* __right = __c->_M_right; + size_t __left_len = __left->_M_size._M_data; + _RopeRep* __result; + + if (__adj_endp1 <= __left_len) { + return _S_substring(__left, __start, __endp1); + } else if (__start >= __left_len) { + return _S_substring(__right, __start - __left_len, + __adj_endp1 - __left_len); + } + _Self_destruct_ptr __left_result(_S_substring(__left, __start, __left_len)); + _Self_destruct_ptr __right_result(_S_substring(__right, 0, __endp1 - __left_len)); + _STLP_MPWFIX_TRY //*TY 06/01/2000 - mpw forgets to call dtor on __left_result and __right_result without this try block + __result = _S_concat_rep(__left_result, __right_result); + // _STLP_ASSERT(1 == __result->_M_ref_count) + return __result; + _STLP_MPWFIX_CATCH //*TY 06/01/2000 - + } + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __base); + _RopeLeaf* __result; + size_t __result_len; + if (__start >= __adj_endp1) return 0; + __result_len = __adj_endp1 - __start; + if (__result_len > __lazy_threshold) goto lazy; + const _CharT* __section = __l->_M_data + __start; + // We should sometimes create substring node instead. + __result = _S_RopeLeaf_from_unowned_char_ptr(__section, __result_len, + __base->get_allocator()); + return __result; + } + case _RopeRep::_S_substringfn: + // Avoid introducing multiple layers of substring nodes. + { + _RopeSubstring* __old = __STATIC_CAST(_RopeSubstring*, __base); + size_t __result_len; + if (__start >= __adj_endp1) return 0; + __result_len = __adj_endp1 - __start; + if (__result_len > __lazy_threshold) { + _RopeSubstring* __result = _S_new_RopeSubstring(__old->_M_base, + __start + __old->_M_start, + __adj_endp1 - __start, + __base->get_allocator()); + return __result; + } // *** else fall through: *** + } + case _RopeRep::_S_function: + { + _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __base); + if (__start >= __adj_endp1) return 0; + size_t __result_len = __adj_endp1 - __start; + + if (__result_len > __lazy_threshold) goto lazy; + _CharT* __section = __base->_M_size.allocate(_S_rounded_up_size(__result_len)); + _STLP_TRY { + (*(__f->_M_fn))(__start, __result_len, __section); + } + _STLP_UNWIND(_RopeRep::_S_free_string(__section, + __result_len, __base->get_allocator())) + _S_construct_null(__section + __result_len); + return _S_new_RopeLeaf(__section, __result_len, + __base->get_allocator()); + } + } + /*NOTREACHED*/ + _STLP_ASSERT(false) + lazy: + { + // Create substring node. + return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start, + __base->get_allocator()); + } +} + +template +class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> { +private: + _CharT* _M_buf_ptr; +public: + _Rope_flatten_char_consumer(_CharT* __buffer) { + _M_buf_ptr = __buffer; + } + ~_Rope_flatten_char_consumer() {} + bool operator() (const _CharT* __leaf, size_t __n) { + _STLP_PRIV __ucopy_n(__leaf, __n, _M_buf_ptr); + _M_buf_ptr += __n; + return true; + } +}; + +template +class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { +private: + _CharT _M_pattern; +public: + size_t _M_count; // Number of nonmatching characters + _Rope_find_char_char_consumer(_CharT __p) + : _M_pattern(__p), _M_count(0) {} + ~_Rope_find_char_char_consumer() {} + bool operator() (const _CharT* __leaf, size_t __n) { + size_t __i; + for (__i = 0; __i < __n; ++__i) { + if (__leaf[__i] == _M_pattern) { + _M_count += __i; return false; + } + } + _M_count += __n; return true; + } +}; + +#if !defined (_STLP_USE_NO_IOSTREAMS) +template +// Here _CharT is both the stream and rope character type. +class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { +private: + typedef basic_ostream<_CharT,_Traits> _Insert_ostream; + typedef _Rope_insert_char_consumer<_CharT,_Traits> _Self; + _Insert_ostream& _M_o; + + //explicitely defined as private to avoid warnings: + _Self& operator = (_Self const&); +public: + _Rope_insert_char_consumer(_Insert_ostream& __writer) + : _M_o(__writer) {} + ~_Rope_insert_char_consumer() {} + // Caller is presumed to own the ostream + bool operator() (const _CharT* __leaf, size_t __n); + // Returns true to continue traversal. +}; + +template +bool _Rope_insert_char_consumer<_CharT, _Traits>::operator() + (const _CharT* __leaf, size_t __n) { + size_t __i; + // We assume that formatting is set up correctly for each element. + for (__i = 0; __i < __n; ++__i) _M_o.put(__leaf[__i]); + return true; +} +#endif /* !_STLP_USE_NO_IOSTREAMS */ + +template +bool _S_apply_to_pieces(_CharConsumer& __c, + _Rope_RopeRep<_CharT, _Alloc> * __r, + size_t __begin, size_t __end) { + typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; + typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; + typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; + typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; + + if (0 == __r) return true; + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __conc = __STATIC_CAST(_RopeConcatenation*, __r); + _RopeRep* __left = __conc->_M_left; + size_t __left_len = __left->_M_size._M_data; + if (__begin < __left_len) { + size_t __left_end = (min) (__left_len, __end); + if (!_S_apply_to_pieces(__c, __left, __begin, __left_end)) + return false; + } + if (__end > __left_len) { + _RopeRep* __right = __conc->_M_right; + size_t __right_start = (max)(__left_len, __begin); + if (!_S_apply_to_pieces(__c, __right, + __right_start - __left_len, + __end - __left_len)) { + return false; + } + } + } + return true; + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r); + return __c(__l->_M_data + __begin, __end - __begin); + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r); + size_t __len = __end - __begin; + bool __result; + _CharT* __buffer = __r->get_allocator().allocate(__len); + _STLP_TRY { + (*(__f->_M_fn))(__begin, __len, __buffer); + __result = __c(__buffer, __len); + __r->get_allocator().deallocate(__buffer, __len); + } + _STLP_UNWIND((__r->get_allocator().deallocate(__buffer, __len))) + return __result; + } + default: + _STLP_ASSERT(false) + /*NOTREACHED*/ + return false; + } +} + +#if !defined (_STLP_USE_NO_IOSTREAMS) +template +inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, streamsize __n) { + char __f = __o.fill(); + for (streamsize __i = 0; __i < __n; ++__i) __o.put(__f); +} + +template +basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o, + const rope<_CharT, _Alloc>& __r, const __true_type& /*_IsBasicCharType*/) { + streamsize __w = __o.width(); + const bool __left = (__o.flags() & ios::left) != 0; + size_t __rope_len = __r.size(); + _Rope_insert_char_consumer<_CharT, _Traits> __c(__o); + + const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __rope_len) < __w)) || + ((sizeof(streamsize) <= sizeof(size_t)) && (__rope_len < __STATIC_CAST(size_t, __w)))); + streamsize __pad_len = __need_pad ? __w - __rope_len : 0; + + if (!__left && __pad_len > 0) { + _Rope_fill(__o, __pad_len); + } + __r.apply_to_pieces(0, __rope_len, __c); + if (__left && __pad_len > 0) { + _Rope_fill(__o, __pad_len); + } + return __o; +} + +template +basic_ostream<_CharT, _Traits>& _S_io_get(basic_ostream<_CharT, _Traits>& __o, + const rope<_CharT, _Alloc>& __r, const __false_type& /*_IsBasicCharType*/) { + streamsize __w = __o.width(); + size_t __rope_len = __r.size(); + _Rope_insert_char_consumer<_CharT, _Traits> __c(__o); + + __o.width(__w /__rope_len); + _STLP_TRY { + __r.apply_to_pieces(0, __rope_len, __c); + __o.width(__w); + } + _STLP_UNWIND(__o.width(__w)) + return __o; +} + +template +basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __o, + const rope<_CharT, _Alloc>& __r) { + typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral; + return _S_io_get(__o, __r, _Char_Is_Integral()); +} +#endif /* NO_IOSTREAMS */ + +template +_CharT* rope<_CharT,_Alloc>::_S_flatten(_RopeRep* __r, + size_t __start, size_t __len, + _CharT* __buffer) { + _Rope_flatten_char_consumer<_CharT> __c(__buffer); + _S_apply_to_pieces(__c, __r, __start, __start + __len); + return(__buffer + __len); +} + +template +size_t rope<_CharT,_Alloc>::find(_CharT __pattern, size_t __start) const { + _Rope_find_char_char_consumer<_CharT> __c(__pattern); + _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __start, size()); + size_type __result_pos = __start + __c._M_count; +#ifndef _STLP_OLD_ROPE_SEMANTICS + if (__result_pos == size()) __result_pos = npos; +#endif + return __result_pos; +} + +template +_CharT* +rope<_CharT,_Alloc>::_S_flatten(_Rope_RopeRep<_CharT, _Alloc>* __r, _CharT* __buffer) { + if (0 == __r) return __buffer; + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r); + _RopeRep* __left = __c->_M_left; + _RopeRep* __right = __c->_M_right; + _CharT* __rest = _S_flatten(__left, __buffer); + return _S_flatten(__right, __rest); + } + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = __STATIC_CAST(_RopeLeaf*, __r); + return _STLP_PRIV __ucopy_n(__l->_M_data, __l->_M_size._M_data, __buffer).second; + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + // We dont yet do anything with substring nodes. + // This needs to be fixed before ropefiles will work well. + { + _RopeFunction* __f = __STATIC_CAST(_RopeFunction*, __r); + (*(__f->_M_fn))(0, __f->_M_size._M_data, __buffer); + return __buffer + __f->_M_size._M_data; + } + default: + _STLP_ASSERT(false) + /*NOTREACHED*/ + return 0; + } +} + +#ifdef _STLP_DEBUG +// This needs work for _CharT != char +template +void rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) { + for (int __i = 0; __i < __indent; ++__i) putchar(' '); + if (0 == __r) { + printf("NULL\n"); return; + } + if (_RopeRep::_S_concat == __r->_M_tag) { + _RopeConcatenation* __c = __STATIC_CAST(_RopeConcatenation*, __r); + _RopeRep* __left = __c->_M_left; + _RopeRep* __right = __c->_M_right; + printf("Concatenation %p (rc = %ld, depth = %d, len = %ld, %s balanced)\n", + __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data, + __r->_M_is_balanced? "" : "not"); + _S_dump(__left, __indent + 2); + _S_dump(__right, __indent + 2); + return; + } + else { + const char* __kind; + + switch (__r->_M_tag) { + case _RopeRep::_S_leaf: + __kind = "Leaf"; + break; + case _RopeRep::_S_function: + __kind = "Function"; + break; + case _RopeRep::_S_substringfn: + __kind = "Function representing substring"; + break; + default: + __kind = "(corrupted kind field!)"; + } + printf("%s %p (rc = %ld, depth = %d, len = %ld) ", + __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size._M_data); + if (sizeof(_CharT) == 1) { + const int __max_len = 40; + _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len)); + _CharT __buffer[__max_len + 1]; + bool __too_big = __r->_M_size._M_data > __prefix->_M_size._M_data; + + _S_flatten(__prefix, __buffer); + __buffer[__prefix->_M_size._M_data] = _STLP_DEFAULT_CONSTRUCTED(_CharT); + printf("%s%s\n", (char*)__buffer, __too_big? "...\n" : "\n"); + } else { + printf("\n"); + } + } +} +#endif /* _STLP_DEBUG */ + +# define __ROPE_TABLE_BODY = { \ +/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, \ +/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, \ +/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, \ +/* 18 */6765ul, /* 19 */10946ul, /* 20 */17711ul, /* 21 */28657ul, /* 22 */46368ul, \ +/* 23 */75025ul, /* 24 */121393ul, /* 25 */196418ul, /* 26 */317811ul, \ +/* 27 */514229ul, /* 28 */832040ul, /* 29 */1346269ul, /* 30 */2178309ul, \ +/* 31 */3524578ul, /* 32 */5702887ul, /* 33 */9227465ul, /* 34 */14930352ul, \ +/* 35 */24157817ul, /* 36 */39088169ul, /* 37 */63245986ul, /* 38 */102334155ul, \ +/* 39 */165580141ul, /* 40 */267914296ul, /* 41 */433494437ul, \ +/* 42 */701408733ul, /* 43 */1134903170ul, /* 44 */1836311903ul, \ +/* 45 */2971215073ul } + +template +const unsigned long +rope<_CharT,_Alloc>::_S_min_len[__ROPE_DEPTH_SIZE] __ROPE_TABLE_BODY; +# undef __ROPE_DEPTH_SIZE +# undef __ROPE_MAX_DEPTH +# undef __ROPE_TABLE_BODY + +// These are Fibonacci numbers < 2**32. + +template +__RopeRep__* rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) { + _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0}; + _RopeRep* __result = 0; + int __i; + // Invariant: + // The concatenation of forest in descending order is equal to __r. + // __forest[__i]._M_size._M_data >= _S_min_len[__i] + // __forest[__i]._M_depth = __i + // References from forest are included in refcount. + + _STLP_TRY { + _S_add_to_forest(__r, __forest); + for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) + if (0 != __forest[__i]) { + _Self_destruct_ptr __old(__result); + __result = _S_concat_rep(__forest[__i], __result); + __forest[__i]->_M_unref_nonnil(); +# ifdef _STLP_USE_EXCEPTIONS + __forest[__i] = 0; +# endif + } + } + _STLP_UNWIND(for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) + _S_unref(__forest[__i])) + if (__result->_M_depth > _RopeRep::_S_max_rope_depth) { + __stl_throw_range_error("rope too long"); + } + return(__result); +} + + +template +void +rope<_CharT,_Alloc>::_S_add_to_forest(_RopeRep* __r, _RopeRep** __forest) +{ + if (__r -> _M_is_balanced) { + _S_add_leaf_to_forest(__r, __forest); + return; + } + _STLP_ASSERT(__r->_M_tag == _RopeRep::_S_concat) + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + + _S_add_to_forest(__c->_M_left, __forest); + _S_add_to_forest(__c->_M_right, __forest); + } +} + + +template +void +rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest) +{ + _RopeRep* __insertee; // included in refcount + _RopeRep* __too_tiny = 0; // included in refcount + int __i; // forest[0..__i-1] is empty + size_t __s = __r->_M_size._M_data; + + for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i) { + if (0 != __forest[__i]) { + _Self_destruct_ptr __old(__too_tiny); + __too_tiny = _S_concat_and_set_balanced(__forest[__i], __too_tiny); + __forest[__i]->_M_unref_nonnil(); + __forest[__i] = 0; + } + } + { + _Self_destruct_ptr __old(__too_tiny); + __insertee = _S_concat_and_set_balanced(__too_tiny, __r); + } + // Too_tiny dead, and no longer included in refcount. + // Insertee is live and included. + _STLP_ASSERT(_S_is_almost_balanced(__insertee)) + _STLP_ASSERT(__insertee->_M_depth <= __r->_M_depth + 1) + for (;; ++__i) { + if (0 != __forest[__i]) { + _Self_destruct_ptr __old(__insertee); + __insertee = _S_concat_and_set_balanced(__forest[__i], __insertee); + __forest[__i]->_M_unref_nonnil(); + __forest[__i] = 0; + _STLP_ASSERT(_S_is_almost_balanced(__insertee)) + } + _STLP_ASSERT(_S_min_len[__i] <= __insertee->_M_size._M_data) + _STLP_ASSERT(__forest[__i] == 0) + if (__i == _RopeRep::_S_max_rope_depth || + __insertee->_M_size._M_data < _S_min_len[__i+1]) { + __forest[__i] = __insertee; + // refcount is OK since __insertee is now dead. + return; + } + } +} + +template +_CharT +rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i) +{ + _CharT* __cstr = __r->_M_c_string; + + _STLP_ASSERT(__i < __r->_M_size._M_data) + if (0 != __cstr) return __cstr[__i]; + for(;;) { + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + _RopeRep* __left = __c->_M_left; + size_t __left_len = __left->_M_size._M_data; + + if (__i >= __left_len) { + __i -= __left_len; + __r = __c->_M_right; + } else { + __r = __left; + } + } + break; + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__r; + return __l->_M_data[__i]; + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + _RopeFunction* __f = (_RopeFunction*)__r; + _CharT __result; + + (*(__f->_M_fn))(__i, 1, &__result); + return __result; + } + } + } +#if defined(_STLP_NEED_UNREACHABLE_RETURN) + return 0; +#endif +} + +// Return a uniquely referenced character slot for the given +// position, or 0 if that's not possible. +template +_CharT* +rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i) +{ + _RopeRep* __clrstack[_RopeRep::_S_max_rope_depth]; + size_t __csptr = 0; + + for(;;) { + // if (__r->_M_ref_count > 1) return 0; + if ( __r->_M_incr() > 2 ) { + __r->_M_decr(); + return 0; + } + switch(__r->_M_tag) { + case _RopeRep::_S_concat: + { + _RopeConcatenation* __c = (_RopeConcatenation*)__r; + _RopeRep* __left = __c->_M_left; + size_t __left_len = __left->_M_size._M_data; + + if (__c->_M_c_string != 0) __clrstack[__csptr++] = __c; + if (__i >= __left_len) { + __i -= __left_len; + __r = __c->_M_right; + } else { + __r = __left; + } + } + break; + case _RopeRep::_S_leaf: + { + _RopeLeaf* __l = (_RopeLeaf*)__r; + if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0) + __clrstack[__csptr++] = __l; + while (__csptr > 0) { + -- __csptr; + _RopeRep* __d = __clrstack[__csptr]; + __d->_M_free_c_string(); + __d->_M_c_string = 0; + } + return __l->_M_data + __i; + } + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + return 0; + } + } +#if defined(_STLP_NEED_UNREACHABLE_RETURN) + return 0; +#endif + +} + +// The following could be implemented trivially using +// lexicographical_compare_3way. +// We do a little more work to avoid dealing with rope iterators for +// flat strings. +template +int +rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left, + const _RopeRep* __right) { + size_t __left_len; + size_t __right_len; + + if (0 == __right) return 0 != __left; + if (0 == __left) return -1; + __left_len = __left->_M_size._M_data; + __right_len = __right->_M_size._M_data; + if (_RopeRep::_S_leaf == __left->_M_tag) { + const _RopeLeaf* __l = __STATIC_CAST(const _RopeLeaf*, __left); + if (_RopeRep::_S_leaf == __right->_M_tag) { + const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right); + return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len, + __r->_M_data, __r->_M_data + __right_len); + } + else { + const_iterator __rstart(__right, 0); + const_iterator __rend(__right, __right_len); + return _STLP_PRIV __lexicographical_compare_3way(__l->_M_data, __l->_M_data + __left_len, + __rstart, __rend); + } + } + else { + const_iterator __lstart(__left, 0); + const_iterator __lend(__left, __left_len); + if (_RopeRep::_S_leaf == __right->_M_tag) { + const _RopeLeaf* __r = __STATIC_CAST(const _RopeLeaf*, __right); + return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, + __r->_M_data, __r->_M_data + __right_len); + } + else { + const_iterator __rstart(__right, 0); + const_iterator __rend(__right, __right_len); + return _STLP_PRIV __lexicographical_compare_3way(__lstart, __lend, __rstart, __rend); + } + } +} + +// Assignment to reference proxies. +template +_Rope_char_ref_proxy<_CharT, _Alloc>& +_Rope_char_ref_proxy<_CharT, _Alloc>::operator= (_CharT __c) { + _RopeRep* __old = _M_root->_M_tree_ptr._M_data; + // First check for the case in which everything is uniquely + // referenced. In that case we can do this destructively. + _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos); + if (0 != __ptr) { + *__ptr = __c; + return *this; + } + _Self_destruct_ptr __left( + _My_rope::_S_substring(__old, 0, _M_pos)); + _Self_destruct_ptr __right( + _My_rope::_S_substring(__old, _M_pos+1, __old->_M_size._M_data)); + _Self_destruct_ptr __result_left( + _My_rope::_S_destr_concat_char_iter(__left, &__c, 1)); + + // _STLP_ASSERT(__left == __result_left || 1 == __result_left->_M_ref_count) + _RopeRep* __result = + _My_rope::_S_concat_rep(__result_left, __right); + // _STLP_ASSERT(1 <= __result->_M_ref_count) + _RopeRep::_S_unref(__old); + _M_root->_M_tree_ptr._M_data = __result; + return *this; +} + +template +_Rope_char_ptr_proxy<_CharT, _Alloc> +_Rope_char_ref_proxy<_CharT, _Alloc>::operator& () const { + return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); +} + +template +_CharT rope<_CharT,_Alloc>::_S_empty_c_str[1] = { _CharT() }; +// # endif + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) +template +const size_t rope<_CharT, _Alloc>::npos; +#endif + +template +const _CharT* rope<_CharT,_Alloc>::c_str() const { + if (0 == _M_tree_ptr._M_data) { + // Possibly redundant, but probably fast. + _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT); + return _S_empty_c_str; + } + _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string; + if (0 != __old_c_string) return __old_c_string; + size_t __s = size(); + _CharT* __result = _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).allocate(__s + 1); + _S_flatten(_M_tree_ptr._M_data, __result); + _S_construct_null(__result + __s); + __old_c_string = __STATIC_CAST(_CharT*, _Atomic_swap_ptr(__REINTERPRET_CAST(void* _STLP_VOLATILE*, &(_M_tree_ptr._M_data->_M_c_string)), + __result)); + if (0 != __old_c_string) { + // It must have been added in the interim. Hence it had to have been + // separately allocated. Deallocate the old copy, since we just + // replaced it. + _STLP_STD::_Destroy_Range(__old_c_string, __old_c_string + __s + 1); + _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_tree_ptr, _CharT).deallocate(__old_c_string, __s + 1); + } + return __result; +} + +template +const _CharT* rope<_CharT,_Alloc>::replace_with_c_str() { + if (0 == _M_tree_ptr._M_data) { + _S_empty_c_str[0] = _STLP_DEFAULT_CONSTRUCTED(_CharT); + return _S_empty_c_str; + } + _CharT* __old_c_string = _M_tree_ptr._M_data->_M_c_string; + if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && 0 != __old_c_string) { + return __old_c_string; + } + size_t __s = size(); + _CharT* __result = _M_tree_ptr.allocate(_S_rounded_up_size(__s)); + _S_flatten(_M_tree_ptr._M_data, __result); + _S_construct_null(__result + __s); + _M_tree_ptr._M_data->_M_unref_nonnil(); + _M_tree_ptr._M_data = _S_new_RopeLeaf(__result, __s, _M_tree_ptr); + return __result; +} + +// Algorithm specializations. More should be added. + +#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) && !defined (__DMC__) +// I couldn't get this to work with VC++ +template +void _Rope_rotate(_Rope_iterator<_CharT,_Alloc> __first, + _Rope_iterator<_CharT,_Alloc> __middle, + _Rope_iterator<_CharT,_Alloc> __last) { + _STLP_ASSERT(__first.container() == __middle.container() && + __middle.container() == __last.container()) + rope<_CharT,_Alloc>& __r(__first.container()); + rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index()); + rope<_CharT,_Alloc> __suffix = + __r.substr(__last.index(), __r.size() - __last.index()); + rope<_CharT,_Alloc> __part1 = + __r.substr(__middle.index(), __last.index() - __middle.index()); + rope<_CharT,_Alloc> __part2 = + __r.substr(__first.index(), __middle.index() - __first.index()); + __r = __prefix; + __r += __part1; + __r += __part2; + __r += __suffix; +} + + +# if 0 +// Probably not useful for several reasons: +// - for SGIs 7.1 compiler and probably some others, +// this forces lots of rope instantiations, creating a +// code bloat and compile time problem. (Fixed in 7.2.) +// - wchar_t is 4 bytes wide on most UNIX platforms, making it unattractive +// for unicode strings. Unsigned short may be a better character +// type. +inline void rotate( + _Rope_iterator > __first, + _Rope_iterator > __middle, + _Rope_iterator > __last) { + _Rope_rotate(__first, __middle, __last); +} +# endif +#endif /* _STLP_MSVC */ + +# undef __RopeLeaf__ +# undef __RopeRep__ +# undef __RopeLeaf +# undef __RopeRep +# undef size_type + +_STLP_END_NAMESPACE + +# endif /* ROPEIMPL_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_rope.h b/sdk/tlibstdcxx/stlport/stl/_rope.h new file mode 100644 index 0000000000..f100f673c8 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_rope.h @@ -0,0 +1,2389 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +// rope<_CharT,_Alloc> is a sequence of _CharT. +// Ropes appear to be mutable, but update operations +// really copy enough of the data structure to leave the original +// valid. Thus ropes can be logically copied by just copying +// a pointer value. + +#ifndef _STLP_INTERNAL_ROPE_H +#define _STLP_INTERNAL_ROPE_H + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_INTERNAL_IOSFWD) +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALGO_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUMERIC_H +# include +#endif + +#ifndef _STLP_INTERNAL_HASH_FUN_H +# include +#endif + +#ifndef _STLP_CHAR_TRAITS_H +# include +#endif + +#ifndef _STLP_INTERNAL_THREADS_H +# include +#endif + +#ifdef _STLP_SGI_THREADS +# include +#endif + +#ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE +# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) (_Alloc_traits<_Tp,__atype>::create_allocator(__a)) +#else +# define _STLP_CREATE_ALLOCATOR(__atype,__a, _Tp) __stl_alloc_create(__a,(_Tp*)0) +#endif + +_STLP_BEGIN_NAMESPACE + +// First a lot of forward declarations. The standard seems to require +// much stricter "declaration before use" than many of the implementations +// that preceded it. +template) > class rope; +template struct _Rope_RopeConcatenation; +template struct _Rope_RopeRep; +template struct _Rope_RopeLeaf; +template struct _Rope_RopeFunction; +template struct _Rope_RopeSubstring; +template class _Rope_iterator; +template class _Rope_const_iterator; +template class _Rope_char_ref_proxy; +template class _Rope_char_ptr_proxy; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _BasicCharType { typedef __false_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct _BasicCharType { typedef __true_type _Ret; }; + +#ifdef _STLP_HAS_WCHAR_T +_STLP_TEMPLATE_NULL +struct _BasicCharType { typedef __true_type _Ret; }; +#endif + +// Some helpers, so we can use the power algorithm on ropes. +// See below for why this isn't local to the implementation. + +// This uses a nonstandard refcount convention. +// The result has refcount 0. +template +struct _Rope_Concat_fn + : public binary_function, rope<_CharT,_Alloc>, + rope<_CharT,_Alloc> > { + rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x, + const rope<_CharT,_Alloc>& __y) { + return __x + __y; + } +}; + +template +inline +rope<_CharT,_Alloc> +__identity_element(_Rope_Concat_fn<_CharT, _Alloc>) +{ return rope<_CharT,_Alloc>(); } + +_STLP_MOVE_TO_STD_NAMESPACE + +// Store an eos +template +inline void _S_construct_null_aux(_CharT *__p, const __true_type&) +{ *__p = 0; } + +template +inline void _S_construct_null_aux(_CharT *__p, const __false_type&) +{ _STLP_STD::_Construct(__p); } + +template +inline void _S_construct_null(_CharT *__p) { + typedef typename _IsIntegral<_CharT>::_Ret _Char_Is_Integral; + _S_construct_null_aux(__p, _Char_Is_Integral()); +} + +// char_producers are logically functions that generate a section of +// a string. These can be converted to ropes. The resulting rope +// invokes the char_producer on demand. This allows, for example, +// files to be viewed as ropes without reading the entire file. +template +class char_producer { +public: + virtual ~char_producer() {} + virtual void operator()(size_t __start_pos, size_t __len, + _CharT* __buffer) = 0; + // Buffer should really be an arbitrary output iterator. + // That way we could flatten directly into an ostream, etc. + // This is thoroughly impossible, since iterator types don't + // have runtime descriptions. +}; + +// Sequence buffers: +// +// Sequence must provide an append operation that appends an +// array to the sequence. Sequence buffers are useful only if +// appending an entire array is cheaper than appending element by element. +// This is true for many string representations. +// This should perhaps inherit from ostream +// and be implemented correspondingly, so that they can be used +// for formatted. For the sake of portability, we don't do this yet. +// +// For now, sequence buffers behave as output iterators. But they also +// behave a little like basic_ostringstream and a +// little like containers. + +template +// The 3rd parameter works around a common compiler bug. +class sequence_buffer : public iterator { +public: +# ifndef __TYPEDEF_WORKAROUND + typedef typename _Sequence::value_type value_type; + typedef sequence_buffer<_Sequence +# if !(defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) || \ + defined ( _STLP_NO_DEFAULT_NON_TYPE_PARAM )) + , _Buf_sz + > _Self; +# else /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ + > _Self; + enum { _Buf_sz = 100}; +# endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */ + // # endif +# else /* __TYPEDEF_WORKAROUND */ + typedef _V value_type; + typedef sequence_buffer<_Sequence, _Buf_sz, _V> _Self; +# endif /* __TYPEDEF_WORKAROUND */ +protected: + _Sequence* _M_prefix; + value_type _M_buffer[_Buf_sz]; + size_t _M_buf_count; +public: + void flush() { + _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count); + _M_buf_count = 0; + } + ~sequence_buffer() { flush(); } + sequence_buffer() : _M_prefix(0), _M_buf_count(0) {} + sequence_buffer(const _Self& __x) { + _M_prefix = __x._M_prefix; + _M_buf_count = __x._M_buf_count; + _STLP_STD::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); + } + sequence_buffer(_Self& __x) { + __x.flush(); + _M_prefix = __x._M_prefix; + _M_buf_count = 0; + } + sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {} + _Self& operator= (_Self& __x) { + __x.flush(); + _M_prefix = __x._M_prefix; + _M_buf_count = 0; + return *this; + } + _Self& operator= (const _Self& __x) { + _M_prefix = __x._M_prefix; + _M_buf_count = __x._M_buf_count; + _STLP_STD::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); + return *this; + } + void push_back(value_type __x) { + if (_M_buf_count < _Buf_sz) { + _M_buffer[_M_buf_count] = __x; + ++_M_buf_count; + } else { + flush(); + _M_buffer[0] = __x; + _M_buf_count = 1; + } + } + void append(const value_type *__s, size_t __len) { + if (__len + _M_buf_count <= _Buf_sz) { + size_t __i = _M_buf_count; + size_t __j = 0; + for (; __j < __len; __i++, __j++) { + _M_buffer[__i] = __s[__j]; + } + _M_buf_count += __len; + } else if (0 == _M_buf_count) { + _M_prefix->append(__s, __s + __len); + } else { + flush(); + append(__s, __len); + } + } + _Self& write(const value_type *__s, size_t __len) { + append(__s, __len); + return *this; + } + _Self& put(value_type __x) { + push_back(__x); + return *this; + } + _Self& operator=(const value_type& __rhs) { + push_back(__rhs); + return *this; + } + _Self& operator*() { return *this; } + _Self& operator++() { return *this; } + _Self& operator++(int) { return *this; } +}; + +// The following should be treated as private, at least for now. +template +class _Rope_char_consumer { +#if !defined (_STLP_MEMBER_TEMPLATES) +public: + //Without member templates we have to use run-time parameterization. + // The symmetry with char_producer is accidental and temporary. + virtual ~_Rope_char_consumer() {} + virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; +#endif +}; + +// +// What follows should really be local to rope. Unfortunately, +// that doesn't work, since it makes it impossible to define generic +// equality on rope iterators. According to the draft standard, the +// template parameters for such an equality operator cannot be inferred +// from the occurence of a member class as a parameter. +// (SGI compilers in fact allow this, but the __result wouldn't be +// portable.) +// Similarly, some of the static member functions are member functions +// only to avoid polluting the global namespace, and to circumvent +// restrictions on type inference for template functions. +// + +// +// The internal data structure for representing a rope. This is +// private to the implementation. A rope is really just a pointer +// to one of these. +// +// A few basic functions for manipulating this data structure +// are members of _RopeRep. Most of the more complex algorithms +// are implemented as rope members. +// +// Some of the static member functions of _RopeRep have identically +// named functions in rope that simply invoke the _RopeRep versions. +// + +template +struct _Rope_RopeRep + : public _Refcount_Base +{ + typedef _Rope_RopeRep<_CharT, _Alloc> _Self; +public: + // + // GAB: 11/09/05 + // + // "__ROPE_DEPTH_SIZE" is set to one more then the "__ROPE_MAX_DEPTH". + // This was originally just an addition of "__ROPE_MAX_DEPTH + 1" + // but this addition causes the sunpro compiler to complain about + // multiple declarations during the initialization of "_S_min_len". + // Changed to be a fixed value and the sunpro compiler appears to + // be happy??? + // +# define __ROPE_MAX_DEPTH 45 +# define __ROPE_DEPTH_SIZE 46 // __ROPE_MAX_DEPTH + 1 + enum { _S_max_rope_depth = __ROPE_MAX_DEPTH }; + enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; + // Apparently needed by VC++ + // The data fields of leaves are allocated with some + // extra space, to accomodate future growth and for basic + // character types, to hold a trailing eos character. + enum { _S_alloc_granularity = 8 }; + + _Tag _M_tag:8; + bool _M_is_balanced:8; + + _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) + typedef _Alloc allocator_type; + + allocator_type get_allocator() const { return allocator_type(_M_size); } + + unsigned char _M_depth; + _CharT* _STLP_VOLATILE _M_c_string; + _STLP_PRIV _STLP_alloc_proxy _M_size; + +#ifdef _STLP_NO_ARROW_OPERATOR + _Rope_RopeRep() : _Refcount_Base(1), _M_size(allocator_type(), 0) { +# if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) + _STLP_CHECK_RUNTIME_COMPATIBILITY(); +# endif + } +#endif + + /* Flattened version of string, if needed. */ + /* typically 0. */ + /* If it's not 0, then the memory is owned */ + /* by this node. */ + /* In the case of a leaf, this may point to */ + /* the same memory as the data field. */ + _Rope_RopeRep(_Tag __t, unsigned char __d, bool __b, size_t _p_size, + allocator_type __a) : + _Refcount_Base(1), + _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0), _M_size(__a, _p_size) { +#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) + _STLP_CHECK_RUNTIME_COMPATIBILITY(); +#endif + } + + typedef _STLP_TYPENAME _STLP_PRIV _BasicCharType<_CharT>::_Ret _IsBasicCharType; + +#if 0 + /* Please tell why this code is necessary if you uncomment it. + * Problem with it is that rope implementation expect that _S_rounded_up_size(n) + * returns a size > n in order to store the terminating null charater. When + * instanciation type is not a char or wchar_t this is not guaranty resulting in + * memory overrun. + */ + static size_t _S_rounded_up_size_aux(size_t __n, __true_type const& /*_IsBasicCharType*/) { + // Allow slop for in-place expansion. + return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); + } + + static size_t _S_rounded_up_size_aux(size_t __n, __false_type const& /*_IsBasicCharType*/) { + // Allow slop for in-place expansion. + return (__n + _S_alloc_granularity - 1) & ~(_S_alloc_granularity - 1); + } +#endif + // fbp : moved from RopeLeaf + static size_t _S_rounded_up_size(size_t __n) + //{ return _S_rounded_up_size_aux(__n, _IsBasicCharType()); } + { return (__n + _S_alloc_granularity) & ~(_S_alloc_granularity - 1); } + + static void _S_free_string( _CharT* __s, size_t __len, + allocator_type __a) { + _STLP_STD::_Destroy_Range(__s, __s + __len); + // This has to be a static member, so this gets a bit messy +# ifndef _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE + __a.deallocate(__s, _S_rounded_up_size(__len)); //*ty 03/24/2001 - restored not to use __stl_alloc_rebind() since it is not defined under _STLP_MEMBER_TEMPLATE_CLASSES +# else + __stl_alloc_rebind (__a, (_CharT*)0).deallocate(__s, _S_rounded_up_size(__len)); +# endif + } + + // Deallocate data section of a leaf. + // This shouldn't be a member function. + // But its hard to do anything else at the + // moment, because it's templatized w.r.t. + // an allocator. + // Does nothing if __GC is defined. + void _M_free_c_string(); + void _M_free_tree(); + // Deallocate t. Assumes t is not 0. + void _M_unref_nonnil() { + if (_M_decr() == 0) _M_free_tree(); + } + void _M_ref_nonnil() { + _M_incr(); + } + static void _S_unref(_Self* __t) { + if (0 != __t) { + __t->_M_unref_nonnil(); + } + } + static void _S_ref(_Self* __t) { + if (0 != __t) __t->_M_incr(); + } + //static void _S_free_if_unref(_Self* __t) { + // if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree(); + //} +}; + +template +struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { +public: + _CharT* _M_data; /* Not necessarily 0 terminated. */ + /* The allocated size is */ + /* _S_rounded_up_size(size), except */ + /* in the GC case, in which it */ + /* doesn't matter. */ +private: + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType; + void _M_init(__true_type const& /*_IsBasicCharType*/) { + this->_M_c_string = _M_data; + } + void _M_init(__false_type const& /*_IsBasicCharType*/) {} + +public: + _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) + typedef typename _RopeRep::allocator_type allocator_type; + + _Rope_RopeLeaf( _CharT* __d, size_t _p_size, allocator_type __a) + : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_leaf, 0, true, _p_size, __a), + _M_data(__d) { + _STLP_ASSERT(_p_size > 0) + _M_init(_IsBasicCharType()); + } + +# ifdef _STLP_NO_ARROW_OPERATOR + _Rope_RopeLeaf() {} + _Rope_RopeLeaf(const _Rope_RopeLeaf<_CharT, _Alloc>& ) {} +# endif + +// The constructor assumes that d has been allocated with + // the proper allocator and the properly padded size. + // In contrast, the destructor deallocates the data: + ~_Rope_RopeLeaf() { + if (_M_data != this->_M_c_string) { + this->_M_free_c_string(); + } + _RopeRep::_S_free_string(_M_data, this->_M_size._M_data, this->get_allocator()); + } +}; + +template +struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT, _Alloc> { +private: + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + +public: + _RopeRep* _M_left; + _RopeRep* _M_right; + _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) + typedef typename _RopeRep::allocator_type allocator_type; + _Rope_RopeConcatenation(_RopeRep* __l, _RopeRep* __r, allocator_type __a) + : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_concat, + (max)(__l->_M_depth, __r->_M_depth) + 1, false, + __l->_M_size._M_data + __r->_M_size._M_data, __a), _M_left(__l), _M_right(__r) + {} +# ifdef _STLP_NO_ARROW_OPERATOR + _Rope_RopeConcatenation() {} + _Rope_RopeConcatenation(const _Rope_RopeConcatenation<_CharT, _Alloc>&) {} +# endif + + ~_Rope_RopeConcatenation() { + this->_M_free_c_string(); + _M_left->_M_unref_nonnil(); + _M_right->_M_unref_nonnil(); + } +}; + +template +struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT, _Alloc> { +private: + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; +public: + char_producer<_CharT>* _M_fn; + /* + * Char_producer is owned by the + * rope and should be explicitly + * deleted when the rope becomes + * inaccessible. + */ + bool _M_delete_when_done; + _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) + typedef typename _Rope_RopeRep<_CharT,_Alloc>::allocator_type allocator_type; +# ifdef _STLP_NO_ARROW_OPERATOR + _Rope_RopeFunction() {} + _Rope_RopeFunction(const _Rope_RopeFunction<_CharT, _Alloc>& ) {} +# endif + + _Rope_RopeFunction(char_producer<_CharT>* __f, size_t _p_size, + bool __d, allocator_type __a) + : _Rope_RopeRep<_CharT,_Alloc>(_RopeRep::_S_function, 0, true, _p_size, __a), _M_fn(__f) + , _M_delete_when_done(__d) + { _STLP_ASSERT(_p_size > 0) } + + ~_Rope_RopeFunction() { + this->_M_free_c_string(); + if (_M_delete_when_done) { + delete _M_fn; + } + } +}; + +/* + * Substring results are usually represented using just + * concatenation nodes. But in the case of very long flat ropes + * or ropes with a functional representation that isn't practical. + * In that case, we represent the __result as a special case of + * RopeFunction, whose char_producer points back to the rope itself. + * In all cases except repeated substring operations and + * deallocation, we treat the __result as a RopeFunction. + */ +template +struct _Rope_RopeSubstring : public char_producer<_CharT>, public _Rope_RopeFunction<_CharT,_Alloc> { +public: + // XXX this whole class should be rewritten. + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + _RopeRep *_M_base; // not 0 + size_t _M_start; + /* virtual */ void operator()(size_t __start_pos, size_t __req_len, + _CharT* __buffer) { + typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; + typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; + switch (_M_base->_M_tag) { + case _RopeRep::_S_function: + case _RopeRep::_S_substringfn: + { + char_producer<_CharT>* __fn = + __STATIC_CAST(_RopeFunction*, _M_base)->_M_fn; + _STLP_ASSERT(__start_pos + __req_len <= this->_M_size._M_data) + _STLP_ASSERT(_M_start + this->_M_size._M_data <= _M_base->_M_size._M_data) + (*__fn)(__start_pos + _M_start, __req_len, __buffer); + } + break; + case _RopeRep::_S_leaf: + { + _CharT* __s = + __STATIC_CAST(_RopeLeaf*, _M_base)->_M_data; + _STLP_PRIV __ucopy_n(__s + __start_pos + _M_start, __req_len, __buffer); + } + break; + default: + _STLP_ASSERT(false) + ; + } + } + + _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) + typedef typename _RopeRep::allocator_type allocator_type; + + _Rope_RopeSubstring(_RopeRep* __b, size_t __s, size_t __l, allocator_type __a) + : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a), + _M_base(__b), _M_start(__s) { + _STLP_ASSERT(__l > 0) + _STLP_ASSERT(__s + __l <= __b->_M_size._M_data) + _M_base->_M_ref_nonnil(); + this->_M_tag = _RopeRep::_S_substringfn; + } + virtual ~_Rope_RopeSubstring() + { _M_base->_M_unref_nonnil(); } +}; + +/* + * Self-destructing pointers to Rope_rep. + * These are not conventional smart pointers. Their + * only purpose in life is to ensure that unref is called + * on the pointer either at normal exit or if an exception + * is raised. It is the caller's responsibility to + * adjust reference counts when these pointers are initialized + * or assigned to. (This convention significantly reduces + * the number of potentially expensive reference count + * updates.) + */ +template +struct _Rope_self_destruct_ptr { + _Rope_RopeRep<_CharT,_Alloc>* _M_ptr; + ~_Rope_self_destruct_ptr() + { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); } +# ifdef _STLP_USE_EXCEPTIONS + _Rope_self_destruct_ptr() : _M_ptr(0) {} +# else + _Rope_self_destruct_ptr() {} +# endif + _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {} + _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; } + _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; } + operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; } + _Rope_self_destruct_ptr<_CharT, _Alloc>& + operator= (_Rope_RopeRep<_CharT,_Alloc>* __x) + { _M_ptr = __x; return *this; } +}; + +/* + * Dereferencing a nonconst iterator has to return something + * that behaves almost like a reference. It's not possible to + * return an actual reference since assignment requires extra + * work. And we would get into the same problems as with the + * CD2 version of basic_string. + */ +template +class _Rope_char_ref_proxy { + typedef _Rope_char_ref_proxy<_CharT, _Alloc> _Self; + friend class rope<_CharT,_Alloc>; + friend class _Rope_iterator<_CharT,_Alloc>; + friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; + typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + typedef rope<_CharT,_Alloc> _My_rope; + size_t _M_pos; + _CharT _M_current; + bool _M_current_valid; + _My_rope* _M_root; // The whole rope. +public: + _Rope_char_ref_proxy(_My_rope* __r, size_t __p) : + _M_pos(__p), _M_current_valid(false), _M_root(__r) {} + _Rope_char_ref_proxy(const _Self& __x) : + _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {} + // Don't preserve cache if the reference can outlive the + // expression. We claim that's not possible without calling + // a copy constructor or generating reference to a proxy + // reference. We declare the latter to have undefined semantics. + _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) + : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} + inline operator _CharT () const; + _Self& operator= (_CharT __c); + _Rope_char_ptr_proxy<_CharT, _Alloc> operator& () const; + _Self& operator= (const _Self& __c) { + return operator=((_CharT)__c); + } +}; + +#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER +template +inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, + _Rope_char_ref_proxy <_CharT, __Alloc > __b) { + _CharT __tmp = __a; + __a = __b; + __b = __tmp; +} +#else +// There is no really acceptable way to handle this. The default +// definition of swap doesn't work for proxy references. +// It can't really be made to work, even with ugly hacks, since +// the only unusual operation it uses is the copy constructor, which +// is needed for other purposes. We provide a macro for +// full specializations, and instantiate the most common case. +# define _ROPE_SWAP_SPECIALIZATION(_CharT, __Alloc) \ + inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, \ + _Rope_char_ref_proxy <_CharT, __Alloc > __b) { \ + _CharT __tmp = __a; \ + __a = __b; \ + __b = __tmp; \ + } + +_ROPE_SWAP_SPECIALIZATION(char, allocator) + +# ifndef _STLP_NO_WCHAR_T +_ROPE_SWAP_SPECIALIZATION(wchar_t, allocator) +# endif + +#endif /* !_STLP_FUNCTION_TMPL_PARTIAL_ORDER */ + +template +class _Rope_char_ptr_proxy { + // XXX this class should be rewritten. +public: + typedef _Rope_char_ptr_proxy<_CharT, _Alloc> _Self; + friend class _Rope_char_ref_proxy<_CharT,_Alloc>; + size_t _M_pos; + rope<_CharT,_Alloc>* _M_root; // The whole rope. + + _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) + : _M_pos(__x._M_pos), _M_root(__x._M_root) {} + _Rope_char_ptr_proxy(const _Self& __x) + : _M_pos(__x._M_pos), _M_root(__x._M_root) {} + _Rope_char_ptr_proxy() {} + _Rope_char_ptr_proxy(_CharT* __x) : _M_pos(0), _M_root(0) { + _STLP_ASSERT(0 == __x) + } + _Self& operator= (const _Self& __x) { + _M_pos = __x._M_pos; + _M_root = __x._M_root; + return *this; + } + + _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const { + return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos); + } +}; + + +/* + * Rope iterators: + * Unlike in the C version, we cache only part of the stack + * for rope iterators, since they must be efficiently copyable. + * When we run out of cache, we have to reconstruct the iterator + * value. + * Pointers from iterators are not included in reference counts. + * Iterators are assumed to be thread private. Ropes can + * be shared. + */ +template +class _Rope_iterator_base +/* : public random_access_iterator<_CharT, ptrdiff_t> */ +{ + friend class rope<_CharT,_Alloc>; + typedef _Rope_iterator_base<_CharT, _Alloc> _Self; + typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcat; +public: + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + + enum { _S_path_cache_len = 4 }; // Must be <= 9 because of _M_path_direction. + enum { _S_iterator_buf_len = 15 }; + size_t _M_current_pos; + // The whole rope. + _RopeRep* _M_root; + // Starting position for current leaf + size_t _M_leaf_pos; + // Buffer possibly containing current char. + _CharT* _M_buf_start; + // Pointer to current char in buffer, != 0 ==> buffer valid. + _CharT* _M_buf_ptr; + // One past __last valid char in buffer. + _CharT* _M_buf_end; + + // What follows is the path cache. We go out of our + // way to make this compact. + // Path_end contains the bottom section of the path from + // the root to the current leaf. + struct { +# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) + _RopeRep const*_M_data[4]; +# else + _RopeRep const*_M_data[_S_path_cache_len]; +# endif + } _M_path_end; + // Last valid __pos in path_end; + // _M_path_end[0] ... _M_path_end[_M_leaf_index-1] + // point to concatenation nodes. + int _M_leaf_index; + // (_M_path_directions >> __i) & 1 is 1 + // if we got from _M_path_end[leaf_index - __i - 1] + // to _M_path_end[leaf_index - __i] by going to the + // __right. Assumes path_cache_len <= 9. + unsigned char _M_path_directions; + // Short buffer for surrounding chars. + // This is useful primarily for + // RopeFunctions. We put the buffer + // here to avoid locking in the + // multithreaded case. + // The cached path is generally assumed to be valid + // only if the buffer is valid. + struct { +# if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) + _CharT _M_data[15]; +# else + _CharT _M_data[_S_iterator_buf_len]; +# endif + } _M_tmp_buf; + + // Set buffer contents given path cache. + static void _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x); + // Set buffer contents and path cache. + static void _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x); + // As above, but assumes path cache is valid for previous posn. + static void _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x); + _Rope_iterator_base() {} + _Rope_iterator_base(_RopeRep* __root, size_t __pos) + : _M_current_pos(__pos),_M_root(__root), _M_buf_ptr(0) {} + void _M_incr(size_t __n); + void _M_decr(size_t __n); +public: + size_t index() const { return _M_current_pos; } +private: + void _M_copy_buf(const _Self& __x) { + _M_tmp_buf = __x._M_tmp_buf; + if (__x._M_buf_start == __x._M_tmp_buf._M_data) { + _M_buf_start = _M_tmp_buf._M_data; + _M_buf_end = _M_buf_start + (__x._M_buf_end - __x._M_buf_start); + _M_buf_ptr = _M_buf_start + (__x._M_buf_ptr - __x._M_buf_start); + } else { + _M_buf_end = __x._M_buf_end; + } + } + +public: + _Rope_iterator_base(const _Self& __x) : + _M_current_pos(__x._M_current_pos), + _M_root(__x._M_root), + _M_leaf_pos( __x._M_leaf_pos ), + _M_buf_start(__x._M_buf_start), + _M_buf_ptr(__x._M_buf_ptr), + _M_path_end(__x._M_path_end), + _M_leaf_index(__x._M_leaf_index), + _M_path_directions(__x._M_path_directions) + { + if (0 != __x._M_buf_ptr) { + _M_copy_buf(__x); + } + } + _Self& operator = (const _Self& __x) + { + _M_current_pos = __x._M_current_pos; + _M_root = __x._M_root; + _M_buf_start = __x._M_buf_start; + _M_buf_ptr = __x._M_buf_ptr; + _M_path_end = __x._M_path_end; + _M_leaf_index = __x._M_leaf_index; + _M_path_directions = __x._M_path_directions; + _M_leaf_pos = __x._M_leaf_pos; + if (0 != __x._M_buf_ptr) { + _M_copy_buf(__x); + } + return *this; + } +}; + +template class _Rope_iterator; + +template +class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { + friend class rope<_CharT,_Alloc>; + typedef _Rope_const_iterator<_CharT, _Alloc> _Self; + typedef _Rope_iterator_base<_CharT,_Alloc> _Base; + // protected: +public: +# ifndef _STLP_HAS_NO_NAMESPACES + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + // The one from the base class may not be directly visible. +# endif + _Rope_const_iterator(const _RopeRep* __root, size_t __pos): + _Rope_iterator_base<_CharT,_Alloc>(__CONST_CAST(_RopeRep*,__root), __pos) + // Only nonconst iterators modify root ref count + {} +public: + typedef _CharT reference; // Really a value. Returning a reference + // Would be a mess, since it would have + // to be included in refcount. + typedef const _CharT* pointer; + typedef _CharT value_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag iterator_category; + +public: + _Rope_const_iterator() {} + _Rope_const_iterator(const _Self& __x) : + _Rope_iterator_base<_CharT,_Alloc>(__x) { } + _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x): + _Rope_iterator_base<_CharT,_Alloc>(__x) {} + _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) : + _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr._M_data, __pos) {} + _Self& operator= (const _Self& __x) { + _Base::operator=(__x); + return *this; + } + reference operator*() { + if (0 == this->_M_buf_ptr) +#if !defined (__DMC__) + _S_setcache(*this); +#else + { _Rope_iterator_base<_CharT, _Alloc>* __x = this; _S_setcache(*__x); } +#endif + return *(this->_M_buf_ptr); + } + _Self& operator++() + { + if ( this->_M_buf_ptr != 0 ) { + _CharT *__next = this->_M_buf_ptr + 1; + if ( __next < this->_M_buf_end ) { + this->_M_buf_ptr = __next; + ++this->_M_current_pos; + return *this; + } + } + this->_M_incr(1); + return *this; + } + _Self& operator+=(ptrdiff_t __n) { + if (__n >= 0) { + this->_M_incr(__n); + } else { + this->_M_decr(-__n); + } + return *this; + } + _Self& operator--() { + this->_M_decr(1); + return *this; + } + _Self& operator-=(ptrdiff_t __n) { + if (__n >= 0) { + this->_M_decr(__n); + } else { + this->_M_incr(-__n); + } + return *this; + } + _Self operator++(int) { + size_t __old_pos = this->_M_current_pos; + this->_M_incr(1); + return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); + // This makes a subsequent dereference expensive. + // Perhaps we should instead copy the iterator + // if it has a valid cache? + } + _Self operator--(int) { + size_t __old_pos = this->_M_current_pos; + this->_M_decr(1); + return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); + } + inline reference operator[](size_t __n); +}; + +template +class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { + friend class rope<_CharT,_Alloc>; + typedef _Rope_iterator<_CharT, _Alloc> _Self; + typedef _Rope_iterator_base<_CharT,_Alloc> _Base; + typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; + +public: + rope<_CharT,_Alloc>* _M_root_rope; + // root is treated as a cached version of this, + // and is used to detect changes to the underlying + // rope. + // Root is included in the reference count. + // This is necessary so that we can detect changes reliably. + // Unfortunately, it requires careful bookkeeping for the + // nonGC case. + _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos); + + void _M_check(); +public: + typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; + typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer; + typedef _CharT value_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag iterator_category; +public: + ~_Rope_iterator() { //*TY 5/6/00 - added dtor to balance reference count + _RopeRep::_S_unref(this->_M_root); + } + + rope<_CharT,_Alloc>& container() { return *_M_root_rope; } + _Rope_iterator() { + this->_M_root = 0; // Needed for reference counting. + } + _Rope_iterator(const _Self& __x) : + _Rope_iterator_base<_CharT,_Alloc>(__x) { + _M_root_rope = __x._M_root_rope; + _RopeRep::_S_ref(this->_M_root); + } + _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos); + _Self& operator= (const _Self& __x) { + _RopeRep* __old = this->_M_root; + _RopeRep::_S_ref(__x._M_root); + _Base::operator=(__x); + _M_root_rope = __x._M_root_rope; + _RopeRep::_S_unref(__old); + return *this; + } + reference operator*() { + _M_check(); + if (0 == this->_M_buf_ptr) { + return reference(_M_root_rope, this->_M_current_pos); + } else { + return reference(_M_root_rope, this->_M_current_pos, *(this->_M_buf_ptr)); + } + } + _Self& operator++() { + this->_M_incr(1); + return *this; + } + _Self& operator+=(ptrdiff_t __n) { + if (__n >= 0) { + this->_M_incr(__n); + } else { + this->_M_decr(-__n); + } + return *this; + } + _Self& operator--() { + this->_M_decr(1); + return *this; + } + _Self& operator-=(ptrdiff_t __n) { + if (__n >= 0) { + this->_M_decr(__n); + } else { + this->_M_incr(-__n); + } + return *this; + } + _Self operator++(int) { + size_t __old_pos = this->_M_current_pos; + this->_M_incr(1); + return _Self(_M_root_rope, __old_pos); + } + _Self operator--(int) { + size_t __old_pos = this->_M_current_pos; + this->_M_decr(1); + return _Self(_M_root_rope, __old_pos); + } + reference operator[](ptrdiff_t __n) { + return reference(_M_root_rope, this->_M_current_pos + __n); + } +}; + +# ifdef _STLP_USE_OLD_HP_ITERATOR_QUERIES +template +inline random_access_iterator_tag +iterator_category(const _Rope_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag();} +template +inline _CharT* value_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; } +template +inline ptrdiff_t* distance_type(const _Rope_iterator<_CharT,_Alloc>&) { return 0; } +template +inline random_access_iterator_tag +iterator_category(const _Rope_const_iterator<_CharT,_Alloc>&) { return random_access_iterator_tag(); } +template +inline _CharT* value_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; } +template +inline ptrdiff_t* distance_type(const _Rope_const_iterator<_CharT,_Alloc>&) { return 0; } +#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ + +template +bool _S_apply_to_pieces(_CharConsumer& __c, + _Rope_RopeRep<_CharT, _Alloc> *__r, + size_t __begin, size_t __end); + // begin and end are assumed to be in range. + +template +class rope +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef rope<_CharT,_Alloc> _Self; +public: + typedef _CharT value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef _CharT const_reference; + typedef const _CharT* const_pointer; + typedef _Rope_iterator<_CharT,_Alloc> iterator; + typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator; + typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; + typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer; + + friend class _Rope_iterator<_CharT,_Alloc>; + friend class _Rope_const_iterator<_CharT,_Alloc>; + friend struct _Rope_RopeRep<_CharT,_Alloc>; + friend class _Rope_iterator_base<_CharT,_Alloc>; + friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; + friend class _Rope_char_ref_proxy<_CharT,_Alloc>; + friend struct _Rope_RopeSubstring<_CharT,_Alloc>; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +protected: + typedef _CharT* _Cstrptr; + + static _CharT _S_empty_c_str[1]; + + enum { _S_copy_max = 23 }; + // For strings shorter than _S_copy_max, we copy to + // concatenate. + + typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; + typedef typename _RopeRep::_IsBasicCharType _IsBasicCharType; + +public: + _STLP_FORCE_ALLOCATORS(_CharT, _Alloc) + typedef _Alloc allocator_type; + +public: + // The only data member of a rope: + _STLP_PRIV _STLP_alloc_proxy<_RopeRep*, _CharT, allocator_type> _M_tree_ptr; + +public: + allocator_type get_allocator() const { return allocator_type(_M_tree_ptr); } + +public: + typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; + typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; + typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; + typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring; + + // Retrieve a character at the indicated position. + static _CharT _S_fetch(_RopeRep* __r, size_type __pos); + + // Obtain a pointer to the character at the indicated position. + // The pointer can be used to change the character. + // If such a pointer cannot be produced, as is frequently the + // case, 0 is returned instead. + // (Returns nonzero only if all nodes in the path have a refcount + // of 1.) + static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos); + + static void _S_unref(_RopeRep* __t) { + _RopeRep::_S_unref(__t); + } + static void _S_ref(_RopeRep* __t) { + _RopeRep::_S_ref(__t); + } + + typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; + + // _Result is counted in refcount. + static _RopeRep* _S_substring(_RopeRep* __base, + size_t __start, size_t __endp1); + + static _RopeRep* _S_concat_char_iter(_RopeRep* __r, + const _CharT* __iter, size_t __slen); + // Concatenate rope and char ptr, copying __s. + // Should really take an arbitrary iterator. + // Result is counted in refcount. + static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, + const _CharT* __iter, size_t __slen); + // As above, but one reference to __r is about to be + // destroyed. Thus the pieces may be recycled if all + // relevent reference counts are 1. + + // General concatenation on _RopeRep. _Result + // has refcount of 1. Adjusts argument refcounts. + static _RopeRep* _S_concat_rep(_RopeRep* __left, _RopeRep* __right); + +public: +#if defined (_STLP_MEMBER_TEMPLATES) + template +#else + typedef _Rope_char_consumer<_CharT> _CharConsumer; +#endif + void apply_to_pieces(size_t __begin, size_t __end, + _CharConsumer& __c) const + { _S_apply_to_pieces(__c, _M_tree_ptr._M_data, __begin, __end); } + +protected: + + static size_t _S_rounded_up_size(size_t __n) + { return _RopeRep::_S_rounded_up_size(__n); } + + // Allocate and construct a RopeLeaf using the supplied allocator + // Takes ownership of s instead of copying. + static _RopeLeaf* _S_new_RopeLeaf(_CharT *__s, + size_t _p_size, allocator_type __a) { + _RopeLeaf* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, + _RopeLeaf).allocate(1); + _STLP_TRY { + new(__space) _RopeLeaf(__s, _p_size, __a); + } + _STLP_UNWIND(_STLP_CREATE_ALLOCATOR(allocator_type,__a, + _RopeLeaf).deallocate(__space, 1)) + return __space; + } + + static _RopeConcatenation* _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right, + allocator_type __a) { + _RopeConcatenation* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, + _RopeConcatenation).allocate(1); + return new(__space) _RopeConcatenation(__left, __right, __a); + } + + static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f, + size_t _p_size, bool __d, allocator_type __a) { + _RopeFunction* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, + _RopeFunction).allocate(1); + return new(__space) _RopeFunction(__f, _p_size, __d, __a); + } + + static _RopeSubstring* _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, + size_t __l, allocator_type __a) { + _RopeSubstring* __space = _STLP_CREATE_ALLOCATOR(allocator_type, __a, + _RopeSubstring).allocate(1); + return new(__space) _RopeSubstring(__b, __s, __l, __a); + } + + static + _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, + size_t _p_size, allocator_type __a) { + if (0 == _p_size) return 0; + + _CharT* __buf = _STLP_CREATE_ALLOCATOR(allocator_type,__a, _CharT).allocate(_S_rounded_up_size(_p_size)); + + _STLP_PRIV __ucopy_n(__s, _p_size, __buf); + _S_construct_null(__buf + _p_size); + + _STLP_TRY { + return _S_new_RopeLeaf(__buf, _p_size, __a); + } + _STLP_UNWIND(_RopeRep::_S_free_string(__buf, _p_size, __a)) + _STLP_RET_AFTER_THROW(0) + } + + + // Concatenation of nonempty strings. + // Always builds a concatenation node. + // Rebalances if the result is too deep. + // Result has refcount 1. + // Does not increment left and right ref counts even though + // they are referenced. + static _RopeRep* + _S_tree_concat(_RopeRep* __left, _RopeRep* __right); + + // Concatenation helper functions + static _RopeLeaf* + _S_leaf_concat_char_iter(_RopeLeaf* __r, + const _CharT* __iter, size_t __slen); + // Concatenate by copying leaf. + // should take an arbitrary iterator + // result has refcount 1. + static _RopeLeaf* _S_destr_leaf_concat_char_iter + (_RopeLeaf* __r, const _CharT* __iter, size_t __slen); + // A version that potentially clobbers __r if __r->_M_ref_count == 1. + + + // A helper function for exponentiating strings. + // This uses a nonstandard refcount convention. + // The result has refcount 0. + typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn; +#if !defined (__GNUC__) || (__GNUC__ < 3) + friend _Concat_fn; +#else + friend struct _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc>; +#endif + +public: + static size_t _S_char_ptr_len(const _CharT* __s) { + return char_traits<_CharT>::length(__s); + } + +public: /* for operators */ + rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, __t) { } +private: + // Copy __r to the _CharT buffer. + // Returns __buffer + __r->_M_size._M_data. + // Assumes that buffer is uninitialized. + static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer); + + // Again, with explicit starting position and length. + // Assumes that buffer is uninitialized. + static _CharT* _S_flatten(_RopeRep* __r, + size_t __start, size_t __len, + _CharT* __buffer); + + // fbp : HP aCC prohibits access to protected min_len from within static methods ( ?? ) +public: + static const unsigned long _S_min_len[__ROPE_DEPTH_SIZE]; +protected: + static bool _S_is_balanced(_RopeRep* __r) + { return (__r->_M_size._M_data >= _S_min_len[__r->_M_depth]); } + + static bool _S_is_almost_balanced(_RopeRep* __r) { + return (__r->_M_depth == 0 || + __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 1]); + } + + static bool _S_is_roughly_balanced(_RopeRep* __r) { + return (__r->_M_depth <= 1 || + __r->_M_size._M_data >= _S_min_len[__r->_M_depth - 2]); + } + + // Assumes the result is not empty. + static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left, + _RopeRep* __right) { + _RopeRep* __result = _S_concat_rep(__left, __right); + if (_S_is_balanced(__result)) __result->_M_is_balanced = true; + return __result; + } + + // The basic rebalancing operation. Logically copies the + // rope. The result has refcount of 1. The client will + // usually decrement the reference count of __r. + // The result is within height 2 of balanced by the above + // definition. + static _RopeRep* _S_balance(_RopeRep* __r); + + // Add all unbalanced subtrees to the forest of balanceed trees. + // Used only by balance. + static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); + + // Add __r to forest, assuming __r is already balanced. + static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); + +#ifdef _STLP_DEBUG + // Print to stdout, exposing structure + static void _S_dump(_RopeRep* __r, int __indent = 0); +#endif + + // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp. + static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); + + void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const; + + void _M_reset(_RopeRep* __r) { + //if (__r != _M_tree_ptr._M_data) { + _S_unref(_M_tree_ptr._M_data); + _M_tree_ptr._M_data = __r; + //} + } + +public: + bool empty() const { return 0 == _M_tree_ptr._M_data; } + + // Comparison member function. This is public only for those + // clients that need a ternary comparison. Others + // should use the comparison operators below. + int compare(const _Self& __y) const { + return _S_compare(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data); + } + + rope(const _CharT* __s, const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, _S_char_ptr_len(__s),__a)) + {} + + rope(const _CharT* __s, size_t __len, + const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, (_S_RopeLeaf_from_unowned_char_ptr(__s, __len, __a))) + {} + + // Should perhaps be templatized with respect to the iterator type + // and use Sequence_buffer. (It should perhaps use sequence_buffer + // even now.) + rope(const _CharT *__s, const _CharT *__e, + const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, _S_RopeLeaf_from_unowned_char_ptr(__s, __e - __s, __a)) + {} + + rope(const const_iterator& __s, const const_iterator& __e, + const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos, + __e._M_current_pos)) + {} + + rope(const iterator& __s, const iterator& __e, + const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, _S_substring(__s._M_root, __s._M_current_pos, + __e._M_current_pos)) + {} + + rope(_CharT __c, const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, (_RopeRep*)0) { + _CharT* __buf = _M_tree_ptr.allocate(_S_rounded_up_size(1)); + + _Copy_Construct(__buf, __c); + _S_construct_null(__buf + 1); + + _STLP_TRY { + _M_tree_ptr._M_data = _S_new_RopeLeaf(__buf, 1, __a); + } + _STLP_UNWIND(_RopeRep::_S_free_string(__buf, 1, __a)) + } + + rope(size_t __n, _CharT __c, + const allocator_type& __a = allocator_type()): + _M_tree_ptr(__a, (_RopeRep*)0) { + if (0 == __n) + return; + + rope<_CharT,_Alloc> __result; +# define __exponentiate_threshold size_t(32) + _RopeRep* __remainder; + rope<_CharT,_Alloc> __remainder_rope; + + // gcc-2.7.2 bugs + typedef _STLP_PRIV _Rope_Concat_fn<_CharT,_Alloc> _Concat_fn; + + size_t __exponent = __n / __exponentiate_threshold; + size_t __rest = __n % __exponentiate_threshold; + if (0 == __rest) { + __remainder = 0; + } else { + _CharT* __rest_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__rest)); + uninitialized_fill_n(__rest_buffer, __rest, __c); + _S_construct_null(__rest_buffer + __rest); + _STLP_TRY { + __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a); + } + _STLP_UNWIND(_RopeRep::_S_free_string(__rest_buffer, __rest, __a)) + } + __remainder_rope._M_tree_ptr._M_data = __remainder; + if (__exponent != 0) { + _CharT* __base_buffer = _M_tree_ptr.allocate(_S_rounded_up_size(__exponentiate_threshold)); + _RopeLeaf* __base_leaf; + rope<_CharT,_Alloc> __base_rope; + uninitialized_fill_n(__base_buffer, __exponentiate_threshold, __c); + _S_construct_null(__base_buffer + __exponentiate_threshold); + _STLP_TRY { + __base_leaf = _S_new_RopeLeaf(__base_buffer, + __exponentiate_threshold, __a); + } + _STLP_UNWIND(_RopeRep::_S_free_string(__base_buffer, + __exponentiate_threshold, __a)) + __base_rope._M_tree_ptr._M_data = __base_leaf; + if (1 == __exponent) { + __result = __base_rope; + // One each for base_rope and __result + //_STLP_ASSERT(2 == __result._M_tree_ptr._M_data->_M_ref_count) + } else { + __result = _STLP_PRIV __power(__base_rope, __exponent, _Concat_fn()); + } + if (0 != __remainder) { + __result += __remainder_rope; + } + } else { + __result = __remainder_rope; + } + _M_tree_ptr._M_data = __result._M_tree_ptr._M_data; + _M_tree_ptr._M_data->_M_ref_nonnil(); +# undef __exponentiate_threshold + } + + rope(const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, (_RopeRep*)0) {} + + // Construct a rope from a function that can compute its members + rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, + const allocator_type& __a = allocator_type()) + : _M_tree_ptr(__a, (_RopeRep*)0) { + _M_tree_ptr._M_data = (0 == __len) ? + 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); + } + + rope(const _Self& __x) + : _M_tree_ptr(__x._M_tree_ptr, __x._M_tree_ptr._M_data) { + _S_ref(_M_tree_ptr._M_data); + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + rope(__move_source<_Self> __src) + : _M_tree_ptr(__src.get()._M_tree_ptr, __src.get()._M_tree_ptr._M_data) { + __src.get()._M_tree_ptr._M_data = 0; + } +#endif + + ~rope() { + _S_unref(_M_tree_ptr._M_data); + } + + _Self& operator=(const _Self& __x) { + _STLP_ASSERT(get_allocator() == __x.get_allocator()) + _S_ref(__x._M_tree_ptr._M_data); + _M_reset(__x._M_tree_ptr._M_data); + return *this; + } + + void clear() { + _S_unref(_M_tree_ptr._M_data); + _M_tree_ptr._M_data = 0; + } + void push_back(_CharT __x) { + _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__x, 1)); + } + + void pop_back() { + _RopeRep* __old = _M_tree_ptr._M_data; + _M_tree_ptr._M_data = + _S_substring(_M_tree_ptr._M_data, 0, _M_tree_ptr._M_data->_M_size._M_data - 1); + _S_unref(__old); + } + + _CharT back() const { + return _S_fetch(_M_tree_ptr._M_data, _M_tree_ptr._M_data->_M_size._M_data - 1); + } + + void push_front(_CharT __x) { + _RopeRep* __old = _M_tree_ptr._M_data; + _RopeRep* __left = + _S_RopeLeaf_from_unowned_char_ptr(&__x, 1, _M_tree_ptr); + _STLP_TRY { + _M_tree_ptr._M_data = _S_concat_rep(__left, _M_tree_ptr._M_data); + _S_unref(__old); + _S_unref(__left); + } + _STLP_UNWIND(_S_unref(__left)) + } + + void pop_front() { + _RopeRep* __old = _M_tree_ptr._M_data; + _M_tree_ptr._M_data = _S_substring(_M_tree_ptr._M_data, 1, _M_tree_ptr._M_data->_M_size._M_data); + _S_unref(__old); + } + + _CharT front() const { + return _S_fetch(_M_tree_ptr._M_data, 0); + } + + void balance() { + _RopeRep* __old = _M_tree_ptr._M_data; + _M_tree_ptr._M_data = _S_balance(_M_tree_ptr._M_data); + _S_unref(__old); + } + + void copy(_CharT* __buffer) const { + _STLP_STD::_Destroy_Range(__buffer, __buffer + size()); + _S_flatten(_M_tree_ptr._M_data, __buffer); + } + + /* + * This is the copy function from the standard, but + * with the arguments reordered to make it consistent with the + * rest of the interface. + * Note that this guaranteed not to compile if the draft standard + * order is assumed. + */ + size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const { + size_t _p_size = size(); + size_t __len = (__pos + __n > _p_size? _p_size - __pos : __n); + + _STLP_STD::_Destroy_Range(__buffer, __buffer + __len); + _S_flatten(_M_tree_ptr._M_data, __pos, __len, __buffer); + return __len; + } + +# ifdef _STLP_DEBUG + // Print to stdout, exposing structure. May be useful for + // performance debugging. + void dump() { + _S_dump(_M_tree_ptr._M_data); + } +# endif + + // Convert to 0 terminated string in new allocated memory. + // Embedded 0s in the input do not terminate the copy. + const _CharT* c_str() const; + + // As above, but also use the flattened representation as the + // the new rope representation. + const _CharT* replace_with_c_str(); + + // Reclaim memory for the c_str generated flattened string. + // Intentionally undocumented, since it's hard to say when this + // is safe for multiple threads. + void delete_c_str () { + if (0 == _M_tree_ptr._M_data) return; + if (_RopeRep::_S_leaf == _M_tree_ptr._M_data->_M_tag && + ((_RopeLeaf*)_M_tree_ptr._M_data)->_M_data == + _M_tree_ptr._M_data->_M_c_string) { + // Representation shared + return; + } + _M_tree_ptr._M_data->_M_free_c_string(); + _M_tree_ptr._M_data->_M_c_string = 0; + } + + _CharT operator[] (size_type __pos) const { + return _S_fetch(_M_tree_ptr._M_data, __pos); + } + + _CharT at(size_type __pos) const { + if (__pos >= size()) _M_throw_out_of_range(); + return (*this)[__pos]; + } + + const_iterator begin() const { + return(const_iterator(_M_tree_ptr._M_data, 0)); + } + + // An easy way to get a const iterator from a non-const container. + const_iterator const_begin() const { + return(const_iterator(_M_tree_ptr._M_data, 0)); + } + + const_iterator end() const { + return(const_iterator(_M_tree_ptr._M_data, size())); + } + + const_iterator const_end() const { + return(const_iterator(_M_tree_ptr._M_data, size())); + } + + size_type size() const { + return(0 == _M_tree_ptr._M_data? 0 : _M_tree_ptr._M_data->_M_size._M_data); + } + + size_type length() const { + return size(); + } + + size_type max_size() const { + return _S_min_len[__ROPE_MAX_DEPTH-1] - 1; + // Guarantees that the result can be sufficiently + // balanced. Longer ropes will probably still work, + // but it's harder to make guarantees. + } + + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + + const_reverse_iterator const_rbegin() const { + return const_reverse_iterator(end()); + } + + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + + const_reverse_iterator const_rend() const { + return const_reverse_iterator(begin()); + } + // The symmetric cases are intentionally omitted, since they're presumed + // to be less common, and we don't handle them as well. + + // The following should really be templatized. + // The first argument should be an input iterator or + // forward iterator with value_type _CharT. + _Self& append(const _CharT* __iter, size_t __n) { + _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __iter, __n)); + return *this; + } + + _Self& append(const _CharT* __c_string) { + size_t __len = _S_char_ptr_len(__c_string); + append(__c_string, __len); + return *this; + } + + _Self& append(const _CharT* __s, const _CharT* __e) { + _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, __s, __e - __s)); + return *this; + } + + _Self& append(const_iterator __s, const_iterator __e) { + _STLP_ASSERT(__s._M_root == __e._M_root) + _STLP_ASSERT(get_allocator() == __s._M_root->get_allocator()) + _Self_destruct_ptr __appendee(_S_substring(__s._M_root, __s._M_current_pos, __e._M_current_pos)); + _M_reset(_S_concat_rep(_M_tree_ptr._M_data, (_RopeRep*)__appendee)); + return *this; + } + + _Self& append(_CharT __c) { + _M_reset(_S_destr_concat_char_iter(_M_tree_ptr._M_data, &__c, 1)); + return *this; + } + + _Self& append() { return append(_CharT()); } // XXX why? + + _Self& append(const _Self& __y) { + _STLP_ASSERT(__y.get_allocator() == get_allocator()) + _M_reset(_S_concat_rep(_M_tree_ptr._M_data, __y._M_tree_ptr._M_data)); + return *this; + } + + _Self& append(size_t __n, _CharT __c) { + rope<_CharT,_Alloc> __last(__n, __c); + return append(__last); + } + + void swap(_Self& __b) { + _M_tree_ptr.swap(__b._M_tree_ptr); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +protected: + // Result is included in refcount. + static _RopeRep* replace(_RopeRep* __old, size_t __pos1, + size_t __pos2, _RopeRep* __r) { + if (0 == __old) { _S_ref(__r); return __r; } + _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1)); + _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size._M_data)); + _STLP_MPWFIX_TRY //*TY 06/01/2000 - + _RopeRep* __result; + + if (0 == __r) { + __result = _S_concat_rep(__left, __right); + } else { + _STLP_ASSERT(__old->get_allocator() == __r->get_allocator()) + _Self_destruct_ptr __left_result(_S_concat_rep(__left, __r)); + __result = _S_concat_rep(__left_result, __right); + } + return __result; + _STLP_MPWFIX_CATCH //*TY 06/01/2000 - + } + +public: + void insert(size_t __p, const _Self& __r) { + if (__p > size()) _M_throw_out_of_range(); + _STLP_ASSERT(get_allocator() == __r.get_allocator()) + _M_reset(replace(_M_tree_ptr._M_data, __p, __p, __r._M_tree_ptr._M_data)); + } + + void insert(size_t __p, size_t __n, _CharT __c) { + rope<_CharT,_Alloc> __r(__n,__c); + insert(__p, __r); + } + + void insert(size_t __p, const _CharT* __i, size_t __n) { + if (__p > size()) _M_throw_out_of_range(); + _Self_destruct_ptr __left(_S_substring(_M_tree_ptr._M_data, 0, __p)); + _Self_destruct_ptr __right(_S_substring(_M_tree_ptr._M_data, __p, size())); + _Self_destruct_ptr __left_result( + _S_concat_char_iter(__left, __i, __n)); + // _S_ destr_concat_char_iter should be safe here. + // But as it stands it's probably not a win, since __left + // is likely to have additional references. + _M_reset(_S_concat_rep(__left_result, __right)); + } + + void insert(size_t __p, const _CharT* __c_string) { + insert(__p, __c_string, _S_char_ptr_len(__c_string)); + } + + void insert(size_t __p, _CharT __c) { + insert(__p, &__c, 1); + } + + void insert(size_t __p) { + _CharT __c = _CharT(); + insert(__p, &__c, 1); + } + + void insert(size_t __p, const _CharT* __i, const _CharT* __j) { + _Self __r(__i, __j); + insert(__p, __r); + } + + void insert(size_t __p, const const_iterator& __i, + const const_iterator& __j) { + _Self __r(__i, __j); + insert(__p, __r); + } + + void insert(size_t __p, const iterator& __i, + const iterator& __j) { + _Self __r(__i, __j); + insert(__p, __r); + } + + // (position, length) versions of replace operations: + void replace(size_t __p, size_t __n, const _Self& __r) { + if (__p > size()) _M_throw_out_of_range(); + _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, __r._M_tree_ptr._M_data)); + } + + void replace(size_t __p, size_t __n, + const _CharT* __i, size_t __i_len) { + _Self __r(__i, __i_len); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, _CharT __c) { + _Self __r(__c); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, const _CharT* __c_string) { + _Self __r(__c_string); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, + const _CharT* __i, const _CharT* __j) { + _Self __r(__i, __j); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, + const const_iterator& __i, const const_iterator& __j) { + _Self __r(__i, __j); + replace(__p, __n, __r); + } + + void replace(size_t __p, size_t __n, + const iterator& __i, const iterator& __j) { + _Self __r(__i, __j); + replace(__p, __n, __r); + } + + // Single character variants: + void replace(size_t __p, _CharT __c) { + if (__p > size()) _M_throw_out_of_range(); + iterator __i(this, __p); + *__i = __c; + } + + void replace(size_t __p, const _Self& __r) { + replace(__p, 1, __r); + } + + void replace(size_t __p, const _CharT* __i, size_t __i_len) { + replace(__p, 1, __i, __i_len); + } + + void replace(size_t __p, const _CharT* __c_string) { + replace(__p, 1, __c_string); + } + + void replace(size_t __p, const _CharT* __i, const _CharT* __j) { + replace(__p, 1, __i, __j); + } + + void replace(size_t __p, const const_iterator& __i, + const const_iterator& __j) { + replace(__p, 1, __i, __j); + } + + void replace(size_t __p, const iterator& __i, + const iterator& __j) { + replace(__p, 1, __i, __j); + } + + // Erase, (position, size) variant. + void erase(size_t __p, size_t __n) { + if (__p > size()) _M_throw_out_of_range(); + _M_reset(replace(_M_tree_ptr._M_data, __p, __p + __n, 0)); + } + + // Erase, single character + void erase(size_t __p) { + erase(__p, __p + 1); + } + + // Insert, iterator variants. + iterator insert(const iterator& __p, const _Self& __r) + { insert(__p.index(), __r); return __p; } + iterator insert(const iterator& __p, size_t __n, _CharT __c) + { insert(__p.index(), __n, __c); return __p; } + iterator insert(const iterator& __p, _CharT __c) + { insert(__p.index(), __c); return __p; } + iterator insert(const iterator& __p ) + { insert(__p.index()); return __p; } + iterator insert(const iterator& __p, const _CharT* c_string) + { insert(__p.index(), c_string); return __p; } + iterator insert(const iterator& __p, const _CharT* __i, size_t __n) + { insert(__p.index(), __i, __n); return __p; } + iterator insert(const iterator& __p, const _CharT* __i, + const _CharT* __j) + { insert(__p.index(), __i, __j); return __p; } + iterator insert(const iterator& __p, + const const_iterator& __i, const const_iterator& __j) + { insert(__p.index(), __i, __j); return __p; } + iterator insert(const iterator& __p, + const iterator& __i, const iterator& __j) + { insert(__p.index(), __i, __j); return __p; } + + // Replace, range variants. + void replace(const iterator& __p, const iterator& __q, + const _Self& __r) + { replace(__p.index(), __q.index() - __p.index(), __r); } + void replace(const iterator& __p, const iterator& __q, _CharT __c) + { replace(__p.index(), __q.index() - __p.index(), __c); } + void replace(const iterator& __p, const iterator& __q, + const _CharT* __c_string) + { replace(__p.index(), __q.index() - __p.index(), __c_string); } + void replace(const iterator& __p, const iterator& __q, + const _CharT* __i, size_t __n) + { replace(__p.index(), __q.index() - __p.index(), __i, __n); } + void replace(const iterator& __p, const iterator& __q, + const _CharT* __i, const _CharT* __j) + { replace(__p.index(), __q.index() - __p.index(), __i, __j); } + void replace(const iterator& __p, const iterator& __q, + const const_iterator& __i, const const_iterator& __j) + { replace(__p.index(), __q.index() - __p.index(), __i, __j); } + void replace(const iterator& __p, const iterator& __q, + const iterator& __i, const iterator& __j) + { replace(__p.index(), __q.index() - __p.index(), __i, __j); } + + // Replace, iterator variants. + void replace(const iterator& __p, const _Self& __r) + { replace(__p.index(), __r); } + void replace(const iterator& __p, _CharT __c) + { replace(__p.index(), __c); } + void replace(const iterator& __p, const _CharT* __c_string) + { replace(__p.index(), __c_string); } + void replace(const iterator& __p, const _CharT* __i, size_t __n) + { replace(__p.index(), __i, __n); } + void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) + { replace(__p.index(), __i, __j); } + void replace(const iterator& __p, const_iterator __i, + const_iterator __j) + { replace(__p.index(), __i, __j); } + void replace(const iterator& __p, iterator __i, iterator __j) + { replace(__p.index(), __i, __j); } + + // Iterator and range variants of erase + iterator erase(const iterator& __p, const iterator& __q) { + size_t __p_index = __p.index(); + erase(__p_index, __q.index() - __p_index); + return iterator(this, __p_index); + } + iterator erase(const iterator& __p) { + size_t __p_index = __p.index(); + erase(__p_index, 1); + return iterator(this, __p_index); + } + + _Self substr(size_t __start, size_t __len = 1) const { + if (__start > size()) _M_throw_out_of_range(); + return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start, __start + __len)); + } + + _Self substr(iterator __start, iterator __end) const { + return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index())); + } + + _Self substr(iterator __start) const { + size_t __pos = __start.index(); + return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1)); + } + + _Self substr(const_iterator __start, const_iterator __end) const { + // This might eventually take advantage of the cache in the + // iterator. + return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __start.index(), __end.index())); + } + + rope<_CharT,_Alloc> substr(const_iterator __start) { + size_t __pos = __start.index(); + return rope<_CharT,_Alloc>(_S_substring(_M_tree_ptr._M_data, __pos, __pos + 1)); + } + +#include + + size_type find(const _Self& __s, size_type __pos = 0) const { + if (__pos >= size()) +# ifndef _STLP_OLD_ROPE_SEMANTICS + return npos; +# else + return size(); +# endif + + size_type __result_pos; + const_iterator __result = _STLP_STD::search(const_begin() + (ptrdiff_t)__pos, const_end(), __s.begin(), __s.end() ); + __result_pos = __result.index(); +# ifndef _STLP_OLD_ROPE_SEMANTICS + if (__result_pos == size()) __result_pos = npos; +# endif + return __result_pos; + } + size_type find(_CharT __c, size_type __pos = 0) const; + size_type find(const _CharT* __s, size_type __pos = 0) const { + size_type __result_pos; + const_iterator __result = _STLP_STD::search(const_begin() + (ptrdiff_t)__pos, const_end(), + __s, __s + _S_char_ptr_len(__s)); + __result_pos = __result.index(); +# ifndef _STLP_OLD_ROPE_SEMANTICS + if (__result_pos == size()) __result_pos = npos; +# endif + return __result_pos; + } + + iterator mutable_begin() { + return(iterator(this, 0)); + } + + iterator mutable_end() { + return(iterator(this, size())); + } + + reverse_iterator mutable_rbegin() { + return reverse_iterator(mutable_end()); + } + + reverse_iterator mutable_rend() { + return reverse_iterator(mutable_begin()); + } + + reference mutable_reference_at(size_type __pos) { + return reference(this, __pos); + } + +# ifdef __STD_STUFF + reference operator[] (size_type __pos) { + return reference(this, __pos); + } + + reference at(size_type __pos) { + if (__pos >= size()) _M_throw_out_of_range(); + return (*this)[__pos]; + } + + void resize(size_type, _CharT) {} + void resize(size_type) {} + void reserve(size_type = 0) {} + size_type capacity() const { + return max_size(); + } + + // Stuff below this line is dangerous because it's error prone. + // I would really like to get rid of it. + // copy function with funny arg ordering. + size_type copy(_CharT* __buffer, size_type __n, + size_type __pos = 0) const { + return copy(__pos, __n, __buffer); + } + + iterator end() { return mutable_end(); } + + iterator begin() { return mutable_begin(); } + + reverse_iterator rend() { return mutable_rend(); } + + reverse_iterator rbegin() { return mutable_rbegin(); } + +# else + + const_iterator end() { return const_end(); } + + const_iterator begin() { return const_begin(); } + + const_reverse_iterator rend() { return const_rend(); } + + const_reverse_iterator rbegin() { return const_rbegin(); } + +# endif +}; //class rope + +#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) +template +const size_t rope<_CharT, _Alloc>::npos = ~(size_t) 0; +#endif + +template +inline _CharT +_Rope_const_iterator< _CharT, _Alloc>::operator[](size_t __n) +{ return rope<_CharT,_Alloc>::_S_fetch(this->_M_root, this->_M_current_pos + __n); } + +template +inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) { + return (__x._M_current_pos == __y._M_current_pos && + __x._M_root == __y._M_root); +} + +template +inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) +{ return (__x._M_current_pos < __y._M_current_pos); } + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) +{ return !(__x == __y); } + +template +inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) +{ return __y < __x; } + +template +inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) +{ return !(__y < __x); } + +template +inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) +{ return !(__x < __y); } + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, + const _Rope_const_iterator<_CharT,_Alloc>& __y) +{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; } + +#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug. +template +inline _Rope_const_iterator<_CharT,_Alloc> +operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) +{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos - __n); } +# endif + +template +inline _Rope_const_iterator<_CharT,_Alloc> +operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) +{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); } + +template +inline _Rope_const_iterator<_CharT,_Alloc> +operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) +{ return _Rope_const_iterator<_CharT,_Alloc>(__x._M_root, __x._M_current_pos + __n); } + +template +inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) { + return (__x._M_current_pos == __y._M_current_pos && + __x._M_root_rope == __y._M_root_rope); +} + +template +inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) +{ return (__x._M_current_pos < __y._M_current_pos); } + +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) +template +inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) +{ return !(__x == __y); } + +template +inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) +{ return __y < __x; } + +template +inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) +{ return !(__y < __x); } + +template +inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) +{ return !(__x < __y); } +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x, + const _Rope_iterator<_CharT,_Alloc>& __y) +{ return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; } + +#if !defined( __MWERKS__ ) || __MWERKS__ >= 0x2000 // dwa 8/21/97 - "ambiguous access to overloaded function" bug. +template +inline _Rope_iterator<_CharT,_Alloc> +operator-(const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n) { + return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos - __n); +} +# endif + +template +inline _Rope_iterator<_CharT,_Alloc> +operator+(const _Rope_iterator<_CharT,_Alloc>& __x, + ptrdiff_t __n) { + return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n); +} + +template +inline _Rope_iterator<_CharT,_Alloc> +operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) { + return _Rope_iterator<_CharT,_Alloc>(__x._M_root_rope, __x._M_current_pos + __n); +} + +template +inline rope<_CharT,_Alloc> +operator+ (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) { + _STLP_ASSERT(__left.get_allocator() == __right.get_allocator()) + return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_rep(__left._M_tree_ptr._M_data, __right._M_tree_ptr._M_data)); + // Inlining this should make it possible to keep __left and __right in registers. +} + +template +inline rope<_CharT,_Alloc>& +operator+= (rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) { + __left.append(__right); + return __left; +} + +template +inline rope<_CharT,_Alloc> +operator+ (const rope<_CharT,_Alloc>& __left, + const _CharT* __right) { + size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right); + return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, __right, __rlen)); +} + +template +inline rope<_CharT,_Alloc>& +operator+= (rope<_CharT,_Alloc>& __left, + const _CharT* __right) { + __left.append(__right); + return __left; +} + +template +inline rope<_CharT,_Alloc> +operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) { + return rope<_CharT,_Alloc>(rope<_CharT,_Alloc>::_S_concat_char_iter(__left._M_tree_ptr._M_data, &__right, 1)); +} + +template +inline rope<_CharT,_Alloc>& +operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) { + __left.append(__right); + return __left; +} + +template +inline bool +operator< (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) { + return __left.compare(__right) < 0; +} + +template +inline bool +operator== (const rope<_CharT,_Alloc>& __left, + const rope<_CharT,_Alloc>& __right) { + return __left.compare(__right) == 0; +} + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool +operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return !(__x == __y); +} + +template +inline bool +operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return __y < __x; +} + +template +inline bool +operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return !(__y < __x); +} + +template +inline bool +operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { + return !(__x < __y); +} + +template +inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, + const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { + return !(__x == __y); +} + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, + const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { + return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); +} + +#if !defined (_STLP_USE_NO_IOSTREAMS) +template +basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o, + const rope<_CharT, _Alloc>& __r); +#endif + +typedef rope > crope; +#if defined (_STLP_HAS_WCHAR_T) +typedef rope > wrope; +#endif + +inline crope::reference __mutable_reference_at(crope& __c, size_t __i) +{ return __c.mutable_reference_at(__i); } + +#if defined (_STLP_HAS_WCHAR_T) +inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i) +{ return __c.mutable_reference_at(__i); } +#endif + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +template +inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) +{ __x.swap(__y); } +#else + +inline void swap(crope& __x, crope& __y) { __x.swap(__y); } +# ifdef _STLP_HAS_WCHAR_T // dwa 8/21/97 +inline void swap(wrope& __x, wrope& __y) { __x.swap(__y); } +# endif + +#endif /* _STLP_FUNCTION_TMPL_PARTIAL_ORDER */ + + +// Hash functions should probably be revisited later: +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(const crope& __str) const { + size_t _p_size = __str.size(); + + if (0 == _p_size) return 0; + return 13*__str[0] + 5*__str[_p_size - 1] + _p_size; + } +}; + +#if defined (_STLP_HAS_WCHAR_T) // dwa 8/21/97 +_STLP_TEMPLATE_NULL struct hash { + size_t operator()(const wrope& __str) const { + size_t _p_size = __str.size(); + + if (0 == _p_size) return 0; + return 13*__str[0] + 5*__str[_p_size - 1] + _p_size; + } +}; +#endif + +#if (!defined (_STLP_MSVC) || (_STLP_MSVC >= 1310)) +// I couldn't get this to work with VC++ +template +# if defined (__DMC__) +extern +# endif +void _Rope_rotate(_Rope_iterator<_CharT, _Alloc> __first, + _Rope_iterator<_CharT, _Alloc> __middle, + _Rope_iterator<_CharT, _Alloc> __last); + +inline void rotate(_Rope_iterator > __first, + _Rope_iterator > __middle, + _Rope_iterator > __last) +{ _Rope_rotate(__first, __middle, __last); } +#endif + +template +inline _Rope_char_ref_proxy<_CharT, _Alloc>::operator _CharT () const { + if (_M_current_valid) { + return _M_current; + } else { + return _My_rope::_S_fetch(_M_root->_M_tree_ptr._M_data, _M_pos); + } +} + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + typedef __true_type implemented; + //Completness depends on the allocator: + typedef typename __move_traits<_Alloc>::complete complete; +}; +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_ROPE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_set.h b/sdk/tlibstdcxx/stlport/stl/_set.h new file mode 100644 index 0000000000..a8f68620ea --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_set.h @@ -0,0 +1,412 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_SET_H +#define _STLP_INTERNAL_SET_H + +#ifndef _STLP_INTERNAL_TREE_H +# include +#endif + +#if !defined (_STLP_USE_PTR_SPECIALIZATIONS) + +_STLP_BEGIN_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits) + +template ), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) > +class set +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef set<_Key, _Compare, _Alloc> _Self; +public: +// typedefs: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + +private: + //Specific iterator traits creation + typedef _STLP_PRIV _SetTraitsT _SetTraits; + +public: + //Following typedef have to be public for __move_traits specialization. + typedef _STLP_PRIV _Rb_tree, + _SetTraits, _Alloc> _Rep_type; + + typedef typename _Rep_type::pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + +private: + _Rep_type _M_t; // red-black tree representing set + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + + // allocation/deallocation +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit set(const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) +#else + set() + : _M_t(_Compare(), allocator_type()) {} + explicit set(const _Compare& __comp) + : _M_t(__comp, allocator_type()) {} + set(const _Compare& __comp, const allocator_type& __a) +#endif + : _M_t(__comp, __a) {} + +#if defined (_STLP_MEMBER_TEMPLATES) + template + set(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + set(_InputIterator __first, _InputIterator __last, const _Compare& __comp) + : _M_t(__comp, allocator_type()) { _M_t.insert_unique(__first, __last); } +# endif + template + set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } +#else + set(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + set(const value_type* __first, + const value_type* __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } + + set(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_unique(__first, __last); } + + set(const_iterator __first, const_iterator __last, const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + set(const _Self& __x) : _M_t(__x._M_t) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + set(__move_source<_Self> src) + : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} +#endif + + _Self& operator=(const _Self& __x) { + _M_t = __x._M_t; + return *this; + } + + // accessors: + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return _M_t.key_comp(); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() { return _M_t.begin(); } + iterator end() { return _M_t.end(); } + const_iterator begin() const { return _M_t.begin(); } + const_iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() { return _M_t.rbegin(); } + reverse_iterator rend() { return _M_t.rend(); } + const_reverse_iterator rbegin() const { return _M_t.rbegin(); } + const_reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(_Self& __x) { _M_t.swap(__x._M_t); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + // insert/erase + pair insert(const value_type& __x) + { return _M_t.insert_unique(__x); } + iterator insert(iterator __pos, const value_type& __x) + { return _M_t.insert_unique( __pos , __x); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __first, _InputIterator __last) + { _M_t.insert_unique(__first, __last); } +#else + void insert(const_iterator __first, const_iterator __last) + { _M_t.insert_unique(__first, __last); } + void insert(const value_type* __first, const value_type* __last) + { _M_t.insert_unique(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + void erase(iterator __pos) { _M_t.erase( __pos ); } + size_type erase(const key_type& __x) { return _M_t.erase_unique(__x); } + void erase(iterator __first, iterator __last) { _M_t.erase(__first, __last ); } + void clear() { _M_t.clear(); } + + // set operations: + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __x) const { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __x) { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const + { return _M_t.find(__x) == _M_t.end() ? 0 : 1 ; } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) + { return _M_t.equal_range_unique(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const + { return _M_t.equal_range_unique(__x); } +}; + +//Specific iterator traits creation +_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits) + +template ), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) > +class multiset +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef multiset<_Key, _Compare, _Alloc> _Self; +public: + // typedefs: + + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + +private: + //Specific iterator traits creation + typedef _STLP_PRIV _MultisetTraitsT _MultisetTraits; + +public: + //Following typedef have to be public for __move_traits specialization. + typedef _STLP_PRIV _Rb_tree, + _MultisetTraits, _Alloc> _Rep_type; + + typedef typename _Rep_type::pointer pointer; + typedef typename _Rep_type::const_pointer const_pointer; + typedef typename _Rep_type::reference reference; + typedef typename _Rep_type::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::allocator_type allocator_type; + +private: + _Rep_type _M_t; // red-black tree representing multiset + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit multiset(const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) +#else + multiset() + : _M_t(_Compare(), allocator_type()) {} + explicit multiset(const _Compare& __comp) + : _M_t(__comp, allocator_type()) {} + multiset(const _Compare& __comp, const allocator_type& __a) +#endif + : _M_t(__comp, __a) {} + +#if defined (_STLP_MEMBER_TEMPLATES) + template + multiset(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp) + : _M_t(__comp, allocator_type()) { _M_t.insert_equal(__first, __last); } +# endif +#else + multiset(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + multiset(const value_type* __first, const value_type* __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } + + multiset(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), allocator_type()) + { _M_t.insert_equal(__first, __last); } + + multiset(const_iterator __first, const_iterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + multiset(const _Self& __x) : _M_t(__x._M_t) {} + _Self& operator=(const _Self& __x) { + _M_t = __x._M_t; + return *this; + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + multiset(__move_source<_Self> src) + : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} +#endif + + // accessors: + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return _M_t.key_comp(); } + allocator_type get_allocator() const { return _M_t.get_allocator(); } + + iterator begin() { return _M_t.begin(); } + iterator end() { return _M_t.end(); } + const_iterator begin() const { return _M_t.begin(); } + const_iterator end() const { return _M_t.end(); } + reverse_iterator rbegin() { return _M_t.rbegin(); } + reverse_iterator rend() { return _M_t.rend(); } + const_reverse_iterator rbegin() const { return _M_t.rbegin(); } + const_reverse_iterator rend() const { return _M_t.rend(); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(_Self& __x) { _M_t.swap(__x._M_t); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + // insert/erase + iterator insert(const value_type& __x) + { return _M_t.insert_equal(__x); } + iterator insert(iterator __pos, const value_type& __x) + { return _M_t.insert_equal(__pos, __x); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __first, _InputIterator __last) + { _M_t.insert_equal(__first, __last); } +#else + void insert(const value_type* __first, const value_type* __last) + { _M_t.insert_equal(__first, __last); } + void insert(const_iterator __first, const_iterator __last) + { _M_t.insert_equal(__first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + void erase(iterator __pos) { _M_t.erase( __pos ); } + size_type erase(const key_type& __x) { return _M_t.erase(__x); } + void erase(iterator __first, iterator __last) { _M_t.erase( __first, __last ); } + void clear() { _M_t.clear(); } + + // multiset operations: + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __x) { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __x) const { return _M_t.find(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const { return _M_t.count(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const { return _M_t.lower_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const { return _M_t.upper_bound(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) { return _M_t.equal_range(__x); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const { return _M_t.equal_range(__x); } +}; + +#else +# include +_STLP_BEGIN_NAMESPACE +#endif /* _STLP_USE_PTR_SPECIALIZATIONS */ + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER set<_Key,_Compare,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#define _STLP_TEMPLATE_CONTAINER multiset<_Key,_Compare,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux::_Rep_type> +{}; + +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux::_Rep_type> +{}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_SET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_slist.c b/sdk/tlibstdcxx/stlport/stl/_slist.c new file mode 100644 index 0000000000..ba158d00c5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_slist.c @@ -0,0 +1,231 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_SLIST_C +#define _STLP_SLIST_C + +#ifndef _STLP_INTERNAL_SLIST_H +# include +#endif + +#ifndef _STLP_CARRAY_H +# include +#endif + +#ifndef _STLP_RANGE_ERRORS_H +# include +#endif + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# define size_type size_t +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_Slist_node_base* +_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first, + _Slist_node_base* __last_node) { + _Slist_node_base* __cur = __before_first->_M_next; + while (__cur != __last_node) { + _Node* __tmp = __STATIC_CAST(_Node*, __cur); + __cur = __cur->_M_next; + _STLP_STD::_Destroy(&__tmp->_M_data); + _M_head.deallocate(__tmp,1); + } + __before_first->_M_next = __last_node; + return __last_node; +} + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define slist _STLP_PTR_IMPL_NAME(slist) +#elif defined (_STLP_DEBUG) +# define slist _STLP_NON_DBG_NAME(slist) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +/* When building STLport lib Digital Mars Compiler complains on the _M_data assignment + * problem which would be perfertly right if we were using it. Hiding it during build + * fix this issue. + */ +template +slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x) { + if (&__x != this) { + _Node_base* __p1 = &this->_M_head._M_data; + _Node_base* __n1 = this->_M_head._M_data._M_next; + const _Node_base* __n2 = __x._M_head._M_data._M_next; + while (__n1 && __n2) { + __STATIC_CAST(_Node*, __n1)->_M_data = __STATIC_CAST(const _Node*, __n2)->_M_data; + __p1 = __n1; + __n1 = __n1->_M_next; + __n2 = __n2->_M_next; + } + if (__n2 == 0) + this->_M_erase_after(__p1, 0); + else + _M_insert_after_range(__p1, const_iterator(__CONST_CAST(_Node_base*, __n2)), + const_iterator(0)); + } + return *this; +} + +template +void slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val) { + _Node_base* __prev = &this->_M_head._M_data; + _Node_base* __node = this->_M_head._M_data._M_next; + for ( ; __node != 0 && __n > 0 ; --__n) { + __STATIC_CAST(_Node*, __node)->_M_data = __val; + __prev = __node; + __node = __node->_M_next; + } + if (__n > 0) + _M_insert_after_fill(__prev, __n, __val); + else + this->_M_erase_after(__prev, 0); +} + +template +void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x) { + _Node_base* __cur = &this->_M_head._M_data; + while (__cur->_M_next != 0 && __len > 0) { + --__len; + __cur = __cur->_M_next; + } + if (__cur->_M_next) + this->_M_erase_after(__cur, 0); + else + _M_insert_after_fill(__cur, __len, __x); +} + +template +void slist<_Tp,_Alloc>::remove(const _Tp& __val) { + _Node_base* __cur = &this->_M_head._M_data; + while (__cur && __cur->_M_next) { + if (__STATIC_CAST(_Node*, __cur->_M_next)->_M_data == __val) + this->_M_erase_after(__cur); + else + __cur = __cur->_M_next; + } +} + +#if !defined (slist) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template +void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __pred) { + typedef _Slist_node<_Tp> _Node; + typename slist<_Tp, _Alloc>::iterator __ite(__that.begin()); + if (__ite != __that.end()) { + while (__ite._M_node->_M_next) { + if (__pred(*__ite, __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) + __that.erase_after(__ite); + else + ++__ite; + } + } +} + +template +void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x, + _StrictWeakOrdering __comp) { + typedef _Slist_node<_Tp> _Node; + typedef _STLP_PRIV _Slist_node_base _Node_base; + if (__that.get_allocator() == __x.get_allocator()) { + typename slist<_Tp, _Alloc>::iterator __ite(__that.before_begin()); + while (__ite._M_node->_M_next && !__x.empty()) { + if (__comp(__x.front(), __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) { + _STLP_VERBOSE_ASSERT(!__comp(__STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data, __x.front()), + _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + __that.splice_after(__ite, __x, __x.before_begin()); + } + ++__ite; + } + if (!__x.empty()) { + __that.splice_after(__ite, __x); + } + } + else { + typename slist<_Tp, _Alloc>::iterator __i1(__that.before_begin()), __i2(__x.begin()); + while (__i1._M_node->_M_next && __i2._M_node) { + if (__comp(__STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data, *__i2)) { + _STLP_VERBOSE_ASSERT(!__comp(*__i2, __STATIC_CAST(_Node*, __i1._M_node->_M_next)->_M_data), + _StlMsg_INVALID_STRICT_WEAK_PREDICATE) + ++__i1; + } + else { + __i1 = __that.insert_after(__i1, *(__i2++)); + } + } + __that.insert_after(__i1, __i2, __x.end()); + __x.clear(); + } +} + +template +void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp) { + if (!__that.begin()._M_node || !__that.begin()._M_node->_M_next) + return; + + slist<_Tp, _Alloc> __carry(__that.get_allocator()); + const int NB = 64; + _STLP_PRIV _CArray, NB> __counter(__carry); + int __fill = 0; + while (!__that.empty()) { + __carry.splice_after(__carry.before_begin(), __that, __that.before_begin()); + int __i = 0; + while (__i < __fill && !__counter[__i].empty()) { + _STLP_PRIV _Slist_merge(__counter[__i], __carry, __comp); + __carry.swap(__counter[__i]); + ++__i; + } + __carry.swap(__counter[__i]); + if (__i == __fill) { + ++__fill; + if (__fill >= NB) { + //Looks like the slist has too many elements to be sorted with this algorithm: + __stl_throw_overflow_error("slist::sort"); + } + } + } + + for (int __i = 1; __i < __fill; ++__i) + _STLP_PRIV _Slist_merge(__counter[__i], __counter[__i - 1], __comp); + __that.swap(__counter[__fill-1]); +} + +#if defined (slist) +# undef slist +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# undef size_type +#endif + +#endif /* _STLP_SLIST_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_slist.h b/sdk/tlibstdcxx/stlport/stl/_slist.h new file mode 100644 index 0000000000..924daa4962 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_slist.h @@ -0,0 +1,914 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_SLIST_H +#define _STLP_INTERNAL_SLIST_H + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_SLIST_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class _Slist_node : public _Slist_node_base { +public: + _Tp _M_data; + __TRIVIAL_STUFF(_Slist_node) +}; + +struct _Slist_iterator_base { + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef forward_iterator_tag iterator_category; + + _Slist_node_base *_M_node; + + _Slist_iterator_base(_Slist_node_base *__x) : _M_node(__x) {} + + void _M_incr() { + _M_node = _M_node->_M_next; + } +}; + +template +class _Slist_iterator : public _Slist_iterator_base { +public: + typedef typename _Traits::value_type value_type; + typedef typename _Traits::pointer pointer; + typedef typename _Traits::reference reference; + typedef forward_iterator_tag iterator_category; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + + typedef _Slist_iterator<_Tp, _Traits> _Self; + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef _Slist_iterator<_Tp, _NonConstTraits> iterator; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef _Slist_iterator<_Tp, _ConstTraits> const_iterator; + + typedef _Slist_node _Node; + + explicit _Slist_iterator(_Slist_node_base *__x) : _Slist_iterator_base(__x) {} + _Slist_iterator() : _Slist_iterator_base(0) {} + //copy constructor for iterator and constructor from iterator for const_iterator + _Slist_iterator(const iterator& __x) : _Slist_iterator_base(__x._M_node) {} + + reference operator*() const { return __STATIC_CAST(_Node*, this->_M_node)->_M_data; } + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + _M_incr(); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + _M_incr(); + return __tmp; + } + + bool operator==(const_iterator __y ) const { + return this->_M_node == __y._M_node; + } + bool operator!=(const_iterator __y ) const { + return this->_M_node != __y._M_node; + } +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +_STLP_MOVE_TO_STD_NAMESPACE +template +struct __type_traits<_STLP_PRIV _Slist_iterator<_Tp, _Traits> > { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +_STLP_MOVE_TO_STD_NAMESPACE +template +inline _Tp* _STLP_CALL value_type(const _STLP_PRIV _Slist_iterator<_Tp, _Traits>&) { return __STATIC_CAST(_Tp*, 0); } +inline ptrdiff_t* _STLP_CALL distance_type(const _STLP_PRIV _Slist_iterator_base&) { return 0; } +inline forward_iterator_tag _STLP_CALL iterator_category(const _STLP_PRIV _Slist_iterator_base&) { return forward_iterator_tag(); } +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif /* OLD_QUERIES */ + +// Base class that encapsulates details of allocators and simplifies EH +template +class _Slist_base { +protected: + typedef _Slist_node<_Tp> _Node; + typedef typename _Alloc_traits<_Node,_Alloc>::allocator_type _M_node_allocator_type; + typedef _Slist_base<_Tp, _Alloc> _Self; + +public: + typedef _STLP_alloc_proxy<_Slist_node_base, _Node, _M_node_allocator_type> _AllocProxy; + + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef _Alloc allocator_type; + + _Slist_base(const allocator_type& __a) : + _M_head(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Slist_node_base() ) + { _M_head._M_data._M_next = 0; } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Slist_base(__move_source<_Self> src) : + _M_head(__move_source<_AllocProxy>(src.get()._M_head)) + { src.get()._M_head._M_data._M_next = 0; } +#endif + + ~_Slist_base() { _M_erase_after(&_M_head._M_data, 0); } + +protected: + _Slist_node_base* _M_erase_after(_Slist_node_base* __pos) { + _Node* __next = __STATIC_CAST(_Node*, __pos->_M_next); + _Slist_node_base* __next_next = __next->_M_next; + __pos->_M_next = __next_next; + _STLP_STD::_Destroy(&__next->_M_data); + _M_head.deallocate(__next,1); + return __next_next; + } + _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*); + +public: + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR((const _M_node_allocator_type&)_M_head, _Tp); } + _AllocProxy _M_head; +}; + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define slist _STLP_PTR_IMPL_NAME(slist) +#elif defined (_STLP_DEBUG) +# define slist _STLP_NON_DBG_NAME(slist) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template ) > +class slist; + +#if !defined (slist) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +// helper functions to reduce code duplication +template +void _Slist_unique(slist<_Tp, _Alloc>& __that, _BinaryPredicate __binary_pred); + +template +void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x, + _StrictWeakOrdering __comp); + +template +void _Slist_sort(slist<_Tp, _Alloc>& __that, _StrictWeakOrdering __comp); + +#if !defined (slist) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template +class slist : protected _STLP_PRIV _Slist_base<_Tp,_Alloc> +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist) + , public __stlport_class > +#endif +{ +private: + typedef _STLP_PRIV _Slist_base<_Tp,_Alloc> _Base; + typedef slist<_Tp,_Alloc> _Self; +public: + typedef _Tp value_type; + + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef forward_iterator_tag _Iterator_category; + + typedef _STLP_PRIV _Slist_iterator<_Tp, _Nonconst_traits<_Tp> > iterator; + typedef _STLP_PRIV _Slist_iterator<_Tp, _Const_traits<_Tp> > const_iterator; + + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef typename _Base::allocator_type allocator_type; + +private: + typedef _STLP_PRIV _Slist_node<_Tp> _Node; + typedef _STLP_PRIV _Slist_node_base _Node_base; + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + _Node* _M_create_node(const value_type& __x = _Tp()) { +#else + _Node* _M_create_node(const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + _Node* __node = this->_M_head.allocate(1); + _STLP_TRY { + _Copy_Construct(&__node->_M_data, __x); + __node->_M_next = 0; + } + _STLP_UNWIND(this->_M_head.deallocate(__node, 1)) + return __node; + } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + _Node* _M_create_node() { + _Node* __node = this->_M_head.allocate(1); + _STLP_TRY { + _STLP_STD::_Construct(&__node->_M_data); + __node->_M_next = 0; + } + _STLP_UNWIND(this->_M_head.deallocate(__node, 1)) + return __node; + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +public: + + allocator_type get_allocator() const { return _Base::get_allocator(); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit slist(const allocator_type& __a = allocator_type()) +#else + slist() + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) {} + slist(const allocator_type& __a) +#endif + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) {} + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp), + const allocator_type& __a = allocator_type()) +#else + explicit slist(size_type __n) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) + { _M_insert_after_fill(&this->_M_head._M_data, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } + slist(size_type __n, const value_type& __x) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) + { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); } + slist(size_type __n, const value_type& __x, const allocator_type& __a) +#endif + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) + { _M_insert_after_fill(&this->_M_head._M_data, __n, __x); } + +#if defined (_STLP_MEMBER_TEMPLATES) + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template + slist(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) + { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + // VC++ needs this crazyness + template + slist(_InputIterator __first, _InputIterator __last) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(allocator_type()) + { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } +# endif +#else /* _STLP_MEMBER_TEMPLATES */ + slist(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type() ) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) + { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } + slist(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__a) + { _M_insert_after_range(&this->_M_head._M_data, __first, __last); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + slist(const _Self& __x) + : _STLP_PRIV _Slist_base<_Tp,_Alloc>(__x.get_allocator()) + { _M_insert_after_range(&this->_M_head._M_data, __x.begin(), __x.end()); } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + slist(__move_source<_Self> src) + : _STLP_PRIV _Slist_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) {} +#endif + + _Self& operator= (const _Self& __x); + + ~slist() {} + +public: + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } + +private: + void _M_fill_assign(size_type __n, const _Tp& __val); + +#if defined (_STLP_MEMBER_TEMPLATES) +public: + template + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } + +private: + template + void _M_assign_dispatch(_Integer __n, _Integer __val, + const __true_type& /*_IsIntegral*/) { + _M_fill_assign((size_type) __n, (_Tp) __val); + } + + template + void _M_assign_dispatch(_InputIter __first, _InputIter __last, + const __false_type& /*_IsIntegral*/) { +#else +public: + void assign(const_pointer __first, const_pointer __last) { + _Node_base* __prev = &this->_M_head._M_data; + _Node_base* __node = this->_M_head._M_data._M_next; + while (__node != 0 && __first != __last) { + __STATIC_CAST(_Node*, __node)->_M_data = *__first; + __prev = __node; + __node = __node->_M_next; + ++__first; + } + if (__first != __last) + _M_insert_after_range(__prev, __first, __last); + else + this->_M_erase_after(__prev, 0); + } + void assign(const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + _Node_base* __prev = &this->_M_head._M_data; + _Node_base* __node = this->_M_head._M_data._M_next; + while (__node != 0 && __first != __last) { + __STATIC_CAST(_Node*, __node)->_M_data = *__first; + __prev = __node; + __node = __node->_M_next; + ++__first; + } + if (__first != __last) + _M_insert_after_range(__prev, __first, __last); + else + this->_M_erase_after(__prev, 0); + } + +public: + + // Experimental new feature: before_begin() returns a + // non-dereferenceable iterator that, when incremented, yields + // begin(). This iterator may be used as the argument to + // insert_after, erase_after, etc. Note that even for an empty + // slist, before_begin() is not the same iterator as end(). It + // is always necessary to increment before_begin() at least once to + // obtain end(). + iterator before_begin() { return iterator(&this->_M_head._M_data); } + const_iterator before_begin() const + { return const_iterator(__CONST_CAST(_Node_base*, &this->_M_head._M_data)); } + + iterator begin() { return iterator(this->_M_head._M_data._M_next); } + const_iterator begin() const + { return const_iterator(this->_M_head._M_data._M_next);} + + iterator end() { return iterator(); } + const_iterator end() const { return const_iterator(); } + + size_type size() const + { return _STLP_PRIV _Sl_global_inst::size(this->_M_head._M_data._M_next); } + + size_type max_size() const { return size_type(-1); } + + bool empty() const { return this->_M_head._M_data._M_next == 0; } + + void swap(_Self& __x) + { this->_M_head.swap(__x._M_head); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +public: + reference front() { return *begin(); } + const_reference front() const { return *begin(); } +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_front(const value_type& __x = _Tp()) { +#else + void push_front(const value_type& __x) { +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node(__x)); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_front() { _STLP_PRIV __slist_make_link(&this->_M_head._M_data, _M_create_node());} +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void pop_front() { + _Node* __node = __STATIC_CAST(_Node*, this->_M_head._M_data._M_next); + this->_M_head._M_data._M_next = __node->_M_next; + _STLP_STD::_Destroy(&__node->_M_data); + this->_M_head.deallocate(__node, 1); + } + + iterator previous(const_iterator __pos) { + return iterator(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node)); + } + const_iterator previous(const_iterator __pos) const { + return const_iterator(__CONST_CAST(_Node_base*, + _STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, + __pos._M_node))); + } + +private: +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + _Node* _M_insert_after(_Node_base* __pos, const value_type& __x = _Tp()) { +#else + _Node* _M_insert_after(_Node_base* __pos, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x))); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + _Node* _M_insert_after(_Node_base* __pos) { + return __STATIC_CAST(_Node*, _STLP_PRIV __slist_make_link(__pos, _M_create_node())); + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void _M_insert_after_fill(_Node_base* __pos, + size_type __n, const value_type& __x) { + for (size_type __i = 0; __i < __n; ++__i) + __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(__x)); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + // Check whether it's an integral type. If so, it's not an iterator. + template + void _M_insert_after_range(_Node_base* __pos, + _InIter __first, _InIter __last) { + typedef typename _IsIntegral<_InIter>::_Ret _Integral; + _M_insert_after_range(__pos, __first, __last, _Integral()); + } + + template + void _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x, + const __true_type&) { + _M_insert_after_fill(__pos, __n, __x); + } + + template + void _M_insert_after_range(_Node_base* __pos, + _InIter __first, _InIter __last, + const __false_type&) { +#else /* _STLP_MEMBER_TEMPLATES */ + void _M_insert_after_range(_Node_base* __pos, + const value_type* __first, + const value_type* __last) { + while (__first != __last) { + __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + void _M_insert_after_range(_Node_base* __pos, + const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + while (__first != __last) { + __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + +#if defined (_STLP_MEMBER_TEMPLATES) + // Check whether it's an integral type. If so, it's not an iterator. + template + void _M_splice_after_range(_Node_base* __pos, + _InIter __first, _InIter __last) { + typedef typename _IsIntegral<_InIter>::_Ret _Integral; + _M_splice_after_range(__pos, __first, __last, _Integral()); + } + + template + void _M_splice_after_range(_Node_base* __pos, _Integer __n, _Integer __x, + const __true_type&) { + _M_insert_after_fill(__pos, __n, __x); + } + + template + void _M_splice_after_range(_Node_base* __pos, + _InIter __first, _InIter __last, + const __false_type&) { +#else /* _STLP_MEMBER_TEMPLATES */ + void _M_splice_after_range(_Node_base* __pos, + const value_type* __first, + const value_type* __last) { + while (__first != __last) { + __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + void _M_splice_after_range(_Node_base* __pos, + const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + //We use a temporary slist to avoid the auto reference troubles (infinite loop) + _Self __tmp(__first, __last, this->get_allocator()); + splice_after(iterator(__pos), __tmp); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + // Check whether it's an integral type. If so, it's not an iterator. + template + void _M_splice_range(_Node_base* __pos, + _InIter __first, _InIter __last) { + typedef typename _IsIntegral<_InIter>::_Ret _Integral; + _M_splice_range(__pos, __first, __last, _Integral()); + } + + template + void _M_splice_range(_Node_base* __pos, _Integer __n, _Integer __x, + const __true_type&) { + _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos), + __n, __x); + } + + template + void _M_splice_range(_Node_base* __pos, + _InIter __first, _InIter __last, + const __false_type&) { +#else /* _STLP_MEMBER_TEMPLATES */ + void _M_splice_range(_Node_base* __pos, + const value_type* __first, + const value_type* __last) { + while (__first != __last) { + __pos = _STLP_PRIV __slist_make_link(__pos, _M_create_node(*__first)); + ++__first; + } + } + void _M_splice_range(_Node_base* __pos, + const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + //We use a temporary slist to avoid the auto reference troubles (infinite loop) + _Self __tmp(__first, __last, this->get_allocator()); + splice(iterator(__pos), __tmp); + } + +public: + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert_after(iterator __pos, const value_type& __x = _Tp()) { +#else + iterator insert_after(iterator __pos, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + return iterator(_M_insert_after(__pos._M_node, __x)); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert_after(iterator __pos) { + return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void insert_after(iterator __pos, size_type __n, const value_type& __x) { + _M_insert_after_fill(__pos._M_node, __n, __x); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template + void insert_after(iterator __pos, _InIter __first, _InIter __last) { +#else /* _STLP_MEMBER_TEMPLATES */ + void insert_after(iterator __pos, + const value_type* __first, const value_type* __last) { + _M_insert_after_range(__pos._M_node, __first, __last); + } + void insert_after(iterator __pos, + const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + _M_splice_after_range(__pos._M_node, __first, __last); + } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos, const value_type& __x = _Tp()) { +#else + iterator insert(iterator __pos, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), + __x)); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos) { + return iterator(_M_insert_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), + _STLP_DEFAULT_CONSTRUCTED(_Tp))); + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void insert(iterator __pos, size_type __n, const value_type& __x) { + _M_insert_after_fill(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), __n, __x); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template + void insert(iterator __pos, _InIter __first, _InIter __last) { +#else /* _STLP_MEMBER_TEMPLATES */ + void insert(iterator __pos, const value_type* __first, + const value_type* __last) { + _M_insert_after_range(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), + __first, __last); + } + void insert(iterator __pos, const_iterator __first, const_iterator __last) { +#endif /* _STLP_MEMBER_TEMPLATES */ + _M_splice_range(__pos._M_node, __first, __last); + } + +public: + iterator erase_after(iterator __pos) + { return iterator(this->_M_erase_after(__pos._M_node)); } + iterator erase_after(iterator __before_first, iterator __last) + { return iterator(this->_M_erase_after(__before_first._M_node, __last._M_node)); } + + iterator erase(iterator __pos) + { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node))); } + iterator erase(iterator __first, iterator __last) + { return iterator(this->_M_erase_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __first._M_node), __last._M_node)); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type new_size, const value_type& __x = _Tp()); +#else + void resize(size_type new_size, const value_type& __x); +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void clear() + { this->_M_erase_after(&this->_M_head._M_data, 0); } + +public: + // Moves the range [__before_first + 1, __before_last + 1) to *this, + // inserting it immediately after __pos. This is constant time. + void splice_after(iterator __pos, _Self& __x, + iterator __before_first, iterator __before_last) { + if (__before_first != __before_last) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, + __before_first._M_node, __before_last._M_node); + } + else { + this->insert_after(__pos, iterator(__before_first._M_node->_M_next), iterator(__before_last._M_node->_M_next)); + __x.erase_after(__before_first, ++__before_last); + } + } + } + + // Moves the element that follows __prev to *this, inserting it immediately + // after __pos. This is constant time. + void splice_after(iterator __pos, _Self& __x, iterator __prev) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, + __prev._M_node, __prev._M_node->_M_next); + } + else { + this->insert_after(__pos, __STATIC_CAST(_Node*, __prev._M_node->_M_next)->_M_data); + __x.erase_after(__prev); + } + } + + // Removes all of the elements from the list __x to *this, inserting + // them immediately after __pos. __x must not be *this. Complexity: + // linear in __x.size(). + void splice_after(iterator __pos, _Self& __x) { + if (this->get_allocator() == __x.get_allocator()) + _STLP_PRIV _Sl_global_inst::__splice_after(__pos._M_node, &__x._M_head._M_data); + else { + this->insert_after(__pos, __x.begin(), __x.end()); + __x.clear(); + } + } + + // Linear in distance(begin(), __pos), and linear in __x.size(). + void splice(iterator __pos, _Self& __x) { + if (__x._M_head._M_data._M_next) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), + &__x._M_head._M_data, + _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, 0)); + } + else { + insert(__pos, __x.begin(), __x.end()); + __x.clear(); + } + } + } + + // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i). + void splice(iterator __pos, _Self& __x, iterator __i) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), + _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __i._M_node), + __i._M_node); + } + else { + insert(__pos, *__i); + __x.erase(__i); + } + } + + // Linear in distance(begin(), __pos), in distance(__x.begin(), __first), + // and in distance(__first, __last). + void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { + if (__first != __last) { + if (this->get_allocator() == __x.get_allocator()) { + _STLP_PRIV _Sl_global_inst::__splice_after(_STLP_PRIV _Sl_global_inst::__previous(&this->_M_head._M_data, __pos._M_node), + _STLP_PRIV _Sl_global_inst::__previous(&__x._M_head._M_data, __first._M_node), + _STLP_PRIV _Sl_global_inst::__previous(__first._M_node, __last._M_node)); + } + else { + insert(__pos, __first, __last); + __x.erase(__first, __last); + } + } + } + +public: + void reverse() { + if (this->_M_head._M_data._M_next) + this->_M_head._M_data._M_next = _STLP_PRIV _Sl_global_inst::__reverse(this->_M_head._M_data._M_next); + } + + void remove(const _Tp& __val); + + void unique() { _STLP_PRIV _Slist_unique(*this, equal_to()); } + void merge(_Self& __x) { _STLP_PRIV _Slist_merge(*this, __x, less()); } + void sort() { _STLP_PRIV _Slist_sort(*this, less()); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void remove_if(_Predicate __pred) { + _Node_base* __cur = &this->_M_head._M_data; + while (__cur->_M_next) { + if (__pred(__STATIC_CAST(_Node*, __cur->_M_next)->_M_data)) + this->_M_erase_after(__cur); + else + __cur = __cur->_M_next; + } + } + + template + void unique(_BinaryPredicate __pred) + { _STLP_PRIV _Slist_unique(*this, __pred); } + + template + void merge(_Self& __x, _StrictWeakOrdering __comp) + { _STLP_PRIV _Slist_merge(*this, __x, __comp); } + + template + void sort(_StrictWeakOrdering __comp) + { _STLP_PRIV _Slist_sort(*this, __comp); } +#endif /* _STLP_MEMBER_TEMPLATES */ +}; + +#if defined (slist) +# undef slist +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# include +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +inline bool _STLP_CALL +operator == (const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { + typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator; + const_iterator __end1 = _SL1.end(); + const_iterator __end2 = _SL2.end(); + + const_iterator __i1 = _SL1.begin(); + const_iterator __i2 = _SL2.begin(); + while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) { + ++__i1; + ++__i2; + } + return __i1 == __end1 && __i2 == __end2; +} + +#define _STLP_EQUAL_OPERATOR_SPECIALIZED +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER slist<_Tp, _Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER +#undef _STLP_EQUAL_OPERATOR_SPECIALIZED + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + typedef __true_type implemented; + typedef typename __move_traits<_Alloc>::complete complete; +}; +# endif + +// Specialization of insert_iterator so that insertions will be constant +// time rather than linear time. +template +class insert_iterator > { +protected: + typedef slist<_Tp, _Alloc> _Container; + _Container* _M_container; + typename _Container::iterator _M_iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x, typename _Container::iterator __i) + : _M_container(&__x) { + if (__i == __x.begin()) + _M_iter = __x.before_begin(); + else + _M_iter = __x.previous(__i); + } + + insert_iterator<_Container>& + operator = (const typename _Container::value_type& __val) { + _M_iter = _M_container->insert_after(_M_iter, __val); + return *this; + } + + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_SLIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_slist_base.c b/sdk/tlibstdcxx/stlport/stl/_slist_base.c new file mode 100644 index 0000000000..e0e68c9b26 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_slist_base.c @@ -0,0 +1,104 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_SLIST_BASE_C +#define _STLP_SLIST_BASE_C + +#ifndef _STLP_INTERNAL_SLIST_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_Slist_node_base* _STLP_CALL +_Sl_global<_Dummy>::__previous(_Slist_node_base* __head, + const _Slist_node_base* __node) { + while (__head && __head->_M_next != __node) + __head = __head->_M_next; + return __head; +} + +template +void _STLP_CALL +_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos, _Slist_node_base* __head) { + _Slist_node_base* __before_last = __previous(__head, 0); + if (__before_last != __head) { + _Slist_node_base* __after = __pos->_M_next; + __pos->_M_next = __head->_M_next; + __head->_M_next = 0; + __before_last->_M_next = __after; + } +} + +template +void _STLP_CALL +_Sl_global<_Dummy>::__splice_after(_Slist_node_base* __pos, + _Slist_node_base* __before_first, + _Slist_node_base* __before_last) { + if (__pos != __before_first && __pos != __before_last) { + _Slist_node_base* __first = __before_first->_M_next; + _Slist_node_base* __after = __pos->_M_next; + __before_first->_M_next = __before_last->_M_next; + __pos->_M_next = __first; + __before_last->_M_next = __after; + } +} + +template +_Slist_node_base* _STLP_CALL +_Sl_global<_Dummy>::__reverse(_Slist_node_base* __node) { + _Slist_node_base* __result = __node; + __node = __node->_M_next; + __result->_M_next = 0; + while(__node) { + _Slist_node_base* __next = __node->_M_next; + __node->_M_next = __result; + __result = __node; + __node = __next; + } + return __result; +} + +template +size_t _STLP_CALL +_Sl_global<_Dummy>::size(_Slist_node_base* __node) { + size_t __result = 0; + for ( ; __node != 0; __node = __node->_M_next) + ++__result; + return __result; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_SLIST_BASE_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_slist_base.h b/sdk/tlibstdcxx/stlport/stl/_slist_base.h new file mode 100644 index 0000000000..3afa18a15b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_slist_base.h @@ -0,0 +1,90 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_SLIST_BASE_H +#define _STLP_INTERNAL_SLIST_BASE_H + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +struct _Slist_node_base { + _Slist_node_base* _M_next; +}; + +inline _Slist_node_base* +__slist_make_link(_Slist_node_base* __prev_node, + _Slist_node_base* __new_node) { + __new_node->_M_next = __prev_node->_M_next; + __prev_node->_M_next = __new_node; + return __new_node; +} + + +template +class _Sl_global { +public: + // those used to be global functions + // moved here to reduce code bloat without templatizing _Slist_iterator_base + static size_t _STLP_CALL size(_Slist_node_base* __node); + static _Slist_node_base* _STLP_CALL __reverse(_Slist_node_base* __node); + static void _STLP_CALL __splice_after(_Slist_node_base* __pos, + _Slist_node_base* __before_first, + _Slist_node_base* __before_last); + + static void _STLP_CALL __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head); + + static _Slist_node_base* _STLP_CALL __previous(_Slist_node_base* __head, + const _Slist_node_base* __node); + static const _Slist_node_base* _STLP_CALL __previous(const _Slist_node_base* __head, + const _Slist_node_base* __node) { + return _Sl_global<_Dummy>::__previous(__CONST_CAST(_Slist_node_base*, __head), __node); + } +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _Sl_global; +#endif + +typedef _Sl_global _Sl_global_inst; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) && defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) +# include +#endif + +#endif /* _STLP_INTERNAL_SLIST_BASE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_sparc_atomic.h b/sdk/tlibstdcxx/stlport/stl/_sparc_atomic.h new file mode 100644 index 0000000000..21cc0ad030 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_sparc_atomic.h @@ -0,0 +1,61 @@ + +// Currently, SUN CC requires object file + +#if defined (__GNUC__) + +/* +** int _STLP_atomic_exchange (__stl_atomic_t *pvalue, __stl_atomic_t value) +*/ + +# if defined(__sparc_v9__) || defined (__sparcv9) + +# ifdef __arch64__ + +# define _STLP_EXCH_ASM asm volatile ("casx [%3], %4, %0 ; membar #LoadLoad | #LoadStore " : \ + "=r" (_L_value2), "=m" (*_L_pvalue1) : \ + "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) ) + +# else /* __arch64__ */ + +# define _STLP_EXCH_ASM asm volatile ("cas [%3], %4, %0" : \ + "=r" (_L_value2), "=m" (*_L_pvalue1) : \ + "m" (*_L_pvalue1), "r" (_L_pvalue1), "r" (_L_value1), "0" (_L_value2) ) +# endif + +# else /* __sparc_v9__ */ + +# define _STLP_EXCH_ASM asm volatile ("swap [%3], %0 " : \ + "=r" (_L_value2), "=m" (*_L_pvalue1) : \ + "m" (*_L_pvalue1), "r" (_L_pvalue1), "0" (_L_value2) ) +# endif + + +# define _STLP_ATOMIC_EXCHANGE(__pvalue1, __value2) \ + ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \ + register __stl_atomic_t _L_value1, _L_value2 = __value2 ; \ + do { _L_value1 = *_L_pvalue1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \ + _L_value1; }) + +# define _STLP_ATOMIC_INCREMENT(__pvalue1) \ + ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \ + register __stl_atomic_t _L_value1, _L_value2; \ + do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1+1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \ + (_L_value2 + 1); }) + +# define _STLP_ATOMIC_DECREMENT(__pvalue1) \ + ({ register volatile __stl_atomic_t *_L_pvalue1 = __pvalue1; \ + register __stl_atomic_t _L_value1, _L_value2; \ + do { _L_value1 = *_L_pvalue1; _L_value2 = _L_value1-1; _STLP_EXCH_ASM; } while ( _L_value1 != _L_value2 ) ; \ + (_L_value2 - 1); }) + +# elif ! defined (_STLP_NO_EXTERN_INLINE) + +extern "C" __stl_atomic_t _STLP_atomic_exchange(__stl_atomic_t * __x, __stl_atomic_t __v); +extern "C" void _STLP_atomic_decrement(__stl_atomic_t* i); +extern "C" void _STLP_atomic_increment(__stl_atomic_t* i); + +# define _STLP_ATOMIC_INCREMENT(__x) _STLP_atomic_increment((__stl_atomic_t*)__x) +# define _STLP_ATOMIC_DECREMENT(__x) _STLP_atomic_decrement((__stl_atomic_t*)__x) +# define _STLP_ATOMIC_EXCHANGE(__x, __y) _STLP_atomic_exchange((__stl_atomic_t*)__x, (__stl_atomic_t)__y) + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_sstream.c b/sdk/tlibstdcxx/stlport/stl/_sstream.c new file mode 100644 index 0000000000..9f585351e1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_sstream.c @@ -0,0 +1,465 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_SSTREAM_C +#define _STLP_SSTREAM_C + +#ifndef _STLP_INTERNAL_SSTREAM +# include +#endif + +#if defined ( _STLP_NESTED_TYPE_PARAM_BUG ) +// no wint_t is supported for this mode +# define __BSB_int_type__ int +# define __BSB_pos_type__ streampos +#else +# define __BSB_int_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::int_type +# define __BSB_pos_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Non-inline stringbuf member functions. + +// Constructors. Note that the base class constructor sets all of the +// get and area pointers to null. + +template +basic_stringbuf<_CharT, _Traits, _Alloc> + ::basic_stringbuf(ios_base::openmode __mode) + : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str() +{} + +template +basic_stringbuf<_CharT, _Traits, _Alloc> + ::basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __s, ios_base::openmode __mode) + : basic_streambuf<_CharT, _Traits>(), _M_mode(__mode), _M_str(__s) +{ + _M_set_ptrs(); +} + +template +basic_stringbuf<_CharT, _Traits, _Alloc>::~basic_stringbuf() +{} + +// Set the underlying string to a new value. +template +void +basic_stringbuf<_CharT, _Traits, _Alloc>::str(const basic_string<_CharT, _Traits, _Alloc>& __s) +{ + _M_str = __s; + _M_set_ptrs(); +} + +template +void +basic_stringbuf<_CharT, _Traits, _Alloc>::_M_set_ptrs() +{ + _CharT* __data_ptr = _S_start(_M_str); + _CharT* __data_end = _S_finish(_M_str); + // The initial read position is the beginning of the string. + if (_M_mode & ios_base::in) { + this->setg(__data_ptr, (_M_mode & ios_base::ate) ? __data_end : __data_ptr, __data_end); + } + + // The initial write position is the beginning of the string. + if (_M_mode & ios_base::out) { + if ( _M_mode & (ios_base::app | ios_base::ate) ) { + this->setp( __data_end, __data_end ); + } else { + this->setp( __data_ptr, __data_end ); + this->pbump((int)_M_str.size()); // initial write position, if we initialized with string + } + // this->setp((_M_mode & (ios_base::app | ios_base::ate))? __data_end : __data_ptr, __data_end); + } +} + +// Precondition: gptr() >= egptr(). Returns a character, if one is available. +template +__BSB_int_type__ +basic_stringbuf<_CharT, _Traits, _Alloc>::underflow() { + return this->gptr() != this->egptr() + ? _Traits::to_int_type(*this->gptr()) + : _Traits::eof(); +} + +// Precondition: gptr() >= egptr(). +template +__BSB_int_type__ +basic_stringbuf<_CharT, _Traits, _Alloc>::uflow() { + if (this->gptr() != this->egptr()) { + int_type __c = _Traits::to_int_type(*this->gptr()); + this->gbump(1); + return __c; + } + else + return _Traits::eof(); +} + +template +__BSB_int_type__ +basic_stringbuf<_CharT, _Traits, _Alloc>::pbackfail(int_type __c) { + if (this->gptr() != this->eback()) { + if (!_Traits::eq_int_type(__c, _Traits::eof())) { + if (_Traits::eq(_Traits::to_char_type(__c), this->gptr()[-1])) { + this->gbump(-1); + return __c; + } + else if (_M_mode & ios_base::out) { + this->gbump(-1); + *this->gptr() = _Traits::to_char_type(__c); + return __c; + } + else + return _Traits::eof(); + } + else { + this->gbump(-1); + return _Traits::not_eof(__c); + } + } + else + return _Traits::eof(); +} + +template +__BSB_int_type__ basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(int_type __c) +{ + if (!_Traits::eq_int_type(__c, _Traits::eof())) { + if (_M_mode & ios_base::out) { + if ( this->pptr() < this->epptr() ) { // just put back in any case + _M_str.push_back( _Traits::to_char_type(__c) ); + this->pbump(1); + } else if ( _M_mode & ios_base::in ) { + ptrdiff_t __offset = this->gptr() - this->eback(); + _M_str.push_back(_Traits::to_char_type(__c)); + _CharT* __data_ptr = _S_start(_M_str); + this->setg(__data_ptr, __data_ptr + __offset, _S_finish(_M_str)); + this->setp(__data_ptr, _S_finish(_M_str)); + this->pbump((int)_M_str.size()); + } else { + _M_str.push_back( _Traits::to_char_type(__c) ); + this->setp(_S_start(_M_str), _S_finish(_M_str)); + this->pbump((int)_M_str.size()); + } + return __c; + } + return _Traits::eof(); // Overflow always fails if it's read-only + } + return _Traits::not_eof(__c); // __c is EOF, so we don't have to do anything +} + +template +streamsize +basic_stringbuf<_CharT, _Traits, _Alloc>::xsputn(const char_type* __s, + streamsize __n) { + streamsize __nwritten = 0; + + if ((_M_mode & ios_base::out) && __n > 0) { + // If the put pointer is somewhere in the middle of the string, + // then overwrite instead of append. + if ( !_M_str.empty() && this->pbase() == _S_start(_M_str)) { + ptrdiff_t __avail = _S_finish(_M_str) - this->pptr(); + if (__avail > __n) { + _Traits::copy(this->pptr(), __s, __STATIC_CAST(size_t, __n)); + this->pbump((int)__n); + return __n; + } else { + _Traits::copy(this->pptr(), __s, __avail); + __nwritten += __avail; + __n -= __avail; + __s += __avail; + } + } + + // At this point we know we're appending. + _CharT* __data_ptr; + if (_M_mode & ios_base::in) { + ptrdiff_t __get_offset = this->gptr() - this->eback(); + _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n)); + __data_ptr = _S_start(_M_str); + this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str)); + } else { + _M_str.append(__s, __s + __STATIC_CAST(ptrdiff_t, __n)); + __data_ptr = _S_start(_M_str); + } + + this->setp(__data_ptr, _S_finish(_M_str)); + this->pbump((int)_M_str.size()); + __nwritten += __n; + } + + return __nwritten; +} + +template +streamsize +basic_stringbuf<_CharT, _Traits, _Alloc>::_M_xsputnc(char_type __c, + streamsize __n) { + streamsize __nwritten = 0; + + if ((_M_mode & ios_base::out) && __n > 0) { + // If the put pointer is somewhere in the middle of the string, + // then overwrite instead of append. + if (this->pbase() == _S_start(_M_str)) { + ptrdiff_t __avail = _S_finish(_M_str) - this->pptr(); + if (__avail > __n) { + _Traits::assign(this->pptr(), __STATIC_CAST(size_t, __n), __c); + this->pbump(__STATIC_CAST(int, __n)); + return __n; + } + else { + _Traits::assign(this->pptr(), __avail, __c); + __nwritten += __avail; + __n -= __avail; + } + } + + // At this point we know we're appending. + size_t __app_size = sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) + : __STATIC_CAST(size_t, __n); + _CharT* __data_ptr; + if (this->_M_mode & ios_base::in) { + ptrdiff_t __get_offset = this->gptr() - this->eback(); + _M_str.append(__app_size, __c); + __data_ptr = _S_start(_M_str); + this->setg(__data_ptr, __data_ptr + __get_offset, _S_finish(_M_str)); + } else { + _M_str.append(__app_size, __c); + __data_ptr = _S_start(_M_str); + } + + this->setp(__data_ptr, _S_finish(_M_str)); + this->pbump((int)_M_str.size()); + __nwritten += __app_size; + } + + return __nwritten; +} + +// According to the C++ standard the effects of setbuf are implementation +// defined, except that setbuf(0, 0) has no effect. In this implementation, +// setbuf(, n), for n > 0, calls reserve(n) on the underlying +// string. +template +basic_streambuf<_CharT, _Traits>* +basic_stringbuf<_CharT, _Traits, _Alloc>::setbuf(_CharT*, streamsize __n) { + if (__n > 0) { + bool __do_get_area = false; + bool __do_put_area = false; + ptrdiff_t __offg = 0; + ptrdiff_t __offp = 0; + + if (this->pbase() == _S_start(_M_str)) { + __do_put_area = true; + __offp = this->pptr() - this->pbase(); + } + + if (this->eback() == _S_start(_M_str)) { + __do_get_area = true; + __offg = this->gptr() - this->eback(); + } + + _M_str.reserve(sizeof(streamsize) > sizeof(size_t) ? __STATIC_CAST(size_t, (min)(__n, __STATIC_CAST(streamsize, _M_str.max_size()))) + : __STATIC_CAST(size_t, __n)); + + _CharT* __data_ptr = _S_start(_M_str); + + if (__do_get_area) { + this->setg(__data_ptr, __data_ptr + __offg, _S_finish(_M_str)); + } + + if (__do_put_area) { + this->setp(__data_ptr, _S_finish(_M_str)); + this->pbump((int)__offp); + } + } + + return this; +} + +template +__BSB_pos_type__ +basic_stringbuf<_CharT, _Traits, _Alloc> + ::seekoff(off_type __off, + ios_base::seekdir __dir, + ios_base::openmode __mode) { + __mode &= _M_mode; + + bool __imode = (__mode & ios_base::in) != 0; + bool __omode = (__mode & ios_base::out) != 0; + + if ( !(__imode || __omode) ) + return pos_type(off_type(-1)); + + if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) ) + return pos_type(off_type(-1)); + + streamoff __newoff; + switch(__dir) { + case ios_base::beg: + __newoff = 0; + break; + case ios_base::end: + __newoff = _M_str.size(); + break; + case ios_base::cur: + __newoff = __imode ? this->gptr() - this->eback() : this->pptr() - this->pbase(); + if ( __off == 0 ) { + return pos_type(__newoff); + } + break; + default: + return pos_type(off_type(-1)); + } + + __off += __newoff; + + if (__imode) { + ptrdiff_t __n = this->egptr() - this->eback(); + + if (__off < 0 || __off > __n) + return pos_type(off_type(-1)); + this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __off), + this->eback() + __STATIC_CAST(ptrdiff_t, __n)); + } + + if (__omode) { + ptrdiff_t __n = this->epptr() - this->pbase(); + + if (__off < 0 || __off > __n) + return pos_type(off_type(-1)); + this->setp(this->pbase(), this->pbase() + __n); + this->pbump((int)__off); + } + + return pos_type(__off); +} + +template +__BSB_pos_type__ +basic_stringbuf<_CharT, _Traits, _Alloc> + ::seekpos(pos_type __pos, ios_base::openmode __mode) { + __mode &= _M_mode; + + bool __imode = (__mode & ios_base::in) != 0; + bool __omode = (__mode & ios_base::out) != 0; + + if ( !(__imode || __omode) ) + return pos_type(off_type(-1)); + + if ( (__imode && (this->gptr() == 0)) || (__omode && (this->pptr() == 0)) ) + return pos_type(off_type(-1)); + + const off_type __n = __pos - pos_type(off_type(0)); + + if (__imode) { + if (__n < 0 || __n > this->egptr() - this->eback()) + return pos_type(off_type(-1)); + this->setg(this->eback(), this->eback() + __STATIC_CAST(ptrdiff_t, __n), this->egptr()); + } + + if (__omode) { + if (__n < 0 || size_t(__n) > _M_str.size()) + return pos_type(off_type(-1)); + + this->setp(_S_start(_M_str), _S_finish(_M_str)); + this->pbump((int)__n); + } + + return __pos; +} + +//---------------------------------------------------------------------- +// Non-inline istringstream member functions. + +template +basic_istringstream<_CharT, _Traits, _Alloc> + ::basic_istringstream(ios_base::openmode __mode) + : basic_istream<_CharT, _Traits>(0), + _M_buf(__mode | ios_base::in) { + this->init(&_M_buf); +} + +template +basic_istringstream<_CharT, _Traits, _Alloc> + ::basic_istringstream(const _String& __str,ios_base::openmode __mode) + : basic_istream<_CharT, _Traits>(0), + _M_buf(__str, __mode | ios_base::in) { + this->init(&_M_buf); +} + +template +basic_istringstream<_CharT, _Traits, _Alloc>::~basic_istringstream() +{} + +//---------------------------------------------------------------------- +// Non-inline ostringstream member functions. + +template +basic_ostringstream<_CharT, _Traits, _Alloc> + ::basic_ostringstream(ios_base::openmode __mode) + : basic_ostream<_CharT, _Traits>(0), + _M_buf(__mode | ios_base::out) { + this->init(&_M_buf); +} + +template +basic_ostringstream<_CharT, _Traits, _Alloc> + ::basic_ostringstream(const _String& __str, ios_base::openmode __mode) + : basic_ostream<_CharT, _Traits>(0), + _M_buf(__str, __mode | ios_base::out) { + this->init(&_M_buf); +} + +template +basic_ostringstream<_CharT, _Traits, _Alloc>::~basic_ostringstream() +{} + +//---------------------------------------------------------------------- +// Non-inline stringstream member functions. + +template +basic_stringstream<_CharT, _Traits, _Alloc> + ::basic_stringstream(ios_base::openmode __mode) + : basic_iostream<_CharT, _Traits>(0), _M_buf(__mode) { + this->init(&_M_buf); +} + +template +basic_stringstream<_CharT, _Traits, _Alloc> + ::basic_stringstream(const _String& __str, ios_base::openmode __mode) + : basic_iostream<_CharT, _Traits>(0), _M_buf(__str, __mode) { + this->init(&_M_buf); +} + +template +basic_stringstream<_CharT, _Traits, _Alloc>::~basic_stringstream() +{} + +_STLP_END_NAMESPACE + +# undef __BSB_int_type__ +# undef __BSB_pos_type__ + +#endif /* _STLP_SSTREAM_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_sstream.h b/sdk/tlibstdcxx/stlport/stl/_sstream.h new file mode 100644 index 0000000000..9e8d02a64a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_sstream.h @@ -0,0 +1,266 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + + +// This header defines classes basic_stringbuf, basic_istringstream, +// basic_ostringstream, and basic_stringstream. These classes +// represent streamsbufs and streams whose sources or destinations are +// C++ strings. + +#ifndef _STLP_INTERNAL_SSTREAM +#define _STLP_INTERNAL_SSTREAM + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAM +# include // Includes , , +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// This version of basic_stringbuf relies on the internal details of +// basic_string. It relies on the fact that, in this implementation, +// basic_string's iterators are pointers. It also assumes (as allowed +// by the standard) that _CharT is a POD type. + +// We have a very small buffer for the put area, just so that we don't +// have to use append() for every sputc. Conceptually, the buffer +// immediately follows the end of the underlying string. We use this +// buffer when appending to write-only streambufs, but we don't use it +// for read-write streambufs. + +template +class basic_stringbuf : public basic_streambuf<_CharT, _Traits> { +public: // Typedefs. + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_streambuf<_CharT, _Traits> _Base; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Self; + typedef basic_string<_CharT, _Traits, _Alloc> _String; + +public: // Constructors, destructor. + explicit basic_stringbuf(ios_base::openmode __mode + = ios_base::in | ios_base::out); + explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode + = ios_base::in | ios_base::out); + virtual ~basic_stringbuf(); + +public: // Get or set the string. + _String str() const { return _M_str; } + void str(const _String& __s); + +protected: // Overridden virtual member functions. + virtual int_type underflow(); + virtual int_type uflow(); + virtual int_type pbackfail(int_type __c); + virtual int_type overflow(int_type __c); + int_type pbackfail() {return pbackfail(_Traits::eof());} + int_type overflow() {return overflow(_Traits::eof());} + + virtual streamsize xsputn(const char_type* __s, streamsize __n); + virtual streamsize _M_xsputnc(char_type __c, streamsize __n); + + virtual _Base* setbuf(_CharT* __buf, streamsize __n); + virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, + ios_base::openmode __mode + = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode + = ios_base::in | ios_base::out); + +private: // Helper functions. + void _M_set_ptrs(); + static _CharT* _S_start(const _String& __str) { return __CONST_CAST(_CharT*, __str.data()); } + static _CharT* _S_finish(const _String& __str) { return __CONST_CAST(_CharT*, __str.data()) + __str.size(); } + +private: + ios_base::openmode _M_mode; + _String _M_str; +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf, allocator >; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf, allocator >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +//---------------------------------------------------------------------- +// Class basic_istringstream, an input stream that uses a stringbuf. + +template +class basic_istringstream : public basic_istream<_CharT, _Traits> { +public: // Typedefs + typedef typename _Traits::char_type char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_ios<_CharT, _Traits> _Basic_ios; + typedef basic_istream<_CharT, _Traits> _Base; + typedef basic_string<_CharT, _Traits, _Alloc> _String; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf; + +public: // Constructors, destructor. + basic_istringstream(ios_base::openmode __mode = ios_base::in); + basic_istringstream(const _String& __str, + ios_base::openmode __mode = ios_base::in); + ~basic_istringstream(); + +public: // Member functions + + basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const + { return __CONST_CAST(_Buf*,&_M_buf); } + + _String str() const { return _M_buf.str(); } + void str(const _String& __s) { _M_buf.str(__s); } + +private: + basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf; + +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) + typedef basic_istringstream<_CharT, _Traits> _Self; + //explicitely defined as private to avoid warnings: + basic_istringstream(_Self const&); + _Self& operator = (_Self const&); +#endif +}; + + +//---------------------------------------------------------------------- +// Class basic_ostringstream, an output stream that uses a stringbuf. + +template +class basic_ostringstream : public basic_ostream<_CharT, _Traits> { +public: // Typedefs + typedef typename _Traits::char_type char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_ios<_CharT, _Traits> _Basic_ios; + typedef basic_ostream<_CharT, _Traits> _Base; + typedef basic_string<_CharT, _Traits, _Alloc> _String; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf; + +public: // Constructors, destructor. + basic_ostringstream(ios_base::openmode __mode = ios_base::out); + basic_ostringstream(const _String& __str, + ios_base::openmode __mode = ios_base::out); + ~basic_ostringstream(); + +public: // Member functions. + + basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const + { return __CONST_CAST(_Buf*,&_M_buf); } + + _String str() const { return _M_buf.str(); } + void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE + + +private: + basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf; + +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) + typedef basic_ostringstream<_CharT, _Traits> _Self; + //explicitely defined as private to avoid warnings: + basic_ostringstream(_Self const&); + _Self& operator = (_Self const&); +#endif +}; + + +//---------------------------------------------------------------------- +// Class basic_stringstream, a bidirectional stream that uses a stringbuf. + +template +class basic_stringstream : public basic_iostream<_CharT, _Traits> { +public: // Typedefs + typedef typename _Traits::char_type char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + typedef basic_ios<_CharT, _Traits> _Basic_ios; + typedef basic_iostream<_CharT, _Traits> _Base; + typedef basic_string<_CharT, _Traits, _Alloc> _String; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> _Buf; + + typedef ios_base::openmode openmode; + +public: // Constructors, destructor. + basic_stringstream(openmode __mod = ios_base::in | ios_base::out); + basic_stringstream(const _String& __str, + openmode __mod = ios_base::in | ios_base::out); + ~basic_stringstream(); + +public: // Member functions. + + basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const + { return __CONST_CAST(_Buf*,&_M_buf); } + + _String str() const { return _M_buf.str(); } + void str(const _String& __s) { _M_buf.str(__s); } + +private: + basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf; + +#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310) + typedef basic_stringstream<_CharT, _Traits> _Self; + //explicitely defined as private to avoid warnings: + basic_stringstream(_Self const&); + _Self& operator = (_Self const&); +#endif +}; + + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream, allocator >; +_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream, allocator >; +_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream, allocator >; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream, allocator >; +_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream, allocator >; +_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream, allocator >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_SSTREAM */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_stack.h b/sdk/tlibstdcxx/stlport/stl/_stack.h new file mode 100644 index 0000000000..7ea9d59afb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_stack.h @@ -0,0 +1,133 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_STACK_H +#define _STLP_INTERNAL_STACK_H + +#ifndef _STLP_INTERNAL_DEQUE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if !defined ( _STLP_LIMITED_DEFAULT_TEMPLATES ) +template > +#elif defined ( _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS ) +# define _STLP_STACK_ARGS _Tp +template +#else +template +#endif +class stack +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) +# if defined (_STLP_STACK_ARGS) + : public __stlport_class > +# else + : public __stlport_class > +# endif +#endif +{ +#ifdef _STLP_STACK_ARGS + typedef deque<_Tp> _Sequence; + typedef stack<_Tp> _Self; +#else + typedef stack<_Tp, _Sequence> _Self; +#endif + +public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; +protected: + //c is a Standard name (23.2.3.3), do no make it STLport naming convention compliant. + _Sequence c; +public: + stack() : c() {} + explicit stack(const _Sequence& __s) : c(__s) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + stack(__move_source<_Self> src) + : c(_STLP_PRIV _AsMoveSource(src.get().c)) {} +#endif + + bool empty() const { return c.empty(); } + size_type size() const { return c.size(); } + reference top() { return c.back(); } + const_reference top() const { return c.back(); } + void push(const value_type& __x) { c.push_back(__x); } + void pop() { c.pop_back(); } + const _Sequence& _Get_s() const { return c; } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { + _Sequence __tmp = c; + c = __x.c; + __x.c = __tmp; + } +#endif +}; + +#ifndef _STLP_STACK_ARGS +# define _STLP_STACK_ARGS _Tp, _Sequence +# define _STLP_STACK_HEADER_ARGS class _Tp, class _Sequence +#else +# define _STLP_STACK_HEADER_ARGS class _Tp +#endif + +template < _STLP_STACK_HEADER_ARGS > +inline bool _STLP_CALL operator==(const stack< _STLP_STACK_ARGS >& __x, + const stack< _STLP_STACK_ARGS >& __y) +{ return __x._Get_s() == __y._Get_s(); } + +template < _STLP_STACK_HEADER_ARGS > +inline bool _STLP_CALL operator<(const stack< _STLP_STACK_ARGS >& __x, + const stack< _STLP_STACK_ARGS >& __y) +{ return __x._Get_s() < __y._Get_s(); } + +_STLP_RELOPS_OPERATORS(template < _STLP_STACK_HEADER_ARGS >, stack< _STLP_STACK_ARGS >) + +#undef _STLP_STACK_ARGS +#undef _STLP_STACK_HEADER_ARGS + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > : + _STLP_PRIV __move_traits_aux<_Sequence> +{}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_STACK_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_stdexcept.h b/sdk/tlibstdcxx/stlport/stl/_stdexcept.h new file mode 100644 index 0000000000..8c784bb990 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_stdexcept.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_STDEXCEPT +#define _STLP_INTERNAL_STDEXCEPT + +#ifndef _STLP_INTERNAL_STDEXCEPT_BASE +# include +#endif + +#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE) + +# if defined(_STLP_USE_EXCEPTIONS) || \ + !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32)) + +_STLP_BEGIN_NAMESPACE + +class _STLP_CLASS_DECLSPEC logic_error : public __Named_exception { +public: + logic_error(const string& __s) : __Named_exception(__s) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~logic_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC runtime_error : public __Named_exception { +public: + runtime_error(const string& __s) : __Named_exception(__s) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~runtime_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC domain_error : public logic_error { +public: + domain_error(const string& __arg) : logic_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~domain_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC invalid_argument : public logic_error { +public: + invalid_argument(const string& __arg) : logic_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~invalid_argument() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC length_error : public logic_error { +public: + length_error(const string& __arg) : logic_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~length_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC out_of_range : public logic_error { +public: + out_of_range(const string& __arg) : logic_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~out_of_range() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC range_error : public runtime_error { +public: + range_error(const string& __arg) : runtime_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~range_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC overflow_error : public runtime_error { +public: + overflow_error(const string& __arg) : runtime_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~overflow_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +class _STLP_CLASS_DECLSPEC underflow_error : public runtime_error { +public: + underflow_error(const string& __arg) : runtime_error(__arg) {} +# ifndef _STLP_USE_NO_IOSTREAMS + ~underflow_error() _STLP_NOTHROW_INHERENTLY; +# endif +}; + +_STLP_END_NAMESPACE + +# endif +#endif + +#endif /* _STLP_INTERNAL_STDEXCEPT */ diff --git a/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.c b/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.c new file mode 100644 index 0000000000..deb705637f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +__Named_exception::__Named_exception(const string& __str) { + size_t __size = strlen(_STLP_PRIV __get_c_string(__str)) + 1; + if (__size > _S_bufsize) { + _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char))); + if (!_M_name) { + __size = _S_bufsize; + _M_name = _M_static_name; + } + else { + *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char); + } + } + else { + _M_name = _M_static_name; + } +#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) + strncpy(_M_name, _STLP_PRIV __get_c_string(__str), __size - 1); + _M_name[__size - 1] = '\0'; +#else + strncpy_s(_M_name, __size, _STLP_PRIV __get_c_string(__str), __size - 1); +#endif +} + +__Named_exception::__Named_exception(const __Named_exception& __x) { + size_t __size = strlen(__x._M_name) + 1; + if (__size > _S_bufsize) { + _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char))); + if (!_M_name) { + __size = _S_bufsize; + _M_name = _M_static_name; + } + else { + *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char); + } + } + else { + _M_name = _M_static_name; + } +#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) + strncpy(_M_name, __x._M_name, __size - 1); + _M_name[__size - 1] = '\0'; +#else + strncpy_s(_M_name, __size, __x._M_name, __size - 1); +#endif +} + +__Named_exception& __Named_exception::operator = (const __Named_exception& __x) { + size_t __size = strlen(__x._M_name) + 1; + size_t __buf_size = _M_name != _M_static_name ? *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) : _S_bufsize; + if (__size > __buf_size) { + // Being here necessarily mean that we need to allocate a buffer: + if (_M_name != _M_static_name) free(_M_name); + _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char))); + if (!_M_name) { + __size = _S_bufsize; + _M_name = _M_static_name; + } + else { + *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) = __size * sizeof(char); + } + } +#if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) + strncpy(_M_name, __x._M_name, __size - 1); + _M_name[__size - 1] = '\0'; +#else + strncpy_s(_M_name, __size, __x._M_name, __size - 1); +#endif + return *this; +} + +__Named_exception::~__Named_exception() _STLP_NOTHROW_INHERENTLY { + if (_M_name != _M_static_name) + free(_M_name); +} + +const char* __Named_exception::what() const _STLP_NOTHROW_INHERENTLY +{ return _M_name; } diff --git a/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.h b/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.h new file mode 100644 index 0000000000..cf8d198694 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_stdexcept_base.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_STDEXCEPT_BASE +#define _STLP_INTERNAL_STDEXCEPT_BASE + +#if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE) + +# ifndef _STLP_INTERNAL_EXCEPTION +# include +# endif + +# if defined(_STLP_USE_EXCEPTIONS) || \ + !(defined(_MIPS_SIM) && defined(_ABIO32) && (_MIPS_SIM == _ABIO32)) + +# ifndef _STLP_INTERNAL_CSTRING +# include +# endif + +# ifndef _STLP_STRING_FWD_H +# include +# endif + +# ifndef _STLP_USE_NO_IOSTREAMS +# define _STLP_OWN_STDEXCEPT 1 +# endif + +_STLP_BEGIN_NAMESPACE + +/* We disable the 4275 warning for + * - WinCE where there are only static version of the native C++ runtime. + * - The MSVC compilers when the STLport user wants to make an STLport dll linked to + * the static C++ native runtime. In this case the std::exception base class is no more + * exported from native dll but is used as a base class for the exported __Named_exception + * class. + */ +# if defined (_STLP_WCE_NET) || \ + defined (_STLP_USE_DYNAMIC_LIB) && defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# define _STLP_DO_WARNING_POP +# pragma warning (push) +# pragma warning (disable: 4275) // Non dll interface class 'exception' used as base + // for dll-interface class '__Named_exception' +# endif + +# if !defined (_STLP_NO_EXCEPTION_HEADER) +# if !defined (_STLP_EXCEPTION_BASE) && !defined (_STLP_BROKEN_EXCEPTION_CLASS) && \ + defined (_STLP_USE_NAMESPACES) && defined (_STLP_USE_OWN_NAMESPACE) +using _STLP_VENDOR_EXCEPT_STD::exception; +# endif +# endif +# define _STLP_EXCEPTION_BASE exception + +class _STLP_CLASS_DECLSPEC __Named_exception : public _STLP_EXCEPTION_BASE { +public: + __Named_exception(const string& __str); + __Named_exception(const __Named_exception&); + __Named_exception& operator = (const __Named_exception&); + + const char* what() const _STLP_NOTHROW_INHERENTLY; + ~__Named_exception() _STLP_NOTHROW_INHERENTLY; + +private: + enum { _S_bufsize = 256 }; + char _M_static_name[_S_bufsize]; + char *_M_name; +}; + +# if defined (_STLP_USE_NO_IOSTREAMS) && defined (__BUILDING_STLPORT) + // if not linking to the lib, expose implementation of members here +# include +# endif + +# if defined (_STLP_DO_WARNING_POP) +# pragma warning (pop) +# undef _STLP_DO_WARNING_POP +# endif + +_STLP_END_NAMESPACE + +# endif /* Not o32, and no exceptions */ +#endif /* _STLP_STDEXCEPT_SEEN */ + +#endif /* _STLP_INTERNAL_STDEXCEPT_BASE */ diff --git a/sdk/tlibstdcxx/stlport/stl/_stlport_version.h b/sdk/tlibstdcxx/stlport/stl/_stlport_version.h new file mode 100644 index 0000000000..587651de41 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_stlport_version.h @@ -0,0 +1,30 @@ + /* + * + * Copyright (c) 2005 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STLPORT_VERSION_H +#define _STLP_STLPORT_VERSION_H + +/* The last SGI STL release we merged with */ +#define __SGI_STL 0x330 + +/* STLport version */ +#define _STLPORT_MAJOR 5 +#define _STLPORT_MINOR 2 +#define _STLPORT_PATCHLEVEL 1 + +#define _STLPORT_VERSION 0x521 + +#endif /* _STLP_STLPORT_VERSION_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/_stream_iterator.h b/sdk/tlibstdcxx/stlport/stl/_stream_iterator.h new file mode 100644 index 0000000000..aa26ae3517 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_stream_iterator.h @@ -0,0 +1,253 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#if !defined (_STLP_INTERNAL_STREAM_ITERATOR_H) && !defined (_STLP_USE_NO_IOSTREAMS) +#define _STLP_INTERNAL_STREAM_ITERATOR_H + +#ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +#endif + +// streambuf_iterators predeclarations must appear first +#ifndef _STLP_INTERNAL_IOSFWD +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAM +# include +#endif + +// istream_iterator and ostream_iterator look very different if we're +// using new, templatized iostreams than if we're using the old cfront +// version. + +_STLP_BEGIN_NAMESPACE + +#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _CharT, class _Traits, class _Dist +# define __ISI_TMPL_ARGUMENTS _Tp, _CharT, _Traits, _Dist +template , + class _Dist = ptrdiff_t> +class istream_iterator : public iterator { +#else +# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM) +# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp +# define __ISI_TMPL_ARGUMENTS _Tp +template +class istream_iterator : public iterator { +# else +# define __ISI_TMPL_HEADER_ARGUMENTS class _Tp, class _Dist +# define __ISI_TMPL_ARGUMENTS _Tp, _Dist +template +class istream_iterator : public iterator { +# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */ +#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) + typedef char _CharT; + typedef char_traits _Traits; +# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM) + typedef ptrdiff_t _Dist; +# endif +#endif + + typedef istream_iterator< __ISI_TMPL_ARGUMENTS > _Self; +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_istream<_CharT, _Traits> istream_type; + + typedef input_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Dist difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + + istream_iterator() : _M_stream(0), _M_ok(false), _M_read_done(true) {} + istream_iterator(istream_type& __s) : _M_stream(&__s), _M_ok(false), _M_read_done(false) {} + + reference operator*() const { + if (!_M_read_done) { + _M_read(); + } + return _M_value; + } + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + _M_read(); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + _M_read(); + return __tmp; + } + + bool _M_equal(const _Self& __x) const { + if (!_M_read_done) { + _M_read(); + } + if (!__x._M_read_done) { + __x._M_read(); + } + return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); + } + +private: + istream_type* _M_stream; + mutable _Tp _M_value; + mutable bool _M_ok; + mutable bool _M_read_done; + + void _M_read() const { + _STLP_MUTABLE(_Self, _M_ok) = ((_M_stream != 0) && !_M_stream->fail()); + if (_M_ok) { + *_M_stream >> _STLP_MUTABLE(_Self, _M_value); + _STLP_MUTABLE(_Self, _M_ok) = !_M_stream->fail(); + } + _STLP_MUTABLE(_Self, _M_read_done) = true; + } +}; + +#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template > +#else +template +#endif +class ostream_iterator: public iterator { +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) + typedef char _CharT; + typedef char_traits _Traits; + typedef ostream_iterator<_TpP> _Self; +#else + typedef ostream_iterator<_TpP, _CharT, _Traits> _Self; +#endif +public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + + typedef output_iterator_tag iterator_category; + + ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} + ostream_iterator(ostream_type& __s, const _CharT* __c) + : _M_stream(&__s), _M_string(__c) {} + _Self& operator=(const _TpP& __val) { + *_M_stream << __val; + if (_M_string) *_M_stream << _M_string; + return *this; + } + _Self& operator*() { return *this; } + _Self& operator++() { return *this; } + _Self& operator++(int) { return *this; } +private: + ostream_type* _M_stream; + const _CharT* _M_string; +}; + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +# if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +inline output_iterator_tag _STLP_CALL +iterator_category(const ostream_iterator<_TpP>&) { return output_iterator_tag(); } +# else +template +inline output_iterator_tag _STLP_CALL +iterator_category(const ostream_iterator<_TpP, _CharT, _Traits>&) { return output_iterator_tag(); } +# endif +#endif + +_STLP_END_NAMESPACE + +// form-independent definiotion of stream iterators +_STLP_BEGIN_NAMESPACE + +template < __ISI_TMPL_HEADER_ARGUMENTS > +inline bool _STLP_CALL +operator==(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x, + const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y) +{ return __x._M_equal(__y); } + +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) +template < __ISI_TMPL_HEADER_ARGUMENTS > +inline bool _STLP_CALL +operator!=(const istream_iterator< __ISI_TMPL_ARGUMENTS >& __x, + const istream_iterator< __ISI_TMPL_ARGUMENTS >& __y) +{ return !__x._M_equal(__y); } +#endif + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +template < __ISI_TMPL_HEADER_ARGUMENTS > +inline input_iterator_tag _STLP_CALL +iterator_category(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) +{ return input_iterator_tag(); } +template < __ISI_TMPL_HEADER_ARGUMENTS > +inline _Tp* _STLP_CALL +value_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Tp*) 0; } + +# if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_DEFAULT_TYPE_PARAM) +template < __ISI_TMPL_HEADER_ARGUMENTS > +inline ptrdiff_t* _STLP_CALL +distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (ptrdiff_t*)0; } +# else +template < __ISI_TMPL_HEADER_ARGUMENTS > +inline _Dist* _STLP_CALL +distance_type(const istream_iterator< __ISI_TMPL_ARGUMENTS >&) { return (_Dist*)0; } +# endif /* _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS */ +#endif + +_STLP_END_NAMESPACE + +#undef __ISI_TMPL_HEADER_ARGUMENTS +#undef __ISI_TMPL_ARGUMENTS + +#endif /* _STLP_INTERNAL_STREAM_ITERATOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_streambuf.c b/sdk/tlibstdcxx/stlport/stl/_streambuf.c new file mode 100644 index 0000000000..bd61a204fa --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_streambuf.c @@ -0,0 +1,208 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_STREAMBUF_C +#define _STLP_STREAMBUF_C + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +_STLP_BEGIN_NAMESPACE +//---------------------------------------------------------------------- +// Non-inline basic_streambuf<> member functions. + +#if !defined (_STLP_MSVC) || (_STLP_MSVC >= 1300) || !defined (_STLP_USE_STATIC_LIB) +template +basic_streambuf<_CharT, _Traits>::basic_streambuf() + : _M_gbegin(0), _M_gnext(0), _M_gend(0), + _M_pbegin(0), _M_pnext(0), _M_pend(0), + _M_locale() { + // _M_lock._M_initialize(); +} +#endif + +template +basic_streambuf<_CharT, _Traits>::~basic_streambuf() +{} + +template +locale +basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc) { + this->imbue(__loc); + locale __tmp = _M_locale; + _M_locale = __loc; + return __tmp; +} + +template +streamsize +basic_streambuf<_CharT, _Traits>::xsgetn(_CharT* __s, streamsize __n) { + streamsize __result = 0; + const int_type __eof = _Traits::eof(); + + while (__result < __n) { + if (_M_gnext < _M_gend) { + size_t __chunk = (min) (__STATIC_CAST(size_t,_M_gend - _M_gnext), + __STATIC_CAST(size_t,__n - __result)); + _Traits::copy(__s, _M_gnext, __chunk); + __result += __chunk; + __s += __chunk; + _M_gnext += __chunk; + } + else { + int_type __c = this->sbumpc(); + if (!_Traits::eq_int_type(__c, __eof)) { + *__s = _Traits::to_char_type(__c); + ++__result; + ++__s; + } + else + break; + } + } + + return __result; +} + +template +streamsize +basic_streambuf<_CharT, _Traits>::xsputn(const _CharT* __s, streamsize __n) +{ + streamsize __result = 0; + const int_type __eof = _Traits::eof(); + + while (__result < __n) { + if (_M_pnext < _M_pend) { + size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), + __STATIC_CAST(size_t,__n - __result)); + _Traits::copy(_M_pnext, __s, __chunk); + __result += __chunk; + __s += __chunk; + _M_pnext += __chunk; + } + + else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(*__s)), + __eof)) { + ++__result; + ++__s; + } + else + break; + } + return __result; +} + +template +streamsize +basic_streambuf<_CharT, _Traits>::_M_xsputnc(_CharT __c, streamsize __n) +{ + streamsize __result = 0; + const int_type __eof = _Traits::eof(); + + while (__result < __n) { + if (_M_pnext < _M_pend) { + size_t __chunk = (min) (__STATIC_CAST(size_t,_M_pend - _M_pnext), + __STATIC_CAST(size_t,__n - __result)); + _Traits::assign(_M_pnext, __chunk, __c); + __result += __chunk; + _M_pnext += __chunk; + } + + else if (!_Traits::eq_int_type(this->overflow(_Traits::to_int_type(__c)), + __eof)) + ++__result; + else + break; + } + return __result; +} + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type +basic_streambuf<_CharT, _Traits>::_M_snextc_aux() +{ + int_type __eof = _Traits::eof(); + if (_M_gend == _M_gnext) + return _Traits::eq_int_type(this->uflow(), __eof) ? __eof : this->sgetc(); + else { + _M_gnext = _M_gend; + return this->underflow(); + } +} + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type +basic_streambuf<_CharT, _Traits>::pbackfail(int_type) { + return _Traits::eof(); +} + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type +basic_streambuf<_CharT, _Traits>::overflow(int_type) { + return _Traits::eof(); +} + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type +basic_streambuf<_CharT, _Traits>::uflow() { + return ( _Traits::eq_int_type(this->underflow(),_Traits::eof()) ? + _Traits::eof() : + _Traits::to_int_type(*_M_gnext++)); +} + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::int_type +basic_streambuf<_CharT, _Traits>::underflow() +{ return _Traits::eof(); } + +template +streamsize +basic_streambuf<_CharT, _Traits>::showmanyc() +{ return 0; } + +template +void +basic_streambuf<_CharT, _Traits>::imbue(const locale&) {} + +template +int +basic_streambuf<_CharT, _Traits>::sync() { return 0; } + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type +basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) +{ return pos_type(-1); } + +template +_STLP_TYPENAME_ON_RETURN_TYPE basic_streambuf<_CharT, _Traits>::pos_type +basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, + ios_base::openmode) +{ return pos_type(-1); } + +template +basic_streambuf<_CharT, _Traits>* +basic_streambuf<_CharT, _Traits>:: setbuf(char_type*, streamsize) +{ return this; } + +_STLP_END_NAMESPACE + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_streambuf.h b/sdk/tlibstdcxx/stlport/stl/_streambuf.h new file mode 100644 index 0000000000..e336b0f53f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_streambuf.h @@ -0,0 +1,287 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_STREAMBUF +#define _STLP_INTERNAL_STREAMBUF + +#ifndef _STLP_IOS_BASE_H +# include // Needed for ios_base bitfield members. +#endif // includes . + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Class basic_streambuf<>, the base class of the streambuf hierarchy. + +// A basic_streambuf<> manages an input (get) area and an output (put) +// area. Each is described by three pointers: a beginning, an end, and a +// current position. basic_streambuf<> contains some very simple member +// functions that manipulate those six pointers, but almost all of the real +// functionality gets delegated to protected virtual member functions. +// All of the public member functions are inline, and most of the protected +// member functions are virtual. + +// Although basic_streambuf<> is not abstract, it is useful only as a base +// class. Its virtual member functions have default definitions such that +// reading from a basic_streambuf<> will always yield EOF, and writing to a +// basic_streambuf<> will always fail. + +// The second template parameter, _Traits, defaults to char_traits<_CharT>. +// The default is declared in header , and it isn't declared here +// because C++ language rules do not allow it to be declared twice. + +template +class basic_streambuf { + friend class basic_istream<_CharT, _Traits>; + friend class basic_ostream<_CharT, _Traits>; + +public: // Typedefs. + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + +private: // Data members. + + char_type* _M_gbegin; // Beginning of get area + char_type* _M_gnext; // Current position within the get area + char_type* _M_gend; // End of get area + + char_type* _M_pbegin; // Beginning of put area + char_type* _M_pnext; // Current position within the put area + char_type* _M_pend; // End of put area + + locale _M_locale; // The streambuf's locale object + +public: // Destructor. + virtual ~basic_streambuf(); + +protected: // The default constructor. + basic_streambuf() +#if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && defined (_STLP_USE_STATIC_LIB) + //We make it inline to avoid unresolved symbol. + : _M_gbegin(0), _M_gnext(0), _M_gend(0), + _M_pbegin(0), _M_pnext(0), _M_pend(0), + _M_locale() + {} +#else + ; +#endif + +protected: // Protected interface to the get area. + char_type* eback() const { return _M_gbegin; } // Beginning + char_type* gptr() const { return _M_gnext; } // Current position + char_type* egptr() const { return _M_gend; } // End + + void gbump(int __n) { _M_gnext += __n; } + void setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) { + _M_gbegin = __gbegin; + _M_gnext = __gnext; + _M_gend = __gend; + } + +public: + // An alternate public interface to the above functions + // which allows us to avoid using templated friends which + // are not supported on some compilers. + char_type* _M_eback() const { return eback(); } + char_type* _M_gptr() const { return gptr(); } + char_type* _M_egptr() const { return egptr(); } + void _M_gbump(int __n) { gbump(__n); } + void _M_setg(char_type* __gbegin, char_type* __gnext, char_type* __gend) + { this->setg(__gbegin, __gnext, __gend); } + +protected: // Protected interface to the put area + + char_type* pbase() const { return _M_pbegin; } // Beginning + char_type* pptr() const { return _M_pnext; } // Current position + char_type* epptr() const { return _M_pend; } // End + + void pbump(int __n) { _M_pnext += __n; } + void setp(char_type* __pbegin, char_type* __pend) { + _M_pbegin = __pbegin; + _M_pnext = __pbegin; + _M_pend = __pend; + } + +protected: // Virtual buffer management functions. + + virtual basic_streambuf<_CharT, _Traits>* setbuf(char_type*, streamsize); + + // Alters the stream position, using an integer offset. In this + // class seekoff does nothing; subclasses are expected to override it. + virtual pos_type seekoff(off_type, ios_base::seekdir, + ios_base::openmode = ios_base::in | ios_base::out); + + // Alters the stream position, using a previously obtained streampos. In + // this class seekpos does nothing; subclasses are expected to override it. + virtual pos_type + seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out); + + // Synchronizes (i.e. flushes) the buffer. All subclasses are expected to + // override this virtual member function. + virtual int sync(); + + +public: // Buffer management. + basic_streambuf<_CharT, _Traits>* pubsetbuf(char_type* __s, streamsize __n) + { return this->setbuf(__s, __n); } + + pos_type pubseekoff(off_type __offset, ios_base::seekdir __way, + ios_base::openmode __mod = ios_base::in | ios_base::out) + { return this->seekoff(__offset, __way, __mod); } + + pos_type pubseekpos(pos_type __sp, + ios_base::openmode __mod = ios_base::in | ios_base::out) + { return this->seekpos(__sp, __mod); } + + int pubsync() { return this->sync(); } + +protected: // Virtual get area functions, as defined in + // 17.5.2.4.3 and 17.5.2.4.4 of the standard. + // Returns a lower bound on the number of characters that we can read, + // with underflow, before reaching end of file. (-1 is a special value: + // it means that underflow will fail.) Most subclasses should probably + // override this virtual member function. + virtual streamsize showmanyc(); + + // Reads up to __n characters. Return value is the number of + // characters read. + virtual streamsize xsgetn(char_type* __s, streamsize __n); + + // Called when there is no read position, i.e. when gptr() is null + // or when gptr() >= egptr(). Subclasses are expected to override + // this virtual member function. + virtual int_type underflow(); + + // Similar to underflow(), but used for unbuffered input. Most + // subclasses should probably override this virtual member function. + virtual int_type uflow(); + + // Called when there is no putback position, i.e. when gptr() is null + // or when gptr() == eback(). All subclasses are expected to override + // this virtual member function. + virtual int_type pbackfail(int_type = traits_type::eof()); + +protected: // Virtual put area functions, as defined in + // 27.5.2.4.5 of the standard. + + // Writes up to __n characters. Return value is the number of characters + // written. + virtual streamsize xsputn(const char_type* __s, streamsize __n); + + // Extension: writes up to __n copies of __c. Return value is the number + // of characters written. + virtual streamsize _M_xsputnc(char_type __c, streamsize __n); + + // Called when there is no write position. All subclasses are expected to + // override this virtual member function. + virtual int_type overflow(int_type = traits_type::eof()); + +public: // Public members for writing characters. + // Write a single character. + int_type sputc(char_type __c) { + return ((_M_pnext < _M_pend) ? _Traits::to_int_type(*_M_pnext++ = __c) + : this->overflow(_Traits::to_int_type(__c))); + } + + // Write __n characters. + streamsize sputn(const char_type* __s, streamsize __n) + { return this->xsputn(__s, __n); } + + // Extension: write __n copies of __c. + streamsize _M_sputnc(char_type __c, streamsize __n) + { return this->_M_xsputnc(__c, __n); } + +private: // Helper functions. + int_type _M_snextc_aux(); + +public: // Public members for reading characters. + streamsize in_avail() { + return (_M_gnext < _M_gend) ? (_M_gend - _M_gnext) : this->showmanyc(); + } + + // Advance to the next character and return it. + int_type snextc() { + return ( _M_gend - _M_gnext > 1 ? + _Traits::to_int_type(*++_M_gnext) : + this->_M_snextc_aux()); + } + + // Return the current character and advance to the next. + int_type sbumpc() { + return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext++) + : this->uflow(); + } + + // Return the current character without advancing to the next. + int_type sgetc() { + return _M_gnext < _M_gend ? _Traits::to_int_type(*_M_gnext) + : this->underflow(); + } + + streamsize sgetn(char_type* __s, streamsize __n) + { return this->xsgetn(__s, __n); } + + int_type sputbackc(char_type __c) { + return ((_M_gbegin < _M_gnext) && _Traits::eq(__c, *(_M_gnext - 1))) + ? _Traits::to_int_type(*--_M_gnext) + : this->pbackfail(_Traits::to_int_type(__c)); + } + + int_type sungetc() { + return (_M_gbegin < _M_gnext) + ? _Traits::to_int_type(*--_M_gnext) + : this->pbackfail(); + } + +protected: // Virtual locale functions. + + // This is a hook, called by pubimbue() just before pubimbue() + // sets the streambuf's locale to __loc. Note that imbue should + // not (and cannot, since it has no access to streambuf's private + // members) set the streambuf's locale itself. + virtual void imbue(const locale&); + +public: // Locale-related functions. + locale pubimbue(const locale&); + locale getloc() const { return _M_locale; } + +#if !defined (_STLP_NO_ANACHRONISMS) + void stossc() { this->sbumpc(); } +#endif +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf >; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_streambuf >; +# endif // _STLP_NO_WCHAR_T +#endif // _STLP_USE_TEMPLATE_EXPORT + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_string.c b/sdk/tlibstdcxx/stlport/stl/_string.c new file mode 100644 index 0000000000..3c247f464b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string.c @@ -0,0 +1,674 @@ +/* + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +#ifndef _STLP_STRING_C +#define _STLP_STRING_C + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +#ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_H +# include +#endif + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define basic_string _STLP_NO_MEM_T_NAME(str) +#elif defined (_STLP_DEBUG) +# define basic_string _STLP_NON_DBG_NAME(str) +#endif + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# define __size_type__ size_t +# define size_type size_t +# define iterator _CharT* +#else +# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// A helper class to use a char_traits as a function object. +template +struct _Not_within_traits : public unary_function { + typedef typename _Traits::char_type _CharT; + const _CharT* _M_first; + const _CharT* _M_last; + + _Not_within_traits(const _CharT* __f, const _CharT* __l) + : _M_first(__f), _M_last(__l) {} + + bool operator()(const _CharT& __x) const { + return find_if(_M_first, _M_last, + _STLP_PRIV _Eq_char_bound<_Traits>(__x)) == _M_last; + } +}; + +template +inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits*, const __true_type& /* _STLportTraits */) +{ return __find_first_of(__first1, __last1, __first2, __last2); } + +template +inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits*, const __false_type& /* _STLportTraits */) +{ return __find_first_of(__first1, __last1, __first2, __last2, _STLP_PRIV _Eq_traits<_Traits>()); } + +template +inline _InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits* __traits) { +#if !defined (__BORLANDC__) + typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits; +#else + enum { _Is = _IsSTLportClass<_Traits>::_Is }; + typedef typename __bool2type<_Is>::_Ret _STLportTraits; +#endif + return __str_find_first_of_aux(__first1, __last1, __first2, __last2, __traits, _STLportTraits()); +} + +template +inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits* /* __traits */, const __true_type& __useStrcspnLikeAlgo) +{ return __find_first_of_aux2(__first1, __last1, __first2, __last2, __first2, not1(_Identity()), __useStrcspnLikeAlgo); } + +template +inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits* /* __traits */, const __false_type& /* _UseStrcspnLikeAlgo */) +{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); } + +template +inline _InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Tp* __pt, _Traits* __traits) { + typedef typename _IsIntegral<_Tp>::_Ret _IsIntegral; + typedef typename _IsCharLikeType<_CharT>::_Ret _IsCharLike; + typedef typename _Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo; + _STLP_MARK_PARAMETER_AS_UNUSED(__pt); + return __str_find_first_not_of_aux3(__first1, __last1, __first2, __last2, __traits, _UseStrcspnLikeAlgo()); +} + +template +inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits* __traits, const __true_type& /* _STLportTraits */) +{ return __str_find_first_not_of_aux2(__first1, __last1, __first2, __last2, + _STLP_VALUE_TYPE(__first1, _InputIter), __traits); } + +template +inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits*, const __false_type& /* _STLportTraits */) +{ return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); } + +template +inline _InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1, + const _CharT* __first2, const _CharT* __last2, + _Traits* __traits) { +#if !defined (__BORLANDC__) + typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits; +#else + enum { _Is = _IsSTLportClass<_Traits>::_Is }; + typedef typename __bool2type<_Is>::_Ret _STLportTraits; +#endif + return __str_find_first_not_of_aux1(__first1, __last1, __first2, __last2, __traits, _STLportTraits()); +} + +// ------------------------------------------------------------ +// Non-inline declarations. + +#if !defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +// Change the string's capacity so that it is large enough to hold +// at least __res_arg elements, plus the terminating _CharT(). Note that, +// if __res_arg < capacity(), this member function may actually decrease +// the string's capacity. +template +void basic_string<_CharT,_Traits,_Alloc>::reserve(size_type __res_arg) { + if (__res_arg > max_size()) + this->_M_throw_length_error(); + + size_type __n = (max)(__res_arg, size()) + 1; + if (__n < this->_M_capacity()) + return; + + _M_reserve(__n); +} + +template +void basic_string<_CharT,_Traits,_Alloc>::_M_reserve(size_type __n) { + pointer __new_start = this->_M_start_of_storage.allocate(__n, __n); + pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __n); +} + +template +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc>::append(size_type __n, _CharT __c) { + if (__n > 0) { + if (__n > max_size() - size()) + this->_M_throw_length_error(); + if (__n >= this->_M_rest()) + _M_reserve(_M_compute_next_size(__n)); + _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c); + _M_construct_null(this->_M_finish + __n); + _Traits::assign(*end(), __c); + this->_M_finish += __n; + } + return *this; +} + +template +basic_string<_CharT, _Traits, _Alloc>& +basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) { + if (__first != __last) { + size_type __n = __STATIC_CAST(size_type, __last - __first); + if (__n >= this->_M_rest()) { + size_type __len = _M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start); + __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + else { + const _CharT* __f1 = __first; + ++__f1; + _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1); + _M_construct_null(this->_M_finish + __n); + _Traits::assign(*end(), *__first); + this->_M_finish += __n; + } + } + return *this; +} + +template +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc>::assign(size_type __n, _CharT __c) { + if (__n <= size()) { + _Traits::assign(this->_M_Start(), __n, __c); + erase(begin() + __n, end()); + } + else { + if (__n < capacity()) { + _Traits::assign(this->_M_Start(), size(), __c); + append(__n - size(), __c); + } + else { + _Self __str(__n, __c); + this->swap(__str); + } + } + return *this; +} + +template +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) { + ptrdiff_t __n = __l - __f; + if (__STATIC_CAST(size_type, __n) <= size()) { + _Traits::move(this->_M_Start(), __f, __n); + erase(begin() + __n, end()); + } + else { + _Traits::move(this->_M_Start(), __f, size()); + _M_append(__f + size(), __l); + } + return *this; +} + +template +_CharT* basic_string<_CharT,_Traits,_Alloc> ::_M_insert_aux(_CharT* __p, + _CharT __c) { + pointer __new_pos = __p; + if (this->_M_rest() > 1 ) { + _M_construct_null(this->_M_finish + 1); + _Traits::move(__p + 1, __p, this->_M_finish - __p); + _Traits::assign(*__p, __c); + ++this->_M_finish; + } + else { + size_type __len = _M_compute_next_size(1); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start); + _Traits::assign(*__new_pos, __c); + pointer __new_finish = __new_pos + 1; + __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + return __new_pos; +} + +template +void basic_string<_CharT,_Traits,_Alloc>::insert(iterator __pos, + size_t __n, _CharT __c) { + if (__n != 0) { + if (this->_M_rest() > __n) { + const size_type __elems_after = this->_M_finish - __pos; + pointer __old_finish = this->_M_finish; + if (__elems_after >= __n) { + _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1); + this->_M_finish += __n; + _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); + _Traits::assign(__pos, __n, __c); + } + else { + _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c); + this->_M_finish += __n - __elems_after; + _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish); + this->_M_finish += __elems_after; + _Traits::assign(__pos, __elems_after + 1, __c); + } + } + else { + size_type __len = _M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start); + __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c); + __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + } +} + +template +void basic_string<_CharT,_Traits,_Alloc>::_M_insert(iterator __pos, + const _CharT* __first, const _CharT* __last, + bool __self_ref) { + //this version has to take care about the auto referencing + if (__first != __last) { + const size_t __n = __last - __first; + if (this->_M_rest() > __n) { + const size_t __elems_after = this->_M_finish - __pos; + pointer __old_finish = this->_M_finish; + if (__elems_after >= __n) { + _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1); + this->_M_finish += __n; + _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); + if (!__self_ref || __last < __pos) { + _M_copy(__first, __last, __pos); + } + else { + //We have to check that the source buffer hasn't move + if (__first >= __pos) { + //The source buffer has move + __first += __n; + __last += __n; + _M_copy(__first, __last, __pos); + } + else { + //The source buffer hasn't move, it has been duplicated + _M_move(__first, __last, __pos); + } + } + } + else { + const_iterator __mid = __first; + __mid += __elems_after + 1; + _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1); + this->_M_finish += __n - __elems_after; + _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish); + this->_M_finish += __elems_after; + if (!__self_ref) + _M_copy(__first, __mid, __pos); + else + _M_move(__first, __mid, __pos); + } + } + else { + size_type __len = _M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start); + __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish); + __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + } +} + +template +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc> ::replace(iterator __first, iterator __last, + size_type __n, _CharT __c) { + size_type __len = (size_type)(__last - __first); + + if (__len >= __n) { + _Traits::assign(__first, __n, __c); + erase(__first + __n, __last); + } + else { + _Traits::assign(__first, __len, __c); + insert(__last, __n - __len, __c); + } + return *this; +} + +template +basic_string<_CharT,_Traits,_Alloc>& +basic_string<_CharT,_Traits,_Alloc> ::_M_replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l, + bool __self_ref) { + const ptrdiff_t __n = __l - __f; + const difference_type __len = __last - __first; + if (__len >= __n) { + if (!__self_ref || __l < __first || __f >= __last) + _M_copy(__f, __l, __first); + else + _M_move(__f, __l, __first); + erase(__first + __n, __last); + } else if (!__self_ref || (__f >= __last) || (__l <= __first)) { // no overlap + const_iterator __m = __f + __len; + _M_copy(__f, __m, __first); + _M_insert(__last, __m, __l, __self_ref ); + } else if (__f < __first) { // we have to take care of overlaping + const_iterator __m = __f + __len; + // We have to deal with possible reallocation because we do insert first. + const difference_type __off_dest = __first - this->begin(); + const difference_type __off_src = __f - this->begin(); + _M_insert(__last, __m, __l, true); + _Traits::move(begin() + __off_dest, begin() + __off_src, __len); + } else { + const_iterator __m = __f + __len; + _Traits::move(__first, __f, __len); + _M_insert(__last, __m, __l, true); + } + return *this; +} + +template +__size_type__ basic_string<_CharT,_Traits,_Alloc>::find( const _CharT* __s, size_type __pos, + size_type __n) const +{ + const size_t __len = size(); + if (__pos >= __len || __pos + __n > __len) { + if ( __n == 0 && __pos <= __len ) { // marginal case + return __pos; + } + return npos; + } + + const_pointer __result = + _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(), + __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>()); + return __result != this->_M_Finish() ? __result - this->_M_Start() : npos; +} + +template +__size_type__ basic_string<_CharT,_Traits,_Alloc>::find(_CharT __c, size_type __pos) const +{ + if (__pos >= size()) { /*__pos + 1 > size()*/ + return npos; + } + + const_pointer __result = + _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(), + _STLP_PRIV _Eq_char_bound<_Traits>(__c)); + return __result != this->_M_Finish() ? __result - this->_M_Start() : npos; +} + +template +__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(const _CharT* __s, size_type __pos, + size_type __n) const +{ + const size_type __len = size(); + if ( __len < __n ) { + return npos; + } + const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n; + if ( __n == 0 ) { // marginal case + return __last - this->_M_Start(); + } + const_pointer __result = _STLP_STD::find_end(this->_M_Start(), __last, + __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>()); + return __result != __last ? __result - this->_M_Start() : npos; +} + +template +__size_type__ basic_string<_CharT,_Traits,_Alloc>::rfind(_CharT __c, size_type __pos) const +{ + const size_type __len = size(); + if ( __len < 1 ) { + return npos; + } + const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; + const_reverse_iterator __rresult = + _STLP_STD::find_if(const_reverse_iterator(__last), rend(), + _STLP_PRIV _Eq_char_bound<_Traits>(__c)); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; +} + +template __size_type__ +basic_string<_CharT,_Traits,_Alloc> ::find_first_of(const _CharT* __s, size_type __pos, + size_type __n) const { + if (__pos >= size()) /*__pos + 1 > size()*/ + return npos; + else { + const_iterator __result = _STLP_PRIV __str_find_first_of(begin() + __pos, end(), + __s, __s + __n, + __STATIC_CAST(_Traits*, 0)); + return __result != end() ? __result - begin() : npos; + } +} + +template + __size_type__ +basic_string<_CharT,_Traits,_Alloc> ::find_last_of(const _CharT* __s, size_type __pos, + size_type __n) const +{ + const size_type __len = size(); + if ( __len < 1 ) { + return npos; + } + const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; + const const_reverse_iterator __rresult = + _STLP_PRIV __str_find_first_of(const_reverse_iterator(__last), rend(), + __s, __s + __n, + __STATIC_CAST(_Traits*, 0)); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; +} + + +template __size_type__ +basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(const _CharT* __s, size_type __pos, + size_type __n) const { + typedef typename _Traits::char_type _CharType; + if (__pos >= size()) /*__pos + 1 >= size()*/ + return npos; + else { + const_pointer __result = _STLP_PRIV __str_find_first_not_of(this->_M_Start() + __pos, this->_M_Finish(), + __STATIC_CAST(const _CharType*, __s), + __STATIC_CAST(const _CharType*, __s) + __n, + __STATIC_CAST(_Traits*, 0)); + return __result != this->_M_finish ? __result - this->_M_Start() : npos; + } +} + +template __size_type__ +basic_string<_CharT,_Traits,_Alloc> ::find_first_not_of(_CharT __c, size_type __pos) const { + if (1 > size()) + return npos; + else { + const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(), + _STLP_PRIV _Neq_char_bound<_Traits>(__c)); + return __result != this->_M_finish ? __result - this->_M_Start() : npos; + } +} + +template +__size_type__ +basic_string<_CharT,_Traits,_Alloc>::find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const +{ + typedef typename _Traits::char_type _CharType; + const size_type __len = size(); + if ( __len < 1 ) { + return npos; + } + const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; + const_reverse_iterator __rlast = const_reverse_iterator(__last); + const_reverse_iterator __rresult = + _STLP_PRIV __str_find_first_not_of(__rlast, rend(), + __STATIC_CAST(const _CharType*, __s), + __STATIC_CAST(const _CharType*, __s) + __n, + __STATIC_CAST(_Traits*, 0)); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; +} + +template +__size_type__ +basic_string<_CharT, _Traits, _Alloc>::find_last_not_of(_CharT __c, size_type __pos) const +{ + const size_type __len = size(); + if ( __len < 1 ) { + return npos; + } + const_iterator __last = begin() + (min)(__len - 1, __pos) + 1; + const_reverse_iterator __rlast = const_reverse_iterator(__last); + const_reverse_iterator __rresult = + _STLP_STD::find_if(__rlast, rend(), + _STLP_PRIV _Neq_char_bound<_Traits>(__c)); + return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos; +} + +#if !defined (basic_string) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template +void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT* __buf, size_t __n) { + if (__n > 0) { + __n = (min) (__n - 1, __s.size()); + _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf); + __buf[__n] = _CharT(); + } +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#include + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// _String_base methods +template +void _String_base<_Tp,_Alloc>::_M_throw_length_error() const +{ __stl_throw_length_error("basic_string"); } + +template +void _String_base<_Tp, _Alloc>::_M_throw_out_of_range() const +{ __stl_throw_out_of_range("basic_string"); } + +template +void _String_base<_Tp, _Alloc>::_M_allocate_block(size_t __n) { + if ((__n <= (max_size() + 1)) && (__n > 0)) { +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + if (__n > _DEFAULT_SIZE) { + this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n); + this->_M_finish = this->_M_start_of_storage._M_data; + this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data + __n; + } +#else + this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n); + this->_M_finish = this->_M_start_of_storage._M_data; + this->_M_end_of_storage = this->_M_start_of_storage._M_data + __n; +#endif + } else { + this->_M_throw_length_error(); + } +} + +#if !defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) +template +basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { + _STLP_FIX_LITERAL_BUG(__s) + _M_range_initialize(__s, __s + traits_type::length(__s)); +} +#endif + +template +basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT* __s, + const allocator_type& __a) + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { + _STLP_FIX_LITERAL_BUG(__s) + _M_range_initialize(__s, __s + traits_type::length(__s)); +} + +template +basic_string<_CharT, _Traits, _Alloc>::basic_string(const basic_string<_CharT, _Traits, _Alloc> & __s) + : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator()) +{ _M_range_initialize(__s._M_Start(), __s._M_Finish()); } + +#if defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +# undef basic_string +#endif + +#if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION) +template +const size_t basic_string<_CharT, _Traits, _Alloc>::npos; +#endif + +_STLP_END_NAMESPACE + +#undef __size_type__ +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# undef size_type +# undef iterator +#endif + +#endif /* _STLP_STRING_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_string.h b/sdk/tlibstdcxx/stlport/stl/_string.h new file mode 100644 index 0000000000..540822b3c1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string.h @@ -0,0 +1,1182 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_STRING_H +#define _STLP_INTERNAL_STRING_H + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_STRING_FWD_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_UNINITIALIZED_H +# include +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +# include +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +#if defined (__MWERKS__) && ! defined (_STLP_USE_OWN_NAMESPACE) + +// MSL implementation classes expect to see the definition of streampos +// when this header is included. We expect this to be fixed in later MSL +// implementations +# if !defined( __MSL_CPP__ ) || __MSL_CPP__ < 0x4105 +# include +# endif +#endif // __MWERKS__ + +/* + * Standard C++ string class. This class has performance + * characteristics very much like vector<>, meaning, for example, that + * it does not perform reference-count or copy-on-write, and that + * concatenation of two strings is an O(N) operation. + + * There are three reasons why basic_string is not identical to + * vector. + * First, basic_string always stores a null character at the end; + * this makes it possible for c_str to be a fast operation. + * Second, the C++ standard requires basic_string to copy elements + * using char_traits<>::assign, char_traits<>::copy, and + * char_traits<>::move. This means that all of vector<>'s low-level + * operations must be rewritten. Third, basic_string<> has a lot of + * extra functions in its interface that are convenient but, strictly + * speaking, redundant. + */ + +#include + +_STLP_BEGIN_NAMESPACE + +// ------------------------------------------------------------ +// Class basic_string. + +// Class invariants: +// (1) [start, finish) is a valid range. +// (2) Each iterator in [start, finish) points to a valid object +// of type value_type. +// (3) *finish is a valid object of type value_type; when +// value_type is not a POD it is value_type(). +// (4) [finish + 1, end_of_storage) is a valid range. +// (5) Each iterator in [finish + 1, end_of_storage) points to +// unininitialized memory. + +// Note one important consequence: a string of length n must manage +// a block of memory whose size is at least n + 1. + +_STLP_MOVE_TO_PRIV_NAMESPACE +struct _String_reserve_t {}; +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define basic_string _STLP_NO_MEM_T_NAME(str) +#elif defined (_STLP_DEBUG) +# define basic_string _STLP_NON_DBG_NAME(str) +#endif + +#if defined (basic_string) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +#if defined (__DMC__) +# define _STLP_PRIVATE public +#elif defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define _STLP_PRIVATE protected +#else +# define _STLP_PRIVATE private +#endif + +template +class basic_string : _STLP_PRIVATE _STLP_PRIV _String_base<_CharT,_Alloc> +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string) + , public __stlport_class > +#endif +{ +_STLP_PRIVATE: // Private members inherited from base. + typedef _STLP_PRIV _String_base<_CharT,_Alloc> _Base; + typedef basic_string<_CharT, _Traits, _Alloc> _Self; + +public: + typedef _CharT value_type; + typedef _Traits traits_type; + + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef typename _Base::size_type size_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag _Iterator_category; + + typedef const value_type* const_iterator; + typedef value_type* iterator; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +#include + + typedef _STLP_PRIV _String_reserve_t _Reserve_t; + +public: // Constructor, destructor, assignment. + typedef typename _Base::allocator_type allocator_type; + + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_start_of_storage, _CharT); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit basic_string(const allocator_type& __a = allocator_type()) +#else + basic_string() + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), _Base::_DEFAULT_SIZE) + { _M_terminate_string(); } + explicit basic_string(const allocator_type& __a) +#endif + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, _Base::_DEFAULT_SIZE) + { _M_terminate_string(); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + basic_string(_Reserve_t, size_t __n, + const allocator_type& __a = allocator_type()) +#else + basic_string(_Reserve_t, size_t __n) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) + { _M_terminate_string(); } + basic_string(_Reserve_t, size_t __n, const allocator_type& __a) +#endif + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) + { _M_terminate_string(); } + + basic_string(const _Self&); + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + basic_string(const _Self& __s, size_type __pos, size_type __n = npos, + const allocator_type& __a = allocator_type()) +#else + basic_string(const _Self& __s, size_type __pos) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { + if (__pos > __s.size()) + this->_M_throw_out_of_range(); + else + _M_range_initialize(__s._M_Start() + __pos, __s._M_Finish()); + } + basic_string(const _Self& __s, size_type __pos, size_type __n) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { + if (__pos > __s.size()) + this->_M_throw_out_of_range(); + else + _M_range_initialize(__s._M_Start() + __pos, + __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); + } + basic_string(const _Self& __s, size_type __pos, size_type __n, + const allocator_type& __a) +#endif + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { + if (__pos > __s.size()) + this->_M_throw_out_of_range(); + else + _M_range_initialize(__s._M_Start() + __pos, + __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); + } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + basic_string(const _CharT* __s, size_type __n, + const allocator_type& __a = allocator_type()) +#else + basic_string(const _CharT* __s, size_type __n) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { + _STLP_FIX_LITERAL_BUG(__s) + _M_range_initialize(__s, __s + __n); + } + basic_string(const _CharT* __s, size_type __n, const allocator_type& __a) +#endif + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { + _STLP_FIX_LITERAL_BUG(__s) + _M_range_initialize(__s, __s + __n); + } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + basic_string(const _CharT* __s, + const allocator_type& __a = allocator_type()); +#else + basic_string(const _CharT* __s); + basic_string(const _CharT* __s, const allocator_type& __a); +#endif + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + basic_string(size_type __n, _CharT __c, + const allocator_type& __a = allocator_type()) +#else + basic_string(size_type __n, _CharT __c) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type(), __n + 1) { + this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c); + _M_terminate_string(); + } + basic_string(size_type __n, _CharT __c, const allocator_type& __a) +#endif + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a, __n + 1) { + this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __c); + _M_terminate_string(); + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + basic_string(__move_source<_Self> src) + : _STLP_PRIV _String_base<_CharT,_Alloc>(__move_source<_Base>(src.get())) {} +#endif + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + basic_string(_InputIterator __f, _InputIterator __l, + const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__f, __l, _Integral()); + } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + basic_string(_InputIterator __f, _InputIterator __l) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__f, __l, _Integral()); + } +# endif +#else +# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + basic_string(const _CharT* __f, const _CharT* __l, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _M_range_initialize(__f, __l); + } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + basic_string(const _CharT* __f, const _CharT* __l) + : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _M_range_initialize(__f, __l); + } +# endif +# endif +# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + /* We need an additionnal constructor to build an empty string without + * any allocation or termination char*/ +protected: + struct _CalledFromWorkaround_t {}; + basic_string(_CalledFromWorkaround_t, const allocator_type &__a) + : _String_base<_CharT,_Alloc>(__a) {} +# endif +#endif + +_STLP_PRIVATE: + size_type _M_compute_next_size(size_type __n) { + const size_type __size = size(); + if (__n > max_size() - __size) + this->_M_throw_length_error(); + size_type __len = __size + (max)(__n, __size) + 1; + if (__len > max_size() || __len < __size) + __len = max_size(); // overflow + return __len; + } + + template + void _M_range_initialize(_InputIter __f, _InputIter __l, + const input_iterator_tag &__tag) { + this->_M_allocate_block(); + _M_construct_null(this->_M_Finish()); + _M_appendT(__f, __l, __tag); + } + + template + void _M_range_initialize(_ForwardIter __f, _ForwardIter __l, + const forward_iterator_tag &) { + difference_type __n = _STLP_STD::distance(__f, __l); + this->_M_allocate_block(__n + 1); + this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start()); + this->_M_terminate_string(); + } + + template + void _M_range_initializeT(_InputIter __f, _InputIter __l) { + _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); + } + + template + void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) { + this->_M_allocate_block(__n + 1); + this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_Start(), __n, __x); + this->_M_terminate_string(); + } + + template + void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { + _M_range_initializeT(__f, __l); + } + +public: + _Self& operator=(const _Self& __s) { + if (&__s != this) + _M_assign(__s._M_Start(), __s._M_Finish()); + return *this; + } + + _Self& operator=(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return _M_assign(__s, __s + traits_type::length(__s)); + } + + _Self& operator=(_CharT __c) + { return assign(__STATIC_CAST(size_type,1), __c); } + +private: + static _CharT _STLP_CALL _M_null() + { return _STLP_DEFAULT_CONSTRUCTED(_CharT); } + +_STLP_PRIVATE: // Helper functions used by constructors + // and elsewhere. + void _M_construct_null(_CharT* __p) const + { _STLP_STD::_Construct(__p); } + void _M_terminate_string() + { _M_construct_null(this->_M_Finish()); } + bool _M_inside(const _CharT* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + return (__s >= this->_M_Start()) && (__s < this->_M_Finish()); + } + + void _M_range_initialize(const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + ptrdiff_t __n = __l - __f; + this->_M_allocate_block(__n + 1); + this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start()); + _M_terminate_string(); + } + +public: // Iterators. + iterator begin() { return this->_M_Start(); } + iterator end() { return this->_M_Finish(); } + const_iterator begin() const { return this->_M_Start(); } + const_iterator end() const { return this->_M_Finish(); } + + reverse_iterator rbegin() + { return reverse_iterator(this->_M_Finish()); } + reverse_iterator rend() + { return reverse_iterator(this->_M_Start()); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(this->_M_Finish()); } + const_reverse_iterator rend() const + { return const_reverse_iterator(this->_M_Start()); } + +public: // Size, capacity, etc. + size_type size() const { return this->_M_Finish() - this->_M_Start(); } + size_type length() const { return size(); } + size_type max_size() const { return _Base::max_size(); } + + void resize(size_type __n, _CharT __c) { + if (__n <= size()) + erase(begin() + __n, end()); + else + append(__n - size(), __c); + } + + void resize(size_type __n) { resize(__n, _M_null()); } + +private: + void _M_reserve(size_type); +public: + void reserve(size_type = 0); + + size_type capacity() const + { return this->_M_capacity() - 1; } + + void clear() { + if (!empty()) { + _Traits::assign(*(this->_M_Start()), _M_null()); + this->_M_finish = this->_M_Start(); + } + } + + bool empty() const { return this->_M_Start() == this->_M_Finish(); } + +public: // Element access. + + const_reference operator[](size_type __n) const + { return *(this->_M_Start() + __n); } + reference operator[](size_type __n) + { return *(this->_M_Start() + __n); } + + const_reference at(size_type __n) const { + if (__n >= size()) + this->_M_throw_out_of_range(); + return *(this->_M_Start() + __n); + } + + reference at(size_type __n) { + if (__n >= size()) + this->_M_throw_out_of_range(); + return *(this->_M_Start() + __n); + } + +public: // Append, operator+=, push_back. + + _Self& operator+=(const _Self& __s) { return append(__s); } + _Self& operator+=(const _CharT* __s) { _STLP_FIX_LITERAL_BUG(__s) return append(__s); } + _Self& operator+=(_CharT __c) { push_back(__c); return *this; } + +private: + _Self& _M_append(const _CharT* __first, const _CharT* __last); + +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + _Self& _M_appendT(_InputIter __first, _InputIter __last, + const input_iterator_tag &) { + for ( ; __first != __last ; ++__first) + push_back(*__first); + return *this; + } + + template + _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last, + const forward_iterator_tag &) { + if (__first != __last) { + size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last)); + if (__n >= this->_M_rest()) { + size_type __len = _M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + else { + _Traits::assign(*this->_M_finish, *__first++); + uninitialized_copy(__first, __last, this->_M_Finish() + 1); + _M_construct_null(this->_M_Finish() + __n); + this->_M_finish += __n; + } + } + return *this; + } + + template + _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/) + { return append((size_type) __n, (_CharT) __x); } + + template + _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/) + { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); } + +public: + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + _Self& append(_InputIter __first, _InputIter __last) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + return _M_append_dispatch(__first, __last, _Integral()); + } +#else +public: + _Self& append(const _CharT* __first, const _CharT* __last) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + return _M_append(__first, __last); + } +#endif + +public: + _Self& append(const _Self& __s) + { return _M_append(__s._M_Start(), __s._M_Finish()); } + + _Self& append(const _Self& __s, + size_type __pos, size_type __n) { + if (__pos > __s.size()) + this->_M_throw_out_of_range(); + return _M_append(__s._M_Start() + __pos, + __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); + } + + _Self& append(const _CharT* __s, size_type __n) + { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s+__n); } + _Self& append(const _CharT* __s) + { _STLP_FIX_LITERAL_BUG(__s) return _M_append(__s, __s + traits_type::length(__s)); } + _Self& append(size_type __n, _CharT __c); + +public: + void push_back(_CharT __c) { + if (this->_M_rest() == 1 ) + _M_reserve(_M_compute_next_size(1)); + _M_construct_null(this->_M_Finish() + 1); + _Traits::assign(*(this->_M_Finish()), __c); + ++this->_M_finish; + } + + void pop_back() { + _Traits::assign(*(this->_M_Finish() - 1), _M_null()); + --this->_M_finish; + } + +public: // Assign + _Self& assign(const _Self& __s) + { return _M_assign(__s._M_Start(), __s._M_Finish()); } + + _Self& assign(const _Self& __s, + size_type __pos, size_type __n) { + if (__pos > __s.size()) + this->_M_throw_out_of_range(); + return _M_assign(__s._M_Start() + __pos, + __s._M_Start() + __pos + (min) (__n, __s.size() - __pos)); + } + + _Self& assign(const _CharT* __s, size_type __n) + { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + __n); } + + _Self& assign(const _CharT* __s) + { _STLP_FIX_LITERAL_BUG(__s) return _M_assign(__s, __s + _Traits::length(__s)); } + + _Self& assign(size_type __n, _CharT __c); + +private: + _Self& _M_assign(const _CharT* __f, const _CharT* __l); + +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + // Helper functions for assign. + template + _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) + { return assign((size_type) __n, (_CharT) __x); } + + template + _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { + pointer __cur = this->_M_Start(); + while (__f != __l && __cur != this->_M_Finish()) { + _Traits::assign(*__cur, *__f); + ++__f; + ++__cur; + } + if (__f == __l) + erase(__cur, this->end()); + else + _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); + return *this; + } + +public: + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + _Self& assign(_InputIter __first, _InputIter __last) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + return _M_assign_dispatch(__first, __last, _Integral()); + } +#else +public: + _Self& assign(const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + return _M_assign(__f, __l); + } +#endif + +public: // Insert + _Self& insert(size_type __pos, const _Self& __s) { + if (__pos > size()) + this->_M_throw_out_of_range(); + if (__s.size() > max_size() - size()) + this->_M_throw_length_error(); + _M_insert(begin() + __pos, __s._M_Start(), __s._M_Finish(), &__s == this); + return *this; + } + + _Self& insert(size_type __pos, const _Self& __s, + size_type __beg, size_type __n) { + if (__pos > size() || __beg > __s.size()) + this->_M_throw_out_of_range(); + size_type __len = (min) (__n, __s.size() - __beg); + if (__len > max_size() - size()) + this->_M_throw_length_error(); + _M_insert(begin() + __pos, + __s._M_Start() + __beg, __s._M_Start() + __beg + __len, &__s == this); + return *this; + } + _Self& insert(size_type __pos, const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + if (__pos > size()) + this->_M_throw_out_of_range(); + if (__n > max_size() - size()) + this->_M_throw_length_error(); + _M_insert(begin() + __pos, __s, __s + __n, _M_inside(__s)); + return *this; + } + + _Self& insert(size_type __pos, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + if (__pos > size()) + this->_M_throw_out_of_range(); + size_type __len = _Traits::length(__s); + if (__len > max_size() - size()) + this->_M_throw_length_error(); + _M_insert(this->_M_Start() + __pos, __s, __s + __len, _M_inside(__s)); + return *this; + } + + _Self& insert(size_type __pos, size_type __n, _CharT __c) { + if (__pos > size()) + this->_M_throw_out_of_range(); + if (__n > max_size() - size()) + this->_M_throw_length_error(); + insert(begin() + __pos, __n, __c); + return *this; + } + + iterator insert(iterator __p, _CharT __c) { + _STLP_FIX_LITERAL_BUG(__p) + if (__p == end()) { + push_back(__c); + return this->_M_Finish() - 1; + } + else + return _M_insert_aux(__p, __c); + } + + void insert(iterator __p, size_t __n, _CharT __c); + +_STLP_PRIVATE: // Helper functions for insert. + void _M_insert(iterator __p, const _CharT* __first, const _CharT* __last, bool __self_ref); + + pointer _M_insert_aux(pointer, _CharT); + + void _M_copy(const _CharT* __f, const _CharT* __l, _CharT* __res) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _STLP_FIX_LITERAL_BUG(__res) + _Traits::copy(__res, __f, __l - __f); + } + + void _M_move(const _CharT* __f, const _CharT* __l, _CharT* __res) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _Traits::move(__res, __f, __l - __f); + } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last, + size_type __n) { + size_type __len = _M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish); + _M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + + template + void _M_insertT(iterator __p, _InputIter __first, _InputIter __last, + const input_iterator_tag &) { + for ( ; __first != __last; ++__first) { + __p = insert(__p, *__first); + ++__p; + } + } + + template + void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last, + const forward_iterator_tag &) { + if (__first != __last) { + size_type __n = _STLP_STD::distance(__first, __last); + if (__n < this->_M_rest()) { + const size_type __elems_after = this->_M_finish - __pos; + if (__elems_after >= __n) { + uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1); + this->_M_finish += __n; + _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); + _M_copyT(__first, __last, __pos); + } + else { + pointer __old_finish = this->_M_Finish(); + _ForwardIter __mid = __first; + _STLP_STD::advance(__mid, __elems_after + 1); + _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1); + this->_M_finish += __n - __elems_after; + uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish()); + this->_M_finish += __elems_after; + _M_copyT(__first, __mid, __pos); + } + } + else { + _M_insert_overflow(__pos, __first, __last, __n); + } + } + } + + template + void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x, + const __true_type& /*Integral*/) + { insert(__p, (size_type) __n, (_CharT) __x); } + + template + void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last, + const __false_type& /*Integral*/) { + _STLP_FIX_LITERAL_BUG(__p) + /* We are forced to do a temporary string to avoid the self referencing issue. */ + const _Self __self(__first, __last, get_allocator()); + _M_insertT(__p, __self.begin(), __self.end(), forward_iterator_tag()); + } + + template + void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) { + _STLP_FIX_LITERAL_BUG(__result) + for ( ; __first != __last; ++__first, ++__result) + _Traits::assign(*__result, *__first); + } + +# if !defined (_STLP_NO_METHOD_SPECIALIZATION) + void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _STLP_FIX_LITERAL_BUG(__res) + _Traits::copy(__res, __f, __l - __f); + } +# endif +public: + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + void insert(iterator __p, _InputIter __first, _InputIter __last) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + _M_insert_dispatch(__p, __first, __last, _Integral()); + } +# endif +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) +public: + void insert(iterator __p, const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _M_insert(__p, __f, __l, _M_inside(__f)); + } +#endif + +public: // Erase. + _Self& erase(size_type __pos = 0, size_type __n = npos) { + if (__pos > size()) + this->_M_throw_out_of_range(); + erase(begin() + __pos, begin() + __pos + (min) (__n, size() - __pos)); + return *this; + } + + iterator erase(iterator __pos) { + // The move includes the terminating _CharT(). + _Traits::move(__pos, __pos + 1, this->_M_Finish() - __pos); + --this->_M_finish; + return __pos; + } + + iterator erase(iterator __first, iterator __last) { + if (__first != __last) { + // The move includes the terminating _CharT(). + traits_type::move(__first, __last, (this->_M_Finish() - __last) + 1); + this->_M_finish = this->_M_Finish() - (__last - __first); + } + return __first; + } + +public: // Replace. (Conceptually equivalent + // to erase followed by insert.) + _Self& replace(size_type __pos, size_type __n, const _Self& __s) { + const size_type __size = size(); + if (__pos > __size) + this->_M_throw_out_of_range(); + const size_type __len = (min) (__n, __size - __pos); + if (__s.size() > max_size() - (__size - __len)) + this->_M_throw_length_error(); + return _M_replace(begin() + __pos, begin() + __pos + __len, + __s._M_Start(), __s._M_Finish(), &__s == this); + } + + _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, + size_type __pos2, size_type __n2) { + const size_type __size1 = size(); + const size_type __size2 = __s.size(); + if (__pos1 > __size1 || __pos2 > __size2) + this->_M_throw_out_of_range(); + const size_type __len1 = (min) (__n1, __size1 - __pos1); + const size_type __len2 = (min) (__n2, __size2 - __pos2); + if (__len2 > max_size() - (__size1 - __len1)) + this->_M_throw_length_error(); + return _M_replace(begin() + __pos1, begin() + __pos1 + __len1, + __s._M_Start() + __pos2, __s._M_Start() + __pos2 + __len2, &__s == this); + } + + _Self& replace(size_type __pos, size_type __n1, + const _CharT* __s, size_type __n2) { + _STLP_FIX_LITERAL_BUG(__s) + const size_type __size = size(); + if (__pos > __size) + this->_M_throw_out_of_range(); + const size_type __len = (min) (__n1, __size - __pos); + if (__n2 > max_size() - (__size - __len)) + this->_M_throw_length_error(); + return _M_replace(begin() + __pos, begin() + __pos + __len, + __s, __s + __n2, _M_inside(__s)); + } + + _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return replace(__pos, __n1, __s, _Traits::length(__s)); + } + + _Self& replace(size_type __pos, size_type __n1, + size_type __n2, _CharT __c) { + const size_type __size = size(); + if (__pos > __size) + this->_M_throw_out_of_range(); + const size_type __len = (min) (__n1, __size - __pos); + if (__n2 > max_size() - (__size - __len)) + this->_M_throw_length_error(); + return replace(begin() + __pos, begin() + __pos + __len, __n2, __c); + } + + _Self& replace(iterator __first, iterator __last, const _Self& __s) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + return _M_replace(__first, __last, __s._M_Start(), __s._M_Finish(), &__s == this); + } + + _Self& replace(iterator __first, iterator __last, + const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__s) + return _M_replace(__first, __last, __s, __s + __n, _M_inside(__s)); + } + + _Self& replace(iterator __first, iterator __last, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__s) + return _M_replace(__first, __last, __s, __s + _Traits::length(__s), _M_inside(__s)); + } + + _Self& replace(iterator __first, iterator __last, size_type __n, _CharT __c); + +_STLP_PRIVATE: // Helper functions for replace. + _Self& _M_replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l, bool __self_ref); + +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + template + _Self& _M_replace_dispatch(iterator __first, iterator __last, + _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + return replace(__first, __last, (size_type) __n, (_CharT) __x); + } + + template + _Self& _M_replace_dispatch(iterator __first, iterator __last, + _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + /* We are forced to do a temporary string to avoid the self referencing issue. */ + const _Self __self(__f, __l, get_allocator()); + return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false); + } + +public: + // Check to see if _InputIter is an integer type. If so, then + // it can't be an iterator. + template + _Self& replace(iterator __first, iterator __last, + _InputIter __f, _InputIter __l) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + return _M_replace_dispatch(__first, __last, __f, __l, _Integral()); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) +public: + _Self& replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + return _M_replace(__first, __last, __f, __l, _M_inside(__f)); + } +#endif + +public: // Other modifier member functions. + + size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { + _STLP_FIX_LITERAL_BUG(__s) + if (__pos > size()) + this->_M_throw_out_of_range(); + const size_type __len = (min) (__n, size() - __pos); + _Traits::copy(__s, this->_M_Start() + __pos, __len); + return __len; + } + + void swap(_Self& __s) { this->_M_swap(__s); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +public: // Conversion to C string. + + const _CharT* c_str() const { return this->_M_Start(); } + const _CharT* data() const { return this->_M_Start(); } + +public: // find. + size_type find(const _Self& __s, size_type __pos = 0) const + { return find(__s._M_Start(), __pos, __s.size()); } + + size_type find(const _CharT* __s, size_type __pos = 0) const + { _STLP_FIX_LITERAL_BUG(__s) return find(__s, __pos, _Traits::length(__s)); } + + size_type find(const _CharT* __s, size_type __pos, size_type __n) const; + + // WIE: Versant schema compiler 5.2.2 ICE workaround + size_type find(_CharT __c) const { return find(__c, 0); } + size_type find(_CharT __c, size_type __pos /* = 0 */) const; + +public: // rfind. + size_type rfind(const _Self& __s, size_type __pos = npos) const + { return rfind(__s._M_Start(), __pos, __s.size()); } + + size_type rfind(const _CharT* __s, size_type __pos = npos) const + { _STLP_FIX_LITERAL_BUG(__s) return rfind(__s, __pos, _Traits::length(__s)); } + + size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const; + size_type rfind(_CharT __c, size_type __pos = npos) const; + +public: // find_first_of + size_type find_first_of(const _Self& __s, size_type __pos = 0) const + { return find_first_of(__s._M_Start(), __pos, __s.size()); } + + size_type find_first_of(const _CharT* __s, size_type __pos = 0) const + { _STLP_FIX_LITERAL_BUG(__s) return find_first_of(__s, __pos, _Traits::length(__s)); } + + size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const; + + size_type find_first_of(_CharT __c, size_type __pos = 0) const + { return find(__c, __pos); } + +public: // find_last_of + size_type find_last_of(const _Self& __s, size_type __pos = npos) const + { return find_last_of(__s._M_Start(), __pos, __s.size()); } + + size_type find_last_of(const _CharT* __s, size_type __pos = npos) const + { _STLP_FIX_LITERAL_BUG(__s) return find_last_of(__s, __pos, _Traits::length(__s)); } + + size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const; + + size_type find_last_of(_CharT __c, size_type __pos = npos) const + { return rfind(__c, __pos); } + +public: // find_first_not_of + size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const + { return find_first_not_of(__s._M_Start(), __pos, __s.size()); } + + size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const + { _STLP_FIX_LITERAL_BUG(__s) return find_first_not_of(__s, __pos, _Traits::length(__s)); } + + size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const; + + size_type find_first_not_of(_CharT __c, size_type __pos = 0) const; + +public: // find_last_not_of + size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const + { return find_last_not_of(__s._M_Start(), __pos, __s.size()); } + + size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const + { _STLP_FIX_LITERAL_BUG(__s) return find_last_not_of(__s, __pos, _Traits::length(__s)); } + + size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; + + size_type find_last_not_of(_CharT __c, size_type __pos = npos) const; + +public: // Substring. + _Self substr(size_type __pos = 0, size_type __n = npos) const + { return _Self(*this, __pos, __n, get_allocator()); } + +public: // Compare + int compare(const _Self& __s) const + { return _M_compare(this->_M_Start(), this->_M_Finish(), __s._M_Start(), __s._M_Finish()); } + + int compare(size_type __pos1, size_type __n1, const _Self& __s) const { + if (__pos1 > size()) + this->_M_throw_out_of_range(); + return _M_compare(this->_M_Start() + __pos1, + this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), + __s._M_Start(), __s._M_Finish()); + } + + int compare(size_type __pos1, size_type __n1, const _Self& __s, + size_type __pos2, size_type __n2) const { + if (__pos1 > size() || __pos2 > __s.size()) + this->_M_throw_out_of_range(); + return _M_compare(this->_M_Start() + __pos1, + this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), + __s._M_Start() + __pos2, + __s._M_Start() + __pos2 + (min) (__n2, __s.size() - __pos2)); + } + + int compare(const _CharT* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + return _M_compare(this->_M_Start(), this->_M_Finish(), __s, __s + _Traits::length(__s)); + } + + int compare(size_type __pos1, size_type __n1, const _CharT* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + if (__pos1 > size()) + this->_M_throw_out_of_range(); + return _M_compare(this->_M_Start() + __pos1, + this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), + __s, __s + _Traits::length(__s)); + } + + int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const { + _STLP_FIX_LITERAL_BUG(__s) + if (__pos1 > size()) + this->_M_throw_out_of_range(); + return _M_compare(this->_M_Start() + __pos1, + this->_M_Start() + __pos1 + (min) (__n1, size() - __pos1), + __s, __s + __n2); + } + +public: // Helper functions for compare. + static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1, + const _CharT* __f2, const _CharT* __l2) { + const ptrdiff_t __n1 = __l1 - __f1; + const ptrdiff_t __n2 = __l2 - __f2; + const int cmp = _Traits::compare(__f1, __f2, (min) (__n1, __n2)); + return cmp != 0 ? cmp : (__n1 < __n2 ? -1 : (__n1 > __n2 ? 1 : 0)); + } +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# define _STLP_STRING_SUM_BASE(__reserve, __size, __alloc) _STLP_PRIV _String_base<_CharT,_Alloc>(__alloc, __size + 1) +# include +# undef _STLP_STRING_SUM_BASE +#endif +}; + +#undef _STLP_PRIVATE + +#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) +template +const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0; +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +#if defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +# undef basic_string +#endif + +_STLP_END_NAMESPACE + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +# include +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// ------------------------------------------------------------ +// Non-member functions. +// Swap. +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +template +inline void _STLP_CALL +swap(basic_string<_CharT,_Traits,_Alloc>& __x, + basic_string<_CharT,_Traits,_Alloc>& __y) +{ __x.swap(__y); } +#else +inline void _STLP_CALL swap(string& __x, string& __y) +{ __x.swap(__y); } +# if defined (_STLP_HAS_WCHAR_T) +inline void _STLP_CALL swap(wstring& __x, wstring& __y) +{ __x.swap(__y); } +# endif +#endif + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + typedef __true_type implemented; + //Completness depends on the allocator: + typedef typename __move_traits<_Alloc>::complete complete; +}; +/*#else + * There is no need to specialize for string and wstring in this case + * as the default __move_traits will already tell that string is movable + * but not complete. We cannot define it as complete as nothing guaranty + * that the STLport user hasn't specialized std::allocator for char or + * wchar_t. + */ +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void _STLP_CALL _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT* __buf, size_t __n); + +#if defined(_STLP_USE_WIDE_INTERFACE) +// A couple of functions to transfer between ASCII/Unicode +wstring __ASCIIToWide(const char *ascii); +string __WideToASCII(const wchar_t *wide); +#endif + +inline const char* _STLP_CALL +__get_c_string(const string& __str) { return __str.c_str(); } + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#include + +#if defined(_STLP_USE_NO_IOSTREAMS) || \ + (defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)) +# include +#endif + +#endif /* _STLP_INTERNAL_STRING_H */ + +/* + * Local Variables: + * mode:C++ + * End: + */ diff --git a/sdk/tlibstdcxx/stlport/stl/_string_base.h b/sdk/tlibstdcxx/stlport/stl/_string_base.h new file mode 100644 index 0000000000..7c6d7fe694 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_base.h @@ -0,0 +1,231 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING_BASE_H +#define _STLP_STRING_BASE_H + +// ------------------------------------------------------------ +// Class _String_base. + +// _String_base is a helper class that makes it it easier to write an +// exception-safe version of basic_string. The constructor allocates, +// but does not initialize, a block of memory. The destructor +// deallocates, but does not destroy elements within, a block of +// memory. The destructor assumes that _M_start either is null, or else +// points to a block of memory that was allocated using _String_base's +// allocator and whose size is _M_end_of_storage - _M_start_of_storage._M_data. + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class _String_base { + typedef _String_base<_Tp, _Alloc> _Self; +protected: + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) +public: + //dums: Some compiler(MSVC6) require it to be public not simply protected! + enum {_DEFAULT_SIZE = 4 * sizeof( void * )}; + //This is needed by the full move framework + typedef _Alloc allocator_type; + typedef _STLP_alloc_proxy<_Tp*, _Tp, allocator_type> _AllocProxy; + typedef size_t size_type; +private: +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + union _Buffers { + _Tp* _M_end_of_storage; + _Tp _M_static_buf[_DEFAULT_SIZE]; + } _M_buffers; +#else + _Tp* _M_end_of_storage; +#endif /* _STLP_USE_SHORT_STRING_OPTIM */ +protected: +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + bool _M_using_static_buf() const + { return (_M_start_of_storage._M_data == _M_buffers._M_static_buf); } + _Tp const* _M_Start() const { return _M_start_of_storage._M_data; } + _Tp* _M_Start() { return _M_start_of_storage._M_data; } + _Tp const* _M_End() const + { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; } + _Tp* _M_End() + { return _M_using_static_buf() ? _M_buffers._M_static_buf + _DEFAULT_SIZE : _M_buffers._M_end_of_storage; } + size_type _M_capacity() const + { return _M_using_static_buf() ? _DEFAULT_SIZE : _M_buffers._M_end_of_storage - _M_start_of_storage._M_data; } + size_type _M_rest() const + { return _M_using_static_buf() ? _DEFAULT_SIZE - (_M_finish - _M_buffers._M_static_buf) : _M_buffers._M_end_of_storage - _M_finish; } +#else + _Tp const* _M_Start() const { return _M_start_of_storage._M_data; } + _Tp* _M_Start() { return _M_start_of_storage._M_data; } + _Tp const* _M_End() const { return _M_end_of_storage; } + _Tp* _M_End() { return _M_end_of_storage; } + size_type _M_capacity() const + { return _M_end_of_storage - _M_start_of_storage._M_data; } + size_type _M_rest() const + { return _M_end_of_storage - _M_finish; } +#endif /* _STLP_USE_SHORT_STRING_OPTIM */ + + _Tp* _M_finish; + _AllocProxy _M_start_of_storage; + + _Tp const* _M_Finish() const {return _M_finish;} + _Tp* _M_Finish() {return _M_finish;} + + // Precondition: 0 < __n <= max_size(). + void _M_allocate_block(size_t __n = _DEFAULT_SIZE); + void _M_deallocate_block() { +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + if (!_M_using_static_buf() && (_M_start_of_storage._M_data != 0)) + _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_buffers._M_end_of_storage - _M_start_of_storage._M_data); +#else + if (_M_start_of_storage._M_data != 0) + _M_start_of_storage.deallocate(_M_start_of_storage._M_data, _M_end_of_storage - _M_start_of_storage._M_data); +#endif /* _STLP_USE_SHORT_STRING_OPTIM */ + } + + size_t max_size() const { + const size_type __string_max_size = size_type(-1) / sizeof(_Tp); + typename allocator_type::size_type __alloc_max_size = _M_start_of_storage.max_size(); + return (min)(__alloc_max_size, __string_max_size) - 1; + } + + _String_base(const allocator_type& __a) +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf) +#else + : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0) +#endif + {} + + _String_base(const allocator_type& __a, size_t __n) +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + : _M_finish(_M_buffers._M_static_buf), _M_start_of_storage(__a, _M_buffers._M_static_buf) { +#else + : _M_end_of_storage(0), _M_finish(0), _M_start_of_storage(__a, (_Tp*)0) { +#endif + _M_allocate_block(__n); + } + +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + void _M_move_src (_Self &src) { + if (src._M_using_static_buf()) { + _M_buffers = src._M_buffers; + _M_finish = _M_buffers._M_static_buf + (src._M_finish - src._M_start_of_storage._M_data); + _M_start_of_storage._M_data = _M_buffers._M_static_buf; + } + else { + _M_start_of_storage._M_data = src._M_start_of_storage._M_data; + _M_finish = src._M_finish; + _M_buffers._M_end_of_storage = src._M_buffers._M_end_of_storage; + src._M_start_of_storage._M_data = 0; + } + } +#endif + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _String_base(__move_source<_Self> src) +# if defined (_STLP_USE_SHORT_STRING_OPTIM) + : _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) { + _M_move_src(src.get()); +# else + : _M_end_of_storage(src.get()._M_end_of_storage), _M_finish(src.get()._M_finish), + _M_start_of_storage(__move_source<_AllocProxy>(src.get()._M_start_of_storage)) { + src.get()._M_start_of_storage._M_data = 0; +# endif + } +#endif + + ~_String_base() { _M_deallocate_block(); } + + void _M_reset(_Tp *__start, _Tp *__finish, _Tp *__end_of_storage) { +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + _M_buffers._M_end_of_storage = __end_of_storage; +#else + _M_end_of_storage = __end_of_storage; +#endif + _M_finish = __finish; + _M_start_of_storage._M_data = __start; + } + + void _M_swap(_Self &__s) { +#if defined (_STLP_USE_SHORT_STRING_OPTIM) + if (_M_using_static_buf()) { + if (__s._M_using_static_buf()) { + _STLP_STD::swap(_M_buffers, __s._M_buffers); + _Tp *__tmp = _M_finish; + _M_finish = _M_start_of_storage._M_data + (__s._M_finish - __s._M_start_of_storage._M_data); + __s._M_finish = __s._M_buffers._M_static_buf + (__tmp - _M_start_of_storage._M_data); + //We need to swap _M_start_of_storage for allocators with state: + _M_start_of_storage.swap(__s._M_start_of_storage); + _M_start_of_storage._M_data = _M_buffers._M_static_buf; + __s._M_start_of_storage._M_data = __s._M_buffers._M_static_buf; + } else { + __s._M_swap(*this); + return; + } + } + else if (__s._M_using_static_buf()) { + _Tp *__tmp = _M_start_of_storage._M_data; + _Tp *__tmp_finish = _M_finish; + _Tp *__tmp_end_data = _M_buffers._M_end_of_storage; + _M_buffers = __s._M_buffers; + //We need to swap _M_start_of_storage for allocators with state: + _M_start_of_storage.swap(__s._M_start_of_storage); + _M_start_of_storage._M_data = _M_buffers._M_static_buf; + _M_finish = _M_buffers._M_static_buf + (__s._M_finish - __s._M_buffers._M_static_buf); + __s._M_buffers._M_end_of_storage = __tmp_end_data; + __s._M_start_of_storage._M_data = __tmp; + __s._M_finish = __tmp_finish; + } + else { + _STLP_STD::swap(_M_buffers._M_end_of_storage, __s._M_buffers._M_end_of_storage); + _M_start_of_storage.swap(__s._M_start_of_storage); + _STLP_STD::swap(_M_finish, __s._M_finish); + } +#else + _STLP_STD::swap(_M_end_of_storage, __s._M_end_of_storage); + _M_start_of_storage.swap(__s._M_start_of_storage); + _STLP_STD::swap(_M_finish, __s._M_finish); +#endif + } + + void _STLP_FUNCTION_THROWS _M_throw_length_error() const; + void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const; +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _String_base >; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS _String_base >; +# endif +#endif /* _STLP_USE_TEMPLATE_EXPORT */ + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_STRING_BASE_H */ + +/* + * Local Variables: + * mode:C++ + * End: + */ diff --git a/sdk/tlibstdcxx/stlport/stl/_string_fwd.h b/sdk/tlibstdcxx/stlport/stl/_string_fwd.h new file mode 100644 index 0000000000..93fb29458c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_fwd.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING_FWD_H +#define _STLP_STRING_FWD_H + +#ifndef _STLP_CHAR_TRAITS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if !defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template , + class _Alloc = allocator<_CharT> > +class basic_string; +#else +template +class basic_string; +#endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */ + +typedef basic_string, allocator > string; + +#if defined (_STLP_HAS_WCHAR_T) +typedef basic_string, allocator > wstring; +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +//This function limits header dependency between exception and string +//implementation. It is implemented in _string.h +const char* _STLP_CALL __get_c_string(const string& __str); + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_STRING_FWD_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_string_hash.h b/sdk/tlibstdcxx/stlport/stl/_string_hash.h new file mode 100644 index 0000000000..87f2d9fbea --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_hash.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING_HASH_H +#define _STLP_STRING_HASH_H + +#ifndef _STLP_HASH_FUN_H +# include +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +_STLP_INLINE_LOOP size_t +__stl_string_hash(const basic_string<_CharT,_Traits,_Alloc>& __s) { + unsigned long __h = 0; + size_t __len = __s.size(); + const _CharT* __data = __s.data(); + for ( size_t __i = 0; __i < __len; ++__i) + __h = /* 5 *__h */(__h << 2) + __h + __data[__i]; + return size_t(__h); +} + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && \ + (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x560)) +template +struct hash > { + size_t operator()(const basic_string<_CharT,_Traits,_Alloc>& __s) const + { return __stl_string_hash(__s); } +}; + +#else + +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC hash { + size_t operator()(const string& __s) const + { return __stl_string_hash(__s); } +}; + +# if defined (_STLP_HAS_WCHAR_T) +_STLP_TEMPLATE_NULL +struct _STLP_CLASS_DECLSPEC hash { + size_t operator()(const wstring& __s) const + { return __stl_string_hash(__s); } +}; +# endif + +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_string_io.c b/sdk/tlibstdcxx/stlport/stl/_string_io.c new file mode 100644 index 0000000000..84b18736b5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_io.c @@ -0,0 +1,172 @@ +#ifndef _STLP_STRING_IO_C +#define _STLP_STRING_IO_C + +#ifndef _STLP_STRING_IO_H +# include +#endif + +#ifndef _STLP_INTERNAL_CTYPE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +bool _STLP_CALL +__stlp_string_fill(basic_ostream<_CharT, _Traits>& __os, + basic_streambuf<_CharT, _Traits>* __buf, + streamsize __n) { + _CharT __f = __os.fill(); + for (streamsize __i = 0; __i < __n; ++__i) { + if (_Traits::eq_int_type(__buf->sputc(__f), _Traits::eof())) + return false; + } + return true; +} + + +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator << (basic_ostream<_CharT, _Traits>& __os, + const basic_string<_CharT,_Traits,_Alloc>& __s) { + typedef basic_ostream<_CharT, _Traits> __ostream; + typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type; + + // The hypothesis of this implementation is that size_type is unsigned: + _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0) + + typename __ostream::sentry __sentry(__os); + bool __ok = false; + + if (__sentry) { + __ok = true; + size_type __n = __s.size(); + const bool __left = (__os.flags() & __ostream::left) != 0; + const streamsize __w = __os.width(0); + basic_streambuf<_CharT, _Traits>* __buf = __os.rdbuf(); + + const bool __need_pad = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __n) < __w)) || + ((sizeof(streamsize) <= sizeof(size_t)) && (__n < __STATIC_CAST(size_t, __w)))); + streamsize __pad_len = __need_pad ? __w - __n : 0; + + if (!__left) + __ok = __stlp_string_fill(__os, __buf, __pad_len); + + __ok = __ok && (__buf->sputn(__s.data(), streamsize(__n)) == streamsize(__n)); + + if (__left) + __ok = __ok && __stlp_string_fill(__os, __buf, __pad_len); + } + + if (!__ok) + __os.setstate(__ostream::failbit); + + return __os; +} + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +operator >> (basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits, _Alloc>& __s) { + typedef basic_istream<_CharT, _Traits> __istream; + typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type; + + // The hypothesis of this implementation is that size_type is unsigned: + _STLP_STATIC_ASSERT(__STATIC_CAST(size_type, -1) > 0) + + typename __istream::sentry __sentry(__is); + + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + typedef ctype<_CharT> _C_type; + + const locale& __loc = __is.getloc(); + const _C_type& _Ctype = use_facet<_C_type>(__loc); + __s.clear(); + streamsize __width = __is.width(0); + size_type __n; + if (__width <= 0) + __n = __s.max_size(); + /* __width can only overflow size_type if sizeof(streamsize) > sizeof(size_type) + * because here we know that __width is positive and the stattic assertion check + * that size_type is unsigned. + */ + else if (sizeof(streamsize) > sizeof(size_type) && + (__width > __STATIC_CAST(streamsize, __s.max_size()))) + __n = 0; + else { + __n = __STATIC_CAST(size_type, __width); + __s.reserve(__n); + } + + while (__n-- > 0) { + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, _Traits::eof())) { + __is.setstate(__istream::eofbit); + break; + } + else { + _CharT __c = _Traits::to_char_type(__c1); + + if (_Ctype.is(_C_type::space, __c)) { + if (_Traits::eq_int_type(__buf->sputbackc(__c), _Traits::eof())) + __is.setstate(__istream::failbit); + break; + } + else + __s.push_back(__c); + } + } + + // If we have read no characters, then set failbit. + if (__s.empty()) + __is.setstate(__istream::failbit); + } + else + __is.setstate(__istream::failbit); + + return __is; +} + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT __delim) { + typedef basic_istream<_CharT, _Traits> __istream; + typedef typename basic_string<_CharT, _Traits, _Alloc>::size_type size_type; + size_type __nread = 0; + typename basic_istream<_CharT, _Traits>::sentry __sentry(__is, true); + if (__sentry) { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + __s.clear(); + + while (__nread < __s.max_size()) { + int __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, _Traits::eof())) { + __is.setstate(__istream::eofbit); + break; + } + else { + ++__nread; + _CharT __c = _Traits::to_char_type(__c1); + if (!_Traits::eq(__c, __delim)) + __s.push_back(__c); + else + break; // Character is extracted but not appended. + } + } + } + if (__nread == 0 || __nread >= __s.max_size()) + __is.setstate(__istream::failbit); + + return __is; +} + +_STLP_END_NAMESPACE + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_string_io.h b/sdk/tlibstdcxx/stlport/stl/_string_io.h new file mode 100644 index 0000000000..fe549fef64 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_io.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING_IO_H +#define _STLP_STRING_IO_H + +#ifndef _STLP_INTERNAL_OSTREAM_H +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAM +# include +#endif + +// I/O. +_STLP_BEGIN_NAMESPACE + +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, + const basic_string<_CharT,_Traits,_Alloc>& __s); + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) + +template +basic_ostream<_CharT, _Traits>& _STLP_CALL +operator<<(basic_ostream<_CharT, _Traits>& __os, + const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __sum) { + basic_string<_CharT, _Traits, _Alloc> __tmp(__sum); + return __os << __tmp; +} + +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +operator>>(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits,_Alloc>& __s); + +template +basic_istream<_CharT, _Traits>& _STLP_CALL +getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits,_Alloc>& __s, + _CharT __delim); + +#if !(defined (__BORLANDC__) && !defined (_STLP_USE_OWN_NAMESPACE)) + +template +inline basic_istream<_CharT, _Traits>& _STLP_CALL +getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT,_Traits,_Alloc>& __s) { + return getline(__is, __s, __is.widen('\n')); +} +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_STRING_IO_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/_string_npos.h b/sdk/tlibstdcxx/stlport/stl/_string_npos.h new file mode 100644 index 0000000000..faa9c62728 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_npos.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2005 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +/* This header contains npos definition used in basic_string and rope + * implementation. It do not have to be guarded as files including it + * are already guarded and it has sometimes to be included several times. + */ + +#if defined (_STLP_STATIC_CONST_INIT_BUG) + enum { npos = -1 }; +#elif defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) + // inline initializer conflicts with 'extern template' + static const size_t npos; +#else + static const size_t npos = ~(size_t)0; +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_string_operators.h b/sdk/tlibstdcxx/stlport/stl/_string_operators.h new file mode 100644 index 0000000000..cff13af01c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_operators.h @@ -0,0 +1,602 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING_OPERATORS_H +#define _STLP_STRING_OPERATORS_H + +_STLP_BEGIN_NAMESPACE + +#if !defined (_STLP_USE_TEMPLATE_EXPRESSION) + +# if defined (__GNUC__) || defined (__MLCCPP__) +# define _STLP_INIT_AMBIGUITY 1 +# endif + +template +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; +# if defined (_STLP_INIT_AMBIGUITY) + // gcc counts this as a function + _Str __result = _Str(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator()); +# else + _Str __result(_Reserve_t(), __s.size() + __y.size(), __s.get_allocator()); +# endif + __result.append(__s); + __result.append(__y); + return __result; +} + +template +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL +operator+(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + const size_t __n = _Traits::length(__s); +# if defined (_STLP_INIT_AMBIGUITY) + _Str __result = _Str(_Reserve_t(), __n + __y.size(), __y.get_allocator()); +# else + _Str __result(_Reserve_t(), __n + __y.size(), __y.get_allocator()); +# endif + __result.append(__s, __s + __n); + __result.append(__y); + return __result; +} + +template +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL +operator+(_CharT __c, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; +# if defined (_STLP_INIT_AMBIGUITY) + _Str __result = _Str(_Reserve_t(), 1 + __y.size(), __y.get_allocator()); +# else + _Str __result(_Reserve_t(), 1 + __y.size(), __y.get_allocator()); +# endif + __result.push_back(__c); + __result.append(__y); + return __result; +} + +template +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; + const size_t __n = _Traits::length(__s); +# if defined (_STLP_INIT_AMBIGUITY) + _Str __result = _Str(_Reserve_t(), __x.size() + __n, __x.get_allocator()); +# else + _Str __result(_Reserve_t(), __x.size() + __n, __x.get_allocator()); +# endif + __result.append(__x); + __result.append(__s, __s + __n); + return __result; +} + +template +inline basic_string<_CharT,_Traits,_Alloc> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT __c) { + typedef basic_string<_CharT,_Traits,_Alloc> _Str; + typedef typename _Str::_Reserve_t _Reserve_t; +# if defined (_STLP_INIT_AMBIGUITY) + _Str __result = _Str(_Reserve_t(), __x.size() + 1, __x.get_allocator()); +# else + _Str __result(_Reserve_t(), __x.size() + 1, __x.get_allocator()); +# endif + __result.append(__x); + __result.push_back(__c); + return __result; +} + +# undef _STLP_INIT_AMBIGUITY + +#else /* _STLP_USE_TEMPLATE_EXPRESSION */ + +// addition with basic_string +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs, + const basic_string<_CharT,_Traits,_Alloc>& __rhs) { + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right> __root_type; + __root_type __root(__rhs, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__lhs.get_allocator())); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + __root_type, + _STLP_PRIV __on_right>(__lhs, __root); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __lhs, + const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __rhs) { + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __on_right>(__lhs, __rhs); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __on_left> _STLP_CALL +operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __lhs, + const basic_string<_CharT,_Traits,_Alloc>& __rhs) { + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __on_left>(__lhs, __rhs); +} + +// addition with C string +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + const size_t __n = _Traits::length(__s); + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right> __root_type; + __root_type __root(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + __root_type, _STLP_PRIV __on_right>(__x, __root); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + const size_t __n = _Traits::length(__s); + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right> __root_type; + __root_type __root(__y, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__y.get_allocator())); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, + __root_type, + _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __root); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __on_left> _STLP_CALL +operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, + const _CharT* __s) { + const size_t __n = _Traits::length(__s); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __on_left>(__x, _STLP_PRIV __cstr_wrapper<_CharT>(__s, __n)); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __y) { + const size_t __n = _Traits::length(__s); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __cstr_wrapper<_CharT>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __on_right>(_STLP_PRIV __cstr_wrapper<_CharT>(__s, __n), __y); +} + +// addition with char +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __char_wrapper<_CharT>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const basic_string<_CharT,_Traits,_Alloc>& __x, const _CharT __c) { + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right> __root_type; + __root_type __root(__c, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + __root_type, _STLP_PRIV __on_right>(__x, __root); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __char_wrapper<_CharT>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const _CharT __c, const basic_string<_CharT,_Traits,_Alloc>& __x) { + typedef _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_wrapper<_CharT,_Traits,_Alloc>, + _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>, + _STLP_PRIV __on_right> __root_type; + __root_type __root(__x, _STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc>(__x.get_allocator())); + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, + __root_type, _STLP_PRIV __on_right>(__c, __root); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __char_wrapper<_CharT>, + _STLP_PRIV __on_left> _STLP_CALL +operator+(const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x, const _CharT __c) { + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __char_wrapper<_CharT>, _STLP_PRIV __on_left>(__x, __c); +} + +template +inline _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __on_right> _STLP_CALL +operator+(const _CharT __c, const _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>& __x) { + return _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _STLP_PRIV __char_wrapper<_CharT>, + _STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir>, + _STLP_PRIV __on_right>(__c, __x); +} + +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +// Operator== and operator!= + +template +inline bool _STLP_CALL +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; +} + +template +inline bool _STLP_CALL +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + return __x.size() == __y.size() && _Traits::compare(__x.data(), __y.data(), __x.size()) == 0; +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + + +template +inline bool _STLP_CALL +operator==(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; +} + +template +inline bool _STLP_CALL +operator==(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator==(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return __n == __y.size() && _Traits::compare(__s, __y.data(), __n) == 0; +} + +template +inline bool _STLP_CALL +operator==(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return __x.size() == __n && _Traits::compare(__x.data(), __s, __n) == 0; +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +// Operator< (and also >, <=, and >=). + +template +inline bool _STLP_CALL +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()) < 0; +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()) < 0; +} + +template +inline bool _STLP_CALL +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()) < 0; +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +template +inline bool _STLP_CALL +operator<(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, + __y.begin(), __y.end()) < 0; +} + +template +inline bool _STLP_CALL +operator<(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), + __s, __s + __n) < 0; +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator<(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__s, __s + __n, + __y.begin(), __y.end()) < 0; +} + +template +inline bool _STLP_CALL +operator<(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + size_t __n = _Traits::length(__s); + return basic_string<_CharT,_Traits,_Alloc> ::_M_compare(__x.begin(), __x.end(), + __s, __s + __n) < 0; +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE) + +/* Only defined if _STLP_USE_SEPARATE_RELOPS_NAMESPACE is defined otherwise + * it might introduce ambiguity with pure template relational operators + * from rel_ops namespace. + */ +template +inline bool _STLP_CALL +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) +{ return !(__x == __y); } + +template +inline bool _STLP_CALL +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) +{ return __y < __x; } + +template +inline bool _STLP_CALL +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) +{ return !(__y < __x); } + +template +inline bool _STLP_CALL +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) +{ return !(__x < __y); } + +# if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const basic_string<_CharT,_Traits,_Alloc>& __y) +{ return !(__x==__y); } + +template +inline bool _STLP_CALL +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) +{ return !(__x==__y); } +# endif + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + +template +inline bool _STLP_CALL +operator!=(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__s == __y); +} + +template +inline bool _STLP_CALL +operator!=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__x == __s); +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator!=(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__s == __y); +} + +template +inline bool _STLP_CALL +operator!=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__x == __s); +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +template +inline bool _STLP_CALL +operator>(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return __y < __s; +} + +template +inline bool _STLP_CALL +operator>(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return __s < __x; +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator>(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return __y < __s; +} + +template +inline bool _STLP_CALL +operator>(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return __s < __x; +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +template +inline bool _STLP_CALL +operator<=(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__y < __s); +} + +template +inline bool _STLP_CALL +operator<=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__s < __x); +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator<=(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__y < __s); +} + +template +inline bool _STLP_CALL +operator<=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__s < __x); +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +template +inline bool _STLP_CALL +operator>=(const _CharT* __s, + const basic_string<_CharT,_Traits,_Alloc>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__s < __y); +} + +template +inline bool _STLP_CALL +operator>=(const basic_string<_CharT,_Traits,_Alloc>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__x < __s); +} + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +template +inline bool _STLP_CALL +operator>=(const _CharT* __s, + const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __y) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__s < __y); +} + +template +inline bool _STLP_CALL +operator>=(const _STLP_PRIV __bstr_sum<_CharT,_Traits,_Alloc,_Lhs,_Rhs,_StoreDir>& __x, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + return !(__x < __s); +} +#endif /* _STLP_USE_TEMPLATE_EXPRESSION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_STRING_OPERATORS_H */ + diff --git a/sdk/tlibstdcxx/stlport/stl/_string_sum.h b/sdk/tlibstdcxx/stlport/stl/_string_sum.h new file mode 100644 index 0000000000..739d2884f0 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_sum.h @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING_SUM_H +#define _STLP_STRING_SUM_H + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +/*char wrapper to simulate basic_string*/ +template +struct __char_wrapper { + typedef const _CharT& const_reference; + + __char_wrapper(_CharT __val) : _Val(__val) {} + + _CharT getValue() const { return _Val; } + size_t size() const { return 1; } + + const_reference operator[] (size_t __n) const { + //To avoid a check on __n we use this strange implementation + return (&_Val)[__n]; + } + +private: + _CharT _Val; +}; + +/*C string wrapper to simulate basic_string*/ +template +struct __cstr_wrapper { + typedef const _CharT& const_reference; + + __cstr_wrapper(const _CharT *__cstr, size_t __size) : + _CStr(__cstr), _Size(__size) {} + + const _CharT* c_str() const { return _CStr; } + + size_t size() const { return _Size; } + + const_reference operator[] (size_t __n) const { return _CStr[__n]; } + +private: + const _CharT *_CStr; + size_t _Size; +}; + +/*basic_string wrapper to ensure that we only store a reference to the original string and not copy it*/ +template +struct __bstr_wrapper { + typedef const _CharT& const_reference; + typedef basic_string<_CharT, _Traits, _Alloc> _BString; + + __bstr_wrapper (_BString const& __s) : + _BStr(__s) {} + + size_t size() const { return _BStr.size(); } + + const_reference operator[] (size_t __n) const { return _BStr[__n]; } + + _BString const& b_str() const { return _BStr; } + +private: + _BString const& _BStr; +}; + +struct __on_left {}; +struct __on_right {}; + +template +class __bstr_sum { +public: + typedef basic_string<_CharT, _Traits, _Alloc> _BString; + typedef typename _BString::const_reference const_reference; + typedef typename _BString::const_iterator const_iterator; + typedef typename _BString::const_reverse_iterator const_reverse_iterator; + typedef typename _BString::size_type size_type; + typedef typename _BString::allocator_type allocator_type; + typedef __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDirection> _Self; + + __bstr_sum (_Left const& lhs, _Right const& rhs) : + _lhs(lhs), _rhs(rhs) {} + + _Left const& getLhs() const { return _lhs; } + _Right const& getRhs() const { return _rhs; } + + allocator_type get_allocator() const { return _M_get_storage(false).get_allocator(); } + + const_iterator begin() const { return _M_get_storage().begin(); } + const_iterator end() const { return _M_get_storage().end(); } + const_reverse_iterator rbegin() const { return _M_get_storage().rbegin(); } + const_reverse_iterator rend() const { return _M_get_storage().rend(); } + + size_type size() const { return _lhs.size() + _rhs.size(); } + size_type length() const { return size(); } + + size_t max_size() const { return _M_get_storage().max_size(); } + size_type capacity() const { return size(); } + bool empty() const { return size() == 0; } + + const_reference operator[](size_t __n) const + { return (__n < _lhs.size())?_lhs[__n]:_rhs[__n - _lhs.size()]; } + + const_reference at(size_type __n) const + { return _M_get_storage().at(__n); } + + //operator += + typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __bstr_wrapper<_CharT, _Traits, _Alloc>, __on_left> _BStrOnLeft; + _BStrOnLeft operator += (const _BString& __s) { return append(__s); } + + typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __cstr_wrapper<_CharT>, __on_left> _CStrOnLeft; + _CStrOnLeft operator += (const _CharT* __s) { return append(__s); } + + typedef __bstr_sum<_CharT, _Traits, _Alloc, _Self, __char_wrapper<_CharT>, __on_left> _CharOnLeft; + _CharOnLeft operator += (_CharT __c) { return _CharOnLeft(*this, __c); } + + //append + _BStrOnLeft append (const _BString& __s) + { return _BStrOnLeft(*this, __s); } + _BString& append(const _BString& __s, size_type __pos, size_type __n) + { return _M_get_storage().append(__s, __pos, __n); } + _CStrOnLeft append(const _CharT* __s) { + const size_type __n = _Traits::length(__s); + return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); + } + _CStrOnLeft append(const _CharT* __s, size_type __n) + { return _CStrOnLeft(*this, __cstr_wrapper<_CharT>(__s, __n)); } + _BString& append(size_type __n, _CharT __c) + {return _M_get_storage().append(__n, __c);} + template + _BString& append(_InputIter __first, _InputIter __last) + {return _M_get_storage().append(__first, __last);} + + //assign + _BString& assign(const _BString& __s) {return _M_get_storage().assign(__s);} + _BString& assign(const _BString& __s, size_type __pos, size_type __n) {return _M_get_storage().assign(__s, __pos, __n);} + _BString& assign(const _CharT* __s, size_type __n) {return _M_get_storage().assign(__s, __n);} + _BString& assign(const _CharT* __s) {return _M_get_storage().assign(__s); } + _BString& assign(size_type __n, _CharT __c) {return _M_get_storage().assign(__n, __c);} + + //insert + _BString& insert(size_type __pos, const _BString& __s) {return _M_get_storage().insert(__pos, __s);} + _BString& insert(size_type __pos, const _BString& __s, size_type __beg, size_type __n) + {return _M_get_storage().insert(__pos, __s, __beg, __n);} + _BString& insert(size_type __pos, const _CharT* __s, size_type __n) {return _M_get_storage().insert(__pos, __s, __n);} + _BString& insert(size_type __pos, const _CharT* __s) {return _M_get_storage().insert(__pos, __s);} + _BString& insert(size_type __pos, size_type __n, _CharT __c) {return _M_get_storage().insert(__pos, __n, __c);} + + //erase + _BString& erase(size_type __pos = 0, size_type __n =_BString::npos) {return _M_get_storage().erase(__pos, __n);} + + //replace + _BString& replace(size_type __pos, size_type __n, const _BString& __s) + {return _M_get_storage().replace(__pos, __n, __s);} + _BString& replace(size_type __pos1, size_type __n1, const _BString& __s, size_type __pos2, size_type __n2) + {return _M_get_storage().replace(__pos1, __n1, __s, __pos2, __n2);} + _BString& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) + {return _M_get_storage().replace(__pos, __n1, __s, __n2);} + _BString& replace(size_type __pos, size_type __n1, const _CharT* __s) + {return _M_get_storage().replace(__pos, __n1, __s);} + _BString& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) + {return _M_get_storage().replace(__pos, __n1, __n2, __c);} + + size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const + {return _M_get_storage().copy(__s, __n, __pos);} + + void swap(_BString& __s) + {_M_get_storage().swap(__s);} + + const _CharT* c_str() const { return _M_get_storage().c_str(); } + const _CharT* data() const { return _M_get_storage().data(); } + + //find family + size_type find(const _BString& __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); } + size_type find(const _CharT* __s, size_type __pos = 0) const { return _M_get_storage().find(__s, __pos); } + size_type find(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().find(__s, __pos, __n); } + size_type find(_CharT __c, size_type __pos = 0) const { return _M_get_storage().find(__c, __pos); } + + size_type rfind(const _BString& __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); } + size_type rfind(const _CharT* __s, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__s, __pos); } + size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { return _M_get_storage().rfind(__s, __pos, __n); } + size_type rfind(_CharT __c, size_type __pos = _BString::npos) const { return _M_get_storage().rfind(__c, __pos); } + + size_type find_first_of(const _BString& __s, size_type __pos = 0) const + { return _M_get_storage().find_first_of(__s, __pos); } + size_type find_first_of(const _CharT* __s, size_type __pos = 0) const + { return _M_get_storage().find_first_of(__s, __pos); } + size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + { return _M_get_storage().find_first_of(__s, __pos, __n); } + size_type find_first_of(_CharT __c, size_type __pos = 0) const + { return _M_get_storage().find(__c, __pos); } + + size_type find_last_of(const _BString& __s, size_type __pos = _BString::npos) const + { return _M_get_storage().find_last_of(__s, __pos); } + size_type find_last_of(const _CharT* __s, size_type __pos = _BString::npos) const + { return _M_get_storage().find_last_of(__s, __pos); } + size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + { return _M_get_storage().find_last_of(__s, __pos, __n); } + size_type find_last_of(_CharT __c, size_type __pos = _BString::npos) const + { return _M_get_storage().rfind(__c, __pos); } + + size_type find_first_not_of(const _BString& __s, size_type __pos = 0) const + { return _M_get_storage().find_first_not_of(__s, __pos); } + size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const + { return _M_get_storage().find_first_not_of(__s, __pos); } + size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const + { return _M_get_storage().find_first_not_of(__s, __pos, __n); } + size_type find_first_not_of(_CharT __c, size_type __pos = 0) const + { return _M_get_storage().find_first_not_of(__c, __pos); } + + size_type find_last_not_of(const _BString& __s, size_type __pos = _BString::npos) const + { return _M_get_storage().find_last_not_of(__s, __pos); } + size_type find_last_not_of(const _CharT* __s, size_type __pos =_BString:: npos) const + { return _M_get_storage().find_last_not_of(__s, __pos); } + size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const + { return _M_get_storage().find_last_not_of(__s, __pos, __n); } + size_type find_last_not_of(_CharT __c, size_type __pos = _BString::npos) const + { return _M_get_storage().find_last_not_of(__c, __pos); } + + _BString substr(size_type __pos = 0, size_type __n = _BString::npos) const + { return _M_get_storage().substr(__pos, __n); } + + //compare + int compare(const _BString& __s) const + { return _M_get_storage().compare(__s); } + int compare(size_type __pos1, size_type __n1, const _Self& __s) const + { return _M_get_storage().compare(__pos1, __n1, __s); } + int compare(size_type __pos1, size_type __n1, const _Self& __s, size_type __pos2, size_type __n2) const + { return _M_get_storage().compare(__pos1, __n1, __s, __pos2, __n2); } + int compare(const _CharT* __s) const + { return _M_get_storage().compare(__s); } + int compare(size_type __pos1, size_type __n1, const _CharT* __s) const + { return _M_get_storage().compare(__pos1, __n1, __s); } + int compare(size_type __pos1, size_type __n1, const _CharT* __s, size_type __n2) const + { return _M_get_storage().compare(__pos1, __n1, __s, __n2); } + + //Returns the underlying basic_string representation of the template expression + //The non const method will always initialise it. + _BString& _M_get_storage() + { return _rhs._M_get_storage(*this, _StorageDirection()); } + + template + _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, + __on_left const& /*StorageDir*/) + { return _lhs._M_get_storage(__ref); } + + template + _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, + __on_right const& /*StorageDir*/) + { return _rhs._M_get_storage(__ref); } + + template + _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref) + { return _M_get_storage(__ref, _StorageDirection()); } + + //The const method can be invoked without initialising the basic_string so avoiding dynamic allocation. + _BString const& _M_get_storage(bool __do_init = true) const + { return _M_get_storage(*this, __do_init, _StorageDirection()); } + + template + _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, + bool __do_init, __on_left const& /*StorageDir*/) const + { return _lhs._M_get_storage(__ref, __do_init); } + + template + _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, + bool __do_init, __on_right const& /*StorageDir*/) const + { return _rhs._M_get_storage(__ref, __do_init); } + + template + _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Lhs, _Rhs, _StorageDir> const& __ref, + bool __do_init) const + { return _M_get_storage(__ref, __do_init, _StorageDirection()); } + +private: + _Left _lhs; + _Right _rhs; +}; + +/* + * For this operator we choose to use the right part as the storage part + */ +template +inline __bstr_sum<_CharT, _Traits, _Alloc, + __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>, + __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>, + __on_right> _STLP_CALL +operator + (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) { + return __bstr_sum<_CharT, _Traits, _Alloc, + __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1>, + __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2>, + __on_right>(__lhs, __rhs); +} + +template +inline bool _STLP_CALL +operator == (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) +{ return (__lhs.size() == __rhs.size()) && (__lhs._M_get_storage() == __rhs._M_get_storage()); } + +template +inline bool _STLP_CALL +operator < (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) +{ return __lhs._M_get_storage() < __rhs._M_get_storage(); } + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline bool _STLP_CALL +operator != (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) +{ return !(__lhs == __rhs); } + +template +inline bool _STLP_CALL +operator > (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) +{ return __rhs < __lhs; } + +template +inline bool _STLP_CALL +operator <= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) +{ return !(__rhs < __lhs); } + +template +inline bool _STLP_CALL +operator >= (const __bstr_sum<_CharT, _Traits, _Alloc, _Lh1, _Rh1, _StoreDir1> &__lhs, + const __bstr_sum<_CharT, _Traits, _Alloc, _Lh2, _Rh2, _StoreDir2> &__rhs) +{ return !(__lhs < __rhs); } + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ + + +/* + * This class will be used to simulate a temporary string that is required for + * a call to the c_str method on the __bstr_sum class. + */ + +template +struct __sum_storage_elem { + typedef __sum_storage_elem<_CharT, _Traits, _Alloc> _Self; + typedef basic_string<_CharT, _Traits, _Alloc> _BString; + + __sum_storage_elem(_Alloc __alloc) : _M_init(false), _M_storage(__alloc) + {} + + template + void _M_Init(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) const { + if (!_M_init) { + _STLP_MUTABLE(_Self, _M_storage) = __ref; + _STLP_MUTABLE(_Self, _M_init) = true; + } + } + + template + _BString const& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref, + bool __do_init) const { + if (__do_init) { + _M_Init(__ref); + } + return _M_storage; + } + template + _BString& _M_get_storage(__bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __ref) { + _M_Init(__ref); + return _M_storage; + } + + size_t size() const { return 0; } + _CharT const& operator[](size_t __n) const + { return __STATIC_CAST(_CharT*, 0)[__n]; } + +private: + mutable bool _M_init; + mutable basic_string<_CharT, _Traits, _Alloc> _M_storage; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /*_STLP_STRING_SUM_H*/ diff --git a/sdk/tlibstdcxx/stlport/stl/_string_sum_methods.h b/sdk/tlibstdcxx/stlport/stl/_string_sum_methods.h new file mode 100644 index 0000000000..305608e50e --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_sum_methods.h @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * All the necessary methods used for template expressions with basic_string + * This file do not have to be macro guarded as it is only used in the _string.h + * file and it is a part of the basic_string definition. + */ + +public: + template + basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) + : _STLP_STRING_SUM_BASE(_Reserve_t(), __s.size(), __s.get_allocator()) + { _M_append_sum(__s); } + + template + basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + size_type __pos, size_type __n = npos, + const allocator_type& __a = allocator_type()) + : _STLP_STRING_SUM_BASE(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a) { + size_type __size = __s.size(); + if (__pos > __size) + this->_M_throw_out_of_range(); + else + _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos)); + } + +private: + _CharT* _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf) { + _STLP_STD::_Copy_Construct(__buf, __c.getValue()); + return __buf + 1; + } + _CharT* _M_append_fast(_CharT const* __s, size_type __s_size, _CharT *__buf) + { return uninitialized_copy(__s, __s + __s_size, __buf); } + _CharT* _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf) + { return _M_append_fast(__s.c_str(), __s.size(), __buf); } + _CharT* _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf) + { return _M_append_fast(__s.b_str(), __buf); } + _CharT* _M_append_fast(_Self const& __s, _CharT *__buf) + { return _M_append_fast(__s.data(), __s.size(), __buf); } + _CharT* _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf) + { return __buf; } + template + _CharT* _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _CharT *__buf) + { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __buf)); } + + _CharT* _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _CharT *__buf, size_type /*__pos*/, size_type __n) { + if (__n == 0) + return __buf; + _STLP_STD::_Copy_Construct(__buf, __c.getValue()); + return __buf + 1; + } + _CharT* _M_append_fast_pos(_CharT const* __s, size_type __s_size, _CharT *__buf, + size_type __pos, size_type __n) + { return uninitialized_copy(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos), __buf); } + _CharT* _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _CharT *__buf, + size_type __pos, size_type __n) + { return _M_append_fast_pos(__s.c_str(), __s.size(), __buf, __pos, __n); } + _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _CharT *__buf, + size_type __pos, size_type __n) + { return _M_append_fast_pos(__s.b_str(), __buf, __pos, __n); } + _CharT* _M_append_fast_pos(_Self const& __s, _CharT *__buf, + size_type __pos, size_type __n) + { return _M_append_fast_pos(__s.data(), __s.size(), __buf, __pos, __n); } + _CharT* _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _CharT *__buf, + size_type, size_type) + { return __buf; } + + template + _CharT* _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + _CharT *__buf, size_type __pos, size_type __n) { + if (__n == 0) { + return __buf; + } + size_type __lhs_size = __s.getLhs().size(); + if (__pos < __lhs_size) { + if (__n < (__lhs_size - __pos)) { + return _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n); + } else { + return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __buf, __pos, __n), + 0, __n - (__lhs_size - __pos)); + } + } else { + return _M_append_fast_pos(__s.getRhs(), __buf, __pos - __lhs_size, __n); + } + } + + template + _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) { + size_type __s_size = __s.size(); + if (__s_size == 0) + return *this; + const size_type __old_size = this->size(); + if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size)) + this->_M_throw_length_error(); + if (__old_size + __s_size > this->capacity()) { + const size_type __len = __old_size + (max)(__old_size, __s_size) + 1; + pointer __new_start = this->_M_start_of_storage.allocate(__len); + pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); + __new_finish = this->_M_append_fast(__s, __new_finish); + this->_M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + else { + _M_append_sum_no_overflow(__s, 0, __s_size); + } + return *this; + } + + template + _Self& _M_append_sum_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + size_type __pos, size_type __n) { + size_type __s_size = (min)(__s.size() - __pos, __n); + if (__s_size == 0) + return *this; + const size_type __old_size = this->size(); + if (__s_size > this->max_size() || __old_size > (this->max_size() - __s_size)) + this->_M_throw_length_error(); + if (__old_size + __s_size > this->capacity()) { + const size_type __len = __old_size + (max)(__old_size, __s_size) + 1; + pointer __new_start = this->_M_start_of_storage.allocate(__len); + pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); + __new_finish = _M_append_fast_pos(__s, __new_finish, __pos, __s_size); + this->_M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + else { + _M_append_sum_no_overflow(__s, __pos, __s_size); + } + return *this; + } + + template + void _M_append_sum_no_overflow(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + size_type __pos, size_type __n) { + pointer __finish = this->_M_Finish(); + _M_append_fast_pos(__s, __finish + 1, __pos + 1, __n - 1); + this->_M_construct_null(__finish + __n); + _Traits::assign(*this->_M_finish, __s[__pos]); + this->_M_finish += __n; + } diff --git a/sdk/tlibstdcxx/stlport/stl/_string_workaround.h b/sdk/tlibstdcxx/stlport/stl/_string_workaround.h new file mode 100644 index 0000000000..d77e320155 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_string_workaround.h @@ -0,0 +1,599 @@ +/* + * Copyright (c) 2004 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +//Included from _string.h, no need for macro guarding. + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_DEBUG) +# define basic_string _STLP_NON_DBG_NAME(str) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +#define _STLP_NO_MEM_T_STRING_BASE _STLP_PRIV _STLP_NO_MEM_T_NAME(str)<_CharT, _Traits, _Alloc> + +template +class basic_string : public _STLP_NO_MEM_T_STRING_BASE +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string) + , public __stlport_class > +#endif +{ +private: // Protected members inherited from base. + typedef basic_string<_CharT, _Traits, _Alloc> _Self; + typedef _STLP_NO_MEM_T_STRING_BASE _Base; + typedef typename _Base::_CalledFromWorkaround_t _CalledFromWorkaround_t; +public: + + __IMPORT_WITH_REVERSE_ITERATORS(_Base) + + typedef typename _Base::_Iterator_category _Iterator_category; + typedef typename _Base::traits_type traits_type; + typedef typename _Base::_Reserve_t _Reserve_t; + +#include + +public: // Constructor, destructor, assignment. + explicit basic_string(const allocator_type& __a = allocator_type()) + : _STLP_NO_MEM_T_STRING_BASE(__a) {} + + basic_string(_Reserve_t __r, size_t __n, + const allocator_type& __a = allocator_type()) + : _STLP_NO_MEM_T_STRING_BASE(__r, __n, __a) {} + + basic_string(const _Self& __s) + : _STLP_NO_MEM_T_STRING_BASE(__s) {} + + basic_string(const _Self& __s, size_type __pos, size_type __n = npos, + const allocator_type& __a = allocator_type()) + : _STLP_NO_MEM_T_STRING_BASE(__s, __pos, __n, __a) {} + + basic_string(const _CharT* __s, size_type __n, + const allocator_type& __a = allocator_type()) + : _STLP_NO_MEM_T_STRING_BASE(__s, __n, __a) {} + + basic_string(const _CharT* __s, + const allocator_type& __a = allocator_type()) + : _STLP_NO_MEM_T_STRING_BASE(__s, __a) {} + + basic_string(size_type __n, _CharT __c, + const allocator_type& __a = allocator_type()) + : _STLP_NO_MEM_T_STRING_BASE(__n, __c, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + basic_string(__move_source<_Self> src) + : _STLP_NO_MEM_T_STRING_BASE(__move_source<_Base>(src.get())) {} +#endif + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + basic_string(_InputIterator __f, _InputIterator __l, + const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL) + : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), __a) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__f, __l, _Integral()); + } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + basic_string(_InputIterator __f, _InputIterator __l) + : _STLP_NO_MEM_T_STRING_BASE(_CalledFromWorkaround_t(), allocator_type()) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_dispatch(__f, __l, _Integral()); + } +# endif + + _Self& operator=(const _Self& __s) { + _Base::operator=(__s); + return *this; + } + + _Self& operator=(const _CharT* __s) { + _Base::operator=(__s); + return *this; + } + + _Self& operator=(_CharT __c) { + _Base::operator=(__c); + return *this; + } + +private: + template + void _M_range_initialize(_InputIter __f, _InputIter __l, + const input_iterator_tag &__tag) { + this->_M_allocate_block(); + this->_M_construct_null(this->_M_Finish()); + _M_appendT(__f, __l, __tag); + } + + template + void _M_range_initialize(_ForwardIter __f, _ForwardIter __l, + const forward_iterator_tag &) { + difference_type __n = _STLP_STD::distance(__f, __l); + this->_M_allocate_block(__n + 1); + this->_M_finish = uninitialized_copy(__f, __l, this->_M_Start()); + this->_M_terminate_string(); + } + + template + void _M_range_initializeT(_InputIter __f, _InputIter __l) { + _M_range_initialize(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); + } + + template + void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) { + this->_M_allocate_block(__n + 1); + this->_M_finish = uninitialized_fill_n(this->_M_Start(), __n, __x); + this->_M_terminate_string(); + } + + template + void _M_initialize_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { + _M_range_initializeT(__f, __l); + } + +public: // Append, operator+=, push_back. + _Self& operator+=(const _Self& __s) { + _Base::operator+=(__s); + return *this; + } + _Self& operator+=(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::operator+=(__s); + return *this; + } + _Self& operator+=(_CharT __c) { + _Base::operator+=(__c); + return *this; + } + + _Self& append(const _Self& __s) { + _Base::append(__s); + return *this; + } + + _Self& append(const _Self& __s, + size_type __pos, size_type __n) { + _Base::append(__s, __pos, __n); + return *this; + } + + _Self& append(const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::append(__s, __n); + return *this; + } + _Self& append(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::append(__s); + return *this; + } + _Self& append(size_type __n, _CharT __c) { + _Base::append(__n, __c); + return *this; + } + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + _Self& append(_InputIter __first, _InputIter __last) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + return _M_append_dispatch(__first, __last, _Integral()); + } + +#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) + //See equivalent assign method remark. + _Self& append(const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) + _Base::append(__f, __l); + return *this; + } +#endif + +private: // Helper functions for append. + + template + _Self& _M_appendT(_InputIter __first, _InputIter __last, + const input_iterator_tag &) { + for ( ; __first != __last ; ++__first) + _Base::push_back(*__first); + return *this; + } + + template + _Self& _M_appendT(_ForwardIter __first, _ForwardIter __last, + const forward_iterator_tag &) { + if (__first != __last) { + const size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last)); + if (__n >= this->_M_rest()) { + size_type __len = this->_M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = uninitialized_copy(this->_M_Start(), this->_M_Finish(), __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + this->_M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + else { + _Traits::assign(*this->_M_finish, *__first++); + uninitialized_copy(__first, __last, this->_M_Finish() + 1); + this->_M_construct_null(this->_M_Finish() + __n); + this->_M_finish += __n; + } + } + return *this; + } + + template + _Self& _M_append_dispatch(_Integer __n, _Integer __x, const __true_type& /*Integral*/) + { return append((size_type) __n, (_CharT) __x); } + + template + _Self& _M_append_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*Integral*/) + { return _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); } + +public: // Assign + _Self& assign(const _Self& __s) { + _Base::assign(__s); + return *this; + } + + _Self& assign(const _Self& __s, + size_type __pos, size_type __n) { + _Base::assign(__s, __pos, __n); + return *this; + } + + _Self& assign(const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::assign(__s, __n); + return *this; + } + + _Self& assign(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::assign(__s); + return *this; + } + + _Self& assign(size_type __n, _CharT __c) { + _Base::assign(__n, __c); + return *this; + } + +private: // Helper functions for assign. + + template + _Self& _M_assign_dispatch(_Integer __n, _Integer __x, const __true_type& /*_Integral*/) + { return assign((size_type) __n, (_CharT) __x); } + + template + _Self& _M_assign_dispatch(_InputIter __f, _InputIter __l, const __false_type& /*_Integral*/) { + pointer __cur = this->_M_Start(); + while (__f != __l && __cur != this->_M_Finish()) { + _Traits::assign(*__cur, *__f); + ++__f; + ++__cur; + } + if (__f == __l) + _Base::erase(__cur, this->_M_Finish()); + else + _M_appendT(__f, __l, _STLP_ITERATOR_CATEGORY(__f, _InputIter)); + return *this; + } + +public: + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + _Self& assign(_InputIter __first, _InputIter __last) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + return _M_assign_dispatch(__first, __last, _Integral()); + } + +#if !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) + /* This method is not part of the standard and is a specialization of the + * template method assign. It is only granted for convenience to call assign + * with mixed parameters iterator and const_iterator. + */ + _Self& assign(const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) + _Base::assign(__f, __l); + return *this; + } +#endif + +public: // Insert + _Self& insert(size_type __pos, const _Self& __s) { + _Base::insert(__pos, __s); + return *this; + } + + _Self& insert(size_type __pos, const _Self& __s, + size_type __beg, size_type __n) { + _Base::insert(__pos, __s, __beg, __n); + return *this; + } + _Self& insert(size_type __pos, const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::insert(__pos, __s, __n); + return *this; + } + + _Self& insert(size_type __pos, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::insert(__pos, __s); + return *this; + } + + _Self& insert(size_type __pos, size_type __n, _CharT __c) { + _Base::insert(__pos, __n, __c); + return *this; + } + + iterator insert(iterator __p, _CharT __c) + { return _Base::insert(__p, __c); } + + void insert(iterator __p, size_t __n, _CharT __c) + { _Base::insert(__p, __n, __c); } + + // Check to see if _InputIterator is an integer type. If so, then + // it can't be an iterator. + template + void insert(iterator __p, _InputIter __first, _InputIter __last) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + _M_insert_dispatch(__p, __first, __last, _Integral()); + } + +#if !defined (_STLP_NO_METHOD_SPECIALIZATION) +public: + void insert(iterator __p, const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _M_insert(__p, __f, __l, this->_M_inside(__f)); + } +#endif + +private: // Helper functions for insert. + void _M_insert(iterator __p, const _CharT* __f, const _CharT* __l, bool __self_ref) { + _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) + _Base::_M_insert(__p, __f, __l, __self_ref); + } + + template + void _M_insert_overflow(iterator __pos, _ForwardIter __first, _ForwardIter __last, + size_type __n) { + size_type __len = this->_M_compute_next_size(__n); + pointer __new_start = this->_M_start_of_storage.allocate(__len, __len); + pointer __new_finish = uninitialized_copy(this->_M_Start(), __pos, __new_start); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish = uninitialized_copy(__pos, this->_M_Finish(), __new_finish); + this->_M_construct_null(__new_finish); + this->_M_deallocate_block(); + this->_M_reset(__new_start, __new_finish, __new_start + __len); + } + + template + void _M_insertT(iterator __p, _InputIter __first, _InputIter __last, + const input_iterator_tag &) { + for ( ; __first != __last; ++__first) { + __p = insert(__p, *__first); + ++__p; + } + } + + template + void _M_insertT(iterator __pos, _ForwardIter __first, _ForwardIter __last, + const forward_iterator_tag &) { + if (__first != __last) { + size_type __n = __STATIC_CAST(size_type, _STLP_STD::distance(__first, __last)); + if (__n < this->_M_rest()) { + const size_type __elems_after = this->_M_finish - __pos; + if (__elems_after >= __n) { + uninitialized_copy((this->_M_Finish() - __n) + 1, this->_M_Finish() + 1, this->_M_Finish() + 1); + this->_M_finish += __n; + _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1); + _M_copyT(__first, __last, __pos); + } + else { + pointer __old_finish = this->_M_Finish(); + _ForwardIter __mid = __first; + _STLP_STD::advance(__mid, __elems_after + 1); + _STLP_STD::uninitialized_copy(__mid, __last, this->_M_Finish() + 1); + this->_M_finish += __n - __elems_after; + uninitialized_copy(__pos, __old_finish + 1, this->_M_Finish()); + this->_M_finish += __elems_after; + _M_copyT(__first, __mid, __pos); + } + } + else { + _M_insert_overflow(__pos, __first, __last, __n); + } + } + } + + template + void _M_insert_dispatch(iterator __p, _Integer __n, _Integer __x, + const __true_type& /*Integral*/) + { insert(__p, (size_type) __n, (_CharT) __x); } + + template + void _M_insert_dispatch(iterator __p, _InputIter __first, _InputIter __last, + const __false_type& /*Integral*/) { + _STLP_FIX_LITERAL_BUG(__p) + /* We are forced to do a temporary string to avoid the self referencing issue. */ + const _Self __self(__first, __last, this->get_allocator()); + _M_insertT(__p, __self.begin(), __self.end(), _STLP_ITERATOR_CATEGORY(__first, _InputIter)); + } + + template + void _M_copyT(_InputIterator __first, _InputIterator __last, pointer __result) { + _STLP_FIX_LITERAL_BUG(__p) + for ( ; __first != __last; ++__first, ++__result) + _Traits::assign(*__result, *__first); + } + +#if !defined (_STLP_NO_METHOD_SPECIALIZATION) + void _M_copyT(const _CharT* __f, const _CharT* __l, _CharT* __res) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) _STLP_FIX_LITERAL_BUG(__res) + _Base::_M_copy(__f, __l, __res); + } +#endif + +public: // Erase. + _Self& erase(size_type __pos = 0, size_type __n = npos) { + _Base::erase(__pos, __n); + return *this; + } + + iterator erase(iterator __pos) { + _STLP_FIX_LITERAL_BUG(__pos) + return _Base::erase(__pos); + } + + iterator erase(iterator __first, iterator __last) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + return _Base::erase(__first, __last); + } + +public: // Replace. (Conceptually equivalent + // to erase followed by insert.) + _Self& replace(size_type __pos, size_type __n, const _Self& __s) { + _Base::replace(__pos, __n, __s); + return *this; + } + + _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, + size_type __pos2, size_type __n2) { + _Base::replace(__pos1, __n1, __s, __pos2, __n2); + return *this; + } + + _Self& replace(size_type __pos, size_type __n1, + const _CharT* __s, size_type __n2) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::replace(__pos, __n1, __s, __n2); + return *this; + } + + _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _Base::replace(__pos, __n1, __s); + return *this; + } + + _Self& replace(size_type __pos, size_type __n1, + size_type __n2, _CharT __c) { + _Base::replace(__pos, __n1, __n2, __c); + return *this; + } + + _Self& replace(iterator __first, iterator __last, const _Self& __s) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _Base::replace(__first, __last, __s); + return *this; + } + + _Self& replace(iterator __first, iterator __last, + const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__s) + _Base::replace(__first, __last, __s, __n); + return *this; + } + + _Self& replace(iterator __first, iterator __last, + const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__s) + _Base::replace(__first, __last, __s); + return *this; + } + + _Self& replace(iterator __first, iterator __last, + size_type __n, _CharT __c) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _Base::replace(__first, __last, __n, __c); + return *this; + } + + // Check to see if _InputIter is an integer type. If so, then + // it can't be an iterator. + template + _Self& replace(iterator __first, iterator __last, + _InputIter __f, _InputIter __l) { + _STLP_FIX_LITERAL_BUG(__first)_STLP_FIX_LITERAL_BUG(__last) + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + return _M_replace_dispatch(__first, __last, __f, __l, _Integral()); + } + +#if !defined (_STLP_NO_METHOD_SPECIALIZATION) + _Self& replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + return _M_replace(__first, __last, __f, __l, this->_M_inside(__f)); + } +#endif + +private: // Helper functions for replace. + _Self& _M_replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l, bool __self_ref) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _Base::_M_replace(__first, __last, __f, __l, __self_ref); + return *this; + } + + template + _Self& _M_replace_dispatch(iterator __first, iterator __last, + _Integer __n, _Integer __x, const __true_type& /*IsIntegral*/) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + return replace(__first, __last, (size_type) __n, (_CharT) __x); + } + + template + _Self& _M_replace_dispatch(iterator __first, iterator __last, + _InputIter __f, _InputIter __l, const __false_type& /*IsIntegral*/) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + /* We are forced to do a temporary string to avoid the self referencing issue. */ + const _Self __self(__f, __l, this->get_allocator()); + return _M_replace(__first, __last, __self._M_Start(), __self._M_Finish(), false); + } + +public: // Other modifier member functions. + void swap(_Self& __s) { _Base::swap(__s); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +public: // Substring. + _Self substr(size_type __pos = 0, size_type __n = npos) const + { return _Self(*this, __pos, __n, this->get_allocator()); } + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) && !defined (_STLP_DEBUG) +# define _STLP_STRING_SUM_BASE _STLP_NO_MEM_T_STRING_BASE +# include +# undef _STLP_STRING_SUM_BASE +#endif +}; + +#undef _STLP_NO_MEM_T_STRING_BASE + +#if defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +# undef basic_string +#endif + +_STLP_END_NAMESPACE diff --git a/sdk/tlibstdcxx/stlport/stl/_strstream.h b/sdk/tlibstdcxx/stlport/stl/_strstream.h new file mode 100644 index 0000000000..5e3d4c37dc --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_strstream.h @@ -0,0 +1,165 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_STRSTREAM +#define _STLP_INTERNAL_STRSTREAM + +#ifndef _STLP_INTERNAL_STREAMBUF +# include +#endif + +#ifndef _STLP_INTERNAL_ISTREAM +# include // Includes , , +#endif + +#ifndef _STLP_INTERNAL_STRING_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#ifndef _STLP_USE_NAMESPACES +# define strstream _STLP_strstream +# define ostrstream _STLP_ostrstream +# define istrstream _STLP_istrstream +# define strstreambuf _STLP_strstreambuf +#endif + +//---------------------------------------------------------------------- +// Class strstreambuf, a streambuf class that manages an array of char. +// Note that this class is not a template. + +class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf > { +public: // Types. + typedef char_traits _Traits; + typedef basic_streambuf > _Base; + typedef void* (*__alloc_fn)(size_t); + typedef void (*__free_fn)(void*); +public: // Constructor, destructor + + explicit strstreambuf(streamsize _Initial_capacity = 0); + + strstreambuf(__alloc_fn, __free_fn); + + strstreambuf(char* __get, streamsize __n, char* __put = 0); + strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0); + strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0); + + strstreambuf(const char* __get, streamsize __n); + strstreambuf(const signed char* __get, streamsize __n); + strstreambuf(const unsigned char* __get, streamsize __n); + + virtual ~strstreambuf(); + +public: // strstreambuf operations. + void freeze(bool = true); + char* str(); + int pcount() const; + +protected: // Overridden virtual member functions. + virtual int_type overflow(int_type __c = _Traits::eof()); + virtual int_type pbackfail(int_type __c = _Traits::eof()); + virtual int_type underflow(); + virtual _Base* setbuf(char* __buf, streamsize __n); + virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, + ios_base::openmode __mode + = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode + = ios_base::in | ios_base::out); + +private: // Helper functions. + // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. + char* _M_alloc(size_t); + void _M_free(char*); + + // Helper function used in constructors. + void _M_setup(char* __get, char* __put, streamsize __n); +private: // Data members. + __alloc_fn _M_alloc_fun; + __free_fn _M_free_fun; + bool _M_dynamic : 1; + bool _M_frozen : 1; + bool _M_constant : 1; +}; + +//---------------------------------------------------------------------- +// Class istrstream, an istream that manages a strstreambuf. + +class _STLP_CLASS_DECLSPEC istrstream : public basic_istream > { +public: + explicit istrstream(char*); + explicit istrstream(const char*); + istrstream(char* , streamsize); + istrstream(const char*, streamsize); + virtual ~istrstream(); + + strstreambuf* rdbuf() const; + char* str(); + +private: + strstreambuf _M_buf; +}; + +//---------------------------------------------------------------------- +// Class ostrstream + +class _STLP_CLASS_DECLSPEC ostrstream : public basic_ostream > +{ +public: + ostrstream(); + ostrstream(char*, int, ios_base::openmode = ios_base::out); + virtual ~ostrstream(); + + strstreambuf* rdbuf() const; + void freeze(bool = true); + char* str(); + int pcount() const; + +private: + strstreambuf _M_buf; +}; + +//---------------------------------------------------------------------- +// Class strstream + +class _STLP_CLASS_DECLSPEC strstream : public basic_iostream > { +public: + typedef char char_type; + typedef char_traits::int_type int_type; + typedef char_traits::pos_type pos_type; + typedef char_traits::off_type off_type; + + strstream(); + strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); + virtual ~strstream(); + + strstreambuf* rdbuf() const; + void freeze(bool = true); + int pcount() const; + char* str(); + +private: + strstreambuf _M_buf; + + //explicitely defined as private to avoid warnings: + strstream(strstream const&); + strstream& operator = (strstream const&); +}; + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_STRSTREAM */ diff --git a/sdk/tlibstdcxx/stlport/stl/_tempbuf.c b/sdk/tlibstdcxx/stlport/stl/_tempbuf.c new file mode 100644 index 0000000000..179b4725cb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_tempbuf.c @@ -0,0 +1,57 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_TEMPBUF_C +#define _STLP_TEMPBUF_C + +#ifndef _STLP_INTERNAL_TEMPBUF_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +pair<_Tp*, ptrdiff_t> _STLP_CALL +__get_temporary_buffer(ptrdiff_t __len, _Tp*) +{ + if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp))) + __len = INT_MAX / sizeof(_Tp); + + while (__len > 0) { + _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp)); + if (__tmp != 0) + return pair<_Tp*, ptrdiff_t>(__tmp, __len); + __len /= 2; + } + + return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0); +} +_STLP_END_NAMESPACE + +#endif /* _STLP_TEMPBUF_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_tempbuf.h b/sdk/tlibstdcxx/stlport/stl/_tempbuf.h new file mode 100644 index 0000000000..0e0a747858 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_tempbuf.h @@ -0,0 +1,167 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_TEMPBUF_H +#define _STLP_INTERNAL_TEMPBUF_H + +#ifndef _STLP_CLIMITS +# include +#endif + +#ifndef _STLP_INTERNAL_CSTDLIB +# include +#endif + +#ifndef _STLP_INTERNAL_UNINITIALIZED_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +pair<_Tp*, ptrdiff_t> _STLP_CALL +__get_temporary_buffer(ptrdiff_t __len, _Tp*); + +#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS + +template +inline pair<_Tp*, ptrdiff_t> _STLP_CALL get_temporary_buffer(ptrdiff_t __len) { + return __get_temporary_buffer(__len, (_Tp*) 0); +} + +# if ! defined(_STLP_NO_EXTENSIONS) +// This overload is not required by the standard; it is an extension. +// It is supported for backward compatibility with the HP STL, and +// because not all compilers support the language feature (explicit +// function template arguments) that is required for the standard +// version of get_temporary_buffer. +template +inline pair<_Tp*, ptrdiff_t> _STLP_CALL +get_temporary_buffer(ptrdiff_t __len, _Tp*) { + return __get_temporary_buffer(__len, (_Tp*) 0); +} +# endif +#endif + +template +inline void _STLP_CALL return_temporary_buffer(_Tp* __p) { +// SunPro brain damage + free((char*)__p); +} + +template +class _Temporary_buffer { +private: + ptrdiff_t _M_original_len; + ptrdiff_t _M_len; + _Tp* _M_buffer; + + void _M_allocate_buffer() { + _M_original_len = _M_len; + _M_buffer = 0; + + if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp))) + _M_len = INT_MAX / sizeof(_Tp); + + while (_M_len > 0) { + _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp)); + if (_M_buffer) + break; + _M_len /= 2; + } + } + + void _M_initialize_buffer(const _Tp&, const __true_type&) {} + void _M_initialize_buffer(const _Tp& val, const __false_type&) { + uninitialized_fill_n(_M_buffer, _M_len, val); + } + +public: + ptrdiff_t size() const { return _M_len; } + ptrdiff_t requested_size() const { return _M_original_len; } + _Tp* begin() { return _M_buffer; } + _Tp* end() { return _M_buffer + _M_len; } + + _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) { + // Workaround for a __type_traits bug in the pre-7.3 compiler. +# if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730 + typedef typename __type_traits<_Tp>::is_POD_type _Trivial; +# else + typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Trivial; +# endif + _STLP_TRY { + _M_len = _STLP_STD::distance(__first, __last); + _M_allocate_buffer(); + if (_M_len > 0) + _M_initialize_buffer(*__first, _Trivial()); + } + _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0) + } + + ~_Temporary_buffer() { + _STLP_STD::_Destroy_Range(_M_buffer, _M_buffer + _M_len); + free(_M_buffer); + } + +private: + // Disable copy constructor and assignment operator. + _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {} + void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {} +}; + +# ifndef _STLP_NO_EXTENSIONS + +// Class temporary_buffer is not part of the standard. It is an extension. + +template ::value_type +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + > +struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> +{ + temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) + : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {} + ~temporary_buffer() {} +}; + +# endif /* _STLP_NO_EXTENSIONS */ + +_STLP_END_NAMESPACE + +# ifndef _STLP_LINK_TIME_INSTANTIATION +# include +# endif + +#endif /* _STLP_INTERNAL_TEMPBUF_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_threads.c b/sdk/tlibstdcxx/stlport/stl/_threads.c new file mode 100644 index 0000000000..ea3c0b9c61 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_threads.c @@ -0,0 +1,167 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_THREADS_C +#define _STLP_THREADS_C + +#ifndef _STLP_INTERNAL_THREADS_H +# include +#endif + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) + +#if defined (_STLP_SGI_THREADS) +# include +#elif defined (_STLP_UNIX) +# ifndef _STLP_INTERNAL_CTIME +# include +# endif +# if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_VENDOR_GLOBAL_CSTD) +using _STLP_VENDOR_CSTD::time_t; +# endif +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_USE_ATOMIC_SWAP_MUTEX) +template +_STLP_STATIC_MUTEX +_Atomic_swap_struct<__32bits>::_S_swap_lock _STLP_MUTEX_INITIALIZER; +# undef _STLP_USE_ATOMIC_SWAP_MUTEX +#endif + +#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) +template +unsigned _STLP_mutex_spin<__inst>::__max = _STLP_mutex_spin<__inst>::__low_max; + +template +unsigned _STLP_mutex_spin<__inst>::__last = 0; +#endif // _STLP_USE_PTHREAD_SPINLOCK + +#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) + +# if defined (_STLP_SPARC_SOLARIS_THREADS) +// underground function in libc.so; we do not want dependance on librt +extern "C" int __nanosleep(const struct timespec*, struct timespec*); +# define _STLP_NANOSLEEP __nanosleep +# else +# define _STLP_NANOSLEEP nanosleep +# endif + +template +void _STLP_CALL +_STLP_mutex_spin<__inst>::_S_nsec_sleep(int __log_nsec, unsigned int& __iteration) { +# if defined (_STLP_WIN32THREADS) +# if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400) + if (__iteration <= 4000) { + // Use SwitchToThread because + // 1) Sleep(1) often takes ~15 ms + // 2) SwitchToThread yields to lower-priority threads + // 4000 is enough to avoid Sleep and is used just to prevent infinite looping + // This number is advised spin count for Heap management by Microsoft + SwitchToThread(); + } else { +# endif + if (__log_nsec <= 21) { + /* Note from boost (www.boost.org): + * Changed from Sleep(0) to Sleep(1). + * According to MSDN, Sleep(0) will never yield to a lower-priority thread, + * whereas Sleep(1) will. Performance seems not to be affected. */ + Sleep(1); + } else { + Sleep(1 << (__log_nsec - 20)); + } +# if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400) + __iteration = 0; //reset to avoid sleeps sequence + } +# endif +# elif defined(_STLP_OS2THREADS) + if (__log_nsec <= 20) { + DosSleep(0); + } else { + DosSleep(1 << (__log_nsec - 20)); + } +# elif defined (_STLP_UNIX) + timespec __ts; + /* Max sleep is 2**27nsec ~ 60msec */ + __ts.tv_sec = 0; + __ts.tv_nsec = 1 << __log_nsec; + _STLP_NANOSLEEP(&__ts, 0); +# endif +} + +template +void _STLP_CALL +_STLP_mutex_spin<__inst>::_M_do_lock(volatile __stl_atomic_t* __lock) { +# if defined(_STLP_ATOMIC_EXCHANGE) + if (_Atomic_swap(__lock, 1)) { + unsigned __my_spin_max = _STLP_mutex_spin<0>::__max; + unsigned __my_last_spins = _STLP_mutex_spin<0>::__last; + volatile unsigned __junk = 17; // Value doesn't matter. + unsigned __i; + + for (__i = 0; __i < __my_spin_max; ++__i) { + if (__i < __my_last_spins/2 || *__lock) { + __junk *= __junk; __junk *= __junk; + __junk *= __junk; __junk *= __junk; + } else { + if (!_Atomic_swap(__lock, 1)) { + // got it! + // Spinning worked. Thus we're probably not being scheduled + // against the other process with which we were contending. + // Thus it makes sense to spin longer the next time. + _STLP_mutex_spin<0>::__last = __i; + _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__high_max; + return; + } + } + } + + // We are probably being scheduled against the other process. Sleep. + _STLP_mutex_spin<0>::__max = _STLP_mutex_spin<0>::__low_max; + + for (__i = 0 ;; ++__i) { + int __log_nsec = __i + 6; + + if (__log_nsec > 27) __log_nsec = 27; + if (!_Atomic_swap(__lock, 1)) { + break; + } + _S_nsec_sleep(__log_nsec, __i); + } + } /* first _Atomic_swap */ +# endif +} +#endif // _STLP_USE_PTHREAD_SPINLOCK + +_STLP_END_NAMESPACE + +#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ +#endif /* _STLP_THREADS_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_threads.h b/sdk/tlibstdcxx/stlport/stl/_threads.h new file mode 100644 index 0000000000..8bf3c6ccae --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_threads.h @@ -0,0 +1,687 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_THREADS_H +#define _STLP_INTERNAL_THREADS_H + +// Supported threading models are native SGI, pthreads, uithreads +// (similar to pthreads, but based on an earlier draft of the Posix +// threads standard), and Win32 threads. Uithread support by Jochen +// Schlick, 1999, and Solaris threads generalized to them. + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +#ifndef _STLP_INTERNAL_CSTDLIB +# include +#endif + +// On SUN and Mac OS X gcc, zero-initialization works just fine... +#if defined (__sun) || (defined (__GNUC__) && defined(__APPLE__)) +# define _STLP_MUTEX_INITIALIZER +#endif + +/* This header defines the following atomic operation that platform should + * try to support as much as possible. Atomic operation are exposed as macro + * in order to easily test for their existance. They are: + * __stl_atomic_t _STLP_ATOMIC_INCREMENT(volatile __stl_atomic_t* __ptr) : + * increment *__ptr by 1 and returns the new value + * __stl_atomic_t _STLP_ATOMIC_DECREMENT(volatile __stl_atomic_t* __ptr) : + * decrement *__ptr by 1 and returns the new value + * __stl_atomic_t _STLP_ATOMIC_EXCHANGE(volatile __stl_atomic_t* __target, __stl_atomic_t __val) : + * assign __val to *__target and returns former *__target value + * void* _STLP_ATOMIC_EXCHANGE_PTR(void* volatile* __target, void* __ptr) : + * assign __ptr to *__target and returns former *__target value + */ + +#if defined (_STLP_THREADS) + +# if defined (_STLP_SGI_THREADS) + +# include +// Hack for SGI o32 compilers. +# if !defined(__add_and_fetch) && \ + (__mips < 3 || !(defined (_ABIN32) || defined(_ABI64))) +# define __add_and_fetch(__l,__v) add_then_test((unsigned long*)__l,__v) +# define __test_and_set(__l,__v) test_and_set(__l,__v) +# endif /* o32 */ + +# if __mips < 3 || !(defined (_ABIN32) || defined(_ABI64)) +# define _STLP_ATOMIC_EXCHANGE(__p, __q) test_and_set(__p, __q) +# else +# define _STLP_ATOMIC_EXCHANGE(__p, __q) __test_and_set((unsigned long*)__p, (unsigned long)__q) +# endif + +# define _STLP_ATOMIC_INCREMENT(__x) __add_and_fetch(__x, 1) +# define _STLP_ATOMIC_DECREMENT(__x) __add_and_fetch(__x, (size_t) -1) +typedef long __stl_atomic_t; + +# elif defined (_STLP_PTHREADS) + +# include +# if !defined (_STLP_USE_PTHREAD_SPINLOCK) +# if defined (PTHREAD_MUTEX_INITIALIZER) && !defined (_STLP_MUTEX_INITIALIZER) && defined (_REENTRANT) +# define _STLP_MUTEX_INITIALIZER = { PTHREAD_MUTEX_INITIALIZER } +# endif +//HPUX variants have (on some platforms optional) non-standard "DCE" pthreads impl +# if defined (_DECTHREADS_) && (defined (_PTHREAD_USE_D4) || defined (__hpux)) && !defined (_CMA_SUPPRESS_EXTERNALS_) +# define _STLP_PTHREAD_ATTR_DEFAULT pthread_mutexattr_default +# else +# define _STLP_PTHREAD_ATTR_DEFAULT 0 +# endif +# else +# if defined (__OpenBSD__) +# include +# endif +# endif + +# if defined (__GNUC__) && defined (__i386__) +# if !defined (_STLP_ATOMIC_INCREMENT) +inline long _STLP_atomic_increment_gcc_x86(long volatile* p) { + long result; + __asm__ __volatile__ + ("lock; xaddl %1, %0;" + :"=m" (*p), "=r" (result) + :"m" (*p), "1" (1) + :"cc"); + return result + 1; +} +# define _STLP_ATOMIC_INCREMENT(__x) (_STLP_atomic_increment_gcc_x86((long volatile*)__x)) +# endif + +# if !defined (_STLP_ATOMIC_DECREMENT) +inline long _STLP_atomic_decrement_gcc_x86(long volatile* p) { + long result; + __asm__ __volatile__ + ("lock; xaddl %1, %0;" + :"=m" (*p), "=r" (result) + :"m" (*p), "1" (-1) + :"cc"); + return result - 1; +} +# define _STLP_ATOMIC_DECREMENT(__x) (_STLP_atomic_decrement_gcc_x86((long volatile*)__x)) +# endif +typedef long __stl_atomic_t; +# else +typedef size_t __stl_atomic_t; +# endif /* if defined(__GNUC__) && defined(__i386__) */ + +# elif defined (_STLP_WIN32THREADS) + +# if !defined (_STLP_ATOMIC_INCREMENT) +# if !defined (_STLP_NEW_PLATFORM_SDK) +# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__CONST_CAST(long*, __x)) +# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__CONST_CAST(long*, __x)) +# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__CONST_CAST(long*, __x), __y) +# else +# define _STLP_ATOMIC_INCREMENT(__x) InterlockedIncrement(__x) +# define _STLP_ATOMIC_DECREMENT(__x) InterlockedDecrement(__x) +# define _STLP_ATOMIC_EXCHANGE(__x, __y) InterlockedExchange(__x, __y) +# endif +# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) STLPInterlockedExchangePointer(__x, __y) +# endif +typedef long __stl_atomic_t; + +# elif defined (__DECC) || defined (__DECCXX) + +# include +# define _STLP_ATOMIC_EXCHANGE __ATOMIC_EXCH_LONG +# define _STLP_ATOMIC_INCREMENT(__x) __ATOMIC_ADD_LONG(__x, 1) +# define _STLP_ATOMIC_DECREMENT(__x) __ATOMIC_ADD_LONG(__x, -1) +typedef long __stl_atomic_t; + +# elif defined (_STLP_SPARC_SOLARIS_THREADS) + +typedef long __stl_atomic_t; +# include + +# elif defined (_STLP_UITHREADS) + +// this inclusion is potential hazard to bring up all sorts +// of old-style headers. Let's assume vendor already know how +// to deal with that. +# ifndef _STLP_INTERNAL_CTIME +# include +# endif +# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD) +using _STLP_VENDOR_CSTD::time_t; +# endif +# include +# ifndef _STLP_INTERNAL_CSTDIO +# include +# endif +# ifndef _STLP_INTERNAL_CWCHAR +# include +# endif +typedef size_t __stl_atomic_t; + +# elif defined (_STLP_BETHREADS) + +# include +# include +# include +# define _STLP_MUTEX_INITIALIZER = { 0 } +typedef size_t __stl_atomic_t; + +# elif defined (_STLP_NWTHREADS) + +# include +# include +typedef size_t __stl_atomic_t; + +# elif defined(_STLP_OS2THREADS) + +# if defined (__GNUC__) +# define INCL_DOSSEMAPHORES +# include +# else +// This section serves to replace os2.h for VisualAge C++ + typedef unsigned long ULONG; +# if !defined (__HEV__) /* INCL_SEMAPHORE may also define HEV */ +# define __HEV__ + typedef ULONG HEV; + typedef HEV* PHEV; +# endif + typedef ULONG APIRET; + typedef ULONG HMTX; + typedef HMTX* PHMTX; + typedef const char* PCSZ; + typedef ULONG BOOL32; + APIRET _System DosCreateMutexSem(PCSZ pszName, PHEV phev, ULONG flAttr, BOOL32 fState); + APIRET _System DosRequestMutexSem(HMTX hmtx, ULONG ulTimeout); + APIRET _System DosReleaseMutexSem(HMTX hmtx); + APIRET _System DosCloseMutexSem(HMTX hmtx); +# define _STLP_MUTEX_INITIALIZER = { 0 } +# endif /* GNUC */ +typedef size_t __stl_atomic_t; + +# else + +typedef size_t __stl_atomic_t; + +# endif + +#else +/* no threads */ +# define _STLP_ATOMIC_INCREMENT(__x) ++(*__x) +# define _STLP_ATOMIC_DECREMENT(__x) --(*__x) +/* We do not grant other atomic operations as they are useless if STLport do not have + * to be thread safe + */ +typedef size_t __stl_atomic_t; +#endif + +#if !defined (_STLP_MUTEX_INITIALIZER) +# if defined(_STLP_ATOMIC_EXCHANGE) +# define _STLP_MUTEX_INITIALIZER = { 0 } +# elif defined(_STLP_UITHREADS) +# define _STLP_MUTEX_INITIALIZER = { DEFAULTMUTEX } +# else +# define _STLP_MUTEX_INITIALIZER +# endif +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_THREADS) && !defined (_STLP_USE_PTHREAD_SPINLOCK) +// Helper struct. This is a workaround for various compilers that don't +// handle static variables in inline functions properly. +template +struct _STLP_mutex_spin { + enum { __low_max = 30, __high_max = 1000 }; + // Low if we suspect uniprocessor, high for multiprocessor. + static unsigned __max; + static unsigned __last; + static void _STLP_CALL _M_do_lock(volatile __stl_atomic_t* __lock); + static void _STLP_CALL _S_nsec_sleep(int __log_nsec, unsigned int& __iteration); +}; +#endif // !_STLP_USE_PTHREAD_SPINLOCK + +// Locking class. Note that this class *does not have a constructor*. +// It must be initialized either statically, with _STLP_MUTEX_INITIALIZER, +// or dynamically, by explicitly calling the _M_initialize member function. +// (This is similar to the ways that a pthreads mutex can be initialized.) +// There are explicit member functions for acquiring and releasing the lock. + +// There is no constructor because static initialization is essential for +// some uses, and only a class aggregate (see section 8.5.1 of the C++ +// standard) can be initialized that way. That means we must have no +// constructors, no base classes, no virtual functions, and no private or +// protected members. + +// For non-static cases, clients should use _STLP_mutex. + +struct _STLP_CLASS_DECLSPEC _STLP_mutex_base { +#if defined (_STLP_ATOMIC_EXCHANGE) || defined (_STLP_SGI_THREADS) + // It should be relatively easy to get this to work on any modern Unix. + volatile __stl_atomic_t _M_lock; +#endif + +#if defined (_STLP_THREADS) +# if defined (_STLP_ATOMIC_EXCHANGE) + inline void _M_initialize() { _M_lock = 0; } + inline void _M_destroy() {} + + void _M_acquire_lock() { + _STLP_mutex_spin<0>::_M_do_lock(&_M_lock); + } + + inline void _M_release_lock() { + volatile __stl_atomic_t* __lock = &_M_lock; +# if defined(_STLP_SGI_THREADS) && defined(__GNUC__) && __mips >= 3 + asm("sync"); + *__lock = 0; +# elif defined(_STLP_SGI_THREADS) && __mips >= 3 && \ + (defined (_ABIN32) || defined(_ABI64)) + __lock_release(__lock); +# elif defined (_STLP_SPARC_SOLARIS_THREADS) +# if defined (__WORD64) || defined (__arch64__) || defined (__sparcv9) || defined (__sparcv8plus) + asm("membar #StoreStore ; membar #LoadStore"); +# else + asm(" stbar "); +# endif + *__lock = 0; +# else + *__lock = 0; + // This is not sufficient on many multiprocessors, since + // writes to protected variables and the lock may be reordered. +# endif + } +# elif defined (_STLP_PTHREADS) +# if defined (_STLP_USE_PTHREAD_SPINLOCK) +# if !defined (__OpenBSD__) + pthread_spinlock_t _M_lock; + inline void _M_initialize() { pthread_spin_init( &_M_lock, 0 ); } + inline void _M_destroy() { pthread_spin_destroy( &_M_lock ); } + + // sorry, but no static initializer for pthread_spinlock_t; + // this will not work for compilers that has problems with call + // constructor of static object... + + // _STLP_mutex_base() + // { pthread_spin_init( &_M_lock, 0 ); } + + // ~_STLP_mutex_base() + // { pthread_spin_destroy( &_M_lock ); } + + inline void _M_acquire_lock() { pthread_spin_lock( &_M_lock ); } + inline void _M_release_lock() { pthread_spin_unlock( &_M_lock ); } +# else // __OpenBSD__ + sgx_spinlock_t _M_lock; + inline void _M_initialize() { _SPINLOCK_INIT( &_M_lock ); } + inline void _M_destroy() { } + inline void _M_acquire_lock() { _SPINLOCK( &_M_lock ); } + inline void _M_release_lock() { _SPINUNLOCK( &_M_lock ); } +# endif // __OpenBSD__ +# else // !_STLP_USE_PTHREAD_SPINLOCK + pthread_mutex_t _M_lock; + inline void _M_initialize() + { pthread_mutex_init(&_M_lock,_STLP_PTHREAD_ATTR_DEFAULT); } + inline void _M_destroy() + { pthread_mutex_destroy(&_M_lock); } + inline void _M_acquire_lock() { +# if defined ( __hpux ) && ! defined (PTHREAD_MUTEX_INITIALIZER) + if (!_M_lock.field1) _M_initialize(); +# endif + pthread_mutex_lock(&_M_lock); + } + inline void _M_release_lock() { pthread_mutex_unlock(&_M_lock); } +# endif // !_STLP_USE_PTHREAD_SPINLOCK + +# elif defined (_STLP_UITHREADS) + mutex_t _M_lock; + inline void _M_initialize() + { mutex_init(&_M_lock, 0, NULL); } + inline void _M_destroy() + { mutex_destroy(&_M_lock); } + inline void _M_acquire_lock() { mutex_lock(&_M_lock); } + inline void _M_release_lock() { mutex_unlock(&_M_lock); } + +# elif defined (_STLP_OS2THREADS) + HMTX _M_lock; + inline void _M_initialize() { DosCreateMutexSem(NULL, &_M_lock, 0, false); } + inline void _M_destroy() { DosCloseMutexSem(_M_lock); } + inline void _M_acquire_lock() { + if (!_M_lock) _M_initialize(); + DosRequestMutexSem(_M_lock, SEM_INDEFINITE_WAIT); + } + inline void _M_release_lock() { DosReleaseMutexSem(_M_lock); } +# elif defined (_STLP_BETHREADS) + sem_id sem; + inline void _M_initialize() { + sem = create_sem(1, "STLPort"); + assert(sem > 0); + } + inline void _M_destroy() { + int t = delete_sem(sem); + assert(t == B_NO_ERROR); + } + inline void _M_acquire_lock(); + inline void _M_release_lock() { + status_t t = release_sem(sem); + assert(t == B_NO_ERROR); + } +# elif defined (_STLP_NWTHREADS) + LONG _M_lock; + inline void _M_initialize() + { _M_lock = OpenLocalSemaphore(1); } + inline void _M_destroy() + { CloseLocalSemaphore(_M_lock); } + inline void _M_acquire_lock() + { WaitOnLocalSemaphore(_M_lock); } + inline void _M_release_lock() { SignalLocalSemaphore(_M_lock); } +# else //*ty 11/24/2001 - added configuration check +# error "Unknown thread facility configuration" +# endif +#else /* No threads */ + inline void _M_initialize() {} + inline void _M_destroy() {} + inline void _M_acquire_lock() {} + inline void _M_release_lock() {} +#endif // _STLP_PTHREADS +}; + +// Locking class. The constructor initializes the lock, the destructor destroys it. +// Well - behaving class, does not need static initializer + +class _STLP_CLASS_DECLSPEC _STLP_mutex : public _STLP_mutex_base { + public: + inline _STLP_mutex () { _M_initialize(); } + inline ~_STLP_mutex () { _M_destroy(); } + private: + _STLP_mutex(const _STLP_mutex&); + void operator=(const _STLP_mutex&); +}; + +// A locking class that uses _STLP_STATIC_MUTEX. The constructor takes +// a reference to an _STLP_STATIC_MUTEX, and acquires a lock. The destructor +// releases the lock. +// It's not clear that this is exactly the right functionality. +// It will probably change in the future. + +struct _STLP_CLASS_DECLSPEC _STLP_auto_lock { + _STLP_auto_lock(_STLP_STATIC_MUTEX& __lock) : _M_lock(__lock) + { _M_lock._M_acquire_lock(); } + ~_STLP_auto_lock() + { _M_lock._M_release_lock(); } + +private: + _STLP_STATIC_MUTEX& _M_lock; + void operator=(const _STLP_auto_lock&); + _STLP_auto_lock(const _STLP_auto_lock&); +}; + +/* + * Class _Refcount_Base provides a type, __stl_atomic_t, a data member, + * _M_ref_count, and member functions _M_incr and _M_decr, which perform + * atomic preincrement/predecrement. The constructor initializes + * _M_ref_count. + */ +class _STLP_CLASS_DECLSPEC _Refcount_Base { + // The data member _M_ref_count +#if defined (__DMC__) +public: +#endif + _STLP_VOLATILE __stl_atomic_t _M_ref_count; + +#if defined (_STLP_THREADS) && \ + (!defined (_STLP_ATOMIC_INCREMENT) || !defined (_STLP_ATOMIC_DECREMENT) || \ + defined (_STLP_WIN95_LIKE)) +# define _STLP_USE_MUTEX + _STLP_mutex _M_mutex; +#endif + + public: + // Constructor + _Refcount_Base(__stl_atomic_t __n) : _M_ref_count(__n) {} +#if defined (__BORLANDC__) + ~_Refcount_Base(){}; +#endif + + // _M_incr and _M_decr +#if defined (_STLP_THREADS) +# if !defined (_STLP_USE_MUTEX) + __stl_atomic_t _M_incr() { return _STLP_ATOMIC_INCREMENT(&_M_ref_count); } + __stl_atomic_t _M_decr() { return _STLP_ATOMIC_DECREMENT(&_M_ref_count); } +# else +# undef _STLP_USE_MUTEX + __stl_atomic_t _M_incr() { + _STLP_auto_lock l(_M_mutex); + return ++_M_ref_count; + } + __stl_atomic_t _M_decr() { + _STLP_auto_lock l(_M_mutex); + return --_M_ref_count; + } +# endif +#else /* No threads */ + __stl_atomic_t _M_incr() { return ++_M_ref_count; } + __stl_atomic_t _M_decr() { return --_M_ref_count; } +#endif +}; + +/* Atomic swap on __stl_atomic_t + * This is guaranteed to behave as though it were atomic only if all + * possibly concurrent updates use _Atomic_swap. + * In some cases the operation is emulated with a lock. + * Idem for _Atomic_swap_ptr + */ +/* Helper struct to handle following cases: + * - on platforms where sizeof(__stl_atomic_t) == sizeof(void*) atomic + * exchange can be done on pointers + * - on platform without atomic operation swap is done in a critical section, + * portable but inefficient. + */ +template +class _Atomic_swap_struct { +public: +#if defined (_STLP_THREADS) && \ + !defined (_STLP_ATOMIC_EXCHANGE) && \ + (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \ + defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS)) +# define _STLP_USE_ATOMIC_SWAP_MUTEX + static _STLP_STATIC_MUTEX _S_swap_lock; +#endif + + static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) { +#if defined (_STLP_THREADS) +# if defined (_STLP_ATOMIC_EXCHANGE) + return _STLP_ATOMIC_EXCHANGE(__p, __q); +# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) + _S_swap_lock._M_acquire_lock(); + __stl_atomic_t __result = *__p; + *__p = __q; + _S_swap_lock._M_release_lock(); + return __result; +# else +# error Missing atomic swap implementation +# endif +#else + /* no threads */ + __stl_atomic_t __result = *__p; + *__p = __q; + return __result; +#endif // _STLP_THREADS + } + + static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) { +#if defined (_STLP_THREADS) +# if defined (_STLP_ATOMIC_EXCHANGE_PTR) + return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q); +# elif defined (_STLP_ATOMIC_EXCHANGE) + _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*)) + return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p), + __REINTERPRET_CAST(__stl_atomic_t, __q)) + ); +# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) + _S_swap_lock._M_acquire_lock(); + void *__result = *__p; + *__p = __q; + _S_swap_lock._M_release_lock(); + return __result; +# else +# error Missing pointer atomic swap implementation +# endif +#else + /* no thread */ + void *__result = *__p; + *__p = __q; + return __result; +#endif + } +}; + +_STLP_TEMPLATE_NULL +class _Atomic_swap_struct<0> { +public: +#if defined (_STLP_THREADS) && \ + (!defined (_STLP_ATOMIC_EXCHANGE) || !defined (_STLP_ATOMIC_EXCHANGE_PTR)) && \ + (defined (_STLP_PTHREADS) || defined (_STLP_UITHREADS) || defined (_STLP_OS2THREADS) || \ + defined (_STLP_USE_PTHREAD_SPINLOCK) || defined (_STLP_NWTHREADS)) +# define _STLP_USE_ATOMIC_SWAP_MUTEX + static _STLP_STATIC_MUTEX _S_swap_lock; +#endif + + static __stl_atomic_t _S_swap(_STLP_VOLATILE __stl_atomic_t* __p, __stl_atomic_t __q) { +#if defined (_STLP_THREADS) +# if defined (_STLP_ATOMIC_EXCHANGE) + return _STLP_ATOMIC_EXCHANGE(__p, __q); +# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) + /* This should be portable, but performance is expected + * to be quite awful. This really needs platform specific + * code. + */ + _S_swap_lock._M_acquire_lock(); + __stl_atomic_t __result = *__p; + *__p = __q; + _S_swap_lock._M_release_lock(); + return __result; +# else +# error Missing atomic swap implementation +# endif +#else + /* no threads */ + __stl_atomic_t __result = *__p; + *__p = __q; + return __result; +#endif // _STLP_THREADS + } + + static void* _S_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) { +#if defined (_STLP_THREADS) +# if defined (_STLP_ATOMIC_EXCHANGE_PTR) + return _STLP_ATOMIC_EXCHANGE_PTR(__p, __q); +# elif defined (_STLP_ATOMIC_EXCHANGE) + _STLP_STATIC_ASSERT(sizeof(__stl_atomic_t) == sizeof(void*)) + return __REINTERPRET_CAST(void*, _STLP_ATOMIC_EXCHANGE(__REINTERPRET_CAST(volatile __stl_atomic_t*, __p), + __REINTERPRET_CAST(__stl_atomic_t, __q)) + ); +# elif defined (_STLP_USE_ATOMIC_SWAP_MUTEX) + _S_swap_lock._M_acquire_lock(); + void *__result = *__p; + *__p = __q; + _S_swap_lock._M_release_lock(); + return __result; +# else +# error Missing pointer atomic swap implementation +# endif +#else + /* no thread */ + void *__result = *__p; + *__p = __q; + return __result; +#endif + } +}; + +#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300) +# pragma warning (push) +# pragma warning (disable : 4189) //__use_ptr_atomic_swap initialized but not used +#endif + +inline __stl_atomic_t _STLP_CALL _Atomic_swap(_STLP_VOLATILE __stl_atomic_t * __p, __stl_atomic_t __q) { + const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*); + return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap(__p, __q); +} + +inline void* _STLP_CALL _Atomic_swap_ptr(void* _STLP_VOLATILE* __p, void* __q) { + const int __use_ptr_atomic_swap = sizeof(__stl_atomic_t) == sizeof(void*); + return _Atomic_swap_struct<__use_ptr_atomic_swap>::_S_swap_ptr(__p, __q); +} + +#if defined (_STLP_MSVC) && (_STLP_MSVC == 1300) +# pragma warning (pop) +#endif + +#if defined (_STLP_BETHREADS) +template +struct _STLP_beos_static_lock_data { + static bool is_init; + struct mutex_t : public _STLP_mutex { + mutex_t() + { _STLP_beos_static_lock_data<0>::is_init = true; } + ~mutex_t() + { _STLP_beos_static_lock_data<0>::is_init = false; } + }; + static mutex_t mut; +}; + +template +bool _STLP_beos_static_lock_data<__inst>::is_init = false; +template +typename _STLP_beos_static_lock_data<__inst>::mutex_t _STLP_beos_static_lock_data<__inst>::mut; + +inline void _STLP_mutex_base::_M_acquire_lock() { + if (sem == 0) { + // we need to initialise on demand here + // to prevent race conditions use our global + // mutex if it's available: + if (_STLP_beos_static_lock_data<0>::is_init) { + _STLP_auto_lock al(_STLP_beos_static_lock_data<0>::mut); + if (sem == 0) _M_initialize(); + } + else { + // no lock available, we must still be + // in startup code, THERE MUST BE ONE THREAD + // ONLY active at this point. + _M_initialize(); + } + } + status_t t; + t = acquire_sem(sem); + assert(t == B_NO_ERROR); +} +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_THREADS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_time_facets.c b/sdk/tlibstdcxx/stlport/stl/_time_facets.c new file mode 100644 index 0000000000..f403817a12 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_time_facets.c @@ -0,0 +1,441 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_TIME_FACETS_C +#define _STLP_TIME_FACETS_C + +#ifndef _STLP_INTERNAL_TIME_FACETS_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUM_PUT_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUM_GET_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Declarations of static template members. + +template +locale::id time_get<_CharT, _InputIterator>::id; + +template +locale::id time_put<_CharT, _OutputIterator>::id; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +/* Matching input against a list of names + + * Alphabetic input of the names of months and the names + * of weekdays requires matching input against a list of names. + * We use a simple generic algorithm to accomplish this. This + * algorithm is not very efficient, especially for longer lists + * of names, but it probably does not matter for the initial + * implementation and it may never matter, since we do not expect + * this kind of input to be used very often. The algorithm + * could be improved fairly simply by creating a new list of + * names still in the running at each iteration. A more sophisticated + * approach would be to build a tree to do the matching. + * + * We compare each character of the input to the corresponding + * character of each name on the list that has not been eliminated, + * either because every character in the name has already been + * matched, or because some character has not been matched. We + * continue only as long as there are some names that have not been + * eliminated. + + * We do not really need a random access iterator (a forward iterator + * would do), but the extra generality makes the notation clumsier, + * and we don't really need it. + + * We can recognize a failed match by the fact that the return value + * will be __name_end. + */ + +#define _MAXNAMES 24 + +template +size_t _STLP_CALL +__match(_InIt& __first, _InIt& __last, _NameIt __name, _NameIt __name_end) { + typedef ptrdiff_t difference_type; + difference_type __n = __name_end - __name; + difference_type __i, __start = 0; + size_t __pos = 0; + difference_type __check_count = __n; + bool __do_not_check[_MAXNAMES]; + size_t __matching_name_index = __n; + + memset(__do_not_check, 0, sizeof(__do_not_check)); + + while (__first != __last) { + difference_type __new_n = __n; + for (__i = __start; __i < __n; ++__i) { + if (!__do_not_check[__i]) { + if (*__first == __name[__i][__pos]) { + if (__pos == (__name[__i].size() - 1)) { + __matching_name_index = __i; + __do_not_check[__i] = true; + if (__i == __start) ++__start; + --__check_count; + if (__check_count == 0) { + ++__first; + return __matching_name_index; + } + } + __new_n = __i + 1; + } + else { + __do_not_check[__i] = true; + if (__i == __start) ++__start; + --__check_count; + if (__check_count == 0) + return __matching_name_index; + } + } + else { + if (__i == __start) ++ __start; + } + } + + __n = __new_n; + ++__first; ++__pos; + } + + return __matching_name_index; +} + +// __get_formatted_time reads input that is assumed to be formatted +// according to the rules for the C strftime function (C standard, +// 7.12.3.5). This function is used to implement the do_get_time +// and do_get_date virtual functions, which depend on the locale +// specifications for the time and day formats respectively. +// Note the catchall default case, intended mainly for the '%Z' +// format designator, which does not make sense here since the +// representation of timezones is not part of the locale. +// +// The case branches are implemented either by doing a match using +// the appopriate name table or by doing a __get_integer_nogroup. +// +// 'y' format is assumed to mean that the input represents years +// since 1900. That is, 2002 should be represented as 102. There +// is no century-guessing. +// +// The match is successful if and only if the second component of the +// return value is format_end. + +// Note that the antepenultimate parameter is being used only to determine +// the correct overloading for the calls to __get_integer_nogroup. +template +string::const_iterator _STLP_CALL +__get_formatted_time _STLP_WEAK (_InIt1 __first, _InIt1 __last, + string::const_iterator __format, string::const_iterator __format_end, + _Ch*, const _TimeInfo& __table, + const ios_base& __s, ios_base::iostate& __err, tm* __t) { + const ctype<_Ch>& __ct = use_facet >(__s.getloc()); + typedef basic_string<_Ch, char_traits<_Ch>, allocator<_Ch> > string_type; + size_t offset; + + while (__first != __last && __format != __format_end) { + offset = 0; + if (*__format == '%') { + ++__format; + char __c = *__format; + if (__c == '#') { //MS extension + ++__format; + __c = *__format; + } + + switch (__c) { + case 'A': + offset = 7; + case 'a': { + size_t __index = __match(__first, __last, + __table._M_dayname + offset, __table._M_dayname + offset + 7); + if (__index == 7) + return __format; + __t->tm_wday = __STATIC_CAST(int, __index); + break; + } + + case 'B': + offset = 12; + case 'b': { + size_t __index = __match(__first, __last, + __table._M_monthname + offset, __table._M_monthname + offset + 12); + if (__index == 12) + return __format; + __t->tm_mon = __STATIC_CAST(int, __index); + break; + } + + case 'd': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_mday, __STATIC_CAST(_Ch*, 0)); + if (!__pr || __t->tm_mday < 1 || __t->tm_mday > 31) { + __err |= ios_base::failbit; + return __format; + } + break; + } + + case 'H': case 'I': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_hour, __STATIC_CAST(_Ch*, 0)); + if (!__pr) + return __format; + break; + } + + case 'j': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_yday, __STATIC_CAST(_Ch*, 0)); + if (!__pr) + return __format; + break; + } + + case 'm': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_mon, __STATIC_CAST(_Ch*, 0)); + --__t->tm_mon; + if (!__pr || __t->tm_mon < 0 || __t->tm_mon > 11) { + __err |= ios_base::failbit; + return __format; + } + break; + } + + case 'M': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_min, __STATIC_CAST(_Ch*, 0)); + if (!__pr) + return __format; + break; + } + + case 'p': { + size_t __index = __match(__first, __last, + __table._M_am_pm + 0, __table._M_am_pm + 2); + if (__index == 2) + return __format; + // 12:00 PM <=> 12:00, 12:00 AM <=> 00:00 + if (__index == 1 && __t->tm_hour != 12 ) + __t->tm_hour += 12; + if (__index == 0 && __t->tm_hour == 12 ) + __t->tm_hour = 0; + break; + } + + case 'S': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_sec, __STATIC_CAST(_Ch*, 0)); + if (!__pr) + return __format; + break; + } + + case 'y': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0)); + if (!__pr) + return __format; + break; + } + + case 'Y': { + bool __pr = __get_decimal_integer(__first, __last, __t->tm_year, __STATIC_CAST(_Ch*, 0)); + __t->tm_year -= 1900; + if (!__pr) + return __format; + break; + } + + default: + break; + } + } + else { + if (*__first++ != __ct.widen(*__format)) break; + } + + ++__format; + } + + return __format; +} + +template +bool _STLP_CALL +__get_short_or_long_dayname(_InIt& __first, _InIt& __last, const _TimeInfo& __table, tm* __t) { + size_t __index = __match(__first, __last, __table._M_dayname + 0, __table._M_dayname + 14); + if (__index != 14) { + __t->tm_wday = __STATIC_CAST(int, __index % 7); + return true; + } + return false; +} + +template +bool _STLP_CALL +__get_short_or_long_monthname(_InIt& __first, _InIt& __last, const _TimeInfo& __table, tm* __t) { + size_t __index = __match(__first, __last, __table._M_monthname + 0, __table._M_monthname + 24); + if (__index != 24) { + __t->tm_mon = __STATIC_CAST(int, __index % 12); + return true; + } + return false; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +_InIt +time_get<_Ch, _InIt>::do_get_date(_InIt __s, _InIt __end, + ios_base& __str, ios_base::iostate& __err, + tm* __t) const { + typedef string::const_iterator string_iterator; + + string_iterator __format = this->_M_timeinfo._M_date_format.begin(); + string_iterator __format_end = this->_M_timeinfo._M_date_format.end(); + + string_iterator __result + = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end, + __STATIC_CAST(_Ch*, 0), this->_M_timeinfo, + __str, __err, __t); + if (__result == __format_end) + __err = ios_base::goodbit; + else { + __err = ios_base::failbit; + if (__s == __end) + __err |= ios_base::eofbit; + } + return __s; +} + +template +_InIt +time_get<_Ch, _InIt>::do_get_time(_InIt __s, _InIt __end, + ios_base& __str, ios_base::iostate& __err, + tm* __t) const { + typedef string::const_iterator string_iterator; + string_iterator __format = this->_M_timeinfo._M_time_format.begin(); + string_iterator __format_end = this->_M_timeinfo._M_time_format.end(); + + string_iterator __result + = _STLP_PRIV __get_formatted_time(__s, __end, __format, __format_end, + __STATIC_CAST(_Ch*, 0), this->_M_timeinfo, + __str, __err, __t); + __err = __result == __format_end ? ios_base::goodbit + : ios_base::failbit; + if (__s == __end) + __err |= ios_base::eofbit; + return __s; +} + +template +_InIt +time_get<_Ch, _InIt>::do_get_year(_InIt __s, _InIt __end, + ios_base&, ios_base::iostate& __err, + tm* __t) const { + if (__s == __end) { + __err = ios_base::failbit | ios_base::eofbit; + return __s; + } + + bool __pr = _STLP_PRIV __get_decimal_integer(__s, __end, __t->tm_year, __STATIC_CAST(_Ch*, 0)); + __t->tm_year -= 1900; + __err = __pr ? ios_base::goodbit : ios_base::failbit; + if (__s == __end) + __err |= ios_base::eofbit; + + return __s; +} + +template +_InIt +time_get<_Ch, _InIt>::do_get_weekday(_InIt __s, _InIt __end, + ios_base &__str, ios_base::iostate &__err, + tm *__t) const { + bool __result = + _STLP_PRIV __get_short_or_long_dayname(__s, __end, this->_M_timeinfo, __t); + if (__result) + __err = ios_base::goodbit; + else { + __err = ios_base::failbit; + if (__s == __end) + __err |= ios_base::eofbit; + } + return __s; +} + +template +_InIt +time_get<_Ch, _InIt>::do_get_monthname(_InIt __s, _InIt __end, + ios_base &__str, ios_base::iostate &__err, + tm *__t) const { + bool __result = + _STLP_PRIV __get_short_or_long_monthname(__s, __end, this->_M_timeinfo, __t); + if (__result) + __err = ios_base::goodbit; + else { + __err = ios_base::failbit; + if (__s == __end) + __err |= ios_base::eofbit; + } + return __s; +} + +template +_OutputIter +time_put<_Ch,_OutputIter>::put(_OutputIter __s, ios_base& __f, _Ch __fill, + const tm* __tmb, const _Ch* __pat, + const _Ch* __pat_end) const { + const ctype<_Ch>& _Ct = use_facet >(__f.getloc()); + while (__pat != __pat_end) { + char __c = _Ct.narrow(*__pat, 0); + if (__c == '%') { + char __mod = 0; + ++__pat; + __c = _Ct.narrow(*__pat++, 0); + if (__c == '#') { // MS extension + __mod = __c; + __c = _Ct.narrow(*__pat++, 0); + } + __s = do_put(__s, __f, __fill, __tmb, __c, __mod); + } + else + *__s++ = *__pat++; + } + return __s; +} + +template +_OutputIter +time_put<_Ch,_OutputIter>::do_put(_OutputIter __s, ios_base& __f, _Ch /* __fill */, + const tm* __tmb, char __format, + char __modifier ) const { + const ctype<_Ch>& __ct = use_facet >(__f.getloc()); + _STLP_BASIC_IOSTRING(_Ch) __buf; + _STLP_PRIV __write_formatted_time(__buf, __ct, __format, __modifier, this->_M_timeinfo, __tmb); + return copy(__buf.begin(), __buf.end(), __s); +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_TIME_FACETS_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_time_facets.h b/sdk/tlibstdcxx/stlport/stl/_time_facets.h new file mode 100644 index 0000000000..e67c2f47a4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_time_facets.h @@ -0,0 +1,329 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +// WARNING: This is an internal header file, included by other C++ +// standard library headers. You should not attempt to use this header +// file directly. + + +#ifndef _STLP_INTERNAL_TIME_FACETS_H +#define _STLP_INTERNAL_TIME_FACETS_H + +#ifndef _STLP_INTERNAL_CTIME +# include // Needed (for struct tm) by time facets +#endif + +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_IOS_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_IOSTREAM_STRING_H +# include +#endif + +#ifndef _STLP_FACETS_FWD_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// Template functions used by time_get + +/* Both time_get and time_put need a structure of type _Time_Info + * to provide names and abbreviated names for months and days, + * as well as the am/pm designator. The month and weekday tables + * have the all the abbreviated names before all the full names. + * The _Time_Info tables are initialized using the non-template + * time_base class, which has a default constructor and two protected. + * The default one initialize _Time_Info with "C" time info. The + * protected initialize _time_Info using a _Locale_time instance + * or using a name( in fact the name is used to build a _Locale_time + * instance that is then used for initialization). */ + +class _STLP_CLASS_DECLSPEC _Time_Info_Base { +public: + string _M_time_format; + string _M_date_format; + string _M_date_time_format; + string _M_long_date_format; + string _M_long_date_time_format; +}; + +class _STLP_CLASS_DECLSPEC _Time_Info : public _Time_Info_Base { +public: + string _M_dayname[14]; + string _M_monthname[24]; + string _M_am_pm[2]; +}; + +#ifndef _STLP_NO_WCHAR_T +class _STLP_CLASS_DECLSPEC _WTime_Info : public _Time_Info_Base { +public: + wstring _M_dayname[14]; + wstring _M_monthname[24]; + wstring _M_am_pm[2]; +}; +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +class _STLP_CLASS_DECLSPEC time_base { +public: + enum dateorder {no_order, dmy, mdy, ymd, ydm}; +}; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class time_init; + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC time_init { +protected: + time_init(); + time_init(const char *name); + time_init(_Locale_time*); +#if defined (__BORLANDC__) + static +#endif + _Time_Info _M_timeinfo; + time_base::dateorder _M_dateorder; +}; + +#ifndef _STLP_NO_WCHAR_T +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC time_init { +protected: + time_init(); + time_init(const char *name); + time_init(_Locale_time*); +#if defined (__BORLANDC__) + static +#endif + _WTime_Info _M_timeinfo; + time_base::dateorder _M_dateorder; +}; +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +template +class time_get : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> { +public: + typedef _Ch char_type; + typedef _InIt iter_type; + + explicit time_get(size_t __refs = 0) : locale::facet(__refs) + {} + + dateorder date_order() const { return do_date_order(); } + iter_type get_time(iter_type __s, iter_type __end, ios_base& __str, + ios_base::iostate& __err, tm* __t) const + { return do_get_time(__s, __end, __str, __err, __t); } + iter_type get_date(iter_type __s, iter_type __end, ios_base& __str, + ios_base::iostate& __err, tm* __t) const + { return do_get_date(__s, __end, __str, __err, __t); } + iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str, + ios_base::iostate& __err, tm* __t) const + { return do_get_weekday(__s, __end, __str, __err, __t); } + iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str, + ios_base::iostate& __err, tm* __t) const + { return do_get_monthname(__s, __end, __str, __err, __t); } + iter_type get_year(iter_type __s, iter_type __end, ios_base& __str, + ios_base::iostate& __err, tm* __t) const + { return do_get_year(__s, __end, __str, __err, __t); } + + static locale::id id; + +protected: + time_get(const char* __name, size_t __refs) + : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name) + {} + time_get(_Locale_time *__time) + : _STLP_PRIV time_init<_Ch>(__time) + {} + + ~time_get() {} + + virtual dateorder do_date_order() const { return this->_M_dateorder; } + + virtual iter_type do_get_time(iter_type __s, iter_type __end, + ios_base&, ios_base::iostate& __err, + tm* __t) const; + + virtual iter_type do_get_date(iter_type __s, iter_type __end, + ios_base&, ios_base::iostate& __err, + tm* __t) const; + + virtual iter_type do_get_weekday(iter_type __s, iter_type __end, + ios_base&, + ios_base::iostate& __err, + tm* __t) const; + virtual iter_type do_get_monthname(iter_type __s, iter_type __end, + ios_base&, + ios_base::iostate& __err, + tm* __t) const; + + virtual iter_type do_get_year(iter_type __s, iter_type __end, + ios_base&, ios_base::iostate& __err, + tm* __t) const; +}; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_get_byname : public time_get<_Ch, _InIt> { + friend class _Locale_impl; +public: + typedef time_base::dateorder dateorder; + typedef _InIt iter_type; + + explicit time_get_byname(const char* __name, size_t __refs = 0) + : time_get<_Ch, _InIt>(__name, __refs) {} + +protected: + ~time_get_byname() {} + dateorder do_date_order() const { return this->_M_dateorder; } + +private: + time_get_byname(_Locale_time *__time) + : time_get<_Ch, _InIt>(__time) + {} + + typedef time_get_byname<_Ch, _InIt> _Self; + //explicitely defined as private to avoid warnings: + time_get_byname(_Self const&); + _Self& operator = (_Self const&); +}; + +// time_put facet + +// For the formats 'x, 'X', and 'c', do_put calls the first form of +// put with the pattern obtained from _M_timeinfo._M_date_format or +// _M_timeinfo._M_time_format. + +// Helper function: __ takes a single-character +// format. As indicated by the foregoing remark, this will never be +// 'x', 'X', or 'c'. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_DECLSPEC void _STLP_CALL +__write_formatted_time(__iostring&, const ctype& __ct, + char __format, char __modifier, + const _Time_Info& __table, const tm* __t); + +#ifndef _STLP_NO_WCHAR_T +_STLP_DECLSPEC void _STLP_CALL +__write_formatted_time(__iowstring&, const ctype& __ct, + char __format, char __modifier, + const _WTime_Info& __table, const tm* __t); +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +template +class time_put : public locale::facet, public time_base, public _STLP_PRIV time_init<_Ch> { +public: + typedef _Ch char_type; + typedef _OutIt iter_type; + + explicit time_put(size_t __refs = 0) : locale::facet(__refs) + {} + + _OutIt put(iter_type __s, ios_base& __f, _Ch __fill, + const tm* __tmb, + const _Ch* __pat, const _Ch* __pat_end) const; + + _OutIt put(iter_type __s, ios_base& __f, _Ch __fill, + const tm* __tmb, char __format, char __modifier = 0) const + { return do_put(__s, __f, __fill, __tmb, __format, __modifier); } + + static locale::id id; + +protected: + time_put(const char* __name, size_t __refs) + : locale::facet(__refs), _STLP_PRIV time_init<_Ch>(__name) + {} + time_put(_Locale_time *__time) + : _STLP_PRIV time_init<_Ch>(__time) + {} + ~time_put() {} + virtual iter_type do_put(iter_type __s, ios_base& __f, + char_type /* __fill */, const tm* __tmb, + char __format, char /* __modifier */) const; +}; + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_put_byname : public time_put<_Ch, _OutIt> { + friend class _Locale_impl; +public: + typedef time_base::dateorder dateorder; + typedef _OutIt iter_type; + typedef _Ch char_type; + + explicit time_put_byname(const char * __name, size_t __refs = 0) + : time_put<_Ch, _OutIt>(__name, __refs) + {} + +protected: + ~time_put_byname() {} + +private: + time_put_byname(_Locale_time *__time) + : time_put<_Ch, _OutIt>(__time) + {} + + typedef time_put_byname<_Ch, _OutIt> _Self; + //explicitely defined as private to avoid warnings: + time_put_byname(_Self const&); + _Self& operator = (_Self const&); +}; + +#if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS time_get > >; +_STLP_EXPORT_TEMPLATE_CLASS time_put > >; +# if !defined (_STLP_NO_WCHAR_T) +_STLP_EXPORT_TEMPLATE_CLASS time_get > >; +_STLP_EXPORT_TEMPLATE_CLASS time_put > >; +# endif + +#endif + +_STLP_END_NAMESPACE + +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* _STLP_INTERNAL_TIME_FACETS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_tree.c b/sdk/tlibstdcxx/stlport/stl/_tree.c new file mode 100644 index 0000000000..818fcc4acd --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_tree.c @@ -0,0 +1,730 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + * Modified CRP 7/10/00 for improved conformance / efficiency on insert_unique / + * insert_equal with valid hint -- efficiency is improved all around, and it is + * should now be standard conforming for complexity on insert point immediately + * after hint (amortized constant time). + * + */ +#ifndef _STLP_TREE_C +#define _STLP_TREE_C + +#ifndef _STLP_INTERNAL_TREE_H +# include +#endif + +#if defined (_STLP_DEBUG) +# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree) +#endif + +// fbp: these defines are for outline methods definitions. +// needed for definitions to be portable. Should not be used in method bodies. +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# define __iterator__ _Rb_tree_iterator<_Value, _STLP_HEADER_TYPENAME _Traits::_NonConstTraits> +# define __size_type__ size_t +# define iterator __iterator__ +#else +# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::iterator +# define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc>::size_type +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) + +template void _STLP_CALL +_Rb_global<_Dummy>::_Rotate_left(_Rb_tree_node_base* __x, + _Rb_tree_node_base*& __root) { + _Rb_tree_node_base* __y = __x->_M_right; + __x->_M_right = __y->_M_left; + if (__y->_M_left != 0) + __y->_M_left->_M_parent = __x; + __y->_M_parent = __x->_M_parent; + + if (__x == __root) + __root = __y; + else if (__x == __x->_M_parent->_M_left) + __x->_M_parent->_M_left = __y; + else + __x->_M_parent->_M_right = __y; + __y->_M_left = __x; + __x->_M_parent = __y; +} + +template void _STLP_CALL +_Rb_global<_Dummy>::_Rotate_right(_Rb_tree_node_base* __x, + _Rb_tree_node_base*& __root) { + _Rb_tree_node_base* __y = __x->_M_left; + __x->_M_left = __y->_M_right; + if (__y->_M_right != 0) + __y->_M_right->_M_parent = __x; + __y->_M_parent = __x->_M_parent; + + if (__x == __root) + __root = __y; + else if (__x == __x->_M_parent->_M_right) + __x->_M_parent->_M_right = __y; + else + __x->_M_parent->_M_left = __y; + __y->_M_right = __x; + __x->_M_parent = __y; +} + +template void _STLP_CALL +_Rb_global<_Dummy>::_Rebalance(_Rb_tree_node_base* __x, + _Rb_tree_node_base*& __root) { + __x->_M_color = _S_rb_tree_red; + while (__x != __root && __x->_M_parent->_M_color == _S_rb_tree_red) { + if (__x->_M_parent == __x->_M_parent->_M_parent->_M_left) { + _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_right; + if (__y && __y->_M_color == _S_rb_tree_red) { + __x->_M_parent->_M_color = _S_rb_tree_black; + __y->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + __x = __x->_M_parent->_M_parent; + } + else { + if (__x == __x->_M_parent->_M_right) { + __x = __x->_M_parent; + _Rotate_left(__x, __root); + } + __x->_M_parent->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + _Rotate_right(__x->_M_parent->_M_parent, __root); + } + } + else { + _Rb_tree_node_base* __y = __x->_M_parent->_M_parent->_M_left; + if (__y && __y->_M_color == _S_rb_tree_red) { + __x->_M_parent->_M_color = _S_rb_tree_black; + __y->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + __x = __x->_M_parent->_M_parent; + } + else { + if (__x == __x->_M_parent->_M_left) { + __x = __x->_M_parent; + _Rotate_right(__x, __root); + } + __x->_M_parent->_M_color = _S_rb_tree_black; + __x->_M_parent->_M_parent->_M_color = _S_rb_tree_red; + _Rotate_left(__x->_M_parent->_M_parent, __root); + } + } + } + __root->_M_color = _S_rb_tree_black; +} + +template _Rb_tree_node_base* _STLP_CALL +_Rb_global<_Dummy>::_Rebalance_for_erase(_Rb_tree_node_base* __z, + _Rb_tree_node_base*& __root, + _Rb_tree_node_base*& __leftmost, + _Rb_tree_node_base*& __rightmost) { + _Rb_tree_node_base* __y = __z; + _Rb_tree_node_base* __x; + _Rb_tree_node_base* __x_parent; + + if (__y->_M_left == 0) // __z has at most one non-null child. y == z. + __x = __y->_M_right; // __x might be null. + else { + if (__y->_M_right == 0) // __z has exactly one non-null child. y == z. + __x = __y->_M_left; // __x is not null. + else { // __z has two non-null children. Set __y to + __y = _Rb_tree_node_base::_S_minimum(__y->_M_right); // __z's successor. __x might be null. + __x = __y->_M_right; + } + } + + if (__y != __z) { // relink y in place of z. y is z's successor + __z->_M_left->_M_parent = __y; + __y->_M_left = __z->_M_left; + if (__y != __z->_M_right) { + __x_parent = __y->_M_parent; + if (__x) __x->_M_parent = __y->_M_parent; + __y->_M_parent->_M_left = __x; // __y must be a child of _M_left + __y->_M_right = __z->_M_right; + __z->_M_right->_M_parent = __y; + } + else + __x_parent = __y; + if (__root == __z) + __root = __y; + else if (__z->_M_parent->_M_left == __z) + __z->_M_parent->_M_left = __y; + else + __z->_M_parent->_M_right = __y; + __y->_M_parent = __z->_M_parent; + _STLP_STD::swap(__y->_M_color, __z->_M_color); + __y = __z; + // __y now points to node to be actually deleted + } + else { // __y == __z + __x_parent = __y->_M_parent; + if (__x) __x->_M_parent = __y->_M_parent; + if (__root == __z) + __root = __x; + else { + if (__z->_M_parent->_M_left == __z) + __z->_M_parent->_M_left = __x; + else + __z->_M_parent->_M_right = __x; + } + + if (__leftmost == __z) { + if (__z->_M_right == 0) // __z->_M_left must be null also + __leftmost = __z->_M_parent; + // makes __leftmost == _M_header if __z == __root + else + __leftmost = _Rb_tree_node_base::_S_minimum(__x); + } + if (__rightmost == __z) { + if (__z->_M_left == 0) // __z->_M_right must be null also + __rightmost = __z->_M_parent; + // makes __rightmost == _M_header if __z == __root + else // __x == __z->_M_left + __rightmost = _Rb_tree_node_base::_S_maximum(__x); + } + } + + if (__y->_M_color != _S_rb_tree_red) { + while (__x != __root && (__x == 0 || __x->_M_color == _S_rb_tree_black)) + if (__x == __x_parent->_M_left) { + _Rb_tree_node_base* __w = __x_parent->_M_right; + if (__w->_M_color == _S_rb_tree_red) { + __w->_M_color = _S_rb_tree_black; + __x_parent->_M_color = _S_rb_tree_red; + _Rotate_left(__x_parent, __root); + __w = __x_parent->_M_right; + } + if ((__w->_M_left == 0 || + __w->_M_left->_M_color == _S_rb_tree_black) && (__w->_M_right == 0 || + __w->_M_right->_M_color == _S_rb_tree_black)) { + __w->_M_color = _S_rb_tree_red; + __x = __x_parent; + __x_parent = __x_parent->_M_parent; + } else { + if (__w->_M_right == 0 || + __w->_M_right->_M_color == _S_rb_tree_black) { + if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black; + __w->_M_color = _S_rb_tree_red; + _Rotate_right(__w, __root); + __w = __x_parent->_M_right; + } + __w->_M_color = __x_parent->_M_color; + __x_parent->_M_color = _S_rb_tree_black; + if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black; + _Rotate_left(__x_parent, __root); + break; + } + } else { // same as above, with _M_right <-> _M_left. + _Rb_tree_node_base* __w = __x_parent->_M_left; + if (__w->_M_color == _S_rb_tree_red) { + __w->_M_color = _S_rb_tree_black; + __x_parent->_M_color = _S_rb_tree_red; + _Rotate_right(__x_parent, __root); + __w = __x_parent->_M_left; + } + if ((__w->_M_right == 0 || + __w->_M_right->_M_color == _S_rb_tree_black) && (__w->_M_left == 0 || + __w->_M_left->_M_color == _S_rb_tree_black)) { + __w->_M_color = _S_rb_tree_red; + __x = __x_parent; + __x_parent = __x_parent->_M_parent; + } else { + if (__w->_M_left == 0 || + __w->_M_left->_M_color == _S_rb_tree_black) { + if (__w->_M_right) __w->_M_right->_M_color = _S_rb_tree_black; + __w->_M_color = _S_rb_tree_red; + _Rotate_left(__w, __root); + __w = __x_parent->_M_left; + } + __w->_M_color = __x_parent->_M_color; + __x_parent->_M_color = _S_rb_tree_black; + if (__w->_M_left) __w->_M_left->_M_color = _S_rb_tree_black; + _Rotate_right(__x_parent, __root); + break; + } + } + if (__x) __x->_M_color = _S_rb_tree_black; + } + return __y; +} + +template _Rb_tree_node_base* _STLP_CALL +_Rb_global<_Dummy>::_M_decrement(_Rb_tree_node_base* _M_node) { + if (_M_node->_M_color == _S_rb_tree_red && _M_node->_M_parent->_M_parent == _M_node) + _M_node = _M_node->_M_right; + else if (_M_node->_M_left != 0) { + _M_node = _Rb_tree_node_base::_S_maximum(_M_node->_M_left); + } + else { + _Base_ptr __y = _M_node->_M_parent; + while (_M_node == __y->_M_left) { + _M_node = __y; + __y = __y->_M_parent; + } + _M_node = __y; + } + return _M_node; +} + +template _Rb_tree_node_base* _STLP_CALL +_Rb_global<_Dummy>::_M_increment(_Rb_tree_node_base* _M_node) { + if (_M_node->_M_right != 0) { + _M_node = _Rb_tree_node_base::_S_minimum(_M_node->_M_right); + } + else { + _Base_ptr __y = _M_node->_M_parent; + while (_M_node == __y->_M_right) { + _M_node = __y; + __y = __y->_M_parent; + } + // check special case: This is necessary if _M_node is the + // _M_head and the tree contains only a single node __y. In + // that case parent, left and right all point to __y! + if (_M_node->_M_right != __y) + _M_node = __y; + } + return _M_node; +} + +#endif /* _STLP_EXPOSE_GLOBALS_IMPLEMENTATION */ + + +template +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>& +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::operator=( + const _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>& __x) { + if (this != &__x) { + // Note that _Key may be a constant type. + clear(); + _M_node_count = 0; + _M_key_compare = __x._M_key_compare; + if (__x._M_root() == 0) { + _M_root() = 0; + _M_leftmost() = &this->_M_header._M_data; + _M_rightmost() = &this->_M_header._M_data; + } + else { + _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data); + _M_leftmost() = _S_minimum(_M_root()); + _M_rightmost() = _S_maximum(_M_root()); + _M_node_count = __x._M_node_count; + } + } + return *this; +} + +// CRP 7/10/00 inserted argument __on_right, which is another hint (meant to +// act like __on_left and ignore a portion of the if conditions -- specify +// __on_right != 0 to bypass comparison as false or __on_left != 0 to bypass +// comparison as true) +template +__iterator__ +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_insert(_Rb_tree_node_base * __parent, + const _Value& __val, + _Rb_tree_node_base * __on_left, + _Rb_tree_node_base * __on_right) { + // We do not create the node here as, depending on tests, we might call + // _M_key_compare that can throw an exception. + _Base_ptr __new_node; + + if ( __parent == &this->_M_header._M_data ) { + __new_node = _M_create_node(__val); + _S_left(__parent) = __new_node; // also makes _M_leftmost() = __new_node + _M_root() = __new_node; + _M_rightmost() = __new_node; + } + else if ( __on_right == 0 && // If __on_right != 0, the remainder fails to false + ( __on_left != 0 || // If __on_left != 0, the remainder succeeds to true + _M_key_compare( _KeyOfValue()(__val), _S_key(__parent) ) ) ) { + __new_node = _M_create_node(__val); + _S_left(__parent) = __new_node; + if (__parent == _M_leftmost()) + _M_leftmost() = __new_node; // maintain _M_leftmost() pointing to min node + } + else { + __new_node = _M_create_node(__val); + _S_right(__parent) = __new_node; + if (__parent == _M_rightmost()) + _M_rightmost() = __new_node; // maintain _M_rightmost() pointing to max node + } + _S_parent(__new_node) = __parent; + _Rb_global_inst::_Rebalance(__new_node, this->_M_header._M_data._M_parent); + ++_M_node_count; + return iterator(__new_node); +} + +template +__iterator__ +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(const _Value& __val) { + _Base_ptr __y = &this->_M_header._M_data; + _Base_ptr __x = _M_root(); + while (__x != 0) { + __y = __x; + if (_M_key_compare(_KeyOfValue()(__val), _S_key(__x))) { + __x = _S_left(__x); + } + else + __x = _S_right(__x); + } + return _M_insert(__y, __val, __x); +} + + +template +pair<__iterator__, bool> +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(const _Value& __val) { + _Base_ptr __y = &this->_M_header._M_data; + _Base_ptr __x = _M_root(); + bool __comp = true; + while (__x != 0) { + __y = __x; + __comp = _M_key_compare(_KeyOfValue()(__val), _S_key(__x)); + __x = __comp ? _S_left(__x) : _S_right(__x); + } + iterator __j = iterator(__y); + if (__comp) { + if (__j == begin()) + return pair(_M_insert(__y, __val, /* __x*/ __y), true); + else + --__j; + } + if (_M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__val))) { + return pair(_M_insert(__y, __val, __x), true); + } + return pair(__j, false); +} + +// Modifications CRP 7/10/00 as noted to improve conformance and +// efficiency. +template +__iterator__ +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_unique(iterator __position, + const _Value& __val) { + if (__position._M_node == this->_M_header._M_data._M_left) { // begin() + + // if the container is empty, fall back on insert_unique. + if (empty()) + return insert_unique(__val).first; + + if (_M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node))) { + return _M_insert(__position._M_node, __val, __position._M_node); + } + // first argument just needs to be non-null + else { + bool __comp_pos_v = _M_key_compare( _S_key(__position._M_node), _KeyOfValue()(__val) ); + + if (__comp_pos_v == false) // compare > and compare < both false so compare equal + return __position; + //Below __comp_pos_v == true + + // Standard-conformance - does the insertion point fall immediately AFTER + // the hint? + iterator __after = __position; + ++__after; + + // Check for only one member -- in that case, __position points to itself, + // and attempting to increment will cause an infinite loop. + if (__after._M_node == &this->_M_header._M_data) + // Check guarantees exactly one member, so comparison was already + // performed and we know the result; skip repeating it in _M_insert + // by specifying a non-zero fourth argument. + return _M_insert(__position._M_node, __val, 0, __position._M_node); + + // All other cases: + + // Optimization to catch insert-equivalent -- save comparison results, + // and we get this for free. + if (_M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) )) { + if (_S_right(__position._M_node) == 0) + return _M_insert(__position._M_node, __val, 0, __position._M_node); + else + return _M_insert(__after._M_node, __val, __after._M_node); + } + else { + return insert_unique(__val).first; + } + } + } + else if (__position._M_node == &this->_M_header._M_data) { // end() + if (_M_key_compare(_S_key(_M_rightmost()), _KeyOfValue()(__val))) { + // pass along to _M_insert that it can skip comparing + // v, Key ; since compare Key, v was true, compare v, Key must be false. + return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null + } + else + return insert_unique(__val).first; + } + else { + iterator __before = __position; + --__before; + + bool __comp_v_pos = _M_key_compare(_KeyOfValue()(__val), _S_key(__position._M_node)); + + if (__comp_v_pos + && _M_key_compare( _S_key(__before._M_node), _KeyOfValue()(__val) )) { + + if (_S_right(__before._M_node) == 0) + return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null + else + return _M_insert(__position._M_node, __val, __position._M_node); + // first argument just needs to be non-null + } + else { + // Does the insertion point fall immediately AFTER the hint? + iterator __after = __position; + ++__after; + // Optimization to catch equivalent cases and avoid unnecessary comparisons + bool __comp_pos_v = !__comp_v_pos; // Stored this result earlier + // If the earlier comparison was true, this comparison doesn't need to be + // performed because it must be false. However, if the earlier comparison + // was false, we need to perform this one because in the equal case, both will + // be false. + if (!__comp_v_pos) { + __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val)); + } + + if ( (!__comp_v_pos) // comp_v_pos true implies comp_v_pos false + && __comp_pos_v + && (__after._M_node == &this->_M_header._M_data || + _M_key_compare( _KeyOfValue()(__val), _S_key(__after._M_node) ))) { + if (_S_right(__position._M_node) == 0) + return _M_insert(__position._M_node, __val, 0, __position._M_node); + else + return _M_insert(__after._M_node, __val, __after._M_node); + } else { + // Test for equivalent case + if (__comp_v_pos == __comp_pos_v) + return __position; + else + return insert_unique(__val).first; + } + } + } +} + +template +__iterator__ +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::insert_equal(iterator __position, + const _Value& __val) { + if (__position._M_node == this->_M_header._M_data._M_left) { // begin() + + // Check for zero members + if (size() <= 0) + return insert_equal(__val); + + if (!_M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val))) + return _M_insert(__position._M_node, __val, __position._M_node); + else { + // Check for only one member + if (__position._M_node->_M_left == __position._M_node) + // Unlike insert_unique, can't avoid doing a comparison here. + return _M_insert(__position._M_node, __val); + + // All other cases: + // Standard-conformance - does the insertion point fall immediately AFTER + // the hint? + iterator __after = __position; + ++__after; + + // Already know that compare(pos, v) must be true! + // Therefore, we want to know if compare(after, v) is false. + // (i.e., we now pos < v, now we want to know if v <= after) + // If not, invalid hint. + if ( __after._M_node == &this->_M_header._M_data || + !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) { + if (_S_right(__position._M_node) == 0) + return _M_insert(__position._M_node, __val, 0, __position._M_node); + else + return _M_insert(__after._M_node, __val, __after._M_node); + } + else { // Invalid hint + return insert_equal(__val); + } + } + } + else if (__position._M_node == &this->_M_header._M_data) { // end() + if (!_M_key_compare(_KeyOfValue()(__val), _S_key(_M_rightmost()))) + return _M_insert(_M_rightmost(), __val, 0, __position._M_node); // Last argument only needs to be non-null + else { + return insert_equal(__val); + } + } + else { + iterator __before = __position; + --__before; + // store the result of the comparison between pos and v so + // that we don't have to do it again later. Note that this reverses the shortcut + // on the if, possibly harming efficiency in comparisons; I think the harm will + // be negligible, and to do what I want to do (save the result of a comparison so + // that it can be re-used) there is no alternative. Test here is for before <= v <= pos. + bool __comp_pos_v = _M_key_compare(_S_key(__position._M_node), _KeyOfValue()(__val)); + if (!__comp_pos_v && + !_M_key_compare(_KeyOfValue()(__val), _S_key(__before._M_node))) { + if (_S_right(__before._M_node) == 0) + return _M_insert(__before._M_node, __val, 0, __before._M_node); // Last argument only needs to be non-null + else + return _M_insert(__position._M_node, __val, __position._M_node); + } + else { + // Does the insertion point fall immediately AFTER the hint? + // Test for pos < v <= after + iterator __after = __position; + ++__after; + + if (__comp_pos_v && + ( __after._M_node == &this->_M_header._M_data || + !_M_key_compare( _S_key(__after._M_node), _KeyOfValue()(__val) ) ) ) { + if (_S_right(__position._M_node) == 0) + return _M_insert(__position._M_node, __val, 0, __position._M_node); + else + return _M_insert(__after._M_node, __val, __after._M_node); + } + else { // Invalid hint + return insert_equal(__val); + } + } + } +} + +template +_Rb_tree_node_base* +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> ::_M_copy(_Rb_tree_node_base* __x, + _Rb_tree_node_base* __p) { + // structural copy. __x and __p must be non-null. + _Base_ptr __top = _M_clone_node(__x); + _S_parent(__top) = __p; + + _STLP_TRY { + if (_S_right(__x)) + _S_right(__top) = _M_copy(_S_right(__x), __top); + __p = __top; + __x = _S_left(__x); + + while (__x != 0) { + _Base_ptr __y = _M_clone_node(__x); + _S_left(__p) = __y; + _S_parent(__y) = __p; + if (_S_right(__x)) + _S_right(__y) = _M_copy(_S_right(__x), __y); + __p = __y; + __x = _S_left(__x); + } + } + _STLP_UNWIND(_M_erase(__top)) + + return __top; +} + +// this has to stay out-of-line : it's recursive +template +void +_Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::_M_erase(_Rb_tree_node_base *__x) { + // erase without rebalancing + while (__x != 0) { + _M_erase(_S_right(__x)); + _Base_ptr __y = _S_left(__x); + _STLP_STD::_Destroy(&_S_value(__x)); + this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x),1); + __x = __y; + } +} + +#if defined (_STLP_DEBUG) +inline int +__black_count(_Rb_tree_node_base* __node, _Rb_tree_node_base* __root) { + if (__node == 0) + return 0; + else { + int __bc = __node->_M_color == _S_rb_tree_black ? 1 : 0; + if (__node == __root) + return __bc; + else + return __bc + __black_count(__node->_M_parent, __root); + } +} + +template +bool _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc>::__rb_verify() const { + if (_M_node_count == 0 || begin() == end()) + return ((_M_node_count == 0) && + (begin() == end()) && + (this->_M_header._M_data._M_left == &this->_M_header._M_data) && + (this->_M_header._M_data._M_right == &this->_M_header._M_data)); + + int __len = __black_count(_M_leftmost(), _M_root()); + for (const_iterator __it = begin(); __it != end(); ++__it) { + _Base_ptr __x = __it._M_node; + _Base_ptr __L = _S_left(__x); + _Base_ptr __R = _S_right(__x); + + if (__x->_M_color == _S_rb_tree_red) + if ((__L && __L->_M_color == _S_rb_tree_red) || + (__R && __R->_M_color == _S_rb_tree_red)) + return false; + + if (__L && _M_key_compare(_S_key(__x), _S_key(__L))) + return false; + if (__R && _M_key_compare(_S_key(__R), _S_key(__x))) + return false; + + if (!__L && !__R && __black_count(__x, _M_root()) != __len) + return false; + } + + if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) + return false; + if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) + return false; + + return true; +} +#endif /* _STLP_DEBUG */ + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +#undef _Rb_tree +#undef __iterator__ +#undef iterator +#undef __size_type__ + +#endif /* _STLP_TREE_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_tree.h b/sdk/tlibstdcxx/stlport/stl/_tree.h new file mode 100644 index 0000000000..bf059015e9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_tree.h @@ -0,0 +1,684 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_TREE_H +#define _STLP_INTERNAL_TREE_H + +/* + +Red-black tree class, designed for use in implementing STL +associative containers (set, multiset, map, and multimap). The +insertion and deletion algorithms are based on those in Cormen, +Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990), +except that + +(1) the header cell is maintained with links not only to the root +but also to the leftmost node of the tree, to enable constant time +begin(), and to the rightmost node of the tree, to enable linear time +performance when used with the generic set algorithms (set_union, +etc.); + +(2) when a node being deleted has two children its successor node is +relinked into its place, rather than copied, so that the only +iterators invalidated are those referring to the deleted node. + +*/ + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +typedef bool _Rb_tree_Color_type; +//const _Rb_tree_Color_type _S_rb_tree_red = false; +//const _Rb_tree_Color_type _S_rb_tree_black = true; + +#define _S_rb_tree_red false +#define _S_rb_tree_black true + +struct _Rb_tree_node_base { + typedef _Rb_tree_Color_type _Color_type; + typedef _Rb_tree_node_base* _Base_ptr; + + _Color_type _M_color; + _Base_ptr _M_parent; + _Base_ptr _M_left; + _Base_ptr _M_right; + + static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) { + while (__x->_M_left != 0) __x = __x->_M_left; + return __x; + } + + static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) { + while (__x->_M_right != 0) __x = __x->_M_right; + return __x; + } +}; + +template +struct _Rb_tree_node : public _Rb_tree_node_base { + _Value _M_value_field; + __TRIVIAL_STUFF(_Rb_tree_node) +}; + +struct _Rb_tree_base_iterator; + +template +class _Rb_global { +public: + typedef _Rb_tree_node_base* _Base_ptr; + // those used to be global functions + static void _STLP_CALL _Rebalance(_Base_ptr __x, _Base_ptr& __root); + static _Base_ptr _STLP_CALL _Rebalance_for_erase(_Base_ptr __z, + _Base_ptr& __root, + _Base_ptr& __leftmost, + _Base_ptr& __rightmost); + // those are from _Rb_tree_base_iterator - moved here to reduce code bloat + // moved here to reduce code bloat without templatizing _Rb_tree_base_iterator + static _Base_ptr _STLP_CALL _M_increment (_Base_ptr); + static _Base_ptr _STLP_CALL _M_decrement (_Base_ptr); + static void _STLP_CALL _Rotate_left (_Base_ptr __x, _Base_ptr& __root); + static void _STLP_CALL _Rotate_right(_Base_ptr __x, _Base_ptr& __root); +}; + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS _Rb_global; +# endif + +typedef _Rb_global _Rb_global_inst; + +struct _Rb_tree_base_iterator { + typedef _Rb_tree_node_base* _Base_ptr; + typedef bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + _Base_ptr _M_node; + _Rb_tree_base_iterator() : _M_node(0) {} + _Rb_tree_base_iterator(_Base_ptr __x) : _M_node(__x) {} +}; + +template +struct _Rb_tree_iterator : public _Rb_tree_base_iterator { + typedef _Value value_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + typedef _Rb_tree_iterator<_Value, _Traits> _Self; + typedef _Rb_tree_node_base* _Base_ptr; + typedef _Rb_tree_node<_Value>* _Link_type; + + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef _Rb_tree_iterator<_Value, _NonConstTraits> iterator; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef _Rb_tree_iterator<_Value, _ConstTraits> const_iterator; + + _Rb_tree_iterator() {} +#if !defined (_STLP_DEBUG) + /* In STL debug mode we need this constructor implicit for the pointer + * specialization implementation. + */ + explicit +#endif + _Rb_tree_iterator(_Base_ptr __x) : _Rb_tree_base_iterator(__x) {} + //copy constructor for iterator and constructor from iterator for const_iterator + _Rb_tree_iterator(const iterator& __it) : _Rb_tree_base_iterator(__it._M_node) {} + + reference operator*() const { + return __STATIC_CAST(_Link_type, _M_node)->_M_value_field; + } + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + _M_node = _Rb_global_inst::_M_increment(_M_node); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + ++(*this); + return __tmp; + } + + _Self& operator--() { + _M_node = _Rb_global_inst::_M_decrement(_M_node); + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + --(*this); + return __tmp; + } + + bool operator == (const_iterator __rhs) const { + return _M_node == __rhs._M_node; + } + bool operator != (const_iterator __rhs) const { + return _M_node != __rhs._M_node; + } +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +_STLP_MOVE_TO_STD_NAMESPACE +template +struct __type_traits<_STLP_PRIV _Rb_tree_iterator<_Value, _Traits> > { + typedef __false_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +_STLP_MOVE_TO_STD_NAMESPACE +template +inline _Value* value_type(const _STLP_PRIV _Rb_tree_iterator<_Value, _Traits>&) +{ return (_Value*)0; } +inline bidirectional_iterator_tag iterator_category(const _STLP_PRIV _Rb_tree_base_iterator&) +{ return bidirectional_iterator_tag(); } +inline ptrdiff_t* distance_type(const _STLP_PRIV _Rb_tree_base_iterator&) +{ return (ptrdiff_t*) 0; } +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +// Base class to help EH + +template +class _Rb_tree_base { +public: + typedef _Rb_tree_node_base _Node_base; + typedef _Rb_tree_node<_Tp> _Node; + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef _Alloc allocator_type; +private: + typedef _Rb_tree_base<_Tp, _Alloc> _Self; + typedef typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator_type; + typedef _STLP_alloc_proxy<_Node_base, _Node, _M_node_allocator_type> _AllocProxy; + +public: + allocator_type get_allocator() const { + return _STLP_CONVERT_ALLOCATOR(_M_header, _Tp); + } + +protected: + _Rb_tree_base(const allocator_type& __a) : + _M_header(_STLP_CONVERT_ALLOCATOR(__a, _Node), _Node_base() ) { + _M_empty_initialize(); + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Rb_tree_base(__move_source<_Self> src) : + _M_header(__move_source<_AllocProxy>(src.get()._M_header)) { + _M_rebind(&src.get()._M_header._M_data); + src.get()._M_empty_initialize(); + } +#endif + + void _M_empty_initialize() { + _M_header._M_data._M_color = _S_rb_tree_red; // used to distinguish header from + // __root, in iterator.operator++ + _M_header._M_data._M_parent = 0; + _M_header._M_data._M_left = &_M_header._M_data; + _M_header._M_data._M_right = &_M_header._M_data; + } + + void _M_rebind(_Node_base *__static_node) { + if (_M_header._M_data._M_parent != 0) { + _M_header._M_data._M_parent->_M_parent = &_M_header._M_data; + } + if (_M_header._M_data._M_right == __static_node) { + _M_header._M_data._M_right = &_M_header._M_data; + } + if (_M_header._M_data._M_left == __static_node) { + _M_header._M_data._M_left = &_M_header._M_data; + } + } + + _AllocProxy _M_header; +}; + +#if defined (_STLP_DEBUG) +# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree) +#endif + +template ) > +class _Rb_tree : public _Rb_tree_base<_Value, _Alloc> { + typedef _Rb_tree_base<_Value, _Alloc> _Base; + typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self; +protected: + typedef _Rb_tree_node_base * _Base_ptr; + typedef _Rb_tree_node<_Value> _Node; + typedef _Node* _Link_type; + typedef _Rb_tree_Color_type _Color_type; +public: + typedef _Key key_type; + typedef _Value value_type; + typedef typename _Traits::pointer pointer; + typedef const value_type* const_pointer; + typedef typename _Traits::reference reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef bidirectional_iterator_tag _Iterator_category; + typedef typename _Base::allocator_type allocator_type; + +protected: + + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + _Base_ptr _M_create_node(const value_type& __x) { + _Link_type __tmp = this->_M_header.allocate(1); + _STLP_TRY { + _Copy_Construct(&__tmp->_M_value_field, __x); + } + _STLP_UNWIND(this->_M_header.deallocate(__tmp,1)) + _S_left(__tmp) = 0; + _S_right(__tmp) = 0; + return __tmp; + } + + _Base_ptr _M_clone_node(_Base_ptr __x) { + _Base_ptr __tmp = _M_create_node(_S_value(__x)); + _S_color(__tmp) = _S_color(__x); + return __tmp; + } + + size_type _M_node_count; // keeps track of size of tree + _Compare _M_key_compare; + + _Base_ptr _M_root() const + { return this->_M_header._M_data._M_parent; } + _Base_ptr _M_leftmost() const + { return this->_M_header._M_data._M_left; } + _Base_ptr _M_rightmost() const + { return this->_M_header._M_data._M_right; } + + _Base_ptr& _M_root() + { return this->_M_header._M_data._M_parent; } + _Base_ptr& _M_leftmost() + { return this->_M_header._M_data._M_left; } + _Base_ptr& _M_rightmost() + { return this->_M_header._M_data._M_right; } + + static _Base_ptr& _STLP_CALL _S_left(_Base_ptr __x) + { return __x->_M_left; } + static _Base_ptr& _STLP_CALL _S_right(_Base_ptr __x) + { return __x->_M_right; } + static _Base_ptr& _STLP_CALL _S_parent(_Base_ptr __x) + { return __x->_M_parent; } + static value_type& _STLP_CALL _S_value(_Base_ptr __x) + { return __STATIC_CAST(_Link_type, __x)->_M_value_field; } + static const _Key& _STLP_CALL _S_key(_Base_ptr __x) + { return _KeyOfValue()(_S_value(__x));} + static _Color_type& _STLP_CALL _S_color(_Base_ptr __x) + { return (_Color_type&)(__x->_M_color); } + + static _Base_ptr _STLP_CALL _S_minimum(_Base_ptr __x) + { return _Rb_tree_node_base::_S_minimum(__x); } + + static _Base_ptr _STLP_CALL _S_maximum(_Base_ptr __x) + { return _Rb_tree_node_base::_S_maximum(__x); } + +public: + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef _Rb_tree_iterator iterator; + typedef _Rb_tree_iterator const_iterator; + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; + +private: + iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0); + _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p); + void _M_erase(_Base_ptr __x); + +public: + // allocation/deallocation + _Rb_tree() + : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(_Compare()) + {} + + _Rb_tree(const _Compare& __comp) + : _Rb_tree_base<_Value, _Alloc>(allocator_type()), _M_node_count(0), _M_key_compare(__comp) + {} + + _Rb_tree(const _Compare& __comp, const allocator_type& __a) + : _Rb_tree_base<_Value, _Alloc>(__a), _M_node_count(0), _M_key_compare(__comp) + {} + + _Rb_tree(const _Self& __x) + : _Rb_tree_base<_Value, _Alloc>(__x.get_allocator()), + _M_node_count(0), _M_key_compare(__x._M_key_compare) { + if (__x._M_root() != 0) { + _S_color(&this->_M_header._M_data) = _S_rb_tree_red; + _M_root() = _M_copy(__x._M_root(), &this->_M_header._M_data); + _M_leftmost() = _S_minimum(_M_root()); + _M_rightmost() = _S_maximum(_M_root()); + } + _M_node_count = __x._M_node_count; + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Rb_tree(__move_source<_Self> src) + : _Rb_tree_base<_Value, _Alloc>(__move_source<_Base>(src.get())), + _M_node_count(src.get()._M_node_count), + _M_key_compare(_AsMoveSource(src.get()._M_key_compare)) + { src.get()._M_node_count = 0; } +#endif + + ~_Rb_tree() { clear(); } + _Self& operator=(const _Self& __x); + +public: + // accessors: + _Compare key_comp() const { return _M_key_compare; } + + iterator begin() { return iterator(_M_leftmost()); } + const_iterator begin() const { return const_iterator(_M_leftmost()); } + iterator end() { return iterator(&this->_M_header._M_data); } + const_iterator end() const { return const_iterator(__CONST_CAST(_Base_ptr, &this->_M_header._M_data)); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + bool empty() const { return _M_node_count == 0; } + size_type size() const { return _M_node_count; } + size_type max_size() const { return size_type(-1); } + + void swap(_Self& __t) { + if (__t.empty()) { + if (this->empty()) return; + __t._M_header.swap(this->_M_header); + __t._M_rebind(&this->_M_header._M_data); + this->_M_empty_initialize(); + } + else if (this->empty()) { + __t.swap(*this); + return; + } + else { + this->_M_header.swap(__t._M_header); + this->_M_rebind(&__t._M_header._M_data); + __t._M_rebind(&this->_M_header._M_data); + } + _STLP_STD::swap(_M_node_count, __t._M_node_count); + _STLP_STD::swap(_M_key_compare, __t._M_key_compare); + } + +public: + // insert/erase + pair insert_unique(const value_type& __x); + iterator insert_equal(const value_type& __x); + + iterator insert_unique(iterator __pos, const value_type& __x); + iterator insert_equal(iterator __pos, const value_type& __x); + +#if defined (_STLP_MEMBER_TEMPLATES) + template void insert_equal(_II __first, _II __last) { + for ( ; __first != __last; ++__first) + insert_equal(*__first); + } + template void insert_unique(_II __first, _II __last) { + for ( ; __first != __last; ++__first) + insert_unique(*__first); + } +#else + void insert_unique(const_iterator __first, const_iterator __last) { + for ( ; __first != __last; ++__first) + insert_unique(*__first); + } + void insert_unique(const value_type* __first, const value_type* __last) { + for ( ; __first != __last; ++__first) + insert_unique(*__first); + } + void insert_equal(const_iterator __first, const_iterator __last) { + for ( ; __first != __last; ++__first) + insert_equal(*__first); + } + void insert_equal(const value_type* __first, const value_type* __last) { + for ( ; __first != __last; ++__first) + insert_equal(*__first); + } +#endif + + void erase(iterator __pos) { + _Base_ptr __x = _Rb_global_inst::_Rebalance_for_erase(__pos._M_node, + this->_M_header._M_data._M_parent, + this->_M_header._M_data._M_left, + this->_M_header._M_data._M_right); + _STLP_STD::_Destroy(&_S_value(__x)); + this->_M_header.deallocate(__STATIC_CAST(_Link_type, __x), 1); + --_M_node_count; + } + + size_type erase(const key_type& __x) { + pair __p = equal_range(__x); + size_type __n = _STLP_STD::distance(__p.first, __p.second); + erase(__p.first, __p.second); + return __n; + } + + size_type erase_unique(const key_type& __x) { + iterator __i = find(__x); + if (__i._M_node != &this->_M_header._M_data) { + erase(__i); + return 1; + } + return 0; + } + + void erase(iterator __first, iterator __last) { + if (__first._M_node == this->_M_header._M_data._M_left && // begin() + __last._M_node == &this->_M_header._M_data) // end() + clear(); + else + while (__first != __last) erase(__first++); + } + + void erase(const key_type* __first, const key_type* __last) { + while (__first != __last) erase(*__first++); + } + + void clear() { + if (_M_node_count != 0) { + _M_erase(_M_root()); + _M_leftmost() = &this->_M_header._M_data; + _M_root() = 0; + _M_rightmost() = &this->_M_header._M_data; + _M_node_count = 0; + } + } + +public: + // set operations: + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __k) { return iterator(_M_find(__k)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __k) const { return const_iterator(_M_find(__k)); } +private: + _STLP_TEMPLATE_FOR_CONT_EXT + _Base_ptr _M_find(const _KT& __k) const { + _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); // Last node which is not less than __k. + _Base_ptr __x = _M_root(); // Current node. + + while (__x != 0) + if (!_M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + if (__y != &this->_M_header._M_data) { + if (_M_key_compare(__k, _S_key(__y))) { + __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); + } + } + return __y; + } + + _STLP_TEMPLATE_FOR_CONT_EXT + _Base_ptr _M_lower_bound(const _KT& __k) const { + _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is not less than __k. */ + _Base_ptr __x = _M_root(); /* Current node. */ + + while (__x != 0) + if (!_M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + return __y; + } + + _STLP_TEMPLATE_FOR_CONT_EXT + _Base_ptr _M_upper_bound(const _KT& __k) const { + _Base_ptr __y = __CONST_CAST(_Base_ptr, &this->_M_header._M_data); /* Last node which is greater than __k. */ + _Base_ptr __x = _M_root(); /* Current node. */ + + while (__x != 0) + if (_M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + + return __y; + } + +public: + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const { + pair __p = equal_range(__x); + return _STLP_STD::distance(__p.first, __p.second); + } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) { return iterator(_M_lower_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const { return const_iterator(_M_lower_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) { return iterator(_M_upper_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const { return const_iterator(_M_upper_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) + { return pair(lower_bound(__x), upper_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const + { return pair(lower_bound(__x), upper_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range_unique(const _KT& __x) { + pair __p; + __p.second = lower_bound(__x); + if (__p.second._M_node != &this->_M_header._M_data && + !_M_key_compare(__x, _S_key(__p.second._M_node))) { + __p.first = __p.second++; + } + else { + __p.first = __p.second; + } + return __p; + } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range_unique(const _KT& __x) const { + pair __p; + __p.second = lower_bound(__x); + if (__p.second._M_node != &this->_M_header._M_data && + !_M_key_compare(__x, _S_key(__p.second._M_node))) { + __p.first = __p.second++; + } + else { + __p.first = __p.second; + } + return __p; + } + +#if defined (_STLP_DEBUG) +public: + // Debugging. + bool __rb_verify() const; +#endif //_STLP_DEBUG +}; + +#if defined (_STLP_DEBUG) +# undef _Rb_tree +#endif + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER _STLP_PRIV _Rb_tree<_Key,_Compare,_Value,_KeyOfValue,_Traits,_Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits<_STLP_PRIV _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> > + : _STLP_PRIV __move_traits_help2<_Compare, _Alloc> {}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_TREE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_typeinfo.h b/sdk/tlibstdcxx/stlport/stl/_typeinfo.h new file mode 100644 index 0000000000..ad9e4d0b63 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_typeinfo.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_INTERNAL_TYPEINFO +#define _STLP_INTERNAL_TYPEINFO + +#if !defined (_STLP_NO_TYPEINFO) + +# if defined (_STLP_NO_NEW_NEW_HEADER) +# include +# else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo) +# endif +# endif + +// We need to import std::exception into _STLP_STD_NAME +# if defined(_STLP_SGX_CONFIG) && !defined(_STLP_INTERNAL_EXCEPTION) +# include +# endif + +# if (defined(_STLP_MSVC) && (_STLP_MSVC >= 1300)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) +// In .NET, actually includes +# undef _STLP_OLDSTD_typeinfo +# endif + +// if already included, do not import anything +# if defined(_STLP_USE_NAMESPACES) && !defined(_STLP_OLDSTD_typeinfo) && \ + (defined(_STLP_VENDOR_GLOBAL_EXCEPT_STD) || \ + defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_DEBUG)) +# if defined(_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined(_STLP_WCE_NET) +class bad_cast : public exception {}; +# endif + +_STLP_BEGIN_NAMESPACE +// VC 6 and eVC 4 have type_info in the global namespace +# if (defined(_STLP_MSVC) && (_STLP_MSVC < 1300)) || defined(_STLP_WCE_NET) +using ::type_info; +# else +using _STLP_VENDOR_EXCEPT_STD::type_info; +# endif + +# if !defined (__DMC__) +using _STLP_VENDOR_EXCEPT_STD::bad_typeid; +# endif + +# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) && !defined (_STLP_WCE_NET) +using ::bad_cast; +# else +using _STLP_VENDOR_EXCEPT_STD::bad_cast; +# endif + +_STLP_END_NAMESPACE + +# endif + +#else + +# ifndef _STLP_INTERNAL_EXCEPTION +# include +# endif + +_STLP_BEGIN_NAMESPACE +# if !defined (__DMC__) +struct bad_cast : exception {}; +# endif +_STLP_END_NAMESPACE +#endif + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/_uninitialized.h b/sdk/tlibstdcxx/stlport/stl/_uninitialized.h new file mode 100644 index 0000000000..5489a94a13 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_uninitialized.h @@ -0,0 +1,443 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_UNINITIALIZED_H +#define _STLP_INTERNAL_UNINITIALIZED_H + +#ifndef _STLP_INTERNAL_CSTRING +# include +#endif + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +// uninitialized_copy + +template +inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, + _OutputIter __result, _Distance*) { + _OutputIter __cur = __result; + _STLP_TRY { + for ( ; __first != __last; ++__first, ++__cur) + _Param_Construct(&*__cur, *__first); + return __cur; + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur)) + _STLP_RET_AFTER_THROW(__cur) +} + +template +inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, + _OutputIter __result, const input_iterator_tag &, _Distance* __d) +{ return __ucopy(__first, __last, __result, __d); } + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, + _OutputIter __result, const forward_iterator_tag &, _Distance* __d) +{ return __ucopy(__first, __last, __result, __d); } + +template +inline _OutputIter __ucopy(_InputIter __first, _InputIter __last, + _OutputIter __result, const bidirectional_iterator_tag &, _Distance* __d) +{ return __ucopy(__first, __last, __result, __d); } +#endif + +template +inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, + _OutputIter __result, const random_access_iterator_tag &, _Distance*) { + _OutputIter __cur = __result; + _STLP_TRY { + for (_Distance __n = __last - __first; __n > 0; --__n) { + _Param_Construct(&*__cur, *__first); + ++__first; + ++__cur; + } + return __cur; + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur)) + _STLP_RET_AFTER_THROW(__cur) +} + +//Used internaly +template +inline _OutputIter __ucopy(_RandomAccessIter __first, _RandomAccessIter __last, _OutputIter __result) +{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); } + +inline void* +__ucopy_trivial(const void* __first, const void* __last, void* __result) { + //dums: this version can use memcpy (__copy_trivial can't) + return (__last == __first) ? __result : + ((char*)memcpy(__result, __first, ((const char*)__last - (const char*)__first))) + + ((const char*)__last - (const char*)__first); +} + +template +inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, + const __false_type& /*TrivialUCopy*/) +{ return __ucopy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0); } + +template +inline _OutputIter __ucopy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result, + const __true_type& /*TrivialUCopy*/) { + // we know they all pointers, so this cast is OK + // return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result)); + return (_OutputIter)__ucopy_trivial(__first, __last, __result); +} + +template +inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, + const __true_type& /*BothPtrType*/) { + return __ucopy_ptrs(__first, __last, __result, + _UseTrivialUCopy(_STLP_VALUE_TYPE(__first, _InputIter), + _STLP_VALUE_TYPE(__result, _OutputIter))._Answer()); +} + +template +inline _OutputIter __ucopy_aux(_InputIter __first, _InputIter __last, _OutputIter __result, + const __false_type& /*BothPtrType*/) { + return __ucopy(__first, __last, __result, + _STLP_ITERATOR_CATEGORY(__first, _InputIter), + _STLP_DISTANCE_TYPE(__first, _InputIter)); +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline _ForwardIter +uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result) +{ return _STLP_PRIV __ucopy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter>::_Answer()); } + +inline char* +uninitialized_copy(const char* __first, const char* __last, char* __result) +{ return (char*)_STLP_PRIV __ucopy_trivial(__first, __last, __result); } + +# if defined (_STLP_HAS_WCHAR_T) // dwa 8/15/97 +inline wchar_t* +uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result) +{ return (wchar_t*)_STLP_PRIV __ucopy_trivial (__first, __last, __result); } +# endif + +// uninitialized_copy_n (not part of the C++ standard) +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +_STLP_INLINE_LOOP +pair<_InputIter, _ForwardIter> +__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result, + const input_iterator_tag &) { + _ForwardIter __cur = __result; + _STLP_TRY { + for ( ; __count > 0 ; --__count, ++__first, ++__cur) + _Param_Construct(&*__cur, *__first); + return pair<_InputIter, _ForwardIter>(__first, __cur); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __cur)) + _STLP_RET_AFTER_THROW((pair<_InputIter, _ForwardIter>(__first, __cur))) +} + +# if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline pair<_InputIter, _ForwardIterator> +__ucopy_n(_InputIter __first, _Size __count, + _ForwardIterator __result, + const forward_iterator_tag &) +{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); } + +template +inline pair<_InputIter, _ForwardIterator> +__ucopy_n(_InputIter __first, _Size __count, + _ForwardIterator __result, + const bidirectional_iterator_tag &) +{ return __ucopy_n(__first, __count, __result, input_iterator_tag()); } +# endif + +template +inline pair<_RandomAccessIter, _ForwardIter> +__ucopy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result, + const random_access_iterator_tag &) { + _RandomAccessIter __last = __first + __count; + return pair<_RandomAccessIter, _ForwardIter>(__last, uninitialized_copy(__first, __last, __result)); +} + +// This is used internally in , which is extension itself. +template +inline pair<_InputIter, _ForwardIter> +__ucopy_n(_InputIter __first, _Size __count, _ForwardIter __result) +{ return _STLP_PRIV __ucopy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); } + +#if !defined (_STLP_NO_EXTENSIONS) + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline pair<_InputIter, _ForwardIter> +uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result) +{ return _STLP_PRIV __ucopy_n(__first, __count, __result); } + +_STLP_MOVE_TO_PRIV_NAMESPACE + +#endif + +template +inline void __ufill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x, _Distance*) { + _ForwardIter __cur = __first; + _STLP_TRY { + for ( ; __cur != __last; ++__cur) + _Param_Construct(&*__cur, __x); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur)) +} + +template +inline void __ufill(_ForwardIter __first, _ForwardIter __last, + const _Tp& __x, const input_iterator_tag &, _Distance* __d) +{ __ufill(__first, __last, __x, __d); } + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline void __ufill(_ForwardIter __first, _ForwardIter __last, + const _Tp& __x, const forward_iterator_tag &, _Distance* __d) +{ __ufill(__first, __last, __x, __d); } + +template +inline void __ufill(_ForwardIter __first, _ForwardIter __last, + const _Tp& __x, const bidirectional_iterator_tag &, _Distance* __d) +{ __ufill(__first, __last, __x, __d); } +#endif + +template +inline void __ufill(_ForwardIter __first, _ForwardIter __last, + const _Tp& __x, const random_access_iterator_tag &, _Distance*) { + _ForwardIter __cur = __first; + _STLP_TRY { + for (_Distance __n = __last - __first; __n > 0; --__n, ++__cur) + _Param_Construct(&*__cur, __x); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur)) +} + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) { + _STLP_PRIV __ufill(__first, __last, __x, + _STLP_ITERATOR_CATEGORY(__first, _ForwardIter), + _STLP_DISTANCE_TYPE(__first, _ForwardIter)); +} + +// Specialization: for one-byte types we can use memset. +inline void uninitialized_fill(unsigned char* __first, unsigned char* __last, + const unsigned char& __val) { + unsigned char __tmp = __val; + memset(__first, __tmp, __last - __first); +} +#if !defined (_STLP_NO_SIGNED_BUILTINS) +inline void uninitialized_fill(signed char* __first, signed char* __last, + const signed char& __val) { + signed char __tmp = __val; + memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); +} +#endif +inline void uninitialized_fill(char* __first, char* __last, const char& __val) { + char __tmp = __val; + memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first); +} + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x) { + _ForwardIter __cur = __first; + _STLP_TRY { + for ( ; __n > 0; --__n, ++__cur) + _Param_Construct(&*__cur, __x); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first, __cur)) + return __cur; +} + +template +inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, + const input_iterator_tag &) +{ return __ufill_n(__first, __n, __x); } + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, + const forward_iterator_tag &) +{ return __ufill_n(__first, __n, __x); } + +template +inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, + const bidirectional_iterator_tag &) +{ return __ufill_n(__first, __n, __x); } +#endif + +template +inline _ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) { + _ForwardIter __last = __first + __n; + __ufill(__first, __last, __x, random_access_iterator_tag(), (ptrdiff_t*)0); + return __last; +} + +template +inline _ForwardIter __ufill_n(_ForwardIter __first, _Size __n, const _Tp& __x, + const random_access_iterator_tag &) +{ return __uninitialized_fill_n(__first, __n, __x); } + +/* __uninitialized_init is an internal algo to init a range with a value + * built using default constructor. It is only called with pointer as + * iterator. + */ +template +inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& __val, + const __false_type& /*_HasDefaultZero*/) +{ return __uninitialized_fill_n(__first, __n, __val); } + +template +inline _ForwardIter __uinit_aux_aux(_ForwardIter __first, _Size __n, const _Tp& /* __val */, + const __true_type& /*_HasDefaultZero*/) { + memset((unsigned char*)__first, 0, __n * sizeof(_Tp)); + return __first + __n; +} + +template +inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp&, + const __true_type& /*_TrivialInit*/) +{ return __first + __n; } + +template +inline _ForwardIter __uinit_aux(_ForwardIter __first, _Size __n, const _Tp& __val, + const __false_type& /*_TrivialInit*/) +{ return __uinit_aux_aux(__first, __n, __val, _HasDefaultZeroValue(__first)._Answer()); } + +template +inline _ForwardIter __uninitialized_init(_ForwardIter __first, _Size __n, const _Tp& __val) +{ return __uinit_aux(__first, __n, __val, _UseTrivialInit(__first)._Answer()); } + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline void +uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) +{ _STLP_PRIV __ufill_n(__first, __n, __x, _STLP_ITERATOR_CATEGORY(__first, _ForwardIter)); } + +// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill, +// __uninitialized_fill_copy. + +// __uninitialized_copy_copy +// Copies [first1, last1) into [result, result + (last1 - first1)), and +// copies [first2, last2) into +// [result + (last1 - first1), result + (last1 - first1) + (last2 - first2)). + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +inline _ForwardIter +__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1, + _InputIter2 __first2, _InputIter2 __last2, + _ForwardIter __result) { + _ForwardIter __new_result = uninitialized_copy(__first1, __last1, __result); + _STLP_TRY { + return uninitialized_copy(__first2, __last2, __new_result); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __new_result)) + _STLP_RET_AFTER_THROW(__result) +} + +// __uninitialized_fill_copy +// Fills [result, mid) with x, and copies [first, last) into +// [mid, mid + (last - first)). +template +inline _ForwardIter +__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x, + _InputIter __first, _InputIter __last) { + uninitialized_fill(__result, __mid, __x); + _STLP_TRY { + return uninitialized_copy(__first, __last, __mid); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__result, __mid)) + _STLP_RET_AFTER_THROW(__result) +} + +// __uninitialized_copy_fill +// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and +// fills [first2 + (last1 - first1), last2) with x. +template +inline void +__uninitialized_copy_fill(_Iter __first1, _Iter __last1, _Iter __first2, _Iter __last2, + const _Tp& __x) { + _Iter __mid2 = uninitialized_copy(__first1, __last1, __first2); + _STLP_TRY { + uninitialized_fill(__mid2, __last2, __x); + } + _STLP_UNWIND(_STLP_STD::_Destroy_Range(__first2, __mid2)) +} + +/* __uninitialized_move: + * This function is used internaly and only with pointers as iterators. + */ +template +inline _ForwardIter +__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result, + _TrivialUCpy __trivial_ucpy, const __false_type& /*_Movable*/) +{ return __ucopy_ptrs(__first, __last, __result, __trivial_ucpy); } + +template +_STLP_INLINE_LOOP +_ForwardIter +__uninitialized_move(_InputIter __first, _InputIter __last, _ForwardIter __result, + _TrivialUCpy , const __true_type& /*_Movable*/) { + //Move constructor should not throw so we do not need to take care of exceptions here. + for (ptrdiff_t __n = __last - __first ; __n > 0; --__n) { + _Move_Construct(&*__result, *__first); + ++__first; ++__result; + } + return __result; +} + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_UNINITIALIZED_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_unordered_map.h b/sdk/tlibstdcxx/stlport/stl/_unordered_map.h new file mode 100644 index 0000000000..f2b017ddf9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_unordered_map.h @@ -0,0 +1,443 @@ +/* + * Copyright (c) 2004 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_UNORDERED_MAP_H +#define _STLP_INTERNAL_UNORDERED_MAP_H + +#ifndef _STLP_INTERNAL_HASHTABLE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMapTraitsT, traits) + +_STLP_BEGIN_TR1_NAMESPACE + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>), + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) > +class unordered_map +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ +private: + typedef unordered_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; +public: + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<_STLP_CONST key_type, data_type> value_type; +private: + //Specific iterator traits creation + typedef _STLP_PRIV _UnorderedMapTraitsT _UnorderedMapTraits; + +public: + typedef hashtable _Ht; + + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + typedef typename _Ht::local_iterator local_iterator; + typedef typename _Ht::const_local_iterator const_local_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_function() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + explicit unordered_map(size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + unordered_map(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + unordered_map(_InputIterator __f, _InputIterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#else + unordered_map(const value_type* __f, const value_type* __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + + unordered_map(const_iterator __f, const_iterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + + _Self& operator = (const _Self& __other) + { _M_ht = __other._M_ht; return *this; } + + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + + pair insert(const value_type& __obj) + { return _M_ht.insert_unique(__obj); } + iterator insert(const_iterator /*__hint*/, const value_type& __obj) + { return _M_ht.insert_unique(__obj); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __f, _InputIterator __l) +#else + void insert(const value_type* __f, const value_type* __l) + { _M_ht.insert_unique(__f,__l); } + void insert(const_iterator __f, const_iterator __l) +#endif /*_STLP_MEMBER_TEMPLATES */ + { _M_ht.insert_unique(__f, __l); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + _Tp& operator[](const _KT& __key) { + iterator __it = _M_ht.find(__key); + return (__it == _M_ht.end() ? + _M_ht._M_insert(value_type(__key, _STLP_DEFAULT_CONSTRUCTED(_Tp))).second : + (*__it).second ); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(const_iterator __it) { _M_ht.erase(__it); } + void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } + local_iterator begin(size_type __n) { return _M_ht.begin(__n); } + local_iterator end(size_type __n) { return _M_ht.end(__n); } + const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } + const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } + + float load_factor() const { return _M_ht.load_factor(); } + float max_load_factor() const { return _M_ht.max_load_factor(); } + void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } + void rehash(size_type __hint) { _M_ht.rehash(__hint); } + +#if defined (__DMC__) // disable operator==(pair, pair) + bool operator==(const _Self&) const; +#endif +}; + +_STLP_END_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultimapTraitsT, traits) + +_STLP_BEGIN_TR1_NAMESPACE + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Key>), + _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_STLP_CONST _Key, _Tp) > +class unordered_multimap +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ +private: + typedef unordered_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc> _Self; +public: + typedef _Key key_type; + typedef _Tp data_type; + typedef _Tp mapped_type; + typedef pair<_STLP_CONST key_type, data_type> value_type; +private: + //Specific iterator traits creation + typedef _STLP_PRIV _UnorderedMultimapTraitsT _UnorderedMultimapTraits; + +public: + typedef hashtable _Ht; + + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + typedef typename _Ht::local_iterator local_iterator; + typedef typename _Ht::const_local_iterator const_local_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_function() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + explicit unordered_multimap(size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + unordered_multimap(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + unordered_multimap(_InputIterator __f, _InputIterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#else + unordered_multimap(const value_type* __f, const value_type* __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + + unordered_multimap(const_iterator __f, const_iterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + + _Self& operator = (const _Self& __other) + { _M_ht = __other._M_ht; return *this; } + + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + + iterator insert(const value_type& __obj) + { return _M_ht.insert_equal(__obj); } + iterator insert(const_iterator /*__hint*/, const value_type& __obj) + { return _M_ht.insert_equal(__obj); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __f, _InputIterator __l) +#else + void insert(const value_type* __f, const value_type* __l) + { _M_ht.insert_equal(__f,__l); } + void insert(const_iterator __f, const_iterator __l) +#endif /*_STLP_MEMBER_TEMPLATES */ + { _M_ht.insert_equal(__f, __l); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(const_iterator __it) { _M_ht.erase(__it); } + void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } + local_iterator begin(size_type __n) { return _M_ht.begin(__n); } + local_iterator end(size_type __n) { return _M_ht.end(__n); } + const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } + const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } + + float load_factor() const { return _M_ht.load_factor(); } + float max_load_factor() const { return _M_ht.max_load_factor(); } + void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } + void rehash(size_type __hint) { _M_ht.rehash(__hint); } +}; + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER unordered_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> + +#include + +#undef _STLP_TEMPLATE_CONTAINER +#define _STLP_TEMPLATE_CONTAINER unordered_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc> + +#include + +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +_STLP_END_NAMESPACE + +// Specialization of insert_iterator so that it will work for unordered_map +// and unordered_multimap. + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > : + _STLP_PRIV __move_traits_help::_Ht> +{}; + +template +struct __move_traits<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > : + _STLP_PRIV __move_traits_help::_Ht> +{}; +# endif + +template +class insert_iterator<_STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { +protected: + typedef _STLP_TR1 unordered_map<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template +class insert_iterator<_STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> > { +protected: + typedef _STLP_TR1 unordered_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_UNORDERED_MAP_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_unordered_set.h b/sdk/tlibstdcxx/stlport/stl/_unordered_set.h new file mode 100644 index 0000000000..ef5f5fe78b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_unordered_set.h @@ -0,0 +1,418 @@ +/* + * Copyright (c) 2004 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_UNORDERED_SET_H +#define _STLP_INTERNAL_UNORDERED_SET_H + +#ifndef _STLP_INTERNAL_HASHTABLE_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedSetTraitsT, Const_traits) + +_STLP_BEGIN_TR1_NAMESPACE + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) > +class unordered_set +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Self; + //Specific iterator traits creation + typedef _STLP_PRIV _UnorderedSetTraitsT<_Value> _UnorderedSetTraits; +public: + typedef hashtable<_Value, _Value, _HashFcn, + _UnorderedSetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; +public: + typedef typename _Ht::key_type key_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + typedef typename _Ht::local_iterator local_iterator; + typedef typename _Ht::const_local_iterator const_local_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_function() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + explicit unordered_set(size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + unordered_set(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + unordered_set(_InputIterator __f, _InputIterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#else + unordered_set(const value_type* __f, const value_type* __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } + + unordered_set(const_iterator __f, const_iterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_unique(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + + _Self& operator = (const _Self& __other) + { _M_ht = __other._M_ht; return *this; } + + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& __hs) { _M_ht.swap(__hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + + pair insert(const value_type& __obj) + { return _M_ht.insert_unique(__obj); } + iterator insert(const_iterator /*__hint*/, const value_type& __obj) + { return _M_ht.insert_unique(__obj); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __f, _InputIterator __l) +#else + void insert(const_iterator __f, const_iterator __l) + {_M_ht.insert_unique(__f, __l); } + void insert(const value_type* __f, const value_type* __l) +#endif + { _M_ht.insert_unique(__f,__l); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(const_iterator __it) { _M_ht.erase(__it); } + void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } + local_iterator begin(size_type __n) { return _M_ht.begin(__n); } + local_iterator end(size_type __n) { return _M_ht.end(__n); } + const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } + const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } + + float load_factor() const { return _M_ht.load_factor(); } + float max_load_factor() const { return _M_ht.max_load_factor(); } + void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } + void rehash(size_type __hint) { _M_ht.rehash(__hint); } +}; + +_STLP_END_NAMESPACE + +//Specific iterator traits creation +_STLP_CREATE_HASH_ITERATOR_TRAITS(UnorderedMultisetTraitsT, Const_traits) + +_STLP_BEGIN_TR1_NAMESPACE + +template ), + _STLP_DFL_TMPL_PARAM(_EqualKey, equal_to<_Value>), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Value>) > +class unordered_multiset +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ + typedef unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Self; + //Specific iterator traits creation + typedef _STLP_PRIV _UnorderedMultisetTraitsT<_Value> _UnorderedMultisetTraits; +public: + typedef hashtable<_Value, _Value, _HashFcn, + _UnorderedMultisetTraits, _STLP_PRIV _Identity<_Value>, _EqualKey, _Alloc> _Ht; + + typedef typename _Ht::key_type key_type; + typedef typename _Ht::value_type value_type; + typedef typename _Ht::hasher hasher; + typedef typename _Ht::key_equal key_equal; + + typedef typename _Ht::size_type size_type; + typedef typename _Ht::difference_type difference_type; + typedef typename _Ht::pointer pointer; + typedef typename _Ht::const_pointer const_pointer; + typedef typename _Ht::reference reference; + typedef typename _Ht::const_reference const_reference; + + typedef typename _Ht::iterator iterator; + typedef typename _Ht::const_iterator const_iterator; + typedef typename _Ht::local_iterator local_iterator; + typedef typename _Ht::const_local_iterator const_local_iterator; + + typedef typename _Ht::allocator_type allocator_type; + + hasher hash_function() const { return _M_ht.hash_funct(); } + key_equal key_eq() const { return _M_ht.key_eq(); } + allocator_type get_allocator() const { return _M_ht.get_allocator(); } + +private: + _Ht _M_ht; + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + explicit unordered_multiset(size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + unordered_multiset(__move_source<_Self> src) + : _M_ht(__move_source<_Ht>(src.get()._M_ht)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + unordered_multiset(_InputIterator __f, _InputIterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#else + unordered_multiset(const value_type* __f, const value_type* __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } + + unordered_multiset(const_iterator __f, const_iterator __l, + size_type __n = 0, const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_ht(__n, __hf, __eql, __a) + { _M_ht.insert_equal(__f, __l); } +#endif /*_STLP_MEMBER_TEMPLATES */ + + _Self& operator = (const _Self& __other) + { _M_ht = __other._M_ht; return *this; } + + size_type size() const { return _M_ht.size(); } + size_type max_size() const { return _M_ht.max_size(); } + bool empty() const { return _M_ht.empty(); } + void swap(_Self& hs) { _M_ht.swap(hs._M_ht); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + iterator begin() { return _M_ht.begin(); } + iterator end() { return _M_ht.end(); } + const_iterator begin() const { return _M_ht.begin(); } + const_iterator end() const { return _M_ht.end(); } + + iterator insert(const value_type& __obj) + { return _M_ht.insert_equal(__obj); } + iterator insert(const_iterator /*__hint*/, const value_type& __obj) + { return _M_ht.insert_equal(__obj); } +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __f, _InputIterator __l) +#else + void insert(const value_type* __f, const value_type* __l) + { _M_ht.insert_equal(__f,__l); } + void insert(const_iterator __f, const_iterator __l) +#endif /*_STLP_MEMBER_TEMPLATES */ + { _M_ht.insert_equal(__f, __l); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) { return _M_ht.find(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const { return _M_ht.find(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_ht.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) + { return _M_ht.equal_range(__key); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const + { return _M_ht.equal_range(__key); } + + size_type erase(const key_type& __key) {return _M_ht.erase(__key); } + void erase(const_iterator __it) { _M_ht.erase(__it); } + void erase(const_iterator __f, const_iterator __l) { _M_ht.erase(__f, __l); } + void clear() { _M_ht.clear(); } + + size_type bucket_count() const { return _M_ht.bucket_count(); } + size_type max_bucket_count() const { return _M_ht.max_bucket_count(); } + size_type bucket_size(size_type __n) const { return _M_ht.elems_in_bucket(__n); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type bucket(const _KT& __k) const { return _M_ht.bucket(__k); } + local_iterator begin(size_type __n) { return _M_ht.begin(__n); } + local_iterator end(size_type __n) { return _M_ht.end(__n); } + const_local_iterator begin(size_type __n) const { return _M_ht.begin(__n); } + const_local_iterator end(size_type __n) const { return _M_ht.end(__n); } + + float load_factor() const { return _M_ht.load_factor(); } + float max_load_factor() const { return _M_ht.max_load_factor(); } + void max_load_factor(float __val) { _M_ht.max_load_factor(__val); } + void rehash(size_type __hint) { _M_ht.rehash(__hint); } +}; + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER unordered_set<_Value,_HashFcn,_EqualKey,_Alloc> + +#include + +#undef _STLP_TEMPLATE_CONTAINER +#define _STLP_TEMPLATE_CONTAINER unordered_multiset<_Value,_HashFcn,_EqualKey,_Alloc> +#include + +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +_STLP_END_NAMESPACE + +// Specialization of insert_iterator so that it will work for unordered_set +// and unordered_multiset. + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits<_STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > : + _STLP_PRIV __move_traits_aux::_Ht> +{}; + +template +struct __move_traits<_STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > : + _STLP_PRIV __move_traits_aux::_Ht> +{}; +# endif + +template +class insert_iterator<_STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> > { +protected: + typedef _STLP_TR1 unordered_set<_Value, _HashFcn, _EqualKey, _Alloc> _Container; + _Container* container; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; + +template +class insert_iterator<_STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> > { +protected: + typedef _STLP_TR1 unordered_multiset<_Value, _HashFcn, _EqualKey, _Alloc> _Container; + _Container* container; + typename _Container::iterator iter; +public: + typedef _Container container_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + insert_iterator(_Container& __x) : container(&__x) {} + insert_iterator(_Container& __x, typename _Container::iterator) + : container(&__x) {} + insert_iterator<_Container>& + operator=(const typename _Container::value_type& __val) { + container->insert(__val); + return *this; + } + insert_iterator<_Container>& operator*() { return *this; } + insert_iterator<_Container>& operator++() { return *this; } + insert_iterator<_Container>& operator++(int) { return *this; } +}; +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_UNORDERED_SET_H */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/stl/_valarray.c b/sdk/tlibstdcxx/stlport/stl/_valarray.c new file mode 100644 index 0000000000..85ee2f8cbb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_valarray.c @@ -0,0 +1,194 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_VALARRAY_C +#define _STLP_VALARRAY_C + +#ifndef _STLP_VALARRAY_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template +_Valarray_bool valarray<_Tp>:: operator!() const { + _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < this->size(); ++__i) + __tmp[__i] = !(*this)[__i]; + return __tmp; +} + +// Behavior is undefined if __x and *this have different sizes +template +valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __x) { + _STLP_ASSERT(__x._M_slice.size() == this->size()) + size_t __index = __x._M_slice.start(); + for (size_t __i = 0; + __i < __x._M_slice.size(); + ++__i, __index += __x._M_slice.stride()) + (*this)[__i] = __x._M_array[__index]; + return *this; +} + +template +valarray<_Tp> valarray<_Tp>::operator[](slice __slice) const { + valarray<_Tp> __tmp(__slice.size(), _NoInit()); + size_t __index = __slice.start(); + for (size_t __i = 0; + __i < __slice.size(); + ++__i, __index += __slice.stride()) + __tmp[__i] = (*this)[__index]; + return __tmp; +} + +template +bool _Gslice_Iter_tmpl<_Size>::_M_incr() { + size_t __dim = _M_indices.size() - 1; + ++_M_step; + for (;;) { + _M_1d_idx += _M_gslice._M_strides[__dim]; + if (++_M_indices[__dim] != _M_gslice._M_lengths[__dim]) + return true; + else if (__dim != 0) { + _M_1d_idx -= _M_gslice._M_strides[__dim] * _M_gslice._M_lengths[__dim]; + _M_indices[__dim] = 0; + --__dim; + } + else + return false; + } +} + +// Behavior is undefined if __x and *this have different sizes, or if +// __x was constructed from a degenerate gslice. +template +valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __x) { + if (this->size() != 0) { + _Gslice_Iter __i(__x._M_gslice); + do + (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx]; + while(__i._M_incr()); + } + return *this; +} + +template +valarray<_Tp> valarray<_Tp>::operator[](const gslice& __slice) const { + valarray<_Tp> __tmp(__slice._M_size(), _NoInit()); + if (__tmp.size() != 0) { + _Gslice_Iter __i(__slice); + do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr()); + } + return __tmp; +} + +template +valarray<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) const { + size_t _p_size = 0; + { + for (size_t __i = 0; __i < __mask.size(); ++__i) + if (__mask[__i]) ++_p_size; + } + + valarray<_Tp> __tmp(_p_size, _NoInit()); + size_t __idx = 0; + { + for (size_t __i = 0; __i < __mask.size(); ++__i) + if (__mask[__i]) __tmp[__idx++] = (*this)[__i]; + } + + return __tmp; +} + +template +valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __x) { + _STLP_ASSERT(__x._M_addr.size() == this->size()) + for (size_t __i = 0; __i < __x._M_addr.size(); ++__i) + (*this)[__i] = __x._M_array[__x._M_addr[__i]]; + return *this; +} + +template +valarray<_Tp> +valarray<_Tp>::operator[](const _Valarray_size_t& __addr) const { + valarray<_Tp> __tmp(__addr.size(), _NoInit()); + for (size_t __i = 0; __i < __addr.size(); ++__i) + __tmp[__i] = (*this)[__addr[__i]]; + return __tmp; +} + +//---------------------------------------------------------------------- +// Other valarray noninline member functions + +// Shift and cshift + +template +valarray<_Tp> valarray<_Tp>::shift(int __n) const { + valarray<_Tp> __tmp(this->size()); + + if (__n >= 0) { + if (__n < this->size()) + copy(this->_M_first + __n, this->_M_first + this->size(), + __tmp._M_first); + } + else { + if (-__n < this->size()) + copy(this->_M_first, this->_M_first + this->size() + __n, + __tmp._M_first - __n); + } + return __tmp; +} + +template +valarray<_Tp> valarray<_Tp>::cshift(int __m) const { + valarray<_Tp> __tmp(this->size()); + + if (this->size() == 0) + return __tmp; + + // Reduce __m to an equivalent number in the range [0, size()). We + // have to be careful with negative numbers, since the sign of a % b + // is unspecified when a < 0. + long __n = __m; + if (this->size() < (numeric_limits::max)()) + __n %= long(this->size()); + if (__n < 0) + __n += this->size(); + + copy(this->_M_first, this->_M_first + __n, + __tmp._M_first + (this->size() - __n)); + copy(this->_M_first + __n, this->_M_first + this->size(), + __tmp._M_first); + + return __tmp; +} + +_STLP_END_NAMESPACE + +#endif /* _STLP_VALARRAY_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_valarray.h b/sdk/tlibstdcxx/stlport/stl/_valarray.h new file mode 100644 index 0000000000..cd9641ab4a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_valarray.h @@ -0,0 +1,1684 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_VALARRAY_H +#define _STLP_VALARRAY_H + +#ifndef _STLP_INTERNAL_CMATH +# include +#endif + +#ifndef _STLP_INTERNAL_NEW +# include +#endif + +#ifndef _STLP_INTERNAL_ALGO_H +# include +#endif + +#ifndef _STLP_INTERNAL_NUMERIC_H +# include +#endif + +#ifndef _STLP_INTERNAL_LIMITS +# include +#endif + +_STLP_BEGIN_NAMESPACE + +class slice; +class gslice; + +template class valarray; +typedef valarray _Valarray_bool; +typedef valarray _Valarray_size_t; + +template class slice_array; +template class gslice_array; +template class mask_array; +template class indirect_array; + +//---------------------------------------------------------------------- +// class valarray + +// Base class to handle memory allocation and deallocation. We can't just +// use vector<>, because vector would be unsuitable as an internal +// representation for valarray. + +template +struct _Valarray_base { + _Tp* _M_first; + size_t _M_size; + + _Valarray_base() : _M_first(0), _M_size(0) {} + _Valarray_base(size_t __n) : _M_first(0), _M_size(0) { _M_allocate(__n); } + ~_Valarray_base() { _M_deallocate(); } + + void _M_allocate(size_t __n) { + if (__n != 0) { + _M_first = __STATIC_CAST(_Tp*, __stl_new(__n * sizeof(_Tp))); + _M_size = __n; + } + else { + _M_first = 0; + _M_size = 0; + } + } + + void _M_deallocate() { + __stl_delete(_M_first); + _M_first = 0; + _M_size = 0; + } +}; + +template +class valarray : private _Valarray_base<_Tp> +{ + friend class gslice; + +public: + typedef _Tp value_type; + + // Basic constructors + valarray() : _Valarray_base<_Tp>() {} + explicit valarray(size_t __n) : _Valarray_base<_Tp>(__n) + { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(value_type)); } + valarray(const value_type& __x, size_t __n) : _Valarray_base<_Tp>(__n) + { uninitialized_fill_n(this->_M_first, this->_M_size, __x); } + valarray(const value_type* __p, size_t __n) : _Valarray_base<_Tp>(__n) + { uninitialized_copy(__p, __p + __n, this->_M_first); } + valarray(const valarray<_Tp>& __x) : _Valarray_base<_Tp>(__x._M_size) { + uninitialized_copy(__x._M_first, __x._M_first + __x._M_size, + this->_M_first); + } + + // Constructors from auxiliary array types + valarray(const slice_array<_Tp>&); + valarray(const gslice_array<_Tp>&); + valarray(const mask_array<_Tp>&); + valarray(const indirect_array<_Tp>&); + + // Destructor + ~valarray() { _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); } + + // Extension: constructor that doesn't initialize valarray elements to a + // specific value. This is faster for types such as int and double. +private: + void _M_initialize(const __true_type&) {} + void _M_initialize(const __false_type&) + { uninitialized_fill_n(this->_M_first, this->_M_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } + +public: + struct _NoInit {}; + valarray(size_t __n, _NoInit) : _Valarray_base<_Tp>(__n) { + typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial; + _M_initialize(_Is_Trivial()); + } + +public: // Assignment + // Basic assignment. Note that 'x = y' is undefined if x.size() != y.size() + valarray<_Tp>& operator=(const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + if (this != &__x) + copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first); + return *this; + } + + // Scalar assignment + valarray<_Tp>& operator=(const value_type& __x) { + fill_n(this->_M_first, this->_M_size, __x); + return *this; + } + + // Assignment of auxiliary array types + valarray<_Tp>& operator=(const slice_array<_Tp>&); + valarray<_Tp>& operator=(const gslice_array<_Tp>&); + valarray<_Tp>& operator=(const mask_array<_Tp>&); + valarray<_Tp>& operator=(const indirect_array<_Tp>&); + +public: // Element access + value_type operator[](size_t __n) const { + _STLP_ASSERT(__n < this->size()) + return this->_M_first[__n]; + } + value_type& operator[](size_t __n) { + _STLP_ASSERT(__n < this->size()) + return this->_M_first[__n]; + } + size_t size() const { return this->_M_size; } + +public: // Subsetting operations with auxiliary type + valarray<_Tp> operator[](slice) const; + slice_array<_Tp> operator[](slice); + valarray<_Tp> operator[](const gslice&) const; + gslice_array<_Tp> operator[](const gslice&); + valarray<_Tp> operator[](const _Valarray_bool&) const; + mask_array<_Tp> operator[](const _Valarray_bool&); + valarray<_Tp> operator[](const _Valarray_size_t&) const; + indirect_array<_Tp> operator[](const _Valarray_size_t&); + +public: // Unary operators. + valarray<_Tp> operator+() const { return *this; } + + valarray<_Tp> operator-() const { + valarray<_Tp> __tmp(this->size(), _NoInit()); + for (size_t __i = 0; __i < this->size(); ++__i) + __tmp[__i] = -(*this)[__i]; + return __tmp; + } + + valarray<_Tp> operator~() const { + valarray<_Tp> __tmp(this->size(), _NoInit()); + for (size_t __i = 0; __i < this->size(); ++__i) + __tmp[__i] = ~(*this)[__i]; + return __tmp; + } + + _Valarray_bool operator!() const; + +public: // Scalar computed assignment. + valarray<_Tp>& operator*= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] *= __x; + return *this; + } + + valarray<_Tp>& operator/= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] /= __x; + return *this; + } + + valarray<_Tp>& operator%= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] %= __x; + return *this; + } + + valarray<_Tp>& operator+= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] += __x; + return *this; + } + + valarray<_Tp>& operator-= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] -= __x; + return *this; + } + + valarray<_Tp>& operator^= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] ^= __x; + return *this; + } + + valarray<_Tp>& operator&= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] &= __x; + return *this; + } + + valarray<_Tp>& operator|= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] |= __x; + return *this; + } + + valarray<_Tp>& operator<<= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] <<= __x; + return *this; + } + + valarray<_Tp>& operator>>= (const value_type& __x) { + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] >>= __x; + return *this; + } + +public: // Array computed assignment. + valarray<_Tp>& operator*= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] *= __x[__i]; + return *this; + } + + valarray<_Tp>& operator/= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] /= __x[__i]; + return *this; + } + + valarray<_Tp>& operator%= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] %= __x[__i]; + return *this; + } + + valarray<_Tp>& operator+= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] += __x[__i]; + return *this; + } + + valarray<_Tp>& operator-= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] -= __x[__i]; + return *this; + } + + valarray<_Tp>& operator^= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] ^= __x[__i]; + return *this; + } + + valarray<_Tp>& operator&= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] &= __x[__i]; + return *this; + } + + valarray<_Tp>& operator|= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] |= __x[__i]; + return *this; + } + + valarray<_Tp>& operator<<= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] <<= __x[__i]; + return *this; + } + + valarray<_Tp>& operator>>= (const valarray<_Tp>& __x) { + _STLP_ASSERT(__x.size() == this->size()) + for (size_t __i = 0; __i < this->size(); ++__i) + (*this)[__i] >>= __x[__i]; + return *this; + } + +public: // Other member functions. + + // The result is undefined for zero-length arrays + value_type sum() const { + _STLP_ASSERT(this->size() != 0) + return accumulate(this->_M_first + 1, this->_M_first + this->_M_size, + (*this)[0]); + } + + // The result is undefined for zero-length arrays + value_type (min) () const { + _STLP_ASSERT(this->size() != 0) + return *min_element(this->_M_first + 0, this->_M_first + this->_M_size); + } + + value_type (max) () const { + _STLP_ASSERT(this->size() != 0) + return *max_element(this->_M_first + 0, this->_M_first + this->_M_size); + } + + valarray<_Tp> shift(int __n) const; + valarray<_Tp> cshift(int __n) const; + + valarray<_Tp> apply(value_type __f(value_type)) const { + valarray<_Tp> __tmp(this->size()); + transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first, + __f); + return __tmp; + } + valarray<_Tp> apply(value_type __f(const value_type&)) const { + valarray<_Tp> __tmp(this->size()); + transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first, + __f); + return __tmp; + } + + void resize(size_t __n, value_type __x = value_type()) { + _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); + _Valarray_base<_Tp>::_M_deallocate(); + _Valarray_base<_Tp>::_M_allocate(__n); + uninitialized_fill_n(this->_M_first, this->_M_size, __x); + } +}; + +//---------------------------------------------------------------------- +// valarray non-member functions. + +// Binary arithmetic operations between two arrays. Behavior is +// undefined if the two arrays do not have the same length. + +template +inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] * __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] / __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] % __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] + __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] - __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] ^ __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] & __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] | __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] << __y[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >> __y[__i]; + return __tmp; +} + +// Binary arithmetic operations between an array and a scalar. + +template +inline valarray<_Tp> _STLP_CALL operator*(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] * __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator*(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c * __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator/(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] / __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator/(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c / __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator%(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] % __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator%(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c % __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator+(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] + __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator+(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c + __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator-(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] - __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator-(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c - __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator^(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] ^ __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator^(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c ^ __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator&(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] & __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator&(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c & __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator|(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] | __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator|(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c | __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator<<(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] << __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator<<(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c << __x[__i]; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator>>(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >> __c; + return __tmp; +} + +template +inline valarray<_Tp> _STLP_CALL operator>>(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c >> __x[__i]; + return __tmp; +} + +// Binary logical operations between two arrays. Behavior is undefined +// if the two arrays have different lengths. Note that operator== does +// not do what you might at first expect. + +template +inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] == __y[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] < __y[__i]; + return __tmp; +} + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE + +template +inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] != __y[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] > __y[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] <= __y[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >= __y[__i]; + return __tmp; +} + +#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */ +// fbp : swap ? + +template +inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] && __y[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + _STLP_ASSERT(__x.size() == __y.size()) + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] || __y[__i]; + return __tmp; +} + +// Logical operations between an array and a scalar. + +template +inline _Valarray_bool _STLP_CALL operator==(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] == __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator==(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c == __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator!=(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] != __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator!=(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c != __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator<(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] < __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator<(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c < __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator>(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] > __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator>(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c > __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator<=(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] <= __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator<=(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c <= __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator>=(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] >= __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator>=(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c >= __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator&&(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] && __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator&&(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c && __x[__i]; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator||(const valarray<_Tp>& __x, const _Tp& __c) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __x[__i] || __c; + return __tmp; +} + +template +inline _Valarray_bool _STLP_CALL operator||(const _Tp& __c, const valarray<_Tp>& __x) { + _Valarray_bool __tmp(__x.size(), _Valarray_bool::_NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = __c || __x[__i]; + return __tmp; +} + +// valarray "transcendentals" (the list includes abs and sqrt, which, +// of course, are not transcendental). + +template +inline valarray<_Tp> abs(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::abs(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> acos(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::acos(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> asin(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::asin(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> atan(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::atan(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> atan2(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::atan2(__x[__i], __y[__i]); + return __tmp; +} + +template +inline valarray<_Tp> atan2(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::atan2(__x[__i], __c); + return __tmp; +} + +template +inline valarray<_Tp> atan2(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::atan2(__c, __x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> cos(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::cos(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> cosh(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::cosh(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> exp(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::exp(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> log(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::log(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> log10(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::log10(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> pow(const valarray<_Tp>& __x, + const valarray<_Tp>& __y) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::pow(__x[__i], __y[__i]); + return __tmp; +} + +template +inline valarray<_Tp> pow(const valarray<_Tp>& __x, const _Tp& __c) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::pow(__x[__i], __c); + return __tmp; +} + +template +inline valarray<_Tp> pow(const _Tp& __c, const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::pow(__c, __x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> sin(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::sin(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> sinh(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::sinh(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> sqrt(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::sqrt(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> tan(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::tan(__x[__i]); + return __tmp; +} + +template +inline valarray<_Tp> tanh(const valarray<_Tp>& __x) { + typedef typename valarray<_Tp>::_NoInit _NoInit; + valarray<_Tp> __tmp(__x.size(), _NoInit()); + for (size_t __i = 0; __i < __x.size(); ++__i) + __tmp[__i] = ::tanh(__x[__i]); + return __tmp; +} + +//---------------------------------------------------------------------- +// slice and slice_array + +class slice { +public: + slice() : _M_start(0), _M_length(0), _M_stride(0) {} + slice(size_t __start, size_t __length, size_t __stride) + : _M_start(__start), _M_length(__length), _M_stride(__stride) + {} + __TRIVIAL_DESTRUCTOR(slice) + + size_t start() const { return _M_start; } + size_t size() const { return _M_length; } + size_t stride() const { return _M_stride; } + +private: + size_t _M_start; + size_t _M_length; + size_t _M_stride; +}; + +template +class slice_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] = __x[__i]; + } + + void operator*=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] *= __x[__i]; + } + + void operator/=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] /= __x[__i]; + } + + void operator%=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] %= __x[__i]; + } + + void operator+=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] += __x[__i]; + } + + void operator-=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] -= __x[__i]; + } + + void operator^=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] ^= __x[__i]; + } + + void operator&=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] &= __x[__i]; + } + + void operator|=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] |= __x[__i]; + } + + void operator<<=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] <<= __x[__i]; + } + + void operator>>=(const valarray& __x) const { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] >>= __x[__i]; + } + + void operator=(const value_type& __c) /*const could be const but standard says NO (26.3.5.4-1)*/ { + size_t __index = _M_slice.start(); + for (size_t __i = 0; + __i < _M_slice.size(); + ++__i, __index += _M_slice.stride()) + _M_array[__index] = __c; + } + + // C++ Standard defect 253, copy constructor must be public. + slice_array(const slice_array &__x) + : _M_slice(__x._M_slice), _M_array(__x._M_array) + {} + + ~slice_array() {} + +private: + slice_array(const slice& __slice, valarray<_Tp> &__array) + : _M_slice(__slice), _M_array(__array) + {} + + slice _M_slice; + valarray<_Tp>& _M_array; + +private: + // Disable default constructor and assignment + slice_array(); + slice_array& operator=(const slice_array&); +}; + +// valarray member functions dealing with slice and slice_array + +template +inline valarray<_Tp>::valarray(const slice_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_slice.size()) { + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + + +template +inline slice_array<_Tp> valarray<_Tp>::operator[](slice __slice) +{ return slice_array<_Tp>(__slice, *this); } + +//---------------------------------------------------------------------- +// gslice and gslice_array + +template +struct _Gslice_Iter_tmpl; + +class gslice { + friend struct _Gslice_Iter_tmpl; +public: + gslice() : _M_start(0), _M_lengths(), _M_strides() {} + gslice(size_t __start, + const _Valarray_size_t& __lengths, const _Valarray_size_t& __strides) + : _M_start(__start), _M_lengths(__lengths), _M_strides(__strides) + {} + __TRIVIAL_DESTRUCTOR(gslice) + + size_t start() const { return _M_start; } + _Valarray_size_t size() const { return _M_lengths; } + _Valarray_size_t stride() const { return _M_strides; } + + // Extension: check for an empty gslice. + bool _M_empty() const { return _M_lengths.size() == 0; } + + // Extension: number of indices this gslice represents. (For a degenerate + // gslice, they're not necessarily all distinct.) + size_t _M_size() const { + return !this->_M_empty() + ? accumulate(_M_lengths._M_first + 1, + _M_lengths._M_first + _M_lengths._M_size, + _M_lengths[0], + multiplies()) + : 0; + } + +# ifndef __HP_aCC +private: +# endif + + size_t _M_start; + _Valarray_size_t _M_lengths; + _Valarray_size_t _M_strides; +}; + +// This is not an STL iterator. It is constructed from a gslice, and it +// steps through the gslice indices in sequence. See 23.3.6 of the C++ +// standard, paragraphs 2-3, for an explanation of the sequence. At +// each step we get two things: the ordinal (i.e. number of steps taken), +// and the one-dimensional index. + +template +struct _Gslice_Iter_tmpl { + _Gslice_Iter_tmpl(const gslice& __gslice) + : _M_step(0), _M_1d_idx(__gslice.start()), + _M_indices(size_t(0), __gslice._M_lengths.size()), + _M_gslice(__gslice) + {} + + bool _M_done() const { return _M_indices[0] == _M_gslice._M_lengths[0]; } + + bool _M_incr(); + + _Size _M_step; + _Size _M_1d_idx; + + valarray<_Size> _M_indices; + const gslice& _M_gslice; +}; + +typedef _Gslice_Iter_tmpl _Gslice_Iter; + +template +class gslice_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] = __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator*= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] *= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator/= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] /= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator%= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] %= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator+= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] += __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator-= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] -= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator^= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] ^= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator&= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] &= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator|= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] |= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator<<= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] <<= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator>>= (const valarray& __x) const { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] >>= __x[__i._M_step]; while(__i._M_incr()); + } + } + + void operator= (const value_type& __c) /*const could be const but standard says NO (26.3.7.4-1)*/ { + if (!_M_gslice._M_empty()) { + _Gslice_Iter __i(_M_gslice); + do _M_array[__i._M_1d_idx] = __c; while(__i._M_incr()); + } + } + + // C++ Standard defect 253, copy constructor must be public. + gslice_array(const gslice_array& __x) + : _M_gslice(__x._M_gslice), _M_array(__x._M_array) + {} + + ~gslice_array() {} + +private: + gslice_array(const gslice &__gslice, valarray<_Tp> &__array) + : _M_gslice(__gslice), _M_array(__array) + {} + + gslice _M_gslice; + valarray& _M_array; + +private: + // Disable default constructor and assignment + gslice_array(); + void operator=(const gslice_array<_Tp>&); +}; + +// valarray member functions dealing with gslice and gslice_array. Note +// that it is illegal (behavior is undefined) to construct a gslice_array +// from a degenerate gslice. + +template +inline valarray<_Tp>::valarray(const gslice_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_gslice._M_size()) { + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + +template +inline gslice_array<_Tp> valarray<_Tp>::operator[](const gslice& __slice) +{ return gslice_array<_Tp>(__slice, *this); } + + +//---------------------------------------------------------------------- +// mask_array + +template +class mask_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] = __x[__idx++]; + } + + void operator*=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] *= __x[__idx++]; + } + + void operator/=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] /= __x[__idx++]; + } + + void operator%=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] %= __x[__idx++]; + } + + void operator+=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] += __x[__idx++]; + } + + void operator-=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] -= __x[__idx++]; + } + + void operator^=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] ^= __x[__idx++]; + } + + void operator&=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] &= __x[__idx++]; + } + + void operator|=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] |= __x[__idx++]; + } + + void operator<<=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] <<= __x[__idx++]; + } + + void operator>>=(const valarray& __x) const { + size_t __idx = 0; + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] >>= __x[__idx++]; + } + + void operator=(const value_type& __c) const { + for (size_t __i = 0; __i < _M_array.size(); ++__i) + if (_M_mask[__i]) _M_array[__i] = __c; + } + + // Extension: number of true values in the mask + size_t _M_num_true() const { + size_t __result = 0; + for (size_t __i = 0; __i < _M_mask.size(); ++__i) + if (_M_mask[__i]) ++__result; + return __result; + } + + // C++ Standard defect 253, copy constructor must be public. + mask_array(const mask_array& __x) + : _M_mask(__x._M_mask), _M_array(__x._M_array) + {} + + ~mask_array() {} + +private: + mask_array(const _Valarray_bool& __mask, valarray<_Tp>& __array) + : _M_mask(__mask), _M_array(__array) + {} + _Valarray_bool _M_mask; + valarray<_Tp>& _M_array; + +private: + // Disable default constructor and assignment + mask_array(); + void operator=(const mask_array<_Tp>&); +}; + +// valarray member functions dealing with mask_array + +template +inline valarray<_Tp>::valarray(const mask_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_num_true()) { + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + +// Behavior is undefined if __x._M_num_true() != this->size() +template +inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __x) { + size_t __idx = 0; + for (size_t __i = 0; __i < __x._M_array.size(); ++__i) + if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i]; + return *this; +} + +template +inline mask_array<_Tp> valarray<_Tp>::operator[](const _Valarray_bool& __mask) { + _STLP_ASSERT(__mask.size() == this->size()) + return mask_array<_Tp>(__mask, *this); +} + +//---------------------------------------------------------------------- +// indirect_array + +template +class indirect_array { + friend class valarray<_Tp>; +public: + typedef _Tp value_type; + + void operator=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] = __x[__i]; + } + + void operator*=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] *= __x[__i]; + } + + void operator/=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] /= __x[__i]; + } + + void operator%=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] %= __x[__i]; + } + + void operator+=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] += __x[__i]; + } + + void operator-=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] -= __x[__i]; + } + + void operator^=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] ^= __x[__i]; + } + + void operator&=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] &= __x[__i]; + } + + void operator|=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] |= __x[__i]; + } + + void operator<<=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] <<= __x[__i]; + } + + void operator>>=(const valarray& __x) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] >>= __x[__i]; + } + + void operator=(const value_type& __c) const { + for (size_t __i = 0; __i < _M_addr.size(); ++__i) + _M_array[_M_addr[__i]] = __c; + } + + // C++ Standard defect 253, copy constructor must be public. + indirect_array(const indirect_array& __x) + : _M_addr(__x._M_addr), _M_array(__x._M_array) + {} + + ~indirect_array() {} + +private: + indirect_array(const _Valarray_size_t& __addr, valarray<_Tp>& __array) + : _M_addr(__addr), _M_array(__array) + {} + + _Valarray_size_t _M_addr; + valarray<_Tp>& _M_array; + +private: + // Disable default constructor and assignment + indirect_array(); + void operator=(const indirect_array<_Tp>&); +}; + +// valarray member functions dealing with indirect_array + +template +inline valarray<_Tp>::valarray(const indirect_array<_Tp>& __x) + : _Valarray_base<_Tp>(__x._M_addr.size()) { + typedef typename __type_traits<_Tp>::has_trivial_default_constructor + _Is_Trivial; + _M_initialize(_Is_Trivial()); + *this = __x; +} + + +template +inline indirect_array<_Tp> +valarray<_Tp>::operator[](const _Valarray_size_t& __addr) +{ return indirect_array<_Tp>(__addr, *this); } + +_STLP_END_NAMESPACE + +# if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +# endif + +#endif /* _STLP_VALARRAY */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_vector.c b/sdk/tlibstdcxx/stlport/stl/_vector.c new file mode 100644 index 0000000000..705f786006 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_vector.c @@ -0,0 +1,242 @@ +/* + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_VECTOR_C +#define _STLP_VECTOR_C + +#if !defined (_STLP_INTERNAL_VECTOR_H) +# include +#endif + +#include + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void _Vector_base<_Tp,_Alloc>::_M_throw_length_error() const +{ __stl_throw_length_error("vector"); } + +template +void _Vector_base<_Tp, _Alloc>::_M_throw_out_of_range() const +{ __stl_throw_out_of_range("vector"); } + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define vector _STLP_PTR_IMPL_NAME(vector) +#elif defined (_STLP_DEBUG) +# define vector _STLP_NON_DBG_NAME(vector) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# define __iterator__ _Tp* +#else +# define __iterator__ _STLP_TYPENAME_ON_RETURN_TYPE vector<_Tp, _Alloc>::iterator +#endif + +template +void vector<_Tp, _Alloc>::reserve(size_type __n) { + if (capacity() < __n) { + if (max_size() < __n) { + this->_M_throw_length_error(); + } + + const size_type __old_size = size(); + pointer __tmp; + if (this->_M_start) { + __tmp = _M_allocate_and_copy(__n, this->_M_start, this->_M_finish); + _M_clear(); + } else { + __tmp = this->_M_end_of_storage.allocate(__n, __n); + } + _M_set(__tmp, __tmp + __old_size, __tmp + __n); + } +} + +template +void vector<_Tp, _Alloc>::_M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*DO NOT USE!!*/, + size_type __fill_len, bool __atend ) { + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + size_type __len = _M_compute_next_size(__fill_len); + pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); + pointer __new_finish = __new_start; + _STLP_TRY { + __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable()); + // handle insertion + if (__fill_len == 1) { + _Copy_Construct(__new_finish, __x); + ++__new_finish; + } else + __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __fill_len, __x); + if (!__atend) + __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); // copy remainder + } + _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), + this->_M_end_of_storage.deallocate(__new_start,__len))) + _M_clear_after_move(); + _M_set(__new_start, __new_finish, __new_start + __len); +} + +template +void vector<_Tp, _Alloc>::_M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/, + size_type __fill_len, bool __atend ) { + size_type __len = _M_compute_next_size(__fill_len); + pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); + pointer __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(this->_M_start, __pos, __new_start)); + // handle insertion + __new_finish = _STLP_PRIV __fill_n(__new_finish, __fill_len, __x); + if (!__atend) + __new_finish = __STATIC_CAST(pointer, _STLP_PRIV __copy_trivial(__pos, this->_M_finish, __new_finish)); // copy remainder + _M_clear(); + _M_set(__new_start, __new_finish, __new_start + __len); +} + +template +void vector<_Tp, _Alloc>::_M_fill_insert_aux(iterator __pos, size_type __n, + const _Tp& __x, const __true_type& /*_Movable*/) { + if (_M_is_inside(__x)) { + _Tp __x_copy = __x; + _M_fill_insert_aux(__pos, __n, __x_copy, __true_type()); + return; + } + iterator __src = this->_M_finish - 1; + iterator __dst = __src + __n; + for (; __src >= __pos; --__dst, --__src) { + _STLP_STD::_Move_Construct(__dst, *__src); + _STLP_STD::_Destroy_Moved(__src); + } + _STLP_PRIV __uninitialized_fill_n(__pos, __n, __x); + this->_M_finish += __n; +} + +template +void vector<_Tp, _Alloc>::_M_fill_insert_aux (iterator __pos, size_type __n, + const _Tp& __x, const __false_type& /*_Movable*/) { + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + //Here self referencing needs to be checked even for non movable types. + if (_M_is_inside(__x)) { + _Tp __x_copy = __x; + _M_fill_insert_aux(__pos, __n, __x_copy, __false_type()); + return; + } + const size_type __elems_after = this->_M_finish - __pos; + pointer __old_finish = this->_M_finish; + if (__elems_after > __n) { + _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy()); + this->_M_finish += __n; + _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy()); + _STLP_STD::fill(__pos, __pos + __n, __x); + } else { + this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x); + _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy()); + this->_M_finish += __elems_after; + _STLP_STD::fill(__pos, __old_finish, __x); + } +} + +template +void vector<_Tp, _Alloc>::_M_fill_insert(iterator __pos, + size_type __n, const _Tp& __x) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + if (__n != 0) { + if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) { + _M_fill_insert_aux(__pos, __n, __x, _Movable()); + } else { + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + _M_insert_overflow(__pos, __x, _TrivialCopy(), __n); + } + } +} + +template +vector<_Tp, _Alloc>& vector<_Tp, _Alloc>::operator = (const vector<_Tp, _Alloc>& __x) { + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; + if (&__x != this) { + const size_type __xlen = __x.size(); + if (__xlen > capacity()) { + size_type __len = __xlen; + pointer __tmp = _M_allocate_and_copy(__len, __CONST_CAST(const_pointer, __x._M_start) + 0, + __CONST_CAST(const_pointer, __x._M_finish) + 0); + _M_clear(); + this->_M_start = __tmp; + this->_M_end_of_storage._M_data = this->_M_start + __len; + } else if (size() >= __xlen) { + pointer __i = _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + 0, + __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_start, _TrivialCopy()); + _STLP_STD::_Destroy_Range(__i, this->_M_finish); + } else { + _STLP_PRIV __copy_ptrs(__CONST_CAST(const_pointer, __x._M_start), + __CONST_CAST(const_pointer, __x._M_start) + size(), this->_M_start, _TrivialCopy()); + _STLP_PRIV __ucopy_ptrs(__CONST_CAST(const_pointer, __x._M_start) + size(), + __CONST_CAST(const_pointer, __x._M_finish) + 0, this->_M_finish, _TrivialUCopy()); + } + this->_M_finish = this->_M_start + __xlen; + } + return *this; +} + +template +void vector<_Tp, _Alloc>::_M_fill_assign(size_t __n, const _Tp& __val) { + if (__n > capacity()) { + vector<_Tp, _Alloc> __tmp(__n, __val, get_allocator()); + __tmp.swap(*this); + } else if (__n > size()) { + fill(begin(), end(), __val); + this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_finish, __n - size(), __val); + } else + erase(_STLP_PRIV __fill_n(begin(), __n, __val), end()); +} + +template +__iterator__ +vector<_Tp, _Alloc>::insert(iterator __pos, const _Tp& __x) { + size_type __n = __pos - begin(); + _M_fill_insert(__pos, 1, __x); + return begin() + __n; +} + +#undef __iterator__ + +#if defined (vector) +# undef vector +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_VECTOR_C */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/_vector.h b/sdk/tlibstdcxx/stlport/stl/_vector.h new file mode 100644 index 0000000000..ed243ef374 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/_vector.h @@ -0,0 +1,773 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_VECTOR_H +#define _STLP_INTERNAL_VECTOR_H + +#ifndef _STLP_INTERNAL_ALGOBASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +#ifndef _STLP_INTERNAL_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_UNINITIALIZED_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +// The vector base class serves one purpose, its constructor and +// destructor allocate (but don't initialize) storage. This makes +// exception safety easier. + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class _Vector_base { +public: + typedef _Vector_base<_Tp, _Alloc> _Self; + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef _Alloc allocator_type; + typedef _Tp* pointer; + typedef _STLP_alloc_proxy _AllocProxy; + + _Vector_base(const _Alloc& __a) + : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) {} + + _Vector_base(size_t __n, const _Alloc& __a) + : _M_start(0), _M_finish(0), _M_end_of_storage(__a, 0) { + _M_start = _M_end_of_storage.allocate(__n, __n); + _M_finish = _M_start; + _M_end_of_storage._M_data = _M_start + __n; + _STLP_MPWFIX_TRY _STLP_MPWFIX_CATCH + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Vector_base(__move_source<_Self> src) + : _M_start(src.get()._M_start), _M_finish(src.get()._M_finish), + _M_end_of_storage(__move_source<_AllocProxy>(src.get()._M_end_of_storage)) { + //Set the source as empty: + src.get()._M_finish = src.get()._M_end_of_storage._M_data = src.get()._M_start = 0; + } +#endif + + ~_Vector_base() { + if (_M_start != _STLP_DEFAULT_CONSTRUCTED(pointer)) + _M_end_of_storage.deallocate(_M_start, _M_end_of_storage._M_data - _M_start); + } + +protected: + void _STLP_FUNCTION_THROWS _M_throw_length_error() const; + void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const; + + pointer _M_start; + pointer _M_finish; + _AllocProxy _M_end_of_storage; +}; + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define vector _STLP_PTR_IMPL_NAME(vector) +#elif defined (_STLP_DEBUG) +# define vector _STLP_NON_DBG_NAME(vector) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template ) > +class vector : protected _STLP_PRIV _Vector_base<_Tp, _Alloc> +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector) + , public __stlport_class > +#endif +{ +private: + typedef _STLP_PRIV _Vector_base<_Tp, _Alloc> _Base; + typedef vector<_Tp, _Alloc> _Self; +public: + _STLP_FORCE_ALLOCATORS(_Tp, _Alloc) + typedef typename _Base::allocator_type allocator_type; + + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type* iterator; + typedef const value_type* const_iterator; + + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag _Iterator_category; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR((const allocator_type&)this->_M_end_of_storage, _Tp); } + +private: +#if defined (_STLP_NO_MOVE_SEMANTIC) + typedef __false_type _Movable; +#endif + + // handles insertions on overflow + void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __false_type& /*_Movable*/, + size_type __fill_len, bool __atend); + void _M_insert_overflow_aux(pointer __pos, const _Tp& __x, const __true_type& /*_Movable*/, + size_type __fill_len, bool __atend) { + //We need to take care of self referencing here: + if (_M_is_inside(__x)) { + value_type __x_copy = __x; + _M_insert_overflow_aux(__pos, __x_copy, __false_type(), __fill_len, __atend); + return; + } + _M_insert_overflow_aux(__pos, __x, __false_type(), __fill_len, __atend); + } + + void _M_insert_overflow(pointer __pos, const _Tp& __x, const __false_type& /*_TrivialCopy*/, + size_type __fill_len, bool __atend = false) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + _M_insert_overflow_aux(__pos, __x, _Movable(), __fill_len, __atend); + } + void _M_insert_overflow(pointer __pos, const _Tp& __x, const __true_type& /*_TrivialCopy*/, + size_type __fill_len, bool __atend = false); + void _M_range_check(size_type __n) const { + if (__n >= size_type(this->_M_finish - this->_M_start)) + this->_M_throw_out_of_range(); + } + + size_type _M_compute_next_size(size_type __n) { + const size_type __size = size(); + if (__n > max_size() - __size) + this->_M_throw_length_error(); + size_type __len = __size + (max)(__n, __size); + if (__len > max_size() || __len < __size) + __len = max_size(); // overflow + return __len; + } + +public: + iterator begin() { return this->_M_start; } + const_iterator begin() const { return this->_M_start; } + iterator end() { return this->_M_finish; } + const_iterator end() const { return this->_M_finish; } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + size_type size() const { return size_type(this->_M_finish - this->_M_start); } + size_type max_size() const { + size_type __vector_max_size = size_type(-1) / sizeof(_Tp); + typename allocator_type::size_type __alloc_max_size = this->_M_end_of_storage.max_size(); + return (__alloc_max_size < __vector_max_size)?__alloc_max_size:__vector_max_size; + } + + size_type capacity() const { return size_type(this->_M_end_of_storage._M_data - this->_M_start); } + bool empty() const { return this->_M_start == this->_M_finish; } + + reference operator[](size_type __n) { return *(begin() + __n); } + const_reference operator[](size_type __n) const { return *(begin() + __n); } + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(end() - 1); } + const_reference back() const { return *(end() - 1); } + + reference at(size_type __n) { _M_range_check(__n); return (*this)[__n]; } + const_reference at(size_type __n) const { _M_range_check(__n); return (*this)[__n]; } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit vector(const allocator_type& __a = allocator_type()) +#else + vector() + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) {} + vector(const allocator_type& __a) +#endif + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) {} + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) +private: + //We always call _M_initialize with only 1 parameter. Default parameter + //is used to allow explicit instanciation of vector with types with no + //default constructor. + void _M_initialize(size_type __n, const _Tp& __val = _STLP_DEFAULT_CONSTRUCTED(_Tp)) + { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, __val); } +public: + explicit vector(size_type __n) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type()) + { _M_initialize(__n); } + vector(size_type __n, const _Tp& __val, const allocator_type& __a = allocator_type()) +#else + explicit vector(size_type __n) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type()) + { this->_M_finish = _STLP_PRIV __uninitialized_init(this->_M_start, __n, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } + vector(size_type __n, const _Tp& __val) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, allocator_type()) + { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); } + vector(size_type __n, const _Tp& __val, const allocator_type& __a) +#endif + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__n, __a) + { this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); } + + vector(const _Self& __x) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__x.size(), __x.get_allocator()) { + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; + this->_M_finish = _STLP_PRIV __ucopy_ptrs(__x.begin(), __x.end(), this->_M_start, _TrivialUCopy()); + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + vector(__move_source<_Self> src) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__move_source<_Base>(src.get())) + {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) +private: + template + void _M_initialize_aux(_Integer __n, _Integer __val, + const __true_type& /*_IsIntegral*/) { + size_type __real_n = __n; + this->_M_start = this->_M_end_of_storage.allocate(__n, __real_n); + this->_M_end_of_storage._M_data = this->_M_start + __real_n; + this->_M_finish = _STLP_PRIV __uninitialized_fill_n(this->_M_start, __n, __val); + } + + template + void _M_initialize_aux(_InputIterator __first, _InputIterator __last, + const __false_type& /*_IsIntegral*/) + { _M_range_initialize(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); } + +public: + // Check whether it's an integral type. If so, it's not an iterator. + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL ) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__a) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_aux(__first, __last, _Integral()); + } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + vector(_InputIterator __first, _InputIterator __last) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(allocator_type()) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_initialize_aux(__first, __last, _Integral()); + } +# endif /* _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS */ + +#else /* _STLP_MEMBER_TEMPLATES */ + vector(const _Tp* __first, const _Tp* __last, + const allocator_type& __a = allocator_type()) + : _STLP_PRIV _Vector_base<_Tp, _Alloc>(__last - __first, __a) { + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; + this->_M_finish = _STLP_PRIV __ucopy_ptrs(__first, __last, this->_M_start, _TrivialUCopy()); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + //As the vector container is a back insert oriented container it + //seems rather logical to destroy elements in reverse order. + ~vector() { _STLP_STD::_Destroy_Range(rbegin(), rend()); } + + _Self& operator=(const _Self& __x); + + void reserve(size_type __n); + + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + + void assign(size_type __n, const _Tp& __val) { _M_fill_assign(__n, __val); } + void _M_fill_assign(size_type __n, const _Tp& __val); + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_assign_aux(_ForwardIter __first, _ForwardIter __last, const forward_iterator_tag &) { +#else + void assign(const_iterator __first, const_iterator __last) { + typedef const_iterator _ForwardIter; +#endif + const size_type __len = _STLP_STD::distance(__first, __last); + if (__len > capacity()) { + size_type __n = __len; + iterator __tmp = _M_allocate_and_copy(__n, __first, __last); + _M_clear(); + _M_set(__tmp, __tmp + __len, __tmp + __n); + } + else if (size() >= __len) { + iterator __new_finish = copy(__first, __last, this->_M_start); + _STLP_STD::_Destroy_Range(__new_finish, this->_M_finish); + this->_M_finish = __new_finish; + } + else { + _ForwardIter __mid = __first; + _STLP_STD::advance(__mid, size()); + _STLP_STD::copy(__first, __mid, this->_M_start); + this->_M_finish = _STLP_STD::uninitialized_copy(__mid, __last, this->_M_finish); + } + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_assign_aux(_InputIter __first, _InputIter __last, + const input_iterator_tag &) { + iterator __cur = begin(); + for ( ; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + erase(__cur, end()); + else + insert(end(), __first, __last); + } + + template + void _M_assign_dispatch(_Integer __n, _Integer __val, + const __true_type& /*_IsIntegral*/) + { _M_fill_assign(__n, __val); } + + template + void _M_assign_dispatch(_InputIter __first, _InputIter __last, + const __false_type& /*_IsIntegral*/) + { _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); } + + template + void assign(_InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back(const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + void push_back(const _Tp& __x) { +#endif + if (this->_M_finish != this->_M_end_of_storage._M_data) { + _Copy_Construct(this->_M_finish, __x); + ++this->_M_finish; + } + else { + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + _M_insert_overflow(this->_M_finish, __x, _TrivialCopy(), 1, true); + } + } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)); +#else + iterator insert(iterator __pos, const _Tp& __x); +#endif + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + void push_back() { push_back(_STLP_DEFAULT_CONSTRUCTED(_Tp)); } + iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif + + void swap(_Self& __x) { + _STLP_STD::swap(this->_M_start, __x._M_start); + _STLP_STD::swap(this->_M_finish, __x._M_finish); + this->_M_end_of_storage.swap(__x._M_end_of_storage); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +private: + void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __true_type& /*_Movable*/); + void _M_fill_insert_aux (iterator __pos, size_type __n, const _Tp& __x, const __false_type& /*_Movable*/); + void _M_fill_insert (iterator __pos, size_type __n, const _Tp& __x); + + bool _M_is_inside(const value_type& __x) const { + return (&__x >= this->_M_start && &__x < this->_M_finish); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_range_insert_realloc(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, +#else + void _M_range_insert_realloc(iterator __pos, + const_iterator __first, const_iterator __last, +#endif + size_type __n) { + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + size_type __len = _M_compute_next_size(__n); + pointer __new_start = this->_M_end_of_storage.allocate(__len, __len); + pointer __new_finish = __new_start; + _STLP_TRY { + __new_finish = _STLP_PRIV __uninitialized_move(this->_M_start, __pos, __new_start, _TrivialUCopy(), _Movable()); + __new_finish = uninitialized_copy(__first, __last, __new_finish); + __new_finish = _STLP_PRIV __uninitialized_move(__pos, this->_M_finish, __new_finish, _TrivialUCopy(), _Movable()); + } + _STLP_UNWIND((_STLP_STD::_Destroy_Range(__new_start,__new_finish), + this->_M_end_of_storage.deallocate(__new_start,__len))) + _M_clear_after_move(); + _M_set(__new_start, __new_finish, __new_start + __len); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_range_insert_aux(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, +#else + void _M_range_insert_aux(iterator __pos, + const_iterator __first, const_iterator __last, +#endif + size_type __n, const __true_type& /*_Movable*/) { + iterator __src = this->_M_finish - 1; + iterator __dst = __src + __n; + for (; __src >= __pos; --__dst, --__src) { + _STLP_STD::_Move_Construct(__dst, *__src); + _STLP_STD::_Destroy_Moved(__src); + } + uninitialized_copy(__first, __last, __pos); + this->_M_finish += __n; + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_range_insert_aux(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, +#else + void _M_range_insert_aux(iterator __pos, + const_iterator __first, const_iterator __last, +#endif + size_type __n, const __false_type& /*_Movable*/) { + typedef typename __type_traits<_Tp>::has_trivial_copy_constructor _TrivialUCopy; + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + const size_type __elems_after = this->_M_finish - __pos; + pointer __old_finish = this->_M_finish; + if (__elems_after > __n) { + _STLP_PRIV __ucopy_ptrs(this->_M_finish - __n, this->_M_finish, this->_M_finish, _TrivialUCopy()); + this->_M_finish += __n; + _STLP_PRIV __copy_backward_ptrs(__pos, __old_finish - __n, __old_finish, _TrivialCopy()); + copy(__first, __last, __pos); + } + else { +#if defined ( _STLP_MEMBER_TEMPLATES ) + _ForwardIterator __mid = __first; + _STLP_STD::advance(__mid, __elems_after); +#else + const_pointer __mid = __first + __elems_after; +#endif + uninitialized_copy(__mid, __last, this->_M_finish); + this->_M_finish += __n - __elems_after; + _STLP_PRIV __ucopy_ptrs(__pos, __old_finish, this->_M_finish, _TrivialUCopy()); + this->_M_finish += __elems_after; + copy(__first, __mid, __pos); + } /* elems_after */ + } + + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + const __true_type&) + { _M_fill_insert(__pos, (size_type) __n, (_Tp) __val); } + + template + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type&) + { _M_range_insert(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator)); } + +public: + // Check whether it's an integral type. If so, it's not an iterator. + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); + } + +private: + template + void _M_range_insert(iterator __pos, + _InputIterator __first, _InputIterator __last, + const input_iterator_tag &) { + for ( ; __first != __last; ++__first) { + __pos = insert(__pos, *__first); + ++__pos; + } + } + + template + void _M_range_insert(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { +#else +public: + void insert(iterator __pos, + const_iterator __first, const_iterator __last) { +#endif +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + /* This method do not check self referencing. + * Standard forbids it, checked by the debug mode. + */ + if (__first != __last) { + size_type __n = _STLP_STD::distance(__first, __last); + + if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) { + _M_range_insert_aux(__pos, __first, __last, __n, _Movable()); + } + else { + _M_range_insert_realloc(__pos, __first, __last, __n); + } + } + } + +public: + void insert (iterator __pos, size_type __n, const _Tp& __x) + { _M_fill_insert(__pos, __n, __x); } + + void pop_back() { + --this->_M_finish; + _STLP_STD::_Destroy(this->_M_finish); + } + +private: + iterator _M_erase(iterator __pos, const __true_type& /*_Movable*/) { + _STLP_STD::_Destroy(__pos); + iterator __dst = __pos, __src = __dst + 1; + iterator __end = end(); + for (; __src != __end; ++__dst, ++__src) { + _STLP_STD::_Move_Construct(__dst, *__src); + _STLP_STD::_Destroy_Moved(__src); + } + this->_M_finish = __dst; + return __pos; + } + iterator _M_erase(iterator __pos, const __false_type& /*_Movable*/) { + if (__pos + 1 != end()) { + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + _STLP_PRIV __copy_ptrs(__pos + 1, this->_M_finish, __pos, _TrivialCopy()); + } + --this->_M_finish; + _STLP_STD::_Destroy(this->_M_finish); + return __pos; + } + iterator _M_erase(iterator __first, iterator __last, const __true_type& /*_Movable*/) { + iterator __dst = __first, __src = __last; + iterator __end = end(); + for (; __dst != __last && __src != __end; ++__dst, ++__src) { + _STLP_STD::_Destroy(__dst); + _STLP_STD::_Move_Construct(__dst, *__src); + } + if (__dst != __last) { + //There is more elements to erase than element to move: + _STLP_STD::_Destroy_Range(__dst, __last); + _STLP_STD::_Destroy_Moved_Range(__last, __end); + } + else { + //There is more element to move than element to erase: + for (; __src != __end; ++__dst, ++__src) { + _STLP_STD::_Destroy_Moved(__dst); + _STLP_STD::_Move_Construct(__dst, *__src); + } + _STLP_STD::_Destroy_Moved_Range(__dst, __end); + } + this->_M_finish = __dst; + return __first; + } + iterator _M_erase(iterator __first, iterator __last, const __false_type& /*_Movable*/) { + typedef typename __type_traits<_Tp>::has_trivial_assignment_operator _TrivialCopy; + pointer __i = _STLP_PRIV __copy_ptrs(__last, this->_M_finish, __first, _TrivialCopy()); + _STLP_STD::_Destroy_Range(__i, this->_M_finish); + this->_M_finish = __i; + return __first; + } + +public: + iterator erase(iterator __pos) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + return _M_erase(__pos, _Movable()); + } + iterator erase(iterator __first, iterator __last) { +#if !defined (_STLP_NO_MOVE_SEMANTIC) + typedef typename __move_traits<_Tp>::implemented _Movable; +#endif + if (__first == __last) + return __first; + return _M_erase(__first, __last, _Movable()); + } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + void resize(size_type __new_size, const _Tp& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + if (__new_size < size()) + erase(begin() + __new_size, end()); + else + insert(end(), __new_size - size(), __x); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void clear() { + erase(begin(), end()); + } + +private: + void _M_clear() { + _STLP_STD::_Destroy_Range(rbegin(), rend()); + this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start); + } + + void _M_clear_after_move() { + _STLP_STD::_Destroy_Moved_Range(rbegin(), rend()); + this->_M_end_of_storage.deallocate(this->_M_start, this->_M_end_of_storage._M_data - this->_M_start); + } + + void _M_set(pointer __s, pointer __f, pointer __e) { + this->_M_start = __s; + this->_M_finish = __f; + this->_M_end_of_storage._M_data = __e; + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + pointer _M_allocate_and_copy(size_type& __n, + _ForwardIterator __first, _ForwardIterator __last) +#else /* _STLP_MEMBER_TEMPLATES */ + pointer _M_allocate_and_copy(size_type& __n, + const_pointer __first, const_pointer __last) +#endif /* _STLP_MEMBER_TEMPLATES */ + { + pointer __result = this->_M_end_of_storage.allocate(__n, __n); + _STLP_TRY { + uninitialized_copy(__first, __last, __result); + return __result; + } + _STLP_UNWIND(this->_M_end_of_storage.deallocate(__result, __n)) + _STLP_RET_AFTER_THROW(__result) + } + + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void _M_range_initialize(_InputIterator __first, _InputIterator __last, + const input_iterator_tag &) { + for ( ; __first != __last; ++__first) + push_back(*__first); + } + // This function is only called by the constructor. + template + void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, + const forward_iterator_tag &) { + size_type __n = _STLP_STD::distance(__first, __last); + this->_M_start = this->_M_end_of_storage.allocate(__n, __n); + this->_M_end_of_storage._M_data = this->_M_start + __n; + this->_M_finish = uninitialized_copy(__first, __last, this->_M_start); + } +#endif /* _STLP_MEMBER_TEMPLATES */ +}; + +#if defined (vector) +# undef vector +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +_STLP_END_NAMESPACE + +#if !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# include +#endif + +//We define the bool specialization before the debug interfave +//to benefit of the debug version of vector even for the bool +//specialization. +#if !defined (_STLP_NO_BOOL) || !defined (_STLP_NO_EXTENSIONS) +# if !defined (_STLP_INTERNAL_BVECTOR_H) +# include +# endif +#endif + +#if defined (_STLP_DEBUG) +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if !defined (_STLP_NO_BOOL) && !defined (_STLP_NO_EXTENSIONS) +// This typedef is non-standard. It is provided for backward compatibility. +typedef vector > bit_vector; +#endif + +#define _STLP_TEMPLATE_HEADER template +#define _STLP_TEMPLATE_CONTAINER vector<_Tp, _Alloc> +#include +#undef _STLP_TEMPLATE_CONTAINER +#undef _STLP_TEMPLATE_HEADER + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !defined (_STLP_NO_MOVE_SEMANTIC) +template +struct __move_traits > { + typedef __true_type implemented; + typedef typename __move_traits<_Alloc>::complete complete; +}; +# endif + +# if !defined (_STLP_DEBUG) +template +struct _DefaultZeroValue > +{ typedef typename __type_traits<_Alloc>::has_trivial_default_constructor _Ret; }; +# endif + +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +_STLP_END_NAMESPACE + +#endif /* _STLP_VECTOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/boost_type_traits.h b/sdk/tlibstdcxx/stlport/stl/boost_type_traits.h new file mode 100644 index 0000000000..ae3a3f61d9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/boost_type_traits.h @@ -0,0 +1,150 @@ +/* + * + * Copyright (c) 2004 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_BOOST_TYPE_TRAITS_H +#define _STLP_BOOST_TYPE_TRAITS_H + +#ifndef BOOST_CONFIG_SUFFIX_HPP +# ifdef BOOST_CONFIG_HPP +# undef BOOST_CONFIG_HPP +# endif +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * This file mostly wraps boost type_traits in the STLport type_traits. + * When checking a type traits like trivial assign operator for instance + * both the boost value and STLport values has to be taken into account + * as we don't know what the user might have prefer, specializing the boost + * type traits or the STLport one. + */ +_STLP_BEGIN_NAMESPACE + +template struct _IsRef { + enum { _Is = ::boost::is_reference<_Tp>::value }; + typedef typename __bool2type<_Is>::_Ret _Ret; +}; + +template struct _IsPtr { + enum { is_pointer = ::boost::is_pointer<_Tp>::value }; + typedef typename __bool2type::_Ret _Ret; +}; + +template struct _IsIntegral { + enum { is_integral = ::boost::is_integral<_Tp>::value }; + typedef typename __bool2type::_Ret _Ret; +}; + +template struct _IsRational { + enum { is_float = ::boost::is_float<_Tp>::value }; + typedef typename __bool2type::_Ret _Ret; +}; + +template +struct __type_traits { + enum { trivial_constructor = ::boost::has_trivial_constructor<_Tp>::value }; + typedef typename __bool2type::_Ret has_trivial_default_constructor; + + enum { trivial_copy = ::boost::has_trivial_copy<_Tp>::value }; + typedef typename __bool2type::_Ret has_trivial_copy_constructor; + + enum { trivial_assign = ::boost::has_trivial_assign<_Tp>::value }; + typedef typename __bool2type::_Ret has_trivial_assignment_operator; + + enum { trivial_destructor = ::boost::has_trivial_destructor<_Tp>::value }; + typedef typename __bool2type::_Ret has_trivial_destructor; + + enum { pod = ::boost::is_pod<_Tp>::value }; + typedef typename __bool2type::_Ret is_POD_type; +}; + +template +struct _TrivialCopy { + typedef typename ::boost::remove_cv<_Tp1>::type uncv1; + typedef typename ::boost::remove_cv<_Tp2>::type uncv2; + + enum { same = ::boost::is_same::value }; + typedef typename __bool2type::_Ret _Same; + + enum { boost_trivial_assign = ::boost::has_trivial_assign::value }; + typedef typename __bool2type::_Ret _BoostTrivialAssign; + typedef typename __type_traits::has_trivial_assignment_operator _STLPTrivialAssign; + typedef typename _Lor2<_BoostTrivialAssign, _STLPTrivialAssign>::_Ret _TrivialAssign; + + typedef typename _Land2<_Same, _TrivialAssign>::_Ret _Type; + static _Type _Answer() { return _Type(); } +}; + +template +struct _TrivialUCopy { + typedef typename ::boost::remove_cv<_Tp1>::type uncv1; + typedef typename ::boost::remove_cv<_Tp2>::type uncv2; + + enum { same = ::boost::is_same::value }; + typedef typename __bool2type::_Ret _Same; + + enum { boost_trivial_copy = ::boost::has_trivial_copy::value }; + typedef typename __bool2type::_Ret _BoostTrivialCopy; + typedef typename __type_traits::has_trivial_copy_constructor _STLPTrivialCopy; + typedef typename _Lor2<_BoostTrivialCopy, _STLPTrivialCopy>::_Ret _TrivialCopy; + + typedef typename _Land2<_Same, _TrivialCopy>::_Ret _Type; + static _Type _Answer() { return _Type(); } +}; + +template +struct _DefaultZeroValue { + enum { is_integral = ::boost::is_integral<_Tp>::value }; + typedef typename __bool2type::_Ret _IsIntegral; + enum { is_float = ::boost::is_float<_Tp>::value }; + typedef typename __bool2type::_Ret _IsFloat; + enum { is_pointer = ::boost::is_pointer<_Tp>::value }; + typedef typename __bool2type::_Ret _IsPointer; + + typedef typename _Lor3<_IsIntegral, _IsFloat, _IsPointer>::_Ret _Ret; +}; + +template +struct _TrivialInit { + typedef typename ::boost::remove_cv<_Tp>::type uncv; + + enum { boost_trivial_constructor = ::boost::has_trivial_constructor::value }; + typedef typename __bool2type::_Ret _BoostTrivialInit; + typedef typename __type_traits::has_trivial_default_constructor _STLPTrivialInit; + typedef typename _Lor2<_BoostTrivialInit, _STLPTrivialInit>::_Ret _Tr1; + + typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2; + typedef typename _Not<_Tr2>::_Ret _Tr3; + + typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +_STLP_END_NAMESPACE + +#endif /* _STLP_BOOST_TYPE_TRAITS_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/c_locale.h b/sdk/tlibstdcxx/stlport/stl/c_locale.h new file mode 100644 index 0000000000..cadd2bc102 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/c_locale.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_C_LOCALE_H +#define _STLP_C_LOCALE_H + +/* + * Implementation dependent definitions. + * Beware: This header is not a purely internal header, it is also included + * from the outside world when building the STLport library. So this header + * should not reference internal headers (stlport/stl/_*.h) directly. + */ +#if defined (__sgi) +# if defined (ROOT_65) /* IRIX 6.5.x */ +# include +# include +# include +# include +# else /* IRIX pre-6.5 */ +# include +# include +# if !defined(_SIZE_T) && !defined(_SIZE_T_) +# define _SIZE_T +# if (_MIPS_SZLONG == 32) +typedef unsigned int size_t; +# endif +# if (_MIPS_SZLONG == 64) +typedef unsigned long size_t; +# endif +# endif +# if !defined (_WCHAR_T) +# define _WCHAR_T +# if (_MIPS_SZLONG == 32) +typedef long wchar_t; +# endif +# if (_MIPS_SZLONG == 64) +typedef __int32_t wchar_t; +# endif +# endif /* _WCHAR_T */ +# if !defined (_WINT_T) +# define _WINT_T +# if (_MIPS_SZLONG == 32) +typedef long wint_t; +# endif +# if (_MIPS_SZLONG == 64) +typedef __int32_t wint_t; +# endif +# endif /* _WINT_T */ +# if !defined (_MBSTATE_T) +# define _MBSTATE_T +/* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined + * by Microsoft compilers to give their version. But we are in a SGI platform section so it + * is weird. However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/ +# if defined (_MSC_VER) +typedef int mbstate_t; +# else +typedef char mbstate_t; +# endif +# endif /* _MBSTATE_T */ +# endif /* ROOT65 */ +#elif defined (_STLP_USE_GLIBC) +# include +#endif + +/* + * GENERAL FRAMEWORK + */ + +/* + * Opaque types, implementation (if there is one) depends + * on platform localisation API. + */ +struct _Locale_ctype; +struct _Locale_codecvt; +struct _Locale_numeric; +struct _Locale_time; +struct _Locale_collate; +struct _Locale_monetary; +struct _Locale_messages; + +/* + Bitmask macros. +*/ + +/* + * For narrow characters, we expose the lookup table interface. + */ + +#if defined (_STLP_USE_GLIBC) +/* This section uses macros defined in the gnu libc ctype.h header */ +# define _Locale_CNTRL _IScntrl +# define _Locale_UPPER _ISupper +# define _Locale_LOWER _ISlower +# define _Locale_DIGIT _ISdigit +# define _Locale_XDIGIT _ISxdigit +# define _Locale_PUNCT _ISpunct +# define _Locale_SPACE _ISspace +# define _Locale_PRINT _ISprint +# define _Locale_ALPHA _ISalpha +#else +/* Default values based on C++ Standard 22.2.1. + * Under Windows the localisation implementation take care of mapping its + * mask values to those internal values. For other platforms without real + * localization support we are free to use the most suitable values.*/ +# define _Locale_SPACE 0x0001 +# define _Locale_PRINT 0x0002 +# define _Locale_CNTRL 0x0004 +# define _Locale_UPPER 0x0008 +# define _Locale_LOWER 0x0010 +# define _Locale_ALPHA 0x0020 +# define _Locale_DIGIT 0x0040 +# define _Locale_PUNCT 0x0080 +# define _Locale_XDIGIT 0x0100 +#endif + +#endif /* _STLP_C_LOCALE_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/char_traits.h b/sdk/tlibstdcxx/stlport/stl/char_traits.h new file mode 100644 index 0000000000..f004a70492 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/char_traits.h @@ -0,0 +1,278 @@ +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_CHAR_TRAITS_H +#define _STLP_CHAR_TRAITS_H + +// Define char_traits + +#ifndef _STLP_INTERNAL_CSTDDEF +# include +#endif + +#ifndef _STLP_INTERNAL_CSTRING +# include +#endif + +#if defined (__unix) +# include // For off_t +#endif /* __unix */ + +#if defined (__BORLANDC__) +# include +# include +# include <_stddef.h> +# include +#endif + +#ifndef _STLP_INTERNAL_CONSTRUCT_H +# include +#endif + +#ifndef _STLP_INTERNAL_CWCHAR +# include +#endif + +_STLP_BEGIN_NAMESPACE + +template class allocator; + +#define _STLP_NULL_CHAR_INIT(_ChT) _STLP_DEFAULT_CONSTRUCTED(_ChT) + +#if defined(_STLP_WCE) +typedef long streamoff; +#elif defined (_STLP_WIN32) +# if defined (_STLP_LONG_LONG) && !defined (__CYGWIN__) +//The Win32 file io API support 64 bits access so streamoff and streamsize +//has to reflect that. Do not change the stringbuf behavior. +typedef _STLP_LONG_LONG streamoff; +# else +typedef ptrdiff_t streamoff; +# endif +#else // __unix +# ifdef _STLP_USE_DEFAULT_FILE_OFFSET +typedef off_t streamoff; +# elif defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE) /* || defined(__USE_FILE_OFFSET64) */ \ + /* || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) */ /* || defined (__sgi) && defined (_STLP_HAS_NO_NEW_C_HEADERS) */ +typedef off64_t streamoff; +# else +typedef off_t streamoff; +# endif +#endif /* __unix */ + +#if defined (_STLP_WIN32) +typedef streamoff streamsize; +#else +typedef ptrdiff_t streamsize; +#endif + +// Class fpos, which represents a position within a file. (The C++ +// standard calls for it to be defined in . This implementation +// moves it to , which is included by .) +template class fpos { +public: // From table 88 of the C++ standard. + fpos(streamoff __pos) : _M_pos(__pos), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {} + fpos() : _M_pos(0), _M_st(_STLP_NULL_CHAR_INIT(_StateT)) {} + + operator streamoff() const { return _M_pos; } + + bool operator==(const fpos& __y) const + { return _M_pos == __y._M_pos; } + bool operator!=(const fpos& __y) const + { return _M_pos != __y._M_pos; } + + fpos& operator+=(streamoff __off) { + _M_pos += __off; + return *this; + } + fpos& operator-=(streamoff __off) { + _M_pos -= __off; + return *this; + } + + fpos operator+(streamoff __off) { + fpos __tmp(*this); + __tmp += __off; + return __tmp; + } + fpos operator-(streamoff __off) { + fpos __tmp(*this); + __tmp -= __off; + return __tmp; + } + +public: // Manipulation of the state member. + _StateT state() const { return _M_st; } + void state(_StateT __st) { _M_st = __st; } +private: + streamoff _M_pos; + _StateT _M_st; +}; + +typedef fpos streampos; +typedef fpos wstreampos; + +// Class __char_traits_base. +template +class __char_traits_base { +public: + typedef _CharT char_type; + typedef _IntT int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static void _STLP_CALL assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; } + static bool _STLP_CALL eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + static bool _STLP_CALL lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static int _STLP_CALL compare(const char_type* __s1, const char_type* __s2, size_t __n) { + for (size_t __i = 0; __i < __n; ++__i) + if (!eq(__s1[__i], __s2[__i])) + return __s1[__i] < __s2[__i] ? -1 : 1; + return 0; + } + + static size_t _STLP_CALL length(const char_type* __s) { + const char_type _NullChar = _STLP_DEFAULT_CONSTRUCTED(char_type); + size_t __i(0); + for (; !eq(__s[__i], _NullChar); ++__i) {} + return __i; + } + + static const char_type* _STLP_CALL find(const char_type* __s, size_t __n, const char_type& __c) { + for ( ; __n > 0 ; ++__s, --__n) + if (eq(*__s, __c)) + return __s; + return 0; + } + + static char_type* _STLP_CALL move(char_type* __s1, const char_type* __s2, size_t _Sz) + { return (_Sz == 0 ? __s1 : (char_type*)memmove(__s1, __s2, _Sz * sizeof(char_type))); } + + static char_type* _STLP_CALL copy(char_type* __s1, const char_type* __s2, size_t __n) { + return (__n == 0 ? __s1 : + (char_type*)memcpy(__s1, __s2, __n * sizeof(char_type))); + } + + static char_type* _STLP_CALL assign(char_type* __s, size_t __n, char_type __c) { + for (size_t __i = 0; __i < __n; ++__i) + __s[__i] = __c; + return __s; + } + + static int_type _STLP_CALL not_eof(const int_type& __c) + { return !eq_int_type(__c, eof()) ? __c : __STATIC_CAST(int_type, 0); } + + static char_type _STLP_CALL to_char_type(const int_type& __c) + { return (char_type)__c; } + + static int_type _STLP_CALL to_int_type(const char_type& __c) + { return (int_type)__c; } + + static bool _STLP_CALL eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + + static int_type _STLP_CALL eof() + { return (int_type)-1; } +}; + +// Generic char_traits class. Note that this class is provided only +// as a base for explicit specialization; it is unlikely to be useful +// as is for any particular user-defined type. In particular, it +// *will not work* for a non-POD type. + +template +class char_traits + : public __char_traits_base<_CharT, _CharT> {}; + +// Specialization for char. + +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC char_traits + : public __char_traits_base, + public __stlport_class > { +public: + typedef char char_type; + typedef int int_type; + typedef streamoff off_type; + typedef streampos pos_type; + typedef mbstate_t state_type; + + static char _STLP_CALL to_char_type(const int& __c) + { return (char)(unsigned char)__c; } + + static int _STLP_CALL to_int_type(const char& __c) + { return (unsigned char)__c; } + + static int _STLP_CALL compare(const char* __s1, const char* __s2, size_t __n) + { return memcmp(__s1, __s2, __n); } + + static size_t _STLP_CALL length(const char* __s) + { return strlen(__s); } + + static void _STLP_CALL assign(char& __c1, const char& __c2) + { __c1 = __c2; } + + static char* _STLP_CALL assign(char* __s, size_t __n, char __c) { + memset(__s, __c, __n); + return __s; + } +}; + +#if defined (_STLP_HAS_WCHAR_T) +// Specialization for wchar_t. +_STLP_TEMPLATE_NULL +class _STLP_CLASS_DECLSPEC char_traits + : public __char_traits_base { +# if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && !defined (_STLP_WCHAR_HPACC_EXCLUDE) +public: +# if !defined (__BORLANDC__) + static wchar_t* _STLP_CALL move(wchar_t* __dest, const wchar_t* __src, size_t __n) + { return wmemmove(__dest, __src, __n); } +# endif + + static wchar_t* _STLP_CALL copy(wchar_t* __dest, const wchar_t* __src, size_t __n) + { return wmemcpy(__dest, __src, __n); } + +# if !defined (__DMC__) && !defined (__BORLANDC__) + static int _STLP_CALL compare(const wchar_t* __s1, const wchar_t* __s2, size_t __n) + { return wmemcmp(__s1, __s2, __n); } +# endif + + static wchar_t* _STLP_CALL assign(wchar_t* __s, size_t __n, wchar_t __c) + { return wmemset(__s, __c, __n); } + + static size_t _STLP_CALL length(const wchar_t* __s) + { return wcslen(__s); } + + static void _STLP_CALL assign(wchar_t& __c1, const wchar_t& __c2) + { __c1 = __c2; } +# endif +}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_CHAR_TRAITS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/concept_checks.h b/sdk/tlibstdcxx/stlport/stl/concept_checks.h new file mode 100644 index 0000000000..5fe02c298a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/concept_checks.h @@ -0,0 +1,810 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +#ifndef __CONCEPT_CHECKS_H +#define __CONCEPT_CHECKS_H + +/* + Use these macro like assertions, but they assert properties + on types (usually template arguments). In technical terms they + verify whether a type "models" a "concept". + + This set of requirements and the terminology used here is derived + from the book "Generic Programming and the STL" by Matt Austern + (Addison Wesley). For further information please consult that + book. The requirements also are intended to match the ANSI/ISO C++ + standard. + + This file covers the basic concepts and the iterator concepts. + There are several other files that provide the requirements + for the STL containers: + container_concepts.h + sequence_concepts.h + assoc_container_concepts.h + + Jeremy Siek, 1999 + + TO DO: + - some issues with regards to concept classification and mutability + including AssociativeContianer -> ForwardContainer + and SortedAssociativeContainer -> ReversibleContainer + - HashedAssociativeContainer + - Allocator + - Function Object Concepts + + */ + +#ifndef _STLP_USE_CONCEPT_CHECKS + +// Some compilers lack the features that are necessary for concept checks. +// On those compilers we define the concept check macros to do nothing. +#define _STLP_REQUIRES(__type_var, __concept) do {} while(0) +#define _STLP_CLASS_REQUIRES(__type_var, __concept) \ + static int __##__type_var##_##__concept +#define _STLP_CONVERTIBLE(__type_x, __type_y) do {} while(0) +#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0) +#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ + static int __##__type_x##__type_y##_require_same_type +#define _STLP_GENERATOR_CHECK(__func, __ret) do {} while(0) +#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \ + static int __##__func##__ret##_generator_check +#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0) +#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ + static int __##__func##__ret##__arg##_unary_function_check +#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ + do {} while(0) +#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ + static int __##__func##__ret##__first##__second##_binary_function_check +#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + do {} while(0) +#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + static int __##__opname##__ret##__first##__second##_require_binary_op + +#else /* _STLP_USE_CONCEPT_CHECKS */ + +// This macro tests whether the template argument "__type_var" +// satisfies the requirements of "__concept". Here is a list of concepts +// that we know how to check: +// _Allocator +// _Assignable +// _DefaultConstructible +// _EqualityComparable +// _LessThanComparable +// _TrivialIterator +// _InputIterator +// _OutputIterator +// _ForwardIterator +// _BidirectionalIterator +// _RandomAccessIterator +// _Mutable_TrivialIterator +// _Mutable_ForwardIterator +// _Mutable_BidirectionalIterator +// _Mutable_RandomAccessIterator + +#define _STLP_REQUIRES(__type_var, __concept) \ +do { \ + void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\ + ::##__concept##_requirement_violation; __x = __x; } while (0) + +// Use this to check whether type X is convertible to type Y +#define _STLP_CONVERTIBLE(__type_x, __type_y) \ +do { \ + void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \ + __type_y >::__type_X_is_not_convertible_to_type_Y; \ + __x = __x; } while (0) + +// Use this to test whether two template arguments are the same type +#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) \ +do { \ + void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \ + __type_y >::__type_X_not_same_as_type_Y; \ + __x = __x; } while (0) + + +// function object checks +#define _STLP_GENERATOR_CHECK(__func, __ret) \ +do { \ + __ret (*__x)( __func&) = \ + _STL_GENERATOR_ERROR< \ + __func, __ret>::__generator_requirement_violation; \ + __x = __x; } while (0) + + +#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ +do { \ + __ret (*__x)( __func&, const __arg& ) = \ + _STL_UNARY_FUNCTION_ERROR< \ + __func, __ret, __arg>::__unary_function_requirement_violation; \ + __x = __x; } while (0) + + +#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ +do { \ + __ret (*__x)( __func&, const __first&, const __second& ) = \ + _STL_BINARY_FUNCTION_ERROR< \ + __func, __ret, __first, __second>::__binary_function_requirement_violation; \ + __x = __x; } while (0) + + +#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + do { \ + __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \ + __ret, __first, __second>::__binary_operator_requirement_violation; \ + __ret (*__y)( const __first&, const __second& ) = \ + _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \ + __const_binary_operator_requirement_violation; \ + __y = __y; __x = __x; } while (0) + + +#ifdef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE + +#define _STLP_CLASS_REQUIRES(__type_var, __concept) +#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) +#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) +#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) +#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) +#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) + +#else + +// Use this macro inside of template classes, where you would +// like to place requirements on the template arguments to the class +// Warning: do not pass pointers and such (e.g. T*) in as the __type_var, +// since the type_var is used to construct identifiers. Instead typedef +// the pointer type, then use the typedef name for the __type_var. +#define _STLP_CLASS_REQUIRES(__type_var, __concept) \ + typedef void (* __func##__type_var##__concept)( __type_var ); \ + template <__func##__type_var##__concept _Tp1> \ + struct __dummy_struct_##__type_var##__concept { }; \ + static __dummy_struct_##__type_var##__concept< \ + __concept##_concept_specification< \ + __type_var>::__concept##_requirement_violation> \ + __dummy_ptr_##__type_var##__concept + + +#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \ + typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \ + __type_y ); \ + template < __func_##__type_x##__type_y##same_type _Tp1> \ + struct __dummy_struct_##__type_x##__type_y##_same_type { }; \ + static __dummy_struct_##__type_x##__type_y##_same_type< \ + _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \ + __dummy_ptr_##__type_x##__type_y##_same_type + + +#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \ + typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \ + template <__f_##__func##__ret##_generator _Tp1> \ + struct __dummy_struct_##__func##__ret##_generator { }; \ + static __dummy_struct_##__func##__ret##_generator< \ + _STL_GENERATOR_ERROR< \ + __func, __ret>::__generator_requirement_violation> \ + __dummy_ptr_##__func##__ret##_generator + + +#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \ + typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \ + const __arg& ); \ + template <__f_##__func##__ret##__arg##_unary_check _Tp1> \ + struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \ + static __dummy_struct_##__func##__ret##__arg##_unary_check< \ + _STL_UNARY_FUNCTION_ERROR< \ + __func, __ret, __arg>::__unary_function_requirement_violation> \ + __dummy_ptr_##__func##__ret##__arg##_unary_check + + +#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \ + typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\ + const __second& ); \ + template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \ + struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \ + static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \ + _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \ + __binary_function_requirement_violation> \ + __dummy_ptr_##__func##__ret##__first##__second##_binary_check + + +#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \ + typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \ + const __second& ); \ + template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \ + struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \ + static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \ + _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \ + __binary_operator_requirement_violation> \ + __dummy_ptr_##__func##__ret##__first##__second##_binary_op + +#endif + +/* helper class for finding non-const version of a type. Need to have + something to assign to etc. when testing constant iterators. */ + +template +struct _Mutable_trait { + typedef _Tp _Type; +}; +template +struct _Mutable_trait { + typedef _Tp _Type; +}; + + +/* helper function for avoiding compiler warnings about unused variables */ +template +void __sink_unused_warning(_Type) { } + +template +struct _STL_CONVERT_ERROR { + static void + __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) { + _TypeY __y = __x; + __sink_unused_warning(__y); + } +}; + + +template struct __check_equal { }; + +template +struct _STL_SAME_TYPE_ERROR { + static void + __type_X_not_same_as_type_Y(_TypeX , _TypeY ) { + __check_equal<_TypeX> t1 = __check_equal<_TypeY>(); + } +}; + + +// Some Functon Object Checks + +template +struct _STL_GENERATOR_ERROR { + static _Ret __generator_requirement_violation(_Func& __f) { + return __f(); + } +}; + +template +struct _STL_GENERATOR_ERROR<_Func, void> { + static void __generator_requirement_violation(_Func& __f) { + __f(); + } +}; + + +template +struct _STL_UNARY_FUNCTION_ERROR { + static _Ret + __unary_function_requirement_violation(_Func& __f, + const _Arg& __arg) { + return __f(__arg); + } +}; + +template +struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> { + static void + __unary_function_requirement_violation(_Func& __f, + const _Arg& __arg) { + __f(__arg); + } +}; + +template +struct _STL_BINARY_FUNCTION_ERROR { + static _Ret + __binary_function_requirement_violation(_Func& __f, + const _First& __first, + const _Second& __second) { + return __f(__first, __second); + } +}; + +template +struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> { + static void + __binary_function_requirement_violation(_Func& __f, + const _First& __first, + const _Second& __second) { + __f(__first, __second); + } +}; + + +#define _STLP_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \ +template \ +struct _STL_BINARY##_NAME##_ERROR { \ + static _Ret \ + __const_binary_operator_requirement_violation(const _First& __first, \ + const _Second& __second) { \ + return __first _OP __second; \ + } \ + static _Ret \ + __binary_operator_requirement_violation(_First& __first, \ + _Second& __second) { \ + return __first _OP __second; \ + } \ +} + +_STLP_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL); +_STLP_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL); +_STLP_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN); +_STLP_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL); +_STLP_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN); +_STLP_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL); +_STLP_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS); +_STLP_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES); +_STLP_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE); +_STLP_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT); +_STLP_DEFINE_BINARY_OP_CHECK(%, _OP_MOD); +// ... + +// TODO, add unary operators (prefix and postfix) + +/* + The presence of this class is just to trick EDG into displaying + these error messages before any other errors. Without the + classes, the errors in the functions get reported after + other class errors deep inside the library. The name + choice just makes for an eye catching error message :) + */ +struct _STL_ERROR { + + template + static _Type + __default_constructor_requirement_violation(_Type) { + return _Type(); + } + template + static _Type + __assignment_operator_requirement_violation(_Type __a) { + __a = __a; + return __a; + } + template + static _Type + __copy_constructor_requirement_violation(_Type __a) { + _Type __c(__a); + return __c; + } + template + static _Type + __const_parameter_required_for_copy_constructor(_Type /* __a */, + const _Type& __b) { + _Type __c(__b); + return __c; + } + template + static _Type + __const_parameter_required_for_assignment_operator(_Type __a, + const _Type& __b) { + __a = __b; + return __a; + } + template + static _Type + __less_than_comparable_requirement_violation(_Type __a, _Type __b) { + if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a; + return __b; + } + template + static _Type + __equality_comparable_requirement_violation(_Type __a, _Type __b) { + if (__a == __b || __a != __b) return __a; + return __b; + } + template + static void + __dereference_operator_requirement_violation(_Iterator __i) { + __sink_unused_warning(*__i); + } + template + static void + __dereference_operator_and_assignment_requirement_violation(_Iterator __i) { + *__i = *__i; + } + template + static void + __preincrement_operator_requirement_violation(_Iterator __i) { + ++__i; + } + template + static void + __postincrement_operator_requirement_violation(_Iterator __i) { + __i++; + } + template + static void + __predecrement_operator_requirement_violation(_Iterator __i) { + --__i; + } + template + static void + __postdecrement_operator_requirement_violation(_Iterator __i) { + __i--; + } + template + static void + __postincrement_operator_and_assignment_requirement_violation(_Iterator __i, + _Type __t) { + *__i++ = __t; + } + template + static _Iterator + __iterator_addition_assignment_requirement_violation(_Iterator __i, + _Distance __n) { + __i += __n; + return __i; + } + template + static _Iterator + __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) { + __i = __i + __n; + __i = __n + __i; + return __i; + } + template + static _Iterator + __iterator_subtraction_assignment_requirement_violation(_Iterator __i, + _Distance __n) { + __i -= __n; + return __i; + } + template + static _Iterator + __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) { + __i = __i - __n; + return __i; + } + template + static _Distance + __difference_operator_requirement_violation(_Iterator __i, _Iterator __j, + _Distance __n) { + __n = __i - __j; + return __n; + } + template + static _Type + __element_access_operator_requirement_violation(_Exp __x, _Type*, + _Distance __n) { + return __x[__n]; + } + template + static void + __element_assignment_operator_requirement_violation(_Exp __x, + _Type* __t, + _Distance __n) { + __x[__n] = *__t; + } + +}; /* _STL_ERROR */ + +/* Associated Type Requirements */ + +_STLP_BEGIN_NAMESPACE +template struct iterator_traits; +_STLP_END_NAMESPACE + +template +struct __value_type_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::value_type value_type; +}; + +template +struct __difference_type_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::difference_type + difference_type; +}; + +template +struct __reference_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::reference reference; +}; + +template +struct __pointer_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::pointer pointer; +}; + +template +struct __iterator_category_type_definition_requirement_violation { + typedef typename __STD::iterator_traits<_Iter>::iterator_category + iterator_category; +}; + +/* Assignable Requirements */ + + +template +struct _Assignable_concept_specification { + static void _Assignable_requirement_violation(_Type __a) { + _STL_ERROR::__assignment_operator_requirement_violation(__a); + _STL_ERROR::__copy_constructor_requirement_violation(__a); + _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a); + _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a); + } +}; + +/* DefaultConstructible Requirements */ + + +template +struct _DefaultConstructible_concept_specification { + static void _DefaultConstructible_requirement_violation(_Type __a) { + _STL_ERROR::__default_constructor_requirement_violation(__a); + } +}; + +/* EqualityComparable Requirements */ + +template +struct _EqualityComparable_concept_specification { + static void _EqualityComparable_requirement_violation(_Type __a) { + _STL_ERROR::__equality_comparable_requirement_violation(__a, __a); + } +}; + +/* LessThanComparable Requirements */ +template +struct _LessThanComparable_concept_specification { + static void _LessThanComparable_requirement_violation(_Type __a) { + _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a); + } +}; + +/* TrivialIterator Requirements */ + +template +struct _TrivialIterator_concept_specification { +static void +_TrivialIterator_requirement_violation(_TrivialIterator __i) { + typedef typename + __value_type_type_definition_requirement_violation<_TrivialIterator>:: + value_type __T; + // Refinement of Assignable + _Assignable_concept_specification<_TrivialIterator>:: + _Assignable_requirement_violation(__i); + // Refinement of DefaultConstructible + _DefaultConstructible_concept_specification<_TrivialIterator>:: + _DefaultConstructible_requirement_violation(__i); + // Refinement of EqualityComparable + _EqualityComparable_concept_specification<_TrivialIterator>:: + _EqualityComparable_requirement_violation(__i); + // Valid Expressions + _STL_ERROR::__dereference_operator_requirement_violation(__i); +} +}; + +template +struct _Mutable_TrivialIterator_concept_specification { +static void +_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) { + _TrivialIterator_concept_specification<_TrivialIterator>:: + _TrivialIterator_requirement_violation(__i); + // Valid Expressions + _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i); +} +}; + +/* InputIterator Requirements */ + +template +struct _InputIterator_concept_specification { +static void +_InputIterator_requirement_violation(_InputIterator __i) { + // Refinement of TrivialIterator + _TrivialIterator_concept_specification<_InputIterator>:: + _TrivialIterator_requirement_violation(__i); + // Associated Types + __difference_type_type_definition_requirement_violation<_InputIterator>(); + __reference_type_definition_requirement_violation<_InputIterator>(); + __pointer_type_definition_requirement_violation<_InputIterator>(); + __iterator_category_type_definition_requirement_violation<_InputIterator>(); + // Valid Expressions + _STL_ERROR::__preincrement_operator_requirement_violation(__i); + _STL_ERROR::__postincrement_operator_requirement_violation(__i); +} +}; + +/* OutputIterator Requirements */ + +template +struct _OutputIterator_concept_specification { +static void +_OutputIterator_requirement_violation(_OutputIterator __i) { + // Refinement of Assignable + _Assignable_concept_specification<_OutputIterator>:: + _Assignable_requirement_violation(__i); + // Associated Types + __iterator_category_type_definition_requirement_violation<_OutputIterator>(); + // Valid Expressions + _STL_ERROR::__dereference_operator_requirement_violation(__i); + _STL_ERROR::__preincrement_operator_requirement_violation(__i); + _STL_ERROR::__postincrement_operator_requirement_violation(__i); + _STL_ERROR:: + __postincrement_operator_and_assignment_requirement_violation(__i, *__i); +} +}; + +/* ForwardIterator Requirements */ + +template +struct _ForwardIterator_concept_specification { +static void +_ForwardIterator_requirement_violation(_ForwardIterator __i) { + // Refinement of InputIterator + _InputIterator_concept_specification<_ForwardIterator>:: + _InputIterator_requirement_violation(__i); +} +}; + +template +struct _Mutable_ForwardIterator_concept_specification { +static void +_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) { + _ForwardIterator_concept_specification<_ForwardIterator>:: + _ForwardIterator_requirement_violation(__i); + // Refinement of OutputIterator + _OutputIterator_concept_specification<_ForwardIterator>:: + _OutputIterator_requirement_violation(__i); +} +}; + +/* BidirectionalIterator Requirements */ + +template +struct _BidirectionalIterator_concept_specification { +static void +_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) { + // Refinement of ForwardIterator + _ForwardIterator_concept_specification<_BidirectionalIterator>:: + _ForwardIterator_requirement_violation(__i); + // Valid Expressions + _STL_ERROR::__predecrement_operator_requirement_violation(__i); + _STL_ERROR::__postdecrement_operator_requirement_violation(__i); +} +}; + +template +struct _Mutable_BidirectionalIterator_concept_specification { +static void +_Mutable_BidirectionalIterator_requirement_violation( + _BidirectionalIterator __i) +{ + _BidirectionalIterator_concept_specification<_BidirectionalIterator>:: + _BidirectionalIterator_requirement_violation(__i); + // Refinement of mutable_ForwardIterator + _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>:: + _Mutable_ForwardIterator_requirement_violation(__i); + typedef typename + __value_type_type_definition_requirement_violation< + _BidirectionalIterator>::value_type __T; + typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0; + // Valid Expressions + _STL_ERROR:: + __postincrement_operator_and_assignment_requirement_violation(__i, + *__tmp_ptr); +} +}; + +/* RandomAccessIterator Requirements */ + +template +struct _RandomAccessIterator_concept_specification { +static void +_RandomAccessIterator_requirement_violation(_RandAccIter __i) { + // Refinement of BidirectionalIterator + _BidirectionalIterator_concept_specification<_RandAccIter>:: + _BidirectionalIterator_requirement_violation(__i); + // Refinement of LessThanComparable + _LessThanComparable_concept_specification<_RandAccIter>:: + _LessThanComparable_requirement_violation(__i); + typedef typename + __value_type_type_definition_requirement_violation<_RandAccIter> + ::value_type + value_type; + typedef typename + __difference_type_type_definition_requirement_violation<_RandAccIter> + ::difference_type + _Dist; + typedef typename _Mutable_trait<_Dist>::_Type _MutDist; + + // Valid Expressions + _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i, + _MutDist()); + _STL_ERROR::__iterator_addition_requirement_violation(__i, + _MutDist()); + _STL_ERROR:: + __iterator_subtraction_assignment_requirement_violation(__i, + _MutDist()); + _STL_ERROR::__iterator_subtraction_requirement_violation(__i, + _MutDist()); + _STL_ERROR::__difference_operator_requirement_violation(__i, __i, + _MutDist()); + typename _Mutable_trait::_Type* __dummy_ptr = 0; + _STL_ERROR::__element_access_operator_requirement_violation(__i, + __dummy_ptr, + _MutDist()); +} +}; + +template +struct _Mutable_RandomAccessIterator_concept_specification { +static void +_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i) +{ + _RandomAccessIterator_concept_specification<_RandAccIter>:: + _RandomAccessIterator_requirement_violation(__i); + // Refinement of mutable_BidirectionalIterator + _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>:: + _Mutable_BidirectionalIterator_requirement_violation(__i); + typedef typename + __value_type_type_definition_requirement_violation<_RandAccIter> + ::value_type + value_type; + typedef typename + __difference_type_type_definition_requirement_violation<_RandAccIter> + ::difference_type + _Dist; + + typename _Mutable_trait::_Type* __tmp_ptr = 0; + // Valid Expressions + _STL_ERROR::__element_assignment_operator_requirement_violation(__i, + __tmp_ptr, _Dist()); +} +}; + +#define _STLP_TYPEDEF_REQUIREMENT(__REQUIREMENT) \ +template \ +struct __##__REQUIREMENT##__typedef_requirement_violation { \ + typedef typename Type::__REQUIREMENT __REQUIREMENT; \ +}; + +_STLP_TYPEDEF_REQUIREMENT(value_type); +_STLP_TYPEDEF_REQUIREMENT(difference_type); +_STLP_TYPEDEF_REQUIREMENT(size_type); +_STLP_TYPEDEF_REQUIREMENT(reference); +_STLP_TYPEDEF_REQUIREMENT(const_reference); +_STLP_TYPEDEF_REQUIREMENT(pointer); +_STLP_TYPEDEF_REQUIREMENT(const_pointer); + + +template +struct _Allocator_concept_specification { +static void +_Allocator_requirement_violation(_Alloc __a) { + // Refinement of DefaultConstructible + _DefaultConstructible_concept_specification<_Alloc>:: + _DefaultConstructible_requirement_violation(__a); + // Refinement of EqualityComparable + _EqualityComparable_concept_specification<_Alloc>:: + _EqualityComparable_requirement_violation(__a); + // Associated Types + __value_type__typedef_requirement_violation<_Alloc>(); + __difference_type__typedef_requirement_violation<_Alloc>(); + __size_type__typedef_requirement_violation<_Alloc>(); + __reference__typedef_requirement_violation<_Alloc>(); + __const_reference__typedef_requirement_violation<_Alloc>(); + __pointer__typedef_requirement_violation<_Alloc>(); + __const_pointer__typedef_requirement_violation<_Alloc>(); + typedef typename _Alloc::value_type _Type; + _STLP_REQUIRES_SAME_TYPE(typename _Alloc::rebind<_Type>::other, _Alloc); +} +}; + +#endif /* _STLP_USE_CONCEPT_CHECKS */ + +#endif /* __CONCEPT_CHECKS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/config/_aix.h b/sdk/tlibstdcxx/stlport/stl/config/_aix.h new file mode 100644 index 0000000000..45ea8b6fd7 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_aix.h @@ -0,0 +1,3 @@ +#define _STLP_PLATFORM "AIX" + +#define _STLP_USE_UNIX_IO diff --git a/sdk/tlibstdcxx/stlport/stl/config/_apcc.h b/sdk/tlibstdcxx/stlport/stl/config/_apcc.h new file mode 100644 index 0000000000..7b4e1397c2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_apcc.h @@ -0,0 +1,30 @@ +// STLport config file for Apogee 4.x + +#define _STLP_COMPILER "Apogee" + +#define _STLP_NO_NEW_NEW_HEADER 1 +#define _STLP_HAS_NO_NEW_C_HEADERS 1 + +#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +#endif +// # define _STLP_RAND48 1 +#define _STLP_LONG_LONG long long +#define _STLP_NO_BAD_ALLOC 1 +#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 +// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 +#define _STLP_NO_EXCEPTION_HEADER 1 + +#undef _STLP_LINK_TIME_INSTANTIATION +#define _STLP_LINK_TIME_INSTANTIATION 1 + +#ifdef __STDLIB +# undef _STLP_NO_NEW_C_HEADERS +# undef _STLP_NO_NEW_NEW_HEADER +# undef _STLP_NO_BAD_ALLOC +# undef _STLP_LONG_LONG +#else +# undef _STLP_NO_EXCEPTION_SPEC +# define _STLP_NO_EXCEPTION_SPEC 1 +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_apple.h b/sdk/tlibstdcxx/stlport/stl/config/_apple.h new file mode 100644 index 0000000000..899ed143ac --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_apple.h @@ -0,0 +1,118 @@ +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly + */ + +/* common configuration settings for Apple MPW MrCpp / SCpp */ + +#define _STLP_COMPILER "spec me!" + +#if defined(__MRC__) && __MRC__ < 0x500 +# error Apple's MPW MrCpp v.5.0.0 or better compiler required +#endif +#if defined(__SC__) && __SC__ < 0x890 +# error Apple's MPW SCpp v.8.9.0 or better compiler required +#endif + +/* TODO: Check that this config is necessary for all compiler versions. + * It is here for historical reasons for the moment. + */ +#define _STLP_NO_CONTAINERS_EXTENSION + +#ifdef qMacApp +# ifndef __CONDITIONALMACROS__ /* skip including ConditionalMacros_AC.h if ConditionalMacros.h is already included */ +# include +# include +# include +# define _STLP_FILE__ _FILE_AC +# define _STLP_DEBUG_MESSAGE +# define __stl_debug_message ProgramBreak_AC +# include +# endif +# include +#else +# include +# include +#endif + +#define _STLP_UINT32_T UInt32 +typedef int wint_t; + +#ifndef TYPE_BOOL +# error must be included. (TYPE_BOOL) +#endif +#if !TYPE_BOOL +# define _STLP_NO_BOOL +# define _STLP_DONT_USE_BOOL_TYPEDEF +#endif + +#ifndef TYPE_LONGLONG +# error must be included. (TYPE_LONGLONG) +#endif +#if TYPE_LONGLONG +# define _STLP_LONG_LONG long long +#endif + +#if !__option(exceptions) +# define _STLP_HAS_NO_EXCEPTIONS +#endif + +#define _STLP_DEBUG_MESSAGE_POST DebugStr("\pSTL diagnosis issued. See 'stderr' for detail."); +#define _STLP_ASSERT_MSG_TRAILER " " + +#ifdef _STLP_DEBUG +# define _STLP_THROW(x) (DebugStr("\pSTL is about to throw exception: "#x),throw x) +#endif + +#if defined(__MRC__) +# ifndef __spillargs +# define __spillargs 1 // MrCpp requires this symbol to be defined as 1 to properly handle va_start; ref.[ file stdarg.h; line 26 ] +# endif +#endif + +#if defined(__SC__) +#define _STLP_VENDOR_LONG_DOUBLE_MATH //*TY 12/03/2000 - SCpp's native math type is long double +#endif + +#ifndef _STLP_NATIVE_INCLUDE_PATH +# if __option(unix_includes) +# define _STLP_NATIVE_INCLUDE_PATH ../CIncludes // expects the alias to {CIncludes} under the same folder as {STL} +# else +# define _STLP_NATIVE_INCLUDE_PATH ::CIncludes // expects the alias to {CIncludes} under the same folder as {STL} +# endif +#endif +#if !defined(_STLP_MAKE_HEADER) +# if !__option(unix_includes) +# define _STLP_MAKE_HEADER(path, header) // Mac uses ":" for directory delimiter +# endif +#endif + +# define _STLD _DBG // to keep the length of generated symbols within the compiler limitation + +#define _STLP_USE_STDIO_IO 1 //*TY 02/24/2000 - see also ; ref.[ file _fstream.h; line 36 ] +#define _STLP_NO_THREADS //*TY 12/17/2000 - multi-thread capability not explored, yet. +#undef _REENTRANT //*ty 11/24/2001 - to make sure no thread facility is activated +#define _NOTHREADS //*ty 12/07/2001 - + +// native library limitations +#define _STLP_VENDOR_GLOBAL_STD // mpw's c++ libs do not utilize namespace std yet +#define _STLP_NO_BAD_ALLOC // known limitation +#define _STLP_HAS_NO_NEW_C_HEADERS // known limitation +#define _STLP_NO_NEW_NEW_HEADER // known limitation +#define _STLP_NO_NATIVE_MBSTATE_T // known limitation +#define _STLP_NO_NATIVE_WIDE_FUNCTIONS // known limitation +#define _STLP_NO_NATIVE_WIDE_STREAMS // known limitation +#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT // known limitation +#define _STLP_BROKEN_EXCEPTION_CLASS // known limitation + +// compiler limitations +# define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS + +# define _STLP_MPWFIX_TRY try{ //*TY 06/01/2000 - exception handling bug workaround +# define _STLP_MPWFIX_CATCH }catch(...){throw;} //*TY 06/01/2000 - exception handling bug workaround +# define _STLP_MPWFIX_CATCH_ACTION(action) }catch(...){action;throw;} //*TY 06/01/2000 - exception handling bug workaround +# define _STLP_THROW_RETURN_BUG // known limitation +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION // known limitation +# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX // known limitation +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER // known limitation +# define _STLP_NO_RELOPS_NAMESPACE // known limitation +// end of stl_apple.h diff --git a/sdk/tlibstdcxx/stlport/stl/config/_as400.h b/sdk/tlibstdcxx/stlport/stl/config/_as400.h new file mode 100644 index 0000000000..28d960b77f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_as400.h @@ -0,0 +1,55 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +// AS/400 C++ config + +# ifdef _REENTRANT +# define _PTHREADS +# endif + +# define _STLP_NO_NEW_NEW_HEADER 1 + +# define _STLP_NO_BOOL +# define _STLP_LIMITED_DEFAULT_TEMPLATES + +# define _STLP_HAS_NO_NAMESPACES +# define _STLP_NEED_TYPENAME +# define _STLP_NEED_EXPLICIT +# define _STLP_HAS_NO_EXCEPTIONS +# define _STLP_NO_EXCEPTION_SPEC +# define _STLP_NO_ARROW_OPERATOR +# define _STLP_NO_NEW_STYLE_CASTS + +# define _STLP_NEED_MUTABLE +# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX +# define _STLP_NO_BAD_ALLOC +# define _STLP_NO_MEMBER_TEMPLATES +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD +# define _STLP_NO_QUALIFIED_FRIENDS +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER + +# define _STLP_NO_METHOD_SPECIALIZATION +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS + +// # define _STLP_NO_EXCEPTION_HEADER + +# define _STLP_HAS_NO_NEW_C_HEADERS + +# define _STLP_STATIC_CONST_INIT_BUG +# define _STLP_THROW_RETURN_BUG +# define _STLP_LINK_TIME_INSTANTIATION +# define _STLP_NO_TEMPLATE_CONVERSIONS + +# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 +# define _STLP_TRIVIAL_DESTRUCTOR_BUG 1 + +# if defined(_LONG_LONG) +# define _STLP_LONG_LONG long long +# endif +# if defined(_PTHREADS) +# define _MULTI_THREADED +# endif +// fbp : to fix __partition() problem +# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 diff --git a/sdk/tlibstdcxx/stlport/stl/config/_auto_link.h b/sdk/tlibstdcxx/stlport/stl/config/_auto_link.h new file mode 100644 index 0000000000..8898c55588 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_auto_link.h @@ -0,0 +1,61 @@ +/* We do not use auto link feature when: + * - user asked not to use it (_STLP_DONT_USE_AUTO_LINK) + * - STLport is used only as a STL library (_STLP_NO_IOSTREAMS || _STLP_USE_NO_IOSTREAMS) + * - we are building a C translation unit, STLport is a C++ Standard library implementation + */ +#if !defined (__BUILDING_STLPORT) && !defined (_STLP_DONT_USE_AUTO_LINK) && \ + !defined (_STLP_NO_IOSTREAMS) && !defined (_STLP_USE_NO_IOSTREAMS) && \ + defined (__cplusplus) + +# define _STLP_STRINGIZE(X) _STLP_STRINGIZE_AUX(X) +# define _STLP_STRINGIZE_AUX(X) #X + +# if defined (_STLP_DEBUG) +# define _STLP_LIB_OPTIM_MODE "stld" +# elif defined (_DEBUG) +# define _STLP_LIB_OPTIM_MODE "d" +# else +# define _STLP_LIB_OPTIM_MODE "" +# endif + +# if defined (_STLP_LIB_NAME_MOTIF) +# define _STLP_LIB_MOTIF "_"_STLP_LIB_NAME_MOTIF +# else +# define _STLP_LIB_MOTIF "" +# endif + +# if defined (_STLP_USE_DYNAMIC_LIB) +# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# define _STLP_LIB_TYPE "_x" +# else +# define _STLP_LIB_TYPE "" +# endif +# else +# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# define _STLP_LIB_TYPE "_statix" +# else +# define _STLP_LIB_TYPE "_static" +# endif +# endif + +# if defined (_STLP_USE_DYNAMIC_LIB) +# define _STLP_VERSION_STR "."_STLP_STRINGIZE(_STLPORT_MAJOR)"."_STLP_STRINGIZE(_STLPORT_MINOR) +# else +# define _STLP_VERSION_STR "" +# endif + +# define _STLP_STLPORT_LIB "stlport"_STLP_LIB_OPTIM_MODE""_STLP_LIB_TYPE""_STLP_LIB_MOTIF""_STLP_VERSION_STR".lib" + +# if defined (_STLP_VERBOSE) +# pragma message ("STLport: Auto linking to "_STLP_STLPORT_LIB) +# endif +# pragma comment (lib, _STLP_STLPORT_LIB) + +# undef _STLP_STLPORT_LIB +# undef _STLP_LIB_OPTIM_MODE +# undef _STLP_LIB_TYPE +# undef _STLP_STRINGIZE_AUX +# undef _STLP_STRINGIZE + +#endif /* _STLP_DONT_USE_AUTO_LINK */ + diff --git a/sdk/tlibstdcxx/stlport/stl/config/_bc.h b/sdk/tlibstdcxx/stlport/stl/config/_bc.h new file mode 100644 index 0000000000..e3802dc090 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_bc.h @@ -0,0 +1,138 @@ +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly */ + +#define _STLP_COMPILER "Borland" + +#if (__BORLANDC__ < 0x551) +# error - Borland compilers below version 5.5.1 not supported. +#endif + +#pragma defineonoption _STLP_NO_RTTI -RT- + +#define _STLP_DONT_SUP_DFLT_PARAM + +#if (__BORLANDC__ >= 0x580) +# define _STLP_HAS_INCLUDE_NEXT +# define _STLP_NATIVE_HEADER(header) <../include/##header> +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/dinkumware/##header> +# define _STLP_NO_NEW_C_HEADERS +# define _STLP_NO_FORCE_INSTANTIATE +#endif + +#if (__BORLANDC__ >= 0x570) && (__BORLANDC__ < 0x580) +# define _STLP_NO_NEW_C_HEADERS +# define _STLP_NO_FORCE_INSTANTIATE +# define _STLP_DEF_CONST_DEF_PARAM_BUG +# define _STLP_USE_DEFAULT_FILE_OFFSET + +# if defined (__cplusplus) +# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include/c++/ ## GCC_VERSION +# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../include/c++/ ## GCC_VERSION +# endif + +# undef _SYS_CDEFS_H +# include + +# ifdef __MT__ +# define _PTHREADS +# if !defined (_RTLDLL) +# define _STLP_DONT_USE_PTHREAD_SPINLOCK +# endif +# else +# define _NOTHREADS +# endif + +# pragma defineonoption _CPPUNWIND -xd +# define _STLP_NO_EXCEPTION_HEADER +# define _STLP_DONT_USE_EXCEPTIONS +#endif + +#if (__BORLANDC__ >= 0x560) && (__BORLANDC__ < 0x570) +# define _USE_OLD_RW_STL +#endif + +#if (__BORLANDC__ >= 0x560) +# if !defined (__BUILDING_STLPORT) +# define NOWINBASEINTERLOCK +# endif +# define _STLP_LANG_INVARIANT_DEFINED +#endif + +#if (__BORLANDC__ < 0x590) +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER +# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION + // problems +# define _STLP_MEMBER_SPECIALIZATION_BUG 1 +# ifdef __cplusplus +# define _STLP_TR1 _STLP_STD_NAME::tr1:: +# endif +#endif + +#if (__BORLANDC__ < 0x564) +# define _STLP_QUALIFIED_SPECIALIZATION_BUG +# define _STLP_NO_MOVE_SEMANTIC +#endif + +#define _STLP_DONT_USE_PRIV_NAMESPACE +#define _STLP_NO_TYPENAME_BEFORE_NAMESPACE +#define _STLP_NO_VENDOR_STDLIB_L +#define _STLP_NO_VENDOR_MATH_F +#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 + +#if (__BORLANDC__ < 0x570) || (__BORLANDC__ >= 0x580) +#define _STLP_NO_NATIVE_MBSTATE_T +#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT +#endif + +#if (__BORLANDC__ < 0x580) && !defined (_RTLDLL) +# define _UNCAUGHT_EXCEPTION 1 +#endif + +// problem +#define _STLP_STATIC_CONST_INIT_BUG + +#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1 + +#define _STLP_LONG_LONG __int64 + +// auto enable thread safety and exceptions: +#ifndef _CPPUNWIND +# define _STLP_HAS_NO_EXCEPTIONS +#endif + +#if defined (__MT__) && !defined (_NOTHREADS) +# define _STLP_THREADS +#endif + +#define _STLP_EXPORT_DECLSPEC __declspec(dllexport) +#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) + +#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) +#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) + +#if defined (_DLL) +# define _STLP_DLL +#endif +#if defined (_RTLDLL) +# define _STLP_RUNTIME_DLL +#endif +#include +#undef _STLP_RUNTIME_DLL +#undef _STLP_DLL + +#if defined (_STLP_USE_DYNAMIC_LIB) +# define _STLP_USE_DECLSPEC 1 +# if defined (__BUILDING_STLPORT) +# define _STLP_CALL __cdecl __export +# else +# define _STLP_CALL __cdecl +# endif +#else +# define _STLP_CALL __cdecl +#endif + +#if !defined (__linux__) +# include +#endif + +#include diff --git a/sdk/tlibstdcxx/stlport/stl/config/_como.h b/sdk/tlibstdcxx/stlport/stl/config/_como.h new file mode 100644 index 0000000000..6076f88084 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_como.h @@ -0,0 +1,207 @@ + +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_COMPILER "Comeau" + +#include + +#define _STLP_UINT32_T unsigned int + +#define _STLP_HAS_NO_NEW_C_HEADERS +// #define _STLP_VENDOR_GLOBAL_EXCEPT_STD +#define _STLP_LONG_LONG long long + + +// +// ADDITIONS FOR COMEAU C++, made by Comeau Computing. +// We can be reached through comeau@comeaucomputing.com +// You shouldn't need to change anything below here for Comeau C++. +// If you do, please tell us at comeau@comeaucomputing.com +// +// Changes made here, AND THROUGH ALL FILES, based upon the __COMO__ macro +// (and SIMILAR NAMES INVOLVING COMO).... no doubt some of this will +// change as SGI integrates the changes into their code base since +// some changes are not really Comeau C++ specific, but required to +// make the SGI code compliant with Standard C++). +// +// Testing was done with Comeau C++ 4.2.44 and 4.2.45.2. Changes were made for +// both Comeau relaxed mode and Comeau strict mode, especially for end user code +// (that is, some of the .cxx files cannot compile in strict mode, because they +// contain extensions to Standard C++, however their object code forms can +// be used once compiled in relaxed mode, even if the end user code uses +// strict mode). +// +// These changes may also work for some earlier versions of Comeau C++, +// though we have not tested them. +// +// Actual mods made under RedHat 6.1 LINUX, should be ok with SuSE too and +// other LINUX's, and older Caldera LINUX, Solaris/SPARC, SunOS, SCO UNIX, +// and NetBSD. Other platforms may be added. Comeau will also perform +// custom ports for you. +// +// Check libcomo details at http://www.comeaucomputing.com/libcomo and +// http://www.comeaucomputing.com +// +// History of Comeau changes (this is rough, as work was often going on in parallel): +// BETA1 July 14, 2000, Initial port for RedHat 6.1 INTEL/ELF +// BETA2 Aug 4, 2000, Stronger RedHat support +// Support for Comeau strict mode for end user code +// BETA3 Aug 22, 2000, Support for other LINUX/INTEL/ELF's, including older ones +// BETA4 Sept 2, 2000, Initial support for SCO UNIX + other UNIX x86 SVR3's +// Stronger support for end user Comeau strict mode +// BETA5 Oct 5, 2000, Initial support for Solaris/SPARC +// More SCO support (though still incomplete) +// BETA6 Feb 5, 2001, Minor mods to accomodate Comeau C++ 4.2.45.1 +// BETA7 Mar 13, 2001, Verified with Comeau C++ 4.2.45.2 +// Minor NetBSD support +// BETA8 Apr 1. 2001, Initial support for SunOS/SPARC +// BETA9 Apr 7, 2001, Stronger SCO support + other UNIX x86 SVR3's +// Mods for an fpos_t problem for some LINUXes +// Mods since Destroy did not work in strict mode +// BETA10 Apr 12. 2001, Stronger NetBSD support +// +// PLANNED: +// BETAx TBA TBA, 2001, NetBSD, UNIXWARE, and Windows support expected +// + + +#ifdef __linux__ + +# define _STLP_NO_NATIVE_MBSTATE_T 1 +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 +# define _STLP_NO_NATIVE_WIDE_STREAMS 1 +# define _STLP_NO_LONG_DOUBLE 1 + +// Comeau C++ under LINUX/INTEL/ELF +// Preprocess away "long long" routines for now, even in relaxed mode +# define __wcstoull_internal_defined 1 +# define __wcstoll_internal_defined 1 + +#endif /* __COMO__ under __linux__ */ + +#ifdef __USING_x86SVR3x_WITH_COMO /* SCO et al */ +/* UNIX 386+ SVR3 mods made with __USING_x86SVR3x_WITH_COMO + in other sources, not here */ +# define atan2l atan2 +# define cosl cos +# define sinl sin +# define sqrtl sqrt +# include + inline long double expl(long double arg) { return exp(arg); } + inline long double logl(long double arg) { return log(arg); } +# define log10l log10 + +# define sinhl sinh +# define coshl cosh +# define fabsl fabs +namespace std { + inline int min(int a, int b) { return a>b ? b : a; } +} +#endif + +#ifdef sun +// Comeau C++ under Solaris/SPARC or SunOS + +#ifdef solarissparc +#define __USING_SOLARIS_SPARC_WITH_COMO /* show this in the source when grep'ing for COMO */ +// Note comowchar.h for Solaris/SPARC wchar stuff + +#include +# define sinf sin +# define sinl sin +# define sinhf sinh +# define sinhl sinh +# define cosf cos +# define cosl cos +# define coshf cosh +# define coshl cosh +# define atan2l atan2 +# define atan2f atan2 + inline float logf(float arg) { return log(arg); } + inline long double logl(long double arg) { return log(arg); } +# define log10f log10 +# define log10l log10 +# define expf exp + inline long double expl(long double arg) { return exp(arg); } +# define sqrtf sqrt +# define sqrtl sqrt +# define fabsf fabs +# define fabsl fabs +#else +#define __USING_SUNOS_WITH_COMO + +#define __unix 1 +#define __EXTENSIONS__ /* This might create undue noise somewhere */ +#endif +#endif /* sun */ + +#if defined(__NetBSD__) +// From non-como #ifdef __GNUC__ above +#undef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE +#define __unix 1 + +#include +// Some joker #define'd __END_DECLS as }; +#undef __END_DECLS +#define __END_DECLS } + +// prob +#include +#undef __RENAME +#define __RENAME(x) + +#define wchar_t __COMO_WCHAR_T +#include +#undef wchar_t + +#include +# ifdef BORIS_DISABLED +# define atan2l atan2 +# define cosl cos +# define sinl sin +# define sqrtl sqrt + inline long double expl(long double arg) { return exp(arg); } + inline long double logl(long double arg) { return log(arg); } +# define log10l log10 +# define sinhl sinh +# define coshl cosh +# define fabsl fabs +# endif +#endif /* __NetBSD__ under __COMO__ */ + +// Shouldn't need to change anything below here for Comeau C++ +// If so, tell us at comeau@comeaucomputing.com + +#define _STLP_NO_DRAND48 + +#define _STLP_PARTIAL_SPECIALIZATION_SYNTAX +#define _STLP_NO_USING_CLAUSE_IN_CLASS + +#if __COMO_VERSION__ < 4300 +#if __COMO_VERSION__ >= 4245 +#define _STLP_NO_EXCEPTION_HEADER /**/ + // Is this needed? +# include +#endif +#define _STLP_NO_BAD_ALLOC /**/ +#define _STLP_USE_AUTO_PTR_CONVERSIONS /**/ +#endif + +// this one is true only with MS +# if defined (_MSC_VER) +# define _STLP_WCHAR_T_IS_USHORT 1 +# if _MSC_VER <= 1200 +# define _STLP_VENDOR_GLOBAL_CSTD +# endif +# if _MSC_VER < 1100 +# define _STLP_NO_BAD_ALLOC 1 +# define _STLP_NO_EXCEPTION_HEADER 1 +# define _STLP_NO_NEW_NEW_HEADER 1 +# define _STLP_USE_NO_IOSTREAMS 1 +# endif +# endif + +// # define __EDG_SWITCHES + + diff --git a/sdk/tlibstdcxx/stlport/stl/config/_cray.h b/sdk/tlibstdcxx/stlport/stl/config/_cray.h new file mode 100644 index 0000000000..55327c11da --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_cray.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#define _STLP_COMPILER "CC" + +// Mostly correct guess, change it for Alpha (and other environments +// that has 64-bit "long") +# define _STLP_UINT32_T unsigned long + +// Uncomment if long long is available +# define _STLP_LONG_LONG long long + +// Uncomment this if your compiler can't inline while(), for() +# define _STLP_LOOP_INLINE_PROBLEMS 1 + +// Uncomment this if your compiler does not support exceptions +// Cray C++ supports exceptions when '-h exceptions' option is user; +// therefore '-D_STLP_HAS_NO_EXCEPTIONS' must be used when '-h exceptions' +// is NOT used. +//# define _STLP_HAS_NO_EXCEPTIONS 1 + +// Delete? +// Define this if compiler lacks header +//# define _STLP_NO_EXCEPTION_HEADER 1 + +// Uncomment this if your C library has lrand48() function +# define _STLP_RAND48 1 + +// Uncomment if native new-style C library headers lile , etc are not available. +# define _STLP_HAS_NO_NEW_C_HEADERS 1 + +// uncomment if new-style headers is available +# define _STLP_NO_NEW_NEW_HEADER 1 + +// uncomment this if and other STD headers put their stuff in ::namespace, +// not std:: +# define _STLP_VENDOR_GLOBAL_STD + +// uncomment this if and the like put stuff in ::namespace, +// not std:: +# define _STLP_VENDOR_GLOBAL_CSTD + +# define _STLP_NATIVE_C_HEADER(__x) +// WARNING: Following is hardcoded to the system default C++ include files +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) + + +# define _STLP_NO_NATIVE_MBSTATE_T +# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS +//# define _STLP_VENDOR_GLOBAL_EXCEPT_STD diff --git a/sdk/tlibstdcxx/stlport/stl/config/_cygwin.h b/sdk/tlibstdcxx/stlport/stl/config/_cygwin.h new file mode 100644 index 0000000000..8610743b99 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_cygwin.h @@ -0,0 +1,9 @@ +#define _STLP_PLATFORM "Cygwin" + +#define _STLP_UNIX + +#ifndef _STLP_USE_STDIO_IO +# define _STLP_USE_UNIX_IO +#endif + +#define _STLP_LDOUBLE_96 diff --git a/sdk/tlibstdcxx/stlport/stl/config/_dec.h b/sdk/tlibstdcxx/stlport/stl/config/_dec.h new file mode 100644 index 0000000000..fc8ace7d62 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_dec.h @@ -0,0 +1,113 @@ +#define _STLP_COMPILER "Dec" + +# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG + +# define _STLP_NATIVE_HEADER(header) <../cxx/##header> +# define _STLP_NATIVE_C_HEADER(x) <../include/##x> + +#if (__DECCXX_VER < 60300000) +# define _STLP_NATIVE_CPP_C_HEADER(header) <../cxx/##header> +#else +# define _STLP_NATIVE_CPP_C_HEADER(header) +#endif + +# define _STLP_NATIVE_OLD_STREAMS_HEADER(header) <../cxx/##header> +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../cxx/##header> + +/* Alpha is little-endian */ +# define _STLP_LITTLE_ENDIAN + +// collisions +# define _STLP_DONT_PUT_STLPORT_IN_STD + +#if (__DECCXX_VER < 60000000) + +/* + automatic template instantiation does not + work with namespaces ;( +*/ +# define _STLP_HAS_NO_NAMESPACES 1 + +# define _STLP_NO_NEW_NEW_HEADER 1 + +# define _STLP_NO_WCHAR_T 1 +# define _STLP_NEED_EXPLICIT 1 + +# define _STLP_NO_BOOL 1 +# define _STLP_NEED_TYPENAME 1 +# define _STLP_NO_NEW_STYLE_CASTS 1 +# define _STLP_NEED_MUTABLE 1 +# define _STLP_NO_BAD_ALLOC 1 + + +# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 + +# define _STLP_NO_MEMBER_TEMPLATES 1 +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# define _STLP_NO_QUALIFIED_FRIENDS 1 +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 +# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 +# define _STLP_BROKEN_USING_DIRECTIVE 1 +# define _STLP_NO_EXCEPTION_HEADER 1 +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 + +#endif + + +#ifndef __NO_USE_STD_IOSTREAM +/* default is to use new iostreams, anyway */ +# ifndef __USE_STD_IOSTREAM +# define __USE_STD_IOSTREAM +# endif +#endif + +/* +# ifndef __STD_STRICT_ANSI_ERRORS +# endif +*/ + +#ifndef __EXCEPTIONS +# define _STLP_HAS_NO_EXCEPTIONS 1 +#endif + +# ifdef __IMPLICIT_INCLUDE_ENABLED + +/* but, works with ours ;). */ +# define _STLP_LINK_TIME_INSTANTIATION 1 +# else +# undef _STLP_LINK_TIME_INSTANTIATION +# endif + +# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM) +/* + we should ban that ! + # error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM" +*/ +# endif + +# if (defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS)) +# define _STLP_STRICT_ANSI 1 +# else +/* we want to enforce it */ +# define _STLP_LONG_LONG long long +# endif + +/* unsigned 32-bit integer type */ +# define _STLP_UINT32_T unsigned int +#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +#endif +/* # define _STLP_RAND48 1 */ + +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 + +# if (__DECCXX_VER <= 60600000) +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +# endif + +#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) +# define _STLP_DEC_THREADS +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_dec_vms.h b/sdk/tlibstdcxx/stlport/stl/config/_dec_vms.h new file mode 100644 index 0000000000..44a0fb8b22 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_dec_vms.h @@ -0,0 +1,89 @@ +// OpenVMS version + +#define _STLP_COMPILER "Dec Vms" + +# define _STLP_NATIVE_HEADER(header) +# define _STLP_NATIVE_C_HEADER(x) +# define _STLP_NATIVE_CPP_C_HEADER(header) +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) + +#if (__DECCXX_VER < 60000000) + +// automatic template instantiation does not +// work with namespaces ;( +# define _STLP_HAS_NO_NAMESPACES 1 + +# define _STLP_NO_WCHAR_T 1 +# define _STLP_NEED_EXPLICIT 1 + +# define _STLP_NO_BOOL 1 +# define _STLP_NEED_TYPENAME 1 +# define _STLP_NO_NEW_STYLE_CASTS 1 +# define _STLP_NEED_MUTABLE 1 +# define _STLP_NO_BAD_ALLOC 1 + +# define _STLP_NO_NEW_NEW_HEADER 1 +# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 + +# define _STLP_NO_MEMBER_TEMPLATES 1 +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# define _STLP_NO_QUALIFIED_FRIENDS 1 +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 +# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 +# define _STLP_BROKEN_USING_DIRECTIVE 1 +# define _STLP_NO_EXCEPTION_HEADER 1 +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 + +#endif + + +#ifdef __NO_USE_STD_IOSTREAM +# define _STLP_USE_NO_IOSTREAMS 1 +# else +// default is to use new iostreams, anyway +# ifndef __USE_STD_IOSTREAM +# define __USE_STD_IOSTREAM +# endif +#endif + +#ifndef __EXCEPTIONS +# define _STLP_HAS_NO_EXCEPTIONS 1 +#endif + +# ifdef __IMPLICIT_INCLUDE_ENABLED + +#ifdef _STLP_USE_NO_IOSTREAMS +// implicit include introduces conflicts +// between stlport and native lib. +# undef __IMPLICIT_INCLUDE_ENABLED +#endif + +// but, works with ours ;). +# define _STLP_LINK_TIME_INSTANTIATION 1 + +# endif + +# if defined (__IMPLICIT_USING_STD) && !defined (__NO_USE_STD_IOSTREAM) +// we should ban that ! +# error "STLport won't work with new iostreams and std:: being implicitly included. Please use -std strict_ansi[_errors] or specify __NO_USE_STD_IOSTREAM" +# endif + +# if !(defined (__STD_STRICT_ANSI) || defined (__STD_STRICT_ANSI_ERRORS)) +// we want to enforce it +# define _STLP_LONG_LONG long long +# endif + +// unsigned 32-bit integer type +# define _STLP_UINT32_T unsigned int +#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +#endif +// # define _STLP_RAND48 1 + +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 + +#define _STLP_HAS_NO_NEW_C_HEADERS 1 + diff --git a/sdk/tlibstdcxx/stlport/stl/config/_detect_dll_or_lib.h b/sdk/tlibstdcxx/stlport/stl/config/_detect_dll_or_lib.h new file mode 100644 index 0000000000..a062e6929c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_detect_dll_or_lib.h @@ -0,0 +1,74 @@ +/* File used to define macros: + * _STLP_USE_DYNAMIC_LIB: To signal use STLport as a dll or build of the + * STLport dlls. + * _STLP_USE_STATIC_LIB: To signal use of STLport as a static lib or build of + * the STLport static libs. + * _STLP_USING_CROSS_NATIVE_RUNTIME_LIB: Signal that we are using a native runtime + * in a version different from the STLport one. + * If _STLP_USE_DYNAMIC_LIB or _STLP_USE_STATIC_LIB is alreday defined it means that + * user forces use of a specific version. In this case _STLP_USING_CROSS_NATIVE_RUNTIME_LIB + * will surely be defined otherwise there is no need to force macro defines. + * + * Before including this file the compiler must define: + * _STLP_DLL: If we are building a dll + * _STLP_RUNTIME_DLL: If we are using native runtime as a dll + */ +#if defined (__BUILDING_STLPORT) +# undef _STLP_USE_DYNAMIC_LIB +# undef _STLP_USE_STATIC_LIB +# if defined (_STLP_DLL) +/* We are building the STLport dll */ +# define _STLP_USE_DYNAMIC_LIB +# if !defined (_STLP_RUNTIME_DLL) +# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB +# endif +# else +# define _STLP_USE_STATIC_LIB +# if defined (_STLP_RUNTIME_DLL) +# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB +# endif +# endif +#else +# if !defined (_STLP_NO_IOSTREAMS) +/* STLport use only depend on _STLP_RUNTIME_DLL as we are replacing + * the native runtime. + */ +# if defined (_STLP_RUNTIME_DLL) +# if !defined (_STLP_USE_STATIC_LIB) +# if !defined (_STLP_USE_DYNAMIC_LIB) +# define _STLP_USE_DYNAMIC_LIB +# endif +# else +/* The user is forcing use of STLport as a dynamic library. We signal it so + * that the STLport namespace will be modify to report such a combination + * and force the user to link with the rebuilt STLport library. + */ +# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB +# endif +# else +# if !defined(_STLP_USE_DYNAMIC_LIB) +# if !defined (_STLP_USE_STATIC_LIB) +# define _STLP_USE_STATIC_LIB +# endif +# else +/* Idem previous remark but the user forces use of the static native runtime. + */ +# define _STLP_USING_CROSS_NATIVE_RUNTIME_LIB +# endif +# endif +# else +/* If we do not build and use STLport libs we consider that we are in a static lib + * mode as only dynamic lib needs additional export/import specifier. + */ +# define _STLP_USE_STATIC_LIB +# endif +#endif + +/* we don't have a static native runtime library on evc3/evc4 */ +#ifdef _STLP_WCE +# undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB +#endif + +#if !defined (_STLP_USE_DYNAMIC_LIB) && !defined (_STLP_USE_STATIC_LIB) +# error Unknown STLport usage config (dll/lib?) +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_dm.h b/sdk/tlibstdcxx/stlport/stl/config/_dm.h new file mode 100644 index 0000000000..4f707323aa --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_dm.h @@ -0,0 +1,121 @@ +// STLport configuration file for Digital Mars C++ + +#define _STLP_COMPILER __DMC_VERSION_STRING__ + +#if (__DMC__ < 0x849) +# error "Digital Mars C++ compilers before version 8.49 are not supported!" +#endif + +/* DMC goes too far in template instanciation and tries to fully instanciate + * slist > for instance. The generation of assignment + * operator fails of course so we are force to use mutable key for this compiler. + */ +#define _STLP_NO_CONST_IN_PAIR +#define _STLP_DONT_SUP_DFLT_PARAM + +#ifndef _CPPUNWIND +# define _STLP_NO_EXCEPTIONS +#endif + +#ifndef _CPPRTTI +# define _STLP_NO_RTTI +#endif + +#define _STLP_VENDOR_GLOBAL_CSTD + +//DMC prefer enum to real static const variable because it do not consider +//static const as const enough to be used in switch declaration... +#define _STLP_STATIC_CONST_INIT_BUG + +#if !defined (_WIN32) +// it's not fully supported on non-Win32 platforms +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS +#endif + +/* _STLP_NO_OWN_NAMESPACE is defined because Digital Mars' linker and libarian + appear to have problems with STLport namespaces. Summary of the issues: + + STATIC: Digital Mars' librarian (lib.exe) may fail with "len <= IDMAX" error + if _STLP_DEBUG is defined. This is because Digital Mars' librarian uses + Microsoft OMF format, which limits identifier length to about 512 bytes. + With STLport namespaces, some identifiers such as Category_Map in + src/locale_catalog.cpp may exceed the maximum OMF identifier length. + + DYNAMIC: Export issues with cin, cout, cerr, clog in src/iostream.cpp. + Exports in Digital Mars 'def' file must match mangled names in iostream.cpp. + With STLport namespaces, the mangled names in the intermediate files no + longer match these pre-defined exports. To use STLport dynamic libraries + and STLport namespaces with Digital Mars, the pre-defined exports in + src/iostream.cpp and the related Digital Mars 'def' files would need to be + revised. */ +#define _STLP_NO_OWN_NAMESPACE 1 + +// select threads strategy +#if defined (_MT) && !defined (_STLP_NO_THREADS) +# define _STLP_THREADS +#endif + +#ifndef _BOOL_DEFINED +# define _STLP_NO_BOOL +#else +# define _STLP_DONT_USE_BOOL_TYPEDEF +#endif + +#if _INTEGRAL_MAX_BITS >= 64 +# define _STLP_LONG_LONG long long +#endif + +#define _STLP_MARK_PARAMETER_AS_UNUSED(X) +#define _STLP_DONT_USE_PRIV_NAMESPACE +#define _STLP_PRIV +#define _STLP_THROW_RETURN_BUG + +#if !defined (_DLL) +# undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT +#endif + +#if (__DMC__ < 0x849) +# define _STLP_NO_BAD_ALLOC +#endif + +#define _STLP_USE_ABBREVS +#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER + +#define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND +#define _STLP_EXPORT_DECLSPEC __declspec(dllexport) +#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) + +#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) +#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) + +#define _STLP_NEED_ADDITIONAL_STATIC_DECLSPEC + +//#define _STLP_IMPORT_TEMPLATE_KEYWORD __declspec(dllimport) +//#define _STLP_EXPORT_TEMPLATE_KEYWORD __declspec(dllexport) + +#if defined (_WINDLL) +# define _STLP_DLL +#endif +#if defined (_DLL) +# define _STLP_RUNTIME_DLL +#endif +#include +#undef _STLP_RUNTIME_DLL +#undef _STLP_DLL + +#if defined (_STLP_USE_DYNAMIC_LIB) +# define _STLP_USE_DECLSPEC 1 +# if defined (__BUILDING_STLPORT) +# define _STLP_CALL __export +# else +# define _STLP_CALL +# endif +#else +# define _STLP_CALL +#endif + +#include + +#undef __SC__ + +#include diff --git a/sdk/tlibstdcxx/stlport/stl/config/_epilog.h b/sdk/tlibstdcxx/stlport/stl/config/_epilog.h new file mode 100644 index 0000000000..30d1e244e7 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_epilog.h @@ -0,0 +1,29 @@ +#if defined (_STLP_MSVC) || defined (__ICL) + +# pragma warning (pop) +# pragma pack (pop) + +#elif defined (__BORLANDC__) + +# pragma option pop +# pragma option -w-pow // -w-8062 Previous options and warnings not restored + +#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) + +# pragma reset woff 1174 +# pragma reset woff 1375 +# pragma reset woff 1209 +/* from iterator_base.h */ +# pragma reset woff 1183 + +#elif defined (__DECCXX) + +# ifdef __PRAGMA_ENVIRONMENT +# pragma __environment __restore +# endif + +#elif defined (__IBMCPP__) + +# pragma info(restore) + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_evc.h b/sdk/tlibstdcxx/stlport/stl/config/_evc.h new file mode 100644 index 0000000000..c460450689 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_evc.h @@ -0,0 +1,333 @@ +/* + * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport + * May 2004 + * Origin : Zdenek Nemec - zero@mapfactor.com + * Michael Fink - vividos@users.sourceforge.net + */ + +#ifndef _STLP_EVC_H +#define _STLP_EVC_H + +#define _STLP_COMPILER "eMbedded Visual C++" + +// This flag is being used by STLport to support +// old-fashioned Windows CE SDK (see stl_wince.h) +// do not use with eMebedded Visual C++ 3 or 4! +#ifdef _STLP_WINCE +# undef _STLP_WINCE +#endif + +/* Compiler dependent define. The following defines may be available: + * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3 + * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET + * _STLP_WCE always defined when compiling with one of the above + */ +#undef _STLP_WCE_EVC3 +#undef _STLP_WCE_NET + +#if (_WIN32_WCE > 300) +# define _STLP_WCE_NET UNDER_CE +#elif (_WIN32_WCE == 300) +# define _STLP_WCE_EVC3 UNDER_CE +#else +# error No support for Windows CE below 3.0! +#endif + +// This is defined for all platforms using Windows CE +#define _STLP_WCE + +/* All Windows CE versions up to at least version 5 are little-endian, even + * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */ +#define _STLP_LITTLE_ENDIAN + +// Ensure _DEBUG is defined. +#if defined (DEBUG) && !defined (_DEBUG) +# define _DEBUG +#endif + +// inherit all msvc6 options +#include + +// CE up to at least version 5 has no C locale support +#define _STLP_NO_LOCALE_SUPPORT + +#if _WIN32_WCE >= 420 + // SDKs built with PB5 have terminate&co in namespace std... +# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD +# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD + // ...and new_handler/set_new_handler in the global namespace. +# define _STLP_GLOBAL_NEW_HANDLER 1 +#endif + +// Always threaded in eMbedded Visual C++ 3.0 and .NET +#ifndef _MT +# define _MT +#endif + +// we don't have a static native runtime library +#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB + +#if _WIN32_WCE < 400 +// no long double under CE3 and older +# define _STLP_NO_LONG_DOUBLE +#endif + +// no *f and *l math functions available +#define _STLP_NO_VENDOR_MATH_F +#define _STLP_NO_VENDOR_MATH_L + +/* + * Redirect cout, cerr and clog: + * If defined redirect cout, cerr and clog to + * files stdout.txt, stderr.txt and stdlog.txt + */ +//# define _STLP_REDIRECT_STDSTREAMS + +/* + * Static class members may generate LNK1179: + * Wrong COMDAT packing may cause LNK1179 error. + * For details see http://groups.google.com/groups?th=8a05c82c4ffee280 + * example P78. This define is not used/needed at this moment + * but may came handy in future... + */ +//# define _STLP_STATIC_MEMBERS_BUG + +// Use wide-string interface of windows native functions (CreateFile...). +// Note that this should be defined all the time while under CE. +#if defined (UNICODE) +# define _STLP_USE_WIDE_INTERFACE +#endif + +// Force exception std to std instead of __std_alias. +#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES) +# ifdef _STLP_VENDOR_EXCEPT_STD +# undef _STLP_VENDOR_EXCEPT_STD +# endif +# define _STLP_VENDOR_EXCEPT_STD std +#endif + +// short string optimization bug under evc3, evc4 using ARM compiler +#if _MSC_VER < 1400 && (defined (ARM) || defined (_ARM_)) +# define _STLP_DONT_USE_SHORT_STRING_OPTIM +#endif + +// when using MFC, disable another placement new declaration, since there is one in wcealt.h +#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER) +# define __PLACEMENT_NEW_INLINE +#endif + +// threads +#undef _REENTRANT +#define _REENTRANT +#undef _NOTHREADS + +// Use old fashioned headers (ctime vs. time.h). +#undef _STLP_NO_NEW_C_HEADERS +#define _STLP_NO_NEW_C_HEADERS + +// exception handling support: only on evc4 and user added /GX to project settings +#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND) +# define _STLP_NO_EXCEPTION_HEADER +# define _STLP_NO_EXCEPTIONS +# undef _STLP_USE_EXCEPTIONS +# ifndef _STLP_THROW_BAD_ALLOC +# define _STLP_THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); } +# endif +#endif + +#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg) + +/* + * eMbedded Visual C++ .NET specific settings + */ +#if defined (_STLP_WCE_NET) + +// evc4 has no locale and time support +# define _STLP_NO_LOCALE_SUPPORT +# define _STLP_NO_TIME_SUPPORT + +// ptrdiff_t is not defined in evc4 headers +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif + +/* + * Helper macros for including the native headers in cases where a file with + * the same name also exists in the STLport include folder. The idea behind + * this is that we first go up one directory and then down into a dir that + * is only present in the native install but not in STLport. + * + */ +# if !defined (_STLP_NATIVE_INCLUDE_PATH) +# if defined (_X86_) +# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR) +# define _STLP_NATIVE_INCLUDE_PATH ../Emulator +# else +# define _STLP_NATIVE_INCLUDE_PATH ../X86 +# endif +# elif defined (_ARM_) +# if _MSC_VER < 1400 + // eVC3/4 +# if defined (ARMV4) +# define _STLP_NATIVE_INCLUDE_PATH ../Armv4 +# elif defined (ARMV4I) +# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i +# elif defined (ARMV4T) +# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t +# else +# error Unknown ARM SDK. +# endif +# else + // VC8 crosscompiling for CE +# if defined (ARMV4) + // VC8 bundled Pocket PC 2003 SDK don't have a target CPU subfolder. +# if defined(WIN32_PLATFORM_PSPC) +# define _STLP_NATIVE_INCLUDE_PATH ../Include +# else +# define _STLP_NATIVE_INCLUDE_PATH ../Armv4 +# endif +# elif defined(ARMV4I) || defined(ARMV4T) +# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i +# else +# error Unknown ARM SDK. +# endif +# endif +# elif defined (_MIPS_) +# if defined (MIPS16) +# define _STLP_NATIVE_INCLUDE_PATH ../mips16 +# elif defined (MIPSII) +# define _STLP_NATIVE_INCLUDE_PATH ../mipsII +# elif defined (MIPSII_FP) +# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp +# elif defined (MIPSIV) +# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV +# elif defined (MIPSIV_FP) +# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp +# else +# error Unknown MIPS SDK. +# endif +# elif defined (SHx) +# if defined (SH3) +# define _STLP_NATIVE_INCLUDE_PATH ../sh3 +# elif defined (SH4) +# define _STLP_NATIVE_INCLUDE_PATH ../sh4 +# else +# error Unknown SHx SDK. +# endif +# else +# error Unknown SDK. +# endif +# endif /* !_STLP_NATIVE_INCLUDE_PATH */ + +/* Workaround when using MFCCE and using together: MFCCE's wcealt.h doesn't + * check for __PLACEMENT_NEW_INLINE before defining operator new, so when + * defines the operatore before, there will be an error C2084: + * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body". + */ +# ifdef _STLP_USE_MFC +# define __PLACEMENT_NEW_INLINE +# endif + +#endif /* _STLP_WCE_NET */ + +/* + * eMbedded Visual C++ 3.0 specific settings + */ +#if defined (_STLP_WCE_EVC3) + +# define _STLP_NO_NATIVE_MBSTATE_T + +// evc3 has no locale and time support +# define _STLP_NO_LOCALE_SUPPORT +# define _STLP_NO_TIME_SUPPORT + +// evc3 has new, but no explicit header +# define _STLP_NO_NEW_HEADER +# define _STLP_NO_NEW_NEW_HEADER + +// evc3 has no bad_alloc and no typeinfo +# undef _STLP_NO_BAD_ALLOC +# define _STLP_NO_BAD_ALLOC + +# undef _STLP_NO_TYPEINFO +# define _STLP_NO_TYPEINFO + +// missing things in eMbedded Visual C++ 3.0 headers +# ifndef _SIZE_T_DEFINED + typedef unsigned int size_t; +# define _SIZE_T_DEFINED +# endif + +# ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +# define _WCHAR_T_DEFINED +# endif + +// ptrdiff_t is not defined in evc3 headers +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif + +// clock_t is not defined in evc3 headers +# ifndef _CLOCK_T_DEFINED + typedef long clock_t; +# define _CLOCK_T_DEFINED +# endif + +// Struct tm is not defined in evc3 headers +# ifndef _TM_DEFINED +struct tm { + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday - [0,6] */ + int tm_yday; /* days since January 1 - [0,365] */ + int tm_isdst; /* daylight savings time flag */ +}; +# define _TM_DEFINED +# endif + +// define placement new and delete operator +// note: when MFCCE headers are included first, don't define the new operator, +// since it was already defined in wcealt.h +# ifdef __cplusplus +# ifndef __PLACEMENT_NEW_INLINE +# ifndef _MFC_VER +inline void *__cdecl operator new(size_t, void *_P) { return (_P); } +# endif /* _MFC_VER */ +inline void __cdecl operator delete(void *, void *) { return; } +# define __PLACEMENT_NEW_INLINE +# endif +# endif /* __cplusplus */ + +// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS + +// evc3 doesn't have assert.h +# ifndef _ASSERT_DEFINED +# define assert(expr) _STLP_ASSERT(expr) +# define _ASSERT_DEFINED +# endif + +#endif /* _STLP_WCE_EVC3 */ + +/* + * original call: TerminateProcess(GetCurrentProcess(), 0); + * we substitute the GetCurrentProcess() with the result of the inline function + * defined in kfuncs.h, since we then can avoid including at all. + * all needed Win32 API functions are defined in + */ +#ifndef _ABORT_DEFINED +# define _STLP_ABORT() TerminateProcess(reinterpret_cast(66), 0) +# define _ABORT_DEFINED +#endif + +// Notice: windows.h isn't included here anymore; all needed defines are in +// stl/_windows.h now + +#endif /* _STLP_EVC_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/_feedback.h b/sdk/tlibstdcxx/stlport/stl/config/_feedback.h new file mode 100644 index 0000000000..0171ca5119 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_feedback.h @@ -0,0 +1,43 @@ +/* Helper header to give feedback about build environment configuration + * thanks to #pragma message directives. + */ + +#if defined (_STLP_VERBOSE) +# define _STLP_VERBOSE_MODE_SUPPORTED + +# if defined (_STLP_COMPILER) +# pragma message (_STLP_COMPILER) +# endif + +# if defined (_STLP_NO_RTTI) +# pragma message ("STLport: RTTI support -> Disabled") +# else +# pragma message ("STLport: RTTI support -> Enabled") +# endif + +# if defined (_STLP_HAS_NO_EXCEPTIONS) +# pragma message ("STLport: Exception support -> Disabled") +# else +# pragma message ("STLport: Exception support -> Enabled") +# endif + +# if defined (_STLP_THREADS) +# pragma message ("STLport: Threading model -> Multi") +# else +# pragma message ("STLport: Threading model -> Mono") +# endif + +# if defined (_STLP_USE_DYNAMIC_LIB) +# pragma message ("STLport: Library model -> Dynamic") +# else +# pragma message ("STLport: Library model -> Static") +# endif + +# if defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# if defined (_STLP_USE_DYNAMIC_LIB) +# pragma message ("STLport: Native library model -> Static") +# else +# pragma message ("STLport: Native library model -> Dynamic") +# endif +# endif +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_freebsd.h b/sdk/tlibstdcxx/stlport/stl/config/_freebsd.h new file mode 100644 index 0000000000..ab9339bd21 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_freebsd.h @@ -0,0 +1,3 @@ +#define _STLP_PLATFORM "Free BSD" + +#define _STLP_USE_UNIX_IO diff --git a/sdk/tlibstdcxx/stlport/stl/config/_fujitsu.h b/sdk/tlibstdcxx/stlport/stl/config/_fujitsu.h new file mode 100644 index 0000000000..cf91e05f94 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_fujitsu.h @@ -0,0 +1,7 @@ +/* STLport configuration for Fujitsu compiler : looks like a perfect one ! */ +#define _STLP_COMPILER "Fujitsu" + +#define _STLP_NATIVE_INCLUDE_PATH ../std +#define _STLP_UINT32_T unsigned int +#define _STLP_LONG_LONG long long +#define _STLP_WCHAR_SUNPRO_EXCLUDE 1 diff --git a/sdk/tlibstdcxx/stlport/stl/config/_gcc.h b/sdk/tlibstdcxx/stlport/stl/config/_gcc.h new file mode 100644 index 0000000000..71dc09c0d2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_gcc.h @@ -0,0 +1,204 @@ +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly + */ + +#define _STLP_COMPILER "gcc" + +#if !defined (_STLP_SGX_CONFIG) +#define _STLP_HAS_INCLUDE_NEXT 1 +#endif + +#if (__GNUC__ < 2) || ((__GNUC__ < 3) && ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96))) +/* We do not support neither the unofficial 2.96 gcc version. */ +# error GNU compilers before 2.95 are not supported anymore. +#endif + +/* Systems having GLIBC installed have different traits */ +#if !defined (_STLP_SGX_CONFIG) +#if defined (__linux__) +# ifndef _STLP_USE_GLIBC +# define _STLP_USE_GLIBC 1 +# endif +# if defined (__UCLIBC__) && !defined (_STLP_USE_UCLIBC) +# define _STLP_USE_UCLIBC 1 +# endif +#endif +#endif + +#if defined (__CYGWIN__) && \ + (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3) && !defined (_GLIBCPP_USE_C99) +# define _STLP_NO_VENDOR_MATH_L +# define _STLP_NO_VENDOR_STDLIB_L +#endif + +#if (__GNUC__ < 3) +# define _STLP_NO_VENDOR_STDLIB_L +#endif + +#if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4)) +/* define for gcc versions before 3.4.0. */ +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD +#endif + +#if !defined (_REENTRANT) && (defined (_THREAD_SAFE) || \ + (defined (__OpenBSD__) && defined (_POSIX_THREADS)) || \ + (defined (__MINGW32__) && defined (_MT))) +# define _REENTRANT +#endif + +#if defined (__DJGPP) +# define _STLP_RAND48 1 +# define _NOTHREADS 1 +# undef _PTHREADS +# define _STLP_LITTLE_ENDIAN +#endif + +#if defined (__MINGW32__) +/* Mingw32, egcs compiler using the Microsoft C runtime */ +# if (__GNUC__ >= 3) +/* For gcc before version 3 this macro is defined below */ +# define _STLP_VENDOR_GLOBAL_CSTD +# endif +# undef _STLP_NO_DRAND48 +# define _STLP_NO_DRAND48 +# define _STLP_CALL +#endif /* __MINGW32__ */ + +#if defined (__CYGWIN__) || defined (__MINGW32__) +# if !defined (_STLP_USE_STATIC_LIB) +# define _STLP_USE_DECLSPEC 1 +# if !defined (_STLP_USE_DYNAMIC_LIB) +# define _STLP_USE_DYNAMIC_LIB +# endif +# define _STLP_EXPORT_DECLSPEC __declspec(dllexport) +# define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) +# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) +# endif +/* The following is defined independently of _STLP_USE_STATIC_LIB because it is also + * used to import symbols from PSDK under MinGW + */ +# define _STLP_IMPORT_DECLSPEC __declspec(dllimport) +#else +# if (__GNUC__ >= 4) +# if !defined (_STLP_USE_STATIC_LIB) +# if !defined (_STLP_USE_DYNAMIC_LIB) +# define _STLP_USE_DYNAMIC_LIB +# endif +# define _STLP_USE_DECLSPEC 1 +# define _STLP_EXPORT_DECLSPEC __attribute__((visibility("default"))) +# define _STLP_IMPORT_DECLSPEC __attribute__((visibility("default"))) +# define _STLP_CLASS_EXPORT_DECLSPEC __attribute__((visibility("default"))) +# define _STLP_CLASS_IMPORT_DECLSPEC __attribute__((visibility("default"))) +# endif +# endif +#endif + +#if !defined (_STLP_SGX_CONFIG) +#if defined (__CYGWIN__) || defined (__MINGW32__) || !(defined (_STLP_USE_GLIBC) || defined (__sun) || defined(__APPLE__)) +# if !defined (__MINGW32__) && !defined (__CYGWIN__) +# define _STLP_NO_NATIVE_MBSTATE_T 1 +# endif +# if !defined (__MINGW32__) || (__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 4) +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 +# endif +# define _STLP_NO_NATIVE_WIDE_STREAMS 1 +#endif +#endif /* _STLP_SGX_CONFIG */ + +#define _STLP_NORETURN_FUNCTION __attribute__((noreturn)) + +/* Mac OS X is a little different with namespaces and cannot instantiate + * static data members in template classes */ +#if defined (__APPLE__) +# if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) +/* Mac OS X is missing a required typedef and standard macro */ +typedef unsigned int wint_t; +# endif + +# define __unix + +# define _STLP_NO_LONG_DOUBLE + +/* Mac OS X needs all "::" scope references to be "std::" */ +# define _STLP_USE_NEW_C_HEADERS + +# define _STLP_NO_VENDOR_STDLIB_L + +#endif /* __APPLE__ */ + +/* g++ 2.7.x and above */ +#define _STLP_LONG_LONG long long + +#ifdef _STLP_USE_UCLIBC + /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */ +# define _STLP_NO_VENDOR_MATH_F + /* No *l math fuctions variants (i.e. sqrtl, fabsl, etc.) */ +# define _STLP_NO_VENDOR_MATH_L +# define _STLP_NO_LONG_DOUBLE +#endif + +#if defined (__OpenBSD__) || defined (__FreeBSD__) +# define _STLP_NO_VENDOR_MATH_L +# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */ +# ifndef __unix +# define __unix +# endif +#endif + +#if defined (__alpha__) +# define _STLP_NO_VENDOR_MATH_L +#endif + +#if defined (__hpux) +# define _STLP_VENDOR_GLOBAL_CSTD 1 +# define _STLP_NO_VENDOR_STDLIB_L /* no llabs */ + /* No *f math fuctions variants (i.e. sqrtf, fabsf, etc.) */ +# define _STLP_NO_VENDOR_MATH_F +#endif + +#if (__GNUC__ >= 3) +# ifndef _STLP_HAS_NO_NEW_C_HEADERS +/* +# ifndef _STLP_USE_UCLIBC +*/ +# define _STLP_HAS_NATIVE_FLOAT_ABS +/* +# endif +*/ +# else +# ifdef _STLP_USE_GLIBC +# define _STLP_VENDOR_LONG_DOUBLE_MATH 1 +# endif +# endif +#endif + +#if (__GNUC__ < 3) +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +# define _STLP_VENDOR_GLOBAL_CSTD 1 +# define _STLP_DONT_USE_PTHREAD_SPINLOCK 1 +# ifndef __HONOR_STD +# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1 +# endif +/* egcs fails to initialize builtin types in expr. like this : new(p) char(); */ +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +#endif + +#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT +#undef _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT + +/* strict ANSI prohibits "long long" ( gcc) */ +#if defined ( __STRICT_ANSI__ ) +# undef _STLP_LONG_LONG +#endif + +#ifndef __EXCEPTIONS +# undef _STLP_DONT_USE_EXCEPTIONS +# define _STLP_DONT_USE_EXCEPTIONS 1 +#endif + +#if (__GNUC__ >= 3) +/* Instantiation scheme that used (default) in gcc 3 made void of sense explicit + instantiation within library: nothing except increased library size. - ptr + */ +# define _STLP_NO_FORCE_INSTANTIATE +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_hpacc.h b/sdk/tlibstdcxx/stlport/stl/config/_hpacc.h new file mode 100644 index 0000000000..920b8b4171 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_hpacc.h @@ -0,0 +1,129 @@ +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly + */ + +#define _STLP_COMPILER "aCC" + +/* system C-library dependent */ +#if defined (_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +#endif +/* # define _STLP_RAND48 1 */ +/* #define _STLP_NO_NATIVE_MBSTATE_T 1 */ +#define _STLP_HPACC_BROKEN_BUFEND 1 +#define _STLP_WCHAR_HPACC_EXCLUDE 1 + +/* this was reported to help, just as with SUN CC 4.2 */ +#define _STLP_INLINE_STRING_LITERAL_BUG + +/* specific prolog is needed to select correct threads impl */ +#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG + +/* HP aCC with +noeh */ +#ifdef __HPACC_NOEH +# define _STLP_HAS_NO_EXCEPTIONS 1 +#endif + +#define _STLP_NO_FORCE_INSTANTIATE +#define _STLP_LONG_LONG long long +#define _STLP_NO_VENDOR_STDLIB_L + +/* The aCC6 compiler is using the EDG Front End. Unfortunately, prior to + * version A.06.12, defining the __EDG__ and __EDG_VERSION__ macros was + * disabled. It was corrected in A.06.12. + */ +#if ((__HP_aCC > 60000) && (__HP_aCC < 61200)) +# define __EDG__ +# define __EDG_VERSION__ 306 +#endif + +#if (__HP_aCC >= 32500 ) +# define _STLP_USE_NEW_C_HEADERS + +# define _STLP_FORCE_ALLOCATORS(t,a) \ + typedef typename _Alloc_traits::_Orig _STLP_dummy_type1;\ + typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind::other _STLP_dummy_type2; + +# if defined (_HP_NAMESPACE_STD) // option -AA +/* from now, we have a full standard lib in namespace std + * + * -AA indicates that we are compiling against Rogue Wave 2.2.1 + * STL shipped with the HP aCC compiler. -AA tells the compiler + * to use the STL defined in the include_std directory. + */ +# define _STLP_NATIVE_INCLUDE_PATH ../include_std +# else // option -Aa +# define _STLP_VENDOR_GLOBAL_STD 1 +# define _STLP_VENDOR_GLOBAL_CSTD 1 +# define _STLP_DONT_THROW_RANGE_ERRORS 1 +# endif +#endif + +#if (__HP_aCC >= 31400 && __HP_aCC < 32500) +# define _STLP_FORCE_ALLOCATORS(t,a) \ +typedef typename _Alloc_traits::_Orig _STLP_dummy_type1;\ +typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind::other _STLP_dummy_type2; +# define _STLP_NO_CWCHAR +# if defined (_NAMESPACE_STD) // option -AA +/* from now, we have a full standard lib in namespace std */ +# define _STLP_NATIVE_INCLUDE_PATH ../include_std +# else /* kind of compatibility mode */ +# define _STLP_VENDOR_GLOBAL_STD 1 +# define _STLP_VENDOR_GLOBAL_CSTD 1 +# define _STLP_DONT_THROW_RANGE_ERRORS 1 +# define _STLP_NO_ROPE 1 +# endif +#endif /* 314 */ + +#if ((__HP_aCC >= 30000 && __HP_aCC < 31400) || (__HP_aCC == 1)) // A.03.13: __HP_aCC == 1 + +# if (__HP_aCC != 1) +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +# endif + +# define _STLP_NO_QUALIFIED_FRIENDS 1 +/* aCC bug ? need explicit args on constructors of partial specialized + * classes + */ +# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1 +/* ?? fbp : maybe present in some versions ? */ +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +/* and stuff is in global namespace */ +# define _STLP_VENDOR_GLOBAL_EXCEPT_STD +/* fbp : moved here */ +# define _STLP_VENDOR_GLOBAL_CSTD 1 +/* # define _INCLUDE_HPUX_SOURCE */ +# define _XPG4 +# define _INCLUDE_XOPEN_SOURCE +# define _INCLUDE_AES_SOURCE +#endif + +#if (__HP_aCC <= 30000 && __HP_aCC >= 12100) +/* Special kludge to workaround bug in aCC A.01.23, CR JAGac40634 */ +# ifdef _STLP_DEBUG +static void _STLP_dummy_literal() { const char *p = "x";} +static void _STLP_dummy_literal_2() { const char *p = "123456789"; } +static void _STLP_dummy_literal_3() { const char *p = "123456700000000000000089";} +# endif + +# define _STLP_VENDOR_GLOBAL_STD 1 +# define _STLP_VENDOR_GLOBAL_CSTD 1 +# define _STLP_DONT_THROW_RANGE_ERRORS 1 +# define _STLP_STATIC_CONST_INIT_BUG 1 +# if (__HP_aCC < 12700) +/* new flag: on most HP compilers cwchar is missing */ +# define _STLP_NO_CWCHAR +# endif + +# define _STLP_FORCE_ALLOCATORS(t,a) \ + typedef typename _Alloc_traits::_Orig _STLP_dummy_type1;\ + typedef typename _STLP_dummy_type1:: _STLP_TEMPLATE rebind::other _STLP_dummy_type2; +#endif + +#if __HP_aCC == 1 +# define _STLP_BROKEN_USING_IN_CLASS +# define _STLP_USING_BASE_MEMBER +# define _STLP_NO_CWCHAR +/* # define _STLP_NO_WCHAR_T 1 */ +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_hpux.h b/sdk/tlibstdcxx/stlport/stl/config/_hpux.h new file mode 100644 index 0000000000..385c514cc0 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_hpux.h @@ -0,0 +1,17 @@ +#ifndef __stl_config__hpux_h +#define __stl_config__hpux_h + +#define _STLP_PLATFORM "HP Unix" + +#define _STLP_USE_UNIX_IO + +#ifdef __GNUC__ +# define _STLP_NO_WCHAR_T +# define _STLP_NO_CWCHAR +# define _STLP_NO_LONG_DOUBLE +# ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 199506 +# endif +#endif + +#endif /* __stl_config__hpux_h */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/_ibm.h b/sdk/tlibstdcxx/stlport/stl/config/_ibm.h new file mode 100644 index 0000000000..f74f6d9be9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_ibm.h @@ -0,0 +1,144 @@ +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly + */ + +#if defined (__IBMCPP__) || defined (__IBMC__) +# define _STLP_COMPILER "Visual Age C++" +#elif defined (__xlC__) +# define _STLP_COMPILER "xlc" +#else +# error "Unknown compiler" +#endif + +#if !defined(__IBMCPP__) || (__IBMCPP__ < 500) +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +#endif + +/* string literal problem, same as with SUN and aCC */ +# define _STLP_INLINE_STRING_LITERAL_BUG 1 +# define _STLP_HAS_NATIVE_FLOAT_ABS + +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 + + +# ifdef __IBMCPP__ +# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG +# endif + +/* # if ( defined (__MULTI__) && defined (__WINDOWS__)) + * # define _STLP_WIN32THREADS 1 Only Visual Age 3.5 for Windows + * # endif + */ + +# if ( defined (__MULTI__) && defined (__OS2__)) +# define _STLP_OS2THREADS 1 +# endif + +/* __TEMPINC__ is set when /Ft+ option is used */ +# ifdef __TEMPINC__ +# define _STLP_LINK_TIME_INSTANTIATION 1 +# endif + +# if defined (__MVS__) +/* long long support is buggy - reported by Tinny Ng + * # if __EXTENDED__ && __COMPILER_VER__ >= 0x22060000 + * # define _STLP_LONG_LONG long long + * # endif + */ +/* boris : hstash reported it can be treated like UNIX */ +# define _STLP_NO_TYPEINFO 1 +# undef _STLP_NATIVE_INCLUDE_PATH +# define _STLP_NATIVE_INCLUDE_PATH /usr/lpp/ioclib/include +/* same for C headers like */ +# undef _STLP_NATIVE_C_INCLUDE_PATH +# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include +# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH /usr/include + +# elif (defined (__WINDOWS__) || defined (_AIX) || defined (__OS2__) ) && (__IBMCPP__ >= 350) + +# define _STLP_LONG_LONG long long + +#endif + +#if !( defined( __xlC__ ) && __xlC__ >= 0x500 ) + +/* AIX xlC 3.1 , 3.0.1 ==0x301 + * Visual Age C++ 3.x + * OS-390 C++ + * fbp : should be more version-specific! + */ + +# define _STLP_NO_BOOL 1 +# define _STLP_DONT_USE_BOOL_TYPEDEF 1 +# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 +# define _STLP_HAS_NO_NAMESPACES 1 +# define _STLP_NEED_TYPENAME 1 +# define _STLP_NEED_EXPLICIT 1 +# define _STLP_NO_ARROW_OPERATOR 1 +# define _STLP_NO_NEW_STYLE_CASTS 1 +# define _STLP_NO_WCHAR_T 1 +# define _STLP_NEED_MUTABLE 1 +# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 +# define _STLP_NO_BAD_ALLOC 1 + +# define _STLP_NO_MEMBER_TEMPLATES 1 +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# define _STLP_NO_QUALIFIED_FRIENDS 1 +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 + +# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 +# define _STLP_NO_METHOD_SPECIALIZATION 1 +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 +# define _STLP_NO_EXCEPTION_HEADER 1 + +# define _STLP_NO_NEW_NEW_HEADER 1 + +# if defined (__OS2__) && (__IBMCPP__ <= 350) +# define _STLP_NO_TYPEINFO 1 +# endif +# define _STLP_NO_NEW_NEW_HEADER 1 + +# define _STLP_STATIC_CONST_INIT_BUG 1 +/* # define _STLP_THROW_RETURN_BUG 1 */ + + +# define _STLP_NO_TEMPLATE_CONVERSIONS 1 +# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 + +/* AIX xlC, Visual Age 3.0 for OS/2 and MS */ +# define _STLP_TRIVIAL_DESTRUCTOR_BUG + +# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 +# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 + +#if __IBMCPP__ <= 350 +# define _STLP_NEED_UNREACHABLE_RETURN 1 +#endif + +#if __IBMCPP__ < 350 +# define _STLP_NO_LONG_DOUBLE 1 +#endif + +#if __IBMCPP__ >= 365 +/* does not have new C headers, but has div() */ +# define _STLP_LDIV +#endif + +#endif /* xlC 5 */ + +/* detect xlC5 by: */ +#if defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 700) +# define _STLP_USE_EXCEPTIONS 1 +# define _STLP_STATIC_CONST_INIT_BUG 1 +/* #pragma report(disable,CPPC1500029) + * unsigned 32-bit integer type + */ +# define _STLP_UINT32_T unsigned int +# if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +# endif +/* # define _STLP_RAND48 1 */ +#endif /* __IBMCPP__ == 500 */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/_icc.h b/sdk/tlibstdcxx/stlport/stl/config/_icc.h new file mode 100644 index 0000000000..e9d7a6c3e4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_icc.h @@ -0,0 +1,45 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly +// A list of Intel compiler for Linux portion of STLport settings. + +#define _STLP_COMPILER "Intel ICC" + +#define _STLP_LONG_LONG long long + +// Edit relative path below (or put full path) to get native +// compiler headers included. Default is "../include". +// C headers may reside in different directory, so separate macro is provided. +#if !defined (_STLP_SGX_CONFIG) +#if (__INTEL_COMPILER < 800) +# define _STLP_NATIVE_INCLUDE_PATH ../include +# define _STLP_NATIVE_C_INCLUDE_PATH ../include +# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include +#endif + +#if (__INTEL_COMPILER >= 800) +# define _STLP_NATIVE_INCLUDE_PATH ../include/c++ +# define _STLP_NATIVE_C_INCLUDE_PATH ../include +# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include + +#endif /* __INTEL_COMPILER >= 800 */ +#endif /* !_STLP_SGX_CONFIG */ +#define _STLP_HAS_NO_NEW_C_HEADERS 1 +#define _STLP_VENDOR_GLOBAL_CSTD 1 + +/* Systems having GLIBC installed have different traits */ +#if !defined (_STLP_USE_GLIBC) && defined (__linux__) +# define _STLP_USE_GLIBC +# define _XOPEN_SOURCE 600 +#endif + +#undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT + + +#ifndef __GNUC__ +# define __GNUC__ 3 +#endif + +//#define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 + +#define _STLP_NO_FORCE_INSTANTIATE +//#define _REENTRANT diff --git a/sdk/tlibstdcxx/stlport/stl/config/_intel.h b/sdk/tlibstdcxx/stlport/stl/config/_intel.h new file mode 100644 index 0000000000..01e09d60f2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_intel.h @@ -0,0 +1,72 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_COMPILER "Intel ICL" + +#define _STLP_IMPORT_TEMPLATE_KEYWORD extern + +/* You need to undef following macro if your icl install is binded to MSVC 6 + * native lib and you are building with /Qvc7 or /Qvc7.1 or /Qvc8 option. + */ +/* #define _STLP_MSVC_LIB 1200 */ +/* You need to undef following macro if your icl install is binded to MSVC .Net 2002 + * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7.1 + * or /Qvc8 option. + */ +/* #define _STLP_MSVC_LIB 1300 */ +/* You need to undef following macro if your icl install is binded to MSVC .Net 2003 + * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7 + * or /Qvc8 option. + */ +/* #define _STLP_MSVC_LIB 1310 */ +/* You need to undef following macro if your icl install is binded to MSVC 2005 + * native lib and you are building without any /Qvc* option or with /Qvc6 or /Qvc7 + * or /Qvc7.1 option. + */ +/* #define _STLP_MSVC_LIB 1400 */ + +#include + +#if defined (_STLP_DONT_RETURN_VOID) +# undef _STLP_DONT_RETURN_VOID +#endif + +#if (__ICL < 900) +# define _STLP_NOTHROW +#endif + +#if (__ICL <= 810) +/* If method specialization is activated, compiler do not export some + * symbols anymore. + */ +# define _STLP_NO_METHOD_SPECIALIZATION 1 +#endif + +#if (__ICL >= 800 && __ICL < 900) +# define _STLP_STATIC_CONST_INIT_BUG 1 +#endif + +#if (__ICL >= 450) +# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 +#endif + +#if (__ICL < 450) +/* only static STLport lib works for ICL */ +# undef _STLP_USE_STATIC_LIB +# undef _STLP_USE_DYNAMIC_LIB +# define _STLP_USE_STATIC_LIB +/* disable hook which makes template symbols to be searched for in the library */ +# undef _STLP_NO_CUSTOM_IO +#endif + +#undef _STLP_LONG_LONG +#define _STLP_LONG_LONG long long + +#if defined (__cplusplus) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300) +namespace std +{ + void _STLP_CALL unexpected(); +} +#endif + +#include diff --git a/sdk/tlibstdcxx/stlport/stl/config/_kai.h b/sdk/tlibstdcxx/stlport/stl/config/_kai.h new file mode 100644 index 0000000000..267158f834 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_kai.h @@ -0,0 +1,43 @@ +// STLport config file for KAI C++ compiler + +#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +#endif + +# ifndef __KAI_STRICT /* _NO_LONGLONG */ +# define _STLP_LONG_LONG long long +# endif + +# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS) +# define _STLP_HAS_NO_EXCEPTIONS +# endif + +# ifndef __BUILDING_STLPORT +# define _STLP_LINK_TIME_INSTANTIATION 1 +# endif + +// two levels of macros do not work good with kcc. +# define _STLP_NATIVE_HEADER(header) <../include/##header> +# define _STLP_NATIVE_C_HEADER(header) <../include/##header> +# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header> +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header> + +// KAI C++ uses EDG front-end, but apparently different switches +// # define __EDG_SWITCHES 1 + +# define _STLP_VENDOR_GLOBAL_CSTD 1 +# define _STLP_VENDOR_MB_NAMESPACE std + +// boris : some of those may also apply to KCC 3.4 +# if __KCC_VERSION < 4000 +# define _STLP_VENDOR_GLOBAL_EXCEPT_STD 1 + +# endif + +# if defined (__sgi) +// this requires some discrimination on whether we are actually on +// a system officially supported by KAI. +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +# include +# endif + diff --git a/sdk/tlibstdcxx/stlport/stl/config/_linux.h b/sdk/tlibstdcxx/stlport/stl/config/_linux.h new file mode 100644 index 0000000000..f6d845ceeb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_linux.h @@ -0,0 +1,126 @@ +#ifndef __stl_config__linux_h +#define __stl_config__linux_h + +#define _STLP_PLATFORM "Linux" + +#include "features.h" + +/* This is defined wether library in use is glibc or not. + This may be treated as presence of GNU libc compatible + header files (these define is not really intended to check + for the presence of a particular library, but rather is used + to define an INTERFACE.) */ +#ifndef _STLP_SGX_CONFIG +#ifndef _STLP_USE_GLIBC +# define _STLP_USE_GLIBC 1 +#endif + +#ifndef _STLP_USE_STDIO_IO +# define _STLP_USE_UNIX_IO +#endif +#endif + +/* #define _STLP_USE_STDIO_IO */ + +/* If not explicitly specified otherwise, work with threads + */ +#if !defined(_STLP_NO_THREADS) && !defined(_REENTRANT) +# define _REENTRANT +#endif + +#if defined(_REENTRANT) && !defined(_PTHREADS) +# define _PTHREADS +#endif + +#ifdef __UCLIBC__ /* uClibc 0.9.27 */ +# define _STLP_USE_UCLIBC 1 +# if !defined(__UCLIBC_HAS_WCHAR__) +# ifndef _STLP_NO_WCHAR_T +# define _STLP_NO_WCHAR_T +# endif +# ifndef _STLP_NO_NATIVE_MBSTATE_T +# define _STLP_NO_NATIVE_MBSTATE_T +# endif +# ifndef _STLP_NO_NATIVE_WIDE_STREAMS +# define _STLP_NO_NATIVE_WIDE_STREAMS +# endif +# endif /* __UCLIBC_HAS_WCHAR__ */ + /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */ +# define _STLP_VENDOR_GLOBAL_CSTD 1 +#endif + + +#if defined(_PTHREADS) +# define _STLP_THREADS +# define _STLP_PTHREADS +/* +# ifndef __USE_UNIX98 +# define __USE_UNIX98 +# endif +*/ +/* This feature exist at least since glibc 2.2.4 */ +/* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */ +# ifdef __USE_XOPEN2K +/* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */ +# ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */ +# define _STLP_USE_PTHREAD_SPINLOCK +# else +# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK + /* in uClibc (0.9.26) pthread_spinlock* declared in headers + * but absent in library */ +# define _STLP_DONT_USE_PTHREAD_SPINLOCK +# endif +# endif +# ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK +# define _STLP_USE_PTHREAD_SPINLOCK +# define _STLP_STATIC_MUTEX _STLP_mutex +# endif +/* # define __FIT_PSHARED_MUTEX */ +# endif +#endif + +/* Endiannes */ +#include +#if !defined(_BYTE_ORDER) || !defined(_LITTLE_ENDIAN) || !defined(_BIG_ENDIAN) +# error "One of _BYTE_ORDER, _LITTLE_ENDIAN and _BIG_ENDIAN undefined; Fix me!" +#endif + +#if ( _BYTE_ORDER == _LITTLE_ENDIAN ) +# define _STLP_LITTLE_ENDIAN 1 +#elif ( _BYTE_ORDER == _BIG_ENDIAN ) +# define _STLP_BIG_ENDIAN 1 +#else +# error "_BYTE_ORDER neither _BIG_ENDIAN nor _LITTLE_ENDIAN; Fix me!" +#endif + +#if defined(__GNUC__) && (__GNUC__ < 3) +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 +#endif + +#ifdef __GLIBC__ +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__GLIBC__ > 2) +/* From glibc 2.3.x default allocator is malloc_alloc, if was not defined other */ +# if !defined(_STLP_USE_MALLOC) && !defined(_STLP_USE_NEWALLOC) && !defined(_STLP_USE_PERTHREAD_ALLOC) && !defined(_STLP_USE_NODE_ALLOC) +# define _STLP_USE_MALLOC 1 +# endif +# endif +/* Following platforms has no long double: + * - Alpha + * - PowerPC + * - SPARC, 32-bits (64-bits platform has long double) + * - MIPS, 32-bits + * - ARM + * - SH4 + */ +# if defined(__alpha__) || \ + defined(__ppc__) || defined(PPC) || defined(__powerpc__) || \ + ((defined(__sparc) || defined(__sparcv9) || defined(__sparcv8plus)) && !defined ( __WORD64 ) && !defined(__arch64__)) /* ? */ || \ + (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32)) || \ + defined(__arm__) || \ + defined(__sh__) + /* # if defined(__NO_LONG_DOUBLE_MATH) */ +# define _STLP_NO_LONG_DOUBLE +# endif +#endif + +#endif /* __stl_config__linux_h */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/_mac.h b/sdk/tlibstdcxx/stlport/stl/config/_mac.h new file mode 100644 index 0000000000..575c183816 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_mac.h @@ -0,0 +1,6 @@ +#define _STLP_PLATFORM "Mac" + +#define _STLP_MAC 1 + +#error Looks like unsupported platform +#define _STLP_USE_UNIX_EMULATION_IO diff --git a/sdk/tlibstdcxx/stlport/stl/config/_macosx.h b/sdk/tlibstdcxx/stlport/stl/config/_macosx.h new file mode 100644 index 0000000000..54a922267e --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_macosx.h @@ -0,0 +1,9 @@ +#define _STLP_PLATFORM "Mac OS X" + +#if defined (__BIG_ENDIAN__) +# define _STLP_BIG_ENDIAN 1 +#elif defined (__LITTLE_ENDIAN__) +# define _STLP_LITTLE_ENDIAN 1 +#endif + +#define _STLP_USE_UNIX_IO diff --git a/sdk/tlibstdcxx/stlport/stl/config/_mlc.h b/sdk/tlibstdcxx/stlport/stl/config/_mlc.h new file mode 100644 index 0000000000..8687d0bf8b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_mlc.h @@ -0,0 +1,7 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_NO_MEMBER_TEMPLATES // Compiler does not support member templates +#define _STLP_NO_MEMBER_TEMPLATE_CLASSES // Compiler does not support member template classes + +#define _STLP_HAS_NEW_NEW_HEADER diff --git a/sdk/tlibstdcxx/stlport/stl/config/_msvc.h b/sdk/tlibstdcxx/stlport/stl/config/_msvc.h new file mode 100644 index 0000000000..cf56e4ee57 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_msvc.h @@ -0,0 +1,265 @@ +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly + * Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0, ICL + */ + +#if !defined (_STLP_COMPILER) +# define _STLP_COMPILER "Microsoft Visual Studio C++" +#endif + +#if !defined (__ICL) && !defined (_STLP_MSVC) +# define _STLP_MSVC _MSC_VER +#endif + +#if !defined (_STLP_MSVC_LIB) +# define _STLP_MSVC_LIB _MSC_VER +#endif + +#if defined (__BUILDING_STLPORT) && defined (_MANAGED) +/* Building a managed version of STLport is not supported because we haven't + * found a good reason to support it. However, building a managed translation + * unit using STLport _is_ supported. + */ +# error Sorry but building a managed version of STLport is not supported. +#endif + +#if defined (_STLP_USING_PLATFORM_SDK_COMPILER) +/* This is a specific section for compilers coming with platform SDKs. Native + * library coming with it is different from the one coming with commercial + * MSVC compilers so there is some specific settings. + */ +# define _STLP_NATIVE_INCLUDE_PATH ../crt +# define _STLP_VENDOR_GLOBAL_CSTD +# define _STLP_VENDOR_TERMINATE_STD +# define _STLP_GLOBAL_NEW_HANDLER +# if (_STLP_MSVC_LIB <= 1400) +/* We hope this bug will be fixed in future versions. */ +# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 +# endif +#endif + +#define _STLP_CALL __cdecl + +#ifndef _STLP_LONG_LONG +# define _STLP_LONG_LONG __int64 +#endif + +#define _STLP_PRAGMA_ONCE + +/* These switches depend on compiler flags. We are hoping here that compilers + * simulating MSVC behavior use identical macros to report compilation context. + * Otherwise those macros will have to be undef in specific compiler configuration + * files. + */ +#ifndef _CPPUNWIND +# define _STLP_DONT_USE_EXCEPTIONS 1 +#endif + +#ifndef _CPPRTTI +# define _STLP_NO_RTTI 1 +#endif + +#if defined (_MT) && !defined (_STLP_NO_THREADS) +# define _STLP_THREADS 1 +#endif + +#if defined (_STLP_SGX_CONFIG) || !defined (_NATIVE_WCHAR_T_DEFINED) +# define _STLP_WCHAR_T_IS_USHORT 1 +#endif + +#define _STLP_NO_VENDOR_STDLIB_L 1 + +#if defined (_STLP_MSVC) + +# if (_STLP_MSVC < 1200) +# error Microsoft Visual C++ compilers before version 6 (SP5) are not supported. +# endif + +# define _STLP_NORETURN_FUNCTION __declspec(noreturn) + +/* Full compiler version comes from boost library intrinsics.hpp header. */ +# if defined (_MSC_FULL_VER) && (_MSC_FULL_VER >= 140050215) +# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) +# define _STLP_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T) +# define _STLP_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T) +# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# define _STLP_IS_POD(T) __is_pod(T) +# define _STLP_HAS_TYPE_TRAITS_INTRINSICS +# endif + +# ifndef _STLP_MSVC50_COMPATIBILITY +# define _STLP_MSVC50_COMPATIBILITY 1 +# endif + +# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 +# define _STLP_HAS_SPECIFIC_PROLOG_EPILOG 1 +# define _STLP_NO_STATIC_CONST_DEFINITION 1 + +/* # ifndef __BUILDING_STLPORT + * # define _STLP_USE_TEMPLATE_EXPORT 1 + * # endif + */ + +/** Note: the macro _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT is defined +unconditionally and undef'ed here when applicable. */ +# if defined (UNDER_CE) +/* eVCx: +uncaught_exception is declared in the SDKs delivered with eVC4 (eVC3 is +unknown) and they all reside in namespace 'std' there. However, they are not +part of any lib so linking fails. When using VC8 to crosscompile for CE 5 on +an ARMV4I, the uncaught_exception test fails, the function returns the wrong +value. */ +/* All eVCs up to at least VC8/CE5 have a broken new operator that + returns null instead of throwing bad_alloc. */ +# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 +# else +/* VCx: +These are present at least since VC6, but the uncaught_exception() of VC6 is +broken, it returns the wrong value in the unittests. 7.1 and later seem to +work, 7.0 is still unknown (we assume it works until negative report). */ +# if (_STLP_MSVC >= 1300)// VC7 and later +# undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT +# endif +# if (_STLP_MSVC < 1300) +# define _STLP_NOTHROW +# endif +# endif + +# if (_STLP_MSVC <= 1300) +# define _STLP_STATIC_CONST_INIT_BUG 1 +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 +/* There is no partial spec, and MSVC breaks on simulating it for iterator_traits queries */ +# define _STLP_USE_OLD_HP_ITERATOR_QUERIES +# define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER +# define _STLP_NO_METHOD_SPECIALIZATION 1 +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1 +/* VC++ cannot handle default allocator argument in template constructors */ +# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS +# define _STLP_NO_QUALIFIED_FRIENDS 1 +# endif + +# if (_STLP_MSVC < 1300) /* including MSVC 6.0 */ +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 +# endif + +# define _STLP_HAS_NATIVE_FLOAT_ABS 1 + +// TODO: some eVC4 compilers report _MSC_VER 1201 or 1202, which category do they belong to? +# if (_STLP_MSVC > 1200) && (_STLP_MSVC < 1310) +# define _STLP_NO_MOVE_SEMANTIC +# endif + +# if (_STLP_MSVC < 1300) +/* TODO: remove this if it is handled and documented elsewhere + * dums: VC6 do not handle correctly member templates of class that are explicitely + * instanciated to be exported. There is a workaround, seperate the non template methods + * from the template ones within 2 different classes and only export the non template one. + * It is implemented for basic_string and locale at the writing of this note. + * However this problem hos not been considered as important enough to remove template member + * methods for other classes. Moreover Boost (www.boost.org) required it to be granted. + * The workaround is activated thanks to the _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND macro defined + * later in this config file. + */ +/* +# if defined (_DLL) +# define _STLP_NO_MEMBER_TEMPLATES 1 +# endif +*/ + +/* Boris : not defining this macro for SP5 causes other problems */ +/*# if !defined (_MSC_FULL_VER) || (_MSC_FULL_VER < 12008804 ) */ +# define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1 +/*# endif */ +# define _STLP_DONT_USE_BOOL_TYPEDEF 1 +# define _STLP_DONT_RETURN_VOID 1 +# endif + +# if (_STLP_MSVC < 1300) /* MSVC 6.0 and earlier */ +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 +/* defined for DEBUG and NDEBUG too, to allow user mix own debug build with STLP release library */ +# define _STLP_USE_ABBREVS +# endif + +#endif /* _STLP_MSVC */ + +/* The desktop variants starting with VC8 have a set of more secure replacements + * for the error-prone string handling functions of the C standard lib. */ +/* When user do not consider 'unsafe' string functions as deprecated using _CRT_SECURE_NO_DEPRECATE + * macro we use 'unsafe' functions for performance reasons. */ +#if (_STLP_MSVC_LIB >= 1400) && !defined (_STLP_USING_PLATFORM_SDK_COMPILER) && !defined (UNDER_CE) && \ + !defined (_CRT_SECURE_NO_DEPRECATE) +# define _STLP_USE_SAFE_STRING_FUNCTIONS 1 +#endif + +#if (_STLP_MSVC_LIB <= 1310) +# define _STLP_VENDOR_GLOBAL_CSTD +#endif + +#if (_STLP_MSVC_LIB >= 1300) && !defined(UNDER_CE) +/* Starting with MSVC 7.0 and compilers simulating it, + * we assume that the new SDK is granted: + */ +# define _STLP_NEW_PLATFORM_SDK 1 +#endif + +#if (_STLP_MSVC_LIB < 1300) /* including MSVC 6.0 */ +# define _STLP_GLOBAL_NEW_HANDLER 1 +# define _STLP_VENDOR_UNEXPECTED_STD +# define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 +#endif + +#define _STLP_EXPORT_DECLSPEC __declspec(dllexport) +#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) +#define _STLP_CLASS_EXPORT_DECLSPEC __declspec(dllexport) +#define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport) + +#if defined (__DLL) || defined (_DLL) || defined (_RTLDLL) || defined (_AFXDLL) +# define _STLP_RUNTIME_DLL +#endif +#if defined (__BUILDING_STLPORT) && \ + (defined (_STLP_USE_DYNAMIC_LIB) || \ + defined (_STLP_RUNTIME_DLL) && !defined (_STLP_USE_STATIC_LIB)) +# define _STLP_DLL +#endif +#include +#undef _STLP_RUNTIME_DLL +#undef _STLP_DLL + +#if defined (_STLP_USE_DYNAMIC_LIB) +# undef _STLP_USE_DECLSPEC +# define _STLP_USE_DECLSPEC 1 +# if defined (_STLP_MSVC) && (_STLP_MSVC < 1300) +# define _STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND 1 +# endif +#endif + +#if !defined (_STLP_IMPORT_TEMPLATE_KEYWORD) +# if !defined (_MSC_EXTENSIONS) || defined (_STLP_MSVC) && (_STLP_MSVC >= 1300) +# define _STLP_IMPORT_TEMPLATE_KEYWORD +# else +# define _STLP_IMPORT_TEMPLATE_KEYWORD extern +# endif +#endif +#define _STLP_EXPORT_TEMPLATE_KEYWORD + +#include + +#if defined (_STLP_USING_PLATFORM_SDK_COMPILER) +/* The Windows 64 bits SDK required for the moment link to bufferoverflowU.lib for + * additional buffer overrun checks. Rather than require the STLport build system and + * users to explicitely link with it we use the MSVC auto link feature. + */ +# if !defined (_STLP_DONT_USE_AUTO_LINK) || defined (__BUILDING_STLPORT) +# pragma comment (lib, "bufferoverflowU.lib") +# if defined (_STLP_VERBOSE) +# pragma message ("STLport: Auto linking to bufferoverflowU.lib") +# endif +# endif +#endif + +#if defined (_STLP_MSVC) +# include +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_mwerks.h b/sdk/tlibstdcxx/stlport/stl/config/_mwerks.h new file mode 100644 index 0000000000..f91f3b181b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_mwerks.h @@ -0,0 +1,159 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_COMPILER "Metrowerk Codewarrior" + +// Bring in definition of __MSL__ and related items +#include +#include + +// +// Compiler features +// + + +// *** CodeWarrior Compiler Common Features *** +# if __option(longlong) +# define _STLP_LONG_LONG long long +# endif + +# define _STLP_USE_UNIX_EMULATION_IO 1 + +# define _STLP_USE_AUTO_PTR_CONVERSIONS 1 + +# ifdef __INTEL__ +# define _STLP_LITTLE_ENDIAN +# else +# define _STLP_BIG_ENDIAN +# endif + +#if defined(_MSL_NO_LOCALE) +#define _STLP_NO_IMPORT_LOCALE +#endif +#if !__option( wchar_type ) +# define _STLP_WCHAR_T_IS_USHORT +#endif + +# if __MWERKS__ < 0x3000 +// *** CodeWarrior Compiler Common Bugs *** +# define __MSL_FIX_ITERATORS__(myType) // Some MSL headers rely on this +# define _STLP_THROW_RETURN_BUG 1 +# endif + +// *** Version-specific settings *** + +# if __MWERKS__ >= 0x2405 +# define _STLP_HAS_NATIVE_FLOAT_ABS +# endif + +# if __MWERKS__ < 0x2405 +# define _STLP_STATIC_CONST_INIT_BUG +# endif + +# if __MWERKS__ <= 0x2303 +# define _STLP_NO_TEMPLATE_CONVERSIONS 1 +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# endif + +# if __MWERKS__ < 0x2301 +# define _STLP_MEMBER_SPECIALIZATION_BUG 1 +# endif + +# if __MWERKS__ < 0x2300 // CW Pro5 features +# define _STLP_INLINE_MEMBER_TEMPLATES 1 +# define _STLP_RELOPS_IN_STD_BUG 1 +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 +# define _STLP_NO_TYPENAME_ON_RETURN_TYPE +# endif + +# if __MWERKS__ < 0x2200 // CW Pro4 features +# define _STLP_BROKEN_USING_DIRECTIVE 1 +# define _STLP_NO_MEMBER_TEMPLATES 1 +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# define _STLP_NO_QUALIFIED_FRIENDS 1 +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 +# endif + +# if __MWERKS__ < 0x2100 // CW Pro3 features +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# define _STLP_HAS_NO_NAMESPACES 1 +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 + +# define _STLP_NEED_TYPENAME 1 +# define _STLP_NO_ARROW_OPERATOR 1 +# define _STLP_TEMPLATE_PARAM_SUBTYPE_BUG 1 +# define _STLP_FORCED_INLINE_INSTANTIATION_BUG 1 +# define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG 1 +# define _STLP_INLINE_NAME_RESOLUTION_BUG 1 +// *** Metrowerks Standard Library Bug *** +# define _STLP_MSVC50_COMPATIBILITY 1 +# endif + +# if __MWERKS__ < 0x2000 // v. 2.0 features +# define _STLP_NO_WCHAR_T 1 +# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 +# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 // dwa 8/21/97 - this bug fixed for CWPro2 +# endif + +# if __MWERKS__ < 0x1900 // dwa 8/19/97 - 1.9 Compiler feature defines +# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 +# define _STLP_BASE_TYPEDEF_BUG 1 +# define _STLP_BASE_MATCH_BUG 1 +# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 +# define _STLP_DEFAULT_TYPE_PARAM 1 // More limited template parameters + +# if __MWERKS__ < 0x1800 + __GIVE_UP_WITH_STL(CW_18) +# endif + +# endif + + +// fixes to native inclusion wrappers. +# if __MWERKS__ >= 0x2300 // CWPro5 changes paths - dwa 2/28/99 +# define _STLP_NATIVE_INCLUDE_PATH ../include +# define _STLP_NATIVE_C_INCLUDE_PATH ../include +# define _STLP_NATIVE_HEADER(header) <../include/##header> +# define _STLP_NATIVE_CPP_C_HEADER(header) <../include/##header> +# define _STLP_NATIVE_C_HEADER(header) <../include/##header> +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) <../include/##header> +# else + +# define _STLP_NATIVE_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C++:Include +# define _STLP_NATIVE_C_INCLUDE_PATH Macintosh HD:Codewarrior Pro 4:Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:MSL Common:Public Includes +# define _STLP_NATIVE_HEADER(header) +# define _STLP_NATIVE_CPP_C_HEADER(header) +# define _STLP_NATIVE_C_HEADER(header) +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) + +# endif + +//Following block come from boost intrinsics.hpp file: +#if defined (__MSL_CPP__) && (__MSL_CPP__ >= 0x8000) + // Metrowerks compiler is acquiring intrinsic type traits support + // post version 8. We hook into the published interface to pick up + // user defined specializations as well as compiler intrinsics as + // and when they become available: +# include +# define _STLP_HAS_TRIVIAL_CONSTRUCTOR(T) Metrowerks::has_trivial_default_ctor::value +# define _STLP_HAS_TRIVIAL_COPY(T) Metrowerks::has_trivial_copy_ctor::value +# define _STLP_HAS_TRIVIAL_ASSIGN(T) Metrowerks::has_trivial_assignment::value +# define _STLP_HAS_TRIVIAL_DESTRUCTOR(T) Metrowerks::has_trivial_dtor::value +# define _STLP_IS_POD(T) Metrowerks::is_POD::value +# define _STLP_HAS_TYPE_TRAITS_INTRINSICS +#endif + +// fbp +# if !defined( __MSL_CPP__ ) || __MSL_CPP__ <= 0x4105 +# define _STLP_NO_NATIVE_WIDE_STREAMS 1 +# endif + +# if defined(__MACH__) +# define _STLP_MAC +# define O_BINARY 0 +# elif defined(macintosh) +# define _NOTHREADS +# endif +# define _STLP_DLLEXPORT_NEEDS_PREDECLARATION 1 diff --git a/sdk/tlibstdcxx/stlport/stl/config/_native_headers.h b/sdk/tlibstdcxx/stlport/stl/config/_native_headers.h new file mode 100644 index 0000000000..f1f4bc9324 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_native_headers.h @@ -0,0 +1,50 @@ + /* + * + * Copyright (c) 2006 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_MAKE_HEADER) +# define _STLP_MAKE_HEADER(path, header) +#endif + +#if !defined (_STLP_NATIVE_HEADER) +# if !defined (_STLP_NATIVE_INCLUDE_PATH) +# define _STLP_NATIVE_INCLUDE_PATH ../include +# endif +# define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header) +#endif + +/* For some compilers, C headers like are located in separate directory */ +#if !defined (_STLP_NATIVE_C_HEADER) +# if !defined (_STLP_NATIVE_C_INCLUDE_PATH) +# define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH +# endif +# define _STLP_NATIVE_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_C_INCLUDE_PATH,header) +#endif + +/* For some compilers, C-library headers like are located in separate directory */ +#if !defined (_STLP_NATIVE_CPP_C_HEADER) +# if !defined (_STLP_NATIVE_CPP_C_INCLUDE_PATH) +# define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH +# endif +# define _STLP_NATIVE_CPP_C_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_C_INCLUDE_PATH,header) +#endif + +/* Some compilers locate basic C++ runtime support headers (, , ) in separate directory */ +#if !defined ( _STLP_NATIVE_CPP_RUNTIME_HEADER ) +# if !defined (_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH) +# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH +# endif +# define _STLP_NATIVE_CPP_RUNTIME_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH,header) +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_openbsd.h b/sdk/tlibstdcxx/stlport/stl/config/_openbsd.h new file mode 100644 index 0000000000..86a19d1f3b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_openbsd.h @@ -0,0 +1,12 @@ +#define _STLP_PLATFORM "Open BSD" + +#define _STLP_USE_UNIX_IO + +#if defined (_POSIX_THREADS) && !defined (_STLP_THREADS) +# define _STLP_THREADS +#endif + +#if defined (_POSIX_THREADS) && !defined (_STLP_DONT_USE_PTHREAD_SPINLOCK) +# define _STLP_USE_PTHREAD_SPINLOCK +# define _STLP_STATIC_MUTEX _STLP_mutex +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_prolog.h b/sdk/tlibstdcxx/stlport/stl/config/_prolog.h new file mode 100644 index 0000000000..a16a794695 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_prolog.h @@ -0,0 +1,43 @@ + +#if defined (_STLP_MSVC) || defined (__ICL) + +# pragma warning (push) +# include +/* We are forcing the alignment to guaranty that libraries are use + * with the same alignment as the one use to build them. + */ +# if !defined (_WIN64) +# pragma pack(push, 8) +# else +# pragma pack(push, 16) +# endif + +#elif defined (__BORLANDC__) + +# pragma option push +# pragma option -Vx- -Ve- -a8 -b -pc +# include + +#elif defined (__sgi) && !defined (__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) + +# pragma set woff 1209 +# pragma set woff 1174 +# pragma set woff 1375 +/* from iterator_base.h */ +# pragma set woff 1183 + +#elif defined (__DECCXX) + +# ifdef __PRAGMA_ENVIRONMENT +# pragma __environment __save +# pragma __environment __header_defaults +# endif + +#elif defined (__IBMCPP__) +/* supress EDC3130: A constant is being used as a conditional expression */ +# pragma info(nocnd) +#elif defined (__WATCOMCPLUSPLUS__) +# pragma warning 604 10 /* must lookahead to determine... */ +# pragma warning 594 10 /* resolved as declaration/type */ +# pragma warning 595 10 /* resolved as an expression */ +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_sgi.h b/sdk/tlibstdcxx/stlport/stl/config/_sgi.h new file mode 100644 index 0000000000..7500f3d87b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_sgi.h @@ -0,0 +1,94 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_COMPILER "CC" + +#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG + +// define native include path before trying to include anything + +#define _STLP_NATIVE_HEADER(__x) +#define _STLP_NATIVE_C_HEADER(__x) +#define _STLP_NATIVE_OLD_STREAMS_HEADER(__x) +#define _STLP_NATIVE_CPP_C_HEADER(__x) +#define _STLP_NATIVE_CPP_RUNTIME_HEADER(__x) + +#define _STLP_NO_NATIVE_MBSTATE_T + +#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS +#define _STLP_NO_NATIVE_WIDE_FUNCTIONS +#define _STLP_NO_MEMBER_TEMPLATE_CLASSES + +// #define _STLP_NO_BAD_ALLOC + +#define _STL_HAS_NAMESPACES + +#if ! defined (__EXCEPTIONS) && ! defined (_STLP_NO_EXCEPTIONS) +# define _STLP_NO_EXCEPTIONS +#endif + +#define __EDG_SWITCHES + +#define _STLP_USE_SGI_STRING 1 + +#define _STLP_HAS_NO_NEW_C_HEADERS 1 +// # define _STLP_VENDOR_GLOBAL_EXCEPT_STD + +#define _STLP_NO_POST_COMPATIBLE_SECTION + +#include + +#if !(_COMPILER_VERSION >= 730) +# define _STLP_NO_NEW_NEW_HEADER 1 +#endif + +#if (_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) +# define _STLP_EXTERN_RANGE_ERRORS +#endif + +#if !defined(_BOOL) +# define _STLP_NO_BOOL +#endif +#if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32 +# define _STLP_STATIC_CONST_INIT_BUG +#endif + +#if (_COMPILER_VERSION < 720) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) +# define _STLP_DEF_CONST_PLCT_NEW_BUG +# define _STLP_DEF_CONST_DEF_PARAM_BUG +#endif +#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32) +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD +#endif +#if !defined(_STANDARD_C_PLUS_PLUS) +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS +#endif +#if !((_COMPILER_VERSION >= 721) && defined(_NAMESPACES)) +# define _STLP_HAS_NO_NAMESPACES +#endif +#if (_COMPILER_VERSION < 721) || !defined(_STL_HAS_NAMESPACES) || defined(_STLP_NO_NAMESPACES) +# define _STLP_NO_EXCEPTION_HEADER +#endif +#if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || !defined(_NAMESPACES) +# define _STLP_NO_BAD_ALLOC +#endif +#if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI +# define _STLP_LONG_LONG long long +#endif +#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) +# define _STLP_USE_NO_IOSTREAMS +#endif +#if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) +# define _STLP_NO_AT_MEMBER_FUNCTION +#endif +// # if !(_COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)) +#if !(_COMPILER_VERSION >= 721 && defined(_STANDARD_C_PLUS_PLUS)) +# define _STLP_NO_TEMPLATE_CONVERSIONS +#endif +#if !((_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32) +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER +#endif + +#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) && !defined (__GNUC__) +# define _STLP_SGI_THREADS +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_sgx.h b/sdk/tlibstdcxx/stlport/stl/config/_sgx.h new file mode 100644 index 0000000000..7d58a804b2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_sgx.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* STLport configuration file + * It is internal STLport header - DO NOT include it directly */ + +#define _STLP_SGX_CONFIG 1 + +/* Use new C headers in STLport instead */ +#define _STLP_HAS_NO_NEW_C_HEADERS 1 + +//#define _STLP_USE_NATIVE_STDEXCEPT 1 +//#define _STLP_NO_EXCEPTION_HEADER 1 + +/* Disable wcstombs, wctomb */ +#define _STLP_NO_NATIVE_WIDE_STREAMS 1 + +/* Use separated C/C++ Runtime directories */ +#define _STLP_NATIVE_C_INCLUDE_PATH tlibc +#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH stdc++ + +/* No I/O operations that involve OCalls allowed */ +#define _STLP_NO_IOSTREAMS 1 + +/* Do not use secure routines in CRT */ +#define _CRT_SECURE_NO_DEPRECATE 1 + +/* Do not support move semantic (C++11) */ +#define _STLP_NO_MOVE_SEMANTIC 1 diff --git a/sdk/tlibstdcxx/stlport/stl/config/_solaris.h b/sdk/tlibstdcxx/stlport/stl/config/_solaris.h new file mode 100644 index 0000000000..8756a060f7 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_solaris.h @@ -0,0 +1,77 @@ +#ifndef __stl_config__solaris_h +#define __stl_config__solaris_h + +#define _STLP_PLATFORM "Sun Solaris" + +/* include system features file */ +#include + +/* system-dependent defines */ +#define _STLP_USE_UNIX_IO + +#ifdef __GNUC__ +/* + * See comments (and configuration defines) in the host.h + */ +# if !(defined(__SunOS_5_5_1) || defined(__SunOS_5_6) || defined(__SunOS_5_7) || \ + defined(__SunOS_5_8) || defined(__SunOS_5_9) || defined(__SunOS_5_10)) +# error Uncomment one of the defines (__SunOS_5_x) in the file stlport/stl/config/host.h +# endif +#endif + +#if defined (__SunOS_5_8) && ! defined (_STLP_HAS_NO_NEW_C_HEADERS) && ( __cplusplus >= 199711L) +# define _STLP_HAS_NATIVE_FLOAT_ABS +#endif + +#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) +# define _STLP_RAND48 1 +#endif + +#if (defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 == 4)) || defined (__SunOS_5_6) +# define _STLP_WCHAR_SUNPRO_EXCLUDE 1 +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 +#endif + +/* boris : this should always be defined for Solaris 5 & 6. Any ideas how to do it? */ +#if !(defined ( __KCC ) && __KCC_VERSION > 3400 ) && \ + ((defined(__SunOS_5_5_1) || defined(__SunOS_5_6) )) +# ifndef _STLP_NO_NATIVE_MBSTATE_T +# define _STLP_NO_NATIVE_MBSTATE_T 1 +# endif +#endif /* KCC */ + +/* For SPARC we use lightweight synchronization */ +#if defined (__sparc) /* && (defined (_REENTRANT) || defined (_PTHREADS)) */ +# if ( (defined (__GNUC__) && defined (__sparc_v9__)) || \ + defined (__sparcv9) ) \ + && !defined(_NOTHREADS) && !defined (_STLP_NO_SPARC_SOLARIS_THREADS) +# define _STLP_SPARC_SOLARIS_THREADS +# define _STLP_THREADS_DEFINED +# endif +#endif + +/* gcc does not support ELF64 yet ; however; it supports ultrasparc + v8plus. + * limits.h contains invalid values for this combination + */ +#ifdef __GNUC__ +# if (defined (__sparc_v9__) || defined (__sparcv9)) && !defined ( __WORD64 ) && !defined(__arch64__) +# define __LONG_MAX__ 2147483647L +# endif +#endif + +/* + * Attention! See comments (and configuration defines) in the host.h + * (you host may has MATH_F and MATH_L functions) + * + */ +#if !defined(__SunOS_5_10) && !defined(_STLP_SOLARIS_MATH_PATCH) +# define _STLP_NO_VENDOR_MATH_F +# define _STLP_NO_VENDOR_MATH_L +#endif + +#ifdef __GNUC__ +# define _STLP_WCHAR_BORLAND_EXCLUDE +# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1 +#endif + +#endif /* __stl_config__solaris_h */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/_sunprocc.h b/sdk/tlibstdcxx/stlport/stl/config/_sunprocc.h new file mode 100644 index 0000000000..15fe5cd11b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_sunprocc.h @@ -0,0 +1,166 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_COMPILER "Sunpro CC" + +#define _STLP_LONG_LONG long long + +// GAB: 11/09/05 +// Starting with 5.0 the STLport code expects to be +// instantiated during compile time. This is due to undefing +// a number of defines that are also used in the c versions +// of the file. When they are undefed the c version fails to +// compile. +// # define _STLP_LINK_TIME_INSTANTIATION 1 + +#if ! defined(_BOOL) +# define _STLP_NO_BOOL 1 +#endif + +// compatibility mode stuff +#if (__SUNPRO_CC >= 0x510) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 )) +# define _STLP_NATIVE_INCLUDE_PATH ../CC/Cstd +# define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH ../CC +#elif (__SUNPRO_CC >= 0x500) && (!defined (__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT == 5 )) +# define _STLP_NATIVE_INCLUDE_PATH ../CC +#elif (defined (__SUNPRO_CC_COMPAT) && __SUNPRO_CC_COMPAT == 4) +# define _STLP_NATIVE_INCLUDE_PATH ../CC4 +#else +# define _STLP_NATIVE_INCLUDE_PATH ../CC +#endif + +#define _STLP_STATIC_CONST_INIT_BUG 1 + +#if (__SUNPRO_CC < 0x530) +// those are tested and proved not to work... +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# define _STLP_USE_OLD_HP_ITERATOR_QUERIES +#endif + +#ifdef _STLP_USE_NO_IOSTREAMS +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +#endif + +// those do not depend on compatibility +#if (__SUNPRO_CC < 0x510) +# define _STLP_NO_TYPENAME_ON_RETURN_TYPE 1 +# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 +#endif + +#if (__SUNPRO_CC < 0x510) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5)) + +# define _STLP_NO_QUALIFIED_FRIENDS 1 + +// no partial , just for explicit one +# define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS +# define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 + +# define _STLP_NO_MEMBER_TEMPLATES 1 + +# define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 +# define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +#endif + +// Features that depend on compatibility switch +#if ( __SUNPRO_CC < 0x500 ) || (defined (__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT < 5)) + +# ifndef _STLP_USE_NO_IOSTREAMS +# define _STLP_USE_NO_IOSTREAMS 1 +# endif +# define _STLP_NO_NEW_NEW_HEADER 1 +// # define _STLP_NO_RELOPS_NAMESPACE +# define _STLP_HAS_NO_NAMESPACES 1 +# define _STLP_NEED_MUTABLE 1 +# define _STLP_NO_BAD_ALLOC 1 +# define _STLP_NO_EXCEPTION_HEADER 1 +# define _STLP_NATIVE_C_INCLUDE_PATH ../include +#elif (__SUNPRO_CC < 0x510) +// # define _STLP_NATIVE_C_HEADER(header) <../CC/##header##.SUNWCCh> +# define _STLP_NATIVE_CPP_C_HEADER(header) <../CC/##header##.SUNWCCh> +# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include +#elif defined( __SunOS_5_5_1 ) || defined( __SunOS_5_6 ) || defined( __SunOS_5_7 ) +# define _STLP_NATIVE_C_INCLUDE_PATH ../CC/std +# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std +#else +# define _STLP_NATIVE_C_INCLUDE_PATH /usr/include +# define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../CC/std +#endif + +#if ( __SUNPRO_CC < 0x500 ) + +# undef _STLP_NATIVE_C_HEADER +# undef _STLP_NATIVE_CPP_C_HEADER + +# define wint_t __wint_t +// famous CC 4.2 bug +# define _STLP_INLINE_STRING_LITERAL_BUG 1 +// /usr/include +# define _STLP_NATIVE_C_INCLUDE_PATH ../include + +// 4.2 cannot handle iterator_traits<_Tp>::iterator_category as a return type ;( +# define _STLP_USE_OLD_HP_ITERATOR_QUERIES + +// 4.2 does not like it +# undef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS + +# define _STLP_LIMITED_DEFAULT_TEMPLATES 1 + +# define _STLP_NEED_TYPENAME 1 +# define _STLP_NEED_EXPLICIT 1 +# define _STLP_NO_BAD_ALLOC 1 +# define _STLP_NO_ARROW_OPERATOR 1 + +# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 +# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 1 +# undef _STLP_HAS_NO_NEW_C_HEADERS +# define _STLP_HAS_NO_NEW_C_HEADERS 1 +// # define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS + +# if ( __SUNPRO_CC < 0x420 ) +# define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 +# define _STLP_NO_NEW_STYLE_CASTS 1 +# define _STLP_NO_METHOD_SPECIALIZATION 1 +# if ( __SUNPRO_CC > 0x401 ) +# if (__SUNPRO_CC==0x410) +# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 +# endif +# else + // SUNPro C++ 4.0.1 +# define _STLP_BASE_MATCH_BUG 1 +# define _STLP_BASE_TYPEDEF_BUG 1 +# if (( __SUNPRO_CC < 0x401 ) && !defined(__SUNPRO_C)) + __GIVE_UP_WITH_STL(SUNPRO_401) +# endif +# endif /* 4.0.1 */ +# endif /* 4.2 */ +#endif /* < 5.0 */ + +#ifndef _MBSTATET_H +# define _MBSTATET_H +# undef _MBSTATE_T +# define _MBSTATE_T +typedef struct __mbstate_t { +# if defined(_LP64) + long __filler[4]; +# else + int __filler[6]; +# endif +} __mbstate_t; +# ifndef _STLP_HAS_NO_NAMESPACES +namespace std { + typedef __mbstate_t mbstate_t; +} +using std::mbstate_t; +# else +typedef __mbstate_t mbstate_t; +# endif +#endif /* __MBSTATET_H */ + +#if !defined(_STLP_HAS_NO_NEW_C_HEADERS) && !defined(_STLP_NO_NEW_C_HEADERS) +/* Since Sun Studio uses , we are at its + * mercy. GCC is built on top of . */ +#define _STLP_NO_VENDOR_STDLIB_L +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_system.h b/sdk/tlibstdcxx/stlport/stl/config/_system.h new file mode 100644 index 0000000000..a2dbb938dd --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_system.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * Purpose of this file : + * + * To hold COMPILER-SPECIFIC portion of STLport settings. + * In general, user should not edit this file unless + * using the compiler not recognized below. + * + * If your compiler is not being recognized yet, + * please look for definitions of macros in stl_mycomp.h, + * copy stl_mycomp.h to stl_YOUR_COMPILER_NAME, + * adjust flags for your compiler, and add + * to the secton controlled by unique macro defined internaly by your compiler. + * + * To change user-definable settings, please edit + * + */ + +#ifndef __stl_config__system_h +#define __stl_config__system_h + +#if defined (__sun) +# include +# if defined (__GNUC__) +# include +# elif defined (__SUNPRO_CC) || defined (__SUNPRO_C) +# include +/* +# ifdef __KCC +# include +# endif +*/ +# elif defined (__APOGEE__) /* Apogee 4.x */ +# include +# elif defined (__FCC_VERSION) /* Fujitsu Compiler, v4.0 assumed */ +# include +# endif +#elif defined (__hpux) +# include +# if defined (__GNUC__) +# include +# elif defined (__HP_aCC) +# include +# endif +#elif defined (linux) || defined (__linux__) +# include +# if defined (__BORLANDC__) +# include /* Borland C++ 0x570 */ +/* Intel's icc define __GNUC__! */ +# elif defined (__INTEL_COMPILER) +# include +# elif defined (__GNUC__) +# include +# endif +/* +# ifdef __KCC +# include +# endif +*/ +#elif defined (__FreeBSD__) +# include +# if defined (__GNUC__) +# include +# endif +#elif defined (__OpenBSD__) +# include +# if defined (__GNUC__) +# include +# endif +#elif defined (__sgi) /* IRIX? */ +# define _STLP_PLATFORM "SGI Irix" +# if defined (__GNUC__) +# include +# else +# include +# endif +#elif defined (__OS400__) /* AS/400 C++ */ +# define _STLP_PLATFORM "OS 400" +# if defined (__GNUC__) +# include +# else +# include +# endif +#elif defined (_AIX) +# include +# if defined (__xlC__) || defined (__IBMC__) || defined ( __IBMCPP__ ) + /* AIX xlC, Visual Age C++ , OS-390 C++ */ +# include +# endif +#elif defined (_CRAY) /* Cray C++ 3.4 or 3.5 */ +# define _STLP_PLATFORM "Cray" +# include +#elif defined (__DECCXX) || defined (__DECC) +# define _STLP_PLATFORM "DECC" +# ifdef __vms +# include +# else +# include +# endif +#elif defined (macintosh) || defined (_MAC) +# include +# if defined (__MWERKS__) +# include +# endif +#elif defined (__APPLE__) +# include +# ifdef __GNUC__ +# include +# endif +#elif defined (__CYGWIN__) +# include +# if defined (__GNUC__) +# include +# endif +#elif defined (__MINGW32__) +# define _STLP_PLATFORM "MinGW" +# if defined (__GNUC__) +# include +# endif +# include +#elif defined (_WIN32) || defined (__WIN32) || defined (WIN32) || defined (__WIN32__) || \ + defined (__WIN16) || defined (WIN16) || defined (_WIN16) +# if defined ( __BORLANDC__ ) /* Borland C++ / CodeGear C++ */ +# include +# elif defined (__WATCOM_CPLUSPLUS__) || defined (__WATCOMC__) /* Watcom C++ */ +# include +# elif defined (__COMO__) || defined (__COMO_VERSION_) +# include +# elif defined (__DMC__) /* Digital Mars C++ */ +# include +# elif defined (__ICL) /* Intel reference compiler for Win */ +# include +# elif defined (__MWERKS__) +# include +# elif defined (_MSC_VER) && (_MSC_VER >= 1200) && defined (UNDER_CE) + /* Microsoft eMbedded Visual C++ 3.0, 4.0 (.NET) */ +# include +# elif defined (_MSC_VER) + /* Microsoft Visual C++ 6.0, 7.0, 7.1, 8.0 */ +# include +# endif + +# include +#else +# error Unknown platform !! +#endif + +#if !defined (_STLP_COMPILER) +/* Unable to identify the compiler, issue error diagnostic. + * Edit to set STLport up for your compiler. */ +# include +#endif + +#endif /* __stl_config__system_h */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/_warnings_off.h b/sdk/tlibstdcxx/stlport/stl/config/_warnings_off.h new file mode 100644 index 0000000000..77e9815ebc --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_warnings_off.h @@ -0,0 +1,51 @@ +/* This header turns off warnings that STLport headers generate for compiled + * user code. + */ + +#if defined (_STLP_MSVC) +# if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ + defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) +/* + * 31/07/2004: dums - now that we do not export the basic_string class anymore but only a base class + * we have to disable this warning as the string are used as data members type of many iostream classes. + */ +# pragma warning ( disable : 4251 ) // ignore template classes being exported in .dll's +# endif + +# if (_STLP_MSVC < 1300) // VC6, eVC3, eVC4 +# pragma warning( disable : 4097 ) // typedef-name used as based class of (...) +# pragma warning( disable : 4231 ) // non standard extension : 'extern' before template instanciation +# pragma warning( disable : 4244 ) // implicit conversion: possible loss of data +# pragma warning( disable : 4284 ) // for -> operator +//This warning is necessary because of the native platform headers: +# pragma warning( disable : 4290 ) // c++ exception specification ignored +# pragma warning( disable : 4514 ) // unreferenced inline function has been removed +# pragma warning( disable : 4660 ) // template-class specialization '...' is already instantiated +# pragma warning( disable : 4701 ) // local variable '...' may be used without having been initialized +# pragma warning( disable : 4710 ) // function (...) not inlined +# pragma warning( disable : 4786 ) // identifier truncated to 255 characters +# endif + +# if (_STLP_MSVC < 1400) +# pragma warning( disable : 4511 ) // copy constructor cannot be generated +# endif + +//Pool of common warnings for all MSVC supported versions: +//Many are only useful if warning level is set to 4. +# pragma warning( disable : 4100 ) // unreferenced formal parameter +# pragma warning( disable : 4127 ) // conditional expression is constant +# pragma warning( disable : 4146 ) // unary minus operator applied to unsigned type, result still unsigned +# pragma warning( disable : 4245 ) // conversion from 'enum ' to 'unsigned int', signed/unsigned mismatch +# pragma warning( disable : 4355 ) // this used in base member initializer list (used in rope implementation) +# pragma warning( disable : 4510 ) // default constructor cannot be generated +# pragma warning( disable : 4512 ) // assignment operator could not be generated +# pragma warning( disable : 4571 ) // catch(...) blocks compiled with /EHs do not catch or re-throw Structured Exceptions +# pragma warning( disable : 4610 ) // struct '...' can never be instantiated - user defined construtor required +#elif defined (__BORLANDC__) +# pragma option -w-ccc // -w-8008 Condition is always true OR Condition is always false +# pragma option -w-inl // -w-8027 Functions containing reserved words are not expanded inline +# pragma option -w-ngu // -w-8041 Negating unsigned value +# pragma option -w-pow // -w-8062 Previous options and warnings not restored +# pragma option -w-rch // -w-8066 Unreachable code +# pragma option -w-par // -w-8057 Parameter 'parameter' is never used +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/_watcom.h b/sdk/tlibstdcxx/stlport/stl/config/_watcom.h new file mode 100644 index 0000000000..b0d2defee4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_watcom.h @@ -0,0 +1,151 @@ +// STLport configuration file +// It is internal STLport header - DO NOT include it directly + +#define _STLP_COMPILER "Watcom" + +#if (__WATCOMC__ < 1250) +# error Not supported! +#endif + +#ifndef _CPPRTTI +# define _STLP_NO_RTTI 1 +#endif + +// for switches (-xs, -xss, -xst) +#if !(defined (__SW_XS) || defined (__SW_XSS) || defined(__SW_XST)) +# define _STLP_HAS_NO_EXCEPTIONS 1 +#endif + +#if defined (_MT) && !defined (_NOTHREADS) +# define _STLP_THREADS 1 +#endif + +#define _STLP_NO_VENDOR_STDLIB_L +#define _STLP_NO_VENDOR_MATH_F +#define _STLP_NO_VENDOR_MATH_L + +#define _STLP_LONG_LONG long long + +#define _STLP_CALL __cdecl +#define _STLP_IMPORT_DECLSPEC __declspec(dllimport) + +#define _STLP_NO_CONST_IN_PAIR + +//#define _STLP_DONT_USE_PRIV_NAMESPACE +//#define _STLP_NO_MOVE_SEMANTIC +//#define _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER +#define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE + +#define _STLP_NO_RELOPS_NAMESPACE + +#define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS +#define _STLP_NO_STATIC_CONST_DEFINITION + +//#define _STLP_HAS_SPECIFIC_PROLOG_EPILOG +#define _STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS +//#define _STLP_USE_OLD_HP_ITERATOR_QUERIES + +#define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 +#define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +//#define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +//#define _STLP_NO_MEMBER_TEMPLATES 1 +//#define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 + +//#define _STLP_LIMITED_DEFAULT_TEMPLATES 1 +//#define _STLP_HAS_NO_NAMESPACES 1 +//#define _STLP_NEED_TYPENAME 1 + +#define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 1 + +//#define _STLP_STATIC_CONST_INIT_BUG 1 +// #define _STLP_THROW_RETURN_BUG 1 +//#define _STLP_NO_TEMPLATE_CONVERSIONS 1 + +#define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 + +#define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 +#define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 + +//#define _STLP_NONTEMPL_BASE_MATCH_BUG +//#define _STLP_NO_EXCEPTION_HEADER 1 +#define _STLP_NO_BAD_ALLOC 1 + +//#define _STLP_NO_TYPENAME_ON_RETURN_TYPE +//#define _STLP_NESTED_TYPE_PARAM_BUG 1 + +//#define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1 + +#define _STLP_NO_ARROW_OPERATOR 1 +// This one is present in 11, but apparently has bugs (with auto_ptr). +//#define _STLP_NO_NEW_STYLE_CASTS 1 + +// Get rid of Watcom's min and max macros +#undef min +#undef max + +// On QNX, headers are supposed to be found in /usr/include, +// so default "../include" should work. +#ifndef __QNX__ +# define _STLP_NATIVE_INCLUDE_PATH ../h +#else +// boris : is this true or just the header is not in /usr/include ? +# define _STLP_NO_TYPEINFO 1 +#endif + +// Inline replacements for locking calls under Watcom +// Define _STLP_NO_WATCOM_INLINE_INTERLOCK to keep using +// standard WIN32 calls +// Define _STL_MULTIPROCESSOR to enable lock +#define _STLP_NO_WATCOM_INLINE_INTERLOCK +#if !defined(_STLP_NO_WATCOM_INLINE_INTERLOCK) + +long __stl_InterlockedIncrement( long *var ); +long __stl_InterlockedDecrement( long *var ); + +#ifdef _STL_MULTIPROCESSOR +// Multiple Processors, add lock prefix +#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \ + ".586" \ + "mov eax, 1" \ + "lock xadd [ecx], eax" \ + "inc eax" \ + value [eax]; + + +#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \ + ".586" \ + "mov eax, 0FFFFFFFFh" \ + "lock xadd [ecx], eax" \ + "dec eax" \ + value [eax]; +#else +// Single Processor, lock prefix not needed +#pragma aux __stl_InterlockedIncrement parm [ ecx ] = \ + ".586" \ + "mov eax, 1" \ + "xadd [ecx], eax" \ + "inc eax" \ + value [eax]; + +#pragma aux __stl_InterlockedDecrement parm [ ecx ] = \ + ".586" \ + "mov eax, 0FFFFFFFFh" \ + "xadd [ecx], eax" \ + "dec eax" \ + value [eax]; +#endif // _STL_MULTIPROCESSOR + +long __stl_InterlockedExchange( long *Destination, long Value ); + +// xchg has auto-lock +#pragma aux __stl_InterlockedExchange parm [ecx] [eax] = \ + ".586" \ + "xchg eax, [ecx]" \ + value [eax]; + +# define _STLP_ATOMIC_INCREMENT(__x) __stl_InterlockedIncrement((long*)__x) +# define _STLP_ATOMIC_DECREMENT(__x) __stl_InterlockedDecrement((long*)__x) +# define _STLP_ATOMIC_EXCHANGE(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y) +# define _STLP_ATOMIC_EXCHANGE_PTR(__x, __y) __stl_InterlockedExchange((long*)__x, (long)__y) +#endif /* INLINE INTERLOCK */ + diff --git a/sdk/tlibstdcxx/stlport/stl/config/_windows.h b/sdk/tlibstdcxx/stlport/stl/config/_windows.h new file mode 100644 index 0000000000..c8c41adfc5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/_windows.h @@ -0,0 +1,293 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_WINDOWS_H +#define _STLP_INTERNAL_WINDOWS_H + +#if !defined (_STLP_PLATFORM) +# define _STLP_PLATFORM "Windows" +#endif + +#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN) +# if defined (_MIPSEB) +# define _STLP_BIG_ENDIAN 1 +# endif +# if defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \ + defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \ + defined (__alpha__) +# define _STLP_LITTLE_ENDIAN 1 +# endif +# if defined (__ia64__) + /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */ +# if defined (__BIG_ENDIAN__) +# define _STLP_BIG_ENDIAN 1 +# else +# define _STLP_LITTLE_ENDIAN 1 +# endif +# endif +#endif /* _STLP_BIG_ENDIAN */ + +#if !defined (_STLP_SGX_CONFIG) +#if !defined (_STLP_WINDOWS_H_INCLUDED) +# define _STLP_WINDOWS_H_INCLUDED +# if defined (__BUILDING_STLPORT) +# include +/* Here we define _STLP_OUTERMOST_HEADER_ID to avoid indirect inclusion + * of STLport stuffs from C/C++ Standard headers exposed by STLport + * as configuration is not yet completed. */ +# if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x100 +# endif +# if !defined (WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN +# endif +# if !defined (VC_EXTRALEAN) +# define VC_EXTRALEAN +# endif +/* Don't let windows.h define its min and max macros. */ +# if !defined (NOMINMAX) +# define NOMINMAX +# endif +# if !defined (STRICT) +# define STRICT +# endif +# if defined (_STLP_USE_MFC) +# include +# else +# include +# endif +# if (_STLP_OUTERMOST_HEADER_ID == 0x100) +# undef _STLP_OUTERMOST_HEADER_ID +# endif +# else +/* This section serves as a replacement for windows.h header. */ +# if defined (__cplusplus) +extern "C" { +# endif +# if (defined (_M_AMD64) || defined (_M_IA64) || (!defined (_STLP_WCE) && defined (_M_MRX000)) || defined (_M_ALPHA) || \ + (defined (_M_PPC) && (_STLP_MSVC_LIB >= 1000))) && !defined (RC_INVOKED) +# define InterlockedIncrement _InterlockedIncrement +# define InterlockedDecrement _InterlockedDecrement +# define InterlockedExchange _InterlockedExchange +# define _STLP_STDCALL +# else +# if defined (_MAC) +# define _STLP_STDCALL _cdecl +# else +# define _STLP_STDCALL __stdcall +# endif +# endif + +# if defined (_STLP_NEW_PLATFORM_SDK) +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long volatile *); +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long volatile *); +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long volatile *, long); +# if defined (_WIN64) +_STLP_IMPORT_DECLSPEC void* _STLP_STDCALL _InterlockedExchangePointer(void* volatile *, void*); +# endif +# elif !defined (_STLP_WCE) +/* boris : for the latest SDK, you may actually need the other version of the declaration (above) + * even for earlier VC++ versions. There is no way to tell SDK versions apart, sorry ... + */ +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedIncrement(long*); +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedDecrement(long*); +_STLP_IMPORT_DECLSPEC long _STLP_STDCALL InterlockedExchange(long*, long); +# else +/* start of eMbedded Visual C++ specific section */ +# include + +/* Don't let windef.h define its min and max macros. */ +# if !defined (NOMINMAX) +# define NOMINMAX +# endif +# include /* needed for basic windows types */ + + /** in SDKs generated with PB5, windef.h somehow includes headers which then + define setjmp. */ +# if (_WIN32_WCE >= 0x500) +# define _STLP_NATIVE_SETJMP_H_INCLUDED +# endif + +# ifndef _WINBASE_ /* winbase.h already included? */ +long WINAPI InterlockedIncrement(long*); +long WINAPI InterlockedDecrement(long*); +long WINAPI InterlockedExchange(long*, long); +# endif + +# ifndef __WINDOWS__ /* windows.h already included? */ + +# if defined (x86) +# include /* needed for inline versions of Interlocked* functions */ +# endif + +# ifndef _MFC_VER + +# define MessageBox MessageBoxW +int WINAPI MessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); + +# define wvsprintf wvsprintfW +int WINAPI wvsprintfW(LPWSTR, LPCWSTR, va_list ArgList); + +void WINAPI ExitThread(DWORD dwExitCode); + +# if !defined (COREDLL) +# define _STLP_WCE_WINBASEAPI DECLSPEC_IMPORT +# else +# define _STLP_WCE_WINBASEAPI +# endif + +_STLP_WCE_WINBASEAPI int WINAPI +MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, + int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar); + +_STLP_WCE_WINBASEAPI UINT WINAPI GetACP(); + +_STLP_WCE_WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE hProcess, DWORD uExitCode); + +# define OutputDebugString OutputDebugStringW +void WINAPI OutputDebugStringW(LPCWSTR); + +_STLP_WCE_WINBASEAPI void WINAPI Sleep(DWORD); + +# undef _STLP_WCE_WINBASEAPI + +# endif /* !_MFC_VER */ + +# endif /* !__WINDOWS__ */ + +/* end of eMbedded Visual C++ specific section */ +# endif + +# if !defined (_STLP_WCE) +_STLP_IMPORT_DECLSPEC void _STLP_STDCALL Sleep(unsigned long); +_STLP_IMPORT_DECLSPEC void _STLP_STDCALL OutputDebugStringA(const char* lpOutputString); +# endif + +# if defined (InterlockedIncrement) +# pragma intrinsic(_InterlockedIncrement) +# pragma intrinsic(_InterlockedDecrement) +# pragma intrinsic(_InterlockedExchange) +# if defined (_WIN64) +# pragma intrinsic(_InterlockedExchangePointer) +# endif +# endif +# if defined (__cplusplus) +} /* extern "C" */ +# endif + +# endif + +/* Here we use a macro different than the InterlockedExchangePointer SDK one + * to avoid macro definition conflict. */ +# if !defined (_WIN64) +/* Under 32 bits platform we rely on a simple InterlockedExchange call. */ +# if defined (__cplusplus) +/* We do not define this function if we are not in a C++ translation unit just + * because of the 'inline' keyword portability issue it would introduce. We will + * have to fix it the day we need this function for a C translation unit. + */ +inline +void* _STLP_CALL STLPInterlockedExchangePointer(void* volatile* __a, void* __b) { +# if defined (_STLP_MSVC) +/* Here MSVC produces warning if 64 bits portability issue is activated. + * MSVC do not see that _STLP_ATOMIC_EXCHANGE_PTR is a macro which content + * is based on the platform, Win32 or Win64 + */ +# pragma warning (push) +# pragma warning (disable : 4311) // pointer truncation from void* to long +# pragma warning (disable : 4312) // conversion from long to void* of greater size +# endif +# if !defined (_STLP_NO_NEW_STYLE_CASTS) + return reinterpret_cast(InterlockedExchange(reinterpret_cast(const_cast(__a)), + reinterpret_cast(__b))); +# else + return (void*)InterlockedExchange((long*)__a, (long)__b); +# endif +# if defined (_STLP_MSVC) +# pragma warning (pop) +# endif +} +# endif +# else +# define STLPInterlockedExchangePointer _InterlockedExchangePointer +# endif + +#endif /* _STLP_WINDOWS_H_INCLUDED */ +#endif /* _STLP_SGX_CONFIG */ + +/* _STLP_WIN95_LIKE signal the Windows 95 OS or assimilated Windows OS version that + * has Interlockeded[Increment, Decrement] Win32 API functions not returning modified + * value. + */ +#if (defined (WINVER) && (WINVER < 0x0410) && (!defined (_WIN32_WINNT) || (_WIN32_WINNT < 0x400))) || \ + (!defined (WINVER) && (defined (_WIN32_WINDOWS) && (_WIN32_WINDOWS < 0x0410) || \ + (defined (_WIN32_WINNT) && (_WIN32_WINNT < 0x400)))) +# define _STLP_WIN95_LIKE +#endif + +/* Between Windows 95 (0x400) and later Windows OSes an API enhancement forces us + * to change _Refcount_Base internal struct. As _Refcount_base member methods might + * be partially inlined we need to check that STLport build/use are coherent. To do + * so we try to generate a link time error thanks to the following macro. + * This additional check is limited to old compilers that might still be used with + * Windows 95. */ +#if (defined (_DEBUG) || defined (_STLP_DEBUG)) && \ + (defined (_STLP_MSVC) && (_STLP_MSVC < 1310) || \ + defined (__GNUC__) && (__GNUC__ < 3)) +/* We invert symbol names based on macro detection, when building for Windows + * 95 we expose a + * building_for_windows95_or_previous_but_library_built_for_windows98_or_later + * function in order to have a more obvious link error message signaling how + * the lib has been built and how it is used. */ +# if defined (__BUILDING_STLPORT) +# if defined (_STLP_WIN95_LIKE) +# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98 +# else +# define _STLP_SIGNAL_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95 +# endif +# else +# if defined (_STLP_WIN95_LIKE) +# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_windows95_but_library_built_for_at_least_windows98 +# else +# define _STLP_CHECK_RUNTIME_COMPATIBILITY building_for_at_least_windows98_but_library_built_for_windows95 +# endif +# endif +#endif + +#if defined (__WIN16) || defined (WIN16) || defined (_WIN16) +# define _STLP_WIN16 +#else +# define _STLP_WIN32 +#endif + +#if defined(_STLP_WIN32) +# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */ +#endif + +#if defined(__MINGW32__) && !defined(_STLP_USE_STDIO_IO) +# define _STLP_USE_WIN32_IO /* CreateFile/ReadFile/WriteFile */ +#endif /* __MINGW32__ */ + +#ifdef _STLP_WIN16 +# define _STLP_USE_UNIX_EMULATION_IO /* _open/_read/_write */ +# define _STLP_LDOUBLE_80 +#endif + +#endif /* _STLP_INTERNAL_WINDOWS_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/compat.h b/sdk/tlibstdcxx/stlport/stl/config/compat.h new file mode 100644 index 0000000000..434f314e7a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/compat.h @@ -0,0 +1,80 @@ + +/* + * Compatibility section + * This section sets new-style macros based on old-style ones, for compatibility + */ + +#if defined (__STL_DEBUG) && !defined (_STLP_DEBUG) +# define _STLP_DEBUG __STL_DEBUG +#endif +#if defined (__STL_NO_ANACHRONISMS) && !defined (_STLP_NO_ANACHRONISMS) +# define _STLP_NO_ANACHRONISMS __STL_NO_ANACHRONISMS +#endif +#if defined (__STL_NO_EXTENSIONS) && !defined (_STLP_NO_EXTENSIONS) +# define _STLP_NO_EXTENSIONS __STL_NO_EXTENSIONS +#endif +#if defined (__STL_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) +# define _STLP_NO_EXCEPTIONS __STL_NO_EXCEPTIONS +#endif +#if defined (__STL_NO_NAMESPACES) && !defined (_STLP_NO_NAMESPACES) +# define _STLP_NO_NAMESPACES __STL_NO_NAMESPACES +#endif +#if defined (__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS) && !defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS) +# define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS __STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS +#endif +#if defined (__STL_NO_OWN_NAMESPACE) && !defined (_STLP_NO_OWN_NAMESPACE) +# define _STLP_NO_OWN_NAMESPACE __STL_NO_OWN_NAMESPACE +#endif + +#if defined (__STL_NO_RELOPS_NAMESPACE) && !defined (_STLP_NO_RELOPS_NAMESPACE) +# define _STLP_NO_RELOPS_NAMESPACE __STL_NO_RELOPS_NAMESPACE +#endif + +#if defined (__STL_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_UNINITIALIZED) +# define _STLP_DEBUG_UNINITIALIZED __STL_DEBUG_UNINITIALIZED +#endif +#if defined (__STL_SHRED_BYTE) && !defined (_STLP_SHRED_BYTE) +# define _STLP_SHRED_BYTE __STL_SHRED_BYTE +#endif +#if defined (__STL_USE_MFC) && !defined (_STLP_USE_MFC) +# define _STLP_USE_MFC __STL_USE_MFC +#endif + +#if defined (__STL_USE_NEWALLOC) && !defined (_STLP_USE_NEWALLOC) +# define _STLP_USE_NEWALLOC __STL_USE_NEWALLOC +#endif +#if defined (__STL_USE_MALLOC) && !defined (_STLP_USE_MALLOC) +# define _STLP_USE_MALLOC __STL_USE_MALLOC +#endif + +#if defined (__STL_DEBUG_ALLOC) && !defined (_STLP_DEBUG_ALLOC) +# define _STLP_DEBUG_ALLOC __STL_DEBUG_ALLOC +#endif + +#if defined (__STL_DEBUG_MESSAGE) && !defined (_STLP_DEBUG_MESSAGE) +# define _STLP_DEBUG_MESSAGE __STL_DEBUG_MESSAGE +#endif + +#if defined (__STL_DEBUG_TERMINATE) && !defined (_STLP_DEBUG_TERMINATE) +# define _STLP_DEBUG_TERMINATE __STL_DEBUG_TERMINATE +#endif + +#if defined (__STL_USE_ABBREVS) && !defined (_STLP_USE_ABBREVS) +# define _STLP_USE_ABBREVS __STL_USE_ABBREVS +#endif + +#if defined (__STL_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_NO_MSVC50_COMPATIBILITY) +# define _STLP_NO_MSVC50_COMPATIBILITY __STL_NO_MSVC50_COMPATIBILITY +#endif + +/* STLport do not support anymore the iostream wrapper mode so this macro should + * always been define for other libraries that was using it: + */ +#if !defined (_STLP_OWN_IOSTREAMS) +# define _STLP_OWN_IOSTREAMS +#endif + +#if defined (_STLP_NO_OWN_IOSTREAMS) +# error STLport do not support anymore the wrapper mode. If you want to use STLport \ +use its iostreams implementation or no iostreams at all. +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/features.h b/sdk/tlibstdcxx/stlport/stl/config/features.h new file mode 100644 index 0000000000..d86e2e6ef4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/features.h @@ -0,0 +1,1084 @@ + /* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_FEATURES_H +#define _STLP_FEATURES_H + +/* + * Purpose of this file: + * + * Defines all STLport settings. + * This file is actually a wrapper : it includes compiler-specific + * settings from + * and user-defined settings from . + * See and for the description + * of those macros + * + */ + +/* Definition of the STLport version informations */ +#include + +/* Other macros defined by this file: + + * bool, true, and false, if _STLP_NO_BOOL is defined. + * typename, as a null macro if it's not already a keyword. + * explicit, as a null macro if it's not already a keyword. + * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.) + * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.) + * _STLP_ASSERT, either as a test or as a null macro, depending on + whether or not _STLP_ASSERTIONS is defined. +*/ + +/* Definition of the 2 STLport debug levels */ +#define _STLP_STLPORT_DBG_LEVEL 1 +#define _STLP_STANDARD_DBG_LEVEL 2 + +/* Common settings for SGX */ +#include + +/* Placeholder for user to override settings. + * It could be also used to mask settings from + * different directories. + */ +#include + +#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL) +# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL +#endif + +#if defined (__BUILDING_STLPORT) +/* For the STLport implementation we can use everything: + */ +# if defined (_STLP_NO_ANACHRONISMS) +# undef _STLP_NO_ANACHRONISMS +# endif +# if defined (_STLP_NO_EXTENSIONS) +# undef _STLP_NO_EXTENSIONS +# endif +/* Moreover there are things that have no sens: + */ +# if !defined (_STLP_SGX_CONFIG) +# if defined (_STLP_NO_IOSTREAMS) +# error If you do not use iostreams you do not need to build the STLport library. +# endif +# endif +#endif + +/* ========================================================= */ +/* This file is used for compatibility; it accepts old-style config + switches */ +#include + +/* Common configuration file for this particular installation. */ +#include + +/* Operational Environment specific */ +#include + +/* ========================================================= */ + +/* some fixes to configuration. This also includes modifications + * of STLport switches depending on compiler flags, + * or settings applicable to a group of compilers, such as + * to all who use EDG front-end. + */ +#include + +#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES) +# define _STLP_MEMBER_TEMPLATES 1 +#endif + +#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES) +# define _STLP_MEMBER_TEMPLATE_CLASSES 1 +#endif + +#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) +# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 +#endif + +#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1 +#endif + +#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) +# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1 +#endif + +#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM) +# define _STLP_USE_SHORT_STRING_OPTIM 1 +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \ + !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION) +# define _STLP_USE_CONTAINERS_EXTENSION +#endif + +#if defined (_STLP_USE_CONTAINERS_EXTENSION) +# define _STLP_TEMPLATE_FOR_CONT_EXT template +#else +# define _STLP_TEMPLATE_FOR_CONT_EXT +#endif + +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \ + (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)) +# error Sorry but according the STLport settings your compiler can not support the pointer specialization feature. +#endif + +#if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_NO_OWN_NAMESPACE) +# error Sorry but asking for both STLport to be in the real std namespace and also having STLport import all native std stuff \ + is invalid, chose one or none. +#endif + +#if defined (_STLP_VERBOSE) && !defined (_STLP_VERBOSE_MODE_SUPPORTED) +# error Sorry but the verbose mode is not implemented for your compiler. +#endif + +#if defined (_STLP_NO_IOSTREAMS) && \ + !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC) +# define _STLP_USE_NEWALLOC +#endif + +#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN) +# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \ + defined (__hpux) || defined (macintosh) || defined (_MAC) +# define _STLP_BIG_ENDIAN 1 +# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \ + defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \ + defined (__alpha__) +# define _STLP_LITTLE_ENDIAN 1 +# elif defined (__ia64__) + /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */ +# if defined (__BIG_ENDIAN__) +# define _STLP_BIG_ENDIAN 1 +# else +# define _STLP_LITTLE_ENDIAN 1 +# endif +# else +# error "can't determine endianess" +# endif +#endif /* _STLP_BIG_ENDIAN */ + +/* ========================================================== + * final workaround tuning based on given flags + * ========================================================== */ + +#ifndef _STLP_UINT32_T +# define _STLP_UINT32_T unsigned long +#endif +#ifndef _STLP_ABORT +# define _STLP_ABORT() abort() +#endif + +#if !defined (_STLP_HAS_NO_NAMESPACES) +# if defined _STLP_NO_NAMESPACES +# undef _STLP_USE_NAMESPACES +# else +/* assume it as the default, turn it off later if NO_NAMESPACES selected */ +# undef _STLP_USE_NAMESPACES +# define _STLP_USE_NAMESPACES 1 +# endif +#endif + +#if defined (_STLP_NO_IOSTREAMS) +# define _STLP_USE_NO_IOSTREAMS +#endif + +/* Operating system recognition (basic) */ +#if (defined(__unix) || defined(__linux__) || defined(__QNX__) || defined(_AIX) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__Lynx__) || defined(__hpux) || defined(__sgi)) && \ + !defined (_STLP_UNIX) +# define _STLP_UNIX 1 +#endif /* __unix */ + +#if !defined (_STLP_NO_LONG_DOUBLE) +# define _STLP_LONGEST_FLOAT_TYPE long double +#else +# define _STLP_LONGEST_FLOAT_TYPE double +#endif + +/* Native headers access macros */ +#if !defined (_STLP_HAS_INCLUDE_NEXT) +# include +#endif + +/* shared library tune-up */ + +#if defined (__BUILDING_STLPORT) +/* if we are rebuilding right now, place everything here */ +# undef _STLP_DESIGNATED_DLL +# define _STLP_DESIGNATED_DLL 1 +#endif + +/* Use own namespace always if possible and not explicitly instructed otherwise */ +#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \ + !defined (_STLP_NO_OWN_NAMESPACE) +# undef _STLP_USE_OWN_NAMESPACE +# define _STLP_USE_OWN_NAMESPACE 1 +#else +# undef _STLP_WHOLE_NATIVE_STD +#endif + +#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) + +# if defined (_PTHREADS) +# define _STLP_PTHREADS +# define _STLP_THREADS +# endif +# if defined (_UITHREADS) +# define _STLP_UITHREADS +# define _STLP_THREADS +# endif + +# if defined (_STLP_WIN32) && !defined (_STLP_PTHREADS) +# define _STLP_WIN32THREADS 1 +# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \ + !defined(_STLP_PTHREADS) +# define _STLP_UITHREADS +# else +# define _STLP_PTHREADS +# endif /* __sgi */ +# define _STLP_THREADS_DEFINED +#endif + +#if (defined (_REENTRANT) || defined (_THREAD_SAFE)) && !defined (_STLP_THREADS) +# define _STLP_THREADS +#endif + +#ifndef _STLP_STATIC_MUTEX +# define _STLP_STATIC_MUTEX _STLP_mutex_base +#endif + +#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC) +# define _STLP_USE_MFC 1 +#endif + +#if defined (_STLP_THREADS) +# define _STLP_VOLATILE volatile +#else +# define _STLP_VOLATILE +#endif + +#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) +# define _STLP_USE_NEW_C_HEADERS +#endif +/* disable new-style headers if requested */ +#if defined (_STLP_NO_NEW_C_HEADERS) +# undef _STLP_USE_NEW_C_HEADERS +#endif + +#if defined (_STLP_BASE_TYPEDEF_BUG) +# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG +# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 +#endif + +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG +#endif + +/* SUNpro 4.2 inline string literal bug */ +#ifdef _STLP_INLINE_STRING_LITERAL_BUG +# define _STLP_FIX_LITERAL_BUG(__x) __x = __x; +#else +# define _STLP_FIX_LITERAL_BUG(__x) +#endif + +#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) +# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM +# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 +#endif + +#if !defined (_STLP_STATIC_ASSERT) +/* Some compiler support 0 size array so we use negative size array to generate + * a compilation time error. + */ +# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1]; +#endif + +/* apple mpw exception handling bug */ +#ifndef _STLP_MPWFIX_TRY +# define _STLP_MPWFIX_TRY +#endif +#ifndef _STLP_MPWFIX_CATCH +# define _STLP_MPWFIX_CATCH +#endif +#ifndef _STLP_MPWFIX_CATCH_ACTION +# define _STLP_MPWFIX_CATCH_ACTION(action) +#endif + +#if !defined (_STLP_WEAK) +# define _STLP_WEAK +#endif + +/* default parameters as template types derived from arguments ( not always supported ) */ +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname +#else +# if !defined (_STLP_DEFAULT_TYPE_PARAM) +# define _STLP_DEFAULT_TYPE_PARAM 1 +# endif +# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval +#endif + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc +#else +# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \ + class _Alloc = allocator< pair < _Key, _Tp > > +#endif + +/* default parameters as complete types */ +#if defined (_STLP_DEFAULT_TYPE_PARAM) +# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval +# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val +#else +# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname +# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name +#endif + +/* SGI compatibility */ + +#ifdef _STLP_NO_WCHAR_T +# ifndef _STLP_NO_NATIVE_WIDE_STREAMS +# define _STLP_NO_NATIVE_WIDE_STREAMS 1 +# endif +#else +# define _STLP_HAS_WCHAR_T 1 +#endif + +#if !defined (_STLP_NO_AT_MEMBER_FUNCTION) +# define _STLP_CAN_THROW_RANGE_ERRORS 1 +#endif + +/* debug mode tool */ +#if defined (_STLP_DEBUG) +# define _STLP_NON_DBG_NAME(X) _NonDbg_##X +#endif + +/* pointer specialization tool */ +#if defined (_STLP_USE_PTR_SPECIALIZATIONS) +# define _STLP_PTR_IMPL_NAME(X) _Impl_##X +#endif + +#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ + defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) +# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X +#endif + +/* this always mean the C library is in global namespace */ +#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD) +# define _STLP_VENDOR_GLOBAL_CSTD 1 +#endif + +/* Depending of whether compiler supports namespaces, + * tune the parameters for vendor-supplied libraries. + * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES, + * since it depends only on the native features, not on user's preference whether + * to use namespace for STLport or not. + */ +#if !defined (_STLP_HAS_NO_NAMESPACES) +/* Import some vendor's headers into corresponding STLport ones if they might be needed + * (if we wrap native iostreams and use namepace other than std::) */ +# if defined (_STLP_WHOLE_NATIVE_STD) +# define _STLP_IMPORT_VENDOR_STD 1 +# endif + +/* if using stlport:: namespace or if C library stuff is not in vendor's std::, + * try importing 'em. + * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */ +# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD)) +# define _STLP_IMPORT_VENDOR_CSTD 1 +# endif + +# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS) +# define _STLP_NO_CSTD_FUNCTION_IMPORTS +# endif + +# define _STLP_USING_NAMESPACE(x) using namespace x ; + +namespace std { } +namespace __std_alias = std; + +/* assume std:: namespace for C++ std library if not being told otherwise */ +# if defined (_STLP_VENDOR_GLOBAL_STD) +# define _STLP_VENDOR_STD +# else +# define _STLP_VENDOR_STD std +# endif + +/* tune things that come from C library */ +# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS) +/* in old-style headers, C functions go to global scope. */ +# define _STLP_VENDOR_CSTD +# define _STLP_USING_VENDOR_CSTD +# else +# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD +# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD) +# endif /* _STLP_VENDOR_CSTD */ +/* exception, typeinfo, new - always come from the vendor */ +# if !defined (_STLP_VENDOR_EXCEPT_STD) +# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD) +# define _STLP_VENDOR_EXCEPT_STD +# else +# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD +# endif +# endif +# define _STLP_OLD_IO_NAMESPACE +# if !defined (_STLP_VENDOR_MB_NAMESPACE) +# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD +# endif +#else +/* compiler has no namespace support */ +# define _STLP_VENDOR_STD +# define _STLP_VENDOR_CSTD +# define _STLP_USING_NAMESPACE(x) +# define _STLP_USING_VENDOR_CSTD +# define _STLP_VENDOR_EXCEPT_STD +#endif + +#if defined (_STLP_USE_NAMESPACES) + +# if defined (_STLP_USE_OWN_NAMESPACE) +# if !defined (_STLP_STD_NAME) +# if !defined (_STLP_DEBUG) +# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# ifndef _STLP_THREADS +# define _STLP_STD_NAME stlpmtx_std +# else +# define _STLP_STD_NAME stlp_std +# endif +# else +# ifndef _STLP_THREADS +# define _STLP_STD_NAME stlpxmtx_std +# else +# define _STLP_STD_NAME stlpx_std +# endif +# endif +# else +/* + * The STLport debug mode is binary incompatible with the other modes, + * lets make it clear on the STLport namespace to generate link errors rather + * than runtime ones. + */ +# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) +# ifndef _STLP_THREADS +# define _STLP_STD_NAME stlpdmtx_std +# else +# define _STLP_STD_NAME stlpd_std +# endif +# else +# ifndef _STLP_THREADS +# define _STLP_STD_NAME stlpdxmtx_std +# else +# define _STLP_STD_NAME stlpdx_std +# endif +# endif +# endif +# endif +namespace _STLP_STD_NAME { } +# else +# define _STLP_STD_NAME std +# endif /* _STLP_USE_OWN_NAMESPACE */ + +# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME { +# define _STLP_BEGIN_TR1_NAMESPACE namespace tr1 { +# define _STLP_END_NAMESPACE } + +/* decide whether or not we use separate namespace for rel ops */ +# if defined (_STLP_NO_RELOPS_NAMESPACE) +# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {} +# define _STLP_END_RELOPS_NAMESPACE } +# else +/* Use std::rel_ops namespace */ +# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops { +# define _STLP_END_RELOPS_NAMESPACE } } +# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE +# endif /* Use std::rel_ops namespace */ + +# define _STLP_STD ::_STLP_STD_NAME +# if !defined (_STLP_TR1) +# define _STLP_TR1 _STLP_STD::tr1:: +# endif + +# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE) +# define _STLP_PRIV_NAME priv +# define _STLP_PRIV _STLP_STD::_STLP_PRIV_NAME:: +# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME { +# define _STLP_MOVE_TO_STD_NAMESPACE } +# else +# if !defined (_STLP_PRIV) +# define _STLP_PRIV _STLP_STD:: +# endif +# define _STLP_MOVE_TO_PRIV_NAMESPACE +# define _STLP_MOVE_TO_STD_NAMESPACE +# endif + +/* Official STLport namespace when std is not redefined. + * Here we don't use a macro because we do not need it and because + * stlport is used as file name by boost and folder name under beos: + */ +namespace stlport = _STLP_STD_NAME; + +/* Backward compatibility: + */ +namespace _STL = _STLP_STD_NAME; +#undef __STLPORT_NAMESPACE +#define __STLPORT_NAMESPACE _STLP_STD_NAME + +#else /* _STLP_USE_NAMESPACES */ +/* STLport is being put into global namespace */ +# define _STLP_STD +# define _STLP_PRIV +# define _STLP_TR1 +# define _STLP_BEGIN_NAMESPACE +# define _STLP_BEGIN_TR1_NAMESPACE +# define _STLP_END_NAMESPACE +# define _STLP_MOVE_TO_PRIV_NAMESPACE +# define _STLP_MOVE_TO_STD_NAMESPACE + +/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE + causes less problems than having relational operator templates in global namespace + Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */ +# if !defined (_STLP_NO_RELOPS_NAMESPACE) +# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE +# endif +# define _STLP_BEGIN_RELOPS_NAMESPACE +# define _STLP_END_RELOPS_NAMESPACE +# undef _STLP_USE_OWN_NAMESPACE +#endif /* _STLP_USE_NAMESPACES */ + +#define STLPORT_CSTD _STLP_VENDOR_CSTD +#define STLPORT _STLP_STD_NAME + +#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG) +# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy +#else +# define _STLP_SIMPLE_TYPE(T) T +#endif + +#ifndef _STLP_RAND48 +# define _STLP_NO_DRAND48 +#endif + +/* advanced keywords usage */ +#define __C_CAST(__x, __y) ((__x)(__y)) +#ifndef _STLP_NO_NEW_STYLE_CASTS +# define __CONST_CAST(__x,__y) const_cast<__x>(__y) +# define __STATIC_CAST(__x,__y) static_cast<__x>(__y) +# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y) +#else +# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y) +# define __CONST_CAST(__x,__y) __C_CAST(__x, __y) +# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y) +#endif + +#if defined (_STLP_NEED_TYPENAME) && ! defined (typename) +# define typename +#endif + +#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE ) +# define _STLP_TYPENAME_ON_RETURN_TYPE +#else +# define _STLP_TYPENAME_ON_RETURN_TYPE typename +#endif + +#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER +# define _STLP_HEADER_TYPENAME +#else +# define _STLP_HEADER_TYPENAME typename +#endif + +#ifdef _STLP_NO_TYPENAME_BEFORE_NAMESPACE +# define _STLP_TYPENAME +#else +# define _STLP_TYPENAME typename +#endif + +#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD +# define _STLP_TEMPLATE template +#else +# define _STLP_TEMPLATE +#endif + +#if defined (_STLP_USE_CONTAINERS_EXTENSION) +# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) +# define _STLP_TEMPLATE_FOR_CONT_EXT template +#else +# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT; +# define _STLP_TEMPLATE_FOR_CONT_EXT +#endif + +#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit) +# define explicit +#endif + +#if !defined (_STLP_NEED_MUTABLE) +# define _STLP_MUTABLE(type, x) x +#else +# define _STLP_MUTABLE(type, x) __CONST_CAST(type*, this)->x +# define mutable +#endif + +#if defined (_STLP_NO_SIGNED_BUILTINS) +/* old HP-UX doesn't understand "signed" keyword */ +# define signed +#endif + +#if defined (_STLP_LOOP_INLINE_PROBLEMS) +# define _STLP_INLINE_LOOP +#else +# define _STLP_INLINE_LOOP inline +#endif + +#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX +# define _STLP_TEMPLATE_NULL template<> +#else +# define _STLP_TEMPLATE_NULL +#endif + +#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER +# define _STLP_OPERATOR_TEMPLATE +#else +# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL +#endif + +#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION +/* unless we have other compiler problem, try simulating partial spec here */ +# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) +# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS +# endif +/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */ +# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)) +# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES ) +# define _STLP_USE_OLD_HP_ITERATOR_QUERIES +# endif +# elif defined ( _STLP_NO_ANACHRONISMS ) +# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES +# endif +#endif + +#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS +# define _STLP_NULL_TMPL_ARGS <> +# else +# define _STLP_NULL_TMPL_ARGS +#endif + +#if !defined (_STLP_ALLOCATOR_TYPE_DFL) +# if defined (_STLP_DONT_SUP_DFLT_PARAM) +# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS +# endif +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) +# define _STLP_ALLOCATOR_TYPE_DFL +# else +# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type() +# endif +#endif + +/* When the compiler do not correctly initialized the basic types value in default parameters we prefer + * to avoid them to be able to correct this bug. + */ +#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG) +# define _STLP_DONT_SUP_DFLT_PARAM 1 +#endif + +#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR) +# define _STLP_NO_ARROW_OPERATOR +#endif + +#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \ + !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY) +/* this one is needed for proper reverse_iterator<> operator ->() handling */ +# define _STLP_MSVC50_COMPATIBILITY 1 +# endif +#endif + +#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) +# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) ) +# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ + typedef typename _STLP_STD :: reverse_iterator const_reverse_iterator; \ + typedef typename _STLP_STD :: reverse_iterator reverse_iterator +# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__) +# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ + typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator const_reverse_iterator; \ + typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator reverse_iterator +# else +# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ + typedef _STLP_STD::reverse_iterator const_reverse_iterator; \ + typedef _STLP_STD::reverse_iterator reverse_iterator +# endif +#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ +# if defined (_STLP_MSVC50_COMPATIBILITY) +# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ + typedef _STLP_STD::__reverse_iterator const_reverse_iterator; \ + typedef _STLP_STD::__reverse_iterator \ + reverse_iterator +# else +# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ + typedef _STLP_STD::__reverse_iterator const_reverse_iterator; \ + typedef _STLP_STD::__reverse_iterator \ + reverse_iterator +# endif +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \ + _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator) +#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \ + _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator) + +#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \ + typedef typename _Super::value_type value_type; \ + typedef typename _Super::size_type size_type; \ + typedef typename _Super::difference_type difference_type; \ + typedef typename _Super::reference reference; \ + typedef typename _Super::const_reference const_reference; \ + typedef typename _Super::pointer pointer; \ + typedef typename _Super::const_pointer const_pointer; \ + typedef typename _Super::allocator_type allocator_type; + + +#define __IMPORT_ITERATORS(_Super) \ + typedef typename _Super::iterator iterator; \ + typedef typename _Super::const_iterator const_iterator; + +#define __IMPORT_REVERSE_ITERATORS(_Super) \ + typedef typename _Super::const_reverse_iterator const_reverse_iterator; \ + typedef typename _Super::reverse_iterator reverse_iterator; + +#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \ + __derived_name(const _Super& __x) : _SUPER(__x) {} \ + _Self& operator=(const _Super& __x) { \ + *(_Super*)this = __x; \ + return *this; \ + } \ + __derived_name(const _Self& __x) : _SUPER(__x) {} \ + _Self& operator=(const _Self& __x) { \ + *(_Super*)this = __x; \ + return *this; \ + } + +#define __IMPORT_WITH_ITERATORS(_Super) \ + __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super) + +#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \ + __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super) + +#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG) +# define __TRIVIAL_CONSTRUCTOR(__type) __type() {} +#else +# define __TRIVIAL_CONSTRUCTOR(__type) +#endif + +#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG) +# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {} +#else +# define __TRIVIAL_DESTRUCTOR(__type) +#endif + +#define __TRIVIAL_STUFF(__type) \ + __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type) + +#if defined (_STLP_STATIC_CONST_INIT_BUG) +# define _STLP_STATIC_CONSTANT(__type, __assignment) enum { __assignment } +#else +# define _STLP_STATIC_CONSTANT(__type, __assignment) static const __type __assignment +#endif + +#if defined (_STLP_HAS_NO_EXCEPTIONS) +# define _STLP_NO_EXCEPTIONS +#endif + +#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS) +# define _STLP_USE_EXCEPTIONS +#endif + +#if defined (_STLP_USE_EXCEPTIONS) +# define _STLP_TRY try +# define _STLP_CATCH_ALL catch(...) +# ifndef _STLP_THROW +# define _STLP_THROW(x) throw x +# endif +# define _STLP_RETHROW throw + +# define _STLP_UNWIND(action) catch(...) { action; throw; } + +# ifdef _STLP_THROW_RETURN_BUG +# define _STLP_RET_AFTER_THROW(data) return data; +# else +# define _STLP_RET_AFTER_THROW(data) +# endif + +# if !defined (_STLP_THROWS) +# define _STLP_THROWS(x) throw(x) +# endif +# if !defined (_STLP_NOTHROW) +# define _STLP_NOTHROW throw() +# endif +#else +# define _STLP_TRY +# define _STLP_CATCH_ALL if (false) +# ifndef _STLP_THROW +# define _STLP_THROW(x) +# endif +# define _STLP_RETHROW {} +# define _STLP_UNWIND(action) +# define _STLP_THROWS(x) +# define _STLP_NOTHROW +# define _STLP_RET_AFTER_THROW(data) +#endif + +/* + * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no + * exception support but not the _STLP_USE_EXCEPTIONS which simply means + * that the user do not want to use them. + */ +#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC) +# define _STLP_THROWS_INHERENTLY(x) throw x +# define _STLP_NOTHROW_INHERENTLY throw() +#else +# define _STLP_THROWS_INHERENTLY(x) +# define _STLP_NOTHROW_INHERENTLY +#endif + +/* STLport function not returning are functions that throw so we translate + * the noreturn functions in throwing functions taking also into account + * exception support activation. + */ +#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \ + !defined (_STLP_FUNCTION_THROWS) +# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION +#else +# define _STLP_FUNCTION_THROWS +#endif + +#if defined(_STLP_NO_BOOL) +# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX) +# include +# if defined (__OS400__) +typedef int bool; +# elif !( defined (__xlC__) || defined (_AIX)) +typedef Boolean bool; +# endif +# else +# if defined(_STLP_YVALS_H) +# include +# else +# if defined (_STLP_DONT_USE_BOOL_TYPEDEF) +# define bool int +# else +typedef int bool; +# endif +# define true 1 +# define false 0 +# endif +# endif /* __IBMCPP__ */ +#else +# define _STLP_BOOL_KEYWORD 1 +#endif /* _STLP_NO_BOOL */ + +/* uninitialized value filler */ +#ifndef _STLP_SHRED_BYTE +/* This value is designed to cause problems if an error occurs */ +# define _STLP_SHRED_BYTE 0xA3 +#endif /* _STLP_SHRED_BYTE */ + +/* shared library tune-up */ +#ifndef _STLP_IMPORT_DECLSPEC +# define _STLP_IMPORT_DECLSPEC +#endif + +/* a keyword used to instantiate export template */ +#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD +# define _STLP_EXPORT_TEMPLATE_KEYWORD +#endif +#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD +# define _STLP_IMPORT_TEMPLATE_KEYWORD +#endif + +#if !defined (_STLP_NO_CONST_IN_PAIR) +# define _STLP_CONST const +#else +# define _STLP_CONST +#endif + +#ifdef _STLP_USE_NO_IOSTREAMS +/* + * If we do not use iostreams we do not use the export/import + * techniques to avoid build of the STLport library. + */ +# undef _STLP_USE_DECLSPEC +/* We also undef USE_DYNAMIC_LIB macro as this macro add some code + * to use the dynamic (shared) STLport library for some platform/compiler + * configuration leading to problem when not linking to the STLport lib. + */ +# undef _STLP_USE_DYNAMIC_LIB +#endif + +#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC) +# if ! defined (_STLP_USE_TEMPLATE_EXPORT) +/* this setting turns on "extern template" extension use */ +# define _STLP_USE_TEMPLATE_EXPORT +# endif +# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE) +# define _STLP_NO_FORCE_INSTANTIATE +# endif +#endif + +#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */ +# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD +#else +# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD +#endif + +#ifndef _STLP_EXPORT_TEMPLATE +# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template +#endif + +#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */ + +# ifndef _STLP_EXPORT_DECLSPEC +# define _STLP_EXPORT_DECLSPEC +# endif +# ifndef _STLP_IMPORT_DECLSPEC +# define _STLP_IMPORT_DECLSPEC +# endif +# ifndef _STLP_CLASS_EXPORT_DECLSPEC +# define _STLP_CLASS_EXPORT_DECLSPEC +# endif +# ifndef _STLP_CLASS_IMPORT_DECLSPEC +# define _STLP_CLASS_IMPORT_DECLSPEC +# endif +# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */ +# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC +# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC +# else +# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */ +# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC +# endif + +#else /* Not using DLL export/import specifications */ + +# define _STLP_DECLSPEC +# define _STLP_CLASS_DECLSPEC + +#endif + +#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC + +#if defined (_STLP_NEED_ADDITIONAL_STATIC_DECLSPEC) +# define _STLP_STATIC_DECLSPEC _STLP_DECLSPEC +#else +# define _STLP_STATIC_DECLSPEC +#endif + +#if !defined (_STLP_CALL) +# define _STLP_CALL +#endif + +#ifndef _STLP_USE_NO_IOSTREAMS + +# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM) +# define __USE_STD_IOSTREAM +# endif + +/* We only need to expose details of streams implementation + if we use non-standard i/o or are building STLport*/ +# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO) +# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1 +# endif + +/* We only need to expose details of global implementation if we are building STLport + or have not instantiated everything in the lib */ +# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) +# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION +# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1 +# endif + +#else /* _STLP_USE_NO_IOSTREAMS */ +/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */ +# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION +#endif /* _STLP_USE_NO_IOSTREAMS */ + +#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS +# define _STLP_PSPEC2(t1,t2) < t1,t2 > +# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 > +#else +# define _STLP_PSPEC2(t1,t2) /* nothing */ +# define _STLP_PSPEC3(t1,t2,t3) /* nothing */ +#endif + +/* Activation of the partial template workaround: + */ +#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\ + (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER)) +# define _STLP_USE_PARTIAL_SPEC_WORKAROUND +#endif + +#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE +# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \ +_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\ +_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\ +_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\ +_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);} +#else +# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) +#endif + +#if defined ( _STLP_USE_ABBREVS ) +# include +#endif + +/* Some really useful macro */ +#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0]) +#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0]) + +#if !defined (_STLP_MARK_PARAMETER_AS_UNUSED) +# define _STLP_MARK_PARAMETER_AS_UNUSED(X) (void*)X; +#endif + +#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) +# if defined (_STLP_USE_NO_IOSTREAMS) +# undef _STLP_CHECK_RUNTIME_COMPATIBILITY +# else +/* The extern "C" simply makes the symbol simpler. */ +#if defined (__cplusplus) +extern "C" +#endif +void _STLP_DECLSPEC _STLP_CALL _STLP_CHECK_RUNTIME_COMPATIBILITY(); +# endif +#endif + +/* some cleanup */ +#undef _STLP_DONT_USE_BOOL_TYPEDEF +#undef _STLP_YVALS_H +#undef _STLP_LOOP_INLINE_PROBLEMS +#undef _STLP_NEED_EXPLICIT +#undef _STLP_NEED_TYPENAME +#undef _STLP_NO_NEW_STYLE_CASTS +#undef __AUTO_CONFIGURED + +#endif /* _STLP_FEATURES_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/config/host.h b/sdk/tlibstdcxx/stlport/stl/config/host.h new file mode 100644 index 0000000000..b0be0f6f14 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/host.h @@ -0,0 +1,342 @@ +/* + * This file defines site configuration. + */ + +/* + * _STLP_NO_THREADS: if defined, STLport don't use any + * multithreading support. Synonym is _NOTHREADS + */ + +#define _NOTHREADS +#define _STLP_NO_THREADS + + +/* _PTHREADS: if defined, use POSIX threads for multithreading support. */ +/* +#define _PTHREADS +*/ + +/* compatibility section + */ + +#if (defined (_STLP_NOTHREADS) || defined (_STLP_NO_THREADS) || defined (NOTHREADS)) +# if !defined (_NOTHREADS) +# define _NOTHREADS +# endif +# if !defined (_STLP_NO_THREADS) +# define _STLP_NO_THREADS +# endif +#endif + +#if !defined(_STLP_USE_DYNAMIC_LIB) && !defined(_STLP_USE_STATIC_LIB) +/* + * Turn _STLP_USE_DYNAMIC_LIB to enforce use of .dll version of STLport library. + * NOTE: please do that only if you know what you are doing! + * Changing default will require you to change makefiles in "build" accordingly + * and to rebuild STLPort library! + * On UNIX, this has no effect, see build/lib/README for make tags. + * See STLport configuration file (build/lib/configure.bat) for help in building + * the require library versions. + */ +/* +#define _STLP_USE_DYNAMIC_LIB +*/ + +/* + * Turn _STLP_USE_STATIC_LIB to enforce use of static version of STLport library. + * NOTE: please do that only if you know what you are doing! + * Changing default will require you to change makefile in "build" accordingly + * and to rebuild STLPort library! + * On UNIX, this has no effect, see build/lib/README for make tags. + * See STLport configuration file (build/lib/configure.bat) for help in building + * the require library versions. + */ +/* +#define _STLP_USE_STATIC_LIB +*/ +#endif + +/* + * Edit relative path below (or put full path) to get native + * compiler vendor's headers included. Default is "../include" + * for _STLP_NATIVE_INCLUDE_PATH, default for other macros is + * _STLP_NATIVE_INCLUDE_PATH. + * Hint: never install STLport in the directory that ends with "include" + */ +/* +#undef _STLP_NATIVE_INCLUDE_PATH +#define _STLP_NATIVE_INCLUDE_PATH ../include +*/ +/* same for C library headers like */ +/* +#undef _STLP_NATIVE_CPP_C_INCLUDE_PATH +#define _STLP_NATIVE_CPP_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH +*/ +/* same for C headers like */ +/* +#undef _STLP_NATIVE_C_INCLUDE_PATH +#define _STLP_NATIVE_C_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH +*/ +/* Some compilers locate basic C++ runtime support headers (, , ) in separate directory */ +/* +#undef _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH +#define _STLP_NATIVE_CPP_RUNTIME_INCLUDE_PATH _STLP_NATIVE_INCLUDE_PATH +*/ + +/* + * If namespases available, STLport use own namespace (and masquerade + * it as std). Disable own namespace may cause undefined behaviour. + */ +/* +#define _STLP_NO_OWN_NAMESPACE 1 +*/ + +/* + * Uncomment _STLP_LEAKS_PEDANTIC to force deallocation of ALL allocated + * memory chunks. Normally not required. But if you worry about quazi-leaks + * (may be reported by some leaks detection tools), use + * _STLP_LEAKS_PEDANTIC. It should be used with _STLP_USE_NEWALLOC or + * _STLP_USE_MALLOC (see below), the default node_alloc allocator also clean + * its internal memory pool but only if STLport is used as a dynamic library + * under Win32 (using MSVC like compilers). + */ +/* +#define _STLP_LEAKS_PEDANTIC 1 +*/ + +/* + * Uncomment _STLP_USE_NEWALLOC to force allocator to use plain "new" + * instead of STLport optimized node allocator engine. + */ + +#define _STLP_USE_NEWALLOC 1 + + +/* + * Uncomment _STLP_USE_MALLOC to force allocator to use plain "malloc" + * instead of STLport optimized node allocator engine. + * + * This is default allocator for glibc 2.3.x and later, if not mentioned other + */ +/* +#define _STLP_USE_MALLOC 1 +*/ + +/* + * Uncomment _STLP_USE_PERTHREAD_ALLOC to force allocator to use + * a specific implementation targetting the massively multi-threaded + * environment. The implementation is based on the POSIX pthread + * interface. + */ +/* +#define _STLP_USE_PERTHREAD_ALLOC 1 +*/ + +/* + * Uncomment _STLP_USE_NODE_ALLOC if you want to force allocator to use + * "node_alloc" allocator (this is default allocator for STLport, if not + * used other above, except glibc 2.3.x and later, where default is + * "malloc", due to better results) + */ +/* +#define _STLP_USE_NODE_ALLOC 1 +*/ + +/* + * Set _STLP_DEBUG_ALLOC to use allocators that perform memory debugging, + * such as padding/checking for memory consistency + */ +/* +#define _STLP_DEBUG_ALLOC 1 +*/ + +/* + * For compiler not supporting partial template specialization or ordering of + * template functions STLport implement a workaround based on inheritance + * detection. This inheritance can introduce trouble in client code when + * a user class derived a STL container (which is not advised as STL containers + * do not have virtual destructors). To disable this workaround turn this macro on: + */ +/* +#define _STLP_DONT_USE_PARTIAL_SPEC_WRKD 1 +*/ + +/* + * Uncomment this to force all debug diagnostic to be directed through a + * user-defined global function: + * void __stl_debug_message(const char * format_str, ...) + * instead of predefined STLport routine. + * This allows you to take control of debug message output. + * Default routine calls fprintf(stderr,...) + * Note : If you set this macro, you must supply __stl_debug_message + * function definition somewhere. + */ +/* +#define _STLP_DEBUG_MESSAGE 1 +*/ + +/* + * Uncomment this to force all failed assertions to be executed through + * user-defined global function: + * void __stl_debug_terminate(void). This allows + * you to take control of assertion behaviour for debugging purposes. + * Default routine calls _STLP_ABORT(). + * Note : If you set this macro, you must supply __stl_debug_terminate + * function definition somewhere. + */ +/* +#define _STLP_DEBUG_TERMINATE 1 +*/ + +/* + * Uncomment that to disable exception handling code + */ + +//#define _STLP_DONT_USE_EXCEPTIONS 1 + + +/* + * _STLP_NO_NAMESPACES: if defined, don't put the library in namespace + * stlport:: or std::, even if the compiler supports namespaces + */ +/* +#define _STLP_NO_NAMESPACES 1 +*/ + +/*========================================================== + * Compatibility section + *==========================================================*/ + +/* + * Use abbreviated class names for linker benefit (don't affect interface). + * This option is obsolete, but should work in this release. + * + */ +/* +#define _STLP_USE_ABBREVS +*/ + +/* + * This definition precludes STLport reverse_iterator to be compatible with + * other parts of MSVC library. (With partial specialization, it just + * has no effect). + * Use it _ONLY_ if you use SGI-style reverse_iterator<> template explicitly + */ +/* +#define _STLP_NO_MSVC50_COMPATIBILITY 1 +*/ + +/* + * Use obsolete overloaded template functions iterator_category(), value_type(), distance_type() + * for querying iterator properties. Please note those names are non-standard and are not guaranteed + * to be used by every implementation. However, this setting is on by default when partial specialization + * is not implemented in the compiler and cannot be simulated (only if _STLP_NO_ANACHRONISMS is not set). + * Use of those interfaces for user-defined iterators is strongly discouraged: + * please use public inheritance from iterator<> template to achieve desired effect. + * Second form is to disable old-style queries in any case. + */ +/* +#define _STLP_USE_OLD_HP_ITERATOR_QUERIES +#define _STLP_NO_OLD_HP_ITERATOR_QUERIES +*/ + + +/* + * On systems with support of large files (_LARGEFILE_SOURCE, + * _LARGEFILE64_SOURCE defined) we will use 64-bit file offset, even if + * __USE_FILE_OFFSET64 or _FILE_OFFSET_BITS not defined or _FILE_OFFSET_BITS + * less than 64. In the last case sizeof(std::streamoff) may not be equal to + * sizeof(off_t); if you want to force equal size of off_t and streamoff, + * uncomment macro below. But pay attention, this has influence on libstlport + * and in future usage it may cause conflict with defined _FILE_OFFSET_BITS macro. + */ + +/* +#define _STLP_USE_DEFAULT_FILE_OFFSET +*/ + +/* + * _STLP_USE_STDIO_IO, _STLP_USE_UNIX_IO: force selection of stdio calls + * (fopen/flose/fread/fwrite) under fstream buffers or unistd calls + * (open/close/read/write + mmap). On systems that have both (i.e. most Unixes) + * _STLP_USE_UNIX_IO is used. + * + * There is a third variant for Windows: _STLP_USE_WIN32_IO, that based + * on Windows calls (CreateFile/CloseHandle/ReadFile/WriteFile + CreateFileMapping, + * MapViewOfFile) + * + * Uncomment only one define here! + */ +/* +#define _STLP_USE_UNIX_IO +*/ +/* +#define _STLP_USE_STDIO_IO +*/ +/* +#define _STLP_USE_WIN32_IO + */ + +/*==========================================================================*/ + +/* This section contains swithes which should be off by default, + * but so few compilers would have it undefined, so that we set them here, + * with the option to be turned off later in compiler-specific file + */ + +//#define _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT +#define _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT + +/*==========================================================================*/ + +#if defined(__sun) && defined(__GNUC__) +/* __SunOS_5_x is not defined in headers, and there is no way to derive it from headers only; + * nevertheless this macro defined automagically by SunPro compilers family; + * + * gcc know nothing about it, but defining it with -D on compiler command line + * is a bad idea from one side, and this info still useful when we want to use + * (or don't use) some Solaris version-specific features from other side. + * Of course, the best way is to define it in spec file, but this is beyond our scope. + * + * Uncomment ONE of the following, depends on what Solaris version you use. + */ + +/* +#define __SunOS_5_5_1 + */ +/* +#define __SunOS_5_6 + */ +/* +#define __SunOS_5_7 + */ +/* +#define __SunOS_5_8 + */ +/* +#define __SunOS_5_9 + */ +/* +#define __SunOS_5_10 + */ +#endif + +#if defined(__sun) +/* With following patches Solaris 8 and 9 will have *l and *f (long double and float) + * variants of math functions: + * SunOS 5.8 patch 111721-04 (May/08/2003) + * + * SunOS 5.9 patch 111722-04 (May/08/2003) + * + * Solaris 10 has this functions from box. + */ +/* +#define _STLP_SOLARIS_MATH_PATCH + */ +#endif + +/* + Local Variables: + mode:C++ + End: +*/ diff --git a/sdk/tlibstdcxx/stlport/stl/config/stl_confix.h b/sdk/tlibstdcxx/stlport/stl/config/stl_confix.h new file mode 100644 index 0000000000..22e5df8e91 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/stl_confix.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * STLport configuration file + * It is internal STLport header - DO NOT include it directly + * Purpose of this file : to define STLport settings that depend on + * compiler flags or can be otherwise missed + * + */ + +#ifndef _STLP_CONFIX_H +#define _STLP_CONFIX_H + +/* If, by any chance, C compiler gets there, try to help it to pass smoothly */ +#if ! defined (__cplusplus) && ! defined (_STLP_HAS_NO_NAMESPACES) +# define _STLP_HAS_NO_NAMESPACES +#endif + +#if defined (__MINGW32__) +# define _STLP_NO_DRAND48 +#endif + +/* Modena C++ library */ +#if defined (__MWERKS__) && __MWERKS__ <= 0x2303 || (defined (__KCC) && __KCC_VERSION < 3400) +# include +# define _STLP_USE_MSIPL 1 +# if defined (__KCC) || (defined(__MSL_CPP__) && \ + ( (__MSL_CPP__ >= 0x5000 && defined( _MSL_NO_MESSAGE_FACET )) || \ + (__MSL_CPP__ < 0x5000 && defined( MSIPL_NL_TYPES )))) +# define _STLP_NO_NATIVE_MESSAGE_FACET 1 +# endif +#endif + +/* common switches for EDG front-end */ +/* __EDG_SWITCHES do not seem to be an official EDG macro. + * We keep it for historical reason. */ +#if defined (__EDG_SWITCHES) +# if !(defined(_TYPENAME) || defined (_TYPENAME_IS_KEYWORD)) +# undef _STLP_NEED_TYPENAME +# define _STLP_NEED_TYPENAME 1 +# endif +# ifndef _WCHAR_T_IS_KEYWORD +# undef _STLP_NO_WCHAR_T +# define _STLP_NO_WCHAR_T 1 +# endif +# ifndef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES +# undef _STLP_NO_CLASS_PARTIAL_SPECIALIZATION +# define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 +# endif +# ifndef _MEMBER_TEMPLATES +# undef _STLP_NO_MEMBER_TEMPLATES +# define _STLP_NO_MEMBER_TEMPLATES 1 +# undef _STLP_NO_MEMBER_TEMPLATE_CLASSES +# define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 +# endif +# ifndef _MEMBER_TEMPLATE_KEYWORD +# undef _STLP_NO_MEMBER_TEMPLATE_KEYWORD +# define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 +# endif +# if !defined (__EXCEPTIONS) && ! defined (_EXCEPTIONS) +# undef _STLP_HAS_NO_EXCEPTIONS +# define _STLP_HAS_NO_EXCEPTIONS +# endif +# undef __EDG_SWITCHES +#endif /* EDG */ + +/* __EDG_VERSION__ is an official EDG macro, compilers based + * on EDG have to define it. */ +#if defined (__EDG_VERSION__) +# if !defined (_STLP_SGX_CONFIG) && (__EDG_VERSION__ >= 244) && !defined (_STLP_HAS_INCLUDE_NEXT) +# define _STLP_HAS_INCLUDE_NEXT +# endif +# if (__EDG_VERSION__ <= 240) && !defined (_STLP_DONT_RETURN_VOID) +# define _STLP_DONT_RETURN_VOID +# endif +# if !defined (__EXCEPTIONS) && !defined (_STLP_HAS_NO_EXCEPTIONS) +# define _STLP_HAS_NO_EXCEPTIONS +# endif +# if !defined (__NO_LONG_LONG) && !defined (_STLP_LONG_LONG) +# define _STLP_LONG_LONG long long +# endif +#endif + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/stl_mycomp.h b/sdk/tlibstdcxx/stlport/stl/config/stl_mycomp.h new file mode 100644 index 0000000000..f92902fd2c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/stl_mycomp.h @@ -0,0 +1,282 @@ +/* + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * Purpose of this file : + * + * A list of COMPILER-SPECIFIC portion of STLport settings. + * This file is provided to help in manual configuration + * of STLport. This file is being included by stlcomp.h + * when STLport is unable to identify your compiler. + * Please remove the error diagnostic below before adjusting + * macros. + * + */ +#ifndef _STLP_MYCOMP_H +#define _STLP_MYCOMP_H + +#error "Your compiler version is not recognized by STLport. Please edit " + +//========================================================== + +// the values choosen here as defaults try to give +// maximum functionality on the most conservative settings + +// Mostly correct guess, change it for Alpha (and other environments +// that has 64-bit "long") +// # define _STLP_UINT32_T unsigned long + +// Disables wchar_t functionality +// # define _STLP_NO_WCHAR_T 1 + +// Define if wchar_t is not an intrinsic type, and is actually a typedef to unsigned short. +// # define _STLP_WCHAR_T_IS_USHORT 1 + +// Uncomment if long long is available +// # define _STLP_LONG_LONG long long + +// Uncomment if long double is not available +// # define _STLP_NO_LONG_DOUBLE 1 + +// Uncomment this if your compiler does not support "typename" keyword +// # define _STLP_NEED_TYPENAME 1 + +// Uncomment this if your compiler does not support "mutable" keyword +// # define _STLP_NEED_MUTABLE 1 + +// Uncomment this if your compiler does not support "explicit" keyword +// # define _STLP_NEED_EXPLICIT 1 + +// Uncomment if new-style-casts like const_cast<> are not available +// # define _STLP_NO_NEW_STYLE_CASTS 1 + +// Uncomment this if your compiler does not have "bool" type +// # define _STLP_NO_BOOL 1 + +// Uncomment this if your compiler does not have "bool" type, but has "bool" keyword reserved +// # define _STLP_DONT_USE_BOOL_TYPEDEF 1 + +// Uncomment this if your compiler does not have "bool" type, but defines "bool" in +// # define _STLP_YVALS_H 1 + +// Uncomment this if your compiler has limited or no default template arguments for classes +// # define _STLP_LIMITED_DEFAULT_TEMPLATES 1 + +// Uncomment this if your compiler support only complete (not dependent on other parameters) +// types as default parameters for class templates +// # define _STLP_DEFAULT_TYPE_PARAM 1 + +// Uncomment this if your compiler do not support default parameters in template class methods +// # define _STLP_DONT_SUP_DFLT_PARAM 1 + +// Uncomment this if your compiler has problem with not-type +// default template parameters +// # define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 + +// Define if compiler has +// trouble with functions getting non-type-parameterized classes as parameters +// # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 + +// Uncomment this if your compiler does not support namespaces +// # define _STLP_HAS_NO_NAMESPACES 1 + +// Uncomment if "using" keyword does not work with template types +// # define _STLP_BROKEN_USING_DIRECTIVE 1 + +// Uncomment this if your compiler does not support exceptions +// # define _STLP_HAS_NO_EXCEPTIONS 1 + +// Uncomment this when you are able to detect that the user do not +// want to use the exceptions feature. +// # define _STLP_DONT_USE_EXCEPTIONS 1 + +// Uncomment this if your compiler does not support exception specifications +// # define _STLP_NO_EXCEPTION_SPEC + +// Define this if your compiler requires return statement after throw() +// # define _STLP_THROW_RETURN_BUG 1 + +// Define this if your compiler do not support return of void +// # define _STLP_DONT_RETURN_VOID 1 + +// Header that comes with the compiler +// does not define bad_alloc exception +// # define _STLP_NO_BAD_ALLOC 1 + +// Define this if your compiler do not throw bad_alloc from the new operator +// # define _STLP_NEW_DONT_THROW_BAD_ALLOC 1 + +// Define this if your compiler has no rtti support or if it has been disabled +// # define _STLP_NO_RTTI 1 + +// Define this if there is no native type_info definition +// # define _STLP_NO_TYPEINFO 1 + +// Uncomment if member template methods are not available +// # define _STLP_NO_MEMBER_TEMPLATES 1 + +// Uncomment if member template classes are not available +// # define _STLP_NO_MEMBER_TEMPLATE_CLASSES 1 + +// Uncomment if your compiler do not support the std::allocator rebind technique +// This is a special case of bad member template classes support, it is automatically +// defined if _STLP_NO_MEMBER_TEMPLATE_CLASSES is defined. +// # define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 + +// Uncomment if no "template" keyword should be used with member template classes +// # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD 1 + +// Compiler does not accept friend declaration qualified with namespace name. +// # define _STLP_NO_QUALIFIED_FRIENDS 1 + +// Uncomment if partial specialization is not available +// # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION 1 + +// Define if class being partially specialized require full name (template parameters) +// of itself for method declarations +// # define _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS + +// Compiler has problem with qualified specializations (cont int, volatile int...) +// # define _STLP_QUALIFIED_SPECIALIZATION_BUG + +// Compiler has problems specializing members of partially +// specialized class +// # define _STLP_MEMBER_SPECIALIZATION_BUG + +// Uncomment if partial order of template functions is not available +// # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER 1 + +// Uncomment if specialization of methods is not allowed +// # define _STLP_NO_METHOD_SPECIALIZATION 1 + +// Uncomment if full specialization does not use partial spec. syntax : template <> struct .... +// # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 1 + +// Uncomment if compiler does not support explicit template arguments for functions +// # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS + +// Uncomment this if your compiler can't inline while(), for() +// # define _STLP_LOOP_INLINE_PROBLEMS 1 + +// Define if the compiler fails to match a template function argument of base +// # define _STLP_BASE_MATCH_BUG 1 + +// Define if the compiler fails to match a template function argument of base +// (non-template) +//# define _STLP_NONTEMPL_BASE_MATCH_BUG 1 + +// Define if the compiler rejects outline method definition +// explicitly taking nested types/typedefs +// # define _STLP_NESTED_TYPE_PARAM_BUG 1 + +// Compiler requires typename keyword on outline method definition +// explicitly taking nested types/typedefs +// #define _STLP_TYPENAME_ON_RETURN_TYPE + +// Define if the baseclass typedefs not visible from outside +// # define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 + +// if your compiler have serious problems with typedefs, try this one +// # define _STLP_BASE_TYPEDEF_BUG 1 + +// Uncomment if getting errors compiling mem_fun* adaptors +// # define _STLP_MEMBER_POINTER_PARAM_BUG 1 + +// Uncomment if the compiler can't handle a constant-initializer in the +// declaration of a static const data member of integer type. +// (See section 9.4.2, paragraph 4, of the C++ standard.) +// # define _STLP_STATIC_CONST_INIT_BUG + +// Uncomment to indicate that the compiler do not like static constant +// definition. +// Meaningfull only if _STLP_STATIC_CONST_INIT_BUG is not defined. +// # define _STLP_NO_STATIC_CONST_DEFINITION + +// Define if default constructor for builtin integer type fails to initialize it to 0 +// In expression like new(&char) char(): +//# define _STLP_DEF_CONST_PLCT_NEW_BUG 1 +// In default function parameter like _M_method(_Tp __x = _Tp()) +//# define _STLP_DEF_CONST_DEF_PARAM_BUG 1 + +// Defined if constructor +// required to explicitly call member's default constructors for const objects +// # define _STLP_CONST_CONSTRUCTOR_BUG 1 + +// Defined if the compiler has trouble calling POD-types constructors/destructors +// # define _STLP_TRIVIAL_CONSTRUCTOR_BUG 1 +// # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1 + +// Define if having problems specializing maps/sets with +// key type being const +// # define _STLP_MULTI_CONST_TEMPLATE_ARG_BUG + +// Uncomment this to disable -> operators on all iterators +// # define _STLP_NO_ARROW_OPERATOR 1 + +// Uncomment this to disble at() member functions for containers +// # define _STLP_NO_AT_MEMBER_FUNCTION 1 + +// Define this if compiler lacks header +// # define _STLP_NO_EXCEPTION_HEADER 1 + +// Uncomment this if your C library has lrand48() function +// # define _STLP_RAND48 1 + +// Uncomment if native new-style C library headers lile , etc are not available. +// # define _STLP_HAS_NO_NEW_C_HEADERS 1 + +// uncomment if new-style headers is available +// # define _STLP_HAS_NEW_NEW_HEADER 1 + +// uncomment this if and other STD headers put their stuff in ::namespace, +// not std:: +// # define _STLP_VENDOR_GLOBAL_STD + +// uncomment this if and the like put stuff in ::namespace, +// not std:: +// # define _STLP_VENDOR_GLOBAL_CSTD + +// uncomment this if your compiler consider as ambiguous a function imported within +// the stlport namespace and called without scope (:: or std::) +// # define _STLP_NO_USING_FOR_GLOBAL_FUNCTIONS 1 + +// uncomment this if your compiler define all the C math functions C++ additional +// overloads in ::namespace and not only in std::. +// # define _STLP_HAS_GLOBAL_C_MATH_FUNCTIONS 1 + +// Edit relative path below (or put full path) to get native +// compiler headers included. Default is "../include". +// C headers may reside in different directory, so separate macro is provided. +// Hint : never install STLport in the directory that ends with "include" +// # define _STLP_NATIVE_INCLUDE_PATH ../include +// # define _STLP_NATIVE_C_INCLUDE_PATH ../include +// # define _STLP_NATIVE_CPP_C_INCLUDE_PATH ../include + +// This macro constructs header path from directory and name. +// You may change it if your compiler does not understand "/". +// # define _STLP_MAKE_HEADER(path, header) + +// This macro constructs native include header path from include path and name. +// You may have do define it if experimenting problems with preprocessor +// # define _STLP_NATIVE_HEADER(header) _STLP_MAKE_HEADER(_STLP_NATIVE_INCLUDE_PATH,header) + +// Same for C headers +// #define _STLP_NATIVE_C_HEADER(header) + +//========================================================== +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/config/user_config.h b/sdk/tlibstdcxx/stlport/stl/config/user_config.h new file mode 100644 index 0000000000..01863b8565 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/config/user_config.h @@ -0,0 +1,326 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +/* + * Purpose of this file : + * + * To hold user-definable portion of STLport settings which may be overridden + * on per-project basis. + * Please note that if you use STLport iostreams (compiled library) then you have + * to use consistent settings when you compile STLport library and your project. + * Those settings are defined in host.h and have to be the same for a given + * STLport installation. + */ + + +/*========================================================== + * User-settable macros that control compilation: + * Features selection + *==========================================================*/ + +/* + * Use this switch for embedded systems where no iostreams are available + * at all. STLport own iostreams will also get disabled automatically then. + * You can either use STLport iostreams, or no iostreams. + * If you want iostreams, you have to compile library in ../build/lib + * and supply resulting library at link time. + */ +/* +#define _STLP_NO_IOSTREAMS 1 +*/ + +/* + * Set _STLP_DEBUG to turn the "Debug Mode" on. + * That gets you checked iterators/ranges in the manner + * of "Safe STL". Very useful for debugging. Thread-safe. + * Please do not forget to link proper STLport library flavor + * (e.g libstlportstlg.so or libstlportstlg.a) when you set this flag + * in STLport iostreams mode, namespace customization guaranty that you + * link to the right library. + */ +/* +#define _STLP_DEBUG 1 +*/ +/* + * You can also choose the debug level: + * STLport debug level: Default value + * Check only what the STLport implementation consider as invalid. + * It also change the iterator invalidation schema. + * Standard debug level: Check for all operations the standard consider as "undefined behavior" + * even if STlport implement it correctly. It also invalidates iterators + * more often. + */ +/* +#define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL +#define _STLP_DEBUG_LEVEL _STLP_STANDARD_DBG_LEVEL +*/ +/* When an inconsistency is detected by the 'safe STL' the program will abort. + * If you prefer an exception define the following macro. The thrown exception + * will be the Standard runtime_error exception. + */ +/* +#define _STLP_DEBUG_MODE_THROWS + */ + +/* + * _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream + * classes with custom types (which is most likely the case). Custom means types + * other than char, wchar_t, char_traits<> and allocator<> like + * basic_ostream > or + * basic_string, my_allocator > + * When this option is on, most non-inline template functions definitions for iostreams + * are not seen by the client which saves a lot of compile time for most compilers, + * also object and executable size for some. + * Default is off, just not to break compilation for those who do use those types. + * That also guarantees that you still use optimized standard i/o when you compile + * your program without optimization. Option does not affect STLport library build; you + * may use the same binary library with and without this option, on per-project basis. + */ +/* +#define _STLP_NO_CUSTOM_IO +*/ + +/* + * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational + * operator templates (>, <=, >=, !=) in namespace std::rel_ops, even + * if the compiler supports namespaces. + * Note : if the compiler do not support namespaces, those operators are not be provided by default, + * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity. + */ +/* +#define _STLP_NO_RELOPS_NAMESPACE 1 +*/ + +/* + * If STLport use its own namespace, see _STLP_NO_OWN_NAMESPACE in host.h, it will try + * by default to rename std:: for the user to stlport::. If you do not want this feature, + * please define the following switch and then use stlport:: + */ +/* +#define _STLP_DONT_REDEFINE_STD 1 +*/ + +/* + * _STLP_WHOLE_NATIVE_STD : only meaningful if STLport uses its own namespace. + * Normally, STLport only imports necessary components from native std:: namespace. + * You might want everything from std:: being available in std:: namespace when you + * include corresponding STLport header (like STLport provides std::map as well, etc.), + * if you are going to use both stlport:: and std:: components in your code. + * Otherwise this option is not recommended as it increases the size of your object files + * and slows down compilation. + * Beware, if you do not use STLport iostream (_STLP_NO_IOSTREAMS above), ask STLport to + * not rename std:: in stlport:: and try to have access to whole native Standard stuff then + * STLport will only throw exceptions from the std namespace and not from stlport. + * For instance a problem in stlport::vector::at will throw a std::out_of_range exception + * and not a stlport::out_of_range. + * Notice that STLport exceptions inherits from std::exception. + */ +/* +#define _STLP_WHOLE_NATIVE_STD +*/ + +/* + * Use this option to catch uninitialized members in your classes. + * When it is set, construct() and destroy() fill the class storage + * with _STLP_SHRED_BYTE (see below). + * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically. + */ +/* +#define _STLP_DEBUG_UNINITIALIZED 1 +#define _STLP_DEBUG_ALLOC 1 +*/ + +/* + * Uncomment and provide a definition for the byte with which raw memory + * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined. + * Choose a value which is likely to cause a noticeable problem if dereferenced + * or otherwise abused. A good value may already be defined for your platform. + */ +/* +#define _STLP_SHRED_BYTE 0xA3 +*/ + +/* + * This option is for gcc users only and only affects systems where native linker + * does not let gcc to implement automatic instantiation of static template data members/ + * It is being put in this file as there is no way to check if we are using GNU ld automatically, + * so it becomes user's responsibility. + */ +/* +#define _STLP_GCC_USES_GNU_LD +*/ + +/*========================================================== + * Compatibility section + *==========================================================*/ + +/* + * Define this macro to disable anachronistic constructs (like the ones used in HP STL and + * not included in final standard, etc. + */ +/* +#define _STLP_NO_ANACHRONISMS 1 +*/ + +/* + * Define this macro to disable STLport extensions (for example, to make sure your code will + * compile with some other implementation ) + */ + +#define _STLP_NO_EXTENSIONS 1 + + +/* + * You should define this macro if compiling with MFC - STLport + * then include instead of to get synchronisation primitives + */ +/* +#define _STLP_USE_MFC 1 +*/ + +/* + * boris : this setting is here as we cannot detect precense of new Platform SDK automatically + * If you are using new PSDK with VC++ 6.0 or lower, + * please define this to get correct prototypes for InterlockedXXX functions + */ +/* +#define _STLP_NEW_PLATFORM_SDK 1 +*/ + +/* + * For the same reason as the one above we are not able to detect easily use + * of the compiler coming with the Platform SDK instead of the one coming with + * a Microsoft Visual Studio release. This change native C/C++ library location + * and implementation, please define this to get correct STLport configuration. + */ +/* +#define _STLP_USING_PLATFORM_SDK_COMPILER 1 +*/ + +/* + * Some compilers support the automatic linking feature. + * Uncomment the following if you prefer to specify the STLport library + * to link with yourself. + * For the moment, this feature is only supported and implemented within STLport + * by the Microsoft compilers. + */ +/* +#define _STLP_DONT_USE_AUTO_LINK 1 +*/ + +/* + * If you customize the STLport generated library names don't forget to give + * the motif you used during configuration here if you still want the auto link + * to work. (Do not remove double quotes in the macro value) + */ +/* +#define _STLP_LIB_NAME_MOTIF "???" + */ + +/* + * Uncomment to get feedback at compilation time about result of build environment + * introspection. + */ +/* +#define _STLP_VERBOSE 1 +*/ + +/* + * Use minimum set of default arguments on template classes that have more + * than one - for example map<>, set<>. + * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on. + * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile + * set with those compilers, but you'll have to use __set__> + * + * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>, + * queue<>, priority_queue<>, stack<>, istream_iterator<> + */ +/* +#define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1 +*/ + +/* + * The agregation of strings using the + operator is an expensive operation + * as it requires construction of temporary objects that need memory allocation + * and deallocation. The problem can be even more important if you are adding + * several strings together in a single expression. To avoid this problem STLport + * implement expression template. With this technique addition of 2 strings is not + * a string anymore but a temporary object having a reference to each of the + * original strings involved in the expression. This object carry information + * directly to the destination string to set its size correctly and only make + * a single call to the allocator. This technique also works for the addition of + * N elements where elements are basic_string, C string or a single character. + * The drawback can be longer compilation time and bigger executable size. + * Another problem is that some compilers (gcc) fail to use string proxy object + * if do with class derived from string (see unit tests for details). + * STLport rebuild: Yes + */ +/* +#define _STLP_USE_TEMPLATE_EXPRESSION 1 +*/ + + +/* + * By default the STLport basic_string implementation use a little static buffer + * (of 16 chars when writing this doc) to avoid systematically memory allocation + * in case of little basic_string. The drawback of such a method is bigger + * basic_string size and some performance penalty for method like swap. If you + * prefer systematical dynamic allocation turn on this macro. + * STLport rebuild: Yes + */ +/* +#define _STLP_DONT_USE_SHORT_STRING_OPTIM 1 +*/ + +/* + * To reduce the famous code bloat trouble due to the use of templates STLport grant + * a specialization of some containers for pointer types. So all instanciations + * of those containers with a pointer type will use the same implementation based on + * a container of void*. This feature has shown very good result on object files size + * but after link phase and optimization you will only experiment benefit if you use + * many container with pointer types. + * There are however a number of limitation to use this option: + * - with compilers not supporting partial template specialization feature, you won't + * be able to access some nested container types like iterator as long as the + * definition of the type used to instanciate the container will be incomplete + * (see IncompleteClass definition in test/unit/vector_test.cpp). + * - you won't be able to use complex Standard allocator implementations which are + * allocators having pointer nested type not being a real C pointer. + */ +/* +#define _STLP_USE_PTR_SPECIALIZATIONS 1 +*/ + +/* + * To achieve many different optimizations within the template implementations STLport + * uses some type traits technique. With this macro you can ask STLport to use the famous + * boost type traits rather than the internal one. The advantages are more compiler + * integration and a better support. If you only define this macro once the STLport has been + * built you just have to add the boost install path within your include path. If you want + * to use this feature at STLport built time you will have to define the + * STLP_BUILD_BOOST_PATH enrironment variable with the value of the boost library path. + */ + +/* +#define _STLP_USE_BOOST_SUPPORT 1 +*/ + + +/*==========================================================*/ + +/* + Local Variables: + mode: C++ + End: +*/ diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_debug.c b/sdk/tlibstdcxx/stlport/stl/debug/_debug.c new file mode 100644 index 0000000000..99d5c6b242 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_debug.c @@ -0,0 +1,628 @@ +/* + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_DEBUG_C +#define _STLP_DEBUG_C + +#if defined (_STLP_DEBUG) +#if defined (_STLP_THREADS) +# if !defined (_STLP_NEED_MUTABLE) +# define _STLP_ACQUIRE_LOCK(_Lock) _Lock._M_acquire_lock(); +# define _STLP_RELEASE_LOCK(_Lock) _Lock._M_release_lock(); +# else +# define _STLP_ACQUIRE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_acquire_lock(); +# define _STLP_RELEASE_LOCK(_Lock) ((_STLP_mutex&)_Lock)._M_release_lock(); +# endif /* _STLP_NEED_MUTABLE */ +#else +# define _STLP_ACQUIRE_LOCK(_Lock) +# define _STLP_RELEASE_LOCK(_Lock) +#endif /* _STLP_THREADS */ + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +//========================================================== +// global non-inline functions +//========================================================== +// [ i1, i2) +#if !defined (__DMC__) +template +inline bool _STLP_CALL +stlp_in_range_aux(const _Iterator& __it, const _Iterator& __first, + const _Iterator& __last, const random_access_iterator_tag &) { + return ( __it >= __first && + __it < __last); +} +#endif + +template +#if defined (_STLP_MSVC) +inline bool _STLP_CALL stlp_in_range_aux(_Iterator1 __it, const _Iterator& __first, +#else +inline bool _STLP_CALL stlp_in_range_aux(const _Iterator1& __it, const _Iterator& __first, +#endif + const _Iterator& __last, const forward_iterator_tag &) { + _Iterator1 __i(__first); + for (; __i != __last && __i != __it; ++__i); + return (__i != __last); +} + +#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG) +template +inline bool _STLP_CALL +stlp_in_range_aux(const _Iterator1& __it, const _Iterator& __first, + const _Iterator& __last, const bidirectional_iterator_tag &) { + _Iterator1 __i(__first); + for (; __i != __last && __i != __it; ++__i); + return (__i != __last); +} +#endif + +template +bool _STLP_CALL __check_range_aux(const _Iterator& __first, const _Iterator& __last, + const __false_type& /*_IsIntegral*/) { + _STLP_VERBOSE_RETURN(__valid_range(__first,__last), _StlMsg_INVALID_RANGE ) + return true; +} + +template +bool _STLP_CALL __check_range_aux(_Integral /*__first*/, _Integral /*__last*/, + const __true_type& /*_IsIntegral*/) +{ return true; } + +template +bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last) { + typedef typename _IsIntegral<_Iterator>::_Ret _Integral; + return __check_range_aux(__first, __last, _Integral()); +} + +template +bool _STLP_CALL __check_range(const _Iterator& __it, + const _Iterator& __start, const _Iterator& __finish) { + _STLP_VERBOSE_RETURN(stlp_in_range(__it, __start, __finish), + _StlMsg_NOT_IN_RANGE_1) + return true; +} + +template +bool _STLP_CALL __check_range(const _Iterator& __first, const _Iterator& __last, + const _Iterator& __start, const _Iterator& __finish) { + _STLP_VERBOSE_RETURN(stlp_in_range(__first, __last, __start, __finish), + _StlMsg_NOT_IN_RANGE_2) + return true; +} + +template +bool _STLP_CALL __check_ptr_range(const _Tp* __first, const _Tp* __last) { + _STLP_VERBOSE_RETURN((__first != 0 || __last == 0), _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_RETURN(__valid_range(__first, __last, random_access_iterator_tag()), + _StlMsg_INVALID_RANGE) + return true; +} + +//=============================================================== +template +void _STLP_CALL __invalidate_range(const __owned_list* __base, + const _Iterator& __first, + const _Iterator& __last) { + typedef __owned_link _L_type; + _STLP_ACQUIRE_LOCK(__base->_M_lock) + _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node); + _L_type* __pos = __prev->_M_next; + + while (__pos != 0) { + if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) && + stlp_in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator, + __first._M_iterator, __last._M_iterator, + _STLP_ITERATOR_CATEGORY(__first, _Iterator))) { + __pos->_M_owner = 0; + __prev->_M_next = __pos->_M_next; + } + else { + __prev = __pos; + } + __pos = __prev->_M_next; + } + _STLP_RELEASE_LOCK(__base->_M_lock) +} + +template +void _STLP_CALL __invalidate_iterator(const __owned_list* __base, + const _Iterator& __it) { + typedef __owned_link _L_type; + _STLP_ACQUIRE_LOCK(__base->_M_lock) + _L_type* __prev = __CONST_CAST(_L_type*, &__base->_M_node); + _L_type* __pos = __prev->_M_next; + while (__pos != 0) { + // this requires safe iterators to be derived from __owned_link + if ((__pos != __STATIC_CAST(const _L_type*, &__it)) && + (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) { + __pos->_M_owner = 0; + __prev->_M_next = __pos->_M_next; + } + else { + __prev = __pos; + } + __pos = __prev->_M_next; + } + _STLP_RELEASE_LOCK(__base->_M_lock) +} + +template +void _STLP_CALL __change_range_owner(const _Iterator& __first, + const _Iterator& __last, + const __owned_list* __dst) { + if (__first._Owner() == __dst) + return; + + typedef __owned_link _L_type; + // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here + //_STLP_ACQUIRE_LOCK(__base->_M_lock) + __owned_list *__base = __CONST_CAST(__owned_list*, __first._Owner()); + _L_type* __src_prev = &__base->_M_node; + _L_type* __pos = __src_prev->_M_next; + _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node); + + while (__pos != 0) { + if (!(&__first == __STATIC_CAST(_Iterator*, __pos) || &__last == __STATIC_CAST(_Iterator*, __pos)) && + stlp_in_range_aux(__STATIC_CAST(_Iterator*, __pos)->_M_iterator, + __first._M_iterator, __last._M_iterator, + _STLP_ITERATOR_CATEGORY(__first, _Iterator))) { + __pos->_M_owner = __CONST_CAST(__owned_list*, __dst); + //remove __pos from __base: + __src_prev->_M_next = __pos->_M_next; + //add __pos to __dst: + __pos->_M_next = __dst_prev->_M_next; + __dst_prev->_M_next = __pos; + } + else { + __src_prev = __pos; + } + __pos = __src_prev->_M_next; + } + +#if defined(_STLP_WCE) && defined(_ARM_) + // Note: This part is needed for compiling under Windows CE under ARM and correctly using + // _STLP_DEBUG mode. This comes from a bug in the ARM compiler where checked iterators that + // are passed by value are not copied over correctly. When __change_range_owner is called, + // e.g. in std::list::splice() the wrong _M_owner field gets modified and the __first + // iterator has the old _M_owner field, but was moved to the new __owned_list. Setting + // the first iterator's _M_owner field fixes this. Ugly but works. + __pos = __CONST_CAST(_Iterator*, &__first); + __pos->_M_owner = __CONST_CAST(__owned_list*, __dst); +#endif + //_STLP_RELEASE_LOCK(__base->_M_lock) +} + +template +void _STLP_CALL __change_ite_owner(const _Iterator& __it, + const __owned_list* __dst) { + if (__it._Owner() == __dst) + return; + + typedef __owned_link _L_type; + // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here + //_STLP_ACQUIRE_LOCK(__base->_M_lock) + __owned_list *__base = __CONST_CAST(__owned_list*, __it._Owner()); + _L_type* __prev = &__base->_M_node; + _L_type* __pos = __prev->_M_next; + _L_type* __dst_prev = __CONST_CAST(_L_type*, &__dst->_M_node); + + while (__pos != 0) { + // this requires safe iterators to be derived from __owned_link + if ((__pos != __STATIC_CAST(const _L_type*, &__it)) && + (__STATIC_CAST(_Iterator*, __pos)->_M_iterator == __it._M_iterator)) { + __pos->_M_owner = __CONST_CAST(__owned_list*, __dst); + //remove __pos from __base: + __prev->_M_next = __pos->_M_next; + //add __pos to __dst: + __pos->_M_next = __dst_prev->_M_next; + __dst_prev->_M_next = __pos; + } + else { + __prev = __pos; + } + __pos = __prev->_M_next; + } + //_STLP_RELEASE_LOCK(__base->_M_lock) +} + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +#endif /* _STLP_DEBUG */ + +#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) + +# ifndef _STLP_INTERNAL_CSTDLIB +# include +# endif + +//========================================================== +// .c section +// owned_list non-inline methods and global functions +//========================================================== + +# if defined (_STLP_ASSERTIONS) + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +# if !defined (_STLP_STRING_LITERAL) +# define _STLP_STRING_LITERAL(__x) __x +# endif + +# if defined (_STLP_USE_WIDE_INTERFACE) +// note: WinCE needs this to format single-byte strings in __stl_debug_engine::_Message +# define _STLP_PERCENT_S "%hs" +# else +# define _STLP_PERCENT_S "%s" +# endif /* _STLP_USE_WIDE_INTERFACE */ + +# define _STLP_MESSAGE_TABLE_BODY = { \ +_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error: " _STLP_PERCENT_S "\n"), \ +_STLP_STRING_LITERAL(_STLP_PERCENT_S "(%d): STL assertion failure : " _STLP_PERCENT_S "\n" _STLP_ASSERT_MSG_TRAILER), \ +_STLP_STRING_LITERAL("\n" _STLP_PERCENT_S "(%d): STL error : " _STLP_PERCENT_S "\n" _STLP_PERCENT_S "(%d): STL assertion failure: " _STLP_PERCENT_S " \n" _STLP_ASSERT_MSG_TRAILER), \ +_STLP_STRING_LITERAL("Invalid argument to operation (see operation documentation)"), \ +_STLP_STRING_LITERAL("Taking an iterator out of destroyed (or otherwise corrupted) container"), \ +_STLP_STRING_LITERAL("Trying to extract an object out from empty container"),\ +_STLP_STRING_LITERAL("Past-the-end iterator could not be erased"), \ +_STLP_STRING_LITERAL("Index out of bounds"), \ +_STLP_STRING_LITERAL("Container doesn't own the iterator"), \ +_STLP_STRING_LITERAL("Container is owner of the iterator, but should not"), \ +_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) iterator used"), \ +_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) lefthand iterator in expression"), \ +_STLP_STRING_LITERAL("Uninitialized or invalidated (by mutating operation) righthand iterator in expression"), \ +_STLP_STRING_LITERAL("Iterators used in expression are from different owners"), \ +_STLP_STRING_LITERAL("Iterator could not be dereferenced (past-the-end ?)"), \ +_STLP_STRING_LITERAL("Range [first,last) is invalid"), \ +_STLP_STRING_LITERAL("Iterator is not in range [first,last)"), \ +_STLP_STRING_LITERAL("Range [first,last) is not in range [start,finish)"), \ +_STLP_STRING_LITERAL("The advance would produce invalid iterator"), \ +_STLP_STRING_LITERAL("Iterator is singular (advanced beyond the bounds ?)"), \ +_STLP_STRING_LITERAL("Invalid strict weak ordering predicate, if pred(a, b) then we should have !pred(b, a)"), \ +_STLP_STRING_LITERAL("Invalid equivalent predicate, if pred(a, b) then we should have pred(b, a)"), \ +_STLP_STRING_LITERAL("Memory block deallocated twice"), \ +_STLP_STRING_LITERAL("Deallocating a block that was never allocated"), \ +_STLP_STRING_LITERAL("Deallocating a memory block allocated for another type"), \ +_STLP_STRING_LITERAL("Size of block passed to deallocate() doesn't match block size"), \ +_STLP_STRING_LITERAL("Pointer underrun - safety margin at front of memory block overwritten"), \ +_STLP_STRING_LITERAL("Pointer overrrun - safety margin at back of memory block overwritten"), \ +_STLP_STRING_LITERAL("Attempt to dereference null pointer returned by auto_ptr::get()"), \ +_STLP_STRING_LITERAL("Memory allocation function returned a wrongly align memory block"), \ +_STLP_STRING_LITERAL("Unknown problem") \ + } + +template +const char* __stl_debug_engine<_Dummy>::_Message_table[_StlMsg_MAX] _STLP_MESSAGE_TABLE_BODY; + +# undef _STLP_STRING_LITERAL +# undef _STLP_PERCENT_S + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +# if !defined (_STLP_DEBUG_MESSAGE) +# ifndef _STLP_INTERNAL_CSTDARG +# include +# endif +# ifndef _STLP_INTERNAL_CSTDIO +# include +# endif +# if defined (_STLP_DEBUG_MODE_THROWS) && !defined (_STLP_RANGE_ERRORS_H) +# include +# endif + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) { + STLPORT_CSTD::va_list __args; + va_start( __args, __format_str ); + +# if !defined (_STLP_DEBUG_MODE_THROWS) +# if defined (_STLP_USE_WIDE_INTERFACE) + TCHAR __buffer[512]; + int _convert = strlen(__format_str) + 1; + LPWSTR _lpw = (LPWSTR)alloca(_convert * sizeof(wchar_t)); + _lpw[0] = '\0'; + MultiByteToWideChar(GetACP(), 0, __format_str, -1, _lpw, _convert); + wvsprintf(__buffer, _lpw, __args); + _STLP_WINCE_TRACE(__buffer); +# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL)) + char __buffer [4096]; + +# if !defined (_STLP_USE_SAFE_STRING_FUNCTIONS) + vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args); +# else + vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args); +# endif + + OutputDebugStringA(__buffer); + +# elif defined (__amigaos__) + STLPORT_CSTD::vfprintf(stderr, __format_str, (char *)__args); +# else + STLPORT_CSTD::vfprintf(stderr, __format_str, __args); +# endif +# else + char __buffer[4096]; + +# if defined (_STLP_USE_SAFE_STRING_FUNCTIONS) + vsnprintf_s(__buffer, _STLP_ARRAY_SIZE(__buffer), _TRUNCATE, __format_str, __args); +# elif defined (_STLP_WIN32) && (defined(_STLP_MSVC) || defined (__ICL)) + vsnprintf(__buffer, _STLP_ARRAY_SIZE(__buffer), __format_str, __args); +# else + vsprintf(__buffer, __format_str, __args); +# endif +# endif + +# ifdef _STLP_DEBUG_MESSAGE_POST + _STLP_DEBUG_MESSAGE_POST +# endif + + va_end(__args); + +# if defined (_STLP_DEBUG_MODE_THROWS) + __stl_throw_runtime_error(__buffer); +# endif +} + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +# else +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Message(const char * __format_str, ...) +{} +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE +# endif /* _STLP_DEBUG_MESSAGE */ + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_IndexedError(int __error_ind, const char* __f, int __l) { + __stl_debug_message(_Message_table[_StlFormat_ERROR_RETURN], + __f, __l, _Message_table[__error_ind]); +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l) { + __stl_debug_message(_Message_table[_StlFormat_VERBOSE_ASSERTION_FAILURE], + __f, __l, _Message_table[__error_ind], __f, __l, __expr); + __stl_debug_terminate(); +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Assert(const char* __expr, const char* __f, int __l) { + __stl_debug_message(_Message_table[_StlFormat_ASSERTION_FAILURE],__f, __l, __expr); + __stl_debug_terminate(); +} + +// if exceptions are present, sends unique exception +// if not, calls abort() to terminate +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Terminate() +{ _STLP_ABORT(); } + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +# endif /* _STLP_ASSERTIONS */ + +# if defined (_STLP_DEBUG) + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +//========================================================== +// owned_list non-inline methods +//========================================================== + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Invalidate_all(__owned_list* __l) { + _STLP_ACQUIRE_LOCK(__l->_M_lock); + _Stamp_all(__l, 0); + __l->_M_node._M_next =0; + _STLP_RELEASE_LOCK(__l->_M_lock); +} + +// boris : this is unasafe routine; should be used from within critical section only ! +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Stamp_all(__owned_list* __l, __owned_list* __o) { + // crucial + if (__l->_M_node._M_owner) { + for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next; + __pos != 0; __pos = (__owned_link*)__pos->_M_next) { + _STLP_ASSERT(__pos->_Owner()== __l) + __pos->_M_owner=__o; + } + } +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Verify(const __owned_list* __l) { + _STLP_ACQUIRE_LOCK(__l->_M_lock); + if (__l) { + _STLP_ASSERT(__l->_M_node._Owner() != 0) + for (__owned_link* __pos = (__owned_link*)__l->_M_node._M_next; + __pos != 0; __pos = (__owned_link*)__pos->_M_next) { + _STLP_ASSERT(__pos->_Owner()== __l) + } + } + _STLP_RELEASE_LOCK(__l->_M_lock); +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Swap_owners(__owned_list& __x, __owned_list& __y) { + /* + * according to the standard : --no swap() function invalidates any references, + * pointers, or iterators referring to the elements of the containers being swapped. + */ + + __owned_link* __tmp; + + /* + * boris : there is a deadlock potential situation here if we lock two containers sequentially. + * As user is supposed to provide its own synchronization around swap() ( it is unsafe to do any container/iterator access + * in parallel with swap()), we just do not use any locking at all -- that behaviour is closer to non-debug version + */ + + __tmp = __x._M_node._M_next; + + _Stamp_all(&__x, &__y); + _Stamp_all(&__y, &__x); + + __x._M_node._M_next = __y._M_node._M_next; + __y._M_node._M_next = __tmp; +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_Set_owner(__owned_list& __src, __owned_list& __dst) { + if (&__src == &__dst) + return; + + // Check __stl_debug_engine<_Dummy>::_Swap_owners comments to see why there is no lock here + typedef __owned_link _L_type; + _L_type* __prev = &__src._M_node; + _L_type* __pos = __prev->_M_next; + + while (__pos != 0) { + __pos->_M_owner = &__dst; + __prev = __pos; + __pos = __prev->_M_next; + } + __prev->_M_next = __dst._M_node._M_next; + __dst._M_node._M_next = __src._M_node._M_next; + __src._M_node._M_next = 0; +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_M_detach(__owned_list* __l, __owned_link* __c_node) { + if (__l != 0) { + + _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER) + + _STLP_ACQUIRE_LOCK(__l->_M_lock) + // boris : re-test the condition in case someone else already deleted us + if(__c_node->_M_owner != 0) { + __owned_link* __prev, *__next; + + for (__prev = &__l->_M_node; (__next = __prev->_M_next) != __c_node; + __prev = __next) { + _STLP_ASSERT(__next && __next->_Owner() == __l) + } + + __prev->_M_next = __c_node->_M_next; + __c_node->_M_owner=0; + } + _STLP_RELEASE_LOCK(__l->_M_lock) + } +} + +template +void _STLP_CALL +__stl_debug_engine<_Dummy>::_M_attach(__owned_list* __l, __owned_link* __c_node) { + if (__l ==0) { + (__c_node)->_M_owner = 0; + } else { + _STLP_VERBOSE_ASSERT(__l->_Owner()!=0, _StlMsg_INVALID_CONTAINER) + _STLP_ACQUIRE_LOCK(__l->_M_lock) + __c_node->_M_owner = __l; + __c_node->_M_next = __l->_M_node._M_next; + __l->_M_node._M_next = __c_node; + _STLP_RELEASE_LOCK(__l->_M_lock) + } +} + +template +void* _STLP_CALL +__stl_debug_engine<_Dummy>::_Get_container_ptr(const __owned_link* __l) { + const __owned_list* __owner = __l->_Owner(); + _STLP_VERBOSE_RETURN_0(__owner != 0, _StlMsg_INVALID_ITERATOR) + void* __ret = __CONST_CAST(void*,__owner->_Owner()); + _STLP_VERBOSE_RETURN_0(__ret !=0, _StlMsg_INVALID_CONTAINER) + return __ret; +} + +template +bool _STLP_CALL +__stl_debug_engine<_Dummy>::_Check_same_owner(const __owned_link& __i1, + const __owned_link& __i2) { + _STLP_VERBOSE_RETURN(__i1._Valid(), _StlMsg_INVALID_LEFTHAND_ITERATOR) + _STLP_VERBOSE_RETURN(__i2._Valid(), _StlMsg_INVALID_RIGHTHAND_ITERATOR) + _STLP_VERBOSE_RETURN((__i1._Owner() == __i2._Owner()), _StlMsg_DIFFERENT_OWNERS) + return true; +} + +template +bool _STLP_CALL +__stl_debug_engine<_Dummy>::_Check_same_or_null_owner(const __owned_link& __i1, + const __owned_link& __i2) { + _STLP_VERBOSE_RETURN(__i1._Owner() == __i2._Owner(), _StlMsg_DIFFERENT_OWNERS) + return true; +} + +template +bool _STLP_CALL +__stl_debug_engine<_Dummy>::_Check_if_owner( const __owned_list * __l, const __owned_link& __it) { + const __owned_list* __owner_ptr = __it._Owner(); + _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR) + _STLP_VERBOSE_RETURN(__l == __owner_ptr, _StlMsg_NOT_OWNER) + return true; +} + +template +bool _STLP_CALL +__stl_debug_engine<_Dummy>::_Check_if_not_owner( const __owned_list * __l, const __owned_link& __it) { + const __owned_list* __owner_ptr = __it._Owner(); + _STLP_VERBOSE_RETURN(__owner_ptr != 0, _StlMsg_INVALID_ITERATOR) + _STLP_VERBOSE_RETURN(__l != __owner_ptr, _StlMsg_SHOULD_NOT_OWNER) + return true; +} + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +# endif /* _STLP_DEBUG */ + +#endif /* if defined (EXPOSE_GLOBALS_IMPLEMENTATION) */ + +#endif /* header guard */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_debug.h b/sdk/tlibstdcxx/stlport/stl/debug/_debug.h new file mode 100644 index 0000000000..6a2a8ce9e0 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_debug.h @@ -0,0 +1,473 @@ +/* + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_DEBUG_H +#define _STLP_DEBUG_H + +#if (defined (_STLP_DEBUG) || defined (_STLP_DEBUG_ALLOC)) && \ + !defined (_STLP_ASSERTIONS) +# define _STLP_ASSERTIONS 1 +#endif + +#if defined (_STLP_ASSERTIONS) + +# if !defined (_STLP_FILE__) +# define _STLP_FILE__ __FILE__ +# endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +enum { + //General errors + _StlFormat_ERROR_RETURN, + _StlFormat_ASSERTION_FAILURE, + _StlFormat_VERBOSE_ASSERTION_FAILURE, + _StlMsg_INVALID_ARGUMENT, + //Container/Iterator related errors + _StlMsg_INVALID_CONTAINER, + _StlMsg_EMPTY_CONTAINER, + _StlMsg_ERASE_PAST_THE_END, + _StlMsg_OUT_OF_BOUNDS, + _StlMsg_NOT_OWNER, + _StlMsg_SHOULD_NOT_OWNER, + _StlMsg_INVALID_ITERATOR, + _StlMsg_INVALID_LEFTHAND_ITERATOR, + _StlMsg_INVALID_RIGHTHAND_ITERATOR, + _StlMsg_DIFFERENT_OWNERS , + _StlMsg_NOT_DEREFERENCEABLE , + _StlMsg_INVALID_RANGE , + _StlMsg_NOT_IN_RANGE_1 , + _StlMsg_NOT_IN_RANGE_2 , + _StlMsg_INVALID_ADVANCE , + _StlMsg_SINGULAR_ITERATOR , + //Bad predicate for sorting + _StlMsg_INVALID_STRICT_WEAK_PREDICATE, + _StlMsg_INVALID_EQUIVALENT_PREDICATE, + // debug alloc messages + _StlMsg_DBA_DELETED_TWICE , + _StlMsg_DBA_NEVER_ALLOCATED , + _StlMsg_DBA_TYPE_MISMATCH , + _StlMsg_DBA_SIZE_MISMATCH , + _StlMsg_DBA_UNDERRUN , + _StlMsg_DBA_OVERRUN , + // auto_ptr messages + _StlMsg_AUTO_PTR_NULL , + //Memory alignent message + _StlMsg_WRONG_MEMORY_ALIGNMENT, + _StlMsg_UNKNOWN + /* _StlMsg_MAX */ +}; + +/* have to hardcode that ;() */ +# define _StlMsg_MAX 31 + +class __owned_link; +class __owned_list; + +# if defined (_STLP_DEBUG_MODE_THROWS) +# define _STLP_MESSAGE_NORETURN _STLP_FUNCTION_THROWS +# else +# define _STLP_MESSAGE_NORETURN +# endif + +template +class __stl_debug_engine { +public: + // Basic routine to report any debug message + // Use _STLP_DEBUG_MESSAGE to override + static void _STLP_MESSAGE_NORETURN _STLP_CALL _Message(const char * format_str, ...); + + // Micsellanous function to report indexed error message + static void _STLP_CALL _IndexedError(int __ind, const char* __f, int __l); + + // Basic assertion report mechanism. + // Reports failed assertion via __stl_debug_message and calls _Terminate + // if _STLP_DEBUG_TERMINATE is specified, calls __stl_debug_terminate instead + static void _STLP_CALL _Assert(const char* __expr, const char* __f, int __l); + + // The same, with additional diagnostics + static void _STLP_CALL _VerboseAssert(const char* __expr, int __error_ind, const char* __f, int __l); + + // If exceptions are present, sends unique exception + // If not, calls _STLP_ABORT() to terminate + // Use _STLP_DEBUG_TERMINATE to override + static void _STLP_CALL _Terminate(); + +# if defined (_STLP_DEBUG) + // owned_list/link delegate non-inline functions here + + static bool _STLP_CALL _Check_same_owner( const __owned_link& __i1, + const __owned_link& __i2); + static bool _STLP_CALL _Check_same_or_null_owner( const __owned_link& __i1, + const __owned_link& __i2); + static bool _STLP_CALL _Check_if_owner( const __owned_list*, const __owned_link&); + + static bool _STLP_CALL _Check_if_not_owner( const __owned_list*, const __owned_link&); + + static void _STLP_CALL _Verify(const __owned_list*); + + static void _STLP_CALL _Swap_owners(__owned_list&, __owned_list&); + + static void _STLP_CALL _Invalidate_all(__owned_list*); + + static void _STLP_CALL _Set_owner(__owned_list& /*src*/, __owned_list& /*dst*/); + + static void _STLP_CALL _Stamp_all(__owned_list*, __owned_list*); + + static void _STLP_CALL _M_detach(__owned_list*, __owned_link*); + + static void _STLP_CALL _M_attach(__owned_list*, __owned_link*); + + // accessor : check and get pointer to the container + static void* _STLP_CALL _Get_container_ptr(const __owned_link*); +# endif + + // debug messages and formats + static const char* _Message_table[_StlMsg_MAX]; +}; + +# undef _STLP_MESSAGE_NORETURN + +# if defined (_STLP_USE_TEMPLATE_EXPORT) +_STLP_EXPORT_TEMPLATE_CLASS __stl_debug_engine; +# endif + +typedef __stl_debug_engine __stl_debugger; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +# if !defined (_STLP_ASSERT) +# define _STLP_ASSERT(expr) \ + if (!(expr)) { _STLP_PRIV __stl_debugger::_Assert( # expr, _STLP_FILE__, __LINE__); } +# endif + +#else +# define _STLP_ASSERT(expr) +#endif + +// this section is for _STLP_DEBUG only +#if defined (_STLP_DEBUG) + +# if !defined (_STLP_VERBOSE_ASSERT) +// fbp : new form not requiring ";" +# define _STLP_VERBOSE_ASSERT(expr, __diag_num) \ + if (!(expr)) { _STLP_PRIV __stl_debugger::_VerboseAssert\ + ( # expr, _STLP_PRIV __diag_num, _STLP_FILE__, __LINE__ ); \ + } +# endif + +# define _STLP_DEBUG_CHECK(expr) _STLP_ASSERT(expr) + +# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) +# define _STLP_STD_DEBUG_CHECK(expr) _STLP_DEBUG_CHECK(expr) +# else +# define _STLP_STD_DEBUG_CHECK(expr) +# endif + +# if !defined (_STLP_VERBOSE_RETURN) +# define _STLP_VERBOSE_RETURN(__expr,__diag_num) if (!(__expr)) { \ + _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__ , __LINE__); \ + return false; } +# endif + +# if !defined (_STLP_VERBOSE_RETURN_0) +# define _STLP_VERBOSE_RETURN_0(__expr,__diag_num) if (!(__expr)) { \ + _STLP_PRIV __stl_debugger::_IndexedError(__diag_num, _STLP_FILE__, __LINE__); \ + return 0; } +# endif + +# ifndef _STLP_INTERNAL_THREADS_H +# include +# endif + +# ifndef _STLP_INTERNAL_ITERATOR_BASE_H +# include +# endif + +# ifndef _STLP_TYPE_TRAITS_H +# include +# endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +/* + * Special debug iterator traits having an additionnal static member + * method _Check. It is used by the slist debug implementation to check + * the special before_begin iterator. + */ +template +struct _DbgTraits : _Traits { + typedef _DbgTraits _ConstTraits; + typedef _DbgTraits _NonConstTraits; + + template + static bool _Check(const _Iterator&) {return true;} +}; + +//============================================================= +template +inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2, + const random_access_iterator_tag&) +{ return (__i1 < __i2) || (__i1 == __i2); } + +template +inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2, + const bidirectional_iterator_tag&) { + // check if comparable + bool __dummy(__i1==__i2); + return (__dummy==__dummy); +} + +template +inline bool _STLP_CALL __valid_range(const _Iterator& __i1 ,const _Iterator& __i2, + const forward_iterator_tag&) { + // check if comparable + bool __dummy(__i1==__i2); + return (__dummy==__dummy); +} + +template +inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&, + const input_iterator_tag&) +{ return true; } + +template +inline bool _STLP_CALL __valid_range(const _Iterator&,const _Iterator&, + const output_iterator_tag&) +{ return true; } + +template +inline bool _STLP_CALL __valid_range(const _Iterator& __i1, const _Iterator& __i2) +{ return __valid_range(__i1,__i2,_STLP_ITERATOR_CATEGORY(__i1, _Iterator)); } + +// Note : that means in range [i1, i2]. +template +inline bool _STLP_CALL stlp_in_range(const _Iterator& _It, + const _Iterator& __i1, const _Iterator& __i2) +{ return __valid_range(__i1,_It) && __valid_range(_It,__i2); } + +template +inline bool _STLP_CALL stlp_in_range(const _Iterator& __first, const _Iterator& __last, + const _Iterator& __start, const _Iterator& __finish) +{ return __valid_range(__first,__last) && __valid_range(__start,__first) && __valid_range(__last,__finish); } + +//========================================================== +class _STLP_CLASS_DECLSPEC __owned_link { +public: + // Note: This and the following special defines for compiling under Windows CE under ARM + // is needed for correctly using _STLP_DEBUG mode. This comes from a bug in the ARM + // compiler where checked iterators that are passed by value call _M_attach with the wrong + // this pointer and calling _M_detach can't find the correct pointer to the __owned_link. + // This is circumvented by managing a _M_self pointer that points to the correct value. + // Ugly but works. +#if defined(_STLP_WCE) && defined(_ARM_) + __owned_link() : _M_self(this), _M_owner(0) {} + __owned_link(const __owned_list* __c) : _M_self(this), _M_owner(0), _M_next(0) + { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); } + __owned_link(const __owned_link& __rhs): _M_self(this), _M_owner(0) + { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); } +#else + __owned_link() : _M_owner(0) {} + __owned_link(const __owned_list* __c) : _M_owner(0), _M_next(0) + { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__c), this); } + __owned_link(const __owned_link& __rhs): _M_owner(0) + { __stl_debugger::_M_attach(__CONST_CAST(__owned_list*,__rhs._M_owner), this); } +#endif + __owned_link& operator=(const __owned_link& __rhs) { + __owned_list* __new_owner = __CONST_CAST(__owned_list*,__rhs._M_owner); + __owned_list* __old_owner = _M_owner; + if ( __old_owner != __new_owner ) { + __stl_debugger::_M_detach(__old_owner, this); + __stl_debugger::_M_attach(__new_owner, this); + } + return *this; + } +#if defined(_STLP_WCE) && defined(_ARM_) + ~__owned_link() { + __stl_debugger::_M_detach(_M_owner, _M_self); + _Invalidate(); + } +#else + ~__owned_link() { + __stl_debugger::_M_detach(_M_owner, this); + _Invalidate(); + } +#endif + + const __owned_list* _Owner() const { return _M_owner; } + __owned_list* _Owner() { return _M_owner; } + void _Set_owner(const __owned_list* __o) { _M_owner= __CONST_CAST(__owned_list*,__o); } + bool _Valid() const { return _M_owner != 0; } + void _Invalidate() { _M_owner = 0; _M_next = 0; } + void _Link_to_self() { _M_next = 0; } + + __owned_link* _Next() { return _M_next; } + const __owned_link* _Next() const { return _M_next; } + +public: +#if defined(_STLP_WCE) && defined(_ARM_) + __owned_link* _M_self; +#endif + + __owned_list* _M_owner; + __owned_link* _M_next; +}; + + +class _STLP_CLASS_DECLSPEC __owned_list { +public: + __owned_list(void* __o) { + // fprintf(stderr, "__owned_list(): %p\n",(void*)this); + _M_node._M_owner = __REINTERPRET_CAST(__owned_list*,__o); + _M_node._M_next = 0; + } + ~__owned_list() { + // fprintf(stderr, "~__owned_list(): %p\n",(void*)this); + _Invalidate_all(); + // that prevents detach + _M_node._Invalidate(); + } + const void* _Owner() const { return (const void*)_M_node._M_owner; } + void* _Owner() { return (void*)_M_node._M_owner; } + bool _Valid() const { return _M_node._M_owner != 0; } + void _Invalidate() { _M_node._M_owner = 0; } + + __owned_link* _First() { return _M_node._Next(); } + __owned_link* _Last() { return 0 ; } + + const __owned_link* _First() const { return (__owned_link*)_M_node._M_next; } + const __owned_link* _Last() const { return 0 ;} + + void _Verify() const { __stl_debugger::_Verify(this); } + void _Swap_owners(__owned_list& __y) { __stl_debugger::_Swap_owners(*this, __y); } + void _Invalidate_all() { __stl_debugger::_Invalidate_all(this); } + void _Set_owner(__owned_list& __y) { __stl_debugger::_Set_owner(*this, __y); } + + mutable __owned_link _M_node; + mutable _STLP_mutex _M_lock; + +private: + // should never be called, should be left not implemented, + // but some compilers complain about it ;( + __owned_list(const __owned_list&){} + __owned_list& operator = (const __owned_list&) { return *this; } + + friend class __owned_link; + friend class __stl_debug_engine; +}; + + +//========================================================== + +// forward declaratioins + +template +bool _STLP_CALL __check_range(const _Iterator&, const _Iterator&); +template +bool _STLP_CALL __check_range(const _Iterator&, + const _Iterator&, const _Iterator&); +template +bool _STLP_CALL __check_range(const _Iterator&, const _Iterator& , + const _Iterator&, const _Iterator& ); +template +bool _STLP_CALL __check_ptr_range(const _Tp*, const _Tp*); + +template +void _STLP_CALL __invalidate_range(const __owned_list* __base, + const _Iterator& __first, + const _Iterator& __last); + +template +void _STLP_CALL __invalidate_iterator(const __owned_list* __base, + const _Iterator& __it); + +template +void _STLP_CALL __change_range_owner(const _Iterator& __first, + const _Iterator& __last, + const __owned_list* __dst); + +template +void _STLP_CALL __change_ite_owner(const _Iterator& __it, + const __owned_list* __dst); + +//============================================================ +inline bool _STLP_CALL +__check_same_owner(const __owned_link& __i1, const __owned_link& __i2) +{ return __stl_debugger::_Check_same_owner(__i1,__i2); } + +inline bool _STLP_CALL +__check_same_or_null_owner(const __owned_link& __i1, const __owned_link& __i2) +{ return __stl_debugger::_Check_same_or_null_owner(__i1,__i2); } + +template +inline bool _STLP_CALL __check_if_owner( const __owned_list* __owner, + const _Iterator& __it) +{ return __stl_debugger::_Check_if_owner(__owner, (const __owned_link&)__it); } + +template +inline bool _STLP_CALL __check_if_not_owner( const __owned_list* __owner, + const _Iterator& __it) +{ return __stl_debugger::_Check_if_not_owner(__owner, (const __owned_link&)__it); } + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#else +# define _STLP_VERBOSE_ASSERT(expr, diagnostic) +# define _STLP_DEBUG_CHECK(expr) +#endif /* _STLP_DEBUG */ + +#if defined (_STLP_ASSERTIONS) + +# if !defined (_STLP_ASSERT_MSG_TRAILER) +# define _STLP_ASSERT_MSG_TRAILER +# endif + +// dwa 12/30/98 - if _STLP_DEBUG_MESSAGE is defined, the user can supply own definition. +# if !defined (_STLP_DEBUG_MESSAGE) +# define __stl_debug_message __stl_debugger::_Message +# else +extern void __stl_debug_message(const char * format_str, ...); +# endif + +// fbp: if _STLP_DEBUG_TERMINATE is defined, the user can supply own definition. +# if !defined (_STLP_DEBUG_TERMINATE) +# define __stl_debug_terminate __stl_debugger::_Terminate +# else +extern void __stl_debug_terminate(); +# endif + +#endif + +#if defined (_STLP_ASSERTIONS) && !defined (_STLP_LINK_TIME_INSTANTIATION) +# include +#endif + +#endif /* DEBUG_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_deque.h b/sdk/tlibstdcxx/stlport/stl/debug/_deque.h new file mode 100644 index 0000000000..f5c5ff5d7a --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_deque.h @@ -0,0 +1,414 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DBG_DEQUE_H +#define _STLP_INTERNAL_DBG_DEQUE_H + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +#define _STLP_NON_DBG_DEQUE _STLP_PRIV _STLP_NON_DBG_NAME(deque) <_Tp,_Alloc> + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _Tp* value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&) +{ return (_Tp*)0; } +template +inline random_access_iterator_tag iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_DEQUE >&) +{ return random_access_iterator_tag(); } +#endif + +template ) > +class deque : +#if !defined (__DMC__) + private +#endif + _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + , public __stlport_class > +#endif +{ + typedef deque<_Tp,_Alloc> _Self; + typedef _STLP_NON_DBG_DEQUE _Base; + typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_DEQUE > _ConstructCheck; + +public: + // Basic types + __IMPORT_CONTAINER_TYPEDEFS(_Base) + + // Iterators + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits > > iterator; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits > > const_iterator; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +protected: + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + + void _Invalidate_all() + { _M_iter_list._Invalidate_all(); } + void _Invalidate_iterator(const iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); } + void _Invalidate_iterators(const iterator& __first, const iterator& __last) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } + +public: + // Basic accessors + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } + + iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + reference operator[](size_type __n) { + _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) + return _M_non_dbg_impl[__n]; + } + const_reference operator[](size_type __n) const { + _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) + return _M_non_dbg_impl[__n]; + } + + reference at(size_type __n) { return _M_non_dbg_impl.at(__n); } + const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); } + + reference front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *begin(); + } + const_reference front() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *begin(); + } + reference back() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *(--end()); + } + const_reference back() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *(--end()); + } + + // Constructor, destructor. + explicit deque(const allocator_type& __a = allocator_type()) : + _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} + deque(const _Self& __x) : + _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), + _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit deque(size_type __n, const value_type& __x = _Tp(), +#else + deque(size_type __n, const value_type& __x, +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) : + _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit deque(size_type __n) : + _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + deque(__move_source<_Self> src) + : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + deque(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), + _M_iter_list(&_M_non_dbg_impl) { + } +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + deque(_InputIterator __first, _InputIterator __last) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), + _M_iter_list(&_M_non_dbg_impl) { + } +# endif +#else + deque(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first, __last, __a), + _M_iter_list(&_M_non_dbg_impl) { + } + + deque(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), + _M_iter_list(&_M_non_dbg_impl) { + } +#endif + + _Self& operator=(const _Self& __x) { + if (this != &__x) { + _Invalidate_all(); + _M_non_dbg_impl = __x._M_non_dbg_impl; + } + return *this; + } + + bool empty() const { return _M_non_dbg_impl.empty(); } + size_type size() const { return _M_non_dbg_impl.size(); } + size_type max_size() const { return _M_non_dbg_impl.max_size(); } + + void swap(_Self& __x) { + _M_iter_list._Swap_owners(__x._M_iter_list); + _M_non_dbg_impl.swap(__x._M_non_dbg_impl); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +public: + void assign(size_type __n, const _Tp& __val) { + _Invalidate_all(); + _M_non_dbg_impl.assign(__n, __val); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Invalidate_all(); + _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#else + void assign(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Invalidate_all(); + _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); + } + void assign(const value_type *__first, const value_type *__last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + _Invalidate_all(); + _M_non_dbg_impl.assign(__first, __last); + } +#endif + +public: // push_* and pop_* + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back(const value_type& __t = _Tp()) { +#else + void push_back(const value_type& __t) { +#endif + _Invalidate_all(); + _M_non_dbg_impl.push_back(__t); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back() { + _Invalidate_all(); + _M_non_dbg_impl.push_back(); + } +#endif + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_front(const value_type& __t = _Tp()) { +#else + void push_front(const value_type& __t) { +#endif + _Invalidate_all(); + _M_non_dbg_impl.push_front(__t); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_front() { + _Invalidate_all(); + _M_non_dbg_impl.push_front(); + } +#endif + + void pop_back() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + _Invalidate_iterator(end()); + _M_non_dbg_impl.pop_back(); + } + + void pop_front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + _Invalidate_iterator(begin()); + _M_non_dbg_impl.pop_front(); + } + +public: // Insert + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const value_type& __x = _Tp()) { +#else + iterator insert(iterator __pos, const value_type& __x) { +#endif + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _Invalidate_all(); + return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x)); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _Invalidate_all(); + return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator)); + } +#endif + + void insert(iterator __pos, size_type __n, const value_type& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + if (__n != 0) _Invalidate_all(); + _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + // We perform invalidate first to detect self referencing in __check_range as __first and __last + // will have been invalidated. + if (__first != __last) _Invalidate_all(); + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.insert(__pos._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) + void insert(iterator __pos, + const value_type* __first, const value_type* __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + if (__first != __last) _Invalidate_all(); + _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) + void insert(iterator __pos, + const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + //Sequence requirements 23.1.1 Table 67: + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first)); + if (__first != __last) _Invalidate_all(); + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + } + + void insert(iterator __pos, + iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + //Sequence requirements 23.1.1 Table 67: + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first)); + if (__first != __last) _Invalidate_all(); + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + } +#endif + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const value_type& __x = _Tp()) { +#else + void resize(size_type __new_size, const value_type& __x) { +#endif + if (__new_size != size()) { + if ((__new_size > size()) || (__new_size < size() - 1)) + _Invalidate_all(); + else + _Invalidate_iterator(end()); + } + _M_non_dbg_impl.resize(__new_size, __x); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type new_size) { resize(new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif + + // Erase + iterator erase(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + if (__pos._M_iterator == _M_non_dbg_impl.begin()) { + _Invalidate_iterator(__pos); + } else { + typename _Base::iterator tmp = --(_M_non_dbg_impl.end()); + if (__pos._M_iterator == tmp) + _Invalidate_iterator(__pos); + else + _Invalidate_all(); + } + return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); + } + + iterator erase(iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + if (!empty()) { + if (__first._M_iterator == _M_non_dbg_impl.begin() || + __last._M_iterator == _M_non_dbg_impl.end()) + _Invalidate_iterators(__first, __last); + else + _Invalidate_all(); + } + return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); + } + + void clear() { + _Invalidate_all(); + _M_non_dbg_impl.clear(); + } +}; + +_STLP_END_NAMESPACE + +#undef _STLP_NON_DBG_DEQUE + +#endif /* _STLP_INTERNAL_DEQUE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_hashtable.h b/sdk/tlibstdcxx/stlport/stl/debug/_hashtable.h new file mode 100644 index 0000000000..523f7e325f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_hashtable.h @@ -0,0 +1,340 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DBG_HASHTABLE_H +#define _STLP_INTERNAL_DBG_HASHTABLE_H + +// Hashtable class, used to implement the hashed associative containers +// hash_set, hash_map, hash_multiset, and hash_multimap, +// unordered_set, unordered_map, unordered_multiset, unordered_multimap + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class _DbgEqual { +public: + _DbgEqual() {} + _DbgEqual(const _Equal& __eq) : _M_non_dbg_eq(__eq) {} + _DbgEqual(const _DbgEqual& __eq) : _M_non_dbg_eq(__eq._M_non_dbg_eq) {} + +#if !defined (_STLP_USE_CONTAINERS_EXTENSION) + bool operator () (const _Key& __lhs, const _Key& __rhs) const +#else + template + bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const +#endif + { +#if !defined (_STLP_USE_CONTAINERS_EXTENSION) + _STLP_VERBOSE_ASSERT(_M_non_dbg_eq(__rhs, __lhs) == _M_non_dbg_eq(__lhs, __rhs), _StlMsg_INVALID_EQUIVALENT_PREDICATE) +#endif + return _M_non_dbg_eq(__lhs, __rhs) ? true : false; + } + + _Equal non_dbg_key_eq() const { return _M_non_dbg_eq; } +private: + _Equal _M_non_dbg_eq; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +#define _STLP_NON_DBG_HT \ +_STLP_PRIV _STLP_NON_DBG_NAME(hashtable) <_Val, _Key, _HF, _Traits, _ExK, _STLP_PRIV _DbgEqual<_Key, _EqK>, _All> + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _Val* +value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&) +{ return (_Val*)0; } + +template +inline forward_iterator_tag +iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_HT >&) +{ return forward_iterator_tag(); } +#endif + +template +class hashtable { + typedef hashtable<_Val, _Key, _HF, _Traits, _ExK, _EqK, _All> _Self; + typedef _STLP_NON_DBG_HT _Base; + + typedef typename _Traits::_NonConstTraits _NonConstTraits; + typedef typename _Traits::_ConstTraits _ConstTraits; + typedef typename _Traits::_NonConstLocalTraits _NonConstLocalTraits; + typedef typename _Traits::_ConstLocalTraits _ConstLocalTraits; + + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + +public: + typedef _Key key_type; + typedef _HF hasher; + typedef _EqK key_equal; + + __IMPORT_CONTAINER_TYPEDEFS(_Base) + + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstTraits> > iterator; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstTraits> > const_iterator; + //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_NonConstLocalTraits> > local_iterator; + typedef iterator local_iterator; + //typedef _STLP_PRIV _DBG_iter<_Base, _DbgTraits<_ConstLocalTraits> > const_local_iterator; + typedef const_iterator const_local_iterator; + + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_iterator _Base_const_iterator; + + hasher hash_funct() const { return _M_non_dbg_impl.hash_funct(); } + key_equal key_eq() const { return _M_non_dbg_impl.key_eq().non_dbg_key_eq(); } + +private: + void _Invalidate_iterator(const const_iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } + void _Invalidate_iterators(const const_iterator& __first, const const_iterator& __last) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } + + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +public: + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } + + hashtable(size_type __n, + const _HF& __hf, + const _EqK& __eql, + const _ExK& __ext, + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__n, __hf, __eql, __ext, __a), + _M_iter_list(&_M_non_dbg_impl) {} + + hashtable(size_type __n, + const _HF& __hf, + const _EqK& __eql, + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__n, __hf, __eql, __a), + _M_iter_list(&_M_non_dbg_impl) {} + + hashtable(const _Self& __ht) + : _M_non_dbg_impl(__ht._M_non_dbg_impl), + _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + hashtable(__move_source<_Self> src) + : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + + size_type size() const { return _M_non_dbg_impl.size(); } + size_type max_size() const { return _M_non_dbg_impl.max_size(); } + bool empty() const { return _M_non_dbg_impl.empty(); } + + _Self& operator=(const _Self& __ht) { + if (this != &__ht) { + //Should not invalidate end iterator + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl = __ht._M_non_dbg_impl; + } + return *this; + } + + void swap(_Self& __ht) { + _M_iter_list._Swap_owners(__ht._M_iter_list); + _M_non_dbg_impl.swap(__ht._M_non_dbg_impl); + } + + iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + local_iterator begin(size_type __n) { + //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators + _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) + return local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n)); + } + local_iterator end(size_type __n) { + //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators + _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) + return local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n)); + } + + const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_local_iterator begin(size_type __n) const { + //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators + _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) + return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.begin(__n)); + } + const_local_iterator end(size_type __n) const { + //TODO: Add checks for iterator locality -> avoids comparison between different bucket iterators + _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) + return const_local_iterator(&_M_iter_list, _M_non_dbg_impl.end(__n)); + } + + pair insert_unique(const value_type& __obj) { + pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__obj); + return pair(iterator(&_M_iter_list, __res.first), __res.second); + } + + iterator insert_equal(const value_type& __obj) + { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__obj)); } + + pair insert_unique_noresize(const value_type& __obj) { + pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique_noresize(__obj); + return pair(iterator(&_M_iter_list, __res.first), __res.second); + } + + iterator insert_equal_noresize(const value_type& __obj) + { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal_noresize(__obj)); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert_unique(_InputIterator __f, _InputIterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); + } + + template + void insert_equal(_InputIterator __f, _InputIterator __l){ + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); + } + +#else + void insert_unique(const value_type* __f, const value_type* __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) + _M_non_dbg_impl.insert_unique(__f, __l); + } + + void insert_equal(const value_type* __f, const value_type* __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) + _M_non_dbg_impl.insert_equal(__f, __l); + } + + void insert_unique(const_iterator __f, const_iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + _M_non_dbg_impl.insert_unique(__f._M_iterator, __l._M_iterator); + } + + void insert_equal(const_iterator __f, const_iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + _M_non_dbg_impl.insert_equal(__f._M_iterator, __l._M_iterator); + } +#endif + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __key) + { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __key) const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__key)); } + + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __key) const { return _M_non_dbg_impl.count(__key); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) { + pair<_Base_iterator, _Base_iterator> __res = _M_non_dbg_impl.equal_range(__key); + return pair (iterator(&_M_iter_list,__res.first), + iterator(&_M_iter_list,__res.second)); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __key) const { + pair <_Base_const_iterator, _Base_const_iterator> __res = _M_non_dbg_impl.equal_range(__key); + return pair (const_iterator(&_M_iter_list,__res.first), + const_iterator(&_M_iter_list,__res.second)); + } + + size_type erase(const key_type& __key) { + pair __p = equal_range(__key); + size_type __n = _STLP_STD::distance(__p.first, __p.second); + _Invalidate_iterators(__p.first, __p.second); + _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator); + return __n; + } + + void erase(const const_iterator& __it) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__it)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __it)) + _Invalidate_iterator(__it); + _M_non_dbg_impl.erase(__it._M_iterator); + } + void erase(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, + const_iterator(begin()), const_iterator(end()))) + _Invalidate_iterators(__first, __last); + _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator); + } + + void rehash(size_type __num_buckets_hint) { _M_non_dbg_impl.rehash(__num_buckets_hint); } + void resize(size_type __num_elements_hint) { _M_non_dbg_impl.resize(__num_elements_hint); } + + void clear() { + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.clear(); + } + + reference _M_insert(const value_type& __obj) { return _M_non_dbg_impl._M_insert(__obj); } + + size_type bucket_count() const { return _M_non_dbg_impl.bucket_count(); } + size_type max_bucket_count() const { return _M_non_dbg_impl.max_bucket_count(); } + size_type elems_in_bucket(size_type __n) const { + _STLP_VERBOSE_ASSERT((__n < bucket_count()), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.elems_in_bucket(__n); + } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type bucket(const _KT& __k) const { return _M_non_dbg_impl.bucket(__k); } + + float load_factor() const { return _M_non_dbg_impl.load_factor(); } + float max_load_factor() const { return _M_non_dbg_impl.max_load_factor(); } + void max_load_factor(float __z) { + _STLP_VERBOSE_ASSERT((__z > 0.0f), _StlMsg_INVALID_ARGUMENT) + _M_non_dbg_impl.max_load_factor(__z); + } +}; + +_STLP_END_NAMESPACE + +#undef _STLP_NON_DBG_HT + +#endif /* _STLP_INTERNAL_HASHTABLE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_iterator.h b/sdk/tlibstdcxx/stlport/stl/debug/_iterator.h new file mode 100644 index 0000000000..b2c8956ec3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_iterator.h @@ -0,0 +1,457 @@ +/* + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_DBG_ITERATOR_H +#define _STLP_DBG_ITERATOR_H + +#ifndef _STLP_INTERNAL_PAIR_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +//============================================================ + +template +void _Decrement(_Iterator& __it, const bidirectional_iterator_tag &) +{ --__it; } + +template +void _Decrement(_Iterator& __it, const random_access_iterator_tag &) +{ --__it; } + +template +void _Decrement(_Iterator& __it, const forward_iterator_tag &) +{ _STLP_ASSERT(0) } + +template +void _Advance(_Iterator&, ptrdiff_t, const forward_iterator_tag &) +{ _STLP_ASSERT(0) } + +template +void _Advance(_Iterator& __it, ptrdiff_t, const bidirectional_iterator_tag &) +{ _STLP_ASSERT(0) } + +template +void _Advance(_Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) +{ __it += __n; } + +template +ptrdiff_t _DBG_distance(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &) +{ return __x - __y; } + +template +ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const forward_iterator_tag &) { + _STLP_ASSERT(0) + return 0; +} + +template +ptrdiff_t _DBG_distance(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) { + _STLP_ASSERT(0) + return 0; +} + +template +bool _CompareIt(const _Iterator&, const _Iterator&, const forward_iterator_tag &) { + _STLP_ASSERT(0) + return false; +} + +template +bool _CompareIt(const _Iterator&, const _Iterator&, const bidirectional_iterator_tag &) { + _STLP_ASSERT(0) + return false; +} + +template +bool _CompareIt(const _Iterator& __x, const _Iterator& __y, const random_access_iterator_tag &) +{ return __x < __y; } + +template +bool _Dereferenceable(const _Iterator& __it) +{ return (__it._Get_container_ptr() != 0) && !(__it._M_iterator == (__it._Get_container_ptr())->end()); } + +template +bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const forward_iterator_tag &) +{ return (__n == 1) && _Dereferenceable(__it); } + +template +bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const bidirectional_iterator_tag &) { + typedef typename _Iterator::_Container_type __container_type; + __container_type* __c = __it._Get_container_ptr(); + return (__c != 0) && ((__n == 1 && __it._M_iterator != __c->end() ) || + (__n == -1 && __it._M_iterator != __c->begin())); +} + +template +bool _Incrementable(const _Iterator& __it, ptrdiff_t __n, const random_access_iterator_tag &) { + typedef typename _Iterator::_Container_type __container_type; + __container_type* __c = __it._Get_container_ptr(); + if (__c == 0) return false; + ptrdiff_t __new_pos = (__it._M_iterator - __c->begin()) + __n; + return (__new_pos >= 0) && (__STATIC_CAST(typename __container_type::size_type, __new_pos) <= __c->size()); +} + + +template +struct _DBG_iter_base : public __owned_link { +public: + typedef typename _Container::value_type value_type; + typedef typename _Container::reference reference; + typedef typename _Container::pointer pointer; + typedef ptrdiff_t difference_type; + //private: + typedef typename _Container::iterator _Nonconst_iterator; + typedef typename _Container::const_iterator _Const_iterator; + typedef _Container _Container_type; + +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION + typedef typename iterator_traits<_Const_iterator>::iterator_category _Iterator_category; +#else + typedef typename _Container::_Iterator_category _Iterator_category; +#endif + typedef _Iterator_category iterator_category; + + _DBG_iter_base() : __owned_link(0) {} + _DBG_iter_base(const __owned_list* __c, const _Const_iterator& __it) : +#if defined(__HP_aCC) && (__HP_aCC < 60000) + __owned_link(__c), _M_iterator(*__REINTERPRET_CAST(const _Nonconst_iterator *, &__it)) {} +#else + __owned_link(__c), _M_iterator(*(const _Nonconst_iterator*)&__it) {} +#endif + _Container* _Get_container_ptr() const { + return (_Container*)__stl_debugger::_Get_container_ptr(this); + } + + void __increment(); + void __decrement(); + void __advance(ptrdiff_t __n); + +// protected: + _Nonconst_iterator _M_iterator; +}; + +template +inline void _DBG_iter_base<_Container>::__increment() { + _STLP_DEBUG_CHECK(_Incrementable(*this, 1, _Iterator_category())) + ++_M_iterator; +} + +template +inline void _DBG_iter_base<_Container>::__decrement() { + _STLP_DEBUG_CHECK(_Incrementable(*this, -1, _Iterator_category())) + _Decrement(_M_iterator, _Iterator_category()); +} + +template +inline void _DBG_iter_base<_Container>::__advance(ptrdiff_t __n) { + _STLP_DEBUG_CHECK(_Incrementable(*this, __n, _Iterator_category())) + _Advance(_M_iterator, __n, _Iterator_category()); +} + +template +ptrdiff_t operator-(const _DBG_iter_base<_Container>& __x, + const _DBG_iter_base<_Container>& __y ) { + typedef typename _DBG_iter_base<_Container>::_Iterator_category _Iterator_category; + _STLP_DEBUG_CHECK(__check_same_owner(__x, __y)) + return _DBG_distance(__x._M_iterator,__y._M_iterator, _Iterator_category()); +} + +template +struct _DBG_iter_mid : public _DBG_iter_base<_Container> { + typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_self; + typedef typename _Container::iterator _Nonconst_iterator; + typedef typename _Container::const_iterator _Const_iterator; + + _DBG_iter_mid() {} + + explicit _DBG_iter_mid(const _Nonconst_self& __it) : + _DBG_iter_base<_Container>(__it) {} + + _DBG_iter_mid(const __owned_list* __c, const _Const_iterator& __it) : + _DBG_iter_base<_Container>(__c, __it) {} +}; + +template +struct _DBG_iter : public _DBG_iter_mid<_Container, _Traits> { + typedef _DBG_iter_base<_Container> _Base; +public: + typedef typename _Base::value_type value_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + + typedef typename _Base::_Nonconst_iterator _Nonconst_iterator; + typedef typename _Base::_Const_iterator _Const_iterator; + +private: + typedef _DBG_iter<_Container, _Traits> _Self; + typedef _DBG_iter_mid<_Container, typename _Traits::_NonConstTraits> _Nonconst_mid; + +public: + +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION + typedef typename _Base::iterator_category iterator_category; +#endif + typedef typename _Base::_Iterator_category _Iterator_category; + +public: + _DBG_iter() {} + // boris : real type of iter would be nice + _DBG_iter(const __owned_list* __c, const _Const_iterator& __it) : + _DBG_iter_mid<_Container, _Traits>(__c, __it) {} + + // This allows conversions from iterator to const_iterator without being + // redundant with the copy constructor below. + _DBG_iter(const _Nonconst_mid& __rhs) : + _DBG_iter_mid<_Container, _Traits>(__rhs) {} + + _DBG_iter(const _Self& __rhs) : + _DBG_iter_mid<_Container, _Traits>(__rhs) {} + + // This allows conversions from iterator to const_iterator without being + // redundant with the copy assignment operator below. + _Self& operator=(const _Nonconst_mid& __rhs) { + (_Base&)*this = __rhs; + return *this; + } + + _Self& operator=(const _Self& __rhs) { + (_Base&)*this = __rhs; + return *this; + } + + reference operator*() const; + + _STLP_DEFINE_ARROW_OPERATOR + + _Self& operator++() { + this->__increment(); + return *this; + } + _Self operator++(int) { + _Self __tmp = *this; + this->__increment(); + return __tmp; + } + _Self& operator--() { + this->__decrement(); + return *this; + } + _Self operator--(int) { + _Self __tmp = *this; + this->__decrement(); + return __tmp; + } + + _Self& operator+=(difference_type __n) { + this->__advance(__n); + return *this; + } + + _Self& operator-=(difference_type __n) { + this->__advance(-__n); + return *this; + } + _Self operator+(difference_type __n) const { + _Self __tmp(*this); + __tmp.__advance(__n); + return __tmp; + } + _Self operator-(difference_type __n) const { + _Self __tmp(*this); + __tmp.__advance(-__n); + return __tmp; + } + reference operator[](difference_type __n) const { return *(*this + __n); } +}; + +template +inline +#if defined (_STLP_NESTED_TYPE_PARAM_BUG) +_STLP_TYPENAME_ON_RETURN_TYPE _Traits::reference +#else +_STLP_TYPENAME_ON_RETURN_TYPE _DBG_iter<_Container, _Traits>::reference +#endif +_DBG_iter<_Container, _Traits>::operator*() const { + _STLP_DEBUG_CHECK(_Dereferenceable(*this)) + _STLP_DEBUG_CHECK(_Traits::_Check(*this)) + return *this->_M_iterator; +} + +template +inline bool +operator==(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) { + _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) + return __x._M_iterator == __y._M_iterator; +} + +template +inline bool +operator<(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) { + _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) + typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; + return _CompareIt(__x._M_iterator , __y._M_iterator, _Category()); +} + +template +inline bool +operator>(const _DBG_iter_base<_Container>& __x, + const _DBG_iter_base<_Container>& __y) { + typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; + return _CompareIt(__y._M_iterator , __x._M_iterator, _Category()); +} + +template +inline bool +operator>=(const _DBG_iter_base<_Container>& __x, const _DBG_iter_base<_Container>& __y) { + _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) + typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; + return !_CompareIt(__x._M_iterator , __y._M_iterator, _Category()); +} + +template +inline bool +operator<=(const _DBG_iter_base<_Container>& __x, + const _DBG_iter_base<_Container>& __y) { + typedef typename _DBG_iter_base<_Container>::_Iterator_category _Category; + return !_CompareIt(__y._M_iterator , __x._M_iterator, _Category()); +} + +template +inline bool +operator!=(const _DBG_iter_base<_Container>& __x, + const _DBG_iter_base<_Container>& __y) { + _STLP_DEBUG_CHECK(__check_same_or_null_owner(__x, __y)) + return __x._M_iterator != __y._M_iterator; +} + +//------------------------------------------ + +template +inline _DBG_iter<_Container, _Traits> +operator+(ptrdiff_t __n, const _DBG_iter<_Container, _Traits>& __it) { + _DBG_iter<_Container, _Traits> __tmp(__it); + return __tmp += __n; +} + + +template +inline _Iterator _Non_Dbg_iter(_Iterator __it) +{ return __it; } + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +template +inline typename _DBG_iter<_Container, _Traits>::_Nonconst_iterator +_Non_Dbg_iter(const _DBG_iter<_Container, _Traits>& __it) +{ return __it._M_iterator; } +#endif + +/* + * Helper classes to check iterator range or pointer validity + * at construction time. + */ +template +class __construct_checker { + typedef typename _Container::value_type value_type; +protected: + __construct_checker() {} + + __construct_checker(const value_type* __p) { + _STLP_VERBOSE_ASSERT((__p != 0), _StlMsg_INVALID_ARGUMENT) + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + __construct_checker(const _InputIter& __f, const _InputIter& __l) { + typedef typename _IsIntegral<_InputIter>::_Ret _Integral; + _M_check_dispatch(__f, __l, _Integral()); + } + + template + void _M_check_dispatch(_Integer , _Integer, const __true_type& /*IsIntegral*/) {} + + template + void _M_check_dispatch(const _InputIter& __f, const _InputIter& __l, const __false_type& /*IsIntegral*/) { + _STLP_DEBUG_CHECK(__check_range(__f,__l)) + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) + __construct_checker(const value_type* __f, const value_type* __l) { + _STLP_DEBUG_CHECK(__check_ptr_range(__f,__l)) + } + + typedef _DBG_iter_base<_Container> _IteType; + __construct_checker(const _IteType& __f, const _IteType& __l) { + _STLP_DEBUG_CHECK(__check_range(__f,__l)) + } +#endif +#if defined (__BORLANDC__) + ~__construct_checker(){} +#endif +}; + +#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES) +# if defined (_STLP_NESTED_TYPE_PARAM_BUG) ||\ + (defined (__SUNPRO_CC) && __SUNPRO_CC < 0x600) +# define _STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS 1 +# endif + +_STLP_MOVE_TO_STD_NAMESPACE + +template +inline ptrdiff_t* +distance_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { return (ptrdiff_t*) 0; } + +# if !defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::value_type* +value_type(const _STLP_PRIV _DBG_iter_base<_Container>&) { + typedef _STLP_TYPENAME _STLP_PRIV _DBG_iter_base<_Container>::value_type _Val; + return (_Val*)0; +} + +template +inline _STLP_TYPENAME_ON_RETURN_TYPE _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category +iterator_category(const _STLP_PRIV _DBG_iter_base<_Container>&) { + typedef _STLP_TYPENAME _STLP_PRIV _DBG_iter_base<_Container>::_Iterator_category _Category; + return _Category(); +} +# endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +#endif /* _STLP_USE_OLD_HP_ITERATOR_QUERIES */ + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* INTERNAL_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_list.h b/sdk/tlibstdcxx/stlport/stl/debug/_list.h new file mode 100644 index 0000000000..c45e1e7860 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_list.h @@ -0,0 +1,495 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DBG_LIST_H +#define _STLP_INTERNAL_DBG_LIST_H + +#ifndef _STLP_INTERNAL_ALGO_H +# include +#endif + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +#define _STLP_NON_DBG_LIST _STLP_PRIV _STLP_NON_DBG_NAME(list) <_Tp, _Alloc> + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _Tp* +value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&) +{ return (_Tp*)0; } +template +inline bidirectional_iterator_tag +iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_LIST >&) +{ return bidirectional_iterator_tag(); } +#endif + +template ) > +class list : +#if !defined (__DMC__) + private +#endif + _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + , public __stlport_class > +#endif +{ + typedef _STLP_NON_DBG_LIST _Base; + typedef list<_Tp, _Alloc> _Self; + typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_LIST > _ConstructCheck; + +public: + __IMPORT_CONTAINER_TYPEDEFS(_Base) + +public: + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits > > iterator; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits > > const_iterator; + + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; + +private: + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + + void _Invalidate_iterator(const iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } + void _Invalidate_iterators(const iterator& __first, const iterator& __last) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } + + typedef typename _Base::iterator _Base_iterator; + +public: + explicit list(const allocator_type& __a = allocator_type()) : + _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit list(size_type __n, const _Tp& __x = _Tp(), +#else + list(size_type __n, const _Tp& __x, +#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit list(size_type __n) + : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + list(__move_source<_Self> src) + : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + list(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), + _M_iter_list(&_M_non_dbg_impl) {} +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + list(_InputIterator __first, _InputIterator __last) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), + _M_iter_list(&_M_non_dbg_impl) {} +# endif +#else + + list(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first, __last, __a), + _M_iter_list(&_M_non_dbg_impl) {} + list(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), + _M_iter_list(&_M_non_dbg_impl) {} + +#endif + + list(const _Self& __x) : + _ConstructCheck(__x), + _M_non_dbg_impl(__x._M_non_dbg_impl) , _M_iter_list(&_M_non_dbg_impl) {} + + _Self& operator=(const _Self& __x) { + if (this != &__x) { + //Should not invalidate end iterator + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl = __x._M_non_dbg_impl; + } + return *this; + } + + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } + + iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + + iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + size_type size() const { return _M_non_dbg_impl.size(); } + size_type max_size() const { return _M_non_dbg_impl.max_size(); } + bool empty() const { return _M_non_dbg_impl.empty(); } + + // those are here to enforce checking + reference front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *begin(); + } + const_reference front() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *begin(); + } + reference back() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *(--end()); + } + const_reference back() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *(--end()); + } + + void swap(_Self& __x) { + _M_iter_list._Swap_owners(__x._M_iter_list); + _M_non_dbg_impl.swap(__x._M_non_dbg_impl); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const _Tp& __x = _Tp()) { +#else + iterator insert(iterator __pos, const _Tp& __x) { +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + return iterator(&_M_iter_list,_M_non_dbg_impl.insert(__pos._M_iterator, __x) ); + } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.insert(__pos._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) + void insert(iterator __pos, const _Tp* __first, const _Tp* __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) + void insert(iterator __pos, + const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) +# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first)) +# endif + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + } + void insert(iterator __pos, + iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) +# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __first)) +# endif + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + } +#endif + + void insert(iterator __pos, size_type __n, const _Tp& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); + } + + void push_back(const_reference __x) { _M_non_dbg_impl.push_back(__x); } + void pop_back() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + _Invalidate_iterator(end()); + _M_non_dbg_impl.pop_back(); + } + + void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); } + void pop_front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + _Invalidate_iterator(begin()); + _M_non_dbg_impl.pop_front(); + } + + iterator erase(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _Invalidate_iterator(__pos); + return iterator(&_M_iter_list,_M_non_dbg_impl.erase(__pos._M_iterator)); + } + iterator erase(iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _Invalidate_iterators(__first, __last); + return iterator (&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); + } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const _Tp& __x = _Tp()) { +#else + void resize(size_type __new_size, const _Tp& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + _Base_iterator __i = _M_non_dbg_impl.begin(); + size_type __len = 0; + for ( ; __i != _M_non_dbg_impl.end() && __len < __new_size; ++__i, ++__len); + + if (__len == __new_size) + erase(iterator(&_M_iter_list, __i), end()); + else // __i == end() + _M_non_dbg_impl.insert(_M_non_dbg_impl.end(), __new_size - __len, __x); + } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + _Invalidate_iterators(begin(), end()); + } +#else + void assign(const _Tp* __first, const _Tp* __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + _M_non_dbg_impl.assign(__first, __last); + _Invalidate_iterators(begin(), end()); + } + + void assign(iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); + _Invalidate_iterators(begin(), end()); + } + + void assign(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); + _Invalidate_iterators(begin(), end()); + } +#endif + + void assign(size_type __n, const _Tp& __val) { + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.assign(__n, __val); + } + + void remove(const _Tp& __x) { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + while (__first != __last) { + _Base_iterator __next = __first; + ++__next; + if (__x == *__first) { + _Invalidate_iterator(iterator(&_M_iter_list, __first)); + _M_non_dbg_impl.erase(__first); + } + __first = __next; + } + } + + void clear() { + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.clear(); + } + +public: + void splice(iterator __pos, _Self& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl); +#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL) + if (get_allocator() == __x.get_allocator()) + __x._M_iter_list._Set_owner(_M_iter_list); + else +#endif + // Std: 23.2.2.4:4 + // end iterator is not invalidated: + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + + void splice(iterator __pos, _Self& __x, iterator __i) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&(__x._M_iter_list),__i)) + _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator); +#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL) + if (get_allocator() == __x.get_allocator()) + _STLP_PRIV __change_ite_owner(__i, &_M_iter_list); + else +#endif + // Std: 23.2.2.4:7 + __x._Invalidate_iterator(__i); + } + + void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end())) + _STLP_DEBUG_CHECK(this == &__x ? !_STLP_PRIV __check_range(__pos, __first, __last) : true) +#if (_STLP_DEBUG_LEVEL != _STLP_STANDARD_DBG_LEVEL) + if (this->get_allocator() == __x.get_allocator()) + _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list); + else +#endif + // Std: 23.2.2.4:12 + __x._Invalidate_iterators(__first, __last); + _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __first._M_iterator, __last._M_iterator); + } + + void merge(_Self& __x) { +#if !defined (_STLP_NO_EXTENSIONS) + _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(begin()._M_iterator, end()._M_iterator)) + _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator)) +#endif + _M_non_dbg_impl.merge(__x._M_non_dbg_impl); + if (this->get_allocator() == __x.get_allocator()) { + __x._M_iter_list._Set_owner(_M_iter_list); + } + else { + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + } + void reverse() { + _M_non_dbg_impl.reverse(); + } + void unique() { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + if (__first == __last) return; + _Base_iterator __next = __first; + while (++__next != __last) { + if (*__first == *__next) { + _Invalidate_iterator(iterator(&_M_iter_list, __next)); + _M_non_dbg_impl.erase(__next); + } + else + __first = __next; + __next = __first; + } + } + void sort() { + _M_non_dbg_impl.sort(); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void remove_if(_Predicate __pred) { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + while (__first != __last) { + _Base_iterator __next = __first; + ++__next; + if (__pred(*__first)) { + _Invalidate_iterator(iterator(&_M_iter_list, __first)); + _M_non_dbg_impl.erase(__first); + } + __first = __next; + } + } + + template + void unique(_BinaryPredicate __binary_pred) { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + if (__first == __last) return; + _Base_iterator __next = __first; + while (++__next != __last) { + if (__binary_pred(*__first, *__next)) { + _Invalidate_iterator(iterator(&_M_iter_list, __next)); + _M_non_dbg_impl.erase(__next); + } + else + __first = __next; + __next = __first; + } + } + + template + void merge(_Self& __x, _StrictWeakOrdering __comp) { +#if !defined (_STLP_NO_EXTENSIONS) + _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __comp)) + _STLP_DEBUG_CHECK(_STLP_STD::is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __comp)) +#endif + _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __comp); + if (this->get_allocator() == __x.get_allocator()) { + __x._M_iter_list._Set_owner(_M_iter_list); + } + else { + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + } + + template + void sort(_StrictWeakOrdering __comp) { + _M_non_dbg_impl.sort(__comp); + } +#endif +}; + + +_STLP_END_NAMESPACE + +#undef _STLP_NON_DBG_LIST + +#endif /* _STLP_INTERNAL_LIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_slist.h b/sdk/tlibstdcxx/stlport/stl/debug/_slist.h new file mode 100644 index 0000000000..2eeaf36733 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_slist.h @@ -0,0 +1,613 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DBG_SLIST_H +#define _STLP_INTERNAL_DBG_SLIST_H + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +#define _STLP_NON_DBG_SLIST _STLP_PRIV _STLP_NON_DBG_NAME(slist) <_Tp, _Alloc> + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _Tp* +value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&) +{ return (_Tp*)0; } + +template +inline forward_iterator_tag +iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_SLIST >&) +{ return forward_iterator_tag(); } +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +/* + * slist special debug traits version. + */ +template +struct _SlistDbgTraits : _Traits { + typedef _SlistDbgTraits _ConstTraits; + typedef _SlistDbgTraits _NonConstTraits; + + /* + * We don't want the before_begin iterator to return false at _Dereferenceable + * call to do not break the current debug framework but calling * operator should + * fail. + */ + template + static bool _Check(const _Iterator& __it) + { return !(__it._M_iterator == (__it._Get_container_ptr())->before_begin()); } +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +template ) > +class slist : +#if !defined (__DMC__) + private +#endif + _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + , public __stlport_class > +#endif +{ +private: + typedef _STLP_NON_DBG_SLIST _Base; + typedef slist<_Tp,_Alloc> _Self; + typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_SLIST > _ConstructCheck; + +public: + + __IMPORT_CONTAINER_TYPEDEFS(_Base) + + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Nonconst_traits > > iterator; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _SlistDbgTraits<_Const_traits > > const_iterator; + + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } +private: + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + + void _Invalidate_iterator(const iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } + void _Invalidate_iterators(const iterator& __first, const iterator& __last) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } + + typedef typename _Base::iterator _Base_iterator; + +public: + explicit slist(const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__a) , _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit slist(size_type __n, const value_type& __x = _Tp(), +#else + slist(size_type __n, const value_type& __x, +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit slist(size_type __n) : _M_non_dbg_impl(__n) , _M_iter_list(&_M_non_dbg_impl) {} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + slist(__move_source<_Self> src) + : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template + slist(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), + _M_iter_list(&_M_non_dbg_impl) {} +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + slist(_InputIterator __first, _InputIterator __last) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), + _M_iter_list(&_M_non_dbg_impl) {} +# endif +#else + + slist(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first, __last, __a), + _M_iter_list(&_M_non_dbg_impl) {} + + slist(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type() ) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), + _M_iter_list(&_M_non_dbg_impl) {} +#endif + + slist(const _Self& __x) : + _ConstructCheck(__x), + _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} + + _Self& operator= (const _Self& __x) { + if (this != &__x) { + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl = __x._M_non_dbg_impl; + } + return *this; + } + + ~slist() {} + + void assign(size_type __n, const value_type& __val) { + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.assign(__n, __val); + } + + iterator before_begin() + { return iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); } + const_iterator before_begin() const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.before_begin()); } + + iterator begin() + { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator begin() const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin());} + + iterator end() + { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_iterator end() const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + + bool empty() const { return _M_non_dbg_impl.empty(); } + size_type size() const { return _M_non_dbg_impl.size(); } + size_type max_size() const { return _M_non_dbg_impl.max_size(); } + + void swap(_Self& __x) { + _M_iter_list._Swap_owners(__x._M_iter_list); + _M_non_dbg_impl.swap(__x._M_non_dbg_impl); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + reference front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return _M_non_dbg_impl.front(); + } + const_reference front() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return _M_non_dbg_impl.front(); + } + void push_front(const_reference __x) { _M_non_dbg_impl.push_front(__x); } + void pop_front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + _M_non_dbg_impl.pop_front(); + } + iterator previous(const_iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + return iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator)); + } + const_iterator previous(const_iterator __pos) const { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + return const_iterator(&_M_iter_list, _M_non_dbg_impl.previous(__pos._M_iterator)); + } + +public: + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert_after(iterator __pos, const value_type& __x = _Tp()) { +#else + iterator insert_after(iterator __pos, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + return iterator(&_M_iter_list,_M_non_dbg_impl.insert_after(__pos._M_iterator, __x)); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert_after(iterator __pos) { + return insert_after(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void insert_after(iterator __pos, size_type __n, const value_type& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _M_non_dbg_impl.insert_after(__pos._M_iterator, __n, __x); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#else + void assign(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.assign(__first._M_iterator, __last._M_iterator); + } + void assign(const value_type *__first, const value_type *__last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.assign(__first, __last); + } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert_after(iterator __pos, _InIter __first, _InIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.insert_after(__pos._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } + + template + void insert(iterator __pos, _InIter __first, _InIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.insert(__pos._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#else + void insert_after(iterator __pos, + const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.insert_after(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + } + void insert_after(iterator __pos, + const value_type* __first, const value_type* __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + _M_non_dbg_impl.insert_after(__pos._M_iterator, __first, __last); + } + + void insert(iterator __pos, const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + } + void insert(iterator __pos, const value_type* __first, + const value_type* __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first, __last)) + _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); + } +#endif + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos, const value_type& __x = _Tp()) { +#else + iterator insert(iterator __pos, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x)); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos) { + return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); + } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void insert(iterator __pos, size_type __n, const value_type& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); + } + +public: + iterator erase_after(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + iterator __tmp = __pos; ++__tmp; + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp)) + _Invalidate_iterator(__tmp); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__pos._M_iterator)); + } + iterator erase_after(iterator __before_first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __last, begin(), end())) + iterator __tmp = __before_first; ++__tmp; + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__tmp)) + _Invalidate_iterators(__tmp, __last); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase_after(__before_first._M_iterator, __last._M_iterator)); + } + + iterator erase(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_VERBOSE_ASSERT(__pos._M_iterator != _M_non_dbg_impl.before_begin(), _StlMsg_INVALID_ARGUMENT) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _Invalidate_iterator(__pos); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); + } + iterator erase(iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _Invalidate_iterators(__first, __last); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); + } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const value_type& __x = _Tp()) { +#else + void resize(size_type __new_size, const value_type& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + _M_non_dbg_impl.resize(__new_size, __x); + } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void clear() { + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.clear(); + } + +public: + // Removes all of the elements from the list __x to *this, inserting + // them immediately after __pos. __x must not be *this. Complexity: + // linear in __x.size(). + void splice_after(iterator __pos, _Self& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT) + _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl); + if (get_allocator() == __x.get_allocator()) { + __x._M_iter_list._Set_owner(_M_iter_list); + } + else { + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + } + + // Moves the element that follows __prev to *this, inserting it immediately + // after __pos. This is constant time. + void splice_after(iterator __pos, _Self& __x, iterator __prev) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__prev)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __prev)) + iterator __elem = __prev; ++__elem; + _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, __prev._M_iterator); + if (get_allocator() == __x.get_allocator()) { + _STLP_PRIV __change_ite_owner(__elem, &_M_iter_list); + } + else { + __x._Invalidate_iterator(__elem); + } + } + + // Moves the range [__before_first + 1, __before_last + 1) to *this, + // inserting it immediately after __pos. This is constant time. + void splice_after(iterator __pos, _Self& __x, + iterator __before_first, iterator __before_last) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__before_first, __before_last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list, __before_first)) + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_first)) + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__before_last)) + iterator __first = __before_first; ++__first; + iterator __last = __before_last; ++__last; + if (get_allocator() == __x.get_allocator()) { + _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list); + } + else { + __x._Invalidate_iterators(__first, __last); + } + _M_non_dbg_impl.splice_after(__pos._M_iterator, __x._M_non_dbg_impl, + __before_first._M_iterator, __before_last._M_iterator); + } + + void splice(iterator __pos, _Self& __x) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + _STLP_VERBOSE_ASSERT(!(&__x == this), _StlMsg_INVALID_ARGUMENT) + _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl); + if (get_allocator() == __x.get_allocator()) { + __x._M_iter_list._Set_owner(_M_iter_list); + } + else { + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + } + + void splice(iterator __pos, _Self& __x, iterator __i) { + //__pos should be owned by *this and not be the before_begin iterator + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + //__i should be dereferenceable, not before_begin and be owned by __x + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__i)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&__x._M_iter_list ,__i)) + _STLP_VERBOSE_ASSERT(!(__i == __x.before_begin()), _StlMsg_INVALID_ARGUMENT) + if (get_allocator() == __x.get_allocator()) { + _STLP_PRIV __change_ite_owner(__i, &_M_iter_list); + } + else { + __x._Invalidate_iterator(__i); + } + _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, __i._M_iterator); + } + + void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _STLP_VERBOSE_ASSERT(!(__pos._M_iterator == _M_non_dbg_impl.before_begin()), _StlMsg_INVALID_ARGUMENT) + //_STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, __x.begin(), __x.end())) + if (get_allocator() == __x.get_allocator()) { + _STLP_PRIV __change_range_owner(__first, __last, &_M_iter_list); + } + else { + __x._Invalidate_iterators(__first, __last); + } + _M_non_dbg_impl.splice(__pos._M_iterator, __x._M_non_dbg_impl, + __first._M_iterator, __last._M_iterator); + } + + void reverse() + { _M_non_dbg_impl.reverse(); } + + void remove(const value_type& __val) { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + while (__first != __last) { + _Base_iterator __next = __first; + ++__next; + if (__val == *__first) { + _Invalidate_iterator(iterator(&_M_iter_list, __first)); + _M_non_dbg_impl.erase(__first); + } + __first = __next; + } + } + void unique() { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + if (__first == __last) return; + _Base_iterator __next = __first; + while (++__next != __last) { + if (*__first == *__next) { + _Invalidate_iterator(iterator(&_M_iter_list, __next)); + _M_non_dbg_impl.erase(__next); + } + else + __first = __next; + __next = __first; + } + } + void merge(_Self& __x) { + _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT) +#if !defined (_STLP_NO_EXTENSIONS) + /* comments below due to bug in GCC compilers: ones eat all memory and die if see + * something like namespace_name::func_name() - ptr + */ + _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end())) + _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator)) +#endif + _M_non_dbg_impl.merge(__x._M_non_dbg_impl); + if (get_allocator() == __x.get_allocator()) { + __x._M_iter_list._Set_owner(_M_iter_list); + } + else { + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + } + void sort() { + _M_non_dbg_impl.sort(); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void remove_if(_Predicate __pred) { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + while (__first != __last) { + _Base_iterator __next = __first; + ++__next; + if (__pred(*__first)) { + _Invalidate_iterator(iterator(&_M_iter_list, __first)); + _M_non_dbg_impl.erase(__first); + } + __first = __next; + } + } + + template + void unique(_BinaryPredicate __pred) { + _Base_iterator __first = _M_non_dbg_impl.begin(), __last = _M_non_dbg_impl.end(); + if (__first == __last) return; + _Base_iterator __next = __first; + while (++__next != __last) { + if (__binary_pred(*__first, *__next)) { + _Invalidate_iterator(iterator(&_M_iter_list, __next)); + _M_non_dbg_impl.erase(__next); + } + else + __first = __next; + __next = __first; + } + } + + template + void merge(_Self& __x, _StrictWeakOrdering __ord) { + _STLP_VERBOSE_ASSERT(&__x != this, _StlMsg_INVALID_ARGUMENT) +#if !defined (_STLP_NO_EXTENSIONS) + /* comments below due to bug in GCC compilers: ones eat all memory and die if see + * something like namespace_name::func_name() - ptr + */ + _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(_M_non_dbg_impl.begin(), _M_non_dbg_impl.end(), __ord)) + _STLP_DEBUG_CHECK( /* _STLP_STD:: */ is_sorted(__x.begin()._M_iterator, __x.end()._M_iterator, __ord)) +#endif + _M_non_dbg_impl.merge(__x._M_non_dbg_impl, __ord); + if (get_allocator() == __x.get_allocator()) { + __x._M_iter_list._Set_owner(_M_iter_list); + } + else { + __x._Invalidate_iterators(__x.begin(), __x.end()); + } + } + + template + void sort(_StrictWeakOrdering __comp) + { _M_non_dbg_impl.sort(__comp); } +#endif +}; + +_STLP_END_NAMESPACE + +#undef _STLP_NON_DBG_SLIST + +#endif /* _STLP_INTERNAL_DBG_SLIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_string.h b/sdk/tlibstdcxx/stlport/stl/debug/_string.h new file mode 100644 index 0000000000..49f7ab2258 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_string.h @@ -0,0 +1,828 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +#ifndef _STLP_DBG_STRING_H +#define _STLP_DBG_STRING_H + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define _STLP_NON_DBG_STRING_NAME _STLP_NON_DBG_NAME(str) +#define _STLP_NON_DBG_STRING _STLP_PRIV _STLP_NON_DBG_STRING_NAME <_CharT, _Traits, _Alloc> + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _CharT* +value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&) +{ return (_CharT*)0; } +template +inline random_access_iterator_tag +iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_STRING >&) +{ return random_access_iterator_tag(); } +#endif + +template +class basic_string : +#if !defined (__DMC__) + private +#else + public +#endif + _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (basic_string) + , public __stlport_class > +#endif +{ +protected: + typedef _STLP_NON_DBG_STRING _Base; + typedef basic_string<_CharT, _Traits, _Alloc> _Self; + typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_STRING > _ConstructCheck; + typedef typename _IsPOD<_CharT>::_Type _Char_Is_POD; + +public: + __IMPORT_CONTAINER_TYPEDEFS(_Base) + typedef typename _Base::traits_type traits_type; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Nonconst_traits > > iterator; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_Const_traits > > const_iterator; + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +public: // Constructor, destructor, assignment. + typedef typename _Base::_Reserve_t _Reserve_t; + +private: + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + + void _Invalidate_all() + { _M_iter_list._Invalidate_all(); } + void _Compare_Capacity (size_type __old_capacity) { + if (this->capacity() > __old_capacity) { + _Invalidate_all(); + } + } + void _Invalidate_iterator(const iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } + void _Invalidate_iterators(const iterator& __f, const iterator& __l) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __f, __l); } + +public: +#include + + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } + + explicit basic_string(const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} + + basic_string(_Reserve_t __r, size_t __n, + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__r, __n, __a), _M_iter_list(&_M_non_dbg_impl) {} + + basic_string(const _Self& __s) + : _ConstructCheck(__s), + _M_non_dbg_impl(__s._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} + + basic_string(const _Self& __s, size_type __pos, size_type __n = npos, + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__s._M_non_dbg_impl, __pos, __n, __a), + _M_iter_list(&_M_non_dbg_impl) {} + + basic_string(const _CharT* __s, size_type __n, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__s), _M_non_dbg_impl(__s, __n, __a), + _M_iter_list(&_M_non_dbg_impl) {} + + basic_string(const _CharT* __s, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__s), + _M_non_dbg_impl(__s, __a), _M_iter_list(&_M_non_dbg_impl) {} + + basic_string(size_type __n, _CharT __c, + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__n, __c, __a), _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + basic_string(__move_source<_Self> src) + : _M_non_dbg_impl(__move_source<_Base >(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) + basic_string(const _CharT* __f, const _CharT* __l, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__f, __l), + _M_non_dbg_impl(__f, __l, __a), _M_iter_list(&_M_non_dbg_impl) { + } + basic_string(const_iterator __f, const_iterator __l, + const allocator_type & __a = allocator_type()) + : _ConstructCheck(__f, __l), + _M_non_dbg_impl(__f._M_iterator, __l._M_iterator, __a), _M_iter_list(&_M_non_dbg_impl) { + } +#else + template + basic_string(_InputIterator __f, _InputIterator __l, + const allocator_type & __a _STLP_ALLOCATOR_TYPE_DFL) + : _ConstructCheck(__f, __l), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l), __a), + _M_iter_list(&_M_non_dbg_impl) {} +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + basic_string(_InputIterator __f, _InputIterator __l) + : _ConstructCheck(__f, __l), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)), + _M_iter_list(&_M_non_dbg_impl) {} +# endif +#endif + +private: + // constructor from non-debug version for substr + basic_string (const _Base& __x) + : _M_non_dbg_impl(__x), _M_iter_list(&_M_non_dbg_impl) {} + +public: + _Self& operator=(const _Self& __s) { + if (this != &__s) { + assign(__s); + } + return *this; + } + + _Self& operator=(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return assign(__s); + } + + _Self& operator=(_CharT __c) { + return assign(1, __c); + } + + // Iterators. + iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + // Size, capacity, etc. + size_type size() const { return _M_non_dbg_impl.size(); } + size_type length() const { return _M_non_dbg_impl.length(); } + size_t max_size() const { return _M_non_dbg_impl.max_size(); } + + void resize(size_type __n, _CharT __c) { + if (__n > capacity()) + _Invalidate_all(); + else if (__n < size()) + _Invalidate_iterators(begin() + __n, end()); + _M_non_dbg_impl.resize(__n, __c); + } + void resize(size_type __n) { resize(__n, _STLP_DEFAULT_CONSTRUCTED(_CharT)); } + size_type capacity() const { return _M_non_dbg_impl.capacity(); } + + void reserve(size_type __s = 0) { + if (__s > capacity()) _Invalidate_all(); + _M_non_dbg_impl.reserve(__s); + } + + void clear() { + _Invalidate_all(); + _M_non_dbg_impl.clear(); + } + + bool empty() const { return _M_non_dbg_impl.empty(); } + + const_reference operator[](size_type __n) const { + _STLP_VERBOSE_ASSERT(__n <= this->size(), _StlMsg_OUT_OF_BOUNDS); + return _M_non_dbg_impl[__n]; + } + + reference operator[](size_type __n) { + _STLP_VERBOSE_ASSERT(__n < this->size(), _StlMsg_OUT_OF_BOUNDS) + return _M_non_dbg_impl[__n]; + } + + const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); } + reference at(size_type __n) { return _M_non_dbg_impl.at(__n); } + + // Append, operator+=, push_back. + _Self& operator+=(const _Self& __s) { return append(__s); } + _Self& operator+=(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return append(__s); + } + _Self& operator+=(_CharT __c) { return append(1, __c); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + _Self& append(_InputIter __first, _InputIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + _Compare_Capacity(__old_capacity); + return *this; + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || \ + !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) + _Self& append(const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(__f, __l); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& append(const_iterator __f, const_iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(__f._M_iterator, __l._M_iterator); + _Compare_Capacity(__old_capacity); + return *this; + } +#endif + + _Self& append(const _Self& __s) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(__s._M_non_dbg_impl); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& append(const _Self& __s, size_type __pos, size_type __n) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(__s._M_non_dbg_impl, __pos, __n); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& append(const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(__s, __n); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& append(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.append(__s); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& append(size_type __n, _CharT __c) { + size_type __old_capacity = this->capacity(); + _M_non_dbg_impl.append(__n, __c); + _Compare_Capacity(__old_capacity); + return *this; + } + + void push_back(_CharT __c) { + size_type __old_capacity = this->capacity(); + _M_non_dbg_impl.push_back(__c); + _Compare_Capacity(__old_capacity); + } + + void pop_back() { + _Invalidate_iterator(this->end()); + _M_non_dbg_impl.pop_back(); + } + + // Assign + _Self& assign(const _Self& __s) { + _Invalidate_all(); + _M_non_dbg_impl.assign(__s._M_non_dbg_impl); + return *this; + } + + _Self& assign(const _Self& __s, size_type __pos, size_type __n) { + if (__pos < __s.size()) { + _Invalidate_all(); + } + _M_non_dbg_impl.assign(__s._M_non_dbg_impl, __pos, __n); + return *this; + } + + _Self& assign(const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + _Invalidate_all(); + _M_non_dbg_impl.assign(__s, __s + __n); + return *this; + } + + _Self& assign(const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + _Invalidate_all(); + _M_non_dbg_impl.assign(__s); + return *this; + } + + _Self& assign(size_type __n, _CharT __c) { + _Invalidate_all(); + _M_non_dbg_impl.assign(__n, __c); + return *this; + } + +#if defined(_STLP_MEMBER_TEMPLATES) + template + inline _Self& assign(_InputIter __first, _InputIter __last) { + _STLP_FIX_LITERAL_BUG(__first) _STLP_FIX_LITERAL_BUG(__last) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _Invalidate_all(); + _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + return *this; + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || \ + !defined (_STLP_NO_METHOD_SPECIALIZATION) && !defined (_STLP_NO_EXTENSIONS) + _Self& assign(const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f) _STLP_FIX_LITERAL_BUG(__l) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) + _Invalidate_all(); + _M_non_dbg_impl.assign(__f, __l); + return *this; + } + _Self& assign(const_iterator __f, const_iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + _Invalidate_all(); + _M_non_dbg_impl.assign(__f._M_iterator, __l._M_iterator); + return *this; + } +#endif + + // Insert + _Self& insert(size_type __pos, const _Self& __s) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& insert(size_type __pos, const _Self& __s, + size_type __beg, size_type __n) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos, __s._M_non_dbg_impl, __beg, __n); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& insert(size_type __pos, const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos, __s, __n); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& insert(size_type __pos, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return insert(__pos, __s, _Traits::length(__s)); + } + + _Self& insert(size_type __pos, size_type __n, _CharT __c) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos, __n, __c); + _Compare_Capacity(__old_capacity); + return *this; + } + + iterator insert(iterator __p, _CharT __c) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) + size_type __old_capacity = capacity(); + typename _Base::iterator __ret = _M_non_dbg_impl.insert(__p._M_iterator, __c); + _Compare_Capacity(__old_capacity); + return iterator(&_M_iter_list, __ret); + } + + void insert(iterator __p, size_t __n, _CharT __c) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__p._M_iterator, __n, __c); + _Compare_Capacity(__old_capacity); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(iterator __p, _InputIter __first, _InputIter __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) + + size_type __old_capacity = this->capacity(); + _M_non_dbg_impl.insert(__p._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + _Compare_Capacity(__old_capacity); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) + void insert(iterator __p, const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f,__l)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__p._M_iterator, __f, __l); + _Compare_Capacity(__old_capacity); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) + // Those overloads are necessary to check self referencing correctly in non debug + // basic_string implementation + void insert(iterator __p, const_iterator __f, const_iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l)) +# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f)) +# endif + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator); + _Compare_Capacity(__old_capacity); + } + void insert(iterator __p, iterator __f, iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__p)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f,__l)) +# if (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + _STLP_STD_DEBUG_CHECK(__check_if_not_owner(&_M_iter_list, __f)) +# endif + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__p._M_iterator, __f._M_iterator, __l._M_iterator); + _Compare_Capacity(__old_capacity); + } +#endif + + // Erase. + _Self& erase(size_type __pos = 0, size_type __n = npos) { + if (__pos < size()) { + _Invalidate_iterators(begin() + __pos, end()); + } + _M_non_dbg_impl.erase(__pos, __n); + return *this; + } + iterator erase(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list,__pos)) + _Invalidate_iterators(__pos, end()); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); + } + iterator erase(iterator __f, iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) + _Invalidate_iterators(__f, end()); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__f._M_iterator, __l._M_iterator)); + } + + // Substring. + _Self substr(size_type __pos = 0, size_type __n = npos) const + { return _M_non_dbg_impl.substr(__pos, __n); } + + // Replace. (Conceptually equivalent to erase followed by insert.) + _Self& replace(size_type __pos, size_type __n, const _Self& __s) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__pos, __n, __s._M_non_dbg_impl); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(size_type __pos1, size_type __n1, const _Self& __s, + size_type __pos2, size_type __n2) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__pos, __n1, __s, __n2); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(size_type __pos, size_type __n1, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__pos, __n1, __s); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) { + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__pos, __n1, __n2, __c); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(iterator __f, iterator __l, const _Self& __s) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s._M_non_dbg_impl); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(iterator __f, iterator __l, const _CharT* __s, size_type __n) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s, __n); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(iterator __f, iterator __l, const _CharT* __s) { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __s); + _Compare_Capacity(__old_capacity); + return *this; + } + + _Self& replace(iterator __f, iterator __l, size_type __n, _CharT __c) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l, begin(), end())) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__f._M_iterator, __l._M_iterator, __n, __c); + _Compare_Capacity(__old_capacity); + return *this; + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + _Self& replace(iterator __first, iterator __last, + _InputIter __f, _InputIter __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__f), _STLP_PRIV _Non_Dbg_iter(__l)); + _Compare_Capacity(__old_capacity); + return *this; + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) + _Self& replace(iterator __first, iterator __last, + const _CharT* __f, const _CharT* __l) { + _STLP_FIX_LITERAL_BUG(__f)_STLP_FIX_LITERAL_BUG(__l) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__f, __l)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, __f, __l); + _Compare_Capacity(__old_capacity); + return *this; + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) + _Self& replace(iterator __first, iterator __last, + const_iterator __f, const_iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, + __f._M_iterator, __l._M_iterator); + _Compare_Capacity(__old_capacity); + return *this; + } + _Self& replace(iterator __first, iterator __last, + iterator __f, iterator __l) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__f, __l)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.replace(__first._M_iterator, __last._M_iterator, + __f._M_iterator, __l._M_iterator); + _Compare_Capacity(__old_capacity); + return *this; + } +#endif + + // Other modifier member functions. + void swap(_Self& __s) { + _M_iter_list._Swap_owners(__s._M_iter_list); + _M_non_dbg_impl.swap(__s._M_non_dbg_impl); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + int compare(const _Self& __s) const + { return _M_non_dbg_impl.compare(__s._M_non_dbg_impl); } + int compare(size_type __pos, size_type __n, const _Self& __s) const + { return _M_non_dbg_impl.compare(__pos, __n, __s._M_non_dbg_impl); } + int compare(size_type __pos1, size_type __n1, const _Self& __s, + size_type __pos2, size_type __n2) const + { return _M_non_dbg_impl.compare(__pos1, __n1, __s._M_non_dbg_impl, __pos2, __n2); } + int compare(const _CharT* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + return _M_non_dbg_impl.compare(__s); + } + int compare(size_type __pos, size_type __n, const _CharT* __s) const { + _STLP_FIX_LITERAL_BUG(__s) + return _M_non_dbg_impl.compare(__pos, __n, __s); + } + int compare(size_type __pos1, size_type __n1, const _CharT* __s, + size_type __n2) const { + _STLP_FIX_LITERAL_BUG(__s) + return _M_non_dbg_impl.compare(__pos1, __n1, __s, __n2); + } + + // Helper functions for compare. + static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1, + const _CharT* __f2, const _CharT* __l2) + { return _Base::_M_compare(__f1, __l1, __f2, __l2); } + static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1, + const _CharT* __f2, const _CharT* __l2) + { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2, __l2); } + static int _STLP_CALL _M_compare(const _CharT* __f1, const _CharT* __l1, + const_iterator __f2, const_iterator __l2) + { return _Base::_M_compare(__f1, __l1, __f2._M_iterator, __l2._M_iterator); } + static int _STLP_CALL _M_compare(const_iterator __f1, const_iterator __l1, + const_iterator __f2, const_iterator __l2) + { return _Base::_M_compare(__f1._M_iterator, __l1._M_iterator, __f2._M_iterator, __l2._M_iterator); } + + const _CharT* c_str() const { return _M_non_dbg_impl.c_str(); } + const _CharT* data() const { return _M_non_dbg_impl.data(); } + + size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const + { return _M_non_dbg_impl.copy(__s, __n, __pos); } + + // find. + size_type find(const _Self& __s, size_type __pos = 0) const + { return _M_non_dbg_impl.find(__s._M_non_dbg_impl, __pos); } + size_type find(const _CharT* __s, size_type __pos = 0) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find(__s, __pos); + } + size_type find(const _CharT* __s, size_type __pos, size_type __n) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find(__s, __pos, __n); + } + // WIE: Versant schema compiler 5.2.2 ICE workaround + size_type find(_CharT __c) const { return find(__c, 0); } + size_type find(_CharT __c, size_type __pos /* = 0 */) const + { return _M_non_dbg_impl.find(__c, __pos); } + + // rfind. + size_type rfind(const _Self& __s, size_type __pos = npos) const + { return _M_non_dbg_impl.rfind(__s._M_non_dbg_impl, __pos); } + size_type rfind(const _CharT* __s, size_type __pos = npos) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.rfind(__s, __pos); + } + size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.rfind(__s, __pos, __n); + } + size_type rfind(_CharT __c, size_type __pos = npos) const + { return _M_non_dbg_impl.rfind(__c, __pos); } + + // find_first_of + size_type find_first_of(const _Self& __s, size_type __pos = 0) const + { return _M_non_dbg_impl.find_first_of(__s._M_non_dbg_impl, __pos); } + size_type find_first_of(const _CharT* __s, size_type __pos = 0) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_first_of(__s, __pos); + } + size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_first_of(__s, __pos, __n); + } + size_type find_first_of(_CharT __c, size_type __pos = 0) const + { return _M_non_dbg_impl.find_first_of(__c, __pos); } + + // find_last_of + size_type find_last_of(const _Self& __s, size_type __pos = npos) const + { return _M_non_dbg_impl.find_last_of(__s._M_non_dbg_impl, __pos); } + size_type find_last_of(const _CharT* __s, size_type __pos = npos) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_last_of(__s, __pos); + } + size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_last_of(__s, __pos, __n); + } + size_type find_last_of(_CharT __c, size_type __pos = npos) const + { return _M_non_dbg_impl.rfind(__c, __pos); } + + // find_first_not_of + size_type find_first_not_of(const _Self& __s, size_type __pos = 0) const + { return _M_non_dbg_impl.find_first_not_of(__s._M_non_dbg_impl, __pos); } + size_type find_first_not_of(const _CharT* __s, size_type __pos = 0) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_first_not_of(__s, __pos); + } + size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_first_not_of(__s, __pos, __n); + } + size_type find_first_not_of(_CharT __c, size_type __pos = 0) const + { return _M_non_dbg_impl.find_first_not_of(__c, __pos); } + + // find_last_not_of + size_type find_last_not_of(const _Self& __s, size_type __pos = npos) const + { return _M_non_dbg_impl.find_last_not_of(__s._M_non_dbg_impl, __pos); } + size_type find_last_not_of(const _CharT* __s, size_type __pos = npos) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_last_not_of(__s, __pos); + } + size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const { + _STLP_FIX_LITERAL_BUG(__s) + _STLP_VERBOSE_ASSERT((__s != 0), _StlMsg_INVALID_ARGUMENT) + return _M_non_dbg_impl.find_last_not_of(__s, __pos, __n); + } + size_type find_last_not_of(_CharT __c, size_type __pos = npos) const + { return _M_non_dbg_impl.find_last_not_of(__c, __pos); } + +#if defined (_STLP_USE_TEMPLATE_EXPRESSION) +# include +#endif +}; + +// This is a hook to instantiate STLport exports in a designated DLL +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +_STLP_MOVE_TO_PRIV_NAMESPACE +_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME , allocator > >; +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; +# if defined (_STLP_HAS_WCHAR_T) +_STLP_MOVE_TO_PRIV_NAMESPACE +_STLP_EXPORT_TEMPLATE_CLASS __construct_checker<_STLP_NON_DBG_STRING_NAME , allocator > >; +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_EXPORT_TEMPLATE_CLASS basic_string, allocator >; +# endif +#endif + +#undef _STLP_NON_DBG_STRING +#undef _STLP_NON_DBG_STRING_NAME + +#if defined (__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ == 96) +template +const size_t basic_string<_CharT, _Traits, _Alloc>::npos = ~(size_t) 0; +#endif + +#if defined (basic_string) +_STLP_MOVE_TO_STD_NAMESPACE +#undef basic_string +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_DBG_STRING */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_string_sum_methods.h b/sdk/tlibstdcxx/stlport/stl/debug/_string_sum_methods.h new file mode 100644 index 0000000000..3fca19484c --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_string_sum_methods.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * All the necessary methods used for template expressions with basic_string + * This file do not have to be macro guarded as it is only used in the _string.h + * file and it is a part of the basic_string definition. + */ + + template + basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s) + : _M_non_dbg_impl(_Reserve_t(), __s.size(), __s.get_allocator()), + _M_iter_list(&_M_non_dbg_impl) + { _M_append_sum(__s, _M_non_dbg_impl); } + + template + basic_string(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + size_type __pos, size_type __n = npos, + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(_Reserve_t(), (__pos <= __s.size()) ? ((min) (__n, __s.size() - __pos)) : 0, __a), + _M_iter_list(&_M_non_dbg_impl) { + size_type __size = __s.size(); + if (__pos > __size) + //This call will generate the necessary out of range exception: + _M_non_dbg_impl.at(0); + else + _M_append_sum_pos(__s, __pos, (min) (__n, __size - __pos), _M_non_dbg_impl); + } + +private: + _Base& _M_append_fast(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str) + { return __str += __c.getValue(); } + _Base& _M_append_fast(_CharT const* __s, size_type __s_size, _Base &__str) + { return __str.append(__s, __s_size); } + _Base& _M_append_fast(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str) + { return _M_append_fast(__s.c_str(), __s.size(), __str); } + _Base& _M_append_fast(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str) + { return _M_append_fast(__s.b_str(), __str); } + _Base& _M_append_fast(_Self const& __s, _Base &__str) + { return _M_append_fast(__s.data(), __s.size(), __str); } + _Base& _M_append_fast(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str) + { return __str; } + template + _Base& _M_append_fast(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, _Base &__str) + { return _M_append_fast(__s.getRhs(), _M_append_fast(__s.getLhs(), __str)); } + + _Base& _M_append_fast_pos(_STLP_PRIV __char_wrapper<_CharT> __c, _Base &__str, size_type /*__pos*/, size_type __n) { + if (__n == 0) + return __str; + return __str += __c.getValue(); + } + _Base& _M_append_fast_pos(_CharT const* __s, size_type __s_size, _Base &__str, + size_type __pos, size_type __n) + { return __str.append(__s + __pos, __s + __pos + (min)(__n, __s_size - __pos)); } + _Base& _M_append_fast_pos(_STLP_PRIV __cstr_wrapper<_CharT> const& __s, _Base &__str, + size_type __pos, size_type __n) + { return _M_append_fast_pos(__s.c_str(), __s.size(), __str, __pos, __n); } + _Base& _M_append_fast_pos(_STLP_PRIV __bstr_wrapper<_CharT, _Traits, _Alloc> __s, _Base &__str, + size_type __pos, size_type __n) + { return _M_append_fast_pos(__s.b_str(), __str, __pos, __n); } + _Base& _M_append_fast_pos(_Self const& __s, _Base &__str, size_type __pos, size_type __n) + { return _M_append_fast_pos(__s.data(), __s.size(), __str, __pos, __n); } + _Base& _M_append_fast_pos(_STLP_PRIV __sum_storage_elem<_CharT, _Traits, _Alloc> const&, _Base &__str, + size_type /*__pos*/, size_type /*__n*/) + { return __str; } + + template + _Base& _M_append_fast_pos(_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + _Base &__str, size_type __pos, size_type __n) { + if (__n == 0) { + return __str; + } + size_type __lhs_size = __s.getLhs().size(); + if (__pos < __lhs_size) { + if (__n < (__lhs_size - __pos)) { + return _M_append_fast_pos(__s.getLhs(), __str, __pos, __n); + } else { + return _M_append_fast_pos(__s.getRhs(), _M_append_fast_pos(__s.getLhs(), __str, __pos, __n), + 0, __n - (__lhs_size - __pos)); + } + } else { + return _M_append_fast_pos(__s.getRhs(), __str, __pos - __lhs_size, __n); + } + } + + template + _Self& _M_append_sum (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + _Base &__impl) { + _M_append_fast(__s, __impl); + return *this; + } + + template + _Self& _M_append_sum_pos (_STLP_PRIV __bstr_sum<_CharT, _Traits, _Alloc, _Left, _Right, _StorageDir> const& __s, + size_type __pos, size_type __n, _Base &__impl) { + _M_non_dbg_impl.reserve(_M_non_dbg_impl.size() + (min) (__s.size() - __pos, __n)); + _M_append_fast_pos(__s, __impl, __pos, __n); + return *this; + } diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_tree.h b/sdk/tlibstdcxx/stlport/stl/debug/_tree.h new file mode 100644 index 0000000000..a32eda2c52 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_tree.h @@ -0,0 +1,317 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DBG_TREE_H +#define _STLP_INTERNAL_DBG_TREE_H + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +#ifndef _STLP_INTERNAL_FUNCTION_BASE_H +# include +#endif + +#ifndef _STLP_INTERNAL_ALLOC_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +class _DbgCompare { +public: + _DbgCompare() {} + _DbgCompare(const _Compare& __cmp) : _M_non_dbg_cmp(__cmp) {} + _DbgCompare(const _DbgCompare& __cmp) : _M_non_dbg_cmp(__cmp._M_non_dbg_cmp) {} + +#if !defined (_STLP_USE_CONTAINERS_EXTENSION) + bool operator () (const _Key& __lhs, const _Key& __rhs) const { +#else + template + bool operator () (const _Kp1& __lhs, const _Kp2& __rhs) const { +#endif + if (_M_non_dbg_cmp(__lhs, __rhs)) { + return true; + } + return false; + } + + _Compare non_dbg_key_comp() const { return _M_non_dbg_cmp; } +private: + _Compare _M_non_dbg_cmp; +}; + +#define _STLP_NON_DBG_TREE _STLP_PRIV _STLP_NON_DBG_NAME(Rb_tree) <_Key, _STLP_PRIV _DbgCompare<_Key, _Compare>, _Value, _KeyOfValue, _Traits, _Alloc> + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +_STLP_MOVE_TO_STD_NAMESPACE +template +inline _Value* +value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&) +{ return (_Value*)0; } +template +inline bidirectional_iterator_tag +iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_TREE >&) +{ return bidirectional_iterator_tag(); } +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template ) > +class _Rb_tree { + typedef _STLP_NON_DBG_TREE _Base; + typedef _Rb_tree<_Key, _Compare, _Value, _KeyOfValue, _Traits, _Alloc> _Self; + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + +public: + __IMPORT_CONTAINER_TYPEDEFS(_Base) + typedef typename _Base::key_type key_type; + + typedef typename _Traits::_NonConstTraits _NonConstIteTraits; + typedef typename _Traits::_ConstTraits _ConstIteTraits; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_NonConstIteTraits> > iterator; + typedef _STLP_PRIV _DBG_iter<_Base, _STLP_PRIV _DbgTraits<_ConstIteTraits> > const_iterator; + + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; + +private: + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + void _Invalidate_iterator(const iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list,__it); } + void _Invalidate_iterators(const iterator& __first, const iterator& __last) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } + + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_iterator _Base_const_iterator; + +public: + _Rb_tree() + : _M_non_dbg_impl(), _M_iter_list(&_M_non_dbg_impl) {} + _Rb_tree(const _Compare& __comp) + : _M_non_dbg_impl(__comp), _M_iter_list(&_M_non_dbg_impl) {} + _Rb_tree(const _Compare& __comp, const allocator_type& __a) + : _M_non_dbg_impl(__comp, __a), _M_iter_list(&_M_non_dbg_impl) {} + _Rb_tree(const _Self& __x) + : _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + _Rb_tree(__move_source<_Self> src): + _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + + ~_Rb_tree() {} + + _Self& operator=(const _Self& __x) { + if (this != &__x) { + //Should not invalidate end iterator: + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl = __x._M_non_dbg_impl; + } + return *this; + } + + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } + _Compare key_comp() const { return _M_non_dbg_impl.key_comp().non_dbg_key_comp(); } + + iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + bool empty() const { return _M_non_dbg_impl.empty(); } + size_type size() const { return _M_non_dbg_impl.size(); } + size_type max_size() const { return _M_non_dbg_impl.max_size(); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const { return _M_non_dbg_impl.count(__x); } + + void swap(_Self& __t) { + _M_non_dbg_impl.swap(__t._M_non_dbg_impl); + _M_iter_list._Swap_owners(__t._M_iter_list); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __k) + { return iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __k) const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.find(__k)); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) + { return iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)); } + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) + { return iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const + { return const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x)); } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) { + return pair(iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)), + iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x))); + } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const { + return pair(const_iterator(&_M_iter_list, _M_non_dbg_impl.lower_bound(__x)), + const_iterator(&_M_iter_list, _M_non_dbg_impl.upper_bound(__x))); + } + + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range_unique(const _KT& __x) { + _STLP_STD::pair<_Base_iterator, _Base_iterator> __p; + __p = _M_non_dbg_impl.equal_range_unique(__x); + return pair(iterator(&_M_iter_list, __p.first), iterator(&_M_iter_list, __p.second)); + } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range_unique(const _KT& __x) const { + _STLP_STD::pair<_Base_const_iterator, _Base_const_iterator> __p; + __p = _M_non_dbg_impl.equal_range_unique(__x); + return pair(const_iterator(&_M_iter_list, __p.first), + const_iterator(&_M_iter_list, __p.second)); + } + + pair insert_unique(const value_type& __x) { + _STLP_STD::pair<_Base_iterator, bool> __res = _M_non_dbg_impl.insert_unique(__x); + return pair(iterator(&_M_iter_list, __res.first), __res.second); + } + iterator insert_equal(const value_type& __x) + { return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__x)); } + + iterator insert_unique(iterator __pos, const value_type& __x) { + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos)) + return iterator(&_M_iter_list, _M_non_dbg_impl.insert_unique(__pos._M_iterator, __x)); + } + iterator insert_equal(iterator __pos, const value_type& __x) { + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list, __pos)) + return iterator(&_M_iter_list, _M_non_dbg_impl.insert_equal(__pos._M_iterator, __x)); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert_equal(_InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(__check_range(__first,__last)) + _M_non_dbg_impl.insert_equal(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } + template + void insert_unique(_InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(__check_range(__first,__last)) + _M_non_dbg_impl.insert_unique(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#else + void insert_unique(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(__check_range(__first,__last)) + _M_non_dbg_impl.insert_unique(__first._M_iterator, __last._M_iterator); + } + void insert_unique(const value_type* __first, const value_type* __last) { + _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last)) + _M_non_dbg_impl.insert_unique(__first, __last); + } + void insert_equal(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(__check_range(__first,__last)) + _M_non_dbg_impl.insert_equal(__first._M_iterator, __last._M_iterator); + } + void insert_equal(const value_type* __first, const value_type* __last) { + _STLP_DEBUG_CHECK(__check_ptr_range(__first,__last)) + _M_non_dbg_impl.insert_equal(__first, __last); + } +#endif + + void erase(iterator __pos) { + _STLP_DEBUG_CHECK(__check_if_owner(&_M_iter_list,__pos)) + _STLP_DEBUG_CHECK(_Dereferenceable(__pos)) + _Invalidate_iterator(__pos); + _M_non_dbg_impl.erase(__pos._M_iterator); + } + size_type erase(const key_type& __x) { + pair __p = equal_range(__x); + size_type __n = _STLP_STD::distance(__p.first._M_iterator, __p.second._M_iterator); + _Invalidate_iterators(__p.first, __p.second); + _M_non_dbg_impl.erase(__p.first._M_iterator, __p.second._M_iterator); + return __n; + } + size_type erase_unique(const key_type& __x) { + _Base_iterator __i = _M_non_dbg_impl.find(__x); + if (__i != _M_non_dbg_impl.end()) { + _Invalidate_iterator(iterator(&_M_iter_list, __i)); + _M_non_dbg_impl.erase(__i); + return 1; + } + return 0; + } + + void erase(iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(__check_range(__first, __last, begin(), end())) + _Invalidate_iterators(__first, __last); + _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator); + } + void erase(const key_type* __first, const key_type* __last) { + while (__first != __last) erase(*__first++); + } + + void clear() { + //should not invalidate end: + _Invalidate_iterators(begin(), end()); + _M_non_dbg_impl.clear(); + } +}; + +_STLP_MOVE_TO_STD_NAMESPACE +_STLP_END_NAMESPACE + +#undef _STLP_NON_DBG_TREE + +#endif /* _STLP_INTERNAL_DBG_TREE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/debug/_vector.h b/sdk/tlibstdcxx/stlport/stl/debug/_vector.h new file mode 100644 index 0000000000..c5800e9627 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/debug/_vector.h @@ -0,0 +1,425 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_INTERNAL_DBG_VECTOR_H +#define _STLP_INTERNAL_DBG_VECTOR_H + +#ifndef _STLP_DBG_ITERATOR_H +# include +#endif + +#define _STLP_NON_DBG_VECTOR _STLP_PRIV _STLP_NON_DBG_NAME(vector) <_Tp, _Alloc> + +_STLP_BEGIN_NAMESPACE + +#if defined (_STLP_DEBUG_USE_DISTINCT_VALUE_TYPE_HELPERS) +template +inline _Tp* +value_type(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&) +{ return (_Tp*)0; } +template +inline random_access_iterator_tag +iterator_category(const _STLP_PRIV _DBG_iter_base< _STLP_NON_DBG_VECTOR >&) +{ return random_access_iterator_tag(); } +#endif + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _Vector_const_traits; + +template +struct _Vector_nonconst_traits { + typedef _Nonconst_traits<_Tp> _BaseT; + typedef _Tp value_type; + typedef _Tp& reference; + typedef _Tp* pointer; + typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits; + typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits; +}; + +template +struct _Vector_const_traits { + typedef _Const_traits<_Tp> _BaseT; + typedef _Tp value_type; + typedef const _Tp& reference; + typedef const _Tp* pointer; + typedef _Vector_const_traits<_Tp, _NcIt> _ConstTraits; + typedef _Vector_nonconst_traits<_Tp, _NcIt> _NonConstTraits; +}; + +_STLP_TEMPLATE_NULL +struct _Vector_nonconst_traits { + typedef _Bit_iterator::value_type value_type; + typedef _Bit_iterator::reference reference; + typedef _Bit_iterator::pointer pointer; + typedef _Vector_const_traits _ConstTraits; + typedef _Vector_nonconst_traits _NonConstTraits; +}; + +_STLP_TEMPLATE_NULL +struct _Vector_const_traits { + typedef _Bit_const_iterator::value_type value_type; + typedef _Bit_const_iterator::reference reference; + typedef _Bit_const_iterator::pointer pointer; + typedef _Vector_const_traits _ConstTraits; + typedef _Vector_nonconst_traits _NonConstTraits; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +template ) > +class vector : +#if !defined (__DMC__) + private +#endif + _STLP_PRIV __construct_checker< _STLP_NON_DBG_VECTOR > +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + , public __stlport_class > +#endif +{ +private: + typedef _STLP_NON_DBG_VECTOR _Base; + typedef vector<_Tp, _Alloc> _Self; + typedef _STLP_PRIV __construct_checker<_STLP_NON_DBG_VECTOR > _ConstructCheck; + _Base _M_non_dbg_impl; + _STLP_PRIV __owned_list _M_iter_list; + +public: + __IMPORT_CONTAINER_TYPEDEFS(_Base) + + typedef _STLP_PRIV _DBG_iter<_Base, + _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_nonconst_traits > > iterator; + + typedef _STLP_PRIV _DBG_iter<_Base, + _STLP_PRIV _DbgTraits<_STLP_PRIV _Vector_const_traits > > const_iterator; + +private: + void _Invalidate_all() + { _M_iter_list._Invalidate_all(); } + void _Invalidate_iterator(const iterator& __it) + { _STLP_PRIV __invalidate_iterator(&_M_iter_list, __it); } + void _Invalidate_iterators(const iterator& __first, const iterator& __last) + { _STLP_PRIV __invalidate_range(&_M_iter_list, __first, __last); } + + void _Check_Overflow(size_type __nb) { + if (size() + __nb > capacity()) + _Invalidate_all(); + } + void _Compare_Capacity (size_type __old_capacity) { + if (capacity() > __old_capacity) { + _Invalidate_all(); + } + } + +public: + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + + allocator_type get_allocator() const { return _M_non_dbg_impl.get_allocator(); } + + iterator begin() { return iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + const_iterator begin() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.begin()); } + iterator end() { return iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + const_iterator end() const { return const_iterator(&_M_iter_list, _M_non_dbg_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + size_type size() const { return _M_non_dbg_impl.size(); } + size_type max_size() const { return _M_non_dbg_impl.max_size(); } + size_type capacity() const { return _M_non_dbg_impl.capacity(); } + bool empty() const { return _M_non_dbg_impl.empty(); } + + reference operator[](size_type __n) { + _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) + return _M_non_dbg_impl[__n]; + } + + const_reference operator[](size_type __n) const { + _STLP_VERBOSE_ASSERT(__n < size(), _StlMsg_OUT_OF_BOUNDS) + return _M_non_dbg_impl[__n]; + } + + reference at(size_type __n) { return _M_non_dbg_impl.at(__n); } + const_reference at(size_type __n) const { return _M_non_dbg_impl.at(__n); } + + explicit vector(const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__a), _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit vector(size_type __n, const _Tp& __x = _Tp(), +#else + vector(size_type __n, const _Tp& __x, +#endif + const allocator_type& __a = allocator_type()) + : _M_non_dbg_impl(__n, __x, __a), _M_iter_list(&_M_non_dbg_impl) {} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit vector(size_type __n) + : _M_non_dbg_impl(__n), _M_iter_list(&_M_non_dbg_impl) {} +#endif + + vector(const _Self& __x) + : _ConstructCheck(__x), _M_non_dbg_impl(__x._M_non_dbg_impl), _M_iter_list(&_M_non_dbg_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + vector(__move_source<_Self> src) + : _M_non_dbg_impl(__move_source<_Base>(src.get()._M_non_dbg_impl)), + _M_iter_list(&_M_non_dbg_impl) { +# if defined (_STLP_NO_EXTENSIONS) || (_STLP_DEBUG_LEVEL == _STLP_STANDARD_DBG_LEVEL) + src.get()._M_iter_list._Invalidate_all(); +# else + src.get()._M_iter_list._Set_owner(_M_iter_list); +# endif + } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last), __a), + _M_iter_list(&_M_non_dbg_impl) {} + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + vector(_InputIterator __first, _InputIterator __last) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)), + _M_iter_list(&_M_non_dbg_impl) {} +# endif +#else + vector(const _Tp* __first, const _Tp* __last, + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), _M_non_dbg_impl(__first, __last, __a), + _M_iter_list(&_M_non_dbg_impl) {} + + // mysterious VC++ bug ? + vector(const_iterator __first, const_iterator __last , + const allocator_type& __a = allocator_type()) + : _ConstructCheck(__first, __last), + _M_non_dbg_impl(__first._M_iterator, __last._M_iterator, __a), + _M_iter_list(&_M_non_dbg_impl) {} +#endif /* _STLP_MEMBER_TEMPLATES */ + + _Self& operator=(const _Self& __x) { + if (this != &__x) { + _Invalidate_all(); + _M_non_dbg_impl = __x._M_non_dbg_impl; + } + return *this; + } + + void reserve(size_type __n) { + if (capacity() < __n) + _Invalidate_all(); + _M_non_dbg_impl.reserve(__n); + } + + reference front() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *begin(); + } + const_reference front() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *begin(); + } + reference back() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *(--end()); + } + const_reference back() const { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + return *(--end()); + } + + void swap(_Self& __x) { + _M_iter_list._Swap_owners(__x._M_iter_list); + _M_non_dbg_impl.swap(__x._M_non_dbg_impl); + } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos, const _Tp& __x = _Tp()) { +#else + iterator insert(iterator __pos, const _Tp& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _Check_Overflow(1); + return iterator(&_M_iter_list, _M_non_dbg_impl.insert(__pos._M_iterator, __x)); + } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos) + { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if defined (_STLP_MEMBER_TEMPLATES) + // Check whether it's an integral type. If so, it's not an iterator. + template + void insert(iterator __pos, + _InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos._M_iterator, + _STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + _Compare_Capacity(__old_capacity); + } +#endif +#if !defined (_STLP_MEMBER_TEMPLATES) + void insert (iterator __pos, + const value_type *__first, const value_type *__last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos._M_iterator, __first, __last); + _Compare_Capacity(__old_capacity); + } +#endif + +#if !defined (_STLP_MEMBER_TEMPLATES) || !defined (_STLP_NO_METHOD_SPECIALIZATION) + void insert(iterator __pos, + const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + //Sequence requirements 23.1.1 Table 67: + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first)); + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + _Compare_Capacity(__old_capacity); + } + void insert(iterator __pos, + iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + //Sequence requirements 23.1.1 Table 67: + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_not_owner(&_M_iter_list, __first)); + size_type __old_capacity = capacity(); + _M_non_dbg_impl.insert(__pos._M_iterator, __first._M_iterator, __last._M_iterator); + _Compare_Capacity(__old_capacity); + } +#endif + + void insert (iterator __pos, size_type __n, const _Tp& __x){ + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _Check_Overflow(__n); + _M_non_dbg_impl.insert(__pos._M_iterator, __n, __x); + } + + void pop_back() { + _STLP_VERBOSE_ASSERT(!empty(), _StlMsg_EMPTY_CONTAINER) + _Invalidate_iterator(end()); + _M_non_dbg_impl.pop_back(); + } + iterator erase(iterator __pos) { + _STLP_DEBUG_CHECK(_STLP_PRIV _Dereferenceable(__pos)) + _STLP_DEBUG_CHECK(_STLP_PRIV __check_if_owner(&_M_iter_list, __pos)) + _Invalidate_iterators(__pos, end()); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__pos._M_iterator)); + } + iterator erase(iterator __first, iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last, begin(), end())) + _Invalidate_iterators(__first, end()); + return iterator(&_M_iter_list, _M_non_dbg_impl.erase(__first._M_iterator, __last._M_iterator)); + } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const _Tp& __x = _STLP_DEFAULT_CONSTRUCTED(_Tp)) { +#else + void resize(size_type __new_size, const _Tp& __x) { +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + if (__new_size > capacity()) { + _Invalidate_all(); + } + else if (__new_size < size()) { + _Invalidate_iterators(begin() + __new_size, end()); + } + _M_non_dbg_impl.resize(__new_size, __x); + } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { resize(__new_size, _STLP_DEFAULT_CONSTRUCTED(_Tp)); } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) + _Invalidate_all(); + _M_non_dbg_impl.assign(_STLP_PRIV _Non_Dbg_iter(__first), _STLP_PRIV _Non_Dbg_iter(__last)); + } +#else +private: + void _M_assign(const value_type *__first, const value_type *__last) { + _Invalidate_all(); + _M_non_dbg_impl.assign(__first, __last); + } +public: + void assign(const value_type *__first, const value_type *__last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_ptr_range(__first,__last)) + _M_assign(__first, __last); + } + + void assign(const_iterator __first, const_iterator __last) { + _STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first,__last)) + _M_assign(__first._M_iterator, __last._M_iterator); + } +#endif + +public: + void assign(size_type __n, const _Tp& __val) { + _Invalidate_all(); + _M_non_dbg_impl.assign(__n, __val); + } + + void clear() { + _Invalidate_all(); + _M_non_dbg_impl.clear(); + } + void push_back(const _Tp& __x) { + _Check_Overflow(1); + _M_non_dbg_impl.push_back(__x); + } +}; + +_STLP_END_NAMESPACE + +#undef _STLP_NON_DBG_VECTOR + +#endif /* _STLP_DBG_VECTOR_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/msl_string.h b/sdk/tlibstdcxx/stlport/stl/msl_string.h new file mode 100644 index 0000000000..1fa4931469 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/msl_string.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1998 + * Mark of the Unicorn, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Mark of the Unicorn, Inc. makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ +#if defined( _STLP_USE_MSIPL ) && !defined( _STLP_MSL_STRING_H_ ) +#define _STLP_MSL_STRING_H_ + +//# define char_traits __msl_char_traits +# define basic_string __msl_basic_string +# define b_str_ref __msl_b_str_ref +# define basic_istream __msl_basic_istream +# define basic_ostream __msl_basic_ostream +# define string __msl_string +# define wstring __msl_wstring +# define iterator_traits __msl_iterator_traits + +namespace std +{ + template class basic_istream; + template class basic_ostream; +} + +#if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +#else +# include _STLP_NATIVE_HEADER(string) +#endif + +// # undef char_traits +# undef basic_string +# undef b_str_ref +# undef basic_istream +# undef basic_ostream +# undef string +# undef wstring +# undef iterator_traits + +#endif diff --git a/sdk/tlibstdcxx/stlport/stl/pointers/_deque.h b/sdk/tlibstdcxx/stlport/stl/pointers/_deque.h new file mode 100644 index 0000000000..f82a559bcb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/pointers/_deque.h @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2004 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_SPECIALIZED_DEQUE_H +#define _STLP_SPECIALIZED_DEQUE_H + +#ifndef _STLP_POINTERS_SPEC_TOOLS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + +/* + * struct helper to cast deque iterators: + */ +template +struct _DequeIteCast { + typedef _Deque_iterator<_ValueT, _Nonconst_traits<_ValueT> > iterator; + typedef _Deque_iterator<_ValueT, _Const_traits<_ValueT> > const_iterator; + typedef _Deque_iterator<_StorageT, _Nonconst_traits<_StorageT> > storage_iterator; + typedef _Deque_iterator<_StorageT, _Const_traits<_StorageT> > const_storage_iterator; + typedef _CastTraits<_StorageT, _ValueT> cast_traits; + + static iterator to_value_type_ite (storage_iterator const& __ite) { + iterator tmp; + tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur); + tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first); + tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last); + tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node); + return tmp; + } + static storage_iterator to_storage_type_ite (iterator const& __ite) { + storage_iterator tmp; + tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur); + tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first); + tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last); + tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node); + return tmp; + } + + static const_iterator to_value_type_cite (const_storage_iterator const& __ite) { + const_iterator tmp; + tmp._M_cur = cast_traits::to_value_type_ptr(__ite._M_cur); + tmp._M_first = cast_traits::to_value_type_ptr(__ite._M_first); + tmp._M_last = cast_traits::to_value_type_ptr(__ite._M_last); + tmp._M_node = cast_traits::to_value_type_pptr(__ite._M_node); + return tmp; + } + + static const_storage_iterator to_storage_type_cite (const_iterator const& __ite) { + const_storage_iterator tmp; + tmp._M_cur = cast_traits::to_storage_type_ptr(__ite._M_cur); + tmp._M_first = cast_traits::to_storage_type_ptr(__ite._M_first); + tmp._M_last = cast_traits::to_storage_type_ptr(__ite._M_last); + tmp._M_node = cast_traits::to_storage_type_pptr(__ite._M_node); + return tmp; + } +}; + +#define DEQUE_IMPL _STLP_PTR_IMPL_NAME(deque) +#if defined (__BORLANDC__) || defined (__DMC__) +# define typename +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy >; +_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC _Deque_iterator >; +_STLP_EXPORT_TEMPLATE_CLASS _Deque_base >; +_STLP_EXPORT_TEMPLATE_CLASS DEQUE_IMPL >; +#endif + +#if defined (_STLP_DEBUG) +# define deque _STLP_NON_DBG_NAME(deque) +#else +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template ) > +class deque +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (deque) + : public __stlport_class > +#endif +{ + typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType; + typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; + typedef _STLP_PRIV DEQUE_IMPL<_StorageType, _StorageTypeAlloc> _Base; + typedef deque<_Tp, _Alloc> _Self; + + typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; + typedef _STLP_PRIV _DequeIteCast<_StorageType, _Tp> ite_cast_traits; + +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag _Iterator_category; + _STLP_FORCE_ALLOCATORS(value_type, _Alloc) + typedef typename _Alloc_traits::allocator_type allocator_type; + typedef _STLP_PRIV _Deque_iterator > iterator; + typedef _STLP_PRIV _Deque_iterator > const_iterator; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + +public: // Basic accessors + iterator begin() { return ite_cast_traits::to_value_type_ite(_M_impl.begin()); } + iterator end() { return ite_cast_traits::to_value_type_ite(_M_impl.end()); } + const_iterator begin() const { return ite_cast_traits::to_value_type_cite(_M_impl.begin()); } + const_iterator end() const { return ite_cast_traits::to_value_type_cite(_M_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const + { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const + { return const_reverse_iterator(begin()); } + + reference operator[](size_type __n) + { return cast_traits::to_value_type_ref(_M_impl[__n]); } + const_reference operator[](size_type __n) const + { return cast_traits::to_value_type_cref(_M_impl[__n]); } + + reference at(size_type __n) + { return cast_traits::to_value_type_ref(_M_impl.at(__n)); } + const_reference at(size_type __n) const + { return cast_traits::to_value_type_cref(_M_impl.at(__n)); } + + reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); } + reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); } + const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); } + const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); } + + size_type size() const { return _M_impl.size(); } + size_type max_size() const { return _M_impl.max_size(); } + bool empty() const { return _M_impl.empty(); } + allocator_type get_allocator() const { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } + + explicit deque(const allocator_type& __a = allocator_type()) + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + + deque(const _Self& __x) : _M_impl(__x._M_impl) {} + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit deque(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), +#else + deque(size_type __n, const value_type& __val, +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) + : _M_impl(__n, cast_traits::to_storage_type_cref(__val), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + // int,long variants may be needed +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + explicit deque(size_type __n) : _M_impl(__n) {} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if defined (_STLP_MEMBER_TEMPLATES) + template + deque(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) +#if !defined (_STLP_USE_ITERATOR_WRAPPER) + : _M_impl(__first, __last, + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { +#else + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { +#endif +#if defined (_STLP_USE_ITERATOR_WRAPPER) + insert(end(), __first, __last); +#endif + } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + deque(_InputIterator __first, _InputIterator __last) +# if !defined (_STLP_USE_ITERATOR_WRAPPER) + : _M_impl(__first, __last) {} +# else + { insert(end(), __first, __last); } +# endif +# endif + +#else + deque(const_pointer __first, const_pointer __last, + const allocator_type& __a = allocator_type() ) + : _M_impl(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + + deque(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type() ) + : _M_impl(ite_cast_traits::to_storage_type_cite(__first), + ite_cast_traits::to_storage_type_cite(__last), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + deque(__move_source<_Self> src) + : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} +#endif + + _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; } + + void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + void assign(size_type __n, const value_type& __val) { + _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); + } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_assign_dispatch(_Integer __n, _Integer __val, + const __true_type&) + { _M_impl.assign(__n, __val); } + + template + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + template + void assign(_InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); +# else + _M_impl.assign(__first, __last); +# endif + } +#else + void assign(const_pointer __first, const_pointer __last) + { _M_impl.assign(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); } + void assign(const_iterator __first, const_iterator __last) + { _M_impl.assign(ite_cast_traits::to_storage_type_cite(__first), + ite_cast_traits::to_storage_type_cite(__last)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void push_back(const value_type& __t) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { _M_impl.push_back(cast_traits::to_storage_type_cref(__t)); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_front(const value_type& __t = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void push_front(const value_type& __t) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { _M_impl.push_front(cast_traits::to_storage_type_cref(__t)); } + +# if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + void push_back() { _M_impl.push_back(); } + void push_front() { _M_impl.push_front(); } +# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void pop_back() { _M_impl.pop_back(); } + void pop_front() { _M_impl.pop_front(); } + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + iterator insert(iterator __pos, const value_type& __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { return ite_cast_traits::to_value_type_ite(_M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), + cast_traits::to_storage_type_cref(__x))); } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos) { return insert(__pos, _STLP_DEFAULT_CONSTRUCTED(value_type)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void insert(iterator __pos, size_type __n, const value_type& __x) + { _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, cast_traits::to_storage_type_cref(__x)); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + const __true_type&) { + _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __n, __val); + } + + template + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); +# else + _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), __first, __last); +# endif + } + +#else /* _STLP_MEMBER_TEMPLATES */ + void insert(iterator __pos, + const_pointer __first, const_pointer __last) { + _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), + cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + void insert(iterator __pos, + const_iterator __first, const_iterator __last) { + _M_impl.insert(ite_cast_traits::to_storage_type_ite(__pos), + ite_cast_traits::to_storage_type_cite(__first), + ite_cast_traits::to_storage_type_cite(__last)); + } + +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void resize(size_type __new_size, const value_type& __x) +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { _M_impl.resize(__new_size); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + iterator erase(iterator __pos) + { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__pos))); } + + iterator erase(iterator __first, iterator __last) + { return ite_cast_traits::to_value_type_ite(_M_impl.erase(ite_cast_traits::to_storage_type_ite(__first), + ite_cast_traits::to_storage_type_ite(__last))); } + void clear() { _M_impl.clear(); } + +private: + _Base _M_impl; +}; + +#if defined (deque) +# undef deque +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#undef DEQUE_IMPL +#if defined (__BORLANDC__) || defined (__DMC__) +# undef typename +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_SPECIALIZED_DEQUE_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/pointers/_list.h b/sdk/tlibstdcxx/stlport/stl/pointers/_list.h new file mode 100644 index 0000000000..52a9262a7b --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/pointers/_list.h @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_PTR_SPECIALIZED_LIST_H +#define _STLP_PTR_SPECIALIZED_LIST_H + +#ifndef _STLP_POINTERS_SPEC_TOOLS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define LIST_IMPL _STLP_PTR_IMPL_NAME(list) +#if defined (__BORLANDC__) || defined (__DMC__) +# define typename +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_EXPORT_TEMPLATE_CLASS _List_node; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_EXPORT_TEMPLATE_CLASS allocator<_STLP_PRIV _List_node >; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_List_node_base, _List_node, allocator<_List_node > >; +_STLP_EXPORT_TEMPLATE_CLASS _List_base >; +_STLP_EXPORT_TEMPLATE_CLASS LIST_IMPL >; + +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#if defined (_STLP_DEBUG) +# define list _STLP_NON_DBG_NAME(list) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template ) > +class list +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (list) + : public __stlport_class > +#endif +{ + typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType; + typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; + typedef _STLP_PRIV LIST_IMPL<_StorageType, _StorageTypeAlloc> _Base; + typedef typename _Base::iterator _BaseIte; + typedef typename _Base::const_iterator _BaseConstIte; + typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; + typedef list<_Tp, _Alloc> _Self; + +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + _STLP_FORCE_ALLOCATORS(value_type, _Alloc) + typedef typename _Alloc_traits::allocator_type allocator_type; + typedef bidirectional_iterator_tag _Iterator_category; + + typedef _STLP_PRIV _List_iterator > iterator; + typedef _STLP_PRIV _List_iterator > const_iterator; + + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; + + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } + + explicit list(const allocator_type& __a = allocator_type()) + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit list(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), +#else + list(size_type __n, const value_type& __val, +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) + : _M_impl(__n, cast_traits::to_storage_type_cref(__val), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit list(size_type __n) + : _M_impl(__n) {} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if defined (_STLP_MEMBER_TEMPLATES) + template + list(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) +# if !defined (_STLP_USE_ITERATOR_WRAPPER) + : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} +# else + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { + insert(begin(), __first, __last); + } +# endif + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + list(_InputIterator __first, _InputIterator __last) +# if !defined (_STLP_USE_WRAPPER_ITERATOR) + : _M_impl(__first, __last) {} +# else + { insert(begin(), __first, __last); } +# endif +# endif + +#else /* _STLP_MEMBER_TEMPLATES */ + + list(const value_type *__first, const value_type *__last, + const allocator_type& __a = allocator_type()) + : _M_impl(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + list(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#endif /* _STLP_MEMBER_TEMPLATES */ + + list(const _Self& __x) : _M_impl(__x._M_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + list(__move_source<_Self> src) + : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} +#endif + + iterator begin() { return iterator(_M_impl.begin()._M_node); } + const_iterator begin() const { return const_iterator(_M_impl.begin()._M_node); } + + iterator end() { return iterator(_M_impl.end()._M_node); } + const_iterator end() const { return const_iterator(_M_impl.end()._M_node); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + bool empty() const { return _M_impl.empty(); } + size_type size() const { return _M_impl.size(); } + size_type max_size() const { return _M_impl.max_size(); } + + reference front() { return *begin(); } + const_reference front() const { return *begin(); } + reference back() { return *(--end()); } + const_reference back() const { return *(--end()); } + + void swap(_Self &__x) { _M_impl.swap(__x._M_impl); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + void clear() { _M_impl.clear(); } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const_reference __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + iterator insert(iterator __pos, const_reference __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { return iterator(_M_impl.insert(_BaseIte(__pos._M_node), + cast_traits::to_storage_type_cref(__x))._M_node); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + const __true_type&) + { _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); } + + template + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.insert(_BaseIte(__pos._M_node), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); +# else + _M_impl.insert(_BaseIte(__pos._M_node), __first, __last); +# endif + } +#else /* _STLP_MEMBER_TEMPLATES */ + void insert(iterator __pos, const value_type *__first, const value_type *__last) + { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); } + void insert(iterator __pos, const_iterator __first, const_iterator __last) + { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + void insert(iterator __pos, size_type __n, const value_type& __x) + { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); } + + void push_front(const value_type& __x) { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); } + void push_back(const value_type& __x) { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); } + +#if defined (_STLP_DONT_SUP_DFLT_PARAM) && !defined (_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos) { return iterator(_M_impl.insert(__pos._M_node)._M_node); } + void push_front() { _M_impl.push_front();} + void push_back() { _M_impl.push_back();} +# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + iterator erase(iterator __pos) + { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); } + iterator erase(iterator __first, iterator __last) + { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void resize(size_type __new_size) { _M_impl.resize(__new_size); } + void resize(size_type __new_size, const value_type& __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM*/ + {_M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));} + + void pop_front() { _M_impl.pop_front(); } + void pop_back() { _M_impl.pop_back(); } + + _Self& operator=(const _Self& __x) + { _M_impl = __x._M_impl; return *this; } + void assign(size_type __n, const value_type& __val) + { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&) + { _M_impl.assign(__n, __val); } + + template + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + + template + void assign(_InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); +# else + _M_impl.assign(__first, __last); +# endif + } +#else + void assign(const value_type *__first, const value_type *__last) { + _M_impl.assign(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + void assign(const_iterator __first, const_iterator __last) + { _M_impl.assign(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } +#endif + + void splice(iterator __pos, _Self& __x) + { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); } + void splice(iterator __pos, _Self& __x, iterator __i) + { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); } + void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) + { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, + _BaseIte(__first._M_node), _BaseIte(__last._M_node)); } + + void remove(const_reference __val) + { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); } + void unique() { _M_impl.unique(); } + void merge(_Self& __x) { _M_impl.merge(__x._M_impl); } + void reverse() { _M_impl.reverse(); } + void sort() { _M_impl.sort(); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void remove_if(_Predicate __pred) + { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); } + template + void unique(_BinaryPredicate __bin_pred) + { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__bin_pred)); } + + template + void merge(_Self &__x, _StrictWeakOrdering __comp) + { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } + + template + void sort(_StrictWeakOrdering __comp) + { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + +private: + _Base _M_impl; +}; + +#if defined (list) +# undef list +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#undef LIST_IMPL +#if defined (__BORLANDC__) || defined (__DMC__) +# undef typename +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_PTR_SPECIALIZED_LIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/pointers/_set.h b/sdk/tlibstdcxx/stlport/stl/pointers/_set.h new file mode 100644 index 0000000000..f997a5ae13 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/pointers/_set.h @@ -0,0 +1,564 @@ +/* + * Copyright (c) 2005 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_PTR_SPECIALIZED_SET_H +#define _STLP_PTR_SPECIALIZED_SET_H + +#ifndef _STLP_POINTERS_SPEC_TOOLS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#if defined (__BORLANDC__) || defined (__DMC__) +# define typename +#endif + +//Specific iterator traits creation +_STLP_CREATE_ITERATOR_TRAITS(SetTraitsT, Const_traits) + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +_STLP_EXPORT template struct _STLP_CLASS_DECLSPEC less; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +typedef _Rb_tree_node _Node; +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Rb_tree_node_base, _Node, allocator<_Node> >; +_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree_base >; +# if defined (_STLP_DEBUG) +_STLP_EXPORT_TEMPLATE_CLASS _DbgCompare >; +# define _Rb_tree _STLP_NON_DBG_NAME(Rb_tree) +_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree >, void*, _Identity, + _SetTraitsT, allocator >; +# undef _Rb_tree +# endif +_STLP_EXPORT_TEMPLATE_CLASS _Rb_tree, void*, _Identity, + _SetTraitsT, allocator >; +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +template ), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) > +class set +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ +#if !defined (__BORLANDC__) + typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes; + typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType; + typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType; +#else + typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_KeyStorageType _KeyStorageType; + typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_CompareStorageType _CompareStorageType; +#endif + typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc; + typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits; + + typedef set<_Key, _Compare, _Alloc> _Self; +public: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + +protected: + //Specific iterator traits creation + typedef _STLP_PRIV _SetTraitsT _SetTraits; + typedef _STLP_PRIV _Rb_tree, + _SetTraits, _Alloc> _Priv_Rep_type; + + typedef _STLP_PRIV _SetTraitsT<_KeyStorageType> _SetStorageTraits; + +public: + //dums: need the following public for the __move_traits framework + typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType, + _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>, + _SetStorageTraits, _StorageTypeAlloc> _Rep_type; + +private: + typedef typename _Rep_type::iterator base_iterator; + typedef typename _Rep_type::const_iterator const_base_iterator; + +public: + typedef typename _Priv_Rep_type::pointer pointer; + typedef typename _Priv_Rep_type::const_pointer const_pointer; + typedef typename _Priv_Rep_type::reference reference; + typedef typename _Priv_Rep_type::const_reference const_reference; + typedef typename _Priv_Rep_type::iterator iterator; + typedef typename _Priv_Rep_type::const_iterator const_iterator; + typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator; + typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Priv_Rep_type::size_type size_type; + typedef typename _Priv_Rep_type::difference_type difference_type; + typedef typename _Priv_Rep_type::allocator_type allocator_type; + +private: + _Rep_type _M_t; // red-black tree representing set + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +#if defined (_STLP_DEBUG) + static iterator _S_to_value_ite(const_base_iterator __ite) + { return iterator(__ite._Owner(), __ite._M_iterator._M_node); } + static base_iterator _S_to_storage_ite(const_iterator __ite) + { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); } +#else + static iterator _S_to_value_ite(const_base_iterator __ite) + { return iterator(__ite._M_node); } + static base_iterator _S_to_storage_ite(const_iterator __ite) + { return base_iterator(__ite._M_node); } +#endif + +public: + set() : _M_t(_CompareStorageType(), _StorageTypeAlloc()) {} + explicit set(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {} + +#if defined (_STLP_MEMBER_TEMPLATES) + template + set(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), _StorageTypeAlloc()) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_unique(__first, __last); +# endif + } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + set(_InputIterator __first, _InputIterator __last, const _Compare& __comp) + : _M_t(__comp, _StorageTypeAlloc()) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_unique(__first, __last); +# endif + } +# endif + template + set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_unique(__first, __last); +# endif + } +#else + set(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), _StorageTypeAlloc()) { + _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + + set(const value_type* __first, const value_type* __last, + const _Compare& __comp, const allocator_type& __a = allocator_type()) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { + _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + + set(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), _StorageTypeAlloc()) + { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } + + set(const_iterator __first, const_iterator __last, + const _Compare& __comp, const allocator_type& __a = allocator_type()) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) + { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + set(const _Self& __x) : _M_t(__x._M_t) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + set(__move_source<_Self> src) + : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} +#endif + + _Self& operator=(const _Self& __x) { + _M_t = __x._M_t; + return *this; + } + + // accessors: + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return _M_t.key_comp(); } + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); } + + iterator begin() { return _S_to_value_ite(_M_t.begin()); } + iterator end() { return _S_to_value_ite(_M_t.end()); } + const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); } + const_iterator end() const { return _S_to_value_ite(_M_t.end()); } + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(_Self& __x) { _M_t.swap(__x._M_t); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + // insert/erase + pair insert(const value_type& __x) { + pair ret = _M_t.insert_unique(cast_traits::to_storage_type_cref(__x)); + return pair(_S_to_value_ite(ret.first), ret.second); + } + iterator insert(iterator __pos, const value_type& __x) + { return _S_to_value_ite(_M_t.insert_unique(_S_to_storage_ite(__pos), cast_traits::to_storage_type_cref(__x))); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_unique(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_unique(__first, __last); +# endif + } +#else + void insert(const_iterator __first, const_iterator __last) + { _M_t.insert_unique(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } + void insert(const value_type* __first, const value_type* __last) { + _M_t.insert_unique(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } +#endif + void erase(iterator __pos) + { _M_t.erase(_S_to_storage_ite(__pos)); } + size_type erase(const key_type& __x) + { return _M_t.erase_unique(cast_traits::to_storage_type_cref(__x)); } + void erase(iterator __first, iterator __last) + { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } + void clear() { _M_t.clear(); } + + // set operations: + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __x) const + { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __x) + { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const + { return _M_t.find(cast_traits::to_storage_type_crefT(__x)) == _M_t.end() ? 0 : 1; } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) + { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const + { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) + { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const + { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) { + pair __ret; + __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x)); + return pair(_S_to_value_ite(__ret.first), + _S_to_value_ite(__ret.second)); + } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const { + pair __ret; + __ret = _M_t.equal_range_unique(cast_traits::to_storage_type_crefT(__x)); + return pair(_S_to_value_ite(__ret.first), + _S_to_value_ite(__ret.second)); + } +}; + +//Specific iterator traits creation +_STLP_CREATE_ITERATOR_TRAITS(MultisetTraitsT, Const_traits) + +template ), + _STLP_DFL_TMPL_PARAM(_Alloc, allocator<_Key>) > +class multiset +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) + : public __stlport_class > +#endif +{ +#if !defined (__BORLANDC__) + typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare> _AssocStorageTypes; + typedef typename _AssocStorageTypes::_KeyStorageType _KeyStorageType; + typedef typename _AssocStorageTypes::_CompareStorageType _CompareStorageType; +#else + typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_KeyStorageType _KeyStorageType; + typedef _STLP_PRIV _AssocStorageTypes<_Key, _Compare>::_CompareStorageType _CompareStorageType; +#endif + typedef typename _Alloc_traits<_KeyStorageType, _Alloc>::allocator_type _StorageTypeAlloc; + typedef _STLP_PRIV _CastTraits<_KeyStorageType, _Key> cast_traits; + + typedef multiset<_Key, _Compare, _Alloc> _Self; +public: + // typedefs: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + +protected: + //Specific iterator traits creation + typedef _STLP_PRIV _MultisetTraitsT _MultisetTraits; + typedef _STLP_PRIV _Rb_tree, + _MultisetTraits, _Alloc> _Priv_Rep_type; + + typedef _STLP_PRIV _MultisetTraitsT<_KeyStorageType> _MultisetStorageTraits; +public: + //dums: need the following public for the __move_traits framework + typedef _STLP_PRIV _Rb_tree<_KeyStorageType, _CompareStorageType, + _KeyStorageType, _STLP_PRIV _Identity<_KeyStorageType>, + _MultisetStorageTraits, _StorageTypeAlloc> _Rep_type; + +private: + typedef typename _Rep_type::iterator base_iterator; + typedef typename _Rep_type::const_iterator const_base_iterator; + +public: + typedef typename _Priv_Rep_type::pointer pointer; + typedef typename _Priv_Rep_type::const_pointer const_pointer; + typedef typename _Priv_Rep_type::reference reference; + typedef typename _Priv_Rep_type::const_reference const_reference; + typedef typename _Priv_Rep_type::iterator iterator; + typedef typename _Priv_Rep_type::const_iterator const_iterator; + typedef typename _Priv_Rep_type::reverse_iterator reverse_iterator; + typedef typename _Priv_Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Priv_Rep_type::size_type size_type; + typedef typename _Priv_Rep_type::difference_type difference_type; + typedef typename _Priv_Rep_type::allocator_type allocator_type; + +private: + _Rep_type _M_t; // red-black tree representing multiset + _STLP_KEY_TYPE_FOR_CONT_EXT(key_type) + +#if defined (_STLP_DEBUG) + static iterator _S_to_value_ite(const_base_iterator __ite) + { return iterator(__ite._Owner(), __ite._M_iterator._M_node); } + static base_iterator _S_to_storage_ite(const_iterator __ite) + { return base_iterator(__ite._Owner(), __ite._M_iterator._M_node); } +#else + static iterator _S_to_value_ite(const_base_iterator __ite) + { return iterator(__ite._M_node); } + static base_iterator _S_to_storage_ite(const_iterator __ite) + { return base_iterator(__ite._M_node); } +#endif + +public: + multiset() : _M_t(_Compare(), _StorageTypeAlloc()) {} + explicit multiset(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) {} + +#if defined (_STLP_MEMBER_TEMPLATES) + template + multiset(_InputIterator __first, _InputIterator __last) + : _M_t(_Compare(), _StorageTypeAlloc()) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_equal(__first, __last); +# endif + } + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp) + : _M_t(__comp, _StorageTypeAlloc()) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_equal(__first, __last); +# endif + } +# endif + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_equal(__first, __last); +# endif + } + +#else + multiset(const value_type* __first, const value_type* __last) + : _M_t(_Compare(), _StorageTypeAlloc()) { + _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + + multiset(const value_type* __first, const value_type* __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) { + _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + + multiset(const_iterator __first, const_iterator __last) + : _M_t(_Compare(), _StorageTypeAlloc()) + { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } + + multiset(const_iterator __first, const_iterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _STLP_CONVERT_ALLOCATOR(__a, _KeyStorageType)) + { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + multiset(const _Self& __x) + : _M_t(__x._M_t) {} + + _Self& operator=(const _Self& __x) { + _M_t = __x._M_t; + return *this; + } + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + multiset(__move_source<_Self> src) + : _M_t(__move_source<_Rep_type>(src.get()._M_t)) {} +#endif + + // accessors: + key_compare key_comp() const { return _M_t.key_comp(); } + value_compare value_comp() const { return _M_t.key_comp(); } + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR(_M_t.get_allocator(), value_type); } + + iterator begin() { return _S_to_value_ite(_M_t.begin()); } + iterator end() { return _S_to_value_ite(_M_t.end()); } + const_iterator begin() const { return _S_to_value_ite(_M_t.begin()); } + const_iterator end() const { return _S_to_value_ite(_M_t.end()); } + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + bool empty() const { return _M_t.empty(); } + size_type size() const { return _M_t.size(); } + size_type max_size() const { return _M_t.max_size(); } + void swap(_Self& __x) { _M_t.swap(__x._M_t); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + + // insert/erase + iterator insert(const value_type& __x) + { return _S_to_value_ite(_M_t.insert_equal(cast_traits::to_storage_type_cref(__x))); } + iterator insert(iterator __pos, const value_type& __x) { + return _S_to_value_ite(_M_t.insert_equal(_S_to_storage_ite(__pos), + cast_traits::to_storage_type_cref(__x))); + } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(_InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + _M_t.insert_equal(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_KeyStorageType, _Key, _InputIterator>::_Ite(__last)); +# else + _M_t.insert_equal(__first, __last); +# endif + } +#else + void insert(const value_type* __first, const value_type* __last) { + _M_t.insert_equal(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + void insert(const_iterator __first, const_iterator __last) + { _M_t.insert_equal(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + void erase(iterator __pos) + { _M_t.erase(_S_to_storage_ite(__pos)); } + size_type erase(const key_type& __x) + { return _M_t.erase(cast_traits::to_storage_type_cref(__x)); } + void erase(iterator __first, iterator __last) + { _M_t.erase(_S_to_storage_ite(__first), _S_to_storage_ite(__last)); } + void clear() { _M_t.clear(); } + + // multiset operations: + + _STLP_TEMPLATE_FOR_CONT_EXT + iterator find(const _KT& __x) + { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator find(const _KT& __x) const + { return _S_to_value_ite(_M_t.find(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + size_type count(const _KT& __x) const + { return _M_t.count(cast_traits::to_storage_type_crefT(__x)); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator lower_bound(const _KT& __x) + { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator lower_bound(const _KT& __x) const + { return _S_to_value_ite(_M_t.lower_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + iterator upper_bound(const _KT& __x) + { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + const_iterator upper_bound(const _KT& __x) const + { return _S_to_value_ite(_M_t.upper_bound(cast_traits::to_storage_type_crefT(__x))); } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) { + pair __ret; + __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x)); + return pair(_S_to_value_ite(__ret.first), + _S_to_value_ite(__ret.second)); + } + _STLP_TEMPLATE_FOR_CONT_EXT + pair equal_range(const _KT& __x) const { + pair __ret; + __ret = _M_t.equal_range(cast_traits::to_storage_type_crefT(__x)); + return pair(_S_to_value_ite(__ret.first), + _S_to_value_ite(__ret.second)); + } +}; + +#if defined (__BORLANDC__) || defined (__DMC__) +# undef typename +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_PTR_SPECIALIZED_SET_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/pointers/_slist.h b/sdk/tlibstdcxx/stlport/stl/pointers/_slist.h new file mode 100644 index 0000000000..76189fe0ed --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/pointers/_slist.h @@ -0,0 +1,427 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_SPECIALIZED_SLIST_H +#define _STLP_SPECIALIZED_SLIST_H + +#ifndef _STLP_POINTERS_SPEC_TOOLS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define SLIST_IMPL _STLP_PTR_IMPL_NAME(slist) + +#if defined (__BORLANDC__) || defined (__DMC__) +# define typename +#endif + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +_STLP_MOVE_TO_PRIV_NAMESPACE + +_STLP_EXPORT_TEMPLATE_CLASS _Slist_node; +typedef _Slist_node _VoidPtrSNode; +_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<_Slist_node_base, _VoidPtrSNode, allocator<_VoidPtrSNode> >; +_STLP_EXPORT_TEMPLATE_CLASS _Slist_base >; +_STLP_EXPORT_TEMPLATE_CLASS SLIST_IMPL >; + +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#if defined (_STLP_DEBUG) +# define slist _STLP_NON_DBG_NAME(slist) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template ) > +class slist +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (slist) + : public __stlport_class > +#endif +{ + typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_Type _StorageType; + typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; + typedef _STLP_PRIV SLIST_IMPL<_StorageType, _StorageTypeAlloc> _Base; + typedef typename _Base::iterator _BaseIte; + typedef typename _Base::const_iterator _BaseConstIte; + typedef slist<_Tp, _Alloc> _Self; + typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; + typedef _STLP_PRIV _Slist_node_base _Node_base; + +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef forward_iterator_tag _Iterator_category; + + typedef _STLP_PRIV _Slist_iterator > iterator; + typedef _STLP_PRIV _Slist_iterator > const_iterator; + + _STLP_FORCE_ALLOCATORS(value_type, _Alloc) + typedef typename _Alloc_traits::allocator_type allocator_type; + +public: + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } + + explicit slist(const allocator_type& __a = allocator_type()) + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit slist(size_type __n, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type), +#else + slist(size_type __n, const value_type& __x, +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) + : _M_impl(__n, cast_traits::to_storage_type_cref(__x), _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit slist(size_type __n) : _M_impl(__n) {} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + +#if defined (_STLP_MEMBER_TEMPLATES) + // We don't need any dispatching tricks here, because _M_insert_after_range + // already does them. + template + slist(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL) +# if !defined (_STLP_USE_ITERATOR_WRAPPER) + : _M_impl(__first, __last, _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} +# else + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) { + insert_after(before_begin(), __first, __last); + } +# endif +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + // VC++ needs this crazyness + template + slist(_InputIterator __first, _InputIterator __last) +# if !defined (_STLP_USE_WRAPPER_ITERATOR) + : _M_impl(__first, __last) {} +# else + { insert_after(before_begin(), __first, __last); } +# endif +# endif +#else /* _STLP_MEMBER_TEMPLATES */ + slist(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type() ) + : _M_impl(_BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + slist(const value_type* __first, const value_type* __last, + const allocator_type& __a = allocator_type()) + : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} +#endif /* _STLP_MEMBER_TEMPLATES */ + + slist(const _Self& __x) : _M_impl(__x._M_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + slist(__move_source<_Self> src) + : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} +#endif + + _Self& operator= (const _Self& __x) { _M_impl = __x._M_impl; return *this; } + + void assign(size_type __n, const value_type& __val) + { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_assign_dispatch(_Integer __n, _Integer __val, + const __true_type&) + { _M_impl.assign(__n, __val); } + + template + void _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.assign(_STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + + template + void assign(_InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_assign_dispatch(__first, __last, _Integral()); +# else + _M_impl.assign(__first, __last); +# endif + } +#else + void assign(const value_type *__first, const value_type *__last) { + _M_impl.assign(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } + void assign(const_iterator __first, const_iterator __last) { + _M_impl.assign(_BaseConstIte(__first._M_node), + _BaseConstIte(__last._M_node)); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + + iterator before_begin() { return iterator(_M_impl.before_begin()._M_node); } + const_iterator before_begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.before_begin()._M_node)); } + + iterator begin() { return iterator(_M_impl.begin()._M_node); } + const_iterator begin() const { return const_iterator(const_cast<_Node_base*>(_M_impl.begin()._M_node));} + + iterator end() { return iterator(_M_impl.end()._M_node); } + const_iterator end() const { return iterator(_M_impl.end()._M_node); } + + size_type size() const { return _M_impl.size(); } + size_type max_size() const { return _M_impl.max_size(); } + bool empty() const { return _M_impl.empty(); } + + void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +public: + reference front() { return *begin(); } + const_reference front() const { return *begin(); } +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + void push_front(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void push_front(const value_type& __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { _M_impl.push_front(cast_traits::to_storage_type_cref(__x)); } + +# if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + void push_front() { _M_impl.push_front();} +# endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void pop_front() { _M_impl.pop_front(); } + + iterator previous(const_iterator __pos) + { return iterator(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node); } + const_iterator previous(const_iterator __pos) const + { return const_iterator(const_cast<_Node_base*>(_M_impl.previous(_BaseConstIte(__pos._M_node))._M_node)); } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + iterator insert_after(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + iterator insert_after(iterator __pos, const value_type& __x) +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node), + cast_traits::to_storage_type_cref(__x))._M_node); } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + iterator insert_after(iterator __pos) + { return iterator(_M_impl.insert_after(_BaseIte(__pos._M_node))._M_node);} +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void insert_after(iterator __pos, size_type __n, const value_type& __x) + { _M_impl.insert_after(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_insert_after_dispatch(iterator __pos, _Integer __n, _Integer __val, + const __true_type&) { + _M_impl.insert_after(_BaseIte(__pos._M_node), __n, __val); + } + + template + void _M_insert_after_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.insert_after(_BaseIte(__pos._M_node), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + + template + void insert_after(iterator __pos, _InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_after_dispatch(__pos, __first, __last, _Integral()); +# else + _M_impl.insert_after(_BaseIte(__pos._M_node), __first, __last); +# endif + } + +#else /* _STLP_MEMBER_TEMPLATES */ + void insert_after(iterator __pos, + const_iterator __first, const_iterator __last) + { _M_impl.insert_after(_BaseIte(__pos._M_node), + _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } + void insert_after(iterator __pos, + const value_type* __first, const value_type* __last) { + _M_impl.insert_after(_BaseIte(__pos._M_node), + cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + iterator insert(iterator __pos, const value_type& __x) +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + { return iterator(_M_impl.insert(_BaseIte(__pos._M_node), + cast_traits::to_storage_type_cref(__x))._M_node); } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + iterator insert(iterator __pos) + { return iterator(_M_impl.insert(_BaseIte(__pos._M_node))._M_node); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void insert(iterator __pos, size_type __n, const value_type& __x) + { _M_impl.insert(_BaseIte(__pos._M_node), __n, cast_traits::to_storage_type_cref(__x)); } + +#if defined (_STLP_MEMBER_TEMPLATES) +# if defined (_STLP_USE_ITERATOR_WRAPPER) +private: + template + void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + const __true_type&) { + _M_impl.insert(_BaseIte(__pos._M_node), __n, __val); + } + + template + void _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + const __false_type&) { + _M_impl.insert(_BaseIte(__pos._M_node), _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__first), + _STLP_TYPENAME _STLP_PRIV _IteWrapper<_StorageType, _Tp, _InputIterator>::_Ite(__last)); + } + +public: +# endif + + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) { +# if defined (_STLP_USE_ITERATOR_WRAPPER) + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename _IsIntegral<_InputIterator>::_Ret _Integral; + _M_insert_dispatch(__pos, __first, __last, _Integral()); +# else + _M_impl.insert(_BaseIte(__pos._M_node), __first, __last); +# endif + } + +#else /* _STLP_MEMBER_TEMPLATES */ + void insert(iterator __pos, const_iterator __first, const_iterator __last) + { _M_impl.insert(_BaseIte(__pos._M_node), _BaseConstIte(__first._M_node), _BaseConstIte(__last._M_node)); } + void insert(iterator __pos, const value_type* __first, const value_type* __last) + { _M_impl.insert(_BaseIte(__pos._M_node), cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + + iterator erase_after(iterator __pos) + { return iterator(_M_impl.erase_after(_BaseIte(__pos._M_node))._M_node); } + iterator erase_after(iterator __before_first, iterator __last) + { return iterator(_M_impl.erase_after(_BaseIte(__before_first._M_node), + _BaseIte(__last._M_node))._M_node); } + + iterator erase(iterator __pos) + { return iterator(_M_impl.erase(_BaseIte(__pos._M_node))._M_node); } + iterator erase(iterator __first, iterator __last) + { return iterator(_M_impl.erase(_BaseIte(__first._M_node), _BaseIte(__last._M_node))._M_node); } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void resize(size_type __new_size, const value_type& __x) +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x));} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { _M_impl.resize(__new_size); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void clear() { _M_impl.clear(); } + + void splice_after(iterator __pos, _Self& __x, + iterator __before_first, iterator __before_last) + { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, + _BaseIte(__before_first._M_node), _BaseIte(__before_last._M_node)); } + void splice_after(iterator __pos, _Self& __x, iterator __prev) + { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__prev._M_node)); } + void splice_after(iterator __pos, _Self& __x) + { _M_impl.splice_after(_BaseIte(__pos._M_node), __x._M_impl); } + void splice(iterator __pos, _Self& __x) + { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl); } + void splice(iterator __pos, _Self& __x, iterator __i) + { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, _BaseIte(__i._M_node)); } + void splice(iterator __pos, _Self& __x, iterator __first, iterator __last) + { _M_impl.splice(_BaseIte(__pos._M_node), __x._M_impl, + _BaseIte(__first._M_node), _BaseIte(__last._M_node)); } + + void reverse() { _M_impl.reverse(); } + + void remove(const value_type& __val) { _M_impl.remove(cast_traits::to_storage_type_cref(__val)); } + void unique() { _M_impl.unique(); } + void merge(_Self& __x) { _M_impl.merge(__x._M_impl); } + void sort() {_M_impl.sort(); } + +#ifdef _STLP_MEMBER_TEMPLATES + template + void remove_if(_Predicate __pred) + { _M_impl.remove_if(_STLP_PRIV _UnaryPredWrapper<_StorageType, _Tp, _Predicate>(__pred)); } + + template + void unique(_BinaryPredicate __pred) + { _M_impl.unique(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _BinaryPredicate>(__pred)); } + + template + void merge(_Self& __x, _StrictWeakOrdering __comp) + { _M_impl.merge(__x._M_impl, _STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } + + template + void sort(_StrictWeakOrdering __comp) + { _M_impl.sort(_STLP_PRIV _BinaryPredWrapper<_StorageType, _Tp, _StrictWeakOrdering>(__comp)); } +#endif /* _STLP_MEMBER_TEMPLATES */ + +private: + _Base _M_impl; +}; + +#if defined (slist) +# undef slist +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#undef SLIST_IMPL + +#if defined (__BORLANDC__) || defined (__DMC__) +# undef typename +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_SPECIALIZED_SLIST_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/stl/pointers/_tools.h b/sdk/tlibstdcxx/stlport/stl/pointers/_tools.h new file mode 100644 index 0000000000..ec94806199 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/pointers/_tools.h @@ -0,0 +1,471 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_POINTERS_SPEC_TOOLS_H +#define _STLP_POINTERS_SPEC_TOOLS_H + +#ifndef _STLP_TYPE_TRAITS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +//Some usefull declarations: +template struct less; + +_STLP_MOVE_TO_PRIV_NAMESPACE + +template +struct _BinaryPredWrapper; + +/* + * Since the compiler only allows at most one non-trivial + * implicit conversion we can make use of a shim class to + * be sure that functions below doesn't accept classes with + * implicit pointer conversion operators + */ +struct _VoidPointerShim +{ _VoidPointerShim(void*); }; +struct _ConstVoidPointerShim +{ _ConstVoidPointerShim(const void*); }; +struct _VolatileVoidPointerShim +{ _VolatileVoidPointerShim(volatile void*); }; +struct _ConstVolatileVoidPointerShim +{ _ConstVolatileVoidPointerShim(const volatile void*); }; + +//The dispatch functions: +template +char _UseVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); +char _UseVoidPtrStorageType(const __true_type& /*POD*/, ...); +char* _UseVoidPtrStorageType(const __true_type& /*POD*/, _VoidPointerShim); + +template +char _UseConstVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); +char _UseConstVoidPtrStorageType(const __true_type& /*POD*/, ...); +char* _UseConstVoidPtrStorageType(const __true_type& /*POD*/, _ConstVoidPointerShim); + +template +char _UseVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); +char _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...); +char* _UseVolatileVoidPtrStorageType(const __true_type& /*POD*/, _VolatileVoidPointerShim); + +template +char _UseConstVolatileVoidPtrStorageType(const __false_type& /*POD*/, const _Tp&); +char _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, ...); +char* _UseConstVolatileVoidPtrStorageType(const __true_type& /*POD*/, _ConstVolatileVoidPointerShim); + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* Thanks to class partial specialization the pointer specialization feature can even be used in + * presence of incomplete type: + * struct MyStruct { + * typedef vector MyStructContainer; + * typedef MyStructContainer::iterator MyStructIterator; + * }; + */ + +template +struct _StorageType { + typedef _Tp _QualifiedType; + typedef _Tp _Type; + enum { use_const_volatile_void_ptr = 0 }; +}; + +template +struct _StorageType<_Tp*> { + // Even if we detect a pointer type we use dispatch function to consider if it can be stored as a void*. + // For instance function pointer might not necessarily be convertible to void*. + enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(__true_type(), + __STATIC_CAST(_Tp*, 0))) == sizeof(char*)) }; + enum { use_const_volatile_void_ptr = use_void_ptr }; + typedef typename __select::_Ret _QualifiedType; + typedef _QualifiedType _Type; +}; + +template +struct _StorageType<_Tp const*> { + enum { use_void_ptr = (sizeof(_UseConstVoidPtrStorageType(__true_type(), + __STATIC_CAST(const _Tp*, 0))) == sizeof(char*)) }; + enum { use_const_volatile_void_ptr = use_void_ptr }; + typedef typename __select::_Ret _QualifiedType; + typedef typename __select::_Ret _Type; +}; + +template +struct _StorageType<_Tp volatile*> { + enum { use_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(__true_type(), + __STATIC_CAST(_Tp volatile*, 0))) == sizeof(char*)) }; + enum { use_const_volatile_void_ptr = use_void_ptr }; + typedef typename __select::_Ret _QualifiedType; + typedef typename __select::_Ret _Type; +}; + +template +struct _StorageType<_Tp const volatile*> { + enum { use_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(__true_type(), + __STATIC_CAST(_Tp const volatile*, 0))) == sizeof(char*)) }; + enum { use_const_volatile_void_ptr = use_void_ptr }; + typedef typename __select::_Ret _QualifiedType; + typedef typename __select::_Ret _Type; +}; +#else +template +struct _StorageType { + typedef typename __type_traits<_Tp>::is_POD_type _PODType; + +#if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) + static _Tp __null_rep(); +#else + static _Tp __null_rep; +#endif + enum { use_void_ptr = (sizeof(_UseVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; + enum { use_const_void_ptr = (sizeof(_UseConstVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; + enum { use_volatile_void_ptr = (sizeof(_UseVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; + enum { use_const_volatile_void_ptr = (sizeof(_UseConstVolatileVoidPtrStorageType(_PODType(), __null_rep())) == sizeof(char*)) }; + + typedef typename __select::_Ret >::_Ret >::_Ret >::_Ret _QualifiedType; + +#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) + /* If the compiler do not support the iterator_traits structure we cannot wrap + * iterators pass to container template methods. The iterator dereferenced value + * has to be storable without any cast in the chosen storage type. To guaranty + * that the void pointer has to be correctly qualified. + */ + typedef _QualifiedType _Type; +#else + /* With iterator_traits we can wrap passed iterators and make the necessary casts. + * We can always use a simple void* storage type: + */ + typedef typename __select::_Ret _Type; +#endif +}; +#endif + +template +struct _AssocStorageTypes { + typedef _StorageType<_Tp> _StorageTypeInfo; + typedef typename _StorageTypeInfo::_Type _SType; + + //We need to also check that the comparison functor used to instanciate the assoc container + //is the default Standard less implementation: + enum { ptr_type = _StorageTypeInfo::use_const_volatile_void_ptr }; + typedef typename _IsSTLportClass<_Compare>::_Ret _STLportLess; + enum { is_default_less = __type2bool<_STLportLess>::_Ret }; + typedef typename __select::_Ret _KeyStorageType; + typedef typename __select, + _Compare>::_Ret _CompareStorageType; +}; + + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +/* + * Base struct to deal with qualifiers + */ +template +struct _VoidCastTraitsAux { + typedef _QualifiedStorageT void_cv_type; + typedef _StorageT void_type; + + static void_type * uncv_ptr(void_cv_type *__ptr) + { return __ptr; } + static void_type const* uncv_cptr(void_cv_type const*__ptr) + { return __ptr; } + static void_type ** uncv_pptr(void_cv_type **__ptr) + { return __ptr; } + static void_type & uncv_ref(void_cv_type & __ref) + { return __ref; } + static void_type const& uncv_cref(void_cv_type const& __ref) + { return __ref; } + static void_cv_type* cv_ptr(void_type *__ptr) + { return __ptr; } + static void_cv_type const* cv_cptr(void_type const*__ptr) + { return __ptr; } + static void_cv_type ** cv_pptr(void_type **__ptr) + { return __ptr; } + static void_cv_type & cv_ref(void_type & __ref) + { return __ref; } + static void_cv_type const& cv_cref(void_type const& __ref) + { return __ref; } +}; + +template +struct _VoidCastTraitsAuxBase { + typedef _VoidCVType* void_cv_type; + typedef void* void_type; + + static void_type* uncv_ptr(void_cv_type *__ptr) + { return __CONST_CAST(void_type*, __ptr); } + static void_type const* uncv_cptr(void_cv_type const*__ptr) + { return __CONST_CAST(void_type const*, __ptr); } + static void_type** uncv_pptr(void_cv_type **__ptr) + { return __CONST_CAST(void_type**, __ptr); } + static void_type& uncv_ref(void_cv_type &__ref) + { return __CONST_CAST(void_type&, __ref); } + static void_type const& uncv_cref(void_cv_type const& __ptr) + { return __CONST_CAST(void_type const&, __ptr); } + // The reverse versions + static void_cv_type * cv_ptr(void_type *__ptr) + { return __CONST_CAST(void_cv_type *, __ptr); } + static void_cv_type const* cv_cptr(void_type const*__ptr) + { return __CONST_CAST(void_cv_type const*, __ptr); } + static void_cv_type ** cv_pptr(void_type **__ptr) + { return __CONST_CAST(void_cv_type**, __ptr); } + static void_cv_type & cv_ref(void_type &__ref) + { return __CONST_CAST(void_cv_type &, __ref); } + static void_cv_type const& cv_cref(void_type const& __ref) + { return __CONST_CAST(void_cv_type const&, __ref); } +}; + +_STLP_TEMPLATE_NULL +struct _VoidCastTraitsAux : _VoidCastTraitsAuxBase +{}; +_STLP_TEMPLATE_NULL +struct _VoidCastTraitsAux : _VoidCastTraitsAuxBase +{}; +_STLP_TEMPLATE_NULL +struct _VoidCastTraitsAux : _VoidCastTraitsAuxBase +{}; + +template +struct _CastTraits { + typedef _ValueT value_type; + typedef typename _StorageType<_ValueT>::_QualifiedType _QualifiedStorageT; + typedef _VoidCastTraitsAux<_StorageT, _QualifiedStorageT> cv_traits; + typedef typename cv_traits::void_type void_type; + typedef typename cv_traits::void_cv_type void_cv_type; + + static value_type * to_value_type_ptr(void_type *__ptr) + { return __REINTERPRET_CAST(value_type *, cv_traits::cv_ptr(__ptr)); } + static value_type const* to_value_type_cptr(void_type const*__ptr) + { return __REINTERPRET_CAST(value_type const*, cv_traits::cv_cptr(__ptr)); } + static value_type ** to_value_type_pptr(void_type **__ptr) + { return __REINTERPRET_CAST(value_type **, cv_traits::cv_pptr(__ptr)); } + static value_type & to_value_type_ref(void_type &__ref) + { return __REINTERPRET_CAST(value_type &, cv_traits::cv_ref(__ref)); } + static value_type const& to_value_type_cref(void_type const& __ptr) + { return __REINTERPRET_CAST(value_type const&, cv_traits::cv_cref(__ptr)); } + // Reverse versions + static void_type * to_storage_type_ptr(value_type *__ptr) + { return cv_traits::uncv_ptr(__REINTERPRET_CAST(void_cv_type *, __ptr)); } + static void_type const* to_storage_type_cptr(value_type const*__ptr) + { return cv_traits::uncv_cptr(__REINTERPRET_CAST(void_cv_type const*, __ptr)); } + static void_type ** to_storage_type_pptr(value_type **__ptr) + { return cv_traits::uncv_pptr(__REINTERPRET_CAST(void_cv_type **, __ptr)); } + static void_type const& to_storage_type_cref(value_type const& __ref) + { return cv_traits::uncv_cref(__REINTERPRET_CAST(void_cv_type const&, __ref)); } + + //Method used to treat set container template method extension + static void_type const& to_storage_type_crefT(value_type const& __ref) + { return to_storage_type_cref(__ref); } +}; + +template +struct _CastTraits<_Tp, _Tp> { + typedef _Tp storage_type; + typedef _Tp value_type; + + static value_type * to_value_type_ptr(storage_type *__ptr) + { return __ptr; } + static value_type const* to_value_type_cptr(storage_type const*__ptr) + { return __ptr; } + static value_type ** to_value_type_pptr(storage_type **__ptr) + { return __ptr; } + static value_type & to_value_type_ref(storage_type &__ref) + { return __ref; } + static value_type const& to_value_type_cref(storage_type const&__ref) + { return __ref; } + // Reverse versions + static storage_type * to_storage_type_ptr(value_type *__ptr) + { return __ptr; } + static storage_type const* to_storage_type_cptr(value_type const*__ptr) + { return __ptr; } + static storage_type ** to_storage_type_pptr(value_type **__ptr) + { return __ptr; } + static storage_type const& to_storage_type_cref(value_type const& __ref) + { return __ref; } + + //Method used to treat set container template method extension + template + static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref) + { return __ref; } +}; + +#define _STLP_USE_ITERATOR_WRAPPER + +template +struct _IteWrapper { + typedef _CastTraits<_StorageT, _ValueT> cast_traits; + typedef iterator_traits<_Iterator> _IteTraits; + + typedef typename _IteTraits::iterator_category iterator_category; + typedef _StorageT value_type; + typedef typename _IteTraits::difference_type difference_type; + typedef value_type* pointer; + typedef value_type const& const_reference; + //This wrapper won't be used for input so to avoid surprise + //the reference type will be a const reference: + typedef const_reference reference; + + typedef _IteWrapper<_StorageT, _ValueT, _Iterator> _Self; + typedef _Self _Ite; + + _IteWrapper(_Iterator &__ite) : _M_ite(__ite) {} + + const_reference operator*() const { return cast_traits::to_storage_type_cref(*_M_ite); } + + _Self& operator= (_Self const& __rhs) { + _M_ite = __rhs._M_ite; + return *this; + } + + _Self& operator++() { + ++_M_ite; + return *this; + } + + _Self& operator--() { + --_M_ite; + return *this; + } + + _Self& operator += (difference_type __offset) { + _M_ite += __offset; + return *this; + } + difference_type operator -(_Self const& __other) const + { return _M_ite - __other._M_ite; } + + bool operator == (_Self const& __other) const + { return _M_ite == __other._M_ite; } + + bool operator != (_Self const& __other) const + { return _M_ite != __other._M_ite; } + + bool operator < (_Self const& __rhs) const + { return _M_ite < __rhs._M_ite; } + +private: + _Iterator _M_ite; +}; + +template +struct _IteWrapper<_Tp, _Tp, _Iterator> +{ typedef _Iterator _Ite; }; + +#else + +/* + * In this config the storage type is qualified in respect of the + * value_type qualification. Simple reinterpret_cast is enough. + */ +template +struct _CastTraits { + typedef _StorageT storage_type; + typedef _ValueT value_type; + + static value_type * to_value_type_ptr(storage_type *__ptr) + { return __REINTERPRET_CAST(value_type*, __ptr); } + static value_type const* to_value_type_cptr(storage_type const*__ptr) + { return __REINTERPRET_CAST(value_type const*, __ptr); } + static value_type ** to_value_type_pptr(storage_type **__ptr) + { return __REINTERPRET_CAST(value_type **, __ptr); } + static value_type & to_value_type_ref(storage_type &__ref) + { return __REINTERPRET_CAST(value_type&, __ref); } + static value_type const& to_value_type_cref(storage_type const&__ref) + { return __REINTERPRET_CAST(value_type const&, __ref); } + // Reverse versions + static storage_type * to_storage_type_ptr(value_type *__ptr) + { return __REINTERPRET_CAST(storage_type*, __ptr); } + static storage_type const* to_storage_type_cptr(value_type const*__ptr) + { return __REINTERPRET_CAST(storage_type const*, __ptr); } + static storage_type ** to_storage_type_pptr(value_type **__ptr) + { return __REINTERPRET_CAST(storage_type **, __ptr); } + static storage_type const& to_storage_type_cref(value_type const&__ref) + { return __REINTERPRET_CAST(storage_type const&, __ref); } + template + static _Tp1 const& to_storage_type_crefT(_Tp1 const& __ref) + { return __ref; } +}; + +#endif + +//Wrapper functors: +template +struct _UnaryPredWrapper { + typedef _CastTraits<_StorageT, _ValueT> cast_traits; + + _UnaryPredWrapper (_UnaryPredicate const& __pred) : _M_pred(__pred) {} + + bool operator () (_StorageT const& __ref) const + { return _M_pred(cast_traits::to_value_type_cref(__ref)); } + +private: + _UnaryPredicate _M_pred; +}; + +template +struct _BinaryPredWrapper { + typedef _CastTraits<_StorageT, _ValueT> cast_traits; + + _BinaryPredWrapper () {} + _BinaryPredWrapper (_BinaryPredicate const& __pred) : _M_pred(__pred) {} + + _BinaryPredicate get_pred() const { return _M_pred; } + + bool operator () (_StorageT const& __fst, _StorageT const& __snd) const + { return _M_pred(cast_traits::to_value_type_cref(__fst), cast_traits::to_value_type_cref(__snd)); } + + //Cast operator used to transparently access underlying predicate + //in set::key_comp() method + operator _BinaryPredicate() const + { return _M_pred; } + +private: + _BinaryPredicate _M_pred; +}; + +_STLP_MOVE_TO_STD_NAMESPACE + +_STLP_END_NAMESPACE + +#endif /* _STLP_POINTERS_SPEC_TOOLS_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/pointers/_vector.h b/sdk/tlibstdcxx/stlport/stl/pointers/_vector.h new file mode 100644 index 0000000000..64705bf248 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/pointers/_vector.h @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* NOTE: This is an internal header file, included by other STL headers. + * You should not attempt to use it directly. + */ + +#ifndef _STLP_SPECIALIZED_VECTOR_H +#define _STLP_SPECIALIZED_VECTOR_H + +#ifndef _STLP_POINTERS_SPEC_TOOLS_H +# include +#endif + +_STLP_BEGIN_NAMESPACE + +#define VECTOR_IMPL _STLP_PTR_IMPL_NAME(vector) + +#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) +_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV _Vector_base >; +_STLP_EXPORT_TEMPLATE_CLASS _STLP_PRIV VECTOR_IMPL >; +#endif + +#if defined (_STLP_DEBUG) +# define vector _STLP_NON_DBG_NAME(vector) +_STLP_MOVE_TO_PRIV_NAMESPACE +#endif + +template ) > +class vector +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (vector) + : public __stlport_class > +#endif +{ + /* In the vector implementation iterators are pointer which give a number + * of opportunities for optimization. To not break those optimizations + * iterators passed to template should not be wrapped for casting purpose. + * So vector implementation will always use a qualified void pointer type and + * won't use iterator wrapping. + */ + typedef _STLP_TYPENAME _STLP_PRIV _StorageType<_Tp>::_QualifiedType _StorageType; + typedef typename _Alloc_traits<_StorageType, _Alloc>::allocator_type _StorageTypeAlloc; + typedef _STLP_PRIV VECTOR_IMPL<_StorageType, _StorageTypeAlloc> _Base; + typedef vector<_Tp, _Alloc> _Self; + + typedef _STLP_PRIV _CastTraits<_StorageType, _Tp> cast_traits; + +public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef random_access_iterator_tag _Iterator_category; + + _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS; + _STLP_FORCE_ALLOCATORS(value_type, _Alloc) + typedef typename _Alloc_traits::allocator_type allocator_type; + + allocator_type get_allocator() const + { return _STLP_CONVERT_ALLOCATOR(_M_impl.get_allocator(), value_type); } + + iterator begin() { return cast_traits::to_value_type_ptr(_M_impl.begin()); } + const_iterator begin() const { return cast_traits::to_value_type_cptr(_M_impl.begin()); } + iterator end() { return cast_traits::to_value_type_ptr(_M_impl.end()); } + const_iterator end() const { return cast_traits::to_value_type_cptr(_M_impl.end()); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } + + size_type size() const { return _M_impl.size(); } + size_type max_size() const { return _M_impl.max_size(); } + + size_type capacity() const { return _M_impl.capacity(); } + bool empty() const { return _M_impl.empty(); } + + reference operator[](size_type __n) { return cast_traits::to_value_type_ref(_M_impl[__n]); } + const_reference operator[](size_type __n) const { return cast_traits::to_value_type_cref(_M_impl[__n]); } + + reference front() { return cast_traits::to_value_type_ref(_M_impl.front()); } + const_reference front() const { return cast_traits::to_value_type_cref(_M_impl.front()); } + reference back() { return cast_traits::to_value_type_ref(_M_impl.back()); } + const_reference back() const { return cast_traits::to_value_type_cref(_M_impl.back()); } + + reference at(size_type __n) { return cast_traits::to_value_type_ref(_M_impl.at(__n)); } + const_reference at(size_type __n) const { return cast_traits::to_value_type_cref(_M_impl.at(__n)); } + + explicit vector(const allocator_type& __a = allocator_type()) + : _M_impl(_STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit vector(size_type __n, const value_type& __val = _STLP_DEFAULT_CONSTRUCTED(value_type), +#else + vector(size_type __n, const value_type& __val, +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + const allocator_type& __a = allocator_type()) + : _M_impl(__n, cast_traits::to_storage_type_cref(__val), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + explicit vector(size_type __n) + : _M_impl(__n, allocator_type() ) {} +#endif + + vector(const _Self& __x) + : _M_impl(__x._M_impl) {} + +#if !defined (_STLP_NO_MOVE_SEMANTIC) + explicit vector(__move_source<_Self> src) + : _M_impl(__move_source<_Base>(src.get()._M_impl)) {} +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL ) + : _M_impl(__first, __last, + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} + +# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) + template + vector(_InputIterator __first, _InputIterator __last) + : _M_impl(__first, __last) {} +# endif + +#else + vector(const_iterator __first, const_iterator __last, + const allocator_type& __a = allocator_type()) + : _M_impl(cast_traits::to_storage_type_cptr(__first), cast_traits::to_storage_type_cptr(__last), + _STLP_CONVERT_ALLOCATOR(__a, _StorageType)) {} +#endif /* _STLP_MEMBER_TEMPLATES */ + + _Self& operator=(const _Self& __x) { _M_impl = __x._M_impl; return *this; } + + void reserve(size_type __n) {_M_impl.reserve(__n);} + void assign(size_type __n, const value_type& __val) + { _M_impl.assign(__n, cast_traits::to_storage_type_cref(__val)); } + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void assign(_InputIterator __first, _InputIterator __last) + { _M_impl.assign(__first, __last); } +#else + void assign(const_iterator __first, const_iterator __last) { + _M_impl.assign(cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } +#endif /* _STLP_MEMBER_TEMPLATES */ + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + void push_back(const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void push_back(const value_type& __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { _M_impl.push_back(cast_traits::to_storage_type_cref(__x)); } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + iterator insert(iterator __pos, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + iterator insert(iterator __pos, const value_type& __x) +#endif /*!_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + { return cast_traits::to_value_type_ptr(_M_impl.insert(cast_traits::to_storage_type_ptr(__pos), + cast_traits::to_storage_type_cref(__x))); } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) && !defined(_STLP_NO_ANACHRONISMS) + void push_back() { _M_impl.push_back(); } + iterator insert(iterator __pos) + { return _M_impl.insert(cast_traits::to_storage_type_ptr(__pos)); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM && !_STLP_NO_ANACHRONISMS*/ + + void swap(_Self& __x) { _M_impl.swap(__x._M_impl); } +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) + void _M_swap_workaround(_Self& __x) { swap(__x); } +#endif + +#if defined (_STLP_MEMBER_TEMPLATES) + template + void insert(iterator __pos, _InputIterator __first, _InputIterator __last) + { _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __first, __last); } +#else + void insert(iterator __pos, const_iterator __first, const_iterator __last) { + _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), cast_traits::to_storage_type_cptr(__first), + cast_traits::to_storage_type_cptr(__last)); + } +#endif + + void insert (iterator __pos, size_type __n, const value_type& __x) { + _M_impl.insert(cast_traits::to_storage_type_ptr(__pos), __n, cast_traits::to_storage_type_cref(__x)); + } + + void pop_back() {_M_impl.pop_back();} + iterator erase(iterator __pos) + {return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__pos)));} + iterator erase(iterator __first, iterator __last) { + return cast_traits::to_value_type_ptr(_M_impl.erase(cast_traits::to_storage_type_ptr(__first), + cast_traits::to_storage_type_ptr(__last))); + } + +#if !defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size, const value_type& __x = _STLP_DEFAULT_CONSTRUCTED(value_type)) +#else + void resize(size_type __new_size, const value_type& __x) +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + { _M_impl.resize(__new_size, cast_traits::to_storage_type_cref(__x)); } + +#if defined(_STLP_DONT_SUP_DFLT_PARAM) + void resize(size_type __new_size) { _M_impl.resize(__new_size); } +#endif /*_STLP_DONT_SUP_DFLT_PARAM*/ + + void clear() { _M_impl.clear(); } + +private: + _Base _M_impl; +}; + +#if defined (vector) +# undef vector +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +#undef VECTOR_IMPL + +_STLP_END_NAMESPACE + +#endif /* _STLP_SPECIALIZED_VECTOR_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/type_manips.h b/sdk/tlibstdcxx/stlport/stl/type_manips.h new file mode 100644 index 0000000000..410b59d256 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/type_manips.h @@ -0,0 +1,321 @@ +/* + * + * Copyright (c) 2003 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + + +#ifndef _STLP_TYPE_MANIPS_H +#define _STLP_TYPE_MANIPS_H + +_STLP_BEGIN_NAMESPACE + +struct __true_type {}; +struct __false_type {}; + +#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_DONT_USE_PRIV_NAMESPACE) +_STLP_MOVE_TO_PRIV_NAMESPACE +using _STLP_STD::__true_type; +using _STLP_STD::__false_type; +_STLP_MOVE_TO_STD_NAMESPACE +#endif + +//bool to type +template +struct __bool2type +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct __bool2type<1> { typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct __bool2type<0> { typedef __false_type _Ret; }; + +//type to bool +template +struct __type2bool { enum {_Ret = 1}; }; + +_STLP_TEMPLATE_NULL +struct __type2bool<__true_type> { enum {_Ret = 1}; }; + +_STLP_TEMPLATE_NULL +struct __type2bool<__false_type> { enum {_Ret = 0}; }; + +//Negation +template +struct _Not { typedef __false_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct _Not<__false_type> { typedef __true_type _Ret; }; + +// logical and of 2 predicated +template +struct _Land2 { typedef __false_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct _Land2<__true_type, __true_type> { typedef __true_type _Ret; }; + +// logical and of 3 predicated +template +struct _Land3 { typedef __false_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct _Land3<__true_type, __true_type, __true_type> { typedef __true_type _Ret; }; + +//logical or of 2 predicated +template +struct _Lor2 { typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct _Lor2<__false_type, __false_type> { typedef __false_type _Ret; }; + +// logical or of 3 predicated +template +struct _Lor3 { typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL +struct _Lor3<__false_type, __false_type, __false_type> { typedef __false_type _Ret; }; + +//////////////////////////////////////////////////////////////////////////////// +// class template __select +// Selects one of two types based upon a boolean constant +// Invocation: __select<_Cond, T, U>::Result +// where: +// flag is a compile-time boolean constant +// T and U are types +// Result evaluates to T if flag is true, and to U otherwise. +//////////////////////////////////////////////////////////////////////////////// +// BEWARE: If the compiler do not support partial template specialization or nested template +//classes the default behavior of the __select is to consider the condition as false and so return +//the second template type!! + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +# if defined (__BORLANDC__) +template +struct __selectT { typedef _Tp1 _Ret; }; + +template +struct __selectT<__false_type, _Tp1, _Tp2> { typedef _Tp2 _Ret; }; +# endif + +# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590) +template +struct __select { typedef _Tp1 _Ret; }; + +template +struct __select { typedef _Tp2 _Ret; }; +# else +template +struct __select +{ typedef __selectT::_Ret, _Tp1, _Tp2>::_Ret _Ret; }; +# endif + +#else + +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) +template +struct __select_aux { + template + struct _In { + typedef _Tp1 _Ret; + }; +}; + +_STLP_TEMPLATE_NULL +struct __select_aux<0> { + template + struct _In { + typedef _Tp2 _Ret; + }; +}; + +template +struct __select { + typedef typename __select_aux<_Cond>::_STLP_TEMPLATE _In<_Tp1, _Tp2>::_Ret _Ret; +}; +# else /* _STLP_MEMBER_TEMPLATE_CLASSES */ +//default behavior +template +struct __select { + typedef _Tp2 _Ret; +}; +# endif /* _STLP_MEMBER_TEMPLATE_CLASSES */ + +#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +/* Rather than introducing a new macro for the following constrution we use + * an existing one (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) that + * is used for a similar feature. + */ +#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && \ + (!defined (__GNUC__) || (__GNUC__ > 2)) +// Helper struct that will forbid volatile qualified types: +# if !defined (__BORLANDC__) +struct _NoVolatilePointerShim { _NoVolatilePointerShim(const void*); }; +template +char _STLP_CALL _IsCopyableFun(bool, _NoVolatilePointerShim, _Tp const*, _Tp*); // no implementation is required +char* _STLP_CALL _IsCopyableFun(bool, ...); // no implementation is required + +template +struct _Copyable { + static _Src* __null_src(); + static _Dst* __null_dst(); + enum { _Ret = (sizeof(_IsCopyableFun(false, __null_src(), __null_src(), __null_dst())) == sizeof(char)) }; + typedef typename __bool2type<_Ret>::_Ret _RetT; +}; +# else +template struct _AreSameTypes; +template struct _IsUnQual; +template +struct _Copyable { + typedef typename _AreSameTypes<_Src, _Dst>::_Ret _Tr1; + typedef typename _IsUnQual<_Dst>::_Ret _Tr2; + typedef typename _Land2<_Tr1, _Tr2>::_Ret _RetT; + enum { _Ret = __type2bool<_RetT>::_Ret }; +}; +# endif +#else +template +struct _Copyable { + enum { _Ret = 0 }; + typedef __false_type _RetT; +}; +#endif + +/* + * The following struct will tell you if 2 types are the same and if copying memory + * from the _Src type to the _Dst type is right considering qualifiers. If _Src and + * _Dst types are the same unqualified types _Ret will be false if: + * - any of the type has the volatile qualifier + * - _Dst is const qualified + */ +template +struct _AreCopyable { + enum { _Same = _Copyable<_Src, _Dst>::_Ret }; + typedef typename _Copyable<_Src, _Dst>::_RetT _Ret; +}; + +template +struct _AreSameTypes { + enum { _Same = 0 }; + typedef __false_type _Ret; +}; + +#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct _AreSameTypes<_Tp, _Tp> { + enum { _Same = 1 }; + typedef __true_type _Ret; +}; +#endif + +#if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) +template +struct _ConversionHelper { + static char _Test(bool, _Dst); + static char* _Test(bool, ...); + static _Src _MakeSource(); +}; + +template +struct _IsConvertible { + typedef _ConversionHelper<_Src*, const volatile _Dst*> _H; + enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) }; + typedef typename __bool2type::_Ret _Ret; +}; + +# if defined (__BORLANDC__) +# if (__BORLANDC__ < 0x590) +template +struct _UnConstPtr { typedef _Tp _Type; }; + +template +struct _UnConstPtr<_Tp*> { typedef _Tp _Type; }; + +template +struct _UnConstPtr { typedef _Tp _Type; }; +# endif + +# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) +template +struct _IsConst { typedef __false_type _Ret; }; +# else +template +struct _IsConst { typedef _AreSameTypes<_Tp, const _Tp>::_Ret _Ret; }; +# endif + +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) +template +struct _IsConst { typedef __true_type _Ret; }; +# endif + +# if (__BORLANDC__ < 0x590) +template +struct _IsConst<_Tp*> { typedef _AreSameTypes<_Tp*, const _Tp*>::_Ret _Ret; }; +# endif +template +struct _IsVolatile { typedef _AreSameTypes<_Tp, volatile _Tp>::_Ret _Ret; }; + +template +struct _IsUnQual { + typedef _IsConst<_Tp>::_Ret _Tr1; + typedef _IsVolatile<_Tp>::_Ret _Tr2; + typedef _Not<_Tr1>::_Ret _NotCon; + typedef _Not<_Tr2>::_Ret _NotVol; + typedef _Land2<_NotCon, _NotVol>::_Ret _Ret; +}; + +# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) +template struct _UnQual { typedef _Tp _Type; }; +template struct _UnQual { typedef _Tp _Type; }; +template struct _UnQual { typedef _Tp _Type; }; +template struct _UnQual { typedef _Tp _Type; }; +# endif +# endif + +/* This struct is intended to say if a pointer can be convertible to an other + * taking into account cv qualifications. It shouldn't be instanciated with + * something else than pointer type as it uses pass by value parameter that + * results in compilation error when parameter type has a special memory + * alignment + */ +template +struct _IsCVConvertible { +# if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x590) + typedef _ConversionHelper<_Src, _Dst> _H; + enum { value = (sizeof(char) == sizeof(_H::_Test(false, _H::_MakeSource()))) }; +# else + enum { _Is1 = __type2bool<_IsConst<_Src>::_Ret>::_Ret }; + enum { _Is2 = _IsConvertible<_UnConstPtr<_Src>::_Type, _UnConstPtr<_Dst>::_Type>::value }; + enum { value = _Is1 ? 0 : _Is2 }; +# endif + typedef typename __bool2type::_Ret _Ret; +}; + +#else +template +struct _IsConvertible { + enum { value = 0 }; + typedef __false_type _Ret; +}; + +template +struct _IsCVConvertible { + enum { value = 0 }; + typedef __false_type _Ret; +}; +#endif + +_STLP_END_NAMESPACE + +#endif /* _STLP_TYPE_MANIPS_H */ diff --git a/sdk/tlibstdcxx/stlport/stl/type_traits.h b/sdk/tlibstdcxx/stlport/stl/type_traits.h new file mode 100644 index 0000000000..af0923d03d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/stl/type_traits.h @@ -0,0 +1,626 @@ +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_TYPE_TRAITS_H +#define _STLP_TYPE_TRAITS_H + +/* +This header file provides a framework for allowing compile time dispatch +based on type attributes. This is useful when writing template code. +For example, when making a copy of an array of an unknown type, it helps +to know if the type has a trivial copy constructor or not, to help decide +if a memcpy can be used. + +The class template __type_traits provides a series of typedefs each of +which is either __true_type or __false_type. The argument to +__type_traits can be any type. The typedefs within this template will +attain their correct values by one of these means: + 1. The general instantiation contain conservative values which work + for all types. + 2. Specializations may be declared to make distinctions between types. + 3. Some compilers (such as the Silicon Graphics N32 and N64 compilers) + will automatically provide the appropriate specializations for all + types. + +EXAMPLE: + +//Copy an array of elements which have non-trivial copy constructors +template void copy(T* source, T* destination, int n, __false_type); +//Copy an array of elements which have trivial copy constructors. Use memcpy. +template void copy(T* source, T* destination, int n, __true_type); + +//Copy an array of any type by using the most efficient copy mechanism +template inline void copy(T* source,T* destination,int n) { + copy(source, destination, n, + typename __type_traits::has_trivial_copy_constructor()); +} +*/ + +#ifdef __WATCOMC__ +# include +#endif + +#ifndef _STLP_TYPE_MANIPS_H +# include +#endif + +#ifdef _STLP_USE_BOOST_SUPPORT +# include +# include +# include +#endif /* _STLP_USE_BOOST_SUPPORT */ + +_STLP_BEGIN_NAMESPACE + +#if !defined (_STLP_USE_BOOST_SUPPORT) + +// The following could be written in terms of numeric_limits. +// We're doing it separately to reduce the number of dependencies. + +template struct _IsIntegral +{ typedef __false_type _Ret; }; + +# ifndef _STLP_NO_BOOL +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; +# endif /* _STLP_NO_BOOL */ + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +# ifndef _STLP_NO_SIGNED_BUILTINS +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; +# endif + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT) +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; +# endif /* _STLP_HAS_WCHAR_T */ + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; + +# ifdef _STLP_LONG_LONG +_STLP_TEMPLATE_NULL struct _IsIntegral<_STLP_LONG_LONG> +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsIntegral +{ typedef __true_type _Ret; }; +# endif /* _STLP_LONG_LONG */ + +template struct _IsRational +{ typedef __false_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsRational +{ typedef __true_type _Ret; }; + +_STLP_TEMPLATE_NULL struct _IsRational +{ typedef __true_type _Ret; }; + +# if !defined ( _STLP_NO_LONG_DOUBLE ) +_STLP_TEMPLATE_NULL struct _IsRational +{ typedef __true_type _Ret; }; +# endif + +// Forward declarations. +template struct __type_traits; +template struct __type_traits_aux { + typedef __false_type has_trivial_default_constructor; + typedef __false_type has_trivial_copy_constructor; + typedef __false_type has_trivial_assignment_operator; + typedef __false_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; + +_STLP_TEMPLATE_NULL +struct __type_traits_aux<__false_type> { + typedef __false_type has_trivial_default_constructor; + typedef __false_type has_trivial_copy_constructor; + typedef __false_type has_trivial_assignment_operator; + typedef __false_type has_trivial_destructor; + typedef __false_type is_POD_type; +}; + +_STLP_TEMPLATE_NULL +struct __type_traits_aux<__true_type> { + typedef __true_type has_trivial_default_constructor; + typedef __true_type has_trivial_copy_constructor; + typedef __true_type has_trivial_assignment_operator; + typedef __true_type has_trivial_destructor; + typedef __true_type is_POD_type; +}; + +template +struct _IsRef { + typedef __false_type _Ret; +}; + +# if defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) +/* + * Boris : simulation technique is used here according to Adobe Open Source License Version 1.0. + * Copyright 2000 Adobe Systems Incorporated and others. All rights reserved. + * Authors: Mat Marcus and Jesse Jones + * The original version of this source code may be found at + * http://opensource.adobe.com. + */ + +struct _PointerShim { + /* + * Since the compiler only allows at most one non-trivial + * implicit conversion we can make use of a shim class to + * be sure that IsPtr below doesn't accept classes with + * implicit pointer conversion operators + */ + _PointerShim(const volatile void*); // no implementation +}; + +// These are the discriminating functions +char _STLP_CALL _IsP(bool, _PointerShim); // no implementation is required +char* _STLP_CALL _IsP(bool, ...); // no implementation is required + +template +struct _IsPtr { + /* + * This template meta function takes a type T + * and returns true exactly when T is a pointer. + * One can imagine meta-functions discriminating on + * other criteria. + */ + static _Tp& __null_rep(); + enum { _Ptr = (sizeof(_IsP(false,__null_rep())) == sizeof(char)) }; + typedef typename __bool2type<_Ptr>::_Ret _Ret; + +}; + +// we make general case dependant on the fact the type is actually a pointer. +template +struct __type_traits : __type_traits_aux::_Ret> {}; + +# else /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */ + +template struct _IsPtr { + typedef __false_type _Ret; +}; + +template +struct __type_traits { + typedef __true_type this_dummy_member_must_be_first; + /* Do not remove this member. It informs a compiler which + automatically specializes __type_traits that this + __type_traits template is special. It just makes sure that + things work if an implementation is using a template + called __type_traits for something unrelated. */ + + /* The following restrictions should be observed for the sake of + compilers which automatically produce type specific specializations + of this class: + - You may reorder the members below if you wish + - You may remove any of the members below if you wish + - You must not rename members without making the corresponding + name change in the compiler + - Members you add will be treated like regular members unless + + you add the appropriate support in the compiler. */ +# if !defined (_STLP_HAS_TYPE_TRAITS_INTRINSICS) + typedef __false_type has_trivial_default_constructor; + typedef __false_type has_trivial_copy_constructor; + typedef __false_type has_trivial_assignment_operator; + typedef __false_type has_trivial_destructor; + typedef __false_type is_POD_type; +# else + typedef typename __bool2type<_STLP_HAS_TRIVIAL_CONSTRUCTOR(_Tp)>::_Ret has_trivial_default_constructor; + typedef typename __bool2type<_STLP_HAS_TRIVIAL_COPY(_Tp)>::_Ret has_trivial_copy_constructor; + typedef typename __bool2type<_STLP_HAS_TRIVIAL_ASSIGN(_Tp)>::_Ret has_trivial_assignment_operator; + typedef typename __bool2type<_STLP_HAS_TRIVIAL_DESTRUCTOR(_Tp)>::_Ret has_trivial_destructor; + typedef typename __bool2type<_STLP_IS_POD(_Tp)>::_Ret is_POD_type; +# endif +}; + +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template struct _IsPtr<_Tp*> +{ typedef __true_type _Ret; }; +template struct _IsRef<_Tp&> +{ typedef __true_type _Ret; }; + +template struct __type_traits<_Tp*> : __type_traits_aux<__true_type> +{}; +# endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ + +# endif /* _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS */ + +// Provide some specializations. This is harmless for compilers that +// have built-in __types_traits support, and essential for compilers +// that don't. +# if !defined (_STLP_QUALIFIED_SPECIALIZATION_BUG) +# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \ +_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; \ +_STLP_TEMPLATE_NULL struct __type_traits< const Type > : __type_traits_aux<__true_type> {}; \ +_STLP_TEMPLATE_NULL struct __type_traits< volatile Type > : __type_traits_aux<__true_type> {}; \ +_STLP_TEMPLATE_NULL struct __type_traits< const volatile Type > : __type_traits_aux<__true_type> {} +# else +# define _STLP_DEFINE_TYPE_TRAITS_FOR(Type) \ +_STLP_TEMPLATE_NULL struct __type_traits< Type > : __type_traits_aux<__true_type> {}; +# endif + +# ifndef _STLP_NO_BOOL +_STLP_DEFINE_TYPE_TRAITS_FOR(bool); +# endif /* _STLP_NO_BOOL */ +_STLP_DEFINE_TYPE_TRAITS_FOR(char); +# ifndef _STLP_NO_SIGNED_BUILTINS +_STLP_DEFINE_TYPE_TRAITS_FOR(signed char); +# endif +_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned char); +# if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT) +_STLP_DEFINE_TYPE_TRAITS_FOR(wchar_t); +# endif /* _STLP_HAS_WCHAR_T */ + +_STLP_DEFINE_TYPE_TRAITS_FOR(short); +_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned short); +_STLP_DEFINE_TYPE_TRAITS_FOR(int); +_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned int); +_STLP_DEFINE_TYPE_TRAITS_FOR(long); +_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned long); + +# ifdef _STLP_LONG_LONG +_STLP_DEFINE_TYPE_TRAITS_FOR(_STLP_LONG_LONG); +_STLP_DEFINE_TYPE_TRAITS_FOR(unsigned _STLP_LONG_LONG); +# endif /* _STLP_LONG_LONG */ + +_STLP_DEFINE_TYPE_TRAITS_FOR(float); +_STLP_DEFINE_TYPE_TRAITS_FOR(double); + +# if !defined ( _STLP_NO_LONG_DOUBLE ) +_STLP_DEFINE_TYPE_TRAITS_FOR(long double); +# endif + +# if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct _IsCVConvertibleIf +{ typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; }; + +template +struct _IsCVConvertibleIf<__false_type, _Src, _Dst> +{ typedef __false_type _Ret; }; +# else +# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) +template +struct _IsCVConvertibleIfAux { + template + struct _In + { typedef typename _IsCVConvertible<_Src, _Dst>::_Ret _Ret; }; +}; + +_STLP_TEMPLATE_NULL +struct _IsCVConvertibleIfAux<__false_type> { + template + struct _In + { typedef __false_type _Ret; }; +}; + +template +struct _IsCVConvertibleIf { + typedef typename _IsCVConvertibleIfAux<_ArePtrs>::_STLP_TEMPLATE _In<_Src, _Dst>::_Ret _Ret; +}; +# else +/* default behavior: we prefer to miss an optimization rather than taking the risk of + * a compilation error if playing with types with exotic memory alignment. + */ +template +struct _IsCVConvertibleIf +{ typedef __false_type _Ret; }; +# endif +# endif + +template +struct _TrivialNativeTypeCopy { + typedef typename _IsPtr<_Src>::_Ret _Ptr1; + typedef typename _IsPtr<_Dst>::_Ret _Ptr2; + typedef typename _Land2<_Ptr1, _Ptr2>::_Ret _BothPtrs; + typedef typename _IsCVConvertibleIf<_BothPtrs, _Src, _Dst>::_Ret _Convertible; + typedef typename _Land2<_BothPtrs, _Convertible>::_Ret _Trivial1; + + typedef typename __bool2type<(sizeof(_Src) == sizeof(_Dst))>::_Ret _SameSize; + +#if !defined (__BORLANDC__) || (__BORLANDC__ < 0x564) + typedef typename _IsIntegral<_Src>::_Ret _Int1; +#else + typedef typename _UnQual<_Src>::_Type _UnQuSrc; + typedef typename _IsIntegral<_UnQuSrc>::_Ret _Int1; +#endif + typedef typename _IsIntegral<_Dst>::_Ret _Int2; + typedef typename _Land2<_Int1, _Int2>::_Ret _BothInts; + + typedef typename _IsRational<_Src>::_Ret _Rat1; + typedef typename _IsRational<_Dst>::_Ret _Rat2; + typedef typename _Land2<_Rat1, _Rat2>::_Ret _BothRats; + + typedef typename _Lor2<_BothInts, _BothRats>::_Ret _BothNatives; +#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x564) + typedef typename _Land2<_BothNatives, _SameSize>::_Ret _Trivial2; +#else + typedef typename _IsUnQual<_Dst>::_Ret _UnQualDst; + typedef typename _Land3<_BothNatives, _SameSize, _UnQualDst>::_Ret _Trivial2; +#endif + typedef typename _Lor2<_Trivial1, _Trivial2>::_Ret _Ret; +}; + +template +struct _TrivialCopy { + typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet; +# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) + typedef typename __type_traits<_Src>::has_trivial_assignment_operator _Tr1; +# else + typedef typename _UnConstPtr<_Src*>::_Type _UnConstSrc; + typedef typename __type_traits<_UnConstSrc>::has_trivial_assignment_operator _Tr1; +# endif + typedef typename _AreCopyable<_Src, _Dst>::_Ret _Tr2; + typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet; + typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +template +struct _TrivialUCopy { + typedef typename _TrivialNativeTypeCopy<_Src, _Dst>::_Ret _NativeRet; +# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) + typedef typename __type_traits<_Src>::has_trivial_copy_constructor _Tr1; +# else + typedef typename _UnConstPtr<_Src*>::_Type _UnConstSrc; + typedef typename __type_traits<_UnConstSrc>::has_trivial_copy_constructor _Tr1; +# endif + typedef typename _AreCopyable<_Src, _Dst>::_Ret _Tr2; + typedef typename _Land2<_Tr1, _Tr2>::_Ret _UserRet; + typedef typename _Lor2<_NativeRet, _UserRet>::_Ret _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +template +struct _DefaultZeroValue { + typedef typename _IsIntegral<_Tp>::_Ret _Tr1; + typedef typename _IsRational<_Tp>::_Ret _Tr2; + typedef typename _IsPtr<_Tp>::_Ret _Tr3; + typedef typename _Lor3<_Tr1, _Tr2, _Tr3>::_Ret _Ret; +}; + +template +struct _TrivialInit { +# if !defined (__BORLANDC__) || (__BORLANDC__ != 0x560) + typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Tr1; +# else + typedef typename _UnConstPtr<_Tp*>::_Type _Tp1; + typedef typename __type_traits<_Tp1>::has_trivial_copy_constructor _Tr1; +# endif + typedef typename _DefaultZeroValue<_Tp>::_Ret _Tr2; + typedef typename _Not<_Tr2>::_Ret _Tr3; + typedef typename _Land2<_Tr1, _Tr3>::_Ret _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +#endif /* !_STLP_USE_BOOST_SUPPORT */ + +template +struct _IsPtrType { + typedef typename _IsPtr<_Tp>::_Ret _Type; + static _Type _Ret() { return _Type(); } +}; + +template +struct _IsRefType { + typedef typename _IsRef<_Tp>::_Ret _Type; + static _Type _Ret() { return _Type();} +}; + +template +struct __call_traits { +#if defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) + typedef typename __select< ::boost::is_reference<_Tp>::value, + typename ::boost::add_const<_Tp>::type, + typename ::boost::add_reference< typename ::boost::add_const<_Tp>::type >::type>::_Ret const_param_type; + typedef typename __select< ::boost::is_reference<_Tp>::value, + typename ::boost::remove_const<_Tp>::type, + typename ::boost::add_reference<_Tp>::type>::_Ret param_type; +#else + typedef const _Tp& const_param_type; + typedef _Tp& param_type; +#endif +}; + +#if !defined (_STLP_USE_BOOST_SUPPORT) && !defined (_STLP_NO_EXTENSIONS) && defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) +template +struct __call_traits<_Tp&> { + typedef _Tp& param_type; + typedef const _Tp& const_param_type; +}; +template +struct __call_traits { + typedef _Tp& param_type; + typedef const _Tp& const_param_type; +}; +#endif + +template +struct _BothPtrType { + typedef typename _IsPtr<_Tp1>::_Ret _IsPtr1; + typedef typename _IsPtr<_Tp2>::_Ret _IsPtr2; + + typedef typename _Land2<_IsPtr1, _IsPtr2>::_Ret _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +template +struct _OKToSwap { + typedef typename _AreSameTypes<_Tp1, _Tp2>::_Ret _Same; + typedef typename _Land3<_Same, _IsRef1, _IsRef2>::_Ret _Type; + static _Type _Answer() { return _Type(); } +}; + +template +inline _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2> +_IsOKToSwap(_Tp1*, _Tp2*, const _IsRef1&, const _IsRef2&) +{ return _OKToSwap<_Tp1, _Tp2, _IsRef1, _IsRef2>(); } + +template +inline _TrivialCopy<_Src, _Dst> _UseTrivialCopy(_Src*, _Dst*) +{ return _TrivialCopy<_Src, _Dst>(); } + +template +inline _TrivialUCopy<_Src, _Dst> _UseTrivialUCopy(_Src*, _Dst*) +{ return _TrivialUCopy<_Src, _Dst>(); } + +#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) || defined (__BORLANDC__) || \ + defined (__DMC__) +struct _NegativeAnswer { + typedef __false_type _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +template +inline _NegativeAnswer _UseTrivialCopy(_Src*, const _Dst*) +{ return _NegativeAnswer(); } + +template +inline _NegativeAnswer _UseTrivialCopy(_Src*, volatile _Dst*) +{ return _NegativeAnswer(); } + +template +inline _NegativeAnswer _UseTrivialCopy(_Src*, const volatile _Dst*) +{ return _NegativeAnswer(); } + +template +inline _NegativeAnswer _UseTrivialUCopy(_Src*, const _Dst*) +{ return _NegativeAnswer(); } + +template +inline _NegativeAnswer _UseTrivialUCopy(_Src*, volatile _Dst*) +{ return _NegativeAnswer(); } + +template +inline _NegativeAnswer _UseTrivialUCopy(_Src*, const volatile _Dst*) +{ return _NegativeAnswer(); } +#endif + +template +inline _TrivialInit<_Tp> _UseTrivialInit(_Tp*) +{ return _TrivialInit<_Tp>(); } + +template +struct _IsPOD { + typedef typename __type_traits<_Tp>::is_POD_type _Type; + static _Type _Answer() { return _Type(); } +}; + +template +inline _IsPOD<_Tp> _Is_POD(_Tp*) +{ return _IsPOD<_Tp>(); } + +template +struct _DefaultZeroValueQuestion { + typedef typename _DefaultZeroValue<_Tp>::_Ret _Ret; + static _Ret _Answer() { return _Ret(); } +}; + +template +inline _DefaultZeroValueQuestion<_Tp> _HasDefaultZeroValue(_Tp*) +{ return _DefaultZeroValueQuestion<_Tp>(); } + +/* + * Base class used: + * - to simulate partial template specialization + * - to simulate partial function ordering + * - to recognize STLport class from user specialized one + */ +template +struct __stlport_class +{ typedef _Tp _Type; }; + +template +struct _IsSTLportClass { + typedef typename _IsConvertible<_Tp, __stlport_class<_Tp> >::_Ret _Ret; +#if defined (__BORLANDC__) + enum { _Is = _IsConvertible<_Tp, __stlport_class<_Tp> >::value }; +#endif +}; + +#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) +template +struct _SwapImplemented { + typedef typename _IsSTLportClass<_Tp>::_Ret _Ret; +# if defined (__BORLANDC__) + enum { _Is = _IsSTLportClass<_Tp>::_Is }; +# endif +}; +#endif + +template +class _TpWithState : private _Tp { + _TpWithState(); + int _state; +}; + +/* This is an internal helper struct used to guess if we are working + * on a stateless class. It can only be instanciated with a class type. */ +template +struct _IsStateless { + enum { _Is = sizeof(_TpWithState<_Tp>) == sizeof(int) }; + typedef typename __bool2type<_Is>::_Ret _Ret; +}; + +_STLP_END_NAMESPACE + +#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION +# if defined (__BORLANDC__) || \ + defined (__SUNPRO_CC) || \ + (defined (__MWERKS__) && (__MWERKS__ <= 0x2303)) || \ + (defined (__sgi) && defined (_COMPILER_VERSION)) || \ + defined (__DMC__) +# define _STLP_IS_POD_ITER(_It, _Tp) __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type() +# else +# define _STLP_IS_POD_ITER(_It, _Tp) typename __type_traits< typename iterator_traits< _Tp >::value_type >::is_POD_type() +# endif +#else +# define _STLP_IS_POD_ITER(_It, _Tp) _Is_POD( _STLP_VALUE_TYPE( _It, _Tp ) )._Answer() +#endif + +#endif /* _STLP_TYPE_TRAITS_H */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/string b/sdk/tlibstdcxx/stlport/string new file mode 100644 index 0000000000..74d458951e --- /dev/null +++ b/sdk/tlibstdcxx/stlport/string @@ -0,0 +1,59 @@ +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_STRING + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x68 +# include +# define _STLP_STRING +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x68) +# ifndef _STLP_INTERNAL_STRING_H +# include +# endif + +# ifndef _STLP_STRING_HASH_H +# include +# endif + +# if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_STRING_IO_H) +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x68) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(string) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x68) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_STRING */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/string.h b/sdk/tlibstdcxx/stlport/string.h new file mode 100644 index 0000000000..52013cfb40 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/string.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* Workaround for a "misbehaviour" when compiling resource scripts using + * eMbedded Visual C++. The standard .rc file includes windows header files, + * which in turn include string.h, which results in warnings and errors + */ +#ifndef _STLP_STRING_H + +#if !defined (RC_INVOKED) + +# ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x269 +# include +# elif (_STLP_OUTERMOST_HEADER_ID == 0x269) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_STRING_H +# endif + +# if defined(_STLP_WCE_EVC3) +struct _exception; +# endif +# if (_STLP_OUTERMOST_HEADER_ID != 0x269) || defined (_STLP_DONT_POP_HEADER_ID) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(string.h) +# endif +# else +# if defined (__BORLANDC__) && !defined (__linux__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next <_str.h> +# else +# include _STLP_NATIVE_CPP_C_HEADER(_str.h) +# endif +# else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(string.h) +# endif +# endif +# endif + +# if (_STLP_OUTERMOST_HEADER_ID == 0x269) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +# endif +#endif /* RC_INVOKED */ +#endif /* _STLP_STRING_H */ diff --git a/sdk/tlibstdcxx/stlport/time.h b/sdk/tlibstdcxx/stlport/time.h new file mode 100644 index 0000000000..e73aa85660 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/time.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x272 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x272) && ! defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#ifdef _STLP_WCE_EVC3 +/* only show message when directly including this file in a non-library build */ +# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x272) +# pragma message("eMbedded Visual C++ 3 doesn't have a time.h header; STLport won't include native time.h here") +# endif +#else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(time.h) +# endif +#endif + + +#if (_STLP_OUTERMOST_HEADER_ID == 0x272) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif diff --git a/sdk/tlibstdcxx/stlport/type_traits b/sdk/tlibstdcxx/stlport/type_traits new file mode 100644 index 0000000000..ae1ea8f186 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/type_traits @@ -0,0 +1,798 @@ +// -*- C++ -*- Time-stamp: <08/07/20 19:10:15 ptr> + +/* + * Copyright (c) 2007, 2008 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License version 3.0 + * + * Derived from original of 'complement' project + * [http://complement.sourceforge.net] + * to make it close to JTC1/SC22/WG21 C++ 0x working draft + * [http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2008/n2521.pdf] + */ + +#ifndef __STLP_TYPE_TRAITS +#define __STLP_TYPE_TRAITS + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x3 +# include +#endif + +// libstdc++ v3, timestamp 20050519 (3.4.4) has __type_traits, +// libstdc++ v3, timestamp 20060306 (3.4.6) has __type_traits, +// while libstdc++ v3, 20050921 (4.0.2) not; use libstdc++ instead +// # if defined(STLPORT) || (defined(__GNUC__) && (__GNUC__ < 4)) /* !defined(__GLIBCXX__) || (defined(__GNUC__) && (__GNUC__ < 4)) */ + +_STLP_BEGIN_NAMESPACE + +_STLP_BEGIN_TR1_NAMESPACE + +namespace detail { + +struct __select_types +{ + typedef char __t1; + struct __t2 + { + char __two[2]; + }; +}; + +template +struct __instance : + public __select_types +{ + private: + template + static __t1 __test(_Up(*)[1]); + + template + static __t2 __test(...); + + public: +#ifdef _STLP_STATIC_CONST_INIT_BUG + static const bool __value; +#else + static const bool __value = sizeof(__test<_Tp>(0)) == sizeof(__select_types::__t1); +#endif + +}; + +#ifdef _STLP_STATIC_CONST_INIT_BUG +template +const bool __instance<_Tp>::__value = sizeof(__instance<_Tp>::__test<_Tp>(0)) == sizeof(__select_types::__t1); +#endif + +template +struct __uoc_aux : // union or class + public __select_types +{ + private: + template + static __t1 __test( int _Up::* ); + + template + static __t2 __test(...); + + public: +#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION + static const bool __value; +#else + static const bool __value = sizeof(__test(0)) == sizeof(__select_types::__t1); +#endif +}; + +#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION +template +const bool __uoc_aux::__value = sizeof(__uoc_aux::__test(0)) == sizeof(__select_types::__t1); +#endif + +template +class __empty +{ }; + +template +class __inheritance_aux +{}; + +template +class __inheritance_aux : + public T +{ + public: + virtual ~__inheritance_aux() + { } +}; + +#if 0 +template +struct __virtual_aux +{ + public: +#ifdef _STLP_STATIC_CONST_INIT_BUG + static const bool __value; +#else + static const bool __value = B ? (sizeof(__inheritance_aux) == sizeof(T)) : false; +#endif +}; + +#ifdef _STLP_STATIC_CONST_INIT_BUG +template +const bool __virtual_aux::__value = B ? (sizeof(__inheritance_aux) == sizeof(T)) : false; +#endif +#endif + +} // namespace detail + +template +struct integral_constant +{ + static const _Tp value = __v; + // enum { value = __v }; ? + + typedef _Tp value_type; + typedef integral_constant<_Tp, __v> type; +}; + +typedef integral_constant true_type; +typedef integral_constant false_type; + +namespace detail { + +template +struct __is_union_or_class : + public integral_constant::__value> +{ }; + +#if 0 +template +struct __is_vtbl : // has virtual table? + public integral_constant::value >::__value> +{ }; +#endif + +template +struct __is_vtbl : // has virtual table? + public integral_constant::value ? (sizeof(__inheritance_aux<_Tp,__is_union_or_class<_Tp>::value>) == sizeof(_Tp)) : false > +{ }; + +} // namespace detail + +#define __SPEC_(C,T,B) \ +template <> \ +struct C : \ + public integral_constant \ +{ } + +#define __CV_SPEC(C,T,B) \ +__SPEC_(C,T,B); \ +__SPEC_(C,const T,B); \ +__SPEC_(C,volatile T,B); \ +__SPEC_(C,const volatile T,B) + +#define __SPEC_1(C,T,B) \ +template \ +struct C : \ + public integral_constant \ +{ } + +#define __CV_SPEC_1(C,T,B) \ +__SPEC_1(C,T,B); \ +__SPEC_1(C,T const,B); \ +__SPEC_1(C,T volatile,B); \ +__SPEC_1(C,T const volatile,B) + +#define __SPEC_2(C,T,B) \ +template \ +struct C : \ + public integral_constant \ +{ } + +#define __CV_SPEC_2(C,T,B) \ +__SPEC_2(C,T,B); \ +__SPEC_2(C,T const,B); \ +__SPEC_2(C,T volatile,B); \ +__SPEC_2(C,T const volatile,B) + +// [4.5.1] primary type categories: + +template +struct is_void : + public false_type +{ }; + +template <> +struct is_void : + public true_type +{ }; + +template +struct is_integral : + public false_type +{ }; + +__CV_SPEC(is_integral,bool,true); +__CV_SPEC(is_integral,char,true); +__CV_SPEC(is_integral,signed char,true); +__CV_SPEC(is_integral,unsigned char,true); +__CV_SPEC(is_integral,wchar_t,true); +__CV_SPEC(is_integral,short,true); +__CV_SPEC(is_integral,unsigned short,true); +__CV_SPEC(is_integral,int,true); +__CV_SPEC(is_integral,unsigned int,true); +__CV_SPEC(is_integral,long,true); +__CV_SPEC(is_integral,unsigned long,true); +__CV_SPEC(is_integral,long long,true); +__CV_SPEC(is_integral,unsigned long long,true); + +template +struct is_floating_point : + public false_type +{ }; + +__CV_SPEC(is_floating_point,float,true); +__CV_SPEC(is_floating_point,double,true); +__CV_SPEC(is_floating_point,long double,true); + +template +struct is_array : + public false_type +{ }; + +template +struct is_array<_Tp[_Sz]> : + public true_type +{ }; + +template +struct is_array<_Tp[]> : + public true_type +{ }; + +template +struct is_pointer : + public false_type +{ }; + +__CV_SPEC_1(is_pointer,_Tp *,true); + +template +struct is_lvalue_reference : + public false_type +{ }; + +template +struct is_lvalue_reference<_Tp&> : + public true_type +{ }; + +template +struct is_rvalue_reference : + public false_type +{ }; + +// template +// struct is_rvalue_reference<_Tp&&> : +// public true_type +// { }; + +template +struct is_reference : + public false_type +{ }; + +template +struct is_reference<_Tp&> : + public true_type +{ }; + +template +struct is_function : + public integral_constant::__value + || detail::__is_union_or_class<_Tp>::value + || is_reference<_Tp>::value + || is_void<_Tp>::value)> +{ }; + +template +struct is_member_object_pointer : + public false_type +{ }; + +// _SPEC_FULL2(is_member_object_pointer, _Tp1 _Tp2::*,!is_function<_Tp1>::value); + +template +struct is_member_object_pointer<_Tp1 _Tp2::*> : + public integral_constant::value> +{ }; + +template +struct is_member_object_pointer<_Tp1 _Tp2::* const> : + public integral_constant::value> +{ }; + +template +struct is_member_object_pointer<_Tp1 _Tp2::* volatile> : + public integral_constant::value> +{ }; + +template +struct is_member_object_pointer<_Tp1 _Tp2::* const volatile> : + public integral_constant::value> +{ }; + +template +struct is_member_function_pointer : + public false_type +{ }; + +// _SPEC_FULL2(is_member_function_pointer,_Tp1 _Tp2::*,is_function<_Tp1>::value); + +template +struct is_member_function_pointer<_Tp1 _Tp2::*> : + public integral_constant::value> +{ }; + +template +struct is_member_function_pointer<_Tp1 _Tp2::* const> : + public integral_constant::value> +{ }; + +template +struct is_member_function_pointer<_Tp1 _Tp2::* volatile> : + public integral_constant::value> +{ }; + +template +struct is_member_function_pointer<_Tp1 _Tp2::* const volatile> : + public integral_constant::value> +{ }; + +template +struct is_member_pointer : + public integral_constant::value || is_member_function_pointer<_Tp>::value)> +{ }; + +// 4.5.2 composite type categories + +template +struct is_arithmetic : + public integral_constant::value || is_floating_point<_Tp>::value)> +{ }; + +template +struct is_fundamental : + public integral_constant::value || is_void<_Tp>::value)> +{ }; + +// [4.5.1] primary type categories (continued): + +template +struct is_enum : + public integral_constant::value + || is_array<_Tp>::value + || is_pointer<_Tp>::value + || is_reference<_Tp>::value + || is_member_pointer<_Tp>::value + || is_function<_Tp>::value + || detail::__is_union_or_class<_Tp>::value) > +{ }; + +template +struct is_union +{ }; + +template +struct is_class +{ }; + +// is_function (above) + +// 4.5.2 composite type categories (continued) + +// is_arithmetic (above) +// is_fundamental (above) + +template +struct is_object : + public integral_constant::value || + is_array<_Tp>::value || + is_pointer<_Tp>::value || + is_member_pointer<_Tp>::value || + detail::__is_union_or_class<_Tp>::value)> +{ }; + +template +struct is_scalar : + public integral_constant::value + || is_enum<_Tp>::value + || is_pointer<_Tp>::value + || is_member_pointer<_Tp>::value)> +{ }; + +template +struct is_compound : + public integral_constant::value> +{ }; + +// is_member_pointer + +// 4.5.3 type properties: + +template +struct is_const : + public false_type +{ }; + +template +struct is_const<_Tp const> : + public true_type +{ }; + +template +struct is_volatile : + public false_type +{ }; + +template +struct is_volatile<_Tp volatile> : + public true_type +{ }; + + +// 4.7.3 array modifications: + +template +struct remove_extent +{ + typedef _Tp type; +}; + +template +struct remove_extent<_Tp[_Sz]> +{ + typedef _Tp type; +}; + +template +struct remove_extent<_Tp[]> +{ + typedef _Tp type; +}; + +template +struct remove_all_extents +{ + typedef _Tp type; +}; + +template +struct remove_all_extents<_Tp[_Size]> +{ + typedef typename remove_all_extents<_Tp>::type type; +}; + +template +struct remove_all_extents<_Tp[]> +{ + typedef typename remove_all_extents<_Tp>::type type; +}; + +// 4.5.3 type properties (continued): + +template +struct is_trivial : + public integral_constant::value + || is_scalar::type>::value)> +{ }; + +template +struct is_standard_layout : + public integral_constant::value + || is_scalar::type>::value)> +{ }; + +template +struct is_pod : + public integral_constant::value + || is_scalar::type>::value)> +{ }; + +template +struct is_empty + : public integral_constant::value + && (sizeof(detail::__empty<_Tp>) == sizeof(_Tp)))> +{ }; + +// is_polimorphic +// is_abstract + +template +struct has_trivial_constructor : + public integral_constant::value> +{ }; + +template +struct has_trivial_copy : + public integral_constant::value> +{ }; + +template +struct has_trivial_assign : + public integral_constant::value> +{ }; + +template +struct has_trivial_destructor : + public integral_constant::value> +{ }; + +template +struct has_nothrow_constructor : + public integral_constant::value> +{ }; + +template +struct has_nothrow_copy : + public integral_constant::value> +{ }; + +template +struct has_nothrow_assign : + public integral_constant::value> +{ }; + +template +struct has_virtual_destructor : + public false_type +{ }; + +template +struct is_signed : + public false_type +{ }; + +__CV_SPEC(is_signed,signed char,true); +__CV_SPEC(is_signed,short,true); +__CV_SPEC(is_signed,int,true); +__CV_SPEC(is_signed,long,true); +__CV_SPEC(is_signed,long long,true); + +template +struct is_unsigned : + public false_type +{ }; + +__CV_SPEC(is_unsigned,unsigned char,true); +__CV_SPEC(is_unsigned,unsigned short,true); +__CV_SPEC(is_unsigned,unsigned int,true); +__CV_SPEC(is_unsigned,unsigned long,true); +__CV_SPEC(is_unsigned,unsigned long long,true); + +// alignment_of +// rank +// extent + +// 4.6 type relations: + +template +struct is_same : + public false_type +{ }; + +template +struct is_same<_Tp, _Tp> : + public true_type +{ }; + +// is_base_of +// is_convertible + +// 4.7.1 const-volatile modifications + +template +struct remove_const +{ + typedef _Tp type; +}; + +template +struct remove_const<_Tp const> +{ + typedef _Tp type; +}; + +template +struct remove_volatile +{ + typedef _Tp type; +}; + +template +struct remove_volatile<_Tp volatile> +{ + typedef _Tp type; +}; + +template +struct remove_cv +{ + typedef typename remove_const::type>::type type; +}; + +template +struct add_const +{ + typedef _Tp const type; +}; + +template +struct add_volatile +{ + typedef _Tp volatile type; +}; + +template +struct add_cv +{ + typedef typename add_const::type>::type type; +}; + +// 4.7.2 reference modifications: + +template +struct remove_reference +{ + typedef _Tp type; +}; + +template +struct remove_reference<_Tp&> +{ + typedef _Tp type; +}; + +template +struct add_reference +{ + typedef _Tp& type; +}; + +template +struct add_reference<_Tp&> +{ + typedef _Tp& type; +}; + +// 4.7.3 array modifications (see above) + +// 4.7.4 pointer modifications: + +template +struct remove_pointer +{ + typedef _Tp type; +}; + +template +struct remove_pointer<_Tp *> +{ + typedef _Tp type; +}; + +template +struct remove_pointer<_Tp * const> +{ + typedef _Tp type; +}; + +template +struct remove_pointer<_Tp * volatile> +{ + typedef _Tp type; +}; + +template +struct remove_pointer<_Tp * const volatile> +{ + typedef _Tp type; +}; + +template +struct add_pointer +{ + typedef typename remove_reference<_Tp>::type * type; +}; + +// 20.5.7 other transformations: + +// template <_STLP_STD::size_t Len, _STLP_STD::size_t Align> struct aligned_storage; +// template <_STLP_STD::size_t Len, class... Types> struct aligned_union; + +namespace detail { + +template +struct _decay_aux2 +{ + typedef typename remove_cv<_U>::type type; +}; + +template +struct _decay_aux2 +{ + typedef typename add_pointer<_U>::type type; +}; + +template +struct _decay_aux1 +{ + typedef typename _decay_aux2::value,_U>::type type; +}; + +template +struct _decay_aux1 +{ + typedef typename remove_extent<_U>::type* type; +}; + +} // namespace detail + +template +class decay +{ + private: + typedef typename remove_reference<_Tp>::type _U; + + public: + typedef typename detail::_decay_aux1::value,_U>::type type; +}; + +template +struct enable_if +{ +}; + +template +struct enable_if +{ + typedef _Tp type; +}; + +template +struct conditional +{ + typedef _Tp2 type; +}; + +template +struct conditional +{ + typedef _Tp1 type; +}; + +// template struct common_type; + +#undef __CV_SPEC +#undef __SPEC_ +#undef __CV_SPEC_1 +#undef __SPEC_1 +#undef __CV_SPEC_2 +#undef __SPEC_2 + +_STLP_END_NAMESPACE // tr1 + +_STLP_END_NAMESPACE + +// # else // __GLIBCXX__ && (__GNUC__ >= 4) && !STLPORT +// # include +// # endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x3) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif // __STLP_TYPE_TRAITS + diff --git a/sdk/tlibstdcxx/stlport/typeinfo b/sdk/tlibstdcxx/stlport/typeinfo new file mode 100644 index 0000000000..269123fce3 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/typeinfo @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_TYPEINFO + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x473 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x473) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_TYPEINFO +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x473) && !defined (_STLP_DONT_POP_HEADER_ID) +# ifndef _STLP_INTERNAL_TYPEINFO +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x473) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x473) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/typeinfo.h b/sdk/tlibstdcxx/stlport/typeinfo.h new file mode 100644 index 0000000000..3bc0f9be98 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/typeinfo.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +// DMC has hardcoded inclusion of typeinfo.h at the begining of any translation unit. +// So inclusion of this header will directly reference the native header. This is not +// a problem as typeinfo.h is neither a C nor C++ Standard header, this header should +// never be used in user code. +#if defined (__DMC__) +// We define _STLP_OUTERMOST_HEADER_ID to signal to other STLport headers that inclusion +// is done from native typeinfo.h (see exception header). +# define _STLP_OUTERMOST_HEADER_ID 0x874 +# include <../include/typeinfo.h> +# undef _STLP_OUTERMOST_HEADER_ID +#else +# ifndef _STLP_OLDSTD_typeinfo +# define _STLP_OLDSTD_typeinfo + +# ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x874 +# include +# endif + +# ifndef _STLP_NO_TYPEINFO + +# if defined (__GNUC__) +# undef _STLP_OLDSTD_typeinfo +# include +# define _STLP_OLDSTD_typeinfo +# else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# elif !defined (__BORLANDC__) || (__BORLANDC__ < 0x580) +# include _STLP_NATIVE_CPP_RUNTIME_HEADER(typeinfo.h) +# else +# include _STLP_NATIVE_CPP_C_HEADER(typeinfo.h) +# endif +# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x580) || \ + defined (__DMC__) +using std::type_info; +using std::bad_typeid; +using std::bad_cast; +# endif +# endif + +// if already included, do not import anything + +# if defined (_STLP_USE_OWN_NAMESPACE) && !(defined (_STLP_TYPEINFO) && !defined (_STLP_NO_NEW_NEW_HEADER)) + +_STLP_BEGIN_NAMESPACE + +using _STLP_VENDOR_EXCEPT_STD :: type_info; +# if !(defined(__MRC__) || (defined(__SC__) && !defined(__DMC__))) +using _STLP_VENDOR_EXCEPT_STD :: bad_typeid; +# endif + +using _STLP_VENDOR_EXCEPT_STD :: bad_cast; + +_STLP_END_NAMESPACE + +# endif /* _STLP_OWN_NAMESPACE */ + +# endif /* _STLP_NO_TYPEINFO */ + +# if (_STLP_OUTERMOST_HEADER_ID == 0x874) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# endif + +# endif /* _STLP_OLDSTD_typeinfo */ + +#endif /* __DMC__ */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/unordered_map b/sdk/tlibstdcxx/stlport/unordered_map new file mode 100644 index 0000000000..09fa0d2493 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/unordered_map @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2004,2005 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_UNORDERED_MAP +#define _STLP_UNORDERED_MAP + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x4030 +# include +#endif + +#ifdef _STLP_PRAGMA_ONCE +# pragma once +#endif + +#include + +#if (_STLP_OUTERMOST_HEADER_ID == 0x4030) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_UNORDERED_MAP */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/unordered_set b/sdk/tlibstdcxx/stlport/unordered_set new file mode 100644 index 0000000000..14de437461 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/unordered_set @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2004,2005 + * Francois Dumont + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_UNORDERED_SET +#define _STLP_UNORDERED_SET + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x4031 +# include +#endif + +#ifdef _STLP_PRAGMA_ONCE +# pragma once +#endif + +#include + +#if (_STLP_OUTERMOST_HEADER_ID == 0x4031) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_UNORDERED_SET */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/using/cstring b/sdk/tlibstdcxx/stlport/using/cstring new file mode 100644 index 0000000000..bf6f024cfd --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/cstring @@ -0,0 +1,73 @@ +using _STLP_VENDOR_CSTD::size_t; + +#if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) +# if defined (__MSL__) && __MC68K__ && !_No_BlockMove && __dest_os == __mac_os +# undef memcpy +# undef memmove +inline void* memcpy(void* dst, const void* src, size_t len) +{ return _STLP_VENDOR_CSTD::__memcpy(dst, src, len); } +inline void* memmove(void* dst, const void* src, size_t len) +{ return _STLP_VENDOR_CSTD::__memmove(dst, src, len); } +# else +using _STLP_VENDOR_CSTD::memmove; +using _STLP_VENDOR_CSTD::memcpy; +# endif + +# if !defined (_STLP_WCE) +// these functions just don't exist on Windows CE +using _STLP_VENDOR_CSTD::strcoll; +using _STLP_VENDOR_CSTD::strerror; +using _STLP_VENDOR_CSTD::strxfrm; +# endif + +# if defined (__BORLANDC__) +extern "C++" { +# endif +using _STLP_VENDOR_CSTD::memchr; +using _STLP_VENDOR_CSTD::strchr; +using _STLP_VENDOR_CSTD::strpbrk; +using _STLP_VENDOR_CSTD::strrchr; +using _STLP_VENDOR_CSTD::strstr; +# if defined (__BORLANDC__) +} +# endif + +inline char* strstr(char* __s1, const char* __s2) +{ + const char* s = __s1; + const char* p = _STLP_VENDOR_CSTD::strstr(s, __s2); + if (!p) return NULL; + return &__s1[p - s]; +} + +using _STLP_VENDOR_CSTD::memcmp; +using _STLP_VENDOR_CSTD::memset; + +#if !defined (_STLP_SGX_CONFIG) +using _STLP_VENDOR_CSTD::strcat; +#endif + +# if !defined (strcmp) || !defined (__BORLANDC__) +using _STLP_VENDOR_CSTD::strcmp; +# else +using ::strcmp; +# endif + +#if !defined (_STLP_SGX_CONFIG) +# if !defined (strcpy) || !defined (__BORLANDC__) +using _STLP_VENDOR_CSTD::strcpy; +# else +using ::strcpy; +# endif +#endif /* !_STLP_SGX_CONFIG */ + +using _STLP_VENDOR_CSTD::strcspn; +using _STLP_VENDOR_CSTD::strlen; +using _STLP_VENDOR_CSTD::strncat; +using _STLP_VENDOR_CSTD::strncmp; + +using _STLP_VENDOR_CSTD::strncpy; +using _STLP_VENDOR_CSTD::strspn; + +using _STLP_VENDOR_CSTD::strtok; +#endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ diff --git a/sdk/tlibstdcxx/stlport/using/export b/sdk/tlibstdcxx/stlport/using/export new file mode 100644 index 0000000000..2d3afcd9f5 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/export @@ -0,0 +1,12 @@ +cstring +fstream +iomanip +ios +iosfwd +iostream +istream +locale +ostream +sstream +streambuf +strstream diff --git a/sdk/tlibstdcxx/stlport/using/fstream b/sdk/tlibstdcxx/stlport/using/fstream new file mode 100644 index 0000000000..e79e0480f6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/fstream @@ -0,0 +1,19 @@ +#ifdef _STLP_BROKEN_USING_DIRECTIVE +using namespace _STLP_STD; +#else +using _STLP_NEW_IO_NAMESPACE::basic_filebuf; +using _STLP_NEW_IO_NAMESPACE::filebuf; +using _STLP_NEW_IO_NAMESPACE::basic_ifstream; +using _STLP_NEW_IO_NAMESPACE::basic_ofstream; +using _STLP_NEW_IO_NAMESPACE::ifstream; +using _STLP_NEW_IO_NAMESPACE::ofstream; +using _STLP_NEW_IO_NAMESPACE::basic_fstream; +using _STLP_NEW_IO_NAMESPACE::fstream; + +# ifndef _STLP_NO_WIDE_STREAMS +using _STLP_NEW_IO_NAMESPACE::wofstream; +using _STLP_NEW_IO_NAMESPACE::wfilebuf; +using _STLP_NEW_IO_NAMESPACE::wifstream; +using _STLP_NEW_IO_NAMESPACE::wfstream; +# endif +#endif diff --git a/sdk/tlibstdcxx/stlport/using/h/fstream.h b/sdk/tlibstdcxx/stlport/using/h/fstream.h new file mode 100644 index 0000000000..6600568955 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/h/fstream.h @@ -0,0 +1,4 @@ +using ::streambuf; +using ::ifstream; +using ::ofstream; +using ::fstream; diff --git a/sdk/tlibstdcxx/stlport/using/h/iomanip.h b/sdk/tlibstdcxx/stlport/using/h/iomanip.h new file mode 100644 index 0000000000..99e48d9980 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/h/iomanip.h @@ -0,0 +1,6 @@ +using ::setiosflags; +using ::resetiosflags; +// using ::setbase; +using ::setfill; +using ::setprecision; +using ::setw; diff --git a/sdk/tlibstdcxx/stlport/using/h/iostream.h b/sdk/tlibstdcxx/stlport/using/h/iostream.h new file mode 100644 index 0000000000..e85f4e2c74 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/h/iostream.h @@ -0,0 +1,24 @@ +using _STLP_OLD_IO_NAMESPACE::istream; +using _STLP_OLD_IO_NAMESPACE::ostream; + +/* HP aCC include files re-define these when THREAD_SAFE */ +#if !defined(cin) +using _STLP_OLD_IO_NAMESPACE::cin; +#endif +#if !defined(cout) +using _STLP_OLD_IO_NAMESPACE::cout; +#endif +#if !defined(cerr) +using _STLP_OLD_IO_NAMESPACE::cerr; +#endif +#if !defined(clog) +using _STLP_OLD_IO_NAMESPACE::clog; +#endif + +using _STLP_OLD_IO_NAMESPACE::endl; +using _STLP_OLD_IO_NAMESPACE::ends; + +using _STLP_OLD_IO_NAMESPACE::ios; +using _STLP_OLD_IO_NAMESPACE::flush; + +// using _STLP_OLD_IO_NAMESPACE::ws; diff --git a/sdk/tlibstdcxx/stlport/using/h/ostream.h b/sdk/tlibstdcxx/stlport/using/h/ostream.h new file mode 100644 index 0000000000..6ba3f88397 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/h/ostream.h @@ -0,0 +1,6 @@ +using _STLP_OLD_IO_NAMESPACE::ostream; +using _STLP_OLD_IO_NAMESPACE::endl; +using _STLP_OLD_IO_NAMESPACE::ends; +using _STLP_OLD_IO_NAMESPACE::flush; + +// using _STLP_OLD_IO_NAMESPACE::ws; diff --git a/sdk/tlibstdcxx/stlport/using/h/streambuf.h b/sdk/tlibstdcxx/stlport/using/h/streambuf.h new file mode 100644 index 0000000000..459de3dba2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/h/streambuf.h @@ -0,0 +1 @@ +using ::streambuf; diff --git a/sdk/tlibstdcxx/stlport/using/h/strstream.h b/sdk/tlibstdcxx/stlport/using/h/strstream.h new file mode 100644 index 0000000000..a7d9f119cb --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/h/strstream.h @@ -0,0 +1,4 @@ +using _STLP_OLD_IO_NAMESPACE::strstreambuf; +using _STLP_OLD_IO_NAMESPACE::istrstream; +using _STLP_OLD_IO_NAMESPACE::ostrstream; +using _STLP_OLD_IO_NAMESPACE::strstream; diff --git a/sdk/tlibstdcxx/stlport/using/iomanip b/sdk/tlibstdcxx/stlport/using/iomanip new file mode 100644 index 0000000000..8a7c792f85 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/iomanip @@ -0,0 +1,6 @@ +using _STLP_NEW_IO_NAMESPACE::setiosflags; +using _STLP_NEW_IO_NAMESPACE::resetiosflags; +using _STLP_NEW_IO_NAMESPACE::setbase; +using _STLP_NEW_IO_NAMESPACE::setfill; +using _STLP_NEW_IO_NAMESPACE::setprecision; +using _STLP_NEW_IO_NAMESPACE::setw; diff --git a/sdk/tlibstdcxx/stlport/using/ios b/sdk/tlibstdcxx/stlport/using/ios new file mode 100644 index 0000000000..d89b495ad2 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/ios @@ -0,0 +1,41 @@ +# ifdef _STLP_BROKEN_USING_DIRECTIVE +using namespace _STLP_NEW_IO_NAMESPACE; +# else + +using _STLP_NEW_IO_NAMESPACE::ios; +using _STLP_NEW_IO_NAMESPACE::streamoff; +using _STLP_NEW_IO_NAMESPACE::streamsize; + +using _STLP_NEW_IO_NAMESPACE::ios_base; +using _STLP_NEW_IO_NAMESPACE::basic_ios; + +// _lib.std.ios.manip_, manipulators: +using _STLP_NEW_IO_NAMESPACE::boolalpha; +using _STLP_NEW_IO_NAMESPACE::noboolalpha; +using _STLP_NEW_IO_NAMESPACE::showbase; +using _STLP_NEW_IO_NAMESPACE::noshowbase; +using _STLP_NEW_IO_NAMESPACE::showpoint; +using _STLP_NEW_IO_NAMESPACE::noshowpoint; +using _STLP_NEW_IO_NAMESPACE::showpos; +using _STLP_NEW_IO_NAMESPACE::noshowpos; +using _STLP_NEW_IO_NAMESPACE::skipws; +using _STLP_NEW_IO_NAMESPACE::noskipws; +using _STLP_NEW_IO_NAMESPACE::uppercase; +using _STLP_NEW_IO_NAMESPACE::nouppercase; + +// _lib.adjustfield.manip_ adjustfield: +using _STLP_NEW_IO_NAMESPACE::internal; +using _STLP_NEW_IO_NAMESPACE::left; +using _STLP_NEW_IO_NAMESPACE::right; + +// _lib.basefield.manip_ basefield: +using _STLP_NEW_IO_NAMESPACE::dec; +using _STLP_NEW_IO_NAMESPACE::hex; +using _STLP_NEW_IO_NAMESPACE::oct; + +// _lib.floatfield.manip_ floatfield: +using _STLP_NEW_IO_NAMESPACE::fixed; +using _STLP_NEW_IO_NAMESPACE::scientific; + +# endif /* _STLP_BROKEN_USING_DIRECTIVE */ + diff --git a/sdk/tlibstdcxx/stlport/using/iosfwd b/sdk/tlibstdcxx/stlport/using/iosfwd new file mode 100644 index 0000000000..b564e819f9 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/iosfwd @@ -0,0 +1,54 @@ +# if defined (_STLP_USE_NEW_IOSTREAMS) +using _STLP_NEW_IO_NAMESPACE::char_traits; +using _STLP_NEW_IO_NAMESPACE::basic_ios; +using _STLP_NEW_IO_NAMESPACE::basic_streambuf; +using _STLP_NEW_IO_NAMESPACE::basic_istream; +using _STLP_NEW_IO_NAMESPACE::basic_ostream; +using _STLP_NEW_IO_NAMESPACE::basic_iostream; +using _STLP_NEW_IO_NAMESPACE::basic_stringbuf; +using _STLP_NEW_IO_NAMESPACE::basic_istringstream; +using _STLP_NEW_IO_NAMESPACE::basic_ostringstream; +using _STLP_NEW_IO_NAMESPACE::basic_stringstream; +using _STLP_NEW_IO_NAMESPACE::basic_filebuf; +using _STLP_NEW_IO_NAMESPACE::basic_ifstream; +using _STLP_NEW_IO_NAMESPACE::basic_ofstream; +using _STLP_NEW_IO_NAMESPACE::basic_fstream; +using _STLP_NEW_IO_NAMESPACE::fpos; +using _STLP_NEW_IO_NAMESPACE::istreambuf_iterator; +using _STLP_NEW_IO_NAMESPACE::ostreambuf_iterator; +using _STLP_NEW_IO_NAMESPACE::stringbuf; +using _STLP_NEW_IO_NAMESPACE::istringstream; +using _STLP_NEW_IO_NAMESPACE::ostringstream; +using _STLP_NEW_IO_NAMESPACE::stringstream; +# endif + +using _STLP_NEW_IO_NAMESPACE::ios; +using _STLP_NEW_IO_NAMESPACE::streambuf; +using _STLP_NEW_IO_NAMESPACE::istream; +using _STLP_NEW_IO_NAMESPACE::ostream; +using _STLP_NEW_IO_NAMESPACE::iostream; + +using _STLP_NEW_IO_NAMESPACE::filebuf; +using _STLP_NEW_IO_NAMESPACE::ifstream; +using _STLP_NEW_IO_NAMESPACE::ofstream; +using _STLP_NEW_IO_NAMESPACE::fstream; + +using _STLP_NEW_IO_NAMESPACE::streampos; +using _STLP_NEW_IO_NAMESPACE::streamoff; + +# if !defined (_STLP_NO_WIDE_STREAMS) +using _STLP_NEW_IO_NAMESPACE::wios; +using _STLP_NEW_IO_NAMESPACE::wstreambuf; +using _STLP_NEW_IO_NAMESPACE::wistream; +using _STLP_NEW_IO_NAMESPACE::wostream; +using _STLP_NEW_IO_NAMESPACE::wiostream; +using _STLP_NEW_IO_NAMESPACE::wstringbuf; +using _STLP_NEW_IO_NAMESPACE::wistringstream; +using _STLP_NEW_IO_NAMESPACE::wostringstream; +using _STLP_NEW_IO_NAMESPACE::wstringstream; +using _STLP_NEW_IO_NAMESPACE::wfilebuf; +using _STLP_NEW_IO_NAMESPACE::wifstream; +using _STLP_NEW_IO_NAMESPACE::wofstream; +using _STLP_NEW_IO_NAMESPACE::wfstream; +using _STLP_NEW_IO_NAMESPACE::wstreampos; +# endif diff --git a/sdk/tlibstdcxx/stlport/using/iostream b/sdk/tlibstdcxx/stlport/using/iostream new file mode 100644 index 0000000000..6169afb2f6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/iostream @@ -0,0 +1,14 @@ + +# include + +using _STLP_VENDOR_STD::cin; +using _STLP_VENDOR_STD::cout; +using _STLP_VENDOR_STD::cerr; +using _STLP_VENDOR_STD::clog; + +# if ! defined (_STLP_NO_WIDE_STREAMS) +using _STLP_VENDOR_STD::wcin; +using _STLP_VENDOR_STD::wcout; +using _STLP_VENDOR_STD::wcerr; +using _STLP_VENDOR_STD::wclog; +# endif diff --git a/sdk/tlibstdcxx/stlport/using/istream b/sdk/tlibstdcxx/stlport/using/istream new file mode 100644 index 0000000000..baf10d2857 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/istream @@ -0,0 +1,16 @@ +# include + +using _STLP_NEW_IO_NAMESPACE::basic_istream; +using _STLP_NEW_IO_NAMESPACE::basic_iostream; + +using _STLP_NEW_IO_NAMESPACE::istream; +using _STLP_NEW_IO_NAMESPACE::iostream; + +# if !defined (_STLP_NO_NATIVE_WIDE_STREAMS) +using _STLP_NEW_IO_NAMESPACE::wistream; +using _STLP_NEW_IO_NAMESPACE::wiostream; +# endif + +#if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1200)) +using _STLP_NEW_IO_NAMESPACE::ws; +#endif diff --git a/sdk/tlibstdcxx/stlport/using/locale b/sdk/tlibstdcxx/stlport/using/locale new file mode 100644 index 0000000000..aa99b5bee4 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/locale @@ -0,0 +1,65 @@ +#if !defined(_STLP_NO_IMPORT_LOCALE) + +// from +#if !defined (_STLP_NO_MBSTATE_T) +using _STLP_VENDOR_MB_NAMESPACE::mbstate_t; +#endif + +// _lib.locale_, locale: +using _STLP_NEW_IO_NAMESPACE::locale; +using _STLP_NEW_IO_NAMESPACE::use_facet; +using _STLP_NEW_IO_NAMESPACE::has_facet; + +// _lib.locale.convenience_, convenience interfaces: +using _STLP_NEW_IO_NAMESPACE::isspace; +using _STLP_NEW_IO_NAMESPACE::isprint; +using _STLP_NEW_IO_NAMESPACE::iscntrl; +using _STLP_NEW_IO_NAMESPACE::isupper; +using _STLP_NEW_IO_NAMESPACE::islower; +using _STLP_NEW_IO_NAMESPACE::isalpha; +using _STLP_NEW_IO_NAMESPACE::isdigit; +using _STLP_NEW_IO_NAMESPACE::ispunct; +using _STLP_NEW_IO_NAMESPACE::isxdigit; +using _STLP_NEW_IO_NAMESPACE::isalnum; +using _STLP_NEW_IO_NAMESPACE::isgraph; +using _STLP_NEW_IO_NAMESPACE::toupper; +using _STLP_NEW_IO_NAMESPACE::tolower; + +// _lib.category.ctype_ and _lib.facet.ctype.special_, ctype: +using _STLP_NEW_IO_NAMESPACE::ctype_base; +using _STLP_NEW_IO_NAMESPACE::ctype; +using _STLP_NEW_IO_NAMESPACE::ctype_byname; +using _STLP_NEW_IO_NAMESPACE::codecvt_base; +using _STLP_NEW_IO_NAMESPACE::codecvt; +using _STLP_NEW_IO_NAMESPACE::codecvt_byname; + +// _lib.category.numeric_ and _lib.facet.numpunct_, numeric: +using _STLP_NEW_IO_NAMESPACE::num_get; +using _STLP_NEW_IO_NAMESPACE::num_put; +using _STLP_NEW_IO_NAMESPACE::numpunct; +using _STLP_NEW_IO_NAMESPACE::numpunct_byname; + +// _lib.category.collate_, collation: +using _STLP_NEW_IO_NAMESPACE::collate; +using _STLP_NEW_IO_NAMESPACE::collate_byname; + +// _lib.category.time_, date and time: +using _STLP_NEW_IO_NAMESPACE::time_base; +using _STLP_NEW_IO_NAMESPACE::time_get; +using _STLP_NEW_IO_NAMESPACE::time_get_byname; +using _STLP_NEW_IO_NAMESPACE::time_put; +using _STLP_NEW_IO_NAMESPACE::time_put_byname; + +// _lib.category.monetary_, money: +using _STLP_NEW_IO_NAMESPACE::money_base; +using _STLP_NEW_IO_NAMESPACE::money_get; +using _STLP_NEW_IO_NAMESPACE::money_put; +using _STLP_NEW_IO_NAMESPACE::moneypunct; +using _STLP_NEW_IO_NAMESPACE::moneypunct_byname; + +#if !defined (_STLP_OWN_IOSTREAMS) && !defined (_STLP_NO_NATIVE_MESSAGE_FACET) +using _STLP_NEW_IO_NAMESPACE::messages_base; +using _STLP_NEW_IO_NAMESPACE::messages; +using _STLP_NEW_IO_NAMESPACE::messages_byname; +#endif // _MSL_NO_MESSAGE_FACET +#endif /* !defined(_STLP_NO_IMPORT_LOCALE) */ diff --git a/sdk/tlibstdcxx/stlport/using/ostream b/sdk/tlibstdcxx/stlport/using/ostream new file mode 100644 index 0000000000..162b32d8b1 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/ostream @@ -0,0 +1,10 @@ +using _STLP_NEW_IO_NAMESPACE::basic_ostream; +using _STLP_NEW_IO_NAMESPACE::ostream; + +# ifndef _STLP_NO_WIDE_STREAMS +using _STLP_NEW_IO_NAMESPACE::wostream; +# endif + +using _STLP_NEW_IO_NAMESPACE::endl; +using _STLP_NEW_IO_NAMESPACE::ends; +using _STLP_NEW_IO_NAMESPACE::flush; diff --git a/sdk/tlibstdcxx/stlport/using/sstream b/sdk/tlibstdcxx/stlport/using/sstream new file mode 100644 index 0000000000..925c37e2da --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/sstream @@ -0,0 +1,16 @@ +using _STLP_NEW_IO_NAMESPACE::basic_stringbuf; +using _STLP_NEW_IO_NAMESPACE::stringbuf; + +using _STLP_NEW_IO_NAMESPACE::basic_istringstream; +using _STLP_NEW_IO_NAMESPACE::basic_ostringstream; +using _STLP_NEW_IO_NAMESPACE::basic_stringstream; +using _STLP_NEW_IO_NAMESPACE::istringstream; +using _STLP_NEW_IO_NAMESPACE::ostringstream; +using _STLP_NEW_IO_NAMESPACE::stringstream; + +#ifndef _STLP_NO_WIDE_STREAMS +using _STLP_NEW_IO_NAMESPACE::wstringbuf; +using _STLP_NEW_IO_NAMESPACE::wistringstream; +using _STLP_NEW_IO_NAMESPACE::wostringstream; +using _STLP_NEW_IO_NAMESPACE::wstringstream; +#endif diff --git a/sdk/tlibstdcxx/stlport/using/streambuf b/sdk/tlibstdcxx/stlport/using/streambuf new file mode 100644 index 0000000000..308241dee8 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/streambuf @@ -0,0 +1,5 @@ +using _STLP_NEW_IO_NAMESPACE::basic_streambuf; +using _STLP_NEW_IO_NAMESPACE::streambuf; +#ifndef _STLP_NO_WIDE_STREAMS +using _STLP_NEW_IO_NAMESPACE::wstreambuf; +# endif diff --git a/sdk/tlibstdcxx/stlport/using/strstream b/sdk/tlibstdcxx/stlport/using/strstream new file mode 100644 index 0000000000..eb26ac1f55 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/using/strstream @@ -0,0 +1,4 @@ +using _STLP_NEW_IO_NAMESPACE::strstreambuf; +using _STLP_NEW_IO_NAMESPACE::istrstream; +using _STLP_NEW_IO_NAMESPACE::ostrstream; +using _STLP_NEW_IO_NAMESPACE::strstream; diff --git a/sdk/tlibstdcxx/stlport/utility b/sdk/tlibstdcxx/stlport/utility new file mode 100644 index 0000000000..4aaaa5935d --- /dev/null +++ b/sdk/tlibstdcxx/stlport/utility @@ -0,0 +1,60 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_UTILITY + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x75 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +# define _STLP_UTILITY +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x75) && !defined (_STLP_DONT_POP_HEADER_ID) +# ifndef _STLP_INTERNAL_PAIR_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x75) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(utility) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x75) +# if !defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + +#endif /* _STLP_UTILITY */ + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/valarray b/sdk/tlibstdcxx/stlport/valarray new file mode 100644 index 0000000000..0cb07767ca --- /dev/null +++ b/sdk/tlibstdcxx/stlport/valarray @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_VALARRAY + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x76 +# include +# define _STLP_VALARRAY +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x76) +# ifndef _STLP_VALARRAY_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x76) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(valarray) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x76) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_VALARRAY */ + + +// Local Variables: +// mode:C++ +// End: diff --git a/sdk/tlibstdcxx/stlport/vector b/sdk/tlibstdcxx/stlport/vector new file mode 100644 index 0000000000..92c41b744f --- /dev/null +++ b/sdk/tlibstdcxx/stlport/vector @@ -0,0 +1,59 @@ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#ifndef _STLP_VECTOR + +#ifndef _STLP_OUTERMOST_HEADER_ID +# define _STLP_OUTERMOST_HEADER_ID 0x77 +# include +# define _STLP_VECTOR +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x77) +# ifndef _STLP_INTERNAL_ALGOBASE_H +# include +# endif + +# ifndef _STLP_INTERNAL_VECTOR_H +# include +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID != 0x77) || defined (_STLP_IMPORT_VENDOR_STD) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_HEADER(vector) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x77) +# include +# undef _STLP_OUTERMOST_HEADER_ID +#endif + +#endif /* _STLP_VECTOR */ + +// Local Variables: +// mode:C++ +// End: + diff --git a/sdk/tlibstdcxx/stlport/wchar.h b/sdk/tlibstdcxx/stlport/wchar.h new file mode 100644 index 0000000000..6d66799698 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/wchar.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x278 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x278) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +#if !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) + +# if defined (__BORLANDC__) && !defined (__linux__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next <_str.h> +# else +# include _STLP_NATIVE_CPP_C_HEADER(_str.h) +# endif +# ifdef __cplusplus +using _STLP_VENDOR_CSTD::strlen; +using _STLP_VENDOR_CSTD::strspn; +# endif +# endif + +# if (((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))) && defined (__APPLE__)) || defined (__OpenBSD__) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(stddef.h) +# endif +# else +# if defined (_STLP_HAS_INCLUDE_NEXT) +# include_next +# else +# include _STLP_NATIVE_C_HEADER(wchar.h) +# endif +# endif +#endif /* !defined (_STLP_WCE_EVC3) && !defined (_STLP_NO_WCHAR_T) */ + +#ifndef _STLP_INTERNAL_MBSTATE_T +# include +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x278) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif + diff --git a/sdk/tlibstdcxx/stlport/wctype.h b/sdk/tlibstdcxx/stlport/wctype.h new file mode 100644 index 0000000000..c64ab9bea6 --- /dev/null +++ b/sdk/tlibstdcxx/stlport/wctype.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +#if !defined (_STLP_OUTERMOST_HEADER_ID) +# define _STLP_OUTERMOST_HEADER_ID 0x279 +# include +#elif (_STLP_OUTERMOST_HEADER_ID == 0x279) && !defined (_STLP_DONT_POP_HEADER_ID) +# define _STLP_DONT_POP_HEADER_ID +#endif + +/* evc3 doesn't have wctype.h */ +#if !defined(_STLP_WCE_EVC3) +# if defined (_STLP_HAS_INCLUDE_NEXT) +# if defined (__hpux) +# include_next +# include_next +# endif +# include_next +# else +# if defined (__hpux) +# include _STLP_NATIVE_C_HEADER(stdarg.h) +# include _STLP_NATIVE_C_HEADER(wchar.h) +# endif +# include _STLP_NATIVE_C_HEADER(wctype.h) +# endif +#endif + +#if (_STLP_OUTERMOST_HEADER_ID == 0x279) +# if ! defined (_STLP_DONT_POP_HEADER_ID) +# include +# undef _STLP_OUTERMOST_HEADER_ID +# else +# undef _STLP_DONT_POP_HEADER_ID +# endif +#endif diff --git a/sdk/tlibthread/Makefile b/sdk/tlibthread/Makefile new file mode 100755 index 0000000000..94200d8c6d --- /dev/null +++ b/sdk/tlibthread/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -Werror -fno-exceptions -fno-rtti + +CPPFLAGS := -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/tlibc \ + -I$(COMMON_DIR)/../sdk/trts \ + -I$(LINUX_PSW_DIR) + +OBJ := sethread_mutex.o \ + sethread_cond.o \ + sethread_utils.o + +LIBTLIBTHREAD := libtlibthread.a + +.PHONY:all +all: $(LIBTLIBTHREAD) + +$(LIBTLIBTHREAD): $(OBJ) + $(AR) rcs $@ $^ + +$(OBJ): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + +.PHONY: clean +clean: + @$(RM) *.o *.a + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/tlibthread/sethread_cond.cpp b/sdk/tlibthread/sethread_cond.cpp new file mode 100644 index 0000000000..7982d77c08 --- /dev/null +++ b/sdk/tlibthread/sethread_cond.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include + +#include "util.h" +#include "sethread_internal.h" + +int sgx_thread_cond_init(sgx_thread_cond_t *cond, const sgx_thread_condattr_t *unused) +{ + UNUSED(unused); + CHECK_PARAMETER(cond); + + cond->m_lock = SGX_SPINLOCK_INITIALIZER; + QUEUE_INIT(&cond->m_queue); + + return 0; +} + +int sgx_thread_cond_destroy(sgx_thread_cond_t *cond) +{ + CHECK_PARAMETER(cond); + + SPIN_LOCK(&cond->m_lock); + + if (QUEUE_FIRST(&cond->m_queue) != SGX_THREAD_T_NULL) { + SPIN_UNLOCK(&cond->m_lock); + return EBUSY; + } + + SPIN_UNLOCK(&cond->m_lock); + + return 0; +} + +int sgx_thread_cond_wait(sgx_thread_cond_t *cond, sgx_thread_mutex_t *mutex) +{ + CHECK_PARAMETER(cond); + CHECK_PARAMETER(mutex); + + sgx_thread_t self = (sgx_thread_t)get_thread_data(); + + SPIN_LOCK(&cond->m_lock); + QUEUE_INSERT_TAIL(&cond->m_queue, self); + + sgx_thread_t waiter = SGX_THREAD_T_NULL; + int ret = sgx_thread_mutex_unlock_lazy(mutex, &waiter); + if (ret != 0) { + SPIN_UNLOCK(&cond->m_lock); + return ret; + } + + while (1) { + sgx_thread_t tmp = SGX_THREAD_T_NULL; + + SPIN_UNLOCK(&cond->m_lock); + /* OPT: if there is a thread waiting on the mutex, wake it in a single OCALL. */ + if (waiter == SGX_THREAD_T_NULL) { + sgx_thread_wait_untrusted_event_ocall(&ret, TD2TCS(self)); + } else { + sgx_thread_setwait_untrusted_events_ocall(&ret, TD2TCS(waiter), TD2TCS(self)); + waiter = SGX_THREAD_T_NULL; + } + SPIN_LOCK(&cond->m_lock); + + QUEUE_FOREACH(tmp, &cond->m_queue) { + if (tmp == self) break; /* stop searching and re-wait outside */ + } + if (tmp == SGX_THREAD_T_NULL) break; /* current thread isn't in the queue */ + } + + SPIN_UNLOCK(&cond->m_lock); + sgx_thread_mutex_lock(mutex); + + return 0; +} + +int sgx_thread_cond_signal(sgx_thread_cond_t *cond) +{ + int err = 0; + sgx_thread_t waiter = SGX_THREAD_T_NULL; + + CHECK_PARAMETER(cond); + SPIN_LOCK(&cond->m_lock); + + if ((waiter = QUEUE_FIRST(&cond->m_queue)) == SGX_THREAD_T_NULL) { + SPIN_UNLOCK(&cond->m_lock); + return 0; + } + + QUEUE_REMOVE_HEAD(&cond->m_queue); + SPIN_UNLOCK(&cond->m_lock); + + sgx_thread_set_untrusted_event_ocall(&err, TD2TCS(waiter)); /* wake first pending thread */ + + return 0; +} + +int sgx_thread_cond_broadcast(sgx_thread_cond_t *cond) +{ + size_t n_waiter = 0; int err = 0; + sgx_thread_t waiter = SGX_THREAD_T_NULL; + const void **waiters = NULL; + + CHECK_PARAMETER(cond); + SPIN_LOCK(&cond->m_lock); + + QUEUE_COUNT_ALL(waiter, &cond->m_queue, n_waiter); + if (n_waiter == 0) { + SPIN_UNLOCK(&cond->m_lock); + return 0; + } + + waiters = (const void **)malloc(n_waiter * sizeof(const void *)); + if (waiters == NULL) { + SPIN_UNLOCK(&cond->m_lock); + return ENOMEM; + } + + const void **tmp = waiters; + while ((waiter = QUEUE_FIRST(&cond->m_queue)) != SGX_THREAD_T_NULL) { + QUEUE_REMOVE_HEAD(&cond->m_queue); /* remove the pending thread */ + *tmp++ = TD2TCS(waiter); + } + + SPIN_UNLOCK(&cond->m_lock); + + sgx_thread_set_multiple_untrusted_events_ocall(&err, waiters, n_waiter); /* wake all pending threads up */ + free(waiters); + return 0; +} diff --git a/sdk/tlibthread/sethread_internal.h b/sdk/tlibthread/sethread_internal.h new file mode 100644 index 0000000000..714269194b --- /dev/null +++ b/sdk/tlibthread/sethread_internal.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_trts.h" +#include "sgx_spinlock.h" +#include "sgx_thread.h" + +#include "internal/se_cdefs.h" +#include "internal/arch.h" +#include "internal/thread_data.h" +#include "trts_internal.h" + + +typedef struct _thread_data_t *pTD; + +/* Queue operations */ +#define QUEUE_FIRST(head) ((sgx_thread_t)((head)->m_first)) +#define QUEUE_NEXT(elm) ((sgx_thread_t)(((pTD)(elm))->m_next)) + +#define QUEUE_INIT(head) do { \ + (head)->m_first = \ + (head)->m_last = SGX_THREAD_T_NULL; \ +} while (0) + +#define QUEUE_FOREACH(var, head) \ + for((var) = QUEUE_FIRST(head); \ + (var) != SGX_THREAD_T_NULL; \ + (var) = QUEUE_NEXT(var)) + +#define QUEUE_INSERT_TAIL(head, elm) do { \ + ((pTD)(elm))->m_next = NULL; \ + if ((head)->m_first != SGX_THREAD_T_NULL) \ + ((pTD)((head)->m_last))->m_next = (pTD)(elm); \ + else \ + (head)->m_first = (elm); \ + (head)->m_last = (elm); \ +} while (0) + +#define QUEUE_REMOVE_HEAD(head) do { \ + if (((head)->m_first = \ + QUEUE_NEXT((head)->m_first)) == SGX_THREAD_T_NULL) \ + (head)->m_last = SGX_THREAD_T_NULL; \ +} while (0) + +#define QUEUE_COUNT_ALL(var, head, total) do { \ + QUEUE_FOREACH(var, head) \ + (total)++; \ +} while(0) \ + +/* Spinlock */ +#define SPIN_LOCK(_lck) sgx_spin_lock((sgx_spinlock_t *)_lck); +#define SPIN_UNLOCK(_lck) sgx_spin_unlock((sgx_spinlock_t *)_lck); + +/* check enclave address */ +#define CHECK_PARAMETER(addr) do { \ + if (addr == NULL || \ + !sgx_is_within_enclave((void *)addr, sizeof(*addr))) \ + return EINVAL; \ +} while (0) + +/* Generated OCALLs */ +extern "C" sgx_status_t sgx_thread_wait_untrusted_event_ocall(int* retval, const void *self); +extern "C" sgx_status_t sgx_thread_set_untrusted_event_ocall(int* retval, const void *waiter); +extern "C" sgx_status_t sgx_thread_set_multiple_untrusted_events_ocall(int* retval, const void** waiters, size_t total); +extern "C" sgx_status_t sgx_thread_setwait_untrusted_events_ocall(int* retval, const void *waiter, const void *self); + +extern "C" int sgx_thread_mutex_unlock_lazy(sgx_thread_mutex_t *mutex, sgx_thread_t *pwaiter); diff --git a/sdk/tlibthread/sethread_mutex.cpp b/sdk/tlibthread/sethread_mutex.cpp new file mode 100644 index 0000000000..322c9b91c6 --- /dev/null +++ b/sdk/tlibthread/sethread_mutex.cpp @@ -0,0 +1,227 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include + +#include "util.h" +#include "sethread_internal.h" + +int sgx_thread_mutex_init(sgx_thread_mutex_t *mutex, const sgx_thread_mutexattr_t *unused) +{ + UNUSED(unused); + CHECK_PARAMETER(mutex); + + mutex->m_control = SGX_THREAD_MUTEX_NONRECURSIVE; + mutex->m_refcount = 0; + mutex->m_owner = SGX_THREAD_T_NULL; + mutex->m_lock = SGX_SPINLOCK_INITIALIZER; + + QUEUE_INIT(&mutex->m_queue); + + return 0; +} + +int sgx_thread_mutex_destroy(sgx_thread_mutex_t *mutex) +{ + CHECK_PARAMETER(mutex); + + SPIN_LOCK(&mutex->m_lock); + if (mutex->m_owner != SGX_THREAD_T_NULL + || QUEUE_FIRST(&mutex->m_queue) != SGX_THREAD_T_NULL) { + SPIN_UNLOCK(&mutex->m_lock); + return EBUSY; + } + + mutex->m_control = 0; + mutex->m_refcount = 0; + + SPIN_UNLOCK(&mutex->m_lock); + + return 0; +} + +int sgx_thread_mutex_lock(sgx_thread_mutex_t *mutex) +{ + CHECK_PARAMETER(mutex); + + sgx_thread_t self = (sgx_thread_t)get_thread_data(); + + while (1) { + SPIN_LOCK(&mutex->m_lock); + + if(mutex->m_control != SGX_THREAD_MUTEX_RECURSIVE + && mutex->m_control != SGX_THREAD_MUTEX_NONRECURSIVE) { + SPIN_UNLOCK(&mutex->m_lock); + return EINVAL; + } + + if (mutex->m_control == SGX_THREAD_MUTEX_RECURSIVE + && mutex->m_owner == self) { + mutex->m_refcount++; + SPIN_UNLOCK(&mutex->m_lock); + return 0; + } + + if (mutex->m_owner == SGX_THREAD_T_NULL + && (QUEUE_FIRST(&mutex->m_queue) == self + || QUEUE_FIRST(&mutex->m_queue) == SGX_THREAD_T_NULL)) { + + if (QUEUE_FIRST(&mutex->m_queue) == self) + QUEUE_REMOVE_HEAD(&mutex->m_queue); + + mutex->m_owner = self; + mutex->m_refcount++; + SPIN_UNLOCK(&mutex->m_lock); + return 0; + } + + sgx_thread_t waiter = SGX_THREAD_T_NULL; + QUEUE_FOREACH(waiter, &mutex->m_queue) { + if (waiter == self) break; + } + + if (waiter == SGX_THREAD_T_NULL) + QUEUE_INSERT_TAIL(&mutex->m_queue, self); + + SPIN_UNLOCK(&mutex->m_lock); + + int err = 0; + sgx_thread_wait_untrusted_event_ocall(&err, TD2TCS(self)); + } + + /* NOTREACHED */ +} + +int sgx_thread_mutex_trylock(sgx_thread_mutex_t *mutex) +{ + CHECK_PARAMETER(mutex); + + sgx_thread_t self = (sgx_thread_t)get_thread_data(); + + SPIN_LOCK(&mutex->m_lock); + + if(mutex->m_control != SGX_THREAD_MUTEX_RECURSIVE + && mutex->m_control != SGX_THREAD_MUTEX_NONRECURSIVE) { + SPIN_UNLOCK(&mutex->m_lock); + return EINVAL; + } + + if (mutex->m_control == SGX_THREAD_MUTEX_RECURSIVE + && mutex->m_owner == self) { + mutex->m_refcount++; + SPIN_UNLOCK(&mutex->m_lock); + return 0; + } + + if (mutex->m_owner == SGX_THREAD_T_NULL + && (QUEUE_FIRST(&mutex->m_queue) == self + || QUEUE_FIRST(&mutex->m_queue) == SGX_THREAD_T_NULL)) { + + if (QUEUE_FIRST(&mutex->m_queue) == self) + QUEUE_REMOVE_HEAD(&mutex->m_queue); + + mutex->m_owner = self; + mutex->m_refcount++; + + SPIN_UNLOCK(&mutex->m_lock); + return 0; + } + + SPIN_UNLOCK(&mutex->m_lock); + return EBUSY; +} + +/* sgx_thread_mutex_unlock_lazy: + * check and modify mutex object, but not wake the pending thread up. + */ +int sgx_thread_mutex_unlock_lazy(sgx_thread_mutex_t *mutex, sgx_thread_t *pwaiter) +{ + CHECK_PARAMETER(mutex); + + sgx_thread_t self = (sgx_thread_t)get_thread_data(); + + SPIN_LOCK(&mutex->m_lock); + + if(mutex->m_control != SGX_THREAD_MUTEX_RECURSIVE + && mutex->m_control != SGX_THREAD_MUTEX_NONRECURSIVE) { + SPIN_UNLOCK(&mutex->m_lock); + return EINVAL; + } + + /* if the mutux is not locked by anyone */ + if(mutex->m_owner == SGX_THREAD_T_NULL) { + SPIN_UNLOCK(&mutex->m_lock); + return EINVAL; + } + + /* if the mutex is locked by another thread */ + if (mutex->m_owner != self) { + SPIN_UNLOCK(&mutex->m_lock); + return EPERM; + } + + /* the mutex is locked by current thread */ + if (--mutex->m_refcount == 0) + mutex->m_owner = SGX_THREAD_T_NULL; + else { + SPIN_UNLOCK(&mutex->m_lock); + return 0; + } + + /* Before releasing the mutex, get the first thread, + * the thread should be waked up by the caller. + */ + sgx_thread_t waiter = QUEUE_FIRST(&mutex->m_queue); + + SPIN_UNLOCK(&mutex->m_lock); + if (pwaiter != NULL) *pwaiter = waiter; + + return 0; +} + +/* sgx_thread_mutex_unlock: + * invoke sgx_thread_mutex_unlock_lazy, wake the pending thread up. + */ +int sgx_thread_mutex_unlock(sgx_thread_mutex_t *mutex) +{ + sgx_thread_t waiter = SGX_THREAD_T_NULL; + + int ret = sgx_thread_mutex_unlock_lazy(mutex, &waiter); + if (ret != 0) return ret; + + if (waiter != SGX_THREAD_T_NULL) /* wake the waiter up*/ + sgx_thread_set_untrusted_event_ocall(&ret, TD2TCS(waiter)); + + return 0; +} diff --git a/sdk/tlibthread/sethread_utils.cpp b/sdk/tlibthread/sethread_utils.cpp new file mode 100644 index 0000000000..7b2d3918c1 --- /dev/null +++ b/sdk/tlibthread/sethread_utils.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include +#include + +#include "util.h" +#include "sethread_internal.h" + +sgx_thread_t sgx_thread_self(void) +{ + return (sgx_thread_t)get_thread_data(); +} + diff --git a/sdk/trts/Makefile b/sdk/trts/Makefile new file mode 100644 index 0000000000..279e300011 --- /dev/null +++ b/sdk/trts/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CPPFLAGS += -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc/tlibc + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) \ + -Werror \ + -fno-exceptions \ + -fno-rtti + +OBJS := init_enclave.o \ + trts.o \ + trts_ecall.o \ + trts_ocall.o \ + trts_util.o \ + trts_veh.o \ + trts_xsave.o \ + init_optimized_lib.o \ + trts_version.o + + +all: $(OBJS) elf_parser + +$(OBJS): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + +.PHONY: elf_parser +elf_parser: + $(MAKE) -C linux + +.PHONY: clean +clean: + @$(RM) $(OBJS) *.bak *~ + $(MAKE) -C linux clean diff --git a/sdk/trts/init_enclave.cpp b/sdk/trts/init_enclave.cpp new file mode 100644 index 0000000000..0f52f99336 --- /dev/null +++ b/sdk/trts/init_enclave.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: init_enclave.cpp + * Description: + * Initialize enclave by rebasing the image to the enclave base + */ + +#include +#include "thread_data.h" +#include "global_data.h" +#include "util.h" +#include "xsave.h" +#include "sgx_trts.h" +#include "init_optimized_lib.h" +#include "trts_internal.h" +# include "linux/elf_parser.h" +#include "rts.h" + +// The global cpu feature bits from uRTS +uint64_t g_cpu_feature_indicator = 0; + +const volatile global_data_t g_global_data = {1, 2, 3, 4, 0, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}}}; +uint32_t g_enclave_state = ENCLAVE_INIT_NOT_STARTED; + +extern "C" { +uintptr_t __stack_chk_guard = 0; +#define __weak_alias(alias,sym) \ + __asm__(".weak " __STRING(alias) " ; " \ + __STRING(alias) " = " __STRING(sym)) +__weak_alias(__intel_security_cookie, __stack_chk_guard); +} + +// init_enclave() +// Initialize enclave. +// Parameters: +// [IN] enclave_base - the enclave base address +// [IN] ms - the marshalling structure passed by uRTS +// Return Value: +// 0 - success +// -1 - fail +// +extern "C" int init_enclave(void *enclave_base, void *ms) +{ + if(enclave_base == NULL || ms == NULL) + { + return -1; + } + + // relocation + if(0 != relocate_enclave(enclave_base)) + { + return -1; + } + + // Check if the ms is outside the enclave. + // sgx_is_outside_enclave() should be placed after relocate_enclave() + cpu_sdk_info_t *info = (cpu_sdk_info_t *)ms; + if(!sgx_is_outside_enclave(info, sizeof(cpu_sdk_info_t))) + { + return -1; + } + const sdk_version_t sdk_version = info->version; + const uint64_t cpu_features = info->cpu_features; + + if (sdk_version != SDK_VERSION_1_5) + return -1; + + // xsave + uint64_t xfrm = get_xfeature_state(); + + // optimized libs + if(0 != init_optimized_libs(cpu_features, xfrm)) + { + CLEAN_XFEATURE_REGS + return -1; + } + + if(SGX_SUCCESS != sgx_read_rand((unsigned char*)&__stack_chk_guard, + sizeof(__stack_chk_guard))) + { + CLEAN_XFEATURE_REGS + return -1; + } + + // clean extended registers, no need to save + CLEAN_XFEATURE_REGS + return 0; +} + +sgx_status_t do_init_enclave(void *ms) +{ + void *enclave_base = get_enclave_base(); + if(ENCLAVE_INIT_NOT_STARTED != lock_enclave()) + { + return SGX_ERROR_UNEXPECTED; + } + if(0 != init_enclave(enclave_base, ms)) + { + return SGX_ERROR_UNEXPECTED; + } + memset(GET_PTR(void, enclave_base, g_global_data.heap_offset), 0, g_global_data.heap_size); + g_enclave_state = ENCLAVE_INIT_DONE; + return SGX_SUCCESS; +} + diff --git a/sdk/trts/init_optimized_lib.cpp b/sdk/trts/init_optimized_lib.cpp new file mode 100644 index 0000000000..4c3918965d --- /dev/null +++ b/sdk/trts/init_optimized_lib.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "init_optimized_lib.h" +#include +#include "se_cpu_feature.h" +#include "sgx_trts.h" +#include "sgx_attributes.h" +#include "global_data.h" + +extern "C" int sgx_init_string_lib(uint64_t cpu_feature_indicator); +extern "C" sgx_status_t sgx_init_crypto_lib(uint64_t cpu_feature_indicator); + +static int set_global_feature_indicator(uint64_t feature_bit_array, uint64_t xfrm) +{ + // Confirm the reserved bits and the unset bits by uRTS must be 0. + + + if(feature_bit_array & (RESERVED_CPU_FEATURE_BIT)) + { + // clear the reserved bits + feature_bit_array = feature_bit_array & (~(RESERVED_CPU_FEATURE_BIT)); + } + ; + + +#ifdef SE_SIM + // Simulation mode - requires SSE for x86 and SSE2 for x64. +#ifdef SE_32 + if(!(feature_bit_array & ~(CPU_FEATURE_SSE - 1))) + { + return -1; + } +#else + if(!(feature_bit_array & ~(CPU_FEATURE_SSE2 - 1))) + { + return -1; + } +#endif +#else + // HW mode - requires SSE4.2. Take SSE4.2 as the baseline. + if(!(feature_bit_array & ~(CPU_FEATURE_SSE4_2 - 1))) + { + return -1; + } +#endif + // Check for inconsistencies in the CPUID feature mask. + if ( (((feature_bit_array & CPU_FEATURE_SSE) == CPU_FEATURE_SSE) &&((feature_bit_array & (CPU_FEATURE_SSE - 1)) != (CPU_FEATURE_SSE - 1))) || + (((feature_bit_array & CPU_FEATURE_SSE2) == CPU_FEATURE_SSE2) &&((feature_bit_array & (CPU_FEATURE_SSE2 - 1)) != (CPU_FEATURE_SSE2 - 1))) || + (((feature_bit_array & CPU_FEATURE_SSE3) == CPU_FEATURE_SSE3) &&((feature_bit_array & (CPU_FEATURE_SSE3 - 1)) != (CPU_FEATURE_SSE3 - 1))) || + (((feature_bit_array & CPU_FEATURE_SSSE3) == CPU_FEATURE_SSSE3) && ((feature_bit_array & (CPU_FEATURE_SSSE3 - 1)) != (CPU_FEATURE_SSSE3 - 1))) || + (((feature_bit_array & CPU_FEATURE_SSE4_1) == CPU_FEATURE_SSE4_1) && ((feature_bit_array & (CPU_FEATURE_SSE4_1 - 1)) != (CPU_FEATURE_SSE4_1 - 1))) || + (((feature_bit_array & CPU_FEATURE_SSE4_2) == CPU_FEATURE_SSE4_2) && ((feature_bit_array & (CPU_FEATURE_SSE4_2 - 1)) != (CPU_FEATURE_SSE4_2 - 1))) ) + { + return -1; + } + + // Determine whether the OS & ENCLAVE support SAVE/RESTORE of the AVX register set + // IF NOT, clear the advanced feature set bits corresponding to AVX and beyond + if(!XFEATURE_ENABLED_AVX(xfrm)) + { + // AVX is disabled by OS, so clear the AVX related feature bits + feature_bit_array &= (~(CPU_FEATURE_AVX | CPU_FEATURE_F16C | CPU_FEATURE_AVX2 | + CPU_FEATURE_FMA | CPU_FEATURE_RTM | CPU_FEATURE_HLE | CPU_FEATURE_BMI | + CPU_FEATURE_PREFETCHW | CPU_FEATURE_RDSEED | CPU_FEATURE_ADCOX)); + } + + g_cpu_feature_indicator = feature_bit_array; + return 0; +} + +extern "C" int init_optimized_libs(const uint64_t feature_bit_array, uint64_t xfrm) +{ + if (g_enclave_state != ENCLAVE_INIT_IN_PROGRESS) + { + return -1; + } + // set the global feature indicator + if(set_global_feature_indicator(feature_bit_array, xfrm)) + { + return -1; + } + + // Init string library with the global feature indicator + if(sgx_init_string_lib(g_cpu_feature_indicator) != 0) + { + return -1; + } + + // Init IPP crypto library with the global feature indicator + if(sgx_init_crypto_lib(g_cpu_feature_indicator) != 0) + { + return -1; + } + + return 0; +} diff --git a/sdk/trts/init_optimized_lib.h b/sdk/trts/init_optimized_lib.h new file mode 100644 index 0000000000..373bfca04e --- /dev/null +++ b/sdk/trts/init_optimized_lib.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef INIT_OPTIMIZED_LIB_H +#define INIT_OPTIMIZED_LIB_H + +#include "se_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +int init_optimized_libs(const uint64_t feature_bits_array, uint64_t xfrm); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/trts/linux/Makefile b/sdk/trts/linux/Makefile new file mode 100644 index 0000000000..ff9394d4b4 --- /dev/null +++ b/sdk/trts/linux/Makefile @@ -0,0 +1,91 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +CFLAGS += -Werror $(ENCLAVE_CFLAGS) \ + -I$(LINUX_SDK_DIR)/trts \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc/internal/linux \ + -I$(LINUX_SDK_DIR)/simulation/assembly/ + +CXXFLAGS += -Werror $(ENCLAVE_CXXFLAGS) \ + -I$(LINUX_SDK_DIR)/trts \ + -I$(COMMON_DIR)/inc \ + -I$(COMMON_DIR)/inc/internal/ + +TCFLAGS += -nostdinc \ + -I$(COMMON_DIR)/inc/tlibc/ + +LDCFLAGS := -shared -nostdlib -nodefaultlibs -nostartfiles + +CPP_SRCS := $(wildcard ../*.cpp) +C_SRCS := $(wildcard *.c) +ASM_SRCS := $(wildcard *.S) +OBJS := $(CPP_SRCS:.cpp=.o) +OBJS += $(C_SRCS:.c=.o) +OBJS += $(ASM_SRCS:.S=.o) + +LIBTRTS = libsgx_trts.a + +.PHONY: all +all: $(LIBTRTS) | $(BUILD_DIR) + $(CP) $(LIBTRTS) $| + +$(LIBTRTS): $(OBJS) setcontext.o + $(AR) rsD $@ $(OBJS) + $(AR) rsD $@ $(ARCH)/setcontext.o + +%.o: %.S + $(CC) $(CFLAGS) $(TCFLAGS) -c $< -o $@ + +%.o: %.c + $(CC) $(CFLAGS) $(TCFLAGS) -c $< -o $@ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(TCFLAGS) -c $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: setcontext.o +setcontext.o: + $(MAKE) -C $(ARCH) + +.PHONY: clean +clean: + @$(RM) $(OBJS) $(LIBTRTS) $(BUILD_DIR)/$(LIBTRTS) + $(MAKE) -C $(ARCH) clean + +.PHONY: rebuild +rebuild: clean all + diff --git a/sdk/trts/linux/elf_parser.c b/sdk/trts/linux/elf_parser.c new file mode 100644 index 0000000000..964c10d0e0 --- /dev/null +++ b/sdk/trts/linux/elf_parser.c @@ -0,0 +1,419 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * This file is part of trusted loader for tRTS. + */ + +#include "elf_parser.h" +#include "rts.h" +#include "util.h" +#include "elf_util.h" +#include "global_data.h" + +static int elf_tls_aligned_virtual_size(const void *enclave_base, + size_t *aligned_virtual_size); + +static ElfW(Phdr)* get_phdr(const ElfW(Ehdr)* ehdr) +{ + if (ehdr == NULL) + return NULL; /* Invalid image. */ + + /* Check the ElfW Magic number. */ + if ((ehdr->e_ident[EI_MAG0] != ELFMAG0) || + (ehdr->e_ident[EI_MAG1] != ELFMAG1) || + (ehdr->e_ident[EI_MAG2] != ELFMAG2) || + (ehdr->e_ident[EI_MAG3] != ELFMAG3)) + return NULL; + + /* Enclave image should be a shared object file. */ + if (ehdr->e_type != ET_DYN) + return NULL; + + return GET_PTR(ElfW(Phdr), ehdr, ehdr->e_phoff); +} + +static ElfW(Sym)* get_sym(ElfW(Sym)* symtab, size_t idx) +{ + if(STB_WEAK == ELFW(ST_BIND)(symtab[idx].st_info) + && 0 == symtab[idx].st_value) + { + return NULL; + } + + return &symtab[idx]; +} + +#ifdef __x86_64__ +/* Relocation for x64 (with addend) */ +static int do_relocs(const ElfW(Addr) enclave_base, + ElfW(Addr) rela_offset, + ElfW(Addr) sym_offset, + size_t nr_relocs) +{ + ElfW(Rela)* rela = GET_PTR(ElfW(Rela), enclave_base, rela_offset); + ElfW(Sym)* symtab = GET_PTR(ElfW(Sym), enclave_base, sym_offset); + ElfW(Sym)* sym; + size_t i; + size_t aligned_virtual_size = 0; + + for (i = 0; i < nr_relocs; ++i, ++rela) + { + ElfW(Addr)* reloc_addr = GET_PTR(ElfW(Addr), enclave_base, rela->r_offset); + + switch (ELF64_R_TYPE(rela->r_info)) + { + case R_X86_64_RELATIVE: + *reloc_addr = enclave_base + (uintptr_t)rela->r_addend; + break; + + case R_X86_64_GLOB_DAT: + case R_X86_64_JUMP_SLOT: + case R_X86_64_64: + sym = get_sym(symtab, ELF64_R_SYM(rela->r_info)); + if(!sym) + break; + *reloc_addr = enclave_base + sym->st_value + (uintptr_t)rela->r_addend; + break; + + case R_X86_64_DTPMOD64: + *reloc_addr = 1; + break; + + case R_X86_64_DTPOFF64: + sym = get_sym(symtab, ELF64_R_SYM(rela->r_info)); + if(!sym) + break; + *reloc_addr = sym->st_value + (uintptr_t)rela->r_addend; + break; + + case R_X86_64_TPOFF64: + sym = get_sym(symtab, ELF64_R_SYM(rela->r_info)); + if(!sym) + break; + + if ((0 == elf_tls_aligned_virtual_size((void *)enclave_base, &aligned_virtual_size)) && (aligned_virtual_size)) + { + *reloc_addr = sym->st_value + (uintptr_t)rela->r_addend - aligned_virtual_size; + break; + } + else + return -1; + + case R_X86_64_NONE: + break; + + default: /* unsupported relocs */ + return -1; + } + } + + return 0; +} + +#elif defined(__i386__) +/* Relocation for x86 (without addend) */ +static int do_relocs(const ElfW(Addr) enclave_base, + ElfW(Addr) rel_offset, + ElfW(Addr) sym_offset, + size_t nr_relocs) +{ + ElfW(Rel)* rel = GET_PTR(ElfW(Rel), enclave_base, rel_offset); + ElfW(Sym)* symtab = GET_PTR(ElfW(Sym), enclave_base, sym_offset); + ElfW(Sym)* sym = NULL; + size_t i; + size_t aligned_virtual_size = 0; + + for (i = 0; i < nr_relocs; ++i, ++rel) + { + ElfW(Addr)* reloc_addr = GET_PTR(ElfW(Addr), enclave_base, rel->r_offset); + + if(R_386_RELATIVE == ELF32_R_TYPE(rel->r_info)) + { + *reloc_addr += enclave_base; /* B+A */ + continue; + } + sym = get_sym(symtab, ELF32_R_SYM(rel->r_info)); + if(!sym) /* when the weak symbol is not implemented, sym is NULL */ + continue; + switch (ELF32_R_TYPE(rel->r_info)) + { + case R_386_GLOB_DAT: + case R_386_JMP_SLOT: /* S */ + *reloc_addr = enclave_base + sym->st_value; + break; + + case R_386_32: /* S+A */ + *reloc_addr += enclave_base + sym->st_value; + break; + + case R_386_PC32: /* S+A-P */ + *reloc_addr += (enclave_base + sym->st_value - (ElfW(Addr))reloc_addr); + break; + + case R_386_NONE: + break; + + case R_386_TLS_DTPMOD32: + *reloc_addr = 1; + break; + + case R_386_TLS_DTPOFF32: + *reloc_addr = sym->st_value; + break; + + case R_386_TLS_TPOFF: + if ((0 == elf_tls_aligned_virtual_size((void *)enclave_base, &aligned_virtual_size)) && (aligned_virtual_size)) + { + *reloc_addr += sym->st_value - aligned_virtual_size; + break; + } + else + return -1; + + case R_386_TLS_TPOFF32: + if ((0 == elf_tls_aligned_virtual_size((void *)enclave_base, &aligned_virtual_size)) && (aligned_virtual_size)) + { + *reloc_addr += aligned_virtual_size - sym->st_value; + break; + } + else + return -1; + + default: /* unsupported relocs */ + return -1; + } + } + + return 0; +} +#endif + +#define DO_REL(base_addr, rel_offset, sym_offset, total_sz, rel_entry_sz) \ +do { \ + if (rel_offset) \ + { \ + size_t n; \ + if (rel_entry_sz == 0) \ + return -1; \ + n = total_sz/rel_entry_sz; \ + if (do_relocs((ElfW(Addr))enclave_base, rel_offset, sym_offset, n)) \ + return -1; \ + } \ +} while (0) + +/* By default all symbol is linked as global symbol by link editor. When call global symbol, + * we first call .plt entry. It should have problems if the call goloal symbol when relocation + * is not done. + * Declare relocate_enclave as .hidden is to make it local symbol. + * Since this function is called before relocation is done, we must make + * it local symbol, so the code is like "fce3: e8 98 12 00 00 call 10f80 " + * 0x9812=0x10f80-0xfce8 + */ +__attribute__ ((visibility ("hidden"))) +int relocate_enclave(void* enclave_base) +{ + ElfW(Half) phnum = 0; + ElfW(Ehdr) *ehdr = (ElfW(Ehdr)*)enclave_base; + ElfW(Phdr) *phdr = get_phdr(ehdr); + + if (phdr == NULL) + return -1; /* Invalid image. */ + + for (; phnum < ehdr->e_phnum; phnum++, phdr++) + { + /* Search for dynamic segment */ + if (phdr->p_type == PT_DYNAMIC) + { + size_t count; + size_t n_dyn = phdr->p_filesz/sizeof(ElfW(Dyn)); + ElfW(Dyn) *dyn = GET_PTR(ElfW(Dyn), ehdr, phdr->p_paddr); + + ElfW(Addr) sym_offset = 0; + ElfW(Addr) rel_offset = 0; + ElfW(Addr) plt_offset = 0; + + size_t rel_total_sz = 0; + size_t rel_entry_sz = 0; + size_t plt_total_sz = 0; + + for (count = 0; count < n_dyn; count++, dyn++) + { + if (dyn->d_tag == DT_NULL) /* End */ + break; + + switch (dyn->d_tag) + { + case DT_SYMTAB: /* symbol table */ + sym_offset = dyn->d_un.d_ptr; + break; + + case RTS_DT_REL:/* Rel (x86) or Rela (x64) relocs */ + rel_offset = dyn->d_un.d_ptr; + break; + + case RTS_DT_RELSZ: + rel_total_sz = dyn->d_un.d_val; + break; + + case RTS_DT_RELENT: + rel_entry_sz = dyn->d_un.d_val; + break; + + case DT_JMPREL: /* PLT relocs */ + plt_offset = dyn->d_un.d_ptr; + break; + + case DT_PLTRELSZ: + plt_total_sz = dyn->d_un.d_val; + break; + } + } + + DO_REL(enclave_base, rel_offset, sym_offset, rel_total_sz, rel_entry_sz); + DO_REL(enclave_base, plt_offset, sym_offset, plt_total_sz, rel_entry_sz); + } + } + + return 0; +} + +int elf_tls_info(const void* enclave_base, + uintptr_t *tls_addr, size_t *tdata_size) +{ + ElfW(Half) phnum = 0; + const ElfW(Ehdr) *ehdr = (const ElfW(Ehdr)*)enclave_base; + ElfW(Phdr) *phdr = get_phdr(ehdr); + + if (!tls_addr || !tdata_size) + return -1; + + if (phdr == NULL) + return -1; /* Invalid image. */ + + /* Search for TLS segment */ + *tls_addr = 0; + *tdata_size = 0; + for (; phnum < ehdr->e_phnum; phnum++, phdr++) + { + if (phdr->p_type == PT_TLS) + { + /* tls_addr here is got from the program header, the address + * need to be added by the enclave base. + */ + *tls_addr = (size_t)enclave_base + phdr->p_vaddr; + *tdata_size = phdr->p_filesz; + break; + } + } + + return 0; +} + +static int elf_tls_aligned_virtual_size(const void *enclave_base, + size_t *aligned_virtual_size) +{ + ElfW(Half) phnum = 0; + const ElfW(Ehdr) *ehdr = (const ElfW(Ehdr)*)enclave_base; + ElfW(Phdr) *phdr = get_phdr(ehdr); + size_t virtual_size =0, align = 0; + + if (phdr == NULL) + return -1; + + if (!aligned_virtual_size) + return -1; + + *aligned_virtual_size = 0; + for (; phnum < ehdr->e_phnum; phnum++, phdr++) + { + if (phdr->p_type == PT_TLS) + { + virtual_size = phdr->p_memsz; + align = phdr->p_align; + + /* p_align == 0 or p_align == 1 means no alignment is required */ + if (align == 0 || align == 1) + *aligned_virtual_size = virtual_size; + else + *aligned_virtual_size = (virtual_size + align - 1) & (~(align - 1)); + + break; + } + } + + return 0; +} + +int elf_get_init_array(const void* enclave_base, + uintptr_t *init_array_addr, size_t *init_array_size) +{ + ElfW(Half) phnum = 0; + const ElfW(Ehdr) *ehdr = (const ElfW(Ehdr)*)enclave_base; + ElfW(Phdr) *phdr = get_phdr(ehdr); + + if (!init_array_addr || !init_array_size) + return -1; + + if (phdr == NULL) + return -1; /* Invalid image. */ + + *init_array_addr = 0; + *init_array_size = 0; + + /* Search for Dynamic segment */ + for (; phnum < ehdr->e_phnum; phnum++, phdr++) + { + if (phdr->p_type == PT_DYNAMIC) + { + size_t count; + size_t n_dyn = phdr->p_filesz/sizeof(ElfW(Dyn)); + ElfW(Dyn) *dyn = GET_PTR(ElfW(Dyn), ehdr, phdr->p_paddr); + + for (count = 0; count < n_dyn; count++, dyn++) + { + switch (dyn->d_tag) + { + case DT_INIT_ARRAY: + *init_array_addr = dyn->d_un.d_ptr; + break; + case DT_INIT_ARRAYSZ: + *init_array_size = dyn->d_un.d_val; + break; + } + } + } + } + + return 0; +} +/* vim: set ts=4 sw=4 et cin: */ diff --git a/sdk/trts/linux/elf_parser.h b/sdk/trts/linux/elf_parser.h new file mode 100644 index 0000000000..0dc8f0cee1 --- /dev/null +++ b/sdk/trts/linux/elf_parser.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: elf_parser.h + * Description: + * Header file for tRTS ELF parser. + */ + +#ifndef _PE_PARSER_H_ +#define _PE_PARSER_H_ + +#include "se_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int relocate_enclave(void* enclave_base); + +int elf_tls_info(const void* enclave_base, + uintptr_t *tls_addr, size_t *tdata_size); + +int elf_get_init_array(const void* enclave_base, + uintptr_t *init_array_addr, size_t *init_array_size); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/trts/linux/global_init.c b/sdk/trts/linux/global_init.c new file mode 100644 index 0000000000..25a4ae5abe --- /dev/null +++ b/sdk/trts/linux/global_init.c @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "internal/global_init.h" +#include "linux/elf_parser.h" +#include "global_data.h" +#include "internal/util.h" +#include "thread_data.h" +#include "sgx_trts.h" +#include +#include + +typedef void (*fp_t)(void); + +/* required by global constructor when -fuse-cxa-atexit is enabled */ +void *__dso_handle __attribute__((weak)) = &(__dso_handle); + +int __cxa_atexit(void (*fun)(void *), void *para, void *dso) +{ + (void)(fun); + (void)(para); + (void)(dso); + + return 0; +} + +/* auxiliary routines */ +static void do_ctors_aux(void) +{ + /* SGX RTS does not support .ctors currently */ + + fp_t *p = NULL; + uintptr_t init_array_addr; + size_t init_array_size; + const void *enclave_start = (const void*)&__ImageBase; + + elf_get_init_array(enclave_start, &init_array_addr, &init_array_size); + + if (init_array_addr == 0 || init_array_size == 0) + return; + + fp_t *fp_start = (fp_t*)(init_array_addr + (uintptr_t)(enclave_start)); + fp_t *fp_end = fp_start + (init_array_size / sizeof(fp_t)); + + /* traverse .init_array in forward order */ + for (p = fp_start; p < fp_end; p++) + { + (*p)(); + } +} + +void init_global_object(void) +{ + do_ctors_aux(); +} + +void init_stack_guard(void) +{ + thread_data_t *thread_data = get_thread_data(); + assert(thread_data != NULL); + + if (SGX_SUCCESS != sgx_read_rand( + (unsigned char*)&thread_data->stack_guard, + sizeof(thread_data->stack_guard))) + abort(); +} diff --git a/sdk/trts/linux/metadata_sec.S b/sdk/trts/linux/metadata_sec.S new file mode 100644 index 0000000000..3ee2b52f04 --- /dev/null +++ b/sdk/trts/linux/metadata_sec.S @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + .file "metadata_sec.S" + +#define METADATA_SIZE 4096 +.section ".note.sgxmeta", "", @note + .p2align 0 /* section no alignment */ + .long 1f - 0f /* name size (not including padding) */ + .long 2f - 1f /* desc size (not including padding) */ + .long 0x01 /* type */ +0: .asciz "sgx_metadata" /* name */ +1: .fill METADATA_SIZE, 1, 0 /* desc - stand for metadata which is initialized with 0 */ +2: .p2align 0 diff --git a/sdk/trts/linux/tls_support.c b/sdk/trts/linux/tls_support.c new file mode 100644 index 0000000000..5726a22958 --- /dev/null +++ b/sdk/trts/linux/tls_support.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: tls_support.c + * Description: + * TLS support in the enclave. + */ + +#include "thread_data.h" + +typedef struct +{ + unsigned long int ti_module; + unsigned long int ti_offset; +} tls_index; + +#if defined SE_GNU32 +void * __attribute__((__regparm__(1))) ___tls_get_addr(tls_index *ti) +#elif defined SE_GNU64 +void *__tls_get_addr(tls_index *ti) +#endif +{ + thread_data_t *thread_data = get_thread_data(); + return (unsigned char *)thread_data->tls_addr + ti->ti_offset; +} diff --git a/sdk/trts/linux/trts_pic.S b/sdk/trts/linux/trts_pic.S new file mode 100644 index 0000000000..af47e443ab --- /dev/null +++ b/sdk/trts/linux/trts_pic.S @@ -0,0 +1,494 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * Description: + * The file provides `enclave_entry' function to switch code between + * trusted and untrusted envronment. + */ + + .file "trts_pic.S" + +#include "trts_pic.h" + + .text + +DECLARE_LOCAL_FUNC get_enclave_base + lea_pic __ImageBase, %xax + ret +DECLARE_LOCAL_FUNC get_enclave_state + lea_pic g_enclave_state, %xcx + xor %xax, %xax + movl (%xcx), %eax + ret +DECLARE_LOCAL_FUNC set_enclave_state + lea_pic g_enclave_state, %xax +#ifdef LINUX32 + mov SE_WORDSIZE(%esp), %edi +#endif + movl %edi, (%xax) + ret + +DECLARE_LOCAL_FUNC lock_enclave + lea_pic g_enclave_state, %xdx + xor %xax, %xax + mov $ENCLAVE_INIT_NOT_STARTED, %eax + xor %xcx, %xcx + mov $ENCLAVE_INIT_IN_PROGRESS, %ecx /* if (g_global_data.enclave_state == ENCLAVE_INIT_NOT_STARTED) */ + lock cmpxchgl %ecx, (%xdx) /* g_global_data.enclave_state == ENCLAVE_INIT_IN_PROGRESS */ + ret /* xax: the initial value of enclave state */ + +/* + * --------------------------------------------------------------------- + * Function: thread_data_t* get_thread_data(void); + * + * Get the address of thread_data + * --------------------------------------------------------------------- + */ +DECLARE_LOCAL_FUNC get_thread_data + READ_TD_DATA self_addr + ret + +/* + * --------------------------------------------------------------------- + * Function: enclave_entry + * The entry point of the enclave. + * + * Registers: + * XAX - TCS.CSSA + * XBX - the address of a TCS + * XCX - the address of the instruction following the EENTER + * XDI - the reason of entering the enclave + * XSI - the pointer to the marshalling structure + */ +DECLARE_GLOBAL_FUNC enclave_entry +/* + * ---------------------------------------------------------------------- + * Dispatch code according to CSSA and the reason of EENTER + * eax > 0 - exception handler + * edi >= 0 - ecall + * edi == -1 - do_init_enclave + * edi == -2 - oret + * Registers + * No need to use any register during the dipatch + * ---------------------------------------------------------------------- + */ + .cfi_startproc + cmp $0, %xax + jne .Ldo_handler /* handle exception state */ + xor %xdx, %xdx + READ_TD_DATA last_sp + cmp $0, %xax + jne .Lswitch_stack + GET_STACK_BASE %xbx /* if last_sp == 0, set sp to stack base */ + sub $STATIC_STACK_SIZE, %xax /* give space for static stack */ +.Lswitch_stack: + xchg %xsp, %xax + push %xcx + push %xbp + + .cfi_def_cfa_offset 2 * SE_WORDSIZE + .cfi_offset xbp, -2 * SE_WORDSIZE + mov %xsp, %xbp + .cfi_def_cfa_register xbp + + /* Save the registers */ + sub $(6*SE_WORDSIZE), %xsp + mov %xax, -1*SE_WORDSIZE(%xbp) /* xsp_u */ + mov %xdx, -3*SE_WORDSIZE(%xbp) /* cssa */ + mov %xbx, -4*SE_WORDSIZE(%xbp) /* TCS */ + mov %xsi, -5*SE_WORDSIZE(%xbp) /* XSI */ + mov %xdi, -6*SE_WORDSIZE(%xbp) /* XDI */ + +#ifdef LINUX64 + mov %rdx, %rcx + mov %rbx, %rdx +#endif + call enter_enclave + +.Lexit_enclave: + mov -1*SE_WORDSIZE(%xbp), %xdx /* xdx: xsp_u */ + mov %xbp, %xsp + pop %xbp /* xbp_u */ + pop %xbx /* ret_u */ + mov %xdx, %xsp /* xsp_u */ + mov $OCMD_ERET, %xdi + mov %xax, %xsi + +.Lclear_and_exit_enclave: + /* Clear all GPRs, except xax, xbx, xdi and xsi */ + xor %xcx, %xcx + xor %xdx, %xdx +#if defined(LINUX64) + xor %r8, %r8 + xor %r9, %r9 + xor %r10, %r10 + xor %r11, %r11 + xor %r12, %r12 + xor %r13, %r13 + xor %r14, %r14 + xor %r15, %r15 +#endif + + /* Set status flags to pre-defined values */ + add %xdx, %xdx /* OF = SF = AF = CF = 0; ZF = PF = 1 */ + + /* EEXIT */ + mov $SE_EEXIT, %xax /* EEXIT leaf */ + ENCLU + + /* Should not come here */ + ud2 + +.Ldo_handler: + mov %xax, %xdx /* XDX: cssa */ + GET_STACK_BASE %xbx /* XAX: static stack, set sp to stack base */ + jmp .Lswitch_stack + + /* Should not come here */ + ud2 + + .cfi_endproc + +/* + * ------------------------------------------------------------------------- + * sgx_status_t do_ocall(unsigned int index, void *ms); + * + * Function: do_ocall + * The entry point of the enclave + * Parameters: + * func_addr - target function address + * ms - marshalling structure + * + * Stack: (same as do_oret) + * bottom of stack -> + * ----------------- + * | ECALL/OCALL | + * previous TD.last_sp -> | frames | + * ----------------- + * | ECALL frame | + * | do_ocall param 2| 21 + * | do_ocall param 1| 20 + * |do_ocall ret_addr| 19 + * | ocall_depth | 18 + * | reserved | 17 + * | reserved | 16 + * | reserved | 15 + * | rbx | 14 + * | rsi | 13 + * | rdi | 12 + * | rbp | 11 + * | r12 | 10 + * | r13 | 9 + * | r14 | 8 + * | r15 | 7 + * | prev TD.last_sp | 6 + * | ocall_index | 5 + * | OCALL FLAG | 4 + * | shadow | 3 + * | shadow | 2 + * | shadow | 1 + * TD.last_sp -> | shadow | 0 + * ----------------- + * ------------------------------------------------------------------------- + */ +DECLARE_LOCAL_FUNC do_ocall + +/* + * 8 for GPR, 1 for TD.last_sp, 1 for ocall_index + * 1 for OCALL_FLAG, 4 for shadow space. + * Stack Pointer is 16-byte aligned under x86_64. + */ + sub $(19*SE_WORDSIZE), %xsp + + /* save non-volatile registers, except xsp */ + mov %xbx, SE_WORDSIZE*14(%xsp) + mov %xsi, SE_WORDSIZE*13(%xsp) + mov %xdi, SE_WORDSIZE*12(%xsp) + mov %xbp, SE_WORDSIZE*11(%xsp) + +#ifdef LINUX64 + mov %r12, SE_WORDSIZE*10(%rsp) + mov %r13, SE_WORDSIZE* 9(%rsp) + mov %r14, SE_WORDSIZE* 8(%rsp) + mov %r15, SE_WORDSIZE* 7(%rsp) +#endif + + /* set xdi and xsi using the input parameters */ +#ifdef LINUX64 + mov %edi, %edi /* it should clear the high 32bit word of RDI */ + /* + * rdi - param 1 (index), rsi - param 2 (ms) + * only use lower 32bit of rdi, rsi remains unchanged. + */ +#endif +#ifdef LINUX32 + mov SE_WORDSIZE*20(%esp), %edi + mov SE_WORDSIZE*21(%esp), %esi +#endif + + /* save ocall index to the stack */ + mov $OCALL_FLAG, %xax + mov %xax, SE_WORDSIZE*4(%xsp) /* save OCALL_FLAG */ + mov %xdi, SE_WORDSIZE*5(%xsp) /* save ocall_index */ + + /* + * save the inside stack context + * push TD.last_sp + * set TD.last_sp = xsp + */ + READ_TD_DATA self_addr + mov %xax, %xbx + + /* call update_ocall_lastsp */ +#ifdef LINUX32 + mov %xsp, (%xsp) +#else + mov %xsp, %xdi +#endif + + call update_ocall_lastsp /* xax: td.last_sp */ + +#ifdef LINUX64 + mov SE_WORDSIZE*12(%xsp), %xdi /* restore xdi */ + mov SE_WORDSIZE*13(%xsp), %xsi /* restore xdi */ +#endif + + /* restore outside stack context */ + mov first_ssa_gpr(%xbx), %xdx + mov ssa_bp_u(%xdx), %xbp + mov ssa_sp_u(%xdx), %xsp + /* + * set EEXIT registers + * return address can be read from the ECALL frame: + * TD.last_sp -> + * ------------- + * | ret_addr | + * | xbp_u | + * | xsp_u | + * | ... | + */ + mov -1*SE_WORDSIZE(%xax), %xbx /* return address */ + mov $SE_EEXIT, %xax /* EEXIT leaf */ + + /* Clear all GPRs, except xax, xbx, xdi, and xsi*/ + xor %xcx, %xcx + xor %xdx, %xdx +#ifdef LINUX64 + xor %r8, %r8 + xor %r9, %r9 + xor %r10, %r10 + xor %r11, %r11 + xor %r12, %r12 + xor %r13, %r13 + xor %r14, %r14 + xor %r15, %r15 +#endif + + /* Set status flags to pre-defined values */ + add %xdx, %xdx /* OF = SF = AF = CF = 0; ZF = PF = 1 */ + + ENCLU + +/* + * ------------------------------------------------------------------ + * this function is the wrapper of do_ocall, which is used to + * stick ocall bridge and proxy frame together + * ------------------------------------------------------------------ + */ +DECLARE_LOCAL_FUNC __morestack + .cfi_startproc + push %xbp + .cfi_def_cfa_offset 2*SE_WORDSIZE + .cfi_offset xbp,-2*SE_WORDSIZE + mov %xsp, %xbp + .cfi_def_cfa_register xbp + sub $(4*SE_WORDSIZE), %xsp +#ifdef LINUX32 + /* save the 2 parameters */ + mov (2*SE_WORDSIZE)(%xbp), %xax + mov %xax, (0*SE_WORDSIZE)(%xsp) + mov (3*SE_WORDSIZE)(%xbp), %xax + mov %xax, (1*SE_WORDSIZE)(%xsp) +#endif + call do_ocall + leave + ret + .cfi_endproc + +DECLARE_GLOBAL_FUNC asm_oret +#ifdef LINUX32 + mov SE_WORDSIZE(%xsp), %xdi + mov 2*SE_WORDSIZE(%xsp), %xsi +#endif + mov %xdi, %xsp /* restore thread_data.last_sp */ + mov %xsi, %xax /* ocall return value */ +#ifdef LINUX64 + mov 7*SE_WORDSIZE(%xsp), %r15 + mov 8*SE_WORDSIZE(%xsp), %r14 + mov 9*SE_WORDSIZE(%xsp), %r13 + mov 10*SE_WORDSIZE(%xsp), %r12 +#endif + + mov 11*SE_WORDSIZE(%xsp), %xbp + mov 12*SE_WORDSIZE(%xsp), %xdi + mov 13*SE_WORDSIZE(%xsp), %xsi + mov 14*SE_WORDSIZE(%xsp), %xbx + + add $(19*SE_WORDSIZE), %xsp + + ret + /* should not come here */ + ud2 + +/* + * ------------------------------------------------------------------------ + * extern "C" int do_egetkey(key_request_t *key_request, key_128bit_t *key) + * return value: + * 0 - success + * none-zeor - EGETKEY error code + * EGETKEY: rbx - the address of KEYREQUEST structure + * rcx - the address where the key is outputted + * ------------------------------------------------------------------------ + */ +DECLARE_LOCAL_FUNC do_egetkey + SE_PROLOG + mov $SE_EGETKEY, %xax /* EGETKEY leaf */ + ENCLU +#ifdef SE_SIM + cmp $SGX_SUCCESS, %xax /* In simulation mode, ZF flag will not be set */ + jnz .Legetkey_done /* because the stack clean operation will always clean ZF flag */ +#else + jz .Legetkey_done /* if EGETKEY error, ZF flag is set and error code is set to xax */ +#endif + xor %xax, %xax +.Legetkey_done: + SE_EPILOG + ret + + +/* + * ------------------------------------------------------------------------- + * extern "C" void do_ereport(sgx_target_info_t *target_info, sgx_report_data_t *report_data, sgx_report_t *report); + * EREPORT: rbx - the address of TARGETINFO; + * rcx - the address of REPORTDATA; + * rdx - the address where REPORT is outputted + * ------------------------------------------------------------------------- + */ +DECLARE_LOCAL_FUNC do_ereport + SE_PROLOG + mov $SE_EREPORT, %xax /* EREPORT leaf */ + ENCLU + SE_EPILOG + ret + +#define _RDRAND_RETRY_TIMES 10 +/* + * ------------------------------------- + * extern "C" uint32_t do_rdrand(uint32_t *rand); + * return value: + * non-zero: rdrand succeeded + * zero: rdrand failed + * ------------------------------------- + */ +DECLARE_LOCAL_FUNC do_rdrand + mov $_RDRAND_RETRY_TIMES, %ecx +.Lrdrand_retry: + .byte 0x0F, 0xC7, 0xF0 /* rdrand %eax */ + jc .Lrdrand_return + dec %ecx + jnz .Lrdrand_retry + xor %xax, %xax + ret +.Lrdrand_return: +#ifdef LINUX32 + mov SE_WORDSIZE(%esp), %ecx +#else + mov %rdi, %rcx +#endif + movl %eax, (%xcx) + mov $1, %xax + ret + +/* + * ------------------------------------------------------------------------- + * extern "C" void abort(void) __attribute__(__noreturn__); + * ------------------------------------------------------------------------- + */ +DECLARE_LOCAL_FUNC abort + lea_pic g_enclave_state, %xax + movl $ENCLAVE_CRASHED, (%xax) + ud2 + +/* + * ------------------------------------------------------------------------- + * extern "C" __attribute__((regparm(1))) void continue_execution(sgx_exception_info_t *info); + * ------------------------------------------------------------------------- + */ +DECLARE_LOCAL_FUNC continue_execution +#ifdef LINUX32 + mov %xax, %xcx +#else + mov %xdi, %xcx +#endif + mov SE_WORDSIZE*4(%xcx), %xdx + mov %xdx, %xsp + sub $(SE_WORDSIZE), %xsp +#ifdef LINUX64 + mov SE_WORDSIZE*17(%xcx), %xax +#else + mov SE_WORDSIZE*9(%xcx), %xax +#endif + mov %xax, (%xsp) + mov SE_WORDSIZE*0(%xcx), %xax + mov SE_WORDSIZE*2(%xcx), %xdx + mov SE_WORDSIZE*3(%xcx), %xbx + mov SE_WORDSIZE*5(%xcx), %xbp + mov SE_WORDSIZE*6(%xcx), %xsi + mov SE_WORDSIZE*7(%xcx), %xdi +#ifdef LINUX64 + mov SE_WORDSIZE*8(%xcx), %xsi + mov SE_WORDSIZE*9(%xcx), %xsi + mov SE_WORDSIZE*10(%xcx), %xsi + mov SE_WORDSIZE*11(%xcx), %xsi + mov SE_WORDSIZE*12(%xcx), %xsi + mov SE_WORDSIZE*13(%xcx), %xsi + mov SE_WORDSIZE*14(%xcx), %xsi + mov SE_WORDSIZE*15(%xcx), %xsi + push SE_WORDSIZE*16(%xcx) + popf +#else + push SE_WORDSIZE*8(%xcx) + popf +#endif + mov SE_WORDSIZE*1(%xcx), %xcx + ret diff --git a/sdk/trts/linux/trts_pic.h b/sdk/trts/linux/trts_pic.h new file mode 100644 index 0000000000..2f0484d530 --- /dev/null +++ b/sdk/trts/linux/trts_pic.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/* + * This header contains constant definitions for tRTS. + */ + +#ifndef TRTS_PIC_H__ +#define TRTS_PIC_H__ + +#include "linux/linux-regs.h" +#include "rts_cmd.h" + +#define SE_GUARD_PAGE_SIZE 0x1000 + +#define ENCLAVE_INIT_NOT_STARTED 0 +#define ENCLAVE_INIT_IN_PROGRESS 1 +#define ENCLAVE_INIT_DONE 2 +#define ENCLAVE_CRASHED 3 + +/* Status */ +#define SGX_SUCCESS 0 +#define SGX_ERROR_UNEXPECTED 0x000000001 // Unexpected error +#define SGX_ERROR_INVALID_FUNCTION 0x000001001 // Invalid ecall/ocall function +#define SGX_ERROR_INVALID_ENCLAVE 0x000002001 // The enclave image is incorrect +#define SGX_ERROR_ENCLAVE_CRASHED 0x000001006 // enclave is crashed +#define SGX_ERROR_STACK_OVERRUN 0x000001009 // enclave is running out of stack + +#define STATIC_STACK_SIZE (SE_WORDSIZE * 100) + +/* Thread Data + * c.f. data structure defintion for thread_data_t in `rts.h'. + */ +#define last_sp (SE_WORDSIZE * 1) +#define stack_base_addr (SE_WORDSIZE * 2) +#define stack_limit_addr (SE_WORDSIZE * 3) +#define first_ssa_gpr (SE_WORDSIZE * 4) +#define self_addr 0 + +/* SSA GPR */ +#define ssa_sp_t 32 +#define ssa_sp_u 144 +#define ssa_bp_u 152 +#define ssa_exit_info 160 +#endif + +#define EXIT_INFO_VALID 0x80000000 +/* OCALL command */ +#define OCALL_FLAG 0x04F434944 + +#define dtv SE_WORDSIZE +#define tls 0 +.macro READ_TD_DATA offset +#ifdef SE_SIM +/* TLS support in simulation mode + * see "sdk/simulation/uinst/linux/set_tls.c" + * and "sdk/simulation/assembly/linux/gnu_tls.h" + * TD address (tcs->ofs_base) is set to tcb_head->dtv->value. + * The offset of tcb_head->dtv->value is SE_WORDSIZE. + */ + +#if defined(LINUX32) + mov %gs:dtv, %xax +#elif defined(LINUX64) + mov %fs:dtv, %xax +#endif + mov tls(%xax), %xax + mov \offset(%xax), %xax + +#else /* SE_SIM */ + +#if defined(LINUX32) + mov %fs:\offset, %xax +#elif defined(LINUX64) + mov %gs:\offset, %xax +#endif + +#endif /* !SE_SIM */ +.endm + +.macro GET_STACK_BASE tcs + mov \tcs, %xax + sub $SE_GUARD_PAGE_SIZE, %xax +.endm diff --git a/sdk/trts/linux/x86/Makefile b/sdk/trts/linux/x86/Makefile new file mode 100644 index 0000000000..414f0063db --- /dev/null +++ b/sdk/trts/linux/x86/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +CPPFLAGS += -I$(LINUX_SDK_DIR)/cpprt/linux/libunwind/src/x86 +OBJS := setcontext.o + +.PHONY: all +all: $(OBJS) + +$(OBJS): %.o: %.S + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + @$(RM) *.o diff --git a/sdk/trts/linux/x86/setcontext.S b/sdk/trts/linux/x86/setcontext.S new file mode 100644 index 0000000000..1b90fc0732 --- /dev/null +++ b/sdk/trts/linux/x86/setcontext.S @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "offsets.h" + + .global setcontext + .type setcontext, @function +setcontext: + movl 4(%esp),%eax /* ucontext_t* */ + + /* restore FP state */ + movl LINUX_UC_FPREGS_PTR_OFF(%eax), %ecx + fldenv (%ecx) + +#ifdef SE_SIM + /* restore FS */ + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_FS_OFF)(%eax), %ecx + + movl %ecx, %fs +#endif + + /* new stack */ + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ESP_OFF)(%eax), %esp + + /* push the return address on the stack */ + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EIP_OFF)(%eax), %ecx + pushl %ecx + + /* restore GPRs */ + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EDI_OFF)(%eax), %edi + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ESI_OFF)(%eax), %esi + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EBP_OFF)(%eax), %ebp + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EBX_OFF)(%eax), %ebx + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EDX_OFF)(%eax), %edx + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_ECX_OFF)(%eax), %ecx + movl (LINUX_UC_MCONTEXT_OFF+LINUX_SC_EAX_OFF)(%eax), %eax + + ret diff --git a/sdk/trts/linux/x86_64/Makefile b/sdk/trts/linux/x86_64/Makefile new file mode 100644 index 0000000000..74b347ad3b --- /dev/null +++ b/sdk/trts/linux/x86_64/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../../buildenv.mk + +CPPFLAGS += -I$(LINUX_SDK_DIR)/cpprt/linux/libunwind/src/x86_64 +CFLAGS += -DISE=1 +OBJS := setcontext.o + +$(OBJS): %.o: %.S + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + +.PHONY: all +all: $(OBJS) + +.PHONY: clean +clean: + @$(RM) *.o diff --git a/sdk/trts/linux/x86_64/setcontext.S b/sdk/trts/linux/x86_64/setcontext.S new file mode 100644 index 0000000000..a43fbf3648 --- /dev/null +++ b/sdk/trts/linux/x86_64/setcontext.S @@ -0,0 +1,117 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2007 Google, Inc + Contributed by Arun Sharma + Copyright (C) 2010 Konstantin Belousov + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "ucontext_i.h" +#if (!ISE) +#if defined __linux__ +#include +#define SIG_SETMASK 2 +#define SIGSET_BYTE_SIZE (64/8) +#elif defined __FreeBSD__ +#include +#endif +#endif + +/* int _Ux86_64_setcontext (const ucontext_t *ucp) + + Restores the machine context provided. + Unlike the libc implementation, doesn't clobber %rax + +*/ + .global _Ux86_64_setcontext + .type _Ux86_64_setcontext, @function + +_Ux86_64_setcontext: + +#if defined __linux__ +#if (!ISE) + /* restore signal mask + sigprocmask(SIG_SETMASK, ucp->uc_sigmask, NULL, sizeof(sigset_t)) */ + push %rdi + mov $__NR_rt_sigprocmask, %rax + lea UC_SIGMASK(%rdi), %rsi + mov $SIG_SETMASK, %rdi + xor %rdx, %rdx + mov $SIGSET_BYTE_SIZE, %r10 + syscall + pop %rdi +#endif + + /* restore fp state */ + mov UC_MCONTEXT_FPREGS_PTR(%rdi),%r8 + fldenv (%r8) + ldmxcsr FPREGS_OFFSET_MXCSR(%r8) +#elif defined __FreeBSD__ +#if (!ISE) + /* restore signal mask */ + pushq %rdi + xorl %edx,%edx + leaq UC_SIGMASK(%rdi),%rsi + movl $3,%edi/* SIG_SETMASK */ + movl $SYS_sigprocmask,%eax + movq %rcx,%r10 + syscall + popq %rdi +#endif + + /* restore fp state */ + cmpq $UC_MCONTEXT_FPOWNED_FPU,UC_MCONTEXT_OWNEDFP(%rdi) + jne 1f + cmpq $UC_MCONTEXT_FPFMT_XMM,UC_MCONTEXT_FPFORMAT(%rdi) + jne 1f + fxrstor UC_MCONTEXT_FPSTATE(%rdi) +1: +#else +#error Port me +#endif + + /* restore the rest of the state */ + mov UC_MCONTEXT_GREGS_R8(%rdi),%r8 + mov UC_MCONTEXT_GREGS_R9(%rdi),%r9 + mov UC_MCONTEXT_GREGS_RBX(%rdi),%rbx + mov UC_MCONTEXT_GREGS_RBP(%rdi),%rbp + mov UC_MCONTEXT_GREGS_R12(%rdi),%r12 + mov UC_MCONTEXT_GREGS_R13(%rdi),%r13 + mov UC_MCONTEXT_GREGS_R14(%rdi),%r14 + mov UC_MCONTEXT_GREGS_R15(%rdi),%r15 + mov UC_MCONTEXT_GREGS_RSI(%rdi),%rsi + mov UC_MCONTEXT_GREGS_RDX(%rdi),%rdx + mov UC_MCONTEXT_GREGS_RAX(%rdi),%rax + mov UC_MCONTEXT_GREGS_RCX(%rdi),%rcx + mov UC_MCONTEXT_GREGS_RSP(%rdi),%rsp + + /* push the return address on the stack */ + mov UC_MCONTEXT_GREGS_RIP(%rdi),%rcx + push %rcx + + mov UC_MCONTEXT_GREGS_RCX(%rdi),%rcx + mov UC_MCONTEXT_GREGS_RDI(%rdi),%rdi + retq + + .size _Ux86_64_setcontext, . - _Ux86_64_setcontext + + /* We do not need executable stack. */ + .section .note.GNU-stack,"",@progbits diff --git a/sdk/trts/trts.cpp b/sdk/trts/trts.cpp new file mode 100644 index 0000000000..f48ec2f1ea --- /dev/null +++ b/sdk/trts/trts.cpp @@ -0,0 +1,323 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "sgx_trts.h" +#include "sgx_edger8r.h" +#include "trts_inst.h" +#include +#include +#include "util.h" +#include "thread_data.h" +#include "global_data.h" + +#include "internal/rts.h" + +#ifdef SE_SIM +#include "t_instructions.h" /* for `g_global_data_sim' */ +#include "sgx_spinlock.h" +#endif + + + +#ifndef SE_SIM + +#include "se_cdefs.h" + +// add a version to trts +SGX_ACCESS_VERSION(trts, 1); + +#endif + +// sgx_is_within_enclave() +// Parameters: +// addr - the start address of the buffer +// size - the size of the buffer +// Return Value: +// 1 - the buffer is strictly within the enclave +// 0 - the whole buffer or part of the buffer is not within the enclave, +// or the buffer is wrap around +// +int sgx_is_within_enclave(const void *addr, size_t size) +{ + size_t start = reinterpret_cast(addr); + size_t end = 0; + size_t enclave_start = (size_t)&__ImageBase; + size_t enclave_end = enclave_start + g_global_data.enclave_size - 1; + // g_global_data.enclave_end = enclave_base + enclave_size - 1; + // so the enclave range is [enclave_start, enclave_end] inclusively + + if(size > 0) + { + end = start + size - 1; + } + else + { + end = start; + } + if( (start <= end) && (start >= enclave_start) && (end <= enclave_end) ) + { + return 1; + } + return 0; +} + +// sgx_is_outside_enclave() +// Parameters: +// addr - the start address of the buffer +// size - the size of the buffer +// Return Value: +// 1 - the buffer is strictly outside the enclave +// 0 - the whole buffer or part of the buffer is not outside the enclave, +// or the buffer is wrap around +// +int sgx_is_outside_enclave(const void *addr, size_t size) +{ + size_t start = reinterpret_cast(addr); + size_t end = 0; + size_t enclave_start = (size_t)&__ImageBase; + size_t enclave_end = enclave_start + g_global_data.enclave_size - 1; + // g_global_data.enclave_end = enclave_base + enclave_size - 1; + // so the enclave range is [enclave_start, enclave_end] inclusively + + if(size > 0) + { + end = start + size - 1; + } + else + { + end = start; + } + if( (start <= end) && ((end < enclave_start) || (start > enclave_end)) ) + { + return 1; + } + return 0; +} + +// sgx_ocalloc() +// Parameters: +// size - bytes to allocate on the outside stack +// Return Value: +// the pointer to the allocated space on the outside stack +// NULL - fail to allocate +// +// sgx_ocalloc allocates memory on the outside stack. It is only used for OCALL, and will be auto freed when ECALL returns. +// To achieve this, the outside stack pointer in SSA is updated when the stack memory is allocated, +// but the outside stack pointer saved in the ECALL stack frame is not changed accordingly. +// When doing an OCALL, the stack pointer is set as the value in SSA and EEXIT. +// When ECALL or exception handling returns, the stack pointer is set as the value in the ECALL stack frame and then EEXIT, +// so the outside stack is automatically unwind. +// In addition, sgx_ocalloc needs perform outside stack probe to make sure it is not allocating beyond the end of the stack. +#define OC_ROUND 16 +void * sgx_ocalloc(size_t size) +{ + // read the outside stack address from current SSA + thread_data_t *thread_data = get_thread_data(); + ssa_gpr_t *ssa_gpr = reinterpret_cast(thread_data->first_ssa_gpr); + size_t addr = ssa_gpr->REG(sp_u); + + // check u_rsp points to the untrusted address. + // if the check fails, it should be hacked. call abort directly + if(!sgx_is_outside_enclave(reinterpret_cast(addr), sizeof(size_t))) + { + abort(); + } + + // size is too large to allocate. call abort() directly. + if(addr < size) + { + abort(); + } + + // calculate the start address for the allocated memory + addr -= size; + addr &= ~(static_cast(OC_ROUND - 1)); // for stack alignment + + // the allocated memory has overlap with enclave, abort the enclave + if(!sgx_is_outside_enclave(reinterpret_cast(addr), size)) + { + abort(); + } + + // probe the outside stack to ensure that we do not skip over the stack3 guard page + // we need to probe all the pages including the first page and the last page + // the first page need to be probed in case uRTS didnot touch that page before EENTER enclave + // the last page need to be probed in case the enclave didnot touch that page before another OCALLOC + size_t first_page = TRIM_TO_PAGE(ssa_gpr->REG(sp_u) - 1); + size_t last_page = TRIM_TO_PAGE(addr); + + // To avoid the dead-loop in the following for(...) loop. + // Attacker might fake a stack address that is within address 0x4095. + if (last_page == 0) + { + abort(); + } + + // the compiler may optimize the following code to probe the pages in any order + // while we only expect the probe order should be from higher addr to lower addr + // so use volatile to avoid optimization by the compiler + for(volatile size_t page = first_page; page >= last_page; page -= SE_PAGE_SIZE) + { + *reinterpret_cast(page) = 0; + } + + // update the outside stack address in the SSA + ssa_gpr->REG(sp_u) = addr; + + return reinterpret_cast(addr); +} + +// sgx_ocfree() +// Parameters: +// N/A +// Return Value: +// N/A +// sgx_ocfree restores the original outside stack pointer in the SSA. +// Do not call this function if you still need the buffer allocated by sgx_ocalloc within the ECALL. +void sgx_ocfree() +{ + // ECALL stack frame + // last_sp -> | | + // ------------- + // | ret_addr | + // | xbp_u | + // | xsp_u | + + thread_data_t *thread_data = get_thread_data(); + ssa_gpr_t *ssa_gpr = reinterpret_cast(thread_data->first_ssa_gpr); + uintptr_t *addr = reinterpret_cast(thread_data->last_sp); + uintptr_t usp = *(addr - 3); + if(!sgx_is_outside_enclave(reinterpret_cast(usp), sizeof(uintptr_t))) + { + abort(); + } + ssa_gpr->REG(sp_u) = usp; +} + +#ifdef SE_SIM +static sgx_spinlock_t g_seed_lock = SGX_SPINLOCK_INITIALIZER; + +static uint32_t get_rand_lcg() +{ + sgx_spin_lock(&g_seed_lock); + + uint32_t& seed = g_global_data_sim.seed; + seed = seed * 1103515245 + 12345; + uint32_t n = (seed % ((uint32_t)RAND_MAX + 1)); + + sgx_spin_unlock(&g_seed_lock); + + return n; +} +#endif + +static sgx_status_t __do_get_rand32(uint32_t* rand_num) +{ +#ifndef SE_SIM + /* We expect the CPU has RDRAND support for HW mode. Otherwise, an exception will be thrown + * do_rdrand() will try to call RDRAND for 10 times + */ + if(0 == do_rdrand(rand_num)) + return SGX_ERROR_UNEXPECTED; +#else + /* use LCG in simulation mode */ + *rand_num = get_rand_lcg(); +#endif + return SGX_SUCCESS; +} + +sgx_status_t sgx_read_rand(unsigned char *rand, size_t length_in_bytes) +{ + // check parameters + // + // rand can be within or outside the enclave + if(!rand || !length_in_bytes) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if(!sgx_is_within_enclave(rand, length_in_bytes) && !sgx_is_outside_enclave(rand, length_in_bytes)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // loop to rdrand + uint32_t rand_num = 0; + while(length_in_bytes > 0) + { + sgx_status_t status = __do_get_rand32(&rand_num); + if(status != SGX_SUCCESS) + { + return status; + } + + size_t size = (length_in_bytes < sizeof(rand_num)) ? length_in_bytes : sizeof(rand_num); + memcpy(rand, &rand_num, size); + + rand += size; + length_in_bytes -= size; + } + memset_s(&rand_num, sizeof(rand_num), 0, sizeof(rand_num)); + return SGX_SUCCESS; +} + +#include "trts_internal.h" +extern "C" int enter_enclave(int index, void *ms, void *tcs, int cssa) +{ + if(get_enclave_state() == ENCLAVE_CRASHED) + { + return SGX_ERROR_ENCLAVE_CRASHED; + } + + sgx_status_t error = SGX_ERROR_UNEXPECTED; + if(cssa == 0) + { + if(index >= 0) + { + error = do_ecall(index, ms, tcs); + } + else if(index == ECMD_INIT_ENCLAVE) + { + error = do_init_enclave(ms); + } + else if(index == ECMD_ORET) + { + error = do_oret(ms); + } + } + else if((cssa == 1) && (index == ECMD_EXCEPT)) + { + error = trts_handle_exception(tcs); + } + if(error == SGX_ERROR_UNEXPECTED) + { + set_enclave_state(ENCLAVE_CRASHED); + } + return error; +} diff --git a/sdk/trts/trts_ecall.cpp b/sdk/trts/trts_ecall.cpp new file mode 100644 index 0000000000..4612ccc4ae --- /dev/null +++ b/sdk/trts/trts_ecall.cpp @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_memcpy.h" +#include "thread_data.h" +#include "global_data.h" +#include "rts.h" +#include "util.h" +#include "xsave.h" +#include "sgx_trts.h" +#include "sgx_spinlock.h" +#include "global_init.h" +#include "trts_internal.h" + +# include "linux/elf_parser.h" +# define GET_TLS_INFO elf_tls_info + +// is_ecall_allowed() +// check the index in the dynamic entry table +static sgx_status_t is_ecall_allowed(uint32_t ordinal) +{ + if(ordinal >= g_ecall_table.nr_ecall) + { + return SGX_ERROR_INVALID_FUNCTION; + } + thread_data_t *thread_data = get_thread_data(); + if(thread_data->last_sp == thread_data->stack_base_addr) + { + // root ECALL, check the priv bits. + if (g_ecall_table.ecall_table[ordinal].is_priv) + return SGX_ERROR_ECALL_NOT_ALLOWED; + return SGX_SUCCESS; + } + ocall_context_t *context = reinterpret_cast(thread_data->last_sp); + if(context->ocall_flag != OCALL_FLAG) + { + // abort the enclave if ocall frame is invalid + abort(); + } + uintptr_t ocall_index = context->ocall_index; + if(ocall_index >= g_dyn_entry_table.nr_ocall) + { + return SGX_ERROR_INVALID_FUNCTION; + } + return (g_dyn_entry_table.entry_table[ocall_index * g_ecall_table.nr_ecall + ordinal] ? SGX_SUCCESS : SGX_ERROR_ECALL_NOT_ALLOWED); +} +// get_func_addr() +// Get the address of ecall function from the ecall table +// Parameters: +// [IN] ordinal - the index of the ecall function in the ecall table +// Return Value: +// non-zero - success +// zero - fail +// +static sgx_status_t get_func_addr(uint32_t ordinal, void **addr) +{ + sgx_status_t status = is_ecall_allowed(ordinal); + if(SGX_SUCCESS != status) + { + return status; + } + + *addr = const_cast(g_ecall_table.ecall_table[ordinal].ecall_addr); + if(!sgx_is_within_enclave(*addr, 0)) + { + return SGX_ERROR_UNEXPECTED; + } + + return SGX_SUCCESS; +} + +static volatile bool g_is_first_ecall = true; +static volatile sgx_spinlock_t g_ife_lock = SGX_SPINLOCK_INITIALIZER; + +typedef sgx_status_t (*ecall_func_t)(void *ms); +static sgx_status_t trts_ecall(uint32_t ordinal, void *ms) +{ + if (unlikely(g_is_first_ecall)) + { + // The thread performing the global initialization cannot do a nested ECall + thread_data_t *thread_data = get_thread_data(); + if (thread_data->last_sp != thread_data->stack_base_addr) + { // nested ecall + return SGX_ERROR_ECALL_NOT_ALLOWED; + } + + sgx_spin_lock(&g_ife_lock); + if (g_is_first_ecall) + { + //invoke global object's construction + init_global_object(); + g_is_first_ecall = false; + } + sgx_spin_unlock(&g_ife_lock); + } + + void *addr = NULL; + sgx_status_t status = get_func_addr(ordinal, &addr); + if(status == SGX_SUCCESS) + { + ecall_func_t func = (ecall_func_t)addr; + status = func(ms); + } + + // clean extended registers, no need to save + CLEAN_XFEATURE_REGS + return status; +} + +extern "C" void init_stack_guard(); +static sgx_status_t do_init_thread(void *tcs) +{ + thread_data_t *thread_data = GET_PTR(thread_data_t, tcs, g_global_data.td_template.self_addr); + memcpy_s(thread_data, SE_PAGE_SIZE, const_cast(&g_global_data.td_template), sizeof(thread_data_t)); + thread_data->last_sp += (size_t)tcs; + thread_data->self_addr += (size_t)tcs; + thread_data->stack_base_addr += (size_t)tcs; + thread_data->stack_limit_addr += (size_t)tcs; + thread_data->first_ssa_gpr += (size_t)tcs; + thread_data->tls_array += (size_t)tcs; + thread_data->tls_addr += (size_t)tcs; + + thread_data->last_sp -= (size_t)STATIC_STACK_SIZE; + thread_data->stack_base_addr -= (size_t)STATIC_STACK_SIZE; + + uintptr_t tls_addr = 0; + size_t tdata_size = 0; + + if(0 != GET_TLS_INFO(&__ImageBase, &tls_addr, &tdata_size)) + { + return SGX_ERROR_UNEXPECTED; + } + if(tls_addr) + { + memset((void *)TRIM_TO_PAGE(thread_data->tls_addr), 0, ROUND_TO_PAGE(thread_data->self_addr - thread_data->tls_addr)); + memcpy_s((void *)(thread_data->tls_addr), thread_data->self_addr - thread_data->tls_addr, (void *)tls_addr, tdata_size); + } + init_stack_guard(); + return SGX_SUCCESS; +} +sgx_status_t do_ecall(int index, void *ms, void *tcs) +{ + sgx_status_t status = SGX_ERROR_UNEXPECTED; + if(ENCLAVE_INIT_DONE != get_enclave_state()) + { + return status; + } + thread_data_t *thread_data = get_thread_data(); + if( (NULL == thread_data) || ((thread_data->stack_base_addr == thread_data->last_sp) && (0 != g_global_data.thread_policy))) + { + status = do_init_thread(tcs); + if(0 != status) + { + return status; + } + } + status = trts_ecall(index, ms); + return status; +} + diff --git a/sdk/trts/trts_internal.h b/sdk/trts/trts_internal.h new file mode 100644 index 0000000000..6c781c5d54 --- /dev/null +++ b/sdk/trts/trts_internal.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef TRTS_INTERNAL_H +#define TRTS_INTERNAL_H + +#include "util.h" + +#ifdef SE_64 +#define STATIC_STACK_SIZE 8*100 +#else +#define STATIC_STACK_SIZE 4*100 +#endif + +#define TD2TCS(td) ((const void *)(((thread_data_t*)(td))->stack_base_addr + (size_t)STATIC_STACK_SIZE + (size_t)SE_GUARD_PAGE_SIZE)) + +typedef struct { + const void *ecall_addr; + uint8_t is_priv; +} ecall_addr_t; + +typedef struct { + size_t nr_ecall; + ecall_addr_t ecall_table[1]; +} ecall_table_t; + +typedef struct { + size_t nr_ocall; + uint8_t entry_table[1]; +} entry_table_t; + + +#ifdef __cplusplus +extern "C" { +#endif +extern ecall_table_t g_ecall_table; +extern entry_table_t g_dyn_entry_table; + +int lock_enclave(); +void *get_enclave_base(); +int get_enclave_state(); +void set_enclave_state(int state); + +sgx_status_t do_init_enclave(void *ms); +sgx_status_t do_ecall(int index, void *ms, void *tcs); +sgx_status_t do_oret(void *ms); +sgx_status_t trts_handle_exception(void *tcs); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/trts/trts_ocall.cpp b/sdk/trts/trts_ocall.cpp new file mode 100644 index 0000000000..7d08783e59 --- /dev/null +++ b/sdk/trts/trts_ocall.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include +#include "thread_data.h" +#include "global_data.h" +#include "sgx_edger8r.h" +#include "rts.h" +#include "util.h" +#include "xsave.h" +#include "trts_internal.h" + +extern "C" sgx_status_t asm_oret(uintptr_t sp, void *ms); +extern "C" sgx_status_t __morestack(const unsigned int index, void *ms); +#define do_ocall __morestack + +// +// sgx_ocall +// Parameters: +// index - the index in the ocall table +// ms - the mashalling structure +// Return Value: +// OCALL status +// +sgx_status_t sgx_ocall(const unsigned int index, void *ms) +{ + // sgx_ocall is not allowed during exception handling + thread_data_t *thread_data = get_thread_data(); + + // we have exceptions being handled + if(thread_data->exception_flag != 0) { + return SGX_ERROR_OCALL_NOT_ALLOWED; + } + // the OCALL index should be within the ocall table range + if(static_cast(index) >= g_dyn_entry_table.nr_ocall) + { + return SGX_ERROR_INVALID_FUNCTION; + } + // save and clean extended feature registers + uint8_t buffer[FXSAVE_SIZE] = {0}; + save_and_clean_xfeature_regs(buffer); + + // do sgx_ocall + sgx_status_t status = do_ocall(index, ms); + + // restore extended feature registers + restore_xfeature_regs(buffer); + + // clear buffer to avoid secret leaking + memset_s(buffer, FXSAVE_SIZE, 0, FXSAVE_SIZE); + + return status; +} + +extern "C" +uintptr_t update_ocall_lastsp(ocall_context_t* context) +{ + thread_data_t* thread_data = get_thread_data(); + + uintptr_t last_sp = 0; + + last_sp = thread_data->last_sp; + + context->pre_last_sp = last_sp; + + if (context->pre_last_sp == thread_data->stack_base_addr) + { + context->ocall_depth = 1; + } else { + // thread_data->last_sp is only set when ocall or exception handling occurs + // ocall is block during exception handling, so last_sp is always ocall frame here + ocall_context_t* context_pre = reinterpret_cast(context->pre_last_sp); + context->ocall_depth = context_pre->ocall_depth + 1; + } + + thread_data->last_sp = reinterpret_cast(context); + + return last_sp; +} + +sgx_status_t do_oret(void *ms) +{ + thread_data_t *thread_data = get_thread_data(); + uintptr_t last_sp = thread_data->last_sp; + ocall_context_t *context = reinterpret_cast(thread_data->last_sp); + if(0 == last_sp) + { + return SGX_ERROR_UNEXPECTED; + } + // At least 1 ecall frame and 1 ocall frame are expected on stack. + // 30 is an estimated value: 8 for enclave_entry and 22 for do_ocall. + if(last_sp > thread_data->stack_base_addr - 30 * sizeof(size_t)) + { + goto invalid_ocall_frame; + } + if(context->ocall_flag != OCALL_FLAG) + { + goto invalid_ocall_frame; + } + if(context->pre_last_sp > thread_data->stack_base_addr) + { + goto invalid_ocall_frame; + } + if(context->pre_last_sp <= (uintptr_t)&context) + { + goto invalid_ocall_frame; + } + thread_data->last_sp = context->pre_last_sp; + asm_oret(last_sp, ms); + +invalid_ocall_frame: + return SGX_ERROR_UNEXPECTED; +} + diff --git a/sdk/trts/trts_util.cpp b/sdk/trts/trts_util.cpp new file mode 100644 index 0000000000..9e86f5c75d --- /dev/null +++ b/sdk/trts/trts_util.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "trts_util.h" +#include "global_data.h" +#include "util.h" +#include "thread_data.h" + +// No need to check the state of enclave or thread. +// The functions should be called within an ECALL, so the enclave and thread must be initialized at that time. +void * get_heap_base(void) +{ + return GET_PTR(void, &__ImageBase, g_global_data.heap_offset); +} + +size_t get_heap_size(void) +{ + return g_global_data.heap_size; +} + +int * get_errno_addr(void) +{ + thread_data_t *thread_data = get_thread_data(); + return reinterpret_cast(&thread_data->last_error); +} + diff --git a/sdk/trts/trts_util.h b/sdk/trts/trts_util.h new file mode 100644 index 0000000000..a6e440aaad --- /dev/null +++ b/sdk/trts/trts_util.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _TRTS_UTIL_H_ +#define _TRTS_UTIL_H_ + +#include /* for size_t */ +#include "se_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void * get_heap_base(void); +size_t get_heap_size(void); +int * get_errno_addr(void); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/sdk/trts/trts_veh.cpp b/sdk/trts/trts_veh.cpp new file mode 100644 index 0000000000..c338d82c9d --- /dev/null +++ b/sdk/trts/trts_veh.cpp @@ -0,0 +1,395 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +/** + * File: trts_veh.cpp + * Description: + * This file implements the support of custom exception handling. + */ + +#include "sgx_trts_exception.h" +#include +#include "sgx_trts.h" +#include "xsave.h" +#include "arch.h" +#include "sgx_spinlock.h" +#include "thread_data.h" +#include "global_data.h" +#include "trts_internal.h" + +typedef struct _handler_node_t +{ + uintptr_t callback; + struct _handler_node_t *next; +} handler_node_t; + +static handler_node_t *g_first_node = NULL; +static sgx_spinlock_t g_handler_lock = SGX_SPINLOCK_INITIALIZER; + +static uintptr_t g_veh_cookie = 0; +#define ENC_VEH_POINTER(x) (uintptr_t)(x) ^ g_veh_cookie +#define DEC_VEH_POINTER(x) (sgx_exception_handler_t)((x) ^ g_veh_cookie) + +static bool is_stack_addr(void *address, size_t size) +{ + thread_data_t *thread_data = get_thread_data(); + size_t stack_base = thread_data->stack_base_addr; + size_t stack_top = thread_data->stack_limit_addr; + size_t addr = (size_t) address; + return (addr <= (addr + size)) && (stack_base >= (addr + size)) && (stack_top <= addr); +} +static bool is_valid_sp(uintptr_t sp) +{ + return ( !(sp & (sizeof(uintptr_t) - 1)) // sp is expected to be 4/8 bytes aligned + && is_stack_addr((void*)sp, 0) ); // sp points to the top/bottom of stack are accepted +} + +// sgx_register_exception_handler() +// register a custom exception handler +// Parameter +// is_first_handler - the order in which the handler should be called. +// if the parameter is nonzero, the handler is the first handler to be called. +// if the parameter is zero, the handler is the last handler to be called. +// exception_handler - a pointer to the handler to be called. +// Return Value +// handler - success +// NULL - fail +void *sgx_register_exception_handler(int is_first_handler, sgx_exception_handler_t exception_handler) +{ + // initialize g_veh_cookie for the first time sgx_register_exception_handler is called. + if(unlikely(g_veh_cookie == 0)) + { + uintptr_t rand = 0; + do + { + if(SGX_SUCCESS != sgx_read_rand((unsigned char *)&rand, sizeof(rand))) + { + return NULL; + } + } while(rand == 0); + + sgx_spin_lock(&g_handler_lock); + if(g_veh_cookie == 0) + { + g_veh_cookie = rand; + } + sgx_spin_unlock(&g_handler_lock); + } + if(!sgx_is_within_enclave((const void*)exception_handler, 0)) + { + return NULL; + } + handler_node_t *node = (handler_node_t *)malloc(sizeof(handler_node_t)); + if(!node) + { + return NULL; + } + node->callback = ENC_VEH_POINTER(exception_handler); + + // write lock + sgx_spin_lock(&g_handler_lock); + + if((g_first_node == NULL) || is_first_handler) + { + node->next = g_first_node; + g_first_node = node; + } + else + { + handler_node_t *tmp = g_first_node; + while(tmp->next != NULL) + { + tmp = tmp->next; + } + node->next = NULL; + tmp->next = node; + } + // write unlock + sgx_spin_unlock(&g_handler_lock); + + return node; +} +// sgx_unregister_exception_handler() +// unregister a custom exception handler. +// Parameter +// handler - a handler to the custom exception handler previously +// registered using the sgx_register_exception_handler function. +// Return Value +// none zero - success +// 0 - fail +int sgx_unregister_exception_handler(void *handler) +{ + if(!handler) + { + return 0; + } + + int status = 0; + + // write lock + sgx_spin_lock(&g_handler_lock); + + if(g_first_node) + { + handler_node_t *node = g_first_node; + if(node == handler) + { + g_first_node = node->next; + status = 1; + } + else + { + while(node->next != NULL) + { + if(node->next == handler) + { + node->next = node->next->next; + status = 1; + break; + } + node = node->next; + } + } + } + // write unlock + sgx_spin_unlock(&g_handler_lock); + + if(status) free(handler); + return status; +} + +// continue_execution(sgx_exception_info_t *info): +// try to restore the thread context saved in info to current execution context. +extern "C" __attribute__((regparm(1))) void continue_execution(sgx_exception_info_t *info); + +// internal_handle_exception(sgx_exception_info_t *info): +// the 2nd phrase exception handing, which traverse registered exception handlers. +// if the exception can be handled, then continue execution +// otherwise, throw abortion, go back to 1st phrase, and call the default handler. +extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_exception_info_t *info) +{ + int status = EXCEPTION_CONTINUE_SEARCH; + handler_node_t *node = NULL; + thread_data_t *thread_data = get_thread_data(); + size_t size = 0; + uintptr_t *nhead = NULL; + uintptr_t *ntmp = NULL; + uintptr_t xsp = 0; + + if (thread_data->exception_flag < 0) + goto failed_end; + thread_data->exception_flag++; + + // read lock + sgx_spin_lock(&g_handler_lock); + + node = g_first_node; + while(node != NULL) + { + size += sizeof(uintptr_t); + node = node->next; + } + + if (size == 0 || (nhead = (uintptr_t *)malloc(size)) == NULL) + { + sgx_spin_unlock(&g_handler_lock); + goto failed_end; + } + ntmp = nhead; + node = g_first_node; + while(node != NULL) + { + *ntmp = node->callback; + ntmp++; + node = node->next; + } + + // read unlock + sgx_spin_unlock(&g_handler_lock); + + // call exception handler until EXCEPTION_CONTINUE_EXECUTION is returned + ntmp = nhead; + while(size > 0) + { + sgx_exception_handler_t handler = DEC_VEH_POINTER(*ntmp); + status = handler(info); + if(EXCEPTION_CONTINUE_EXECUTION == status) + { + break; + } + ntmp++; + size -= sizeof(sgx_exception_handler_t); + } + free(nhead); + + // call default handler + // ignore invalid return value, treat to EXCEPTION_CONTINUE_SEARCH + // check SP to be written on SSA is pointing to the trusted stack + xsp = info->cpu_context.REG(sp); + if (!is_valid_sp(xsp)) + { + goto failed_end; + } + + if(EXCEPTION_CONTINUE_EXECUTION == status) + { + //exception is handled, decrease the nested exception count + thread_data->exception_flag--; + } + else + { + //exception cannot be handled + thread_data->exception_flag = -1; + } + + //instruction triggering the exception will be executed again. + continue_execution(info); + +failed_end: + thread_data->exception_flag = -1; // mark the current exception cannot be handled + abort(); // throw abortion +} + +// trts_handle_exception(void *tcs) +// the entry point for the exceptoin handling +// Parameter +// the pointer of TCS +// Return Value +// none zero - success +// 0 - fail +#include "trts_internal.h" +extern "C" sgx_status_t trts_handle_exception(void *tcs) +{ + thread_data_t *thread_data = get_thread_data(); + ssa_gpr_t *ssa_gpr = NULL; + sgx_exception_info_t *info = NULL; + uintptr_t sp, *new_sp = NULL; + size_t size = 0; + + if (tcs == NULL) goto default_handler; + + if(get_enclave_state() != ENCLAVE_INIT_DONE) + { + goto default_handler; + } + + // check if the exception is raised from 2nd phrase + if(thread_data->exception_flag == -1) { + goto default_handler; + } + + if ((TD2TCS(thread_data) != tcs) + || (((thread_data->first_ssa_gpr)&(~0xfff)) - SE_PAGE_SIZE) != (uintptr_t)tcs) { + goto default_handler; + } + + // no need to check the result of ssa_gpr because thread_data is always trusted + ssa_gpr = reinterpret_cast(thread_data->first_ssa_gpr); + + sp = ssa_gpr->REG(sp); + if(!is_stack_addr((void*)sp, 0)) // check stack overrun only, alignment will be checked after exception handled + { + g_enclave_state = ENCLAVE_CRASHED; + return SGX_ERROR_STACK_OVERRUN; + } + + size = 0; +#ifdef SE_GNU64 + size += 128; // preserve stack for red zone (128 bytes) +#endif + + // decrease the stack to give space for info + size += sizeof(sgx_exception_info_t); + sp -= size; + sp = sp & ~0xF; + + // check the decreased sp to make sure it is in the trusted stack range + if(!is_stack_addr((void *)sp, size)) + { + g_enclave_state = ENCLAVE_CRASHED; + return SGX_ERROR_STACK_OVERRUN; + } + + if(ssa_gpr->exit_info.valid != 1) + { // exception handlers are not allowed to call in a non-exception state + goto default_handler; + } + + info = (sgx_exception_info_t *)sp; + + // No need to check the stack as it have already been checked by assembly code + + // initialize the info with SSA[0] + info->exception_vector = (sgx_exception_vector_t)ssa_gpr->exit_info.vector; + info->exception_type = (sgx_exception_type_t)ssa_gpr->exit_info.exit_type; + + info->cpu_context.REG(ax) = ssa_gpr->REG(ax); + info->cpu_context.REG(cx) = ssa_gpr->REG(cx); + info->cpu_context.REG(dx) = ssa_gpr->REG(dx); + info->cpu_context.REG(bx) = ssa_gpr->REG(bx); + info->cpu_context.REG(sp) = ssa_gpr->REG(sp); + info->cpu_context.REG(bp) = ssa_gpr->REG(bp); + info->cpu_context.REG(si) = ssa_gpr->REG(si); + info->cpu_context.REG(di) = ssa_gpr->REG(di); + info->cpu_context.REG(flags) = ssa_gpr->REG(flags); + info->cpu_context.REG(ip) = ssa_gpr->REG(ip); +#ifdef SE_64 + info->cpu_context.r8 = ssa_gpr->r8; + info->cpu_context.r9 = ssa_gpr->r9; + info->cpu_context.r10 = ssa_gpr->r10; + info->cpu_context.r11 = ssa_gpr->r11; + info->cpu_context.r12 = ssa_gpr->r12; + info->cpu_context.r13 = ssa_gpr->r13; + info->cpu_context.r14 = ssa_gpr->r14; + info->cpu_context.r15 = ssa_gpr->r15; +#endif + + // decrease the stack to save the SSA[0]->ip + size = sizeof(uintptr_t); + new_sp = (uintptr_t *)(sp - size); + if(!is_stack_addr(new_sp, size)) + { + g_enclave_state = ENCLAVE_CRASHED; + return SGX_ERROR_STACK_OVERRUN; + } + ssa_gpr->REG(ip) = (size_t)internal_handle_exception; // prepare the ip for 2nd phrase handling + ssa_gpr->REG(sp) = (size_t)new_sp; // new stack for internal_handle_exception + ssa_gpr->REG(ax) = (size_t)info; // 1st parameter (info) for LINUX32 + ssa_gpr->REG(di) = (size_t)info; // 1st parameter (info) for LINUX64, LINUX32 also uses it while restoring the context + *new_sp = info->cpu_context.REG(ip); // for debugger to get call trace + + return SGX_SUCCESS; + +default_handler: + g_enclave_state = ENCLAVE_CRASHED; + return SGX_ERROR_ENCLAVE_CRASHED; +} diff --git a/sdk/trts/trts_version.cpp b/sdk/trts/trts_version.cpp new file mode 100644 index 0000000000..2012e1317e --- /dev/null +++ b/sdk/trts/trts_version.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_TRTS_VERSION_STR __CONCAT("SGX_TRTS_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_trts_version = SGX_TRTS_VERSION_STR; + +#ifdef __cplusplus +} +#endif diff --git a/sdk/trts/trts_xsave.cpp b/sdk/trts/trts_xsave.cpp new file mode 100644 index 0000000000..c7ac543682 --- /dev/null +++ b/sdk/trts/trts_xsave.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "arch.h" +#include "xsave.h" +#include "trts_inst.h" +#include "util.h" + +// 'SYNTHETIC_STATE' buffer size is (512 + 64 + 256) bytes +// 512 for fxsave buffer, +// 64 for xsave header, +// 256 for YMM State (16 * 16 bytes of each YMMH-register) +// and the buffer should be 64 byte aligned. +#define SYNTHETIC_STATE_SIZE (512 + 64 + 256) + +se_static_assert(SYNTHETIC_STATE_SIZE <= SE_PAGE_SIZE); + +static SE_DECLSPEC_ALIGN(4096) const uint16_t +SYNTHETIC_STATE[SYNTHETIC_STATE_SIZE/sizeof(uint16_t)] = { + 0x037F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1F80, 0, 0xFFFF, 0 +}; + +static int g_xsave_enabled; // flag to indicate whether xsave is enabled or not + +// EENTER will set xcr0 with secs.attr.xfrm, +// So use the xfeature mask from report instead of calling xgetbv +uint64_t get_xfeature_state() +{ + // target_info and report_data are useless + // we only need to make sure their alignment and within enclave + // so set the pointers to SYNTHETIC_STATE + sgx_target_info_t *target_info = (sgx_target_info_t *)SYNTHETIC_STATE; + sgx_report_data_t *report_data = (sgx_report_data_t *)SYNTHETIC_STATE; + uint8_t buffer[sizeof(sgx_report_t) + REPORT_ALIGN_SIZE -1] = {0}; + sgx_report_t *report = (sgx_report_t *)ROUND_TO((size_t)buffer, REPORT_ALIGN_SIZE); + + do_ereport(target_info, report_data, report); + + g_xsave_enabled = (report->body.attributes.xfrm == SGX_XFRM_LEGACY) ? 0 : 1; + uint64_t xfrm = report->body.attributes.xfrm; + + // no secrets in target_info, report_data, and report. no need to clear them before return + // tlibc functions cannot be used before calling init_optimized_libs(). + + return xfrm; +} + +// save_and_clean_xfeature_regs() +// do fwait, fxsave, and then clean the extended feature registers +// Parameters: +// buffer - If the pointer is not NULL, save the CPU state to the memory +// Return Value: +// none +void save_and_clean_xfeature_regs(uint8_t *buffer) +{ + do_fwait(); + + if(buffer != 0) + { + uint8_t *buf = (uint8_t*)ROUND_TO((size_t)buffer, FXSAVE_ALIGN_SIZE); + do_fxsave(buf); + } + + if(g_xsave_enabled) + { + do_xrstor(SYNTHETIC_STATE); + } + else + { + do_fxrstor(SYNTHETIC_STATE); + } +} +// restore_xfeature_regs() +// restore the extended feature registers +// +void restore_xfeature_regs(const uint8_t *buffer) +{ + if(buffer != 0) + { + uint8_t *buf = (uint8_t*)ROUND_TO((size_t)buffer, FXSAVE_ALIGN_SIZE); + do_fxrstor(buf); + } +} diff --git a/sdk/tseal/linux/Makefile b/sdk/tseal/linux/Makefile new file mode 100644 index 0000000000..596a0d59c3 --- /dev/null +++ b/sdk/tseal/linux/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../../buildenv.mk + +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -Werror -fno-rtti -fno-exceptions + +CPPFLAGS := -I$(COMMON_DIR)/inc/ \ + -I$(COMMON_DIR)/inc/internal/ \ + -I$(COMMON_DIR)/inc/tlibc \ + -I../ + +OBJ1 := tSeal.o tSeal_aad.o tSeal_internal.o tSeal_util.o +OBJS := $(OBJ1) + +LIBTSEAL := libtSeal.a + +.PHONY: all +all: $(LIBTSEAL) + +$(LIBTSEAL): $(OBJS) + $(AR) rcs $@ $^ + +$(OBJS): %.o: ../%.cpp + $(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(OBJS) $(LIBTSEAL) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/tseal/tSeal.cpp b/sdk/tseal/tSeal.cpp new file mode 100644 index 0000000000..87fac83147 --- /dev/null +++ b/sdk/tseal/tSeal.cpp @@ -0,0 +1,237 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +// tSeal.cpp - Trusted Sealing Routines + +#include "sgx_tseal.h" +#include +#include +#include "sgx_trts.h" +#include "sgx_report.h" +#include "se_cdefs.h" +#include "sgx_utils.h" +#include "tSeal_internal.h" + +extern "C" sgx_status_t sgx_seal_data(const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, const uint32_t text2encrypt_length, + const uint8_t *p_text2encrypt, const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + sgx_attributes_t attribute_mask; + attribute_mask.flags = SGX_FLAGS_RESERVED | SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG; + attribute_mask.xfrm = 0x0; + + err = sgx_seal_data_ex(SGX_KEYPOLICY_MRSIGNER, attribute_mask, TSEAL_DEFAULT_MISCMASK, additional_MACtext_length, + p_additional_MACtext, text2encrypt_length, p_text2encrypt, sealed_data_size, p_sealed_data); + return err; +} + +extern "C" sgx_status_t sgx_seal_data_ex(const uint16_t key_policy, + const sgx_attributes_t attribute_mask, + const sgx_misc_select_t misc_mask, + const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, const uint32_t text2encrypt_length, + const uint8_t *p_text2encrypt, const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + sgx_report_t report; + sgx_key_id_t keyID; + sgx_key_request_t tmp_key_request; + uint8_t payload_iv[SGX_SEAL_IV_SIZE]; + memset(&payload_iv, 0, sizeof(payload_iv)); + + + uint32_t sealedDataSize = sgx_calc_sealed_data_size(additional_MACtext_length,text2encrypt_length); + // Check for overflow + if (sealedDataSize == UINT32_MAX) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // + // Check parameters + // + // check key_request->key_policy reserved bits are not set and one of policy bits are set + if ((key_policy & ~(SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) || + ((key_policy & (SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) == 0)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ( !(attribute_mask.flags & SGX_FLAGS_INITTED) + || !(attribute_mask.flags & SGX_FLAGS_DEBUG) ) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ((additional_MACtext_length > 0) && (p_additional_MACtext == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ((text2encrypt_length == 0) || (p_text2encrypt == NULL) || (!sgx_is_within_enclave(p_text2encrypt,text2encrypt_length))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // Ensure sealed data blob is within an enclave during the sealing process + if ((p_sealed_data == NULL) || (!sgx_is_within_enclave(p_sealed_data,sealed_data_size))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // Ensure aad data does not cross enclave boundary + if ((additional_MACtext_length > 0) && + (!(sgx_is_within_enclave(p_additional_MACtext,additional_MACtext_length) || sgx_is_outside_enclave(p_additional_MACtext, additional_MACtext_length)))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if (sealedDataSize != sealed_data_size) + { + return SGX_ERROR_INVALID_PARAMETER; + } + memset(&report, 0, sizeof(sgx_report_t)); + memset(p_sealed_data, 0, sealedDataSize); + memset(&keyID, 0, sizeof(sgx_key_id_t)); + memset(&tmp_key_request, 0, sizeof(sgx_key_request_t)); + + // Get the report to obtain isv_svn and cpu_svn + err = sgx_create_report(NULL, NULL, &report); + if (err != SGX_SUCCESS) + { + goto clear_return; + } + + // Get a random number to populate the key_id of the key_request + err = sgx_read_rand(reinterpret_cast(&keyID), sizeof(sgx_key_id_t)); + if (err != SGX_SUCCESS) + { + goto clear_return; + } + + memcpy(&(tmp_key_request.cpu_svn), &(report.body.cpu_svn), sizeof(sgx_cpu_svn_t)); + memcpy(&(tmp_key_request.isv_svn), &(report.body.isv_svn), sizeof(sgx_isv_svn_t)); + tmp_key_request.key_name = SGX_KEYSELECT_SEAL; + tmp_key_request.key_policy = key_policy; + tmp_key_request.attribute_mask.flags = attribute_mask.flags; + tmp_key_request.attribute_mask.xfrm = attribute_mask.xfrm; + memcpy(&(tmp_key_request.key_id), &keyID, sizeof(sgx_key_id_t)); + tmp_key_request.misc_mask = misc_mask; + + err = sgx_seal_data_iv(additional_MACtext_length, p_additional_MACtext, + text2encrypt_length, p_text2encrypt, payload_iv, &tmp_key_request, p_sealed_data); + + if (err == SGX_SUCCESS) + { + // Copy data from the temporary key request buffer to the sealed data blob + memcpy(&(p_sealed_data->key_request), &tmp_key_request, sizeof(sgx_key_request_t)); + } +clear_return: + // Clear temp state + memset_s(&report, sizeof(sgx_report_t), 0, sizeof(sgx_report_t)); + memset_s(&keyID, sizeof(sgx_key_id_t), 0, sizeof(sgx_key_id_t)); + return err; +} + +extern "C" sgx_status_t sgx_unseal_data(const sgx_sealed_data_t *p_sealed_data, uint8_t *p_additional_MACtext, + uint32_t *p_additional_MACtext_length, uint8_t *p_decrypted_text, uint32_t *p_decrypted_text_length) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + // Ensure the the sgx_sealed_data_t members are all inside enclave before using them. + if ((p_sealed_data == NULL) || (!sgx_is_within_enclave(p_sealed_data,sizeof(sgx_sealed_data_t)))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + uint32_t encrypt_text_length = sgx_get_encrypt_txt_len(p_sealed_data); + if(encrypt_text_length == UINT32_MAX) + { + return SGX_ERROR_MAC_MISMATCH; // Return error indicating the blob is corrupted + } + uint32_t add_text_length = sgx_get_add_mac_txt_len(p_sealed_data); + if(add_text_length == UINT32_MAX) + { + return SGX_ERROR_MAC_MISMATCH; // Return error indicating the blob is corrupted + } + uint32_t sealedDataSize = sgx_calc_sealed_data_size(add_text_length,encrypt_text_length); + if (sealedDataSize == UINT32_MAX) + { + return SGX_ERROR_MAC_MISMATCH; // Return error indicating the blob is corrupted + } + + // + // Check parameters + // + // Ensure sealed data blob is within an enclave during the sealing process + if (!sgx_is_within_enclave(p_sealed_data,sealedDataSize)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ((add_text_length > 0) && ((p_additional_MACtext == NULL) || (p_additional_MACtext_length == NULL))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ((encrypt_text_length < 1) || (p_decrypted_text == NULL) || (p_decrypted_text_length == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if (!sgx_is_within_enclave(p_decrypted_text,encrypt_text_length)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if (!sgx_is_within_enclave(p_decrypted_text_length,sizeof(p_decrypted_text_length))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // Ensure aad data does not cross enclave boundary + if ((add_text_length > 0) && + (!(sgx_is_within_enclave(p_additional_MACtext,add_text_length) || sgx_is_outside_enclave(p_additional_MACtext, add_text_length)))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ((*p_decrypted_text_length) < encrypt_text_length) + { + return SGX_ERROR_INVALID_PARAMETER; + } + uint32_t additional_MACtext_length = (NULL != p_additional_MACtext_length) ? *p_additional_MACtext_length : 0; + if (additional_MACtext_length < add_text_length) { + return SGX_ERROR_INVALID_PARAMETER; + } + + err = sgx_unseal_data_helper(p_sealed_data, p_additional_MACtext, add_text_length, + p_decrypted_text, encrypt_text_length); + if (err == SGX_SUCCESS) + { + *p_decrypted_text_length = encrypt_text_length; + if(p_additional_MACtext_length != NULL) + *p_additional_MACtext_length = add_text_length; + } + return err; +} + diff --git a/sdk/tseal/tSeal_aad.cpp b/sdk/tseal/tSeal_aad.cpp new file mode 100644 index 0000000000..426ecd758f --- /dev/null +++ b/sdk/tseal/tSeal_aad.cpp @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tseal.h" +#include "sgx_utils.h" +#include "sgx_trts.h" +#include "tSeal_internal.h" +#include +#include + + +extern "C" sgx_status_t sgx_mac_aadata(const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, + const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + sgx_attributes_t attribute_mask; + attribute_mask.flags = SGX_FLAGS_RESERVED | SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG; + attribute_mask.xfrm = 0x0; + + err = sgx_mac_aadata_ex(SGX_KEYPOLICY_MRSIGNER, attribute_mask, TSEAL_DEFAULT_MISCMASK, additional_MACtext_length, + p_additional_MACtext, sealed_data_size, p_sealed_data); + return err; +} + +extern "C" sgx_status_t sgx_mac_aadata_ex(const uint16_t key_policy, + const sgx_attributes_t attribute_mask, + const sgx_misc_select_t misc_mask, + const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, + const uint32_t sealed_data_size, + sgx_sealed_data_t *p_sealed_data) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + sgx_report_t report; + sgx_key_id_t keyID; + sgx_key_request_t tmp_key_request; + uint8_t payload_iv[SGX_SEAL_IV_SIZE]; + memset(&payload_iv, 0, sizeof(payload_iv)); + + uint32_t sealedDataSize = sgx_calc_sealed_data_size(additional_MACtext_length, 0); + // Check for overflow + if (sealedDataSize == UINT32_MAX) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // + // Check parameters + // + // check key_request->key_policy reserved bits are not set and one of policy bits are set + if ((key_policy & ~(SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) || + ((key_policy & (SGX_KEYPOLICY_MRENCLAVE | SGX_KEYPOLICY_MRSIGNER)) == 0)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if ((attribute_mask.flags & 0x3) != 0x3) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // The AAD must be provided + if ((additional_MACtext_length == 0) || (p_additional_MACtext == NULL)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // Ensure AAD does not cross enclave boundary + if (!(sgx_is_within_enclave(p_additional_MACtext, additional_MACtext_length) || + sgx_is_outside_enclave(p_additional_MACtext, additional_MACtext_length))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + // Ensure sealed data blob is within an enclave during the sealing process + if ((p_sealed_data == NULL) || (!sgx_is_within_enclave(p_sealed_data, sealed_data_size))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if (sealedDataSize != sealed_data_size) + { + return SGX_ERROR_INVALID_PARAMETER; + } + memset(&report, 0, sizeof(sgx_report_t)); + memset(p_sealed_data, 0, sealedDataSize); + memset(&keyID, 0, sizeof(sgx_key_id_t)); + memset(&tmp_key_request, 0, sizeof(sgx_key_request_t)); + + // Get the report to obtain isv_svn and cpu_svn + err = sgx_create_report(NULL, NULL, &report); + if (err != SGX_SUCCESS) + { + goto clear_return; + } + + // Get a random number to populate the key_id of the key_request + err = sgx_read_rand(reinterpret_cast(&keyID), sizeof(sgx_key_id_t)); + if (err != SGX_SUCCESS) + { + goto clear_return; + } + + memcpy(&(tmp_key_request.cpu_svn), &(report.body.cpu_svn), sizeof(sgx_cpu_svn_t)); + memcpy(&(tmp_key_request.isv_svn), &(report.body.isv_svn), sizeof(sgx_isv_svn_t)); + tmp_key_request.key_name = SGX_KEYSELECT_SEAL; + tmp_key_request.key_policy = key_policy; + tmp_key_request.attribute_mask.flags = attribute_mask.flags; + tmp_key_request.attribute_mask.xfrm = attribute_mask.xfrm; + memcpy(&(tmp_key_request.key_id), &keyID, sizeof(sgx_key_id_t)); + tmp_key_request.misc_mask = misc_mask; + + err = sgx_seal_data_iv(additional_MACtext_length, p_additional_MACtext, + 0, NULL, payload_iv, &tmp_key_request, p_sealed_data); + + if (err == SGX_SUCCESS) + { + // Copy data from the temporary key request buffer to the sealed data blob + memcpy(&(p_sealed_data->key_request), &tmp_key_request, sizeof(sgx_key_request_t)); + } + +clear_return: + // Clear temp state + memset_s(&report, sizeof(sgx_report_t), 0, sizeof(sgx_report_t)); + memset_s(&keyID, sizeof(sgx_key_id_t), 0, sizeof(sgx_key_id_t)); + return err; +} + +extern "C" sgx_status_t sgx_unmac_aadata(const sgx_sealed_data_t *p_sealed_data, + uint8_t *p_additional_MACtext, + uint32_t *p_additional_MACtext_length) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + // Ensure the the sgx_sealed_data_t members are all inside enclave before using them. + if ((p_sealed_data == NULL) || (!sgx_is_within_enclave(p_sealed_data, sizeof(sgx_sealed_data_t)))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // If using this API, the sealed blob must have no encrypted data. + // So the encryt_text_length must be 0. + uint32_t encrypt_text_length = sgx_get_encrypt_txt_len(p_sealed_data); + if (encrypt_text_length != 0) + { + return SGX_ERROR_MAC_MISMATCH; // Return error indicating the blob is corrupted + } + + // The sealed blob must have AAD. So the add_text_length must not be 0. + uint32_t add_text_length = sgx_get_add_mac_txt_len(p_sealed_data); + if (add_text_length == UINT32_MAX || add_text_length == 0) + { + return SGX_ERROR_MAC_MISMATCH; // Return error indicating the blob is corrupted + } + uint32_t sealedDataSize = sgx_calc_sealed_data_size(add_text_length, encrypt_text_length); + if (sealedDataSize == UINT32_MAX) + { + return SGX_ERROR_MAC_MISMATCH; // Return error indicating the blob is corrupted + } + + // + // Check parameters + // + // Ensure sealed data blob is within an enclave during the sealing process + if (!sgx_is_within_enclave(p_sealed_data, sealedDataSize)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + if (p_additional_MACtext == NULL || p_additional_MACtext_length == NULL) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + // Ensure AAD does not cross enclave boundary + if (!(sgx_is_within_enclave(p_additional_MACtext, add_text_length) || + sgx_is_outside_enclave(p_additional_MACtext, add_text_length))) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + uint32_t additional_MACtext_length = *p_additional_MACtext_length; + if (additional_MACtext_length < add_text_length) { + return SGX_ERROR_INVALID_PARAMETER; + } + + err = sgx_unseal_data_helper(p_sealed_data, p_additional_MACtext, add_text_length, + NULL, encrypt_text_length); + if (err == SGX_SUCCESS) + { + *p_additional_MACtext_length = add_text_length; + } + return err; +} diff --git a/sdk/tseal/tSeal_internal.cpp b/sdk/tseal/tSeal_internal.cpp new file mode 100644 index 0000000000..6e3bbe7793 --- /dev/null +++ b/sdk/tseal/tSeal_internal.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + +#include "sgx_tseal.h" +#include "tSeal_internal.h" +#include "sgx_utils.h" +#include + + +// sgx_seal_data_iv +// +// Parameters: +// additional_MACtext_length - [IN] length of the plaintext data stream in bytes +// p_additional_MACtext - [IN] pointer to the plaintext data stream to be GCM protected +// text2encrypt_length - [IN] length of the data stream to encrypt in bytes +// p_text2encrypt - [IN] pointer to data stream to encrypt +// p_payload_iv - [IN] Pointer to Initialization Vector to be used during AES GCM encryption +// p_key_request - [IN] Pointer to the key request structure to be utilized to obtain the SEAL key +// p_sealed_data - [OUT] pointer to the sealed data structure containing protected data +// +// Return Value: +// sgx_status_t - SGX Error code +sgx_status_t sgx_seal_data_iv(const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, const uint32_t text2encrypt_length, + const uint8_t *p_text2encrypt, const uint8_t *p_payload_iv, + const sgx_key_request_t* p_key_request, sgx_sealed_data_t *p_sealed_data) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + + // Parameter checking performed in sgx_seal_data + + // Get the seal key + sgx_key_128bit_t seal_key; + memset(&seal_key, 0, sizeof(sgx_key_128bit_t)); + err = sgx_get_key(p_key_request, &seal_key); + if (err != SGX_SUCCESS) + { + // Clear temp state + memset_s(&seal_key, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + if (err != SGX_ERROR_OUT_OF_MEMORY) + err = SGX_ERROR_UNEXPECTED; + return err; + } + + err = sgx_rijndael128GCM_encrypt(&seal_key, p_text2encrypt, text2encrypt_length, + reinterpret_cast(&(p_sealed_data->aes_data.payload)), p_payload_iv, + SGX_SEAL_IV_SIZE, p_additional_MACtext, additional_MACtext_length, + &(p_sealed_data->aes_data.payload_tag)); + + if (err == SGX_SUCCESS) + { + // Copy additional MAC text + uint8_t* p_aad = NULL; + if (additional_MACtext_length > 0) + { + p_aad = &(p_sealed_data->aes_data.payload[text2encrypt_length]); + memcpy(p_aad, p_additional_MACtext, additional_MACtext_length); + } + + // populate the plain_text_offset, payload_size in the data_blob + p_sealed_data->plain_text_offset = text2encrypt_length; + p_sealed_data->aes_data.payload_size = additional_MACtext_length + text2encrypt_length; + } + // Clear temp state + memset_s(&seal_key, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + return err; +} + +// sgx_unseal_data_helper +// +// Parameters: +// p_sealed_data - [IN] pointer to the sealed data structure containing protected data +// p_additional_MACtext - [OUT] pointer to the plaintext data stream which was GCM protected +// additional_MACtext_length - [IN] length of the plaintext data stream in bytes +// p_decrypted_text - [OUT] pointer to decrypted data stream +// decrypted_text_length - [IN] length of the decrypted data stream to encrypt in bytes +// +// Return Value: +// sgx_status_t - SGX Error code +sgx_status_t sgx_unseal_data_helper(const sgx_sealed_data_t *p_sealed_data, uint8_t *p_additional_MACtext, + uint32_t additional_MACtext_length, uint8_t *p_decrypted_text, uint32_t decrypted_text_length) +{ + sgx_status_t err = SGX_ERROR_UNEXPECTED; + sgx_key_128bit_t seal_key; + memset(&seal_key, 0, sizeof(sgx_key_128bit_t)); + uint8_t payload_iv[SGX_SEAL_IV_SIZE]; + memset(&payload_iv, 0, SGX_SEAL_IV_SIZE); + + if (decrypted_text_length > 0) + memset(p_decrypted_text, 0, decrypted_text_length); + + if (additional_MACtext_length > 0) + memset(p_additional_MACtext, 0, additional_MACtext_length); + + // Get the seal key + err = sgx_get_key(&p_sealed_data->key_request, &seal_key); + if (err != SGX_SUCCESS) + { + // Clear temp state + memset_s(&seal_key, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + // Provide only error codes that the calling code could act on + if ((err == SGX_ERROR_INVALID_CPUSVN) || (err == SGX_ERROR_INVALID_ISVSVN) || (err == SGX_ERROR_OUT_OF_MEMORY)) + return err; + // Return error indicating the blob is corrupted + return SGX_ERROR_MAC_MISMATCH; + } + err = sgx_rijndael128GCM_decrypt(&seal_key, const_cast(p_sealed_data->aes_data.payload), + decrypted_text_length, p_decrypted_text, &payload_iv[0], SGX_SEAL_IV_SIZE, + const_cast(&(p_sealed_data->aes_data.payload[decrypted_text_length])), additional_MACtext_length, + const_cast(&p_sealed_data->aes_data.payload_tag)); + + if (err != SGX_SUCCESS) + { + // Clear temp state + memset_s(&seal_key, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + return err; + } + + if (additional_MACtext_length > 0) + { + memcpy(p_additional_MACtext, &(p_sealed_data->aes_data.payload[decrypted_text_length]), additional_MACtext_length); + } + // Clear temp state + memset_s(&seal_key, sizeof(sgx_key_128bit_t), 0, sizeof(sgx_key_128bit_t)); + return SGX_SUCCESS; +} \ No newline at end of file diff --git a/sdk/tseal/tSeal_internal.h b/sdk/tseal/tSeal_internal.h new file mode 100644 index 0000000000..5f9686da29 --- /dev/null +++ b/sdk/tseal/tSeal_internal.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef _TSEAL_INTERNAL_H_ +#define _TSEAL_INTERNAL_H_ + +#include +#include "sgx_tseal.h" + +/* set MISCMASK.exinfo_bit = 0 for data migration to the enclave + built with the SDK that supports exinfo bit */ +#define SGX_MISCSEL_EXINFO 0x00000001 /* report #PF and #GP inside enclave */ +#define TSEAL_DEFAULT_MISCMASK (~SGX_MISCSEL_EXINFO) + +#ifdef __cplusplus +extern "C" { +#endif + + sgx_status_t sgx_seal_data_iv(const uint32_t additional_MACtext_length, + const uint8_t *p_additional_MACtext, const uint32_t text2encrypt_length, + const uint8_t *p_text2encrypt, const uint8_t *p_payload_iv, + const sgx_key_request_t* p_key_request, sgx_sealed_data_t *p_sealed_data); + + sgx_status_t sgx_unseal_data_helper(const sgx_sealed_data_t *p_sealed_data, uint8_t *p_additional_MACtext, + uint32_t additional_MACtext_length, uint8_t *p_decrypted_text, + uint32_t decrypted_text_length); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sdk/tseal/tSeal_util.cpp b/sdk/tseal/tSeal_util.cpp new file mode 100644 index 0000000000..4b17d7791b --- /dev/null +++ b/sdk/tseal/tSeal_util.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "sgx_tseal.h" +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffffU +#endif + +uint32_t sgx_calc_sealed_data_size(const uint32_t add_mac_txt_size, const uint32_t txt_encrypt_size) +{ + if(add_mac_txt_size > UINT32_MAX - txt_encrypt_size) + return UINT32_MAX; + uint32_t payload_size = add_mac_txt_size + txt_encrypt_size; //Calculate the payload size + + if(payload_size > UINT32_MAX - sizeof(sgx_sealed_data_t)) + return UINT32_MAX; + return (uint32_t)(sizeof(sgx_sealed_data_t) + payload_size); +} + +uint32_t sgx_get_add_mac_txt_len(const sgx_sealed_data_t* p_sealed_data) +{ + if(p_sealed_data == NULL) + return UINT32_MAX; + + uint32_t data_size = p_sealed_data->aes_data.payload_size - p_sealed_data->plain_text_offset; + if (data_size > p_sealed_data->aes_data.payload_size) + return UINT32_MAX; + return data_size; +} + +uint32_t sgx_get_encrypt_txt_len(const sgx_sealed_data_t* p_sealed_data) +{ + return ((p_sealed_data == NULL) ? UINT32_MAX : p_sealed_data->plain_text_offset); +} diff --git a/sdk/ukey_exchange/Makefile b/sdk/ukey_exchange/Makefile new file mode 100644 index 0000000000..a98b73cbb2 --- /dev/null +++ b/sdk/ukey_exchange/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +TOP_DIR = ../.. +include $(TOP_DIR)/buildenv.mk + +CFLAGS += -Werror +CXXFLAGS += -Werror + +INCLUDE += -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc + +INCLUDE += -I$(LINUX_EXTERNAL_DIR)/crypto_px/include + +vpath %.cpp $(COMMON_DIR)/src + +vpath %.c $(TOP_DIR)/common/src + +CXXFLAGS += -fPIC -fno-rtti $(INCLUDE) +CFLAGS += -fPIC $(INCLUDE) + +OBJ := ukey_exchange.o se_thread.o ukey_exchange_version.o + +LIBNAME := libsgx_ukey_exchange.a + +.PHONY: all +all: $(LIBNAME) | $(BUILD_DIR) + $(CP) $< $| + +$(LIBNAME): $(OBJ) + $(AR) rcsD $@ $^ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + @$(RM) $(OBJ) + @$(RM) $(LIBNAME) $(BUILD_DIR)/$(LIBNAME) + +.PHONY: rebuild +rebuild: clean all diff --git a/sdk/ukey_exchange/ukey_exchange.cpp b/sdk/ukey_exchange/ukey_exchange.cpp new file mode 100644 index 0000000000..82ccd5907f --- /dev/null +++ b/sdk/ukey_exchange/ukey_exchange.cpp @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#ifndef __STDINT_LIMITS +#define __STDINT_LIMITS +#endif +//for Linux +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif +#include +#include + +#include "se_memcpy.h" +#include "sgx_ukey_exchange.h" +#include "sgx_uae_service.h" +#include "sgx_ecp_types.h" +#include "se_lock.hpp" + +#include "se_cdefs.h" +SGX_ACCESS_VERSION(ukey_exchange, 1) + +static sgx_target_info_t g_qe_target_info; +static Mutex g_ukey_spin_lock; + + +#ifndef ERROR_BREAK +#define ERROR_BREAK(x) if(x){break;} +#endif +#ifndef SAFE_FREE +#define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} +#endif + +sgx_status_t sgx_ra_get_msg1( + sgx_ra_context_t context, + sgx_enclave_id_t eid, + sgx_ecall_get_ga_trusted_t p_get_ga, + sgx_ra_msg1_t *p_msg1) +{ + if(!p_msg1 || !p_get_ga) + return SGX_ERROR_INVALID_PARAMETER; + sgx_epid_group_id_t gid = {0}; + sgx_target_info_t qe_target_info; + + memset(&qe_target_info, 0, sizeof(qe_target_info)); + sgx_status_t ret = sgx_init_quote(&qe_target_info, &gid); + if(SGX_SUCCESS != ret) + return ret; + g_ukey_spin_lock.lock(); + if(memcpy_s(&g_qe_target_info, sizeof(g_qe_target_info), + &qe_target_info, sizeof(qe_target_info)) != 0) + { + g_ukey_spin_lock.unlock(); + return SGX_ERROR_UNEXPECTED; + } + g_ukey_spin_lock.unlock(); + if(memcpy_s(&p_msg1->gid, sizeof(p_msg1->gid), &gid, sizeof(gid)) != 0) + return SGX_ERROR_UNEXPECTED; + sgx_ec256_public_t g_a; + sgx_status_t status = SGX_ERROR_UNEXPECTED; + memset(&g_a, 0, sizeof(g_a)); + ret = p_get_ga(eid, &status, context, &g_a); + if(SGX_SUCCESS !=ret) + return ret; + if (SGX_SUCCESS != status) + return status; + memcpy_s(&p_msg1->g_a, sizeof(p_msg1->g_a), &g_a, sizeof(g_a)); + return SGX_SUCCESS; +} + +sgx_status_t sgx_ra_proc_msg2( + sgx_ra_context_t context, + sgx_enclave_id_t eid, + sgx_ecall_proc_msg2_trusted_t p_proc_msg2, + sgx_ecall_get_msg3_trusted_t p_get_msg3, + const sgx_ra_msg2_t *p_msg2, + uint32_t msg2_size, + sgx_ra_msg3_t **pp_msg3, + uint32_t *p_msg3_size) +{ + if(!p_msg2 || !p_proc_msg2 || !p_get_msg3 || !p_msg3_size || !pp_msg3) + return SGX_ERROR_INVALID_PARAMETER; + if(msg2_size != sizeof(sgx_ra_msg2_t) + p_msg2->sig_rl_size) + return SGX_ERROR_INVALID_PARAMETER; + + sgx_status_t ret = SGX_ERROR_UNEXPECTED; + sgx_report_t report; + sgx_ra_msg3_t *p_msg3 = NULL; + + memset(&report, 0, sizeof(report)); + + { + sgx_quote_nonce_t nonce; + sgx_report_t qe_report; + sgx_target_info_t qe_target_info; + + memset(&nonce, 0, sizeof(nonce)); + memset(&qe_report, 0, sizeof(qe_report)); + + sgx_status_t status; + g_ukey_spin_lock.lock(); + if(memcpy_s(&qe_target_info, sizeof(qe_target_info), + &g_qe_target_info, sizeof(g_qe_target_info)) != 0) + { + ret = SGX_ERROR_UNEXPECTED; + g_ukey_spin_lock.unlock(); + goto CLEANUP; + } + g_ukey_spin_lock.unlock(); + ret = p_proc_msg2(eid, &status, context, p_msg2, &qe_target_info, + &report, &nonce); + if(SGX_SUCCESS!=ret) + { + goto CLEANUP; + } + if(SGX_SUCCESS!=status) + { + ret = status; + goto CLEANUP; + } + + uint32_t quote_size = 0; + ret = sgx_get_quote_size(p_msg2->sig_rl_size ? + const_cast(p_msg2->sig_rl):NULL, + "e_size); + if(SGX_SUCCESS!=ret) + { + goto CLEANUP; + } + + //check integer overflow of quote_size + if (UINT32_MAX - quote_size < sizeof(sgx_ra_msg3_t)) + { + ret = SGX_ERROR_UNEXPECTED; + goto CLEANUP; + } + uint32_t msg3_size = static_cast(sizeof(sgx_ra_msg3_t)) + quote_size; + p_msg3 = (sgx_ra_msg3_t *)malloc(msg3_size); + if(!p_msg3) + { + ret = SGX_ERROR_OUT_OF_MEMORY; + goto CLEANUP; + } + memset(p_msg3, 0, msg3_size); + + ret = sgx_get_quote(&report, + p_msg2->quote_type == SGX_UNLINKABLE_SIGNATURE ? + SGX_UNLINKABLE_SIGNATURE : SGX_LINKABLE_SIGNATURE, + const_cast(&p_msg2->spid), + &nonce, + p_msg2->sig_rl_size ? + const_cast(p_msg2->sig_rl):NULL, + p_msg2->sig_rl_size, + &qe_report, + (sgx_quote_t *)p_msg3->quote, + quote_size); + if(SGX_SUCCESS!=ret) + { + goto CLEANUP; + } + + ret = p_get_msg3(eid, &status, context, quote_size, &qe_report, + p_msg3, msg3_size); + if(SGX_SUCCESS!=ret) + { + goto CLEANUP; + } + if(SGX_SUCCESS!=status) + { + ret = status; + goto CLEANUP; + } + *pp_msg3 = p_msg3; + *p_msg3_size = msg3_size; + } + +CLEANUP: + if(ret) + SAFE_FREE(p_msg3); + return ret; +} diff --git a/sdk/ukey_exchange/ukey_exchange_version.cpp b/sdk/ukey_exchange/ukey_exchange_version.cpp new file mode 100644 index 0000000000..05752e7e98 --- /dev/null +++ b/sdk/ukey_exchange/ukey_exchange_version.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + +#include "se_version.h" + +#define __CONCAT(x, y) x/**/y + +#define SGX_UKEY_EXCHANGE_VERSION_STR __CONCAT("SGX_UKEY_EXCHANGE_VERSION_", STRFILEVER) + +#ifdef __cplusplus +extern "C" { +#endif + +__attribute__((visibility("default"))) +const char * sgx_ukey_exchange_version = SGX_UKEY_EXCHANGE_VERSION_STR; + +#ifdef __cplusplus +} +#endif From 07f546948cdc23122e9d88acd068909a0c9fe0fd Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Fri, 24 Jun 2016 16:30:00 +0800 Subject: [PATCH 05/33] Beautify README format --- README.md | 133 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index d0dd507f1b..8d57395219 100644 --- a/README.md +++ b/README.md @@ -29,95 +29,128 @@ Follow the instructions in the [linux-sgx-driver](https://github.com/01org/linux Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package ------------------------------------------------------- ###Prerequisites: -- Ensure that you have the following required operating systems: +- Ensure that you have the following required operating systems: Ubuntu\*-14.04-LTS 64bits -- Use the following command to install the required tools to build Intel(R) SGX SDK: - `$ sudo apt-get install build-essential ocaml automake autoconf libtool` -- Use the following command to install additional required tools to build Intel(R) SGX PSW: - `$ sudo apt-get install libcurl4-openssl-dev protobuf-compiler protobuf-c-compiler libprotobuf-dev libprotobuf-c0-dev` -- Use the script *download_prebuilt.sh* inside source code package to download prebuilt binaries to prebuilt folder - You may need set http proxy for wget tool used by the script (such as `export http_proxy=http://test-proxy:test-port`) - `$ ./download_prebuilt.sh` +- Use the following command to install the required tools to build Intel(R) SGX SDK: +``` + $ sudo apt-get install build-essential ocaml automake autoconf libtool +``` +- Use the following command to install additional required tools to build Intel(R) SGX PSW: +``` + $ sudo apt-get install libcurl4-openssl-dev protobuf-compiler protobuf-c-compiler libprotobuf-dev libprotobuf-c0-dev +``` +- Use the script `download_prebuilt.sh` inside source code package to download prebuilt binaries to prebuilt folder + You may need set http proxy for wget tool used by the script (such as `export http_proxy=http://test-proxy:test-port`) +``` + $ ./download_prebuilt.sh +``` ###Build the Intel(R) SGX SDK and Intel(R) SGX PSW -The following steps describe how to build the Intel SGX SDK and PSW. You can build the project according to your requirement. -1. To build both Intel SGX SDK and PSW with default configuration, enter the following command: - `$ make` - You can find the tools and libraries generated in the `build/linux` directory. - Note: You can also go to the sdk folder and use the `make` command to build the Intel SGX SDK component only. However, the building of PSW component is dependent on the building result of Intel SGX SDK. -2. To build Intel SGX SDK and PSW with debug information, enter the following command: - `$ make DEBUG=1` -3. To clean the files generated by previous `make` command, enter the following command: - `$ make clean` +The following steps describe how to build the Intel SGX SDK and PSW. You can build the project according to your requirement. +- To build both Intel SGX SDK and PSW with default configuration, enter the following command: + You can find the tools and libraries generated in the `build/linux` directory. + **Note**: You can also go to the sdk folder and use the `make` command to build the Intel SGX SDK component only. However, the building of PSW component is dependent on the building result of Intel SGX SDK. +``` + $ make +``` + +- To build Intel SGX SDK and PSW with debug information, enter the following command: +``` + $ make DEBUG=1 +``` +- To clean the files generated by previous `make` command, enter the following command: +``` + $ make clean +``` ###Build Intel(R) SGX SDK Installer To build Intel(R) SGX SDK installer, enter the following command: - `$ make sdk_install_pkg` +``` +$ make sdk_install_pkg +``` You can find the generated Intel SGX SDK installer `sgx_linux_x64_sdk_${version}.bin` located under `linux/installer/bin/`, where `${version}` refers to the version number. ###Build Intel(R) SGX PSW Installer To build Intel(R) SGX PSW installer, enter the following command: - `$ make psw_install_pkg` +``` +$ make psw_install_pkg +``` You can find the generated Intel SGX PSW installer `sgx_linux_x64_psw_${version}.bin` located under `linux/installer/bin/`, where `${version}` refers to the version number. Install Intel(R) SGX SDK ------------------------ ###Prerequisites -- Ensure that you have the following required operating systems: +- Ensure that you have the following required operating systems: Ubuntu\*-14.04-LTS - Use the following command to install the required tool to use Intel(R) SGX SDK: - `$ sudo apt-get install build-essential` +``` + $ sudo apt-get install build-essential +``` ###Install Intel(R) SGX SDK To install Intel(R) SGX SDK, execute the installer with root privilege: - `$ sudo ./sgx_linux_x64_sdk_${version}.bin ` - +``` +$ cd linux/installer/bin +$ sudo ./sgx_linux_x64_sdk_${version}.bin ` +``` ###Test Intel(R) SGX SDK Package with the Sample Codes -1. Copy the sample codes installed by Intel(R) SGX SDK package into your work folder, such as - `$ cp -r /opt/intel/sgxsdk/SampleCode ~` -2. Compile and run each sample codes in the simulation mode to make sure the package works well. - `$ cd SampleCode/LocalAttestation` - `$ make` - `$ ./app` +- Copy the sample codes installed by Intel(R) SGX SDK package into your work folder, such as +``` + $ cp -r /opt/intel/sgxsdk/SampleCode ~ +``` +- Compile and run each sample codes in the simulation mode to make sure the package works well. +``` + $ cd SampleCode/LocalAttestation + $ make + $ ./app +``` Use similar commands for other sample codes. ###Compile and Run the Sample Codes in the Hardware Mode If you use an SGX hardware enabled machine, you need to run the sample codes in the hardware mode. -Ensure that you install SGX driver and Intel(R) SGX PSW installer on the machine. +Ensure that you install SGX driver and Intel(R) SGX PSW installer on the machine. See the topic, Install Intel(R) SGX PSW, on how to install the PSW package. -1. Copy the sample codes installed by the Intel(R) SGX SDK package into your work folder, such as - `$ cp -r /opt/intel/sgxsdk/SampleCode ~` -2. Compile and run each sample codes in the debug mode. - `$ cd SampleCode/LocalAttestation` - `$ make SGX_MODE=HW SGX_DEBUG=1` - `$ ./app` +- Copy the sample codes installed by the Intel(R) SGX SDK package into your work folder, such as +``` + $ cp -r /opt/intel/sgxsdk/SampleCode ~ +``` +- Compile and run each sample codes in the debug mode. +``` + $ cd SampleCode/LocalAttestation + $ make SGX_MODE=HW SGX_DEBUG=1 + $ ./app +``` Use similar commands for other sample codes. Install Intel(R) SGX PSW ------------------------ ###Prerequisites -- Ensure that you have the following required operating systems: +- Ensure that you have the following required operating systems: Ubuntu\*-14.04-LTS 64bits -- Ensure that you have the following required hardware: +- Ensure that you have the following required hardware: 6th Generation Intel(R) Core(TM) Processor (code named Skylake) -- Configure the system with the **SGX hardware enabled** option and install SGX driver in advance. +- Configure the system with the **SGX hardware enabled** option and install SGX driver in advance. See the topic, Build and Install the Intel(R) SGX Driver, on how to install the SGX driver. -- Install the library using the following command: - `$ sudo apt-get install libcurl4-openssl-dev libprotobuf-dev libprotobuf-c0-dev` +- Install the library using the following command: +``` + $ sudo apt-get install libcurl4-openssl-dev libprotobuf-dev libprotobuf-c0-dev` +``` ###Install Intel(R) SGX PSW -To install Intel(R) SGX PSW, execute the installer with root privilege: - `$ sudo ./sgx_linux_x64_psw_${version}.bin` +To install Intel(R) SGX PSW, execute the installer with root privilege: +``` +$ cd linux/installer/bin +$ sudo ./sgx_linux_x64_psw_${version}.bin` +``` ###Start or Stop aesmd Service -The Intel(R) SGX PSW installer installs an aesmd service in your machine which is running in a special linux account aesmd. -To stop the service: `$ sudo service aesmd stop` -To start the service: `$ sudo service aesmd start` +The Intel(R) SGX PSW installer installs an aesmd service in your machine which is running in a special linux account aesmd. +To stop the service: `$ sudo service aesmd stop` +To start the service: `$ sudo service aesmd start` To restart the service: `$ sudo service aesmd restart` ###Configure the Proxy for aesmd Service -The aesmd service uses HTTP protocol to initialize some services. -If proxy is required for HTTP protocol, you may need manually setup the proxy for aesmd service. -You should manually edit file `/etc/aesmd.conf` (refer the comment in the file) to set the proxy for aesmd service. +The aesmd service uses HTTP protocol to initialize some services. +If proxy is required for HTTP protocol, you may need manually setup the proxy for aesmd service. +You should manually edit file `/etc/aesmd.conf` (refer the comment in the file) to set the proxy for aesmd service. After you configure the proxy, you need to restart the service to enable the proxy. - From 50a296217c6f9f3664ebac120ec49fb75ea5ead0 Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Fri, 24 Jun 2016 16:45:39 +0800 Subject: [PATCH 06/33] Remove redundant characters --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8d57395219..b38c943bee 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Install Intel(R) SGX SDK To install Intel(R) SGX SDK, execute the installer with root privilege: ``` $ cd linux/installer/bin -$ sudo ./sgx_linux_x64_sdk_${version}.bin ` +$ sudo ./sgx_linux_x64_sdk_${version}.bin ``` ###Test Intel(R) SGX SDK Package with the Sample Codes - Copy the sample codes installed by Intel(R) SGX SDK package into your work folder, such as @@ -133,14 +133,14 @@ Install Intel(R) SGX PSW See the topic, Build and Install the Intel(R) SGX Driver, on how to install the SGX driver. - Install the library using the following command: ``` - $ sudo apt-get install libcurl4-openssl-dev libprotobuf-dev libprotobuf-c0-dev` + $ sudo apt-get install libcurl4-openssl-dev libprotobuf-dev libprotobuf-c0-dev ``` ###Install Intel(R) SGX PSW To install Intel(R) SGX PSW, execute the installer with root privilege: ``` $ cd linux/installer/bin -$ sudo ./sgx_linux_x64_psw_${version}.bin` +$ sudo ./sgx_linux_x64_psw_${version}.bin ``` ###Start or Stop aesmd Service From cc08bf96f848167c8a5e634d335afa2b9a6c1b46 Mon Sep 17 00:00:00 2001 From: llly Date: Thu, 21 Jul 2016 19:36:32 +0800 Subject: [PATCH 07/33] Update .gitignore ignore generated proxy --- .gitignore | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c634f5eb38..aa2eb5d3cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,15 @@ #object file -.o +*.o #library -.a +*.a #share object -.so -.so.* +*.so +*.so.* + +#generated proxy +*_u.c +*_u.h +*_t.c +*_t.h From 3cd172adaa773cf8876e80e16849b50e119f497d Mon Sep 17 00:00:00 2001 From: haitaohuang Date: Tue, 26 Jul 2016 08:24:28 -0500 Subject: [PATCH 08/33] Create CONTRIBUTING.md Signed-off-by: Haitao Huang --- CONTRIBUTING.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..660066e7e9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,79 @@ +# Contributing + +## Issues + +GitHub Issues tracks SGX SDK and PSW design and development issues, bugs, and feature requests. +For usage, installation, or other requests for help, please use the [01.org](https://01.org/intel-software-guard-extensions/forum/forum) forum instead. + +When reporting a bug, please provide the following information, where applicable: + +* What are the steps to reproduce the bug? +* Can you reproduce the bug using the latest [master](https://github.com/01org/linux-sgx/tree/master)? +* What CPU, platform, operating system/distribution, and SGX driver are you running? The more specific, the better. +* For crashes, please provide the backtrace (use gdb). + + +### Contribution Guide + +We accept contributions as pull requests on GitHub. More detailed guidelines will be added later. Please follow these simple rules for now: + +* A PR should have a clear purpose, and do one thing only, and nothing more. This will enable us review your PR more quickly. +* Each commit in PR should be a small, atomic change representing one step in development. +* Please squash intermediate steps within PR for bugfixes, style cleanups, reversions, etc., so they would not appear in merged PR history. +* Please explain anything non-obvious from the code in comments, commit messages, or the PR description, as appropriate. + +### License + +linux-sgx is licensed under the terms in [LICENSE](https://github.com/01org/linux-sgx/blob/master/License.txt). By contributing to the project, you agree to the license and copyright terms therein and release your contribution under these terms. + +### Sign your work + +Please use the sign-off line at the end of the patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify +the below (from [developercertificate.org](http://developercertificate.org/)): + +``` +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +660 York Street, Suite 102, +San Francisco, CA 94110 USA + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. From 56bd012febb91760d04bf9b560f7438cc9add84c Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Wed, 27 Jul 2016 11:32:55 +0800 Subject: [PATCH 09/33] Update README.md Update README.md to include "Contributing" section. Signed-off-by: Andy Zhao --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b38c943bee..51c7f718f7 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ License ------- See License.txt for details. +Contributing +------- +See CONTRIBUTING.md for details. + Documentation ------------- - [Intel(R) SGX for Linux\* OS][1] project home page on [01.org](http://01.org) From 24c366ccf66ed012059847dc88e96f48b5cc50fd Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Thu, 28 Jul 2016 11:14:04 +0800 Subject: [PATCH 10/33] Update README.md to specify Ubuntu desktop version Signed-off-by: Andy Zhao --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b38c943bee..9ff0d139ca 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package ------------------------------------------------------- ###Prerequisites: - Ensure that you have the following required operating systems: - Ubuntu\*-14.04-LTS 64bits + Ubuntu\* Desktop-14.04-LTS 64bits - Use the following command to install the required tools to build Intel(R) SGX SDK: ``` $ sudo apt-get install build-essential ocaml automake autoconf libtool From 2a0c21a62df30a0b091dea8774365735d774a3ba Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Fri, 29 Jul 2016 21:19:35 +0800 Subject: [PATCH 11/33] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 64d14dad52..a2e80a18e9 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Install Intel(R) SGX SDK ------------------------ ###Prerequisites - Ensure that you have the following required operating systems: - Ubuntu\*-14.04-LTS + Ubuntu\* Desktop-14.04-LTS 64bits - Use the following command to install the required tool to use Intel(R) SGX SDK: ``` $ sudo apt-get install build-essential @@ -130,7 +130,7 @@ Install Intel(R) SGX PSW ------------------------ ###Prerequisites - Ensure that you have the following required operating systems: - Ubuntu\*-14.04-LTS 64bits + Ubuntu\* Desktop-14.04-LTS 64bits - Ensure that you have the following required hardware: 6th Generation Intel(R) Core(TM) Processor (code named Skylake) - Configure the system with the **SGX hardware enabled** option and install SGX driver in advance. From 8bde48e653c62ed50ccf4ff43a5e9b97c1803e67 Mon Sep 17 00:00:00 2001 From: Warren He <-w@berkeley.edu> Date: Mon, 1 Aug 2016 08:39:04 -0700 Subject: [PATCH 12/33] Avoid overflow when shifting The urts library and the signing tool often shift page counts as 32-bit integers, then passes the result as a 64-bit value. This patch casts page counts into 64-bit integers first, so that large page counts don't overflow. Signed-off-by: Warren He <-w@berkeley.edu> --- psw/urts/loader.cpp | 14 +++++++------- sdk/sign_tool/SignTool/manage_metadata.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index 01b61ce238..a925972d21 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -265,14 +265,14 @@ int CLoader::build_context(const uint64_t start_rva, layout_entry_t *layout) ptcs->ogs_base += rva; m_tcs_list.push_back(GET_PTR(tcs_t, m_start_addr, rva)); sinfo.flags = layout->si_flags; - if(SGX_SUCCESS != (ret = build_pages(rva, layout->page_count << SE_PAGE_SHIFT, added_page, sinfo, layout->attributes))) + if(SGX_SUCCESS != (ret = build_pages(rva, (uint64_t)layout->page_count << SE_PAGE_SHIFT, added_page, sinfo, layout->attributes))) { return ret; } } else // guard page should not have content_offset != 0 { - section_info_t sec_info = {GET_PTR(uint8_t, m_metadata, layout->content_offset), layout->content_size, rva, layout->page_count << SE_PAGE_SHIFT, layout->si_flags, NULL}; + section_info_t sec_info = {GET_PTR(uint8_t, m_metadata, layout->content_offset), layout->content_size, rva, (uint64_t)layout->page_count << SE_PAGE_SHIFT, layout->si_flags, NULL}; if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) { return ret; @@ -292,7 +292,7 @@ int CLoader::build_context(const uint64_t start_rva, layout_entry_t *layout) } source = added_page; } - if(SGX_SUCCESS != (ret = build_pages(rva, layout->page_count << SE_PAGE_SHIFT, source, sinfo, layout->attributes))) + if(SGX_SUCCESS != (ret = build_pages(rva, (uint64_t)layout->page_count << SE_PAGE_SHIFT, source, sinfo, layout->attributes))) { return ret; } @@ -438,7 +438,7 @@ int CLoader::validate_layout_table() { if(!IS_GROUP_ID(layout->entry.id)) // layout entry { - rva_vector.push_back(make_pair(layout->entry.rva, layout->entry.page_count << SE_PAGE_SHIFT)); + rva_vector.push_back(make_pair(layout->entry.rva, (uint64_t)layout->entry.page_count << SE_PAGE_SHIFT)); if(layout->entry.content_offset) { if(false == is_metadata_buffer(layout->entry.content_offset, layout->entry.content_size)) @@ -467,7 +467,7 @@ int CLoader::validate_layout_table() { return SGX_ERROR_INVALID_METADATA; } - rva_vector.push_back(make_pair(entry->rva + load_step, entry->page_count << SE_PAGE_SHIFT)); + rva_vector.push_back(make_pair(entry->rva + load_step, (uint64_t)entry->page_count << SE_PAGE_SHIFT)); // no need to check integer overflow for entry->rva + load_step, because // entry->rva and load_step are less than enclave_size, whose size is no more than 37 bit } @@ -751,13 +751,13 @@ int CLoader::set_context_protection(layout_t *layout_start, layout_t *layout_end prot = SI_FLAGS_RW & SI_MASK_MEM_ATTRIBUTE; } ret = mprotect(GET_PTR(void, m_start_addr, layout->entry.rva + delta), - (size_t)(layout->entry.page_count << SE_PAGE_SHIFT), + (size_t)layout->entry.page_count << SE_PAGE_SHIFT, prot); if(ret != 0) { SE_TRACE(SE_TRACE_WARNING, "mprotect(rva=%" PRIu64 ", len=%" PRIu64 ", flags=%d) failed\n", (uint64_t)m_start_addr + layout->entry.rva + delta, - (uint64_t)(layout->entry.page_count << SE_PAGE_SHIFT), + (uint64_t)layout->entry.page_count << SE_PAGE_SHIFT, prot); return SGX_ERROR_UNEXPECTED; } diff --git a/sdk/sign_tool/SignTool/manage_metadata.cpp b/sdk/sign_tool/SignTool/manage_metadata.cpp index 7ae747d4af..e71e8ed22f 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.cpp +++ b/sdk/sign_tool/SignTool/manage_metadata.cpp @@ -279,13 +279,13 @@ bool CMetadata::build_layout_entries(vector &layouts) if(!IS_GROUP_ID(layouts[i].entry.id)) { layout_table->entry.rva = rva; - rva += (uint64_t)(layouts[i].entry.page_count << SE_PAGE_SHIFT); + rva += (uint64_t)layouts[i].entry.page_count << SE_PAGE_SHIFT; } else { for (uint32_t j = 0; j < layouts[i].group.entry_count; j++) { - layout_table->group.load_step += layouts[i-j-1].entry.page_count << SE_PAGE_SHIFT; + layout_table->group.load_step += (uint64_t)layouts[i-j-1].entry.page_count << SE_PAGE_SHIFT; } rva += layouts[i].group.load_times * layout_table->group.load_step; } @@ -546,14 +546,14 @@ layout_entry_t *CMetadata::get_entry_by_id(uint16_t id) bool CMetadata::build_gd_template(uint8_t *data, uint32_t *data_size) { m_create_param.stack_limit_addr = get_entry_by_id(LAYOUT_ID_STACK)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva; - m_create_param.stack_base_addr = (get_entry_by_id(LAYOUT_ID_STACK)->page_count << SE_PAGE_SHIFT) + m_create_param.stack_limit_addr; + m_create_param.stack_base_addr = ((uint64_t)get_entry_by_id(LAYOUT_ID_STACK)->page_count << SE_PAGE_SHIFT) + m_create_param.stack_limit_addr; m_create_param.first_ssa_gpr = get_entry_by_id(LAYOUT_ID_SSA)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva + SSA_FRAME_SIZE * SE_PAGE_SIZE - (uint64_t)sizeof(ssa_gpr_t); m_create_param.enclave_size = m_metadata->enclave_size; m_create_param.heap_offset = get_entry_by_id(LAYOUT_ID_HEAP)->rva; uint64_t tmp_tls_addr = get_entry_by_id(LAYOUT_ID_TD)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva; - m_create_param.td_addr = tmp_tls_addr + ((get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); + m_create_param.td_addr = tmp_tls_addr + (((uint64_t)get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); const Section *section = m_parser->get_tls_section(); if(section) @@ -584,7 +584,7 @@ bool CMetadata::build_tcs_template(tcs_t *tcs) tcs->cssa = 0; tcs->ossa = get_entry_by_id(LAYOUT_ID_SSA)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva; //fs/gs pointer at TLS/TD - tcs->ofs_base = tcs->ogs_base = get_entry_by_id(LAYOUT_ID_TD)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva + (uint64_t)((get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); + tcs->ofs_base = tcs->ogs_base = get_entry_by_id(LAYOUT_ID_TD)->rva - get_entry_by_id(LAYOUT_ID_TCS)->rva + (((uint64_t)get_entry_by_id(LAYOUT_ID_TD)->page_count - 1) << SE_PAGE_SHIFT); tcs->ofs_limit = tcs->ogs_limit = (uint32_t)-1; return true; } From b57e8d04698629f0bf3315004bf2e12ed663198d Mon Sep 17 00:00:00 2001 From: Warren He <-w@berkeley.edu> Date: Mon, 1 Aug 2016 08:39:17 -0700 Subject: [PATCH 13/33] Widen XML parameters to 64 bits The signing tool parses values in the enclave configuration as 32-bit integers. This patch changes it to parse them as 64-bit integers, so that it can process larger enclaves. This only affects properties such as MaxStackSize and MaxHeapSize, while subsequent 32-bit bookkeeping, such as TCSPolicy, MiscSelect, and MiscMask are unchanged. Signed-off-by: Warren He <-w@berkeley.edu> --- sdk/sign_tool/SignTool/manage_metadata.cpp | 12 ++++++------ sdk/sign_tool/SignTool/manage_metadata.h | 6 +++--- sdk/sign_tool/SignTool/sign_tool.cpp | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sdk/sign_tool/SignTool/manage_metadata.cpp b/sdk/sign_tool/SignTool/manage_metadata.cpp index e71e8ed22f..6f86fa425a 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.cpp +++ b/sdk/sign_tool/SignTool/manage_metadata.cpp @@ -58,7 +58,7 @@ static bool traverser_parameter(const char *temp_name, const char *temp_text, xml_parameter_t *parameter, int parameter_count) { assert(temp_name != NULL && parameter != NULL); - uint32_t temp_value=0; + uint64_t temp_value=0; if(temp_text == NULL) { se_trace(SE_TRACE_ERROR, LACK_VALUE_FOR_ELEMENT_ERROR, temp_name); @@ -74,7 +74,7 @@ static bool traverser_parameter(const char *temp_name, const char *temp_text, xm errno = 0; char* endptr = NULL; - temp_value = (uint32_t)strtoul(temp_text, &endptr, 0); + temp_value = (uint64_t)strtoull(temp_text, &endptr, 0); if(*endptr!='\0'||errno!=0) //Invalid value or valid value but out of the representable range { se_trace(SE_TRACE_ERROR, INVALID_VALUE_FOR_ELEMENT_ERROR, temp_name); @@ -212,7 +212,7 @@ bool CMetadata::modify_metadata(const xml_parameter_t *parameter) assert(parameter != NULL); m_metadata->version = META_DATA_MAKE_VERSION(MAJOR_VERSION,MINOR_VERSION ); m_metadata->size = offsetof(metadata_t, data); - m_metadata->tcs_policy = parameter[TCSPOLICY].value; + m_metadata->tcs_policy = (uint32_t)parameter[TCSPOLICY].value; m_metadata->ssa_frame_size = SSA_FRAME_SIZE; //stack/heap must be page-align if(parameter[STACKMAXSIZE].value % ALIGN_SIZE) @@ -237,13 +237,13 @@ bool CMetadata::modify_metadata(const xml_parameter_t *parameter) m_metadata->max_save_buffer_size = MAX_SAVE_BUF_SIZE; m_metadata->magic_num = METADATA_MAGIC; m_metadata->desired_misc_select = 0; - m_metadata->enclave_css.body.misc_select = parameter[MISCSELECT].value; - m_metadata->enclave_css.body.misc_mask = parameter[MISCMASK].value; + m_metadata->enclave_css.body.misc_select = (uint32_t)parameter[MISCSELECT].value; + m_metadata->enclave_css.body.misc_mask = (uint32_t)parameter[MISCMASK].value; m_create_param.heap_max_size = parameter[HEAPMAXSIZE].value; m_create_param.ssa_frame_size = SSA_FRAME_SIZE; m_create_param.stack_max_size = parameter[STACKMAXSIZE].value; - m_create_param.tcs_max_num = parameter[TCSNUM].value; + m_create_param.tcs_max_num = (uint32_t)parameter[TCSNUM].value; m_create_param.tcs_policy = m_metadata->tcs_policy; return true; } diff --git a/sdk/sign_tool/SignTool/manage_metadata.h b/sdk/sign_tool/SignTool/manage_metadata.h index b6033fd0a7..e45a628613 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.h +++ b/sdk/sign_tool/SignTool/manage_metadata.h @@ -68,9 +68,9 @@ typedef enum _para_type_t typedef struct _xml_parameter_t { const char* name; //the element name - uint32_t max_value; - uint32_t min_value; - uint32_t value; //parameter value. Initialized with the default value. + uint64_t max_value; + uint64_t min_value; + uint64_t value; //parameter value. Initialized with the default value. uint32_t flag; //Show whether it has been matched } xml_parameter_t; diff --git a/sdk/sign_tool/SignTool/sign_tool.cpp b/sdk/sign_tool/SignTool/sign_tool.cpp index 5f6d66e93b..ba09e38d39 100644 --- a/sdk/sign_tool/SignTool/sign_tool.cpp +++ b/sdk/sign_tool/SignTool/sign_tool.cpp @@ -309,12 +309,12 @@ static bool fill_enclave_css(const IppsRSAPublicKeyState *pub_key, const xml_par } //hardware version - enclave_css.header.hw_version = para[HW].value; + enclave_css.header.hw_version = (uint32_t)para[HW].value; //****************************fill the body*********************** // Misc_select/Misc_mask - enclave_css.body.misc_select = para[MISCSELECT].value; - enclave_css.body.misc_mask = para[MISCMASK].value; + enclave_css.body.misc_select = (uint32_t)para[MISCSELECT].value; + enclave_css.body.misc_mask = (uint32_t)para[MISCMASK].value; //low 64 bit enclave_css.body.attributes.flags = 0; enclave_css.body.attribute_mask.flags = ~SGX_FLAGS_DEBUG; @@ -1088,8 +1088,8 @@ int main(int argc, char* argv[]) {"HW", 0x10,0,0,0}, {"TCSNum",0xFFFFFFFF,TCS_NUM_MIN,1,0}, {"TCSPolicy",TCS_POLICY_UNBIND,TCS_POLICY_BIND,TCS_POLICY_UNBIND,0}, - {"StackMaxSize",0xFFFFFFFF,STACK_SIZE_MIN,0x40000,0}, - {"HeapMaxSize",0xFFFFFFFF,HEAP_SIZE_MIN,0x100000,0}, + {"StackMaxSize",0x1FFFFFFFFF,STACK_SIZE_MIN,0x40000,0}, + {"HeapMaxSize",0x1FFFFFFFFF,HEAP_SIZE_MIN,0x100000,0}, {"MiscSelect", 0xFFFFFFFF, 0, DEFAULT_MISC_SELECT, 0}, {"MiscMask", 0xFFFFFFFF, 0, DEFAULT_MISC_MASK, 0}}; From 85947caa128f9f5c731cb25c3cdc4a4d5f95d6e7 Mon Sep 17 00:00:00 2001 From: zhaohuidu Date: Mon, 19 Sep 2016 14:55:22 +0800 Subject: [PATCH 14/33] Upgrade to Linux 1.6 gold release switch code to linux 1.6 opensource gold release --- .gitignore | 4 + License.txt | 2 +- Linux_SGXEclipsePlugin/build.sh | 57 ++- .../html/Adding_SGX_Nature_to_a_Project.htm | 22 - ...Adding_SGX_Nature_to_a_non_SGX_project.htm | 55 --- .../html/Adding_an_SGX_Enclave.htm | 54 --- .../html/Adding_an_SGX_Trusted_Library.htm | 39 -- .../html/Adding_an_SGX_Untrusted_Module.htm | 39 -- .../html/Building_and_Running_SGX_Code.htm | 25 -- .../html/Command_Reference.htm | 30 -- ...tware_Guard_Extensions_Eclipse_Plug-in.htm | 31 -- ...ting_a_New_C_C_Project_with_SGX_Nature.htm | 37 -- .../html/Generate_Hash.htm | 45 -- .../html/Generate_Signed_Enclaves.htm | 39 -- .../html/Getting_Started.htm | 23 - ...ftware_Guard_Extensions_Eclipse_Plugin.htm | 40 -- ...tware_Guard _Extensions_Eclipse_Plugin.htm | 42 -- ...ducing_Intel_Software_Guard_Extensions.htm | 23 - .../html/Introduction.htm | 21 - .../html/Legal_Information.htm | 70 --- .../html/Prerequisites.htm | 27 -- .../Stylesheets/intel_css_styles.css | 75 ++-- ...Running_Samples_Generated_for_Enclaves.htm | 31 -- .../html/SGX_Build_Configurations.htm | 97 ----- .../html/SGX_title.htm | 30 -- .../html/Two_Steps_Sign_Enclave.htm | 59 --- .../Updating_Enclave_Configuration_Files.htm | 39 -- .../html/Updating_SGX_Enclave_Signing_Key.htm | 37 -- .../com.intel.sgx.userguide/html/content.html | 191 +++++---- .../plugins/com.intel.sgx.userguide/toc.xml | 134 ++---- .../SGXEnclave/trusted/Enclave1.config.xml | 1 - .../build_directory/sites/site.xml | 4 +- Linux_SGXEclipsePlugin/clean.sh | 2 +- Linux_SGXEclipsePlugin/readme.txt | 15 +- .../src/main/groovy/preprocessHtml.groovy | 34 -- README.md | 16 +- SampleCode/LocalAttestation/Makefile | 10 +- SampleCode/PowerTransition/Makefile | 10 +- SampleCode/RemoteAttestation/Makefile | 13 +- .../RemoteAttestation/isv_app/isv_app.cpp | 92 +++- .../isv_enclave/isv_enclave.cpp | 134 +++++- .../service_provider/ecp.cpp | 85 ++++ .../RemoteAttestation/service_provider/ecp.h | 22 +- .../service_provider/ias_ra.cpp | 22 +- .../service_provider/ias_ra.h | 1 - .../service_provider/network_ra.cpp | 17 +- .../service_provider/network_ra.h | 33 +- .../remote_attestation_result.h | 26 +- .../service_provider/service_provider.cpp | 212 ++++++--- .../service_provider/service_provider.h | 69 ++- .../SampleEnclave/Enclave/Enclave.config.xml | 1 - SampleCode/SampleEnclave/Makefile | 10 +- common/inc/internal/arch.h | 10 +- common/inc/internal/linux/xsave_gnu.h | 4 +- common/inc/internal/oal/uae_oal_api.h | 21 + common/inc/internal/se_version.h | 2 +- common/inc/sgx_quote.h | 3 +- common/inc/sgx_thread.h | 1 + common/inc/sgx_tkey_exchange.h | 71 ++- common/inc/sgx_uae_service.h | 25 ++ common/inc/tlibc/setjmp.h | 64 +++ download_prebuilt.sh | 5 +- external/epid/inc/epid_types.h | 30 +- external/rdrand/rdrand.h | 2 +- linux/installer/bin/install-sgx-psw.bin.tmpl | 16 +- linux/installer/bin/install-sgx-sdk.bin.tmpl | 81 +++- linux/installer/common/psw/BOMs/psw_base.txt | 1 + linux/installer/common/psw/Makefile | 2 +- linux/installer/common/psw/createTarball.sh | 5 +- linux/installer/common/psw/install.sh | 4 +- linux/installer/common/sdk/BOMs/sdk_base.txt | 1 + linux/installer/common/sdk/BOMs/sdk_x64.txt | 5 + linux/installer/common/sdk/BOMs/sdk_x86.txt | 5 + linux/installer/common/sdk/Makefile | 21 +- linux/installer/common/sdk/createTarball.sh | 28 +- linux/installer/common/sdk/install.sh | 45 +- .../pkgconfig/template/libsgx_uae_service.pc | 10 + .../template/libsgx_uae_service_sim.pc | 10 + .../sdk/pkgconfig/template/libsgx_urts.pc | 10 + .../sdk/pkgconfig/template/libsgx_urts_sim.pc | 10 + psw/ae/Makefile | 6 +- psw/ae/aesm_service/Makefile | 33 +- psw/ae/aesm_service/config/network/aesmd.conf | 12 +- .../include/oal/aesm_persistent_storage.h | 41 +- .../aesm_service/include/oal/error_report.h | 1 + .../aesm_service/include/oal/internal_log.h | 2 + .../source/aesm/application/AEClass.h | 7 +- .../source/aesm/application/aesm_config.cpp | 37 +- .../source/aesm/application/aesm_config.h | 4 +- .../source/aesm/application/aesm_logic.cpp | 403 ++++++++++++++++-- .../source/aesm/application/aesm_logic.h | 29 +- .../source/aesm/extension/aesm_ecdsa.cpp | 36 +- .../source/aesm/extension/aesm_encode.cpp | 14 +- .../source/aesm/extension/aesm_encode.h | 11 +- .../source/aesm/extension/aesm_epid_blob.cpp | 94 +++- .../source/aesm/extension/aesm_epid_blob.h | 7 +- .../source/aesm/extension/aesm_http_msg.cpp | 68 ++- .../aesm/extension/aesm_long_lived_thread.cpp | 88 +++- .../aesm/extension/aesm_long_lived_thread.h | 6 +- .../source/aesm/extension/aesm_xegd_blob.cpp | 109 +++++ .../source/aesm/extension/aesm_xegd_blob.h | 57 +++ .../aesm/extension/endpoint_select_info.cpp | 154 ++++++- .../aesm/extension/endpoint_select_info.h | 32 +- .../aesm/extension/platform_info_facility.cpp | 144 +++++++ .../aesm/extension/platform_info_logic.cpp | 135 ++---- .../aesm/extension/platform_info_logic.h | 5 +- .../aesm/extension/type_length_value.cpp | 99 +++-- .../source/aesm/extension/type_length_value.h | 123 ++++-- .../aesm_wrapper/inc/AESMLogicWrapper.h | 4 + .../aesm_wrapper/src/AESMLogicWrapper.cpp | 21 + .../epid_endpoint_selection.cpp | 14 +- .../epid_provision/epid_provision_msg1.cpp | 341 ++++++++++++--- .../epid_provision/epid_provision_msg2.cpp | 340 +++++++++------ .../epid_provision/epid_provision_msg4.cpp | 162 ++++--- .../source/epid_provision/epid_utility.cpp | 8 +- psw/ae/aesm_service/source/le/LEClass.cpp | 74 +++- psw/ae/aesm_service/source/le/LEClass.h | 4 +- .../source/network/network_encoding_wrapper.h | 1 - .../aesm_service/source/oal/aesm_thread.cpp | 11 +- psw/ae/aesm_service/source/oal/aesm_util.cpp | 127 +++++- .../aesm_service/source/oal/internal_log.cpp | 374 +++++++++++++--- psw/ae/aesm_service/source/pce/PCEClass.cpp | 139 ++++++ psw/ae/aesm_service/source/pce/PCEClass.h | 63 +++ psw/ae/aesm_service/source/pve/PVEClass.cpp | 136 ++++-- psw/ae/aesm_service/source/pve/PVEClass.h | 26 +- .../aesm_service/source/pve/prov_msg_size.h | 27 +- psw/ae/aesm_service/source/pve/pve_logic.cpp | 119 +++--- psw/ae/aesm_service/source/pve/pve_logic.h | 15 +- psw/ae/aesm_service/source/qe/QEClass.cpp | 13 +- psw/ae/aesm_service/source/qe/QEClass.h | 3 +- psw/ae/aesm_service/source/qe/qe_logic.cpp | 63 ++- psw/ae/aesm_service/source/qe/qe_logic.h | 6 +- .../source/storage/persistent_storage_info.h | 2 +- .../storage/persistent_storage_table.cpp | 5 +- .../source/upse/platform_info_blob.h | 3 +- psw/ae/common/inc/AEGetWhiteListRequest.h | 71 +++ psw/ae/common/inc/AEGetWhiteListResponse.h | 78 ++++ psw/ae/common/inc/AEGetWhiteListSizeRequest.h | 62 +++ .../common/inc/AEGetWhiteListSizeResponse.h | 75 ++++ .../inc/AESGXGetExtendedEpidGroupIdRequest.h | 62 +++ .../inc/AESGXGetExtendedEpidGroupIdResponse.h | 75 ++++ .../inc/AESGXSwitchExtendedEpidGroupRequest.h | 71 +++ .../AESGXSwitchExtendedEpidGroupResponse.h | 62 +++ psw/ae/common/inc/IAERequest.h | 8 + psw/ae/common/inc/IAEResponse.h | 8 + psw/ae/common/inc/IAESMLogic.h | 4 + psw/ae/common/inc/ISerializer.h | 25 +- psw/ae/common/inc/ProtobufSerializer.h | 16 + .../ae/common/inc/debug_log.h | 20 +- psw/ae/common/pek_pub_key.cpp | 65 ++- psw/ae/common/proto/messages.proto | 43 ++ psw/ae/common/pve_pub_key.cpp | 6 +- psw/ae/common/src/AEGetWhiteListRequest.cpp | 131 ++++++ psw/ae/common/src/AEGetWhiteListResponse.cpp | 155 +++++++ .../common/src/AEGetWhiteListSizeRequest.cpp | 115 +++++ .../common/src/AEGetWhiteListSizeResponse.cpp | 126 ++++++ .../common/src/AEReportAttestationRequest.cpp | 1 + .../src/AEReportAttestationResponse.cpp | 3 - .../AESGXGetExtendedEpidGroupIdRequest.cpp | 115 +++++ .../AESGXGetExtendedEpidGroupIdResponse.cpp | 126 ++++++ .../AESGXSwitchExtendedEpidGroupRequest.cpp | 128 ++++++ .../AESGXSwitchExtendedEpidGroupResponse.cpp | 113 +++++ psw/ae/common/src/ProtobufSerializer.cpp | 396 +++++++++++++++++ .../data/constants/linux/default_url_info.hh | 1 + psw/ae/data/constants/linux/isk_pub.hh | 8 +- .../linux/service_enclave_mrsigner.hh | 14 +- .../ae/data/constants/linux/xegdsk_pub.hh | 23 +- .../prebuilt/aesm_server_url.blob.00000000 | Bin 0 -> 782 bytes psw/ae/data/prebuilt/le_prod_css.bin | Bin 1808 -> 1808 bytes .../prebuilt/white_list_cert_to_be_verify.bin | Bin 280 -> 440 bytes psw/ae/inc/aeerror.h | 65 +-- psw/ae/inc/internal/aesm_error.h | 2 + psw/ae/inc/internal/epid_pve_type.h | 87 ++-- .../ae/inc/internal/pce_cert.h | 24 +- psw/ae/inc/internal/pek_pub_key.h | 4 +- psw/ae/inc/internal/provision_msg.h | 120 +++--- psw/ae/inc/internal/pve_qe_common.h | 4 - psw/ae/inc/internal/tlv_common.h | 13 +- psw/ae/le/config_debug.xml | 12 - psw/ae/pce/pce.edl | 49 +++ psw/ae/pve/provision_enclave.edl | 12 +- psw/ae/qe/quoting_enclave.edl | 2 +- psw/uae_service/linux/Makefile | 8 + psw/uae_service/sgx_uae_service.cpp | 161 +++++++ .../uae_wrapper/inc/AEInternalServices.h | 5 + psw/uae_service/uae_wrapper/inc/AEServices.h | 40 ++ .../uae_wrapper/inc/AEServicesImpl.h | 7 +- .../uae_wrapper/src/AEServicesImpl.cpp | 112 +++++ psw/uae_service/uae_wrapper/src/uae_api.cpp | 90 ++++ psw/urts/linux/enter_enclave.S | 2 +- psw/urts/loader.cpp | 39 ++ psw/urts/parser/elfparser.cpp | 2 +- sdk/Makefile | 7 +- .../linux/gdb-sgx-plugin/gdb_sgx_plugin.py | 6 +- sdk/debugger_interface/linux/se_ptrace.c | 1 + sdk/edger8r/linux/CodeGen.ml | 16 +- sdk/edger8r/linux/Preprocessor.ml | 71 +++ sdk/sample_libcrypto/sample_libcrypto.cpp | 15 +- sdk/sample_libcrypto/sample_libcrypto.h | 10 +- sdk/sign_tool/SignTool/manage_metadata.cpp | 7 + sdk/sign_tool/SignTool/parse_key_file.cpp | 300 +++++++------ sdk/simulation/uae_service_sim/linux/Makefile | 2 +- .../linux/uae_service_sim.linux.version | 1 + .../uae_service_sim/quoting_sim.cpp | 22 + .../uae_service_sim/uae_service_deploy.c | 6 +- sdk/tkey_exchange/tkey_exchange.cpp | 144 +++++-- sdk/tlibc/Makefile | 2 +- sdk/tlibc/math/w_drem.c | 14 - sdk/tlibc/math/w_dremf.c | 14 - sdk/tlibc/string/bcopy.c | 17 +- sdk/tlibc/string/mempcpy.c | 2 +- sdk/tlibthread/sethread_utils.cpp | 4 + sdk/trts/linux/trts_pic.S | 16 +- sdk/trts/trts_veh.cpp | 21 +- sdk/tsetjmp/Makefile | 69 +++ sdk/tsetjmp/_setjmp.S | 131 ++++++ .../tlongjmp_version.cpp} | 17 +- 217 files changed, 7766 insertions(+), 2812 deletions(-) delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm delete mode 100644 Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy create mode 100644 common/inc/tlibc/setjmp.h create mode 100644 linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service.pc create mode 100644 linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service_sim.pc create mode 100644 linux/installer/common/sdk/pkgconfig/template/libsgx_urts.pc create mode 100644 linux/installer/common/sdk/pkgconfig/template/libsgx_urts_sim.pc create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.cpp create mode 100644 psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.h create mode 100644 psw/ae/aesm_service/source/aesm/extension/platform_info_facility.cpp create mode 100644 psw/ae/aesm_service/source/pce/PCEClass.cpp create mode 100644 psw/ae/aesm_service/source/pce/PCEClass.h create mode 100644 psw/ae/common/inc/AEGetWhiteListRequest.h create mode 100644 psw/ae/common/inc/AEGetWhiteListResponse.h create mode 100644 psw/ae/common/inc/AEGetWhiteListSizeRequest.h create mode 100644 psw/ae/common/inc/AEGetWhiteListSizeResponse.h create mode 100644 psw/ae/common/inc/AESGXGetExtendedEpidGroupIdRequest.h create mode 100644 psw/ae/common/inc/AESGXGetExtendedEpidGroupIdResponse.h create mode 100644 psw/ae/common/inc/AESGXSwitchExtendedEpidGroupRequest.h create mode 100644 psw/ae/common/inc/AESGXSwitchExtendedEpidGroupResponse.h rename sdk/tlibc/math/w_pow10l.c => psw/ae/common/inc/debug_log.h (79%) create mode 100644 psw/ae/common/src/AEGetWhiteListRequest.cpp create mode 100644 psw/ae/common/src/AEGetWhiteListResponse.cpp create mode 100644 psw/ae/common/src/AEGetWhiteListSizeRequest.cpp create mode 100644 psw/ae/common/src/AEGetWhiteListSizeResponse.cpp create mode 100644 psw/ae/common/src/AESGXGetExtendedEpidGroupIdRequest.cpp create mode 100644 psw/ae/common/src/AESGXGetExtendedEpidGroupIdResponse.cpp create mode 100644 psw/ae/common/src/AESGXSwitchExtendedEpidGroupRequest.cpp create mode 100644 psw/ae/common/src/AESGXSwitchExtendedEpidGroupResponse.cpp rename sdk/tlibc/math/w_pow10f.c => psw/ae/data/constants/linux/xegdsk_pub.hh (72%) create mode 100644 psw/ae/data/prebuilt/aesm_server_url.blob.00000000 rename sdk/tlibc/math/w_pow10.c => psw/ae/inc/internal/pce_cert.h (79%) delete mode 100644 psw/ae/le/config_debug.xml create mode 100644 psw/ae/pce/pce.edl create mode 100644 sdk/edger8r/linux/Preprocessor.ml delete mode 100644 sdk/tlibc/math/w_drem.c delete mode 100644 sdk/tlibc/math/w_dremf.c create mode 100644 sdk/tsetjmp/Makefile create mode 100644 sdk/tsetjmp/_setjmp.S rename sdk/{tlibc/math/w_dreml.c => tsetjmp/tlongjmp_version.cpp} (84%) diff --git a/.gitignore b/.gitignore index aa2eb5d3cc..89a3585dc9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,7 @@ *_u.h *_t.c *_t.h + +#output files +/build/ +/linux/installer/bin/*.bin diff --git a/License.txt b/License.txt index 8e1d1f882e..ea9d767559 100644 --- a/License.txt +++ b/License.txt @@ -37,7 +37,7 @@ http://www.eclipse.org/legal/epl-v10.html ============================================================== -libsgx_le.signed.so, libsgx_pve.signed.so and libsgx_qe.signed.so are licensed as Intel redistributable binary firmware and other blobs. +libsgx_le.signed.so, libsgx_pce.signed.so, libsgx_pve.signed.so and libsgx_qe.signed.so are licensed as Intel redistributable binary firmware and other blobs. Copyright (c) Intel Corporation. diff --git a/Linux_SGXEclipsePlugin/build.sh b/Linux_SGXEclipsePlugin/build.sh index 9c36296fd6..ba6e8a28a9 100755 --- a/Linux_SGXEclipsePlugin/build.sh +++ b/Linux_SGXEclipsePlugin/build.sh @@ -11,7 +11,7 @@ TRUNK_HOME=$(cd $(pwd)/../../ ; pwd) [ -n "${ECLIPSE_HOME}" ] || { echo "using default ECLIPSE_HOME=${TRUNK_HOME}/eclipse"; ECLIPSE_HOME=${TRUNK_HOME}/eclipse; } -BUILD_RELEASE_ID_PREFIX=Linux_SGX_1.5 +BUILD_RELEASE_ID_PREFIX=Linux_SGX_1.6 if [ "$RELEASE_ID" != "${RELEASE_ID%$BUILD_RELEASE_ID_PREFIX*}" ]; then echo "$BUILD_RELEASE_ID_PREFIX IS in $RELEASE_ID, so it is an triggered build. Change the RELEASE_ID to an accepted form." @@ -126,6 +126,51 @@ ${ECLIPSE_HOME}/eclipse -nosplash \ -installIU org.eclipse.pde.feature.group } +function preBuild() { + local BUILDDIR="$1" + local BUILDDIRWORK="$2" + + local SITEFILE="$BUILDDIRWORK/sites/site.xml" + local FEATUREDIR="$BUILDDIRWORK/features" + local FEATUREFILE="feature.xml" + local PLUGINDIR="$BUILDDIRWORK/plugins" + local PLUGINFILE="META-INF/MANIFEST.MF" + + local ROOTDIR=$(dirname "$0")"/.." + local VERSION=$(awk '/STRFILEVER/ {print $3}' ${ROOTDIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') + VERSION=$(echo "$VERSION" | awk -F'.' '{for(i=1; i<=NF&&i<=3; i++) if(i==1){version=$i} else{version=version"."$i}}; END{print version}') + + if [[ "$VERSION" =~ ^[0-9]{1,}(.[0-9]{1,}){2}$ ]]; then + rm -fr "$BUILDDIRWORK" + cp -fr "$BUILDDIR" "$BUILDDIRWORK" + + #site.xml + sed -i "s#[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{0,2\}\.qualifier#$VERSION\.qualifier#g" "$SITEFILE" + + #feature + for DIR in $(ls "$FEATUREDIR"); do + sed -i "s#[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{0,2\}\.qualifier#$VERSION\.qualifier#g" "$FEATUREDIR/$DIR/$FEATUREFILE" + done + + #plugin + for DIR in $(ls "$PLUGINDIR"); do + sed -i "s#[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{0,2\}\.qualifier#$VERSION\.qualifier#g" "$PLUGINDIR/$DIR/$PLUGINFILE" + done + fi +} + +function postBuild() { + local BUILDDIR="$1" + local BUILDDIRWORK="$2" + local UPDATESITEDIR="updatesite" + + if [[ -d "$BUILDDIRWORK" ]] && [[ -d "$BUILDDIRWORK/$UPDATESITEDIR" ]]; then + rm -fr "$BUILDDIR/$UPDATESITEDIR" + cp -fr "$BUILDDIRWORK/$UPDATESITEDIR" "$BUILDDIR/$UPDATESITEDIR" + rm -fr "$BUILDDIRWORK" + fi +} + function buildPlugin() { pwd @@ -136,6 +181,7 @@ function buildPlugin() { BASELOCATION="$ECLIPSE_HOME" BUILDVERSION="$RELEASE_ID" BUILDDIR="$PWD/build_directory" + BUILDDIRWORK="$PWD/.build_directory" BUILDCONFIG="$PWD/build_config" LAUNCHER=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.equinox.launcher_*.jar` BUILDFILE=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.pde.build_*/scripts/build.xml` @@ -151,7 +197,9 @@ function buildPlugin() { "not detected. Found '$BUILDFILE'. Aborting." exit 1 fi - + + preBuild "$BUILDDIR" "$BUILDDIRWORK" + # # -- Print configuration used and actually execute the build -- # @@ -161,7 +209,7 @@ function buildPlugin() { echo " Build File: $BUILDFILE" echo " Build Config: $BUILDCONFIG" echo " Base Location: $BASELOCATION" - echo " Build Directory: $BUILDDIR" + echo " Build Directory: $BUILDDIRWORK" echo " Build Version: $BUILDVERSION" echo " Java: " $(which java) java -version @@ -174,12 +222,13 @@ function buildPlugin() { -jar $LAUNCHER \ -application org.eclipse.ant.core.antRunner \ -buildfile $BUILDFILE \ - -DbuildDirectory=$BUILDDIR \ + -DbuildDirectory=$BUILDDIRWORK \ -DbaseLocation=$BASELOCATION \ -Dbuilder=$BUILDCONFIG \ -DforceContextQualifier=$BUILDVERSION \ -v -v -v -v + postBuild "$BUILDDIR" "$BUILDDIRWORK" } function findFirst() { diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm deleted file mode 100644 index ca61b8308c..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_Project.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - Adding SGX Nature to a Project - - - -

Adding SGX Nature to a Project

-

The nature of an Eclipse project is a concept defined by an Eclipse Platform which allows a plug-in to tag a project as a specific kind of project. Intel(R) Software Guard Extensions uses an SGX nature to add SGX-specific behavior to projects. Project natures are defined by plug-ins, and are typically added or removed per-project when the user performs some action defined by the plug-in.

-

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm deleted file mode 100644 index 19e6eaa3f4..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_SGX_Nature_to_a_non_SGX_project.htm +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - Adding SGX Nature to a non-SGX project - - - -

Adding SGX Nature to a non-SGX project

-

When you have a C/C++ project created without Intel SGX, you cannot use Intel SGX support. In this case, you need to add SGX nature to this project to use Intel SGX support:

-
    -
  1. Right-click on the project root
  2. -
  3. -

    Select Software Guard Extension Tools → Add SGX Nature

    -

    - -

    -

    Add SGX Nature

    -
  4. -
-

After you add the SGX nature to your project, you should see:

-
    -
  • -

    A subdirectory sgx in the project which contains a Makefile file.

    -

    - -

    -

    Makefile for Intel(R) SGX

    -
  • -
  • -

    The Intel SGX tools as shown in the following graphic:

    -

    - -

    -

    Intel(R) SGX Tools

    -
  • -
  • -

    New configurations specific to SGX technology. You may see the configurations for the project by clicking to the down arrow of button usually found at the top of the Eclipse window:

    -

    - -

    -

    Configurations Specific to Intel(R) SGX Technology

    -
  • -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm deleted file mode 100644 index fac206c107..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Enclave.htm +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - Adding an SGX Enclave - - - -

Adding an SGX Enclave

-

After you add the SGX nature to a project, you can start creating a minimal but complete skeleton for a new enclave:

-
    -
  1. Right-click on the project root in Project Explorer.
  2. -
  3. -

    Open the dialog Add New SGX Enclave by selecting Software Guard Extensions Tools → Add SGX Enclave from the contextual menu.

    -

    - -

    -

    Add New Intel® SGX Enclave Dialog

    -
  4. -
  5. -

    Choose a name for the enclave in Enclave name field. This name is used in the process of generation of the skeleton to give unicity to the source files and the name of the resulting executable, so you can add more than one enclave to the same project.

    -
      -
    • -

      If you do not select the Generate sample untrusted application checkbox, the plugin generates only a trusted file and a Makefile fragment to build and compile the trusted part. See the following graphic. All the code for the enclave, including build Makefile, is put in a directory <root>/sgx/enclave_<name> . C/C++ code for the enclave proper are in <root>/sgx/enclave_<name>/trusted.

      -

      - -

      -

      Generated Skeleton for an Enclave. The option to Generate Sample was not Used

      -
    • -
    • -

      If you select Generate sample untrusted application checkbox, a simple ready to work sample application is generated, including untrusted stubs and implementation for a sample OCALL and ECALL.

      -

      - -

      -

      Generated Sample Untrusted Application

      -
    • -
    -
  6. -
-
-

NOTE:

-

If you select the Generate sample untrusted application checkbox, ecalls from the untrusted part are not be resolved by Eclipse C/C++ indexer. These functions are marked with a red line. The declaration of these ecalls resides in the unstrusted stub header which is generated during the build proces and is not indexed by Eclipse. To resolve this problem, right-click on project root and select Index → Freshen All Files.

-
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm deleted file mode 100644 index fb0d63b836..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Trusted_Library.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - Adding an SGX Trusted Library - - - -

Adding an SGX Trusted Library

-

Trusted Static Libraries helps enclave author have libraries of shared code to be reused by enclaves, in exactly the same manner as usual static libxxx.a libraries are used to share code between regular non-SGX applications. The plugin adds a command to generate the skeleton of a trusted shared library.

-

To add a new SGX Trusted Library:

-
    -
  1. -

    Open Add New SGX Static Trusted Library dialog by right-click on the root of the project and select the appropriate command from Software Guard Extensions Tools menu:

    -

    - -

    -

    Add New SGX Static Trusted Library Dialog

    -
  2. -
  3. -

    Choose a name for the library and click OK. A skeleton for a trusted library is generated in directory <root>/sgx/trustedlib_<name>:

    -

    - -

    -

    A Generated Trusted Library

    -
  4. -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm deleted file mode 100644 index c2d90ce205..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Adding_an_SGX_Untrusted_Module.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - Adding an SGX Untrusted Module - - - -

Adding an SGX Untrusted Module

-

Add an untrusted module to generate the untrusted stubs so you use an enclave, provided you have access to its .edl file. The enclave might have been built in the current project or in a different project.

-

To use trusted functionality of an enclave for which its *.edl is known, use the command Add SGX Untrusted Module:

-
    -
  1. -

    Open dialog Add Sgx Untrusted Module by right-click-ing the project root in Package Explorer and chose the command from Software Guard Extension Tools.

    -

    - -

    -

    Add SGX Untrusted Module

    -
  2. -
  3. -

    Use the Browse button to navigate the file system using a file dialog, and click OK. The untrusted module is copied to <root>/sgx/untrusted_<edl file name>. The selected *.edl is copied to the project.

    -

    - -

    -

    Copying the Untrusted Module to a Project

    -
  4. -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm deleted file mode 100644 index 1f57f2335c..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Building_and_Running_SGX_Code.htm +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - Building and Running SGX Code - - - -

Building and Running SGX Code

-

This section describes the following topics about building and running SGX code:

-
    -
  • SGX build configurations
  • -
  • Running samples generated for enclaves
  • -
  - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm deleted file mode 100644 index 03f9ab1eae..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Command_Reference.htm +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - Command Reference - - - -

Command Reference

-

This topic provides the command reference for the following scenarios of using Intel(R) Software Guard Extensions Eclipse* Plug-in:

-
    -
  • Adding SGX nature to a project
  • -
  • Adding an SGX enclave
  • -
  • Adding an SGX trusted library
  • -
  • Adding an SGX untrusted module
  • -
  • Updating SGX enclave signing key
  • -
  • Updating enclave configuration files
  • -
  • Two steps sign enclave
  • -
-

All commands brought by Intel(R) Software Guard Extensions Eclipse Plug-in are available by right-clicking on the Project root in Project explorer view in menu Software Guard Extension Tools:

 

Project Explorer

  - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm deleted file mode 100644 index 4c8bc41c4a..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Configuring_Intel_Software_Guard_Extensions_Eclipse_Plug-in.htm +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in - - - -

Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

-

If you do not install Intel(R) SGX SDK for Linux* OS in the default location, you need to specify the path for Intel SGX SDK using the following steps:

-
    -
  1. -

    Go to Window menu ->Preferences. Enter SGX in the filter text field to quickly locate the SGX Preferences page.

    -

    - -

    -

    SGX Preference Page

    -
  2. -
  3. Enter the path for Intel SGX SDK for Linux OS in the SGX SDK Directory field.
  4. -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm deleted file mode 100644 index f3db754ab1..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Creating_a_New_C_C_Project_with_SGX_Nature.htm +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - Creating a New C/C++ Project with SGX Nature - - - -

Creating a New C/C++ Project with SGX Nature

-

You can create a new project with SGX nature. To create such a project, follow these steps:

-
    -
  1. -

    Open a standard Eclipse new project: File menu → Project... . If you have installed Intel® Software Guard Extensions Eclipse Plug-in, you can see the category C/C++ with SGX Enabled in the New Project dialog.

    -

    - -

    -

    New Project

    -

    This category has 2 sub-categories, SGX C project and SGX C++ project. These sub-categories are similar to the sub-categories C Project and C++ Project of standard C/C++ category.

    -
  2. -
  3. Select one of the 2 sub-categories, SGX C project or SGX C++ project, and click Next.
  4. -
  5. Complete creating the project using the regular process of creating a standard C or C++ project.
  6. -
-
-

NOTE:

-

Projects created following the subcategories under C/C++ with SGX Enabled are identical with their standard counterparts, except that they have SGX Nature added. There is no difference between creating a C or C++ project with SGX enabled, or creating a standard C/C++ project and launch Add SGX nature from it, as described in precedent paragraph.

-
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm deleted file mode 100644 index 83326534d3..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Hash.htm +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - Generate Hash - - - -

Generate Hash

-

Generating hash is the first step in the 2-Steps signing process.To generate hash, use the following steps:

-
    -
  1. -

    Right-click on project root, go to Software Guard Extensions Tools menu → Two StepSigne Enclave → Generate Hash

    -

    - -

    -

    Two StepSigne Enclave - Generate Hash

    -
  2. -
  3. In the Generate Hash dialog, enter the required inputs to the corresponding fields:
    • Enter the path to the compiled enclave to be signed in the Enclave Path field. Click Select Enclave to open a file dialog to select the enclave.
    • In the Hash File Location field , enter the path of the output file that will contain signing materials. By default this file has the same file name as the unsigned enclave, with .hex extension added. To change the path, click Select File Path to open a file dialog to select the file path.
    • In the Configuration File path field, enter the path of the configuration filefor the generated hash. Click Select Config to open a dialog to select from all enclave configuration files in the project (similar with the one of the command Update Config).
  4. -
  5. -

    Click OK after you fill in all the fields. The Intel(R) SGX SDK is launched under the hood with the provided parameters and the hash file is generated. A dialog box appears to confirm the completion:

    -

    - -

    -

    Generating Hash Completion Dialog

    -
  6. -
-

You complete the first step, generating hash, in the two step signing enclave. The *.hex file may be signed with the external facility, which generates a signature for it and a public verification key.

-

If you click OK, the Generate Signed Enclave dialog appears. The required fileds in this dialog have been pre-configured with the paths of the unsigned enclave, the configuration file and of the *.hex file. To generated the final signed enclave ready for production immediately, click OK.

-

- -

-

Generate Signed Enclave Dialog with Pre-configurations

-

If you click Cancel in the Generate Signed Enclave dialog, you can continue the signing process later using the Generate Signed Enclave command.

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm deleted file mode 100644 index f0427d7d28..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Generate_Signed_Enclaves.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - Generate Signed Enclaves - - - -

Generate Signed Enclaves

-

Generating signed enclave is the second step in the 2-Steps signing process. You should have the following files to complete this step:

-
    -
  • The .hex file generated with Generate Hash command
  • -
  • The files produced from the external signing facility
  • -
  • The signature of the .hex file
  • -
  • The public verification key
  • -
-

To generate signed encalves, use the following steps:

-
    -
  1. -

    Right-click on the project root, and go to Software Guard Extensions Tools menu → Two Step Sign Enclave → Generate Signed Enclave.

    -

    - -

    -

    Generate Signed Enclave Dialog

    -
  2. -
  3. Enter the inputs to all the fields and click OK.
  4. -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm deleted file mode 100644 index 64c4de51c9..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Getting_Started.htm +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - Getting Started with Intel(R) Software Guard Extensions Eclipse* Plugin - - - -

Getting Started with Intel(R) Software Guard Extensions Eclipse* Plugin

-

This section contains steps to set up your Intel(R) Software Guard Extensions Eclipse* Plugin on a Linux* system, including necessary softwares, steps to install the product, and steps to configure your preferred product directory.

-

• Pre-requisites

-

• Installation Intel(R) Software Guard Extensions Eclipse* Plug-in

-

• Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

  - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm deleted file mode 100644 index ab27b83cd9..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Installing_Intel_Software_Guard_Extensions_Eclipse_Plugin.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - Installing Intel(R) Software Guard Extensions Eclipse* Plug-in - - - -

Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

-

Install Intel(R) Software Guard Extensions Eclipse* Plug-in as a regular Eclipse Plugin:

-
    -
  1. Download the zip archive of Intel(R) Software Guard Extensions Eclipse Plug-in from Intel Site
  2. -
  3. -

    Go to Help menu -> Install New Software. Click the Add button for the Work with field to open the Add Repository dialog as shown in the following graphic:

    -

    - -

    -

    Add Repository Dialog

    -
  4. -
  5. -

    Enter SGX Archive in the Name field . Click the Archive... button and select the location of the downloaded archive as shown in the following graphic:

    -

    - -

    -

    The Location of the Plugin zip Archive

    -
  6. -
  7. Press OK to add the archive as a repository.
  8. -
  9. In the Install dialog, select the Software Guard Extensions Plugin check-box and proceed with the usual steps.
  10. -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm deleted file mode 100644 index 8d58e09d73..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard _Extensions_Eclipse_Plugin.htm +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - What is Intel(R) Software Guard Extensions? - - - -

Introducing Intel(R) Software Guard Extensions

-

Intel(R) Software Guard Extensions is a new Intel technology, whose objective is to enable a high level of protection of secrets. It operates by allocating hardware-protected memory where code and data reside. The protected memory area within an application process is called an enclave. Data within the enclave memory can only be accessed by code that resides within that enclave. Enclave code can be invoked by special instructions.

-

An enclave can be built and loaded as a shared object.

-

Throughout this document, Intel(R) SGX refers to Intel(R) Software Guard Extensions.

-

An Intel(R) SGX application design is different from the design of non- Intel(R) SGX application as it specifies dividing the application into two logical parts:

-
    -
  • Trusted part. The code that accesses the secret resides here and it is called an enclave. More than one enclave can exist in an application.
  • -
  • Untrusted part. This includes the rest of the modules in the application, that is outside in an enclave.
  • -
-

The trusted components and untrusted components are developed as separate modules.

-

The trusted part or the enclave is implemented in C or C++. It is supplied as a collection of functions and data packaged in the form of a dynamically loaded library, a DLL in Windows* OS and a shared object in Linux* OS. It may be supplied either as a pre-built signed library or as a signed shared library built during compilation of the untrusted component.

-

Enclave functions within an enclave library are wrapped by auto-generated proxy and bridge functions that simplify the mechanism of using the Intel(R) SGX technology by developers.

-

The role of these functions is to handle the following tasks:

-
    -
  • Call an enclave function from untrusted code, also called an ECALL (enclave call).
  • -
  • Call an untrusted function from within an enclave, also called an OCALL (outside call).
  • -
  • Handle interrupts.
  • -
  • Handle exceptions.
  • -
-

The proxy and bridge functions are generated by the sgx_edger8r tool provided by Intel(R) SGX SDK. It reads an edl file (Enclave Descriptor Language) which describes the functions that form the trusted and untrusted component boundaries within the application.

-

After the enclave is built, a signed version of it is created using the tool sgx_sign also provided by Intel(R) SGX SDK. It is this signed version may be loaded and executed in the encrypted memory.

-

Enclaves may have some specific properties which are added as meta-information during the signing process. The meta-information is stored in one configuration xml file per enclave, whose details may be seen in Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm deleted file mode 100644 index e65c2fbaa1..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introducing_Intel_Software_Guard_Extensions.htm +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - What can be done with Linux SGX Eclipse Plugin? - - - -

Introducing Intel(R) Software Guard Extensions Eclipse* Plugin

-

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

-

Once the SGX nature is added to a project, you will have access to the SGX commands. SGX nature adds also a folder called sgx to the root of the project, and a Makefile inside it. All resources of the project managed by Intel(R) Software Guard Extensions Eclipse Plug-inare located inside this directory. You can build and run enclaves related code using GNU* Make tool through the Makefile.

-

The plugin is generating minimal but ready-to-work code skeletons, complete with their own Makefile having all the required make targets as to call sgx_edger8r tool to generate the proxies and bridges, compile these source, generate a shared object and finally, to sign the enclave with the sgx_sign tool. This provide a starting point you may build upon.

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm deleted file mode 100644 index ae45b4eaf4..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Introduction.htm +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - Introduction - - - -

Introduction

-

This Developer Guide is intended for use by Independent Service Vendors who wish to harden their Linux* applications using Intel(R) SGX Technology, code named Intel(R) Software Guard Extensions. The guide describes the procedure for installation of Intel(R) SGX Plugin for Eclipse* IDE and development of Intel(R) SGX components using the plugin. The Intel(R) SGX Plugin for Eclipse leverages on the Intel(R) Software Guard Extensions Evaluation SDK, which is a collection of APIs, libraries and tools that enable you to develop, build and debug Intel(R) SGX applications in C/C++.

-

To learn more about the Intel(R) Software Guard Extensions Evaluation SDK, see the Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

  - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm deleted file mode 100644 index fd43d5c6e7..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Legal_Information.htm +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - Legal Information - - - - -

Legal Information

-

No license (express or implied, by estoppel or otherwise) to any intellectual - property rights is granted by this document.

-

Intel disclaims all express and implied warranties, including without - limitation, the implied warranties of merchantability, fitness for a particular - purpose, and non-infringement, as well as any warranty arising from course - of performance, course of dealing, or usage in trade.

-

This document contains information on products, services and/or processes - in development.  All information provided here is subject to change - without notice. Contact your Intel representative to obtain the latest - forecast, schedule, specifications and roadmaps.

-

The products and services described may contain defects or errors known - as errata which may cause deviations from published specifications. Current - characterized errata are available on request.

-

Intel technologies features and benefits depend on system configuration - and may require enabled hardware, software or service activation. Learn - more at Intel.com, or from the OEM or retailer.

-

Copies of documents which have an order number and are referenced in - this document may be obtained by calling 1-800-548-4725 or by visiting - www.intel.com/design/literature.htm.

-

Intel, the Intel logo, Xeon, and Xeon Phi are trademarks of Intel Corporation - in the U.S. and/or other countries.

- - - - - - - - -
-

Optimization Notice

-
-

Intel's compilers may or may not optimize to the same degree - for non-Intel microprocessors for optimizations that are not unique - to Intel microprocessors. These optimizations include SSE2, SSE3, - and SSSE3 instruction sets and other optimizations. Intel does - not guarantee the availability, functionality, or effectiveness - of any optimization on microprocessors not manufactured by Intel. - Microprocessor-dependent optimizations in this product are intended - for use with Intel microprocessors. Certain optimizations not - specific to Intel microarchitecture are reserved for Intel microprocessors. - Please refer to the applicable product User and Reference Guides - for more information regarding the specific instruction sets covered - by this notice.

-

Notice revision #20110804

-
-

* Other names and brands may be claimed as the property of others.

-

© 2016 Intel Corporation.

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm deleted file mode 100644 index 462873fae3..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Prerequisites.htm +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - Pre-requisites - - - -

Pre-requisites

-

To use Intel(R) Software Guard Extensions Eclipse Plug-in, install the following softwares:

-
    -
  • Eclipse* Mars 1 with CDT IDE for C/C++ Developpers (version 4.5.1). To use this version, install Java* Development Kit (JDK) or Java* Runtime Environment (JRE) version 1.8 or above.
  • -
  • gcc/g++ tools
  • -
  • Openssl*
  • -
  • Intel(R) SGX SDK for Linux* OS
  • -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css index 6c2190cf4c..859063f2e1 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Stylesheets/intel_css_styles.css @@ -18,17 +18,16 @@ body color: #333333; background-color: #ffffff; font-family: "Intel Clear", Verdana, Arial, sans-serif; - font-size: 12pt; margin-left: 30px; margin-right: 30px; margin-bottom: 7%; color: #333333; background-color: #ffffff; font-family: "Intel Clear", Verdana, Arial, sans-serif; - font-size: 12pt; margin-left: 30px; margin-right: 30px; margin-bottom: 7%; + font-size: 12pt; } .RevUpdate @@ -126,43 +125,43 @@ h3 h4 { color: #0071c5; - margin-top: 12pt; + margin-top: 10pt; margin-bottom: 5pt; padding-left: 0px; - font-size: 12pt; + font-size: 10pt; color: #0071c5; - margin-top: 12pt; + margin-top: 10pt; margin-bottom: 5pt; padding-left: 0px; - font-size: 12pt; + font-size: 10pt; } h5 { color: #0071c5; - margin-top: 12pt; + margin-top: 10pt; margin-bottom: 5pt; padding-left: 0px; - font-size: 12pt; + font-size: 10pt; color: #0071c5; - margin-top: 12pt; + margin-top: 10pt; margin-bottom: 5pt; padding-left: 0px; - font-size: 12pt; + font-size: 10pt; } h6 { color: #0071c5; - margin-top: 12pt; + margin-top: 10pt; margin-bottom: 5pt; padding-left: 0px; - font-size: 12pt; + font-size: 10pt; color: #0071c5; - margin-top: 12pt; + margin-top: 10pt; margin-bottom: 5pt; padding-left: 0px; - font-size: 12pt; + font-size: 10pt; } .relinfo @@ -178,22 +177,21 @@ h6 caption { - font-size: 12pt; + font-weight: bold; + text-align: left; font-weight: bold; text-align: left; font-size: 12pt; - font-weight: bold; - text-align: left; } .figcap { margin-left: 24px; - font-size: 12pt; + font-size: 10pt; font-weight: bold; text-align: center; margin-left: 24px; - font-size: 12pt; + font-size: 10pt; font-weight: bold; text-align: center; } @@ -278,16 +276,15 @@ a.underlined p { - font-size: inherit; margin-left: 0px; line-height: 120%; margin-top: 0; margin-bottom: 10px; - font-size: inherit; margin-left: 0px; line-height: 120%; margin-top: 0; margin-bottom: 10px; + font-size: 12pt; } .p @@ -312,12 +309,12 @@ table border-collapse: collapse; margin-left: 0px; margin-top: 0.3em; - font-size: 12pt; + font-size: 10pt; margin-bottom: 5pt; border-collapse: collapse; margin-left: 0px; margin-top: 0.3em; - font-size: 12pt; + font-size: 10pt; } tr @@ -336,6 +333,7 @@ DIV.Note border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; + font-size: 10pt; } p.NoteTipHead @@ -347,9 +345,9 @@ p.NoteTipHead line-height: 15pt; margin-left: 0.202cm; font-family: "Verdana", "sans-serif"; - font-size: 9pt; text-transform: uppercase; text-align: justify; + font-size: 12pt; } MadCap|xref @@ -357,6 +355,7 @@ MadCap|xref color: #0860a8; mc-format: '{paratext}'; text-decoration: none; + font-size: 12pt; } div.NoteCont @@ -365,16 +364,44 @@ div.NoteCont border-bottom-width: 1px; border-top-style: solid; border-top-width: 1px; + font-size: 10pt; } p.figcap { text-align: left; + font-size: 12pt; } th { text-align: left; + font-size: 12pt; +} + +ul +{ + font-size: 12pt; +} + +ol +{ + font-size: 12pt; +} + +li +{ + font-size: 12pt; +} + +b +{ + font-size: 12pt; +} + +code +{ + font-size: 12pt; } a:link diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm deleted file mode 100644 index 1fc481290d..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Running_Samples_Generated_for_Enclaves.htm +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - Running Samples Generated for Enclaves - - - -

Running Samples Generated for Enclaves

-

Intel(R) Software Guard Extensions Eclipse* Plugin provides an option to generate a sample application together with the enclave code when the enclave is created. After the project is build, the sample application is built also and ready to run. You can see the sample application named sample in the enclave directory in Project Explorer. You can run this sample as a local C/C++ application as shown in the following figure:

-

- -

-

Sample Application

-

See the result of the execution in Eclipse console window as shown below:

-

- -

-

The Result of Running Samples Generated for Enclaves

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm deleted file mode 100644 index c41301eea7..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_Build_Configurations.htm +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - SGX Build Configurations - - - -

SGX Build Configurations

-

There are usually two types of builds that a regular non-SGX project defines:

-
    -
  • Debug
  • -
  • Release
  • -
-

SGX-enabled projects add to this picture support to build and test SGX-enabled application on non-SGX platforms (or emulator) using simulation libraries. This approach doubles the set of build types, creating four possible combinations. For these combinations, you need to use different sets of compilation and linking flags and link different libraries.

-

The non-debug hardware build is meant to give production code, so it requires the maximum attention when signed. The Two Steps Sign schema is required for production enclaves, which involves an external signing facility, not part of Intel SGX SDK. The other configurations are not meant for production but they have to be signed too. The simplest and more convenient Single Step schema is used for them.

-

Again for testing purpose, you might want to experiment with a non-production enclave built with release compilation and linking flags, on a real hardware SGX-enabled platform. That would be an enclave built exactly as a production enclave, except for the sign process which would be Single Step. To support the construction of such enclave, there is a hardware non-debug build configuration dubbed Prerelease.

-

So there are five SGX related configurations when SGX Nature is added to a project:

-

- -

-

Intel(R) SGX Configurations

-

The following table resumes the existing SGX configurations and relate them with compilation/linking flags (debug/non-debug) and signing scheme (single vs. two steps):

-

Intel(R) SGX Configurations

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Configuration NameSimulation?Debug?Signing Schema
SGX Hardware DebugHardwareDebugSingle Step
SGX Hardware Pre-releaseHardwareNon-debugSingle Step
SGX Hardware ReleaseHardwareNon-debugTwo Step
SGX SimulationSimulationNon-debugSingle Step
SGX SimulationDebug SimulationDebugSingle step
-

Intel® Software Guard Extensions Eclipse Plug-in uses standard GNU* make tool to build the trusted and the untrusted code, using the generated file sgx/Makefile.

-

This fact does not impose any restriction on the build tool chosen for the hosting project. Intel® Software Guard Extensions Eclipse* Plug-in uses its own build configurations which do not interfere with the configurations that you might have in your project.

-

When SGX configurations are selected, by default only code under <root>/sgx directory get built.

-

You can customize SGX configurations as any other Eclipse build configurations from the project properties dialog. For example:

-
    -
  1. Right-click in Project Explorer Properties → C/C++ Build
  2. -
  3. Uncheck the Use default build command checkbox.
  4. -
-

Then you can customize and integrate SGX build process. You can use Makefile instead of sgx/Makefile in the example shown in the following figure:

-

- -

-

Customization of SGX Build Command

-

The build process is done using standard Eclipse interface for build, by example from the main Project menu:

-

- -

-

Project Menu

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm deleted file mode 100644 index bbf44bea76..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/SGX_title.htm +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - Intel(R) Software Guard Extensions - - - - -

Intel(R) Software Guard Extensions

-

Developer Reference

-

Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for a -pplication developers seeking to protect select code and data from disclosure or -modification. Intel(R) SGX makes such protections possible through the use of -enclaves. Enclaves are protected areas of execution. Application code can be put -into an enclave through special instructions and software made available to -developers by the Intel(R) SGX SDK.

-

Legal Information -

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm deleted file mode 100644 index 6201863d5c..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Two_Steps_Sign_Enclave.htm +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - Two Steps Sign Enclave - - - -

Two Steps Sign Enclave

-

To help you develop enclaves, Intel(R) Software Guard Extensions Eclipse Plug-in generates all required structure including:

-
    -
  • c/c++ files and header files
  • -
  • .edl file
  • -
  • *.config.xml file
  • -
  • a sample Makefile
  • -
  • a sample signing key
  • -
-

While these structure might be appropriate for development and debugging, you need a 2-step process to integrate your own signing schema for generating production enclaves.

-
    -
  1. Generate hash: the signer tool generates signing material from the unsigned compiled enclave and from the configuration file for the enclave. The signed material comes as an opaque sequence of bytes which are put in a file with extension .hex. This file is used with the external signing facility. You come back with a signature for the .hex file plus the public key of your signing facility, and proceed to Step 2.
  2. -
  3. Generate signed enclaves : the signer tool generates the final signed enclave.
  4. -
-

To complete this task, provide the following input parameters:

-
    -
  • The unsigned enclave
  • -
  • The configuration file
  • -
  • The output file produced when you generate hash (the .hex file)
  • -
  • The files produced by the external signing facility: the signature of the .hex file and public key for it
  • -
  • The plugin checks if the input parameters are consistent:
  • -
  • The .hex file matches the unsigned enclave and the configuration file,
  • -
  • The signed material is verified with the public key
  • -
-

If the parameters are consistenet, the production signed enclave is produced.

-
-

NOTE:

-

If you generate signed enclave right after generating hash, you can only enter the parameters specific for generating signed enclave.

-
-

To use the two-step signing function, activate the configuration SGX Hardware Release mode. When this configuration is active, the compilation does not produce a signed enclave, as in the other SGX configurations; the process only produces unsigned enclaves.

-

- -

-

Configure SGX Hardware Release Mode

-

When you configure the plugin in the SGX Hardware Release Mode, you can see the Generate Hash and Generate Signed Enclave options through Software Guard Extension Tools->Two Step Sign Enclave.

-

- -

-

Two Step Sign Enclave Menu

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm deleted file mode 100644 index d416791d27..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_Enclave_Configuration_Files.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - Updating Enclave Configuration Files - - - -

Updating Enclave Configuration Files

-

A configuration file is an important part in the definition of an enclave. Intel(R) SGX SDK signer tool requires such *.xml configuration file as necessary input.

-

To update this configuration file, use the Update Config command:

-
    -
  1. -

    Right-click on the root project, Software Extension Guards Tools->Select Config File.

    -

    - -

    -

    Select Configuration File

    -
  2. -
  3. -

    Click OK or double-click the selected configuration file to open the Enclave Configuration Settings dialog.

    -

    - -

    -

    Enclave Configuration Settings

    -

    For details on the meaning of the fields, see Intel(R) Software Guard Extensions Developer Guide.

    -
  4. -
- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm deleted file mode 100644 index d536de1c6d..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Updating_SGX_Enclave_Signing_Key.htm +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - Updating SGX Enclave Signing Key - - - -

Updating SGX Enclave Signing Key

-

All skeletons enclave samples produced by the plugin contain a sample signing key. You might want to import another sign key that you already have, or generate a new one. Use the command Update SGX Enclave Signing Key to complete this task.

-
    -
  1. Choose Update SGX Enclave Signing Key by right-click on the project in Project Explorer -> Software Guard Extension Tools menu. The Import or (Re)Generate Enclave Signing Key dialog appears.
  2. -
  3. In the Import or (Re)Generate Enclave Signing Key dialog, click Select to open a file dialog to select the output key.
  4. -
  5. -

    Click Improt Key to update a selected signing key by copying another existing key or click Generate Key to update the selected signing key by generating a new key. In both cases, the new signature key is put into the file in text field Enclave Signing Key.

    -

    - -

    -

    Import or (Re)Generate Enclave Signing Key

    -
  6. -
  7. Click OK to update the enclave signing key.
  8. -
-

Under the hood, a new key is generated using openssl*, which needs to be installed on the machine:

-

openssl genrsa -out ../../../encl1_private.pem.key.pem -3 3072 -

-

- - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html index 40f03550f3..b2a5bad637 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html @@ -1,35 +1,34 @@ - - - - - - - - - - - + + + + + + + + +
+

Intel(R) Software Guard Extensions Plug-in for Eclipse*

Developer Guide

-

Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for a -pplication developers seeking to protect select code and data from disclosure or +

Intel(R) Software Guard Extensions (Intel(R) SGX) is an Intel technology for application developers seeking to protect select code and data from disclosure or modification. Intel(R) SGX makes such protections possible through the use of enclaves. Enclaves are protected areas of execution. Application code can be put into an enclave through special instructions and software made available to developers by the Intel(R) SGX SDK.

-

Legal Information +

Legal Information

- - -

Legal Information

+
+ +
+

Introduction

+

This Developer Guide is intended for use by Independent Service Vendors who wish to harden their Linux* applications using Intel(R) SGX Technology, code named Intel(R) Software Guard Extensions. The guide describes the procedure for installation of Intel(R) SGX Plugin for Eclipse* IDE and development of Intel(R) SGX components using the plugin. The Intel(R) SGX Plugin for Eclipse leverages on the Intel(R) Software Guard Extensions SDK, which is a collection of APIs, libraries and tools that enable you to develop, build and debug Intel(R) SGX applications in C/C++.

+

To learn more about the Intel(R) Software Guard Extensions SDK, see the Intel(R) Software Guard Extensions SDK for Linux* OS Developer Reference.

 
+
+

Introducing Intel(R) Software Guard Extensions

Intel(R) Software Guard Extensions is a new Intel technology, whose objective is to enable a high level of protection of secrets. It operates by allocating hardware-protected memory where code and data reside. The protected memory area within an application process is called an enclave. Data within the enclave memory can only be accessed by code that resides within that enclave. Enclave code can be invoked by special instructions.

An enclave can be built and loaded as a shared object.

Throughout this document, Intel(R) SGX refers to Intel(R) Software Guard Extensions.

@@ -105,22 +104,22 @@ developers by the Intel(R) SGX SDK.

The proxy and bridge functions are generated by the sgx_edger8r tool provided by Intel(R) SGX SDK. It reads an edl file (Enclave Descriptor Language) which describes the functions that form the trusted and untrusted component boundaries within the application.

After the enclave is built, a signed version of it is created using the tool sgx_sign also provided by Intel(R) SGX SDK. It is this signed version may be loaded and executed in the encrypted memory.

-

Enclaves may have some specific properties which are added as meta-information during the signing process. The meta-information is stored in one configuration xml file per enclave, whose details may be seen in Intel(R) Software Guard Extensions Evaluation SDK for Linux* OS.

- - -

Introducing Intel(R) Software Guard Extensions Eclipse* Plug-in

-

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

+

Enclaves may have some specific properties which are added as meta-information during the signing process. The meta-information is stored in one configuration xml file per enclave, whose details may be seen in Intel(R) Software Guard Extensions SDK for Linux* OS.

+
+
+

Introducing Intel(R) Software Guard Extensions Eclipse* Plug-in

+

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

Once the SGX nature is added to a project, you will have access to the SGX commands. SGX nature adds also a folder called sgx to the root of the project, and a Makefile inside it. All resources of the project managed by Intel(R) Software Guard Extensions Eclipse Plug-inare located inside this directory. You can build and run enclaves related code using GNU* Make tool through the Makefile.

The plugin is generating minimal but ready-to-work code skeletons, complete with their own Makefile having all the required make targets as to call sgx_edger8r tool to generate the proxies and bridges, compile these source, generate a shared object and finally, to sign the enclave with the sgx_sign tool. This provide a starting point you may build upon.

- - -

Getting Started with Intel(R) Software Guard Extensions Eclipse* Plug-in

+
+
+

Getting Started with Intel(R) Software Guard Extensions Eclipse* Plug-in

This section contains steps to set up your Intel(R) Software Guard Extensions Eclipse* Plug-in on a Linux* system, including necessary softwares, steps to install the product, and steps to configure your preferred product directory.

• Pre-requisites

• Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

-

• Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

  - -

Pre-requisites

+

• Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

 
+
+

Pre-requisites

To use Intel(R) Software Guard Extensions Eclipse Plug-in, install the following softwares:

  • Eclipse* Mars 1 with CDT IDE for C/C++ Developpers (version 4.5.1). To use this version, install Java* Development Kit (JDK) or Java* Runtime Environment (JRE) version 1.8 or above.
  • @@ -128,9 +127,9 @@ developers by the Intel(R) SGX SDK.

  • Openssl*
  • Intel(R) SGX SDK for Linux* OS
- - -

Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

+
+
+

Installing Intel(R) Software Guard Extensions Eclipse* Plug-in

Install Intel(R) Software Guard Extensions Eclipse* Plug-in as a regular Eclipse Plugin:

  1. Download the zip archive of Intel(R) Software Guard Extensions Eclipse Plug-in from Intel Site
  2. @@ -151,9 +150,9 @@ developers by the Intel(R) SGX SDK.

  3. Press OK to add the archive as a repository.
  4. In the Install dialog, select the Software Guard Extensions Plugin check-box and proceed with the usual steps.
- - -

Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

+
+
+

Configuring Intel(R) Software Guard Extensions Eclipse* Plug-in

If you do not install Intel(R) SGX SDK for Linux* OS in the default location, you need to specify the path for Intel SGX SDK using the following steps:

  1. @@ -165,9 +164,9 @@ developers by the Intel(R) SGX SDK.

  2. Enter the path for Intel SGX SDK for Linux OS in the SGX SDK Directory field.
- - -

Command Reference

+
+
+

Command Reference

This topic provides the command reference for the following scenarios of using Intel(R) Software Guard Extensions Eclipse* Plug-in:

  • Adding SGX nature to a project
  • @@ -178,14 +177,14 @@ developers by the Intel(R) SGX SDK.

  • Updating enclave configuration files
  • Two steps sign enclave
-

All commands brought by Intel(R) Software Guard Extensions Eclipse Plug-in are available by right-clicking on the Project root in Project explorer view in menu Software Guard Extension Tools:

 

Project Explorer

  - -

Adding SGX Nature to a Project

+

All commands brought by Intel(R) Software Guard Extensions Eclipse Plug-in are available by right-clicking on the Project root in Project explorer view in menu Software Guard Extension Tools:

 

Project Explorer

 
+
+

Adding SGX Nature to a Project

The nature of an Eclipse project is a concept defined by an Eclipse Platform which allows a plug-in to tag a project as a specific kind of project. Intel(R) Software Guard Extensions uses an SGX nature to add SGX-specific behavior to projects. Project natures are defined by plug-ins, and are typically added or removed per-project when the user performs some action defined by the plug-in.

-

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

- - -

Adding SGX Nature to a non-SGX project

+

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

+
+
+

Adding SGX Nature to a non-SGX project

When you have a C/C++ project created without Intel SGX, you cannot use Intel SGX support. In this case, you need to add SGX nature to this project to use Intel SGX support:

  1. Right-click on the project root
  2. @@ -221,9 +220,9 @@ developers by the Intel(R) SGX SDK.

    Configurations Specific to Intel(R) SGX Technology

    - - -

    Creating a New C/C++ Project with SGX Nature

    +
+
+

Creating a New C/C++ Project with SGX Nature

You can create a new project with SGX nature. To create such a project, follow these steps:

  1. @@ -241,9 +240,9 @@ developers by the Intel(R) SGX SDK.

    NOTE:

    Projects created following the subcategories under C/C++ with SGX Enabled are identical with their standard counterparts, except that they have SGX Nature added. There is no difference between creating a C or C++ project with SGX enabled, or creating a standard C/C++ project and launch Add SGX nature from it, as described in precedent paragraph.

- - -

Adding an SGX Enclave

+ +
+

Adding an SGX Enclave

After you add the SGX nature to a project, you can start creating a minimal but complete skeleton for a new enclave:

  1. Right-click on the project root in Project Explorer.
  2. @@ -278,9 +277,9 @@ developers by the Intel(R) SGX SDK.

    NOTE:

    If you select the Generate sample untrusted application checkbox, ecalls from the untrusted part are not be resolved by Eclipse C/C++ indexer. These functions are marked with a red line. The declaration of these ecalls resides in the unstrusted stub header which is generated during the build proces and is not indexed by Eclipse. To resolve this problem, right-click on project root and select Index → Freshen All Files.

- - -

Adding an SGX Trusted Library

+ +
+

Adding an SGX Trusted Library

Trusted Static Libraries helps enclave author have libraries of shared code to be reused by enclaves, in exactly the same manner as usual static libxxx.a libraries are used to share code between regular non-SGX applications. The plugin adds a command to generate the skeleton of a trusted shared library.

To add a new SGX Trusted Library:

    @@ -299,9 +298,9 @@ developers by the Intel(R) SGX SDK.

    A Generated Trusted Library

- - -

Adding an SGX Untrusted Module

+
+
+

Adding an SGX Untrusted Module

Add an untrusted module to generate the untrusted stubs so you use an enclave, provided you have access to its .edl file. The enclave might have been built in the current project or in a different project.

To use trusted functionality of an enclave for which its *.edl is known, use the command Add SGX Untrusted Module:

    @@ -320,9 +319,9 @@ developers by the Intel(R) SGX SDK.

    Copying the Untrusted Module to a Project

- - -

Updating SGX Enclave Signing Key

+
+
+

Updating SGX Enclave Signing Key

All skeletons enclave samples produced by the plugin contain a sample signing key. You might want to import another sign key that you already have, or generate a new one. Use the command Update SGX Enclave Signing Key to complete this task.

  1. Choose Update SGX Enclave Signing Key by right-click on the project in Project Explorer -> Software Guard Extension Tools menu. The Import or (Re)Generate Enclave Signing Key dialog appears.
  2. @@ -340,9 +339,9 @@ developers by the Intel(R) SGX SDK.

    openssl genrsa -out ../../../encl1_private.pem.key.pem -3 3072

    - - -

    Updating Enclave Configuration Files

    +
+
+

Updating Enclave Configuration Files

A configuration file is an important part in the definition of an enclave. Intel(R) SGX SDK signer tool requires such *.xml configuration file as necessary input.

To update this configuration file, use the Update Config command:

    @@ -362,9 +361,9 @@ developers by the Intel(R) SGX SDK.

    For details on the meaning of the fields, see Intel(R) Software Guard Extensions Developer Guide.

- - -

Two Steps Sign Enclave

+
+
+

Two Steps Sign Enclave

To help you develop enclaves, Intel(R) Software Guard Extensions Eclipse Plug-in generates all required structure including:

  • c/c++ files and header files
  • @@ -403,9 +402,9 @@ developers by the Intel(R) SGX SDK.

    Two Step Sign Enclave Menu

    - - -

    Generate Hash

    +
+
+

Generate Hash

Generating hash is the first step in the 2-Steps signing process.To generate hash, use the following steps:

  1. @@ -431,9 +430,9 @@ developers by the Intel(R) SGX SDK.

    Generate Signed Enclave Dialog with Pre-configurations

    If you click Cancel in the Generate Signed Enclave dialog, you can continue the signing process later using the Generate Signed Enclave command.

    - - -

    Generate Signed Enclaves

    +
+
+

Generate Signed Enclaves

Generating signed enclave is the second step in the 2-Steps signing process. You should have the following files to complete this step:

  • The .hex file generated with Generate Hash command
  • @@ -452,16 +451,16 @@ developers by the Intel(R) SGX SDK.

  • Enter the inputs to all the fields and click OK.
  • - - -

    Building and Running SGX Code

    +
+
+

Building and Running SGX Code

This section describes the following topics about building and running SGX code:

  • SGX build configurations
  • Running samples generated for enclaves
  • -
  - -

SGX Build Configurations

+  
+
+

SGX Build Configurations

There are usually two types of builds that a regular non-SGX project defines:

  • Debug
  • @@ -539,9 +538,9 @@ developers by the Intel(R) SGX SDK.

    Project Menu

    - - -

    Running Samples Generated for Enclaves

    +
+
+

Running Samples Generated for Enclaves

Intel(R) Software Guard Extensions Eclipse* Plugin provides an option to generate a sample application together with the enclave code when the enclave is created. After the project is build, the sample application is built also and ready to run. You can see the sample application named sample in the enclave directory in Project Explorer. You can run this sample as a local C/C++ application as shown in the following figure:

@@ -552,6 +551,6 @@ developers by the Intel(R) SGX SDK.

The Result of Running Samples Generated for Enclaves

- - +
+ diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml index 85c36da39e..9a4a908de0 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml @@ -1,90 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml index a957526f95..1b2f224567 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXEnclave/trusted/Enclave1.config.xml @@ -1,4 +1,3 @@ - 0 0 diff --git a/Linux_SGXEclipsePlugin/build_directory/sites/site.xml b/Linux_SGXEclipsePlugin/build_directory/sites/site.xml index a0a475351b..3c3d422d7b 100644 --- a/Linux_SGXEclipsePlugin/build_directory/sites/site.xml +++ b/Linux_SGXEclipsePlugin/build_directory/sites/site.xml @@ -17,5 +17,7 @@ - + + SGX Eclipse Plugin 1.0.1.qualifier + diff --git a/Linux_SGXEclipsePlugin/clean.sh b/Linux_SGXEclipsePlugin/clean.sh index 0b3edca3d7..ba0f7bc78a 100755 --- a/Linux_SGXEclipsePlugin/clean.sh +++ b/Linux_SGXEclipsePlugin/clean.sh @@ -13,7 +13,7 @@ rm -fv build_directory/features/com.intel.sgx.feature/build.xml rm -fv build_directory/features/com.intel.sgx.feature/*.zip rm -rfv build_directory/nestedJars rm -rfv build_directory/updatesite/sgx-eclipse-plugin -find . -name "*.zip" | xargs rm -rfv +find . -name "*.zip" ! -name "eclipse_mars.v4.5.1_x64.zip" | xargs rm -rfv find . -name "javaCompiler*" | xargs rm -rfv find . -name "@*" | xargs rm -rfv find build_directory -maxdepth 1 -mindepth 1 | grep -v "features" | grep -v "plugins" | grep -v "sites" | grep -v "updatesite" | xargs rm -frv diff --git a/Linux_SGXEclipsePlugin/readme.txt b/Linux_SGXEclipsePlugin/readme.txt index 53b7c6241a..1430d35772 100644 --- a/Linux_SGXEclipsePlugin/readme.txt +++ b/Linux_SGXEclipsePlugin/readme.txt @@ -1,21 +1,22 @@ -The eclipse plugin build from commandline requires the following variables to be set +The eclipse plugin build from command line requires the following variables to be set. $ECLIPSE_HOME - Path to eclipse home. In order to build the plugin eclipse needs to be installed. -$RELEASE_ID - The release id for the plugin. - -The plugin has been tested with the following Eclipse ADT version - -Build: v22.3.0-887826 +$RELEASE_ID - The release id for the plugin. The release id should be changed for each source codes updates. +$DELETE_CURRENT_ECLIPSE - Delete current eclipse or not. Generally this variable is set to false. The following plugins are pre-requisites to be installed in Eclipse before trying to build the plugin. 1. Eclipse IDE for C/C++ Developers 4.5.1.20150917-1200 (tested_version) 2. Eclipse PDE Plug-in Developer Resources 3.11.1.v20150904-0345 (tested_version) +run ./build.sh from command line under current directory. +Once the build script is run, the folder build_directory/updatesite/sgx-eclipse-plugin contains the update site. This is the path that needs to be provided to the eclipse while doing installation. If the sgx eclipse plugin is already installed to eclipse and to build and install a newer version, uninstall the old version and start eclipse with the -clean option. Then try to build the new version of the plugin and install it in eclipse. http://wiki.eclipse.org/FAQ_How_do_I_remove_a_plug-in%3F -Once the build script is run, the folder build_directory/updatesite/sgx-eclipse-plugin contains the update site. This is the path that needs to be provided to the eclipse while doing installation. +The plugin has been tested with the following Eclipse ADT version + +Build: v22.3.0-887826 diff --git a/Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy b/Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy deleted file mode 100644 index 99c0aa1168..0000000000 --- a/Linux_SGXEclipsePlugin/src/main/groovy/preprocessHtml.groovy +++ /dev/null @@ -1,34 +0,0 @@ -import groovy.xml.MarkupBuilder -import groovy.xml.StreamingMarkupBuilder - - -println "Hello, Script!!!" - - - -def fragments = new XmlParser(false, true).parseText("") - -def resultFile = new File('/home/mlutescu/0_WORK/SGXUserGuide/developer_guide_eclipse_plugin/Output/WebHelp/Content/test.html') - -if (resultFile.exists()) { - resultFile.delete() -} - -def fltoc = new File('/home/mlutescu/0_WORK/SGXUserGuide/developer_guide_eclipse_plugin/Project/TOCs/Master.fltoc') -def toc = (new XmlParser()).parse(fltoc) -def contentDir = new File(fltoc, '../../../').canonicalPath - -def PrintWriter pw = new PrintWriter(new FileWriter(resultFile)) - - -toc.TocEntry['**'].each { tocEntry -> - def htmlFile = new File(contentDir, "${tocEntry.'@Link'}") - - - println htmlFile.text -} - - - -println groovy.xml.XmlUtil.serialize( fragments) - diff --git a/README.md b/README.md index a2e80a18e9..5dba72abc8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ See CONTRIBUTING.md for details. Documentation ------------- -- [Intel(R) SGX for Linux\* OS][1] project home page on [01.org](http://01.org) +- [Intel(R) SGX for Linux\* OS][1] project home page on [01.org](https://01.org) - [Intel(R) SGX Programming Reference][2] [1]: https://01.org/intel-softwareguard-extensions [2]: https://software.intel.com/sites/default/files/managed/48/88/329298-002.pdf @@ -44,7 +44,7 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package $ sudo apt-get install libcurl4-openssl-dev protobuf-compiler protobuf-c-compiler libprotobuf-dev libprotobuf-c0-dev ``` - Use the script `download_prebuilt.sh` inside source code package to download prebuilt binaries to prebuilt folder - You may need set http proxy for wget tool used by the script (such as `export http_proxy=http://test-proxy:test-port`) + You may need set https proxy for wget tool used by the script (such as `export https_proxy=http://test-proxy:test-port`) ``` $ ./download_prebuilt.sh ``` @@ -92,16 +92,12 @@ Install Intel(R) SGX SDK ``` ###Install Intel(R) SGX SDK -To install Intel(R) SGX SDK, execute the installer with root privilege: +To install Intel(R) SGX SDK, enter the following commands: ``` $ cd linux/installer/bin -$ sudo ./sgx_linux_x64_sdk_${version}.bin +$ ./sgx_linux_x64_sdk_${version}.bin ``` ###Test Intel(R) SGX SDK Package with the Sample Codes -- Copy the sample codes installed by Intel(R) SGX SDK package into your work folder, such as -``` - $ cp -r /opt/intel/sgxsdk/SampleCode ~ -``` - Compile and run each sample codes in the simulation mode to make sure the package works well. ``` $ cd SampleCode/LocalAttestation @@ -114,10 +110,6 @@ $ sudo ./sgx_linux_x64_sdk_${version}.bin If you use an SGX hardware enabled machine, you need to run the sample codes in the hardware mode. Ensure that you install SGX driver and Intel(R) SGX PSW installer on the machine. See the topic, Install Intel(R) SGX PSW, on how to install the PSW package. -- Copy the sample codes installed by the Intel(R) SGX SDK package into your work folder, such as -``` - $ cp -r /opt/intel/sgxsdk/SampleCode ~ -``` - Compile and run each sample codes in the debug mode. ``` $ cd SampleCode/LocalAttestation diff --git a/SampleCode/LocalAttestation/Makefile b/SampleCode/LocalAttestation/Makefile index eaacfc8ffe..119fa78f7f 100644 --- a/SampleCode/LocalAttestation/Makefile +++ b/SampleCode/LocalAttestation/Makefile @@ -131,6 +131,14 @@ Enclave_Cpp_Files_3 := $(wildcard Enclave3/*.cpp) Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -I./LocalAttestationCode -I./Include Enclave_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) + +# To generate a proper enclave, it is recommended to follow below guideline to link the trusted libraries: +# 1. Link sgx_trts with the `--whole-archive' and `--no-whole-archive' options, +# so that the whole content of trts is included in the enclave. +# 2. For other libraries, you just need to pull the required symbols. +# Use `--start-group' and `--end-group' to link these libraries. +# Do NOT move the libraries linked with `--start-group' and `--end-group' within `--whole-archive' and `--no-whole-archive' options. +# Otherwise, you may get some undesirable errors. Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -L. -lLocalAttestation_Trusted -l$(Service_Library_Name) -Wl,--end-group \ @@ -162,7 +170,7 @@ all: $(Trust_Lib_Name) $(UnTrustLib_Name) Enclave1.so Enclave2.so Enclave3.so $( @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave Enclave1.so -out <$(Enclave_Name_1)> -config Enclave1/Enclave1.config.xml" @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave Enclave2.so -out <$(Enclave_Name_2)> -config Enclave2/Enclave2.config.xml" @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave Enclave3.so -out <$(Enclave_Name_3)> -config Enclave3/Enclave3.config.xml" - @echo "You can also sign the enclaves using an external signing tool. See User's Guide for more details." + @echo "You can also sign the enclaves using an external signing tool." @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: $(Trust_Lib_Name) $(UnTrustLib_Name) $(Enclave_Name_1) $(Enclave_Name_2) $(Enclave_Name_3) $(App_Name) diff --git a/SampleCode/PowerTransition/Makefile b/SampleCode/PowerTransition/Makefile index 5c03d8aaa6..32b9d2f3fc 100644 --- a/SampleCode/PowerTransition/Makefile +++ b/SampleCode/PowerTransition/Makefile @@ -124,6 +124,14 @@ Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX Enclave_Compile_CFlags := -nostdinc -ffreestanding -fvisibility=hidden -fpie \ $(Enclave_Include_Paths) Enclave_Compile_CXXFlags := -nostdinc++ -std=c++03 $(Enclave_Compile_CFlags) + +# To generate a proper enclave, it is recommended to follow below guideline to link the trusted libraries: +# 1. Link sgx_trts with the `--whole-archive' and `--no-whole-archive' options, +# so that the whole content of trts is included in the enclave. +# 2. For other libraries, you just need to pull the required symbols. +# Use `--start-group' and `--end-group' to link these libraries. +# Do NOT move the libraries linked with `--start-group' and `--end-group' within `--whole-archive' and `--no-whole-archive' options. +# Otherwise, you may get some undesirable errors. Enclave_Link_Flags := -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ @@ -154,7 +162,7 @@ all: $(App_Name) $(Enclave_Name) @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." @echo "To sign the enclave use the command:" @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" - @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." + @echo "You can also sign the enclave using an external signing tool." @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: $(App_Name) $(Signed_Enclave_Name) diff --git a/SampleCode/RemoteAttestation/Makefile b/SampleCode/RemoteAttestation/Makefile index 7335b486c9..541fad85c3 100644 --- a/SampleCode/RemoteAttestation/Makefile +++ b/SampleCode/RemoteAttestation/Makefile @@ -65,6 +65,9 @@ else SGX_COMMON_CFLAGS += -O2 endif +ifeq ($(SUPPLIED_KEY_DERIVATION), 1) + SGX_COMMON_CFLAGS += -DSUPPLIED_KEY_DERIVATION +endif ######## App Settings ######## ifneq ($(SGX_MODE), HW) @@ -130,6 +133,14 @@ Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++03 -nostdinc++ + +# To generate a proper enclave, it is recommended to follow below guideline to link the trusted libraries: +# 1. Link sgx_trts with the `--whole-archive' and `--no-whole-archive' options, +# so that the whole content of trts is included in the enclave. +# 2. For other libraries, you just need to pull the required symbols. +# Use `--start-group' and `--end-group' to link these libraries. +# Do NOT move the libraries linked with `--start-group' and `--end-group' within `--whole-archive' and `--no-whole-archive' options. +# Otherwise, you may get some undesirable errors. Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -lsgx_tkey_exchange -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ @@ -161,7 +172,7 @@ all: libservice_provider.so $(App_Name) $(Enclave_Name) @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." @echo "To sign the enclave use the command:" @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" - @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." + @echo "You can also sign the enclave using an external signing tool." @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: libservice_provider.so $(App_Name) $(Signed_Enclave_Name) diff --git a/SampleCode/RemoteAttestation/isv_app/isv_app.cpp b/SampleCode/RemoteAttestation/isv_app/isv_app.cpp index 472e81902f..0fb3590acb 100644 --- a/SampleCode/RemoteAttestation/isv_app/isv_app.cpp +++ b/SampleCode/RemoteAttestation/isv_app/isv_app.cpp @@ -29,10 +29,14 @@ * */ +// This sample is confined to the communication between a SGX client platform +// and an ISV Application Server. + #include #include +#include // Needed for definition of remote attestation messages. #include "remote_attestation_result.h" @@ -48,6 +52,9 @@ // Needed to create enclave and do ecall. #include "sgx_urts.h" +// Needed to query extended epid group id. +#include "sgx_uae_service.h" + #include "service_provider.h" #ifndef SAFE_FREE @@ -116,6 +123,10 @@ void PRINT_ATTESTATION_SERVICE_RESPONSE( fprintf(file, "MSG2 spid - "); PRINT_BYTE_ARRAY(file, &(p_msg2_body->spid), sizeof(p_msg2_body->spid)); + fprintf(file, "MSG2 quote_type : %hx\n", p_msg2_body->quote_type); + + fprintf(file, "MSG2 kdf_id : %hx\n", p_msg2_body->kdf_id); + fprintf(file, "MSG2 sign_gb_ga - "); PRINT_BYTE_ARRAY(file, &(p_msg2_body->sign_gb_ga), sizeof(p_msg2_body->sign_gb_ga)); @@ -154,19 +165,21 @@ void PRINT_ATTESTATION_SERVICE_RESPONSE( // This sample code doesn't have any recovery/retry mechanisms for the remote // attestation. Since the enclave can be lost due S3 transitions, apps -// susceptible to S3 transtions should have logic to restart attestation in -// these scenenarios. +// susceptible to S3 transitions should have logic to restart attestation in +// these scenarios. #define _T(x) x int main(int argc, char* argv[]) { int ret = 0; + ra_samp_request_header_t *p_msg0_full = NULL; + ra_samp_response_header_t *p_msg0_resp_full = NULL; ra_samp_request_header_t *p_msg1_full = NULL; ra_samp_response_header_t *p_msg2_full = NULL; sgx_ra_msg3_t *p_msg3 = NULL; ra_samp_response_header_t* p_att_result_msg_full = NULL; sgx_enclave_id_t enclave_id = 0; int enclave_lost_retry_time = 1; - int busy_retry_time = 2; + int busy_retry_time = 4; sgx_ra_context_t context = INT_MAX; sgx_status_t status = SGX_SUCCESS; ra_samp_request_header_t* p_msg3_full = NULL; @@ -204,7 +217,54 @@ int main(int argc, char* argv[]) } } - // Remote attestaton will be initiated the ISV server challenges the ISV + // Preparation for remote attestation by configuring extended epid group id. + { + uint32_t extended_epid_group_id = 0; + ret = sgx_get_extended_epid_group_id(&extended_epid_group_id); + if (SGX_SUCCESS != ret) + { + ret = -1; + fprintf(OUTPUT, "\nError, call sgx_get_extended_epid_group_id fail [%s].", + __FUNCTION__); + return ret; + } + fprintf(OUTPUT, "\nCall sgx_get_extended_epid_group_id success."); + + p_msg0_full = (ra_samp_request_header_t*) + malloc(sizeof(ra_samp_request_header_t) + +sizeof(uint32_t)); + if (NULL == p_msg0_full) + { + ret = -1; + goto CLEANUP; + } + p_msg0_full->type = TYPE_RA_MSG0; + p_msg0_full->size = sizeof(uint32_t); + + *(uint32_t*)((uint8_t*)p_msg0_full + sizeof(ra_samp_request_header_t)) = extended_epid_group_id; + { + + fprintf(OUTPUT, "\nMSG0 body generated -\n"); + + PRINT_BYTE_ARRAY(OUTPUT, p_msg0_full->body, p_msg0_full->size); + + } + // The ISV application sends msg0 to the SP. + // The ISV decides whether to support this extended epid group id. + fprintf(OUTPUT, "\nSending msg0 to remote attestation service provider.\n"); + + ret = ra_network_send_receive("http://SampleServiceProvider.intel.com/", + p_msg0_full, + &p_msg0_resp_full); + if (ret != 0) + { + fprintf(OUTPUT, "\nError, ra_network_send_receive for msg0 failed " + "[%s].", __FUNCTION__); + goto CLEANUP; + } + fprintf(OUTPUT, "\nSent MSG0 to remote attestation service.\n"); + } + // Remote attestation will be initiated the ISV server challenges the ISV // app or if the ISV app detects it doesn't have the credentials // (shared secret) from a previous attestation required for secure // communication with the server. @@ -225,7 +285,7 @@ int main(int argc, char* argv[]) ret = -1; fprintf(OUTPUT, "\nError, call sgx_create_enclave fail [%s].", __FUNCTION__); - return ret; + goto CLEANUP; } fprintf(OUTPUT, "\nCall sgx_create_enclave success."); @@ -261,6 +321,7 @@ int main(int argc, char* argv[]) ret = sgx_ra_get_msg1(context, enclave_id, sgx_ra_get_ga, (sgx_ra_msg1_t*)((uint8_t*)p_msg1_full + sizeof(ra_samp_request_header_t))); + sleep(3); // Wait 3s between retries } while (SGX_ERROR_BUSY == ret && busy_retry_time--); if(SGX_SUCCESS != ret) { @@ -566,7 +627,9 @@ int main(int argc, char* argv[]) bool attestation_passed = true; // Check the attestation result for pass or fail. - // @TODO: Check the status. This is ISV defined. + // Whether attestation passes or fails is a decision made by the ISV Server. + // When the ISV server decides to trust the enclave, then it will return success. + // When the ISV server decided to not trust the enclave, then it will return failure. if(0 != p_att_result_msg_full->status[0] || 0 != p_att_result_msg_full->status[1]) { @@ -575,13 +638,20 @@ int main(int argc, char* argv[]) attestation_passed = false; } - // the SGX blob analysis API. The ISV will take action based on the - // update_info. (upgrade PSW or uCode), the second param should be 1 if - // the attestation failed, otherwise should be 0. + // The attestation result message should contain a field for the Platform + // Info Blob (PIB). The PIB is returned by attestation server in the attestation report. + // It is not returned in all cases, but when it is, the ISV app + // should pass it to the blob analysis API called sgx_report_attestation_status() + // along with the trust decision from the ISV server. + // The ISV application will take action based on the update_info. + // returned in update_info by the API. + // This call is stubbed out for the sample. + // // sgx_update_info_bit_t update_info; // ret = sgx_report_attestation_status( // &p_att_result_msg_body->platform_info_blob, // attestation_passed ? 0 : 1, &update_info); + // Get the shared secret sent by the server using SK (if attestation // passed) if(attestation_passed) @@ -630,13 +700,15 @@ CLEANUP: sgx_destroy_enclave(enclave_id); + ra_free_network_response_buffer(p_msg0_resp_full); ra_free_network_response_buffer(p_msg2_full); ra_free_network_response_buffer(p_att_result_msg_full); - // p_msg3 is malloc'd by the untrused KE library. App needs to free. + // p_msg3 is malloc'd by the untrusted KE library. App needs to free. SAFE_FREE(p_msg3); SAFE_FREE(p_msg3_full); SAFE_FREE(p_msg1_full); + SAFE_FREE(p_msg0_full); printf("\nEnter a character before exit ...\n"); getchar(); return ret; diff --git a/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp b/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp index 1d8182e3a0..980de0c8db 100644 --- a/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp +++ b/SampleCode/RemoteAttestation/isv_enclave/isv_enclave.cpp @@ -30,7 +30,7 @@ */ - +#include #include "isv_enclave_t.h" #include "sgx_tkey_exchange.h" #include "sgx_tcrypto.h" @@ -69,6 +69,134 @@ static const sgx_ec256_public_t g_sp_pub_key = { uint8_t g_secret[8] = {0}; +#ifdef SUPPLIED_KEY_DERIVATION + +#pragma message ("Supplied key derivation function is used.") + +typedef struct _hash_buffer_t +{ + uint8_t counter[4]; + sgx_ec256_dh_shared_t shared_secret; + uint8_t algorithm_id[4]; +} hash_buffer_t; + +const char ID_U[] = "SGXRAENCLAVE"; +const char ID_V[] = "SGXRASERVER"; + +// Derive two keys from shared key and key id. +bool derive_key( + const sgx_ec256_dh_shared_t *p_shared_key, + uint8_t key_id, + sgx_ec_key_128bit_t *first_derived_key, + sgx_ec_key_128bit_t *second_derived_key) +{ + sgx_status_t sgx_ret = SGX_SUCCESS; + hash_buffer_t hash_buffer; + sgx_sha_state_handle_t sha_context; + sgx_sha256_hash_t key_material; + + memset(&hash_buffer, 0, sizeof(hash_buffer_t)); + /* counter in big endian */ + hash_buffer.counter[3] = key_id; + + /*convert from little endian to big endian */ + for (size_t i = 0; i < sizeof(sgx_ec256_dh_shared_t); i++) + { + hash_buffer.shared_secret.s[i] = p_shared_key->s[sizeof(p_shared_key->s)-1 - i]; + } + + sgx_ret = sgx_sha256_init(&sha_context); + if (sgx_ret != SGX_SUCCESS) + { + return false; + } + sgx_ret = sgx_sha256_update((uint8_t*)&hash_buffer, sizeof(hash_buffer_t), sha_context); + if (sgx_ret != SGX_SUCCESS) + { + sgx_sha256_close(sha_context); + return false; + } + sgx_ret = sgx_sha256_update((uint8_t*)&ID_U, sizeof(ID_U), sha_context); + if (sgx_ret != SGX_SUCCESS) + { + sgx_sha256_close(sha_context); + return false; + } + sgx_ret = sgx_sha256_update((uint8_t*)&ID_V, sizeof(ID_V), sha_context); + if (sgx_ret != SGX_SUCCESS) + { + sgx_sha256_close(sha_context); + return false; + } + sgx_ret = sgx_sha256_get_hash(sha_context, &key_material); + if (sgx_ret != SGX_SUCCESS) + { + sgx_sha256_close(sha_context); + return false; + } + sgx_ret = sgx_sha256_close(sha_context); + + assert(sizeof(sgx_ec_key_128bit_t)* 2 == sizeof(sgx_sha256_hash_t)); + memcpy(first_derived_key, &key_material, sizeof(sgx_ec_key_128bit_t)); + memcpy(second_derived_key, (uint8_t*)&key_material + sizeof(sgx_ec_key_128bit_t), sizeof(sgx_ec_key_128bit_t)); + + // memset here can be optimized away by compiler, so please use memset_s on + // windows for production code and similar functions on other OSes. + memset(&key_material, 0, sizeof(sgx_sha256_hash_t)); + + return true; +} + +//isv defined key derivation function id +#define ISV_KDF_ID 2 + +typedef enum _derive_key_type_t +{ + DERIVE_KEY_SMK_SK = 0, + DERIVE_KEY_MK_VK, +} derive_key_type_t; + +sgx_status_t key_derivation(const sgx_ec256_dh_shared_t* shared_key, + uint16_t kdf_id, + sgx_ec_key_128bit_t* smk_key, + sgx_ec_key_128bit_t* sk_key, + sgx_ec_key_128bit_t* mk_key, + sgx_ec_key_128bit_t* vk_key) +{ + bool derive_ret = false; + + if (NULL == shared_key) + { + return SGX_ERROR_INVALID_PARAMETER; + } + + if (ISV_KDF_ID != kdf_id) + { + //fprintf(stderr, "\nError, key derivation id mismatch in [%s].", __FUNCTION__); + return SGX_ERROR_KDF_MISMATCH; + } + + derive_ret = derive_key(shared_key, DERIVE_KEY_SMK_SK, + smk_key, sk_key); + if (derive_ret != true) + { + //fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + return SGX_ERROR_UNEXPECTED; + } + + derive_ret = derive_key(shared_key, DERIVE_KEY_MK_VK, + mk_key, vk_key); + if (derive_ret != true) + { + //fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + return SGX_ERROR_UNEXPECTED; + } + return SGX_SUCCESS; +} +#else +#pragma message ("Default key derivation function is used.") +#endif + // This ecall is a wrapper of sgx_ra_init to create the trusted // KE exchange key context needed for the remote attestation // SIGMA API's. Input pointers aren't checked since the trusted stubs @@ -99,7 +227,11 @@ sgx_status_t enclave_init_ra( if (ret != SGX_SUCCESS) return ret; } +#ifdef SUPPLIED_KEY_DERIVATION + ret = sgx_ra_init_ex(&g_sp_pub_key, b_pse, key_derivation, p_context); +#else ret = sgx_ra_init(&g_sp_pub_key, b_pse, p_context); +#endif if(b_pse) { sgx_close_pse_session(); diff --git a/SampleCode/RemoteAttestation/service_provider/ecp.cpp b/SampleCode/RemoteAttestation/service_provider/ecp.cpp index 3b0ed32b98..192d20fb8c 100644 --- a/SampleCode/RemoteAttestation/service_provider/ecp.cpp +++ b/SampleCode/RemoteAttestation/service_provider/ecp.cpp @@ -74,6 +74,90 @@ bool verify_cmac128( return false; } + +#ifdef SUPPLIED_KEY_DERIVATION + +#pragma message ("Supplied key derivation function is used.") + +typedef struct _hash_buffer_t +{ + uint8_t counter[4]; + sample_ec_dh_shared_t shared_secret; + uint8_t algorithm_id[4]; +} hash_buffer_t; + +const char ID_U[] = "SGXRAENCLAVE"; +const char ID_V[] = "SGXRASERVER"; + +// Derive two keys from shared key and key id. +bool derive_key( + const sample_ec_dh_shared_t *p_shared_key, + uint8_t key_id, + sample_ec_key_128bit_t *first_derived_key, + sample_ec_key_128bit_t *second_derived_key) +{ + sample_status_t sample_ret = SAMPLE_SUCCESS; + hash_buffer_t hash_buffer; + sample_sha_state_handle_t sha_context; + sample_sha256_hash_t key_material; + + memset(&hash_buffer, 0, sizeof(hash_buffer_t)); + + /* counter in big endian */ + hash_buffer.counter[3] = key_id; + + /*convert from little endian to big endian */ + for (size_t i = 0; i < sizeof(sample_ec_dh_shared_t) ; i++) + { + hash_buffer.shared_secret.s[i] = p_shared_key->s[sizeof(p_shared_key->s) - 1 - i]; + } + + sample_ret = sample_sha256_init(&sha_context); + if (sample_ret != SAMPLE_SUCCESS) + { + return false; + } + sample_ret = sample_sha256_update((uint8_t*)&hash_buffer, sizeof(hash_buffer_t), sha_context); + if (sample_ret != SAMPLE_SUCCESS) + { + sample_sha256_close(sha_context); + return false; + } + sample_ret = sample_sha256_update((uint8_t*)ID_U, sizeof(ID_U), sha_context); + if (sample_ret != SAMPLE_SUCCESS) + { + sample_sha256_close(sha_context); + return false; + } + sample_ret = sample_sha256_update((uint8_t*)ID_V, sizeof(ID_V), sha_context); + if (sample_ret != SAMPLE_SUCCESS) + { + sample_sha256_close(sha_context); + return false; + } + sample_ret = sample_sha256_get_hash(sha_context, &key_material); + if (sample_ret != SAMPLE_SUCCESS) + { + sample_sha256_close(sha_context); + return false; + } + sample_ret = sample_sha256_close(sha_context); + + static_assert(sizeof(sample_ec_key_128bit_t)* 2 == sizeof(sample_sha256_hash_t), "structure size mismatch."); + memcpy(first_derived_key, &key_material, sizeof(sample_ec_key_128bit_t)); + memcpy(second_derived_key, (uint8_t*)&key_material + sizeof(sample_ec_key_128bit_t), sizeof(sample_ec_key_128bit_t)); + + // memset here can be optimized away by compiler, so please use memset_s on + // windows for production code and similar functions on other OSes. + memset(&key_material, 0, sizeof(sample_sha256_hash_t)); + + return true; +} + +#else + +#pragma message ("Default key derivation function is used.") + #define EC_DERIVATION_BUFFER_SIZE(label_length) ((label_length) +4) const char str_SMK[] = "SMK"; @@ -170,3 +254,4 @@ bool derive_key( } return true; } +#endif \ No newline at end of file diff --git a/SampleCode/RemoteAttestation/service_provider/ecp.h b/SampleCode/RemoteAttestation/service_provider/ecp.h index 1cda156476..0a562b05f0 100644 --- a/SampleCode/RemoteAttestation/service_provider/ecp.h +++ b/SampleCode/RemoteAttestation/service_provider/ecp.h @@ -38,10 +38,10 @@ #include "remote_attestation_result.h" #ifndef SAMPLE_FEBITSIZE -#define SAMPLE_FEBITSIZE 256 + #define SAMPLE_FEBITSIZE 256 #endif -#define SAMPLE_ECP_KEY_SIZE (SAMPLE_FEBITSIZE/8) +#define SAMPLE_ECP_KEY_SIZE (SAMPLE_FEBITSIZE/8) typedef struct sample_ec_priv_t { @@ -70,6 +70,22 @@ errno_t memcpy_s(void *dest, size_t numberOfElements, const void *src, size_t count); +#ifdef SUPPLIED_KEY_DERIVATION + +typedef enum _sample_derive_key_type_t +{ + SAMPLE_DERIVE_KEY_SMK_SK = 0, + SAMPLE_DERIVE_KEY_MK_VK, +} sample_derive_key_type_t; + +bool derive_key( + const sample_ec_dh_shared_t *p_shared_key, + uint8_t key_id, + sample_ec_key_128bit_t *first_derived_key, + sample_ec_key_128bit_t *second_derived_key); + +#else + typedef enum _sample_derive_key_type_t { SAMPLE_DERIVE_KEY_SMK = 0, @@ -83,6 +99,8 @@ bool derive_key( uint8_t key_id, sample_ec_key_128bit_t *derived_key); +#endif + bool verify_cmac128( sample_ec_key_128bit_t mac_key, const uint8_t *p_data_buf, diff --git a/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp b/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp index e39d1b1942..ec6f52f769 100644 --- a/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp +++ b/SampleCode/RemoteAttestation/service_provider/ias_ra.cpp @@ -41,9 +41,9 @@ #include #include "ias_ra.h" -// @TODO: This whole file is used as simulation of the interfaces to be -// delivered the IAS. Once the interface definitions are made available by the -// IAS, this file should be changed accordingly. +//This whole file is used as simulation of the interfaces to be +// delivered an attestation server. + #define UNUSED(expr) do { (void)(expr); } while (0) @@ -75,12 +75,10 @@ // This is the ECDSA NIST P-256 private key used to sign platform_info_blob. // This private // key and the public key in SDK untrusted KElibrary should be a temporary key -// pair. For production parts the IAS will sign the platform_info_blob with the +// pair. For production parts an attestation server will sign the platform_info_blob with the // production private key and the SDK untrusted KE library will have the public // key for verifcation. -// @TODO: This key will will not be available when the production backend -// is avaialbe. The remote attestation sample will need to change to use the -// real backend. This will likely be an RSA2048 type of key. + static const sample_ec256_private_t g_rk_priv_key = {{ 0x63,0x2c,0xd4,0x02,0x7a,0xdc,0x56,0xa5, @@ -92,7 +90,7 @@ static const sample_ec256_private_t g_rk_priv_key = static sample_spid_t g_sim_spid = {"Service X"}; -// Simulates the IAS function for verifying the quote produce by +// Simulates the attestation server function for verifying the quote produce by // the ISV enclave. It doesn't decrypt or verify the quote in // the simulation. Just produces the attestaion verification // report with the platform info blob. @@ -189,8 +187,7 @@ int ias_verify_attestation_evidence( } -// Simulates retrieving the SIGRL for upon the SP request. Becaue the IAS -// backend is not ready right now, we will return NULL. +// Simulates retrieving the SIGRL for upon the SP request. // // @param gid Group ID for the EPID key. // @param p_sig_rl_size Pointer to the output value of the full @@ -217,8 +214,7 @@ int ias_get_sigrl( } *p_sig_rl_size = 0; *p_sig_rl = NULL; - // we should try to get sig_rl from IAS, but right now we will just - // skip it until the IAS backend is ready. + // we should try to get sig_rl from an attestation server break; }while (0); @@ -226,7 +222,7 @@ int ias_get_sigrl( } -// Used to simulate the enrollment function of the IAS. It only +// Used to simulate the enrollment function of an attestation server. It only // gives back the SPID right now. In production, the enrollment // occurs out of context from an attestation attempt and only // occurs once. diff --git a/SampleCode/RemoteAttestation/service_provider/ias_ra.h b/SampleCode/RemoteAttestation/service_provider/ias_ra.h index 6230eb4e53..a984d0f06e 100644 --- a/SampleCode/RemoteAttestation/service_provider/ias_ra.h +++ b/SampleCode/RemoteAttestation/service_provider/ias_ra.h @@ -36,7 +36,6 @@ #include "ecp.h" -// These status should align with the definition in IAS API spec(rev 0.6) typedef enum { IAS_QUOTE_OK, IAS_QUOTE_SIGNATURE_INVALID, diff --git a/SampleCode/RemoteAttestation/service_provider/network_ra.cpp b/SampleCode/RemoteAttestation/service_provider/network_ra.cpp index 3db2be3973..f8ab863720 100644 --- a/SampleCode/RemoteAttestation/service_provider/network_ra.cpp +++ b/SampleCode/RemoteAttestation/service_provider/network_ra.cpp @@ -66,7 +66,18 @@ int ra_network_send_receive(const char *server_url, switch(p_req->type) { - case TYPE_RA_MSG1: + case TYPE_RA_MSG0: + ret = sp_ra_proc_msg0_req((const sample_ra_msg0_t*)((uint8_t*)p_req + + sizeof(ra_samp_request_header_t)), + p_req->size); + if (0 != ret) + { + fprintf(stderr, "\nError, call sp_ra_proc_msg1_req fail [%s].", + __FUNCTION__); + } + break; + + case TYPE_RA_MSG1: ret = sp_ra_proc_msg1_req((const sample_ra_msg1_t*)((uint8_t*)p_req + sizeof(ra_samp_request_header_t)), p_req->size, @@ -82,7 +93,7 @@ int ra_network_send_receive(const char *server_url, } break; - case TYPE_RA_MSG3: + case TYPE_RA_MSG3: ret =sp_ra_proc_msg3_req((const sample_ra_msg3_t*)((uint8_t*)p_req + sizeof(ra_samp_request_header_t)), p_req->size, @@ -98,7 +109,7 @@ int ra_network_send_receive(const char *server_url, } break; - default: + default: ret = -1; fprintf(stderr, "\nError, unknown ra message type. Type = %d [%s].", p_req->type, __FUNCTION__); diff --git a/SampleCode/RemoteAttestation/service_provider/network_ra.h b/SampleCode/RemoteAttestation/service_provider/network_ra.h index bd7fdb7108..9091bfb67c 100644 --- a/SampleCode/RemoteAttestation/service_provider/network_ra.h +++ b/SampleCode/RemoteAttestation/service_provider/network_ra.h @@ -35,20 +35,23 @@ #define _NETWORK_RA_H -// Enum for all possible message types between the ISV app and -// the ISV SP. Requests and responses in hte remote attestation -// sample. +/* Enum for all possible message types between the ISV app and + * the ISV SP. Requests and responses in the remote attestation + * sample. + */ typedef enum _ra_msg_type_t { - TYPE_RA_MSG1 = 1, + TYPE_RA_MSG0, + TYPE_RA_MSG1, TYPE_RA_MSG2, TYPE_RA_MSG3, TYPE_RA_ATT_RESULT, }ra_msg_type_t; -// Enum for all possible message types between the SP and IAS. -// Network communication is not simulated in the remote -// attestation sample. Currently these aren't used. +/* Enum for all possible message types between the SP and IAS. + * Network communication is not simulated in the remote + * attestation sample. Currently these aren't used. + */ typedef enum _ias_msg_type_t { TYPE_IAS_ENROLL, @@ -60,18 +63,18 @@ typedef enum _ias_msg_type_t #pragma pack(1) typedef struct _ra_samp_request_header_t{ - uint8_t type; // set to one of ra_msg_type_t - uint32_t size; //size of request body, - uint8_t align[3]; + uint8_t type; /* set to one of ra_msg_type_t*/ + uint32_t size; /*size of request body*/ + uint8_t align[3]; uint8_t body[]; }ra_samp_request_header_t; typedef struct _ra_samp_response_header_t{ - uint8_t type; // set to one of ra_msg_type_t - uint8_t status[2]; - uint32_t size; //size of the response body - uint8_t align[1]; - uint8_t body[]; + uint8_t type; /* set to one of ra_msg_type_t*/ + uint8_t status[2]; + uint32_t size; /*size of the response body*/ + uint8_t align[1]; + uint8_t body[]; }ra_samp_response_header_t; #pragma pack() diff --git a/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h b/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h index 5e6121cd11..86d1532b6d 100644 --- a/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h +++ b/SampleCode/RemoteAttestation/service_provider/remote_attestation_result.h @@ -38,8 +38,8 @@ extern "C" { #endif -#define SAMPLE_MAC_SIZE 16 // Message Authentication Code - // - 16 bytes +#define SAMPLE_MAC_SIZE 16 /* Message Authentication Code*/ + /* - 16 bytes*/ typedef uint8_t sample_mac_t[SAMPLE_MAC_SIZE]; #ifndef SAMPLE_FEBITSIZE @@ -59,14 +59,14 @@ typedef struct sample_ec_sign256_t #define SAMPLE_SP_TAG_SIZE 16 typedef struct sp_aes_gcm_data_t { - uint32_t payload_size; // 0: Size of the payload which is - // encrypted - uint8_t reserved[12]; // 4: Reserved bits - uint8_t payload_tag[SAMPLE_SP_TAG_SIZE]; - // 16: AES-GMAC of the plain text, - // payload, and the sizes - uint8_t payload[]; // 32: Ciphertext of the payload - // followed by the plain text + uint32_t payload_size; /* 0: Size of the payload which is*/ + /* encrypted*/ + uint8_t reserved[12]; /* 4: Reserved bits*/ + uint8_t payload_tag[SAMPLE_SP_TAG_SIZE]; + /* 16: AES-GMAC of the plain text,*/ + /* payload, and the sizes*/ + uint8_t payload[]; /* 32: Ciphertext of the payload*/ + /* followed by the plain text*/ } sp_aes_gcm_data_t; @@ -75,8 +75,8 @@ typedef struct sp_aes_gcm_data_t { #define GID_SIZE 4 #define PSVN_SIZE 18 -// @TODO: Modify at production to use the values specified by the Production -// IAS API +/* @TODO: Modify at production to use the values specified by an Production*/ +/* attestation server API*/ typedef struct ias_platform_info_blob_t { uint8_t sample_epid_group_status; @@ -92,7 +92,7 @@ typedef struct ias_platform_info_blob_t typedef struct sample_ra_att_result_msg_t { ias_platform_info_blob_t platform_info_blob; - sample_mac_t mac; // mac_smk(attestation_status) + sample_mac_t mac; /* mac_smk(attestation_status)*/ sp_aes_gcm_data_t secret; } sample_ra_att_result_msg_t; diff --git a/SampleCode/RemoteAttestation/service_provider/service_provider.cpp b/SampleCode/RemoteAttestation/service_provider/service_provider.cpp index 3736951d03..1db44c0a96 100644 --- a/SampleCode/RemoteAttestation/service_provider/service_provider.cpp +++ b/SampleCode/RemoteAttestation/service_provider/service_provider.cpp @@ -48,6 +48,17 @@ #define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr) = NULL;}} #endif +// This is supported extended epid group of SP. SP can support more than one +// extended epid group with different extended epid group id and credentials. +static const sample_extended_epid_group g_extended_epid_groups[] = { + { + 0, + ias_enroll, + ias_get_sigrl, + ias_verify_attestation_evidence + } +}; + // This is the private EC key of SP, the corresponding public EC key is // hard coded in isv_enclave. It is based on NIST P-256 curve. static const sample_ec256_private_t g_sp_priv_key = { @@ -90,6 +101,7 @@ typedef struct _sp_db_item_t }sp_db_item_t; static sp_db_item_t g_sp_db; +static const sample_extended_epid_group* g_sp_extended_epid_group_id= NULL; static bool g_is_sp_registered = false; static int g_sp_credentials = 0; static int g_authentication_token = 0; @@ -98,6 +110,60 @@ uint8_t g_secret[8] = {0,1,2,3,4,5,6,7}; sample_spid_t g_spid; + +// Verify message 0 then configure extended epid group. +int sp_ra_proc_msg0_req(const sample_ra_msg0_t *p_msg0, + uint32_t msg0_size) +{ + int ret = -1; + + if (!p_msg0 || + (msg0_size != sizeof(sample_ra_msg0_t))) + { + return -1; + } + uint32_t extended_epid_group_id = p_msg0->extended_epid_group_id; + + // Check to see if we have registered with the attestation server yet? + if (!g_is_sp_registered || + (g_sp_extended_epid_group_id != NULL && g_sp_extended_epid_group_id->extended_epid_group_id != extended_epid_group_id)) + { + // Check to see if the extended_epid_group_id is supported? + ret = SP_UNSUPPORTED_EXTENDED_EPID_GROUP; + for (size_t i = 0; i < sizeof(g_extended_epid_groups) / sizeof(sample_extended_epid_group); i++) + { + if (g_extended_epid_groups[i].extended_epid_group_id == extended_epid_group_id) + { + g_sp_extended_epid_group_id = &(g_extended_epid_groups[i]); + // In the product, the SP will establish a mutually + // authenticated SSL channel. During the enrollment process, the ISV + // registers it exchanges TLS certs with attestation server and obtains an SPID and + // Report Key from the attestation server. + // For a product attestation server, enrollment is an offline process. See the 'on-boarding' + // documentation to get the information required. The enrollment process is + // simulated by a call in this sample. + ret = g_sp_extended_epid_group_id->enroll(g_sp_credentials, &g_spid, + &g_authentication_token); + if (0 != ret) + { + ret = SP_IAS_FAILED; + break; + } + + g_is_sp_registered = true; + ret = SP_OK; + break; + } + } + } + else + { + ret = SP_OK; + } + + return ret; +} + // Verify message 1 then generate and return message 2 to isv. int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, uint32_t msg1_size, @@ -117,56 +183,24 @@ int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, return -1; } + // Check to see if we have registered? + if (!g_is_sp_registered) + { + return SP_UNSUPPORTED_EXTENDED_EPID_GROUP; + } + do { - // Check to see if we have registered with the IAS yet? - if(!g_is_sp_registered) - { - do - { - // @IAS_Q: What are the sp credentials? - // @IAS_Q: What is in the authentication token - // In the product, the SP will establish a mutually - // authenticated SSL channel. The authentication token is - // based on this channel. - // @TODO: Convert this call to a 'network' send/receive - // once the IAS server is a vaialable. - ret = ias_enroll(g_sp_credentials, &g_spid, - &g_authentication_token); - if(0 != ret) - { - ret = SP_IAS_FAILED; - break; - } - - // IAS may support registering the Enclave Trust Policy. - // Just leave a place holder here - // @IAS_Q: What needs to be sent to the IAS with the policy - // that identifies the SP? - // ret = ias_register_enclave_policy(g_enclave_policy, - // g_authentication_token); - // if(0 != ret) - // { - // break; - // } - - g_is_sp_registered = true; - break; - } while(0); - } - - // Get the sig_rl from IAS using GID. + // Get the sig_rl from attestation server using GID. // GID is Base-16 encoded of EPID GID in little-endian format. - // @IAS_Q: Does the SP need to supply any authentication info to the - // IAS? SPID? - // In the product, the SP and IAS will use an established channel for + // In the product, the SP and attesation server uses an established channel for // communication. uint8_t* sig_rl; uint32_t sig_rl_size = 0; - // @TODO: Convert this call to a 'network' send/receive - // once the IAS server is a vaialable. - ret = ias_get_sigrl(p_msg1->gid, &sig_rl_size, &sig_rl); + // The product interface uses a REST based message to get the SigRL. + + ret = g_sp_extended_epid_group_id->get_sigrl(p_msg1->gid, &sig_rl_size, &sig_rl); if(0 != ret) { fprintf(stderr, "\nError, ias_get_sigrl [%s].", __FUNCTION__); @@ -187,7 +221,7 @@ int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, sample_ret = sample_ecc256_open_context(&ecc_state); if(SAMPLE_SUCCESS != sample_ret) { - fprintf(stderr, "\nError, cannot get ECC cotext in [%s].", + fprintf(stderr, "\nError, cannot get ECC context in [%s].", __FUNCTION__); ret = -1; break; @@ -228,6 +262,28 @@ int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, break; } +#ifdef SUPPLIED_KEY_DERIVATION + + // smk is only needed for msg2 generation. + derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_SMK_SK, + &g_sp_db.smk_key, &g_sp_db.sk_key); + if(derive_ret != true) + { + fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } + + // The rest of the keys are the shared secrets for future communication. + derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_MK_VK, + &g_sp_db.mk_key, &g_sp_db.vk_key); + if(derive_ret != true) + { + fprintf(stderr, "\nError, derive key fail in [%s].", __FUNCTION__); + ret = SP_INTERNAL_ERROR; + break; + } +#else // smk is only needed for msg2 generation. derive_ret = derive_key(&dh_key, SAMPLE_DERIVE_KEY_SMK, &g_sp_db.smk_key); @@ -265,6 +321,7 @@ int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, ret = SP_INTERNAL_ERROR; break; } +#endif uint32_t msg2_size = sizeof(sample_ra_msg2_t) + sig_rl_size; p_msg2_full = (ra_samp_response_header_t*)malloc(msg2_size @@ -278,7 +335,8 @@ int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, memset(p_msg2_full, 0, msg2_size + sizeof(ra_samp_response_header_t)); p_msg2_full->type = TYPE_RA_MSG2; p_msg2_full->size = msg2_size; - // @TODO: Set the status properly based on real protocol communication. + // The simulated message2 always passes. This would need to be set + // accordingly in a real service provider implementation. p_msg2_full->status[0] = 0; p_msg2_full->status[1] = 0; p_msg2 = (sample_ra_msg2_t *)p_msg2_full->body; @@ -298,9 +356,13 @@ int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, // signature type and to understand the implications of the choice! p_msg2->quote_type = SAMPLE_QUOTE_LINKABLE_SIGNATURE; - +#ifdef SUPPLIED_KEY_DERIVATION +//isv defined key derivation function id +#define ISV_KDF_ID 2 + p_msg2->kdf_id = ISV_KDF_ID; +#else p_msg2->kdf_id = SAMPLE_AES_CMAC_KDF_ID; - +#endif // Create gb_ga sample_ec_pub_t gb_ga[2]; if(memcpy_s(&gb_ga[0], sizeof(gb_ga[0]), &g_sp_db.g_b, @@ -394,6 +456,11 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, return SP_INTERNAL_ERROR; } + // Check to see if we have registered? + if (!g_is_sp_registered) + { + return SP_UNSUPPORTED_EXTENDED_EPID_GROUP; + } do { // Compare g_a in message 3 with local g_a. @@ -441,7 +508,17 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, p_quote = (sample_quote_t *)p_msg3->quote; - // Verify the the report_data in the Quote matches the expected value. + // Check the quote version if needed. Only check the Quote.version field if the enclave + // identity fields have changed or the size of the quote has changed. The version may + // change without affecting the legacy fields or size of the quote structure. + //if(p_quote->version < ACCEPTED_QUOTE_VERSION) + //{ + // fprintf(stderr,"\nError, quote version is too old.", __FUNCTION__); + // ret = SP_QUOTE_VERSION_ERROR; + // break; + //} + + // Verify the report_data in the Quote matches the expected value. // The first 32 bytes of report_data are SHA256 HASH of {ga|gb|vk}. // The second 32 bytes of report_data are set to zero. sample_ret = sample_sha256_init(&sha_handle); @@ -496,15 +573,14 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, break; } - // Verify Enclave policy (IAS may provide an API for this if we + // Verify Enclave policy (an attestation server may provide an API for this if we // registered an Enclave policy) - // Verify quote with IAS. - // @IAS_Q: What is the proper JSON format for attestation evidence? - ias_att_report_t attestation_report; - // @TODO: Convert this call to a 'network' send/receive - // once the IAS server is a vaialable. - ret = ias_verify_attestation_evidence(p_quote, NULL, + // Verify quote with attestation server. + // In the product, an attestation server could use a REST message and JSON formatting to request + // attestation Quote verification. The sample only simulates this interface. + ias_att_report_t attestation_report = {0}; + ret = g_sp_extended_epid_group_id->verify_attestation_evidence(p_quote, NULL, &attestation_report); if(0 != ret) { @@ -519,14 +595,13 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, attestation_report.revocation_reason); // attestation_report.info_blob; fprintf(OUTPUT, "\n\tpse_status: %d.", attestation_report.pse_status); - // Check if Platform_Info_Blob is available. - // @TODO: Currenlty, the IAS spec says this will not be available if - // no info blob status flags are set. For now, assume it is always - // there until we have the full message format definition. + // Note: This sample always assumes the PIB is sent by attestation server. In the product + // implementation, the attestation server could only send the PIB for certain attestation + // report statuses. A product SP implementation needs to handle cases + // where the PIB is zero length. // Respond the client with the results of the attestation. - uint32_t att_result_msg_size = sizeof(sample_ra_att_result_msg_t) - + attestation_report.policy_report_size; + uint32_t att_result_msg_size = sizeof(sample_ra_att_result_msg_t); p_att_result_msg_full = (ra_samp_response_header_t*)malloc(att_result_msg_size + sizeof(ra_samp_response_header_t) + sizeof(g_secret)); @@ -552,15 +627,13 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, p_att_result_msg = (sample_ra_att_result_msg_t *)p_att_result_msg_full->body; - // @TODO: In the product, the HTTP response header itself will have + // In a product implementation of attestation server, the HTTP response header itself could have // an RK based signature that the service provider needs to check here. // The platform_info_blob signature will be verified by the client - // if needed. No need to have the Service Provider to check it. + // when sent. No need to have the Service Provider to check it. The SP + // should pass it down to the application for further analysis. - // @TODO: Verify the enlcave policy report if they are to be supported - // by IAS. Otherwise, the SP will need to check the ISV enclave report - // itself. fprintf(OUTPUT, "\n\n\tEnclave Report:"); fprintf(OUTPUT, "\n\tSignature Type: 0x%x", p_quote->sign_type); fprintf(OUTPUT, "\n\tSignature Basename: "); @@ -602,7 +675,12 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, p_quote->report_body.isv_prod_id); fprintf(OUTPUT, "\n\tisv_svn: 0x%0x",p_quote->report_body.isv_svn); fprintf(OUTPUT, "\n"); - // @TODO do a real check here. + + // A product service provider needs to verify that its enclave properties + // match what is expected. The SP needs to check these values before + // trusting the enclave. For the sample, we always pass the policy check. + // Attestation server only verifies the quote structure and signature. It does not + // check the identity of the enclave. bool isv_policy_passed = true; // Assemble Attestation Result Message diff --git a/SampleCode/RemoteAttestation/service_provider/service_provider.h b/SampleCode/RemoteAttestation/service_provider/service_provider.h index 820e39072a..83a7522e07 100644 --- a/SampleCode/RemoteAttestation/service_provider/service_provider.h +++ b/SampleCode/RemoteAttestation/service_provider/service_provider.h @@ -44,11 +44,13 @@ extern "C" { typedef enum { SP_OK, + SP_UNSUPPORTED_EXTENDED_EPID_GROUP, SP_INTEGRITY_FAILED, SP_QUOTE_VERIFICATION_FAILED, SP_IAS_FAILED, SP_INTERNAL_ERROR, SP_PROTOCOL_ERROR, + SP_QUOTE_VERSION_ERROR, } sp_ra_msg_status_t; #pragma pack(push,1) @@ -62,7 +64,7 @@ typedef struct sample_ec_pub_t uint8_t gy[SAMPLE_ECP_KEY_SIZE]; } sample_ec_pub_t; -//fixed length to align with internal structure +/*fixed length to align with internal structure*/ typedef struct sample_ps_sec_prop_desc_t { uint8_t sample_ps_sec_prop_desc[256]; @@ -76,41 +78,49 @@ typedef uint8_t sample_key_128bit_t[16]; typedef sample_key_128bit_t sample_ra_key_128_t; +typedef struct sample_ra_msg0_t +{ + uint32_t extended_epid_group_id; +} sample_ra_msg0_t; + + typedef struct sample_ra_msg1_t { - sample_ec_pub_t g_a; // the Endian-ness of Ga is - // Little-Endian - sample_epid_group_id_t gid; // the Endian-ness of GID is - // Little-Endian + sample_ec_pub_t g_a; /* the Endian-ness of Ga is + Little-Endian*/ + sample_epid_group_id_t gid; /* the Endian-ness of GID is + Little-Endian*/ } sample_ra_msg1_t; -//Key Derivation Function ID : 0x0001 AES-CMAC Entropy Extraction and Key Expansion +/*Key Derivation Function ID : 0x0001 AES-CMAC Entropy Extraction and Key Expansion*/ const uint16_t SAMPLE_AES_CMAC_KDF_ID = 0x0001; typedef struct sample_ra_msg2_t { - sample_ec_pub_t g_b; // the Endian-ness of Gb is - // Little-Endian - sample_spid_t spid; - uint16_t quote_type; /* unlinkable Quote(0) or linkable Quote(0) in little endian*/ - uint16_t kdf_id; /* key derivation function id in little endian. + sample_ec_pub_t g_b; /* the Endian-ness of Gb is + Little-Endian*/ + sample_spid_t spid; /* In little endian*/ + uint16_t quote_type; /* unlinkable Quote(0) or linkable Quote(0) in little endian*/ + uint16_t kdf_id; /* key derivation function id in little endian. 0x0001 for AES-CMAC Entropy Extraction and Key Derivation */ - sample_ec_sign256_t sign_gb_ga; // In little endian - sample_mac_t mac; // mac_smk(g_b||spid||quote_type|| - // sign_gb_ga) + sample_ec_sign256_t sign_gb_ga; /* In little endian*/ + sample_mac_t mac; /* mac_smk(g_b||spid||quote_type|| + sign_gb_ga)*/ uint32_t sig_rl_size; - uint8_t sig_rl[]; + uint8_t sig_rl[]; } sample_ra_msg2_t; typedef struct sample_ra_msg3_t { - sample_mac_t mac; // mac_smk(g_a||ps_sec_prop||quote) - sample_ec_pub_t g_a; // the Endian-ness of Ga is - // Little-Endian + sample_mac_t mac; /* mac_smk(g_a||ps_sec_prop||quote)*/ + sample_ec_pub_t g_a; /* the Endian-ness of Ga is*/ + /* Little-Endian*/ sample_ps_sec_prop_desc_t ps_sec_prop; - uint8_t quote[]; + uint8_t quote[]; } sample_ra_msg3_t; +int sp_ra_proc_msg0_req(const sample_ra_msg0_t *p_msg0, + uint32_t msg0_size); int sp_ra_proc_msg1_req(const sample_ra_msg1_t *p_msg1, uint32_t msg1_size, @@ -123,6 +133,27 @@ int sp_ra_proc_msg3_req(const sample_ra_msg3_t *p_msg3, int sp_ra_free_msg2( sample_ra_msg2_t *p_msg2); + + +typedef int (*sample_enroll)(int sp_credentials, sample_spid_t* spid, + int* authentication_token); + +typedef int(*sample_get_sigrl)(const sample_epid_group_id_t gid, uint32_t* p_sig_rl_size, + uint8_t** p_sig_rl); + +typedef int(*sample_verify_attestation_evidence)(sample_quote_t* p_isv_quote, + uint8_t* pse_manifest, + ias_att_report_t* attestation_verification_report); + + +typedef struct sample_extended_epid_group +{ + uint32_t extended_epid_group_id; + sample_enroll enroll; + sample_get_sigrl get_sigrl; + sample_verify_attestation_evidence verify_attestation_evidence; +} sample_extended_epid_group; + #ifdef __cplusplus } #endif diff --git a/SampleCode/SampleEnclave/Enclave/Enclave.config.xml b/SampleCode/SampleEnclave/Enclave/Enclave.config.xml index a94d12f001..c9533851cf 100644 --- a/SampleCode/SampleEnclave/Enclave/Enclave.config.xml +++ b/SampleCode/SampleEnclave/Enclave/Enclave.config.xml @@ -1,4 +1,3 @@ - 0 0 diff --git a/SampleCode/SampleEnclave/Makefile b/SampleCode/SampleEnclave/Makefile index 3885ed8b58..dc4fa2c84a 100644 --- a/SampleCode/SampleEnclave/Makefile +++ b/SampleCode/SampleEnclave/Makefile @@ -119,6 +119,14 @@ Enclave_Include_Paths := -IInclude -IEnclave -I$(SGX_SDK)/include -I$(SGX_SDK)/i Enclave_C_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) Enclave_Cpp_Flags := $(Enclave_C_Flags) -std=c++03 -nostdinc++ + +# To generate a proper enclave, it is recommended to follow below guideline to link the trusted libraries: +# 1. Link sgx_trts with the `--whole-archive' and `--no-whole-archive' options, +# so that the whole content of trts is included in the enclave. +# 2. For other libraries, you just need to pull the required symbols. +# Use `--start-group' and `--end-group' to link these libraries. +# Do NOT move the libraries linked with `--start-group' and `--end-group' within `--whole-archive' and `--no-whole-archive' options. +# Otherwise, you may get some undesirable errors. Enclave_Link_Flags := $(SGX_COMMON_CFLAGS) -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L$(SGX_LIBRARY_PATH) \ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ -Wl,--start-group -lsgx_tstdc -lsgx_tstdcxx -l$(Crypto_Library_Name) -l$(Service_Library_Name) -Wl,--end-group \ @@ -150,7 +158,7 @@ all: $(App_Name) $(Enclave_Name) @echo "Please sign the $(Enclave_Name) first with your signing key before you run the $(App_Name) to launch and access the enclave." @echo "To sign the enclave use the command:" @echo " $(SGX_ENCLAVE_SIGNER) sign -key -enclave $(Enclave_Name) -out <$(Signed_Enclave_Name)> -config $(Enclave_Config_File)" - @echo "You can also sign the enclave using an external signing tool. See User's Guide for more details." + @echo "You can also sign the enclave using an external signing tool." @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: $(App_Name) $(Signed_Enclave_Name) diff --git a/common/inc/internal/arch.h b/common/inc/internal/arch.h index 876e2aad50..2486e01795 100644 --- a/common/inc/internal/arch.h +++ b/common/inc/internal/arch.h @@ -269,9 +269,9 @@ se_static_assert(sizeof(token_t) == 304); typedef struct _wl_cert_t /* All fields except the mr_signer_list fields, are big-endian integer format */ { - uint16_t version; /* ( 0) White List Cert format version. For 2015, only valid version is 1 */ + uint16_t version; /* ( 0) White List Cert format version. Currently, only valid version is 1 */ uint16_t cert_type; /* ( 2) White List Cert Type. For Enclave Signing Key White List Cert, must be 1 */ - uint16_t provider_id; /* ( 4) Enclave Signing Key White List Provider ID to identify the key used to sign this Enclave signing Key White List Certificate. For 2015, only one White List Provider is approved: WLProviderID-ISecG = 0 */ + uint16_t provider_id; /* ( 4) Enclave Signing Key White List Provider ID to identify the key used to sign this Enclave signing Key White List Certificate. Currently, only one White List Provider is approved: WLProviderID-ISecG = 0 */ uint16_t le_prod_id; /* ( 6) Launch Enclave ProdID the White List Cert applies to. Linux LE-ProdID = 0x20 */ uint32_t wl_version; /* ( 8) Version of the Enclave Signing Key White List. For a specific LE-ProdID, should increase on every WL Cert signing request */ uint32_t entry_number; /* (12) Number of MRSIGNER entries in the Cert. If the White List Certificate allows enclave signed by any key to launch, the White List Cert must only contain one all-0 MRSIGNER entry. */ @@ -279,10 +279,10 @@ typedef struct _wl_cert_t /* All fields except the mr_ }wl_cert_t; typedef struct _wl_provider_cert_t /* All fields are big endian */ { - uint16_t version; /* ( 0) White List Cert format version. For 2015, only valid version is 1 */ + uint16_t version; /* ( 0) White List Cert format version. Currently, only valid version is 1 */ uint16_t cert_type; /* ( 2) White List Cert Type, For Enclave Signing Key White List Signer Cert, must be 0 */ - uint16_t provider_id; /* ( 4) Enclave Signing Key White List Signer ID assigned by the White List Root CA. For 2015, only one White List Provider is approved: WLProviderID-ISecG = 0 */ - uint16_t root_id; /* ( 6) Identify the White List Root CA key used to sign the Cert. For 2015, only one WLRootID is valid: WLRootID-iKGF-Key-0 = 0 */ + uint16_t provider_id; /* ( 4) Enclave Signing Key White List Signer ID assigned by the White List Root CA. Currently, only one White List Provider is approved: WLProviderID-ISecG = 0 */ + uint16_t root_id; /* ( 6) Identify the White List Root CA key used to sign the Cert. Currently, only one WLRootID is valid: WLRootID-iKGF-Key-0 = 0 */ sgx_ec256_public_t pub_key; /* ( 8) ECDSA public key of the Enclave Signing Key White List Provider identified by WLProviderID */ sgx_ec256_signature_t signature; /* (72) ECDSA Signature by WL Root CA identified by WLRootID */ }wl_provider_cert_t; diff --git a/common/inc/internal/linux/xsave_gnu.h b/common/inc/internal/linux/xsave_gnu.h index 960398faaf..5466ba5de6 100644 --- a/common/inc/internal/linux/xsave_gnu.h +++ b/common/inc/internal/linux/xsave_gnu.h @@ -37,12 +37,12 @@ #ifdef __x86_64__ # define ASM_FXSAVE "rex64/fxsave" # define ASM_FXRSTR "rex64/fxrstor" -# define ASM_XSAVE "rex64/xsave" +# define ASM_XSAVE ".byte 0x48,0x0f,0xae,0x21" # define ASM_XRSTR ".byte 0x48,0x0f,0xae,0x2f" #else # define ASM_FXSAVE "fxsave" # define ASM_FXRSTR "fxrstor" -# define ASM_XSAVE "xsave" +# define ASM_XSAVE ".byte 0x0f,0xae,0x21" # define ASM_XRSTR ".byte 0x0f,0xae,0x2f" #endif diff --git a/common/inc/internal/oal/uae_oal_api.h b/common/inc/internal/oal/uae_oal_api.h index 2666fd662b..42c917dddb 100644 --- a/common/inc/internal/oal/uae_oal_api.h +++ b/common/inc/internal/oal/uae_oal_api.h @@ -118,6 +118,27 @@ uae_oal_status_t oal_invoke_service( uint32_t timeout_usec, aesm_error_t *response); +uae_oal_status_t oal_get_whitelist_size( + uint32_t* p_whitelist_size, + uint32_t timeout_usec, + aesm_error_t* result); + +uae_oal_status_t oal_get_whitelist( + uint8_t* p_whitelist, + uint32_t whitelist_size, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t oal_get_extended_epid_group_id( + uint32_t* extended_group_id, + uint32_t timeout_usec, + aesm_error_t *result); + +uae_oal_status_t oal_switch_extended_epid_group( + uint32_t x_group_id, + uint32_t timeout_usec, + aesm_error_t *result); + sgx_status_t oal_map_status(uae_oal_status_t status); sgx_status_t oal_map_result(aesm_error_t result); diff --git a/common/inc/internal/se_version.h b/common/inc/internal/se_version.h index b7bf1bb4a0..74491662f5 100644 --- a/common/inc/internal/se_version.h +++ b/common/inc/internal/se_version.h @@ -28,5 +28,5 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#define STRFILEVER "1.5.80.33399" +#define STRFILEVER "1.6.100.34922" diff --git a/common/inc/sgx_quote.h b/common/inc/sgx_quote.h index 06a6ae6c60..aec125e893 100644 --- a/common/inc/sgx_quote.h +++ b/common/inc/sgx_quote.h @@ -78,7 +78,8 @@ typedef struct _quote_t uint16_t sign_type; /* 2 */ sgx_epid_group_id_t epid_group_id; /* 4 */ sgx_isv_svn_t qe_svn; /* 8 */ - uint8_t reserved[6]; /* 10 */ + sgx_isv_svn_t pce_svn; /* 10 */ + uint32_t xeid; /* 12 */ sgx_basename_t basename; /* 16 */ sgx_report_body_t report_body; /* 48 */ uint32_t signature_len; /* 432 */ diff --git a/common/inc/sgx_thread.h b/common/inc/sgx_thread.h index 88af98372e..ee0274c9e3 100644 --- a/common/inc/sgx_thread.h +++ b/common/inc/sgx_thread.h @@ -105,6 +105,7 @@ int SGXAPI sgx_thread_cond_signal(sgx_thread_cond_t *cond); int SGXAPI sgx_thread_cond_broadcast(sgx_thread_cond_t *cond); sgx_thread_t SGXAPI sgx_thread_self(void); +int sgx_thread_equal(sgx_thread_t a, sgx_thread_t b); #ifdef __cplusplus } diff --git a/common/inc/sgx_tkey_exchange.h b/common/inc/sgx_tkey_exchange.h index f2fb9d0f75..eb8e27f6e3 100644 --- a/common/inc/sgx_tkey_exchange.h +++ b/common/inc/sgx_tkey_exchange.h @@ -58,8 +58,6 @@ extern "C" { * SGX_ERROR_INVALID_PARAMETER Indicates an error that * the input parameters are * invalid. - * SGX_ERROR_KDF_MISMATCH Indicates key derivation - * function doesn't match. * SGX_ERROR_OUT_OF_MEMORY There is not enough * memory available to * complete this operation. @@ -73,6 +71,75 @@ sgx_status_t SGXAPI sgx_ra_init( int b_pse, sgx_ra_context_t *p_context); +/* + * The sgx_ra_derive_secret_keys_t function should takes the Diffie-Hellman + * shared secret as input to allow the ISV enclave to generate their own derived + * shared keys (SMK, SK, MK and VK). + * + * @param p_shared_key The the Diffie-Hellman shared secret. + * @param kdf_id, Key Derivation Function ID + * @param p_smk_key The output SMK. + * @param p_sk_key The output SK. + * @param p_mk_key The output MK. + * @param p_vk_key The output VK. + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Indicates an error that + * the input parameters are + * invalid. + * SGX_ERROR_KDF_MISMATCH Indicates key derivation + * function doesn't match. + * SGX_ERROR_OUT_OF_MEMORY There is not enough + * memory available to + * complete this operation. + * SGX_ERROR_UNEXPECTED Indicates an unexpected + * error occurs. + */ + +typedef sgx_status_t(*sgx_ra_derive_secret_keys_t)( + const sgx_ec256_dh_shared_t* p_shared_key, + uint16_t kdf_id, + sgx_ec_key_128bit_t* p_smk_key, + sgx_ec_key_128bit_t* p_sk_key, + sgx_ec_key_128bit_t* p_mk_key, + sgx_ec_key_128bit_t* p_vk_key); + +/* + * The sgx_ra_init_ex function creates a context for the remote attestation and + * key exchange process asociated with a key derive function. + * + * @param p_pub_key The EC public key of the service provider based on the NIST + * P-256 elliptic curve. + * @param b_pse If true, platform service information is needed in message + * 3. The caller should make sure a PSE session has been + * established using sgx_create_pse_session before attempting + * to establish a remote attestation and key exchange session + * involving platform service information. + * @param derive_key_cb A pointer to a call back routine matching the + * function prototype of sgx_ra_derive_secret_keys_t. This + * function takes the Diffie-Hellman shared secret as input + * to allow the ISV enclave to generate their own derived + * shared keys (SMK, SK, MK and VK). + * @param p_context The output context for the subsequent remote attestation + * and key exchange process, to be used in sgx_ra_get_msg1 and + * sgx_ra_get_msg2. + * @return sgx_status_t SGX_SUCCESS Indicates success. + * SGX_ERROR_INVALID_PARAMETER Indicates an error that + * the input parameters are + * invalid. + * SGX_ERROR_OUT_OF_MEMORY There is not enough + * memory available to + * complete this operation. + * SGX_ERROR_AE_SESSION_INVALID Session is invalid or + * ended by server. + * SGX_ERROR_UNEXPECTED Indicates an unexpected + * error occurs. + */ + +sgx_status_t SGXAPI sgx_ra_init_ex( + const sgx_ec256_public_t *p_pub_key, + int b_pse, + sgx_ra_derive_secret_keys_t derive_key_cb, + sgx_ra_context_t *p_context); /* * The sgx_ra_get_keys function is used to get the negotiated keys of a remote * attestation and key exchange session. This function should only be called diff --git a/common/inc/sgx_uae_service.h b/common/inc/sgx_uae_service.h index 5380c59a57..ff668b131b 100644 --- a/common/inc/sgx_uae_service.h +++ b/common/inc/sgx_uae_service.h @@ -121,6 +121,31 @@ sgx_status_t SGXAPI sgx_get_quote( */ sgx_status_t SGXAPI sgx_get_ps_cap(sgx_ps_cap_t* p_sgx_ps_cap); +/** + * Get the white list's size + * + * @param p_whitelist_size Save the size of the white list. + * @return if OK, return SGX_SUCCESS + */ +sgx_status_t SGXAPI sgx_get_whitelist_size(uint32_t* p_whitelist_size); + +/** + * Get the white list value + * + * @param p_whitelist Save the white list value + * @param whitelist_size The size of the white list and the read data size is whitelist_size + * @return if OK, return SGX_SUCCESS + */ +sgx_status_t SGXAPI sgx_get_whitelist(uint8_t* p_whitelist, uint32_t whitelist_size); + +/** + * Get the extended epid group id + * + * @param p_extended_epid_group_id Save the extended epid group id. + * @return if OK, return SGX_SUCCESS + */ +sgx_status_t SGXAPI sgx_get_extended_epid_group_id(uint32_t* p_extended_epid_group_id); + #define SGX_IS_TRUSTED_TIME_AVAILABLE(cap) ((((uint32_t)PS_CAP_TRUSTED_TIME)&((cap).ps_cap0))!=0) #define SGX_IS_MONOTONIC_COUNTER_AVAILABLE(cap) ((((uint32_t)PS_CAP_MONOTONIC_COUNTER)&((cap).ps_cap0))!=0) diff --git a/common/inc/tlibc/setjmp.h b/common/inc/tlibc/setjmp.h new file mode 100644 index 0000000000..ac5627f7ea --- /dev/null +++ b/common/inc/tlibc/setjmp.h @@ -0,0 +1,64 @@ +/* $NetBSD: setjmp.h,v 1.26 2011/11/05 09:27:06 joerg Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)setjmp.h 8.2 (Berkeley) 1/21/94 + */ + +#ifndef _SETJMP_H_ +#define _SETJMP_H_ + +#ifndef _JB_ATTRIBUTES +#define _JB_ATTRIBUTES /**/ +#else +#endif +#ifndef _BSD_JBSLOT_T_ +#define _BSD_JBSLOT_T_ long +#endif + +#define _JBLEN 8 + +typedef _BSD_JBSLOT_T_ jmp_buf[_JBLEN] _JB_ATTRIBUTES; + +#include +#define __returns_twice __attribute__((__returns_twice__)) +#define __dead + +__BEGIN_DECLS +int _setjmp(jmp_buf) __returns_twice; +void _longjmp(jmp_buf, int) __dead; +__END_DECLS + +#endif /* !_SETJMP_H_ */ + diff --git a/download_prebuilt.sh b/download_prebuilt.sh index 84533dd102..f106f41c95 100755 --- a/download_prebuilt.sh +++ b/download_prebuilt.sh @@ -33,10 +33,11 @@ top_dir=`dirname $0` out_dir=$top_dir/psw/ae/data/prebuilt -server_url=https://01.org/sites/default/files/downloads/intelr-software-guard-extensions-linux-os/sgxprebuilt-1.5.80.27216.tar +file_name=sgxprebuilt-1.6.100.34040.tar +server_url=https://download.01.org/intel-sgx/linux-1.6/$file_name wget $server_url -P $out_dir if [ $? -ne 0 ]; then echo "Fail to download file $server_url" exit -1 fi -pushd $out_dir;tar -xf sgxprebuilt-1.5.80.27216.tar;rm -rf sgxprebuilt-1.5.80.27216.tar;popd +pushd $out_dir;tar -xf $file_name;rm -rf $file_name;popd diff --git a/external/epid/inc/epid_types.h b/external/epid/inc/epid_types.h index eb4b9d873f..ea42c8a623 100644 --- a/external/epid/inc/epid_types.h +++ b/external/epid/inc/epid_types.h @@ -92,9 +92,9 @@ typedef struct G2ElemStr { } G2ElemStr; /// Serialized GT element -typedef struct GtElemStr { +typedef struct GTElemStr { FqElemStr x[12]; ///< an integer between [0, q-1] -} GtElemStr; +} GTElemStr; typedef FpElemStr PElemStr; typedef OctStr32 RLver_t; @@ -282,6 +282,32 @@ typedef struct VerifierRl { G1ElemStr K[1]; ///< elements in G1 (flexible array) } VerifierRl; +/*! +* \brief +* member pre-computation blob +* +* \note e12 = 0 implies that this blob is not valid +*/ +typedef struct _MemberPrecomp { + GTElemStr e12; ///< an element in GT + GTElemStr e22; ///< an element in GT + GTElemStr e2w; ///< an element in GT + GTElemStr ea2; ///< an element in GT +} MemberPrecomp; + +/*! + * \brief + * verifier pre-computation blob + * + * \note e12 = 0 implies that this blob is not valid +*/ +typedef struct _VerifierPrecomp { + GTElemStr e12; ///< an element in GT + GTElemStr e22; ///< an element in GT + GTElemStr e2w; ///< an element in GT + GTElemStr eg12; ///< an element in GT +} VerifierPrecomp; + /// element to store seed values for later rekey typedef G1ElemStr ReKeySeed; diff --git a/external/rdrand/rdrand.h b/external/rdrand/rdrand.h index ee25cf5986..9a9cbd32df 100644 --- a/external/rdrand/rdrand.h +++ b/external/rdrand/rdrand.h @@ -1,4 +1,4 @@ -/* Copyright © 2012, Intel Corporation. All rights reserved. +/* Copyright © 2012, Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/linux/installer/bin/install-sgx-psw.bin.tmpl b/linux/installer/bin/install-sgx-psw.bin.tmpl index 4c36e367ff..6b05b4f849 100755 --- a/linux/installer/bin/install-sgx-psw.bin.tmpl +++ b/linux/installer/bin/install-sgx-psw.bin.tmpl @@ -32,8 +32,14 @@ modinfo isgx &> /dev/null if [[ $? != "0" ]]; then - echo "Please install the driver package before the PSW package" - exit 4 + lsmod | grep isgx &> /dev/null + if [[ $? = "0" ]]; then + echo "Warning: You did not follow the document to install the driver package" + echo + else + echo "Please install the driver package before the PSW package" + exit 4 + fi fi set -e @@ -58,6 +64,12 @@ if [[ $ARCH != $PKG_ARCH ]]; then exit 4 fi +INSTALL_PATH=/opt/intel/sgxpsw +if [ -d "$INSTALL_PATH" ]; then + echo "$PKG_NAME already exists in $INSTALL_PATH, please uninstall it first!" + exit 4 +fi + PATH=/usr/bin:/bin umask 022 diff --git a/linux/installer/bin/install-sgx-sdk.bin.tmpl b/linux/installer/bin/install-sgx-sdk.bin.tmpl index 71457ba804..da55ba4db3 100755 --- a/linux/installer/bin/install-sgx-sdk.bin.tmpl +++ b/linux/installer/bin/install-sgx-sdk.bin.tmpl @@ -34,10 +34,43 @@ set -e PKG_NAME="Intel SGX SDK" -if test $(id -u) -ne 0; then - echo "Root privilege is required to install $PKG_NAME." - exit 4 -fi +select_install_path() +{ + USER_INPUT_PATH=$(pwd) + echo + echo -n "Do you want to install in current directory? [yes/no] : " + read ANSWER + + if [ "$ANSWER" == "yes" ]; then + if [ ! -d "$USER_INPUT_PATH" ] || [ ! -w "$USER_INPUT_PATH" ]; then + echo "Can not install in $USER_INPUT_PATH, please check the permission!" + exit 4 + fi + else + echo + echo -n "Please input the directory which you want to install in : " + read USER_INPUT_PATH + + eval USER_INPUT_PATH="$USER_INPUT_PATH" + + if [ -d "$USER_INPUT_PATH" ]; then + if [ ! -w "$USER_INPUT_PATH" ]; then + echo "Can not install in $USER_INPUT_PATH, please check the permission!" + exit 4 + fi + else + mkdir -p "$USER_INPUT_PATH" + if [ "$?" != "0" ]; then + echo "Can not install in $USER_INPUT_PATH, please check the permission!" + exit 4 + fi + fi + fi + + USER_INPUT_PATH=$(cd "$USER_INPUT_PATH"; pwd -P) +} + +select_install_path PATH=/usr/bin:/bin umask 022 @@ -79,13 +112,49 @@ echo " done." pushd ${SDK_TEMP_FOLDER} +sed -i "s#\(SGX_PACKAGES_PATH=\).*#\1$USER_INPUT_PATH#" scripts/installConfig source scripts/installConfig -make install +make install INSTALLER_FORM=BIN popd -${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/scripts/install.sh +${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/scripts/install.sh BIN rm -fr ${SDK_TEMP_FOLDER} +export_the_simulation() +{ + if [ ! -d ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs ]; then + mkdir ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs + else + rm -f ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/libsgx_urts_sim.so + rm -f ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/libsgx_uae_service_sim.so + fi + ln -s ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_urts_sim.so ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/ + ln -s ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/${LIB_DIR}/libsgx_uae_service_sim.so ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/sdk_libs/ +} + +generate_environment_script() +{ + cat > ${SGX_PACKAGES_PATH}/${SDK_PKG_NAME}/environment </build/linux/libsgx_le.signed.so /package/aesm/libsgx_le.signed.so 0 main STP /build/linux/libsgx_pve.signed.so /package/aesm/libsgx_pve.signed.so 0 main STP /build/linux/libsgx_qe.signed.so /package/aesm/libsgx_qe.signed.so 0 main STP +/build/linux/libsgx_pce.signed.so /package/aesm/libsgx_pce.signed.so 0 main STP /linux/installer/common/psw/install.sh /scripts/install.sh 0 main STP /linux/installer/common/psw/Makefile /Makefile 0 main STP /psw/ae/aesm_service/config/network/aesmd.conf /package/aesm/conf/aesmd.conf 0 main STP diff --git a/linux/installer/common/psw/Makefile b/linux/installer/common/psw/Makefile index 648f6ee7b0..cabc076516 100644 --- a/linux/installer/common/psw/Makefile +++ b/linux/installer/common/psw/Makefile @@ -34,7 +34,7 @@ include scripts/installConfig SOURCE_FOLDER=package SCRIPTS_FOLDER=scripts -INSTALL_PATH=$(DESTDIR)/$(SGX_PACKAGES_PATH)/$(PSW_PKG_NAME) +INSTALL_PATH=$(shell readlink -m $(DESTDIR)/$(SGX_PACKAGES_PATH)/$(PSW_PKG_NAME)) SOURCE_INSTALL_PATH=$(INSTALL_PATH) SCRIPTS_INSTALL_PATH=$(INSTALL_PATH)/$(SCRIPTS_FOLDER) PSW_LIB_PATH=$(SOURCE_INSTALL_PATH)/$(LIB_DIR) diff --git a/linux/installer/common/psw/createTarball.sh b/linux/installer/common/psw/createTarball.sh index 79d1df3506..aa89c97c75 100755 --- a/linux/installer/common/psw/createTarball.sh +++ b/linux/installer/common/psw/createTarball.sh @@ -53,6 +53,9 @@ get_arch() ARCH=$(get_arch) +# Get the configuration for this package +source ${SCRIPT_DIR}/installConfig.${ARCH} + # Fetch the gen_source script cp ${LINUX_INSTALLER_COMMON_DIR}/gen_source/gen_source.py ${SCRIPT_DIR} @@ -62,8 +65,6 @@ python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/psw_${ARCH}.txt --cleanup=false python ${SCRIPT_DIR}/gen_source.py --bom=../licenses/BOM_license.txt --cleanup=false # Create the tarball -source ${SCRIPT_DIR}/installConfig.${ARCH} - pushd ${INSTALL_PATH} &> /dev/null tar -zcvf ${TARBALL_NAME} * popd &> /dev/null diff --git a/linux/installer/common/psw/install.sh b/linux/installer/common/psw/install.sh index 5e38a9b449..8b5be3c5dd 100755 --- a/linux/installer/common/psw/install.sh +++ b/linux/installer/common/psw/install.sh @@ -122,6 +122,8 @@ rm -f /usr/lib/libsgx_urts.so # Removing AESM folder rm -fr $PSW_DST_PATH +# Removing AESM user and group +/usr/sbin/userdel aesmd EOF chmod +x $PSW_DST_PATH/uninstall.sh @@ -135,7 +137,7 @@ fi echo -e "\nuninstall.sh script generated in $PSW_DST_PATH\n" -echo -e "Installation successful!" +echo -e "Installation is successful!" rm -fr $PSW_DST_PATH/scripts diff --git a/linux/installer/common/sdk/BOMs/sdk_base.txt b/linux/installer/common/sdk/BOMs/sdk_base.txt index 2c74e5a803..4cb36ef406 100644 --- a/linux/installer/common/sdk/BOMs/sdk_base.txt +++ b/linux/installer/common/sdk/BOMs/sdk_base.txt @@ -60,6 +60,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /common/inc/tlibc/unistd.h /package/include/tlibc/unistd.h 0 main STP /common/inc/tlibc/wchar.h /package/include/tlibc/wchar.h 0 main STP /common/inc/tlibc/wctype.h /package/include/tlibc/wctype.h 0 main STP +/common/inc/tlibc/setjmp.h /package/include/tlibc/setjmp.h 0 main STP /common/src/se_memory.c /package/ptrace/se_memory.c 0 main STP /common/src/se_trace.c /package/ptrace/se_trace.c 0 main STP /linux/installer/common/sdk/install.sh /scripts/install.sh 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_x64.txt b/linux/installer/common/sdk/BOMs/sdk_x64.txt index 0d8926c423..c11decedc5 100644 --- a/linux/installer/common/sdk/BOMs/sdk_x64.txt +++ b/linux/installer/common/sdk/BOMs/sdk_x64.txt @@ -13,6 +13,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linux/libsgx_tservice_sim.a /package/lib64/libsgx_tservice_sim.a 0 main STP /build/linux/libsgx_tstdc.a /package/lib64/libsgx_tstdc.a 0 main STP /build/linux/libsgx_tstdcxx.a /package/lib64/libsgx_tstdcxx.a 0 main STP +/build/linux/libsgx_tsetjmp.a /package/lib64/libsgx_tsetjmp.a 0 main STP /build/linux/libsgx_uae_service_deploy.so /package/lib64/libsgx_uae_service.so 0 main STP /build/linux/libsgx_uae_service_sim.so /package/lib64/libsgx_uae_service_sim.so 0 main STP /build/linux/libsgx_ukey_exchange.a /package/lib64/libsgx_ukey_exchange.a 0 main STP @@ -23,3 +24,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linux/sgx_edger8r /package/bin/x64/sgx_edger8r 0 main STP /build/linux/sgx_sign /package/bin/x64/sgx_sign 0 main STP /linux/installer/common/sdk/installConfig.x64 /scripts/installConfig 0 main STP +/linux/installer/common/sdk/pkgconfig/x64/libsgx_uae_service_sim.pc /package/pkgconfig/libsgx_uae_service_sim.pc 0 main STP +/linux/installer/common/sdk/pkgconfig/x64/libsgx_urts_sim.pc /package/pkgconfig/libsgx_urts_sim.pc 0 main STP +/linux/installer/common/sdk/pkgconfig/x64/libsgx_uae_service.pc /package/pkgconfig/libsgx_uae_service.pc 0 main STP +/linux/installer/common/sdk/pkgconfig/x64/libsgx_urts.pc /package/pkgconfig/libsgx_urts.pc 0 main STP diff --git a/linux/installer/common/sdk/BOMs/sdk_x86.txt b/linux/installer/common/sdk/BOMs/sdk_x86.txt index 23f3b47a2b..6555739e2a 100644 --- a/linux/installer/common/sdk/BOMs/sdk_x86.txt +++ b/linux/installer/common/sdk/BOMs/sdk_x86.txt @@ -13,6 +13,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linux/libsgx_tservice_sim.a /package/lib/libsgx_tservice_sim.a 0 main STP /build/linux/libsgx_tstdc.a /package/lib/libsgx_tstdc.a 0 main STP /build/linux/libsgx_tstdcxx.a /package/lib/libsgx_tstdcxx.a 0 main STP +/build/linux/libsgx_tsetjmp.a /package/lib/libsgx_tsetjmp.a 0 main STP /build/linux/libsgx_uae_service_deploy.so /package/lib/libsgx_uae_service.so 0 main STP /build/linux/libsgx_uae_service_sim.so /package/lib/libsgx_uae_service_sim.so 0 main STP /build/linux/libsgx_ukey_exchange.a /package/lib/libsgx_ukey_exchange.a 0 main STP @@ -23,3 +24,7 @@ DeliveryName InstallName FileCheckSum FileFeature FileOwner /build/linux/sgx_edger8r /package/bin/x86/sgx_edger8r 0 main STP /build/linux/sgx_sign /package/bin/x86/sgx_sign 0 main STP /linux/installer/common/sdk/installConfig.x86 /scripts/installConfig 0 main STP +/linux/installer/common/sdk/pkgconfig/x86/libsgx_uae_service_sim.pc /package/pkgconfig/libsgx_uae_service_sim.pc 0 main STP +/linux/installer/common/sdk/pkgconfig/x86/libsgx_urts_sim.pc /package/pkgconfig/libsgx_urts_sim.pc 0 main STP +/linux/installer/common/sdk/pkgconfig/x86/libsgx_uae_service.pc /package/pkgconfig/libsgx_uae_service.pc 0 main STP +/linux/installer/common/sdk/pkgconfig/x86/libsgx_urts.pc /package/pkgconfig/libsgx_urts.pc 0 main STP diff --git a/linux/installer/common/sdk/Makefile b/linux/installer/common/sdk/Makefile index 68363821d5..33f71323bb 100644 --- a/linux/installer/common/sdk/Makefile +++ b/linux/installer/common/sdk/Makefile @@ -34,7 +34,7 @@ include scripts/installConfig SOURCE_FOLDER=package SCRIPTS_FOLDER=scripts -INSTALL_PATH=$(DESTDIR)/$(SGX_PACKAGES_PATH)/$(SDK_PKG_NAME) +INSTALL_PATH=$(shell readlink -m $(DESTDIR)/$(SGX_PACKAGES_PATH)/$(SDK_PKG_NAME)) SOURCE_INSTALL_PATH=$(INSTALL_PATH) SCRIPTS_INSTALL_PATH=$(INSTALL_PATH)/$(SCRIPTS_FOLDER) SDK_LIB_PATH=$(SOURCE_INSTALL_PATH)/$(LIB_DIR) @@ -44,8 +44,27 @@ default: install: install -d $(SOURCE_INSTALL_PATH) install -d $(SCRIPTS_INSTALL_PATH) + +ifneq ($(INSTALLER_FORM),BIN) install -d $(DESTDIR)/usr/lib + install -d $(DESTDIR)/usr/lib/pkgconfig +endif + cp -r $(SOURCE_FOLDER)/* $(SOURCE_INSTALL_PATH) install $(SCRIPTS_FOLDER)/* $(SCRIPTS_INSTALL_PATH) + +ifeq ($(INSTALLER_FORM),BIN) + @sed -i "s#\(prefix=\).*#\1$(INSTALL_PATH)#" $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_uae_service_sim.pc + @sed -i "s#\(prefix=\).*#\1$(INSTALL_PATH)#" $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_urts_sim.pc + @sed -i "s#\(prefix=\).*#\1$(INSTALL_PATH)#" $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_uae_service.pc + @sed -i "s#\(prefix=\).*#\1$(INSTALL_PATH)#" $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_urts.pc +else + @sed -i "s#\(libdir=\).*#\1/usr/lib#" $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_uae_service_sim.pc + @sed -i "s#\(libdir=\).*#\1/usr/lib#" $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_urts_sim.pc mv $(SDK_LIB_PATH)/libsgx_uae_service_sim.so $(DESTDIR)/usr/lib mv $(SDK_LIB_PATH)/libsgx_urts_sim.so $(DESTDIR)/usr/lib + mv $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_uae_service_sim.pc $(DESTDIR)/usr/lib/pkgconfig + mv $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_urts_sim.pc $(DESTDIR)/usr/lib/pkgconfig + mv $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_uae_service.pc $(DESTDIR)/usr/lib/pkgconfig + mv $(SOURCE_INSTALL_PATH)/pkgconfig/libsgx_urts.pc $(DESTDIR)/usr/lib/pkgconfig +endif \ No newline at end of file diff --git a/linux/installer/common/sdk/createTarball.sh b/linux/installer/common/sdk/createTarball.sh index cda3c29a07..69f5253b0e 100755 --- a/linux/installer/common/sdk/createTarball.sh +++ b/linux/installer/common/sdk/createTarball.sh @@ -53,6 +53,32 @@ get_arch() ARCH=$(get_arch) +# Get the configuration for this package +source ${SCRIPT_DIR}/installConfig.${ARCH} + +generate_pkgconfig_files() { + local TEMPLATE_FOLDER=${SCRIPT_DIR}/pkgconfig/template + local TARGET_FOLDER=${SCRIPT_DIR}/pkgconfig/${ARCH} + local VERSION="$1" + + # Create pkgconfig folder for this architecture + rm -fr ${TARGET_FOLDER} + mkdir -p ${TARGET_FOLDER} + + # Copy the template files into the folder + for pkgconfig_file in $(ls -1 ${TEMPLATE_FOLDER}); do + sed -e "s:@LIB_FOLDER_NAME@:$LIB_DIR:" \ + -e "s:@SGX_VERSION@:$VERSION:" \ + ${TEMPLATE_FOLDER}/$pkgconfig_file > ${TARGET_FOLDER}/$pkgconfig_file + done +} + +# Get SGX version +SGX_VERSION=$(awk '/STRFILEVER/ {print $3}' ${ROOT_DIR}/common/inc/internal/se_version.h|sed 's/^\"\(.*\)\"$/\1/') + +# Generate pkgconfig files +generate_pkgconfig_files $SGX_VERSION + # Fetch the gen_source script cp ${LINUX_INSTALLER_COMMON_DIR}/gen_source/gen_source.py ${SCRIPT_DIR} @@ -62,8 +88,6 @@ python ${SCRIPT_DIR}/gen_source.py --bom=BOMs/sdk_${ARCH}.txt --cleanup=false python ${SCRIPT_DIR}/gen_source.py --bom=../licenses/BOM_license.txt --cleanup=false # Create the tarball -source ${SCRIPT_DIR}/installConfig.${ARCH} - pushd ${INSTALL_PATH} &> /dev/null tar -zcvf ${TARBALL_NAME} * popd &> /dev/null diff --git a/linux/installer/common/sdk/install.sh b/linux/installer/common/sdk/install.sh index cea3366a1f..2dde89a988 100755 --- a/linux/installer/common/sdk/install.sh +++ b/linux/installer/common/sdk/install.sh @@ -38,9 +38,14 @@ source ${SCRIPT_DIR}/installConfig # Generate the script to preload SGX ptrace library for gdb SDK_DST_PATH=${SGX_PACKAGES_PATH}/${SDK_PKG_NAME} -GDB_SCRIPT=/usr/bin/sgx-gdb SDK_LIB_PATH=${SDK_DST_PATH}/${LIB_DIR} +if [ "$1" == "BIN" ]; then + GDB_SCRIPT=${SDK_DST_PATH}/bin/sgx-gdb +else + GDB_SCRIPT=/usr/bin/sgx-gdb +fi + generate_gdb_script() { cat > $GDB_SCRIPT < $SDK_DST_PATH/uninstall.sh < $SDK_DST_PATH/uninstall.sh < $SDK_DST_PATH/uninstall.sh < /dev/null + +if [ \$? -ne 0 ]; then + echo "Superuser privilege is required." + exit 1 +fi + +EOF +} + +if [ "$1" == "BIN" ]; then + generate_uninstall_script_for_bin +else + generate_uninstall_script +fi chmod +x $SDK_DST_PATH/uninstall.sh echo -e "uninstall.sh script generated in $SDK_DST_PATH\n" -echo -e "Installation successful! The SDK package can be found in $SDK_DST_PATH" +echo -e "Installation is successful! The SDK package can be found in $SDK_DST_PATH" rm -fr $SDK_DST_PATH/scripts diff --git a/linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service.pc b/linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service.pc new file mode 100644 index 0000000000..c730204ee2 --- /dev/null +++ b/linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service.pc @@ -0,0 +1,10 @@ +prefix=/opt/intel/sgxsdk +includedir=${prefix}/include +libdir=${prefix}/@LIB_FOLDER_NAME@ + +Name: libsgx_uae_service +Description: SGX uAE service library +Version: @SGX_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lsgx_uae_service +Libs.private: -lsgx_urts diff --git a/linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service_sim.pc b/linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service_sim.pc new file mode 100644 index 0000000000..0b470bd588 --- /dev/null +++ b/linux/installer/common/sdk/pkgconfig/template/libsgx_uae_service_sim.pc @@ -0,0 +1,10 @@ +prefix=/opt/intel/sgxsdk +includedir=${prefix}/include +libdir=${prefix}/@LIB_FOLDER_NAME@ + +Name: libsgx_uae_service_sim +Description: SGX uAE service simulation library +Version: @SGX_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lsgx_uae_service_sim +Libs.private: -lsgx_urts_sim diff --git a/linux/installer/common/sdk/pkgconfig/template/libsgx_urts.pc b/linux/installer/common/sdk/pkgconfig/template/libsgx_urts.pc new file mode 100644 index 0000000000..4d865487cd --- /dev/null +++ b/linux/installer/common/sdk/pkgconfig/template/libsgx_urts.pc @@ -0,0 +1,10 @@ +prefix=/opt/intel/sgxsdk +includedir=${prefix}/include +libdir=${prefix}/@LIB_FOLDER_NAME@ + +Name: libsgx_urts +Description: SGX uRTS library +Version: @SGX_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lsgx_urts +Libs.private: -lsgx_uae_service diff --git a/linux/installer/common/sdk/pkgconfig/template/libsgx_urts_sim.pc b/linux/installer/common/sdk/pkgconfig/template/libsgx_urts_sim.pc new file mode 100644 index 0000000000..f5d18ef37b --- /dev/null +++ b/linux/installer/common/sdk/pkgconfig/template/libsgx_urts_sim.pc @@ -0,0 +1,10 @@ +prefix=/opt/intel/sgxsdk +includedir=${prefix}/include +libdir=${prefix}/@LIB_FOLDER_NAME@ + +Name: libsgx_urts_sim +Description: SGX uRTS simulation library +Version: @SGX_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lsgx_urts_sim +Libs.private: -lsgx_uae_service_sim diff --git a/psw/ae/Makefile b/psw/ae/Makefile index a9cd1ee544..6f5d4cd851 100644 --- a/psw/ae/Makefile +++ b/psw/ae/Makefile @@ -40,10 +40,10 @@ else endif .PHONY: all -all: $(CURL_RESULT) LE AESM COPY_PVE_QE| $(BUILD_DIR) +all: $(CURL_RESULT) LE AESM COPY_PVE_QE_PCE| $(BUILD_DIR) -.PHONY: COPY_PVE_QE -COPY_PVE_QE: | $(BUILD_DIR) +.PHONY: COPY_PVE_QE_PCE +COPY_PVE_QE_PCE: | $(BUILD_DIR) $(CP) data/prebuilt/* $(BUILD_DIR) .PHONY: AESM diff --git a/psw/ae/aesm_service/Makefile b/psw/ae/aesm_service/Makefile index 0d071dad5f..cb543c73e2 100644 --- a/psw/ae/aesm_service/Makefile +++ b/psw/ae/aesm_service/Makefile @@ -60,6 +60,7 @@ INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/oal/ INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/protobuf/ INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/pve/ INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/qe/ +INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/pce/ INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/storage/ INCLUDE += -I$(LINUX_PSW_DIR)/ae/data/constants/linux @@ -72,7 +73,6 @@ INCLUDE += -I$(LINUX_PSW_DIR)/ae/aesm_service/source/epid_provision INCLUDE += -I$(LINUX_EXTERNAL_DIR)/epid/inc INCLUDE += -I$(LINUX_EXTERNAL_DIR)/crypto_px/include/ \ - -I$(LINUX_EXTERNAL_DIR)/tinyxml/ \ -I$(LINUX_EXTERNAL_DIR)/ \ -I$(LINUX_EXTERNAL_DIR)/rdrand \ -I$(IPC_COMMON_INC_DIR) \ @@ -113,13 +113,12 @@ TRTSLIB := -lsgx_trts WHITE_LIST_FILE := $(LINUX_PSW_DIR)/ae/data/prebuilt/white_list_cert_to_be_verify.bin TCRYPTO_LIBDIR := $(LINUX_SDK_DIR)/tlibcrypto -PROTOBUF_LIBDIR := $(LINUX_PROTOBUF)/intel64 VTUNE_LIBDIR := $(LINUX_EXTERNAL_DIR)/vtune/linux/sdk/src/ittnotify RDRAND_LIBDIR :=$(LINUX_EXTERNAL_DIR)/rdrand/src RDRAND_MAKEFILE := $(RDRAND_LIBDIR)/Makefile ifeq ($(ARCH), x86) - PROTOBUF_LIBDIR = $(LINUX_PROTOBUF)/ia32 + VTUNE_LIBDIR = $(LINUX_EXTERNAL_DIR)/vtune/linux/lib32 endif @@ -131,15 +130,11 @@ EXTERNAL_LIB += -L$(LINUX_SE_WRAPPER) -lwrapper -lrt EXTERNAL_LIB += -L$(RDRAND_LIBDIR) -lrdrand EXTERNAL_LIB += -L$(VTUNE_LIBDIR) -littnotify -vpath %.cpp $(COMMON_DIR)/src $(LINUX_EXTERNAL_DIR)/tinyxml ./source/epid_provision $(LINUX_PSW_DIR)/ae/common $(AESM_APPLICATION) $(AESM_EXTENSION) $(AESM_SRC_DIR) $(IPC_COMMON_PROTO_DIR) $(COMMON_DIR)/src $(TOP_DIR)/sdk/tseal +vpath %.cpp $(COMMON_DIR)/src ./source/epid_provision $(LINUX_PSW_DIR)/ae/common $(AESM_APPLICATION) $(AESM_EXTENSION) $(AESM_SRC_DIR) $(IPC_COMMON_PROTO_DIR) $(COMMON_DIR)/src $(TOP_DIR)/sdk/tseal vpath %.cc $(IPC_COMMON_PROTO_DIR) vpath %.c $(TOP_DIR)/sdk/tlibc/string -COMMON_SRC := tinyxmlparser.cpp \ - tinyxmlerror.cpp \ - tinyxml.cpp \ - tinystr.cpp \ - ./source/le/LEClass.cpp \ +COMMON_SRC := ./source/le/LEClass.cpp \ ./source/oal/aesm_util.cpp \ ./source/storage/persistent_storage_table.cpp \ aesm_logic.cpp \ @@ -158,8 +153,10 @@ COMMON_SRC := tinyxmlparser.cpp \ COMMON_SRC += ./source/qe/QEClass.cpp \ ./source/pve/PVEClass.cpp \ + ./source/pce/PCEClass.cpp \ aesm_encode.cpp \ aesm_epid_blob.cpp \ + aesm_xegd_blob.cpp \ epid_provision_msg1.cpp \ epid_provision_msg2.cpp \ epid_provision_msg4.cpp \ @@ -169,6 +166,7 @@ COMMON_SRC += ./source/qe/QEClass.cpp \ ./source/qe/qe_logic.cpp \ ./source/pve/pve_logic.cpp \ platform_info_logic.cpp \ + platform_info_facility.cpp \ pve_pub_key.cpp \ pek_pub_key.cpp \ ./source/network/network_encoding_wrapper.cpp \ @@ -194,6 +192,14 @@ IPC_SRC := $(IPC_COMMON_SRC_DIR)/AECloseSessionRequest.cpp \ $(IPC_COMMON_SRC_DIR)/AEGetLaunchTokenRequest.cpp \ $(IPC_COMMON_SRC_DIR)/AEGetPsCapRequest.cpp \ $(IPC_COMMON_SRC_DIR)/AEGetPsCapResponse.cpp \ + $(IPC_COMMON_SRC_DIR)/AEGetWhiteListSizeRequest.cpp \ + $(IPC_COMMON_SRC_DIR)/AEGetWhiteListSizeResponse.cpp \ + $(IPC_COMMON_SRC_DIR)/AEGetWhiteListRequest.cpp \ + $(IPC_COMMON_SRC_DIR)/AEGetWhiteListResponse.cpp \ + $(IPC_COMMON_SRC_DIR)/AESGXGetExtendedEpidGroupIdRequest.cpp \ + $(IPC_COMMON_SRC_DIR)/AESGXGetExtendedEpidGroupIdResponse.cpp \ + $(IPC_COMMON_SRC_DIR)/AESGXSwitchExtendedEpidGroupRequest.cpp \ + $(IPC_COMMON_SRC_DIR)/AESGXSwitchExtendedEpidGroupResponse.cpp \ $(IPC_COMMON_SRC_DIR)/AEReportAttestationRequest.cpp \ $(IPC_COMMON_SRC_DIR)/AEReportAttestationResponse.cpp \ $(IPC_COMMON_SRC_DIR)/SocketTransporter.cpp \ @@ -257,13 +263,14 @@ $(LIBNAME): $(COMMON_OBJ) consttime_memequal.o :consttime_memequal.c $(CC) $(filter-out -O2,$(CFLAGS)) -fPIC -O1 $(INCLUDE) -c $< -o $@ -$(APPNAME): $(OBJ) $(LIBNAME) sgx_tcrypto -lrdrand +$(APPNAME): $(OBJ) $(LIBNAME) sgx_tcrypto -lrdrand urts $(CXX) $(CXXFLAGS) $(OBJ) $(LIBNAME) $(LDUFLAGS) $(EXTERNAL_LIB) -o $@ -ldl $(IPC_SRC): PROTPBUF ./source/le/LEClass.o: ${AESM_EXTENSION}/launch_enclave_u.c ./source/pve/PVEClass.o: ${AESM_EXTENSION}/provision_enclave_u.c ./source/qe/QEClass.o: ${AESM_EXTENSION}/quoting_enclave_u.c +./source/pce/PCEClass.o: ${AESM_EXTENSION}/pce_u.c uecall_bridge.o: ${AESM_EXTENSION}/pse_pr_u.c -lrdrand: $(RDRAND_MAKEFILE) @@ -288,6 +295,8 @@ ${AESM_EXTENSION}/quoting_enclave_u.c: ${LINUX_PSW_DIR}/ae/qe/quoting_enclave.ed ${AESM_EXTENSION}/pse_pr_u.c: ${LINUX_PSW_DIR}/ae/pse/pse_pr/pse_pr.edl @$(EDGER8R) --untrusted --untrusted-dir ${AESM_EXTENSION} $< +${AESM_EXTENSION}/pce_u.c: ${LINUX_PSW_DIR}/ae/pce/pce.edl + @$(EDGER8R) --untrusted --untrusted-dir ${AESM_EXTENSION} $< .PHONY: PROTPBUF PROTPBUF: $(MAKE) -C $(IPC_COMMON_PROTO_DIR) @@ -307,13 +316,13 @@ clean: @$(RM) $(APPNAME) @$(RM) $(LIBNAME) $(MAKE) -C $(IPC_COMMON_PROTO_DIR) clean + $(MAKE) -C $(LINUX_PSW_DIR)/urts/linux clean @$(RM) source/le/*.o @$(RM) source/pve/*.o - @$(RM) source/pve/*.o + @$(RM) source/pce/*.o @$(RM) source/network/*.o @$(RM) source/oal/*.o @$(RM) source/qe/*.o - @$(RM) source/qe/*.o @$(RM) source/storage/*.o @$(RM) $(AESM_EXTENSION)/*_u.c $(AESM_EXTENSION)/*_u.h ifeq ($(RDRAND_MAKEFILE), $(wildcard $(RDRAND_MAKEFILE))) diff --git a/psw/ae/aesm_service/config/network/aesmd.conf b/psw/ae/aesm_service/config/network/aesmd.conf index 971052accf..c2f32e5ef3 100644 --- a/psw/ae/aesm_service/config/network/aesmd.conf +++ b/psw/ae/aesm_service/config/network/aesmd.conf @@ -1,10 +1,8 @@ #Line with comments only #empty line with comment -#proxy type = direct #direct type means no proxy used -#proxy type = default #system default proxy -#proxy type = manual #aesm proxy should be specified for manual proxy type -#aesm proxy = http://proxyuser:passwd@proxy_url:proxy_port -#endpoint url = http://sample_endpoint_url:8080 -#pse rl url = http://sample_pse_rl_url/rl -#pse ocsp url = https://sample_ocsp_url/ocsp +#proxy type = direct #direct type means no proxy used +#proxy type = default #system default proxy +#proxy type = manual #aesm proxy should be specified for manual proxy type +#aesm proxy = http://proxyuser:passwd@proxy_url:proxy_port +#whitelist url = http://sample_while_list_url/ diff --git a/psw/ae/aesm_service/include/oal/aesm_persistent_storage.h b/psw/ae/aesm_service/include/oal/aesm_persistent_storage.h index 3c9744588d..d975a4a6ba 100644 --- a/psw/ae/aesm_service/include/oal/aesm_persistent_storage.h +++ b/psw/ae/aesm_service/include/oal/aesm_persistent_storage.h @@ -54,8 +54,11 @@ typedef enum _aesm_data_id_t{ PVE_ENCLAVE_FID, PSE_OP_ENCLAVE_FID, PSE_PR_ENCLAVE_FID, + PCE_ENCLAVE_FID, LE_PROD_SIG_STRUCT_FID, /*some normal persistent storages*/ + EXTENDED_EPID_GROUP_ID_FID, + EXTENDED_EPID_GROUP_BLOB_INFO_FID, PROVISION_PEK_BLOB_FID, EPID_DATA_BLOB_FID, AESM_SERVER_URL_FID, @@ -92,43 +95,61 @@ typedef enum _aesm_data_id_t{ aesm_data_id_t operator++(aesm_data_id_t& id, int); typedef aesm_data_id_t aesm_enclave_id_t; - -/*Function to get pathname of a file object such as vmc database, aesm_get_cpathname is alias of function aesm_get_pathname +#define DEFAULT_EGID 0 +#define INVALID_EGID 0xFFFFFFFF +/*Function to get pathname of a file object such as vmc database *@type: input for the type of the storage *@data_id: id of persistent storage *@buf: start address of the buffer to receive the zero terminated path file name of the data *@buf_size: size in char of the buffer 'buf' - *@return AESM_SUCCESS on success or error code if faileda + *@xgid: extended epid group id associated with the file if the file location info is AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + * the xgid must be INVALID_EGID if the file location info is not AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + *@return AESM_SUCCESS on success or error code if failed */ -ae_error_t aesm_get_pathname(aesm_data_type_t type, aesm_data_id_t data_id, char *buf, uint32_t buf_size); -ae_error_t aesm_get_cpathname(aesm_data_type_t type, aesm_data_id_t data_id, char *buf, uint32_t buf_size); +ae_error_t aesm_get_pathname(aesm_data_type_t type, aesm_data_id_t data_id, char *buf, uint32_t buf_size, uint32_t xgid = INVALID_EGID); +ae_error_t aesm_get_cpathname(aesm_data_type_t type, aesm_data_id_t data_id, char *buf, uint32_t buf_size, uint32_t xgid = INVALID_EGID); /*Function to query size of data in persistent storage *@type: input for the type of storage *@data_id: id of persistent storage *@p_size: output parameter to return size of the data blob + *@xgid: extended epid group id associated with the file if the file location info is AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + * the xgid must be INVALID_EGID if the file location info is not AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA *@return AESM_SUCCESS on success or error code if failed */ -ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t *p_size); +ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t *p_size, uint32_t xgid = INVALID_EGID); /*Function to read data from persistent storage *@type: input type of the storage *@data_id: id of persistent storage *@buf: start address of the buffer to receive data from persistent storage *@p_size: the input value *p_size is size of the buffer and output the size in bytes of data read + *@xgid: extended epid group id associated with the file if the file location info is AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + * the xgid must be INVALID_EGID if the file location info is not AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA *@return AESM_SUCCESS on success or error code if failed * The functin will not check whether there're too much data in the persistent storage to be read */ -ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t *buf, uint32_t *p_size); +ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t *buf, uint32_t *p_size, uint32_t xgid = INVALID_EGID); -/*Function to write data to persistent storage +/*Function to write data tp persistent storage *@type: input type of the storage *@data_id: id of persistent storage *@buf: start address of the buffer where the data is to be saved to persistent storage - *@size: size in bytes of the input data in buf + *@size: size in bytes of the ti be saved + *@xgid: extended epid group id associated with the file if the file location info is AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + * the xgid must be INVALID_EGID if the file location info is not AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA *@return AESM_SUCCESS on success or error code if failed + * The functin will not check whether there're too much data in the persistent storage to be read */ -ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const uint8_t *buf, uint32_t size); +ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const uint8_t *buf, uint32_t size, uint32_t xgid = INVALID_EGID); +/*Function to remove data persistent storage + *@type: input type of the storage + *@data_id: id of persistent storage + *@xgid: extended epid group id associated with the file if the file location info is AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + * the xgid must be INVALID_EGID if the file location info is not AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA + *@return AESM_SUCCESS on success or error code if failed + */ +ae_error_t aesm_remove_data(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t xgid = INVALID_EGID); #endif diff --git a/psw/ae/aesm_service/include/oal/error_report.h b/psw/ae/aesm_service/include/oal/error_report.h index 5e05334c26..fa11c6da12 100644 --- a/psw/ae/aesm_service/include/oal/error_report.h +++ b/psw/ae/aesm_service/include/oal/error_report.h @@ -50,6 +50,7 @@ extern "C" { #define AESM_LOG_WARN(format, args...) aesm_log_report(AESM_LOG_REPORT_WARNING, format, ## args) #define AESM_LOG_INIT() aesm_log_init() #define AESM_LOG_FINI() aesm_log_fini() +#define AESM_LOG_ERROR_UNICODE AESM_LOG_ERROR #endif/*__OAL_ERROR_REPORT_H__*/ diff --git a/psw/ae/aesm_service/include/oal/internal_log.h b/psw/ae/aesm_service/include/oal/internal_log.h index 93ce70df43..95e0599d13 100644 --- a/psw/ae/aesm_service/include/oal/internal_log.h +++ b/psw/ae/aesm_service/include/oal/internal_log.h @@ -75,6 +75,8 @@ extern "C" { #define SGX_DBGPRINT_PRINT_TWO_STRINGS(x,y) AESM_DBG_WARN("%s %s",x, y) #define SGX_DBGPRINT_PRINT_TWO_STRINGS_ONE_INT(x,y,z) AESM_DBG_WARN("%s %s %d", x,y,z) #define SGX_DBGPRINT_PRINT_FIVE_STRINGS(a,b,c,d,e) AESM_DBG_WARN("%s %s %s %s %s",a,b,c,d,e) +#define SGX_DBGPRINT_PRINT_UNICODE_STRING_LTP(x) AESM_DBG_WARN("%s", x) +#define SGX_DBGPRINT_PRINT_ANSI_STRING(x) AESM_DBG_WARN("%s",x) #define SGX_DBGPRINT_PRINT_STRING_LTP(x) AESM_DBG_WARN("%s",x) #define SGX_DBGPRINT_PRINT_STRING(x) AESM_DBG_WARN("%s",x) diff --git a/psw/ae/aesm_service/source/aesm/application/AEClass.h b/psw/ae/aesm_service/source/aesm/application/AEClass.h index 0fe1b5d87b..a6fed7bf2f 100644 --- a/psw/ae/aesm_service/source/aesm/application/AEClass.h +++ b/psw/ae/aesm_service/source/aesm/application/AEClass.h @@ -28,7 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - #ifndef _AE_CLASS_H_ #define _AE_CLASS_H_ #include "sgx_eid.h" @@ -125,9 +124,13 @@ ae_error_t SingletonEnclave::load_enclave() AESM_DBG_ERROR("AE SERVER NOT AVAILABLE in load enclave: %s",enclave_path); return AE_SERVER_NOT_AVAILABLE; } + if(ret == SGX_ERROR_OUT_OF_EPC){ + AESM_DBG_ERROR("No enough EPC to load AE: %s",enclave_path); + return AESM_AE_OUT_OF_EPC; + } if (ret != SGX_SUCCESS){ AESM_DBG_ERROR("Create Enclave failed:%d",ret); - return AE_FAILURE; + return AE_SERVER_NOT_AVAILABLE; } AESM_DBG_INFO("enclave %d loaded with id 0X%llX",aesm_enclave_id,m_enclave_id); diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp b/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp index c651501f0c..3b9780a4b2 100644 --- a/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp +++ b/psw/ae/aesm_service/source/aesm/application/aesm_config.cpp @@ -33,6 +33,7 @@ #include "aesm_config.h" #include "aesm_proxy_type.h" #include "oal.h" +#include "default_url_info.hh" #include #include #include @@ -45,9 +46,7 @@ enum _config_value_t{ config_comment, config_space, - config_endpoint_url, - config_pse_rl_url, - config_pse_ocsp_url, + config_white_list_url, config_aesm_proxy_url, config_aesm_proxy_type, config_value_nums @@ -59,9 +58,7 @@ struct _config_patterns_t{ }config_patterns[]={ {config_comment, "^[[:blank:]]*#"}, //matching a line with comments only (It is started by #) {config_space, "^[[:blank:]]*$"}, //matching empty line - {config_endpoint_url, "^[[:blank:]]*endpoint[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: endpoint url = .... - {config_pse_rl_url, "^[[:blank:]]*pse[[:blank:]]*rl[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: pse rl url = ... - {config_pse_ocsp_url, "^[[:blank:]]*pse[[:blank:]]*ocsp[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: pse ocsp url = ... + {config_white_list_url, "^[[:blank:]]*whitelist[[:blank:]]*url[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: whilelist url = .... {config_aesm_proxy_url,"^[[:blank:]]*aesm[[:blank:]]*proxy[[:blank:]]*=" URL_PATTERN OPTION_COMMENT "$"}, //matching line in format: aesm proxy = ... {config_aesm_proxy_type, "^[[:blank:]]*proxy[[:blank:]]*type[[:blank:]]*=[[:blank:]]([^[:blank:]]+)[[:blank:]]*" OPTION_COMMENT "$"}//matching line in format: proxy type = [direct|default|manual] }; @@ -143,28 +140,12 @@ static bool config_process_one_line(const char *line, config_entry_t entries[], case config_space: //ignore comment and space only line break; - case config_endpoint_url://Matching Endpoint URL setting + case config_white_list_url://Matching White List URL setting if(matches[1].rm_eo-matches[1].rm_so>=MAX_PATH){ - AESM_DBG_ERROR("too long endpoint url in config file"); + AESM_DBG_ERROR("too long white list url in config file"); }else{ - memcpy(infos.endpoint_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); - infos.endpoint_url[matches[1].rm_eo-matches[1].rm_so]='\0'; - } - break; - case config_pse_rl_url: - if(matches[1].rm_eo-matches[1].rm_so>=MAX_PATH){ - AESM_DBG_ERROR("too long pse pr url in config file"); - }else{ - memcpy(infos.pse_rl_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); - infos.pse_rl_url[matches[1].rm_eo-matches[1].rm_so]='\0'; - } - break; - case config_pse_ocsp_url: - if(matches[1].rm_eo-matches[1].rm_so>=MAX_PATH){ - AESM_DBG_ERROR("too long pse ocsp url in config file"); - }else{ - memcpy(infos.pse_ocsp_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); - infos.pse_ocsp_url[matches[1].rm_eo-matches[1].rm_so]='\0'; + memcpy(infos.white_list_url, line+matches[1].rm_so,matches[1].rm_eo-matches[1].rm_so); + infos.white_list_url[matches[1].rm_eo-matches[1].rm_so]='\0'; } break; case config_aesm_proxy_url: @@ -200,9 +181,7 @@ bool read_aesm_config(aesm_config_infos_t& infos) config_entry_t entries[config_value_nums]; memset(&entries,0,sizeof(entries)); memset(&infos, 0, sizeof(aesm_config_infos_t)); - strcpy(infos.endpoint_url, DEFAULT_URL); - strcpy(infos.pse_rl_url, DEFAULT_PSE_RL_URL); - strcpy(infos.pse_ocsp_url, DEFAULT_PSE_OCSP_URL); + strcpy(infos.white_list_url, DEFAULT_WHITE_LIST_URL); infos.proxy_type = AESM_PROXY_TYPE_DEFAULT_PROXY; FILE *f =fopen(AESM_CONFIG_FILE, "r"); diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_config.h b/psw/ae/aesm_service/source/aesm/application/aesm_config.h index 0dc5b5f24f..b8baf3d510 100644 --- a/psw/ae/aesm_service/source/aesm/application/aesm_config.h +++ b/psw/ae/aesm_service/source/aesm/application/aesm_config.h @@ -35,9 +35,7 @@ #include "aesm_logic.h" typedef struct _aesm_config_infos_t{ uint32_t proxy_type; - char endpoint_url[MAX_PATH]; - char pse_rl_url[MAX_PATH]; - char pse_ocsp_url[MAX_PATH]; + char white_list_url[MAX_PATH]; char aesm_proxy[MAX_PATH]; }aesm_config_infos_t; #endif diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp b/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp index 84b124a0b9..909fde2209 100644 --- a/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp +++ b/psw/ae/aesm_service/source/aesm/application/aesm_logic.cpp @@ -34,6 +34,7 @@ #include "QEClass.h" #include "LEClass.h" #include "PVEClass.h" +#include "PCEClass.h" #include "arch.h" #include "sgx_report.h" @@ -46,6 +47,7 @@ #include "oal/aesm_thread.h" #include "aesm_encode.h" #include "aesm_epid_blob.h" +#include "aesm_xegd_blob.h" #include "aesm_logic.h" #include "pve_logic.h" #include "qe_logic.h" @@ -64,6 +66,7 @@ #include "prof_fun.h" #include "aesm_long_lived_thread.h" #include "sgx_profile.h" +#include "service_enclave_mrsigner.hh" #define CHECK_SERVICE_STATUS if (!is_service_running()) return AESM_SERVICE_STOPPED; #define CHECK_SGX_STATUS if (g_sgx_device_status != SGX_ENABLED) return AESM_SGX_DEVICE_NOT_AVAILABLE; @@ -74,13 +77,60 @@ AESMLogicMutex AESMLogic::_le_mutex; bool AESMLogic::_is_qe_psvn_set; bool AESMLogic::_is_pse_psvn_set; +bool AESMLogic::_is_pce_psvn_set; psvn_t AESMLogic::_qe_psvn; +psvn_t AESMLogic::_pce_psvn; psvn_t AESMLogic::_pse_psvn; +uint32_t AESMLogic::active_extended_epid_group_id; + +static ae_error_t read_global_extended_epid_group_id(uint32_t *xeg_id) +{ + char path_name[MAX_PATH]; + ae_error_t ae_ret = aesm_get_pathname(FT_PERSISTENT_STORAGE, EXTENDED_EPID_GROUP_ID_FID, path_name, MAX_PATH); + if(AE_SUCCESS != ae_ret){ + return ae_ret; + } + FILE * f = fopen(path_name, "r"); + if( f == NULL){ + return OAL_CONFIG_FILE_ERROR; + } + ae_ret = OAL_CONFIG_FILE_ERROR; + if(fscanf(f, "%u", xeg_id)==1){ + ae_ret = AE_SUCCESS; + } + fclose(f); + return ae_ret; +} +static ae_error_t set_global_extended_epid_group_id(uint32_t xeg_id) +{ + char path_name[MAX_PATH]; + ae_error_t ae_ret = aesm_get_pathname(FT_PERSISTENT_STORAGE, EXTENDED_EPID_GROUP_ID_FID, path_name, MAX_PATH); + if(AE_SUCCESS != ae_ret){ + return ae_ret; + } + FILE *f = fopen(path_name, "w"); + if(f == NULL){ + return OAL_CONFIG_FILE_ERROR; + } + ae_ret = OAL_CONFIG_FILE_ERROR; + if(fprintf(f, "%u", xeg_id)>0){ + ae_ret = AE_SUCCESS; + } + fclose(f); + return ae_ret; +} + +uint32_t AESMLogic::get_active_extended_epid_group_id() +{ + return active_extended_epid_group_id; +} + static ae_error_t thread_to_load_qe(aesm_thread_arg_type_t arg) { epid_blob_with_cur_psvn_t epid_data; ae_error_t ae_ret = AE_FAILURE; + uint32_t epid_xeid = 0; UNUSED(arg); AESM_DBG_TRACE("start to load qe"); memset(&epid_data, 0, sizeof(epid_data)); @@ -94,7 +144,50 @@ static ae_error_t thread_to_load_qe(aesm_thread_arg_type_t arg) AESM_DBG_WARN("fail to load QE: %d", ae_ret); }else{ AESM_DBG_TRACE("QE loaded successfully"); + bool resealed = false; + // Just take this chance to reseal EPID blob in case TCB is + // upgraded, return value is ignored and no provisioning is + // triggered. + ae_ret = static_cast(CQEClass::instance().verify_blob( + epid_data.trusted_epid_blob, + SGX_TRUSTED_EPID_BLOB_SIZE_PAK, + &resealed)); + if(AE_SUCCESS != ae_ret) + { + AESM_DBG_WARN("Failed to verify EPID blob: %d", ae_ret); + // The EPID blob is invalid. + EPIDBlob::instance().remove(); + }else{ + // Check whether EPID blob XEGDID is aligned with active extended group id if it exists. + if ((EPIDBlob::instance().get_extended_epid_group_id(&epid_xeid) == AE_SUCCESS) && (epid_xeid == AESMLogic::get_active_extended_epid_group_id())) { + AESM_DBG_TRACE("EPID blob Verified"); + // XEGDID is aligned + if (true == resealed) + { + AESM_DBG_TRACE("EPID blob is resealed"); + if ((ae_ret = EPIDBlob::instance().write(epid_data)) + != AE_SUCCESS) + { + AESM_DBG_WARN("Failed to update epid blob: %d", ae_ret); + } + } + } + else { // XEGDID is NOT aligned + AESM_DBG_TRACE("XEGDID mismatch in EPIDBlob, loading PCE ..."); + EPIDBlob::instance().remove(); + ae_ret = CPCEClass::instance().load_enclave(); + if (AE_SUCCESS != ae_ret) + { + AESM_DBG_WARN("fail to load PCE: %d", ae_ret); + } + else{ + AESM_DBG_TRACE("PCE loaded successfully"); + } + } + } } + }else{ + AESM_DBG_TRACE("Fail to read EPID Blob"); } AESM_DBG_TRACE("QE Thread finished succ"); return AE_SUCCESS; @@ -110,6 +203,24 @@ ae_error_t AESMLogic::service_start() //ippInit();//no ippInit available for c version ipp AESM_DBG_INFO("aesm service is starting"); + + //Try to read current active extended epid group id + ae_ret = read_global_extended_epid_group_id(&AESMLogic::active_extended_epid_group_id); + if (AE_SUCCESS != ae_ret){ + AESM_DBG_INFO("Fail to read extended epid group id, default extended epid group used"); + AESMLogic::active_extended_epid_group_id = DEFAULT_EGID; //use default extended epid group id 0 if it is not available from data file + + } + else{ + AESM_DBG_INFO("active extended group id %d used", AESMLogic::active_extended_epid_group_id); + } + extended_epid_group_blob_t xegb; + aesm_server_url_infos_t urls; + if (AE_SUCCESS != (XEGDBlob::verify_xegd_by_xgid(active_extended_epid_group_id)) || + AE_SUCCESS != (EndpointSelectionInfo::verify_file_by_xgid(active_extended_epid_group_id))){//try to load XEGD and URL file to make sure it is valid + AESMLogic::active_extended_epid_group_id = DEFAULT_EGID;//If the active extended epid group id read from data file is not valid, switch to default extended epid group id + } + ae_ret = CLEClass::instance().load_enclave(); if(AE_SUCCESS != ae_ret) { @@ -126,7 +237,8 @@ ae_error_t AESMLogic::service_start() }else{ (void)aesm_free_thread(qe_thread);//release thread handle to free memory } - + + start_white_list_thread(); AESM_DBG_TRACE("aesm service is started"); return AE_SUCCESS; @@ -134,7 +246,9 @@ ae_error_t AESMLogic::service_start() void AESMLogic::service_stop() { + stop_all_long_lived_threads();//waiting for pending threads util timeout CPVEClass::instance().unload_enclave(); + CPCEClass::instance().unload_enclave(); CQEClass::instance().unload_enclave(); CLEClass::instance().unload_enclave(); stop_all_long_lived_threads(); @@ -234,16 +348,21 @@ aesm_error_t AESMLogic::get_launch_token( return AESM_PARAMETER_ERROR; } ae_error_t ae_ret = CLEClass::instance().load_enclave(); - if(ae_ret == AE_SERVER_NOT_AVAILABLE) + if(ae_ret == AESM_AE_NO_DEVICE) { AESM_LOG_ERROR("%s", g_event_string_table[SGX_EVENT_SERVICE_UNAVAILABLE]); AESM_DBG_FATAL("LE not loaded due to AE_SERVER_NOT_AVAILABLE, possible SGX Env Not Ready"); return AESM_NO_DEVICE_ERROR; } + else if(ae_ret == AESM_AE_OUT_OF_EPC) + { + AESM_DBG_WARN("LE not loaded due to out of EPC", ae_ret); + return AESM_OUT_OF_EPC; + } else if(AE_FAILED(ae_ret)) { AESM_DBG_ERROR("LE not loaded:%d", ae_ret); - return AESM_UNEXPECTED_ERROR; + return AESM_SERVICE_UNAVAILABLE; } ret_le = static_cast(CLEClass::instance().get_launch_token( const_cast(mrenclave), mrenclave_size, @@ -297,6 +416,24 @@ ae_error_t AESMLogic::get_qe_isv_svn(uint16_t& isv_svn) return AE_SUCCESS; } + +ae_error_t AESMLogic::get_pce_isv_svn(uint16_t& isv_svn) +{ + if(!_is_pce_psvn_set){ + ae_error_t ae_err = CPCEClass::instance().load_enclave(); + if(AE_SUCCESS != ae_err){ + AESM_DBG_ERROR("Fail to load PCE Enclave:%d",ae_err); + return ae_err; + } + } + assert(_is_pce_psvn_set); + if(0!=memcpy_s(&isv_svn, sizeof(isv_svn), &_pce_psvn.isv_svn, sizeof(_pce_psvn.isv_svn))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + return AE_SUCCESS; +} + ae_error_t AESMLogic::get_pse_isv_svn(uint16_t& isv_svn) { return AE_FAILURE; @@ -321,41 +458,62 @@ ae_error_t AESMLogic::get_qe_cpu_svn(sgx_cpu_svn_t& cpu_svn) -ae_error_t AESMLogic::set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn) +ae_error_t AESMLogic::set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn, uint32_t mrsigner_index) { if(prod_id == QE_PROD_ID){ - if(_is_qe_psvn_set){ - if(0!=memcmp(&_qe_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| - 0!=memcmp(&_qe_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ - AESM_DBG_ERROR("PSVN unmatched for QE/PVE"); - return AE_PSVN_UNMATCHED_ERROR; + if(mrsigner_index == AE_MR_SIGNER){ + if(_is_qe_psvn_set){ + if(0!=memcmp(&_qe_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| + 0!=memcmp(&_qe_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("PSVN unmatched for QE/PVE"); + return AE_PSVN_UNMATCHED_ERROR; + } + }else{ + if(0!=memcpy_s(&_qe_psvn.isv_svn, sizeof(_qe_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| + 0!=memcpy_s(&_qe_psvn.cpu_svn, sizeof(_qe_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + AESM_DBG_TRACE("get QE or PvE isv_svn=%d",(int)isv_svn); + _is_qe_psvn_set = true; + return AE_SUCCESS; } - }else{ - if(0!=memcpy_s(&_qe_psvn.isv_svn, sizeof(_qe_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| - 0!=memcpy_s(&_qe_psvn.cpu_svn, sizeof(_qe_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ - AESM_DBG_ERROR("memcpy failed"); - return AE_FAILURE; + }else if(mrsigner_index==PCE_MR_SIGNER){ + if(_is_pce_psvn_set){ + if(0!=memcmp(&_pce_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| + 0!=memcmp(&_pce_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("PSVN unmatched for PCE"); + return AE_PSVN_UNMATCHED_ERROR; + } + }else{ + if(0!=memcpy_s(&_pce_psvn.isv_svn, sizeof(_pce_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| + 0!=memcpy_s(&_pce_psvn.cpu_svn, sizeof(_pce_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + AESM_DBG_TRACE("get PCE isv_svn=%d", (int)isv_svn); + _is_pce_psvn_set = true; + return AE_SUCCESS; } - AESM_DBG_TRACE("get QE or PvE isv_svn=%d",(int)isv_svn); - _is_qe_psvn_set = true; - return AE_SUCCESS; } }else if(prod_id == PSE_PROD_ID){ - if(_is_pse_psvn_set){ - if(0!=memcmp(&_pse_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| - 0!=memcmp(&_pse_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ - AESM_DBG_ERROR("PSVN unmatched for PSE"); - return AE_PSVN_UNMATCHED_ERROR; + if(mrsigner_index == AE_MR_SIGNER){ + if(_is_pse_psvn_set){ + if(0!=memcmp(&_pse_psvn.isv_svn, &isv_svn, sizeof(isv_svn))|| + 0!=memcmp(&_pse_psvn.cpu_svn, &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("PSVN unmatched for PSE"); + return AE_PSVN_UNMATCHED_ERROR; + } + }else{ + if(0!=memcpy_s(&_pse_psvn.isv_svn, sizeof(_pse_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| + 0!=memcpy_s(&_pse_psvn.cpu_svn, sizeof(_pse_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ + AESM_DBG_ERROR("memcpy failed"); + return AE_FAILURE; + } + AESM_DBG_TRACE("get PSE isv_svn=%d", (int)isv_svn); + _is_pse_psvn_set = true; + return AE_SUCCESS; } - }else{ - if(0!=memcpy_s(&_pse_psvn.isv_svn, sizeof(_pse_psvn.isv_svn), &isv_svn, sizeof(isv_svn))|| - 0!=memcpy_s(&_pse_psvn.cpu_svn, sizeof(_pse_psvn.cpu_svn), &cpu_svn, sizeof(sgx_cpu_svn_t))){ - AESM_DBG_ERROR("memcpy failed"); - return AE_FAILURE; - } - AESM_DBG_TRACE("get PSE isv_svn=%d", (int)isv_svn); - _is_pse_psvn_set = true; - return AE_SUCCESS; } } return AE_SUCCESS; @@ -369,16 +527,25 @@ sgx_status_t AESMLogic::get_launch_token(const enclave_css_t* signature, AESMLogicLock lock(_le_mutex); ae_error_t ret_le = AE_SUCCESS; + uint32_t mrsigner_index = UINT32_MAX; // load LE to get launch token if((ret_le=CLEClass::instance().load_enclave()) != AE_SUCCESS) { - if(ret_le == AE_SERVER_NOT_AVAILABLE) + if(ret_le == AESM_AE_NO_DEVICE) { - AESM_DBG_FATAL("LE not loaded due to AE_SERVER_NOT_AVAILABLE, possible SGX Env Not Ready"); + AESM_DBG_FATAL("LE not loaded due to no SGX device available, possible SGX Env Not Ready"); return SGX_ERROR_NO_DEVICE; } - AESM_DBG_FATAL("fail to load LE:%d",ret_le); - return SGX_ERROR_UNEXPECTED; + else if(ret_le == AESM_AE_OUT_OF_EPC) + { + AESM_DBG_FATAL("LE not loaded due to out of EPC"); + return SGX_ERROR_OUT_OF_EPC; + } + else + { + AESM_DBG_FATAL("fail to load LE:%d",ret_le); + return SGX_ERROR_SERVICE_UNAVAILABLE; + } } @@ -390,7 +557,8 @@ sgx_status_t AESMLogic::get_launch_token(const enclave_css_t* signature, const_cast(reinterpret_cast(attribute)), sizeof(sgx_attributes_t), reinterpret_cast(launch_token), - sizeof(token_t))); + sizeof(token_t), + &mrsigner_index)); switch (ret_le) { case AE_SUCCESS: @@ -411,7 +579,7 @@ sgx_status_t AESMLogic::get_launch_token(const enclave_css_t* signature, } token_t *lt = reinterpret_cast(launch_token); - ret_le = set_psvn(signature->body.isv_prod_id, signature->body.isv_svn, lt->cpu_svn_le); + ret_le = set_psvn(signature->body.isv_prod_id, signature->body.isv_svn, lt->cpu_svn_le, mrsigner_index); if(AE_PSVN_UNMATCHED_ERROR == ret_le) { //QE or PSE has been changed, but AESM doesn't restart. Will not provide service. @@ -428,7 +596,7 @@ aesm_error_t AESMLogic::create_session( uint32_t* session_id, uint8_t* se_dh_msg1, uint32_t se_dh_msg1_size) { - return AESM_SERVICE_NOT_AVAILABLE; + return AESM_SERVICE_UNAVAILABLE; } aesm_error_t AESMLogic::exchange_report( @@ -436,20 +604,20 @@ aesm_error_t AESMLogic::exchange_report( const uint8_t* se_dh_msg2, uint32_t se_dh_msg2_size, uint8_t* se_dh_msg3, uint32_t se_dh_msg3_size) { - return AESM_SERVICE_NOT_AVAILABLE; + return AESM_SERVICE_UNAVAILABLE; } aesm_error_t AESMLogic::close_session( uint32_t session_id) { - return AESM_SERVICE_NOT_AVAILABLE; + return AESM_SERVICE_UNAVAILABLE; } aesm_error_t AESMLogic::invoke_service( const uint8_t* pse_message_req, uint32_t pse_message_req_size, uint8_t* pse_message_resp, uint32_t pse_message_resp_size) { - return AESM_SERVICE_NOT_AVAILABLE;; + return AESM_SERVICE_UNAVAILABLE;; } aesm_error_t AESMLogic::get_ps_cap( @@ -469,6 +637,7 @@ aesm_error_t AESMLogic::init_quote( { ae_error_t ret = AE_SUCCESS; uint16_t qe_isv_svn = 0xFFFF; + uint16_t pce_isv_svn = 0xFFFF; sgx_cpu_svn_t qe_cpu_svn; memset(&qe_cpu_svn, 0, sizeof(qe_cpu_svn)); AESM_DBG_INFO("init_quote"); @@ -479,19 +648,42 @@ aesm_error_t AESMLogic::init_quote( } AESMLogicLock lock(_qe_pve_mutex); CHECK_EPID_PROVISIONG_STATUS; + ret = get_pce_isv_svn(pce_isv_svn); + if(AE_SUCCESS != ret) + { + if(AESM_AE_OUT_OF_EPC == ret) + return AESM_OUT_OF_EPC; + else if(AESM_AE_NO_DEVICE == ret) + return AESM_NO_DEVICE_ERROR; + else if(AE_SERVER_NOT_AVAILABLE == ret) + return AESM_SERVICE_UNAVAILABLE; + return AESM_UNEXPECTED_ERROR; + } ret = get_qe_cpu_svn(qe_cpu_svn); if(AE_SUCCESS != ret) { + if(AESM_AE_OUT_OF_EPC == ret) + return AESM_OUT_OF_EPC; + else if(AESM_AE_NO_DEVICE == ret) + return AESM_NO_DEVICE_ERROR; + else if(AE_SERVER_NOT_AVAILABLE == ret) + return AESM_SERVICE_UNAVAILABLE; return AESM_UNEXPECTED_ERROR; } ret = get_qe_isv_svn(qe_isv_svn); if(AE_SUCCESS != ret) { + if(AESM_AE_OUT_OF_EPC == ret) + return AESM_OUT_OF_EPC; + else if(AESM_AE_NO_DEVICE == ret) + return AESM_NO_DEVICE_ERROR; + else if(AE_SERVER_NOT_AVAILABLE == ret) + return AESM_SERVICE_UNAVAILABLE; return AESM_UNEXPECTED_ERROR; } return QEAESMLogic::init_quote( reinterpret_cast(target_info), - gid, gid_size, qe_isv_svn, qe_cpu_svn); + gid, gid_size, pce_isv_svn, qe_isv_svn, qe_cpu_svn); } aesm_error_t AESMLogic::get_quote(const uint8_t *report, uint32_t report_size, @@ -502,6 +694,8 @@ aesm_error_t AESMLogic::get_quote(const uint8_t *report, uint32_t report_size, uint8_t *qe_report, uint32_t qe_report_size, uint8_t *quote, uint32_t buf_size) { + ae_error_t ret = AE_SUCCESS; + uint16_t pce_isv_svn = 0xFFFF; AESM_DBG_INFO("get_quote"); if(sizeof(sgx_report_t) != report_size || sizeof(sgx_spid_t) != spid_size) @@ -516,8 +710,19 @@ aesm_error_t AESMLogic::get_quote(const uint8_t *report, uint32_t report_size, } AESMLogicLock lock(_qe_pve_mutex); CHECK_EPID_PROVISIONG_STATUS; + ret = get_pce_isv_svn(pce_isv_svn); + if(AE_SUCCESS != ret) + { + if(AESM_AE_OUT_OF_EPC == ret) + return AESM_OUT_OF_EPC; + else if(AESM_AE_NO_DEVICE == ret) + return AESM_NO_DEVICE_ERROR; + else if(AE_SERVER_NOT_AVAILABLE == ret) + return AESM_SERVICE_UNAVAILABLE; + return AESM_UNEXPECTED_ERROR; + } return QEAESMLogic::get_quote(report, quote_type, spid, nonce, sigrl, - sigrl_size, qe_report, quote, buf_size); + sigrl_size, qe_report, quote, buf_size, pce_isv_svn); } uint32_t AESMLogic::endpoint_selection(endpoint_selection_infos_t& es_info) @@ -538,6 +743,84 @@ aesm_error_t AESMLogic::report_attestation_status( return PlatformInfoLogic::report_attestation_status(platform_info, platform_info_size, attestation_status, update_info, update_info_size); } +uint32_t AESMLogic::is_gid_matching_result_in_epid_blob(const GroupID& gid) +{ + AESMLogicLock lock(_qe_pve_mutex); + EPIDBlob& epid_blob = EPIDBlob::instance(); + uint32_t le_gid; + if(epid_blob.get_sgx_gid(&le_gid)!=AE_SUCCESS){//get littlen endian gid + return GIDMT_UNEXPECTED_ERROR; + } + le_gid=_htonl(le_gid);//use bigendian gid + se_static_assert(sizeof(le_gid)==sizeof(gid)); + if(memcmp(&le_gid,&gid,sizeof(gid))!=0){ + return GIDMT_UNMATCHED; + } + return GIDMT_MATCHED; +} + +ae_error_t AESMLogic::get_white_list_size_without_lock(uint32_t *white_list_cert_size) +{ + uint32_t white_cert_size = 0; + ae_error_t ae_ret = aesm_query_data_size(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_FID, &white_cert_size); + if (AE_SUCCESS == ae_ret) + { + if (white_cert_size != 0){//file existing and not 0 size + *white_list_cert_size = white_cert_size; + return AE_SUCCESS; + } + else + return AE_FAILURE; + } + else + { + return ae_ret; + } +} + +aesm_error_t AESMLogic::get_white_list_size( + uint32_t* white_list_cert_size) +{ + if (NULL == white_list_cert_size){ + return AESM_PARAMETER_ERROR; + } + CHECK_SERVICE_STATUS; + AESMLogicLock lock(_le_mutex); + CHECK_SERVICE_STATUS; + ae_error_t ae_ret = get_white_list_size_without_lock(white_list_cert_size); + if (AE_SUCCESS == ae_ret) + return AESM_SUCCESS; + else + return AESM_UNEXPECTED_ERROR; +} + + +aesm_error_t AESMLogic::get_white_list( + uint8_t *white_list_cert, uint32_t buf_size) +{ + uint32_t white_cert_size=0; + if (NULL == white_list_cert){ + return AESM_PARAMETER_ERROR; + } + CHECK_SERVICE_STATUS; + AESMLogicLock lock(_le_mutex); + CHECK_SERVICE_STATUS; + ae_error_t ae_ret = get_white_list_size_without_lock(&white_cert_size); + if (AE_SUCCESS != ae_ret) + return AESM_UNEXPECTED_ERROR; + if (white_cert_size != buf_size) + { + return AESM_PARAMETER_ERROR; + } + + ae_ret = aesm_read_data(FT_PERSISTENT_STORAGE, AESM_WHITE_LIST_CERT_FID, white_list_cert, &white_cert_size); + if (AE_SUCCESS != ae_ret){ + AESM_DBG_WARN("Fail to read white cert list file"); + return AESM_UNEXPECTED_ERROR; + } + return AESM_SUCCESS; +} + ae_error_t sgx_error_to_ae_error(sgx_status_t status) { if(SGX_ERROR_OUT_OF_MEMORY == status) @@ -547,3 +830,37 @@ ae_error_t sgx_error_to_ae_error(sgx_status_t status) return AE_FAILURE; } +aesm_error_t AESMLogic::switch_extended_epid_group( + uint32_t extended_epid_group_id + ) +{ + AESM_DBG_INFO("AESMLogic::switch_extended_epid_group"); + ae_error_t ae_ret; + extended_epid_group_blob_t xegb; + aesm_server_url_infos_t urls; + if ((ae_ret = XEGDBlob::verify_xegd_by_xgid(extended_epid_group_id)) != AE_SUCCESS || + (ae_ret = EndpointSelectionInfo::verify_file_by_xgid(extended_epid_group_id)) != AE_SUCCESS){ + AESM_DBG_INFO("Fail to switch to extended epid group to %d due to XEGD blob for URL blob not available", extended_epid_group_id); + return AESM_PARAMETER_ERROR; + } + ae_ret = set_global_extended_epid_group_id(extended_epid_group_id); + if (ae_ret != AE_SUCCESS){ + AESM_DBG_INFO("Fail to switch to extended epid group %d", extended_epid_group_id); + return AESM_UNEXPECTED_ERROR; + } + + AESM_DBG_INFO("Succ to switch to extended epid group %d in data file, restart aesm required to use it", extended_epid_group_id); + return AESM_SUCCESS; +} +aesm_error_t AESMLogic::get_extended_epid_group_id( + uint32_t* extended_epid_group_id) +{ + AESM_DBG_INFO("AESMLogic::get_extended_epid_group"); + if (NULL == extended_epid_group_id) + { + return AESM_PARAMETER_ERROR; + } + *extended_epid_group_id = get_active_extended_epid_group_id(); + return AESM_SUCCESS; +} + diff --git a/psw/ae/aesm_service/source/aesm/application/aesm_logic.h b/psw/ae/aesm_service/source/aesm/application/aesm_logic.h index 48ef7fc527..0cbd654bf5 100644 --- a/psw/ae/aesm_service/source/aesm/application/aesm_logic.h +++ b/psw/ae/aesm_service/source/aesm/application/aesm_logic.h @@ -49,7 +49,7 @@ #include "default_url_info.hh" -/*File to declare AESMLogic Class */ +/*File to declare AESMLogic Class and facility class(Mutex/Lock) for it*/ const uint32_t THREAD_TIMEOUT = 5000; @@ -82,15 +82,19 @@ class AESMLogic{ public: static AESMLogicMutex _qe_pve_mutex, _pse_mutex, _le_mutex; /*mutex to lock external interface*/ private: - static psvn_t _qe_psvn, _pse_psvn; /*two different cpu svn used although they're same. We should only access qe_psvn when qe_pve_mutex is acquired and only access pse_psvn when pse_mutext is acquired*/ - static bool _is_qe_psvn_set, _is_pse_psvn_set; - static ae_error_t set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn); + static psvn_t _qe_psvn, _pse_psvn, _pce_psvn; /*different cpu svn used although they're same. We should only access _qe_psvn/_pce_svn when qe_pve_mutex is acquired and only access _pse_psvn when pse_mutext is acquired*/ + static bool _is_qe_psvn_set, _is_pse_psvn_set, _is_pce_psvn_set; + static uint32_t active_extended_epid_group_id; + static ae_error_t set_psvn(uint16_t prod_id, uint16_t isv_svn, sgx_cpu_svn_t cpu_svn, uint32_t mrsigner_index); static ae_error_t save_unverified_white_list(const uint8_t *white_list_cert, uint32_t white_list_cert_size); + static ae_error_t get_white_list_size_without_lock(uint32_t *white_list_cert_size); public: - static ae_error_t get_qe_isv_svn(uint16_t& isv_svn);/*This function should only be called when _qe_pve_mutex is acquired*/ + static ae_error_t get_qe_isv_svn(uint16_t& isv_svn); /*This function should only be called when _qe_pve_mutex is acquired*/ static ae_error_t get_qe_cpu_svn(sgx_cpu_svn_t& cpu_svn);/*This function should only be called when _qe_pve_mutex is acquired*/ - static ae_error_t get_pse_isv_svn(uint16_t& isv_svn); /*This function should only be called when _pse_mutex is acquired*/ + static ae_error_t get_pse_isv_svn(uint16_t& isv_svn); /*This function should only be called when _pse_mutex is acquired*/ static ae_error_t get_pse_cpu_svn(sgx_cpu_svn_t& cpu_svn);/*This function should only be called when _pse_mutex is acquired*/ + static ae_error_t get_pce_isv_svn(uint16_t& isv_svn); + static uint32_t get_active_extended_epid_group_id(void); static ae_error_t service_start(); static void service_stop(); @@ -138,6 +142,8 @@ public: uint64_t* ps_cap); static uint32_t endpoint_selection(endpoint_selection_infos_t& es_info); + enum {GIDMT_UNMATCHED, GIDMT_NOT_AVAILABLE, GIDMT_MATCHED,GIDMT_UNEXPECTED_ERROR}; + static uint32_t is_gid_matching_result_in_epid_blob(const GroupID& gid); static aesm_error_t report_attestation_status( uint8_t* platform_info, uint32_t platform_info_size, @@ -147,6 +153,17 @@ public: static aesm_error_t white_list_register( const uint8_t *white_list_cert, uint32_t white_list_cert_size); + static aesm_error_t get_white_list_size( + uint32_t* white_list_cert_size); + + static aesm_error_t get_white_list( + uint8_t *white_list_cert, uint32_t buf_size); + + static aesm_error_t get_extended_epid_group_id( + uint32_t* extended_epid_group_id); + + static aesm_error_t switch_extended_epid_group( + uint32_t extended_epid_group_id ); }; #endif diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp index 92832a0469..2b86a50486 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_ecdsa.cpp @@ -32,12 +32,26 @@ #include "sgx_tcrypto.h" #include "aeerror.h" #include "tlv_common.h" -#include "cipher.h" +#include "pek_pub_key.h" +#include "peksk_pub.hh" -ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek) +ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek, const extended_epid_group_blob_t& xegb) { uint8_t result = SGX_EC_INVALID_SIGNATURE; - sgx_status_t sgx_code = check_pek_signature(signed_pek, &result); + uint32_t i; + sgx_status_t sgx_code; + const uint8_t *p = (const uint8_t *)&xegb; + for (i = 0; i < sizeof(xegb); i++){ + if (p[i] != 0){ + break; + } + } + if (i == sizeof(xegb)){//if all bytes of xegb is 0, using hardcoded PEKSK public key + sgx_code = check_pek_signature(signed_pek, (const sgx_ec256_public_t*)&g_pek_pub_key_little_endian, &result); + } + else{ + sgx_code = check_pek_signature(signed_pek, (const sgx_ec256_public_t*)xegb.pek_sk, &result); + } if(sgx_code == SGX_ERROR_OUT_OF_MEMORY) return AE_OUT_OF_MEMORY_ERROR; else if(sgx_code != SGX_SUCCESS) @@ -48,3 +62,19 @@ ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek) return AE_SUCCESS;//PEK Singatue verified successfully } +ae_error_t aesm_verify_xegb(const extended_epid_group_blob_t& signed_xegb) +{ + uint8_t result = SGX_EC_INVALID_SIGNATURE; + sgx_status_t sgx_code = verify_xegb(signed_xegb, &result); + if (sgx_code == SGX_ERROR_INVALID_PARAMETER) + return AE_INVALID_PARAMETER; + else if(sgx_code == SGX_ERROR_OUT_OF_MEMORY) + return AE_OUT_OF_MEMORY_ERROR; + else if (sgx_code != SGX_SUCCESS) + return AE_FAILURE; //unknown error code + else if (result != SGX_EC_VALID)//sgx_code is SGX_SUCCESS + return AE_INVALID_PARAMETER; //signature verification failed + else + return AE_SUCCESS;//XEGB Signature verified successfully +} + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp index bebc4a7e95..f5f3f0f8ae 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.cpp @@ -40,7 +40,6 @@ #include #include #include - /** * Method converts byte containing value from 0x00-0x0F into its corresponding ASCII code, * e.g. converts 0x00 to '0', 0x0A to 'A'. @@ -69,7 +68,7 @@ static uint8_t convert_value_to_ascii(uint8_t in) * e.g. converts '0' to 0x00, 'A' to 0x0A. * * @param in char containing ASCII code (allowed values: '0-9', 'a-f', 'A-F') -* @param val output parameter containing converted value, if method suceeds. +* @param val output parameter containing converted value, if method succeeds. * * @return true if conversion succeeds, false otherwise */ @@ -102,6 +101,7 @@ static bool convert_ascii_to_value(uint8_t in, uint8_t& val) //The out_size must always be 2*in_size since each byte into encoded by 2 characters static bool byte_array_to_hex_string(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + if(in_size>UINT32_MAX/2)return false; if(in_buf==NULL||out_buf==NULL|| out_size!=in_size*2 )return false; for(uint32_t i=0; i< in_size; i++) @@ -120,6 +120,7 @@ static bool byte_array_to_hex_string(const uint8_t *in_buf, uint32_t in_size, ui //The in_size must be even number and equals 2*out_size static bool hex_string_to_byte_array(const uint8_t *in_buf, uint32_t in_size, uint8_t *out_buf, uint32_t out_size) { + if(out_size>UINT32_MAX/2)return false; if(in_buf==NULL||out_buf==NULL||out_size*2!=in_size)return false; for(uint32_t i=0;i 0) ? 1 : 0 ); } -//Function to give an upbound of size of data after BASR64 encoding +//Function to give an upper bound of size of data after BASR64 encoding //@param length: the length in bytes of data to be encoded -//@return an upbound of length in bytes of data after encoding +//@return an upper bound of length in bytes of data after encoding static uint32_t get_base_64_length_upbound(uint32_t length) { uint32_t extra = (length+9)/10+50;//using enough extra memory @@ -274,3 +275,4 @@ bool decode_response(const uint8_t *input_buf, uint32_t input_len, uint8_t *resp return false; return true; } + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h index 3b35f281e0..e221d408ed 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_encode.h @@ -37,17 +37,16 @@ extern "C"{ #endif -uint32_t certPseSvn(); -/*Function to provide an upbound of buffer size of encoded message for an input request +/*Function to provide an upper bound of buffer size of encoded message for an input request *@param req, the header for the input request such as ProvMsg1 or ProvMsg3 - *@return an upbound of the required buffer size for the encoded message - */ + *@return an upper bound of the required buffer size for the encoded message +*/ uint32_t get_request_encoding_length(const uint8_t *req); -/*Function to provide an upbound of the response body size given the length of encoded response message +/*Function to provide an upper bound of the response body size given the length of encoded response message *@param buf_len, the length of the encoded message for an response message - *@return an upbound of the length in bytes of decoded response message body such as ProvMsg2 or ProvMsg4 + *@return an upper bound of the length in bytes of decoded response message body such as ProvMsg2 or ProvMsg4 */ uint32_t get_response_decoding_length(uint32_t buf_len); diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp index cbfa1cd6fa..a268e6a69d 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.cpp @@ -45,8 +45,7 @@ ae_error_t EPIDBlob::read(epid_blob_with_cur_psvn_t& blob) goto CLEANUP_READ_FILE; } - if( data_size != sizeof(blob_cache) ) - { + if (data_size != sizeof(blob_cache)){ ae_ret = QE_EPIDBLOB_ERROR; goto CLEANUP_READ_FILE; } @@ -107,22 +106,26 @@ ae_error_t EPIDBlob::get_sgx_gid(uint32_t* pgid) epid_blob_with_cur_psvn_t epid_blob; sgx_sealed_data_t *sealed_epid = reinterpret_cast(epid_blob.trusted_epid_blob); - if (NULL != pgid) { + if (NULL == pgid) + return AE_INVALID_PARAMETER; + // + // get the epid blob + // + aesm_result = this->read(epid_blob); + if (AE_SUCCESS == aesm_result) { // - // get the epid blob + // get the gid // - aesm_result = this->read(epid_blob); - if (AE_SUCCESS == aesm_result) { - // - // get the gid - // - uint32_t plain_text_offset = sealed_epid->plain_text_offset; - se_plaintext_epid_data_t* plain_text = reinterpret_cast(epid_blob.trusted_epid_blob + sizeof(sgx_sealed_data_t) + plain_text_offset); - if(memcpy_s(pgid, sizeof(*pgid), &plain_text->epid_group_cert.gid, sizeof(plain_text->epid_group_cert.gid))) //read gid from EPID Data blob - { - AESM_DBG_ERROR("memcpy_s failed"); - aesm_result = AE_FAILURE; - } + uint32_t plain_text_offset = sealed_epid->plain_text_offset; + se_plaintext_epid_data_pak_t* plain_text = reinterpret_cast(epid_blob.trusted_epid_blob + sizeof(sgx_sealed_data_t) + plain_text_offset); + + if(memcpy_s(pgid, sizeof(*pgid), &plain_text->epid_group_cert.gid, sizeof(plain_text->epid_group_cert.gid))) //read gid from EPID Data blob + { + AESM_DBG_ERROR("memcpy_s failed"); + aesm_result = AE_FAILURE; + } + else + { // // return little-endian // @@ -135,5 +138,64 @@ ae_error_t EPIDBlob::get_sgx_gid(uint32_t* pgid) } return aesm_result; +} + + +ae_error_t EPIDBlob::get_extended_epid_group_id(uint32_t* pxeid) +{ + ae_error_t aesm_result = AE_SUCCESS; + epid_blob_with_cur_psvn_t epid_blob; + sgx_sealed_data_t *sealed_epid = reinterpret_cast(epid_blob.trusted_epid_blob); + + if (NULL == pxeid) + return AE_INVALID_PARAMETER; + // + // get the epid blob + // + aesm_result = this->read(epid_blob); + if (AE_SUCCESS == aesm_result) { + // + // get the xeid + // + uint32_t plain_text_offset = sealed_epid->plain_text_offset; + se_plaintext_epid_data_pak_t* plain_text_new = reinterpret_cast(epid_blob.trusted_epid_blob + sizeof(sgx_sealed_data_t)+plain_text_offset); + switch (plain_text_new->epid_key_version) + { + case EPID_KEY_BLOB_VERSION_PAK: + + if (memcpy_s(pxeid, sizeof(*pxeid), &plain_text_new->xeid, sizeof(plain_text_new->xeid))) //read extended_epid_group_id from EPID Data blob + { + AESM_DBG_ERROR("memcpy_s failed"); + aesm_result = AE_FAILURE; + } + else + { + // + // return little-endian + // + AESM_DBG_TRACE(": get gid %d from epid blob", *pxeid); + aesm_result = AE_SUCCESS; + } + break; + default: + AESM_DBG_ERROR("unexpected epid_key_version"); + aesm_result = AE_FAILURE; + break; + } + } + return aesm_result; } + + +ae_error_t EPIDBlob::remove(void) +{ + ae_error_t ae_ret = AE_FAILURE; + status = not_available; + if ((ae_ret = aesm_remove_data(FT_PERSISTENT_STORAGE, EPID_DATA_BLOB_FID)) != AE_SUCCESS){ + status = not_initialized; + return ae_ret; + } + status = not_initialized; + return AE_SUCCESS; +} diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h index 16b49e20d6..b0fec667a8 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_epid_blob.h @@ -44,10 +44,11 @@ #include "internal/se_rwlock.h" typedef struct _epid_blob_with_cur_psvn_t{ - uint8_t trusted_epid_blob[HARD_CODED_EPID_BLOB_SIZE]; - psvn_t cur_psvn; + uint8_t trusted_epid_blob[SGX_TRUSTED_EPID_BLOB_SIZE_PAK]; + bk_platform_info_t cur_pi; }epid_blob_with_cur_psvn_t; + #define SGX_EPID_BLOB_SIZE sizeof(epid_blob_with_cur_psvn_t) class EPIDBlob: public Singleton{ @@ -60,6 +61,8 @@ public: ae_error_t read(epid_blob_with_cur_psvn_t& blob); ae_error_t write(const epid_blob_with_cur_psvn_t& blob); ae_error_t get_sgx_gid(uint32_t* pgid);/*get little endian gid from epid data blob*/ + ae_error_t get_extended_epid_group_id(uint32_t* pxeid);//get little endian extended_epid_group_id from epid data blob + ae_error_t remove(void); }; #endif/*_AESM_EPID_BLOB_H_*/ diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp index 0f7ffbc682..fbe8c5afe9 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_http_msg.cpp @@ -59,6 +59,9 @@ static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) network_malloc_info_t* s=reinterpret_cast(stream); uint32_t start=0; if(s->base==NULL){ + if(UINT32_MAX/sizebase = reinterpret_cast(malloc(size*nmemb)); s->size = static_cast(size*nmemb); if(s->base==NULL){ @@ -67,6 +70,9 @@ static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) } }else{ uint32_t newsize = s->size+static_cast(size*nmemb); + if((UINT32_MAX-s->size)/size(malloc(newsize)); if(p == NULL){ free(s->base); @@ -105,6 +111,7 @@ static ae_error_t http_network_init(CURL **curl, const char *url, bool is_ocsp) } if((cc=curl_easy_setopt(*curl, CURLOPT_URL, url_path.c_str()))!=CURLE_OK){ AESM_DBG_ERROR("fail error code %d in set url %s",(int)cc, url_path.c_str()); + curl_easy_cleanup(*curl); return AE_FAILURE; } (void)curl_easy_setopt(*curl, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); @@ -123,44 +130,62 @@ static ae_error_t http_network_send_data(CURL *curl, const char *req_msg, uint32 { AESM_DBG_TRACE("send data method=%d",method); struct curl_slist *headers=NULL; + struct curl_slist *tmp=NULL; + ae_error_t ae_ret = AE_SUCCESS; CURLcode cc=CURLE_OK; + int num_bytes = 0; if(is_ocsp){ - headers = curl_slist_append(headers, "Accept: application/ocsp-response"); - if(headers==NULL){ + tmp = curl_slist_append(headers, "Accept: application/ocsp-response"); + if(tmp==NULL){ AESM_DBG_ERROR("fail in add accept ocsp-response header"); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } - headers = curl_slist_append(headers, "Content-Type: application/ocsp-request"); - if(headers == NULL){ + headers = tmp; + tmp = curl_slist_append(headers, "Content-Type: application/ocsp-request"); + if(tmp == NULL){ AESM_DBG_ERROR("fail in add content type ocsp-request"); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } + headers=tmp; AESM_DBG_TRACE("ocsp request"); } char buf[50]; - sprintf(buf, "Content-Length: %u", (unsigned int)msg_size); - headers = curl_slist_append(headers, buf); - if(headers == NULL){ - AESM_DBG_ERROR("fail to add content-length header"); - return AE_FAILURE; + num_bytes = snprintf(buf,sizeof(buf), "Content-Length: %u", (unsigned int)msg_size); + if(num_bytes<0 || num_bytes>=sizeof(buf)){ + AESM_DBG_ERROR("fail to prepare string Content-Length"); + ae_ret = AE_FAILURE; + goto fini; } + tmp = curl_slist_append(headers, buf); + if(tmp == NULL){ + AESM_DBG_ERROR("fail to add content-length header"); + ae_ret = AE_FAILURE; + goto fini; + } + headers=tmp; if((cc=curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers))!=CURLE_OK){ AESM_DBG_ERROR("fail to set http header:%d",(int)cc); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } if(method == POST){ if((cc=curl_easy_setopt(curl, CURLOPT_POSTFIELDS, req_msg))!=CURLE_OK){ AESM_DBG_ERROR("fail to set POST fields:%d",(int)cc); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } if((cc=curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, msg_size))!=CURLE_OK){ AESM_DBG_ERROR("fail to set POST fields size:%d",(int)cc); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } } if((cc=curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback))!=CURLE_OK){ AESM_DBG_ERROR("Fail to set callback function:%d",(int)cc); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } network_malloc_info_t malloc_info; @@ -168,19 +193,26 @@ static ae_error_t http_network_send_data(CURL *curl, const char *req_msg, uint32 malloc_info.size = 0; if((cc=curl_easy_setopt(curl, CURLOPT_WRITEDATA, reinterpret_cast(&malloc_info)))!=CURLE_OK){ AESM_DBG_ERROR("fail to set write back function parameter:%d",(int)cc); - return AE_FAILURE; + ae_ret = AE_FAILURE; + goto fini; } if((cc=curl_easy_perform(curl))!=CURLE_OK){ if(malloc_info.base){ free(malloc_info.base); } AESM_DBG_ERROR("fail in connect:%d",(int)cc); - return OAL_NETWORK_UNAVAILABLE_ERROR; + ae_ret = OAL_NETWORK_UNAVAILABLE_ERROR; + goto fini; } *resp_msg = malloc_info.base; resp_size = malloc_info.size; AESM_DBG_TRACE("get response size=%d",resp_size); - return AE_SUCCESS; + ae_ret = AE_SUCCESS; +fini: + if(headers!=NULL){ + curl_slist_free_all(headers); + } + return ae_ret; } static void http_network_fini(CURL *curl) diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp index 1395c8438d..0fced729df 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.cpp @@ -30,7 +30,6 @@ */ - #include "aesm_long_lived_thread.h" #include "pve_logic.h" #include "platform_info_logic.h" @@ -40,6 +39,7 @@ #include #include #include +#include "LEClass.h" enum _thread_state { @@ -56,6 +56,7 @@ enum _io_cache_state }; #define MAX_OUTPUT_CACHE 50 +#define THREAD_INFINITE_TICK_COUNT 0xFFFFFFFFFFFFFFFFLL class ThreadStatus; class BaseThreadIOCache; typedef ae_error_t (*long_lived_thread_func_t)(BaseThreadIOCache *cache); @@ -176,18 +177,18 @@ public: } void set_status_finish(BaseThreadIOCache* ioc);//only called at the end of aesm_long_lived_thread_entry void deref(BaseThreadIOCache* iocache); - ae_error_t wait_iocache(BaseThreadIOCache* ioc); + ae_error_t wait_iocache_timeout(BaseThreadIOCache* ioc, uint64_t stop_tick_count); //create thread and wait at most 'timeout' for the thread to be finished // It will first look up whether there is a previous run with same input before starting the thread // we should not delete ioc after calling to this function ae_error_t set_thread_start(BaseThreadIOCache* ioc, BaseThreadIOCache *&out_ioc, uint32_t timeout=THREAD_TIMEOUT); - void stop_thread();//We need wait for thread to be terminated and all thread_handle in list to be closed + void stop_thread(uint64_t stop_milli_second);//We need wait for thread to be terminated and all thread_handle in list to be closed - ~ThreadStatus(){stop_thread();}//ThreadStatus instance should be global object. Otherwise, it is possible that the object is destroyed before a thread waiting for and IOCache got notified and causing exception + ~ThreadStatus(){stop_thread(THREAD_INFINITE_TICK_COUNT);}//ThreadStatus instance should be global object. Otherwise, it is possible that the object is destroyed before a thread waiting for and IOCache got notified and causing exception - ae_error_t wait_for_cur_thread(void); + ae_error_t wait_for_cur_thread(uint64_t millisecond); //function to query whether current thread is idle, //if it is idle, return true and reset clock to current clock value @@ -218,7 +219,7 @@ static ae_error_t aesm_long_lived_thread_entry(aesm_thread_arg_type_t arg) return ae_err; } -void ThreadStatus::stop_thread() +void ThreadStatus::stop_thread(uint64_t stop_tick_count) { //change state to stop thread_mutex.lock(); @@ -237,7 +238,7 @@ void ThreadStatus::stop_thread() BaseThreadIOCache *p=*it; p->ref_count++; thread_mutex.unlock(); - wait_iocache(p); + wait_iocache_timeout(p, stop_tick_count); thread_mutex.lock(); }else{ break; @@ -249,9 +250,15 @@ void ThreadStatus::stop_thread() //Leave memory leak here is OK and all pointer to BaseThreadIOCache will not be released } -ae_error_t ThreadStatus::wait_for_cur_thread(void) +ae_error_t ThreadStatus::wait_for_cur_thread(uint64_t millisecond) { BaseThreadIOCache *ioc=NULL; + uint64_t stop_tick_count; + if(millisecond == AESM_THREAD_INFINITE){ + stop_tick_count = THREAD_INFINITE_TICK_COUNT; + }else{ + stop_tick_count = se_get_tick_count() + (millisecond*se_get_tick_count_freq()+500)/1000; + } thread_mutex.lock(); if(cur_iocache!=NULL){ ioc = cur_iocache; @@ -259,25 +266,34 @@ ae_error_t ThreadStatus::wait_for_cur_thread(void) } thread_mutex.unlock(); if(ioc!=NULL){ - return wait_iocache(ioc); + return wait_iocache_timeout(ioc, stop_tick_count); } return AE_SUCCESS; } -ae_error_t ThreadStatus::wait_iocache(BaseThreadIOCache* ioc) +ae_error_t ThreadStatus::wait_iocache_timeout(BaseThreadIOCache* ioc, uint64_t stop_tick_count) { ae_error_t ae_ret=AE_SUCCESS; + uint64_t cur_tick_count = se_get_tick_count(); + uint64_t freq = se_get_tick_count_freq(); bool need_wait=false; aesm_thread_t handle=NULL; thread_mutex.lock(); - if(ioc->thread_handle!=NULL){ + if(ioc->thread_handle!=NULL&&(cur_tick_countref_count); need_wait = true; handle = ioc->thread_handle; } thread_mutex.unlock(); if(need_wait){ - ae_ret= aesm_wait_thread(handle, &ae_ret, AESM_THREAD_INFINITE); + unsigned long diff_time; + if(stop_tick_count == THREAD_INFINITE_TICK_COUNT){ + diff_time = AESM_THREAD_INFINITE; + }else{ + double wtime=(double)(stop_tick_count-cur_tick_count)*1000.0/(double)freq; + diff_time = (unsigned long)(wtime+0.5); + } + ae_ret= aesm_wait_thread(handle, &ae_ret, diff_time); } deref(ioc); return ae_ret; @@ -384,10 +400,10 @@ static time_t get_timeout_via_ae_error(ae_error_t ae) case PVE_REVOKED_ERROR: case PVE_MSG_ERROR: case PVE_PERFORMANCE_REKEY_NOT_SUPPORTED: - case PSW_UPDATED_REQUIRED: + case PSW_UPDATE_REQUIRED: return cur+TIMEOUT_LONG_TIME; default: - return cur+TIMEOUT_FOR_A_WHILE;//not retry too quickly for unknown error + return cur+TIMEOUT_SHORT_TIME;//retry quicky for unknown error } } @@ -432,6 +448,9 @@ bool ThreadStatus::query_status_and_reset_clock(void) static ThreadStatus epid_thread; +static ThreadStatus white_list_thread; + + class EpidProvIOCache:public BaseThreadIOCache{ bool performance_rekey;//input protected: @@ -449,17 +468,40 @@ public: } }; +class WhiteListIOCache :public BaseThreadIOCache{ +//no input to be cached for white list pulling +protected: + WhiteListIOCache(void){ + } + virtual ae_error_t entry(void); + virtual ThreadStatus& get_thread(); + friend ae_error_t start_white_list_thread(unsigned long timeout); +public: + virtual bool operator==(const BaseThreadIOCache& oc)const{ + const WhiteListIOCache *p = dynamic_cast(&oc); + if (p == NULL) return false; + return true; + } +}; ThreadStatus& EpidProvIOCache::get_thread() { return epid_thread; } +ThreadStatus& WhiteListIOCache::get_thread() +{ + return white_list_thread; +} ae_error_t EpidProvIOCache::entry() { return ae_ret = PvEAESMLogic::epid_provision_thread_func(performance_rekey); } +ae_error_t WhiteListIOCache::entry() +{ + return ae_ret = CLEClass::update_white_list_by_url(); +} //start implementation of external functions @@ -494,17 +536,25 @@ ae_error_t start_epid_provision_thread(bool performance_rekey, unsigned long tim FINI_THREAD() } +ae_error_t start_white_list_thread(unsigned long timeout) +{ + INIT_THREAD(WhiteListIOCache, timeout, ()) + FINI_THREAD() +} bool query_pve_thread_status(void) { return epid_thread.query_status_and_reset_clock(); } - -ae_error_t wait_pve_thread(void) +ae_error_t wait_pve_thread(uint64_t time_out_milliseconds) { - return epid_thread.wait_for_cur_thread(); + return epid_thread.wait_for_cur_thread(time_out_milliseconds); } -void stop_all_long_lived_threads(void) +void stop_all_long_lived_threads(uint64_t time_out_milliseconds) { - epid_thread.stop_thread(); + uint64_t freq = se_get_tick_count_freq(); + uint64_t stop_tick_count = se_get_tick_count()+(time_out_milliseconds*freq+500)/1000; + epid_thread.stop_thread(stop_tick_count); + white_list_thread.stop_thread(stop_tick_count); } + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h index 1685b80078..32006928ac 100644 --- a/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_long_lived_thread.h @@ -33,9 +33,11 @@ #define _AESM_LONG_LIVED_THREAD_H_ #include "aesm_logic.h" +#define AESM_STOP_TIMEOUT (60*1000) /*waiting for 1 minute at most*/ extern ae_error_t start_epid_provision_thread(bool performance_rekey, unsigned long timeout=THREAD_TIMEOUT); +extern ae_error_t start_white_list_thread(unsigned long timeout=THREAD_TIMEOUT); extern bool query_pve_thread_status(void);/*return true if idle and reset clock for thread*/ -extern ae_error_t wait_pve_thread(void); -extern void stop_all_long_lived_threads(void); +extern ae_error_t wait_pve_thread(uint64_t time_out_milliseconds=AESM_THREAD_INFINITE); +extern void stop_all_long_lived_threads(uint64_t time_out_milliseconds=AESM_STOP_TIMEOUT); #endif diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.cpp b/psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.cpp new file mode 100644 index 0000000000..c596f493e3 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include "aesm_xegd_blob.h" +#include "endpoint_select_info.h" +#include "internal/se_memcpy.h" +#include "oal/oal.h" +#include "byte_order.h" +#include "aesm_epid_blob.h" + +ae_error_t XEGDBlob::verify_xegd_by_xgid(uint32_t xgid) +{ + extended_epid_group_blob_t blob; + if (xgid == DEFAULT_EGID){//always return success for default xgid + return AE_SUCCESS; + } + uint32_t data_size = sizeof(blob); + ae_error_t ae_ret = aesm_read_data(FT_PERSISTENT_STORAGE, EXTENDED_EPID_GROUP_BLOB_INFO_FID, reinterpret_cast(&blob), &data_size, xgid); + if (AE_SUCCESS != ae_ret){ + return ae_ret; + } + if (data_size != sizeof(blob)){ + return OAL_CONFIG_FILE_ERROR; + } + ae_ret = verify(blob); + return ae_ret; +} + +ae_error_t XEGDBlob::read(extended_epid_group_blob_t& blob) +{ + ae_error_t ae_ret = AE_FAILURE; + if(status == not_initialized){ + uint32_t data_size = sizeof(blob_cache); + if ((ae_ret = aesm_read_data(FT_PERSISTENT_STORAGE, EXTENDED_EPID_GROUP_BLOB_INFO_FID, reinterpret_cast(&blob_cache), &data_size, AESMLogic::get_active_extended_epid_group_id())) != AE_SUCCESS){ + goto CLEANUP_READ_FILE; + } + if (data_size != sizeof(blob_cache)){ + ae_ret = OAL_CONFIG_FILE_ERROR; + goto CLEANUP_READ_FILE; + } + ae_ret = verify(blob_cache); + if (AE_SUCCESS != ae_ret){ + AESM_DBG_ERROR("signature error in XEGD file"); + goto CLEANUP_READ_FILE; + } + status = update_to_date; +CLEANUP_READ_FILE: + if (status != update_to_date){ + if (AESMLogic::get_active_extended_epid_group_id() == DEFAULT_EGID){ + memset(&blob_cache, 0, sizeof(blob_cache));//indicate other part to use default data + status = update_to_date; + } + else{ + status = not_available;//xegd blob lost + } + } + } + if(status == update_to_date){ + if(memcpy_s(&blob, sizeof(blob), &blob_cache, sizeof(blob_cache))!=0){ + status = not_available; //invalid + ae_ret = AE_FAILURE; + }else{ + ae_ret = AE_SUCCESS; + } + } + return ae_ret; +} + +ae_error_t aesm_verify_xegb(const extended_epid_group_blob_t& signed_xegb); + +ae_error_t XEGDBlob::verify(const extended_epid_group_blob_t& signed_xegb) +{ + ae_error_t aesm_result = aesm_verify_xegb(signed_xegb); + if (AE_SUCCESS != aesm_result) + { + AESM_DBG_ERROR("Extended EPID Group Blob Signature verifcation not passed:%d", aesm_result); + return aesm_result; + } + return aesm_result; +} + diff --git a/psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.h b/psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.h new file mode 100644 index 0000000000..8f206d7402 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/aesm_xegd_blob.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once +/*File to declare class for extended_epid_group_blob*/ +#include "se_types.h" +#include "sgx_tseal.h" +#include "oal/oal.h" +#include "AEClass.h" +#include "epid_pve_type.h" +#include "assert.h" +#include "aeerror.h" +#include "se_thread.h" +#include "provision_msg.h" +#include "internal/se_rwlock.h" +#include "aesm_error.h" + +class XEGDBlob: public Singleton{ + CLASS_UNCOPYABLE(XEGDBlob) + extended_epid_group_blob_t blob_cache; + friend class Singleton; + enum XEGDBlobStatus {not_initialized=0, update_to_date=1, not_available=2} status; + XEGDBlob(){ memset(&blob_cache, 0, sizeof(blob_cache)); status = not_initialized; } + static ae_error_t verify(const extended_epid_group_blob_t& signed_xegb); +public: + ae_error_t read(extended_epid_group_blob_t& blob); + static ae_error_t verify_xegd_by_xgid(uint32_t xgid); +}; + diff --git a/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp index 0c0f8754cd..607a6e0420 100644 --- a/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.cpp @@ -38,8 +38,9 @@ #include "sgx_tcrypto.h" #include "ippcp.h" #include "ippcore.h" +#include "aesm_xegd_blob.h" +#include "peksk_pub.hh" #include "sgx_read_rand.h" -#include "se_wrapper.h" #include @@ -89,9 +90,98 @@ static ae_error_t ipp_error_to_ae_error(IppStatus ipp_status) else return AE_FAILURE;//unknown or unexpected ipp error } -ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek); -IppStatus get_provision_server_rsa_pub_key_in_ipp_format(const signed_pek_t& pek, IppsRSAPublicKeyState **rsa_pub_key); +static bool is_valid_server_url_infos(const aesm_server_url_infos_t& server_urls) +{ + if(server_urls.aesm_data_type!=AESM_DATA_SERVER_URL_INFOS|| + server_urls.aesm_data_version!=AESM_DATA_SERVER_URL_VERSION&& + server_urls.aesm_data_version != AESM_DATA_SERVER_URL_VERSION_1)//still support version 1 since the first 3 urls in version 1 is still same as the urls in version 2 + return false; + if(strnlen(server_urls.endpoint_url,MAX_PATH)>=MAX_PATH) + return false; + if (strnlen(server_urls.pse_rl_url, MAX_PATH) >= MAX_PATH) + return false; + if (strnlen(server_urls.pse_ocsp_url, MAX_PATH) >= MAX_PATH) + return false; + return true; +} +ae_error_t EndpointSelectionInfo::verify_file_by_xgid(uint32_t xgid) +{ + if (xgid == DEFAULT_EGID){//always return true for DEFAULT_EGID + return AE_SUCCESS; + } + aesm_server_url_infos_t urls; + uint32_t server_urls_size = sizeof(urls); + ae_error_t ae_err = aesm_read_data(FT_PERSISTENT_STORAGE, AESM_SERVER_URL_FID, reinterpret_cast(&urls), &server_urls_size, xgid); + if (AE_SUCCESS != ae_err || + server_urls_size != sizeof(urls) || + !is_valid_server_url_infos(urls)){ + return OAL_CONFIG_FILE_ERROR; + } + return AE_SUCCESS; +} + +//Function to read urls from configure files +ae_error_t EndpointSelectionInfo::get_url_info() +{ + ae_error_t ae_err=AE_SUCCESS; + uint32_t server_urls_size = sizeof(_server_urls); + + ae_err = aesm_read_data(FT_PERSISTENT_STORAGE, AESM_SERVER_URL_FID, reinterpret_cast(&_server_urls), &server_urls_size, AESMLogic::get_active_extended_epid_group_id()); + + if(AE_SUCCESS != ae_err || + server_urls_size != sizeof(_server_urls)|| + !is_valid_server_url_infos(_server_urls)){ //If fail to read or data format error, use default value + _is_server_url_valid = false; + if(AE_SUCCESS == ae_err){//File available but format error, report ERROR LOG + AESM_LOG_WARN("Server URL Blob file format error"); + AESM_DBG_INFO("fail to read server url info from persistent storage, error code (%d), size %d, expected size %d", + ae_err, server_urls_size, sizeof(_server_urls)); + ae_err = OAL_CONFIG_FILE_ERROR; + }else{ + AESM_DBG_INFO("server url blob file not available in persistent storage"); + } + if (AESMLogic::get_active_extended_epid_group_id() == DEFAULT_EGID){ + if (strcpy_s(_server_urls.endpoint_url, MAX_PATH, DEFAULT_URL) != 0) + return AE_FAILURE; + if (strcpy_s(_server_urls.pse_rl_url, MAX_PATH, DEFAULT_PSE_RL_URL) != 0) + return AE_FAILURE; + if (strcpy_s(_server_urls.pse_ocsp_url, MAX_PATH, DEFAULT_PSE_OCSP_URL) != 0) + return AE_FAILURE; + _is_server_url_valid = true; + return AE_SUCCESS; + } + else{ + return ae_err; + } + } + + _is_server_url_valid = true; + return AE_SUCCESS; +} + +ae_error_t EndpointSelectionInfo::get_url_info(aesm_server_url_infos_t& server_url) +{ + AESMLogicLock lock(_es_lock); + if (!_is_server_url_valid){ + (void)get_url_info(); + } + if (_is_server_url_valid) + { + if (memcpy_s(&server_url, sizeof(server_url), &_server_urls, sizeof(_server_urls)) != 0){ + return AE_FAILURE; + } + } + else + { + return AE_FAILURE; + } + return AE_SUCCESS; + +} + +ae_error_t aesm_check_pek_signature(const signed_pek_t& signed_pek, const extended_epid_group_blob_t& xegb); +IppStatus get_provision_server_rsa_pub_key_in_ipp_format(const signed_pek_t& pek, IppsRSAPublicKeyState **rsa_pub_key); //The function is to verify the PEK ECDSA Signature and RSA Signature for ES Msg2 // When PvE uses PEK, it will re-check the ECDSA Signature //The function will only be called after ES protocol is completed. But it will not be called when reading data back from persitent storage @@ -113,14 +203,19 @@ ae_error_t EndpointSelectionInfo::verify_signature(const endpoint_selection_info IppStatus ipp_status = ippStsNoErr; uint8_t msg_buf[XID_SIZE + sizeof(ttl) + MAX_PATH]; uint32_t buf_size = 0; + extended_epid_group_blob_t xegb={0}; - ae_err = aesm_check_pek_signature(es_info.pek); + if (AE_SUCCESS != (ae_err=XEGDBlob::instance().read(xegb))){ + return ae_err; + } + + ae_err = aesm_check_pek_signature(es_info.pek, xegb); if(AE_SUCCESS != ae_err){ AESM_DBG_ERROR("PEK Signature verifcation not passed:%d",ae_err); goto ret_point; } AESM_DBG_INFO("PEK signature verified successfully"); - buf_size = XID_SIZE +static_cast(sizeof(ttl) + strnlen_s(es_info.provision_url, MAX_PATH)); + buf_size = XID_SIZE +static_cast(sizeof(ttl) + strnlen(es_info.provision_url, MAX_PATH)); if(0!=memcpy_s(msg_buf,sizeof(msg_buf), xid, XID_SIZE)|| 0!=memcpy_s(msg_buf+XID_SIZE, sizeof(ttl) + MAX_PATH, &ttl, sizeof(ttl))|| 0!=memcpy_s(msg_buf+XID_SIZE+sizeof(ttl), MAX_PATH, es_info.provision_url, buf_size-XID_SIZE-sizeof(ttl))){ @@ -192,9 +287,12 @@ ae_error_t EndpointSelectionInfo::start_protocol(endpoint_selection_infos_t& es_ AESM_DBG_DEBUG("enter fun"); memset(&es_info, 0, sizeof(es_info)); memset(&enclave_output, 0, sizeof(enclave_output)); - if(!_is_server_url_loaded){ - (void) read_aesm_config(_server_urls); - _is_server_url_loaded = true; + if(!_is_server_url_valid){ + ae_ret = get_url_info(); + if(AE_SUCCESS != ae_ret){//It is not likely happen, only fail when memcpy_s failed + AESM_DBG_ERROR("Fail to initialize server URL information"); + goto final_point; + } } do{ @@ -277,14 +375,42 @@ final_point: return ae_ret; } +const char *EndpointSelectionInfo::get_server_url(aesm_network_server_enum_type_t type) +{ + AESMLogicLock lock(_es_lock); + if (type == SGX_WHITE_LIST_FILE){ + if (!_is_white_list_url_valid){ + (void)read_aesm_config(_config_urls); + _is_white_list_url_valid = true; + } + return _config_urls.white_list_url; + } + if(!_is_server_url_valid){ + (void)get_url_info(); + } + if(!_is_server_url_valid){ + return NULL; + } + switch(type){ + case ENDPOINT_SELECTION: + return _server_urls.endpoint_url; + case REVOCATION_LIST_RETRIEVAL: + return _server_urls.pse_rl_url; + case PSE_OCSP: + return _server_urls.pse_ocsp_url; + default://invalid case + assert(0); + return NULL; + } +} + void EndpointSelectionInfo::get_proxy(uint32_t& proxy_type, char proxy_url[MAX_PATH]) { AESMLogicLock lock(_es_lock); - if(!_is_server_url_loaded){ - (void)read_aesm_config(_server_urls); - _is_server_url_loaded=true; + if(!_is_white_list_url_valid){ + (void)read_aesm_config(_config_urls); + _is_white_list_url_valid=true; } - proxy_type = _server_urls.proxy_type; - strcpy(proxy_url, _server_urls.aesm_proxy); + proxy_type = _config_urls.proxy_type; + strcpy(proxy_url, _config_urls.aesm_proxy); } - diff --git a/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h index 39c38a0ebb..7b37c55116 100644 --- a/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h +++ b/psw/ae/aesm_service/source/aesm/extension/endpoint_select_info.h @@ -34,21 +34,33 @@ #include "se_types.h" #include "sgx_tseal.h" #include "aeerror.h" -#include "tlv_common.h" #include "se_thread.h" #include "internal/se_rwlock.h" #include "oal/oal.h" #include "se_wrapper.h" #include #include +#include "tlv_common.h" #include "AEClass.h" #include "aesm_logic.h" +#define AESM_DATA_SERVER_URL_INFOS 'A' #define AESM_DATA_ENDPOINT_SELECTION_INFOS 'B' +#define AESM_DATA_SERVER_URL_VERSION_1 1 +#define AESM_DATA_SERVER_URL_VERSION 2 #define AESM_DATA_ENDPOINT_SELECTION_VERSION 1 #pragma pack(1) #include "aesm_config.h" +/*Struct for PCE based url information which will be installed by PSW Installer*/ +typedef struct _aesm_server_url_infos_t{ + uint8_t aesm_data_type; + uint8_t aesm_data_version; + char endpoint_url[MAX_PATH]; /*URL for endpoint selection protocol server*/ + char pse_rl_url[MAX_PATH]; /*URL to retrieve PSE rovocation List*/ + char pse_ocsp_url[MAX_PATH]; +}aesm_server_url_infos_t; + /*Struct for data to save endpoint selection protocol result into persistent data storage*/ typedef struct _endpoint_selection_infos_t{ uint8_t aesm_data_type; @@ -61,26 +73,32 @@ typedef struct _endpoint_selection_infos_t{ /*An interface to provide the endpoint selection protocol and also provide some URLs (result of ES protocol or some static url) *Singleton class used to provide a singleton instance in memory and lock used so that it could be shared by PvE/PSEPR *EndpointSelectionInfo::instance().start_protocol(...) could be used to get endpoint selection result - * It will restart the ES protocol to get updated data. If the protocol fails, it may resue existing endpoint selection protocol result in persistent storage + * It will restart the ES protocol to get updated data. If the protocol fails, it may reuse existing endpoint selection protocol result in persistent storage */ class EndpointSelectionInfo: public Singleton{ CLASS_UNCOPYABLE(EndpointSelectionInfo); friend class Singleton; private: - AESMLogicMutex _es_lock; /*lock used since the data will be accessed by two different components: PSEPR and PVE*/ - aesm_config_infos_t _server_urls; /*some readonly urls */ - bool _is_server_url_valid; /*Set it to true when field _server_urls is valid*/ - bool _is_server_url_loaded;/*Set it to true after trying to read _server_urls from persistent storage. If _is_server_url_valid is false but this field is true, it means there're problem in persistent storage access*/ + AESMLogicMutex _es_lock; /*lock used since the data will be accessed by two different components: PSEPR and PVE*/ + aesm_config_infos_t _config_urls; /*some readonly urls not related to XEGD*/ + aesm_server_url_infos_t _server_urls; /*XEGD based readonly url*/ + bool _is_server_url_valid; /*Set it to true when field _server_urls is valid*/ + bool _is_white_list_url_valid; /*Set it to true after reading _config_urls*/ static ae_error_t read_pek(endpoint_selection_infos_t& es_info); /*read _es_info from persistent storage*/ static ae_error_t write_pek(const endpoint_selection_infos_t& es_info); /*save _es_info to persistent storage*/ ae_error_t verify_signature(const endpoint_selection_infos_t& es_info, uint8_t xid[XID_SIZE], uint8_t rsa_signature[PVE_RSA_KEY_BYTES], uint16_t ttl); /*verify rsa signature in ES protocol result*/ public: EndpointSelectionInfo(){ memset(&_server_urls, 0, sizeof(_server_urls)); - _is_server_url_loaded=false; + memset(&_config_urls, 0, sizeof(_config_urls)); + _is_white_list_url_valid=false; _is_server_url_valid=false; } public: + static ae_error_t verify_file_by_xgid(uint32_t xgid); + ae_error_t get_url_info(); + ae_error_t get_url_info(aesm_server_url_infos_t& server_url); + const char *get_server_url(aesm_network_server_enum_type_t type); void get_proxy(uint32_t& proxy_type, char proxy_url[MAX_PATH]); /*Function to get result of Endpoint Selection Protocol from Backend Server*/ ae_error_t start_protocol(endpoint_selection_infos_t& es_info); diff --git a/psw/ae/aesm_service/source/aesm/extension/platform_info_facility.cpp b/psw/ae/aesm_service/source/aesm/extension/platform_info_facility.cpp new file mode 100644 index 0000000000..2fd994bd54 --- /dev/null +++ b/psw/ae/aesm_service/source/aesm/extension/platform_info_facility.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "platform_info_logic.h" +#include "byte_order.h" +#include +#include "sgx_profile.h" + +ae_error_t PlatformInfoLogic::get_sgx_epid_group_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint8_t* pflags) +{ + ae_error_t retval = AE_SUCCESS; + if (NULL != pflags && NULL != p_platform_info_blob && p_platform_info_blob->valid_info_blob) { + *pflags = p_platform_info_blob->platform_info_blob.sgx_epid_group_flags; + } + else { + retval = AE_INVALID_PARAMETER; + } + return retval; +} + +ae_error_t PlatformInfoLogic::get_sgx_tcb_evaluation_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint16_t* pflags) +{ + ae_error_t retval = AE_SUCCESS; + if (NULL != pflags && NULL != p_platform_info_blob && p_platform_info_blob->valid_info_blob) { + const uint16_t* p = reinterpret_cast(p_platform_info_blob->platform_info_blob.sgx_tcb_evaluation_flags); + *pflags = lv_ntohs(*p); + } + else { + retval = AE_INVALID_PARAMETER; + } + return retval; +} + +bool PlatformInfoLogic::sgx_gid_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint8_t flags = 0; + bool retVal = false; + ae_error_t getflagsError = get_sgx_epid_group_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = (0 != (QE_EPID_GROUP_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + + return retVal; +} + +bool PlatformInfoLogic::performance_rekey_available(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + // + // return whether platform info blob says PR is available + // the group associated with PR that's returned corresponds to the group + // that we'll be in **after** executing PR + // + bool retVal = false; + uint8_t flags; + ae_error_t getflagsError = get_sgx_epid_group_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = static_cast(flags & PERF_REKEY_FOR_QE_EPID_GROUP_AVAILABLE); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + return retVal; +} +bool PlatformInfoLogic::qe_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint16_t flags = 0; + bool retVal = true; + ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = (0 != (QUOTE_ISVSVN_QE_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + return retVal; +} + +bool PlatformInfoLogic::pce_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint16_t flags = 0; + bool retVal = true; + ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = (0 != (QUOTE_ISVSVN_PCE_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + return retVal; +} + +bool PlatformInfoLogic::cpu_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + uint16_t flags = 0; + bool retVal = false; + ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); + if (AE_SUCCESS == getflagsError) { + retVal = (0 != (QUOTE_CPUSVN_OUT_OF_DATE & flags)); + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); + + return retVal; +} +ae_error_t PlatformInfoLogic::need_epid_provisioning(const platform_info_blob_wrapper_t* p_platform_info_blob) +{ + ae_error_t status = AESM_NEP_DONT_NEED_EPID_PROVISIONING; + if (sgx_gid_out_of_date(p_platform_info_blob) && + !qe_svn_out_of_date(p_platform_info_blob) && + !cpu_svn_out_of_date(p_platform_info_blob) && + !pce_svn_out_of_date(p_platform_info_blob)) + { + status = AESM_NEP_DONT_NEED_UPDATE_PVEQE; // don't need update, but need epid provisioning + } + else if (!sgx_gid_out_of_date(p_platform_info_blob) && performance_rekey_available(p_platform_info_blob)) + { + status = AESM_NEP_PERFORMANCE_REKEY; + } + SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", status, status); + return status; +} + diff --git a/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp index 40ed197950..4fb783c37e 100644 --- a/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.cpp @@ -29,75 +29,19 @@ * */ - #include "util.h" #include "platform_info_logic.h" #include "sgx_quote.h" #include "aesm_encode.h" #include "pve_logic.h" #include "aesm_logic.h" -#include -#include "sgx_profile.h" #include "le2be_macros.h" #include "pibsk_pub.hh" #include "sgx_sha256_128.h" +#include +#include "sgx_profile.h" #include "aesm_long_lived_thread.h" -ae_error_t PlatformInfoLogic::get_sgx_epid_group_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint8_t* pflags) -{ - ae_error_t retval = AE_SUCCESS; - if (NULL != pflags && NULL != p_platform_info_blob && p_platform_info_blob->valid_info_blob){ - *pflags = p_platform_info_blob->platform_info_blob.sgx_epid_group_flags; - } - else { - retval = AE_INVALID_PARAMETER; - } - return retval; -} - -ae_error_t PlatformInfoLogic::get_sgx_tcb_evaluation_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint16_t* pflags) -{ - ae_error_t retval = AE_SUCCESS; - if (NULL != pflags && NULL != p_platform_info_blob && p_platform_info_blob->valid_info_blob) { - const uint16_t* p = reinterpret_cast(p_platform_info_blob->platform_info_blob.sgx_tcb_evaluation_flags); - *pflags = lv_ntohs(*p); - } - else { - retval = AE_INVALID_PARAMETER; - } - return retval; -} - -bool PlatformInfoLogic::sgx_gid_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) -{ - uint8_t flags = 0; - bool retVal = false; - ae_error_t getflagsError = get_sgx_epid_group_flags(p_platform_info_blob, &flags); - if (AE_SUCCESS == getflagsError) { - retVal = (0 != (QE_EPID_GROUP_OUT_OF_DATE & flags)); - } - SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); - - return retVal; -} - -ae_error_t PlatformInfoLogic::need_epid_provisioning(const platform_info_blob_wrapper_t* p_platform_info_blob) -{ - ae_error_t status = AESM_NEP_DONT_NEED_EPID_PROVISIONING; - if (sgx_gid_out_of_date(p_platform_info_blob) && - !qe_svn_out_of_date(p_platform_info_blob) && - !cpu_svn_out_of_date(p_platform_info_blob)) - { - status = AESM_NEP_DONT_NEED_UPDATE_PVEQE; // don't need update, but need epid provisioning - } - else if (!sgx_gid_out_of_date(p_platform_info_blob) && performance_rekey_available(p_platform_info_blob)) - { - status = AESM_NEP_PERFORMANCE_REKEY; - } - SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", status, status); - return status; -} - ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper) { @@ -116,8 +60,8 @@ ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper) sgx_ec256_signature_t signature; sgx_status_t sgx_status; - //BREAK_IF_TRUE((sizeof(publicKey) != sizeof(s_pib_pub_key_big_endian)), ae_err, AE_FAILURE); - //BREAK_IF_TRUE((sizeof(signature) != sizeof(piBlobWrapper.platform_info_blob.signature)), ae_err, AE_FAILURE); + se_static_assert(sizeof(publicKey) == sizeof(s_pib_pub_key_big_endian)); + se_static_assert(sizeof(signature) == sizeof(piBlobWrapper.platform_info_blob.signature)); // convert the public key to little endian if(0!=memcpy_s(&publicKey, sizeof(publicKey), s_pib_pub_key_big_endian, sizeof(s_pib_pub_key_big_endian))){ @@ -164,6 +108,7 @@ aesm_error_t PlatformInfoLogic::report_attestation_status( uint32_t attestation_status, uint8_t* update_info, uint32_t update_info_size) { + AESM_DBG_TRACE("enter fun"); // // we don't do anything without platform info @@ -174,6 +119,7 @@ aesm_error_t PlatformInfoLogic::report_attestation_status( platform_info_blob_wrapper_t pibw; + // // presence of platform info is conditional, on whether we're up to date // if we're up to date, no platform info and no need for update info @@ -200,6 +146,17 @@ aesm_error_t PlatformInfoLogic::report_attestation_status( AESM_DBG_ERROR("pib verify signature failed"); return AESM_PLATFORM_INFO_BLOB_INVALID_SIG; } + if(pibw.platform_info_blob.xeid != AESMLogic::get_active_extended_epid_group_id()){ + return AESM_UNEXPECTED_ERROR; + } + uint32_t gid_mt_result = AESMLogic::is_gid_matching_result_in_epid_blob( pibw.platform_info_blob.gid); + if(AESMLogic::GIDMT_UNMATCHED == gid_mt_result|| + AESMLogic::GIDMT_UNEXPECTED_ERROR == gid_mt_result){ + return AESM_UNEXPECTED_ERROR; + } + else if (AESMLogic::GIDMT_NOT_AVAILABLE == gid_mt_result) { + return AESM_EPIDBLOB_ERROR; + } ae_error_t nepStatus = need_epid_provisioning(&pibw); AESM_DBG_TRACE("need_epid_provisioning return %d",nepStatus); @@ -220,7 +177,8 @@ aesm_error_t PlatformInfoLogic::report_attestation_status( status = PvEAESMLogic::provision(perfRekey, THREAD_TIMEOUT); if (AESM_BUSY == status || //thread timeout AESM_PROXY_SETTING_ASSIST == status || //uae service need to set up proxy info and retry - AESM_UPDATE_AVAILABLE == status) //PSW need be updated + AESM_UPDATE_AVAILABLE == status || //PSW need be updated + AESM_OUT_OF_EPC == status) // out of EPC { return status;//We should return to uae serivce directly } @@ -247,7 +205,8 @@ aesm_error_t PlatformInfoLogic::report_attestation_status( status = PvEAESMLogic::provision(perfRekey, THREAD_TIMEOUT); if (AESM_BUSY == status ||//thread timeout AESM_PROXY_SETTING_ASSIST == status ||//uae service need to set up proxy info and retry - AESM_UPDATE_AVAILABLE == status) + AESM_UPDATE_AVAILABLE == status || + AESM_OUT_OF_EPC == status) { return status;//We should return to uae serivce directly } @@ -278,68 +237,28 @@ aesm_error_t PlatformInfoLogic::report_attestation_status( memset(p_update_info, 0, sizeof(*p_update_info)); // - // here, we treat values that get reported live - cpusvn, qe.isvsvn + // here, we treat values that get reported live - cpusvn, qe.isvsvn, // in normal flow, live values reported to attestation server will be the same as current values now so // we just look at out-of-date bits corresponding to these values. // the alternative would be to compare current with latest as reported by IAS. this // isn't an option for cpusvn since what we get from IAS is equivalent cpusvn. // + + if (cpu_svn_out_of_date(&pibw)) { p_update_info->ucodeUpdate = 1; status = AESM_UPDATE_AVAILABLE; } - if (qe_svn_out_of_date(&pibw)) + if (qe_svn_out_of_date(&pibw) || + pce_svn_out_of_date(&pibw) + ) { p_update_info->pswUpdate = 1; status = AESM_UPDATE_AVAILABLE; } - } return status; } -bool PlatformInfoLogic::cpu_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) -{ - uint16_t flags = 0; - bool retVal = false; - ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); - if (AE_SUCCESS == getflagsError) { - retVal = ( 0 !=(QUOTE_CPUSVN_OUT_OF_DATE & flags)); - } - SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); - return retVal; -} - -bool PlatformInfoLogic::qe_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob) -{ - uint16_t flags = 0; - // - // default to true since easy to update QE/PvE - // - bool retVal = true; - ae_error_t getflagsError = get_sgx_tcb_evaluation_flags(p_platform_info_blob, &flags); - if (AE_SUCCESS == getflagsError) { - retVal = ( 0 !=(QUOTE_ISVSVN_QE_OUT_OF_DATE & flags)); - } - SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); - return retVal; -} - -bool PlatformInfoLogic::performance_rekey_available(const platform_info_blob_wrapper_t* p_platform_info_blob) -{ - // - // return whether platform info blob says PR is available - // the group associated with PR that's returned corresponds to the group - // that we'll be in **after** executing PR - // - bool retVal = false; - uint8_t flags; - ae_error_t getflagsError = get_sgx_epid_group_flags(p_platform_info_blob, &flags); - if (AE_SUCCESS == getflagsError) { - retVal = static_cast(flags & PERF_REKEY_FOR_QE_EPID_GROUP_AVAILABLE); - } - SGX_DBGPRINT_ONE_STRING_TWO_INTS_CREATE_SESSION(__FUNCTION__" returning ", retVal, retVal); - return retVal; -} diff --git a/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h index d77a713496..7a307807f9 100644 --- a/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h +++ b/psw/ae/aesm_service/source/aesm/extension/platform_info_logic.h @@ -46,15 +46,12 @@ public: uint8_t* platform_info, uint32_t platform_info_size, uint32_t attestation_status, uint8_t* update_info, uint32_t update_info_size); - - static ae_error_t need_epid_provisioning(const platform_info_blob_wrapper_t* p_platform_info_blob); - static bool sgx_gid_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); static bool cpu_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); static bool qe_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); + static bool pce_svn_out_of_date(const platform_info_blob_wrapper_t* p_platform_info_blob); static bool performance_rekey_available(const platform_info_blob_wrapper_t* p_platform_info_blob); - private: static ae_error_t get_sgx_epid_group_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint8_t* flags); static ae_error_t get_sgx_tcb_evaluation_flags(const platform_info_blob_wrapper_t* p_platform_info_blob, uint16_t* flags); diff --git a/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp b/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp index 301026fb57..e15661787b 100644 --- a/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp +++ b/psw/ae/aesm_service/source/aesm/extension/type_length_value.cpp @@ -41,38 +41,6 @@ #include "oal/oal.h" #include -#ifdef DBG_LOG -#define CASE_ENUM_RET_STRING(x) case x: return #x; -const char *get_tlv_enum_type_t_string(uint8_t type){ - switch(type){ - CASE_ENUM_RET_STRING(TLV_CIPHER_TEXT) - CASE_ENUM_RET_STRING(TLV_BLOCK_CIPHER_TEXT) - CASE_ENUM_RET_STRING(TLV_BLOCK_CIPHER_INFO) - CASE_ENUM_RET_STRING(TLV_MESSAGE_AUTHENTICATION_CODE) - CASE_ENUM_RET_STRING(TLV_NONCE) - CASE_ENUM_RET_STRING(TLV_EPID_GID) - CASE_ENUM_RET_STRING(TLV_EPID_SIG_RL) - CASE_ENUM_RET_STRING(TLV_EPID_GROUP_CERT) - CASE_ENUM_RET_STRING(TLV_DEVICE_ID) - CASE_ENUM_RET_STRING(TLV_PS_ID) - CASE_ENUM_RET_STRING(TLV_EPID_JOIN_PROOF) - CASE_ENUM_RET_STRING(TLV_EPID_SIG) - CASE_ENUM_RET_STRING(TLV_EPID_MEMBERSHIP_CREDENTIAL) - CASE_ENUM_RET_STRING(TLV_EPID_PSVN) - CASE_ENUM_RET_STRING(TLV_QUOTE) - CASE_ENUM_RET_STRING(TLV_X509_CERT_TLV) - CASE_ENUM_RET_STRING(TLV_X509_CSR_TLV) - CASE_ENUM_RET_STRING(TLV_ES_SELECTOR) - CASE_ENUM_RET_STRING(TLV_ES_INFORMATION) - CASE_ENUM_RET_STRING(TLV_FLAGS) - CASE_ENUM_RET_STRING(TLV_QUOTE_SIG) - CASE_ENUM_RET_STRING(TLV_PEK) - CASE_ENUM_RET_STRING(TLV_SIGNATURE) - default: - return "Unknown TLV"; - } -} -#endif //Function to write tlv header into a msg according to tlv info, the input buffer size should be at least MAX_TLV_HEADER_SIZE static tlv_status_t write_tlv_header(uint8_t *msg, const tlv_info_t *info) { @@ -228,19 +196,18 @@ tlv_msg_t block_cipher_tlv_get_encrypted_text(const tlv_info_t& info) return tlv_msg; } - -fmsp_t *device_id_tlv_get_fmsp(const tlv_info_t& info) +fmsp_t *platform_info_tlv_get_fmsp(const tlv_info_t& info) { - assert(info.type == TLV_DEVICE_ID && info.size == DEVICE_ID_TLV_PAYLOAD_SIZE()); + assert(info.type == TLV_PLATFORM_INFO && info.size == PLATFORM_INFO_TLV_PAYLOAD_SIZE()); assert(info.payload!=NULL); - return reinterpret_cast(info.payload+sizeof(psvn_t)+sizeof(ppid_t)); + return reinterpret_cast(info.payload+sizeof(psvn_t)+sizeof(sgx_isv_svn_t)+sizeof(CUR_PCE_ID)); } -psvn_t *device_id_tlv_get_psvn(const tlv_info_t& info) +psvn_t *platform_info_tlv_get_psvn(const tlv_info_t& info) { - assert(info.type == TLV_DEVICE_ID && info.size == DEVICE_ID_TLV_PAYLOAD_SIZE()); + assert(info.type == TLV_PLATFORM_INFO && info.size == PLATFORM_INFO_TLV_PAYLOAD_SIZE()); assert(info.payload!=NULL); - return reinterpret_cast(info.payload+sizeof(ppid_t)); + return reinterpret_cast(info.payload); } @@ -272,7 +239,7 @@ tlv_status_t TLVsMsg::init_from_tlv_msg(const tlv_msg_t& tlv_msg) #ifdef DBG_LOG char dbg_str[256]; aesm_dbg_format_hex(new_info->payload, new_info->size, dbg_str, 256); - AESM_DBG_TRACE("Decode One TLV: type %s, size %u, version %d, payload:%s",get_tlv_enum_type_t_string(new_info->type), new_info->size, (int)new_info->version,dbg_str); + AESM_DBG_TRACE("Decode One TLV: type (tlv %d), size %u, version %d, payload:%s",new_info->type, new_info->size, (int)new_info->version,dbg_str); #endif }else{ return TLV_INVALID_MSG_ERROR; @@ -327,7 +294,7 @@ tlv_status_t TLVsMsg::alloc_more_buffer(uint32_t new_size, tlv_msg_t& new_buf) {\ char dbg_str[256]; \ aesm_dbg_format_hex(new_info->payload, new_info->size, dbg_str, 256);\ - AESM_DBG_INFO("create TLV: type %s, size %u, version %d, payload %s", get_tlv_enum_type_t_string(new_info->type), new_info->size, (int)new_info->version, dbg_str);\ + AESM_DBG_INFO("create TLV: type (tlv %d), size %u, version %d, payload %s", new_info->type, new_info->size, (int)new_info->version, dbg_str);\ } #else #define ADD_TLV_DBG_INFO @@ -516,7 +483,6 @@ tlv_status_t TLVsMsg::add_quote_signature(const uint8_t *quote_signature, uint32 return TLV_SUCCESS; } - tlv_status_t TLVsMsg::add_es_selector(uint8_t protocol, uint8_t selector_id) { uint8_t buf[2]; @@ -524,3 +490,52 @@ tlv_status_t TLVsMsg::add_es_selector(uint8_t protocol, uint8_t selector_id) buf[1]=selector_id; ADD_TLV_BY_DATA_SIZE(TLV_ES_SELECTOR, buf, static_cast(2*sizeof(uint8_t))) } + +tlv_status_t TLVsMsg::add_psid(const psid_t *psid) +{ + ADD_TLV_BY_DATA_SIZE(TLV_PS_ID, psid, sizeof(psid_t)) +} + +tlv_status_t TLVsMsg::add_platform_info(const bk_platform_info_t& pi) +{ + ADD_TLV_BY_DATA_SIZE(TLV_PLATFORM_INFO, &pi, sizeof(pi)) +} + +tlv_status_t TLVsMsg::add_flags(const flags_t *flags) +{ + ADD_TLV_BY_DATA_SIZE(TLV_FLAGS, flags, sizeof(flags_t)) +} + +tlv_status_t TLVsMsg::add_pce_report_sign(const sgx_report_body_t& report, const uint8_t ecdsa_sign[64]) +{ + tlv_info_t one_info; + one_info.header_size = LARGE_TLV_HEADER_SIZE; + one_info.payload = NULL; + one_info.size = sizeof(report)+64; + one_info.type = TLV_SE_REPORT; + one_info.version = TLV_VERSION_1; + uint32_t size = ::calc_one_tlv_size(one_info); + tlv_msg_t new_buf; + tlv_info_t *new_info = NULL; + tlv_status_t ret = alloc_more_buffer(size, new_buf); + if(ret!=TLV_SUCCESS){ + return ret; + } + ret = create_new_info(new_info); + if(ret != TLV_SUCCESS) + return ret; + if((ret=::tlv_msg_init_one_tlv(&one_info, new_buf))!=TLV_SUCCESS){ + return ret; + } + if(memcpy_s(one_info.payload, one_info.size, &report, sizeof(report))!=0){ + return (TLV_UNKNOWN_ERROR); + } + if(memcpy_s(one_info.payload+sizeof(report), one_info.size-sizeof(report), ecdsa_sign, 64)!=0){ + return (TLV_UNKNOWN_ERROR); + } + if(memcpy_s(new_info, sizeof(*new_info), &one_info, sizeof(one_info))!=0) + return TLV_UNKNOWN_ERROR; + ADD_TLV_DBG_INFO + return TLV_SUCCESS; +} + diff --git a/psw/ae/aesm_service/source/aesm/extension/type_length_value.h b/psw/ae/aesm_service/source/aesm/extension/type_length_value.h index 047538148b..f63c12774a 100644 --- a/psw/ae/aesm_service/source/aesm/extension/type_length_value.h +++ b/psw/ae/aesm_service/source/aesm/extension/type_length_value.h @@ -29,13 +29,15 @@ * */ - /** * File: type_length_value.h * Description: Header file for data structure and macro definition of the TLV, the type length value encoding format of Provision Message * - * Unaligned data will be used and for TLV, no data structure but some macros are used to extract information from TLV (due to var size of some fields) + * Unaligned data will be used and for TLV, no data structure but some macros to extract information from TLV(due to var size of some fields) * A tlv_info_t structure is defined for decoded TLV header information + * special macro to begin with upper case letter and end with lower case letter to indicate it will extract one field from the msg, such as + * EPID_GID_TLV_gid + * to extract the gid field from and EPID_GID_TLV * *To encoding TLV: * i) declare array of tlv_info_t and filling type/version/size of each TLV @@ -43,20 +45,23 @@ * iii) prepare the output buffer in tlv_msg_t (set both msg_buf and msg_size) * iv) call tlv_msg_init to initialize tlv headers of all sub-tlv * v) use function like cipher_text_tlv_get_encrypted_text(...) to get pointer to each payload component - * vi) copy corresponding data into each payload + * vi) copy correspondent data into each payload *To decoding TLV: * i) initialize tlv_msg_t to input buffer (msg_buf and msg_size) * ii) call read_tlv_info to get correpondent tlv_info_t array * iii) use function like cipher_text_tlv_get_encrypted_text(...) to get pointer to each payload component * or access size field of tlv_info_t directly to get size of payload - *Usually, there're multiple level of TLVs. + *Usually, there're multiple level of TLVs. To save memory which is critical inside enclave + * we need reuse the memory buffer for all levels of TLV. * So in encoding TLV, we need * go through step i) and ii) from inner-most level TLV to out-most level of TLV to define - * tlv_info_t of all level of TLVs and get msg size for them + * tlv_info_t of all level of TLVs and get msg size for them * Usually, the tlv_info_t of outer level is dependent on size of inner level * After that, we could prepare the output buffer which is step iii) according to size of outmost level TLVs * call tlv_msg_init to initialize TLV headers and get start address of payload (where inner TLV will share the memory) * from outmost level to innermost level which is step iv) and v) + * Now we could copy-in correpondent data from innermost level to outermost level and do correpondent encryption if required + * inplace encryption function provided so that no new memory required * In decoding TLV, it is simpler, just decode from outmost-level to innermost-level and do decryption if required */ @@ -70,15 +75,16 @@ #include "oal/oal.h" #include "tlv_common.h" #include "se_sig_rl.h" -#include "se_wrapper.h" +#include "pce_cert.h" +#include "sgx_report.h" -#define FOUR_BYTES_SIZE_TYPE 128 /*mask used in type of TLV to indicate that 'size' field uses 4 bytes*/ +#define FOUR_BYTES_SIZE_TYPE 128 /*mask used in type of TLV to indicate that 'size' field uses 4 bytes*/ #ifndef UINT16_MAX -#define UINT16_MAX 0xFFFF +#define UINT16_MAX 0xFFFF #endif #ifndef UINT32_MAX -#define UINT32_MAX 0xFFFFFFFFU +#define UINT32_MAX 0xFFFFFFFFU #endif #define IS_FOUR_BYTES_SIZE_TYPE(x) (((x)&FOUR_BYTES_SIZE_TYPE)!=0) @@ -90,28 +96,30 @@ typedef enum _tlv_status_t { TLV_INVALID_PARAMETER_ERROR, TLV_INVALID_MSG_ERROR, TLV_UNKNOWN_ERROR, - TLV_MORE_TLVS, /*There're more TLVs in the encoded buffer than user's expectation*/ - TLV_INSUFFICIENT_MEMORY, /*There'ld be more data in the TLV buffer according to the partially decoded data*/ - TLV_INVALID_FORMAT, /*Invalid data format in the TLV buffer to be decoded*/ - TLV_UNSUPPORTED /*the feature has not been supported such as version is later than supported version*/ + TLV_MORE_TLVS, /*There're more TLVs in the encoded buffer than user's expectation*/ + TLV_INSUFFICIENT_MEMORY, /*There'ld be more data in the TLV buffer according to the partially decoded data*/ + TLV_INVALID_FORMAT, /*Invalid data format in the TLV buffer to be decoded*/ + TLV_UNSUPPORTED /*the feature has not been supported such as version is later than supported version*/ }tlv_status_t; /*usually, we could initialize header_size by UNKOWN_TLV_HEADER_SIZE - *but sometimes, we could initialize it by LARGE_TLV_HEADER_SIZE if we want to always use 4 bytes for size even though it is small such as in EPIDSignature TLV*/ -#define UNKNOWN_TLV_HEADER_SIZE 0 -#define TLV_HEADER_SIZE_OFFSET 2 -#define SMALL_TLV_HEADER_SIZE 4 -#define LARGE_TLV_HEADER_SIZE 6 -#define MAX_TLV_HEADER_SIZE 6 /*an upper bound for TLV header size*/ -#define SHORT_TLV_MAX_SIZE UINT16_MAX + * but sometimes, we could initialize it by LARGE_TLV_HEADER_SIZE if we want to always use 4 bytes for size even though it is small such as in EPIDSignature TLV + */ +#define UNKNOWN_TLV_HEADER_SIZE 0 +#define TLV_HEADER_SIZE_OFFSET 2 +#define SMALL_TLV_HEADER_SIZE 4 +#define LARGE_TLV_HEADER_SIZE 6 +#define MAX_TLV_HEADER_SIZE 6 /*an upper bound for TLV header size*/ +#define SHORT_TLV_MAX_SIZE UINT16_MAX /*It defines a TLV information - *All those information is encoded inside a TLV but not in this structure*/ + *All those information is encoded inside a TLV but not in this structure + */ typedef struct _tlv_info_t{ - uint8_t type; /*type of tlv must be between 0 and 127 before encoding*/ - uint8_t version; - uint16_t header_size; /*header_size used to easy query begin and end address of TLV*/ - uint32_t size; /* 2 or 4 bytes size after encoding but always 4 bytes in this structure*/ - uint8_t *payload; /*pointer to payload of the TLV*/ + uint8_t type; /*type of tlv must be between 0 and 127 before encoding*/ + uint8_t version; + uint16_t header_size; /*header_size used to easy query begin and end address of TLV*/ + uint32_t size; /*2 or 4 bytes size after encoding but always 4 bytes in this structure*/ + uint8_t *payload; /*pointer to payload of the TLV*/ }tlv_info_t; typedef struct _tlv_msg_t{ @@ -119,10 +127,10 @@ typedef struct _tlv_msg_t{ uint32_t msg_size; }tlv_msg_t; -#define SIGRL_CERT_PREFIX_SIZE (sizeof(se_sig_rl_t)-sizeof(SigRL)) /*size for version and type*/ -#define SIGRL_CERT_HEADER_SIZE (sizeof(se_sig_rl_t)-sizeof(SigRLEntry)) -#define SIGRL_CERT_SIZE(sigrl_count) (sizeof(se_sig_rl_t)+((sigrl_count)-1)*sizeof(SigRLEntry)+2*SE_ECDSA_SIGN_SIZE) -#define EPID_SIGNATURE_HEADER_SIZE (sizeof(EPIDSignature)-sizeof(NRProof)) +#define SIGRL_CERT_PREFIX_SIZE (sizeof(se_sig_rl_t)-sizeof(SigRL)) /*size for version and type*/ +#define SIGRL_CERT_HEADER_SIZE (sizeof(se_sig_rl_t)-sizeof(SigRLEntry)) +#define SIGRL_CERT_SIZE(sigrl_count) (sizeof(se_sig_rl_t)+((sigrl_count)-1)*sizeof(SigRLEntry)+2*SE_ECDSA_SIGN_SIZE) +#define EPID_SIGNATURE_HEADER_SIZE (sizeof(EPIDSignature)-sizeof(NRProof)) #define EPID_SIGNATURE_SIZE(sign_count) (sizeof(EPIDSignature)+((sign_count)-1)*sizeof(NRProof)) @@ -140,13 +148,13 @@ tlv_status_t read_tlv_infos(const tlv_msg_t& msg, uint32_t *tlvs_count, tlv_info /*Function to return the header size in encoded TLV buffer*/ uint32_t get_tlv_header_size(const tlv_info_t *info); -/*Function to return the estimated upper bound of length of TLV in bytes given length in bytes of payload. +/*Function to return the estimated upper bound of length of TLV in bytes given length in bytes of payload. * Currently, it returns the exact value for TLV encoding, it should not be used for TLV decoding *return 0 if there's any error */ inline static uint32_t get_tlv_total_size(size_t payload_size) { - if(payload_size>UINT16_MAX){/*6 bytes TLV header*/ + if(payload_size>UINT16_MAX){ /*6 bytes TLV header*/ if(payload_size>UINT32_MAX-LARGE_TLV_HEADER_SIZE)/*overflow of uint32_t, return 0 to indicate error*/ return 0; return static_cast(payload_size+LARGE_TLV_HEADER_SIZE); @@ -157,7 +165,8 @@ inline static uint32_t get_tlv_total_size(size_t payload_size) /*Function to return number in bytes of a msg with some encoded TLVs - *tlvs_count gives number of TLVs in the msg and infos[i] gives info of the i'th TLV*/ + *tlvs_count gives number of TLVs in the msg and infos[i] gives info of the i'th TLV + */ uint32_t get_tlv_msg_size(uint32_t tlvs_count, const tlv_info_t infos[]); /*Function to initialize a msg of some encoded TLVs @@ -180,15 +189,16 @@ tlv_status_t tlv_msg_init(uint32_t tlvs_count, tlv_info_t infos[], const tlv_msg */ uint32_t tlv_msg_init_one_header(uint8_t msg[MAX_TLV_HEADER_SIZE], tlv_info_t& info); -/*Macro used to crack tlv structure, the pointer type of payload must be uint8_t * +/*Macro used to crach tlv structure, the pointer type of payload must be uint8_t * *The alignment of all types used inside payload should be 1 (which means no alignment) - *cipher text TLV*/ + *cipher text TLV + */ #define CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size) ((text_size)+1) /*size of payload*/ #define CIPHER_TEXT_TLV_SIZE(text_size) get_tlv_total_size(CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size)) /*size of TLV*/ -uint8_t *cipher_text_tlv_get_key_id(const tlv_info_t& info); /*given tlv_info_t, return pointer to key_id*/ -tlv_msg_t cipher_text_tlv_get_encrypted_text(const tlv_info_t& info); /*given tlv_info_t return tlv_msg for encrypted text so that we could restart decode*/ +uint8_t *cipher_text_tlv_get_key_id(const tlv_info_t& info); /*given tlv_info_t, return pointer to key_id*/ +tlv_msg_t cipher_text_tlv_get_encrypted_text(const tlv_info_t& info); /*given tlv_info_t return tlv_msg for encrypted text so that we could restart decode*/ /*block cipher text TLV*/ -#define BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size) ((text_size)+IV_SIZE) /*size of payload*/ +#define BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size) ((text_size)+IV_SIZE) /*size of payload*/ #define BLOCK_CIPHER_TEXT_TLV_SIZE(text_size) get_tlv_total_size(BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(text_size)) /*size of TLV*/ struct _tlv_iv_t;/*an incomplete type for iv only*/ typedef struct _tlv_iv_t tlv_iv_t; @@ -240,8 +250,24 @@ psvn_t *epid_sigrl_psvn_tlv_get_psvn(const tlv_info_t& info); #define DEVICE_ID_TLV_PAYLOAD_SIZE() (sizeof(ppid_t)+sizeof(fmsp_t)+sizeof(psvn_t)) #define DEVICE_ID_TLV_SIZE() get_tlv_total_size(DEVICE_ID_TLV_PAYLOAD_SIZE()) ppid_t *device_id_tlv_get_ppid(const tlv_info_t& info); -fmsp_t *device_id_tlv_get_fmsp(const tlv_info_t& info); -psvn_t *device_id_tlv_get_psvn(const tlv_info_t& info); + +/*PPID TLV*/ +#define PPID_TLV_PAYLOAD_SIZE() (sizeof(ppid_t)) +#define PPID_TLV_SIZE() get_tlv_total_size(PPID_TLV_PAYLOAD_SIZE()) + +/*PWK2 TLV*/ +#define PWK2_TLV_PAYLOAD_SIZE() (SK_SIZE) +#define PWK2_TLV_SIZE() get_tlv_total_size(PWK2_TLV_PAYLOAD_SIZE()) + +/*PlatfromInfo TLV*/ +#define PLATFORM_INFO_TLV_PAYLOAD_SIZE() (sizeof(bk_platform_info_t)) +#define PLATFORM_INFO_TLV_SIZE() get_tlv_total_size(PLATFORM_INFO_TLV_PAYLOAD_SIZE()) +fmsp_t *platform_info_tlv_get_fmsp(const tlv_info_t& info); +psvn_t *platform_info_tlv_get_psvn(const tlv_info_t& info); + +/*SE_REPORT_TLV*/ +#define SE_REPORT_TLV_PAYLOAD_SIZE() (sizeof(sgx_report_body_t)+2*ECDSA_SIGN_SIZE) +#define SE_REPORT_TLV_SIZE() (LARGE_TLV_HEADER_SIZE+SE_REPORT_TLV_PAYLOAD_SIZE()) /*PSID TLV*/ #define PSID_TLV_PAYLOAD_SIZE() (sizeof(psid_t)) @@ -257,7 +283,7 @@ psid_t *psid_tlv_get_psid(const tlv_info_t& info); #define EPID_SIGNATURE_TLV_SIZE(sign_count) (LARGE_TLV_HEADER_SIZE+EPID_SIGNATURE_TLV_PAYLOAD_SIZE(sign_count)) /*always use large header size for Signature TLV*/ /*EPID Membership Credential TLV*/ -#define MEMBERSHIP_CREDENTIAL_TLV_PAYLOAD_SIZE() (sizeof(membertship_credential_with_escrow_t)) +#define MEMBERSHIP_CREDENTIAL_TLV_PAYLOAD_SIZE() (sizeof(membership_credential_with_escrow_t)) #define MEMBERSHIP_CREDENTIAL_TLV_SIZE() get_tlv_total_size(MEMBERSHIP_CREDENTIAL_TLV_PAYLOAD_SIZE()) PElemStr *membership_credential_tlv_get_x(const tlv_info_t& info); G1ElemStr *membership_credential_tlv_get_A(const tlv_info_t& info); @@ -271,6 +297,12 @@ G1ElemStr *membership_credential_tlv_get_A(const tlv_info_t& info); uint8_t *es_selector_tlv_get_es_type(const tlv_info_t& info); uint8_t *es_selector_tlv_get_selector_id(const tlv_info_t& info); +#define PCE_CERT_TLV_PAYLOAD_SIZE() sizeof(pce_tcb_cert_t) +#define PCE_CERT_TLV_SIZE() get_tlv_total_size(PCE_CERT_TLV_PAYLOAD_SIZE()) + +#define PCE_SIGNATURE_TLV_PAYLOAD_SIZE() (2*SE_ECDSA_SIGN_SIZE+sizeof(sgx_report_t)) +#define PCE_SIGNATURE_TLV_SIZE() get_tlv_total_size(PCE_SIGNATURE_TLV_PAYLOAD_SIZE()) + class TLVsMsg{ uint32_t num_infos; tlv_info_t* infos; @@ -294,10 +326,7 @@ protected: if(p==NULL){ return TLV_OUT_OF_MEMORY_ERROR; } - if(0!=memcpy_s(p, sizeof(tlv_info_t)*(num_infos+1), infos, sizeof(tlv_info_t)*num_infos)){ - free(p); - return TLV_UNKNOWN_ERROR; - } + memcpy(p, infos, sizeof(tlv_info_t)*num_infos); free(infos); infos = p; new_info = infos + (num_infos); @@ -335,6 +364,10 @@ public: tlv_status_t add_mac(const uint8_t mac[MAC_SIZE]); tlv_status_t add_nonce(const uint8_t *nonce, uint32_t nonce_size); tlv_status_t add_epid_gid(const GroupID& gid); + tlv_status_t add_platform_info(const bk_platform_info_t& pi); + tlv_status_t add_pce_report_sign(const sgx_report_body_t& report, const uint8_t ecdsa_sign[64]); + tlv_status_t add_psid(const psid_t *psid); + tlv_status_t add_flags(const flags_t *flags); tlv_status_t add_es_selector(uint8_t protocol, uint8_t selector_id); tlv_status_t add_quote(const uint8_t *quote_data, uint32_t quote_size); tlv_status_t add_quote_signature(const uint8_t *quote_signature, uint32_t sign_size); diff --git a/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMLogicWrapper.h b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMLogicWrapper.h index 1b3ec418ab..e0b8d5bc55 100644 --- a/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMLogicWrapper.h +++ b/psw/ae/aesm_service/source/aesm_wrapper/inc/AESMLogicWrapper.h @@ -90,6 +90,10 @@ class AESMLogicWrapper :public IAESMLogic { virtual aesm_error_t reportAttestationStatus(uint8_t* platform_info, uint32_t platform_info_size, uint32_t attestation_error_code, uint8_t* update_info, uint32_t update_info_size); + virtual aesm_error_t getWhiteListSize(uint32_t* white_list_size); + virtual aesm_error_t getWhiteList(uint8_t* white_list, uint32_t mWhiteListSize); + virtual aesm_error_t sgxGetExtendedEpidGroupId(uint32_t* x_group_id); + virtual aesm_error_t sgxSwitchExtendedEpidGroup(uint32_t x_group_id); private: AESMLogicWrapper& operator=(const AESMLogicWrapper&); diff --git a/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp index 9ff970e0e7..1e3c8fdb3b 100644 --- a/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp +++ b/psw/ae/aesm_service/source/aesm_wrapper/src/AESMLogicWrapper.cpp @@ -139,6 +139,27 @@ aesm_error_t AESMLogicWrapper::reportAttestationStatus(uint8_t* platform_info, u update_info, update_info_size); } +aesm_error_t AESMLogicWrapper::getWhiteListSize(uint32_t* white_list_size) +{ + return AESMLogic::get_white_list_size(white_list_size); +} + +aesm_error_t AESMLogicWrapper::getWhiteList(uint8_t *white_list, + uint32_t white_list_size) +{ + return AESMLogic::get_white_list(white_list, white_list_size); +} + +aesm_error_t AESMLogicWrapper::sgxGetExtendedEpidGroupId(uint32_t* x_group_id) +{ + return AESMLogic::get_extended_epid_group_id(x_group_id); +} + +aesm_error_t AESMLogicWrapper::sgxSwitchExtendedEpidGroup(uint32_t x_group_id) +{ + return AESMLogic::switch_extended_epid_group(x_group_id); +} + void AESMLogicWrapper::service_stop() { AESMLogic::service_stop(); diff --git a/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp b/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp index 26f1beedb5..2c2c5ae9b4 100644 --- a/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp +++ b/psw/ae/aesm_service/source/epid_provision/epid_endpoint_selection.cpp @@ -57,7 +57,7 @@ static ae_error_t prov_es_gen_header(provision_request_header_t *es_header, return PVE_UNEXPECTED_ERROR; } uint32_t size_in; - size_in = _htonl(total_size);//big endian size required in msg header + size_in = _htonl(total_size);//use as a tmp size, big endian required in msg header if(0!=memcpy_s(&es_header->size,sizeof(es_header->size), &size_in, sizeof(size_in))){ AESM_DBG_FATAL("memcpy error"); return PVE_UNEXPECTED_ERROR; @@ -82,7 +82,7 @@ uint32_t CPVEClass::gen_es_msg1( ret = prov_es_gen_header(es_header, es_output.xid, msg_size); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to generate Endpoint Selection Msg1 Header:%d",ret); + AESM_DBG_ERROR("Fail to generate Endpoint Selection Msg1 Header:(ae%d)",ret); return ret; } @@ -91,7 +91,7 @@ uint32_t CPVEClass::gen_es_msg1( tlv_status_t tlv_status = tlvs_msg.add_es_selector(SE_EPID_PROVISIONING, es_output.selector_id); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("fail to create ES Selector TLV:%d",ret); + AESM_DBG_ERROR("fail to create ES Selector TLV:(ae%d)",ret); return ret; } assert(tlvs_msg.get_tlv_msg_size()<=msg_size - PROVISION_REQUEST_HEADER_SIZE); //The checking should have been done in prov_es_gen_header @@ -133,7 +133,7 @@ uint32_t CPVEClass::proc_es_msg2( } ae_ret = check_endpoint_pg_stauts(resp_header); if(AE_SUCCESS != ae_ret){ - AESM_DBG_ERROR("Backend report error in ES Msg2 Header:%d",ae_ret); + AESM_DBG_ERROR("Backend report error in ES Msg2 Header:(ae%d)",ae_ret); goto final_point; } if(0!=memcmp(xid, resp_header->xid, XID_SIZE)){ @@ -150,7 +150,7 @@ uint32_t CPVEClass::proc_es_msg2( tlv_status = tlvs_msg.init_from_buffer(resp_body, msg_size - static_cast(PROVISION_RESPONSE_HEADER_SIZE)); ae_ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ae_ret){ - AESM_DBG_ERROR("Fail to decode ES Msg2:%d",ae_ret); + AESM_DBG_ERROR("Fail to decode ES Msg2:(ae%d)",ae_ret); goto final_point; } if(tlvs_msg.get_tlv_count() != ES_MSG2_FIELD_COUNT){//three TLVs @@ -173,7 +173,7 @@ uint32_t CPVEClass::proc_es_msg2( tlvs_msg[1].header_size!=SMALL_TLV_HEADER_SIZE||tlvs_msg[1].size != PVE_RSA_KEY_BYTES+1 || tlvs_msg[1].payload[0] != PEK_PRIV){ ae_ret = PVE_MSG_ERROR; - AESM_DBG_ERROR("Invalid Signature TLV: type %d, version %d, size %d while expected value is %d, %d, %d", + AESM_DBG_ERROR("Invalid Signature TLV: type (tlv%d), version %d, size %d while expected value is (tlv%d,) %d, %d", tlvs_msg[1].type, tlvs_msg[1].version, tlvs_msg[1].size, TLV_SIGNATURE, TLV_VERSION_1, PVE_RSA_KEY_BYTES); goto final_point; @@ -181,7 +181,7 @@ uint32_t CPVEClass::proc_es_msg2( if(tlvs_msg[2].type != TLV_PEK || tlvs_msg[2].version != TLV_VERSION_1 || tlvs_msg[2].header_size!=SMALL_TLV_HEADER_SIZE||tlvs_msg[2].size != sizeof(signed_pek_t)){ ae_ret = PVE_MSG_ERROR; - AESM_DBG_ERROR("Invalid PEK TLV: type %d, version %d, size %d while expected value is %d, %d, %d", + AESM_DBG_ERROR("Invalid PEK TLV: type (tlv%d), version %d, size %d while expected value is (tlv%d), %d, %d", tlvs_msg[2].type, tlvs_msg[2].version, tlvs_msg[2].size, TLV_PEK, TLV_VERSION_1, sizeof(signed_pek_t)); goto final_point; diff --git a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp index ac0b03bd62..5a0015d252 100644 --- a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp +++ b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg1.cpp @@ -31,129 +31,360 @@ #include "type_length_value.h" -#include "sgx_tcrypto_internal.h" #include "epid_utility.h" #include "oal/oal.h" #include "aeerror.h" #include "PVEClass.h" -#include "se_wrapper.h" +#include "PCEClass.h" +#include "aesm_rand.h" +#include "epid_pve_type.h" +#include "ipp_wrapper.h" /** - * File: epid_provision_msg1.cpp + * File: epid_provision_msg1.cpp * Description: Provide the untrusted implementation of code to generate ProvMsg1 - */ + */ -//For each ProvMsg, the first field is msg header (which including XID) +//For each ProvMsg,the first field is msg header (which including XID) //But in the code here, XID is not counted as a TLV field(since it is part of msg header) -// and the index of TLV field is started from 0. +//and the index of TLV field is started from 0. //Msg1 Top TLVs: TLV_CIPHER_TEXT(rsa_oaep_result),E+MAC(encrypted_and_mac_data) -#define MSG1_TOP_FIELDS_COUNT 3 -#define MSG1_TOP_FIELD_RSA_OAEP_DATA msg1_fields[0] -#define MSG1_TOP_FIELD_GCM_DATA msg1_fields[1] -#define MSG1_TOP_FIELD_GCM_MAC msg1_fields[2] +//#define MSG1_TOP_FIELDS_COUNT 3 +//#define MSG1_TOP_FIELD_RSA_OAEP_DATA msg1_fields[0] +//#define MSG1_TOP_FIELD_GCM_DATA msg1_fields[1] +//#define MSG1_TOP_FIELD_GCM_MAC msg1_fields[2] + +//Function to transform the RSA public key(big endian) into ipp format, the function is defined in pve_pub_key.cpp +//the key is from Provision Server which is used for rsa-oaep in ProvMsg1 +//free_rsa_key should be called to release the memory on successfully returned rsa_pub_key +//return PVEC_SUCCESS on success +IppStatus get_provision_server_rsa_pub_key_in_ipp_format(const signed_pek_t& pek, IppsRSAPublicKeyState **rsa_pub_key); - -//Function to initialize TLV Header for ProvMsg1 and check whether input buffer for ProvMsg1 is large enough -//field1_data_size[in]: size of field1_data which varies according to whether performance rekey used. -//msg1_buffer_size[in]: size of buffer used to hold generated ProvMsg1, it is used by the function to verify whether size of buffer is large enough -//xid[in]: Transaction ID used in protocol -//msg1_header[out]: request header for ProvMsg1 to fill in +//Function to initialize reqeust header for ProvMsg1 +//msg1_header: request header for ProvMsg1 to fill in +//use_flags: whether the flag tlv is included +//xid: transaction ID +//msg1_buffer_size: buffer size for ProvMsg1, in bytes static ae_error_t prov_msg1_gen_header(provision_request_header_t *msg1_header, - uint32_t field1_data_size, + bool use_flags, const uint8_t *xid, uint32_t msg1_buffer_size) { uint32_t total_size = 0; + //platform info tlv size + uint32_t field1_data_size = PLATFORM_INFO_TLV_SIZE(); + field1_data_size += CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES); + //add flag tlv if needed + if(use_flags){ + field1_data_size += FLAGS_TLV_SIZE(); + } if(sizeof(*msg1_header)>msg1_buffer_size){ AESM_DBG_ERROR("Too small ProvMsg1 buffer size"); return PVE_INSUFFICIENT_MEMORY_ERROR; } total_size = CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES) + BLOCK_CIPHER_TEXT_TLV_SIZE(field1_data_size) +MAC_TLV_SIZE(MAC_SIZE); - //initialize field in Msg1 Header + //initialize Msg1 Header msg1_header->protocol = SE_EPID_PROVISIONING; msg1_header->type = TYPE_PROV_MSG1; - msg1_header->version = TLV_VERSION_1; + msg1_header->version = TLV_VERSION_2; if(0!=memcpy_s(msg1_header->xid, XID_SIZE, xid, XID_SIZE)){ - AESM_DBG_FATAL("fail in memcpy"); + AESM_DBG_FATAL("fail in memcpy_s"); return PVE_UNEXPECTED_ERROR; } uint32_t size_in; - size_in = _htonl(total_size);//big endian size required in msg header + //use as a tmp size, big endian required in msg header + size_in = _htonl(total_size); + //copy big endian msg body size into header if(0!=memcpy_s(&msg1_header->size, sizeof(msg1_header->size),&size_in, sizeof(size_in))){ - AESM_DBG_FATAL("fail in memcpy"); + AESM_DBG_FATAL("fail in memcpy_s"); return PVE_UNEXPECTED_ERROR; } - if(total_size +sizeof(*msg1_header) >msg1_buffer_size){//the input msg body size is not large enough + if(total_size +sizeof(*msg1_header) >msg1_buffer_size){ + //the input msg body size is not large enough AESM_DBG_ERROR("Too small ProvMsg1 buffer size"); return PVE_INSUFFICIENT_MEMORY_ERROR; } return AE_SUCCESS; } -//Function to generate ProvMsg1 -//Input psvn could be NULL to use the current psvn, or input the previous_psvn from preivous ProvMsg2 -//The function will generate a random transaction id which is used by msg header of msg1 +//This function will do the rsa oaep encrypt with input src[0:src_len] and put the output to buffer dst +//The function will assume that buffer src_len is no more than PVE_RSAOAEP_ENCRYPT_MAXLEN and the buffer size is at least PVE_RSA_KEY_BITS +static ae_error_t aesm_rsa_oaep_encrypt(const uint8_t *src, uint32_t src_len, const IppsRSAPublicKeyState *rsa, uint8_t dst[PVE_RSA_KEY_BYTES]) +{ + const int hashsize = SHA_SIZE_BIT; + Ipp8u seeds[hashsize]; + IppStatus status = ippStsNoErr; + ae_error_t ret = AE_SUCCESS; + uint8_t* pub_key_buffer = NULL; + int pub_key_size; + + ret = aesm_read_rand(seeds, hashsize); + if(AE_SUCCESS!=ret){ + goto ret_point; + } + + if((status = ippsRSA_GetBufferSizePublicKey(&pub_key_size, rsa)) != ippStsNoErr) + { + ret = AE_FAILURE; + goto ret_point; + } + + //allocate temporary buffer + pub_key_buffer = (uint8_t*)malloc(pub_key_size); + if(pub_key_buffer == NULL) + { + ret = AE_OUT_OF_MEMORY_ERROR; + goto ret_point; + } + + if((status = ippsRSA_OAEPEncrypt_SHA256(src, src_len, + NULL, 0, seeds, + dst, rsa, pub_key_buffer)) != ippStsNoErr) + { + ret = AE_FAILURE; + goto ret_point; + } + +ret_point: + if(pub_key_buffer) + free(pub_key_buffer); + return ret; +} + + +//generate ProvMsg1 +//The function will generate a random transaction id which is used by msg header of msg1 and saved in global memory too //The function return AE_SUCCESS on success and other to indicate error -//Format of ProvMsg1: RSA-OAEP(SK,PSID),E+MAC(DeviceID[:Flags]) -//@psvn: the input psvn or NULL -//@pek: the input PEK got from endpoint selection -//@performance_rekey_used: true for performance rekey and false for first provisioning, backup retrieval or TCB upgrade +//@pve_data: global structure used to store pve relative data //@msg1: buffer to receive ProvMsg1 (including both header and body) -//@msg1_size: size of buffer for generating ProvMsg1 +//@msg1_size: size of buffer msg1 //@return AE_SUCCESS on success -uint32_t CPVEClass::gen_prov_msg1(const psvn_t *psvn, - const signed_pek_t& pek, - bool performance_rekey_used, - uint8_t *msg1, - uint32_t msg1_size) + + uint32_t CPVEClass::gen_prov_msg1( + pve_data_t &pve_data, + uint8_t *msg1, + uint32_t msg1_size) { uint32_t ret = AE_SUCCESS; - prov_msg1_output_t msg1_output; - //ProvMsg1 header will be in the beginning part of the output msg + uint16_t pce_id = 0; + uint16_t pce_isv_svn = 0; + sgx_report_t pek_report; + uint8_t *field2 = NULL; + uint8_t field2_iv[IV_SIZE]; + uint8_t field2_mac[MAC_SIZE]; + uint8_t encrypted_pcid[PVE_RSA_KEY_BYTES]; + //msg1 header will be in the beginning part of the output msg provision_request_header_t *msg1_header = reinterpret_cast(msg1); - memset(&msg1_output, 0, sizeof(msg1_output)); + memset(&pek_report, 0, sizeof(pek_report)); + sgx_target_info_t pce_target_info; + sgx_status_t sgx_status; - ret = gen_prov_msg1_data(psvn, &pek, performance_rekey_used, &msg1_output); - if(AE_SUCCESS !=ret ){ - AESM_DBG_ERROR("Gen ProvMsg1 in trusted code failed:%d",ret); + //Load PCE Enclave required + ret = CPCEClass::instance().load_enclave(); + if(ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PCE enclave:( ae%d)\n",ret); + return ret; + } + ret = CPCEClass::instance().get_pce_target(&pce_target_info); + if(ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to get PCE target info:( ae %d)\n",ret); return ret; } - ret = prov_msg1_gen_header(msg1_header, msg1_output.field1_data_size, msg1_output.xid, msg1_size); + //Load PvE enclave now + ret = CPVEClass::instance().load_enclave(); + if( ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PvE enclave:(ae%d)\n",ret); + return ret; + } + //The code will generate a report on PEK by PvE + ret = gen_prov_msg1_data(&pve_data.pek, &pce_target_info, &pek_report); + if(AE_SUCCESS != ret ){ + AESM_DBG_ERROR("Gen ProvMsg1 in trusted code failed:( ae %d)",ret); + return ret; + } + se_static_assert(sizeof(encrypted_pcid)==PEK_MOD_SIZE); + //Load PCE Enclave required + ret = CPCEClass::instance().load_enclave(); + if(ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PCE enclave:( ae %d)\n",ret); + return ret; + } + ret = CPCEClass::instance().get_pce_info(pek_report, pve_data.pek, pce_id, + pce_isv_svn, encrypted_pcid); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("fail to generate ProvMsg1 Header:%d",ret); + AESM_DBG_ERROR("Fail to generate pc_info:(ae%d)",ret); + return ret; + } + + //randomly generate XID + ret = aesm_read_rand(pve_data.xid, XID_SIZE); + if(AE_SUCCESS != ret ){ + AESM_DBG_ERROR("Fail to generate random XID (ae%d)",ret); + return ret; + } + //randomly generate SK + ret = aesm_read_rand(pve_data.sk, SK_SIZE); + if(AE_SUCCESS != ret ){ + AESM_DBG_ERROR("Fail to generate random SK (ae%d)",ret); + return ret; + } + CPCEClass::instance().unload_enclave(); + ret = prov_msg1_gen_header(msg1_header, pve_data.is_performance_rekey, pve_data.xid, msg1_size); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("fail to generate ProvMsg1 Header:(ae %d)",ret); return ret; } { - TLVsMsg tlvs_msg1; + TLVsMsg tlvs_msg1_sub; tlv_status_t tlv_status; - tlv_status= tlvs_msg1.add_cipher_text(msg1_output.field0, PVE_RSA_KEY_BYTES, PEK_PUB); + + sgx_sha256_hash_t psid; + tlv_status = tlvs_msg1_sub.add_block_cipher_info(pve_data.sk); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("Fail to generate field0 TLV of ProvMsg1:%d",ret); + + AESM_DBG_ERROR("Fail to generate SK TLV of ProvMsg1 (ae %d)",ret); return ret; } - tlv_status = tlvs_msg1.add_block_cipher_text(msg1_output.field1_iv, msg1_output.field1_data, msg1_output.field1_data_size); + sgx_status = sgx_sha256_msg(reinterpret_cast(&pve_data.pek.n), + static_cast(sizeof(pve_data.pek.n) + sizeof(pve_data.pek.e)), &psid); + if(SGX_SUCCESS != sgx_status){ + AESM_DBG_ERROR("Fail to generate PSID, (sgx0x%x)",sgx_status); + return AE_FAILURE; + } + se_static_assert(sizeof(sgx_sha256_hash_t)==sizeof(psid_t)); + tlv_status = tlvs_msg1_sub.add_psid(reinterpret_cast(&psid)); ret = tlv_error_2_pve_error(tlv_status); - if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("Fail to generate field1 TLV of ProvMsg1:%d",ret); + if(SGX_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to add PSID TLV ae(%d)",ret); return ret; } - tlv_status = tlvs_msg1.add_mac(msg1_output.field1_mac); + //transform rsa format PEK public key of Provision Server into IPP library format + IppsRSAPublicKeyState *rsa_pub_key = NULL; + IppStatus ippStatus = get_provision_server_rsa_pub_key_in_ipp_format(pve_data.pek, &rsa_pub_key); + if( ippStsNoErr != ippStatus){ + AESM_DBG_ERROR("Fail to decode PEK:%d",ippStatus); + return AE_FAILURE; + } + uint8_t field0[PVE_RSA_KEY_BYTES]; + ret = aesm_rsa_oaep_encrypt(tlvs_msg1_sub.get_tlv_msg(), tlvs_msg1_sub.get_tlv_msg_size(), rsa_pub_key, field0); + secure_free_rsa_pub_key(PVE_RSA_KEY_BYTES, sizeof(uint32_t), rsa_pub_key); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to in RSA_OAEP for ProvMsg1:(ae%d)",ret); + return ret; + } + TLVsMsg tlvs_msg1; + tlv_status= tlvs_msg1.add_cipher_text(field0, PVE_RSA_KEY_BYTES, PEK_PUB); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("Fail to create field2 TLV of ProvMsg1:%d",ret); + AESM_DBG_ERROR("Fail to generate field0 TLV of ProvMsg1( ae%d)",ret); + return ret; + } + + TLVsMsg tlvs_msg2_sub; + tlv_status = tlvs_msg2_sub.add_cipher_text(encrypted_pcid, PVE_RSA_KEY_BYTES, PEK_PUB); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + return ret; + } + + if(!pve_data.is_backup_retrieval){ + if(0!=memcpy_s(&pve_data.bpi.cpu_svn, sizeof(pve_data.bpi.cpu_svn), + &pek_report.body.cpu_svn, sizeof(pek_report.body.cpu_svn))){ + AESM_DBG_FATAL("fail in memcpy_s"); + return PVE_UNEXPECTED_ERROR; + } + if(0!=memcpy_s(&pve_data.bpi.pve_svn, sizeof(pve_data.bpi.pve_svn), + &pek_report.body.isv_svn, sizeof(pek_report.body.isv_svn))){ + AESM_DBG_FATAL("fail in memcpy_s"); + return PVE_UNEXPECTED_ERROR; + } + if(0!=memcpy_s(&pve_data.bpi.pce_svn, sizeof(pve_data.bpi.pce_svn), + &pce_isv_svn, sizeof(pce_isv_svn))){ + AESM_DBG_FATAL("fail in memcpy_s"); + return PVE_UNEXPECTED_ERROR; + } + } + //always use pce_id from PCE enclave + pve_data.bpi.pce_id = pce_id; + memset(&pve_data.bpi.fmsp, 0, sizeof(pve_data.bpi.fmsp)); + tlv_status = tlvs_msg2_sub.add_platform_info(pve_data.bpi); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Platform Info TLV of ProvMsg1 (ae%d)",ret); + return ret; + } + if(pve_data.is_performance_rekey){ + //ignore performance rekey in backup retrieval + flags_t flags; + memset(&flags,0,sizeof(flags)); + //set performance rekey flags + flags.flags[FLAGS_SIZE-1]=1; + tlv_status = tlvs_msg2_sub.add_flags(&flags); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate FLAGS TLV of ProvMsg1, (ae %d)",ret); + return ret; + } + } + + ret = aesm_read_rand(field2_iv, IV_SIZE); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to read rand:(ae%d)",ret); + return ret; + } + sgx_cmac_128bit_tag_t ek1; + se_static_assert(SK_SIZE==sizeof(sgx_cmac_128bit_key_t)); + if((sgx_status = sgx_rijndael128_cmac_msg(reinterpret_cast(pve_data.sk), + pve_data.xid, XID_SIZE, &ek1))!=SGX_SUCCESS){ + AESM_DBG_ERROR("Fail to generate ek1:(sgx%d)",sgx_status); + return AE_FAILURE; + } + + field2 = (uint8_t *)malloc(tlvs_msg2_sub.get_tlv_msg_size()); + if(NULL == field2){ + AESM_DBG_ERROR("Out of memory"); + return AE_OUT_OF_MEMORY_ERROR; + } + + + sgx_status = sgx_rijndael128GCM_encrypt(&ek1, + tlvs_msg2_sub.get_tlv_msg(), tlvs_msg2_sub.get_tlv_msg_size(), + field2,field2_iv, IV_SIZE, (const uint8_t *)msg1_header, sizeof(provision_request_header_t), + (sgx_aes_gcm_128bit_tag_t *)field2_mac); + if(SGX_SUCCESS != sgx_status){ + ret = sgx_error_to_ae_error(sgx_status); + AESM_DBG_ERROR("Fail to do AES encrypt (sgx %d)", sgx_status); + free(field2); + return ret; + } + + tlv_status = tlvs_msg1.add_block_cipher_text(field2_iv, field2, tlvs_msg2_sub.get_tlv_msg_size()); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + free(field2); + AESM_DBG_ERROR("Fail to generate field1 TLV of ProvMsg1(ae%d)",ret); + return ret; + } + + free(field2); + tlv_status = tlvs_msg1.add_mac(field2_mac); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS!=ret){ + AESM_DBG_ERROR("Fail to create field2 TLV of ProvMsg1:(ae %d)",ret); return ret; } uint32_t size = tlvs_msg1.get_tlv_msg_size(); - if(memcpy_s(msg1+PROVISION_REQUEST_HEADER_SIZE, msg1_size - PROVISION_REQUEST_HEADER_SIZE, + if(memcpy_s(msg1+PROVISION_REQUEST_HEADER_SIZE, msg1_size - PROVISION_REQUEST_HEADER_SIZE, tlvs_msg1.get_tlv_msg(), size)!=0){ - AESM_DBG_FATAL("memcpy error"); - return PVE_UNEXPECTED_ERROR;//The size overflow has been checked in header generation + //The size overflow has been checked in header generation + AESM_DBG_FATAL("fail in memcpy_s"); + return PVE_UNEXPECTED_ERROR; } } return AE_SUCCESS; diff --git a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp index c688b00511..175f51dce7 100644 --- a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp +++ b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg2.cpp @@ -30,16 +30,15 @@ */ #include "type_length_value.h" -#include "sgx_tcrypto_internal.h" #include "epid_utility.h" +#include "aesm_xegd_blob.h" #include "aeerror.h" #include "PVEClass.h" +#include "PCEClass.h" #include "aesm_rand.h" -#include "se_wrapper.h" -#include /** -* File: epid_provision_msg2.cpp +* File: epid_provision_msg2.cpp * Description: Provide the untrusted implementation of code to process ProvMsg2 * * Untrusted Code for EPID Provision @@ -50,17 +49,15 @@ #define MSG2_TOP_FIELD_DATA tlvs_msg2[1] #define MSG2_TOP_FIELD_MAC tlvs_msg2[2] #define MSG2_TOP_FIELD_SIGRL tlvs_msg2[3] -#define MSG2_FIELD1_MAX_COUNT 8 -#define MSG2_FIELD1_MIN_COUNT 6 +#define MSG2_FIELD1_MAX_COUNT 6 +#define MSG2_FIELD1_MIN_COUNT 4 #define MSG2_FIELD1_GROUP_CERT tlvs_field1[0] -#define MSG2_FIELD1_NONCE tlvs_field1[1] -#define MSG2_FIELD1_PREV_PSVN tlvs_field1[2]//optional field -#define MSG2_FIELD1_PSID tlvs_field1[psid_index]//psid_index is 2 if optional PREV_PSVN is not present or 3 if it is present -#define MSG2_FIELD1_ENC_TCB tlvs_field1[psid_index+1] -#define MSG2_FIELD1_MAC_TCB tlvs_field1[psid_index+2] -#define MSG2_FIELD1_DEVICE_ID tlvs_field1[psid_index+3] -#define PREV_GID_INDEX (psid_index+4) +#define MSG2_FIELD1_NONCE tlvs_field1[2] +#define MSG2_FIELD1_PSID tlvs_field1[1] +#define MSG2_FIELD1_PREV_PI tlvs_field1[alt_index+1] +#define PREV_GID_INDEX (alt_index+2) #define MSG2_FIELD1_PREV_GID tlvs_field1[PREV_GID_INDEX] +#define MSG2_FIELD1_PLAT_INFO tlvs_field1[alt_index+3] //Function to verify that EPID SigRL type and version is correct for sigrl @@ -79,7 +76,7 @@ static ae_error_t msg2_integrity_checking(const TLVsMsg& tlvs_msg2) return PVE_INTEGRITY_CHECK_ERROR; if(MSG2_TOP_FIELD_NONCE.type != TLV_NONCE || MSG2_TOP_FIELD_NONCE.size != NONCE_SIZE || MSG2_TOP_FIELD_NONCE.version != TLV_VERSION_1) return PVE_INTEGRITY_CHECK_ERROR; - if(MSG2_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE)//NONCE TLV has small header size + if(MSG2_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE)//Requires NONCE to be small header size return PVE_INTEGRITY_CHECK_ERROR; if(MSG2_TOP_FIELD_DATA.type != TLV_BLOCK_CIPHER_TEXT || MSG2_TOP_FIELD_DATA.version != TLV_VERSION_1) return PVE_INTEGRITY_CHECK_ERROR; @@ -103,67 +100,62 @@ static ae_error_t msg2_integrity_checking(const TLVsMsg& tlvs_msg2) static ae_error_t msg2_field1_msg_check_copy(const TLVsMsg& tlvs_field1, proc_prov_msg2_blob_input_t& msg2_blob_input, const signed_pek_t& pek) { uint32_t tlv_count = tlvs_field1.get_tlv_count(); - uint32_t psid_index = 2; - msg2_blob_input.is_previous_psvn_provided = false; - if(tlv_countMSG2_FIELD1_MAX_COUNT){ - return PVE_MSG_ERROR; - } - uint32_t i; - for(i=0;i(&pek.n), static_cast(sizeof(pek.n)+sizeof(pek.e)), &psid_hash)); @@ -171,15 +163,11 @@ static ae_error_t msg2_field1_msg_check_copy(const TLVsMsg& tlvs_field1, proc_pr return ret; if(0!=memcmp(&psid_hash, MSG2_FIELD1_PSID.payload, sizeof(psid_hash)))//PSID does not match return PVE_MSG_ERROR; + bk_platform_info_t *d2 = (bk_platform_info_t *)MSG2_FIELD1_PLAT_INFO.payload; - tlv_msg_t tcb_data = block_cipher_tlv_get_encrypted_text(MSG2_FIELD1_ENC_TCB); if(0!=memcpy_s(&msg2_blob_input.group_cert, sizeof(msg2_blob_input.group_cert), MSG2_FIELD1_GROUP_CERT.payload, MSG2_FIELD1_GROUP_CERT.size)|| 0!=memcpy_s(&msg2_blob_input.challenge_nonce, CHALLENGE_NONCE_SIZE, MSG2_FIELD1_NONCE.payload, MSG2_FIELD1_NONCE.size)|| - 0!=memcpy_s(&msg2_blob_input.equivalent_psvn, sizeof(psvn_t), device_id_tlv_get_psvn(MSG2_FIELD1_DEVICE_ID),sizeof(psvn_t))|| - 0!=memcpy_s(&msg2_blob_input.fmsp, sizeof(fmsp_t), device_id_tlv_get_fmsp(MSG2_FIELD1_DEVICE_ID), sizeof(fmsp_t))|| - 0!=memcpy_s(&msg2_blob_input.tcb_iv, IV_SIZE, block_cipher_tlv_get_iv(MSG2_FIELD1_ENC_TCB), IV_SIZE)|| - 0!=memcpy_s(&msg2_blob_input.encrypted_tcb, SK_SIZE, tcb_data.msg_buf, tcb_data.msg_size)|| - 0!=memcpy_s(&msg2_blob_input.tcb_mac, MAC_SIZE, MSG2_FIELD1_MAC_TCB.payload, MSG2_FIELD1_MAC_TCB.size)){ + 0!=memcpy_s(&msg2_blob_input.equiv_pi, sizeof(bk_platform_info_t), d2,sizeof(bk_platform_info_t))){ return PVE_UNEXPECTED_ERROR; } return AE_SUCCESS; @@ -187,11 +175,12 @@ static ae_error_t msg2_field1_msg_check_copy(const TLVsMsg& tlvs_field1, proc_pr //Function to check message header of ProvMsg2 to determine whether it is valid //@msg2_header, input the message header of ProvMsg2 +//@msg2_size, size of ProvMsg2, in bytes //@return AE_SUCCESS if the message header is valid ProvMsg2 or error code if there're any problems static ae_error_t check_prov_msg2_header(const provision_response_header_t *msg2_header, uint32_t msg2_size) { if(msg2_header->protocol != SE_EPID_PROVISIONING || msg2_header->type != TYPE_PROV_MSG2 || - msg2_header->version != TLV_VERSION_1){ + msg2_header->version != TLV_VERSION_2){ return PVE_INTEGRITY_CHECK_ERROR; } uint32_t size_in_header = lv_ntohl(msg2_header->size); @@ -204,26 +193,36 @@ static uint32_t estimate_epid_sig_size(uint32_t sigrl_size) { uint32_t sigrl_body_size = 0; uint32_t sigrl_extra_size = static_cast(sizeof(se_sig_rl_t)-sizeof(SigRLEntry)+2*ECDSA_SIGN_SIZE); - if(sigrl_size<=sigrl_extra_size){ - return static_cast(sizeof(EPIDSignature)-sizeof(NRProof)); + if(sigrl_size ==sigrl_extra_size || sigrl_size == 0){//sigrl_size==0 is special cases that no sigrl provided + //Add the TLV Header size + return static_cast(sizeof(EPIDSignature)-sizeof(NRProof)+MAX_TLV_HEADER_SIZE); + }else if (sigrl_size < sigrl_extra_size){ + //Invalid sigrl size + return 0; }else{ sigrl_body_size = sigrl_size - sigrl_extra_size; - size_t entry_count = sigrl_body_size/sizeof(SigRLEntry); - return static_cast(sizeof(EPIDSignature)-sizeof(NRProof)+sizeof(NRProof)*entry_count); + uint64_t entry_count = sigrl_body_size/sizeof(SigRLEntry); + uint64_t total_size = sizeof(EPIDSignature)-sizeof(NRProof)+sizeof(NRProof)*entry_count+MAX_TLV_HEADER_SIZE; + if(total_size > UINT32_MAX){ + return 0; + } + return static_cast(total_size); } } static ae_error_t gen_msg3_header(const gen_prov_msg3_output_t& msg3_output, const uint8_t xid[XID_SIZE], provision_request_header_t *msg3_header, uint32_t& msg3_size) { msg3_header->protocol = SE_EPID_PROVISIONING; - msg3_header->version = TLV_VERSION_1; + msg3_header->version = TLV_VERSION_2; msg3_header->type = TYPE_PROV_MSG3; size_t field1_size = 0; if(msg3_output.is_join_proof_generated){ field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE)+MAC_TLV_SIZE(MAC_SIZE); }else{ + // BLOCK_CIPHER_TEXT_TLV_SIZE(0) is needed because IV need to be included for the following MAC tlv field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(0)+MAC_TLV_SIZE(MAC_SIZE); } + field1_size+=NONCE_TLV_SIZE(NONCE_2_SIZE)+CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES)+SE_REPORT_TLV_SIZE(); size_t total_body_size = NONCE_TLV_SIZE(NONCE_SIZE) + BLOCK_CIPHER_TEXT_TLV_SIZE(field1_size)+MAC_TLV_SIZE(MAC_SIZE); if(msg3_output.is_epid_sig_generated){ total_body_size += BLOCK_CIPHER_TEXT_TLV_SIZE(msg3_output.epid_sig_output_size)+MAC_TLV_SIZE(MAC_SIZE); @@ -241,30 +240,21 @@ static ae_error_t gen_msg3_header(const gen_prov_msg3_output_t& msg3_output, con } //Function to decode ProvMsg2 and generate ProvMsg3 on success -//ProvMsg2 Format: -//R, E+MAC(**), [SigRL with ECDSA Sig] -//@msg2, the input buffer for ProvMsg2 in TLV encoded format -//@msg2_size, size of buffer msg2 -//@pek, the input pek got from endpoint selection protocol -//@epid_blob, input an optional old epid data blob used to generate non-revoke proof if required -//@blob_size, the buffer size of epid_blob -//@ek2, an output parameter for EK2 used in provision protocol which could be reused in proc_prov_msg4 -//@previous_psvn, an optional output buffer for Previous SigRL PSVN if old epid blob is missing or invalid -// so that caller could repeat ProvMsg1 and ProvMsg4 to retrieve backuped old epid data blob -//@msg3, output the ProvMsg3 in TLV encoded format -//@msg3_size: input the size of buffer msg3 +//@data: global structure used to store pve relative data +//@msg2: ProvMsg2 +//@msg2_size: size of ProvMsg2 +//@epid_blob: input an optional old epid data blob used to generate non-revoke proof if required +//@blob_size: size of the epid blob +//@msg3: output buffer for ProvMsg3 +//@msg3_size: input the size of buffer ProvMsg3, in byte //@return AE_SUCCESS on success and error code on failure -// PVE_EPID_BLOB_ERROR is returned if old_epid_blob is required but it is invalid or not provided and -// previous_psvn will be filled in by a Previous SigRL PSVN uint32_t CPVEClass::proc_prov_msg2( - const uint8_t* msg2, + pve_data_t &data, + const uint8_t *msg2, uint32_t msg2_size, - const signed_pek_t& pek, - const uint8_t* epid_blob, - uint32_t blob_size, - uint8_t ek2[SK_SIZE], - psvn_t* previous_psvn, - uint8_t* msg3, + const uint8_t *epid_blob, + uint32_t blob_size, + uint8_t *msg3, uint32_t msg3_size) { ae_error_t ret = AE_SUCCESS; @@ -273,6 +263,7 @@ uint32_t CPVEClass::proc_prov_msg2( uint8_t *epid_sig = NULL; uint8_t *decoded_msg2 = NULL; uint8_t *encrypted_field1 = NULL; + sgx_status_t sgx_status; uint8_t aad[PROVISION_RESPONSE_HEADER_SIZE+sizeof(RLver_t)+sizeof(GroupID)]; size_t aad_size = PROVISION_RESPONSE_HEADER_SIZE; const provision_response_header_t *msg2_header = reinterpret_cast(msg2); @@ -281,6 +272,10 @@ uint32_t CPVEClass::proc_prov_msg2( AESM_DBG_ERROR("ProvMsg2 size too small"); return PVE_MSG_ERROR; } + if (epid_blob != NULL && blob_size != SGX_TRUSTED_EPID_BLOB_SIZE_PAK){ + AESM_DBG_FATAL("epid blob size error"); + return PVE_UNEXPECTED_ERROR; + } if(msg3_size xid, data.xid, XID_SIZE) ){ + AESM_DBG_ERROR("unmatched xid in ProvMsg2 header"); + return AE_FAILURE; + } ret = check_epid_pve_pg_status_before_mac_verification(msg2_header); if( AE_SUCCESS != ret){ - AESM_DBG_ERROR("Backend server reported error in ProvMsg2:%d",ret); + AESM_DBG_ERROR("Backend server reported error in ProvMsg2:(ae%d)",ret); return ret; } @@ -309,32 +308,30 @@ uint32_t CPVEClass::proc_prov_msg2( tlv_status= tlvs_msg2.init_from_buffer(msg2+static_cast(PROVISION_RESPONSE_HEADER_SIZE), msg2_size - static_cast(PROVISION_RESPONSE_HEADER_SIZE)); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("Fail to decode ProvMsg2:%d",ret); + AESM_DBG_ERROR("Fail to decode ProvMsg2:(ae%d)",ret); break; } ret = msg2_integrity_checking(tlvs_msg2);//checking and verifying that TLV structure is correct and version is supported if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("ProvMsg2 integrity checking error:%d",ret); + AESM_DBG_ERROR("ProvMsg2 integrity checking error:(ae%d)",ret); break; } - prov_get_ek2_input_t ek2_input; - if(memcpy_s(ek2_input.nonce, NONCE_SIZE, MSG2_TOP_FIELD_NONCE.payload, NONCE_SIZE)!=0){ - AESM_DBG_FATAL("memcpy error"); - ret = PVE_UNEXPECTED_ERROR; - break; + sgx_aes_gcm_128bit_key_t ek2; + uint8_t temp[NONCE_SIZE+XID_SIZE]; + if(0!=memcpy_s(temp, sizeof(temp), data.xid, XID_SIZE)|| + 0!=memcpy_s(temp+XID_SIZE, sizeof(temp)-XID_SIZE, MSG2_TOP_FIELD_NONCE.payload, NONCE_SIZE)){ + AESM_DBG_ERROR("memcpy error"); + ret = AE_FAILURE; + break; } - if(memcpy_s(ek2_input.xid, XID_SIZE, msg2_header->xid, XID_SIZE)!=0){ - AESM_DBG_FATAL("memcpy error"); - ret = PVE_UNEXPECTED_ERROR; - break; - } - //call PvE to get EK2 - se_static_assert(SK_SIZE == sizeof(prov_get_ek2_output_t)); - ret = static_cast(get_ek2(&ek2_input, reinterpret_cast(ek2))); - if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to get EK2:%d",ret); - break; + se_static_assert(sizeof(sgx_cmac_128bit_key_t)==SK_SIZE); + if((sgx_status=sgx_rijndael128_cmac_msg(reinterpret_cast(data.sk), + temp, XID_SIZE+NONCE_SIZE, &ek2))!=SGX_SUCCESS){ + AESM_DBG_ERROR("Fail to generate ek2:(sgx 0x%x)",sgx_status); + ret = AE_FAILURE; + break; } + if(tlvs_msg2.get_tlv_count() == MSG2_TOP_FIELDS_COUNT_WITH_SIGRL){//RLver and gid is added as part of AAD if available sigrl = reinterpret_cast(MSG2_TOP_FIELD_SIGRL.payload); if(0!=memcpy_s(aad+PROVISION_RESPONSE_HEADER_SIZE, sizeof(RLver_t), &sigrl->sig_rl.RLver, sizeof(RLver_t))){ @@ -359,47 +356,53 @@ uint32_t CPVEClass::proc_prov_msg2( break; } //decrypt ProvMsg2 by EK2 - sgx_status_t sgx_status = sgx_rijndael128GCM_decrypt(reinterpret_cast(ek2), - field1.msg_buf, field1.msg_size, decoded_msg2, - reinterpret_cast(block_cipher_tlv_get_iv(MSG2_TOP_FIELD_DATA)), IV_SIZE, + sgx_status_t sgx_status = sgx_rijndael128GCM_decrypt(&ek2, + field1.msg_buf, field1.msg_size, decoded_msg2, + reinterpret_cast(block_cipher_tlv_get_iv(MSG2_TOP_FIELD_DATA)), IV_SIZE, aad, static_cast(aad_size), reinterpret_cast(MSG2_TOP_FIELD_MAC.payload)); if(SGX_ERROR_MAC_MISMATCH == sgx_status){ - AESM_DBG_ERROR("Fail to decrypt ProvMsg2 body by EK2"); + AESM_DBG_ERROR("Fail to decrypt ProvMsg2 body by EK2 (sgx0x%x)",sgx_status); ret = PVE_INTEGRITY_CHECK_ERROR; break; } if( AE_SUCCESS != (ret = sgx_error_to_ae_error(sgx_status))){ - AESM_DBG_ERROR("error in decrypting ProvMsg2 body:%d",sgx_status); + AESM_DBG_ERROR("error in decrypting ProvMsg2 body:(sgx0x%x)",sgx_status); break; } ret = check_epid_pve_pg_status_after_mac_verification(msg2_header); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Backend server reported error in ProvMsg2 passed MAC verification:%d",ret); + AESM_DBG_ERROR("Backend server reported error in ProvMsg2 passed MAC verification:(ae%d)",ret); break; } TLVsMsg tlvs_field1; tlv_status = tlvs_field1.init_from_buffer(decoded_msg2, field1.msg_size);//decode TLV structure of field1 of ProvMsg2 ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("Fail to decode field1 of ProvMsg2:%d",tlv_status); + AESM_DBG_ERROR("Fail to decode field1 of ProvMsg2:(ae%d)",ret); break; } - proc_prov_msg2_blob_input_t msg2_blob_input; - ret = msg2_field1_msg_check_copy(tlvs_field1, msg2_blob_input, pek);//version/type checking to verify message format + proc_prov_msg2_blob_input_t msg2_blob_input={0}; + ret = CPCEClass::instance().load_enclave();//Load PCE enclave now + if( ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PCE enclave:(ae%d)\n",ret); + break; + } + ret = (ae_error_t)CPCEClass::instance().get_pce_target(&msg2_blob_input.pce_target_info); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("fail to get PCE target info:(ae%d)\n",ret); + break; + } + ret = msg2_field1_msg_check_copy(tlvs_field1, msg2_blob_input, data.pek);//version/type checking to verify message format if( AE_SUCCESS != ret){ - AESM_DBG_ERROR("field1 of ProvMsg2 checking error:%d",ret); + AESM_DBG_ERROR("field1 of ProvMsg2 checking error:( ae%d)",ret); break; } gen_prov_msg3_output_t msg3_fixed_output; memset(&msg3_fixed_output, 0, sizeof(msg3_fixed_output)); //collect old epid blob if(epid_blob==NULL){ - memset(msg2_blob_input.old_epid_data_blob, 0, HARD_CODED_EPID_BLOB_SIZE); - }else if(blob_size!=HARD_CODED_EPID_BLOB_SIZE){ - AESM_DBG_FATAL("epid blob internal size error"); - ret = PVE_UNEXPECTED_ERROR; - break; + memset(msg2_blob_input.old_epid_data_blob, 0, SGX_TRUSTED_EPID_BLOB_SIZE_PAK); }else{ #ifdef DBG_LOG { @@ -408,58 +411,93 @@ uint32_t CPVEClass::proc_prov_msg2( AESM_DBG_TRACE("old epid blob=%s",dbg_str); } #endif - if(0!=memcpy_s(msg2_blob_input.old_epid_data_blob, HARD_CODED_EPID_BLOB_SIZE, epid_blob, blob_size)){ + if (0 != memcpy_s(msg2_blob_input.old_epid_data_blob, SGX_TRUSTED_EPID_BLOB_SIZE_PAK, epid_blob, blob_size)){ AESM_DBG_FATAL("memcpy error"); ret = PVE_UNEXPECTED_ERROR; break; } } - uint32_t epid_sig_output_size = estimate_epid_sig_size(sigrl_size) + MAX_TLV_HEADER_SIZE; + if(0!=memcpy_s(&msg2_blob_input.pek,sizeof(data.pek), &data.pek, sizeof(data.pek))){ + AESM_DBG_ERROR("memcpy error"); + ret = AE_FAILURE; + break; + } + if (AE_SUCCESS != (ret = XEGDBlob::instance().read(msg2_blob_input.xegb))){ + AESM_DBG_ERROR("Fail to read extend epid group blob info "); + return ret; + } + + uint32_t epid_sig_output_size = estimate_epid_sig_size(sigrl_size); + //estimate_epid_sig_size(sigrl_size)=0, which means the sigrl is invalid. + if(epid_sig_output_size == 0){ + AESM_DBG_ERROR("Invalid SIGRL size %d", sigrl_size); + ret = PVE_MSG_ERROR; + break; + } epid_sig = reinterpret_cast(malloc(epid_sig_output_size)); if(NULL == epid_sig){ AESM_DBG_ERROR("malloc error"); ret = AE_OUT_OF_MEMORY_ERROR; break; } - ret = (ae_error_t)proc_prov_msg2_data(&msg2_blob_input, reinterpret_cast(sigrl), sigrl_size, + ret = CPVEClass::instance().load_enclave();//Load PvE enclave now + if( ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PvE enclave:(ae%d)\n",ret); + break; + } + ret = (ae_error_t)proc_prov_msg2_data(&msg2_blob_input, data.is_performance_rekey, reinterpret_cast(sigrl), sigrl_size, &msg3_fixed_output, epid_sig, epid_sig_output_size);//ecall to process msg2 data and generate msg3 data in PvE if( PVE_EPIDBLOB_ERROR == ret){ - if(previous_psvn == NULL){ - AESM_DBG_ERROR("PvE requires previous PSVN but it is not provided"); - ret = PVE_PARAMETER_ERROR; + if(0!=memcpy_s(&data.bpi, sizeof(bk_platform_info_t), &msg2_blob_input.previous_pi, sizeof(bk_platform_info_t))){ + AESM_DBG_FATAL("memcpy error"); + ret = PVE_UNEXPECTED_ERROR; break; - }else{//output previous svn in correspondent to sigrl in epid blob error - if(0!=memcpy_s(previous_psvn, sizeof(psvn_t), &msg2_blob_input.previous_psvn, sizeof(psvn_t))){ - AESM_DBG_FATAL("memcpy error"); - ret = PVE_UNEXPECTED_ERROR; - break; - } + } } if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("PvE report error %d in processing ProvMsg2",ret); + AESM_DBG_ERROR("PvE report error (ae%d) in processing ProvMsg2",ret); break; } + uint8_t ecdsa_sign[64]; + psvn_t psvn={0}; + if(0!=memcpy_s(&psvn.cpu_svn,sizeof(sgx_cpu_svn_t), &msg2_blob_input.equiv_pi.cpu_svn, sizeof(sgx_cpu_svn_t))|| + 0!=memcpy_s(&psvn.isv_svn, sizeof(sgx_isv_svn_t), &msg2_blob_input.equiv_pi.pce_svn, sizeof(sgx_isv_svn_t))){ + ret = PVE_UNEXPECTED_ERROR; + break; + } + ret = CPCEClass::instance().load_enclave();//Load PCE enclave now + if( ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PCE enclave:(ae%d)\n",ret); + break; + } + ret = (ae_error_t)CPCEClass::instance().sign_report(psvn, msg3_fixed_output.pwk2_report, ecdsa_sign); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("PCE report error (ae%d) in sign report",ret); + break; + } + CPCEClass::instance().unload_enclave(); uint8_t iv[IV_SIZE]; uint8_t mac[MAC_SIZE]; uint8_t *payload_data=NULL; uint32_t payload_size = 0; ret = aesm_read_rand(iv, IV_SIZE); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("fail to generate random number:%d",ret); + + AESM_DBG_ERROR("fail to generate random number:(ae%d)",ret); break; } //Now start to generate ProvMsg3 - ret = gen_msg3_header(msg3_fixed_output, ek2_input.xid, msg3_header,msg3_size);//first generate header + ret = gen_msg3_header(msg3_fixed_output, data.xid, msg3_header,msg3_size);//first generate header if( AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to generate ProvMsg3 Header:%d",ret); + AESM_DBG_ERROR("Fail to generate ProvMsg3 Header:(ae%d)",ret); break; } TLVsMsg tlvs_msg3; - tlv_status = tlvs_msg3.add_nonce(ek2_input.nonce, NONCE_SIZE); + tlv_status = tlvs_msg3.add_nonce(MSG2_TOP_FIELD_NONCE.payload, NONCE_SIZE); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("Fail to generate Nonce TLV in ProvMsg3:%d",tlv_status); + AESM_DBG_ERROR("Fail to generate Nonce TLV in ProvMsg3:(ae%d)",ret); break; } if(msg3_fixed_output.is_join_proof_generated){ @@ -470,13 +508,31 @@ uint32_t CPVEClass::proc_prov_msg2( tlv_status = tlvs_m3field1.add_block_cipher_text(msg3_fixed_output.field1_iv, payload_data, payload_size); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to generate Field3.1 TLV in ProvMsg3:%d",tlv_status); + AESM_DBG_ERROR("Fail to generate Field3.1 TLV in ProvMsg3:(ae%d)", ret); break; } tlv_status = tlvs_m3field1.add_mac(msg3_fixed_output.field1_mac); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to generate Field3.2 TLV in ProvMsg3:%d",tlv_status); + AESM_DBG_ERROR("Fail to generate Field3.2 TLV in ProvMsg3:(ae%d)",ret); + break; + } + tlv_status = tlvs_m3field1.add_nonce(msg3_fixed_output.n2, NONCE_2_SIZE); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Field3.3 NONCE TLV N2 in ProvMsg3:(ae %d)",ret); + break; + } + tlv_status = tlvs_m3field1.add_cipher_text(msg3_fixed_output.encrypted_pwk2, PVE_RSA_KEY_BYTES, PEK_PUB); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Field3.4 SE Report TLV in ProvMsg3:(ae %d)",ret); + break; + } + tlv_status = tlvs_m3field1.add_pce_report_sign(msg3_fixed_output.pwk2_report.body, ecdsa_sign); + ret = tlv_error_2_pve_error(tlv_status); + if(AE_SUCCESS != ret){ + AESM_DBG_ERROR("Fail to generate Field3.5 PCE Report Sign TLV in ProvMsg3:(ae %d)",ret); break; } encrypted_field1 = reinterpret_cast(malloc(tlvs_m3field1.get_tlv_msg_size())); @@ -486,39 +542,41 @@ uint32_t CPVEClass::proc_prov_msg2( break; } //encrypt field1 using ek2 as key - sgx_status = sgx_rijndael128GCM_encrypt(reinterpret_cast(ek2), - tlvs_m3field1.get_tlv_msg(), tlvs_m3field1.get_tlv_msg_size(), encrypted_field1, + + sgx_status = sgx_rijndael128GCM_encrypt(&ek2, + tlvs_m3field1.get_tlv_msg(), tlvs_m3field1.get_tlv_msg_size(), encrypted_field1, iv, IV_SIZE, reinterpret_cast(msg3_header), PROVISION_REQUEST_HEADER_SIZE, reinterpret_cast(mac)); if(AE_SUCCESS != (ret = sgx_error_to_ae_error(sgx_status))){ - AESM_DBG_ERROR("fail to encrypting ProvMsg3 body by ek2:%d",sgx_status); + AESM_DBG_ERROR("fail to encrypting ProvMsg3 body by ek2:(sgx0x%x)",sgx_status); break; } tlv_status = tlvs_msg3.add_block_cipher_text(iv, encrypted_field1, tlvs_m3field1.get_tlv_msg_size()); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to create Field1 TLV of ProvMsg3:%d",tlv_status); + AESM_DBG_ERROR("Fail to create Field1 TLV of ProvMsg3:(ae%d)",ret); break; } ret = tlv_error_2_pve_error(tlvs_msg3.add_mac(mac)); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to create Field2 TLV of ProvMsg3:%d",ret); + AESM_DBG_ERROR("Fail to create Field2 TLV of ProvMsg3:(ae%d)",ret); break; } if(msg3_fixed_output.is_epid_sig_generated){ tlv_status = tlvs_msg3.add_block_cipher_text(msg3_fixed_output.epid_sig_iv, epid_sig, msg3_fixed_output.epid_sig_output_size); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to create Field3 TLV of ProvMsg3:%d",tlv_status); + AESM_DBG_ERROR("Fail to create Field3 TLV of ProvMsg3:(ae%d)",ret); break; } tlv_status = tlvs_msg3.add_mac(msg3_fixed_output.epid_sig_mac); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Fail to create Field4 TLV of ProvMsg3:%d",tlv_status); + AESM_DBG_ERROR("Fail to create Field4 TLV of ProvMsg3:(ae%d)",ret); break; } } + assert( tlvs_msg3.get_tlv_msg_size() <= msg3_size - PROVISION_REQUEST_HEADER_SIZE);//The checking should have been done in header generation if(0!=memcpy_s(msg3+PROVISION_REQUEST_HEADER_SIZE, msg3_size-PROVISION_REQUEST_HEADER_SIZE, diff --git a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp index 18cccf91e0..289edc0e9f 100644 --- a/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp +++ b/psw/ae/aesm_service/source/epid_provision/epid_provision_msg4.cpp @@ -29,17 +29,15 @@ * */ - #include "type_length_value.h" -#include "sgx_tcrypto_internal.h" #include #include "epid_utility.h" +#include "aesm_xegd_blob.h" #include "aeerror.h" #include "PVEClass.h" -#include "se_wrapper.h" -#include "oal/internal_log.h" + /** -* File: epid_provision_msg4.cpp +* File: epid_provision_msg4.cpp * Description: Provide the untrusted implementation of code to process ProvMsg4 * * Untrusted Code for EPID Provision @@ -49,13 +47,12 @@ #define MSG4_TOP_FIELD_DATA tlvs_msg4[1] #define MSG4_TOP_FIELD_MAC tlvs_msg4[2] -#define MSG4_FIELD1_COUNT 6 -#define MSG4_FIELD1_DEVICE_ID tlvs_field1[5] -#define MSG4_FIELD1_ENC_TCB tlvs_field1[0] -#define MSG4_FIELD1_MAC_TCB tlvs_field1[1] -#define MSG4_FIELD1_ENC_Axf tlvs_field1[2] -#define MSG4_FIELD1_MAC_Axf tlvs_field1[3] -#define MSG4_FIELD1_GROUP_CERT tlvs_field1[4] +#define MSG4_FIELD1_COUNT 5 +#define MSG4_FIELD1_PLATFORM_INFO tlvs_field1[4] +#define MSG4_FIELD1_Nonce2 tlvs_field1[0] +#define MSG4_FIELD1_ENC_Axf tlvs_field1[1] +#define MSG4_FIELD1_MAC_Axf tlvs_field1[2] +#define MSG4_FIELD1_GROUP_CERT tlvs_field1[3] static ae_error_t msg4_integrity_checking(const TLVsMsg& tlvs_msg4) @@ -63,8 +60,8 @@ static ae_error_t msg4_integrity_checking(const TLVsMsg& tlvs_msg4) uint32_t tlv_count = tlvs_msg4.get_tlv_count(); if(tlv_count != MSG4_TOP_FIELDS_COUNT) return PVE_INTEGRITY_CHECK_ERROR; - if(MSG4_TOP_FIELD_NONCE.type != TLV_NONCE || MSG4_TOP_FIELD_NONCE.size != NONCE_SIZE || - MSG4_TOP_FIELD_NONCE.version != TLV_VERSION_1 || MSG4_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE) + if(MSG4_TOP_FIELD_NONCE.type != TLV_NONCE || MSG4_TOP_FIELD_NONCE.version != TLV_VERSION_1 || + MSG4_TOP_FIELD_NONCE.size != NONCE_SIZE || MSG4_TOP_FIELD_NONCE.header_size != SMALL_TLV_HEADER_SIZE) return PVE_INTEGRITY_CHECK_ERROR; if(MSG4_TOP_FIELD_DATA.type != TLV_BLOCK_CIPHER_TEXT || MSG4_TOP_FIELD_DATA.version != TLV_VERSION_1) return PVE_INTEGRITY_CHECK_ERROR; @@ -85,22 +82,9 @@ static ae_error_t msg4_field1_msg_checking(const TLVsMsg& tlvs_field1) if(tlvs_field1[i].version != TLV_VERSION_1) return PVE_MSG_ERROR; - - if(MSG4_FIELD1_GROUP_CERT.type != TLV_EPID_GROUP_CERT|| - MSG4_FIELD1_GROUP_CERT.size != sizeof(signed_epid_group_cert_t)|| - MSG4_FIELD1_GROUP_CERT.header_size != SMALL_TLV_HEADER_SIZE) - return PVE_MSG_ERROR; - - if(MSG4_FIELD1_DEVICE_ID.type != TLV_DEVICE_ID || - MSG4_FIELD1_DEVICE_ID.size != sizeof(device_id_t)|| - MSG4_FIELD1_DEVICE_ID.header_size != SMALL_TLV_HEADER_SIZE) - return PVE_MSG_ERROR; - if(MSG4_FIELD1_ENC_TCB.type != TLV_BLOCK_CIPHER_TEXT|| - MSG4_FIELD1_ENC_TCB.size != BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(SK_SIZE)) - return PVE_MSG_ERROR; - if(MSG4_FIELD1_MAC_TCB.type != TLV_MESSAGE_AUTHENTICATION_CODE|| - MSG4_FIELD1_MAC_TCB.size != MAC_SIZE || - MSG4_FIELD1_MAC_TCB.header_size != SMALL_TLV_HEADER_SIZE) + if(MSG4_FIELD1_Nonce2.type != TLV_NONCE || + MSG4_FIELD1_Nonce2.size != NONCE_2_SIZE || + MSG4_FIELD1_Nonce2.header_size != SMALL_TLV_HEADER_SIZE) return PVE_MSG_ERROR; if(MSG4_FIELD1_ENC_Axf.type != TLV_BLOCK_CIPHER_TEXT|| MSG4_FIELD1_ENC_Axf.size != BLOCK_CIPHER_TEXT_TLV_PAYLOAD_SIZE(HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE)) @@ -109,16 +93,24 @@ static ae_error_t msg4_field1_msg_checking(const TLVsMsg& tlvs_field1) MSG4_FIELD1_MAC_Axf.size != MAC_SIZE|| MSG4_FIELD1_MAC_Axf.header_size != SMALL_TLV_HEADER_SIZE) return PVE_MSG_ERROR; + if(MSG4_FIELD1_GROUP_CERT.type != TLV_EPID_GROUP_CERT|| + MSG4_FIELD1_GROUP_CERT.size != sizeof(signed_epid_group_cert_t)|| + MSG4_FIELD1_GROUP_CERT.header_size != SMALL_TLV_HEADER_SIZE) + return PVE_MSG_ERROR; + if (MSG4_FIELD1_PLATFORM_INFO.type != TLV_PLATFORM_INFO || + MSG4_FIELD1_PLATFORM_INFO.size != sizeof(bk_platform_info_t) || + MSG4_FIELD1_PLATFORM_INFO.header_size != SMALL_TLV_HEADER_SIZE) + return PVE_MSG_ERROR; return AE_SUCCESS; } //Function to check message header of ProvMsg4 to determine whether it is valid //@msg4_header, input the message header of ProvMsg4 -//@return AE_SUCCESS if the message header is valid ProvMsg4 or error code if there're any problems +//@return PVEC_SUCCESS if the message header is valid ProvMsg4 or error code if there're any problems static ae_error_t check_prov_msg4_header(const provision_response_header_t *msg4_header, uint32_t msg4_size) { if(msg4_header->protocol != SE_EPID_PROVISIONING || msg4_header->type != TYPE_PROV_MSG4 || - msg4_header->version != TLV_VERSION_1){ + msg4_header->version != TLV_VERSION_2){ return PVE_INTEGRITY_CHECK_ERROR; } uint32_t size_in_header = lv_ntohl(msg4_header->size); @@ -130,78 +122,71 @@ static ae_error_t check_prov_msg4_header(const provision_response_header_t *msg4 //Function to decode ProvMsg4 and generate epid data blob uint32_t CPVEClass::proc_prov_msg4( - bool use_ek2_in_input, - const uint8_t ek2[SK_SIZE], - const uint8_t* msg4, + const pve_data_t &data, + const uint8_t *msg4, uint32_t msg4_size, - uint8_t* data_blob, + uint8_t *data_blob, uint32_t blob_size) { ae_error_t ret = AE_SUCCESS; uint8_t local_ek2[SK_SIZE]; uint8_t *decoded_msg4 = NULL; + uint8_t temp[XID_SIZE+NONCE_SIZE]; + sgx_status_t sgx_status; const provision_response_header_t *msg4_header = reinterpret_cast(msg4); if(msg4_size < PROVISION_RESPONSE_HEADER_SIZE){ AESM_DBG_ERROR("invalid msg4 size"); return PVE_MSG_ERROR; } - if(blob_size != HARD_CODED_EPID_BLOB_SIZE){ + if (blob_size != SGX_TRUSTED_EPID_BLOB_SIZE_PAK){ AESM_DBG_FATAL("invalid input epid blob size"); return PVE_PARAMETER_ERROR; } ret = check_prov_msg4_header(msg4_header, msg4_size); if( AE_SUCCESS != ret){ - AESM_DBG_ERROR("Invalid ProvMsg4 Header:%d",ret); + AESM_DBG_ERROR("Invalid ProvMsg4 Header:(ae%d)",ret); return ret; } + if(0!=memcmp(msg4_header->xid, data.xid, XID_SIZE)){ + AESM_DBG_ERROR("Invalid XID in msg4 header"); + return PVE_MSG_ERROR; + } ret = check_epid_pve_pg_status_before_mac_verification(msg4_header); if( AE_SUCCESS != ret){ - AESM_DBG_ERROR("Backend return failure in ProvMsg4 Header:%d",ret); + AESM_DBG_ERROR("Backend return failure in ProvMsg4 Header:(ae%d)",ret); return ret; } do{ TLVsMsg tlvs_msg4; + uint8_t aad[PROVISION_RESPONSE_HEADER_SIZE+NONCE_SIZE]; tlv_status_t tlv_status; tlv_status = tlvs_msg4.init_from_buffer(msg4+static_cast(PROVISION_RESPONSE_HEADER_SIZE), msg4_size - static_cast(PROVISION_RESPONSE_HEADER_SIZE)); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS!=ret){ - AESM_DBG_ERROR("fail to decode ProvMsg4:%d",tlv_status); + AESM_DBG_ERROR("fail to decode ProvMsg4:(ae%d)",ret); break; } ret = msg4_integrity_checking(tlvs_msg4); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("ProvMsg4 integrity checking error:%d",ret); + AESM_DBG_ERROR("ProvMsg4 integrity checking error:(ae%d)",ret); break; } AESM_DBG_TRACE("ProvMsg4 decoded"); - if(!use_ek2_in_input){ //we need generate ek2 - prov_get_ek2_input_t ek2_input; - if(memcpy_s(ek2_input.nonce, NONCE_SIZE, MSG4_TOP_FIELD_NONCE.payload, NONCE_SIZE)!=0){ - AESM_DBG_ERROR("fail in memcpy"); - ret = PVE_UNEXPECTED_ERROR; + se_static_assert(sizeof(sgx_cmac_128bit_key_t)==SK_SIZE); + if(0!=memcpy_s(temp,sizeof(temp), data.xid, XID_SIZE)|| + 0!=memcpy_s(temp+XID_SIZE, sizeof(temp)-XID_SIZE, MSG4_TOP_FIELD_NONCE.payload, NONCE_SIZE)){ + AESM_DBG_ERROR("Fail in memcpy"); + ret = AE_FAILURE; break; - } - if(memcpy_s(ek2_input.xid, XID_SIZE, msg4_header->xid, XID_SIZE)!=0){ - AESM_DBG_ERROR("fail in memcpy"); - ret = PVE_UNEXPECTED_ERROR; + } + if((sgx_status=sgx_rijndael128_cmac_msg(reinterpret_cast(data.sk), + temp, XID_SIZE+NONCE_SIZE, reinterpret_cast(local_ek2)))!=SGX_SUCCESS){ + AESM_DBG_ERROR("Fail to generate ek2:(sgx0x%x)",sgx_status); + ret = AE_FAILURE; break; - } - //call PvE to get EK2 - se_static_assert(SK_SIZE == sizeof(prov_get_ek2_output_t)); - ret = (ae_error_t)get_ek2(&ek2_input, reinterpret_cast(local_ek2)); - if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("fail to get EK2:%d",ret); - break; - } - }else{//reuse ek2 generated in processing ProvMsg2 - if(0!=memcpy_s(local_ek2, sizeof(local_ek2), ek2, SK_SIZE)){ - AESM_DBG_ERROR("fail in memcpy"); - ret = PVE_UNEXPECTED_ERROR; - break; - } } se_static_assert(SK_SIZE==sizeof(sgx_aes_gcm_128bit_key_t)); tlv_msg_t field1 = block_cipher_tlv_get_encrypted_text(MSG4_TOP_FIELD_DATA); @@ -211,52 +196,51 @@ uint32_t CPVEClass::proc_prov_msg4( ret = AE_OUT_OF_MEMORY_ERROR; break; } + if (memcpy_s(aad, sizeof(aad), msg4_header, PROVISION_RESPONSE_HEADER_SIZE) != 0 || + memcpy_s(aad + PROVISION_RESPONSE_HEADER_SIZE, sizeof(aad)-PROVISION_RESPONSE_HEADER_SIZE, + MSG4_TOP_FIELD_NONCE.payload, MSG4_TOP_FIELD_NONCE.size) != 0){ + AESM_DBG_ERROR("memcpy failure"); + ret = AE_FAILURE; + break; + } sgx_status_t sgx_status = sgx_rijndael128GCM_decrypt(reinterpret_cast(local_ek2), - field1.msg_buf, field1.msg_size, decoded_msg4, - reinterpret_cast(block_cipher_tlv_get_iv(MSG4_TOP_FIELD_DATA)), IV_SIZE, - reinterpret_cast(msg4_header), PROVISION_RESPONSE_HEADER_SIZE, + field1.msg_buf, field1.msg_size, decoded_msg4, + reinterpret_cast(block_cipher_tlv_get_iv(MSG4_TOP_FIELD_DATA)), IV_SIZE, + aad, sizeof(aad), reinterpret_cast(MSG4_TOP_FIELD_MAC.payload)); if(SGX_ERROR_MAC_MISMATCH == sgx_status){ - AESM_DBG_ERROR("fail to decrypt ProvMsg4 by EK2"); + AESM_DBG_ERROR("fail to decrypt ProvMsg4 by EK2 (sgx0x%x)",sgx_status); ret = PVE_INTEGRITY_CHECK_ERROR; break; } if( AE_SUCCESS != (ret = sgx_error_to_ae_error(sgx_status))){ - AESM_DBG_ERROR("error in decrypting ProvMsg4:%d",sgx_status); + AESM_DBG_ERROR("error in decrypting ProvMsg4:(sgx0x%x)",sgx_status); break; } AESM_DBG_TRACE("ProvMsg4 decrypted by EK2 successfully"); ret = check_epid_pve_pg_status_after_mac_verification(msg4_header); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("Backend reported error passed MAC verification:%d",ret); + AESM_DBG_ERROR("Backend reported error passed MAC verification:(ae%d)",ret); break; } TLVsMsg tlvs_field1; tlv_status = tlvs_field1.init_from_buffer(decoded_msg4, field1.msg_size); ret = tlv_error_2_pve_error(tlv_status); if(AE_SUCCESS != ret){ - AESM_DBG_ERROR("ProvMsg4 Field2.1 decoding failed:%d",tlv_status); + AESM_DBG_ERROR("ProvMsg4 Field2.1 decoding failed:(ae%d)",ret); break; } ret = msg4_field1_msg_checking(tlvs_field1); if( AE_SUCCESS != ret){ - AESM_DBG_ERROR("ProvMsg4 Field2.1 invalid:%d",ret); + AESM_DBG_ERROR("ProvMsg4 Field2.1 invalid:(ae%d)",ret); break; } proc_prov_msg4_input_t msg4_input; - if(sizeof(proc_prov_msg4_output_t)!=SGX_TRUSTED_EPID_BLOB_SIZE){ - AESM_DBG_FATAL("Trusted ProvMsg4 output buffer size error"); - ret = PVE_UNEXPECTED_ERROR; - break; - } - tlv_msg_t tcb_data = block_cipher_tlv_get_encrypted_text(MSG4_FIELD1_ENC_TCB); tlv_msg_t Axf_data = block_cipher_tlv_get_encrypted_text(MSG4_FIELD1_ENC_Axf); if(0!=memcpy_s(&msg4_input.group_cert, sizeof(msg4_input.group_cert), MSG4_FIELD1_GROUP_CERT.payload, MSG4_FIELD1_GROUP_CERT.size)|| - 0!=memcpy_s(&msg4_input.equivalent_psvn, sizeof(psvn_t), device_id_tlv_get_psvn(MSG4_FIELD1_DEVICE_ID), sizeof(psvn_t))|| - 0!=memcpy_s(&msg4_input.fmsp, sizeof(fmsp_t), device_id_tlv_get_fmsp(MSG4_FIELD1_DEVICE_ID), sizeof(fmsp_t))|| - 0!=memcpy_s(&msg4_input.tcb_iv, IV_SIZE, block_cipher_tlv_get_iv(MSG4_FIELD1_ENC_TCB), IV_SIZE)|| - 0!=memcpy_s(&msg4_input.encrypted_tcb, SK_SIZE, tcb_data.msg_buf, tcb_data.msg_size)|| - 0!=memcpy_s(&msg4_input.tcb_mac, MAC_SIZE, MSG4_FIELD1_MAC_TCB.payload, MSG4_FIELD1_MAC_TCB.size)|| + 0!=memcpy_s(&msg4_input.n2, NONCE_2_SIZE, MSG4_FIELD1_Nonce2.payload, MSG4_FIELD1_Nonce2.size) || + 0!=memcpy_s(&msg4_input.equivalent_psvn, sizeof(psvn_t), platform_info_tlv_get_psvn(MSG4_FIELD1_PLATFORM_INFO), sizeof(psvn_t))|| + 0!=memcpy_s(&msg4_input.fmsp, sizeof(fmsp_t), platform_info_tlv_get_fmsp(MSG4_FIELD1_PLATFORM_INFO), sizeof(fmsp_t))|| 0!=memcpy_s(&msg4_input.member_credential_iv, IV_SIZE, block_cipher_tlv_get_iv(MSG4_FIELD1_ENC_Axf), IV_SIZE)|| 0!=memcpy_s(&msg4_input.encrypted_member_credential, HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE, Axf_data.msg_buf, Axf_data.msg_size)|| 0!=memcpy_s(&msg4_input.member_credential_mac, MAC_SIZE, MSG4_FIELD1_MAC_Axf.payload, MSG4_FIELD1_MAC_Axf.size)){ @@ -264,8 +248,18 @@ uint32_t CPVEClass::proc_prov_msg4( ret = PVE_UNEXPECTED_ERROR; break; } + if (AE_SUCCESS != (ret =XEGDBlob::instance().read(msg4_input.xegb))){ + AESM_DBG_ERROR("Fail to read extend epid blob info (ae%d)",ret); + return ret; + } + + ret = CPVEClass::instance().load_enclave();//Load PvE enclave now + if( ret != AE_SUCCESS){ + AESM_DBG_ERROR("Fail to load PvE enclave:(ae%d)\n",ret); + break; + } ret = (ae_error_t)proc_prov_msg4_data(&msg4_input, reinterpret_cast(data_blob)); - AESM_DBG_TRACE("PvE return %d in Process ProvMsg4",ret); + AESM_DBG_TRACE("PvE return (ae%d) in Process ProvMsg4",ret); }while(0); if(decoded_msg4)free(decoded_msg4); return ret; diff --git a/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp b/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp index 7e39e0cb79..6719638b17 100644 --- a/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp +++ b/psw/ae/aesm_service/source/epid_provision/epid_utility.cpp @@ -63,7 +63,7 @@ ae_error_t check_endpoint_pg_stauts(const provision_response_header_t *msg_heade case GRS_INTEGRITY_CHECK_FAIL: return PVE_INTEGRITY_CHECK_ERROR; case GRS_INCOMPATIBLE_VERSION://Backend report that PSW has used too old protocol, we need update PSW software - return PSW_UPDATED_REQUIRED; + return PSW_UPDATE_REQUIRED; case GRS_INCORRECT_SYNTAX: return PVE_MSG_ERROR; case GRS_OK: @@ -83,7 +83,7 @@ ae_error_t check_epid_pve_pg_status_before_mac_verification(const provision_res case GRS_INTEGRITY_CHECK_FAIL: return PVE_INTEGRITY_CHECK_ERROR; case GRS_INCOMPATIBLE_VERSION://Backend report that PSW has used too old protocol, we need update PSW software, no MAC provided - return PSW_UPDATED_REQUIRED; + return PSW_UPDATE_REQUIRED; case GRS_INCORRECT_SYNTAX: return PVE_MSG_ERROR; case GRS_OK: @@ -114,6 +114,10 @@ ae_error_t check_epid_pve_pg_status_after_mac_verification(const provision_resp return PVE_REVOKED_ERROR; case SE_PRS_PERFORMANCE_REKEY_NOT_SUPPORTED: return PVE_PERFORMANCE_REKEY_NOT_SUPPORTED; + case SE_PRS_PROV_ATTEST_KEY_NOT_FOUND: + return PVE_PROV_ATTEST_KEY_NOT_FOUND; + case SE_PRS_INVALID_REPORT: + return PVE_INVALID_REPORT; default: return PVE_SERVER_REPORTED_ERROR; } diff --git a/psw/ae/aesm_service/source/le/LEClass.cpp b/psw/ae/aesm_service/source/le/LEClass.cpp index 3412fc3943..bdcbaef698 100644 --- a/psw/ae/aesm_service/source/le/LEClass.cpp +++ b/psw/ae/aesm_service/source/le/LEClass.cpp @@ -36,6 +36,8 @@ #include "arch.h" #include "ae_ipp.h" #include "util.h" +#include "service_enclave_mrsigner.hh" +#include "aesm_long_lived_thread.h" extern "C" sgx_status_t sgx_create_le(const char *file_name, const char *prd_css_file_name, const int debug, sgx_launch_token_t *launch_token, int *launch_token_updated, sgx_enclave_id_t *enclave_id, sgx_misc_attribute_t *misc_attr, int *production_loaded); @@ -50,6 +52,7 @@ int CLEClass::white_list_register( sgx_status_t ret = SGX_SUCCESS; int retry = 0; uint32_t status = 0; + AESMLogicLock locker(AESMLogic::_le_mutex); assert(m_enclave_id); @@ -83,6 +86,50 @@ void CLEClass::load_white_cert_list() load_verified_white_cert_list(); load_white_cert_list_to_be_verify();//If this version is older than previous one, it will not be loaded } +#include +#include "endpoint_select_info.h" +#include "stdint.h" + +#define UPDATE_DURATION (24*3600) +ae_error_t CLEClass::update_white_list_by_url() +{ + static time_t last_updated_time = 0; + int i = 0; + ae_error_t ret = AE_FAILURE; + time_t cur_time = time(NULL); + if (last_updated_time + UPDATE_DURATION > cur_time){ + return LE_WHITE_LIST_QUERY_BUSY; + } + for (i = 0; i < 2; i++){//at most retry once if network error + uint8_t *resp_buf = NULL; + uint32_t resp_size = 0; + const char *url = EndpointSelectionInfo::instance().get_server_url(SGX_WHITE_LIST_FILE); + if (NULL == url){ + return OAL_CONFIG_FILE_ERROR; + } + ret = aesm_network_send_receive(url, + NULL, 0, &resp_buf, &resp_size,GET, false); + if (ret == OAL_NETWORK_UNAVAILABLE_ERROR){ + AESM_DBG_WARN("Network failure in getting white list..."); + continue; + } + if (ret == AE_SUCCESS){ + if (resp_buf != NULL && resp_size > 0){ + ret = (ae_error_t)instance().white_list_register(resp_buf, resp_size, true); + if (AE_SUCCESS == ret&&resp_size >= sizeof(wl_cert_chain_t)){ + const wl_cert_chain_t* wl = reinterpret_cast(resp_buf); + } + else{ + ret = AE_FAILURE;//Internal error, maybe LE not consistent with AESM? + } + } + last_updated_time = cur_time; + aesm_free_network_response_buffer(resp_buf); + } + break; + } + return ret; +} ae_error_t CLEClass::load_verified_white_cert_list() { @@ -189,11 +236,16 @@ ae_error_t CLEClass::load_enclave_only() &m_attributes, &production_le_loaded); if (ret == SGX_ERROR_NO_DEVICE){ AESM_DBG_ERROR("AE SERVER NOT AVAILABLE in load non-production signed LE: %s",enclave_path); - return AE_SERVER_NOT_AVAILABLE; + return AESM_AE_NO_DEVICE; + } + if(ret == SGX_ERROR_OUT_OF_EPC) + { + AESM_DBG_ERROR("Loading LE failed due to out of epc"); + return AESM_AE_OUT_OF_EPC; } if (ret != SGX_SUCCESS){ AESM_DBG_ERROR("Loading LE failed:%d",ret); - return AE_FAILURE; + return AE_SERVER_NOT_AVAILABLE; }else if(production_le_loaded!=0){//production signed LE loaded AESM_DBG_INFO("Production signed LE loaded, try loading white list now"); }else{ @@ -219,7 +271,8 @@ int CLEClass::get_launch_token( uint8_t * mrenclave, uint32_t mrenclave_size, uint8_t *public_key, uint32_t public_key_size, uint8_t *se_attributes, uint32_t se_attributes_size, - uint8_t * lictoken, uint32_t lictoken_size + uint8_t * lictoken, uint32_t lictoken_size, + uint32_t *ae_mrsigner_index ) { sgx_status_t ret = SGX_SUCCESS; @@ -240,11 +293,21 @@ int CLEClass::get_launch_token( if( ipperrorCode != ippStsNoErr){ return AE_FAILURE; } + if(ae_mrsigner_index!=NULL){ + *ae_mrsigner_index = UINT32_MAX; + for(uint32_t i=0;iflags, attr->xfrm); #endif //get launch token by ecall into LE @@ -267,5 +330,8 @@ int CLEClass::get_launch_token( if(SGX_SUCCESS!=ret) return sgx_error_to_ae_error(ret); + if (status == LE_WHITELIST_UNINITIALIZED_ERROR || status == LE_INVALID_PRIVILEGE_ERROR){ + start_white_list_thread(0);//try to query white list unblocking + } return status; } diff --git a/psw/ae/aesm_service/source/le/LEClass.h b/psw/ae/aesm_service/source/le/LEClass.h index c69a6461c4..0b71bbd691 100644 --- a/psw/ae/aesm_service/source/le/LEClass.h +++ b/psw/ae/aesm_service/source/le/LEClass.h @@ -54,12 +54,14 @@ public: uint8_t * mrenclave, uint32_t mrenclave_size, uint8_t *mrsigner, uint32_t mrsigner_size, uint8_t *se_attributes, uint32_t se_attributes_size, - uint8_t * lictoken, uint32_t lictoken_size + uint8_t * lictoken, uint32_t lictoken_size, + uint32_t *ae_mrsigner_value=NULL ); int white_list_register( const uint8_t *white_list_cert, uint32_t white_list_cert_size, bool save_to_persistent_storage=true); + static ae_error_t update_white_list_by_url(void); }; #endif diff --git a/psw/ae/aesm_service/source/network/network_encoding_wrapper.h b/psw/ae/aesm_service/source/network/network_encoding_wrapper.h index 0fc68064b8..1075574c18 100644 --- a/psw/ae/aesm_service/source/network/network_encoding_wrapper.h +++ b/psw/ae/aesm_service/source/network/network_encoding_wrapper.h @@ -39,7 +39,6 @@ #include "se_thread.h" #include "oal/oal.h" #include "se_wrapper.h" -#include "endpoint_select_info.h" /*Class for network interface inside AESM*/ class AESMNetworkEncoding{ diff --git a/psw/ae/aesm_service/source/oal/aesm_thread.cpp b/psw/ae/aesm_service/source/oal/aesm_thread.cpp index 85a6d110ac..7d3b2111fc 100644 --- a/psw/ae/aesm_service/source/oal/aesm_thread.cpp +++ b/psw/ae/aesm_service/source/oal/aesm_thread.cpp @@ -95,7 +95,11 @@ void* aesm_thread_proc(void* param) AESM_DBG_TRACE("thread parameters of thread %p copied",param); ae_error_t err = fun_entry(arg); AESM_DBG_TRACE("returned from user defined thread code for thread %p",param); - pthread_mutex_lock(&p->mutex); + if(pthread_mutex_lock(&p->mutex)!=0){ + p->status = AESM_THREAD_INVALID; + AESM_DBG_ERROR("fail to lock the thread mutex of thread %p",param); + return reinterpret_cast(static_cast(AE_FAILURE)); + } p->ae_ret = err; if(p->status == AESM_THREAD_RUNNING){ p->status = AESM_THREAD_PENDING; @@ -244,7 +248,10 @@ ae_error_t aesm_free_thread(aesm_thread_t h) ae_error_t aesm_wait_thread(aesm_thread_t h, ae_error_t *thread_ret, unsigned long milisecond) { AESM_DBG_TRACE("start to wait thread %p for %d ms",h,milisecond); - pthread_mutex_lock(&h->mutex); + if(pthread_mutex_lock(&h->mutex)!=0){ + AESM_DBG_TRACE("Fail to hold lock of thread %p",h); + return OAL_THREAD_ERROR; + } if(h->status==AESM_THREAD_PENDING||h->status==AESM_THREAD_DETACHED){//if the thread has been finished pthread_mutex_unlock(&h->mutex); AESM_DBG_TRACE("thread %p is pending",h); diff --git a/psw/ae/aesm_service/source/oal/aesm_util.cpp b/psw/ae/aesm_service/source/oal/aesm_util.cpp index d50b6ffb36..f863ceb3ef 100644 --- a/psw/ae/aesm_service/source/oal/aesm_util.cpp +++ b/psw/ae/aesm_service/source/oal/aesm_util.cpp @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include @@ -52,9 +54,9 @@ static ae_error_t aesm_get_path( if(0==dladdr(__builtin_return_address(0), &dl_info)|| NULL==dl_info.dli_fname) return AE_FAILURE; - if(strlen(dl_info.dli_fname)>buf_size-1) + if(strnlen(dl_info.dli_fname,buf_size)>=buf_size) return OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; - strncpy(p_file_path,dl_info.dli_fname,buf_size); + (void)strncpy(p_file_path,dl_info.dli_fname,buf_size); char* p_last_slash = strrchr(p_file_path, '/' ); if ( p_last_slash != NULL ) { @@ -62,9 +64,9 @@ static ae_error_t aesm_get_path( *p_last_slash = '\0'; //null terminate the string } else p_file_path[0] = '\0'; - if(strlen(p_file_path)+strlen(p_file_name)+sizeof(char)>buf_size) + if(strnlen(p_file_path,buf_size)+strnlen(p_file_name,buf_size)+sizeof(char)>buf_size) return OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; - strncat(p_file_path,p_file_name, strlen(p_file_name)); + (void)strncat(p_file_path,p_file_name, strnlen(p_file_name,buf_size)); return AE_SUCCESS; } @@ -77,10 +79,10 @@ static ae_error_t aesm_get_data_path( if(!p_file_name || !p_file_path) return OAL_PARAMETER_ERROR; - if(strlen(AESM_DATA_FOLDER)+strlen(p_file_name)+sizeof(char)>buf_size) + if(strlen(AESM_DATA_FOLDER)+strnlen(p_file_name,buf_size)+sizeof(char)>buf_size) return OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; - strcpy(p_file_path, AESM_DATA_FOLDER); - strncat(p_file_path,p_file_name, strlen(p_file_name)); + (void)strcpy(p_file_path, AESM_DATA_FOLDER); + (void)strncat(p_file_path,p_file_name, strnlen(p_file_name,buf_size)); return AE_SUCCESS; } @@ -95,11 +97,11 @@ static ae_error_t aesm_write_file( FILE* p_file = NULL; char p_full_path[MAX_PATH]= {0}; if(is_full_path){ - if(strlen(p_file_name)>MAX_PATH-1){ + if(strnlen(p_file_name,MAX_PATH)>=MAX_PATH){ ret = OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; goto CLEANUP; } - strcpy(p_full_path, p_file_name); + (void)strcpy(p_full_path, p_file_name); }else{ if((ret=aesm_get_data_path(p_file_name, p_full_path, MAX_PATH)) != AE_SUCCESS) goto CLEANUP; @@ -132,11 +134,11 @@ static ae_error_t aesm_read_file( FILE* p_file = NULL; char p_full_path[MAX_PATH]= {0}; if(is_full_path){ - if(strlen(p_file_name)>MAX_PATH-1){ + if(strnlen(p_file_name,MAX_PATH)>=MAX_PATH){ ret = OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; goto CLEANUP; } - strcpy(p_full_path, p_file_name); + (void)strcpy(p_full_path, p_file_name); }else{ if((ret=aesm_get_data_path(p_file_name, p_full_path, MAX_PATH)) != AE_SUCCESS) goto CLEANUP; @@ -155,31 +157,95 @@ CLEANUP: return ret; } -ae_error_t aesm_get_pathname(aesm_data_type_t type, aesm_data_id_t id, char *buf, uint32_t buf_size) +static ae_error_t aesm_remove_file( + const char *p_file_name, + bool is_full_path) +{ + ae_error_t ae_err = AE_FAILURE; + char p_full_path[MAX_PATH] = { 0 }; + if (is_full_path){ + if(strnlen(p_file_name,MAX_PATH)>=MAX_PATH){ + ae_err = OAL_PATHNAME_BUFFER_OVERFLOW_ERROR; + goto CLEANUP; + } + (void)strcpy(p_full_path, p_file_name); + } + else{ + if ((ae_err = aesm_get_data_path(p_file_name, p_full_path, MAX_PATH)) != AE_SUCCESS) + goto CLEANUP; + } + if (remove(p_full_path)){ + if (errno == ENOENT) + ae_err = AE_SUCCESS; + else + ae_err = OAL_FILE_ACCESS_ERROR; + goto CLEANUP; + } + ae_err = AE_SUCCESS; + +CLEANUP: + return ae_err; +} + +#define UPBOUND_OF_FORMAT 40 +ae_error_t aesm_get_pathname(aesm_data_type_t type, aesm_data_id_t id, char *buf, uint32_t buf_size, uint32_t xgid) { const persistent_storage_info_t *info = get_persistent_storage_info(id); + int num_bytes = 0; if(info == NULL) return OAL_PARAMETER_ERROR; if(info->type != type) return OAL_PARAMETER_ERROR; if(info->type == FT_ENCLAVE_NAME){ char local_info_name[MAX_PATH]; - sprintf(local_info_name,"libsgx_%s.signed.so",info->name); + if (xgid != INVALID_EGID){ + return AE_FAILURE; + } + if(strnlen(info->name, MAX_PATH)>=MAX_PATH-UPBOUND_OF_FORMAT){ + return AE_FAILURE;//info->name is a constant string and the length of it should not be too long so that the defense in depth codition here should never be triggered. + } + num_bytes = snprintf(local_info_name,MAX_PATH, "libsgx_%s.signed.so",info->name); + if(num_bytes<0||num_bytes>=MAX_PATH){ + return AE_FAILURE; + } return aesm_get_path(local_info_name, buf, buf_size); }else if(info->loc == AESM_LOCATION_DATA){ + if (xgid != INVALID_EGID){ + return AE_FAILURE; + } return aesm_get_data_path(info->name, buf, buf_size); + } + else if (info->loc == AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA){ + char name[MAX_PATH]; + int num_bytes = 0; + ae_error_t ae_err; + if (xgid == INVALID_EGID){//INVALID_EGID should not be used for file to support multi extended_epid_group + return AE_FAILURE; + } + if(strnlen(info->name,MAX_PATH)>=MAX_PATH-UPBOUND_OF_FORMAT){ + return AE_FAILURE;//defense in depth. info->name is a constant string and its size should be small + } + if ((num_bytes=snprintf(name, MAX_PATH, "%s.%08X", info->name, xgid)) < 0|| num_bytes>=MAX_PATH){ + return AE_FAILURE; + } + if ((ae_err = aesm_get_data_path(name, buf, buf_size)) != AE_SUCCESS) + return ae_err; + return AE_SUCCESS; }else{//info->loc == AESM_LOCATION_EXE_FOLDER + if (xgid != INVALID_EGID){ + return AE_FAILURE; + } return aesm_get_path(info->name, buf, buf_size); } } //alias function for aesm_get_pathname -ae_error_t aesm_get_cpathname(aesm_data_type_t type, aesm_data_id_t id, char *buf, uint32_t buf_size) +ae_error_t aesm_get_cpathname(aesm_data_type_t type, aesm_data_id_t id, char *buf, uint32_t buf_size, uint32_t xgid) { - return aesm_get_pathname(type, id, buf, buf_size); + return aesm_get_pathname(type, id, buf, buf_size, xgid); } -ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t *p_size) +ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t *p_size, uint32_t xgid) { char pathname[MAX_PATH]; ae_error_t ret = AE_SUCCESS; @@ -190,7 +256,7 @@ ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, u if(info->access == AESM_FILE_ACCESS_PATH_ONLY) return OAL_PARAMETER_ERROR; - ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH); + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH, xgid);//currently all in file if(ret != AE_SUCCESS) return ret; @@ -204,7 +270,7 @@ ae_error_t aesm_query_data_size(aesm_data_type_t type, aesm_data_id_t data_id, u return AE_SUCCESS; } -ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t *buf, uint32_t *p_size) +ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t *buf, uint32_t *p_size, uint32_t xgid) { char pathname[MAX_PATH]; ae_error_t ret = AE_SUCCESS; @@ -213,7 +279,7 @@ ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t return OAL_PARAMETER_ERROR; if(info->access == AESM_FILE_ACCESS_PATH_ONLY) return OAL_PARAMETER_ERROR; - ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH); + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH, xgid);//currently all in file if(ret != AE_SUCCESS) return ret; @@ -222,7 +288,7 @@ ae_error_t aesm_read_data(aesm_data_type_t type, aesm_data_id_t data_id, uint8_t return AE_SUCCESS; } -ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const uint8_t *buf, uint32_t size) +ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const uint8_t *buf, uint32_t size, uint32_t xgid) { char pathname[MAX_PATH]; ae_error_t ret = AE_SUCCESS; @@ -233,7 +299,7 @@ ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const if(info->access != AESM_FILE_ACCESS_ALL) return OAL_PARAMETER_ERROR; - ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH); + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH, xgid);//currently all in file if(ret != AE_SUCCESS) return ret; if((ret=aesm_write_file(buf, size, pathname, true))!=AE_SUCCESS) @@ -241,3 +307,22 @@ ae_error_t aesm_write_data(aesm_data_type_t type, aesm_data_id_t data_id, const return AE_SUCCESS; } +ae_error_t aesm_remove_data(aesm_data_type_t type, aesm_data_id_t data_id, uint32_t xgid) +{ + char pathname[MAX_PATH]; + ae_error_t ret = AE_SUCCESS; + + const persistent_storage_info_t *info = get_persistent_storage_info(data_id); + if (info == NULL) + return OAL_PARAMETER_ERROR; + if (info->access != AESM_FILE_ACCESS_ALL) + return OAL_PARAMETER_ERROR; + + ret = aesm_get_pathname(type, data_id, pathname, MAX_PATH, xgid);//currently all in file + if (ret != AE_SUCCESS){ + return ret; + } + if ((ret = aesm_remove_file(pathname, true)) != AE_SUCCESS) + return ret; + return AE_SUCCESS; +} diff --git a/psw/ae/aesm_service/source/oal/internal_log.cpp b/psw/ae/aesm_service/source/oal/internal_log.cpp index 4a692e3352..8c4c5d74ca 100644 --- a/psw/ae/aesm_service/source/oal/internal_log.cpp +++ b/psw/ae/aesm_service/source/oal/internal_log.cpp @@ -32,17 +32,22 @@ #ifdef DBG_LOG #include "oal/oal.h" -#include "se_wrapper.h" -#include "se_stdio.h" #include #include #include #include +#include +#include +#include #include "se_thread.h" +#include "type_length_value.h" +#include "aeerror.h" +#include "aesm_error.h" +#include "sgx_error.h" + static int aesm_trace_level = TRACE_LOG_LEVEL; static int at_start=1; -ae_error_t load_log_config(void); se_mutex_t cs; static ae_error_t init_log_file(void) { @@ -50,10 +55,94 @@ static ae_error_t init_log_file(void) ae_error_t err = aesm_get_pathname(FT_PERSISTENT_STORAGE, AESM_DBG_LOG_FID, filename, MAX_PATH); if(err != AE_SUCCESS) return err; - (void)load_log_config(); return AE_SUCCESS; } +#include +using namespace std; + +static const char *get_sgx_status_t_string(sgx_status_t status); +static const char *get_ae_error_t_string(ae_error_t ae_error); +static const char *get_aesm_error_t_string(aesm_error_t aesm_error); +static const char *get_tlv_enum_type_t_string(uint8_t type); + +const char *support_tags[] = { + "sgx", + "aesm",//matching longer tag before shorter one so aesm should be arranged before ae + "ae", + "tlv" +}; +#define COUNT_TAGS (sizeof(support_tags)/sizeof(support_tags[0])) +#define TAG_SGX 0 +#define TAG_AESM 1 +#define TAG_AE 2 +#define TAG_TLV 3 + +#define MAX_BUF_SIZE 4096 +std::string internal_log_msg_trans(const std::string& s) +{ + std::string output; + size_t i; + const char *p = s.c_str(); + for (i = 0; i < s.length(); ++i){ + if (p[i] == '('){//begin of tag + size_t start = i + 1; + while (isspace(p[start]))start++;//skip all space + int j; + for (j = 0; j < COUNT_TAGS; ++j){ + int tag_len = strlen(support_tags[j]); + if (strncmp(p + start, support_tags[j], tag_len) == 0){ + start += tag_len; + break; + } + } + if (j < COUNT_TAGS){//found a potential tag + while (isspace(p[start]))start++;//skip all space after tag + if ((p[start] == '-' || p[start] == '+') && isdigit(p[start + 1]) || + isdigit(p[start])){ + int number = strtol(p + start,NULL, 0); + switch (j){ + case TAG_SGX: + output += "(sgx_status_t:"; + output += get_sgx_status_t_string((sgx_status_t)number); + output += ":"; + break; + case TAG_AESM: + output += "(aesm_error_t:"; + output += get_aesm_error_t_string((aesm_error_t)number); + output += ":"; + break; + case TAG_AE: + output += "(ae_error_t:"; + output += get_ae_error_t_string((ae_error_t)number); + output += ":"; + break; + case TAG_TLV: + output += "(TLV:"; + output += get_tlv_enum_type_t_string((uint8_t)number); + output += ":"; + break; + default: + output += "(Unknown type:"; + break; + } + i = start-1; + } + else{ + output += p[i]; + } + } + else{//not found, keep original flags + output += p[i]; + } + } + else{ + output += p[i]; + } + } + return output; +} + #define TIME_BUF_SIZE 100 void aesm_internal_log(const char *file_name, int line_no, const char *funname, int level, const char *format, ...) { @@ -69,8 +158,8 @@ void aesm_internal_log(const char *file_name, int line_no, const char *funname, return; FILE *logfile = NULL; se_mutex_lock(&cs); - errno_t err_code = fopen_s(&logfile, filename, "a+"); - if(err_code!=0){ + logfile = fopen(filename, "a+"); + if(logfile == NULL){ se_mutex_unlock(&cs); return; } @@ -88,9 +177,12 @@ void aesm_internal_log(const char *file_name, int line_no, const char *funname, fprintf(logfile, "[%s|%d|%s]",file_name, line_no, funname); } va_start(varg, format); - vfprintf(logfile, format, varg); + char message_buf[MAX_BUF_SIZE]; + vsnprintf(message_buf, MAX_BUF_SIZE-1, format, varg); va_end(varg); - fprintf(logfile, "\n"); + std::string input_message = message_buf; + std::string output_message = internal_log_msg_trans(input_message); + fprintf(logfile, "%s\n", output_message.c_str()); fflush(logfile); fclose(logfile); se_mutex_unlock(&cs); @@ -160,72 +252,230 @@ void aesm_dbg_format_hex(const uint8_t *data, uint32_t data_len, char *out_buf, } } -#include "tinyxml.h" -static const char *xml_get_child_text(TiXmlNode *parent, const char *name) +#define CASE_ENUM_RET_STRING(x) case x: return #x; + +//(tlv%d) +static const char *get_tlv_enum_type_t_string(uint8_t type) { - if(parent == NULL) return NULL; - TiXmlNode *sub_node = parent->FirstChild(name); - if(sub_node == NULL) return NULL; - TiXmlElement *elem = sub_node->ToElement(); - if(elem == NULL) return NULL; - return elem->GetText(); + switch (type){ + CASE_ENUM_RET_STRING(TLV_CIPHER_TEXT) + CASE_ENUM_RET_STRING(TLV_BLOCK_CIPHER_TEXT) + CASE_ENUM_RET_STRING(TLV_BLOCK_CIPHER_INFO) + CASE_ENUM_RET_STRING(TLV_MESSAGE_AUTHENTICATION_CODE) + CASE_ENUM_RET_STRING(TLV_NONCE) + CASE_ENUM_RET_STRING(TLV_EPID_GID) + CASE_ENUM_RET_STRING(TLV_EPID_SIG_RL) + CASE_ENUM_RET_STRING(TLV_EPID_GROUP_CERT) + CASE_ENUM_RET_STRING(TLV_DEVICE_ID) + CASE_ENUM_RET_STRING(TLV_PS_ID) + CASE_ENUM_RET_STRING(TLV_EPID_JOIN_PROOF) + CASE_ENUM_RET_STRING(TLV_EPID_SIG) + CASE_ENUM_RET_STRING(TLV_EPID_MEMBERSHIP_CREDENTIAL) + CASE_ENUM_RET_STRING(TLV_EPID_PSVN) + CASE_ENUM_RET_STRING(TLV_QUOTE) + CASE_ENUM_RET_STRING(TLV_X509_CERT_TLV) + CASE_ENUM_RET_STRING(TLV_X509_CSR_TLV) + CASE_ENUM_RET_STRING(TLV_ES_SELECTOR) + CASE_ENUM_RET_STRING(TLV_ES_INFORMATION) + CASE_ENUM_RET_STRING(TLV_FLAGS) + CASE_ENUM_RET_STRING(TLV_QUOTE_SIG) + CASE_ENUM_RET_STRING(TLV_PEK) + CASE_ENUM_RET_STRING(TLV_SIGNATURE) + CASE_ENUM_RET_STRING(TLV_PLATFORM_INFO) + CASE_ENUM_RET_STRING(TLV_PWK2) + CASE_ENUM_RET_STRING(TLV_SE_REPORT) + default: + return "Unknown TLV"; + } } -static const char *dbg_level_str[]={ - "fatal", - "error", - "warning", - "info", - "debug", - "trace" -}; -#define DBG_LEVEL_COUNT (sizeof(dbg_level_str)/sizeof(dbg_level_str[0])) -static int find_dbg_level_str(const char *text_level) +//(ae%d) +static const char *get_ae_error_t_string(ae_error_t ae_error) { - uint32_t i; - size_t text_level_len = strlen(text_level); - for(i=0;itext_level_len)cur_len=text_level_len; - if(_strnicmp(text_level, dbg_level_str[i], cur_len)==0){ - return (int)i; - } + switch (ae_error){ + CASE_ENUM_RET_STRING(AE_SUCCESS) + CASE_ENUM_RET_STRING(AE_FAILURE) + CASE_ENUM_RET_STRING(AE_ENCLAVE_LOST) + CASE_ENUM_RET_STRING(OAL_PARAMETER_ERROR) + CASE_ENUM_RET_STRING(OAL_PATHNAME_BUFFER_OVERFLOW_ERROR) + CASE_ENUM_RET_STRING(OAL_FILE_ACCESS_ERROR) + CASE_ENUM_RET_STRING(OAL_CONFIG_FILE_ERROR) + CASE_ENUM_RET_STRING(OAL_NETWORK_UNAVAILABLE_ERROR) + CASE_ENUM_RET_STRING(OAL_NETWORK_BUSY) + CASE_ENUM_RET_STRING(OAL_NETWORK_RESEND_REQUIRED) + CASE_ENUM_RET_STRING(OAL_PROXY_SETTING_ASSIST) + CASE_ENUM_RET_STRING(OAL_THREAD_ERROR) + CASE_ENUM_RET_STRING(OAL_THREAD_TIMEOUT_ERROR) + CASE_ENUM_RET_STRING(AE_PSVN_UNMATCHED_ERROR) + CASE_ENUM_RET_STRING(AE_SERVER_NOT_AVAILABLE) + CASE_ENUM_RET_STRING(AE_INVALID_PARAMETER) + CASE_ENUM_RET_STRING(AE_READ_RAND_ERROR) + CASE_ENUM_RET_STRING(AE_OUT_OF_MEMORY_ERROR) + CASE_ENUM_RET_STRING(AE_INSUFFICIENT_DATA_IN_BUFFER) + CASE_ENUM_RET_STRING(QE_UNEXPECTED_ERROR) + CASE_ENUM_RET_STRING(QE_PARAMETER_ERROR) + CASE_ENUM_RET_STRING(QE_EPIDBLOB_ERROR) + CASE_ENUM_RET_STRING(QE_REVOKED_ERROR) + CASE_ENUM_RET_STRING(QE_SIGRL_ERROR) + CASE_ENUM_RET_STRING(PVE_UNEXPECTED_ERROR) + CASE_ENUM_RET_STRING(PVE_PARAMETER_ERROR) + CASE_ENUM_RET_STRING(PVE_EPIDBLOB_ERROR) + CASE_ENUM_RET_STRING(PVE_INSUFFICIENT_MEMORY_ERROR) + CASE_ENUM_RET_STRING(PVE_INTEGRITY_CHECK_ERROR) + CASE_ENUM_RET_STRING(PVE_SIGRL_INTEGRITY_CHECK_ERROR) + CASE_ENUM_RET_STRING(PVE_SERVER_REPORTED_ERROR) + CASE_ENUM_RET_STRING(PVE_PEK_SIGN_ERROR) + CASE_ENUM_RET_STRING(PVE_MSG_ERROR) + CASE_ENUM_RET_STRING(PVE_REVOKED_ERROR) + CASE_ENUM_RET_STRING(PVE_SESSION_OUT_OF_ORDER_ERROR) + CASE_ENUM_RET_STRING(PVE_SERVER_BUSY_ERROR) + CASE_ENUM_RET_STRING(PVE_PERFORMANCE_REKEY_NOT_SUPPORTED) + CASE_ENUM_RET_STRING(LE_UNEXPECTED_ERROR) + CASE_ENUM_RET_STRING(LE_INVALID_PARAMETER) + CASE_ENUM_RET_STRING(LE_GET_LICENSE_KEY_ERROR) + CASE_ENUM_RET_STRING(LE_INVALID_ATTRIBUTE) + CASE_ENUM_RET_STRING(LE_INVALID_PRIVILEGE_ERROR) + CASE_ENUM_RET_STRING(LE_WHITELIST_UNINITIALIZED_ERROR) + CASE_ENUM_RET_STRING(LE_CALC_LIC_TOKEN_ERROR) + CASE_ENUM_RET_STRING(AESM_NLTP_NO_LTP_BLOB) + CASE_ENUM_RET_STRING(AESM_NLTP_DONT_NEED_UPDATE_PAIR_LTP) + CASE_ENUM_RET_STRING(AESM_NLTP_MAY_NEED_UPDATE_LTP) + CASE_ENUM_RET_STRING(AESM_NLTP_OLD_EPID11_RLS) + CASE_ENUM_RET_STRING(AESM_PCP_NEED_PSE_UPDATE) + CASE_ENUM_RET_STRING(AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_NEED_EPID_UPDATE) + CASE_ENUM_RET_STRING(AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_MIGHT_NEED_EPID_UPDATE) + CASE_ENUM_RET_STRING(AESM_PCP_SIMPLE_PSE_CERT_PROVISIONING_ERROR) + CASE_ENUM_RET_STRING(AESM_PCP_SIMPLE_EPID_PROVISION_ERROR) + CASE_ENUM_RET_STRING(AESM_NPC_DONT_NEED_PSEP) + CASE_ENUM_RET_STRING(AESM_NPC_NO_PSE_CERT) + CASE_ENUM_RET_STRING(AESM_NPC_DONT_NEED_UPDATE_PSEP) + CASE_ENUM_RET_STRING(AESM_NPC_MAY_NEED_UPDATE_PSEP) + CASE_ENUM_RET_STRING(AESM_NEP_DONT_NEED_EPID_PROVISIONING) + CASE_ENUM_RET_STRING(AESM_NEP_DONT_NEED_UPDATE_PVEQE) + CASE_ENUM_RET_STRING(AESM_NEP_PERFORMANCE_REKEY) + CASE_ENUM_RET_STRING(AESM_NEP_MAY_NEED_UPDATE) + CASE_ENUM_RET_STRING(AESM_CP_ATTESTATION_FAILURE) + CASE_ENUM_RET_STRING(AESM_LTP_PSE_CERT_REVOKED) + CASE_ENUM_RET_STRING(AESM_LTP_SIMPLE_LTP_ERROR) + CASE_ENUM_RET_STRING(AESM_PSE_PR_GET_PRIVRL_ERROR) + CASE_ENUM_RET_STRING(AESM_NETWORK_TIMEOUT) + + CASE_ENUM_RET_STRING(PSW_UPDATE_REQUIRED) + CASE_ENUM_RET_STRING(PSE_OP_ERROR_KDF_MISMATCH) + CASE_ENUM_RET_STRING(AESM_AE_OUT_OF_EPC) + + CASE_ENUM_RET_STRING(PVE_PROV_ATTEST_KEY_NOT_FOUND) + CASE_ENUM_RET_STRING(PVE_INVALID_REPORT) + CASE_ENUM_RET_STRING(PVE_XEGDSK_SIGN_ERROR) + + // PCE ERROR CODES + CASE_ENUM_RET_STRING(PCE_UNEXPECTED_ERROR) + CASE_ENUM_RET_STRING(PCE_INVALID_PRIVILEGE) + CASE_ENUM_RET_STRING(PCE_INVALID_REPORT) + + CASE_ENUM_RET_STRING(LE_WHITE_LIST_QUERY_BUSY) + CASE_ENUM_RET_STRING(AESM_AE_NO_DEVICE) + CASE_ENUM_RET_STRING(EXTENDED_GROUP_NOT_AVAILABLE) + default: + return "Unknown ae_error_t"; } - AESM_DBG_ERROR("unkown level %s",text_level); - return -1; } -ae_error_t load_log_config(void) +//(aesm%d) +static const char *get_aesm_error_t_string(aesm_error_t aesm_error) { - char path_name[MAX_PATH]; - ae_error_t ae_err = AE_SUCCESS; - if((ae_err=aesm_get_cpathname(FT_PERSISTENT_STORAGE, AESM_DBG_LOG_CFG_FID, path_name, MAX_PATH))!=AE_SUCCESS){ - AESM_DBG_ERROR("fail to read config path"); - return ae_err; + switch (aesm_error){ + CASE_ENUM_RET_STRING(AESM_SUCCESS) + CASE_ENUM_RET_STRING(AESM_UNEXPECTED_ERROR) + CASE_ENUM_RET_STRING(AESM_NO_DEVICE_ERROR) + CASE_ENUM_RET_STRING(AESM_PARAMETER_ERROR) + CASE_ENUM_RET_STRING(AESM_EPIDBLOB_ERROR) + CASE_ENUM_RET_STRING(AESM_EPID_REVOKED_ERROR) + CASE_ENUM_RET_STRING(AESM_GET_LICENSETOKEN_ERROR) + CASE_ENUM_RET_STRING(AESM_SESSION_INVALID) + CASE_ENUM_RET_STRING(AESM_MAX_NUM_SESSION_REACHED) + CASE_ENUM_RET_STRING(AESM_PSDA_UNAVAILABLE) + CASE_ENUM_RET_STRING(AESM_KDF_MISMATCH) + CASE_ENUM_RET_STRING(AESM_EPH_SESSION_FAILED) + CASE_ENUM_RET_STRING(AESM_LONG_TERM_PAIRING_FAILED) + CASE_ENUM_RET_STRING(AESM_NETWORK_ERROR) + CASE_ENUM_RET_STRING(AESM_NETWORK_BUSY_ERROR) + CASE_ENUM_RET_STRING(AESM_PROXY_SETTING_ASSIST) + CASE_ENUM_RET_STRING(AESM_FILE_ACCESS_ERROR) + CASE_ENUM_RET_STRING(AESM_SGX_PROVISION_FAILED) + CASE_ENUM_RET_STRING(AESM_SERVICE_STOPPED) + CASE_ENUM_RET_STRING(AESM_BUSY) + CASE_ENUM_RET_STRING(AESM_BACKEND_SERVER_BUSY) + CASE_ENUM_RET_STRING(AESM_UPDATE_AVAILABLE) + CASE_ENUM_RET_STRING(AESM_OUT_OF_MEMORY_ERROR) + CASE_ENUM_RET_STRING(AESM_MSG_ERROR) + CASE_ENUM_RET_STRING(AESM_ENABLE_SGX_DEVICE_FAILED) + CASE_ENUM_RET_STRING(AESM_PLATFORM_INFO_BLOB_INVALID_SIG) + CASE_ENUM_RET_STRING(AESM_OUT_OF_EPC) + CASE_ENUM_RET_STRING(AESM_SERVICE_UNAVAILABLE) + default: + return "Unknow aesm_error_t"; } +} - TiXmlDocument doc(path_name); - bool load_ok = doc.LoadFile(); - if(!load_ok){ - AESM_DBG_ERROR("fail to load config file %s", path_name); - return OAL_FILE_ACCESS_ERROR; +//(sgx) +static const char *get_sgx_status_t_string(sgx_status_t status) +{ + switch (status){ + CASE_ENUM_RET_STRING(SGX_SUCCESS) + + CASE_ENUM_RET_STRING(SGX_ERROR_UNEXPECTED) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_PARAMETER) + CASE_ENUM_RET_STRING(SGX_ERROR_OUT_OF_MEMORY) + CASE_ENUM_RET_STRING(SGX_ERROR_ENCLAVE_LOST) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_STATE) + + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_FUNCTION) + CASE_ENUM_RET_STRING(SGX_ERROR_OUT_OF_TCS) + CASE_ENUM_RET_STRING(SGX_ERROR_ENCLAVE_CRASHED ) + CASE_ENUM_RET_STRING(SGX_ERROR_ECALL_NOT_ALLOWED) + CASE_ENUM_RET_STRING(SGX_ERROR_OCALL_NOT_ALLOWED) + + CASE_ENUM_RET_STRING(SGX_ERROR_UNDEFINED_SYMBOL) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_ENCLAVE) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_ENCLAVE_ID) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_SIGNATURE) + CASE_ENUM_RET_STRING(SGX_ERROR_NDEBUG_ENCLAVE) + CASE_ENUM_RET_STRING(SGX_ERROR_OUT_OF_EPC) + CASE_ENUM_RET_STRING(SGX_ERROR_NO_DEVICE) + CASE_ENUM_RET_STRING(SGX_ERROR_MEMORY_MAP_CONFLICT) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_METADATA) + CASE_ENUM_RET_STRING(SGX_ERROR_DEVICE_BUSY) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_VERSION) + CASE_ENUM_RET_STRING(SGX_ERROR_MODE_INCOMPATIBLE) + CASE_ENUM_RET_STRING(SGX_ERROR_ENCLAVE_FILE_ACCESS) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_MISC) + + CASE_ENUM_RET_STRING(SGX_ERROR_MAC_MISMATCH) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_ATTRIBUTE) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_CPUSVN) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_ISVSVN) + CASE_ENUM_RET_STRING(SGX_ERROR_INVALID_KEYNAME) + + CASE_ENUM_RET_STRING(SGX_ERROR_SERVICE_UNAVAILABLE) + CASE_ENUM_RET_STRING(SGX_ERROR_SERVICE_TIMEOUT) + CASE_ENUM_RET_STRING(SGX_ERROR_AE_INVALID_EPIDBLOB) + CASE_ENUM_RET_STRING(SGX_ERROR_SERVICE_INVALID_PRIVILEGE) + CASE_ENUM_RET_STRING(SGX_ERROR_EPID_MEMBER_REVOKED) + CASE_ENUM_RET_STRING(SGX_ERROR_UPDATE_NEEDED) + CASE_ENUM_RET_STRING(SGX_ERROR_NETWORK_FAILURE) + CASE_ENUM_RET_STRING(SGX_ERROR_AE_SESSION_INVALID) + CASE_ENUM_RET_STRING(SGX_ERROR_BUSY) + CASE_ENUM_RET_STRING(SGX_ERROR_MC_NOT_FOUND) + CASE_ENUM_RET_STRING(SGX_ERROR_MC_NO_ACCESS_RIGHT) + CASE_ENUM_RET_STRING(SGX_ERROR_MC_USED_UP) + CASE_ENUM_RET_STRING(SGX_ERROR_MC_OVER_QUOTA) + CASE_ENUM_RET_STRING(SGX_ERROR_KDF_MISMATCH) + + default: + return "Unknown sgx_status_t"; } - TiXmlNode *pmetadata_node = doc.FirstChild("DbgLog"); - const char *temp_text = xml_get_child_text(pmetadata_node, "level"); - if(temp_text!=NULL){ - if(isdigit(temp_text[0])){ - AESM_SET_DBG_LEVEL(atoi(temp_text)); - }else{ - int level = find_dbg_level_str(temp_text); - if(level>=0){ - AESM_SET_DBG_LEVEL(level); - } - } - }else{ - AESM_DBG_ERROR("fail to find level"); - } - return AE_SUCCESS; } #endif diff --git a/psw/ae/aesm_service/source/pce/PCEClass.cpp b/psw/ae/aesm_service/source/pce/PCEClass.cpp new file mode 100644 index 0000000000..5c7c69c4fc --- /dev/null +++ b/psw/ae/aesm_service/source/pce/PCEClass.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __GNUC__ +#include "StdAfx.h" +#include +#endif +#include +#include "PCEClass.h" +#include "QEClass.h" +#include "PVEClass.h" +#include "util.h" +#include "prof_fun.h" +#include "sgx_report.h" +#include "sgx_tseal.h" +#include "epid_pve_type.h" +#include "pce_u.h" +#include "pce_u.c" + +void CPCEClass::before_enclave_load() { + // always unload qe/pve enclave before loading pce enclave + CQEClass::instance().unload_enclave(); + CPVEClass::instance().unload_enclave(); +} + +uint32_t CPCEClass::get_pce_target( + sgx_target_info_t *p_pce_target) +{ + token_t *p_token = + reinterpret_cast(&m_launch_token); + + /* We need to make sure the PCE is successfully loaded and then we can use + the cached attributes and launch token. */ + assert(m_enclave_id); + memset(p_pce_target, 0, sizeof(sgx_target_info_t)); + memcpy_s(&p_pce_target->attributes, sizeof(p_pce_target->attributes), + &m_attributes.secs_attr, sizeof(m_attributes.secs_attr)); + memcpy_s(&p_pce_target->misc_select, sizeof(p_pce_target->misc_select), + &m_attributes.misc_select, sizeof(m_attributes.misc_select)); + memcpy_s(&p_pce_target->mr_enclave, sizeof(p_pce_target->mr_enclave), + &p_token->body.mr_enclave, + sizeof(p_token->body.mr_enclave)); + return AE_SUCCESS; +} + +uint32_t CPCEClass::get_pce_info(const sgx_report_t& report, const signed_pek_t& pek, uint16_t& pce_id, uint16_t& isv_svn, uint8_t encrypted_ppid[PEK_MOD_SIZE]) +{ + sgx_status_t status = SGX_SUCCESS; + uint32_t ret_val = 0; + uint32_t ret_size = PEK_MOD_SIZE; + int retry = 0; + pce_info_t pce_info; + uint8_t signature_scheme; + AESM_PROFILE_FUN; + if (m_enclave_id == 0){ + AESM_DBG_ERROR("call get_pc_info without loading PCE"); + return AE_FAILURE; + } + + status = ::get_pc_info(m_enclave_id, &ret_val, &report, (uint8_t*)&pek, PEK_MOD_SIZE + sizeof(pek.e), ALG_RSA_OAEP_2048, encrypted_ppid, PEK_MOD_SIZE, &ret_size, &pce_info, &signature_scheme); + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = ::get_pc_info(m_enclave_id, &ret_val, &report, (uint8_t*)&pek, PEK_MOD_SIZE + sizeof(pek.e), ALG_RSA_OAEP_2048, encrypted_ppid, PEK_MOD_SIZE, &ret_size, &pce_info, &signature_scheme); + } + if(status != SGX_SUCCESS) + return AE_FAILURE; + if (ret_val != AE_SUCCESS) + return ret_val; + if(signature_scheme != NIST_P256_ECDSA_SHA256){ + return AE_FAILURE; + } + if(ret_size != PEK_MOD_SIZE){ + return AE_FAILURE; + } + pce_id = pce_info.pce_id; + isv_svn = pce_info.pce_isvn; + return AE_SUCCESS; +} + +uint32_t CPCEClass::sign_report(const psvn_t& cert_psvn, const sgx_report_t& report, uint8_t signed_sign[2*SE_ECDSA_SIGN_SIZE]) +{ + sgx_status_t status = SGX_SUCCESS; + uint32_t ret_val = 0; + uint32_t ret_size = 2*SE_ECDSA_SIGN_SIZE; + int retry = 0; + AESM_PROFILE_FUN; + if (m_enclave_id == 0){ + AESM_DBG_ERROR("call certify_enclave without loading PCE"); + return AE_FAILURE; + } + + status = ::certify_enclave(m_enclave_id, &ret_val, &cert_psvn, &report, signed_sign, 2*SE_ECDSA_SIGN_SIZE, &ret_size); + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = ::certify_enclave(m_enclave_id, &ret_val, &cert_psvn, &report, signed_sign, 2*SE_ECDSA_SIGN_SIZE, &ret_size); + } + if(status != SGX_SUCCESS) + return AE_FAILURE; + if(ret_val != AE_SUCCESS){ + return ret_val; + } + if(ret_size != 2*SE_ECDSA_SIGN_SIZE) + return AE_FAILURE; + return AE_SUCCESS; +} diff --git a/psw/ae/aesm_service/source/pce/PCEClass.h b/psw/ae/aesm_service/source/pce/PCEClass.h new file mode 100644 index 0000000000..94c75bfd31 --- /dev/null +++ b/psw/ae/aesm_service/source/pce/PCEClass.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#pragma once + +#include "AEClass.h" +#include "aeerror.h" +#include "provision_msg.h" +#include "pce_cert.h" +#include "sgx_report.h" +#include "epid_pve_type.h" +#include "se_sig_rl.h" + +class CPCEClass: public SingletonEnclave +{ + friend class Singleton; + friend class SingletonEnclave; + static aesm_enclave_id_t get_enclave_fid(){return PCE_ENCLAVE_FID;} +protected: + CPCEClass(){}; + ~CPCEClass(){}; + virtual void before_enclave_load(); + virtual int get_debug_flag() { return 0;} + +public: + uint32_t get_pce_target(sgx_target_info_t *p_pce_target); + uint32_t get_pce_info(const sgx_report_t& report, + const signed_pek_t& pek, + uint16_t& pce_id, + uint16_t& isv_svn, + uint8_t encrypted_ppid[PEK_MOD_SIZE]); + uint32_t sign_report(const psvn_t& cert_psvn, + const sgx_report_t& report, + uint8_t signed_sign[2*SE_ECDSA_SIGN_SIZE]); +}; + diff --git a/psw/ae/aesm_service/source/pve/PVEClass.cpp b/psw/ae/aesm_service/source/pve/PVEClass.cpp index 4ba432e15b..128ecd37bd 100644 --- a/psw/ae/aesm_service/source/pve/PVEClass.cpp +++ b/psw/ae/aesm_service/source/pve/PVEClass.cpp @@ -33,71 +33,72 @@ #include #include "PVEClass.h" #include "QEClass.h" +#include "PCEClass.h" #include "util.h" #include "prof_fun.h" #include "sgx_report.h" #include "sgx_tseal.h" #include "epid_pve_type.h" +#include "aesm_xegd_blob.h" #include "provision_enclave_u.h" #include "provision_enclave_u.c" void CPVEClass::before_enclave_load() { // always unload qe enclave before loading pve enclave CQEClass::instance().unload_enclave(); + CPCEClass::instance().unload_enclave(); } uint32_t CPVEClass::gen_prov_msg1_data( - const psvn_t* psvn, const signed_pek_t *pek, - bool performance_rekey_used, - prov_msg1_output_t* output) + const sgx_target_info_t *pce_target_info, + sgx_report_t *pek_report) { uint32_t ret = AE_SUCCESS; sgx_status_t status = SGX_SUCCESS; + extended_epid_group_blob_t xegb={0}; + int retry = 0; AESM_PROFILE_FUN; if(m_enclave_id==0){ AESM_DBG_ERROR("call gen_prov_msg1_data without loading PvE"); return AE_FAILURE; } - - status = gen_prov_msg1_data_wrapper( - m_enclave_id, &ret, - psvn, - pek, - performance_rekey_used?1:0, - output); - if(status == SGX_ERROR_ENCLAVE_LOST) - ret = AE_ENCLAVE_LOST; - else if(status != SGX_SUCCESS) - ret = AE_FAILURE; - return ret; -} - -uint32_t CPVEClass::get_ek2( - const prov_get_ek2_input_t* input, - prov_get_ek2_output_t* ek2) -{ - uint32_t ret = AE_SUCCESS; - sgx_status_t status = SGX_SUCCESS; - AESM_PROFILE_FUN; - if(m_enclave_id==0){ - AESM_DBG_ERROR("call get_ek2 without loading PvE"); - return AE_FAILURE; + if (AE_SUCCESS != (ret = XEGDBlob::instance().read(xegb))){ + return ret; } - status = get_ek2_wrapper( - m_enclave_id, &ret, - input, - ek2); - if(status == SGX_ERROR_ENCLAVE_LOST) - ret = AE_ENCLAVE_LOST; - else if(status != SGX_SUCCESS) + status = gen_prov_msg1_data_wrapper( + m_enclave_id, &ret, + &xegb, + pek, + pce_target_info, + pek_report); + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + // Reload an AE will not fail because of out of EPC, so AESM_AE_OUT_OF_EPC is not checked here + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = gen_prov_msg1_data_wrapper( + m_enclave_id, &ret, + &xegb, + pek, + pce_target_info, + pek_report); + } + if (PVE_XEGDSK_SIGN_ERROR == ret) { + AESM_DBG_ERROR("XEGD signature mismatch in gen_prov_msg1_data"); + } + + if(status != SGX_SUCCESS) ret = AE_FAILURE; return ret; } + uint32_t CPVEClass::proc_prov_msg2_data( const proc_prov_msg2_blob_input_t* input, + bool performance_rekey_used, const uint8_t* sigrl, uint32_t sigrl_size, gen_prov_msg3_output_t* msg3_fixed_output, @@ -105,7 +106,9 @@ uint32_t CPVEClass::proc_prov_msg2_data( uint32_t epid_sig_buffer_size) { uint32_t ret = AE_SUCCESS; + int retry = 0; sgx_status_t status = SGX_SUCCESS; + uint8_t b_performance_rekey_used = performance_rekey_used?1:0; AESM_PROFILE_FUN; if(m_enclave_id==0){ AESM_DBG_ERROR("call proc_prov_msg2_data without loading PvE"); @@ -113,14 +116,31 @@ uint32_t CPVEClass::proc_prov_msg2_data( } status = proc_prov_msg2_data_wrapper( - m_enclave_id, &ret, + m_enclave_id, &ret, input, + b_performance_rekey_used, sigrl, sigrl_size, msg3_fixed_output, epid_sig, epid_sig_buffer_size); - if(status == SGX_ERROR_ENCLAVE_LOST) - ret = AE_ENCLAVE_LOST; - else if(status != SGX_SUCCESS) + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + // Reload an AE will not fail because of out of EPC, so AESM_AE_OUT_OF_EPC is not checked here + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = proc_prov_msg2_data_wrapper( + m_enclave_id, &ret, + input, + b_performance_rekey_used, + sigrl, sigrl_size, + msg3_fixed_output, + epid_sig, epid_sig_buffer_size); + } + if (PVE_XEGDSK_SIGN_ERROR == ret) { + AESM_DBG_ERROR("XEGD signature mismatch in proc_prov_msg2_data"); + } + + if(status != SGX_SUCCESS) ret = AE_FAILURE; return ret; } @@ -131,6 +151,7 @@ uint32_t CPVEClass::proc_prov_msg4_data( { uint32_t ret = AE_SUCCESS; sgx_status_t status = SGX_SUCCESS; + int retry = 0; AESM_PROFILE_FUN; if(m_enclave_id==0){ AESM_DBG_ERROR("call proc_prov_msg4_data without loading PvE"); @@ -138,12 +159,25 @@ uint32_t CPVEClass::proc_prov_msg4_data( } status = proc_prov_msg4_data_wrapper( - m_enclave_id, &ret, + m_enclave_id, &ret, msg4_input, data_blob); - if(status == SGX_ERROR_ENCLAVE_LOST) - ret = AE_ENCLAVE_LOST; - else if(status != SGX_SUCCESS) + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + // Reload an AE will not fail because of out of EPC, so AESM_AE_OUT_OF_EPC is not checked here + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = proc_prov_msg4_data_wrapper( + m_enclave_id, &ret, + msg4_input, + data_blob); + } + if (PVE_XEGDSK_SIGN_ERROR == ret) { + AESM_DBG_ERROR("XEGD signature mismatch in proc_prov_msg4_data"); + } + + if(status != SGX_SUCCESS) ret = AE_FAILURE; return ret; } @@ -153,6 +187,7 @@ uint32_t CPVEClass::gen_es_msg1_data( { uint32_t ret = AE_SUCCESS; sgx_status_t status = SGX_SUCCESS; + int retry = 0; AESM_PROFILE_FUN; if(m_enclave_id==0){ AESM_DBG_ERROR("call gen_es_msg1_data without loading PvE"); @@ -160,11 +195,20 @@ uint32_t CPVEClass::gen_es_msg1_data( } status = gen_es_msg1_data_wrapper( - m_enclave_id, &ret, + m_enclave_id, &ret, es_output); - if(status == SGX_ERROR_ENCLAVE_LOST) - ret = AE_ENCLAVE_LOST; - else if(status != SGX_SUCCESS) + for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) + { + unload_enclave(); + // Reload an AE will not fail because of out of EPC, so AESM_AE_OUT_OF_EPC is not checked here + if(AE_SUCCESS != load_enclave()) + return AE_FAILURE; + status = gen_es_msg1_data_wrapper( + m_enclave_id, &ret, + es_output); + } + + if(status != SGX_SUCCESS) ret = AE_FAILURE; return ret; } diff --git a/psw/ae/aesm_service/source/pve/PVEClass.h b/psw/ae/aesm_service/source/pve/PVEClass.h index 3ea1a828c9..b3537e56bf 100644 --- a/psw/ae/aesm_service/source/pve/PVEClass.h +++ b/psw/ae/aesm_service/source/pve/PVEClass.h @@ -32,8 +32,8 @@ #ifndef _PVE_CLASS_H_ #define _PVE_CLASS_H_ #include "AEClass.h" -#include "aeerror.h" #include "provision_msg.h" +#include "pve_logic.h" #include "ae_debug_flag.hh" class CPVEClass: public SingletonEnclave @@ -48,17 +48,13 @@ protected: virtual int get_debug_flag() { return AE_DEBUG_FLAG;} uint32_t gen_prov_msg1_data( - const psvn_t* psvn, const signed_pek_t *pek, - bool performance_rekey_used, - prov_msg1_output_t* output); - - uint32_t get_ek2( - const prov_get_ek2_input_t* input, - prov_get_ek2_output_t* ek2); + const sgx_target_info_t *pce_target_info, + sgx_report_t *pek_report); uint32_t proc_prov_msg2_data( const proc_prov_msg2_blob_input_t* input, + bool performance_rekey_used, const uint8_t* sigrl, uint32_t sigrl_size, gen_prov_msg3_output_t* msg3_fixed_output, @@ -73,27 +69,21 @@ public: uint32_t gen_es_msg1_data( gen_endpoint_selection_output_t* es_output); - uint32_t gen_prov_msg1( - const psvn_t* psvn, - const signed_pek_t& pek, - bool performance_rekey_used, + uint32_t gen_prov_msg1(pve_data_t& pve_data, uint8_t* msg1, - uint32_t msg1_size); + uint32_t msg1_size);//input output parameter, input for back_retrieval and output only for other cases uint32_t proc_prov_msg2( + pve_data_t& data, const uint8_t* msg2, uint32_t msg2_size, - const signed_pek_t& pek, const uint8_t* epid_blob, uint32_t blob_size, - uint8_t ek2[SK_SIZE], - psvn_t* sigrl_svn, uint8_t* msg3, uint32_t msg3_size); uint32_t proc_prov_msg4( - bool use_ek2_in_input, - const uint8_t ek2[SK_SIZE], + const pve_data_t& data, const uint8_t* msg4, uint32_t msg4_size, uint8_t* data_blob, diff --git a/psw/ae/aesm_service/source/pve/prov_msg_size.h b/psw/ae/aesm_service/source/pve/prov_msg_size.h index ebf7a737e1..1d3d266193 100644 --- a/psw/ae/aesm_service/source/pve/prov_msg_size.h +++ b/psw/ae/aesm_service/source/pve/prov_msg_size.h @@ -38,26 +38,30 @@ /*Inline functions to estimate size of ProvMsg1, ProvMsg3 etc*/ /*Function to estimate the size of ProvMsg1 - TLV_CIPHER_TEXT(SK, PSID): E+MAC(Device_ID_TLV[:FLAG_TLV])*/ + TLV_CIPHER_TEXT(SK, PSID): E+MAC(CIPHER_TLV:PLATFORM_INFO_TLV[:FLAG_TLV])*/ inline uint32_t estimate_msg1_size(bool performance_rekey) { size_t field0_size = CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES); - size_t field1_0_size = DEVICE_ID_TLV_SIZE(); - size_t field1_1_size = performance_rekey? FLAGS_TLV_SIZE():0; - size_t field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field1_0_size+field1_1_size); + size_t field1_0_size = CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES); + size_t field1_1_size = PLATFORM_INFO_TLV_SIZE(); + size_t field1_2_size = performance_rekey? FLAGS_TLV_SIZE():0; + size_t field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field1_0_size+field1_1_size+field1_2_size); size_t field2_size = MAC_TLV_SIZE(MAC_SIZE); return static_cast(PROVISION_REQUEST_HEADER_SIZE+field0_size+field1_size+field2_size); /*no checking for integer overflow since the size of msg1 is fixed and small*/ } /*Function to estimate the size of ProvMsg3 - NONCE_TLV(NONCE_SIZE):E+MAC(E+MAC(EPID_JOIN_PROOF_TLV):E+MAC(EPID_SIGNATURE_TLV))*/ + NONCE_TLV(NONCE_SIZE):E+MAC(E+MAC(EPID_JOIN_PROOF_TLV):NONCE_TLV(NONCE_2):CIPHER_TLV:SE_REPRT_TLV):E+MAC(EPID_SIGNATURE_TLV)*/ inline uint32_t calc_msg3_size_by_sigrl_count(uint32_t sigrl_count) { size_t field0_size = NONCE_TLV_SIZE(NONCE_SIZE); size_t field1_0_size = BLOCK_CIPHER_TEXT_TLV_SIZE(EPID_JOIN_PROOF_TLV_SIZE()); size_t field1_1_size = MAC_TLV_SIZE(MAC_SIZE); + size_t field1_2_size = NONCE_TLV_SIZE(NONCE_2_SIZE); + size_t field1_3_size = CIPHER_TEXT_TLV_SIZE(PVE_RSA_KEY_BYTES); + size_t field1_4_size = SE_REPORT_TLV_SIZE(); size_t field3_0_size = EPID_SIGNATURE_TLV_SIZE(sigrl_count); - size_t field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field1_0_size+field1_1_size); + size_t field1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field1_0_size+field1_1_size+field1_2_size+field1_3_size+field1_4_size); size_t field2_size = MAC_TLV_SIZE(MAC_SIZE); size_t field3_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field3_0_size); size_t field4_size = MAC_TLV_SIZE(MAC_SIZE); @@ -65,19 +69,18 @@ inline uint32_t calc_msg3_size_by_sigrl_count(uint32_t sigrl_count) } /*Function to estimate the count of SigRL Entry inside a ProvMsg2 - Nonce_TLV(NONCE_SIZE):E+MAC(PubGroupCert:ChallengeNonce[:SigrlPSVN]:PSID:E+MAC(TCB_KEY):deviceID)[:signed SigRL]*/ + Nonce_TLV(NONCE_SIZE):E+MAC(PubGroupCert:ChallengeNonce[:PlatformInfoPSVN]:PSID:EPID_GID:PlatformInfo)[:signed SigRL]*/ inline uint32_t estimate_sigrl_count_by_msg2_size(uint32_t msg2_size) { size_t field_0_size = NONCE_TLV_SIZE(NONCE_SIZE); size_t field_1_0_size = EPID_GROUP_CERT_TLV_SIZE(); size_t field_1_1_size = NONCE_TLV_SIZE(CHALLENGE_NONCE_SIZE); - size_t field_1_2_size = EPID_SIGRL_PSVN_TLV_SIZE(); /*It is always present if sigrl entry count is nonzero*/ + size_t field_1_2_size = PLATFORM_INFO_TLV_SIZE(); //It is always present if sigrl entry count is nonzero size_t field_1_3_size = PSID_TLV_SIZE(); - size_t field_1_4_size = BLOCK_CIPHER_TEXT_TLV_SIZE(SK_SIZE); - size_t field_1_5_size = MAC_TLV_SIZE(MAC_SIZE); - size_t field_1_6_size = DEVICE_ID_TLV_SIZE(); + size_t field_1_4_size = EPID_GID_TLV_SIZE(); + size_t field_1_5_size = PLATFORM_INFO_TLV_SIZE(); size_t field_1_size = BLOCK_CIPHER_TEXT_TLV_SIZE(field_1_0_size+field_1_1_size+field_1_2_size - + field_1_3_size + field_1_4_size + field_1_5_size + field_1_6_size); + + field_1_3_size + field_1_4_size + field_1_5_size ); size_t field_2_size = MAC_TLV_SIZE(MAC_SIZE); size_t field_3_size = 0; if(PROVISION_RESPONSE_HEADER_SIZE+field_0_size+field_1_size+field_2_size>=msg2_size) diff --git a/psw/ae/aesm_service/source/pve/pve_logic.cpp b/psw/ae/aesm_service/source/pve/pve_logic.cpp index 8853118e60..136c833717 100644 --- a/psw/ae/aesm_service/source/pve/pve_logic.cpp +++ b/psw/ae/aesm_service/source/pve/pve_logic.cpp @@ -34,6 +34,7 @@ #include "aesm_logic.h" #include "PVEClass.h" #include "QEClass.h" +#include "PCEClass.h" #include "oal/oal.h" #include "aesm_epid_blob.h" #include "se_wrapper.h" @@ -41,12 +42,13 @@ #include "network_encoding_wrapper.h" #include "prof_fun.h" #include "aesm_long_lived_thread.h" +#include "endpoint_select_info.h" #include #define SAFE_FREE(ptr) {if (NULL != (ptr)) {free(ptr); (ptr)=NULL;}} //Function to continue process Provisioning logic when the response of ProvMsg1 is ProvMsg2 -ae_error_t PvEAESMLogic::process_pve_msg2(psvn_t& sigrl_psvn, const uint8_t* msg2, uint32_t msg2_size, const endpoint_selection_infos_t& es_info) +ae_error_t PvEAESMLogic::process_pve_msg2(pve_data_t& data, const uint8_t* msg2, uint32_t msg2_size, const endpoint_selection_infos_t& es_info) { uint32_t msg_size = 0; uint8_t *msg = NULL; @@ -82,8 +84,9 @@ ae_error_t PvEAESMLogic::process_pve_msg2(psvn_t& sigrl_psvn, const uint8_t* msg } memset(msg, 0, msg_size); AESM_DBG_TRACE("start processing msg2 and gen msg3"); - ret = static_cast(CPVEClass::instance().proc_prov_msg2(msg2, msg2_size, es_info.pek, epid_data.trusted_epid_blob, SGX_TRUSTED_EPID_BLOB_SIZE,//discard curpsvn in epid blob which is used in untrusted code only - ek2, &sigrl_psvn, msg, msg_size));//with help of PvE, process ProvMsg2 and generate ProvMsg3 + ret = static_cast(CPVEClass::instance().proc_prov_msg2(data, msg2, msg2_size, + epid_data.trusted_epid_blob, SGX_TRUSTED_EPID_BLOB_SIZE_PAK,//discard curpsvn in epid blob + msg, msg_size));//with help of PvE, process ProvMsg2 and generate ProvMsg3 if(ret == AE_SUCCESS){ if(GET_SIZE_FROM_PROVISION_REQUEST(msg)>msg_size){ @@ -102,7 +105,7 @@ ae_error_t PvEAESMLogic::process_pve_msg2(psvn_t& sigrl_psvn, const uint8_t* msg } assert(resp_msg!=NULL); AESM_DBG_TRACE("Start to proc msg4"); - ret = process_pve_msg4(resp_msg, resp_size, NULL, true, ek2);//The response msg must be ProvMsg4, process it to generate EPIDBlob + ret = process_pve_msg4(data, resp_msg, resp_size);//The response msg must be ProvMsg4, process it to generate EPIDBlob if(ret != AE_SUCCESS){ AESM_DBG_TRACE("processing msg4 failed:%d",ret); goto CLEANUP; @@ -120,7 +123,7 @@ CLEANUP: } //Function to finish the Provisioning Logic when a ProvMsg4 is expected or encountered -ae_error_t PvEAESMLogic::process_pve_msg4(const uint8_t* msg4, uint32_t msg4_size, const psvn_t* old_psvn, bool use_ek2, const uint8_t ek2[SK_SIZE]) +ae_error_t PvEAESMLogic::process_pve_msg4(const pve_data_t& data, const uint8_t* msg4, uint32_t msg4_size) { AESM_PROFILE_FUN; epid_blob_with_cur_psvn_t epid_data; @@ -131,34 +134,22 @@ ae_error_t PvEAESMLogic::process_pve_msg4(const uint8_t* msg4, uint32_t msg4_siz memset(&epid_data, 0, sizeof(epid_data)); //with the help of PvE to process ProvMsg4 and generate EPIDDataBlob - if((ret = static_cast(CPVEClass::instance().proc_prov_msg4(use_ek2, ek2, msg4, msg4_size, - epid_data.trusted_epid_blob, SGX_TRUSTED_EPID_BLOB_SIZE )))!=AE_SUCCESS){ + if((ret = static_cast(CPVEClass::instance().proc_prov_msg4(data, msg4, msg4_size, + epid_data.trusted_epid_blob, SGX_TRUSTED_EPID_BLOB_SIZE_PAK)))!=AE_SUCCESS){ AESM_DBG_WARN("proc prov msg4 fail:%d",ret); goto fini; } - if(NULL != old_psvn){ - if(0!=memcpy_s(&epid_data.cur_psvn, sizeof(epid_data.cur_psvn), - old_psvn, sizeof(psvn_t))){ - AESM_DBG_ERROR("memcpy failed"); - ret = PVE_UNEXPECTED_ERROR; - goto fini; - } - }else{//using current QE/PvE PSVN - uint16_t isv_svn; - ret = AESMLogic::get_qe_cpu_svn(epid_data.cur_psvn.cpu_svn); - if(AE_SUCCESS != ret){ - goto fini; - } - ret = AESMLogic::get_qe_isv_svn(isv_svn); - if(AE_SUCCESS != ret){ - goto fini; - } - if(0!=memcpy_s(&epid_data.cur_psvn.isv_svn, sizeof(epid_data.cur_psvn.isv_svn), &isv_svn, sizeof(isv_svn))){ + if(0!=memcpy_s(&epid_data.cur_pi, sizeof(epid_data.cur_pi), + &data.bpi, sizeof(data.bpi))){ AESM_DBG_ERROR("memcpy failed"); ret = PVE_UNEXPECTED_ERROR; goto fini; - } } +#ifdef DBG_LOG + char dbg_str[256]; + aesm_dbg_format_hex(reinterpret_cast(&epid_data), sizeof(epid_data), dbg_str, 256); + AESM_DBG_TRACE("write epid_data=%s",dbg_str); +#endif ret=EPIDBlob::instance().write(epid_data);//save the data into persistent data storage if(AE_SUCCESS!=ret){ AESM_DBG_WARN("fail to write epid_data:%d",ret); @@ -169,7 +160,7 @@ fini: //Function to process the Provisioning Logic for backup retrieval of old epid data blob //The function assumes that the PvE state has been IDLE -ae_error_t PvEAESMLogic::update_old_blob(const psvn_t& psvn, const endpoint_selection_infos_t& es_info) +ae_error_t PvEAESMLogic::update_old_blob(pve_data_t& data, const endpoint_selection_infos_t& es_info) { uint32_t msg_size = 0; uint8_t *msg = NULL; @@ -191,9 +182,10 @@ ae_error_t PvEAESMLogic::update_old_blob(const psvn_t& psvn, const endpoint_sele } memset(msg, 0, msg_size); - AESM_DBG_TRACE("start to gen prov msg1, estimated size %d", msg_size); - ae_ret = CPVEClass::instance().gen_prov_msg1(&psvn, es_info.pek, - false, msg, msg_size);//generate ProvMsg1 + AESM_DBG_TRACE("start to gen prov msg1, estimate size %d", msg_size); + data.is_backup_retrieval = true; + data.is_performance_rekey = false; + ae_ret = CPVEClass::instance().gen_prov_msg1(data, msg, msg_size);//generate ProvMsg1 if (ae_ret != AE_SUCCESS) { AESM_DBG_WARN("gen prov msg1 failed:%d",ae_ret); @@ -216,10 +208,10 @@ ae_error_t PvEAESMLogic::update_old_blob(const psvn_t& psvn, const endpoint_sele goto ret_point; } - AESM_DBG_TRACE("start to proc msg4"); + AESM_DBG_TRACE("start to send msg4 to server"); if(GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg) == TYPE_PROV_MSG4){ - ae_ret = process_pve_msg4(resp_msg, resp_size, &psvn, false, NULL);//process ProvMsg4 and generated/save EPID Data Blob + ae_ret = process_pve_msg4(data, resp_msg, resp_size);//process ProvMsg4 and generated/save EPID Data Blob AESM_DBG_TRACE("msg4 processing finished, status %d",ae_ret); }else{ AESM_DBG_WARN("response message is not prov msg4"); @@ -280,8 +272,10 @@ aesm_error_t PvEAESMLogic::pve_error_postprocess(ae_error_t ae_error) return AESM_BACKEND_SERVER_BUSY; case AE_OUT_OF_MEMORY_ERROR: return AESM_OUT_OF_MEMORY_ERROR; - case PSW_UPDATED_REQUIRED: + case PSW_UPDATE_REQUIRED: return AESM_UPDATE_AVAILABLE; + case AESM_AE_OUT_OF_EPC: + return AESM_OUT_OF_EPC; default: return AESM_UNEXPECTED_ERROR; } @@ -292,12 +286,17 @@ aesm_error_t PvEAESMLogic::provision(bool performance_rekey_used, uint32_t timeo ae_error_t ae_ret = AE_SUCCESS; AESM_PROFILE_FUN; AESM_DBG_DEBUG("enter fun"); + AESM_DBG_TRACE("start end point selection"); ae_ret = start_epid_provision_thread(performance_rekey_used, timeout_usec); return pve_error_postprocess(ae_ret); } +static void log_provision_result(ae_error_t ae_ret) +{ + // Log provisioning results to the Admin Log +} ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) { @@ -307,32 +306,27 @@ ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) uint32_t resp_size = 0; ae_error_t ae_ret = AE_SUCCESS; uint32_t repeat = 0; - int retry = 0; endpoint_selection_infos_t es_info; + pve_data_t pve_data; + memset(&pve_data, 0, sizeof(pve_data)); if(AE_SUCCESS!=(ae_ret=aesm_start_request_wake_execution())){ AESM_DBG_ERROR("fail to request wake execution:%d", ae_ret); + log_provision_result(ae_ret); return ae_ret; } + AESM_DBG_TRACE("start end point selection"); if((ae_ret = EndpointSelectionInfo::instance().start_protocol(es_info))!=AE_SUCCESS){//EndPoint Selection Protocol to setup Provisioning URL (void)aesm_stop_request_wake_execution(); AESM_DBG_WARN("end point selection failed:%d",ae_ret); + log_provision_result(ae_ret); return ae_ret; } //If enclave_lost encountered(such as S3/S4 reached, the retry will be increased by 1, for other kinds of exception like network error, repeat is increased by 1) - while((ae_ret!=AE_ENCLAVE_LOST&&repeat < AESM_RETRY_COUNT) || (ae_ret == AE_ENCLAVE_LOST && retry < AESM_RETRY_COUNT)){ - if(ae_ret == AE_ENCLAVE_LOST){ - AESM_DBG_TRACE("enclave lost inside SGX Provisioning and reload PvE required"); - CPVEClass::instance().unload_enclave();//force PVE to be reloaded later - } - if((ae_ret = CPVEClass::instance().load_enclave())!=AE_SUCCESS) - { - AESM_DBG_ERROR("load pve failed:%d",ae_ret); - break; - } - //estimate upbound size of ProvMsg1 and alloc memory for it + while(repeat < AESM_RETRY_COUNT){ + //estimate upbound of ProvMsg1 and alloc memory for it msg_size = estimate_msg1_size(performance_rekey_used); AESM_DBG_TRACE("estimate msg1 size :%d",msg_size); assert(msg_size > 0); @@ -346,14 +340,16 @@ ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) memset(msg, 0, msg_size); //Generate ProvMsg1 - ae_ret = static_cast(CPVEClass::instance().gen_prov_msg1(NULL, es_info.pek, performance_rekey_used, msg, msg_size));//Generate ProvMsg1 + pve_data.is_backup_retrieval = false; + pve_data.is_performance_rekey = performance_rekey_used; + if(0!=memcpy_s(&pve_data.pek, sizeof(pve_data.pek), &es_info.pek, sizeof(es_info.pek))){ + AESM_DBG_ERROR("memcpy error"); + ae_ret = AE_FAILURE; + break; + } + ae_ret = static_cast(CPVEClass::instance().gen_prov_msg1(pve_data, msg, msg_size));//Generate ProvMsg1 if (ae_ret != AE_SUCCESS) { - if(ae_ret == AE_ENCLAVE_LOST){ - AESM_DBG_TRACE("Enclave lost after gen_prov_msg1"); - retry++; - continue; - } AESM_DBG_WARN("fail to generate prov msg1:%d",ae_ret); break; } @@ -378,16 +374,11 @@ ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) if(GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg) == TYPE_PROV_MSG2){//If responsed msg is ProvMsg2 psvn_t sigrl_svn; AESM_DBG_TRACE("start to process prov msg2, size %d", resp_size); - ae_ret = process_pve_msg2(sigrl_svn, resp_msg, resp_size, es_info); + ae_ret = process_pve_msg2(pve_data, resp_msg, resp_size, es_info);//processing following flow if response message is ProvMsg2 if(ae_ret != AE_SUCCESS){ if(ae_ret == PVE_EPIDBLOB_ERROR){//If it reports old EPID Blob Error AESM_DBG_TRACE("retrieve old epid blob"); - if((ae_ret = update_old_blob(sigrl_svn, es_info))!=AE_SUCCESS){//try to retrieve old EPID blob from backend server - if(ae_ret == AE_ENCLAVE_LOST){ - AESM_DBG_TRACE("PvE Enclave lost in update_old_blob"); - retry++; - continue; - } + if((ae_ret = update_old_blob(pve_data, es_info))!=AE_SUCCESS){//try to retrieve old EPID blob from backend server AESM_DBG_WARN("fail to retrieve old epid blob:%d",ae_ret); break; }else{ @@ -396,10 +387,6 @@ ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) repeat++;//only retry after update old epid blob continue; } - }else if(ae_ret == AE_ENCLAVE_LOST){ - AESM_DBG_TRACE("PvE enclave lost in process_pve_msg2"); - retry++; - continue; }else{ AESM_DBG_WARN("processing prov msg2 failed:%d",ae_ret); break; @@ -407,12 +394,7 @@ ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) } }else if(GET_TYPE_FROM_PROVISION_RESPONSE(resp_msg) == TYPE_PROV_MSG4){ AESM_DBG_TRACE("start to process prov msg4 for current psvn"); - if((ae_ret = process_pve_msg4(resp_msg,resp_size, NULL, false, NULL))!=AE_SUCCESS){//process ProvMsg4 to generate EPID blob if resp is Msg4 - if(ae_ret == AE_ENCLAVE_LOST){ - AESM_DBG_TRACE("PvE Enclave lost in process_pve_msg4"); - retry++; - continue; - } + if((ae_ret = process_pve_msg4(pve_data, resp_msg,resp_size))!=AE_SUCCESS){//process ProvMsg4 to generate EPID blob if resp is Msg4 AESM_DBG_WARN("fail to process prov msg4:%d",ae_ret); break; } @@ -431,6 +413,7 @@ ae_error_t PvEAESMLogic::epid_provision_thread_func(bool performance_rekey_used) AESMNetworkEncoding::aesm_free_response_msg(resp_msg); } (void)aesm_stop_request_wake_execution(); + log_provision_result(ae_ret); return ae_ret; } diff --git a/psw/ae/aesm_service/source/pve/pve_logic.h b/psw/ae/aesm_service/source/pve/pve_logic.h index c07a1495f8..1032d83de5 100644 --- a/psw/ae/aesm_service/source/pve/pve_logic.h +++ b/psw/ae/aesm_service/source/pve/pve_logic.h @@ -39,20 +39,29 @@ #include "se_thread.h" #include "oal/oal.h" #include "se_wrapper.h" +#include "epid_pve_type.h" #include #include typedef struct _endpoint_selection_infos_t endpoint_selection_infos_t; +typedef struct _pve_data_t{ + uint8_t sk[SK_SIZE]; + uint8_t xid[XID_SIZE]; + signed_pek_t pek; + bool is_performance_rekey; + bool is_backup_retrieval; + bk_platform_info_t bpi; +}pve_data_t; class PvEAESMLogic{ public: static aesm_error_t provision(bool performance_rekey_used, uint32_t timeout_usec); static aesm_error_t pve_error_postprocess(ae_error_t ae_error); static ae_error_t epid_provision_thread_func(bool performance_rekey_used); /*call get_epid_provision_thread_status().start(performance_rekey_used) to invoke this function with timeout*/ private: - static ae_error_t update_old_blob(const psvn_t& psvn, const endpoint_selection_infos_t& es_info); - static ae_error_t process_pve_msg2(psvn_t& sigrl_psvn, const uint8_t *msg2, uint32_t msg2_size, const endpoint_selection_infos_t& es_info); - static ae_error_t process_pve_msg4(const uint8_t *msg4, uint32_t msg4_size, const psvn_t* old_psvn, bool use_ek2, const uint8_t ek2[SK_SIZE]); + static ae_error_t update_old_blob(pve_data_t& pve_data, const endpoint_selection_infos_t& es_info); + static ae_error_t process_pve_msg2(pve_data_t& pve_data, const uint8_t *msg2, uint32_t msg2_size, const endpoint_selection_infos_t& es_info); + static ae_error_t process_pve_msg4(const pve_data_t& pve_data, const uint8_t *msg4, uint32_t msg4_size); }; #endif diff --git a/psw/ae/aesm_service/source/qe/QEClass.cpp b/psw/ae/aesm_service/source/qe/QEClass.cpp index 7e41bdaf76..8fca2a1dfd 100644 --- a/psw/ae/aesm_service/source/qe/QEClass.cpp +++ b/psw/ae/aesm_service/source/qe/QEClass.cpp @@ -34,6 +34,7 @@ #include "arch.h" #include "QEClass.h" #include "PVEClass.h" +#include "PCEClass.h" #include "se_memcpy.h" #include "prof_fun.h" #include "quoting_enclave_u.h" @@ -42,6 +43,7 @@ void CQEClass::before_enclave_load() { // always unload qe enclave before loading pve enclave CPVEClass::instance().unload_enclave(); + CPCEClass::instance().unload_enclave(); } uint32_t CQEClass::get_qe_target( @@ -81,6 +83,7 @@ uint32_t CQEClass::verify_blob( for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) { unload_enclave(); + // Reload an AE will not fail because of out of EPC, so AESM_AE_OUT_OF_EPC is not checked here if(AE_SUCCESS != load_enclave()) return AE_FAILURE; status = ::verify_blob(m_enclave_id, &ret, p_epid_blob, blob_size, @@ -110,7 +113,8 @@ uint32_t CQEClass::get_quote( uint32_t sigrl_size, sgx_report_t *p_qe_report, uint8_t *p_quote, - uint32_t quote_size) + uint32_t quote_size, + uint16_t pce_isv_svn) { uint32_t ret = AE_SUCCESS; sgx_status_t status = SGX_SUCCESS; @@ -131,10 +135,12 @@ uint32_t CQEClass::get_quote( sigrl_size, p_qe_report, p_quote, - quote_size); + quote_size, + pce_isv_svn); for(; status == SGX_ERROR_ENCLAVE_LOST && retry < AESM_RETRY_COUNT; retry++) { unload_enclave(); + // Reload an AE will not fail because of out of EPC, so AESM_AE_OUT_OF_EPC is not checked here if(AE_SUCCESS != load_enclave()) return AE_FAILURE; status = ::get_quote( @@ -150,7 +156,8 @@ uint32_t CQEClass::get_quote( sigrl_size, p_qe_report, p_quote, - quote_size); + quote_size, + pce_isv_svn); } if(status != SGX_SUCCESS) return AE_FAILURE; diff --git a/psw/ae/aesm_service/source/qe/QEClass.h b/psw/ae/aesm_service/source/qe/QEClass.h index e1e83ea4d4..8c6acb467b 100644 --- a/psw/ae/aesm_service/source/qe/QEClass.h +++ b/psw/ae/aesm_service/source/qe/QEClass.h @@ -66,7 +66,8 @@ public: uint32_t sigrl_size, sgx_report_t *p_qe_report, uint8_t *p_quote, - uint32_t quote_size); + uint32_t quote_size, + uint16_t pce_isv_svn); }; #endif diff --git a/psw/ae/aesm_service/source/qe/qe_logic.cpp b/psw/ae/aesm_service/source/qe/qe_logic.cpp index 66d8e567b2..bf43681247 100644 --- a/psw/ae/aesm_service/source/qe/qe_logic.cpp +++ b/psw/ae/aesm_service/source/qe/qe_logic.cpp @@ -31,6 +31,7 @@ #include "aesm_epid_blob.h" +#include "aesm_xegd_blob.h" #include "qe_logic.h" #include "pve_logic.h" #include "aesm_logic.h" @@ -92,7 +93,7 @@ static aesm_error_t try_reprovision_if_not(bool& updated, epid_blob_with_cur_psv // the qe_isv_svn or cpu_svn don't match that in Epid Data Blob aesm_error_t QEAESMLogic::init_quote( sgx_target_info_t *target, - uint8_t *gid, uint32_t gid_size, + uint8_t *gid, uint32_t gid_size, uint16_t pce_isv_svn, uint16_t qe_isv_svn, const sgx_cpu_svn_t qe_cpu_svn) { ae_error_t ae_ret = AE_SUCCESS; @@ -107,9 +108,21 @@ aesm_error_t QEAESMLogic::init_quote( bool updated = false; memset(&epid_data,0,sizeof(epid_data)); + uint32_t xegd_xeid = AESMLogic::get_active_extended_epid_group_id(); AESM_DBG_TRACE("start read and verify old epid blob"); - if((ae_ret = epid_blob.read(epid_data))!=AE_SUCCESS){ - if(AESM_SUCCESS!=(aesm_result = try_reprovision_if_not(updated, epid_data))){ + uint32_t epid_xeid = 0; + //EPID BLOB not exist + if ((ae_ret = epid_blob.read(epid_data)) != AE_SUCCESS ){ + if (AESM_SUCCESS != (aesm_result = try_reprovision_if_not(updated, epid_data))){ + goto ret_point; + } + } + //ExtEPIDGroupID not match + else if ((ae_ret = epid_blob.get_extended_epid_group_id(&epid_xeid)) == AE_SUCCESS && + xegd_xeid != epid_xeid) + { + (void)epid_blob.remove(); + if (AESM_SUCCESS != (aesm_result = try_reprovision_if_not(updated, epid_data))){ goto ret_point; } } @@ -117,17 +130,26 @@ aesm_error_t QEAESMLogic::init_quote( if((ae_ret = CQEClass::instance().load_enclave())!=AE_SUCCESS) { AESM_DBG_ERROR("Fail to load QE:%d", ae_ret); - aesm_result = AESM_UNEXPECTED_ERROR; + if(ae_ret == AESM_AE_OUT_OF_EPC) + aesm_result = AESM_OUT_OF_EPC; + else + aesm_result = AESM_UNEXPECTED_ERROR; goto ret_point; } ae_ret = static_cast(CQEClass::instance().verify_blob(epid_data.trusted_epid_blob, - SGX_TRUSTED_EPID_BLOB_SIZE, + SGX_TRUSTED_EPID_BLOB_SIZE_PAK, &resealed)); if(ae_ret == QE_EPIDBLOB_ERROR){ + (void)epid_blob.remove(); if(AESM_SUCCESS!=(aesm_result = try_reprovision_if_not(updated, epid_data))){ goto ret_point; } } + else if(ae_ret == AESM_AE_OUT_OF_EPC) + { + aesm_result = AESM_OUT_OF_EPC; + goto ret_point; + } else if(ae_ret != AE_SUCCESS) { aesm_result = AESM_UNEXPECTED_ERROR; @@ -145,22 +167,26 @@ aesm_error_t QEAESMLogic::init_quote( AESM_DBG_TRACE("get gid %d from epid blob (little-endian)", *(uint32_t*) gid); - - if(get_qe_target(target)!=AE_SUCCESS){ + ae_ret = get_qe_target(target); + if(ae_ret!=AE_SUCCESS){ AESM_DBG_ERROR("get qe target failed"); + if(ae_ret==AESM_AE_OUT_OF_EPC) + aesm_result = AESM_OUT_OF_EPC; + else aesm_result = AESM_UNEXPECTED_ERROR; goto ret_point; } AESM_DBG_TRACE("get qe_target flags:%llx xfrm:%llx", target->attributes.flags, target->attributes.xfrm); //Any Quoting enclave related code must be before this section to avoid QE/PvE unloading each other - //Do the upgrade reprovision if required - AESM_DBG_TRACE("qe_isv_svn %d, epid_isv_svn %df",qe_isv_svn, epid_data.cur_psvn.isv_svn); - if((qe_isv_svn > epid_data.cur_psvn.isv_svn) - || (0!=memcmp(&qe_cpu_svn, &epid_data.cur_psvn.cpu_svn, + //do the upgrade reprovision after all Quoting Enclave works + AESM_DBG_TRACE("qe_isv_svn %d, epid_isv_svn %d",qe_isv_svn, epid_data.cur_pi.pve_svn); + if((qe_isv_svn > epid_data.cur_pi.pve_svn) + || (pce_isv_svn > epid_data.cur_pi.pce_svn) + || (0!=memcmp(&qe_cpu_svn, &epid_data.cur_pi.cpu_svn, sizeof(sgx_cpu_svn_t)))) { - //We will ignore all provision failure when there is a working EPID blob and leave the decision to attestation server + if(AESM_SUCCESS == (aesm_result = try_reprovision_if_not(updated, epid_data))){ resealed = false; }else if(AESM_PROXY_SETTING_ASSIST == aesm_result || @@ -189,7 +215,7 @@ aesm_error_t QEAESMLogic::get_quote(const uint8_t *report, const uint8_t *nonce, const uint8_t *sigrl, uint32_t sigrl_size, uint8_t *qe_report, - uint8_t *quote, uint32_t buf_size) + uint8_t *quote, uint32_t buf_size, uint16_t pce_isv_svn) { epid_blob_with_cur_psvn_t epid_data; uint32_t ae_ret = AE_SUCCESS; @@ -209,15 +235,18 @@ aesm_error_t QEAESMLogic::get_quote(const uint8_t *report, } } - if(CQEClass::instance().load_enclave()) + if((ae_ret = CQEClass::instance().load_enclave())!=AE_SUCCESS) { AESM_DBG_ERROR("load QE failed"); - aesm_result = AESM_UNEXPECTED_ERROR; + if(ae_ret == AESM_AE_OUT_OF_EPC) + aesm_result = AESM_OUT_OF_EPC; + else + aesm_result = AESM_UNEXPECTED_ERROR; goto CLEANUP; } AESM_DBG_TRACE("start to get quote"); ae_ret = CQEClass::instance().get_quote(epid_data.trusted_epid_blob, - SGX_TRUSTED_EPID_BLOB_SIZE, + SGX_TRUSTED_EPID_BLOB_SIZE_PAK, reinterpret_cast(report), static_cast(quote_type), reinterpret_cast(spid), @@ -226,7 +255,7 @@ aesm_error_t QEAESMLogic::get_quote(const uint8_t *report, sigrl_size, reinterpret_cast(qe_report), quote, - buf_size); + buf_size, pce_isv_svn); if(ae_ret != AE_SUCCESS) { AESM_DBG_TRACE("get_quote failed:%d",ae_ret); diff --git a/psw/ae/aesm_service/source/qe/qe_logic.h b/psw/ae/aesm_service/source/qe/qe_logic.h index 22227bd103..48501cf862 100644 --- a/psw/ae/aesm_service/source/qe/qe_logic.h +++ b/psw/ae/aesm_service/source/qe/qe_logic.h @@ -45,8 +45,8 @@ class QEAESMLogic{ public: static aesm_error_t init_quote(sgx_target_info_t *target_info, - uint8_t *gid, uint32_t gid_size, uint16_t qe_isv_svn, - const sgx_cpu_svn_t qe_cpu_svn); + uint8_t *gid, uint32_t gid_size, uint16_t pce_isv_svn, + uint16_t qe_isv_svn, const sgx_cpu_svn_t qe_cpu_svn); static aesm_error_t get_quote(const uint8_t *report, uint32_t quote_type, @@ -54,7 +54,7 @@ public: const uint8_t *nonce, const uint8_t *sigrl, uint32_t sigrl_size, uint8_t *qe_report, - uint8_t *quote, uint32_t buf_size); + uint8_t *quote, uint32_t buf_size, uint16_t pce_isv_svn); }; #endif diff --git a/psw/ae/aesm_service/source/storage/persistent_storage_info.h b/psw/ae/aesm_service/source/storage/persistent_storage_info.h index 1f9e4e5b2e..fd5e2f203d 100644 --- a/psw/ae/aesm_service/source/storage/persistent_storage_info.h +++ b/psw/ae/aesm_service/source/storage/persistent_storage_info.h @@ -33,7 +33,7 @@ #define _PERSISTENT_STORAGE_INFO_H_ #include "oal/aesm_persistent_storage.h" -typedef enum _aesm_location_info_t {AESM_LOCATION_EXE_FOLDER, AESM_LOCATION_DATA} aesm_location_info_t; +typedef enum _aesm_location_info_t {AESM_LOCATION_EXE_FOLDER, AESM_LOCATION_DATA, AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA} aesm_location_info_t; typedef enum _aesm_file_access_type_t { AESM_FILE_ACCESS_PATH_ONLY, /*We will only get pathname of the file obj via oal interface but AESM could still access the file via other APIs*/ AESM_FILE_ACCESS_READ_ONLY, /*Only read the data*/ diff --git a/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp b/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp index 076056a8d2..b419935d55 100644 --- a/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp +++ b/psw/ae/aesm_service/source/storage/persistent_storage_table.cpp @@ -40,10 +40,13 @@ static const persistent_storage_info_t psinfos[]={ {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pve"},//PVE_ENCLAVE_FID {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pse_op"},//PSE_OP_ENCLAVE_FID {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pse_pr"},//PSE_PR_ENCLAVE_FID + {FT_ENCLAVE_NAME, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "pce"}, //PCE_ENCLAVE_FID {FT_PERSISTENT_STORAGE, AESM_LOCATION_EXE_FOLDER, AESM_FILE_ACCESS_PATH_ONLY, "le_prod_css.bin"},//LE_PROD_SIG_STRUCT_FID + { FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "active_extended_epid_group_id" }, // EXTENDED_EPID_GROUP_ID_FID + { FT_PERSISTENT_STORAGE, AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA, AESM_FILE_ACCESS_READ_ONLY, "extended_epid_group.blob" }, //EXTENDED_EPID_GROUP_BLOB_INFO_FID {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "endpoint_selection_info.blob"},//PROVISION_PEK_BLOB_FID {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_ALL, "epid_data.blob"},//EPID_DATA_BLOB_FID - {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_READ_ONLY, "aesm_server_url.blob"},//AESM_SERVER_URL_FID + { FT_PERSISTENT_STORAGE, AESM_LOCATION_MULTI_EXTENDED_EPID_GROUP_DATA, AESM_FILE_ACCESS_READ_ONLY, "aesm_server_url.blob" },//AESM_SERVER_URL_FID {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, "pse_vmc.db"},//VMC_DATABASE_FID {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, "backup_pse_vmc.db"},//VMC_DATABASE_BK_FID {FT_PERSISTENT_STORAGE, AESM_LOCATION_DATA, AESM_FILE_ACCESS_PATH_ONLY, "prebuild_pse_vmc.db"},//VMC_DATABASE_PREBUILD_FID diff --git a/psw/ae/aesm_service/source/upse/platform_info_blob.h b/psw/ae/aesm_service/source/upse/platform_info_blob.h index f24a566f99..aaee47a4d7 100644 --- a/psw/ae/aesm_service/source/upse/platform_info_blob.h +++ b/psw/ae/aesm_service/source/upse/platform_info_blob.h @@ -55,6 +55,7 @@ const uint8_t QE_EPID_GROUP_OUT_OF_DATE = 0x04; /* Masks for sgx_tcb_evaluation_flags*/ const uint16_t QUOTE_CPUSVN_OUT_OF_DATE = 0x0001; const uint16_t QUOTE_ISVSVN_QE_OUT_OF_DATE = 0x0002; +const uint16_t QUOTE_ISVSVN_PCE_OUT_OF_DATE = 0x0004; /* Masks for sgx_pse_evaluation_flags PS_SEC_PROP_DESC.PSE_ISVSVN is out of date*/ @@ -81,7 +82,7 @@ typedef struct _platform_info_blob_wrapper_t tcb_psvn_t latest_equivalent_tcb_psvn; pse_isvsvn_t latest_pse_isvsvn; psda_svn_t latest_psda_svn; - GroupID performance_rekey_gid; + uint32_t xeid; GroupID gid; sgx_ec256_signature_t signature; } platform_info_blob; diff --git a/psw/ae/common/inc/AEGetWhiteListRequest.h b/psw/ae/common/inc/AEGetWhiteListRequest.h new file mode 100644 index 0000000000..03caae525c --- /dev/null +++ b/psw/ae/common/inc/AEGetWhiteListRequest.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_GET_WHITE_LIST_REQUEST_H +#define _AE_GET_WHITE_LIST_REQUEST_H + +#include + +class AEGetWhiteListRequest : public IAERequest +{ + public: + AEGetWhiteListRequest(); + AEGetWhiteListRequest(uint32_t whiteListSize, uint32_t timeout); + AEGetWhiteListRequest(const AEGetWhiteListRequest& other); + ~AEGetWhiteListRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t whiteListSize, uint32_t timeout); + + //getters + int GetWhiteListSize() const { return mWhiteListSize; } + + //operators + bool operator==(const AEGetWhiteListRequest& other) const; + AEGetWhiteListRequest& operator=(const AEGetWhiteListRequest& request); + + //checks + bool check(); + void visit(IAERequestVisitor& visitor); + + //hooks + IAEResponse* execute(IAESMLogic* aesmLogic); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + + protected: + void ReleaseMemory(); + void CopyFields(uint32_t whiteListSize, uint32_t timeout); + + uint32_t mWhiteListSize; +}; + +#endif diff --git a/psw/ae/common/inc/AEGetWhiteListResponse.h b/psw/ae/common/inc/AEGetWhiteListResponse.h new file mode 100644 index 0000000000..33d3ef4907 --- /dev/null +++ b/psw/ae/common/inc/AEGetWhiteListResponse.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_WHITE_LIST_RESPONSE_H +#define __AE_GET_WHITE_LIST_RESPONSE_H + +#include +#include + +class ISerializer; + +class AEGetWhiteListResponse : public IAEResponse +{ + public: + AEGetWhiteListResponse(); //default ... will prepare a response that will later be inflated + + AEGetWhiteListResponse(int errorCode, uint32_t whiteListLength, const uint8_t * whiteList); + AEGetWhiteListResponse(const AEGetWhiteListResponse& other); + + ~AEGetWhiteListResponse(); + + //inflater + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + + //getters + inline uint32_t GetWhiteListLength() const { return mWhiteListLength; } + inline const uint8_t* GetWhiteList() const { return mWhiteList; } + + AEMessage* serialize(ISerializer* serializer); + + //this is used to inflate values from a serializer, instead of creating the object directly + void inflateValues(int errorCode, uint32_t whiteListLength, const uint8_t * whiteList); + + //operators + virtual bool operator==(const AEGetWhiteListResponse &other) const; + AEGetWhiteListResponse& operator=(const AEGetWhiteListResponse &other); + + void visit(IAEResponseVisitor& visitor); + + //checks + bool check(); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t whiteListLength, const uint8_t * whiteList); + + uint32_t mWhiteListLength; + uint8_t * mWhiteList; +}; + +#endif diff --git a/psw/ae/common/inc/AEGetWhiteListSizeRequest.h b/psw/ae/common/inc/AEGetWhiteListSizeRequest.h new file mode 100644 index 0000000000..6767c330e3 --- /dev/null +++ b/psw/ae/common/inc/AEGetWhiteListSizeRequest.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_WHITE_LIST_SIZE_REQUEST_H +#define __AE_GET_WHITE_LIST_SIZE_REQUEST_H + +#include +class IAESMLogic; + +class AEGetWhiteListSizeRequest : public IAERequest{ + public: + AEGetWhiteListSizeRequest(uint32_t timeout = 0); + AEGetWhiteListSizeRequest(const AEGetWhiteListSizeRequest& other); + ~AEGetWhiteListSizeRequest(); + + void ReleaseMemory(); + + AEMessage* serialize(ISerializer* serializer); + + //inflater -> empty for now ... but soon + void inflateValues(uint32_t timeout = 0); + + //checks + bool check() {return true;} // no special check for this object. Maybe later + virtual IAEResponse* execute(IAESMLogic*); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + bool operator==(const AEGetWhiteListSizeRequest& other) const; + AEGetWhiteListSizeRequest& operator=(const AEGetWhiteListSizeRequest& other); + void visit(IAERequestVisitor& visitor); + void CopyFields(uint32_t timeout); +}; + +#endif diff --git a/psw/ae/common/inc/AEGetWhiteListSizeResponse.h b/psw/ae/common/inc/AEGetWhiteListSizeResponse.h new file mode 100644 index 0000000000..ff61b98980 --- /dev/null +++ b/psw/ae/common/inc/AEGetWhiteListSizeResponse.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_GET_WHITE_LIST_SIZE_RESPONSE_H +#define __AE_GET_WHITE_LIST_SIZE_RESPONSE_H + +#include +#include + +class ISerializer; + +class AEGetWhiteListSizeResponse : public IAEResponse +{ + public: + AEGetWhiteListSizeResponse(); //default ... will prepare a response that will later be inflated + + AEGetWhiteListSizeResponse(int errorCode, uint32_t white_list_size); + AEGetWhiteListSizeResponse(const AEGetWhiteListSizeResponse& other); + + ~AEGetWhiteListSizeResponse(); + + //inflater + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + + inline uint32_t GetWhiteListSize() const { return mWhiteListSize;} + + AEMessage* serialize(ISerializer* serializer); + + //this is used to inflate values from a serializer, instead of creating the object directly + void inflateValues(int errorCode, uint32_t white_list_size); + + //operators + virtual bool operator==(const AEGetWhiteListSizeResponse &other) const; + AEGetWhiteListSizeResponse& operator=(const AEGetWhiteListSizeResponse &other); + + void visit(IAEResponseVisitor& visitor); + + //checks + bool check(); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t white_list_size); + + uint32_t mWhiteListSize; +}; + +#endif diff --git a/psw/ae/common/inc/AESGXGetExtendedEpidGroupIdRequest.h b/psw/ae/common/inc/AESGXGetExtendedEpidGroupIdRequest.h new file mode 100644 index 0000000000..8aafdb1bfb --- /dev/null +++ b/psw/ae/common/inc/AESGXGetExtendedEpidGroupIdRequest.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_SGX_GET_EXTENDED_GROUP_ID_REQUEST_H +#define __AE_SGX_GET_EXTENDED_GROUP_ID_REQUEST_H + +#include +class IAESMLogic; + +class AESGXGetExtendedEpidGroupIdRequest : public IAERequest{ + public: + AESGXGetExtendedEpidGroupIdRequest(uint32_t timeout = 0); + AESGXGetExtendedEpidGroupIdRequest(const AESGXGetExtendedEpidGroupIdRequest& other); + ~AESGXGetExtendedEpidGroupIdRequest(); + + void ReleaseMemory(); + + AEMessage* serialize(ISerializer* serializer); + + //inflater -> empty for now ... but soon + void inflateValues(uint32_t timeout = 0); + + //checks + bool check() {return true;} // no special check for this object. Maybe later + virtual IAEResponse* execute(IAESMLogic*); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + bool operator==(const AESGXGetExtendedEpidGroupIdRequest& other) const; + AESGXGetExtendedEpidGroupIdRequest& operator=(const AESGXGetExtendedEpidGroupIdRequest& other); + void visit(IAERequestVisitor& visitor); + void CopyFields(uint32_t timeout); +}; + +#endif diff --git a/psw/ae/common/inc/AESGXGetExtendedEpidGroupIdResponse.h b/psw/ae/common/inc/AESGXGetExtendedEpidGroupIdResponse.h new file mode 100644 index 0000000000..d6f709b2ca --- /dev/null +++ b/psw/ae/common/inc/AESGXGetExtendedEpidGroupIdResponse.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __AE_SGX_GET_EXTENDED_GROUP_ID_RESPONSE_H +#define __AE_SGX_GET_EXTENDED_GROUP_ID_RESPONSE_H + +#include +#include + +class ISerializer; + +class AESGXGetExtendedEpidGroupIdResponse : public IAEResponse +{ + public: + AESGXGetExtendedEpidGroupIdResponse(); //default ... will prepare a response that will later be inflated + + AESGXGetExtendedEpidGroupIdResponse(int errorCode, uint32_t x_group_id); + AESGXGetExtendedEpidGroupIdResponse(const AESGXGetExtendedEpidGroupIdResponse& other); + + ~AESGXGetExtendedEpidGroupIdResponse(); + + //inflater + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + + inline uint32_t GetExtendedEpidGroupId() const { return mExtendedEpidGroupId;} + + AEMessage* serialize(ISerializer* serializer); + + //this is used to inflate values from a serializer, instead of creating the object directly + void inflateValues(int errorCode, uint32_t x_group_id); + + //operators + virtual bool operator==(const AESGXGetExtendedEpidGroupIdResponse &other) const; + AESGXGetExtendedEpidGroupIdResponse& operator=(const AESGXGetExtendedEpidGroupIdResponse &other); + + void visit(IAEResponseVisitor& visitor); + + //checks + bool check(); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode, uint32_t x_group_id); + + uint32_t mExtendedEpidGroupId; +}; + +#endif diff --git a/psw/ae/common/inc/AESGXSwitchExtendedEpidGroupRequest.h b/psw/ae/common/inc/AESGXSwitchExtendedEpidGroupRequest.h new file mode 100644 index 0000000000..da59a8ecf8 --- /dev/null +++ b/psw/ae/common/inc/AESGXSwitchExtendedEpidGroupRequest.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_SGX_SWITCH_EXTENDED_GROUP_REQUEST_H +#define _AE_SGX_SWITCH_EXTENDED_GROUP_REQUEST_H + +#include + +class AESGXSwitchExtendedEpidGroupRequest : public IAERequest +{ + public: + AESGXSwitchExtendedEpidGroupRequest(); + AESGXSwitchExtendedEpidGroupRequest(uint32_t extendedGroupId, uint32_t timeout); + AESGXSwitchExtendedEpidGroupRequest(const AESGXSwitchExtendedEpidGroupRequest& other); + ~AESGXSwitchExtendedEpidGroupRequest(); + + AEMessage* serialize(ISerializer* serializer); + void inflateValues(uint32_t extendedGroupId, uint32_t timeout); + + //getters + int GetExtendedEpidGroupId() const { return mExtendedEpidGroupId; } + + //operators + bool operator==(const AESGXSwitchExtendedEpidGroupRequest& other) const; + AESGXSwitchExtendedEpidGroupRequest& operator=(const AESGXSwitchExtendedEpidGroupRequest& request); + + //checks + bool check(); + void visit(IAERequestVisitor& visitor); + + //hooks + IAEResponse* execute(IAESMLogic* aesmLogic); + + //used to determin in which queue to be placed + virtual RequestClass getRequestClass(); + + protected: + void ReleaseMemory(); + void CopyFields(uint32_t extendedGroupId, uint32_t timeout); + + uint32_t mExtendedEpidGroupId; +}; + +#endif diff --git a/psw/ae/common/inc/AESGXSwitchExtendedEpidGroupResponse.h b/psw/ae/common/inc/AESGXSwitchExtendedEpidGroupResponse.h new file mode 100644 index 0000000000..32f5f3eaa5 --- /dev/null +++ b/psw/ae/common/inc/AESGXSwitchExtendedEpidGroupResponse.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _AE_SGX_SWITCH_EXTENDED_GROUP_RESPONSE_H +#define _AE_SGX_SWITCH_EXTENDED_GROUP_RESPONSE_H + +#include + +class AESGXSwitchExtendedEpidGroupResponse : public IAEResponse +{ + public: + AESGXSwitchExtendedEpidGroupResponse(); + AESGXSwitchExtendedEpidGroupResponse(int errorCode); + AESGXSwitchExtendedEpidGroupResponse(const AESGXSwitchExtendedEpidGroupResponse& other); + ~AESGXSwitchExtendedEpidGroupResponse(); + + AEMessage* serialize(ISerializer* serializer); + bool inflateWithMessage(AEMessage* message, ISerializer* serializer); + void inflateValues(int errorCode); + + //operators + bool operator==(const AESGXSwitchExtendedEpidGroupResponse& other) const; + AESGXSwitchExtendedEpidGroupResponse& operator=(const AESGXSwitchExtendedEpidGroupResponse& other); + + //checks + bool check(); + virtual void visit(IAEResponseVisitor& visitor); + + protected: + void ReleaseMemory(); + void CopyFields(int errorCode); + +}; + +#endif diff --git a/psw/ae/common/inc/IAERequest.h b/psw/ae/common/inc/IAERequest.h index 9254c0b3d4..85bd123a28 100644 --- a/psw/ae/common/inc/IAERequest.h +++ b/psw/ae/common/inc/IAERequest.h @@ -105,6 +105,10 @@ class AEGetLaunchTokenRequest; class AEGetQuoteRequest; class AEInitQuoteRequest; class AEGetPsCapRequest; +class AEGetWhiteListSizeRequest; +class AEGetWhiteListRequest; +class AESGXGetExtendedEpidGroupIdRequest; +class AESGXSwitchExtendedEpidGroupRequest; class IAERequestVisitor { @@ -118,6 +122,10 @@ class IAERequestVisitor virtual void visitExchangeReportRequest(AEExchangeReportRequest&) = 0; virtual void visitCloseSessionRequest(AECloseSessionRequest&) = 0; virtual void visitGetPsCapRequest(AEGetPsCapRequest&) = 0; + virtual void visitGetWhiteListSizeRequest(AEGetWhiteListSizeRequest&) = 0; + virtual void visitGetWhiteListRequest(AEGetWhiteListRequest&) = 0; + virtual void visitSGXGetExtendedEpidGroupIdRequest(AESGXGetExtendedEpidGroupIdRequest&) = 0; + virtual void visitSGXSwitchExtendedEpidGroupRequest(AESGXSwitchExtendedEpidGroupRequest&) = 0; virtual ~IAERequestVisitor() = 0; }; diff --git a/psw/ae/common/inc/IAEResponse.h b/psw/ae/common/inc/IAEResponse.h index 0fb9719b99..9b4f21bf93 100644 --- a/psw/ae/common/inc/IAEResponse.h +++ b/psw/ae/common/inc/IAEResponse.h @@ -49,6 +49,10 @@ class AEGetLaunchTokenResponse; class AEGetQuoteResponse; class AEInitQuoteResponse; class AEGetPsCapResponse; +class AEGetWhiteListSizeResponse; +class AEGetWhiteListResponse; +class AESGXGetExtendedEpidGroupIdResponse; +class AESGXSwitchExtendedEpidGroupResponse; #include @@ -64,6 +68,10 @@ class IAEResponseVisitor virtual void visitExchangeReportResponse(AEExchangeReportResponse&) = 0; virtual void visitCloseSessionResponse(AECloseSessionResponse&) = 0; virtual void visitGetPsCapResponse(AEGetPsCapResponse&) = 0; + virtual void visitGetWhiteListSizeResponse(AEGetWhiteListSizeResponse&) = 0; + virtual void visitGetWhiteListResponse(AEGetWhiteListResponse&) = 0; + virtual void visitSGXGetExtendedEpidGroupIdResponse(AESGXGetExtendedEpidGroupIdResponse&) = 0; + virtual void visitSGXSwitchExtendedEpidGroupResponse(AESGXSwitchExtendedEpidGroupResponse&) = 0; virtual ~IAEResponseVisitor() {}; }; diff --git a/psw/ae/common/inc/IAESMLogic.h b/psw/ae/common/inc/IAESMLogic.h index 95d685b9ab..82e43909b5 100644 --- a/psw/ae/common/inc/IAESMLogic.h +++ b/psw/ae/common/inc/IAESMLogic.h @@ -77,6 +77,10 @@ class IAESMLogic { virtual aesm_error_t reportAttestationStatus(uint8_t* platform_info, uint32_t platform_info_size, uint32_t attestation_error_code, uint8_t* update_info, uint32_t update_info_size) = 0; + virtual aesm_error_t getWhiteListSize(uint32_t* white_list_size) = 0; + virtual aesm_error_t getWhiteList(uint8_t* white_list, uint32_t mWhiteListSize) = 0; + virtual aesm_error_t sgxGetExtendedEpidGroupId(uint32_t* x_group_id) = 0; + virtual aesm_error_t sgxSwitchExtendedEpidGroup(uint32_t x_group_id) = 0; virtual void service_stop() = 0; virtual ~IAESMLogic(){}; }; diff --git a/psw/ae/common/inc/ISerializer.h b/psw/ae/common/inc/ISerializer.h index 6da6d931ec..ede1a56170 100644 --- a/psw/ae/common/inc/ISerializer.h +++ b/psw/ae/common/inc/ISerializer.h @@ -60,6 +60,18 @@ class AEGetPsCapResponse; class AEReportAttestationRequest; class AEReportAttestationResponse; +class AEGetWhiteListSizeRequest; +class AEGetWhiteListSizeResponse; + +class AEGetWhiteListRequest; +class AEGetWhiteListResponse; + +class AESGXGetExtendedEpidGroupIdRequest; +class AESGXGetExtendedEpidGroupIdResponse; + +class AESGXSwitchExtendedEpidGroupRequest; +class AESGXSwitchExtendedEpidGroupResponse; + class IAERequest; class IAEResponse; @@ -76,6 +88,10 @@ class ISerializer{ virtual AEMessage* serialize(AECloseSessionRequest* request) = 0; virtual AEMessage* serialize(AEGetPsCapRequest* request) = 0; virtual AEMessage* serialize(AEReportAttestationRequest* request) = 0; + virtual AEMessage* serialize(AEGetWhiteListRequest* request) = 0; + virtual AEMessage* serialize(AEGetWhiteListSizeRequest* request) = 0; + virtual AEMessage* serialize(AESGXGetExtendedEpidGroupIdRequest* request) = 0; + virtual AEMessage* serialize(AESGXSwitchExtendedEpidGroupRequest* request) = 0; //response serializers virtual AEMessage* serialize(AEInitQuoteResponse* response) = 0; @@ -87,6 +103,10 @@ class ISerializer{ virtual AEMessage* serialize(AECloseSessionResponse* response) = 0; virtual AEMessage* serialize(AEGetPsCapResponse* response) = 0; virtual AEMessage* serialize(AEReportAttestationResponse* response) = 0; + virtual AEMessage* serialize(AEGetWhiteListSizeResponse* response) = 0; + virtual AEMessage* serialize(AEGetWhiteListResponse* response) = 0; + virtual AEMessage* serialize(AESGXGetExtendedEpidGroupIdResponse* response) = 0; + virtual AEMessage* serialize(AESGXSwitchExtendedEpidGroupResponse* response) = 0; //request inflater -> will inflate request objects by unmarshaling communication level data (this will be used by server) virtual IAERequest* inflateRequest(AEMessage* message) = 0; @@ -101,7 +121,10 @@ class ISerializer{ virtual bool inflateResponse(AEMessage* message, AECloseSessionResponse* response) = 0; virtual bool inflateResponse(AEMessage* message, AEGetPsCapResponse* response) = 0; virtual bool inflateResponse(AEMessage* message, AEReportAttestationResponse* response) = 0; - + virtual bool inflateResponse(AEMessage* message, AEGetWhiteListSizeResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AEGetWhiteListResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AESGXGetExtendedEpidGroupIdResponse* response) = 0; + virtual bool inflateResponse(AEMessage* message, AESGXSwitchExtendedEpidGroupResponse* response) = 0; virtual ~ISerializer() {} }; diff --git a/psw/ae/common/inc/ProtobufSerializer.h b/psw/ae/common/inc/ProtobufSerializer.h index b2e694334b..c7d60f9e4c 100644 --- a/psw/ae/common/inc/ProtobufSerializer.h +++ b/psw/ae/common/inc/ProtobufSerializer.h @@ -57,6 +57,10 @@ class ProtobufSerializer : public ISerializer{ AEMessage* serialize(AECloseSessionRequest* request); AEMessage* serialize(AEGetPsCapRequest* request); AEMessage* serialize(AEReportAttestationRequest* request); + AEMessage* serialize(AEGetWhiteListSizeRequest* request); + AEMessage* serialize(AEGetWhiteListRequest* request); + AEMessage* serialize(AESGXGetExtendedEpidGroupIdRequest* request); + AEMessage* serialize(AESGXSwitchExtendedEpidGroupRequest* request); //response serializers AEMessage* serialize(AEInitQuoteResponse* response); @@ -68,6 +72,10 @@ class ProtobufSerializer : public ISerializer{ AEMessage* serialize(AECloseSessionResponse* response); AEMessage* serialize(AEGetPsCapResponse* response); AEMessage* serialize(AEReportAttestationResponse* response); + AEMessage* serialize(AEGetWhiteListSizeResponse* response); + AEMessage* serialize(AEGetWhiteListResponse* response); + AEMessage* serialize(AESGXGetExtendedEpidGroupIdResponse* response); + AEMessage* serialize(AESGXSwitchExtendedEpidGroupResponse* response); //base inflate request IAERequest* inflateRequest(AEMessage* message); @@ -82,6 +90,10 @@ class ProtobufSerializer : public ISerializer{ bool inflateResponse(AEMessage* message, AECloseSessionResponse* response); bool inflateResponse(AEMessage* message, AEGetPsCapResponse* response); bool inflateResponse(AEMessage* message, AEReportAttestationResponse* response); + bool inflateResponse(AEMessage* message, AEGetWhiteListSizeResponse* response); + bool inflateResponse(AEMessage* message, AEGetWhiteListResponse *response); + bool inflateResponse(AEMessage* message, AESGXGetExtendedEpidGroupIdResponse* response); + bool inflateResponse(AEMessage* message, AESGXSwitchExtendedEpidGroupResponse* response); private: //request inflaters @@ -94,6 +106,10 @@ class ProtobufSerializer : public ISerializer{ IAERequest* inflateInvokeServiceRequest(aesm::message::Request* reqMsg); IAERequest* inflateGetPsCapRequest(aesm::message::Request* reqMsg); IAERequest* inflateReportAttestationErrorRequest(aesm::message::Request* reqMsg); + IAERequest* inflateGetWhiteListSizeRequest(aesm::message::Request* reqMsg); + IAERequest* inflateGetWhiteListRequest(aesm::message::Request* reqMsg); + IAERequest* inflateSGXGetExtendedEpidGroupIdRequest(aesm::message::Request* reqMsg); + IAERequest* inflateSGXSwitchExtendedEpidGroupRequest(aesm::message::Request* reqMsg); }; #endif diff --git a/sdk/tlibc/math/w_pow10l.c b/psw/ae/common/inc/debug_log.h similarity index 79% rename from sdk/tlibc/math/w_pow10l.c rename to psw/ae/common/inc/debug_log.h index f191c5155f..7b55b98367 100644 --- a/sdk/tlibc/math/w_pow10l.c +++ b/psw/ae/common/inc/debug_log.h @@ -28,15 +28,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#ifndef __DEBUG_LOG_H_ +#define __DEBUG_LOG_H_ -#include -#include +#ifdef DEBUG +#include -#if (LDBL_MANT_DIG > DBL_MANT_DIG) - -long double pow10l(long double x) -{ - return powl(10, x); -} +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, __FILE__, __VA_ARGS__) +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, __FILE__, __VA_ARGS__) +#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, __FILE__, __VA_ARGS__) +#else +#define LOGD(...) +#define LOGE(...) +#define LOGI(...) +#endif #endif diff --git a/psw/ae/common/pek_pub_key.cpp b/psw/ae/common/pek_pub_key.cpp index 59940d5b1c..aeaa47a713 100644 --- a/psw/ae/common/pek_pub_key.cpp +++ b/psw/ae/common/pek_pub_key.cpp @@ -34,12 +34,16 @@ #include "pek_pub_key.h" #include "pve_qe_common.h" #include +#include "xegdsk_pub.hh" #include "peksk_pub.hh" +#include "qsdk_pub.hh" +#include "isk_pub.hh" +#include "byte_order.h" //Function to verify the ECDSA signature of a PEK -//SHA1 value for integrity checking is not verified since the ECDSA verification could make sure the integrity at the sametime. -sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, uint8_t *result) +//SHA1 value for integrity checking is not verified since the ECDSA verification could make sure the integrity at the same time. +sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, const sgx_ec256_public_t* pek_sk, uint8_t *result) { sgx_status_t status = SGX_SUCCESS; sgx_ecc_state_handle_t handle= 0; @@ -54,10 +58,65 @@ sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, uint8_t *result SWAP_ENDIAN_32B(ec_signature.y); status = sgx_ecdsa_verify(reinterpret_cast(&signed_pek), static_cast(sizeof(signed_pek.n)+sizeof(signed_pek.e)), - const_cast(&g_pek_pub_key_little_endian), + pek_sk, &ec_signature, result, handle); (void)sgx_ecc256_close_context(handle); return status; } + +//Function to verify that ECDSA signature of XEGB is correct +sgx_status_t verify_xegb(const extended_epid_group_blob_t& xegb, uint8_t *result){ + if (lv_htons(xegb.data_length) != EXTENDED_EPID_GROUP_BLOB_DATA_LEN + || xegb.format_id != XEGB_FORMAT_ID){ + return SGX_ERROR_INVALID_PARAMETER; + } + + sgx_status_t status = SGX_SUCCESS; + sgx_ecc_state_handle_t handle= 0; + sgx_ec256_signature_t ec_signature; + status = sgx_ecc256_open_context(&handle); + if(SGX_SUCCESS!=status){ + return status; + } + se_static_assert(sizeof(ec_signature)==sizeof(xegb.signature)); + memcpy(&ec_signature, xegb.signature, sizeof(xegb.signature)); + SWAP_ENDIAN_32B(ec_signature.x); + SWAP_ENDIAN_32B(ec_signature.y); + status = sgx_ecdsa_verify(reinterpret_cast(&xegb), + static_cast(sizeof(xegb)-sizeof(xegb.signature)), + const_cast(&g_sdsk_pub_key_little_endian), + &ec_signature, + result, + handle); + (void)sgx_ecc256_close_context(handle); + if(SGX_SUCCESS!=status){ + return status; + } + return SGX_SUCCESS; +} + +sgx_status_t verify_xegb_with_default(const extended_epid_group_blob_t& xegb, uint8_t *result, extended_epid_group_blob_t& out_xegb) +{ + const uint8_t *pxegb = reinterpret_cast(&xegb); + uint32_t i; + //check whether all bytes of xegb is 0, if so we should use default xegb + for (i = 0; i < sizeof(xegb); i++){ + if (pxegb[i] != 0){ + break; + } + } + if (i == sizeof(xegb)){//using default xegb value if all bytes are 0, for hardcoded xegb, no ecdsa signature is available so that no ecdsa verification requried too. + out_xegb.xeid = 0; + out_xegb.format_id = XEGB_FORMAT_ID; + memcpy(out_xegb.epid_sk, &g_sgx_isk_pubkey, 2*ECDSA_SIGN_SIZE); + memcpy(out_xegb.pek_sk, &g_pek_pub_key_little_endian, 2 * ECDSA_SIGN_SIZE); + memcpy(out_xegb.qsdk_exp, g_qsdk_pub_key_e, sizeof(g_qsdk_pub_key_e)); + memcpy(out_xegb.qsdk_mod, g_qsdk_pub_key_n, PVE_RSA_KEY_BYTES); + *result = SGX_EC_VALID; + return SGX_SUCCESS; + } + memcpy(&out_xegb, &xegb, sizeof(xegb));//use the input xegb if any bytes in it is non-zero + return verify_xegb(out_xegb, result); +} diff --git a/psw/ae/common/proto/messages.proto b/psw/ae/common/proto/messages.proto index 3fdc784019..f16d19775c 100644 --- a/psw/ae/common/proto/messages.proto +++ b/psw/ae/common/proto/messages.proto @@ -59,6 +59,23 @@ message Request{ optional uint32 timeout = 9; } + message GetWhiteListSizeRequest{ + optional uint32 timeout = 9; + } + + message GetWhiteListRequest{ + optional uint32 white_list_size= 1; + optional uint32 timeout = 9; + } + + message SGXGetExtendedEpidGroupIdRequest{ + optional uint32 timeout = 9; + } + + message SGXSwitchExtendedEpidGroupRequest{ + optional uint32 x_group_id = 1; + optional uint32 timeout = 9; + } optional InitQuoteRequest initQuoteReq = 1; optional GetQuoteRequest getQuoteReq = 2; optional GetLaunchTokenRequest getLicTokenReq = 3; @@ -68,6 +85,10 @@ message Request{ optional ExchangeReportRequest exchangeReportReq = 7; optional CloseSessionRequest closeSessionReq = 8; optional GetPsCapRequest getPsCapReq = 9; + optional GetWhiteListSizeRequest getWhiteListSizeReq = 10; + optional GetWhiteListRequest getWhiteListReq = 11; + optional SGXGetExtendedEpidGroupIdRequest sgxGetExtendedEpidGroupIdReq = 12; + optional SGXSwitchExtendedEpidGroupRequest sgxSwitchExtendedEpidGroupReq = 13; } message Response{ @@ -119,6 +140,24 @@ message Response{ required uint32 errorCode = 1 [default = 1]; optional uint64 ps_cap = 2; } + message GetWhiteListSizeResponse{ + required uint32 errorCode = 1 [default = 1]; + optional uint32 white_list_size = 2; + } + + message GetWhiteListResponse{ + required uint32 errorCode = 1 [default = 1]; + optional bytes white_list = 2; + } + + message SGXGetExtendedEpidGroupIdResponse{ + required uint32 errorCode = 1 [default = 1]; + optional uint32 x_group_id = 2; + } + + message SGXSwitchExtendedEpidGroupResponse{ + required uint32 errorCode = 1 [ default = 1]; + } optional InitQuoteResponse initQuoteRes = 1; optional GetQuoteResponse getQuoteRes = 2; optional GetLaunchTokenResponse getLicTokenRes = 3; @@ -128,4 +167,8 @@ message Response{ optional ExchangeReportResponse exchangeReportRes = 7; optional CloseSessionResponse closeSessionRes = 8; optional GetPsCapResponse getPsCapRes = 9; + optional GetWhiteListSizeResponse getWhiteListSizeRes = 10; + optional GetWhiteListResponse getWhiteListRes = 11; + optional SGXGetExtendedEpidGroupIdResponse sgxGetExtendedEpidGroupIdRes = 12; + optional SGXSwitchExtendedEpidGroupResponse sgxSwitchExtendedEpidGroupRes = 13; } diff --git a/psw/ae/common/pve_pub_key.cpp b/psw/ae/common/pve_pub_key.cpp index 19dc02cbfc..273013f24c 100644 --- a/psw/ae/common/pve_pub_key.cpp +++ b/psw/ae/common/pve_pub_key.cpp @@ -54,13 +54,9 @@ IppStatus get_provision_server_rsa_pub_key_in_ipp_format(const signed_pek_t& pek { signed_pek_t little_endian_key; get_provision_server_rsa_key_little_endian_order(pek, little_endian_key); - IppStatus status = create_rsa_pub_key(PVE_RSA_KEY_BYTES, + return create_rsa_pub_key(PVE_RSA_KEY_BYTES, sizeof(little_endian_key.e), reinterpret_cast(little_endian_key.n), reinterpret_cast(&little_endian_key.e), rsa_pub_key); - if(status != ippStsNoErr){ - return status; - } - return ippStsNoErr; } diff --git a/psw/ae/common/src/AEGetWhiteListRequest.cpp b/psw/ae/common/src/AEGetWhiteListRequest.cpp new file mode 100644 index 0000000000..3d28e1d8b6 --- /dev/null +++ b/psw/ae/common/src/AEGetWhiteListRequest.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include +#include + +AEGetWhiteListRequest::AEGetWhiteListRequest() +:mWhiteListSize(0) +{ +} + +AEGetWhiteListRequest::AEGetWhiteListRequest(uint32_t whiteListSize, uint32_t timeout) +:mWhiteListSize(0) + +{ + CopyFields(whiteListSize, timeout); +} + +AEGetWhiteListRequest::AEGetWhiteListRequest(const AEGetWhiteListRequest& other) +:IAERequest(other), mWhiteListSize(0) +{ + CopyFields(other.mWhiteListSize, other.mTimeout); +} + +AEGetWhiteListRequest::~AEGetWhiteListRequest() +{ + ReleaseMemory(); +} + +void AEGetWhiteListRequest::ReleaseMemory() +{ + mWhiteListSize = 0; +} + +void AEGetWhiteListRequest::CopyFields(uint32_t whiteListSize, uint32_t timeout) +{ + mWhiteListSize = whiteListSize; + mTimeout = timeout; +} + +AEMessage* AEGetWhiteListRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AEGetWhiteListRequest::inflateValues(uint32_t whiteListSize, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(whiteListSize, timeout); +} + +bool AEGetWhiteListRequest::operator==(const AEGetWhiteListRequest& other) const +{ + if (this == &other) + return true; + + if (mWhiteListSize != other.mWhiteListSize || + mTimeout != other.mTimeout) + return false; + + return true; +} + +AEGetWhiteListRequest& AEGetWhiteListRequest::operator=(const AEGetWhiteListRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mWhiteListSize, other.mTimeout); + + return *this; +} + +bool AEGetWhiteListRequest::check() +{ + return true; +} + +IAERequest::RequestClass AEGetWhiteListRequest::getRequestClass() +{ + return PLATFORM_CLASS; +} + +IAEResponse* AEGetWhiteListRequest::execute(IAESMLogic* aesmLogic) +{ + uint8_t* white_list = new uint8_t[mWhiteListSize]; + + aesm_error_t result = aesmLogic->getWhiteList(white_list, mWhiteListSize); + + AEGetWhiteListResponse* getWhiteListResponse = new AEGetWhiteListResponse(result, mWhiteListSize, white_list); + delete [] white_list; + return getWhiteListResponse; +} + +void AEGetWhiteListRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitGetWhiteListRequest(*this); +} diff --git a/psw/ae/common/src/AEGetWhiteListResponse.cpp b/psw/ae/common/src/AEGetWhiteListResponse.cpp new file mode 100644 index 0000000000..70ed7e4bf4 --- /dev/null +++ b/psw/ae/common/src/AEGetWhiteListResponse.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +AEGetWhiteListResponse::AEGetWhiteListResponse() +:mWhiteListLength(0), mWhiteList(NULL) +{ +} + +AEGetWhiteListResponse::AEGetWhiteListResponse(int errorCode, uint32_t whiteListLength, const uint8_t* whiteList) +:mWhiteListLength(0), mWhiteList(NULL) +{ + CopyFields(errorCode, whiteListLength, whiteList); +} + +AEGetWhiteListResponse::AEGetWhiteListResponse(const AEGetWhiteListResponse& other) +:mWhiteListLength(0), mWhiteList(NULL) +{ + CopyFields(other.mErrorCode, other.mWhiteListLength, other.mWhiteList); +} + +AEGetWhiteListResponse::~AEGetWhiteListResponse() +{ + ReleaseMemory(); +} + +void AEGetWhiteListResponse::ReleaseMemory() +{ + if (mWhiteList != NULL) + { + if (mWhiteListLength > 0) + memset(mWhiteList, 0, mWhiteListLength); + delete [] mWhiteList; + mWhiteList = NULL; + } + mErrorCode = SGX_ERROR_UNEXPECTED; + mWhiteListLength = 0; +} + +void AEGetWhiteListResponse::CopyFields(int errorCode, uint32_t whiteListLength,const uint8_t* whiteList) +{ + if(whiteListLength <= MAX_MEMORY_ALLOCATION ) + { + mValidSizeCheck = true; + } + else + { + mValidSizeCheck = false; + return; + } + + mErrorCode = errorCode; + mWhiteListLength = whiteListLength; + if (whiteList != NULL && whiteListLength > 0) { + mWhiteList = new uint8_t[whiteListLength]; + memcpy(mWhiteList, whiteList, whiteListLength); + } +} + +AEMessage* AEGetWhiteListResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEGetWhiteListResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEGetWhiteListResponse::inflateValues(int errorCode, uint32_t whiteListLength,const uint8_t* whiteList) +{ + ReleaseMemory(); + + CopyFields(errorCode, whiteListLength, whiteList); +} + +bool AEGetWhiteListResponse::operator==(const AEGetWhiteListResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode || + mWhiteListLength != other.mWhiteListLength) + return false; + + if ((mWhiteList != other.mWhiteList) && + (mWhiteList == NULL || other.mWhiteList == NULL)) + return false; + + if (mWhiteList != NULL && other.mWhiteList != NULL && + memcmp(mWhiteList, other.mWhiteList, other.mWhiteListLength) != 0) + return false; + + return true; +} + +AEGetWhiteListResponse& AEGetWhiteListResponse::operator=(const AEGetWhiteListResponse& other) +{ + if (this == &other) + return * this; + + inflateValues(other.mErrorCode, other.mWhiteListLength, other.mWhiteList); + + return *this; +} + +bool AEGetWhiteListResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + + if (mValidSizeCheck == false) + return false; + + if (mWhiteList == NULL) + return false; + + return true; +} + +void AEGetWhiteListResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitGetWhiteListResponse(*this); +} diff --git a/psw/ae/common/src/AEGetWhiteListSizeRequest.cpp b/psw/ae/common/src/AEGetWhiteListSizeRequest.cpp new file mode 100644 index 0000000000..0be8a5063a --- /dev/null +++ b/psw/ae/common/src/AEGetWhiteListSizeRequest.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include +#include + +AEGetWhiteListSizeRequest::AEGetWhiteListSizeRequest(uint32_t timeout) : IAERequest(timeout) { +} + +AEGetWhiteListSizeRequest::AEGetWhiteListSizeRequest(const AEGetWhiteListSizeRequest& other) +: IAERequest(other) +{ + CopyFields(other.mTimeout); +} + +AEGetWhiteListSizeRequest::~AEGetWhiteListSizeRequest() +{ + ReleaseMemory(); +} + +void AEGetWhiteListSizeRequest::ReleaseMemory() +{ + //empty for now +} + + +void AEGetWhiteListSizeRequest::CopyFields(uint32_t timeout) +{ + mTimeout = timeout; +} + +AEMessage* AEGetWhiteListSizeRequest::serialize(ISerializer* serializer){ + return serializer->serialize(this); +} + +IAERequest::RequestClass AEGetWhiteListSizeRequest::getRequestClass() { + return PLATFORM_CLASS; +} + +void AEGetWhiteListSizeRequest::inflateValues(uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(timeout); +} + +bool AEGetWhiteListSizeRequest::operator==(const AEGetWhiteListSizeRequest& other) const +{ + if (this == &other) + return true; + + if (mTimeout != other.mTimeout) + return false; + + return true; //no members , default to true +} + +AEGetWhiteListSizeRequest& AEGetWhiteListSizeRequest::operator=(const AEGetWhiteListSizeRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mTimeout); + + //do nothing - no members + return *this; +} + +void AEGetWhiteListSizeRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitGetWhiteListSizeRequest(*this); +} + + +IAEResponse* AEGetWhiteListSizeRequest::execute(IAESMLogic* aesmLogic) +{ + uint32_t white_list_size; + + aesm_error_t result = aesmLogic->getWhiteListSize(&white_list_size); + + AEGetWhiteListSizeResponse * response = new AEGetWhiteListSizeResponse((uint32_t)result, white_list_size); + + return response; +} diff --git a/psw/ae/common/src/AEGetWhiteListSizeResponse.cpp b/psw/ae/common/src/AEGetWhiteListSizeResponse.cpp new file mode 100644 index 0000000000..efeec6d84e --- /dev/null +++ b/psw/ae/common/src/AEGetWhiteListSizeResponse.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AEGetWhiteListSizeResponse::AEGetWhiteListSizeResponse() : + mWhiteListSize(-1) +{ +} + +AEGetWhiteListSizeResponse::AEGetWhiteListSizeResponse(int errorCode, uint32_t white_list_size) : + mWhiteListSize(-1) +{ + CopyFields(errorCode, white_list_size); +} + +AEGetWhiteListSizeResponse::AEGetWhiteListSizeResponse(const AEGetWhiteListSizeResponse& other) : + mWhiteListSize(-1) +{ + CopyFields(other.mErrorCode, other.mWhiteListSize); +} + +AEGetWhiteListSizeResponse::~AEGetWhiteListSizeResponse() +{ + ReleaseMemory(); +} + +void AEGetWhiteListSizeResponse::ReleaseMemory() +{ + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AEGetWhiteListSizeResponse::CopyFields(int errorCode, uint32_t white_list_size) +{ + mErrorCode = errorCode; + mWhiteListSize = white_list_size; +} + + +AEMessage* AEGetWhiteListSizeResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AEGetWhiteListSizeResponse::inflateWithMessage(AEMessage* message, ISerializer *serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AEGetWhiteListSizeResponse::inflateValues(int errorCode, uint32_t white_list_size) +{ + ReleaseMemory(); + + CopyFields(errorCode, white_list_size); +} + +bool AEGetWhiteListSizeResponse::operator==(const AEGetWhiteListSizeResponse &other) const +{ + if (this == &other) + return true; + + if (mWhiteListSize!= other.mWhiteListSize) + return false; + return true; +} + +AEGetWhiteListSizeResponse & AEGetWhiteListSizeResponse::operator=(const AEGetWhiteListSizeResponse &other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode, other.mWhiteListSize); + + return *this; +} + +bool AEGetWhiteListSizeResponse::check() +{ + // no MAC to check at this point, but do some generic parameter check + + //impose a limit of 1MB for these messages. If larger then a transmission, or unmarshalling error may have occured + //also a big value here might be an attack + + //first, fail if errorCode is not 0 + if (mErrorCode != SGX_SUCCESS) + return false; + + return true; +} + +void AEGetWhiteListSizeResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitGetWhiteListSizeResponse(*this); +} + diff --git a/psw/ae/common/src/AEReportAttestationRequest.cpp b/psw/ae/common/src/AEReportAttestationRequest.cpp index bc90db810c..e900dbbd71 100644 --- a/psw/ae/common/src/AEReportAttestationRequest.cpp +++ b/psw/ae/common/src/AEReportAttestationRequest.cpp @@ -176,6 +176,7 @@ IAEResponse* AEReportAttestationRequest::execute(IAESMLogic* aesmLogic) { aesm_error_t result; uint8_t* update_info = new uint8_t[mUpdateInfoLength]; + memset(update_info,0, mUpdateInfoLength); result = aesmLogic->reportAttestationStatus(mPlatformInfo, mPlatformInfoLength, mAttestationErrorCode, update_info, mUpdateInfoLength); diff --git a/psw/ae/common/src/AEReportAttestationResponse.cpp b/psw/ae/common/src/AEReportAttestationResponse.cpp index cf95e70d63..2cec9539a1 100644 --- a/psw/ae/common/src/AEReportAttestationResponse.cpp +++ b/psw/ae/common/src/AEReportAttestationResponse.cpp @@ -137,9 +137,6 @@ AEReportAttestationResponse& AEReportAttestationResponse::operator=(const AERepo //checks bool AEReportAttestationResponse::check() { - if (mErrorCode != SGX_SUCCESS) - return false; - if (mValidSizeCheck == false) return false; diff --git a/psw/ae/common/src/AESGXGetExtendedEpidGroupIdRequest.cpp b/psw/ae/common/src/AESGXGetExtendedEpidGroupIdRequest.cpp new file mode 100644 index 0000000000..2133bc305f --- /dev/null +++ b/psw/ae/common/src/AESGXGetExtendedEpidGroupIdRequest.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include +#include + +AESGXGetExtendedEpidGroupIdRequest::AESGXGetExtendedEpidGroupIdRequest(uint32_t timeout) : IAERequest(timeout) { +} + +AESGXGetExtendedEpidGroupIdRequest::AESGXGetExtendedEpidGroupIdRequest(const AESGXGetExtendedEpidGroupIdRequest& other) +: IAERequest(other) +{ + CopyFields(other.mTimeout); +} + +AESGXGetExtendedEpidGroupIdRequest::~AESGXGetExtendedEpidGroupIdRequest() +{ + ReleaseMemory(); +} + +void AESGXGetExtendedEpidGroupIdRequest::ReleaseMemory() +{ + //empty for now +} + + +void AESGXGetExtendedEpidGroupIdRequest::CopyFields(uint32_t timeout) +{ + mTimeout = timeout; +} + +AEMessage* AESGXGetExtendedEpidGroupIdRequest::serialize(ISerializer* serializer){ + return serializer->serialize(this); +} + +IAERequest::RequestClass AESGXGetExtendedEpidGroupIdRequest::getRequestClass() { + return PLATFORM_CLASS; +} + +void AESGXGetExtendedEpidGroupIdRequest::inflateValues(uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(timeout); +} + +bool AESGXGetExtendedEpidGroupIdRequest::operator==(const AESGXGetExtendedEpidGroupIdRequest& other) const +{ + if (this == &other) + return true; + + if (mTimeout != other.mTimeout) + return false; + + return true; //no members , default to true +} + +AESGXGetExtendedEpidGroupIdRequest& AESGXGetExtendedEpidGroupIdRequest::operator=(const AESGXGetExtendedEpidGroupIdRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mTimeout); + + //do nothing - no members + return *this; +} + +void AESGXGetExtendedEpidGroupIdRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitSGXGetExtendedEpidGroupIdRequest(*this); +} + + +IAEResponse* AESGXGetExtendedEpidGroupIdRequest::execute(IAESMLogic* aesmLogic) +{ + uint32_t extended_group_id; + + aesm_error_t result = aesmLogic->sgxGetExtendedEpidGroupId(&extended_group_id); + + AESGXGetExtendedEpidGroupIdResponse * response = new AESGXGetExtendedEpidGroupIdResponse((uint32_t)result, extended_group_id); + + return response; +} diff --git a/psw/ae/common/src/AESGXGetExtendedEpidGroupIdResponse.cpp b/psw/ae/common/src/AESGXGetExtendedEpidGroupIdResponse.cpp new file mode 100644 index 0000000000..86daf53b36 --- /dev/null +++ b/psw/ae/common/src/AESGXGetExtendedEpidGroupIdResponse.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AESGXGetExtendedEpidGroupIdResponse::AESGXGetExtendedEpidGroupIdResponse() : + mExtendedEpidGroupId(-1) +{ +} + +AESGXGetExtendedEpidGroupIdResponse::AESGXGetExtendedEpidGroupIdResponse(int errorCode, uint32_t extendedGroupId) : + mExtendedEpidGroupId(-1) +{ + CopyFields(errorCode, extendedGroupId); +} + +AESGXGetExtendedEpidGroupIdResponse::AESGXGetExtendedEpidGroupIdResponse(const AESGXGetExtendedEpidGroupIdResponse& other) : + mExtendedEpidGroupId(-1) +{ + CopyFields(other.mErrorCode, other.mExtendedEpidGroupId); +} + +AESGXGetExtendedEpidGroupIdResponse::~AESGXGetExtendedEpidGroupIdResponse() +{ + ReleaseMemory(); +} + +void AESGXGetExtendedEpidGroupIdResponse::ReleaseMemory() +{ + mErrorCode = SGX_ERROR_UNEXPECTED; +} + +void AESGXGetExtendedEpidGroupIdResponse::CopyFields(int errorCode, uint32_t extendedGroupId) +{ + mErrorCode = errorCode; + mExtendedEpidGroupId = extendedGroupId; +} + + +AEMessage* AESGXGetExtendedEpidGroupIdResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AESGXGetExtendedEpidGroupIdResponse::inflateWithMessage(AEMessage* message, ISerializer *serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AESGXGetExtendedEpidGroupIdResponse::inflateValues(int errorCode, uint32_t extendedGroupId) +{ + ReleaseMemory(); + + CopyFields(errorCode, extendedGroupId); +} + +bool AESGXGetExtendedEpidGroupIdResponse::operator==(const AESGXGetExtendedEpidGroupIdResponse &other) const +{ + if (this == &other) + return true; + + if (mExtendedEpidGroupId!= other.mExtendedEpidGroupId) + return false; + return true; +} + +AESGXGetExtendedEpidGroupIdResponse & AESGXGetExtendedEpidGroupIdResponse::operator=(const AESGXGetExtendedEpidGroupIdResponse &other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode, other.mExtendedEpidGroupId); + + return *this; +} + +bool AESGXGetExtendedEpidGroupIdResponse::check() +{ + // no MAC to check at this point, but do some generic parameter check + + //impose a limit of 1MB for these messages. If larger then a transmission, or unmarshalling error may have occured + //also a big value here might be an attack + + //first, fail if errorCode is not 0 + if (mErrorCode != SGX_SUCCESS) + return false; + + return true; +} + +void AESGXGetExtendedEpidGroupIdResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitSGXGetExtendedEpidGroupIdResponse(*this); +} + diff --git a/psw/ae/common/src/AESGXSwitchExtendedEpidGroupRequest.cpp b/psw/ae/common/src/AESGXSwitchExtendedEpidGroupRequest.cpp new file mode 100644 index 0000000000..5728205435 --- /dev/null +++ b/psw/ae/common/src/AESGXSwitchExtendedEpidGroupRequest.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include + +#include +#include + +AESGXSwitchExtendedEpidGroupRequest::AESGXSwitchExtendedEpidGroupRequest() +:mExtendedEpidGroupId(0) +{ +} + +AESGXSwitchExtendedEpidGroupRequest::AESGXSwitchExtendedEpidGroupRequest(uint32_t extendedGroupId, uint32_t timeout) +:mExtendedEpidGroupId(0) + +{ + CopyFields(extendedGroupId, timeout); +} + +AESGXSwitchExtendedEpidGroupRequest::AESGXSwitchExtendedEpidGroupRequest(const AESGXSwitchExtendedEpidGroupRequest& other) +:IAERequest(other), mExtendedEpidGroupId(0) +{ + CopyFields(other.mExtendedEpidGroupId, other.mTimeout); +} + +AESGXSwitchExtendedEpidGroupRequest::~AESGXSwitchExtendedEpidGroupRequest() +{ + ReleaseMemory(); +} + +void AESGXSwitchExtendedEpidGroupRequest::ReleaseMemory() +{ + mExtendedEpidGroupId = 0; +} + +void AESGXSwitchExtendedEpidGroupRequest::CopyFields(uint32_t extendedGroupId, uint32_t timeout) +{ + mExtendedEpidGroupId = extendedGroupId; + mTimeout = timeout; +} + +AEMessage* AESGXSwitchExtendedEpidGroupRequest::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +void AESGXSwitchExtendedEpidGroupRequest::inflateValues(uint32_t extendedGroupId, uint32_t timeout) +{ + ReleaseMemory(); + + CopyFields(extendedGroupId, timeout); +} + +bool AESGXSwitchExtendedEpidGroupRequest::operator==(const AESGXSwitchExtendedEpidGroupRequest& other) const +{ + if (this == &other) + return true; + + if (mExtendedEpidGroupId != other.mExtendedEpidGroupId || + mTimeout != other.mTimeout) + return false; + + return true; +} + +AESGXSwitchExtendedEpidGroupRequest& AESGXSwitchExtendedEpidGroupRequest::operator=(const AESGXSwitchExtendedEpidGroupRequest& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mExtendedEpidGroupId, other.mTimeout); + + return *this; +} + +bool AESGXSwitchExtendedEpidGroupRequest::check() +{ + return true; +} + +IAERequest::RequestClass AESGXSwitchExtendedEpidGroupRequest::getRequestClass() +{ + return PLATFORM_CLASS; +} + +IAEResponse* AESGXSwitchExtendedEpidGroupRequest::execute(IAESMLogic* aesmLogic) +{ + aesm_error_t result; + result = aesmLogic->sgxSwitchExtendedEpidGroup(mExtendedEpidGroupId); + + return new AESGXSwitchExtendedEpidGroupResponse(result); +} + +void AESGXSwitchExtendedEpidGroupRequest::visit(IAERequestVisitor& visitor) +{ + visitor.visitSGXSwitchExtendedEpidGroupRequest(*this); +} diff --git a/psw/ae/common/src/AESGXSwitchExtendedEpidGroupResponse.cpp b/psw/ae/common/src/AESGXSwitchExtendedEpidGroupResponse.cpp new file mode 100644 index 0000000000..55ba1692d2 --- /dev/null +++ b/psw/ae/common/src/AESGXSwitchExtendedEpidGroupResponse.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include + +#include +#include + +AESGXSwitchExtendedEpidGroupResponse::AESGXSwitchExtendedEpidGroupResponse() +{ +} + +AESGXSwitchExtendedEpidGroupResponse::AESGXSwitchExtendedEpidGroupResponse(int errorCode) +{ + CopyFields(errorCode); +} + +AESGXSwitchExtendedEpidGroupResponse::AESGXSwitchExtendedEpidGroupResponse(const AESGXSwitchExtendedEpidGroupResponse& other) +{ + CopyFields(other.mErrorCode); +} + +AESGXSwitchExtendedEpidGroupResponse::~AESGXSwitchExtendedEpidGroupResponse() +{ + ReleaseMemory(); +} + +void AESGXSwitchExtendedEpidGroupResponse::ReleaseMemory() +{ +} + +void AESGXSwitchExtendedEpidGroupResponse::CopyFields(int errorCode) +{ + mErrorCode = errorCode; +} + +AEMessage* AESGXSwitchExtendedEpidGroupResponse::serialize(ISerializer* serializer) +{ + return serializer->serialize(this); +} + +bool AESGXSwitchExtendedEpidGroupResponse::inflateWithMessage(AEMessage* message, ISerializer* serializer) +{ + return serializer->inflateResponse(message, this); +} + +void AESGXSwitchExtendedEpidGroupResponse::inflateValues(int errorCode) +{ + ReleaseMemory(); + + CopyFields(errorCode); +} + +bool AESGXSwitchExtendedEpidGroupResponse::operator==(const AESGXSwitchExtendedEpidGroupResponse& other) const +{ + if (this == &other) + return true; + + if (mErrorCode != other.mErrorCode) + return false; + + return true; +} + +AESGXSwitchExtendedEpidGroupResponse& AESGXSwitchExtendedEpidGroupResponse::operator=(const AESGXSwitchExtendedEpidGroupResponse& other) +{ + if (this == &other) + return *this; + + inflateValues(other.mErrorCode); + + return *this; +} + +bool AESGXSwitchExtendedEpidGroupResponse::check() +{ + if (mErrorCode != SGX_SUCCESS) + return false; + return true; +} + +void AESGXSwitchExtendedEpidGroupResponse::visit(IAEResponseVisitor& visitor) +{ + visitor.visitSGXSwitchExtendedEpidGroupResponse(*this); +} diff --git a/psw/ae/common/src/ProtobufSerializer.cpp b/psw/ae/common/src/ProtobufSerializer.cpp index aec29bc3b8..97a95fa10a 100644 --- a/psw/ae/common/src/ProtobufSerializer.cpp +++ b/psw/ae/common/src/ProtobufSerializer.cpp @@ -66,6 +66,18 @@ #include #include +#include +#include + +#include +#include + +#include +#include + +#include +#include + #include #include #include @@ -397,6 +409,14 @@ IAERequest* ProtobufSerializer::inflateRequest(AEMessage* message) { request = inflateGetPsCapRequest(reqMsg); if (reqMsg->has_reporterrreq() == true) request = inflateReportAttestationErrorRequest(reqMsg); + if(reqMsg->has_getwhitelistsizereq() == true) + request = inflateGetWhiteListSizeRequest(reqMsg); + if(reqMsg->has_getwhitelistreq() == true) + request = inflateGetWhiteListRequest(reqMsg); + if(reqMsg->has_sgxgetextendedepidgroupidreq() == true) + request = inflateSGXGetExtendedEpidGroupIdRequest(reqMsg); + if(reqMsg->has_sgxswitchextendedepidgroupreq() == true) + request = inflateSGXSwitchExtendedEpidGroupRequest(reqMsg); delete reqMsg; return request; } @@ -1287,3 +1307,379 @@ bool ProtobufSerializer::inflateResponse(AEMessage* message, AEReportAttestation return true; } + +/* + Get white list size +*/ +IAERequest* ProtobufSerializer::inflateGetWhiteListSizeRequest(aesm::message::Request* reqMsg) +{ + AEGetWhiteListSizeRequest* request = new AEGetWhiteListSizeRequest(); + aesm::message::Request::GetWhiteListSizeRequest proto_req = reqMsg->getwhitelistsizereq(); + + request->inflateValues(proto_req.timeout()); + return request; +} + +AEMessage* ProtobufSerializer::serialize(AEGetWhiteListSizeRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::GetWhiteListSizeRequest proto_req; + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::GetWhiteListSizeRequest* mutableReq = msg.mutable_getwhitelistsizereq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_getwhitelistsizereq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEGetWhiteListSizeResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::GetWhiteListSizeResponse proto_res; + + proto_res.set_errorcode(response->GetErrorCode()); + proto_res.set_white_list_size(response->GetWhiteListSize()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::GetWhiteListSizeResponse* mutableRes = msg.mutable_getwhitelistsizeres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_getwhitelistsizeres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), data.size()); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEGetWhiteListSizeResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_getwhitelistsizeres() == false) + return false; + + aesm::message::Response::GetWhiteListSizeResponse proto_res = msg.getwhitelistsizeres(); + uint32_t errorCode = proto_res.errorcode(); + uint32_t white_list_size = -1; + if (proto_res.has_white_list_size()) + { + white_list_size = proto_res.white_list_size(); + } + response->inflateValues(errorCode, white_list_size); + + return true; +} + +/* + Get white list +*/ +IAERequest* ProtobufSerializer::inflateGetWhiteListRequest(aesm::message::Request* reqMsg) +{ + AEGetWhiteListRequest* request = new AEGetWhiteListRequest(); + aesm::message::Request::GetWhiteListRequest proto_req = reqMsg->getwhitelistreq(); + + request->inflateValues(proto_req.white_list_size(),proto_req.timeout()); + return request; +} + +AEMessage* ProtobufSerializer::serialize(AEGetWhiteListRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::GetWhiteListRequest proto_req; + proto_req.set_white_list_size(request->GetWhiteListSize()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::GetWhiteListRequest* mutableReq = msg.mutable_getwhitelistreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_getwhitelistreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AEGetWhiteListResponse* response) +{ + std::string data; + AEMessage* ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::GetWhiteListResponse proto_res; + + if (response->GetWhiteList() != NULL) + { + std::string se_white_list((const char*)response->GetWhiteList(), response->GetWhiteListLength()); + proto_res.set_white_list(se_white_list); + } + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::GetWhiteListResponse* mutableRes = msg.mutable_getwhitelistres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_getwhitelistres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), ae_msg->size); + } + delete mutableRes; + } + + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AEGetWhiteListResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_getwhitelistres() == false) + return false; + + aesm::message::Response::GetWhiteListResponse proto_res = msg.getwhitelistres(); + uint32_t errorCode = proto_res.errorcode(); + uint32_t white_list_length = 0; + uint8_t * white_list = NULL; + + if (proto_res.has_white_list()) + { + if(proto_res.white_list().size() > UINT_MAX) { + return false; + } + white_list_length = (unsigned int)proto_res.white_list().size(); + white_list = (uint8_t*)const_cast(proto_res.white_list().data()); + } + response->inflateValues(errorCode, white_list_length, white_list); + + return true; +} + +/* + SGX Get extended epid group id +*/ +IAERequest* ProtobufSerializer::inflateSGXGetExtendedEpidGroupIdRequest(aesm::message::Request* reqMsg) +{ + AESGXGetExtendedEpidGroupIdRequest* request = new AESGXGetExtendedEpidGroupIdRequest(); + aesm::message::Request::SGXGetExtendedEpidGroupIdRequest proto_req = reqMsg->sgxgetextendedepidgroupidreq(); + + request->inflateValues(proto_req.timeout()); + return request; +} + +AEMessage* ProtobufSerializer::serialize(AESGXGetExtendedEpidGroupIdRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::SGXGetExtendedEpidGroupIdRequest proto_req; + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::SGXGetExtendedEpidGroupIdRequest* mutableReq = msg.mutable_sgxgetextendedepidgroupidreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_sgxgetextendedepidgroupidreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AESGXGetExtendedEpidGroupIdResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::SGXGetExtendedEpidGroupIdResponse proto_res; + + proto_res.set_errorcode(response->GetErrorCode()); + proto_res.set_x_group_id(response->GetExtendedEpidGroupId()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::SGXGetExtendedEpidGroupIdResponse* mutableRes = msg.mutable_sgxgetextendedepidgroupidres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_sgxgetextendedepidgroupidres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), data.size()); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AESGXGetExtendedEpidGroupIdResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_sgxgetextendedepidgroupidres() == false) + return false; + + aesm::message::Response::SGXGetExtendedEpidGroupIdResponse proto_res = msg.sgxgetextendedepidgroupidres(); + uint32_t errorCode = proto_res.errorcode(); + uint32_t x_group_id = -1; + if (proto_res.has_x_group_id()) + { + x_group_id = proto_res.x_group_id(); + } + response->inflateValues(errorCode, x_group_id); + + return true; +} + +/* + SGX Switch extended epid group +*/ +IAERequest* ProtobufSerializer::inflateSGXSwitchExtendedEpidGroupRequest(aesm::message::Request* reqMsg) +{ + AESGXSwitchExtendedEpidGroupRequest* request = new AESGXSwitchExtendedEpidGroupRequest(); + aesm::message::Request::SGXSwitchExtendedEpidGroupRequest proto_req = reqMsg->sgxswitchextendedepidgroupreq(); + + request->inflateValues(proto_req.x_group_id(), proto_req.timeout()); + return request; +} + +AEMessage* ProtobufSerializer::serialize(AESGXSwitchExtendedEpidGroupRequest* request) +{ + //kill the warning + UNUSED(request); + + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Request msg; + aesm::message::Request::SGXSwitchExtendedEpidGroupRequest proto_req; + proto_req.set_x_group_id(request->GetExtendedEpidGroupId()); + proto_req.set_timeout(request->GetTimeout()); + + if (proto_req.IsInitialized()) + { + aesm::message::Request::SGXSwitchExtendedEpidGroupRequest* mutableReq = msg.mutable_sgxswitchextendedepidgroupreq(); + mutableReq->CopyFrom(proto_req); + msg.SerializeToString(&data); + msg.release_sgxswitchextendedepidgroupreq(); //free the internal object + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.c_str(), ae_msg->size); + } + delete mutableReq; + } + return ae_msg; +} + +AEMessage* ProtobufSerializer::serialize(AESGXSwitchExtendedEpidGroupResponse* response) +{ + std::string data; + AEMessage *ae_msg = NULL; + + aesm::message::Response msg; + aesm::message::Response::SGXSwitchExtendedEpidGroupResponse proto_res; + + proto_res.set_errorcode(response->GetErrorCode()); + + if (proto_res.IsInitialized()) + { + aesm::message::Response::SGXSwitchExtendedEpidGroupResponse* mutableRes = msg.mutable_sgxswitchextendedepidgroupres(); + mutableRes->CopyFrom(proto_res); + msg.SerializeToString(&data); + msg.release_sgxswitchextendedepidgroupres(); + + if (data.size() <= UINT_MAX) { + ae_msg = new AEMessage; + ae_msg->size = (unsigned int) data.size(); + ae_msg->data = new char[ae_msg->size]; + memcpy(ae_msg->data, data.data(), data.size()); + } + delete mutableRes; + } + return ae_msg; +} + +bool ProtobufSerializer::inflateResponse(AEMessage* message, AESGXSwitchExtendedEpidGroupResponse* response) +{ + std::string data((char*)message->data, message->size); + aesm::message::Response msg; + + msg.ParseFromString(data); + if (msg.has_sgxswitchextendedepidgroupres() == false) + return false; + + aesm::message::Response::SGXSwitchExtendedEpidGroupResponse proto_res = msg.sgxswitchextendedepidgroupres(); + uint32_t errorCode = proto_res.errorcode(); + response->inflateValues(errorCode); + + return true; +} diff --git a/psw/ae/data/constants/linux/default_url_info.hh b/psw/ae/data/constants/linux/default_url_info.hh index 08f6743370..1c11ac94f6 100644 --- a/psw/ae/data/constants/linux/default_url_info.hh +++ b/psw/ae/data/constants/linux/default_url_info.hh @@ -33,5 +33,6 @@ #define DEFAULT_URL "http://ps.sgx.trustedservices.intel.com:8080/" /*production backend server*/ #define DEFAULT_PSE_RL_URL "https://trustedservices.intel.com/content/CRL/" #define DEFAULT_PSE_OCSP_URL "http://trustedservices.intel.com/ocsp" +#define DEFAULT_WHITE_LIST_URL "http://trustedservices.intel.com/LCWL/Linux/white_list_to_be_verify.bin" #endif diff --git a/psw/ae/data/constants/linux/isk_pub.hh b/psw/ae/data/constants/linux/isk_pub.hh index db45bcedea..ff0c248a0b 100644 --- a/psw/ae/data/constants/linux/isk_pub.hh +++ b/psw/ae/data/constants/linux/isk_pub.hh @@ -32,15 +32,11 @@ #ifndef _ISK_PUB_HH_ #define _ISK_PUB_HH_ /* This is the x component of production public key used for EC-DSA verify for EPID Signing key. */ -const uint8_t g_sgx_isk_pubkey_x[] = { +const uint8_t g_sgx_isk_pubkey[] = { 0x26, 0x9c, 0x10, 0x82, 0xe3, 0x5a, 0x78, 0x26, 0xee, 0x2e, 0xcc, 0x0d, 0x29, 0x50, 0xc9, 0xa4, 0x7a, 0x21, 0xdb, 0xcf, 0xa7, 0x6a, 0x95, 0x92, - 0xeb, 0x2f, 0xb9, 0x24, 0x89, 0x88, 0xbd, 0xce -}; - -/* This is the y component of production public key used for EC-DSA verify. Same as upper. */ -const uint8_t g_sgx_isk_pubkey_y[] = { + 0xeb, 0x2f, 0xb9, 0x24, 0x89, 0x88, 0xbd, 0xce, 0xb8, 0xe0, 0xf2, 0x41, 0xc3, 0xe5, 0x35, 0x52, 0xbc, 0xef, 0x9c, 0x04, 0x02, 0x06, 0x48, 0xa5, 0x76, 0x10, 0x1b, 0xa4, 0x28, 0xe4, 0x8e, 0xa9, diff --git a/psw/ae/data/constants/linux/service_enclave_mrsigner.hh b/psw/ae/data/constants/linux/service_enclave_mrsigner.hh index 594b1ada25..00d09294a3 100644 --- a/psw/ae/data/constants/linux/service_enclave_mrsigner.hh +++ b/psw/ae/data/constants/linux/service_enclave_mrsigner.hh @@ -35,13 +35,23 @@ const sgx_measurement_t G_SERVICE_ENCLAVE_MRSIGNER[] = { { - { + {//MR_SIGNER of PvE provided 0xec, 0x15, 0xb1, 0x07, 0x87, 0xd2, 0xf8, 0x46, 0x67, 0xce, 0xb0, 0xb5, 0x98, 0xff, 0xc4, 0x4a, 0x1f, 0x1c, 0xb8, 0x0f, 0x67, 0x0a, 0xae, 0x5d, 0xf9, 0xe8, 0xfa, 0x9f, 0x63, 0x76, 0xe1, 0xf8 } + }, + { + {//MR_SIGNER of PCE provided + 0xC5, 0x4A, 0x62, 0xF2, 0xBE, 0x9E, 0xF7, 0x6E, + 0xFB, 0x1F, 0x39, 0x30, 0xAD, 0x81, 0xEA, 0x7F, + 0x60, 0xDE, 0xFC, 0x1F, 0x5F, 0x25, 0xE0, 0x9B, + 0x7C, 0x06, 0x7A, 0x81, 0x5A, 0xE0, 0xC6, 0xCB + } } }; -#endif +#define AE_MR_SIGNER 0 +#define PCE_MR_SIGNER 1 +#endif diff --git a/sdk/tlibc/math/w_pow10f.c b/psw/ae/data/constants/linux/xegdsk_pub.hh similarity index 72% rename from sdk/tlibc/math/w_pow10f.c rename to psw/ae/data/constants/linux/xegdsk_pub.hh index eb335fefdd..5e7afdaf0e 100644 --- a/sdk/tlibc/math/w_pow10f.c +++ b/psw/ae/data/constants/linux/xegdsk_pub.hh @@ -29,11 +29,18 @@ * */ -#include - -float -pow10f(float x) -{ - return powf(10, x); -} - +/*ECDSA key for Extended EPID Blob signing key in little endian format*/ +const sgx_ec256_public_t g_sdsk_pub_key_little_endian={ + { + 0X21, 0X6D, 0X79, 0X72, 0X46, 0X45, 0XF9, 0X3A, + 0XE3, 0X74, 0XD9, 0X39, 0X6D, 0XDA, 0XFB, 0X61, + 0XDD, 0X87, 0X57, 0X72, 0X55, 0X2C, 0XCF, 0XBF, + 0X58, 0X0D, 0X51, 0X36, 0XC4, 0X27, 0XF0, 0X63 + }, + { + 0X18, 0X68, 0X1C, 0X77, 0X27, 0X2E, 0X9B, 0XE6, + 0X25, 0X7B, 0XAC, 0XA1, 0XB9, 0X2C, 0XBF, 0X2C, + 0X84, 0X95, 0X16, 0XD6, 0XDD, 0X7F, 0XA1, 0X61, + 0XC5, 0X33, 0XBE, 0X9B, 0XFF, 0XED, 0X06, 0XAC + } +}; diff --git a/psw/ae/data/prebuilt/aesm_server_url.blob.00000000 b/psw/ae/data/prebuilt/aesm_server_url.blob.00000000 new file mode 100644 index 0000000000000000000000000000000000000000..2380e21c7e59be57c77c5366dec011582d73add3 GIT binary patch literal 782 zcmZ={$|xx*u+rBrDAp@Zuh1(gDlINaO({+-D$7hxE!NA-D@o1KOU}==vM{hP&}SH) q02Btrz(Bz1d;R2mU_j)R=sO4b4AVe>rUTqTke^&!Fg&9l?kfO#jW9?6 literal 0 HcmV?d00001 diff --git a/psw/ae/data/prebuilt/le_prod_css.bin b/psw/ae/data/prebuilt/le_prod_css.bin index 76e8543ec69e8991a7a3df4059c0bde392686bb4..6576f23ac0ae143f2a513abf7546d60925f33af3 100644 GIT binary patch delta 1239 zcmV;|1StEE4v-Fz6ay#+7O@xY0e^C0P`Kc%;i`JI_ZNIvOeJwD{L@l#`ZkUM5c}w~Gf0U+z>%GkO5>WGPmB zx~s@+U@}2mH#cM-1)~zzUbiH>4g|KF?_Oh>>oJP!pqHZRwhPQR1~M>vr#{hz?^5{r95R58WIprkg@8~d-8ic=KpRGfk9USTMK0J9RL6T0RR90 z|B*2ilb{0_DEt5a|NsC0{~j`U+i)42dpdvBuOWg@u3V-weJ5QHx5QWvqS{Y21CcQx zk^~Tccw40qmA*QnEmEClgl_jJd~&v;&HST82oTXQyLs!JNxZ+S)MdqyIw$(XkdM7w zKrE8=1KHwJQBQnx-5|ef6=I?GcYN8Q$mtgs11ZY+xAve9{2uXTTZ(027tcl|CLIh=0P<}WeR95eN+cBpf&J%m1fnE6<@9^A@? zY>9stz{I&f%XdV2ZwvBW?rJVLS{vqn+2RB)n6gv6bzlil0u1S7^jZ`}pg! z3lVamoNMWa0k-74?rcVC(#k^-E2379x06`5?>OaoFrGF6n+u?A3WL;fK7hcJp2>S5)AZOLtT+ha#0*b-^g*~-0=S;ihvj~m- z#37~+$)(H*-i(4}*-4mF5O1h|xFXv>*2|RCr~&6u#wCj&-jtU(+h_qBs4B|~rrb%# z>PAK+xetgS65<{E`Kaje+c@)#;@qOp@UL3u&Fhl130rv#BJZypSN zmPsoV&epkHGdTH=neHaL3)u;NxrwkA0yo##Me8F%TP6&#Ay0MKh1T$R?rMW@3Lh*> zvME>uc*IM9imqRFj;Gr9|Am(*S1sGe#5Ae`bc<;kDf_JF*1yu^@bGl}qqCAcbQgfYWc4%EE60EL-NYcOCa+q5Da|} z2Bs~cC%e||Iv;iOF-CW;Y%3PQb?L)+P9x;ZSZ|Z!8>yDpZ|Ko~6APfEO@DF(z$OAElQF8Sh;K;LfSLUnK^FSN`}QkByqwl00XRPS z=AR8P^wD#0zl=xwPR*cp4&Bb#)!Tz$LX?DI-2Wfd1Md|0eYUnKAUN|Db?N4D9))jU z!e_=B9HnSjw&%@(VwiS;slRjlFG%gP1kX>;q-i`2JJlpKG*t5;vkTc9RsaA10RR90 z|B*2ilb{0_C>#I(|NsC0|39`Pf(EgijyojY*vibE*+PSIiHrsj?)k=q1I_M>$P+J>+^2ZX(?)Ps5q-NQWQMN@h$dU#@wkK4K zG;Q@ZKcfIkweq zx;SoLmJ9zS2K$RGXX{NPv!1cb z&)m$$LsPn+jJv?*won0u#vT_!=s+R>)YsX#g0;4SBEY28#V9qB0{+uP^V9TyF&&CE zj*qWhECdG!CB;%)k%~XDo_K$@uYo1RCV|$?JLSVRNg>^lcXz4-q7)e5>XS0_{Pokf z*C0bUeN56*={~^~BJNLf+`s1LCDkT2xz1O5a=_A7TyU}z(h^#!k$G7!o_XYsX4LmF z|3-64)I5UKd3{^CFVW$R;i0vE{Z@dqZ{#yq5x{GRqD0F*!TUgHas-DM;^LWyX47cC z3R|SH`qfhq`qp`g`$Mf(fbMHP!>ga4HqP~Ea{otAl}$Ppjm15N4EW(NDtqj>ER^h8 zfTuhsn4%ct2r53MO<41RMN??m+k-_Q0>iM(Eki`qP*3$^sWPk_RMcn¥mFNJ`~M BWuX87 diff --git a/psw/ae/data/prebuilt/white_list_cert_to_be_verify.bin b/psw/ae/data/prebuilt/white_list_cert_to_be_verify.bin index d573b1f47f37bab8aa5f091552117006a855144d..b016c56b53d8c7498bcef0108ecd2459570129c0 100644 GIT binary patch delta 241 zcmV+Hcb4{+X>NJ+1X`=T4Q4hs14U4nizD~| diff --git a/psw/ae/inc/aeerror.h b/psw/ae/inc/aeerror.h index 929dcfddd5..b67a96a980 100644 --- a/psw/ae/inc/aeerror.h +++ b/psw/ae/inc/aeerror.h @@ -29,7 +29,6 @@ * */ - #ifndef _AE_ERROR_H_ #define _AE_ERROR_H_ @@ -86,33 +85,49 @@ typedef enum _ae_error_t{ LE_INVALID_PRIVILEGE_ERROR = 41, LE_WHITELIST_UNINITIALIZED_ERROR = 42, LE_CALC_LIC_TOKEN_ERROR = 43, + AESM_NLTP_NO_LTP_BLOB =179, + AESM_NLTP_DONT_NEED_UPDATE_PAIR_LTP =180, + AESM_NLTP_MAY_NEED_UPDATE_LTP =181, + AESM_NLTP_OLD_EPID11_RLS =182, + AESM_PCP_NEED_PSE_UPDATE =183, + AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_NEED_EPID_UPDATE =184, + AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_MIGHT_NEED_EPID_UPDATE =185, + AESM_PCP_SIMPLE_PSE_CERT_PROVISIONING_ERROR =186, + AESM_PCP_SIMPLE_EPID_PROVISION_ERROR =187, + AESM_NPC_DONT_NEED_PSEP =188, + AESM_NPC_NO_PSE_CERT =189, + AESM_NPC_DONT_NEED_UPDATE_PSEP =190, + AESM_NPC_MAY_NEED_UPDATE_PSEP =191, + AESM_NEP_DONT_NEED_EPID_PROVISIONING =192, + AESM_NEP_DONT_NEED_UPDATE_PVEQE =193, + AESM_NEP_PERFORMANCE_REKEY =194, + AESM_NEP_MAY_NEED_UPDATE =195, + AESM_CP_ATTESTATION_FAILURE =196, + AESM_LTP_PSE_CERT_REVOKED =197, + AESM_LTP_SIMPLE_LTP_ERROR =198, + AESM_PSE_PR_GET_PRIVRL_ERROR =199, + AESM_NETWORK_TIMEOUT =200, - AESM_NLTP_NO_LTP_BLOB =178, - AESM_NLTP_DONT_NEED_UPDATE_PAIR_LTP =179, - AESM_NLTP_MAY_NEED_UPDATE_LTP =180, - AESM_NLTP_OLD_EPID11_RLS =181, - AESM_PCP_NEED_PSE_UPDATE =182, - AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_NEED_EPID_UPDATE =183, - AESM_PCP_PSE_CERT_PROVISIONING_ATTESTATION_FAILURE_MIGHT_NEED_EPID_UPDATE =184, - AESM_PCP_SIMPLE_PSE_CERT_PROVISIONING_ERROR =185, - AESM_PCP_SIMPLE_EPID_PROVISION_ERROR =186, - AESM_NPC_DONT_NEED_PSEP =187, - AESM_NPC_NO_PSE_CERT =188, - AESM_NPC_DONT_NEED_UPDATE_PSEP =189, - AESM_NPC_MAY_NEED_UPDATE_PSEP =190, - AESM_NEP_DONT_NEED_EPID_PROVISIONING =191, - AESM_NEP_DONT_NEED_UPDATE_PVEQE =192, - AESM_NEP_PERFORMANCE_REKEY =193, - AESM_NEP_MAY_NEED_UPDATE =194, - AESM_CP_ATTESTATION_FAILURE =195, - AESM_LTP_PSE_CERT_REVOKED =196, - AESM_LTP_SIMPLE_LTP_ERROR =197, - AESM_PSE_PR_GET_PRIVRL_ERROR =198, - AESM_NETWORK_TIMEOUT =199, + PSW_UPDATE_REQUIRED =201, + AESM_AE_OUT_OF_EPC =202, - AE_SERVICE_NOT_AVAILABLE =200, + PVE_PROV_ATTEST_KEY_NOT_FOUND =203, + PVE_INVALID_REPORT =204, + PVE_XEGDSK_SIGN_ERROR =205, - PSW_UPDATED_REQUIRED =201 + // PCE ERROR CODES + PCE_UNEXPECTED_ERROR =206, + PCE_INVALID_PRIVILEGE =207, + PCE_INVALID_REPORT =208, + + LE_WHITE_LIST_QUERY_BUSY =209, + AESM_AE_NO_DEVICE =210, + EXTENDED_GROUP_NOT_AVAILABLE =211, + + // MORE PSE_OP ERROR CASES + PSE_OP_ERROR_KDF_MISMATCH =212, + + LE_WHITE_LIST_HAS_BEEN_UPDATED =213, } ae_error_t; #define AE_FAILED(x) (AE_SUCCESS != (x)) diff --git a/psw/ae/inc/internal/aesm_error.h b/psw/ae/inc/internal/aesm_error.h index 02b87fe485..1b8cedccd7 100644 --- a/psw/ae/inc/internal/aesm_error.h +++ b/psw/ae/inc/internal/aesm_error.h @@ -65,6 +65,8 @@ typedef enum _aesm_error_t AESM_PLATFORM_INFO_BLOB_INVALID_SIG = 26, AESM_SERVICE_NOT_AVAILABLE = 27, AESM_KDF_MISMATCH = 28, + AESM_OUT_OF_EPC = 29, + AESM_SERVICE_UNAVAILABLE = 30 } aesm_error_t; #endif diff --git a/psw/ae/inc/internal/epid_pve_type.h b/psw/ae/inc/internal/epid_pve_type.h index 2d2a4fbeab..136cda0c3b 100644 --- a/psw/ae/inc/internal/epid_pve_type.h +++ b/psw/ae/inc/internal/epid_pve_type.h @@ -51,6 +51,7 @@ #define SK_CMAC_KEY_LEN IppsRijndaelKey128 #define XID_SIZE 8 /*length in bytes of transaction id*/ #define NONCE_SIZE 8 /*length in bytes of Nonce R in ProvMsg*/ +#define NONCE_2_SIZE 16 /*length in bytes of Nonce in ProvMsg3*/ #define CHALLENGE_NONCE_SIZE 32 /*length in bytes of Challenge nonce in ProvMsg2*/ #define PPID_SIZE sizeof(ppid_t) /*16*/ #define PSVN_SIZE sizeof(psvn_t) /*18*/ @@ -60,7 +61,6 @@ #define PSID_SIZE sizeof(psid_t) /*64*/ #define JOIN_PROOF_SIZE sizeof(JoinRequest) #define BLIND_ESCROW_SIZE sizeof(blind_escrow_data_t) -#define EPID_KEY_MEMBER_SIZE 16 /*the length in bytes of X,A,F in private key*/ #define PEK_PUB ((uint8_t)0) #define PEK_PRIV ((uint8_t)1) @@ -68,8 +68,12 @@ #define ECDSA_SIGN_SIZE 32 /*This is the size of biginteger for ECDSA signature appended at the end of SIG-RL and the total signature size is size of two such kind of integer*/ #define PVE_RSA_KEY_BITS 2048 #define PVE_RSA_KEY_BYTES (PVE_RSA_KEY_BITS/8) +#define PVE_RSA_SEED_SIZE 32 -#pragma pack(1) +#define XEGB_SIZE 456 /*hardcoded size of extended_epid_group_blob_t*/ +#define XEGB_FORMAT_ID 0x0100 /*hardcoded format id in extended_epid_group_blob to be 16bits bigendian 1*/ + +#pragma pack(push, 1) /*Define some structure will be used in TLV payload. Make sure the alignment of all of them is 1 since they'll be used in an unaligned buffer type for Platform Provisioning Identifier, it could be calculated inside PvE*/ typedef struct _ppid_t{ @@ -85,10 +89,10 @@ typedef struct _psid_t{ uint8_t psid[32]; }psid_t; -/*type for Platform Security Version Numbers. Data structure without alignment required. */ +/*Data structure without alignment required. */ typedef struct _psvn_t{ sgx_cpu_svn_t cpu_svn; - sgx_isv_svn_t isv_svn; //PvE SVN + sgx_isv_svn_t isv_svn; /*PvE/QE SVN*/ }psvn_t; /*type for the optional Flags in ProvMsg1. Currently only the 1st bit is defined for performance rekey flag*/ @@ -96,6 +100,13 @@ typedef struct _flags_t{ uint8_t flags[16]; }flags_t; +typedef struct _bk_platform_info_t{ + sgx_cpu_svn_t cpu_svn; + sgx_isv_svn_t pve_svn; + sgx_isv_svn_t pce_svn; + uint16_t pce_id; + fmsp_t fmsp; +}bk_platform_info_t; /*type for EpidVersion used in Epid Data which is two bytes big endian integer*/ typedef struct _epid_version_t{ uint8_t data[2]; @@ -106,7 +117,7 @@ typedef struct _epid_type_t{ uint8_t data[2]; }epid_type_t; -/*Type for Epid Group Public Cert*/ +/*Type for signed Epid Group Public Cert*/ typedef struct _signed_epid_group_cert_t{ epid_version_t version; epid_type_t type; @@ -114,35 +125,36 @@ typedef struct _signed_epid_group_cert_t{ uint8_t intel_signature[2*ECDSA_SIGN_SIZE]; }signed_epid_group_cert_t; +#define PEK_MOD_SIZE 256 typedef struct _signed_pek_t{ - uint8_t n[256]; + uint8_t n[PEK_MOD_SIZE]; uint8_t e[4]; uint8_t sha1_ne[20]; uint8_t pek_signature[2*ECDSA_SIGN_SIZE]; uint8_t sha1_sign[20]; }signed_pek_t; -/*Type for an Blind Escrow Data which is used in provisioning message 3 and message 4. +/*Type for Blind Escrow Data which is used in provisioning message 3 and message 4. The data structure is only used by PvE*/ typedef struct _blind_escrow_data_t{ uint32_t version; - uint8_t iv[IV_SIZE]; + uint8_t iv[IV_SIZE]; PElemStr f; - uint8_t mac[MAC_SIZE]; + uint8_t mac[MAC_SIZE]; }blind_escrow_data_t; /*The Join Proof with Escrow data in provisioning message 3*/ typedef struct _join_proof_with_escrow_t{ - JoinRequest jr; + JoinRequest jr; blind_escrow_data_t escrow; }join_proof_with_escrow_t; /*The Membership Credential with Escrow Data used in provisioning message 4*/ -typedef struct _membertship_credential_with_escrow_t{ - PElemStr x; - G1ElemStr A; +typedef struct _membership_credential_with_escrow_t{ + PElemStr x; + G1ElemStr A; blind_escrow_data_t escrow; -}membertship_credential_with_escrow_t; +}membership_credential_with_escrow_t; /*The Device ID structure used in Provisioning message*/ typedef struct _device_id_t{ @@ -151,29 +163,42 @@ typedef struct _device_id_t{ fmsp_t fmsp; }device_id_t; -#define EPID_KEY_BLOB_VERSION 1 -#define PVE_SEAL_EPID_KEY_BLOB 0 +#define EPID_KEY_BLOB_VERSION_PAK 2 +#define PVE_SEAL_EPID_KEY_BLOB 0 -#pragma pack(push, 1) typedef struct _se_secret_epid_data_t { PrivKey epid_private_key; }se_secret_epid_data_t; -typedef struct _se_plaintext_epid_data_t { - uint8_t seal_blob_type; /*Encalve-specific Sealblob Type, for 2015 PvE/QE, only one Sealblob type defined: PVE_SEAL_EPID_KEY_BLOB=0*/ - uint8_t epid_key_version;/*epid key version should be EPID_KEY_BLOB_VERSION=1*/ - sgx_cpu_svn_t equiv_cpu_svn; - sgx_isv_svn_t equiv_isv_svn; - EPID2Params epid_param_cert; - GroupPubKey epid_group_cert; -}se_plaintext_epid_data_t; +/*From beginning to field epid_group_cert, se_plaintext_epid_data_pak_t should has same layout as se_plaintext_epid_data_t*/ +typedef struct _se_plaintext_epid_data_pak_t { + uint8_t seal_blob_type; /*Encalve-specific Sealblob Type, for 2015 PvE/QE, only one Sealblob type defined: PVE_SEAL_EPID_KEY_BLOB=0*/ + uint8_t epid_key_version;/*seal_blob_type specific version number, should be EPID_KEY_BLOB_VERSION_PAK(_NPC). 2 or 3*/ + sgx_cpu_svn_t equiv_cpu_svn; + sgx_isv_svn_t equiv_pve_isv_svn; + EPID2Params epid_param_cert; + GroupPubKey epid_group_cert; + uint8_t qsdk_exp[4]; /*little endian*/ + uint8_t qsdk_mod[PVE_RSA_KEY_BYTES];/*little endian*/ + uint8_t epid_sk[2*ECDSA_SIGN_SIZE]; /*little endian*/ + uint32_t xeid; /*ExtEPIDGroup ID, little endian*/ +}se_plaintext_epid_data_pak_t; + +typedef struct _extended_epid_group_blob_t{ + uint16_t format_id; /*fixed bigendian 1*/ + uint16_t data_length; /*bigendian length for fields after it and not including signature*/ + uint32_t xeid; /*ExtEPIDGroup ID, little endian*/ + uint8_t epid_sk[2*ECDSA_SIGN_SIZE];/*ecdsa public key for EPID sign Key in little endian*/ + uint8_t pek_sk[2*ECDSA_SIGN_SIZE]; /*ecdsa public key for PEKSK in little endian*/ + uint8_t qsdk_exp[4]; /*exponient of RSA key for QSDK, little endian*/ + uint8_t qsdk_mod[PVE_RSA_KEY_BYTES];/*Modulus of RSA key for QSDK. current it is 2048 bits, little endian*/ + uint8_t signature[2*ECDSA_SIGN_SIZE];/*ECDSA signature of the data, big endian*/ +}extended_epid_group_blob_t; + +#define EXTENDED_EPID_GROUP_BLOB_DATA_LEN ((uint32_t)(sizeof(uint32_t)+4*(ECDSA_SIGN_SIZE)+4+(PVE_RSA_KEY_BYTES))) + +#define SGX_TRUSTED_EPID_BLOB_SIZE_PAK (sizeof(sgx_sealed_data_t)+sizeof(se_secret_epid_data_t)+sizeof(se_plaintext_epid_data_pak_t)) #pragma pack(pop) - -#define SGX_TRUSTED_EPID_BLOB_SIZE (sgx_calc_sealed_data_size( \ - sizeof(se_plaintext_epid_data_t), \ - sizeof(se_secret_epid_data_t))) - -#pragma pack() #endif diff --git a/sdk/tlibc/math/w_pow10.c b/psw/ae/inc/internal/pce_cert.h similarity index 79% rename from sdk/tlibc/math/w_pow10.c rename to psw/ae/inc/internal/pce_cert.h index cc63e92e58..b2b6978139 100644 --- a/sdk/tlibc/math/w_pow10.c +++ b/psw/ae/inc/internal/pce_cert.h @@ -28,12 +28,24 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#ifndef _PCE_CERT_H_ +#define _PCE_CERT_H_ +#include "se_types.h" +#include "sgx_tcrypto.h" +#include "epid_pve_type.h" +const uint16_t CUR_PCE_ID = 0; -#include +/*crypto_suite*/ +#define ALG_RSA_OAEP_2048 0 -double -pow10(double x) -{ - return pow(10, x); -} +/*signature_scheme*/ +#define NIST_P256_ECDSA_SHA256 0 + +/*type for Platform Certificate Enclave information*/ +typedef struct _pce_info_t{ + sgx_isv_svn_t pce_isvn; /*PCE ISVSVN*/ + uint16_t pce_id; +}pce_info_t; + +#endif diff --git a/psw/ae/inc/internal/pek_pub_key.h b/psw/ae/inc/internal/pek_pub_key.h index 624fd5e869..af2b690f21 100644 --- a/psw/ae/inc/internal/pek_pub_key.h +++ b/psw/ae/inc/internal/pek_pub_key.h @@ -37,6 +37,8 @@ #include "epid_pve_type.h" -sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, uint8_t *result); +sgx_status_t check_pek_signature(const signed_pek_t& signed_pek, const sgx_ec256_public_t* pek_sk, uint8_t *result); +sgx_status_t verify_xegb(const extended_epid_group_blob_t& xegb, uint8_t *result); +sgx_status_t verify_xegb_with_default(const extended_epid_group_blob_t& xegb, uint8_t *result, extended_epid_group_blob_t& out_xegb); #endif diff --git a/psw/ae/inc/internal/provision_msg.h b/psw/ae/inc/internal/provision_msg.h index 33f466d3e8..c3abac8511 100644 --- a/psw/ae/inc/internal/provision_msg.h +++ b/psw/ae/inc/internal/provision_msg.h @@ -42,8 +42,9 @@ #include "epid_pve_type.h" #include "sgx_tseal.h" +#include "sgx_report.h" -//error code definition +/*error code definition*/ typedef enum _pve_status_t { PVEC_SUCCESS = 0, @@ -57,113 +58,92 @@ typedef enum _pve_status_t PVEC_IPP_ERROR, PVEC_MSG_ERROR, PVEC_PEK_SIGN_ERROR, + PVEC_XEGDSK_SIGN_ERROR, PVEC_INTEGER_OVERFLOW_ERROR, PVEC_SEAL_ERROR, PVEC_EPID_ERROR, - PVEC_SESSION_OUT_OF_ORDER_ERROR, PVEC_REVOKED_ERROR, PVEC_UNSUPPORTED_VERSION_ERROR, PVEC_INVALID_CPU_ISV_SVN, PVEC_INVALID_EPID_KEY, - PVEC_UNEXPECTED_ERROR //unknown error which should never happen, it indicates there're internal logical error in PvE's code + PVEC_UNEXPECTED_ERROR /*unknown error which should never happen, it indicates there're internal logical error in PvE's code*/ }pve_status_t; -//State inside PvE +/*State inside PvE*/ typedef enum _prov_stage_t { - PVE_STAGE_IDLE, //waiting for ProvMsg1 - PVE_STAGE_WAIT_FOR_GET_EK2, //waiting for get ek2 after processing msg1 - PVE_STAGE_WAIT_FOR_MSG2_OR_MSG4, //waiting for ProvMsg2 or ProvMsg4 after getting ek2 - PVE_STAGE_WAIT_FOR_MSG4, //waiting for ProvMsg4 only + PVE_STAGE_IDLE, /*waiting for ProvMsg1*/ + PVE_STAGE_WAIT_FOR_GET_EK2, /*waiting for get ek2 after processing msg1*/ + PVE_STAGE_WAIT_FOR_MSG2_OR_MSG4, /*waiting for ProvMsg2 or ProvMsg4 after getting ek2*/ + PVE_STAGE_WAIT_FOR_MSG4, /*waiting for ProvMsg4 only*/ }prov_stage_t; -#define PVE_RSAOAEP_ENCRYPT_MAXLEN (PVE_RSA_KEY_BYTES - 2*SHA_SIZE_BIT/8 - 2) //190 bytes at most +#define PVE_RSAOAEP_ENCRYPT_MAXLEN (PVE_RSA_KEY_BYTES - 2*SHA_SIZE_BIT/8 - 2) /*190 bytes at most*/ -//macro definition for RSA-OAE algorithm -//SHA-256 will be used for the hash generation +/*macro definition for RSA-OAE algorithm + SHA-256 will be used for the hash generation*/ #define SHA_SIZE_BIT 256 -#define MSG1_FIELD1_MAX_PAYLOAD_SIZE (4+PPID_SIZE+FMSP_SIZE+PSVN_SIZE+4+FLAGS_SIZE) -#define HARD_CODED_EPID_BLOB_SIZE (sizeof(sgx_sealed_data_t)+sizeof(se_secret_epid_data_t)+sizeof(se_plaintext_epid_data_t)) #define pointer_diff_u32(p1, p2) static_cast(p1-p2) #pragma pack(1) -//output information from PvE for AESM to generated ProvMsg1 -typedef struct _prov_msg1_output_t{ - uint32_t field1_data_size; //size of field1_data, it will be no more than MSG1_FIELD1_MAX_PAYLOAD_SIZE - uint8_t xid[XID_SIZE]; //The random transaction id which will be generated inside Enclave - uint8_t field0[PVE_RSA_KEY_BYTES]; //field0 of Msg1 generated inside PvE encrypted by RSA-OAEP, that's SK TLV:PSID TLV - uint8_t field1_iv[IV_SIZE]; //The random IV used to encrypt field1 of Msg1 by aes-gcm - //field1 before encryption is DeviceIDTlV[:FlagTLV] - uint8_t field1_data[MSG1_FIELD1_MAX_PAYLOAD_SIZE];//The encrypted field1 of Msg1 by aes-gcm, the size in byte is indicated by field1_data - uint8_t field1_mac[MAC_SIZE]; //The generated mac value of field1 of Msg1 by aes-gcm -}prov_msg1_output_t; -//input information to generate EK2 by PvE -typedef struct _prov_get_ek2_input_t{ - uint8_t xid[XID_SIZE]; //The transaction Id - uint8_t nonce[NONCE_SIZE]; //The nonce_r from ProvMsg2 or ProvMsg4 -}prov_get_ek2_input_t; - -//Ek2 generated by PvE -typedef struct _prov_get_ek2_output_t{ - uint8_t ek2[SK_SIZE]; -}prov_get_ek2_output_t; - -//input information for PvE to decode data from ProvMsg2 +/*input information for PvE to decode data from ProvMsg2*/ typedef struct _proc_prov_msg2_blob_input_t{ - signed_epid_group_cert_t group_cert; //ECDSA signed EPID Group Public Certificate from Intel decoded from ProvMsg2 - uint8_t challenge_nonce[CHALLENGE_NONCE_SIZE]; //The challenge nonce from ProvMsg2 - psvn_t equivalent_psvn; //The Equivalent PSVN which contains ISVN and Equivalent CPUSVN - psvn_t previous_psvn; //an optional PSVN for Sigrl corresponding to previous EPID (if we upgrade TCB or performance rekey) - fmsp_t fmsp; //fmsp passing in ProvMsg2 from Provisioning Backend server - GroupID previous_gid; //optional previous_gid if previous_psvn is provided - uint8_t old_epid_data_blob[HARD_CODED_EPID_BLOB_SIZE]; //optional old epid data blob corresponding to previous EPID - uint8_t tcb_iv[IV_SIZE]; //The random IV to decode TIK - uint8_t encrypted_tcb[SK_SIZE]; //It's TIK1, the aesm-gcm encrypted TIK by aes-gcm - uint8_t tcb_mac[MAC_SIZE]; //The mac value to check the integrity of TIK1 - uint8_t is_previous_psvn_provided;//both previous_psvn and old_epid_data_blob should be provided if it is true and prev gid must be provided too + signed_epid_group_cert_t group_cert; /*ECDSA signed EPID Group Public Certificate from Intel decoded from ProvMsg2*/ + extended_epid_group_blob_t xegb; + signed_pek_t pek; + sgx_target_info_t pce_target_info; + uint8_t challenge_nonce[CHALLENGE_NONCE_SIZE]; /*The challenge nonce from ProvMsg2*/ + bk_platform_info_t equiv_pi; /*The Equivalent platform_info*/ + bk_platform_info_t previous_pi; /*an optional platform_info for Sigrl correpondent to previous EPID (if we upgrade TCB or performance rekey)*/ + GroupID previous_gid; /*optional previous_gid if previous_psvn is provided*/ + uint8_t old_epid_data_blob[SGX_TRUSTED_EPID_BLOB_SIZE_PAK]; /*optional old epid data blob correpondent to previous EPID*/ + uint8_t is_previous_pi_provided; /*both previous_platform_info and old_epid_data_blob should be provided if it is true and prev gid must be provided too*/ }proc_prov_msg2_blob_input_t; #define HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE (4+sizeof(join_proof_with_escrow_t)) -#define HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE (4+sizeof(membertship_credential_with_escrow_t)) +#define HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE (4+sizeof(membership_credential_with_escrow_t)) -//output information from PvE for AESM to generate ProvMsg3 +/*output information from PvE for AESM to generate ProvMsg3*/ typedef struct _gen_prov_msg3_output_t{ - uint8_t field1_iv[IV_SIZE]; //The random generated IV for aes-gcm encryption of join proof and escrow data - uint8_t field1_data[HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE]; //The encrypted join proof and escrow data TLV by aes-gcm - uint8_t field1_mac[MAC_SIZE]; //The corresponding mac value of previous encrypted data - uint8_t epid_sig_iv[IV_SIZE]; //The random generated IV for aes-gcm encryption of EPIDSignature if available - uint8_t epid_sig_mac[MAC_SIZE];//The corresponding mac value for encrypted EPIDSignature if available - uint32_t epid_sig_output_size; //The size of EPIDSignature if available - uint8_t is_join_proof_generated; //boolean value to tell whether join proof and escrow data is generated. The first three fields in this structure will be invalid if this field is false - uint8_t is_epid_sig_generated; //boolean value to tell whether EpidSignature is generated - //If it is false, the epid_sig_iv/mac/output_size are all invalid + uint8_t field1_iv[IV_SIZE]; /*The random generated IV for aes-gcm encryption of join proof and escrow data*/ + uint8_t field1_data[HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE]; /*The encrypted join proof and escrow data TLV by aes-gcm*/ + uint8_t field1_mac[MAC_SIZE]; /*The corresponding mac value of previous encrypted data*/ + uint8_t n2[NONCE_2_SIZE]; + uint8_t epid_sig_iv[IV_SIZE]; /*The random generated IV for aes-gcm encryption of EPIDSignature if available*/ + uint8_t epid_sig_mac[MAC_SIZE];/*The corresponding mac value for encrypted EPIDSignature if available*/ + uint8_t encrypted_pwk2[PEK_MOD_SIZE]; + sgx_report_t pwk2_report; + uint32_t epid_sig_output_size; /*The size of EPIDSignature if available*/ + uint8_t is_join_proof_generated;/*boolean value to tell whether join pro[of and escrow data is generated. The first three fields in this structure will be invalid if this field is false*/ + uint8_t is_epid_sig_generated; /*boolean value to tell whether EpidSignature is generated*/ + /*If it is false, the epid_sig_iv/mac/output_size are all invalid*/ }gen_prov_msg3_output_t; -//input information for PvE to decode data from ProvMsg4 and generate EPID Data Blob +/*input information for PvE to decode data from ProvMsg4 and generate EPID Data Blob*/ typedef struct _proc_prov_msg4_input_t{ - uint8_t tcb_iv[IV_SIZE]; //The random IV to decode TIK - uint8_t encrypted_tcb[SK_SIZE]; //It's TIK1, the aes-gcm encrypted TIK by aes-gcm - uint8_t tcb_mac[MAC_SIZE]; //The mac value to check the integrity of TIK1 - uint8_t member_credential_iv[IV_SIZE]; //The random IV to decode member credential and escrow data TLV - uint8_t encrypted_member_credential[HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE]; //The encrypted member credential and escrow data TLV by aes-gcm - uint8_t member_credential_mac[MAC_SIZE]; //The mac value of previous field - psvn_t equivalent_psvn; //An equivalent PSVN including ISVN and equivalent CPUSVN - fmsp_t fmsp; //The fmsp from provisioning backend server - signed_epid_group_cert_t group_cert;//ECDSA signed EPID Group Public Certificate from Intel decoded from ProvMsg4 + extended_epid_group_blob_t xegb; + uint8_t member_credential_iv[IV_SIZE]; /*The random IV to decode member credential and escrow data TLV*/ + uint8_t encrypted_member_credential[HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE]; /*The encrypted member credential and escrow data TLV by aes-gcm*/ + uint8_t member_credential_mac[MAC_SIZE];/*The mac value of previous field*/ + uint8_t n2[NONCE_2_SIZE]; + psvn_t equivalent_psvn; /*An equivalent PSVN including ISVN and equivalent CPUSVN*/ + fmsp_t fmsp; /*The fmsp from provisioning backend server*/ + signed_epid_group_cert_t group_cert; /*ECDSA signed EPID Group Public Certificate from Intel decoded from ProvMsg4*/ }proc_prov_msg4_input_t; -//The EPID Data Blob generated by PvE in processing ProvMsg4 data +/*The EPID Data Blob generated by PvE in processing ProvMsg4 data*/ typedef struct _proc_prov_msg4_output_t{ - uint8_t truested_epid_blob[HARD_CODED_EPID_BLOB_SIZE]; + uint8_t truested_epid_blob[SGX_TRUSTED_EPID_BLOB_SIZE_PAK]; }proc_prov_msg4_output_t; -//output data of PvE to generate End Point Selection TLV +/*output data of PvE to generate End Point Selection TLV*/ typedef struct _gen_endpoint_selection_output_t{ uint8_t xid[XID_SIZE]; uint8_t selector_id; }gen_endpoint_selection_output_t; + #pragma pack() #define PSVN_START_IN_DEVICE_ID sizeof(ppid_t) diff --git a/psw/ae/inc/internal/pve_qe_common.h b/psw/ae/inc/internal/pve_qe_common.h index 96d5cb9084..ec72523c92 100644 --- a/psw/ae/inc/internal/pve_qe_common.h +++ b/psw/ae/inc/internal/pve_qe_common.h @@ -41,10 +41,6 @@ extern "C" { #endif -extern const uint8_t g_sgx_isk_pubkey_x[SGX_ECP256_KEY_SIZE]; - -extern const uint8_t g_sgx_isk_pubkey_y[SGX_ECP256_KEY_SIZE]; - IppStatus new_std_256_ecp(IppsECCPState **pp_new_ecp); void secure_free_std_256_ecp(IppsECCPState *p_ecp); diff --git a/psw/ae/inc/internal/tlv_common.h b/psw/ae/inc/internal/tlv_common.h index ccf193de83..4102301677 100644 --- a/psw/ae/inc/internal/tlv_common.h +++ b/psw/ae/inc/internal/tlv_common.h @@ -75,6 +75,9 @@ typedef enum _tlv_enum_type_t{ TLV_SIGNATURE, /* End-point Selection Protocol TLVs*/ TLV_PEK, + TLV_PLATFORM_INFO, + TLV_PWK2, + TLV_SE_REPORT }tlv_enum_type_t; /*here comes general type and macro definition for AESM related Server URL which will be shared by code in other components*/ @@ -83,7 +86,8 @@ typedef enum _aesm_network_server_enum_type_t{ PSE_PROVISIONING, ENDPOINT_SELECTION, REVOCATION_LIST_RETRIEVAL, - PSE_OCSP + PSE_OCSP, + SGX_WHITE_LIST_FILE }aesm_network_server_enum_type_t; typedef enum _pve_msg_type_t @@ -136,7 +140,11 @@ enum _se_protocol_response_status_t SE_PRS_OK, SE_PRS_PLATFORM_REVOKED, SE_PRS_STATUS_INTEGRITY_FAILED, - SE_PRS_PERFORMANCE_REKEY_NOT_SUPPORTED + SE_PRS_PERFORMANCE_REKEY_NOT_SUPPORTED, + SE_PRS_PROVISIONING_ERROR, + SE_PRS_INVALID_REQUEST, + SE_PRS_PROV_ATTEST_KEY_NOT_FOUND, + SE_PRS_INVALID_REPORT }; typedef uint16_t pse_protocol_response_status_t; @@ -182,6 +190,7 @@ typedef struct _provision_response_header_t{ #define GET_TYPE_FROM_PROVISION_RESPONSE(resp) (((const provision_response_header_t *)(resp))->type) #define TLV_VERSION_1 1 +#define TLV_VERSION_2 2 #endif diff --git a/psw/ae/le/config_debug.xml b/psw/ae/le/config_debug.xml deleted file mode 100644 index 7a66a6d111..0000000000 --- a/psw/ae/le/config_debug.xml +++ /dev/null @@ -1,12 +0,0 @@ - - 1 - 0 - 1 - 0x20 - 1 - 1 - 1 - 0x2000 - 0xb000 - 0x1 - diff --git a/psw/ae/pce/pce.edl b/psw/ae/pce/pce.edl new file mode 100644 index 0000000000..426bbc1332 --- /dev/null +++ b/psw/ae/pce/pce.edl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +enclave{ + include "pce_cert.h" + include "sgx_report.h" + trusted { + public uint32_t get_pc_info([in]const sgx_report_t *report, + [in, size=key_size]const uint8_t *public_key, uint32_t key_size, + uint8_t crypto_suite, + [out, size=encrypted_ppid_buf_size]uint8_t *encrypted_ppid, uint32_t encrypted_ppid_buf_size, + [out]uint32_t *encrypted_ppid_out_size, + [out]pce_info_t *pce_info, + [out] uint8_t *signature_scheme); + + public uint32_t certify_enclave([in]const psvn_t *cert_psvn, + [in]const sgx_report_t *report, + [out, size=signature_buf_size]uint8_t *signature, uint32_t signature_buf_size, + [out]uint32_t *signature_out_size); + }; +}; \ No newline at end of file diff --git a/psw/ae/pve/provision_enclave.edl b/psw/ae/pve/provision_enclave.edl index 356d68888a..87d78ad383 100644 --- a/psw/ae/pve/provision_enclave.edl +++ b/psw/ae/pve/provision_enclave.edl @@ -32,15 +32,13 @@ enclave{ include "provision_msg.h" trusted { - public uint32_t gen_prov_msg1_data_wrapper([in]const psvn_t *psvn, - [in]const signed_pek_t *pek, - uint8_t performance_rekey_flag, - [out] prov_msg1_output_t *msg1_output); - - public uint32_t get_ek2_wrapper([in] const prov_get_ek2_input_t *input, - [out] prov_get_ek2_output_t *ek2); + public uint32_t gen_prov_msg1_data_wrapper([in]const extended_epid_group_blob_t *xegb, + [in]const signed_pek_t *pek, + [in]const sgx_target_info_t *pce_target_info, + [out]sgx_report_t *msg1_output); public uint32_t proc_prov_msg2_data_wrapper([in]const proc_prov_msg2_blob_input_t *msg2_input, + uint8_t performance_rekey_used, [user_check]const uint8_t *sigrl, uint32_t sigrl_size,//optional input sigrl in external memory [out] gen_prov_msg3_output_t *msg3_fixed_output, [user_check]uint8_t *epid_sig, uint32_t epid_sig_buffer_size);//optional output epid signature in external memory directly diff --git a/psw/ae/qe/quoting_enclave.edl b/psw/ae/qe/quoting_enclave.edl index 426736e6ba..a67655b840 100644 --- a/psw/ae/qe/quoting_enclave.edl +++ b/psw/ae/qe/quoting_enclave.edl @@ -48,6 +48,6 @@ include "sgx_quote.h" uint32_t sig_rl_size, [out] sgx_report_t *qe_report, [user_check] uint8_t *p_quote, // Quote is also big, we should output it in piece meal. - uint32_t quote_size); + uint32_t quote_size, sgx_isv_svn_t pce_isvnsvn); }; }; diff --git a/psw/uae_service/linux/Makefile b/psw/uae_service/linux/Makefile index 5771ae8ac9..a3aad4e284 100644 --- a/psw/uae_service/linux/Makefile +++ b/psw/uae_service/linux/Makefile @@ -93,6 +93,14 @@ IPC_SRC := AECloseSessionRequest.cpp \ AEReportAttestationResponse.cpp \ ProtobufSerializer.cpp \ AEGetLaunchTokenRequest.cpp \ + AEGetWhiteListSizeRequest.cpp \ + AEGetWhiteListSizeResponse.cpp \ + AEGetWhiteListRequest.cpp \ + AEGetWhiteListResponse.cpp \ + AESGXGetExtendedEpidGroupIdRequest.cpp \ + AESGXGetExtendedEpidGroupIdResponse.cpp \ + AESGXSwitchExtendedEpidGroupRequest.cpp \ + AESGXSwitchExtendedEpidGroupResponse.cpp \ SocketTransporter.cpp \ AEGetLaunchTokenResponse.cpp \ UnixCommunicationSocket.cpp \ diff --git a/psw/uae_service/sgx_uae_service.cpp b/psw/uae_service/sgx_uae_service.cpp index 89b5304433..b85fab489c 100644 --- a/psw/uae_service/sgx_uae_service.cpp +++ b/psw/uae_service/sgx_uae_service.cpp @@ -53,6 +53,10 @@ #define SE_GET_PS_CAP_TIMEOUT_MSEC (IPC_LATENCY) #define SE_REPORT_REMOTE_ATTESTATION_FAILURE_TIMEOUT_MSEC (IPC_LATENCY) +#define GET_WHITE_LIST_SIZE_MSEC (IPC_LATENCY) +#define GET_WHITE_LIST_MSEC (IPC_LATENCY) +#define SGX_GET_EXTENDED_GROUP_ID_MSEC (IPC_LATENCY) +#define SGX_SWITCH_EXTENDED_GROUP_MSEC (IPC_LATENCY) extern "C" { sgx_status_t get_launch_token( @@ -85,6 +89,9 @@ sgx_status_t get_launch_token( case AESM_GET_LICENSETOKEN_ERROR: mapped = SGX_ERROR_SERVICE_INVALID_PRIVILEGE; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; default: mapped = SGX_ERROR_UNEXPECTED; } @@ -129,6 +136,9 @@ sgx_status_t sgx_init_quote( case AESM_SGX_PROVISION_FAILED: mapped = SGX_ERROR_UNEXPECTED; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; default: mapped = SGX_ERROR_UNEXPECTED; } @@ -186,6 +196,9 @@ sgx_status_t sgx_get_quote( case AESM_SGX_PROVISION_FAILED: mapped = SGX_ERROR_UNEXPECTED; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; default: mapped = SGX_ERROR_UNEXPECTED; } @@ -265,6 +278,12 @@ sgx_status_t sgx_report_attestation_status( case AESM_PLATFORM_INFO_BLOB_INVALID_SIG: mapped = SGX_ERROR_INVALID_PARAMETER; break; + case AESM_EPIDBLOB_ERROR: + mapped = SGX_ERROR_AE_INVALID_EPIDBLOB; + break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; case AESM_SGX_PROVISION_FAILED: default: mapped = SGX_ERROR_UNEXPECTED; @@ -308,6 +327,9 @@ sgx_status_t create_session_ocall( case AESM_SERVICE_NOT_AVAILABLE: mapped = SGX_ERROR_SERVICE_UNAVAILABLE; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; case AESM_MSG_ERROR: default: mapped = SGX_ERROR_UNEXPECTED; @@ -356,6 +378,9 @@ sgx_status_t exchange_report_ocall( case AESM_SERVICE_NOT_AVAILABLE: mapped = SGX_ERROR_SERVICE_UNAVAILABLE; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; default: mapped = SGX_ERROR_UNEXPECTED; } @@ -393,6 +418,9 @@ sgx_status_t close_session_ocall( case AESM_SERVICE_NOT_AVAILABLE: mapped = SGX_ERROR_SERVICE_UNAVAILABLE; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; default: mapped = SGX_ERROR_UNEXPECTED; } @@ -436,6 +464,9 @@ sgx_status_t invoke_service_ocall( case AESM_SERVICE_NOT_AVAILABLE: mapped = SGX_ERROR_SERVICE_UNAVAILABLE; break; + case AESM_OUT_OF_EPC: + mapped = SGX_ERROR_OUT_OF_EPC; + break; case AESM_MSG_ERROR: default: mapped = SGX_ERROR_UNEXPECTED; @@ -446,6 +477,132 @@ sgx_status_t invoke_service_ocall( return mapped; } + +sgx_status_t sgx_get_whitelist_size( + uint32_t* p_whitelist_size) +{ + if (p_whitelist_size == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + ret = oal_get_whitelist_size(p_whitelist_size, GET_WHITE_LIST_SIZE_MSEC*1000, &result); + + //common mappings + sgx_status_t mapped = oal_map_status(ret); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + //operation specific mapping + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + + +sgx_status_t sgx_get_whitelist( + uint8_t* p_whitelist, + uint32_t whitelist_size) +{ + if (p_whitelist == NULL || whitelist_size == 0) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + + ret = oal_get_whitelist(p_whitelist, whitelist_size, GET_WHITE_LIST_MSEC*1000, &result); + + //common mappings + sgx_status_t mapped = oal_map_status(ret); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + //operation specific mapping + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + + return mapped; +} + +sgx_status_t sgx_get_extended_epid_group_id( + uint32_t* p_extended_epid_group_id) +{ + if (p_extended_epid_group_id == NULL) + return SGX_ERROR_INVALID_PARAMETER; + + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + ret = oal_get_extended_epid_group_id(p_extended_epid_group_id, SGX_GET_EXTENDED_GROUP_ID_MSEC*1000, &result); + + //common mappings + sgx_status_t mapped = oal_map_status(ret); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + //operation specific mapping + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + return mapped; +} + +sgx_status_t sgx_switch_extended_epid_group(uint32_t extended_epid_group_id) +{ + aesm_error_t result = AESM_UNEXPECTED_ERROR; + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + ret = oal_switch_extended_epid_group(extended_epid_group_id, SGX_SWITCH_EXTENDED_GROUP_MSEC*1000, &result); + + //common mappings + sgx_status_t mapped = oal_map_status(ret); + if (mapped != SGX_SUCCESS) + return mapped; + + mapped = oal_map_result(result); + if (mapped != SGX_SUCCESS) + { + //operation specific mapping + if (mapped == SGX_ERROR_UNEXPECTED && result != AESM_UNEXPECTED_ERROR) + { + switch (result) + { + default: + mapped = SGX_ERROR_UNEXPECTED; + } + } + } + return mapped; +} + // common mapper function for all OAL specific error codes sgx_status_t oal_map_status(uae_oal_status_t status) @@ -492,6 +649,7 @@ sgx_status_t oal_map_result(aesm_error_t result) retVal = SGX_ERROR_INVALID_PARAMETER; break; case AESM_SERVICE_STOPPED: + case AESM_SERVICE_UNAVAILABLE: retVal = SGX_ERROR_SERVICE_UNAVAILABLE; break; case AESM_OUT_OF_MEMORY_ERROR: @@ -505,6 +663,9 @@ sgx_status_t oal_map_result(aesm_error_t result) case AESM_PROXY_SETTING_ASSIST: retVal = SGX_ERROR_NETWORK_FAILURE; break; + case AESM_NO_DEVICE_ERROR: + retVal = SGX_ERROR_NO_DEVICE; + break; default: retVal = SGX_ERROR_UNEXPECTED; } diff --git a/psw/uae_service/uae_wrapper/inc/AEInternalServices.h b/psw/uae_service/uae_wrapper/inc/AEInternalServices.h index 52329fe220..b8386e66f0 100644 --- a/psw/uae_service/uae_wrapper/inc/AEInternalServices.h +++ b/psw/uae_service/uae_wrapper/inc/AEInternalServices.h @@ -52,6 +52,11 @@ class AEInternalServices : public AEServices virtual PsCap* GetPsCap(uint32_t timeout_msec=0) =0; virtual AttestationStatus* ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout_msec=0) =0; + + virtual WhiteListSize* GetWhiteListSize(uint32_t timeout_msec=0) =0; + virtual PlainData* GetWhiteList(uint32_t white_list_size, uint32_t timeout = 0) =0; + virtual ExtendedEpidGroupId* SGXGetExtendedEpidGroupId(uint32_t timeout_msec=0) =0; + virtual PlainData* SGXSwitchExtendedEpidGroup(uint32_t x_group_id, uint32_t timeout = 0) =0; }; #endif diff --git a/psw/uae_service/uae_wrapper/inc/AEServices.h b/psw/uae_service/uae_wrapper/inc/AEServices.h index f688428eb2..e36de2f0a5 100644 --- a/psw/uae_service/uae_wrapper/inc/AEServices.h +++ b/psw/uae_service/uae_wrapper/inc/AEServices.h @@ -114,6 +114,8 @@ typedef PlainData Signature; typedef PlainData SEAttributes; typedef PlainData PSEMessage; +typedef PlainData WhiteList; + typedef PlainData PlatformInfo; typedef PlainData UpdateInfo; @@ -218,7 +220,41 @@ struct PsCap } }; +struct WhiteListSize +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + uint32_t white_list_size; + WhiteListSize(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), white_list_size(0){} + ~WhiteListSize() + { + } + + bool operator==(const WhiteListSize& other) const + { + if (this == &other) return true; + return white_list_size == other.white_list_size; + } +}; + +struct ExtendedEpidGroupId +{ + uint32_t errorCode; + uae_oal_status_t uaeStatus; + uint32_t x_group_id; + + ExtendedEpidGroupId(): errorCode(AESM_UNEXPECTED_ERROR), uaeStatus(UAE_OAL_ERROR_UNEXPECTED), x_group_id(0){} + ~ExtendedEpidGroupId() + { + } + + bool operator==(const ExtendedEpidGroupId& other) const + { + if (this == &other) return true; + return x_group_id == other.x_group_id; + } +}; struct AttestationStatus { @@ -257,6 +293,10 @@ class AEServices virtual PsCap* GetPsCap(uint32_t timeout_msec=0) = 0; virtual AttestationStatus* ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength, uint32_t timeout_msec=0) = 0; + virtual WhiteListSize* GetWhiteListSize(uint32_t timeout_msec=0) = 0; + virtual PlainData* GetWhiteList(uint32_t white_list_size, uint32_t timeout = 0) =0; + virtual ExtendedEpidGroupId* SGXGetExtendedEpidGroupId(uint32_t timeout_msec=0) =0; + virtual PlainData* SGXSwitchExtendedEpidGroup(uint32_t x_group_id, uint32_t timeout = 0) =0; }; #endif diff --git a/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h b/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h index 45eac15978..944de67678 100644 --- a/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h +++ b/psw/uae_service/uae_wrapper/inc/AEServicesImpl.h @@ -62,7 +62,12 @@ class AEServicesImpl : public AEInternalServices{ PsCap* GetPsCap(uint32_t timeout_msec=0); AttestationStatus* ReportAttestationError(const PlatformInfo* platformInfo, uint32_t attestation_error_code, uint32_t updateInfoLength,uint32_t timeout_msec=0) ; - + + WhiteListSize* GetWhiteListSize(uint32_t timeout_msec=0); + PlainData* GetWhiteList(uint32_t white_list_size, uint32_t timeout = 0); + ExtendedEpidGroupId* SGXGetExtendedEpidGroupId(uint32_t timeout_msec=0); + PlainData* SGXSwitchExtendedEpidGroup(uint32_t x_group_id, uint32_t timeout = 0); + friend AEServices* AEServicesProvider::GetServicesProvider(); friend AEInternalServices* AEInternalServicesProvider::GetInternalServicesProvider(); diff --git a/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp b/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp index 4fa0e378b1..8dffbcaab4 100644 --- a/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp +++ b/psw/uae_service/uae_wrapper/src/AEServicesImpl.cpp @@ -57,6 +57,18 @@ #include #include +#include +#include + +#include +#include + +#include +#include + +#include +#include + #include #include #include @@ -395,3 +407,103 @@ AttestationStatus* AEServicesImpl::ReportAttestationError(const PlatformInfo* pl return attestationStatus; } + +WhiteListSize* AEServicesImpl::GetWhiteListSize(uint32_t timeout_msec) +{ + AEGetWhiteListSizeRequest* getWhiteListSizeRequest = new AEGetWhiteListSizeRequest(timeout_msec); + AEGetWhiteListSizeResponse* getWhiteListSizeResponse = new AEGetWhiteListSizeResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(getWhiteListSizeRequest, getWhiteListSizeResponse); + + WhiteListSize* white_list_size = new WhiteListSize(); + white_list_size->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && getWhiteListSizeResponse->check() == true) + white_list_size->white_list_size= getWhiteListSizeResponse->GetWhiteListSize(); + + white_list_size->errorCode = getWhiteListSizeResponse->GetErrorCode(); + + delete getWhiteListSizeRequest; + delete getWhiteListSizeResponse; + + return white_list_size; +} + +PlainData* AEServicesImpl::GetWhiteList(uint32_t white_list_size, uint32_t timeout) +{ + AEGetWhiteListRequest* getWhiteListRequest = new AEGetWhiteListRequest(white_list_size, timeout); + + if(getWhiteListRequest->check() == false) + { + delete getWhiteListRequest; + PlainData* whiteList = new PlainData; + whiteList->uaeStatus = UAE_OAL_ERROR_UNEXPECTED; + return whiteList; + } + + AEGetWhiteListResponse* getWhiteListResponse = new AEGetWhiteListResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(getWhiteListRequest, getWhiteListResponse); + + PlainData* whiteList = new PlainData; + whiteList->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && getWhiteListResponse->check()) + { + whiteList->length = getWhiteListResponse->GetWhiteListLength(); + + if (whiteList->length > 0) + { + whiteList->data = new uint8_t[whiteList->length]; + memcpy(whiteList->data, getWhiteListResponse->GetWhiteList(), whiteList->length); + } + } + + whiteList->errorCode = getWhiteListResponse->GetErrorCode(); + + delete getWhiteListRequest; + delete getWhiteListResponse; + + return whiteList; +} + +PlainData* AEServicesImpl::SGXSwitchExtendedEpidGroup(uint32_t x_group_id, uint32_t timeout) +{ + AESGXSwitchExtendedEpidGroupRequest* switchExtendedEpidGroupRequest = new AESGXSwitchExtendedEpidGroupRequest(x_group_id, timeout); + AESGXSwitchExtendedEpidGroupResponse* switchExtendedEpidGroupResponse = new AESGXSwitchExtendedEpidGroupResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(switchExtendedEpidGroupRequest, switchExtendedEpidGroupResponse); + + PlainData* res = new PlainData; + + res->errorCode = switchExtendedEpidGroupResponse->GetErrorCode(); + res->uaeStatus = ipc_status; + + delete switchExtendedEpidGroupRequest; + delete switchExtendedEpidGroupResponse; + + return res; +} + +ExtendedEpidGroupId* AEServicesImpl::SGXGetExtendedEpidGroupId(uint32_t timeout_msec) +{ + AESGXGetExtendedEpidGroupIdRequest* getExtendedEpidGroupIdRequest = new AESGXGetExtendedEpidGroupIdRequest(timeout_msec); + AESGXGetExtendedEpidGroupIdResponse* getExtendedEpidGroupIdResponse = new AESGXGetExtendedEpidGroupIdResponse(); + + uae_oal_status_t ipc_status = mTransporter->transact(getExtendedEpidGroupIdRequest, getExtendedEpidGroupIdResponse); + + ExtendedEpidGroupId* extended_group_id = new ExtendedEpidGroupId(); + extended_group_id->uaeStatus = ipc_status; + + if (ipc_status == UAE_OAL_SUCCESS && getExtendedEpidGroupIdResponse->check() == true) + extended_group_id->x_group_id= getExtendedEpidGroupIdResponse->GetExtendedEpidGroupId(); + + extended_group_id->errorCode = getExtendedEpidGroupIdResponse->GetErrorCode(); + + delete getExtendedEpidGroupIdRequest; + delete getExtendedEpidGroupIdResponse; + + return extended_group_id; +} + + diff --git a/psw/uae_service/uae_wrapper/src/uae_api.cpp b/psw/uae_service/uae_wrapper/src/uae_api.cpp index fa7588c03d..2f76c82b65 100644 --- a/psw/uae_service/uae_wrapper/src/uae_api.cpp +++ b/psw/uae_service/uae_wrapper/src/uae_api.cpp @@ -284,3 +284,93 @@ uae_oal_status_t SGXAPI oal_report_attestation_status( return ret; } +extern "C" +uae_oal_status_t oal_get_whitelist_size(uint32_t* white_list_size, uint32_t timeout_usec, aesm_error_t *result) +{ + AEServices* servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + WhiteListSize* whiteListSize = servicesProvider->GetWhiteListSize(timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (whiteListSize != NULL) + { + ret = whiteListSize->uaeStatus; + *result = (aesm_error_t)whiteListSize->errorCode; + + if (*result == AESM_SUCCESS) + { + *white_list_size = whiteListSize->white_list_size; + } + } + delete whiteListSize; + return ret; +} + +extern "C" +uae_oal_status_t oal_get_whitelist(uint8_t *white_list, uint32_t white_list_size, uint32_t timeout_usec, aesm_error_t *result) +{ + AEServices* servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + WhiteList* whiteList = servicesProvider->GetWhiteList(white_list_size, timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (whiteList != NULL) + { + ret = whiteList->uaeStatus; + *result = (aesm_error_t)whiteList->errorCode; + + if (*result == AESM_SUCCESS) + { + memcpy(white_list,whiteList->data,whiteList->length); + } + } + delete whiteList; + return ret; +} + +extern "C" +uae_oal_status_t oal_get_extended_epid_group_id(uint32_t* extended_group_id, uint32_t timeout_usec, aesm_error_t *result) +{ + AEServices* servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + ExtendedEpidGroupId* extendedGroupId = servicesProvider->SGXGetExtendedEpidGroupId(timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (extendedGroupId != NULL) + { + ret = extendedGroupId->uaeStatus; + *result = (aesm_error_t)extendedGroupId->errorCode; + + if (*result == AESM_SUCCESS) + { + *extended_group_id = extendedGroupId->x_group_id; + } + } + delete extendedGroupId; + return ret; +} + +extern "C" +uae_oal_status_t oal_switch_extended_epid_group(uint32_t x_group_id, uint32_t timeout_usec, aesm_error_t *result) +{ + AEServices* servicesProvider = AEServicesProvider::GetServicesProvider(); + if (servicesProvider == NULL) + return UAE_OAL_ERROR_UNEXPECTED; + + PlainData* plainData = servicesProvider->SGXSwitchExtendedEpidGroup(x_group_id, timeout_usec / 1000); + + uae_oal_status_t ret = UAE_OAL_ERROR_UNEXPECTED; + if (plainData != NULL) + { + ret = plainData->uaeStatus; + *result = (aesm_error_t)plainData->errorCode; + } + delete plainData; + return ret; +} diff --git a/psw/urts/linux/enter_enclave.S b/psw/urts/linux/enter_enclave.S index 3fb35543bc..bca4de6229 100644 --- a/psw/urts/linux/enter_enclave.S +++ b/psw/urts/linux/enter_enclave.S @@ -58,7 +58,7 @@ EENTER_PROLOG /* * at this point, we may have returned due to a normal EEXIT, * or we may have returned due to an OCALL. We differentiate - * by popping the top of the stack. If it is not -1, we have + * by popping the top of the stack. If it is not OCMD_ERET, we have * an untrusted bridge to call at that address. */ diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index 01b61ce238..ba1e2f4f2f 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -182,9 +182,32 @@ int CLoader::build_sections(vector *bitmap) { int ret = SGX_SUCCESS; std::vector sections = m_parser.get_sections(); + uint64_t max_rva =0; + Section* last_section = NULL; for(unsigned int i = 0; i < sections.size() ; i++) { + + + + if((last_section != NULL) && + (ROUND_TO_PAGE(last_section->virtual_size() + last_section->get_rva()) < ROUND_TO_PAGE(ROUND_TO_PAGE(last_section->virtual_size()) + last_section->get_rva())) && + (ROUND_TO_PAGE(last_section->get_rva() + last_section->virtual_size()) < (sections[i]->get_rva() & (~(SE_PAGE_SIZE - 1))))) + { + size_t size = SE_PAGE_SIZE; + sec_info_t sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + sinfo.flags = last_section->get_si_flags(); + uint64_t rva = ROUND_TO_PAGE(last_section->get_rva() + last_section->virtual_size()); + if(SGX_SUCCESS != (ret = build_pages(rva, size, 0, sinfo, ADD_EXTEND_PAGE))) + return ret; + } + + if(sections[i]->get_rva() > max_rva) + { + max_rva = sections[i]->get_rva(); + last_section = sections[i]; + } //since build_mem_region require the sec_info.rva be page aligned, we need handle the first page. //build the first page; uint64_t offset = (sections[i]->get_rva() & (SE_PAGE_SIZE -1)); @@ -218,6 +241,22 @@ int CLoader::build_sections(vector *bitmap) return ret; } } + + } + + + + + if((last_section != NULL) && + (ROUND_TO_PAGE(last_section->virtual_size() + last_section->get_rva()) < ROUND_TO_PAGE(ROUND_TO_PAGE(last_section->virtual_size()) + last_section->get_rva()))) + { + size_t size = SE_PAGE_SIZE; + sec_info_t sinfo; + memset(&sinfo, 0, sizeof(sinfo)); + sinfo.flags = last_section->get_si_flags(); + uint64_t rva = ROUND_TO_PAGE(last_section->get_rva() + last_section->virtual_size()); + if(SGX_SUCCESS != (ret = build_pages(rva, size, 0, sinfo, ADD_EXTEND_PAGE))) + return ret; } return SGX_SUCCESS; diff --git a/psw/urts/parser/elfparser.cpp b/psw/urts/parser/elfparser.cpp index aa2f7974fc..ea25b8fecb 100644 --- a/psw/urts/parser/elfparser.cpp +++ b/psw/urts/parser/elfparser.cpp @@ -528,7 +528,7 @@ bool build_regular_sections(const uint8_t* start_addr, { case PT_LOAD: sec = build_section(GET_PTR(uint8_t, start_addr, prg_hdr->p_offset), - (uint64_t)prg_hdr->p_filesz, ROUND_TO_PAGE((uint64_t)prg_hdr->p_memsz), + (uint64_t)prg_hdr->p_filesz, (uint64_t)prg_hdr->p_memsz, (uint64_t)prg_hdr->p_vaddr, (uint32_t) prg_hdr->p_flags); break; diff --git a/sdk/Makefile b/sdk/Makefile index 029026880b..9d1d429561 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -38,6 +38,7 @@ # - trts: libsgx_trts.a # - tcrypto: libsgx_tcrypto.a # - tkey_exchange: libsgx_tkey_exchange.a +# - tsetjmp: libsgx_tsetjmp.a # - Untrtusted libraries # - ukey_exchange: libsgx_ukey_exchange.a # - ptrace: libsgx_ptrace.so, gdb-sgx-plugin @@ -55,7 +56,7 @@ LIBTLIBCXX := $(BUILD_DIR)/libsgx_tstdcxx.a LIBTSE := $(BUILD_DIR)/libsgx_tservice.a .PHONY: all -all: tstdc tstdcxx tservice trts tcrypto tkey_exchange ukey_exchange ptrace sample_crypto simulation signtool edger8r +all: tstdc tstdcxx tservice trts tcrypto tkey_exchange ukey_exchange ptrace sample_crypto simulation signtool edger8r tsetjmp # --------------------------------------------------- # tstdc @@ -161,6 +162,9 @@ tcrypto: tkey_exchange: $(MAKE) -C tkey_exchange +.PHONY: tsetjmp +tsetjmp: + $(MAKE) -C tsetjmp/ # --------------------------------------------------- # Untrusted libraries # --------------------------------------------------- @@ -208,6 +212,7 @@ clean: $(MAKE) -C selib/linux/ clean $(MAKE) -C tae_service/ clean $(MAKE) -C trts/ clean + $(MAKE) -C tsetjmp/ clean $(MAKE) -C tlibcrypto/ clean $(MAKE) -C tkey_exchange/ clean $(MAKE) -C ukey_exchange/ clean diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py index 77f35f3ae5..0fe75649b4 100755 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py @@ -488,9 +488,9 @@ class UpdateOcallFrame(gdb.Breakpoint): if bp_in_urts == True: if SIZE == 4: - base_addr = gdb.parse_and_eval("base") - tcs_addr = gdb.parse_and_eval("tcs") - ocall_frame = gdb.parse_and_eval("of") + base_addr = gdb.parse_and_eval("$eax") + tcs_addr = gdb.parse_and_eval("$edx") + ocall_frame = gdb.parse_and_eval("$ecx") elif SIZE == 8: base_addr = gdb.parse_and_eval("$rdi") tcs_addr = gdb.parse_and_eval("$rsi") diff --git a/sdk/debugger_interface/linux/se_ptrace.c b/sdk/debugger_interface/linux/se_ptrace.c index 6d23bd989c..19e6fa2f59 100644 --- a/sdk/debugger_interface/linux/se_ptrace.c +++ b/sdk/debugger_interface/linux/se_ptrace.c @@ -131,6 +131,7 @@ static int get_exec_class(pid_t pid) return ELFCLASSNONE; if(-1 == read(fd, e_ident, EI_NIDENT)) { + close(fd); return ELFCLASSNONE; } diff --git a/sdk/edger8r/linux/CodeGen.ml b/sdk/edger8r/linux/CodeGen.ml index f7e2074aad..441025302d 100644 --- a/sdk/edger8r/linux/CodeGen.ml +++ b/sdk/edger8r/linux/CodeGen.ml @@ -1393,10 +1393,16 @@ let start_parsing (fname: string) : Ast.enclave = } in try - let chan = - let fullpath = Util.get_file_path fname - in save_file fullpath; open_in fullpath in - let lexbuf = Lexing.from_channel chan in + let fullpath = Util.get_file_path fname in + let preprocessed = + save_file fullpath; Preprocessor.processor_macro(fullpath) in + let lexbuf = + match preprocessed with + | None -> + let chan = open_in fullpath in + Lexing.from_channel chan + | Some(preprocessed_string) -> Lexing.from_string preprocessed_string + in try set_initial_pos lexbuf fname; let e : Ast.enclave = Parser.start_parsing Lexer.tokenize lexbuf in @@ -1407,7 +1413,7 @@ let start_parsing (fname: string) : Ast.enclave = let res = { e with Ast.ename = short_name } in if Util.is_c_identifier short_name then res else (eprintf "warning: %s: file short name `%s' is not a valid C identifier\n" fname short_name; res) - with exn -> close_in chan; + with exn -> begin match exn with | Parsing.Parse_error -> let curr = lexbuf.Lexing.lex_curr_p in diff --git a/sdk/edger8r/linux/Preprocessor.ml b/sdk/edger8r/linux/Preprocessor.ml new file mode 100644 index 0000000000..8eae6f4892 --- /dev/null +++ b/sdk/edger8r/linux/Preprocessor.ml @@ -0,0 +1,71 @@ +(* + * Copyright (C) 2011-2016 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *) + +open Unix +open Printf + +open Util + +(* for compat of OCaml before version 4.02.0 *) +module Bytes = String + +(* Run a command and return its results as a process_status*string. *) +let read_process (command : string) : Unix.process_status * string = + let buffer_size = 2048 in + let buffer = Buffer.create buffer_size in + let str = Bytes.create buffer_size in + let in_channel = Unix.open_process_in command in + let chars_read = ref 1 in + while !chars_read <> 0 do + chars_read := input in_channel str 0 buffer_size; + Buffer.add_substring buffer str 0 !chars_read + done; + let status = Unix.close_process_in in_channel in + let output = Buffer.contents buffer in + ( status, output ) + +(*Return None if gcc not found, caller should handle it*) +let processor_macro ( full_path : string) : string option= + let gcc_path = snd (read_process "which gcc") in + if not (String.contains gcc_path '/' ) then + (eprintf "warning: preprocessor is not found\n"; None) + else + let command = sprintf "gcc -x c -E -P \"%s\" 2>/dev/null" full_path in + let output = read_process command in + match fst output with + | WEXITED exit_status -> + if exit_status < 0 then + failwithf "gcc exited with error code 0x%d\n" exit_status + else if exit_status > 0 then + failwithf "Preprocessor failed\n" + else + Some(snd output) + | _ -> failwithf "Preprocessor stopped by signal\n" diff --git a/sdk/sample_libcrypto/sample_libcrypto.cpp b/sdk/sample_libcrypto/sample_libcrypto.cpp index 4b6b6f18e9..9057e248f4 100644 --- a/sdk/sample_libcrypto/sample_libcrypto.cpp +++ b/sdk/sample_libcrypto/sample_libcrypto.cpp @@ -31,10 +31,13 @@ /* - * This sample cryptopgraphy library was intended to be used in a limited - * manner. Its cryptographic strength is very weak. It should not be - * used by any production code. Its scope is limited to assist in the - * development of the remote attestation sample application. +* Do NOT use this library in your actual product. +* The purpose of this sample library is to aid the debugging of a +* remote attestation service. +* To achieve that goal, the sample remote attestation application +* will use this sample library to generate reproducible messages. +* If you have still not decided on whether you should use this library in a +* released product, please refer to the implementation of __do_get_rand32. **/ #include @@ -105,12 +108,12 @@ extern "C" int memset_s(void *s, size_t smax, int c, size_t n) #endif -// We are using this very non-random definition for reproducibility / debugging purposes. + static uint32_t seed = (uint32_t)(9); +// We are using this very non-random definition for reproducibility / debugging purposes. static inline sample_status_t __do_get_rand32(uint32_t* rand_num) { - // A better source of entropy would be the "time" function or something like that *rand_num = seed; return SAMPLE_SUCCESS; } diff --git a/sdk/sample_libcrypto/sample_libcrypto.h b/sdk/sample_libcrypto/sample_libcrypto.h index bd907cf9b9..4e4de19ce1 100644 --- a/sdk/sample_libcrypto/sample_libcrypto.h +++ b/sdk/sample_libcrypto/sample_libcrypto.h @@ -32,10 +32,12 @@ /** * File: sample_libcrypto.h * Description: -* Interface for generic crypto library APIs. This library does NOT have -* production quality crypto implementations. -* Some methods have been constructed to facilitate reproduceable results to -* aid in the debugging of the sample application. +* Interface for generic crypto library APIs. +* Do NOT use this library in your actual product. +* The purpose of this sample library is to aid the debugging of a +* remote attestation service. +* To achieve that goal, the sample remote attestation application +* will use this sample library to generate reproducible messages. */ #ifndef SAMPLE_LIBCRYPTO_H diff --git a/sdk/sign_tool/SignTool/manage_metadata.cpp b/sdk/sign_tool/SignTool/manage_metadata.cpp index 7ae747d4af..ed92ea9982 100644 --- a/sdk/sign_tool/SignTool/manage_metadata.cpp +++ b/sdk/sign_tool/SignTool/manage_metadata.cpp @@ -627,6 +627,13 @@ uint64_t CMetadata::calculate_sections_size() uint64_t size = (NULL == last_section) ? (0) : (last_section->get_rva() + last_section->virtual_size()); size = ROUND_TO_PAGE(size); + + + + if(size < ROUND_TO_PAGE(last_section->get_rva() + ROUND_TO_PAGE(last_section->virtual_size()))) + { + size += SE_PAGE_SIZE; + } return size; } diff --git a/sdk/sign_tool/SignTool/parse_key_file.cpp b/sdk/sign_tool/SignTool/parse_key_file.cpp index bc8aa45f0b..47a4982e76 100644 --- a/sdk/sign_tool/SignTool/parse_key_file.cpp +++ b/sdk/sign_tool/SignTool/parse_key_file.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,11 @@ //N_SIZE+E_SIZE+D_SIZE+P_SIZE+Q_SIZE+DMP1_SIZE+DMQ1_SIZE+sizeof(inverseQ) #define PRI_COMPONENTS_SIZE (N_SIZE_IN_BYTES + E_SIZE_IN_BYTES + D_SIZE_IN_BYTES + P_SIZE_IN_BYTES *5) #define PUB_CONPONENTS_SIZE (N_SIZE_IN_BYTES + E_SIZE_IN_BYTES) //N_SIZE+E_SIZE +#define SEQUENCE_TAG_VALUE 0x30 +#define INTEGER_TAG_VALUE 0x02 +#define BIT_STRING_TAG_VALUE 0x03 +#define NULL_TAG_VALUE 0x05 +#define OID_TAG_VALUE 0x06 #define CHECK_RETRUN(value) {if(0 == (value)) return 0;} @@ -69,7 +75,7 @@ //Return Value // int---The length of the decoded string static int base64_decode(const unsigned char* aSrc, size_t srcLen, unsigned char* result) -{ +{ //two reason will cause the function return 0: 1- The input parameters are wrong, 2- srcLen<4 static char index_64[256] = { 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, @@ -130,6 +136,89 @@ static void convert_string(unsigned char *str, int len) } } +static bool parse_tag_and_length(const unsigned char *begin, const unsigned char *end, uint8_t expect_tag, size_t *len_bytes, size_t *value_bytes) +{ + assert(NULL != begin && NULL != end && NULL != len_bytes && NULL != value_bytes); + if (begin[0] != expect_tag) + return false; + size_t tvb = 0, tlb = 0; // 'temporary value bytes' and 'temporary length bytes' + const unsigned char *lbegin = begin + 1; + if (!(lbegin[0] & 0x80)) + { + // Value bytes <= 127 + tvb = lbegin[0]; + tlb += 1; // length is only one bytes + } + else if (lbegin[0] == 0x81) + { + tlb += (lbegin[0] & 0x7F) + 1; // + 1byte Length + 1byte to contain the value bytes + if (tlb != 2) + return false; + tvb = lbegin[1]; + } + else if (lbegin[0] == 0x82) + { + tlb += (lbegin[0] & 0x7F) + 1; // + 1byte Length + 2bytes to contain the value bytes + if (tlb != 3) + return false; + tvb = (lbegin[1] << 8) + lbegin[2]; + } + else + { + // Only the 3072bits RSA key is acceptable, for which we only need 2bytes to store the value bytes. + // Therefore, return failure if the length of the value bytes is greater than 2bytes. + return false; + } + + if ((tlb < UINT_MAX - tvb) && (size_t)(lbegin + tvb + tlb) > tvb + tlb) + { + // In the input begin/end, the key_header/end has been removed. + // Therefore, we should not check the entire key length. + if (expect_tag != SEQUENCE_TAG_VALUE && lbegin + tvb + tlb > end) + return false; + else + { + *value_bytes = tvb; + *len_bytes = tlb + 1; // + size of tag + return true; + } + } + return false; +} + +static bool parse_tlv_integer(const unsigned char **begin, const unsigned char *end, unsigned int *values, size_t values_length) +{ + assert(NULL != begin && NULL != *begin && NULL != end && NULL != values && values_length > 0); + size_t value_bytes = 0, len_bytes = 0; + const unsigned char *psrc = *begin; + if (parse_tag_and_length(psrc, end, INTEGER_TAG_VALUE, &len_bytes, &value_bytes) == false) + return false; + psrc += len_bytes; + + if (value_bytes < values_length) + return false; + + else if (value_bytes > values_length) + { + for (unsigned int i = 0; i < value_bytes - values_length; i++) + { + if (*(psrc + i) != 0x00) + return false; + } + // There are some padding 0x00s which need to skip + psrc += value_bytes - values_length; + } + + if (values != NULL) + { + memcpy_s(values, values_length, psrc, values_length); + } + psrc += values_length; + *begin = psrc; + + return true; +} + static bool convert_from_pri_key(const unsigned char *psrc, unsigned int slen, rsa_params_t *rsa) { assert(NULL != psrc && NULL != rsa); @@ -138,119 +227,81 @@ static bool convert_from_pri_key(const unsigned char *psrc, unsigned int slen, r return false; } - int index = 0; - if((int)psrc[index]== 0x30 &&(int)psrc[index+1] == 0x82) - index += 4; - else if((int)psrc[index] == 0x30 && (int)psrc[index+1] == 0x81) - index += 3; - else - return false; - - if(!((int)psrc[index] == 0x02 && (int)psrc[index+1] == 0x01))// version number must be 0x0102 + size_t value_bytes = 0, len_bytes = 0; + const unsigned char *end = psrc + slen; + if (parse_tag_and_length(psrc, end, SEQUENCE_TAG_VALUE, &len_bytes, &value_bytes) == false) { return false; } - index += 2; - if((int)psrc[index] != 0x00) + psrc += len_bytes; + // Version + if (parse_tag_and_length(psrc, end, INTEGER_TAG_VALUE, &len_bytes, &value_bytes) == false) + { return false; - index += 6; + } + psrc += len_bytes; + if (value_bytes != 0x01 || *psrc != 0x00) // Version should be 0x00 + { + return false; + } + psrc += value_bytes; memset(rsa, 0, sizeof(rsa_params_t)); - //get the module - memcpy_s(rsa->n, sizeof(rsa->n), psrc+index, N_SIZE_IN_BYTES); + // N + if (parse_tlv_integer(&psrc, end, rsa->n, N_SIZE_IN_BYTES) == false) + { + return false; + } convert_string((unsigned char *)rsa->n, sizeof(rsa->n)); - //get EXPONENT - index += N_SIZE_IN_BYTES; - if(!((unsigned int)psrc[index] == 0x02 &&(unsigned int)psrc[index+1] == 0x01)) //"0x01" indicates the size of e is 1 byte + // E + if (parse_tlv_integer(&psrc, end, rsa->e, E_SIZE_IN_UINT) == false) + { + return false; + } + if (rsa->e[0] != 0x03) { se_trace(SE_TRACE_ERROR, "Only '3' is accepted as the Exponent value.\n"); return false; } - index += 2; - unsigned int temp = *(psrc+index); - if(temp != 0x03) - { - se_trace(SE_TRACE_ERROR, "Key Exponent is %#x. Only '3' is accepted as the Exponent value.\n", temp); - return false; - } - temp = temp&0x0f; - memcpy_s(rsa->e, sizeof(rsa->e), &temp, sizeof(unsigned int)); - //get D - index += 1; - if((unsigned int)psrc[index]!=0x02) + // D + if (parse_tlv_integer(&psrc, end, rsa->d, D_SIZE_IN_BYTES) == false) { return false; } - - index = index+4; - if((int)psrc[index] == 0) - index += 1; - memcpy_s(rsa->d, sizeof(rsa->d), psrc+index, D_SIZE_IN_BYTES); convert_string((unsigned char *)rsa->d, sizeof(rsa->d)); - //get P - index += D_SIZE_IN_BYTES; - if((unsigned int)psrc[index]!=0x02) + // P + if (parse_tlv_integer(&psrc, end, rsa->p, P_SIZE_IN_BYTES) == false) { return false; } - index = index+4; - if((int)psrc[index] == 0) - index += 1; - memcpy_s(rsa->p, sizeof(rsa->p), psrc+index, P_SIZE_IN_BYTES); convert_string((unsigned char *)rsa->p, sizeof(rsa->p)); - - //get Q - index += P_SIZE_IN_BYTES; - if((unsigned int)psrc[index]!=0x02) + // Q + if (parse_tlv_integer(&psrc, end, rsa->q, Q_SIZE_IN_BYTES) == false) { return false; } - - index = index+4; - if((int)psrc[index] == 0) - index += 1; - memcpy_s(rsa->q, sizeof(rsa->q), psrc+index, Q_SIZE_IN_BYTES); convert_string((unsigned char *)rsa->q, sizeof(rsa->q)); - - //get DMP1 - index += Q_SIZE_IN_BYTES; - if((unsigned int)psrc[index]!=0x02) + // DMP1 + if (parse_tlv_integer(&psrc, end, rsa->dmp1, DMP1_SIZE_IN_BYTES) == false) { return false; } - index += 4; - if((int)psrc[index] == 0) - index += 1; - memcpy_s(rsa->dmp1, sizeof(rsa->dmp1), psrc+index, DMP1_SIZE_IN_BYTES); convert_string((unsigned char *)rsa->dmp1, sizeof(rsa->dmp1)); - - //get DMQ1 - index += DMP1_SIZE_IN_BYTES; - if((unsigned int)psrc[index]!=0x02) + // DMQ1 + if (parse_tlv_integer(&psrc, end, rsa->dmq1, DMQ1_SIZE_IN_BYTES) == false) { return false; } - index += 4; - if((int)psrc[index] == 0) - index += 1; - memcpy_s(rsa->dmq1, sizeof(rsa->dmq1), psrc+index, DMQ1_SIZE_IN_BYTES); convert_string((unsigned char *)rsa->dmq1, sizeof(rsa->dmq1)); - - //get IQMP - index += DMQ1_SIZE_IN_BYTES; - if((unsigned int)psrc[index]!=0x02) + // IQMP + if (parse_tlv_integer(&psrc, end, rsa->iqmp, IQMP_SIZE_IN_BYTES) == false) { return false; } - index += 3; - if((int)psrc[index] == 0) - index += 1; - memcpy_s(rsa->iqmp, sizeof(rsa->iqmp), psrc+index, IQMP_SIZE_IN_BYTES); convert_string((unsigned char *)rsa->iqmp, sizeof(rsa->iqmp)); - return true; } @@ -261,73 +312,58 @@ static bool convert_from_pub_key(const unsigned char *psrc, unsigned int slen, { return false; } - //encoded OID sequence (OBJECT IDENTIFIER = 1.2.840.113549.1.1.1) - unsigned char OID_str[] = {0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00}; - size_t index = 0; - if((unsigned int)psrc[index]==0x30 && (unsigned int)psrc[index+1] == 0x82) - index += 4; - else if((unsigned int)psrc[index]==0x30 && (unsigned int)psrc[index+1] == 0x81) - index += 3; - else - return false; - unsigned int i=0; - for(; in, sizeof(rsa->n), psrc+index, N_SIZE_IN_BYTES); + // N + if (parse_tlv_integer(&psrc, end, rsa->n, N_SIZE_IN_BYTES) == false) + { + return false; + } convert_string((unsigned char *)rsa->n, sizeof(rsa->n)); - - //get EXPONENT - index += N_SIZE_IN_BYTES; - if(!((unsigned int)psrc[index] == 0x02 &&(unsigned int)psrc[index+1] == 0x01)) //"0x01" indicates the size of e is 1 byte + // E + if (parse_tlv_integer(&psrc, end, rsa->e, E_SIZE_IN_UINT) == false) + { + return false; + } + if (rsa->e[0] != 0x03) { se_trace(SE_TRACE_ERROR, "Only '3' is accepted as the Exponent value.\n"); return false; } - index += 2; - unsigned int temp = *(psrc+index); - if(temp != 0x03) - { - se_trace(SE_TRACE_ERROR, "Key Exponent is %#x. Only '3' is accepted as the Exponent value.\n", temp); - return false; - } - temp = temp&0x0f; - memcpy_s(rsa->e, sizeof(rsa->e), &temp, sizeof(unsigned int)); return true; } diff --git a/sdk/simulation/uae_service_sim/linux/Makefile b/sdk/simulation/uae_service_sim/linux/Makefile index 24d931f4e7..e63bbc6319 100644 --- a/sdk/simulation/uae_service_sim/linux/Makefile +++ b/sdk/simulation/uae_service_sim/linux/Makefile @@ -104,7 +104,7 @@ else endif $(LIBUAE_SERVICE_DEPLOY): ../uae_service_deploy.c - $(CC) -shared -Wl,-soname=libsgx_uae_service.so $< -o $@ + $(CC) -fPIC -shared -Wl,-soname=libsgx_uae_service.so $< -o $@ $(BUILD_DIR): @$(MKDIR) $@ diff --git a/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version b/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version index c31c0ded9d..a6273130a4 100644 --- a/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version +++ b/sdk/simulation/uae_service_sim/linux/uae_service_sim.linux.version @@ -10,6 +10,7 @@ global: exchange_report_ocall; close_session_ocall; invoke_service_ocall; + sgx_get_extended_epid_group_id; local: *; }; diff --git a/sdk/simulation/uae_service_sim/quoting_sim.cpp b/sdk/simulation/uae_service_sim/quoting_sim.cpp index 0a918fefb9..e400988e06 100644 --- a/sdk/simulation/uae_service_sim/quoting_sim.cpp +++ b/sdk/simulation/uae_service_sim/quoting_sim.cpp @@ -460,3 +460,25 @@ sgx_status_t SGXAPI sgx_report_attestation_status( return SGX_SUCCESS; } +sgx_status_t SGXAPI sgx_get_extended_epid_group_id(uint32_t* p_extended_epid_group_id) +{ + *p_extended_epid_group_id = 0; + return SGX_SUCCESS; +} + +sgx_status_t SGXAPI sgx_get_whitelist_size(uint32_t* p_whitelist_size) +{ + *p_whitelist_size = 0; + return SGX_SUCCESS; +} + +sgx_status_t SGXAPI sgx_get_whitelist(uint8_t* p_whitelist, uint32_t whitelist_size) +{ + UNUSED(p_whitelist); + if(whitelist_size!=0){ + return SGX_ERROR_INVALID_PARAMETER; + }else{ + return SGX_SUCCESS; + } +} + diff --git a/sdk/simulation/uae_service_sim/uae_service_deploy.c b/sdk/simulation/uae_service_sim/uae_service_deploy.c index ddb7b05e54..b14e64da80 100644 --- a/sdk/simulation/uae_service_sim/uae_service_deploy.c +++ b/sdk/simulation/uae_service_sim/uae_service_deploy.c @@ -33,10 +33,14 @@ void Java_com_voidel_security_sgx_uae_SGX_1AEServices_initializeNativeAEServices void sgx_get_quote(){} void sgx_get_quote_size(){} void sgx_init_quote(){} +void sgx_get_whitelist_size(){} +void sgx_get_whitelist(){} +void sgx_switch_extended_epid_group(){} +void sgx_get_extended_epid_group_id(){} void get_launch_token(){} void close_session_ocall(){} void create_session_ocall(){} void exchange_report_ocall(){} void invoke_service_ocall(){} -void sgx_report_remote_attestation_failure(){} +void sgx_report_attestation_status(){} void sgx_get_ps_cap(){} diff --git a/sdk/tkey_exchange/tkey_exchange.cpp b/sdk/tkey_exchange/tkey_exchange.cpp index 32681d263d..925e01cb65 100644 --- a/sdk/tkey_exchange/tkey_exchange.cpp +++ b/sdk/tkey_exchange/tkey_exchange.cpp @@ -77,12 +77,16 @@ typedef struct _ra_db_item_t sgx_target_info_t qe_target; //to verify quote report ra_state state; sgx_spinlock_t item_lock; + uintptr_t derive_key_cb; }ra_db_item_t; #pragma pack(pop) static simple_vector g_ra_db = {0, 0, NULL}; -static sgx_spinlock_t g_ra_db_lock; +static sgx_spinlock_t g_ra_db_lock = SGX_SPINLOCK_INITIALIZER; +static uintptr_t g_kdf_cookie = 0; +#define ENC_KDF_POINTER(x) (uintptr_t)(x) ^ g_kdf_cookie +#define DEC_KDF_POINTER(x) (sgx_ra_derive_secret_keys_t)((x) ^ g_kdf_cookie) extern "C" sgx_status_t sgx_ra_get_ga( sgx_ra_context_t context, @@ -166,6 +170,12 @@ extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( // Create gb_ga sgx_ec256_public_t gb_ga[2]; sgx_ec256_public_t sp_pubkey; + sgx_ec_key_128bit_t smkey = {0}; + sgx_ec_key_128bit_t skey = {0}; + sgx_ec_key_128bit_t mkey = {0}; + sgx_ec_key_128bit_t vkey = {0}; + sgx_ra_derive_secret_keys_t ra_key_cb = NULL; + memset(&gb_ga[0], 0, sizeof(gb_ga)); sgx_spin_lock(&item->item_lock); //sgx_ra_get_ga must have been called @@ -177,6 +187,7 @@ extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( memcpy(&a, &item->a, sizeof(a)); memcpy(&gb_ga[1], &item->g_a, sizeof(gb_ga[1])); memcpy(&sp_pubkey, &item->sp_pubkey, sizeof(sp_pubkey)); + ra_key_cb = DEC_KDF_POINTER(item->derive_key_cb); sgx_spin_unlock(&item->item_lock); memcpy(&gb_ga[0], &p_msg2->g_b, sizeof(gb_ga[0])); @@ -196,7 +207,7 @@ extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( sgx_ec256_public_t* p_msg2_g_b = const_cast(&p_msg2->g_b); se_ret = sgx_ecc256_compute_shared_dhkey(&a, (sgx_ec256_public_t*)p_msg2_g_b, - (sgx_ec256_dh_shared_t*)&dh_key, ecc_state); + &dh_key, ecc_state); if(SGX_SUCCESS != se_ret) { if (SGX_ERROR_OUT_OF_MEMORY != se_ret) @@ -223,13 +234,27 @@ extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( sgx_ecc256_close_context(ecc_state); return SGX_ERROR_INVALID_SIGNATURE; } - sgx_ec_key_128bit_t smkey = {0}; - sgx_ec_key_128bit_t skey = {0}; - sgx_ec_key_128bit_t mkey = {0}; - sgx_ec_key_128bit_t vkey = {0}; + do { - if (p_msg2->kdf_id == 0x0001) + if(NULL != ra_key_cb) + { + se_ret = ra_key_cb(&dh_key, + p_msg2->kdf_id, + &smkey, + &skey, + &mkey, + &vkey); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret && + SGX_ERROR_INVALID_PARAMETER != se_ret && + SGX_ERROR_KDF_MISMATCH != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + } + else if (p_msg2->kdf_id == 0x0001) { se_ret = derive_key(&dh_key, "SMK", (uint32_t)(sizeof("SMK") -1), &smkey); if (SGX_SUCCESS != se_ret) @@ -238,44 +263,27 @@ extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( se_ret = SGX_ERROR_UNEXPECTED; break; } - - sgx_cmac_128bit_tag_t mac; - uint32_t maced_size = offsetof(sgx_ra_msg2_t, mac); - - se_ret = sgx_rijndael128_cmac_msg(&smkey, (const uint8_t *)p_msg2, maced_size, &mac); + se_ret = derive_key(&dh_key, "SK", (uint32_t)(sizeof("SK") -1), &skey); if (SGX_SUCCESS != se_ret) { if(SGX_ERROR_OUT_OF_MEMORY != se_ret) se_ret = SGX_ERROR_UNEXPECTED; break; } - //Check mac - if(0 == consttime_memequal(mac, p_msg2->mac, sizeof(mac))) - { - se_ret = SGX_ERROR_MAC_MISMATCH; - break; - } - se_ret = derive_key((sgx_ec256_dh_shared_t*)&dh_key, "SK", (uint32_t )(sizeof("SK") -1), &skey); - if (SGX_SUCCESS != se_ret) - { - if(SGX_ERROR_OUT_OF_MEMORY != se_ret) - se_ret = SGX_ERROR_UNEXPECTED; - break; - } - - se_ret = derive_key((sgx_ec256_dh_shared_t*)&dh_key, "MK", (uint32_t)(sizeof("MK") -1), &mkey); - if (SGX_SUCCESS != se_ret) - { - if(SGX_ERROR_OUT_OF_MEMORY != se_ret) - se_ret = SGX_ERROR_UNEXPECTED; - break; - } - - se_ret = derive_key((sgx_ec256_dh_shared_t*)&dh_key, "VK", (uint32_t)(sizeof("VK") -1), &vkey); + se_ret = derive_key(&dh_key, "MK", (uint32_t)(sizeof("MK") -1), &mkey); if (SGX_SUCCESS != se_ret) { if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + + se_ret = derive_key(&dh_key, "VK", (uint32_t)(sizeof("VK") -1), &vkey); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; break; } } @@ -285,7 +293,24 @@ extern "C" sgx_status_t sgx_ra_proc_msg2_trusted( break; } - //create a random nonce + sgx_cmac_128bit_tag_t mac; + uint32_t maced_size = offsetof(sgx_ra_msg2_t, mac); + + se_ret = sgx_rijndael128_cmac_msg(&smkey, (const uint8_t *)p_msg2, maced_size, &mac); + if (SGX_SUCCESS != se_ret) + { + if(SGX_ERROR_OUT_OF_MEMORY != se_ret) + se_ret = SGX_ERROR_UNEXPECTED; + break; + } + //Check mac + if(0 == consttime_memequal(mac, p_msg2->mac, sizeof(mac))) + { + se_ret = SGX_ERROR_MAC_MISMATCH; + break; + } + + //create a nonce se_ret =sgx_read_rand((uint8_t*)p_nonce, sizeof(sgx_quote_nonce_t)); if (SGX_SUCCESS != se_ret) { @@ -473,7 +498,7 @@ extern "C" sgx_status_t sgx_ra_get_msg3_trusted( while (emp_quote_piecemeal < emp_msg3->quote + quote_size) { - //caculate size of one piece, the size of them are sizeof(quote_piece) except for the last one. + //calculate size of one piece, the size of them are sizeof(quote_piece) except for the last one. if (static_cast(emp_msg3->quote + quote_size - emp_quote_piecemeal) < quote_piece_size) quote_piece_size = static_cast(emp_msg3->quote - emp_quote_piecemeal) + quote_size ; memcpy(quote_piece, emp_quote_piecemeal, quote_piece_size); @@ -536,21 +561,49 @@ extern "C" sgx_status_t sgx_ra_get_msg3_trusted( } // TKE interface for isv enclaves -sgx_status_t sgx_ra_init( +sgx_status_t sgx_ra_init_ex( const sgx_ec256_public_t *p_pub_key, int b_pse, + sgx_ra_derive_secret_keys_t derive_key_cb, sgx_ra_context_t *p_context) { int valid = 0; sgx_status_t ret = SGX_SUCCESS; sgx_ecc_state_handle_t ecc_state = NULL; + // initialize g_kdf_cookie for the first time sgx_ra_init_ex is called. + if (unlikely(g_kdf_cookie == 0)) + { + uintptr_t rand = 0; + do + { + if (SGX_SUCCESS != sgx_read_rand((unsigned char *)&rand, sizeof(rand))) + { + return SGX_ERROR_UNEXPECTED; + } + } while (rand == 0); + + sgx_spin_lock(&g_ra_db_lock); + if (g_kdf_cookie == 0) + { + g_kdf_cookie = rand; + } + sgx_spin_unlock(&g_ra_db_lock); + } + if(!p_pub_key || !p_context) return SGX_ERROR_INVALID_PARAMETER; if(!sgx_is_within_enclave(p_pub_key, sizeof(sgx_ec256_public_t))) return SGX_ERROR_INVALID_PARAMETER; + //derive_key_cb can be NULL + if (NULL != derive_key_cb && + !sgx_is_within_enclave((const void*)derive_key_cb, 0)) + { + return SGX_ERROR_INVALID_PARAMETER; + } + ret = sgx_ecc256_open_context(&ecc_state); if(SGX_SUCCESS != ret) { @@ -593,6 +646,8 @@ sgx_status_t sgx_ra_init( return ret; } } + + new_item->derive_key_cb = ENC_KDF_POINTER(derive_key_cb); new_item->state = ra_inited; //find first empty slot in g_ra_db @@ -644,6 +699,19 @@ sgx_status_t sgx_ra_init( return SGX_SUCCESS; } +// TKE interface for isv enclaves +sgx_status_t sgx_ra_init( + const sgx_ec256_public_t *p_pub_key, + int b_pse, + sgx_ra_context_t *p_context) +{ + + return sgx_ra_init_ex(p_pub_key, + b_pse, + NULL, + p_context); +} + // TKE interface for isv enclaves sgx_status_t sgx_ra_get_keys( sgx_ra_context_t context, diff --git a/sdk/tlibc/Makefile b/sdk/tlibc/Makefile index bada08a704..e3d2ff0d6b 100644 --- a/sdk/tlibc/Makefile +++ b/sdk/tlibc/Makefile @@ -43,7 +43,7 @@ CPPFLAGS += -I. \ -I$(LINUX_SDK_DIR)/trts \ -I./gdtoa \ -LIBC_C_SRCS := $(wildcard gen/*.c gdtoa/*.c locale/*.c math/*.c stdlib/*.c string/*.c stdio/*.c time/*.c) +LIBC_C_SRCS := $(wildcard gen/*.c gdtoa/*.c locale/*.c stdlib/*.c string/*.c stdio/*.c time/*.c) LIBC_CPP_SRCS := $(wildcard gen/*.cpp) tstdc_version.cpp LIBC_ASM_SRCS := $(wildcard gen/*.S) diff --git a/sdk/tlibc/math/w_drem.c b/sdk/tlibc/math/w_drem.c deleted file mode 100644 index 5038f5c409..0000000000 --- a/sdk/tlibc/math/w_drem.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * drem() wrapper for remainder(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include - -double -drem(double x, double y) -{ - return remainder(x, y); -} diff --git a/sdk/tlibc/math/w_dremf.c b/sdk/tlibc/math/w_dremf.c deleted file mode 100644 index f14d98f840..0000000000 --- a/sdk/tlibc/math/w_dremf.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * dremf() wrapper for remainderf(). - * - * Written by J.T. Conklin, - * Placed into the Public Domain, 1994. - */ - -#include "math.h" - -float -dremf(float x, float y) -{ - return remainderf(x, y); -} diff --git a/sdk/tlibc/string/bcopy.c b/sdk/tlibc/string/bcopy.c index d9195c1fdf..406f2c135e 100644 --- a/sdk/tlibc/string/bcopy.c +++ b/sdk/tlibc/string/bcopy.c @@ -42,16 +42,25 @@ typedef long word; /* "word" used for optimal copy speed */ #define wsize sizeof(word) #define wmask (wsize - 1) +#ifdef MEMPCPY +void * +mempcpy(void *dst0, const void *src0, size_t length) +#else /* * Copy a block of memory, handling overlap. */ void bcopy(const void *src0, void *dst0, size_t length) +#endif { - char *dst = dst0; - const char *src = src0; + char *dst = (char *)dst0; + const char *src = (const char *)src0; size_t t; +#ifdef MEMPCPY + size_t len = length; +#endif + if (length == 0 || dst == src) /* nothing to do */ goto done; @@ -108,5 +117,9 @@ bcopy(const void *src0, void *dst0, size_t length) TLOOP(*--dst = *--src); } done: +#if defined(MEMPCPY) + return ((void *)(((char *)dst0) + len)); +#else return; +#endif } diff --git a/sdk/tlibc/string/mempcpy.c b/sdk/tlibc/string/mempcpy.c index 6d2568630f..a51b85af64 100644 --- a/sdk/tlibc/string/mempcpy.c +++ b/sdk/tlibc/string/mempcpy.c @@ -1,2 +1,2 @@ #define MEMPCPY -#include "./memcpy.c" +#include "./bcopy.c" diff --git a/sdk/tlibthread/sethread_utils.cpp b/sdk/tlibthread/sethread_utils.cpp index 7b2d3918c1..644407701c 100644 --- a/sdk/tlibthread/sethread_utils.cpp +++ b/sdk/tlibthread/sethread_utils.cpp @@ -42,3 +42,7 @@ sgx_thread_t sgx_thread_self(void) return (sgx_thread_t)get_thread_data(); } +int sgx_thread_equal(sgx_thread_t a, sgx_thread_t b) +{ + return a == b; +} diff --git a/sdk/trts/linux/trts_pic.S b/sdk/trts/linux/trts_pic.S index af47e443ab..f11e1dbbe8 100644 --- a/sdk/trts/linux/trts_pic.S +++ b/sdk/trts/linux/trts_pic.S @@ -476,14 +476,14 @@ DECLARE_LOCAL_FUNC continue_execution mov SE_WORDSIZE*6(%xcx), %xsi mov SE_WORDSIZE*7(%xcx), %xdi #ifdef LINUX64 - mov SE_WORDSIZE*8(%xcx), %xsi - mov SE_WORDSIZE*9(%xcx), %xsi - mov SE_WORDSIZE*10(%xcx), %xsi - mov SE_WORDSIZE*11(%xcx), %xsi - mov SE_WORDSIZE*12(%xcx), %xsi - mov SE_WORDSIZE*13(%xcx), %xsi - mov SE_WORDSIZE*14(%xcx), %xsi - mov SE_WORDSIZE*15(%xcx), %xsi + mov SE_WORDSIZE*8(%xcx), %r8 + mov SE_WORDSIZE*9(%xcx), %r9 + mov SE_WORDSIZE*10(%xcx), %r10 + mov SE_WORDSIZE*11(%xcx), %r11 + mov SE_WORDSIZE*12(%xcx), %r12 + mov SE_WORDSIZE*13(%xcx), %r13 + mov SE_WORDSIZE*14(%xcx), %r14 + mov SE_WORDSIZE*15(%xcx), %r15 push SE_WORDSIZE*16(%xcx) popf #else diff --git a/sdk/trts/trts_veh.cpp b/sdk/trts/trts_veh.cpp index c338d82c9d..cc5f4fbf07 100644 --- a/sdk/trts/trts_veh.cpp +++ b/sdk/trts/trts_veh.cpp @@ -63,9 +63,9 @@ static bool is_stack_addr(void *address, size_t size) { thread_data_t *thread_data = get_thread_data(); size_t stack_base = thread_data->stack_base_addr; - size_t stack_top = thread_data->stack_limit_addr; + size_t stack_limit = thread_data->stack_limit_addr; size_t addr = (size_t) address; - return (addr <= (addr + size)) && (stack_base >= (addr + size)) && (stack_top <= addr); + return (addr <= (addr + size)) && (stack_base >= (addr + size)) && (stack_limit <= addr); } static bool is_valid_sp(uintptr_t sp) { @@ -219,7 +219,19 @@ extern "C" __attribute__((regparm(1))) void internal_handle_exception(sgx_except node = node->next; } - if (size == 0 || (nhead = (uintptr_t *)malloc(size)) == NULL) + // There's no exception handler registered + if (size == 0) + { + sgx_spin_unlock(&g_handler_lock); + + //exception cannot be handled + thread_data->exception_flag = -1; + + //instruction triggering the exception will be executed again. + continue_execution(info); + } + + if ((nhead = (uintptr_t *)malloc(size)) == NULL) { sgx_spin_unlock(&g_handler_lock); goto failed_end; @@ -324,7 +336,8 @@ extern "C" sgx_status_t trts_handle_exception(void *tcs) size = 0; #ifdef SE_GNU64 - size += 128; // preserve stack for red zone (128 bytes) + size += 128; // x86_64 requires a 128-bytes red zone, which begins directly + // after the return addr and includes func's arguments #endif // decrease the stack to give space for info diff --git a/sdk/tsetjmp/Makefile b/sdk/tsetjmp/Makefile new file mode 100644 index 0000000000..907d7bd2b3 --- /dev/null +++ b/sdk/tsetjmp/Makefile @@ -0,0 +1,69 @@ +# +# Copyright (C) 2011-2016 Intel Corporation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# + +include ../../buildenv.mk + +CFLAGS += $(ENCLAVE_CFLAGS) +ASFLAGS := $(CFLAGS) +CFLAGS += -std=c99 +CXXFLAGS += $(ENCLAVE_CXXFLAGS) -fno-exceptions -fno-rtti -D_TLIBC_USE_INTEL_FAST_STRING_ + +CPPFLAGS += -I. \ + -I$(COMMON_DIR)/inc/internal \ + -I$(COMMON_DIR)/inc/internal/linux \ + +LIBLONGJMP_CPP_SRCS := tlongjmp_version.cpp +LIBLONGJMP_ASM_SRCS := $(wildcard *.S) + +LIBLONGJMP_OBJS := $(LIBLONGJMP_ASM_SRCS:.S=.o) +LIBLONGJMP_OBJS += $(LIBLONGJMP_CPP_SRCS:.cpp=.o) + +LIBLONGJMP_NAME := libsgx_tsetjmp.a + +.PHONY: all +all: $(LIBLONGJMP_NAME) | $(BUILD_DIR) + $(CP) $(LIBLONGJMP_NAME) $| + +$(LIBLONGJMP_NAME): $(LIBLONGJMP_OBJS) + $(AR) rcs $@ $^ + +%.o: %.cpp + $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ + +%.o: %.S + $(CC) $(ASFLAGS) $(CPPFLAGS) -c $< -o $@ + +$(BUILD_DIR): + @$(MKDIR) $@ + +.PHONY: clean +clean: + @$(RM) $(LIBLONGJMP_NAME) $(LIBLONGJMP_OBJS) $(BUILD_DIR)/$(LIBLONGJMP_NAME) diff --git a/sdk/tsetjmp/_setjmp.S b/sdk/tsetjmp/_setjmp.S new file mode 100644 index 0000000000..09eb712b0d --- /dev/null +++ b/sdk/tsetjmp/_setjmp.S @@ -0,0 +1,131 @@ +/* $NetBSD: _setjmp.S,v 1.9 2014/05/23 02:34:19 uebayasi Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: @(#)_setjmp.s 5.1 (Berkeley) 4/23/90 + */ + +#include "linux-regs.h" +#if defined(LIBC_SCCS) + RCSID("$NetBSD: _setjmp.S,v 1.9 2014/05/23 02:34:19 uebayasi Exp $") +#endif + +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v)" from the last call to + * _setjmp(a) + * by restoring registers from the stack. + * The previous signal state is NOT restored. + */ + +#ifdef LINUX32 +#define _JB_EDX 0 +#define _JB_EBX 1 +#define _JB_ESP 2 +#define _JB_EBP 3 +#define _JB_ESI 4 +#define _JB_EDI 5 +#define MOV movl +#endif + +#ifdef LINUX64 +#define _JB_RBX 0 +#define _JB_RBP 1 +#define _JB_R12 2 +#define _JB_R13 3 +#define _JB_R14 4 +#define _JB_R15 5 +#define _JB_RSP 6 +#define _JB_PC 7 +#define MOV movq +#endif + +DECLARE_GLOBAL_FUNC _setjmp +#ifdef LINUX32 + movl 4(%esp),%eax + movl 0(%esp),%edx + movl %edx, (_JB_EDX * 4)(%eax) /* rta */ + movl %ebx, (_JB_EBX * 4)(%eax) + movl %esp, (_JB_ESP * 4)(%eax) + movl %ebp, (_JB_EBP * 4)(%eax) + movl %esi, (_JB_ESI * 4)(%eax) + movl %edi, (_JB_EDI * 4)(%eax) +#endif +#ifdef LINUX64 + movq (%rsp),%r11 + movq %rbx,(_JB_RBX * 8)(%rdi) + movq %rbp,(_JB_RBP * 8)(%rdi) + movq %r12,(_JB_R12 * 8)(%rdi) + movq %r13,(_JB_R13 * 8)(%rdi) + movq %r14,(_JB_R14 * 8)(%rdi) + movq %r15,(_JB_R15 * 8)(%rdi) + movq %rsp,(_JB_RSP * 8)(%rdi) + movq %r11,(_JB_PC * 8)(%rdi) +#endif + xorl %eax,%eax + ret + +DECLARE_GLOBAL_FUNC _longjmp +#ifdef LINUX32 + movl 4(%esp),%edx + movl 8(%esp),%eax + movl (_JB_EDX * 4)(%edx),%ecx + movl (_JB_EBX * 4)(%edx),%ebx + movl (_JB_ESP * 4)(%edx),%esp + movl (_JB_EBP * 4)(%edx),%ebp + movl (_JB_ESI * 4)(%edx),%esi + movl (_JB_EDI * 4)(%edx),%edi +#endif +#ifdef LINUX64 + movl %esi,%eax + movq (_JB_RBX * 8)(%rdi),%rbx + movq (_JB_RBP * 8)(%rdi),%rbp + movq (_JB_R12 * 8)(%rdi),%r12 + movq (_JB_R13 * 8)(%rdi),%r13 + movq (_JB_R14 * 8)(%rdi),%r14 + movq (_JB_R15 * 8)(%rdi),%r15 + movq (_JB_RSP * 8)(%rdi),%rsp + movq (_JB_PC * 8)(%rdi),%rcx + +#endif + testl %eax,%eax + jnz 1f + incl %eax +1: MOV %xcx,0(%xsp) + ret + +DECLARE_GLOBAL_FUNC set_sgx_tlongjmp_version + lea_pic sgx_tsetjmp_version, %xax + ret + diff --git a/sdk/tlibc/math/w_dreml.c b/sdk/tsetjmp/tlongjmp_version.cpp similarity index 84% rename from sdk/tlibc/math/w_dreml.c rename to sdk/tsetjmp/tlongjmp_version.cpp index 5537f164cd..c521781add 100644 --- a/sdk/tlibc/math/w_dreml.c +++ b/sdk/tsetjmp/tlongjmp_version.cpp @@ -29,14 +29,17 @@ * */ -#include -#include +#include "se_version.h" -#if (LDBL_MANT_DIG > DBL_MANT_DIG) +#define __CONCAT(x, y) x/**/y -long double dreml(long double x, long double y) -{ - return remainderl(x, y); -} +#define SGX_TSETJMP_VERSION_STR __CONCAT("SGX_TSETJMP_VERSION_", STRFILEVER) +#ifdef __cplusplus +extern "C" { +#endif +__attribute__((visibility("default"))) +const char * sgx_tsetjmp_version = SGX_TSETJMP_VERSION_STR; +#ifdef __cplusplus +} #endif From ed437b5ea16eb1b6b923755020d9e61292b54a48 Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Tue, 20 Sep 2016 10:35:02 -0700 Subject: [PATCH 15/33] Set misc_attr for failing _create_enclave flows Set misc_attr in the top level sgx_create_enclave if _create_enclave fails. This provides the user with the platform's capabilities when sgx_create_enclave fails for any reason other than a parameter error. Previously the misc_attr was only set upon failure if build_image failed, which was not helpful when sgx_create_enclave failed due to an attribute error, e.g. misc_select, as the flow aborted before it reached build_image. Signed-off-by: Sean Christopherson --- psw/urts/linux/urts.cpp | 8 ++++++++ psw/urts/loader.cpp | 12 +----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/psw/urts/linux/urts.cpp b/psw/urts/linux/urts.cpp index 4c2af4c365..f82c803c87 100644 --- a/psw/urts/linux/urts.cpp +++ b/psw/urts/linux/urts.cpp @@ -58,6 +58,14 @@ extern "C" sgx_status_t sgx_create_enclave(const char *file_name, const int debu file.name_len = (uint32_t)strlen(resolved_path); ret = _create_enclave(!!debug, fd, file, NULL, launch_token, launch_token_updated, enclave_id, misc_attr); + if(SGX_SUCCESS != ret && misc_attr) + { + sgx_misc_attribute_t plat_cap; + memset(&plat_cap, 0, sizeof(plat_cap)); + get_enclave_creator()->get_plat_cap(&plat_cap); + memcpy_s(misc_attr, sizeof(sgx_misc_attribute_t), &plat_cap, sizeof(sgx_misc_attribute_t)); + } + close(fd); return ret; diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index ba1e2f4f2f..187937131d 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -641,7 +641,7 @@ int CLoader::load_enclave(SGXLaunchToken *lc, int debug, const metadata_t *metad } ret = build_image(lc, &sgx_misc_attr.secs_attr, prd_css_file, &sgx_misc_attr); - //return platform capability if fail. Otherwise, return secs.attr. + //Update misc_attr with secs.attr upon success. if(SGX_SUCCESS == ret) { if(misc_attr) @@ -651,16 +651,6 @@ int CLoader::load_enclave(SGXLaunchToken *lc, int debug, const metadata_t *metad misc_attr->secs_attr.flags |= SGX_FLAGS_INITTED; } } - else - { - if(misc_attr) - { - sgx_misc_attribute_t plat_cap; - memset(&plat_cap, 0, sizeof(plat_cap)); - get_enclave_creator()->get_plat_cap(&plat_cap); - memcpy_s(misc_attr, sizeof(sgx_misc_attribute_t), &plat_cap, sizeof(sgx_misc_attribute_t)); - } - } return ret; } From 14c19edaafdd70ab090c1f161a77589d8b9365c3 Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Mon, 26 Sep 2016 08:29:33 -0700 Subject: [PATCH 16/33] Clean up build_sections and build_mem_region code Modify build_mem_region to support an unaligned starting address. This makes it symmetrical with regard to starting and ending partial pages; previously, build_mem_region only support partial pages at the end of a section (caller was responsible for handling the first page). Remove the edge case handling of the first page from build_sections now that build_mem_region does not have alignment restrictions. Change the section_info_t parameter in build_mem_region to be a const reference to eliminate any need to check for a null pointer. Make the raw_data pointer in section_info_t const, as the source file's data should never be modified. This is currently cast away via GET_PTR in build_pages when calling into add_enclave_page; the add_enclave_page flow can be modified by a future commit to retain the const modifier. Add two utilities, is_relocation_page and build_partial_page, to reduce copy-paste code. Add PAGE_OFFSET macro to calculate the offset within a page. Assert on address/size alignment in build_pages and build_context to document expected alignment and catch any related code bugs. Signed-off-by: Sean Christopherson --- common/inc/internal/util.h | 1 + psw/urts/loader.cpp | 175 ++++++++++++++++--------------------- psw/urts/loader.h | 6 +- psw/urts/section_info.h | 2 +- 4 files changed, 82 insertions(+), 102 deletions(-) diff --git a/common/inc/internal/util.h b/common/inc/internal/util.h index d26b2d9d10..ce066ec32a 100644 --- a/common/inc/internal/util.h +++ b/common/inc/internal/util.h @@ -58,6 +58,7 @@ #define ROUND_TO(x, align) (((x) + ((align)-1)) & ~((align)-1)) #define ROUND_TO_PAGE(x) ROUND_TO(x, SE_PAGE_SIZE) #define TRIM_TO_PAGE(x) ((x) & ~(SE_PAGE_SIZE-1)) +#define PAGE_OFFSET(x) ((x) & (SE_PAGE_SIZE -1)) #ifdef __cplusplus #define PAGE_ALIGN(t, x) reinterpret_cast((reinterpret_cast(x)+(SE_PAGE_SIZE-1)) & (~(SE_PAGE_SIZE-1))) #else diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index ba1e2f4f2f..4bf76da282 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -101,76 +101,50 @@ void* CLoader::get_symbol_address(const char * const symbol) return GET_PTR(void, m_start_addr, rva); } -int CLoader::build_mem_region(const section_info_t * const sec_info) +int CLoader::build_mem_region(const section_info_t &sec_info) { int ret = SGX_SUCCESS; - uint8_t added_page[SE_PAGE_SIZE]; uint64_t offset = 0; - uint8_t *raw_ptr = NULL; - uint64_t rva = 0; sec_info_t sinfo; memset(&sinfo, 0, sizeof(sinfo)); - rva = sec_info->rva + offset; - while(offset < TRIM_TO_PAGE(sec_info->raw_data_size)) + // Build pages of the section that are contain initialized data. Each page + // needs to be added individually as the page may hold relocation data, in + // which case the page needs to be marked writable. + while(offset < sec_info.raw_data_size) { - raw_ptr = sec_info->raw_data + offset; - sinfo.flags = sec_info->flag; + uint64_t rva = sec_info.rva + offset; + uint64_t size = MIN((SE_PAGE_SIZE - PAGE_OFFSET(rva)), (sec_info.raw_data_size - offset)); - //check if the page is writable. - if(sec_info->bitmap && sec_info->bitmap->size()) - { - uint64_t page_frame = rva >> SE_PAGE_SHIFT; + sinfo.flags = sec_info.flag; + if (is_relocation_page(rva, sec_info.bitmap)) + sinfo.flags = sec_info.flag | SI_FLAG_W; - //NOTE: - // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. - // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. - // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) - if((*sec_info->bitmap)[(size_t)(page_frame / 8)] & (1 << (page_frame % 8))) - sinfo.flags = sec_info->flag | SI_FLAG_W; - } - //call driver API to add page; raw_ptr needn't be page align, driver will handle page align; - if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, raw_ptr, rva, sinfo, ADD_EXTEND_PAGE))) - { - //if add page failed , we should remove enclave somewhere; + if (size == SE_PAGE_SIZE) + ret = build_pages(rva, size, sec_info.raw_data + offset, sinfo, ADD_EXTEND_PAGE); + else + ret = build_partial_page(rva, size, sec_info.raw_data + offset, sinfo, ADD_EXTEND_PAGE); + if(SGX_SUCCESS != ret) return ret; - } - offset += SE_PAGE_SIZE; - rva = sec_info->rva + offset; + + // The only time we aren't guaranteed to advance the offset by a full + // page is when the rva to be added starts in the middle of a page, as + // offset is always advanced to the next page boundary. The only case + // where the rva can start in the middle of the page is for the initial + // rva, i.e. offset == 0. + offset += (offset == 0) ? size : SE_PAGE_SIZE; } - //add the remaider of last page of raw data - if(!IS_PAGE_ALIGNED(sec_info->raw_data_size)) + + // Add any remaining uninitialized data. We can call build_pages directly + // even if there are partial pages since the source is null, i.e. everything + // is filled with '0'. Uninitialied data cannot be a relocation table, ergo + // there is no need to check the relocation bitmap. + if(sec_info.virtual_size > offset) { - sinfo.flags = sec_info->flag; - //the padding be 0 - memset(added_page, 0, SE_PAGE_SIZE); - raw_ptr = sec_info->raw_data + offset; - rva = sec_info->rva + offset; - memcpy_s(added_page, SE_PAGE_SIZE, raw_ptr, sec_info->raw_data_size & (SE_PAGE_SIZE-1)); - //check if the page is writable. - if(sec_info->bitmap && sec_info->bitmap->size()) - { - uint64_t page_frame = rva >> SE_PAGE_SHIFT; - //NOTE: - // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. - // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. - // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) - if((*sec_info->bitmap)[(size_t)(page_frame / 8)] & (1 << (page_frame % 8))) - sinfo.flags = sec_info->flag | SI_FLAG_W; - } - //call driver to add page; - if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, added_page, rva, sinfo, ADD_EXTEND_PAGE))) - { - //if add page failed , we should remove enclave somewhere; - return ret; - } - rva += SE_PAGE_SIZE; - } - //add unintialized page.If the section have no raw data, the offset should be 0. - if(ROUND_TO_PAGE(sec_info->virtual_size) > ROUND_TO_PAGE(sec_info->raw_data_size)) - { - size_t size = (size_t)(ROUND_TO_PAGE(sec_info->virtual_size) - ROUND_TO_PAGE(sec_info->raw_data_size)); - sinfo.flags = sec_info->flag; + uint64_t rva = sec_info.rva + offset; + size_t size = (size_t)(ROUND_TO_PAGE(sec_info.virtual_size - offset)); + + sinfo.flags = sec_info.flag; if(SGX_SUCCESS != (ret = build_pages(rva, size, 0, sinfo, ADD_EXTEND_PAGE))) return ret; } @@ -187,9 +161,6 @@ int CLoader::build_sections(vector *bitmap) for(unsigned int i = 0; i < sections.size() ; i++) { - - - if((last_section != NULL) && (ROUND_TO_PAGE(last_section->virtual_size() + last_section->get_rva()) < ROUND_TO_PAGE(ROUND_TO_PAGE(last_section->virtual_size()) + last_section->get_rva())) && (ROUND_TO_PAGE(last_section->get_rva() + last_section->virtual_size()) < (sections[i]->get_rva() & (~(SE_PAGE_SIZE - 1))))) @@ -208,45 +179,12 @@ int CLoader::build_sections(vector *bitmap) max_rva = sections[i]->get_rva(); last_section = sections[i]; } - //since build_mem_region require the sec_info.rva be page aligned, we need handle the first page. - //build the first page; - uint64_t offset = (sections[i]->get_rva() & (SE_PAGE_SIZE -1)); - uint64_t size = SE_PAGE_SIZE - offset; - uint8_t first_page[SE_PAGE_SIZE]; - //the raw data may be smaller than the size, we get the min of them - if(sections[i]->raw_data_size() < size) - size = sections[i]->raw_data_size(); - //the padding is '0' - memset(first_page, 0, SE_PAGE_SIZE); - memcpy_s(&first_page[offset], (size_t)size, sections[i]->raw_data(), (size_t)size); - section_info_t sec_info = { first_page, SE_PAGE_SIZE, sections[i]->get_rva() & (~(SE_PAGE_SIZE - 1)), SE_PAGE_SIZE, sections[i]->get_si_flags(), bitmap }; - if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) - { + section_info_t sec_info = { sections[i]->raw_data(), sections[i]->raw_data_size(), sections[i]->get_rva(), sections[i]->virtual_size(), sections[i]->get_si_flags(), bitmap }; + if(SGX_SUCCESS != (ret = build_mem_region(sec_info))) return ret; - } - //if there is more pages, then build the next paged aligned pages - if((sections[i]->virtual_size() + offset) > SE_PAGE_SIZE) - { - sec_info.raw_data = GET_PTR(uint8_t, sections[i]->raw_data(), size); - sec_info.raw_data_size = sections[i]->raw_data_size() - size; - sec_info.rva = sections[i]->get_rva() + (SE_PAGE_SIZE - offset); - assert(0 == (sec_info.rva & (SE_PAGE_SIZE - 1))); - //we need use (SE_PAGE_SIZE - offset), because (SE_PAGE_SIZE - offset) may larger than size - sec_info.virtual_size = sections[i]->virtual_size() - (SE_PAGE_SIZE - offset); - sec_info.flag = sections[i]->get_si_flags(); - sec_info.bitmap = bitmap; - if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) - { - return ret; - } - } - } - - - if((last_section != NULL) && (ROUND_TO_PAGE(last_section->virtual_size() + last_section->get_rva()) < ROUND_TO_PAGE(ROUND_TO_PAGE(last_section->virtual_size()) + last_section->get_rva()))) { @@ -262,16 +200,37 @@ int CLoader::build_sections(vector *bitmap) return SGX_SUCCESS; } -int CLoader::build_pages(const uint64_t start_rva, const uint64_t size, void *source, const sec_info_t &sinfo, const uint32_t attr) +int CLoader::build_partial_page(const uint64_t rva, const uint64_t size, const void *source, const sec_info_t &sinfo, const uint32_t attr) +{ + // RVA may or may not be aligned. + uint64_t offset = PAGE_OFFSET(rva); + + // Initialize the page with '0', this serves as both the padding at the start + // of the page (if it's not aligned) as well as the fill for any unitilized + // bytes at the end of the page, e.g. .bss data. + uint8_t page_data[SE_PAGE_SIZE]; + memset(page_data, 0, SE_PAGE_SIZE); + + // The amount of raw data may be less than the number of bytes on the page, + // but that portion of page_data has already been filled (see above). + memcpy_s(&page_data[offset], (size_t)(SE_PAGE_SIZE - offset), source, (size_t)size); + + // Add the page, trimming the start address to make it page aligned. + return build_pages(TRIM_TO_PAGE(rva), SE_PAGE_SIZE, page_data, sinfo, attr); +} + +int CLoader::build_pages(const uint64_t start_rva, const uint64_t size, const void *source, const sec_info_t &sinfo, const uint32_t attr) { int ret = SGX_SUCCESS; uint64_t offset = 0; uint64_t rva = start_rva; + assert(IS_PAGE_ALIGNED(start_rva) && IS_PAGE_ALIGNED(size)); + while(offset < size) { //call driver to add page; - if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, source, rva, sinfo, attr))) + if(SGX_SUCCESS != (ret = get_enclave_creator()->add_enclave_page(ENCLAVE_ID_IOCTL, GET_PTR(void, source, 0), rva, sinfo, attr))) { //if add page failed , we should remove enclave somewhere; return ret; @@ -290,6 +249,8 @@ int CLoader::build_context(const uint64_t start_rva, layout_entry_t *layout) memset(&sinfo, 0, sizeof(sinfo)); uint64_t rva = start_rva + layout->rva; + assert(IS_PAGE_ALIGNED(rva)); + if (layout->content_offset) { // assume TCS is only 1 page @@ -312,7 +273,7 @@ int CLoader::build_context(const uint64_t start_rva, layout_entry_t *layout) else // guard page should not have content_offset != 0 { section_info_t sec_info = {GET_PTR(uint8_t, m_metadata, layout->content_offset), layout->content_size, rva, layout->page_count << SE_PAGE_SHIFT, layout->si_flags, NULL}; - if(SGX_SUCCESS != (ret = build_mem_region(&sec_info))) + if(SGX_SUCCESS != (ret = build_mem_region(sec_info))) { return ret; } @@ -468,6 +429,22 @@ bool CLoader::is_enclave_buffer(uint64_t offset, uint64_t size) } return true; } + +// is_relocation_page returns true if the specified RVA is a writable relocation page based on the bitmap. +bool CLoader::is_relocation_page(const uint64_t rva, vector *bitmap) +{ + if(bitmap && bitmap->size()) + { + uint64_t page_frame = rva >> SE_PAGE_SHIFT; + + //NOTE: + // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. + // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. + // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) + return ((*bitmap)[(size_t)(page_frame / 8)] & (1 << (page_frame % 8))); + } + return false; +} int CLoader::validate_layout_table() { layout_t *layout_start = GET_PTR(layout_t, m_metadata, m_metadata->dirs[DIR_LAYOUT].offset); diff --git a/psw/urts/loader.h b/psw/urts/loader.h index 77b7c194ed..5533caaff2 100644 --- a/psw/urts/loader.h +++ b/psw/urts/loader.h @@ -68,12 +68,14 @@ public: int set_memory_protection(); private: - int build_mem_region(const section_info_t * const sec_info); + int build_mem_region(const section_info_t &sec_info); int build_image(SGXLaunchToken * const lc, sgx_attributes_t * const secs_attr, le_prd_css_file_t *prd_css_file, sgx_misc_attribute_t * const misc_attr); int build_secs(sgx_attributes_t * const secs_attr, sgx_misc_attribute_t * const misc_attr); int build_context(const uint64_t start_rva, layout_entry_t *layout); int build_contexts(layout_t *layout_start, layout_t *layout_end, uint64_t delta); - int build_pages(const uint64_t start_rva, const uint64_t size, void *source, const sec_info_t &sinfo, const uint32_t attr); + int build_partial_page(const uint64_t rva, const uint64_t size, const void *source, const sec_info_t &sinfo, const uint32_t attr); + int build_pages(const uint64_t start_rva, const uint64_t size, const void *source, const sec_info_t &sinfo, const uint32_t attr); + bool is_relocation_page(const uint64_t rva, vector *bitmap); bool is_ae(const enclave_css_t *enclave_css); bool is_metadata_buffer(uint32_t offset, uint32_t size); diff --git a/psw/urts/section_info.h b/psw/urts/section_info.h index f55dafdaf9..767e021f79 100644 --- a/psw/urts/section_info.h +++ b/psw/urts/section_info.h @@ -40,7 +40,7 @@ using namespace std; typedef struct _section_info_t { - uint8_t *raw_data; //The file pointer to the first page of the section. + const uint8_t *raw_data; //The file pointer to the first page of the section. uint64_t raw_data_size; //The size of the section or the size of the initialized section on disk. uint64_t rva; //The address of the first byte of the section relative to the image base when section is loaded into memory. uint64_t virtual_size; //The total size of the section when loaded into memory. From 97006286863b2a6dade69f7a1f3883f8f3eb4660 Mon Sep 17 00:00:00 2001 From: ZongminGu Date: Mon, 24 Oct 2016 11:53:26 +0800 Subject: [PATCH 17/33] Update gdb_sgx_plugin.py fix the simulation mode support issue --- .../linux/gdb-sgx-plugin/gdb_sgx_plugin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py index 0fe75649b4..ff588fcb8a 100755 --- a/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py +++ b/sdk/debugger_interface/linux/gdb-sgx-plugin/gdb_sgx_plugin.py @@ -114,7 +114,7 @@ def target_path_to_host_path(target_path): #host_path = host_path[0:strlen-7] return host_path -class enclave_info: +class enclave_info(object): """Class to contain the enclave inforation, such as start address, stack addresses, stack size, etc. The enclave information is for one enclave.""" @@ -528,11 +528,11 @@ class UpdateOcallFrame(gdb.Breakpoint): return False trusted_ocall_frame_tuple = struct.unpack_from(trusted_of_fmt, trusted_ocall_frame) - gdb_cmd = "set *(uintptr_t *)%#x = 0" %(ocall_frame) + gdb_cmd = "set *(uintptr_t *)%#x = 0" %(int(ocall_frame)) gdb.execute(gdb_cmd, False, True) - gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(ocall_frame+(2*SIZE), trusted_ocall_frame_tuple[11]) + gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(int(ocall_frame+(2*SIZE)), trusted_ocall_frame_tuple[11]) gdb.execute(gdb_cmd, False, True) - gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(ocall_frame+(3*SIZE), trusted_ocall_frame_tuple[19]) + gdb_cmd = "set *(uintptr_t *)%#x = %#x" %(int(ocall_frame+(3*SIZE)), trusted_ocall_frame_tuple[19]) gdb.execute(gdb_cmd, False, True) return False @@ -582,7 +582,7 @@ def sgx_debugger_init(): def exit_handler(event): # When the inferior exited, remove all enclave symbol - for key in ENCLAVES_ADDR.keys(): + for key in list(ENCLAVES_ADDR.keys()): gdb.execute("remove-symbol-file -a %s" % (ENCLAVES_ADDR[key]), False, True) ENCLAVES_ADDR.clear() From 5cd3c5a7bfb469e411bd3cbc7f72365df330fa57 Mon Sep 17 00:00:00 2001 From: Yu Yuan Date: Mon, 24 Oct 2016 12:27:44 +0800 Subject: [PATCH 18/33] update enclave_creator to align with driver API change --- common/inc/internal/enclave_creator.h | 2 +- psw/urts/enclave.cpp | 2 +- psw/urts/enclave_creator_hw.h | 2 +- psw/urts/linux/enclave_creator_hw.cpp | 85 +++++++----- psw/urts/linux/isgx_user.h | 131 ++++++++---------- psw/urts/loader.cpp | 4 +- .../SignTool/enclave_creator_sign.cpp | 3 +- sdk/sign_tool/SignTool/enclave_creator_sign.h | 2 +- .../urtssim/enclave_creator_sim.cpp | 3 +- sdk/simulation/urtssim/enclave_creator_sim.h | 2 +- 10 files changed, 125 insertions(+), 111 deletions(-) diff --git a/common/inc/internal/enclave_creator.h b/common/inc/internal/enclave_creator.h index 67d41a7ae2..c7f25088de 100644 --- a/common/inc/internal/enclave_creator.h +++ b/common/inc/internal/enclave_creator.h @@ -65,7 +65,7 @@ public: */ virtual int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr) = 0; virtual int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file = NULL) = 0; - virtual int destroy_enclave(sgx_enclave_id_t enclave_id) = 0; + virtual int destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size = 0) = 0; virtual int initialize(sgx_enclave_id_t enclave_id) = 0; virtual bool use_se_hw() const = 0; diff --git a/psw/urts/enclave.cpp b/psw/urts/enclave.cpp index 7586b1e87f..8890077b7e 100644 --- a/psw/urts/enclave.cpp +++ b/psw/urts/enclave.cpp @@ -240,7 +240,7 @@ void CEnclave::destroy() debug_enclave_info_t *debug_info = const_cast(get_debug_info()); generate_enclave_debug_event(URTS_EXCEPTION_PREREMOVEENCLAVE, debug_info); - get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL); + get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL, m_size); m_destroyed = true; //We are going to destory m_rwlock. At this point, maybe an ecall is in progress, and try to get m_rwlock. diff --git a/psw/urts/enclave_creator_hw.h b/psw/urts/enclave_creator_hw.h index db176d976d..c60b400008 100644 --- a/psw/urts/enclave_creator_hw.h +++ b/psw/urts/enclave_creator_hw.h @@ -52,7 +52,7 @@ public: int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae); int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr); int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file); - int destroy_enclave(sgx_enclave_id_t enclave_id); + int destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size); int initialize(sgx_enclave_id_t enclave_id); bool use_se_hw() const; int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag); diff --git a/psw/urts/linux/enclave_creator_hw.cpp b/psw/urts/linux/enclave_creator_hw.cpp index 10c80a94a2..feeb72ecf1 100644 --- a/psw/urts/linux/enclave_creator_hw.cpp +++ b/psw/urts/linux/enclave_creator_hw.cpp @@ -72,39 +72,38 @@ int EnclaveCreatorHW::error_driver2urts(int driver_error) switch(driver_error) { - case ISGX_ERROR: +#if 0 + case SGX_ERROR: if(ENOMEM == errno) ret = SGX_ERROR_OUT_OF_MEMORY; else ret = SGX_ERROR_NO_DEVICE; break; - case ISGX_INVALID_ATTRIBUTE: +#endif + case SGX_INVALID_ATTRIBUTE: ret = SGX_ERROR_INVALID_ATTRIBUTE; break; - case ISGX_INVALID_MEASUREMENT: + case SGX_INVALID_MEASUREMENT: ret = SE_ERROR_INVALID_MEASUREMENT; break; - case ISGX_INVALID_SIG_STRUCT: - case ISGX_INVALID_SIGNATIRE: + case SGX_INVALID_SIG_STRUCT: + case SGX_INVALID_SIGNATURE: ret = SGX_ERROR_INVALID_SIGNATURE; break; - case ISGX_INVALID_LAUNCH_TOKEN: - ret = SE_ERROR_INVALID_LAUNCH_TOKEN; - break; - case ISGX_INVALID_CPUSVN: + case SGX_INVALID_CPUSVN: ret = SGX_ERROR_INVALID_CPUSVN; break; - case ISGX_INVALID_ISVSVN: + case SGX_INVALID_ISVSVN: ret = SGX_ERROR_INVALID_ISVSVN; break; - case ISGX_UNMASKED_EVENT: + case SGX_UNMASKED_EVENT: ret = SGX_ERROR_DEVICE_BUSY; break; - case (int)ISGX_POWER_LOST_ENCLAVE: // [-Wc++11-narrowing] + case (int)SGX_POWER_LOST_ENCLAVE: // [-Wc++11-narrowing] ret = SGX_ERROR_ENCLAVE_LOST; break; default: - SE_TRACE(SE_TRACE_WARNING, "unexpected error %#x from driver, should be uRTS/driver bug\n", ret); + SE_TRACE(SE_TRACE_WARNING, "unexpected error %#X from driver, should be uRTS/driver bug\n", driver_error); ret = SGX_ERROR_UNEXPECTED; break; } @@ -116,15 +115,35 @@ int EnclaveCreatorHW::create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, { assert(secs != NULL && enclave_id != NULL && start_addr != NULL); UNUSED(ae); + int ret = 0; if (false == open_se_device()) return SGX_ERROR_NO_DEVICE; SE_TRACE(SE_TRACE_DEBUG, "\n secs.attibutes.flags = %llx, secs.attributes.xfrm = %llx \n" , secs->attributes.flags, secs->attributes.xfrm); + //SECS:BASEADDR must be naturally aligned on an SECS.SIZE boundary + void* enclave_base = mmap(NULL, (size_t)secs->size *2, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, m_hdevice, 0); - struct isgx_create_param param = { secs, 0 }; - int ret = ioctl(m_hdevice, ISGX_IOCTL_ENCLAVE_CREATE, ¶m); + if(enclave_base == NULL) + { + SE_TRACE(SE_TRACE_WARNING, "\nISGX_IOCTL_ENCLAVE_CREATE fails: mmap fail\n"); + return SGX_ERROR_OUT_OF_MEMORY; + } + //find a suitable base for enclave + uint64_t base = (uint64_t)enclave_base + (secs->size - ((uint64_t)enclave_base % secs->size)) ; + secs->base = (void*)base; + //remove unneed page + munmap(enclave_base, (size_t)(secs->base) - (size_t)(enclave_base)); + + if(((uint64_t)(enclave_base) + secs->size *2) != ((uint64_t)secs->base + secs->size)) + { + munmap((void*)((size_t)secs->base + secs->size), (size_t)(enclave_base) + (size_t)secs->size - (size_t)(secs->base)); + } + + struct sgx_enclave_create param = {0}; + param.src = (__u64)(secs); + ret = ioctl(m_hdevice, SGX_IOC_ENCLAVE_CREATE, ¶m); if(ret) { SE_TRACE(SE_TRACE_WARNING, "\nISGX_IOCTL_ENCLAVE_CREATE fails: errno = %x\n", errno); return error_driver2urts(ret); @@ -134,11 +153,12 @@ int EnclaveCreatorHW::create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, if(0 == tmp) g_eid_high++; *enclave_id = ((uint64_t)g_eid_high << 32) | g_eid_low; - *start_addr = secs->base = (void *)param.addr; + *start_addr = secs->base; return SGX_SUCCESS; } + int EnclaveCreatorHW::add_enclave_page(sgx_enclave_id_t enclave_id, void *src, uint64_t rva, const sec_info_t &sinfo, uint32_t attr) { assert((rva & ((1<(source); - addp.secinfo = (void *)const_cast(&sinfo); - if(!((1<(source); + addp.secinfo = reinterpret_cast<__u64>(const_cast(&sinfo)); + if(((1<(enclave_css); + struct sgx_enclave_init initp = { 0, 0, 0 }; + initp.addr = (__u64)enclave_id; + initp.sigstruct = reinterpret_cast<__u64>(enclave_css); //launch should NOT be NULL, because it has been checked in urts_com.h::_create_enclave(...) assert(launch != NULL); - initp.einittoken = reinterpret_cast(launch); - ret = ioctl(m_hdevice, ISGX_IOCTL_ENCLAVE_INIT, &initp); + initp.einittoken = reinterpret_cast<__u64>(launch); + ret = ioctl(m_hdevice, SGX_IOC_ENCLAVE_INIT, &initp); if (ret) { SE_TRACE(SE_TRACE_WARNING, "\nISGX_IOCTL_ENCLAVE_INIT fails error = %x\n", ret); return error_driver2urts(ret); @@ -195,14 +216,14 @@ int EnclaveCreatorHW::try_init_enclave(sgx_enclave_id_t enclave_id, enclave_css_ return SGX_SUCCESS; } -int EnclaveCreatorHW::destroy_enclave(sgx_enclave_id_t enclave_id) +//for linux hw mode, enclave_id is actually start address here +int EnclaveCreatorHW::destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size) { int ret = 0; - isgx_destroy_param param = { (unsigned long)enclave_id }; - ret = ioctl(m_hdevice, ISGX_IOCTL_ENCLAVE_DESTROY, ¶m); + ret = munmap((void*)enclave_id, (size_t)enclave_size); - if (-1 == ret) { + if (0 != ret) { SE_TRACE(SE_TRACE_WARNING, "destroy SGX enclave failed, error = %d\n", errno); ret = SGX_ERROR_UNEXPECTED; } diff --git a/psw/urts/linux/isgx_user.h b/psw/urts/linux/isgx_user.h index bee8016bcd..e2cd4b35d6 100644 --- a/psw/urts/linux/isgx_user.h +++ b/psw/urts/linux/isgx_user.h @@ -28,75 +28,66 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef _X86_ISGX_USER_H -#define _X86_ISGX_USER_H - -#include -#include +#ifndef _UAPI_ASM_X86_SGX_H +#define _UAPI_ASM_X86_SGX_H + #include +#include + +#define SGX_MAGIC 0xA4 + +#define SGX_IOC_ENCLAVE_CREATE \ + _IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create) +#define SGX_IOC_ENCLAVE_ADD_PAGE \ + _IOW(SGX_MAGIC, 0x01, struct sgx_enclave_add_page) +#define SGX_IOC_ENCLAVE_INIT \ + _IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init) + + /* SGX leaf instruction return values */ +#define SGX_SUCCESS 0 +#define SGX_INVALID_SIG_STRUCT 1 +#define SGX_INVALID_ATTRIBUTE 2 +#define SGX_BLKSTATE 3 +#define SGX_INVALID_MEASUREMENT 4 +#define SGX_NOTBLOCKABLE 5 +#define SGX_PG_INVLD 6 +#define SGX_LOCKFAIL 7 +#define SGX_INVALID_SIGNATURE 8 +#define SGX_MAC_COMPARE_FAIL 9 +#define SGX_PAGE_NOT_BLOCKED 10 +#define SGX_NOT_TRACKED 11 +#define SGX_VA_SLOT_OCCUPIED 12 +#define SGX_CHILD_PRESENT 13 +#define SGX_ENCLAVE_ACT 14 +#define SGX_ENTRYEPOCH_LOCKED 15 +#define SGX_INVALID_LICENSE 16 +#define SGX_PREV_TRK_INCMPL 17 +#define SGX_PG_IS_SECS 18 +#define SGX_INVALID_CPUSVN 32 +#define SGX_INVALID_ISVSVN 64 +#define SGX_UNMASKED_EVENT 128 +#define SGX_INVALID_KEYNAME 256 + + /* IOCTL return values */ +#define SGX_POWER_LOST_ENCLAVE 0x40000000 +#define SGX_LE_ROLLBACK 0x40000001 + + struct sgx_enclave_create { + __u64 src; + } __attribute__((packed)); + + struct sgx_enclave_add_page { + __u64 addr; + __u64 src; + __u64 secinfo; + __u16 mrmask; + } __attribute__((packed)); + + struct sgx_enclave_init { + __u64 addr; + __u64 sigstruct; + __u64 einittoken; + } __attribute__((packed)); + +#endif /* _UAPI_ASM_X86_SGX_H */ -#define ISGX_IOCTL_ENCLAVE_CREATE _IOWR('p', 0x02, struct isgx_create_param) -#define ISGX_IOCTL_ENCLAVE_ADD_PAGE _IOW('p', 0x03, struct isgx_add_param) -#define ISGX_IOCTL_ENCLAVE_INIT _IOW('p', 0x04, struct isgx_init_param) -#define ISGX_IOCTL_ENCLAVE_DESTROY _IOW('p', 0x06, struct isgx_destroy_param) - -#define SECS_SIZE_OFFSET 0 -#define SECS_BASE_OFFSET (SECS_SIZE_OFFSET + 8) -#define SECS_FLAGS_OFFSET (SECS_BASE_OFFSET + 8) -#define SECS_SSAFRAMESIZE_OFFSET (SECS_SIZE_OFFSET + 164) - -/* SGX leaf instruction return values */ -#define ISGX_SUCCESS 0 -#define ISGX_ERROR -1 -#define ISGX_INVALID_SIG_STRUCT 0x1 -#define ISGX_INVALID_ATTRIBUTE 0x2 -#define ISGX_INVALID_MEASUREMENT 0x4 -#define ISGX_INVALID_SIGNATIRE 0x8 -#define ISGX_INVALID_LAUNCH_TOKEN 0x10 -#define ISGX_INVALID_CPUSVN 0x20 -#define ISGX_INVALID_ISVSVN 0x40 -#define ISGX_UNMASKED_EVENT 0x80 -#define ISGX_INVALID_KEYNAME 0x100 - -/* IOCTL return values */ -#define ISGX_OUT_OF_EPC_PAGES 0xc0000001 -#define ISGX_POWER_LOST_ENCLAVE 0xc0000002 - -/* SECINFO flags */ -#define ISGX_SECINFO_R 0x1 /* Read Access */ -#define ISGX_SECINFO_W 0x2 /* Write Access */ -#define ISGX_SECINFO_X 0x4 /* Execute Access */ -#define ISGX_SECINFO_SECS 0x000 /* SECS */ -#define ISGX_SECINFO_TCS 0x100 /* TCS */ -#define ISGX_SECINFO_REG 0x200 /* Regular Page */ - -struct isgx_secinfo { - __u64 flags; - __u64 reserved[7]; -}; - -struct isgx_create_param { - void *secs; - unsigned long addr; -}; - -#define ISGX_ADD_SKIP_EEXTEND 0x1 - -struct isgx_add_param { - unsigned long addr; - unsigned long user_addr; - void *secinfo; - unsigned int flags; -}; - -struct isgx_init_param { - unsigned long addr; - void *sigstruct; - void *einittoken; -}; - -struct isgx_destroy_param { - unsigned long addr; -}; - -#endif /* _X86_ISGX_USER_H */ diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index 6821d7210d..a1fd16f61e 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -438,7 +438,7 @@ int CLoader::build_image(SGXLaunchToken * const lc, sgx_attributes_t * const sec return SGX_SUCCESS; fail: - get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL); + get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL, m_secs.size); return ret; } @@ -689,7 +689,7 @@ int CLoader::load_enclave_ex(SGXLaunchToken *lc, bool debug, const metadata_t *m int CLoader::destroy_enclave() { - return get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL); + return get_enclave_creator()->destroy_enclave(ENCLAVE_ID_IOCTL, m_secs.size); } int CLoader::set_memory_protection() diff --git a/sdk/sign_tool/SignTool/enclave_creator_sign.cpp b/sdk/sign_tool/SignTool/enclave_creator_sign.cpp index ebd6ac3fb7..a92130db86 100644 --- a/sdk/sign_tool/SignTool/enclave_creator_sign.cpp +++ b/sdk/sign_tool/SignTool/enclave_creator_sign.cpp @@ -236,9 +236,10 @@ int EnclaveCreatorST::get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadat return SGX_SUCCESS; } -int EnclaveCreatorST::destroy_enclave(sgx_enclave_id_t enclave_id) +int EnclaveCreatorST::destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size) { UNUSED(enclave_id); + UNUSED(enclave_size); SAFE_FREE_MM(m_ctx); return SGX_SUCCESS; } diff --git a/sdk/sign_tool/SignTool/enclave_creator_sign.h b/sdk/sign_tool/SignTool/enclave_creator_sign.h index 64fe6ea589..d4612a0994 100644 --- a/sdk/sign_tool/SignTool/enclave_creator_sign.h +++ b/sdk/sign_tool/SignTool/enclave_creator_sign.h @@ -49,7 +49,7 @@ public: int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *lc, le_prd_css_file_t *prd_css_file); int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag); bool get_plat_cap(sgx_misc_attribute_t *se_attr); - int destroy_enclave(sgx_enclave_id_t enclave_id); + int destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size); int initialize(sgx_enclave_id_t enclave_id); bool use_se_hw() const; diff --git a/sdk/simulation/urtssim/enclave_creator_sim.cpp b/sdk/simulation/urtssim/enclave_creator_sim.cpp index 3f92291f24..852db2be4e 100644 --- a/sdk/simulation/urtssim/enclave_creator_sim.cpp +++ b/sdk/simulation/urtssim/enclave_creator_sim.cpp @@ -167,8 +167,9 @@ int EnclaveCreatorSim::get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metada return SGX_SUCCESS; } -int EnclaveCreatorSim::destroy_enclave(sgx_enclave_id_t enclave_id) +int EnclaveCreatorSim::destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size) { + UNUSED(enclave_size); CEnclave *enclave = CEnclavePool::instance()->get_enclave(enclave_id); if(enclave == NULL) diff --git a/sdk/simulation/urtssim/enclave_creator_sim.h b/sdk/simulation/urtssim/enclave_creator_sim.h index 4732183dda..23d7c88e7d 100644 --- a/sdk/simulation/urtssim/enclave_creator_sim.h +++ b/sdk/simulation/urtssim/enclave_creator_sim.h @@ -43,7 +43,7 @@ public: int create_enclave(secs_t *secs, sgx_enclave_id_t *enclave_id, void **start_addr, bool ae); int add_enclave_page(sgx_enclave_id_t enclave_id, void *source, uint64_t offset, const sec_info_t &sinfo, uint32_t attr); int init_enclave(sgx_enclave_id_t enclave_id, enclave_css_t *enclave_css, SGXLaunchToken *launch, le_prd_css_file_t *prd_css_file); - virtual int destroy_enclave(sgx_enclave_id_t enclave_id); + virtual int destroy_enclave(sgx_enclave_id_t enclave_id, uint64_t enclave_size); int get_misc_attr(sgx_misc_attribute_t *sgx_misc_attr, metadata_t *metadata, SGXLaunchToken * const lc, uint32_t flag); bool get_plat_cap(sgx_misc_attribute_t *se_attr); int initialize(sgx_enclave_id_t enclave_id); From dc3125fe2eb40e56209f0ea7481040789b64a98a Mon Sep 17 00:00:00 2001 From: Yu Yuan Date: Tue, 25 Oct 2016 14:11:22 +0800 Subject: [PATCH 19/33] update CLoader::is_relocation_page to check the array index is out of range. Signed-off-by Yu Yuan yuan.yu@intel.com --- psw/urts/loader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/psw/urts/loader.cpp b/psw/urts/loader.cpp index ab0fc5357d..e392a22535 100644 --- a/psw/urts/loader.cpp +++ b/psw/urts/loader.cpp @@ -433,15 +433,15 @@ bool CLoader::is_enclave_buffer(uint64_t offset, uint64_t size) // is_relocation_page returns true if the specified RVA is a writable relocation page based on the bitmap. bool CLoader::is_relocation_page(const uint64_t rva, vector *bitmap) { - if(bitmap && bitmap->size()) + uint64_t page_frame = rva >> SE_PAGE_SHIFT; + //NOTE: + // Current enclave size is not beyond 128G, so the type-casting from (uint64>>15) to (size_t) is OK. + // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. + // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) + size_t index = (size_t)(page_frame / 8); + if(bitmap && (index < bitmap->size())) { - uint64_t page_frame = rva >> SE_PAGE_SHIFT; - - //NOTE: - // Current enclave size is not beyond 64G, so the type-casting from (uint64>>15) to (size_t) is OK. - // In the future, if the max enclave size is extended to beyond (1<<49), this type-casting will not work. - // It only impacts the enclave signing process. (32bit signing tool to sign 64 bit enclaves) - return ((*bitmap)[(size_t)(page_frame / 8)] & (1 << (page_frame % 8))); + return ((*bitmap)[index] & (1 << (page_frame % 8))); } return false; } From 5ac65167be298bbddce9bf1e3c0045b455345ec0 Mon Sep 17 00:00:00 2001 From: Rodolfo Silva Date: Wed, 9 Nov 2016 10:18:30 -0300 Subject: [PATCH 20/33] Updated get_arch() function in linux/installer/bin/build-installpkg.sh script to support all system languages. The old get_arch() function would only work on systems configured in English, since it looked for the 'Class:' string. The new get_arch() function uses the 'magic' information from the readelf output to determine the architecture of the build from generated binary. Signed-off-by: Rodolfo Silva --- linux/installer/bin/build-installpkg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/installer/bin/build-installpkg.sh b/linux/installer/bin/build-installpkg.sh index 5db4537402..83da0511c8 100755 --- a/linux/installer/bin/build-installpkg.sh +++ b/linux/installer/bin/build-installpkg.sh @@ -57,8 +57,8 @@ BUILD_DIR=${ROOT_DIR}/build/linux # Get the architecture of the build from generated binary get_arch() { - local a=$(readelf -h $BUILD_DIR/sgx_sign | awk '/Class:/{print $2}') - test $a = ELF64 && echo 'x86_64' || echo 'x86' + local a=$(readelf -h $BUILD_DIR/sgx_sign | sed -n '2p' | awk '/:/{print $6}') + test $a = 02 && echo 'x86_64' || echo 'x86' } From 17f2836e2e2a443c93806db1aa981419d703388c Mon Sep 17 00:00:00 2001 From: Rodolfo Silva Date: Wed, 9 Nov 2016 10:19:17 -0300 Subject: [PATCH 21/33] Updated get_arch() function in linux/installer/common/sdk/createTarball.sh script to support all system languages. The old get_arch() function would only work on systems configured in English, since it looked for the 'Class:' string. The new get_arch() function uses the 'magic' information from the readelf output to determine the architecture of the build from generated binary. Signed-off-by: Rodolfo Silva --- linux/installer/common/sdk/createTarball.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/installer/common/sdk/createTarball.sh b/linux/installer/common/sdk/createTarball.sh index 69f5253b0e..88c22ea340 100755 --- a/linux/installer/common/sdk/createTarball.sh +++ b/linux/installer/common/sdk/createTarball.sh @@ -47,8 +47,8 @@ rm -fr ${INSTALL_PATH} # Get the architecture of the build from generated binary get_arch() { - local a=$(readelf -h $BUILD_DIR/sgx_sign | awk '/Class:/{print $2}') - test $a = ELF64 && echo 'x64' || echo 'x86' + local a=$(readelf -h $BUILD_DIR/sgx_sign | sed -n '2p' | awk '/:/{print $6}') + test $a = 02 && echo 'x86_64' || echo 'x86' } ARCH=$(get_arch) From ca3fee442ec7ab8fcedc3db633f719c57369feb7 Mon Sep 17 00:00:00 2001 From: Rodolfo Silva Date: Wed, 9 Nov 2016 10:20:27 -0300 Subject: [PATCH 22/33] Updated get_arch() function in linux/installer/common/psw/createTarball.sh script to support all system languages. The old get_arch() function would only work on systems configured in English, since it looked for the 'Class:' string. The new get_arch() function uses the 'magic' information from the readelf output to determine the architecture of the build from generated binary. Signed-off-by: Rodolfo Silva --- linux/installer/common/psw/createTarball.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/installer/common/psw/createTarball.sh b/linux/installer/common/psw/createTarball.sh index aa89c97c75..5684b5d922 100755 --- a/linux/installer/common/psw/createTarball.sh +++ b/linux/installer/common/psw/createTarball.sh @@ -47,8 +47,8 @@ rm -fr ${INSTALL_PATH} # Get the architecture of the build from generated binary get_arch() { - local a=$(readelf -h $BUILD_DIR/sgx_sign | awk '/Class:/{print $2}') - test $a = ELF64 && echo 'x64' || echo 'x86' + local a=$(readelf -h $BUILD_DIR/sgx_sign | sed -n '2p' | awk '/:/{print $6}') + test $a = 02 && echo 'x86_64' || echo 'x86' } ARCH=$(get_arch) From a49f62a6cdb969cfd4539d2fbed6de1cf8492bdb Mon Sep 17 00:00:00 2001 From: Rodolfo Silva Date: Wed, 9 Nov 2016 22:26:30 -0300 Subject: [PATCH 23/33] Corrected architecture output from x86_64 to x64. Signed-off-by: Rodolfo Silva --- linux/installer/common/psw/createTarball.sh | 2 +- linux/installer/common/sdk/createTarball.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/installer/common/psw/createTarball.sh b/linux/installer/common/psw/createTarball.sh index 5684b5d922..a78f83c4dd 100755 --- a/linux/installer/common/psw/createTarball.sh +++ b/linux/installer/common/psw/createTarball.sh @@ -48,7 +48,7 @@ rm -fr ${INSTALL_PATH} get_arch() { local a=$(readelf -h $BUILD_DIR/sgx_sign | sed -n '2p' | awk '/:/{print $6}') - test $a = 02 && echo 'x86_64' || echo 'x86' + test $a = 02 && echo 'x64' || echo 'x86' } ARCH=$(get_arch) diff --git a/linux/installer/common/sdk/createTarball.sh b/linux/installer/common/sdk/createTarball.sh index 88c22ea340..9d3e12ebfb 100755 --- a/linux/installer/common/sdk/createTarball.sh +++ b/linux/installer/common/sdk/createTarball.sh @@ -48,7 +48,7 @@ rm -fr ${INSTALL_PATH} get_arch() { local a=$(readelf -h $BUILD_DIR/sgx_sign | sed -n '2p' | awk '/:/{print $6}') - test $a = 02 && echo 'x86_64' || echo 'x86' + test $a = 02 && echo 'x64' || echo 'x86' } ARCH=$(get_arch) From 6662022bf8505768b4106de99d07fb96ac653539 Mon Sep 17 00:00:00 2001 From: llly Date: Tue, 20 Dec 2016 09:47:15 +0900 Subject: [PATCH 24/33] Linux 1.7 Open Source Gold release Signed-off-by: Li, Xun --- Linux_SGXEclipsePlugin/build.sh | 2 +- .../html/Resources/PageLayouts/Default.flpgl | 22 - .../com.intel.sgx.userguide/html/content.html | 11 +- .../plugins/com.intel.sgx.userguide/toc.xml | 23 +- .../makefiles/c++/sgx_t_static.mk | 6 +- .../makefiles/c/sgx_t_static.mk | 6 +- Makefile | 8 +- README.md | 41 +- SampleCode/LocalAttestation/.cproject | 12 +- SampleCode/LocalAttestation/.project | 2 +- SampleCode/LocalAttestation/App/App.cpp | 14 +- SampleCode/LocalAttestation/Makefile | 35 +- SampleCode/LocalAttestation/README.txt | 22 +- SampleCode/PowerTransition/.cproject | 12 +- SampleCode/PowerTransition/.project | 2 +- .../PowerTransition/Enclave/Enclave.cpp | 2 +- SampleCode/PowerTransition/Makefile | 33 +- SampleCode/PowerTransition/README.txt | 22 +- SampleCode/RemoteAttestation/.cproject | 12 +- SampleCode/RemoteAttestation/.project | 2 +- SampleCode/RemoteAttestation/Makefile | 30 +- SampleCode/RemoteAttestation/README.txt | 22 +- SampleCode/SampleEnclave/.cproject | 12 +- SampleCode/SampleEnclave/.project | 2 +- .../Enclave/Edger8rSyntax/Pointers.cpp | 2 +- SampleCode/SampleEnclave/Makefile | 30 +- SampleCode/SampleEnclave/README.txt | 21 +- buildenv.mk | 27 + common/inc/internal/se_quote_internal.h | 2 +- common/inc/internal/se_version.h | 2 +- common/inc/{ => internal}/sgx_sha256_128.h | 0 common/inc/sgx_attributes.h | 4 +- common/inc/sgx_key.h | 20 +- download_prebuilt.sh | 38 +- external/crypto_px/Makefile | 2 +- external/crypto_px/include/ippbase.h | 390 +- external/crypto_px/include/ippcore.h | 790 +- external/crypto_px/include/ippcp.h | 654 +- external/crypto_px/include/ippcpdefs.h | 422 +- external/crypto_px/include/ippdefs.h | 258 +- external/crypto_px/include/ipptypes.h | 2208 +- external/crypto_px/include/ippversion.h | 82 +- external/crypto_px/sources/include/cpudef.h | 528 +- external/crypto_px/sources/include/ippver.h | 92 +- external/crypto_px/sources/include/owndefs.h | 1888 +- external/crypto_px/sources/ippcp/src/owncp.h | 298 +- .../sources/ippcp/src/pcpaesauthcmacca.c | 792 +- .../sources/ippcp/src/pcpaesauthgcm.h | 282 +- .../sources/ippcp/src/pcpaesauthgcmca.c | 1462 +- .../sources/ippcp/src/pcpaesgcmtableca.c | 104 +- .../sources/ippcp/src/pcpaesgcmtbl2kca.c | 458 +- .../crypto_px/sources/ippcp/src/pcpaesm.h | 100 +- .../sources/ippcp/src/pcpaesmctrca.c | 300 +- .../sources/ippcp/src/pcpaesminitca.c | 346 +- external/crypto_px/sources/ippcp/src/pcpbn.h | 420 +- .../crypto_px/sources/ippcp/src/pcpbnca.c | 2116 +- .../sources/ippcp/src/pcpbnresource.h | 102 +- .../sources/ippcp/src/pcpbnresourceca.c | 186 +- .../crypto_px/sources/ippcp/src/pcpbnsetca.c | 238 +- .../sources/ippcp/src/pcpbnu32arith.c | 468 +- .../sources/ippcp/src/pcpbnu32arith.h | 92 +- .../sources/ippcp/src/pcpbnu32misc.c | 106 +- .../sources/ippcp/src/pcpbnu32misc.h | 98 +- .../crypto_px/sources/ippcp/src/pcpbnuarith.c | 602 +- .../crypto_px/sources/ippcp/src/pcpbnuarith.h | 228 +- .../crypto_px/sources/ippcp/src/pcpbnuimpl.h | 282 +- .../crypto_px/sources/ippcp/src/pcpbnumisc.c | 416 +- .../crypto_px/sources/ippcp/src/pcpbnumisc.h | 298 +- .../crypto_px/sources/ippcp/src/pcpcmac.h | 140 +- .../crypto_px/sources/ippcp/src/pcpeccp.h | 460 +- .../crypto_px/sources/ippcp/src/pcpeccpdpca.c | 740 +- .../sources/ippcp/src/pcpeccpgenkeyca.c | 214 +- .../sources/ippcp/src/pcpeccpinitca.c | 610 +- .../sources/ippcp/src/pcpeccpmethod.h | 186 +- .../sources/ippcp/src/pcpeccpmethodcom.h | 266 +- .../sources/ippcp/src/pcpeccpmethodcomca.c | 1462 +- .../sources/ippcp/src/pcpeccppoint.h | 120 +- .../sources/ippcp/src/pcpeccppointca.c | 256 +- .../sources/ippcp/src/pcpeccppointopca.c | 952 +- .../sources/ippcp/src/pcpeccppublickeyca.c | 178 +- .../sources/ippcp/src/pcpeccpsecretdhca.c | 232 +- .../sources/ippcp/src/pcpeccpsetkeyca.c | 210 +- .../sources/ippcp/src/pcpeccpsigndsaca.c | 298 +- .../crypto_px/sources/ippcp/src/pcpeccpsscm.c | 322 +- .../crypto_px/sources/ippcp/src/pcpeccpsscm.h | 98 +- .../sources/ippcp/src/pcpeccpstdca.c | 648 +- .../sources/ippcp/src/pcpeccpverifydsaca.c | 290 +- .../crypto_px/sources/ippcp/src/pcphash.h | 318 +- .../crypto_px/sources/ippcp/src/pcphashca.c | 1026 +- .../crypto_px/sources/ippcp/src/pcphashcnt.c | 432 +- .../sources/ippcp/src/pcphashmd5px.c | 394 +- .../sources/ippcp/src/pcphashsha1px.c | 348 +- .../sources/ippcp/src/pcphashsha256px.c | 398 +- .../sources/ippcp/src/pcphashsha512px.c | 414 +- .../crypto_px/sources/ippcp/src/pcphmac.h | 110 +- .../crypto_px/sources/ippcp/src/pcphmacca.c | 664 +- .../sources/ippcp/src/pcpmontexpbinca.c | 232 +- .../sources/ippcp/src/pcpmontgomery.h | 380 +- .../sources/ippcp/src/pcpmontgomeryca.c | 592 +- .../crypto_px/sources/ippcp/src/pcpmontred.c | 128 +- .../crypto_px/sources/ippcp/src/pcpname.h | 112 +- .../crypto_px/sources/ippcp/src/pcpngrsa.h | 220 +- .../sources/ippcp/src/pcpngrsaencodec.c | 874 +- .../sources/ippcp/src/pcpngrsaesoaepca.c | 352 +- .../sources/ippcp/src/pcpngrsagenerate.c | 646 +- .../sources/ippcp/src/pcpngrsakeyprivate.c | 992 +- .../sources/ippcp/src/pcpngrsakeypublic.c | 544 +- .../sources/ippcp/src/pcpngrsamontstuff.c | 1062 +- .../sources/ippcp/src/pcpngrsamontstuff.h | 458 +- .../sources/ippcp/src/pcpngrsassapkcsv15ca.c | 556 +- external/crypto_px/sources/ippcp/src/pcppma.h | 166 +- .../crypto_px/sources/ippcp/src/pcpprimeg.h | 156 +- .../sources/ippcp/src/pcpprimegenca.c | 944 +- .../sources/ippcp/src/pcpprimeginitca.c | 248 +- .../crypto_px/sources/ippcp/src/pcpprng.h | 130 +- .../crypto_px/sources/ippcp/src/pcpprngenca.c | 356 +- .../sources/ippcp/src/pcpprnginitca.c | 226 +- external/crypto_px/sources/ippcp/src/pcprij.h | 282 +- .../sources/ippcp/src/pcprij128safe2.h | 158 +- .../sources/ippcp/src/pcprij128safedec2pxca.c | 266 +- .../sources/ippcp/src/pcprij128safeenc2pxca.c | 250 +- .../sources/ippcp/src/pcprijdecsboxca.c | 74 +- .../sources/ippcp/src/pcprijencsboxca.c | 74 +- .../sources/ippcp/src/pcprijkeysca.c | 392 +- .../sources/ippcp/src/pcprijtables.h | 398 +- .../crypto_px/sources/ippcp/src/pcpscramble.h | 340 +- .../crypto_px/sources/ippcp/src/pcpshsmgfca.c | 218 +- .../crypto_px/sources/ippcp/src/pcptool.h | 354 +- external/crypto_px/sources/ippcp/src/pcpver.c | 82 +- external/crypto_px/sources/ippcp/src/pcpver.h | 72 +- external/epid/LICENSE.txt | 249 + external/epid/Makefile | 52 + external/epid/NOTICE.txt | 22 + external/epid/README.md | 57 + external/epid/RELEASE_NOTES.md | 41 + external/epid/ReadMe.txt | 29 + external/epid/SConstruct | 210 + external/epid/doc/html/BuildingSdk.html | 150 + external/epid/doc/html/ChangeLog.html | 106 + external/epid/doc/html/EpidOverview.html | 172 + external/epid/doc/html/Glossary.html | 170 + .../epid/doc/html/ImplementationNotes.html | 110 + external/epid/doc/html/IssuerMaterial.html | 136 + external/epid/doc/html/LegalInformation.html | 84 + external/epid/doc/html/SdkOverview.html | 163 + .../epid/doc/html/SignVerifyTutorial.html | 192 + external/epid/doc/html/annotated.html | 136 + external/epid/doc/html/arrowdown.png | Bin 0 -> 246 bytes external/epid/doc/html/arrowright.png | Bin 0 -> 229 bytes external/epid/doc/html/basicdoc.png | Bin 0 -> 19922 bytes external/epid/doc/html/bc_s.png | Bin 0 -> 676 bytes external/epid/doc/html/bdwn.png | Bin 0 -> 147 bytes external/epid/doc/html/bignum_8c.html | 120 + external/epid/doc/html/bignum_8h.html | 124 + external/epid/doc/html/bitsupplier_8h.html | 92 + .../epid/doc/html/building__sdk_8dox.html | 82 + .../doc/html/check__privrl__entry_8c.html | 93 + external/epid/doc/html/classes.html | 113 + external/epid/doc/html/closed.png | Bin 0 -> 132 bytes external/epid/doc/html/commitment_8c.html | 98 + external/epid/doc/html/commitment_8h.html | 108 + .../epid/doc/html/decompress__privkey_8c.html | 124 + .../dir_02c945662023679b89476bd7126bc985.html | 111 + .../dir_12b90d9c027aaf878a834df729679a56.html | 96 + .../dir_512d3e62841a8535b716ec4cf8b9e950.html | 123 + .../dir_f169ebf8da29290a918fa4b3f7151050.html | 132 + .../dir_f6bef457d5f671b6e774bfccc16651f6.html | 156 + external/epid/doc/html/doc.png | Bin 0 -> 746 bytes external/epid/doc/html/doxygen.css | 1475 ++ external/epid/doc/html/doxygen.png | Bin 0 -> 3779 bytes external/epid/doc/html/dynsections.js | 97 + external/epid/doc/html/ecdsa_8h.html | 98 + external/epid/doc/html/ecdsa__sign_8c.html | 105 + external/epid/doc/html/ecdsa__verify_8c.html | 133 + external/epid/doc/html/ecgroup_8c.html | 222 + external/epid/doc/html/ecgroup_8h.html | 159 + .../epid/doc/html/endian__convert_8h.html | 92 + external/epid/doc/html/epid2params_8c.html | 98 + external/epid/doc/html/epid2params_8h.html | 105 + .../epid/doc/html/epid2params__ate_8inc.html | 82 + .../epid/doc/html/epid__overview_8dox.html | 82 + .../epid_diagram_high_level_interaction.png | Bin 0 -> 25513 bytes .../html/epid_diagram_high_level_use_case.png | Bin 0 -> 16041 bytes .../html/epid_diagram_issuer_high_level.png | Bin 0 -> 4857 bytes .../html/epid_diagram_member_high_level.png | Bin 0 -> 8319 bytes .../html/epid_diagram_verifier_high_level.png | Bin 0 -> 8897 bytes external/epid/doc/html/epidstyle.css | 325 + external/epid/doc/html/errors_8c.html | 101 + external/epid/doc/html/errors_8h.html | 122 + external/epid/doc/html/examples.html | 82 + external/epid/doc/html/examples.js | 5 + external/epid/doc/html/examples_8dox.html | 82 + external/epid/doc/html/file__parser_8c.html | 118 + external/epid/doc/html/file__parser_8h.html | 141 + external/epid/doc/html/files.html | 141 + external/epid/doc/html/finitefield_8c.html | 162 + external/epid/doc/html/finitefield_8h.html | 159 + external/epid/doc/html/folderclosed.png | Bin 0 -> 616 bytes external/epid/doc/html/folderopen.png | Bin 0 -> 597 bytes external/epid/doc/html/functions.html | 98 + external/epid/doc/html/functions_b.html | 107 + external/epid/doc/html/functions_c.html | 85 + external/epid/doc/html/functions_d.html | 90 + external/epid/doc/html/functions_e.html | 112 + external/epid/doc/html/functions_f.html | 100 + external/epid/doc/html/functions_g.html | 122 + external/epid/doc/html/functions_h.html | 98 + external/epid/doc/html/functions_k.html | 95 + external/epid/doc/html/functions_l.html | 79 + external/epid/doc/html/functions_m.html | 82 + external/epid/doc/html/functions_n.html | 102 + external/epid/doc/html/functions_p.html | 105 + external/epid/doc/html/functions_q.html | 80 + external/epid/doc/html/functions_r.html | 121 + external/epid/doc/html/functions_s.html | 113 + external/epid/doc/html/functions_t.html | 99 + external/epid/doc/html/functions_v.html | 88 + external/epid/doc/html/functions_vars.html | 98 + external/epid/doc/html/functions_vars_b.html | 107 + external/epid/doc/html/functions_vars_c.html | 85 + external/epid/doc/html/functions_vars_d.html | 90 + external/epid/doc/html/functions_vars_e.html | 112 + external/epid/doc/html/functions_vars_f.html | 100 + external/epid/doc/html/functions_vars_g.html | 122 + external/epid/doc/html/functions_vars_h.html | 98 + external/epid/doc/html/functions_vars_k.html | 95 + external/epid/doc/html/functions_vars_l.html | 79 + external/epid/doc/html/functions_vars_m.html | 82 + external/epid/doc/html/functions_vars_n.html | 102 + external/epid/doc/html/functions_vars_p.html | 105 + external/epid/doc/html/functions_vars_q.html | 80 + external/epid/doc/html/functions_vars_r.html | 121 + external/epid/doc/html/functions_vars_s.html | 113 + external/epid/doc/html/functions_vars_t.html | 99 + external/epid/doc/html/functions_vars_v.html | 88 + external/epid/doc/html/functions_vars_w.html | 83 + external/epid/doc/html/functions_vars_x.html | 95 + external/epid/doc/html/functions_vars_y.html | 83 + external/epid/doc/html/functions_w.html | 83 + external/epid/doc/html/functions_x.html | 95 + external/epid/doc/html/functions_y.html | 83 + external/epid/doc/html/get__sigsize_8c.html | 93 + external/epid/doc/html/globals.html | 80 + external/epid/doc/html/globals_b.html | 119 + external/epid/doc/html/globals_c.html | 104 + external/epid/doc/html/globals_d.html | 120 + external/epid/doc/html/globals_defs.html | 197 + external/epid/doc/html/globals_e.html | 308 + external/epid/doc/html/globals_enum.html | 86 + external/epid/doc/html/globals_eval.html | 184 + external/epid/doc/html/globals_f.html | 129 + external/epid/doc/html/globals_func.html | 80 + external/epid/doc/html/globals_func_b.html | 92 + external/epid/doc/html/globals_func_c.html | 99 + external/epid/doc/html/globals_func_d.html | 120 + external/epid/doc/html/globals_func_e.html | 287 + external/epid/doc/html/globals_func_f.html | 120 + external/epid/doc/html/globals_func_i.html | 83 + external/epid/doc/html/globals_func_m.html | 80 + external/epid/doc/html/globals_func_n.html | 107 + external/epid/doc/html/globals_func_o.html | 79 + external/epid/doc/html/globals_func_p.html | 128 + external/epid/doc/html/globals_func_r.html | 88 + external/epid/doc/html/globals_func_s.html | 99 + external/epid/doc/html/globals_func_w.html | 88 + external/epid/doc/html/globals_g.html | 79 + external/epid/doc/html/globals_h.html | 79 + external/epid/doc/html/globals_i.html | 89 + external/epid/doc/html/globals_k.html | 188 + external/epid/doc/html/globals_m.html | 86 + external/epid/doc/html/globals_n.html | 110 + external/epid/doc/html/globals_o.html | 79 + external/epid/doc/html/globals_p.html | 137 + external/epid/doc/html/globals_r.html | 100 + external/epid/doc/html/globals_s.html | 114 + external/epid/doc/html/globals_t.html | 79 + external/epid/doc/html/globals_type.html | 110 + external/epid/doc/html/globals_vars.html | 78 + external/epid/doc/html/globals_w.html | 91 + external/epid/doc/html/glossary_8dox.html | 82 + .../doc/html/group___big_num_primitives.html | 445 + .../doc/html/group___big_num_primitives.js | 12 + .../doc/html/group___ec_group_primitives.html | 1078 + .../doc/html/group___ec_group_primitives.js | 23 + .../doc/html/group___ecdsa_primitives.html | 229 + .../epid/doc/html/group___ecdsa_primitives.js | 5 + .../epid/doc/html/group___epid_common.html | 1066 + external/epid/doc/html/group___epid_common.js | 76 + external/epid/doc/html/group___epid_math.html | 106 + external/epid/doc/html/group___epid_math.js | 9 + .../doc/html/group___epid_member_module.html | 933 + .../doc/html/group___epid_member_module.js | 37 + .../epid/doc/html/group___epid_module.html | 97 + external/epid/doc/html/group___epid_module.js | 6 + .../epid/doc/html/group___epid_print.html | 660 + external/epid/doc/html/group___epid_print.js | 19 + .../epid/doc/html/group___epid_types.html | 266 + external/epid/doc/html/group___epid_types.js | 169 + .../html/group___epid_verifier_module.html | 834 + .../doc/html/group___epid_verifier_module.js | 22 + .../epid/doc/html/group___error_codes.html | 225 + external/epid/doc/html/group___error_codes.js | 24 + .../epid/doc/html/group___file_parser.html | 439 + external/epid/doc/html/group___file_parser.js | 34 + .../html/group___finite_field_primitives.html | 1048 + .../html/group___finite_field_primitives.js | 23 + .../doc/html/group___hash_primitives.html | 142 + .../epid/doc/html/group___hash_primitives.js | 7 + .../doc/html/group___pairing_primitives.html | 249 + .../doc/html/group___pairing_primitives.js | 7 + external/epid/doc/html/grouppubkey_8c.html | 96 + external/epid/doc/html/grouppubkey_8h.html | 104 + external/epid/doc/html/hash_8h.html | 102 + .../doc/html/implementation__notes_8dox.html | 82 + external/epid/doc/html/index.html | 78 + .../epid/doc/html/issuer__material_8dox.html | 82 + external/epid/doc/html/jquery.js | 68 + .../doc/html/legal__information_8dox.html | 82 + external/epid/doc/html/mainpage_8dox.html | 82 + external/epid/doc/html/member_2api_8h.html | 148 + .../epid/doc/html/member_2context_8c.html | 129 + .../epid/doc/html/member_2context_8h.html | 159 + external/epid/doc/html/memory_8c.html | 118 + external/epid/doc/html/memory_8h.html | 124 + external/epid/doc/html/modules.html | 95 + external/epid/doc/html/modules.js | 4 + external/epid/doc/html/nav_f.png | Bin 0 -> 153 bytes external/epid/doc/html/nav_g.png | Bin 0 -> 95 bytes external/epid/doc/html/nav_h.png | Bin 0 -> 98 bytes external/epid/doc/html/navtree.css | 143 + external/epid/doc/html/navtree.js | 523 + external/epid/doc/html/navtreedata.js | 91 + external/epid/doc/html/navtreeindex0.js | 253 + external/epid/doc/html/navtreeindex1.js | 203 + external/epid/doc/html/nr__prove_8c.html | 132 + external/epid/doc/html/nrverify_8c.html | 128 + external/epid/doc/html/open.png | Bin 0 -> 123 bytes external/epid/doc/html/organization_8dox.html | 82 + external/epid/doc/html/pageorder_8dox.html | 84 + external/epid/doc/html/pages.html | 89 + external/epid/doc/html/pairing_8c.html | 205 + external/epid/doc/html/pairing_8h.html | 109 + external/epid/doc/html/presig_8c.html | 161 + external/epid/doc/html/printutils_8c.html | 178 + external/epid/doc/html/printutils_8h.html | 137 + external/epid/doc/html/privkey_8c.html | 96 + external/epid/doc/html/privkey_8h.html | 104 + external/epid/doc/html/request__join_8c.html | 133 + external/epid/doc/html/resize.js | 97 + .../epid/doc/html/sdk__overview_8dox.html | 82 + external/epid/doc/html/sdk_block_diagram.png | Bin 0 -> 9193 bytes external/epid/doc/html/sha256_8c.html | 93 + external/epid/doc/html/sign_8c.html | 97 + .../doc/html/sign__verify__tutorial_8dox.html | 82 + external/epid/doc/html/signbasic_8c.html | 122 + .../epid/doc/html/signmsg_8c-example.html | 77 + external/epid/doc/html/sigrlvalid_8c.html | 94 + external/epid/doc/html/sigrlvalid_8h.html | 94 + external/epid/doc/html/sigs__linked_8c.html | 93 + external/epid/doc/html/splitbar.png | Bin 0 -> 314 bytes external/epid/doc/html/stack_8c.html | 113 + external/epid/doc/html/stack_8h.html | 105 + external/epid/doc/html/stdtypes_8h.html | 105 + .../doc/html/struct_allowed_basename.html | 105 + .../epid/doc/html/struct_basic_signature.html | 126 + .../epid/doc/html/struct_big_num_str.html | 97 + .../epid/doc/html/struct_commit_values.html | 137 + .../doc/html/struct_compressed_priv_key.html | 107 + .../doc/html/struct_ecdsa_private_key.html | 97 + .../doc/html/struct_ecdsa_public_key.html | 101 + .../epid/doc/html/struct_ecdsa_signature.html | 101 + .../epid/doc/html/struct_epid2_params.html | 130 + .../epid/doc/html/struct_epid2_params__.html | 153 + .../doc/html/struct_epid_ca_certificate.html | 130 + .../doc/html/struct_epid_file_header.html | 101 + ...struct_epid_group_pub_key_certificate.html | 115 + .../epid/doc/html/struct_epid_signature.html | 111 + .../doc/html/struct_error_text_entry.html | 99 + .../epid/doc/html/struct_fp_elem_str.html | 97 + .../epid/doc/html/struct_fq12_elem_dat.html | 95 + .../epid/doc/html/struct_fq12_elem_str.html | 97 + .../epid/doc/html/struct_fq2_elem_dat.html | 95 + .../epid/doc/html/struct_fq2_elem_str.html | 97 + .../epid/doc/html/struct_fq6_elem_dat.html | 95 + .../epid/doc/html/struct_fq6_elem_str.html | 97 + .../epid/doc/html/struct_fq_elem_dat.html | 95 + .../epid/doc/html/struct_fq_elem_str.html | 97 + .../epid/doc/html/struct_g1_elem_str.html | 101 + .../epid/doc/html/struct_g2_elem_str.html | 101 + .../epid/doc/html/struct_group_pub_key.html | 111 + .../epid/doc/html/struct_group_pub_key__.html | 109 + external/epid/doc/html/struct_group_rl.html | 107 + .../epid/doc/html/struct_gt_elem_str.html | 97 + external/epid/doc/html/struct_i_priv_key.html | 102 + .../doc/html/struct_join_p_commit_values.html | 127 + .../epid/doc/html/struct_join_request.html | 106 + external/epid/doc/html/struct_member_ctx.html | 147 + .../epid/doc/html/struct_member_precomp.html | 112 + .../html/struct_membership_credential.html | 106 + external/epid/doc/html/struct_nr_proof.html | 110 + .../html/struct_nr_verify_commit_values.html | 133 + external/epid/doc/html/struct_oct_str128.html | 97 + external/epid/doc/html/struct_oct_str16.html | 97 + external/epid/doc/html/struct_oct_str256.html | 97 + external/epid/doc/html/struct_oct_str32.html | 97 + external/epid/doc/html/struct_oct_str512.html | 97 + external/epid/doc/html/struct_oct_str64.html | 97 + external/epid/doc/html/struct_oct_str8.html | 97 + .../html/struct_pre_computed_signature.html | 138 + external/epid/doc/html/struct_priv_key.html | 111 + external/epid/doc/html/struct_priv_key__.html | 109 + external/epid/doc/html/struct_priv_rl.html | 111 + .../epid/doc/html/struct_sha256_digest.html | 97 + external/epid/doc/html/struct_sig_rl.html | 111 + .../epid/doc/html/struct_sig_rl_entry.html | 101 + external/epid/doc/html/struct_stack.html | 108 + .../epid/doc/html/struct_verifier_ctx.html | 143 + .../doc/html/struct_verifier_precomp.html | 112 + .../epid/doc/html/struct_verifier_rl.html | 111 + external/epid/doc/html/sync_off.png | Bin 0 -> 853 bytes external/epid/doc/html/sync_on.png | Bin 0 -> 845 bytes external/epid/doc/html/tab_a.png | Bin 0 -> 142 bytes external/epid/doc/html/tab_b.png | Bin 0 -> 169 bytes external/epid/doc/html/tab_h.png | Bin 0 -> 177 bytes external/epid/doc/html/tab_s.png | Bin 0 -> 184 bytes external/epid/doc/html/tabs.css | 60 + external/epid/doc/html/types_8h.html | 227 + external/epid/doc/html/verifier_2api_8h.html | 138 + .../epid/doc/html/verifier_2context_8c.html | 120 + .../epid/doc/html/verifier_2context_8h.html | 96 + external/epid/doc/html/verify_8c.html | 122 + external/epid/doc/html/verifybasic_8c.html | 125 + .../epid/doc/html/verifysig_8c-example.html | 77 + external/epid/doc/index.html | 15 + .../bignum_wrapper-testhelper.cc | 123 + .../bignum_wrapper-testhelper.h | 69 + .../common-testhelper/common-testhelper.parts | 66 + .../ecgroup_wrapper-testhelper.cc | 126 + .../ecgroup_wrapper-testhelper.h | 68 + .../ecpoint_wrapper-testhelper.cc | 123 + .../ecpoint_wrapper-testhelper.h | 75 + .../epid_params-testhelper.cc | 164 + .../epid_params-testhelper.h | 72 + .../common-testhelper/errors-testhelper.h | 41 + .../ffelement_wrapper-testhelper.cc | 141 + .../ffelement_wrapper-testhelper.h | 81 + .../finite_field_wrapper-testhelper.cc | 170 + .../finite_field_wrapper-testhelper.h | 68 + .../common-testhelper/octstr-testhelper.cc | 126 + .../common-testhelper/octstr-testhelper.h | 47 + .../epid/common-testhelper/prng-testhelper.h | 81 + .../unittests/bignum_wrapper-test.cc | 173 + .../unittests/ecgroup_wrapper-test.cc | 154 + .../unittests/ecpoint_wrapper-test.cc | 134 + .../unittests/ffelement_wrapper-test.cc | 156 + .../unittests/finite_field_wrapper-test.cc | 135 + .../common-testhelper/unittests/main-test.cc | 26 + .../verifier_wrapper-testhelper.cc | 53 + .../verifier_wrapper-testhelper.h | 55 + external/epid/epid/common/bitsupplier.h | 46 + external/epid/epid/common/commitment.c | 121 + external/epid/epid/common/commitment.h | 120 + external/epid/epid/common/common.parts | 139 + external/epid/epid/common/endian_convert.h | 38 + external/epid/epid/common/epid2params.c | 575 + external/epid/epid/common/epid2params.h | 75 + external/epid/epid/common/epid2params_ate.inc | 111 + external/epid/epid/common/errors.c | 65 + external/epid/epid/common/errors.h | 71 + external/epid/epid/common/file_parser.c | 269 + external/epid/epid/common/file_parser.h | 241 + external/epid/epid/common/grouppubkey.c | 86 + external/epid/epid/common/grouppubkey.h | 67 + .../epid/epid/common/math/bignum-internal.h | 60 + external/epid/epid/common/math/bignum.c | 266 + external/epid/epid/common/math/bignum.h | 156 + external/epid/epid/common/math/ecdsa.h | 114 + external/epid/epid/common/math/ecdsa_sign.c | 205 + external/epid/epid/common/math/ecdsa_verify.c | 351 + .../epid/epid/common/math/ecgroup-internal.h | 44 + external/epid/epid/common/math/ecgroup.c | 945 + external/epid/epid/common/math/ecgroup.h | 435 + .../epid/common/math/finitefield-internal.h | 46 + external/epid/epid/common/math/finitefield.c | 805 + external/epid/epid/common/math/finitefield.h | 403 + external/epid/epid/common/math/hash.h | 63 + .../epid/epid/common/math/pairing-internal.h | 39 + external/epid/epid/common/math/pairing.c | 2381 ++ external/epid/epid/common/math/pairing.h | 102 + external/epid/epid/common/math/printutils.c | 604 + external/epid/epid/common/math/printutils.h | 287 + external/epid/epid/common/math/sha256.c | 43 + .../epid/common/math/unittests/bignum-test.cc | 394 + .../common/math/unittests/ecdsa_sign-test.cc | 229 + .../math/unittests/ecdsa_verify-test.cc | 278 + .../common/math/unittests/ecgroup-test.cc | 1690 ++ .../common/math/unittests/ffelement-test.cc | 2543 ++ .../common/math/unittests/file_parser-test.cc | 1199 + .../common/math/unittests/finitefield-test.cc | 173 + .../epid/common/math/unittests/hash-test.cc | 87 + .../epid/common/math/unittests/main-test.cc | 26 + .../math/unittests/octstrconvert-test.cc | 72 + .../common/math/unittests/pairing-test.cc | 225 + .../common/math/unittests/printutils-test.cc | 379 + external/epid/epid/common/memory.c | 122 + external/epid/epid/common/memory.h | 123 + external/epid/epid/common/sigrlvalid.c | 49 + external/epid/epid/common/sigrlvalid.h | 46 + external/epid/epid/common/stack.c | 91 + external/epid/epid/common/stack.h | 95 + external/epid/epid/common/stdtypes.h | 37 + .../epid/common/testdata/grp01/gpubkey.inc | 53 + .../grp01/member0/sig_test0_sha256_sigrl.inc | 1222 + .../grp01/member0/sig_test0_sha384_sigrl.inc | 1222 + .../grp01/member0/sig_test0_sha512_sigrl.inc | 1222 + .../testdata/grp01/member0/sig_test1.inc | 74 + .../member0/sig_test1_basename1_sha256.inc | 85 + .../grp01/member0/sig_test1_sha256.inc | 85 + .../grp01/member0/sig_test1_sha384.inc | 85 + .../grp01/member0/sig_test1_sha512.inc | 85 + .../epid/common/testdata/grp01/privrl.inc | 277 + .../epid/epid/common/testdata/grp01/sigrl.inc | 878 + .../epid/epid/common/testdata/grp01/verrl.inc | 151 + .../testdata/grp_x/cmember9/cmpprivkey.inc | 36 + .../testdata/grp_x/cmember9/mprivkey.inc | 44 + .../epid/common/testdata/grp_x/iprivkey.inc | 31 + .../testdata/grp_x/member0/mprivkey.inc | 44 + .../grp_x/member0/sig_sha256_bsn0_msg0.inc | 135 + .../sig_sha256_bsn0_msg0_rl_singleentry.inc | 95 + .../grp_x/member0/sig_sha256_bsn0_msg1.inc | 135 + .../grp_x/member0/sig_sha256_bsn1_msg0.inc | 135 + .../grp_x/member0/sig_sha256_rndbase_msg0.inc | 135 + .../grp_x/member0/sig_sha256_rndbase_msg1.inc | 135 + .../grp_x/member0/sig_sha384_bsn0_msg0.inc | 135 + .../grp_x/member0/sig_sha384_rndbase_msg0.inc | 135 + .../grp_x/member0/sig_sha512_bsn0_msg0.inc | 135 + .../grp_x/member0/sig_sha512_rndbase_msg0.inc | 135 + .../testdata/grp_x/member1/mprivkey.inc | 44 + .../grp_x/member1/sig_sha256_bsn0_msg0.inc | 136 + .../grp_x/privrevoked/mprivatekey000.inc | 45 + .../grp_x/privrevoked/mprivatekey001.inc | 45 + .../grp_x/privrevoked/mprivatekey002.inc | 45 + .../sig_sha256_bsn0_msg0_revkey000.inc | 135 + .../sig_sha256_bsn0_msg0_revkey001.inc | 135 + .../sig_sha256_bsn0_msg0_revkey002.inc | 135 + .../epid/common/testdata/grp_x/privrl.inc | 40 + .../privrl_single_entry_revoked_key000.inc | 33 + .../epid/common/testdata/grp_x/pubkey.inc | 59 + .../grp_x/sigrevoked/mprivatekey000.inc | 45 + .../grp_x/sigrevoked/mprivatekey001.inc | 45 + .../grp_x/sigrevoked/mprivatekey002.inc | 45 + .../epid/epid/common/testdata/grp_x/sigrl.inc | 76 + ...g_sha256_bsn0_msg0_revoked_first_entry.inc | 77 + ...ig_sha256_bsn0_msg0_revoked_last_entry.inc | 77 + ..._sha256_bsn0_msg0_revoked_middle_entry.inc | 77 + .../testdata/grp_x/sigrl_single_entry.inc | 45 + .../common/testdata/grp_x/sigrl_ver_2.inc | 76 + .../grp_x/verrevoked/bsn0/mprivkey000.inc | 45 + .../grp_x/verrevoked/bsn0/mprivkey001.inc | 45 + .../grp_x/verrevoked/bsn0/mprivkey002.inc | 45 + .../bsn0/sig_revoked0sha256bsn0msg0.inc | 136 + .../bsn0/sig_revoked1sha256bsn0msg0.inc | 135 + .../bsn0/sig_revoked2sha256bsn0msg0.inc | 135 + .../testdata/grp_x/verrevoked/bsn0/verrl.inc | 68 + .../grp_x/verrevoked/bsn0/verrl_1entry.inc | 50 + .../grp_x/verrevoked/bsn1/mprivkey003.inc | 45 + .../grp_x/verrevoked/bsn1/mprivkey004.inc | 45 + .../grp_x/verrevoked/bsn1/mprivkey005.inc | 45 + .../bsn1/sig_revoked3sha256bsn1msg0.inc | 135 + .../testdata/grp_x/verrevoked/bsn1/verrl.inc | 69 + .../verrevoked/bsn1/verrl_012revoked.inc | 68 + .../testdata/grp_y/cmember9/cmpprivkey.dat | Bin 0 -> 80 bytes .../testdata/grp_y/cmember9/cmpprivkey.inc | 36 + .../epid/common/testdata/grp_y/iprivkey.inc | 32 + .../epid/common/testdata/grp_y/pubkey.inc | 59 + external/epid/epid/common/testdata/grprl.inc | 26 + .../grprl_revoked_grp_x_first_entry.inc | 31 + .../grprl_revoked_grp_x_last_entry.inc | 31 + .../grprl_revoked_grp_x_middle_entry.inc | 31 + .../grprl_single_entry_revoked_grp_x.inc | 27 + .../testdata/ikgf/groupa/member0/mprecomp.inc | 106 + .../testdata/ikgf/groupa/member0/mprivkey.inc | 36 + .../common/testdata/ikgf/groupa/privrl.inc | 38 + .../common/testdata/ikgf/groupa/pubkey.inc | 46 + .../ikgf/groupa/sig_msg0_sha256_sigrl.inc | 98 + .../ikgf/groupa/sig_sha256_bsn0_msg0.inc | 58 + .../groupa/sig_sha256_bsn0_msg0_revkey.inc | 61 + .../ikgf/groupa/sig_sha256_rndbase_msg0.inc | 98 + .../sig_sigrevoked_sha256_bsn0_msg0.inc | 98 + .../groupa/sig_test1_basename1_sha256.inc | 59 + .../groupa/sigrevokedmember0/mprivkey.inc | 36 + .../common/testdata/ikgf/groupa/sigrl.inc | 57 + .../testdata/ikgf/groupb/member0/mprivkey.inc | 36 + .../sig_grouprevoked_sha256_bsn0_msg0.inc | 98 + .../epid/epid/common/testdata/ikgf/grprl.inc | 124 + .../{inc/epid_types.h => epid/common/types.h} | 129 +- external/epid/epid/member/api.h | 482 + external/epid/epid/member/context.c | 422 + external/epid/epid/member/context.h | 85 + .../epid/epid/member/decompress_privkey.c | 290 + external/epid/epid/member/get_sigsize.c | 35 + external/epid/epid/member/member.parts | 99 + external/epid/epid/member/nr_prove.c | 288 + external/epid/epid/member/presig.c | 229 + external/epid/epid/member/privkey.c | 88 + external/epid/epid/member/privkey.h | 67 + external/epid/epid/member/request_join.c | 418 + external/epid/epid/member/sign.c | 110 + external/epid/epid/member/signbasic.c | 272 + .../member/unittests/compute_presig-test.cc | 93 + .../epid/member/unittests/context-test.cc | 264 + .../unittests/decompress_privkey-test.cc | 97 + .../epid/member/unittests/get_sigsize-test.cc | 96 + .../epid/epid/member/unittests/main-test.cc | 26 + .../member/unittests/member-testhelper.cc | 522 + .../epid/member/unittests/member-testhelper.h | 116 + .../epid/member/unittests/nr_prove-test.cc | 299 + .../epid/epid/member/unittests/presig-test.cc | 246 + .../member/unittests/request_join-test.cc | 320 + .../epid/epid/member/unittests/sign-test.cc | 1051 + .../epid/member/unittests/signbasic-test.cc | 401 + external/epid/epid/verifier/api.h | 472 + .../epid/epid/verifier/check_privrl_entry.c | 82 + external/epid/epid/verifier/context.c | 466 + external/epid/epid/verifier/context.h | 43 + external/epid/epid/verifier/nrverify.c | 243 + external/epid/epid/verifier/sigs_linked.c | 31 + .../unittests/check_privrl_entry-test.cc | 116 + .../epid/verifier/unittests/context-test.cc | 597 + .../epid/epid/verifier/unittests/main-test.cc | 26 + .../epid/verifier/unittests/nrverify-test.cc | 265 + .../verifier/unittests/sigs_linked-test.cc | 68 + .../testdata/sigrl/pub_key_sigrl_verify.inc | 39 + .../testdata/sigrl/signature_sigrl_first.inc | 54 + .../testdata/sigrl/signature_sigrl_last.inc | 54 + .../testdata/sigrl/signature_sigrl_middle.inc | 54 + .../testdata/sigrl/sigrl_five_entries.inc | 113 + .../testdata/sigrl/sigrl_single_entry.inc | 29 + .../verifier/unittests/verifier-testhelper.cc | 657 + .../verifier/unittests/verifier-testhelper.h | 252 + .../epid/verifier/unittests/verify-test.cc | 1143 + .../verifier/unittests/verifybasic-test.cc | 161 + external/epid/epid/verifier/verifier.parts | 91 + external/epid/epid/verifier/verify.c | 204 + external/epid/epid/verifier/verifybasic.c | 323 + external/epid/example/data/README.md | 161 + external/epid/example/data/cacert.bin | Bin 0 -> 324 bytes external/epid/example/data/data.parts | 70 + .../example/data/groupa/member0/mprivkey.dat | Bin 0 -> 144 bytes .../example/data/groupa/member1/mprivkey.dat | Bin 0 -> 144 bytes .../groupa/privrevokedmember0/mprivkey.dat | Bin 0 -> 144 bytes .../groupa/privrevokedmember1/mprivkey.dat | Bin 0 -> 144 bytes .../groupa/privrevokedmember2/mprivkey.dat | Bin 0 -> 144 bytes external/epid/example/data/groupa/privrl.bin | Bin 0 -> 188 bytes external/epid/example/data/groupa/pubkey.bin | Bin 0 -> 340 bytes .../groupa/sigrevokedmember0/mprivkey.dat | Bin 0 -> 144 bytes .../groupa/sigrevokedmember1/mprivkey.dat | Bin 0 -> 144 bytes .../groupa/sigrevokedmember2/mprivkey.dat | Bin 0 -> 144 bytes external/epid/example/data/groupa/sigrl.bin | Bin 0 -> 476 bytes .../example/data/groupb/member0/mprivkey.dat | Bin 0 -> 144 bytes .../groupb/privrevokedmember0/mprivkey.dat | Bin 0 -> 144 bytes external/epid/example/data/groupb/privrl.bin | Bin 0 -> 188 bytes external/epid/example/data/groupb/pubkey.bin | Bin 0 -> 340 bytes .../groupb/sigrevokedmember0/mprivkey.dat | Bin 0 -> 144 bytes external/epid/example/data/groupb/sigrl.bin | Bin 0 -> 476 bytes external/epid/example/data/grprl.bin | Bin 0 -> 876 bytes external/epid/example/data/grprl_empty.bin | Bin 0 -> 76 bytes external/epid/example/data/mprivkey.dat | Bin 0 -> 144 bytes external/epid/example/data/pubkey.bin | Bin 0 -> 340 bytes external/epid/example/signmsg/signmsg.parts | 51 + external/epid/example/signmsg/src/main.c | 385 + external/epid/example/signmsg/src/prng.c | 98 + external/epid/example/signmsg/src/prng.h | 36 + external/epid/example/signmsg/src/signmsg.c | 171 + external/epid/example/signmsg/src/signmsg.h | 42 + external/epid/example/util/argutil.h | 52 + external/epid/example/util/buffutil.h | 146 + external/epid/example/util/convutil.h | 61 + external/epid/example/util/envutil.h | 54 + external/epid/example/util/src/argutil.c | 70 + external/epid/example/util/src/bufutil.c | 355 + external/epid/example/util/src/convutil.c | 75 + external/epid/example/util/src/envutil.c | 91 + external/epid/example/util/stdtypes.h | 37 + external/epid/example/util/util.parts | 59 + external/epid/example/verifysig/src/main.c | 418 + .../epid/example/verifysig/src/verifysig.c | 233 + .../epid/example/verifysig/src/verifysig.h | 41 + .../epid/example/verifysig/verifysig.parts | 52 + external/epid/ext/gtest/LICENSE | 28 + external/epid/ext/gtest/gtest-all.cc | 9596 ++++++++ external/epid/ext/gtest/gtest.h | 20061 ++++++++++++++++ external/epid/ext/gtest/gtest.parts | 50 + external/epid/ext/ipp/include/ippbase.h | 188 + external/epid/ext/ipp/include/ippcp.h | 860 + external/epid/ext/ipp/include/ippcpdefs.h | 371 + external/epid/ext/ipp/include/ippcpepid.h | 218 + external/epid/ext/ipp/include/ippdefs.h | 126 + external/epid/ext/ipp/include/ipptypes.h | 1100 + external/epid/ext/ipp/ippcommon.parts | 56 + external/epid/ext/ipp/ippcp.parts | 82 + external/epid/ext/ipp/ippcpepid.parts | 85 + .../epid/ext/ipp/sources/include/owndefs.h | 934 + .../epid/ext/ipp/sources/ippcp/src/owncp.h | 171 + .../epid/ext/ipp/sources/ippcp/src/pcpbn.h | 203 + .../epid/ext/ipp/sources/ippcp/src/pcpbnca.c | 1286 + .../ext/ipp/sources/ippcp/src/pcpbnresource.h | 48 + .../ipp/sources/ippcp/src/pcpbnresourceca.c | 87 + .../ext/ipp/sources/ippcp/src/pcpbnsetca.c | 117 + .../ext/ipp/sources/ippcp/src/pcpbnu32arith.c | 366 + .../ext/ipp/sources/ippcp/src/pcpbnu32arith.h | 50 + .../ext/ipp/sources/ippcp/src/pcpbnu32misc.c | 229 + .../ext/ipp/sources/ippcp/src/pcpbnu32misc.h | 71 + .../ext/ipp/sources/ippcp/src/pcpbnuarith.c | 537 + .../ext/ipp/sources/ippcp/src/pcpbnuarith.h | 169 + .../ext/ipp/sources/ippcp/src/pcpbnuimpl.h | 136 + .../ext/ipp/sources/ippcp/src/pcpbnumisc.c | 294 + .../ext/ipp/sources/ippcp/src/pcpbnumisc.h | 160 + .../epid/ext/ipp/sources/ippcp/src/pcpeccp.h | 260 + .../ext/ipp/sources/ippcp/src/pcpeccpdpca.c | 801 + .../ipp/sources/ippcp/src/pcpeccpgenkeyca.c | 105 + .../ext/ipp/sources/ippcp/src/pcpeccpinitca.c | 454 + .../ext/ipp/sources/ippcp/src/pcpeccpmethod.h | 98 + .../ipp/sources/ippcp/src/pcpeccpmethod128.h | 118 + .../sources/ippcp/src/pcpeccpmethod128ca.c | 879 + .../ipp/sources/ippcp/src/pcpeccpmethod192.h | 117 + .../sources/ippcp/src/pcpeccpmethod192ca.c | 880 + .../ipp/sources/ippcp/src/pcpeccpmethod224.h | 118 + .../sources/ippcp/src/pcpeccpmethod224ca.c | 877 + .../ipp/sources/ippcp/src/pcpeccpmethod256.h | 118 + .../sources/ippcp/src/pcpeccpmethod256ca.c | 879 + .../ipp/sources/ippcp/src/pcpeccpmethod384.h | 118 + .../sources/ippcp/src/pcpeccpmethod384ca.c | 879 + .../ipp/sources/ippcp/src/pcpeccpmethod521.h | 118 + .../sources/ippcp/src/pcpeccpmethod521ca.c | 879 + .../ipp/sources/ippcp/src/pcpeccpmethodcom.h | 133 + .../sources/ippcp/src/pcpeccpmethodcomca.c | 1025 + .../ipp/sources/ippcp/src/pcpeccpmethodsm2.h | 120 + .../sources/ippcp/src/pcpeccpmethodsm2ca.c | 879 + .../ext/ipp/sources/ippcp/src/pcpeccppoint.h | 54 + .../ipp/sources/ippcp/src/pcpeccppointca.c | 126 + .../ipp/sources/ippcp/src/pcpeccppointopca.c | 482 + .../sources/ippcp/src/pcpeccppublickeyca.c | 87 + .../ipp/sources/ippcp/src/pcpeccpsetkeyca.c | 102 + .../ipp/sources/ippcp/src/pcpeccpsigndsaca.c | 146 + .../ext/ipp/sources/ippcp/src/pcpeccpsscm.c | 160 + .../ext/ipp/sources/ippcp/src/pcpeccpsscm.h | 45 + .../ext/ipp/sources/ippcp/src/pcpeccpstdca.c | 465 + .../sources/ippcp/src/pcpeccpverifydsaca.c | 173 + .../epid/ext/ipp/sources/ippcp/src/pcphash.h | 239 + .../ext/ipp/sources/ippcp/src/pcphashcnt.c | 434 + .../ext/ipp/sources/ippcp/src/pcphashmd5px.c | 211 + .../ext/ipp/sources/ippcp/src/pcphashsha1px.c | 189 + .../ipp/sources/ippcp/src/pcphashsha256px.c | 214 + .../ipp/sources/ippcp/src/pcphashsha512px.c | 221 + .../epid/ext/ipp/sources/ippcp/src/pcpmd5ca.c | 485 + .../ipp/sources/ippcp/src/pcpmontexpbinca.c | 562 + .../ext/ipp/sources/ippcp/src/pcpmontgomery.h | 282 + .../ipp/sources/ippcp/src/pcpmontgomeryca.c | 479 + .../ext/ipp/sources/ippcp/src/pcpmontred.c | 75 + .../ext/ipp/sources/ippcp/src/pcpmulbnukara.h | 84 + .../epid/ext/ipp/sources/ippcp/src/pcppma.h | 106 + .../ext/ipp/sources/ippcp/src/pcppma128.c | 169 + .../ext/ipp/sources/ippcp/src/pcppma128.h | 79 + .../ext/ipp/sources/ippcp/src/pcppma192.c | 153 + .../ext/ipp/sources/ippcp/src/pcppma192.h | 84 + .../ext/ipp/sources/ippcp/src/pcppma224.c | 169 + .../ext/ipp/sources/ippcp/src/pcppma224.h | 81 + .../ext/ipp/sources/ippcp/src/pcppma256.c | 181 + .../ext/ipp/sources/ippcp/src/pcppma256.h | 82 + .../ext/ipp/sources/ippcp/src/pcppma384.c | 191 + .../ext/ipp/sources/ippcp/src/pcppma384.h | 82 + .../ext/ipp/sources/ippcp/src/pcppma521.c | 124 + .../ext/ipp/sources/ippcp/src/pcppma521.h | 80 + .../ext/ipp/sources/ippcp/src/pcppmasm2.c | 311 + .../ext/ipp/sources/ippcp/src/pcppmasm2.h | 121 + .../ext/ipp/sources/ippcp/src/pcpprimeg.h | 72 + .../ipp/sources/ippcp/src/pcpprimeginitca.c | 158 + .../epid/ext/ipp/sources/ippcp/src/pcpprng.h | 59 + .../ext/ipp/sources/ippcp/src/pcpprngenca.c | 251 + .../ext/ipp/sources/ippcp/src/pcpprnginitca.c | 111 + .../ext/ipp/sources/ippcp/src/pcpprngsetca.c | 239 + .../ext/ipp/sources/ippcp/src/pcpsha1ca.c | 551 + .../ext/ipp/sources/ippcp/src/pcpsha256ca.c | 728 + .../ext/ipp/sources/ippcp/src/pcpsha512ca.c | 674 + .../epid/ext/ipp/sources/ippcp/src/pcptool.h | 631 + .../ext/ipp/sources/ippcp/src/pcpvariant.h | 326 + .../epid/ext/ipp/sources/ippcp/src/precomp.h | 22 + .../ipp/sources/ippcpepid/src/ippcpepid_p8.h | 44 + .../ipp/sources/ippcpepid/src/ippcpepid_y8.h | 44 + .../ext/ipp/sources/ippcpepid/src/owncpepid.h | 58 + .../ext/ipp/sources/ippcpepid/src/pcpgfp.c | 846 + .../ext/ipp/sources/ippcpepid/src/pcpgfpec.c | 322 + .../ipp/sources/ippcpepid/src/pcpgfpecpoint.c | 426 + .../ippcpepid/src/pcpgfpecpointstuff.c | 1227 + .../ipp/sources/ippcpepid/src/pcpgfpecstuff.h | 320 + .../sources/ippcpepid/src/pcpgfphashstuff.h | 117 + .../ipp/sources/ippcpepid/src/pcpgfpstuff.c | 486 + .../ipp/sources/ippcpepid/src/pcpgfpstuff.h | 212 + .../ext/ipp/sources/ippcpepid/src/pcpgfpx.c | 202 + .../ipp/sources/ippcpepid/src/pcpgfpxstuff.c | 1307 + .../ipp/sources/ippcpepid/src/pcpgfpxstuff.h | 174 + .../parts-site/configurations/__init__.py | 25 + .../configurations/debug/__init__.py | 20 + .../parts-site/configurations/debug/g++.py | 46 + .../parts-site/configurations/debug/gcc.py | 51 + .../configurations/debug/intelc_posix-any.py | 37 + .../debug/intelc_win32-any_win32-x86.py | 48 + .../debug/intelc_win32-any_win32-x86_64.py | 47 + .../debug/msvc_win32-any_win32-x86.py | 53 + .../debug/msvc_win32-any_win32-x86_64.py | 52 + .../configurations/release/__init__.py | 19 + .../parts-site/configurations/release/g++.py | 46 + .../parts-site/configurations/release/gcc.py | 53 + .../release/intelc_posix-any.py | 38 + .../release/intelc_win32-any_win32-x86.py | 52 + .../release/intelc_win32-any_win32-x86_64.py | 51 + .../release/msvc_win32-any_win32-x86.py | 57 + .../release/msvc_win32-any_win32-x86_64.py | 56 + external/rdrand/rdrand.h | 312 +- external/rdrand/src/main.c | 190 +- external/rdrand/src/rdrand.c | 770 +- external/rdrand/src/rdrand.h | 338 +- external/tinyxml/tinystr.cpp | 117 - external/tinyxml/tinystr.h | 319 - external/tinyxml/tinyxml.cpp | 1840 -- external/tinyxml/tinyxml.h | 1799 -- external/tinyxml/tinyxmlerror.cpp | 53 - external/tinyxml/tinyxmlparser.cpp | 1635 -- external/tinyxml2/tinyxml2.cpp | 2536 ++ external/tinyxml2/tinyxml2.h | 2170 ++ linux/installer/bin/install-sgx-psw.bin.tmpl | 1 + psw/Makefile | 10 +- psw/ae/Makefile | 19 +- psw/ae/aesm_service/Makefile | 129 +- .../config/aesmd_service/aesmd.conf | 2 +- .../config/aesmd_service/aesmd.service | 2 +- psw/ae/aesm_service/config/network/aesmd.conf | 2 +- .../source/aesm/application/aesm_logic.cpp | 10 +- .../source/aesm/application/aesm_logic.h | 2 +- .../source/aesm/extension/aesm_ecdsa.cpp | 2 +- .../source/aesm/extension/aesm_epid_blob.cpp | 31 +- .../source/aesm/extension/aesm_epid_blob.h | 6 +- .../source/aesm/extension/aesm_http_msg.cpp | 4 + .../aesm/extension/aesm_long_lived_thread.cpp | 2 +- .../aesm/extension/endpoint_select_info.cpp | 2 +- .../aesm/extension/type_length_value.cpp | 4 +- .../source/aesm/extension/type_length_value.h | 28 +- .../epid_endpoint_selection.cpp | 2 +- .../epid_provision/epid_provision_msg1.cpp | 27 +- .../epid_provision/epid_provision_msg2.cpp | 66 +- .../epid_provision/epid_provision_msg4.cpp | 34 +- .../source/epid_provision/epid_utility.cpp | 4 +- psw/ae/aesm_service/source/le/LEClass.cpp | 19 +- psw/ae/aesm_service/source/le/LEClass.h | 2 + .../aesm_service/source/oal/internal_log.cpp | 4 +- psw/ae/aesm_service/source/protobuf/Makefile | 2 + .../aesm_service/source/pve/prov_msg_size.h | 12 +- psw/ae/aesm_service/source/pve/pve_logic.cpp | 10 +- psw/ae/aesm_service/source/qe/qe_logic.cpp | 5 +- .../source/upse/platform_info_blob.h | 2 +- psw/ae/buildenv.mk | 8 +- psw/ae/common/proto/Makefile | 2 + psw/ae/common/proto/messages.proto | 52 +- psw/ae/common/pve_qe_common.cpp | 113 + psw/ae/common/se_ecdsa_verify_internal.cpp | 281 + psw/ae/common/se_sig_rl.cpp | 6 +- .../NonBlockingUnixCommunicationSocket.cpp | 4 +- psw/ae/common/version.cpp | 33 + .../linux/service_enclave_mrsigner.hh | 2 +- psw/ae/data/prebuilt/le_prod_css.bin | Bin 1808 -> 1808 bytes psw/ae/inc/aeerror.h | 6 +- psw/ae/inc/internal/cipher.h | 124 - psw/ae/inc/internal/epid_pve_type.h | 68 +- .../inc/internal/se_ecdsa_verify_internal.h | 57 + psw/ae/inc/se_sig_rl.h | 4 +- psw/ae/le/Makefile | 20 +- psw/ae/le/config_linux.xml | 2 +- psw/ae/le/launch_enclave.cpp | 10 +- psw/ae/pce/Makefile | 88 + psw/ae/pce/config.xml | 12 + psw/ae/pce/pce.cpp | 293 + psw/ae/pce/pce_helper.cpp | 244 + psw/ae/pve/Makefile | 97 + psw/ae/pve/cipher.cpp | 219 + psw/ae/pve/cipher.h | 106 + psw/ae/pve/config.xml | 12 + psw/ae/pve/endpoint_selection.cpp | 70 + psw/ae/pve/helper.cpp | 234 + psw/ae/pve/helper.h | 85 + psw/ae/pve/msg3_parm.h | 71 + psw/ae/pve/protocol.h | 73 + psw/ae/pve/provision_enclave.cpp | 211 + psw/ae/{inc/internal => pve}/provision_msg.h | 13 +- psw/ae/pve/provision_msg1.cpp | 142 + psw/ae/pve/provision_msg2.cpp | 267 + psw/ae/pve/provision_msg3.cpp | 510 + psw/ae/pve/provision_msg4.cpp | 262 + psw/ae/pve/pve_hardcoded_tlv_data.h | 52 + psw/ae/pve/pve_rng.cpp | 55 + psw/ae/pve/pve_verify_signature.cpp | 182 + psw/ae/qe/Makefile | 80 + psw/ae/qe/config.xml | 13 + psw/ae/qe/quoting_enclave.cpp | 1145 + psw/uae_service/linux/Makefile | 55 +- psw/uae_service/linux/uae_service.lds | 16 + .../uae_wrapper/src/AEServicesImpl.cpp | 9 +- psw/uae_service/uae_wrapper/src/uae_api.cpp | 2 +- psw/urts/linux/Makefile | 34 +- psw/urts/linux/enclave_creator_hw.cpp | 21 +- psw/urts/linux/urts.lds | 13 + psw/urts/loader.cpp | 56 +- psw/urts/loader.h | 2 +- psw/urts/parser/binparser.h | 2 + psw/urts/parser/elfparser.cpp | 16 + psw/urts/parser/elfparser.h | 1 + psw/urts/section_info.h | 2 +- sdk/Makefile | 201 +- sdk/Makefile.opt_lib | 245 + sdk/Makefile.source | 227 + sdk/compiler-rt/Makefile | 2 +- sdk/cpprt/Makefile | 2 +- sdk/cpprt/linux/guard.cc | 52 +- sdk/debugger_interface/linux/Makefile | 2 +- .../linux/gdb-sgx-plugin/gdb_sgx_plugin.py | 14 +- sdk/debugger_interface/linux/se_ptrace.c | 26 +- sdk/ec_dh_lib/Makefile | 4 +- sdk/sample_libcrypto/Makefile | 28 +- sdk/selib/linux/Makefile | 4 +- sdk/sign_tool/SignTool/Makefile | 33 +- sdk/sign_tool/SignTool/README.txt | 38 +- sdk/sign_tool/SignTool/elf_helper.h | 22 +- sdk/sign_tool/SignTool/manage_metadata.cpp | 71 +- sdk/sign_tool/SignTool/manage_metadata.h | 2 +- sdk/sign_tool/SignTool/sign_tool.cpp | 52 +- sdk/sign_tool/SignTool/util_st.cpp | 2 +- sdk/sign_tool/SignTool/util_st.h | 37 +- sdk/simulation/Makefile | 2 + sdk/simulation/tae_service_sim/Makefile | 12 +- sdk/simulation/tinst/deriv.cpp | 23 +- sdk/simulation/tinst/deriv.h | 2 +- sdk/simulation/tinst/rts_sim.h | 2 +- sdk/simulation/tinst/t_instructions.cpp | 4 +- sdk/simulation/trtssim/linux/Makefile | 4 +- sdk/simulation/uae_service_sim/linux/Makefile | 49 +- .../linux/platform_service_sim.cpp | 4 + .../uae_service_sim/quoting_sim.cpp | 6 +- sdk/simulation/uinst/Makefile | 2 +- .../urtssim/enclave_creator_sim.cpp | 2 +- sdk/simulation/urtssim/linux/Makefile | 47 +- sdk/tae_service/Makefile | 11 +- sdk/tkey_exchange/Makefile | 19 +- sdk/tlibc/Makefile | 9 +- sdk/tlibc/gen/__strlen_chk.cpp | 126 +- sdk/tlibc/math/w_drem.c | 14 + sdk/tlibc/math/w_dremf.c | 14 + .../math/w_dreml.c} | 18 +- sdk/tlibc/math/w_pow10.c | 39 + sdk/tlibc/math/w_pow10f.c | 39 + sdk/tlibc/math/w_pow10l.c | 42 + sdk/tlibc/stdio/fvwrite.h | 2 +- sdk/tlibc/string/memcmp.c | 7 + sdk/tlibc/string/memcpy.c | 7 + sdk/tlibc/string/memset.c | 7 + sdk/tlibc/string/se_string_init.c | 76 + sdk/tlibc/string/strchr.c | 7 + sdk/tlibc/string/strcmp.c | 7 + sdk/tlibc/string/strcspn.c | 7 + sdk/tlibc/string/strerror_r.c | 200 +- sdk/tlibc/string/strlen.c | 7 + sdk/tlibc/string/strncat.c | 7 + sdk/tlibc/string/strncmp.c | 7 + sdk/tlibc/string/strncpy.c | 7 + sdk/tlibc/string/strpbrk.c | 7 + sdk/tlibc/string/strrchr.c | 7 + sdk/tlibc/string/strspn.c | 7 + sdk/tlibc/string/strtok.c | 7 + sdk/tlibcrypto/Makefile | 32 +- sdk/tlibcrypto/init_tcrypto_lib.cpp | 142 + sdk/tlibcrypto/sgx_ecc256.cpp | 111 - sdk/tlibcrypto/sgx_ecc256_common.h | 1 - sdk/tlibthread/Makefile | 4 +- sdk/trts/init_optimized_lib.cpp | 24 +- sdk/trts/linux/Makefile | 5 +- sdk/trts/linux/trts_pic.S | 32 +- sdk/trts/trts.cpp | 6 +- sdk/trts/trts_veh.cpp | 3 + sdk/tseal/linux/Makefile | 4 +- sdk/ukey_exchange/Makefile | 6 +- 989 files changed, 181441 insertions(+), 28625 deletions(-) delete mode 100644 Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/PageLayouts/Default.flpgl rename common/inc/{ => internal}/sgx_sha256_128.h (100%) create mode 100644 external/epid/LICENSE.txt create mode 100644 external/epid/Makefile create mode 100644 external/epid/NOTICE.txt create mode 100644 external/epid/README.md create mode 100644 external/epid/RELEASE_NOTES.md create mode 100644 external/epid/ReadMe.txt create mode 100644 external/epid/SConstruct create mode 100644 external/epid/doc/html/BuildingSdk.html create mode 100644 external/epid/doc/html/ChangeLog.html create mode 100644 external/epid/doc/html/EpidOverview.html create mode 100644 external/epid/doc/html/Glossary.html create mode 100644 external/epid/doc/html/ImplementationNotes.html create mode 100644 external/epid/doc/html/IssuerMaterial.html create mode 100644 external/epid/doc/html/LegalInformation.html create mode 100644 external/epid/doc/html/SdkOverview.html create mode 100644 external/epid/doc/html/SignVerifyTutorial.html create mode 100644 external/epid/doc/html/annotated.html create mode 100644 external/epid/doc/html/arrowdown.png create mode 100644 external/epid/doc/html/arrowright.png create mode 100644 external/epid/doc/html/basicdoc.png create mode 100644 external/epid/doc/html/bc_s.png create mode 100644 external/epid/doc/html/bdwn.png create mode 100644 external/epid/doc/html/bignum_8c.html create mode 100644 external/epid/doc/html/bignum_8h.html create mode 100644 external/epid/doc/html/bitsupplier_8h.html create mode 100644 external/epid/doc/html/building__sdk_8dox.html create mode 100644 external/epid/doc/html/check__privrl__entry_8c.html create mode 100644 external/epid/doc/html/classes.html create mode 100644 external/epid/doc/html/closed.png create mode 100644 external/epid/doc/html/commitment_8c.html create mode 100644 external/epid/doc/html/commitment_8h.html create mode 100644 external/epid/doc/html/decompress__privkey_8c.html create mode 100644 external/epid/doc/html/dir_02c945662023679b89476bd7126bc985.html create mode 100644 external/epid/doc/html/dir_12b90d9c027aaf878a834df729679a56.html create mode 100644 external/epid/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html create mode 100644 external/epid/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html create mode 100644 external/epid/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html create mode 100644 external/epid/doc/html/doc.png create mode 100644 external/epid/doc/html/doxygen.css create mode 100644 external/epid/doc/html/doxygen.png create mode 100644 external/epid/doc/html/dynsections.js create mode 100644 external/epid/doc/html/ecdsa_8h.html create mode 100644 external/epid/doc/html/ecdsa__sign_8c.html create mode 100644 external/epid/doc/html/ecdsa__verify_8c.html create mode 100644 external/epid/doc/html/ecgroup_8c.html create mode 100644 external/epid/doc/html/ecgroup_8h.html create mode 100644 external/epid/doc/html/endian__convert_8h.html create mode 100644 external/epid/doc/html/epid2params_8c.html create mode 100644 external/epid/doc/html/epid2params_8h.html create mode 100644 external/epid/doc/html/epid2params__ate_8inc.html create mode 100644 external/epid/doc/html/epid__overview_8dox.html create mode 100644 external/epid/doc/html/epid_diagram_high_level_interaction.png create mode 100644 external/epid/doc/html/epid_diagram_high_level_use_case.png create mode 100644 external/epid/doc/html/epid_diagram_issuer_high_level.png create mode 100644 external/epid/doc/html/epid_diagram_member_high_level.png create mode 100644 external/epid/doc/html/epid_diagram_verifier_high_level.png create mode 100644 external/epid/doc/html/epidstyle.css create mode 100644 external/epid/doc/html/errors_8c.html create mode 100644 external/epid/doc/html/errors_8h.html create mode 100644 external/epid/doc/html/examples.html create mode 100644 external/epid/doc/html/examples.js create mode 100644 external/epid/doc/html/examples_8dox.html create mode 100644 external/epid/doc/html/file__parser_8c.html create mode 100644 external/epid/doc/html/file__parser_8h.html create mode 100644 external/epid/doc/html/files.html create mode 100644 external/epid/doc/html/finitefield_8c.html create mode 100644 external/epid/doc/html/finitefield_8h.html create mode 100644 external/epid/doc/html/folderclosed.png create mode 100644 external/epid/doc/html/folderopen.png create mode 100644 external/epid/doc/html/functions.html create mode 100644 external/epid/doc/html/functions_b.html create mode 100644 external/epid/doc/html/functions_c.html create mode 100644 external/epid/doc/html/functions_d.html create mode 100644 external/epid/doc/html/functions_e.html create mode 100644 external/epid/doc/html/functions_f.html create mode 100644 external/epid/doc/html/functions_g.html create mode 100644 external/epid/doc/html/functions_h.html create mode 100644 external/epid/doc/html/functions_k.html create mode 100644 external/epid/doc/html/functions_l.html create mode 100644 external/epid/doc/html/functions_m.html create mode 100644 external/epid/doc/html/functions_n.html create mode 100644 external/epid/doc/html/functions_p.html create mode 100644 external/epid/doc/html/functions_q.html create mode 100644 external/epid/doc/html/functions_r.html create mode 100644 external/epid/doc/html/functions_s.html create mode 100644 external/epid/doc/html/functions_t.html create mode 100644 external/epid/doc/html/functions_v.html create mode 100644 external/epid/doc/html/functions_vars.html create mode 100644 external/epid/doc/html/functions_vars_b.html create mode 100644 external/epid/doc/html/functions_vars_c.html create mode 100644 external/epid/doc/html/functions_vars_d.html create mode 100644 external/epid/doc/html/functions_vars_e.html create mode 100644 external/epid/doc/html/functions_vars_f.html create mode 100644 external/epid/doc/html/functions_vars_g.html create mode 100644 external/epid/doc/html/functions_vars_h.html create mode 100644 external/epid/doc/html/functions_vars_k.html create mode 100644 external/epid/doc/html/functions_vars_l.html create mode 100644 external/epid/doc/html/functions_vars_m.html create mode 100644 external/epid/doc/html/functions_vars_n.html create mode 100644 external/epid/doc/html/functions_vars_p.html create mode 100644 external/epid/doc/html/functions_vars_q.html create mode 100644 external/epid/doc/html/functions_vars_r.html create mode 100644 external/epid/doc/html/functions_vars_s.html create mode 100644 external/epid/doc/html/functions_vars_t.html create mode 100644 external/epid/doc/html/functions_vars_v.html create mode 100644 external/epid/doc/html/functions_vars_w.html create mode 100644 external/epid/doc/html/functions_vars_x.html create mode 100644 external/epid/doc/html/functions_vars_y.html create mode 100644 external/epid/doc/html/functions_w.html create mode 100644 external/epid/doc/html/functions_x.html create mode 100644 external/epid/doc/html/functions_y.html create mode 100644 external/epid/doc/html/get__sigsize_8c.html create mode 100644 external/epid/doc/html/globals.html create mode 100644 external/epid/doc/html/globals_b.html create mode 100644 external/epid/doc/html/globals_c.html create mode 100644 external/epid/doc/html/globals_d.html create mode 100644 external/epid/doc/html/globals_defs.html create mode 100644 external/epid/doc/html/globals_e.html create mode 100644 external/epid/doc/html/globals_enum.html create mode 100644 external/epid/doc/html/globals_eval.html create mode 100644 external/epid/doc/html/globals_f.html create mode 100644 external/epid/doc/html/globals_func.html create mode 100644 external/epid/doc/html/globals_func_b.html create mode 100644 external/epid/doc/html/globals_func_c.html create mode 100644 external/epid/doc/html/globals_func_d.html create mode 100644 external/epid/doc/html/globals_func_e.html create mode 100644 external/epid/doc/html/globals_func_f.html create mode 100644 external/epid/doc/html/globals_func_i.html create mode 100644 external/epid/doc/html/globals_func_m.html create mode 100644 external/epid/doc/html/globals_func_n.html create mode 100644 external/epid/doc/html/globals_func_o.html create mode 100644 external/epid/doc/html/globals_func_p.html create mode 100644 external/epid/doc/html/globals_func_r.html create mode 100644 external/epid/doc/html/globals_func_s.html create mode 100644 external/epid/doc/html/globals_func_w.html create mode 100644 external/epid/doc/html/globals_g.html create mode 100644 external/epid/doc/html/globals_h.html create mode 100644 external/epid/doc/html/globals_i.html create mode 100644 external/epid/doc/html/globals_k.html create mode 100644 external/epid/doc/html/globals_m.html create mode 100644 external/epid/doc/html/globals_n.html create mode 100644 external/epid/doc/html/globals_o.html create mode 100644 external/epid/doc/html/globals_p.html create mode 100644 external/epid/doc/html/globals_r.html create mode 100644 external/epid/doc/html/globals_s.html create mode 100644 external/epid/doc/html/globals_t.html create mode 100644 external/epid/doc/html/globals_type.html create mode 100644 external/epid/doc/html/globals_vars.html create mode 100644 external/epid/doc/html/globals_w.html create mode 100644 external/epid/doc/html/glossary_8dox.html create mode 100644 external/epid/doc/html/group___big_num_primitives.html create mode 100644 external/epid/doc/html/group___big_num_primitives.js create mode 100644 external/epid/doc/html/group___ec_group_primitives.html create mode 100644 external/epid/doc/html/group___ec_group_primitives.js create mode 100644 external/epid/doc/html/group___ecdsa_primitives.html create mode 100644 external/epid/doc/html/group___ecdsa_primitives.js create mode 100644 external/epid/doc/html/group___epid_common.html create mode 100644 external/epid/doc/html/group___epid_common.js create mode 100644 external/epid/doc/html/group___epid_math.html create mode 100644 external/epid/doc/html/group___epid_math.js create mode 100644 external/epid/doc/html/group___epid_member_module.html create mode 100644 external/epid/doc/html/group___epid_member_module.js create mode 100644 external/epid/doc/html/group___epid_module.html create mode 100644 external/epid/doc/html/group___epid_module.js create mode 100644 external/epid/doc/html/group___epid_print.html create mode 100644 external/epid/doc/html/group___epid_print.js create mode 100644 external/epid/doc/html/group___epid_types.html create mode 100644 external/epid/doc/html/group___epid_types.js create mode 100644 external/epid/doc/html/group___epid_verifier_module.html create mode 100644 external/epid/doc/html/group___epid_verifier_module.js create mode 100644 external/epid/doc/html/group___error_codes.html create mode 100644 external/epid/doc/html/group___error_codes.js create mode 100644 external/epid/doc/html/group___file_parser.html create mode 100644 external/epid/doc/html/group___file_parser.js create mode 100644 external/epid/doc/html/group___finite_field_primitives.html create mode 100644 external/epid/doc/html/group___finite_field_primitives.js create mode 100644 external/epid/doc/html/group___hash_primitives.html create mode 100644 external/epid/doc/html/group___hash_primitives.js create mode 100644 external/epid/doc/html/group___pairing_primitives.html create mode 100644 external/epid/doc/html/group___pairing_primitives.js create mode 100644 external/epid/doc/html/grouppubkey_8c.html create mode 100644 external/epid/doc/html/grouppubkey_8h.html create mode 100644 external/epid/doc/html/hash_8h.html create mode 100644 external/epid/doc/html/implementation__notes_8dox.html create mode 100644 external/epid/doc/html/index.html create mode 100644 external/epid/doc/html/issuer__material_8dox.html create mode 100644 external/epid/doc/html/jquery.js create mode 100644 external/epid/doc/html/legal__information_8dox.html create mode 100644 external/epid/doc/html/mainpage_8dox.html create mode 100644 external/epid/doc/html/member_2api_8h.html create mode 100644 external/epid/doc/html/member_2context_8c.html create mode 100644 external/epid/doc/html/member_2context_8h.html create mode 100644 external/epid/doc/html/memory_8c.html create mode 100644 external/epid/doc/html/memory_8h.html create mode 100644 external/epid/doc/html/modules.html create mode 100644 external/epid/doc/html/modules.js create mode 100644 external/epid/doc/html/nav_f.png create mode 100644 external/epid/doc/html/nav_g.png create mode 100644 external/epid/doc/html/nav_h.png create mode 100644 external/epid/doc/html/navtree.css create mode 100644 external/epid/doc/html/navtree.js create mode 100644 external/epid/doc/html/navtreedata.js create mode 100644 external/epid/doc/html/navtreeindex0.js create mode 100644 external/epid/doc/html/navtreeindex1.js create mode 100644 external/epid/doc/html/nr__prove_8c.html create mode 100644 external/epid/doc/html/nrverify_8c.html create mode 100644 external/epid/doc/html/open.png create mode 100644 external/epid/doc/html/organization_8dox.html create mode 100644 external/epid/doc/html/pageorder_8dox.html create mode 100644 external/epid/doc/html/pages.html create mode 100644 external/epid/doc/html/pairing_8c.html create mode 100644 external/epid/doc/html/pairing_8h.html create mode 100644 external/epid/doc/html/presig_8c.html create mode 100644 external/epid/doc/html/printutils_8c.html create mode 100644 external/epid/doc/html/printutils_8h.html create mode 100644 external/epid/doc/html/privkey_8c.html create mode 100644 external/epid/doc/html/privkey_8h.html create mode 100644 external/epid/doc/html/request__join_8c.html create mode 100644 external/epid/doc/html/resize.js create mode 100644 external/epid/doc/html/sdk__overview_8dox.html create mode 100644 external/epid/doc/html/sdk_block_diagram.png create mode 100644 external/epid/doc/html/sha256_8c.html create mode 100644 external/epid/doc/html/sign_8c.html create mode 100644 external/epid/doc/html/sign__verify__tutorial_8dox.html create mode 100644 external/epid/doc/html/signbasic_8c.html create mode 100644 external/epid/doc/html/signmsg_8c-example.html create mode 100644 external/epid/doc/html/sigrlvalid_8c.html create mode 100644 external/epid/doc/html/sigrlvalid_8h.html create mode 100644 external/epid/doc/html/sigs__linked_8c.html create mode 100644 external/epid/doc/html/splitbar.png create mode 100644 external/epid/doc/html/stack_8c.html create mode 100644 external/epid/doc/html/stack_8h.html create mode 100644 external/epid/doc/html/stdtypes_8h.html create mode 100644 external/epid/doc/html/struct_allowed_basename.html create mode 100644 external/epid/doc/html/struct_basic_signature.html create mode 100644 external/epid/doc/html/struct_big_num_str.html create mode 100644 external/epid/doc/html/struct_commit_values.html create mode 100644 external/epid/doc/html/struct_compressed_priv_key.html create mode 100644 external/epid/doc/html/struct_ecdsa_private_key.html create mode 100644 external/epid/doc/html/struct_ecdsa_public_key.html create mode 100644 external/epid/doc/html/struct_ecdsa_signature.html create mode 100644 external/epid/doc/html/struct_epid2_params.html create mode 100644 external/epid/doc/html/struct_epid2_params__.html create mode 100644 external/epid/doc/html/struct_epid_ca_certificate.html create mode 100644 external/epid/doc/html/struct_epid_file_header.html create mode 100644 external/epid/doc/html/struct_epid_group_pub_key_certificate.html create mode 100644 external/epid/doc/html/struct_epid_signature.html create mode 100644 external/epid/doc/html/struct_error_text_entry.html create mode 100644 external/epid/doc/html/struct_fp_elem_str.html create mode 100644 external/epid/doc/html/struct_fq12_elem_dat.html create mode 100644 external/epid/doc/html/struct_fq12_elem_str.html create mode 100644 external/epid/doc/html/struct_fq2_elem_dat.html create mode 100644 external/epid/doc/html/struct_fq2_elem_str.html create mode 100644 external/epid/doc/html/struct_fq6_elem_dat.html create mode 100644 external/epid/doc/html/struct_fq6_elem_str.html create mode 100644 external/epid/doc/html/struct_fq_elem_dat.html create mode 100644 external/epid/doc/html/struct_fq_elem_str.html create mode 100644 external/epid/doc/html/struct_g1_elem_str.html create mode 100644 external/epid/doc/html/struct_g2_elem_str.html create mode 100644 external/epid/doc/html/struct_group_pub_key.html create mode 100644 external/epid/doc/html/struct_group_pub_key__.html create mode 100644 external/epid/doc/html/struct_group_rl.html create mode 100644 external/epid/doc/html/struct_gt_elem_str.html create mode 100644 external/epid/doc/html/struct_i_priv_key.html create mode 100644 external/epid/doc/html/struct_join_p_commit_values.html create mode 100644 external/epid/doc/html/struct_join_request.html create mode 100644 external/epid/doc/html/struct_member_ctx.html create mode 100644 external/epid/doc/html/struct_member_precomp.html create mode 100644 external/epid/doc/html/struct_membership_credential.html create mode 100644 external/epid/doc/html/struct_nr_proof.html create mode 100644 external/epid/doc/html/struct_nr_verify_commit_values.html create mode 100644 external/epid/doc/html/struct_oct_str128.html create mode 100644 external/epid/doc/html/struct_oct_str16.html create mode 100644 external/epid/doc/html/struct_oct_str256.html create mode 100644 external/epid/doc/html/struct_oct_str32.html create mode 100644 external/epid/doc/html/struct_oct_str512.html create mode 100644 external/epid/doc/html/struct_oct_str64.html create mode 100644 external/epid/doc/html/struct_oct_str8.html create mode 100644 external/epid/doc/html/struct_pre_computed_signature.html create mode 100644 external/epid/doc/html/struct_priv_key.html create mode 100644 external/epid/doc/html/struct_priv_key__.html create mode 100644 external/epid/doc/html/struct_priv_rl.html create mode 100644 external/epid/doc/html/struct_sha256_digest.html create mode 100644 external/epid/doc/html/struct_sig_rl.html create mode 100644 external/epid/doc/html/struct_sig_rl_entry.html create mode 100644 external/epid/doc/html/struct_stack.html create mode 100644 external/epid/doc/html/struct_verifier_ctx.html create mode 100644 external/epid/doc/html/struct_verifier_precomp.html create mode 100644 external/epid/doc/html/struct_verifier_rl.html create mode 100644 external/epid/doc/html/sync_off.png create mode 100644 external/epid/doc/html/sync_on.png create mode 100644 external/epid/doc/html/tab_a.png create mode 100644 external/epid/doc/html/tab_b.png create mode 100644 external/epid/doc/html/tab_h.png create mode 100644 external/epid/doc/html/tab_s.png create mode 100644 external/epid/doc/html/tabs.css create mode 100644 external/epid/doc/html/types_8h.html create mode 100644 external/epid/doc/html/verifier_2api_8h.html create mode 100644 external/epid/doc/html/verifier_2context_8c.html create mode 100644 external/epid/doc/html/verifier_2context_8h.html create mode 100644 external/epid/doc/html/verify_8c.html create mode 100644 external/epid/doc/html/verifybasic_8c.html create mode 100644 external/epid/doc/html/verifysig_8c-example.html create mode 100644 external/epid/doc/index.html create mode 100644 external/epid/epid/common-testhelper/bignum_wrapper-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/bignum_wrapper-testhelper.h create mode 100644 external/epid/epid/common-testhelper/common-testhelper.parts create mode 100644 external/epid/epid/common-testhelper/ecgroup_wrapper-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/ecgroup_wrapper-testhelper.h create mode 100644 external/epid/epid/common-testhelper/ecpoint_wrapper-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/ecpoint_wrapper-testhelper.h create mode 100644 external/epid/epid/common-testhelper/epid_params-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/epid_params-testhelper.h create mode 100644 external/epid/epid/common-testhelper/errors-testhelper.h create mode 100644 external/epid/epid/common-testhelper/ffelement_wrapper-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/ffelement_wrapper-testhelper.h create mode 100644 external/epid/epid/common-testhelper/finite_field_wrapper-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/finite_field_wrapper-testhelper.h create mode 100644 external/epid/epid/common-testhelper/octstr-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/octstr-testhelper.h create mode 100644 external/epid/epid/common-testhelper/prng-testhelper.h create mode 100644 external/epid/epid/common-testhelper/unittests/bignum_wrapper-test.cc create mode 100644 external/epid/epid/common-testhelper/unittests/ecgroup_wrapper-test.cc create mode 100644 external/epid/epid/common-testhelper/unittests/ecpoint_wrapper-test.cc create mode 100644 external/epid/epid/common-testhelper/unittests/ffelement_wrapper-test.cc create mode 100644 external/epid/epid/common-testhelper/unittests/finite_field_wrapper-test.cc create mode 100644 external/epid/epid/common-testhelper/unittests/main-test.cc create mode 100644 external/epid/epid/common-testhelper/verifier_wrapper-testhelper.cc create mode 100644 external/epid/epid/common-testhelper/verifier_wrapper-testhelper.h create mode 100644 external/epid/epid/common/bitsupplier.h create mode 100644 external/epid/epid/common/commitment.c create mode 100644 external/epid/epid/common/commitment.h create mode 100644 external/epid/epid/common/common.parts create mode 100644 external/epid/epid/common/endian_convert.h create mode 100644 external/epid/epid/common/epid2params.c create mode 100644 external/epid/epid/common/epid2params.h create mode 100644 external/epid/epid/common/epid2params_ate.inc create mode 100644 external/epid/epid/common/errors.c create mode 100644 external/epid/epid/common/errors.h create mode 100644 external/epid/epid/common/file_parser.c create mode 100644 external/epid/epid/common/file_parser.h create mode 100644 external/epid/epid/common/grouppubkey.c create mode 100644 external/epid/epid/common/grouppubkey.h create mode 100644 external/epid/epid/common/math/bignum-internal.h create mode 100644 external/epid/epid/common/math/bignum.c create mode 100644 external/epid/epid/common/math/bignum.h create mode 100644 external/epid/epid/common/math/ecdsa.h create mode 100644 external/epid/epid/common/math/ecdsa_sign.c create mode 100644 external/epid/epid/common/math/ecdsa_verify.c create mode 100644 external/epid/epid/common/math/ecgroup-internal.h create mode 100644 external/epid/epid/common/math/ecgroup.c create mode 100644 external/epid/epid/common/math/ecgroup.h create mode 100644 external/epid/epid/common/math/finitefield-internal.h create mode 100644 external/epid/epid/common/math/finitefield.c create mode 100644 external/epid/epid/common/math/finitefield.h create mode 100644 external/epid/epid/common/math/hash.h create mode 100644 external/epid/epid/common/math/pairing-internal.h create mode 100644 external/epid/epid/common/math/pairing.c create mode 100644 external/epid/epid/common/math/pairing.h create mode 100644 external/epid/epid/common/math/printutils.c create mode 100644 external/epid/epid/common/math/printutils.h create mode 100644 external/epid/epid/common/math/sha256.c create mode 100644 external/epid/epid/common/math/unittests/bignum-test.cc create mode 100644 external/epid/epid/common/math/unittests/ecdsa_sign-test.cc create mode 100644 external/epid/epid/common/math/unittests/ecdsa_verify-test.cc create mode 100644 external/epid/epid/common/math/unittests/ecgroup-test.cc create mode 100644 external/epid/epid/common/math/unittests/ffelement-test.cc create mode 100644 external/epid/epid/common/math/unittests/file_parser-test.cc create mode 100644 external/epid/epid/common/math/unittests/finitefield-test.cc create mode 100644 external/epid/epid/common/math/unittests/hash-test.cc create mode 100644 external/epid/epid/common/math/unittests/main-test.cc create mode 100644 external/epid/epid/common/math/unittests/octstrconvert-test.cc create mode 100644 external/epid/epid/common/math/unittests/pairing-test.cc create mode 100644 external/epid/epid/common/math/unittests/printutils-test.cc create mode 100644 external/epid/epid/common/memory.c create mode 100644 external/epid/epid/common/memory.h create mode 100644 external/epid/epid/common/sigrlvalid.c create mode 100644 external/epid/epid/common/sigrlvalid.h create mode 100644 external/epid/epid/common/stack.c create mode 100644 external/epid/epid/common/stack.h create mode 100644 external/epid/epid/common/stdtypes.h create mode 100644 external/epid/epid/common/testdata/grp01/gpubkey.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test0_sha256_sigrl.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test0_sha384_sigrl.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test0_sha512_sigrl.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test1.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test1_basename1_sha256.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test1_sha256.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test1_sha384.inc create mode 100644 external/epid/epid/common/testdata/grp01/member0/sig_test1_sha512.inc create mode 100644 external/epid/epid/common/testdata/grp01/privrl.inc create mode 100644 external/epid/epid/common/testdata/grp01/sigrl.inc create mode 100644 external/epid/epid/common/testdata/grp01/verrl.inc create mode 100644 external/epid/epid/common/testdata/grp_x/cmember9/cmpprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_x/cmember9/mprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_x/iprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/mprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha256_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha256_bsn0_msg0_rl_singleentry.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha256_bsn0_msg1.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha256_bsn1_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha256_rndbase_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha256_rndbase_msg1.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha384_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha384_rndbase_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha512_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member0/sig_sha512_rndbase_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member1/mprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_x/member1/sig_sha256_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrevoked/mprivatekey000.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrevoked/mprivatekey001.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrevoked/mprivatekey002.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrevoked/signatures/sig_sha256_bsn0_msg0_revkey000.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrevoked/signatures/sig_sha256_bsn0_msg0_revkey001.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrevoked/signatures/sig_sha256_bsn0_msg0_revkey002.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrl.inc create mode 100644 external/epid/epid/common/testdata/grp_x/privrl_single_entry_revoked_key000.inc create mode 100644 external/epid/epid/common/testdata/grp_x/pubkey.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrevoked/mprivatekey000.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrevoked/mprivatekey001.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrevoked/mprivatekey002.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrl.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrl_member0_sig_sha256_bsn0_msg0_revoked_first_entry.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrl_member0_sig_sha256_bsn0_msg0_revoked_last_entry.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrl_member0_sig_sha256_bsn0_msg0_revoked_middle_entry.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrl_single_entry.inc create mode 100644 external/epid/epid/common/testdata/grp_x/sigrl_ver_2.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/mprivkey000.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/mprivkey001.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/mprivkey002.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/sig_revoked0sha256bsn0msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/sig_revoked1sha256bsn0msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/sig_revoked2sha256bsn0msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/verrl.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn0/verrl_1entry.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn1/mprivkey003.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn1/mprivkey004.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn1/mprivkey005.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn1/sig_revoked3sha256bsn1msg0.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn1/verrl.inc create mode 100644 external/epid/epid/common/testdata/grp_x/verrevoked/bsn1/verrl_012revoked.inc create mode 100644 external/epid/epid/common/testdata/grp_y/cmember9/cmpprivkey.dat create mode 100644 external/epid/epid/common/testdata/grp_y/cmember9/cmpprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_y/iprivkey.inc create mode 100644 external/epid/epid/common/testdata/grp_y/pubkey.inc create mode 100644 external/epid/epid/common/testdata/grprl.inc create mode 100644 external/epid/epid/common/testdata/grprl_revoked_grp_x_first_entry.inc create mode 100644 external/epid/epid/common/testdata/grprl_revoked_grp_x_last_entry.inc create mode 100644 external/epid/epid/common/testdata/grprl_revoked_grp_x_middle_entry.inc create mode 100644 external/epid/epid/common/testdata/grprl_single_entry_revoked_grp_x.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/member0/mprecomp.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/member0/mprivkey.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/privrl.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/pubkey.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sig_msg0_sha256_sigrl.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sig_sha256_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sig_sha256_bsn0_msg0_revkey.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sig_sha256_rndbase_msg0.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sig_sigrevoked_sha256_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sig_test1_basename1_sha256.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sigrevokedmember0/mprivkey.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupa/sigrl.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupb/member0/mprivkey.inc create mode 100644 external/epid/epid/common/testdata/ikgf/groupb/sig_grouprevoked_sha256_bsn0_msg0.inc create mode 100644 external/epid/epid/common/testdata/ikgf/grprl.inc rename external/epid/{inc/epid_types.h => epid/common/types.h} (78%) create mode 100644 external/epid/epid/member/api.h create mode 100644 external/epid/epid/member/context.c create mode 100644 external/epid/epid/member/context.h create mode 100644 external/epid/epid/member/decompress_privkey.c create mode 100644 external/epid/epid/member/get_sigsize.c create mode 100644 external/epid/epid/member/member.parts create mode 100644 external/epid/epid/member/nr_prove.c create mode 100644 external/epid/epid/member/presig.c create mode 100644 external/epid/epid/member/privkey.c create mode 100644 external/epid/epid/member/privkey.h create mode 100644 external/epid/epid/member/request_join.c create mode 100644 external/epid/epid/member/sign.c create mode 100644 external/epid/epid/member/signbasic.c create mode 100644 external/epid/epid/member/unittests/compute_presig-test.cc create mode 100644 external/epid/epid/member/unittests/context-test.cc create mode 100644 external/epid/epid/member/unittests/decompress_privkey-test.cc create mode 100644 external/epid/epid/member/unittests/get_sigsize-test.cc create mode 100644 external/epid/epid/member/unittests/main-test.cc create mode 100644 external/epid/epid/member/unittests/member-testhelper.cc create mode 100644 external/epid/epid/member/unittests/member-testhelper.h create mode 100644 external/epid/epid/member/unittests/nr_prove-test.cc create mode 100644 external/epid/epid/member/unittests/presig-test.cc create mode 100644 external/epid/epid/member/unittests/request_join-test.cc create mode 100644 external/epid/epid/member/unittests/sign-test.cc create mode 100644 external/epid/epid/member/unittests/signbasic-test.cc create mode 100644 external/epid/epid/verifier/api.h create mode 100644 external/epid/epid/verifier/check_privrl_entry.c create mode 100644 external/epid/epid/verifier/context.c create mode 100644 external/epid/epid/verifier/context.h create mode 100644 external/epid/epid/verifier/nrverify.c create mode 100644 external/epid/epid/verifier/sigs_linked.c create mode 100644 external/epid/epid/verifier/unittests/check_privrl_entry-test.cc create mode 100644 external/epid/epid/verifier/unittests/context-test.cc create mode 100644 external/epid/epid/verifier/unittests/main-test.cc create mode 100644 external/epid/epid/verifier/unittests/nrverify-test.cc create mode 100644 external/epid/epid/verifier/unittests/sigs_linked-test.cc create mode 100644 external/epid/epid/verifier/unittests/testdata/sigrl/pub_key_sigrl_verify.inc create mode 100644 external/epid/epid/verifier/unittests/testdata/sigrl/signature_sigrl_first.inc create mode 100644 external/epid/epid/verifier/unittests/testdata/sigrl/signature_sigrl_last.inc create mode 100644 external/epid/epid/verifier/unittests/testdata/sigrl/signature_sigrl_middle.inc create mode 100644 external/epid/epid/verifier/unittests/testdata/sigrl/sigrl_five_entries.inc create mode 100644 external/epid/epid/verifier/unittests/testdata/sigrl/sigrl_single_entry.inc create mode 100644 external/epid/epid/verifier/unittests/verifier-testhelper.cc create mode 100644 external/epid/epid/verifier/unittests/verifier-testhelper.h create mode 100644 external/epid/epid/verifier/unittests/verify-test.cc create mode 100644 external/epid/epid/verifier/unittests/verifybasic-test.cc create mode 100644 external/epid/epid/verifier/verifier.parts create mode 100644 external/epid/epid/verifier/verify.c create mode 100644 external/epid/epid/verifier/verifybasic.c create mode 100644 external/epid/example/data/README.md create mode 100644 external/epid/example/data/cacert.bin create mode 100644 external/epid/example/data/data.parts create mode 100644 external/epid/example/data/groupa/member0/mprivkey.dat create mode 100644 external/epid/example/data/groupa/member1/mprivkey.dat create mode 100644 external/epid/example/data/groupa/privrevokedmember0/mprivkey.dat create mode 100644 external/epid/example/data/groupa/privrevokedmember1/mprivkey.dat create mode 100644 external/epid/example/data/groupa/privrevokedmember2/mprivkey.dat create mode 100644 external/epid/example/data/groupa/privrl.bin create mode 100644 external/epid/example/data/groupa/pubkey.bin create mode 100644 external/epid/example/data/groupa/sigrevokedmember0/mprivkey.dat create mode 100644 external/epid/example/data/groupa/sigrevokedmember1/mprivkey.dat create mode 100644 external/epid/example/data/groupa/sigrevokedmember2/mprivkey.dat create mode 100644 external/epid/example/data/groupa/sigrl.bin create mode 100644 external/epid/example/data/groupb/member0/mprivkey.dat create mode 100644 external/epid/example/data/groupb/privrevokedmember0/mprivkey.dat create mode 100644 external/epid/example/data/groupb/privrl.bin create mode 100644 external/epid/example/data/groupb/pubkey.bin create mode 100644 external/epid/example/data/groupb/sigrevokedmember0/mprivkey.dat create mode 100644 external/epid/example/data/groupb/sigrl.bin create mode 100644 external/epid/example/data/grprl.bin create mode 100644 external/epid/example/data/grprl_empty.bin create mode 100644 external/epid/example/data/mprivkey.dat create mode 100644 external/epid/example/data/pubkey.bin create mode 100644 external/epid/example/signmsg/signmsg.parts create mode 100644 external/epid/example/signmsg/src/main.c create mode 100644 external/epid/example/signmsg/src/prng.c create mode 100644 external/epid/example/signmsg/src/prng.h create mode 100644 external/epid/example/signmsg/src/signmsg.c create mode 100644 external/epid/example/signmsg/src/signmsg.h create mode 100644 external/epid/example/util/argutil.h create mode 100644 external/epid/example/util/buffutil.h create mode 100644 external/epid/example/util/convutil.h create mode 100644 external/epid/example/util/envutil.h create mode 100644 external/epid/example/util/src/argutil.c create mode 100644 external/epid/example/util/src/bufutil.c create mode 100644 external/epid/example/util/src/convutil.c create mode 100644 external/epid/example/util/src/envutil.c create mode 100644 external/epid/example/util/stdtypes.h create mode 100644 external/epid/example/util/util.parts create mode 100644 external/epid/example/verifysig/src/main.c create mode 100644 external/epid/example/verifysig/src/verifysig.c create mode 100644 external/epid/example/verifysig/src/verifysig.h create mode 100644 external/epid/example/verifysig/verifysig.parts create mode 100644 external/epid/ext/gtest/LICENSE create mode 100644 external/epid/ext/gtest/gtest-all.cc create mode 100644 external/epid/ext/gtest/gtest.h create mode 100644 external/epid/ext/gtest/gtest.parts create mode 100644 external/epid/ext/ipp/include/ippbase.h create mode 100644 external/epid/ext/ipp/include/ippcp.h create mode 100644 external/epid/ext/ipp/include/ippcpdefs.h create mode 100644 external/epid/ext/ipp/include/ippcpepid.h create mode 100644 external/epid/ext/ipp/include/ippdefs.h create mode 100644 external/epid/ext/ipp/include/ipptypes.h create mode 100644 external/epid/ext/ipp/ippcommon.parts create mode 100644 external/epid/ext/ipp/ippcp.parts create mode 100644 external/epid/ext/ipp/ippcpepid.parts create mode 100644 external/epid/ext/ipp/sources/include/owndefs.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/owncp.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbn.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnresource.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnresourceca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnsetca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnu32arith.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnu32arith.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnu32misc.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnu32misc.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnuarith.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnuarith.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnuimpl.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnumisc.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpbnumisc.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccp.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpdpca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpgenkeyca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpinitca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod128.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod128ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod192.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod192ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod224.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod224ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod256.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod256ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod384.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod384ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod521.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethod521ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethodcom.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethodcomca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpmethodsm2ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccppoint.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccppointca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccppointopca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccppublickeyca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpsetkeyca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpsigndsaca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpsscm.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpsscm.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpstdca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpeccpverifydsaca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcphash.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcphashcnt.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcphashmd5px.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcphashsha1px.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcphashsha256px.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcphashsha512px.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpmd5ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpmontexpbinca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpmontgomery.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpmontgomeryca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpmontred.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpmulbnukara.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma128.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma128.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma192.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma192.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma224.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma224.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma256.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma256.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma384.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma384.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma521.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppma521.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppmasm2.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcppmasm2.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpprimeg.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpprimeginitca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpprng.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpprngenca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpprnginitca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpprngsetca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpsha1ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpsha256ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpsha512ca.c create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcptool.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/pcpvariant.h create mode 100644 external/epid/ext/ipp/sources/ippcp/src/precomp.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/ippcpepid_p8.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/ippcpepid_y8.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/owncpepid.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfp.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpec.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpecpoint.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpecpointstuff.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpecstuff.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfphashstuff.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpstuff.h create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpx.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.c create mode 100644 external/epid/ext/ipp/sources/ippcpepid/src/pcpgfpxstuff.h create mode 100644 external/epid/parts-site/configurations/__init__.py create mode 100644 external/epid/parts-site/configurations/debug/__init__.py create mode 100644 external/epid/parts-site/configurations/debug/g++.py create mode 100644 external/epid/parts-site/configurations/debug/gcc.py create mode 100644 external/epid/parts-site/configurations/debug/intelc_posix-any.py create mode 100644 external/epid/parts-site/configurations/debug/intelc_win32-any_win32-x86.py create mode 100644 external/epid/parts-site/configurations/debug/intelc_win32-any_win32-x86_64.py create mode 100644 external/epid/parts-site/configurations/debug/msvc_win32-any_win32-x86.py create mode 100644 external/epid/parts-site/configurations/debug/msvc_win32-any_win32-x86_64.py create mode 100644 external/epid/parts-site/configurations/release/__init__.py create mode 100644 external/epid/parts-site/configurations/release/g++.py create mode 100644 external/epid/parts-site/configurations/release/gcc.py create mode 100644 external/epid/parts-site/configurations/release/intelc_posix-any.py create mode 100644 external/epid/parts-site/configurations/release/intelc_win32-any_win32-x86.py create mode 100644 external/epid/parts-site/configurations/release/intelc_win32-any_win32-x86_64.py create mode 100644 external/epid/parts-site/configurations/release/msvc_win32-any_win32-x86.py create mode 100644 external/epid/parts-site/configurations/release/msvc_win32-any_win32-x86_64.py delete mode 100644 external/tinyxml/tinystr.cpp delete mode 100644 external/tinyxml/tinystr.h delete mode 100644 external/tinyxml/tinyxml.cpp delete mode 100644 external/tinyxml/tinyxml.h delete mode 100644 external/tinyxml/tinyxmlerror.cpp delete mode 100644 external/tinyxml/tinyxmlparser.cpp create mode 100644 external/tinyxml2/tinyxml2.cpp create mode 100644 external/tinyxml2/tinyxml2.h create mode 100644 psw/ae/common/pve_qe_common.cpp create mode 100644 psw/ae/common/se_ecdsa_verify_internal.cpp create mode 100644 psw/ae/common/version.cpp delete mode 100644 psw/ae/inc/internal/cipher.h create mode 100644 psw/ae/inc/internal/se_ecdsa_verify_internal.h create mode 100644 psw/ae/pce/Makefile create mode 100644 psw/ae/pce/config.xml create mode 100644 psw/ae/pce/pce.cpp create mode 100644 psw/ae/pce/pce_helper.cpp create mode 100644 psw/ae/pve/Makefile create mode 100644 psw/ae/pve/cipher.cpp create mode 100644 psw/ae/pve/cipher.h create mode 100644 psw/ae/pve/config.xml create mode 100644 psw/ae/pve/endpoint_selection.cpp create mode 100644 psw/ae/pve/helper.cpp create mode 100644 psw/ae/pve/helper.h create mode 100644 psw/ae/pve/msg3_parm.h create mode 100644 psw/ae/pve/protocol.h create mode 100644 psw/ae/pve/provision_enclave.cpp rename psw/ae/{inc/internal => pve}/provision_msg.h (95%) create mode 100644 psw/ae/pve/provision_msg1.cpp create mode 100644 psw/ae/pve/provision_msg2.cpp create mode 100644 psw/ae/pve/provision_msg3.cpp create mode 100644 psw/ae/pve/provision_msg4.cpp create mode 100644 psw/ae/pve/pve_hardcoded_tlv_data.h create mode 100644 psw/ae/pve/pve_rng.cpp create mode 100644 psw/ae/pve/pve_verify_signature.cpp create mode 100644 psw/ae/qe/Makefile create mode 100644 psw/ae/qe/config.xml create mode 100644 psw/ae/qe/quoting_enclave.cpp create mode 100644 psw/uae_service/linux/uae_service.lds create mode 100644 psw/urts/linux/urts.lds create mode 100644 sdk/Makefile.opt_lib create mode 100644 sdk/Makefile.source create mode 100644 sdk/tlibc/math/w_drem.c create mode 100644 sdk/tlibc/math/w_dremf.c rename sdk/{tlibcrypto/init_crypto_lib.cpp => tlibc/math/w_dreml.c} (83%) create mode 100644 sdk/tlibc/math/w_pow10.c create mode 100644 sdk/tlibc/math/w_pow10f.c create mode 100644 sdk/tlibc/math/w_pow10l.c create mode 100644 sdk/tlibcrypto/init_tcrypto_lib.cpp diff --git a/Linux_SGXEclipsePlugin/build.sh b/Linux_SGXEclipsePlugin/build.sh index ba6e8a28a9..e4bd19a937 100755 --- a/Linux_SGXEclipsePlugin/build.sh +++ b/Linux_SGXEclipsePlugin/build.sh @@ -11,7 +11,7 @@ TRUNK_HOME=$(cd $(pwd)/../../ ; pwd) [ -n "${ECLIPSE_HOME}" ] || { echo "using default ECLIPSE_HOME=${TRUNK_HOME}/eclipse"; ECLIPSE_HOME=${TRUNK_HOME}/eclipse; } -BUILD_RELEASE_ID_PREFIX=Linux_SGX_1.6 +BUILD_RELEASE_ID_PREFIX=Linux_SGX_1.5 if [ "$RELEASE_ID" != "${RELEASE_ID%$BUILD_RELEASE_ID_PREFIX*}" ]; then echo "$BUILD_RELEASE_ID_PREFIX IS in $RELEASE_ID, so it is an triggered build. Change the RELEASE_ID to an accepted form." diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/PageLayouts/Default.flpgl b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/PageLayouts/Default.flpgl deleted file mode 100644 index 5faf8a4961..0000000000 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/PageLayouts/Default.flpgl +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html index b2a5bad637..c934419af6 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/content.html @@ -9,8 +9,9 @@ Contributors: Intel Corporation - initial implementation and documentation - --> + + --> @@ -24,7 +25,7 @@ modification. Intel(R) SGX makes such protections possible through the use of enclaves. Enclaves are protected areas of execution. Application code can be put into an enclave through special instructions and software made available to developers by the Intel(R) SGX SDK.

-

Legal Information +

Legal Information

Introducing Intel(R) Software Guard Extensions Eclipse* Plug-in

-

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

+

The Intel(R) Software Guard Extensions Eclipse* Plug-in helps the enclave developer to maintain enclaves and untrusted related code inside Eclipse* C/C++ projects. To use this support, add SGX nature to the C/C++ project. See Adding SGX Nature to a Project for details.

Once the SGX nature is added to a project, you will have access to the SGX commands. SGX nature adds also a folder called sgx to the root of the project, and a Makefile inside it. All resources of the project managed by Intel(R) Software Guard Extensions Eclipse Plug-inare located inside this directory. You can build and run enclaves related code using GNU* Make tool through the Makefile.

The plugin is generating minimal but ready-to-work code skeletons, complete with their own Makefile having all the required make targets as to call sgx_edger8r tool to generate the proxies and bridges, compile these source, generate a shared object and finally, to sign the enclave with the sgx_sign tool. This provide a starting point you may build upon.

@@ -181,7 +182,7 @@ developers by the Intel(R) SGX SDK.

Adding SGX Nature to a Project

The nature of an Eclipse project is a concept defined by an Eclipse Platform which allows a plug-in to tag a project as a specific kind of project. Intel(R) Software Guard Extensions uses an SGX nature to add SGX-specific behavior to projects. Project natures are defined by plug-ins, and are typically added or removed per-project when the user performs some action defined by the plug-in.

-

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

+

To use Intel(R) Software Guard Extensions Eclipse Plug-in in your project, you need to add SGX nature to it. You may either add SGX nature to a pre-existing C/C++ project or create a project with SGX nature from start. See Adding SGX Nature to a non-SGX project and Creating a New C/C++ Project with SGX Nature for how to complete these tasks.

Adding SGX Nature to a non-SGX project

diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml index 9a4a908de0..9a31c4b5b2 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/toc.xml @@ -1,16 +1,17 @@ + Copyright (c) 2016 Intel Corporation. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Intel Corporation - initial implementation and documentation + + + --> @@ -41,4 +42,4 @@ - + \ No newline at end of file diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk index 6b9dce7acc..62ff91ff93 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c++/sgx_t_static.mk @@ -77,7 +77,7 @@ endif .PHONY: all run -all: $(enclaveName).sgx.static.lib.a +all: lib$(enclaveName).sgx.static.lib.a ######## $(enclaveName) Objects ######## @@ -97,8 +97,8 @@ static_trusted/%.o: static_trusted/%.c @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ @echo "CC <= $<" -$(enclaveName).sgx.static.lib.a: static_trusted/$(enclaveName)_t.h $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) - ar rcs $(enclaveName).sgx.static.lib.a $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) +lib$(enclaveName).sgx.static.lib.a: static_trusted/$(enclaveName)_t.h $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) + ar rcs lib$(enclaveName).sgx.static.lib.a $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) @echo "LINK => $@" clean: diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk index e0bd716e18..e3dbd8f7f5 100644 --- a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk +++ b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx/templates/sgx/SGXTrustedStaticLibrary/makefiles/c/sgx_t_static.mk @@ -71,7 +71,7 @@ endif .PHONY: all run -all: $(enclaveName).sgx.static.lib.a +all: lib$(enclaveName).sgx.static.lib.a ######## $(enclaveName) Objects ######## @@ -87,8 +87,8 @@ static_trusted/%.o: static_trusted/%.c @$(CC) $($(EnclaveName)_C_Flags) -c $< -o $@ @echo "CC <= $<" -$(enclaveName).sgx.static.lib.a: static_trusted/$(enclaveName)_t.h $($(EnclaveName)_C_Objects) - ar rcs $(enclaveName).sgx.static.lib.a $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) +lib$(enclaveName).sgx.static.lib.a: static_trusted/$(enclaveName)_t.h $($(EnclaveName)_C_Objects) + ar rcs lib$(enclaveName).sgx.static.lib.a $($(EnclaveName)_Cpp_Objects) $($(EnclaveName)_C_Objects) @echo "LINK => $@" clean: diff --git a/Makefile b/Makefile index 8e9a40f00d..9cd3ab3a08 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,10 @@ include buildenv.mk all: sdk psw psw: sdk - $(MAKE) -C psw/ + $(MAKE) -C psw/ USE_OPT_LIBS=$(USE_OPT_LIBS) sdk: - $(MAKE) -C sdk/ + $(MAKE) -C sdk/ USE_OPT_LIBS=$(USE_OPT_LIBS) # Generate SE SDK Install package sdk_install_pkg: sdk @@ -53,4 +53,6 @@ clean: @$(RM) -r $(ROOT_DIR)/build @$(RM) -r linux/installer/bin/sgx_linux*.bin -rebuild: clean all +rebuild: + $(MAKE) clean + $(MAKE) all diff --git a/README.md b/README.md index 5dba72abc8..efacc00610 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ Build the Intel(R) SGX SDK and Intel(R) SGX PSW Package ``` $ sudo apt-get install libcurl4-openssl-dev protobuf-compiler protobuf-c-compiler libprotobuf-dev libprotobuf-c0-dev ``` -- Use the script `download_prebuilt.sh` inside source code package to download prebuilt binaries to prebuilt folder - You may need set https proxy for wget tool used by the script (such as `export https_proxy=http://test-proxy:test-port`) +- Use the script ``download_prebuilt.sh`` inside source code package to download prebuilt binaries to prebuilt folder + You may need set https proxy for wget tool used by the script (such as ``export https_proxy=http://test-proxy:test-port``) ``` $ ./download_prebuilt.sh ``` @@ -58,6 +58,11 @@ The following steps describe how to build the Intel SGX SDK and PSW. You can bui $ make ``` +- The default build uses precompiled optimized libraries which have been downloaded by the script ``./download_prebuilt.sh``. + You can also use the non-optimized source code version implementation instead by entering the following command: +``` + $ make USE_OPT_LIBS=0 +``` - To build Intel SGX SDK and PSW with debug information, enter the following command: ``` $ make DEBUG=1 @@ -67,20 +72,34 @@ The following steps describe how to build the Intel SGX SDK and PSW. You can bui $ make clean ``` +- The build above uses prebuilt Intel(R) Architecture Enclaves(LE/PvE/QE/PCE) - the files ``psw/ae/data/prebuilt/libsgx_*.signed.so``, which have been signed by Intel in advance. + To build those binaries by yourself (without a signature), first you need to build both Intel SGX SDK and PSW with the default configuration. After that, you can build each Architecture Enclave by using the `make` command from the corresponding folder: +``` + $ cd psw/ae/le + $ make +``` + ###Build Intel(R) SGX SDK Installer To build Intel(R) SGX SDK installer, enter the following command: ``` $ make sdk_install_pkg ``` -You can find the generated Intel SGX SDK installer `sgx_linux_x64_sdk_${version}.bin` located under `linux/installer/bin/`, where `${version}` refers to the version number. +You can find the generated Intel SGX SDK installer ``sgx_linux_x64_sdk_${version}.bin`` located under `linux/installer/bin/`, where `${version}` refers to the version number. +You could also make an SGX SDK installer with non-optimized source code for crypto library by +``` +$ make sdk_install_pkg USE_OPT_LIBS=0 +``` ###Build Intel(R) SGX PSW Installer To build Intel(R) SGX PSW installer, enter the following command: ``` $ make psw_install_pkg ``` -You can find the generated Intel SGX PSW installer `sgx_linux_x64_psw_${version}.bin` located under `linux/installer/bin/`, where `${version}` refers to the version number. - +You can find the generated Intel SGX PSW installer ``sgx_linux_x64_psw_${version}.bin`` located under `linux/installer/bin/`, where `${version}` refers to the version number. +You could also make an SGX PSW intaller with non-optimized source code for crypto library by +``` +$ make psw_install_pkg USE_OPT_LIBS=0 +``` Install Intel(R) SGX SDK ------------------------ ###Prerequisites @@ -92,12 +111,16 @@ Install Intel(R) SGX SDK ``` ###Install Intel(R) SGX SDK -To install Intel(R) SGX SDK, enter the following commands: +To install Intel(R) SGX SDK, execute the installer with root privilege: ``` $ cd linux/installer/bin -$ ./sgx_linux_x64_sdk_${version}.bin +$ sudo ./sgx_linux_x64_sdk_${version}.bin ``` ###Test Intel(R) SGX SDK Package with the Sample Codes +- Copy the sample codes installed by Intel(R) SGX SDK package into your work folder, such as +``` + $ cp -r /opt/intel/sgxsdk/SampleCode ~ +``` - Compile and run each sample codes in the simulation mode to make sure the package works well. ``` $ cd SampleCode/LocalAttestation @@ -110,6 +133,10 @@ $ ./sgx_linux_x64_sdk_${version}.bin If you use an SGX hardware enabled machine, you need to run the sample codes in the hardware mode. Ensure that you install SGX driver and Intel(R) SGX PSW installer on the machine. See the topic, Install Intel(R) SGX PSW, on how to install the PSW package. +- Copy the sample codes installed by the Intel(R) SGX SDK package into your work folder, such as +``` + $ cp -r /opt/intel/sgxsdk/SampleCode ~ +``` - Compile and run each sample codes in the debug mode. ``` $ cd SampleCode/LocalAttestation diff --git a/SampleCode/LocalAttestation/.cproject b/SampleCode/LocalAttestation/.cproject index b9fabf3067..be4d65295c 100644 --- a/SampleCode/LocalAttestation/.cproject +++ b/SampleCode/LocalAttestation/.cproject @@ -168,24 +168,24 @@ - + - + - + - + - + - + diff --git a/SampleCode/LocalAttestation/.project b/SampleCode/LocalAttestation/.project index f1af7d8591..df8b1a4d24 100644 --- a/SampleCode/LocalAttestation/.project +++ b/SampleCode/LocalAttestation/.project @@ -1,6 +1,6 @@ - SimpleEnclave + LocalAttestation diff --git a/SampleCode/LocalAttestation/App/App.cpp b/SampleCode/LocalAttestation/App/App.cpp index 151d954992..92b5ec0b6c 100644 --- a/SampleCode/LocalAttestation/App/App.cpp +++ b/SampleCode/LocalAttestation/App/App.cpp @@ -38,6 +38,9 @@ #include "../Enclave3/Enclave3_u.h" #include "sgx_eid.h" #include "sgx_urts.h" +#define __STDC_FORMAT_MACROS +#include + #define UNUSED(val) (void)(val) #define TCHAR char @@ -59,9 +62,10 @@ sgx_enclave_id_t e3_enclave_id = 0; void waitForKeyPress() { - uint8_t ch; + char ch; + int temp; printf("\n\nHit a key....\n"); - scanf_s("%c", &ch); + temp = scanf_s("%c", &ch); } uint32_t load_enclaves() @@ -115,9 +119,9 @@ int _tmain(int argc, _TCHAR* argv[]) } printf("\nAvaliable Enclaves"); - printf("\nEnclave1 - EnclaveID %llx",e1_enclave_id); - printf("\nEnclave2 - EnclaveID %llx",e2_enclave_id); - printf("\nEnclave3 - EnclaveID %llx",e3_enclave_id); + printf("\nEnclave1 - EnclaveID %" PRIx64, e1_enclave_id); + printf("\nEnclave2 - EnclaveID %" PRIx64, e2_enclave_id); + printf("\nEnclave3 - EnclaveID %" PRIx64, e3_enclave_id); do { diff --git a/SampleCode/LocalAttestation/Makefile b/SampleCode/LocalAttestation/Makefile index 119fa78f7f..4fb31a0b3c 100644 --- a/SampleCode/LocalAttestation/Makefile +++ b/SampleCode/LocalAttestation/Makefile @@ -32,8 +32,9 @@ ######## SGX SDK Settings ######## SGX_SDK ?= /opt/intel/sgxsdk -SGX_MODE ?= SIM +SGX_MODE ?= HW SGX_ARCH ?= x64 +SGX_DEBUG ?= 1 ifeq ($(shell getconf LONG_BIT), 32) SGX_ARCH := x86 @@ -71,7 +72,8 @@ Trust_Lib_Name := libLocalAttestation_Trusted.a TrustLib_Cpp_Files := $(wildcard LocalAttestationCode/*.cpp) TrustLib_Cpp_Objects := $(TrustLib_Cpp_Files:.cpp=.o) TrustLib_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/stlport -I$(SGX_SDK)/include/epid -I./Include -TrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector -std=c++03 -nostdinc++ $(TrustLib_Include_Paths) +TrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(TrustLib_Include_Paths) +TrustLib_Compile_Cxx_Flags := -std=c++03 -nostdinc++ UnTrustLib_Name := libLocalAttestation_unTrusted.a UnTrustLib_Cpp_Files := $(wildcard Untrusted_LocalAttestation/*.cpp) @@ -155,10 +157,20 @@ Enclave_Name_2 := libenclave2.so Enclave_Name_3 := libenclave3.so ifeq ($(SGX_MODE), HW) -ifneq ($(SGX_DEBUG), 1) -ifneq ($(SGX_PRERELEASE), 1) -Build_Mode = HW_RELEASE +ifeq ($(SGX_DEBUG), 1) + Build_Mode = HW_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = HW_PRERELEASE +else + Build_Mode = HW_RELEASE endif +else +ifeq ($(SGX_DEBUG), 1) + Build_Mode = SIM_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = SIM_PRERELEASE +else + Build_Mode = SIM_RELEASE endif endif @@ -174,6 +186,17 @@ all: $(Trust_Lib_Name) $(UnTrustLib_Name) Enclave1.so Enclave2.so Enclave3.so $( @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: $(Trust_Lib_Name) $(UnTrustLib_Name) $(Enclave_Name_1) $(Enclave_Name_2) $(Enclave_Name_3) $(App_Name) +ifeq ($(Build_Mode), HW_DEBUG) + @echo "The project has been built in debug hardware mode." +else ifeq ($(Build_Mode), SIM_DEBUG) + @echo "The project has been built in debug simulation mode." +else ifeq ($(Build_Mode), HW_PRERELEASE) + @echo "The project has been built in pre-release hardware mode." +else ifeq ($(Build_Mode), SIM_PRERELEASE) + @echo "The project has been built in pre-release simulation mode." +else + @echo "The project has been built in release simulation mode." +endif endif ######## Library Objects ######## @@ -187,7 +210,7 @@ LocalAttestationCode/LocalAttestationCode_t.o: LocalAttestationCode/LocalAttesta @echo "CC <= $<" LocalAttestationCode/%.o: LocalAttestationCode/%.cpp LocalAttestationCode/LocalAttestationCode_t.h - @$(CXX) $(TrustLib_Compile_Flags) -c $< -o $@ + @$(CXX) $(TrustLib_Compile_Flags) $(TrustLib_Compile_Cxx_Flags) -c $< -o $@ @echo "CC <= $<" $(Trust_Lib_Name): LocalAttestationCode/LocalAttestationCode_t.o $(TrustLib_Cpp_Objects) diff --git a/SampleCode/LocalAttestation/README.txt b/SampleCode/LocalAttestation/README.txt index 067bb498dc..882143468d 100644 --- a/SampleCode/LocalAttestation/README.txt +++ b/SampleCode/LocalAttestation/README.txt @@ -11,17 +11,17 @@ How to Build/Execute the Sample Code 1. Install Intel(R) SGX SDK for Linux* OS 2. Build the project with the prepared Makefile: a. Hardware Mode, Debug build: - $ make SGX_MODE=HW SGX_DEBUG=1 - b. Hardware Mode, Pre-release build: - $ make SGX_MODE=HW SGX_PRERELEASE=1 - c. Hardware Mode, Release build: - $ make SGX_MODE=HW - d. Simulation Mode, Debug build: - $ make SGX_DEBUG=1 - e. Simulation Mode, Pre-release build: - $ make SGX_PRERELEASE=1 - f. Simulation Mode, Release build: $ make + b. Hardware Mode, Pre-release build: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 + c. Hardware Mode, Release build: + $ make SGX_DEBUG=0 + d. Simulation Mode, Debug build: + $ make SGX_MODE=SIM + e. Simulation Mode, Pre-release build: + $ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0 + f. Simulation Mode, Release build: + $ make SGX_MODE=SIM SGX_DEBUG=0 3. Execute the binary directly: $ ./app - +4. Remember to "make clean" before switching build mode diff --git a/SampleCode/PowerTransition/.cproject b/SampleCode/PowerTransition/.cproject index b9fabf3067..77c05bf4f1 100644 --- a/SampleCode/PowerTransition/.cproject +++ b/SampleCode/PowerTransition/.cproject @@ -168,24 +168,24 @@ - + - + - + - + - + - + diff --git a/SampleCode/PowerTransition/.project b/SampleCode/PowerTransition/.project index f1af7d8591..7f1ef0688c 100644 --- a/SampleCode/PowerTransition/.project +++ b/SampleCode/PowerTransition/.project @@ -1,6 +1,6 @@ - SimpleEnclave + PowerTransition diff --git a/SampleCode/PowerTransition/Enclave/Enclave.cpp b/SampleCode/PowerTransition/Enclave/Enclave.cpp index 34b9ba0ac7..3918abf4ab 100644 --- a/SampleCode/PowerTransition/Enclave/Enclave.cpp +++ b/SampleCode/PowerTransition/Enclave/Enclave.cpp @@ -158,7 +158,7 @@ int increase_and_seal_data(size_t tid, struct sealed_buf_t* sealed_buf) // Ocall to print the unsealed secret data outside. // In theory, the secret data(s) SHOULD NOT be transferred outside the enclave as clear text(s). // So please DO NOT print any secret outside. Here printing the secret data to outside is only for demo. - snprintf(string_buf, BUFSIZ, "Thread %#x>: %d\n", (unsigned int)tid, temp_secret); + snprintf(string_buf, BUFSIZ, "Thread %#x>: %u\n", (unsigned int)tid, (unsigned int)temp_secret); print(string_buf); return 0; } diff --git a/SampleCode/PowerTransition/Makefile b/SampleCode/PowerTransition/Makefile index 32b9d2f3fc..6bccdb7673 100644 --- a/SampleCode/PowerTransition/Makefile +++ b/SampleCode/PowerTransition/Makefile @@ -32,8 +32,9 @@ ####### SGX SDK Settings ######## SGX_SDK ?= /opt/intel/sgxsdk -SGX_MODE ?= SIM +SGX_MODE ?= HW SGX_ARCH ?= x64 +SGX_DEBUG ?= 1 ifeq ($(shell getconf LONG_BIT), 32) SGX_ARCH := x86 @@ -149,10 +150,20 @@ Signed_Enclave_Name := libenclave.signed.so Enclave_Config_File := Enclave/Enclave.config.xml ifeq ($(SGX_MODE), HW) -ifneq ($(SGX_DEBUG), 1) -ifneq ($(SGX_PRERELEASE), 1) -Build_Mode = HW_RELEASE +ifeq ($(SGX_DEBUG), 1) + Build_Mode = HW_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = HW_PRERELEASE +else + Build_Mode = HW_RELEASE endif +else +ifeq ($(SGX_DEBUG), 1) + Build_Mode = SIM_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = SIM_PRERELEASE +else + Build_Mode = SIM_RELEASE endif endif @@ -166,9 +177,17 @@ all: $(App_Name) $(Enclave_Name) @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: $(App_Name) $(Signed_Enclave_Name) - @echo "Build $(App_Name) [$(SGX_MODE)|$(SGX_ARCH)] Success!" - @echo "Please RUN the project with command:" - @echo " $(App_Name)" +ifeq ($(Build_Mode), HW_DEBUG) + @echo "The project has been built in debug hardware mode." +else ifeq ($(Build_Mode), SIM_DEBUG) + @echo "The project has been built in debug simulation mode." +else ifeq ($(Build_Mode), HW_PRERELEASE) + @echo "The project has been built in pre-release hardware mode." +else ifeq ($(Build_Mode), SIM_PRERELEASE) + @echo "The project has been built in pre-release simulation mode." +else + @echo "The project has been built in release simulation mode." +endif endif ######## App Objects ######## diff --git a/SampleCode/PowerTransition/README.txt b/SampleCode/PowerTransition/README.txt index a6a23b930e..23c298b021 100644 --- a/SampleCode/PowerTransition/README.txt +++ b/SampleCode/PowerTransition/README.txt @@ -10,17 +10,17 @@ How to Build/Execute the Sample Code 1. Install Intel(R) SGX SDK for Linux* OS 2. Build the project with the prepared Makefile: a. Hardware Mode, Debug build: - $ make SGX_MODE=HW SGX_DEBUG=1 - b. Hardware Mode, Pre-release build: - $ make SGX_MODE=HW SGX_PRERELEASE=1 - c. Hardware Mode, Release build: - $ make SGX_MODE=HW - d. Simulation Mode, Debug build: - $ make SGX_DEBUG=1 - e. Simulation Mode, Pre-release build: - $ make SGX_PRERELEASE=1 - f. Simulation Mode, Release build: $ make + b. Hardware Mode, Pre-release build: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 + c. Hardware Mode, Release build: + $ make SGX_DEBUG=0 + d. Simulation Mode, Debug build: + $ make SGX_MODE=SIM + e. Simulation Mode, Pre-release build: + $ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0 + f. Simulation Mode, Release build: + $ make SGX_MODE=SIM SGX_DEBUG=0 3. Execute the binary directly: $ ./app - +4. Remember to "make clean" before switching build mode diff --git a/SampleCode/RemoteAttestation/.cproject b/SampleCode/RemoteAttestation/.cproject index b9fabf3067..efe1117e34 100644 --- a/SampleCode/RemoteAttestation/.cproject +++ b/SampleCode/RemoteAttestation/.cproject @@ -168,24 +168,24 @@ - + - + - + - + - + - + diff --git a/SampleCode/RemoteAttestation/.project b/SampleCode/RemoteAttestation/.project index f1af7d8591..3cc71f6a6a 100644 --- a/SampleCode/RemoteAttestation/.project +++ b/SampleCode/RemoteAttestation/.project @@ -1,6 +1,6 @@ - SimpleEnclave + RemoteAttestation diff --git a/SampleCode/RemoteAttestation/Makefile b/SampleCode/RemoteAttestation/Makefile index 541fad85c3..1f6e5af6f7 100644 --- a/SampleCode/RemoteAttestation/Makefile +++ b/SampleCode/RemoteAttestation/Makefile @@ -32,8 +32,9 @@ ######## SGX SDK Settings ######## SGX_SDK ?= /opt/intel/sgxsdk -SGX_MODE ?= SIM +SGX_MODE ?= HW SGX_ARCH ?= x64 +SGX_DEBUG ?= 1 ifeq ($(shell getconf LONG_BIT), 32) SGX_ARCH := x86 @@ -156,10 +157,20 @@ Signed_Enclave_Name := isv_enclave.signed.so Enclave_Config_File := isv_enclave/isv_enclave.config.xml ifeq ($(SGX_MODE), HW) -ifneq ($(SGX_DEBUG), 1) -ifneq ($(SGX_PRERELEASE), 1) -Build_Mode = HW_RELEASE +ifeq ($(SGX_DEBUG), 1) + Build_Mode = HW_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = HW_PRERELEASE +else + Build_Mode = HW_RELEASE endif +else +ifeq ($(SGX_DEBUG), 1) + Build_Mode = SIM_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = SIM_PRERELEASE +else + Build_Mode = SIM_RELEASE endif endif @@ -176,6 +187,17 @@ all: libservice_provider.so $(App_Name) $(Enclave_Name) @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: libservice_provider.so $(App_Name) $(Signed_Enclave_Name) +ifeq ($(Build_Mode), HW_DEBUG) + @echo "The project has been built in debug hardware mode." +else ifeq ($(Build_Mode), SIM_DEBUG) + @echo "The project has been built in debug simulation mode." +else ifeq ($(Build_Mode), HW_PRERELEASE) + @echo "The project has been built in pre-release hardware mode." +else ifeq ($(Build_Mode), SIM_PRERELEASE) + @echo "The project has been built in pre-release simulation mode." +else + @echo "The project has been built in release simulation mode." +endif endif run: all diff --git a/SampleCode/RemoteAttestation/README.txt b/SampleCode/RemoteAttestation/README.txt index a940b9d1b9..2b78193368 100644 --- a/SampleCode/RemoteAttestation/README.txt +++ b/SampleCode/RemoteAttestation/README.txt @@ -11,17 +11,17 @@ How to Build/Execute the Sample Code 1. Install Intel(R) SGX SDK for Linux* OS 2. Build the project with the prepared Makefile: a. Hardware Mode, Debug build: - $ make SGX_MODE=HW SGX_DEBUG=1 - b. Hardware Mode, Pre-release build: - $ make SGX_MODE=HW SGX_PRERELEASE=1 - c. Hardware Mode, Release build: - $ make SGX_MODE=HW - d. Simulation Mode, Debug build: - $ make SGX_DEBUG=1 - e. Simulation Mode, Pre-release build: - $ make SGX_PRERELEASE=1 - f. Simulation Mode, Release build: $ make + b. Hardware Mode, Pre-release build: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 + c. Hardware Mode, Release build: + $ make SGX_DEBUG=0 + d. Simulation Mode, Debug build: + $ make SGX_MODE=SIM + e. Simulation Mode, Pre-release build: + $ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0 + f. Simulation Mode, Release build: + $ make SGX_MODE=SIM SGX_DEBUG=0 3. Execute the binary directly: $ ./app - +4. Remember to "make clean" before switching build mode diff --git a/SampleCode/SampleEnclave/.cproject b/SampleCode/SampleEnclave/.cproject index b9fabf3067..e685836b4d 100644 --- a/SampleCode/SampleEnclave/.cproject +++ b/SampleCode/SampleEnclave/.cproject @@ -168,24 +168,24 @@ - + - + - + - + - + - + diff --git a/SampleCode/SampleEnclave/.project b/SampleCode/SampleEnclave/.project index f1af7d8591..102c105873 100644 --- a/SampleCode/SampleEnclave/.project +++ b/SampleCode/SampleEnclave/.project @@ -1,6 +1,6 @@ - SimpleEnclave + SampleEnclave diff --git a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp index 3ee37ab8f4..6e027e9cd3 100644 --- a/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp +++ b/SampleCode/SampleEnclave/Enclave/Edger8rSyntax/Pointers.cpp @@ -78,7 +78,7 @@ size_t ecall_pointer_user_check(void *val, size_t sz) int32_t sum = checksum_internal((char *)tmp, len); printf("Checksum(0x%p, %zu) = 0x%x\n", - val, len, sum); + val, len, (unsigned int)sum); /* modify outside memory directly */ memcpy(val, "SGX_SUCCESS", len>12?12:len); diff --git a/SampleCode/SampleEnclave/Makefile b/SampleCode/SampleEnclave/Makefile index dc4fa2c84a..aaa22052e6 100644 --- a/SampleCode/SampleEnclave/Makefile +++ b/SampleCode/SampleEnclave/Makefile @@ -32,8 +32,9 @@ ######## SGX SDK Settings ######## SGX_SDK ?= /opt/intel/sgxsdk -SGX_MODE ?= SIM +SGX_MODE ?= HW SGX_ARCH ?= x64 +SGX_DEBUG ?= 1 ifeq ($(shell getconf LONG_BIT), 32) SGX_ARCH := x86 @@ -142,10 +143,20 @@ Signed_Enclave_Name := enclave.signed.so Enclave_Config_File := Enclave/Enclave.config.xml ifeq ($(SGX_MODE), HW) -ifneq ($(SGX_DEBUG), 1) -ifneq ($(SGX_PRERELEASE), 1) -Build_Mode = HW_RELEASE +ifeq ($(SGX_DEBUG), 1) + Build_Mode = HW_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = HW_PRERELEASE +else + Build_Mode = HW_RELEASE endif +else +ifeq ($(SGX_DEBUG), 1) + Build_Mode = SIM_DEBUG +else ifeq ($(SGX_PRERELEASE), 1) + Build_Mode = SIM_PRERELEASE +else + Build_Mode = SIM_RELEASE endif endif @@ -162,6 +173,17 @@ all: $(App_Name) $(Enclave_Name) @echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW." else all: $(App_Name) $(Signed_Enclave_Name) +ifeq ($(Build_Mode), HW_DEBUG) + @echo "The project has been built in debug hardware mode." +else ifeq ($(Build_Mode), SIM_DEBUG) + @echo "The project has been built in debug simulation mode." +else ifeq ($(Build_Mode), HW_PRERELEASE) + @echo "The project has been built in pre-release hardware mode." +else ifeq ($(Build_Mode), SIM_PRERELEASE) + @echo "The project has been built in pre-release simulation mode." +else + @echo "The project has been built in release simulation mode." +endif endif run: all diff --git a/SampleCode/SampleEnclave/README.txt b/SampleCode/SampleEnclave/README.txt index b07ef7fcfb..3ecd3c3ac3 100644 --- a/SampleCode/SampleEnclave/README.txt +++ b/SampleCode/SampleEnclave/README.txt @@ -13,17 +13,18 @@ How to Build/Execute the Sample Code 1. Install Intel(R) SGX SDK for Linux* OS 2. Build the project with the prepared Makefile: a. Hardware Mode, Debug build: - $ make SGX_MODE=HW SGX_DEBUG=1 - b. Hardware Mode, Pre-release build: - $ make SGX_MODE=HW SGX_PRERELEASE=1 - c. Hardware Mode, Release build: - $ make SGX_MODE=HW - d. Simulation Mode, Debug build: - $ make SGX_DEBUG=1 - e. Simulation Mode, Pre-release build: - $ make SGX_PRERELEASE=1 - f. Simulation Mode, Release build: $ make + b. Hardware Mode, Pre-release build: + $ make SGX_PRERELEASE=1 SGX_DEBUG=0 + c. Hardware Mode, Release build: + $ make SGX_DEBUG=0 + d. Simulation Mode, Debug build: + $ make SGX_MODE=SIM + e. Simulation Mode, Pre-release build: + $ make SGX_MODE=SIM SGX_PRERELEASE=1 SGX_DEBUG=0 + f. Simulation Mode, Release build: + $ make SGX_MODE=SIM SGX_DEBUG=0 3. Execute the binary directly: $ ./app +4. Remember to "make clean" before switching build mode diff --git a/buildenv.mk b/buildenv.mk index 6fdda27e47..a337f982ab 100644 --- a/buildenv.mk +++ b/buildenv.mk @@ -54,6 +54,8 @@ LINUX_UNITTESTS := $(ROOT_DIR)/unittests CP := /bin/cp -f MKDIR := mkdir -p +STRIP := strip +OBJCOPY := objcopy # clean the content of 'INCLUDE' - this variable will be set by vcvars32.bat # thus it will cause build error when this variable is used by our Makefile, @@ -151,3 +153,28 @@ ENCLAVE_CXXFLAGS = $(ENCLAVE_CFLAGS) -nostdinc++ ENCLAVE_LDFLAGS = -Wl,-Bstatic -Wl,-Bsymbolic -Wl,--no-undefined \ -Wl,-pie,-eenclave_entry -Wl,--export-dynamic \ -Wl,--defsym,__ImageBase=0 + + +# Choose to use the optimized libraries (IPP/String/Math) by default. +# Users could also use the non-optimized source code version by +# explicitly specifying 'USE_OPT_LIBS=0' +USE_OPT_LIBS ?= 1 + +ifeq ($(ARCH), x86_64) +IPP_SUBDIR = intel64 +else +IPP_SUBDIR = ia32 +endif + +ifneq ($(USE_OPT_LIBS), 0) + SGX_IPP_DIR := $(ROOT_DIR)/external/ippcp_internal + SGX_IPP_INC := $(SGX_IPP_DIR)/inc + IPP_LIBS_DIR := $(SGX_IPP_DIR)/lib/linux/$(IPP_SUBDIR) + LD_IPP := -lippcp -lippcore +else + SGX_IPP_DIR := $(ROOT_DIR)/external/crypto_px + SGX_IPP_INC := $(SGX_IPP_DIR)/include + IPP_LIBS_DIR := $(SGX_IPP_DIR) + LD_IPP := -lcrypto_px +endif + diff --git a/common/inc/internal/se_quote_internal.h b/common/inc/internal/se_quote_internal.h index 756cec19c0..ab2ea160f4 100644 --- a/common/inc/internal/se_quote_internal.h +++ b/common/inc/internal/se_quote_internal.h @@ -33,7 +33,7 @@ #define _SE_QUOTE_INTERNAL_H_ #include "se_types.h" -#include "epid_types.h" +#include "epid/common/types.h" #ifdef __cplusplus extern "C" { diff --git a/common/inc/internal/se_version.h b/common/inc/internal/se_version.h index 74491662f5..84814cfc28 100644 --- a/common/inc/internal/se_version.h +++ b/common/inc/internal/se_version.h @@ -28,5 +28,5 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#define STRFILEVER "1.6.100.34922" +#define STRFILEVER "1.7.100.36470" diff --git a/common/inc/sgx_sha256_128.h b/common/inc/internal/sgx_sha256_128.h similarity index 100% rename from common/inc/sgx_sha256_128.h rename to common/inc/internal/sgx_sha256_128.h diff --git a/common/inc/sgx_attributes.h b/common/inc/sgx_attributes.h index 398621e5b0..665ce88547 100644 --- a/common/inc/sgx_attributes.h +++ b/common/inc/sgx_attributes.h @@ -39,8 +39,8 @@ #define SGX_FLAGS_DEBUG 0x0000000000000002ULL /* If set, then the enclave is debug */ #define SGX_FLAGS_MODE64BIT 0x0000000000000004ULL /* If set, then the enclave is 64 bit */ #define SGX_FLAGS_PROVISION_KEY 0x0000000000000010ULL /* If set, then the enclave has access to provision key */ -#define SGX_FLAGS_LICENSE_KEY 0x0000000000000020ULL /* If set, then the enclave has access to License key */ -#define SGX_FLAGS_RESERVED (~(SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG | SGX_FLAGS_MODE64BIT | SGX_FLAGS_PROVISION_KEY | SGX_FLAGS_LICENSE_KEY)) +#define SGX_FLAGS_EINITOKEN_KEY 0x0000000000000020ULL /* If set, then the enclave has access to EINITOKEN key */ +#define SGX_FLAGS_RESERVED (~(SGX_FLAGS_INITTED | SGX_FLAGS_DEBUG | SGX_FLAGS_MODE64BIT | SGX_FLAGS_PROVISION_KEY | SGX_FLAGS_EINITOKEN_KEY)) /* XSAVE Feature Request Mask */ #define SGX_XFRM_LEGACY 0x0000000000000003ULL /* Legacy XFRM */ diff --git a/common/inc/sgx_key.h b/common/inc/sgx_key.h index 7e040fb64c..b607747843 100644 --- a/common/inc/sgx_key.h +++ b/common/inc/sgx_key.h @@ -43,7 +43,7 @@ #include "sgx_attributes.h" /* Key Name */ -#define SGX_KEYSELECT_LICENSE 0x0000 +#define SGX_KEYSELECT_EINITOKEN 0x0000 #define SGX_KEYSELECT_PROVISION 0x0001 #define SGX_KEYSELECT_PROVISION_SEAL 0x0002 #define SGX_KEYSELECT_REPORT 0x0003 @@ -73,15 +73,15 @@ typedef struct _sgx_key_id_t typedef struct _key_request_t { - uint16_t key_name; /* Identifies the key required */ - uint16_t key_policy; /* Identifies which inputs should be used in the key derivation */ - sgx_isv_svn_t isv_svn; /* Security Version of the Enclave */ - uint16_t reserved1; /* Must be 0 */ - sgx_cpu_svn_t cpu_svn; /* Security Version of the CPU */ - sgx_attributes_t attribute_mask; /* Mask which ATTRIBUTES Seal keys should be bound to */ - sgx_key_id_t key_id; /* Value for key wear-out protection */ - sgx_misc_select_t misc_mask; /* Mask what MISCSELECT Seal keys bound to */ - uint8_t reserved2[SGX_KEY_REQUEST_RESERVED2_BYTES]; /* Struct size is 512 bytes */ + uint16_t key_name; /* Identifies the key required */ + uint16_t key_policy; /* Identifies which inputs should be used in the key derivation */ + sgx_isv_svn_t isv_svn; /* Security Version of the Enclave */ + uint16_t reserved1; /* Must be 0 */ + sgx_cpu_svn_t cpu_svn; /* Security Version of the CPU */ + sgx_attributes_t attribute_mask; /* Mask which ATTRIBUTES Seal keys should be bound to */ + sgx_key_id_t key_id; /* Value for key wear-out protection */ + sgx_misc_select_t misc_mask; /* Mask what MISCSELECT Seal keys bound to */ + uint8_t reserved2[SGX_KEY_REQUEST_RESERVED2_BYTES]; /* Struct size is 512 bytes */ } sgx_key_request_t; diff --git a/download_prebuilt.sh b/download_prebuilt.sh index f106f41c95..2d8214786e 100755 --- a/download_prebuilt.sh +++ b/download_prebuilt.sh @@ -32,12 +32,38 @@ top_dir=`dirname $0` -out_dir=$top_dir/psw/ae/data/prebuilt -file_name=sgxprebuilt-1.6.100.34040.tar -server_url=https://download.01.org/intel-sgx/linux-1.6/$file_name -wget $server_url -P $out_dir +#out_dir=$top_dir/psw/ae/data/prebuilt +out_dir=$top_dir +optlib_name=optimized_libs-1.7.100.35958.tar +ae_file_name=prebuilt-ae-1.7.100.35958.tar +server_url_path=https://download.01.org/intel-sgx/linux-1.7/ +server_optlib_url=$server_url_path/$optlib_name +server_ae_url=$server_url_path/$ae_file_name +optlib_md5=d873e20155fceb870c2e14771cc2258a +ae_md5=ca7cf31f1e9fee06feea44732cfbc908 +rm -rf $out_dir/$optlib_name +wget $server_optlib_url -P $out_dir if [ $? -ne 0 ]; then - echo "Fail to download file $server_url" + echo "Fail to download file $server_optlib_url" exit -1 fi -pushd $out_dir;tar -xf $file_name;rm -rf $file_name;popd +md5sum $out_dir/$optlib_name > check_sum.txt +grep $optlib_md5 check_sum.txt +if [ $? -ne 0 ]; then + echo "File $server_optlib_url checksum failure" + exit -1 +fi +rm -rf $out_dir/$ae_file_name +wget $server_ae_url -P $out_dir +if [ $? -ne 0 ]; then + echo "Fail to download file $server_ae_url" + exit -1 +fi +md5sum $out_dir/$ae_file_name > check_sum.txt +grep $ae_md5 check_sum.txt +if [ $? -ne 0 ]; then + echo "File $server_optlib_url checksum failure" + exit -1 +fi + +pushd $out_dir;tar -xf $optlib_name;tar -xf $ae_file_name;rm -f $optlib_name;rm -f $ae_file_name;popd diff --git a/external/crypto_px/Makefile b/external/crypto_px/Makefile index 5c70a24ef6..6739cdaf32 100644 --- a/external/crypto_px/Makefile +++ b/external/crypto_px/Makefile @@ -31,7 +31,7 @@ include ../../buildenv.mk -CFLAGS += $(ENCLAVE_CFLAGS) -D_PX +CFLAGS += -fPIC -D_PX ifeq ($(ARCH), x86_64) CFLAGS += -D_ARCH_EM64T else diff --git a/external/crypto_px/include/ippbase.h b/external/crypto_px/include/ippbase.h index fdcd79e2c6..202cda8f26 100755 --- a/external/crypto_px/include/ippbase.h +++ b/external/crypto_px/include/ippbase.h @@ -1,195 +1,195 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __IPPBASE_H__ -#define __IPPBASE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined( _WIN32 ) || defined ( _WIN64 ) - #define __STDCALL __stdcall - #define __CDECL __cdecl - #define __INT64 __int64 - #define __UINT64 unsigned __int64 -#else - #define __STDCALL - #define __CDECL - #define __INT64 long long - #define __UINT64 unsigned long long -#endif - -#define IPP_PI ( 3.14159265358979323846 ) /* ANSI C does not support M_PI */ -#define IPP_2PI ( 6.28318530717958647692 ) /* 2*pi */ -#define IPP_PI2 ( 1.57079632679489661923 ) /* pi/2 */ -#define IPP_PI4 ( 0.78539816339744830961 ) /* pi/4 */ -#define IPP_PI180 ( 0.01745329251994329577 ) /* pi/180 */ -#define IPP_RPI ( 0.31830988618379067154 ) /* 1/pi */ -#define IPP_SQRT2 ( 1.41421356237309504880 ) /* sqrt(2) */ -#define IPP_SQRT3 ( 1.73205080756887729353 ) /* sqrt(3) */ -#define IPP_LN2 ( 0.69314718055994530942 ) /* ln(2) */ -#define IPP_LN3 ( 1.09861228866810969139 ) /* ln(3) */ -#define IPP_E ( 2.71828182845904523536 ) /* e */ -#define IPP_RE ( 0.36787944117144232159 ) /* 1/e */ -#define IPP_EPS23 ( 1.19209289e-07f ) -#define IPP_EPS52 ( 2.2204460492503131e-016 ) - -#define IPP_MAX_8U ( 0xFF ) -#define IPP_MAX_16U ( 0xFFFF ) -#define IPP_MAX_32U ( 0xFFFFFFFF ) -#define IPP_MIN_8U ( 0 ) -#define IPP_MIN_16U ( 0 ) -#define IPP_MIN_32U ( 0 ) -#define IPP_MIN_8S (-128 ) -#define IPP_MAX_8S ( 127 ) -#define IPP_MIN_16S (-32768 ) -#define IPP_MAX_16S ( 32767 ) -#define IPP_MIN_32S (-2147483647 - 1 ) -#define IPP_MAX_32S ( 2147483647 ) -#define IPP_MIN_64U ( 0 ) - -#if defined( _WIN32 ) || defined ( _WIN64 ) - #define IPP_MAX_64S ( 9223372036854775807i64 ) - #define IPP_MIN_64S (-9223372036854775807i64 - 1 ) - #define IPP_MAX_64U ( 0xffffffffffffffffL ) /* 18446744073709551615 */ -#else - #define IPP_MAX_64S ( 9223372036854775807LL ) - #define IPP_MIN_64S (-9223372036854775807LL - 1 ) - #define IPP_MAX_64U ( 0xffffffffffffffffLL ) /* 18446744073709551615 */ -#endif - -#define IPP_MINABS_32F ( 1.175494351e-38f ) -#define IPP_MAXABS_32F ( 3.402823466e+38f ) -#define IPP_EPS_32F ( 1.192092890e-07f ) -#define IPP_MINABS_64F ( 2.2250738585072014e-308 ) -#define IPP_MAXABS_64F ( 1.7976931348623158e+308 ) -#define IPP_EPS_64F ( 2.2204460492503131e-016 ) - -#define IPP_MAX( a, b ) ( ((a) > (b)) ? (a) : (b) ) -#define IPP_MIN( a, b ) ( ((a) < (b)) ? (a) : (b) ) - -#define IPP_ABS( a ) ( ((a) < 0) ? (-(a)) : (a) ) - -typedef struct { - int major; /* e.g. 1 */ - int minor; /* e.g. 2 */ - int majorBuild; /* e.g. 3 */ - int build; /* e.g. 10, always >= majorBuild */ - char targetCpu[4]; /* corresponding to Intel(R) processor */ - const char* Name; /* e.g. "ippsw7" */ - const char* Version; /* e.g. "v1.2 Beta" */ - const char* BuildDate; /* e.g. "Jul 20 99" */ -} IppLibraryVersion; - -typedef unsigned char Ipp8u; -typedef unsigned short Ipp16u; -typedef unsigned int Ipp32u; -typedef signed char Ipp8s; -typedef signed short Ipp16s; -typedef signed int Ipp32s; -typedef float Ipp32f; -typedef __INT64 Ipp64s; -typedef __UINT64 Ipp64u; -typedef double Ipp64f; -typedef Ipp16s Ipp16f; - -typedef struct { - Ipp8s re; - Ipp8s im; -} Ipp8sc; - -typedef struct { - Ipp16s re; - Ipp16s im; -} Ipp16sc; - -typedef struct { - Ipp16u re; - Ipp16u im; -} Ipp16uc; - -typedef struct { - Ipp32s re; - Ipp32s im; -} Ipp32sc; - -typedef struct { - Ipp32f re; - Ipp32f im; -} Ipp32fc; - -typedef struct { - Ipp64s re; - Ipp64s im; -} Ipp64sc; - -typedef struct { - Ipp64f re; - Ipp64f im; -} Ipp64fc; - -typedef enum { - ippUndef = -1, - ipp1u = 0, - ipp8u = 1, - ipp8uc = 2, - ipp8s = 3, - ipp8sc = 4, - ipp16u = 5, - ipp16uc = 6, - ipp16s = 7, - ipp16sc = 8, - ipp32u = 9, - ipp32uc = 10, - ipp32s = 11, - ipp32sc = 12, - ipp32f = 13, - ipp32fc = 14, - ipp64u = 15, - ipp64uc = 16, - ipp64s = 17, - ipp64sc = 18, - ipp64f = 19, - ipp64fc = 20 -} IppDataType; - -typedef enum { - ippFalse = 0, - ippTrue = 1 -} IppBool; - -#ifdef __cplusplus -} -#endif - -#endif /* __IPPBASE_H__ */ - +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPBASE_H__ +#define __IPPBASE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define __STDCALL __stdcall + #define __CDECL __cdecl + #define __INT64 __int64 + #define __UINT64 unsigned __int64 +#else + #define __STDCALL + #define __CDECL + #define __INT64 long long + #define __UINT64 unsigned long long +#endif + +#define IPP_PI ( 3.14159265358979323846 ) /* ANSI C does not support M_PI */ +#define IPP_2PI ( 6.28318530717958647692 ) /* 2*pi */ +#define IPP_PI2 ( 1.57079632679489661923 ) /* pi/2 */ +#define IPP_PI4 ( 0.78539816339744830961 ) /* pi/4 */ +#define IPP_PI180 ( 0.01745329251994329577 ) /* pi/180 */ +#define IPP_RPI ( 0.31830988618379067154 ) /* 1/pi */ +#define IPP_SQRT2 ( 1.41421356237309504880 ) /* sqrt(2) */ +#define IPP_SQRT3 ( 1.73205080756887729353 ) /* sqrt(3) */ +#define IPP_LN2 ( 0.69314718055994530942 ) /* ln(2) */ +#define IPP_LN3 ( 1.09861228866810969139 ) /* ln(3) */ +#define IPP_E ( 2.71828182845904523536 ) /* e */ +#define IPP_RE ( 0.36787944117144232159 ) /* 1/e */ +#define IPP_EPS23 ( 1.19209289e-07f ) +#define IPP_EPS52 ( 2.2204460492503131e-016 ) + +#define IPP_MAX_8U ( 0xFF ) +#define IPP_MAX_16U ( 0xFFFF ) +#define IPP_MAX_32U ( 0xFFFFFFFF ) +#define IPP_MIN_8U ( 0 ) +#define IPP_MIN_16U ( 0 ) +#define IPP_MIN_32U ( 0 ) +#define IPP_MIN_8S (-128 ) +#define IPP_MAX_8S ( 127 ) +#define IPP_MIN_16S (-32768 ) +#define IPP_MAX_16S ( 32767 ) +#define IPP_MIN_32S (-2147483647 - 1 ) +#define IPP_MAX_32S ( 2147483647 ) +#define IPP_MIN_64U ( 0 ) + +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define IPP_MAX_64S ( 9223372036854775807i64 ) + #define IPP_MIN_64S (-9223372036854775807i64 - 1 ) + #define IPP_MAX_64U ( 0xffffffffffffffffL ) /* 18446744073709551615 */ +#else + #define IPP_MAX_64S ( 9223372036854775807LL ) + #define IPP_MIN_64S (-9223372036854775807LL - 1 ) + #define IPP_MAX_64U ( 0xffffffffffffffffLL ) /* 18446744073709551615 */ +#endif + +#define IPP_MINABS_32F ( 1.175494351e-38f ) +#define IPP_MAXABS_32F ( 3.402823466e+38f ) +#define IPP_EPS_32F ( 1.192092890e-07f ) +#define IPP_MINABS_64F ( 2.2250738585072014e-308 ) +#define IPP_MAXABS_64F ( 1.7976931348623158e+308 ) +#define IPP_EPS_64F ( 2.2204460492503131e-016 ) + +#define IPP_MAX( a, b ) ( ((a) > (b)) ? (a) : (b) ) +#define IPP_MIN( a, b ) ( ((a) < (b)) ? (a) : (b) ) + +#define IPP_ABS( a ) ( ((a) < 0) ? (-(a)) : (a) ) + +typedef struct { + int major; /* e.g. 1 */ + int minor; /* e.g. 2 */ + int majorBuild; /* e.g. 3 */ + int build; /* e.g. 10, always >= majorBuild */ + char targetCpu[4]; /* corresponding to Intel(R) processor */ + const char* Name; /* e.g. "ippsw7" */ + const char* Version; /* e.g. "v1.2 Beta" */ + const char* BuildDate; /* e.g. "Jul 20 99" */ +} IppLibraryVersion; + +typedef unsigned char Ipp8u; +typedef unsigned short Ipp16u; +typedef unsigned int Ipp32u; +typedef signed char Ipp8s; +typedef signed short Ipp16s; +typedef signed int Ipp32s; +typedef float Ipp32f; +typedef __INT64 Ipp64s; +typedef __UINT64 Ipp64u; +typedef double Ipp64f; +typedef Ipp16s Ipp16f; + +typedef struct { + Ipp8s re; + Ipp8s im; +} Ipp8sc; + +typedef struct { + Ipp16s re; + Ipp16s im; +} Ipp16sc; + +typedef struct { + Ipp16u re; + Ipp16u im; +} Ipp16uc; + +typedef struct { + Ipp32s re; + Ipp32s im; +} Ipp32sc; + +typedef struct { + Ipp32f re; + Ipp32f im; +} Ipp32fc; + +typedef struct { + Ipp64s re; + Ipp64s im; +} Ipp64sc; + +typedef struct { + Ipp64f re; + Ipp64f im; +} Ipp64fc; + +typedef enum { + ippUndef = -1, + ipp1u = 0, + ipp8u = 1, + ipp8uc = 2, + ipp8s = 3, + ipp8sc = 4, + ipp16u = 5, + ipp16uc = 6, + ipp16s = 7, + ipp16sc = 8, + ipp32u = 9, + ipp32uc = 10, + ipp32s = 11, + ipp32sc = 12, + ipp32f = 13, + ipp32fc = 14, + ipp64u = 15, + ipp64uc = 16, + ipp64s = 17, + ipp64sc = 18, + ipp64f = 19, + ipp64fc = 20 +} IppDataType; + +typedef enum { + ippFalse = 0, + ippTrue = 1 +} IppBool; + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPBASE_H__ */ + diff --git a/external/crypto_px/include/ippcore.h b/external/crypto_px/include/ippcore.h index e4bc012bc6..ec5185923c 100755 --- a/external/crypto_px/include/ippcore.h +++ b/external/crypto_px/include/ippcore.h @@ -1,395 +1,395 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined( __IPPCORE_H__ ) || defined( _OWN_BLDPCS ) -#define __IPPCORE_H__ - -#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall) - #define _IPP_STDCALL_CDECL - #undef __stdcall -#endif - -#ifndef __IPPDEFS_H__ - #include "ippdefs.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -#if !defined( _IPP_NO_DEFAULT_LIB ) - #if defined( _IPP_SEQUENTIAL_DYNAMIC ) - #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcore" ) - #elif defined( _IPP_SEQUENTIAL_STATIC ) - #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcoremt" ) - #elif defined( _IPP_PARALLEL_DYNAMIC ) - #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcore" ) - #elif defined( _IPP_PARALLEL_STATIC ) - #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcoremt" ) - #endif -#endif - -/* ///////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Functions declarations -//////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// */ - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippGetLibVersion -// Purpose: getting of the library version -// Returns: the structure of information about version -// of ippcore library -// Parameters: -// -// Notes: not necessary to release the returned structure -*/ -IPPAPI( const IppLibraryVersion*, ippGetLibVersion, (void) ) - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippGetStatusString -// Purpose: convert the library status code to a readable string -// Parameters: -// StsCode IPP status code -// Returns: pointer to string describing the library status code -// -// Notes: don't free the pointer -*/ -IPPAPI( const char*, ippGetStatusString, ( IppStatus StsCode ) ) - - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippGetCpuClocks -// Purpose: reading of time stamp counter (TSC) register value -// Returns: TSC value -// -// Note: An hardware exception is possible if TSC reading is not supported by -/ the current chipset -*/ - -IPPAPI( Ipp64u, ippGetCpuClocks, (void) ) - - -/* /////////////////////////////////////////////////////////////////////////// -// Names: ippSetFlushToZero, -// ippSetDenormAreZero. -// -// Purpose: ippSetFlushToZero enables or disables the flush-to-zero mode, -// ippSetDenormAreZero enables or disables the denormals-are-zeros -// mode. -// -// Arguments: -// value - !0 or 0 - set or clear the corresponding bit of MXCSR -// pUMask - pointer to user store current underflow exception mask -// ( may be NULL if don't want to store ) -// -// Return: -// ippStsNoErr - Ok -// ippStsCpuNotSupportedErr - the mode is not supported -*/ - -IPPAPI( IppStatus, ippSetFlushToZero, ( int value, unsigned int* pUMask )) -IPPAPI( IppStatus, ippSetDenormAreZeros, ( int value )) - - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippAlignPtr -// Purpose: pointer aligning -// Returns: aligned pointer -// -// Parameter: -// ptr - pointer -// alignBytes - number of bytes to align -// -*/ -IPPAPI( void*, ippAlignPtr, ( void * ptr, int alignBytes ) ) - -/* ///////////////////////////////////////////////////////////////////////////// -// Functions to allocate and free memory -///////////////////////////////////////////////////////////////////////////// */ -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippMalloc -// Purpose: 64-byte aligned memory allocation -// Parameter: -// len number of bytes -// Returns: pointer to allocated memory -// -// Notes: the memory allocated by ippMalloc has to be free by ippFree -// function only. -*/ - -IPPAPI( void*, ippMalloc, (int length) ) - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippFree -// Purpose: free memory allocated by the ippMalloc function -// Parameter: -// ptr pointer to the memory allocated by the ippMalloc function -// -// Notes: use the function to free memory allocated by ippMalloc -*/ -IPPAPI( void, ippFree, (void* ptr) ) - - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippInit -// Purpose: Automatic switching to best for current cpu library code using. -// Returns: -// ippStsNoErr -// -// Parameter: nothing -// -// Notes: At the moment of this function execution no any other IPP function -// has to be working -*/ -IPPAPI( IppStatus, ippInit, ( void )) - - -/* //////////////////////////////////////////////////////////////////////////// -// Name: ippGetCpuFreqMhz -// -// Purpose: the function estimates cpu frequency and returns -// its value in MHz as a integer -// -// Return: -// ippStsNoErr Ok -// ippStsNullPtrErr null pointer to the freq value -// ippStsSizeErr wrong num of tries, internal var -// Arguments: -// pMhz pointer to the integer to write -// cpu freq value estimated -// -// Notes: no exact value is guaranteed, the value could -// vary with cpu workloading -*/ - -IPPAPI(IppStatus, ippGetCpuFreqMhz, ( int* pMhz ) ) - -/* //////////////////////////////////////////////////////////////////////////// -// Name: ippSetNumThreads -// -// Purpose: -// -// Return: -// ippStsNoErr Ok -// ippStsNoOperation For static library internal threading is not supported -// ippStsSizeErr Desired number of threads less or equal zero -// -// Arguments: -// numThr Desired number of threads -*/ -IPPAPI( IppStatus, ippSetNumThreads, ( int numThr ) ) - -/* //////////////////////////////////////////////////////////////////////////// -// Name: ippGetNumThreads -// -// Purpose: -// -// Return: -// ippStsNoErr Ok -// ippStsNullPtrErr Pointer to numThr is Null -// ippStsNoOperation For static library internal threading is not supported -// and return value is always == 1 -// -// Arguments: -// pNumThr Pointer to memory location where to store current numThr -*/ -IPPAPI( IppStatus, ippGetNumThreads, (int* pNumThr) ) - -/* //////////////////////////////////////////////////////////////////////////// -// Name: ippGetMaxCacheSizeB -// -// Purpose: Detects maximal from the sizes of L2 or L3 in bytes -// -// Return: -// ippStsNullPtrErr The result's pointer is NULL. -// ippStsNotSupportedCpu The cpu is not supported. -// ippStsUnknownCacheSize The cpu is supported, but the size of the cache is unknown. -// ippStsNoErr Ok -// -// Arguments: -// pSizeByte Pointer to the result -// -// Note: -// 1). Intel(R) processors are supported only. -// 2). Intel(R) Itanium(R) processors and platforms with Intel XScale(R) technology are unsupported -// 3). For unsupported processors the result is "0", -// and the return status is "ippStsNotSupportedCpu". -// 4). For supported processors the result is "0", -// and the return status is "ippStsUnknownCacheSize". -// if sizes of the cache is unknown. -// -*/ -IPPAPI( IppStatus, ippGetMaxCacheSizeB, ( int* pSizeByte ) ) - -/* -// Name: ippGetCpuFeatures -// Purpose: Detects CPU features. -// Parameters: -// pFeaturesMask Pointer to the features mask. -// Nonzero value of bit means the corresponding feature is supported. -// Features mask values are defined in the ippdefs.h -// [ 0] - MMX ( ippCPUID_MMX ) -// [ 1] - SSE ( ippCPUID_SSE ) -// [ 2] - SSE2 ( ippCPUID_SSE2 ) -// [ 3] - SSE3 ( ippCPUID_SSE3 ) -// [ 4] - SSSE3 ( ippCPUID_SSSE3 ) -// [ 5] - MOVBE ( ippCPUID_MOVBE ) -// [ 6] - SSE41 ( ippCPUID_SSE41 ) -// [ 7] - SSE42 ( ippCPUID_SSE42 ) -// [ 8] - AVX ( ippCPUID_AVX ) -// [ 9] - ENABLEDBYOS( ippAVX_ENABLEDBYOS ) -// [10] - AES ( ippCPUID_AES ) -// [11] - PCLMULQDQ ( ippCPUID_CLMUL ) -// [12] - ABR ( ippCPUID_ABR ) -// [13] - RDRAND ( ippCPUID_RDRAND ) -// [14] - F16C ( ippCPUID_F16C ) -// [15] - AVX2 ( ippCPUID_AVX2 ) -// [16] - ADOX/ADCX ( ippCPUID_ADCOX ) ADCX and ADOX instructions -// [17] - RDSEED ( ippCPUID_RDSEED ) The RDSEED instruction -// [18] - PREFETCHW ( ippCPUID_PREFETCHW ) The PREFETCHW instruction -// [19] - SHA ( ippCPUID_SHA ) Intel (R) SHA Extensions -// [20:63] - Reserved -// -// pCpuidInfoRegs Pointer to the 4-element vector. -// Result of CPUID.1 are stored in this vector. -// [0] - register EAX -// [1] - register EBX -// [2] - register ECX -// [3] - register EDX -// If pointer pCpuidInfoRegs is set to NULL, registers are not stored. -// -// Returns: -// ippStsNullPtrErr The pointer to the features mask (pFeaturesMask) is NULL. -// ippStsNotSupportedCpu CPU is not supported. -// ippStsNoErr Ok -// -// Note: Only IA-32 and Intel(R) 64 are supported -*/ -IPPAPI( IppStatus, ippGetCpuFeatures, ( Ipp64u* pFeaturesMask, - Ipp32u pCpuidInfoRegs[4] ) ) - -/* -// Name: ippGetEnabledCpuFeatures -// Purpose: Detects enabled features for loaded libraries -// Returns: Features mask -// Features mask values are defined in the ippdefs.h -// [ 0] - ippCPUID_MMX -// [ 1] - ippCPUID_SSE -// [ 2] - ippCPUID_SSE2 -// [ 3] - ippCPUID_SSE3 -// [ 4] - ippCPUID_SSSE3 -// [ 5] - ippCPUID_MOVBE -// [ 6] - ippCPUID_SSE41 -// [ 7] - ippCPUID_SSE42 -// [ 8] - ippCPUID_AVX -// [ 9] - ippAVX_ENABLEDBYOS -// [10] - ippCPUID_AES -// [11] - ippCPUID_CLMUL -// [12] - ippCPUID_ABR -// [13] - ippCPUID_RDRAND -// [14] - ippCPUID_F16C -// [15] - ippCPUID_AVX2 -// [16] - ippCPUID_ADCOX -// [17] - ippCPUID_RDSEED -// [18] - ippCPUID_PREFETCHW -// [19] - ippCPUID_SHA -// [20:63] - Reserved -// -*/ -IPPAPI( Ipp64u, ippGetEnabledCpuFeatures, ( void ) ) - -/* //////////////////////////////////////////////////////////////////////////// -// Name: ippSetCpuFeatures -// -// Purpose: Changes the set of enabled/disabled CPU features. -// This function sets the processor-specific code of the Intel IPP -// library according to the processor features specified in cpuFeatures. -// -// Return: -// ippStsNoErr No errors. -// Warnings: -// ippStsFeatureNotSupported Current CPU doesn't support at least 1 of the -// desired features; -// ippStsUnknownFeature At least one of the desired features is unknown; -// ippStsFeaturesCombination Wrong combination of features; -// ippStsCpuMismatch Indicates that the specified processor features -// are not valid. Previously set code is used. -// -// Arguments: -// cpuFeatures Desired features to support by the library -// (see ippdefs.h for ippCPUID_XX definition) -// -// NOTE: this function can re-initializes dispatcher and after the -// call another library (letter) may work -// CAUTION: At the moment of this function excecution no any other IPP -// function has to be working -// -// The next pre-defined sets of features can be used: -// 32-bit code: -// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE ) -// #define W7_FM ( PX_FM | ippCPUID_SSE2 ) -// #define V8_FM ( W7_FM | ippCPUID_SSE3 | ippCPUID_SSSE3 ) -// #define S8_FM ( V8_FM | ippCPUID_MOVBE ) -// #define P8_FM ( V8_FM | ippCPUID_SSE41 | ippCPUID_SSE42 | ippCPUID_AES | ippCPUID_CLMUL | ippCPUID_SHA ) -// #define G9_FM ( P8_FM | ippCPUID_AVX | ippAVX_ENABLEDBYOS | ippCPUID_RDRAND | ippCPUID_F16C ) -// #define H9_FM ( G9_FM | ippCPUID_AVX2 | ippCPUID_MOVBE | ippCPUID_ADCOX | ippCPUID_RDSEED | ippCPUID_PREFETCHW ) -// -// 64-bit code: -// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE | ippCPUID_SSE2 ) -// #define M7_FM ( PX_FM | ippCPUID_SSE3 ) -// #define N8_FM ( S8_FM ) -// #define U8_FM ( V8_FM ) -// #define Y8_FM ( P8_FM ) -// #define E9_FM ( G9_FM ) -// #define L9_FM ( H9_FM ) -// -*/ - -IPPAPI( IppStatus, ippSetCpuFeatures,( Ipp64u cpuFeatures )) - -#if defined (_IPP_STDCALL_CDECL) - #undef _IPP_STDCALL_CDECL - #define __stdcall __cdecl -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __IPPCORE_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined( __IPPCORE_H__ ) || defined( _OWN_BLDPCS ) +#define __IPPCORE_H__ + +#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall) + #define _IPP_STDCALL_CDECL + #undef __stdcall +#endif + +#ifndef __IPPDEFS_H__ + #include "ippdefs.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +#if !defined( _IPP_NO_DEFAULT_LIB ) + #if defined( _IPP_SEQUENTIAL_DYNAMIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcore" ) + #elif defined( _IPP_SEQUENTIAL_STATIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "ippcoremt" ) + #elif defined( _IPP_PARALLEL_DYNAMIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcore" ) + #elif defined( _IPP_PARALLEL_STATIC ) + #pragma comment( lib, __FILE__ "/../../lib/" _INTEL_PLATFORM "threaded/ippcoremt" ) + #endif +#endif + +/* ///////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// Functions declarations +//////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// */ + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippGetLibVersion +// Purpose: getting of the library version +// Returns: the structure of information about version +// of ippcore library +// Parameters: +// +// Notes: not necessary to release the returned structure +*/ +IPPAPI( const IppLibraryVersion*, ippGetLibVersion, (void) ) + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippGetStatusString +// Purpose: convert the library status code to a readable string +// Parameters: +// StsCode IPP status code +// Returns: pointer to string describing the library status code +// +// Notes: don't free the pointer +*/ +IPPAPI( const char*, ippGetStatusString, ( IppStatus StsCode ) ) + + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippGetCpuClocks +// Purpose: reading of time stamp counter (TSC) register value +// Returns: TSC value +// +// Note: An hardware exception is possible if TSC reading is not supported by +/ the current chipset +*/ + +IPPAPI( Ipp64u, ippGetCpuClocks, (void) ) + + +/* /////////////////////////////////////////////////////////////////////////// +// Names: ippSetFlushToZero, +// ippSetDenormAreZero. +// +// Purpose: ippSetFlushToZero enables or disables the flush-to-zero mode, +// ippSetDenormAreZero enables or disables the denormals-are-zeros +// mode. +// +// Arguments: +// value - !0 or 0 - set or clear the corresponding bit of MXCSR +// pUMask - pointer to user store current underflow exception mask +// ( may be NULL if don't want to store ) +// +// Return: +// ippStsNoErr - Ok +// ippStsCpuNotSupportedErr - the mode is not supported +*/ + +IPPAPI( IppStatus, ippSetFlushToZero, ( int value, unsigned int* pUMask )) +IPPAPI( IppStatus, ippSetDenormAreZeros, ( int value )) + + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippAlignPtr +// Purpose: pointer aligning +// Returns: aligned pointer +// +// Parameter: +// ptr - pointer +// alignBytes - number of bytes to align +// +*/ +IPPAPI( void*, ippAlignPtr, ( void * ptr, int alignBytes ) ) + +/* ///////////////////////////////////////////////////////////////////////////// +// Functions to allocate and free memory +///////////////////////////////////////////////////////////////////////////// */ +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippMalloc +// Purpose: 64-byte aligned memory allocation +// Parameter: +// len number of bytes +// Returns: pointer to allocated memory +// +// Notes: the memory allocated by ippMalloc has to be free by ippFree +// function only. +*/ + +IPPAPI( void*, ippMalloc, (int length) ) + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippFree +// Purpose: free memory allocated by the ippMalloc function +// Parameter: +// ptr pointer to the memory allocated by the ippMalloc function +// +// Notes: use the function to free memory allocated by ippMalloc +*/ +IPPAPI( void, ippFree, (void* ptr) ) + + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippInit +// Purpose: Automatic switching to best for current cpu library code using. +// Returns: +// ippStsNoErr +// +// Parameter: nothing +// +// Notes: At the moment of this function execution no any other IPP function +// has to be working +*/ +IPPAPI( IppStatus, ippInit, ( void )) + + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippGetCpuFreqMhz +// +// Purpose: the function estimates cpu frequency and returns +// its value in MHz as a integer +// +// Return: +// ippStsNoErr Ok +// ippStsNullPtrErr null pointer to the freq value +// ippStsSizeErr wrong num of tries, internal var +// Arguments: +// pMhz pointer to the integer to write +// cpu freq value estimated +// +// Notes: no exact value is guaranteed, the value could +// vary with cpu workloading +*/ + +IPPAPI(IppStatus, ippGetCpuFreqMhz, ( int* pMhz ) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippSetNumThreads +// +// Purpose: +// +// Return: +// ippStsNoErr Ok +// ippStsNoOperation For static library internal threading is not supported +// ippStsSizeErr Desired number of threads less or equal zero +// +// Arguments: +// numThr Desired number of threads +*/ +IPPAPI( IppStatus, ippSetNumThreads, ( int numThr ) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippGetNumThreads +// +// Purpose: +// +// Return: +// ippStsNoErr Ok +// ippStsNullPtrErr Pointer to numThr is Null +// ippStsNoOperation For static library internal threading is not supported +// and return value is always == 1 +// +// Arguments: +// pNumThr Pointer to memory location where to store current numThr +*/ +IPPAPI( IppStatus, ippGetNumThreads, (int* pNumThr) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippGetMaxCacheSizeB +// +// Purpose: Detects maximal from the sizes of L2 or L3 in bytes +// +// Return: +// ippStsNullPtrErr The result's pointer is NULL. +// ippStsNotSupportedCpu The cpu is not supported. +// ippStsUnknownCacheSize The cpu is supported, but the size of the cache is unknown. +// ippStsNoErr Ok +// +// Arguments: +// pSizeByte Pointer to the result +// +// Note: +// 1). Intel(R) processors are supported only. +// 2). Intel(R) Itanium(R) processors and platforms with Intel XScale(R) technology are unsupported +// 3). For unsupported processors the result is "0", +// and the return status is "ippStsNotSupportedCpu". +// 4). For supported processors the result is "0", +// and the return status is "ippStsUnknownCacheSize". +// if sizes of the cache is unknown. +// +*/ +IPPAPI( IppStatus, ippGetMaxCacheSizeB, ( int* pSizeByte ) ) + +/* +// Name: ippGetCpuFeatures +// Purpose: Detects CPU features. +// Parameters: +// pFeaturesMask Pointer to the features mask. +// Nonzero value of bit means the corresponding feature is supported. +// Features mask values are defined in the ippdefs.h +// [ 0] - MMX ( ippCPUID_MMX ) +// [ 1] - SSE ( ippCPUID_SSE ) +// [ 2] - SSE2 ( ippCPUID_SSE2 ) +// [ 3] - SSE3 ( ippCPUID_SSE3 ) +// [ 4] - SSSE3 ( ippCPUID_SSSE3 ) +// [ 5] - MOVBE ( ippCPUID_MOVBE ) +// [ 6] - SSE41 ( ippCPUID_SSE41 ) +// [ 7] - SSE42 ( ippCPUID_SSE42 ) +// [ 8] - AVX ( ippCPUID_AVX ) +// [ 9] - ENABLEDBYOS( ippAVX_ENABLEDBYOS ) +// [10] - AES ( ippCPUID_AES ) +// [11] - PCLMULQDQ ( ippCPUID_CLMUL ) +// [12] - ABR ( ippCPUID_ABR ) +// [13] - RDRAND ( ippCPUID_RDRAND ) +// [14] - F16C ( ippCPUID_F16C ) +// [15] - AVX2 ( ippCPUID_AVX2 ) +// [16] - ADOX/ADCX ( ippCPUID_ADCOX ) ADCX and ADOX instructions +// [17] - RDSEED ( ippCPUID_RDSEED ) The RDSEED instruction +// [18] - PREFETCHW ( ippCPUID_PREFETCHW ) The PREFETCHW instruction +// [19] - SHA ( ippCPUID_SHA ) Intel (R) SHA Extensions +// [20:63] - Reserved +// +// pCpuidInfoRegs Pointer to the 4-element vector. +// Result of CPUID.1 are stored in this vector. +// [0] - register EAX +// [1] - register EBX +// [2] - register ECX +// [3] - register EDX +// If pointer pCpuidInfoRegs is set to NULL, registers are not stored. +// +// Returns: +// ippStsNullPtrErr The pointer to the features mask (pFeaturesMask) is NULL. +// ippStsNotSupportedCpu CPU is not supported. +// ippStsNoErr Ok +// +// Note: Only IA-32 and Intel(R) 64 are supported +*/ +IPPAPI( IppStatus, ippGetCpuFeatures, ( Ipp64u* pFeaturesMask, + Ipp32u pCpuidInfoRegs[4] ) ) + +/* +// Name: ippGetEnabledCpuFeatures +// Purpose: Detects enabled features for loaded libraries +// Returns: Features mask +// Features mask values are defined in the ippdefs.h +// [ 0] - ippCPUID_MMX +// [ 1] - ippCPUID_SSE +// [ 2] - ippCPUID_SSE2 +// [ 3] - ippCPUID_SSE3 +// [ 4] - ippCPUID_SSSE3 +// [ 5] - ippCPUID_MOVBE +// [ 6] - ippCPUID_SSE41 +// [ 7] - ippCPUID_SSE42 +// [ 8] - ippCPUID_AVX +// [ 9] - ippAVX_ENABLEDBYOS +// [10] - ippCPUID_AES +// [11] - ippCPUID_CLMUL +// [12] - ippCPUID_ABR +// [13] - ippCPUID_RDRAND +// [14] - ippCPUID_F16C +// [15] - ippCPUID_AVX2 +// [16] - ippCPUID_ADCOX +// [17] - ippCPUID_RDSEED +// [18] - ippCPUID_PREFETCHW +// [19] - ippCPUID_SHA +// [20:63] - Reserved +// +*/ +IPPAPI( Ipp64u, ippGetEnabledCpuFeatures, ( void ) ) + +/* //////////////////////////////////////////////////////////////////////////// +// Name: ippSetCpuFeatures +// +// Purpose: Changes the set of enabled/disabled CPU features. +// This function sets the processor-specific code of the Intel IPP +// library according to the processor features specified in cpuFeatures. +// +// Return: +// ippStsNoErr No errors. +// Warnings: +// ippStsFeatureNotSupported Current CPU doesn't support at least 1 of the +// desired features; +// ippStsUnknownFeature At least one of the desired features is unknown; +// ippStsFeaturesCombination Wrong combination of features; +// ippStsCpuMismatch Indicates that the specified processor features +// are not valid. Previously set code is used. +// +// Arguments: +// cpuFeatures Desired features to support by the library +// (see ippdefs.h for ippCPUID_XX definition) +// +// NOTE: this function can re-initializes dispatcher and after the +// call another library (letter) may work +// CAUTION: At the moment of this function excecution no any other IPP +// function has to be working +// +// The next pre-defined sets of features can be used: +// 32-bit code: +// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE ) +// #define W7_FM ( PX_FM | ippCPUID_SSE2 ) +// #define V8_FM ( W7_FM | ippCPUID_SSE3 | ippCPUID_SSSE3 ) +// #define S8_FM ( V8_FM | ippCPUID_MOVBE ) +// #define P8_FM ( V8_FM | ippCPUID_SSE41 | ippCPUID_SSE42 | ippCPUID_AES | ippCPUID_CLMUL | ippCPUID_SHA ) +// #define G9_FM ( P8_FM | ippCPUID_AVX | ippAVX_ENABLEDBYOS | ippCPUID_RDRAND | ippCPUID_F16C ) +// #define H9_FM ( G9_FM | ippCPUID_AVX2 | ippCPUID_MOVBE | ippCPUID_ADCOX | ippCPUID_RDSEED | ippCPUID_PREFETCHW ) +// +// 64-bit code: +// #define PX_FM ( ippCPUID_MMX | ippCPUID_SSE | ippCPUID_SSE2 ) +// #define M7_FM ( PX_FM | ippCPUID_SSE3 ) +// #define N8_FM ( S8_FM ) +// #define U8_FM ( V8_FM ) +// #define Y8_FM ( P8_FM ) +// #define E9_FM ( G9_FM ) +// #define L9_FM ( H9_FM ) +// +*/ + +IPPAPI( IppStatus, ippSetCpuFeatures,( Ipp64u cpuFeatures )) + +#if defined (_IPP_STDCALL_CDECL) + #undef _IPP_STDCALL_CDECL + #define __stdcall __cdecl +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPCORE_H__ */ diff --git a/external/crypto_px/include/ippcp.h b/external/crypto_px/include/ippcp.h index 07d92d52b5..48d1d81cce 100755 --- a/external/crypto_px/include/ippcp.h +++ b/external/crypto_px/include/ippcp.h @@ -1,327 +1,327 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined( __IPPCP_H__ ) || defined( _OWN_BLDPCS ) -#define __IPPCP_H__ - - -#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall) - #define _IPP_STDCALL_CDECL - #undef __stdcall -#endif - - -#ifndef __IPPDEFS_H__ - #include "ippdefs.h" -#endif - -#ifndef __IPPCPDEFS_H__ - #include "ippcpdefs.h" -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* ///////////////////////////////////////////////////////////////////////////// -// Name: ippcpGetLibVersion -// Purpose: getting of the library version -// Returns: the structure of information about version of ippCP library -// Parameters: -// -// Notes: not necessary to release the returned structure -*/ -IPPAPI( const IppLibraryVersion*, ippcpGetLibVersion, (void) ) - - -/* -// AES -*/ -IPPAPI(IppStatus, ippsAESGetSize,(int *pSize)) -IPPAPI(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) - -/* AES-CTR */ -IPPAPI(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, - const IppsAESSpec* pCtx, - Ipp8u* pCtrValue, int ctrNumBitSize)) -IPPAPI(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, - const IppsAESSpec* pCtx, - Ipp8u* pCtrValue, int ctrNumBitSize)) - -/* AES-GCM */ -IPPAPI(IppStatus, ippsAES_GCMGetSize,(int * pSize)) -IPPAPI(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) - -IPPAPI(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState)) -IPPAPI(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, - IppsAES_GCMState* pState)) -IPPAPI(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, - IppsAES_GCMState* pState)) -IPPAPI(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, - const Ipp8u* pAAD, int aadLen, - IppsAES_GCMState* pState)) -IPPAPI(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) -IPPAPI(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) - -/* AES-CMAC */ -IPPAPI(IppStatus, ippsAES_CMACGetSize,(int* pSize)) -IPPAPI(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) - -IPPAPI(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) -IPPAPI(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) -IPPAPI(IppStatus, ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) - -/* -// hash -*/ -IPPAPI(IppStatus, ippsHashGetSize,(int* pSize)) -IPPAPI(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId hashAlg)) - -IPPAPI(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx)) -IPPAPI(IppStatus, ippsHashGetTag,(Ipp8u* pMD, int tagLen, const IppsHashState* pCtx)) -IPPAPI(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx)) -IPPAPI(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) - -IPPAPI(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) - -IPPAPI(IppStatus, ippsHMAC_GetSize,(int* pSize)) -IPPAPI(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) - -IPPAPI(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) -IPPAPI(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) -IPPAPI(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) -IPPAPI(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, - const Ipp8u* pKey, int keyLen, - Ipp8u* pMD, int mdLen, - IppHashAlgId hashAlg)) - -/* -// Big Number Integer Arithmetic -*/ -IPPAPI(IppStatus, ippsBigNumGetSize,(int length, int* pSize)) -IPPAPI(IppStatus, ippsBigNumInit,(int length, IppsBigNumState* pBN)) - -IPPAPI(IppStatus, ippsSet_BN,(IppsBigNumSGN sgn, - int length, const Ipp32u* pData, - IppsBigNumState* pBN)) -IPPAPI(IppStatus, ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, - const IppsBigNumState* pBN)) - -IPPAPI(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) -IPPAPI(IppStatus, ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) -IPPAPI(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) -IPPAPI(IppStatus, ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) -IPPAPI(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) -IPPAPI(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -IPPAPI(IppStatus, ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) - -IPPAPI(IppStatus, ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) -IPPAPI(IppStatus, ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) - -/* -// Montgomery Operations -*/ -IPPAPI(IppStatus, ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) -IPPAPI(IppStatus, ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) -IPPAPI(IppStatus, ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) -IPPAPI(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) - -/* -// PRNG -*/ -IPPAPI(IppStatus, ippsPRNGGetSize,(int* pSize)) -IPPAPI(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) -IPPAPI(IppStatus, ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) - -/* -// Prime Number Generation -*/ -IPPAPI(IppStatus, ippsPrimeGetSize,(int nMaxBits, int* pSize)) -IPPAPI(IppStatus, ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) - - -/* -// RSA -*/ -IPPAPI(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) -IPPAPI(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, - IppsRSAPublicKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, - const IppsBigNumState* pPublicExp, - IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, - IppsBigNumState* pPublicExp, - const IppsRSAPublicKeyState* pKey)) - -IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) -IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, - IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, - const IppsBigNumState* pPrivateExp, - IppsRSAPrivateKeyState* pKey)) - -IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) -IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, - IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, - const IppsBigNumState* pFactorQ, - const IppsBigNumState* pCrtExpP, - const IppsBigNumState* pCrtExpQ, - const IppsBigNumState* pInverseQ, - IppsRSAPrivateKeyState* pKey)) - -IPPAPI(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) -IPPAPI(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) - -IPPAPI(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, - IppsBigNumState* pCtxt, - const IppsRSAPublicKeyState* pKey, - Ipp8u* pScratchBuffer)) -IPPAPI(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, - IppsBigNumState* pPtxt, - const IppsRSAPrivateKeyState* pKey, - Ipp8u* pScratchBuffer)) - -IPPAPI(IppStatus, ippsRSA_ValidateKeys,(int* pResult, - const IppsRSAPublicKeyState* pPublicKey, - const IppsRSAPrivateKeyState* pPrivateKeyType2, - const IppsRSAPrivateKeyState* pPrivateKeyType1, - Ipp8u* pScratchBuffer, - int nTrials, - IppsPrimeState* pPrimeGen, - IppBitSupplier rndFunc, void* pRndParam)) - -/* encryption scheme: RSAES-OAEP */ -IPPAPI(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, - const Ipp8u* pLabel, int labLen, - const Ipp8u* pSeed, - Ipp8u* pDst, - const IppsRSAPublicKeyState* pKey, - IppHashAlgId hashAlg, - Ipp8u* pBuffer)) -IPPAPI(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen, - const Ipp8u* pLabel, int labLen, - const Ipp8u* pSeed, - Ipp8u* pDst, - const IppsRSAPublicKeyState* pKey, - Ipp8u* pBuffer)) - -/* signature scheme : RSA-SSA-PKCS1-v1_5 */ -IPPAPI(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, - Ipp8u* pSign, - const IppsRSAPrivateKeyState* pPrvKey, - const IppsRSAPublicKeyState* pPubKey, - IppHashAlgId hashAlg, - Ipp8u* pBuffer)) - - -IPPAPI(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, - const Ipp8u* pSign, int* pIsValid, - const IppsRSAPublicKeyState* pKey, - IppHashAlgId hashAlg, - Ipp8u* pBuffer)) - - -/* -// EC Cryptography -*/ -IPPAPI(IppStatus, ippsECCPGetSize,(int feBitSize, int* pSize)) -IPPAPI(IppStatus, ippsECCPInit,(int feBitSize, IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPSet,(const IppsBigNumState* pPrime, - const IppsBigNumState* pA, const IppsBigNumState* pB, - const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, - int cofactor, - IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPSetStd,(IppECCType flag, IppsECCPState* pECC)) - - -IPPAPI(IppStatus, ippsECCPPointGetSize,(int feBitSize, int* pSize)) -IPPAPI(IppStatus, ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) - -IPPAPI(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, - IppsECCPPointState* pPoint, IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, - const IppsECCPPointState* pPoint, IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP, - IppECResult* pResult, IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, - IppECResult* pResult, IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPNegativePoint,(const IppsECCPPointState* pP, - IppsECCPPointState* pR, IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, - IppsECCPPointState* pR, IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, - IppsECCPPointState* pR, IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, - IppsECCPState* pECC, - IppBitSupplier rndFunc, void* pRndParam)) -IPPAPI(IppStatus, ippsECCPPublicKey,(const IppsBigNumState* pPrivate, - IppsECCPPointState* pPublic, - IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, - IppBool regular, - IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, - const IppsECCPPointState* pPublicB, - IppsBigNumState* pShare, - IppsECCPState* pECC)) - -IPPAPI(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, - const IppsBigNumState* pPrivate, - IppsBigNumState* pSignX, IppsBigNumState* pSignY, - IppsECCPState* pECC)) -IPPAPI(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, - const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, - IppECResult* pResult, - IppsECCPState* pECC)) - -#ifdef __cplusplus -} -#endif - -#if defined (_IPP_STDCALL_CDECL) - #undef _IPP_STDCALL_CDECL - #define __stdcall __cdecl -#endif - -#endif /* __IPPCP_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined( __IPPCP_H__ ) || defined( _OWN_BLDPCS ) +#define __IPPCP_H__ + + +#if defined (_WIN32_WCE) && defined (_M_IX86) && defined (__stdcall) + #define _IPP_STDCALL_CDECL + #undef __stdcall +#endif + + +#ifndef __IPPDEFS_H__ + #include "ippdefs.h" +#endif + +#ifndef __IPPCPDEFS_H__ + #include "ippcpdefs.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ///////////////////////////////////////////////////////////////////////////// +// Name: ippcpGetLibVersion +// Purpose: getting of the library version +// Returns: the structure of information about version of ippCP library +// Parameters: +// +// Notes: not necessary to release the returned structure +*/ +IPPAPI( const IppLibraryVersion*, ippcpGetLibVersion, (void) ) + + +/* +// AES +*/ +IPPAPI(IppStatus, ippsAESGetSize,(int *pSize)) +IPPAPI(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, IppsAESSpec* pCtx, int ctxSize)) + +/* AES-CTR */ +IPPAPI(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) +IPPAPI(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int len, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) + +/* AES-GCM */ +IPPAPI(IppStatus, ippsAES_GCMGetSize,(int * pSize)) +IPPAPI(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) + +IPPAPI(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, + IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int ivAAD, + IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, + const Ipp8u* pAAD, int aadLen, + IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int len, IppsAES_GCMState* pState)) +IPPAPI(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pDstTag, int tagLen, const IppsAES_GCMState* pState)) + +/* AES-CMAC */ +IPPAPI(IppStatus, ippsAES_CMACGetSize,(int* pSize)) +IPPAPI(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pState, int ctxSize)) + +IPPAPI(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pState)) +IPPAPI(IppStatus, ippsAES_CMACGetTag,(Ipp8u* pMD, int mdLen, const IppsAES_CMACState* pState)) + +/* +// hash +*/ +IPPAPI(IppStatus, ippsHashGetSize,(int* pSize)) +IPPAPI(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx)) +IPPAPI(IppStatus, ippsHashGetTag,(Ipp8u* pMD, int tagLen, const IppsHashState* pCtx)) +IPPAPI(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx)) +IPPAPI(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int len, Ipp8u* pMD, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsHMAC_GetSize,(int* pSize)) +IPPAPI(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) + +IPPAPI(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +IPPAPI(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +IPPAPI(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +IPPAPI(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pKey, int keyLen, + Ipp8u* pMD, int mdLen, + IppHashAlgId hashAlg)) + +/* +// Big Number Integer Arithmetic +*/ +IPPAPI(IppStatus, ippsBigNumGetSize,(int length, int* pSize)) +IPPAPI(IppStatus, ippsBigNumInit,(int length, IppsBigNumState* pBN)) + +IPPAPI(IppStatus, ippsSet_BN,(IppsBigNumSGN sgn, + int length, const Ipp32u* pData, + IppsBigNumState* pBN)) +IPPAPI(IppStatus, ippsRef_BN,(IppsBigNumSGN* pSgn, int* bitSize, Ipp32u** const ppData, + const IppsBigNumState* pBN)) + +IPPAPI(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsMod_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsModInv_BN,(IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pInv)) +IPPAPI(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsCmpZero_BN,(const IppsBigNumState* pBN, Ipp32u* pResult)) +IPPAPI(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u* pResult)) +IPPAPI(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +IPPAPI(IppStatus, ippsGcd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pGCD)) + +IPPAPI(IppStatus, ippsSetOctString_BN,(const Ipp8u* pStr, int strLen, IppsBigNumState* pBN)) +IPPAPI(IppStatus, ippsGetOctString_BN,(Ipp8u* pStr, int strLen, const IppsBigNumState* pBN)) + +/* +// Montgomery Operations +*/ +IPPAPI(IppStatus, ippsMontGetSize,(IppsExpMethod method, int length, int* pSize)) +IPPAPI(IppStatus, ippsMontInit,(IppsExpMethod method, int length, IppsMontState* pCtx)) +IPPAPI(IppStatus, ippsMontSet,(const Ipp32u* pModulo, int size, IppsMontState* pCtx)) +IPPAPI(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* m, IppsBigNumState* pR)) + +/* +// PRNG +*/ +IPPAPI(IppStatus, ippsPRNGGetSize,(int* pSize)) +IPPAPI(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pCtx)) +IPPAPI(IppStatus, ippsPRNGen, (Ipp32u* pRand, int nBits, void* pCtx)) + +/* +// Prime Number Generation +*/ +IPPAPI(IppStatus, ippsPrimeGetSize,(int nMaxBits, int* pSize)) +IPPAPI(IppStatus, ippsPrimeInit, (int nMaxBits, IppsPrimeState* pCtx)) + + +/* +// RSA +*/ +IPPAPI(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int pubicExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, + IppsRSAPublicKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPublicExp, + IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, + IppsBigNumState* pPublicExp, + const IppsRSAPublicKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPrivateExp, + IppsRSAPrivateKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +IPPAPI(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +IPPAPI(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, + const IppsBigNumState* pFactorQ, + const IppsBigNumState* pCrtExpP, + const IppsBigNumState* pCrtExpQ, + const IppsBigNumState* pInverseQ, + IppsRSAPrivateKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +IPPAPI(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) + +IPPAPI(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, + IppsBigNumState* pCtxt, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pScratchBuffer)) +IPPAPI(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, + IppsBigNumState* pPtxt, + const IppsRSAPrivateKeyState* pKey, + Ipp8u* pScratchBuffer)) + +IPPAPI(IppStatus, ippsRSA_ValidateKeys,(int* pResult, + const IppsRSAPublicKeyState* pPublicKey, + const IppsRSAPrivateKeyState* pPrivateKeyType2, + const IppsRSAPrivateKeyState* pPrivateKeyType1, + Ipp8u* pScratchBuffer, + int nTrials, + IppsPrimeState* pPrimeGen, + IppBitSupplier rndFunc, void* pRndParam)) + +/* encryption scheme: RSAES-OAEP */ +IPPAPI(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +IPPAPI(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pBuffer)) + +/* signature scheme : RSA-SSA-PKCS1-v1_5 */ +IPPAPI(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + Ipp8u* pSign, + const IppsRSAPrivateKeyState* pPrvKey, + const IppsRSAPublicKeyState* pPubKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) + + +IPPAPI(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pSign, int* pIsValid, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) + + +/* +// EC Cryptography +*/ +IPPAPI(IppStatus, ippsECCPGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, ippsECCPInit,(int feBitSize, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSet,(const IppsBigNumState* pPrime, + const IppsBigNumState* pA, const IppsBigNumState* pB, + const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, + int cofactor, + IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSetStd,(IppECCType flag, IppsECCPState* pECC)) + + +IPPAPI(IppStatus, ippsECCPPointGetSize,(int feBitSize, int* pSize)) +IPPAPI(IppStatus, ippsECCPPointInit,(int feBitSize, IppsECCPPointState* pPoint)) + +IPPAPI(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, const IppsBigNumState* pY, + IppsECCPPointState* pPoint, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, IppsBigNumState* pY, + const IppsECCPPointState* pPoint, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP, + IppECResult* pResult, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, + IppECResult* pResult, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPNegativePoint,(const IppsECCPPointState* pP, + IppsECCPPointState* pR, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, const IppsECCPPointState* pQ, + IppsECCPPointState* pR, IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, const IppsBigNumState* pK, + IppsECCPPointState* pR, IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPGenKeyPair,(IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, + IppsECCPState* pECC, + IppBitSupplier rndFunc, void* pRndParam)) +IPPAPI(IppStatus, ippsECCPPublicKey,(const IppsBigNumState* pPrivate, + IppsECCPPointState* pPublic, + IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPSetKeyPair,(const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, + IppBool regular, + IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, + const IppsECCPPointState* pPublicB, + IppsBigNumState* pShare, + IppsECCPState* pECC)) + +IPPAPI(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pPrivate, + IppsBigNumState* pSignX, IppsBigNumState* pSignY, + IppsECCPState* pECC)) +IPPAPI(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, + IppECResult* pResult, + IppsECCPState* pECC)) + +#ifdef __cplusplus +} +#endif + +#if defined (_IPP_STDCALL_CDECL) + #undef _IPP_STDCALL_CDECL + #define __stdcall __cdecl +#endif + +#endif /* __IPPCP_H__ */ diff --git a/external/crypto_px/include/ippcpdefs.h b/external/crypto_px/include/ippcpdefs.h index c86ee0f3ed..612ed50dec 100755 --- a/external/crypto_px/include/ippcpdefs.h +++ b/external/crypto_px/include/ippcpdefs.h @@ -1,211 +1,211 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __IPPCPDEFS_H__ -#define __IPPCPDEFS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -// AES -*/ -#define IPP_AES_BLOCK_BITSIZE (128) /* cipher blocksizes (bits) */ - -typedef enum { /* cipher keysizes (bits) */ - ippRijndaelKey128 = 128, IppsRijndaelKey128 = 128, /* 128-bit key */ - ippRijndaelKey192 = 192, IppsRijndaelKey192 = 192, /* 192-bit key */ - ippRijndaelKey256 = 256, IppsRijndaelKey256 = 256 /* 256-bit key */ -} IppsRijndaelKeyLength; - -typedef struct _cpRijndael128 IppsAESSpec; -typedef struct _cpAES_GCM IppsAES_GCMState; -typedef struct _cpAES_CMAC IppsAES_CMACState; - - -/* -// hash -*/ -typedef enum { - ippHashAlg_Unknown, - ippHashAlg_SHA1, - ippHashAlg_SHA256, - ippHashAlg_SHA224, - ippHashAlg_SHA512, - ippHashAlg_SHA384, - ippHashAlg_MD5, - ippHashAlg_SHA512_224, - ippHashAlg_SHA512_256, - ippHashAlg_MaxNo -} IppHashAlgId; - -#define IPP_ALG_HASH_UNKNOWN (ippHashAlg_Unknown) /* unknown */ -#define IPP_ALG_HASH_SHA1 (ippHashAlg_SHA1) /* SHA1 */ -#define IPP_ALG_HASH_SHA256 (ippHashAlg_SHA256) /* SHA256 */ -#define IPP_ALG_HASH_SHA224 (ippHashAlg_SHA224) /* SHA224 or SHA256/224 */ -#define IPP_ALG_HASH_SHA512 (ippHashAlg_SHA512) /* SHA512 */ -#define IPP_ALG_HASH_SHA384 (ippHashAlg_SHA384) /* SHA384 or SHA512/384 */ -#define IPP_ALG_HASH_MD5 (ippHashAlg_MD5) /* MD5 */ -#define IPP_ALG_HASH_SHA512_224 (ippHashAlg_SHA512_224) /* SHA512/224 */ -#define IPP_ALG_HASH_SHA512_256 (ippHashAlg_SHA512_256) /* SHA512/256 */ -#define IPP_ALG_HASH_LIMIT (ippHashAlg_MaxNo) /* hash alg limiter*/ - -#define IPP_SHA1_DIGEST_BITSIZE 160 /* digest size (bits) */ -#define IPP_SHA256_DIGEST_BITSIZE 256 -#define IPP_SHA224_DIGEST_BITSIZE 224 -#define IPP_SHA384_DIGEST_BITSIZE 384 -#define IPP_SHA512_DIGEST_BITSIZE 512 -#define IPP_MD5_DIGEST_BITSIZE 128 -#define IPP_SHA512_224_DIGEST_BITSIZE 224 -#define IPP_SHA512_256_DIGEST_BITSIZE 256 - -typedef struct _cpHashCtx IppsHashState; -typedef struct _cpHMAC IppsHMACState; - - -/* -// Big Number Integer Arithmetic -*/ -#define BN_MAXBITSIZE (16*1024) /* bn max size (bits) */ - -/* operation results */ -#define IPP_IS_EQ (0) -#define IPP_IS_GT (1) -#define IPP_IS_LT (2) -#define IPP_IS_NE (3) -#define IPP_IS_NA (4) - -#define IPP_IS_PRIME (5) -#define IPP_IS_COMPOSITE (6) - -#define IPP_IS_VALID (7) -#define IPP_IS_INVALID (8) -#define IPP_IS_INCOMPLETE (9) -#define IPP_IS_ATINFINITY (10) - -#define IS_ZERO IPP_IS_EQ -#define GREATER_THAN_ZERO IPP_IS_GT -#define LESS_THAN_ZERO IPP_IS_LT -#define IS_PRIME IPP_IS_PRIME -#define IS_COMPOSITE IPP_IS_COMPOSITE -#define IS_VALID_KEY IPP_IS_VALID -#define IS_INVALID_KEY IPP_IS_INVALID -#define IS_INCOMPLETED_KEY IPP_IS_INCOMPLETE - -typedef enum { - ippBigNumNEG = 0, IppsBigNumNEG = 0, - ippBigNumPOS = 1, IppsBigNumPOS = 1 -} IppsBigNumSGN; - -typedef enum { - ippBinaryMethod = 0, IppsBinaryMethod = 0, - ippSlidingWindows = 1, IppsSlidingWindows = 1 -} IppsExpMethod; - -typedef struct _cpBigNum IppsBigNumState; -typedef struct _cpMontgomery IppsMontState; -typedef struct _cpPRNG IppsPRNGState; -typedef struct _cpPrime IppsPrimeState; - -/* External Bit Supplier */ -typedef IppStatus (__STDCALL *IppBitSupplier)(Ipp32u* pRand, int nBits, void* pEbsParams); - - -/* -// RSA -*/ -#define MIN_RSA_SIZE (8) -#define MAX_RSA_SIZE (4096) - -typedef struct _cpRSA IppsRSAState; -typedef struct _cpRSA_public_key IppsRSAPublicKeyState; -typedef struct _cpRSA_private_key IppsRSAPrivateKeyState; - - -/* -// EC Cryptography -*/ -#define EC_GFP_MAXBITSIZE (1024) - -typedef struct _cpECCP IppsECCPState; -typedef struct _cpECCPPoint IppsECCPPointState; - -/* operation result */ -typedef enum { - ippECValid, /* validation pass successfully */ - - ippECCompositeBase, /* field based on composite */ - ippECComplicatedBase, /* number of non-zero terms in the polynomial (> PRIME_ARR_MAX) */ - ippECIsZeroDiscriminant,/* zero discriminant */ - ippECCompositeOrder, /* composite order of base point */ - ippECInvalidOrder, /* invalid base point order */ - ippECIsWeakMOV, /* weak Meneze-Okamoto-Vanstone reduction attack */ - ippECIsWeakSSSA, /* weak Semaev-Smart,Satoh-Araki reduction attack */ - ippECIsSupersingular, /* supersingular curve */ - - ippECInvalidPrivateKey, /* !(0 < Private < order) */ - ippECInvalidPublicKey, /* (order*PublicKey != Infinity) */ - ippECInvalidKeyPair, /* (Private*BasePoint != PublicKey) */ - - ippECPointOutOfGroup, /* out of group (order*P != Infinity) */ - ippECPointIsAtInfinite, /* point (P=(Px,Py)) at Infinity */ - ippECPointIsNotValid, /* point (P=(Px,Py)) out-of EC */ - - ippECPointIsEqual, /* compared points are equal */ - ippECPointIsNotEqual, /* compared points are different */ - - ippECInvalidSignature /* invalid signature */ -} IppECResult; - -typedef enum { - ippECarbitrary =0x00000, IppECCArbitrary = 0x00000, /* arbitrary ECC */ - - ippECPstd = 0x10000, IppECCPStd = 0x10000, /* random (recommended) EC over FG(p): */ - ippECPstd112r1 = ippECPstd, IppECCPStd112r1 = IppECCPStd, /* secp112r1 curve */ - ippECPstd112r2 = ippECPstd+1, IppECCPStd112r2 = IppECCPStd+1, /* secp112r2 curve */ - ippECPstd128r1 = ippECPstd+2, IppECCPStd128r1 = IppECCPStd+2, /* secp128r1 curve */ - ippECPstd128r2 = ippECPstd+3, IppECCPStd128r2 = IppECCPStd+3, /* secp128r2 curve */ - ippECPstd160r1 = ippECPstd+4, IppECCPStd160r1 = IppECCPStd+4, /* secp160r1 curve */ - ippECPstd160r2 = ippECPstd+5, IppECCPStd160r2 = IppECCPStd+5, /* secp160r2 curve */ - ippECPstd192r1 = ippECPstd+6, IppECCPStd192r1 = IppECCPStd+6, /* secp192r1 curve */ - ippECPstd224r1 = ippECPstd+7, IppECCPStd224r1 = IppECCPStd+7, /* secp224r1 curve */ - ippECPstd256r1 = ippECPstd+8, IppECCPStd256r1 = IppECCPStd+8, /* secp256r1 curve */ - ippECPstd384r1 = ippECPstd+9, IppECCPStd384r1 = IppECCPStd+9, /* secp384r1 curve */ - ippECPstd521r1 = ippECPstd+10, IppECCPStd521r1 = IppECCPStd+10, /* secp521r1 curve */ -} IppsECType, IppECCType; - - -#ifdef __cplusplus -} -#endif - -#endif /* __IPPCPDEFS_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPCPDEFS_H__ +#define __IPPCPDEFS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +// AES +*/ +#define IPP_AES_BLOCK_BITSIZE (128) /* cipher blocksizes (bits) */ + +typedef enum { /* cipher keysizes (bits) */ + ippRijndaelKey128 = 128, IppsRijndaelKey128 = 128, /* 128-bit key */ + ippRijndaelKey192 = 192, IppsRijndaelKey192 = 192, /* 192-bit key */ + ippRijndaelKey256 = 256, IppsRijndaelKey256 = 256 /* 256-bit key */ +} IppsRijndaelKeyLength; + +typedef struct _cpRijndael128 IppsAESSpec; +typedef struct _cpAES_GCM IppsAES_GCMState; +typedef struct _cpAES_CMAC IppsAES_CMACState; + + +/* +// hash +*/ +typedef enum { + ippHashAlg_Unknown, + ippHashAlg_SHA1, + ippHashAlg_SHA256, + ippHashAlg_SHA224, + ippHashAlg_SHA512, + ippHashAlg_SHA384, + ippHashAlg_MD5, + ippHashAlg_SHA512_224, + ippHashAlg_SHA512_256, + ippHashAlg_MaxNo +} IppHashAlgId; + +#define IPP_ALG_HASH_UNKNOWN (ippHashAlg_Unknown) /* unknown */ +#define IPP_ALG_HASH_SHA1 (ippHashAlg_SHA1) /* SHA1 */ +#define IPP_ALG_HASH_SHA256 (ippHashAlg_SHA256) /* SHA256 */ +#define IPP_ALG_HASH_SHA224 (ippHashAlg_SHA224) /* SHA224 or SHA256/224 */ +#define IPP_ALG_HASH_SHA512 (ippHashAlg_SHA512) /* SHA512 */ +#define IPP_ALG_HASH_SHA384 (ippHashAlg_SHA384) /* SHA384 or SHA512/384 */ +#define IPP_ALG_HASH_MD5 (ippHashAlg_MD5) /* MD5 */ +#define IPP_ALG_HASH_SHA512_224 (ippHashAlg_SHA512_224) /* SHA512/224 */ +#define IPP_ALG_HASH_SHA512_256 (ippHashAlg_SHA512_256) /* SHA512/256 */ +#define IPP_ALG_HASH_LIMIT (ippHashAlg_MaxNo) /* hash alg limiter*/ + +#define IPP_SHA1_DIGEST_BITSIZE 160 /* digest size (bits) */ +#define IPP_SHA256_DIGEST_BITSIZE 256 +#define IPP_SHA224_DIGEST_BITSIZE 224 +#define IPP_SHA384_DIGEST_BITSIZE 384 +#define IPP_SHA512_DIGEST_BITSIZE 512 +#define IPP_MD5_DIGEST_BITSIZE 128 +#define IPP_SHA512_224_DIGEST_BITSIZE 224 +#define IPP_SHA512_256_DIGEST_BITSIZE 256 + +typedef struct _cpHashCtx IppsHashState; +typedef struct _cpHMAC IppsHMACState; + + +/* +// Big Number Integer Arithmetic +*/ +#define BN_MAXBITSIZE (16*1024) /* bn max size (bits) */ + +/* operation results */ +#define IPP_IS_EQ (0) +#define IPP_IS_GT (1) +#define IPP_IS_LT (2) +#define IPP_IS_NE (3) +#define IPP_IS_NA (4) + +#define IPP_IS_PRIME (5) +#define IPP_IS_COMPOSITE (6) + +#define IPP_IS_VALID (7) +#define IPP_IS_INVALID (8) +#define IPP_IS_INCOMPLETE (9) +#define IPP_IS_ATINFINITY (10) + +#define IS_ZERO IPP_IS_EQ +#define GREATER_THAN_ZERO IPP_IS_GT +#define LESS_THAN_ZERO IPP_IS_LT +#define IS_PRIME IPP_IS_PRIME +#define IS_COMPOSITE IPP_IS_COMPOSITE +#define IS_VALID_KEY IPP_IS_VALID +#define IS_INVALID_KEY IPP_IS_INVALID +#define IS_INCOMPLETED_KEY IPP_IS_INCOMPLETE + +typedef enum { + ippBigNumNEG = 0, IppsBigNumNEG = 0, + ippBigNumPOS = 1, IppsBigNumPOS = 1 +} IppsBigNumSGN; + +typedef enum { + ippBinaryMethod = 0, IppsBinaryMethod = 0, + ippSlidingWindows = 1, IppsSlidingWindows = 1 +} IppsExpMethod; + +typedef struct _cpBigNum IppsBigNumState; +typedef struct _cpMontgomery IppsMontState; +typedef struct _cpPRNG IppsPRNGState; +typedef struct _cpPrime IppsPrimeState; + +/* External Bit Supplier */ +typedef IppStatus (__STDCALL *IppBitSupplier)(Ipp32u* pRand, int nBits, void* pEbsParams); + + +/* +// RSA +*/ +#define MIN_RSA_SIZE (8) +#define MAX_RSA_SIZE (4096) + +typedef struct _cpRSA IppsRSAState; +typedef struct _cpRSA_public_key IppsRSAPublicKeyState; +typedef struct _cpRSA_private_key IppsRSAPrivateKeyState; + + +/* +// EC Cryptography +*/ +#define EC_GFP_MAXBITSIZE (1024) + +typedef struct _cpECCP IppsECCPState; +typedef struct _cpECCPPoint IppsECCPPointState; + +/* operation result */ +typedef enum { + ippECValid, /* validation pass successfully */ + + ippECCompositeBase, /* field based on composite */ + ippECComplicatedBase, /* number of non-zero terms in the polynomial (> PRIME_ARR_MAX) */ + ippECIsZeroDiscriminant,/* zero discriminant */ + ippECCompositeOrder, /* composite order of base point */ + ippECInvalidOrder, /* invalid base point order */ + ippECIsWeakMOV, /* weak Meneze-Okamoto-Vanstone reduction attack */ + ippECIsWeakSSSA, /* weak Semaev-Smart,Satoh-Araki reduction attack */ + ippECIsSupersingular, /* supersingular curve */ + + ippECInvalidPrivateKey, /* !(0 < Private < order) */ + ippECInvalidPublicKey, /* (order*PublicKey != Infinity) */ + ippECInvalidKeyPair, /* (Private*BasePoint != PublicKey) */ + + ippECPointOutOfGroup, /* out of group (order*P != Infinity) */ + ippECPointIsAtInfinite, /* point (P=(Px,Py)) at Infinity */ + ippECPointIsNotValid, /* point (P=(Px,Py)) out-of EC */ + + ippECPointIsEqual, /* compared points are equal */ + ippECPointIsNotEqual, /* compared points are different */ + + ippECInvalidSignature /* invalid signature */ +} IppECResult; + +typedef enum { + ippECarbitrary =0x00000, IppECCArbitrary = 0x00000, /* arbitrary ECC */ + + ippECPstd = 0x10000, IppECCPStd = 0x10000, /* random (recommended) EC over FG(p): */ + ippECPstd112r1 = ippECPstd, IppECCPStd112r1 = IppECCPStd, /* secp112r1 curve */ + ippECPstd112r2 = ippECPstd+1, IppECCPStd112r2 = IppECCPStd+1, /* secp112r2 curve */ + ippECPstd128r1 = ippECPstd+2, IppECCPStd128r1 = IppECCPStd+2, /* secp128r1 curve */ + ippECPstd128r2 = ippECPstd+3, IppECCPStd128r2 = IppECCPStd+3, /* secp128r2 curve */ + ippECPstd160r1 = ippECPstd+4, IppECCPStd160r1 = IppECCPStd+4, /* secp160r1 curve */ + ippECPstd160r2 = ippECPstd+5, IppECCPStd160r2 = IppECCPStd+5, /* secp160r2 curve */ + ippECPstd192r1 = ippECPstd+6, IppECCPStd192r1 = IppECCPStd+6, /* secp192r1 curve */ + ippECPstd224r1 = ippECPstd+7, IppECCPStd224r1 = IppECCPStd+7, /* secp224r1 curve */ + ippECPstd256r1 = ippECPstd+8, IppECCPStd256r1 = IppECCPStd+8, /* secp256r1 curve */ + ippECPstd384r1 = ippECPstd+9, IppECCPStd384r1 = IppECCPStd+9, /* secp384r1 curve */ + ippECPstd521r1 = ippECPstd+10, IppECCPStd521r1 = IppECCPStd+10, /* secp521r1 curve */ +} IppsECType, IppECCType; + + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPCPDEFS_H__ */ diff --git a/external/crypto_px/include/ippdefs.h b/external/crypto_px/include/ippdefs.h index 4250bf24d4..1e78d0c76f 100755 --- a/external/crypto_px/include/ippdefs.h +++ b/external/crypto_px/include/ippdefs.h @@ -1,129 +1,129 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __IPPDEFS_H__ -#define __IPPDEFS_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -#if defined (_WIN64) -#define _INTEL_PLATFORM "intel64/" -#elif defined (_WIN32) -#define _INTEL_PLATFORM "ia32/" -#endif - -#if !defined( IPPAPI ) - - #if defined( IPP_W32DLL ) && (defined( _WIN32 ) || defined( _WIN64 )) - #if defined( _MSC_VER ) || defined( __ICL ) - #define IPPAPI( type,name,arg ) \ - __declspec(dllimport) type __STDCALL name arg; - #else - #define IPPAPI( type,name,arg ) type __STDCALL name arg; - #endif - #else - #define IPPAPI( type,name,arg ) type __STDCALL name arg; - #endif - -#endif - -#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) && !defined( _PCS ) && !defined( _PCS_GENSTUBS ) - #if( __INTEL_COMPILER >= 1100 ) /* icl 11.0 supports additional comment */ - #if( _MSC_VER >= 1400 ) - #define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment )) - #else - #pragma message ("your icl version supports additional comment for deprecated functions but it can't be displayed") - #pragma message ("because internal _MSC_VER macro variable setting requires compatibility with MSVC7.1") - #pragma message ("use -Qvc8 switch for icl command line to see these additional comments") - #define IPP_DEPRECATED( comment ) __declspec( deprecated ) - #endif - #elif( _MSC_FULL_VER >= 140050727 )&&( !defined( __INTEL_COMPILER )) /* VS2005 supports additional comment */ - #define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment )) - #elif( _MSC_VER <= 1200 )&&( !defined( __INTEL_COMPILER )) /* VS 6 doesn't support deprecation */ - #define IPP_DEPRECATED( comment ) - #else - #define IPP_DEPRECATED( comment ) __declspec( deprecated ) - #endif -#elif (defined(__ICC) || defined(__ECC) || defined( __GNUC__ )) && !defined( _PCS ) && !defined( _PCS_GENSTUBS ) - #if defined( __GNUC__ ) - #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5 - #define IPP_DEPRECATED( message ) __attribute__(( deprecated( message ))) - #else - #define IPP_DEPRECATED( message ) __attribute__(( deprecated )) - #endif - #else - #define IPP_DEPRECATED( comment ) __attribute__(( deprecated )) - #endif -#else - #define IPP_DEPRECATED( comment ) -#endif - -#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) - #if !defined( _IPP_NO_DEFAULT_LIB ) - #if (( defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ - (!defined( _IPP_PARALLEL_DYNAMIC ) && defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ - (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ - (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && defined( _IPP_SEQUENTIAL_STATIC ))) - #elif (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) - #define _IPP_NO_DEFAULT_LIB - #else - #error Illegal combination of _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC, only one definition can be defined - #endif - #endif -#else - #define _IPP_NO_DEFAULT_LIB - #if (defined( _IPP_PARALLEL_DYNAMIC ) || defined( _IPP_PARALLEL_STATIC ) || defined(_IPP_SEQUENTIAL_DYNAMIC) || defined(_IPP_SEQUENTIAL_STATIC)) - #pragma message ("defines _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC do not have any effect in current configuration") - #endif -#endif - -#if !defined( _IPP_NO_DEFAULT_LIB ) - #if defined( _IPP_PARALLEL_STATIC ) - #pragma comment( lib, "libircmt" ) - #pragma comment( lib, "libmmt" ) - #pragma comment( lib, "svml_dispmt" ) - #pragma comment( lib, "libiomp5md" ) - #endif -#endif - -#include "ippbase.h" -#include "ipptypes.h" - -extern const IppiRect ippRectInfinite; - -#ifdef __cplusplus -} -#endif - -#endif /* __IPPDEFS_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPDEFS_H__ +#define __IPPDEFS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined (_WIN64) +#define _INTEL_PLATFORM "intel64/" +#elif defined (_WIN32) +#define _INTEL_PLATFORM "ia32/" +#endif + +#if !defined( IPPAPI ) + + #if defined( IPP_W32DLL ) && (defined( _WIN32 ) || defined( _WIN64 )) + #if defined( _MSC_VER ) || defined( __ICL ) + #define IPPAPI( type,name,arg ) \ + __declspec(dllimport) type __STDCALL name arg; + #else + #define IPPAPI( type,name,arg ) type __STDCALL name arg; + #endif + #else + #define IPPAPI( type,name,arg ) type __STDCALL name arg; + #endif + +#endif + +#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) && !defined( _PCS ) && !defined( _PCS_GENSTUBS ) + #if( __INTEL_COMPILER >= 1100 ) /* icl 11.0 supports additional comment */ + #if( _MSC_VER >= 1400 ) + #define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment )) + #else + #pragma message ("your icl version supports additional comment for deprecated functions but it can't be displayed") + #pragma message ("because internal _MSC_VER macro variable setting requires compatibility with MSVC7.1") + #pragma message ("use -Qvc8 switch for icl command line to see these additional comments") + #define IPP_DEPRECATED( comment ) __declspec( deprecated ) + #endif + #elif( _MSC_FULL_VER >= 140050727 )&&( !defined( __INTEL_COMPILER )) /* VS2005 supports additional comment */ + #define IPP_DEPRECATED( comment ) __declspec( deprecated ( comment )) + #elif( _MSC_VER <= 1200 )&&( !defined( __INTEL_COMPILER )) /* VS 6 doesn't support deprecation */ + #define IPP_DEPRECATED( comment ) + #else + #define IPP_DEPRECATED( comment ) __declspec( deprecated ) + #endif +#elif (defined(__ICC) || defined(__ECC) || defined( __GNUC__ )) && !defined( _PCS ) && !defined( _PCS_GENSTUBS ) + #if defined( __GNUC__ ) + #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5 + #define IPP_DEPRECATED( message ) __attribute__(( deprecated( message ))) + #else + #define IPP_DEPRECATED( message ) __attribute__(( deprecated )) + #endif + #else + #define IPP_DEPRECATED( comment ) __attribute__(( deprecated )) + #endif +#else + #define IPP_DEPRECATED( comment ) +#endif + +#if (defined( __ICL ) || defined( __ECL ) || defined(_MSC_VER)) + #if !defined( _IPP_NO_DEFAULT_LIB ) + #if (( defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ + (!defined( _IPP_PARALLEL_DYNAMIC ) && defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ + (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) || \ + (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && defined( _IPP_SEQUENTIAL_STATIC ))) + #elif (!defined( _IPP_PARALLEL_DYNAMIC ) && !defined( _IPP_PARALLEL_STATIC ) && !defined( _IPP_SEQUENTIAL_DYNAMIC ) && !defined( _IPP_SEQUENTIAL_STATIC )) + #define _IPP_NO_DEFAULT_LIB + #else + #error Illegal combination of _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC, only one definition can be defined + #endif + #endif +#else + #define _IPP_NO_DEFAULT_LIB + #if (defined( _IPP_PARALLEL_DYNAMIC ) || defined( _IPP_PARALLEL_STATIC ) || defined(_IPP_SEQUENTIAL_DYNAMIC) || defined(_IPP_SEQUENTIAL_STATIC)) + #pragma message ("defines _IPP_PARALLEL_DYNAMIC/_IPP_PARALLEL_STATIC/_IPP_SEQUENTIAL_DYNAMIC/_IPP_SEQUENTIAL_STATIC do not have any effect in current configuration") + #endif +#endif + +#if !defined( _IPP_NO_DEFAULT_LIB ) + #if defined( _IPP_PARALLEL_STATIC ) + #pragma comment( lib, "libircmt" ) + #pragma comment( lib, "libmmt" ) + #pragma comment( lib, "svml_dispmt" ) + #pragma comment( lib, "libiomp5md" ) + #endif +#endif + +#include "ippbase.h" +#include "ipptypes.h" + +extern const IppiRect ippRectInfinite; + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPDEFS_H__ */ diff --git a/external/crypto_px/include/ipptypes.h b/external/crypto_px/include/ipptypes.h index 684a8e9dbe..dedb27991c 100755 --- a/external/crypto_px/include/ipptypes.h +++ b/external/crypto_px/include/ipptypes.h @@ -1,1104 +1,1104 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __IPPTYPES_H__ -#define __IPPTYPES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/*****************************************************************************/ -/* Below are ippCore domain specific definitions */ -/*****************************************************************************/ -#if !defined( _OWN_BLDPCS ) - -#define ippCPUID_MMX 0x00000001 /* Intel Architecture MMX technology supported */ -#define ippCPUID_SSE 0x00000002 /* Streaming SIMD Extensions */ -#define ippCPUID_SSE2 0x00000004 /* Streaming SIMD Extensions 2 */ -#define ippCPUID_SSE3 0x00000008 /* Streaming SIMD Extensions 3 */ -#define ippCPUID_SSSE3 0x00000010 /* Supplemental Streaming SIMD Extensions 3 */ -#define ippCPUID_MOVBE 0x00000020 /* The processor supports MOVBE instruction */ -#define ippCPUID_SSE41 0x00000040 /* Streaming SIMD Extensions 4.1 */ -#define ippCPUID_SSE42 0x00000080 /* Streaming SIMD Extensions 4.2 */ -#define ippCPUID_AVX 0x00000100 /* Advanced Vector Extensions instruction set */ -#define ippAVX_ENABLEDBYOS 0x00000200 /* The operating system supports AVX */ -#define ippCPUID_AES 0x00000400 /* AES instruction */ -#define ippCPUID_CLMUL 0x00000800 /* PCLMULQDQ instruction */ -#define ippCPUID_ABR 0x00001000 /* Reserved */ -#define ippCPUID_RDRAND 0x00002000 /* Read Random Number instructions */ -#define ippCPUID_F16C 0x00004000 /* Float16 instructions */ -#define ippCPUID_AVX2 0x00008000 /* Advanced Vector Extensions 2 instruction set */ -#define ippCPUID_ADCOX 0x00010000 /* ADCX and ADOX instructions */ -#define ippCPUID_RDSEED 0x00020000 /* The RDSEED instruction */ -#define ippCPUID_PREFETCHW 0x00040000 /* The PREFETCHW instruction */ -#define ippCPUID_SHA 0x00080000 /* Intel (R) SHA Extensions */ -#define ippCPUID_AVX512F 0x00100000 /* AVX-512 Foundation instructions */ -#define ippCPUID_AVX512CD 0x00200000 /* AVX-512 Conflict Detection instructions */ -#define ippCPUID_AVX512ER 0x00400000 /* AVX-512 Exponential & Reciprocal instructions*/ -#define ippCPUID_AVX512PF 0x00800000 /* AVX-512 Prefetch instructions */ -#define ippCPUID_AVX512BW 0x01000000 /* AVX-512 Byte & Word instructions */ -#define ippCPUID_AVX512DQ 0x02000000 /* AVX-512 DWord & QWord instructions */ -#define ippCPUID_AVX512VL 0x04000000 /* AVX-512 Vector Length extensions */ -#define ippCPUID_KNC 0x80000000 /* Intel(R) Xeon Phi(TM) Coprocessor */ -#if defined( _WIN32 ) || defined ( _WIN64 ) - #define ippCPUID_NOCHECK 0x8000000000000000L /* Force ippSetCpuFeatures to set CPU features without check */ -#else - #define ippCPUID_NOCHECK 0x8000000000000000LL -#endif - -#if defined( _WIN32 ) || defined ( _WIN64 ) - #define ippCPUID_GETINFO_A 0x616f666e69746567L /* Force ipp_GetCpuFeatures to work as cpuid instruction */ -#else - #define ippCPUID_GETINFO_A 0x616f666e69746567LL -#endif - -#define IPP_COUNT_OF( obj ) (sizeof(obj)/sizeof(obj[0])) - -/*****************************************************************************/ -/* Below are ippSP domain specific definitions */ -/*****************************************************************************/ -typedef enum { - ippRndZero, - ippRndNear, - ippRndFinancial, - ippRndHintAccurate=0x10 -} IppRoundMode; - - -typedef enum { - ippAlgHintNone, - ippAlgHintFast, - ippAlgHintAccurate -} IppHintAlgorithm; - -typedef enum { - ippCmpLess, - ippCmpLessEq, - ippCmpEq, - ippCmpGreaterEq, - ippCmpGreater -} IppCmpOp; - -typedef enum { - ippAlgAuto = 0x00000000, - ippAlgDirect = 0x00000001, - ippAlgFFT = 0x00000002, - ippAlgMask = 0x000000FF -} IppAlgType; - -typedef enum { - ippsNormNone = 0x00000000, /* default */ - ippsNormA = 0x00000100, /* biased normalization */ - ippsNormB = 0x00000200, /* unbiased normalization */ - ippsNormMask = 0x0000FF00 -} IppsNormOp; - -typedef enum { - ippNormInf = 0x00000001, - ippNormL1 = 0x00000002, - ippNormL2 = 0x00000004 -} IppNormType; - -enum { - IPP_FFT_DIV_FWD_BY_N = 1, - IPP_FFT_DIV_INV_BY_N = 2, - IPP_FFT_DIV_BY_SQRTN = 4, - IPP_FFT_NODIV_BY_ANY = 8 -}; - -enum { - IPP_DIV_FWD_BY_N = 1, - IPP_DIV_INV_BY_N = 2, - IPP_DIV_BY_SQRTN = 4, - IPP_NODIV_BY_ANY = 8 -}; - -typedef struct { - Ipp32f rho; - Ipp32f theta; -} IppPointPolar; - -typedef enum {ippWinBartlett,ippWinBlackman,ippWinHamming,ippWinHann,ippWinRect} IppWinType; - -typedef enum { ippButterworth, ippChebyshev1 } IppsIIRFilterType; - -typedef enum { ippZCR=0, ippZCXor, ippZCC } IppsZCType; - -#if !defined( _OWN_BLDPCS ) - -typedef struct { - int left; - int right; -} IppsROI; - -typedef struct RandUniState_8u IppsRandUniState_8u; -typedef struct RandUniState_16s IppsRandUniState_16s; -typedef struct RandUniState_32f IppsRandUniState_32f; -typedef struct RandUniState_64f IppsRandUniState_64f; - -typedef struct RandGaussState_8u IppsRandGaussState_8u; -typedef struct RandGaussState_16s IppsRandGaussState_16s; -typedef struct RandGaussState_32f IppsRandGaussState_32f; -typedef struct RandGaussState_64f IppsRandGaussState_64f; - -typedef struct FFTSpec_C_32fc IppsFFTSpec_C_32fc; -typedef struct FFTSpec_C_32f IppsFFTSpec_C_32f; -typedef struct FFTSpec_R_32f IppsFFTSpec_R_32f; - -typedef struct FFTSpec_C_64fc IppsFFTSpec_C_64fc; -typedef struct FFTSpec_C_64f IppsFFTSpec_C_64f; -typedef struct FFTSpec_R_64f IppsFFTSpec_R_64f; - -typedef struct DFTSpec_C_32fc IppsDFTSpec_C_32fc; -typedef struct DFTSpec_C_32f IppsDFTSpec_C_32f; -typedef struct DFTSpec_R_32f IppsDFTSpec_R_32f; - -typedef struct DFTSpec_C_64fc IppsDFTSpec_C_64fc; -typedef struct DFTSpec_C_64f IppsDFTSpec_C_64f; -typedef struct DFTSpec_R_64f IppsDFTSpec_R_64f; - -typedef struct DCTFwdSpec_32f IppsDCTFwdSpec_32f; -typedef struct DCTInvSpec_32f IppsDCTInvSpec_32f; - -typedef struct DCTFwdSpec_64f IppsDCTFwdSpec_64f; -typedef struct DCTInvSpec_64f IppsDCTInvSpec_64f; - -typedef struct sWTFwdState_32f IppsWTFwdState_32f; -typedef struct sWTFwdState_8u32f IppsWTFwdState_8u32f; -typedef struct sWTFwdState_16s32f IppsWTFwdState_16s32f; -typedef struct sWTFwdState_16u32f IppsWTFwdState_16u32f; -typedef struct sWTInvState_32f IppsWTInvState_32f; -typedef struct sWTInvState_32f8u IppsWTInvState_32f8u; -typedef struct sWTInvState_32f16s IppsWTInvState_32f16s; -typedef struct sWTInvState_32f16u IppsWTInvState_32f16u; - -typedef struct IIRState_32f IppsIIRState_32f; -typedef struct IIRState_32fc IppsIIRState_32fc; -typedef struct IIRState32f_16s IppsIIRState32f_16s; -typedef struct IIRState32fc_16sc IppsIIRState32fc_16sc; -typedef struct IIRState_64f IppsIIRState_64f; -typedef struct IIRState_64fc IppsIIRState_64fc; -typedef struct IIRState64f_32f IppsIIRState64f_32f; -typedef struct IIRState64fc_32fc IppsIIRState64fc_32fc; -typedef struct IIRState64f_32s IppsIIRState64f_32s; -typedef struct IIRState64fc_32sc IppsIIRState64fc_32sc; -typedef struct IIRState64f_16s IppsIIRState64f_16s; -typedef struct IIRState64fc_16sc IppsIIRState64fc_16sc; - -typedef struct FIRSpec_32f IppsFIRSpec_32f; -typedef struct FIRSpec_64f IppsFIRSpec_64f; -typedef struct FIRSpec_32fc IppsFIRSpec_32fc; -typedef struct FIRSpec_64fc IppsFIRSpec_64fc; - -typedef struct FIRLMSState_32f IppsFIRLMSState_32f; -typedef struct FIRLMSState32f_16s IppsFIRLMSState32f_16s; - -typedef struct HilbertSpec IppsHilbertSpec; - -typedef struct FIRSparseState_32f IppsFIRSparseState_32f; -typedef struct IIRSparseState_32f IppsIIRSparseState_32f; - -typedef struct ResamplingPolyphase_16s IppsResamplingPolyphase_16s; -typedef struct ResamplingPolyphaseFixed_16s IppsResamplingPolyphaseFixed_16s; -typedef struct ResamplingPolyphase_32f IppsResamplingPolyphase_32f; -typedef struct ResamplingPolyphaseFixed_32f IppsResamplingPolyphaseFixed_32f; - -#endif /* _OWN_BLDPCS */ - -/*****************************************************************************/ -/* Below are ippIP domain specific definitions */ -/*****************************************************************************/ -#define IPP_TEMPORAL_COPY 0x0 -#define IPP_NONTEMPORAL_STORE 0x01 -#define IPP_NONTEMPORAL_LOAD 0x02 - -typedef int IppEnum; - -#define IPP_DEG_TO_RAD( deg ) ( (deg)/180.0 * IPP_PI ) - -typedef enum { - ippiNormNone = 0x00000000, /* default */ - ippiNorm = 0x00000100, /* normalized form */ - ippiNormCoefficient = 0x00000200, /* correlation coefficient in the range [-1.0 ... 1.0] */ - ippiNormMask = 0x0000FF00 -} IppiNormOp; - -typedef enum { - ippiROIFull = 0x00000000, - ippiROIValid = 0x00010000, - ippiROISame = 0x00020000, - ippiROIMask = 0x00FF0000 -} IppiROIShape; - -typedef enum { - ippC0 = 0, - ippC1 = 1, - ippC2 = 2, - ippC3 = 3, - ippC4 = 4, - ippP2 = 5, - ippP3 = 6, - ippP4 = 7, - ippAC1 = 8, - ippAC4 = 9, - ippA0C4 = 10, - ippAP4 = 11 -} IppChannels; - -typedef enum _IppiBorderType { - ippBorderConst = 0, - ippBorderRepl = 1, - ippBorderWrap = 2, - ippBorderMirror = 3, /* left border: 012... -> 21012... */ - ippBorderMirrorR = 4, /* left border: 012... -> 210012... */ - ippBorderInMem = 6, - ippBorderTransp = 7, - ippBorderInMemTop = 0x0010, - ippBorderInMemBottom = 0x0020, - ippBorderInMemLeft = 0x0040, - ippBorderInMemRight = 0x0080 -} IppiBorderType; - -typedef enum { - ippAxsHorizontal, - ippAxsVertical, - ippAxsBoth, - ippAxs45, - ippAxs135 -} IppiAxis; - -typedef struct { - int x; - int y; - int width; - int height; -} IppiRect; - -typedef struct { - int x; - int y; -} IppiPoint; - -typedef struct { - int width; - int height; -} IppiSize; - -typedef struct { - Ipp32f x; - Ipp32f y; -} IppiPoint_32f; - -typedef enum _IppiMaskSize { - ippMskSize1x3 = 13, - ippMskSize1x5 = 15, - ippMskSize3x1 = 31, - ippMskSize3x3 = 33, - ippMskSize5x1 = 51, - ippMskSize5x5 = 55 -} IppiMaskSize; - -enum { - IPPI_INTER_NN = 1, - IPPI_INTER_LINEAR = 2, - IPPI_INTER_CUBIC = 4, - IPPI_INTER_CUBIC2P_BSPLINE, /* two-parameter cubic filter (B=1, C=0) */ - IPPI_INTER_CUBIC2P_CATMULLROM, /* two-parameter cubic filter (B=0, C=1/2) */ - IPPI_INTER_CUBIC2P_B05C03, /* two-parameter cubic filter (B=1/2, C=3/10) */ - IPPI_INTER_SUPER = 8, - IPPI_INTER_LANCZOS = 16, - IPPI_ANTIALIASING = (1 << 29), - IPPI_SUBPIXEL_EDGE = (1 << 30), - IPPI_SMOOTH_EDGE = (1 << 31) -}; - -typedef enum { - ippNearest = IPPI_INTER_NN, - ippLinear = IPPI_INTER_LINEAR, - ippCubic = IPPI_INTER_CUBIC2P_CATMULLROM, - ippLanczos = IPPI_INTER_LANCZOS, - ippHahn = 0, - ippSuper = IPPI_INTER_SUPER -} IppiInterpolationType; - -typedef enum { - ippPolyphase_1_2, - ippPolyphase_3_5, - ippPolyphase_2_3, - ippPolyphase_7_10, - ippPolyphase_3_4 -} IppiFraction; - -enum { - IPP_FASTN_ORIENTATION = 0x0001, - IPP_FASTN_NMS = 0x0002, - IPP_FASTN_CIRCLE = 0X0004, - IPP_FASTN_SCORE_MODE0 = 0X0020 -}; - -#if !defined( _OWN_BLDPCS ) - -typedef enum { - ippAlphaOver, - ippAlphaIn, - ippAlphaOut, - ippAlphaATop, - ippAlphaXor, - ippAlphaPlus, - ippAlphaOverPremul, - ippAlphaInPremul, - ippAlphaOutPremul, - ippAlphaATopPremul, - ippAlphaXorPremul, - ippAlphaPlusPremul -} IppiAlphaType; - -typedef struct DeconvFFTState_32f_C1R IppiDeconvFFTState_32f_C1R; -typedef struct DeconvFFTState_32f_C3R IppiDeconvFFTState_32f_C3R; -typedef struct DeconvLR_32f_C1R IppiDeconvLR_32f_C1R; -typedef struct DeconvLR_32f_C3R IppiDeconvLR_32f_C3R; - -typedef enum { - ippiFilterBilateralGauss = 100, - ippiFilterBilateralGaussFast = 101 -} IppiFilterBilateralType; - -typedef struct FilterBilateralSpec IppiFilterBilateralSpec; - -typedef enum { - ippDistNormL1 = 0x00000002 -} IppiDistanceMethodType; - -typedef enum { - ippResizeFilterHann, - ippResizeFilterLanczos -} IppiResizeFilterType; - -typedef struct ResizeFilterState IppiResizeFilterState; - -typedef struct { - Ipp32u borderLeft; - Ipp32u borderTop; - Ipp32u borderRight; - Ipp32u borderBottom; -} IppiBorderSize; - -typedef enum { - ippWarpForward, - ippWarpBackward, -} IppiWarpDirection; - -typedef enum { - ippWarpAffine, - ippWarpPerspective, - ippWarpBilinear, -} IppiWarpTransformType; - - -typedef struct ResizeSpec_32f IppiResizeSpec_32f; -typedef struct ResizeYUV422Spec IppiResizeYUV422Spec; -typedef struct ResizeYUV420Spec IppiResizeYUV420Spec; - -typedef struct ResizeSpec_64f IppiResizeSpec_64f; - -typedef struct IppiWarpSpec IppiWarpSpec; - -typedef struct FilterBorderSpec IppiFilterBorderSpec; - -typedef struct ThresholdAdaptiveSpec IppiThresholdAdaptiveSpec; - -typedef struct HistogramSpec IppiHistogramSpec; - -typedef struct { - int cvCompatible; /* openCV compatible output format */ - int cellSize; /* squre cell size (pixels) */ - int blockSize; /* square block size (pixels) */ - int blockStride; /* block displacement (the same for x- and y- directions) */ - int nbins; /* required number of bins */ - Ipp32f sigma; /* gaussian factor of HOG block weights */ - Ipp32f l2thresh; /* normalization factor */ - IppiSize winSize; /* detection window size (pixels) */ -} IppiHOGConfig; - -typedef struct FFT2DSpec_C_32fc IppiFFTSpec_C_32fc; -typedef struct FFT2DSpec_R_32f IppiFFTSpec_R_32f; - -typedef struct DFT2DSpec_C_32fc IppiDFTSpec_C_32fc; -typedef struct DFT2DSpec_R_32f IppiDFTSpec_R_32f; - -typedef struct DCT2DFwdSpec_32f IppiDCTFwdSpec_32f; -typedef struct DCT2DInvSpec_32f IppiDCTInvSpec_32f; - -typedef struct iWTFwdSpec_32f_C1R IppiWTFwdSpec_32f_C1R; -typedef struct iWTInvSpec_32f_C1R IppiWTInvSpec_32f_C1R; -typedef struct iWTFwdSpec_32f_C3R IppiWTFwdSpec_32f_C3R; -typedef struct iWTInvSpec_32f_C3R IppiWTInvSpec_32f_C3R; - -typedef struct MomentState64f IppiMomentState_64f; -typedef Ipp64f IppiHuMoment_64f[7]; - -typedef struct LUT_Spec IppiLUT_Spec; - -#define IPP_HOG_MAX_CELL (16) /* max size of CELL */ -#define IPP_HOG_MAX_BLOCK (64) /* max size of BLOCK */ -#define IPP_HOG_MAX_BINS (16) /* max number of BINS */ - -typedef struct _ipHOG IppiHOGSpec; - -#endif /* _OWN_BLDPCS */ - - - /**** Below are 3D Image (Volume) Processing specific definitions ****/ - -typedef struct { - int width; - int height; - int depth; -} IpprVolume; - -typedef struct { - int x; - int y; - int z; - int width; - int height; - int depth; -} IpprCuboid; - -typedef struct { - int x; - int y; - int z; -} IpprPoint; - -/*****************************************************************************/ -/* Below are ippCV domain specific definitions */ -/*****************************************************************************/ - -typedef enum _IppiDifferentialKernel -{ - ippFilterSobelVert, - ippFilterSobelHoriz, - ippFilterSobel, - ippFilterScharrVert, - ippFilterScharrHoriz, - ippFilterScharr, - ippFilterCentralDiffVert, - ippFilterCentralDiffHoriz, - ippFilterCentralDiff, -}IppiDifferentialKernel; - -#if !defined( _OWN_BLDPCS ) - -typedef enum _IppiKernelType { - ippKernelSobel = 0, - ippKernelScharr = 1, - ippKernelSobelNeg = 2 -} IppiKernelType; - -typedef enum _IppiNorm { - ippiNormInf = 0, - ippiNormL1 = 1, - ippiNormL2 = 2, - ippiNormFM = 3 -} IppiNorm; - -typedef struct ipcvMorphState IppiMorphState; -typedef struct ipcvMorphAdvState IppiMorphAdvState; -typedef struct ipcvMorphGrayState_8u IppiMorphGrayState_8u; -typedef struct ipcvMorphGrayState_32f IppiMorphGrayState_32f; - -typedef struct ipcvConvState IppiConvState; - -typedef struct _IppiConnectedComp { - Ipp64f area; /* area of the segmented component */ - Ipp64f value[3];/* gray scale value of the segmented component */ - IppiRect rect; /* bounding rectangle of the segmented component */ -} IppiConnectedComp; - -typedef struct PyramidState IppiPyramidState; - -typedef IppiPyramidState IppiPyramidDownState_8u_C1R; -typedef IppiPyramidState IppiPyramidDownState_16u_C1R; -typedef IppiPyramidState IppiPyramidDownState_32f_C1R; -typedef IppiPyramidState IppiPyramidDownState_8u_C3R; -typedef IppiPyramidState IppiPyramidDownState_16u_C3R; -typedef IppiPyramidState IppiPyramidDownState_32f_C3R; -typedef IppiPyramidState IppiPyramidUpState_8u_C1R; -typedef IppiPyramidState IppiPyramidUpState_16u_C1R; -typedef IppiPyramidState IppiPyramidUpState_32f_C1R; -typedef IppiPyramidState IppiPyramidUpState_8u_C3R; -typedef IppiPyramidState IppiPyramidUpState_16u_C3R; -typedef IppiPyramidState IppiPyramidUpState_32f_C3R; - - -typedef struct _IppiPyramid { - Ipp8u **pImage; - IppiSize *pRoi; - Ipp64f *pRate; - int *pStep; - Ipp8u *pState; - int level; -} IppiPyramid; - -typedef struct OptFlowPyrLK IppiOptFlowPyrLK; - -typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_8u_C1R; -typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_16u_C1R; -typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_32f_C1R; - -typedef struct ipcvHaarClassifier_32f IppiHaarClassifier_32f; -typedef struct ipcvHaarClassifier_32s IppiHaarClassifier_32s; - -typedef struct ipcvFGHistogramState_8u_C1R IppFGHistogramState_8u_C1R; -typedef struct ipcvFGHistogramState_8u_C3R IppFGHistogramState_8u_C3R; - -typedef struct ipcvFGGaussianState_8u_C1R IppFGGaussianState_8u_C1R; -typedef struct ipcvFGGaussianState_8u_C3R IppFGGaussianState_8u_C3R; - -typedef enum _IppiInpaintFlag { - IPP_INPAINT_TELEA = 0, - IPP_INPAINT_NS = 1 -} IppiInpaintFlag; - -typedef struct ippcvFilterGaussianSpec IppFilterGaussianSpec; - -typedef struct ipcvInpaintState_8u IppiInpaintState_8u_C1R; -typedef struct ipcvInpaintState_8u IppiInpaintState_8u_C3R; - -typedef struct HoughProbSpec IppiHoughProbSpec; - -typedef struct FastNSpec IppiFastNSpec; - -typedef struct _IppiCornerFastN { - int x; - int y; - int cornerType; - int orientation; - float angle; - float score; -} IppiCornerFastN; - -typedef struct FGMMState_8u_C3R IppFGMMState_8u_C3R; - -typedef struct -{ - unsigned int numFrames; - unsigned int maxNGauss; - Ipp32f varInit; - Ipp32f varMin; - Ipp32f varMax; - Ipp32f varWBRatio; - Ipp32f bckgThr; - Ipp32f varNGRatio; - Ipp32f reduction; - Ipp8u shadowValue; - char shadowFlag; - Ipp32f shadowRatio; -} IppFGMModel; - -#endif /* _OWN_BLDPCS */ - -#define IPP_SEGMENT_QUEUE 0x01 -#define IPP_SEGMENT_DISTANCE 0x02 -#define IPP_SEGMENT_BORDER_4 0x40 -#define IPP_SEGMENT_BORDER_8 0x80 - -#define IPP_TRUNC(a,b) ((a)&~((b)-1)) -#define IPP_APPEND(a,b) (((a)+(b)-1)&~((b)-1)) - -/*****************************************************************************/ -/* Below are ippCC domain specific definitions */ -/*****************************************************************************/ -enum { - IPP_UPPER = 1, - IPP_LEFT = 2, - IPP_CENTER = 4, - IPP_RIGHT = 8, - IPP_LOWER = 16, - IPP_UPPER_LEFT = 32, - IPP_UPPER_RIGHT = 64, - IPP_LOWER_LEFT = 128, - IPP_LOWER_RIGHT = 256 -}; - -#if !defined( _OWN_BLDPCS ) - -typedef enum { - ippDitherNone, - ippDitherFS, - ippDitherJJN, - ippDitherStucki, - ippDitherBayer -} IppiDitherType; - -#endif /* _OWN_BLDPCS */ - -/*****************************************************************************/ -/* Below are ippCH domain specific definitions */ -/*****************************************************************************/ - -#if !defined( _OWN_BLDPCS ) - -typedef struct { - void *pFind; - int lenFind; -} IppRegExpFind; - -typedef struct RegExpState IppRegExpState; - -typedef enum { - ippFmtASCII = 0, - ippFmtUTF8 -} IppRegExpFormat; - -typedef struct RegExpReplaceState IppRegExpReplaceState; - -#endif /* _OWN_BLDPCS */ - -/*****************************************************************************/ -/* Below are ippDC domain specific definitions */ -/*****************************************************************************/ - -#if !defined ( _OWN_BLDPCS ) - -typedef struct MTFState_8u IppMTFState_8u; - -typedef enum { - ippBWTItohTanakaLimSort, - ippBWTItohTanakaUnlimSort, - ippBWTSuffixSort, - ippBWTAutoSort -} IppBWTSortAlgorithmHint; - -typedef struct LZSSState_8u IppLZSSState_8u; - -typedef struct LZ77State_8u IppLZ77State_8u; -typedef enum{ - IppLZ77FastCompr, - IppLZ77AverageCompr, - IppLZ77BestCompr -} IppLZ77ComprLevel; -typedef enum{ - IppLZ77NoChcksm, - IppLZ77Adler32, - IppLZ77CRC32 -} IppLZ77Chcksm; -typedef enum { - IppLZ77NoFlush, - IppLZ77SyncFlush, - IppLZ77FullFlush, - IppLZ77FinishFlush -} IppLZ77Flush; -typedef struct IppLZ77Pairs_16u { - Ipp16u length; - Ipp16u offset; -} IppLZ77Pair; -typedef enum { - IppLZ77StatusInit, - IppLZ77StatusLZ77Process, - IppLZ77StatusHuffProcess, - IppLZ77StatusFinal -} IppLZ77DeflateStatus; -typedef enum { - IppLZ77UseFixed, - IppLZ77UseDynamic, - IppLZ77UseStored -} IppLZ77HuffMode; -typedef enum { - IppLZ77InflateStatusInit, - IppLZ77InflateStatusHuffProcess, - IppLZ77InflateStatusLZ77Process, - IppLZ77InflateStatusFinal -} IppLZ77InflateStatus; - -typedef struct IppInflateState { - const Ipp8u* pWindow; /* pointer to the sliding window - (the dictionary for the LZ77 algorithm) */ - unsigned int winSize; /* size of the sliding window */ - unsigned int tableType; /* type of Huffman code tables - (for example, 0 - tables for Fixed Huffman codes) */ - unsigned int tableBufferSize; /* (ENOUGH = 2048) * (sizeof(code) = 4) - - sizeof(IppInflateState) */ -} IppInflateState; - -typedef enum { /* this type is used as a translator of the inflate_mode type from zlib */ - ippTYPE, - ippLEN, - ippLENEXT -} IppInflateMode; - -typedef struct { - Ipp16u freq; - Ipp16u code; -} IppDeflateFreqTable; - -typedef struct { - Ipp16u code; - Ipp16u len; -} IppDeflateHuffCode; - -typedef struct RLEState_BZ2 IppRLEState_BZ2; - -typedef struct EncodeHuffState_BZ2 IppEncodeHuffState_BZ2; - -typedef struct DecodeHuffState_BZ2 IppDecodeHuffState_BZ2; - -typedef enum { - IppLZO1XST, /* Single-threaded, generic LZO-compatible*/ - IppLZO1XMT /* Multi-threaded */ -} IppLZOMethod ; - -typedef struct LZOState_8u IppLZOState_8u; - -#endif /* _OWN_BLDPCS */ - -/* ///////////////////////////////////////////////////////////////////////////// -// The following enumerator defines a status of IPP operations -// negative value means error -*/ -typedef enum { - /* errors */ - ippStsNotSupportedModeErr = -9999,/* The requested mode is currently not supported. */ - ippStsCpuNotSupportedErr = -9998,/* The target CPU is not supported. */ - ippStsInplaceModeNotSupportedErr = -9997,/* The inplace operation is currently not supported. */ - - ippStsIIRIIRLengthErr = -234, /* Vector length for IIRIIR function is less than 3*(IIR order) */ - ippStsWarpTransformTypeErr = -233, /* The warp transform type is illegal */ - ippStsExceededSizeErr = -232, /* Requested size exceeded the maximum supported ROI size */ - ippStsWarpDirectionErr = -231, /* The warp transform direction is illegal */ - - ippStsFilterTypeErr = -230, /* The filter type is incorrect or not supported */ - - ippStsNormErr = -229, /* The norm is incorrect or not supported */ - - ippStsAlgTypeErr = -228, /* Algorithm type is not supported. */ - ippStsMisalignedOffsetErr = -227, /* The offset is not aligned with an element. */ - - ippStsQuadraticNonResidueErr = -226, /* SQRT operation on quadratic non-residue value. */ - - ippStsBorderErr = -225, /* Illegal value for border type.*/ - - ippStsDitherTypeErr = -224, /* Dithering type is not supported. */ - ippStsH264BufferFullErr = -223, /* Buffer for the output bitstream is full. */ - ippStsWrongAffinitySettingErr= -222, /* An affinity setting does not correspond to the affinity setting that was set by f.ippSetAffinity(). */ - ippStsLoadDynErr = -221, /* Error when loading the dynamic library. */ - - ippStsPointAtInfinity = -220, /* Point at infinity is detected. */ - - ippStsUnknownStatusCodeErr = -216, /* Unknown status code. */ - - ippStsOFBSizeErr = -215, /* Incorrect value for crypto OFB block size. */ - ippStsLzoBrokenStreamErr = -214, /* LZO safe decompression function cannot decode LZO stream. */ - - ippStsRoundModeNotSupportedErr = -213, /* Rounding mode is not supported. */ - ippStsDecimateFractionErr = -212, /* Fraction in Decimate is not supported. */ - ippStsWeightErr = -211, /* Incorrect value for weight. */ - - ippStsQualityIndexErr = -210, /* Cannot calculate the quality index for an image filled with a constant. */ - ippStsIIRPassbandRippleErr = -209, /* Ripple in passband for Chebyshev1 design is less than zero, equal to zero, or greater than 29. */ - ippStsFilterFrequencyErr = -208, /* Cutoff frequency of filter is less than zero, equal to zero, or greater than 0.5. */ - ippStsFIRGenOrderErr = -207, /* Order of the FIR filter for design is less than 1. */ - ippStsIIRGenOrderErr = -206, /* Order of the IIR filter for design is less than 1, or greater than 12. */ - - ippStsConvergeErr = -205, /* The algorithm does not converge. */ - ippStsSizeMatchMatrixErr = -204, /* The sizes of the source matrices are unsuitable. */ - ippStsCountMatrixErr = -203, /* Count value is less than, or equal to zero. */ - ippStsRoiShiftMatrixErr = -202, /* RoiShift value is negative or not divisible by the size of the data type. */ - - ippStsResizeNoOperationErr = -201, /* One of the output image dimensions is less than 1 pixel. */ - ippStsSrcDataErr = -200, /* The source buffer contains unsupported data. */ - ippStsMaxLenHuffCodeErr = -199, /* Huff: Max length of Huffman code is more than the expected one. */ - ippStsCodeLenTableErr = -198, /* Huff: Invalid codeLenTable. */ - ippStsFreqTableErr = -197, /* Huff: Invalid freqTable. */ - - ippStsIncompleteContextErr = -196, /* Crypto: set up of context is not complete. */ - - ippStsSingularErr = -195, /* Matrix is singular. */ - ippStsSparseErr = -194, /* Positions of taps are not in ascending order, or are negative, or repetitive. */ - ippStsBitOffsetErr = -193, /* Incorrect bit offset value. */ - ippStsQPErr = -192, /* Incorrect quantization parameter value. */ - ippStsVLCErr = -191, /* Illegal VLC or FLC is detected during stream decoding. */ - ippStsRegExpOptionsErr = -190, /* RegExp: Options for the pattern are incorrect. */ - ippStsRegExpErr = -189, /* RegExp: The structure pRegExpState contains incorrect data. */ - ippStsRegExpMatchLimitErr = -188, /* RegExp: The match limit is exhausted. */ - ippStsRegExpQuantifierErr = -187, /* RegExp: Incorrect quantifier. */ - ippStsRegExpGroupingErr = -186, /* RegExp: Incorrect grouping. */ - ippStsRegExpBackRefErr = -185, /* RegExp: Incorrect back reference. */ - ippStsRegExpChClassErr = -184, /* RegExp: Incorrect character class. */ - ippStsRegExpMetaChErr = -183, /* RegExp: Incorrect metacharacter. */ - ippStsStrideMatrixErr = -182, /* Stride value is not positive or not divisible by the size of the data type. */ - ippStsCTRSizeErr = -181, /* Incorrect value for crypto CTR block size. */ - ippStsJPEG2KCodeBlockIsNotAttached =-180, /* Codeblock parameters are not attached to the state structure. */ - ippStsNotPosDefErr = -179, /* Matrix is not positive definite. */ - - ippStsEphemeralKeyErr = -178, /* ECC: Invalid ephemeral key. */ - ippStsMessageErr = -177, /* ECC: Invalid message digest. */ - ippStsShareKeyErr = -176, /* ECC: Invalid share key. */ - ippStsIvalidPublicKey = -175, /* ECC: Invalid public key. */ - ippStsIvalidPrivateKey = -174, /* ECC: Invalid private key. */ - ippStsOutOfECErr = -173, /* ECC: Point out of EC. */ - ippStsECCInvalidFlagErr = -172, /* ECC: Invalid Flag. */ - - ippStsMP3FrameHeaderErr = -171, /* Error in fields of the IppMP3FrameHeader structure. */ - ippStsMP3SideInfoErr = -170, /* Error in fields of the IppMP3SideInfo structure. */ - - ippStsBlockStepErr = -169, /* Step for Block is less than 8. */ - ippStsMBStepErr = -168, /* Step for MB is less than 16. */ - - ippStsAacPrgNumErr = -167, /* AAC: Invalid number of elements for one program. */ - ippStsAacSectCbErr = -166, /* AAC: Invalid section codebook. */ - ippStsAacSfValErr = -164, /* AAC: Invalid scalefactor value. */ - ippStsAacCoefValErr = -163, /* AAC: Invalid quantized coefficient value. */ - ippStsAacMaxSfbErr = -162, /* AAC: Invalid coefficient index. */ - ippStsAacPredSfbErr = -161, /* AAC: Invalid predicted coefficient index. */ - ippStsAacPlsDataErr = -160, /* AAC: Invalid pulse data attributes. */ - ippStsAacGainCtrErr = -159, /* AAC: Gain control is not supported. */ - ippStsAacSectErr = -158, /* AAC: Invalid number of sections. */ - ippStsAacTnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters. */ - ippStsAacTnsLenErr = -156, /* AAC: Invalid length of TNS region. */ - ippStsAacTnsOrderErr = -155, /* AAC: Invalid order of TNS filter. */ - ippStsAacTnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients. */ - ippStsAacTnsCoefErr = -153, /* AAC: Invalid coefficients of TNS filter. */ - ippStsAacTnsDirectErr = -152, /* AAC: Invalid direction TNS filter. */ - ippStsAacTnsProfileErr = -151, /* AAC: Invalid TNS profile. */ - ippStsAacErr = -150, /* AAC: Internal error. */ - ippStsAacBitOffsetErr = -149, /* AAC: Invalid current bit offset in bitstream. */ - ippStsAacAdtsSyncWordErr = -148, /* AAC: Invalid ADTS syncword. */ - ippStsAacSmplRateIdxErr = -147, /* AAC: Invalid sample rate index. */ - ippStsAacWinLenErr = -146, /* AAC: Invalid window length (not short or long). */ - ippStsAacWinGrpErr = -145, /* AAC: Invalid number of groups for current window length. */ - ippStsAacWinSeqErr = -144, /* AAC: Invalid window sequence range. */ - ippStsAacComWinErr = -143, /* AAC: Invalid common window flag. */ - ippStsAacStereoMaskErr = -142, /* AAC: Invalid stereo mask. */ - ippStsAacChanErr = -141, /* AAC: Invalid channel number. */ - ippStsAacMonoStereoErr = -140, /* AAC: Invalid mono-stereo flag. */ - ippStsAacStereoLayerErr = -139, /* AAC: Invalid this Stereo Layer flag. */ - ippStsAacMonoLayerErr = -138, /* AAC: Invalid this Mono Layer flag. */ - ippStsAacScalableErr = -137, /* AAC: Invalid scalable object flag. */ - ippStsAacObjTypeErr = -136, /* AAC: Invalid audio object type. */ - ippStsAacWinShapeErr = -135, /* AAC: Invalid window shape. */ - ippStsAacPcmModeErr = -134, /* AAC: Invalid PCM output interleaving indicator. */ - ippStsVLCUsrTblHeaderErr = -133, /* VLC: Invalid header inside table. */ - ippStsVLCUsrTblUnsupportedFmtErr = -132, /* VLC: Table format is not supported. */ - ippStsVLCUsrTblEscAlgTypeErr = -131, /* VLC: Ecs-algorithm is not supported. */ - ippStsVLCUsrTblEscCodeLengthErr = -130, /* VLC: Esc-code length inside table header is incorrect. */ - ippStsVLCUsrTblCodeLengthErr = -129, /* VLC: Code length inside table is incorrect. */ - ippStsVLCInternalTblErr = -128, /* VLC: Invalid internal table. */ - ippStsVLCInputDataErr = -127, /* VLC: Invalid input data. */ - ippStsVLCAACEscCodeLengthErr = -126, /* VLC: Invalid AAC-Esc code length. */ - ippStsNoiseRangeErr = -125, /* Noise value for Wiener Filter is out of range. */ - ippStsUnderRunErr = -124, /* Error in data under run. */ - ippStsPaddingErr = -123, /* Detected padding error indicates the possible data corruption. */ - ippStsCFBSizeErr = -122, /* Incorrect value for crypto CFB block size. */ - ippStsPaddingSchemeErr = -121, /* Invalid padding scheme. */ - ippStsInvalidCryptoKeyErr = -120, /* A compromised key causes suspansion of the requested cryptographic operation. */ - ippStsLengthErr = -119, /* Incorrect value for string length. */ - ippStsBadModulusErr = -118, /* Bad modulus caused a failure in module inversion. */ - ippStsLPCCalcErr = -117, /* Cannot evaluate linear prediction. */ - ippStsRCCalcErr = -116, /* Cannot compute reflection coefficients. */ - ippStsIncorrectLSPErr = -115, /* Incorrect values for Linear Spectral Pair. */ - ippStsNoRootFoundErr = -114, /* No roots are found for equation. */ - ippStsJPEG2KBadPassNumber = -113, /* Pass number exceeds allowed boundaries [0,nOfPasses-1]. */ - ippStsJPEG2KDamagedCodeBlock= -112, /* Codeblock for decoding contains damaged data. */ - ippStsH263CBPYCodeErr = -111, /* Illegal Huffman code is detected through CBPY stream processing. */ - ippStsH263MCBPCInterCodeErr = -110, /* Illegal Huffman code is detected through MCBPC Inter stream processing. */ - ippStsH263MCBPCIntraCodeErr = -109, /* Illegal Huffman code is detected through MCBPC Intra stream processing. */ - ippStsNotEvenStepErr = -108, /* Step value is not pixel multiple. */ - ippStsHistoNofLevelsErr = -107, /* Number of levels for histogram is less than 2. */ - ippStsLUTNofLevelsErr = -106, /* Number of levels for LUT is less than 2. */ - ippStsMP4BitOffsetErr = -105, /* Incorrect bit offset value. */ - ippStsMP4QPErr = -104, /* Incorrect quantization parameter. */ - ippStsMP4BlockIdxErr = -103, /* Incorrect block index. */ - ippStsMP4BlockTypeErr = -102, /* Incorrect block type. */ - ippStsMP4MVCodeErr = -101, /* Illegal Huffman code is detected during MV stream processing. */ - ippStsMP4VLCCodeErr = -100, /* Illegal Huffman code is detected during VLC stream processing. */ - ippStsMP4DCCodeErr = -99, /* Illegal code is detected during DC stream processing. */ - ippStsMP4FcodeErr = -98, /* Incorrect fcode value. */ - ippStsMP4AlignErr = -97, /* Incorrect buffer alignment . */ - ippStsMP4TempDiffErr = -96, /* Incorrect temporal difference. */ - ippStsMP4BlockSizeErr = -95, /* Incorrect size of a block or macroblock. */ - ippStsMP4ZeroBABErr = -94, /* All BAB values are equal to zero. */ - ippStsMP4PredDirErr = -93, /* Incorrect prediction direction. */ - ippStsMP4BitsPerPixelErr = -92, /* Incorrect number of bits per pixel. */ - ippStsMP4VideoCompModeErr = -91, /* Incorrect video component mode. */ - ippStsMP4LinearModeErr = -90, /* Incorrect DC linear mode. */ - ippStsH263PredModeErr = -83, /* Incorrect Prediction Mode value. */ - ippStsH263BlockStepErr = -82, /* The step value is less than 8. */ - ippStsH263MBStepErr = -81, /* The step value is less than 16. */ - ippStsH263FrameWidthErr = -80, /* The frame width is less than 8. */ - ippStsH263FrameHeightErr = -79, /* The frame height is less than, or equal to zero. */ - ippStsH263ExpandPelsErr = -78, /* Expand pixels number is less than 8. */ - ippStsH263PlaneStepErr = -77, /* Step value is less than the plane width. */ - ippStsH263QuantErr = -76, /* Quantizer value is less than, or equal to zero, or greater than 31. */ - ippStsH263MVCodeErr = -75, /* Illegal Huffman code is detected during MV stream processing. */ - ippStsH263VLCCodeErr = -74, /* Illegal Huffman code is detected during VLC stream processing. */ - ippStsH263DCCodeErr = -73, /* Illegal code is detected during DC stream processing. */ - ippStsH263ZigzagLenErr = -72, /* Zigzag compact length is more than 64. */ - ippStsFBankFreqErr = -71, /* Incorrect value for the filter bank frequency parameter. */ - ippStsFBankFlagErr = -70, /* Incorrect value for the filter bank parameter. */ - ippStsFBankErr = -69, /* Filter bank is not correctly initialized. */ - ippStsNegOccErr = -67, /* Occupation count is negative. */ - ippStsCdbkFlagErr = -66, /* Incorrect value for the codebook flag parameter. */ - ippStsSVDCnvgErr = -65, /* SVD algorithm does not converge. */ - ippStsJPEGHuffTableErr = -64, /* JPEG Huffman table is destroyed. */ - ippStsJPEGDCTRangeErr = -63, /* JPEG DCT coefficient is out of range. */ - ippStsJPEGOutOfBufErr = -62, /* Attempt to access out of the buffer limits. */ - ippStsDrawTextErr = -61, /* System error in the draw text operation. */ - ippStsChannelOrderErr = -60, /* Incorrect order of the destination channels. */ - ippStsZeroMaskValuesErr = -59, /* All values of the mask are equal to zero. */ - ippStsQuadErr = -58, /* The quadrangle is nonconvex or degenerates into triangle, line, or point */ - ippStsRectErr = -57, /* Size of the rectangle region is less than, or equal to 1. */ - ippStsCoeffErr = -56, /* Incorrect values for transformation coefficients. */ - ippStsNoiseValErr = -55, /* Incorrect value for noise amplitude for dithering. */ - ippStsDitherLevelsErr = -54, /* Number of dithering levels is out of range. */ - ippStsNumChannelsErr = -53, /* Number of channels is incorrect, or not supported. */ - ippStsCOIErr = -52, /* COI is out of range. */ - ippStsDivisorErr = -51, /* Divisor is equal to zero, function is aborted. */ - ippStsAlphaTypeErr = -50, /* Illegal type of image compositing operation. */ - ippStsGammaRangeErr = -49, /* Gamma range bounds is less than, or equal to zero. */ - ippStsGrayCoefSumErr = -48, /* Sum of the conversion coefficients must be less than, or equal to 1. */ - ippStsChannelErr = -47, /* Illegal channel number. */ - ippStsToneMagnErr = -46, /* Tone magnitude is less than, or equal to zero. */ - ippStsToneFreqErr = -45, /* Tone frequency is negative, or greater than, or equal to 0.5. */ - ippStsTonePhaseErr = -44, /* Tone phase is negative, or greater than, or equal to 2*PI. */ - ippStsTrnglMagnErr = -43, /* Triangle magnitude is less than, or equal to zero. */ - ippStsTrnglFreqErr = -42, /* Triangle frequency is negative, or greater than, or equal to 0.5. */ - ippStsTrnglPhaseErr = -41, /* Triangle phase is negative, or greater than, or equal to 2*PI. */ - ippStsTrnglAsymErr = -40, /* Triangle asymmetry is less than -PI, or greater than, or equal to PI. */ - ippStsHugeWinErr = -39, /* Kaiser window is too big. */ - ippStsJaehneErr = -38, /* Magnitude value is negative. */ - ippStsStrideErr = -37, /* Stride value is less than the length of the row. */ - ippStsEpsValErr = -36, /* Negative epsilon value. */ - ippStsWtOffsetErr = -35, /* Invalid offset value for wavelet filter. */ - ippStsAnchorErr = -34, /* Anchor point is outside the mask. */ - ippStsMaskSizeErr = -33, /* Invalid mask size. */ - ippStsShiftErr = -32, /* Shift value is less than zero. */ - ippStsSampleFactorErr = -31, /* Sampling factor is less than, or equal to zero. */ - ippStsSamplePhaseErr = -30, /* Phase value is out of range: 0 <= phase < factor. */ - ippStsFIRMRFactorErr = -29, /* MR FIR sampling factor is less than, or equal to zero. */ - ippStsFIRMRPhaseErr = -28, /* MR FIR sampling phase is negative, or greater than, or equal to the sampling factor. */ - ippStsRelFreqErr = -27, /* Relative frequency value is out of range. */ - ippStsFIRLenErr = -26, /* Length of a FIR filter is less than, or equal to zero. */ - ippStsIIROrderErr = -25, /* Order of an IIR filter is not valid. */ - ippStsDlyLineIndexErr = -24, /* Invalid value for the delay line sample index. */ - ippStsResizeFactorErr = -23, /* Resize factor(s) is less than, or equal to zero. */ - ippStsInterpolationErr = -22, /* Invalid interpolation mode. */ - ippStsMirrorFlipErr = -21, /* Invalid flip mode. */ - ippStsMoment00ZeroErr = -20, /* Moment value M(0,0) is too small to continue calculations. */ - ippStsThreshNegLevelErr = -19, /* Negative value of the level in the threshold operation. */ - ippStsThresholdErr = -18, /* Invalid threshold bounds. */ - ippStsContextMatchErr = -17, /* Context parameter does not match the operation. */ - ippStsFftFlagErr = -16, /* Invalid value for the FFT flag parameter. */ - ippStsFftOrderErr = -15, /* Invalid value for the FFT order parameter. */ - ippStsStepErr = -14, /* Step value is not valid. */ - ippStsScaleRangeErr = -13, /* Scale bounds are out of range. */ - ippStsDataTypeErr = -12, /* Data type is incorrect or not supported. */ - ippStsOutOfRangeErr = -11, /* Argument is out of range, or point is outside the image. */ - ippStsDivByZeroErr = -10, /* An attempt to divide by zero. */ - ippStsMemAllocErr = -9, /* Memory allocated for the operation is not enough.*/ - ippStsNullPtrErr = -8, /* Null pointer error. */ - ippStsRangeErr = -7, /* Incorrect values for bounds: the lower bound is greater than the upper bound. */ - ippStsSizeErr = -6, /* Incorrect value for data size. */ - ippStsBadArgErr = -5, /* Incorrect arg/param of the function. */ - ippStsNoMemErr = -4, /* Not enough memory for the operation. */ - ippStsSAReservedErr3 = -3, /* Unknown/unspecified error, -3. */ - ippStsErr = -2, /* Unknown/unspecified error, -2. */ - ippStsSAReservedErr1 = -1, /* Unknown/unspecified error, -1. */ - - /* no errors */ - ippStsNoErr = 0, /* No errors. */ - - /* warnings */ - ippStsNoOperation = 1, /* No operation has been executed. */ - ippStsMisalignedBuf = 2, /* Misaligned pointer in operation in which it must be aligned. */ - ippStsSqrtNegArg = 3, /* Negative value(s) for the argument in the Sqrt function. */ - ippStsInvZero = 4, /* INF result. Zero value was met by InvThresh with zero level. */ - ippStsEvenMedianMaskSize= 5, /* Even size of the Median Filter mask was replaced with the odd one. */ - ippStsDivByZero = 6, /* Zero value(s) for the divisor in the Div function. */ - ippStsLnZeroArg = 7, /* Zero value(s) for the argument in the Ln function. */ - ippStsLnNegArg = 8, /* Negative value(s) for the argument in the Ln function. */ - ippStsNanArg = 9, /* Argument value is not a number. */ - ippStsJPEGMarker = 10, /* JPEG marker in the bitstream. */ - ippStsResFloor = 11, /* All result values are floored. */ - ippStsOverflow = 12, /* Overflow in the operation. */ - ippStsLSFLow = 13, /* Quantized LP synthesis filter stability check is applied at the low boundary of [0,pi]. */ - ippStsLSFHigh = 14, /* Quantized LP synthesis filter stability check is applied at the high boundary of [0,pi]. */ - ippStsLSFLowAndHigh = 15, /* Quantized LP synthesis filter stability check is applied at both boundaries of [0,pi]. */ - ippStsZeroOcc = 16, /* Zero occupation count. */ - ippStsUnderflow = 17, /* Underflow in the operation. */ - ippStsSingularity = 18, /* Singularity in the operation. */ - ippStsDomain = 19, /* Argument is out of the function domain. */ - ippStsNonIntelCpu = 20, /* The target CPU is not Genuine Intel. */ - ippStsCpuMismatch = 21, /* Cannot set the library for the given CPU. */ - ippStsNoIppFunctionFound = 22, /* Application does not contain Intel IPP function calls. */ - ippStsDllNotFoundBestUsed = 23, /* Dispatcher cannot find the newest version of the Intel IPP dll. */ - ippStsNoOperationInDll = 24, /* The function does nothing in the dynamic version of the library. */ - ippStsInsufficientEntropy= 25, /* Generation of the prime/key failed due to insufficient entropy in the random seed and stimulus bit string. */ - ippStsOvermuchStrings = 26, /* Number of destination strings is more than expected. */ - ippStsOverlongString = 27, /* Length of one of the destination strings is more than expected. */ - ippStsAffineQuadChanged = 28, /* 4th vertex of destination quad is not equal to customer's one. */ - ippStsWrongIntersectROI = 29, /* ROI has no intersection with the source or destination ROI. No operation. */ - ippStsWrongIntersectQuad = 30, /* Quadrangle has no intersection with the source or destination ROI. No operation. */ - ippStsSmallerCodebook = 31, /* Size of created codebook is less than the cdbkSize argument. */ - ippStsSrcSizeLessExpected = 32, /* DC: Size of the source buffer is less than the expected one. */ - ippStsDstSizeLessExpected = 33, /* DC: Size of the destination buffer is less than the expected one. */ - ippStsStreamEnd = 34, /* DC: The end of stream processed. */ - ippStsDoubleSize = 35, /* Width or height of image is odd. */ - ippStsNotSupportedCpu = 36, /* The CPU is not supported. */ - ippStsUnknownCacheSize = 37, /* The CPU is supported, but the size of the cache is unknown. */ - ippStsSymKernelExpected = 38, /* The Kernel is not symmetric. */ - ippStsEvenMedianWeight = 39, /* Even weight of the Weighted Median Filter is replaced with the odd one. */ - ippStsWrongIntersectVOI = 40, /* VOI has no intersection with the source or destination volume. No operation. */ - ippStsI18nMsgCatalogInvalid=41, /* Message Catalog is invalid, English message returned. */ - ippStsI18nGetMessageFail = 42, /* Failed to fetch a localized message, English message returned. For more information use errno on Linux* OS and GetLastError on Windows* OS. */ - ippStsWaterfall = 43, /* Cannot load required library, waterfall is used. */ - ippStsPrevLibraryUsed = 44, /* Cannot load required library, previous dynamic library is used. */ - ippStsLLADisabled = 45, /* OpenMP* Low Level Affinity is disabled. */ - ippStsNoAntialiasing = 46, /* The mode does not support antialiasing. */ - ippStsRepetitiveSrcData = 47, /* DC: The source data is too repetitive. */ - ippStsSizeWrn = 48, /* The size does not allow to perform full operation. */ - ippStsFeatureNotSupported = 49, /* Current CPU doesn't support at least 1 of the desired features. */ - ippStsUnknownFeature = 50, /* At least one of the desired features is unknown. */ - ippStsFeaturesCombination = 51, /* Wrong combination of features. */ - ippStsAccurateModeNotSupported = 52 /* Accurate mode is not supported. */ -} IppStatus; - -#define ippStsOk ippStsNoErr - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __IPPTYPES_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __IPPTYPES_H__ +#define __IPPTYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/*****************************************************************************/ +/* Below are ippCore domain specific definitions */ +/*****************************************************************************/ +#if !defined( _OWN_BLDPCS ) + +#define ippCPUID_MMX 0x00000001 /* Intel Architecture MMX technology supported */ +#define ippCPUID_SSE 0x00000002 /* Streaming SIMD Extensions */ +#define ippCPUID_SSE2 0x00000004 /* Streaming SIMD Extensions 2 */ +#define ippCPUID_SSE3 0x00000008 /* Streaming SIMD Extensions 3 */ +#define ippCPUID_SSSE3 0x00000010 /* Supplemental Streaming SIMD Extensions 3 */ +#define ippCPUID_MOVBE 0x00000020 /* The processor supports MOVBE instruction */ +#define ippCPUID_SSE41 0x00000040 /* Streaming SIMD Extensions 4.1 */ +#define ippCPUID_SSE42 0x00000080 /* Streaming SIMD Extensions 4.2 */ +#define ippCPUID_AVX 0x00000100 /* Advanced Vector Extensions instruction set */ +#define ippAVX_ENABLEDBYOS 0x00000200 /* The operating system supports AVX */ +#define ippCPUID_AES 0x00000400 /* AES instruction */ +#define ippCPUID_CLMUL 0x00000800 /* PCLMULQDQ instruction */ +#define ippCPUID_ABR 0x00001000 /* Reserved */ +#define ippCPUID_RDRAND 0x00002000 /* Read Random Number instructions */ +#define ippCPUID_F16C 0x00004000 /* Float16 instructions */ +#define ippCPUID_AVX2 0x00008000 /* Advanced Vector Extensions 2 instruction set */ +#define ippCPUID_ADCOX 0x00010000 /* ADCX and ADOX instructions */ +#define ippCPUID_RDSEED 0x00020000 /* The RDSEED instruction */ +#define ippCPUID_PREFETCHW 0x00040000 /* The PREFETCHW instruction */ +#define ippCPUID_SHA 0x00080000 /* Intel (R) SHA Extensions */ +#define ippCPUID_AVX512F 0x00100000 /* AVX-512 Foundation instructions */ +#define ippCPUID_AVX512CD 0x00200000 /* AVX-512 Conflict Detection instructions */ +#define ippCPUID_AVX512ER 0x00400000 /* AVX-512 Exponential & Reciprocal instructions*/ +#define ippCPUID_AVX512PF 0x00800000 /* AVX-512 Prefetch instructions */ +#define ippCPUID_AVX512BW 0x01000000 /* AVX-512 Byte & Word instructions */ +#define ippCPUID_AVX512DQ 0x02000000 /* AVX-512 DWord & QWord instructions */ +#define ippCPUID_AVX512VL 0x04000000 /* AVX-512 Vector Length extensions */ +#define ippCPUID_KNC 0x80000000 /* Intel(R) Xeon Phi(TM) Coprocessor */ +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define ippCPUID_NOCHECK 0x8000000000000000L /* Force ippSetCpuFeatures to set CPU features without check */ +#else + #define ippCPUID_NOCHECK 0x8000000000000000LL +#endif + +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define ippCPUID_GETINFO_A 0x616f666e69746567L /* Force ipp_GetCpuFeatures to work as cpuid instruction */ +#else + #define ippCPUID_GETINFO_A 0x616f666e69746567LL +#endif + +#define IPP_COUNT_OF( obj ) (sizeof(obj)/sizeof(obj[0])) + +/*****************************************************************************/ +/* Below are ippSP domain specific definitions */ +/*****************************************************************************/ +typedef enum { + ippRndZero, + ippRndNear, + ippRndFinancial, + ippRndHintAccurate=0x10 +} IppRoundMode; + + +typedef enum { + ippAlgHintNone, + ippAlgHintFast, + ippAlgHintAccurate +} IppHintAlgorithm; + +typedef enum { + ippCmpLess, + ippCmpLessEq, + ippCmpEq, + ippCmpGreaterEq, + ippCmpGreater +} IppCmpOp; + +typedef enum { + ippAlgAuto = 0x00000000, + ippAlgDirect = 0x00000001, + ippAlgFFT = 0x00000002, + ippAlgMask = 0x000000FF +} IppAlgType; + +typedef enum { + ippsNormNone = 0x00000000, /* default */ + ippsNormA = 0x00000100, /* biased normalization */ + ippsNormB = 0x00000200, /* unbiased normalization */ + ippsNormMask = 0x0000FF00 +} IppsNormOp; + +typedef enum { + ippNormInf = 0x00000001, + ippNormL1 = 0x00000002, + ippNormL2 = 0x00000004 +} IppNormType; + +enum { + IPP_FFT_DIV_FWD_BY_N = 1, + IPP_FFT_DIV_INV_BY_N = 2, + IPP_FFT_DIV_BY_SQRTN = 4, + IPP_FFT_NODIV_BY_ANY = 8 +}; + +enum { + IPP_DIV_FWD_BY_N = 1, + IPP_DIV_INV_BY_N = 2, + IPP_DIV_BY_SQRTN = 4, + IPP_NODIV_BY_ANY = 8 +}; + +typedef struct { + Ipp32f rho; + Ipp32f theta; +} IppPointPolar; + +typedef enum {ippWinBartlett,ippWinBlackman,ippWinHamming,ippWinHann,ippWinRect} IppWinType; + +typedef enum { ippButterworth, ippChebyshev1 } IppsIIRFilterType; + +typedef enum { ippZCR=0, ippZCXor, ippZCC } IppsZCType; + +#if !defined( _OWN_BLDPCS ) + +typedef struct { + int left; + int right; +} IppsROI; + +typedef struct RandUniState_8u IppsRandUniState_8u; +typedef struct RandUniState_16s IppsRandUniState_16s; +typedef struct RandUniState_32f IppsRandUniState_32f; +typedef struct RandUniState_64f IppsRandUniState_64f; + +typedef struct RandGaussState_8u IppsRandGaussState_8u; +typedef struct RandGaussState_16s IppsRandGaussState_16s; +typedef struct RandGaussState_32f IppsRandGaussState_32f; +typedef struct RandGaussState_64f IppsRandGaussState_64f; + +typedef struct FFTSpec_C_32fc IppsFFTSpec_C_32fc; +typedef struct FFTSpec_C_32f IppsFFTSpec_C_32f; +typedef struct FFTSpec_R_32f IppsFFTSpec_R_32f; + +typedef struct FFTSpec_C_64fc IppsFFTSpec_C_64fc; +typedef struct FFTSpec_C_64f IppsFFTSpec_C_64f; +typedef struct FFTSpec_R_64f IppsFFTSpec_R_64f; + +typedef struct DFTSpec_C_32fc IppsDFTSpec_C_32fc; +typedef struct DFTSpec_C_32f IppsDFTSpec_C_32f; +typedef struct DFTSpec_R_32f IppsDFTSpec_R_32f; + +typedef struct DFTSpec_C_64fc IppsDFTSpec_C_64fc; +typedef struct DFTSpec_C_64f IppsDFTSpec_C_64f; +typedef struct DFTSpec_R_64f IppsDFTSpec_R_64f; + +typedef struct DCTFwdSpec_32f IppsDCTFwdSpec_32f; +typedef struct DCTInvSpec_32f IppsDCTInvSpec_32f; + +typedef struct DCTFwdSpec_64f IppsDCTFwdSpec_64f; +typedef struct DCTInvSpec_64f IppsDCTInvSpec_64f; + +typedef struct sWTFwdState_32f IppsWTFwdState_32f; +typedef struct sWTFwdState_8u32f IppsWTFwdState_8u32f; +typedef struct sWTFwdState_16s32f IppsWTFwdState_16s32f; +typedef struct sWTFwdState_16u32f IppsWTFwdState_16u32f; +typedef struct sWTInvState_32f IppsWTInvState_32f; +typedef struct sWTInvState_32f8u IppsWTInvState_32f8u; +typedef struct sWTInvState_32f16s IppsWTInvState_32f16s; +typedef struct sWTInvState_32f16u IppsWTInvState_32f16u; + +typedef struct IIRState_32f IppsIIRState_32f; +typedef struct IIRState_32fc IppsIIRState_32fc; +typedef struct IIRState32f_16s IppsIIRState32f_16s; +typedef struct IIRState32fc_16sc IppsIIRState32fc_16sc; +typedef struct IIRState_64f IppsIIRState_64f; +typedef struct IIRState_64fc IppsIIRState_64fc; +typedef struct IIRState64f_32f IppsIIRState64f_32f; +typedef struct IIRState64fc_32fc IppsIIRState64fc_32fc; +typedef struct IIRState64f_32s IppsIIRState64f_32s; +typedef struct IIRState64fc_32sc IppsIIRState64fc_32sc; +typedef struct IIRState64f_16s IppsIIRState64f_16s; +typedef struct IIRState64fc_16sc IppsIIRState64fc_16sc; + +typedef struct FIRSpec_32f IppsFIRSpec_32f; +typedef struct FIRSpec_64f IppsFIRSpec_64f; +typedef struct FIRSpec_32fc IppsFIRSpec_32fc; +typedef struct FIRSpec_64fc IppsFIRSpec_64fc; + +typedef struct FIRLMSState_32f IppsFIRLMSState_32f; +typedef struct FIRLMSState32f_16s IppsFIRLMSState32f_16s; + +typedef struct HilbertSpec IppsHilbertSpec; + +typedef struct FIRSparseState_32f IppsFIRSparseState_32f; +typedef struct IIRSparseState_32f IppsIIRSparseState_32f; + +typedef struct ResamplingPolyphase_16s IppsResamplingPolyphase_16s; +typedef struct ResamplingPolyphaseFixed_16s IppsResamplingPolyphaseFixed_16s; +typedef struct ResamplingPolyphase_32f IppsResamplingPolyphase_32f; +typedef struct ResamplingPolyphaseFixed_32f IppsResamplingPolyphaseFixed_32f; + +#endif /* _OWN_BLDPCS */ + +/*****************************************************************************/ +/* Below are ippIP domain specific definitions */ +/*****************************************************************************/ +#define IPP_TEMPORAL_COPY 0x0 +#define IPP_NONTEMPORAL_STORE 0x01 +#define IPP_NONTEMPORAL_LOAD 0x02 + +typedef int IppEnum; + +#define IPP_DEG_TO_RAD( deg ) ( (deg)/180.0 * IPP_PI ) + +typedef enum { + ippiNormNone = 0x00000000, /* default */ + ippiNorm = 0x00000100, /* normalized form */ + ippiNormCoefficient = 0x00000200, /* correlation coefficient in the range [-1.0 ... 1.0] */ + ippiNormMask = 0x0000FF00 +} IppiNormOp; + +typedef enum { + ippiROIFull = 0x00000000, + ippiROIValid = 0x00010000, + ippiROISame = 0x00020000, + ippiROIMask = 0x00FF0000 +} IppiROIShape; + +typedef enum { + ippC0 = 0, + ippC1 = 1, + ippC2 = 2, + ippC3 = 3, + ippC4 = 4, + ippP2 = 5, + ippP3 = 6, + ippP4 = 7, + ippAC1 = 8, + ippAC4 = 9, + ippA0C4 = 10, + ippAP4 = 11 +} IppChannels; + +typedef enum _IppiBorderType { + ippBorderConst = 0, + ippBorderRepl = 1, + ippBorderWrap = 2, + ippBorderMirror = 3, /* left border: 012... -> 21012... */ + ippBorderMirrorR = 4, /* left border: 012... -> 210012... */ + ippBorderInMem = 6, + ippBorderTransp = 7, + ippBorderInMemTop = 0x0010, + ippBorderInMemBottom = 0x0020, + ippBorderInMemLeft = 0x0040, + ippBorderInMemRight = 0x0080 +} IppiBorderType; + +typedef enum { + ippAxsHorizontal, + ippAxsVertical, + ippAxsBoth, + ippAxs45, + ippAxs135 +} IppiAxis; + +typedef struct { + int x; + int y; + int width; + int height; +} IppiRect; + +typedef struct { + int x; + int y; +} IppiPoint; + +typedef struct { + int width; + int height; +} IppiSize; + +typedef struct { + Ipp32f x; + Ipp32f y; +} IppiPoint_32f; + +typedef enum _IppiMaskSize { + ippMskSize1x3 = 13, + ippMskSize1x5 = 15, + ippMskSize3x1 = 31, + ippMskSize3x3 = 33, + ippMskSize5x1 = 51, + ippMskSize5x5 = 55 +} IppiMaskSize; + +enum { + IPPI_INTER_NN = 1, + IPPI_INTER_LINEAR = 2, + IPPI_INTER_CUBIC = 4, + IPPI_INTER_CUBIC2P_BSPLINE, /* two-parameter cubic filter (B=1, C=0) */ + IPPI_INTER_CUBIC2P_CATMULLROM, /* two-parameter cubic filter (B=0, C=1/2) */ + IPPI_INTER_CUBIC2P_B05C03, /* two-parameter cubic filter (B=1/2, C=3/10) */ + IPPI_INTER_SUPER = 8, + IPPI_INTER_LANCZOS = 16, + IPPI_ANTIALIASING = (1 << 29), + IPPI_SUBPIXEL_EDGE = (1 << 30), + IPPI_SMOOTH_EDGE = (1 << 31) +}; + +typedef enum { + ippNearest = IPPI_INTER_NN, + ippLinear = IPPI_INTER_LINEAR, + ippCubic = IPPI_INTER_CUBIC2P_CATMULLROM, + ippLanczos = IPPI_INTER_LANCZOS, + ippHahn = 0, + ippSuper = IPPI_INTER_SUPER +} IppiInterpolationType; + +typedef enum { + ippPolyphase_1_2, + ippPolyphase_3_5, + ippPolyphase_2_3, + ippPolyphase_7_10, + ippPolyphase_3_4 +} IppiFraction; + +enum { + IPP_FASTN_ORIENTATION = 0x0001, + IPP_FASTN_NMS = 0x0002, + IPP_FASTN_CIRCLE = 0X0004, + IPP_FASTN_SCORE_MODE0 = 0X0020 +}; + +#if !defined( _OWN_BLDPCS ) + +typedef enum { + ippAlphaOver, + ippAlphaIn, + ippAlphaOut, + ippAlphaATop, + ippAlphaXor, + ippAlphaPlus, + ippAlphaOverPremul, + ippAlphaInPremul, + ippAlphaOutPremul, + ippAlphaATopPremul, + ippAlphaXorPremul, + ippAlphaPlusPremul +} IppiAlphaType; + +typedef struct DeconvFFTState_32f_C1R IppiDeconvFFTState_32f_C1R; +typedef struct DeconvFFTState_32f_C3R IppiDeconvFFTState_32f_C3R; +typedef struct DeconvLR_32f_C1R IppiDeconvLR_32f_C1R; +typedef struct DeconvLR_32f_C3R IppiDeconvLR_32f_C3R; + +typedef enum { + ippiFilterBilateralGauss = 100, + ippiFilterBilateralGaussFast = 101 +} IppiFilterBilateralType; + +typedef struct FilterBilateralSpec IppiFilterBilateralSpec; + +typedef enum { + ippDistNormL1 = 0x00000002 +} IppiDistanceMethodType; + +typedef enum { + ippResizeFilterHann, + ippResizeFilterLanczos +} IppiResizeFilterType; + +typedef struct ResizeFilterState IppiResizeFilterState; + +typedef struct { + Ipp32u borderLeft; + Ipp32u borderTop; + Ipp32u borderRight; + Ipp32u borderBottom; +} IppiBorderSize; + +typedef enum { + ippWarpForward, + ippWarpBackward, +} IppiWarpDirection; + +typedef enum { + ippWarpAffine, + ippWarpPerspective, + ippWarpBilinear, +} IppiWarpTransformType; + + +typedef struct ResizeSpec_32f IppiResizeSpec_32f; +typedef struct ResizeYUV422Spec IppiResizeYUV422Spec; +typedef struct ResizeYUV420Spec IppiResizeYUV420Spec; + +typedef struct ResizeSpec_64f IppiResizeSpec_64f; + +typedef struct IppiWarpSpec IppiWarpSpec; + +typedef struct FilterBorderSpec IppiFilterBorderSpec; + +typedef struct ThresholdAdaptiveSpec IppiThresholdAdaptiveSpec; + +typedef struct HistogramSpec IppiHistogramSpec; + +typedef struct { + int cvCompatible; /* openCV compatible output format */ + int cellSize; /* squre cell size (pixels) */ + int blockSize; /* square block size (pixels) */ + int blockStride; /* block displacement (the same for x- and y- directions) */ + int nbins; /* required number of bins */ + Ipp32f sigma; /* gaussian factor of HOG block weights */ + Ipp32f l2thresh; /* normalization factor */ + IppiSize winSize; /* detection window size (pixels) */ +} IppiHOGConfig; + +typedef struct FFT2DSpec_C_32fc IppiFFTSpec_C_32fc; +typedef struct FFT2DSpec_R_32f IppiFFTSpec_R_32f; + +typedef struct DFT2DSpec_C_32fc IppiDFTSpec_C_32fc; +typedef struct DFT2DSpec_R_32f IppiDFTSpec_R_32f; + +typedef struct DCT2DFwdSpec_32f IppiDCTFwdSpec_32f; +typedef struct DCT2DInvSpec_32f IppiDCTInvSpec_32f; + +typedef struct iWTFwdSpec_32f_C1R IppiWTFwdSpec_32f_C1R; +typedef struct iWTInvSpec_32f_C1R IppiWTInvSpec_32f_C1R; +typedef struct iWTFwdSpec_32f_C3R IppiWTFwdSpec_32f_C3R; +typedef struct iWTInvSpec_32f_C3R IppiWTInvSpec_32f_C3R; + +typedef struct MomentState64f IppiMomentState_64f; +typedef Ipp64f IppiHuMoment_64f[7]; + +typedef struct LUT_Spec IppiLUT_Spec; + +#define IPP_HOG_MAX_CELL (16) /* max size of CELL */ +#define IPP_HOG_MAX_BLOCK (64) /* max size of BLOCK */ +#define IPP_HOG_MAX_BINS (16) /* max number of BINS */ + +typedef struct _ipHOG IppiHOGSpec; + +#endif /* _OWN_BLDPCS */ + + + /**** Below are 3D Image (Volume) Processing specific definitions ****/ + +typedef struct { + int width; + int height; + int depth; +} IpprVolume; + +typedef struct { + int x; + int y; + int z; + int width; + int height; + int depth; +} IpprCuboid; + +typedef struct { + int x; + int y; + int z; +} IpprPoint; + +/*****************************************************************************/ +/* Below are ippCV domain specific definitions */ +/*****************************************************************************/ + +typedef enum _IppiDifferentialKernel +{ + ippFilterSobelVert, + ippFilterSobelHoriz, + ippFilterSobel, + ippFilterScharrVert, + ippFilterScharrHoriz, + ippFilterScharr, + ippFilterCentralDiffVert, + ippFilterCentralDiffHoriz, + ippFilterCentralDiff, +}IppiDifferentialKernel; + +#if !defined( _OWN_BLDPCS ) + +typedef enum _IppiKernelType { + ippKernelSobel = 0, + ippKernelScharr = 1, + ippKernelSobelNeg = 2 +} IppiKernelType; + +typedef enum _IppiNorm { + ippiNormInf = 0, + ippiNormL1 = 1, + ippiNormL2 = 2, + ippiNormFM = 3 +} IppiNorm; + +typedef struct ipcvMorphState IppiMorphState; +typedef struct ipcvMorphAdvState IppiMorphAdvState; +typedef struct ipcvMorphGrayState_8u IppiMorphGrayState_8u; +typedef struct ipcvMorphGrayState_32f IppiMorphGrayState_32f; + +typedef struct ipcvConvState IppiConvState; + +typedef struct _IppiConnectedComp { + Ipp64f area; /* area of the segmented component */ + Ipp64f value[3];/* gray scale value of the segmented component */ + IppiRect rect; /* bounding rectangle of the segmented component */ +} IppiConnectedComp; + +typedef struct PyramidState IppiPyramidState; + +typedef IppiPyramidState IppiPyramidDownState_8u_C1R; +typedef IppiPyramidState IppiPyramidDownState_16u_C1R; +typedef IppiPyramidState IppiPyramidDownState_32f_C1R; +typedef IppiPyramidState IppiPyramidDownState_8u_C3R; +typedef IppiPyramidState IppiPyramidDownState_16u_C3R; +typedef IppiPyramidState IppiPyramidDownState_32f_C3R; +typedef IppiPyramidState IppiPyramidUpState_8u_C1R; +typedef IppiPyramidState IppiPyramidUpState_16u_C1R; +typedef IppiPyramidState IppiPyramidUpState_32f_C1R; +typedef IppiPyramidState IppiPyramidUpState_8u_C3R; +typedef IppiPyramidState IppiPyramidUpState_16u_C3R; +typedef IppiPyramidState IppiPyramidUpState_32f_C3R; + + +typedef struct _IppiPyramid { + Ipp8u **pImage; + IppiSize *pRoi; + Ipp64f *pRate; + int *pStep; + Ipp8u *pState; + int level; +} IppiPyramid; + +typedef struct OptFlowPyrLK IppiOptFlowPyrLK; + +typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_8u_C1R; +typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_16u_C1R; +typedef IppiOptFlowPyrLK IppiOptFlowPyrLK_32f_C1R; + +typedef struct ipcvHaarClassifier_32f IppiHaarClassifier_32f; +typedef struct ipcvHaarClassifier_32s IppiHaarClassifier_32s; + +typedef struct ipcvFGHistogramState_8u_C1R IppFGHistogramState_8u_C1R; +typedef struct ipcvFGHistogramState_8u_C3R IppFGHistogramState_8u_C3R; + +typedef struct ipcvFGGaussianState_8u_C1R IppFGGaussianState_8u_C1R; +typedef struct ipcvFGGaussianState_8u_C3R IppFGGaussianState_8u_C3R; + +typedef enum _IppiInpaintFlag { + IPP_INPAINT_TELEA = 0, + IPP_INPAINT_NS = 1 +} IppiInpaintFlag; + +typedef struct ippcvFilterGaussianSpec IppFilterGaussianSpec; + +typedef struct ipcvInpaintState_8u IppiInpaintState_8u_C1R; +typedef struct ipcvInpaintState_8u IppiInpaintState_8u_C3R; + +typedef struct HoughProbSpec IppiHoughProbSpec; + +typedef struct FastNSpec IppiFastNSpec; + +typedef struct _IppiCornerFastN { + int x; + int y; + int cornerType; + int orientation; + float angle; + float score; +} IppiCornerFastN; + +typedef struct FGMMState_8u_C3R IppFGMMState_8u_C3R; + +typedef struct +{ + unsigned int numFrames; + unsigned int maxNGauss; + Ipp32f varInit; + Ipp32f varMin; + Ipp32f varMax; + Ipp32f varWBRatio; + Ipp32f bckgThr; + Ipp32f varNGRatio; + Ipp32f reduction; + Ipp8u shadowValue; + char shadowFlag; + Ipp32f shadowRatio; +} IppFGMModel; + +#endif /* _OWN_BLDPCS */ + +#define IPP_SEGMENT_QUEUE 0x01 +#define IPP_SEGMENT_DISTANCE 0x02 +#define IPP_SEGMENT_BORDER_4 0x40 +#define IPP_SEGMENT_BORDER_8 0x80 + +#define IPP_TRUNC(a,b) ((a)&~((b)-1)) +#define IPP_APPEND(a,b) (((a)+(b)-1)&~((b)-1)) + +/*****************************************************************************/ +/* Below are ippCC domain specific definitions */ +/*****************************************************************************/ +enum { + IPP_UPPER = 1, + IPP_LEFT = 2, + IPP_CENTER = 4, + IPP_RIGHT = 8, + IPP_LOWER = 16, + IPP_UPPER_LEFT = 32, + IPP_UPPER_RIGHT = 64, + IPP_LOWER_LEFT = 128, + IPP_LOWER_RIGHT = 256 +}; + +#if !defined( _OWN_BLDPCS ) + +typedef enum { + ippDitherNone, + ippDitherFS, + ippDitherJJN, + ippDitherStucki, + ippDitherBayer +} IppiDitherType; + +#endif /* _OWN_BLDPCS */ + +/*****************************************************************************/ +/* Below are ippCH domain specific definitions */ +/*****************************************************************************/ + +#if !defined( _OWN_BLDPCS ) + +typedef struct { + void *pFind; + int lenFind; +} IppRegExpFind; + +typedef struct RegExpState IppRegExpState; + +typedef enum { + ippFmtASCII = 0, + ippFmtUTF8 +} IppRegExpFormat; + +typedef struct RegExpReplaceState IppRegExpReplaceState; + +#endif /* _OWN_BLDPCS */ + +/*****************************************************************************/ +/* Below are ippDC domain specific definitions */ +/*****************************************************************************/ + +#if !defined ( _OWN_BLDPCS ) + +typedef struct MTFState_8u IppMTFState_8u; + +typedef enum { + ippBWTItohTanakaLimSort, + ippBWTItohTanakaUnlimSort, + ippBWTSuffixSort, + ippBWTAutoSort +} IppBWTSortAlgorithmHint; + +typedef struct LZSSState_8u IppLZSSState_8u; + +typedef struct LZ77State_8u IppLZ77State_8u; +typedef enum{ + IppLZ77FastCompr, + IppLZ77AverageCompr, + IppLZ77BestCompr +} IppLZ77ComprLevel; +typedef enum{ + IppLZ77NoChcksm, + IppLZ77Adler32, + IppLZ77CRC32 +} IppLZ77Chcksm; +typedef enum { + IppLZ77NoFlush, + IppLZ77SyncFlush, + IppLZ77FullFlush, + IppLZ77FinishFlush +} IppLZ77Flush; +typedef struct IppLZ77Pairs_16u { + Ipp16u length; + Ipp16u offset; +} IppLZ77Pair; +typedef enum { + IppLZ77StatusInit, + IppLZ77StatusLZ77Process, + IppLZ77StatusHuffProcess, + IppLZ77StatusFinal +} IppLZ77DeflateStatus; +typedef enum { + IppLZ77UseFixed, + IppLZ77UseDynamic, + IppLZ77UseStored +} IppLZ77HuffMode; +typedef enum { + IppLZ77InflateStatusInit, + IppLZ77InflateStatusHuffProcess, + IppLZ77InflateStatusLZ77Process, + IppLZ77InflateStatusFinal +} IppLZ77InflateStatus; + +typedef struct IppInflateState { + const Ipp8u* pWindow; /* pointer to the sliding window + (the dictionary for the LZ77 algorithm) */ + unsigned int winSize; /* size of the sliding window */ + unsigned int tableType; /* type of Huffman code tables + (for example, 0 - tables for Fixed Huffman codes) */ + unsigned int tableBufferSize; /* (ENOUGH = 2048) * (sizeof(code) = 4) - + sizeof(IppInflateState) */ +} IppInflateState; + +typedef enum { /* this type is used as a translator of the inflate_mode type from zlib */ + ippTYPE, + ippLEN, + ippLENEXT +} IppInflateMode; + +typedef struct { + Ipp16u freq; + Ipp16u code; +} IppDeflateFreqTable; + +typedef struct { + Ipp16u code; + Ipp16u len; +} IppDeflateHuffCode; + +typedef struct RLEState_BZ2 IppRLEState_BZ2; + +typedef struct EncodeHuffState_BZ2 IppEncodeHuffState_BZ2; + +typedef struct DecodeHuffState_BZ2 IppDecodeHuffState_BZ2; + +typedef enum { + IppLZO1XST, /* Single-threaded, generic LZO-compatible*/ + IppLZO1XMT /* Multi-threaded */ +} IppLZOMethod ; + +typedef struct LZOState_8u IppLZOState_8u; + +#endif /* _OWN_BLDPCS */ + +/* ///////////////////////////////////////////////////////////////////////////// +// The following enumerator defines a status of IPP operations +// negative value means error +*/ +typedef enum { + /* errors */ + ippStsNotSupportedModeErr = -9999,/* The requested mode is currently not supported. */ + ippStsCpuNotSupportedErr = -9998,/* The target CPU is not supported. */ + ippStsInplaceModeNotSupportedErr = -9997,/* The inplace operation is currently not supported. */ + + ippStsIIRIIRLengthErr = -234, /* Vector length for IIRIIR function is less than 3*(IIR order) */ + ippStsWarpTransformTypeErr = -233, /* The warp transform type is illegal */ + ippStsExceededSizeErr = -232, /* Requested size exceeded the maximum supported ROI size */ + ippStsWarpDirectionErr = -231, /* The warp transform direction is illegal */ + + ippStsFilterTypeErr = -230, /* The filter type is incorrect or not supported */ + + ippStsNormErr = -229, /* The norm is incorrect or not supported */ + + ippStsAlgTypeErr = -228, /* Algorithm type is not supported. */ + ippStsMisalignedOffsetErr = -227, /* The offset is not aligned with an element. */ + + ippStsQuadraticNonResidueErr = -226, /* SQRT operation on quadratic non-residue value. */ + + ippStsBorderErr = -225, /* Illegal value for border type.*/ + + ippStsDitherTypeErr = -224, /* Dithering type is not supported. */ + ippStsH264BufferFullErr = -223, /* Buffer for the output bitstream is full. */ + ippStsWrongAffinitySettingErr= -222, /* An affinity setting does not correspond to the affinity setting that was set by f.ippSetAffinity(). */ + ippStsLoadDynErr = -221, /* Error when loading the dynamic library. */ + + ippStsPointAtInfinity = -220, /* Point at infinity is detected. */ + + ippStsUnknownStatusCodeErr = -216, /* Unknown status code. */ + + ippStsOFBSizeErr = -215, /* Incorrect value for crypto OFB block size. */ + ippStsLzoBrokenStreamErr = -214, /* LZO safe decompression function cannot decode LZO stream. */ + + ippStsRoundModeNotSupportedErr = -213, /* Rounding mode is not supported. */ + ippStsDecimateFractionErr = -212, /* Fraction in Decimate is not supported. */ + ippStsWeightErr = -211, /* Incorrect value for weight. */ + + ippStsQualityIndexErr = -210, /* Cannot calculate the quality index for an image filled with a constant. */ + ippStsIIRPassbandRippleErr = -209, /* Ripple in passband for Chebyshev1 design is less than zero, equal to zero, or greater than 29. */ + ippStsFilterFrequencyErr = -208, /* Cutoff frequency of filter is less than zero, equal to zero, or greater than 0.5. */ + ippStsFIRGenOrderErr = -207, /* Order of the FIR filter for design is less than 1. */ + ippStsIIRGenOrderErr = -206, /* Order of the IIR filter for design is less than 1, or greater than 12. */ + + ippStsConvergeErr = -205, /* The algorithm does not converge. */ + ippStsSizeMatchMatrixErr = -204, /* The sizes of the source matrices are unsuitable. */ + ippStsCountMatrixErr = -203, /* Count value is less than, or equal to zero. */ + ippStsRoiShiftMatrixErr = -202, /* RoiShift value is negative or not divisible by the size of the data type. */ + + ippStsResizeNoOperationErr = -201, /* One of the output image dimensions is less than 1 pixel. */ + ippStsSrcDataErr = -200, /* The source buffer contains unsupported data. */ + ippStsMaxLenHuffCodeErr = -199, /* Huff: Max length of Huffman code is more than the expected one. */ + ippStsCodeLenTableErr = -198, /* Huff: Invalid codeLenTable. */ + ippStsFreqTableErr = -197, /* Huff: Invalid freqTable. */ + + ippStsIncompleteContextErr = -196, /* Crypto: set up of context is not complete. */ + + ippStsSingularErr = -195, /* Matrix is singular. */ + ippStsSparseErr = -194, /* Positions of taps are not in ascending order, or are negative, or repetitive. */ + ippStsBitOffsetErr = -193, /* Incorrect bit offset value. */ + ippStsQPErr = -192, /* Incorrect quantization parameter value. */ + ippStsVLCErr = -191, /* Illegal VLC or FLC is detected during stream decoding. */ + ippStsRegExpOptionsErr = -190, /* RegExp: Options for the pattern are incorrect. */ + ippStsRegExpErr = -189, /* RegExp: The structure pRegExpState contains incorrect data. */ + ippStsRegExpMatchLimitErr = -188, /* RegExp: The match limit is exhausted. */ + ippStsRegExpQuantifierErr = -187, /* RegExp: Incorrect quantifier. */ + ippStsRegExpGroupingErr = -186, /* RegExp: Incorrect grouping. */ + ippStsRegExpBackRefErr = -185, /* RegExp: Incorrect back reference. */ + ippStsRegExpChClassErr = -184, /* RegExp: Incorrect character class. */ + ippStsRegExpMetaChErr = -183, /* RegExp: Incorrect metacharacter. */ + ippStsStrideMatrixErr = -182, /* Stride value is not positive or not divisible by the size of the data type. */ + ippStsCTRSizeErr = -181, /* Incorrect value for crypto CTR block size. */ + ippStsJPEG2KCodeBlockIsNotAttached =-180, /* Codeblock parameters are not attached to the state structure. */ + ippStsNotPosDefErr = -179, /* Matrix is not positive definite. */ + + ippStsEphemeralKeyErr = -178, /* ECC: Invalid ephemeral key. */ + ippStsMessageErr = -177, /* ECC: Invalid message digest. */ + ippStsShareKeyErr = -176, /* ECC: Invalid share key. */ + ippStsIvalidPublicKey = -175, /* ECC: Invalid public key. */ + ippStsIvalidPrivateKey = -174, /* ECC: Invalid private key. */ + ippStsOutOfECErr = -173, /* ECC: Point out of EC. */ + ippStsECCInvalidFlagErr = -172, /* ECC: Invalid Flag. */ + + ippStsMP3FrameHeaderErr = -171, /* Error in fields of the IppMP3FrameHeader structure. */ + ippStsMP3SideInfoErr = -170, /* Error in fields of the IppMP3SideInfo structure. */ + + ippStsBlockStepErr = -169, /* Step for Block is less than 8. */ + ippStsMBStepErr = -168, /* Step for MB is less than 16. */ + + ippStsAacPrgNumErr = -167, /* AAC: Invalid number of elements for one program. */ + ippStsAacSectCbErr = -166, /* AAC: Invalid section codebook. */ + ippStsAacSfValErr = -164, /* AAC: Invalid scalefactor value. */ + ippStsAacCoefValErr = -163, /* AAC: Invalid quantized coefficient value. */ + ippStsAacMaxSfbErr = -162, /* AAC: Invalid coefficient index. */ + ippStsAacPredSfbErr = -161, /* AAC: Invalid predicted coefficient index. */ + ippStsAacPlsDataErr = -160, /* AAC: Invalid pulse data attributes. */ + ippStsAacGainCtrErr = -159, /* AAC: Gain control is not supported. */ + ippStsAacSectErr = -158, /* AAC: Invalid number of sections. */ + ippStsAacTnsNumFiltErr = -157, /* AAC: Invalid number of TNS filters. */ + ippStsAacTnsLenErr = -156, /* AAC: Invalid length of TNS region. */ + ippStsAacTnsOrderErr = -155, /* AAC: Invalid order of TNS filter. */ + ippStsAacTnsCoefResErr = -154, /* AAC: Invalid bit-resolution for TNS filter coefficients. */ + ippStsAacTnsCoefErr = -153, /* AAC: Invalid coefficients of TNS filter. */ + ippStsAacTnsDirectErr = -152, /* AAC: Invalid direction TNS filter. */ + ippStsAacTnsProfileErr = -151, /* AAC: Invalid TNS profile. */ + ippStsAacErr = -150, /* AAC: Internal error. */ + ippStsAacBitOffsetErr = -149, /* AAC: Invalid current bit offset in bitstream. */ + ippStsAacAdtsSyncWordErr = -148, /* AAC: Invalid ADTS syncword. */ + ippStsAacSmplRateIdxErr = -147, /* AAC: Invalid sample rate index. */ + ippStsAacWinLenErr = -146, /* AAC: Invalid window length (not short or long). */ + ippStsAacWinGrpErr = -145, /* AAC: Invalid number of groups for current window length. */ + ippStsAacWinSeqErr = -144, /* AAC: Invalid window sequence range. */ + ippStsAacComWinErr = -143, /* AAC: Invalid common window flag. */ + ippStsAacStereoMaskErr = -142, /* AAC: Invalid stereo mask. */ + ippStsAacChanErr = -141, /* AAC: Invalid channel number. */ + ippStsAacMonoStereoErr = -140, /* AAC: Invalid mono-stereo flag. */ + ippStsAacStereoLayerErr = -139, /* AAC: Invalid this Stereo Layer flag. */ + ippStsAacMonoLayerErr = -138, /* AAC: Invalid this Mono Layer flag. */ + ippStsAacScalableErr = -137, /* AAC: Invalid scalable object flag. */ + ippStsAacObjTypeErr = -136, /* AAC: Invalid audio object type. */ + ippStsAacWinShapeErr = -135, /* AAC: Invalid window shape. */ + ippStsAacPcmModeErr = -134, /* AAC: Invalid PCM output interleaving indicator. */ + ippStsVLCUsrTblHeaderErr = -133, /* VLC: Invalid header inside table. */ + ippStsVLCUsrTblUnsupportedFmtErr = -132, /* VLC: Table format is not supported. */ + ippStsVLCUsrTblEscAlgTypeErr = -131, /* VLC: Ecs-algorithm is not supported. */ + ippStsVLCUsrTblEscCodeLengthErr = -130, /* VLC: Esc-code length inside table header is incorrect. */ + ippStsVLCUsrTblCodeLengthErr = -129, /* VLC: Code length inside table is incorrect. */ + ippStsVLCInternalTblErr = -128, /* VLC: Invalid internal table. */ + ippStsVLCInputDataErr = -127, /* VLC: Invalid input data. */ + ippStsVLCAACEscCodeLengthErr = -126, /* VLC: Invalid AAC-Esc code length. */ + ippStsNoiseRangeErr = -125, /* Noise value for Wiener Filter is out of range. */ + ippStsUnderRunErr = -124, /* Error in data under run. */ + ippStsPaddingErr = -123, /* Detected padding error indicates the possible data corruption. */ + ippStsCFBSizeErr = -122, /* Incorrect value for crypto CFB block size. */ + ippStsPaddingSchemeErr = -121, /* Invalid padding scheme. */ + ippStsInvalidCryptoKeyErr = -120, /* A compromised key causes suspansion of the requested cryptographic operation. */ + ippStsLengthErr = -119, /* Incorrect value for string length. */ + ippStsBadModulusErr = -118, /* Bad modulus caused a failure in module inversion. */ + ippStsLPCCalcErr = -117, /* Cannot evaluate linear prediction. */ + ippStsRCCalcErr = -116, /* Cannot compute reflection coefficients. */ + ippStsIncorrectLSPErr = -115, /* Incorrect values for Linear Spectral Pair. */ + ippStsNoRootFoundErr = -114, /* No roots are found for equation. */ + ippStsJPEG2KBadPassNumber = -113, /* Pass number exceeds allowed boundaries [0,nOfPasses-1]. */ + ippStsJPEG2KDamagedCodeBlock= -112, /* Codeblock for decoding contains damaged data. */ + ippStsH263CBPYCodeErr = -111, /* Illegal Huffman code is detected through CBPY stream processing. */ + ippStsH263MCBPCInterCodeErr = -110, /* Illegal Huffman code is detected through MCBPC Inter stream processing. */ + ippStsH263MCBPCIntraCodeErr = -109, /* Illegal Huffman code is detected through MCBPC Intra stream processing. */ + ippStsNotEvenStepErr = -108, /* Step value is not pixel multiple. */ + ippStsHistoNofLevelsErr = -107, /* Number of levels for histogram is less than 2. */ + ippStsLUTNofLevelsErr = -106, /* Number of levels for LUT is less than 2. */ + ippStsMP4BitOffsetErr = -105, /* Incorrect bit offset value. */ + ippStsMP4QPErr = -104, /* Incorrect quantization parameter. */ + ippStsMP4BlockIdxErr = -103, /* Incorrect block index. */ + ippStsMP4BlockTypeErr = -102, /* Incorrect block type. */ + ippStsMP4MVCodeErr = -101, /* Illegal Huffman code is detected during MV stream processing. */ + ippStsMP4VLCCodeErr = -100, /* Illegal Huffman code is detected during VLC stream processing. */ + ippStsMP4DCCodeErr = -99, /* Illegal code is detected during DC stream processing. */ + ippStsMP4FcodeErr = -98, /* Incorrect fcode value. */ + ippStsMP4AlignErr = -97, /* Incorrect buffer alignment . */ + ippStsMP4TempDiffErr = -96, /* Incorrect temporal difference. */ + ippStsMP4BlockSizeErr = -95, /* Incorrect size of a block or macroblock. */ + ippStsMP4ZeroBABErr = -94, /* All BAB values are equal to zero. */ + ippStsMP4PredDirErr = -93, /* Incorrect prediction direction. */ + ippStsMP4BitsPerPixelErr = -92, /* Incorrect number of bits per pixel. */ + ippStsMP4VideoCompModeErr = -91, /* Incorrect video component mode. */ + ippStsMP4LinearModeErr = -90, /* Incorrect DC linear mode. */ + ippStsH263PredModeErr = -83, /* Incorrect Prediction Mode value. */ + ippStsH263BlockStepErr = -82, /* The step value is less than 8. */ + ippStsH263MBStepErr = -81, /* The step value is less than 16. */ + ippStsH263FrameWidthErr = -80, /* The frame width is less than 8. */ + ippStsH263FrameHeightErr = -79, /* The frame height is less than, or equal to zero. */ + ippStsH263ExpandPelsErr = -78, /* Expand pixels number is less than 8. */ + ippStsH263PlaneStepErr = -77, /* Step value is less than the plane width. */ + ippStsH263QuantErr = -76, /* Quantizer value is less than, or equal to zero, or greater than 31. */ + ippStsH263MVCodeErr = -75, /* Illegal Huffman code is detected during MV stream processing. */ + ippStsH263VLCCodeErr = -74, /* Illegal Huffman code is detected during VLC stream processing. */ + ippStsH263DCCodeErr = -73, /* Illegal code is detected during DC stream processing. */ + ippStsH263ZigzagLenErr = -72, /* Zigzag compact length is more than 64. */ + ippStsFBankFreqErr = -71, /* Incorrect value for the filter bank frequency parameter. */ + ippStsFBankFlagErr = -70, /* Incorrect value for the filter bank parameter. */ + ippStsFBankErr = -69, /* Filter bank is not correctly initialized. */ + ippStsNegOccErr = -67, /* Occupation count is negative. */ + ippStsCdbkFlagErr = -66, /* Incorrect value for the codebook flag parameter. */ + ippStsSVDCnvgErr = -65, /* SVD algorithm does not converge. */ + ippStsJPEGHuffTableErr = -64, /* JPEG Huffman table is destroyed. */ + ippStsJPEGDCTRangeErr = -63, /* JPEG DCT coefficient is out of range. */ + ippStsJPEGOutOfBufErr = -62, /* Attempt to access out of the buffer limits. */ + ippStsDrawTextErr = -61, /* System error in the draw text operation. */ + ippStsChannelOrderErr = -60, /* Incorrect order of the destination channels. */ + ippStsZeroMaskValuesErr = -59, /* All values of the mask are equal to zero. */ + ippStsQuadErr = -58, /* The quadrangle is nonconvex or degenerates into triangle, line, or point */ + ippStsRectErr = -57, /* Size of the rectangle region is less than, or equal to 1. */ + ippStsCoeffErr = -56, /* Incorrect values for transformation coefficients. */ + ippStsNoiseValErr = -55, /* Incorrect value for noise amplitude for dithering. */ + ippStsDitherLevelsErr = -54, /* Number of dithering levels is out of range. */ + ippStsNumChannelsErr = -53, /* Number of channels is incorrect, or not supported. */ + ippStsCOIErr = -52, /* COI is out of range. */ + ippStsDivisorErr = -51, /* Divisor is equal to zero, function is aborted. */ + ippStsAlphaTypeErr = -50, /* Illegal type of image compositing operation. */ + ippStsGammaRangeErr = -49, /* Gamma range bounds is less than, or equal to zero. */ + ippStsGrayCoefSumErr = -48, /* Sum of the conversion coefficients must be less than, or equal to 1. */ + ippStsChannelErr = -47, /* Illegal channel number. */ + ippStsToneMagnErr = -46, /* Tone magnitude is less than, or equal to zero. */ + ippStsToneFreqErr = -45, /* Tone frequency is negative, or greater than, or equal to 0.5. */ + ippStsTonePhaseErr = -44, /* Tone phase is negative, or greater than, or equal to 2*PI. */ + ippStsTrnglMagnErr = -43, /* Triangle magnitude is less than, or equal to zero. */ + ippStsTrnglFreqErr = -42, /* Triangle frequency is negative, or greater than, or equal to 0.5. */ + ippStsTrnglPhaseErr = -41, /* Triangle phase is negative, or greater than, or equal to 2*PI. */ + ippStsTrnglAsymErr = -40, /* Triangle asymmetry is less than -PI, or greater than, or equal to PI. */ + ippStsHugeWinErr = -39, /* Kaiser window is too big. */ + ippStsJaehneErr = -38, /* Magnitude value is negative. */ + ippStsStrideErr = -37, /* Stride value is less than the length of the row. */ + ippStsEpsValErr = -36, /* Negative epsilon value. */ + ippStsWtOffsetErr = -35, /* Invalid offset value for wavelet filter. */ + ippStsAnchorErr = -34, /* Anchor point is outside the mask. */ + ippStsMaskSizeErr = -33, /* Invalid mask size. */ + ippStsShiftErr = -32, /* Shift value is less than zero. */ + ippStsSampleFactorErr = -31, /* Sampling factor is less than, or equal to zero. */ + ippStsSamplePhaseErr = -30, /* Phase value is out of range: 0 <= phase < factor. */ + ippStsFIRMRFactorErr = -29, /* MR FIR sampling factor is less than, or equal to zero. */ + ippStsFIRMRPhaseErr = -28, /* MR FIR sampling phase is negative, or greater than, or equal to the sampling factor. */ + ippStsRelFreqErr = -27, /* Relative frequency value is out of range. */ + ippStsFIRLenErr = -26, /* Length of a FIR filter is less than, or equal to zero. */ + ippStsIIROrderErr = -25, /* Order of an IIR filter is not valid. */ + ippStsDlyLineIndexErr = -24, /* Invalid value for the delay line sample index. */ + ippStsResizeFactorErr = -23, /* Resize factor(s) is less than, or equal to zero. */ + ippStsInterpolationErr = -22, /* Invalid interpolation mode. */ + ippStsMirrorFlipErr = -21, /* Invalid flip mode. */ + ippStsMoment00ZeroErr = -20, /* Moment value M(0,0) is too small to continue calculations. */ + ippStsThreshNegLevelErr = -19, /* Negative value of the level in the threshold operation. */ + ippStsThresholdErr = -18, /* Invalid threshold bounds. */ + ippStsContextMatchErr = -17, /* Context parameter does not match the operation. */ + ippStsFftFlagErr = -16, /* Invalid value for the FFT flag parameter. */ + ippStsFftOrderErr = -15, /* Invalid value for the FFT order parameter. */ + ippStsStepErr = -14, /* Step value is not valid. */ + ippStsScaleRangeErr = -13, /* Scale bounds are out of range. */ + ippStsDataTypeErr = -12, /* Data type is incorrect or not supported. */ + ippStsOutOfRangeErr = -11, /* Argument is out of range, or point is outside the image. */ + ippStsDivByZeroErr = -10, /* An attempt to divide by zero. */ + ippStsMemAllocErr = -9, /* Memory allocated for the operation is not enough.*/ + ippStsNullPtrErr = -8, /* Null pointer error. */ + ippStsRangeErr = -7, /* Incorrect values for bounds: the lower bound is greater than the upper bound. */ + ippStsSizeErr = -6, /* Incorrect value for data size. */ + ippStsBadArgErr = -5, /* Incorrect arg/param of the function. */ + ippStsNoMemErr = -4, /* Not enough memory for the operation. */ + ippStsSAReservedErr3 = -3, /* Unknown/unspecified error, -3. */ + ippStsErr = -2, /* Unknown/unspecified error, -2. */ + ippStsSAReservedErr1 = -1, /* Unknown/unspecified error, -1. */ + + /* no errors */ + ippStsNoErr = 0, /* No errors. */ + + /* warnings */ + ippStsNoOperation = 1, /* No operation has been executed. */ + ippStsMisalignedBuf = 2, /* Misaligned pointer in operation in which it must be aligned. */ + ippStsSqrtNegArg = 3, /* Negative value(s) for the argument in the Sqrt function. */ + ippStsInvZero = 4, /* INF result. Zero value was met by InvThresh with zero level. */ + ippStsEvenMedianMaskSize= 5, /* Even size of the Median Filter mask was replaced with the odd one. */ + ippStsDivByZero = 6, /* Zero value(s) for the divisor in the Div function. */ + ippStsLnZeroArg = 7, /* Zero value(s) for the argument in the Ln function. */ + ippStsLnNegArg = 8, /* Negative value(s) for the argument in the Ln function. */ + ippStsNanArg = 9, /* Argument value is not a number. */ + ippStsJPEGMarker = 10, /* JPEG marker in the bitstream. */ + ippStsResFloor = 11, /* All result values are floored. */ + ippStsOverflow = 12, /* Overflow in the operation. */ + ippStsLSFLow = 13, /* Quantized LP synthesis filter stability check is applied at the low boundary of [0,pi]. */ + ippStsLSFHigh = 14, /* Quantized LP synthesis filter stability check is applied at the high boundary of [0,pi]. */ + ippStsLSFLowAndHigh = 15, /* Quantized LP synthesis filter stability check is applied at both boundaries of [0,pi]. */ + ippStsZeroOcc = 16, /* Zero occupation count. */ + ippStsUnderflow = 17, /* Underflow in the operation. */ + ippStsSingularity = 18, /* Singularity in the operation. */ + ippStsDomain = 19, /* Argument is out of the function domain. */ + ippStsNonIntelCpu = 20, /* The target CPU is not Genuine Intel. */ + ippStsCpuMismatch = 21, /* Cannot set the library for the given CPU. */ + ippStsNoIppFunctionFound = 22, /* Application does not contain Intel IPP function calls. */ + ippStsDllNotFoundBestUsed = 23, /* Dispatcher cannot find the newest version of the Intel IPP dll. */ + ippStsNoOperationInDll = 24, /* The function does nothing in the dynamic version of the library. */ + ippStsInsufficientEntropy= 25, /* Generation of the prime/key failed due to insufficient entropy in the random seed and stimulus bit string. */ + ippStsOvermuchStrings = 26, /* Number of destination strings is more than expected. */ + ippStsOverlongString = 27, /* Length of one of the destination strings is more than expected. */ + ippStsAffineQuadChanged = 28, /* 4th vertex of destination quad is not equal to customer's one. */ + ippStsWrongIntersectROI = 29, /* ROI has no intersection with the source or destination ROI. No operation. */ + ippStsWrongIntersectQuad = 30, /* Quadrangle has no intersection with the source or destination ROI. No operation. */ + ippStsSmallerCodebook = 31, /* Size of created codebook is less than the cdbkSize argument. */ + ippStsSrcSizeLessExpected = 32, /* DC: Size of the source buffer is less than the expected one. */ + ippStsDstSizeLessExpected = 33, /* DC: Size of the destination buffer is less than the expected one. */ + ippStsStreamEnd = 34, /* DC: The end of stream processed. */ + ippStsDoubleSize = 35, /* Width or height of image is odd. */ + ippStsNotSupportedCpu = 36, /* The CPU is not supported. */ + ippStsUnknownCacheSize = 37, /* The CPU is supported, but the size of the cache is unknown. */ + ippStsSymKernelExpected = 38, /* The Kernel is not symmetric. */ + ippStsEvenMedianWeight = 39, /* Even weight of the Weighted Median Filter is replaced with the odd one. */ + ippStsWrongIntersectVOI = 40, /* VOI has no intersection with the source or destination volume. No operation. */ + ippStsI18nMsgCatalogInvalid=41, /* Message Catalog is invalid, English message returned. */ + ippStsI18nGetMessageFail = 42, /* Failed to fetch a localized message, English message returned. For more information use errno on Linux* OS and GetLastError on Windows* OS. */ + ippStsWaterfall = 43, /* Cannot load required library, waterfall is used. */ + ippStsPrevLibraryUsed = 44, /* Cannot load required library, previous dynamic library is used. */ + ippStsLLADisabled = 45, /* OpenMP* Low Level Affinity is disabled. */ + ippStsNoAntialiasing = 46, /* The mode does not support antialiasing. */ + ippStsRepetitiveSrcData = 47, /* DC: The source data is too repetitive. */ + ippStsSizeWrn = 48, /* The size does not allow to perform full operation. */ + ippStsFeatureNotSupported = 49, /* Current CPU doesn't support at least 1 of the desired features. */ + ippStsUnknownFeature = 50, /* At least one of the desired features is unknown. */ + ippStsFeaturesCombination = 51, /* Wrong combination of features. */ + ippStsAccurateModeNotSupported = 52 /* Accurate mode is not supported. */ +} IppStatus; + +#define ippStsOk ippStsNoErr + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __IPPTYPES_H__ */ diff --git a/external/crypto_px/include/ippversion.h b/external/crypto_px/include/ippversion.h index 66dcd6b216..478ac0b0cf 100755 --- a/external/crypto_px/include/ippversion.h +++ b/external/crypto_px/include/ippversion.h @@ -1,41 +1,41 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined( __IPPVERSION_H__ ) -#define __IPPVERSION_H__ - -#define IPP_VERSION_MAJOR 9 -#define IPP_VERSION_MINOR 0 -#define IPP_VERSION_UPDATE 2 - -#define IPP_VERSION_STR "9.0.2" - -#endif /* __IPPVERSION_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined( __IPPVERSION_H__ ) +#define __IPPVERSION_H__ + +#define IPP_VERSION_MAJOR 9 +#define IPP_VERSION_MINOR 0 +#define IPP_VERSION_UPDATE 2 + +#define IPP_VERSION_STR "9.0.2" + +#endif /* __IPPVERSION_H__ */ diff --git a/external/crypto_px/sources/include/cpudef.h b/external/crypto_px/sources/include/cpudef.h index 2bdd6eff07..3d9cde6c64 100644 --- a/external/crypto_px/sources/include/cpudef.h +++ b/external/crypto_px/sources/include/cpudef.h @@ -1,264 +1,264 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __CPUDEF_H__ -#define __CPUDEF_H__ - -#include "ippcore.h" - -#if defined( __cplusplus ) -extern "C" { -#endif - -#undef __CDECL -#if defined( _WIN32 ) || defined ( _WIN64 ) - #define __CDECL __cdecl -#else - #define __CDECL -#endif - - -/* Intel CPU informator */ - -typedef struct { - int family; - int stepping; - int model; - int type; - int feature; - int tlb; - int cache; - int mmx; - int freq; - int ssx; - int wni; - int htt; - int pni; - int em64t; - int mni; - int phcores; - int sse41; - int sse42; - int ext_family; - int ext_model; - int movbe_instr; - int avx; - int xsavexgetbv; -} ippIntelCpuId; - -int __CDECL ownGetMaskFeatures( Ipp64u* pFeaturesMask ); -int __CDECL ownGetFeature( Ipp64u MaskOfFeature ); -int __CDECL ipp_is_avx_extension( void ); - -__INT64 __CDECL ipp_get_pentium_counter (void); -int __CDECL ipp_is_mmx_extension (void); -int __CDECL ipp_is_ssx_extension (void); -int __CDECL ipp_is_wni_extension (void); -int __CDECL ipp_is_htt_extension( void ); -int __CDECL ipp_is_pni_extension( void ); -int __CDECL ipp_is_mni_extension( void ); -int __CDECL ipp_is_sse41_extension( void ); -int __CDECL ipp_is_sse42_extension( void ); -int __CDECL ipp_is_movbe( void ); -int __CDECL ipp_get_cores_on_die( void ); -int __CDECL ipp_is_em64t_extension( void ); -int __CDECL ipp_has_cpuid ( void ); -int __CDECL ipp_has_rdtsc( void ); - -void __CDECL ipp_get_pentium_ident ( ippIntelCpuId* cpuid ); -int __CDECL ipp_is_GenuineIntel ( void ); -int __CDECL ipp_max_cpuid_input( void ); -int __CDECL ipp_get_cpuid( int regs[4], int valEAX, int valECX ); -void __CDECL ipp_get_cache_line_size( int* szCacheLine ); - -int __CDECL ipp_isnan( double x ); -int __CDECL ipp_finite( double x ); -int __CDECL ipp_isnan_32f( float x ); -int __CDECL ipp_finite_32f( float x ); -#define ipp_isfinite ipp_finite - -unsigned int __CDECL ipp_control87 ( unsigned int newcw, unsigned int mask ); -unsigned int __CDECL ipp_status87 ( void ); -unsigned int __CDECL ipp_clear87 ( void ); - -unsigned int __CDECL ipp_clear_ssx (void); -/* topology/affinity */ - -/* here are definitions of the CW bits exactly as x87 and ssx have */ - -#define IPP_FPU_MASK_RC 0x0c00 -#define IPP_FPU_MASK_PC 0x0300 -#define IPP_FPU_MASK_RCPC 0x0f00 - -#define IPP_FPU_RC_NEAR 0x0000 -#define IPP_FPU_RC_DOWN 0x0400 -#define IPP_FPU_RC_UP 0x0800 -#define IPP_FPU_RC_ZERO 0x0c00 - -#define IPP_FPU_PC_24 0x0000 -#define IPP_FPU_PC_53 0x0200 -#define IPP_FPU_PC_64 0x0300 - - -unsigned int __CDECL ipp_set_rcpc_fpu( unsigned int newrcpc, unsigned int mask); -void __CDECL ipp_set_cw_fpu( unsigned int cw ); - -#define IPP_SSX_RC_NEAR 0x0000 -#define IPP_SSX_RC_DOWN 0x2000 -#define IPP_SSX_RC_UP 0x4000 -#define IPP_SSX_RC_ZERO 0x6000 -#define IPP_SSX_MASK_RC 0x6000 - - -unsigned int __CDECL ipp_set_rc_ssx( unsigned int newrc ); -void __CDECL ipp_set_cw_ssx( unsigned int cw ); - -/* ================= FPU section ===================== */ - -/* Control bits - disable exceptions */ -#define FPU_EXC_MSK 0x003f /* Exception Masks Mask */ -#define FPU_MSK_INVALID 0x0001 /* invalid operation */ -#define FPU_MSK_DENORMAL 0x0002 /* denormalized operand */ -#define FPU_MSK_ZERODIV 0x0004 /* zero divide */ -#define FPU_MSK_OVERFLOW 0x0008 /* overflow */ -#define FPU_MSK_UNDERFLOW 0x0010 /* underflow */ -#define FPU_MSK_INEXACT 0x0020 /* inexact (precision) */ - -/* Status bits - exceptions */ -#define FPU_EXC_FLG 0x003f /* Exception Flags Mask */ -#define FPU_FLG_INVALID 0x0001 /* invalid operation */ -#define FPU_FLG_DENORMAL 0x0002 /* denormalized operand */ -#define FPU_FLG_ZERODIV 0x0004 /* zero divide */ -#define FPU_FLG_OVERFLOW 0x0008 /* overflow */ -#define FPU_FLG_UNDERFLOW 0x0010 /* underflow */ -#define FPU_FLG_INEXACT 0x0020 /* inexact (precision) */ - -/* Control bits - rounding control */ -#define FPU_RND 0x0c00 /* Rounding Control Mask */ -#define FPU_RND_NEAR 0x0000 /* near */ -#define FPU_RND_DOWN 0x0400 /* down */ -#define FPU_RND_UP 0x0800 /* up */ -#define FPU_RND_CHOP 0x0c00 /* chop */ - -/* Control bits - precision control */ -#define FPU_PRC 0x0300 /* Precision Control Mask */ -#define FPU_PRC_64 0x0300 /* 64 bits */ -#define FPU_PRC_53 0x0200 /* 53 bits */ -#define FPU_PRC_24 0x0000 /* 24 bits */ - -/* Control bits - all masks */ -#define FPU_ALL 0x0f3f /* all masks */ - -/* ============= definition for control/status world ============== */ - -#define FPU_SET_EXC_MASK(mask) ps_set_cw_fpu(mask,FPU_EXC_MSK) -#define FPU_GET_EXC_MASK() (ps_set_cw_fpu(0,0) & FPU_EXC_MSK) - -#define FPU_GET_EXC_FLAG() (ps_get_sw_fpu() & FPU_EXC_FLG) - -#define FPU_SET_RND_MODE(mode) ps_set_cw_fpu(mode,FPU_RND) -#define FPU_GET_RND_MODE() (ps_set_cw_fpu(0,0) & FPU_RND) - -#define FPU_SET_PRC_MODE(mode) ps_set_cw_fpu(mode,FPU_PRC) -#define FPU_GET_PRC_MODE() (ps_set_cw_fpu(0,0) & FPU_PRC) - -unsigned int __CDECL ps_set_cw_fpu( unsigned int newcw, unsigned int msk); -unsigned int __CDECL ps_get_cw_fpu(void); -unsigned int __CDECL ps_get_sw_fpu(void); -unsigned int __CDECL ps_clear_fpu(void); - -/* ======================= SSX section ============================ */ - -/* Control bits - disable exceptions */ -#define SSX_EXC_MSK 0x1f80 /* Disabling exception mask */ -#define SSX_MSK_INEXACT 0x1000 /* precision (inexact) */ -#define SSX_MSK_UNDERFLOW 0x0800 /* underflow */ -#define SSX_MSK_OVERFLOW 0x0400 /* overflow */ -#define SSX_MSK_ZERODIV 0x0200 /* divide by zero */ -#define SSX_MSK_DENORMAL 0x0100 /* denormalized */ -#define SSX_MSK_INVALID 0x0080 /* invalid operation */ - -/* Status bits - exceptions */ -#define SSX_EXC_FLG 0x003f /* Exception flags mask */ -#define SSX_FLG_INEXACT 0x0020 /* precision (inexact) */ -#define SSX_FLG_UNDERFLOW 0x0010 /* underflow */ -#define SSX_FLG_OVERFLOW 0x0008 /* overflow */ -#define SSX_FLG_ZERODIV 0x0004 /* divide by zero */ -#define SSX_FLG_DENORMAL 0x0002 /* denormalized */ -#define SSX_FLG_INVALID 0x0001 /* invalid operation */ - -/* Control bits - rounding control */ -#define SSX_RND 0x6000 /* Rounding control mask */ -#define SSX_RND_NEAR 0x0000 /* near */ -#define SSX_RND_DOWN 0x2000 /* down */ -#define SSX_RND_UP 0x4000 /* up */ -#define SSX_RND_CHOP 0x6000 /* chop */ - -/* Control bits - flush to zero mode */ -#define SSX_FZ 0x8000 /* Flush to zero mask */ -#define SSX_FZ_ENABLE 0x8000 /* flush to zero */ -#define SSX_FZ_DISABLE 0x0000 /* not flush to zero */ - -/* Control bits - denormals are zero mode */ -#define SSX_DAZ 0x0040 /* denorm. are zero mask */ -#define SSX_DAZ_ENABLE 0x0040 /* denorm. are zero */ -#define SSX_DAZ_DISABLE 0x0000 /* denorm. are not zero */ - -#define SSX_ALL 0xffbf /* All masks */ - -/* ==================== definition for SSX register =============== */ - -#define SSX_SET_EXC_MASK(mask) ps_set_ssx(mask,SSX_EXC_MSK) -#define SSX_GET_EXC_MASK() (ps_get_ssx() & SSX_EXC_MSK) - -#define SSX_SET_EXC_FLAG(flag) ps_set_ssx(flag,SSX_EXC_FLG) -#define SSX_GET_EXC_FLAG() (ps_get_ssx() & SSX_EXC_FLG) - -#define SSX_SET_RND_MODE(mode) ps_set_ssx(mode,SSX_RND) -#define SSX_GET_RND_MODE() (ps_get_ssx() & SSX_RND) - -#define SSX_SET_FZ_MODE(mode) ps_set_ssx(mode,SSX_FZ) -#define SSX_GET_FZ_MODE() (ps_get_ssx() & SSX_FZ) - -#define SSX_SET_DAZ_MODE(mode) ps_set_ssx(mode,SSX_DAZ) -#define SSX_GET_DAZ_MODE() (ps_get_ssx() & SSX_DAZ) - -unsigned int __CDECL ps_set_ssx(unsigned int newssx, unsigned int msk); -unsigned int __CDECL ps_get_ssx(void); -unsigned int __CDECL ipp_tst_daz_ssx(void); - -#if defined( __cplusplus ) -} -#endif - -#endif /* __CPUDEF_H__ */ - -/* ////////////////////////// End of file "cpudef.h" //////////////////////// */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __CPUDEF_H__ +#define __CPUDEF_H__ + +#include "ippcore.h" + +#if defined( __cplusplus ) +extern "C" { +#endif + +#undef __CDECL +#if defined( _WIN32 ) || defined ( _WIN64 ) + #define __CDECL __cdecl +#else + #define __CDECL +#endif + + +/* Intel CPU informator */ + +typedef struct { + int family; + int stepping; + int model; + int type; + int feature; + int tlb; + int cache; + int mmx; + int freq; + int ssx; + int wni; + int htt; + int pni; + int em64t; + int mni; + int phcores; + int sse41; + int sse42; + int ext_family; + int ext_model; + int movbe_instr; + int avx; + int xsavexgetbv; +} ippIntelCpuId; + +int __CDECL ownGetMaskFeatures( Ipp64u* pFeaturesMask ); +int __CDECL ownGetFeature( Ipp64u MaskOfFeature ); +int __CDECL ipp_is_avx_extension( void ); + +__INT64 __CDECL ipp_get_pentium_counter (void); +int __CDECL ipp_is_mmx_extension (void); +int __CDECL ipp_is_ssx_extension (void); +int __CDECL ipp_is_wni_extension (void); +int __CDECL ipp_is_htt_extension( void ); +int __CDECL ipp_is_pni_extension( void ); +int __CDECL ipp_is_mni_extension( void ); +int __CDECL ipp_is_sse41_extension( void ); +int __CDECL ipp_is_sse42_extension( void ); +int __CDECL ipp_is_movbe( void ); +int __CDECL ipp_get_cores_on_die( void ); +int __CDECL ipp_is_em64t_extension( void ); +int __CDECL ipp_has_cpuid ( void ); +int __CDECL ipp_has_rdtsc( void ); + +void __CDECL ipp_get_pentium_ident ( ippIntelCpuId* cpuid ); +int __CDECL ipp_is_GenuineIntel ( void ); +int __CDECL ipp_max_cpuid_input( void ); +int __CDECL ipp_get_cpuid( int regs[4], int valEAX, int valECX ); +void __CDECL ipp_get_cache_line_size( int* szCacheLine ); + +int __CDECL ipp_isnan( double x ); +int __CDECL ipp_finite( double x ); +int __CDECL ipp_isnan_32f( float x ); +int __CDECL ipp_finite_32f( float x ); +#define ipp_isfinite ipp_finite + +unsigned int __CDECL ipp_control87 ( unsigned int newcw, unsigned int mask ); +unsigned int __CDECL ipp_status87 ( void ); +unsigned int __CDECL ipp_clear87 ( void ); + +unsigned int __CDECL ipp_clear_ssx (void); +/* topology/affinity */ + +/* here are definitions of the CW bits exactly as x87 and ssx have */ + +#define IPP_FPU_MASK_RC 0x0c00 +#define IPP_FPU_MASK_PC 0x0300 +#define IPP_FPU_MASK_RCPC 0x0f00 + +#define IPP_FPU_RC_NEAR 0x0000 +#define IPP_FPU_RC_DOWN 0x0400 +#define IPP_FPU_RC_UP 0x0800 +#define IPP_FPU_RC_ZERO 0x0c00 + +#define IPP_FPU_PC_24 0x0000 +#define IPP_FPU_PC_53 0x0200 +#define IPP_FPU_PC_64 0x0300 + + +unsigned int __CDECL ipp_set_rcpc_fpu( unsigned int newrcpc, unsigned int mask); +void __CDECL ipp_set_cw_fpu( unsigned int cw ); + +#define IPP_SSX_RC_NEAR 0x0000 +#define IPP_SSX_RC_DOWN 0x2000 +#define IPP_SSX_RC_UP 0x4000 +#define IPP_SSX_RC_ZERO 0x6000 +#define IPP_SSX_MASK_RC 0x6000 + + +unsigned int __CDECL ipp_set_rc_ssx( unsigned int newrc ); +void __CDECL ipp_set_cw_ssx( unsigned int cw ); + +/* ================= FPU section ===================== */ + +/* Control bits - disable exceptions */ +#define FPU_EXC_MSK 0x003f /* Exception Masks Mask */ +#define FPU_MSK_INVALID 0x0001 /* invalid operation */ +#define FPU_MSK_DENORMAL 0x0002 /* denormalized operand */ +#define FPU_MSK_ZERODIV 0x0004 /* zero divide */ +#define FPU_MSK_OVERFLOW 0x0008 /* overflow */ +#define FPU_MSK_UNDERFLOW 0x0010 /* underflow */ +#define FPU_MSK_INEXACT 0x0020 /* inexact (precision) */ + +/* Status bits - exceptions */ +#define FPU_EXC_FLG 0x003f /* Exception Flags Mask */ +#define FPU_FLG_INVALID 0x0001 /* invalid operation */ +#define FPU_FLG_DENORMAL 0x0002 /* denormalized operand */ +#define FPU_FLG_ZERODIV 0x0004 /* zero divide */ +#define FPU_FLG_OVERFLOW 0x0008 /* overflow */ +#define FPU_FLG_UNDERFLOW 0x0010 /* underflow */ +#define FPU_FLG_INEXACT 0x0020 /* inexact (precision) */ + +/* Control bits - rounding control */ +#define FPU_RND 0x0c00 /* Rounding Control Mask */ +#define FPU_RND_NEAR 0x0000 /* near */ +#define FPU_RND_DOWN 0x0400 /* down */ +#define FPU_RND_UP 0x0800 /* up */ +#define FPU_RND_CHOP 0x0c00 /* chop */ + +/* Control bits - precision control */ +#define FPU_PRC 0x0300 /* Precision Control Mask */ +#define FPU_PRC_64 0x0300 /* 64 bits */ +#define FPU_PRC_53 0x0200 /* 53 bits */ +#define FPU_PRC_24 0x0000 /* 24 bits */ + +/* Control bits - all masks */ +#define FPU_ALL 0x0f3f /* all masks */ + +/* ============= definition for control/status world ============== */ + +#define FPU_SET_EXC_MASK(mask) ps_set_cw_fpu(mask,FPU_EXC_MSK) +#define FPU_GET_EXC_MASK() (ps_set_cw_fpu(0,0) & FPU_EXC_MSK) + +#define FPU_GET_EXC_FLAG() (ps_get_sw_fpu() & FPU_EXC_FLG) + +#define FPU_SET_RND_MODE(mode) ps_set_cw_fpu(mode,FPU_RND) +#define FPU_GET_RND_MODE() (ps_set_cw_fpu(0,0) & FPU_RND) + +#define FPU_SET_PRC_MODE(mode) ps_set_cw_fpu(mode,FPU_PRC) +#define FPU_GET_PRC_MODE() (ps_set_cw_fpu(0,0) & FPU_PRC) + +unsigned int __CDECL ps_set_cw_fpu( unsigned int newcw, unsigned int msk); +unsigned int __CDECL ps_get_cw_fpu(void); +unsigned int __CDECL ps_get_sw_fpu(void); +unsigned int __CDECL ps_clear_fpu(void); + +/* ======================= SSX section ============================ */ + +/* Control bits - disable exceptions */ +#define SSX_EXC_MSK 0x1f80 /* Disabling exception mask */ +#define SSX_MSK_INEXACT 0x1000 /* precision (inexact) */ +#define SSX_MSK_UNDERFLOW 0x0800 /* underflow */ +#define SSX_MSK_OVERFLOW 0x0400 /* overflow */ +#define SSX_MSK_ZERODIV 0x0200 /* divide by zero */ +#define SSX_MSK_DENORMAL 0x0100 /* denormalized */ +#define SSX_MSK_INVALID 0x0080 /* invalid operation */ + +/* Status bits - exceptions */ +#define SSX_EXC_FLG 0x003f /* Exception flags mask */ +#define SSX_FLG_INEXACT 0x0020 /* precision (inexact) */ +#define SSX_FLG_UNDERFLOW 0x0010 /* underflow */ +#define SSX_FLG_OVERFLOW 0x0008 /* overflow */ +#define SSX_FLG_ZERODIV 0x0004 /* divide by zero */ +#define SSX_FLG_DENORMAL 0x0002 /* denormalized */ +#define SSX_FLG_INVALID 0x0001 /* invalid operation */ + +/* Control bits - rounding control */ +#define SSX_RND 0x6000 /* Rounding control mask */ +#define SSX_RND_NEAR 0x0000 /* near */ +#define SSX_RND_DOWN 0x2000 /* down */ +#define SSX_RND_UP 0x4000 /* up */ +#define SSX_RND_CHOP 0x6000 /* chop */ + +/* Control bits - flush to zero mode */ +#define SSX_FZ 0x8000 /* Flush to zero mask */ +#define SSX_FZ_ENABLE 0x8000 /* flush to zero */ +#define SSX_FZ_DISABLE 0x0000 /* not flush to zero */ + +/* Control bits - denormals are zero mode */ +#define SSX_DAZ 0x0040 /* denorm. are zero mask */ +#define SSX_DAZ_ENABLE 0x0040 /* denorm. are zero */ +#define SSX_DAZ_DISABLE 0x0000 /* denorm. are not zero */ + +#define SSX_ALL 0xffbf /* All masks */ + +/* ==================== definition for SSX register =============== */ + +#define SSX_SET_EXC_MASK(mask) ps_set_ssx(mask,SSX_EXC_MSK) +#define SSX_GET_EXC_MASK() (ps_get_ssx() & SSX_EXC_MSK) + +#define SSX_SET_EXC_FLAG(flag) ps_set_ssx(flag,SSX_EXC_FLG) +#define SSX_GET_EXC_FLAG() (ps_get_ssx() & SSX_EXC_FLG) + +#define SSX_SET_RND_MODE(mode) ps_set_ssx(mode,SSX_RND) +#define SSX_GET_RND_MODE() (ps_get_ssx() & SSX_RND) + +#define SSX_SET_FZ_MODE(mode) ps_set_ssx(mode,SSX_FZ) +#define SSX_GET_FZ_MODE() (ps_get_ssx() & SSX_FZ) + +#define SSX_SET_DAZ_MODE(mode) ps_set_ssx(mode,SSX_DAZ) +#define SSX_GET_DAZ_MODE() (ps_get_ssx() & SSX_DAZ) + +unsigned int __CDECL ps_set_ssx(unsigned int newssx, unsigned int msk); +unsigned int __CDECL ps_get_ssx(void); +unsigned int __CDECL ipp_tst_daz_ssx(void); + +#if defined( __cplusplus ) +} +#endif + +#endif /* __CPUDEF_H__ */ + +/* ////////////////////////// End of file "cpudef.h" //////////////////////// */ diff --git a/external/crypto_px/sources/include/ippver.h b/external/crypto_px/sources/include/ippver.h index f72232a335..ef6868a967 100644 --- a/external/crypto_px/sources/include/ippver.h +++ b/external/crypto_px/sources/include/ippver.h @@ -1,46 +1,46 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "ippversion.h" -#ifndef BASE_VERSION -#define BASE_VERSION() IPP_VERSION_MAJOR,IPP_VERSION_MINOR,IPP_VERSION_UPDATE -#endif - -#ifndef STR_VERSION - #ifdef IPP_REVISION - #define STR_VERSION() IPP_VERSION_STR " (r" STR( IPP_REVISION ) ")" - #else - #define STR_VERSION() IPP_VERSION_STR " (-)" - #endif -#endif - - -/* ////////////////////////////// End of file /////////////////////////////// */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "ippversion.h" +#ifndef BASE_VERSION +#define BASE_VERSION() IPP_VERSION_MAJOR,IPP_VERSION_MINOR,IPP_VERSION_UPDATE +#endif + +#ifndef STR_VERSION + #ifdef IPP_REVISION + #define STR_VERSION() IPP_VERSION_STR " (r" STR( IPP_REVISION ) ")" + #else + #define STR_VERSION() IPP_VERSION_STR " (-)" + #endif +#endif + + +/* ////////////////////////////// End of file /////////////////////////////// */ diff --git a/external/crypto_px/sources/include/owndefs.h b/external/crypto_px/sources/include/owndefs.h index 9757893d4e..6d9b386375 100644 --- a/external/crypto_px/sources/include/owndefs.h +++ b/external/crypto_px/sources/include/owndefs.h @@ -1,944 +1,944 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __OWNDEFS_H__ -#define __OWNDEFS_H__ - -#if defined( _VXWORKS ) - #include - #undef NONE -#endif - -#include "ippdefs.h" - -#if defined(__INTEL_COMPILER) || defined(_MSC_VER) - #define __INLINE static __inline -#elif defined( __GNUC__ ) - #define __INLINE static __inline__ -#else - #define __INLINE static -#endif - -#if defined(__INTEL_COMPILER) - #define __RESTRICT restrict -#elif !defined( __RESTRICT ) - #define __RESTRICT -#endif - -#if defined( IPP_W32DLL ) - #if defined( _MSC_VER ) || defined( __INTEL_COMPILER ) - #define IPPFUN(type,name,arg) __declspec(dllexport) type __STDCALL name arg - #else - #define IPPFUN(type,name,arg) extern type __STDCALL name arg - #endif -#else - #define IPPFUN(type,name,arg) extern type __STDCALL name arg -#endif - - -/* structure represeting 128 bit unsigned integer type */ - -typedef struct{ - Ipp64u low; - Ipp64u high; -}Ipp128u; - -#define _IPP_PX 0 /* pure C-code ia32 */ -#define _IPP_M5 1 /* Quark (Pentium) - x86+x87 ia32 */ -#define _IPP_M6 2 /* Pentium MMX - MMX ia32 */ -#define _IPP_A6 4 /* Pentium III - SSE ia32 */ -#define _IPP_W7 8 /* Pentium 4 - SSE2 ia32 */ -#define _IPP_T7 16 /* Pentium with x64 support (Nocona) - SSE3 ia32 */ -#define _IPP_V8 32 /* Merom - SSSE3 ia32 */ -#define _IPP_P8 64 /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */ -#define _IPP_G9 128 /* SandyBridge (GSSE) - AVX ia32 */ -#define _IPP_H9 256 /* Haswell (AVX2) ia32 */ -#define _IPP_I0 512 /* KNL (AVX-512) ia32 */ -#define _IPP_S0 1024 /* SkyLake Xeon (AVX-512) ia32 */ - -#define _IPPXSC_PX 0 -#define _IPPXSC_S1 1 -#define _IPPXSC_S2 2 -#define _IPPXSC_C2 4 - -#define _IPPLRB_PX 0 -#define _IPPLRB_B1 1 -#define _IPPLRB_B2 2 - -#define _IPP64_PX _IPP_PX -#define _IPP64_I7 64 - -#define _IPP32E_PX _IPP_PX /* pure C-code x64 */ -#define _IPP32E_M7 32 /* Pentium with x64 support (Nocona) - SSE3 x64 */ -#define _IPP32E_U8 64 /* Merom - SSSE3 x64 */ -#define _IPP32E_Y8 128 /* Penryn - SSE4.1 + tick for SSE4.2 x64 */ -#define _IPP32E_E9 256 /* SandyBridge (GSSE) - AVX x64 */ -#define _IPP32E_L9 512 /* Haswell (AVX2) x64 */ -#define _IPP32E_N0 1024 /* KNL (AVX-512) x64 */ -#define _IPP32E_K0 2048 /* SkyLake Xeon (AVX-512) x64 */ - -#define _IPPLP32_PX _IPP_PX -#define _IPPLP32_S8 1 /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */ - -#define _IPPLP64_PX _IPP_PX -#define _IPPLP64_N8 1 /* old Atom (SSSE3+movbe) (Silverthorne) x64 */ - -#if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300) - #define __ALIGN8 __declspec (align(8)) - #define __ALIGN16 __declspec (align(16)) -#if !defined( OSX32 ) - #define __ALIGN32 __declspec (align(32)) -#else - #define __ALIGN32 __declspec (align(16)) -#endif - #define __ALIGN64 __declspec (align(64)) -#elif defined (__GNUC__) - #define __ALIGN8 __attribute((aligned(8))) - #define __ALIGN16 __attribute((aligned(16))) - #define __ALIGN32 __attribute((aligned(32))) - #define __ALIGN64 __attribute((aligned(64))) -#else - #define __ALIGN8 - #define __ALIGN16 - #define __ALIGN32 - #define __ALIGN64 -#endif - -#if defined ( _M5 ) /* Quark (Pentium) - x86+x87 ia32 */ - #define _IPP _IPP_M5 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined ( _M6 ) /* Pentium MMX - MMX ia32 */ - #define _IPP _IPP_M6 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _A6 ) /* Pentium III - SSE ia32 */ - #define _IPP _IPP_A6 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _W7 ) /* Pentium 4 - SSE2 ia32 */ - #define _IPP _IPP_W7 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _T7 ) /* Pentium with x64 support (Nocona) - SSE3 ia32 */ - #define _IPP _IPP_T7 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _V8 ) /* Merom - SSSE3 ia32 */ - #define _IPP _IPP_V8 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _P8 ) /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */ - #define _IPP _IPP_P8 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _G9 ) /* SandyBridge (GSSE) - AVX ia32 */ - #define _IPP _IPP_G9 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _H9 ) /* Haswell (AVX2) ia32 */ - #define _IPP _IPP_H9 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _M7 ) /* Pentium with x64 support (Nocona) - SSE3 x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_M7 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _U8 ) /* Merom - SSSE3 x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_U8 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _Y8 ) /* Penryn - SSE4.1 + tick for SSE4.2 x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_Y8 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _E9 ) /* SandyBridge (GSSE) - AVX x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_E9 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _L9 ) /* Haswell (AVX2) x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_L9 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _N0 ) /* KNL (AVX-512) x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_N0 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _K0 ) /* SkyLake Xeon (AVX-512) x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_K0 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _B2 ) /* KNC (MIC) */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_B2 - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _S8 ) /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */ - #define _IPP _IPP_V8 - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_S8 - #define _IPPLP64 _IPPLP64_PX - -#elif defined( _N8 ) /* old Atom (SSSE3+movbe) (Silverthorne) x64 */ - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_U8 - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_N8 - -#else - #define _IPP _IPP_PX - #define _IPP32E _IPP32E_PX - #define _IPPLRB _IPPLRB_PX - #define _IPPLP32 _IPPLP32_PX - #define _IPPLP64 _IPPLP64_PX - -#endif - - -#define _IPP_ARCH_IA32 1 -#define _IPP_ARCH_IA64 2 -#define _IPP_ARCH_EM64T 4 -#define _IPP_ARCH_XSC 8 -#define _IPP_ARCH_LRB 16 -#define _IPP_ARCH_LP32 32 -#define _IPP_ARCH_LP64 64 -#define _IPP_ARCH_LRB2 128 - -#if defined ( _ARCH_IA32 ) - #define _IPP_ARCH _IPP_ARCH_IA32 - -#elif defined( _ARCH_EM64T ) - #define _IPP_ARCH _IPP_ARCH_EM64T - -#elif defined( _ARCH_LRB2 ) - #define _IPP_ARCH _IPP_ARCH_LRB2 - -#elif defined( _ARCH_LP32 ) - #define _IPP_ARCH _IPP_ARCH_LP32 - -#elif defined( _ARCH_LP64 ) - #define _IPP_ARCH _IPP_ARCH_LP64 - -#else - #if defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) - #define _IPP_ARCH _IPP_ARCH_EM64T - - #else - #define _IPP_ARCH _IPP_ARCH_IA32 - - #endif -#endif - -#if ((_IPP_ARCH == _IPP_ARCH_IA32) || (_IPP_ARCH == _IPP_ARCH_LP32)) -__INLINE -Ipp32s IPP_INT_PTR( const void* ptr ) { - union { - void* Ptr; - Ipp32s Int; - } dd; - dd.Ptr = (void*)ptr; - return dd.Int; -} - -__INLINE -Ipp32u IPP_UINT_PTR( const void* ptr ) { - union { - void* Ptr; - Ipp32u Int; - } dd; - dd.Ptr = (void*)ptr; - return dd.Int; -} -#elif ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LRB2) || (_IPP_ARCH == _IPP_ARCH_LP64)) -__INLINE -Ipp64s IPP_INT_PTR( const void* ptr ) { - union { - void* Ptr; - Ipp64s Int; - } dd; - dd.Ptr = (void*)ptr; - return dd.Int; -} - -__INLINE -Ipp64u IPP_UINT_PTR( const void* ptr ) { - union { - void* Ptr; - Ipp64u Int; - } dd; - dd.Ptr = (void*)ptr; - return dd.Int; -} -#else - #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) - #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) -#endif - -#define IPP_ALIGN_TYPE(type, align) ((align)/sizeof(type)-1) -#define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) -#define IPP_ALIGNED_PTR(ptr, align) (void*)( (unsigned char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) - -#define IPP_ALIGNED_SIZE(size, align) (((size)+(align)-1)&~((align)-1)) - -#define IPP_MALLOC_ALIGNED_BYTES 64 -#define IPP_MALLOC_ALIGNED_8BYTES 8 -#define IPP_MALLOC_ALIGNED_16BYTES 16 -#define IPP_MALLOC_ALIGNED_32BYTES 32 - -#define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ - char arrname##AlignedArrBuff[sizeof(arrtype)*(arrlength)+IPP_ALIGN_TYPE(char, align)];\ - arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) - -#if defined( __cplusplus ) -extern "C" { -#endif - -/* ///////////////////////////////////////////////////////////////////////////// - - IPP Context Identification - - /////////////////////////////////////////////////////////////////////////// */ - -#define IPP_CONTEXT( a, b, c, d) \ - (int)(((unsigned)(a) << 24) | ((unsigned)(b) << 16) | \ - ((unsigned)(c) << 8) | (unsigned)(d)) - -typedef enum { - idCtxUnknown = 0, - idCtxFFT_C_16sc, - idCtxFFT_C_16s, - idCtxFFT_R_16s, - idCtxFFT_C_32fc, - idCtxFFT_C_32f, - idCtxFFT_R_32f, - idCtxFFT_C_64fc, - idCtxFFT_C_64f, - idCtxFFT_R_64f, - idCtxDFT_C_16sc, - idCtxDFT_C_16s, - idCtxDFT_R_16s, - idCtxDFT_C_32fc, - idCtxDFT_C_32f, - idCtxDFT_R_32f, - idCtxDFT_C_64fc, - idCtxDFT_C_64f, - idCtxDFT_R_64f, - idCtxDCTFwd_16s, - idCtxDCTInv_16s, - idCtxDCTFwd_32f, - idCtxDCTInv_32f, - idCtxDCTFwd_64f, - idCtxDCTInv_64f, - idCtxFFT2D_C_32fc, - idCtxFFT2D_R_32f, - idCtxDFT2D_C_32fc, - idCtxDFT2D_R_32f, - idCtxFFT2D_R_32s, - idCtxDFT2D_R_32s, - idCtxDCT2DFwd_32f, - idCtxDCT2DInv_32f, - idCtxMoment64f, - idCtxMoment64s, - idCtxRandUni_8u, - idCtxRandUni_16s, - idCtxRandUni_32f, - idCtxRandUni_64f, - idCtxRandGauss_8u, - idCtxRandGauss_16s, - idCtxRandGauss_32f, - idCtxRandGauss_64f, - idCtxWTFwd_32f, - idCtxWTFwd_8u32f, - idCtxWTFwd_8s32f, - idCtxWTFwd_16u32f, - idCtxWTFwd_16s32f, - idCtxWTFwd2D_32f_C1R, - idCtxWTInv2D_32f_C1R, - idCtxWTFwd2D_32f_C3R, - idCtxWTInv2D_32f_C3R, - idCtxWTInv_32f, - idCtxWTInv_32f8u, - idCtxWTInv_32f8s, - idCtxWTInv_32f16u, - idCtxWTInv_32f16s, - idCtxMDCTFwd_32f, - idCtxMDCTInv_32f, - idCtxMDCTFwd_16s, - idCtxFIRBlock_32f, - idCtxFDP_32f, - idCtxRLMS_32f = IPP_CONTEXT( 'L', 'M', 'S', '1'), - idCtxRLMS32f_16s = IPP_CONTEXT( 'L', 'M', 'S', 0 ), - idCtxIIRAR_32f = IPP_CONTEXT( 'I', 'I', '0', '1'), - idCtxIIRBQ_32f = IPP_CONTEXT( 'I', 'I', '0', '2'), - idCtxIIRAR_32fc = IPP_CONTEXT( 'I', 'I', '0', '3'), - idCtxIIRBQ_32fc = IPP_CONTEXT( 'I', 'I', '0', '4'), - idCtxIIRAR32f_16s = IPP_CONTEXT( 'I', 'I', '0', '5'), - idCtxIIRBQ32f_16s = IPP_CONTEXT( 'I', 'I', '0', '6'), - idCtxIIRAR32fc_16sc = IPP_CONTEXT( 'I', 'I', '0', '7'), - idCtxIIRBQ32fc_16sc = IPP_CONTEXT( 'I', 'I', '0', '8'), - idCtxIIRAR32s_16s = IPP_CONTEXT( 'I', 'I', '0', '9'), - idCtxIIRBQ32s_16s = IPP_CONTEXT( 'I', 'I', '1', '0'), - idCtxIIRAR32sc_16sc = IPP_CONTEXT( 'I', 'I', '1', '1'), - idCtxIIRBQ32sc_16sc = IPP_CONTEXT( 'I', 'I', '1', '2'), - idCtxIIRAR_64f = IPP_CONTEXT( 'I', 'I', '1', '3'), - idCtxIIRBQ_64f = IPP_CONTEXT( 'I', 'I', '1', '4'), - idCtxIIRAR_64fc = IPP_CONTEXT( 'I', 'I', '1', '5'), - idCtxIIRBQ_64fc = IPP_CONTEXT( 'I', 'I', '1', '6'), - idCtxIIRAR64f_32f = IPP_CONTEXT( 'I', 'I', '1', '7'), - idCtxIIRBQ64f_32f = IPP_CONTEXT( 'I', 'I', '1', '8'), - idCtxIIRAR64fc_32fc = IPP_CONTEXT( 'I', 'I', '1', '9'), - idCtxIIRBQ64fc_32fc = IPP_CONTEXT( 'I', 'I', '2', '0'), - idCtxIIRAR64f_32s = IPP_CONTEXT( 'I', 'I', '2', '1'), - idCtxIIRBQ64f_32s = IPP_CONTEXT( 'I', 'I', '2', '2'), - idCtxIIRAR64fc_32sc = IPP_CONTEXT( 'I', 'I', '2', '3'), - idCtxIIRBQ64fc_32sc = IPP_CONTEXT( 'I', 'I', '2', '4'), - idCtxIIRAR64f_16s = IPP_CONTEXT( 'I', 'I', '2', '5'), - idCtxIIRBQ64f_16s = IPP_CONTEXT( 'I', 'I', '2', '6'), - idCtxIIRAR64fc_16sc = IPP_CONTEXT( 'I', 'I', '2', '7'), - idCtxIIRBQ64fc_16sc = IPP_CONTEXT( 'I', 'I', '2', '8'), - idCtxIIRBQDF1_32f = IPP_CONTEXT( 'I', 'I', '2', '9'), - idCtxIIRBQDF164f_32s= IPP_CONTEXT( 'I', 'I', '3', '0'), - idCtxFIRSR_32f = IPP_CONTEXT( 'F', 'I', '0', '1'), - idCtxFIRSR_32fc = IPP_CONTEXT( 'F', 'I', '0', '2'), - idCtxFIRMR_32f = IPP_CONTEXT( 'F', 'I', '0', '3'), - idCtxFIRMR_32fc = IPP_CONTEXT( 'F', 'I', '0', '4'), - idCtxFIRSR32f_16s = IPP_CONTEXT( 'F', 'I', '0', '5'), - idCtxFIRSR32fc_16sc = IPP_CONTEXT( 'F', 'I', '0', '6'), - idCtxFIRMR32f_16s = IPP_CONTEXT( 'F', 'I', '0', '7'), - idCtxFIRMR32fc_16sc = IPP_CONTEXT( 'F', 'I', '0', '8'), - idCtxFIRSR32s_16s = IPP_CONTEXT( 'F', 'I', '0', '9'), - idCtxFIRSR32sc_16sc = IPP_CONTEXT( 'F', 'I', '1', '0'), - idCtxFIRMR32s_16s = IPP_CONTEXT( 'F', 'I', '1', '1'), - idCtxFIRMR32sc_16sc = IPP_CONTEXT( 'F', 'I', '1', '2'), - idCtxFIRSR_64f = IPP_CONTEXT( 'F', 'I', '1', '3'), - idCtxFIRSR_64fc = IPP_CONTEXT( 'F', 'I', '1', '4'), - idCtxFIRMR_64f = IPP_CONTEXT( 'F', 'I', '1', '5'), - idCtxFIRMR_64fc = IPP_CONTEXT( 'F', 'I', '1', '6'), - idCtxFIRSR64f_32f = IPP_CONTEXT( 'F', 'I', '1', '7'), - idCtxFIRSR64fc_32fc = IPP_CONTEXT( 'F', 'I', '1', '8'), - idCtxFIRMR64f_32f = IPP_CONTEXT( 'F', 'I', '1', '9'), - idCtxFIRMR64fc_32fc = IPP_CONTEXT( 'F', 'I', '2', '0'), - idCtxFIRSR64f_32s = IPP_CONTEXT( 'F', 'I', '2', '1'), - idCtxFIRSR64fc_32sc = IPP_CONTEXT( 'F', 'I', '2', '2'), - idCtxFIRMR64f_32s = IPP_CONTEXT( 'F', 'I', '2', '3'), - idCtxFIRMR64fc_32sc = IPP_CONTEXT( 'F', 'I', '2', '4'), - idCtxFIRSR64f_16s = IPP_CONTEXT( 'F', 'I', '2', '5'), - idCtxFIRSR64fc_16sc = IPP_CONTEXT( 'F', 'I', '2', '6'), - idCtxFIRMR64f_16s = IPP_CONTEXT( 'F', 'I', '2', '7'), - idCtxFIRMR64fc_16sc = IPP_CONTEXT( 'F', 'I', '2', '8'), - idCtxFIRSR_16s = IPP_CONTEXT( 'F', 'I', '2', '9'), - idCtxFIRMR_16s = IPP_CONTEXT( 'F', 'I', '3', '0'), - idCtxFIRSRStream_16s= IPP_CONTEXT( 'F', 'I', '3', '1'), - idCtxFIRMRStream_16s= IPP_CONTEXT( 'F', 'I', '3', '2'), - idCtxFIRSRStream_32f= IPP_CONTEXT( 'F', 'I', '3', '3'), - idCtxFIRMRStream_32f= IPP_CONTEXT( 'F', 'I', '3', '4'), - idCtxRLMS32s_16s = IPP_CONTEXT( 'L', 'M', 'S', 'R'), - idCtxCLMS32s_16s = IPP_CONTEXT( 'L', 'M', 'S', 'C'), - idCtxEncode_JPEG2K, - idCtxDES = IPP_CONTEXT( ' ', 'D', 'E', 'S'), - idCtxBlowfish = IPP_CONTEXT( ' ', ' ', 'B', 'F'), - idCtxRijndael = IPP_CONTEXT( ' ', 'R', 'I', 'J'), - idCtxSMS4 = IPP_CONTEXT( 'S', 'M', 'S', '4'), - idCtxTwofish = IPP_CONTEXT( ' ', ' ', 'T', 'F'), - idCtxARCFOUR = IPP_CONTEXT( ' ', 'R', 'C', '4'), - idCtxRC564 = IPP_CONTEXT( 'R', 'C', '5', '1'), - idCtxRC5128 = IPP_CONTEXT( 'R', 'C', '5', '2'), - idCtxSHA1 = IPP_CONTEXT( 'S', 'H', 'S', '1'), - idCtxSHA224 = IPP_CONTEXT( 'S', 'H', 'S', '3'), - idCtxSHA256 = IPP_CONTEXT( 'S', 'H', 'S', '2'), - idCtxSHA384 = IPP_CONTEXT( 'S', 'H', 'S', '4'), - idCtxSHA512 = IPP_CONTEXT( 'S', 'H', 'S', '5'), - idCtxMD5 = IPP_CONTEXT( ' ', 'M', 'D', '5'), - idCtxHMAC = IPP_CONTEXT( 'H', 'M', 'A', 'C'), - idCtxDAA = IPP_CONTEXT( ' ', 'D', 'A', 'A'), - idCtxBigNum = IPP_CONTEXT( 'B', 'I', 'G', 'N'), - idCtxMontgomery = IPP_CONTEXT( 'M', 'O', 'N', 'T'), - idCtxPrimeNumber = IPP_CONTEXT( 'P', 'R', 'I', 'M'), - idCtxPRNG = IPP_CONTEXT( 'P', 'R', 'N', 'G'), - idCtxRSA = IPP_CONTEXT( ' ', 'R', 'S', 'A'), - idCtxRSA_PubKey = IPP_CONTEXT( 'R', 'S', 'A', '0'), - idCtxRSA_PrvKey1 = IPP_CONTEXT( 'R', 'S', 'A', '1'), - idCtxRSA_PrvKey2 = IPP_CONTEXT( 'R', 'S', 'A', '2'), - idCtxDSA = IPP_CONTEXT( ' ', 'D', 'S', 'A'), - idCtxECCP = IPP_CONTEXT( ' ', 'E', 'C', 'P'), - idCtxECCB = IPP_CONTEXT( ' ', 'E', 'C', 'B'), - idCtxECCPPoint = IPP_CONTEXT( 'P', 'E', 'C', 'P'), - idCtxECCBPoint = IPP_CONTEXT( 'P', 'E', 'C', 'B'), - idCtxDH = IPP_CONTEXT( ' ', ' ', 'D', 'H'), - idCtxDLP = IPP_CONTEXT( ' ', 'D', 'L', 'P'), - idCtxCMAC = IPP_CONTEXT( 'C', 'M', 'A', 'C'), - idCtxRFFT2_8u, - idCtxHilbert_32f32fc, - idCtxHilbert_16s32fc, - idCtxHilbert_16s16sc, - idCtxTone_16s, - idCtxTriangle_16s, - idCtxDFTOutOrd_C_32fc, - idCtxDFTOutOrd_C_64fc, - idCtxFFT_C_32sc, - idCtxFFT_C_32s, - idCtxFFT_R_32s, - idCtxFFT_R_16s32s, - idCtxDecodeProgr_JPEG2K, - idCtxWarp_MPEG4, - idCtxQuantInvIntra_MPEG4, - idCtxQuantInvInter_MPEG4, - idCtxQuantIntra_MPEG4, - idCtxQuantInter_MPEG4, - idCtxAnalysisFilter_SBR_C_32f32fc, - idCtxAnalysisFilter_SBR_C_32f, - idCtxAnalysisFilter_SBR_R_32f, - idCtxSynthesisFilter_SBR_C_32fc32f, - idCtxSynthesisFilter_SBR_C_32f, - idCtxSynthesisFilter_SBR_R_32f, - idCtxSynthesisDownFilter_SBR_C_32fc32f, - idCtxSynthesisDownFilter_SBR_C_32f, - idCtxSynthesisDownFilter_SBR_R_32f, - idCtxVLCEncode, - idCtxVLCDecode, - idCtxAnalysisFilter_SBR_C_32s32sc, - idCtxAnalysisFilter_SBR_R_32s, - idCtxSynthesisFilter_SBR_C_32sc32s, - idCtxSynthesisFilter_SBR_R_32s, - idCtxSynthesisDownFilter_SBR_C_32sc32s, - idCtxSynthesisDownFilter_SBR_R_32s, - idCtxSynthesisFilter_PQMF_MP3_32f, - idCtxAnalysisFilter_PQMF_MP3_32f, - idCtxResampleRow, - idCtxAnalysisFilter_SBR_Enc_C_32f32fc, - idCtxSynthesisFilter_DTS_32f, - idCtxFilterBilateralGauss_8u, - idCtxFilterBilateralGaussFast_8u, - idCtxBGF, - idCtxPolyGF, - idCtxRSenc, - idCtxRSdec, - idCtxSnow3g = IPP_CONTEXT( 'S', 'n', 'o', 'w'), - idCtxSnow3gF8, - idCtxSnow3gF9, - idCtxKasumi = IPP_CONTEXT( 'K', 'a', 's', 'u'), - idCtxKasumiF8, - idCtxKasumiF9, - idCtxResizeHannFilter_8u, - idCtxResizeLanczosFilter_8u, - idCtxAESXCBC, - idCtxAESCCM, - idCtxAESGCM, - idCtxMsgCatalog, - idCtxGFP, - idCtxGFPE, - idCtxGFPX, - idCtxGFPXE, - idCtxGFPXQX, - idCtxGFPXQXE, - idCtxGFPEC, - idCtxGFPPoint, - idCtxGFPXEC, - idCtxGFPXECPoint, - idCtxPairing, - idCtxResize_32f, - idCtxResizeYUV420, - idCtxResizeYUV422, - idCtxResize_64f, - idCtxFilterBilateralBorder, - idCtxThresholdAdaptiveGauss, - idCtxHOG, - idCtxFastN, - idCtxHash, - idCtxSM3 -} IppCtxId; - - - - -/* ///////////////////////////////////////////////////////////////////////////// - Helpers - /////////////////////////////////////////////////////////////////////////// */ - -#define IPP_NOERROR_RET() return ippStsNoErr -#define IPP_ERROR_RET( ErrCode ) return (ErrCode) - -#ifdef _IPP_DEBUG - - #define IPP_BADARG_RET( expr, ErrCode )\ - {if (expr) { IPP_ERROR_RET( ErrCode ); }} - -#else - - #define IPP_BADARG_RET( expr, ErrCode ) - -#endif - - - #define IPP_BAD_SIZE_RET( n )\ - IPP_BADARG_RET( (n)<=0, ippStsSizeErr ) - - #define IPP_BAD_STEP_RET( n )\ - IPP_BADARG_RET( (n)<=0, ippStsStepErr ) - - #define IPP_BAD_PTR1_RET( ptr )\ - IPP_BADARG_RET( NULL==(ptr), ippStsNullPtrErr ) - - #define IPP_BAD_PTR2_RET( ptr1, ptr2 )\ - {IPP_BAD_PTR1_RET( ptr1 ); IPP_BAD_PTR1_RET( ptr2 )} - - #define IPP_BAD_PTR3_RET( ptr1, ptr2, ptr3 )\ - {IPP_BAD_PTR2_RET( ptr1, ptr2 ); IPP_BAD_PTR1_RET( ptr3 )} - - #define IPP_BAD_PTR4_RET( ptr1, ptr2, ptr3, ptr4 )\ - {IPP_BAD_PTR2_RET( ptr1, ptr2 ); IPP_BAD_PTR2_RET( ptr3, ptr4 )} - - #define IPP_BAD_ISIZE_RET(roi) \ - IPP_BADARG_RET( ((roi).width<=0 || (roi).height<=0), ippStsSizeErr) - -/* ////////////////////////////////////////////////////////////////////////// */ -/* internal messages */ - -#define MSG_LOAD_DLL_ERR (-9700) /* Error at loading of %s library */ -#define MSG_NO_DLL (-9701) /* No DLLs were found in the Waterfall procedure */ -#define MSG_NO_SHARED (-9702) /* No shared libraries were found in the Waterfall procedure */ - -/* ////////////////////////////////////////////////////////////////////////// */ - - -typedef union { /* double precision */ - Ipp64s hex; - Ipp64f fp; -} IppFP_64f; - -typedef union { /* single precision */ - Ipp32s hex; - Ipp32f fp; -} IppFP_32f; - - -extern const IppFP_32f ippConstantOfNAN_32f; -extern const IppFP_64f ippConstantOfNAN_64f; - -extern const IppFP_32f ippConstantOfINF_32f; -extern const IppFP_64f ippConstantOfINF_64f; -extern const IppFP_32f ippConstantOfINF_NEG_32f; -extern const IppFP_64f ippConstantOfINF_NEG_64f; - -#define NAN_32F (ippConstantOfNAN_32f.fp) -#define NAN_64F (ippConstantOfNAN_64f.fp) -#define INF_32F (ippConstantOfINF_32f.fp) -#define INF_64F (ippConstantOfINF_64f.fp) -#define INF_NEG_32F (ippConstantOfINF_NEG_32f.fp) -#define INF_NEG_64F (ippConstantOfINF_NEG_64f.fp) - -/* ////////////////////////////////////////////////////////////////////////// */ - -typedef enum { - ippunreg=-1, - ippac = 0, - ippcc = 1, - ippch = 2, - ippcp = 3, - ippcv = 4, - ippdc = 5, - ippdi = 6, - ippgen = 7, - ippi = 8, - ippj = 9, - ippm = 10, - ippr = 11, - ipps = 12, - ippsc = 13, - ippsr = 14, - ippvc = 15, - ippvm = 16, - ippmsdk = 17, - ippcpepid = 18, - ippe = 19, - ipprs = 20, - ippsq = 21, - ippnomore -} IppDomain; - -int __CDECL ownGetNumThreads( void ); -int __CDECL ownGetFeature( Ipp64u MaskOfFeature ); /* the main function of tick-tock dispatcher */ - -#ifdef _IPP_DYNAMIC -typedef IppStatus (__STDCALL *DYN_RELOAD)( int ); -void __CDECL ownRegisterLib( IppDomain, DYN_RELOAD ); -void __CDECL ownUnregisterLib( IppDomain ); -#endif - -/* the number of threads available for any ipp function that uses OMP; */ -/* at the ippxx.dll loading time is equal to the number of logical processors, */ -/* and can be changed ONLY externally by library user to any desired number */ -/* by means of ippSetNumThreads() function */ -#define IPP_GET_NUM_THREADS() ( ownGetNumThreads() ) -#define IPP_OMP_NUM_THREADS() num_threads( IPP_GET_NUM_THREADS() ) -#define IPP_OMP_LIMIT_MAX_NUM_THREADS(n) num_threads( IPP_MIN(IPP_GET_NUM_THREADS(),(n))) - - -/* ////////////////////////////////////////////////////////////////////////// */ - -/* Define NULL pointer value */ -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#define UNREFERENCED_PARAMETER(p) (p)=(p) - -#if defined( _IPP_MARK_LIBRARY ) -static char G[] = {73, 80, 80, 71, 101, 110, 117, 105, 110, 101, 243, 193, 210, 207, 215}; -#endif - - -#define STR2(x) #x -#define STR(x) STR2(x) -#define MESSAGE( desc )\ - message(__FILE__ "(" STR(__LINE__) "):" #desc) - -/* -// endian definition -*/ -#define IPP_LITTLE_ENDIAN (0) -#define IPP_BIG_ENDIAN (1) - -#if defined( _IPP_LE ) - #define IPP_ENDIAN IPP_LITTLE_ENDIAN - -#elif defined( _IPP_BE ) - #define IPP_ENDIAN IPP_BIG_ENDIAN - -#else - #if defined( __ARMEB__ ) - #define IPP_ENDIAN IPP_BIG_ENDIAN - - #else - #define IPP_ENDIAN IPP_LITTLE_ENDIAN - - #endif -#endif - - -/* ////////////////////////////////////////////////////////////////////////// */ - -/* intrinsics */ -#if (_IPP >= _IPP_A6) || (_IPP32E >= _IPP32E_M7) - #if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300) - #if (_IPP == _IPP_A6) - #include "xmmintrin.h" - #elif (_IPP == _IPP_W7) - #if defined(__INTEL_COMPILER) - #include "emmintrin.h" - #else - #undef _W7 - #include "emmintrin.h" - #define _W7 - #endif - #define _mm_loadu _mm_loadu_si128 - #elif (_IPP == _IPP_T7) || (_IPP32E == _IPP32E_M7) - #if defined(__INTEL_COMPILER) - #include "pmmintrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER >= 140050110) - #include "intrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER < 140050110) - #include "emmintrin.h" - #define _mm_loadu _mm_loadu_si128 - #endif - #elif (_IPP == _IPP_V8) || (_IPP32E == _IPP32E_U8) - #if defined(__INTEL_COMPILER) - #include "tmmintrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER >= 140050110) - #include "intrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER < 140050110) - #include "emmintrin.h" - #define _mm_loadu _mm_loadu_si128 - #endif - #elif (_IPP == _IPP_P8) || (_IPP32E == _IPP32E_Y8) - #if defined(__INTEL_COMPILER) - #include "smmintrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER >= 140050110) - #include "intrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER < 140050110) - #include "emmintrin.h" - #define _mm_loadu _mm_loadu_si128 - #endif - #elif (_IPP >= _IPP_G9) || (_IPP32E >= _IPP32E_E9) - #if defined(__INTEL_COMPILER) - #include "immintrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER >= 160021003) - #include "immintrin.h" - #define _mm_loadu _mm_lddqu_si128 - #endif - #endif - #endif -#elif (_IPPLP32 >= _IPPLP32_S8) || (_IPPLP64 >= _IPPLP64_N8) - #if defined(__INTEL_COMPILER) - #include "tmmintrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER >= 140050110) - #include "intrin.h" - #define _mm_loadu _mm_lddqu_si128 - #elif (_MSC_FULL_VER < 140050110) - #include "emmintrin.h" - #define _mm_loadu _mm_loadu_si128 - #endif -#elif (_IPPLRB >= _IPPLRB_B2) - #if defined(__INTEL_COMPILER) || defined(_REF_LIB) - #include "immintrin.h" - #endif -#endif - -// **** intrinsics for bit casting **** -#if defined(__INTEL_COMPILER) -extern unsigned int __intel_castf32_u32(float val); -extern float __intel_castu32_f32(unsigned int val); -extern unsigned __int64 __intel_castf64_u64(double val); -extern double __intel_castu64_f64(unsigned __int64 val); - #define __CAST_32f32u(val) __intel_castf32_u32((Ipp32f)val) - #define __CAST_32u32f(val) __intel_castu32_f32((Ipp32u)val) - #define __CAST_64f64u(val) __intel_castf64_u64((Ipp64f)val) - #define __CAST_64u64f(val) __intel_castu64_f64((Ipp64u)val) -#else - #define __CAST_32f32u(val) ( *((Ipp32u*)&val) ) - #define __CAST_32u32f(val) ( *((Ipp32f*)&val) ) - #define __CAST_64f64u(val) ( *((Ipp64u*)&val) ) - #define __CAST_64u64f(val) ( *((Ipp64f*)&val) ) -#endif - - -// short names for vector registers casting -#define _pd2ps _mm_castpd_ps -#define _ps2pd _mm_castps_pd -#define _pd2pi _mm_castpd_si128 -#define _pi2pd _mm_castsi128_pd -#define _ps2pi _mm_castps_si128 -#define _pi2ps _mm_castsi128_ps - -#define _ypd2ypi _mm256_castpd_si256 -#define _ypi2ypd _mm256_castsi256_pd -#define _yps2ypi _mm256_castps_si256 -#define _ypi2yps _mm256_castsi256_ps -#define _ypd2yps _mm256_castpd_ps -#define _yps2ypd _mm256_castps_pd - -#define _yps2ps _mm256_castps256_ps128 -#define _ypi2pi _mm256_castsi256_si128 -#define _ypd2pd _mm256_castpd256_pd128 -#define _ps2yps _mm256_castps128_ps256 -#define _pi2ypi _mm256_castsi128_si256 -#define _pd2ypd _mm256_castpd128_pd256 - - -#if defined(__INTEL_COMPILER) -#define __IVDEP ivdep -#else -#define __IVDEP message("message :: 'ivdep' is not defined") -#endif -//usage: #pragma __IVDEP - -/* ////////////////////////////////////////////////////////////////////////// - _IPP_DATA shoul be defined only: - - if compile not merged library - - only for 1 CPU for merged library to avoid data duplication -*/ -#if defined( _MERGED_BLD ) && ( defined(_G9) || defined(_E9) ) /* compile data only for g9 and e9 CPU */ - #define _IPP_DATA 1 -#elif !defined( _MERGED_BLD ) /* compile data if it isn't merged library */ - #define _IPP_DATA 1 -#endif - - -#if defined( __cplusplus ) -} -#endif - -#endif /* __OWNDEFS_H__ */ - +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __OWNDEFS_H__ +#define __OWNDEFS_H__ + +#if defined( _VXWORKS ) + #include + #undef NONE +#endif + +#include "ippdefs.h" + +#if defined(__INTEL_COMPILER) || defined(_MSC_VER) + #define __INLINE static __inline +#elif defined( __GNUC__ ) + #define __INLINE static __inline__ +#else + #define __INLINE static +#endif + +#if defined(__INTEL_COMPILER) + #define __RESTRICT restrict +#elif !defined( __RESTRICT ) + #define __RESTRICT +#endif + +#if defined( IPP_W32DLL ) + #if defined( _MSC_VER ) || defined( __INTEL_COMPILER ) + #define IPPFUN(type,name,arg) __declspec(dllexport) type __STDCALL name arg + #else + #define IPPFUN(type,name,arg) extern type __STDCALL name arg + #endif +#else + #define IPPFUN(type,name,arg) extern type __STDCALL name arg +#endif + + +/* structure represeting 128 bit unsigned integer type */ + +typedef struct{ + Ipp64u low; + Ipp64u high; +}Ipp128u; + +#define _IPP_PX 0 /* pure C-code ia32 */ +#define _IPP_M5 1 /* Quark (Pentium) - x86+x87 ia32 */ +#define _IPP_M6 2 /* Pentium MMX - MMX ia32 */ +#define _IPP_A6 4 /* Pentium III - SSE ia32 */ +#define _IPP_W7 8 /* Pentium 4 - SSE2 ia32 */ +#define _IPP_T7 16 /* Pentium with x64 support (Nocona) - SSE3 ia32 */ +#define _IPP_V8 32 /* Merom - SSSE3 ia32 */ +#define _IPP_P8 64 /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */ +#define _IPP_G9 128 /* SandyBridge (GSSE) - AVX ia32 */ +#define _IPP_H9 256 /* Haswell (AVX2) ia32 */ +#define _IPP_I0 512 /* KNL (AVX-512) ia32 */ +#define _IPP_S0 1024 /* SkyLake Xeon (AVX-512) ia32 */ + +#define _IPPXSC_PX 0 +#define _IPPXSC_S1 1 +#define _IPPXSC_S2 2 +#define _IPPXSC_C2 4 + +#define _IPPLRB_PX 0 +#define _IPPLRB_B1 1 +#define _IPPLRB_B2 2 + +#define _IPP64_PX _IPP_PX +#define _IPP64_I7 64 + +#define _IPP32E_PX _IPP_PX /* pure C-code x64 */ +#define _IPP32E_M7 32 /* Pentium with x64 support (Nocona) - SSE3 x64 */ +#define _IPP32E_U8 64 /* Merom - SSSE3 x64 */ +#define _IPP32E_Y8 128 /* Penryn - SSE4.1 + tick for SSE4.2 x64 */ +#define _IPP32E_E9 256 /* SandyBridge (GSSE) - AVX x64 */ +#define _IPP32E_L9 512 /* Haswell (AVX2) x64 */ +#define _IPP32E_N0 1024 /* KNL (AVX-512) x64 */ +#define _IPP32E_K0 2048 /* SkyLake Xeon (AVX-512) x64 */ + +#define _IPPLP32_PX _IPP_PX +#define _IPPLP32_S8 1 /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */ + +#define _IPPLP64_PX _IPP_PX +#define _IPPLP64_N8 1 /* old Atom (SSSE3+movbe) (Silverthorne) x64 */ + +#if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300) + #define __ALIGN8 __declspec (align(8)) + #define __ALIGN16 __declspec (align(16)) +#if !defined( OSX32 ) + #define __ALIGN32 __declspec (align(32)) +#else + #define __ALIGN32 __declspec (align(16)) +#endif + #define __ALIGN64 __declspec (align(64)) +#elif defined (__GNUC__) + #define __ALIGN8 __attribute((aligned(8))) + #define __ALIGN16 __attribute((aligned(16))) + #define __ALIGN32 __attribute((aligned(32))) + #define __ALIGN64 __attribute((aligned(64))) +#else + #define __ALIGN8 + #define __ALIGN16 + #define __ALIGN32 + #define __ALIGN64 +#endif + +#if defined ( _M5 ) /* Quark (Pentium) - x86+x87 ia32 */ + #define _IPP _IPP_M5 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined ( _M6 ) /* Pentium MMX - MMX ia32 */ + #define _IPP _IPP_M6 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _A6 ) /* Pentium III - SSE ia32 */ + #define _IPP _IPP_A6 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _W7 ) /* Pentium 4 - SSE2 ia32 */ + #define _IPP _IPP_W7 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _T7 ) /* Pentium with x64 support (Nocona) - SSE3 ia32 */ + #define _IPP _IPP_T7 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _V8 ) /* Merom - SSSE3 ia32 */ + #define _IPP _IPP_V8 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _P8 ) /* Penryn - SSE4.1 + tick for SSE4.2 ia32 */ + #define _IPP _IPP_P8 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _G9 ) /* SandyBridge (GSSE) - AVX ia32 */ + #define _IPP _IPP_G9 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _H9 ) /* Haswell (AVX2) ia32 */ + #define _IPP _IPP_H9 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _M7 ) /* Pentium with x64 support (Nocona) - SSE3 x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_M7 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _U8 ) /* Merom - SSSE3 x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_U8 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _Y8 ) /* Penryn - SSE4.1 + tick for SSE4.2 x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_Y8 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _E9 ) /* SandyBridge (GSSE) - AVX x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_E9 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _L9 ) /* Haswell (AVX2) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_L9 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _N0 ) /* KNL (AVX-512) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_N0 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _K0 ) /* SkyLake Xeon (AVX-512) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_K0 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _B2 ) /* KNC (MIC) */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_B2 + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _S8 ) /* old Atom (SSSE3+movbe) (Silverthorne) ia32 */ + #define _IPP _IPP_V8 + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_S8 + #define _IPPLP64 _IPPLP64_PX + +#elif defined( _N8 ) /* old Atom (SSSE3+movbe) (Silverthorne) x64 */ + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_U8 + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_N8 + +#else + #define _IPP _IPP_PX + #define _IPP32E _IPP32E_PX + #define _IPPLRB _IPPLRB_PX + #define _IPPLP32 _IPPLP32_PX + #define _IPPLP64 _IPPLP64_PX + +#endif + + +#define _IPP_ARCH_IA32 1 +#define _IPP_ARCH_IA64 2 +#define _IPP_ARCH_EM64T 4 +#define _IPP_ARCH_XSC 8 +#define _IPP_ARCH_LRB 16 +#define _IPP_ARCH_LP32 32 +#define _IPP_ARCH_LP64 64 +#define _IPP_ARCH_LRB2 128 + +#if defined ( _ARCH_IA32 ) + #define _IPP_ARCH _IPP_ARCH_IA32 + +#elif defined( _ARCH_EM64T ) + #define _IPP_ARCH _IPP_ARCH_EM64T + +#elif defined( _ARCH_LRB2 ) + #define _IPP_ARCH _IPP_ARCH_LRB2 + +#elif defined( _ARCH_LP32 ) + #define _IPP_ARCH _IPP_ARCH_LP32 + +#elif defined( _ARCH_LP64 ) + #define _IPP_ARCH _IPP_ARCH_LP64 + +#else + #if defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) + #define _IPP_ARCH _IPP_ARCH_EM64T + + #else + #define _IPP_ARCH _IPP_ARCH_IA32 + + #endif +#endif + +#if ((_IPP_ARCH == _IPP_ARCH_IA32) || (_IPP_ARCH == _IPP_ARCH_LP32)) +__INLINE +Ipp32s IPP_INT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp32s Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} + +__INLINE +Ipp32u IPP_UINT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp32u Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} +#elif ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LRB2) || (_IPP_ARCH == _IPP_ARCH_LP64)) +__INLINE +Ipp64s IPP_INT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp64s Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} + +__INLINE +Ipp64u IPP_UINT_PTR( const void* ptr ) { + union { + void* Ptr; + Ipp64u Int; + } dd; + dd.Ptr = (void*)ptr; + return dd.Int; +} +#else + #define IPP_INT_PTR( ptr ) ( (long)(ptr) ) + #define IPP_UINT_PTR( ptr ) ( (unsigned long)(ptr) ) +#endif + +#define IPP_ALIGN_TYPE(type, align) ((align)/sizeof(type)-1) +#define IPP_BYTES_TO_ALIGN(ptr, align) ((-(IPP_INT_PTR(ptr)&((align)-1)))&((align)-1)) +#define IPP_ALIGNED_PTR(ptr, align) (void*)( (unsigned char*)(ptr) + (IPP_BYTES_TO_ALIGN( ptr, align )) ) + +#define IPP_ALIGNED_SIZE(size, align) (((size)+(align)-1)&~((align)-1)) + +#define IPP_MALLOC_ALIGNED_BYTES 64 +#define IPP_MALLOC_ALIGNED_8BYTES 8 +#define IPP_MALLOC_ALIGNED_16BYTES 16 +#define IPP_MALLOC_ALIGNED_32BYTES 32 + +#define IPP_ALIGNED_ARRAY(align,arrtype,arrname,arrlength)\ + char arrname##AlignedArrBuff[sizeof(arrtype)*(arrlength)+IPP_ALIGN_TYPE(char, align)];\ + arrtype *arrname = (arrtype*)IPP_ALIGNED_PTR(arrname##AlignedArrBuff,align) + +#if defined( __cplusplus ) +extern "C" { +#endif + +/* ///////////////////////////////////////////////////////////////////////////// + + IPP Context Identification + + /////////////////////////////////////////////////////////////////////////// */ + +#define IPP_CONTEXT( a, b, c, d) \ + (int)(((unsigned)(a) << 24) | ((unsigned)(b) << 16) | \ + ((unsigned)(c) << 8) | (unsigned)(d)) + +typedef enum { + idCtxUnknown = 0, + idCtxFFT_C_16sc, + idCtxFFT_C_16s, + idCtxFFT_R_16s, + idCtxFFT_C_32fc, + idCtxFFT_C_32f, + idCtxFFT_R_32f, + idCtxFFT_C_64fc, + idCtxFFT_C_64f, + idCtxFFT_R_64f, + idCtxDFT_C_16sc, + idCtxDFT_C_16s, + idCtxDFT_R_16s, + idCtxDFT_C_32fc, + idCtxDFT_C_32f, + idCtxDFT_R_32f, + idCtxDFT_C_64fc, + idCtxDFT_C_64f, + idCtxDFT_R_64f, + idCtxDCTFwd_16s, + idCtxDCTInv_16s, + idCtxDCTFwd_32f, + idCtxDCTInv_32f, + idCtxDCTFwd_64f, + idCtxDCTInv_64f, + idCtxFFT2D_C_32fc, + idCtxFFT2D_R_32f, + idCtxDFT2D_C_32fc, + idCtxDFT2D_R_32f, + idCtxFFT2D_R_32s, + idCtxDFT2D_R_32s, + idCtxDCT2DFwd_32f, + idCtxDCT2DInv_32f, + idCtxMoment64f, + idCtxMoment64s, + idCtxRandUni_8u, + idCtxRandUni_16s, + idCtxRandUni_32f, + idCtxRandUni_64f, + idCtxRandGauss_8u, + idCtxRandGauss_16s, + idCtxRandGauss_32f, + idCtxRandGauss_64f, + idCtxWTFwd_32f, + idCtxWTFwd_8u32f, + idCtxWTFwd_8s32f, + idCtxWTFwd_16u32f, + idCtxWTFwd_16s32f, + idCtxWTFwd2D_32f_C1R, + idCtxWTInv2D_32f_C1R, + idCtxWTFwd2D_32f_C3R, + idCtxWTInv2D_32f_C3R, + idCtxWTInv_32f, + idCtxWTInv_32f8u, + idCtxWTInv_32f8s, + idCtxWTInv_32f16u, + idCtxWTInv_32f16s, + idCtxMDCTFwd_32f, + idCtxMDCTInv_32f, + idCtxMDCTFwd_16s, + idCtxFIRBlock_32f, + idCtxFDP_32f, + idCtxRLMS_32f = IPP_CONTEXT( 'L', 'M', 'S', '1'), + idCtxRLMS32f_16s = IPP_CONTEXT( 'L', 'M', 'S', 0 ), + idCtxIIRAR_32f = IPP_CONTEXT( 'I', 'I', '0', '1'), + idCtxIIRBQ_32f = IPP_CONTEXT( 'I', 'I', '0', '2'), + idCtxIIRAR_32fc = IPP_CONTEXT( 'I', 'I', '0', '3'), + idCtxIIRBQ_32fc = IPP_CONTEXT( 'I', 'I', '0', '4'), + idCtxIIRAR32f_16s = IPP_CONTEXT( 'I', 'I', '0', '5'), + idCtxIIRBQ32f_16s = IPP_CONTEXT( 'I', 'I', '0', '6'), + idCtxIIRAR32fc_16sc = IPP_CONTEXT( 'I', 'I', '0', '7'), + idCtxIIRBQ32fc_16sc = IPP_CONTEXT( 'I', 'I', '0', '8'), + idCtxIIRAR32s_16s = IPP_CONTEXT( 'I', 'I', '0', '9'), + idCtxIIRBQ32s_16s = IPP_CONTEXT( 'I', 'I', '1', '0'), + idCtxIIRAR32sc_16sc = IPP_CONTEXT( 'I', 'I', '1', '1'), + idCtxIIRBQ32sc_16sc = IPP_CONTEXT( 'I', 'I', '1', '2'), + idCtxIIRAR_64f = IPP_CONTEXT( 'I', 'I', '1', '3'), + idCtxIIRBQ_64f = IPP_CONTEXT( 'I', 'I', '1', '4'), + idCtxIIRAR_64fc = IPP_CONTEXT( 'I', 'I', '1', '5'), + idCtxIIRBQ_64fc = IPP_CONTEXT( 'I', 'I', '1', '6'), + idCtxIIRAR64f_32f = IPP_CONTEXT( 'I', 'I', '1', '7'), + idCtxIIRBQ64f_32f = IPP_CONTEXT( 'I', 'I', '1', '8'), + idCtxIIRAR64fc_32fc = IPP_CONTEXT( 'I', 'I', '1', '9'), + idCtxIIRBQ64fc_32fc = IPP_CONTEXT( 'I', 'I', '2', '0'), + idCtxIIRAR64f_32s = IPP_CONTEXT( 'I', 'I', '2', '1'), + idCtxIIRBQ64f_32s = IPP_CONTEXT( 'I', 'I', '2', '2'), + idCtxIIRAR64fc_32sc = IPP_CONTEXT( 'I', 'I', '2', '3'), + idCtxIIRBQ64fc_32sc = IPP_CONTEXT( 'I', 'I', '2', '4'), + idCtxIIRAR64f_16s = IPP_CONTEXT( 'I', 'I', '2', '5'), + idCtxIIRBQ64f_16s = IPP_CONTEXT( 'I', 'I', '2', '6'), + idCtxIIRAR64fc_16sc = IPP_CONTEXT( 'I', 'I', '2', '7'), + idCtxIIRBQ64fc_16sc = IPP_CONTEXT( 'I', 'I', '2', '8'), + idCtxIIRBQDF1_32f = IPP_CONTEXT( 'I', 'I', '2', '9'), + idCtxIIRBQDF164f_32s= IPP_CONTEXT( 'I', 'I', '3', '0'), + idCtxFIRSR_32f = IPP_CONTEXT( 'F', 'I', '0', '1'), + idCtxFIRSR_32fc = IPP_CONTEXT( 'F', 'I', '0', '2'), + idCtxFIRMR_32f = IPP_CONTEXT( 'F', 'I', '0', '3'), + idCtxFIRMR_32fc = IPP_CONTEXT( 'F', 'I', '0', '4'), + idCtxFIRSR32f_16s = IPP_CONTEXT( 'F', 'I', '0', '5'), + idCtxFIRSR32fc_16sc = IPP_CONTEXT( 'F', 'I', '0', '6'), + idCtxFIRMR32f_16s = IPP_CONTEXT( 'F', 'I', '0', '7'), + idCtxFIRMR32fc_16sc = IPP_CONTEXT( 'F', 'I', '0', '8'), + idCtxFIRSR32s_16s = IPP_CONTEXT( 'F', 'I', '0', '9'), + idCtxFIRSR32sc_16sc = IPP_CONTEXT( 'F', 'I', '1', '0'), + idCtxFIRMR32s_16s = IPP_CONTEXT( 'F', 'I', '1', '1'), + idCtxFIRMR32sc_16sc = IPP_CONTEXT( 'F', 'I', '1', '2'), + idCtxFIRSR_64f = IPP_CONTEXT( 'F', 'I', '1', '3'), + idCtxFIRSR_64fc = IPP_CONTEXT( 'F', 'I', '1', '4'), + idCtxFIRMR_64f = IPP_CONTEXT( 'F', 'I', '1', '5'), + idCtxFIRMR_64fc = IPP_CONTEXT( 'F', 'I', '1', '6'), + idCtxFIRSR64f_32f = IPP_CONTEXT( 'F', 'I', '1', '7'), + idCtxFIRSR64fc_32fc = IPP_CONTEXT( 'F', 'I', '1', '8'), + idCtxFIRMR64f_32f = IPP_CONTEXT( 'F', 'I', '1', '9'), + idCtxFIRMR64fc_32fc = IPP_CONTEXT( 'F', 'I', '2', '0'), + idCtxFIRSR64f_32s = IPP_CONTEXT( 'F', 'I', '2', '1'), + idCtxFIRSR64fc_32sc = IPP_CONTEXT( 'F', 'I', '2', '2'), + idCtxFIRMR64f_32s = IPP_CONTEXT( 'F', 'I', '2', '3'), + idCtxFIRMR64fc_32sc = IPP_CONTEXT( 'F', 'I', '2', '4'), + idCtxFIRSR64f_16s = IPP_CONTEXT( 'F', 'I', '2', '5'), + idCtxFIRSR64fc_16sc = IPP_CONTEXT( 'F', 'I', '2', '6'), + idCtxFIRMR64f_16s = IPP_CONTEXT( 'F', 'I', '2', '7'), + idCtxFIRMR64fc_16sc = IPP_CONTEXT( 'F', 'I', '2', '8'), + idCtxFIRSR_16s = IPP_CONTEXT( 'F', 'I', '2', '9'), + idCtxFIRMR_16s = IPP_CONTEXT( 'F', 'I', '3', '0'), + idCtxFIRSRStream_16s= IPP_CONTEXT( 'F', 'I', '3', '1'), + idCtxFIRMRStream_16s= IPP_CONTEXT( 'F', 'I', '3', '2'), + idCtxFIRSRStream_32f= IPP_CONTEXT( 'F', 'I', '3', '3'), + idCtxFIRMRStream_32f= IPP_CONTEXT( 'F', 'I', '3', '4'), + idCtxRLMS32s_16s = IPP_CONTEXT( 'L', 'M', 'S', 'R'), + idCtxCLMS32s_16s = IPP_CONTEXT( 'L', 'M', 'S', 'C'), + idCtxEncode_JPEG2K, + idCtxDES = IPP_CONTEXT( ' ', 'D', 'E', 'S'), + idCtxBlowfish = IPP_CONTEXT( ' ', ' ', 'B', 'F'), + idCtxRijndael = IPP_CONTEXT( ' ', 'R', 'I', 'J'), + idCtxSMS4 = IPP_CONTEXT( 'S', 'M', 'S', '4'), + idCtxTwofish = IPP_CONTEXT( ' ', ' ', 'T', 'F'), + idCtxARCFOUR = IPP_CONTEXT( ' ', 'R', 'C', '4'), + idCtxRC564 = IPP_CONTEXT( 'R', 'C', '5', '1'), + idCtxRC5128 = IPP_CONTEXT( 'R', 'C', '5', '2'), + idCtxSHA1 = IPP_CONTEXT( 'S', 'H', 'S', '1'), + idCtxSHA224 = IPP_CONTEXT( 'S', 'H', 'S', '3'), + idCtxSHA256 = IPP_CONTEXT( 'S', 'H', 'S', '2'), + idCtxSHA384 = IPP_CONTEXT( 'S', 'H', 'S', '4'), + idCtxSHA512 = IPP_CONTEXT( 'S', 'H', 'S', '5'), + idCtxMD5 = IPP_CONTEXT( ' ', 'M', 'D', '5'), + idCtxHMAC = IPP_CONTEXT( 'H', 'M', 'A', 'C'), + idCtxDAA = IPP_CONTEXT( ' ', 'D', 'A', 'A'), + idCtxBigNum = IPP_CONTEXT( 'B', 'I', 'G', 'N'), + idCtxMontgomery = IPP_CONTEXT( 'M', 'O', 'N', 'T'), + idCtxPrimeNumber = IPP_CONTEXT( 'P', 'R', 'I', 'M'), + idCtxPRNG = IPP_CONTEXT( 'P', 'R', 'N', 'G'), + idCtxRSA = IPP_CONTEXT( ' ', 'R', 'S', 'A'), + idCtxRSA_PubKey = IPP_CONTEXT( 'R', 'S', 'A', '0'), + idCtxRSA_PrvKey1 = IPP_CONTEXT( 'R', 'S', 'A', '1'), + idCtxRSA_PrvKey2 = IPP_CONTEXT( 'R', 'S', 'A', '2'), + idCtxDSA = IPP_CONTEXT( ' ', 'D', 'S', 'A'), + idCtxECCP = IPP_CONTEXT( ' ', 'E', 'C', 'P'), + idCtxECCB = IPP_CONTEXT( ' ', 'E', 'C', 'B'), + idCtxECCPPoint = IPP_CONTEXT( 'P', 'E', 'C', 'P'), + idCtxECCBPoint = IPP_CONTEXT( 'P', 'E', 'C', 'B'), + idCtxDH = IPP_CONTEXT( ' ', ' ', 'D', 'H'), + idCtxDLP = IPP_CONTEXT( ' ', 'D', 'L', 'P'), + idCtxCMAC = IPP_CONTEXT( 'C', 'M', 'A', 'C'), + idCtxRFFT2_8u, + idCtxHilbert_32f32fc, + idCtxHilbert_16s32fc, + idCtxHilbert_16s16sc, + idCtxTone_16s, + idCtxTriangle_16s, + idCtxDFTOutOrd_C_32fc, + idCtxDFTOutOrd_C_64fc, + idCtxFFT_C_32sc, + idCtxFFT_C_32s, + idCtxFFT_R_32s, + idCtxFFT_R_16s32s, + idCtxDecodeProgr_JPEG2K, + idCtxWarp_MPEG4, + idCtxQuantInvIntra_MPEG4, + idCtxQuantInvInter_MPEG4, + idCtxQuantIntra_MPEG4, + idCtxQuantInter_MPEG4, + idCtxAnalysisFilter_SBR_C_32f32fc, + idCtxAnalysisFilter_SBR_C_32f, + idCtxAnalysisFilter_SBR_R_32f, + idCtxSynthesisFilter_SBR_C_32fc32f, + idCtxSynthesisFilter_SBR_C_32f, + idCtxSynthesisFilter_SBR_R_32f, + idCtxSynthesisDownFilter_SBR_C_32fc32f, + idCtxSynthesisDownFilter_SBR_C_32f, + idCtxSynthesisDownFilter_SBR_R_32f, + idCtxVLCEncode, + idCtxVLCDecode, + idCtxAnalysisFilter_SBR_C_32s32sc, + idCtxAnalysisFilter_SBR_R_32s, + idCtxSynthesisFilter_SBR_C_32sc32s, + idCtxSynthesisFilter_SBR_R_32s, + idCtxSynthesisDownFilter_SBR_C_32sc32s, + idCtxSynthesisDownFilter_SBR_R_32s, + idCtxSynthesisFilter_PQMF_MP3_32f, + idCtxAnalysisFilter_PQMF_MP3_32f, + idCtxResampleRow, + idCtxAnalysisFilter_SBR_Enc_C_32f32fc, + idCtxSynthesisFilter_DTS_32f, + idCtxFilterBilateralGauss_8u, + idCtxFilterBilateralGaussFast_8u, + idCtxBGF, + idCtxPolyGF, + idCtxRSenc, + idCtxRSdec, + idCtxSnow3g = IPP_CONTEXT( 'S', 'n', 'o', 'w'), + idCtxSnow3gF8, + idCtxSnow3gF9, + idCtxKasumi = IPP_CONTEXT( 'K', 'a', 's', 'u'), + idCtxKasumiF8, + idCtxKasumiF9, + idCtxResizeHannFilter_8u, + idCtxResizeLanczosFilter_8u, + idCtxAESXCBC, + idCtxAESCCM, + idCtxAESGCM, + idCtxMsgCatalog, + idCtxGFP, + idCtxGFPE, + idCtxGFPX, + idCtxGFPXE, + idCtxGFPXQX, + idCtxGFPXQXE, + idCtxGFPEC, + idCtxGFPPoint, + idCtxGFPXEC, + idCtxGFPXECPoint, + idCtxPairing, + idCtxResize_32f, + idCtxResizeYUV420, + idCtxResizeYUV422, + idCtxResize_64f, + idCtxFilterBilateralBorder, + idCtxThresholdAdaptiveGauss, + idCtxHOG, + idCtxFastN, + idCtxHash, + idCtxSM3 +} IppCtxId; + + + + +/* ///////////////////////////////////////////////////////////////////////////// + Helpers + /////////////////////////////////////////////////////////////////////////// */ + +#define IPP_NOERROR_RET() return ippStsNoErr +#define IPP_ERROR_RET( ErrCode ) return (ErrCode) + +#ifdef _IPP_DEBUG + + #define IPP_BADARG_RET( expr, ErrCode )\ + {if (expr) { IPP_ERROR_RET( ErrCode ); }} + +#else + + #define IPP_BADARG_RET( expr, ErrCode ) + +#endif + + + #define IPP_BAD_SIZE_RET( n )\ + IPP_BADARG_RET( (n)<=0, ippStsSizeErr ) + + #define IPP_BAD_STEP_RET( n )\ + IPP_BADARG_RET( (n)<=0, ippStsStepErr ) + + #define IPP_BAD_PTR1_RET( ptr )\ + IPP_BADARG_RET( NULL==(ptr), ippStsNullPtrErr ) + + #define IPP_BAD_PTR2_RET( ptr1, ptr2 )\ + {IPP_BAD_PTR1_RET( ptr1 ); IPP_BAD_PTR1_RET( ptr2 )} + + #define IPP_BAD_PTR3_RET( ptr1, ptr2, ptr3 )\ + {IPP_BAD_PTR2_RET( ptr1, ptr2 ); IPP_BAD_PTR1_RET( ptr3 )} + + #define IPP_BAD_PTR4_RET( ptr1, ptr2, ptr3, ptr4 )\ + {IPP_BAD_PTR2_RET( ptr1, ptr2 ); IPP_BAD_PTR2_RET( ptr3, ptr4 )} + + #define IPP_BAD_ISIZE_RET(roi) \ + IPP_BADARG_RET( ((roi).width<=0 || (roi).height<=0), ippStsSizeErr) + +/* ////////////////////////////////////////////////////////////////////////// */ +/* internal messages */ + +#define MSG_LOAD_DLL_ERR (-9700) /* Error at loading of %s library */ +#define MSG_NO_DLL (-9701) /* No DLLs were found in the Waterfall procedure */ +#define MSG_NO_SHARED (-9702) /* No shared libraries were found in the Waterfall procedure */ + +/* ////////////////////////////////////////////////////////////////////////// */ + + +typedef union { /* double precision */ + Ipp64s hex; + Ipp64f fp; +} IppFP_64f; + +typedef union { /* single precision */ + Ipp32s hex; + Ipp32f fp; +} IppFP_32f; + + +extern const IppFP_32f ippConstantOfNAN_32f; +extern const IppFP_64f ippConstantOfNAN_64f; + +extern const IppFP_32f ippConstantOfINF_32f; +extern const IppFP_64f ippConstantOfINF_64f; +extern const IppFP_32f ippConstantOfINF_NEG_32f; +extern const IppFP_64f ippConstantOfINF_NEG_64f; + +#define NAN_32F (ippConstantOfNAN_32f.fp) +#define NAN_64F (ippConstantOfNAN_64f.fp) +#define INF_32F (ippConstantOfINF_32f.fp) +#define INF_64F (ippConstantOfINF_64f.fp) +#define INF_NEG_32F (ippConstantOfINF_NEG_32f.fp) +#define INF_NEG_64F (ippConstantOfINF_NEG_64f.fp) + +/* ////////////////////////////////////////////////////////////////////////// */ + +typedef enum { + ippunreg=-1, + ippac = 0, + ippcc = 1, + ippch = 2, + ippcp = 3, + ippcv = 4, + ippdc = 5, + ippdi = 6, + ippgen = 7, + ippi = 8, + ippj = 9, + ippm = 10, + ippr = 11, + ipps = 12, + ippsc = 13, + ippsr = 14, + ippvc = 15, + ippvm = 16, + ippmsdk = 17, + ippcpepid = 18, + ippe = 19, + ipprs = 20, + ippsq = 21, + ippnomore +} IppDomain; + +int __CDECL ownGetNumThreads( void ); +int __CDECL ownGetFeature( Ipp64u MaskOfFeature ); /* the main function of tick-tock dispatcher */ + +#ifdef _IPP_DYNAMIC +typedef IppStatus (__STDCALL *DYN_RELOAD)( int ); +void __CDECL ownRegisterLib( IppDomain, DYN_RELOAD ); +void __CDECL ownUnregisterLib( IppDomain ); +#endif + +/* the number of threads available for any ipp function that uses OMP; */ +/* at the ippxx.dll loading time is equal to the number of logical processors, */ +/* and can be changed ONLY externally by library user to any desired number */ +/* by means of ippSetNumThreads() function */ +#define IPP_GET_NUM_THREADS() ( ownGetNumThreads() ) +#define IPP_OMP_NUM_THREADS() num_threads( IPP_GET_NUM_THREADS() ) +#define IPP_OMP_LIMIT_MAX_NUM_THREADS(n) num_threads( IPP_MIN(IPP_GET_NUM_THREADS(),(n))) + + +/* ////////////////////////////////////////////////////////////////////////// */ + +/* Define NULL pointer value */ +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define UNREFERENCED_PARAMETER(p) (p)=(p) + +#if defined( _IPP_MARK_LIBRARY ) +static char G[] = {73, 80, 80, 71, 101, 110, 117, 105, 110, 101, 243, 193, 210, 207, 215}; +#endif + + +#define STR2(x) #x +#define STR(x) STR2(x) +#define MESSAGE( desc )\ + message(__FILE__ "(" STR(__LINE__) "):" #desc) + +/* +// endian definition +*/ +#define IPP_LITTLE_ENDIAN (0) +#define IPP_BIG_ENDIAN (1) + +#if defined( _IPP_LE ) + #define IPP_ENDIAN IPP_LITTLE_ENDIAN + +#elif defined( _IPP_BE ) + #define IPP_ENDIAN IPP_BIG_ENDIAN + +#else + #if defined( __ARMEB__ ) + #define IPP_ENDIAN IPP_BIG_ENDIAN + + #else + #define IPP_ENDIAN IPP_LITTLE_ENDIAN + + #endif +#endif + + +/* ////////////////////////////////////////////////////////////////////////// */ + +/* intrinsics */ +#if (_IPP >= _IPP_A6) || (_IPP32E >= _IPP32E_M7) + #if defined(__INTEL_COMPILER) || (_MSC_VER >= 1300) + #if (_IPP == _IPP_A6) + #include "xmmintrin.h" + #elif (_IPP == _IPP_W7) + #if defined(__INTEL_COMPILER) + #include "emmintrin.h" + #else + #undef _W7 + #include "emmintrin.h" + #define _W7 + #endif + #define _mm_loadu _mm_loadu_si128 + #elif (_IPP == _IPP_T7) || (_IPP32E == _IPP32E_M7) + #if defined(__INTEL_COMPILER) + #include "pmmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif + #elif (_IPP == _IPP_V8) || (_IPP32E == _IPP32E_U8) + #if defined(__INTEL_COMPILER) + #include "tmmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif + #elif (_IPP == _IPP_P8) || (_IPP32E == _IPP32E_Y8) + #if defined(__INTEL_COMPILER) + #include "smmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif + #elif (_IPP >= _IPP_G9) || (_IPP32E >= _IPP32E_E9) + #if defined(__INTEL_COMPILER) + #include "immintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 160021003) + #include "immintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #endif + #endif + #endif +#elif (_IPPLP32 >= _IPPLP32_S8) || (_IPPLP64 >= _IPPLP64_N8) + #if defined(__INTEL_COMPILER) + #include "tmmintrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER >= 140050110) + #include "intrin.h" + #define _mm_loadu _mm_lddqu_si128 + #elif (_MSC_FULL_VER < 140050110) + #include "emmintrin.h" + #define _mm_loadu _mm_loadu_si128 + #endif +#elif (_IPPLRB >= _IPPLRB_B2) + #if defined(__INTEL_COMPILER) || defined(_REF_LIB) + #include "immintrin.h" + #endif +#endif + +// **** intrinsics for bit casting **** +#if defined(__INTEL_COMPILER) +extern unsigned int __intel_castf32_u32(float val); +extern float __intel_castu32_f32(unsigned int val); +extern unsigned __int64 __intel_castf64_u64(double val); +extern double __intel_castu64_f64(unsigned __int64 val); + #define __CAST_32f32u(val) __intel_castf32_u32((Ipp32f)val) + #define __CAST_32u32f(val) __intel_castu32_f32((Ipp32u)val) + #define __CAST_64f64u(val) __intel_castf64_u64((Ipp64f)val) + #define __CAST_64u64f(val) __intel_castu64_f64((Ipp64u)val) +#else + #define __CAST_32f32u(val) ( *((Ipp32u*)&val) ) + #define __CAST_32u32f(val) ( *((Ipp32f*)&val) ) + #define __CAST_64f64u(val) ( *((Ipp64u*)&val) ) + #define __CAST_64u64f(val) ( *((Ipp64f*)&val) ) +#endif + + +// short names for vector registers casting +#define _pd2ps _mm_castpd_ps +#define _ps2pd _mm_castps_pd +#define _pd2pi _mm_castpd_si128 +#define _pi2pd _mm_castsi128_pd +#define _ps2pi _mm_castps_si128 +#define _pi2ps _mm_castsi128_ps + +#define _ypd2ypi _mm256_castpd_si256 +#define _ypi2ypd _mm256_castsi256_pd +#define _yps2ypi _mm256_castps_si256 +#define _ypi2yps _mm256_castsi256_ps +#define _ypd2yps _mm256_castpd_ps +#define _yps2ypd _mm256_castps_pd + +#define _yps2ps _mm256_castps256_ps128 +#define _ypi2pi _mm256_castsi256_si128 +#define _ypd2pd _mm256_castpd256_pd128 +#define _ps2yps _mm256_castps128_ps256 +#define _pi2ypi _mm256_castsi128_si256 +#define _pd2ypd _mm256_castpd128_pd256 + + +#if defined(__INTEL_COMPILER) +#define __IVDEP ivdep +#else +#define __IVDEP message("message :: 'ivdep' is not defined") +#endif +//usage: #pragma __IVDEP + +/* ////////////////////////////////////////////////////////////////////////// + _IPP_DATA shoul be defined only: + - if compile not merged library + - only for 1 CPU for merged library to avoid data duplication +*/ +#if defined( _MERGED_BLD ) && ( defined(_G9) || defined(_E9) ) /* compile data only for g9 and e9 CPU */ + #define _IPP_DATA 1 +#elif !defined( _MERGED_BLD ) /* compile data if it isn't merged library */ + #define _IPP_DATA 1 +#endif + + +#if defined( __cplusplus ) +} +#endif + +#endif /* __OWNDEFS_H__ */ + diff --git a/external/crypto_px/sources/ippcp/src/owncp.h b/external/crypto_px/sources/ippcp/src/owncp.h index ec0e3b7d83..5793989761 100644 --- a/external/crypto_px/sources/ippcp/src/owncp.h +++ b/external/crypto_px/sources/ippcp/src/owncp.h @@ -1,149 +1,149 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#ifndef __OWNCP_H__ -#define __OWNCP_H__ - -#ifndef __OWNDEFS_H__ - #include "owndefs.h" -#endif - -#ifndef __IPPCP_H__ - #include "ippcp.h" -#endif - -#pragma warning( disable : 4324) - -/* ippCP length */ -typedef int cpSize; - -/* -// common macros & definitions -*/ - -/* size of cache line (bytes) */ -#define CACHE_LINE_SIZE (64) -#define LOG_CACHE_LINE_SIZE (6) - -/* swap data & pointers */ -#define SWAP_PTR(ATYPE, pX,pY) { ATYPE* aPtr=(pX); (pX)=(pY); (pY)=aPtr; } -#define SWAP(x,y) {(x)^=(y); (y)^=(x); (x)^=(y);} - -/* alignment value */ -#define ALIGN_VAL ((int)sizeof(void*)) - -/* bitsize */ -#define BYTESIZE (8) -#define BITSIZE(x) ((int)(sizeof(x)*BYTESIZE)) - -/* bit length -> byte/word length conversion */ -#define BITS2WORD8_SIZE(x) (((x)+ 7)>>3) -#define BITS2WORD16_SIZE(x) (((x)+15)>>4) -#define BITS2WORD32_SIZE(x) (((x)+31)>>5) -#define BITS2WORD64_SIZE(x) (((x)+63)>>6) - -/* WORD and DWORD manipulators */ -#define LODWORD(x) ((Ipp32u)(x)) -#define HIDWORD(x) ((Ipp32u)(((Ipp64u)(x) >>32) & 0xFFFFFFFF)) - -#define MAKEHWORD(bLo,bHi) ((Ipp16u)(((Ipp8u)(bLo)) | ((Ipp16u)((Ipp8u)(bHi))) << 8)) -#define MAKEWORD(hLo,hHi) ((Ipp32u)(((Ipp16u)(hLo)) | ((Ipp32u)((Ipp16u)(hHi))) << 16)) -#define MAKEDWORD(wLo,wHi) ((Ipp64u)(((Ipp32u)(wLo)) | ((Ipp64u)((Ipp32u)(wHi))) << 32)) - -/* extract byte */ -#define EBYTE(w,n) ((Ipp8u)((w) >> (8 * (n)))) - -/* hexString <-> Ipp32u conversion */ -#define HSTRING_TO_U32(ptrByte) \ - (((ptrByte)[0]) <<24) \ - +(((ptrByte)[1]) <<16) \ - +(((ptrByte)[2]) <<8) \ - +((ptrByte)[3]) -#define U32_TO_HSTRING(ptrByte, x) \ - (ptrByte)[0] = (Ipp8u)((x)>>24); \ - (ptrByte)[1] = (Ipp8u)((x)>>16); \ - (ptrByte)[2] = (Ipp8u)((x)>>8); \ - (ptrByte)[3] = (Ipp8u)(x) - -/* 32- and 64-bit masks for MSB of nbits-sequence */ -#define MAKEMASK32(nbits) (0xFFFFFFFF >>((32 - ((nbits)&0x1F)) &0x1F)) -#define MAKEMASK64(nbits) (0xFFFFFFFFFFFFFFFF >>((64 - ((nbits)&0x3F)) &0x3F)) - -/* Logical Shifts (right and left) of WORD */ -#define LSR32(x,nBits) ((x)>>(nBits)) -#define LSL32(x,nBits) ((x)<<(nBits)) - -/* Rorate (right and left) of WORD */ -#if defined(_MSC_VER) -# include -# define ROR32(x, nBits) _lrotr((x),(nBits)) -# define ROL32(x, nBits) _lrotl((x),(nBits)) -#else -# define ROR32(x, nBits) (LSR32((x),(nBits)) | LSL32((x),32-(nBits))) -# define ROL32(x, nBits) ROR32((x),(32-(nBits))) -#endif - -/* Logical Shifts (right and left) of DWORD */ -#define LSR64(x,nBits) ((x)>>(nBits)) -#define LSL64(x,nBits) ((x)<<(nBits)) - -/* Rorate (right and left) of DWORD */ -#define ROR64(x, nBits) (LSR64((x),(nBits)) | LSL64((x),64-(nBits))) -#define ROL64(x, nBits) ROR64((x),(64-(nBits))) - -/* change endian */ -#if defined(_MSC_VER) -# define ENDIANNESS(x) _byteswap_ulong((x)) -# define ENDIANNESS32(x) ENDIANNESS((x)) -# define ENDIANNESS64(x) _byteswap_uint64((x)) -#else -# define ENDIANNESS(x) ((ROR32((x), 24) & 0x00ff00ff) | (ROR32((x), 8) & 0xff00ff00)) -# define ENDIANNESS32(x) ENDIANNESS((x)) -# define ENDIANNESS64(x) MAKEDWORD(ENDIANNESS(HIDWORD((x))), ENDIANNESS(LODWORD((x)))) -#endif - -#define IPP_MAKE_MULTIPLE_OF_8(x) ((x) = ((x)+7)&(~7)) -#define IPP_MAKE_MULTIPLE_OF_16(x) ((x) = ((x)+15)&(~15)) - -/* 64-bit constant */ -#if !defined(__GNUC__) - #define CONST_64(x) (x) /*(x##i64)*/ -#else - #define CONST_64(x) (x##LL) -#endif - -/* copy under mask */ -#define MASKED_COPY_BNU(dst, mask, src1, src2, len) { \ - cpSize i; \ - for(i=0; i<(len); i++) (dst)[i] = ((mask) & (src1)[i]) | (~(mask) & (src2)[i]); \ -} - -#endif /* __OWNCP_H__ */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#ifndef __OWNCP_H__ +#define __OWNCP_H__ + +#ifndef __OWNDEFS_H__ + #include "owndefs.h" +#endif + +#ifndef __IPPCP_H__ + #include "ippcp.h" +#endif + +#pragma warning( disable : 4324) + +/* ippCP length */ +typedef int cpSize; + +/* +// common macros & definitions +*/ + +/* size of cache line (bytes) */ +#define CACHE_LINE_SIZE (64) +#define LOG_CACHE_LINE_SIZE (6) + +/* swap data & pointers */ +#define SWAP_PTR(ATYPE, pX,pY) { ATYPE* aPtr=(pX); (pX)=(pY); (pY)=aPtr; } +#define SWAP(x,y) {(x)^=(y); (y)^=(x); (x)^=(y);} + +/* alignment value */ +#define ALIGN_VAL ((int)sizeof(void*)) + +/* bitsize */ +#define BYTESIZE (8) +#define BITSIZE(x) ((int)(sizeof(x)*BYTESIZE)) + +/* bit length -> byte/word length conversion */ +#define BITS2WORD8_SIZE(x) (((x)+ 7)>>3) +#define BITS2WORD16_SIZE(x) (((x)+15)>>4) +#define BITS2WORD32_SIZE(x) (((x)+31)>>5) +#define BITS2WORD64_SIZE(x) (((x)+63)>>6) + +/* WORD and DWORD manipulators */ +#define LODWORD(x) ((Ipp32u)(x)) +#define HIDWORD(x) ((Ipp32u)(((Ipp64u)(x) >>32) & 0xFFFFFFFF)) + +#define MAKEHWORD(bLo,bHi) ((Ipp16u)(((Ipp8u)(bLo)) | ((Ipp16u)((Ipp8u)(bHi))) << 8)) +#define MAKEWORD(hLo,hHi) ((Ipp32u)(((Ipp16u)(hLo)) | ((Ipp32u)((Ipp16u)(hHi))) << 16)) +#define MAKEDWORD(wLo,wHi) ((Ipp64u)(((Ipp32u)(wLo)) | ((Ipp64u)((Ipp32u)(wHi))) << 32)) + +/* extract byte */ +#define EBYTE(w,n) ((Ipp8u)((w) >> (8 * (n)))) + +/* hexString <-> Ipp32u conversion */ +#define HSTRING_TO_U32(ptrByte) \ + (((ptrByte)[0]) <<24) \ + +(((ptrByte)[1]) <<16) \ + +(((ptrByte)[2]) <<8) \ + +((ptrByte)[3]) +#define U32_TO_HSTRING(ptrByte, x) \ + (ptrByte)[0] = (Ipp8u)((x)>>24); \ + (ptrByte)[1] = (Ipp8u)((x)>>16); \ + (ptrByte)[2] = (Ipp8u)((x)>>8); \ + (ptrByte)[3] = (Ipp8u)(x) + +/* 32- and 64-bit masks for MSB of nbits-sequence */ +#define MAKEMASK32(nbits) (0xFFFFFFFF >>((32 - ((nbits)&0x1F)) &0x1F)) +#define MAKEMASK64(nbits) (0xFFFFFFFFFFFFFFFF >>((64 - ((nbits)&0x3F)) &0x3F)) + +/* Logical Shifts (right and left) of WORD */ +#define LSR32(x,nBits) ((x)>>(nBits)) +#define LSL32(x,nBits) ((x)<<(nBits)) + +/* Rorate (right and left) of WORD */ +#if defined(_MSC_VER) +# include +# define ROR32(x, nBits) _lrotr((x),(nBits)) +# define ROL32(x, nBits) _lrotl((x),(nBits)) +#else +# define ROR32(x, nBits) (LSR32((x),(nBits)) | LSL32((x),32-(nBits))) +# define ROL32(x, nBits) ROR32((x),(32-(nBits))) +#endif + +/* Logical Shifts (right and left) of DWORD */ +#define LSR64(x,nBits) ((x)>>(nBits)) +#define LSL64(x,nBits) ((x)<<(nBits)) + +/* Rorate (right and left) of DWORD */ +#define ROR64(x, nBits) (LSR64((x),(nBits)) | LSL64((x),64-(nBits))) +#define ROL64(x, nBits) ROR64((x),(64-(nBits))) + +/* change endian */ +#if defined(_MSC_VER) +# define ENDIANNESS(x) _byteswap_ulong((x)) +# define ENDIANNESS32(x) ENDIANNESS((x)) +# define ENDIANNESS64(x) _byteswap_uint64((x)) +#else +# define ENDIANNESS(x) ((ROR32((x), 24) & 0x00ff00ff) | (ROR32((x), 8) & 0xff00ff00)) +# define ENDIANNESS32(x) ENDIANNESS((x)) +# define ENDIANNESS64(x) MAKEDWORD(ENDIANNESS(HIDWORD((x))), ENDIANNESS(LODWORD((x)))) +#endif + +#define IPP_MAKE_MULTIPLE_OF_8(x) ((x) = ((x)+7)&(~7)) +#define IPP_MAKE_MULTIPLE_OF_16(x) ((x) = ((x)+15)&(~15)) + +/* 64-bit constant */ +#if !defined(__GNUC__) + #define CONST_64(x) (x) /*(x##i64)*/ +#else + #define CONST_64(x) (x##LL) +#endif + +/* copy under mask */ +#define MASKED_COPY_BNU(dst, mask, src1, src2, len) { \ + cpSize i; \ + for(i=0; i<(len); i++) (dst)[i] = ((mask) & (src1)[i]) | (~(mask) & (src2)[i]); \ +} + +#endif /* __OWNCP_H__ */ diff --git a/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c b/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c index 8c4d24bc5e..0443664763 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c +++ b/external/crypto_px/sources/ippcp/src/pcpaesauthcmacca.c @@ -1,396 +1,396 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpcmac.h" -#include "pcpaesm.h" -#include "pcptool.h" - -#include "pcprijtables.h" - -/*F* -// Name: ippsAES_CMACGetSize -// -// Purpose: Returns size of AES-CMAC context (in bytes). -// -// Returns: Reason: -// ippStsNullPtrErr pSzie == NULL -// ippStsNoErr no errors -// -// Parameters: -// pSize pointer to the AES-CMAC size of context -// -*F*/ -static int cpSizeofCtx_AESCMAC(void) -{ - return sizeof(IppsAES_CMACState) + AESCMAC_ALIGNMENT-1; -} - -IPPFUN(IppStatus, ippsAES_CMACGetSize,(int* pSize)) -{ - /* test size's pointer */ - IPP_BAD_PTR1_RET(pSize); - - *pSize = cpSizeofCtx_AESCMAC(); - - return ippStsNoErr; -} - - -/*F* -// Name: ippsAES_CMACInit -// -// Purpose: Init AES-CMAC context. -// -// Returns: Reason: -// ippStsNullPtrErr pCtx == NULL -// ippStsMemAllocErr size of buffer is not match fro operation -// ippStsLengthErr keyLen != 16 -// keyLen != 24 -// keyLen != 32 -// ippStsNoErr no errors -// -// Parameters: -// pKey pointer to the secret key -// keyLen length of secret key -// pCtx pointer to the CMAC context -// ctxSize available size (in bytes) of buffer above -// -*F*/ -static -void init(IppsAES_CMACState* pCtx) -{ - /* buffer is empty */ - CMAC_INDX(pCtx) = 0; - /* zeros MAC */ - PaddBlock(0, CMAC_MAC(pCtx), MBS_RIJ128); -} - -static -void LogicalLeftSift16(const Ipp8u* pSrc, Ipp8u* pDst) -{ - Ipp32u carry = 0; - int n; - for(n=0; n<16; n++) { - Ipp32u x = pSrc[16-1-n] + pSrc[16-1-n] + carry; - pDst[16-1-n] = (Ipp8u)x; - carry = (x>>8) & 0xFF; - } -} - -IPPFUN(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pCtx, int ctxSize)) -{ - /* test pCtx pointer */ - IPP_BAD_PTR1_RET(pCtx); - - /* test available size of context buffer */ - IPP_BADARG_RET(ctxSize>7)) & 0x87); /* ^ Rb changed for constant time execution */ - - /* precompute k2 subkey */ - msb = (CMAC_K1(pCtx))[0]; - LogicalLeftSift16(CMAC_K1(pCtx),CMAC_K2(pCtx)); - (CMAC_K2(pCtx))[MBS_RIJ128-1] ^= (Ipp8u)((0-(msb>>7)) & 0x87); /* ^ Rb changed for constant time execution */ - } - - return sts; - } -} - - -/*F* -// Name: ippsAES_CMACUpdate -// -// Purpose: Updates intermadiate digest based on input stream. -// -// Returns: Reason: -// ippStsNullPtrErr pSrc == NULL -// pCtx == NULL -// ippStsContextMatchErr !VALID_AESCMAC_ID() -// ippStsLengthErr len <0 -// ippStsNoErr no errors -// -// Parameters: -// pSrc pointer to the input stream -// len input stream length -// pCtx pointer to the CMAC context -// -*F*/ -static -void AES_CMAC_processing(Ipp8u* pDigest, const Ipp8u* pSrc, int processedLen, const IppsAESSpec* pAES) -{ - /* setup encoder method */ - RijnCipher encoder = RIJ_ENCODER(pAES); - - while(processedLen) { - ((Ipp32u*)pDigest)[0] ^= ((Ipp32u*)pSrc)[0]; - ((Ipp32u*)pDigest)[1] ^= ((Ipp32u*)pSrc)[1]; - ((Ipp32u*)pDigest)[2] ^= ((Ipp32u*)pSrc)[2]; - ((Ipp32u*)pDigest)[3] ^= ((Ipp32u*)pSrc)[3]; - - encoder(pDigest, pDigest, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - - pSrc += MBS_RIJ128; - processedLen -= MBS_RIJ128; - } -} - -IPPFUN(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx)) -{ - int processedLen; - - /* test context pointer */ - IPP_BAD_PTR1_RET(pCtx); - /* use aligned context */ - pCtx = (IppsAES_CMACState*)( IPP_ALIGNED_PTR(pCtx, AESCMAC_ALIGNMENT) ); - - /* test ID */ - IPP_BADARG_RET(!VALID_AESCMAC_ID(pCtx), ippStsContextMatchErr); - /* test input message and it's length */ - IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr); - /* test source pointer */ - IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); - - if(!len) - return ippStsNoErr; - - { - /* - // test internal buffer filling - */ - if(CMAC_INDX(pCtx)) { - /* copy from input stream to the internal buffer as match as possible */ - processedLen = IPP_MIN(len, (MBS_RIJ128 - CMAC_INDX(pCtx))); - CopyBlock(pSrc, CMAC_BUFF(pCtx)+CMAC_INDX(pCtx), processedLen); - - /* internal buffer filling */ - CMAC_INDX(pCtx) += processedLen; - - /* update message pointer and length */ - pSrc += processedLen; - len -= processedLen; - - if(!len) - return ippStsNoErr; - - /* update CMAC if buffer full but not the last */ - if(MBS_RIJ128==CMAC_INDX(pCtx) ) { - const IppsAESSpec* pAES = &CMAC_CIPHER(pCtx); - /* setup encoder method */ - RijnCipher encoder = RIJ_ENCODER(pAES); - XorBlock16(CMAC_BUFF(pCtx), CMAC_MAC(pCtx), CMAC_MAC(pCtx)); - - encoder(CMAC_MAC(pCtx), CMAC_MAC(pCtx), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - - CMAC_INDX(pCtx) = 0; - } - } - - /* - // main part - */ - processedLen = len & ~(MBS_RIJ128-1); - if(!(len & (MBS_RIJ128-1))) - processedLen -= MBS_RIJ128; - if(processedLen) { - const IppsAESSpec* pAES = &CMAC_CIPHER(pCtx); - - AES_CMAC_processing(CMAC_MAC(pCtx), pSrc, processedLen, pAES); - - /* update message pointer and length */ - pSrc += processedLen; - len -= processedLen; - } - - /* - // remaind - */ - if(len) { - CopyBlock(pSrc, (Ipp8u*)(&CMAC_BUFF(pCtx)), len); - /* update internal buffer filling */ - CMAC_INDX(pCtx) += len; - } - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsAES_CMACFinal -// -// Purpose: Stop message digesting and return MD. -// -// Returns: Reason: -// ippStsNullPtrErr pMD == NULL -// pCtx == NULL -// ippStsContextMatchErr !VALID_AESCMAC_ID() -// ippStsLengthErr MBS_RIJ128 < mdLen <1 -// ippStsNoErr no errors -// -// Parameters: -// pMD pointer to the output message digest -// mdLen requested length of the message digest -// pCtx pointer to the CMAC context -// -*F*/ -IPPFUN(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pCtx)) -{ - /* test context pointer and ID */ - IPP_BAD_PTR1_RET(pCtx); - /* use aligned context */ - pCtx = (IppsAES_CMACState*)( IPP_ALIGNED_PTR(pCtx, AESCMAC_ALIGNMENT) ); - - IPP_BADARG_RET(!VALID_AESCMAC_ID(pCtx), ippStsContextMatchErr); - /* test DAC pointer */ - IPP_BAD_PTR1_RET(pMD); - IPP_BADARG_RET((mdLen<1)||(MBS_RIJ128>8) & 0xFF; + } +} + +IPPFUN(IppStatus, ippsAES_CMACInit,(const Ipp8u* pKey, int keyLen, IppsAES_CMACState* pCtx, int ctxSize)) +{ + /* test pCtx pointer */ + IPP_BAD_PTR1_RET(pCtx); + + /* test available size of context buffer */ + IPP_BADARG_RET(ctxSize>7)) & 0x87); /* ^ Rb changed for constant time execution */ + + /* precompute k2 subkey */ + msb = (CMAC_K1(pCtx))[0]; + LogicalLeftSift16(CMAC_K1(pCtx),CMAC_K2(pCtx)); + (CMAC_K2(pCtx))[MBS_RIJ128-1] ^= (Ipp8u)((0-(msb>>7)) & 0x87); /* ^ Rb changed for constant time execution */ + } + + return sts; + } +} + + +/*F* +// Name: ippsAES_CMACUpdate +// +// Purpose: Updates intermadiate digest based on input stream. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pCtx == NULL +// ippStsContextMatchErr !VALID_AESCMAC_ID() +// ippStsLengthErr len <0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the input stream +// len input stream length +// pCtx pointer to the CMAC context +// +*F*/ +static +void AES_CMAC_processing(Ipp8u* pDigest, const Ipp8u* pSrc, int processedLen, const IppsAESSpec* pAES) +{ + /* setup encoder method */ + RijnCipher encoder = RIJ_ENCODER(pAES); + + while(processedLen) { + ((Ipp32u*)pDigest)[0] ^= ((Ipp32u*)pSrc)[0]; + ((Ipp32u*)pDigest)[1] ^= ((Ipp32u*)pSrc)[1]; + ((Ipp32u*)pDigest)[2] ^= ((Ipp32u*)pSrc)[2]; + ((Ipp32u*)pDigest)[3] ^= ((Ipp32u*)pSrc)[3]; + + encoder(pDigest, pDigest, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + pSrc += MBS_RIJ128; + processedLen -= MBS_RIJ128; + } +} + +IPPFUN(IppStatus, ippsAES_CMACUpdate,(const Ipp8u* pSrc, int len, IppsAES_CMACState* pCtx)) +{ + int processedLen; + + /* test context pointer */ + IPP_BAD_PTR1_RET(pCtx); + /* use aligned context */ + pCtx = (IppsAES_CMACState*)( IPP_ALIGNED_PTR(pCtx, AESCMAC_ALIGNMENT) ); + + /* test ID */ + IPP_BADARG_RET(!VALID_AESCMAC_ID(pCtx), ippStsContextMatchErr); + /* test input message and it's length */ + IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr); + /* test source pointer */ + IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); + + if(!len) + return ippStsNoErr; + + { + /* + // test internal buffer filling + */ + if(CMAC_INDX(pCtx)) { + /* copy from input stream to the internal buffer as match as possible */ + processedLen = IPP_MIN(len, (MBS_RIJ128 - CMAC_INDX(pCtx))); + CopyBlock(pSrc, CMAC_BUFF(pCtx)+CMAC_INDX(pCtx), processedLen); + + /* internal buffer filling */ + CMAC_INDX(pCtx) += processedLen; + + /* update message pointer and length */ + pSrc += processedLen; + len -= processedLen; + + if(!len) + return ippStsNoErr; + + /* update CMAC if buffer full but not the last */ + if(MBS_RIJ128==CMAC_INDX(pCtx) ) { + const IppsAESSpec* pAES = &CMAC_CIPHER(pCtx); + /* setup encoder method */ + RijnCipher encoder = RIJ_ENCODER(pAES); + XorBlock16(CMAC_BUFF(pCtx), CMAC_MAC(pCtx), CMAC_MAC(pCtx)); + + encoder(CMAC_MAC(pCtx), CMAC_MAC(pCtx), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + CMAC_INDX(pCtx) = 0; + } + } + + /* + // main part + */ + processedLen = len & ~(MBS_RIJ128-1); + if(!(len & (MBS_RIJ128-1))) + processedLen -= MBS_RIJ128; + if(processedLen) { + const IppsAESSpec* pAES = &CMAC_CIPHER(pCtx); + + AES_CMAC_processing(CMAC_MAC(pCtx), pSrc, processedLen, pAES); + + /* update message pointer and length */ + pSrc += processedLen; + len -= processedLen; + } + + /* + // remaind + */ + if(len) { + CopyBlock(pSrc, (Ipp8u*)(&CMAC_BUFF(pCtx)), len); + /* update internal buffer filling */ + CMAC_INDX(pCtx) += len; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_CMACFinal +// +// Purpose: Stop message digesting and return MD. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pCtx == NULL +// ippStsContextMatchErr !VALID_AESCMAC_ID() +// ippStsLengthErr MBS_RIJ128 < mdLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pMD pointer to the output message digest +// mdLen requested length of the message digest +// pCtx pointer to the CMAC context +// +*F*/ +IPPFUN(IppStatus, ippsAES_CMACFinal,(Ipp8u* pMD, int mdLen, IppsAES_CMACState* pCtx)) +{ + /* test context pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + /* use aligned context */ + pCtx = (IppsAES_CMACState*)( IPP_ALIGNED_PTR(pCtx, AESCMAC_ALIGNMENT) ); + + IPP_BADARG_RET(!VALID_AESCMAC_ID(pCtx), ippStsContextMatchErr); + /* test DAC pointer */ + IPP_BAD_PTR1_RET(pMD); + IPP_BADARG_RET((mdLen<1)||(MBS_RIJ128idCtx) -#define AESGCM_STATE(stt) ((stt)->state) - -#define AESGCM_IV_LEN(stt) ((stt)->ivLen) -#define AESGCM_AAD_LEN(stt) ((stt)->aadLen) -#define AESGCM_TXT_LEN(stt) ((stt)->txtLen) - -#define AESGCM_BUFLEN(stt) ((stt)->bufLen) -#define AESGCM_COUNTER(stt) ((stt)->counter) -#define AESGCM_ECOUNTER0(stt) ((stt)->ecounter0) -#define AESGCM_ECOUNTER(stt) ((stt)->ecounter) -#define AESGCM_GHASH(stt) ((stt)->ghash) - -#define AESGCM_HASH(stt) ((stt)->hashFun) -#define AESGCM_AUTH(stt) ((stt)->authFun) -#define AESGCM_ENC(stt) ((stt)->encFun) -#define AESGCM_DEC(stt) ((stt)->decFun) - -#define AESGCM_CIPHER(stt) (IppsAESSpec*)(&((stt)->cipher)) - -#define AESGCM_HKEY(stt) ((stt)->multiplier) -#define AESGCM_CPWR(stt) ((stt)->multiplier) -#define AES_GCM_MTBL(stt) ((stt)->multiplier) - -#define AESGCM_VALID_ID(stt) (AESGCM_ID((stt))==idCtxAESGCM) - - -__INLINE void IncrementCounter32(Ipp8u* pCtr) -{ - int i; - for(i=BLOCK_SIZE-1; i>=CTR_POS && 0==(Ipp8u)(++pCtr[i]); i--) ; -} - - -void AesGcmPrecompute_table2K(Ipp8u* pPrecomputeData, const Ipp8u* pHKey); -void AesGcmMulGcm_table2K(Ipp8u* pGhash, const Ipp8u* pHkey, const void* pParam); -void AesGcmAuth_table2K(Ipp8u* pGhash, const Ipp8u* pSrc, int len, const Ipp8u* pHkey, const void* pParam); -void wrpAesGcmEnc_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); -void wrpAesGcmDec_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); - -extern const Ipp16u AesGcmConst_table[256]; /* precomputed reduction table */ - -#endif /* _CP_AESAUTH_GCM_H*/ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_AESAUTH_GCM_H) +#define _CP_AESAUTH_GCM_H + +#include "owndefs.h" +#include "owncp.h" +#include "pcpaesm.h" + +#define BLOCK_SIZE (MBS_RIJ128) + +/* GCM Hash prototype: GHash = GHash*HKey mod G() */ +typedef void (*MulGcm_)(Ipp8u* pGHash, const Ipp8u* pHKey, const void* pParam); + +/* GCM Authentication prototype: GHash = (GHash^src[])*HKey mod G() */ +typedef void (*Auth_)(Ipp8u* pHash, const Ipp8u* pSrc, int len, const Ipp8u* pHKey, const void* pParam); + +/* GCM Encrypt_Authentication prototype */ +typedef void (*Encrypt_)(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); + +/* GCM Authentication_Decrypt prototype */ +typedef void (*Decrypt_)(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); + +typedef enum { + GcmInit, + GcmIVprocessing, + GcmAADprocessing, + GcmTXTprocessing +} GcmState; + +struct _cpAES_GCM { + IppCtxId idCtx; /* AES-GCM id */ + GcmState state; /* GCM state: Init, IV|AAD|TXT proccessing */ + Ipp64u ivLen; /* IV length (bytes) */ + Ipp64u aadLen; /* header length (bytes) */ + Ipp64u txtLen; /* text length (bytes) */ + + int bufLen; /* staff buffer length */ + __ALIGN16 /* aligned buffers */ + Ipp8u counter[BLOCK_SIZE]; /* counter */ + Ipp8u ecounter0[BLOCK_SIZE]; /* encrypted initial counter */ + Ipp8u ecounter[BLOCK_SIZE]; /* encrypted counter */ + Ipp8u ghash[BLOCK_SIZE]; /* ghash accumulator */ + + MulGcm_ hashFun; /* AES-GCM mul function */ + Auth_ authFun; /* authentication function */ + Encrypt_ encFun; /* encryption & authentication */ + Decrypt_ decFun; /* authentication & decryption */ + + __ALIGN16 /* aligned AES context */ + IppsAESSpec cipher; + + __ALIGN16 /* aligned pre-computed data: */ + Ipp8u multiplier[BLOCK_SIZE]; /* - (default) hKey */ + /* - (ase_ni) hKey*t, (hKey*t)^2, (hKey*t)^4 */ + /* - (safe) hKey*(t^i), i=0,...,127 */ +}; + +#define CTR_POS 12 + +/* alignment */ +#define AESGCM_ALIGNMENT (16) + +#define PRECOMP_DATA_SIZE_AES_NI_AESGCM (BLOCK_SIZE*4) +#define PRECOMP_DATA_SIZE_FAST2K (BLOCK_SIZE*128) + +/* +// Useful macros +*/ +#define AESGCM_ID(stt) ((stt)->idCtx) +#define AESGCM_STATE(stt) ((stt)->state) + +#define AESGCM_IV_LEN(stt) ((stt)->ivLen) +#define AESGCM_AAD_LEN(stt) ((stt)->aadLen) +#define AESGCM_TXT_LEN(stt) ((stt)->txtLen) + +#define AESGCM_BUFLEN(stt) ((stt)->bufLen) +#define AESGCM_COUNTER(stt) ((stt)->counter) +#define AESGCM_ECOUNTER0(stt) ((stt)->ecounter0) +#define AESGCM_ECOUNTER(stt) ((stt)->ecounter) +#define AESGCM_GHASH(stt) ((stt)->ghash) + +#define AESGCM_HASH(stt) ((stt)->hashFun) +#define AESGCM_AUTH(stt) ((stt)->authFun) +#define AESGCM_ENC(stt) ((stt)->encFun) +#define AESGCM_DEC(stt) ((stt)->decFun) + +#define AESGCM_CIPHER(stt) (IppsAESSpec*)(&((stt)->cipher)) + +#define AESGCM_HKEY(stt) ((stt)->multiplier) +#define AESGCM_CPWR(stt) ((stt)->multiplier) +#define AES_GCM_MTBL(stt) ((stt)->multiplier) + +#define AESGCM_VALID_ID(stt) (AESGCM_ID((stt))==idCtxAESGCM) + + +__INLINE void IncrementCounter32(Ipp8u* pCtr) +{ + int i; + for(i=BLOCK_SIZE-1; i>=CTR_POS && 0==(Ipp8u)(++pCtr[i]); i--) ; +} + + +void AesGcmPrecompute_table2K(Ipp8u* pPrecomputeData, const Ipp8u* pHKey); +void AesGcmMulGcm_table2K(Ipp8u* pGhash, const Ipp8u* pHkey, const void* pParam); +void AesGcmAuth_table2K(Ipp8u* pGhash, const Ipp8u* pSrc, int len, const Ipp8u* pHkey, const void* pParam); +void wrpAesGcmEnc_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); +void wrpAesGcmDec_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pCtx); + +extern const Ipp16u AesGcmConst_table[256]; /* precomputed reduction table */ + +#endif /* _CP_AESAUTH_GCM_H*/ diff --git a/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c b/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c index c48b66f302..bf8d8264b4 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c +++ b/external/crypto_px/sources/ippcp/src/pcpaesauthgcmca.c @@ -1,731 +1,731 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" - -#include "pcpaesauthgcm.h" -#include "pcptool.h" - -#include "pcprijtables.h" - -/*F* -// Name: ippsAES_GCMGetSize -// -// Purpose: Returns size of AES_GCM state (in bytes). -// -// Returns: Reason: -// ippStsNullPtrErr pSize == NULL -// ippStsNoErr no errors -// -// Parameters: -// pSize pointer to size of context -// -*F*/ -static int cpSizeofCtx_AESGCM(void) -{ - int precomp_size; - - precomp_size = PRECOMP_DATA_SIZE_FAST2K; - - /* decrease precomp_size as soon as BLOCK_SIZE bytes already reserved in context */ - precomp_size -= BLOCK_SIZE; - - return sizeof(IppsAES_GCMState) - +precomp_size - +AESGCM_ALIGNMENT-1; -} - -IPPFUN(IppStatus, ippsAES_GCMGetSize,(int* pSize)) -{ - /* test size's pointer */ - IPP_BAD_PTR1_RET(pSize); - - *pSize = cpSizeofCtx_AESGCM(); - - return ippStsNoErr; -} - - -/*F* -// Name: ippsAES_GCMReset -// -// Purpose: Resets AES_GCM context. -// -// Returns: Reason: -// ippStsNullPtrErr pState== NULL -// ippStsContextMatchErr pState points on invalid context -// ippStsNoErr no errors -// -// Parameters: -// pState pointer to the context -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState)) -{ - /* test pState pointer */ - IPP_BAD_PTR1_RET(pState); - - /* use aligned context */ - pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); - /* test context validity */ - IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); - - /* reset GCM */ - AESGCM_STATE(pState) = GcmInit; - AESGCM_IV_LEN(pState) = CONST_64(0); - AESGCM_AAD_LEN(pState) = CONST_64(0); - AESGCM_TXT_LEN(pState) = CONST_64(0); - - AESGCM_BUFLEN(pState) = 0; - PaddBlock(0, AESGCM_COUNTER(pState), BLOCK_SIZE); - PaddBlock(0, AESGCM_ECOUNTER(pState), BLOCK_SIZE); - PaddBlock(0, AESGCM_ECOUNTER0(pState), BLOCK_SIZE); - PaddBlock(0, AESGCM_GHASH(pState), BLOCK_SIZE); - - return ippStsNoErr; -} - - -/*F* -// Name: ippsAES_GCMInit -// -// Purpose: Init AES_GCM context for future usage. -// -// Returns: Reason: -// ippStsNullPtrErr pState == NULL -// ippStsMemAllocErr size of buffer is not match fro operation -// ippStsLengthErr keyLen != 16 && -// != 24 && -// != 32 -// ippStsNoErr no errors -// -// Parameters: -// pKey pointer to the secret key -// keyLen length of secret key -// pState pointer to the AES-GCM context -// ctxSize available size (in bytes) of buffer above -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) -{ - /* test pCtx pointer */ - IPP_BAD_PTR1_RET(pState); - - /* test available size of context buffer */ - IPP_BADARG_RET(ctxSize0 -// ippStsContextMatchErr !AESGCM_VALID_ID() -// ippStsLengthErr ivLen <0 -// ippStsBadArgErr illegal sequence call -// ippStsNoErr no errors -// -// Parameters: -// pIV pointer to the IV -// ivLen length of IV (it could be 0) -// pState pointer to the context -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) -{ - /* test pState pointer */ - IPP_BAD_PTR1_RET(pState); - - /* test IV pointer and length */ - IPP_BADARG_RET(ivLen && !pIV, ippStsNullPtrErr); - IPP_BADARG_RET(ivLen<0, ippStsLengthErr); - - /* use aligned context */ - pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); - /* test context validity */ - IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); - - IPP_BADARG_RET(!(GcmInit==AESGCM_STATE(pState) || GcmIVprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); - - /* switch IVprocessing on */ - AESGCM_STATE(pState) = GcmIVprocessing; - - /* test if buffer is not empty */ - if(AESGCM_BUFLEN(pState)) { - int locLen = IPP_MIN(ivLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); - XorBlock(pIV, AESGCM_COUNTER(pState)+AESGCM_BUFLEN(pState), AESGCM_COUNTER(pState)+AESGCM_BUFLEN(pState), locLen); - AESGCM_BUFLEN(pState) += locLen; - - /* if buffer full */ - if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { - MulGcm_ ghashFunc = AESGCM_HASH(pState); - ghashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); - AESGCM_BUFLEN(pState) = 0; - } - - AESGCM_IV_LEN(pState) += locLen; - pIV += locLen; - ivLen -= locLen; - } - - /* process main part of IV */ - { - int lenBlks = ivLen & (-BLOCK_SIZE); - if(lenBlks) { - Auth_ authFunc = AESGCM_AUTH(pState); - - authFunc(AESGCM_COUNTER(pState), pIV, lenBlks, AESGCM_HKEY(pState), AesGcmConst_table); - - AESGCM_IV_LEN(pState) += lenBlks; - pIV += lenBlks; - ivLen -= lenBlks; - } - } - - /* copy the rest of IV into the buffer */ - if(ivLen) { - XorBlock(pIV, AESGCM_COUNTER(pState), AESGCM_COUNTER(pState), ivLen); - AESGCM_IV_LEN(pState) += ivLen; - AESGCM_BUFLEN(pState) += ivLen; - } - - return ippStsNoErr; -} - - -/*F* -// Name: ippsAES_GCMProcessAAD -// -// Purpose: AAD processing. -// -// Returns: Reason: -// ippStsNullPtrErr pState == NULL -// pAAD == NULL, aadLen>0 -// ippStsContextMatchErr !AESGCM_VALID_ID() -// ippStsLengthErr aadLen <0 -// ippStsBadArgErr illegal sequence call -// ippStsNoErr no errors -// -// Parameters: -// pAAD pointer to the AAD -// aadlen length of AAD (it could be 0) -// pState pointer to the context -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) -{ - /* test pState pointer */ - IPP_BAD_PTR1_RET(pState); - /* use aligned context */ - pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); - /* test if context is valid */ - IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); - - /* test AAD pointer and length */ - IPP_BADARG_RET(aadLen && !pAAD, ippStsNullPtrErr); - IPP_BADARG_RET(aadLen<0, ippStsLengthErr); - - IPP_BADARG_RET(!(GcmIVprocessing==AESGCM_STATE(pState) || GcmAADprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); - - { - /* get method */ - MulGcm_ hashFunc = AESGCM_HASH(pState); - - if( GcmIVprocessing==AESGCM_STATE(pState) ) { - IPP_BADARG_RET(0==AESGCM_IV_LEN(pState), ippStsBadArgErr); - - /* complete IV processing */ - if(CTR_POS==AESGCM_IV_LEN(pState)) { - /* apply special format if IV length is 12 bytes */ - AESGCM_COUNTER(pState)[12] = 0; - AESGCM_COUNTER(pState)[13] = 0; - AESGCM_COUNTER(pState)[14] = 0; - AESGCM_COUNTER(pState)[15] = 1; - } - else { - /* process the rest of IV */ - if(AESGCM_BUFLEN(pState)) - hashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); - - /* add IV bit length */ - { - Ipp64u ivBitLen = AESGCM_IV_LEN(pState)*BYTESIZE; - Ipp8u tmp[BLOCK_SIZE]; - PaddBlock(0, tmp, BLOCK_SIZE-8); - U32_TO_HSTRING(tmp+8, HIDWORD(ivBitLen)); - U32_TO_HSTRING(tmp+12, LODWORD(ivBitLen)); - XorBlock16(tmp, AESGCM_COUNTER(pState), AESGCM_COUNTER(pState)); - hashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); - } - } - - /* prepare initial counter */ - { - IppsAESSpec* pAES = AESGCM_CIPHER(pState); - RijnCipher encoder = RIJ_ENCODER(pAES); - encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER0(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - } - - /* switch mode and init counters */ - AESGCM_STATE(pState) = GcmAADprocessing; - AESGCM_AAD_LEN(pState) = CONST_64(0); - AESGCM_BUFLEN(pState) = 0; - } - - /* - // AAD processing - */ - - /* test if buffer is not empty */ - if(AESGCM_BUFLEN(pState)) { - int locLen = IPP_MIN(aadLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); - XorBlock(pAAD, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); - AESGCM_BUFLEN(pState) += locLen; - - /* if buffer full */ - if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { - hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); - AESGCM_BUFLEN(pState) = 0; - } - - AESGCM_AAD_LEN(pState) += locLen; - pAAD += locLen; - aadLen -= locLen; - } - - /* process main part of AAD */ - { - int lenBlks = aadLen & (-BLOCK_SIZE); - if(lenBlks) { - Auth_ authFunc = AESGCM_AUTH(pState); - - authFunc(AESGCM_GHASH(pState), pAAD, lenBlks, AESGCM_HKEY(pState), AesGcmConst_table); - - AESGCM_AAD_LEN(pState) += lenBlks; - pAAD += lenBlks; - aadLen -= lenBlks; - } - } - - /* copy the rest of AAD into the buffer */ - if(aadLen) { - XorBlock(pAAD, AESGCM_GHASH(pState), AESGCM_GHASH(pState), aadLen); - AESGCM_AAD_LEN(pState) += aadLen; - AESGCM_BUFLEN(pState) = aadLen; - } - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsAES_GCMStart -// -// Purpose: Start the process of encryption or decryption and authentication tag generation. -// -// Returns: Reason: -// ippStsNullPtrErr pState == NULL -// pIV == NULL, ivLen>0 -// pAAD == NULL, aadLen>0 -// ippStsContextMatchErr !AESGCM_VALID_ID() -// ippStsLengthErr ivLen < 0 -// aadLen < 0 -// ippStsNoErr no errors -// -// Parameters: -// pIV pointer to the IV (nonce) -// ivLen length of the IV in bytes -// pAAD pointer to the Addition Authenticated Data (header) -// aadLen length of the AAD in bytes -// pState pointer to the AES-GCM state -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, - const Ipp8u* pAAD, int aadLen, - IppsAES_GCMState* pState)) -{ - IppStatus sts = ippsAES_GCMReset(pState); - if(ippStsNoErr==sts) - sts = ippsAES_GCMProcessIV(pIV, ivLen, pState); - if(ippStsNoErr==sts) - sts = ippsAES_GCMProcessAAD(pAAD, aadLen, pState); - return sts; -} - - -/*F* -// Name: ippsAES_GCMEncrypt -// -// Purpose: Encrypts a data buffer in the GCM mode. -// -// Returns: Reason: -// ippStsNullPtrErr pSrc == NULL -// pDst == NULL -// pState == NULL -// ippStsContextMatchErr !AESGCM_VALID_ID() -// ippStsLengthErr txtLen<0 -// ippStsNoErr no errors -// -// Parameters: -// pSrc Pointer to plaintext. -// pDst Pointer to ciphertext. -// len Length of the plaintext and ciphertext in bytes -// pState pointer to the context -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int txtLen, - IppsAES_GCMState* pState)) -{ - /* test pState pointer */ - IPP_BAD_PTR1_RET(pState); - /* use aligned context */ - pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); - /* test state ID */ - IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); - /* test context validity */ - IPP_BADARG_RET(!(GcmAADprocessing==AESGCM_STATE(pState) || GcmTXTprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); - - /* test text pointers and length */ - IPP_BAD_PTR2_RET(pSrc, pDst); - IPP_BADARG_RET(txtLen<0, ippStsLengthErr); - - - { - /* get method */ - IppsAESSpec* pAES = AESGCM_CIPHER(pState); - RijnCipher encoder = RIJ_ENCODER(pAES); - MulGcm_ hashFunc = AESGCM_HASH(pState); - - if( GcmAADprocessing==AESGCM_STATE(pState) ) { - /* complete AAD processing */ - if(AESGCM_BUFLEN(pState)) - hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); - - /* increment counter block */ - IncrementCounter32(AESGCM_COUNTER(pState)); - /* and encrypt counter */ - encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - - /* switch mode and init counters */ - AESGCM_STATE(pState) = GcmTXTprocessing; - AESGCM_TXT_LEN(pState) = CONST_64(0); - AESGCM_BUFLEN(pState) = 0; - } - - /* - // process text (encrypt and authenticate) - */ - /* process partial block */ - if(AESGCM_BUFLEN(pState)) { - int locLen = IPP_MIN(txtLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); - /* ctr encryption */ - XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, locLen); - /* authentication */ - XorBlock(pDst, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); - - AESGCM_BUFLEN(pState) += locLen; - AESGCM_TXT_LEN(pState) += locLen; - pSrc += locLen; - pDst += locLen; - txtLen -= locLen; - - /* if buffer full */ - if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { - /* hash buffer */ - hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); - AESGCM_BUFLEN(pState) = 0; - - /* increment counter block */ - IncrementCounter32(AESGCM_COUNTER(pState)); - /* and encrypt counter */ - encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - } - } - - /* process the main part of text */ - { - int lenBlks = txtLen & (-BLOCK_SIZE); - if(lenBlks) { - Encrypt_ encFunc = AESGCM_ENC(pState); - - encFunc(pDst, pSrc, lenBlks, pState); - - AESGCM_TXT_LEN(pState) += lenBlks; - pSrc += lenBlks; - pDst += lenBlks; - txtLen -= lenBlks; - } - } - - /* process the rest of text */ - if(txtLen) { - XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, txtLen); - XorBlock(pDst, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), txtLen); - - AESGCM_BUFLEN(pState) += txtLen; - AESGCM_TXT_LEN(pState) += txtLen; - } - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsAES_GCMDecrypt -// -// Purpose: Decrypts a data buffer in the GCM mode. -// -// Returns: Reason: -// ippStsNullPtrErr pSrc == NULL -// pDst == NULL -// pState == NULL -// ippStsContextMatchErr !AESGCM_VALID_ID() -// ippStsLengthErr txtLen<0 -// ippStsNoErr no errors -// -// Parameters: -// pSrc Pointer to ciphertext. -// pDst Pointer to plaintext. -// len Length of the plaintext and ciphertext in bytes -// pState pointer to the context -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int txtLen, IppsAES_GCMState* pState)) -{ - /* test pState pointer */ - IPP_BAD_PTR1_RET(pState); - /* use aligned context */ - pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); - /* test state ID */ - IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); - /* test context validity */ - IPP_BADARG_RET(!(GcmAADprocessing==AESGCM_STATE(pState) || GcmTXTprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); - - /* test text pointers and length */ - IPP_BAD_PTR2_RET(pSrc, pDst); - IPP_BADARG_RET(txtLen<0, ippStsLengthErr); - - - { - /* get method */ - IppsAESSpec* pAES = AESGCM_CIPHER(pState); - RijnCipher encoder = RIJ_ENCODER(pAES); - MulGcm_ hashFunc = AESGCM_HASH(pState); - - if( GcmAADprocessing==AESGCM_STATE(pState) ) { - /* complete AAD processing */ - if(AESGCM_BUFLEN(pState)) - hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); - - /* increment counter block */ - IncrementCounter32(AESGCM_COUNTER(pState)); - /* and encrypt counter */ - encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - - /* switch mode and init counters */ - AESGCM_BUFLEN(pState) = 0; - AESGCM_TXT_LEN(pState) = CONST_64(0); - AESGCM_STATE(pState) = GcmTXTprocessing; - } - - /* - // process text (authenticate and decrypt ) - */ - /* process partial block */ - if(AESGCM_BUFLEN(pState)) { - int locLen = IPP_MIN(txtLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); - /* authentication */ - XorBlock(pSrc, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); - /* ctr decryption */ - XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, locLen); - - AESGCM_BUFLEN(pState) += locLen; - AESGCM_TXT_LEN(pState) += locLen; - pSrc += locLen; - pDst += locLen; - txtLen -= locLen; - - /* if buffer full */ - if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { - /* hash buffer */ - hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); - AESGCM_BUFLEN(pState) = 0; - - /* increment counter block */ - IncrementCounter32(AESGCM_COUNTER(pState)); - /* and encrypt counter */ - encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - } - } - - /* process the main part of text */ - { - int lenBlks = txtLen & (-BLOCK_SIZE); - if(lenBlks) { - Decrypt_ decFunc = AESGCM_DEC(pState); - - decFunc(pDst, pSrc, lenBlks, pState); - - AESGCM_TXT_LEN(pState) += lenBlks; - pSrc += lenBlks; - pDst += lenBlks; - txtLen -= lenBlks; - } - } - - /* process the rest of text */ - if(txtLen) { - /* ctr encryption */ - XorBlock(pSrc, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), txtLen); - XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, txtLen); - - AESGCM_BUFLEN(pState) += txtLen; - AESGCM_TXT_LEN(pState) += txtLen; - } - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsAES_GCMGetTag -// -// Purpose: Generates authentication tag in the GCM mode. -// -// Returns: Reason: -// ippStsNullPtrErr pDstTag == NULL -// pState == NULL -// ippStsLengthErr tagLen<=0 || tagLen>16 -// ippStsContextMatchErr !AESGCM_VALID_ID() -// ippStsNoErr no errors -// -// Parameters: -// pDstTag pointer to the authentication tag. -// tagLen length of the authentication tag *pDstTag in bytes -// pState pointer to the context -// -*F*/ -IPPFUN(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_GCMState* pState)) -{ - /* test State pointer */ - IPP_BAD_PTR1_RET(pState); - /* use aligned context */ - pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); - /* test state ID */ - IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); - - /* test tag pointer and length */ - IPP_BAD_PTR1_RET(pTag); - IPP_BADARG_RET(tagLen<=0 || tagLen>BLOCK_SIZE, ippStsLengthErr); - - - { - /* get method */ - MulGcm_ hashFunc = AESGCM_HASH(pState); - - __ALIGN16 Ipp8u tmpHash[BLOCK_SIZE]; - Ipp8u tmpCntr[BLOCK_SIZE]; - - /* local copy of AAD and text counters (in bits) */ - Ipp64u aadBitLen = AESGCM_AAD_LEN(pState)*BYTESIZE; - Ipp64u txtBitLen = AESGCM_TXT_LEN(pState)*BYTESIZE; - - /* do local copy of ghash */ - CopyBlock16(AESGCM_GHASH(pState), tmpHash); - - /* complete text processing */ - if(AESGCM_BUFLEN(pState)) { - hashFunc(tmpHash, AESGCM_HKEY(pState), AesGcmConst_table); - } - - /* process lengths of AAD and text */ - U32_TO_HSTRING(tmpCntr, HIDWORD(aadBitLen)); - U32_TO_HSTRING(tmpCntr+4, LODWORD(aadBitLen)); - U32_TO_HSTRING(tmpCntr+8, HIDWORD(txtBitLen)); - U32_TO_HSTRING(tmpCntr+12,LODWORD(txtBitLen)); - - XorBlock16(tmpHash, tmpCntr, tmpHash); - hashFunc(tmpHash, AESGCM_HKEY(pState), AesGcmConst_table); - - /* add encrypted initial counter */ - XorBlock16(tmpHash, AESGCM_ECOUNTER0(pState), tmpHash); - - /* return tag of required lenth */ - CopyBlock(tmpHash, pTag, tagLen); - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcpaesauthgcm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/*F* +// Name: ippsAES_GCMGetSize +// +// Purpose: Returns size of AES_GCM state (in bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSize == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to size of context +// +*F*/ +static int cpSizeofCtx_AESGCM(void) +{ + int precomp_size; + + precomp_size = PRECOMP_DATA_SIZE_FAST2K; + + /* decrease precomp_size as soon as BLOCK_SIZE bytes already reserved in context */ + precomp_size -= BLOCK_SIZE; + + return sizeof(IppsAES_GCMState) + +precomp_size + +AESGCM_ALIGNMENT-1; +} + +IPPFUN(IppStatus, ippsAES_GCMGetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = cpSizeofCtx_AESGCM(); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_GCMReset +// +// Purpose: Resets AES_GCM context. +// +// Returns: Reason: +// ippStsNullPtrErr pState== NULL +// ippStsContextMatchErr pState points on invalid context +// ippStsNoErr no errors +// +// Parameters: +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMReset,(IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test context validity */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + /* reset GCM */ + AESGCM_STATE(pState) = GcmInit; + AESGCM_IV_LEN(pState) = CONST_64(0); + AESGCM_AAD_LEN(pState) = CONST_64(0); + AESGCM_TXT_LEN(pState) = CONST_64(0); + + AESGCM_BUFLEN(pState) = 0; + PaddBlock(0, AESGCM_COUNTER(pState), BLOCK_SIZE); + PaddBlock(0, AESGCM_ECOUNTER(pState), BLOCK_SIZE); + PaddBlock(0, AESGCM_ECOUNTER0(pState), BLOCK_SIZE); + PaddBlock(0, AESGCM_GHASH(pState), BLOCK_SIZE); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_GCMInit +// +// Purpose: Init AES_GCM context for future usage. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// ippStsMemAllocErr size of buffer is not match fro operation +// ippStsLengthErr keyLen != 16 && +// != 24 && +// != 32 +// ippStsNoErr no errors +// +// Parameters: +// pKey pointer to the secret key +// keyLen length of secret key +// pState pointer to the AES-GCM context +// ctxSize available size (in bytes) of buffer above +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMInit,(const Ipp8u* pKey, int keyLen, IppsAES_GCMState* pState, int ctxSize)) +{ + /* test pCtx pointer */ + IPP_BAD_PTR1_RET(pState); + + /* test available size of context buffer */ + IPP_BADARG_RET(ctxSize0 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr ivLen <0 +// ippStsBadArgErr illegal sequence call +// ippStsNoErr no errors +// +// Parameters: +// pIV pointer to the IV +// ivLen length of IV (it could be 0) +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMProcessIV,(const Ipp8u* pIV, int ivLen, IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + + /* test IV pointer and length */ + IPP_BADARG_RET(ivLen && !pIV, ippStsNullPtrErr); + IPP_BADARG_RET(ivLen<0, ippStsLengthErr); + + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test context validity */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + IPP_BADARG_RET(!(GcmInit==AESGCM_STATE(pState) || GcmIVprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + /* switch IVprocessing on */ + AESGCM_STATE(pState) = GcmIVprocessing; + + /* test if buffer is not empty */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(ivLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + XorBlock(pIV, AESGCM_COUNTER(pState)+AESGCM_BUFLEN(pState), AESGCM_COUNTER(pState)+AESGCM_BUFLEN(pState), locLen); + AESGCM_BUFLEN(pState) += locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + MulGcm_ ghashFunc = AESGCM_HASH(pState); + ghashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + } + + AESGCM_IV_LEN(pState) += locLen; + pIV += locLen; + ivLen -= locLen; + } + + /* process main part of IV */ + { + int lenBlks = ivLen & (-BLOCK_SIZE); + if(lenBlks) { + Auth_ authFunc = AESGCM_AUTH(pState); + + authFunc(AESGCM_COUNTER(pState), pIV, lenBlks, AESGCM_HKEY(pState), AesGcmConst_table); + + AESGCM_IV_LEN(pState) += lenBlks; + pIV += lenBlks; + ivLen -= lenBlks; + } + } + + /* copy the rest of IV into the buffer */ + if(ivLen) { + XorBlock(pIV, AESGCM_COUNTER(pState), AESGCM_COUNTER(pState), ivLen); + AESGCM_IV_LEN(pState) += ivLen; + AESGCM_BUFLEN(pState) += ivLen; + } + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAES_GCMProcessAAD +// +// Purpose: AAD processing. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// pAAD == NULL, aadLen>0 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr aadLen <0 +// ippStsBadArgErr illegal sequence call +// ippStsNoErr no errors +// +// Parameters: +// pAAD pointer to the AAD +// aadlen length of AAD (it could be 0) +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMProcessAAD,(const Ipp8u* pAAD, int aadLen, IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test if context is valid */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + /* test AAD pointer and length */ + IPP_BADARG_RET(aadLen && !pAAD, ippStsNullPtrErr); + IPP_BADARG_RET(aadLen<0, ippStsLengthErr); + + IPP_BADARG_RET(!(GcmIVprocessing==AESGCM_STATE(pState) || GcmAADprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + { + /* get method */ + MulGcm_ hashFunc = AESGCM_HASH(pState); + + if( GcmIVprocessing==AESGCM_STATE(pState) ) { + IPP_BADARG_RET(0==AESGCM_IV_LEN(pState), ippStsBadArgErr); + + /* complete IV processing */ + if(CTR_POS==AESGCM_IV_LEN(pState)) { + /* apply special format if IV length is 12 bytes */ + AESGCM_COUNTER(pState)[12] = 0; + AESGCM_COUNTER(pState)[13] = 0; + AESGCM_COUNTER(pState)[14] = 0; + AESGCM_COUNTER(pState)[15] = 1; + } + else { + /* process the rest of IV */ + if(AESGCM_BUFLEN(pState)) + hashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); + + /* add IV bit length */ + { + Ipp64u ivBitLen = AESGCM_IV_LEN(pState)*BYTESIZE; + Ipp8u tmp[BLOCK_SIZE]; + PaddBlock(0, tmp, BLOCK_SIZE-8); + U32_TO_HSTRING(tmp+8, HIDWORD(ivBitLen)); + U32_TO_HSTRING(tmp+12, LODWORD(ivBitLen)); + XorBlock16(tmp, AESGCM_COUNTER(pState), AESGCM_COUNTER(pState)); + hashFunc(AESGCM_COUNTER(pState), AESGCM_HKEY(pState), AesGcmConst_table); + } + } + + /* prepare initial counter */ + { + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER0(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + + /* switch mode and init counters */ + AESGCM_STATE(pState) = GcmAADprocessing; + AESGCM_AAD_LEN(pState) = CONST_64(0); + AESGCM_BUFLEN(pState) = 0; + } + + /* + // AAD processing + */ + + /* test if buffer is not empty */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(aadLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + XorBlock(pAAD, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); + AESGCM_BUFLEN(pState) += locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + } + + AESGCM_AAD_LEN(pState) += locLen; + pAAD += locLen; + aadLen -= locLen; + } + + /* process main part of AAD */ + { + int lenBlks = aadLen & (-BLOCK_SIZE); + if(lenBlks) { + Auth_ authFunc = AESGCM_AUTH(pState); + + authFunc(AESGCM_GHASH(pState), pAAD, lenBlks, AESGCM_HKEY(pState), AesGcmConst_table); + + AESGCM_AAD_LEN(pState) += lenBlks; + pAAD += lenBlks; + aadLen -= lenBlks; + } + } + + /* copy the rest of AAD into the buffer */ + if(aadLen) { + XorBlock(pAAD, AESGCM_GHASH(pState), AESGCM_GHASH(pState), aadLen); + AESGCM_AAD_LEN(pState) += aadLen; + AESGCM_BUFLEN(pState) = aadLen; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_GCMStart +// +// Purpose: Start the process of encryption or decryption and authentication tag generation. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// pIV == NULL, ivLen>0 +// pAAD == NULL, aadLen>0 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr ivLen < 0 +// aadLen < 0 +// ippStsNoErr no errors +// +// Parameters: +// pIV pointer to the IV (nonce) +// ivLen length of the IV in bytes +// pAAD pointer to the Addition Authenticated Data (header) +// aadLen length of the AAD in bytes +// pState pointer to the AES-GCM state +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMStart,(const Ipp8u* pIV, int ivLen, + const Ipp8u* pAAD, int aadLen, + IppsAES_GCMState* pState)) +{ + IppStatus sts = ippsAES_GCMReset(pState); + if(ippStsNoErr==sts) + sts = ippsAES_GCMProcessIV(pIV, ivLen, pState); + if(ippStsNoErr==sts) + sts = ippsAES_GCMProcessAAD(pAAD, aadLen, pState); + return sts; +} + + +/*F* +// Name: ippsAES_GCMEncrypt +// +// Purpose: Encrypts a data buffer in the GCM mode. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pDst == NULL +// pState == NULL +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr txtLen<0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc Pointer to plaintext. +// pDst Pointer to ciphertext. +// len Length of the plaintext and ciphertext in bytes +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMEncrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int txtLen, + IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test state ID */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + /* test context validity */ + IPP_BADARG_RET(!(GcmAADprocessing==AESGCM_STATE(pState) || GcmTXTprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + /* test text pointers and length */ + IPP_BAD_PTR2_RET(pSrc, pDst); + IPP_BADARG_RET(txtLen<0, ippStsLengthErr); + + + { + /* get method */ + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + MulGcm_ hashFunc = AESGCM_HASH(pState); + + if( GcmAADprocessing==AESGCM_STATE(pState) ) { + /* complete AAD processing */ + if(AESGCM_BUFLEN(pState)) + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + /* switch mode and init counters */ + AESGCM_STATE(pState) = GcmTXTprocessing; + AESGCM_TXT_LEN(pState) = CONST_64(0); + AESGCM_BUFLEN(pState) = 0; + } + + /* + // process text (encrypt and authenticate) + */ + /* process partial block */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(txtLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + /* ctr encryption */ + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, locLen); + /* authentication */ + XorBlock(pDst, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); + + AESGCM_BUFLEN(pState) += locLen; + AESGCM_TXT_LEN(pState) += locLen; + pSrc += locLen; + pDst += locLen; + txtLen -= locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + /* hash buffer */ + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + } + + /* process the main part of text */ + { + int lenBlks = txtLen & (-BLOCK_SIZE); + if(lenBlks) { + Encrypt_ encFunc = AESGCM_ENC(pState); + + encFunc(pDst, pSrc, lenBlks, pState); + + AESGCM_TXT_LEN(pState) += lenBlks; + pSrc += lenBlks; + pDst += lenBlks; + txtLen -= lenBlks; + } + } + + /* process the rest of text */ + if(txtLen) { + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, txtLen); + XorBlock(pDst, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), txtLen); + + AESGCM_BUFLEN(pState) += txtLen; + AESGCM_TXT_LEN(pState) += txtLen; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_GCMDecrypt +// +// Purpose: Decrypts a data buffer in the GCM mode. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pDst == NULL +// pState == NULL +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsLengthErr txtLen<0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc Pointer to ciphertext. +// pDst Pointer to plaintext. +// len Length of the plaintext and ciphertext in bytes +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMDecrypt,(const Ipp8u* pSrc, Ipp8u* pDst, int txtLen, IppsAES_GCMState* pState)) +{ + /* test pState pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test state ID */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + /* test context validity */ + IPP_BADARG_RET(!(GcmAADprocessing==AESGCM_STATE(pState) || GcmTXTprocessing==AESGCM_STATE(pState)), ippStsBadArgErr); + + /* test text pointers and length */ + IPP_BAD_PTR2_RET(pSrc, pDst); + IPP_BADARG_RET(txtLen<0, ippStsLengthErr); + + + { + /* get method */ + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + MulGcm_ hashFunc = AESGCM_HASH(pState); + + if( GcmAADprocessing==AESGCM_STATE(pState) ) { + /* complete AAD processing */ + if(AESGCM_BUFLEN(pState)) + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + + /* switch mode and init counters */ + AESGCM_BUFLEN(pState) = 0; + AESGCM_TXT_LEN(pState) = CONST_64(0); + AESGCM_STATE(pState) = GcmTXTprocessing; + } + + /* + // process text (authenticate and decrypt ) + */ + /* process partial block */ + if(AESGCM_BUFLEN(pState)) { + int locLen = IPP_MIN(txtLen, BLOCK_SIZE-AESGCM_BUFLEN(pState)); + /* authentication */ + XorBlock(pSrc, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), locLen); + /* ctr decryption */ + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, locLen); + + AESGCM_BUFLEN(pState) += locLen; + AESGCM_TXT_LEN(pState) += locLen; + pSrc += locLen; + pDst += locLen; + txtLen -= locLen; + + /* if buffer full */ + if(BLOCK_SIZE==AESGCM_BUFLEN(pState)) { + /* hash buffer */ + hashFunc(AESGCM_GHASH(pState), AESGCM_HKEY(pState), AesGcmConst_table); + AESGCM_BUFLEN(pState) = 0; + + /* increment counter block */ + IncrementCounter32(AESGCM_COUNTER(pState)); + /* and encrypt counter */ + encoder(AESGCM_COUNTER(pState), AESGCM_ECOUNTER(pState), RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + } + + /* process the main part of text */ + { + int lenBlks = txtLen & (-BLOCK_SIZE); + if(lenBlks) { + Decrypt_ decFunc = AESGCM_DEC(pState); + + decFunc(pDst, pSrc, lenBlks, pState); + + AESGCM_TXT_LEN(pState) += lenBlks; + pSrc += lenBlks; + pDst += lenBlks; + txtLen -= lenBlks; + } + } + + /* process the rest of text */ + if(txtLen) { + /* ctr encryption */ + XorBlock(pSrc, AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), AESGCM_GHASH(pState)+AESGCM_BUFLEN(pState), txtLen); + XorBlock(pSrc, AESGCM_ECOUNTER(pState)+AESGCM_BUFLEN(pState), pDst, txtLen); + + AESGCM_BUFLEN(pState) += txtLen; + AESGCM_TXT_LEN(pState) += txtLen; + } + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsAES_GCMGetTag +// +// Purpose: Generates authentication tag in the GCM mode. +// +// Returns: Reason: +// ippStsNullPtrErr pDstTag == NULL +// pState == NULL +// ippStsLengthErr tagLen<=0 || tagLen>16 +// ippStsContextMatchErr !AESGCM_VALID_ID() +// ippStsNoErr no errors +// +// Parameters: +// pDstTag pointer to the authentication tag. +// tagLen length of the authentication tag *pDstTag in bytes +// pState pointer to the context +// +*F*/ +IPPFUN(IppStatus, ippsAES_GCMGetTag,(Ipp8u* pTag, int tagLen, const IppsAES_GCMState* pState)) +{ + /* test State pointer */ + IPP_BAD_PTR1_RET(pState); + /* use aligned context */ + pState = (IppsAES_GCMState*)( IPP_ALIGNED_PTR(pState, AESGCM_ALIGNMENT) ); + /* test state ID */ + IPP_BADARG_RET(!AESGCM_VALID_ID(pState), ippStsContextMatchErr); + + /* test tag pointer and length */ + IPP_BAD_PTR1_RET(pTag); + IPP_BADARG_RET(tagLen<=0 || tagLen>BLOCK_SIZE, ippStsLengthErr); + + + { + /* get method */ + MulGcm_ hashFunc = AESGCM_HASH(pState); + + __ALIGN16 Ipp8u tmpHash[BLOCK_SIZE]; + Ipp8u tmpCntr[BLOCK_SIZE]; + + /* local copy of AAD and text counters (in bits) */ + Ipp64u aadBitLen = AESGCM_AAD_LEN(pState)*BYTESIZE; + Ipp64u txtBitLen = AESGCM_TXT_LEN(pState)*BYTESIZE; + + /* do local copy of ghash */ + CopyBlock16(AESGCM_GHASH(pState), tmpHash); + + /* complete text processing */ + if(AESGCM_BUFLEN(pState)) { + hashFunc(tmpHash, AESGCM_HKEY(pState), AesGcmConst_table); + } + + /* process lengths of AAD and text */ + U32_TO_HSTRING(tmpCntr, HIDWORD(aadBitLen)); + U32_TO_HSTRING(tmpCntr+4, LODWORD(aadBitLen)); + U32_TO_HSTRING(tmpCntr+8, HIDWORD(txtBitLen)); + U32_TO_HSTRING(tmpCntr+12,LODWORD(txtBitLen)); + + XorBlock16(tmpHash, tmpCntr, tmpHash); + hashFunc(tmpHash, AESGCM_HKEY(pState), AesGcmConst_table); + + /* add encrypted initial counter */ + XorBlock16(tmpHash, AESGCM_ECOUNTER0(pState), tmpHash); + + /* return tag of required lenth */ + CopyBlock(tmpHash, pTag, tagLen); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c b/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c index 7675de46ea..ca4f51afe1 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c +++ b/external/crypto_px/sources/ippcp/src/pcpaesgcmtableca.c @@ -1,52 +1,52 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" - -const Ipp16u AesGcmConst_table[256] = { -0x0000, 0xc201, 0x8403, 0x4602, 0x0807, 0xca06, 0x8c04, 0x4e05, 0x100e, 0xd20f, 0x940d, 0x560c, 0x1809, 0xda08, 0x9c0a, 0x5e0b, -0x201c, 0xe21d, 0xa41f, 0x661e, 0x281b, 0xea1a, 0xac18, 0x6e19, 0x3012, 0xf213, 0xb411, 0x7610, 0x3815, 0xfa14, 0xbc16, 0x7e17, -0x4038, 0x8239, 0xc43b, 0x063a, 0x483f, 0x8a3e, 0xcc3c, 0x0e3d, 0x5036, 0x9237, 0xd435, 0x1634, 0x5831, 0x9a30, 0xdc32, 0x1e33, -0x6024, 0xa225, 0xe427, 0x2626, 0x6823, 0xaa22, 0xec20, 0x2e21, 0x702a, 0xb22b, 0xf429, 0x3628, 0x782d, 0xba2c, 0xfc2e, 0x3e2f, -0x8070, 0x4271, 0x0473, 0xc672, 0x8877, 0x4a76, 0x0c74, 0xce75, 0x907e, 0x527f, 0x147d, 0xd67c, 0x9879, 0x5a78, 0x1c7a, 0xde7b, -0xa06c, 0x626d, 0x246f, 0xe66e, 0xa86b, 0x6a6a, 0x2c68, 0xee69, 0xb062, 0x7263, 0x3461, 0xf660, 0xb865, 0x7a64, 0x3c66, 0xfe67, -0xc048, 0x0249, 0x444b, 0x864a, 0xc84f, 0x0a4e, 0x4c4c, 0x8e4d, 0xd046, 0x1247, 0x5445, 0x9644, 0xd841, 0x1a40, 0x5c42, 0x9e43, -0xe054, 0x2255, 0x6457, 0xa656, 0xe853, 0x2a52, 0x6c50, 0xae51, 0xf05a, 0x325b, 0x7459, 0xb658, 0xf85d, 0x3a5c, 0x7c5e, 0xbe5f, -0x00e1, 0xc2e0, 0x84e2, 0x46e3, 0x08e6, 0xcae7, 0x8ce5, 0x4ee4, 0x10ef, 0xd2ee, 0x94ec, 0x56ed, 0x18e8, 0xdae9, 0x9ceb, 0x5eea, -0x20fd, 0xe2fc, 0xa4fe, 0x66ff, 0x28fa, 0xeafb, 0xacf9, 0x6ef8, 0x30f3, 0xf2f2, 0xb4f0, 0x76f1, 0x38f4, 0xfaf5, 0xbcf7, 0x7ef6, -0x40d9, 0x82d8, 0xc4da, 0x06db, 0x48de, 0x8adf, 0xccdd, 0x0edc, 0x50d7, 0x92d6, 0xd4d4, 0x16d5, 0x58d0, 0x9ad1, 0xdcd3, 0x1ed2, -0x60c5, 0xa2c4, 0xe4c6, 0x26c7, 0x68c2, 0xaac3, 0xecc1, 0x2ec0, 0x70cb, 0xb2ca, 0xf4c8, 0x36c9, 0x78cc, 0xbacd, 0xfccf, 0x3ece, -0x8091, 0x4290, 0x0492, 0xc693, 0x8896, 0x4a97, 0x0c95, 0xce94, 0x909f, 0x529e, 0x149c, 0xd69d, 0x9898, 0x5a99, 0x1c9b, 0xde9a, -0xa08d, 0x628c, 0x248e, 0xe68f, 0xa88a, 0x6a8b, 0x2c89, 0xee88, 0xb083, 0x7282, 0x3480, 0xf681, 0xb884, 0x7a85, 0x3c87, 0xfe86, -0xc0a9, 0x02a8, 0x44aa, 0x86ab, 0xc8ae, 0x0aaf, 0x4cad, 0x8eac, 0xd0a7, 0x12a6, 0x54a4, 0x96a5, 0xd8a0, 0x1aa1, 0x5ca3, 0x9ea2, -0xe0b5, 0x22b4, 0x64b6, 0xa6b7, 0xe8b2, 0x2ab3, 0x6cb1, 0xaeb0, 0xf0bb, 0x32ba, 0x74b8, 0xb6b9, 0xf8bc, 0x3abd, 0x7cbf, 0xbebe -}; +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +const Ipp16u AesGcmConst_table[256] = { +0x0000, 0xc201, 0x8403, 0x4602, 0x0807, 0xca06, 0x8c04, 0x4e05, 0x100e, 0xd20f, 0x940d, 0x560c, 0x1809, 0xda08, 0x9c0a, 0x5e0b, +0x201c, 0xe21d, 0xa41f, 0x661e, 0x281b, 0xea1a, 0xac18, 0x6e19, 0x3012, 0xf213, 0xb411, 0x7610, 0x3815, 0xfa14, 0xbc16, 0x7e17, +0x4038, 0x8239, 0xc43b, 0x063a, 0x483f, 0x8a3e, 0xcc3c, 0x0e3d, 0x5036, 0x9237, 0xd435, 0x1634, 0x5831, 0x9a30, 0xdc32, 0x1e33, +0x6024, 0xa225, 0xe427, 0x2626, 0x6823, 0xaa22, 0xec20, 0x2e21, 0x702a, 0xb22b, 0xf429, 0x3628, 0x782d, 0xba2c, 0xfc2e, 0x3e2f, +0x8070, 0x4271, 0x0473, 0xc672, 0x8877, 0x4a76, 0x0c74, 0xce75, 0x907e, 0x527f, 0x147d, 0xd67c, 0x9879, 0x5a78, 0x1c7a, 0xde7b, +0xa06c, 0x626d, 0x246f, 0xe66e, 0xa86b, 0x6a6a, 0x2c68, 0xee69, 0xb062, 0x7263, 0x3461, 0xf660, 0xb865, 0x7a64, 0x3c66, 0xfe67, +0xc048, 0x0249, 0x444b, 0x864a, 0xc84f, 0x0a4e, 0x4c4c, 0x8e4d, 0xd046, 0x1247, 0x5445, 0x9644, 0xd841, 0x1a40, 0x5c42, 0x9e43, +0xe054, 0x2255, 0x6457, 0xa656, 0xe853, 0x2a52, 0x6c50, 0xae51, 0xf05a, 0x325b, 0x7459, 0xb658, 0xf85d, 0x3a5c, 0x7c5e, 0xbe5f, +0x00e1, 0xc2e0, 0x84e2, 0x46e3, 0x08e6, 0xcae7, 0x8ce5, 0x4ee4, 0x10ef, 0xd2ee, 0x94ec, 0x56ed, 0x18e8, 0xdae9, 0x9ceb, 0x5eea, +0x20fd, 0xe2fc, 0xa4fe, 0x66ff, 0x28fa, 0xeafb, 0xacf9, 0x6ef8, 0x30f3, 0xf2f2, 0xb4f0, 0x76f1, 0x38f4, 0xfaf5, 0xbcf7, 0x7ef6, +0x40d9, 0x82d8, 0xc4da, 0x06db, 0x48de, 0x8adf, 0xccdd, 0x0edc, 0x50d7, 0x92d6, 0xd4d4, 0x16d5, 0x58d0, 0x9ad1, 0xdcd3, 0x1ed2, +0x60c5, 0xa2c4, 0xe4c6, 0x26c7, 0x68c2, 0xaac3, 0xecc1, 0x2ec0, 0x70cb, 0xb2ca, 0xf4c8, 0x36c9, 0x78cc, 0xbacd, 0xfccf, 0x3ece, +0x8091, 0x4290, 0x0492, 0xc693, 0x8896, 0x4a97, 0x0c95, 0xce94, 0x909f, 0x529e, 0x149c, 0xd69d, 0x9898, 0x5a99, 0x1c9b, 0xde9a, +0xa08d, 0x628c, 0x248e, 0xe68f, 0xa88a, 0x6a8b, 0x2c89, 0xee88, 0xb083, 0x7282, 0x3480, 0xf681, 0xb884, 0x7a85, 0x3c87, 0xfe86, +0xc0a9, 0x02a8, 0x44aa, 0x86ab, 0xc8ae, 0x0aaf, 0x4cad, 0x8eac, 0xd0a7, 0x12a6, 0x54a4, 0x96a5, 0xd8a0, 0x1aa1, 0x5ca3, 0x9ea2, +0xe0b5, 0x22b4, 0x64b6, 0xa6b7, 0xe8b2, 0x2ab3, 0x6cb1, 0xaeb0, 0xf0bb, 0x32ba, 0x74b8, 0xb6b9, 0xf8bc, 0x3abd, 0x7cbf, 0xbebe +}; diff --git a/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c b/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c index b2d9d32322..edbdfd291a 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c +++ b/external/crypto_px/sources/ippcp/src/pcpaesgcmtbl2kca.c @@ -1,229 +1,229 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" - -#include "pcpaesauthgcm.h" -#include "pcptool.h" - -#include "pcprijtables.h" - - -/* -// AES-GCM precomputations. -*/ -static void RightShiftBlock16(Ipp8u* pBlock) -{ - Ipp8u v0 = 0; - int i; - for(i=0; i<16; i++) { - Ipp8u v1 = pBlock[i]; - Ipp8u tmp = (Ipp8u)( (v1>>1) | (v0<<7) ); - pBlock[i] = tmp; - v0 = v1; - } -} -void AesGcmPrecompute_table2K(Ipp8u* pPrecomputeData, const Ipp8u* pHKey) -{ - Ipp8u t[BLOCK_SIZE]; - int n; - - CopyBlock16(pHKey, t); - - for(n=0; n<128-24; n++) { - /* get msb */ - int hBit = t[15]&1; - - int k = n%32; - if(k<4) { - CopyBlock16(t, pPrecomputeData +1024 +(n/32)*256 +(Ipp32u)(1<<(7-k))); - } - else if(k<8) { - CopyBlock16(t, pPrecomputeData +(n/32)*256 +(Ipp32u)(1<<(11-k))); - } - - /* shift */ - RightShiftBlock16(t); - /* xor if msb=1 */ - if(hBit) - t[0] ^= 0xe1; - } - - for(n=0; n<4; n++) { - int m, k; - XorBlock16(pPrecomputeData +n*256, pPrecomputeData +n*256, pPrecomputeData +n*256); - XorBlock16(pPrecomputeData +1024 +n*256, pPrecomputeData +1024 +n*256, pPrecomputeData +1024 +n*256); - for(m=2; m<=8; m*=2) - for(k=1; k=BLOCK_SIZE) { - /* add src */ - XorBlock16(pSrc, pHash, pHash); - /* hash it */ - AesGcmMulGcm_table2K(pHash, pHKey, AesGcmConst_table); - - pSrc += BLOCK_SIZE; - len -= BLOCK_SIZE; - } -} - - -/* -// encrypts and authenticates n*BLOCK_SIZE bytes -*/ -void wrpAesGcmEnc_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pState) -{ - Ipp8u* pHashedData = pDst; - int hashedDataLen = len; - - Ipp8u* pCounter = AESGCM_COUNTER(pState); - Ipp8u* pECounter = AESGCM_ECOUNTER(pState); - - IppsAESSpec* pAES = AESGCM_CIPHER(pState); - RijnCipher encoder = RIJ_ENCODER(pAES); - - while(len>=BLOCK_SIZE) { - /* encrypt whole AES block */ - XorBlock16(pSrc, pECounter, pDst); - - pSrc += BLOCK_SIZE; - pDst += BLOCK_SIZE; - len -= BLOCK_SIZE; - - /* increment counter block */ - IncrementCounter32(pCounter); - /* and encrypt counter */ - encoder(pCounter, pECounter, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - } - - AesGcmAuth_table2K(AESGCM_GHASH(pState), pHashedData, hashedDataLen, AESGCM_HKEY(pState), AesGcmConst_table); -} - - -/* -// authenticates and decrypts n*BLOCK_SIZE bytes -*/ -void wrpAesGcmDec_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pState) -{ - AesGcmAuth_table2K(AESGCM_GHASH(pState), pSrc, len, AESGCM_HKEY(pState), AesGcmConst_table); - - { - Ipp8u* pCounter = AESGCM_COUNTER(pState); - Ipp8u* pECounter = AESGCM_ECOUNTER(pState); - - IppsAESSpec* pAES = AESGCM_CIPHER(pState); - RijnCipher encoder = RIJ_ENCODER(pAES); - - while(len>=BLOCK_SIZE) { - /* encrypt whole AES block */ - XorBlock16(pSrc, pECounter, pDst); - - pSrc += BLOCK_SIZE; - pDst += BLOCK_SIZE; - len -= BLOCK_SIZE; - - /* increment counter block */ - IncrementCounter32(pCounter); - /* and encrypt counter */ - encoder(pCounter, pECounter, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); - } - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcpaesauthgcm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + + +/* +// AES-GCM precomputations. +*/ +static void RightShiftBlock16(Ipp8u* pBlock) +{ + Ipp8u v0 = 0; + int i; + for(i=0; i<16; i++) { + Ipp8u v1 = pBlock[i]; + Ipp8u tmp = (Ipp8u)( (v1>>1) | (v0<<7) ); + pBlock[i] = tmp; + v0 = v1; + } +} +void AesGcmPrecompute_table2K(Ipp8u* pPrecomputeData, const Ipp8u* pHKey) +{ + Ipp8u t[BLOCK_SIZE]; + int n; + + CopyBlock16(pHKey, t); + + for(n=0; n<128-24; n++) { + /* get msb */ + int hBit = t[15]&1; + + int k = n%32; + if(k<4) { + CopyBlock16(t, pPrecomputeData +1024 +(n/32)*256 +(Ipp32u)(1<<(7-k))); + } + else if(k<8) { + CopyBlock16(t, pPrecomputeData +(n/32)*256 +(Ipp32u)(1<<(11-k))); + } + + /* shift */ + RightShiftBlock16(t); + /* xor if msb=1 */ + if(hBit) + t[0] ^= 0xe1; + } + + for(n=0; n<4; n++) { + int m, k; + XorBlock16(pPrecomputeData +n*256, pPrecomputeData +n*256, pPrecomputeData +n*256); + XorBlock16(pPrecomputeData +1024 +n*256, pPrecomputeData +1024 +n*256, pPrecomputeData +1024 +n*256); + for(m=2; m<=8; m*=2) + for(k=1; k=BLOCK_SIZE) { + /* add src */ + XorBlock16(pSrc, pHash, pHash); + /* hash it */ + AesGcmMulGcm_table2K(pHash, pHKey, AesGcmConst_table); + + pSrc += BLOCK_SIZE; + len -= BLOCK_SIZE; + } +} + + +/* +// encrypts and authenticates n*BLOCK_SIZE bytes +*/ +void wrpAesGcmEnc_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pState) +{ + Ipp8u* pHashedData = pDst; + int hashedDataLen = len; + + Ipp8u* pCounter = AESGCM_COUNTER(pState); + Ipp8u* pECounter = AESGCM_ECOUNTER(pState); + + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + + while(len>=BLOCK_SIZE) { + /* encrypt whole AES block */ + XorBlock16(pSrc, pECounter, pDst); + + pSrc += BLOCK_SIZE; + pDst += BLOCK_SIZE; + len -= BLOCK_SIZE; + + /* increment counter block */ + IncrementCounter32(pCounter); + /* and encrypt counter */ + encoder(pCounter, pECounter, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + + AesGcmAuth_table2K(AESGCM_GHASH(pState), pHashedData, hashedDataLen, AESGCM_HKEY(pState), AesGcmConst_table); +} + + +/* +// authenticates and decrypts n*BLOCK_SIZE bytes +*/ +void wrpAesGcmDec_table2K(Ipp8u* pDst, const Ipp8u* pSrc, int len, IppsAES_GCMState* pState) +{ + AesGcmAuth_table2K(AESGCM_GHASH(pState), pSrc, len, AESGCM_HKEY(pState), AesGcmConst_table); + + { + Ipp8u* pCounter = AESGCM_COUNTER(pState); + Ipp8u* pECounter = AESGCM_ECOUNTER(pState); + + IppsAESSpec* pAES = AESGCM_CIPHER(pState); + RijnCipher encoder = RIJ_ENCODER(pAES); + + while(len>=BLOCK_SIZE) { + /* encrypt whole AES block */ + XorBlock16(pSrc, pECounter, pDst); + + pSrc += BLOCK_SIZE; + pDst += BLOCK_SIZE; + len -= BLOCK_SIZE; + + /* increment counter block */ + IncrementCounter32(pCounter); + /* and encrypt counter */ + encoder(pCounter, pECounter, RIJ_NR(pAES), RIJ_EKEYS(pAES), RijEncSbox); + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpaesm.h b/external/crypto_px/sources/ippcp/src/pcpaesm.h index dacfe258ea..924fcf238e 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesm.h +++ b/external/crypto_px/sources/ippcp/src/pcpaesm.h @@ -1,50 +1,50 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_AES_H) -#define _PCP_AES_H - -#include "pcprij.h" - -/* alignment of AES context */ -#define AES_ALIGNMENT (RIJ_ALIGNMENT) - -/* valid AES context ID */ -#define VALID_AES_ID(ctx) (RIJ_ID((ctx))==idCtxRijndael) - -/* size of AES context */ -__INLINE int cpSizeofCtx_AES(void) -{ - return sizeof(IppsAESSpec) - +(AES_ALIGNMENT-1); -} - -#endif /* _PCP_AES_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_AES_H) +#define _PCP_AES_H + +#include "pcprij.h" + +/* alignment of AES context */ +#define AES_ALIGNMENT (RIJ_ALIGNMENT) + +/* valid AES context ID */ +#define VALID_AES_ID(ctx) (RIJ_ID((ctx))==idCtxRijndael) + +/* size of AES context */ +__INLINE int cpSizeofCtx_AES(void) +{ + return sizeof(IppsAESSpec) + +(AES_ALIGNMENT-1); +} + +#endif /* _PCP_AES_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c b/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c index 1a7f65487d..6aac2fc218 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c +++ b/external/crypto_px/sources/ippcp/src/pcpaesmctrca.c @@ -1,150 +1,150 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" - -#include "owncp.h" -#include "pcpaesm.h" -#include "pcptool.h" - -#include "pcprijtables.h" - -/* -// AES-CRT processing. -// -// Returns: Reason: -// ippStsNullPtrErr pCtx == NULL -// pSrc == NULL -// pDst == NULL -// pCtrValue ==NULL -// ippStsContextMatchErr !VALID_AES_ID() -// ippStsLengthErr len <1 -// ippStsCTRSizeErr 128 < ctrNumBitSize < 1 -// ippStsNoErr no errors -// -// Parameters: -// pSrc pointer to the source data buffer -// pDst pointer to the target data buffer -// dataLen input/output buffer length (in bytes) -// pCtx pointer to rge AES context -// pCtrValue pointer to the counter block -// ctrNumBitSize counter block size (bits) -// -// Note: -// counter will updated on return -// -*/ -static -IppStatus cpProcessAES_ctr(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, - const IppsAESSpec* pCtx, - Ipp8u* pCtrValue, int ctrNumBitSize) -{ - /* test context */ - IPP_BAD_PTR1_RET(pCtx); - /* use aligned AES context */ - pCtx = (IppsAESSpec*)( IPP_ALIGNED_PTR(pCtx, AES_ALIGNMENT) ); - /* test the context ID */ - IPP_BADARG_RET(!VALID_AES_ID(pCtx), ippStsContextMatchErr); - - /* test source, target and counter block pointers */ - IPP_BAD_PTR3_RET(pSrc, pDst, pCtrValue); - /* test stream length */ - IPP_BADARG_RET((dataLen<1), ippStsLengthErr); - - /* test counter block size */ - IPP_BADARG_RET(((MBS_RIJ128*8)= MBS_RIJ128) { - /* encrypt counter block */ - encoder((Ipp8u*)counter, (Ipp8u*)output, RIJ_NR(pCtx), RIJ_EKEYS(pCtx), RijEncSbox); - - /* compute ciphertext block */ - if( !(IPP_UINT_PTR(pSrc) & 0x3) && !(IPP_UINT_PTR(pDst) & 0x3)) { - ((Ipp32u*)pDst)[0] = output[0]^((Ipp32u*)pSrc)[0]; - ((Ipp32u*)pDst)[1] = output[1]^((Ipp32u*)pSrc)[1]; - ((Ipp32u*)pDst)[2] = output[2]^((Ipp32u*)pSrc)[2]; - ((Ipp32u*)pDst)[3] = output[3]^((Ipp32u*)pSrc)[3]; - } - else - XorBlock16(pSrc, output, pDst); - /* encrement counter block */ - StdIncrement((Ipp8u*)counter,MBS_RIJ128*8, ctrNumBitSize); - - pSrc += MBS_RIJ128; - pDst += MBS_RIJ128; - dataLen -= MBS_RIJ128; - } - /* - // encrypt last data block - */ - if(dataLen) { - /* encrypt counter block */ - encoder((Ipp8u*)counter, (Ipp8u*)output, RIJ_NR(pCtx), RIJ_EKEYS(pCtx), RijEncSbox); - - /* compute ciphertext block */ - XorBlock(pSrc, output, pDst,dataLen); - /* encrement counter block */ - StdIncrement((Ipp8u*)counter,MBS_RIJ128*8, ctrNumBitSize); - } - - /* update counter */ - CopyBlock16(counter, pCtrValue); - - return ippStsNoErr; - } -} - -IPPFUN(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, - const IppsAESSpec* pCtx, - Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - return cpProcessAES_ctr(pSrc, pDst, dataLen, pCtx, pCtrValue, ctrNumBitSize); -} - -IPPFUN(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, - const IppsAESSpec* pCtx, - Ipp8u* pCtrValue, int ctrNumBitSize)) -{ - return cpProcessAES_ctr(pSrc, pDst, dataLen, pCtx, pCtrValue, ctrNumBitSize); -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#include "owncp.h" +#include "pcpaesm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/* +// AES-CRT processing. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// pSrc == NULL +// pDst == NULL +// pCtrValue ==NULL +// ippStsContextMatchErr !VALID_AES_ID() +// ippStsLengthErr len <1 +// ippStsCTRSizeErr 128 < ctrNumBitSize < 1 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the source data buffer +// pDst pointer to the target data buffer +// dataLen input/output buffer length (in bytes) +// pCtx pointer to rge AES context +// pCtrValue pointer to the counter block +// ctrNumBitSize counter block size (bits) +// +// Note: +// counter will updated on return +// +*/ +static +IppStatus cpProcessAES_ctr(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize) +{ + /* test context */ + IPP_BAD_PTR1_RET(pCtx); + /* use aligned AES context */ + pCtx = (IppsAESSpec*)( IPP_ALIGNED_PTR(pCtx, AES_ALIGNMENT) ); + /* test the context ID */ + IPP_BADARG_RET(!VALID_AES_ID(pCtx), ippStsContextMatchErr); + + /* test source, target and counter block pointers */ + IPP_BAD_PTR3_RET(pSrc, pDst, pCtrValue); + /* test stream length */ + IPP_BADARG_RET((dataLen<1), ippStsLengthErr); + + /* test counter block size */ + IPP_BADARG_RET(((MBS_RIJ128*8)= MBS_RIJ128) { + /* encrypt counter block */ + encoder((Ipp8u*)counter, (Ipp8u*)output, RIJ_NR(pCtx), RIJ_EKEYS(pCtx), RijEncSbox); + + /* compute ciphertext block */ + if( !(IPP_UINT_PTR(pSrc) & 0x3) && !(IPP_UINT_PTR(pDst) & 0x3)) { + ((Ipp32u*)pDst)[0] = output[0]^((Ipp32u*)pSrc)[0]; + ((Ipp32u*)pDst)[1] = output[1]^((Ipp32u*)pSrc)[1]; + ((Ipp32u*)pDst)[2] = output[2]^((Ipp32u*)pSrc)[2]; + ((Ipp32u*)pDst)[3] = output[3]^((Ipp32u*)pSrc)[3]; + } + else + XorBlock16(pSrc, output, pDst); + /* encrement counter block */ + StdIncrement((Ipp8u*)counter,MBS_RIJ128*8, ctrNumBitSize); + + pSrc += MBS_RIJ128; + pDst += MBS_RIJ128; + dataLen -= MBS_RIJ128; + } + /* + // encrypt last data block + */ + if(dataLen) { + /* encrypt counter block */ + encoder((Ipp8u*)counter, (Ipp8u*)output, RIJ_NR(pCtx), RIJ_EKEYS(pCtx), RijEncSbox); + + /* compute ciphertext block */ + XorBlock(pSrc, output, pDst,dataLen); + /* encrement counter block */ + StdIncrement((Ipp8u*)counter,MBS_RIJ128*8, ctrNumBitSize); + } + + /* update counter */ + CopyBlock16(counter, pCtrValue); + + return ippStsNoErr; + } +} + +IPPFUN(IppStatus, ippsAESEncryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) +{ + return cpProcessAES_ctr(pSrc, pDst, dataLen, pCtx, pCtrValue, ctrNumBitSize); +} + +IPPFUN(IppStatus, ippsAESDecryptCTR,(const Ipp8u* pSrc, Ipp8u* pDst, int dataLen, + const IppsAESSpec* pCtx, + Ipp8u* pCtrValue, int ctrNumBitSize)) +{ + return cpProcessAES_ctr(pSrc, pDst, dataLen, pCtx, pCtrValue, ctrNumBitSize); +} diff --git a/external/crypto_px/sources/ippcp/src/pcpaesminitca.c b/external/crypto_px/sources/ippcp/src/pcpaesminitca.c index ce273cdeec..262fa85e90 100644 --- a/external/crypto_px/sources/ippcp/src/pcpaesminitca.c +++ b/external/crypto_px/sources/ippcp/src/pcpaesminitca.c @@ -1,173 +1,173 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpaesm.h" -#include "pcptool.h" - -#include "pcprijtables.h" - -/*F* -// Name: ippsAESGetSize -// -// Purpose: Returns size of AES context (in bytes). -// -// Returns: Reason: -// ippStsNullPtrErr pSzie == NULL -// ippStsNoErr no errors -// -// Parameters: -// pSize pointer to AES size of context(in bytes) -// -*F*/ -IPPFUN(IppStatus, ippsAESGetSize,(int* pSize)) -{ - /* test size's pointer */ - IPP_BAD_PTR1_RET(pSize); - - *pSize = cpSizeofCtx_AES(); - - return ippStsNoErr; -} - -/* number of rounds (use [NK] for access) */ -static int rij128nRounds[3] = {NR128_128, NR128_192, NR128_256}; - -/* -// number of keys (estimation only!) (use [NK] for access) -// -// accurate number of keys necassary for encrypt/decrypt are: -// nKeys = NB * (NR+1) -// where NB - data block size (32-bit words) -// NR - number of rounds (depend on NB and keyLen) -// -// but the estimation -// estnKeys = (NK*n) >= nKeys -// or -// estnKeys = ( (NB*(NR+1) + (NK-1)) / NK) * NK -// where NK - key length (words) -// NB - data block size (word) -// NR - number of rounds (depend on NB and keyLen) -// nKeys - accurate numner of keys -// is more convinient when calculates key extension -*/ -static int rij128nKeys[3] = {44, 54, 64 }; - -/* -// helper for nRounds[] and estnKeys[] access -// note: x is length in 32-bits words -*/ -__INLINE int rij_index(int x) -{ return (x-NB(128))>>1; } - -/*F* -// Name: ippsAESInit -// -// Purpose: Init AES context for future usage -// and setup secret key. -// -// Returns: Reason: -// ippStsNullPtrErr pCtx == NULL -// ippStsMemAllocErr size of buffer is not match fro operation -// ippStsLengthErr keyLen != 16 -// keyLen != 24 -// keyLen != 32 -// -// Parameters: -// pKey secret key -// keyLen length of the secret key (in bytes) -// pCtx pointer to buffer initialized as AES context -// ctxSize available size (in bytes) of buffer above -// -// Note: -// if pKey==NULL, then AES initialized by zero value key -// -*F*/ -IPPFUN(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, - IppsAESSpec* pCtxRaw, int rawCtxSize)) -{ - /* test context pointer */ - IPP_BAD_PTR1_RET(pCtxRaw); - - /* make sure in legal keyLen */ - IPP_BADARG_RET(keyLen!=16 && keyLen!=24 && keyLen!=32, ippStsLengthErr); - - { - /* use aligned Rijndael context */ - IppsAESSpec* pCtx = (IppsAESSpec*)( IPP_ALIGNED_PTR(pCtxRaw, AES_ALIGNMENT) ); - - /* test available size of context buffer */ - if(((Ipp8u*)pCtx+sizeof(IppsAESSpec)) > ((Ipp8u*)pCtxRaw+rawCtxSize)) - IPP_ERROR_RET(ippStsMemAllocErr); - - else { - int keyWords = NK(keyLen*BITSIZE(Ipp8u)); - int nExpKeys = rij128nKeys [ rij_index(keyWords) ]; - int nRounds = rij128nRounds[ rij_index(keyWords) ]; - - Ipp8u zeroKey[32] = {0}; - const Ipp8u* pActualKey = pKey? pKey : zeroKey; - - /* clear context */ - PaddBlock(0, pCtx, sizeof(IppsAESSpec)); - - /* init spec */ - RIJ_ID(pCtx) = idCtxRijndael; - RIJ_NB(pCtx) = NB(128); - RIJ_NK(pCtx) = keyWords; - RIJ_NR(pCtx) = nRounds; - RIJ_SAFE_INIT(pCtx) = 1; - - /* set key expansion */ - ExpandRijndaelKey(pActualKey, keyWords, NB(128), nRounds, nExpKeys, - RIJ_EKEYS(pCtx), - RIJ_DKEYS(pCtx)); - { - int nr; - Ipp8u* pEnc_key = (Ipp8u*)(RIJ_EKEYS(pCtx)); - /* update key material: transpose inplace */ - for(nr=0; nr<(1+nRounds); nr++, pEnc_key+=16) { - SWAP(pEnc_key[ 1], pEnc_key[ 4]); - SWAP(pEnc_key[ 2], pEnc_key[ 8]); - SWAP(pEnc_key[ 3], pEnc_key[12]); - SWAP(pEnc_key[ 6], pEnc_key[ 9]); - SWAP(pEnc_key[ 7], pEnc_key[13]); - SWAP(pEnc_key[11], pEnc_key[14]); - } - } - RIJ_ENCODER(pCtx) = Safe2Encrypt_RIJ128; /* safe encoder (compact Sbox)) */ - RIJ_DECODER(pCtx) = Safe2Decrypt_RIJ128; /* safe decoder (compact Sbox)) */ - - return ippStsNoErr; - } - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpaesm.h" +#include "pcptool.h" + +#include "pcprijtables.h" + +/*F* +// Name: ippsAESGetSize +// +// Purpose: Returns size of AES context (in bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSzie == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to AES size of context(in bytes) +// +*F*/ +IPPFUN(IppStatus, ippsAESGetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = cpSizeofCtx_AES(); + + return ippStsNoErr; +} + +/* number of rounds (use [NK] for access) */ +static int rij128nRounds[3] = {NR128_128, NR128_192, NR128_256}; + +/* +// number of keys (estimation only!) (use [NK] for access) +// +// accurate number of keys necassary for encrypt/decrypt are: +// nKeys = NB * (NR+1) +// where NB - data block size (32-bit words) +// NR - number of rounds (depend on NB and keyLen) +// +// but the estimation +// estnKeys = (NK*n) >= nKeys +// or +// estnKeys = ( (NB*(NR+1) + (NK-1)) / NK) * NK +// where NK - key length (words) +// NB - data block size (word) +// NR - number of rounds (depend on NB and keyLen) +// nKeys - accurate numner of keys +// is more convinient when calculates key extension +*/ +static int rij128nKeys[3] = {44, 54, 64 }; + +/* +// helper for nRounds[] and estnKeys[] access +// note: x is length in 32-bits words +*/ +__INLINE int rij_index(int x) +{ return (x-NB(128))>>1; } + +/*F* +// Name: ippsAESInit +// +// Purpose: Init AES context for future usage +// and setup secret key. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// ippStsMemAllocErr size of buffer is not match fro operation +// ippStsLengthErr keyLen != 16 +// keyLen != 24 +// keyLen != 32 +// +// Parameters: +// pKey secret key +// keyLen length of the secret key (in bytes) +// pCtx pointer to buffer initialized as AES context +// ctxSize available size (in bytes) of buffer above +// +// Note: +// if pKey==NULL, then AES initialized by zero value key +// +*F*/ +IPPFUN(IppStatus, ippsAESInit,(const Ipp8u* pKey, int keyLen, + IppsAESSpec* pCtxRaw, int rawCtxSize)) +{ + /* test context pointer */ + IPP_BAD_PTR1_RET(pCtxRaw); + + /* make sure in legal keyLen */ + IPP_BADARG_RET(keyLen!=16 && keyLen!=24 && keyLen!=32, ippStsLengthErr); + + { + /* use aligned Rijndael context */ + IppsAESSpec* pCtx = (IppsAESSpec*)( IPP_ALIGNED_PTR(pCtxRaw, AES_ALIGNMENT) ); + + /* test available size of context buffer */ + if(((Ipp8u*)pCtx+sizeof(IppsAESSpec)) > ((Ipp8u*)pCtxRaw+rawCtxSize)) + IPP_ERROR_RET(ippStsMemAllocErr); + + else { + int keyWords = NK(keyLen*BITSIZE(Ipp8u)); + int nExpKeys = rij128nKeys [ rij_index(keyWords) ]; + int nRounds = rij128nRounds[ rij_index(keyWords) ]; + + Ipp8u zeroKey[32] = {0}; + const Ipp8u* pActualKey = pKey? pKey : zeroKey; + + /* clear context */ + PaddBlock(0, pCtx, sizeof(IppsAESSpec)); + + /* init spec */ + RIJ_ID(pCtx) = idCtxRijndael; + RIJ_NB(pCtx) = NB(128); + RIJ_NK(pCtx) = keyWords; + RIJ_NR(pCtx) = nRounds; + RIJ_SAFE_INIT(pCtx) = 1; + + /* set key expansion */ + ExpandRijndaelKey(pActualKey, keyWords, NB(128), nRounds, nExpKeys, + RIJ_EKEYS(pCtx), + RIJ_DKEYS(pCtx)); + { + int nr; + Ipp8u* pEnc_key = (Ipp8u*)(RIJ_EKEYS(pCtx)); + /* update key material: transpose inplace */ + for(nr=0; nr<(1+nRounds); nr++, pEnc_key+=16) { + SWAP(pEnc_key[ 1], pEnc_key[ 4]); + SWAP(pEnc_key[ 2], pEnc_key[ 8]); + SWAP(pEnc_key[ 3], pEnc_key[12]); + SWAP(pEnc_key[ 6], pEnc_key[ 9]); + SWAP(pEnc_key[ 7], pEnc_key[13]); + SWAP(pEnc_key[11], pEnc_key[14]); + } + } + RIJ_ENCODER(pCtx) = Safe2Encrypt_RIJ128; /* safe encoder (compact Sbox)) */ + RIJ_DECODER(pCtx) = Safe2Decrypt_RIJ128; /* safe decoder (compact Sbox)) */ + + return ippStsNoErr; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbn.h b/external/crypto_px/sources/ippcp/src/pcpbn.h index a6fd9a0b14..180f59c5fd 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbn.h +++ b/external/crypto_px/sources/ippcp/src/pcpbn.h @@ -1,210 +1,210 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_CP_BN_H) -#define _CP_BN_H - -#include "pcpbnuimpl.h" -#include "pcpbnuarith.h" -#include "pcpbnumisc.h" -#include "pcpbnu32arith.h" -#include "pcpbnu32misc.h" - -/* -// Big Number context -*/ -struct _cpBigNum -{ - IppCtxId idCtx; /* BigNum ctx id */ - IppsBigNumSGN sgn; /* sign */ - cpSize size; /* BigNum size (BNU_CHUNK_T) */ - cpSize room; /* BigNum max size (BNU_CHUNK_T) */ - BNU_CHUNK_T* number; /* BigNum value */ - BNU_CHUNK_T* buffer; /* temporary buffer */ -}; - -/* BN accessory macros */ -#define BN_ID(pBN) ((pBN)->idCtx) -#define BN_SIGN(pBN) ((pBN)->sgn) -#define BN_POSITIVE(pBN) (BN_SIGN(pBN)==ippBigNumPOS) -#define BN_NEGATIVE(pBN) (BN_SIGN(pBN)==ippBigNumNEG) -#define BN_NUMBER(pBN) ((pBN)->number) -#define BN_BUFFER(pBN) ((pBN)->buffer) -#define BN_ROOM(pBN) ((pBN)->room) -#define BN_SIZE(pBN) ((pBN)->size) -#define BN_SIZE32(pBN) ((pBN)->size*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))) -//#define BN_SIZE32(pBN) (BITS2WORD32_SIZE( BITSIZE_BNU(BN_NUMBER((pBN)),BN_SIZE((pBN))))) - -#define BN_VALID_ID(pBN) (BN_ID((pBN))==idCtxBigNum) - -#define INVERSE_SIGN(s) (((s)==ippBigNumPOS)? ippBigNumNEG : ippBigNumPOS) - -#define BN_ALIGNMENT ((int)sizeof(void*)) - - -/* pack-unpack context */ -void cpPackBigNumCtx(const IppsBigNumState* pBN, Ipp8u* pBuffer); -void cpUnpackBigNumCtx(const Ipp8u* pBuffer, IppsBigNumState* pBN); - -/* copy BN */ -__INLINE IppsBigNumState* cpBN_copy(IppsBigNumState* pDst, const IppsBigNumState* pSrc) -{ - BN_SIGN(pDst) = BN_SIGN(pSrc); - BN_SIZE(pDst) = BN_SIZE(pSrc); - ZEXPAND_COPY_BNU(BN_NUMBER(pDst), BN_ROOM(pDst), BN_NUMBER(pSrc), BN_SIZE(pSrc)); - return pDst; -} -/* set BN to zero */ -__INLINE IppsBigNumState* cpBN_zero(IppsBigNumState* pBN) -{ - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = 1; - ZEXPAND_BNU(BN_NUMBER(pBN),0, (int)BN_ROOM(pBN)); - return pBN; -} -/* fixup BN */ -__INLINE IppsBigNumState* cpBN_fix(IppsBigNumState* pBN) -{ - cpSize len = BN_SIZE(pBN); - FIX_BNU(BN_NUMBER(pBN), len); - BN_SIZE(pBN) = len; - return pBN; -} -/* set BN to chunk */ -__INLINE IppsBigNumState* cpBN_chunk(IppsBigNumState* pBN, BNU_CHUNK_T a) -{ - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = 1; - ZEXPAND_BNU(BN_NUMBER(pBN),0, (int)BN_ROOM(pBN)); - BN_NUMBER(pBN)[0] = a; - return pBN; -} -/* set BN to 2^m */ -__INLINE IppsBigNumState* cpBN_power2(IppsBigNumState* pBN, int power) -{ - cpSize size = BITS_BNU_CHUNK(power+1); - if(BN_ROOM(pBN) >= size) { - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = size; - ZEXPAND_BNU(BN_NUMBER(pBN),0, BN_ROOM(pBN)); - SET_BIT(BN_NUMBER(pBN), power); - return pBN; - } - else return NULL; -} - -/* bitsize of BN */ -__INLINE int cpBN_bitsize(const IppsBigNumState* pA) -{ - int bitsize = BITSIZE_BNU(BN_NUMBER(pA), BN_SIZE(pA)); - return bitsize; -} - -/* returns -1/0/+1 depemding on A~B comparison */ -__INLINE int cpBN_cmp(const IppsBigNumState* pA, const IppsBigNumState* pB) -{ - IppsBigNumSGN signA = BN_SIGN(pA); - IppsBigNumSGN signB = BN_SIGN(pB); - - if(signA==signB) { - int result = cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pB), BN_SIZE(pB)); - return (ippBigNumPOS==signA)? result : -result; - } - return (ippBigNumPOS==signA)? 1 : -1; -} - -/* returns -1/0/+1 depemding on A comparison 00 */ -__INLINE int cpBN_tst(const IppsBigNumState* pA) -{ - if(1==BN_SIZE(pA) && 0==BN_NUMBER(pA)[0]) - return 0; - else - return BN_POSITIVE(pA)? 1 : -1; -} - - -// some addtition functions -__INLINE int IsZero_BN(const IppsBigNumState* pA) -{ - return ( BN_SIZE(pA)==1 ) && ( BN_NUMBER(pA)[0]==0 ); -} -__INLINE int IsOdd_BN(const IppsBigNumState* pA) -{ - return BN_NUMBER(pA)[0] & 1; -} - -__INLINE IppsBigNumState* BN_Word(IppsBigNumState* pBN, BNU_CHUNK_T w) -{ - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = 1; - ZEXPAND_BNU(BN_NUMBER(pBN),0, BN_ROOM(pBN)); - BN_NUMBER(pBN)[0] = w; - return pBN; -} -__INLINE IppsBigNumState* BN_Set(const BNU_CHUNK_T* pData, cpSize len, IppsBigNumState* pBN) -{ - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = len; - ZEXPAND_COPY_BNU(BN_NUMBER(pBN), BN_ROOM(pBN), pData, len); - return pBN; -} -__INLINE IppsBigNumState* BN_Make(BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer, cpSize len, IppsBigNumState* pBN) -{ - BN_ID(pBN) = idCtxBigNum; - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = 1; - BN_ROOM(pBN) = len; - BN_NUMBER(pBN) = pData; - BN_BUFFER(pBN) = pBuffer; - return pBN; -} - - - -/* -// fixed single chunk BN -*/ -typedef struct _ippcpBigNumChunk { - IppsBigNumState bn; - BNU_CHUNK_T value; - BNU_CHUNK_T temporary; -} IppsBigNumStateChunk; - -/* reference to BN(1) and BN(2) */ -IppsBigNumState* cpBN_OneRef(void); -IppsBigNumState* cpBN_TwoRef(void); -IppsBigNumState* cpBN_ThreeRef(void); - -#define BN_ONE_REF() cpBN_OneRef() -#define BN_TWO_REF() cpBN_TwoRef() -#define BN_THREE_REF() cpBN_ThreeRef() - -#endif /* _CP_BN_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BN_H) +#define _CP_BN_H + +#include "pcpbnuimpl.h" +#include "pcpbnuarith.h" +#include "pcpbnumisc.h" +#include "pcpbnu32arith.h" +#include "pcpbnu32misc.h" + +/* +// Big Number context +*/ +struct _cpBigNum +{ + IppCtxId idCtx; /* BigNum ctx id */ + IppsBigNumSGN sgn; /* sign */ + cpSize size; /* BigNum size (BNU_CHUNK_T) */ + cpSize room; /* BigNum max size (BNU_CHUNK_T) */ + BNU_CHUNK_T* number; /* BigNum value */ + BNU_CHUNK_T* buffer; /* temporary buffer */ +}; + +/* BN accessory macros */ +#define BN_ID(pBN) ((pBN)->idCtx) +#define BN_SIGN(pBN) ((pBN)->sgn) +#define BN_POSITIVE(pBN) (BN_SIGN(pBN)==ippBigNumPOS) +#define BN_NEGATIVE(pBN) (BN_SIGN(pBN)==ippBigNumNEG) +#define BN_NUMBER(pBN) ((pBN)->number) +#define BN_BUFFER(pBN) ((pBN)->buffer) +#define BN_ROOM(pBN) ((pBN)->room) +#define BN_SIZE(pBN) ((pBN)->size) +#define BN_SIZE32(pBN) ((pBN)->size*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))) +//#define BN_SIZE32(pBN) (BITS2WORD32_SIZE( BITSIZE_BNU(BN_NUMBER((pBN)),BN_SIZE((pBN))))) + +#define BN_VALID_ID(pBN) (BN_ID((pBN))==idCtxBigNum) + +#define INVERSE_SIGN(s) (((s)==ippBigNumPOS)? ippBigNumNEG : ippBigNumPOS) + +#define BN_ALIGNMENT ((int)sizeof(void*)) + + +/* pack-unpack context */ +void cpPackBigNumCtx(const IppsBigNumState* pBN, Ipp8u* pBuffer); +void cpUnpackBigNumCtx(const Ipp8u* pBuffer, IppsBigNumState* pBN); + +/* copy BN */ +__INLINE IppsBigNumState* cpBN_copy(IppsBigNumState* pDst, const IppsBigNumState* pSrc) +{ + BN_SIGN(pDst) = BN_SIGN(pSrc); + BN_SIZE(pDst) = BN_SIZE(pSrc); + ZEXPAND_COPY_BNU(BN_NUMBER(pDst), BN_ROOM(pDst), BN_NUMBER(pSrc), BN_SIZE(pSrc)); + return pDst; +} +/* set BN to zero */ +__INLINE IppsBigNumState* cpBN_zero(IppsBigNumState* pBN) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + ZEXPAND_BNU(BN_NUMBER(pBN),0, (int)BN_ROOM(pBN)); + return pBN; +} +/* fixup BN */ +__INLINE IppsBigNumState* cpBN_fix(IppsBigNumState* pBN) +{ + cpSize len = BN_SIZE(pBN); + FIX_BNU(BN_NUMBER(pBN), len); + BN_SIZE(pBN) = len; + return pBN; +} +/* set BN to chunk */ +__INLINE IppsBigNumState* cpBN_chunk(IppsBigNumState* pBN, BNU_CHUNK_T a) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + ZEXPAND_BNU(BN_NUMBER(pBN),0, (int)BN_ROOM(pBN)); + BN_NUMBER(pBN)[0] = a; + return pBN; +} +/* set BN to 2^m */ +__INLINE IppsBigNumState* cpBN_power2(IppsBigNumState* pBN, int power) +{ + cpSize size = BITS_BNU_CHUNK(power+1); + if(BN_ROOM(pBN) >= size) { + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = size; + ZEXPAND_BNU(BN_NUMBER(pBN),0, BN_ROOM(pBN)); + SET_BIT(BN_NUMBER(pBN), power); + return pBN; + } + else return NULL; +} + +/* bitsize of BN */ +__INLINE int cpBN_bitsize(const IppsBigNumState* pA) +{ + int bitsize = BITSIZE_BNU(BN_NUMBER(pA), BN_SIZE(pA)); + return bitsize; +} + +/* returns -1/0/+1 depemding on A~B comparison */ +__INLINE int cpBN_cmp(const IppsBigNumState* pA, const IppsBigNumState* pB) +{ + IppsBigNumSGN signA = BN_SIGN(pA); + IppsBigNumSGN signB = BN_SIGN(pB); + + if(signA==signB) { + int result = cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pB), BN_SIZE(pB)); + return (ippBigNumPOS==signA)? result : -result; + } + return (ippBigNumPOS==signA)? 1 : -1; +} + +/* returns -1/0/+1 depemding on A comparison 00 */ +__INLINE int cpBN_tst(const IppsBigNumState* pA) +{ + if(1==BN_SIZE(pA) && 0==BN_NUMBER(pA)[0]) + return 0; + else + return BN_POSITIVE(pA)? 1 : -1; +} + + +// some addtition functions +__INLINE int IsZero_BN(const IppsBigNumState* pA) +{ + return ( BN_SIZE(pA)==1 ) && ( BN_NUMBER(pA)[0]==0 ); +} +__INLINE int IsOdd_BN(const IppsBigNumState* pA) +{ + return BN_NUMBER(pA)[0] & 1; +} + +__INLINE IppsBigNumState* BN_Word(IppsBigNumState* pBN, BNU_CHUNK_T w) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + ZEXPAND_BNU(BN_NUMBER(pBN),0, BN_ROOM(pBN)); + BN_NUMBER(pBN)[0] = w; + return pBN; +} +__INLINE IppsBigNumState* BN_Set(const BNU_CHUNK_T* pData, cpSize len, IppsBigNumState* pBN) +{ + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = len; + ZEXPAND_COPY_BNU(BN_NUMBER(pBN), BN_ROOM(pBN), pData, len); + return pBN; +} +__INLINE IppsBigNumState* BN_Make(BNU_CHUNK_T* pData, BNU_CHUNK_T* pBuffer, cpSize len, IppsBigNumState* pBN) +{ + BN_ID(pBN) = idCtxBigNum; + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; + BN_ROOM(pBN) = len; + BN_NUMBER(pBN) = pData; + BN_BUFFER(pBN) = pBuffer; + return pBN; +} + + + +/* +// fixed single chunk BN +*/ +typedef struct _ippcpBigNumChunk { + IppsBigNumState bn; + BNU_CHUNK_T value; + BNU_CHUNK_T temporary; +} IppsBigNumStateChunk; + +/* reference to BN(1) and BN(2) */ +IppsBigNumState* cpBN_OneRef(void); +IppsBigNumState* cpBN_TwoRef(void); +IppsBigNumState* cpBN_ThreeRef(void); + +#define BN_ONE_REF() cpBN_OneRef() +#define BN_TWO_REF() cpBN_TwoRef() +#define BN_THREE_REF() cpBN_ThreeRef() + +#endif /* _CP_BN_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnca.c b/external/crypto_px/sources/ippcp/src/pcpbnca.c index c2a276796b..5e1e2a3d38 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnca.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnca.c @@ -1,1058 +1,1058 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcptool.h" - -/* BN(1) and reference */ -static IppsBigNumStateChunk cpChunk_BN1 = { - { - idCtxBigNum, - ippBigNumPOS, - 1,1, - &cpChunk_BN1.value,&cpChunk_BN1.temporary - }, - 1,0 -}; -IppsBigNumState* cpBN_OneRef(void) -{ return &cpChunk_BN1.bn; }; - -/* BN(2) and reference */ -static IppsBigNumStateChunk cpChunk_BN2 = { - { - idCtxBigNum, - ippBigNumPOS, - 1,1, - &cpChunk_BN2.value,&cpChunk_BN2.temporary - }, - 2,0 -}; -IppsBigNumState* cpBN_TwoRef(void) -{ return &cpChunk_BN2.bn; }; - -/* BN(3) and reference */ -static IppsBigNumStateChunk cpChunk_BN3 = { - { - idCtxBigNum, - ippBigNumPOS, - 1,1, - &cpChunk_BN3.value,&cpChunk_BN3.temporary - }, - 3,0 -}; -IppsBigNumState* cpBN_ThreeRef(void) -{ return &cpChunk_BN3.bn; }; - - - -/*F* -// Name: ippsBigNumGetSize -// -// Purpose: Returns size of BigNum ctx (bytes). -// -// Returns: Reason: -// ippStsNullPtrErr pCtxSize == NULL -// ippStsLengthErr len32 < 1 -// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) -// ippStsNoErr no errors -// -// Parameters: -// pCtxSize pointer BigNum ctx size -// -*F*/ -IPPFUN(IppStatus, ippsBigNumGetSize, (cpSize len32, cpSize *pCtxSize)) -{ - IPP_BAD_PTR1_RET(pCtxSize); - IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); - - { - /* convert length to the number of BNU_CHUNK_T */ - cpSize len = INTERNAL_BNU_LENGTH(len32); - - /* reserve one BNU_CHUNK_T more for cpDiv_BNU, - mul, mont exp operations */ - len++; - - *pCtxSize = sizeof(IppsBigNumState) - + len*sizeof(BNU_CHUNK_T) - + len*sizeof(BNU_CHUNK_T) - + BN_ALIGNMENT-1; - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsBigNumInit -// -// Purpose: Init BigNum spec for future usage. -// -// Returns: Reason: -// ippStsNullPtrErr pBN == NULL -// ippStsLengthErr len32<1 -// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) -// ippStsNoErr no errors -// -// Parameters: -// len32 max BN length (32-bits segments) -// pBN BigNum ctx -// -*F*/ -IPPFUN(IppStatus, ippsBigNumInit, (cpSize len32, IppsBigNumState* pBN)) -{ - IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); - IPP_BAD_PTR1_RET(pBN); - pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); - - { - Ipp8u* ptr = (Ipp8u*)pBN; - - /* convert length to the number of BNU_CHUNK_T */ - cpSize len = INTERNAL_BNU_LENGTH(len32); - - BN_ID(pBN) = idCtxUnknown; - BN_SIGN(pBN) = ippBigNumPOS; - BN_SIZE(pBN) = 1; /* initial valie is zero */ - BN_ROOM(pBN) = len; /* close to what has been passed by user */ - - /* reserve one BNU_CHUNK_T more for cpDiv_BNU, - mul, mont exp operations */ - len++; - - /* allocate buffers */ - BN_NUMBER(pBN) = (BNU_CHUNK_T*)(ptr += sizeof(IppsBigNumState)); - BN_BUFFER(pBN) = (BNU_CHUNK_T*)(ptr += len*sizeof(BNU_CHUNK_T)); /* use expanded length here */ - - /* set BN value and buffer to zero */ - ZEXPAND_BNU(BN_NUMBER(pBN), 0, len); - ZEXPAND_BNU(BN_BUFFER(pBN), 0, len); - - BN_ID(pBN) = idCtxBigNum; - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsCmpZero_BN -// -// Purpose: Test BigNum value. -// -// Returns: Reason: -// ippStsNullPtrErr pBN == NULL -// pResult == NULL -// ippStsContextMatchErr BN_VALID_ID() -// ippStsNoErr no errors -// -// Parameters: -// pBN BigNum ctx -// pResult result of comparison -// -*F*/ -IPPFUN(IppStatus, ippsCmpZero_BN, (const IppsBigNumState* pBN, Ipp32u* pResult)) -{ - IPP_BAD_PTR2_RET(pBN, pResult); - - pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); - - if(BN_SIZE(pBN)==1 && BN_NUMBER(pBN)[0]==0) - *pResult = IS_ZERO; - else if (BN_SIGN(pBN)==ippBigNumPOS) - *pResult = GREATER_THAN_ZERO; - else if (BN_SIGN(pBN)==ippBigNumNEG) - *pResult = LESS_THAN_ZERO; - - return ippStsNoErr; -} - - -/*F* -// Name: ippsCmp_BN -// -// Purpose: Compare two BigNums. -// -// Returns: Reason: -// ippStsNullPtrErr pA == NULL -// pB == NULL -// pResult == NULL -// ippStsContextMatchErr BN_VALID_ID(pA) -// BN_VALID_ID(pB) -// ippStsNoErr no errors -// -// Parameters: -// pA BigNum ctx -// pB BigNum ctx -// pResult result of comparison -// -*F*/ -IPPFUN(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u *pResult)) -{ - IPP_BAD_PTR3_RET(pA, pB, pResult); - - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - - { - int res; - if(BN_SIGN(pA)==BN_SIGN(pB)) { - res = cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pB), BN_SIZE(pB)); - if(ippBigNumNEG==BN_SIGN(pA)) - res = -res; - } - else - res = (ippBigNumPOS==BN_SIGN(pA))? 1 :-1; - - *pResult = (1==res)? IPP_IS_GT : (-1==res)? IPP_IS_LT : IPP_IS_EQ; - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsSet_BN -// -// Purpose: Set BigNum. -// -// Returns: Reason: -// ippStsNullPtrErr pBN == NULL -// pData == NULL -// ippStsContextMatchErr BN_VALID_ID(pBN) -// ippStsLengthErr len32 < 1 -// ippStsOutOfRangeErr len32 > BN_ROOM() -// ippStsNoErr no errors -// -// Parameters: -// sgn sign -// len32 data size (in Ipp32u chunks) -// pData source data pointer -// pBn BigNum ctx -// -*F*/ -IPPFUN(IppStatus, ippsSet_BN, (IppsBigNumSGN sgn, cpSize len32, const Ipp32u* pData, - IppsBigNumState* pBN)) -{ - IPP_BAD_PTR2_RET(pData, pBN); - - pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); - - IPP_BADARG_RET(len32<1, ippStsLengthErr); - - /* compute real size */ - FIX_BNU(pData, len32); - - { - cpSize len = INTERNAL_BNU_LENGTH(len32); - IPP_BADARG_RET(len > BN_ROOM(pBN), ippStsOutOfRangeErr); - - ZEXPAND_COPY_BNU((Ipp32u*)BN_NUMBER(pBN), BN_ROOM(pBN)*(int)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), pData, len32); - - BN_SIZE(pBN) = len; - - if(len32==1 && pData[0] == 0) - sgn = ippBigNumPOS; /* consider zero value as positive */ - BN_SIGN(pBN) = sgn; - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsRef_BN -// -// Purpose: Get BigNum info. -// -// Returns: Reason: -// ippStsNullPtrErr pBN == NULL -// ippStsContextMatchErr BN_VALID_ID(pBN) -// ippStsNoErr no errors -// -// Parameters: -// pSgn pointer to the sign -// pBitSize pointer to the data size (in bits) -// ppData pointer to the data buffer -// pBN BigNum ctx -// -*F*/ -IPPFUN(IppStatus, ippsRef_BN, (IppsBigNumSGN* pSgn, cpSize* pBitSize, Ipp32u** const ppData, - const IppsBigNumState *pBN)) -{ - IPP_BAD_PTR1_RET(pBN); - - pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); - - if(pSgn) - *pSgn = BN_SIGN(pBN); - if(pBitSize) { - cpSize bitLen = BITSIZE_BNU(BN_NUMBER(pBN), BN_SIZE(pBN)); - *pBitSize = bitLen? bitLen : 1; - } - - if(ppData) - *ppData = (Ipp32u*)BN_NUMBER(pBN); - - return ippStsNoErr; -} - - -/*F* -// Name: ippsAdd_BN -// -// Purpose: Add BigNum. -// -// Returns: Reason: -// ippStsNullPtrErr pA == NULL -// pB == NULL -// pR == NULL -// ippStsContextMatchErr BN_VALID_ID(pA) -// BN_VALID_ID(pB) -// BN_VALID_ID(pR) -// ippStsOutOfRangeErr pR can not hold result -// ippStsNoErr no errors -// -// Parameters: -// pA source BigNum -// pB source BigNum -// pR resultant BigNum -// -*F*/ -IPPFUN(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - IPP_BAD_PTR3_RET(pA, pB, pR); - - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); - - { - cpSize nsA = BN_SIZE(pA); - cpSize nsB = BN_SIZE(pB); - cpSize nsR = BN_ROOM(pR); - IPP_BADARG_RET(nsR < IPP_MAX(nsA, nsB), ippStsOutOfRangeErr); - - { - BNU_CHUNK_T* pDataR = BN_NUMBER(pR); - - IppsBigNumSGN sgnA = BN_SIGN(pA); - IppsBigNumSGN sgnB = BN_SIGN(pB); - BNU_CHUNK_T* pDataA = BN_NUMBER(pA); - BNU_CHUNK_T* pDataB = BN_NUMBER(pB); - - BNU_CHUNK_T carry; - - if(sgnA==sgnB) { - if(nsA < nsB) { - SWAP(nsA, nsB); - SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); - } - - carry = cpAdd_BNU(pDataR, pDataA, pDataB, nsB); - if(nsA>nsB) - carry = cpInc_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); - if(carry) { - if(nsR>nsA) - pDataR[nsA++] = carry; - else - IPP_ERROR_RET(ippStsOutOfRangeErr); - } - BN_SIGN(pR) = sgnA; - } - - else { - int cmpRes = cpCmp_BNU(pDataA, nsA, pDataB, nsB); - - if(0==cmpRes) { - pDataR[0] = 0; - BN_SIZE(pR) = 1; - BN_SIGN(pR) = ippBigNumPOS; - return ippStsNoErr; - } - - if(0>cmpRes) { - SWAP(nsA, nsB); - SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); - } - - carry = cpSub_BNU(pDataR, pDataA, pDataB, nsB); - if(nsA>nsB) - cpDec_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); - - BN_SIGN(pR) = cmpRes>0? sgnA : INVERSE_SIGN(sgnA); - } - - FIX_BNU(pDataR, nsA); - BN_SIZE(pR) = nsA; - - return ippStsNoErr; - } - } -} - - -/*F* -// Name: ippsSub_BN -// -// Purpose: Subtcrac BigNum. -// -// Returns: Reason: -// ippStsNullPtrErr pA == NULL -// pB == NULL -// pR == NULL -// ippStsContextMatchErr BN_VALID_ID(pA) -// BN_VALID_ID(pB) -// BN_VALID_ID(pR) -// ippStsOutOfRangeErr pR can not hold result -// ippStsNoErr no errors -// -// Parameters: -// pA source BigNum -// pB source BigNum -// pR resultant BigNum -// -*F*/ -IPPFUN(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - IPP_BAD_PTR3_RET(pA, pB, pR); - - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); - - { - cpSize nsA = BN_SIZE(pA); - cpSize nsB = BN_SIZE(pB); - cpSize nsR = BN_ROOM(pR); - IPP_BADARG_RET(nsR < IPP_MAX(nsA, nsB), ippStsOutOfRangeErr); - - { - BNU_CHUNK_T* pDataR = BN_NUMBER(pR); - - IppsBigNumSGN sgnA = BN_SIGN(pA); - IppsBigNumSGN sgnB = BN_SIGN(pB); - BNU_CHUNK_T* pDataA = BN_NUMBER(pA); - BNU_CHUNK_T* pDataB = BN_NUMBER(pB); - - BNU_CHUNK_T carry; - - if(sgnA!=sgnB) { - if(nsA < nsB) { - SWAP(nsA, nsB); - SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); - } - - carry = cpAdd_BNU(pDataR, pDataA, pDataB, nsB); - if(nsA>nsB) - carry = cpInc_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); - if(carry) { - if(nsR > nsA) - pDataR[nsA++] = carry; - else - IPP_ERROR_RET(ippStsOutOfRangeErr); - } - BN_SIGN(pR) = sgnA; - } - - else { - int cmpRes= cpCmp_BNU(pDataA, nsA, pDataB, nsB); - - if(0==cmpRes) { - ZEXPAND_BNU(pDataR,0, nsR); - BN_SIZE(pR) = 1; - BN_SIGN(pR) = ippBigNumPOS; - return ippStsNoErr; - } - - if(0>cmpRes) { - SWAP(nsA, nsB); - SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); - } - - carry = cpSub_BNU(pDataR, pDataA, pDataB, nsB); - if(nsA>nsB) - cpDec_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); - - BN_SIGN(pR) = cmpRes>0? sgnA : INVERSE_SIGN(sgnA); - } - - FIX_BNU(pDataR, nsA); - BN_SIZE(pR) = nsA; - - return ippStsNoErr; - } - } -} - - -/*F* -// Name: ippsMul_BN -// -// Purpose: Multiply BigNum. -// -// Returns: Reason: -// ippStsNullPtrErr pA == NULL -// pB == NULL -// pR == NULL -// ippStsContextMatchErr BN_VALID_ID(pA) -// BN_VALID_ID(pB) -// BN_VALID_ID(pR) -// ippStsOutOfRangeErr pR can not hold result -// ippStsNoErr no errors -// -// Parameters: -// pA source BigNum -// pB source BigNum -// pR resultant BigNum -// -*F*/ -IPPFUN(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) -{ - IPP_BAD_PTR3_RET(pA, pB, pR); - - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); - - { - BNU_CHUNK_T* pDataA = BN_NUMBER(pA); - BNU_CHUNK_T* pDataB = BN_NUMBER(pB); - BNU_CHUNK_T* pDataR = BN_NUMBER(pR); - - cpSize nsA = BN_SIZE(pA); - cpSize nsB = BN_SIZE(pB); - cpSize nsR = BN_ROOM(pR); - - cpSize bitSizeA = BITSIZE_BNU(pDataA, nsA); - cpSize bitSizeB = BITSIZE_BNU(pDataB, nsB); - - /* test if multiplicant/multiplier is zero */ - if(!bitSizeA || !bitSizeB) { - BN_SIZE(pR) = 1; - BN_SIGN(pR) = IppsBigNumPOS; - pDataR[0] = 0; - return ippStsNoErr; - } - - /* test if even low estimation of product A*B exceeded */ - IPP_BADARG_RET(nsR*BNU_CHUNK_BITS < (bitSizeA+bitSizeB-1), ippStsOutOfRangeErr); - - { - BNU_CHUNK_T* aData = pDataA; - BNU_CHUNK_T* bData = pDataB; - - if(pA == pR) { - aData = BN_BUFFER(pR); - COPY_BNU(aData, pDataA, nsA); - } - if((pB == pR) && (pA != pB)) { - bData = BN_BUFFER(pR); - COPY_BNU(bData, pDataB, nsB); - } - - /* clear result */ - ZEXPAND_BNU(pDataR, 0, nsR+1); - - cpMul_BNU_school(pDataR, aData, nsA, bData, nsB); - - nsR = (bitSizeA + bitSizeB + BNU_CHUNK_BITS - 1) /BNU_CHUNK_BITS; - FIX_BNU(pDataR, nsR); - IPP_BADARG_RET(nsR>BN_ROOM(pR), ippStsOutOfRangeErr); - - BN_SIZE(pR) = nsR; - BN_SIGN(pR) = (BN_SIGN(pA)==BN_SIGN(pB)? ippBigNumPOS : ippBigNumNEG); - return ippStsNoErr; - } - } -} - - -/*F* -// Name: ippsDiv_BN -// -// Purpose: Divide BigNum. -// -// Returns: Reason: -// ippStsNullPtrErr pA == NULL -// pB == NULL -// pQ == NULL -// pR == NULL -// ippStsContextMatchErr BN_VALID_ID(pA) -// BN_VALID_ID(pB) -// BN_VALID_ID(pQ) -// BN_VALID_ID(pR) -// ippStsOutOfRangeErr pQ and/or pR can not hold result -// ippStsNoErr no errors -// -// Parameters: -// pA source BigNum -// pB source BigNum -// pQ quotient BigNum -// pR reminder BigNum -// -// A = Q*B + R, 0 <= val(R) < val(B), sgn(A)==sgn(R) -// -*F*/ -IPPFUN(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) -{ - IPP_BAD_PTR4_RET(pA, pB, pQ, pR); - - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - pQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pQ, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pQ), ippStsContextMatchErr); - pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); - - IPP_BADARG_RET(BN_SIZE(pB)== 1 && BN_NUMBER(pB)[0]==0, ippStsDivByZeroErr); - - IPP_BADARG_RET(BN_ROOM(pR)cmpRes) - SWAP_PTR(IppsBigNumState, x, y); - if(0==cmpRes) { - COPY_BNU(BN_NUMBER(g), BN_NUMBER(x), BN_SIZE(x)); - BN_SIGN(g) = ippBigNumPOS; - BN_SIZE(g) = BN_SIZE(x); - return ippStsNoErr; - } - if(BN_SIZE(x)==1) { - BNU_CHUNK_T gcd = cpGcd_BNU(BN_NUMBER(x)[0], BN_NUMBER(y)[0]); - BN_NUMBER(g)[0] = gcd; - BN_SIZE(g) = 1; - return ippStsNoErr; - } - } - - { - Ipp32u* xBuffer = (Ipp32u*)BN_BUFFER(x); - Ipp32u* yBuffer = (Ipp32u*)BN_BUFFER(y); - Ipp32u* gBuffer = (Ipp32u*)BN_BUFFER(g); - Ipp32u* xData = (Ipp32u*)BN_NUMBER(x); - Ipp32u* yData = (Ipp32u*)BN_NUMBER(y); - Ipp32u* gData = (Ipp32u*)BN_NUMBER(g); - cpSize nsXmax = BN_ROOM(x)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); - cpSize nsYmax = BN_ROOM(y)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); - cpSize nsGmax = BN_ROOM(g)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); - cpSize nsX = BN_SIZE(x)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); - cpSize nsY = BN_SIZE(y)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); - - Ipp32u* T; - Ipp32u* u; - - FIX_BNU(xData, nsX); - FIX_BNU(yData, nsY); - - /* init buffers */ - ZEXPAND_COPY_BNU(xBuffer, nsX, xData, nsXmax); - ZEXPAND_COPY_BNU(yBuffer, nsY, yData, nsYmax); - - T = gBuffer; - u = gData; - ZEXPAND_BNU(T, 0, nsGmax); - ZEXPAND_BNU(u, 0, nsGmax); - - while(nsX > (cpSize)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))) { - /* xx and yy is the high-order digits of x and y (yy could be 0) */ - - Ipp64u xx = (Ipp64u)(xBuffer[nsX-1]); - Ipp64u yy = (nsY < nsX)? 0 : (Ipp64u)(yBuffer[nsY-1]); - - Ipp64s AA = 1; - Ipp64s BB = 0; - Ipp64s CC = 0; - Ipp64s DD = 1; - Ipp64s t; - - while((yy+CC)!=0 && (yy+DD)!=0) { - Ipp64u q = ( xx + AA ) / ( yy + CC ); - Ipp64u q1 = ( xx + BB ) / ( yy + DD ); - if(q!=q1) - break; - t = AA - q*CC; - AA = CC; - CC = t; - t = BB - q*DD; - BB = DD; - DD = t; - t = xx - q*yy; - xx = yy; - yy = t; - } - - if(BB == 0) { - /* T = x mod y */ - cpSize nsT = cpMod_BNU32(xBuffer, nsX, yBuffer, nsY); - ZEXPAND_BNU(T, 0, nsGmax); - COPY_BNU(T, xBuffer, nsT); - /* a = b; b = T; */ - ZEXPAND_BNU(xBuffer, 0, nsXmax); - COPY_BNU(xBuffer, yBuffer, nsY); - ZEXPAND_BNU(yBuffer, 0, nsYmax); - COPY_BNU(yBuffer, T, nsY); - } - - else { - Ipp32u carry; - /* - // T = AA*x + BB*y; - // u = CC*x + DD*y; - // b = u; a = T; - */ - if((AA <= 0)&&(BB>=0)) { - Ipp32u a1 = (Ipp32u)(-AA); - carry = cpMulDgt_BNU32(T, yBuffer, nsY, (Ipp32u)BB); - carry = cpMulDgt_BNU32(u, xBuffer, nsY, a1); - /* T = BB*y - AA*x; */ - carry = cpSub_BNU32(T, T, u, nsY); - } - else { - if((AA >= 0)&&(BB<=0)) { - Ipp32u b1 = (Ipp32u)(-BB); - carry = cpMulDgt_BNU32(T, xBuffer, nsY, (Ipp32u)AA); - carry = cpMulDgt_BNU32(u, yBuffer, nsY, b1); - /* T = AA*x - BB*y; */ - carry = cpSub_BNU32(T, T, u, nsY); - } - else { - /*AA*BB>=0 */ - carry = cpMulDgt_BNU32(T, xBuffer, nsY, (Ipp32u)AA); - carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)BB); - /* T = AA*x + BB*y; */ - carry = cpAdd_BNU32(T, T, u, nsY); - } - } - - /* Now T is reserved. We use only u for intermediate results. */ - if((CC <= 0)&&(DD>=0)){ - Ipp32u c1 = (Ipp32u)(-CC); - /* u = x*CC; x = u; */ - carry = cpMulDgt_BNU32(u, xBuffer, nsY, c1); - COPY_BNU(xBuffer, u, nsY); - /* u = y*DD; */ - carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)DD); - /* u = DD*y - CC*x; */ - carry = cpSub_BNU32(u, u, xBuffer, nsY); - } - else { - if((CC >= 0)&&(DD<=0)){ - Ipp32u d1 = (Ipp32u)(-DD); - /* u = y*DD; y = u */ - carry = cpMulDgt_BNU32(u, yBuffer, nsY, d1); - COPY_BNU(yBuffer, u, nsY); - /* u = CC*x; */ - carry = cpMulDgt_BNU32(u, xBuffer, nsY, (Ipp32u)CC); - /* u = CC*x - DD*y; */ - carry = cpSub_BNU32(u, u, yBuffer, nsY); - } - else { - /*CC*DD>=0 */ - /* y = y*DD */ - carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)DD); - COPY_BNU(yBuffer, u, nsY); - /* u = x*CC */ - carry = cpMulDgt_BNU32(u, xBuffer, nsY, (Ipp32u)CC); - /* u = x*CC + y*DD */ - carry = cpAdd_BNU32(u, u, yBuffer, nsY); - } - } - - /* y = u; x = T; */ - COPY_BNU(yBuffer, u, nsY); - COPY_BNU(xBuffer, T, nsY); - } - - FIX_BNU(xBuffer, nsX); - FIX_BNU(yBuffer, nsY); - - if (nsY > nsX) { - SWAP_PTR(IppsBigNumState, x, y); - SWAP(nsX, nsY); - } - - if (nsY==1 && yBuffer[nsY-1]==0) { - /* End evaluation */ - ZEXPAND_BNU(gData, 0, nsGmax); - COPY_BNU(gData, xBuffer, nsX); - BN_SIZE(g) = INTERNAL_BNU_LENGTH(nsX); - BN_SIGN(g) = ippBigNumPOS; - return ippStsNoErr; - } - } - - BN_NUMBER(g)[0] = cpGcd_BNU(((BNU_CHUNK_T*)xBuffer)[0], ((BNU_CHUNK_T*)yBuffer)[0]); - BN_SIZE(g) = 1; - BN_SIGN(g) = ippBigNumPOS; - return ippStsNoErr; - } - } -} - - -/*F* -// Name: ippsModInv_BN -// -// Purpose: Multiplicative Inversion BigNum. -// -// Returns: Reason: -// ippStsNullPtrErr pA == NULL -// pM == NULL -// pR == NULL -// ippStsContextMatchErr BN_VALID_ID(pA) -// BN_VALID_ID(pM) -// BN_VALID_ID(pR) -// ippStsBadArgErr A<=0 -// ippStsBadModulusErr M<=0 -// ippStsScaleRangeErr A>=M -// ippStsOutOfRangeErr pR can not hold result -// ippStsNoErr no errors -// ippStsBadModulusErr inversion not found -// -// Parameters: -// pA source (value) BigNum -// pM source (modulus) BigNum -// pR reminder BigNum -// -*F*/ -IPPFUN(IppStatus, ippsModInv_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR) ) -{ - IPP_BAD_PTR3_RET(pA, pM, pR); - - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - pM = (IppsBigNumState*)( IPP_ALIGNED_PTR(pM, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pM), ippStsContextMatchErr); - pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); - - IPP_BADARG_RET(BN_ROOM(pR) < BN_SIZE(pM), ippStsOutOfRangeErr); - IPP_BADARG_RET(BN_NEGATIVE(pA) || (BN_SIZE(pA)==1 && BN_NUMBER(pA)[0]==0), ippStsBadArgErr); - IPP_BADARG_RET(BN_NEGATIVE(pM) || (BN_SIZE(pM)==1 && BN_NUMBER(pM)[0]==0), ippStsBadModulusErr); - IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pM), BN_SIZE(pM)) >= 0, ippStsScaleRangeErr); - - { - cpSize nsR = cpModInv_BNU(BN_NUMBER(pR), - BN_NUMBER(pA), BN_SIZE(pA), - BN_NUMBER(pM), BN_SIZE(pM), - BN_BUFFER(pR), BN_BUFFER(pA), BN_BUFFER(pM)); - if(nsR) { - BN_SIGN(pR) = ippBigNumPOS; - BN_SIZE(pR) = nsR; - return ippStsNoErr; - } - else - return ippStsBadModulusErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcptool.h" + +/* BN(1) and reference */ +static IppsBigNumStateChunk cpChunk_BN1 = { + { + idCtxBigNum, + ippBigNumPOS, + 1,1, + &cpChunk_BN1.value,&cpChunk_BN1.temporary + }, + 1,0 +}; +IppsBigNumState* cpBN_OneRef(void) +{ return &cpChunk_BN1.bn; }; + +/* BN(2) and reference */ +static IppsBigNumStateChunk cpChunk_BN2 = { + { + idCtxBigNum, + ippBigNumPOS, + 1,1, + &cpChunk_BN2.value,&cpChunk_BN2.temporary + }, + 2,0 +}; +IppsBigNumState* cpBN_TwoRef(void) +{ return &cpChunk_BN2.bn; }; + +/* BN(3) and reference */ +static IppsBigNumStateChunk cpChunk_BN3 = { + { + idCtxBigNum, + ippBigNumPOS, + 1,1, + &cpChunk_BN3.value,&cpChunk_BN3.temporary + }, + 3,0 +}; +IppsBigNumState* cpBN_ThreeRef(void) +{ return &cpChunk_BN3.bn; }; + + + +/*F* +// Name: ippsBigNumGetSize +// +// Purpose: Returns size of BigNum ctx (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pCtxSize == NULL +// ippStsLengthErr len32 < 1 +// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// pCtxSize pointer BigNum ctx size +// +*F*/ +IPPFUN(IppStatus, ippsBigNumGetSize, (cpSize len32, cpSize *pCtxSize)) +{ + IPP_BAD_PTR1_RET(pCtxSize); + IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + + { + /* convert length to the number of BNU_CHUNK_T */ + cpSize len = INTERNAL_BNU_LENGTH(len32); + + /* reserve one BNU_CHUNK_T more for cpDiv_BNU, + mul, mont exp operations */ + len++; + + *pCtxSize = sizeof(IppsBigNumState) + + len*sizeof(BNU_CHUNK_T) + + len*sizeof(BNU_CHUNK_T) + + BN_ALIGNMENT-1; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsBigNumInit +// +// Purpose: Init BigNum spec for future usage. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// ippStsLengthErr len32<1 +// len32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// len32 max BN length (32-bits segments) +// pBN BigNum ctx +// +*F*/ +IPPFUN(IppStatus, ippsBigNumInit, (cpSize len32, IppsBigNumState* pBN)) +{ + IPP_BADARG_RET(len32<1 || len32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + IPP_BAD_PTR1_RET(pBN); + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + + { + Ipp8u* ptr = (Ipp8u*)pBN; + + /* convert length to the number of BNU_CHUNK_T */ + cpSize len = INTERNAL_BNU_LENGTH(len32); + + BN_ID(pBN) = idCtxUnknown; + BN_SIGN(pBN) = ippBigNumPOS; + BN_SIZE(pBN) = 1; /* initial valie is zero */ + BN_ROOM(pBN) = len; /* close to what has been passed by user */ + + /* reserve one BNU_CHUNK_T more for cpDiv_BNU, + mul, mont exp operations */ + len++; + + /* allocate buffers */ + BN_NUMBER(pBN) = (BNU_CHUNK_T*)(ptr += sizeof(IppsBigNumState)); + BN_BUFFER(pBN) = (BNU_CHUNK_T*)(ptr += len*sizeof(BNU_CHUNK_T)); /* use expanded length here */ + + /* set BN value and buffer to zero */ + ZEXPAND_BNU(BN_NUMBER(pBN), 0, len); + ZEXPAND_BNU(BN_BUFFER(pBN), 0, len); + + BN_ID(pBN) = idCtxBigNum; + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsCmpZero_BN +// +// Purpose: Test BigNum value. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// pResult == NULL +// ippStsContextMatchErr BN_VALID_ID() +// ippStsNoErr no errors +// +// Parameters: +// pBN BigNum ctx +// pResult result of comparison +// +*F*/ +IPPFUN(IppStatus, ippsCmpZero_BN, (const IppsBigNumState* pBN, Ipp32u* pResult)) +{ + IPP_BAD_PTR2_RET(pBN, pResult); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + if(BN_SIZE(pBN)==1 && BN_NUMBER(pBN)[0]==0) + *pResult = IS_ZERO; + else if (BN_SIGN(pBN)==ippBigNumPOS) + *pResult = GREATER_THAN_ZERO; + else if (BN_SIGN(pBN)==ippBigNumNEG) + *pResult = LESS_THAN_ZERO; + + return ippStsNoErr; +} + + +/*F* +// Name: ippsCmp_BN +// +// Purpose: Compare two BigNums. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pResult == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// ippStsNoErr no errors +// +// Parameters: +// pA BigNum ctx +// pB BigNum ctx +// pResult result of comparison +// +*F*/ +IPPFUN(IppStatus, ippsCmp_BN,(const IppsBigNumState* pA, const IppsBigNumState* pB, Ipp32u *pResult)) +{ + IPP_BAD_PTR3_RET(pA, pB, pResult); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + + { + int res; + if(BN_SIGN(pA)==BN_SIGN(pB)) { + res = cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pB), BN_SIZE(pB)); + if(ippBigNumNEG==BN_SIGN(pA)) + res = -res; + } + else + res = (ippBigNumPOS==BN_SIGN(pA))? 1 :-1; + + *pResult = (1==res)? IPP_IS_GT : (-1==res)? IPP_IS_LT : IPP_IS_EQ; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsSet_BN +// +// Purpose: Set BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// pData == NULL +// ippStsContextMatchErr BN_VALID_ID(pBN) +// ippStsLengthErr len32 < 1 +// ippStsOutOfRangeErr len32 > BN_ROOM() +// ippStsNoErr no errors +// +// Parameters: +// sgn sign +// len32 data size (in Ipp32u chunks) +// pData source data pointer +// pBn BigNum ctx +// +*F*/ +IPPFUN(IppStatus, ippsSet_BN, (IppsBigNumSGN sgn, cpSize len32, const Ipp32u* pData, + IppsBigNumState* pBN)) +{ + IPP_BAD_PTR2_RET(pData, pBN); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + IPP_BADARG_RET(len32<1, ippStsLengthErr); + + /* compute real size */ + FIX_BNU(pData, len32); + + { + cpSize len = INTERNAL_BNU_LENGTH(len32); + IPP_BADARG_RET(len > BN_ROOM(pBN), ippStsOutOfRangeErr); + + ZEXPAND_COPY_BNU((Ipp32u*)BN_NUMBER(pBN), BN_ROOM(pBN)*(int)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), pData, len32); + + BN_SIZE(pBN) = len; + + if(len32==1 && pData[0] == 0) + sgn = ippBigNumPOS; /* consider zero value as positive */ + BN_SIGN(pBN) = sgn; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRef_BN +// +// Purpose: Get BigNum info. +// +// Returns: Reason: +// ippStsNullPtrErr pBN == NULL +// ippStsContextMatchErr BN_VALID_ID(pBN) +// ippStsNoErr no errors +// +// Parameters: +// pSgn pointer to the sign +// pBitSize pointer to the data size (in bits) +// ppData pointer to the data buffer +// pBN BigNum ctx +// +*F*/ +IPPFUN(IppStatus, ippsRef_BN, (IppsBigNumSGN* pSgn, cpSize* pBitSize, Ipp32u** const ppData, + const IppsBigNumState *pBN)) +{ + IPP_BAD_PTR1_RET(pBN); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + if(pSgn) + *pSgn = BN_SIGN(pBN); + if(pBitSize) { + cpSize bitLen = BITSIZE_BNU(BN_NUMBER(pBN), BN_SIZE(pBN)); + *pBitSize = bitLen? bitLen : 1; + } + + if(ppData) + *ppData = (Ipp32u*)BN_NUMBER(pBN); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsAdd_BN +// +// Purpose: Add BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pR resultant BigNum +// +*F*/ +IPPFUN(IppStatus, ippsAdd_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +{ + IPP_BAD_PTR3_RET(pA, pB, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + { + cpSize nsA = BN_SIZE(pA); + cpSize nsB = BN_SIZE(pB); + cpSize nsR = BN_ROOM(pR); + IPP_BADARG_RET(nsR < IPP_MAX(nsA, nsB), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + + IppsBigNumSGN sgnA = BN_SIGN(pA); + IppsBigNumSGN sgnB = BN_SIGN(pB); + BNU_CHUNK_T* pDataA = BN_NUMBER(pA); + BNU_CHUNK_T* pDataB = BN_NUMBER(pB); + + BNU_CHUNK_T carry; + + if(sgnA==sgnB) { + if(nsA < nsB) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpAdd_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + carry = cpInc_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + if(carry) { + if(nsR>nsA) + pDataR[nsA++] = carry; + else + IPP_ERROR_RET(ippStsOutOfRangeErr); + } + BN_SIGN(pR) = sgnA; + } + + else { + int cmpRes = cpCmp_BNU(pDataA, nsA, pDataB, nsB); + + if(0==cmpRes) { + pDataR[0] = 0; + BN_SIZE(pR) = 1; + BN_SIGN(pR) = ippBigNumPOS; + return ippStsNoErr; + } + + if(0>cmpRes) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpSub_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + cpDec_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + + BN_SIGN(pR) = cmpRes>0? sgnA : INVERSE_SIGN(sgnA); + } + + FIX_BNU(pDataR, nsA); + BN_SIZE(pR) = nsA; + + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsSub_BN +// +// Purpose: Subtcrac BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pR resultant BigNum +// +*F*/ +IPPFUN(IppStatus, ippsSub_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +{ + IPP_BAD_PTR3_RET(pA, pB, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + { + cpSize nsA = BN_SIZE(pA); + cpSize nsB = BN_SIZE(pB); + cpSize nsR = BN_ROOM(pR); + IPP_BADARG_RET(nsR < IPP_MAX(nsA, nsB), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + + IppsBigNumSGN sgnA = BN_SIGN(pA); + IppsBigNumSGN sgnB = BN_SIGN(pB); + BNU_CHUNK_T* pDataA = BN_NUMBER(pA); + BNU_CHUNK_T* pDataB = BN_NUMBER(pB); + + BNU_CHUNK_T carry; + + if(sgnA!=sgnB) { + if(nsA < nsB) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpAdd_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + carry = cpInc_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + if(carry) { + if(nsR > nsA) + pDataR[nsA++] = carry; + else + IPP_ERROR_RET(ippStsOutOfRangeErr); + } + BN_SIGN(pR) = sgnA; + } + + else { + int cmpRes= cpCmp_BNU(pDataA, nsA, pDataB, nsB); + + if(0==cmpRes) { + ZEXPAND_BNU(pDataR,0, nsR); + BN_SIZE(pR) = 1; + BN_SIGN(pR) = ippBigNumPOS; + return ippStsNoErr; + } + + if(0>cmpRes) { + SWAP(nsA, nsB); + SWAP_PTR(BNU_CHUNK_T, pDataA, pDataB); + } + + carry = cpSub_BNU(pDataR, pDataA, pDataB, nsB); + if(nsA>nsB) + cpDec_BNU(pDataR+nsB, pDataA+nsB, nsA-nsB, carry); + + BN_SIGN(pR) = cmpRes>0? sgnA : INVERSE_SIGN(sgnA); + } + + FIX_BNU(pDataR, nsA); + BN_SIZE(pR) = nsA; + + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsMul_BN +// +// Purpose: Multiply BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pR resultant BigNum +// +*F*/ +IPPFUN(IppStatus, ippsMul_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pR)) +{ + IPP_BAD_PTR3_RET(pA, pB, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + { + BNU_CHUNK_T* pDataA = BN_NUMBER(pA); + BNU_CHUNK_T* pDataB = BN_NUMBER(pB); + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + + cpSize nsA = BN_SIZE(pA); + cpSize nsB = BN_SIZE(pB); + cpSize nsR = BN_ROOM(pR); + + cpSize bitSizeA = BITSIZE_BNU(pDataA, nsA); + cpSize bitSizeB = BITSIZE_BNU(pDataB, nsB); + + /* test if multiplicant/multiplier is zero */ + if(!bitSizeA || !bitSizeB) { + BN_SIZE(pR) = 1; + BN_SIGN(pR) = IppsBigNumPOS; + pDataR[0] = 0; + return ippStsNoErr; + } + + /* test if even low estimation of product A*B exceeded */ + IPP_BADARG_RET(nsR*BNU_CHUNK_BITS < (bitSizeA+bitSizeB-1), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* aData = pDataA; + BNU_CHUNK_T* bData = pDataB; + + if(pA == pR) { + aData = BN_BUFFER(pR); + COPY_BNU(aData, pDataA, nsA); + } + if((pB == pR) && (pA != pB)) { + bData = BN_BUFFER(pR); + COPY_BNU(bData, pDataB, nsB); + } + + /* clear result */ + ZEXPAND_BNU(pDataR, 0, nsR+1); + + cpMul_BNU_school(pDataR, aData, nsA, bData, nsB); + + nsR = (bitSizeA + bitSizeB + BNU_CHUNK_BITS - 1) /BNU_CHUNK_BITS; + FIX_BNU(pDataR, nsR); + IPP_BADARG_RET(nsR>BN_ROOM(pR), ippStsOutOfRangeErr); + + BN_SIZE(pR) = nsR; + BN_SIGN(pR) = (BN_SIGN(pA)==BN_SIGN(pB)? ippBigNumPOS : ippBigNumNEG); + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsDiv_BN +// +// Purpose: Divide BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pB == NULL +// pQ == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pB) +// BN_VALID_ID(pQ) +// BN_VALID_ID(pR) +// ippStsOutOfRangeErr pQ and/or pR can not hold result +// ippStsNoErr no errors +// +// Parameters: +// pA source BigNum +// pB source BigNum +// pQ quotient BigNum +// pR reminder BigNum +// +// A = Q*B + R, 0 <= val(R) < val(B), sgn(A)==sgn(R) +// +*F*/ +IPPFUN(IppStatus, ippsDiv_BN, (IppsBigNumState* pA, IppsBigNumState* pB, IppsBigNumState* pQ, IppsBigNumState* pR)) +{ + IPP_BAD_PTR4_RET(pA, pB, pQ, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + pQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pQ), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + IPP_BADARG_RET(BN_SIZE(pB)== 1 && BN_NUMBER(pB)[0]==0, ippStsDivByZeroErr); + + IPP_BADARG_RET(BN_ROOM(pR)cmpRes) + SWAP_PTR(IppsBigNumState, x, y); + if(0==cmpRes) { + COPY_BNU(BN_NUMBER(g), BN_NUMBER(x), BN_SIZE(x)); + BN_SIGN(g) = ippBigNumPOS; + BN_SIZE(g) = BN_SIZE(x); + return ippStsNoErr; + } + if(BN_SIZE(x)==1) { + BNU_CHUNK_T gcd = cpGcd_BNU(BN_NUMBER(x)[0], BN_NUMBER(y)[0]); + BN_NUMBER(g)[0] = gcd; + BN_SIZE(g) = 1; + return ippStsNoErr; + } + } + + { + Ipp32u* xBuffer = (Ipp32u*)BN_BUFFER(x); + Ipp32u* yBuffer = (Ipp32u*)BN_BUFFER(y); + Ipp32u* gBuffer = (Ipp32u*)BN_BUFFER(g); + Ipp32u* xData = (Ipp32u*)BN_NUMBER(x); + Ipp32u* yData = (Ipp32u*)BN_NUMBER(y); + Ipp32u* gData = (Ipp32u*)BN_NUMBER(g); + cpSize nsXmax = BN_ROOM(x)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsYmax = BN_ROOM(y)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsGmax = BN_ROOM(g)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsX = BN_SIZE(x)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + cpSize nsY = BN_SIZE(y)*(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)); + + Ipp32u* T; + Ipp32u* u; + + FIX_BNU(xData, nsX); + FIX_BNU(yData, nsY); + + /* init buffers */ + ZEXPAND_COPY_BNU(xBuffer, nsX, xData, nsXmax); + ZEXPAND_COPY_BNU(yBuffer, nsY, yData, nsYmax); + + T = gBuffer; + u = gData; + ZEXPAND_BNU(T, 0, nsGmax); + ZEXPAND_BNU(u, 0, nsGmax); + + while(nsX > (cpSize)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u))) { + /* xx and yy is the high-order digits of x and y (yy could be 0) */ + + Ipp64u xx = (Ipp64u)(xBuffer[nsX-1]); + Ipp64u yy = (nsY < nsX)? 0 : (Ipp64u)(yBuffer[nsY-1]); + + Ipp64s AA = 1; + Ipp64s BB = 0; + Ipp64s CC = 0; + Ipp64s DD = 1; + Ipp64s t; + + while((yy+CC)!=0 && (yy+DD)!=0) { + Ipp64u q = ( xx + AA ) / ( yy + CC ); + Ipp64u q1 = ( xx + BB ) / ( yy + DD ); + if(q!=q1) + break; + t = AA - q*CC; + AA = CC; + CC = t; + t = BB - q*DD; + BB = DD; + DD = t; + t = xx - q*yy; + xx = yy; + yy = t; + } + + if(BB == 0) { + /* T = x mod y */ + cpSize nsT = cpMod_BNU32(xBuffer, nsX, yBuffer, nsY); + ZEXPAND_BNU(T, 0, nsGmax); + COPY_BNU(T, xBuffer, nsT); + /* a = b; b = T; */ + ZEXPAND_BNU(xBuffer, 0, nsXmax); + COPY_BNU(xBuffer, yBuffer, nsY); + ZEXPAND_BNU(yBuffer, 0, nsYmax); + COPY_BNU(yBuffer, T, nsY); + } + + else { + Ipp32u carry; + /* + // T = AA*x + BB*y; + // u = CC*x + DD*y; + // b = u; a = T; + */ + if((AA <= 0)&&(BB>=0)) { + Ipp32u a1 = (Ipp32u)(-AA); + carry = cpMulDgt_BNU32(T, yBuffer, nsY, (Ipp32u)BB); + carry = cpMulDgt_BNU32(u, xBuffer, nsY, a1); + /* T = BB*y - AA*x; */ + carry = cpSub_BNU32(T, T, u, nsY); + } + else { + if((AA >= 0)&&(BB<=0)) { + Ipp32u b1 = (Ipp32u)(-BB); + carry = cpMulDgt_BNU32(T, xBuffer, nsY, (Ipp32u)AA); + carry = cpMulDgt_BNU32(u, yBuffer, nsY, b1); + /* T = AA*x - BB*y; */ + carry = cpSub_BNU32(T, T, u, nsY); + } + else { + /*AA*BB>=0 */ + carry = cpMulDgt_BNU32(T, xBuffer, nsY, (Ipp32u)AA); + carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)BB); + /* T = AA*x + BB*y; */ + carry = cpAdd_BNU32(T, T, u, nsY); + } + } + + /* Now T is reserved. We use only u for intermediate results. */ + if((CC <= 0)&&(DD>=0)){ + Ipp32u c1 = (Ipp32u)(-CC); + /* u = x*CC; x = u; */ + carry = cpMulDgt_BNU32(u, xBuffer, nsY, c1); + COPY_BNU(xBuffer, u, nsY); + /* u = y*DD; */ + carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)DD); + /* u = DD*y - CC*x; */ + carry = cpSub_BNU32(u, u, xBuffer, nsY); + } + else { + if((CC >= 0)&&(DD<=0)){ + Ipp32u d1 = (Ipp32u)(-DD); + /* u = y*DD; y = u */ + carry = cpMulDgt_BNU32(u, yBuffer, nsY, d1); + COPY_BNU(yBuffer, u, nsY); + /* u = CC*x; */ + carry = cpMulDgt_BNU32(u, xBuffer, nsY, (Ipp32u)CC); + /* u = CC*x - DD*y; */ + carry = cpSub_BNU32(u, u, yBuffer, nsY); + } + else { + /*CC*DD>=0 */ + /* y = y*DD */ + carry = cpMulDgt_BNU32(u, yBuffer, nsY, (Ipp32u)DD); + COPY_BNU(yBuffer, u, nsY); + /* u = x*CC */ + carry = cpMulDgt_BNU32(u, xBuffer, nsY, (Ipp32u)CC); + /* u = x*CC + y*DD */ + carry = cpAdd_BNU32(u, u, yBuffer, nsY); + } + } + + /* y = u; x = T; */ + COPY_BNU(yBuffer, u, nsY); + COPY_BNU(xBuffer, T, nsY); + } + + FIX_BNU(xBuffer, nsX); + FIX_BNU(yBuffer, nsY); + + if (nsY > nsX) { + SWAP_PTR(IppsBigNumState, x, y); + SWAP(nsX, nsY); + } + + if (nsY==1 && yBuffer[nsY-1]==0) { + /* End evaluation */ + ZEXPAND_BNU(gData, 0, nsGmax); + COPY_BNU(gData, xBuffer, nsX); + BN_SIZE(g) = INTERNAL_BNU_LENGTH(nsX); + BN_SIGN(g) = ippBigNumPOS; + return ippStsNoErr; + } + } + + BN_NUMBER(g)[0] = cpGcd_BNU(((BNU_CHUNK_T*)xBuffer)[0], ((BNU_CHUNK_T*)yBuffer)[0]); + BN_SIZE(g) = 1; + BN_SIGN(g) = ippBigNumPOS; + return ippStsNoErr; + } + } +} + + +/*F* +// Name: ippsModInv_BN +// +// Purpose: Multiplicative Inversion BigNum. +// +// Returns: Reason: +// ippStsNullPtrErr pA == NULL +// pM == NULL +// pR == NULL +// ippStsContextMatchErr BN_VALID_ID(pA) +// BN_VALID_ID(pM) +// BN_VALID_ID(pR) +// ippStsBadArgErr A<=0 +// ippStsBadModulusErr M<=0 +// ippStsScaleRangeErr A>=M +// ippStsOutOfRangeErr pR can not hold result +// ippStsNoErr no errors +// ippStsBadModulusErr inversion not found +// +// Parameters: +// pA source (value) BigNum +// pM source (modulus) BigNum +// pR reminder BigNum +// +*F*/ +IPPFUN(IppStatus, ippsModInv_BN, (IppsBigNumState* pA, IppsBigNumState* pM, IppsBigNumState* pR) ) +{ + IPP_BAD_PTR3_RET(pA, pM, pR); + + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + pM = (IppsBigNumState*)( IPP_ALIGNED_PTR(pM, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pM), ippStsContextMatchErr); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + IPP_BADARG_RET(BN_ROOM(pR) < BN_SIZE(pM), ippStsOutOfRangeErr); + IPP_BADARG_RET(BN_NEGATIVE(pA) || (BN_SIZE(pA)==1 && BN_NUMBER(pA)[0]==0), ippStsBadArgErr); + IPP_BADARG_RET(BN_NEGATIVE(pM) || (BN_SIZE(pM)==1 && BN_NUMBER(pM)[0]==0), ippStsBadModulusErr); + IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), BN_NUMBER(pM), BN_SIZE(pM)) >= 0, ippStsScaleRangeErr); + + { + cpSize nsR = cpModInv_BNU(BN_NUMBER(pR), + BN_NUMBER(pA), BN_SIZE(pA), + BN_NUMBER(pM), BN_SIZE(pM), + BN_BUFFER(pR), BN_BUFFER(pA), BN_BUFFER(pM)); + if(nsR) { + BN_SIGN(pR) = ippBigNumPOS; + BN_SIZE(pR) = nsR; + return ippStsNoErr; + } + else + return ippStsBadModulusErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnresource.h b/external/crypto_px/sources/ippcp/src/pcpbnresource.h index a77f6880c5..0358aaed4e 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnresource.h +++ b/external/crypto_px/sources/ippcp/src/pcpbnresource.h @@ -1,51 +1,51 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_BNRESOURCE_H) -#define _PCP_BNRESOURCE_H - - -typedef struct { - void* pNext; - IppsBigNumState* pBN; -} BigNumNode; - - -/* size (byte) of BN resource */ -int cpBigNumListGetSize(int feBitSize, int nodes); - -/* init BN resource */ -void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList); - -/* get BN from resource */ -IppsBigNumState* cpBigNumListGet(BigNumNode** pList); - -#endif /* _PCP_BNRESOURCE_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_BNRESOURCE_H) +#define _PCP_BNRESOURCE_H + + +typedef struct { + void* pNext; + IppsBigNumState* pBN; +} BigNumNode; + + +/* size (byte) of BN resource */ +int cpBigNumListGetSize(int feBitSize, int nodes); + +/* init BN resource */ +void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList); + +/* get BN from resource */ +IppsBigNumState* cpBigNumListGet(BigNumNode** pList); + +#endif /* _PCP_BNRESOURCE_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c b/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c index 1c89c67a5f..63bdd6737f 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnresourceca.c @@ -1,93 +1,93 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbnresource.h" -#include "pcpbn.h" - -/* -// Size of BigNum List Buffer -*/ -int cpBigNumListGetSize(int feBitSize, int nodes) -{ - /* size of buffer per single big number */ - int bnSize; - ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize); - - /* size of buffer for whole list */ - return (ALIGN_VAL-1) + (sizeof(BigNumNode) + bnSize) * nodes; -} - -/* -// Init list -// -// Note: buffer for BN list must have appropriate alignment -*/ -void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList) -{ - int itemSize; - /* length of Big Num */ - int bnLen = BITS2WORD32_SIZE(feBitSize); - /* size of buffer per single big number */ - ippsBigNumGetSize(bnLen, &itemSize); - /* size of list item */ - itemSize += sizeof(BigNumNode); - - { - int n; - /* init all nodes */ - BigNumNode* pNode = (BigNumNode*)( (Ipp8u*)pList + (nodes-1)*itemSize ); - BigNumNode* pNext = NULL; - for(n=0; npNext = pNext; - pNode->pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(tbnPtr, ALIGN_VAL) ); - ippsBigNumInit(bnLen, pNode->pBN); - pNext = pNode; - pNode = (BigNumNode*)( (Ipp8u*)pNode - itemSize); - } - } -} - -/* -// Get BigNum reference -*/ -IppsBigNumState* cpBigNumListGet(BigNumNode** ppList) -{ - if(*ppList) { - IppsBigNumState* ret = (*ppList)->pBN; - *ppList = (BigNumNode*)((*ppList)->pNext); - return ret; - } - else - return NULL; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbnresource.h" +#include "pcpbn.h" + +/* +// Size of BigNum List Buffer +*/ +int cpBigNumListGetSize(int feBitSize, int nodes) +{ + /* size of buffer per single big number */ + int bnSize; + ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize); + + /* size of buffer for whole list */ + return (ALIGN_VAL-1) + (sizeof(BigNumNode) + bnSize) * nodes; +} + +/* +// Init list +// +// Note: buffer for BN list must have appropriate alignment +*/ +void cpBigNumListInit(int feBitSize, int nodes, BigNumNode* pList) +{ + int itemSize; + /* length of Big Num */ + int bnLen = BITS2WORD32_SIZE(feBitSize); + /* size of buffer per single big number */ + ippsBigNumGetSize(bnLen, &itemSize); + /* size of list item */ + itemSize += sizeof(BigNumNode); + + { + int n; + /* init all nodes */ + BigNumNode* pNode = (BigNumNode*)( (Ipp8u*)pList + (nodes-1)*itemSize ); + BigNumNode* pNext = NULL; + for(n=0; npNext = pNext; + pNode->pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(tbnPtr, ALIGN_VAL) ); + ippsBigNumInit(bnLen, pNode->pBN); + pNext = pNode; + pNode = (BigNumNode*)( (Ipp8u*)pNode - itemSize); + } + } +} + +/* +// Get BigNum reference +*/ +IppsBigNumState* cpBigNumListGet(BigNumNode** ppList) +{ + if(*ppList) { + IppsBigNumState* ret = (*ppList)->pBN; + *ppList = (BigNumNode*)((*ppList)->pNext); + return ret; + } + else + return NULL; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnsetca.c b/external/crypto_px/sources/ippcp/src/pcpbnsetca.c index 4d92c39032..728ec45c8d 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnsetca.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnsetca.c @@ -1,119 +1,119 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" - - -/*F* -// Name: ippsSetOctString_BN -// -// Purpose: Convert octet string into the BN value. -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pOctStr -// NULL == pBN -// -// ippStsLengthErr 0>strLen -// -// ippStsSizeErr BN_ROOM() is enough for keep actual strLen -// -// ippStsNoErr no errors -// -// Parameters: -// pOctStr pointer to the source octet string -// strLen octet string length -// pBN pointer to the target BN -// -*F*/ -IPPFUN(IppStatus, ippsSetOctString_BN,(const Ipp8u* pOctStr, cpSize strLen, - IppsBigNumState* pBN)) -{ - IPP_BAD_PTR2_RET(pOctStr, pBN); - - pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); - - IPP_BADARG_RET((0>strLen), ippStsLengthErr); - - /* remove leading zeros */ - while(strLen && (0==pOctStr[0])) { - strLen--; - pOctStr++; - } - - /* test BN size */ - IPP_BADARG_RET((int)(sizeof(BNU_CHUNK_T)*BN_ROOM(pBN))strLen), ippStsLengthErr); - - return cpToOctStr_BNU(pOctStr,strLen, BN_NUMBER(pBN),BN_SIZE(pBN))? ippStsNoErr : ippStsLengthErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" + + +/*F* +// Name: ippsSetOctString_BN +// +// Purpose: Convert octet string into the BN value. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pOctStr +// NULL == pBN +// +// ippStsLengthErr 0>strLen +// +// ippStsSizeErr BN_ROOM() is enough for keep actual strLen +// +// ippStsNoErr no errors +// +// Parameters: +// pOctStr pointer to the source octet string +// strLen octet string length +// pBN pointer to the target BN +// +*F*/ +IPPFUN(IppStatus, ippsSetOctString_BN,(const Ipp8u* pOctStr, cpSize strLen, + IppsBigNumState* pBN)) +{ + IPP_BAD_PTR2_RET(pOctStr, pBN); + + pBN = (IppsBigNumState*)( IPP_ALIGNED_PTR(pBN, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pBN), ippStsContextMatchErr); + + IPP_BADARG_RET((0>strLen), ippStsLengthErr); + + /* remove leading zeros */ + while(strLen && (0==pOctStr[0])) { + strLen--; + pOctStr++; + } + + /* test BN size */ + IPP_BADARG_RET((int)(sizeof(BNU_CHUNK_T)*BN_ROOM(pBN))strLen), ippStsLengthErr); + + return cpToOctStr_BNU(pOctStr,strLen, BN_NUMBER(pBN),BN_SIZE(pBN))? ippStsNoErr : ippStsLengthErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c index cf04011d47..79779fd27c 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.c @@ -1,234 +1,234 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpbnumisc.h" -#include "pcpbnu32misc.h" -#include "pcpbnu32arith.h" - - -/* -// BNU32 addition -*/ -Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, cpSize ns) -{ - Ipp32u carry = 0; - cpSize i; - for(i=0; i>(32-1); - } - return borrow; -} - -/* -// BNU32 mul_by_digit -*/ -Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, Ipp32u val) -{ - Ipp32u carry = 0; - cpSize i; - for(i=0; i0; nsA--) { - Ipp64u r = (Ipp64u)*pR - (Ipp64u)(*pA++) * val - carry; - *pR++ = LODWORD(r); - carry = 0-HIDWORD(r); - } - return carry; -} - -/* -// BNU32 division -*/ -int cpDiv_BNU32(Ipp32u* pQ, cpSize* sizeQ, - Ipp32u* pX, cpSize sizeX, - Ipp32u* pY, cpSize sizeY) -{ - FIX_BNU(pY,sizeY); - FIX_BNU(pX,sizeX); - - /* special case */ - if(sizeX < sizeY) { - - if(pQ) { - pQ[0] = 0; - *sizeQ = 1; - } - - return sizeX; - } - - /* special case */ - if(1 == sizeY) { - int i; - Ipp32u r = 0; - for(i=(int)sizeX-1; i>=0; i--) { - Ipp64u tmp = MAKEDWORD(pX[i],r); - Ipp32u q = LODWORD(tmp / pY[0]); - r = LODWORD(tmp - q*pY[0]); - if(pQ) pQ[i] = q; - } - - pX[0] = r; - - if(pQ) { - FIX_BNU(pQ,sizeX); - *sizeQ = sizeX; - } - - return 1; - } - - - /* common case */ - { - cpSize qs = sizeX-sizeY+1; - - cpSize nlz = cpNLZ_BNU32(pY[sizeY-1]); - - /* normalization */ - pX[sizeX] = 0; - if(nlz) { - cpSize ni; - - pX[sizeX] = pX[sizeX-1] >> (32-nlz); - for(ni=sizeX-1; ni>0; ni--) - pX[ni] = (pX[ni]<>(32-nlz)); - pX[0] <<= nlz; - - for(ni=sizeY-1; ni>0; ni--) - pY[ni] = (pY[ni]<>(32-nlz)); - pY[0] <<= nlz; - } - - /* - // division - */ - { - Ipp32u yHi = pY[sizeY-1]; - - int i; - for(i=(int)qs-1; i>=0; i--) { - Ipp32u extend; - - /* estimate digit of quotient */ - Ipp64u tmp = MAKEDWORD(pX[i+sizeY-1], pX[i+sizeY]); - Ipp64u q = tmp / yHi; - Ipp64u r = tmp - q*yHi; - - /* tune estimation above */ - for(; HIDWORD(q) || (Ipp64u)q*pY[sizeY-2] > MAKEDWORD(pX[i+sizeY-2],r); ) { - q -= 1; - r += yHi; - if( HIDWORD(r) ) - break; - } - - /* multiply and subtract */ - extend = cpSubMulDgt_BNU32(pX+i, pY, sizeY, (Ipp32u)q); - extend = (pX[i+sizeY] -= extend); - - if(extend) { /* subtracted too much */ - q -= 1; - extend = cpAdd_BNU32(pX+i, pY, pX+i, sizeY); - pX[i+sizeY] += extend; - } - - /* store quotation digit */ - if(pQ) pQ[i] = LODWORD(q); - } - } - - /* de-normalization */ - if(nlz) { - cpSize ni; - for(ni=0; ni>nlz) | (pX[ni+1]<<(32-nlz)); - for(ni=0; ni>nlz) | (pY[ni+1]<<(32-nlz)); - pY[sizeY-1] >>= nlz; - } - - FIX_BNU(pX,sizeX); - - if(pQ) { - FIX_BNU(pQ,qs); - *sizeQ = qs; - } - - return sizeX; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnumisc.h" +#include "pcpbnu32misc.h" +#include "pcpbnu32arith.h" + + +/* +// BNU32 addition +*/ +Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, cpSize ns) +{ + Ipp32u carry = 0; + cpSize i; + for(i=0; i>(32-1); + } + return borrow; +} + +/* +// BNU32 mul_by_digit +*/ +Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize nsA, Ipp32u val) +{ + Ipp32u carry = 0; + cpSize i; + for(i=0; i0; nsA--) { + Ipp64u r = (Ipp64u)*pR - (Ipp64u)(*pA++) * val - carry; + *pR++ = LODWORD(r); + carry = 0-HIDWORD(r); + } + return carry; +} + +/* +// BNU32 division +*/ +int cpDiv_BNU32(Ipp32u* pQ, cpSize* sizeQ, + Ipp32u* pX, cpSize sizeX, + Ipp32u* pY, cpSize sizeY) +{ + FIX_BNU(pY,sizeY); + FIX_BNU(pX,sizeX); + + /* special case */ + if(sizeX < sizeY) { + + if(pQ) { + pQ[0] = 0; + *sizeQ = 1; + } + + return sizeX; + } + + /* special case */ + if(1 == sizeY) { + int i; + Ipp32u r = 0; + for(i=(int)sizeX-1; i>=0; i--) { + Ipp64u tmp = MAKEDWORD(pX[i],r); + Ipp32u q = LODWORD(tmp / pY[0]); + r = LODWORD(tmp - q*pY[0]); + if(pQ) pQ[i] = q; + } + + pX[0] = r; + + if(pQ) { + FIX_BNU(pQ,sizeX); + *sizeQ = sizeX; + } + + return 1; + } + + + /* common case */ + { + cpSize qs = sizeX-sizeY+1; + + cpSize nlz = cpNLZ_BNU32(pY[sizeY-1]); + + /* normalization */ + pX[sizeX] = 0; + if(nlz) { + cpSize ni; + + pX[sizeX] = pX[sizeX-1] >> (32-nlz); + for(ni=sizeX-1; ni>0; ni--) + pX[ni] = (pX[ni]<>(32-nlz)); + pX[0] <<= nlz; + + for(ni=sizeY-1; ni>0; ni--) + pY[ni] = (pY[ni]<>(32-nlz)); + pY[0] <<= nlz; + } + + /* + // division + */ + { + Ipp32u yHi = pY[sizeY-1]; + + int i; + for(i=(int)qs-1; i>=0; i--) { + Ipp32u extend; + + /* estimate digit of quotient */ + Ipp64u tmp = MAKEDWORD(pX[i+sizeY-1], pX[i+sizeY]); + Ipp64u q = tmp / yHi; + Ipp64u r = tmp - q*yHi; + + /* tune estimation above */ + for(; HIDWORD(q) || (Ipp64u)q*pY[sizeY-2] > MAKEDWORD(pX[i+sizeY-2],r); ) { + q -= 1; + r += yHi; + if( HIDWORD(r) ) + break; + } + + /* multiply and subtract */ + extend = cpSubMulDgt_BNU32(pX+i, pY, sizeY, (Ipp32u)q); + extend = (pX[i+sizeY] -= extend); + + if(extend) { /* subtracted too much */ + q -= 1; + extend = cpAdd_BNU32(pX+i, pY, pX+i, sizeY); + pX[i+sizeY] += extend; + } + + /* store quotation digit */ + if(pQ) pQ[i] = LODWORD(q); + } + } + + /* de-normalization */ + if(nlz) { + cpSize ni; + for(ni=0; ni>nlz) | (pX[ni+1]<<(32-nlz)); + for(ni=0; ni>nlz) | (pY[ni+1]<<(32-nlz)); + pY[sizeY-1] >>= nlz; + } + + FIX_BNU(pX,sizeX); + + if(pQ) { + FIX_BNU(pQ,qs); + *sizeQ = qs; + } + + return sizeX; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h index c72b77e18c..96cfe24231 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32arith.h @@ -1,46 +1,46 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_CP_BNU32_ARITH_H) -#define _CP_BNU32_ARITH_H - -Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns); -Ipp32u cpSub_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns); -Ipp32u cpInc_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val); -Ipp32u cpDec_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val); - -Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int ns, Ipp32u val); -Ipp32u cpSubMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int nsA, Ipp32u val); - -int cpDiv_BNU32(Ipp32u* pQ, int* nsQ, Ipp32u* pX, int nsX, Ipp32u* pY, int nsY); -#define cpMod_BNU32(pX,sizeX, pM,sizeM) cpDiv_BNU32(NULL,NULL, (pX),(sizeX), (pM),(sizeM)) - -#endif /* _CP_BNU32_ARITH_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BNU32_ARITH_H) +#define _CP_BNU32_ARITH_H + +Ipp32u cpAdd_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns); +Ipp32u cpSub_BNU32(Ipp32u* pR, const Ipp32u* pA, const Ipp32u* pB, int ns); +Ipp32u cpInc_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val); +Ipp32u cpDec_BNU32(Ipp32u* pR, const Ipp32u* pA, cpSize ns, Ipp32u val); + +Ipp32u cpMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int ns, Ipp32u val); +Ipp32u cpSubMulDgt_BNU32(Ipp32u* pR, const Ipp32u* pA, int nsA, Ipp32u val); + +int cpDiv_BNU32(Ipp32u* pQ, int* nsQ, Ipp32u* pX, int nsX, Ipp32u* pY, int nsY); +#define cpMod_BNU32(pX,sizeX, pM,sizeM) cpDiv_BNU32(NULL,NULL, (pX),(sizeX), (pM),(sizeM)) + +#endif /* _CP_BNU32_ARITH_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c index e9a2dd7313..6680a497d7 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.c @@ -1,53 +1,53 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpbnuimpl.h" -#include "pcpbnumisc.h" -#include "pcpbnu32misc.h" - - -/* -// number of leading zeros -*/ -cpSize cpNLZ_BNU32(Ipp32u x) -{ - cpSize nlz = BITSIZE(Ipp32u); - if(x) { - nlz = 0; - if( 0==(x & 0xFFFF0000) ) { nlz +=16; x<<=16; } - if( 0==(x & 0xFF000000) ) { nlz += 8; x<<= 8; } - if( 0==(x & 0xF0000000) ) { nlz += 4; x<<= 4; } - if( 0==(x & 0xC0000000) ) { nlz += 2; x<<= 2; } - if( 0==(x & 0x80000000) ) { nlz++; } - } - return nlz; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnuimpl.h" +#include "pcpbnumisc.h" +#include "pcpbnu32misc.h" + + +/* +// number of leading zeros +*/ +cpSize cpNLZ_BNU32(Ipp32u x) +{ + cpSize nlz = BITSIZE(Ipp32u); + if(x) { + nlz = 0; + if( 0==(x & 0xFFFF0000) ) { nlz +=16; x<<=16; } + if( 0==(x & 0xFF000000) ) { nlz += 8; x<<= 8; } + if( 0==(x & 0xF0000000) ) { nlz += 4; x<<= 4; } + if( 0==(x & 0xC0000000) ) { nlz += 2; x<<= 2; } + if( 0==(x & 0x80000000) ) { nlz++; } + } + return nlz; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h index a25c9f0d5a..cda2eca224 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h +++ b/external/crypto_px/sources/ippcp/src/pcpbnu32misc.h @@ -1,49 +1,49 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_CP_BNU32_MISC_H) -#define _CP_BNU32_MISC_H - - -/* bit operations */ -#define BITSIZE_BNU32(p,ns) ((ns)*BNU_CHUNK_32BIT-cpNLZ_BNU32((p)[(ns)-1])) - -/* number of leading/trailing zeros */ -cpSize cpNLZ_BNU32(Ipp32u x); - -/* most significant BNU bit */ -__INLINE int cpMSBit_BNU32(const Ipp32u* pA, cpSize nsA) -{ - FIX_BNU(pA, nsA); - return nsA*BITSIZE(Ipp32u) - cpNLZ_BNU32(pA[nsA-1]) -1; -} - -#endif /* _CP_BNU32_MISC_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BNU32_MISC_H) +#define _CP_BNU32_MISC_H + + +/* bit operations */ +#define BITSIZE_BNU32(p,ns) ((ns)*BNU_CHUNK_32BIT-cpNLZ_BNU32((p)[(ns)-1])) + +/* number of leading/trailing zeros */ +cpSize cpNLZ_BNU32(Ipp32u x); + +/* most significant BNU bit */ +__INLINE int cpMSBit_BNU32(const Ipp32u* pA, cpSize nsA) +{ + FIX_BNU(pA, nsA); + return nsA*BITSIZE(Ipp32u) - cpNLZ_BNU32(pA[nsA-1]) -1; +} + +#endif /* _CP_BNU32_MISC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnuarith.c b/external/crypto_px/sources/ippcp/src/pcpbnuarith.c index c1a21e9065..93822f3f67 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnuarith.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnuarith.c @@ -1,301 +1,301 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpbnuarith.h" -#include "pcpbnumisc.h" - - -/* Function cpAdd_BNU - addition of 2 BigNumbers */ -BNU_CHUNK_T cpAdd_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, const BNU_CHUNK_T* pB, cpSize ns) -{ - BNU_CHUNK_T carry = 0; - cpSize i; - for(i=0; i b){ - gcd = a; - t = b; - } else { - t = a; - gcd = b; - } - - while (t != 0) { - r = gcd % t; - gcd = t; - t = r; - } - return gcd; -} - - -/* -// cpMAC_BNU -// -// Multiply with ACcumulation -// Computes r <- r + a * b, returns real size of the r in the size_r variable -// Returns 0 if there are no enought buffer size to write to r[MAX(size_r + 1, size_a + size_b) - 1] -// Returns 1 if no error -// -// Note: -// DO NOT run in inplace mode -// The minimum buffer size for the r must be (size_a + size_b - 1) -// the maximum buffer size for the r is MAX(size_r + 1, size_a + size_b) -*/ -static int cpMac_BNU(BNU_CHUNK_T* pR, cpSize nsR, - const BNU_CHUNK_T* pA, cpSize nsA, - const BNU_CHUNK_T* pB, cpSize nsB) -{ - /* cleanup the rest of destination buffer */ - ZEXPAND_BNU(pR, nsR, nsA+nsB-1); - - { - BNU_CHUNK_T expansion = 0; - cpSize i; - for(i=0; i b){ + gcd = a; + t = b; + } else { + t = a; + gcd = b; + } + + while (t != 0) { + r = gcd % t; + gcd = t; + t = r; + } + return gcd; +} + + +/* +// cpMAC_BNU +// +// Multiply with ACcumulation +// Computes r <- r + a * b, returns real size of the r in the size_r variable +// Returns 0 if there are no enought buffer size to write to r[MAX(size_r + 1, size_a + size_b) - 1] +// Returns 1 if no error +// +// Note: +// DO NOT run in inplace mode +// The minimum buffer size for the r must be (size_a + size_b - 1) +// the maximum buffer size for the r is MAX(size_r + 1, size_a + size_b) +*/ +static int cpMac_BNU(BNU_CHUNK_T* pR, cpSize nsR, + const BNU_CHUNK_T* pA, cpSize nsA, + const BNU_CHUNK_T* pB, cpSize nsB) +{ + /* cleanup the rest of destination buffer */ + ZEXPAND_BNU(pR, nsR, nsA+nsB-1); + + { + BNU_CHUNK_T expansion = 0; + cpSize i; + for(i=0; i> (BNU_CHUNK_BITS/2)) - -/* (carry,R) = A+B */ -#define ADD_AB(CARRY,R, A,B) \ -do { \ - BNU_CHUNK_T __s = (A) + (B); \ - (CARRY) = __s < (A); \ - (R) = __s; \ -} while(0) - -/* (carry,R) = A+B+C */ -#define ADD_ABC(CARRY,R, A,B,C) \ -do { \ - BNU_CHUNK_T __s = (A) + (B); \ - BNU_CHUNK_T __t1= __s < (A); \ - BNU_CHUNK_T __r = __s + (C); \ - BNU_CHUNK_T __t2 = __r < __s; \ - (CARRY) = __t1 + __t2; \ - (R) = __r; \ -} while(0) - -/* (borrow,R) = A-B */ -#define SUB_AB(BORROW,R, A,B) \ -do { \ - (BORROW) = (A)<(B); \ - (R) = (A)-(B); \ -} while(0) - -/* (borrow,R) = A-B-C */ -#define SUB_ABC(BORROW,R, A,B,C) \ -do { \ - BNU_CHUNK_T __s = (A) -( B); \ - BNU_CHUNK_T __t1= __s > (A); \ - BNU_CHUNK_T __r = __s - (C); \ - BNU_CHUNK_T __t2 = __r > __s; \ - (BORROW) = __t1 + __t2; \ - (R) = __r; \ -} while(0) - -/* (RH,RL) = A*B */ -#define MUL_AB(RH, RL, A, B) \ - do { \ - BNU_CHUNK_T __aL = LO_CHUNK((A)); \ - BNU_CHUNK_T __aH = HI_CHUNK((A)); \ - BNU_CHUNK_T __bL = LO_CHUNK((B)); \ - BNU_CHUNK_T __bH = HI_CHUNK((B)); \ - \ - BNU_CHUNK_T __x0 = (BNU_CHUNK_T) __aL * __bL; \ - BNU_CHUNK_T __x1 = (BNU_CHUNK_T) __aL * __bH; \ - BNU_CHUNK_T __x2 = (BNU_CHUNK_T) __aH * __bL; \ - BNU_CHUNK_T __x3 = (BNU_CHUNK_T) __aH * __bH; \ - \ - __x1 += HI_CHUNK(__x0); \ - __x1 += __x2; \ - if(__x1 < __x2) \ - __x3 += BNU_CHUNK_2H; \ - \ - (RH) = __x3 + HI_CHUNK(__x1); \ - (RL) = (__x1 << BNU_CHUNK_BITS/2) + LO_CHUNK(__x0); \ - } while (0) - -#endif /* _CP_BNU_IMPL_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_BNU_IMPL_H) +#define _CP_BNU_IMPL_H + +#define BNU_CHUNK_64BIT (64) +#define BNU_CHUNK_32BIT (32) + + +/* +// define BNU chunk data type +*/ +#if ((_IPP_ARCH == _IPP_ARCH_EM64T) || (_IPP_ARCH == _IPP_ARCH_LP64) || (_IPP_ARCH == _IPP_ARCH_LRB) || (_IPP_ARCH == _IPP_ARCH_LRB2)) + typedef Ipp64u BNU_CHUNK_T; + typedef Ipp64s BNS_CHUNK_T; + #define BNU_CHUNK_LOG2 (6) + #define BNU_CHUNK_BITS BNU_CHUNK_64BIT + +#else + typedef Ipp32u BNU_CHUNK_T; + typedef Ipp32s BNS_CHUNK_T; + #define BNU_CHUNK_LOG2 (5) + #define BNU_CHUNK_BITS BNU_CHUNK_32BIT +#endif + +#define BNU_CHUNK_MASK (~(BNU_CHUNK_T)(0)) + +#if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT) + #pragma message ("BNU_CHUNK_BITS = 64 bit") +#elif (BNU_CHUNK_BITS == BNU_CHUNK_32BIT) + #pragma message ("BNU_CHUNK_BITS = 32 bit") +#else + #error BNU_CHUNK_BITS should be either 64 or 32 bit! +#endif + + +#ifdef _MSC_VER +# pragma warning( disable : 4127) +#endif + +/* user's API BNU chunk data type */ +typedef Ipp32u API_BNU_CHUNK_T; + +/* convert API_BNU_CHUNK_T (usual Ipp32u) length into the BNU_CHUNK_T length */ +#define INTERNAL_BNU_LENGTH(apiLen) \ + ((apiLen) + sizeof(BNU_CHUNK_T)/sizeof(API_BNU_CHUNK_T) -1)/(sizeof(BNU_CHUNK_T)/sizeof(API_BNU_CHUNK_T)) + +/* Low and High parts of BNU_CHUNK_T value */ +#define BNU_CHUNK_2H ((BNU_CHUNK_T)1 << (BNU_CHUNK_BITS/2)) +#define LO_CHUNK(c) ((BNU_CHUNK_T)(c) & (BNU_CHUNK_2H - 1)) +#define HI_CHUNK(c) ((BNU_CHUNK_T)(c) >> (BNU_CHUNK_BITS/2)) + +/* (carry,R) = A+B */ +#define ADD_AB(CARRY,R, A,B) \ +do { \ + BNU_CHUNK_T __s = (A) + (B); \ + (CARRY) = __s < (A); \ + (R) = __s; \ +} while(0) + +/* (carry,R) = A+B+C */ +#define ADD_ABC(CARRY,R, A,B,C) \ +do { \ + BNU_CHUNK_T __s = (A) + (B); \ + BNU_CHUNK_T __t1= __s < (A); \ + BNU_CHUNK_T __r = __s + (C); \ + BNU_CHUNK_T __t2 = __r < __s; \ + (CARRY) = __t1 + __t2; \ + (R) = __r; \ +} while(0) + +/* (borrow,R) = A-B */ +#define SUB_AB(BORROW,R, A,B) \ +do { \ + (BORROW) = (A)<(B); \ + (R) = (A)-(B); \ +} while(0) + +/* (borrow,R) = A-B-C */ +#define SUB_ABC(BORROW,R, A,B,C) \ +do { \ + BNU_CHUNK_T __s = (A) -( B); \ + BNU_CHUNK_T __t1= __s > (A); \ + BNU_CHUNK_T __r = __s - (C); \ + BNU_CHUNK_T __t2 = __r > __s; \ + (BORROW) = __t1 + __t2; \ + (R) = __r; \ +} while(0) + +/* (RH,RL) = A*B */ +#define MUL_AB(RH, RL, A, B) \ + do { \ + BNU_CHUNK_T __aL = LO_CHUNK((A)); \ + BNU_CHUNK_T __aH = HI_CHUNK((A)); \ + BNU_CHUNK_T __bL = LO_CHUNK((B)); \ + BNU_CHUNK_T __bH = HI_CHUNK((B)); \ + \ + BNU_CHUNK_T __x0 = (BNU_CHUNK_T) __aL * __bL; \ + BNU_CHUNK_T __x1 = (BNU_CHUNK_T) __aL * __bH; \ + BNU_CHUNK_T __x2 = (BNU_CHUNK_T) __aH * __bL; \ + BNU_CHUNK_T __x3 = (BNU_CHUNK_T) __aH * __bH; \ + \ + __x1 += HI_CHUNK(__x0); \ + __x1 += __x2; \ + if(__x1 < __x2) \ + __x3 += BNU_CHUNK_2H; \ + \ + (RH) = __x3 + HI_CHUNK(__x1); \ + (RL) = (__x1 << BNU_CHUNK_BITS/2) + LO_CHUNK(__x0); \ + } while (0) + +#endif /* _CP_BNU_IMPL_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpbnumisc.c b/external/crypto_px/sources/ippcp/src/pcpbnumisc.c index 3e7eec89ff..3b0bb839fc 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnumisc.c +++ b/external/crypto_px/sources/ippcp/src/pcpbnumisc.c @@ -1,208 +1,208 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpbnumisc.h" - - -/* -// number of leading zeros -*/ -cpSize cpNLZ_BNU(BNU_CHUNK_T x) -{ - cpSize nlz = BNU_CHUNK_BITS; - if(x) { - nlz = 0; - #if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT) - if( 0==(x & 0xFFFFFFFF00000000) ) { nlz +=32; x<<=32; } - if( 0==(x & 0xFFFF000000000000) ) { nlz +=16; x<<=16; } - if( 0==(x & 0xFF00000000000000) ) { nlz += 8; x<<= 8; } - if( 0==(x & 0xF000000000000000) ) { nlz += 4; x<<= 4; } - if( 0==(x & 0xC000000000000000) ) { nlz += 2; x<<= 2; } - if( 0==(x & 0x8000000000000000) ) { nlz++; } - #else - if( 0==(x & 0xFFFF0000) ) { nlz +=16; x<<=16; } - if( 0==(x & 0xFF000000) ) { nlz += 8; x<<= 8; } - if( 0==(x & 0xF0000000) ) { nlz += 4; x<<= 4; } - if( 0==(x & 0xC0000000) ) { nlz += 2; x<<= 2; } - if( 0==(x & 0x80000000) ) { nlz++; } - #endif - } - return nlz; -} - -/* -// number of trailing zeros -*/ -cpSize cpNTZ_BNU(BNU_CHUNK_T x) -{ - cpSize ntz = BNU_CHUNK_BITS; - if(x) { - ntz = 0; - #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) - if( 0==(x & 0x00000000FFFFFFFF) ) { ntz+=32; x>>=32; } - if( 0==(x & 0x000000000000FFFF) ) { ntz+=16; x>>=16; } - if( 0==(x & 0x00000000000000FF) ) { ntz+= 8; x>>= 8; } - if( 0==(x & 0x000000000000000F) ) { ntz+= 4; x>>= 4; } - if( 0==(x & 0x0000000000000003) ) { ntz+= 2; x>>= 2; } - if( 0==(x & 0x0000000000000001) ) { ntz++; } - #else - if( 0==(x & 0x0000FFFF) ) { ntz+=16; x>>=16; } - if( 0==(x & 0x000000FF) ) { ntz+= 8; x>>= 8; } - if( 0==(x & 0x0000000F) ) { ntz+= 4; x>>= 4; } - if( 0==(x & 0x00000003) ) { ntz+= 2; x>>= 2; } - if( 0==(x & 0x00000001) ) { ntz++; } - #endif - } - return ntz; -} - - -/* -// Logical shift right (including inplace) -// -// Returns new length -// -*/ -cpSize cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits) -{ - cpSize nw = nBits/BNU_CHUNK_BITS; - cpSize n; - - pA += nw; - nsA -= nw; - - nBits %= BNU_CHUNK_BITS; - if(nBits) { - BNU_CHUNK_T hi; - BNU_CHUNK_T lo = pA[0]; - - for(n=0; n<(nsA-1); n++) { - hi = pA[n+1]; - pR[n] = (lo>>nBits) | (hi<<(BNU_CHUNK_BITS-nBits)); - lo = hi; - } - pR[nsA-1] = (lo>>nBits); - } - else { - for(n=0; n=(int)sizeof(BNU_CHUNK_T); nsA++,strLen-=(int)(sizeof(BNU_CHUNK_T))) { - /* pack sizeof(BNU_CHUNK_T) bytes into single BNU_CHUNK_T value*/ - *pA++ = - #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) - +( (BNU_CHUNK_T)pStr[strLen-8]<<(8*7) ) - +( (BNU_CHUNK_T)pStr[strLen-7]<<(8*6) ) - +( (BNU_CHUNK_T)pStr[strLen-6]<<(8*5) ) - +( (BNU_CHUNK_T)pStr[strLen-5]<<(8*4) ) - #endif - +( (BNU_CHUNK_T)pStr[strLen-4]<<(8*3) ) - +( (BNU_CHUNK_T)pStr[strLen-3]<<(8*2) ) - +( (BNU_CHUNK_T)pStr[strLen-2]<<(8*1) ) - + (BNU_CHUNK_T)pStr[strLen-1]; - } - - /* convert the beginning of the string */ - if(strLen) { - BNU_CHUNK_T x = 0; - for(x=0; strLen>0; strLen--) { - BNU_CHUNK_T d = *pStr++; - x = (x<<8) + d; - } - *pA++ = x; - nsA++; - } - - return nsA; -} - -/* -// Convert BNU into HexString representation -// -// Returns length of the string or 0 if no success -*/ -cpSize cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA) -{ - FIX_BNU(pA, nsA); - { - cpSize bnuBitSize = BITSIZE_BNU(pA, nsA); - if(bnuBitSize <= strLen*BYTESIZE) { - int cnvLen = 0; - BNU_CHUNK_T x = pA[nsA-1]; - - ZEXPAND_BNU(pStr, 0, strLen); - pStr += strLen - BITS2WORD8_SIZE(bnuBitSize); - - if(x) { - //int nb; - cpSize nb; - for(nb=cpNLZ_BNU(x)/BYTESIZE; nb<(cpSize)(sizeof(BNU_CHUNK_T)); cnvLen++, nb++) - *pStr++ = EBYTE(x, sizeof(BNU_CHUNK_T)-1-nb); - - for(--nsA; nsA>0; cnvLen+=sizeof(BNU_CHUNK_T), nsA--) { - x = pA[nsA-1]; - #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) - *pStr++ = EBYTE(x,7); - *pStr++ = EBYTE(x,6); - *pStr++ = EBYTE(x,5); - *pStr++ = EBYTE(x,4); - #endif - *pStr++ = EBYTE(x,3); - *pStr++ = EBYTE(x,2); - *pStr++ = EBYTE(x,1); - *pStr++ = EBYTE(x,0); - } - } - return strLen; - } - else - return 0; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpbnumisc.h" + + +/* +// number of leading zeros +*/ +cpSize cpNLZ_BNU(BNU_CHUNK_T x) +{ + cpSize nlz = BNU_CHUNK_BITS; + if(x) { + nlz = 0; + #if (BNU_CHUNK_BITS == BNU_CHUNK_64BIT) + if( 0==(x & 0xFFFFFFFF00000000) ) { nlz +=32; x<<=32; } + if( 0==(x & 0xFFFF000000000000) ) { nlz +=16; x<<=16; } + if( 0==(x & 0xFF00000000000000) ) { nlz += 8; x<<= 8; } + if( 0==(x & 0xF000000000000000) ) { nlz += 4; x<<= 4; } + if( 0==(x & 0xC000000000000000) ) { nlz += 2; x<<= 2; } + if( 0==(x & 0x8000000000000000) ) { nlz++; } + #else + if( 0==(x & 0xFFFF0000) ) { nlz +=16; x<<=16; } + if( 0==(x & 0xFF000000) ) { nlz += 8; x<<= 8; } + if( 0==(x & 0xF0000000) ) { nlz += 4; x<<= 4; } + if( 0==(x & 0xC0000000) ) { nlz += 2; x<<= 2; } + if( 0==(x & 0x80000000) ) { nlz++; } + #endif + } + return nlz; +} + +/* +// number of trailing zeros +*/ +cpSize cpNTZ_BNU(BNU_CHUNK_T x) +{ + cpSize ntz = BNU_CHUNK_BITS; + if(x) { + ntz = 0; + #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) + if( 0==(x & 0x00000000FFFFFFFF) ) { ntz+=32; x>>=32; } + if( 0==(x & 0x000000000000FFFF) ) { ntz+=16; x>>=16; } + if( 0==(x & 0x00000000000000FF) ) { ntz+= 8; x>>= 8; } + if( 0==(x & 0x000000000000000F) ) { ntz+= 4; x>>= 4; } + if( 0==(x & 0x0000000000000003) ) { ntz+= 2; x>>= 2; } + if( 0==(x & 0x0000000000000001) ) { ntz++; } + #else + if( 0==(x & 0x0000FFFF) ) { ntz+=16; x>>=16; } + if( 0==(x & 0x000000FF) ) { ntz+= 8; x>>= 8; } + if( 0==(x & 0x0000000F) ) { ntz+= 4; x>>= 4; } + if( 0==(x & 0x00000003) ) { ntz+= 2; x>>= 2; } + if( 0==(x & 0x00000001) ) { ntz++; } + #endif + } + return ntz; +} + + +/* +// Logical shift right (including inplace) +// +// Returns new length +// +*/ +cpSize cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits) +{ + cpSize nw = nBits/BNU_CHUNK_BITS; + cpSize n; + + pA += nw; + nsA -= nw; + + nBits %= BNU_CHUNK_BITS; + if(nBits) { + BNU_CHUNK_T hi; + BNU_CHUNK_T lo = pA[0]; + + for(n=0; n<(nsA-1); n++) { + hi = pA[n+1]; + pR[n] = (lo>>nBits) | (hi<<(BNU_CHUNK_BITS-nBits)); + lo = hi; + } + pR[nsA-1] = (lo>>nBits); + } + else { + for(n=0; n=(int)sizeof(BNU_CHUNK_T); nsA++,strLen-=(int)(sizeof(BNU_CHUNK_T))) { + /* pack sizeof(BNU_CHUNK_T) bytes into single BNU_CHUNK_T value*/ + *pA++ = + #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) + +( (BNU_CHUNK_T)pStr[strLen-8]<<(8*7) ) + +( (BNU_CHUNK_T)pStr[strLen-7]<<(8*6) ) + +( (BNU_CHUNK_T)pStr[strLen-6]<<(8*5) ) + +( (BNU_CHUNK_T)pStr[strLen-5]<<(8*4) ) + #endif + +( (BNU_CHUNK_T)pStr[strLen-4]<<(8*3) ) + +( (BNU_CHUNK_T)pStr[strLen-3]<<(8*2) ) + +( (BNU_CHUNK_T)pStr[strLen-2]<<(8*1) ) + + (BNU_CHUNK_T)pStr[strLen-1]; + } + + /* convert the beginning of the string */ + if(strLen) { + BNU_CHUNK_T x = 0; + for(x=0; strLen>0; strLen--) { + BNU_CHUNK_T d = *pStr++; + x = (x<<8) + d; + } + *pA++ = x; + nsA++; + } + + return nsA; +} + +/* +// Convert BNU into HexString representation +// +// Returns length of the string or 0 if no success +*/ +cpSize cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA) +{ + FIX_BNU(pA, nsA); + { + cpSize bnuBitSize = BITSIZE_BNU(pA, nsA); + if(bnuBitSize <= strLen*BYTESIZE) { + int cnvLen = 0; + BNU_CHUNK_T x = pA[nsA-1]; + + ZEXPAND_BNU(pStr, 0, strLen); + pStr += strLen - BITS2WORD8_SIZE(bnuBitSize); + + if(x) { + //int nb; + cpSize nb; + for(nb=cpNLZ_BNU(x)/BYTESIZE; nb<(cpSize)(sizeof(BNU_CHUNK_T)); cnvLen++, nb++) + *pStr++ = EBYTE(x, sizeof(BNU_CHUNK_T)-1-nb); + + for(--nsA; nsA>0; cnvLen+=sizeof(BNU_CHUNK_T), nsA--) { + x = pA[nsA-1]; + #if (BNU_CHUNK_BITS==BNU_CHUNK_64BIT) + *pStr++ = EBYTE(x,7); + *pStr++ = EBYTE(x,6); + *pStr++ = EBYTE(x,5); + *pStr++ = EBYTE(x,4); + #endif + *pStr++ = EBYTE(x,3); + *pStr++ = EBYTE(x,2); + *pStr++ = EBYTE(x,1); + *pStr++ = EBYTE(x,0); + } + } + return strLen; + } + else + return 0; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpbnumisc.h b/external/crypto_px/sources/ippcp/src/pcpbnumisc.h index 8a27bea7a8..cbb8d60dbc 100644 --- a/external/crypto_px/sources/ippcp/src/pcpbnumisc.h +++ b/external/crypto_px/sources/ippcp/src/pcpbnumisc.h @@ -1,149 +1,149 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_BNUMISC_H) -#define _PCP_BNUMISC_H - -#include "pcpbnuimpl.h" - - -/* bit operations */ -#define BITSIZE_BNU(p,ns) ((ns)*BNU_CHUNK_BITS-cpNLZ_BNU((p)[(ns)-1])) -#define BIT_BNU(bnu, ns,nbit) ((((nbit)>>BNU_CHUNK_LOG2) < (ns))? ((((bnu))[(nbit)>>BNU_CHUNK_LOG2] >>((nbit)&(BNU_CHUNK_BITS))) &1) : 0) -#define TST_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) & ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) -#define SET_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) |= ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) -#define CLR_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) &=~((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) - -/* convert bitsize nbits into the number of BNU_CHUNK_T */ -#define BITS_BNU_CHUNK(nbits) (((nbits)+BNU_CHUNK_BITS-1)/BNU_CHUNK_BITS) - -/* mask for top BNU_CHUNK_T */ -#define MASK_BNU_CHUNK(nbits) ((BNU_CHUNK_T)(-1) >>((BNU_CHUNK_BITS- ((nbits)&(BNU_CHUNK_BITS-1))) &(BNU_CHUNK_BITS-1))) - -/* copy BNU content */ -#define COPY_BNU(dst, src, len) \ -{ \ - cpSize __idx; \ - for(__idx=0; __idx<(len); __idx++) (dst)[__idx] = (src)[__idx]; \ -} - -/* expand by zeros */ -#define ZEXPAND_BNU(srcdst,srcLen, dstLen) \ -{ \ - cpSize __idx; \ - for(__idx=(srcLen); __idx<(dstLen); __idx++) (srcdst)[__idx] = 0; \ -} - -/* copy and expand by zeros */ -#define ZEXPAND_COPY_BNU(dst,dstLen, src,srcLen) \ -{ \ - cpSize __idx; \ - for(__idx=0; __idx<(srcLen); __idx++) (dst)[__idx] = (src)[__idx]; \ - for(; __idx<(dstLen); __idx++) (dst)[__idx] = 0; \ -} - -/* fix actual length */ -#define FIX_BNU(src,srcLen) \ - for(; ((srcLen)>1) && (0==(src)[(srcLen)-1]); (srcLen)--) - - -/* copy and set */ -__INLINE void cpCpy_BNU(BNU_CHUNK_T* pDst, const BNU_CHUNK_T* pSrc, cpSize ns) -{ COPY_BNU(pDst, pSrc, ns); } - -__INLINE void cpSet_BNU(BNU_CHUNK_T* pDst, cpSize ns, BNU_CHUNK_T val) -{ - ZEXPAND_BNU(pDst, 0, ns); - pDst[0] = val; -} - -/* fix up */ -__INLINE int cpFix_BNU(const BNU_CHUNK_T* pA, int nsA) -{ - FIX_BNU(pA, nsA); - return nsA; -} - -/* comparison -// -// returns -// negative, if A < B -// 0, if A = B -// positive, if A > B -*/ -__INLINE int cpCmp_BNU(const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB) -{ - if(nsA!=nsB) - return nsA>nsB? 1 : -1; - else { - for(; nsA>0; nsA--) { - if(pA[nsA-1] > pB[nsA-1]) - return 1; - else if(pA[nsA-1] < pB[nsA-1]) - return -1; - } - return 0; - } -} -__INLINE int cpEqu_BNU_CHUNK(const BNU_CHUNK_T* pA, cpSize nsA, BNU_CHUNK_T b) -{ - return (pA[0]==b && 1==cpFix_BNU(pA, nsA)); -} - -/* -// test -// -// returns -// 0, if A = 0 -// >0, if A > 0 -// <0, looks like impossible (or error) case -*/ -__INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA) -{ - for(; (nsA>0) && (0==pA[nsA-1]); nsA--) ; - return nsA; -} - -/* number of leading/trailing zeros */ -cpSize cpNLZ_BNU(BNU_CHUNK_T x); -cpSize cpNTZ_BNU(BNU_CHUNK_T x); - -/* logical shift left/right */ -int cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits); - -/* least and most significant BNU bit */ -int cpMSBit_BNU(const BNU_CHUNK_T* pA, cpSize nsA); - -/* BNU <-> hex-string conversion */ -int cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA); -int cpFromOctStr_BNU(BNU_CHUNK_T* pA, const Ipp8u* pStr, cpSize strLen); - -#endif /* _PCP_BNUMISC_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_BNUMISC_H) +#define _PCP_BNUMISC_H + +#include "pcpbnuimpl.h" + + +/* bit operations */ +#define BITSIZE_BNU(p,ns) ((ns)*BNU_CHUNK_BITS-cpNLZ_BNU((p)[(ns)-1])) +#define BIT_BNU(bnu, ns,nbit) ((((nbit)>>BNU_CHUNK_LOG2) < (ns))? ((((bnu))[(nbit)>>BNU_CHUNK_LOG2] >>((nbit)&(BNU_CHUNK_BITS))) &1) : 0) +#define TST_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) & ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) +#define SET_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) |= ((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) +#define CLR_BIT(bnu, nbit) ((((bnu))[(nbit)>>BNU_CHUNK_LOG2]) &=~((BNU_CHUNK_T)1<<((nbit)&(BNU_CHUNK_BITS-1)))) + +/* convert bitsize nbits into the number of BNU_CHUNK_T */ +#define BITS_BNU_CHUNK(nbits) (((nbits)+BNU_CHUNK_BITS-1)/BNU_CHUNK_BITS) + +/* mask for top BNU_CHUNK_T */ +#define MASK_BNU_CHUNK(nbits) ((BNU_CHUNK_T)(-1) >>((BNU_CHUNK_BITS- ((nbits)&(BNU_CHUNK_BITS-1))) &(BNU_CHUNK_BITS-1))) + +/* copy BNU content */ +#define COPY_BNU(dst, src, len) \ +{ \ + cpSize __idx; \ + for(__idx=0; __idx<(len); __idx++) (dst)[__idx] = (src)[__idx]; \ +} + +/* expand by zeros */ +#define ZEXPAND_BNU(srcdst,srcLen, dstLen) \ +{ \ + cpSize __idx; \ + for(__idx=(srcLen); __idx<(dstLen); __idx++) (srcdst)[__idx] = 0; \ +} + +/* copy and expand by zeros */ +#define ZEXPAND_COPY_BNU(dst,dstLen, src,srcLen) \ +{ \ + cpSize __idx; \ + for(__idx=0; __idx<(srcLen); __idx++) (dst)[__idx] = (src)[__idx]; \ + for(; __idx<(dstLen); __idx++) (dst)[__idx] = 0; \ +} + +/* fix actual length */ +#define FIX_BNU(src,srcLen) \ + for(; ((srcLen)>1) && (0==(src)[(srcLen)-1]); (srcLen)--) + + +/* copy and set */ +__INLINE void cpCpy_BNU(BNU_CHUNK_T* pDst, const BNU_CHUNK_T* pSrc, cpSize ns) +{ COPY_BNU(pDst, pSrc, ns); } + +__INLINE void cpSet_BNU(BNU_CHUNK_T* pDst, cpSize ns, BNU_CHUNK_T val) +{ + ZEXPAND_BNU(pDst, 0, ns); + pDst[0] = val; +} + +/* fix up */ +__INLINE int cpFix_BNU(const BNU_CHUNK_T* pA, int nsA) +{ + FIX_BNU(pA, nsA); + return nsA; +} + +/* comparison +// +// returns +// negative, if A < B +// 0, if A = B +// positive, if A > B +*/ +__INLINE int cpCmp_BNU(const BNU_CHUNK_T* pA, cpSize nsA, const BNU_CHUNK_T* pB, cpSize nsB) +{ + if(nsA!=nsB) + return nsA>nsB? 1 : -1; + else { + for(; nsA>0; nsA--) { + if(pA[nsA-1] > pB[nsA-1]) + return 1; + else if(pA[nsA-1] < pB[nsA-1]) + return -1; + } + return 0; + } +} +__INLINE int cpEqu_BNU_CHUNK(const BNU_CHUNK_T* pA, cpSize nsA, BNU_CHUNK_T b) +{ + return (pA[0]==b && 1==cpFix_BNU(pA, nsA)); +} + +/* +// test +// +// returns +// 0, if A = 0 +// >0, if A > 0 +// <0, looks like impossible (or error) case +*/ +__INLINE int cpTst_BNU(const BNU_CHUNK_T* pA, int nsA) +{ + for(; (nsA>0) && (0==pA[nsA-1]); nsA--) ; + return nsA; +} + +/* number of leading/trailing zeros */ +cpSize cpNLZ_BNU(BNU_CHUNK_T x); +cpSize cpNTZ_BNU(BNU_CHUNK_T x); + +/* logical shift left/right */ +int cpLSR_BNU(BNU_CHUNK_T* pR, const BNU_CHUNK_T* pA, cpSize nsA, cpSize nBits); + +/* least and most significant BNU bit */ +int cpMSBit_BNU(const BNU_CHUNK_T* pA, cpSize nsA); + +/* BNU <-> hex-string conversion */ +int cpToOctStr_BNU(Ipp8u* pStr, cpSize strLen, const BNU_CHUNK_T* pA, cpSize nsA); +int cpFromOctStr_BNU(BNU_CHUNK_T* pA, const Ipp8u* pStr, cpSize strLen); + +#endif /* _PCP_BNUMISC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpcmac.h b/external/crypto_px/sources/ippcp/src/pcpcmac.h index cfeb9bf107..47eee76e9c 100644 --- a/external/crypto_px/sources/ippcp/src/pcpcmac.h +++ b/external/crypto_px/sources/ippcp/src/pcpcmac.h @@ -1,70 +1,70 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_CMAC_H) -#define _PCP_CMAC_H - -#include "pcprij.h" - - -/* -// Rijndael128 based CMAC context -*/ -struct _cpAES_CMAC { - IppCtxId idCtx; /* CMAC identifier */ - int index; /* internal buffer entry (free) */ - int dummy[2]; /* align-16 */ - Ipp8u k1[MBS_RIJ128]; /* k1 subkey */ - Ipp8u k2[MBS_RIJ128]; /* k2 subkey */ - Ipp8u mBuffer[MBS_RIJ128];/* buffer */ - Ipp8u mMAC[MBS_RIJ128]; /* intermediate digest */ - __ALIGN16 /* aligned AES context */ - IppsAESSpec mCipherCtx; -}; - -/* alignment */ -#define AESCMAC_ALIGNMENT (RIJ_ALIGNMENT) - -/* -// Useful macros -*/ -#define CMAC_ID(stt) ((stt)->idCtx) -#define CMAC_INDX(stt) ((stt)->index) -#define CMAC_K1(stt) ((stt)->k1) -#define CMAC_K2(stt) ((stt)->k2) -#define CMAC_BUFF(stt) ((stt)->mBuffer) -#define CMAC_MAC(stt) ((stt)->mMAC) -#define CMAC_CIPHER(stt) ((stt)->mCipherCtx) - -/* valid context ID */ -#define VALID_AESCMAC_ID(ctx) (CMAC_ID((ctx))==idCtxCMAC) - -#endif /* _PCP_CMAC_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_CMAC_H) +#define _PCP_CMAC_H + +#include "pcprij.h" + + +/* +// Rijndael128 based CMAC context +*/ +struct _cpAES_CMAC { + IppCtxId idCtx; /* CMAC identifier */ + int index; /* internal buffer entry (free) */ + int dummy[2]; /* align-16 */ + Ipp8u k1[MBS_RIJ128]; /* k1 subkey */ + Ipp8u k2[MBS_RIJ128]; /* k2 subkey */ + Ipp8u mBuffer[MBS_RIJ128];/* buffer */ + Ipp8u mMAC[MBS_RIJ128]; /* intermediate digest */ + __ALIGN16 /* aligned AES context */ + IppsAESSpec mCipherCtx; +}; + +/* alignment */ +#define AESCMAC_ALIGNMENT (RIJ_ALIGNMENT) + +/* +// Useful macros +*/ +#define CMAC_ID(stt) ((stt)->idCtx) +#define CMAC_INDX(stt) ((stt)->index) +#define CMAC_K1(stt) ((stt)->k1) +#define CMAC_K2(stt) ((stt)->k2) +#define CMAC_BUFF(stt) ((stt)->mBuffer) +#define CMAC_MAC(stt) ((stt)->mMAC) +#define CMAC_CIPHER(stt) ((stt)->mCipherCtx) + +/* valid context ID */ +#define VALID_AESCMAC_ID(ctx) (CMAC_ID((ctx))==idCtxCMAC) + +#endif /* _PCP_CMAC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpeccp.h b/external/crypto_px/sources/ippcp/src/pcpeccp.h index c5bf622be5..34871a136f 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccp.h +++ b/external/crypto_px/sources/ippcp/src/pcpeccp.h @@ -1,230 +1,230 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_ECCP_H) -#define _PCP_ECCP_H - -#include "pcpbnresource.h" -#include "pcppma.h" -#include "pcpeccppoint.h" -#include "pcpeccpsscm.h" - - -typedef struct eccp_method_st ECCP_METHOD; - -/* -// ECC over prime GF(p) Context -*/ -struct _cpECCP { - IppCtxId idCtx; /* prime EC identifier */ - - IppsBigNumState* pPrime; /* specify finite field GF(p) */ - IppsBigNumState* pA; /* scecify A & B of EC equation: */ - IppsBigNumState* pB; /* y^2 = x^3 + A*x + B (mod)p */ - - IppsBigNumState* pGX; /* Base Point (X coordinate) */ - IppsBigNumState* pGY; /* Base Point (Y coordinate) */ - IppsBigNumState* pR; /* order (r) of Base Point */ - /* fields above mainly for ippsECCPSet()/ippsECCPGet() */ - - Ipp32u eccStandard;/* generic/standard ecc */ - - ECCP_METHOD* pMethod; - - int gfeBitSize; /* size (bits) of field element */ - int ordBitSize; /* size (bits) of BP order */ - - int a_3; /* ==1 if A==-3 or A==P-3 */ - IppsBigNumState* pAenc; /* internal formatted pA value */ - IppsBigNumState* pBenc; /* internal formatted pB value */ - IppsMontState* pMontP; /* montromery engine (modulo p) */ - - IppsECCPPointState* pGenc; /* internal formatted Base Point */ - IppsBigNumState* pCofactor; /* cofactor = #E/base_point_order*/ - IppsMontState* pMontR; /* montromery engine (modulo r) */ - - IppsBigNumState* pPrivate; /* private key */ - IppsECCPPointState* pPublic; /* public key (affine) */ - IppsBigNumState* pPrivateE; /* ephemeral private key */ - IppsECCPPointState* pPublicE; /* ephemeral public key (affine) */ - - IppsPrimeState* pPrimary; /* prime engine */ - - Ipp8u* pSscmBuffer;/* pointer to sscm buffer */ - - BigNumNode* pBnList; /* list of big numbers */ -}; - -/* some useful constants */ -#define BNLISTSIZE (32) /* list size (probably less) */ - -/* -// Contetx Access Macros -*/ -#define ECP_ID(ctx) ((ctx)->idCtx) - -#define ECP_PRIME(ctx) ((ctx)->pPrime) -#define ECP_A(ctx) ((ctx)->pA) -#define ECP_B(ctx) ((ctx)->pB) - -#define ECP_GX(ctx) ((ctx)->pGX) -#define ECP_GY(ctx) ((ctx)->pGY) -#define ECP_ORDER(ctx) ((ctx)->pR) - -#define ECP_TYPE(ctx) ((ctx)->eccStandard) - -#define ECP_METHOD(ctx) ((ctx)->pMethod) - -#define ECP_GFEBITS(ctx) ((ctx)->gfeBitSize) -#define ECP_ORDBITS(ctx) ((ctx)->ordBitSize) - -#define ECP_AMI3(ctx) ((ctx)->a_3) -#define ECP_AENC(ctx) ((ctx)->pAenc) -#define ECP_BENC(ctx) ((ctx)->pBenc) -#define ECP_PMONT(ctx) ((ctx)->pMontP) - -#define ECP_GENC(ctx) ((ctx)->pGenc) -#define ECP_COFACTOR(ctx) ((ctx)->pCofactor) -#define ECP_RMONT(ctx) ((ctx)->pMontR) - -#define ECP_PRIVATE(ctx) ((ctx)->pPrivate) -#define ECP_PUBLIC(ctx) ((ctx)->pPublic) -#define ECP_PRIVATE_E(ctx) ((ctx)->pPrivateE) -#define ECP_PUBLIC_E(ctx) ((ctx)->pPublicE) - -#define ECP_PRIMARY(ctx) ((ctx)->pPrimary) -#define ECP_SCCMBUFF(ctx) ((ctx)->pSscmBuffer) -#define ECP_BNCTX(ctx) ((ctx)->pBnList) - -#define ECP_VALID_ID(ctx) (ECP_ID((ctx))==idCtxECCP) - -/* -// Recommended (Standard) Domain Parameters -*/ -extern const Ipp32u secp112r1_p[]; // (2^128 -3)/76439 -extern const Ipp32u secp112r1_a[]; -extern const Ipp32u secp112r1_b[]; -extern const Ipp32u secp112r1_gx[]; -extern const Ipp32u secp112r1_gy[]; -extern const Ipp32u secp112r1_r[]; -extern Ipp32u secp112r1_h; - -extern const Ipp32u secp112r2_p[]; // (2^128 -3)/76439 -extern const Ipp32u secp112r2_a[]; -extern const Ipp32u secp112r2_b[]; -extern const Ipp32u secp112r2_gx[]; -extern const Ipp32u secp112r2_gy[]; -extern const Ipp32u secp112r2_r[]; -extern Ipp32u secp112r2_h; - -extern const Ipp32u secp128r1_p[]; // 2^128 -2^97 -1 -extern const Ipp32u secp128r1_a[]; -extern const Ipp32u secp128r1_b[]; -extern const Ipp32u secp128r1_gx[]; -extern const Ipp32u secp128r1_gy[]; -extern const Ipp32u secp128r1_r[]; -extern Ipp32u secp128r1_h; - -extern const Ipp32u* secp128_mx[]; - -extern const Ipp32u secp128r2_p[]; // 2^128 -2^97 -1 -extern const Ipp32u secp128r2_a[]; -extern const Ipp32u secp128r2_b[]; -extern const Ipp32u secp128r2_gx[]; -extern const Ipp32u secp128r2_gy[]; -extern const Ipp32u secp128r2_r[]; -extern Ipp32u secp128r2_h; - -extern const Ipp32u secp160r1_p[]; // 2^160 -2^31 -1 -extern const Ipp32u secp160r1_a[]; -extern const Ipp32u secp160r1_b[]; -extern const Ipp32u secp160r1_gx[]; -extern const Ipp32u secp160r1_gy[]; -extern const Ipp32u secp160r1_r[]; -extern Ipp32u secp160r1_h; - -extern const Ipp32u secp160r2_p[]; // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1 -extern const Ipp32u secp160r2_a[]; -extern const Ipp32u secp160r2_b[]; -extern const Ipp32u secp160r2_gx[]; -extern const Ipp32u secp160r2_gy[]; -extern const Ipp32u secp160r2_r[]; -extern Ipp32u secp160r2_h; - -extern const Ipp32u secp192r1_p[]; // 2^192 -2^64 -1 -extern const Ipp32u secp192r1_a[]; -extern const Ipp32u secp192r1_b[]; -extern const Ipp32u secp192r1_gx[]; -extern const Ipp32u secp192r1_gy[]; -extern const Ipp32u secp192r1_r[]; -extern Ipp32u secp192r1_h; - -extern const Ipp32u secp224r1_p[]; // 2^224 -2^96 +1 -extern const Ipp32u secp224r1_a[]; -extern const Ipp32u secp224r1_b[]; -extern const Ipp32u secp224r1_gx[]; -extern const Ipp32u secp224r1_gy[]; -extern const Ipp32u secp224r1_r[]; -extern Ipp32u secp224r1_h; - -extern const Ipp32u secp256r1_p[]; // 2^256 -2^224 +2^192 +2^96 -1 -extern const Ipp32u secp256r1_a[]; -extern const Ipp32u secp256r1_b[]; -extern const Ipp32u secp256r1_gx[]; -extern const Ipp32u secp256r1_gy[]; -extern const Ipp32u secp256r1_r[]; -extern Ipp32u secp256r1_h; - -extern const Ipp32u secp384r1_p[]; // 2^384 -2^128 -2^96 +2^32 -1 -extern const Ipp32u secp384r1_a[]; -extern const Ipp32u secp384r1_b[]; -extern const Ipp32u secp384r1_gx[]; -extern const Ipp32u secp384r1_gy[]; -extern const Ipp32u secp384r1_r[]; -extern Ipp32u secp384r1_h; - -extern const Ipp32u secp521r1_p[]; // 2^521 -1 -extern const Ipp32u secp521r1_a[]; -extern const Ipp32u secp521r1_b[]; -extern const Ipp32u secp521r1_gx[]; -extern const Ipp32u secp521r1_gy[]; -extern const Ipp32u secp521r1_r[]; -extern Ipp32u secp521r1_h; - -/* half of some std modulus */ -extern const Ipp32u h_secp128r1_p[]; -extern const Ipp32u h_secp192r1_p[]; -extern const Ipp32u h_secp224r1_p[]; -extern const Ipp32u h_secp256r1_p[]; -extern const Ipp32u h_secp384r1_p[]; -extern const Ipp32u h_secp521r1_p[]; - -#endif /* _PCP_ECCP_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_ECCP_H) +#define _PCP_ECCP_H + +#include "pcpbnresource.h" +#include "pcppma.h" +#include "pcpeccppoint.h" +#include "pcpeccpsscm.h" + + +typedef struct eccp_method_st ECCP_METHOD; + +/* +// ECC over prime GF(p) Context +*/ +struct _cpECCP { + IppCtxId idCtx; /* prime EC identifier */ + + IppsBigNumState* pPrime; /* specify finite field GF(p) */ + IppsBigNumState* pA; /* scecify A & B of EC equation: */ + IppsBigNumState* pB; /* y^2 = x^3 + A*x + B (mod)p */ + + IppsBigNumState* pGX; /* Base Point (X coordinate) */ + IppsBigNumState* pGY; /* Base Point (Y coordinate) */ + IppsBigNumState* pR; /* order (r) of Base Point */ + /* fields above mainly for ippsECCPSet()/ippsECCPGet() */ + + Ipp32u eccStandard;/* generic/standard ecc */ + + ECCP_METHOD* pMethod; + + int gfeBitSize; /* size (bits) of field element */ + int ordBitSize; /* size (bits) of BP order */ + + int a_3; /* ==1 if A==-3 or A==P-3 */ + IppsBigNumState* pAenc; /* internal formatted pA value */ + IppsBigNumState* pBenc; /* internal formatted pB value */ + IppsMontState* pMontP; /* montromery engine (modulo p) */ + + IppsECCPPointState* pGenc; /* internal formatted Base Point */ + IppsBigNumState* pCofactor; /* cofactor = #E/base_point_order*/ + IppsMontState* pMontR; /* montromery engine (modulo r) */ + + IppsBigNumState* pPrivate; /* private key */ + IppsECCPPointState* pPublic; /* public key (affine) */ + IppsBigNumState* pPrivateE; /* ephemeral private key */ + IppsECCPPointState* pPublicE; /* ephemeral public key (affine) */ + + IppsPrimeState* pPrimary; /* prime engine */ + + Ipp8u* pSscmBuffer;/* pointer to sscm buffer */ + + BigNumNode* pBnList; /* list of big numbers */ +}; + +/* some useful constants */ +#define BNLISTSIZE (32) /* list size (probably less) */ + +/* +// Contetx Access Macros +*/ +#define ECP_ID(ctx) ((ctx)->idCtx) + +#define ECP_PRIME(ctx) ((ctx)->pPrime) +#define ECP_A(ctx) ((ctx)->pA) +#define ECP_B(ctx) ((ctx)->pB) + +#define ECP_GX(ctx) ((ctx)->pGX) +#define ECP_GY(ctx) ((ctx)->pGY) +#define ECP_ORDER(ctx) ((ctx)->pR) + +#define ECP_TYPE(ctx) ((ctx)->eccStandard) + +#define ECP_METHOD(ctx) ((ctx)->pMethod) + +#define ECP_GFEBITS(ctx) ((ctx)->gfeBitSize) +#define ECP_ORDBITS(ctx) ((ctx)->ordBitSize) + +#define ECP_AMI3(ctx) ((ctx)->a_3) +#define ECP_AENC(ctx) ((ctx)->pAenc) +#define ECP_BENC(ctx) ((ctx)->pBenc) +#define ECP_PMONT(ctx) ((ctx)->pMontP) + +#define ECP_GENC(ctx) ((ctx)->pGenc) +#define ECP_COFACTOR(ctx) ((ctx)->pCofactor) +#define ECP_RMONT(ctx) ((ctx)->pMontR) + +#define ECP_PRIVATE(ctx) ((ctx)->pPrivate) +#define ECP_PUBLIC(ctx) ((ctx)->pPublic) +#define ECP_PRIVATE_E(ctx) ((ctx)->pPrivateE) +#define ECP_PUBLIC_E(ctx) ((ctx)->pPublicE) + +#define ECP_PRIMARY(ctx) ((ctx)->pPrimary) +#define ECP_SCCMBUFF(ctx) ((ctx)->pSscmBuffer) +#define ECP_BNCTX(ctx) ((ctx)->pBnList) + +#define ECP_VALID_ID(ctx) (ECP_ID((ctx))==idCtxECCP) + +/* +// Recommended (Standard) Domain Parameters +*/ +extern const Ipp32u secp112r1_p[]; // (2^128 -3)/76439 +extern const Ipp32u secp112r1_a[]; +extern const Ipp32u secp112r1_b[]; +extern const Ipp32u secp112r1_gx[]; +extern const Ipp32u secp112r1_gy[]; +extern const Ipp32u secp112r1_r[]; +extern Ipp32u secp112r1_h; + +extern const Ipp32u secp112r2_p[]; // (2^128 -3)/76439 +extern const Ipp32u secp112r2_a[]; +extern const Ipp32u secp112r2_b[]; +extern const Ipp32u secp112r2_gx[]; +extern const Ipp32u secp112r2_gy[]; +extern const Ipp32u secp112r2_r[]; +extern Ipp32u secp112r2_h; + +extern const Ipp32u secp128r1_p[]; // 2^128 -2^97 -1 +extern const Ipp32u secp128r1_a[]; +extern const Ipp32u secp128r1_b[]; +extern const Ipp32u secp128r1_gx[]; +extern const Ipp32u secp128r1_gy[]; +extern const Ipp32u secp128r1_r[]; +extern Ipp32u secp128r1_h; + +extern const Ipp32u* secp128_mx[]; + +extern const Ipp32u secp128r2_p[]; // 2^128 -2^97 -1 +extern const Ipp32u secp128r2_a[]; +extern const Ipp32u secp128r2_b[]; +extern const Ipp32u secp128r2_gx[]; +extern const Ipp32u secp128r2_gy[]; +extern const Ipp32u secp128r2_r[]; +extern Ipp32u secp128r2_h; + +extern const Ipp32u secp160r1_p[]; // 2^160 -2^31 -1 +extern const Ipp32u secp160r1_a[]; +extern const Ipp32u secp160r1_b[]; +extern const Ipp32u secp160r1_gx[]; +extern const Ipp32u secp160r1_gy[]; +extern const Ipp32u secp160r1_r[]; +extern Ipp32u secp160r1_h; + +extern const Ipp32u secp160r2_p[]; // 2^160 -2^32 -2^14 -2^12 -2^9 -2^8 -2^7 -2^2 -1 +extern const Ipp32u secp160r2_a[]; +extern const Ipp32u secp160r2_b[]; +extern const Ipp32u secp160r2_gx[]; +extern const Ipp32u secp160r2_gy[]; +extern const Ipp32u secp160r2_r[]; +extern Ipp32u secp160r2_h; + +extern const Ipp32u secp192r1_p[]; // 2^192 -2^64 -1 +extern const Ipp32u secp192r1_a[]; +extern const Ipp32u secp192r1_b[]; +extern const Ipp32u secp192r1_gx[]; +extern const Ipp32u secp192r1_gy[]; +extern const Ipp32u secp192r1_r[]; +extern Ipp32u secp192r1_h; + +extern const Ipp32u secp224r1_p[]; // 2^224 -2^96 +1 +extern const Ipp32u secp224r1_a[]; +extern const Ipp32u secp224r1_b[]; +extern const Ipp32u secp224r1_gx[]; +extern const Ipp32u secp224r1_gy[]; +extern const Ipp32u secp224r1_r[]; +extern Ipp32u secp224r1_h; + +extern const Ipp32u secp256r1_p[]; // 2^256 -2^224 +2^192 +2^96 -1 +extern const Ipp32u secp256r1_a[]; +extern const Ipp32u secp256r1_b[]; +extern const Ipp32u secp256r1_gx[]; +extern const Ipp32u secp256r1_gy[]; +extern const Ipp32u secp256r1_r[]; +extern Ipp32u secp256r1_h; + +extern const Ipp32u secp384r1_p[]; // 2^384 -2^128 -2^96 +2^32 -1 +extern const Ipp32u secp384r1_a[]; +extern const Ipp32u secp384r1_b[]; +extern const Ipp32u secp384r1_gx[]; +extern const Ipp32u secp384r1_gy[]; +extern const Ipp32u secp384r1_r[]; +extern Ipp32u secp384r1_h; + +extern const Ipp32u secp521r1_p[]; // 2^521 -1 +extern const Ipp32u secp521r1_a[]; +extern const Ipp32u secp521r1_b[]; +extern const Ipp32u secp521r1_gx[]; +extern const Ipp32u secp521r1_gy[]; +extern const Ipp32u secp521r1_r[]; +extern Ipp32u secp521r1_h; + +/* half of some std modulus */ +extern const Ipp32u h_secp128r1_p[]; +extern const Ipp32u h_secp192r1_p[]; +extern const Ipp32u h_secp224r1_p[]; +extern const Ipp32u h_secp256r1_p[]; +extern const Ipp32u h_secp384r1_p[]; +extern const Ipp32u h_secp521r1_p[]; + +#endif /* _PCP_ECCP_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c b/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c index f5b9f5b060..e4c88689d4 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpdpca.c @@ -1,370 +1,370 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccp.h" -#include "pcpeccppoint.h" -#include "pcpbnresource.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" -#include "pcppma.h" - - -/*F* -// Name: ippsECCPSet -// -// Purpose: Set EC Domain Parameters. -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pPrime -// NULL == pA -// NULL == pB -// NULL == pGX -// NULL == pGY -// NULL == pOrder -// NULL == pECC -// -// ippStsContextMatchErr illegal pPrime->idCtx -// illegal pA->idCtx -// illegal pB->idCtx -// illegal pGX->idCtx -// illegal pGY->idCtx -// illegal pOrder->idCtx -// illegal pECC->idCtx -// -// ippStsRangeErr not enough room for: -// pPrime -// pA, pB, -// pGX,pGY -// pOrder -// -// ippStsRangeErr 0>= cofactor -// -// ippStsNoErr no errors -// -// Parameters: -// pPrime pointer to the prime (specify FG(p)) -// pA pointer to the A coefficient of EC equation -// pB pointer to the B coefficient of EC equation -// pGX,pGY pointer to the Base Point (x and y coordinates) of EC -// pOrder pointer to the Base Point order -// cofactor cofactor value -// pECC pointer to the ECC context -// -*F*/ -static -void ECCPSetDP(IppECCType flag, - int primeSize, const Ipp32u* pPrime, - int aSize, const Ipp32u* pA, - int bSize, const Ipp32u* pB, - int gxSize, const Ipp32u* pGx, - int gySize, const Ipp32u* pGy, - int orderSize, const Ipp32u* pOrder, - Ipp32u cofactor, - IppsECCPState* pECC) -{ - ECP_TYPE(pECC) = flag; - - /* reset size (bits) of field element */ - ECP_GFEBITS(pECC) = cpMSBit_BNU32(pPrime, primeSize) +1; - /* reset size (bits) of Base Point order */ - ECP_ORDBITS(pECC) = cpMSBit_BNU32(pOrder, orderSize) +1; - - /* set up prime */ - ippsSet_BN(ippBigNumPOS, primeSize, pPrime, ECP_PRIME(pECC)); - /* set up A */ - ippsSet_BN(ippBigNumPOS, aSize, pA, ECP_A(pECC)); - /* test A */ - BN_Word(ECP_B(pECC), 3); - PMA_add(ECP_B(pECC), ECP_A(pECC), ECP_B(pECC), ECP_PRIME(pECC)); - ECP_AMI3(pECC) = IsZero_BN(ECP_B(pECC)); - /* set up B */ - ippsSet_BN(ippBigNumPOS, bSize, pB, ECP_B(pECC)); - - /* set up affine coordinates of Base Point and order */ - ippsSet_BN(ippBigNumPOS, gxSize, pGx, ECP_GX(pECC)); - ippsSet_BN(ippBigNumPOS, gySize, pGy, ECP_GY(pECC)); - ippsSet_BN(ippBigNumPOS, orderSize, pOrder, ECP_ORDER(pECC)); - - /* set up cofactor */ - //ippsSet_BN(ippBigNumPOS, 1, &((Ipp32u)cofactor), ECP_COFACTOR(pECC)); - ippsSet_BN(ippBigNumPOS, 1, &cofactor, ECP_COFACTOR(pECC)); - - /* montgomery engine (prime) */ - if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_PRIME(pECC)), BN_SIZE32(ECP_PRIME(pECC)), ECP_PMONT(pECC)) ) { - /* modulo reduction and montgomery form of A and B */ - PMA_mod(ECP_AENC(pECC), ECP_A(pECC), ECP_PRIME(pECC)); - PMA_enc(ECP_AENC(pECC), ECP_AENC(pECC), ECP_PMONT(pECC)); - PMA_mod(ECP_BENC(pECC), ECP_B(pECC), ECP_PRIME(pECC)); - PMA_enc(ECP_BENC(pECC), ECP_BENC(pECC), ECP_PMONT(pECC)); - /* projective coordinates and montgomery form of of Base Point */ - if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(ECP_GX(pECC), ECP_GY(pECC))) || - (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(ECP_GX(pECC), ECP_GY(pECC))) ) - ECCP_SetPointToInfinity(ECP_GENC(pECC)); - else { - ECP_METHOD(pECC)->SetPointProjective(ECP_GX(pECC), ECP_GY(pECC), BN_ONE_REF(), ECP_GENC(pECC), pECC); - } - } - - /* montgomery engine (order) */ - if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_ORDER(pECC)), BN_SIZE32(ECP_ORDER(pECC)), ECP_RMONT(pECC)) ) - PMA_enc(ECP_COFACTOR(pECC), ECP_COFACTOR(pECC), ECP_RMONT(pECC)); - - /* set zero private keys */ - BN_Word(ECP_PRIVATE(pECC), 0); - BN_Word(ECP_PRIVATE_E(pECC), 0); - - /* set infinity public keys */ - ECCP_SetPointToInfinity(ECP_PUBLIC(pECC)); - ECCP_SetPointToInfinity(ECP_PUBLIC_E(pECC)); -} - - -IPPFUN(IppStatus, ippsECCPSet, (const IppsBigNumState* pPrime, - const IppsBigNumState* pA, const IppsBigNumState* pB, - const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, - int cofactor, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test pPrime */ - IPP_BAD_PTR1_RET(pPrime); - pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr); - IPP_BADARG_RET((cpBN_bitsize(pPrime)>ECP_GFEBITS(pECC)), ippStsRangeErr); - - /* test pA and pB */ - IPP_BAD_PTR2_RET(pA,pB); - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, ALIGN_VAL) ); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - IPP_BADARG_RET((cpBN_bitsize(pA)>ECP_GFEBITS(pECC)), ippStsRangeErr); - IPP_BADARG_RET((cpBN_bitsize(pB)>ECP_GFEBITS(pECC)), ippStsRangeErr); - - /* test pG and pGorder pointers */ - IPP_BAD_PTR3_RET(pGX,pGY, pOrder); - pGX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pGX, ALIGN_VAL) ); - pGY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pGY, ALIGN_VAL) ); - pOrder = (IppsBigNumState*)( IPP_ALIGNED_PTR(pOrder, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pGX), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pGY), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr); - IPP_BADARG_RET((cpBN_bitsize(pGX)>ECP_GFEBITS(pECC)), ippStsRangeErr); - IPP_BADARG_RET((cpBN_bitsize(pGY)>ECP_GFEBITS(pECC)), ippStsRangeErr); - IPP_BADARG_RET((cpBN_bitsize(pOrder)>ECP_ORDBITS(pECC)), ippStsRangeErr); - - /* test cofactor */ - IPP_BADARG_RET(!(0idCtx -// -// ippStsECCInvalidFlagErr invalid flag -// -// ippStsNoErr no errors -// -// Parameters: -// flag specify standard ECC parameter(s) to be setup -// pECC pointer to the ECC context -// -*F*/ -IPPFUN(IppStatus, ippsECCPSetStd, (IppECCType flag, IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); - - switch(flag) { - case IppECCPStd112r1: - ECCPSetDP(IppECCPStd112r1, - BITS2WORD32_SIZE(112), secp112r1_p, - BITS2WORD32_SIZE(112), secp112r1_a, - BITS2WORD32_SIZE(112), secp112r1_b, - BITS2WORD32_SIZE(112), secp112r1_gx, - BITS2WORD32_SIZE(112), secp112r1_gy, - BITS2WORD32_SIZE(112), secp112r1_r, - secp112r1_h, pECC); - break; - - case IppECCPStd112r2: - ECCPSetDP(IppECCPStd112r2, - BITS2WORD32_SIZE(112), secp112r2_p, - BITS2WORD32_SIZE(112), secp112r2_a, - BITS2WORD32_SIZE(112), secp112r2_b, - BITS2WORD32_SIZE(112), secp112r2_gx, - BITS2WORD32_SIZE(112), secp112r2_gy, - BITS2WORD32_SIZE(112), secp112r2_r, - secp112r2_h, pECC); - break; - - case IppECCPStd128r1: - ECCPSetDP(IppECCPStd128r1, - BITS2WORD32_SIZE(128), secp128r1_p, - BITS2WORD32_SIZE(128), secp128r1_a, - BITS2WORD32_SIZE(128), secp128r1_b, - BITS2WORD32_SIZE(128), secp128r1_gx, - BITS2WORD32_SIZE(128), secp128r1_gy, - BITS2WORD32_SIZE(128), secp128r1_r, - secp128r1_h, pECC); - break; - - case IppECCPStd128r2: - ECCPSetDP(IppECCPStd128r2, - BITS2WORD32_SIZE(128), secp128r2_p, - BITS2WORD32_SIZE(128), secp128r2_a, - BITS2WORD32_SIZE(128), secp128r2_b, - BITS2WORD32_SIZE(128), secp128r2_gx, - BITS2WORD32_SIZE(128), secp128r2_gy, - BITS2WORD32_SIZE(128), secp128r2_r, - secp128r2_h, pECC); - break; - - case IppECCPStd160r1: - ECCPSetDP(IppECCPStd160r1, - BITS2WORD32_SIZE(160), secp160r1_p, - BITS2WORD32_SIZE(160), secp160r1_a, - BITS2WORD32_SIZE(160), secp160r1_b, - BITS2WORD32_SIZE(160), secp160r1_gx, - BITS2WORD32_SIZE(160), secp160r1_gy, - BITS2WORD32_SIZE(161), secp160r1_r, - secp160r1_h, pECC); - break; - - case IppECCPStd160r2: - ECCPSetDP(IppECCPStd160r2, - BITS2WORD32_SIZE(160), secp160r2_p, - BITS2WORD32_SIZE(160), secp160r2_a, - BITS2WORD32_SIZE(160), secp160r2_b, - BITS2WORD32_SIZE(160), secp160r2_gx, - BITS2WORD32_SIZE(160), secp160r2_gy, - BITS2WORD32_SIZE(161), secp160r2_r, - secp160r2_h, pECC); - break; - - case IppECCPStd192r1: - ECCPSetDP(IppECCPStd192r1, - BITS2WORD32_SIZE(192), secp192r1_p, - BITS2WORD32_SIZE(192), secp192r1_a, - BITS2WORD32_SIZE(192), secp192r1_b, - BITS2WORD32_SIZE(192), secp192r1_gx, - BITS2WORD32_SIZE(192), secp192r1_gy, - BITS2WORD32_SIZE(192), secp192r1_r, - secp192r1_h, pECC); - break; - - case IppECCPStd224r1: - ECCPSetDP(IppECCPStd224r1, - BITS2WORD32_SIZE(224), secp224r1_p, - BITS2WORD32_SIZE(224), secp224r1_a, - BITS2WORD32_SIZE(224), secp224r1_b, - BITS2WORD32_SIZE(224), secp224r1_gx, - BITS2WORD32_SIZE(224), secp224r1_gy, - BITS2WORD32_SIZE(224), secp224r1_r, - secp224r1_h, pECC); - break; - - case IppECCPStd256r1: - ECCPSetDP(IppECCPStd256r1, - BITS2WORD32_SIZE(256), secp256r1_p, - BITS2WORD32_SIZE(256), secp256r1_a, - BITS2WORD32_SIZE(256), secp256r1_b, - BITS2WORD32_SIZE(256), secp256r1_gx, - BITS2WORD32_SIZE(256), secp256r1_gy, - BITS2WORD32_SIZE(256), secp256r1_r, - secp256r1_h, pECC); - break; - - case IppECCPStd384r1: - ECCPSetDP(IppECCPStd384r1, - BITS2WORD32_SIZE(384), secp384r1_p, - BITS2WORD32_SIZE(384), secp384r1_a, - BITS2WORD32_SIZE(384), secp384r1_b, - BITS2WORD32_SIZE(384), secp384r1_gx, - BITS2WORD32_SIZE(384), secp384r1_gy, - BITS2WORD32_SIZE(384), secp384r1_r, - secp384r1_h, pECC); - break; - - case IppECCPStd521r1: - ECCPSetDP(IppECCPStd521r1, - BITS2WORD32_SIZE(521), secp521r1_p, - BITS2WORD32_SIZE(521), secp521r1_a, - BITS2WORD32_SIZE(521), secp521r1_b, - BITS2WORD32_SIZE(521), secp521r1_gx, - BITS2WORD32_SIZE(521), secp521r1_gy, - BITS2WORD32_SIZE(521), secp521r1_r, - secp521r1_h, pECC); - break; - - default: - return ippStsECCInvalidFlagErr; - } - - return ippStsNoErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpbnresource.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" +#include "pcppma.h" + + +/*F* +// Name: ippsECCPSet +// +// Purpose: Set EC Domain Parameters. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pPrime +// NULL == pA +// NULL == pB +// NULL == pGX +// NULL == pGY +// NULL == pOrder +// NULL == pECC +// +// ippStsContextMatchErr illegal pPrime->idCtx +// illegal pA->idCtx +// illegal pB->idCtx +// illegal pGX->idCtx +// illegal pGY->idCtx +// illegal pOrder->idCtx +// illegal pECC->idCtx +// +// ippStsRangeErr not enough room for: +// pPrime +// pA, pB, +// pGX,pGY +// pOrder +// +// ippStsRangeErr 0>= cofactor +// +// ippStsNoErr no errors +// +// Parameters: +// pPrime pointer to the prime (specify FG(p)) +// pA pointer to the A coefficient of EC equation +// pB pointer to the B coefficient of EC equation +// pGX,pGY pointer to the Base Point (x and y coordinates) of EC +// pOrder pointer to the Base Point order +// cofactor cofactor value +// pECC pointer to the ECC context +// +*F*/ +static +void ECCPSetDP(IppECCType flag, + int primeSize, const Ipp32u* pPrime, + int aSize, const Ipp32u* pA, + int bSize, const Ipp32u* pB, + int gxSize, const Ipp32u* pGx, + int gySize, const Ipp32u* pGy, + int orderSize, const Ipp32u* pOrder, + Ipp32u cofactor, + IppsECCPState* pECC) +{ + ECP_TYPE(pECC) = flag; + + /* reset size (bits) of field element */ + ECP_GFEBITS(pECC) = cpMSBit_BNU32(pPrime, primeSize) +1; + /* reset size (bits) of Base Point order */ + ECP_ORDBITS(pECC) = cpMSBit_BNU32(pOrder, orderSize) +1; + + /* set up prime */ + ippsSet_BN(ippBigNumPOS, primeSize, pPrime, ECP_PRIME(pECC)); + /* set up A */ + ippsSet_BN(ippBigNumPOS, aSize, pA, ECP_A(pECC)); + /* test A */ + BN_Word(ECP_B(pECC), 3); + PMA_add(ECP_B(pECC), ECP_A(pECC), ECP_B(pECC), ECP_PRIME(pECC)); + ECP_AMI3(pECC) = IsZero_BN(ECP_B(pECC)); + /* set up B */ + ippsSet_BN(ippBigNumPOS, bSize, pB, ECP_B(pECC)); + + /* set up affine coordinates of Base Point and order */ + ippsSet_BN(ippBigNumPOS, gxSize, pGx, ECP_GX(pECC)); + ippsSet_BN(ippBigNumPOS, gySize, pGy, ECP_GY(pECC)); + ippsSet_BN(ippBigNumPOS, orderSize, pOrder, ECP_ORDER(pECC)); + + /* set up cofactor */ + //ippsSet_BN(ippBigNumPOS, 1, &((Ipp32u)cofactor), ECP_COFACTOR(pECC)); + ippsSet_BN(ippBigNumPOS, 1, &cofactor, ECP_COFACTOR(pECC)); + + /* montgomery engine (prime) */ + if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_PRIME(pECC)), BN_SIZE32(ECP_PRIME(pECC)), ECP_PMONT(pECC)) ) { + /* modulo reduction and montgomery form of A and B */ + PMA_mod(ECP_AENC(pECC), ECP_A(pECC), ECP_PRIME(pECC)); + PMA_enc(ECP_AENC(pECC), ECP_AENC(pECC), ECP_PMONT(pECC)); + PMA_mod(ECP_BENC(pECC), ECP_B(pECC), ECP_PRIME(pECC)); + PMA_enc(ECP_BENC(pECC), ECP_BENC(pECC), ECP_PMONT(pECC)); + /* projective coordinates and montgomery form of of Base Point */ + if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(ECP_GX(pECC), ECP_GY(pECC))) || + (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(ECP_GX(pECC), ECP_GY(pECC))) ) + ECCP_SetPointToInfinity(ECP_GENC(pECC)); + else { + ECP_METHOD(pECC)->SetPointProjective(ECP_GX(pECC), ECP_GY(pECC), BN_ONE_REF(), ECP_GENC(pECC), pECC); + } + } + + /* montgomery engine (order) */ + if( ippStsNoErr == ippsMontSet((Ipp32u*)BN_NUMBER(ECP_ORDER(pECC)), BN_SIZE32(ECP_ORDER(pECC)), ECP_RMONT(pECC)) ) + PMA_enc(ECP_COFACTOR(pECC), ECP_COFACTOR(pECC), ECP_RMONT(pECC)); + + /* set zero private keys */ + BN_Word(ECP_PRIVATE(pECC), 0); + BN_Word(ECP_PRIVATE_E(pECC), 0); + + /* set infinity public keys */ + ECCP_SetPointToInfinity(ECP_PUBLIC(pECC)); + ECCP_SetPointToInfinity(ECP_PUBLIC_E(pECC)); +} + + +IPPFUN(IppStatus, ippsECCPSet, (const IppsBigNumState* pPrime, + const IppsBigNumState* pA, const IppsBigNumState* pB, + const IppsBigNumState* pGX,const IppsBigNumState* pGY,const IppsBigNumState* pOrder, + int cofactor, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test pPrime */ + IPP_BAD_PTR1_RET(pPrime); + pPrime = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrime, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrime), ippStsContextMatchErr); + IPP_BADARG_RET((cpBN_bitsize(pPrime)>ECP_GFEBITS(pECC)), ippStsRangeErr); + + /* test pA and pB */ + IPP_BAD_PTR2_RET(pA,pB); + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, ALIGN_VAL) ); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + IPP_BADARG_RET((cpBN_bitsize(pA)>ECP_GFEBITS(pECC)), ippStsRangeErr); + IPP_BADARG_RET((cpBN_bitsize(pB)>ECP_GFEBITS(pECC)), ippStsRangeErr); + + /* test pG and pGorder pointers */ + IPP_BAD_PTR3_RET(pGX,pGY, pOrder); + pGX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pGX, ALIGN_VAL) ); + pGY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pGY, ALIGN_VAL) ); + pOrder = (IppsBigNumState*)( IPP_ALIGNED_PTR(pOrder, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pGX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pGY), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pOrder), ippStsContextMatchErr); + IPP_BADARG_RET((cpBN_bitsize(pGX)>ECP_GFEBITS(pECC)), ippStsRangeErr); + IPP_BADARG_RET((cpBN_bitsize(pGY)>ECP_GFEBITS(pECC)), ippStsRangeErr); + IPP_BADARG_RET((cpBN_bitsize(pOrder)>ECP_ORDBITS(pECC)), ippStsRangeErr); + + /* test cofactor */ + IPP_BADARG_RET(!(0idCtx +// +// ippStsECCInvalidFlagErr invalid flag +// +// ippStsNoErr no errors +// +// Parameters: +// flag specify standard ECC parameter(s) to be setup +// pECC pointer to the ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetStd, (IppECCType flag, IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + *(ECP_METHOD(pECC)) = *(ECCPcom_Methods()); + + switch(flag) { + case IppECCPStd112r1: + ECCPSetDP(IppECCPStd112r1, + BITS2WORD32_SIZE(112), secp112r1_p, + BITS2WORD32_SIZE(112), secp112r1_a, + BITS2WORD32_SIZE(112), secp112r1_b, + BITS2WORD32_SIZE(112), secp112r1_gx, + BITS2WORD32_SIZE(112), secp112r1_gy, + BITS2WORD32_SIZE(112), secp112r1_r, + secp112r1_h, pECC); + break; + + case IppECCPStd112r2: + ECCPSetDP(IppECCPStd112r2, + BITS2WORD32_SIZE(112), secp112r2_p, + BITS2WORD32_SIZE(112), secp112r2_a, + BITS2WORD32_SIZE(112), secp112r2_b, + BITS2WORD32_SIZE(112), secp112r2_gx, + BITS2WORD32_SIZE(112), secp112r2_gy, + BITS2WORD32_SIZE(112), secp112r2_r, + secp112r2_h, pECC); + break; + + case IppECCPStd128r1: + ECCPSetDP(IppECCPStd128r1, + BITS2WORD32_SIZE(128), secp128r1_p, + BITS2WORD32_SIZE(128), secp128r1_a, + BITS2WORD32_SIZE(128), secp128r1_b, + BITS2WORD32_SIZE(128), secp128r1_gx, + BITS2WORD32_SIZE(128), secp128r1_gy, + BITS2WORD32_SIZE(128), secp128r1_r, + secp128r1_h, pECC); + break; + + case IppECCPStd128r2: + ECCPSetDP(IppECCPStd128r2, + BITS2WORD32_SIZE(128), secp128r2_p, + BITS2WORD32_SIZE(128), secp128r2_a, + BITS2WORD32_SIZE(128), secp128r2_b, + BITS2WORD32_SIZE(128), secp128r2_gx, + BITS2WORD32_SIZE(128), secp128r2_gy, + BITS2WORD32_SIZE(128), secp128r2_r, + secp128r2_h, pECC); + break; + + case IppECCPStd160r1: + ECCPSetDP(IppECCPStd160r1, + BITS2WORD32_SIZE(160), secp160r1_p, + BITS2WORD32_SIZE(160), secp160r1_a, + BITS2WORD32_SIZE(160), secp160r1_b, + BITS2WORD32_SIZE(160), secp160r1_gx, + BITS2WORD32_SIZE(160), secp160r1_gy, + BITS2WORD32_SIZE(161), secp160r1_r, + secp160r1_h, pECC); + break; + + case IppECCPStd160r2: + ECCPSetDP(IppECCPStd160r2, + BITS2WORD32_SIZE(160), secp160r2_p, + BITS2WORD32_SIZE(160), secp160r2_a, + BITS2WORD32_SIZE(160), secp160r2_b, + BITS2WORD32_SIZE(160), secp160r2_gx, + BITS2WORD32_SIZE(160), secp160r2_gy, + BITS2WORD32_SIZE(161), secp160r2_r, + secp160r2_h, pECC); + break; + + case IppECCPStd192r1: + ECCPSetDP(IppECCPStd192r1, + BITS2WORD32_SIZE(192), secp192r1_p, + BITS2WORD32_SIZE(192), secp192r1_a, + BITS2WORD32_SIZE(192), secp192r1_b, + BITS2WORD32_SIZE(192), secp192r1_gx, + BITS2WORD32_SIZE(192), secp192r1_gy, + BITS2WORD32_SIZE(192), secp192r1_r, + secp192r1_h, pECC); + break; + + case IppECCPStd224r1: + ECCPSetDP(IppECCPStd224r1, + BITS2WORD32_SIZE(224), secp224r1_p, + BITS2WORD32_SIZE(224), secp224r1_a, + BITS2WORD32_SIZE(224), secp224r1_b, + BITS2WORD32_SIZE(224), secp224r1_gx, + BITS2WORD32_SIZE(224), secp224r1_gy, + BITS2WORD32_SIZE(224), secp224r1_r, + secp224r1_h, pECC); + break; + + case IppECCPStd256r1: + ECCPSetDP(IppECCPStd256r1, + BITS2WORD32_SIZE(256), secp256r1_p, + BITS2WORD32_SIZE(256), secp256r1_a, + BITS2WORD32_SIZE(256), secp256r1_b, + BITS2WORD32_SIZE(256), secp256r1_gx, + BITS2WORD32_SIZE(256), secp256r1_gy, + BITS2WORD32_SIZE(256), secp256r1_r, + secp256r1_h, pECC); + break; + + case IppECCPStd384r1: + ECCPSetDP(IppECCPStd384r1, + BITS2WORD32_SIZE(384), secp384r1_p, + BITS2WORD32_SIZE(384), secp384r1_a, + BITS2WORD32_SIZE(384), secp384r1_b, + BITS2WORD32_SIZE(384), secp384r1_gx, + BITS2WORD32_SIZE(384), secp384r1_gy, + BITS2WORD32_SIZE(384), secp384r1_r, + secp384r1_h, pECC); + break; + + case IppECCPStd521r1: + ECCPSetDP(IppECCPStd521r1, + BITS2WORD32_SIZE(521), secp521r1_p, + BITS2WORD32_SIZE(521), secp521r1_a, + BITS2WORD32_SIZE(521), secp521r1_b, + BITS2WORD32_SIZE(521), secp521r1_gx, + BITS2WORD32_SIZE(521), secp521r1_gy, + BITS2WORD32_SIZE(521), secp521r1_r, + secp521r1_h, pECC); + break; + + default: + return ippStsECCInvalidFlagErr; + } + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c b/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c index aab1fd4f29..b152a7b82c 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpgenkeyca.c @@ -1,107 +1,107 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccppoint.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" - - -/*F* -// Name: ippsECCPGenKeyPair -// -// Purpose: Generate (private,public) Key Pair -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPrivate -// NULL == pPublic -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pPrivate->idCtx -// illegal pPublic->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pPrivate pointer to the resultant private key -// pPublic pointer to the resultant public key -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPGenKeyPair, (IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, - IppsECCPState* pECC, - IppBitSupplier rndFunc, void* pRndParam)) -{ - IPP_BAD_PTR2_RET(pECC, rndFunc); - - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test private/public keys */ - IPP_BAD_PTR2_RET(pPrivate,pPublic); - pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); - pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); - IPP_BADARG_RET((BN_ROOM(pPrivate)*BITSIZE(BNU_CHUNK_T)MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC)); - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPGenKeyPair +// +// Purpose: Generate (private,public) Key Pair +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivate +// NULL == pPublic +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivate->idCtx +// illegal pPublic->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivate pointer to the resultant private key +// pPublic pointer to the resultant public key +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPGenKeyPair, (IppsBigNumState* pPrivate, IppsECCPPointState* pPublic, + IppsECCPState* pECC, + IppBitSupplier rndFunc, void* pRndParam)) +{ + IPP_BAD_PTR2_RET(pECC, rndFunc); + + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test private/public keys */ + IPP_BAD_PTR2_RET(pPrivate,pPublic); + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + IPP_BADARG_RET((BN_ROOM(pPrivate)*BITSIZE(BNU_CHUNK_T)MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c b/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c index ef7be299ea..ee54bb844b 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpinitca.c @@ -1,305 +1,305 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccp.h" -#include "pcpeccppoint.h" -#include "pcpbnresource.h" -#include "pcpeccpmethod.h" -#include "pcpeccpsscm.h" -#include "pcptool.h" - - -/*F* -// Name: ippsECCPGetSize -// -// Purpose: Returns size of ECC context (bytes). -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSize -// -// ippStsSizeErr 2>feBitSize -// -// ippStsNoErr no errors -// -// Parameters: -// feBitSize size of field element (bits) -// pSize pointer to the size of internal ECC context -// -*F*/ -IPPFUN(IppStatus, ippsECCPGetSize, (int feBitSize, int *pSize)) -{ - /* test size's pointer */ - IPP_BAD_PTR1_RET(pSize); - - /* test size of field element */ - IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr); - - { - int bn1Size; - int bn2Size; - int pointSize; - int mont1Size; - int mont2Size; - int primeSize; - int listSize; - - /* size of field element */ - int gfeSize = BITS2WORD32_SIZE(feBitSize); - /* size of order */ - int ordSize = BITS2WORD32_SIZE(feBitSize+1); - - /* size of sscm buffer */ - int w = cpECCP_OptimalWinSize(feBitSize+1); - int nPrecomputed = 1<feBitSize -// -// ippStsNoErr no errors -// -// Parameters: -// feBitSize size of field element (bits) -// pECC pointer to the ECC context -// -*F*/ -IPPFUN(IppStatus, ippsECCPInit, (int feBitSize, IppsECCPState* pECC)) -{ - /* test pECC pointer */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - - /* test size of field element */ - IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr); - - /* clear context */ - PaddBlock(0, pECC, sizeof(IppsECCPState)); - - /* context ID */ - ECP_ID(pECC) = idCtxECCP; - - /* generic EC */ - ECP_TYPE(pECC) = IppECCArbitrary; - - /* size of field element & BP order */ - ECP_GFEBITS(pECC) = feBitSize; - ECP_ORDBITS(pECC) = feBitSize+1; - - /* - // init other context fields - */ - { - int bn1Size; - int bn2Size; - int pointSize; - int mont1Size; - int mont2Size; - int primeSize; - - /* size of field element */ - int gfeSize = BITS2WORD32_SIZE(feBitSize); - /* size of order */ - int ordSize = BITS2WORD32_SIZE(feBitSize+1); - - /* size of sscm buffer */ - int w = cpECCP_OptimalWinSize(feBitSize+1); - int nPrecomputed = 1<feBitSize +// +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pSize pointer to the size of internal ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPGetSize, (int feBitSize, int *pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr); + + { + int bn1Size; + int bn2Size; + int pointSize; + int mont1Size; + int mont2Size; + int primeSize; + int listSize; + + /* size of field element */ + int gfeSize = BITS2WORD32_SIZE(feBitSize); + /* size of order */ + int ordSize = BITS2WORD32_SIZE(feBitSize+1); + + /* size of sscm buffer */ + int w = cpECCP_OptimalWinSize(feBitSize+1); + int nPrecomputed = 1<feBitSize +// +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pECC pointer to the ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPInit, (int feBitSize, IppsECCPState* pECC)) +{ + /* test pECC pointer */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize || feBitSize>EC_GFP_MAXBITSIZE), ippStsSizeErr); + + /* clear context */ + PaddBlock(0, pECC, sizeof(IppsECCPState)); + + /* context ID */ + ECP_ID(pECC) = idCtxECCP; + + /* generic EC */ + ECP_TYPE(pECC) = IppECCArbitrary; + + /* size of field element & BP order */ + ECP_GFEBITS(pECC) = feBitSize; + ECP_ORDBITS(pECC) = feBitSize+1; + + /* + // init other context fields + */ + { + int bn1Size; + int bn2Size; + int pointSize; + int mont1Size; + int mont2Size; + int primeSize; + + /* size of field element */ + int gfeSize = BITS2WORD32_SIZE(feBitSize); + /* size of order */ + int ordSize = BITS2WORD32_SIZE(feBitSize+1); + + /* size of sscm buffer */ + int w = cpECCP_OptimalWinSize(feBitSize+1); + int nPrecomputed = 1< pP==pQ (maybe both pP and pQ are at Infinity) -// returns 1 => pP!=pQ -// -// Note -// In general we check: -// P_X*Q_Z^2 ~ Q_X*P_Z^2 -// P_Y*Q_Z^3 ~ Q_Y*P_Z^3 -*/ -int ECCP_ComparePoint(const IppsECCPPointState* pP, - const IppsECCPPointState* pQ, - const IppsECCPState* pECC, - BigNumNode* pList) -{ - /* P or/and Q at Infinity */ - if( ECCP_IsPointAtInfinity(pP) ) - return ECCP_IsPointAtInfinity(pQ)? 0:1; - if( ECCP_IsPointAtInfinity(pQ) ) - return ECCP_IsPointAtInfinity(pP)? 0:1; - - /* (P_Z==1) && (Q_Z==1) */ - if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) ) - return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1; - - { - IppsMontState* pMont = ECP_PMONT(pECC); - - IppsBigNumState* pPtmp = cpBigNumListGet(&pList); - IppsBigNumState* pQtmp = cpBigNumListGet(&pList); - IppsBigNumState* pPZ = cpBigNumListGet(&pList); - IppsBigNumState* pQZ = cpBigNumListGet(&pList); - - /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */ - if( !ECP_POINT_AFFINE(pQ) ) { - PMA_sqre(pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_X*Q_Z^2 */ - PMA_mule(pPtmp, ECP_POINT_X(pP), pQZ, pMont); - } - else { - PMA_set(pPtmp, ECP_POINT_X(pP)); - } - if( !ECP_POINT_AFFINE(pP) ) { - PMA_sqre(pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_X*P_Z^2 */ - PMA_mule(pQtmp, ECP_POINT_X(pQ), pPZ, pMont); - } - else { - PMA_set(pQtmp, ECP_POINT_X(pQ)); - } - if ( cpBN_cmp(pPtmp, pQtmp) ) - return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */ - - /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */ - if( !ECP_POINT_AFFINE(pQ) ) { - PMA_mule(pQZ, pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_Y*Q_Z^3 */ - PMA_mule(pPtmp, ECP_POINT_Y(pP), pQZ, pMont); - } - else { - PMA_set(pPtmp, ECP_POINT_Y(pP)); - } - if( !ECP_POINT_AFFINE(pP) ) { - PMA_mule(pPZ, pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_Y*P_Z^3 */ - PMA_mule(pQtmp, ECP_POINT_Y(pQ), pPZ, pMont); - } - else { - PMA_set(pQtmp, ECP_POINT_Y(pQ)); - } - return cpBN_cmp(pPtmp, pQtmp)? 1:0; - } -} - -/* -// ECCP_NegPoint -// -// Negative point -*/ -void ECCP_NegPoint(const IppsECCPPointState* pP, - IppsECCPPointState* pR, - const IppsECCPState* pECC) -{ - /* test point at Infinity */ - if( ECCP_IsPointAtInfinity(pP) ) - ECCP_SetPointToInfinity(pR); - - else { - IppsBigNumState* pModulo = ECP_PRIME(pECC); - - if( pP!=pR ) { - PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP)); - PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP)); - } - PMA_sub(ECP_POINT_Y(pR), pModulo, ECP_POINT_Y(pP), pModulo); - ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP); - } -} - -/* -// ECCP_DblPoint -// -// Double point -*/ -void ECCP_DblPoint(const IppsECCPPointState* pP, - IppsECCPPointState* pR, - const IppsECCPState* pECC, - BigNumNode* pList) -{ - /* P at infinity */ - if( ECCP_IsPointAtInfinity(pP) ) - ECCP_SetPointToInfinity(pR); - - else { - IppsMontState* pMont = ECP_PMONT(pECC); - - IppsBigNumState* bnV = cpBigNumListGet(&pList); - IppsBigNumState* bnU = cpBigNumListGet(&pList); - IppsBigNumState* bnM = cpBigNumListGet(&pList); - IppsBigNumState* bnS = cpBigNumListGet(&pList); - IppsBigNumState* bnT = cpBigNumListGet(&pList); - IppsBigNumState* pModulo = ECP_PRIME(pECC); - - /* M = 3*X^2 + A*Z^4 */ - if( ECP_POINT_AFFINE(pP) ) { - PMA_sqre(bnU, ECP_POINT_X(pP), pMont); - PMA_add(bnM, bnU, bnU, pModulo); - PMA_add(bnM, bnM, bnU, pModulo); - PMA_add(bnM, bnM, ECP_AENC(pECC), pModulo); - } - else if( ECP_AMI3(pECC) ) { - PMA_sqre(bnU, ECP_POINT_Z(pP), pMont); - PMA_add(bnS, ECP_POINT_X(pP), bnU, pModulo); - PMA_sub(bnT, ECP_POINT_X(pP), bnU, pModulo); - PMA_mule(bnM, bnS, bnT, pMont); - PMA_add(bnU, bnM, bnM, pModulo); - PMA_add(bnM, bnU, bnM, pModulo); - } - else { - PMA_sqre(bnU, ECP_POINT_X(pP), pMont); - PMA_add(bnM, bnU, bnU, pModulo); - PMA_add(bnM, bnM, bnU, pModulo); - PMA_sqre(bnU, ECP_POINT_Z(pP), pMont); - PMA_sqre(bnU, bnU, pMont); - PMA_mule(bnU, bnU, ECP_AENC(pECC), pMont); - PMA_add(bnM, bnM, bnU, pModulo); - } - - PMA_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP), pModulo); - - /* R_Z = 2*Y*Z */ - if( ECP_POINT_AFFINE(pP) ) { - PMA_set(ECP_POINT_Z(pR), bnV); - } - else { - PMA_mule(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP), pMont); - } - - /* S = 4*X*Y^2 */ - PMA_sqre(bnT, bnV, pMont); - PMA_mule(bnS, bnT, ECP_POINT_X(pP), pMont); - - /* R_X = M^2 - 2*S */ - PMA_sqre(bnU, bnM, pMont); - PMA_sub(bnU, bnU, bnS, pModulo); - PMA_sub(ECP_POINT_X(pR), bnU, bnS, pModulo); - - /* T = 8*Y^4 */ - PMA_mule(bnV, bnV, ECP_POINT_Y(pP), pMont); - PMA_mule(bnT, bnT, bnV, pMont); - - /* R_Y = M*(S - R_X) - T */ - PMA_sub(bnS, bnS, ECP_POINT_X(pR), pModulo); - PMA_mule(bnS, bnS, bnM, pMont); - PMA_sub(ECP_POINT_Y(pR), bnS, bnT, pModulo); - - ECP_POINT_AFFINE(pR) = 0; - } -} - -/* -// ECCP_AddPoint -// -// Add points -*/ -void ECCP_AddPoint(const IppsECCPPointState* pP, - const IppsECCPPointState* pQ, - IppsECCPPointState* pR, - const IppsECCPState* pECC, - BigNumNode* pList) -{ - /* prevent operation with point at Infinity */ - if( ECCP_IsPointAtInfinity(pP) ) { - ECCP_CopyPoint(pQ, pR); - return; - } - if( ECCP_IsPointAtInfinity(pQ) ) { - ECCP_CopyPoint(pP, pR); - return; - } - - /* - // addition - */ - { - IppsMontState* pMont = ECP_PMONT(pECC); - - IppsBigNumState* bnU0 = cpBigNumListGet(&pList); - IppsBigNumState* bnS0 = cpBigNumListGet(&pList); - IppsBigNumState* bnU1 = cpBigNumListGet(&pList); - IppsBigNumState* bnS1 = cpBigNumListGet(&pList); - IppsBigNumState* bnW = cpBigNumListGet(&pList); - IppsBigNumState* bnR = cpBigNumListGet(&pList); - IppsBigNumState *bnT = bnU0; - IppsBigNumState *bnM = bnS0; - IppsBigNumState* pModulo = ECP_PRIME(pECC); - - /* U0 = P_X * Q_Z^2 */ - /* S0 = P_Y * Q_Z^3 */ - if( ECP_POINT_AFFINE(pQ) ) { - PMA_set(bnU0, ECP_POINT_X(pP)); - PMA_set(bnS0, ECP_POINT_Y(pP)); - } - else { - PMA_sqre(bnW, ECP_POINT_Z(pQ), pMont); - PMA_mule(bnU0,ECP_POINT_X(pP), bnW, pMont); - PMA_mule(bnW, ECP_POINT_Z(pQ), bnW, pMont); - PMA_mule(bnS0,ECP_POINT_Y(pP), bnW, pMont); - } - - /* U1 = Q_X * P_Z^2 */ - /* S1 = Q_Y * P_Z^3 */ - if( ECP_POINT_AFFINE(pP) ) { - PMA_set(bnU1, ECP_POINT_X(pQ)); - PMA_set(bnS1, ECP_POINT_Y(pQ)); - } - else { - PMA_sqre(bnW, ECP_POINT_Z(pP), pMont); - PMA_mule(bnU1,ECP_POINT_X(pQ), bnW, pMont); - PMA_mule(bnW, ECP_POINT_Z(pP), bnW, pMont); - PMA_mule(bnS1,ECP_POINT_Y(pQ), bnW, pMont); - } - - /* W = U0-U1 */ - /* R = S0-S1 */ - PMA_sub(bnW, bnU0, bnU1, pModulo); - PMA_sub(bnR, bnS0, bnS1, pModulo); - - if( IsZero_BN(bnW) ) { - if( IsZero_BN(bnR) ) { - ECCP_DblPoint(pP, pR, pECC, pList); - return; - } - else { - ECCP_SetPointToInfinity(pR); - return; - } - } - - /* T = U0+U1 */ - /* M = S0+S1 */ - PMA_add(bnT, bnU0, bnU1, pModulo); - PMA_add(bnM, bnS0, bnS1, pModulo); - - /* R_Z = P_Z * Q_Z * W */ - if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) { - PMA_set(ECP_POINT_Z(pR), bnW); - } - else { - if( ECP_POINT_AFFINE(pQ) ) { - PMA_set(bnU1, ECP_POINT_Z(pP)); - } - else if( ECP_POINT_AFFINE(pP) ) { - PMA_set(bnU1, ECP_POINT_Z(pQ)); - } - else { - PMA_mule(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ), pMont); - } - PMA_mule(ECP_POINT_Z(pR), bnU1, bnW, pMont); - } - - PMA_sqre(bnU1, bnW, pMont); /* U1 = W^2 */ - PMA_mule(bnS1, bnT, bnU1, pMont); /* S1 = T * W^2 */ - - /* R_X = R^2 - T * W^2 */ - PMA_sqre(ECP_POINT_X(pR), bnR, pMont); - PMA_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1, pModulo); - - /* V = T * W^2 - 2 * R_X (S1) */ - PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo); - PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo); - - /* R_Y = (V * R - M * W^3) /2 */ - PMA_mule(ECP_POINT_Y(pR), bnS1, bnR, pMont); - PMA_mule(bnU1, bnU1, bnW, pMont); - PMA_mule(bnU1, bnU1, bnM, pMont); - PMA_sub(bnU1, ECP_POINT_Y(pR), bnU1, pModulo); - PMA_div2(ECP_POINT_Y(pR), bnU1, pModulo); - - ECP_POINT_AFFINE(pR) = 0; - } -} - -/* -// ECCP_MulPoint -// -// Multiply point by scalar -*/ -void ECCP_MulPoint(const IppsECCPPointState* pP, - const IppsBigNumState* bnN, - IppsECCPPointState* pR, - const IppsECCPState* pECC, - BigNumNode* pList) -{ - /* test zero scalar or input point at Infinity */ - if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) { - ECCP_SetPointToInfinity(pR); - return; - } - - /* - // scalar multiplication - */ - else { - Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC); - - BNU_CHUNK_T* pN = BN_NUMBER(bnN); - cpSize nsN = BN_SIZE(bnN); - /* scalar bitsize */ - int scalarBitSize = BITSIZE_BNU(pN, nsN); - /* optimal size of window */ - int w = cpECCP_OptimalWinSize(scalarBitSize); - /* number of table entries */ - int nPrecomputed = 1<>shift) & dmask; - - /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */ - cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed); - ECP_POINT_AFFINE(pR) = 0; - - /* initialize temporary T (ECP_PROJECTIVE) */ - ECP_POINT_AFFINE(&T) = 0; - - for(wPosition-=w; wPosition>=0; wPosition-=w) { - /* w times doubling */ - int k; - for(k=0; k>shift) & dmask; - - /* extract value from the pre-computed table */ - cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed); - - /* and add it */ - ECCP_AddPoint(pR, &T, pR, pECC, pList); - } - } - } -} - - -void ECCP_MulBasePoint(const IppsBigNumState* pK, - IppsECCPPointState* pR, - const IppsECCPState* pECC, - BigNumNode* pList) -{ - ECCP_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList); -} - -/* -// ECCP_ProdPoint -// -// Point product -*/ -void ECCP_ProdPoint(const IppsECCPPointState* pP, - const IppsBigNumState* bnPscalar, - const IppsECCPPointState* pQ, - const IppsBigNumState* bnQscalar, - IppsECCPPointState* pR, - const IppsECCPState* pECC, - BigNumNode* pList) -{ - IppsECCPPointState T; - IppsECCPPointState U; - - ECP_POINT_X(&T) = cpBigNumListGet(&pList); - ECP_POINT_Y(&T) = cpBigNumListGet(&pList); - ECP_POINT_Z(&T) = cpBigNumListGet(&pList); - - ECP_POINT_X(&U) = cpBigNumListGet(&pList); - ECP_POINT_Y(&U) = cpBigNumListGet(&pList); - ECP_POINT_Z(&U) = cpBigNumListGet(&pList); - - ECCP_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList); - ECCP_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList); - ECCP_AddPoint(&T, &U, pR, pECC, pList); -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" +#include "pcppma.h" +#include "pcpeccpsscm.h" + + +static +ECCP_METHOD ECCPcom = { + ECCP_SetPointProjective, + ECCP_SetPointAffine, + ECCP_GetPointAffine, + + ECCP_IsPointOnCurve, + + ECCP_ComparePoint, + ECCP_NegPoint, + ECCP_DblPoint, + ECCP_AddPoint, + ECCP_MulPoint, + ECCP_MulBasePoint, + ECCP_ProdPoint +}; + + +/* +// Returns reference +*/ +ECCP_METHOD* ECCPcom_Methods(void) +{ + return &ECCPcom; +} + + +/* +// Copy Point +*/ +void ECCP_CopyPoint(const IppsECCPPointState* pSrc, IppsECCPPointState* pDst) +{ + cpBN_copy(ECP_POINT_X(pDst), ECP_POINT_X(pSrc)); + cpBN_copy(ECP_POINT_Y(pDst), ECP_POINT_Y(pSrc)); + cpBN_copy(ECP_POINT_Z(pDst), ECP_POINT_Z(pSrc)); + ECP_POINT_AFFINE(pDst) = ECP_POINT_AFFINE(pSrc); +} + +/* +// ECCP_PoinSettProjective +// Converts regular projective triplet (pX,pY,pZ) into pPoint +// (see note above) +*/ +void ECCP_SetPointProjective(const IppsBigNumState* pX, + const IppsBigNumState* pY, + const IppsBigNumState* pZ, + IppsECCPPointState* pPoint, + const IppsECCPState* pECC) +{ + IppsMontState* pMont = ECP_PMONT(pECC); + + PMA_enc(ECP_POINT_X(pPoint), (IppsBigNumState*)pX, pMont); + PMA_enc(ECP_POINT_Y(pPoint), (IppsBigNumState*)pY, pMont); + PMA_enc(ECP_POINT_Z(pPoint), (IppsBigNumState*)pZ, pMont); + ECP_POINT_AFFINE(pPoint) = cpBN_cmp(pZ, BN_ONE_REF())==0; +} + +/* +// ECCP_PointAffineSet +// Converts regular affine pair (pX,pY) into pPoint +*/ +void ECCP_SetPointAffine(const IppsBigNumState* pX, + const IppsBigNumState* pY, + IppsECCPPointState* pPoint, + const IppsECCPState* pECC) +{ + IppsMontState* pMont = ECP_PMONT(pECC); + PMA_enc(ECP_POINT_X(pPoint), (IppsBigNumState*)pX, pMont); + PMA_enc(ECP_POINT_Y(pPoint), (IppsBigNumState*)pY, pMont); + PMA_enc(ECP_POINT_Z(pPoint), (IppsBigNumState*)cpBN_OneRef(), pMont); + ECP_POINT_AFFINE(pPoint) = 1; +} + +/* +// ECCP_GetPointAffine +// +// Converts pPoint into regular affine pair (pX,pY) +// +// Note: +// pPoint is not point at Infinity +// transform (X, Y, Z) into (x, y) = (X/Z^2, Y/Z^3) +*/ +void ECCP_GetPointAffine(IppsBigNumState* pX, IppsBigNumState* pY, + const IppsECCPPointState* pPoint, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + IppsMontState* pMont = ECP_PMONT(pECC); + + /* case Z == 1 */ + if( ECP_POINT_AFFINE(pPoint) ) { + if(pX) { + PMA_dec(pX, ECP_POINT_X(pPoint), pMont); + } + if(pY) { + PMA_dec(pY, ECP_POINT_Y(pPoint), pMont); + } + } + + /* case Z != 1 */ + else { + IppsBigNumState* pT = cpBigNumListGet(&pList); + IppsBigNumState* pU = cpBigNumListGet(&pList); + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + /* decode Z */ + PMA_dec(pU, ECP_POINT_Z(pPoint), pMont); + /* regular T = Z^-1 */ + PMA_inv(pT, pU, pModulo); + /* montgomery U = Z^-1 */ + PMA_enc(pU, pT, pMont); + /* regular T = Z^-2 */ + PMA_mule(pT, pU, pT, pMont); + + if(pX) { + PMA_mule(pX,pT, ECP_POINT_X(pPoint), pMont); + } + if(pY) { + /* regular U = Z^-3 */ + PMA_mule(pU, pU, pT, pMont); + PMA_mule(pY,pU, ECP_POINT_Y(pPoint), pMont); + } + } +} + +/* +// ECCP_SetPointToInfinity +// ECCP_SetPointToAffineInfinity0 +// ECCP_SetPointToAffineInfinity1 +// +// Set point to Infinity +*/ +void ECCP_SetPointToInfinity(IppsECCPPointState* pPoint) +{ + cpBN_zero(ECP_POINT_X(pPoint)); + cpBN_zero(ECP_POINT_Y(pPoint)); + cpBN_zero(ECP_POINT_Z(pPoint)); + ECP_POINT_AFFINE(pPoint) = 0; +} + +void ECCP_SetPointToAffineInfinity0(IppsBigNumState* pX, IppsBigNumState* pY) +{ + if(pX) cpBN_zero(pX); + if(pY) cpBN_zero(pY); +} + +void ECCP_SetPointToAffineInfinity1(IppsBigNumState* pX, IppsBigNumState* pY) +{ + if(pX) cpBN_zero(pX); + if(pY) BN_Word(pY,1); +} + +/* +// ECCP_IsPointAtInfinity +// ECCP_IsPointAtAffineInfinity0 +// ECCP_IsPointAtAffineInfinity1 +// +// Test point is at Infinity +*/ +int ECCP_IsPointAtInfinity(const IppsECCPPointState* pPoint) +{ + return IsZero_BN( ECP_POINT_Z(pPoint) ); +} + +int ECCP_IsPointAtAffineInfinity0(const IppsBigNumState* pX, const IppsBigNumState* pY) +{ + return IsZero_BN(pX) && IsZero_BN(pY); +} + +int ECCP_IsPointAtAffineInfinity1(const IppsBigNumState* pX, const IppsBigNumState* pY) +{ + return IsZero_BN(pX) && !IsZero_BN(pY); +} + +/* +// ECCP_IsPointOnCurve +// +// Test point is lie on curve +// +// Note +// We deal with equation: y^2 = x^3 + A*x + B. +// Or in projective coordinates: Y^2 = X^3 + a*X*Z^4 + b*Z^6. +// The point under test is given by projective triplet (X,Y,Z), +// which represents actually (x,y) = (X/Z^2,Y/Z^3). +*/ +int ECCP_IsPointOnCurve(const IppsECCPPointState* pPoint, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* let think Infinity point is on the curve */ + if( ECCP_IsPointAtInfinity(pPoint) ) + return 1; + + else { + IppsMontState* pMont = ECP_PMONT(pECC); + IppsBigNumState* pR = cpBigNumListGet(&pList); + IppsBigNumState* pT = cpBigNumListGet(&pList); + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + PMA_sqre(pR, ECP_POINT_X(pPoint), pMont); // R = X^3 + PMA_mule(pR, pR, ECP_POINT_X(pPoint), pMont); + + /* case Z != 1 */ + if( !ECP_POINT_AFFINE(pPoint) ) { + IppsBigNumState* pZ4 = cpBigNumListGet(&pList); + IppsBigNumState* pZ6 = cpBigNumListGet(&pList); + PMA_sqre(pT, ECP_POINT_Z(pPoint), pMont); // Z^2 + PMA_sqre(pZ4, pT, pMont); // Z^4 + PMA_mule(pZ6, pZ4, pT, pMont); // Z^6 + + PMA_mule(pT, pZ4, ECP_POINT_X(pPoint), pMont); // T = X*Z^4 + if( ECP_AMI3(pECC) ) { + IppsBigNumState* pU = cpBigNumListGet(&pList); + PMA_add(pU, pT, pT, pModulo); // R = X^3 +a*X*Z^4 + PMA_add(pU, pU, pT, pModulo); + PMA_sub(pR, pR, pU, pModulo); + } + else { + PMA_mule(pT, pT, ECP_AENC(pECC), pMont); // R = X^3 +a*X*Z^4 + PMA_add(pR, pR, pT, pModulo); + } + PMA_mule(pT, pZ6, ECP_BENC(pECC), pMont); // R = X^3 +a*X*Z^4 + b*Z^6 + PMA_add(pR, pR, pT, pModulo); + + } + /* case Z == 1 */ + else { + if( ECP_AMI3(pECC) ) { + PMA_add(pT, ECP_POINT_X(pPoint), ECP_POINT_X(pPoint), pModulo); // R = X^3 +a*X + PMA_add(pT, pT, ECP_POINT_X(pPoint), pModulo); + PMA_sub(pR, pR, pT, pModulo); + } + else { + PMA_mule(pT, ECP_POINT_X(pPoint), ECP_AENC(pECC), pMont); // R = X^3 +a*X + PMA_add(pR, pR, pT, pModulo); + } + PMA_add(pR, pR, ECP_BENC(pECC), pModulo); // R = X^3 +a*X + b + } + PMA_sqre(pT, ECP_POINT_Y(pPoint), pMont); // T = Y^2 + return 0==cpBN_cmp(pR, pT); + } +} + +/* +// ECCP_ComparePoint +// +// Compare two points: +// returns 0 => pP==pQ (maybe both pP and pQ are at Infinity) +// returns 1 => pP!=pQ +// +// Note +// In general we check: +// P_X*Q_Z^2 ~ Q_X*P_Z^2 +// P_Y*Q_Z^3 ~ Q_Y*P_Z^3 +*/ +int ECCP_ComparePoint(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* P or/and Q at Infinity */ + if( ECCP_IsPointAtInfinity(pP) ) + return ECCP_IsPointAtInfinity(pQ)? 0:1; + if( ECCP_IsPointAtInfinity(pQ) ) + return ECCP_IsPointAtInfinity(pP)? 0:1; + + /* (P_Z==1) && (Q_Z==1) */ + if( ECP_POINT_AFFINE(pP) && ECP_POINT_AFFINE(pQ) ) + return ((0==cpBN_cmp(ECP_POINT_X(pP),ECP_POINT_X(pQ))) && (0==cpBN_cmp(ECP_POINT_Y(pP),ECP_POINT_Y(pQ))))? 0:1; + + { + IppsMontState* pMont = ECP_PMONT(pECC); + + IppsBigNumState* pPtmp = cpBigNumListGet(&pList); + IppsBigNumState* pQtmp = cpBigNumListGet(&pList); + IppsBigNumState* pPZ = cpBigNumListGet(&pList); + IppsBigNumState* pQZ = cpBigNumListGet(&pList); + + /* P_X*Q_Z^2 ~ Q_X*P_Z^2 */ + if( !ECP_POINT_AFFINE(pQ) ) { + PMA_sqre(pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_X*Q_Z^2 */ + PMA_mule(pPtmp, ECP_POINT_X(pP), pQZ, pMont); + } + else { + PMA_set(pPtmp, ECP_POINT_X(pP)); + } + if( !ECP_POINT_AFFINE(pP) ) { + PMA_sqre(pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_X*P_Z^2 */ + PMA_mule(pQtmp, ECP_POINT_X(pQ), pPZ, pMont); + } + else { + PMA_set(pQtmp, ECP_POINT_X(pQ)); + } + if ( cpBN_cmp(pPtmp, pQtmp) ) + return 1; /* points are different: (P_X*Q_Z^2) != (Q_X*P_Z^2) */ + + /* P_Y*Q_Z^3 ~ Q_Y*P_Z^3 */ + if( !ECP_POINT_AFFINE(pQ) ) { + PMA_mule(pQZ, pQZ, ECP_POINT_Z(pQ), pMont); /* Ptmp = P_Y*Q_Z^3 */ + PMA_mule(pPtmp, ECP_POINT_Y(pP), pQZ, pMont); + } + else { + PMA_set(pPtmp, ECP_POINT_Y(pP)); + } + if( !ECP_POINT_AFFINE(pP) ) { + PMA_mule(pPZ, pPZ, ECP_POINT_Z(pP), pMont); /* Qtmp = Q_Y*P_Z^3 */ + PMA_mule(pQtmp, ECP_POINT_Y(pQ), pPZ, pMont); + } + else { + PMA_set(pQtmp, ECP_POINT_Y(pQ)); + } + return cpBN_cmp(pPtmp, pQtmp)? 1:0; + } +} + +/* +// ECCP_NegPoint +// +// Negative point +*/ +void ECCP_NegPoint(const IppsECCPPointState* pP, + IppsECCPPointState* pR, + const IppsECCPState* pECC) +{ + /* test point at Infinity */ + if( ECCP_IsPointAtInfinity(pP) ) + ECCP_SetPointToInfinity(pR); + + else { + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + if( pP!=pR ) { + PMA_set(ECP_POINT_X(pR), ECP_POINT_X(pP)); + PMA_set(ECP_POINT_Z(pR), ECP_POINT_Z(pP)); + } + PMA_sub(ECP_POINT_Y(pR), pModulo, ECP_POINT_Y(pP), pModulo); + ECP_POINT_AFFINE(pR) = ECP_POINT_AFFINE(pP); + } +} + +/* +// ECCP_DblPoint +// +// Double point +*/ +void ECCP_DblPoint(const IppsECCPPointState* pP, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* P at infinity */ + if( ECCP_IsPointAtInfinity(pP) ) + ECCP_SetPointToInfinity(pR); + + else { + IppsMontState* pMont = ECP_PMONT(pECC); + + IppsBigNumState* bnV = cpBigNumListGet(&pList); + IppsBigNumState* bnU = cpBigNumListGet(&pList); + IppsBigNumState* bnM = cpBigNumListGet(&pList); + IppsBigNumState* bnS = cpBigNumListGet(&pList); + IppsBigNumState* bnT = cpBigNumListGet(&pList); + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + /* M = 3*X^2 + A*Z^4 */ + if( ECP_POINT_AFFINE(pP) ) { + PMA_sqre(bnU, ECP_POINT_X(pP), pMont); + PMA_add(bnM, bnU, bnU, pModulo); + PMA_add(bnM, bnM, bnU, pModulo); + PMA_add(bnM, bnM, ECP_AENC(pECC), pModulo); + } + else if( ECP_AMI3(pECC) ) { + PMA_sqre(bnU, ECP_POINT_Z(pP), pMont); + PMA_add(bnS, ECP_POINT_X(pP), bnU, pModulo); + PMA_sub(bnT, ECP_POINT_X(pP), bnU, pModulo); + PMA_mule(bnM, bnS, bnT, pMont); + PMA_add(bnU, bnM, bnM, pModulo); + PMA_add(bnM, bnU, bnM, pModulo); + } + else { + PMA_sqre(bnU, ECP_POINT_X(pP), pMont); + PMA_add(bnM, bnU, bnU, pModulo); + PMA_add(bnM, bnM, bnU, pModulo); + PMA_sqre(bnU, ECP_POINT_Z(pP), pMont); + PMA_sqre(bnU, bnU, pMont); + PMA_mule(bnU, bnU, ECP_AENC(pECC), pMont); + PMA_add(bnM, bnM, bnU, pModulo); + } + + PMA_add(bnV, ECP_POINT_Y(pP), ECP_POINT_Y(pP), pModulo); + + /* R_Z = 2*Y*Z */ + if( ECP_POINT_AFFINE(pP) ) { + PMA_set(ECP_POINT_Z(pR), bnV); + } + else { + PMA_mule(ECP_POINT_Z(pR), bnV, ECP_POINT_Z(pP), pMont); + } + + /* S = 4*X*Y^2 */ + PMA_sqre(bnT, bnV, pMont); + PMA_mule(bnS, bnT, ECP_POINT_X(pP), pMont); + + /* R_X = M^2 - 2*S */ + PMA_sqre(bnU, bnM, pMont); + PMA_sub(bnU, bnU, bnS, pModulo); + PMA_sub(ECP_POINT_X(pR), bnU, bnS, pModulo); + + /* T = 8*Y^4 */ + PMA_mule(bnV, bnV, ECP_POINT_Y(pP), pMont); + PMA_mule(bnT, bnT, bnV, pMont); + + /* R_Y = M*(S - R_X) - T */ + PMA_sub(bnS, bnS, ECP_POINT_X(pR), pModulo); + PMA_mule(bnS, bnS, bnM, pMont); + PMA_sub(ECP_POINT_Y(pR), bnS, bnT, pModulo); + + ECP_POINT_AFFINE(pR) = 0; + } +} + +/* +// ECCP_AddPoint +// +// Add points +*/ +void ECCP_AddPoint(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* prevent operation with point at Infinity */ + if( ECCP_IsPointAtInfinity(pP) ) { + ECCP_CopyPoint(pQ, pR); + return; + } + if( ECCP_IsPointAtInfinity(pQ) ) { + ECCP_CopyPoint(pP, pR); + return; + } + + /* + // addition + */ + { + IppsMontState* pMont = ECP_PMONT(pECC); + + IppsBigNumState* bnU0 = cpBigNumListGet(&pList); + IppsBigNumState* bnS0 = cpBigNumListGet(&pList); + IppsBigNumState* bnU1 = cpBigNumListGet(&pList); + IppsBigNumState* bnS1 = cpBigNumListGet(&pList); + IppsBigNumState* bnW = cpBigNumListGet(&pList); + IppsBigNumState* bnR = cpBigNumListGet(&pList); + IppsBigNumState *bnT = bnU0; + IppsBigNumState *bnM = bnS0; + IppsBigNumState* pModulo = ECP_PRIME(pECC); + + /* U0 = P_X * Q_Z^2 */ + /* S0 = P_Y * Q_Z^3 */ + if( ECP_POINT_AFFINE(pQ) ) { + PMA_set(bnU0, ECP_POINT_X(pP)); + PMA_set(bnS0, ECP_POINT_Y(pP)); + } + else { + PMA_sqre(bnW, ECP_POINT_Z(pQ), pMont); + PMA_mule(bnU0,ECP_POINT_X(pP), bnW, pMont); + PMA_mule(bnW, ECP_POINT_Z(pQ), bnW, pMont); + PMA_mule(bnS0,ECP_POINT_Y(pP), bnW, pMont); + } + + /* U1 = Q_X * P_Z^2 */ + /* S1 = Q_Y * P_Z^3 */ + if( ECP_POINT_AFFINE(pP) ) { + PMA_set(bnU1, ECP_POINT_X(pQ)); + PMA_set(bnS1, ECP_POINT_Y(pQ)); + } + else { + PMA_sqre(bnW, ECP_POINT_Z(pP), pMont); + PMA_mule(bnU1,ECP_POINT_X(pQ), bnW, pMont); + PMA_mule(bnW, ECP_POINT_Z(pP), bnW, pMont); + PMA_mule(bnS1,ECP_POINT_Y(pQ), bnW, pMont); + } + + /* W = U0-U1 */ + /* R = S0-S1 */ + PMA_sub(bnW, bnU0, bnU1, pModulo); + PMA_sub(bnR, bnS0, bnS1, pModulo); + + if( IsZero_BN(bnW) ) { + if( IsZero_BN(bnR) ) { + ECCP_DblPoint(pP, pR, pECC, pList); + return; + } + else { + ECCP_SetPointToInfinity(pR); + return; + } + } + + /* T = U0+U1 */ + /* M = S0+S1 */ + PMA_add(bnT, bnU0, bnU1, pModulo); + PMA_add(bnM, bnS0, bnS1, pModulo); + + /* R_Z = P_Z * Q_Z * W */ + if( ECP_POINT_AFFINE(pQ) && ECP_POINT_AFFINE(pP) ) { + PMA_set(ECP_POINT_Z(pR), bnW); + } + else { + if( ECP_POINT_AFFINE(pQ) ) { + PMA_set(bnU1, ECP_POINT_Z(pP)); + } + else if( ECP_POINT_AFFINE(pP) ) { + PMA_set(bnU1, ECP_POINT_Z(pQ)); + } + else { + PMA_mule(bnU1, ECP_POINT_Z(pP), ECP_POINT_Z(pQ), pMont); + } + PMA_mule(ECP_POINT_Z(pR), bnU1, bnW, pMont); + } + + PMA_sqre(bnU1, bnW, pMont); /* U1 = W^2 */ + PMA_mule(bnS1, bnT, bnU1, pMont); /* S1 = T * W^2 */ + + /* R_X = R^2 - T * W^2 */ + PMA_sqre(ECP_POINT_X(pR), bnR, pMont); + PMA_sub(ECP_POINT_X(pR), ECP_POINT_X(pR), bnS1, pModulo); + + /* V = T * W^2 - 2 * R_X (S1) */ + PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo); + PMA_sub(bnS1, bnS1, ECP_POINT_X(pR), pModulo); + + /* R_Y = (V * R - M * W^3) /2 */ + PMA_mule(ECP_POINT_Y(pR), bnS1, bnR, pMont); + PMA_mule(bnU1, bnU1, bnW, pMont); + PMA_mule(bnU1, bnU1, bnM, pMont); + PMA_sub(bnU1, ECP_POINT_Y(pR), bnU1, pModulo); + PMA_div2(ECP_POINT_Y(pR), bnU1, pModulo); + + ECP_POINT_AFFINE(pR) = 0; + } +} + +/* +// ECCP_MulPoint +// +// Multiply point by scalar +*/ +void ECCP_MulPoint(const IppsECCPPointState* pP, + const IppsBigNumState* bnN, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + /* test zero scalar or input point at Infinity */ + if( IsZero_BN(bnN) || ECCP_IsPointAtInfinity(pP) ) { + ECCP_SetPointToInfinity(pR); + return; + } + + /* + // scalar multiplication + */ + else { + Ipp8u* pScratchAligned = ECP_SCCMBUFF(pECC); + + BNU_CHUNK_T* pN = BN_NUMBER(bnN); + cpSize nsN = BN_SIZE(bnN); + /* scalar bitsize */ + int scalarBitSize = BITSIZE_BNU(pN, nsN); + /* optimal size of window */ + int w = cpECCP_OptimalWinSize(scalarBitSize); + /* number of table entries */ + int nPrecomputed = 1<>shift) & dmask; + + /* initialize result (ECP_FINITE_POINT|ECP_PROJECTIVE) */ + cpECCP_ScrambleGet(pR, coordSize, pScratchAligned+windowVal, nPrecomputed); + ECP_POINT_AFFINE(pR) = 0; + + /* initialize temporary T (ECP_PROJECTIVE) */ + ECP_POINT_AFFINE(&T) = 0; + + for(wPosition-=w; wPosition>=0; wPosition-=w) { + /* w times doubling */ + int k; + for(k=0; k>shift) & dmask; + + /* extract value from the pre-computed table */ + cpECCP_ScrambleGet(&T, coordSize, pScratchAligned+windowVal, nPrecomputed); + + /* and add it */ + ECCP_AddPoint(pR, &T, pR, pECC, pList); + } + } + } +} + + +void ECCP_MulBasePoint(const IppsBigNumState* pK, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + ECCP_MulPoint(ECP_GENC(pECC), pK, pR, pECC, pList); +} + +/* +// ECCP_ProdPoint +// +// Point product +*/ +void ECCP_ProdPoint(const IppsECCPPointState* pP, + const IppsBigNumState* bnPscalar, + const IppsECCPPointState* pQ, + const IppsBigNumState* bnQscalar, + IppsECCPPointState* pR, + const IppsECCPState* pECC, + BigNumNode* pList) +{ + IppsECCPPointState T; + IppsECCPPointState U; + + ECP_POINT_X(&T) = cpBigNumListGet(&pList); + ECP_POINT_Y(&T) = cpBigNumListGet(&pList); + ECP_POINT_Z(&T) = cpBigNumListGet(&pList); + + ECP_POINT_X(&U) = cpBigNumListGet(&pList); + ECP_POINT_Y(&U) = cpBigNumListGet(&pList); + ECP_POINT_Z(&U) = cpBigNumListGet(&pList); + + ECCP_MulPoint(pP, bnPscalar, &T, (IppsECCPState*)pECC, pList); + ECCP_MulPoint(pQ, bnQscalar, &U, (IppsECCPState*)pECC, pList); + ECCP_AddPoint(&T, &U, pR, pECC, pList); +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppoint.h b/external/crypto_px/sources/ippcp/src/pcpeccppoint.h index 62c2cadc84..a72b0ea1ef 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccppoint.h +++ b/external/crypto_px/sources/ippcp/src/pcpeccppoint.h @@ -1,60 +1,60 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_ECCPPOINT_H) -#define _PCP_ECCPPOINT_H - -#include "pcpeccp.h" - - -/* -// EC Point context -*/ -struct _cpECCPPoint { - IppCtxId idCtx; /* EC Point identifier */ - - IppsBigNumState* pX; /* projective X */ - IppsBigNumState* pY; /* Y */ - IppsBigNumState* pZ; /* Z coordinates */ - int affine; /* impotrant case Z=1 */ -}; - -/* -// Contetx Access Macros -*/ -#define ECP_POINT_ID(ctx) ((ctx)->idCtx) -#define ECP_POINT_X(ctx) ((ctx)->pX) -#define ECP_POINT_Y(ctx) ((ctx)->pY) -#define ECP_POINT_Z(ctx) ((ctx)->pZ) -#define ECP_POINT_AFFINE(ctx) ((ctx)->affine) -#define ECP_POINT_VALID_ID(ctx) (ECP_POINT_ID((ctx))==idCtxECCPPoint) - -#endif /* _PCP_ECCPPOINT_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_ECCPPOINT_H) +#define _PCP_ECCPPOINT_H + +#include "pcpeccp.h" + + +/* +// EC Point context +*/ +struct _cpECCPPoint { + IppCtxId idCtx; /* EC Point identifier */ + + IppsBigNumState* pX; /* projective X */ + IppsBigNumState* pY; /* Y */ + IppsBigNumState* pZ; /* Z coordinates */ + int affine; /* impotrant case Z=1 */ +}; + +/* +// Contetx Access Macros +*/ +#define ECP_POINT_ID(ctx) ((ctx)->idCtx) +#define ECP_POINT_X(ctx) ((ctx)->pX) +#define ECP_POINT_Y(ctx) ((ctx)->pY) +#define ECP_POINT_Z(ctx) ((ctx)->pZ) +#define ECP_POINT_AFFINE(ctx) ((ctx)->affine) +#define ECP_POINT_VALID_ID(ctx) (ECP_POINT_ID((ctx))==idCtxECCPPoint) + +#endif /* _PCP_ECCPPOINT_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppointca.c b/external/crypto_px/sources/ippcp/src/pcpeccppointca.c index edd94e5452..04dd7ca4a7 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccppointca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccppointca.c @@ -1,128 +1,128 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccppoint.h" - - -/*F* -// Name: ippsECCPPointGetSize -// -// Purpose: Returns size of EC Point context (bytes). -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSzie -// ippStsSizeErr 2>feBitSize -// ippStsNoErr no errors -// -// Parameters: -// feBitSize size of field element (bits) -// pSize pointer to the size of EC Point context -// -*F*/ -IPPFUN(IppStatus, ippsECCPPointGetSize, (int feBitSize, int* pSize)) -{ - /* test size's pointer */ - IPP_BAD_PTR1_RET(pSize); - - /* test size of field element */ - IPP_BADARG_RET((2>feBitSize), ippStsSizeErr); - - { - int bnSize; - ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize); - *pSize = sizeof(IppsECCPPointState) - + bnSize /* X coodinate */ - + bnSize /* Y coodinate */ - + bnSize /* Z coodinate */ - +(ALIGN_VAL-1); - } - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPPointInit -// -// Purpose: Init EC Point context. -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pPoint -// ippStsSizeErr 2>feBitSize -// ippStsNoErr no errors -// -// Parameters: -// feBitSize size of field element (bits) -// pECC pointer to ECC context -// -*F*/ -IPPFUN(IppStatus, ippsECCPPointInit, (int feBitSize, IppsECCPPointState* pPoint)) -{ - /* test pEC pointer */ - IPP_BAD_PTR1_RET(pPoint); - - /* use aligned context */ - pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); - - /* test size of field element */ - IPP_BADARG_RET((2>feBitSize), ippStsSizeErr); - - /* context ID */ - ECP_POINT_ID(pPoint) = idCtxECCPPoint; - - /* meaning: point was not set */ - ECP_POINT_AFFINE(pPoint) =-1; - - /* - // init other context fields - */ - { - Ipp8u* ptr = (Ipp8u*)pPoint; - int bnLen = BITS2WORD32_SIZE(feBitSize); - int bnSize; - ippsBigNumGetSize(bnLen, &bnSize); - - /* allocate coordinate buffers */ - ptr += sizeof(IppsECCPPointState); - ECP_POINT_X(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); - ptr += bnSize; - ECP_POINT_Y(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); - ptr += bnSize; - ECP_POINT_Z(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); - - /* init coordinate buffers */ - ippsBigNumInit(bnLen, ECP_POINT_X(pPoint)); - ippsBigNumInit(bnLen, ECP_POINT_Y(pPoint)); - ippsBigNumInit(bnLen, ECP_POINT_Z(pPoint)); - } - return ippStsNoErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" + + +/*F* +// Name: ippsECCPPointGetSize +// +// Purpose: Returns size of EC Point context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSzie +// ippStsSizeErr 2>feBitSize +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pSize pointer to the size of EC Point context +// +*F*/ +IPPFUN(IppStatus, ippsECCPPointGetSize, (int feBitSize, int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize), ippStsSizeErr); + + { + int bnSize; + ippsBigNumGetSize(BITS2WORD32_SIZE(feBitSize), &bnSize); + *pSize = sizeof(IppsECCPPointState) + + bnSize /* X coodinate */ + + bnSize /* Y coodinate */ + + bnSize /* Z coodinate */ + +(ALIGN_VAL-1); + } + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPPointInit +// +// Purpose: Init EC Point context. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pPoint +// ippStsSizeErr 2>feBitSize +// ippStsNoErr no errors +// +// Parameters: +// feBitSize size of field element (bits) +// pECC pointer to ECC context +// +*F*/ +IPPFUN(IppStatus, ippsECCPPointInit, (int feBitSize, IppsECCPPointState* pPoint)) +{ + /* test pEC pointer */ + IPP_BAD_PTR1_RET(pPoint); + + /* use aligned context */ + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + + /* test size of field element */ + IPP_BADARG_RET((2>feBitSize), ippStsSizeErr); + + /* context ID */ + ECP_POINT_ID(pPoint) = idCtxECCPPoint; + + /* meaning: point was not set */ + ECP_POINT_AFFINE(pPoint) =-1; + + /* + // init other context fields + */ + { + Ipp8u* ptr = (Ipp8u*)pPoint; + int bnLen = BITS2WORD32_SIZE(feBitSize); + int bnSize; + ippsBigNumGetSize(bnLen, &bnSize); + + /* allocate coordinate buffers */ + ptr += sizeof(IppsECCPPointState); + ECP_POINT_X(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); + ptr += bnSize; + ECP_POINT_Y(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); + ptr += bnSize; + ECP_POINT_Z(pPoint) = (IppsBigNumState*)( IPP_ALIGNED_PTR(ptr,ALIGN_VAL) ); + + /* init coordinate buffers */ + ippsBigNumInit(bnLen, ECP_POINT_X(pPoint)); + ippsBigNumInit(bnLen, ECP_POINT_Y(pPoint)); + ippsBigNumInit(bnLen, ECP_POINT_Z(pPoint)); + } + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c b/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c index 26c0fc71bf..df81d08f93 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccppointopca.c @@ -1,476 +1,476 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccppoint.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" - - -/*F* -// Name: ippsECCPSetPoint -// -// Purpose: Converts regular affine coordinates EC point (pX,pY) -// into internal presentation - montgomery projective. -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPoint -// NULL == pX -// NULL == pY -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pX->idCtx -// illegal pY->idCtx -// illegal pPoint->idCtx -// -// ippStsOutOfECErr point out-of EC -// -// ippStsNoErr no errors -// -// Parameters: -// pX pointer to the regular affine coordinate X -// pY pointer to the regular affine coordinate Y -// pPoint pointer to the EC Point context -// pECC pointer to the ECCP context -// -// Note: -// if B==0 and (x,y)=(0,y) then point at Infinity will be set up -// if B!=0 and (x,y)=(0,0) then point at Infinity will be set up -// else point with requested coordinates (x,y) wil be set up -// There are no check validation inside! -// -*F*/ -IPPFUN(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, - const IppsBigNumState* pY, - IppsECCPPointState* pPoint, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test pX and pY */ - IPP_BAD_PTR2_RET(pX,pY); - pX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pX, ALIGN_VAL) ); - pY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pY, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr); - - /* test pPoint */ - IPP_BAD_PTR1_RET(pPoint); - pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); - - /* set affine coordinates at Infinity */ - if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(pX,pY)) || - (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(pX,pY)) ) - ECCP_SetPointToInfinity(pPoint); - /* set point */ - else { - ECP_METHOD(pECC)->SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC); - } - - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPSetPointAtInfinity -// -// Purpose: Set point at Infinity -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPoint -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pPoint->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pPoint pointer to the EC Point context -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test pPoint */ - IPP_BAD_PTR1_RET(pPoint); - pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); - - ECCP_SetPointToInfinity(pPoint); - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPGetPoint -// -// Purpose: Converts internal presentation EC point - montgomery projective -// into regular affine coordinates EC point (pX,pY) -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPoint -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pPoint->idCtx -// NULL != pX, illegal pX->idCtx -// NULL != pY, illegal pY->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pX pointer to the regular affine coordinate X -// pY pointer to the regular affine coordinate Y -// pLength pointer to the length of coordinates -// pPoint pointer to the EC Point context -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, - IppsBigNumState* pY, - const IppsECCPPointState* pPoint, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test source point */ - IPP_BAD_PTR1_RET(pPoint); - pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); - - /* test pX and pY */ - if(pX) { - pX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pX, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr); - } - if(pY) { - pY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pY, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr); - } - - if( ECCP_IsPointAtInfinity(pPoint) ) { - if( IsZero_BN(ECP_BENC(pECC)) ) - ECCP_SetPointToAffineInfinity1(pX, pY); - else - ECCP_SetPointToAffineInfinity0(pX, pY); - } - else - ECP_METHOD(pECC)->GetPointAffine(pX, pY, pPoint, pECC, ECP_BNCTX(pECC)); - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPCheckPoint -// -// Purpose: Check EC point: -// - is point lie on EC -// - is point at infinity -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pP -// NULL == pResult -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pP->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pPoint pointer to the EC Point context -// pECC pointer to the ECCP context -// pResult pointer to the result: -// ippECValid -// ippECPointIsNotValid -// ippECPointIsAtInfinite -// -*F*/ -IPPFUN(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP, - IppECResult* pResult, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test point */ - IPP_BAD_PTR1_RET(pP); - pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); - - /* test pResult */ - IPP_BAD_PTR1_RET(pResult); - - if( ECCP_IsPointAtInfinity(pP) ) - *pResult = ippECPointIsAtInfinite; - else if( ECP_METHOD(pECC)->IsPointOnCurve(pP, pECC, ECP_BNCTX(pECC)) ) - *pResult = ippECValid; - else - *pResult = ippECPointIsNotValid; - - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPComparePoint -// -// Purpose: Compare two EC points -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pP -// NULL == pQ -// NULL == pResult -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pP->idCtx -// illegal pQ->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pP pointer to the EC Point context -// pQ pointer to the EC Point context -// pECC pointer to the ECCP context -// pResult pointer to the result: -// ippECPointIsEqual -// ippECPointIsNotEqual -// -*F*/ -IPPFUN(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, - const IppsECCPPointState* pQ, - IppECResult* pResult, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test points */ - IPP_BAD_PTR2_RET(pP,pQ); - pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); - pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr); - - /* test pResult */ - IPP_BAD_PTR1_RET(pResult); - - *pResult = ECP_METHOD(pECC)->ComparePoint(pP, pQ, pECC, ECP_BNCTX(pECC))? ippECPointIsNotEqual : ippECPointIsEqual; - - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPNegativePoint -// -// Purpose: Perforn EC point operation: R = -P -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pP -// NULL == pR -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pP->idCtx -// illegal pR->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pP pointer to the source EC Point context -// pR pointer to the resultant EC Point context -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPNegativePoint, (const IppsECCPPointState* pP, - IppsECCPPointState* pR, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test points */ - IPP_BAD_PTR2_RET(pP,pR); - pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); - pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); - - ECP_METHOD(pECC)->NegPoint(pP, pR, pECC); - - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPAddPoint -// -// Purpose: Perforn EC point operation: R = P+Q -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pP -// NULL == pQ -// NULL == pR -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pP->idCtx -// illegal pQ->idCtx -// illegal pR->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pP pointer to the source EC Point context -// pQ pointer to the source EC Point context -// pR pointer to the resultant EC Point context -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, - const IppsECCPPointState* pQ, - IppsECCPPointState* pR, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test points */ - IPP_BAD_PTR3_RET(pP,pQ,pR); - pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); - pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) ); - pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); - - if(pP==pQ) - ECP_METHOD(pECC)->DblPoint(pP, pR, pECC, ECP_BNCTX(pECC)); - else - ECP_METHOD(pECC)->AddPoint(pP, pQ, pR, pECC, ECP_BNCTX(pECC)); - - return ippStsNoErr; -} - - -/*F* -// Name: ippsECCPMulPointScalar -// -// Purpose: Perforn EC point operation: R = k*P -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pP -// NULL == pK -// NULL == pR -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pP->idCtx -// illegal pK->idCtx -// illegal pR->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pP pointer to the source EC Point context -// pK pointer to the source BigNum multiplier context -// pR pointer to the resultant EC Point context -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, - const IppsBigNumState* pK, - IppsECCPPointState* pR, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test points */ - IPP_BAD_PTR2_RET(pP,pR); - pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); - pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); - - /* test scalar */ - IPP_BAD_PTR1_RET(pK); - pK = (IppsBigNumState*)( IPP_ALIGNED_PTR(pK, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pK), ippStsContextMatchErr); - - ECP_METHOD(pECC)->MulPoint(pP, pK, pR, pECC, ECP_BNCTX(pECC)); - - return ippStsNoErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSetPoint +// +// Purpose: Converts regular affine coordinates EC point (pX,pY) +// into internal presentation - montgomery projective. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPoint +// NULL == pX +// NULL == pY +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pX->idCtx +// illegal pY->idCtx +// illegal pPoint->idCtx +// +// ippStsOutOfECErr point out-of EC +// +// ippStsNoErr no errors +// +// Parameters: +// pX pointer to the regular affine coordinate X +// pY pointer to the regular affine coordinate Y +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// +// Note: +// if B==0 and (x,y)=(0,y) then point at Infinity will be set up +// if B!=0 and (x,y)=(0,0) then point at Infinity will be set up +// else point with requested coordinates (x,y) wil be set up +// There are no check validation inside! +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetPoint,(const IppsBigNumState* pX, + const IppsBigNumState* pY, + IppsECCPPointState* pPoint, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test pX and pY */ + IPP_BAD_PTR2_RET(pX,pY); + pX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pX, ALIGN_VAL) ); + pY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr); + + /* test pPoint */ + IPP_BAD_PTR1_RET(pPoint); + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); + + /* set affine coordinates at Infinity */ + if( ( IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity1(pX,pY)) || + (!IsZero_BN(ECP_BENC(pECC)) && ECCP_IsPointAtAffineInfinity0(pX,pY)) ) + ECCP_SetPointToInfinity(pPoint); + /* set point */ + else { + ECP_METHOD(pECC)->SetPointProjective(pX, pY, BN_ONE_REF(), pPoint, pECC); + } + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPSetPointAtInfinity +// +// Purpose: Set point at Infinity +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPoint +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPoint->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetPointAtInfinity,(IppsECCPPointState* pPoint, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test pPoint */ + IPP_BAD_PTR1_RET(pPoint); + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); + + ECCP_SetPointToInfinity(pPoint); + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPGetPoint +// +// Purpose: Converts internal presentation EC point - montgomery projective +// into regular affine coordinates EC point (pX,pY) +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPoint +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPoint->idCtx +// NULL != pX, illegal pX->idCtx +// NULL != pY, illegal pY->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pX pointer to the regular affine coordinate X +// pY pointer to the regular affine coordinate Y +// pLength pointer to the length of coordinates +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPGetPoint,(IppsBigNumState* pX, + IppsBigNumState* pY, + const IppsECCPPointState* pPoint, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test source point */ + IPP_BAD_PTR1_RET(pPoint); + pPoint = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPoint, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPoint), ippStsContextMatchErr); + + /* test pX and pY */ + if(pX) { + pX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pX, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pX), ippStsContextMatchErr); + } + if(pY) { + pY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pY), ippStsContextMatchErr); + } + + if( ECCP_IsPointAtInfinity(pPoint) ) { + if( IsZero_BN(ECP_BENC(pECC)) ) + ECCP_SetPointToAffineInfinity1(pX, pY); + else + ECCP_SetPointToAffineInfinity0(pX, pY); + } + else + ECP_METHOD(pECC)->GetPointAffine(pX, pY, pPoint, pECC, ECP_BNCTX(pECC)); + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPCheckPoint +// +// Purpose: Check EC point: +// - is point lie on EC +// - is point at infinity +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pResult +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPoint pointer to the EC Point context +// pECC pointer to the ECCP context +// pResult pointer to the result: +// ippECValid +// ippECPointIsNotValid +// ippECPointIsAtInfinite +// +*F*/ +IPPFUN(IppStatus, ippsECCPCheckPoint,(const IppsECCPPointState* pP, + IppECResult* pResult, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test point */ + IPP_BAD_PTR1_RET(pP); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + + /* test pResult */ + IPP_BAD_PTR1_RET(pResult); + + if( ECCP_IsPointAtInfinity(pP) ) + *pResult = ippECPointIsAtInfinite; + else if( ECP_METHOD(pECC)->IsPointOnCurve(pP, pECC, ECP_BNCTX(pECC)) ) + *pResult = ippECValid; + else + *pResult = ippECPointIsNotValid; + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPComparePoint +// +// Purpose: Compare two EC points +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pQ +// NULL == pResult +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pQ->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the EC Point context +// pQ pointer to the EC Point context +// pECC pointer to the ECCP context +// pResult pointer to the result: +// ippECPointIsEqual +// ippECPointIsNotEqual +// +*F*/ +IPPFUN(IppStatus, ippsECCPComparePoint,(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + IppECResult* pResult, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR2_RET(pP,pQ); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr); + + /* test pResult */ + IPP_BAD_PTR1_RET(pResult); + + *pResult = ECP_METHOD(pECC)->ComparePoint(pP, pQ, pECC, ECP_BNCTX(pECC))? ippECPointIsNotEqual : ippECPointIsEqual; + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPNegativePoint +// +// Purpose: Perforn EC point operation: R = -P +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pR +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pR->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the source EC Point context +// pR pointer to the resultant EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPNegativePoint, (const IppsECCPPointState* pP, + IppsECCPPointState* pR, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR2_RET(pP,pR); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); + + ECP_METHOD(pECC)->NegPoint(pP, pR, pECC); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPAddPoint +// +// Purpose: Perforn EC point operation: R = P+Q +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pQ +// NULL == pR +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pQ->idCtx +// illegal pR->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the source EC Point context +// pQ pointer to the source EC Point context +// pR pointer to the resultant EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPAddPoint,(const IppsECCPPointState* pP, + const IppsECCPPointState* pQ, + IppsECCPPointState* pR, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR3_RET(pP,pQ,pR); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pQ = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pQ, ALIGN_VAL) ); + pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pQ), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); + + if(pP==pQ) + ECP_METHOD(pECC)->DblPoint(pP, pR, pECC, ECP_BNCTX(pECC)); + else + ECP_METHOD(pECC)->AddPoint(pP, pQ, pR, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; +} + + +/*F* +// Name: ippsECCPMulPointScalar +// +// Purpose: Perforn EC point operation: R = k*P +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pP +// NULL == pK +// NULL == pR +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pP->idCtx +// illegal pK->idCtx +// illegal pR->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pP pointer to the source EC Point context +// pK pointer to the source BigNum multiplier context +// pR pointer to the resultant EC Point context +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPMulPointScalar,(const IppsECCPPointState* pP, + const IppsBigNumState* pK, + IppsECCPPointState* pR, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test points */ + IPP_BAD_PTR2_RET(pP,pR); + pP = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pP, ALIGN_VAL) ); + pR = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pR, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pP), ippStsContextMatchErr); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pR), ippStsContextMatchErr); + + /* test scalar */ + IPP_BAD_PTR1_RET(pK); + pK = (IppsBigNumState*)( IPP_ALIGNED_PTR(pK, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pK), ippStsContextMatchErr); + + ECP_METHOD(pECC)->MulPoint(pP, pK, pR, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c b/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c index d4a4408c98..42b2515cf4 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccppublickeyca.c @@ -1,89 +1,89 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccppoint.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" - - -/*F* -// Name: ippsECCPPublicKey -// -// Purpose: Calculate Public Key -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPrivate -// NULL == pPublic -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pPrivate->idCtx -// illegal pPublic->idCtx -// -// ippStsIvalidPrivateKey !(0 < pPrivate < order) -// -// ippStsNoErr no errors -// -// Parameters: -// pPrivate pointer to the private key -// pPublic pointer to the resultant public key -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPPublicKey, (const IppsBigNumState* pPrivate, - IppsECCPPointState* pPublic, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test public key */ - IPP_BAD_PTR1_RET(pPublic); - pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr); - - /* test private keys */ - IPP_BAD_PTR1_RET(pPrivate); - pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); - IPP_BADARG_RET(!((0cpBN_cmp(pPrivate, ECP_ORDER(pECC))) ), ippStsIvalidPrivateKey); - - /* calculates public key */ - ECP_METHOD(pECC)->MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC)); - - return ippStsNoErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPPublicKey +// +// Purpose: Calculate Public Key +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivate +// NULL == pPublic +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivate->idCtx +// illegal pPublic->idCtx +// +// ippStsIvalidPrivateKey !(0 < pPrivate < order) +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivate pointer to the private key +// pPublic pointer to the resultant public key +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPPublicKey, (const IppsBigNumState* pPrivate, + IppsECCPPointState* pPublic, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test public key */ + IPP_BAD_PTR1_RET(pPublic); + pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr); + + /* test private keys */ + IPP_BAD_PTR1_RET(pPrivate); + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + IPP_BADARG_RET(!((0cpBN_cmp(pPrivate, ECP_ORDER(pECC))) ), ippStsIvalidPrivateKey); + + /* calculates public key */ + ECP_METHOD(pECC)->MulBasePoint(pPrivate, pPublic, pECC, ECP_BNCTX(pECC)); + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c b/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c index 05d3c10233..3fec05a086 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsecretdhca.c @@ -1,116 +1,116 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccp.h" -#include "pcpeccppoint.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" - - -/*F* -// Name: ippsECCPSharedSecretDH -// -// Purpose: Shared Secret Value Derivation -// (Diffie-Hellman version). -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPrivateA -// NULL == pPublicB -// NULL == pShare -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pPrivateA->idCtx -// illegal pPublicB->idCtx -// illegal pShare->idCtx -// -// ippStsRangeErr not enough room for share key -// -// ippStsShareKeyErr (infinity) => z -// -// ippStsNoErr no errors -// -// Parameters: -// pPrivateA pointer to own private key -// pPublicB pointer to alien public key -// pShare pointer to the shareds secret value -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, - const IppsECCPPointState* pPublicB, - IppsBigNumState* pShare, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test private (own) key */ - IPP_BAD_PTR1_RET(pPrivateA); - pPrivateA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivateA, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrivateA), ippStsContextMatchErr); - - /* test public (other party) key */ - IPP_BAD_PTR1_RET(pPublicB); - pPublicB = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublicB, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublicB), ippStsContextMatchErr); - - /* test share secret value */ - IPP_BAD_PTR1_RET(pShare); - pShare = (IppsBigNumState*)( IPP_ALIGNED_PTR(pShare, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pShare), ippStsContextMatchErr); - IPP_BADARG_RET((BN_ROOM(pShare)*BITSIZE(BNU_CHUNK_T)MulPoint(pPublicB, pPrivateA, &Tmp, pECC, pList); - - /* test: Tmp ~ point at Infinity */ - if( ECCP_IsPointAtInfinity(&Tmp) ) - return ippStsShareKeyErr; - else { - ECP_METHOD(pECC)->GetPointAffine(pShare, NULL, &Tmp, pECC, pList); - return ippStsNoErr; - } - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSharedSecretDH +// +// Purpose: Shared Secret Value Derivation +// (Diffie-Hellman version). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivateA +// NULL == pPublicB +// NULL == pShare +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivateA->idCtx +// illegal pPublicB->idCtx +// illegal pShare->idCtx +// +// ippStsRangeErr not enough room for share key +// +// ippStsShareKeyErr (infinity) => z +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivateA pointer to own private key +// pPublicB pointer to alien public key +// pShare pointer to the shareds secret value +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSharedSecretDH,(const IppsBigNumState* pPrivateA, + const IppsECCPPointState* pPublicB, + IppsBigNumState* pShare, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test private (own) key */ + IPP_BAD_PTR1_RET(pPrivateA); + pPrivateA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivateA, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivateA), ippStsContextMatchErr); + + /* test public (other party) key */ + IPP_BAD_PTR1_RET(pPublicB); + pPublicB = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublicB, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublicB), ippStsContextMatchErr); + + /* test share secret value */ + IPP_BAD_PTR1_RET(pShare); + pShare = (IppsBigNumState*)( IPP_ALIGNED_PTR(pShare, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pShare), ippStsContextMatchErr); + IPP_BADARG_RET((BN_ROOM(pShare)*BITSIZE(BNU_CHUNK_T)MulPoint(pPublicB, pPrivateA, &Tmp, pECC, pList); + + /* test: Tmp ~ point at Infinity */ + if( ECCP_IsPointAtInfinity(&Tmp) ) + return ippStsShareKeyErr; + else { + ECP_METHOD(pECC)->GetPointAffine(pShare, NULL, &Tmp, pECC, pList); + return ippStsNoErr; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c b/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c index bb3463cfc1..c1644c06ae 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsetkeyca.c @@ -1,105 +1,105 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccp.h" -#include "pcpeccppoint.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" - - -/*F* -// Name: ippsECCPSetKeyPair -// -// Purpose: Generate (private,public) Key Pair -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pPrivate -// NULL == pPublic -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pPrivate->idCtx -// illegal pPublic->idCtx -// -// ippStsNoErr no errors -// -// Parameters: -// pPrivate pointer to the private key -// pPublic pointer to the public key -// regular flag regular/ephemeral keys -// pECC pointer to the ECCP context -// -*F*/ -IPPFUN(IppStatus, ippsECCPSetKeyPair, (const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, - IppBool regular, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - /* test ID */ - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - { - IppsBigNumState* targetPrivate; - IppsECCPPointState* targetPublic; - - if( regular ) { - targetPrivate = ECP_PRIVATE(pECC); - targetPublic = ECP_PUBLIC(pECC); - } - else { - targetPrivate = ECP_PRIVATE_E(pECC); - targetPublic = ECP_PUBLIC_E(pECC); - } - - /* set up private key request */ - if( pPrivate ) { - pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); - ippsSet_BN(ippBigNumPOS, BN_SIZE32(pPrivate), (Ipp32u*)BN_NUMBER(pPrivate), targetPrivate); - } - - /* set up public key request */ - if( pPublic ) { - pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr); - - ECP_METHOD(pECC)->GetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), pPublic, pECC, ECP_BNCTX(pECC)); - ECP_METHOD(pECC)->SetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), targetPublic, pECC); - } - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSetKeyPair +// +// Purpose: Generate (private,public) Key Pair +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pPrivate +// NULL == pPublic +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pPrivate->idCtx +// illegal pPublic->idCtx +// +// ippStsNoErr no errors +// +// Parameters: +// pPrivate pointer to the private key +// pPublic pointer to the public key +// regular flag regular/ephemeral keys +// pECC pointer to the ECCP context +// +*F*/ +IPPFUN(IppStatus, ippsECCPSetKeyPair, (const IppsBigNumState* pPrivate, const IppsECCPPointState* pPublic, + IppBool regular, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + /* test ID */ + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + { + IppsBigNumState* targetPrivate; + IppsECCPPointState* targetPublic; + + if( regular ) { + targetPrivate = ECP_PRIVATE(pECC); + targetPublic = ECP_PUBLIC(pECC); + } + else { + targetPrivate = ECP_PRIVATE_E(pECC); + targetPublic = ECP_PUBLIC_E(pECC); + } + + /* set up private key request */ + if( pPrivate ) { + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + ippsSet_BN(ippBigNumPOS, BN_SIZE32(pPrivate), (Ipp32u*)BN_NUMBER(pPrivate), targetPrivate); + } + + /* set up public key request */ + if( pPublic ) { + pPublic = (IppsECCPPointState*)( IPP_ALIGNED_PTR(pPublic, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_POINT_VALID_ID(pPublic), ippStsContextMatchErr); + + ECP_METHOD(pECC)->GetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), pPublic, pECC, ECP_BNCTX(pECC)); + ECP_METHOD(pECC)->SetPointAffine(ECP_POINT_X(targetPublic), ECP_POINT_Y(targetPublic), targetPublic, pECC); + } + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c b/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c index ca9a9dbe9d..bcda1d76ad 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsigndsaca.c @@ -1,149 +1,149 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpeccp.h" -#include "pcpeccppoint.h" -#include "pcpeccpmethod.h" -#include "pcpeccpmethodcom.h" - - -/*F* -// Name: ippsECCPSignDSA -// -// Purpose: Signing of message representative. -// (DSA version). -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pECC -// NULL == pMsgDigest -// NULL == pPrivate -// NULL == pSignX -// NULL == pSignY -// -// ippStsContextMatchErr illegal pECC->idCtx -// illegal pMsgDigest->idCtx -// illegal pPrivate->idCtx -// illegal pSignX->idCtx -// illegal pSignY->idCtx -// -// ippStsMessageErr MsgDigest >= order -// -// ippStsRangeErr not enough room for: -// signX -// signY -// -// ippStsEphemeralKeyErr (0==signX) || (0==signY) -// -// ippStsNoErr no errors -// -// Parameters: -// pMsgDigest pointer to the message representative to be signed -// pPrivate pointer to the regular private key -// pSignX,pSignY pointer to the signature -// pECC pointer to the ECCP context -// -// Note: -// - ephemeral key pair extracted from pECC and -// must be generated and before ippsECCPDSASign() usage -// - ephemeral key pair destroy before exit -// -*F*/ -IPPFUN(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, - const IppsBigNumState* pPrivate, - IppsBigNumState* pSignX, IppsBigNumState* pSignY, - IppsECCPState* pECC)) -{ - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test private key*/ - IPP_BAD_PTR1_RET(pPrivate); - pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); - - /* test message representative */ - IPP_BAD_PTR1_RET(pMsgDigest); - pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr); - IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr); - - /* test signature */ - IPP_BAD_PTR2_RET(pSignX,pSignY); - pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) ); - pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr); - IPP_BADARG_RET((BN_ROOM(pSignX)*BITSIZE(BNU_CHUNK_T)GetPointAffine(pTmp, NULL, ECP_PUBLIC_E(pECC), pECC, pList); - - /* - // compute - // signX = eph_pub_x (mod order) - */ - PMA_mod(pSignX, pTmp, pOrder); - if( !IsZero_BN(pSignX) ) { - - IppsBigNumState* pEncMsg = cpBigNumListGet(&pList); - IppsBigNumState* pEncSignX = cpBigNumListGet(&pList); - PMA_enc(pEncMsg, (IppsBigNumState*)pMsgDigest, rMont); - PMA_enc(pEncSignX, pSignX, rMont); - - /* - // compute - // signY = (1/eph_private)*(pMsgDigest + private*signX) (mod order) - */ - PMA_inv(pSignY, ECP_PRIVATE_E(pECC), pOrder); - PMA_enc(ECP_PRIVATE_E(pECC), pPrivate, rMont); - PMA_mule(pTmp, ECP_PRIVATE_E(pECC), pEncSignX, rMont); - PMA_add(pTmp, pTmp, pEncMsg, pOrder); - PMA_mule(pSignY, pSignY, pTmp, rMont); - if( !IsZero_BN(pSignY) ) - return ippStsNoErr; - } - - return ippStsEphemeralKeyErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPSignDSA +// +// Purpose: Signing of message representative. +// (DSA version). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pMsgDigest +// NULL == pPrivate +// NULL == pSignX +// NULL == pSignY +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pMsgDigest->idCtx +// illegal pPrivate->idCtx +// illegal pSignX->idCtx +// illegal pSignY->idCtx +// +// ippStsMessageErr MsgDigest >= order +// +// ippStsRangeErr not enough room for: +// signX +// signY +// +// ippStsEphemeralKeyErr (0==signX) || (0==signY) +// +// ippStsNoErr no errors +// +// Parameters: +// pMsgDigest pointer to the message representative to be signed +// pPrivate pointer to the regular private key +// pSignX,pSignY pointer to the signature +// pECC pointer to the ECCP context +// +// Note: +// - ephemeral key pair extracted from pECC and +// must be generated and before ippsECCPDSASign() usage +// - ephemeral key pair destroy before exit +// +*F*/ +IPPFUN(IppStatus, ippsECCPSignDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pPrivate, + IppsBigNumState* pSignX, IppsBigNumState* pSignY, + IppsECCPState* pECC)) +{ + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test private key*/ + IPP_BAD_PTR1_RET(pPrivate); + pPrivate = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivate, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivate), ippStsContextMatchErr); + + /* test message representative */ + IPP_BAD_PTR1_RET(pMsgDigest); + pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr); + IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr); + + /* test signature */ + IPP_BAD_PTR2_RET(pSignX,pSignY); + pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) ); + pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr); + IPP_BADARG_RET((BN_ROOM(pSignX)*BITSIZE(BNU_CHUNK_T)GetPointAffine(pTmp, NULL, ECP_PUBLIC_E(pECC), pECC, pList); + + /* + // compute + // signX = eph_pub_x (mod order) + */ + PMA_mod(pSignX, pTmp, pOrder); + if( !IsZero_BN(pSignX) ) { + + IppsBigNumState* pEncMsg = cpBigNumListGet(&pList); + IppsBigNumState* pEncSignX = cpBigNumListGet(&pList); + PMA_enc(pEncMsg, (IppsBigNumState*)pMsgDigest, rMont); + PMA_enc(pEncSignX, pSignX, rMont); + + /* + // compute + // signY = (1/eph_private)*(pMsgDigest + private*signX) (mod order) + */ + PMA_inv(pSignY, ECP_PRIVATE_E(pECC), pOrder); + PMA_enc(ECP_PRIVATE_E(pECC), pPrivate, rMont); + PMA_mule(pTmp, ECP_PRIVATE_E(pECC), pEncSignX, rMont); + PMA_add(pTmp, pTmp, pEncMsg, pOrder); + PMA_mule(pSignY, pSignY, pTmp, rMont); + if( !IsZero_BN(pSignY) ) + return ippStsNoErr; + } + + return ippStsEphemeralKeyErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c b/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c index c2b08f3fd7..32ab537cf1 100644 --- a/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c +++ b/external/crypto_px/sources/ippcp/src/pcpeccpsscm.c @@ -1,161 +1,161 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpeccppoint.h" - - -#define LOG2_CACHE_LINE_SIZE (LOG_CACHE_LINE_SIZE) - -static int div_upper(int a, int d) -{ return (a+d-1)/d; } - -static int getNumOperations(int bitsize, int w) -{ - int n_overhead = (1<=n_opt) break; - w_opt = w_trial; - n_opt = n_trial; - } - return w_opt; -#undef LIMIT -} - -int cpECCP_ConvertRepresentation(BNU_CHUNK_T* pInput, int inpBits, int w) -{ - Ipp32u* pR = (Ipp32u*)pInput; - Ipp16u* pR16 = (Ipp16u*)pInput; - - int outBits = 0; - Ipp32u base = (BNU_CHUNK_T)1<>digitShift) &digitMask; - - Ipp32u delta = (base-digit) & ~digitMask; - delta <<= digitShift; - cpDec_BNU32((Ipp32u*)(pR16+chunkIdx), (Ipp32u*)(pR16+chunkIdx), (2*nsR-chunkIdx+1)/2, delta); - - inpBits = BITSIZE_BNU32(pR, nsR); - outBits += w; - } - - return outBits; -} - -/* -// cpsScramblePut/cpsScrambleGet -// stores to/retrieves from pScrambleEntry position -// pre-computed data if fixed window method is used -*/ -void cpECCP_ScramblePut(Ipp8u* pScrambleEntry, int proposity, - const IppsECCPPointState* pPoint, cpSize coordLen) -{ - int i; - Ipp8u* pCoord; - - BNU_CHUNK_T* pX = BN_NUMBER(ECP_POINT_X(pPoint)); - BNU_CHUNK_T* pY = BN_NUMBER(ECP_POINT_Y(pPoint)); - BNU_CHUNK_T* pZ = BN_NUMBER(ECP_POINT_Z(pPoint)); - int coordSize = coordLen*sizeof(BNU_CHUNK_T); - - ZEXPAND_BNU(pX, BN_SIZE(ECP_POINT_X(pPoint)), coordLen); - ZEXPAND_BNU(pY, BN_SIZE(ECP_POINT_Y(pPoint)), coordLen); - ZEXPAND_BNU(pZ, BN_SIZE(ECP_POINT_Z(pPoint)), coordLen); - - pCoord = (Ipp8u*)pX; - for(i=0; i=n_opt) break; + w_opt = w_trial; + n_opt = n_trial; + } + return w_opt; +#undef LIMIT +} + +int cpECCP_ConvertRepresentation(BNU_CHUNK_T* pInput, int inpBits, int w) +{ + Ipp32u* pR = (Ipp32u*)pInput; + Ipp16u* pR16 = (Ipp16u*)pInput; + + int outBits = 0; + Ipp32u base = (BNU_CHUNK_T)1<>digitShift) &digitMask; + + Ipp32u delta = (base-digit) & ~digitMask; + delta <<= digitShift; + cpDec_BNU32((Ipp32u*)(pR16+chunkIdx), (Ipp32u*)(pR16+chunkIdx), (2*nsR-chunkIdx+1)/2, delta); + + inpBits = BITSIZE_BNU32(pR, nsR); + outBits += w; + } + + return outBits; +} + +/* +// cpsScramblePut/cpsScrambleGet +// stores to/retrieves from pScrambleEntry position +// pre-computed data if fixed window method is used +*/ +void cpECCP_ScramblePut(Ipp8u* pScrambleEntry, int proposity, + const IppsECCPPointState* pPoint, cpSize coordLen) +{ + int i; + Ipp8u* pCoord; + + BNU_CHUNK_T* pX = BN_NUMBER(ECP_POINT_X(pPoint)); + BNU_CHUNK_T* pY = BN_NUMBER(ECP_POINT_Y(pPoint)); + BNU_CHUNK_T* pZ = BN_NUMBER(ECP_POINT_Z(pPoint)); + int coordSize = coordLen*sizeof(BNU_CHUNK_T); + + ZEXPAND_BNU(pX, BN_SIZE(ECP_POINT_X(pPoint)), coordLen); + ZEXPAND_BNU(pY, BN_SIZE(ECP_POINT_Y(pPoint)), coordLen); + ZEXPAND_BNU(pZ, BN_SIZE(ECP_POINT_Z(pPoint)), coordLen); + + pCoord = (Ipp8u*)pX; + for(i=0; iidCtx -// illegal pMsgDigest->idCtx -// illegal pSignX->idCtx -// illegal pSignY->idCtx -// -// ippStsMessageErr MsgDigest >= order -// -// ippStsNoErr no errors -// -// Parameters: -// pMsgDigest pointer to the message representative to be signed -// pSignX,pSignY pointer to the signature -// pResult pointer to the result: ippECValid/ippECInvalidSignature -// pECC pointer to the ECCP context -// -// Note: -// - signer's key must be set up in ECCP context -// before ippsECCPVerifyDSA() usage -// -*F*/ -IPPFUN(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, - const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, - IppECResult* pResult, - IppsECCPState* pECC)) -{ - IppsMontState* rMont; - - /* test pECC */ - IPP_BAD_PTR1_RET(pECC); - /* use aligned EC context */ - pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); - IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); - - /* test message representative */ - IPP_BAD_PTR1_RET(pMsgDigest); - pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr); - rMont = ECP_RMONT(pECC); - IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr); - - /* test result */ - IPP_BAD_PTR1_RET(pResult); - - /* test signature */ - IPP_BAD_PTR2_RET(pSignX,pSignY); - pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) ); - pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) ); - IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr); - - /* test signature value */ - if( (0>cpBN_tst(pSignX)) || (0>cpBN_tst(pSignY)) || - (0<=cpBN_cmp(pSignX, ECP_ORDER(pECC))) || - (0<=cpBN_cmp(pSignY, ECP_ORDER(pECC))) ) { - *pResult = ippECInvalidSignature; - return ippStsNoErr; - } - - /* validate signature */ - else { - IppsECCPPointState P1; - - BigNumNode* pList = ECP_BNCTX(pECC); - IppsBigNumState* pH1 = cpBigNumListGet(&pList); - IppsBigNumState* pH2 = cpBigNumListGet(&pList); - IppsBigNumState* pOrder = cpBigNumListGet(&pList); - BN_Set(MNT_MODULUS(rMont), MNT_SIZE(rMont), pOrder); - - ECP_POINT_X(&P1) = cpBigNumListGet(&pList); - ECP_POINT_Y(&P1) = cpBigNumListGet(&pList); - ECP_POINT_Z(&P1) = cpBigNumListGet(&pList); - - PMA_inv(pH1, (IppsBigNumState*)pSignY, pOrder);/* h = 1/signY (mod order) */ - PMA_enc(pH1, pH1, rMont); - PMA_mule(pH2, (IppsBigNumState*)pSignX, pH1, rMont); /* h2 = pSignX * h (mod order) */ - PMA_mule(pH1, (IppsBigNumState*)pMsgDigest, pH1, rMont); /* h1 = pMsgDigest * h (mod order) */ - - /* compute h1*BasePoint + h2*publicKey */ - ECP_METHOD(pECC)->ProdPoint(ECP_GENC(pECC), pH1, - ECP_PUBLIC(pECC), pH2, - &P1, pECC, pList); - - if( ECCP_IsPointAtInfinity(&P1) ) { - *pResult = ippECInvalidSignature; - return ippStsNoErr; - } - /* extract X component */ - ECP_METHOD(pECC)->GetPointAffine(pH1, NULL, &P1, pECC, pList); - /* compare with signX */ - PMA_mod(pH1, pH1, pOrder); - *pResult = (0==cpBN_cmp(pH1, pSignX))? ippECValid : ippECInvalidSignature; - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpeccp.h" +#include "pcpeccppoint.h" +#include "pcpeccpmethod.h" +#include "pcpeccpmethodcom.h" + + +/*F* +// Name: ippsECCPVerifyDSA +// +// Purpose: Verify Signature (DSA version). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pECC +// NULL == pMsgDigest +// NULL == pSignX +// NULL == pSignY +// NULL == pResult +// +// ippStsContextMatchErr illegal pECC->idCtx +// illegal pMsgDigest->idCtx +// illegal pSignX->idCtx +// illegal pSignY->idCtx +// +// ippStsMessageErr MsgDigest >= order +// +// ippStsNoErr no errors +// +// Parameters: +// pMsgDigest pointer to the message representative to be signed +// pSignX,pSignY pointer to the signature +// pResult pointer to the result: ippECValid/ippECInvalidSignature +// pECC pointer to the ECCP context +// +// Note: +// - signer's key must be set up in ECCP context +// before ippsECCPVerifyDSA() usage +// +*F*/ +IPPFUN(IppStatus, ippsECCPVerifyDSA,(const IppsBigNumState* pMsgDigest, + const IppsBigNumState* pSignX, const IppsBigNumState* pSignY, + IppECResult* pResult, + IppsECCPState* pECC)) +{ + IppsMontState* rMont; + + /* test pECC */ + IPP_BAD_PTR1_RET(pECC); + /* use aligned EC context */ + pECC = (IppsECCPState*)( IPP_ALIGNED_PTR(pECC, ALIGN_VAL) ); + IPP_BADARG_RET(!ECP_VALID_ID(pECC), ippStsContextMatchErr); + + /* test message representative */ + IPP_BAD_PTR1_RET(pMsgDigest); + pMsgDigest = (IppsBigNumState*)( IPP_ALIGNED_PTR(pMsgDigest, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pMsgDigest), ippStsContextMatchErr); + rMont = ECP_RMONT(pECC); + IPP_BADARG_RET((0<=cpBN_cmp(pMsgDigest, ECP_ORDER(pECC))), ippStsMessageErr); + + /* test result */ + IPP_BAD_PTR1_RET(pResult); + + /* test signature */ + IPP_BAD_PTR2_RET(pSignX,pSignY); + pSignX = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignX, ALIGN_VAL) ); + pSignY = (IppsBigNumState*)( IPP_ALIGNED_PTR(pSignY, ALIGN_VAL) ); + IPP_BADARG_RET(!BN_VALID_ID(pSignX), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pSignY), ippStsContextMatchErr); + + /* test signature value */ + if( (0>cpBN_tst(pSignX)) || (0>cpBN_tst(pSignY)) || + (0<=cpBN_cmp(pSignX, ECP_ORDER(pECC))) || + (0<=cpBN_cmp(pSignY, ECP_ORDER(pECC))) ) { + *pResult = ippECInvalidSignature; + return ippStsNoErr; + } + + /* validate signature */ + else { + IppsECCPPointState P1; + + BigNumNode* pList = ECP_BNCTX(pECC); + IppsBigNumState* pH1 = cpBigNumListGet(&pList); + IppsBigNumState* pH2 = cpBigNumListGet(&pList); + IppsBigNumState* pOrder = cpBigNumListGet(&pList); + BN_Set(MNT_MODULUS(rMont), MNT_SIZE(rMont), pOrder); + + ECP_POINT_X(&P1) = cpBigNumListGet(&pList); + ECP_POINT_Y(&P1) = cpBigNumListGet(&pList); + ECP_POINT_Z(&P1) = cpBigNumListGet(&pList); + + PMA_inv(pH1, (IppsBigNumState*)pSignY, pOrder);/* h = 1/signY (mod order) */ + PMA_enc(pH1, pH1, rMont); + PMA_mule(pH2, (IppsBigNumState*)pSignX, pH1, rMont); /* h2 = pSignX * h (mod order) */ + PMA_mule(pH1, (IppsBigNumState*)pMsgDigest, pH1, rMont); /* h1 = pMsgDigest * h (mod order) */ + + /* compute h1*BasePoint + h2*publicKey */ + ECP_METHOD(pECC)->ProdPoint(ECP_GENC(pECC), pH1, + ECP_PUBLIC(pECC), pH2, + &P1, pECC, pList); + + if( ECCP_IsPointAtInfinity(&P1) ) { + *pResult = ippECInvalidSignature; + return ippStsNoErr; + } + /* extract X component */ + ECP_METHOD(pECC)->GetPointAffine(pH1, NULL, &P1, pECC, pList); + /* compare with signX */ + PMA_mod(pH1, pH1, pOrder); + *pResult = (0==cpBN_cmp(pH1, pSignX))? ippECValid : ippECInvalidSignature; + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphash.h b/external/crypto_px/sources/ippcp/src/pcphash.h index 1dccb86b36..669f3e3467 100644 --- a/external/crypto_px/sources/ippcp/src/pcphash.h +++ b/external/crypto_px/sources/ippcp/src/pcphash.h @@ -1,159 +1,159 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_HASH_H) -#define _PCP_HASH_H - - -/* messge block size */ -#define MBS_SHA1 (64) /* SHA1 message block size (bytes) */ -#define MBS_SHA256 (64) /* SHA256 and SHA224 */ -#define MBS_SHA224 (64) /* SHA224 */ -#define MBS_SHA512 (128) /* SHA512 and SHA384 */ -#define MBS_SHA384 (128) /* SHA384 */ -#define MBS_MD5 (64) /* MD5 */ -#define MBS_HASH_MAX (MBS_SHA512) /* max message block size (bytes) */ -#define MAX_HASH_SIZE (IPP_SHA512_DIGEST_BITSIZE/8) /* hash of the max len (bytes) */ - -/* -// Useful macros -*/ -#define SHS_ID(stt) ((stt)->idCtx) -#define SHS_INDX(stt) ((stt)->index) -#define SHS_LENL(stt) ((stt)->msgLenLo) -#define SHS_LENH(stt) ((stt)->msgLenHi) -#define SHS_BUFF(stt) ((stt)->msgBuffer) -#define SHS_HASH(stt) ((stt)->msgHash) - -/* initial hash values */ -extern const Ipp32u SHA1_IV[]; -extern const Ipp32u SHA256_IV[]; -extern const Ipp32u SHA224_IV[]; -extern const Ipp64u SHA512_IV[]; -extern const Ipp64u SHA384_IV[]; -extern const Ipp32u MD5_IV[]; -extern const Ipp64u SHA512_224_IV[]; -extern const Ipp64u SHA512_256_IV[]; - -/* hash alg additive constants */ -extern __ALIGN16 const Ipp32u SHA1_cnt[]; -extern __ALIGN16 const Ipp32u SHA256_cnt[]; -extern __ALIGN16 const Ipp64u SHA512_cnt[]; -extern __ALIGN16 const Ipp32u MD5_cnt[]; - - -/* hash alg attributes */ -typedef struct _cpHashAttr { - int ivSize; /* attr: length (bytes) of initial value cpHashIV */ - int hashSize; /* attr: length (bytes) of hash */ - int msgBlkSize; /* attr: length (bytes) of message block */ - int msgLenRepSize; /* attr: length (bytes) in representation of processed message length */ - Ipp64u msgLenMax[2]; /* attr: max message length (bytes) (low high) */ -} cpHashAttr; - - -/* hash value */ -typedef Ipp64u cpHash[IPP_SHA512_DIGEST_BITSIZE/BITSIZE(Ipp64u)]; /* hash value */ - -/* hash update function */ -typedef void (*cpHashProc)(void* pHash, const Ipp8u* pMsg, int msgLen, const void* pParam); - - - -/* hash context */ -struct _cpHashCtx { - IppCtxId idCtx; /* hash identifier */ - IppHashAlgId algID; /* hash algorithm ID */ - Ipp64u msgLenLo; /* length (bytes) of processed message: */ - Ipp64u msgLenHi; /* low and high parts */ - cpHashProc hashProc; /* hash update function */ - const void* pParam; /* optional hashProc's parameter */ - cpHash hashVal; /* intermadiate has value */ - int buffOffset; /* current buffer position */ - Ipp8u msgBuffer[MBS_HASH_MAX]; /* buffer */ -}; - -/* accessors */ -#define HASH_CTX_ID(stt) ((stt)->idCtx) -#define HASH_ALG_ID(stt) ((stt)->algID) -#define HASH_LENLO(stt) ((stt)->msgLenLo) -#define HASH_LENHI(stt) ((stt)->msgLenHi) -#define HASH_FUNC(stt) ((stt)->hashProc) -#define HASH_FUNC_PAR(stt) ((stt)->pParam) -#define HASH_VALUE(stt) ((stt)->hashVal) -#define HAHS_BUFFIDX(stt) ((stt)->buffOffset) -#define HASH_BUFF(stt) ((stt)->msgBuffer) -#define HASH_VALID_ID(pCtx) (HASH_CTX_ID((pCtx))==idCtxHash) - - -/* hash alg opt argument */ -extern const void* cpHashProcFuncOpt[]; - -/* enabled hash alg */ -extern const IppHashAlgId cpEnabledHashAlgID[]; - -/* hash alg IV (init value) */ -extern const Ipp8u* cpHashIV[]; - -/* hash alg attribute DB */ -extern const cpHashAttr cpHashAlgAttr[]; - -/* IV size helper */ -__INLINE int cpHashIvSize(IppHashAlgId algID) -{ return cpHashAlgAttr[algID].ivSize; } - -/* hash size helper */ -__INLINE int cpHashSize(IppHashAlgId algID) -{ return cpHashAlgAttr[algID].hashSize; } - -/* message block size helper */ -__INLINE int cpHashMBS(IppHashAlgId algID) -{ return cpHashAlgAttr[algID].msgBlkSize; } - -/* maps algID into enabled IppHashAlgId value */ -__INLINE IppHashAlgId cpValidHashAlg(IppHashAlgId algID) -{ - /* maps algID into the valid range */ - algID = (((int)ippHashAlg_Unknown < (int)algID) && ((int)algID < (int)ippHashAlg_MaxNo))? algID : ippHashAlg_Unknown; - return cpEnabledHashAlgID[algID]; -} - - -/* processing functions */ -void UpdateSHA1 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); -void UpdateSHA256(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); -void UpdateSHA512(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); -void UpdateMD5 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); - -/* general methods */ -int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID); - -#endif /* _PCP_HASH_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_HASH_H) +#define _PCP_HASH_H + + +/* messge block size */ +#define MBS_SHA1 (64) /* SHA1 message block size (bytes) */ +#define MBS_SHA256 (64) /* SHA256 and SHA224 */ +#define MBS_SHA224 (64) /* SHA224 */ +#define MBS_SHA512 (128) /* SHA512 and SHA384 */ +#define MBS_SHA384 (128) /* SHA384 */ +#define MBS_MD5 (64) /* MD5 */ +#define MBS_HASH_MAX (MBS_SHA512) /* max message block size (bytes) */ +#define MAX_HASH_SIZE (IPP_SHA512_DIGEST_BITSIZE/8) /* hash of the max len (bytes) */ + +/* +// Useful macros +*/ +#define SHS_ID(stt) ((stt)->idCtx) +#define SHS_INDX(stt) ((stt)->index) +#define SHS_LENL(stt) ((stt)->msgLenLo) +#define SHS_LENH(stt) ((stt)->msgLenHi) +#define SHS_BUFF(stt) ((stt)->msgBuffer) +#define SHS_HASH(stt) ((stt)->msgHash) + +/* initial hash values */ +extern const Ipp32u SHA1_IV[]; +extern const Ipp32u SHA256_IV[]; +extern const Ipp32u SHA224_IV[]; +extern const Ipp64u SHA512_IV[]; +extern const Ipp64u SHA384_IV[]; +extern const Ipp32u MD5_IV[]; +extern const Ipp64u SHA512_224_IV[]; +extern const Ipp64u SHA512_256_IV[]; + +/* hash alg additive constants */ +extern __ALIGN16 const Ipp32u SHA1_cnt[]; +extern __ALIGN16 const Ipp32u SHA256_cnt[]; +extern __ALIGN16 const Ipp64u SHA512_cnt[]; +extern __ALIGN16 const Ipp32u MD5_cnt[]; + + +/* hash alg attributes */ +typedef struct _cpHashAttr { + int ivSize; /* attr: length (bytes) of initial value cpHashIV */ + int hashSize; /* attr: length (bytes) of hash */ + int msgBlkSize; /* attr: length (bytes) of message block */ + int msgLenRepSize; /* attr: length (bytes) in representation of processed message length */ + Ipp64u msgLenMax[2]; /* attr: max message length (bytes) (low high) */ +} cpHashAttr; + + +/* hash value */ +typedef Ipp64u cpHash[IPP_SHA512_DIGEST_BITSIZE/BITSIZE(Ipp64u)]; /* hash value */ + +/* hash update function */ +typedef void (*cpHashProc)(void* pHash, const Ipp8u* pMsg, int msgLen, const void* pParam); + + + +/* hash context */ +struct _cpHashCtx { + IppCtxId idCtx; /* hash identifier */ + IppHashAlgId algID; /* hash algorithm ID */ + Ipp64u msgLenLo; /* length (bytes) of processed message: */ + Ipp64u msgLenHi; /* low and high parts */ + cpHashProc hashProc; /* hash update function */ + const void* pParam; /* optional hashProc's parameter */ + cpHash hashVal; /* intermadiate has value */ + int buffOffset; /* current buffer position */ + Ipp8u msgBuffer[MBS_HASH_MAX]; /* buffer */ +}; + +/* accessors */ +#define HASH_CTX_ID(stt) ((stt)->idCtx) +#define HASH_ALG_ID(stt) ((stt)->algID) +#define HASH_LENLO(stt) ((stt)->msgLenLo) +#define HASH_LENHI(stt) ((stt)->msgLenHi) +#define HASH_FUNC(stt) ((stt)->hashProc) +#define HASH_FUNC_PAR(stt) ((stt)->pParam) +#define HASH_VALUE(stt) ((stt)->hashVal) +#define HAHS_BUFFIDX(stt) ((stt)->buffOffset) +#define HASH_BUFF(stt) ((stt)->msgBuffer) +#define HASH_VALID_ID(pCtx) (HASH_CTX_ID((pCtx))==idCtxHash) + + +/* hash alg opt argument */ +extern const void* cpHashProcFuncOpt[]; + +/* enabled hash alg */ +extern const IppHashAlgId cpEnabledHashAlgID[]; + +/* hash alg IV (init value) */ +extern const Ipp8u* cpHashIV[]; + +/* hash alg attribute DB */ +extern const cpHashAttr cpHashAlgAttr[]; + +/* IV size helper */ +__INLINE int cpHashIvSize(IppHashAlgId algID) +{ return cpHashAlgAttr[algID].ivSize; } + +/* hash size helper */ +__INLINE int cpHashSize(IppHashAlgId algID) +{ return cpHashAlgAttr[algID].hashSize; } + +/* message block size helper */ +__INLINE int cpHashMBS(IppHashAlgId algID) +{ return cpHashAlgAttr[algID].msgBlkSize; } + +/* maps algID into enabled IppHashAlgId value */ +__INLINE IppHashAlgId cpValidHashAlg(IppHashAlgId algID) +{ + /* maps algID into the valid range */ + algID = (((int)ippHashAlg_Unknown < (int)algID) && ((int)algID < (int)ippHashAlg_MaxNo))? algID : ippHashAlg_Unknown; + return cpEnabledHashAlgID[algID]; +} + + +/* processing functions */ +void UpdateSHA1 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); +void UpdateSHA256(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); +void UpdateSHA512(void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); +void UpdateMD5 (void* pHash, const Ipp8u* mblk, int mlen, const void* pParam); + +/* general methods */ +int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID); + +#endif /* _PCP_HASH_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcphashca.c b/external/crypto_px/sources/ippcp/src/pcphashca.c index f80272c04b..47b2a8b670 100644 --- a/external/crypto_px/sources/ippcp/src/pcphashca.c +++ b/external/crypto_px/sources/ippcp/src/pcphashca.c @@ -1,513 +1,513 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" -#include "pcptool.h" - - -/*F* -// Name: ippsHashGetSize -// -// Purpose: Returns size (bytes) of IppsHashState state. -// -// Returns: Reason: -// ippStsNullPtrErr pSize == NULL -// ippStsNoErr no errors -// -// Parameters: -// pSize pointer to state size -// -*F*/ -IPPFUN(IppStatus, ippsHashGetSize,(int* pSize)) -{ - /* test pointers */ - IPP_BAD_PTR1_RET(pSize); - - *pSize = sizeof(IppsHashState); - return ippStsNoErr; -} - - -/*F* -// Name: ippsHashInit -// -// Purpose: Init Hash state. -// -// Returns: Reason: -// ippStsNullPtrErr pState == NULL -// ippStsNotSupportedModeErr if algID is not match to supported hash alg -// ippStsNoErr no errors -// -// Parameters: -// pCtx pointer to the Hash state -// algID hash alg ID -// -*F*/ -int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID) -{ - int hashIvSize = cpHashIvSize(algID); - const Ipp8u* iv = cpHashIV[algID]; - - HASH_LENLO(pCtx) = CONST_64(0); - HASH_LENHI(pCtx) = CONST_64(0); - HAHS_BUFFIDX(pCtx) = 0; - CopyBlock(iv, HASH_VALUE(pCtx), hashIvSize); - - return hashIvSize; -} - -/* -// hash alg default processing functions and opt argument -*/ -static cpHashProc cpHashProcFunc[] = { - (cpHashProc)NULL, - UpdateSHA1, - UpdateSHA256, - UpdateSHA256, - UpdateSHA512, - UpdateSHA512, - UpdateMD5, - UpdateSHA512, - UpdateSHA512, -}; - -int cpInitHash(IppsHashState* pCtx, IppHashAlgId algID) -{ - /* setup default processing function */ - HASH_FUNC(pCtx) = cpHashProcFunc[algID]; - - /* setup optional agr of processing function */ - HASH_FUNC_PAR(pCtx) = cpHashProcFuncOpt[algID]; - - return cpReInitHash(pCtx, algID); -} - -IPPFUN(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId algID)) -{ - /* get algorithm id */ - algID = cpValidHashAlg(algID); - /* test hash alg */ - IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr); - - /* test ctx pointer */ - IPP_BAD_PTR1_RET(pCtx); - /* test hash alg */ - - /* set ctx ID */ - HASH_CTX_ID(pCtx) = idCtxHash; - HASH_ALG_ID(pCtx) = algID; - - /* init context */ - cpInitHash(pCtx, algID); - return ippStsNoErr; -} - - -/*F* -// Name: ippsHashUpdate -// -// Purpose: Updates intermediate hash value based on input stream. -// -// Returns: Reason: -// ippStsNullPtrErr pCtx == NULL -// ippStsNullPtrErr pSrc==0 but len!=0 -// ippStsContextMatchErr pCtx->idCtx != idCtxHash -// ippStsLengthErr len <0 -// ippStsNoErr no errors -// -// Parameters: -// pSrc pointer to the input stream -// len input stream length -// pCtx pointer to the Hash context -// -*F*/ -__INLINE int IsExceedMsgLen(Ipp64u maxLo, Ipp64u maxHi, Ipp64u lenLo, Ipp64u lenHi) -{ - int isExceed = lenLo > maxLo; - isExceed = (lenHi+isExceed) > maxHi; - return isExceed; -} - -IPPFUN(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx)) -{ - /* test state pointer and ID */ - IPP_BAD_PTR1_RET(pCtx); - /* test the context */ - IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); - /* test input length */ - IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr); - /* test source pointer */ - IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); - - /* handle non empty input */ - if(len) { - const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)]; - - /* test if size of message is being processed not exceeded yet */ - Ipp64u lenLo = HASH_LENLO(pCtx); - Ipp64u lenHi = HASH_LENHI(pCtx); - lenLo += len; - if(lenLo < HASH_LENLO(pCtx)) lenHi++; - if(IsExceedMsgLen(pAttr->msgLenMax[0],pAttr->msgLenMax[1], lenLo,lenHi)) - IPP_ERROR_RET(ippStsLengthErr); - - else { - cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */ - const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */ - int mbs = pAttr->msgBlkSize; /* data block size */ - - /* - // processing - */ - { - int procLen; - - /* test if internal buffer is not empty */ - int n = HAHS_BUFFIDX(pCtx); - if(n) { - procLen = IPP_MIN(len, (mbs-n)); - CopyBlock(pSrc, HASH_BUFF(pCtx)+n, procLen); - HAHS_BUFFIDX(pCtx) = n += procLen; - - /* block processing */ - if(mbs==n) { - hashFunc(HASH_VALUE(pCtx), HASH_BUFF(pCtx), mbs, pParam); - HAHS_BUFFIDX(pCtx) = 0; - } - - /* update message pointer and length */ - pSrc += procLen; - len -= procLen; - } - - /* main processing part */ - procLen = len & ~(mbs-1); - if(procLen) { - hashFunc(HASH_VALUE(pCtx), pSrc, procLen, pParam); - pSrc += procLen; - len -= procLen; - } - - /* rest of input message */ - if(len) { - CopyBlock(pSrc, HASH_BUFF(pCtx), len); - HAHS_BUFFIDX(pCtx) += len; - } - } - - /* update length of processed message */ - HASH_LENLO(pCtx) = lenLo; - HASH_LENHI(pCtx) = lenHi; - - return ippStsNoErr; - } - } - - return ippStsNoErr; -} - - -static void cpComputeDigest(Ipp8u* pHashTag, int hashTagLen, const IppsHashState* pCtx) -{ - /* hash alg and parameters */ - cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */ - const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */ - - /* attributes */ - const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)]; - int mbs = pAttr->msgBlkSize; /* data block size */ - int ivSize = pAttr->ivSize; /* size of hash's IV */ - int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */ - - /* number of bytes in context buffer */ - int n = HAHS_BUFFIDX(pCtx); - /* buffer and it actual length */ - Ipp8u buffer[MBS_HASH_MAX*2]; - int bufferLen = n < (mbs-msgLenRepSize)? mbs : mbs*2; - - /* copy current hash value */ - cpHash hash; - CopyBlock(HASH_VALUE(pCtx), hash, ivSize); - - /* copy of state's buffer */ - CopyBlock(HASH_BUFF(pCtx), buffer, bufferLen); - /* end of message bit */ - buffer[n++] = 0x80; - /* padd buffer */ - PaddBlock(0, buffer+n, bufferLen-n-msgLenRepSize); - - /* message length representation in bits (remember about big endian) */ - { - /* convert processed message length bytes ->bits */ - Ipp64u lo = HASH_LENLO(pCtx); - Ipp64u hi = HASH_LENHI(pCtx); - hi = LSL64(hi,3) | LSR64(lo,63-3); - lo = LSL64(lo,3); - - if(msgLenRepSize>(int)(sizeof(Ipp64u))) { - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - ((Ipp64u*)(buffer+bufferLen))[-2] = hi; - #else - ((Ipp64u*)(buffer+bufferLen))[-2] = ENDIANNESS64(hi); - #endif - } - - /* recall about MD5 specific */ - if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) { - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - ((Ipp64u*)(buffer+bufferLen))[-1] = lo; - #else - ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo); - #endif - } - else { - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo); - #else - ((Ipp64u*)(buffer+bufferLen))[-1] = lo; - #endif - } - } - - /* copmplete hash computation */ - hashFunc(hash, buffer, bufferLen, pParam); - - /* store digest into the user buffer (remember digest in big endian) */ - if(msgLenRepSize>(int)(sizeof(Ipp64u))) { - /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */ - hash[0] = ENDIANNESS64(hash[0]); - hash[1] = ENDIANNESS64(hash[1]); - hash[2] = ENDIANNESS64(hash[2]); - hash[3] = ENDIANNESS64(hash[3]); - hash[4] = ENDIANNESS64(hash[4]); - hash[5] = ENDIANNESS64(hash[5]); - hash[6] = ENDIANNESS64(hash[6]); - hash[7] = ENDIANNESS64(hash[7]); - } - else if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) { - ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]); - ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]); - ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]); - ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]); - ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]); - if(ippHashAlg_SHA1!=HASH_ALG_ID(pCtx)) { - ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]); - ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]); - ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]); - } - } - CopyBlock(hash, pHashTag, hashTagLen); -} - - -/*F* -// Name: ippsHashGetTag -// -// Purpose: Compute digest based on current state. -// Note, that futher digest update is possible -// -// Returns: Reason: -// ippStsNullPtrErr pTag == NULL -// pCtx == NULL -// ippStsContextMatchErr pCtx->idCtx != idCtxHash -// ippStsLengthErr hashSize < tagLen <1 -// ippStsNoErr no errors -// -// Parameters: -// pTag address of the output digest -// tagLen length of digest -// pCtx pointer to the SHS state -// -*F*/ -IPPFUN(IppStatus, ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pCtx)) -{ - /* test state pointer and ID */ - IPP_BAD_PTR2_RET(pTag, pCtx); - /* test the context */ - IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); - - { - /* size of hash */ - int hashSize = cpHashAlgAttr[HASH_ALG_ID(pCtx)].hashSize; - if(tagLen<1||hashSizeidCtx != idCtxHash -// ippStsNoErr no errors -// -// Parameters: -// pMD address of the output digest -// pCtx pointer to the SHS state -// -*F*/ -IPPFUN(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx)) -{ - /* test state pointer and ID */ - IPP_BAD_PTR2_RET(pMD, pCtx); - /* test the context */ - IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); - - { - IppHashAlgId algID = HASH_ALG_ID(pCtx); - int hashSize = cpHashAlgAttr[algID].hashSize; - - cpComputeDigest(pMD, hashSize, pCtx); - cpReInitHash(pCtx, algID); - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsHashMessage -// -// Purpose: Hash of the whole message. -// -// Returns: Reason: -// ippStsNullPtrErr pMD == NULL -// pMsg == NULL but msgLen!=0 -// ippStsLengthErr msgLen <0 -// ippStsNotSupportedModeErr if algID is not match to supported hash alg -// ippStsNoErr no errors -// -// Parameters: -// pMsg pointer to the input message -// msgLen input message length -// pMD address of the output digest -// algID hash alg ID -// -*F*/ -IPPFUN(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD, IppHashAlgId algID)) -{ - /* get algorithm id */ - algID = cpValidHashAlg(algID); - /* test hash alg */ - IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr); - - /* test digest pointer */ - IPP_BAD_PTR1_RET(pMD); - /* test message length */ - IPP_BADARG_RET((msgLen<0), ippStsLengthErr); - /* test message pointer */ - IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr); - - { - /* processing function and parameter */ - cpHashProc hashFunc = cpHashProcFunc[algID]; - const void* pParam = cpHashProcFuncOpt[algID]; - - /* attributes */ - const cpHashAttr* pAttr = &cpHashAlgAttr[algID]; - int mbs = pAttr->msgBlkSize; /* data block size */ - int ivSize = pAttr->ivSize; /* size of hash's IV */ - int hashSize = pAttr->hashSize; /* hash size */ - int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */ - - /* message bitlength representation */ - Ipp64u msgLenBits = (Ipp64u)msgLen*8; - /* length of main message part */ - int msgLenBlks = msgLen & (-mbs); - /* rest of message length */ - int msgLenRest = msgLen - msgLenBlks; - - /* end of message buffer */ - Ipp8u buffer[MBS_HASH_MAX*2]; - int bufferLen = (msgLenRest < (mbs-msgLenRepSize))? mbs : mbs*2; - - /* init hash */ - cpHash hash; - const Ipp8u* iv = cpHashIV[algID]; - CopyBlock(iv, hash, ivSize); - - /*construct last messge block(s) */ - #define MSG_LEN_REP (sizeof(Ipp64u)) - - /* copy end of message */ - CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest); - /* end of message bit */ - buffer[msgLenRest++] = 0x80; - /* padd buffer */ - PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MSG_LEN_REP); - /* copy message bitlength representation */ - if(ippHashAlg_MD5!=algID) - msgLenBits = ENDIANNESS64(msgLenBits); - ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits; - - #undef MSG_LEN_REP - - /* message processing */ - if(msgLenBlks) - hashFunc(hash, pMsg, msgLenBlks, pParam); - hashFunc(hash, buffer, bufferLen, pParam); - - /* store digest into the user buffer (remember digest in big endian) */ - if(msgLenRepSize > (int)(sizeof(Ipp64u))) { - /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */ - hash[0] = ENDIANNESS64(hash[0]); - hash[1] = ENDIANNESS64(hash[1]); - hash[2] = ENDIANNESS64(hash[2]); - hash[3] = ENDIANNESS64(hash[3]); - hash[4] = ENDIANNESS64(hash[4]); - hash[5] = ENDIANNESS64(hash[5]); - hash[6] = ENDIANNESS64(hash[6]); - hash[7] = ENDIANNESS64(hash[7]); - } - else if(ippHashAlg_MD5!=algID) { - /* ippHashAlg_SHA1, ippHashAlg_SHA224, ippHashAlg_SHA256 and ippHashAlg_SM3 */ - ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]); - ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]); - ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]); - ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]); - ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]); - ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]); - ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]); - ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]); - } - CopyBlock(hash, pMD, hashSize); - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/*F* +// Name: ippsHashGetSize +// +// Purpose: Returns size (bytes) of IppsHashState state. +// +// Returns: Reason: +// ippStsNullPtrErr pSize == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to state size +// +*F*/ +IPPFUN(IppStatus, ippsHashGetSize,(int* pSize)) +{ + /* test pointers */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = sizeof(IppsHashState); + return ippStsNoErr; +} + + +/*F* +// Name: ippsHashInit +// +// Purpose: Init Hash state. +// +// Returns: Reason: +// ippStsNullPtrErr pState == NULL +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pCtx pointer to the Hash state +// algID hash alg ID +// +*F*/ +int cpReInitHash(IppsHashState* pCtx, IppHashAlgId algID) +{ + int hashIvSize = cpHashIvSize(algID); + const Ipp8u* iv = cpHashIV[algID]; + + HASH_LENLO(pCtx) = CONST_64(0); + HASH_LENHI(pCtx) = CONST_64(0); + HAHS_BUFFIDX(pCtx) = 0; + CopyBlock(iv, HASH_VALUE(pCtx), hashIvSize); + + return hashIvSize; +} + +/* +// hash alg default processing functions and opt argument +*/ +static cpHashProc cpHashProcFunc[] = { + (cpHashProc)NULL, + UpdateSHA1, + UpdateSHA256, + UpdateSHA256, + UpdateSHA512, + UpdateSHA512, + UpdateMD5, + UpdateSHA512, + UpdateSHA512, +}; + +int cpInitHash(IppsHashState* pCtx, IppHashAlgId algID) +{ + /* setup default processing function */ + HASH_FUNC(pCtx) = cpHashProcFunc[algID]; + + /* setup optional agr of processing function */ + HASH_FUNC_PAR(pCtx) = cpHashProcFuncOpt[algID]; + + return cpReInitHash(pCtx, algID); +} + +IPPFUN(IppStatus, ippsHashInit,(IppsHashState* pCtx, IppHashAlgId algID)) +{ + /* get algorithm id */ + algID = cpValidHashAlg(algID); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr); + + /* test ctx pointer */ + IPP_BAD_PTR1_RET(pCtx); + /* test hash alg */ + + /* set ctx ID */ + HASH_CTX_ID(pCtx) = idCtxHash; + HASH_ALG_ID(pCtx) = algID; + + /* init context */ + cpInitHash(pCtx, algID); + return ippStsNoErr; +} + + +/*F* +// Name: ippsHashUpdate +// +// Purpose: Updates intermediate hash value based on input stream. +// +// Returns: Reason: +// ippStsNullPtrErr pCtx == NULL +// ippStsNullPtrErr pSrc==0 but len!=0 +// ippStsContextMatchErr pCtx->idCtx != idCtxHash +// ippStsLengthErr len <0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the input stream +// len input stream length +// pCtx pointer to the Hash context +// +*F*/ +__INLINE int IsExceedMsgLen(Ipp64u maxLo, Ipp64u maxHi, Ipp64u lenLo, Ipp64u lenHi) +{ + int isExceed = lenLo > maxLo; + isExceed = (lenHi+isExceed) > maxHi; + return isExceed; +} + +IPPFUN(IppStatus, ippsHashUpdate,(const Ipp8u* pSrc, int len, IppsHashState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + /* test the context */ + IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); + /* test input length */ + IPP_BADARG_RET((len<0 && pSrc), ippStsLengthErr); + /* test source pointer */ + IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); + + /* handle non empty input */ + if(len) { + const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)]; + + /* test if size of message is being processed not exceeded yet */ + Ipp64u lenLo = HASH_LENLO(pCtx); + Ipp64u lenHi = HASH_LENHI(pCtx); + lenLo += len; + if(lenLo < HASH_LENLO(pCtx)) lenHi++; + if(IsExceedMsgLen(pAttr->msgLenMax[0],pAttr->msgLenMax[1], lenLo,lenHi)) + IPP_ERROR_RET(ippStsLengthErr); + + else { + cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */ + const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */ + int mbs = pAttr->msgBlkSize; /* data block size */ + + /* + // processing + */ + { + int procLen; + + /* test if internal buffer is not empty */ + int n = HAHS_BUFFIDX(pCtx); + if(n) { + procLen = IPP_MIN(len, (mbs-n)); + CopyBlock(pSrc, HASH_BUFF(pCtx)+n, procLen); + HAHS_BUFFIDX(pCtx) = n += procLen; + + /* block processing */ + if(mbs==n) { + hashFunc(HASH_VALUE(pCtx), HASH_BUFF(pCtx), mbs, pParam); + HAHS_BUFFIDX(pCtx) = 0; + } + + /* update message pointer and length */ + pSrc += procLen; + len -= procLen; + } + + /* main processing part */ + procLen = len & ~(mbs-1); + if(procLen) { + hashFunc(HASH_VALUE(pCtx), pSrc, procLen, pParam); + pSrc += procLen; + len -= procLen; + } + + /* rest of input message */ + if(len) { + CopyBlock(pSrc, HASH_BUFF(pCtx), len); + HAHS_BUFFIDX(pCtx) += len; + } + } + + /* update length of processed message */ + HASH_LENLO(pCtx) = lenLo; + HASH_LENHI(pCtx) = lenHi; + + return ippStsNoErr; + } + } + + return ippStsNoErr; +} + + +static void cpComputeDigest(Ipp8u* pHashTag, int hashTagLen, const IppsHashState* pCtx) +{ + /* hash alg and parameters */ + cpHashProc hashFunc = HASH_FUNC(pCtx); /* processing function */ + const void* pParam = HASH_FUNC_PAR(pCtx); /* and it's addition params */ + + /* attributes */ + const cpHashAttr* pAttr = &cpHashAlgAttr[HASH_ALG_ID(pCtx)]; + int mbs = pAttr->msgBlkSize; /* data block size */ + int ivSize = pAttr->ivSize; /* size of hash's IV */ + int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */ + + /* number of bytes in context buffer */ + int n = HAHS_BUFFIDX(pCtx); + /* buffer and it actual length */ + Ipp8u buffer[MBS_HASH_MAX*2]; + int bufferLen = n < (mbs-msgLenRepSize)? mbs : mbs*2; + + /* copy current hash value */ + cpHash hash; + CopyBlock(HASH_VALUE(pCtx), hash, ivSize); + + /* copy of state's buffer */ + CopyBlock(HASH_BUFF(pCtx), buffer, bufferLen); + /* end of message bit */ + buffer[n++] = 0x80; + /* padd buffer */ + PaddBlock(0, buffer+n, bufferLen-n-msgLenRepSize); + + /* message length representation in bits (remember about big endian) */ + { + /* convert processed message length bytes ->bits */ + Ipp64u lo = HASH_LENLO(pCtx); + Ipp64u hi = HASH_LENHI(pCtx); + hi = LSL64(hi,3) | LSR64(lo,63-3); + lo = LSL64(lo,3); + + if(msgLenRepSize>(int)(sizeof(Ipp64u))) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + ((Ipp64u*)(buffer+bufferLen))[-2] = hi; + #else + ((Ipp64u*)(buffer+bufferLen))[-2] = ENDIANNESS64(hi); + #endif + } + + /* recall about MD5 specific */ + if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + ((Ipp64u*)(buffer+bufferLen))[-1] = lo; + #else + ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo); + #endif + } + else { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + ((Ipp64u*)(buffer+bufferLen))[-1] = ENDIANNESS64(lo); + #else + ((Ipp64u*)(buffer+bufferLen))[-1] = lo; + #endif + } + } + + /* copmplete hash computation */ + hashFunc(hash, buffer, bufferLen, pParam); + + /* store digest into the user buffer (remember digest in big endian) */ + if(msgLenRepSize>(int)(sizeof(Ipp64u))) { + /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */ + hash[0] = ENDIANNESS64(hash[0]); + hash[1] = ENDIANNESS64(hash[1]); + hash[2] = ENDIANNESS64(hash[2]); + hash[3] = ENDIANNESS64(hash[3]); + hash[4] = ENDIANNESS64(hash[4]); + hash[5] = ENDIANNESS64(hash[5]); + hash[6] = ENDIANNESS64(hash[6]); + hash[7] = ENDIANNESS64(hash[7]); + } + else if(ippHashAlg_MD5!=HASH_ALG_ID(pCtx)) { + ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]); + ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]); + ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]); + ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]); + ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]); + if(ippHashAlg_SHA1!=HASH_ALG_ID(pCtx)) { + ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]); + ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]); + ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]); + } + } + CopyBlock(hash, pHashTag, hashTagLen); +} + + +/*F* +// Name: ippsHashGetTag +// +// Purpose: Compute digest based on current state. +// Note, that futher digest update is possible +// +// Returns: Reason: +// ippStsNullPtrErr pTag == NULL +// pCtx == NULL +// ippStsContextMatchErr pCtx->idCtx != idCtxHash +// ippStsLengthErr hashSize < tagLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pTag address of the output digest +// tagLen length of digest +// pCtx pointer to the SHS state +// +*F*/ +IPPFUN(IppStatus, ippsHashGetTag,(Ipp8u* pTag, int tagLen, const IppsHashState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR2_RET(pTag, pCtx); + /* test the context */ + IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); + + { + /* size of hash */ + int hashSize = cpHashAlgAttr[HASH_ALG_ID(pCtx)].hashSize; + if(tagLen<1||hashSizeidCtx != idCtxHash +// ippStsNoErr no errors +// +// Parameters: +// pMD address of the output digest +// pCtx pointer to the SHS state +// +*F*/ +IPPFUN(IppStatus, ippsHashFinal,(Ipp8u* pMD, IppsHashState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR2_RET(pMD, pCtx); + /* test the context */ + IPP_BADARG_RET(!HASH_VALID_ID(pCtx), ippStsContextMatchErr); + + { + IppHashAlgId algID = HASH_ALG_ID(pCtx); + int hashSize = cpHashAlgAttr[algID].hashSize; + + cpComputeDigest(pMD, hashSize, pCtx); + cpReInitHash(pCtx, algID); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsHashMessage +// +// Purpose: Hash of the whole message. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pMsg == NULL but msgLen!=0 +// ippStsLengthErr msgLen <0 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pMsg pointer to the input message +// msgLen input message length +// pMD address of the output digest +// algID hash alg ID +// +*F*/ +IPPFUN(IppStatus, ippsHashMessage,(const Ipp8u* pMsg, int msgLen, Ipp8u* pMD, IppHashAlgId algID)) +{ + /* get algorithm id */ + algID = cpValidHashAlg(algID); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==algID, ippStsNotSupportedModeErr); + + /* test digest pointer */ + IPP_BAD_PTR1_RET(pMD); + /* test message length */ + IPP_BADARG_RET((msgLen<0), ippStsLengthErr); + /* test message pointer */ + IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr); + + { + /* processing function and parameter */ + cpHashProc hashFunc = cpHashProcFunc[algID]; + const void* pParam = cpHashProcFuncOpt[algID]; + + /* attributes */ + const cpHashAttr* pAttr = &cpHashAlgAttr[algID]; + int mbs = pAttr->msgBlkSize; /* data block size */ + int ivSize = pAttr->ivSize; /* size of hash's IV */ + int hashSize = pAttr->hashSize; /* hash size */ + int msgLenRepSize = pAttr->msgLenRepSize; /* length of the message representation */ + + /* message bitlength representation */ + Ipp64u msgLenBits = (Ipp64u)msgLen*8; + /* length of main message part */ + int msgLenBlks = msgLen & (-mbs); + /* rest of message length */ + int msgLenRest = msgLen - msgLenBlks; + + /* end of message buffer */ + Ipp8u buffer[MBS_HASH_MAX*2]; + int bufferLen = (msgLenRest < (mbs-msgLenRepSize))? mbs : mbs*2; + + /* init hash */ + cpHash hash; + const Ipp8u* iv = cpHashIV[algID]; + CopyBlock(iv, hash, ivSize); + + /*construct last messge block(s) */ + #define MSG_LEN_REP (sizeof(Ipp64u)) + + /* copy end of message */ + CopyBlock(pMsg+msgLen-msgLenRest, buffer, msgLenRest); + /* end of message bit */ + buffer[msgLenRest++] = 0x80; + /* padd buffer */ + PaddBlock(0, buffer+msgLenRest, bufferLen-msgLenRest-MSG_LEN_REP); + /* copy message bitlength representation */ + if(ippHashAlg_MD5!=algID) + msgLenBits = ENDIANNESS64(msgLenBits); + ((Ipp64u*)(buffer+bufferLen))[-1] = msgLenBits; + + #undef MSG_LEN_REP + + /* message processing */ + if(msgLenBlks) + hashFunc(hash, pMsg, msgLenBlks, pParam); + hashFunc(hash, buffer, bufferLen, pParam); + + /* store digest into the user buffer (remember digest in big endian) */ + if(msgLenRepSize > (int)(sizeof(Ipp64u))) { + /* ippHashAlg_SHA384, ippHashAlg_SHA512, ippHashAlg_SHA512_224 and ippHashAlg_SHA512_256 */ + hash[0] = ENDIANNESS64(hash[0]); + hash[1] = ENDIANNESS64(hash[1]); + hash[2] = ENDIANNESS64(hash[2]); + hash[3] = ENDIANNESS64(hash[3]); + hash[4] = ENDIANNESS64(hash[4]); + hash[5] = ENDIANNESS64(hash[5]); + hash[6] = ENDIANNESS64(hash[6]); + hash[7] = ENDIANNESS64(hash[7]); + } + else if(ippHashAlg_MD5!=algID) { + /* ippHashAlg_SHA1, ippHashAlg_SHA224, ippHashAlg_SHA256 and ippHashAlg_SM3 */ + ((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]); + ((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]); + ((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]); + ((Ipp32u*)hash)[3] = ENDIANNESS32(((Ipp32u*)hash)[3]); + ((Ipp32u*)hash)[4] = ENDIANNESS32(((Ipp32u*)hash)[4]); + ((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]); + ((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]); + ((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]); + } + CopyBlock(hash, pMD, hashSize); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphashcnt.c b/external/crypto_px/sources/ippcp/src/pcphashcnt.c index 9a54892bbf..37e0188172 100644 --- a/external/crypto_px/sources/ippcp/src/pcphashcnt.c +++ b/external/crypto_px/sources/ippcp/src/pcphashcnt.c @@ -1,216 +1,216 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" - -/* -// enabled hash alg IDs -*/ -const IppHashAlgId cpEnabledHashAlgID[] = { - IPP_ALG_HASH_UNKNOWN, - IPP_ALG_HASH_SHA1, - IPP_ALG_HASH_SHA256, - IPP_ALG_HASH_SHA224, - IPP_ALG_HASH_SHA512, - IPP_ALG_HASH_SHA384, - IPP_ALG_HASH_MD5, - IPP_ALG_HASH_SHA512_224, - IPP_ALG_HASH_SHA512_256 -}; -//////////////////////////////////////////////////////////// - -/* -// hash init values -*/ -const Ipp32u UnknownHash_IV[] = { - 0}; - -const Ipp32u SHA1_IV[] = { - 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0}; - -const Ipp32u SHA256_IV[] = { - 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, - 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19}; - -const Ipp32u SHA224_IV[] = { - 0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939, - 0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4}; - -const Ipp64u SHA512_IV[] = { - CONST_64(0x6A09E667F3BCC908), CONST_64(0xBB67AE8584CAA73B), - CONST_64(0x3C6EF372FE94F82B), CONST_64(0xA54FF53A5F1D36F1), - CONST_64(0x510E527FADE682D1), CONST_64(0x9B05688C2B3E6C1F), - CONST_64(0x1F83D9ABFB41BD6B), CONST_64(0x5BE0CD19137E2179)}; - -const Ipp64u SHA384_IV[] = { - CONST_64(0xCBBB9D5DC1059ED8), CONST_64(0x629A292A367CD507), - CONST_64(0x9159015A3070DD17), CONST_64(0x152FECD8F70E5939), - CONST_64(0x67332667FFC00B31), CONST_64(0x8EB44A8768581511), - CONST_64(0xDB0C2E0D64F98FA7), CONST_64(0x47B5481DBEFA4FA4)}; - -const Ipp32u MD5_IV[] = { - 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476}; - -const Ipp64u SHA512_224_IV[] = { - CONST_64(0x8C3D37C819544DA2), CONST_64(0x73E1996689DCD4D6), - CONST_64(0x1DFAB7AE32FF9C82), CONST_64(0x679DD514582F9FCF), - CONST_64(0x0F6D2B697BD44DA8), CONST_64(0x77E36F7304C48942), - CONST_64(0x3F9D85A86A1D36C8), CONST_64(0x1112E6AD91D692A1)}; - -const Ipp64u SHA512_256_IV[] = { - CONST_64(0x22312194FC2BF72C), CONST_64(0x9F555FA3C84C64C2), - CONST_64(0x2393B86B6F53B151), CONST_64(0x963877195940EABD), - CONST_64(0x96283EE2A88EFFE3), CONST_64(0xBE5E1E2553863992), - CONST_64(0x2B0199FC2C85B8AA), CONST_64(0x0EB72DDC81C52CA2)}; - -const Ipp8u* cpHashIV[] = { - (Ipp8u*)UnknownHash_IV, - (Ipp8u*)SHA1_IV, - (Ipp8u*)SHA256_IV, - (Ipp8u*)SHA224_IV, - (Ipp8u*)SHA512_IV, - (Ipp8u*)SHA384_IV, - (Ipp8u*)MD5_IV, - (Ipp8u*)SHA512_224_IV, - (Ipp8u*)SHA512_256_IV, -}; - -//////////////////////////////////////////////////////////// - -/* -// additive constatns -*/ -__ALIGN16 const Ipp32u SHA1_cnt[] = { - 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 -}; - -__ALIGN16 const Ipp32u SHA256_cnt[] = { - 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, - 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, - 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, - 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, - 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, - 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, - 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, - 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, - 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, - 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, - 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, - 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, - 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, - 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, - 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, - 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 -}; - -__ALIGN16 const Ipp64u SHA512_cnt[] = { - CONST_64(0x428A2F98D728AE22), CONST_64(0x7137449123EF65CD), CONST_64(0xB5C0FBCFEC4D3B2F), CONST_64(0xE9B5DBA58189DBBC), - CONST_64(0x3956C25BF348B538), CONST_64(0x59F111F1B605D019), CONST_64(0x923F82A4AF194F9B), CONST_64(0xAB1C5ED5DA6D8118), - CONST_64(0xD807AA98A3030242), CONST_64(0x12835B0145706FBE), CONST_64(0x243185BE4EE4B28C), CONST_64(0x550C7DC3D5FFB4E2), - CONST_64(0x72BE5D74F27B896F), CONST_64(0x80DEB1FE3B1696B1), CONST_64(0x9BDC06A725C71235), CONST_64(0xC19BF174CF692694), - CONST_64(0xE49B69C19EF14AD2), CONST_64(0xEFBE4786384F25E3), CONST_64(0x0FC19DC68B8CD5B5), CONST_64(0x240CA1CC77AC9C65), - CONST_64(0x2DE92C6F592B0275), CONST_64(0x4A7484AA6EA6E483), CONST_64(0x5CB0A9DCBD41FBD4), CONST_64(0x76F988DA831153B5), - CONST_64(0x983E5152EE66DFAB), CONST_64(0xA831C66D2DB43210), CONST_64(0xB00327C898FB213F), CONST_64(0xBF597FC7BEEF0EE4), - CONST_64(0xC6E00BF33DA88FC2), CONST_64(0xD5A79147930AA725), CONST_64(0x06CA6351E003826F), CONST_64(0x142929670A0E6E70), - CONST_64(0x27B70A8546D22FFC), CONST_64(0x2E1B21385C26C926), CONST_64(0x4D2C6DFC5AC42AED), CONST_64(0x53380D139D95B3DF), - CONST_64(0x650A73548BAF63DE), CONST_64(0x766A0ABB3C77B2A8), CONST_64(0x81C2C92E47EDAEE6), CONST_64(0x92722C851482353B), - CONST_64(0xA2BFE8A14CF10364), CONST_64(0xA81A664BBC423001), CONST_64(0xC24B8B70D0F89791), CONST_64(0xC76C51A30654BE30), - CONST_64(0xD192E819D6EF5218), CONST_64(0xD69906245565A910), CONST_64(0xF40E35855771202A), CONST_64(0x106AA07032BBD1B8), - CONST_64(0x19A4C116B8D2D0C8), CONST_64(0x1E376C085141AB53), CONST_64(0x2748774CDF8EEB99), CONST_64(0x34B0BCB5E19B48A8), - CONST_64(0x391C0CB3C5C95A63), CONST_64(0x4ED8AA4AE3418ACB), CONST_64(0x5B9CCA4F7763E373), CONST_64(0x682E6FF3D6B2B8A3), - CONST_64(0x748F82EE5DEFB2FC), CONST_64(0x78A5636F43172F60), CONST_64(0x84C87814A1F0AB72), CONST_64(0x8CC702081A6439EC), - CONST_64(0x90BEFFFA23631E28), CONST_64(0xA4506CEBDE82BDE9), CONST_64(0xBEF9A3F7B2C67915), CONST_64(0xC67178F2E372532B), - CONST_64(0xCA273ECEEA26619C), CONST_64(0xD186B8C721C0C207), CONST_64(0xEADA7DD6CDE0EB1E), CONST_64(0xF57D4F7FEE6ED178), - CONST_64(0x06F067AA72176FBA), CONST_64(0x0A637DC5A2C898A6), CONST_64(0x113F9804BEF90DAE), CONST_64(0x1B710B35131C471B), - CONST_64(0x28DB77F523047D84), CONST_64(0x32CAAB7B40C72493), CONST_64(0x3C9EBE0A15C9BEBC), CONST_64(0x431D67C49C100D4C), - CONST_64(0x4CC5D4BECB3E42B6), CONST_64(0x597F299CFC657E2A), CONST_64(0x5FCB6FAB3AD6FAEC), CONST_64(0x6C44198C4A475817) -}; - -__ALIGN16 const Ipp32u MD5_cnt[] = { - 0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, - 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, - 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, - 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, - - 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, - 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, - 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, - 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, - - 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, - 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, - 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, - 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, - - 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, - 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, - 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, - 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391 -}; - -/* -// hash alg default processing opt argument -*/ -const void* cpHashProcFuncOpt[] = { - NULL, - SHA1_cnt, - SHA256_cnt, - SHA256_cnt, - SHA512_cnt, - SHA512_cnt, - MD5_cnt, - SHA512_cnt, - SHA512_cnt, -}; -//////////////////////////////////////////////////////////// - -/* hash alg attributes */ -const cpHashAttr cpHashAlgAttr[] = { - {0, 0, 0, 0, {CONST_64(0),CONST_64(0)}}, /* unknown */ - - {IPP_SHA1_DIGEST_BITSIZE/8, IPP_SHA1_DIGEST_BITSIZE/8, MBS_SHA1, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, - - {IPP_SHA256_DIGEST_BITSIZE/8,IPP_SHA256_DIGEST_BITSIZE/8, MBS_SHA256, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, - - {IPP_SHA256_DIGEST_BITSIZE/8,IPP_SHA224_DIGEST_BITSIZE/8, MBS_SHA224, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, - - {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, - - {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA384_DIGEST_BITSIZE/8, MBS_SHA384, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, - - {IPP_MD5_DIGEST_BITSIZE/8,IPP_MD5_DIGEST_BITSIZE/8, MBS_MD5, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, - - {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_224_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, - - {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_256_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}} -}; +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" + +/* +// enabled hash alg IDs +*/ +const IppHashAlgId cpEnabledHashAlgID[] = { + IPP_ALG_HASH_UNKNOWN, + IPP_ALG_HASH_SHA1, + IPP_ALG_HASH_SHA256, + IPP_ALG_HASH_SHA224, + IPP_ALG_HASH_SHA512, + IPP_ALG_HASH_SHA384, + IPP_ALG_HASH_MD5, + IPP_ALG_HASH_SHA512_224, + IPP_ALG_HASH_SHA512_256 +}; +//////////////////////////////////////////////////////////// + +/* +// hash init values +*/ +const Ipp32u UnknownHash_IV[] = { + 0}; + +const Ipp32u SHA1_IV[] = { + 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0}; + +const Ipp32u SHA256_IV[] = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19}; + +const Ipp32u SHA224_IV[] = { + 0xC1059ED8, 0x367CD507, 0x3070DD17, 0xF70E5939, + 0xFFC00B31, 0x68581511, 0x64F98FA7, 0xBEFA4FA4}; + +const Ipp64u SHA512_IV[] = { + CONST_64(0x6A09E667F3BCC908), CONST_64(0xBB67AE8584CAA73B), + CONST_64(0x3C6EF372FE94F82B), CONST_64(0xA54FF53A5F1D36F1), + CONST_64(0x510E527FADE682D1), CONST_64(0x9B05688C2B3E6C1F), + CONST_64(0x1F83D9ABFB41BD6B), CONST_64(0x5BE0CD19137E2179)}; + +const Ipp64u SHA384_IV[] = { + CONST_64(0xCBBB9D5DC1059ED8), CONST_64(0x629A292A367CD507), + CONST_64(0x9159015A3070DD17), CONST_64(0x152FECD8F70E5939), + CONST_64(0x67332667FFC00B31), CONST_64(0x8EB44A8768581511), + CONST_64(0xDB0C2E0D64F98FA7), CONST_64(0x47B5481DBEFA4FA4)}; + +const Ipp32u MD5_IV[] = { + 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476}; + +const Ipp64u SHA512_224_IV[] = { + CONST_64(0x8C3D37C819544DA2), CONST_64(0x73E1996689DCD4D6), + CONST_64(0x1DFAB7AE32FF9C82), CONST_64(0x679DD514582F9FCF), + CONST_64(0x0F6D2B697BD44DA8), CONST_64(0x77E36F7304C48942), + CONST_64(0x3F9D85A86A1D36C8), CONST_64(0x1112E6AD91D692A1)}; + +const Ipp64u SHA512_256_IV[] = { + CONST_64(0x22312194FC2BF72C), CONST_64(0x9F555FA3C84C64C2), + CONST_64(0x2393B86B6F53B151), CONST_64(0x963877195940EABD), + CONST_64(0x96283EE2A88EFFE3), CONST_64(0xBE5E1E2553863992), + CONST_64(0x2B0199FC2C85B8AA), CONST_64(0x0EB72DDC81C52CA2)}; + +const Ipp8u* cpHashIV[] = { + (Ipp8u*)UnknownHash_IV, + (Ipp8u*)SHA1_IV, + (Ipp8u*)SHA256_IV, + (Ipp8u*)SHA224_IV, + (Ipp8u*)SHA512_IV, + (Ipp8u*)SHA384_IV, + (Ipp8u*)MD5_IV, + (Ipp8u*)SHA512_224_IV, + (Ipp8u*)SHA512_256_IV, +}; + +//////////////////////////////////////////////////////////// + +/* +// additive constatns +*/ +__ALIGN16 const Ipp32u SHA1_cnt[] = { + 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 +}; + +__ALIGN16 const Ipp32u SHA256_cnt[] = { + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +}; + +__ALIGN16 const Ipp64u SHA512_cnt[] = { + CONST_64(0x428A2F98D728AE22), CONST_64(0x7137449123EF65CD), CONST_64(0xB5C0FBCFEC4D3B2F), CONST_64(0xE9B5DBA58189DBBC), + CONST_64(0x3956C25BF348B538), CONST_64(0x59F111F1B605D019), CONST_64(0x923F82A4AF194F9B), CONST_64(0xAB1C5ED5DA6D8118), + CONST_64(0xD807AA98A3030242), CONST_64(0x12835B0145706FBE), CONST_64(0x243185BE4EE4B28C), CONST_64(0x550C7DC3D5FFB4E2), + CONST_64(0x72BE5D74F27B896F), CONST_64(0x80DEB1FE3B1696B1), CONST_64(0x9BDC06A725C71235), CONST_64(0xC19BF174CF692694), + CONST_64(0xE49B69C19EF14AD2), CONST_64(0xEFBE4786384F25E3), CONST_64(0x0FC19DC68B8CD5B5), CONST_64(0x240CA1CC77AC9C65), + CONST_64(0x2DE92C6F592B0275), CONST_64(0x4A7484AA6EA6E483), CONST_64(0x5CB0A9DCBD41FBD4), CONST_64(0x76F988DA831153B5), + CONST_64(0x983E5152EE66DFAB), CONST_64(0xA831C66D2DB43210), CONST_64(0xB00327C898FB213F), CONST_64(0xBF597FC7BEEF0EE4), + CONST_64(0xC6E00BF33DA88FC2), CONST_64(0xD5A79147930AA725), CONST_64(0x06CA6351E003826F), CONST_64(0x142929670A0E6E70), + CONST_64(0x27B70A8546D22FFC), CONST_64(0x2E1B21385C26C926), CONST_64(0x4D2C6DFC5AC42AED), CONST_64(0x53380D139D95B3DF), + CONST_64(0x650A73548BAF63DE), CONST_64(0x766A0ABB3C77B2A8), CONST_64(0x81C2C92E47EDAEE6), CONST_64(0x92722C851482353B), + CONST_64(0xA2BFE8A14CF10364), CONST_64(0xA81A664BBC423001), CONST_64(0xC24B8B70D0F89791), CONST_64(0xC76C51A30654BE30), + CONST_64(0xD192E819D6EF5218), CONST_64(0xD69906245565A910), CONST_64(0xF40E35855771202A), CONST_64(0x106AA07032BBD1B8), + CONST_64(0x19A4C116B8D2D0C8), CONST_64(0x1E376C085141AB53), CONST_64(0x2748774CDF8EEB99), CONST_64(0x34B0BCB5E19B48A8), + CONST_64(0x391C0CB3C5C95A63), CONST_64(0x4ED8AA4AE3418ACB), CONST_64(0x5B9CCA4F7763E373), CONST_64(0x682E6FF3D6B2B8A3), + CONST_64(0x748F82EE5DEFB2FC), CONST_64(0x78A5636F43172F60), CONST_64(0x84C87814A1F0AB72), CONST_64(0x8CC702081A6439EC), + CONST_64(0x90BEFFFA23631E28), CONST_64(0xA4506CEBDE82BDE9), CONST_64(0xBEF9A3F7B2C67915), CONST_64(0xC67178F2E372532B), + CONST_64(0xCA273ECEEA26619C), CONST_64(0xD186B8C721C0C207), CONST_64(0xEADA7DD6CDE0EB1E), CONST_64(0xF57D4F7FEE6ED178), + CONST_64(0x06F067AA72176FBA), CONST_64(0x0A637DC5A2C898A6), CONST_64(0x113F9804BEF90DAE), CONST_64(0x1B710B35131C471B), + CONST_64(0x28DB77F523047D84), CONST_64(0x32CAAB7B40C72493), CONST_64(0x3C9EBE0A15C9BEBC), CONST_64(0x431D67C49C100D4C), + CONST_64(0x4CC5D4BECB3E42B6), CONST_64(0x597F299CFC657E2A), CONST_64(0x5FCB6FAB3AD6FAEC), CONST_64(0x6C44198C4A475817) +}; + +__ALIGN16 const Ipp32u MD5_cnt[] = { + 0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, + 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, + 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, + 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, + + 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, + 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, + 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, + 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, + + 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, + 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, + 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, + 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, + + 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, + 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, + 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, + 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391 +}; + +/* +// hash alg default processing opt argument +*/ +const void* cpHashProcFuncOpt[] = { + NULL, + SHA1_cnt, + SHA256_cnt, + SHA256_cnt, + SHA512_cnt, + SHA512_cnt, + MD5_cnt, + SHA512_cnt, + SHA512_cnt, +}; +//////////////////////////////////////////////////////////// + +/* hash alg attributes */ +const cpHashAttr cpHashAlgAttr[] = { + {0, 0, 0, 0, {CONST_64(0),CONST_64(0)}}, /* unknown */ + + {IPP_SHA1_DIGEST_BITSIZE/8, IPP_SHA1_DIGEST_BITSIZE/8, MBS_SHA1, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA256_DIGEST_BITSIZE/8,IPP_SHA256_DIGEST_BITSIZE/8, MBS_SHA256, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA256_DIGEST_BITSIZE/8,IPP_SHA224_DIGEST_BITSIZE/8, MBS_SHA224, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA384_DIGEST_BITSIZE/8, MBS_SHA384, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, + + {IPP_MD5_DIGEST_BITSIZE/8,IPP_MD5_DIGEST_BITSIZE/8, MBS_MD5, sizeof(Ipp64u), {CONST_64(0x2000000000000000-1),CONST_64(0)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_224_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}}, + + {IPP_SHA512_DIGEST_BITSIZE/8,IPP_SHA512_256_DIGEST_BITSIZE/8, MBS_SHA512, sizeof(Ipp64u)*2, {CONST_64(0xFFFFFFFFFFFFFFFF),CONST_64(0x2000000000000000-1)}} +}; diff --git a/external/crypto_px/sources/ippcp/src/pcphashmd5px.c b/external/crypto_px/sources/ippcp/src/pcphashmd5px.c index f42f95bde6..d6a93dd22f 100644 --- a/external/crypto_px/sources/ippcp/src/pcphashmd5px.c +++ b/external/crypto_px/sources/ippcp/src/pcphashmd5px.c @@ -1,197 +1,197 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" -#include "pcptool.h" - -#pragma message("IPP_ALG_HASH_MD5 enabled") - - -/* -// Magic functions defined in RFC 1321 -// -*/ -#define F(X,Y,Z) ((Z) ^ ((X) & ((Y) ^ (Z)))) /* sightly optimized form of (((X) & (Y)) | ((~(X) & (Z)))*/ -#define G(X,Y,Z) F((Z),(X),(Y)) /* replace the original (((X) & (Z)) | ((Y) & ~(Z))) */ -#define H(X,Y,Z) ((X) ^ (Y) ^ (Z)) -#define I(X,Y,Z) ((Y) ^ ((X) | ~(Z))) - -/* -// MD5 step -*/ -#define MD5_STEP(MAGIC, A,B,C,D, data, constant, nrot) \ - (A = B +ROL32((A +MAGIC(B,C,D) +data +constant), nrot)) - -/* -// MD5 left rotations (number of bits) -// depends on round type -*/ -#define F1 7 -#define F2 12 -#define F3 17 -#define F4 22 - -#define G1 5 -#define G2 9 -#define G3 14 -#define G4 20 - -#define H1 4 -#define H2 11 -#define H3 16 -#define H4 23 - -#define I1 6 -#define I2 10 -#define I3 15 -#define I4 21 - -/*F* -// Name: UpdateMD5 -// -// Purpose: Update internal hash according to input message stream. -// -// Parameters: -// uniHash pointer to in/out hash -// mblk pointer to message stream -// mlen message stream length (multiple by message block size) -// uniParam pointer to the optional parameter -// -*F*/ -void UpdateMD5(void* uinHash, const Ipp8u* mblk, int mlen, const void* uniParam) -{ - Ipp32u* digest = (Ipp32u*)uinHash; - Ipp32u* MD5_cnt_loc = (Ipp32u*)uniParam; - - for(; mlen>=MBS_MD5; mblk += MBS_MD5, mlen -= MBS_MD5) { - - /* allocate data */ - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - Ipp32u data[MBS_MD5/sizeof(Ipp32u)]; - #else - /* or just word alias */ - Ipp32u* data = (Ipp32u*)mblk; - #endif - - /* init variables */ - Ipp32u a = digest[0]; - Ipp32u b = digest[1]; - Ipp32u c = digest[2]; - Ipp32u d = digest[3]; - - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - int t; - for(t=0; t<16; t++) { - data[t] = ENDIANNESS(((Ipp32u*)mblk)[t]); - } - #endif - - /* rounds type F */ - MD5_STEP(F, a,b,c,d, data[ 0], MD5_cnt_loc[ 0], F1); - MD5_STEP(F, d,a,b,c, data[ 1], MD5_cnt_loc[ 1], F2); - MD5_STEP(F, c,d,a,b, data[ 2], MD5_cnt_loc[ 2], F3); - MD5_STEP(F, b,c,d,a, data[ 3], MD5_cnt_loc[ 3], F4); - MD5_STEP(F, a,b,c,d, data[ 4], MD5_cnt_loc[ 4], F1); - MD5_STEP(F, d,a,b,c, data[ 5], MD5_cnt_loc[ 5], F2); - MD5_STEP(F, c,d,a,b, data[ 6], MD5_cnt_loc[ 6], F3); - MD5_STEP(F, b,c,d,a, data[ 7], MD5_cnt_loc[ 7], F4); - MD5_STEP(F, a,b,c,d, data[ 8], MD5_cnt_loc[ 8], F1); - MD5_STEP(F, d,a,b,c, data[ 9], MD5_cnt_loc[ 9], F2); - MD5_STEP(F, c,d,a,b, data[10], MD5_cnt_loc[10], F3); - MD5_STEP(F, b,c,d,a, data[11], MD5_cnt_loc[11], F4); - MD5_STEP(F, a,b,c,d, data[12], MD5_cnt_loc[12], F1); - MD5_STEP(F, d,a,b,c, data[13], MD5_cnt_loc[13], F2); - MD5_STEP(F, c,d,a,b, data[14], MD5_cnt_loc[14], F3); - MD5_STEP(F, b,c,d,a, data[15], MD5_cnt_loc[15], F4); - - /* rounds type G */ - MD5_STEP(G, a,b,c,d, data[ 1], MD5_cnt_loc[16], G1); - MD5_STEP(G, d,a,b,c, data[ 6], MD5_cnt_loc[17], G2); - MD5_STEP(G, c,d,a,b, data[11], MD5_cnt_loc[18], G3); - MD5_STEP(G, b,c,d,a, data[ 0], MD5_cnt_loc[19], G4); - MD5_STEP(G, a,b,c,d, data[ 5], MD5_cnt_loc[20], G1); - MD5_STEP(G, d,a,b,c, data[10], MD5_cnt_loc[21], G2); - MD5_STEP(G, c,d,a,b, data[15], MD5_cnt_loc[22], G3); - MD5_STEP(G, b,c,d,a, data[ 4], MD5_cnt_loc[23], G4); - MD5_STEP(G, a,b,c,d, data[ 9], MD5_cnt_loc[24], G1); - MD5_STEP(G, d,a,b,c, data[14], MD5_cnt_loc[25], G2); - MD5_STEP(G, c,d,a,b, data[ 3], MD5_cnt_loc[26], G3); - MD5_STEP(G, b,c,d,a, data[ 8], MD5_cnt_loc[27], G4); - MD5_STEP(G, a,b,c,d, data[13], MD5_cnt_loc[28], G1); - MD5_STEP(G, d,a,b,c, data[ 2], MD5_cnt_loc[29], G2); - MD5_STEP(G, c,d,a,b, data[ 7], MD5_cnt_loc[30], G3); - MD5_STEP(G, b,c,d,a, data[12], MD5_cnt_loc[31], G4); - - /* rounds type H */ - MD5_STEP(H, a,b,c,d, data[ 5], MD5_cnt_loc[32], H1); - MD5_STEP(H, d,a,b,c, data[ 8], MD5_cnt_loc[33], H2); - MD5_STEP(H, c,d,a,b, data[11], MD5_cnt_loc[34], H3); - MD5_STEP(H, b,c,d,a, data[14], MD5_cnt_loc[35], H4); - MD5_STEP(H, a,b,c,d, data[ 1], MD5_cnt_loc[36], H1); - MD5_STEP(H, d,a,b,c, data[ 4], MD5_cnt_loc[37], H2); - MD5_STEP(H, c,d,a,b, data[ 7], MD5_cnt_loc[38], H3); - MD5_STEP(H, b,c,d,a, data[10], MD5_cnt_loc[39], H4); - MD5_STEP(H, a,b,c,d, data[13], MD5_cnt_loc[40], H1); - MD5_STEP(H, d,a,b,c, data[ 0], MD5_cnt_loc[41], H2); - MD5_STEP(H, c,d,a,b, data[ 3], MD5_cnt_loc[42], H3); - MD5_STEP(H, b,c,d,a, data[ 6], MD5_cnt_loc[43], H4); - MD5_STEP(H, a,b,c,d, data[ 9], MD5_cnt_loc[44], H1); - MD5_STEP(H, d,a,b,c, data[12], MD5_cnt_loc[45], H2); - MD5_STEP(H, c,d,a,b, data[15], MD5_cnt_loc[46], H3); - MD5_STEP(H, b,c,d,a, data[ 2], MD5_cnt_loc[47], H4); - - /* rounds type I */ - MD5_STEP(I, a,b,c,d, data[ 0], MD5_cnt_loc[48], I1); - MD5_STEP(I, d,a,b,c, data[ 7], MD5_cnt_loc[49], I2); - MD5_STEP(I, c,d,a,b, data[14], MD5_cnt_loc[50], I3); - MD5_STEP(I, b,c,d,a, data[ 5], MD5_cnt_loc[51], I4); - MD5_STEP(I, a,b,c,d, data[12], MD5_cnt_loc[52], I1); - MD5_STEP(I, d,a,b,c, data[ 3], MD5_cnt_loc[53], I2); - MD5_STEP(I, c,d,a,b, data[10], MD5_cnt_loc[54], I3); - MD5_STEP(I, b,c,d,a, data[ 1], MD5_cnt_loc[55], I4); - MD5_STEP(I, a,b,c,d, data[ 8], MD5_cnt_loc[56], I1); - MD5_STEP(I, d,a,b,c, data[15], MD5_cnt_loc[57], I2); - MD5_STEP(I, c,d,a,b, data[ 6], MD5_cnt_loc[58], I3); - MD5_STEP(I, b,c,d,a, data[13], MD5_cnt_loc[59], I4); - MD5_STEP(I, a,b,c,d, data[ 4], MD5_cnt_loc[60], I1); - MD5_STEP(I, d,a,b,c, data[11], MD5_cnt_loc[61], I2); - MD5_STEP(I, c,d,a,b, data[ 2], MD5_cnt_loc[62], I3); - MD5_STEP(I, b,c,d,a, data[ 9], MD5_cnt_loc[63], I4); - - /* update digest */ - digest[0] += a; - digest[1] += b; - digest[2] += c; - digest[3] += d; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + +#pragma message("IPP_ALG_HASH_MD5 enabled") + + +/* +// Magic functions defined in RFC 1321 +// +*/ +#define F(X,Y,Z) ((Z) ^ ((X) & ((Y) ^ (Z)))) /* sightly optimized form of (((X) & (Y)) | ((~(X) & (Z)))*/ +#define G(X,Y,Z) F((Z),(X),(Y)) /* replace the original (((X) & (Z)) | ((Y) & ~(Z))) */ +#define H(X,Y,Z) ((X) ^ (Y) ^ (Z)) +#define I(X,Y,Z) ((Y) ^ ((X) | ~(Z))) + +/* +// MD5 step +*/ +#define MD5_STEP(MAGIC, A,B,C,D, data, constant, nrot) \ + (A = B +ROL32((A +MAGIC(B,C,D) +data +constant), nrot)) + +/* +// MD5 left rotations (number of bits) +// depends on round type +*/ +#define F1 7 +#define F2 12 +#define F3 17 +#define F4 22 + +#define G1 5 +#define G2 9 +#define G3 14 +#define G4 20 + +#define H1 4 +#define H2 11 +#define H3 16 +#define H4 23 + +#define I1 6 +#define I2 10 +#define I3 15 +#define I4 21 + +/*F* +// Name: UpdateMD5 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +void UpdateMD5(void* uinHash, const Ipp8u* mblk, int mlen, const void* uniParam) +{ + Ipp32u* digest = (Ipp32u*)uinHash; + Ipp32u* MD5_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_MD5; mblk += MBS_MD5, mlen -= MBS_MD5) { + + /* allocate data */ + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + Ipp32u data[MBS_MD5/sizeof(Ipp32u)]; + #else + /* or just word alias */ + Ipp32u* data = (Ipp32u*)mblk; + #endif + + /* init variables */ + Ipp32u a = digest[0]; + Ipp32u b = digest[1]; + Ipp32u c = digest[2]; + Ipp32u d = digest[3]; + + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + int t; + for(t=0; t<16; t++) { + data[t] = ENDIANNESS(((Ipp32u*)mblk)[t]); + } + #endif + + /* rounds type F */ + MD5_STEP(F, a,b,c,d, data[ 0], MD5_cnt_loc[ 0], F1); + MD5_STEP(F, d,a,b,c, data[ 1], MD5_cnt_loc[ 1], F2); + MD5_STEP(F, c,d,a,b, data[ 2], MD5_cnt_loc[ 2], F3); + MD5_STEP(F, b,c,d,a, data[ 3], MD5_cnt_loc[ 3], F4); + MD5_STEP(F, a,b,c,d, data[ 4], MD5_cnt_loc[ 4], F1); + MD5_STEP(F, d,a,b,c, data[ 5], MD5_cnt_loc[ 5], F2); + MD5_STEP(F, c,d,a,b, data[ 6], MD5_cnt_loc[ 6], F3); + MD5_STEP(F, b,c,d,a, data[ 7], MD5_cnt_loc[ 7], F4); + MD5_STEP(F, a,b,c,d, data[ 8], MD5_cnt_loc[ 8], F1); + MD5_STEP(F, d,a,b,c, data[ 9], MD5_cnt_loc[ 9], F2); + MD5_STEP(F, c,d,a,b, data[10], MD5_cnt_loc[10], F3); + MD5_STEP(F, b,c,d,a, data[11], MD5_cnt_loc[11], F4); + MD5_STEP(F, a,b,c,d, data[12], MD5_cnt_loc[12], F1); + MD5_STEP(F, d,a,b,c, data[13], MD5_cnt_loc[13], F2); + MD5_STEP(F, c,d,a,b, data[14], MD5_cnt_loc[14], F3); + MD5_STEP(F, b,c,d,a, data[15], MD5_cnt_loc[15], F4); + + /* rounds type G */ + MD5_STEP(G, a,b,c,d, data[ 1], MD5_cnt_loc[16], G1); + MD5_STEP(G, d,a,b,c, data[ 6], MD5_cnt_loc[17], G2); + MD5_STEP(G, c,d,a,b, data[11], MD5_cnt_loc[18], G3); + MD5_STEP(G, b,c,d,a, data[ 0], MD5_cnt_loc[19], G4); + MD5_STEP(G, a,b,c,d, data[ 5], MD5_cnt_loc[20], G1); + MD5_STEP(G, d,a,b,c, data[10], MD5_cnt_loc[21], G2); + MD5_STEP(G, c,d,a,b, data[15], MD5_cnt_loc[22], G3); + MD5_STEP(G, b,c,d,a, data[ 4], MD5_cnt_loc[23], G4); + MD5_STEP(G, a,b,c,d, data[ 9], MD5_cnt_loc[24], G1); + MD5_STEP(G, d,a,b,c, data[14], MD5_cnt_loc[25], G2); + MD5_STEP(G, c,d,a,b, data[ 3], MD5_cnt_loc[26], G3); + MD5_STEP(G, b,c,d,a, data[ 8], MD5_cnt_loc[27], G4); + MD5_STEP(G, a,b,c,d, data[13], MD5_cnt_loc[28], G1); + MD5_STEP(G, d,a,b,c, data[ 2], MD5_cnt_loc[29], G2); + MD5_STEP(G, c,d,a,b, data[ 7], MD5_cnt_loc[30], G3); + MD5_STEP(G, b,c,d,a, data[12], MD5_cnt_loc[31], G4); + + /* rounds type H */ + MD5_STEP(H, a,b,c,d, data[ 5], MD5_cnt_loc[32], H1); + MD5_STEP(H, d,a,b,c, data[ 8], MD5_cnt_loc[33], H2); + MD5_STEP(H, c,d,a,b, data[11], MD5_cnt_loc[34], H3); + MD5_STEP(H, b,c,d,a, data[14], MD5_cnt_loc[35], H4); + MD5_STEP(H, a,b,c,d, data[ 1], MD5_cnt_loc[36], H1); + MD5_STEP(H, d,a,b,c, data[ 4], MD5_cnt_loc[37], H2); + MD5_STEP(H, c,d,a,b, data[ 7], MD5_cnt_loc[38], H3); + MD5_STEP(H, b,c,d,a, data[10], MD5_cnt_loc[39], H4); + MD5_STEP(H, a,b,c,d, data[13], MD5_cnt_loc[40], H1); + MD5_STEP(H, d,a,b,c, data[ 0], MD5_cnt_loc[41], H2); + MD5_STEP(H, c,d,a,b, data[ 3], MD5_cnt_loc[42], H3); + MD5_STEP(H, b,c,d,a, data[ 6], MD5_cnt_loc[43], H4); + MD5_STEP(H, a,b,c,d, data[ 9], MD5_cnt_loc[44], H1); + MD5_STEP(H, d,a,b,c, data[12], MD5_cnt_loc[45], H2); + MD5_STEP(H, c,d,a,b, data[15], MD5_cnt_loc[46], H3); + MD5_STEP(H, b,c,d,a, data[ 2], MD5_cnt_loc[47], H4); + + /* rounds type I */ + MD5_STEP(I, a,b,c,d, data[ 0], MD5_cnt_loc[48], I1); + MD5_STEP(I, d,a,b,c, data[ 7], MD5_cnt_loc[49], I2); + MD5_STEP(I, c,d,a,b, data[14], MD5_cnt_loc[50], I3); + MD5_STEP(I, b,c,d,a, data[ 5], MD5_cnt_loc[51], I4); + MD5_STEP(I, a,b,c,d, data[12], MD5_cnt_loc[52], I1); + MD5_STEP(I, d,a,b,c, data[ 3], MD5_cnt_loc[53], I2); + MD5_STEP(I, c,d,a,b, data[10], MD5_cnt_loc[54], I3); + MD5_STEP(I, b,c,d,a, data[ 1], MD5_cnt_loc[55], I4); + MD5_STEP(I, a,b,c,d, data[ 8], MD5_cnt_loc[56], I1); + MD5_STEP(I, d,a,b,c, data[15], MD5_cnt_loc[57], I2); + MD5_STEP(I, c,d,a,b, data[ 6], MD5_cnt_loc[58], I3); + MD5_STEP(I, b,c,d,a, data[13], MD5_cnt_loc[59], I4); + MD5_STEP(I, a,b,c,d, data[ 4], MD5_cnt_loc[60], I1); + MD5_STEP(I, d,a,b,c, data[11], MD5_cnt_loc[61], I2); + MD5_STEP(I, c,d,a,b, data[ 2], MD5_cnt_loc[62], I3); + MD5_STEP(I, b,c,d,a, data[ 9], MD5_cnt_loc[63], I4); + + /* update digest */ + digest[0] += a; + digest[1] += b; + digest[2] += c; + digest[3] += d; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphashsha1px.c b/external/crypto_px/sources/ippcp/src/pcphashsha1px.c index cb3b7a155f..77b7c184e1 100644 --- a/external/crypto_px/sources/ippcp/src/pcphashsha1px.c +++ b/external/crypto_px/sources/ippcp/src/pcphashsha1px.c @@ -1,174 +1,174 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" -#include "pcptool.h" - - -/* -// Magic functions defined in FIPS 180-1 -// -*/ -#define MAGIC_F0(B,C,D) (((B) & (C)) | ((~(B)) & (D))) -#define MAGIC_F1(B,C,D) ((B) ^ (C) ^ (D)) -#define MAGIC_F2(B,C,D) (((B) & (C)) | ((B) & (D)) | ((C) & (D))) -#define MAGIC_F3(B,C,D) ((B) ^ (C) ^ (D)) - -#define SHA1_STEP(A,B,C,D,E, MAGIC_FUN, W,K) \ - (E)+= ROL32((A),5) + MAGIC_FUN((B),(C),(D)) + (W) + (K); \ - (B) = ROL32((B),30) - -#define COMPACT_SHA1_STEP(A,B,C,D,E, MAGIC_FUN, W,K, t) { \ - Ipp32u _T = ROL32((A),5) + MAGIC_FUN((t)/20, (B),(C),(D)) + (E) + (W)[(t)] + (K)[(t)/20]; \ - (E) = (D); \ - (D) = (C); \ - (C) = ROL32((B),30); \ - (B) = (A); \ - (A) = _T; \ -} - -#if defined(_ALG_SHA1_COMPACT_) -__INLINE Ipp32u MagicFun(int s, Ipp32u b, Ipp32u c, Ipp32u d) -{ - switch(s) { - case 0: return MAGIC_F0(b,c,d); - case 2: return MAGIC_F2(b,c,d); - default:return MAGIC_F1(b,c,d); - } -} -#endif - - -/*F* -// Name: UpdateSHA1 -// -// Purpose: Update internal hash according to input message stream. -// -// Parameters: -// uniHash pointer to in/out hash -// mblk pointer to message stream -// mlen message stream length (multiple by message block size) -// uniParam pointer to the optional parameter -// -*F*/ -#if defined(_ALG_SHA1_COMPACT_) -#pragma message("SHA1 compact") -#endif - -void UpdateSHA1(void* uinHash, const Ipp8u* mblk, int mlen, const void *uniParam) -{ - Ipp32u* data = (Ipp32u*)mblk; - - Ipp32u* digest = (Ipp32u*)uinHash; - Ipp32u* SHA1_cnt_loc = (Ipp32u*)uniParam; - - for(; mlen>=MBS_SHA1; data += MBS_SHA1/sizeof(Ipp32u), mlen -= MBS_SHA1) { - int t; - - /* - // expand message block - */ - Ipp32u W[80]; - /* initialize the first 16 words in the array W (remember about endian) */ - for(t=0; t<16; t++) { - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - W[t] = data[t]; - #else - W[t] = ENDIANNESS(data[t]); - #endif - } - /* schedule another 80-16 words in the array W */ - for(; t<80; t++) { - W[t] = ROL32(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1); - } - - /* - // update hash - */ - { - /* init A, B, C, D, E by the the input hash */ - Ipp32u A = digest[0]; - Ipp32u B = digest[1]; - Ipp32u C = digest[2]; - Ipp32u D = digest[3]; - Ipp32u E = digest[4]; - - #if defined(_ALG_SHA1_COMPACT_) - /* steps 0-79 */ - for(t=0; t<80; t++) - COMPACT_SHA1_STEP(A,B,C,D,E, MagicFun, W, SHA1_cnt_loc, t); - - #else - /* perform 0-19 steps */ - for(t=0; t<20; t+=5) { - SHA1_STEP(A,B,C,D,E, MAGIC_F0, W[t ],SHA1_cnt_loc[0]); - SHA1_STEP(E,A,B,C,D, MAGIC_F0, W[t+1],SHA1_cnt_loc[0]); - SHA1_STEP(D,E,A,B,C, MAGIC_F0, W[t+2],SHA1_cnt_loc[0]); - SHA1_STEP(C,D,E,A,B, MAGIC_F0, W[t+3],SHA1_cnt_loc[0]); - SHA1_STEP(B,C,D,E,A, MAGIC_F0, W[t+4],SHA1_cnt_loc[0]); - } - /* perform 20-39 steps */ - for(; t<40; t+=5) { - SHA1_STEP(A,B,C,D,E, MAGIC_F1, W[t ],SHA1_cnt_loc[1]); - SHA1_STEP(E,A,B,C,D, MAGIC_F1, W[t+1],SHA1_cnt_loc[1]); - SHA1_STEP(D,E,A,B,C, MAGIC_F1, W[t+2],SHA1_cnt_loc[1]); - SHA1_STEP(C,D,E,A,B, MAGIC_F1, W[t+3],SHA1_cnt_loc[1]); - SHA1_STEP(B,C,D,E,A, MAGIC_F1, W[t+4],SHA1_cnt_loc[1]); - } - /* perform 40-59 steps */ - for(; t<60; t+=5) { - SHA1_STEP(A,B,C,D,E, MAGIC_F2, W[t ],SHA1_cnt_loc[2]); - SHA1_STEP(E,A,B,C,D, MAGIC_F2, W[t+1],SHA1_cnt_loc[2]); - SHA1_STEP(D,E,A,B,C, MAGIC_F2, W[t+2],SHA1_cnt_loc[2]); - SHA1_STEP(C,D,E,A,B, MAGIC_F2, W[t+3],SHA1_cnt_loc[2]); - SHA1_STEP(B,C,D,E,A, MAGIC_F2, W[t+4],SHA1_cnt_loc[2]); - } - /* perform 60-79 steps */ - for(; t<80; t+=5) { - SHA1_STEP(A,B,C,D,E, MAGIC_F3, W[t ],SHA1_cnt_loc[3]); - SHA1_STEP(E,A,B,C,D, MAGIC_F3, W[t+1],SHA1_cnt_loc[3]); - SHA1_STEP(D,E,A,B,C, MAGIC_F3, W[t+2],SHA1_cnt_loc[3]); - SHA1_STEP(C,D,E,A,B, MAGIC_F3, W[t+3],SHA1_cnt_loc[3]); - SHA1_STEP(B,C,D,E,A, MAGIC_F3, W[t+4],SHA1_cnt_loc[3]); - } - #endif - - /* update digest */ - digest[0] += A; - digest[1] += B; - digest[2] += C; - digest[3] += D; - digest[4] += E; - } - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/* +// Magic functions defined in FIPS 180-1 +// +*/ +#define MAGIC_F0(B,C,D) (((B) & (C)) | ((~(B)) & (D))) +#define MAGIC_F1(B,C,D) ((B) ^ (C) ^ (D)) +#define MAGIC_F2(B,C,D) (((B) & (C)) | ((B) & (D)) | ((C) & (D))) +#define MAGIC_F3(B,C,D) ((B) ^ (C) ^ (D)) + +#define SHA1_STEP(A,B,C,D,E, MAGIC_FUN, W,K) \ + (E)+= ROL32((A),5) + MAGIC_FUN((B),(C),(D)) + (W) + (K); \ + (B) = ROL32((B),30) + +#define COMPACT_SHA1_STEP(A,B,C,D,E, MAGIC_FUN, W,K, t) { \ + Ipp32u _T = ROL32((A),5) + MAGIC_FUN((t)/20, (B),(C),(D)) + (E) + (W)[(t)] + (K)[(t)/20]; \ + (E) = (D); \ + (D) = (C); \ + (C) = ROL32((B),30); \ + (B) = (A); \ + (A) = _T; \ +} + +#if defined(_ALG_SHA1_COMPACT_) +__INLINE Ipp32u MagicFun(int s, Ipp32u b, Ipp32u c, Ipp32u d) +{ + switch(s) { + case 0: return MAGIC_F0(b,c,d); + case 2: return MAGIC_F2(b,c,d); + default:return MAGIC_F1(b,c,d); + } +} +#endif + + +/*F* +// Name: UpdateSHA1 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +#if defined(_ALG_SHA1_COMPACT_) +#pragma message("SHA1 compact") +#endif + +void UpdateSHA1(void* uinHash, const Ipp8u* mblk, int mlen, const void *uniParam) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp32u* digest = (Ipp32u*)uinHash; + Ipp32u* SHA1_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_SHA1; data += MBS_SHA1/sizeof(Ipp32u), mlen -= MBS_SHA1) { + int t; + + /* + // expand message block + */ + Ipp32u W[80]; + /* initialize the first 16 words in the array W (remember about endian) */ + for(t=0; t<16; t++) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + W[t] = data[t]; + #else + W[t] = ENDIANNESS(data[t]); + #endif + } + /* schedule another 80-16 words in the array W */ + for(; t<80; t++) { + W[t] = ROL32(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1); + } + + /* + // update hash + */ + { + /* init A, B, C, D, E by the the input hash */ + Ipp32u A = digest[0]; + Ipp32u B = digest[1]; + Ipp32u C = digest[2]; + Ipp32u D = digest[3]; + Ipp32u E = digest[4]; + + #if defined(_ALG_SHA1_COMPACT_) + /* steps 0-79 */ + for(t=0; t<80; t++) + COMPACT_SHA1_STEP(A,B,C,D,E, MagicFun, W, SHA1_cnt_loc, t); + + #else + /* perform 0-19 steps */ + for(t=0; t<20; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F0, W[t ],SHA1_cnt_loc[0]); + SHA1_STEP(E,A,B,C,D, MAGIC_F0, W[t+1],SHA1_cnt_loc[0]); + SHA1_STEP(D,E,A,B,C, MAGIC_F0, W[t+2],SHA1_cnt_loc[0]); + SHA1_STEP(C,D,E,A,B, MAGIC_F0, W[t+3],SHA1_cnt_loc[0]); + SHA1_STEP(B,C,D,E,A, MAGIC_F0, W[t+4],SHA1_cnt_loc[0]); + } + /* perform 20-39 steps */ + for(; t<40; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F1, W[t ],SHA1_cnt_loc[1]); + SHA1_STEP(E,A,B,C,D, MAGIC_F1, W[t+1],SHA1_cnt_loc[1]); + SHA1_STEP(D,E,A,B,C, MAGIC_F1, W[t+2],SHA1_cnt_loc[1]); + SHA1_STEP(C,D,E,A,B, MAGIC_F1, W[t+3],SHA1_cnt_loc[1]); + SHA1_STEP(B,C,D,E,A, MAGIC_F1, W[t+4],SHA1_cnt_loc[1]); + } + /* perform 40-59 steps */ + for(; t<60; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F2, W[t ],SHA1_cnt_loc[2]); + SHA1_STEP(E,A,B,C,D, MAGIC_F2, W[t+1],SHA1_cnt_loc[2]); + SHA1_STEP(D,E,A,B,C, MAGIC_F2, W[t+2],SHA1_cnt_loc[2]); + SHA1_STEP(C,D,E,A,B, MAGIC_F2, W[t+3],SHA1_cnt_loc[2]); + SHA1_STEP(B,C,D,E,A, MAGIC_F2, W[t+4],SHA1_cnt_loc[2]); + } + /* perform 60-79 steps */ + for(; t<80; t+=5) { + SHA1_STEP(A,B,C,D,E, MAGIC_F3, W[t ],SHA1_cnt_loc[3]); + SHA1_STEP(E,A,B,C,D, MAGIC_F3, W[t+1],SHA1_cnt_loc[3]); + SHA1_STEP(D,E,A,B,C, MAGIC_F3, W[t+2],SHA1_cnt_loc[3]); + SHA1_STEP(C,D,E,A,B, MAGIC_F3, W[t+3],SHA1_cnt_loc[3]); + SHA1_STEP(B,C,D,E,A, MAGIC_F3, W[t+4],SHA1_cnt_loc[3]); + } + #endif + + /* update digest */ + digest[0] += A; + digest[1] += B; + digest[2] += C; + digest[3] += D; + digest[4] += E; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcphashsha256px.c b/external/crypto_px/sources/ippcp/src/pcphashsha256px.c index 0eb0628518..932b9cb335 100644 --- a/external/crypto_px/sources/ippcp/src/pcphashsha256px.c +++ b/external/crypto_px/sources/ippcp/src/pcphashsha256px.c @@ -1,199 +1,199 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" -#include "pcptool.h" - - -/* -// SHA256 Specific Macros (reference proposal 256-384-512) -*/ -#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#define SUM0(x) (ROR32((x), 2) ^ ROR32((x),13) ^ ROR32((x),22)) -#define SUM1(x) (ROR32((x), 6) ^ ROR32((x),11) ^ ROR32((x),25)) - -#define SIG0(x) (ROR32((x), 7) ^ ROR32((x),18) ^ LSR32((x), 3)) -#define SIG1(x) (ROR32((x),17) ^ ROR32((x),19) ^ LSR32((x),10)) - -#define SHA256_UPDATE(i) \ - wdat[i & 15] += SIG1(wdat[(i+14)&15]) + wdat[(i+9)&15] + SIG0(wdat[(i+1)&15]) - -#define SHA256_STEP(i,j) \ - v[(7 - i) & 7] += (j ? SHA256_UPDATE(i) : wdat[i&15]) \ - + SHA256_cnt_loc[i + j] \ - + SUM1(v[(4-i)&7]) \ - + CH(v[(4-i)&7], v[(5-i)&7], v[(6-i)&7]); \ - v[(3-i)&7] += v[(7-i)&7]; \ - v[(7-i)&7] += SUM0(v[(0-i)&7]) + MAJ(v[(0-i)&7], v[(1-i)&7], v[(2-i)&7]) - -#define COMPACT_SHA256_STEP(A,B,C,D,E,F,G,H, W,K, r) { \ - Ipp32u _T1 = (H) + SUM1((E)) + CH((E),(F),(G)) + (W)[(r)] + (K)[(r)]; \ - Ipp32u _T2 = SUM0((A)) + MAJ((A),(B),(C)); \ - (H) = (G); \ - (G) = (F); \ - (F) = (E); \ - (E) = (D)+_T1; \ - (D) = (C); \ - (C) = (B); \ - (B) = (A); \ - (A) = _T1+_T2; \ -} - -/*F* -// Name: UpdateSHA256 -// -// Purpose: Update internal hash according to input message stream. -// -// Parameters: -// uniHash pointer to in/out hash -// mblk pointer to message stream -// mlen message stream length (multiple by message block size) -// uniParam pointer to the optional parameter -// -*F*/ -#if defined(_ALG_SHA256_COMPACT_) -#pragma message("SHA256 compact") - -void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam) -{ - Ipp32u* data = (Ipp32u*)mblk; - - Ipp32u* digest = (Ipp32u*)uniHash; - Ipp32u* SHA256_cnt_loc = (Ipp32u*)uniParam; - - for(; mlen>=MBS_SHA256; data += MBS_SHA256/sizeof(Ipp32u), mlen -= MBS_SHA256) { - int t; - - /* - // expand message block - */ - Ipp32u W[64]; - /* initialize the first 16 words in the array W (remember about endian) */ - for(t=0; t<16; t++) { - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - W[t] = data[t]; - #else - W[t] = ENDIANNESS( data[t] ); - #endif - } - for(; t<64; t++) - W[t] = SIG1(W[t-2]) + W[t-7] + SIG0(W[t-15]) + W[t-16]; - - /* - // update hash - */ - { - /* init A, B, C, D, E, F, G, H by the input hash */ - Ipp32u A = digest[0]; - Ipp32u B = digest[1]; - Ipp32u C = digest[2]; - Ipp32u D = digest[3]; - Ipp32u E = digest[4]; - Ipp32u F = digest[5]; - Ipp32u G = digest[6]; - Ipp32u H = digest[7]; - - for(t=0; t<64; t++) - COMPACT_SHA256_STEP(A,B,C,D,E,F,G,H, W,SHA256_cnt_loc, t); - - /* update hash*/ - digest[0] += A; - digest[1] += B; - digest[2] += C; - digest[3] += D; - digest[4] += E; - digest[5] += F; - digest[6] += G; - digest[7] += H; - } - } -} - -#else -void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam) -{ - Ipp32u* data = (Ipp32u*)mblk; - - Ipp32u* digest = (Ipp32u*)uniHash; - Ipp32u* SHA256_cnt_loc = (Ipp32u*)uniParam; - - for(; mlen>=MBS_SHA256; data += MBS_SHA256/sizeof(Ipp32u), mlen -= MBS_SHA256) { - Ipp32u wdat[16]; - int j; - - /* copy digest */ - Ipp32u v[8]; - CopyBlock(digest, v, IPP_SHA256_DIGEST_BITSIZE/BYTESIZE); - - /* initialize the first 16 words in the array W (remember about endian) */ - for(j=0; j<16; j++) { - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - wdat[j] = data[j]; - #else - wdat[j] = ENDIANNESS( data[j] ); - #endif - } - - for(j=0; j<64; j+=16) { - SHA256_STEP( 0, j); - SHA256_STEP( 1, j); - SHA256_STEP( 2, j); - SHA256_STEP( 3, j); - SHA256_STEP( 4, j); - SHA256_STEP( 5, j); - SHA256_STEP( 6, j); - SHA256_STEP( 7, j); - SHA256_STEP( 8, j); - SHA256_STEP( 9, j); - SHA256_STEP(10, j); - SHA256_STEP(11, j); - SHA256_STEP(12, j); - SHA256_STEP(13, j); - SHA256_STEP(14, j); - SHA256_STEP(15, j); - } - - /* update digest */ - digest[0] += v[0]; - digest[1] += v[1]; - digest[2] += v[2]; - digest[3] += v[3]; - digest[4] += v[4]; - digest[5] += v[5]; - digest[6] += v[6]; - digest[7] += v[7]; - } -} -#endif +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/* +// SHA256 Specific Macros (reference proposal 256-384-512) +*/ +#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#define SUM0(x) (ROR32((x), 2) ^ ROR32((x),13) ^ ROR32((x),22)) +#define SUM1(x) (ROR32((x), 6) ^ ROR32((x),11) ^ ROR32((x),25)) + +#define SIG0(x) (ROR32((x), 7) ^ ROR32((x),18) ^ LSR32((x), 3)) +#define SIG1(x) (ROR32((x),17) ^ ROR32((x),19) ^ LSR32((x),10)) + +#define SHA256_UPDATE(i) \ + wdat[i & 15] += SIG1(wdat[(i+14)&15]) + wdat[(i+9)&15] + SIG0(wdat[(i+1)&15]) + +#define SHA256_STEP(i,j) \ + v[(7 - i) & 7] += (j ? SHA256_UPDATE(i) : wdat[i&15]) \ + + SHA256_cnt_loc[i + j] \ + + SUM1(v[(4-i)&7]) \ + + CH(v[(4-i)&7], v[(5-i)&7], v[(6-i)&7]); \ + v[(3-i)&7] += v[(7-i)&7]; \ + v[(7-i)&7] += SUM0(v[(0-i)&7]) + MAJ(v[(0-i)&7], v[(1-i)&7], v[(2-i)&7]) + +#define COMPACT_SHA256_STEP(A,B,C,D,E,F,G,H, W,K, r) { \ + Ipp32u _T1 = (H) + SUM1((E)) + CH((E),(F),(G)) + (W)[(r)] + (K)[(r)]; \ + Ipp32u _T2 = SUM0((A)) + MAJ((A),(B),(C)); \ + (H) = (G); \ + (G) = (F); \ + (F) = (E); \ + (E) = (D)+_T1; \ + (D) = (C); \ + (C) = (B); \ + (B) = (A); \ + (A) = _T1+_T2; \ +} + +/*F* +// Name: UpdateSHA256 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +#if defined(_ALG_SHA256_COMPACT_) +#pragma message("SHA256 compact") + +void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp32u* digest = (Ipp32u*)uniHash; + Ipp32u* SHA256_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_SHA256; data += MBS_SHA256/sizeof(Ipp32u), mlen -= MBS_SHA256) { + int t; + + /* + // expand message block + */ + Ipp32u W[64]; + /* initialize the first 16 words in the array W (remember about endian) */ + for(t=0; t<16; t++) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + W[t] = data[t]; + #else + W[t] = ENDIANNESS( data[t] ); + #endif + } + for(; t<64; t++) + W[t] = SIG1(W[t-2]) + W[t-7] + SIG0(W[t-15]) + W[t-16]; + + /* + // update hash + */ + { + /* init A, B, C, D, E, F, G, H by the input hash */ + Ipp32u A = digest[0]; + Ipp32u B = digest[1]; + Ipp32u C = digest[2]; + Ipp32u D = digest[3]; + Ipp32u E = digest[4]; + Ipp32u F = digest[5]; + Ipp32u G = digest[6]; + Ipp32u H = digest[7]; + + for(t=0; t<64; t++) + COMPACT_SHA256_STEP(A,B,C,D,E,F,G,H, W,SHA256_cnt_loc, t); + + /* update hash*/ + digest[0] += A; + digest[1] += B; + digest[2] += C; + digest[3] += D; + digest[4] += E; + digest[5] += F; + digest[6] += G; + digest[7] += H; + } + } +} + +#else +void UpdateSHA256(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniParam) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp32u* digest = (Ipp32u*)uniHash; + Ipp32u* SHA256_cnt_loc = (Ipp32u*)uniParam; + + for(; mlen>=MBS_SHA256; data += MBS_SHA256/sizeof(Ipp32u), mlen -= MBS_SHA256) { + Ipp32u wdat[16]; + int j; + + /* copy digest */ + Ipp32u v[8]; + CopyBlock(digest, v, IPP_SHA256_DIGEST_BITSIZE/BYTESIZE); + + /* initialize the first 16 words in the array W (remember about endian) */ + for(j=0; j<16; j++) { + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + wdat[j] = data[j]; + #else + wdat[j] = ENDIANNESS( data[j] ); + #endif + } + + for(j=0; j<64; j+=16) { + SHA256_STEP( 0, j); + SHA256_STEP( 1, j); + SHA256_STEP( 2, j); + SHA256_STEP( 3, j); + SHA256_STEP( 4, j); + SHA256_STEP( 5, j); + SHA256_STEP( 6, j); + SHA256_STEP( 7, j); + SHA256_STEP( 8, j); + SHA256_STEP( 9, j); + SHA256_STEP(10, j); + SHA256_STEP(11, j); + SHA256_STEP(12, j); + SHA256_STEP(13, j); + SHA256_STEP(14, j); + SHA256_STEP(15, j); + } + + /* update digest */ + digest[0] += v[0]; + digest[1] += v[1]; + digest[2] += v[2]; + digest[3] += v[3]; + digest[4] += v[4]; + digest[5] += v[5]; + digest[6] += v[6]; + digest[7] += v[7]; + } +} +#endif diff --git a/external/crypto_px/sources/ippcp/src/pcphashsha512px.c b/external/crypto_px/sources/ippcp/src/pcphashsha512px.c index 5dd09b8fca..6b8983d467 100644 --- a/external/crypto_px/sources/ippcp/src/pcphashsha512px.c +++ b/external/crypto_px/sources/ippcp/src/pcphashsha512px.c @@ -1,207 +1,207 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" -#include "pcptool.h" - - -/* -// SHA512 Specific Macros (reference proposal 256-384-512) -// -// Note: All operations act on DWORDs (64-bits) -*/ -#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#define SUM0(x) (ROR64((x),28) ^ ROR64((x),34) ^ ROR64((x),39)) -#define SUM1(x) (ROR64((x),14) ^ ROR64((x),18) ^ ROR64((x),41)) - -#define SIG0(x) (ROR64((x), 1) ^ ROR64((x), 8) ^ LSR64((x), 7)) -#define SIG1(x) (ROR64((x),19) ^ ROR64((x),61) ^ LSR64((x), 6)) - -#define SHA512_UPDATE(i) \ - wdat[i&15] += SIG1(wdat[(i+14)&15]) + wdat[(i+9)&15] + SIG0(wdat[(i+1)&15]) - -#define SHA512_STEP(i,j) \ - v[(7-i)&7] += (j ? SHA512_UPDATE(i) : wdat[i&15]) \ - + SHA512_cnt_loc[i+j] \ - + SUM1(v[(4-i)&7]) \ - + CH(v[(4-i)&7], v[(5-i)&7], v[(6-i)&7]); \ - v[(3-i)&7] += v[(7-i)&7]; \ - v[(7-i)&7] += SUM0(v[(0-i)&7]) + MAJ(v[(0-i)&7], v[(1-i)&7], v[(2-i)&7]) - -#define COMPACT_SHA512_STEP(A,B,C,D,E,F,G,H, W,K, r) { \ - Ipp64u _T1 = (H) + SUM1((E)) + CH((E),(F),(G)) + (W)[(r)] + (K)[(r)]; \ - Ipp64u _T2 = SUM0((A)) + MAJ((A),(B),(C)); \ - (H) = (G); \ - (G) = (F); \ - (F) = (E); \ - (E) = (D)+_T1; \ - (D) = (C); \ - (C) = (B); \ - (B) = (A); \ - (A) = _T1+_T2; \ -} - -/*F* -// Name: UpdateSHA512 -// -// Purpose: Update internal hash according to input message stream. -// -// Parameters: -// uniHash pointer to in/out hash -// mblk pointer to message stream -// mlen message stream length (multiple by message block size) -// uniParam pointer to the optional parameter -// -*F*/ -#if defined(_ALG_SHA512_COMPACT_) -#pragma message("SHA512 compact") - -void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram) -{ - Ipp32u* data = (Ipp32u*)mblk; - - Ipp64u* digest = (Ipp64u*)uniHash; - Ipp64u* SHA512_cnt_loc = (Ipp64u*)uniPraram; - - - for(; mlen>=MBS_SHA512; data += MBS_SHA512/sizeof(Ipp32u), mlen -= MBS_SHA512) { - int t; - Ipp64u W[80]; - - /* - // expand message block - */ - /* initialize the first 16 words in the array W (remember about endian) */ - for(t=0; t<16; t++) { - Ipp32u hiX = data[2*t]; - Ipp32u loX = data[2*t+1]; - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - W[t] = MAKEDWORD(loX, hiX); - #else - W[t] = MAKEDWORD( ENDIANNESS(loX), ENDIANNESS(hiX) ); - #endif - } - for(; t<80; t++) - W[t] = SIG1(W[t-2]) + W[t-7] + SIG0(W[t-15]) + W[t-16]; - - /* - // update hash - */ - { - /* init A, B, C, D, E, F, G, H by the input hash */ - Ipp64u A = digest[0]; - Ipp64u B = digest[1]; - Ipp64u C = digest[2]; - Ipp64u D = digest[3]; - Ipp64u E = digest[4]; - Ipp64u F = digest[5]; - Ipp64u G = digest[6]; - Ipp64u H = digest[7]; - - for(t=0; t<80; t++) - COMPACT_SHA512_STEP(A,B,C,D,E,F,G,H, W,SHA512_cnt_loc, t); - - /* update hash*/ - digest[0] += A; - digest[1] += B; - digest[2] += C; - digest[3] += D; - digest[4] += E; - digest[5] += F; - digest[6] += G; - digest[7] += H; - } - } -} - -#else -void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram) -{ - Ipp32u* data = (Ipp32u*)mblk; - - Ipp64u* digest = (Ipp64u*)uniHash; - Ipp64u* SHA512_cnt_loc = (Ipp64u*)uniPraram; - - for(; mlen>=MBS_SHA512; data += MBS_SHA512/sizeof(Ipp32u), mlen -= MBS_SHA512) { - Ipp64u wdat[16]; - int j; - - Ipp64u v[8]; - - /* initialize the first 16 words in the array W (remember about endian) */ - for(j=0; j<16; j++) { - Ipp32u hiX = data[2*j]; - Ipp32u loX = data[2*j+1]; - #if (IPP_ENDIAN == IPP_BIG_ENDIAN) - wdat[j] = MAKEDWORD(loX, hiX); - #else - wdat[j] = MAKEDWORD( ENDIANNESS(loX), ENDIANNESS(hiX) ); - #endif - } - - /* copy digest */ - CopyBlock(digest, v, IPP_SHA512_DIGEST_BITSIZE/BYTESIZE); - - for(j=0; j<80; j+=16) { - SHA512_STEP( 0, j); - SHA512_STEP( 1, j); - SHA512_STEP( 2, j); - SHA512_STEP( 3, j); - SHA512_STEP( 4, j); - SHA512_STEP( 5, j); - SHA512_STEP( 6, j); - SHA512_STEP( 7, j); - SHA512_STEP( 8, j); - SHA512_STEP( 9, j); - SHA512_STEP(10, j); - SHA512_STEP(11, j); - SHA512_STEP(12, j); - SHA512_STEP(13, j); - SHA512_STEP(14, j); - SHA512_STEP(15, j); - } - - /* update digest */ - digest[0] += v[0]; - digest[1] += v[1]; - digest[2] += v[2]; - digest[3] += v[3]; - digest[4] += v[4]; - digest[5] += v[5]; - digest[6] += v[6]; - digest[7] += v[7]; - } -} -#endif +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/* +// SHA512 Specific Macros (reference proposal 256-384-512) +// +// Note: All operations act on DWORDs (64-bits) +*/ +#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#define SUM0(x) (ROR64((x),28) ^ ROR64((x),34) ^ ROR64((x),39)) +#define SUM1(x) (ROR64((x),14) ^ ROR64((x),18) ^ ROR64((x),41)) + +#define SIG0(x) (ROR64((x), 1) ^ ROR64((x), 8) ^ LSR64((x), 7)) +#define SIG1(x) (ROR64((x),19) ^ ROR64((x),61) ^ LSR64((x), 6)) + +#define SHA512_UPDATE(i) \ + wdat[i&15] += SIG1(wdat[(i+14)&15]) + wdat[(i+9)&15] + SIG0(wdat[(i+1)&15]) + +#define SHA512_STEP(i,j) \ + v[(7-i)&7] += (j ? SHA512_UPDATE(i) : wdat[i&15]) \ + + SHA512_cnt_loc[i+j] \ + + SUM1(v[(4-i)&7]) \ + + CH(v[(4-i)&7], v[(5-i)&7], v[(6-i)&7]); \ + v[(3-i)&7] += v[(7-i)&7]; \ + v[(7-i)&7] += SUM0(v[(0-i)&7]) + MAJ(v[(0-i)&7], v[(1-i)&7], v[(2-i)&7]) + +#define COMPACT_SHA512_STEP(A,B,C,D,E,F,G,H, W,K, r) { \ + Ipp64u _T1 = (H) + SUM1((E)) + CH((E),(F),(G)) + (W)[(r)] + (K)[(r)]; \ + Ipp64u _T2 = SUM0((A)) + MAJ((A),(B),(C)); \ + (H) = (G); \ + (G) = (F); \ + (F) = (E); \ + (E) = (D)+_T1; \ + (D) = (C); \ + (C) = (B); \ + (B) = (A); \ + (A) = _T1+_T2; \ +} + +/*F* +// Name: UpdateSHA512 +// +// Purpose: Update internal hash according to input message stream. +// +// Parameters: +// uniHash pointer to in/out hash +// mblk pointer to message stream +// mlen message stream length (multiple by message block size) +// uniParam pointer to the optional parameter +// +*F*/ +#if defined(_ALG_SHA512_COMPACT_) +#pragma message("SHA512 compact") + +void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp64u* digest = (Ipp64u*)uniHash; + Ipp64u* SHA512_cnt_loc = (Ipp64u*)uniPraram; + + + for(; mlen>=MBS_SHA512; data += MBS_SHA512/sizeof(Ipp32u), mlen -= MBS_SHA512) { + int t; + Ipp64u W[80]; + + /* + // expand message block + */ + /* initialize the first 16 words in the array W (remember about endian) */ + for(t=0; t<16; t++) { + Ipp32u hiX = data[2*t]; + Ipp32u loX = data[2*t+1]; + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + W[t] = MAKEDWORD(loX, hiX); + #else + W[t] = MAKEDWORD( ENDIANNESS(loX), ENDIANNESS(hiX) ); + #endif + } + for(; t<80; t++) + W[t] = SIG1(W[t-2]) + W[t-7] + SIG0(W[t-15]) + W[t-16]; + + /* + // update hash + */ + { + /* init A, B, C, D, E, F, G, H by the input hash */ + Ipp64u A = digest[0]; + Ipp64u B = digest[1]; + Ipp64u C = digest[2]; + Ipp64u D = digest[3]; + Ipp64u E = digest[4]; + Ipp64u F = digest[5]; + Ipp64u G = digest[6]; + Ipp64u H = digest[7]; + + for(t=0; t<80; t++) + COMPACT_SHA512_STEP(A,B,C,D,E,F,G,H, W,SHA512_cnt_loc, t); + + /* update hash*/ + digest[0] += A; + digest[1] += B; + digest[2] += C; + digest[3] += D; + digest[4] += E; + digest[5] += F; + digest[6] += G; + digest[7] += H; + } + } +} + +#else +void UpdateSHA512(void* uniHash, const Ipp8u* mblk, int mlen, const void* uniPraram) +{ + Ipp32u* data = (Ipp32u*)mblk; + + Ipp64u* digest = (Ipp64u*)uniHash; + Ipp64u* SHA512_cnt_loc = (Ipp64u*)uniPraram; + + for(; mlen>=MBS_SHA512; data += MBS_SHA512/sizeof(Ipp32u), mlen -= MBS_SHA512) { + Ipp64u wdat[16]; + int j; + + Ipp64u v[8]; + + /* initialize the first 16 words in the array W (remember about endian) */ + for(j=0; j<16; j++) { + Ipp32u hiX = data[2*j]; + Ipp32u loX = data[2*j+1]; + #if (IPP_ENDIAN == IPP_BIG_ENDIAN) + wdat[j] = MAKEDWORD(loX, hiX); + #else + wdat[j] = MAKEDWORD( ENDIANNESS(loX), ENDIANNESS(hiX) ); + #endif + } + + /* copy digest */ + CopyBlock(digest, v, IPP_SHA512_DIGEST_BITSIZE/BYTESIZE); + + for(j=0; j<80; j+=16) { + SHA512_STEP( 0, j); + SHA512_STEP( 1, j); + SHA512_STEP( 2, j); + SHA512_STEP( 3, j); + SHA512_STEP( 4, j); + SHA512_STEP( 5, j); + SHA512_STEP( 6, j); + SHA512_STEP( 7, j); + SHA512_STEP( 8, j); + SHA512_STEP( 9, j); + SHA512_STEP(10, j); + SHA512_STEP(11, j); + SHA512_STEP(12, j); + SHA512_STEP(13, j); + SHA512_STEP(14, j); + SHA512_STEP(15, j); + } + + /* update digest */ + digest[0] += v[0]; + digest[1] += v[1]; + digest[2] += v[2]; + digest[3] += v[3]; + digest[4] += v[4]; + digest[5] += v[5]; + digest[6] += v[6]; + digest[7] += v[7]; + } +} +#endif diff --git a/external/crypto_px/sources/ippcp/src/pcphmac.h b/external/crypto_px/sources/ippcp/src/pcphmac.h index 5e55334339..65374dbb87 100644 --- a/external/crypto_px/sources/ippcp/src/pcphmac.h +++ b/external/crypto_px/sources/ippcp/src/pcphmac.h @@ -1,55 +1,55 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_HMAC_H) -#define _PCP_HMAC_H - -#include "pcphash.h" - -/* -// HMAC context -*/ -struct _cpHMAC { - IppCtxId idCtx; /* HMAC identifier */ - Ipp8u ipadKey[MBS_HASH_MAX]; /* inner padding key */ - Ipp8u opadKey[MBS_HASH_MAX]; /* outer padding key */ - IppsHashState hashCtx; /* hash context */ -}; - -/* accessors */ -#define HMAC_CTX_ID(stt) ((stt)->idCtx) -#define HASH_CTX(stt) ((stt)->hashCtx) -#define HMAC_VALID_ID(stt) (HMAC_CTX_ID((stt))==idCtxHMAC) - -#define IPAD (0x36) /* inner padding value */ -#define OPAD (0x5C) /* outer padding value */ - -#endif /* _PCP_HMAC_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_HMAC_H) +#define _PCP_HMAC_H + +#include "pcphash.h" + +/* +// HMAC context +*/ +struct _cpHMAC { + IppCtxId idCtx; /* HMAC identifier */ + Ipp8u ipadKey[MBS_HASH_MAX]; /* inner padding key */ + Ipp8u opadKey[MBS_HASH_MAX]; /* outer padding key */ + IppsHashState hashCtx; /* hash context */ +}; + +/* accessors */ +#define HMAC_CTX_ID(stt) ((stt)->idCtx) +#define HASH_CTX(stt) ((stt)->hashCtx) +#define HMAC_VALID_ID(stt) (HMAC_CTX_ID((stt))==idCtxHMAC) + +#define IPAD (0x36) /* inner padding value */ +#define OPAD (0x5C) /* outer padding value */ + +#endif /* _PCP_HMAC_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcphmacca.c b/external/crypto_px/sources/ippcp/src/pcphmacca.c index 2c45b38291..524d26f49b 100644 --- a/external/crypto_px/sources/ippcp/src/pcphmacca.c +++ b/external/crypto_px/sources/ippcp/src/pcphmacca.c @@ -1,332 +1,332 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphmac.h" -#include "pcptool.h" - -/*F* -// Name: ippsHMAC_GetSize -// -// Purpose: Returns size of HMAC state (bytes). -// -// Returns: Reason: -// ippStsNullPtrErr pSzie == NULL -// ippStsNoErr no errors -// -// Parameters: -// pSize pointer to the HMAC state size -// -*F*/ -IPPFUN(IppStatus, ippsHMAC_GetSize,(int* pSize)) -{ - /* test size's pointer */ - IPP_BAD_PTR1_RET(pSize); - - *pSize = sizeof(IppsHMACState); - return ippStsNoErr; -} - -/*F* -// Name: ippsHMAC_Init -// -// Purpose: Init HMAC state. -// -// Returns: Reason: -// ippStsNullPtrErr pKey == NULL -// pState == NULL -// ippStsLengthErr keyLen <0 -// ippStsNotSupportedModeErr if algID is not match to supported hash alg -// ippStsNoErr no errors -// -// Parameters: -// pKey pointer to the secret key -// keyLen length (bytes) of the secret key -// pState pointer to the HMAC state -// hashAlg hash alg ID -// -*F*/ -IPPFUN(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) -{ - //int mbs; - - /* get algorithm id */ - hashAlg = cpValidHashAlg(hashAlg); - /* test hash alg */ - IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); - //mbs = cpHashMBS(hashAlg); - - /* test pState pointer */ - IPP_BAD_PTR1_RET(pCtx); - - /* test key pointer and key length */ - IPP_BAD_PTR1_RET(pKey); - IPP_BADARG_RET(0>keyLen, ippStsLengthErr); - - /* set state ID */ - HMAC_CTX_ID(pCtx) = idCtxHMAC; - - /* init hash context */ - ippsHashInit(&HASH_CTX(pCtx), hashAlg); - - { - int n; - - /* hash specific */ - IppsHashState* pHashCtx = &HASH_CTX(pCtx); - int mbs = cpHashMBS(hashAlg); - int hashSize = cpHashSize(hashAlg); - - /* copyMask = keyLen>mbs? 0xFF : 0x00 */ - int copyMask = (mbs-keyLen) >>(BITSIZE(int)-1); - - /* actualKeyLen = keyLen>mbs? hashSize:keyLen */ - int actualKeyLen = (hashSize & copyMask) | (keyLen & ~copyMask); - - /* compute hash(key, keyLen) just in case */ - ippsHashUpdate(pKey, keyLen, pHashCtx); - ippsHashFinal(HASH_BUFF(pHashCtx), pHashCtx); - - /* copy either key or hash(key) into ipad- and opad- buffers */ - MASKED_COPY_BNU(pCtx->ipadKey, (Ipp8u)copyMask, HASH_BUFF(pHashCtx), pKey, actualKeyLen); - MASKED_COPY_BNU(pCtx->opadKey, (Ipp8u)copyMask, HASH_BUFF(pHashCtx), pKey, actualKeyLen); - - /* XOR-ing key */ - for(n=0; nipadKey[n] ^= (Ipp8u)IPAD; - pCtx->opadKey[n] ^= (Ipp8u)OPAD; - } - for(; nipadKey[n] = (Ipp8u)IPAD; - pCtx->opadKey[n] = (Ipp8u)OPAD; - } - - /* ipad key processing */ - ippsHashUpdate(pCtx->ipadKey, mbs, pHashCtx); - - return ippStsNoErr; - } -} - -/*F* -// Name: ippsHMAC_Update -// -// Purpose: Updates intermadiate MAC based on input stream. -// -// Returns: Reason: -// ippStsNullPtrErr pSrc == NULL -// pState == NULL -// ippStsContextMatchErr pState->idCtx != idCtxHMAC -// ippStsLengthErr len <0 -// ippStsNoErr no errors -// -// Parameters: -// pSrc pointer to the input stream -// len input stream length -// pState pointer to the HMAC state -// -*F*/ -IPPFUN(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) -{ - /* test state pointers */ - IPP_BAD_PTR1_RET(pCtx); - - /* test state ID */ - IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); - /* test input length */ - IPP_BADARG_RET((len<0), ippStsLengthErr); - /* test source pointer */ - IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); - - if(len) - return ippsHashUpdate(pSrc, len, &HASH_CTX(pCtx)); - else - return ippStsNoErr; -} - -/*F* -// Name: ippsHMAC_Final -// -// Purpose: Stop message digesting and return digest. -// -// Returns: Reason: -// ippStsNullPtrErr pMD == NULL -// pState == NULL -// ippStsContextMatchErr pState->idCtx != idCtxHMAC -// ippStsLengthErr sizeof(DigestMD5) < mdLen <1 -// ippStsNoErr no errors -// -// Parameters: -// pMD address of the output digest -// pState pointer to the HMAC state -// -*F*/ -IPPFUN(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) -{ - /* test state pointer and ID */ - IPP_BAD_PTR1_RET(pCtx); - IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); - - /* test MD pointer and length */ - IPP_BAD_PTR1_RET(pMD); - IPP_BADARG_RET(mdLen<=0, ippStsLengthErr); - - { - /* hash specific */ - IppsHashState* pHashCtx = &HASH_CTX(pCtx); - int mbs = cpHashMBS(HASH_ALG_ID(pHashCtx)); - int hashSize = cpHashSize(HASH_ALG_ID(pHashCtx)); - if(mdLen>hashSize) - IPP_ERROR_RET(ippStsLengthErr); - - /* - // finalize hmac - */ - { - /* finalize 1-st step */ - Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/8]; - IppStatus sts = ippsHashFinal(md, pHashCtx); - - if(ippStsNoErr==sts) { - /* perform outer hash */ - ippsHashUpdate(pCtx->opadKey, mbs, pHashCtx); - ippsHashUpdate(md, hashSize, pHashCtx); - - /* complete HMAC */ - ippsHashFinal(md, pHashCtx); - CopyBlock(md, pMD, IPP_MIN(hashSize, mdLen)); - - /* ready to the next HMAC computation */ - ippsHashUpdate(pCtx->ipadKey, mbs, pHashCtx); - } - - return sts; - } - } -} - -/*F* -// Name: ippsHMAC_GetTag -// -// Purpose: Compute digest with further digesting ability. -// -// Returns: Reason: -// ippStsNullPtrErr pMD == NULL -// pState == NULL -// ippStsContextMatchErr pState->idCtx != idCtxHMAC -// ippStsLengthErr size_of_digest < mdLen <1 -// ippStsNoErr no errors -// -// Parameters: -// pMD address of the output digest -// mdLen length of the digest -// pState pointer to the HMAC state -// -*F*/ -IPPFUN(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) -{ - /* test state pointer and ID */ - IPP_BAD_PTR1_RET(pCtx); - IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); - - /* test MD pointer */ - IPP_BAD_PTR1_RET(pMD); - - { - IppsHMACState tmpCtx; - CopyBlock(pCtx, &tmpCtx, sizeof(IppsHMACState)); - return ippsHMAC_Final(pMD, mdLen, &tmpCtx); - } -} - -/*F* -// Name: ippsHMAC_Message -// -// Purpose: MAC of the whole message. -// -// Returns: Reason: -// ippStsNullPtrErr pMsg == NULL -// pKey == NULL -// pMD == NULL -// ippStsLengthErr msgLen <0 -// keyLen <0 -// size_of_digest < mdLen <1 -// ippStsNotSupportedModeErr if algID is not match to supported hash alg -// ippStsNoErr no errors -// -// Parameters: -// pMsg pointer to the input message -// msgLen input message length -// pKey pointer to the secret key -// keyLen secret key length -// pMD pointer to message digest -// mdLen MD length -// hashAlg hash alg ID -// -*F*/ -IPPFUN(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, - const Ipp8u* pKey, int keyLen, - Ipp8u* pMD, int mdLen, - IppHashAlgId hashAlg)) -{ - /* get algorithm id */ - hashAlg = cpValidHashAlg(hashAlg); - /* test hash alg */ - IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); - - /* test secret key pointer and length */ - IPP_BAD_PTR1_RET(pKey); - IPP_BADARG_RET((keyLen<0), ippStsLengthErr); - - /* test input message pointer and length */ - IPP_BADARG_RET((msgLen<0), ippStsLengthErr); - IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr); - - /* test MD pointer and length */ - IPP_BAD_PTR1_RET(pMD); - IPP_BADARG_RET(0>=mdLen || mdLen>cpHashSize(hashAlg), ippStsLengthErr); - - { - IppsHMACState ctx; - IppStatus sts = ippsHMAC_Init(pKey, keyLen, &ctx, hashAlg); - if(ippStsNoErr!=sts) goto exit; - - sts = ippsHashUpdate(pMsg,msgLen, &HASH_CTX(&ctx)); - if(ippStsNoErr!=sts) goto exit; - - sts = ippsHMAC_Final(pMD, mdLen, &ctx); - - exit: - PurgeBlock(&ctx, sizeof(IppsHMACState)); - return sts; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphmac.h" +#include "pcptool.h" + +/*F* +// Name: ippsHMAC_GetSize +// +// Purpose: Returns size of HMAC state (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr pSzie == NULL +// ippStsNoErr no errors +// +// Parameters: +// pSize pointer to the HMAC state size +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_GetSize,(int* pSize)) +{ + /* test size's pointer */ + IPP_BAD_PTR1_RET(pSize); + + *pSize = sizeof(IppsHMACState); + return ippStsNoErr; +} + +/*F* +// Name: ippsHMAC_Init +// +// Purpose: Init HMAC state. +// +// Returns: Reason: +// ippStsNullPtrErr pKey == NULL +// pState == NULL +// ippStsLengthErr keyLen <0 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pKey pointer to the secret key +// keyLen length (bytes) of the secret key +// pState pointer to the HMAC state +// hashAlg hash alg ID +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Init,(const Ipp8u* pKey, int keyLen, IppsHMACState* pCtx, IppHashAlgId hashAlg)) +{ + //int mbs; + + /* get algorithm id */ + hashAlg = cpValidHashAlg(hashAlg); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + //mbs = cpHashMBS(hashAlg); + + /* test pState pointer */ + IPP_BAD_PTR1_RET(pCtx); + + /* test key pointer and key length */ + IPP_BAD_PTR1_RET(pKey); + IPP_BADARG_RET(0>keyLen, ippStsLengthErr); + + /* set state ID */ + HMAC_CTX_ID(pCtx) = idCtxHMAC; + + /* init hash context */ + ippsHashInit(&HASH_CTX(pCtx), hashAlg); + + { + int n; + + /* hash specific */ + IppsHashState* pHashCtx = &HASH_CTX(pCtx); + int mbs = cpHashMBS(hashAlg); + int hashSize = cpHashSize(hashAlg); + + /* copyMask = keyLen>mbs? 0xFF : 0x00 */ + int copyMask = (mbs-keyLen) >>(BITSIZE(int)-1); + + /* actualKeyLen = keyLen>mbs? hashSize:keyLen */ + int actualKeyLen = (hashSize & copyMask) | (keyLen & ~copyMask); + + /* compute hash(key, keyLen) just in case */ + ippsHashUpdate(pKey, keyLen, pHashCtx); + ippsHashFinal(HASH_BUFF(pHashCtx), pHashCtx); + + /* copy either key or hash(key) into ipad- and opad- buffers */ + MASKED_COPY_BNU(pCtx->ipadKey, (Ipp8u)copyMask, HASH_BUFF(pHashCtx), pKey, actualKeyLen); + MASKED_COPY_BNU(pCtx->opadKey, (Ipp8u)copyMask, HASH_BUFF(pHashCtx), pKey, actualKeyLen); + + /* XOR-ing key */ + for(n=0; nipadKey[n] ^= (Ipp8u)IPAD; + pCtx->opadKey[n] ^= (Ipp8u)OPAD; + } + for(; nipadKey[n] = (Ipp8u)IPAD; + pCtx->opadKey[n] = (Ipp8u)OPAD; + } + + /* ipad key processing */ + ippsHashUpdate(pCtx->ipadKey, mbs, pHashCtx); + + return ippStsNoErr; + } +} + +/*F* +// Name: ippsHMAC_Update +// +// Purpose: Updates intermadiate MAC based on input stream. +// +// Returns: Reason: +// ippStsNullPtrErr pSrc == NULL +// pState == NULL +// ippStsContextMatchErr pState->idCtx != idCtxHMAC +// ippStsLengthErr len <0 +// ippStsNoErr no errors +// +// Parameters: +// pSrc pointer to the input stream +// len input stream length +// pState pointer to the HMAC state +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Update,(const Ipp8u* pSrc, int len, IppsHMACState* pCtx)) +{ + /* test state pointers */ + IPP_BAD_PTR1_RET(pCtx); + + /* test state ID */ + IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); + /* test input length */ + IPP_BADARG_RET((len<0), ippStsLengthErr); + /* test source pointer */ + IPP_BADARG_RET((len && !pSrc), ippStsNullPtrErr); + + if(len) + return ippsHashUpdate(pSrc, len, &HASH_CTX(pCtx)); + else + return ippStsNoErr; +} + +/*F* +// Name: ippsHMAC_Final +// +// Purpose: Stop message digesting and return digest. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pState == NULL +// ippStsContextMatchErr pState->idCtx != idCtxHMAC +// ippStsLengthErr sizeof(DigestMD5) < mdLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pMD address of the output digest +// pState pointer to the HMAC state +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Final,(Ipp8u* pMD, int mdLen, IppsHMACState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); + + /* test MD pointer and length */ + IPP_BAD_PTR1_RET(pMD); + IPP_BADARG_RET(mdLen<=0, ippStsLengthErr); + + { + /* hash specific */ + IppsHashState* pHashCtx = &HASH_CTX(pCtx); + int mbs = cpHashMBS(HASH_ALG_ID(pHashCtx)); + int hashSize = cpHashSize(HASH_ALG_ID(pHashCtx)); + if(mdLen>hashSize) + IPP_ERROR_RET(ippStsLengthErr); + + /* + // finalize hmac + */ + { + /* finalize 1-st step */ + Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/8]; + IppStatus sts = ippsHashFinal(md, pHashCtx); + + if(ippStsNoErr==sts) { + /* perform outer hash */ + ippsHashUpdate(pCtx->opadKey, mbs, pHashCtx); + ippsHashUpdate(md, hashSize, pHashCtx); + + /* complete HMAC */ + ippsHashFinal(md, pHashCtx); + CopyBlock(md, pMD, IPP_MIN(hashSize, mdLen)); + + /* ready to the next HMAC computation */ + ippsHashUpdate(pCtx->ipadKey, mbs, pHashCtx); + } + + return sts; + } + } +} + +/*F* +// Name: ippsHMAC_GetTag +// +// Purpose: Compute digest with further digesting ability. +// +// Returns: Reason: +// ippStsNullPtrErr pMD == NULL +// pState == NULL +// ippStsContextMatchErr pState->idCtx != idCtxHMAC +// ippStsLengthErr size_of_digest < mdLen <1 +// ippStsNoErr no errors +// +// Parameters: +// pMD address of the output digest +// mdLen length of the digest +// pState pointer to the HMAC state +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_GetTag,(Ipp8u* pMD, int mdLen, const IppsHMACState* pCtx)) +{ + /* test state pointer and ID */ + IPP_BAD_PTR1_RET(pCtx); + IPP_BADARG_RET(!HMAC_VALID_ID(pCtx), ippStsContextMatchErr); + + /* test MD pointer */ + IPP_BAD_PTR1_RET(pMD); + + { + IppsHMACState tmpCtx; + CopyBlock(pCtx, &tmpCtx, sizeof(IppsHMACState)); + return ippsHMAC_Final(pMD, mdLen, &tmpCtx); + } +} + +/*F* +// Name: ippsHMAC_Message +// +// Purpose: MAC of the whole message. +// +// Returns: Reason: +// ippStsNullPtrErr pMsg == NULL +// pKey == NULL +// pMD == NULL +// ippStsLengthErr msgLen <0 +// keyLen <0 +// size_of_digest < mdLen <1 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pMsg pointer to the input message +// msgLen input message length +// pKey pointer to the secret key +// keyLen secret key length +// pMD pointer to message digest +// mdLen MD length +// hashAlg hash alg ID +// +*F*/ +IPPFUN(IppStatus, ippsHMAC_Message,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pKey, int keyLen, + Ipp8u* pMD, int mdLen, + IppHashAlgId hashAlg)) +{ + /* get algorithm id */ + hashAlg = cpValidHashAlg(hashAlg); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* test secret key pointer and length */ + IPP_BAD_PTR1_RET(pKey); + IPP_BADARG_RET((keyLen<0), ippStsLengthErr); + + /* test input message pointer and length */ + IPP_BADARG_RET((msgLen<0), ippStsLengthErr); + IPP_BADARG_RET((msgLen && !pMsg), ippStsNullPtrErr); + + /* test MD pointer and length */ + IPP_BAD_PTR1_RET(pMD); + IPP_BADARG_RET(0>=mdLen || mdLen>cpHashSize(hashAlg), ippStsLengthErr); + + { + IppsHMACState ctx; + IppStatus sts = ippsHMAC_Init(pKey, keyLen, &ctx, hashAlg); + if(ippStsNoErr!=sts) goto exit; + + sts = ippsHashUpdate(pMsg,msgLen, &HASH_CTX(&ctx)); + if(ippStsNoErr!=sts) goto exit; + + sts = ippsHMAC_Final(pMD, mdLen, &ctx); + + exit: + PurgeBlock(&ctx, sizeof(IppsHMACState)); + return sts; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c b/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c index f7708ed648..fdc43b5127 100644 --- a/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c +++ b/external/crypto_px/sources/ippcp/src/pcpmontexpbinca.c @@ -1,116 +1,116 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpmontgomery.h" - - -/* -// Binary method of Exponentiation -*/ -cpSize cpMontExpBin_BNU(BNU_CHUNK_T* dataY, - const BNU_CHUNK_T* dataX, cpSize nsX, - const BNU_CHUNK_T* dataE, cpSize nsE, - IppsMontState* pMont) -{ - cpSize nsM = MNT_SIZE(pMont); - - /* - // test for special cases: - // x^0 = 1 - // 0^e = 0 - */ - if( cpEqu_BNU_CHUNK(dataE, nsE, 0) ) { - COPY_BNU(dataY, MNT_1(pMont), nsM); - } - else if( cpEqu_BNU_CHUNK(dataX, nsX, 0) ) { - ZEXPAND_BNU(dataY, 0, nsM); - } - - /* general case */ - else { - BNU_CHUNK_T* dataM = MNT_MODULUS(pMont); - BNU_CHUNK_T m0 = MNT_HELPER(pMont); - - /* Montgomery engine buffers */ - BNU_CHUNK_T* pKBuffer = MNT_KBUFFER(pMont); - BNU_CHUNK_T* pProduct = MNT_PRODUCT(pMont); - - BNU_CHUNK_T* dataT = MNT_TBUFFER(pMont); - - /* execute most significant part pE */ - BNU_CHUNK_T eValue = dataE[nsE-1]; - int n = cpNLZ_BNU(eValue)+1; - - /* expand base and init result */ - ZEXPAND_COPY_BNU(dataT, nsM, dataX, nsX); - COPY_BNU(dataY, dataT, nsM); - - eValue <<= n; - for(; n0; nsE--) { - eValue = dataE[nsE-1]; - - for(n=0; n0; nsE--) { + eValue = dataE[nsE-1]; + + for(n=0; nidCtx) -#define MNT_ROOM(eng) ((eng)->maxLen) -#define MNT_SIZE(eng) ((eng)->modLen) -#define MNT_HELPER(eng) ((eng)->m0) -#define MNT_MODULUS(eng) ((eng)->pModulus) -#define MNT_1(eng) ((eng)->pIdentity) -#define MNT_IDENT_R(eng) (MNT_1((eng))) -#define MNT_SQUARE_R(eng) ((eng)->pSquare) -#define MNT_CUBE_R(eng) ((eng)->pCube) -#define MNT_TBUFFER(eng) ((eng)->pTBuffer) -#define MNT_SBUFFER(eng) ((eng)->pSBuffer) -#define MNT_PRODUCT(eng) ((eng)->pProduct) -#define MNT_KBUFFER(eng) ((eng)->pKBuffer) - -#define MNT_VALID_ID(eng) (MNT_ID((eng))==idCtxMontgomery) - -/* default methos */ -#define EXPONENT_METHOD (ippBinaryMethod) - -/* alignment */ -#define MONT_ALIGNMENT ((int)(sizeof(void*))) - - -/* -// Pacp/unpack Montgomery context -*/ -void cpPackMontCtx(const IppsMontState* pCtx, Ipp8u* pBuffer); -void cpUnpackMontCtx(const Ipp8u* pBuffer, IppsMontState* pCtx); - - -/* -// Montgomery reduction, multiplication and squaring -*/ -void cpMontRedAdc_BNU(BNU_CHUNK_T* pR, - BNU_CHUNK_T* pProduct, - const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0); - -__INLINE void cpMontRed_BNU(BNU_CHUNK_T* pR, - BNU_CHUNK_T* pProduct, - const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0) -{ - cpMontRedAdc_BNU(pR, pProduct, pModulus, nsM, m0); -} - -__INLINE void cpMontMul_BNU(BNU_CHUNK_T* pR, - const BNU_CHUNK_T* pX, cpSize nsX, - const BNU_CHUNK_T* pY, cpSize nsY, - const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0, - BNU_CHUNK_T* pProduct, BNU_CHUNK_T* pKBuffer) -{ - cpMul_BNU(pProduct, pX,nsX, pY,nsY, pKBuffer); - ZEXPAND_BNU(pProduct,nsX+nsY, 2*nsM); - cpMontRed_BNU(pR, pProduct, pModulus, nsM, m0); -} - -__INLINE void cpMontSqr_BNU(BNU_CHUNK_T* pR, - const BNU_CHUNK_T* pX, cpSize nsX, - const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0, - BNU_CHUNK_T* pProduct, BNU_CHUNK_T* pKBuffer) -{ - cpSqr_BNU(pProduct, pX,nsX, pKBuffer); - ZEXPAND_BNU(pProduct, 2*nsX, 2*nsM); - cpMontRed_BNU(pR, pProduct, pModulus, nsM, m0); -} - -/* -// Montgomery encoding/decoding -*/ -__INLINE cpSize cpMontEnc_BNU(BNU_CHUNK_T* pR, - const BNU_CHUNK_T* pXreg, cpSize nsX, - IppsMontState* pMont) -{ - cpSize nsM = MNT_SIZE(pMont); - cpMontMul_BNU(pR, - pXreg, nsX, MNT_SQUARE_R(pMont), nsM, - MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), - MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); - - FIX_BNU(pR, nsM); - return nsM; -} - -__INLINE cpSize cpMontDec_BNU(BNU_CHUNK_T* pR, - const BNU_CHUNK_T* pXmont, cpSize nsX, - IppsMontState* pMont) -{ - cpSize nsM = MNT_SIZE(pMont); - ZEXPAND_COPY_BNU(MNT_PRODUCT(pMont), 2*nsM, pXmont, nsX); - - cpMontRed_BNU(pR, MNT_PRODUCT(pMont), MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); - - FIX_BNU(pR, nsM); - return nsM; -} - -__INLINE void cpMontEnc_BN(IppsBigNumState* pRbn, - const IppsBigNumState* pXbn, - IppsMontState* pMont) -{ - BNU_CHUNK_T* pR = BN_NUMBER(pRbn); - cpSize nsM = MNT_SIZE(pMont); - cpMontMul_BNU(pR, - BN_NUMBER(pXbn), BN_SIZE(pXbn), - MNT_SQUARE_R(pMont), nsM, - MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), - MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); - - FIX_BNU(pR, nsM); - BN_SIZE(pRbn) = nsM; - BN_SIGN(pRbn) = ippBigNumPOS; -} - -__INLINE void cpMontDec_BN(IppsBigNumState* pRbn, - const IppsBigNumState* pXbn, - IppsMontState* pMont) -{ - BNU_CHUNK_T* pR = BN_NUMBER(pRbn); - cpSize nsM = MNT_SIZE(pMont); - ZEXPAND_COPY_BNU(MNT_PRODUCT(pMont), 2*nsM, BN_NUMBER(pXbn), BN_SIZE(pXbn)); - - cpMontRed_BNU(pR, MNT_PRODUCT(pMont), MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); - - FIX_BNU(pR, nsM); - BN_SIZE(pRbn) = nsM; - BN_SIGN(pRbn) = ippBigNumPOS; -} - -/* -// Montgomery exponentiation (binary) -*/ -cpSize cpMontExpBin_BNU(BNU_CHUNK_T* pY, - const BNU_CHUNK_T* pX, cpSize nsX, - const BNU_CHUNK_T* pE, cpSize nsE, - IppsMontState* pMont); - -#endif /* _CP_MONTGOMETRY_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_MONTGOMETRY_H) +#define _CP_MONTGOMETRY_H + +/* +// Montgomery spec structure +*/ +struct _cpMontgomery +{ + IppCtxId idCtx; /* Montgomery spec identifier */ + cpSize maxLen; /* maximum length of modulus being stored */ + cpSize modLen; /* length of modulus (and R = b^modLen) */ + BNU_CHUNK_T m0; /* low word of (1/modulus) mod R */ + BNU_CHUNK_T* pModulus; /* modulus (of modLen BNU_CHUNK_T size) */ + BNU_CHUNK_T* pIdentity; /* mont_enc(1) */ + BNU_CHUNK_T* pSquare; /* mont_enc(R^2) */ + BNU_CHUNK_T* pCube; /* mont_enc(R^3) */ + BNU_CHUNK_T* pTBuffer; /* internal buffer modLen BNU_CHUNK_T */ + BNU_CHUNK_T* pSBuffer; /* internal buffer modLen BNU_CHUNK_T */ + BNU_CHUNK_T* pProduct; /* internal product (2*modLen BNU_CHUNK_T)*/ + BNU_CHUNK_T* pKBuffer; /* mul/sqr buffer (Karatsuba method used) */ +}; + +/* accessory macros */ +#define MNT_ID(eng) ((eng)->idCtx) +#define MNT_ROOM(eng) ((eng)->maxLen) +#define MNT_SIZE(eng) ((eng)->modLen) +#define MNT_HELPER(eng) ((eng)->m0) +#define MNT_MODULUS(eng) ((eng)->pModulus) +#define MNT_1(eng) ((eng)->pIdentity) +#define MNT_IDENT_R(eng) (MNT_1((eng))) +#define MNT_SQUARE_R(eng) ((eng)->pSquare) +#define MNT_CUBE_R(eng) ((eng)->pCube) +#define MNT_TBUFFER(eng) ((eng)->pTBuffer) +#define MNT_SBUFFER(eng) ((eng)->pSBuffer) +#define MNT_PRODUCT(eng) ((eng)->pProduct) +#define MNT_KBUFFER(eng) ((eng)->pKBuffer) + +#define MNT_VALID_ID(eng) (MNT_ID((eng))==idCtxMontgomery) + +/* default methos */ +#define EXPONENT_METHOD (ippBinaryMethod) + +/* alignment */ +#define MONT_ALIGNMENT ((int)(sizeof(void*))) + + +/* +// Pacp/unpack Montgomery context +*/ +void cpPackMontCtx(const IppsMontState* pCtx, Ipp8u* pBuffer); +void cpUnpackMontCtx(const Ipp8u* pBuffer, IppsMontState* pCtx); + + +/* +// Montgomery reduction, multiplication and squaring +*/ +void cpMontRedAdc_BNU(BNU_CHUNK_T* pR, + BNU_CHUNK_T* pProduct, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0); + +__INLINE void cpMontRed_BNU(BNU_CHUNK_T* pR, + BNU_CHUNK_T* pProduct, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0) +{ + cpMontRedAdc_BNU(pR, pProduct, pModulus, nsM, m0); +} + +__INLINE void cpMontMul_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pY, cpSize nsY, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0, + BNU_CHUNK_T* pProduct, BNU_CHUNK_T* pKBuffer) +{ + cpMul_BNU(pProduct, pX,nsX, pY,nsY, pKBuffer); + ZEXPAND_BNU(pProduct,nsX+nsY, 2*nsM); + cpMontRed_BNU(pR, pProduct, pModulus, nsM, m0); +} + +__INLINE void cpMontSqr_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0, + BNU_CHUNK_T* pProduct, BNU_CHUNK_T* pKBuffer) +{ + cpSqr_BNU(pProduct, pX,nsX, pKBuffer); + ZEXPAND_BNU(pProduct, 2*nsX, 2*nsM); + cpMontRed_BNU(pR, pProduct, pModulus, nsM, m0); +} + +/* +// Montgomery encoding/decoding +*/ +__INLINE cpSize cpMontEnc_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXreg, cpSize nsX, + IppsMontState* pMont) +{ + cpSize nsM = MNT_SIZE(pMont); + cpMontMul_BNU(pR, + pXreg, nsX, MNT_SQUARE_R(pMont), nsM, + MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), + MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); + + FIX_BNU(pR, nsM); + return nsM; +} + +__INLINE cpSize cpMontDec_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXmont, cpSize nsX, + IppsMontState* pMont) +{ + cpSize nsM = MNT_SIZE(pMont); + ZEXPAND_COPY_BNU(MNT_PRODUCT(pMont), 2*nsM, pXmont, nsX); + + cpMontRed_BNU(pR, MNT_PRODUCT(pMont), MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); + + FIX_BNU(pR, nsM); + return nsM; +} + +__INLINE void cpMontEnc_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + IppsMontState* pMont) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + cpMontMul_BNU(pR, + BN_NUMBER(pXbn), BN_SIZE(pXbn), + MNT_SQUARE_R(pMont), nsM, + MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), + MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + +__INLINE void cpMontDec_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + IppsMontState* pMont) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + ZEXPAND_COPY_BNU(MNT_PRODUCT(pMont), 2*nsM, BN_NUMBER(pXbn), BN_SIZE(pXbn)); + + cpMontRed_BNU(pR, MNT_PRODUCT(pMont), MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + +/* +// Montgomery exponentiation (binary) +*/ +cpSize cpMontExpBin_BNU(BNU_CHUNK_T* pY, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pE, cpSize nsE, + IppsMontState* pMont); + +#endif /* _CP_MONTGOMETRY_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c b/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c index f82147cfb2..8459fd0249 100644 --- a/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c +++ b/external/crypto_px/sources/ippcp/src/pcpmontgomeryca.c @@ -1,296 +1,296 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpmontgomery.h" -#include "pcptool.h" - -/*F* -// Name: ippsMontGetSize -// -// Purpose: Specifies size of buffer in bytes. -// -// Returns: Reason: -// ippStsNullPtrErr pCtxSize==NULL -// ippStsLengthErr maxLen32 < 1 -// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) -// ippStsNoErr no errors -// -// Parameters: -// method selected exponential method (unused parameter) -// maxLen32 max modulus length (in Ipp32u chunks) -// pCtxSize size of context -// -// Notes: Function always use method=ippBinaryMethod, -// so this parameter is ignored -*F*/ -IPPFUN(IppStatus, ippsMontGetSize, (IppsExpMethod method, cpSize maxLen32, cpSize* pCtxSize)) -{ - IPP_BAD_PTR1_RET(pCtxSize); - IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); - - UNREFERENCED_PARAMETER(method); - - { - /* convert modulus length to the number of BNU_CHUNK_T */ - cpSize modSize = INTERNAL_BNU_LENGTH(maxLen32); - - *pCtxSize= sizeof(IppsMontState) - + modSize*sizeof(BNU_CHUNK_T) /* modulus */ - + modSize*sizeof(BNU_CHUNK_T) /* identity */ - + modSize*sizeof(BNU_CHUNK_T) /* square R */ - + modSize*sizeof(BNU_CHUNK_T) /* cube R */ - + modSize*sizeof(BNU_CHUNK_T) /* internal buffer */ - + modSize*sizeof(BNU_CHUNK_T) /* internal sscm buffer */ - + modSize*sizeof(BNU_CHUNK_T)*2 /* internal product */ - + MONT_ALIGNMENT-1; - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsMontInit -// -// Purpose: Initializes the symbolic data structure and partitions the -// specified buffer space. -// -// Returns: Reason: -// ippStsNullPtrErr pMont==NULL -// ippStsLengthErr maxLen32 < 1 -// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) -// ippStsNoErr no errors -// -// Parameters: -// method selected exponential method (unused parameter) -// maxLen32 max modulus length (in Ipp32u chunks) -// pMont pointer to Montgomery context -*F*/ -IPPFUN(IppStatus, ippsMontInit,(IppsExpMethod method, int maxLen32, IppsMontState* pMont)) -{ - IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); - - IPP_BAD_PTR1_RET(pMont); - pMont = (IppsMontState*)( IPP_ALIGNED_PTR(pMont, MONT_ALIGNMENT) ); - - UNREFERENCED_PARAMETER(method); - - MNT_ID(pMont) = idCtxUnknown; - MNT_ROOM(pMont) = INTERNAL_BNU_LENGTH(maxLen32); - MNT_SIZE(pMont) = 0; - MNT_HELPER(pMont) = 0; - - { - Ipp8u* ptr = (Ipp8u*)pMont; - - /* convert modulus length to the number of BNU_CHUNK_T */ - cpSize modSize = MNT_ROOM(pMont); - - /* assign internal buffers */ - MNT_MODULUS(pMont) = (BNU_CHUNK_T*)( ptr += sizeof(IppsMontState) ); - - MNT_1(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); - MNT_SQUARE_R(pMont)= (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); - MNT_CUBE_R(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); - - MNT_TBUFFER(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); - MNT_SBUFFER(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); - MNT_PRODUCT(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); - MNT_KBUFFER(pMont) = (BNU_CHUNK_T*)NULL; - - /* init internal buffers */ - ZEXPAND_BNU(MNT_MODULUS(pMont), 0, modSize); - ZEXPAND_BNU(MNT_1(pMont), 0, modSize); - ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, modSize); - ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, modSize); - - MNT_ID(pMont) = idCtxMontgomery; - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsMontSet -// -// Purpose: Setup modulus value -// -// Returns: Reason: -// ippStsNullPtrErr pMont==NULL -// pModulus==NULL -// ippStsContextMatchErr !MNT_VALID_ID() -// ippStsLengthErr len32<1 -// ippStsNoErr no errors -// -// Parameters: -// pModulus pointer to the modulus buffer -// len32 length of the modulus (in Ipp32u chunks). -// pMont pointer to the context -*F*/ -static BNU_CHUNK_T cpMontHelper(BNU_CHUNK_T m0) -{ - BNU_CHUNK_T y = 1; - BNU_CHUNK_T x = 2; - BNU_CHUNK_T mask = 2*x-1; - - int i; - for(i=2; i<=BNU_CHUNK_BITS; i++, x<<=1) { - BNU_CHUNK_T rH, rL; - MUL_AB(rH, rL, m0, y); - if( x < (rL & mask) ) /* x < ((m0*y) mod (2*x)) */ - y+=x; - mask += mask + 1; - } - return 0-y; -} - -IPPFUN(IppStatus, ippsMontSet,(const Ipp32u* pModulus, cpSize len32, IppsMontState* pMont)) -{ - IPP_BAD_PTR2_RET(pModulus, pMont); - pMont = (IppsMontState*)(IPP_ALIGNED_PTR((pMont), MONT_ALIGNMENT)); - IPP_BADARG_RET(!MNT_VALID_ID(pMont), ippStsContextMatchErr); - - IPP_BADARG_RET(len32<1, ippStsLengthErr); - - /* modulus is not an odd number */ - IPP_BADARG_RET((pModulus[0] & 1) == 0, ippStsBadModulusErr); - IPP_BADARG_RET(MNT_ROOM(pMont)<(int)(INTERNAL_BNU_LENGTH(len32)), ippStsOutOfRangeErr); - - { - BNU_CHUNK_T m0; - cpSize len; - - /* fix input modulus */ - FIX_BNU(pModulus, len32); - - /* store modulus */ - ZEXPAND_BNU(MNT_MODULUS(pMont), 0, MNT_ROOM(pMont)); - COPY_BNU((Ipp32u*)(MNT_MODULUS(pMont)), pModulus, len32); - /* store modulus length */ - len = INTERNAL_BNU_LENGTH(len32); - MNT_SIZE(pMont) = len; - - /* pre-compute helper m0, m0*m = -1 mod R */ - m0 = cpMontHelper(MNT_MODULUS(pMont)[0]); - MNT_HELPER(pMont) = m0; - - /* setup identity */ - ZEXPAND_BNU(MNT_1(pMont), 0, len); - MNT_1(pMont)[len] = 1; - cpMod_BNU(MNT_1(pMont), len+1, MNT_MODULUS(pMont), len); - - /* setup square */ - ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, len); - COPY_BNU(MNT_SQUARE_R(pMont)+len, MNT_1(pMont), len); - cpMod_BNU(MNT_SQUARE_R(pMont), 2*len, MNT_MODULUS(pMont), len); - - /* setup cube */ - ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, len); - COPY_BNU(MNT_CUBE_R(pMont)+len, MNT_SQUARE_R(pMont), len); - cpMod_BNU(MNT_CUBE_R(pMont), 2*len, MNT_MODULUS(pMont), len); - - /* clear buffers */ - ZEXPAND_BNU(MNT_TBUFFER(pMont), 0, len); - ZEXPAND_BNU(MNT_SBUFFER(pMont), 0, len); - ZEXPAND_BNU(MNT_PRODUCT(pMont), 0, 2*len); - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsMontMul -// -// Purpose: Computes Montgomery modular multiplication for positive big -// number integers of Montgomery form. The following pseudocode -// represents this function: -// r <- ( a * b * R^(-1) ) mod m -// -// Returns: Reason: -// ippStsNoErr Returns no error. -// ippStsNullPtrErr Returns an error when pointers are null. -// ippStsBadArgErr Returns an error when a or b is a negative integer. -// ippStsScaleRangeErr Returns an error when a or b is more than m. -// ippStsOutOfRangeErr Returns an error when IppsBigNumState *r is larger than -// IppsMontState *m. -// ippStsContextMatchErr Returns an error when the context parameter does -// not match the operation. -// -// Parameters: -// a Multiplicand within the range [0, m - 1]. -// b Multiplier within the range [0, m - 1]. -// m Modulus. -// r Montgomery multiplication result. -// -// Notes: The size of IppsBigNumState *r should not be less than the data -// length of the modulus m. -*F*/ -IPPFUN(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* pMont, IppsBigNumState* pR)) -{ - IPP_BAD_PTR4_RET(pA, pB, pMont, pR); - - pMont = (IppsMontState*)(IPP_ALIGNED_PTR((pMont), MONT_ALIGNMENT)); - pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); - pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); - pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); - - IPP_BADARG_RET(!MNT_VALID_ID(pMont), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); - IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); - - IPP_BADARG_RET(BN_NEGATIVE(pA) || BN_NEGATIVE(pB), ippStsBadArgErr); - IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), MNT_MODULUS(pMont), MNT_SIZE(pMont)) >= 0, ippStsScaleRangeErr); - IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pB), BN_SIZE(pB), MNT_MODULUS(pMont), MNT_SIZE(pMont)) >= 0, ippStsScaleRangeErr); - IPP_BADARG_RET(BN_ROOM(pR) < MNT_SIZE(pMont), ippStsOutOfRangeErr); - - { - BNU_CHUNK_T* pDataR = BN_NUMBER(pR); - cpSize nsM = MNT_SIZE(pMont); - - cpMontMul_BNU(pDataR, - BN_NUMBER(pA), BN_SIZE(pA), - BN_NUMBER(pB), BN_SIZE(pB), - MNT_MODULUS(pMont), nsM, - MNT_HELPER(pMont), - MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); - - FIX_BNU(pDataR, nsM); - BN_SIZE(pR) = nsM; - BN_SIGN(pR) = ippBigNumPOS; - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpmontgomery.h" +#include "pcptool.h" + +/*F* +// Name: ippsMontGetSize +// +// Purpose: Specifies size of buffer in bytes. +// +// Returns: Reason: +// ippStsNullPtrErr pCtxSize==NULL +// ippStsLengthErr maxLen32 < 1 +// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// method selected exponential method (unused parameter) +// maxLen32 max modulus length (in Ipp32u chunks) +// pCtxSize size of context +// +// Notes: Function always use method=ippBinaryMethod, +// so this parameter is ignored +*F*/ +IPPFUN(IppStatus, ippsMontGetSize, (IppsExpMethod method, cpSize maxLen32, cpSize* pCtxSize)) +{ + IPP_BAD_PTR1_RET(pCtxSize); + IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + + UNREFERENCED_PARAMETER(method); + + { + /* convert modulus length to the number of BNU_CHUNK_T */ + cpSize modSize = INTERNAL_BNU_LENGTH(maxLen32); + + *pCtxSize= sizeof(IppsMontState) + + modSize*sizeof(BNU_CHUNK_T) /* modulus */ + + modSize*sizeof(BNU_CHUNK_T) /* identity */ + + modSize*sizeof(BNU_CHUNK_T) /* square R */ + + modSize*sizeof(BNU_CHUNK_T) /* cube R */ + + modSize*sizeof(BNU_CHUNK_T) /* internal buffer */ + + modSize*sizeof(BNU_CHUNK_T) /* internal sscm buffer */ + + modSize*sizeof(BNU_CHUNK_T)*2 /* internal product */ + + MONT_ALIGNMENT-1; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsMontInit +// +// Purpose: Initializes the symbolic data structure and partitions the +// specified buffer space. +// +// Returns: Reason: +// ippStsNullPtrErr pMont==NULL +// ippStsLengthErr maxLen32 < 1 +// maxLen32 > BITS2WORD32_SIZE(BN_MAXBITSIZE) +// ippStsNoErr no errors +// +// Parameters: +// method selected exponential method (unused parameter) +// maxLen32 max modulus length (in Ipp32u chunks) +// pMont pointer to Montgomery context +*F*/ +IPPFUN(IppStatus, ippsMontInit,(IppsExpMethod method, int maxLen32, IppsMontState* pMont)) +{ + IPP_BADARG_RET(maxLen32<1 || maxLen32>BITS2WORD32_SIZE(BN_MAXBITSIZE), ippStsLengthErr); + + IPP_BAD_PTR1_RET(pMont); + pMont = (IppsMontState*)( IPP_ALIGNED_PTR(pMont, MONT_ALIGNMENT) ); + + UNREFERENCED_PARAMETER(method); + + MNT_ID(pMont) = idCtxUnknown; + MNT_ROOM(pMont) = INTERNAL_BNU_LENGTH(maxLen32); + MNT_SIZE(pMont) = 0; + MNT_HELPER(pMont) = 0; + + { + Ipp8u* ptr = (Ipp8u*)pMont; + + /* convert modulus length to the number of BNU_CHUNK_T */ + cpSize modSize = MNT_ROOM(pMont); + + /* assign internal buffers */ + MNT_MODULUS(pMont) = (BNU_CHUNK_T*)( ptr += sizeof(IppsMontState) ); + + MNT_1(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_SQUARE_R(pMont)= (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_CUBE_R(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + + MNT_TBUFFER(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_SBUFFER(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_PRODUCT(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_KBUFFER(pMont) = (BNU_CHUNK_T*)NULL; + + /* init internal buffers */ + ZEXPAND_BNU(MNT_MODULUS(pMont), 0, modSize); + ZEXPAND_BNU(MNT_1(pMont), 0, modSize); + ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, modSize); + ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, modSize); + + MNT_ID(pMont) = idCtxMontgomery; + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsMontSet +// +// Purpose: Setup modulus value +// +// Returns: Reason: +// ippStsNullPtrErr pMont==NULL +// pModulus==NULL +// ippStsContextMatchErr !MNT_VALID_ID() +// ippStsLengthErr len32<1 +// ippStsNoErr no errors +// +// Parameters: +// pModulus pointer to the modulus buffer +// len32 length of the modulus (in Ipp32u chunks). +// pMont pointer to the context +*F*/ +static BNU_CHUNK_T cpMontHelper(BNU_CHUNK_T m0) +{ + BNU_CHUNK_T y = 1; + BNU_CHUNK_T x = 2; + BNU_CHUNK_T mask = 2*x-1; + + int i; + for(i=2; i<=BNU_CHUNK_BITS; i++, x<<=1) { + BNU_CHUNK_T rH, rL; + MUL_AB(rH, rL, m0, y); + if( x < (rL & mask) ) /* x < ((m0*y) mod (2*x)) */ + y+=x; + mask += mask + 1; + } + return 0-y; +} + +IPPFUN(IppStatus, ippsMontSet,(const Ipp32u* pModulus, cpSize len32, IppsMontState* pMont)) +{ + IPP_BAD_PTR2_RET(pModulus, pMont); + pMont = (IppsMontState*)(IPP_ALIGNED_PTR((pMont), MONT_ALIGNMENT)); + IPP_BADARG_RET(!MNT_VALID_ID(pMont), ippStsContextMatchErr); + + IPP_BADARG_RET(len32<1, ippStsLengthErr); + + /* modulus is not an odd number */ + IPP_BADARG_RET((pModulus[0] & 1) == 0, ippStsBadModulusErr); + IPP_BADARG_RET(MNT_ROOM(pMont)<(int)(INTERNAL_BNU_LENGTH(len32)), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T m0; + cpSize len; + + /* fix input modulus */ + FIX_BNU(pModulus, len32); + + /* store modulus */ + ZEXPAND_BNU(MNT_MODULUS(pMont), 0, MNT_ROOM(pMont)); + COPY_BNU((Ipp32u*)(MNT_MODULUS(pMont)), pModulus, len32); + /* store modulus length */ + len = INTERNAL_BNU_LENGTH(len32); + MNT_SIZE(pMont) = len; + + /* pre-compute helper m0, m0*m = -1 mod R */ + m0 = cpMontHelper(MNT_MODULUS(pMont)[0]); + MNT_HELPER(pMont) = m0; + + /* setup identity */ + ZEXPAND_BNU(MNT_1(pMont), 0, len); + MNT_1(pMont)[len] = 1; + cpMod_BNU(MNT_1(pMont), len+1, MNT_MODULUS(pMont), len); + + /* setup square */ + ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, len); + COPY_BNU(MNT_SQUARE_R(pMont)+len, MNT_1(pMont), len); + cpMod_BNU(MNT_SQUARE_R(pMont), 2*len, MNT_MODULUS(pMont), len); + + /* setup cube */ + ZEXPAND_BNU(MNT_CUBE_R(pMont), 0, len); + COPY_BNU(MNT_CUBE_R(pMont)+len, MNT_SQUARE_R(pMont), len); + cpMod_BNU(MNT_CUBE_R(pMont), 2*len, MNT_MODULUS(pMont), len); + + /* clear buffers */ + ZEXPAND_BNU(MNT_TBUFFER(pMont), 0, len); + ZEXPAND_BNU(MNT_SBUFFER(pMont), 0, len); + ZEXPAND_BNU(MNT_PRODUCT(pMont), 0, 2*len); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsMontMul +// +// Purpose: Computes Montgomery modular multiplication for positive big +// number integers of Montgomery form. The following pseudocode +// represents this function: +// r <- ( a * b * R^(-1) ) mod m +// +// Returns: Reason: +// ippStsNoErr Returns no error. +// ippStsNullPtrErr Returns an error when pointers are null. +// ippStsBadArgErr Returns an error when a or b is a negative integer. +// ippStsScaleRangeErr Returns an error when a or b is more than m. +// ippStsOutOfRangeErr Returns an error when IppsBigNumState *r is larger than +// IppsMontState *m. +// ippStsContextMatchErr Returns an error when the context parameter does +// not match the operation. +// +// Parameters: +// a Multiplicand within the range [0, m - 1]. +// b Multiplier within the range [0, m - 1]. +// m Modulus. +// r Montgomery multiplication result. +// +// Notes: The size of IppsBigNumState *r should not be less than the data +// length of the modulus m. +*F*/ +IPPFUN(IppStatus, ippsMontMul, (const IppsBigNumState* pA, const IppsBigNumState* pB, IppsMontState* pMont, IppsBigNumState* pR)) +{ + IPP_BAD_PTR4_RET(pA, pB, pMont, pR); + + pMont = (IppsMontState*)(IPP_ALIGNED_PTR((pMont), MONT_ALIGNMENT)); + pA = (IppsBigNumState*)( IPP_ALIGNED_PTR(pA, BN_ALIGNMENT) ); + pB = (IppsBigNumState*)( IPP_ALIGNED_PTR(pB, BN_ALIGNMENT) ); + pR = (IppsBigNumState*)( IPP_ALIGNED_PTR(pR, BN_ALIGNMENT) ); + + IPP_BADARG_RET(!MNT_VALID_ID(pMont), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pA), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pB), ippStsContextMatchErr); + IPP_BADARG_RET(!BN_VALID_ID(pR), ippStsContextMatchErr); + + IPP_BADARG_RET(BN_NEGATIVE(pA) || BN_NEGATIVE(pB), ippStsBadArgErr); + IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pA), BN_SIZE(pA), MNT_MODULUS(pMont), MNT_SIZE(pMont)) >= 0, ippStsScaleRangeErr); + IPP_BADARG_RET(cpCmp_BNU(BN_NUMBER(pB), BN_SIZE(pB), MNT_MODULUS(pMont), MNT_SIZE(pMont)) >= 0, ippStsScaleRangeErr); + IPP_BADARG_RET(BN_ROOM(pR) < MNT_SIZE(pMont), ippStsOutOfRangeErr); + + { + BNU_CHUNK_T* pDataR = BN_NUMBER(pR); + cpSize nsM = MNT_SIZE(pMont); + + cpMontMul_BNU(pDataR, + BN_NUMBER(pA), BN_SIZE(pA), + BN_NUMBER(pB), BN_SIZE(pB), + MNT_MODULUS(pMont), nsM, + MNT_HELPER(pMont), + MNT_PRODUCT(pMont), MNT_KBUFFER(pMont)); + + FIX_BNU(pDataR, nsM); + BN_SIZE(pR) = nsM; + BN_SIGN(pR) = ippBigNumPOS; + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpmontred.c b/external/crypto_px/sources/ippcp/src/pcpmontred.c index b43dce71f9..a7851d6ec8 100644 --- a/external/crypto_px/sources/ippcp/src/pcpmontred.c +++ b/external/crypto_px/sources/ippcp/src/pcpmontred.c @@ -1,64 +1,64 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpbnuarith.h" - - -void cpMontRedAdc_BNU(BNU_CHUNK_T* pR, - BNU_CHUNK_T* pProduct, - const BNU_CHUNK_T* pModulus, cpSize nsM, BNU_CHUNK_T m0) -{ - BNU_CHUNK_T carry; - BNU_CHUNK_T extension; - - cpSize n; - for(n=0, carry = 0; n<(nsM-1); n++) { - BNU_CHUNK_T u = pProduct[n]*m0; - BNU_CHUNK_T t = pProduct[nsM +n +1] + carry; - - extension = cpAddMulDgt_BNU(pProduct+n, pModulus, nsM, u); - ADD_AB(carry, pProduct[nsM+n], pProduct[nsM+n], extension); - t += carry; - - carry = tmaxbitSizeN) -#define RSA_PUB_KEY_MAXSIZE_E(x) ((x)->maxbitSizeE) -#define RSA_PUB_KEY_ID(x) ((x)->id) -#define RSA_PUB_KEY_BITSIZE_N(x) ((x)->bitSizeN) -#define RSA_PUB_KEY_BITSIZE_E(x) ((x)->bitSizeE) -#define RSA_PUB_KEY_E(x) ((x)->pDataE) -#define RSA_PUB_KEY_NMONT(x) ((x)->pMontN) -#define RSA_PUB_KEY_VALID_ID(x) (RSA_PUB_KEY_ID((x))==idCtxRSA_PubKey) -#define RSA_PUB_KEY_IS_SET(x) (RSA_PUB_KEY_BITSIZE_N((x))>0) - -/* alignment */ -#define RSA_PUBLIC_KEY_ALIGNMENT ((int)(sizeof(void*))) - -struct _cpRSA_private_key { - IppCtxId id; /* key ID */ - int maxbitSizeN; - int maxbitSizeD; - int bitSizeN; /* RSA modulus bitsize */ - int bitSizeD; /* RSA private exp bitsize */ - int bitSizeP; /* RSA p-factor bitsize */ - int bitSizeQ; /* RSA q-factor bitsize */ - - BNU_CHUNK_T* pDataD; /* private exp */ - BNU_CHUNK_T* pDataDp; /* dp private exp */ - BNU_CHUNK_T* pDataDq; /* dq private exp */ - BNU_CHUNK_T* pDataQinv; /* qinv coeff */ - - IppsMontState* pMontP; /* montgomery engine (P) */ - IppsMontState* pMontQ; /* montgomery engine (Q) */ - IppsMontState* pMontN; /* montgomery engine (N) */ -}; - -/* access */ -#define RSA_PRV_KEY_MAXSIZE_N(x) ((x)->maxbitSizeN) -#define RSA_PRV_KEY_MAXSIZE_D(x) ((x)->maxbitSizeD) -#define RSA_PRV_KEY_ID(x) ((x)->id) -#define RSA_PRV_KEY_BITSIZE_N(x) ((x)->bitSizeN) -#define RSA_PRV_KEY_BITSIZE_D(x) ((x)->bitSizeD) -#define RSA_PRV_KEY_BITSIZE_P(x) ((x)->bitSizeP) -#define RSA_PRV_KEY_BITSIZE_Q(x) ((x)->bitSizeQ) -#define RSA_PRV_KEY_D(x) ((x)->pDataD) -#define RSA_PRV_KEY_DP(x) ((x)->pDataDp) -#define RSA_PRV_KEY_DQ(x) ((x)->pDataDq) -#define RSA_PRV_KEY_INVQ(x) ((x)->pDataQinv) -#define RSA_PRV_KEY_PMONT(x) ((x)->pMontP) -#define RSA_PRV_KEY_QMONT(x) ((x)->pMontQ) -#define RSA_PRV_KEY_NMONT(x) ((x)->pMontN) -#define RSA_PRV_KEY1_VALID_ID(x) (RSA_PRV_KEY_ID((x))==idCtxRSA_PrvKey1) -#define RSA_PRV_KEY2_VALID_ID(x) (RSA_PRV_KEY_ID((x))==idCtxRSA_PrvKey2) -#define RSA_PRV_KEY_VALID_ID(x) (RSA_PRV_KEY1_VALID_ID((x)) || RSA_PRV_KEY2_VALID_ID((x))) -#define RSA_PRV_KEY_IS_SET(x) (RSA_PRV_KEY_BITSIZE_N((x))>0) - -/* alignment */ -#define RSA_PRIVATE_KEY_ALIGNMENT ((int)(sizeof(void*))) - -/* pubic and private key operations */ -void gsRSApub_cipher(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPublicKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); -void gsRSAprv_cipher(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPrivateKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); -void gsRSAprv_cipher_crt(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPrivateKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); - -#endif /* _CP_NG_RSA_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_NG_RSA_H) +#define _CP_NG_RSA_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + +struct _cpRSA_public_key { + IppCtxId id; /* key ID */ + int maxbitSizeN; + int maxbitSizeE; + int bitSizeN; /* RSA modulus bitsize */ + int bitSizeE; /* RSA public exp bitsize */ + + BNU_CHUNK_T* pDataE; /* public exp */ + IppsMontState* pMontN; /* montgomery engine (N) */ +}; + +/* access */ +#define RSA_PUB_KEY_MAXSIZE_N(x) ((x)->maxbitSizeN) +#define RSA_PUB_KEY_MAXSIZE_E(x) ((x)->maxbitSizeE) +#define RSA_PUB_KEY_ID(x) ((x)->id) +#define RSA_PUB_KEY_BITSIZE_N(x) ((x)->bitSizeN) +#define RSA_PUB_KEY_BITSIZE_E(x) ((x)->bitSizeE) +#define RSA_PUB_KEY_E(x) ((x)->pDataE) +#define RSA_PUB_KEY_NMONT(x) ((x)->pMontN) +#define RSA_PUB_KEY_VALID_ID(x) (RSA_PUB_KEY_ID((x))==idCtxRSA_PubKey) +#define RSA_PUB_KEY_IS_SET(x) (RSA_PUB_KEY_BITSIZE_N((x))>0) + +/* alignment */ +#define RSA_PUBLIC_KEY_ALIGNMENT ((int)(sizeof(void*))) + +struct _cpRSA_private_key { + IppCtxId id; /* key ID */ + int maxbitSizeN; + int maxbitSizeD; + int bitSizeN; /* RSA modulus bitsize */ + int bitSizeD; /* RSA private exp bitsize */ + int bitSizeP; /* RSA p-factor bitsize */ + int bitSizeQ; /* RSA q-factor bitsize */ + + BNU_CHUNK_T* pDataD; /* private exp */ + BNU_CHUNK_T* pDataDp; /* dp private exp */ + BNU_CHUNK_T* pDataDq; /* dq private exp */ + BNU_CHUNK_T* pDataQinv; /* qinv coeff */ + + IppsMontState* pMontP; /* montgomery engine (P) */ + IppsMontState* pMontQ; /* montgomery engine (Q) */ + IppsMontState* pMontN; /* montgomery engine (N) */ +}; + +/* access */ +#define RSA_PRV_KEY_MAXSIZE_N(x) ((x)->maxbitSizeN) +#define RSA_PRV_KEY_MAXSIZE_D(x) ((x)->maxbitSizeD) +#define RSA_PRV_KEY_ID(x) ((x)->id) +#define RSA_PRV_KEY_BITSIZE_N(x) ((x)->bitSizeN) +#define RSA_PRV_KEY_BITSIZE_D(x) ((x)->bitSizeD) +#define RSA_PRV_KEY_BITSIZE_P(x) ((x)->bitSizeP) +#define RSA_PRV_KEY_BITSIZE_Q(x) ((x)->bitSizeQ) +#define RSA_PRV_KEY_D(x) ((x)->pDataD) +#define RSA_PRV_KEY_DP(x) ((x)->pDataDp) +#define RSA_PRV_KEY_DQ(x) ((x)->pDataDq) +#define RSA_PRV_KEY_INVQ(x) ((x)->pDataQinv) +#define RSA_PRV_KEY_PMONT(x) ((x)->pMontP) +#define RSA_PRV_KEY_QMONT(x) ((x)->pMontQ) +#define RSA_PRV_KEY_NMONT(x) ((x)->pMontN) +#define RSA_PRV_KEY1_VALID_ID(x) (RSA_PRV_KEY_ID((x))==idCtxRSA_PrvKey1) +#define RSA_PRV_KEY2_VALID_ID(x) (RSA_PRV_KEY_ID((x))==idCtxRSA_PrvKey2) +#define RSA_PRV_KEY_VALID_ID(x) (RSA_PRV_KEY1_VALID_ID((x)) || RSA_PRV_KEY2_VALID_ID((x))) +#define RSA_PRV_KEY_IS_SET(x) (RSA_PRV_KEY_BITSIZE_N((x))>0) + +/* alignment */ +#define RSA_PRIVATE_KEY_ALIGNMENT ((int)(sizeof(void*))) + +/* pubic and private key operations */ +void gsRSApub_cipher(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPublicKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); +void gsRSAprv_cipher(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPrivateKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); +void gsRSAprv_cipher_crt(IppsBigNumState* pY, const IppsBigNumState* pX, const IppsRSAPrivateKeyState* pKey, BNU_CHUNK_T* pScratchBuffer); + +#endif /* _CP_NG_RSA_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c b/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c index ccf2a855a6..4d147ad395 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c +++ b/external/crypto_px/sources/ippcp/src/pcpngrsaencodec.c @@ -1,437 +1,437 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpngrsa.h" -#include "pcpngrsamontstuff.h" - - -/*F* -// Name: ippsRSA_GetBufferSizePublicKey -// -// Purpose: Returns size of temporary buffer (in bytes) for public key operation -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pKey -// NULL == pBufferSize -// -// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() -// -// ippStsIncompleteContextErr no ippsRSA_SetPublicKey() call -// -// ippStsNoErr no error -// -// Parameters: -// pBufferSize pointer to size of temporary buffer -// pKey pointer to the key context -*F*/ -IPPFUN(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - - IPP_BAD_PTR1_RET(pBufferSize); - - { - cpSize expBitSize = RSA_PUB_KEY_BITSIZE_E(pKey); - cpSize w = gsMontExp_WinSize(expBitSize); - cpSize precompLen = (1==w)? 0 : (1<1) - // temporary product (2) - */ - cpSize bufferLen = ((nsM+1)*2)*2 - +precompLen*nsM - +nsM - +nsM*2; - - *pBufferSize = bufferLen*sizeof(BNU_CHUNK_T) - + sizeof(BNU_CHUNK_T)-1 - + (CACHE_LINE_SIZE-1); - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsRSA_GetBufferSizePublicKey -// -// Purpose: Returns size of temporary buffer (in bytes) for public key operation -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pKey -// NULL == pBufferSize -// -// ippStsContextMatchErr !RSA_PRV_KEY_VALID_ID() -// -// ippStsIncompleteContextErr (type1) private key is not set up -// -// ippStsNoErr no error -// -// Parameters: -// pBufferSize pointer to size of temporary buffer -// pKey pointer to the key context -*F*/ -IPPFUN(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pKey), ippStsContextMatchErr); - IPP_BADARG_RET(RSA_PRV_KEY1_VALID_ID(pKey) && !RSA_PRV_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - - IPP_BAD_PTR1_RET(pBufferSize); - - { - cpSize bufferLen; - if(RSA_PRV_KEY1_VALID_ID(pKey)) { - cpSize expBitSize = RSA_PRV_KEY_BITSIZE_D(pKey); - cpSize w = gsMontExp_WinSize(expBitSize); - cpSize precompLen = (1==w)? 0 : (1<1) - // temporary product (2) - */ - bufferLen = ((nsN+1)*2)*2 - +gsPrecompResourcelen(precompLen,nsN) //+precompLen*nsN - +nsN - +nsN - +nsN*2; - } - else { - cpSize expBitSize = IPP_MAX(RSA_PRV_KEY_BITSIZE_P(pKey), RSA_PRV_KEY_BITSIZE_Q(pKey)); - cpSize w = gsMontExp_WinSize(expBitSize); - cpSize precompLen = (1==w)? 0 : (1<1) - // recoure to keep "masked" multipler (x|1) (1), (w=1) - // or resource to keep zero-extended power e (1), (w>1) - // temporary product (2) - */ - bufferLen = ((nsP*2+1)*2)*2 - +gsPrecompResourcelen(precompLen, nsP) //+precompLen*nsP - +nsP - +nsP - +nsP*2; - bufferLen = IPP_MAX( IPP_MAX(validationBufferLen,generationBufferLen), bufferLen ); - } - *pBufferSize = bufferLen*sizeof(BNU_CHUNK_T) - + sizeof(BNU_CHUNK_T)-1 - + (CACHE_LINE_SIZE-1); - return ippStsNoErr; - } -} - - - -void gsRSApub_cipher(IppsBigNumState* pY, - const IppsBigNumState* pX, - const IppsRSAPublicKeyState* pKey, - BNU_CHUNK_T* pScratchBuffer) -{ - IppsMontState* pMontN = RSA_PUB_KEY_NMONT(pKey); - gsMontEnc_BN(pY, pX, pMontN, pScratchBuffer); - - { - /* optimal size of window */ - BNU_CHUNK_T* pExp = RSA_PUB_KEY_E(pKey); - cpSize nsExp = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_E(pKey)); - cpSize w = gsMontExp_WinSize(RSA_PUB_KEY_BITSIZE_E(pKey)); - - if(1==w) - gsMontExpBin_BN(pY, pY, pExp, nsExp, pMontN, pScratchBuffer); - else - gsMontExpWin_BN(pY, pY, pExp, nsExp, w, pMontN, pScratchBuffer); - } - - gsMontDec_BN(pY, pY, pMontN, pScratchBuffer); -} - - -/*F* -// Name: ippsRSA_Encrypt -// -// Purpose: Performs RSA Encryprion -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pKey -// NULL == pPtxt -// NULL == pCtxt -// NULL == pBuffer -// -// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() -// !BN_VALID_ID(pPtxt) -// !BN_VALID_ID(pCtxt) -// -// ippStsIncompleteContextErr public key is not setup -// -// ippStsOutOfRangeErr pPtxt >= modulus -// pPtxt <0 -// -// ippStsSizeErr BN_ROOM(pCtxt) is not enough -// -// ippStsNoErr no error -// -// Parameters: -// pPtxt pointer to the plaintext -// pCtxt pointer to the ciphertext -// pKey pointer to the key context -// pScratchBuffer pointer to the temporary buffer -*F*/ -IPPFUN(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, - IppsBigNumState* pCtxt, - const IppsRSAPublicKeyState* pKey, - Ipp8u* pScratchBuffer)) -{ - IPP_BAD_PTR2_RET(pKey, pScratchBuffer); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - - IPP_BAD_PTR1_RET(pPtxt); - pPtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPtxt, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pPtxt), ippStsContextMatchErr); - IPP_BADARG_RET(BN_NEGATIVE(pPtxt), ippStsOutOfRangeErr); - IPP_BADARG_RET(0 <= cpCmp_BNU(BN_NUMBER(pPtxt), BN_SIZE(pPtxt), - MNT_MODULUS(RSA_PUB_KEY_NMONT(pKey)), MNT_SIZE(RSA_PUB_KEY_NMONT(pKey))), ippStsOutOfRangeErr); - - IPP_BAD_PTR1_RET(pCtxt); - pCtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCtxt, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pCtxt), ippStsContextMatchErr); - IPP_BADARG_RET(BN_ROOM(pCtxt) < BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_N(pKey)), ippStsSizeErr); - - gsRSApub_cipher(pCtxt, - pPtxt, - pKey, - (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); - return ippStsNoErr; -} - - - -void gsRSAprv_cipher(IppsBigNumState* pY, - const IppsBigNumState* pX, - const IppsRSAPrivateKeyState* pKey, - BNU_CHUNK_T* pScratchBuffer) -{ - IppsMontState* pMontN = RSA_PRV_KEY_NMONT(pKey); - gsMontEnc_BN(pY, pX, pMontN, pScratchBuffer); - - { - /* optimal size of window */ - BNU_CHUNK_T* pExp = RSA_PRV_KEY_D(pKey); - cpSize nsExp = BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_D(pKey)); - cpSize w = gsMontExp_WinSize(RSA_PRV_KEY_BITSIZE_D(pKey)); - - if(1==w) - gsMontExpBin_BN_sscm(pY, pY, pExp, nsExp, pMontN, pScratchBuffer); - else - gsMontExpWin_BN_sscm(pY, pY, pExp, nsExp, w, pMontN, pScratchBuffer); - } - - gsMontDec_BN(pY, pY, pMontN, pScratchBuffer); -} - -void gsRSAprv_cipher_crt(IppsBigNumState* pY, - const IppsBigNumState* pX, - const IppsRSAPrivateKeyState* pKey, - BNU_CHUNK_T* pScratchBuffer) -{ - /* P- and Q- montgometry engines */ - IppsMontState* pMontP = RSA_PRV_KEY_PMONT(pKey); - IppsMontState* pMontQ = RSA_PRV_KEY_QMONT(pKey); - cpSize nsP = MNT_SIZE(pMontP); - cpSize nsQ = MNT_SIZE(pMontQ); - - const BNU_CHUNK_T* dataX = BN_NUMBER(pX); - cpSize nsX = BN_SIZE(pX); - BNU_CHUNK_T* dataXp = BN_NUMBER(pY); - BNU_CHUNK_T* dataXq = BN_BUFFER(pY); - - cpSize bitSizeDP = BITSIZE_BNU(RSA_PRV_KEY_DP(pKey), nsP); - cpSize bitSizeDQ = BITSIZE_BNU(RSA_PRV_KEY_DQ(pKey), nsQ); - cpSize w; - BNU_CHUNK_T cf; - - /* compute xq = x^dQ mod Q */ - COPY_BNU(dataXq, dataX, nsX); - cpMod_BNU(dataXq, nsX, MNT_MODULUS(pMontQ), nsQ); - gsMontEnc_BNU(dataXq, dataXq, nsQ, pMontQ, pScratchBuffer); - w = gsMontExp_WinSize(bitSizeDQ); - - if(1==w) - gsMontExpBin_BNU_sscm(dataXq, - dataXq, nsQ, - RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(bitSizeDQ), - pMontQ, pScratchBuffer); - else - gsMontExpWin_BNU_sscm(dataXq, - dataXq, nsQ, - RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(bitSizeDQ), w, - pMontQ, pScratchBuffer); - - gsMontDec_BNU(dataXq, dataXq, nsQ, pMontQ, pScratchBuffer); - - /* compute xp = x^dP mod P */ - COPY_BNU(dataXp, dataX, nsX); - cpMod_BNU(dataXp, nsX, MNT_MODULUS(pMontP), nsP); - gsMontEnc_BNU(dataXp, dataXp, nsP, pMontP, pScratchBuffer); - w = gsMontExp_WinSize(bitSizeDP); - - if(1==w) - gsMontExpBin_BNU_sscm(dataXp, - dataXp, nsP, - RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(bitSizeDP), - pMontP, pScratchBuffer); - else - gsMontExpWin_BNU_sscm(dataXp, - dataXp, nsP, - RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(bitSizeDP), w, - pMontP, pScratchBuffer); - - gsMontDec_BNU(dataXp, dataXp, nsP, pMontP, pScratchBuffer); - - /* xp -= xq */ - cf = cpSub_BNU(dataXp, dataXp, dataXq, nsQ); - if(nsP-nsQ) - cf = cpDec_BNU(dataXp+nsQ, dataXp+nsQ, (nsP-nsQ), cf); - if(cf) - cpAdd_BNU(dataXp, dataXp, MNT_MODULUS(pMontP), nsP); - - /* xp = xp*qInv mod P */ - cpMontMul_BNU(dataXp, - dataXp, nsP, - RSA_PRV_KEY_INVQ(pKey), nsP, - MNT_MODULUS(pMontP), nsP, MNT_HELPER(pMontP), - pScratchBuffer, NULL); - - /* Y = xq + xp*Q */ - cpMul_BNU_school(pScratchBuffer, - dataXp, nsP, - MNT_MODULUS(pMontQ), nsQ); - cf = cpAdd_BNU(BN_NUMBER(pY), pScratchBuffer, dataXq, nsQ); - cpInc_BNU(BN_NUMBER(pY)+nsQ, pScratchBuffer+nsQ, nsP, cf); - - nsX = nsP+nsQ; - FIX_BNU(BN_NUMBER(pY), nsX); - BN_SIZE(pY) = nsX; - BN_SIGN(pY) = ippBigNumPOS; -} - -/*F* -// Name: ippsRSA_Decrypt -// -// Purpose: Performs RSA Decryprion -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pKey -// NULL == pCtxt -// NULL == pPtxt -// NULL == pBuffer -// -// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() -// !BN_VALID_ID(pCtxt) -// !BN_VALID_ID(pPtxt) -// -// ippStsIncompleteContextErr private key is not set up -// -// ippStsOutOfRangeErr pCtxt >= modulus -// pCtxt <0 -// -// ippStsSizeErr BN_ROOM(pPtxt) is not enough -// -// ippStsNoErr no error -// -// Parameters: -// pCtxt pointer to the ciphertext -// pPtxt pointer to the plaintext -// pKey pointer to the key context -// pScratchBuffer pointer to the temporary buffer -*F*/ -IPPFUN(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, - IppsBigNumState* pPtxt, - const IppsRSAPrivateKeyState* pKey, - Ipp8u* pScratchBuffer)) -{ - IPP_BAD_PTR2_RET(pKey, pScratchBuffer); - pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - - IPP_BAD_PTR1_RET(pCtxt); - pCtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCtxt, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pCtxt), ippStsContextMatchErr); - IPP_BADARG_RET(BN_NEGATIVE(pCtxt), ippStsOutOfRangeErr); - IPP_BADARG_RET(0 <= cpCmp_BNU(BN_NUMBER(pCtxt), BN_SIZE(pCtxt), - MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)), MNT_SIZE(RSA_PRV_KEY_NMONT(pKey))), ippStsOutOfRangeErr); - - IPP_BAD_PTR1_RET(pPtxt); - pPtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPtxt, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pPtxt), ippStsContextMatchErr); - IPP_BADARG_RET(BN_ROOM(pPtxt) < BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_N(pKey)), ippStsSizeErr); - - if(RSA_PRV_KEY1_VALID_ID(pKey)) - gsRSAprv_cipher(pPtxt, - pCtxt, - pKey, - (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); - else - gsRSAprv_cipher_crt(pPtxt, - pCtxt, - pKey, - (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); - return ippStsNoErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + + +/*F* +// Name: ippsRSA_GetBufferSizePublicKey +// +// Purpose: Returns size of temporary buffer (in bytes) for public key operation +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pBufferSize +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// +// ippStsIncompleteContextErr no ippsRSA_SetPublicKey() call +// +// ippStsNoErr no error +// +// Parameters: +// pBufferSize pointer to size of temporary buffer +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_GetBufferSizePublicKey,(int* pBufferSize, const IppsRSAPublicKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pBufferSize); + + { + cpSize expBitSize = RSA_PUB_KEY_BITSIZE_E(pKey); + cpSize w = gsMontExp_WinSize(expBitSize); + cpSize precompLen = (1==w)? 0 : (1<1) + // temporary product (2) + */ + cpSize bufferLen = ((nsM+1)*2)*2 + +precompLen*nsM + +nsM + +nsM*2; + + *pBufferSize = bufferLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + (CACHE_LINE_SIZE-1); + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRSA_GetBufferSizePublicKey +// +// Purpose: Returns size of temporary buffer (in bytes) for public key operation +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pBufferSize +// +// ippStsContextMatchErr !RSA_PRV_KEY_VALID_ID() +// +// ippStsIncompleteContextErr (type1) private key is not set up +// +// ippStsNoErr no error +// +// Parameters: +// pBufferSize pointer to size of temporary buffer +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_GetBufferSizePrivateKey,(int* pBufferSize, const IppsRSAPrivateKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(RSA_PRV_KEY1_VALID_ID(pKey) && !RSA_PRV_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pBufferSize); + + { + cpSize bufferLen; + if(RSA_PRV_KEY1_VALID_ID(pKey)) { + cpSize expBitSize = RSA_PRV_KEY_BITSIZE_D(pKey); + cpSize w = gsMontExp_WinSize(expBitSize); + cpSize precompLen = (1==w)? 0 : (1<1) + // temporary product (2) + */ + bufferLen = ((nsN+1)*2)*2 + +gsPrecompResourcelen(precompLen,nsN) //+precompLen*nsN + +nsN + +nsN + +nsN*2; + } + else { + cpSize expBitSize = IPP_MAX(RSA_PRV_KEY_BITSIZE_P(pKey), RSA_PRV_KEY_BITSIZE_Q(pKey)); + cpSize w = gsMontExp_WinSize(expBitSize); + cpSize precompLen = (1==w)? 0 : (1<1) + // recoure to keep "masked" multipler (x|1) (1), (w=1) + // or resource to keep zero-extended power e (1), (w>1) + // temporary product (2) + */ + bufferLen = ((nsP*2+1)*2)*2 + +gsPrecompResourcelen(precompLen, nsP) //+precompLen*nsP + +nsP + +nsP + +nsP*2; + bufferLen = IPP_MAX( IPP_MAX(validationBufferLen,generationBufferLen), bufferLen ); + } + *pBufferSize = bufferLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + (CACHE_LINE_SIZE-1); + return ippStsNoErr; + } +} + + + +void gsRSApub_cipher(IppsBigNumState* pY, + const IppsBigNumState* pX, + const IppsRSAPublicKeyState* pKey, + BNU_CHUNK_T* pScratchBuffer) +{ + IppsMontState* pMontN = RSA_PUB_KEY_NMONT(pKey); + gsMontEnc_BN(pY, pX, pMontN, pScratchBuffer); + + { + /* optimal size of window */ + BNU_CHUNK_T* pExp = RSA_PUB_KEY_E(pKey); + cpSize nsExp = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_E(pKey)); + cpSize w = gsMontExp_WinSize(RSA_PUB_KEY_BITSIZE_E(pKey)); + + if(1==w) + gsMontExpBin_BN(pY, pY, pExp, nsExp, pMontN, pScratchBuffer); + else + gsMontExpWin_BN(pY, pY, pExp, nsExp, w, pMontN, pScratchBuffer); + } + + gsMontDec_BN(pY, pY, pMontN, pScratchBuffer); +} + + +/*F* +// Name: ippsRSA_Encrypt +// +// Purpose: Performs RSA Encryprion +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pPtxt +// NULL == pCtxt +// NULL == pBuffer +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// !BN_VALID_ID(pPtxt) +// !BN_VALID_ID(pCtxt) +// +// ippStsIncompleteContextErr public key is not setup +// +// ippStsOutOfRangeErr pPtxt >= modulus +// pPtxt <0 +// +// ippStsSizeErr BN_ROOM(pCtxt) is not enough +// +// ippStsNoErr no error +// +// Parameters: +// pPtxt pointer to the plaintext +// pCtxt pointer to the ciphertext +// pKey pointer to the key context +// pScratchBuffer pointer to the temporary buffer +*F*/ +IPPFUN(IppStatus, ippsRSA_Encrypt,(const IppsBigNumState* pPtxt, + IppsBigNumState* pCtxt, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pScratchBuffer)) +{ + IPP_BAD_PTR2_RET(pKey, pScratchBuffer); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pPtxt); + pPtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_NEGATIVE(pPtxt), ippStsOutOfRangeErr); + IPP_BADARG_RET(0 <= cpCmp_BNU(BN_NUMBER(pPtxt), BN_SIZE(pPtxt), + MNT_MODULUS(RSA_PUB_KEY_NMONT(pKey)), MNT_SIZE(RSA_PUB_KEY_NMONT(pKey))), ippStsOutOfRangeErr); + + IPP_BAD_PTR1_RET(pCtxt); + pCtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_ROOM(pCtxt) < BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_N(pKey)), ippStsSizeErr); + + gsRSApub_cipher(pCtxt, + pPtxt, + pKey, + (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); + return ippStsNoErr; +} + + + +void gsRSAprv_cipher(IppsBigNumState* pY, + const IppsBigNumState* pX, + const IppsRSAPrivateKeyState* pKey, + BNU_CHUNK_T* pScratchBuffer) +{ + IppsMontState* pMontN = RSA_PRV_KEY_NMONT(pKey); + gsMontEnc_BN(pY, pX, pMontN, pScratchBuffer); + + { + /* optimal size of window */ + BNU_CHUNK_T* pExp = RSA_PRV_KEY_D(pKey); + cpSize nsExp = BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_D(pKey)); + cpSize w = gsMontExp_WinSize(RSA_PRV_KEY_BITSIZE_D(pKey)); + + if(1==w) + gsMontExpBin_BN_sscm(pY, pY, pExp, nsExp, pMontN, pScratchBuffer); + else + gsMontExpWin_BN_sscm(pY, pY, pExp, nsExp, w, pMontN, pScratchBuffer); + } + + gsMontDec_BN(pY, pY, pMontN, pScratchBuffer); +} + +void gsRSAprv_cipher_crt(IppsBigNumState* pY, + const IppsBigNumState* pX, + const IppsRSAPrivateKeyState* pKey, + BNU_CHUNK_T* pScratchBuffer) +{ + /* P- and Q- montgometry engines */ + IppsMontState* pMontP = RSA_PRV_KEY_PMONT(pKey); + IppsMontState* pMontQ = RSA_PRV_KEY_QMONT(pKey); + cpSize nsP = MNT_SIZE(pMontP); + cpSize nsQ = MNT_SIZE(pMontQ); + + const BNU_CHUNK_T* dataX = BN_NUMBER(pX); + cpSize nsX = BN_SIZE(pX); + BNU_CHUNK_T* dataXp = BN_NUMBER(pY); + BNU_CHUNK_T* dataXq = BN_BUFFER(pY); + + cpSize bitSizeDP = BITSIZE_BNU(RSA_PRV_KEY_DP(pKey), nsP); + cpSize bitSizeDQ = BITSIZE_BNU(RSA_PRV_KEY_DQ(pKey), nsQ); + cpSize w; + BNU_CHUNK_T cf; + + /* compute xq = x^dQ mod Q */ + COPY_BNU(dataXq, dataX, nsX); + cpMod_BNU(dataXq, nsX, MNT_MODULUS(pMontQ), nsQ); + gsMontEnc_BNU(dataXq, dataXq, nsQ, pMontQ, pScratchBuffer); + w = gsMontExp_WinSize(bitSizeDQ); + + if(1==w) + gsMontExpBin_BNU_sscm(dataXq, + dataXq, nsQ, + RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(bitSizeDQ), + pMontQ, pScratchBuffer); + else + gsMontExpWin_BNU_sscm(dataXq, + dataXq, nsQ, + RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(bitSizeDQ), w, + pMontQ, pScratchBuffer); + + gsMontDec_BNU(dataXq, dataXq, nsQ, pMontQ, pScratchBuffer); + + /* compute xp = x^dP mod P */ + COPY_BNU(dataXp, dataX, nsX); + cpMod_BNU(dataXp, nsX, MNT_MODULUS(pMontP), nsP); + gsMontEnc_BNU(dataXp, dataXp, nsP, pMontP, pScratchBuffer); + w = gsMontExp_WinSize(bitSizeDP); + + if(1==w) + gsMontExpBin_BNU_sscm(dataXp, + dataXp, nsP, + RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(bitSizeDP), + pMontP, pScratchBuffer); + else + gsMontExpWin_BNU_sscm(dataXp, + dataXp, nsP, + RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(bitSizeDP), w, + pMontP, pScratchBuffer); + + gsMontDec_BNU(dataXp, dataXp, nsP, pMontP, pScratchBuffer); + + /* xp -= xq */ + cf = cpSub_BNU(dataXp, dataXp, dataXq, nsQ); + if(nsP-nsQ) + cf = cpDec_BNU(dataXp+nsQ, dataXp+nsQ, (nsP-nsQ), cf); + if(cf) + cpAdd_BNU(dataXp, dataXp, MNT_MODULUS(pMontP), nsP); + + /* xp = xp*qInv mod P */ + cpMontMul_BNU(dataXp, + dataXp, nsP, + RSA_PRV_KEY_INVQ(pKey), nsP, + MNT_MODULUS(pMontP), nsP, MNT_HELPER(pMontP), + pScratchBuffer, NULL); + + /* Y = xq + xp*Q */ + cpMul_BNU_school(pScratchBuffer, + dataXp, nsP, + MNT_MODULUS(pMontQ), nsQ); + cf = cpAdd_BNU(BN_NUMBER(pY), pScratchBuffer, dataXq, nsQ); + cpInc_BNU(BN_NUMBER(pY)+nsQ, pScratchBuffer+nsQ, nsP, cf); + + nsX = nsP+nsQ; + FIX_BNU(BN_NUMBER(pY), nsX); + BN_SIZE(pY) = nsX; + BN_SIGN(pY) = ippBigNumPOS; +} + +/*F* +// Name: ippsRSA_Decrypt +// +// Purpose: Performs RSA Decryprion +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// NULL == pCtxt +// NULL == pPtxt +// NULL == pBuffer +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// !BN_VALID_ID(pCtxt) +// !BN_VALID_ID(pPtxt) +// +// ippStsIncompleteContextErr private key is not set up +// +// ippStsOutOfRangeErr pCtxt >= modulus +// pCtxt <0 +// +// ippStsSizeErr BN_ROOM(pPtxt) is not enough +// +// ippStsNoErr no error +// +// Parameters: +// pCtxt pointer to the ciphertext +// pPtxt pointer to the plaintext +// pKey pointer to the key context +// pScratchBuffer pointer to the temporary buffer +*F*/ +IPPFUN(IppStatus, ippsRSA_Decrypt,(const IppsBigNumState* pCtxt, + IppsBigNumState* pPtxt, + const IppsRSAPrivateKeyState* pKey, + Ipp8u* pScratchBuffer)) +{ + IPP_BAD_PTR2_RET(pKey, pScratchBuffer); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pCtxt); + pCtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_NEGATIVE(pCtxt), ippStsOutOfRangeErr); + IPP_BADARG_RET(0 <= cpCmp_BNU(BN_NUMBER(pCtxt), BN_SIZE(pCtxt), + MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)), MNT_SIZE(RSA_PRV_KEY_NMONT(pKey))), ippStsOutOfRangeErr); + + IPP_BAD_PTR1_RET(pPtxt); + pPtxt = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPtxt, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPtxt), ippStsContextMatchErr); + IPP_BADARG_RET(BN_ROOM(pPtxt) < BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_N(pKey)), ippStsSizeErr); + + if(RSA_PRV_KEY1_VALID_ID(pKey)) + gsRSAprv_cipher(pPtxt, + pCtxt, + pKey, + (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); + else + gsRSAprv_cipher_crt(pPtxt, + pCtxt, + pKey, + (BNU_CHUNK_T*)(IPP_ALIGNED_PTR((pScratchBuffer), (int)sizeof(BNU_CHUNK_T))) ); + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c b/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c index 22b8917f67..ac9ce14f14 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c +++ b/external/crypto_px/sources/ippcp/src/pcpngrsaesoaepca.c @@ -1,176 +1,176 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcptool.h" -#include "pcpngrsa.h" -#include "pcphash.h" - - -/*F* -// Name: ippsRSAEncrypt_OAEP -// -// Purpose: Performs RSAES-OAEP encryprion scheme -// -// Returns: Reason: -// ippStsNotSupportedModeErr unknown hashAlg -// -// ippStsNullPtrErr NULL == pKey -// NULL == pSrc -// NULL == pDst -// NULL == pLabel -// NULL == pSeed -// NULL == pBuffer -// -// ippStsLengthErr srcLen <0 -// labLen <0 -// srcLen > RSAsize -2*hashLen -2 -// RSAsize < 2*hashLen +2 -// -// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() -// -// ippStsIncompleteContextErr public key is not set up -// -// ippStsNoErr no error -// -// Parameters: -// pSrc pointer to the plaintext -// srcLen plaintext length (bytes) -// pLabel (optional) pointer to the label associated with plaintext -// labLen label length (bytes) -// pSeed seed string of hashLen size -// pDst pointer to the ciphertext (length of pdst is not less then size of RSA modulus) -// pKey pointer to the RSA public key context -// hashAlg hash alg ID -// pBuffer pointer to scratch buffer -*F*/ -IPPFUN(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, - const Ipp8u* pLabel, int labLen, - const Ipp8u* pSeed, - Ipp8u* pDst, - const IppsRSAPublicKeyState* pKey, - IppHashAlgId hashAlg, - Ipp8u* pBuffer)) -{ - int hashLen; - - /* test hash algorith ID */ - hashAlg = cpValidHashAlg(hashAlg); - IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); - - /* test data pointer */ - IPP_BAD_PTR3_RET(pSrc,pDst, pSeed); - - IPP_BADARG_RET(!pLabel && labLen, ippStsNullPtrErr); - - /* test public key context */ - IPP_BAD_PTR2_RET(pKey, pBuffer); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - - /* test length */ - IPP_BADARG_RET(srcLen<0||labLen<0, ippStsLengthErr); - - hashLen = cpHashSize(hashAlg); - /* test compatibility of RSA and hash length */ - IPP_BADARG_RET(BITS2WORD8_SIZE(RSA_PRV_KEY_BITSIZE_N(pKey)) < (2*hashLen +2), ippStsLengthErr); - /* test compatibility of msg length and other (RSA and hash) lengths */ - IPP_BADARG_RET(BITS2WORD8_SIZE(RSA_PRV_KEY_BITSIZE_N(pKey))-(2*hashLen +2) < srcLen, ippStsLengthErr); - - { - /* size of RSA modulus in bytes and chunks */ - int k = BITS2WORD8_SIZE(RSA_PUB_KEY_BITSIZE_N(pKey)); - cpSize nsN = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_N(pKey)); - - /* - // EME-OAEP encoding - */ - { - Ipp8u seedMask[BITS2WORD8_SIZE(IPP_SHA512_DIGEST_BITSIZE)]; - - Ipp8u* pMaskedSeed = pDst+1; - Ipp8u* pMaskedDB = pDst +hashLen +1; - - pDst[0] = 0; - - /* maskedDB = MGF(seed, k-1-hashLen)*/ - ippsMGF(pSeed, hashLen, pMaskedDB, k-1-hashLen, hashAlg); - - /* seedMask = HASH(pLab) */ - ippsHashMessage(pLabel, labLen, seedMask, hashAlg); - - /* maskedDB ^= concat(HASH(pLab),PS,0x01,pSc) */ - XorBlock(pMaskedDB, seedMask, pMaskedDB, hashLen); - pMaskedDB[k-srcLen-hashLen-2] ^= 0x01; - XorBlock(pMaskedDB+k-srcLen-hashLen-2+1, pSrc, pMaskedDB+k-srcLen-hashLen-2+1, srcLen); - - /* seedMask = MGF(maskedDB, hashLen) */ - ippsMGF(pMaskedDB, k-1-hashLen, seedMask, hashLen, hashAlg); - /* maskedSeed = seed ^ seedMask */ - XorBlock(pSeed, seedMask, pMaskedSeed, hashLen); - } - - /* RSA encryption */ - { - /* align buffer */ - BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); - - /* temporary BN */ - __ALIGN8 IppsBigNumState tmpBN; - BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &tmpBN); - - /* updtae buffer pointer */ - pScratchBuffer += (nsN+1)*2; - - ippsSetOctString_BN(pDst, k, &tmpBN); - - gsRSApub_cipher(&tmpBN, &tmpBN, pKey, pScratchBuffer); - - ippsGetOctString_BN(pDst, k, &tmpBN); - } - - return ippStsNoErr; - } -} - - -IPPFUN(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen, - const Ipp8u* pLabel, int labLen, - const Ipp8u* pSeed, - Ipp8u* pDst, - const IppsRSAPublicKeyState* pKey, - Ipp8u* pBuffer)) -{ return ippsRSAEncrypt_OAEP(pSrc,srcLen, pLabel,labLen, pSeed, - pDst, pKey, - IPP_ALG_HASH_SHA256, - pBuffer); } +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcptool.h" +#include "pcpngrsa.h" +#include "pcphash.h" + + +/*F* +// Name: ippsRSAEncrypt_OAEP +// +// Purpose: Performs RSAES-OAEP encryprion scheme +// +// Returns: Reason: +// ippStsNotSupportedModeErr unknown hashAlg +// +// ippStsNullPtrErr NULL == pKey +// NULL == pSrc +// NULL == pDst +// NULL == pLabel +// NULL == pSeed +// NULL == pBuffer +// +// ippStsLengthErr srcLen <0 +// labLen <0 +// srcLen > RSAsize -2*hashLen -2 +// RSAsize < 2*hashLen +2 +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// +// ippStsIncompleteContextErr public key is not set up +// +// ippStsNoErr no error +// +// Parameters: +// pSrc pointer to the plaintext +// srcLen plaintext length (bytes) +// pLabel (optional) pointer to the label associated with plaintext +// labLen label length (bytes) +// pSeed seed string of hashLen size +// pDst pointer to the ciphertext (length of pdst is not less then size of RSA modulus) +// pKey pointer to the RSA public key context +// hashAlg hash alg ID +// pBuffer pointer to scratch buffer +*F*/ +IPPFUN(IppStatus, ippsRSAEncrypt_OAEP,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +{ + int hashLen; + + /* test hash algorith ID */ + hashAlg = cpValidHashAlg(hashAlg); + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* test data pointer */ + IPP_BAD_PTR3_RET(pSrc,pDst, pSeed); + + IPP_BADARG_RET(!pLabel && labLen, ippStsNullPtrErr); + + /* test public key context */ + IPP_BAD_PTR2_RET(pKey, pBuffer); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + /* test length */ + IPP_BADARG_RET(srcLen<0||labLen<0, ippStsLengthErr); + + hashLen = cpHashSize(hashAlg); + /* test compatibility of RSA and hash length */ + IPP_BADARG_RET(BITS2WORD8_SIZE(RSA_PRV_KEY_BITSIZE_N(pKey)) < (2*hashLen +2), ippStsLengthErr); + /* test compatibility of msg length and other (RSA and hash) lengths */ + IPP_BADARG_RET(BITS2WORD8_SIZE(RSA_PRV_KEY_BITSIZE_N(pKey))-(2*hashLen +2) < srcLen, ippStsLengthErr); + + { + /* size of RSA modulus in bytes and chunks */ + int k = BITS2WORD8_SIZE(RSA_PUB_KEY_BITSIZE_N(pKey)); + cpSize nsN = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_N(pKey)); + + /* + // EME-OAEP encoding + */ + { + Ipp8u seedMask[BITS2WORD8_SIZE(IPP_SHA512_DIGEST_BITSIZE)]; + + Ipp8u* pMaskedSeed = pDst+1; + Ipp8u* pMaskedDB = pDst +hashLen +1; + + pDst[0] = 0; + + /* maskedDB = MGF(seed, k-1-hashLen)*/ + ippsMGF(pSeed, hashLen, pMaskedDB, k-1-hashLen, hashAlg); + + /* seedMask = HASH(pLab) */ + ippsHashMessage(pLabel, labLen, seedMask, hashAlg); + + /* maskedDB ^= concat(HASH(pLab),PS,0x01,pSc) */ + XorBlock(pMaskedDB, seedMask, pMaskedDB, hashLen); + pMaskedDB[k-srcLen-hashLen-2] ^= 0x01; + XorBlock(pMaskedDB+k-srcLen-hashLen-2+1, pSrc, pMaskedDB+k-srcLen-hashLen-2+1, srcLen); + + /* seedMask = MGF(maskedDB, hashLen) */ + ippsMGF(pMaskedDB, k-1-hashLen, seedMask, hashLen, hashAlg); + /* maskedSeed = seed ^ seedMask */ + XorBlock(pSeed, seedMask, pMaskedSeed, hashLen); + } + + /* RSA encryption */ + { + /* align buffer */ + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); + + /* temporary BN */ + __ALIGN8 IppsBigNumState tmpBN; + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &tmpBN); + + /* updtae buffer pointer */ + pScratchBuffer += (nsN+1)*2; + + ippsSetOctString_BN(pDst, k, &tmpBN); + + gsRSApub_cipher(&tmpBN, &tmpBN, pKey, pScratchBuffer); + + ippsGetOctString_BN(pDst, k, &tmpBN); + } + + return ippStsNoErr; + } +} + + +IPPFUN(IppStatus, ippsRSA_OAEPEncrypt_SHA256,(const Ipp8u* pSrc, int srcLen, + const Ipp8u* pLabel, int labLen, + const Ipp8u* pSeed, + Ipp8u* pDst, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pBuffer)) +{ return ippsRSAEncrypt_OAEP(pSrc,srcLen, pLabel,labLen, pSeed, + pDst, pKey, + IPP_ALG_HASH_SHA256, + pBuffer); } diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c b/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c index e942bed1a5..2896ffdc89 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c +++ b/external/crypto_px/sources/ippcp/src/pcpngrsagenerate.c @@ -1,323 +1,323 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpprimeg.h" -#include "pcpngrsa.h" -#include "pcpngrsamontstuff.h" - -/*F* -// Name: ippsRSA_ValidateKeys -// -// Purpose: Validate RSA keys -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pPublicKey -// NULL == pPrivateKeyType2 -// NULL == pPrivateKeyType1 -// NULL == pBuffer -// NULL == pPrimeGen -// NULL == rndFunc -// NULL == pResult -// -// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID(pPublicKey) -// !RSA_PRV_KEY2_VALID_ID(pPrivateKeyType2) -// !RSA_PRV_KEY1_VALID_ID(pPrivateKeyType1) -// !PRIME_VALID_ID(pPrimeGen) -// -// ippStsIncompleteContextErr public and.or private key is not set up -// -// ippStsSizeErr PRIME_MAXBITSIZE(pPrimeGen) < factorPbitSize -// -// ippStsBadArgErr nTrials < 1 -// -// ippStsNoErr no error -// -// Parameters: -// pResult pointer to the validation result -// pPublicKey pointer to the public key context -// pPrivateKeyType2 pointer to the private key type2 context -// pPrivateKeyType1 (optional) pointer to the private key type1 context -// pBuffer pointer to the temporary buffer -// nTrials parameter of Miller-Rabin Test -// pPrimeGen pointer to the Prime generator context -// rndFunc external PRNG -// pRndParam pointer to the external PRNG parameters -*F*/ -/* -// make sure D*E = 1 mod(phi(P,Q)) -// where phi(P,Q) = (P-1)*(Q-1) -*/ -static -int isValidPriv1_classic(const BNU_CHUNK_T* pN, int nsN, - const BNU_CHUNK_T* pE, int nsE, - const BNU_CHUNK_T* pD, int nsD, - const BNU_CHUNK_T* pFactorP, int nsP, - const BNU_CHUNK_T* pFactorQ, int nsQ, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* pPhi = pBuffer; - BNU_CHUNK_T* pProduct = pPhi + nsN; - BNU_CHUNK_T c = cpSub_BNU(pPhi, pN, pFactorP, nsP); - int prodLen; - if(nsN>1) cpDec_BNU(pPhi+nsP, pN+nsP, nsQ, c); - c = cpSub_BNU(pPhi,pPhi, pFactorQ, nsQ); - if(nsN>1) cpDec_BNU(pPhi+nsQ, pPhi+nsQ, nsP, c); - cpInc_BNU(pPhi, pPhi, nsP+nsQ, 1); - - cpMul_BNU_school(pProduct, pE, nsE, pD, nsD); - prodLen = cpMod_BNU(pProduct, nsE+nsD, pPhi, nsN); - - return 1==cpEqu_BNU_CHUNK(pProduct, prodLen, 1)? IPP_IS_VALID : IPP_IS_INVALID; -} - -/* -// make sure D*E = 1 mod(lcm(P-1,Q-1)) -// where lcm(P-1,Q-1) = (P-1)*(Q-1)/gcd(P-1,Q-1) -*/ -static -int isValidPriv1_rsa(const BNU_CHUNK_T* pN, int nsN, - const BNU_CHUNK_T* pE, int nsE, - const BNU_CHUNK_T* pD, int nsD, - BNU_CHUNK_T* pFactorP, int nsP, - BNU_CHUNK_T* pFactorQ, int nsQ, - BNU_CHUNK_T* pBuffer) -{ - __ALIGN8 IppsBigNumState tmpBN1; - __ALIGN8 IppsBigNumState tmpBN2; - __ALIGN8 IppsBigNumState tmpBN3; - - BNU_CHUNK_T* pProduct = pBuffer; - BNU_CHUNK_T* pGcd = pProduct+(nsN+1); - BNU_CHUNK_T* pLcm; - int nsLcm; - int prodLen; - pBuffer = pGcd + (nsP+1)*2; - - /* P = P-1 and Q = Q-1 */ - pFactorP[0]--; - pFactorQ[0]--; - - /* compute product (P-1)*(Q-1) = P*Q -P -Q +1 = N -(P-1) -(Q-1) -1 */ - { - BNU_CHUNK_T c = cpSub_BNU(pProduct, pN, pFactorP, nsP); - if(nsN>1) cpDec_BNU(pProduct+nsP, pN+nsP, nsQ, c); - c = cpSub_BNU(pProduct, pProduct, pFactorQ, nsQ); - if(nsN>1) cpDec_BNU(pProduct+nsQ, pProduct+nsQ, nsP, c); - cpDec_BNU(pProduct, pProduct, nsN, 1); - } - - /* compute gcd(p-1, q-1) */ - BN_Make(pGcd, pGcd+nsP+1, nsP, &tmpBN1); /* BN(gcd) */ - BN_SIZE(&tmpBN1) = nsP; - BN_Make(pFactorP, pBuffer, nsP, &tmpBN2); /* BN(P-1) */ - BN_SIZE(&tmpBN2) = nsP; - BN_Make(pFactorQ, pBuffer+nsP+1, nsQ, &tmpBN3); /* BN(Q-1) */ - BN_SIZE(&tmpBN3) = nsQ; - ippsGcd_BN(&tmpBN2, &tmpBN3, &tmpBN1); - - /* compute lcm(p-1, q-1) = (p-1)(q-1)/gcd(p-1, q-1) */ - pLcm = pBuffer; - cpDiv_BNU(pLcm, &nsLcm, pProduct, nsN, pGcd, BN_SIZE(&tmpBN1)); - - /* test E*D = 1 mod lcm */ - cpMul_BNU_school(pProduct, pE, nsE, pD, nsD); - prodLen = cpMod_BNU(pProduct, nsE+nsD, pLcm, nsLcm); - - /* restore P and Q */ - pFactorP[0]++; - pFactorQ[0]++; - - return 1==cpEqu_BNU_CHUNK(pProduct, prodLen, 1)? IPP_IS_VALID : IPP_IS_INVALID; -} - -IPPFUN(IppStatus, ippsRSA_ValidateKeys,(int* pResult, - const IppsRSAPublicKeyState* pPublicKey, - const IppsRSAPrivateKeyState* pPrivateKeyType2, - const IppsRSAPrivateKeyState* pPrivateKeyType1, /*optional */ - Ipp8u* pBuffer, - int nTrials, - IppsPrimeState* pPrimeGen, - IppBitSupplier rndFunc, void* pRndParam)) -{ - IPP_BAD_PTR1_RET(pPublicKey); - pPublicKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pPublicKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pPublicKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pPublicKey), ippStsIncompleteContextErr); - - IPP_BAD_PTR1_RET(pPrivateKeyType2); - pPrivateKeyType2 = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrivateKeyType2, RSA_PRIVATE_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY2_VALID_ID(pPrivateKeyType2), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrivateKeyType2), ippStsIncompleteContextErr); - - if(pPrivateKeyType1) { /* pPrivateKeyType1 is optional */ - pPrivateKeyType1 = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrivateKeyType1, RSA_PRIVATE_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY1_VALID_ID(pPrivateKeyType1), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrivateKeyType1), ippStsIncompleteContextErr); - } - - IPP_BAD_PTR1_RET(pPrimeGen); - pPrimeGen = (IppsPrimeState*)( IPP_ALIGNED_PTR(pPrimeGen, PRIME_ALIGNMENT) ); - IPP_BADARG_RET(!PRIME_VALID_ID(pPrimeGen), ippStsContextMatchErr); - IPP_BADARG_RET(PRIME_MAXBITSIZE(pPrimeGen) < RSA_PRV_KEY_BITSIZE_P(pPrivateKeyType2), ippStsSizeErr); - - IPP_BAD_PTR3_RET(pResult, pBuffer, rndFunc); - - /* test security parameter parameter */ - IPP_BADARG_RET((1>nTrials), ippStsBadArgErr); - - { - BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T))); - - /* E key component */ - BNU_CHUNK_T* pExpE = RSA_PUB_KEY_E(pPublicKey); - cpSize nsE = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_E(pPublicKey)); - /* P, dP, invQ key components */ - BNU_CHUNK_T* pFactorP= MNT_MODULUS(RSA_PRV_KEY_PMONT(pPrivateKeyType2)); - BNU_CHUNK_T* pExpDp = RSA_PRV_KEY_DP(pPrivateKeyType2); - BNU_CHUNK_T* pInvQ = RSA_PRV_KEY_INVQ(pPrivateKeyType2); - cpSize nsP = MNT_SIZE(RSA_PRV_KEY_PMONT(pPrivateKeyType2)); - /* Q, dQ key components */ - BNU_CHUNK_T* pFactorQ= MNT_MODULUS(RSA_PRV_KEY_QMONT(pPrivateKeyType2)); - BNU_CHUNK_T* pExpDq = RSA_PRV_KEY_DQ(pPrivateKeyType2); - cpSize nsQ = MNT_SIZE(RSA_PRV_KEY_QMONT(pPrivateKeyType2)); - - /*const*/ BNU_CHUNK_T* pN0 = MNT_MODULUS(RSA_PUB_KEY_NMONT(pPublicKey)); - cpSize nsN = MNT_SIZE(RSA_PUB_KEY_NMONT(pPublicKey)); - - *pResult = IPP_IS_VALID; - - /* make sure P is prime */ - if(!cpPrimeTest(pFactorP, nsP, nTrials, pPrimeGen, rndFunc, pRndParam)) { - *pResult = IPP_IS_COMPOSITE; - return ippStsNoErr; - } - - /* make sure Q is prime */ - if(!cpPrimeTest(pFactorQ, nsQ, nTrials, pPrimeGen, rndFunc, pRndParam)) { - *pResult = IPP_IS_COMPOSITE; - return ippStsNoErr; - } - - /* make sure PubKey(N)==PrivKeytype2(N) and PubKey(N)==PrivKeytype1(N) */ - if(cpCmp_BNU(pN0, nsN, - MNT_MODULUS(RSA_PRV_KEY_NMONT(pPrivateKeyType2)), MNT_SIZE(RSA_PRV_KEY_NMONT(pPrivateKeyType2)))) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - if(pPrivateKeyType1) { - if(cpCmp_BNU(pN0, nsN, - MNT_MODULUS(RSA_PRV_KEY_NMONT(pPrivateKeyType1)), MNT_SIZE(RSA_PRV_KEY_NMONT(pPrivateKeyType1)))) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - } - - /* make sure 3 <= E < N */ - if(1==nsE && pExpE[0]<3) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - if(0 <= cpCmp_BNU(pExpE, nsE, pN0, nsN)) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - - { - BNU_CHUNK_T* pFactor1 = pScratchBuffer; - BNU_CHUNK_T* pInv = pFactor1 +nsP+1; - BNU_CHUNK_T* pBufInv = pInv +nsP+1; - BNU_CHUNK_T* pBufE = pBufInv +nsP+1; - BNU_CHUNK_T* pBufFact = pBufE +nsP+1; - BNU_CHUNK_T* pProduct = pBufInv; - - /* make sure E*dP = 1 mod (P-1) */ - cpDec_BNU(pFactor1, pFactorP, nsP, 1); - cpMul_BNU_school(pProduct, pExpDp, nsP, pExpE, nsE); - cpMod_BNU(pProduct, nsP+nsE, pFactor1, nsP); - if(!cpEqu_BNU_CHUNK(pProduct, nsP, 1)) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - /* make sure 1==GCD(E,P-1) => exist Inv(E,P-1) */ - if(!cpModInv_BNU(pInv, pExpE, nsE, pFactor1, nsP, pBufInv, pBufE, pBufFact)) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - - /* make sure E*dQ = 1 mod (Q-1) */ - cpDec_BNU(pFactor1, pFactorQ, nsQ, 1); - cpMul_BNU_school(pProduct, pExpDq, nsQ, pExpE, nsE); - cpMod_BNU(pProduct, nsQ+nsE, pFactor1, nsQ); - if(!cpEqu_BNU_CHUNK(pProduct, nsQ, 1)) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - /* make sure 1==GCD(E,Q-1) => exist Inv(E,Q-1) */ - if(!cpModInv_BNU(pInv, pExpE, nsE, pFactor1, nsQ, pBufInv, pBufE, pBufFact)) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - } - - /* make sure Q*Qinv = 1 mod P */ - cpMontMul_BNU(pScratchBuffer, - pFactorQ, nsQ, - pInvQ, nsP, - pFactorP, nsP, MNT_HELPER(RSA_PRV_KEY_PMONT(pPrivateKeyType2)), - pScratchBuffer+nsP, NULL); - if(!cpEqu_BNU_CHUNK(pScratchBuffer, nsP, 1)) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - - /* test priva exponent (optiobal) */ - if(pPrivateKeyType1) { - const BNU_CHUNK_T* pExpD = RSA_PRV_KEY_D(pPrivateKeyType1); - cpSize nsD = nsN; - - int resilt1 = isValidPriv1_classic(pN0,nsN, pExpE,nsE, pExpD,nsD, - pFactorP,nsP, pFactorQ,nsQ, - (BNU_CHUNK_T*)pScratchBuffer); - int resilt2 = isValidPriv1_rsa(pN0,nsN, pExpE,nsE, pExpD,nsD, - pFactorP,nsP, pFactorQ,nsQ, - (BNU_CHUNK_T*)pScratchBuffer); - if(IPP_IS_VALID!=resilt1 && IPP_IS_VALID!=resilt2) { - *pResult = IPP_IS_INVALID; - return ippStsNoErr; - } - } - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpprimeg.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + +/*F* +// Name: ippsRSA_ValidateKeys +// +// Purpose: Validate RSA keys +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pPublicKey +// NULL == pPrivateKeyType2 +// NULL == pPrivateKeyType1 +// NULL == pBuffer +// NULL == pPrimeGen +// NULL == rndFunc +// NULL == pResult +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID(pPublicKey) +// !RSA_PRV_KEY2_VALID_ID(pPrivateKeyType2) +// !RSA_PRV_KEY1_VALID_ID(pPrivateKeyType1) +// !PRIME_VALID_ID(pPrimeGen) +// +// ippStsIncompleteContextErr public and.or private key is not set up +// +// ippStsSizeErr PRIME_MAXBITSIZE(pPrimeGen) < factorPbitSize +// +// ippStsBadArgErr nTrials < 1 +// +// ippStsNoErr no error +// +// Parameters: +// pResult pointer to the validation result +// pPublicKey pointer to the public key context +// pPrivateKeyType2 pointer to the private key type2 context +// pPrivateKeyType1 (optional) pointer to the private key type1 context +// pBuffer pointer to the temporary buffer +// nTrials parameter of Miller-Rabin Test +// pPrimeGen pointer to the Prime generator context +// rndFunc external PRNG +// pRndParam pointer to the external PRNG parameters +*F*/ +/* +// make sure D*E = 1 mod(phi(P,Q)) +// where phi(P,Q) = (P-1)*(Q-1) +*/ +static +int isValidPriv1_classic(const BNU_CHUNK_T* pN, int nsN, + const BNU_CHUNK_T* pE, int nsE, + const BNU_CHUNK_T* pD, int nsD, + const BNU_CHUNK_T* pFactorP, int nsP, + const BNU_CHUNK_T* pFactorQ, int nsQ, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* pPhi = pBuffer; + BNU_CHUNK_T* pProduct = pPhi + nsN; + BNU_CHUNK_T c = cpSub_BNU(pPhi, pN, pFactorP, nsP); + int prodLen; + if(nsN>1) cpDec_BNU(pPhi+nsP, pN+nsP, nsQ, c); + c = cpSub_BNU(pPhi,pPhi, pFactorQ, nsQ); + if(nsN>1) cpDec_BNU(pPhi+nsQ, pPhi+nsQ, nsP, c); + cpInc_BNU(pPhi, pPhi, nsP+nsQ, 1); + + cpMul_BNU_school(pProduct, pE, nsE, pD, nsD); + prodLen = cpMod_BNU(pProduct, nsE+nsD, pPhi, nsN); + + return 1==cpEqu_BNU_CHUNK(pProduct, prodLen, 1)? IPP_IS_VALID : IPP_IS_INVALID; +} + +/* +// make sure D*E = 1 mod(lcm(P-1,Q-1)) +// where lcm(P-1,Q-1) = (P-1)*(Q-1)/gcd(P-1,Q-1) +*/ +static +int isValidPriv1_rsa(const BNU_CHUNK_T* pN, int nsN, + const BNU_CHUNK_T* pE, int nsE, + const BNU_CHUNK_T* pD, int nsD, + BNU_CHUNK_T* pFactorP, int nsP, + BNU_CHUNK_T* pFactorQ, int nsQ, + BNU_CHUNK_T* pBuffer) +{ + __ALIGN8 IppsBigNumState tmpBN1; + __ALIGN8 IppsBigNumState tmpBN2; + __ALIGN8 IppsBigNumState tmpBN3; + + BNU_CHUNK_T* pProduct = pBuffer; + BNU_CHUNK_T* pGcd = pProduct+(nsN+1); + BNU_CHUNK_T* pLcm; + int nsLcm; + int prodLen; + pBuffer = pGcd + (nsP+1)*2; + + /* P = P-1 and Q = Q-1 */ + pFactorP[0]--; + pFactorQ[0]--; + + /* compute product (P-1)*(Q-1) = P*Q -P -Q +1 = N -(P-1) -(Q-1) -1 */ + { + BNU_CHUNK_T c = cpSub_BNU(pProduct, pN, pFactorP, nsP); + if(nsN>1) cpDec_BNU(pProduct+nsP, pN+nsP, nsQ, c); + c = cpSub_BNU(pProduct, pProduct, pFactorQ, nsQ); + if(nsN>1) cpDec_BNU(pProduct+nsQ, pProduct+nsQ, nsP, c); + cpDec_BNU(pProduct, pProduct, nsN, 1); + } + + /* compute gcd(p-1, q-1) */ + BN_Make(pGcd, pGcd+nsP+1, nsP, &tmpBN1); /* BN(gcd) */ + BN_SIZE(&tmpBN1) = nsP; + BN_Make(pFactorP, pBuffer, nsP, &tmpBN2); /* BN(P-1) */ + BN_SIZE(&tmpBN2) = nsP; + BN_Make(pFactorQ, pBuffer+nsP+1, nsQ, &tmpBN3); /* BN(Q-1) */ + BN_SIZE(&tmpBN3) = nsQ; + ippsGcd_BN(&tmpBN2, &tmpBN3, &tmpBN1); + + /* compute lcm(p-1, q-1) = (p-1)(q-1)/gcd(p-1, q-1) */ + pLcm = pBuffer; + cpDiv_BNU(pLcm, &nsLcm, pProduct, nsN, pGcd, BN_SIZE(&tmpBN1)); + + /* test E*D = 1 mod lcm */ + cpMul_BNU_school(pProduct, pE, nsE, pD, nsD); + prodLen = cpMod_BNU(pProduct, nsE+nsD, pLcm, nsLcm); + + /* restore P and Q */ + pFactorP[0]++; + pFactorQ[0]++; + + return 1==cpEqu_BNU_CHUNK(pProduct, prodLen, 1)? IPP_IS_VALID : IPP_IS_INVALID; +} + +IPPFUN(IppStatus, ippsRSA_ValidateKeys,(int* pResult, + const IppsRSAPublicKeyState* pPublicKey, + const IppsRSAPrivateKeyState* pPrivateKeyType2, + const IppsRSAPrivateKeyState* pPrivateKeyType1, /*optional */ + Ipp8u* pBuffer, + int nTrials, + IppsPrimeState* pPrimeGen, + IppBitSupplier rndFunc, void* pRndParam)) +{ + IPP_BAD_PTR1_RET(pPublicKey); + pPublicKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pPublicKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pPublicKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pPublicKey), ippStsIncompleteContextErr); + + IPP_BAD_PTR1_RET(pPrivateKeyType2); + pPrivateKeyType2 = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrivateKeyType2, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY2_VALID_ID(pPrivateKeyType2), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrivateKeyType2), ippStsIncompleteContextErr); + + if(pPrivateKeyType1) { /* pPrivateKeyType1 is optional */ + pPrivateKeyType1 = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrivateKeyType1, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY1_VALID_ID(pPrivateKeyType1), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrivateKeyType1), ippStsIncompleteContextErr); + } + + IPP_BAD_PTR1_RET(pPrimeGen); + pPrimeGen = (IppsPrimeState*)( IPP_ALIGNED_PTR(pPrimeGen, PRIME_ALIGNMENT) ); + IPP_BADARG_RET(!PRIME_VALID_ID(pPrimeGen), ippStsContextMatchErr); + IPP_BADARG_RET(PRIME_MAXBITSIZE(pPrimeGen) < RSA_PRV_KEY_BITSIZE_P(pPrivateKeyType2), ippStsSizeErr); + + IPP_BAD_PTR3_RET(pResult, pBuffer, rndFunc); + + /* test security parameter parameter */ + IPP_BADARG_RET((1>nTrials), ippStsBadArgErr); + + { + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T))); + + /* E key component */ + BNU_CHUNK_T* pExpE = RSA_PUB_KEY_E(pPublicKey); + cpSize nsE = BITS_BNU_CHUNK(RSA_PUB_KEY_BITSIZE_E(pPublicKey)); + /* P, dP, invQ key components */ + BNU_CHUNK_T* pFactorP= MNT_MODULUS(RSA_PRV_KEY_PMONT(pPrivateKeyType2)); + BNU_CHUNK_T* pExpDp = RSA_PRV_KEY_DP(pPrivateKeyType2); + BNU_CHUNK_T* pInvQ = RSA_PRV_KEY_INVQ(pPrivateKeyType2); + cpSize nsP = MNT_SIZE(RSA_PRV_KEY_PMONT(pPrivateKeyType2)); + /* Q, dQ key components */ + BNU_CHUNK_T* pFactorQ= MNT_MODULUS(RSA_PRV_KEY_QMONT(pPrivateKeyType2)); + BNU_CHUNK_T* pExpDq = RSA_PRV_KEY_DQ(pPrivateKeyType2); + cpSize nsQ = MNT_SIZE(RSA_PRV_KEY_QMONT(pPrivateKeyType2)); + + /*const*/ BNU_CHUNK_T* pN0 = MNT_MODULUS(RSA_PUB_KEY_NMONT(pPublicKey)); + cpSize nsN = MNT_SIZE(RSA_PUB_KEY_NMONT(pPublicKey)); + + *pResult = IPP_IS_VALID; + + /* make sure P is prime */ + if(!cpPrimeTest(pFactorP, nsP, nTrials, pPrimeGen, rndFunc, pRndParam)) { + *pResult = IPP_IS_COMPOSITE; + return ippStsNoErr; + } + + /* make sure Q is prime */ + if(!cpPrimeTest(pFactorQ, nsQ, nTrials, pPrimeGen, rndFunc, pRndParam)) { + *pResult = IPP_IS_COMPOSITE; + return ippStsNoErr; + } + + /* make sure PubKey(N)==PrivKeytype2(N) and PubKey(N)==PrivKeytype1(N) */ + if(cpCmp_BNU(pN0, nsN, + MNT_MODULUS(RSA_PRV_KEY_NMONT(pPrivateKeyType2)), MNT_SIZE(RSA_PRV_KEY_NMONT(pPrivateKeyType2)))) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + if(pPrivateKeyType1) { + if(cpCmp_BNU(pN0, nsN, + MNT_MODULUS(RSA_PRV_KEY_NMONT(pPrivateKeyType1)), MNT_SIZE(RSA_PRV_KEY_NMONT(pPrivateKeyType1)))) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + } + + /* make sure 3 <= E < N */ + if(1==nsE && pExpE[0]<3) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + if(0 <= cpCmp_BNU(pExpE, nsE, pN0, nsN)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + + { + BNU_CHUNK_T* pFactor1 = pScratchBuffer; + BNU_CHUNK_T* pInv = pFactor1 +nsP+1; + BNU_CHUNK_T* pBufInv = pInv +nsP+1; + BNU_CHUNK_T* pBufE = pBufInv +nsP+1; + BNU_CHUNK_T* pBufFact = pBufE +nsP+1; + BNU_CHUNK_T* pProduct = pBufInv; + + /* make sure E*dP = 1 mod (P-1) */ + cpDec_BNU(pFactor1, pFactorP, nsP, 1); + cpMul_BNU_school(pProduct, pExpDp, nsP, pExpE, nsE); + cpMod_BNU(pProduct, nsP+nsE, pFactor1, nsP); + if(!cpEqu_BNU_CHUNK(pProduct, nsP, 1)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + /* make sure 1==GCD(E,P-1) => exist Inv(E,P-1) */ + if(!cpModInv_BNU(pInv, pExpE, nsE, pFactor1, nsP, pBufInv, pBufE, pBufFact)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + + /* make sure E*dQ = 1 mod (Q-1) */ + cpDec_BNU(pFactor1, pFactorQ, nsQ, 1); + cpMul_BNU_school(pProduct, pExpDq, nsQ, pExpE, nsE); + cpMod_BNU(pProduct, nsQ+nsE, pFactor1, nsQ); + if(!cpEqu_BNU_CHUNK(pProduct, nsQ, 1)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + /* make sure 1==GCD(E,Q-1) => exist Inv(E,Q-1) */ + if(!cpModInv_BNU(pInv, pExpE, nsE, pFactor1, nsQ, pBufInv, pBufE, pBufFact)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + } + + /* make sure Q*Qinv = 1 mod P */ + cpMontMul_BNU(pScratchBuffer, + pFactorQ, nsQ, + pInvQ, nsP, + pFactorP, nsP, MNT_HELPER(RSA_PRV_KEY_PMONT(pPrivateKeyType2)), + pScratchBuffer+nsP, NULL); + if(!cpEqu_BNU_CHUNK(pScratchBuffer, nsP, 1)) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + + /* test priva exponent (optiobal) */ + if(pPrivateKeyType1) { + const BNU_CHUNK_T* pExpD = RSA_PRV_KEY_D(pPrivateKeyType1); + cpSize nsD = nsN; + + int resilt1 = isValidPriv1_classic(pN0,nsN, pExpE,nsE, pExpD,nsD, + pFactorP,nsP, pFactorQ,nsQ, + (BNU_CHUNK_T*)pScratchBuffer); + int resilt2 = isValidPriv1_rsa(pN0,nsN, pExpE,nsE, pExpD,nsD, + pFactorP,nsP, pFactorQ,nsQ, + (BNU_CHUNK_T*)pScratchBuffer); + if(IPP_IS_VALID!=resilt1 && IPP_IS_VALID!=resilt2) { + *pResult = IPP_IS_INVALID; + return ippStsNoErr; + } + } + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c b/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c index f038522c4d..5c4c13e845 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c +++ b/external/crypto_px/sources/ippcp/src/pcpngrsakeyprivate.c @@ -1,496 +1,496 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpngrsa.h" -#include "pcpngrsamontstuff.h" - -/*F* -// Name: ippsRSA_GetSizePrivateKeyType1 -// -// Purpose: Returns context size (bytes) of RSA private key (type1) context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSize -// -// ippStsNotSupportedModeErr MIN_RSA_SIZE > rsaModulusBitSize -// MAX_RSA_SIZE < rsaModulusBitSize -// -// ippStsBadArgErr 0 >= privateExpBitSize -// privateExpBitSize > rsaModulusBitSize -// -// ippStsNoErr no error -// -// Parameters: -// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) -// privateExpBitSize bitsize of private exponent (bitsize of D) -// pSize pointer to the size of RSA key context (bytes) -*F*/ -static int cpSizeof_RSA_privateKey1(int rsaModulusBitSize, int privateExpBitSize) -{ - int prvExpLen = BITS_BNU_CHUNK(privateExpBitSize); - int modulusLen32 = BITS2WORD32_SIZE(rsaModulusBitSize); - int montNsize; - gsMontGetSize(ippBinaryMethod, modulusLen32, &montNsize); - - return sizeof(IppsRSAPrivateKeyState) - + prvExpLen*sizeof(BNU_CHUNK_T) - + sizeof(BNU_CHUNK_T)-1 - + montNsize - + (RSA_PRIVATE_KEY_ALIGNMENT-1); -} - -IPPFUN(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) -{ - IPP_BAD_PTR1_RET(pKeySize); - IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); - IPP_BADARG_RET(!((0 rsaModulusBitSize -// MAX_RSA_SIZE < rsaModulusBitSize -// -// ippStsBadArgErr 0 >= privateExpBitSize -// privateExpBitSize > rsaModulusBitSize -// -// ippStsMemAllocErr keyCtxSize is not enough for operation -// -// ippStsNoErr no error -// -// Parameters: -// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) -// privateExpBitSize bitsize of private exponent (bitsize of D) -// pKey pointer to the key context -// keyCtxSize size of memmory accosizted with key comtext -*F*/ -IPPFUN(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, - IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); - - IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); - IPP_BADARG_RET(!((0= pModulus -// 0 >= pPrivateExp -// -// ippStsSizeErr bitsize(pModulus) exceeds requested value -// bitsize(pPrivateExp) exceeds requested value -// -// ippStsNoErr no error -// -// Parameters: -// pModulus pointer to modulus (N) -// pPrivateExp pointer to public exponent (D) -// pKey pointer to the key context -*F*/ -IPPFUN(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, - const IppsBigNumState* pPrivateExp, - IppsRSAPrivateKeyState* pKey)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY1_VALID_ID(pKey), ippStsContextMatchErr); - - IPP_BAD_PTR1_RET(pModulus); - pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pModulus)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pModulus), BN_SIZE(pModulus)) > RSA_PRV_KEY_MAXSIZE_N(pKey), ippStsSizeErr); - - IPP_BAD_PTR1_RET(pPrivateExp); - pPrivateExp = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivateExp, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pPrivateExp), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pPrivateExp)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPrivateExp), BN_SIZE(pPrivateExp)) > RSA_PRV_KEY_MAXSIZE_D(pKey), ippStsSizeErr); - - { - /* store D */ - ZEXPAND_COPY_BNU(RSA_PRV_KEY_D(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_MAXSIZE_D(pKey)), BN_NUMBER(pPrivateExp), BN_SIZE(pPrivateExp)); - - /* setup montgomery engine */ - gsMontSet((Ipp32u*)BN_NUMBER(pModulus), BN_SIZE32(pModulus), RSA_PRV_KEY_NMONT(pKey)); - - RSA_PRV_KEY_BITSIZE_N(pKey) = cpBN_bitsize(pModulus); - RSA_PRV_KEY_BITSIZE_D(pKey) = cpBN_bitsize(pPrivateExp); - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsRSA_GetSizePrivateKeyType2 -// -// Purpose: Returns context size (bytes) of RSA private key (type2) context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSize -// -// ippStsNotSupportedModeErr MIN_RSA_SIZE > (factorPbitSize+factorQbitSize) -// MAX_RSA_SIZE < (factorPbitSize+factorQbitSize) -// -// ippStsBadArgErr 0 >= factorPbitSize -// 0 >= factorQbitSize -// factorQbitSize > factorPbitSize -// -// ippStsNoErr no error -// -// Parameters: -// factorPbitSize bitsize of RSA modulus (bitsize of P) -// factorPbitSize bitsize of private exponent (bitsize of Q) -// pSize pointer to the size of RSA key context (bytes) -*F*/ -static int cpSizeof_RSA_privateKey2(int factorPbitSize, int factorQbitSize) -{ - int factorPlen = BITS_BNU_CHUNK(factorPbitSize); - int factorQlen = BITS_BNU_CHUNK(factorQbitSize); - int factorPlen32 = BITS2WORD32_SIZE(factorPbitSize); - int factorQlen32 = BITS2WORD32_SIZE(factorQbitSize); - int rsaModulusLen32 = BITS2WORD32_SIZE(factorPbitSize+factorQbitSize); - int montPsize; - int montQsize; - int montNsize; - gsMontGetSize(ippBinaryMethod, factorPlen32, &montPsize); - gsMontGetSize(ippBinaryMethod, factorQlen32, &montQsize); - gsMontGetSize(ippBinaryMethod, rsaModulusLen32, &montNsize); - - return sizeof(IppsRSAPrivateKeyState) - + factorPlen*sizeof(BNU_CHUNK_T) /* dp slot */ - + factorQlen*sizeof(BNU_CHUNK_T) /* dq slot */ - + factorPlen*sizeof(BNU_CHUNK_T) /* qinv slot */ - + sizeof(BNU_CHUNK_T)-1 - + montPsize - + montQsize - + montNsize - + (RSA_PRIVATE_KEY_ALIGNMENT-1); -} - -IPPFUN(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) -{ - IPP_BAD_PTR1_RET(pKeySize); - IPP_BADARG_RET((factorPbitSize<=0) || (factorQbitSize<=0), ippStsBadArgErr); - IPP_BADARG_RET((factorPbitSize < factorQbitSize), ippStsBadArgErr); - IPP_BADARG_RET((MIN_RSA_SIZE>(factorPbitSize+factorQbitSize) || (factorPbitSize+factorQbitSize)>MAX_RSA_SIZE), ippStsNotSupportedModeErr); - - *pKeySize = cpSizeof_RSA_privateKey2(factorPbitSize, factorQbitSize); - return ippStsNoErr; -} - - -/*F* -// Name: ippsRSA_InitPrivateKeyType2 -// -// Purpose: Init RSA private key context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pKey -// -// ippStsNotSupportedModeErr MIN_RSA_SIZE > (factorPbitSize+factorQbitSize) -// MAX_RSA_SIZE < (factorPbitSize+factorQbitSize) -// -// ippStsBadArgErr 0 >= factorPbitSize -// 0 >= factorQbitSize -// factorQbitSize > factorPbitSize -// -// ippStsMemAllocErr keyCtxSize is not enough for operation -// -// ippStsNoErr no error -// -// Parameters: -// factorPbitSize bitsize of RSA modulus (bitsize of P) -// factorQbitSize bitsize of private exponent (bitsize of Q) -// pKey pointer to the key context -// keyCtxSize size of memmory accosizted with key comtext -*F*/ -IPPFUN(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, - IppsRSAPrivateKeyState* pKey, int keyCtxSize)) -{ - IPP_BAD_PTR1_RET(pKey); - IPP_BADARG_RET((factorPbitSize<=0) || (factorQbitSize<=0), ippStsBadArgErr); - IPP_BADARG_RET((factorPbitSize < factorQbitSize), ippStsBadArgErr); - IPP_BADARG_RET((MIN_RSA_SIZE>(factorPbitSize+factorQbitSize) || (factorPbitSize+factorQbitSize)>MAX_RSA_SIZE), ippStsNotSupportedModeErr); - - /* test available size of context buffer */ - IPP_BADARG_RET(keyCtxSize= pFactorP, 0 >= pFactorQ -// 0 >= pCrtExpP, 0 >= pCrtExpQ -// 0 >= pInverseQ -// -// ippStsSizeErr bitsize(pFactorP) exceeds requested value -// bitsize(pFactorQ) exceeds requested value -// bitsize(pCrtExpP) > bitsize(pFactorP) -// bitsize(pCrtExpQ) > bitsize(pFactorQ) -// bitsize(pInverseQ) > bitsize(pFactorP) -// -// ippStsNoErr no error -// -// Parameters: -// pFactorP, pFactorQ pointer to the RSA modulus (N) prime factors -// pCrtExpP, pCrtExpQ pointer to CTR's exponent -// pInverseQ 1/Q mod P -// pKey pointer to the key context -*F*/ -IPPFUN(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, - const IppsBigNumState* pFactorQ, - const IppsBigNumState* pCrtExpP, - const IppsBigNumState* pCrtExpQ, - const IppsBigNumState* pInverseQ, - IppsRSAPrivateKeyState* pKey)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY2_VALID_ID(pKey), ippStsContextMatchErr); - - IPP_BAD_PTR1_RET(pFactorP); - pFactorP = (IppsBigNumState*)( IPP_ALIGNED_PTR(pFactorP, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pFactorP), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pFactorP)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pFactorP), BN_SIZE(pFactorP)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); - - IPP_BAD_PTR1_RET(pFactorQ); - pFactorQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pFactorQ, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pFactorQ), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pFactorQ)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pFactorQ), BN_SIZE(pFactorQ)) > RSA_PRV_KEY_BITSIZE_Q(pKey), ippStsSizeErr); - - /* let P>Q */ - IPP_BADARG_RET(0>=cpBN_cmp(pFactorP,pFactorQ), ippStsBadArgErr); - - IPP_BAD_PTR1_RET(pCrtExpP); - pCrtExpP = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCrtExpP, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pCrtExpP), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pCrtExpP)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pCrtExpP), BN_SIZE(pCrtExpP)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); - - IPP_BAD_PTR1_RET(pCrtExpQ); - pCrtExpQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCrtExpQ, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pCrtExpQ), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pCrtExpQ)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pCrtExpQ), BN_SIZE(pCrtExpQ)) > RSA_PRV_KEY_BITSIZE_Q(pKey), ippStsSizeErr); - - IPP_BAD_PTR1_RET(pInverseQ); - pInverseQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pInverseQ, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pInverseQ), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pInverseQ)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pInverseQ), BN_SIZE(pInverseQ)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); - - /* set bitsize(N) = 0, so the key contex is not ready */ - RSA_PRV_KEY_BITSIZE_N(pKey) = 0; - RSA_PRV_KEY_BITSIZE_D(pKey) = 0; - - /* setup montgomery engine P */ - gsMontSet((Ipp32u*)BN_NUMBER(pFactorP), BN_SIZE32(pFactorP), RSA_PRV_KEY_PMONT(pKey)); - /* setup montgomery engine Q */ - gsMontSet((Ipp32u*)BN_NUMBER(pFactorQ), BN_SIZE32(pFactorQ), RSA_PRV_KEY_QMONT(pKey)); - - /* actual size of key components */ - RSA_PRV_KEY_BITSIZE_P(pKey) = cpBN_bitsize(pFactorP); - RSA_PRV_KEY_BITSIZE_Q(pKey) = cpBN_bitsize(pFactorQ); - - /* store CTR's exp dp */ - ZEXPAND_COPY_BNU(RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_P(pKey)), BN_NUMBER(pCrtExpP), BN_SIZE(pCrtExpP)); - /* store CTR's exp dq */ - ZEXPAND_COPY_BNU(RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_Q(pKey)), BN_NUMBER(pCrtExpQ), BN_SIZE(pCrtExpQ)); - /* store mont encoded CTR's coeff qinv */ - { - IppsMontState* pMontP = RSA_PRV_KEY_PMONT(pKey); - BNU_CHUNK_T* pTmpProduct = MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)); - cpMontMul_BNU(RSA_PRV_KEY_INVQ(pKey), - BN_NUMBER(pInverseQ), BN_SIZE(pInverseQ), - MNT_SQUARE_R(pMontP), MNT_SIZE(pMontP), - MNT_MODULUS(pMontP), MNT_SIZE(pMontP), MNT_HELPER(pMontP), - pTmpProduct, NULL); - } - - /* setup montgomery engine N = P*Q */ - { - BNU_CHUNK_T* pN = MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)); - cpSize nsN = BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_P(pKey) + RSA_PRV_KEY_BITSIZE_Q(pKey)); - - cpMul_BNU_school(pN, - BN_NUMBER(pFactorP), BN_SIZE(pFactorP), - BN_NUMBER(pFactorQ), BN_SIZE(pFactorQ)); - - gsMontSet((Ipp32u*)MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)), BITS2WORD32_SIZE(RSA_PRV_KEY_BITSIZE_P(pKey)+RSA_PRV_KEY_BITSIZE_Q(pKey)), RSA_PRV_KEY_NMONT(pKey)); - - FIX_BNU(pN, nsN); - RSA_PRV_KEY_BITSIZE_N(pKey) = BITSIZE_BNU(pN, nsN); - } - - return ippStsNoErr; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpbn.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + +/*F* +// Name: ippsRSA_GetSizePrivateKeyType1 +// +// Purpose: Returns context size (bytes) of RSA private key (type1) context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= privateExpBitSize +// privateExpBitSize > rsaModulusBitSize +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// privateExpBitSize bitsize of private exponent (bitsize of D) +// pSize pointer to the size of RSA key context (bytes) +*F*/ +static int cpSizeof_RSA_privateKey1(int rsaModulusBitSize, int privateExpBitSize) +{ + int prvExpLen = BITS_BNU_CHUNK(privateExpBitSize); + int modulusLen32 = BITS2WORD32_SIZE(rsaModulusBitSize); + int montNsize; + gsMontGetSize(ippBinaryMethod, modulusLen32, &montNsize); + + return sizeof(IppsRSAPrivateKeyState) + + prvExpLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + montNsize + + (RSA_PRIVATE_KEY_ALIGNMENT-1); +} + +IPPFUN(IppStatus, ippsRSA_GetSizePrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, int* pKeySize)) +{ + IPP_BAD_PTR1_RET(pKeySize); + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0 rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= privateExpBitSize +// privateExpBitSize > rsaModulusBitSize +// +// ippStsMemAllocErr keyCtxSize is not enough for operation +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// privateExpBitSize bitsize of private exponent (bitsize of D) +// pKey pointer to the key context +// keyCtxSize size of memmory accosizted with key comtext +*F*/ +IPPFUN(IppStatus, ippsRSA_InitPrivateKeyType1,(int rsaModulusBitSize, int privateExpBitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0= pModulus +// 0 >= pPrivateExp +// +// ippStsSizeErr bitsize(pModulus) exceeds requested value +// bitsize(pPrivateExp) exceeds requested value +// +// ippStsNoErr no error +// +// Parameters: +// pModulus pointer to modulus (N) +// pPrivateExp pointer to public exponent (D) +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_SetPrivateKeyType1,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPrivateExp, + IppsRSAPrivateKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY1_VALID_ID(pKey), ippStsContextMatchErr); + + IPP_BAD_PTR1_RET(pModulus); + pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pModulus)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pModulus), BN_SIZE(pModulus)) > RSA_PRV_KEY_MAXSIZE_N(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pPrivateExp); + pPrivateExp = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPrivateExp, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPrivateExp), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pPrivateExp)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPrivateExp), BN_SIZE(pPrivateExp)) > RSA_PRV_KEY_MAXSIZE_D(pKey), ippStsSizeErr); + + { + /* store D */ + ZEXPAND_COPY_BNU(RSA_PRV_KEY_D(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_MAXSIZE_D(pKey)), BN_NUMBER(pPrivateExp), BN_SIZE(pPrivateExp)); + + /* setup montgomery engine */ + gsMontSet((Ipp32u*)BN_NUMBER(pModulus), BN_SIZE32(pModulus), RSA_PRV_KEY_NMONT(pKey)); + + RSA_PRV_KEY_BITSIZE_N(pKey) = cpBN_bitsize(pModulus); + RSA_PRV_KEY_BITSIZE_D(pKey) = cpBN_bitsize(pPrivateExp); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRSA_GetSizePrivateKeyType2 +// +// Purpose: Returns context size (bytes) of RSA private key (type2) context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > (factorPbitSize+factorQbitSize) +// MAX_RSA_SIZE < (factorPbitSize+factorQbitSize) +// +// ippStsBadArgErr 0 >= factorPbitSize +// 0 >= factorQbitSize +// factorQbitSize > factorPbitSize +// +// ippStsNoErr no error +// +// Parameters: +// factorPbitSize bitsize of RSA modulus (bitsize of P) +// factorPbitSize bitsize of private exponent (bitsize of Q) +// pSize pointer to the size of RSA key context (bytes) +*F*/ +static int cpSizeof_RSA_privateKey2(int factorPbitSize, int factorQbitSize) +{ + int factorPlen = BITS_BNU_CHUNK(factorPbitSize); + int factorQlen = BITS_BNU_CHUNK(factorQbitSize); + int factorPlen32 = BITS2WORD32_SIZE(factorPbitSize); + int factorQlen32 = BITS2WORD32_SIZE(factorQbitSize); + int rsaModulusLen32 = BITS2WORD32_SIZE(factorPbitSize+factorQbitSize); + int montPsize; + int montQsize; + int montNsize; + gsMontGetSize(ippBinaryMethod, factorPlen32, &montPsize); + gsMontGetSize(ippBinaryMethod, factorQlen32, &montQsize); + gsMontGetSize(ippBinaryMethod, rsaModulusLen32, &montNsize); + + return sizeof(IppsRSAPrivateKeyState) + + factorPlen*sizeof(BNU_CHUNK_T) /* dp slot */ + + factorQlen*sizeof(BNU_CHUNK_T) /* dq slot */ + + factorPlen*sizeof(BNU_CHUNK_T) /* qinv slot */ + + sizeof(BNU_CHUNK_T)-1 + + montPsize + + montQsize + + montNsize + + (RSA_PRIVATE_KEY_ALIGNMENT-1); +} + +IPPFUN(IppStatus, ippsRSA_GetSizePrivateKeyType2,(int factorPbitSize, int factorQbitSize, int* pKeySize)) +{ + IPP_BAD_PTR1_RET(pKeySize); + IPP_BADARG_RET((factorPbitSize<=0) || (factorQbitSize<=0), ippStsBadArgErr); + IPP_BADARG_RET((factorPbitSize < factorQbitSize), ippStsBadArgErr); + IPP_BADARG_RET((MIN_RSA_SIZE>(factorPbitSize+factorQbitSize) || (factorPbitSize+factorQbitSize)>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + + *pKeySize = cpSizeof_RSA_privateKey2(factorPbitSize, factorQbitSize); + return ippStsNoErr; +} + + +/*F* +// Name: ippsRSA_InitPrivateKeyType2 +// +// Purpose: Init RSA private key context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// +// ippStsNotSupportedModeErr MIN_RSA_SIZE > (factorPbitSize+factorQbitSize) +// MAX_RSA_SIZE < (factorPbitSize+factorQbitSize) +// +// ippStsBadArgErr 0 >= factorPbitSize +// 0 >= factorQbitSize +// factorQbitSize > factorPbitSize +// +// ippStsMemAllocErr keyCtxSize is not enough for operation +// +// ippStsNoErr no error +// +// Parameters: +// factorPbitSize bitsize of RSA modulus (bitsize of P) +// factorQbitSize bitsize of private exponent (bitsize of Q) +// pKey pointer to the key context +// keyCtxSize size of memmory accosizted with key comtext +*F*/ +IPPFUN(IppStatus, ippsRSA_InitPrivateKeyType2,(int factorPbitSize, int factorQbitSize, + IppsRSAPrivateKeyState* pKey, int keyCtxSize)) +{ + IPP_BAD_PTR1_RET(pKey); + IPP_BADARG_RET((factorPbitSize<=0) || (factorQbitSize<=0), ippStsBadArgErr); + IPP_BADARG_RET((factorPbitSize < factorQbitSize), ippStsBadArgErr); + IPP_BADARG_RET((MIN_RSA_SIZE>(factorPbitSize+factorQbitSize) || (factorPbitSize+factorQbitSize)>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + + /* test available size of context buffer */ + IPP_BADARG_RET(keyCtxSize= pFactorP, 0 >= pFactorQ +// 0 >= pCrtExpP, 0 >= pCrtExpQ +// 0 >= pInverseQ +// +// ippStsSizeErr bitsize(pFactorP) exceeds requested value +// bitsize(pFactorQ) exceeds requested value +// bitsize(pCrtExpP) > bitsize(pFactorP) +// bitsize(pCrtExpQ) > bitsize(pFactorQ) +// bitsize(pInverseQ) > bitsize(pFactorP) +// +// ippStsNoErr no error +// +// Parameters: +// pFactorP, pFactorQ pointer to the RSA modulus (N) prime factors +// pCrtExpP, pCrtExpQ pointer to CTR's exponent +// pInverseQ 1/Q mod P +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_SetPrivateKeyType2,(const IppsBigNumState* pFactorP, + const IppsBigNumState* pFactorQ, + const IppsBigNumState* pCrtExpP, + const IppsBigNumState* pCrtExpQ, + const IppsBigNumState* pInverseQ, + IppsRSAPrivateKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY2_VALID_ID(pKey), ippStsContextMatchErr); + + IPP_BAD_PTR1_RET(pFactorP); + pFactorP = (IppsBigNumState*)( IPP_ALIGNED_PTR(pFactorP, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pFactorP), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pFactorP)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pFactorP), BN_SIZE(pFactorP)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pFactorQ); + pFactorQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pFactorQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pFactorQ), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pFactorQ)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pFactorQ), BN_SIZE(pFactorQ)) > RSA_PRV_KEY_BITSIZE_Q(pKey), ippStsSizeErr); + + /* let P>Q */ + IPP_BADARG_RET(0>=cpBN_cmp(pFactorP,pFactorQ), ippStsBadArgErr); + + IPP_BAD_PTR1_RET(pCrtExpP); + pCrtExpP = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCrtExpP, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCrtExpP), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pCrtExpP)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pCrtExpP), BN_SIZE(pCrtExpP)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pCrtExpQ); + pCrtExpQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pCrtExpQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pCrtExpQ), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pCrtExpQ)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pCrtExpQ), BN_SIZE(pCrtExpQ)) > RSA_PRV_KEY_BITSIZE_Q(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pInverseQ); + pInverseQ = (IppsBigNumState*)( IPP_ALIGNED_PTR(pInverseQ, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pInverseQ), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pInverseQ)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pInverseQ), BN_SIZE(pInverseQ)) > RSA_PRV_KEY_BITSIZE_P(pKey), ippStsSizeErr); + + /* set bitsize(N) = 0, so the key contex is not ready */ + RSA_PRV_KEY_BITSIZE_N(pKey) = 0; + RSA_PRV_KEY_BITSIZE_D(pKey) = 0; + + /* setup montgomery engine P */ + gsMontSet((Ipp32u*)BN_NUMBER(pFactorP), BN_SIZE32(pFactorP), RSA_PRV_KEY_PMONT(pKey)); + /* setup montgomery engine Q */ + gsMontSet((Ipp32u*)BN_NUMBER(pFactorQ), BN_SIZE32(pFactorQ), RSA_PRV_KEY_QMONT(pKey)); + + /* actual size of key components */ + RSA_PRV_KEY_BITSIZE_P(pKey) = cpBN_bitsize(pFactorP); + RSA_PRV_KEY_BITSIZE_Q(pKey) = cpBN_bitsize(pFactorQ); + + /* store CTR's exp dp */ + ZEXPAND_COPY_BNU(RSA_PRV_KEY_DP(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_P(pKey)), BN_NUMBER(pCrtExpP), BN_SIZE(pCrtExpP)); + /* store CTR's exp dq */ + ZEXPAND_COPY_BNU(RSA_PRV_KEY_DQ(pKey), BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_Q(pKey)), BN_NUMBER(pCrtExpQ), BN_SIZE(pCrtExpQ)); + /* store mont encoded CTR's coeff qinv */ + { + IppsMontState* pMontP = RSA_PRV_KEY_PMONT(pKey); + BNU_CHUNK_T* pTmpProduct = MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)); + cpMontMul_BNU(RSA_PRV_KEY_INVQ(pKey), + BN_NUMBER(pInverseQ), BN_SIZE(pInverseQ), + MNT_SQUARE_R(pMontP), MNT_SIZE(pMontP), + MNT_MODULUS(pMontP), MNT_SIZE(pMontP), MNT_HELPER(pMontP), + pTmpProduct, NULL); + } + + /* setup montgomery engine N = P*Q */ + { + BNU_CHUNK_T* pN = MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)); + cpSize nsN = BITS_BNU_CHUNK(RSA_PRV_KEY_BITSIZE_P(pKey) + RSA_PRV_KEY_BITSIZE_Q(pKey)); + + cpMul_BNU_school(pN, + BN_NUMBER(pFactorP), BN_SIZE(pFactorP), + BN_NUMBER(pFactorQ), BN_SIZE(pFactorQ)); + + gsMontSet((Ipp32u*)MNT_MODULUS(RSA_PRV_KEY_NMONT(pKey)), BITS2WORD32_SIZE(RSA_PRV_KEY_BITSIZE_P(pKey)+RSA_PRV_KEY_BITSIZE_Q(pKey)), RSA_PRV_KEY_NMONT(pKey)); + + FIX_BNU(pN, nsN); + RSA_PRV_KEY_BITSIZE_N(pKey) = BITSIZE_BNU(pN, nsN); + } + + return ippStsNoErr; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c b/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c index 48ca2be853..a76c955d2a 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c +++ b/external/crypto_px/sources/ippcp/src/pcpngrsakeypublic.c @@ -1,272 +1,272 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcpbn.h" -#include "pcpngrsa.h" -#include "pcpngrsamontstuff.h" - - -/*F* -// Name: ippsRSA_GetSizePublicKey -// -// Purpose: Returns context size (bytes) of RSA public key context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSize -// -// ippStsNotSupportedModeErr MIN_RSA_SIZE > rsaModulusBitSize -// MAX_RSA_SIZE < rsaModulusBitSize -// -// ippStsBadArgErr 0 >= publicExpBitSize -// publicExpBitSize > rsaModulusBitSize -// -// ippStsNoErr no error -// -// Parameters: -// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) -// publicExpBitSize bitsize of public exponent (bitsize of E) -// pSize pointer to the size of RSA key context (bytes) -*F*/ -static int cpSizeof_RSA_publicKey(int rsaModulusBitSize, int publicExpBitSize) -{ - int pubExpLen = BITS_BNU_CHUNK(publicExpBitSize); - int modulusLen32 = BITS2WORD32_SIZE(rsaModulusBitSize); - int montNsize; - gsMontGetSize(ippBinaryMethod, modulusLen32, &montNsize); - - return sizeof(IppsRSAPublicKeyState) - + pubExpLen*sizeof(BNU_CHUNK_T) - + sizeof(BNU_CHUNK_T)-1 - + montNsize - + (RSA_PUBLIC_KEY_ALIGNMENT-1); -} - -IPPFUN(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int publicExpBitSize, int* pKeySize)) -{ - IPP_BAD_PTR1_RET(pKeySize); - IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); - IPP_BADARG_RET(!((0 rsaModulusBitSize -// MAX_RSA_SIZE < rsaModulusBitSize -// -// ippStsBadArgErr 0 >= publicExpBitSize -// publicExpBitSize > rsaModulusBitSize -// -// ippStsMemAllocErr keyCtxSize is not enough for operation -// -// ippStsNoErr no error -// -// Parameters: -// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) -// publicExpBitSize bitsize of public exponent (bitsize of E) -// pKey pointer to the key context -// keyCtxSize size of memmory accosizted with key comtext -*F*/ -IPPFUN(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, - IppsRSAPublicKeyState* pKey, int keyCtxSize)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - - IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); - IPP_BADARG_RET(!((0= pModulus -// 0 >= pPublicExp -// -// ippStsSizeErr bitsize(pModulus) exceeds requested value -// bitsize(pPublicExp) exceeds requested value -// -// ippStsNoErr no error -// -// Parameters: -// pModulus pointer to modulus (N) -// pPublicExp pointer to public exponent (E) -// pKey pointer to the key context -*F*/ -IPPFUN(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, - const IppsBigNumState* pPublicExp, - IppsRSAPublicKeyState* pKey)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); - - IPP_BAD_PTR1_RET(pModulus); - pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pModulus)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pModulus), BN_SIZE(pModulus)) > RSA_PUB_KEY_MAXSIZE_N(pKey), ippStsSizeErr); - - IPP_BAD_PTR1_RET(pPublicExp); - pPublicExp = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPublicExp, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pPublicExp), ippStsContextMatchErr); - IPP_BADARG_RET(!(0 < cpBN_tst(pPublicExp)), ippStsOutOfRangeErr); - IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPublicExp), BN_SIZE(pPublicExp)) > RSA_PUB_KEY_MAXSIZE_E(pKey), ippStsSizeErr); - - { - RSA_PUB_KEY_BITSIZE_N(pKey) = 0; - RSA_PUB_KEY_BITSIZE_E(pKey) = 0; - - /* store E */ - ZEXPAND_COPY_BNU(RSA_PUB_KEY_E(pKey), BITS_BNU_CHUNK(RSA_PUB_KEY_MAXSIZE_E(pKey)), BN_NUMBER(pPublicExp), BN_SIZE(pPublicExp)); - - /* setup montgomery engine */ - gsMontSet((Ipp32u*)BN_NUMBER(pModulus), BN_SIZE32(pModulus), RSA_PUB_KEY_NMONT(pKey)); - - RSA_PUB_KEY_BITSIZE_N(pKey) = cpBN_bitsize(pModulus); - RSA_PUB_KEY_BITSIZE_E(pKey) = cpBN_bitsize(pPublicExp); - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsRSA_GetPublicKey -// -// Purpose: Extract key component from the key context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pKey -// -// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() -// !BN_VALID_ID(pModulus) -// !BN_VALID_ID(pExp) -// -// ippStsIncompleteContextErr public key is not set up -// -// ippStsSizeErr BN_ROOM(pModulus), BN_ROOM(pExp) is not enough -// -// ippStsNoErr no error -// -// Parameters: -// pModulus (optional) pointer to the modulus (N) -// pExp (optional) pointer to the public exponent (E) -// pKey pointer to the key context -*F*/ -IPPFUN(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, - IppsBigNumState* pExp, - const IppsRSAPublicKeyState* pKey)) -{ - IPP_BAD_PTR1_RET(pKey); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); - - if(pModulus) { - pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); - IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - IPP_BADARG_RET(BN_ROOM(pModulus) rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= publicExpBitSize +// publicExpBitSize > rsaModulusBitSize +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// publicExpBitSize bitsize of public exponent (bitsize of E) +// pSize pointer to the size of RSA key context (bytes) +*F*/ +static int cpSizeof_RSA_publicKey(int rsaModulusBitSize, int publicExpBitSize) +{ + int pubExpLen = BITS_BNU_CHUNK(publicExpBitSize); + int modulusLen32 = BITS2WORD32_SIZE(rsaModulusBitSize); + int montNsize; + gsMontGetSize(ippBinaryMethod, modulusLen32, &montNsize); + + return sizeof(IppsRSAPublicKeyState) + + pubExpLen*sizeof(BNU_CHUNK_T) + + sizeof(BNU_CHUNK_T)-1 + + montNsize + + (RSA_PUBLIC_KEY_ALIGNMENT-1); +} + +IPPFUN(IppStatus, ippsRSA_GetSizePublicKey,(int rsaModulusBitSize, int publicExpBitSize, int* pKeySize)) +{ + IPP_BAD_PTR1_RET(pKeySize); + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0 rsaModulusBitSize +// MAX_RSA_SIZE < rsaModulusBitSize +// +// ippStsBadArgErr 0 >= publicExpBitSize +// publicExpBitSize > rsaModulusBitSize +// +// ippStsMemAllocErr keyCtxSize is not enough for operation +// +// ippStsNoErr no error +// +// Parameters: +// rsaModulusBitSize bitsize of RSA modulus (bitsize of N) +// publicExpBitSize bitsize of public exponent (bitsize of E) +// pKey pointer to the key context +// keyCtxSize size of memmory accosizted with key comtext +*F*/ +IPPFUN(IppStatus, ippsRSA_InitPublicKey,(int rsaModulusBitSize, int publicExpBitSize, + IppsRSAPublicKeyState* pKey, int keyCtxSize)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + + IPP_BADARG_RET((MIN_RSA_SIZE>rsaModulusBitSize) || (rsaModulusBitSize>MAX_RSA_SIZE), ippStsNotSupportedModeErr); + IPP_BADARG_RET(!((0= pModulus +// 0 >= pPublicExp +// +// ippStsSizeErr bitsize(pModulus) exceeds requested value +// bitsize(pPublicExp) exceeds requested value +// +// ippStsNoErr no error +// +// Parameters: +// pModulus pointer to modulus (N) +// pPublicExp pointer to public exponent (E) +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_SetPublicKey,(const IppsBigNumState* pModulus, + const IppsBigNumState* pPublicExp, + IppsRSAPublicKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + + IPP_BAD_PTR1_RET(pModulus); + pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pModulus)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pModulus), BN_SIZE(pModulus)) > RSA_PUB_KEY_MAXSIZE_N(pKey), ippStsSizeErr); + + IPP_BAD_PTR1_RET(pPublicExp); + pPublicExp = (IppsBigNumState*)( IPP_ALIGNED_PTR(pPublicExp, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pPublicExp), ippStsContextMatchErr); + IPP_BADARG_RET(!(0 < cpBN_tst(pPublicExp)), ippStsOutOfRangeErr); + IPP_BADARG_RET(BITSIZE_BNU(BN_NUMBER(pPublicExp), BN_SIZE(pPublicExp)) > RSA_PUB_KEY_MAXSIZE_E(pKey), ippStsSizeErr); + + { + RSA_PUB_KEY_BITSIZE_N(pKey) = 0; + RSA_PUB_KEY_BITSIZE_E(pKey) = 0; + + /* store E */ + ZEXPAND_COPY_BNU(RSA_PUB_KEY_E(pKey), BITS_BNU_CHUNK(RSA_PUB_KEY_MAXSIZE_E(pKey)), BN_NUMBER(pPublicExp), BN_SIZE(pPublicExp)); + + /* setup montgomery engine */ + gsMontSet((Ipp32u*)BN_NUMBER(pModulus), BN_SIZE32(pModulus), RSA_PUB_KEY_NMONT(pKey)); + + RSA_PUB_KEY_BITSIZE_N(pKey) = cpBN_bitsize(pModulus); + RSA_PUB_KEY_BITSIZE_E(pKey) = cpBN_bitsize(pPublicExp); + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsRSA_GetPublicKey +// +// Purpose: Extract key component from the key context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pKey +// +// ippStsContextMatchErr !RSA_PUB_KEY_VALID_ID() +// !BN_VALID_ID(pModulus) +// !BN_VALID_ID(pExp) +// +// ippStsIncompleteContextErr public key is not set up +// +// ippStsSizeErr BN_ROOM(pModulus), BN_ROOM(pExp) is not enough +// +// ippStsNoErr no error +// +// Parameters: +// pModulus (optional) pointer to the modulus (N) +// pExp (optional) pointer to the public exponent (E) +// pKey pointer to the key context +*F*/ +IPPFUN(IppStatus, ippsRSA_GetPublicKey,(IppsBigNumState* pModulus, + IppsBigNumState* pExp, + const IppsRSAPublicKeyState* pKey)) +{ + IPP_BAD_PTR1_RET(pKey); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + + if(pModulus) { + pModulus = (IppsBigNumState*)( IPP_ALIGNED_PTR(pModulus, BN_ALIGNMENT) ); + IPP_BADARG_RET(!BN_VALID_ID(pModulus), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + IPP_BADARG_RET(BN_ROOM(pModulus)0; nsE--) { - eValue = dataE[nsE-1]; - - for(n=0; n=0; j--) { - mask_pattern = (BNU_CHUNK_T)(back_step-1); - - /* safeBuffer = (Y[] and mask_pattern) or (X[] and ~mask_pattern) */ - for(i=0; i>j) & 0x1) & (back_step^1); - j += back_step; - } - - /* execute rest bits of E */ - for(--nsE; nsE>0; nsE--) { - eValue = dataE[nsE-1]; - - for(j=BNU_CHUNK_BITS-1; j>=0; j--) { - mask_pattern = (BNU_CHUNK_T)(back_step-1); - - /* safeBuffer = (Y[] and mask_pattern) or (X[] and ~mask_pattern) */ - for(i=0; i>j) & 0x1) & (back_step^1); - j += back_step; - } - } - } - - return nsM; -} - - -/* -// "fast" fixed-size window montgomery exponentiation -// -// scratch buffer structure: -// precomutation resource[(1<>shift) &mask; - - /* initialize result */ - COPY_BNU(dataY, pResource+windowVal*nsM, nsM); - - for(eBit-=wBitSize; eBit>=0; eBit-=wBitSize) { - /* do square window times */ - for(n=0,windowVal=0; n>shift) &mask; - - if(windowVal) { - /* extract precomputed value and muptiply */ - cpMul_BNU(pProduct, dataY, nsM, pResource+windowVal*nsM, nsM, pBufferMulK); - cpMontRed_BNU(dataY, pProduct, dataM, nsM, m0); - } - } - } - } - - return nsM; -} - - -/* -// "safe" fixed-size window montgomery exponentiation -// -// scratch buffer structure: -// precomutation resource[(1<>shift) &mask; - - /* initialize result */ - cpScrambleGet((Ipp32u*)dataY, nsM*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), ((Ipp8u*)pResource)+windowVal*chunkSize, chunkSize); - - for(eBit-=bitsizeEwin; eBit>=0; eBit-=bitsizeEwin) { - /* do square window times */ - for(n=0,windowVal=0; n>shift) &mask; - - /* exptact precomputed value and muptiply */ - cpScrambleGet((Ipp32u*)dataT, nsM*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), ((Ipp8u*)pResource)+windowVal*chunkSize, chunkSize); - - cpMul_BNU(pProduct, dataY, nsM, dataT, nsM, pBufferMulK); - cpMontRed_BNU(dataY, pProduct, dataM, nsM, m0); - } - } - } - - return nsM; -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcpscramble.h" +#include "pcpngrsa.h" +#include "pcpngrsamontstuff.h" + + +/* +// Montgomery engine preparation (GetSize/init/Set) +*/ +void gsMontGetSize(IppsExpMethod method, int maxLen32, int* pSize) +{ + cpSize modSize = INTERNAL_BNU_LENGTH(maxLen32); + + UNREFERENCED_PARAMETER(method); + + *pSize = sizeof(IppsMontState) + + modSize*sizeof(BNU_CHUNK_T) /* modulus */ + + modSize*sizeof(BNU_CHUNK_T) /* identity */ + + modSize*sizeof(BNU_CHUNK_T) /* square R */ + + modSize*sizeof(BNU_CHUNK_T) /* just to compute R^2 */ + + MONT_ALIGNMENT-1; +} + +void gsMontInit(IppsExpMethod method, int maxLen32, IppsMontState* pMont) +{ + UNREFERENCED_PARAMETER(method); + + MNT_ID(pMont) = idCtxMontgomery; + MNT_ROOM(pMont) = INTERNAL_BNU_LENGTH(maxLen32); + MNT_SIZE(pMont) = 0; + MNT_HELPER(pMont) = 0; + + MNT_CUBE_R(pMont) = NULL; + MNT_TBUFFER(pMont) = NULL; + MNT_SBUFFER(pMont) = NULL; + MNT_PRODUCT(pMont) = NULL; + MNT_KBUFFER(pMont) = NULL; + + { + Ipp8u* ptr = (Ipp8u*)pMont; + + /* modulus length in BNU_CHUNK_T */ + cpSize modSize = MNT_ROOM(pMont); + + /* assign internal buffers */ + MNT_MODULUS(pMont) = (BNU_CHUNK_T*)( ptr += sizeof(IppsMontState) ); + MNT_1(pMont) = (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + MNT_SQUARE_R(pMont)= (BNU_CHUNK_T*)( ptr += modSize*sizeof(BNU_CHUNK_T) ); + + /* init internal buffers */ + ZEXPAND_BNU(MNT_MODULUS(pMont), 0, modSize); + ZEXPAND_BNU(MNT_1(pMont), 0, modSize); + ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, modSize); + } +} + +static BNU_CHUNK_T cpMontHelper(BNU_CHUNK_T m0) +{ + BNU_CHUNK_T y = 1; + BNU_CHUNK_T x = 2; + BNU_CHUNK_T mask = 2*x-1; + + int i; + for(i=2; i<=BNU_CHUNK_BITS; i++, x<<=1) { + BNU_CHUNK_T rH, rL; + MUL_AB(rH, rL, m0, y); + if( x < (rL & mask) ) /* x < ((m0*y) mod (2*x)) */ + y+=x; + mask += mask + 1; + } + return 0-y; +} + +void gsMontSet(const Ipp32u* pModulus, int len32, IppsMontState* pMont) +{ + BNU_CHUNK_T m0; + cpSize len; + + /* store modulus */ + ZEXPAND_COPY_BNU((Ipp32u*)(MNT_MODULUS(pMont)), MNT_ROOM(pMont)*(int)(sizeof(BNU_CHUNK_T)/sizeof(Ipp32u)), pModulus, len32); + /* store modulus length */ + len = INTERNAL_BNU_LENGTH(len32); + MNT_SIZE(pMont) = len; + + /* pre-compute helper m0, m0*m = -1 mod R */ + m0 = cpMontHelper(MNT_MODULUS(pMont)[0]); + MNT_HELPER(pMont) = m0; + + /* setup identity */ + ZEXPAND_BNU(MNT_1(pMont), 0, len); + MNT_1(pMont)[len] = 1; + cpMod_BNU(MNT_1(pMont), len+1, MNT_MODULUS(pMont), len); + + /* setup square */ + ZEXPAND_BNU(MNT_SQUARE_R(pMont), 0, len); + COPY_BNU(MNT_SQUARE_R(pMont)+len, MNT_1(pMont), len); + cpMod_BNU(MNT_SQUARE_R(pMont), 2*len, MNT_MODULUS(pMont), len); +} + + +/* +// "fast" binary montgomery exponentiation +// +// scratch buffer structure: +// precomutation resource[0] +// copy of base (in case of inplace operation) +// product[nsM*2] +// karatsubaBuffer[gsKaratsubaBufferSize()] +*/ +cpSize gsMontExpBin_BNU(BNU_CHUNK_T* dataY, + const BNU_CHUNK_T* dataX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + cpSize nsM = MNT_SIZE(pMont); + + /* + // test for special cases: + // x^0 = 1 + // 0^e = 0 + */ + if( cpEqu_BNU_CHUNK(dataE, nsE, 0) ) { + COPY_BNU(dataY, MNT_1(pMont), nsM); + } + else if( cpEqu_BNU_CHUNK(dataX, nsX, 0) ) { + ZEXPAND_BNU(dataY, 0, nsM); + } + + /* general case */ + else { + BNU_CHUNK_T* dataM = MNT_MODULUS(pMont); + BNU_CHUNK_T m0 = MNT_HELPER(pMont); + + /* allocate buffers */ + BNU_CHUNK_T* dataT = pBuffer; + BNU_CHUNK_T* pProduct = dataT+nsM; + BNU_CHUNK_T* pBufferMulK = NULL; + BNU_CHUNK_T* pBufferSqrK = NULL; + + /* expand base and init result */ + ZEXPAND_COPY_BNU(dataT, nsM, dataX, nsX); + COPY_BNU(dataY, dataT, nsM); + + FIX_BNU(dataE, nsE); + + /* execute most significant part pE */ + { + BNU_CHUNK_T eValue = dataE[nsE-1]; + int n = cpNLZ_BNU(eValue)+1; + + eValue <<= n; + for(; n0; nsE--) { + eValue = dataE[nsE-1]; + + for(n=0; n=0; j--) { + mask_pattern = (BNU_CHUNK_T)(back_step-1); + + /* safeBuffer = (Y[] and mask_pattern) or (X[] and ~mask_pattern) */ + for(i=0; i>j) & 0x1) & (back_step^1); + j += back_step; + } + + /* execute rest bits of E */ + for(--nsE; nsE>0; nsE--) { + eValue = dataE[nsE-1]; + + for(j=BNU_CHUNK_BITS-1; j>=0; j--) { + mask_pattern = (BNU_CHUNK_T)(back_step-1); + + /* safeBuffer = (Y[] and mask_pattern) or (X[] and ~mask_pattern) */ + for(i=0; i>j) & 0x1) & (back_step^1); + j += back_step; + } + } + } + + return nsM; +} + + +/* +// "fast" fixed-size window montgomery exponentiation +// +// scratch buffer structure: +// precomutation resource[(1<>shift) &mask; + + /* initialize result */ + COPY_BNU(dataY, pResource+windowVal*nsM, nsM); + + for(eBit-=wBitSize; eBit>=0; eBit-=wBitSize) { + /* do square window times */ + for(n=0,windowVal=0; n>shift) &mask; + + if(windowVal) { + /* extract precomputed value and muptiply */ + cpMul_BNU(pProduct, dataY, nsM, pResource+windowVal*nsM, nsM, pBufferMulK); + cpMontRed_BNU(dataY, pProduct, dataM, nsM, m0); + } + } + } + } + + return nsM; +} + + +/* +// "safe" fixed-size window montgomery exponentiation +// +// scratch buffer structure: +// precomutation resource[(1<>shift) &mask; + + /* initialize result */ + cpScrambleGet((Ipp32u*)dataY, nsM*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), ((Ipp8u*)pResource)+windowVal*chunkSize, chunkSize); + + for(eBit-=bitsizeEwin; eBit>=0; eBit-=bitsizeEwin) { + /* do square window times */ + for(n=0,windowVal=0; n>shift) &mask; + + /* exptact precomputed value and muptiply */ + cpScrambleGet((Ipp32u*)dataT, nsM*sizeof(BNU_CHUNK_T)/sizeof(Ipp32u), ((Ipp8u*)pResource)+windowVal*chunkSize, chunkSize); + + cpMul_BNU(pProduct, dataY, nsM, dataT, nsM, pBufferMulK); + cpMontRed_BNU(dataY, pProduct, dataM, nsM, m0); + } + } + } + + return nsM; +} diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h b/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h index beb996aed4..2c69c8f0b3 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h +++ b/external/crypto_px/sources/ippcp/src/pcpngrsamontstuff.h @@ -1,229 +1,229 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_CP_NG_RSA_MONT_STUFF_H) -#define _CP_NG_RSA_MONT_STUFF_H - -#include "pcpbn.h" -#include "pcpmontgomery.h" - -/* -// Montgomery engine preparation (GetSize/init/Set) -*/ -void gsMontGetSize(IppsExpMethod method, int length, int* pSize); -void gsMontInit(IppsExpMethod method, int length, IppsMontState* pCtx); -void gsMontSet(const Ipp32u* pModulo, int size, IppsMontState* pCtx); - - -/* -// optimal size of fixed window exponentiation -*/ -__INLINE cpSize gsMontExp_WinSize(cpSize bitsize) -{ - return - bitsize> 4096? 6 : /* 4096- .. . */ - bitsize> 2666? 5 : /* 2666 - 4095 */ - bitsize> 717? 4 : /* 717 - 2665 */ - bitsize> 178? 3 : /* 178 - 716 */ - bitsize> 41? 2 : 1; /* 41 - 177 */ -} - -/* -// Montgomery encoding/decoding -*/ -__INLINE cpSize gsMontEnc_BNU(BNU_CHUNK_T* pR, - const BNU_CHUNK_T* pXreg, cpSize nsX, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - cpSize nsM = MNT_SIZE(pMont); - BNU_CHUNK_T* pProduct = pBuffer; - BNU_CHUNK_T* pBufferKmul = NULL; - - cpMontMul_BNU(pR, - pXreg, nsX, MNT_SQUARE_R(pMont), nsM, - MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), - pProduct, pBufferKmul); - return nsM; -} - -__INLINE cpSize gsMontDec_BNU(BNU_CHUNK_T* pR, - const BNU_CHUNK_T* pXmont, cpSize nsX, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - cpSize nsM = MNT_SIZE(pMont); - ZEXPAND_COPY_BNU(pBuffer, 2*nsM, pXmont, nsX); - - cpMontRed_BNU(pR, pBuffer, MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); - return nsM; -} - -__INLINE void gsMontEnc_BN(IppsBigNumState* pRbn, - const IppsBigNumState* pXbn, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* pR = BN_NUMBER(pRbn); - cpSize nsM = MNT_SIZE(pMont); - - gsMontEnc_BNU(pR, BN_NUMBER(pXbn), BN_SIZE(pXbn), pMont, pBuffer); - - FIX_BNU(pR, nsM); - BN_SIZE(pRbn) = nsM; - BN_SIGN(pRbn) = ippBigNumPOS; -} - -__INLINE void gsMontDec_BN(IppsBigNumState* pRbn, - const IppsBigNumState* pXbn, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* pR = BN_NUMBER(pRbn); - cpSize nsM = MNT_SIZE(pMont); - - gsMontDec_BNU(pR, BN_NUMBER(pXbn), BN_SIZE(pXbn), pMont, pBuffer); - - FIX_BNU(pR, nsM); - BN_SIZE(pRbn) = nsM; - BN_SIGN(pRbn) = ippBigNumPOS; -} - - -/* -// binary montgomery exponentiation ("fast" version) -*/ -cpSize gsMontExpBin_BNU(BNU_CHUNK_T* dataY, - const BNU_CHUNK_T* dataX, cpSize nsX, - const BNU_CHUNK_T* dataE, cpSize nsE, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer); - -__INLINE void gsMontExpBin_BN(IppsBigNumState* pY, - const IppsBigNumState* pX, - const BNU_CHUNK_T* dataE, cpSize nsE, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* dataY = BN_NUMBER(pY); - cpSize nsY = gsMontExpBin_BNU(dataY, - BN_NUMBER(pX), BN_SIZE(pX), - dataE, nsE, - pMont, pBuffer); - FIX_BNU(dataY, nsY); - BN_SIZE(pY) = nsY; - BN_SIGN(pY) = ippBigNumPOS; -} - -/* -// fixed-size window montgomery exponentiation ("fast" version) -*/ -cpSize gsMontExpWin_BNU(BNU_CHUNK_T* pY, - const BNU_CHUNK_T* pX, cpSize nsX, - const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieW, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer); - -__INLINE void gsMontExpWin_BN(IppsBigNumState* pY, - const IppsBigNumState* pX, - const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieW, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* dataY = BN_NUMBER(pY); - cpSize nsY = gsMontExpWin_BNU(dataY, - BN_NUMBER(pX), BN_SIZE(pX), - dataE, nsE, bitsieW, - pMont, pBuffer); - FIX_BNU(dataY, nsY); - BN_SIZE(pY) = nsY; - BN_SIGN(pY) = ippBigNumPOS; -} - -/* -// binary montgomery exponentiation ("safe" version) -*/ -__INLINE cpSize gsPrecompResourcelen(int n, cpSize nsM) -{ - cpSize nsR = sizeof(BNU_CHUNK_T)*nsM*n + (CACHE_LINE_SIZE-1); - nsR /=CACHE_LINE_SIZE; /* num of cashe lines */ - nsR *= (CACHE_LINE_SIZE/sizeof(BNU_CHUNK_T)); - return nsR; -} - -cpSize gsMontExpBin_BNU_sscm(BNU_CHUNK_T* pY, - const BNU_CHUNK_T* pX, cpSize nsX, - const BNU_CHUNK_T* pE, cpSize nsE, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer); - -__INLINE void gsMontExpBin_BN_sscm(IppsBigNumState* pY, - const IppsBigNumState* pX, - const BNU_CHUNK_T* dataE, cpSize nsE, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* dataY = BN_NUMBER(pY); - cpSize nsY = gsMontExpBin_BNU_sscm(dataY, - BN_NUMBER(pX), BN_SIZE(pX), - dataE, nsE, - pMont, pBuffer); - FIX_BNU(dataY, nsY); - BN_SIZE(pY) = nsY; - BN_SIGN(pY) = ippBigNumPOS; -} - -/* -// fixed-size window montgomery exponentiation ("safe" version) -*/ -cpSize gsMontExpWin_BNU_sscm(BNU_CHUNK_T* dataY, - const BNU_CHUNK_T* dataX, cpSize nsX, - const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieEwin, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer); - -__INLINE void gsMontExpWin_BN_sscm(IppsBigNumState* pY, - const IppsBigNumState* pX, - const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieEwin, - const IppsMontState* pMont, - BNU_CHUNK_T* pBuffer) -{ - BNU_CHUNK_T* dataY = BN_NUMBER(pY); - cpSize nsY = gsMontExpWin_BNU_sscm(dataY, - BN_NUMBER(pX), BN_SIZE(pX), - dataE, nsE, bitsieEwin, - pMont, pBuffer); - FIX_BNU(dataY, nsY); - BN_SIZE(pY) = nsY; - BN_SIGN(pY) = ippBigNumPOS; -} - -#endif /* _CP_NG_RSA_MONT_STUFF_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_NG_RSA_MONT_STUFF_H) +#define _CP_NG_RSA_MONT_STUFF_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + +/* +// Montgomery engine preparation (GetSize/init/Set) +*/ +void gsMontGetSize(IppsExpMethod method, int length, int* pSize); +void gsMontInit(IppsExpMethod method, int length, IppsMontState* pCtx); +void gsMontSet(const Ipp32u* pModulo, int size, IppsMontState* pCtx); + + +/* +// optimal size of fixed window exponentiation +*/ +__INLINE cpSize gsMontExp_WinSize(cpSize bitsize) +{ + return + bitsize> 4096? 6 : /* 4096- .. . */ + bitsize> 2666? 5 : /* 2666 - 4095 */ + bitsize> 717? 4 : /* 717 - 2665 */ + bitsize> 178? 3 : /* 178 - 716 */ + bitsize> 41? 2 : 1; /* 41 - 177 */ +} + +/* +// Montgomery encoding/decoding +*/ +__INLINE cpSize gsMontEnc_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXreg, cpSize nsX, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + cpSize nsM = MNT_SIZE(pMont); + BNU_CHUNK_T* pProduct = pBuffer; + BNU_CHUNK_T* pBufferKmul = NULL; + + cpMontMul_BNU(pR, + pXreg, nsX, MNT_SQUARE_R(pMont), nsM, + MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont), + pProduct, pBufferKmul); + return nsM; +} + +__INLINE cpSize gsMontDec_BNU(BNU_CHUNK_T* pR, + const BNU_CHUNK_T* pXmont, cpSize nsX, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + cpSize nsM = MNT_SIZE(pMont); + ZEXPAND_COPY_BNU(pBuffer, 2*nsM, pXmont, nsX); + + cpMontRed_BNU(pR, pBuffer, MNT_MODULUS(pMont), nsM, MNT_HELPER(pMont)); + return nsM; +} + +__INLINE void gsMontEnc_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + + gsMontEnc_BNU(pR, BN_NUMBER(pXbn), BN_SIZE(pXbn), pMont, pBuffer); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + +__INLINE void gsMontDec_BN(IppsBigNumState* pRbn, + const IppsBigNumState* pXbn, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* pR = BN_NUMBER(pRbn); + cpSize nsM = MNT_SIZE(pMont); + + gsMontDec_BNU(pR, BN_NUMBER(pXbn), BN_SIZE(pXbn), pMont, pBuffer); + + FIX_BNU(pR, nsM); + BN_SIZE(pRbn) = nsM; + BN_SIGN(pRbn) = ippBigNumPOS; +} + + +/* +// binary montgomery exponentiation ("fast" version) +*/ +cpSize gsMontExpBin_BNU(BNU_CHUNK_T* dataY, + const BNU_CHUNK_T* dataX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpBin_BN(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpBin_BNU(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +/* +// fixed-size window montgomery exponentiation ("fast" version) +*/ +cpSize gsMontExpWin_BNU(BNU_CHUNK_T* pY, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieW, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpWin_BN(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieW, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpWin_BNU(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, bitsieW, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +/* +// binary montgomery exponentiation ("safe" version) +*/ +__INLINE cpSize gsPrecompResourcelen(int n, cpSize nsM) +{ + cpSize nsR = sizeof(BNU_CHUNK_T)*nsM*n + (CACHE_LINE_SIZE-1); + nsR /=CACHE_LINE_SIZE; /* num of cashe lines */ + nsR *= (CACHE_LINE_SIZE/sizeof(BNU_CHUNK_T)); + return nsR; +} + +cpSize gsMontExpBin_BNU_sscm(BNU_CHUNK_T* pY, + const BNU_CHUNK_T* pX, cpSize nsX, + const BNU_CHUNK_T* pE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpBin_BN_sscm(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpBin_BNU_sscm(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +/* +// fixed-size window montgomery exponentiation ("safe" version) +*/ +cpSize gsMontExpWin_BNU_sscm(BNU_CHUNK_T* dataY, + const BNU_CHUNK_T* dataX, cpSize nsX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieEwin, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer); + +__INLINE void gsMontExpWin_BN_sscm(IppsBigNumState* pY, + const IppsBigNumState* pX, + const BNU_CHUNK_T* dataE, cpSize nsE, cpSize bitsieEwin, + const IppsMontState* pMont, + BNU_CHUNK_T* pBuffer) +{ + BNU_CHUNK_T* dataY = BN_NUMBER(pY); + cpSize nsY = gsMontExpWin_BNU_sscm(dataY, + BN_NUMBER(pX), BN_SIZE(pX), + dataE, nsE, bitsieEwin, + pMont, pBuffer); + FIX_BNU(dataY, nsY); + BN_SIZE(pY) = nsY; + BN_SIGN(pY) = ippBigNumPOS; +} + +#endif /* _CP_NG_RSA_MONT_STUFF_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c b/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c index 86df1f3a12..c16699fc14 100644 --- a/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c +++ b/external/crypto_px/sources/ippcp/src/pcpngrsassapkcsv15ca.c @@ -1,278 +1,278 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" - -#include "pcpngrsa.h" -#include "pcphash.h" -#include "pcptool.h" - -static int EMSA_PKCSv15(const Ipp8u* msgDg, int lenMsgDg, - const Ipp8u* fixPS, int lenFixPS, - Ipp8u* pEM, int lenEM) -{ - /* - // encoded message format: - // EM = 00 || 01 || PS=(FF..FF) || 00 || T - // T = fixPS || msgDg - // len(PS) >= 8 - */ - int tLen = lenFixPS + lenMsgDg; - - if(lenEM >= tLen+11) { - int psLen = lenEM - 3 - tLen; - - PaddBlock(0xFF, pEM, lenEM); - pEM[0] = 0x00; - pEM[1] = 0x01; - pEM[2+psLen] = 0x00; - CopyBlock(fixPS, pEM+3+psLen, lenFixPS); - CopyBlock(msgDg, pEM+3+psLen+lenFixPS, lenMsgDg); - return 1; - } - else - return 0; /* encoded message length too long */ -} - -/* -// The DER encoding T of the DigestInfo value is equal to the following (see PKCS-1v2-2): -*/ -static const Ipp8u SHA1_fixPS[] = "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14"; -static const Ipp8u SHA224_fixPS[] = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c"; -static const Ipp8u SHA256_fixPS[] = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20"; -static const Ipp8u SHA384_fixPS[] = "\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30"; -static const Ipp8u SHA512_fixPS[] = "\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40"; -static const Ipp8u MD5_fixPS[] = "\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10"; -static const Ipp8u SHA512_224_fixPS[] = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x05\x05\x00\x04\x1c"; -static const Ipp8u SHA512_256_fixPS[] = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x06\x05\x00\x04\x20"; - -typedef struct { - const Ipp8u* pSalt; - int saltLen; -} SaltInfo; - -static SaltInfo pksc15_salt[] = { - {NULL, 0}, - {SHA1_fixPS, sizeof(SHA1_fixPS)-1}, - {SHA256_fixPS, sizeof(SHA256_fixPS)-1}, - {SHA224_fixPS, sizeof(SHA224_fixPS)-1}, - {SHA512_fixPS, sizeof(SHA512_fixPS)-1}, - {SHA384_fixPS, sizeof(SHA384_fixPS)-1}, - { MD5_fixPS, sizeof(MD5_fixPS)-1}, - {NULL, 0}, - {SHA512_224_fixPS, sizeof(SHA512_224_fixPS)-1}, - {SHA512_256_fixPS, sizeof(SHA512_256_fixPS)-1}, -}; -/* //////////////////////////////////////////////////////////////////////////////////////////////// */ - -static int GenerateSing(const Ipp8u* pMsg, int msgLen, /* message representation */ - const Ipp8u* pSalt, int saltLen, /* fied string */ - Ipp8u* pSign, - const IppsRSAPrivateKeyState* pPrvKey, - const IppsRSAPublicKeyState* pPubKey, - Ipp8u* pBuffer) -{ - /* size of RSA modulus in bytes and chunks */ - cpSize rsaBits = RSA_PRV_KEY_BITSIZE_N(pPrvKey); - cpSize k = BITS2WORD8_SIZE(rsaBits); - cpSize nsN = BITS_BNU_CHUNK(rsaBits); - - /* EMSA-PKCS-v1_5 encoding */ - int result = EMSA_PKCSv15(pMsg,msgLen, pSalt,saltLen, pSign, k); - - if(result) { - /* align buffer */ - BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); - - /* temporary BNs */ - __ALIGN8 IppsBigNumState bnC; - __ALIGN8 IppsBigNumState bnP; - - /* make BNs */ - BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnC); - pScratchBuffer += (nsN+1)*2; - BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnP); - pScratchBuffer += (nsN+1)*2; - - /* - // private-key operation - */ - ippsSetOctString_BN(pSign, k, &bnC); - - if(RSA_PRV_KEY1_VALID_ID(pPrvKey)) - gsRSAprv_cipher(&bnP, &bnC, pPrvKey, pScratchBuffer); - else - gsRSAprv_cipher_crt(&bnP, &bnC, pPrvKey, pScratchBuffer); - - ippsGetOctString_BN(pSign, k, &bnP); - - /* check the result before send it out (fault attack mitigatioin) */ - if(pPubKey) { - gsRSApub_cipher(&bnP, &bnP, pPubKey, pScratchBuffer); - - /* check signature before send it out (fault attack mitigatioin) */ - if(0!=cpBN_cmp(&bnP, &bnC)) { - PaddBlock(0, pSign, k); - result = 0; - } - } - } - - return result; -} - -IPPFUN(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, - Ipp8u* pSign, - const IppsRSAPrivateKeyState* pPrvKey, - const IppsRSAPublicKeyState* pPubKey, - IppHashAlgId hashAlg, - Ipp8u* pBuffer)) -{ - /* test private key context */ - IPP_BAD_PTR2_RET(pPrvKey, pBuffer); - pPrvKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrvKey, RSA_PRIVATE_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pPrvKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrvKey), ippStsIncompleteContextErr); - - /* test hash algorith ID */ - hashAlg = cpValidHashAlg(hashAlg); - IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); - - /* use aligned public key context if defined */ - if(pPubKey) { - pPubKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pPubKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pPubKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pPubKey), ippStsIncompleteContextErr); - } - - /* test data pointer */ - IPP_BAD_PTR2_RET(pMsg, pSign); - /* test length */ - IPP_BADARG_RET(msgLen<0, ippStsLengthErr); - - { - Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE]; - int mdLen = cpHashSize(hashAlg); - ippsHashMessage(pMsg, msgLen, md, hashAlg); - - { - const Ipp8u* pSalt = pksc15_salt[hashAlg].pSalt; - int saltLen = pksc15_salt[hashAlg].saltLen; - - int sts = GenerateSing(md, mdLen, - pSalt, saltLen, - pSign, - pPrvKey, pPubKey, pBuffer); - - return (1==sts)? ippStsNoErr : ippStsSizeErr; - } - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - -static int VerifySing(const Ipp8u* pMsg, int msgLen, /* message representation */ - const Ipp8u* pSalt, int saltLen, /* fied string */ - const Ipp8u* pSign, - int* pIsValid, - const IppsRSAPublicKeyState* pKey, - Ipp8u* pBuffer) -{ - /* size of RSA modulus in bytes and chunks */ - cpSize rsaBits = RSA_PUB_KEY_BITSIZE_N(pKey); - cpSize k = BITS2WORD8_SIZE(rsaBits); - cpSize nsN = BITS_BNU_CHUNK(rsaBits); - - /* align buffer */ - BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); - - /* temporary BNs */ - __ALIGN8 IppsBigNumState bnC; - __ALIGN8 IppsBigNumState bnP; - - /* make BNs */ - BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnC); - pScratchBuffer += (nsN+1)*2; - BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnP); - pScratchBuffer += (nsN+1)*2; - - /* - // public-key operation - */ - ippsSetOctString_BN(pSign, k, &bnP); - gsRSApub_cipher(&bnC, &bnP, pKey, pScratchBuffer); - - /* convert EM into the string */ - ippsGetOctString_BN((Ipp8u*)(BN_BUFFER(&bnC)), k, &bnC); - - /* EMSA-PKCS-v1_5 encoding */ - if( EMSA_PKCSv15(pMsg,msgLen, pSalt,saltLen, (Ipp8u*)(BN_NUMBER(&bnC)), k) ) { - *pIsValid = 1==EquBlock((Ipp8u*)(BN_BUFFER(&bnC)), (Ipp8u*)(BN_NUMBER(&bnC)), k); - return 1; - } - else - return 0; -} - -IPPFUN(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, - const Ipp8u* pSign, int* pIsValid, - const IppsRSAPublicKeyState* pKey, - IppHashAlgId hashAlg, - Ipp8u* pBuffer)) -{ - /* test public key context */ - IPP_BAD_PTR2_RET(pKey, pBuffer); - pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); - IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); - IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); - - /* test hash algorith ID */ - hashAlg = cpValidHashAlg(hashAlg); - IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); - - /* test data pointer */ - IPP_BAD_PTR3_RET(pMsg, pSign, pIsValid); - /* test length */ - IPP_BADARG_RET(msgLen<0, ippStsLengthErr); - - *pIsValid = 0; - { - Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE]; - int mdLen = cpHashSize(hashAlg); - ippsHashMessage(pMsg, msgLen, md, hashAlg); - - return VerifySing(md, mdLen, - pksc15_salt[hashAlg].pSalt, pksc15_salt[hashAlg].saltLen, - pSign, pIsValid, - pKey, pBuffer)? ippStsNoErr : ippStsSizeErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcpngrsa.h" +#include "pcphash.h" +#include "pcptool.h" + +static int EMSA_PKCSv15(const Ipp8u* msgDg, int lenMsgDg, + const Ipp8u* fixPS, int lenFixPS, + Ipp8u* pEM, int lenEM) +{ + /* + // encoded message format: + // EM = 00 || 01 || PS=(FF..FF) || 00 || T + // T = fixPS || msgDg + // len(PS) >= 8 + */ + int tLen = lenFixPS + lenMsgDg; + + if(lenEM >= tLen+11) { + int psLen = lenEM - 3 - tLen; + + PaddBlock(0xFF, pEM, lenEM); + pEM[0] = 0x00; + pEM[1] = 0x01; + pEM[2+psLen] = 0x00; + CopyBlock(fixPS, pEM+3+psLen, lenFixPS); + CopyBlock(msgDg, pEM+3+psLen+lenFixPS, lenMsgDg); + return 1; + } + else + return 0; /* encoded message length too long */ +} + +/* +// The DER encoding T of the DigestInfo value is equal to the following (see PKCS-1v2-2): +*/ +static const Ipp8u SHA1_fixPS[] = "\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14"; +static const Ipp8u SHA224_fixPS[] = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c"; +static const Ipp8u SHA256_fixPS[] = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20"; +static const Ipp8u SHA384_fixPS[] = "\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30"; +static const Ipp8u SHA512_fixPS[] = "\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40"; +static const Ipp8u MD5_fixPS[] = "\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10"; +static const Ipp8u SHA512_224_fixPS[] = "\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x05\x05\x00\x04\x1c"; +static const Ipp8u SHA512_256_fixPS[] = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x06\x05\x00\x04\x20"; + +typedef struct { + const Ipp8u* pSalt; + int saltLen; +} SaltInfo; + +static SaltInfo pksc15_salt[] = { + {NULL, 0}, + {SHA1_fixPS, sizeof(SHA1_fixPS)-1}, + {SHA256_fixPS, sizeof(SHA256_fixPS)-1}, + {SHA224_fixPS, sizeof(SHA224_fixPS)-1}, + {SHA512_fixPS, sizeof(SHA512_fixPS)-1}, + {SHA384_fixPS, sizeof(SHA384_fixPS)-1}, + { MD5_fixPS, sizeof(MD5_fixPS)-1}, + {NULL, 0}, + {SHA512_224_fixPS, sizeof(SHA512_224_fixPS)-1}, + {SHA512_256_fixPS, sizeof(SHA512_256_fixPS)-1}, +}; +/* //////////////////////////////////////////////////////////////////////////////////////////////// */ + +static int GenerateSing(const Ipp8u* pMsg, int msgLen, /* message representation */ + const Ipp8u* pSalt, int saltLen, /* fied string */ + Ipp8u* pSign, + const IppsRSAPrivateKeyState* pPrvKey, + const IppsRSAPublicKeyState* pPubKey, + Ipp8u* pBuffer) +{ + /* size of RSA modulus in bytes and chunks */ + cpSize rsaBits = RSA_PRV_KEY_BITSIZE_N(pPrvKey); + cpSize k = BITS2WORD8_SIZE(rsaBits); + cpSize nsN = BITS_BNU_CHUNK(rsaBits); + + /* EMSA-PKCS-v1_5 encoding */ + int result = EMSA_PKCSv15(pMsg,msgLen, pSalt,saltLen, pSign, k); + + if(result) { + /* align buffer */ + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); + + /* temporary BNs */ + __ALIGN8 IppsBigNumState bnC; + __ALIGN8 IppsBigNumState bnP; + + /* make BNs */ + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnC); + pScratchBuffer += (nsN+1)*2; + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnP); + pScratchBuffer += (nsN+1)*2; + + /* + // private-key operation + */ + ippsSetOctString_BN(pSign, k, &bnC); + + if(RSA_PRV_KEY1_VALID_ID(pPrvKey)) + gsRSAprv_cipher(&bnP, &bnC, pPrvKey, pScratchBuffer); + else + gsRSAprv_cipher_crt(&bnP, &bnC, pPrvKey, pScratchBuffer); + + ippsGetOctString_BN(pSign, k, &bnP); + + /* check the result before send it out (fault attack mitigatioin) */ + if(pPubKey) { + gsRSApub_cipher(&bnP, &bnP, pPubKey, pScratchBuffer); + + /* check signature before send it out (fault attack mitigatioin) */ + if(0!=cpBN_cmp(&bnP, &bnC)) { + PaddBlock(0, pSign, k); + result = 0; + } + } + } + + return result; +} + +IPPFUN(IppStatus, ippsRSASign_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + Ipp8u* pSign, + const IppsRSAPrivateKeyState* pPrvKey, + const IppsRSAPublicKeyState* pPubKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +{ + /* test private key context */ + IPP_BAD_PTR2_RET(pPrvKey, pBuffer); + pPrvKey = (IppsRSAPrivateKeyState*)( IPP_ALIGNED_PTR(pPrvKey, RSA_PRIVATE_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PRV_KEY_VALID_ID(pPrvKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PRV_KEY_IS_SET(pPrvKey), ippStsIncompleteContextErr); + + /* test hash algorith ID */ + hashAlg = cpValidHashAlg(hashAlg); + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* use aligned public key context if defined */ + if(pPubKey) { + pPubKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pPubKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pPubKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pPubKey), ippStsIncompleteContextErr); + } + + /* test data pointer */ + IPP_BAD_PTR2_RET(pMsg, pSign); + /* test length */ + IPP_BADARG_RET(msgLen<0, ippStsLengthErr); + + { + Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE]; + int mdLen = cpHashSize(hashAlg); + ippsHashMessage(pMsg, msgLen, md, hashAlg); + + { + const Ipp8u* pSalt = pksc15_salt[hashAlg].pSalt; + int saltLen = pksc15_salt[hashAlg].saltLen; + + int sts = GenerateSing(md, mdLen, + pSalt, saltLen, + pSign, + pPrvKey, pPubKey, pBuffer); + + return (1==sts)? ippStsNoErr : ippStsSizeErr; + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +static int VerifySing(const Ipp8u* pMsg, int msgLen, /* message representation */ + const Ipp8u* pSalt, int saltLen, /* fied string */ + const Ipp8u* pSign, + int* pIsValid, + const IppsRSAPublicKeyState* pKey, + Ipp8u* pBuffer) +{ + /* size of RSA modulus in bytes and chunks */ + cpSize rsaBits = RSA_PUB_KEY_BITSIZE_N(pKey); + cpSize k = BITS2WORD8_SIZE(rsaBits); + cpSize nsN = BITS_BNU_CHUNK(rsaBits); + + /* align buffer */ + BNU_CHUNK_T* pScratchBuffer = (BNU_CHUNK_T*)(IPP_ALIGNED_PTR(pBuffer, (int)sizeof(BNU_CHUNK_T)) ); + + /* temporary BNs */ + __ALIGN8 IppsBigNumState bnC; + __ALIGN8 IppsBigNumState bnP; + + /* make BNs */ + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnC); + pScratchBuffer += (nsN+1)*2; + BN_Make(pScratchBuffer, pScratchBuffer+nsN+1, nsN, &bnP); + pScratchBuffer += (nsN+1)*2; + + /* + // public-key operation + */ + ippsSetOctString_BN(pSign, k, &bnP); + gsRSApub_cipher(&bnC, &bnP, pKey, pScratchBuffer); + + /* convert EM into the string */ + ippsGetOctString_BN((Ipp8u*)(BN_BUFFER(&bnC)), k, &bnC); + + /* EMSA-PKCS-v1_5 encoding */ + if( EMSA_PKCSv15(pMsg,msgLen, pSalt,saltLen, (Ipp8u*)(BN_NUMBER(&bnC)), k) ) { + *pIsValid = 1==EquBlock((Ipp8u*)(BN_BUFFER(&bnC)), (Ipp8u*)(BN_NUMBER(&bnC)), k); + return 1; + } + else + return 0; +} + +IPPFUN(IppStatus, ippsRSAVerify_PKCS1v15,(const Ipp8u* pMsg, int msgLen, + const Ipp8u* pSign, int* pIsValid, + const IppsRSAPublicKeyState* pKey, + IppHashAlgId hashAlg, + Ipp8u* pBuffer)) +{ + /* test public key context */ + IPP_BAD_PTR2_RET(pKey, pBuffer); + pKey = (IppsRSAPublicKeyState*)( IPP_ALIGNED_PTR(pKey, RSA_PUBLIC_KEY_ALIGNMENT) ); + IPP_BADARG_RET(!RSA_PUB_KEY_VALID_ID(pKey), ippStsContextMatchErr); + IPP_BADARG_RET(!RSA_PUB_KEY_IS_SET(pKey), ippStsIncompleteContextErr); + + /* test hash algorith ID */ + hashAlg = cpValidHashAlg(hashAlg); + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + /* test data pointer */ + IPP_BAD_PTR3_RET(pMsg, pSign, pIsValid); + /* test length */ + IPP_BADARG_RET(msgLen<0, ippStsLengthErr); + + *pIsValid = 0; + { + Ipp8u md[IPP_SHA512_DIGEST_BITSIZE/BYTESIZE]; + int mdLen = cpHashSize(hashAlg); + ippsHashMessage(pMsg, msgLen, md, hashAlg); + + return VerifySing(md, mdLen, + pksc15_salt[hashAlg].pSalt, pksc15_salt[hashAlg].saltLen, + pSign, pIsValid, + pKey, pBuffer)? ippStsNoErr : ippStsSizeErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcppma.h b/external/crypto_px/sources/ippcp/src/pcppma.h index b9d1e1ca82..66f5da33fe 100644 --- a/external/crypto_px/sources/ippcp/src/pcppma.h +++ b/external/crypto_px/sources/ippcp/src/pcppma.h @@ -1,83 +1,83 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_PMA_H) -#define _PCP_PMA_H - -#include "pcpbn.h" -#include "pcpmontgomery.h" - - -/* -// Prime Modulo Arithmetic -*/ -#define PMA_set(r,a) \ - BN_SIGN((r)) = BN_SIGN((a)); \ - BN_SIZE((r)) = BN_SIZE((a)); \ - ZEXPAND_COPY_BNU(BN_NUMBER((r)),BN_ROOM((r)), BN_NUMBER((a)),BN_SIZE((a))) \ - -#define PMA_mod(r,a,modulo) \ - ippsMod_BN((a),(modulo),(r)) - -#define PMA_inv(r,a,modulo) \ - ippsModInv_BN((a),(modulo),(r)) - -#define PMA_div2(r,a,modulo) { \ - if( IsOdd_BN((a)) ) { \ - ippsAdd_BN((a), (modulo), (a)); \ - } \ - BN_SIZE((r)) = cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), (int)BN_SIZE((a)), 1); \ - cpBN_fix((r)); \ -} - -#define PMA_add(r,a,b,modulo) \ - ippsAdd_BN((a),(b),(r)); \ - if( cpCmp_BNU(BN_NUMBER((r)),BN_SIZE((r)),BN_NUMBER((modulo)),BN_SIZE(modulo)) >= 0 ) \ - ippsSub_BN((r),(modulo),(r)) - -#define PMA_sub(r,a,b,modulo) \ - ippsSub_BN((a),(b),(r)); \ - if( BN_NEGATIVE((r)) ) \ - ippsAdd_BN((r),(modulo),(r)) - -#define PMA_enc(r,a,mont) \ - cpMontEnc_BN((r), (a), (mont)) - -#define PMA_dec(r,a,mont) \ - cpMontDec_BN((r), (a), (mont)) - -#define PMA_sqre(r,a,mont) \ - ippsMontMul((a),(a), (mont),(r)) - -#define PMA_mule(r,a,b,mont) \ - ippsMontMul((a),(b), (mont),(r)) - -#endif /* _PCP_PMA_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_PMA_H) +#define _PCP_PMA_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + + +/* +// Prime Modulo Arithmetic +*/ +#define PMA_set(r,a) \ + BN_SIGN((r)) = BN_SIGN((a)); \ + BN_SIZE((r)) = BN_SIZE((a)); \ + ZEXPAND_COPY_BNU(BN_NUMBER((r)),BN_ROOM((r)), BN_NUMBER((a)),BN_SIZE((a))) \ + +#define PMA_mod(r,a,modulo) \ + ippsMod_BN((a),(modulo),(r)) + +#define PMA_inv(r,a,modulo) \ + ippsModInv_BN((a),(modulo),(r)) + +#define PMA_div2(r,a,modulo) { \ + if( IsOdd_BN((a)) ) { \ + ippsAdd_BN((a), (modulo), (a)); \ + } \ + BN_SIZE((r)) = cpLSR_BNU(BN_NUMBER((r)), BN_NUMBER((a)), (int)BN_SIZE((a)), 1); \ + cpBN_fix((r)); \ +} + +#define PMA_add(r,a,b,modulo) \ + ippsAdd_BN((a),(b),(r)); \ + if( cpCmp_BNU(BN_NUMBER((r)),BN_SIZE((r)),BN_NUMBER((modulo)),BN_SIZE(modulo)) >= 0 ) \ + ippsSub_BN((r),(modulo),(r)) + +#define PMA_sub(r,a,b,modulo) \ + ippsSub_BN((a),(b),(r)); \ + if( BN_NEGATIVE((r)) ) \ + ippsAdd_BN((r),(modulo),(r)) + +#define PMA_enc(r,a,mont) \ + cpMontEnc_BN((r), (a), (mont)) + +#define PMA_dec(r,a,mont) \ + cpMontDec_BN((r), (a), (mont)) + +#define PMA_sqre(r,a,mont) \ + ippsMontMul((a),(a), (mont),(r)) + +#define PMA_mule(r,a,b,mont) \ + ippsMontMul((a),(b), (mont),(r)) + +#endif /* _PCP_PMA_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpprimeg.h b/external/crypto_px/sources/ippcp/src/pcpprimeg.h index e61d4dee44..7e54efbe61 100644 --- a/external/crypto_px/sources/ippcp/src/pcpprimeg.h +++ b/external/crypto_px/sources/ippcp/src/pcpprimeg.h @@ -1,78 +1,78 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_CP_PRIME_H) -#define _CP_PRIME_H - -#include "pcpbn.h" -#include "pcpmontgomery.h" - - -/* -// Prime context -*/ -struct _cpPrime { - IppCtxId idCtx; /* Prime context identifier */ - cpSize maxBitSize; /* max bit length */ - BNU_CHUNK_T* pPrime; /* prime value */ - BNU_CHUNK_T* pT1; /* temporary BNU */ - BNU_CHUNK_T* pT2; /* temporary BNU */ - BNU_CHUNK_T* pT3; /* temporary BNU */ - IppsMontState* pMont; /* montgomery engine */ -}; - -/* alignment */ -#define PRIME_ALIGNMENT ((int)sizeof(void*)) - -/* Prime accessory macros */ -#define PRIME_ID(ctx) ((ctx)->idCtx) -#define PRIME_MAXBITSIZE(ctx) ((ctx)->maxBitSize) -#define PRIME_NUMBER(ctx) ((ctx)->pPrime) -#define PRIME_TEMP1(ctx) ((ctx)->pT1) -#define PRIME_TEMP2(ctx) ((ctx)->pT2) -#define PRIME_TEMP3(ctx) ((ctx)->pT3) -#define PRIME_MONT(ctx) ((ctx)->pMont) - -#define PRIME_VALID_ID(ctx) (PRIME_ID((ctx))==idCtxPrimeNumber) - -/* easy prime test */ -int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize ns); - -/* prime test */ -int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen, - cpSize nTrials, - IppsPrimeState* pCtx, - IppBitSupplier rndFunc, void* pRndParam); - -void cpPackPrimeCtx(const IppsPrimeState* pCtx, Ipp8u* pBuffer); -void cpUnpackPrimeCtx(const Ipp8u* pBuffer, IppsPrimeState* pCtx); - -#endif /* _CP_PRIME_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_PRIME_H) +#define _CP_PRIME_H + +#include "pcpbn.h" +#include "pcpmontgomery.h" + + +/* +// Prime context +*/ +struct _cpPrime { + IppCtxId idCtx; /* Prime context identifier */ + cpSize maxBitSize; /* max bit length */ + BNU_CHUNK_T* pPrime; /* prime value */ + BNU_CHUNK_T* pT1; /* temporary BNU */ + BNU_CHUNK_T* pT2; /* temporary BNU */ + BNU_CHUNK_T* pT3; /* temporary BNU */ + IppsMontState* pMont; /* montgomery engine */ +}; + +/* alignment */ +#define PRIME_ALIGNMENT ((int)sizeof(void*)) + +/* Prime accessory macros */ +#define PRIME_ID(ctx) ((ctx)->idCtx) +#define PRIME_MAXBITSIZE(ctx) ((ctx)->maxBitSize) +#define PRIME_NUMBER(ctx) ((ctx)->pPrime) +#define PRIME_TEMP1(ctx) ((ctx)->pT1) +#define PRIME_TEMP2(ctx) ((ctx)->pT2) +#define PRIME_TEMP3(ctx) ((ctx)->pT3) +#define PRIME_MONT(ctx) ((ctx)->pMont) + +#define PRIME_VALID_ID(ctx) (PRIME_ID((ctx))==idCtxPrimeNumber) + +/* easy prime test */ +int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize ns); + +/* prime test */ +int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen, + cpSize nTrials, + IppsPrimeState* pCtx, + IppBitSupplier rndFunc, void* pRndParam); + +void cpPackPrimeCtx(const IppsPrimeState* pCtx, Ipp8u* pBuffer); +void cpUnpackPrimeCtx(const Ipp8u* pBuffer, IppsPrimeState* pCtx); + +#endif /* _CP_PRIME_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpprimegenca.c b/external/crypto_px/sources/ippcp/src/pcpprimegenca.c index bfa6ea5518..6b105e8c16 100644 --- a/external/crypto_px/sources/ippcp/src/pcpprimegenca.c +++ b/external/crypto_px/sources/ippcp/src/pcpprimegenca.c @@ -1,472 +1,472 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpprimeg.h" -#include "pcptool.h" - - -/*F* -// Name: ippsPrimeTest -// -// Purpose: Tests the set BN for being a probable prime. -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pCtx -// NULL == pResult -// NULL == rndFunc -// ippStsContextMatchErr illegal pCtx->idCtx -// ippStsOutOfRangeErr zero value under the test -// ippStsBadArgErr 1 > nTrials -// ippStsNoErr no error -// -// Parameters: -// nTrials parameter for the Miller-Rabin probable primality test -// pResult pointer to the test result (IS_COMPOSITE / IS_PRIME) -// pCtx pointer to the context -// rndFunc external PRNG -// pRndParam pointer to the external PRNG parameters -*F*/ - -/* minimal prime test */ -static Ipp32u PrimeList[] = { - 2, 3, 5, 7, 11, 13, 17, 19, - 23, 29, 31, 37, 41, 43, 47, 53, - 59, 61, 67, 71, 73, 79, 83, 89, - 97, 101, 103, 107, 109, 113, 127, 131, - 137, 139, 149, 151, 157, 163, 167, 173, - 179, 181, 191, 193, 197, 199, 211, 223, - 227, 229, 233, 239, 241, 251, 257, 263, - 269, 271, 277, 281, 283, 293, 307, 311, - 313, 317, 331, 337, 347, 349, 353, 359, - 367, 373, 379, 383, 389, 397, 401, 409, - 419, 421, 431, 433, 439, 443, 449, 457, - 461, 463, 467, 479, 487, 491, 499, 503, - 509, 521, 523, 541, 547, 557, 563, 569, - 571, 577, 587, 593, 599, 601, 607, 613, - 617, 619, 631, 641, 643, 647, 653, 659, - 661, 673, 677, 683, 691, 701, 709, 719, - 727, 733, 739, 743, 751, 757, 761, 769, - 773, 787, 797, 809, 811, 821, 823, 827, - 829, 839, 853, 857, 859, 863, 877, 881, - 883, 887, 907, 911, 919, 929, 937, 941, - 947, 953, 967, 971, 977, 983, 991, 997, - 1009,1013,1019,1021,1031,1033,1039,1049, - 1051,1061,1063,1069,1087,1091,1093,1097, - 1103,1109,1117,1123,1129,1151,1153,1163, - 1171,1181,1187,1193,1201,1213,1217,1223, - 1229,1231,1237,1249,1259,1277,1279,1283, - 1289,1291,1297,1301,1303,1307,1319,1321, - 1327,1361,1367,1373,1381,1399,1409,1423, - 1427,1429,1433,1439,1447,1451,1453,1459, - 1471,1481,1483,1487,1489,1493,1499,1511, - 1523,1531,1543,1549,1553,1559,1567,1571, - 1579,1583,1597,1601,1607,1609,1613,1619, - 1621,1627,1637,1657,1663,1667,1669,1693, - 1697,1699,1709,1721,1723,1733,1741,1747, - 1753,1759,1777,1783,1787,1789,1801,1811, - 1823,1831,1847,1861,1867,1871,1873,1877, - 1879,1889,1901,1907,1913,1931,1933,1949, - 1951,1973,1979,1987,1993,1997,1999,2003, - 2011,2017,2027,2029,2039,2053,2063,2069, - 2081,2083,2087,2089,2099,2111,2113,2129, - 2131,2137,2141,2143,2153,2161,2179,2203, - 2207,2213,2221,2237,2239,2243,2251,2267, - 2269,2273,2281,2287,2293,2297,2309,2311, - 2333,2339,2341,2347,2351,2357,2371,2377, - 2381,2383,2389,2393,2399,2411,2417,2423, - 2437,2441,2447,2459,2467,2473,2477,2503, - 2521,2531,2539,2543,2549,2551,2557,2579, - 2591,2593,2609,2617,2621,2633,2647,2657, - 2659,2663,2671,2677,2683,2687,2689,2693, - 2699,2707,2711,2713,2719,2729,2731,2741, - 2749,2753,2767,2777,2789,2791,2797,2801, - 2803,2819,2833,2837,2843,2851,2857,2861, - 2879,2887,2897,2903,2909,2917,2927,2939, - 2953,2957,2963,2969,2971,2999,3001,3011, - 3019,3023,3037,3041,3049,3061,3067,3079, - 3083,3089,3109,3119,3121,3137,3163,3167, - 3169,3181,3187,3191,3203,3209,3217,3221, - 3229,3251,3253,3257,3259,3271,3299,3301, - 3307,3313,3319,3323,3329,3331,3343,3347, - 3359,3361,3371,3373,3389,3391,3407,3413, - 3433,3449,3457,3461,3463,3467,3469,3491, - 3499,3511,3517,3527,3529,3533,3539,3541, - 3547,3557,3559,3571,3581,3583,3593,3607, - 3613,3617,3623,3631,3637,3643,3659,3671, - 3673,3677,3691,3697,3701,3709,3719,3727, - 3733,3739,3761,3767,3769,3779,3793,3797, - 3803,3821,3823,3833,3847,3851,3853,3863, - 3877,3881,3889,3907,3911,3917,3919,3923, - 3929,3931,3943,3947,3967,3989,4001,4003, - 4007,4013,4019,4021,4027,4049,4051,4057, - 4073,4079,4091,4093,4099,4111,4127,4129, - 4133,4139,4153,4157,4159,4177,4201,4211, - 4217,4219,4229,4231,4241,4243,4253,4259, - 4261,4271,4273,4283,4289,4297,4327,4337, - 4339,4349,4357,4363,4373,4391,4397,4409, - 4421,4423,4441,4447,4451,4457,4463,4481, - 4483,4493,4507,4513,4517,4519,4523,4547, - 4549,4561,4567,4583,4591,4597,4603,4621, - 4637,4639,4643,4649,4651,4657,4663,4673, - 4679,4691,4703,4721,4723,4729,4733,4751, - 4759,4783,4787,4789,4793,4799,4801,4813, - 4817,4831,4861,4871,4877,4889,4903,4909, - 4919,4931,4933,4937,4943,4951,4957,4967, - 4969,4973,4987,4993,4999,5003,5009,5011, - 5021,5023,5039,5051,5059,5077,5081,5087, - 5099,5101,5107,5113,5119,5147,5153,5167, - 5171,5179,5189,5197,5209,5227,5231,5233, - 5237,5261,5273,5279,5281,5297,5303,5309, - 5323,5333,5347,5351,5381,5387,5393,5399, - 5407,5413,5417,5419,5431,5437,5441,5443, - 5449,5471,5477,5479,5483,5501,5503,5507, - 5519,5521,5527,5531,5557,5563,5569,5573, - 5581,5591,5623,5639,5641,5647,5651,5653, - 5657,5659,5669,5683,5689,5693,5701,5711, - 5717,5737,5741,5743,5749,5779,5783,5791, - 5801,5807,5813,5821,5827,5839,5843,5849, - 5851,5857,5861,5867,5869,5879,5881,5897, - 5903,5923,5927,5939,5953,5981,5987,6007, - 6011,6029,6037,6043,6047,6053,6067,6073, - 6079,6089,6091,6101,6113,6121,6131,6133, - 6143,6151,6163,6173,6197,6199,6203,6211, - 6217,6221,6229,6247,6257,6263,6269,6271, - 6277,6287,6299,6301,6311,6317,6323,6329, - 6337,6343,6353,6359,6361,6367,6373,6379, - 6389,6397,6421,6427,6449,6451,6469,6473, - 6481,6491,6521,6529,6547,6551,6553,6563, - 6569,6571,6577,6581,6599,6607,6619,6637, - 6653,6659,6661,6673,6679,6689,6691,6701, - 6703,6709,6719,6733,6737,6761,6763,6779, - 6781,6791,6793,6803,6823,6827,6829,6833, - 6841,6857,6863,6869,6871,6883,6899,6907, - 6911,6917,6947,6949,6959,6961,6967,6971, - 6977,6983,6991,6997,7001,7013,7019,7027, - 7039,7043,7057,7069,7079,7103,7109,7121, - 7127,7129,7151,7159,7177,7187,7193,7207, - 7211,7213,7219,7229,7237,7243,7247,7253, - 7283,7297,7307,7309,7321,7331,7333,7349, - 7351,7369,7393,7411,7417,7433,7451,7457, - 7459,7477,7481,7487,7489,7499,7507,7517, - 7523,7529,7537,7541,7547,7549,7559,7561, - 7573,7577,7583,7589,7591,7603,7607,7621, - 7639,7643,7649,7669,7673,7681,7687,7691, - 7699,7703,7717,7723,7727,7741,7753,7757, - 7759,7789,7793,7817,7823,7829,7841,7853, - 7867,7873,7877,7879,7883,7901,7907,7919, - 7927,7933,7937,7949,7951,7963,7993,8009, - 8011,8017,8039,8053,8059,8069,8081,8087, - 8089,8093,8101,8111,8117,8123,8147,8161, - 8167,8171,8179,8191,8209,8219,8221,8231, - 8233,8237,8243,8263,8269,8273,8287,8291, - 8293,8297,8311,8317,8329,8353,8363,8369, - 8377,8387,8389,8419,8423,8429,8431,8443, - 8447,8461,8467,8501,8513,8521,8527,8537, - 8539,8543,8563,8573,8581,8597,8599,8609, - 8623,8627,8629,8641,8647,8663,8669,8677, - 8681,8689,8693,8699,8707,8713,8719,8731, - 8737,8741,8747,8753,8761,8779,8783,8803, - 8807,8819,8821,8831,8837,8839,8849,8861, - 8863,8867,8887,8893,8923,8929,8933,8941, - 8951,8963,8969,8971,8999,9001,9007,9011, - 9013,9029,9041,9043,9049,9059,9067,9091, - 9103,9109,9127,9133,9137,9151,9157,9161, - 9173,9181,9187,9199,9203,9209,9221,9227, - 9239,9241,9257,9277,9281,9283,9293,9311, - 9319,9323,9337,9341,9343,9349,9371,9377, - 9391,9397,9403,9413,9419,9421,9431,9433, - 9437,9439,9461,9463,9467,9473,9479,9491, - 9497,9511,9521,9533,9539,9547,9551,9587, - 9601,9613,9619,9623,9629,9631,9643,9649, - 9661,9677,9679,9689,9697,9719,9721,9733, - 9739,9743,9749,9767,9769,9781,9787,9791, - 9803,9811,9817,9829,9833,9839,9851,9857, - 9859,9871,9883,9887,9901,9907,9923,9929, - 9931,9941,9949,9967,9973,10007,10009,10037, - 10039,10061,10067,10069,10079,10091,10093,10099, - 10103,10111,10133,10139,10141,10151,10159,10163, - 10169,10177,10181,10193,10211,10223,10243,10247, - 10253,10259,10267,10271,10273,10289,10301,10303, - 10313,10321,10331,10333,10337,10343,10357,10369, - 10391,10399,10427,10429,10433,10453,10457,10459, - 10463,10477,10487,10499,10501,10513,10529,10531, - 10559,10567,10589,10597,10601,10607,10613,10627, - 10631,10639,10651,10657,10663,10667,10687,10691, - 10709,10711,10723,10729,10733,10739,10753,10771, - 10781,10789,10799,10831,10837,10847,10853,10859, - 10861,10867,10883,10889,10891,10903,10909,10937, - 10939,10949,10957,10973,10979,10987,10993,11003, - 11027,11047,11057,11059,11069,11071,11083,11087, - 11093,11113,11117,11119,11131,11149,11159,11161, - 11171,11173,11177,11197,11213,11239,11243,11251, - 11257,11261,11273,11279,11287,11299,11311,11317, - 11321,11329,11351,11353,11369,11383,11393,11399, - 11411,11423,11437,11443,11447,11467,11471,11483, - 11489,11491,11497,11503,11519,11527,11549,11551, - 11579,11587,11593,11597,11617,11621,11633,11657, - 11677,11681,11689,11699,11701,11717,11719,11731, - 11743,11777,11779,11783,11789,11801,11807,11813, - 11821,11827,11831,11833,11839,11863,11867,11887, - 11897,11903,11909,11923,11927,11933,11939,11941, - 11953,11959,11969,11971,11981,11987,12007,12011, - 12037,12041,12043,12049,12071,12073,12097,12101, - 12107,12109,12113,12119,12143,12149,12157,12161, - 12163,12197,12203,12211,12227,12239,12241,12251, - 12253,12263,12269,12277,12281,12289,12301,12323, - 12329,12343,12347,12373,12377,12379,12391,12401, - 12409,12413,12421,12433,12437,12451,12457,12473, - 12479,12487,12491,12497,12503,12511,12517,12527, - 12539,12541,12547,12553,12569,12577,12583,12589, - 12601,12611,12613,12619,12637,12641,12647,12653, - 12659,12671,12689,12697,12703,12713,12721,12739, - 12743,12757,12763,12781,12791,12799,12809,12821, - 12823,12829,12841,12853,12889,12893,12899,12907, - 12911,12917,12919,12923,12941,12953,12959,12967, - 12973,12979,12983,13001,13003,13007,13009,13033, - 13037,13043,13049,13063,13093,13099,13103,13109, - 13121,13127,13147,13151,13159,13163,13171,13177, - 13183,13187,13217,13219,13229,13241,13249,13259, - 13267,13291,13297,13309,13313,13327,13331,13337, - 13339,13367,13381,13397,13399,13411,13417,13421, - 13441,13451,13457,13463,13469,13477,13487,13499, - 13513,13523,13537,13553,13567,13577,13591,13597, - 13613,13619,13627,13633,13649,13669,13679,13681, - 13687,13691,13693,13697,13709,13711,13721,13723, - 13729,13751,13757,13759,13763,13781,13789,13799, - 13807,13829,13831,13841,13859,13873,13877,13879, - 13883,13901,13903,13907,13913,13921,13931,13933, - 13963,13967,13997,13999,14009,14011,14029,14033, - 14051,14057,14071,14081,14083,14087,14107,14143, - 14149,14153,14159,14173,14177,14197,14207,14221, - 14243,14249,14251,14281,14293,14303,14321,14323, - 14327,14341,14347,14369,14387,14389,14401,14407, - 14411,14419,14423,14431,14437,14447,14449,14461, - 14479,14489,14503,14519,14533,14537,14543,14549, - 14551,14557,14561,14563,14591,14593,14621,14627, - 14629,14633,14639,14653,14657,14669,14683,14699, - 14713,14717,14723,14731,14737,14741,14747,14753, - 14759,14767,14771,14779,14783,14797,14813,14821, - 14827,14831,14843,14851,14867,14869,14879,14887, - 14891,14897,14923,14929,14939,14947,14951,14957, - 14969,14983,15013,15017,15031,15053,15061,15073, - 15077,15083,15091,15101,15107,15121,15131,15137, - 15139,15149,15161,15173,15187,15193,15199,15217, - 15227,15233,15241,15259,15263,15269,15271,15277, - 15287,15289,15299,15307,15313,15319,15329,15331, - 15349,15359,15361,15373,15377,15383,15391,15401, - 15413,15427,15439,15443,15451,15461,15467,15473, - 15493,15497,15511,15527,15541,15551,15559,15569, - 15581,15583,15601,15607,15619,15629,15641,15643, - 15647,15649,15661,15667,15671,15679,15683,15727, - 15731,15733,15737,15739,15749,15761,15767,15773, - 15787,15791,15797,15803,15809,15817,15823,15859, - 15877,15881,15887,15889,15901,15907,15913,15919, - 15923,15937,15959,15971,15973,15991,16001,16007, - 16033,16057,16061,16063,16067,16069,16073,16087, - 16091,16097,16103,16111,16127,16139,16141,16183, - 16187,16189,16193,16217,16223,16229,16231,16249, - 16253,16267,16273,16301,16319,16333,16339,16349, - 16361,16363,16369,16381,16411,16417,16421,16427, - 16433,16447,16451,16453,16477,16481,16487,16493, - 16519,16529,16547,16553,16561,16567,16573,16603, - 16607,16619,16631,16633,16649,16651,16657,16661, - 16673,16691,16693,16699,16703,16729,16741,16747, - 16759,16763,16787,16811,16823,16829,16831,16843, - 16871,16879,16883,16889,16901,16903,16921,16927, - 16931,16937,16943,16963,16979,16981,16987,16993, - 17011,17021,17027,17029,17033,17041,17047,17053, - 17077,17093,17099,17107,17117,17123,17137,17159, - 17167,17183,17189,17191,17203,17207,17209,17231, - 17239,17257,17291,17293,17299,17317,17321,17327, - 17333,17341,17351,17359,17377,17383,17387,17389, - 17393,17401,17417,17419,17431,17443,17449,17467, - 17471,17477,17483,17489,17491,17497,17509,17519, - 17539,17551,17569,17573,17579,17581,17597,17599, - 17609,17623,17627,17657,17659,17669,17681,17683, - 17707,17713,17729,17737,17747,17749,17761,17783, - 17789,17791,17807,17827,17837,17839,17851,17863 -}; - -static -Ipp32u cpMod32(const Ipp32u* pX, cpSize sizeX, Ipp32u divider) -{ - cpSize n; - Ipp32u r; - for(n=sizeX, r=0; n>0; n--) { - Ipp64u tmp = MAKEDWORD(pX[n-1],r); - r = (Ipp32u)(tmp%divider); - } - return r; -} - -int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize len32) -{ - cpSize i; - - FIX_BNU(pPrime, len32); - - /* take a look in the list */ - if(1==len32) { - for(i=0; i<(cpSize)(sizeof(PrimeList)/sizeof(Ipp32u)); i++) { - if(pPrime[0]==PrimeList[i]) - return 1; - } - } - - /* test if value under the test is divisible by first prime numbers 2,3,5, ... */ - for(i=0; i<(cpSize)(sizeof(PrimeList)/sizeof(Ipp32u)); i++) { - if(0 == cpMod32(pPrime, len32, PrimeList[i])) - return 0; - } - - return 1; -} - -/* Rabin-Miller test */ -static -int RabinMiller(int a, - BNU_CHUNK_T* pZ, - BNU_CHUNK_T* pR, cpSize nsR, - BNU_CHUNK_T* pM, cpSize nsM, - IppsMontState* pMont) -{ - /* modulus and it length and other parameters */ - const BNU_CHUNK_T* pModulus = MNT_MODULUS(pMont); - cpSize modLen = MNT_SIZE(pMont); - BNU_CHUNK_T m0 = MNT_HELPER(pMont); - BNU_CHUNK_T* pProduct = MNT_PRODUCT(pMont); - BNU_CHUNK_T* pKBuffer = MNT_KBUFFER(pMont); - - /* compute z = r^m mod prime */ - nsR = cpMontEnc_BNU(pR, pR, nsR, pMont); - cpMontExpBin_BNU(pZ, pR, nsR, pM, nsM, pMont); - - /* if z==1 => probably prime */ - if(0==cpCmp_BNU(pZ, modLen, MNT_1(pMont), modLen)) - return 1; - - /* if z==prime-1 => probably prime */ - cpSub_BNU(MNT_PRODUCT(pMont), pModulus, MNT_1(pMont), modLen); - if(0==cpCmp_BNU(pZ, modLen, MNT_PRODUCT(pMont), modLen)) - return 1; - - while(--a) { - - /* z = z^2 mod w */ - cpMontSqr_BNU(pZ, pZ, modLen, pModulus, modLen, m0, pProduct, pKBuffer); - - /* if z==1 => definitely composite */ - if(0==cpCmp_BNU(pZ, modLen, MNT_1(pMont), modLen)) - return 1; - - /* if z==w-1 => probably prime */ - cpSub_BNU(MNT_PRODUCT(pMont), pModulus, MNT_1(pMont), modLen); - if(0==cpCmp_BNU(pZ, modLen, MNT_PRODUCT(pMont), modLen)) - return 1; - } - - /* if we are here, then we deal with composize */ - return 0; -} - -int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen, - cpSize nTrials, - IppsPrimeState* pCtx, - IppBitSupplier rndFunc, void* pRndParam) -{ - FIX_BNU(pPrime, primeLen); - - /* 0 is composite number */ - if( primeLen==1 && pPrime[0]==0) - return 0; - - /* 2 is prime number */ - else if( primeLen==1 && pPrime[0]==2) - return 1; - - /* - // test number - */ - else { - cpSize primeBitsize = BITSIZE_BNU(pPrime, primeLen); - cpSize primeLen32 = BITS2WORD32_SIZE(primeBitsize); - - /* apply easy prime test */ - if( 0==cpMimimalPrimeTest((Ipp32u*)pPrime, primeLen32) ) - return 0; - - /* continue test */ - else { - cpSize n, a; - - IppsMontState* pMont = PRIME_MONT(pCtx); - BNU_CHUNK_T* pMdata = PRIME_TEMP1(pCtx); - BNU_CHUNK_T* pRdata = PRIME_TEMP2(pCtx); - BNU_CHUNK_T* pZdata = PRIME_TEMP3(pCtx); - cpSize lenM, lenR; - - /* set up Montgomery engine (and save value being under the test) */ - ippsMontSet((Ipp32u*)pPrime, primeLen32, pMont); - - /* express w = m*2^a + 1 */ - cpDec_BNU(pMdata, pPrime, primeLen, 1); - for(n=0,a=0; n=1 */ - if(!cpTst_BNU(pRdata, lenR)) - pRdata[0] |= 1; - FIX_BNU(pRdata, lenR); - - /* Rabin-Miller test */ - if(0==RabinMiller(a, pZdata, pRdata,lenR, pMdata,lenM, pMont)) - return 0; - } - - return 1; - } - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpprimeg.h" +#include "pcptool.h" + + +/*F* +// Name: ippsPrimeTest +// +// Purpose: Tests the set BN for being a probable prime. +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pCtx +// NULL == pResult +// NULL == rndFunc +// ippStsContextMatchErr illegal pCtx->idCtx +// ippStsOutOfRangeErr zero value under the test +// ippStsBadArgErr 1 > nTrials +// ippStsNoErr no error +// +// Parameters: +// nTrials parameter for the Miller-Rabin probable primality test +// pResult pointer to the test result (IS_COMPOSITE / IS_PRIME) +// pCtx pointer to the context +// rndFunc external PRNG +// pRndParam pointer to the external PRNG parameters +*F*/ + +/* minimal prime test */ +static Ipp32u PrimeList[] = { + 2, 3, 5, 7, 11, 13, 17, 19, + 23, 29, 31, 37, 41, 43, 47, 53, + 59, 61, 67, 71, 73, 79, 83, 89, + 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, + 179, 181, 191, 193, 197, 199, 211, 223, + 227, 229, 233, 239, 241, 251, 257, 263, + 269, 271, 277, 281, 283, 293, 307, 311, + 313, 317, 331, 337, 347, 349, 353, 359, + 367, 373, 379, 383, 389, 397, 401, 409, + 419, 421, 431, 433, 439, 443, 449, 457, + 461, 463, 467, 479, 487, 491, 499, 503, + 509, 521, 523, 541, 547, 557, 563, 569, + 571, 577, 587, 593, 599, 601, 607, 613, + 617, 619, 631, 641, 643, 647, 653, 659, + 661, 673, 677, 683, 691, 701, 709, 719, + 727, 733, 739, 743, 751, 757, 761, 769, + 773, 787, 797, 809, 811, 821, 823, 827, + 829, 839, 853, 857, 859, 863, 877, 881, + 883, 887, 907, 911, 919, 929, 937, 941, + 947, 953, 967, 971, 977, 983, 991, 997, + 1009,1013,1019,1021,1031,1033,1039,1049, + 1051,1061,1063,1069,1087,1091,1093,1097, + 1103,1109,1117,1123,1129,1151,1153,1163, + 1171,1181,1187,1193,1201,1213,1217,1223, + 1229,1231,1237,1249,1259,1277,1279,1283, + 1289,1291,1297,1301,1303,1307,1319,1321, + 1327,1361,1367,1373,1381,1399,1409,1423, + 1427,1429,1433,1439,1447,1451,1453,1459, + 1471,1481,1483,1487,1489,1493,1499,1511, + 1523,1531,1543,1549,1553,1559,1567,1571, + 1579,1583,1597,1601,1607,1609,1613,1619, + 1621,1627,1637,1657,1663,1667,1669,1693, + 1697,1699,1709,1721,1723,1733,1741,1747, + 1753,1759,1777,1783,1787,1789,1801,1811, + 1823,1831,1847,1861,1867,1871,1873,1877, + 1879,1889,1901,1907,1913,1931,1933,1949, + 1951,1973,1979,1987,1993,1997,1999,2003, + 2011,2017,2027,2029,2039,2053,2063,2069, + 2081,2083,2087,2089,2099,2111,2113,2129, + 2131,2137,2141,2143,2153,2161,2179,2203, + 2207,2213,2221,2237,2239,2243,2251,2267, + 2269,2273,2281,2287,2293,2297,2309,2311, + 2333,2339,2341,2347,2351,2357,2371,2377, + 2381,2383,2389,2393,2399,2411,2417,2423, + 2437,2441,2447,2459,2467,2473,2477,2503, + 2521,2531,2539,2543,2549,2551,2557,2579, + 2591,2593,2609,2617,2621,2633,2647,2657, + 2659,2663,2671,2677,2683,2687,2689,2693, + 2699,2707,2711,2713,2719,2729,2731,2741, + 2749,2753,2767,2777,2789,2791,2797,2801, + 2803,2819,2833,2837,2843,2851,2857,2861, + 2879,2887,2897,2903,2909,2917,2927,2939, + 2953,2957,2963,2969,2971,2999,3001,3011, + 3019,3023,3037,3041,3049,3061,3067,3079, + 3083,3089,3109,3119,3121,3137,3163,3167, + 3169,3181,3187,3191,3203,3209,3217,3221, + 3229,3251,3253,3257,3259,3271,3299,3301, + 3307,3313,3319,3323,3329,3331,3343,3347, + 3359,3361,3371,3373,3389,3391,3407,3413, + 3433,3449,3457,3461,3463,3467,3469,3491, + 3499,3511,3517,3527,3529,3533,3539,3541, + 3547,3557,3559,3571,3581,3583,3593,3607, + 3613,3617,3623,3631,3637,3643,3659,3671, + 3673,3677,3691,3697,3701,3709,3719,3727, + 3733,3739,3761,3767,3769,3779,3793,3797, + 3803,3821,3823,3833,3847,3851,3853,3863, + 3877,3881,3889,3907,3911,3917,3919,3923, + 3929,3931,3943,3947,3967,3989,4001,4003, + 4007,4013,4019,4021,4027,4049,4051,4057, + 4073,4079,4091,4093,4099,4111,4127,4129, + 4133,4139,4153,4157,4159,4177,4201,4211, + 4217,4219,4229,4231,4241,4243,4253,4259, + 4261,4271,4273,4283,4289,4297,4327,4337, + 4339,4349,4357,4363,4373,4391,4397,4409, + 4421,4423,4441,4447,4451,4457,4463,4481, + 4483,4493,4507,4513,4517,4519,4523,4547, + 4549,4561,4567,4583,4591,4597,4603,4621, + 4637,4639,4643,4649,4651,4657,4663,4673, + 4679,4691,4703,4721,4723,4729,4733,4751, + 4759,4783,4787,4789,4793,4799,4801,4813, + 4817,4831,4861,4871,4877,4889,4903,4909, + 4919,4931,4933,4937,4943,4951,4957,4967, + 4969,4973,4987,4993,4999,5003,5009,5011, + 5021,5023,5039,5051,5059,5077,5081,5087, + 5099,5101,5107,5113,5119,5147,5153,5167, + 5171,5179,5189,5197,5209,5227,5231,5233, + 5237,5261,5273,5279,5281,5297,5303,5309, + 5323,5333,5347,5351,5381,5387,5393,5399, + 5407,5413,5417,5419,5431,5437,5441,5443, + 5449,5471,5477,5479,5483,5501,5503,5507, + 5519,5521,5527,5531,5557,5563,5569,5573, + 5581,5591,5623,5639,5641,5647,5651,5653, + 5657,5659,5669,5683,5689,5693,5701,5711, + 5717,5737,5741,5743,5749,5779,5783,5791, + 5801,5807,5813,5821,5827,5839,5843,5849, + 5851,5857,5861,5867,5869,5879,5881,5897, + 5903,5923,5927,5939,5953,5981,5987,6007, + 6011,6029,6037,6043,6047,6053,6067,6073, + 6079,6089,6091,6101,6113,6121,6131,6133, + 6143,6151,6163,6173,6197,6199,6203,6211, + 6217,6221,6229,6247,6257,6263,6269,6271, + 6277,6287,6299,6301,6311,6317,6323,6329, + 6337,6343,6353,6359,6361,6367,6373,6379, + 6389,6397,6421,6427,6449,6451,6469,6473, + 6481,6491,6521,6529,6547,6551,6553,6563, + 6569,6571,6577,6581,6599,6607,6619,6637, + 6653,6659,6661,6673,6679,6689,6691,6701, + 6703,6709,6719,6733,6737,6761,6763,6779, + 6781,6791,6793,6803,6823,6827,6829,6833, + 6841,6857,6863,6869,6871,6883,6899,6907, + 6911,6917,6947,6949,6959,6961,6967,6971, + 6977,6983,6991,6997,7001,7013,7019,7027, + 7039,7043,7057,7069,7079,7103,7109,7121, + 7127,7129,7151,7159,7177,7187,7193,7207, + 7211,7213,7219,7229,7237,7243,7247,7253, + 7283,7297,7307,7309,7321,7331,7333,7349, + 7351,7369,7393,7411,7417,7433,7451,7457, + 7459,7477,7481,7487,7489,7499,7507,7517, + 7523,7529,7537,7541,7547,7549,7559,7561, + 7573,7577,7583,7589,7591,7603,7607,7621, + 7639,7643,7649,7669,7673,7681,7687,7691, + 7699,7703,7717,7723,7727,7741,7753,7757, + 7759,7789,7793,7817,7823,7829,7841,7853, + 7867,7873,7877,7879,7883,7901,7907,7919, + 7927,7933,7937,7949,7951,7963,7993,8009, + 8011,8017,8039,8053,8059,8069,8081,8087, + 8089,8093,8101,8111,8117,8123,8147,8161, + 8167,8171,8179,8191,8209,8219,8221,8231, + 8233,8237,8243,8263,8269,8273,8287,8291, + 8293,8297,8311,8317,8329,8353,8363,8369, + 8377,8387,8389,8419,8423,8429,8431,8443, + 8447,8461,8467,8501,8513,8521,8527,8537, + 8539,8543,8563,8573,8581,8597,8599,8609, + 8623,8627,8629,8641,8647,8663,8669,8677, + 8681,8689,8693,8699,8707,8713,8719,8731, + 8737,8741,8747,8753,8761,8779,8783,8803, + 8807,8819,8821,8831,8837,8839,8849,8861, + 8863,8867,8887,8893,8923,8929,8933,8941, + 8951,8963,8969,8971,8999,9001,9007,9011, + 9013,9029,9041,9043,9049,9059,9067,9091, + 9103,9109,9127,9133,9137,9151,9157,9161, + 9173,9181,9187,9199,9203,9209,9221,9227, + 9239,9241,9257,9277,9281,9283,9293,9311, + 9319,9323,9337,9341,9343,9349,9371,9377, + 9391,9397,9403,9413,9419,9421,9431,9433, + 9437,9439,9461,9463,9467,9473,9479,9491, + 9497,9511,9521,9533,9539,9547,9551,9587, + 9601,9613,9619,9623,9629,9631,9643,9649, + 9661,9677,9679,9689,9697,9719,9721,9733, + 9739,9743,9749,9767,9769,9781,9787,9791, + 9803,9811,9817,9829,9833,9839,9851,9857, + 9859,9871,9883,9887,9901,9907,9923,9929, + 9931,9941,9949,9967,9973,10007,10009,10037, + 10039,10061,10067,10069,10079,10091,10093,10099, + 10103,10111,10133,10139,10141,10151,10159,10163, + 10169,10177,10181,10193,10211,10223,10243,10247, + 10253,10259,10267,10271,10273,10289,10301,10303, + 10313,10321,10331,10333,10337,10343,10357,10369, + 10391,10399,10427,10429,10433,10453,10457,10459, + 10463,10477,10487,10499,10501,10513,10529,10531, + 10559,10567,10589,10597,10601,10607,10613,10627, + 10631,10639,10651,10657,10663,10667,10687,10691, + 10709,10711,10723,10729,10733,10739,10753,10771, + 10781,10789,10799,10831,10837,10847,10853,10859, + 10861,10867,10883,10889,10891,10903,10909,10937, + 10939,10949,10957,10973,10979,10987,10993,11003, + 11027,11047,11057,11059,11069,11071,11083,11087, + 11093,11113,11117,11119,11131,11149,11159,11161, + 11171,11173,11177,11197,11213,11239,11243,11251, + 11257,11261,11273,11279,11287,11299,11311,11317, + 11321,11329,11351,11353,11369,11383,11393,11399, + 11411,11423,11437,11443,11447,11467,11471,11483, + 11489,11491,11497,11503,11519,11527,11549,11551, + 11579,11587,11593,11597,11617,11621,11633,11657, + 11677,11681,11689,11699,11701,11717,11719,11731, + 11743,11777,11779,11783,11789,11801,11807,11813, + 11821,11827,11831,11833,11839,11863,11867,11887, + 11897,11903,11909,11923,11927,11933,11939,11941, + 11953,11959,11969,11971,11981,11987,12007,12011, + 12037,12041,12043,12049,12071,12073,12097,12101, + 12107,12109,12113,12119,12143,12149,12157,12161, + 12163,12197,12203,12211,12227,12239,12241,12251, + 12253,12263,12269,12277,12281,12289,12301,12323, + 12329,12343,12347,12373,12377,12379,12391,12401, + 12409,12413,12421,12433,12437,12451,12457,12473, + 12479,12487,12491,12497,12503,12511,12517,12527, + 12539,12541,12547,12553,12569,12577,12583,12589, + 12601,12611,12613,12619,12637,12641,12647,12653, + 12659,12671,12689,12697,12703,12713,12721,12739, + 12743,12757,12763,12781,12791,12799,12809,12821, + 12823,12829,12841,12853,12889,12893,12899,12907, + 12911,12917,12919,12923,12941,12953,12959,12967, + 12973,12979,12983,13001,13003,13007,13009,13033, + 13037,13043,13049,13063,13093,13099,13103,13109, + 13121,13127,13147,13151,13159,13163,13171,13177, + 13183,13187,13217,13219,13229,13241,13249,13259, + 13267,13291,13297,13309,13313,13327,13331,13337, + 13339,13367,13381,13397,13399,13411,13417,13421, + 13441,13451,13457,13463,13469,13477,13487,13499, + 13513,13523,13537,13553,13567,13577,13591,13597, + 13613,13619,13627,13633,13649,13669,13679,13681, + 13687,13691,13693,13697,13709,13711,13721,13723, + 13729,13751,13757,13759,13763,13781,13789,13799, + 13807,13829,13831,13841,13859,13873,13877,13879, + 13883,13901,13903,13907,13913,13921,13931,13933, + 13963,13967,13997,13999,14009,14011,14029,14033, + 14051,14057,14071,14081,14083,14087,14107,14143, + 14149,14153,14159,14173,14177,14197,14207,14221, + 14243,14249,14251,14281,14293,14303,14321,14323, + 14327,14341,14347,14369,14387,14389,14401,14407, + 14411,14419,14423,14431,14437,14447,14449,14461, + 14479,14489,14503,14519,14533,14537,14543,14549, + 14551,14557,14561,14563,14591,14593,14621,14627, + 14629,14633,14639,14653,14657,14669,14683,14699, + 14713,14717,14723,14731,14737,14741,14747,14753, + 14759,14767,14771,14779,14783,14797,14813,14821, + 14827,14831,14843,14851,14867,14869,14879,14887, + 14891,14897,14923,14929,14939,14947,14951,14957, + 14969,14983,15013,15017,15031,15053,15061,15073, + 15077,15083,15091,15101,15107,15121,15131,15137, + 15139,15149,15161,15173,15187,15193,15199,15217, + 15227,15233,15241,15259,15263,15269,15271,15277, + 15287,15289,15299,15307,15313,15319,15329,15331, + 15349,15359,15361,15373,15377,15383,15391,15401, + 15413,15427,15439,15443,15451,15461,15467,15473, + 15493,15497,15511,15527,15541,15551,15559,15569, + 15581,15583,15601,15607,15619,15629,15641,15643, + 15647,15649,15661,15667,15671,15679,15683,15727, + 15731,15733,15737,15739,15749,15761,15767,15773, + 15787,15791,15797,15803,15809,15817,15823,15859, + 15877,15881,15887,15889,15901,15907,15913,15919, + 15923,15937,15959,15971,15973,15991,16001,16007, + 16033,16057,16061,16063,16067,16069,16073,16087, + 16091,16097,16103,16111,16127,16139,16141,16183, + 16187,16189,16193,16217,16223,16229,16231,16249, + 16253,16267,16273,16301,16319,16333,16339,16349, + 16361,16363,16369,16381,16411,16417,16421,16427, + 16433,16447,16451,16453,16477,16481,16487,16493, + 16519,16529,16547,16553,16561,16567,16573,16603, + 16607,16619,16631,16633,16649,16651,16657,16661, + 16673,16691,16693,16699,16703,16729,16741,16747, + 16759,16763,16787,16811,16823,16829,16831,16843, + 16871,16879,16883,16889,16901,16903,16921,16927, + 16931,16937,16943,16963,16979,16981,16987,16993, + 17011,17021,17027,17029,17033,17041,17047,17053, + 17077,17093,17099,17107,17117,17123,17137,17159, + 17167,17183,17189,17191,17203,17207,17209,17231, + 17239,17257,17291,17293,17299,17317,17321,17327, + 17333,17341,17351,17359,17377,17383,17387,17389, + 17393,17401,17417,17419,17431,17443,17449,17467, + 17471,17477,17483,17489,17491,17497,17509,17519, + 17539,17551,17569,17573,17579,17581,17597,17599, + 17609,17623,17627,17657,17659,17669,17681,17683, + 17707,17713,17729,17737,17747,17749,17761,17783, + 17789,17791,17807,17827,17837,17839,17851,17863 +}; + +static +Ipp32u cpMod32(const Ipp32u* pX, cpSize sizeX, Ipp32u divider) +{ + cpSize n; + Ipp32u r; + for(n=sizeX, r=0; n>0; n--) { + Ipp64u tmp = MAKEDWORD(pX[n-1],r); + r = (Ipp32u)(tmp%divider); + } + return r; +} + +int cpMimimalPrimeTest(const Ipp32u* pPrime, cpSize len32) +{ + cpSize i; + + FIX_BNU(pPrime, len32); + + /* take a look in the list */ + if(1==len32) { + for(i=0; i<(cpSize)(sizeof(PrimeList)/sizeof(Ipp32u)); i++) { + if(pPrime[0]==PrimeList[i]) + return 1; + } + } + + /* test if value under the test is divisible by first prime numbers 2,3,5, ... */ + for(i=0; i<(cpSize)(sizeof(PrimeList)/sizeof(Ipp32u)); i++) { + if(0 == cpMod32(pPrime, len32, PrimeList[i])) + return 0; + } + + return 1; +} + +/* Rabin-Miller test */ +static +int RabinMiller(int a, + BNU_CHUNK_T* pZ, + BNU_CHUNK_T* pR, cpSize nsR, + BNU_CHUNK_T* pM, cpSize nsM, + IppsMontState* pMont) +{ + /* modulus and it length and other parameters */ + const BNU_CHUNK_T* pModulus = MNT_MODULUS(pMont); + cpSize modLen = MNT_SIZE(pMont); + BNU_CHUNK_T m0 = MNT_HELPER(pMont); + BNU_CHUNK_T* pProduct = MNT_PRODUCT(pMont); + BNU_CHUNK_T* pKBuffer = MNT_KBUFFER(pMont); + + /* compute z = r^m mod prime */ + nsR = cpMontEnc_BNU(pR, pR, nsR, pMont); + cpMontExpBin_BNU(pZ, pR, nsR, pM, nsM, pMont); + + /* if z==1 => probably prime */ + if(0==cpCmp_BNU(pZ, modLen, MNT_1(pMont), modLen)) + return 1; + + /* if z==prime-1 => probably prime */ + cpSub_BNU(MNT_PRODUCT(pMont), pModulus, MNT_1(pMont), modLen); + if(0==cpCmp_BNU(pZ, modLen, MNT_PRODUCT(pMont), modLen)) + return 1; + + while(--a) { + + /* z = z^2 mod w */ + cpMontSqr_BNU(pZ, pZ, modLen, pModulus, modLen, m0, pProduct, pKBuffer); + + /* if z==1 => definitely composite */ + if(0==cpCmp_BNU(pZ, modLen, MNT_1(pMont), modLen)) + return 1; + + /* if z==w-1 => probably prime */ + cpSub_BNU(MNT_PRODUCT(pMont), pModulus, MNT_1(pMont), modLen); + if(0==cpCmp_BNU(pZ, modLen, MNT_PRODUCT(pMont), modLen)) + return 1; + } + + /* if we are here, then we deal with composize */ + return 0; +} + +int cpPrimeTest(const BNU_CHUNK_T* pPrime, cpSize primeLen, + cpSize nTrials, + IppsPrimeState* pCtx, + IppBitSupplier rndFunc, void* pRndParam) +{ + FIX_BNU(pPrime, primeLen); + + /* 0 is composite number */ + if( primeLen==1 && pPrime[0]==0) + return 0; + + /* 2 is prime number */ + else if( primeLen==1 && pPrime[0]==2) + return 1; + + /* + // test number + */ + else { + cpSize primeBitsize = BITSIZE_BNU(pPrime, primeLen); + cpSize primeLen32 = BITS2WORD32_SIZE(primeBitsize); + + /* apply easy prime test */ + if( 0==cpMimimalPrimeTest((Ipp32u*)pPrime, primeLen32) ) + return 0; + + /* continue test */ + else { + cpSize n, a; + + IppsMontState* pMont = PRIME_MONT(pCtx); + BNU_CHUNK_T* pMdata = PRIME_TEMP1(pCtx); + BNU_CHUNK_T* pRdata = PRIME_TEMP2(pCtx); + BNU_CHUNK_T* pZdata = PRIME_TEMP3(pCtx); + cpSize lenM, lenR; + + /* set up Montgomery engine (and save value being under the test) */ + ippsMontSet((Ipp32u*)pPrime, primeLen32, pMont); + + /* express w = m*2^a + 1 */ + cpDec_BNU(pMdata, pPrime, primeLen, 1); + for(n=0,a=0; n=1 */ + if(!cpTst_BNU(pRdata, lenR)) + pRdata[0] |= 1; + FIX_BNU(pRdata, lenR); + + /* Rabin-Miller test */ + if(0==RabinMiller(a, pZdata, pRdata,lenR, pMdata,lenM, pMont)) + return 0; + } + + return 1; + } + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c b/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c index e3eeefe141..2a8af24616 100644 --- a/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c +++ b/external/crypto_px/sources/ippcp/src/pcpprimeginitca.c @@ -1,124 +1,124 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owncp.h" -#include "pcpprimeg.h" -#include "pcptool.h" - - -/*F* -// Name: ippsPrimeGetSize -// -// Purpose: Returns size of Prime Number Generator context (bytes). -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSize -// ippStsLengthErr 1 > maxBits -// ippStsNoErr no error -// -// Parameters: -// maxBits max length of a prime number -// pSize pointer to the size of internal context -*F*/ -IPPFUN(IppStatus, ippsPrimeGetSize, (cpSize maxBits, cpSize* pSize)) -{ - IPP_BAD_PTR1_RET(pSize); - IPP_BADARG_RET(maxBits<1, ippStsLengthErr); - - { - cpSize len = BITS_BNU_CHUNK(maxBits); - cpSize len32 = BITS2WORD32_SIZE(maxBits); - cpSize montSize; - ippsMontGetSize(ippBinaryMethod, len32, &montSize); - - *pSize = sizeof(IppsPrimeState) - +len*sizeof(BNU_CHUNK_T) - +len*sizeof(BNU_CHUNK_T) - +len*sizeof(BNU_CHUNK_T) - +len*sizeof(BNU_CHUNK_T) - +montSize - +PRIME_ALIGNMENT-1; - - return ippStsNoErr; - } -} - - -/*F* -// Name: ippsPrimeInit -// -// Purpose: Initializes Prime Number Generator context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pCtx -// ippStsLengthErr 1 > maxBits -// ippStsNoErr no error -// -// Parameters: -// maxBits max length of a prime number -// pCtx pointer to the context to be initialized -*F*/ -IPPFUN(IppStatus, ippsPrimeInit, (cpSize maxBits, IppsPrimeState* pCtx)) -{ - IPP_BAD_PTR1_RET(pCtx); - IPP_BADARG_RET(maxBits<1, ippStsLengthErr); - - /* use aligned PRNG context */ - pCtx = (IppsPrimeState*)( IPP_ALIGNED_PTR(pCtx, PRIME_ALIGNMENT) ); - - { - Ipp8u* ptr = (Ipp8u*)pCtx; - - cpSize len = BITS_BNU_CHUNK(maxBits); - cpSize len32 = BITS2WORD32_SIZE(maxBits); - - PRIME_ID(pCtx) = idCtxPrimeNumber; - PRIME_MAXBITSIZE(pCtx) = maxBits; - - ptr += sizeof(IppsPrimeState); - PRIME_NUMBER(pCtx) = (BNU_CHUNK_T*)ptr; - - ptr += len*sizeof(BNU_CHUNK_T); - PRIME_TEMP1(pCtx) = (BNU_CHUNK_T*)ptr; - - ptr += len*sizeof(BNU_CHUNK_T); - PRIME_TEMP2(pCtx) = (BNU_CHUNK_T*)ptr; - - ptr += len*sizeof(BNU_CHUNK_T); - PRIME_TEMP3(pCtx) = (BNU_CHUNK_T*)ptr; - - ptr += len*sizeof(BNU_CHUNK_T); - PRIME_MONT(pCtx) = (IppsMontState*)( IPP_ALIGNED_PTR((ptr), MONT_ALIGNMENT) ); - ippsMontInit(ippBinaryMethod, len32, PRIME_MONT(pCtx)); - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owncp.h" +#include "pcpprimeg.h" +#include "pcptool.h" + + +/*F* +// Name: ippsPrimeGetSize +// +// Purpose: Returns size of Prime Number Generator context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// ippStsLengthErr 1 > maxBits +// ippStsNoErr no error +// +// Parameters: +// maxBits max length of a prime number +// pSize pointer to the size of internal context +*F*/ +IPPFUN(IppStatus, ippsPrimeGetSize, (cpSize maxBits, cpSize* pSize)) +{ + IPP_BAD_PTR1_RET(pSize); + IPP_BADARG_RET(maxBits<1, ippStsLengthErr); + + { + cpSize len = BITS_BNU_CHUNK(maxBits); + cpSize len32 = BITS2WORD32_SIZE(maxBits); + cpSize montSize; + ippsMontGetSize(ippBinaryMethod, len32, &montSize); + + *pSize = sizeof(IppsPrimeState) + +len*sizeof(BNU_CHUNK_T) + +len*sizeof(BNU_CHUNK_T) + +len*sizeof(BNU_CHUNK_T) + +len*sizeof(BNU_CHUNK_T) + +montSize + +PRIME_ALIGNMENT-1; + + return ippStsNoErr; + } +} + + +/*F* +// Name: ippsPrimeInit +// +// Purpose: Initializes Prime Number Generator context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pCtx +// ippStsLengthErr 1 > maxBits +// ippStsNoErr no error +// +// Parameters: +// maxBits max length of a prime number +// pCtx pointer to the context to be initialized +*F*/ +IPPFUN(IppStatus, ippsPrimeInit, (cpSize maxBits, IppsPrimeState* pCtx)) +{ + IPP_BAD_PTR1_RET(pCtx); + IPP_BADARG_RET(maxBits<1, ippStsLengthErr); + + /* use aligned PRNG context */ + pCtx = (IppsPrimeState*)( IPP_ALIGNED_PTR(pCtx, PRIME_ALIGNMENT) ); + + { + Ipp8u* ptr = (Ipp8u*)pCtx; + + cpSize len = BITS_BNU_CHUNK(maxBits); + cpSize len32 = BITS2WORD32_SIZE(maxBits); + + PRIME_ID(pCtx) = idCtxPrimeNumber; + PRIME_MAXBITSIZE(pCtx) = maxBits; + + ptr += sizeof(IppsPrimeState); + PRIME_NUMBER(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_TEMP1(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_TEMP2(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_TEMP3(pCtx) = (BNU_CHUNK_T*)ptr; + + ptr += len*sizeof(BNU_CHUNK_T); + PRIME_MONT(pCtx) = (IppsMontState*)( IPP_ALIGNED_PTR((ptr), MONT_ALIGNMENT) ); + ippsMontInit(ippBinaryMethod, len32, PRIME_MONT(pCtx)); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpprng.h b/external/crypto_px/sources/ippcp/src/pcpprng.h index 3c4829fe5e..2c0201df48 100644 --- a/external/crypto_px/sources/ippcp/src/pcpprng.h +++ b/external/crypto_px/sources/ippcp/src/pcpprng.h @@ -1,65 +1,65 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_CP_PRNG_H) -#define _CP_PRNG_H - -/* -// Pseudo-random generation context -*/ - -#define MAX_XKEY_SIZE 512 -#define DEFAULT_XKEY_SIZE 512 /* must be >=160 || <=512 */ - -struct _cpPRNG { - IppCtxId idCtx; /* PRNG identifier */ - cpSize seedBits; /* secret seed-key bitsize */ - BNU_CHUNK_T Q[BITS_BNU_CHUNK(160)]; /* modulus */ - BNU_CHUNK_T T[BITS_BNU_CHUNK(160)]; /* parameter of SHA_G() funct */ - BNU_CHUNK_T xAug[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; /* optional entropy augment */ - BNU_CHUNK_T xKey[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; /* secret seed-key */ -}; - -/* alignment */ -#define PRNG_ALIGNMENT ((int)(sizeof(void*))) - -#define RAND_ID(ctx) ((ctx)->idCtx) -#define RAND_SEEDBITS(ctx) ((ctx)->seedBits) -#define RAND_Q(ctx) ((ctx)->Q) -#define RAND_T(ctx) ((ctx)->T) -#define RAND_XAUGMENT(ctx) ((ctx)->xAug) -#define RAND_XKEY(ctx) ((ctx)->xKey) - -#define RAND_VALID_ID(ctx) (RAND_ID((ctx))==idCtxPRNG) - -int cpPRNGen(Ipp32u* pBuffer, cpSize bitLen, IppsPRNGState* pCtx); - -#endif /* _CP_PRNG_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_CP_PRNG_H) +#define _CP_PRNG_H + +/* +// Pseudo-random generation context +*/ + +#define MAX_XKEY_SIZE 512 +#define DEFAULT_XKEY_SIZE 512 /* must be >=160 || <=512 */ + +struct _cpPRNG { + IppCtxId idCtx; /* PRNG identifier */ + cpSize seedBits; /* secret seed-key bitsize */ + BNU_CHUNK_T Q[BITS_BNU_CHUNK(160)]; /* modulus */ + BNU_CHUNK_T T[BITS_BNU_CHUNK(160)]; /* parameter of SHA_G() funct */ + BNU_CHUNK_T xAug[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; /* optional entropy augment */ + BNU_CHUNK_T xKey[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; /* secret seed-key */ +}; + +/* alignment */ +#define PRNG_ALIGNMENT ((int)(sizeof(void*))) + +#define RAND_ID(ctx) ((ctx)->idCtx) +#define RAND_SEEDBITS(ctx) ((ctx)->seedBits) +#define RAND_Q(ctx) ((ctx)->Q) +#define RAND_T(ctx) ((ctx)->T) +#define RAND_XAUGMENT(ctx) ((ctx)->xAug) +#define RAND_XKEY(ctx) ((ctx)->xKey) + +#define RAND_VALID_ID(ctx) (RAND_ID((ctx))==idCtxPRNG) + +int cpPRNGen(Ipp32u* pBuffer, cpSize bitLen, IppsPRNGState* pCtx); + +#endif /* _CP_PRNG_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpprngenca.c b/external/crypto_px/sources/ippcp/src/pcpprngenca.c index f25b6e6b31..066c3caa54 100644 --- a/external/crypto_px/sources/ippcp/src/pcpprngenca.c +++ b/external/crypto_px/sources/ippcp/src/pcpprngenca.c @@ -1,178 +1,178 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" - -#include "owncp.h" -#include "pcpbn.h" -#include "pcphash.h" -#include "pcpprng.h" -#include "pcptool.h" - -/* -// G() function based on SHA1 -// -// Parameters: -// T 160 bit parameter -// pHexStr input hex string -// hexStrLen size of hex string (Ipp8u segnments) -// xBNU 160 bit BNU result -// -// Note 1: -// must to be hexStrLen <= 64 (512 bits) -*/ -static -void SHA1_G(Ipp32u* xBNU, const Ipp32u* T, Ipp8u* pHexStr, int hexStrLen) -{ - /* select processing function */ - cpHashProc updateFunc = UpdateSHA1; - - /* pad HexString zeros */ - PaddBlock(0, pHexStr+hexStrLen, BITS2WORD8_SIZE(MAX_XKEY_SIZE)-hexStrLen); - - /* reset initial HASH value */ - xBNU[0] = T[0]; - xBNU[1] = T[1]; - xBNU[2] = T[2]; - xBNU[3] = T[3]; - xBNU[4] = T[4]; - - /* SHA1 */ - //UpdateSHA1(xBNU, pHexStr, BITS2WORD8_SIZE(MAX_XKEY_SIZE), SHA1_cnt); - updateFunc(xBNU, pHexStr, BITS2WORD8_SIZE(MAX_XKEY_SIZE), SHA1_cnt); - - /* swap back */ - SWAP(xBNU[0],xBNU[4]); - SWAP(xBNU[1],xBNU[3]); -} - -/* -// Returns bitsize of the bitstring has beed added -*/ -int cpPRNGen(Ipp32u* pRand, cpSize nBits, IppsPRNGState* pRnd) -{ - BNU_CHUNK_T Xj [BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; - BNU_CHUNK_T XVAL[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; - - Ipp8u TXVAL[BITS2WORD8_SIZE(MAX_XKEY_SIZE)]; - - /* XKEY length in BNU_CHUNK_T */ - cpSize xKeyLen = BITS_BNU_CHUNK(RAND_SEEDBITS(pRnd)); - /* XKEY length in bytes */ - cpSize xKeySize= BITS2WORD8_SIZE(RAND_SEEDBITS(pRnd)); - /* XKEY word's mask */ - BNU_CHUNK_T xKeyMsk = MASK_BNU_CHUNK(RAND_SEEDBITS(pRnd)); - - /* number of Ipp32u chunks to be generated */ - cpSize genlen = BITS2WORD32_SIZE(nBits); - - ZEXPAND_BNU(Xj, 0, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); - ZEXPAND_BNU(XVAL, 0, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); - - while(genlen) { - cpSize len; - - /* Step 1: XVAL=(Xkey+Xseed) mod 2^b */ - BNU_CHUNK_T carry = cpAdd_BNU(XVAL, RAND_XKEY(pRnd), RAND_XAUGMENT(pRnd), xKeyLen); - XVAL[xKeyLen-1] &= xKeyMsk; - - /* Step 2: xj=G(t, XVAL) mod Q */ - cpToOctStr_BNU(TXVAL, xKeySize, XVAL, xKeyLen); - SHA1_G((Ipp32u*)Xj, (Ipp32u*)RAND_T(pRnd), TXVAL, xKeySize); - - { - cpSize sizeXj = BITS_BNU_CHUNK(160); - if(0 <= cpCmp_BNU(Xj, BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE), RAND_Q(pRnd),BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE)) ) - sizeXj = cpMod_BNU(Xj, BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE), RAND_Q(pRnd), BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE)); - FIX_BNU(Xj, sizeXj); - ZEXPAND_BNU(Xj, sizeXj, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); - } - - /* Step 3: Xkey=(1+Xkey+Xj) mod 2^b */ - cpInc_BNU(RAND_XKEY(pRnd), RAND_XKEY(pRnd), xKeyLen, 1); - carry = cpAdd_BNU(RAND_XKEY(pRnd), RAND_XKEY(pRnd), Xj, xKeyLen); - RAND_XKEY(pRnd)[xKeyLen-1] &= xKeyMsk; - - /* fill out result */ - len = genlenidCtx -// -// ippStsLengthErr 1 > nBits -// -// ippStsNoErr no error -// -// Parameters: -// pBuffer pointer to the buffer -// nBits number of bits be requested -// pRndCtx pointer to the context -*F*/ -IPPFUN(IppStatus, ippsPRNGen,(Ipp32u* pBuffer, cpSize nBits, void* pRnd)) -{ - IppsPRNGState* pRndCtx = (IppsPRNGState*)pRnd; - - /* test PRNG context */ - IPP_BAD_PTR2_RET(pBuffer, pRnd); - - pRndCtx = (IppsPRNGState*)( IPP_ALIGNED_PTR(pRndCtx, PRNG_ALIGNMENT) ); - IPP_BADARG_RET(!RAND_VALID_ID(pRndCtx), ippStsContextMatchErr); - - /* test sizes */ - IPP_BADARG_RET(nBits< 1, ippStsLengthErr); - - { - cpSize rndSize = BITS2WORD32_SIZE(nBits); - Ipp32u rndMask = MAKEMASK32(nBits); - - cpPRNGen(pBuffer, nBits, pRndCtx); - pBuffer[rndSize-1] &= rndMask; - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#include "owncp.h" +#include "pcpbn.h" +#include "pcphash.h" +#include "pcpprng.h" +#include "pcptool.h" + +/* +// G() function based on SHA1 +// +// Parameters: +// T 160 bit parameter +// pHexStr input hex string +// hexStrLen size of hex string (Ipp8u segnments) +// xBNU 160 bit BNU result +// +// Note 1: +// must to be hexStrLen <= 64 (512 bits) +*/ +static +void SHA1_G(Ipp32u* xBNU, const Ipp32u* T, Ipp8u* pHexStr, int hexStrLen) +{ + /* select processing function */ + cpHashProc updateFunc = UpdateSHA1; + + /* pad HexString zeros */ + PaddBlock(0, pHexStr+hexStrLen, BITS2WORD8_SIZE(MAX_XKEY_SIZE)-hexStrLen); + + /* reset initial HASH value */ + xBNU[0] = T[0]; + xBNU[1] = T[1]; + xBNU[2] = T[2]; + xBNU[3] = T[3]; + xBNU[4] = T[4]; + + /* SHA1 */ + //UpdateSHA1(xBNU, pHexStr, BITS2WORD8_SIZE(MAX_XKEY_SIZE), SHA1_cnt); + updateFunc(xBNU, pHexStr, BITS2WORD8_SIZE(MAX_XKEY_SIZE), SHA1_cnt); + + /* swap back */ + SWAP(xBNU[0],xBNU[4]); + SWAP(xBNU[1],xBNU[3]); +} + +/* +// Returns bitsize of the bitstring has beed added +*/ +int cpPRNGen(Ipp32u* pRand, cpSize nBits, IppsPRNGState* pRnd) +{ + BNU_CHUNK_T Xj [BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; + BNU_CHUNK_T XVAL[BITS_BNU_CHUNK(MAX_XKEY_SIZE)]; + + Ipp8u TXVAL[BITS2WORD8_SIZE(MAX_XKEY_SIZE)]; + + /* XKEY length in BNU_CHUNK_T */ + cpSize xKeyLen = BITS_BNU_CHUNK(RAND_SEEDBITS(pRnd)); + /* XKEY length in bytes */ + cpSize xKeySize= BITS2WORD8_SIZE(RAND_SEEDBITS(pRnd)); + /* XKEY word's mask */ + BNU_CHUNK_T xKeyMsk = MASK_BNU_CHUNK(RAND_SEEDBITS(pRnd)); + + /* number of Ipp32u chunks to be generated */ + cpSize genlen = BITS2WORD32_SIZE(nBits); + + ZEXPAND_BNU(Xj, 0, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); + ZEXPAND_BNU(XVAL, 0, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); + + while(genlen) { + cpSize len; + + /* Step 1: XVAL=(Xkey+Xseed) mod 2^b */ + BNU_CHUNK_T carry = cpAdd_BNU(XVAL, RAND_XKEY(pRnd), RAND_XAUGMENT(pRnd), xKeyLen); + XVAL[xKeyLen-1] &= xKeyMsk; + + /* Step 2: xj=G(t, XVAL) mod Q */ + cpToOctStr_BNU(TXVAL, xKeySize, XVAL, xKeyLen); + SHA1_G((Ipp32u*)Xj, (Ipp32u*)RAND_T(pRnd), TXVAL, xKeySize); + + { + cpSize sizeXj = BITS_BNU_CHUNK(160); + if(0 <= cpCmp_BNU(Xj, BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE), RAND_Q(pRnd),BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE)) ) + sizeXj = cpMod_BNU(Xj, BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE), RAND_Q(pRnd), BITS_BNU_CHUNK(IPP_SHA1_DIGEST_BITSIZE)); + FIX_BNU(Xj, sizeXj); + ZEXPAND_BNU(Xj, sizeXj, BITS_BNU_CHUNK(MAX_XKEY_SIZE)); + } + + /* Step 3: Xkey=(1+Xkey+Xj) mod 2^b */ + cpInc_BNU(RAND_XKEY(pRnd), RAND_XKEY(pRnd), xKeyLen, 1); + carry = cpAdd_BNU(RAND_XKEY(pRnd), RAND_XKEY(pRnd), Xj, xKeyLen); + RAND_XKEY(pRnd)[xKeyLen-1] &= xKeyMsk; + + /* fill out result */ + len = genlenidCtx +// +// ippStsLengthErr 1 > nBits +// +// ippStsNoErr no error +// +// Parameters: +// pBuffer pointer to the buffer +// nBits number of bits be requested +// pRndCtx pointer to the context +*F*/ +IPPFUN(IppStatus, ippsPRNGen,(Ipp32u* pBuffer, cpSize nBits, void* pRnd)) +{ + IppsPRNGState* pRndCtx = (IppsPRNGState*)pRnd; + + /* test PRNG context */ + IPP_BAD_PTR2_RET(pBuffer, pRnd); + + pRndCtx = (IppsPRNGState*)( IPP_ALIGNED_PTR(pRndCtx, PRNG_ALIGNMENT) ); + IPP_BADARG_RET(!RAND_VALID_ID(pRndCtx), ippStsContextMatchErr); + + /* test sizes */ + IPP_BADARG_RET(nBits< 1, ippStsLengthErr); + + { + cpSize rndSize = BITS2WORD32_SIZE(nBits); + Ipp32u rndMask = MAKEMASK32(nBits); + + cpPRNGen(pBuffer, nBits, pRndCtx); + pBuffer[rndSize-1] &= rndMask; + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcpprnginitca.c b/external/crypto_px/sources/ippcp/src/pcpprnginitca.c index 06c8f2b283..9f42b23ff8 100644 --- a/external/crypto_px/sources/ippcp/src/pcpprnginitca.c +++ b/external/crypto_px/sources/ippcp/src/pcpprnginitca.c @@ -1,113 +1,113 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" - -#include "owncp.h" -#include "pcpbn.h" -#include "pcpprng.h" -#include "pcphash.h" -#include "pcptool.h" - - -/*F* -// Name: ippsPRNGGetSize -// -// Purpose: Returns size of PRNG context (bytes). -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pSize -// -// ippStsNoErr no error -// -// Parameters: -// pSize pointer to the size of internal context -*F*/ -IPPFUN(IppStatus, ippsPRNGGetSize, (int* pSize)) -{ - IPP_BAD_PTR1_RET(pSize); - - *pSize = sizeof(IppsPRNGState) - +PRNG_ALIGNMENT-1; - return ippStsNoErr; -} - - -/*F* -// Name: ippsPRNGInit -// -// Purpose: Initializes PRNG context -// -// Returns: Reason: -// ippStsNullPtrErr NULL == pRnd -// -// ippStsLengthErr seedBits < 1 -// seedBits < MAX_XKEY_SIZE -// seedBits%8 !=0 -// -// ippStsNoErr no error -// -// Parameters: -// seedBits seed bitsize -// pRnd pointer to the context to be initialized -*F*/ -IPPFUN(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pRnd)) -{ - /* test PRNG context */ - IPP_BAD_PTR1_RET(pRnd); - pRnd = (IppsPRNGState*)( IPP_ALIGNED_PTR(pRnd, PRNG_ALIGNMENT) ); - - /* test sizes */ - IPP_BADARG_RET((1>seedBits) || (seedBits>MAX_XKEY_SIZE) ||(seedBits&7), ippStsLengthErr); - - { - int hashIvSize = cpHashIvSize(ippHashAlg_SHA1); - const Ipp8u* iv = cpHashIV[ippHashAlg_SHA1]; - - /* cleanup context */ - ZEXPAND_BNU((Ipp8u*)pRnd, 0, (cpSize)(sizeof(IppsPRNGState))); - - RAND_ID(pRnd) = idCtxPRNG; - RAND_SEEDBITS(pRnd) = seedBits; - - /* default Q parameter */ - ((Ipp32u*)RAND_Q(pRnd))[0] = 0xFFFFFFFF; - ((Ipp32u*)RAND_Q(pRnd))[1] = 0xFFFFFFFF; - ((Ipp32u*)RAND_Q(pRnd))[2] = 0xFFFFFFFF; - ((Ipp32u*)RAND_Q(pRnd))[3] = 0xFFFFFFFF; - ((Ipp32u*)RAND_Q(pRnd))[4] = 0xFFFFFFFF; - - /* default T parameter */ - CopyBlock(iv, RAND_T(pRnd), hashIvSize); - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#include "owncp.h" +#include "pcpbn.h" +#include "pcpprng.h" +#include "pcphash.h" +#include "pcptool.h" + + +/*F* +// Name: ippsPRNGGetSize +// +// Purpose: Returns size of PRNG context (bytes). +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pSize +// +// ippStsNoErr no error +// +// Parameters: +// pSize pointer to the size of internal context +*F*/ +IPPFUN(IppStatus, ippsPRNGGetSize, (int* pSize)) +{ + IPP_BAD_PTR1_RET(pSize); + + *pSize = sizeof(IppsPRNGState) + +PRNG_ALIGNMENT-1; + return ippStsNoErr; +} + + +/*F* +// Name: ippsPRNGInit +// +// Purpose: Initializes PRNG context +// +// Returns: Reason: +// ippStsNullPtrErr NULL == pRnd +// +// ippStsLengthErr seedBits < 1 +// seedBits < MAX_XKEY_SIZE +// seedBits%8 !=0 +// +// ippStsNoErr no error +// +// Parameters: +// seedBits seed bitsize +// pRnd pointer to the context to be initialized +*F*/ +IPPFUN(IppStatus, ippsPRNGInit, (int seedBits, IppsPRNGState* pRnd)) +{ + /* test PRNG context */ + IPP_BAD_PTR1_RET(pRnd); + pRnd = (IppsPRNGState*)( IPP_ALIGNED_PTR(pRnd, PRNG_ALIGNMENT) ); + + /* test sizes */ + IPP_BADARG_RET((1>seedBits) || (seedBits>MAX_XKEY_SIZE) ||(seedBits&7), ippStsLengthErr); + + { + int hashIvSize = cpHashIvSize(ippHashAlg_SHA1); + const Ipp8u* iv = cpHashIV[ippHashAlg_SHA1]; + + /* cleanup context */ + ZEXPAND_BNU((Ipp8u*)pRnd, 0, (cpSize)(sizeof(IppsPRNGState))); + + RAND_ID(pRnd) = idCtxPRNG; + RAND_SEEDBITS(pRnd) = seedBits; + + /* default Q parameter */ + ((Ipp32u*)RAND_Q(pRnd))[0] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[1] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[2] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[3] = 0xFFFFFFFF; + ((Ipp32u*)RAND_Q(pRnd))[4] = 0xFFFFFFFF; + + /* default T parameter */ + CopyBlock(iv, RAND_T(pRnd), hashIvSize); + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcprij.h b/external/crypto_px/sources/ippcp/src/pcprij.h index 6b55123a77..f2e59a558d 100644 --- a/external/crypto_px/sources/ippcp/src/pcprij.h +++ b/external/crypto_px/sources/ippcp/src/pcprij.h @@ -1,141 +1,141 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_RIJ_H) -#define _PCP_RIJ_H - - -/* -// The GF(256) modular polynomial and elements -*/ -#define WPOLY 0x011B -#define BPOLY 0x1B - -/* -// Make WORD using 4 arbitrary bytes -*/ -#define BYTES_TO_WORD(b0,b1,b2,b3) ( ( ((Ipp32u)((Ipp8u)(b3))) <<24 ) \ - |( ((Ipp32u)((Ipp8u)(b2))) <<16 ) \ - |( ((Ipp32u)((Ipp8u)(b1))) << 8 ) \ - |( ((Ipp32u)((Ipp8u)(b0))) ) ) -/* -// Make WORD setting byte in specified position -*/ -#define BYTE0_TO_WORD(b) BYTES_TO_WORD((b), 0, 0, 0) -#define BYTE1_TO_WORD(b) BYTES_TO_WORD( 0, (b), 0, 0) -#define BYTE2_TO_WORD(b) BYTES_TO_WORD( 0, 0, (b), 0) -#define BYTE3_TO_WORD(b) BYTES_TO_WORD( 0, 0, 0, (b)) - -/* -// Extract byte from specified position n. -// Sure, n=0,1,2 or 3 only -*/ -#define EBYTE(w,n) ((Ipp8u)((w) >> (8 * (n)))) - - -/* -// Rijndael's spec -*/ -typedef void (*RijnCipher)(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); - -struct _cpRijndael128 { - IppCtxId idCtx; /* Rijndael spec identifier */ - int nk; /* security key length (words) */ - int nb; /* data block size (words) */ - int nr; /* number of rounds */ - RijnCipher encoder; /* encoder/decoder */ - RijnCipher decoder; /* entry point */ - Ipp32u* pEncTbl; /* expanded S-boxes for */ - Ipp32u* pDecTbl; /* encryption and decryption */ - Ipp32u enc_keys[64]; /* array of keys for encryprion */ - Ipp32u dec_keys[64]; /* array of keys for decryprion */ - Ipp32u aesNI; /* AES instruction available */ - Ipp32u safeInit; /* SafeInit performed */ -}; - -/* alignment */ -#define RIJ_ALIGNMENT (16) - -#define MBS_RIJ128 (128/8) /* message block size (bytes) */ -#define MBS_RIJ192 (192/8) -#define MBS_RIJ256 (256/8) - -#define SR (4) /* number of rows in STATE data */ - -#define NB(msgBlks) ((msgBlks)/32) /* message block size (words) */ - /* 4-word for 128-bits data block */ - /* 6-word for 192-bits data block */ - /* 8-word for 256-bits data block */ - -#define NK(keybits) ((keybits)/32) /* key length (words): */ -#define NK128 NK(ippRijndaelKey128)/* 4-word for 128-bits security key */ -#define NK192 NK(ippRijndaelKey192)/* 6-word for 192-bits security key */ -#define NK256 NK(ippRijndaelKey256)/* 8-word for 256-bits security key */ - -#define NR128_128 (10) /* number of rounds data: 128 bits key: 128 bits are used */ -#define NR128_192 (12) /* number of rounds data: 128 bits key: 192 bits are used */ -#define NR128_256 (14) /* number of rounds data: 128 bits key: 256 bits are used */ -#define NR192_128 (12) /* number of rounds data: 192 bits key: 128 bits are used */ -#define NR192_192 (12) /* number of rounds data: 192 bits key: 192 bits are used */ -#define NR192_256 (14) /* number of rounds data: 192 bits key: 256 bits are used */ -#define NR256_128 (14) /* number of rounds data: 256 bits key: 128 bits are used */ -#define NR256_192 (14) /* number of rounds data: 256 bits key: 192 bits are used */ -#define NR256_256 (14) /* number of rounds data: 256 bits key: 256 bits are used */ - -/* -// Useful macros -*/ -#define RIJ_ID(ctx) ((ctx)->idCtx) -#define RIJ_NB(ctx) ((ctx)->nb) -#define RIJ_NK(ctx) ((ctx)->nk) -#define RIJ_NR(ctx) ((ctx)->nr) -#define RIJ_ENCODER(ctx) ((ctx)->encoder) -#define RIJ_DECODER(ctx) ((ctx)->decoder) -#define RIJ_ENC_SBOX(ctx) ((ctx)->pEncTbl) -#define RIJ_DEC_SBOX(ctx) ((ctx)->pDecTbl) -#define RIJ_EKEYS(ctx) (Ipp8u*)((ctx)->enc_keys) -#define RIJ_DKEYS(ctx) (Ipp8u*)((ctx)->dec_keys) -#define RIJ_AESNI(ctx) ((ctx)->aesNI) -#define RIJ_SAFE_INIT(ctx) ((ctx)->safeInit) - -#define RIJ_ID_TEST(ctx) (RIJ_ID((ctx))==idCtxRijndael) - -/* -// Internal functions -*/ - -void Safe2Encrypt_RIJ128(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); -void Safe2Decrypt_RIJ128(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); - -void ExpandRijndaelKey(const Ipp8u* pKey, int NK, int NB, int NR, int nKeys, - Ipp8u* pEncKeys, Ipp8u* pDecKeys); - -#endif /* _PCP_RIJ_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_RIJ_H) +#define _PCP_RIJ_H + + +/* +// The GF(256) modular polynomial and elements +*/ +#define WPOLY 0x011B +#define BPOLY 0x1B + +/* +// Make WORD using 4 arbitrary bytes +*/ +#define BYTES_TO_WORD(b0,b1,b2,b3) ( ( ((Ipp32u)((Ipp8u)(b3))) <<24 ) \ + |( ((Ipp32u)((Ipp8u)(b2))) <<16 ) \ + |( ((Ipp32u)((Ipp8u)(b1))) << 8 ) \ + |( ((Ipp32u)((Ipp8u)(b0))) ) ) +/* +// Make WORD setting byte in specified position +*/ +#define BYTE0_TO_WORD(b) BYTES_TO_WORD((b), 0, 0, 0) +#define BYTE1_TO_WORD(b) BYTES_TO_WORD( 0, (b), 0, 0) +#define BYTE2_TO_WORD(b) BYTES_TO_WORD( 0, 0, (b), 0) +#define BYTE3_TO_WORD(b) BYTES_TO_WORD( 0, 0, 0, (b)) + +/* +// Extract byte from specified position n. +// Sure, n=0,1,2 or 3 only +*/ +#define EBYTE(w,n) ((Ipp8u)((w) >> (8 * (n)))) + + +/* +// Rijndael's spec +*/ +typedef void (*RijnCipher)(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); + +struct _cpRijndael128 { + IppCtxId idCtx; /* Rijndael spec identifier */ + int nk; /* security key length (words) */ + int nb; /* data block size (words) */ + int nr; /* number of rounds */ + RijnCipher encoder; /* encoder/decoder */ + RijnCipher decoder; /* entry point */ + Ipp32u* pEncTbl; /* expanded S-boxes for */ + Ipp32u* pDecTbl; /* encryption and decryption */ + Ipp32u enc_keys[64]; /* array of keys for encryprion */ + Ipp32u dec_keys[64]; /* array of keys for decryprion */ + Ipp32u aesNI; /* AES instruction available */ + Ipp32u safeInit; /* SafeInit performed */ +}; + +/* alignment */ +#define RIJ_ALIGNMENT (16) + +#define MBS_RIJ128 (128/8) /* message block size (bytes) */ +#define MBS_RIJ192 (192/8) +#define MBS_RIJ256 (256/8) + +#define SR (4) /* number of rows in STATE data */ + +#define NB(msgBlks) ((msgBlks)/32) /* message block size (words) */ + /* 4-word for 128-bits data block */ + /* 6-word for 192-bits data block */ + /* 8-word for 256-bits data block */ + +#define NK(keybits) ((keybits)/32) /* key length (words): */ +#define NK128 NK(ippRijndaelKey128)/* 4-word for 128-bits security key */ +#define NK192 NK(ippRijndaelKey192)/* 6-word for 192-bits security key */ +#define NK256 NK(ippRijndaelKey256)/* 8-word for 256-bits security key */ + +#define NR128_128 (10) /* number of rounds data: 128 bits key: 128 bits are used */ +#define NR128_192 (12) /* number of rounds data: 128 bits key: 192 bits are used */ +#define NR128_256 (14) /* number of rounds data: 128 bits key: 256 bits are used */ +#define NR192_128 (12) /* number of rounds data: 192 bits key: 128 bits are used */ +#define NR192_192 (12) /* number of rounds data: 192 bits key: 192 bits are used */ +#define NR192_256 (14) /* number of rounds data: 192 bits key: 256 bits are used */ +#define NR256_128 (14) /* number of rounds data: 256 bits key: 128 bits are used */ +#define NR256_192 (14) /* number of rounds data: 256 bits key: 192 bits are used */ +#define NR256_256 (14) /* number of rounds data: 256 bits key: 256 bits are used */ + +/* +// Useful macros +*/ +#define RIJ_ID(ctx) ((ctx)->idCtx) +#define RIJ_NB(ctx) ((ctx)->nb) +#define RIJ_NK(ctx) ((ctx)->nk) +#define RIJ_NR(ctx) ((ctx)->nr) +#define RIJ_ENCODER(ctx) ((ctx)->encoder) +#define RIJ_DECODER(ctx) ((ctx)->decoder) +#define RIJ_ENC_SBOX(ctx) ((ctx)->pEncTbl) +#define RIJ_DEC_SBOX(ctx) ((ctx)->pDecTbl) +#define RIJ_EKEYS(ctx) (Ipp8u*)((ctx)->enc_keys) +#define RIJ_DKEYS(ctx) (Ipp8u*)((ctx)->dec_keys) +#define RIJ_AESNI(ctx) ((ctx)->aesNI) +#define RIJ_SAFE_INIT(ctx) ((ctx)->safeInit) + +#define RIJ_ID_TEST(ctx) (RIJ_ID((ctx))==idCtxRijndael) + +/* +// Internal functions +*/ + +void Safe2Encrypt_RIJ128(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); +void Safe2Decrypt_RIJ128(const Ipp8u* pInpBlk, Ipp8u* pOutBlk, int nr, const Ipp8u* pKeys, const void* pTbl); + +void ExpandRijndaelKey(const Ipp8u* pKey, int NK, int NB, int NR, int nKeys, + Ipp8u* pEncKeys, Ipp8u* pDecKeys); + +#endif /* _PCP_RIJ_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcprij128safe2.h b/external/crypto_px/sources/ippcp/src/pcprij128safe2.h index 94a79f13d7..c407edd470 100644 --- a/external/crypto_px/sources/ippcp/src/pcprij128safe2.h +++ b/external/crypto_px/sources/ippcp/src/pcprij128safe2.h @@ -1,79 +1,79 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PCP_RIJ_SAFE2_H) -#define _PCP_RIJ_SAFE2_H - -// transpose 4x4 Ipp8u matrix -#define TRANSPOSE(out, inp) \ - (out)[ 0] = (inp)[ 0]; \ - (out)[ 4] = (inp)[ 1]; \ - (out)[ 8] = (inp)[ 2]; \ - (out)[12] = (inp)[ 3]; \ - \ - (out)[ 1] = (inp)[ 4]; \ - (out)[ 5] = (inp)[ 5]; \ - (out)[ 9] = (inp)[ 6]; \ - (out)[13] = (inp)[ 7]; \ - \ - (out)[ 2] = (inp)[ 8]; \ - (out)[ 6] = (inp)[ 9]; \ - (out)[10] = (inp)[10]; \ - (out)[14] = (inp)[11]; \ - \ - (out)[ 3] = (inp)[12]; \ - (out)[ 7] = (inp)[13]; \ - (out)[11] = (inp)[14]; \ - (out)[15] = (inp)[15] - -__INLINE void XorRoundKey(Ipp32u* state, const Ipp32u* RoundKey) -{ - state[0] ^= RoundKey[0]; - state[1] ^= RoundKey[1]; - state[2] ^= RoundKey[2]; - state[3] ^= RoundKey[3]; -} - -// xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b} -__INLINE Ipp32u mask4(Ipp32u x) -{ - x &= 0x80808080; - return (Ipp32u)((x<<1) - (x>>7)); -} - -__INLINE Ipp32u xtime4(Ipp32u x) -{ - Ipp32u t = (x+x) &0xFEFEFEFE; - t ^= mask4(x) & 0x1B1B1B1B; - return t; -} - -#endif /* _PCP_RIJ_SAFE2_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_RIJ_SAFE2_H) +#define _PCP_RIJ_SAFE2_H + +// transpose 4x4 Ipp8u matrix +#define TRANSPOSE(out, inp) \ + (out)[ 0] = (inp)[ 0]; \ + (out)[ 4] = (inp)[ 1]; \ + (out)[ 8] = (inp)[ 2]; \ + (out)[12] = (inp)[ 3]; \ + \ + (out)[ 1] = (inp)[ 4]; \ + (out)[ 5] = (inp)[ 5]; \ + (out)[ 9] = (inp)[ 6]; \ + (out)[13] = (inp)[ 7]; \ + \ + (out)[ 2] = (inp)[ 8]; \ + (out)[ 6] = (inp)[ 9]; \ + (out)[10] = (inp)[10]; \ + (out)[14] = (inp)[11]; \ + \ + (out)[ 3] = (inp)[12]; \ + (out)[ 7] = (inp)[13]; \ + (out)[11] = (inp)[14]; \ + (out)[15] = (inp)[15] + +__INLINE void XorRoundKey(Ipp32u* state, const Ipp32u* RoundKey) +{ + state[0] ^= RoundKey[0]; + state[1] ^= RoundKey[1]; + state[2] ^= RoundKey[2]; + state[3] ^= RoundKey[3]; +} + +// xtime is a macro that finds the product of {02} and the argument to xtime modulo {1b} +__INLINE Ipp32u mask4(Ipp32u x) +{ + x &= 0x80808080; + return (Ipp32u)((x<<1) - (x>>7)); +} + +__INLINE Ipp32u xtime4(Ipp32u x) +{ + Ipp32u t = (x+x) &0xFEFEFEFE; + t ^= mask4(x) & 0x1B1B1B1B; + return t; +} + +#endif /* _PCP_RIJ_SAFE2_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c b/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c index 16b1f54133..8dbbb21ae4 100644 --- a/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c +++ b/external/crypto_px/sources/ippcp/src/pcprij128safedec2pxca.c @@ -1,133 +1,133 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" - -#include "pcprij128safe2.h" -#include "pcprijtables.h" - - -__INLINE Ipp8u getInvSboxValue(Ipp32u x) -{ - Ipp32u t[sizeof(RijDecSbox)/CACHE_LINE_SIZE]; - const Ipp8u* SboxEntry = RijDecSbox +x%CACHE_LINE_SIZE; - Ipp32u i; - for(i=0; i0;round--) { - invShiftRows(state); - invSubBytes((Ipp8u*)state); - XorRoundKey(state,(Ipp32u*)(RoundKey+round*16)); - invMixColumns(state); - } - - // last round - invShiftRows(state); - invSubBytes((Ipp8u*)state); - XorRoundKey(state,(Ipp32u*)(RoundKey+0*16)); - - // copy from the state to output - TRANSPOSE(out, (Ipp8u*)state); -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" + +#include "pcprij128safe2.h" +#include "pcprijtables.h" + + +__INLINE Ipp8u getInvSboxValue(Ipp32u x) +{ + Ipp32u t[sizeof(RijDecSbox)/CACHE_LINE_SIZE]; + const Ipp8u* SboxEntry = RijDecSbox +x%CACHE_LINE_SIZE; + Ipp32u i; + for(i=0; i0;round--) { + invShiftRows(state); + invSubBytes((Ipp8u*)state); + XorRoundKey(state,(Ipp32u*)(RoundKey+round*16)); + invMixColumns(state); + } + + // last round + invShiftRows(state); + invSubBytes((Ipp8u*)state); + XorRoundKey(state,(Ipp32u*)(RoundKey+0*16)); + + // copy from the state to output + TRANSPOSE(out, (Ipp8u*)state); +} diff --git a/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c b/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c index 8295b1b001..c59006df7b 100644 --- a/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c +++ b/external/crypto_px/sources/ippcp/src/pcprij128safeenc2pxca.c @@ -1,125 +1,125 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" - -#include "pcprij128safe2.h" -#include "pcprijtables.h" - - -__INLINE Ipp8u getSboxValue(Ipp32u x) -{ - Ipp32u t[sizeof(RijEncSbox)/CACHE_LINE_SIZE]; - const Ipp8u* SboxEntry = RijEncSbox +x%CACHE_LINE_SIZE; - Ipp32u i; - for(i=0; i>7) & 1) * WPOLY)) -#define gf_m4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) -#define gf_m8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ - ^ (((x>>5) & 4) * WPOLY)) -#define gf_m1(x) ((x)) -#define gf_m3(x) (gf_m2(x) ^ x) -#define gf_m9(x) (gf_m8(x) ^ x) -#define gf_mB(x) (gf_m8(x) ^ gf_m2(x) ^ x) -#define gf_mD(x) (gf_m8(x) ^ gf_m4(x) ^ x) -#define gf_mE(x) (gf_m8(x) ^ gf_m4(x) ^ gf_m2(x)) - -/* -// The following particular transformations -// are used for create Encryption Tables -*/ -#define fwd_t0(x) BYTES_TO_WORD(gf_m2(x), gf_m1(x), gf_m1(x), gf_m3(x)) -#define fwd_t1(x) BYTES_TO_WORD(gf_m3(x), gf_m2(x), gf_m1(x), gf_m1(x)) -#define fwd_t2(x) BYTES_TO_WORD(gf_m1(x), gf_m3(x), gf_m2(x), gf_m1(x)) -#define fwd_t3(x) BYTES_TO_WORD(gf_m1(x), gf_m1(x), gf_m3(x), gf_m2(x)) - -/* -// The following particular transformations -// are used for create Decryption Tables -*/ -#define inv_t0(x) BYTES_TO_WORD(gf_mE(x), gf_m9(x), gf_mD(x), gf_mB(x)) -#define inv_t1(x) BYTES_TO_WORD(gf_mB(x), gf_mE(x), gf_m9(x), gf_mD(x)) -#define inv_t2(x) BYTES_TO_WORD(gf_mD(x), gf_mB(x), gf_mE(x), gf_m9(x)) -#define inv_t3(x) BYTES_TO_WORD(gf_m9(x), gf_mD(x), gf_mB(x), gf_mE(x)) - -#define exp_b3(x) BYTES_TO_WORD(0, 0, 0, (x)) -#define exp_b2(x) BYTES_TO_WORD(0, 0, (x),0) -#define exp_b1(x) BYTES_TO_WORD(0, (x),0, 0) -#define exp_b0(x) BYTES_TO_WORD((x),0, 0, 0) - -/* -// The following particular transformations -// are used for create pure Encryption/Decryption Sboxes -*/ -#define none_t(x) (x) - - -/* -// Just sequence of byte, beginning 0x00 upto 0xff -// (be parametrized by any transformation 't') -*/ -#define LINE(t) \ - t(0x00), t(0x01), t(0x02), t(0x03), t(0x04), t(0x05), t(0x06), t(0x07),\ - t(0x08), t(0x09), t(0x0a), t(0x0b), t(0x0c), t(0x0d), t(0x0e), t(0x0f),\ - t(0x10), t(0x11), t(0x12), t(0x13), t(0x14), t(0x15), t(0x16), t(0x17),\ - t(0x18), t(0x19), t(0x1a), t(0x1b), t(0x1c), t(0x1d), t(0x1e), t(0x1f),\ - t(0x20), t(0x21), t(0x22), t(0x23), t(0x24), t(0x25), t(0x26), t(0x27),\ - t(0x28), t(0x29), t(0x2a), t(0x2b), t(0x2c), t(0x2d), t(0x2e), t(0x2f),\ - t(0x30), t(0x31), t(0x32), t(0x33), t(0x34), t(0x35), t(0x36), t(0x37),\ - t(0x38), t(0x39), t(0x3a), t(0x3b), t(0x3c), t(0x3d), t(0x3e), t(0x3f),\ - t(0x40), t(0x41), t(0x42), t(0x43), t(0x44), t(0x45), t(0x46), t(0x47),\ - t(0x48), t(0x49), t(0x4a), t(0x4b), t(0x4c), t(0x4d), t(0x4e), t(0x4f),\ - t(0x50), t(0x51), t(0x52), t(0x53), t(0x54), t(0x55), t(0x56), t(0x57),\ - t(0x58), t(0x59), t(0x5a), t(0x5b), t(0x5c), t(0x5d), t(0x5e), t(0x5f),\ - t(0x60), t(0x61), t(0x62), t(0x63), t(0x64), t(0x65), t(0x66), t(0x67),\ - t(0x68), t(0x69), t(0x6a), t(0x6b), t(0x6c), t(0x6d), t(0x6e), t(0x6f),\ - t(0x70), t(0x71), t(0x72), t(0x73), t(0x74), t(0x75), t(0x76), t(0x77),\ - t(0x78), t(0x79), t(0x7a), t(0x7b), t(0x7c), t(0x7d), t(0x7e), t(0x7f),\ - t(0x80), t(0x81), t(0x82), t(0x83), t(0x84), t(0x85), t(0x86), t(0x87),\ - t(0x88), t(0x89), t(0x8a), t(0x8b), t(0x8c), t(0x8d), t(0x8e), t(0x8f),\ - t(0x90), t(0x91), t(0x92), t(0x93), t(0x94), t(0x95), t(0x96), t(0x97),\ - t(0x98), t(0x99), t(0x9a), t(0x9b), t(0x9c), t(0x9d), t(0x9e), t(0x9f),\ - t(0xa0), t(0xa1), t(0xa2), t(0xa3), t(0xa4), t(0xa5), t(0xa6), t(0xa7),\ - t(0xa8), t(0xa9), t(0xaa), t(0xab), t(0xac), t(0xad), t(0xae), t(0xaf),\ - t(0xb0), t(0xb1), t(0xb2), t(0xb3), t(0xb4), t(0xb5), t(0xb6), t(0xb7),\ - t(0xb8), t(0xb9), t(0xba), t(0xbb), t(0xbc), t(0xbd), t(0xbe), t(0xbf),\ - t(0xc0), t(0xc1), t(0xc2), t(0xc3), t(0xc4), t(0xc5), t(0xc6), t(0xc7),\ - t(0xc8), t(0xc9), t(0xca), t(0xcb), t(0xcc), t(0xcd), t(0xce), t(0xcf),\ - t(0xd0), t(0xd1), t(0xd2), t(0xd3), t(0xd4), t(0xd5), t(0xd6), t(0xd7),\ - t(0xd8), t(0xd9), t(0xda), t(0xdb), t(0xdc), t(0xdd), t(0xde), t(0xdf),\ - t(0xe0), t(0xe1), t(0xe2), t(0xe3), t(0xe4), t(0xe5), t(0xe6), t(0xe7),\ - t(0xe8), t(0xe9), t(0xea), t(0xeb), t(0xec), t(0xed), t(0xee), t(0xef),\ - t(0xf0), t(0xf1), t(0xf2), t(0xf3), t(0xf4), t(0xf5), t(0xf6), t(0xf7),\ - t(0xf8), t(0xf9), t(0xfa), t(0xfb), t(0xfc), t(0xfd), t(0xfe), t(0xff) - -/* -// Encrypt/Decrypt S-box data -// (be parametrized by any transformation 't') -*/ -#define ENC_SBOX(t) \ - t(0x63), t(0x7c), t(0x77), t(0x7b), t(0xf2), t(0x6b), t(0x6f), t(0xc5),\ - t(0x30), t(0x01), t(0x67), t(0x2b), t(0xfe), t(0xd7), t(0xab), t(0x76),\ - t(0xca), t(0x82), t(0xc9), t(0x7d), t(0xfa), t(0x59), t(0x47), t(0xf0),\ - t(0xad), t(0xd4), t(0xa2), t(0xaf), t(0x9c), t(0xa4), t(0x72), t(0xc0),\ - t(0xb7), t(0xfd), t(0x93), t(0x26), t(0x36), t(0x3f), t(0xf7), t(0xcc),\ - t(0x34), t(0xa5), t(0xe5), t(0xf1), t(0x71), t(0xd8), t(0x31), t(0x15),\ - t(0x04), t(0xc7), t(0x23), t(0xc3), t(0x18), t(0x96), t(0x05), t(0x9a),\ - t(0x07), t(0x12), t(0x80), t(0xe2), t(0xeb), t(0x27), t(0xb2), t(0x75),\ - t(0x09), t(0x83), t(0x2c), t(0x1a), t(0x1b), t(0x6e), t(0x5a), t(0xa0),\ - t(0x52), t(0x3b), t(0xd6), t(0xb3), t(0x29), t(0xe3), t(0x2f), t(0x84),\ - t(0x53), t(0xd1), t(0x00), t(0xed), t(0x20), t(0xfc), t(0xb1), t(0x5b),\ - t(0x6a), t(0xcb), t(0xbe), t(0x39), t(0x4a), t(0x4c), t(0x58), t(0xcf),\ - t(0xd0), t(0xef), t(0xaa), t(0xfb), t(0x43), t(0x4d), t(0x33), t(0x85),\ - t(0x45), t(0xf9), t(0x02), t(0x7f), t(0x50), t(0x3c), t(0x9f), t(0xa8),\ - t(0x51), t(0xa3), t(0x40), t(0x8f), t(0x92), t(0x9d), t(0x38), t(0xf5),\ - t(0xbc), t(0xb6), t(0xda), t(0x21), t(0x10), t(0xff), t(0xf3), t(0xd2),\ - t(0xcd), t(0x0c), t(0x13), t(0xec), t(0x5f), t(0x97), t(0x44), t(0x17),\ - t(0xc4), t(0xa7), t(0x7e), t(0x3d), t(0x64), t(0x5d), t(0x19), t(0x73),\ - t(0x60), t(0x81), t(0x4f), t(0xdc), t(0x22), t(0x2a), t(0x90), t(0x88),\ - t(0x46), t(0xee), t(0xb8), t(0x14), t(0xde), t(0x5e), t(0x0b), t(0xdb),\ - t(0xe0), t(0x32), t(0x3a), t(0x0a), t(0x49), t(0x06), t(0x24), t(0x5c),\ - t(0xc2), t(0xd3), t(0xac), t(0x62), t(0x91), t(0x95), t(0xe4), t(0x79),\ - t(0xe7), t(0xc8), t(0x37), t(0x6d), t(0x8d), t(0xd5), t(0x4e), t(0xa9),\ - t(0x6c), t(0x56), t(0xf4), t(0xea), t(0x65), t(0x7a), t(0xae), t(0x08),\ - t(0xba), t(0x78), t(0x25), t(0x2e), t(0x1c), t(0xa6), t(0xb4), t(0xc6),\ - t(0xe8), t(0xdd), t(0x74), t(0x1f), t(0x4b), t(0xbd), t(0x8b), t(0x8a),\ - t(0x70), t(0x3e), t(0xb5), t(0x66), t(0x48), t(0x03), t(0xf6), t(0x0e),\ - t(0x61), t(0x35), t(0x57), t(0xb9), t(0x86), t(0xc1), t(0x1d), t(0x9e),\ - t(0xe1), t(0xf8), t(0x98), t(0x11), t(0x69), t(0xd9), t(0x8e), t(0x94),\ - t(0x9b), t(0x1e), t(0x87), t(0xe9), t(0xce), t(0x55), t(0x28), t(0xdf),\ - t(0x8c), t(0xa1), t(0x89), t(0x0d), t(0xbf), t(0xe6), t(0x42), t(0x68),\ - t(0x41), t(0x99), t(0x2d), t(0x0f), t(0xb0), t(0x54), t(0xbb), t(0x16) - -#define DEC_SBOX(t) \ - t(0x52), t(0x09), t(0x6a), t(0xd5), t(0x30), t(0x36), t(0xa5), t(0x38),\ - t(0xbf), t(0x40), t(0xa3), t(0x9e), t(0x81), t(0xf3), t(0xd7), t(0xfb),\ - t(0x7c), t(0xe3), t(0x39), t(0x82), t(0x9b), t(0x2f), t(0xff), t(0x87),\ - t(0x34), t(0x8e), t(0x43), t(0x44), t(0xc4), t(0xde), t(0xe9), t(0xcb),\ - t(0x54), t(0x7b), t(0x94), t(0x32), t(0xa6), t(0xc2), t(0x23), t(0x3d),\ - t(0xee), t(0x4c), t(0x95), t(0x0b), t(0x42), t(0xfa), t(0xc3), t(0x4e),\ - t(0x08), t(0x2e), t(0xa1), t(0x66), t(0x28), t(0xd9), t(0x24), t(0xb2),\ - t(0x76), t(0x5b), t(0xa2), t(0x49), t(0x6d), t(0x8b), t(0xd1), t(0x25),\ - t(0x72), t(0xf8), t(0xf6), t(0x64), t(0x86), t(0x68), t(0x98), t(0x16),\ - t(0xd4), t(0xa4), t(0x5c), t(0xcc), t(0x5d), t(0x65), t(0xb6), t(0x92),\ - t(0x6c), t(0x70), t(0x48), t(0x50), t(0xfd), t(0xed), t(0xb9), t(0xda),\ - t(0x5e), t(0x15), t(0x46), t(0x57), t(0xa7), t(0x8d), t(0x9d), t(0x84),\ - t(0x90), t(0xd8), t(0xab), t(0x00), t(0x8c), t(0xbc), t(0xd3), t(0x0a),\ - t(0xf7), t(0xe4), t(0x58), t(0x05), t(0xb8), t(0xb3), t(0x45), t(0x06),\ - t(0xd0), t(0x2c), t(0x1e), t(0x8f), t(0xca), t(0x3f), t(0x0f), t(0x02),\ - t(0xc1), t(0xaf), t(0xbd), t(0x03), t(0x01), t(0x13), t(0x8a), t(0x6b),\ - t(0x3a), t(0x91), t(0x11), t(0x41), t(0x4f), t(0x67), t(0xdc), t(0xea),\ - t(0x97), t(0xf2), t(0xcf), t(0xce), t(0xf0), t(0xb4), t(0xe6), t(0x73),\ - t(0x96), t(0xac), t(0x74), t(0x22), t(0xe7), t(0xad), t(0x35), t(0x85),\ - t(0xe2), t(0xf9), t(0x37), t(0xe8), t(0x1c), t(0x75), t(0xdf), t(0x6e),\ - t(0x47), t(0xf1), t(0x1a), t(0x71), t(0x1d), t(0x29), t(0xc5), t(0x89),\ - t(0x6f), t(0xb7), t(0x62), t(0x0e), t(0xaa), t(0x18), t(0xbe), t(0x1b),\ - t(0xfc), t(0x56), t(0x3e), t(0x4b), t(0xc6), t(0xd2), t(0x79), t(0x20),\ - t(0x9a), t(0xdb), t(0xc0), t(0xfe), t(0x78), t(0xcd), t(0x5a), t(0xf4),\ - t(0x1f), t(0xdd), t(0xa8), t(0x33), t(0x88), t(0x07), t(0xc7), t(0x31),\ - t(0xb1), t(0x12), t(0x10), t(0x59), t(0x27), t(0x80), t(0xec), t(0x5f),\ - t(0x60), t(0x51), t(0x7f), t(0xa9), t(0x19), t(0xb5), t(0x4a), t(0x0d),\ - t(0x2d), t(0xe5), t(0x7a), t(0x9f), t(0x93), t(0xc9), t(0x9c), t(0xef),\ - t(0xa0), t(0xe0), t(0x3b), t(0x4d), t(0xae), t(0x2a), t(0xf5), t(0xb0),\ - t(0xc8), t(0xeb), t(0xbb), t(0x3c), t(0x83), t(0x53), t(0x99), t(0x61),\ - t(0x17), t(0x2b), t(0x04), t(0x7e), t(0xba), t(0x77), t(0xd6), t(0x26),\ - t(0xe1), t(0x69), t(0x14), t(0x63), t(0x55), t(0x21), t(0x0c), t(0x7d), - -/* -// Internal cipher tables -*/ -extern const __ALIGN64 Ipp8u RijEncSbox[256]; /* pure encryption S-box */ -extern const __ALIGN64 Ipp8u RijDecSbox[256]; /* pure decryption S-box */ - -#endif /* _PCP_RIJTBLES_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PCP_RIJTBLES_H) +#define _PCP_RIJTBLES_H + +#include "owndefs.h" +#include "owncp.h" +#include "pcprij.h" + +/* +// GF(256) multiplication operations +*/ +#define gf_m2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) +#define gf_m4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) +#define gf_m8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ + ^ (((x>>5) & 4) * WPOLY)) +#define gf_m1(x) ((x)) +#define gf_m3(x) (gf_m2(x) ^ x) +#define gf_m9(x) (gf_m8(x) ^ x) +#define gf_mB(x) (gf_m8(x) ^ gf_m2(x) ^ x) +#define gf_mD(x) (gf_m8(x) ^ gf_m4(x) ^ x) +#define gf_mE(x) (gf_m8(x) ^ gf_m4(x) ^ gf_m2(x)) + +/* +// The following particular transformations +// are used for create Encryption Tables +*/ +#define fwd_t0(x) BYTES_TO_WORD(gf_m2(x), gf_m1(x), gf_m1(x), gf_m3(x)) +#define fwd_t1(x) BYTES_TO_WORD(gf_m3(x), gf_m2(x), gf_m1(x), gf_m1(x)) +#define fwd_t2(x) BYTES_TO_WORD(gf_m1(x), gf_m3(x), gf_m2(x), gf_m1(x)) +#define fwd_t3(x) BYTES_TO_WORD(gf_m1(x), gf_m1(x), gf_m3(x), gf_m2(x)) + +/* +// The following particular transformations +// are used for create Decryption Tables +*/ +#define inv_t0(x) BYTES_TO_WORD(gf_mE(x), gf_m9(x), gf_mD(x), gf_mB(x)) +#define inv_t1(x) BYTES_TO_WORD(gf_mB(x), gf_mE(x), gf_m9(x), gf_mD(x)) +#define inv_t2(x) BYTES_TO_WORD(gf_mD(x), gf_mB(x), gf_mE(x), gf_m9(x)) +#define inv_t3(x) BYTES_TO_WORD(gf_m9(x), gf_mD(x), gf_mB(x), gf_mE(x)) + +#define exp_b3(x) BYTES_TO_WORD(0, 0, 0, (x)) +#define exp_b2(x) BYTES_TO_WORD(0, 0, (x),0) +#define exp_b1(x) BYTES_TO_WORD(0, (x),0, 0) +#define exp_b0(x) BYTES_TO_WORD((x),0, 0, 0) + +/* +// The following particular transformations +// are used for create pure Encryption/Decryption Sboxes +*/ +#define none_t(x) (x) + + +/* +// Just sequence of byte, beginning 0x00 upto 0xff +// (be parametrized by any transformation 't') +*/ +#define LINE(t) \ + t(0x00), t(0x01), t(0x02), t(0x03), t(0x04), t(0x05), t(0x06), t(0x07),\ + t(0x08), t(0x09), t(0x0a), t(0x0b), t(0x0c), t(0x0d), t(0x0e), t(0x0f),\ + t(0x10), t(0x11), t(0x12), t(0x13), t(0x14), t(0x15), t(0x16), t(0x17),\ + t(0x18), t(0x19), t(0x1a), t(0x1b), t(0x1c), t(0x1d), t(0x1e), t(0x1f),\ + t(0x20), t(0x21), t(0x22), t(0x23), t(0x24), t(0x25), t(0x26), t(0x27),\ + t(0x28), t(0x29), t(0x2a), t(0x2b), t(0x2c), t(0x2d), t(0x2e), t(0x2f),\ + t(0x30), t(0x31), t(0x32), t(0x33), t(0x34), t(0x35), t(0x36), t(0x37),\ + t(0x38), t(0x39), t(0x3a), t(0x3b), t(0x3c), t(0x3d), t(0x3e), t(0x3f),\ + t(0x40), t(0x41), t(0x42), t(0x43), t(0x44), t(0x45), t(0x46), t(0x47),\ + t(0x48), t(0x49), t(0x4a), t(0x4b), t(0x4c), t(0x4d), t(0x4e), t(0x4f),\ + t(0x50), t(0x51), t(0x52), t(0x53), t(0x54), t(0x55), t(0x56), t(0x57),\ + t(0x58), t(0x59), t(0x5a), t(0x5b), t(0x5c), t(0x5d), t(0x5e), t(0x5f),\ + t(0x60), t(0x61), t(0x62), t(0x63), t(0x64), t(0x65), t(0x66), t(0x67),\ + t(0x68), t(0x69), t(0x6a), t(0x6b), t(0x6c), t(0x6d), t(0x6e), t(0x6f),\ + t(0x70), t(0x71), t(0x72), t(0x73), t(0x74), t(0x75), t(0x76), t(0x77),\ + t(0x78), t(0x79), t(0x7a), t(0x7b), t(0x7c), t(0x7d), t(0x7e), t(0x7f),\ + t(0x80), t(0x81), t(0x82), t(0x83), t(0x84), t(0x85), t(0x86), t(0x87),\ + t(0x88), t(0x89), t(0x8a), t(0x8b), t(0x8c), t(0x8d), t(0x8e), t(0x8f),\ + t(0x90), t(0x91), t(0x92), t(0x93), t(0x94), t(0x95), t(0x96), t(0x97),\ + t(0x98), t(0x99), t(0x9a), t(0x9b), t(0x9c), t(0x9d), t(0x9e), t(0x9f),\ + t(0xa0), t(0xa1), t(0xa2), t(0xa3), t(0xa4), t(0xa5), t(0xa6), t(0xa7),\ + t(0xa8), t(0xa9), t(0xaa), t(0xab), t(0xac), t(0xad), t(0xae), t(0xaf),\ + t(0xb0), t(0xb1), t(0xb2), t(0xb3), t(0xb4), t(0xb5), t(0xb6), t(0xb7),\ + t(0xb8), t(0xb9), t(0xba), t(0xbb), t(0xbc), t(0xbd), t(0xbe), t(0xbf),\ + t(0xc0), t(0xc1), t(0xc2), t(0xc3), t(0xc4), t(0xc5), t(0xc6), t(0xc7),\ + t(0xc8), t(0xc9), t(0xca), t(0xcb), t(0xcc), t(0xcd), t(0xce), t(0xcf),\ + t(0xd0), t(0xd1), t(0xd2), t(0xd3), t(0xd4), t(0xd5), t(0xd6), t(0xd7),\ + t(0xd8), t(0xd9), t(0xda), t(0xdb), t(0xdc), t(0xdd), t(0xde), t(0xdf),\ + t(0xe0), t(0xe1), t(0xe2), t(0xe3), t(0xe4), t(0xe5), t(0xe6), t(0xe7),\ + t(0xe8), t(0xe9), t(0xea), t(0xeb), t(0xec), t(0xed), t(0xee), t(0xef),\ + t(0xf0), t(0xf1), t(0xf2), t(0xf3), t(0xf4), t(0xf5), t(0xf6), t(0xf7),\ + t(0xf8), t(0xf9), t(0xfa), t(0xfb), t(0xfc), t(0xfd), t(0xfe), t(0xff) + +/* +// Encrypt/Decrypt S-box data +// (be parametrized by any transformation 't') +*/ +#define ENC_SBOX(t) \ + t(0x63), t(0x7c), t(0x77), t(0x7b), t(0xf2), t(0x6b), t(0x6f), t(0xc5),\ + t(0x30), t(0x01), t(0x67), t(0x2b), t(0xfe), t(0xd7), t(0xab), t(0x76),\ + t(0xca), t(0x82), t(0xc9), t(0x7d), t(0xfa), t(0x59), t(0x47), t(0xf0),\ + t(0xad), t(0xd4), t(0xa2), t(0xaf), t(0x9c), t(0xa4), t(0x72), t(0xc0),\ + t(0xb7), t(0xfd), t(0x93), t(0x26), t(0x36), t(0x3f), t(0xf7), t(0xcc),\ + t(0x34), t(0xa5), t(0xe5), t(0xf1), t(0x71), t(0xd8), t(0x31), t(0x15),\ + t(0x04), t(0xc7), t(0x23), t(0xc3), t(0x18), t(0x96), t(0x05), t(0x9a),\ + t(0x07), t(0x12), t(0x80), t(0xe2), t(0xeb), t(0x27), t(0xb2), t(0x75),\ + t(0x09), t(0x83), t(0x2c), t(0x1a), t(0x1b), t(0x6e), t(0x5a), t(0xa0),\ + t(0x52), t(0x3b), t(0xd6), t(0xb3), t(0x29), t(0xe3), t(0x2f), t(0x84),\ + t(0x53), t(0xd1), t(0x00), t(0xed), t(0x20), t(0xfc), t(0xb1), t(0x5b),\ + t(0x6a), t(0xcb), t(0xbe), t(0x39), t(0x4a), t(0x4c), t(0x58), t(0xcf),\ + t(0xd0), t(0xef), t(0xaa), t(0xfb), t(0x43), t(0x4d), t(0x33), t(0x85),\ + t(0x45), t(0xf9), t(0x02), t(0x7f), t(0x50), t(0x3c), t(0x9f), t(0xa8),\ + t(0x51), t(0xa3), t(0x40), t(0x8f), t(0x92), t(0x9d), t(0x38), t(0xf5),\ + t(0xbc), t(0xb6), t(0xda), t(0x21), t(0x10), t(0xff), t(0xf3), t(0xd2),\ + t(0xcd), t(0x0c), t(0x13), t(0xec), t(0x5f), t(0x97), t(0x44), t(0x17),\ + t(0xc4), t(0xa7), t(0x7e), t(0x3d), t(0x64), t(0x5d), t(0x19), t(0x73),\ + t(0x60), t(0x81), t(0x4f), t(0xdc), t(0x22), t(0x2a), t(0x90), t(0x88),\ + t(0x46), t(0xee), t(0xb8), t(0x14), t(0xde), t(0x5e), t(0x0b), t(0xdb),\ + t(0xe0), t(0x32), t(0x3a), t(0x0a), t(0x49), t(0x06), t(0x24), t(0x5c),\ + t(0xc2), t(0xd3), t(0xac), t(0x62), t(0x91), t(0x95), t(0xe4), t(0x79),\ + t(0xe7), t(0xc8), t(0x37), t(0x6d), t(0x8d), t(0xd5), t(0x4e), t(0xa9),\ + t(0x6c), t(0x56), t(0xf4), t(0xea), t(0x65), t(0x7a), t(0xae), t(0x08),\ + t(0xba), t(0x78), t(0x25), t(0x2e), t(0x1c), t(0xa6), t(0xb4), t(0xc6),\ + t(0xe8), t(0xdd), t(0x74), t(0x1f), t(0x4b), t(0xbd), t(0x8b), t(0x8a),\ + t(0x70), t(0x3e), t(0xb5), t(0x66), t(0x48), t(0x03), t(0xf6), t(0x0e),\ + t(0x61), t(0x35), t(0x57), t(0xb9), t(0x86), t(0xc1), t(0x1d), t(0x9e),\ + t(0xe1), t(0xf8), t(0x98), t(0x11), t(0x69), t(0xd9), t(0x8e), t(0x94),\ + t(0x9b), t(0x1e), t(0x87), t(0xe9), t(0xce), t(0x55), t(0x28), t(0xdf),\ + t(0x8c), t(0xa1), t(0x89), t(0x0d), t(0xbf), t(0xe6), t(0x42), t(0x68),\ + t(0x41), t(0x99), t(0x2d), t(0x0f), t(0xb0), t(0x54), t(0xbb), t(0x16) + +#define DEC_SBOX(t) \ + t(0x52), t(0x09), t(0x6a), t(0xd5), t(0x30), t(0x36), t(0xa5), t(0x38),\ + t(0xbf), t(0x40), t(0xa3), t(0x9e), t(0x81), t(0xf3), t(0xd7), t(0xfb),\ + t(0x7c), t(0xe3), t(0x39), t(0x82), t(0x9b), t(0x2f), t(0xff), t(0x87),\ + t(0x34), t(0x8e), t(0x43), t(0x44), t(0xc4), t(0xde), t(0xe9), t(0xcb),\ + t(0x54), t(0x7b), t(0x94), t(0x32), t(0xa6), t(0xc2), t(0x23), t(0x3d),\ + t(0xee), t(0x4c), t(0x95), t(0x0b), t(0x42), t(0xfa), t(0xc3), t(0x4e),\ + t(0x08), t(0x2e), t(0xa1), t(0x66), t(0x28), t(0xd9), t(0x24), t(0xb2),\ + t(0x76), t(0x5b), t(0xa2), t(0x49), t(0x6d), t(0x8b), t(0xd1), t(0x25),\ + t(0x72), t(0xf8), t(0xf6), t(0x64), t(0x86), t(0x68), t(0x98), t(0x16),\ + t(0xd4), t(0xa4), t(0x5c), t(0xcc), t(0x5d), t(0x65), t(0xb6), t(0x92),\ + t(0x6c), t(0x70), t(0x48), t(0x50), t(0xfd), t(0xed), t(0xb9), t(0xda),\ + t(0x5e), t(0x15), t(0x46), t(0x57), t(0xa7), t(0x8d), t(0x9d), t(0x84),\ + t(0x90), t(0xd8), t(0xab), t(0x00), t(0x8c), t(0xbc), t(0xd3), t(0x0a),\ + t(0xf7), t(0xe4), t(0x58), t(0x05), t(0xb8), t(0xb3), t(0x45), t(0x06),\ + t(0xd0), t(0x2c), t(0x1e), t(0x8f), t(0xca), t(0x3f), t(0x0f), t(0x02),\ + t(0xc1), t(0xaf), t(0xbd), t(0x03), t(0x01), t(0x13), t(0x8a), t(0x6b),\ + t(0x3a), t(0x91), t(0x11), t(0x41), t(0x4f), t(0x67), t(0xdc), t(0xea),\ + t(0x97), t(0xf2), t(0xcf), t(0xce), t(0xf0), t(0xb4), t(0xe6), t(0x73),\ + t(0x96), t(0xac), t(0x74), t(0x22), t(0xe7), t(0xad), t(0x35), t(0x85),\ + t(0xe2), t(0xf9), t(0x37), t(0xe8), t(0x1c), t(0x75), t(0xdf), t(0x6e),\ + t(0x47), t(0xf1), t(0x1a), t(0x71), t(0x1d), t(0x29), t(0xc5), t(0x89),\ + t(0x6f), t(0xb7), t(0x62), t(0x0e), t(0xaa), t(0x18), t(0xbe), t(0x1b),\ + t(0xfc), t(0x56), t(0x3e), t(0x4b), t(0xc6), t(0xd2), t(0x79), t(0x20),\ + t(0x9a), t(0xdb), t(0xc0), t(0xfe), t(0x78), t(0xcd), t(0x5a), t(0xf4),\ + t(0x1f), t(0xdd), t(0xa8), t(0x33), t(0x88), t(0x07), t(0xc7), t(0x31),\ + t(0xb1), t(0x12), t(0x10), t(0x59), t(0x27), t(0x80), t(0xec), t(0x5f),\ + t(0x60), t(0x51), t(0x7f), t(0xa9), t(0x19), t(0xb5), t(0x4a), t(0x0d),\ + t(0x2d), t(0xe5), t(0x7a), t(0x9f), t(0x93), t(0xc9), t(0x9c), t(0xef),\ + t(0xa0), t(0xe0), t(0x3b), t(0x4d), t(0xae), t(0x2a), t(0xf5), t(0xb0),\ + t(0xc8), t(0xeb), t(0xbb), t(0x3c), t(0x83), t(0x53), t(0x99), t(0x61),\ + t(0x17), t(0x2b), t(0x04), t(0x7e), t(0xba), t(0x77), t(0xd6), t(0x26),\ + t(0xe1), t(0x69), t(0x14), t(0x63), t(0x55), t(0x21), t(0x0c), t(0x7d), + +/* +// Internal cipher tables +*/ +extern const __ALIGN64 Ipp8u RijEncSbox[256]; /* pure encryption S-box */ +extern const __ALIGN64 Ipp8u RijDecSbox[256]; /* pure decryption S-box */ + +#endif /* _PCP_RIJTBLES_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpscramble.h b/external/crypto_px/sources/ippcp/src/pcpscramble.h index c26f96bd10..9518ef6ada 100644 --- a/external/crypto_px/sources/ippcp/src/pcpscramble.h +++ b/external/crypto_px/sources/ippcp/src/pcpscramble.h @@ -1,170 +1,170 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PC_SCRAMBLE_H) -#define _PC_SCRAMBLE_H - -/* -// cpsScramblePut/cpsScrambleGet -// stores to/retrieves from pScrambleEntry position -// pre-computed data if fixed window method is used -*/ -__INLINE void cpScramblePut(Ipp8u* pArray, cpSize colummSize, - const Ipp32u* pData, cpSize dataSize) -{ - int i; - switch(colummSize) { - case 1: - dataSize *= sizeof(Ipp32u); - for(i=0; i=2; dataSize-=2, pArray+=CACHE_LINE_SIZE, pData+=2) { - ((Ipp32u*)pArray)[0] = pData[0]; - ((Ipp32u*)pArray)[1] = pData[1]; - } - if(dataSize) - ((Ipp32u*)pArray)[0] = pData[0]; - break; - case 16: - for(; dataSize>=4; dataSize-=4, pArray+=CACHE_LINE_SIZE, pData+=4) { - ((Ipp32u*)pArray)[0] = pData[0]; - ((Ipp32u*)pArray)[1] = pData[1]; - ((Ipp32u*)pArray)[2] = pData[2]; - ((Ipp32u*)pArray)[3] = pData[3]; - } - for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) - ((Ipp32u*)pArray)[0] = pData[0]; - break; - case 32: - for(; dataSize>=8; dataSize-=8, pArray+=CACHE_LINE_SIZE, pData+=8) { - ((Ipp32u*)pArray)[0] = pData[0]; - ((Ipp32u*)pArray)[1] = pData[1]; - ((Ipp32u*)pArray)[2] = pData[2]; - ((Ipp32u*)pArray)[3] = pData[3]; - ((Ipp32u*)pArray)[4] = pData[4]; - ((Ipp32u*)pArray)[5] = pData[5]; - ((Ipp32u*)pArray)[6] = pData[6]; - ((Ipp32u*)pArray)[7] = pData[7]; - } - for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) - ((Ipp32u*)pArray)[0] = pData[0]; - break; - default: - break; - } -} - - -/* -// Retrieve data from pArray -*/ -#define u8_to_u32(b0,b1,b2,b3, x) \ - ((x) = (b0), \ - (x)|=((b1)<<8), \ - (x)|=((b2)<<16), \ - (x)|=((b3)<<24)) -#define u16_to_u32(w0,w1, x) \ - ((x) = (w0), \ - (x)|=((w1)<<16)) -#define u32_to_u64(dw0,dw1, x) \ - ((x) = (Ipp64u)(dw0), \ - (x)|= (((Ipp64u)(dw1))<<32)) - -__INLINE void cpScrambleGet(Ipp32u* pData, cpSize dataSize, - const Ipp8u* pArray, cpSize colummSize) -{ - int i; - switch(colummSize) { - case 1: - for(i=0; i=2; dataSize-=2, pArray+=CACHE_LINE_SIZE, pData+=2) { - pData[0] = ((Ipp32u*)pArray)[0]; - pData[1] = ((Ipp32u*)pArray)[1]; - } - if(dataSize) - pData[0] = ((Ipp32u*)pArray)[0]; - break; - case 16: - for(; dataSize>=4; dataSize-=4, pArray+=CACHE_LINE_SIZE, pData+=4) { - pData[0] = ((Ipp32u*)pArray)[0]; - pData[1] = ((Ipp32u*)pArray)[1]; - pData[2] = ((Ipp32u*)pArray)[2]; - pData[3] = ((Ipp32u*)pArray)[3]; - - } - for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) - pData[0] = ((Ipp32u*)pArray)[0]; - break; - case 32: - for(; dataSize>=8; dataSize-=8, pArray+=CACHE_LINE_SIZE, pData+=8) { - pData[0] = ((Ipp32u*)pArray)[0]; - pData[1] = ((Ipp32u*)pArray)[1]; - pData[2] = ((Ipp32u*)pArray)[2]; - pData[3] = ((Ipp32u*)pArray)[3]; - pData[4] = ((Ipp32u*)pArray)[4]; - pData[5] = ((Ipp32u*)pArray)[5]; - pData[6] = ((Ipp32u*)pArray)[6]; - pData[7] = ((Ipp32u*)pArray)[7]; - } - for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) - pData[0] = ((Ipp32u*)pArray)[0]; - break; - default: - break; - } -} - -#endif /* _PC_SCRAMBLE_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PC_SCRAMBLE_H) +#define _PC_SCRAMBLE_H + +/* +// cpsScramblePut/cpsScrambleGet +// stores to/retrieves from pScrambleEntry position +// pre-computed data if fixed window method is used +*/ +__INLINE void cpScramblePut(Ipp8u* pArray, cpSize colummSize, + const Ipp32u* pData, cpSize dataSize) +{ + int i; + switch(colummSize) { + case 1: + dataSize *= sizeof(Ipp32u); + for(i=0; i=2; dataSize-=2, pArray+=CACHE_LINE_SIZE, pData+=2) { + ((Ipp32u*)pArray)[0] = pData[0]; + ((Ipp32u*)pArray)[1] = pData[1]; + } + if(dataSize) + ((Ipp32u*)pArray)[0] = pData[0]; + break; + case 16: + for(; dataSize>=4; dataSize-=4, pArray+=CACHE_LINE_SIZE, pData+=4) { + ((Ipp32u*)pArray)[0] = pData[0]; + ((Ipp32u*)pArray)[1] = pData[1]; + ((Ipp32u*)pArray)[2] = pData[2]; + ((Ipp32u*)pArray)[3] = pData[3]; + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + ((Ipp32u*)pArray)[0] = pData[0]; + break; + case 32: + for(; dataSize>=8; dataSize-=8, pArray+=CACHE_LINE_SIZE, pData+=8) { + ((Ipp32u*)pArray)[0] = pData[0]; + ((Ipp32u*)pArray)[1] = pData[1]; + ((Ipp32u*)pArray)[2] = pData[2]; + ((Ipp32u*)pArray)[3] = pData[3]; + ((Ipp32u*)pArray)[4] = pData[4]; + ((Ipp32u*)pArray)[5] = pData[5]; + ((Ipp32u*)pArray)[6] = pData[6]; + ((Ipp32u*)pArray)[7] = pData[7]; + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + ((Ipp32u*)pArray)[0] = pData[0]; + break; + default: + break; + } +} + + +/* +// Retrieve data from pArray +*/ +#define u8_to_u32(b0,b1,b2,b3, x) \ + ((x) = (b0), \ + (x)|=((b1)<<8), \ + (x)|=((b2)<<16), \ + (x)|=((b3)<<24)) +#define u16_to_u32(w0,w1, x) \ + ((x) = (w0), \ + (x)|=((w1)<<16)) +#define u32_to_u64(dw0,dw1, x) \ + ((x) = (Ipp64u)(dw0), \ + (x)|= (((Ipp64u)(dw1))<<32)) + +__INLINE void cpScrambleGet(Ipp32u* pData, cpSize dataSize, + const Ipp8u* pArray, cpSize colummSize) +{ + int i; + switch(colummSize) { + case 1: + for(i=0; i=2; dataSize-=2, pArray+=CACHE_LINE_SIZE, pData+=2) { + pData[0] = ((Ipp32u*)pArray)[0]; + pData[1] = ((Ipp32u*)pArray)[1]; + } + if(dataSize) + pData[0] = ((Ipp32u*)pArray)[0]; + break; + case 16: + for(; dataSize>=4; dataSize-=4, pArray+=CACHE_LINE_SIZE, pData+=4) { + pData[0] = ((Ipp32u*)pArray)[0]; + pData[1] = ((Ipp32u*)pArray)[1]; + pData[2] = ((Ipp32u*)pArray)[2]; + pData[3] = ((Ipp32u*)pArray)[3]; + + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + pData[0] = ((Ipp32u*)pArray)[0]; + break; + case 32: + for(; dataSize>=8; dataSize-=8, pArray+=CACHE_LINE_SIZE, pData+=8) { + pData[0] = ((Ipp32u*)pArray)[0]; + pData[1] = ((Ipp32u*)pArray)[1]; + pData[2] = ((Ipp32u*)pArray)[2]; + pData[3] = ((Ipp32u*)pArray)[3]; + pData[4] = ((Ipp32u*)pArray)[4]; + pData[5] = ((Ipp32u*)pArray)[5]; + pData[6] = ((Ipp32u*)pArray)[6]; + pData[7] = ((Ipp32u*)pArray)[7]; + } + for(; dataSize>0; dataSize--, pArray+=sizeof(Ipp32u), pData++) + pData[0] = ((Ipp32u*)pArray)[0]; + break; + default: + break; + } +} + +#endif /* _PC_SCRAMBLE_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c b/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c index 1fef36aef0..544d30eb89 100644 --- a/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c +++ b/external/crypto_px/sources/ippcp/src/pcpshsmgfca.c @@ -1,109 +1,109 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" -#include "owncp.h" -#include "pcphash.h" -#include "pcptool.h" - - -/*F* -// Name: ippsMGF_SHA1 -// ippsMGF_SHA224 -// ippsMGF_SHA256 -// ippsMGF_SHA384 -// ippsMGF_SHA512 -// ippsMGF_MD5 -// -// Purpose: Mask Generation Functios. -// -// Returns: Reason: -// ippStsNullPtrErr pMask == NULL -// ippStsLengthErr seedLen <0 -// maskLen <0 -// ippStsNotSupportedModeErr if algID is not match to supported hash alg -// ippStsNoErr no errors -// -// Parameters: -// pSeed pointer to the input stream -// seedLen input stream length (bytes) -// pMaske pointer to the ouput mask -// maskLen desired length of mask (bytes) -// -*F*/ -IPPFUN(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) -{ - /* get algorithm id */ - hashAlg = cpValidHashAlg(hashAlg); - /* test hash alg */ - IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); - - IPP_BAD_PTR1_RET(pMask); - IPP_BADARG_RET((seedLen<0)||(maskLen<0), ippStsLengthErr); - - { - /* hash specific */ - int hashSize = cpHashSize(hashAlg); - - int i, outLen; - - IppsHashState hashCtx; - ippsHashInit(&hashCtx, hashAlg); - - if(!pSeed) - seedLen = 0; - - for(i=0,outLen=0; outLen>24) & 0xFF); - cnt[1] = (Ipp8u)((i>>16) & 0xFF); - cnt[2] = (Ipp8u)((i>>8) & 0xFF); - cnt[3] = (Ipp8u)(i & 0xFF); - - cpReInitHash(&hashCtx, hashAlg); - ippsHashUpdate(pSeed, seedLen, &hashCtx); - ippsHashUpdate(cnt, 4, &hashCtx); - - if((outLen + hashSize) <= maskLen) { - ippsHashFinal(pMask+outLen, &hashCtx); - outLen += hashSize; - } - else { - Ipp8u md[BITS2WORD8_SIZE(IPP_SHA512_DIGEST_BITSIZE)]; - ippsHashFinal(md, &hashCtx); - CopyBlock(md, pMask+outLen, maskLen-outLen); - outLen = maskLen; - } - } - - return ippStsNoErr; - } -} +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" +#include "owncp.h" +#include "pcphash.h" +#include "pcptool.h" + + +/*F* +// Name: ippsMGF_SHA1 +// ippsMGF_SHA224 +// ippsMGF_SHA256 +// ippsMGF_SHA384 +// ippsMGF_SHA512 +// ippsMGF_MD5 +// +// Purpose: Mask Generation Functios. +// +// Returns: Reason: +// ippStsNullPtrErr pMask == NULL +// ippStsLengthErr seedLen <0 +// maskLen <0 +// ippStsNotSupportedModeErr if algID is not match to supported hash alg +// ippStsNoErr no errors +// +// Parameters: +// pSeed pointer to the input stream +// seedLen input stream length (bytes) +// pMaske pointer to the ouput mask +// maskLen desired length of mask (bytes) +// +*F*/ +IPPFUN(IppStatus, ippsMGF,(const Ipp8u* pSeed, int seedLen, Ipp8u* pMask, int maskLen, IppHashAlgId hashAlg)) +{ + /* get algorithm id */ + hashAlg = cpValidHashAlg(hashAlg); + /* test hash alg */ + IPP_BADARG_RET(ippHashAlg_Unknown==hashAlg, ippStsNotSupportedModeErr); + + IPP_BAD_PTR1_RET(pMask); + IPP_BADARG_RET((seedLen<0)||(maskLen<0), ippStsLengthErr); + + { + /* hash specific */ + int hashSize = cpHashSize(hashAlg); + + int i, outLen; + + IppsHashState hashCtx; + ippsHashInit(&hashCtx, hashAlg); + + if(!pSeed) + seedLen = 0; + + for(i=0,outLen=0; outLen>24) & 0xFF); + cnt[1] = (Ipp8u)((i>>16) & 0xFF); + cnt[2] = (Ipp8u)((i>>8) & 0xFF); + cnt[3] = (Ipp8u)(i & 0xFF); + + cpReInitHash(&hashCtx, hashAlg); + ippsHashUpdate(pSeed, seedLen, &hashCtx); + ippsHashUpdate(cnt, 4, &hashCtx); + + if((outLen + hashSize) <= maskLen) { + ippsHashFinal(pMask+outLen, &hashCtx); + outLen += hashSize; + } + else { + Ipp8u md[BITS2WORD8_SIZE(IPP_SHA512_DIGEST_BITSIZE)]; + ippsHashFinal(md, &hashCtx); + CopyBlock(md, pMask+outLen, maskLen-outLen); + outLen = maskLen; + } + } + + return ippStsNoErr; + } +} diff --git a/external/crypto_px/sources/ippcp/src/pcptool.h b/external/crypto_px/sources/ippcp/src/pcptool.h index f4549263cd..9d6b63e913 100644 --- a/external/crypto_px/sources/ippcp/src/pcptool.h +++ b/external/crypto_px/sources/ippcp/src/pcptool.h @@ -1,177 +1,177 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#if !defined(_PC_TOOL_H) -#define _CP_TOOL_H - -/* copy data block */ -__INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes) -{ - const Ipp8u* s = (Ipp8u*)pSrc; - Ipp8u* d = (Ipp8u*)pDst; - cpSize k; - for(k=0; k> (blkSize-numSize)%8 ); - - /* save crytical byte */ - Ipp8u save = (Ipp8u)( pCounter[maskPosition] & ~mask ); - - int len = BITS2WORD8_SIZE(blkSize); - Ipp32u carry = 1; - for(; (len>maskPosition) && carry; len--) { - Ipp32u x = pCounter[len-1] + carry; - pCounter[len-1] = (Ipp8u)x; - carry = (x>>8) & 0xFF; - } - - /* update crytical byte */ - pCounter[maskPosition] &= mask; - pCounter[maskPosition] |= save; -} - -#endif /* _CP_TOOL_H */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#if !defined(_PC_TOOL_H) +#define _CP_TOOL_H + +/* copy data block */ +__INLINE void CopyBlock(const void* pSrc, void* pDst, cpSize numBytes) +{ + const Ipp8u* s = (Ipp8u*)pSrc; + Ipp8u* d = (Ipp8u*)pDst; + cpSize k; + for(k=0; k> (blkSize-numSize)%8 ); + + /* save crytical byte */ + Ipp8u save = (Ipp8u)( pCounter[maskPosition] & ~mask ); + + int len = BITS2WORD8_SIZE(blkSize); + Ipp32u carry = 1; + for(; (len>maskPosition) && carry; len--) { + Ipp32u x = pCounter[len-1] + carry; + pCounter[len-1] = (Ipp8u)x; + carry = (x>>8) & 0xFF; + } + + /* update crytical byte */ + pCounter[maskPosition] &= mask; + pCounter[maskPosition] |= save; +} + +#endif /* _CP_TOOL_H */ diff --git a/external/crypto_px/sources/ippcp/src/pcpver.c b/external/crypto_px/sources/ippcp/src/pcpver.c index 694c6292ad..18c70aa883 100644 --- a/external/crypto_px/sources/ippcp/src/pcpver.c +++ b/external/crypto_px/sources/ippcp/src/pcpver.c @@ -1,41 +1,41 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "owndefs.h" - -#ifndef __OWNCP_H__ - #include "owncp.h" -#endif - -#include "pcpname.h" -#include "pcpver.h" - -#include "ippver.gen" +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "owndefs.h" + +#ifndef __OWNCP_H__ + #include "owncp.h" +#endif + +#include "pcpname.h" +#include "pcpver.h" + +#include "ippver.gen" diff --git a/external/crypto_px/sources/ippcp/src/pcpver.h b/external/crypto_px/sources/ippcp/src/pcpver.h index 6e6e90fc7e..30e6dc3a02 100644 --- a/external/crypto_px/sources/ippcp/src/pcpver.h +++ b/external/crypto_px/sources/ippcp/src/pcpver.h @@ -1,36 +1,36 @@ -/* -* Copyright (C) 2016 Intel Corporation. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in -* the documentation and/or other materials provided with the -* distribution. -* * Neither the name of Intel Corporation nor the names of its -* contributors may be used to endorse or promote products derived -* from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -#include "ippver.h" -#define BUILD() 1043 -#define VERSION() BASE_VERSION(),BUILD() - -/* ////////////////////////// End of file "pcpver.h" ///////////////////////// */ +/* +* Copyright (C) 2016 Intel Corporation. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "ippver.h" +#define BUILD() 1043 +#define VERSION() BASE_VERSION(),BUILD() + +/* ////////////////////////// End of file "pcpver.h" ///////////////////////// */ diff --git a/external/epid/LICENSE.txt b/external/epid/LICENSE.txt new file mode 100644 index 0000000000..38f89e4ace --- /dev/null +++ b/external/epid/LICENSE.txt @@ -0,0 +1,249 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +======================================================================= + +EPID SDK Subcomponents: + +The EPID SDK contains subcomponents with separate copyright notices +and license terms. Your use of the source code for these subcomponents +is subject to the terms and conditions of the following licenses. + + +----------------------------------------------------------------------- +The BSD 3-Clause License +----------------------------------------------------------------------- + +The EPID SDK bundles portions of the following under the BSD 3-Clause +License: + + - Google Test (https://github.com/google/googletest) + Copyright 2008, Google Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/external/epid/Makefile b/external/epid/Makefile new file mode 100644 index 0000000000..a542d977a3 --- /dev/null +++ b/external/epid/Makefile @@ -0,0 +1,52 @@ +include ../../buildenv.mk + +EPIDLIB := libepid.a +TOP_DIR := $(LINUX_EXTERNAL_DIR)/epid + +CFLAGS += -fPIC +DEFINES := -DIPPEPID_USE_MERGEDLIB -DASSUME_GETOCTSTRING_POINT_VALID + +ifdef DEBUG + CFLAGS += -O0 + DEFINES += -DDEBUG +else + DEFINES += -DNDEBUG +endif + +ifeq ($(ARCH), x86_64) + DEFINES += -DUSE_Y8_HEADER +else + DEFINES += -DUSE_P8_HEADER +endif + +vpath %.c epid/common epid/common/math epid/member epid/verifier ext/ipp/sources/ippcpepid/src + +INCLUDE += -I$(TOP_DIR)/ext/ipp/include \ + -I$(TOP_DIR)/ext/ipp/sources/include \ + -I$(TOP_DIR)/ext/ipp/sources/ippcp/src \ + -I$(TOP_DIR)/ext/ipp/sources/ippcpepid/src \ + -I$(TOP_DIR) + +SRC := commitment.c epid2params.c errors.c grouppubkey.c memory.c printutils.c sigrlvalid.c stack.c \ + bignum.c ecgroup.c finitefield.c pairing.c \ + context.c nr_prove.c privkey.c signbasic.c get_sigsize.c presig.c request_join.c sign.c \ + check_privrl_entry.c nrverify.c verifybasic.c context.c sigs_linked.c verify.c \ + pcpgfp.c pcpgfpec.c pcpgfpecpoint.c pcpgfpecpointstuff.c pcpgfpstuff.c pcpgfpx.c pcpgfpxstuff.c + +OBJ := $(SRC:.c=.o) + +.PHONY: all +all: $(EPIDLIB) + +$(EPIDLIB): $(OBJ) + $(AR) rcs $@ $^ + +%.o: %.c + $(CC) $(INCLUDE) $(filter-out -Werror, $(CFLAGS)) $(DEFINES) -c $< -o $@ + +.PHONY: clean +clean: + @$(RM) $(OBJ) $(EPIDLIB) + +.PHONY: rebuild +rebuild: clean all diff --git a/external/epid/NOTICE.txt b/external/epid/NOTICE.txt new file mode 100644 index 0000000000..fc0c4208bb --- /dev/null +++ b/external/epid/NOTICE.txt @@ -0,0 +1,22 @@ +Intel(R) EPID SDK +Copyright 2016 Intel Corporation + +========== + +The Intel(R) EPID SDK contains subcomponents with separate copyright notices +and license terms. + +Your use of the source code for the these subcomponents is subject to +the terms and conditions of their respective licenses. + +See the LICENSE.txt file for a list of subcomponents and dependencies and +their respective licenses. + +---------- + +The source code used for math primitives in the Intel(R) EPID SDK is a +subset of the Intel(R) IPP Cryptography library (v9.0.3) written in +C. For higher performance, you can use the commercial version of the +IPP Cryptography libraries, which are available at +https://software.intel.com/articles/download-ipp-cryptography-libraries. + diff --git a/external/epid/README.md b/external/epid/README.md new file mode 100644 index 0000000000..332f72233e --- /dev/null +++ b/external/epid/README.md @@ -0,0 +1,57 @@ +# Intel(R) EPID SDK + +The Intel(R) Enhanced Privacy ID Software Development Kit + +Intel(R) EPID SDK enables adding Intel(R) EPID support to applications +and platforms. + +Intel(R) EPID is a cryptographic protocol which enables the remote +authentication of a trusted platform whilst preserving the user's +privacy. + +* For a given public key there are many (e.g., millions) of private + keys. The key holders form a group. + +* Any key holder may sign against the one public key. + +* No one can tell which private key signed the data. This is the + privacy property. + +You can use Intel(R) EPID as a foundational building block for a +multitude of security solutions. + + +## Prerequisites + +* [Python](http://www.python.org) + +* [SCons](http://www.scons.org/) + +* [Parts](https://bitbucket.org/sconsparts/parts) + +* A C/C++ compiler supported by Parts + + +## Release Notes + +See [RELEASE_NOTES.md](RELEASE_NOTES.md). + + +## Documentation + +See [doc/index.html](doc/index.html) to browse the html +documentation. + + +## License + +See [LICENSE.txt](LICENSE.txt). + + +## Math Primitives + +The source code used for math primitives in the Intel(R) EPID SDK is a +subset of the Intel(R) IPP Cryptography library (v9.0.3) written in +C. For higher performance, you can use the commercial version of the +IPP Cryptography libraries, which are available at +https://software.intel.com/articles/download-ipp-cryptography-libraries. diff --git a/external/epid/RELEASE_NOTES.md b/external/epid/RELEASE_NOTES.md new file mode 100644 index 0000000000..3eb9ab3fc5 --- /dev/null +++ b/external/epid/RELEASE_NOTES.md @@ -0,0 +1,41 @@ +# Intel(R) EPID SDK Release Notes {#ChangeLog} + +# 2.0.0 + +## New in This Release + +* Signed binary issuer material support. + + - Binary issuer material validation APIs. + + - Updated sample issuer material. + + - Updated samples that parse signed binary issuer material. + +* Compressed member private key support. + +* Validated on additional IoT platforms. + + - Windows 10 IoT Core + + - WindRiver IDP + + +## Changes + +* The default hash algorithm has changed. It is now SHA-512. + +* Functions that returned `EpidNullPtrErr` now return `EpidBadArgErr` + instead. + + +## Fixes + +* Updated build flags to work around GCC 4.8.5 defect. + + +## Known Issues + +* SHA-512/256 hash algorithm is not supported. + +* Compressed key sample material is not included in the package. diff --git a/external/epid/ReadMe.txt b/external/epid/ReadMe.txt new file mode 100644 index 0000000000..9520110999 --- /dev/null +++ b/external/epid/ReadMe.txt @@ -0,0 +1,29 @@ +======================================================================== + STATIC LIBRARY : epid Project Overview +======================================================================== + +AppWizard has created this epid library project for you. + +No source files were created as part of your project. + + +epid.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +epid.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/external/epid/SConstruct b/external/epid/SConstruct new file mode 100644 index 0000000000..296adced51 --- /dev/null +++ b/external/epid/SConstruct @@ -0,0 +1,210 @@ +############################################################################ +# Copyright 2016 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################ + +"""use scons -k to invoke all builds regardless of unit test failures +""" +import string +import sys +import SCons.Script +import os.path +from parts import * + +print "**************** TOOLS ****************" +print '* Python Version:', string.split(sys.version, " ", 1)[0] +print '* SCons Version:', SCons.__version__ +print '* Parts Version:', PartsExtensionVersion() +print "***************************************" + +def PrintCompilerVersion(env): + """ + Function to print version of compilers used for build + Args: + env: Environment to get compilers version + """ + res = '' + if 'INTELC_VERSION' in env: + res += 'ICC ' + env['INTELC_VERSION'] + ';' + if 'MSVC_VERSION' in env: + res += 'MS ' + env['MSVC_VERSION'] + ';' + if 'GXX_VERSION' in env: + res += 'GXX ' + env['GXX_VERSION'] + ';' + if 'GCC_VERSION' in env: + res += 'GCC ' + env['GCC_VERSION'] + ';' + print 'Compiler Version: ', res + +def include_parts(part_list, **kwargs): + for parts_file in part_list: + if os.path.isfile(DefaultEnvironment().subst(parts_file)): + Part(parts_file=parts_file, **kwargs) + +######## Part groups #################################################### +ipp_parts = ['ext/ipp/ippcp.parts', + 'ext/ipp/ippcpepid.parts', + 'ext/ipp/ippcommon.parts'] +utest_parts = ['ext/gtest/gtest.parts', + 'epid/common-testhelper/common-testhelper.parts'] +common_parts = ['epid/common/common.parts'] +member_parts = ['epid/member/member.parts'] +verifier_parts = ['epid/verifier/verifier.parts'] +util_parts = ['example/util/util.parts'] +example_parts = ['example/verifysig/verifysig.parts', + 'example/signmsg/signmsg.parts', + 'example/data/data.parts'] +example_test_parts = ['test/testbot/testbot.parts', + 'test/testbot/signmsg/signmsg_testbot.parts', + 'test/testbot/verifysig/verifysig_testbot.parts', + 'test/testbot/integration/integration_testbot.parts'] +package_parts = ['ext/gtest/gtest.parts', + 'ext/ipp/ippcommon.parts', + 'ext/ipp/ippcp.parts', + 'ext/ipp/ippcpepid.parts', + 'package.parts'] +internal_tools_parts = ['tools/ikgfwrapper/ikgfwrapper.parts', + 'tools/revokegrp/revokegrp.parts', + 'tools/revokekey/revokekey.parts', + 'tools/revokesig/revokesig.parts', + 'tools/extractkeys/extractkeys.parts', + 'tools/extractgrps/extractgrps.parts'] +######## End Part groups ############################################### +######## Commandline option setup ####################################### +product_variants = [ + 'production', + 'internal-test', + 'package-epid-sdk', + 'internal-tools' +] + +default_variant = 'production' + +def is_production(): + return GetOption("product-variant") == 'production' + +def is_internal_test(): + return GetOption("product-variant") == 'internal-test' + +def is_internal_tools(): + return GetOption("product-variant") == 'internal-tools' + +def is_package(): + return GetOption("product-variant") == 'package-epid-sdk' + +def variant_dirname(): + s = GetOption("product-variant") + if s == 'production': + return 'epid-sdk' + elif s == 'package-epid-sdk': + return 'epid-sdk' + else: + return s + +AddOption("--product-variant", "--prod-var", nargs=1, + help=("Select product variant to build. Possible " + "options are: {0}. The default is {1} if no option " + "is specified").format(", ".join(product_variants), + default_variant), + action='store', dest='product-variant', type='choice', + choices=product_variants, default=default_variant) + +SetOptionDefault("PRODUCT_VARIANT", variant_dirname()) + +######## End Commandline option setup ################################### + + +# fix for parts 0.10.8 until we get better logic to extract ${CC} +SetOptionDefault('PARTS_USE_SHORT_TOOL_NAMES', 1) + +def set_default_production_options(): + SetOptionDefault('TARGET_PLATFORM', 'x86_64') + SetOptionDefault('CONFIG', 'release') + + SetOptionDefault('TARGET_VARIANT', '${TARGET_OS}-${TARGET_ARCH}') + + SetOptionDefault('INSTALL_ROOT', + '#_install/${PRODUCT_VARIANT}') + + SetOptionDefault('INSTALL_TOOLS_BIN', + '$INSTALL_ROOT/tools') + + SetOptionDefault('INSTALL_SAMPLE_BIN', + '$INSTALL_ROOT/example') + + SetOptionDefault('INSTALL_EPID_INCLUDE', + '$INSTALL_ROOT/include/epid') + + SetOptionDefault('INSTALL_IPP_INCLUDE', + '$INSTALL_ROOT/include/ext/ipp/include') + + SetOptionDefault('INSTALL_TEST_BIN', + '$INSTALL_ROOT/test') + + SetOptionDefault('INSTALL_LIB', + '$INSTALL_ROOT/lib/${TARGET_VARIANT}') + + SetOptionDefault('INSTALL_SAMPLE_DATA', + '$INSTALL_ROOT/example') + + SetOptionDefault('PACKAGE_DIR', + '#_package') + + SetOptionDefault('PACKAGE_ROOT', + '#_package/${PRODUCT_VARIANT}') + + SetOptionDefault('ROOT', + '#') + + SetOptionDefault('PACKAGE_NAME', + '{PRODUCT_VARIANT}') + +if is_production(): + set_default_production_options() + include_parts(ipp_parts, mode=['install_lib'], + INSTALL_INCLUDE='${INSTALL_IPP_INCLUDE}') + include_parts(utest_parts + common_parts + + member_parts + verifier_parts, + mode=['install_lib'], + INSTALL_INCLUDE='${INSTALL_EPID_INCLUDE}') + include_parts(util_parts + example_parts, + INSTALL_INCLUDE='${INSTALL_EPID_INCLUDE}', + INSTALL_BIN='${INSTALL_SAMPLE_BIN}', + INSTALL_DATA='${INSTALL_SAMPLE_DATA}') + PrintCompilerVersion(DefaultEnvironment()) + Default('all') + Default('run_utest::') + +if is_internal_test(): + set_default_production_options() + include_parts(ipp_parts) + include_parts(utest_parts + common_parts + + member_parts + verifier_parts) + include_parts(util_parts + example_parts, + INSTALL_BIN='${INSTALL_SAMPLE_BIN}', + INSTALL_DATA='${INSTALL_SAMPLE_DATA}') + include_parts(example_test_parts) + Default('all') + +if is_internal_tools(): + set_default_production_options() + include_parts(ipp_parts + utest_parts + common_parts + util_parts) + include_parts(internal_tools_parts, INSTALL_BIN='${INSTALL_TOOLS_BIN}') + Default('ikgfwrapper', 'revokegrp', 'revokekey', 'revokesig', + 'extractkeys', 'extractgrps') + +if is_package(): + set_default_production_options() + include_parts(package_parts, + mode=['install_package'], + INSTALL_TOP_LEVEL='${PACKAGE_ROOT}') + Default('package') diff --git a/external/epid/doc/html/BuildingSdk.html b/external/epid/doc/html/BuildingSdk.html new file mode 100644 index 0000000000..715303c04d --- /dev/null +++ b/external/epid/doc/html/BuildingSdk.html @@ -0,0 +1,150 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Building From Source + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Building From Source
+
+
+ +

To use the SDK in a project, the code from the SDK must be included in that project. The easiest way to do this is to link to static libraries. The SDK comes with build scripts to build static libraries for common environments.

+

+Prerequisites

+

Building SDK code out of the box requires a number of tools. This section lists the tools used to build the SDK.

+ + + + + + + + + + + +
Prerequisite Notes
A C/C++ compiler Core code in C. Unit tests need C++11 support.
Python Validated with v2.7.10
SCons Validated with v2.4.1
Parts 0.10.9.2 or later
+

+Building

+

To use the SDK, you need to build it to generate libraries compatible with your build environment.

+

To build based on the default SConstruct file in the root directory of the SDK, invoke scons with no arguments.

cd <path/to/sdk-root>
+scons
+

By default, this performs a 64 bit release build.

+

Potentially useful command line options:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Option Action
--cfg=debug Build in debug mode
--cfg=release Build in release mode
--target=x86 Target x86
--target=x86_64 Target x86_64
--tc=cl Use msvc to compile
--tc=gcc Use gcc to compile
--tc=icl,mstools Use intelc to compile
build:: Build the SDK (does not build unit tests)
utest:: Build unit tests
run_utest:: Run unit tests (builds tests if needed)
-c Clean the build
+

Built components appear in the _install directory of the SDK root.

+

+Example Programs

+

The SDK includes several examples that show you different aspects of how the Intel® EPID scheme works. In the SDK build, these examples are located in _install/epid-sdk/example.

+ + + + + + + +
Name Description
signmsg Create Intel® EPID signature of message
verifysig Verify signature is from a group member in good standing
+

+Building with Other Build Systems

+

It is relatively straightforward to port the SDK to your build system of choice. The following dependency diagram shows the relationship between components and the sources used to build them.

+
+basicdoc.png +
+
+
+ + + + + diff --git a/external/epid/doc/html/ChangeLog.html b/external/epid/doc/html/ChangeLog.html new file mode 100644 index 0000000000..ed8fc9fb33 --- /dev/null +++ b/external/epid/doc/html/ChangeLog.html @@ -0,0 +1,106 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: What's New + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
What's New
+
+
+

2.0.0

+

New in This Release

+
    +
  • Signed binary issuer material support.
      +
    • Binary issuer material validation APIs.
    • +
    • Updated sample issuer material.
    • +
    • Updated samples that parse signed binary issuer material.
    • +
    +
  • +
  • Compressed member private key support.
  • +
  • Validated on additional IoT platforms.
      +
    • Windows 10 IoT Core
    • +
    • WindRiver IDP
    • +
    +
  • +
+

Changes

+
    +
  • The default hash algorithm has changed. It is now SHA-512.
  • +
  • Functions that returned EpidNullPtrErr now return EpidBadArgErr instead.
  • +
+

Fixes

+
    +
  • Updated build flags to work around GCC 4.8.5 defect.
  • +
+

Known Issues

+
    +
  • SHA-512/256 hash algorithm is not supported.
  • +
  • Compressed key sample material is not included in the package.
  • +
+
+
+ + + + + diff --git a/external/epid/doc/html/EpidOverview.html b/external/epid/doc/html/EpidOverview.html new file mode 100644 index 0000000000..ae20c68102 --- /dev/null +++ b/external/epid/doc/html/EpidOverview.html @@ -0,0 +1,172 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Introduction to the Intel® EPID Scheme + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Introduction to the Intel® EPID Scheme
+
+
+ +

Intel® EPID is a cryptographic protocol which enables the remote authentication of a trusted platform whilst preserving the user's privacy.

+

+Roles

+

In the Intel® EPID scheme, there are three roles: issuers, members, and verifiers.

+

The entities in these roles interact with each other in such a way that a member can prove to a verifier that it is a trusted member of a group without disclosing the identity of the member. Groups are created and managed by the issuer.

+
+epid_diagram_high_level_use_case.png +
+

+Issuers

+

The issuer is responsible for managing group membership.

+

The issuer manages groups by doing the following:

+
    +
  • Creates groups by generating one issuing private key and one group certificate for each group. The group certificate contains the group public key.
  • +
  • Creates group members by generating unique Intel® EPID member private keys through bulk provisioning. Member private keys are created from the issuing private key for the group.
  • +
  • Manages requests from prospective members to join existing groups by using the join protocol.
  • +
  • Creates and maintains signature based revocation lists and private key based revocation lists. These lists of members no longer in good standing allow members to be dropped from a group.
  • +
  • Creates and maintains group revocation lists.
  • +
  • Makes group public keys and revocation lists available to verifiers.
  • +
+
+epid_diagram_issuer_high_level.png +
+

+Members

+

The member is the entity that attempts to anonymously prove its group membership to the verifier.

+
    +
  • Members are authorized by the issuer as part of a group.
  • +
  • Each group member has a unique Intel® EPID private key, which corresponds to the group.
  • +
  • The member uses its member private key to sign a message to prove group membership to the verifier without revealing the identity of the member.
  • +
+
+epid_diagram_member_high_level.png +
+

+Verifiers

+

The verifier checks an Intel(R) EPID signature to establish whether it was signed by an entity or device that is a member in good standing.

+

The verifier acts on behalf of a party that needs to know it is communicating with a trusted device. Verifiers obtain group certificates and revocation lists from issuers and negotiate details of signature protocol with members.

+

A verifier can do the following:

+
    +
  • Confirm a member is in fact a member of a given group in good standing.
  • +
  • Obtain group certificates and revocation lists from issuers.
  • +
  • Negotiate details of signature protocol with members.
  • +
+
+epid_diagram_verifier_high_level.png +
+

+Groups

+

An Intel® EPID group represents a set of trusted entities called members. Issuers create groups and manage group membership. For each group, the issuer creates a group public key simultaneously with the corresponding issuing private key. The issuer uses the issuing private key to create unique member private keys for each group member, and makes the group public key available to verifiers.

+

All groups have the following:

+
    +
  • Group public key, which corresponds to the issuing private key kept by the issuer
  • +
  • Signature based revocation list
  • +
  • Private key based revocation list
  • +
  • Member private keys, generated from the issuing private key
  • +
+

If a signature based revocation list or private key based revocation list does not exist, it is assumed to be empty.

+

+Keys

+

The Intel® EPID scheme works with three types of keys: the group public key, the issuing private key, and the member private key. A group public key corresponds to the unique member private keys that are part of the group. Member private keys are generated from the issuing private key.

+

Additionally, in the Intel® EPID scheme, a private key can be revoked given a signature created by that key, even if the key itself is still unknown. Group membership can be revoked and entire groups can be revoked. For more information on revocation, refer to Revocation.

+

+Group Public Key

+

The group public key is the key used by the verifier to confirm that a member belongs to a group in good standing. Each member private key in a group is associated with the group's public key.

+

When a group is created, the group public key and the issuing private key are simultaneously generated by the issuer. The verifier obtains the group public key from the issuer.

+

+Issuing Private Key

+

The issuing private key is the key used by the issuer to generate unique private keys for each member of a given group. For every group public key, there is a corresponding issuing private key. The issuing private key remains with the issuer and is kept private.

+

+Member Private Key

+

The member private key is the key used by the member to digitally sign a message when attempting to prove to the verifier that the member belongs to the group and is in good standing.

+

Unique member private keys are generated by the issuer for each member of a given group. The same group public key corresponds to each member private key in the group.

+

+Member and Verifier Interaction

+

Each Intel® EPID member uses its Intel® EPID private key to digitally sign a message. The resulting signature is called an Intel® EPID signature.

+

The Intel® EPID verifier uses the group public key to verify the correctness of an Intel® EPID signature, i.e., to verify that the signature was indeed created by a member with a valid Intel® EPID private key.

+

However, the Intel® EPID signature does not convey any information about which unique private key was used to create the signature.

+
+epid_diagram_high_level_interaction.png +
+
+
+ + + + + diff --git a/external/epid/doc/html/Glossary.html b/external/epid/doc/html/Glossary.html new file mode 100644 index 0000000000..09a29e6fcb --- /dev/null +++ b/external/epid/doc/html/Glossary.html @@ -0,0 +1,170 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Glossary + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Glossary
+
+
+ +

+DAA

+

Direct Anonymous Attestation (DAA) is a digital signature algorithm that supports anonymity by providing a group public verification key associated with many unique private signing keys. Intel® EPID enhances DAA by enabling a private key to be revoked given a signature created by that key, even if the key itself is still unknown.

+

+Elliptic curve

+

In elliptic curve cryptography, an elliptic curve is an algebraic structure used to create a function whose output is easy to compute, but whose input is difficult to compute given the output. Elliptic curve cryptography requires smaller keys compared to non-elliptic curve cryptography (based on Galois fields) to provide equivalent security.

+

+Elliptic curve point

+

An elliptic curve point is a point along an elliptic curve. The security of elliptic curve cryptography depends on the ability to compute a point multiplication and the inability to compute the multiplicand given the original and product points.

+

+Group

+

An Intel® EPID group represents a set of trusted entities called members.

+

Issuers create groups and manage group membership. For each group, the issuer creates a group public key simultaneously with the corresponding issuing private key. The issuer uses the issuing private key to create unique member private keys for each group member, and makes the group public key available to verifiers.

+

All groups have the following:

+
    +
  • Group public key, which corresponds to the issuing private key kept by the issuer
  • +
  • Signature based revocation list
  • +
  • Private key based revocation list
  • +
  • Member private keys, generated from the issuing private key
  • +
+

If a signature based revocation list or private key based revocation list does not exist, it is assumed to be empty.

+

+Group certificate

+

The group certificate contains the group public key. The group certificate is created by the issuer and obtained by the verifier. When the issuer creates groups, it generates one issuing private key and one group certificate for each group.

+

+Group public key

+

The group public key is the key used by the verifier to confirm that a member belongs to a group in good standing. Each member private key in a group is associated with the group's public key.

+

When a group is created, the group public key and the issuing private key are simultaneously generated by the issuer. The verifier obtains the group public key from the issuer.

+

+Intel® EPID

+

Enhanced Privacy ID (Intel® EPID) is a cryptographic protocol for attestation of a trusted platform while preserving the user's privacy. Intel® EPID can be used as a foundational building block for a multitude of security solutions.

+

+Intel® EPID signature

+

An Intel® EPID signature is a type of digital signature that preserves anonymity of the signer, while still proving the signer is a member of a trusted group.

+

+Issuer

+

The issuer is the entity in the Intel® EPID scheme that is responsible for managing group membership. An example of an issuer is the Intel Key Generation Facility.

+

The issuer manages groups by doing the following:

+
    +
  • Creates groups by generating one issuing private key and one group certificate for each group. The group certificate contains the group public key.
  • +
  • Creates group members by generating unique Intel® EPID member private keys through bulk provisioning. Member private keys are created from the issuing private key for the group.
  • +
  • Manages requests from prospective members to join existing groups by using the join protocol.
  • +
  • Creates and maintains signature based revocation lists and private key based revocation lists. These lists of members no longer in good standing allow members to be dropped from a group.
  • +
  • Creates and maintains group revocation lists.
  • +
  • Makes group public keys and revocation lists available to verifiers.
  • +
+

+Issuing private key

+

The issuing private key is the key used by the issuer to generate unique private keys for each member of a given group. For every group public key, there is a corresponding issuing private key. The issuing private key remains with the issuer and is kept private.

+

+Member

+

The member is the entity that attempts to prove its group membership to the verifier. Members are authorized by the issuer as part of a group and each group member has a unique Intel® EPID private key. The member uses its member private key to sign a message to prove group membership without revealing its identity. An example of a member is a PC with an embedded Intel® EPID member private key.

+

+Name-based signature

+

A name-based signature is a type of signature that gives the verifier the ability to link Intel® EPID signatures from the same member, reducing the member's privacy.

+

A name-based signature is created using the additional parameter of a basename. If a basename is not specified, a random number is chosen as the basename. If the member uses the same basename, the verifier can mathematically link signatures generated by the member, showing that the signatures are from the same member.

+

+Member private key

+

The member private key is the key used by the member to digitally sign a message when attempting to prove to the verifier that the member belongs to the group and is in good standing.

+

Unique member private keys are generated by the issuer for each member of a given group. The same group public key corresponds to each member private key in the group.

+

+Non-revoked proof

+

A non-revoked proof is part of an Intel® EPID signature that proves that the member is not a specific revoked entity in the signature based revocation list. The member provides the signature with a number of non-revoked proofs, one per revocation list entry, to prove to the verifier that the member does not correspond to any entry in the revocation list.

+

+Pairing

+

Pairing is a mathematical operation that maps two elliptic curve groups to a third multiplicative group.

+

+Revocation, revocation lists

+

Revocation lists are data structures used by the verifier to identify members that are no longer approved members of the group.

+

The verifier obtains the member private key based revocation list (PrivRL), signature based revocation list (SigRL), and group based revocation list (GroupRL) from the issuer. The verifier can also maintain its own verifier blacklist (VerifierRL).

+

+Verifier

+

The verifier is the entity that checks an Intel® EPID signature to establish whether it was signed by an entity or device that is a member in good standing.

+

The verifier acts on behalf of a party that needs to know it is communicating with a trusted device. Verifiers obtain group certificates and revocation lists from issuers and negotiate details of signature protocol with members.

+
+
+ + + + + diff --git a/external/epid/doc/html/ImplementationNotes.html b/external/epid/doc/html/ImplementationNotes.html new file mode 100644 index 0000000000..c8a9555422 --- /dev/null +++ b/external/epid/doc/html/ImplementationNotes.html @@ -0,0 +1,110 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Implementation Notes + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Implementation Notes
+
+
+ +

+Random Number Generation

+

Some SDK APIs require a random number data source. A BitSupplier provides a source of random data. This function should be a cryptographically secure random number generator.

+
Warning
The pseudo-random number generator provided with the examples is for sample use only and is not suitable for cryptographically secure applications.
+

+Protecting Secrets

+

Member code works with private keys, so member code must be run in a trusted environment.

+
Warning
If member memory is available to an untrusted source, the member private key could be exposed.
+

The EpidZeroMemory function is used by the memory allocation routines EpidAlloc, EpidRealloc and EpidFree to wipe the memory as memory is freed.

+
Warning
The EpidZeroMemory function may be optimized away by some compilers. If it is, you should consider using a compiler or operating system specific memory sanitization function (e.g. memcpy_s or SecureZeroMemory).
+

+Replacing Math Primitives

+

SDK math primitives are designed to be replaced with your own implementation if you need to rely on custom hardware for performance. The SDK is designed to simplify this process by isolating implementation details behind a clearly defined interface, defined by the non-internal headers the epid/common/math directory. Math functionality has detailed tests to ease validation.

+

+Octstring/Buffer Types

+

Serialized information in the SDK is passed in fixed size buffer types whenever possible. Collectively these fixed size buffer types are called Octstrings.

+

In epid/common/types.h, there are a large number of packed structs that contain other packed structs, which eventually contain OctStr* types. Normally these are named *Str and are refered to as Str types.

+

OctStr* types are buffers that hold N bits, where N is the number at the end of the type name. These types usually represent numbers in a Big Endian format (buffer[0] is the most significant value).

+

Str types generally represent fixed size groups of numbers such as a point or vector.

+

OctStr* and Str types are usually populated by reading a buffer from a file or other storage, or by calling a serialize function. OctStr* and Str types must be packed so that the compiler does not insert padding. In the current code, this is done using pragmas.

+
#pragma pack(1)
// OctStr* type holding 256 bits
typedef struct OctStr256 {
unsigned char data[256 / CHAR_BIT];
// Str type consisting of a single 256 bit number
typedef struct FqElemStr {
// Str type consisting of a two other Str types
typedef struct G1ElemStr {

Many APIs use void* parameters where OctStr* types are expected. If more than one size is allowed, a size parameter is usually also required.

+

+Flexible Arrays

+

A common idiom in the SDK is the use of flexible array types. These types are structs with the last element being an array of size 1 of some type. Flexible array types always have a size value embedded in the struct. The name of the count and array fields differs between flexible array types.

+
typedef struct Sample {
OctStr32 data;
OctStr32 count;
G1ElemStr array[1];
} Sample;

Flexible array types are expected to be in a buffer of size sizeof(FA) + ((N-1) * sizeof(E)) where FA is the flexible array type, N is the number of elements in the array and E is the type of each element. Note that this may be smaller than sizeof(FA) if N is 0, in which case referencing any element is an error.

+
Sample* AllocSample(size_t count) {
return (Sample*)malloc(sizeof(Sample)
+ (count * sizeof(G1ElemStr))
- sizeof(G1ElemStr));
}

In many cases, functions that accept flexible array types will also expect a buffer size that is compared against the computed size of the array as a sanity check.

+
+
+ + + + + diff --git a/external/epid/doc/html/IssuerMaterial.html b/external/epid/doc/html/IssuerMaterial.html new file mode 100644 index 0000000000..67d8ab03d0 --- /dev/null +++ b/external/epid/doc/html/IssuerMaterial.html @@ -0,0 +1,136 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Sample Issuer Material + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Sample Issuer Material
+
+
+ +

Because the SDK does not include issuer APIs, pre-generated sample data is included for validation purposes.

+
Note
Sample compressed key material is not included in the package.
+

+Sample Groups

+

Issuers create groups and manage group membership. For each group, the issuer creates a group public key simultaneously with the corresponding issuing private key. The issuer uses the issuing private key to create unique member private keys for each group member, and makes the group public key available to verifiers.

+

All groups have the following:

+
    +
  • Group public key, which corresponds to the issuing private key kept by the issuer
  • +
  • Signature based revocation list
  • +
  • Private key based revocation list
  • +
  • Member private keys, generated from the issuing private key
  • +
+

If a signature based revocation list or private key based revocation list does not exist, it is assumed to be empty.

+

+groupa

+

There are eight members in groupa:

+
    +
  • groupa/member0 - A non-revoked member.
  • +
  • groupa/member1 - Another non-revoked member.
  • +
  • groupa/privrevokedmember0 - A revoked member. Revoked by Private-Key based revocation list (groupa/privrl.bin)
  • +
  • groupa/privrevokedmember1 - A revoked member. Revoked by Private-Key based revocation list (groupa/privrl.bin)
  • +
  • groupa/privrevokedmember2 - A revoked member. Revoked by Private-Key based revocation list (groupa/privrl.bin)
  • +
  • groupa/sigrevokedmember0 - A revoked member. Revoked by Signature based revocation list (groupa/sigrl.bin)
  • +
  • groupa/sigrevokedmember1 - A revoked member. Revoked by Signature based revocation list (groupa/sigrl.bin)
  • +
  • groupa/sigrevokedmember2 - A revoked member. Revoked by Signature based revocation list (groupa/sigrl.bin)
  • +
+

The following are groupa revocation lists:

+
    +
  • groupa/privrl.bin - Private-Key based revocation list. privrevokedmember0, privrevokedmember1 and privrevokedmember2** revoked.
  • +
  • groupa/sigrl.bin - Signature based revocation list. sigrevokedmember0, sigrevokedmember0 and sigrevokedmember0** revoked.
  • +
+

+groupb

+

There are four members in groupb:

+
    +
  • groupb/member0 - A non-revoked member.
  • +
  • groupb/member1 - Another non-revoked member.
  • +
  • groupb/privrevokedmember0 - A revoked member. Revoked by Private-Key based revocation list (groupb/privrl.bin)
  • +
  • groupb/sigrevokedmember0 - A revoked member. Revoked by Signature based revocation list (groupb/sigrl.bin)
  • +
+

The following are groupb revocation lists:

+
    +
  • groupb/privrl.bin - Private-Key based revocation list. privrevokedmember0 revoked.
  • +
  • groupb/sigrl.bin - Signature based revocation list. sigrevokedmember0 revoked.
  • +
+

+Group Based Revocation Lists

+

If an entire group is no longer valid, the issuer can revoke it using the group based revocation list. Two sample group based revocation lists are provided with the SDK.

+
    +
  • grprl_empty.bin - No entries
  • +
  • grprl.bin - One entry in which groupb is revoked.
  • +
+
+
+ + + + + diff --git a/external/epid/doc/html/LegalInformation.html b/external/epid/doc/html/LegalInformation.html new file mode 100644 index 0000000000..959bf33c6c --- /dev/null +++ b/external/epid/doc/html/LegalInformation.html @@ -0,0 +1,84 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Legal Information + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Legal Information
+
+
+

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

+

UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.

+

Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.

+

The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

+

Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.

+

Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or by visiting Intel's web site http://www.intel.com.

+

Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and other countries.

+

*Other names and brands may be claimed as the property of others.

+
+
+ + + + + diff --git a/external/epid/doc/html/SdkOverview.html b/external/epid/doc/html/SdkOverview.html new file mode 100644 index 0000000000..b9432dfdda --- /dev/null +++ b/external/epid/doc/html/SdkOverview.html @@ -0,0 +1,163 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: What's Included in the SDK + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
What's Included in the SDK
+
+
+ +

+SDK Components

+

The SDK is divided into logical components to separate responsibilities and create interfaces that you can re-implement using custom tools such as hardware accelerators.

+
+sdk_block_diagram.png +
+


+ The Intel® EPID SDK is divided into the following components:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Component Description
member Library containing APIs needed to implement a member
verifier Library containing APIs needed to implement a verifier
common Library containing common types and functions
math Math primitives used by member and verifier
IPP A C-only non-optimized subset of Intel® IPP
signmsg A sample program showing how to sign messages
verfifysig A sample program showing how to verify signatures
util Common utilities used by samples
gtest gtest unit test framework
Build Scripts Scripts to configure and build the SDK
Sample Issuer Material Sample keys and revocation lists
+

Math primitives are implemented in the math sub-component of common. The reference math primitive implementation is based on a non-optimized Vanilla C subset of the Intel® Performance Primitives. Math is designed so that you can replace its implementation to call custom hardware IP blocks or optimized libraries.

+

+Filesystem Layout

+

The Intel® EPID SDK has two filesystem layouts: the Source Layout and the Install Layout.

+

The Source Layout is what you find when you download the SDK and extract it to disk. This layout contains all of the files that you need to build the libraries, samples, tests, and data generated by the SDK.

+

The Install Layout is the layout of files under the _install folder after you build the SDK.

+

+Source Layout

+

The Source Layout is used by the build scripts in the Intel® EPID SDK to find components and files needed to create libraries and executables.

epid-sdk/
+|__ LICENSE.txt             Distribution license
+|__ NOTICE.txt              Legal notices
+|__ README.md               Readme
+|__ RELEASE_NOTES.md        Release notes
+|__ SConstruct              Main build configuration
+|
+|__ doc/
+|   |__ html/               HTML format documentation
+|   |__ index.html          Entry point for HTML format documentation
+|
+|__ epid/
+|   |__ common/             Source for Common
+|   |__ common-testhelper/  Source for unit test helper common helpers
+|   |__ member/             Source for Member
+|   |__ verifier/           Source for Verifier
+|
+|__ example/
+|   |__ data/               Binary data used for testing and tutorials
+|   |__ signmsg/            Source for message signing example
+|   |__ util/               Common utilities for examples
+|   |__ verifysig/          Source for signature validation signing example
+|
+|__ ext/
+|   |__ gtest/             Third party gtest library
+|   |__ ipp/               IPP library
+|
+|__ parts-site/            Parts platform config scripts
+

+Install Layout

+

The Install Layout contains the data developers need to develop and build their applications using the Intel® EPID SDK. Once built, the Install Layout has no dependency on the Source Layout, allowing developers to build the SDK once and reuse the built files in other locations or on other computers.

_install/
+|__ epid-sdk/
+    |__ include/            C include header files for the SDK
+    |__ lib/
+    |   |__ <platform>      Target specific static libraries for the SDK
+    |
+    |__example/             Sample applications and data
+    |__test/                Unit test executables (if unit tests built)
+
+ + + + + diff --git a/external/epid/doc/html/SignVerifyTutorial.html b/external/epid/doc/html/SignVerifyTutorial.html new file mode 100644 index 0000000000..3aca35d6f5 --- /dev/null +++ b/external/epid/doc/html/SignVerifyTutorial.html @@ -0,0 +1,192 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Signing and Verification Tutorial + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Signing and Verification Tutorial
+
+
+ +

The Intel® EPID SDK provides example tools to show you how to use the Intel® EPID SDK APIs. These examples are called signmsg and verifysig.

+

You can build these examples using the instructions in Building From Source. The tutorial assumes _install/epid-sdk/example is the current directory.

+

All command lines in this tutorial use posix command line conventions; for other systems, adjust accordingly.

+

For the code used in this tutorial, refer to Examples.

+
Note
The data for running this tutorial is pre-generated. Once the samples are built, the data is in the _install/epid-sdk/example/data directory. See Sample Issuer Material.
+

+Creating an Intel® EPID Signature of a Given Message

+

The example application signmsg shows you how to create an Intel® EPID Signature of a given message.

$ ./signmsg -h
+Usage: signmsg [OPTION]...
+Create Intel(R) EPID signature of message
+
+Options:
+
+--sig=FILE            write signature to FILE (default: sig.dat)
+--msg=MESSAGE         MESSAGE to sign
+--bsn=BASENAME        BASENAME to sign with (default: random)
+--sigrl=FILE          load signature based revocation list from FILE
+--gpubkey=FILE        load group public key from FILE
+                        (default: pubkey.bin)
+--mprivkey=FILE       load member private key from FILE
+                        (default: mprivkey.dat)
+--mprecmpi=FILE       load pre-computed member data from FILE
+--mprecmpo=FILE       write pre-computed member data to FILE
+--hashalg=NAME        SHA-256 | SHA-384 | SHA-512 (default: SHA-512)
+--capubkey=FILE       load IoT Issuing CA public key from FILE
+                        (default: cacert.bin)
+-h,--help             display this help and exit
+-v,--verbose          print status messages to stdout
+

To sign a message, a group member in good standing uses the following command:

$ ./signmsg --msg="test0"
+

The above command signs a message "test0". signmsg uses default options for the group public key, member private key, and hash algorithm (SHA-512). All other parameters that are not given are ignored. The command produces a signature file: sig.dat

+

+Verifying an Intel® EPID Signature

+

The example application verifysig shows you how to verify that a given Intel® EPID Signature is produced by a member in good standing.

$ ./verifysig -h
+Usage: verifysig [OPTION]...
+Verify signature was created by group member in good standing
+
+Options:
+
+--sig=FILE            load signature from FILE (default: sig.dat)
+--msg=MESSAGE         MESSAGE that was signed (default: empty)
+--bsn=BASENAME        BASENAME used in signature (default: random)
+--privrl=FILE         load private key based revocation list from FILE
+--sigrl=FILE          load signature based revocation list from FILE
+--grprl=FILE          load group revocation list from FILE
+                        (default: grprl.bin)
+--verifierrl=FILE     load verifier revocation list from FILE
+--gpubkey=FILE        load group public key from FILE (default: pubkey.bin)
+--vprecmpi=FILE       load pre-computed verifier data from FILE
+--vprecmpo=FILE       write pre-computed verifier data to FILE
+--hashalg=NAME        SHA-256 | SHA-384 | SHA-512 (default: SHA-512)
+--capubkey=FILE       load IoT Issuing CA public key from FILE
+                        (default: cacert.bin)
+-h,--help             display this help and exit
+-v,--verbose          print status messages to stdout
+

To verify that a signature is from a member in good standing, the verifier uses the following command:

$ ./verifysig --msg="test0"
+signature verified successfully
+

This verifies that the default signature file sig.dat is generated for the message "test0" by a member in good standing. verifysig uses default inputs for group public key and hash algorithm (SHA-512). All other parameters are ignored. The output verifysig: signature verified successfully denotes that the verification is successful.

+

+Linking Intel® EPID Signatures from the Same Member

+

A name-based signature is a type of signature that gives the verifier the ability to link Intel® EPID signatures from the same member, reducing the member's privacy.

+

The verifier can ask the member to sign a message with a basename that the verifier chooses. If the member uses the name-based signature option (i.e., in cases where a basename is specified), then all the signatures created by the member using the same basename are linkable by the verifier.

+
Warning
The use of a name-based signature creates a platform unique pseudonymous identifier. Because it reduces the member's privacy, the user should be notified when it is used and should have control over its use.
+

A name-based signature is created using the additional parameter of a basename. If the member uses the same basename, the verifier can mathematically link signatures generated by the member, showing that the signatures are from the same member.

+

If basename is not provided, then the member uses a random basename and the signature generated by the member is anonymous.

+

To Sign message "test0" with a basename "base0":

$ ./signmsg --msg="test0" --bsn="base0"
+

To verify the signature:

$ ./verifysig --msg="test0" --bsn="base0"
+verifysig: signature verified successfully
+

+Expected Failures

+

The signature verification process fails if there is a parameter mismatch between sign and verify operations. Here are some examples.

+

Verification fails if there is a mismatch in the message:

$ ./signmsg --msg="test0"
+$ ./verifysig --msg="test1"
+verifysig: signature verification failed: invalid signature
+

Verification fails if there is a mismatch in the basename:

$ ./signmsg --msg="test0" --bsn="base0"
+$ ./verifysig --msg="test0" --bsn="base1"
+verifysig: signature verification failed: invalid signature
+

The Intel® EPID SDK supports the following hash algorithms: SHA-256, SHA-384, SHA-512. The selected hash algorithm must be the same for both sign and verify. Mismatch in hash algorithm results in verification failure:

$ ./signmsg --msg="test0" --hashalg=SHA-256
+$ ./verifysig --msg="test0" --hashalg=SHA-384
+verifysig: signature verification failed: invalid signature
+

+Revocation

+

Revocation lists are data structures used by the verifier to identify members that are no longer approved members of the group.

+

The verifier obtains the member private key based revocation list (PrivRL), signature based revocation list (SigRL), and group based revocation list (GroupRL) from the issuer. The verifier can also maintain its own verifier blacklist (VerifierRL).

+

+Detecting Revoked Group from Group Revocation List

+

Verification of a signature fails if it is generated by a member of a group that is revoked in the group revocation list.

+

For example,

$ ./signmsg --msg="test0" --gpubkey=data/groupb/pubkey.bin --mprivkey=data/groupb/member0/mprivkey.dat
+$ ./verifysig --msg="test0" --grprl=data/grprl.bin --gpubkey=data/groupb/pubkey.bin
+verifysig: signature verification failed: signature revoked in GroupRl
+

The verification fails because groupb is revoked and is an entry in the group revocation list (grprl.bin).

+

+Detecting Revoked Member from Private Key Based Revocation List

+

Verification of a signature fails if it is generated by a member whose private key is revoked in a private-key based revocation list.

+

For example,

$ ./signmsg --msg=test0 --gpubkey=data/groupa/pubkey.bin --mprivkey=data/groupa/privrevokedmember0/mprivkey.dat
+$ ./verifysig --msg=test0 --privrl=data/groupa/privrl.bin --gpubkey=data/groupa/pubkey.bin
+verifysig: signature verification failed: signature revoked in PrivRl
+

The verification fails because the private key of privrevokedmember0 is revoked and is an entry in the private key based revocation list of groupa (privrl.bin).

+

+Detecting Revoked Member from Signature Based Revocation List

+

Verification of a signature fails if it is generated by a member whose signature is revoked in a signature based revocation list.

$ ./signmsg --msg="test1" --sigrl=data/groupa/sigrl.bin --gpubkey=data/groupa/pubkey.bin --mprivkey=data/groupa/sigrevokedmember0/mprivkey.dat
+signmsg: signature revoked in SigRL
+$ ./verifysig --msg="test1" --sigrl=data/groupa/sigrl.bin --gpubkey=data/groupa/pubkey.bin
+verifysig: signature verification failed: signature revoked in SigRl
+

The message "test1" is signed by signmsg with a warning signmsg: signature revoked in SigRL. This means that the signature of sigrevokedmember0 is revoked in the signature based revocation list. The verification fails because the signature was generated by sigrevokedmember0, which is revoked and is an entry in the signature based revocation list of groupa (sigrl.bin).

+
+
+ + + + + diff --git a/external/epid/doc/html/annotated.html b/external/epid/doc/html/annotated.html new file mode 100644 index 0000000000..3fbd0796d1 --- /dev/null +++ b/external/epid/doc/html/annotated.html @@ -0,0 +1,136 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Structures + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Data Structures
+
+
+
Here are the data structures with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 CAllowedBasenameInternal implementation of base name
 CBasicSignatureIntel(R) EPID 2.0 basic signature
 CBigNumStrSerialized BigNum
 CCommitValuesStorage for values to create commitment in Sign and Verify algorithms
 CCompressedPrivKeyCompressed private key
 CEcdsaPrivateKeyECDSA Private Key
 CEcdsaPublicKeyECDSA Public Key
 CEcdsaSignatureECDSA Signature using NIST 256-bit curve secp256r1
 CEpid2ParamsIntel(R) EPID 2.0 Parameters
 CEpid2Params_Internal representation of Epid2Params
 CEpidCaCertificateIoT CA Certificate binary format
 CEpidFileHeaderIntel(R) EPID binary file header
 CEpidGroupPubKeyCertificateIntel(R) EPID 2.0 Group Public Key binary format
 CEpidSignatureIntel(R) EPID 2.0 Signature
 CErrorTextEntryRecord mapping status code to string
 CFpElemStrNumber in [0, p-1]
 CFq12ElemDatData for element in Fq2^3^2
 CFq12ElemStrSerialized Fq2^3^2 element
 CFq2ElemDatData for element in Fq2
 CFq2ElemStrSerialized Fq2 element
 CFq6ElemDatData for element in Fq2^3
 CFq6ElemStrSerialized Fq2^3 element
 CFqElemDatData for element in Fq
 CFqElemStrNumber in [0, q-1]
 CG1ElemStrSerialized G1 element
 CG2ElemStrSerialized G2 element
 CGroupPubKeyIntel(R) EPID 2.0 group public key
 CGroupPubKey_Internal representation of GroupPubKey
 CGroupRlGroup revocation list
 CGtElemStrSerialized GT element
 CIPrivKeyIntel(R) EPID 2.0 issuing private key
 CJoinPCommitValuesStorage for values to create commitment in Sign and Verify algorithms
 CJoinRequestJoin request
 CMemberCtxMember context definition
 CMemberPrecompPre-computed member settings
 CMembershipCredentialMembership credential
 CNrProofNon-revoked Proof
 CNrVerifyCommitValuesStorage for values to create commitment in NrProve algorithm
 COctStr128128 bit octet string
 COctStr1616 bit octet string
 COctStr256256 bit octet string
 COctStr3232 bit octet string
 COctStr512512 bit octet string
 COctStr6464 bit octet string
 COctStr88 bit octet string
 CPreComputedSignaturePre-computed signature
 CPrivKeyIntel(R) EPID 2.0 private key
 CPrivKey_Internal implementation of PrivKey
 CPrivRlPrivate-key based revocation list
 CSha256DigestSHA256 digest
 CSigRlSignature based revocation list
 CSigRlEntryEntry in SigRL (B,K)
 CStackInternal representation of a Stack
 CVerifierCtxVerifier context definition
 CVerifierPrecompPre-computed member settings
 CVerifierRl
+
+
+
+ + + + + diff --git a/external/epid/doc/html/arrowdown.png b/external/epid/doc/html/arrowdown.png new file mode 100644 index 0000000000000000000000000000000000000000..0b63f6d38c4b9ec907b820192ebe9724ed6eca22 GIT binary patch literal 246 zcmVkw!R34#Lv2LOS^S2tZA31X++9RY}n zChwn@Z)Wz*WWHH{)HDtJnq&A2hk$b-y(>?@z0iHr41EKCGp#T5?07*qoM6N<$f(V3Pvj6}9 literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/arrowright.png b/external/epid/doc/html/arrowright.png new file mode 100644 index 0000000000000000000000000000000000000000..c6ee22f937a07d1dbfc27c669d11f8ed13e2f152 GIT binary patch literal 229 zcmV^P)R?RzRoKvklcaQ%HF6%rK2&ZgO(-ihJ_C zzrKgp4jgO( fd_(yg|3PpEQb#9`a?Pz_00000NkvXXu0mjftR`5K literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/basicdoc.png b/external/epid/doc/html/basicdoc.png new file mode 100644 index 0000000000000000000000000000000000000000..e092eb64db088145daa571cd093c338c269ba0ff GIT binary patch literal 19922 zcmeIac|6o#+c>WJluD>5$(9r;OOh>yBFP?#vW&=*oh*Z~R6_QB3!@T4vdv^SlzpGF zHZ=An43lNX&iBmFec#{b``o|Z^W4AX^?ZN7=Z_k5-sfEBdSBbQ&b3U?Jq;!Lqi2uO z(9qB;-@UC(L$e?JI{-PnAB_BXdXx)%>~q#ulBdb*V4ntG{<6HKev5{tFoJH=uc2` zXDxc$W*%Li{)(18%6sx4>;0_P_+bT}y9emczieVwfV_q)hJ`@G-ro&g6zKk;?ak4e z$7ELafJ-@&>(*h{E#vAUa=-7q>;?hdJ2=Ehi@~fsf~PLItlSuacWl6>L}_T;{0Kd> z^CdoBQ}Yn}pEc@6C+A0R&d?dduWb0%+f9|^4{elHNZx3IVi4}zb9(lir5prA`I+vE zBW{t}!p`<|s{}O5;OcO5!l1J>hgm+C=xu&fAAlioFWI8Xv~pr=vipskS}V2=46@^*WV_Lj`Yu&qMHVvi<$`=J#y2m zctC!LNVxT9x2X;UzHEyP5B6ct=QMC~6Y2u<6>Ge>zD;T_!CptmkbYWgwra`F10ORK;KaK49aH0q5GoOUV z^41-U#O%vpl$twemuHN-=_HAtWi(&AP;s^nvRDu^bOrfDER_*w^MD)f!^-M*FvzuM z&8;(6M5-ZTQB?@n`UekYUpryLmBq_M!|pewKNUiwAH)z|zq1$jRjPV9?vYB%fHrZW zlID@=3vymgffrirO2-_5b>SZIRVfWh;_aq^{!f2jHK9c_vAa0^yA2b3WrcwX&w_b) zPfiuS(FL6DX@{0OF1nh}3+82-wFiqO5nTC*X;do2qNnn_c%V(AZ=WRGDZkbUHb3KZ z+V>9ZV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{g_yB#U#s9JDp_42C0w({F%W%lE2qT2)fOAC`e7k%}nlxFN$ zkp>#(=VuPJLT5zkUs~_(k?~C9QXyz^NAAZhkFmN$3nL5SNIwV??V3% zo8kYw)K3pX7MplJdfjwfnKy!a(|l?8Ez3w#zy^LCUy__>=_9%My z{n931IS})GlGUF8K#6VIbs%684A^L3@%PlP2>_sk`UWPq@f;rU*V%rPy_ekbhXT&s z(GN{DxFv}*vZp`F>S!r||M`I*nOwwKX+BC~3P5N3-)Y{65c;ywYiAh-1*hZcToLHK ztpl1xomJ+Yb}K(cfbJr2=GNOnT!UFA7Vy~fBz8?J>XHsbZoDad^8PxfSa0GDgENZS zuLCEqzb*xWX2CG*b&5IiO#NzrW*;`VC9455M`o1NBh+(k8~`XCEEoC1Ybwf;vr4K3 zg|EB<07?SOqHp9DhLpS&bzgo70I+ghB_#)K7H%AMU3v}xuyQq9&Bm~++VYhF09a+U zl7>n7Jjm$K#b*FONz~fj;I->Bf;ule1prFN9FovcDGBkpg>)O*-}eLnC{6oZHZ$o% zXKW$;0_{8hxHQ>l;_*HATI(`7t#^{$(zLe}h*mqwOc*nRY9=?Sx4OOeVIfI|0V(V2 zBrW#G7Ss9wvzr@>H*`r>zE z+e8bOBgqIgldUJlG(YUDviMB`9+DH8n-s9SXRLyJHO1!=wY^79WYZMTa(wiZ!zP66 zA~!21vmF3H2{ngD;+`6j#~6j;$*f*G_2ZD1E;9(yaw7d-QnSCpK(cR1zU3qU0000< KMNUMnLSTYoA~SLT literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/bdwn.png b/external/epid/doc/html/bdwn.png new file mode 100644 index 0000000000000000000000000000000000000000..940a0b950443a0bb1b216ac03c45b8a16c955452 GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)H!3HEvS)PKZC{Gv1kP61Pb5HX&C2wk~_T + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/bignum.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
bignum.c File Reference
+
+
+ +

Big number implementation. +More...

+
#include "epid/common/math/bignum.h"
+#include "epid/common/math/bignum-internal.h"
+#include "epid/common/memory.h"
+#include "ext/ipp/include/ippcp.h"
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewBigNum (size_t data_size_bytes, BigNum **bignum)
 Constructs a new BigNum. More...
 
void DeleteBigNum (BigNum **bignum)
 Deletes a previously allocated BigNum. More...
 
EpidStatus ReadBigNum (void const *bn_str, size_t strlen, BigNum *bn)
 Deserializes a BigNum from a string. More...
 
EpidStatus WriteBigNum (BigNum const *bn, size_t strlen, void const *bn_str)
 Serializes a BigNum to a string. More...
 
+int OctStr2Bnu (uint32_t *bnu_ptr, void const *octstr_ptr, int octstr_len)
 convert octet string into "big number unsigned" representation
 
EpidStatus BigNumAdd (BigNum const *a, BigNum const *b, BigNum *r)
 Adds two BigNum values. More...
 
EpidStatus BigNumSub (BigNum const *a, BigNum const *b, BigNum *r)
 Subtracts two BigNum values. More...
 
EpidStatus BigNumMul (BigNum const *a, BigNum const *b, BigNum *r)
 Multiplies two BigNum values. More...
 
EpidStatus BigNumMod (BigNum const *a, BigNum const *b, BigNum *r)
 Computes modular reduction for BigNum value by specified modulus. More...
 
+

Detailed Description

+

Big number implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/bignum_8h.html b/external/epid/doc/html/bignum_8h.html new file mode 100644 index 0000000000..ac66718f6c --- /dev/null +++ b/external/epid/doc/html/bignum_8h.html @@ -0,0 +1,124 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/bignum.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
bignum.h File Reference
+
+
+ +

Big number interface. +More...

+
#include <stddef.h>
+#include <stdint.h>
+#include "epid/common/errors.h"
+#include "epid/common/types.h"
+
+ + + + +

+Typedefs

+typedef struct BigNum BigNum
 Internal representation of large numbers.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewBigNum (size_t data_size_bytes, BigNum **bignum)
 Constructs a new BigNum. More...
 
void DeleteBigNum (BigNum **bignum)
 Deletes a previously allocated BigNum. More...
 
EpidStatus ReadBigNum (void const *bn_str, size_t strlen, BigNum *bn)
 Deserializes a BigNum from a string. More...
 
EpidStatus WriteBigNum (BigNum const *bn, size_t strlen, void const *bn_str)
 Serializes a BigNum to a string. More...
 
EpidStatus BigNumAdd (BigNum const *a, BigNum const *b, BigNum *r)
 Adds two BigNum values. More...
 
EpidStatus BigNumSub (BigNum const *a, BigNum const *b, BigNum *r)
 Subtracts two BigNum values. More...
 
EpidStatus BigNumMul (BigNum const *a, BigNum const *b, BigNum *r)
 Multiplies two BigNum values. More...
 
EpidStatus BigNumMod (BigNum const *a, BigNum const *b, BigNum *r)
 Computes modular reduction for BigNum value by specified modulus. More...
 
+

Detailed Description

+

Big number interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/bitsupplier_8h.html b/external/epid/doc/html/bitsupplier_8h.html new file mode 100644 index 0000000000..c89b3b2043 --- /dev/null +++ b/external/epid/doc/html/bitsupplier_8h.html @@ -0,0 +1,92 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/bitsupplier.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
bitsupplier.h File Reference
+
+
+ +

Random data supplier interface. +More...

+ + + + + +

+Typedefs

typedef int(__STDCALL * BitSupplier) (unsigned int *rand_data, int num_bits, void *user_data)
 Generates random data. More...
 
+

Detailed Description

+

Random data supplier interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/building__sdk_8dox.html b/external/epid/doc/html/building__sdk_8dox.html new file mode 100644 index 0000000000..6e2f6fe4bb --- /dev/null +++ b/external/epid/doc/html/building__sdk_8dox.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: doc/docsrc/building_sdk.dox File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
doc/docsrc/building_sdk.dox File Reference
+
+
+ +

This file is used by Doxygen to generate documentation. +More...

+

Detailed Description

+

This file is used by Doxygen to generate documentation.

+
+
+ + + + + diff --git a/external/epid/doc/html/check__privrl__entry_8c.html b/external/epid/doc/html/check__privrl__entry_8c.html new file mode 100644 index 0000000000..77506853ea --- /dev/null +++ b/external/epid/doc/html/check__privrl__entry_8c.html @@ -0,0 +1,93 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/verifier/check_privrl_entry.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
check_privrl_entry.c File Reference
+
+
+ +

EpidCheckPrivRlEntry implementation. +More...

+ + + + + +

+Functions

EpidStatus EpidCheckPrivRlEntry (VerifierCtx const *ctx, BasicSignature const *sig, FpElemStr const *f)
 Verifies a signature has not been revoked in the private key based revocation list. More...
 
+

Detailed Description

+

EpidCheckPrivRlEntry implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/classes.html b/external/epid/doc/html/classes.html new file mode 100644 index 0000000000..1a92e1c897 --- /dev/null +++ b/external/epid/doc/html/classes.html @@ -0,0 +1,113 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Structure Index + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Data Structure Index
+
+
+
A | B | C | E | F | G | I | J | M | N | O | P | S | V
+ + + + + + + + + + + + + + + + + + + + +
  A  
+
Epid2Params_   
  G  
+
MemberPrecomp   PrivKey   
EpidCaCertificate   MembershipCredential   PrivKey_   
AllowedBasename   EpidFileHeader   G1ElemStr   
  N  
+
PrivRl   
  B  
+
EpidGroupPubKeyCertificate   G2ElemStr   
  S  
+
EpidSignature   GroupPubKey   NrProof   
BasicSignature   ErrorTextEntry   GroupPubKey_   NrVerifyCommitValues   Sha256Digest   
BigNumStr   
  F  
+
GroupRl   
  O  
+
SigRl   
  C  
+
GtElemStr   SigRlEntry   
FpElemStr   
  I  
+
OctStr128   Stack   
CommitValues   Fq12ElemDat   OctStr16   
  V  
+
CompressedPrivKey   Fq12ElemStr   IPrivKey   OctStr256   
  E  
+
Fq2ElemDat   
  J  
+
OctStr32   VerifierCtx   
Fq2ElemStr   OctStr512   VerifierPrecomp   
EcdsaPrivateKey   Fq6ElemDat   JoinPCommitValues   OctStr64   VerifierRl   
EcdsaPublicKey   Fq6ElemStr   JoinRequest   OctStr8   
EcdsaSignature   FqElemDat   
  M  
+
  P  
+
Epid2Params   FqElemStr   
MemberCtx   PreComputedSignature   
+
A | B | C | E | F | G | I | J | M | N | O | P | S | V
+
+
+ + + + + diff --git a/external/epid/doc/html/closed.png b/external/epid/doc/html/closed.png new file mode 100644 index 0000000000000000000000000000000000000000..98cc2c909da37a6df914fbf67780eebd99c597f5 GIT binary patch literal 132 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>1|%O$WD@{V-kvUwAr*{o@8{^CZMh(5KoB^r_<4^zF@3)Cp&&t3hdujKf f*?bjBoY!V+E))@{xMcbjXe@)LtDnm{r-UW|*e5JT literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/commitment_8c.html b/external/epid/doc/html/commitment_8c.html new file mode 100644 index 0000000000..13a543a28d --- /dev/null +++ b/external/epid/doc/html/commitment_8c.html @@ -0,0 +1,98 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/commitment.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
commitment.c File Reference
+
+
+ +

Commitment hash implementation. +More...

+
#include <limits.h>
+#include "epid/common/commitment.h"
+#include "epid/common/memory.h"
+#include "epid/common/epid2params_ate.inc"
+
+ + + + + + + +

+Functions

EpidStatus SetCalculatedCommitValues (G1ElemStr const *B, G1ElemStr const *K, G1ElemStr const *T, EcPoint const *R1, EcGroup *G1, FfElement const *R2, FiniteField *GT, CommitValues *values)
 Set CommitValues structure fields calculated in algorithm. More...
 
EpidStatus CalculateCommitmentHash (CommitValues const *values, FiniteField *Fp, HashAlg hash_alg, void const *msg, size_t msg_len, FfElement *c)
 Calculate Fp.hash(t3 || m) for Sign and Verfiy algorithms. More...
 
+

Detailed Description

+

Commitment hash implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/commitment_8h.html b/external/epid/doc/html/commitment_8h.html new file mode 100644 index 0000000000..fc9e54f8c4 --- /dev/null +++ b/external/epid/doc/html/commitment_8h.html @@ -0,0 +1,108 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/commitment.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
commitment.h File Reference
+
+
+ +

Commitment hash interface. +More...

+ + + + + +

+Data Structures

struct  CommitValues
 Storage for values to create commitment in Sign and Verify algorithms. More...
 
+ + + + + + + + + + +

+Functions

EpidStatus SetKeySpecificCommitValues (GroupPubKey const *pub_key, CommitValues *values)
 Set group public key related fields from CommitValues structure. More...
 
EpidStatus SetCalculatedCommitValues (G1ElemStr const *B, G1ElemStr const *K, G1ElemStr const *T, EcPoint const *R1, EcGroup *G1, FfElement const *R2, FiniteField *GT, CommitValues *values)
 Set CommitValues structure fields calculated in algorithm. More...
 
EpidStatus CalculateCommitmentHash (CommitValues const *values, FiniteField *Fp, HashAlg hash_alg, void const *msg, size_t msg_len, FfElement *c)
 Calculate Fp.hash(t3 || m) for Sign and Verfiy algorithms. More...
 
+

Detailed Description

+

Commitment hash interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/decompress__privkey_8c.html b/external/epid/doc/html/decompress__privkey_8c.html new file mode 100644 index 0000000000..b34aa82ea7 --- /dev/null +++ b/external/epid/doc/html/decompress__privkey_8c.html @@ -0,0 +1,124 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/member/decompress_privkey.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
decompress_privkey.c File Reference
+
+
+ +

EpidDecompressPrivKey implementation. +More...

+
#include "epid/member/api.h"
+#include "epid/common/memory.h"
+#include "epid/common/epid2params.h"
+#include "epid/common/math/bignum-internal.h"
+#include "epid/common/math/hash.h"
+#include "epid/member/privkey.h"
+
+ + + + +

+Macros

#define BREAK_ON_EPID_ERROR(ret)
 Handle Intel(R) EPID Error with Break. More...
 
+ + + + +

+Functions

EpidStatus EpidDecompressPrivKey (GroupPubKey const *pub_key, CompressedPrivKey const *compressed_privkey, PrivKey *priv_key)
 Decompresses compressed member private key. More...
 
+

Detailed Description

+

EpidDecompressPrivKey implementation.

+

Macro Definition Documentation

+ +
+
+ + + + + + + + +
#define BREAK_ON_EPID_ERROR( ret)
+
+Value:
if (kEpidNoErr != (ret)) { \
break; \
}
no error
Definition: errors.h:41
+
+

Handle Intel(R) EPID Error with Break.

+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/dir_02c945662023679b89476bd7126bc985.html b/external/epid/doc/html/dir_02c945662023679b89476bd7126bc985.html new file mode 100644 index 0000000000..34c3526226 --- /dev/null +++ b/external/epid/doc/html/dir_02c945662023679b89476bd7126bc985.html @@ -0,0 +1,111 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/verifier Directory Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
verifier Directory Reference
+
+
+ +

Verifier functionality.

+ +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  api.h
 Intel(R) EPID SDK verifier API.
 
file  check_privrl_entry.c
 EpidCheckPrivRlEntry implementation.
 
file  context.c
 Verifier context implementation.
 
file  context.h
 Verifier context interface.
 
file  nrverify.c
 NrVerfy implementation.
 
file  sigs_linked.c
 AreSigsLinked implementation.
 
file  verify.c
 Verify implementation.
 
file  verifybasic.c
 VerifyBasicSig implementation.
 
+

Detailed Description

+

Verifier functionality.

+
+
+ + + + + diff --git a/external/epid/doc/html/dir_12b90d9c027aaf878a834df729679a56.html b/external/epid/doc/html/dir_12b90d9c027aaf878a834df729679a56.html new file mode 100644 index 0000000000..9031b5cc6b --- /dev/null +++ b/external/epid/doc/html/dir_12b90d9c027aaf878a834df729679a56.html @@ -0,0 +1,96 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid Directory Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
epid Directory Reference
+
+
+ +

Core Intel® EPID functionality.

+ +More...

+ + + + + + + + + + + +

+Directories

directory  common
 Common code shared between core sub-components.
 
directory  member
 Member functionality.
 
directory  verifier
 Verifier functionality.
 
+

Detailed Description

+

Core Intel® EPID functionality.

+
+
+ + + + + diff --git a/external/epid/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html b/external/epid/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html new file mode 100644 index 0000000000..dd82485b94 --- /dev/null +++ b/external/epid/doc/html/dir_512d3e62841a8535b716ec4cf8b9e950.html @@ -0,0 +1,123 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/member Directory Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
member Directory Reference
+
+
+ +

Member functionality.

+ +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  api.h
 Intel(R) EPID SDK member API.
 
file  context.c
 Member context implementation.
 
file  context.h
 Member context interface.
 
file  decompress_privkey.c
 EpidDecompressPrivKey implementation.
 
file  get_sigsize.c
 EpidGetSigSize implementation.
 
file  nr_prove.c
 EpidNrProve implementation.
 
file  presig.c
 EpidComputePreSig implementation.
 
file  privkey.c
 Private key implementation.
 
file  privkey.h
 Private key private interface.
 
file  request_join.c
 EpidRequestJoin implementation.
 
file  sign.c
 EpidSign implementation.
 
file  signbasic.c
 EpidSignBasic implementation.
 
+

Detailed Description

+

Member functionality.

+
+
+ + + + + diff --git a/external/epid/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html b/external/epid/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html new file mode 100644 index 0000000000..7a85522717 --- /dev/null +++ b/external/epid/doc/html/dir_f169ebf8da29290a918fa4b3f7151050.html @@ -0,0 +1,132 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math Directory Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
math Directory Reference
+
+
+ +

Math primitives.

+ +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  bignum.c
 Big number implementation.
 
file  bignum.h
 Big number interface.
 
file  ecdsa.h
 Ecdsa interface.
 
file  ecdsa_sign.c
 EcdsaSignBuffer implementation.
 
file  ecdsa_verify.c
 EcdsaVerifyBuffer implementation.
 
file  ecgroup.c
 Elliptic curve group implementation.
 
file  ecgroup.h
 Elliptic curve group interface.
 
file  finitefield.c
 Finite field implementation.
 
file  finitefield.h
 Finite field interface.
 
file  hash.h
 Hash primitives.
 
file  pairing.c
 Pairing implementation.
 
file  pairing.h
 Pairing interface.
 
file  printutils.c
 Print helper implementation.
 
file  printutils.h
 Print helper interface.
 
file  sha256.c
 SHA256 implementation.
 
+

Detailed Description

+

Math primitives.

+
+
+ + + + + diff --git a/external/epid/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html b/external/epid/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html new file mode 100644 index 0000000000..9ce1d0c21e --- /dev/null +++ b/external/epid/doc/html/dir_f6bef457d5f671b6e774bfccc16651f6.html @@ -0,0 +1,156 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common Directory Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
common Directory Reference
+
+
+ +

Common code shared between core sub-components.

+ +More...

+ + + + + +

+Directories

directory  math
 Math primitives.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Files

file  bitsupplier.h
 Random data supplier interface.
 
file  commitment.c
 Commitment hash implementation.
 
file  commitment.h
 Commitment hash interface.
 
file  endian_convert.h
 Endianness conversion interface.
 
file  epid2params.c
 Intel(R) EPID 2.0 constant parameters implementation.
 
file  epid2params.h
 Intel(R) EPID 2.0 constant parameters interface.
 
file  epid2params_ate.inc
 Intel(R) EPID 2.0 constant parameters data.
 
file  errors.c
 Error reporting implementation.
 
file  errors.h
 Error reporting.
 
file  file_parser.c
 Implementation of issuer material file parsing utilities.
 
file  file_parser.h
 Epid issuer material parsing utilities.
 
file  grouppubkey.c
 Group public key implementation.
 
file  grouppubkey.h
 Group public key interface.
 
file  memory.c
 Memory access implementation.
 
file  memory.h
 Memory access interface.
 
file  sigrlvalid.c
 SigRl validity checking implementation.
 
file  sigrlvalid.h
 SigRl validity checking interface.
 
file  stack.c
 Stack container implementation.
 
file  stack.h
 Stack container interface.
 
file  stdtypes.h
 C99 standard data types.
 
file  types.h
 SDK data types.
 
+

Detailed Description

+

Common code shared between core sub-components.

+
+
+ + + + + diff --git a/external/epid/doc/html/doc.png b/external/epid/doc/html/doc.png new file mode 100644 index 0000000000000000000000000000000000000000..17edabff95f7b8da13c9516a04efe05493c29501 GIT binary patch literal 746 zcmV7=@pnbNXRFEm&G8P!&WHG=d)>K?YZ1bzou)2{$)) zumDct!>4SyxL;zgaG>wy`^Hv*+}0kUfCrz~BCOViSb$_*&;{TGGn2^x9K*!Sf0=lV zpP=7O;GA0*Jm*tTYj$IoXvimpnV4S1Z5f$p*f$Db2iq2zrVGQUz~yq`ahn7ck(|CE z7Gz;%OP~J6)tEZWDzjhL9h2hdfoU2)Nd%T<5Kt;Y0XLt&<@6pQx!nw*5`@bq#?l*?3z{Hlzoc=Pr>oB5(9i6~_&-}A(4{Q$>c>%rV&E|a(r&;?i5cQB=} zYSDU5nXG)NS4HEs0it2AHe2>shCyr7`6@4*6{r@8fXRbTA?=IFVWAQJL&H5H{)DpM#{W(GL+Idzf^)uRV@oB8u$ z8v{MfJbTiiRg4bza<41NAzrl{=3fl_D+$t+^!xlQ8S}{UtY`e z;;&9UhyZqQRN%2pot{*Ei0*4~hSF_3AH2@fKU!$NSflS>{@tZpDT4`M2WRTTVH+D? z)GFlEGGHe?koB}i|1w45!BF}N_q&^HJ&-tyR{(afC6H7|aml|tBBbv}55C5DNP8p3 z)~jLEO4Z&2hZmP^i-e%(@d!(E|KRafiU8Q5u(wU((j8un3OR*Hvj+t literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/doxygen.css b/external/epid/doc/html/doxygen.css new file mode 100644 index 0000000000..1425ec530d --- /dev/null +++ b/external/epid/doc/html/doxygen.css @@ -0,0 +1,1475 @@ +/* The standard CSS for doxygen 1.8.11 */ + +body, table, div, p, dl { + font: 400 14px/22px Roboto,sans-serif; +} + +/* @group Heading Levels */ + +h1.groupheader { + font-size: 150%; +} + +.title { + font: 400 14px/28px Roboto,sans-serif; + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2.groupheader { + border-bottom: 1px solid #879ECB; + color: #354C7B; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 4px 6px; + margin: 4px 8px 4px 2px; + background-color: #FBFCFD; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +div.ah, span.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 8px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; +} + +.memname { + font-weight: bold; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; + border-top-left-radius: 4px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; + +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 10px 2px 10px; + background-color: #FBFCFD; + border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: #FFFFFF; + /* opera specific markup */ + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} +.paramname code { + line-height: 14px; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.even { + padding-left: 6px; + background-color: #F7F8FB; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; +} + +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + /*width: 100%;*/ + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + /*width: 100%;*/ +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + background-position: 0 -5px; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +dl +{ + padding: 0 0 0 10px; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ +dl.section +{ + margin-left: 0px; + padding-left: 0px; +} + +dl.note +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #00D000; +} + +dl.deprecated +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #505050; +} + +dl.todo +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #00C0E0; +} + +dl.test +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #3030E0; +} + +dl.bug +{ + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; + border-color: #C08050; +} + +dl.section dd { + margin-bottom: 6px; +} + + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +div.toc li { + background: url("bdwn.png") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + white-space: nowrap; + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font: 12px/16px Roboto,sans-serif; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: #ffffff; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before { + border-top-color: #808080; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: #ffffff; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: #808080; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: #ffffff; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: #ffffff; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + diff --git a/external/epid/doc/html/doxygen.png b/external/epid/doc/html/doxygen.png new file mode 100644 index 0000000000000000000000000000000000000000..3ff17d807fd8aa003bed8bb2a69e8f0909592fd1 GIT binary patch literal 3779 zcmV;!4m|ORP)tMIv#Q0*~7*`IBSO7_x;@a8#Zk6_PeKR_s92J&)(m+);m9Iz3blw)z#Gi zP!9lj4$%+*>Hz@HCmM9L9|8c+0u=!H$O3?R0Kgx|#WP<6fKfC8fM-CQZT|_r@`>VO zX^Hgb|9cJqpdJA5$MCEK`F_2@2Y@s>^+;pF`~jdI0Pvr|vl4`=C)EH@1IFe7pdJ8F zH(qGi004~QnF)Ggga~8v08kGAs2hKTATxr7pwfNk|4#_AaT>w8P6TV+R2kbS$v==} zAjf`s0g#V8lB+b3)5oEI*q+{Yt$MZDruD2^;$+(_%Qn+%v0X-bJO=;@kiJ^ygLBnC z?1OVv_%aex1M@jKU|Z~$eI?PoF4Vj>fDzyo zAiLfpXY*a^Sj-S5D0S3@#V$sRW)g)_1e#$%8xdM>Jm7?!h zu0P2X=xoN>^!4DoPRgph2(2va07yfpXF+WH7EOg1GY%Zn z7~1A<(z7Q$ktEXhW_?GMpHp9l_UL18F3KOsxu81pqoBiNbFSGsof-W z6~eloMoz=4?OOnl2J268x5rOY`dCk0us(uS#Ud4yqOr@?=Q57a}tit|BhY>}~frH1sP`ScHS_d)oqH^lYy zZ%VP`#10MlE~P?cE(%(#(AUSv_T{+;t@$U}El}(1ig`vZo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Z=f^4+u=!lA|#r%1`WB0-6*3BL#at`47#ebPpR|D1b)3BjT34nYY z%Ds%d?5$|{LgOIaRO{{oC&RK`O91$fqwM0(C_TALcozu*fWHb%%q&p-q{_8*2Zsi^ zh1ZCnr^UYa;4vQEtHk{~zi>wwMC5o{S=$P0X681y`SXwFH?Ewn{x-MOZynmc)JT5v zuHLwh;tLfxRrr%|k370}GofLl7thg>ACWWY&msqaVu&ry+`7+Ss>NL^%T1|z{IGMA zW-SKl=V-^{(f!Kf^#3(|T2W47d(%JVCI4JgRrT1pNz>+ietmFToNv^`gzC@&O-)+i zPQ~RwK8%C_vf%;%e>NyTp~dM5;!C|N0Q^6|CEb7Bw=Vz~$1#FA;Z*?mKSC)Hl-20s t8QyHj(g6VK0RYbl8UjE)0O0w=e*@m04r>stuEhWV002ovPDHLkV1hl;dM*F} literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/dynsections.js b/external/epid/doc/html/dynsections.js new file mode 100644 index 0000000000..85e1836909 --- /dev/null +++ b/external/epid/doc/html/dynsections.js @@ -0,0 +1,97 @@ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} + +function toggleLevel(level) +{ + $('table.directory tr').each(function() { + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (l + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/ecdsa.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecdsa.h File Reference
+
+
+ +

Ecdsa interface. +More...

+
#include <stddef.h>
+#include "epid/common/errors.h"
+#include "epid/common/types.h"
+#include "epid/common/bitsupplier.h"
+
+ + + + + + + +

+Functions

EpidStatus EcdsaVerifyBuffer (void const *buf, size_t buf_len, EcdsaPublicKey const *pubkey, EcdsaSignature const *sig)
 Verifies authenticity of a digital signature over a buffer. More...
 
EpidStatus EcdsaSignBuffer (void const *buf, size_t buf_len, EcdsaPrivateKey const *privkey, BitSupplier rnd_func, void *rnd_param, EcdsaSignature *sig)
 Creates ECDSA signature of buffer. More...
 
+

Detailed Description

+

Ecdsa interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/ecdsa__sign_8c.html b/external/epid/doc/html/ecdsa__sign_8c.html new file mode 100644 index 0000000000..a94a4c26c3 --- /dev/null +++ b/external/epid/doc/html/ecdsa__sign_8c.html @@ -0,0 +1,105 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/ecdsa_sign.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecdsa_sign.c File Reference
+
+
+ +

EcdsaSignBuffer implementation. +More...

+
#include "epid/common/math/ecdsa.h"
+#include "epid/common/math/bignum.h"
+#include "epid/common/math/bignum-internal.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/memory.h"
+#include "ext/ipp/include/ippcp.h"
+
+ + + + +

+Macros

+#define EPHKEYGEN_WATCHDOG   (10)
 The number of attempts to generate ephemeral key pair.
 
+ + + + +

+Functions

EpidStatus EcdsaSignBuffer (void const *buf, size_t buf_len, EcdsaPrivateKey const *privkey, BitSupplier rnd_func, void *rnd_param, EcdsaSignature *sig)
 Creates ECDSA signature of buffer. More...
 
+

Detailed Description

+

EcdsaSignBuffer implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/ecdsa__verify_8c.html b/external/epid/doc/html/ecdsa__verify_8c.html new file mode 100644 index 0000000000..bb97f4f4c2 --- /dev/null +++ b/external/epid/doc/html/ecdsa__verify_8c.html @@ -0,0 +1,133 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/ecdsa_verify.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecdsa_verify.c File Reference
+
+
+ +

EcdsaVerifyBuffer implementation. +More...

+
#include "epid/common/math/ecdsa.h"
+#include "epid/common/math/bignum.h"
+#include "epid/common/math/bignum-internal.h"
+#include "epid/common/memory.h"
+#include "ext/ipp/include/ippcp.h"
+
+ + + + +

+Macros

#define BREAK_ON_IPP_ERROR(sts, ret)
 Handle Ipp Errors with Break. More...
 
+ + + + +

+Functions

EpidStatus EcdsaVerifyBuffer (void const *buf, size_t buf_len, EcdsaPublicKey const *pubkey, EcdsaSignature const *sig)
 Verifies authenticity of a digital signature over a buffer. More...
 
+

Detailed Description

+

EcdsaVerifyBuffer implementation.

+

Macro Definition Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
#define BREAK_ON_IPP_ERROR( sts,
 ret 
)
+
+Value:
{ \
IppStatus temp_sts = (sts); \
if (ippStsNoErr != temp_sts) { \
(ret) = kEpidMathErr; \
break; \
} \
}
internal math error
Definition: errors.h:53
+
+

Handle Ipp Errors with Break.

+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/ecgroup_8c.html b/external/epid/doc/html/ecgroup_8c.html new file mode 100644 index 0000000000..a59852ba8f --- /dev/null +++ b/external/epid/doc/html/ecgroup_8c.html @@ -0,0 +1,222 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/ecgroup.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecgroup.c File Reference
+
+
+ +

Elliptic curve group implementation. +More...

+
#include <string.h>
+#include "epid/common/math/bignum-internal.h"
+#include "epid/common/math/ecgroup-internal.h"
+#include "epid/common/math/ecgroup.h"
+#include "epid/common/math/finitefield-internal.h"
+#include "epid/common/memory.h"
+#include "ext/ipp/include/ippcp.h"
+#include "ext/ipp/include/ippcpepid.h"
+
+ + + + +

+Macros

+#define EPID_ECHASH_WATCHDOG   (50)
 The number of attempts to hash a message to an element.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewEcGroup (FiniteField const *ff, FfElement const *a, FfElement const *b, FfElement const *x, FfElement const *y, BigNum const *order, BigNum const *cofactor, EcGroup **g)
 Constructs a new EcGroup. More...
 
void DeleteEcGroup (EcGroup **g)
 Deletes a previously allocated EcGroup. More...
 
EpidStatus NewEcPoint (EcGroup const *g, EcPoint **p)
 Creates a new EcPoint. More...
 
void DeleteEcPoint (EcPoint **p)
 Deletes a previously allocated EcPoint. More...
 
EpidStatus eccontains (EcGroup *g, void const *p_str, size_t strlen, EcPoint *p, bool *in_group)
 Check and initialize element if it is in elliptic curve group. More...
 
EpidStatus ReadEcPoint (EcGroup *g, void const *p_str, size_t strlen, EcPoint *p)
 Deserializes an EcPoint from a string. More...
 
EpidStatus WriteEcPoint (EcGroup *g, EcPoint const *p, void *p_str, size_t strlen)
 Serializes an EcPoint to a string. More...
 
EpidStatus EcMul (EcGroup *g, EcPoint const *a, EcPoint const *b, EcPoint *r)
 Multiplies two elements in an elliptic curve group. More...
 
EpidStatus EcExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
 Raises a point in an elliptic curve group to a power. More...
 
EpidStatus EcSscmExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
 Software side-channel mitigated implementation of EcExp. More...
 
EpidStatus EcMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
 Multi-exponentiates elements in elliptic curve group. More...
 
EpidStatus EcSscmMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
 Software side-channel mitigated implementation of EcMultiExp. More...
 
EpidStatus EcGetRandom (EcGroup *g, BitSupplier rnd_func, void *rnd_func_param, EcPoint *r)
 Generates a random element from an elliptic curve group. More...
 
EpidStatus EcInGroup (EcGroup *g, void const *p_str, size_t strlen, bool *in_group)
 Checks if a point is in an elliptic curve group. More...
 
EpidStatus EcHash (EcGroup *g, void const *msg, size_t msg_len, HashAlg hash_alg, EcPoint *r)
 Hashes an arbitrary message to an element in an elliptic curve group. More...
 
EpidStatus EcMakePoint (EcGroup *g, FfElement const *x, EcPoint *r)
 Sets an EcPoint variable to a point on a curve. More...
 
EpidStatus EcInverse (EcGroup *g, EcPoint const *p, EcPoint *r)
 Computes the additive inverse of an EcPoint. More...
 
EpidStatus EcIsEqual (EcGroup *g, EcPoint const *a, EcPoint const *b, bool *is_equal)
 Checks if two EcPoints are equal. More...
 
EpidStatus EcIsIdentity (EcGroup *g, EcPoint const *p, bool *is_identity)
 Checks if an EcPoint is the identity element. More...
 
+

Detailed Description

+

Elliptic curve group implementation.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus eccontains (EcGroupg,
void const * p_str,
size_t strlen,
EcPointp,
boolin_group 
)
+
+ +

Check and initialize element if it is in elliptic curve group.

+

This is internal function. Takes a value p as input. If p is indeed an element of g, it outputs true, otherwise, it outputs false.

+

This is only used to check if input buffer are actually valid elements in group. If p is in g, this fills p and initializes it to internal FfElement format.

+
Parameters
+ + + + + + +
[in]gThe eliptic curve group in which to perform the check
[in]p_strSerialized eliptic curve group element to check
[in]strlenThe size of p_str in bytes.
[out]pDeserialized value of p_str
[out]in_groupResult of the check
+
+
+
Returns
EpidStatus
+
See also
NewEcPoint
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/ecgroup_8h.html b/external/epid/doc/html/ecgroup_8h.html new file mode 100644 index 0000000000..ebb7d5d214 --- /dev/null +++ b/external/epid/doc/html/ecgroup_8h.html @@ -0,0 +1,159 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/ecgroup.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecgroup.h File Reference
+
+
+ +

Elliptic curve group interface. +More...

+ + + + + + + + +

+Typedefs

+typedef struct EcGroup EcGroup
 Elliptic curve group over finite field.
 
+typedef struct EcPoint EcPoint
 Point on elliptic curve over finite field.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewEcGroup (FiniteField const *ff, FfElement const *a, FfElement const *b, FfElement const *x, FfElement const *y, BigNum const *order, BigNum const *cofactor, EcGroup **g)
 Constructs a new EcGroup. More...
 
void DeleteEcGroup (EcGroup **g)
 Deletes a previously allocated EcGroup. More...
 
EpidStatus NewEcPoint (EcGroup const *g, EcPoint **p)
 Creates a new EcPoint. More...
 
void DeleteEcPoint (EcPoint **p)
 Deletes a previously allocated EcPoint. More...
 
EpidStatus ReadEcPoint (EcGroup *g, void const *p_str, size_t strlen, EcPoint *p)
 Deserializes an EcPoint from a string. More...
 
EpidStatus WriteEcPoint (EcGroup *g, EcPoint const *p, void *p_str, size_t strlen)
 Serializes an EcPoint to a string. More...
 
EpidStatus EcMul (EcGroup *g, EcPoint const *a, EcPoint const *b, EcPoint *r)
 Multiplies two elements in an elliptic curve group. More...
 
EpidStatus EcExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
 Raises a point in an elliptic curve group to a power. More...
 
EpidStatus EcSscmExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
 Software side-channel mitigated implementation of EcExp. More...
 
EpidStatus EcMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
 Multi-exponentiates elements in elliptic curve group. More...
 
EpidStatus EcSscmMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
 Software side-channel mitigated implementation of EcMultiExp. More...
 
EpidStatus EcGetRandom (EcGroup *g, BitSupplier rnd_func, void *rnd_func_param, EcPoint *r)
 Generates a random element from an elliptic curve group. More...
 
EpidStatus EcInGroup (EcGroup *g, void const *p_str, size_t strlen, bool *in_group)
 Checks if a point is in an elliptic curve group. More...
 
EpidStatus EcHash (EcGroup *g, void const *msg, size_t msg_len, HashAlg hash_alg, EcPoint *r)
 Hashes an arbitrary message to an element in an elliptic curve group. More...
 
EpidStatus EcMakePoint (EcGroup *g, FfElement const *x, EcPoint *r)
 Sets an EcPoint variable to a point on a curve. More...
 
EpidStatus EcInverse (EcGroup *g, EcPoint const *p, EcPoint *r)
 Computes the additive inverse of an EcPoint. More...
 
EpidStatus EcIsEqual (EcGroup *g, EcPoint const *a, EcPoint const *b, bool *is_equal)
 Checks if two EcPoints are equal. More...
 
EpidStatus EcIsIdentity (EcGroup *g, EcPoint const *p, bool *is_identity)
 Checks if an EcPoint is the identity element. More...
 
+

Detailed Description

+

Elliptic curve group interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/endian__convert_8h.html b/external/epid/doc/html/endian__convert_8h.html new file mode 100644 index 0000000000..5f089eb45b --- /dev/null +++ b/external/epid/doc/html/endian__convert_8h.html @@ -0,0 +1,92 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/endian_convert.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
endian_convert.h File Reference
+
+
+ +

Endianness conversion interface. +More...

+
#include <stdint.h>
+
+ + + + +

+Macros

#define ntohl(u32)
 Macros to transform oct str 32 into uint_32. More...
 
+

Detailed Description

+

Endianness conversion interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/epid2params_8c.html b/external/epid/doc/html/epid2params_8c.html new file mode 100644 index 0000000000..8d24884ccc --- /dev/null +++ b/external/epid/doc/html/epid2params_8c.html @@ -0,0 +1,98 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/epid2params.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
epid2params.c File Reference
+
+
+ +

Intel(R) EPID 2.0 constant parameters implementation. +More...

+ + + + + + + + +

+Functions

+EpidStatus NewFq6 (Epid2Params const *param, FiniteField *Fq2, FfElement *xi, FiniteField **Fq6)
 create a new Finite Field Fq6
 
void DeleteEpid2Params (Epid2Params_ **epid_params)
 Deallocates storage for internal representation of Epid2Params. More...
 
+

Detailed Description

+

Intel(R) EPID 2.0 constant parameters implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/epid2params_8h.html b/external/epid/doc/html/epid2params_8h.html new file mode 100644 index 0000000000..58c8eb3451 --- /dev/null +++ b/external/epid/doc/html/epid2params_8h.html @@ -0,0 +1,105 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/epid2params.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
epid2params.h File Reference
+
+
+ +

Intel(R) EPID 2.0 constant parameters interface. +More...

+ + + + + +

+Data Structures

struct  Epid2Params_
 Internal representation of Epid2Params. More...
 
+ + + + + + + +

+Functions

EpidStatus CreateEpid2Params (Epid2Params_ **params)
 Constructs the internal representation of Epid2Params. More...
 
void DeleteEpid2Params (Epid2Params_ **epid_params)
 Deallocates storage for internal representation of Epid2Params. More...
 
+

Detailed Description

+

Intel(R) EPID 2.0 constant parameters interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/epid2params__ate_8inc.html b/external/epid/doc/html/epid2params__ate_8inc.html new file mode 100644 index 0000000000..b7168eae1f --- /dev/null +++ b/external/epid/doc/html/epid2params__ate_8inc.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/epid2params_ate.inc File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
epid2params_ate.inc File Reference
+
+
+ +

Intel(R) EPID 2.0 constant parameters data. +More...

+

Detailed Description

+

Intel(R) EPID 2.0 constant parameters data.

+
+
+ + + + + diff --git a/external/epid/doc/html/epid__overview_8dox.html b/external/epid/doc/html/epid__overview_8dox.html new file mode 100644 index 0000000000..eefba2234f --- /dev/null +++ b/external/epid/doc/html/epid__overview_8dox.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: doc/docsrc/epid_overview.dox File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
doc/docsrc/epid_overview.dox File Reference
+
+
+ +

This file is used by Doxygen to generate documentation. +More...

+

Detailed Description

+

This file is used by Doxygen to generate documentation.

+
+
+ + + + + diff --git a/external/epid/doc/html/epid_diagram_high_level_interaction.png b/external/epid/doc/html/epid_diagram_high_level_interaction.png new file mode 100644 index 0000000000000000000000000000000000000000..1013eb05f21ed8d32711372cea3756ffdbe79830 GIT binary patch literal 25513 zcmaI8cQl-D)HOW12+>OrL=c?_L-gKT^cF(2=)LzEL=U1z8NCal6GV#^QHC&j@1nQ& zlHc=ue|+y+@2q4kW#%r|eXeu%*?S)ms>(7rSmam`2n0t?R#FWDL5c_e3o((wPcGix zR6!s#5IIRP4UdeSR$m_q?bI`0Y*^;$gJ?!w)ukXACOWSC6Vn`>HRUQv*=Gn;eJ^M^ ztfoA_>Nmk|a2a0J#Mk&FJ7x+G+NhMeKk3qH$tI~}bdPnIOl!#-1nUe=D|&7B>d48h zDYv|)*@i;U1$PTJF5Xc}Rh#K^yiAMtZOit%jF5S`Zs0ejGSxWjT2acJsf>b&id>90 z|LiLg9ww?9M75R%PnI5u=OJ>S2EqUP8%*4cSEB~%yTZ=9h#|{y)ve2Ised12?fE@A zuQap~SZ%GX+&rcOI*8x`-m#$VRIfdm}4i#!atj@b&GibAy_K}FV0*qURjDRB|x-`9zj3jR`ZQd_o^ z-=gKB?yThMtWa6uV`olFwLwC@k%eTW)DjZiO27g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lk`q zSk6wxa6=+bSajI?WKr4<{jKq!qj{!zE@**kaqZIR_BUZauY0H?s(in>mE3_Qn%t(F za0{MC?k4C(T8C-(0d@QtU1H{;QNN2u>_PO`74Q5hCg0S3O-hJ6TSRz;3I6vu{_hd} e|NYy6-v{TRvK4Zv3J9dYdnm6a_f^I;;J*M&nC0C7 literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/epid_diagram_high_level_use_case.png b/external/epid/doc/html/epid_diagram_high_level_use_case.png new file mode 100644 index 0000000000000000000000000000000000000000..acc63747281f6b6233c1a641044c5a6face6fff7 GIT binary patch literal 16041 zcmb8WWmweD7dI@@-HoKANK3bL3L=6mONW58l!SDHlq)Tb(jnaqO9)6wNi0YSES=ti zzyEVR*ZuN-!Nu-(XU?3NIdkTm&*yw2pJ^%M@K=jMV(h+r}D4`iI$W@CP1VH(zd*3%=^6G(CKwdUEcEC-rvQ zW&6jD#9z1V96}i^rVtJiWHpg__uAT;Yhw%kh8RhTXmopT ze}9h>GVB4k{Ez6OBKCFB>@i}5DPKoc;VTT4G+Dn-f?f0T>2O;@xY)qrVkUgRLXy7b zqet_edIoyp)M*FZ9ZiNDaGX0*eh=%z+b8$M6Oszl0 zyu7@QgGG-en{s5XP33olQ)t`L4&^&CM+!z$AOx zFJ#K@N%}}}QgLeE8vj&c`ZNDKQTLF&aYpV>-&(q>ZbehWUDL&C(`WOPHN$ln*x#;MZkn3(#s7Ko$ot_G3YB@PNMoktmfnUUSU0$8A zQGRG{ZeDRV`0x~Lmxc!+JF{fQJZWmPnL4xV~q9$4wqji z2&8&rsW?>d84FV#O2KS`LlP8u3~6-%5)xQKjC+0M_31EpO%5}?z*^I#j#y7_{a{t_ z_VV`Lau=VmLx440?>#yaoT+O{Q6Dm|qKfb5aWMp2hYTu7v!7>;+qfEIknue~I6OMz z@#8X)P8bQ-Hi00cEWardyAF9gEtzT>iqEj4{ExX?(#MnnF5TM}>;6+XFa*d)Tjcp0Gbo|HJ#uNYcCYYK>*q!NsW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k7$7its}N;AUv8v8J8-`L2;q2ArW)xXaiLy@KQdc z>-Y!QPS?)PBO95CoKCn&*i>()bk%abRrdF<2HX@U3n118P3$ob1#|>qC{;PF<@)u6 zj*Jn2jzSBJOAxRtzi1Zwug!?vx3m%KkSLE%(?>j6Y98*D#&rd;O5Mx4B4wwRJBSmX z5#1_-uquES*0+Ehkua;8gT(Ev_=8m#KwzQXItXqG+;?kX@T|S+kAY1yXM@x5Ro`_h z;ybWdQ(d0Qy)Wgpw#i&SlaA52x!n+IGX9aS7O6|c%+sOb)Ps=`c0egd12}03QR#7EY$H1I}N1(YLp?9M#cxA@@1LKOIeC@!` z`!BMsYhL%^bq%Y2It&IBC=3=Jx~I@Ne0^}x@pFnZ0b51*yugu!Rry`ESgfiEE zjGTtGG23s0Y2Ad7NKjxGTFlJ$y#f;j_wUBbasGZ5UK4=lMR2X6HO)563SHh67EGGl zUN%?4ZYnQJvK_3C65B6NVZs~f6_o83{sG$_x3LRvFl4CW*K5q4;~VHB&#UfGAL32K zveP9`8}xcyoWJd6gdrFzjQdxZ?>e*SrPJ+5hS8DZ$8QD0?Sa(7(co5~Uh+y!`{lW0 z>vH${;ESFk7U)vcY&0}rXYj|F0C8<->wG}_`6;X}S!T+i*~l(^&$?8m1>gx774r%S zNY#HsnxrjtD8Zn=oA#|JH)-Vd=(iBhq-oa?lXoZ;vqa$S?TpDj{VY%?ynXA literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/epid_diagram_issuer_high_level.png b/external/epid/doc/html/epid_diagram_issuer_high_level.png new file mode 100644 index 0000000000000000000000000000000000000000..d03d6b9fdb1f216d83576b612707bbf5601874d4 GIT binary patch literal 4857 zcmcIocT`i^)(;@ypnymlgrP|jr8r0t5CrL903|^>B27wA2?6N@=`}EfCLl-;5g`x+ z45&yGLy=Ah5RfK>UWO9#;(Rmjy?Jle{PC^tyKCLG?z;Qjz0cWqpWpAdPn;Q0pOxhT z3jhFMH8jw<0|3xnr`;l_>1l5gm~NT@0O#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qU68_VX~Jzk4uO!jK*ZV1 zDSg%hnZ0;u@&s=jc$e`l?Z^L+g3Mm3Zt?*wkTK}iqP79H+1j=LsS(6m7Sdh=bb*rS z7LXtWXo9M#23HGv`_c(LACyI`RGrg|H~_$3Mn-f2jwUPcZA{Y5{GkS`ej4EE=e0E( zxa#hgtBVuonWj;DWG5Z>1AtNncp`|wwU(7-ynX6_$29#rIEJid_2)1r_EPCVO(XeV zK-!o789nyXmNUOo1ZI(6ERO>RclLYFsP)QVi>350Z4FPpyD?F|cx)Pq3W?PF{6MG8 z3QQ&kxl#whxKzZ|qfs&JJn?I5@;D$XW_5&m5Qh#~_4?VL8K zvyP(%W4H{_v=KY6=Z@7xMN9S7+gsDSv<={oKu>Z@<@=H!oHS^mnJ0PL^&^u%xw_C8 zY3Zv`*6+>H-#q?REzqILyg*Mta6RDfw*Z;0dsJnn6TE>BqOB&ASKS1puK|I>F~!MO z8FpFEPY9>5i-P`~3)e5y@}lXz<>JHZ`Lm$+v&1dDtKp+s;*JBa4Z$KR zT5NSkZsrZx_75dJ*?tEew+5Ghg{>xYW60d8yEf<97KLb+piy%@GPLVP0@62Nx7fQd zv`Qg0{V{|*Oq^Nb-$d^4e>)bh%8bdH%;7nE<@2*zek2+aa0f)JpD>jaH#MBGK z_@}=9<8!~ZdUmb0n!1w4mA+EXuc?I|Y^{rByO19I=u!NTfw>0EgL#55Dj&zT9K%Z) zErn@-MEe^cd|fY=A@dHXdi^4xQFhrSr(i8yQ}+)jN{mXfeLD*_fBUo<(sXipz`X z7d0FXH=CvgaX$cvC`byyz3=}TKKlO=P7(-k@qlGgI?9}Uoj`+wk| ul > li > div { + display: none; +} + +/* Shift remaining nav-tree nodes left */ +#nav-tree-contents > ul { + margin: 0; + padding: 0; + margin-left: -16px; + margin-top: -2em; /* nav-tree hack*/ +} + +#projectlink { + color:inherit; + text-decoration:none; +} \ No newline at end of file diff --git a/external/epid/doc/html/errors_8c.html b/external/epid/doc/html/errors_8c.html new file mode 100644 index 0000000000..ce82948c36 --- /dev/null +++ b/external/epid/doc/html/errors_8c.html @@ -0,0 +1,101 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/errors.c File Reference + + + + + + + + + + + + +

+
+ +
+
+
+ +
+
+ +
+
errors.c File Reference
+
+
+ +

Error reporting implementation. +More...

+
#include <stddef.h>
+#include "epid/common/stdtypes.h"
+#include "epid/common/errors.h"
+
+ + + + +

+Data Structures

struct  ErrorTextEntry
 Record mapping status code to string. More...
 
+ + + + +

+Functions

char const * EpidStatusToString (EpidStatus e)
 Returns string representation of error code. More...
 
+

Detailed Description

+

Error reporting implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/errors_8h.html b/external/epid/doc/html/errors_8h.html new file mode 100644 index 0000000000..7b8a7f8697 --- /dev/null +++ b/external/epid/doc/html/errors_8h.html @@ -0,0 +1,122 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/errors.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
errors.h File Reference
+
+
+ +

Error reporting. +More...

+ + + + + +

+Enumerations

enum  EpidStatus {
+  kEpidNoErr = 0, +kEpidSigValid = 0, +kEpidSigInvalid = 1, +kEpidSigRevokedinGroupRl = 2, +
+  kEpidSigRevokedinPrivRl = 3, +kEpidSigRevokedinSigRl = 4, +kEpidSigRevokedinVerifierRl = 5, +kEpidErr = -999, +
+  kEpidNotImpl, +kEpidBadArgErr, +kEpidNoMemErr, +kEpidMemAllocErr, +
+  kEpidMathErr, +kEpidDivByZeroErr, +kEpidUnderflowErr, +kEpidHashAlgorithmNotSupported, +
+  kEpidRandMaxIterErr, +kEpidDuplicateErr +
+ }
 Return status for SDK functions. More...
 
+ + + + +

+Functions

char const * EpidStatusToString (EpidStatus e)
 Returns string representation of error code. More...
 
+

Detailed Description

+

Error reporting.

+
+
+ + + + + diff --git a/external/epid/doc/html/examples.html b/external/epid/doc/html/examples.html new file mode 100644 index 0000000000..f2de4e678e --- /dev/null +++ b/external/epid/doc/html/examples.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Examples + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Examples
+
+
+
Here is a list of all examples:
+
+
+ + + + + diff --git a/external/epid/doc/html/examples.js b/external/epid/doc/html/examples.js new file mode 100644 index 0000000000..cdfa35393e --- /dev/null +++ b/external/epid/doc/html/examples.js @@ -0,0 +1,5 @@ +var examples = +[ + [ "signmsg.c", "signmsg_8c-example.html", null ], + [ "verifysig.c", "verifysig_8c-example.html", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/examples_8dox.html b/external/epid/doc/html/examples_8dox.html new file mode 100644 index 0000000000..7f8829a3bb --- /dev/null +++ b/external/epid/doc/html/examples_8dox.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: doc/docsrc/examples.dox File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
doc/docsrc/examples.dox File Reference
+
+
+ +

This file is used by Doxygen to generate documentation. +More...

+

Detailed Description

+

This file is used by Doxygen to generate documentation.

+
+
+ + + + + diff --git a/external/epid/doc/html/file__parser_8c.html b/external/epid/doc/html/file__parser_8c.html new file mode 100644 index 0000000000..befa225f71 --- /dev/null +++ b/external/epid/doc/html/file__parser_8c.html @@ -0,0 +1,118 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/file_parser.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
file_parser.c File Reference
+
+
+ +

Implementation of issuer material file parsing utilities. +More...

+
#include "epid/common/file_parser.h"
+#include <string.h>
+#include "epid/common/math/ecdsa.h"
+#include "epid/common/memory.h"
+
+ + + + +

+Data Structures

struct  EpidGroupPubKeyCertificate
 Intel(R) EPID 2.0 Group Public Key binary format. More...
 
+ + + + + + + + + + + + + +

+Functions

EpidStatus EpidParseGroupPubKeyFile (void const *buf, size_t len, EpidCaCertificate const *cert, GroupPubKey *pubkey)
 Extracts group public key from buffer in issuer binary format. More...
 
EpidStatus EpidParsePrivRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, PrivRl *rl, size_t *rl_len)
 Extracts private key revocation list from buffer in issuer binary format. More...
 
EpidStatus EpidParseSigRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, SigRl *rl, size_t *rl_len)
 Extracts signature revocation list from buffer in issuer binary format. More...
 
EpidStatus EpidParseGroupRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, GroupRl *rl, size_t *rl_len)
 Extracts group revocation list from buffer in issuer binary format. More...
 
+ + + + +

+Variables

const OctStr16 kEpidFileTypeCode [kNumFileTypes]
 Encoding of issuer material file types. More...
 
+

Detailed Description

+

Implementation of issuer material file parsing utilities.

+
+
+ + + + + diff --git a/external/epid/doc/html/file__parser_8h.html b/external/epid/doc/html/file__parser_8h.html new file mode 100644 index 0000000000..b87ad4cac5 --- /dev/null +++ b/external/epid/doc/html/file__parser_8h.html @@ -0,0 +1,141 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/file_parser.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
file_parser.h File Reference
+
+
+ +

Epid issuer material parsing utilities. +More...

+
#include <stddef.h>
+#include "epid/common/types.h"
+#include "epid/common/errors.h"
+
+ + + + + + + +

+Data Structures

struct  EpidFileHeader
 Intel(R) EPID binary file header. More...
 
struct  EpidCaCertificate
 IoT CA Certificate binary format. More...
 
+ + + + +

+Enumerations

enum  EpidFileType {
+  kIssuingCaPubKeyFile, +kGroupPubKeyFile, +kPrivRlFile, +kSigRlFile, +
+  kGroupRlFile, +kPrivRlRequestFile, +kSigRlRequestFile, +kGroupRlRequestFile, +
+  kNumFileTypes +
+ }
 Recognized Intel(R) EPID file types. More...
 
+ + + + + + + + + + + + + +

+Functions

EpidStatus EpidParseGroupPubKeyFile (void const *buf, size_t len, EpidCaCertificate const *cert, GroupPubKey *pubkey)
 Extracts group public key from buffer in issuer binary format. More...
 
EpidStatus EpidParsePrivRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, PrivRl *rl, size_t *rl_len)
 Extracts private key revocation list from buffer in issuer binary format. More...
 
EpidStatus EpidParseSigRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, SigRl *rl, size_t *rl_len)
 Extracts signature revocation list from buffer in issuer binary format. More...
 
EpidStatus EpidParseGroupRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, GroupRl *rl, size_t *rl_len)
 Extracts group revocation list from buffer in issuer binary format. More...
 
+ + + + +

+Variables

+const OctStr16 kEpidFileTypeCode [kNumFileTypes]
 Encoding of issuer material file types.
 
+

Detailed Description

+

Epid issuer material parsing utilities.

+
+
+ + + + + diff --git a/external/epid/doc/html/files.html b/external/epid/doc/html/files.html new file mode 100644 index 0000000000..9da5d546e4 --- /dev/null +++ b/external/epid/doc/html/files.html @@ -0,0 +1,141 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: File List + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
File List
+
+
+
Here is a list of all documented files with brief descriptions:
+
[detail level 1234]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  epidCore Intel® EPID functionality
  commonCommon code shared between core sub-components
  mathMath primitives
 bignum.cBig number implementation
 bignum.hBig number interface
 ecdsa.hEcdsa interface
 ecdsa_sign.cEcdsaSignBuffer implementation
 ecdsa_verify.cEcdsaVerifyBuffer implementation
 ecgroup.cElliptic curve group implementation
 ecgroup.hElliptic curve group interface
 finitefield.cFinite field implementation
 finitefield.hFinite field interface
 hash.hHash primitives
 pairing.cPairing implementation
 pairing.hPairing interface
 printutils.cPrint helper implementation
 printutils.hPrint helper interface
 sha256.cSHA256 implementation
 bitsupplier.hRandom data supplier interface
 commitment.cCommitment hash implementation
 commitment.hCommitment hash interface
 endian_convert.hEndianness conversion interface
 epid2params.cIntel(R) EPID 2.0 constant parameters implementation
 epid2params.hIntel(R) EPID 2.0 constant parameters interface
 epid2params_ate.incIntel(R) EPID 2.0 constant parameters data
 errors.cError reporting implementation
 errors.hError reporting
 file_parser.cImplementation of issuer material file parsing utilities
 file_parser.hEpid issuer material parsing utilities
 grouppubkey.cGroup public key implementation
 grouppubkey.hGroup public key interface
 memory.cMemory access implementation
 memory.hMemory access interface
 sigrlvalid.cSigRl validity checking implementation
 sigrlvalid.hSigRl validity checking interface
 stack.cStack container implementation
 stack.hStack container interface
 stdtypes.hC99 standard data types
 types.hSDK data types
  memberMember functionality
 api.hIntel(R) EPID SDK member API
 context.cMember context implementation
 context.hMember context interface
 decompress_privkey.cEpidDecompressPrivKey implementation
 get_sigsize.cEpidGetSigSize implementation
 nr_prove.cEpidNrProve implementation
 presig.cEpidComputePreSig implementation
 privkey.cPrivate key implementation
 privkey.hPrivate key private interface
 request_join.cEpidRequestJoin implementation
 sign.cEpidSign implementation
 signbasic.cEpidSignBasic implementation
  verifierVerifier functionality
 api.hIntel(R) EPID SDK verifier API
 check_privrl_entry.cEpidCheckPrivRlEntry implementation
 context.cVerifier context implementation
 context.hVerifier context interface
 nrverify.cNrVerfy implementation
 sigs_linked.cAreSigsLinked implementation
 verify.cVerify implementation
 verifybasic.cVerifyBasicSig implementation
+
+
+
+ + + + + diff --git a/external/epid/doc/html/finitefield_8c.html b/external/epid/doc/html/finitefield_8c.html new file mode 100644 index 0000000000..da6975291f --- /dev/null +++ b/external/epid/doc/html/finitefield_8c.html @@ -0,0 +1,162 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/finitefield.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
finitefield.c File Reference
+
+
+ +

Finite field implementation. +More...

+
#include <limits.h>
+#include <string.h>
+#include "epid/common/math/finitefield.h"
+#include "epid/common/math/bignum-internal.h"
+#include "epid/common/math/finitefield-internal.h"
+#include "epid/common/memory.h"
+#include "ext/ipp/include/ippcp.h"
+#include "ext/ipp/include/ippcpepid.h"
+
+ + + + +

+Macros

+#define RNG_WATCHDOG   (10)
 Number of tries for RNG.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

+EpidStatus InitFiniteFieldFromIpp (IppsGFpState *ipp_ff, FiniteField *ff)
 Initializes a FiniteField structure.
 
EpidStatus NewFiniteField (BigNumStr const *prime, FiniteField **ff)
 Creates new finite field. More...
 
EpidStatus NewFiniteFieldViaBinomalExtension (FiniteField const *ground_field, FfElement const *ground_element, int degree, FiniteField **ff)
 Creates a new finite field using binomial extension. More...
 
void DeleteFiniteField (FiniteField **ff)
 Frees a previously allocated FiniteField. More...
 
EpidStatus NewFfElement (FiniteField const *ff, FfElement **new_ff_elem)
 Creates a new finite field element. More...
 
void DeleteFfElement (FfElement **ff_elem)
 Frees a previously allocated FfElement. More...
 
EpidStatus ReadFfElement (FiniteField *ff, void const *ff_elem_str, size_t strlen, FfElement *ff_elem)
 Deserializes a FfElement from a string. More...
 
EpidStatus WriteFfElement (FiniteField *ff, FfElement const *ff_elem, void *ff_elem_str, size_t strlen)
 Serializes a finite field element to a string. More...
 
EpidStatus FfNeg (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the additive inverse of a finite field element. More...
 
EpidStatus FfInv (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the multiplicative inverse of a finite field element. More...
 
EpidStatus FfAdd (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Adds two finite field elements. More...
 
EpidStatus FfMul (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Multiplies two finite field elements. More...
 
EpidStatus FfIsZero (FiniteField *ff, FfElement const *a, bool *is_zero)
 Checks if given finite field element is the additive identity (zero). More...
 
EpidStatus FfExp (FiniteField *ff, FfElement const *a, BigNum const *b, FfElement *r)
 Raises an element of a finite field to a power. More...
 
EpidStatus FfMultiExp (FiniteField *ff, FfElement const **p, BigNumStr const **b, size_t m, FfElement *r)
 Multi-exponentiates finite field elements. More...
 
EpidStatus FfSscmMultiExp (FiniteField *ff, FfElement const **p, BigNumStr const **b, size_t m, FfElement *r)
 Software side-channel mitigated implementation of FfMultiExp. More...
 
EpidStatus FfIsEqual (FiniteField *ff, FfElement const *a, FfElement const *b, bool *is_equal)
 Checks if two finite field elements are equal. More...
 
EpidStatus FfHash (FiniteField *ff, void const *msg, size_t msg_len, HashAlg hash_alg, FfElement *r)
 Hashes an arbitrary message to an element in a finite field. More...
 
EpidStatus FfGetRandom (FiniteField *ff, BigNumStr const *low_bound, BitSupplier rnd_func, void *rnd_param, FfElement *r)
 Generate random finite field element. More...
 
+

Detailed Description

+

Finite field implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/finitefield_8h.html b/external/epid/doc/html/finitefield_8h.html new file mode 100644 index 0000000000..b966a52228 --- /dev/null +++ b/external/epid/doc/html/finitefield_8h.html @@ -0,0 +1,159 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/finitefield.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
finitefield.h File Reference
+
+
+ +

Finite field interface. +More...

+ + + + + + + + +

+Typedefs

+typedef struct FiniteField FiniteField
 A finite field.
 
+typedef struct FfElement FfElement
 An element in a finite field.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewFiniteField (BigNumStr const *prime, FiniteField **ff)
 Creates new finite field. More...
 
EpidStatus NewFiniteFieldViaBinomalExtension (FiniteField const *ground_field, FfElement const *ground_element, int degree, FiniteField **ff)
 Creates a new finite field using binomial extension. More...
 
void DeleteFiniteField (FiniteField **ff)
 Frees a previously allocated FiniteField. More...
 
EpidStatus NewFfElement (FiniteField const *ff, FfElement **new_ff_elem)
 Creates a new finite field element. More...
 
void DeleteFfElement (FfElement **ff_elem)
 Frees a previously allocated FfElement. More...
 
EpidStatus ReadFfElement (FiniteField *ff, void const *ff_elem_str, size_t strlen, FfElement *ff_elem)
 Deserializes a FfElement from a string. More...
 
EpidStatus WriteFfElement (FiniteField *ff, FfElement const *ff_elem, void *ff_elem_str, size_t strlen)
 Serializes a finite field element to a string. More...
 
EpidStatus FfNeg (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the additive inverse of a finite field element. More...
 
EpidStatus FfInv (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the multiplicative inverse of a finite field element. More...
 
EpidStatus FfAdd (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Adds two finite field elements. More...
 
EpidStatus FfMul (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Multiplies two finite field elements. More...
 
EpidStatus FfIsZero (FiniteField *ff, FfElement const *a, bool *is_zero)
 Checks if given finite field element is the additive identity (zero). More...
 
EpidStatus FfExp (FiniteField *ff, FfElement const *a, BigNum const *b, FfElement *r)
 Raises an element of a finite field to a power. More...
 
EpidStatus FfMultiExp (FiniteField *ff, FfElement const **a, BigNumStr const **b, size_t m, FfElement *r)
 Multi-exponentiates finite field elements. More...
 
EpidStatus FfSscmMultiExp (FiniteField *ff, FfElement const **a, BigNumStr const **b, size_t m, FfElement *r)
 Software side-channel mitigated implementation of FfMultiExp. More...
 
EpidStatus FfIsEqual (FiniteField *ff, FfElement const *a, FfElement const *b, bool *is_equal)
 Checks if two finite field elements are equal. More...
 
EpidStatus FfHash (FiniteField *ff, void const *msg, size_t msg_len, HashAlg hash_alg, FfElement *r)
 Hashes an arbitrary message to an element in a finite field. More...
 
EpidStatus FfGetRandom (FiniteField *ff, BigNumStr const *low_bound, BitSupplier rnd_func, void *rnd_param, FfElement *r)
 Generate random finite field element. More...
 
+

Detailed Description

+

Finite field interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/folderclosed.png b/external/epid/doc/html/folderclosed.png new file mode 100644 index 0000000000000000000000000000000000000000..bb8ab35edce8e97554e360005ee9fc5bffb36e66 GIT binary patch literal 616 zcmV-u0+;=XP)a9#ETzayK)T~Jw&MMH>OIr#&;dC}is*2Mqdf&akCc=O@`qC+4i z5Iu3w#1M@KqXCz8TIZd1wli&kkl2HVcAiZ8PUn5z_kG@-y;?yK06=cA0U%H0PH+kU zl6dp}OR(|r8-RG+YLu`zbI}5TlOU6ToR41{9=uz^?dGTNL;wIMf|V3`d1Wj3y!#6` zBLZ?xpKR~^2x}?~zA(_NUu3IaDB$tKma*XUdOZN~c=dLt_h_k!dbxm_*ibDM zlFX`g{k$X}yIe%$N)cn1LNu=q9_CS)*>A zsX_mM4L@`(cSNQKMFc$RtYbx{79#j-J7hk*>*+ZZhM4Hw?I?rsXCi#mRWJ=-0LGV5a-WR0Qgt<|Nqf)C-@80`5gIz45^_20000IqP)X=#(TiCT&PiIIVc55T}TU}EUh*{q$|`3@{d>{Tc9Bo>e= zfmF3!f>fbI9#GoEHh0f`i5)wkLpva0ztf%HpZneK?w-7AK@b4Itw{y|Zd3k!fH?q2 zlhckHd_V2M_X7+)U&_Xcfvtw60l;--DgZmLSw-Y?S>)zIqMyJ1#FwLU*%bl38ok+! zh78H87n`ZTS;uhzAR$M`zZ`bVhq=+%u9^$5jDplgxd44}9;IRqUH1YHH|@6oFe%z( zo4)_>E$F&^P-f(#)>(TrnbE>Pefs9~@iN=|)Rz|V`sGfHNrJ)0gJb8xx+SBmRf@1l zvuzt=vGfI)<-F9!o&3l?>9~0QbUDT(wFdnQPv%xdD)m*g%!20>Bc9iYmGAp<9YAa( z0QgYgTWqf1qN++Gqp z8@AYPTB3E|6s=WLG?xw0tm|U!o=&zd+H0oRYE;Dbx+Na9s^STqX|Gnq%H8s(nGDGJ j8vwW|`Ts`)fSK|Kx=IK@RG@g200000NkvXXu0mjfauFEA literal 0 HcmV?d00001 diff --git a/external/epid/doc/html/functions.html b/external/epid/doc/html/functions.html new file mode 100644 index 0000000000..e284cced9a --- /dev/null +++ b/external/epid/doc/html/functions.html @@ -0,0 +1,98 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- a -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_b.html b/external/epid/doc/html/functions_b.html new file mode 100644 index 0000000000..a2e57488e9 --- /dev/null +++ b/external/epid/doc/html/functions_b.html @@ -0,0 +1,107 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- b -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_c.html b/external/epid/doc/html/functions_c.html new file mode 100644 index 0000000000..e373d8a1e1 --- /dev/null +++ b/external/epid/doc/html/functions_c.html @@ -0,0 +1,85 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- c -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_d.html b/external/epid/doc/html/functions_d.html new file mode 100644 index 0000000000..48a9295861 --- /dev/null +++ b/external/epid/doc/html/functions_d.html @@ -0,0 +1,90 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- d -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_e.html b/external/epid/doc/html/functions_e.html new file mode 100644 index 0000000000..89b95e91a6 --- /dev/null +++ b/external/epid/doc/html/functions_e.html @@ -0,0 +1,112 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- e -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_f.html b/external/epid/doc/html/functions_f.html new file mode 100644 index 0000000000..72d55950ca --- /dev/null +++ b/external/epid/doc/html/functions_f.html @@ -0,0 +1,100 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- f -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_g.html b/external/epid/doc/html/functions_g.html new file mode 100644 index 0000000000..edb3cd466b --- /dev/null +++ b/external/epid/doc/html/functions_g.html @@ -0,0 +1,122 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- g -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_h.html b/external/epid/doc/html/functions_h.html new file mode 100644 index 0000000000..dcb325c8ae --- /dev/null +++ b/external/epid/doc/html/functions_h.html @@ -0,0 +1,98 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- h -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_k.html b/external/epid/doc/html/functions_k.html new file mode 100644 index 0000000000..fdf2abced7 --- /dev/null +++ b/external/epid/doc/html/functions_k.html @@ -0,0 +1,95 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- k -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_l.html b/external/epid/doc/html/functions_l.html new file mode 100644 index 0000000000..9c72e634d0 --- /dev/null +++ b/external/epid/doc/html/functions_l.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- l -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_m.html b/external/epid/doc/html/functions_m.html new file mode 100644 index 0000000000..8d86dd4814 --- /dev/null +++ b/external/epid/doc/html/functions_m.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- m -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_n.html b/external/epid/doc/html/functions_n.html new file mode 100644 index 0000000000..23782aac09 --- /dev/null +++ b/external/epid/doc/html/functions_n.html @@ -0,0 +1,102 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- n -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_p.html b/external/epid/doc/html/functions_p.html new file mode 100644 index 0000000000..8355af16e5 --- /dev/null +++ b/external/epid/doc/html/functions_p.html @@ -0,0 +1,105 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- p -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_q.html b/external/epid/doc/html/functions_q.html new file mode 100644 index 0000000000..ea64bc38f2 --- /dev/null +++ b/external/epid/doc/html/functions_q.html @@ -0,0 +1,80 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- q -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_r.html b/external/epid/doc/html/functions_r.html new file mode 100644 index 0000000000..313ae27a04 --- /dev/null +++ b/external/epid/doc/html/functions_r.html @@ -0,0 +1,121 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- r -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_s.html b/external/epid/doc/html/functions_s.html new file mode 100644 index 0000000000..671de83346 --- /dev/null +++ b/external/epid/doc/html/functions_s.html @@ -0,0 +1,113 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- s -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_t.html b/external/epid/doc/html/functions_t.html new file mode 100644 index 0000000000..d845079562 --- /dev/null +++ b/external/epid/doc/html/functions_t.html @@ -0,0 +1,99 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- t -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_v.html b/external/epid/doc/html/functions_v.html new file mode 100644 index 0000000000..590391966a --- /dev/null +++ b/external/epid/doc/html/functions_v.html @@ -0,0 +1,88 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- v -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars.html b/external/epid/doc/html/functions_vars.html new file mode 100644 index 0000000000..445df8d494 --- /dev/null +++ b/external/epid/doc/html/functions_vars.html @@ -0,0 +1,98 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- a -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_b.html b/external/epid/doc/html/functions_vars_b.html new file mode 100644 index 0000000000..d19d2371e7 --- /dev/null +++ b/external/epid/doc/html/functions_vars_b.html @@ -0,0 +1,107 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- b -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_c.html b/external/epid/doc/html/functions_vars_c.html new file mode 100644 index 0000000000..0225552d3a --- /dev/null +++ b/external/epid/doc/html/functions_vars_c.html @@ -0,0 +1,85 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- c -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_d.html b/external/epid/doc/html/functions_vars_d.html new file mode 100644 index 0000000000..5887dbfcd7 --- /dev/null +++ b/external/epid/doc/html/functions_vars_d.html @@ -0,0 +1,90 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+ +
+ + + + + diff --git a/external/epid/doc/html/functions_vars_e.html b/external/epid/doc/html/functions_vars_e.html new file mode 100644 index 0000000000..81b785fd71 --- /dev/null +++ b/external/epid/doc/html/functions_vars_e.html @@ -0,0 +1,112 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- e -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_f.html b/external/epid/doc/html/functions_vars_f.html new file mode 100644 index 0000000000..a9cdb55eb9 --- /dev/null +++ b/external/epid/doc/html/functions_vars_f.html @@ -0,0 +1,100 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- f -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_g.html b/external/epid/doc/html/functions_vars_g.html new file mode 100644 index 0000000000..fc37948c73 --- /dev/null +++ b/external/epid/doc/html/functions_vars_g.html @@ -0,0 +1,122 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ + + + + + + diff --git a/external/epid/doc/html/functions_vars_h.html b/external/epid/doc/html/functions_vars_h.html new file mode 100644 index 0000000000..53e982ccb1 --- /dev/null +++ b/external/epid/doc/html/functions_vars_h.html @@ -0,0 +1,98 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ + + + + + + diff --git a/external/epid/doc/html/functions_vars_k.html b/external/epid/doc/html/functions_vars_k.html new file mode 100644 index 0000000000..84e55cd6b7 --- /dev/null +++ b/external/epid/doc/html/functions_vars_k.html @@ -0,0 +1,95 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- k -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_l.html b/external/epid/doc/html/functions_vars_l.html new file mode 100644 index 0000000000..b5eef3e5df --- /dev/null +++ b/external/epid/doc/html/functions_vars_l.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- l -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_m.html b/external/epid/doc/html/functions_vars_m.html new file mode 100644 index 0000000000..58b6aa8a09 --- /dev/null +++ b/external/epid/doc/html/functions_vars_m.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- m -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_n.html b/external/epid/doc/html/functions_vars_n.html new file mode 100644 index 0000000000..b154f6685e --- /dev/null +++ b/external/epid/doc/html/functions_vars_n.html @@ -0,0 +1,102 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- n -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_p.html b/external/epid/doc/html/functions_vars_p.html new file mode 100644 index 0000000000..03f386e990 --- /dev/null +++ b/external/epid/doc/html/functions_vars_p.html @@ -0,0 +1,105 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- p -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_q.html b/external/epid/doc/html/functions_vars_q.html new file mode 100644 index 0000000000..ae5b02c099 --- /dev/null +++ b/external/epid/doc/html/functions_vars_q.html @@ -0,0 +1,80 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- q -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_r.html b/external/epid/doc/html/functions_vars_r.html new file mode 100644 index 0000000000..a9c20fb040 --- /dev/null +++ b/external/epid/doc/html/functions_vars_r.html @@ -0,0 +1,121 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- r -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_s.html b/external/epid/doc/html/functions_vars_s.html new file mode 100644 index 0000000000..e6a4e85a9d --- /dev/null +++ b/external/epid/doc/html/functions_vars_s.html @@ -0,0 +1,113 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- s -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_t.html b/external/epid/doc/html/functions_vars_t.html new file mode 100644 index 0000000000..6a1d6689e8 --- /dev/null +++ b/external/epid/doc/html/functions_vars_t.html @@ -0,0 +1,99 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- t -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_v.html b/external/epid/doc/html/functions_vars_v.html new file mode 100644 index 0000000000..63566534eb --- /dev/null +++ b/external/epid/doc/html/functions_vars_v.html @@ -0,0 +1,88 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- v -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_vars_w.html b/external/epid/doc/html/functions_vars_w.html new file mode 100644 index 0000000000..4034b01b6a --- /dev/null +++ b/external/epid/doc/html/functions_vars_w.html @@ -0,0 +1,83 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ + + + + + + diff --git a/external/epid/doc/html/functions_vars_x.html b/external/epid/doc/html/functions_vars_x.html new file mode 100644 index 0000000000..17d2cc60bc --- /dev/null +++ b/external/epid/doc/html/functions_vars_x.html @@ -0,0 +1,95 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ + + + + + + diff --git a/external/epid/doc/html/functions_vars_y.html b/external/epid/doc/html/functions_vars_y.html new file mode 100644 index 0000000000..96f739bfab --- /dev/null +++ b/external/epid/doc/html/functions_vars_y.html @@ -0,0 +1,83 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields - Variables + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- y -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_w.html b/external/epid/doc/html/functions_w.html new file mode 100644 index 0000000000..8c463abed0 --- /dev/null +++ b/external/epid/doc/html/functions_w.html @@ -0,0 +1,83 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- w -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_x.html b/external/epid/doc/html/functions_x.html new file mode 100644 index 0000000000..e54c6ebf5f --- /dev/null +++ b/external/epid/doc/html/functions_x.html @@ -0,0 +1,95 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- x -

+
+
+ + + + + diff --git a/external/epid/doc/html/functions_y.html b/external/epid/doc/html/functions_y.html new file mode 100644 index 0000000000..47cbd2d3d1 --- /dev/null +++ b/external/epid/doc/html/functions_y.html @@ -0,0 +1,83 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Data Fields + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:
+ +

- y -

+
+
+ + + + + diff --git a/external/epid/doc/html/get__sigsize_8c.html b/external/epid/doc/html/get__sigsize_8c.html new file mode 100644 index 0000000000..e1196acb68 --- /dev/null +++ b/external/epid/doc/html/get__sigsize_8c.html @@ -0,0 +1,93 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/member/get_sigsize.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
get_sigsize.c File Reference
+
+
+ +

EpidGetSigSize implementation. +More...

+ + + + + +

+Functions

size_t EpidGetSigSize (SigRl const *sig_rl)
 Computes the size in bytes required for a Intel(R) EPID signature. More...
 
+

Detailed Description

+

EpidGetSigSize implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/globals.html b/external/epid/doc/html/globals.html new file mode 100644 index 0000000000..85cb8704c3 --- /dev/null +++ b/external/epid/doc/html/globals.html @@ -0,0 +1,80 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- a -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_b.html b/external/epid/doc/html/globals_b.html new file mode 100644 index 0000000000..82c9bd3dc3 --- /dev/null +++ b/external/epid/doc/html/globals_b.html @@ -0,0 +1,119 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- b -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_c.html b/external/epid/doc/html/globals_c.html new file mode 100644 index 0000000000..a3ef228d2e --- /dev/null +++ b/external/epid/doc/html/globals_c.html @@ -0,0 +1,104 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- c -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_d.html b/external/epid/doc/html/globals_d.html new file mode 100644 index 0000000000..48bbd7ba26 --- /dev/null +++ b/external/epid/doc/html/globals_d.html @@ -0,0 +1,120 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- d -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_defs.html b/external/epid/doc/html/globals_defs.html new file mode 100644 index 0000000000..63b1b750d1 --- /dev/null +++ b/external/epid/doc/html/globals_defs.html @@ -0,0 +1,197 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- b -

+ + +

- c -

+ + +

- e -

+ + +

- f -

+ + +

- i -

+ + +

- m -

+ + +

- n -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- w -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_e.html b/external/epid/doc/html/globals_e.html new file mode 100644 index 0000000000..a2efb894bf --- /dev/null +++ b/external/epid/doc/html/globals_e.html @@ -0,0 +1,308 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- e -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_enum.html b/external/epid/doc/html/globals_enum.html new file mode 100644 index 0000000000..9054ce7352 --- /dev/null +++ b/external/epid/doc/html/globals_enum.html @@ -0,0 +1,86 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/globals_eval.html b/external/epid/doc/html/globals_eval.html new file mode 100644 index 0000000000..4e265cb3f6 --- /dev/null +++ b/external/epid/doc/html/globals_eval.html @@ -0,0 +1,184 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- k -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_f.html b/external/epid/doc/html/globals_f.html new file mode 100644 index 0000000000..7b7f7bfb4d --- /dev/null +++ b/external/epid/doc/html/globals_f.html @@ -0,0 +1,129 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- f -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func.html b/external/epid/doc/html/globals_func.html new file mode 100644 index 0000000000..786416a46d --- /dev/null +++ b/external/epid/doc/html/globals_func.html @@ -0,0 +1,80 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- a -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_b.html b/external/epid/doc/html/globals_func_b.html new file mode 100644 index 0000000000..452e4ac509 --- /dev/null +++ b/external/epid/doc/html/globals_func_b.html @@ -0,0 +1,92 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- b -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_c.html b/external/epid/doc/html/globals_func_c.html new file mode 100644 index 0000000000..032b6eeed2 --- /dev/null +++ b/external/epid/doc/html/globals_func_c.html @@ -0,0 +1,99 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- c -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_d.html b/external/epid/doc/html/globals_func_d.html new file mode 100644 index 0000000000..b6f814ed21 --- /dev/null +++ b/external/epid/doc/html/globals_func_d.html @@ -0,0 +1,120 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- d -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_e.html b/external/epid/doc/html/globals_func_e.html new file mode 100644 index 0000000000..e0bd93d98c --- /dev/null +++ b/external/epid/doc/html/globals_func_e.html @@ -0,0 +1,287 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- e -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_f.html b/external/epid/doc/html/globals_func_f.html new file mode 100644 index 0000000000..b3b0673c4a --- /dev/null +++ b/external/epid/doc/html/globals_func_f.html @@ -0,0 +1,120 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- f -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_i.html b/external/epid/doc/html/globals_func_i.html new file mode 100644 index 0000000000..26cdb45ccb --- /dev/null +++ b/external/epid/doc/html/globals_func_i.html @@ -0,0 +1,83 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- i -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_m.html b/external/epid/doc/html/globals_func_m.html new file mode 100644 index 0000000000..58fbba2e30 --- /dev/null +++ b/external/epid/doc/html/globals_func_m.html @@ -0,0 +1,80 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- m -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_n.html b/external/epid/doc/html/globals_func_n.html new file mode 100644 index 0000000000..e940ff24a1 --- /dev/null +++ b/external/epid/doc/html/globals_func_n.html @@ -0,0 +1,107 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- n -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_o.html b/external/epid/doc/html/globals_func_o.html new file mode 100644 index 0000000000..ec740c2fd9 --- /dev/null +++ b/external/epid/doc/html/globals_func_o.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- o -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_p.html b/external/epid/doc/html/globals_func_p.html new file mode 100644 index 0000000000..61f42fdb0d --- /dev/null +++ b/external/epid/doc/html/globals_func_p.html @@ -0,0 +1,128 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- p -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_r.html b/external/epid/doc/html/globals_func_r.html new file mode 100644 index 0000000000..f4db740eae --- /dev/null +++ b/external/epid/doc/html/globals_func_r.html @@ -0,0 +1,88 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- r -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_s.html b/external/epid/doc/html/globals_func_s.html new file mode 100644 index 0000000000..8dad2c468e --- /dev/null +++ b/external/epid/doc/html/globals_func_s.html @@ -0,0 +1,99 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- s -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_func_w.html b/external/epid/doc/html/globals_func_w.html new file mode 100644 index 0000000000..378005ea04 --- /dev/null +++ b/external/epid/doc/html/globals_func_w.html @@ -0,0 +1,88 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+  + +

- w -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_g.html b/external/epid/doc/html/globals_g.html new file mode 100644 index 0000000000..363836c265 --- /dev/null +++ b/external/epid/doc/html/globals_g.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- g -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_h.html b/external/epid/doc/html/globals_h.html new file mode 100644 index 0000000000..e45607a9d3 --- /dev/null +++ b/external/epid/doc/html/globals_h.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- h -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_i.html b/external/epid/doc/html/globals_i.html new file mode 100644 index 0000000000..6d046c6a48 --- /dev/null +++ b/external/epid/doc/html/globals_i.html @@ -0,0 +1,89 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- i -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_k.html b/external/epid/doc/html/globals_k.html new file mode 100644 index 0000000000..09524383ae --- /dev/null +++ b/external/epid/doc/html/globals_k.html @@ -0,0 +1,188 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- k -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_m.html b/external/epid/doc/html/globals_m.html new file mode 100644 index 0000000000..b6884640b0 --- /dev/null +++ b/external/epid/doc/html/globals_m.html @@ -0,0 +1,86 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- m -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_n.html b/external/epid/doc/html/globals_n.html new file mode 100644 index 0000000000..1b72d4169b --- /dev/null +++ b/external/epid/doc/html/globals_n.html @@ -0,0 +1,110 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- n -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_o.html b/external/epid/doc/html/globals_o.html new file mode 100644 index 0000000000..8b0da4a790 --- /dev/null +++ b/external/epid/doc/html/globals_o.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- o -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_p.html b/external/epid/doc/html/globals_p.html new file mode 100644 index 0000000000..196ac75dac --- /dev/null +++ b/external/epid/doc/html/globals_p.html @@ -0,0 +1,137 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- p -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_r.html b/external/epid/doc/html/globals_r.html new file mode 100644 index 0000000000..a3f9836ed2 --- /dev/null +++ b/external/epid/doc/html/globals_r.html @@ -0,0 +1,100 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- r -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_s.html b/external/epid/doc/html/globals_s.html new file mode 100644 index 0000000000..91f6e87aa2 --- /dev/null +++ b/external/epid/doc/html/globals_s.html @@ -0,0 +1,114 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- s -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_t.html b/external/epid/doc/html/globals_t.html new file mode 100644 index 0000000000..a6e1ee10d6 --- /dev/null +++ b/external/epid/doc/html/globals_t.html @@ -0,0 +1,79 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- t -

+
+
+ + + + + diff --git a/external/epid/doc/html/globals_type.html b/external/epid/doc/html/globals_type.html new file mode 100644 index 0000000000..8975797ee7 --- /dev/null +++ b/external/epid/doc/html/globals_type.html @@ -0,0 +1,110 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/globals_vars.html b/external/epid/doc/html/globals_vars.html new file mode 100644 index 0000000000..80dfdade97 --- /dev/null +++ b/external/epid/doc/html/globals_vars.html @@ -0,0 +1,78 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/globals_w.html b/external/epid/doc/html/globals_w.html new file mode 100644 index 0000000000..6a291796f8 --- /dev/null +++ b/external/epid/doc/html/globals_w.html @@ -0,0 +1,91 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Globals + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:
+ +

- w -

+
+
+ + + + + diff --git a/external/epid/doc/html/glossary_8dox.html b/external/epid/doc/html/glossary_8dox.html new file mode 100644 index 0000000000..268f395b34 --- /dev/null +++ b/external/epid/doc/html/glossary_8dox.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: doc/docsrc/glossary.dox File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
doc/docsrc/glossary.dox File Reference
+
+
+ +

This file is used by Doxygen to generate documentation. +More...

+

Detailed Description

+

This file is used by Doxygen to generate documentation.

+
+
+ + + + + diff --git a/external/epid/doc/html/group___big_num_primitives.html b/external/epid/doc/html/group___big_num_primitives.html new file mode 100644 index 0000000000..c54ac40cb6 --- /dev/null +++ b/external/epid/doc/html/group___big_num_primitives.html @@ -0,0 +1,445 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: bignum + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
bignum
+
+
+ +

Big number operations. +More...

+ + + + + +

+Typedefs

+typedef struct BigNum BigNum
 Internal representation of large numbers.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewBigNum (size_t data_size_bytes, BigNum **bignum)
 Constructs a new BigNum. More...
 
void DeleteBigNum (BigNum **bignum)
 Deletes a previously allocated BigNum. More...
 
EpidStatus ReadBigNum (void const *bn_str, size_t strlen, BigNum *bn)
 Deserializes a BigNum from a string. More...
 
EpidStatus WriteBigNum (BigNum const *bn, size_t strlen, void const *bn_str)
 Serializes a BigNum to a string. More...
 
EpidStatus BigNumAdd (BigNum const *a, BigNum const *b, BigNum *r)
 Adds two BigNum values. More...
 
EpidStatus BigNumSub (BigNum const *a, BigNum const *b, BigNum *r)
 Subtracts two BigNum values. More...
 
EpidStatus BigNumMul (BigNum const *a, BigNum const *b, BigNum *r)
 Multiplies two BigNum values. More...
 
EpidStatus BigNumMod (BigNum const *a, BigNum const *b, BigNum *r)
 Computes modular reduction for BigNum value by specified modulus. More...
 
+

Detailed Description

+

Big number operations.

+

This module provides an API for working with large numbers. BigNums represent non-negative integers.

+

Each BigNum variable represents a number of a byte-size set when the variable was created. BigNum variables cannot be re-sized after they are created.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus BigNumAdd (BigNum const * a,
BigNum const * b,
BigNumr 
)
+
+ +

Adds two BigNum values.

+
Parameters
+ + + + +
[in]aThe left hand parameter.
[in]bThe right hand parameter.
[out]rThe result of adding a and b.
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus BigNumMod (BigNum const * a,
BigNum const * b,
BigNumr 
)
+
+ +

Computes modular reduction for BigNum value by specified modulus.

+
Parameters
+ + + + +
[in]aThe BigNum value.
[in]bThe modulus.
[out]rModular reduction result.
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus BigNumMul (BigNum const * a,
BigNum const * b,
BigNumr 
)
+
+ +

Multiplies two BigNum values.

+
Parameters
+ + + + +
[in]aThe left hand parameter.
[in]bThe right hand parameter.
[out]rThe result of multiplying a and b.
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus BigNumSub (BigNum const * a,
BigNum const * b,
BigNumr 
)
+
+ +

Subtracts two BigNum values.

+
Parameters
+ + + + +
[in]aThe left hand parameter.
[in]bThe right hand parameter.
[out]rThe result of subtracting a and b.
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + +
void DeleteBigNum (BigNum ** bignum)
+
+ +

Deletes a previously allocated BigNum.

+

Frees memory pointed to by bignum. Nulls the pointer.

+
Parameters
+ + +
[in]bignumThe BigNum. Can be NULL.
+
+
+
See also
NewBigNum
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus NewBigNum (size_t data_size_bytes,
BigNum ** bignum 
)
+
+ +

Constructs a new BigNum.

+

Allocates memory and creates a new BigNum.

+

Use DeleteBigNum() to free memory.

+
Parameters
+ + + +
[in]data_size_bytesThe size in bytes of the new number.
[out]bignumThe BigNum.
+
+
+
Returns
EpidStatus
+
See also
DeleteBigNum
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus ReadBigNum (void const * bn_str,
size_t strlen,
BigNumbn 
)
+
+ +

Deserializes a BigNum from a string.

+
Parameters
+ + + + +
[in]bn_strThe serialized value.
[in]strlenThe size of bn_str in bytes.
[out]bnThe target BigNum.
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus WriteBigNum (BigNum const * bn,
size_t strlen,
void const * bn_str 
)
+
+ +

Serializes a BigNum to a string.

+
Parameters
+ + + + +
[in]bnThe BigNum to be serialized.
[in]strlenThe size of bn_str in bytes.
[out]bn_strThe target string.
+
+
+
Returns
EpidStatus
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___big_num_primitives.js b/external/epid/doc/html/group___big_num_primitives.js new file mode 100644 index 0000000000..d4354d5148 --- /dev/null +++ b/external/epid/doc/html/group___big_num_primitives.js @@ -0,0 +1,12 @@ +var group___big_num_primitives = +[ + [ "BigNum", "group___big_num_primitives.html#ga2bf153e27be2683f0fb26f0f7ff1f718", null ], + [ "BigNumAdd", "group___big_num_primitives.html#gae70fd9b3026f0ab3c7e9601d0a3186b8", null ], + [ "BigNumMod", "group___big_num_primitives.html#ga7dd6038987210d10bf843602fef0c929", null ], + [ "BigNumMul", "group___big_num_primitives.html#ga03c89b8b8dd87de2c0f4b5822145d317", null ], + [ "BigNumSub", "group___big_num_primitives.html#gacbec9669ab0fe768e2be74dcaca397ea", null ], + [ "DeleteBigNum", "group___big_num_primitives.html#ga2d17600068b1d94000635c6644258a03", null ], + [ "NewBigNum", "group___big_num_primitives.html#gad5f6f262bfd780fed3678bcee16f0aed", null ], + [ "ReadBigNum", "group___big_num_primitives.html#ga808cf477b70ed06358b11756bfe36024", null ], + [ "WriteBigNum", "group___big_num_primitives.html#ga47f356d816bcb5742ba6d78000861328", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___ec_group_primitives.html b/external/epid/doc/html/group___ec_group_primitives.html new file mode 100644 index 0000000000..de489f9e26 --- /dev/null +++ b/external/epid/doc/html/group___ec_group_primitives.html @@ -0,0 +1,1078 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: ecgroup + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecgroup
+
+
+ +

Elliptic curve group operations. +More...

+ + + + + + + + +

+Typedefs

+typedef struct EcGroup EcGroup
 Elliptic curve group over finite field.
 
+typedef struct EcPoint EcPoint
 Point on elliptic curve over finite field.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewEcGroup (FiniteField const *ff, FfElement const *a, FfElement const *b, FfElement const *x, FfElement const *y, BigNum const *order, BigNum const *cofactor, EcGroup **g)
 Constructs a new EcGroup. More...
 
void DeleteEcGroup (EcGroup **g)
 Deletes a previously allocated EcGroup. More...
 
EpidStatus NewEcPoint (EcGroup const *g, EcPoint **p)
 Creates a new EcPoint. More...
 
void DeleteEcPoint (EcPoint **p)
 Deletes a previously allocated EcPoint. More...
 
EpidStatus ReadEcPoint (EcGroup *g, void const *p_str, size_t strlen, EcPoint *p)
 Deserializes an EcPoint from a string. More...
 
EpidStatus WriteEcPoint (EcGroup *g, EcPoint const *p, void *p_str, size_t strlen)
 Serializes an EcPoint to a string. More...
 
EpidStatus EcMul (EcGroup *g, EcPoint const *a, EcPoint const *b, EcPoint *r)
 Multiplies two elements in an elliptic curve group. More...
 
EpidStatus EcExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
 Raises a point in an elliptic curve group to a power. More...
 
EpidStatus EcSscmExp (EcGroup *g, EcPoint const *a, BigNumStr const *b, EcPoint *r)
 Software side-channel mitigated implementation of EcExp. More...
 
EpidStatus EcMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
 Multi-exponentiates elements in elliptic curve group. More...
 
EpidStatus EcSscmMultiExp (EcGroup *g, EcPoint const **a, BigNumStr const **b, size_t m, EcPoint *r)
 Software side-channel mitigated implementation of EcMultiExp. More...
 
EpidStatus EcGetRandom (EcGroup *g, BitSupplier rnd_func, void *rnd_func_param, EcPoint *r)
 Generates a random element from an elliptic curve group. More...
 
EpidStatus EcInGroup (EcGroup *g, void const *p_str, size_t strlen, bool *in_group)
 Checks if a point is in an elliptic curve group. More...
 
EpidStatus EcHash (EcGroup *g, void const *msg, size_t msg_len, HashAlg hash_alg, EcPoint *r)
 Hashes an arbitrary message to an element in an elliptic curve group. More...
 
EpidStatus EcMakePoint (EcGroup *g, FfElement const *x, EcPoint *r)
 Sets an EcPoint variable to a point on a curve. More...
 
EpidStatus EcInverse (EcGroup *g, EcPoint const *p, EcPoint *r)
 Computes the additive inverse of an EcPoint. More...
 
EpidStatus EcIsEqual (EcGroup *g, EcPoint const *a, EcPoint const *b, bool *is_equal)
 Checks if two EcPoints are equal. More...
 
EpidStatus EcIsIdentity (EcGroup *g, EcPoint const *p, bool *is_identity)
 Checks if an EcPoint is the identity element. More...
 
+

Detailed Description

+

Elliptic curve group operations.

+

Provides APIs for working with Elliptic curve groups. Elliptic curve groups allow simple mathematical operations based on points that lie on a defined elliptic curve. The results of these operations also lie on the same curve.

+

Curves themselves are defined based on elements (FfElement) of a finite field (FiniteField).

+

Function Documentation

+ +
+
+ + + + + + + + +
void DeleteEcGroup (EcGroup ** g)
+
+ +

Deletes a previously allocated EcGroup.

+

Frees memory pointed to by elliptic curve group. Nulls the pointer.

+
Parameters
+ + +
[in]gThe elliptic curve group. Can be NULL.
+
+
+
See also
NewEcGroup
+ +
+
+ +
+
+ + + + + + + + +
void DeleteEcPoint (EcPoint ** p)
+
+ +

Deletes a previously allocated EcPoint.

+

Frees memory used by a point on elliptic curve group. Nulls the pointer.

+
Parameters
+ + +
[in]pThe EcPoint. Can be NULL.
+
+
+
See also
NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcExp (EcGroupg,
EcPoint const * a,
BigNumStr const * b,
EcPointr 
)
+
+ +

Raises a point in an elliptic curve group to a power.

+

This exponentiation operation is also known as element multiplication for elliptic curve groups.

Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]aThe base.
[in]bThe power. Power must be less than the order of the elliptic curve group.
[out]rThe result of raising a to the power b.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcGetRandom (EcGroupg,
BitSupplier rnd_func,
void * rnd_func_param,
EcPointr 
)
+
+ +

Generates a random element from an elliptic curve group.

+

This function is only available for G1 and GT.

+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]rnd_funcRandom number generator.
[in]rnd_func_paramPass through context data for rnd_func.
[in,out]rOutput random elliptic curve element.
+
+
+
Returns
EpidStatus
+
See also
NewEcPoint
+
+BitSupplier
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcHash (EcGroupg,
void const * msg,
size_t msg_len,
HashAlg hash_alg,
EcPointr 
)
+
+ +

Hashes an arbitrary message to an element in an elliptic curve group.

+
Parameters
+ + + + + + +
[in]gThe elliptic curve group.
[in]msgThe message.
[in]msg_lenThe size of msg in bytes.
[in]hash_algThe hash algorithm.
[out]rThe hashed value.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcInGroup (EcGroupg,
void const * p_str,
size_t strlen,
boolin_group 
)
+
+ +

Checks if a point is in an elliptic curve group.

+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]p_strA serialized point. Must be a G1ElemStr or G2ElemStr.
[in]strlenThe size of p_str in bytes.
[out]in_groupThe result of the check.
+
+
+
Returns
EpidStatus
+
See also
NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcInverse (EcGroupg,
EcPoint const * p,
EcPointr 
)
+
+ +

Computes the additive inverse of an EcPoint.

+

This inverse operation is also known as element negation for elliptic curve groups.

+
Parameters
+ + + + +
[in]gThe elliptic curve group.
[in]pThe point.
[out]rThe inverted point.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcIsEqual (EcGroupg,
EcPoint const * a,
EcPoint const * b,
boolis_equal 
)
+
+ +

Checks if two EcPoints are equal.

+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]aA point to check.
[in]bAnother point to check.
[out]is_equalThe result of the check.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcIsIdentity (EcGroupg,
EcPoint const * p,
boolis_identity 
)
+
+ +

Checks if an EcPoint is the identity element.

+

Takes a group element P as input. It outputs true if P is the identity element of G. Otherwise, it outputs false.

+
Parameters
+ + + + +
[in]gThe elliptic curve group.
[in]pThe point to check.
[out]is_identityThe result of the check.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcMakePoint (EcGroupg,
FfElement const * x,
EcPointr 
)
+
+ +

Sets an EcPoint variable to a point on a curve.

+

This function is only available for G1.

+
Parameters
+ + + + +
[in]gThe elliptic curve group.
[in]xThe x coordinate.
[out]rThe point.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcMul (EcGroupg,
EcPoint const * a,
EcPoint const * b,
EcPointr 
)
+
+ +

Multiplies two elements in an elliptic curve group.

+

This multiplication operation is also known as element addition for elliptic curve groups.

+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]aThe left hand parameter.
[in]bThe right hand parameter.
[out]rThe result of multiplying a and b.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcMultiExp (EcGroupg,
EcPoint const ** a,
BigNumStr const ** b,
size_t m,
EcPointr 
)
+
+ +

Multi-exponentiates elements in elliptic curve group.

+

Takes a group elements a[0], ... , a[m-1] in G and positive integers b[0], ..., b[m-1], where m is a small positive integer. Outputs r (in G) = EcExp(a[0],b[0]) * ... * EcExp(a[m-1],b[m-1]).

+
Parameters
+ + + + + + +
[in]gThe elliptic curve group.
[in]aThe bases.
[in]bThe powers. Power must be less than the order of the elliptic curve group.
[in]mNumber of entries in a and b.
[out]rThe result of raising each a to the corresponding power b and multiplying the results.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcSscmExp (EcGroupg,
EcPoint const * a,
BigNumStr const * b,
EcPointr 
)
+
+ +

Software side-channel mitigated implementation of EcExp.

+

This exponentiation operation is also known as element multiplication for elliptic curve groups.

+
Attention
The reference implementation of EcSscmExp calls EcExp directly because the implementation of EcExp is already side channel mitigated. Implementers providing their own versions of this function are responsible for ensuring that EcSscmExp is side channel mitigated per section 8 of the Intel(R) EPID 2.0 spec.
+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]aThe base.
[in]bThe power. Power must be less than the order of the elliptic curve group.
[out]rThe result of raising a to the power b.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcSscmMultiExp (EcGroupg,
EcPoint const ** a,
BigNumStr const ** b,
size_t m,
EcPointr 
)
+
+ +

Software side-channel mitigated implementation of EcMultiExp.

+

Takes a group elements a[0], ... , a[m-1] in G and positive integers b[0], ..., b[m-1], where m is a small positive integer. Outputs r (in G) = EcExp(a[0],b[0]) * ... * EcExp(a[m-1],b[m-1]).

+
Attention
The reference implementation of EcSscmMultiExp calls EcMultiExp directly because the implementation of EcMultiExp is already side channel mitigated. Implementers providing their own versions of this function are responsible for ensuring that EcSscmMultiExp is side channel mitigated per section 8 of the Intel(R) EPID 2.0 spec.
+
Parameters
+ + + + + + +
[in]gThe elliptic curve group.
[in]aThe bases.
[in]bThe powers. Power must be less than the order of the elliptic curve group.
[in]mNumber of entries in a and b.
[out]rThe result of raising each a to the corresponding power b and multiplying the results.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus NewEcGroup (FiniteField const * ff,
FfElement const * a,
FfElement const * b,
FfElement const * x,
FfElement const * y,
BigNum const * order,
BigNum const * cofactor,
EcGroup ** g 
)
+
+ +

Constructs a new EcGroup.

+

Allocates memory and creates a new elliptic curve group.

+

Use DeleteFiniteField() to free memory.

+
Parameters
+ + + + + + + + + +
[in]ffThe finite field on which the curve is based.
[in]aThe A value of the elliptic curve.
[in]bThe B value of the elliptic curve.
[in]xThe X co-ordinate of the base point of the elliptic curve.
[in]yThe Y co-ordinate of the base point of the elliptic curve.
[in]orderThe order of the elliptic curve group.
[in]cofactorThe co-factor of the elliptic curve.
[out]gThe newly constructed elliptic curve group.
+
+
+
Returns
EpidStatus
+
See also
DeleteEcGroup
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus NewEcPoint (EcGroup const * g,
EcPoint ** p 
)
+
+ +

Creates a new EcPoint.

+

Allocates memory and creates a new point on elliptic curve group.

+

Use DeleteEcPoint() to free memory.

+
Parameters
+ + + +
[in]gElliptic curve group.
[out]pNewly constructed point on the elliptic curve group g.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+DeleteEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus ReadEcPoint (EcGroupg,
void const * p_str,
size_t strlen,
EcPointp 
)
+
+ +

Deserializes an EcPoint from a string.

+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]p_strThe serialized value.
[in]strlenThe size of p_str in bytes.
[out]pThe target EcPoint.
+
+
+
Returns
EpidStatus
+
See also
NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus WriteEcPoint (EcGroupg,
EcPoint const * p,
void * p_str,
size_t strlen 
)
+
+ +

Serializes an EcPoint to a string.

+
Parameters
+ + + + + +
[in]gThe elliptic curve group.
[in]pThe EcPoint to be serialized.
[out]p_strThe target string.
[in]strlenthe size of p_str in bytes.
+
+
+
Returns
EpidStatus
+
See also
NewEcPoint
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___ec_group_primitives.js b/external/epid/doc/html/group___ec_group_primitives.js new file mode 100644 index 0000000000..bf32859b49 --- /dev/null +++ b/external/epid/doc/html/group___ec_group_primitives.js @@ -0,0 +1,23 @@ +var group___ec_group_primitives = +[ + [ "EcGroup", "group___ec_group_primitives.html#gac91c5a7623c17a868dd15b2e9aaf7159", null ], + [ "EcPoint", "group___ec_group_primitives.html#ga85c1d5e106031b385a6e23e598ac98fa", null ], + [ "DeleteEcGroup", "group___ec_group_primitives.html#gab7af276256c27610eda85ff432b846ea", null ], + [ "DeleteEcPoint", "group___ec_group_primitives.html#ga8cb086d792bffb79b3ca07e6ca4ce0e7", null ], + [ "EcExp", "group___ec_group_primitives.html#ga01bf8d6fa60a2e445490966b3a06c270", null ], + [ "EcGetRandom", "group___ec_group_primitives.html#ga3f96c43d14d24de0f7a5e214aef64196", null ], + [ "EcHash", "group___ec_group_primitives.html#gadc22ee07864a7ee681a881029b69d76a", null ], + [ "EcInGroup", "group___ec_group_primitives.html#ga4d0f32aede3066eae500241b387bd970", null ], + [ "EcInverse", "group___ec_group_primitives.html#ga0b6d7a3398251e9352fb29ef4abef466", null ], + [ "EcIsEqual", "group___ec_group_primitives.html#gad3b3c63c48fa24e8dea07837b05bc061", null ], + [ "EcIsIdentity", "group___ec_group_primitives.html#ga9cf15b34bc4ff12e58b169dd989d8210", null ], + [ "EcMakePoint", "group___ec_group_primitives.html#ga8a6114a48214a327d4ec04fd25e5940e", null ], + [ "EcMul", "group___ec_group_primitives.html#ga25c9013cc76907d73765eb7a96aa8c96", null ], + [ "EcMultiExp", "group___ec_group_primitives.html#gae96c38e004ccd2211290ad6e66415ec4", null ], + [ "EcSscmExp", "group___ec_group_primitives.html#gaf3b6a548aa6f0d4f028a14feca251f57", null ], + [ "EcSscmMultiExp", "group___ec_group_primitives.html#ga40e3431d3dbe8cf7a65ada7b7811cba4", null ], + [ "NewEcGroup", "group___ec_group_primitives.html#gaf4e23677dd378ef2e0cf55df79cbdb62", null ], + [ "NewEcPoint", "group___ec_group_primitives.html#ga6417b0ce72ba96de00c329e322fec7fb", null ], + [ "ReadEcPoint", "group___ec_group_primitives.html#ga2d433f567fa2419465a49604f4da21ad", null ], + [ "WriteEcPoint", "group___ec_group_primitives.html#ga4bb7d6691ffbb6e947c1068453e27fbd", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___ecdsa_primitives.html b/external/epid/doc/html/group___ecdsa_primitives.html new file mode 100644 index 0000000000..e1c37b9239 --- /dev/null +++ b/external/epid/doc/html/group___ecdsa_primitives.html @@ -0,0 +1,229 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: ecdsa + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
ecdsa
+
+
+ +

Elliptic Curve Digital Signature Algorithm Primitives. +More...

+ + + + + + + + +

+Functions

EpidStatus EcdsaVerifyBuffer (void const *buf, size_t buf_len, EcdsaPublicKey const *pubkey, EcdsaSignature const *sig)
 Verifies authenticity of a digital signature over a buffer. More...
 
EpidStatus EcdsaSignBuffer (void const *buf, size_t buf_len, EcdsaPrivateKey const *privkey, BitSupplier rnd_func, void *rnd_param, EcdsaSignature *sig)
 Creates ECDSA signature of buffer. More...
 
+

Detailed Description

+

Elliptic Curve Digital Signature Algorithm Primitives.

+

Provides APIs for computing and checking buffer signatures using the Elliptic Curve Digital Signature Algorithm.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcdsaSignBuffer (void const * buf,
size_t buf_len,
EcdsaPrivateKey const * privkey,
BitSupplier rnd_func,
void * rnd_param,
EcdsaSignaturesig 
)
+
+ +

Creates ECDSA signature of buffer.

+

Uses Elliptic Curve Digital Signature Algorithm (ECDSA) to generate a signature of the SHA256 hash of the input buffer with the provided private key.

+

The operation is over the standard secp256r1 curve.

+
Parameters
+ + + + + + + +
[in]bufPointer to buffer containing message to sign.
[in]buf_lenThe size of buf in bytes.
[in]privkeyThe ECDSA private key on secp256r1 curve.
[in]rnd_funcRandom number generator.
[in]rnd_paramPass through context data for rnd_func.
[out]sigThe resulting ECDSA signature.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidRandMaxIterErrFailed to sign after maximum number of iterations due to bad luck in random number generation.
+
+
+
See also
EcdsaSignBuffer
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EcdsaVerifyBuffer (void const * buf,
size_t buf_len,
EcdsaPublicKey const * pubkey,
EcdsaSignature const * sig 
)
+
+ +

Verifies authenticity of a digital signature over a buffer.

+

Uses Elliptic Curve Digital Signature Algorithm (ECDSA) to verify that the SHA256 hash of the input buffer was signed with the private key corresponding to the provided public key.

+

The operation is over the standard secp256r1 curve.

+
Warning
It is the responsibility of the caller to verify the identity of the public key.
+
Parameters
+ + + + + +
[in]bufPointer to buffer containing message to verify.
[in]buf_lenThe size of buf in bytes.
[in]pubkeyThe ECDSA public key on secp256r1 curve.
[in]sigThe ECDSA signature to be verified.
+
+
+
Returns
EpidStatus
+
Return values
+ + + +
kEpidSigValidEcdsaSignature is valid for the given buffer.
kEpidSigInvalidEcdsaSignature is invalid for the given buffer.
+
+
+
See also
EcdsaSignBuffer
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___ecdsa_primitives.js b/external/epid/doc/html/group___ecdsa_primitives.js new file mode 100644 index 0000000000..37f85bf007 --- /dev/null +++ b/external/epid/doc/html/group___ecdsa_primitives.js @@ -0,0 +1,5 @@ +var group___ecdsa_primitives = +[ + [ "EcdsaSignBuffer", "group___ecdsa_primitives.html#ga67091ecae643c1b8a0b0a4946eda7afe", null ], + [ "EcdsaVerifyBuffer", "group___ecdsa_primitives.html#gaab68de7291db6e42a01e99c2fa40057f", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_common.html b/external/epid/doc/html/group___epid_common.html new file mode 100644 index 0000000000..e0940043c1 --- /dev/null +++ b/external/epid/doc/html/group___epid_common.html @@ -0,0 +1,1066 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: common + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+ +
+ +

Common code shared between core sub-components. +More...

+ + + + + + + + + + + + + + + + + +

+Modules

 math
 Math Primitives and Group Operations.
 
 errors
 Error reporting interface.
 
 fileparser
 Parser for issuer material.
 
 print_utils
 Debug print routines.
 
 types
 SDK data types.
 
+ + + + + + + + + + + + + +

+Data Structures

struct  CommitValues
 Storage for values to create commitment in Sign and Verify algorithms. More...
 
struct  Epid2Params_
 Internal representation of Epid2Params. More...
 
struct  GroupPubKey_
 Internal representation of GroupPubKey. More...
 
struct  PrivKey_
 Internal implementation of PrivKey. More...
 
+ + + + + + + + + + + + + + + + +

+Macros

#define ntohl(u32)
 Macros to transform oct str 32 into uint_32. More...
 
+#define EPID_ENABLE_EPID_ZERO_MEMORY_ON_FREE
 When enabled secrets are wiped out from the memory by EpidFree.
 
+#define SAFE_ALLOC(size)   EpidAlloc(size);
 Allocates zero initalized block of memory.
 
#define SAFE_FREE(ptr)
 Deallocates space allocated by SAFE_ALLOC() and nulls pointer. More...
 
+#define SAFE_REALLOC(ptr, size)   EpidRealloc((ptr), (size))
 Changes the size of the memory block pointed to by ptr.
 
+ + + + +

+Typedefs

typedef int(__STDCALL * BitSupplier) (unsigned int *rand_data, int num_bits, void *user_data)
 Generates random data. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus SetKeySpecificCommitValues (GroupPubKey const *pub_key, CommitValues *values)
 Set group public key related fields from CommitValues structure. More...
 
EpidStatus SetCalculatedCommitValues (G1ElemStr const *B, G1ElemStr const *K, G1ElemStr const *T, EcPoint const *R1, EcGroup *G1, FfElement const *R2, FiniteField *GT, CommitValues *values)
 Set CommitValues structure fields calculated in algorithm. More...
 
EpidStatus CalculateCommitmentHash (CommitValues const *values, FiniteField *Fp, HashAlg hash_alg, void const *msg, size_t msg_len, FfElement *c)
 Calculate Fp.hash(t3 || m) for Sign and Verfiy algorithms. More...
 
EpidStatus CreateEpid2Params (Epid2Params_ **params)
 Constructs the internal representation of Epid2Params. More...
 
void DeleteEpid2Params (Epid2Params_ **epid_params)
 Deallocates storage for internal representation of Epid2Params. More...
 
EpidStatus CreateGroupPubKey (GroupPubKey const *pub_key_str, EcGroup *G1, EcGroup *G2, GroupPubKey_ **pub_key)
 Constructs internal representation of GroupPubKey. More...
 
void DeleteGroupPubKey (GroupPubKey_ **pub_key)
 Deallocates storage for internal representation of GroupPubKey. More...
 
void EpidZeroMemory (void *ptr, size_t size)
 Clear information stored in block of memory pointer to by ptr. More...
 
void * EpidAlloc (size_t size)
 Allocates memory of size bytes. More...
 
void * EpidRealloc (void *ptr, size_t new_size)
 Reallocates memory allocated by EpidAlloc. More...
 
void EpidFree (void *ptr)
 Frees memory allocated by EpidAlloc. More...
 
int memcpy_S (void *dest, size_t destsz, void const *src, size_t count)
 Copies bytes between buffers with security ehancements. More...
 
bool IsSigRlValid (GroupId const *gid, SigRl const *sig_rl, size_t sig_rl_size)
 Function to verify if signature based revocation list is valid. More...
 
bool CreateStack (size_t element_size, Stack **stack)
 Create stack. More...
 
void * StackPushN (Stack *stack, size_t n, void *elements)
 Push multiple elements to the stack. More...
 
bool StackPopN (Stack *stack, size_t n, void *elements)
 Pop multiple elements from the stack. More...
 
size_t StackGetSize (Stack const *stack)
 Get number of elements in the stack. More...
 
void DeleteStack (Stack **stack)
 Deallocates memory used for the stack. More...
 
EpidStatus CreatePrivKey (PrivKey const *priv_key_str, EcGroup *G1, FiniteField *Fp, PrivKey_ **priv_key)
 Constructs internal representation of PrivKey. More...
 
void DeletePrivKey (PrivKey_ **priv_key)
 Deallocate storage for internal representation of PrivKey. More...
 
+

Detailed Description

+

Common code shared between core sub-components.

+

Constants, utility functions, and libraries that are used widely in the implementation or definition of APIs and samples.

+

Macro Definition Documentation

+ +
+
+ + + + + + + + +
#define ntohl( u32)
+
+Value:
((uint32_t)(((((unsigned char*)&(u32))[0]) << 24) + \
((((unsigned char*)&(u32))[1]) << 16) + \
((((unsigned char*)&(u32))[2]) << 8) + \
(((unsigned char*)&(u32))[3])))
+

Macros to transform oct str 32 into uint_32.

+ +
+
+ +
+
+ + + + + + + + +
#define SAFE_FREE( ptr)
+
+Value:
{ \
if (NULL != (ptr)) { \
EpidFree(ptr); \
(ptr) = NULL; \
} \
}
+

Deallocates space allocated by SAFE_ALLOC() and nulls pointer.

+ +
+
+

Typedef Documentation

+ +
+
+ + + + +
typedef int(__STDCALL* BitSupplier) (unsigned int *rand_data, int num_bits, void *user_data)
+
+ +

Generates random data.

+

It is the responsibility of the caller of the SDK interfaces to implement a function of this prototype and to then pass a pointer to this function into methods that require it.

+
Parameters
+ + + + +
[out]rand_datadestination buffer
[in]num_bitssize of rand_data in bits
[in]user_datauser data passed through from api call.
+
+
+
Returns
zero on success and non-zero value on error.
+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus CalculateCommitmentHash (CommitValues const * values,
FiniteFieldFp,
HashAlg hash_alg,
void const * msg,
size_t msg_len,
FfElementc 
)
+
+ +

Calculate Fp.hash(t3 || m) for Sign and Verfiy algorithms.

+

Calculate c = Fp.hash(t3 || m) where t3 is Fp.hash(p || g1 || g2 || h1 || h2 || w || B || K || T || R1 || R2).

+
Parameters
+ + + + + + + +
[in]valuesCommit values to hash
[in]FpFinite field to perfom hash operation in
[in]hash_algHash algorithm to use
[in]msgMessage to hash
[in]msg_lenSize of msg buffer in bytes
[out]cResult of calculation
+
+
+
Returns
EpidStatus
+
See also
SetKeySpecificCommitValues
+
+SetCalculatedCommitValues
+ +
+
+ +
+
+ + + + + + + + +
EpidStatus CreateEpid2Params (Epid2Params_ ** params)
+
+ +

Constructs the internal representation of Epid2Params.

+

Allocates memory for the internal representation of Epid2Params. Initialize the Epid2Params. Use DeleteEpid2Params() to deallocate memory.

+
Parameters
+ + +
[in,out]paramsInternal Epid2Params
+
+
+
Returns
EpidStatus
+
See also
DeleteEpid2Params
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus CreateGroupPubKey (GroupPubKey const * pub_key_str,
EcGroupG1,
EcGroupG2,
GroupPubKey_ ** pub_key 
)
+
+ +

Constructs internal representation of GroupPubKey.

+

Allocates memory and initializes gid, h1, h2, w parameters. Use DeleteGroupPubKey() to deallocate memory

+
Parameters
+ + + + + +
[in]pub_key_strOct string representation of group public key
[in]G1EcGroup containing elements h1 and h2
[in]G2EcGroup containing element w
[out]pub_keyGroup public key: (gid, h1, h2, w)
+
+
+
Returns
EpidStatus
+
See also
DeleteGroupPubKey
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus CreatePrivKey (PrivKey const * priv_key_str,
EcGroupG1,
FiniteFieldFp,
PrivKey_ ** priv_key 
)
+
+ +

Constructs internal representation of PrivKey.

+

This function allocates memory and initializes gid, A, x, f parameters.

+
Parameters
+ + + + + +
[in]priv_key_strSerialized representation of private key
[in]G1EcGroup containing element A
[in]FpFiniteField containing elements x and f
[out]priv_keyNewly created private key: (gid, A, x, f)
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool CreateStack (size_t element_size,
Stack ** stack 
)
+
+ +

Create stack.

+
Parameters
+ + + +
[in]element_sizeSize of stack element
[out]stackStack context to be created
+
+
+
Returns
true is operation succeed, false if stack were failed to allocate
+
See also
DeleteStack
+ +
+
+ +
+
+ + + + + + + + +
void DeleteEpid2Params (Epid2Params_ ** epid_params)
+
+ +

Deallocates storage for internal representation of Epid2Params.

+

Frees the memory and nulls the pointer.

+
Parameters
+ + +
[in,out]epid_paramsparams to be deallocated
+
+
+
See also
CreateEpid2Params
+ +
+
+ +
+
+ + + + + + + + +
void DeleteGroupPubKey (GroupPubKey_ ** pub_key)
+
+ +

Deallocates storage for internal representation of GroupPubKey.

+

Frees memory pointed to by Group public key. Nulls the pointer.

+
Parameters
+ + +
[in]pub_keyGroup public key to be freed
+
+
+
See also
CreateGroupPubKey
+ +
+
+ +
+
+ + + + + + + + +
void DeletePrivKey (PrivKey_ ** priv_key)
+
+ +

Deallocate storage for internal representation of PrivKey.

+

Frees memory pointed to by Member private key. Nulls the pointer.

+
Parameters
+ + +
[in]priv_keyMember private key to be freed
+
+
+ +
+
+ +
+
+ + + + + + + + +
void DeleteStack (Stack ** stack)
+
+ +

Deallocates memory used for the stack.

+
Parameters
+ + +
[in,out]stackStack context
+
+
+
See also
CreateStack
+ +
+
+ +
+
+ + + + + + + + +
void* EpidAlloc (size_t size)
+
+ +

Allocates memory of size bytes.

+

The content of memory is initialized with zeros. Memory must be freed with EpidFree function.

+
Parameters
+ + +
[in]sizenumber of bytes to allocate
+
+
+
Returns
pointer to allocated memory.
+ +
+
+ +
+
+ + + + + + + + +
void EpidFree (void * ptr)
+
+ +

Frees memory allocated by EpidAlloc.

+

Clears information stored in the block of memory.

+
Parameters
+ + +
[in]ptrpointer to allocated memory block
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void* EpidRealloc (void * ptr,
size_t new_size 
)
+
+ +

Reallocates memory allocated by EpidAlloc.

+

In case of error NULL pointer is returned and input memory block is not changed. Memory must be freed with EpidFree function.

+
Parameters
+ + + +
[in]ptrpointer to memory block to reallocate
[in]new_sizenumber of bytes to reallocate for
+
+
+
Returns
pointer to allocated memory.
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void EpidZeroMemory (void * ptr,
size_t size 
)
+
+ +

Clear information stored in block of memory pointer to by ptr.

+
Warning
This function may be optimized away by some compilers. If it is, you should consider using a compiler or operating system specific memory sanitization function (e.g. memcpy_s or SecureZeroMemory).
+
Parameters
+ + + +
[in]ptrpointer to memory block
[in]sizenumber of bytes to clear
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool IsSigRlValid (GroupId const * gid,
SigRl const * sig_rl,
size_t sig_rl_size 
)
+
+ +

Function to verify if signature based revocation list is valid.

+
Parameters
+ + + + +
[in]gidGroup id
[in]sig_rlSignature based revocation list
[in]sig_rl_sizeSize of signature based revocation list
+
+
+
Returns
true if revocation list is valid
+
+false if revocation list is invalid
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int memcpy_S (void * dest,
size_t destsz,
void const * src,
size_t count 
)
+
+ +

Copies bytes between buffers with security ehancements.

+

Copies count bytes from src to dest. If the source and destination overlap, the behavior is undefined.

+
Parameters
+ + + + + +
[out]destpointer to the object to copy to
[in]destszmax number of bytes to modify in the destination (typically the size of the destination object)
[in]srcpointer to the object to copy from
[in]countnumber of bytes to copy
+
+
+
Returns
zero on success and non-zero value on error.
+

Copies bytes between buffers with security ehancements.

+
Note
Implementation follows C11 memcpy_s but with checks always enabled
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus SetCalculatedCommitValues (G1ElemStr const * B,
G1ElemStr const * K,
G1ElemStr const * T,
EcPoint const * R1,
EcGroupG1,
FfElement const * R2,
FiniteFieldGT,
CommitValuesvalues 
)
+
+ +

Set CommitValues structure fields calculated in algorithm.

+

Set B, K, T, R1 and R2 fields of values argument.

+
Parameters
+ + + + + + + + + +
[in]BValue of B to set
[in]KValue of K to set
[in]TValue of T to set
[in]R1Value of R1 to set
[in]G1EcGroup containing element R1
[in]R2Value of R2 to set
[in]GTFiniteField containing element R2
[out]valuesPointer to CommitValues structure to fill.
+
+
+
Returns
EpidStatus
+
See also
CalculateCommitmentHash
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus SetKeySpecificCommitValues (GroupPubKey const * pub_key,
CommitValuesvalues 
)
+
+ +

Set group public key related fields from CommitValues structure.

+

Set p, g1, g2, h1, h2 and w fields of values argument.

+
Parameters
+ + + +
[in]pub_keyGroup public key
[out]valuesPointer to CommitValues structure to fill.
+
+
+
Returns
EpidStatus
+
See also
CalculateCommitmentHash
+ +
+
+ +
+
+ + + + + + + + +
size_t StackGetSize (Stack const * stack)
+
+ +

Get number of elements in the stack.

+
Parameters
+ + +
[in]stackStack context
+
+
+
Returns
Number of elements in the stack or 0 if stack is NULL
+
See also
CreateStack
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool StackPopN (Stackstack,
size_t n,
void * elements 
)
+
+ +

Pop multiple elements from the stack.

+
Parameters
+ + + + +
[in,out]stackStack context
[in]nNumber of elements to pop from the stack
[out]elementsPointer to a buffer to store elements removed from the stack
+
+
+
Returns
true is operation succeed, false otherwise
+
See also
CreateStack
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void* StackPushN (Stackstack,
size_t n,
void * elements 
)
+
+ +

Push multiple elements to the stack.

+
Parameters
+ + + + +
[in,out]stackStack context
[in]nNumber of elements to push to the stack
[in]elementsArray of elements to push to the stack. Can be NULL
+
+
+
Returns
A pointer to an array of new elements in the stack or NULL if stack is empty or push operation were failed.
+
See also
CreateStack
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_common.js b/external/epid/doc/html/group___epid_common.js new file mode 100644 index 0000000000..78783bcfb6 --- /dev/null +++ b/external/epid/doc/html/group___epid_common.js @@ -0,0 +1,76 @@ +var group___epid_common = +[ + [ "math", "group___epid_math.html", "group___epid_math" ], + [ "errors", "group___error_codes.html", "group___error_codes" ], + [ "fileparser", "group___file_parser.html", "group___file_parser" ], + [ "print_utils", "group___epid_print.html", "group___epid_print" ], + [ "types", "group___epid_types.html", "group___epid_types" ], + [ "CommitValues", "struct_commit_values.html", [ + [ "B", "struct_commit_values.html#abc97167d51a8d0669da9a8d97353db4d", null ], + [ "g1", "struct_commit_values.html#a22512a6efa7b7b0277b211be64f71c30", null ], + [ "g2", "struct_commit_values.html#af7022c18732bbee8c12328923a4a12a1", null ], + [ "h1", "struct_commit_values.html#a42297d157420f0b554bce8a8cbe95c46", null ], + [ "h2", "struct_commit_values.html#a4a93cb984bac3de47bb60511b382a074", null ], + [ "K", "struct_commit_values.html#a49f073d0132a51020c0bfc819ec0d619", null ], + [ "p", "struct_commit_values.html#af5bf0f288e76f28ce54fe2df813881ef", null ], + [ "R1", "struct_commit_values.html#a00f7731d75085be08f171771c8f43d30", null ], + [ "R2", "struct_commit_values.html#acb0d12e761fadb149924cdf21290b9bf", null ], + [ "T", "struct_commit_values.html#ab2da47fe5c28b4202658c5ad3523ea1a", null ], + [ "w", "struct_commit_values.html#ac00af9d3eeb74543808a9e52e692f614", null ] + ] ], + [ "Epid2Params_", "struct_epid2_params__.html", [ + [ "Fp", "struct_epid2_params__.html#a45d742532485af7f34d43606a3f96b5d", null ], + [ "Fq", "struct_epid2_params__.html#a9cd99a40a7427666ff4b940ed69f69a0", null ], + [ "Fq2", "struct_epid2_params__.html#aebda3f9b5ed6f015adc992216bacf29f", null ], + [ "Fq6", "struct_epid2_params__.html#af3e9afc48ec8274f15d10f5f991c0937", null ], + [ "g1", "struct_epid2_params__.html#a337490f043e867b6c8d92180a9120541", null ], + [ "G1", "struct_epid2_params__.html#ade20ba985bc9219832df78ee9d255ee5", null ], + [ "g2", "struct_epid2_params__.html#a20dcfa40dba6679f45f1b90a91791a5c", null ], + [ "G2", "struct_epid2_params__.html#ae15ab066b26bbf1be8772743d604c766", null ], + [ "GT", "struct_epid2_params__.html#ac085cbd970d89fb382b621fb2884e420", null ], + [ "neg", "struct_epid2_params__.html#a1e50604a1739e48e8588d666d33d03ef", null ], + [ "p", "struct_epid2_params__.html#ad90e9f295e28d3f93852e87e97640e76", null ], + [ "pairing_state", "struct_epid2_params__.html#a74aa52f336a194b20627f8a540196dd5", null ], + [ "q", "struct_epid2_params__.html#a6d56c3f4dff7e92a0738e7866208bf4d", null ], + [ "t", "struct_epid2_params__.html#a4bca3d05a46b1325ac2490ebeb460543", null ], + [ "xi", "struct_epid2_params__.html#a51a678f0f26804e0c6f3a4c55fcf6731", null ] + ] ], + [ "GroupPubKey_", "struct_group_pub_key__.html", [ + [ "gid", "struct_group_pub_key__.html#afd2192bfd1e24c09951d9c0200a74f95", null ], + [ "h1", "struct_group_pub_key__.html#a2322bc1b42f85e0d01b50b15d064f840", null ], + [ "h2", "struct_group_pub_key__.html#a4d95b831d9a66071092678547df921ae", null ], + [ "w", "struct_group_pub_key__.html#a4d1537e5bd834b6fc92eb2fd7c826329", null ] + ] ], + [ "PrivKey_", "struct_priv_key__.html", [ + [ "A", "struct_priv_key__.html#aaf02af1379a0801f49a3f8845e7a1b1f", null ], + [ "f", "struct_priv_key__.html#a183eb6658baec9825313ab534608fa10", null ], + [ "gid", "struct_priv_key__.html#a0892f451bb967dd7c99fe1d926d5056f", null ], + [ "x", "struct_priv_key__.html#a327d7192cbb6b5638e3f6f1c3d9d2d5b", null ] + ] ], + [ "EPID_ENABLE_EPID_ZERO_MEMORY_ON_FREE", "group___epid_common.html#gab1587898f15de1b51cd5e799a43465ff", null ], + [ "ntohl", "group___epid_common.html#ga29a7e07cd5181e738f98fc026979efca", null ], + [ "SAFE_ALLOC", "group___epid_common.html#ga38fad13430eba25f9f9b05e35ecd22f8", null ], + [ "SAFE_FREE", "group___epid_common.html#ga2ca3c202ee727774d55890e568621842", null ], + [ "SAFE_REALLOC", "group___epid_common.html#ga41c113e15b695291199c27fac4bd53fa", null ], + [ "BitSupplier", "group___epid_common.html#ga6119a2c0323a3fca9e502b24bc378c2c", null ], + [ "CalculateCommitmentHash", "group___epid_common.html#ga23f8ea0f7529e8e7a81bd88e607dda01", null ], + [ "CreateEpid2Params", "group___epid_common.html#ga5c396a5ac8a0e5ec1e02330c53420dce", null ], + [ "CreateGroupPubKey", "group___epid_common.html#ga20a575d3d538b0bac654fd57f20e2b30", null ], + [ "CreatePrivKey", "group___epid_common.html#gae51985a0e811f4bbb2d70b62e35b881e", null ], + [ "CreateStack", "group___epid_common.html#ga00cb25d52726cef61a9a5266176c2a58", null ], + [ "DeleteEpid2Params", "group___epid_common.html#gac22664b5f7df5cd4da1bd7b1b1e7912f", null ], + [ "DeleteGroupPubKey", "group___epid_common.html#ga07c9b47d326ee784aecb78195adffb8b", null ], + [ "DeletePrivKey", "group___epid_common.html#ga53db100214e65e362fa426508a240d12", null ], + [ "DeleteStack", "group___epid_common.html#ga3335a4754825c54840263aa4b2a9bf67", null ], + [ "EpidAlloc", "group___epid_common.html#gada170fd890504b013139f4a33033ae4b", null ], + [ "EpidFree", "group___epid_common.html#gaeae76709e6bfc80c9d79ec4943ccc1ac", null ], + [ "EpidRealloc", "group___epid_common.html#ga6911838728d546e4a51d7bcb8404525c", null ], + [ "EpidZeroMemory", "group___epid_common.html#gad471f600f6032f432b99432fda97a070", null ], + [ "IsSigRlValid", "group___epid_common.html#ga23ec3f6c8b89eb63e04d2b1ec6fd2696", null ], + [ "memcpy_S", "group___epid_common.html#ga4856121ac4bce4161a015a8a2b4f5b1c", null ], + [ "SetCalculatedCommitValues", "group___epid_common.html#ga3f3c3b965dd714179cbc2f8d96678ee0", null ], + [ "SetKeySpecificCommitValues", "group___epid_common.html#ga2d54f4f222e965222024113c0420602d", null ], + [ "StackGetSize", "group___epid_common.html#gab34066dc882ad63362c43c0790973fdc", null ], + [ "StackPopN", "group___epid_common.html#ga8cdde2b366f4473f0a6965bcfea5b6a6", null ], + [ "StackPushN", "group___epid_common.html#ga0b4dedb867504e0148aa0e1fdf642b2b", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_math.html b/external/epid/doc/html/group___epid_math.html new file mode 100644 index 0000000000..574d7260c3 --- /dev/null +++ b/external/epid/doc/html/group___epid_math.html @@ -0,0 +1,106 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: math + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
math
+
+
+ +

Math Primitives and Group Operations. +More...

+ + + + + + + + + + + + + + + + + + + + +

+Modules

 bignum
 Big number operations.
 
 ecdsa
 Elliptic Curve Digital Signature Algorithm Primitives.
 
 ecgroup
 Elliptic curve group operations.
 
 finitefield
 Finite field operations.
 
 hash
 Hash primitives.
 
 pairing
 Pairing operations.
 
+

Detailed Description

+

Math Primitives and Group Operations.

+

Provides abstracted math primitives that are designed to be overridden by implementers porting to environments with specialized hardware. This module is defined and tested to hide implementation details from users of the API

+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_math.js b/external/epid/doc/html/group___epid_math.js new file mode 100644 index 0000000000..c416f54486 --- /dev/null +++ b/external/epid/doc/html/group___epid_math.js @@ -0,0 +1,9 @@ +var group___epid_math = +[ + [ "bignum", "group___big_num_primitives.html", "group___big_num_primitives" ], + [ "ecdsa", "group___ecdsa_primitives.html", "group___ecdsa_primitives" ], + [ "ecgroup", "group___ec_group_primitives.html", "group___ec_group_primitives" ], + [ "finitefield", "group___finite_field_primitives.html", "group___finite_field_primitives" ], + [ "hash", "group___hash_primitives.html", "group___hash_primitives" ], + [ "pairing", "group___pairing_primitives.html", "group___pairing_primitives" ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_member_module.html b/external/epid/doc/html/group___epid_member_module.html new file mode 100644 index 0000000000..898d1c9185 --- /dev/null +++ b/external/epid/doc/html/group___epid_member_module.html @@ -0,0 +1,933 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: member + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
member
+
+
+ +

Member functionality. +More...

+ + + + + + + + +

+Data Structures

struct  MemberPrecomp
 Pre-computed member settings. More...
 
struct  PreComputedSignature
 Pre-computed signature. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus EpidMemberCreate (GroupPubKey const *pub_key, PrivKey const *priv_key, MemberPrecomp const *precomp, BitSupplier rnd_func, void *rnd_param, MemberCtx **ctx)
 Creates a new member context. More...
 
void EpidMemberDelete (MemberCtx **ctx)
 Deletes an existing member context. More...
 
EpidStatus EpidMemberWritePrecomp (MemberCtx const *ctx, MemberPrecomp *precomp)
 Serializes the pre-computed member settings. More...
 
EpidStatus EpidMemberSetHashAlg (MemberCtx *ctx, HashAlg hash_alg)
 Sets the hash algorithm to be used by a member. More...
 
size_t EpidGetSigSize (SigRl const *sig_rl)
 Computes the size in bytes required for a Intel(R) EPID signature. More...
 
EpidStatus EpidSign (MemberCtx const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, SigRl const *sig_rl, size_t sig_rl_size, EpidSignature *sig, size_t sig_len)
 Writes a Intel(R) EPID signature. More...
 
EpidStatus EpidRegisterBaseName (MemberCtx *ctx, void const *basename, size_t basename_len)
 Registers a basename with a member. More...
 
EpidStatus EpidAddPreSigs (MemberCtx *ctx, size_t number_presigs, PreComputedSignature *presigs)
 Extends the member's pool of pre-computed signatures. More...
 
size_t EpidGetNumPreSigs (MemberCtx const *ctx)
 Gets the number of pre-computed signatures in the member's pool. More...
 
EpidStatus EpidWritePreSigs (MemberCtx *ctx, PreComputedSignature *presigs, size_t number_presigs)
 Serializes pre-computed signatures from the member's pool. More...
 
EpidStatus EpidRequestJoin (GroupPubKey const *pub_key, IssuerNonce const *ni, FpElemStr const *f, BitSupplier rnd_func, void *rnd_param, HashAlg hash_alg, JoinRequest *join_request)
 Creates a request to join a group. More...
 
EpidStatus EpidSignBasic (MemberCtx const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, BasicSignature *sig)
 Creates a basic signature for use in constrained environment. More...
 
EpidStatus EpidNrProve (MemberCtx const *ctx, void const *msg, size_t msg_len, BasicSignature const *sig, SigRlEntry const *sigrl_entry, NrProof *proof)
 Calculates a non-revoked proof for a single signature based revocation list entry. More...
 
bool EpidIsPrivKeyInGroup (GroupPubKey const *pub_key, PrivKey const *priv_key)
 Tests if a member private key is valid without checking revocation. More...
 
EpidStatus EpidDecompressPrivKey (GroupPubKey const *pub_key, CompressedPrivKey const *compressed_privkey, PrivKey *priv_key)
 Decompresses compressed member private key. More...
 
+

Detailed Description

+

Member functionality.

+

Defines the APIs needed by Intel(R) EPID members. Each member context (MemberCtx) represents membership in a single group.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidAddPreSigs (MemberCtxctx,
size_t number_presigs,
PreComputedSignaturepresigs 
)
+
+ +

Extends the member's pool of pre-computed signatures.

+

Can either generate new pre-computed signatures or import existing ones. EpidWritePreSigs can be used to export pre-computed signatures.

+
Parameters
+ + + + +
[in]ctxThe member context.
[in]number_presigsThe number of pre-computed signatures to add to the internal pool.
[in,out]presigsOptional array of valid pre-computed signatures to import. If presigs is not NULL it most contain at least number_presigs pre-computed signatures.
+
+
+
Returns
EpidStatus
+
Note
presigs buffer is zeroed out before return to prevent pre-computed signatures from being reused.
+
+If the result is not kEpidNoErr the state of the pre-computed signature pool, and of presigs, is undefined.
+
See also
EpidMemberCreate
+
+EpidWritePreSigs
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidDecompressPrivKey (GroupPubKey const * pub_key,
CompressedPrivKey const * compressed_privkey,
PrivKeypriv_key 
)
+
+ +

Decompresses compressed member private key.

+

Converts a compressed member private key into a member private key for use by other member APIs.

+
Parameters
+ + + + +
[in]pub_keyThe public key of the group.
[in]compressed_privkeyThe compressed member private key to be decompressed.
[out]priv_keyThe member private key.
+
+
+
Returns
EpidStatus
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + +
size_t EpidGetNumPreSigs (MemberCtx const * ctx)
+
+ +

Gets the number of pre-computed signatures in the member's pool.

+
Parameters
+ + +
[in]ctxThe member context.
+
+
+
Returns
Number of remaining pre-computed signatures. Returns 0 if ctx is NULL.
+
See also
EpidMemberCreate
+
+EpidWritePreSigs
+ +
+
+ +
+
+ + + + + + + + +
size_t EpidGetSigSize (SigRl const * sig_rl)
+
+ +

Computes the size in bytes required for a Intel(R) EPID signature.

+
Parameters
+ + +
[in]sig_rlThe signature based revocation list that is used. NULL is treated as a zero length list.
+
+
+
Returns
Size in bytes of an Intel(R) EPID signature including proofs for each entry in the signature based revocation list.
+
See also
SigRl
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool EpidIsPrivKeyInGroup (GroupPubKey const * pub_key,
PrivKey const * priv_key 
)
+
+ +

Tests if a member private key is valid without checking revocation.

+

Used to check that a member private key is a valid key for a group. This is useful as a cross check when creating a new member private key as part of the join process

+
Parameters
+ + + +
[in]pub_keyThe public key of the group.
[in]priv_keyThe private key to check.
+
+
+
Returns
bool
+
Return values
+ + + +
trueif the private key is valid for the group of the public key
falseif the private key is not valid for the group of the public key
+
+
+
See also
EpidRequestJoin
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidMemberCreate (GroupPubKey const * pub_key,
PrivKey const * priv_key,
MemberPrecomp const * precomp,
BitSupplier rnd_func,
void * rnd_param,
MemberCtx ** ctx 
)
+
+ +

Creates a new member context.

+

Must be called to create the member context that is used by other "Member" APIs.

+

Allocates memory for the context, then initializes it.

+

EpidMemberDelete() must be called to safely release the member context.

+
Parameters
+ + + + + + + +
[in]pub_keyThe group certificate.
[in]priv_keyThe member private key.
[in]precompOptional pre-computed data. If NULL the value is computed internally and is readable using EpidMemberWritePrecomp().
[in]rnd_funcRandom number generator.
[in]rnd_paramPass through context data for rnd_func.
[out]ctxNewly constructed member context.
+
+
+
Returns
EpidStatus
+
Warning
For security rnd_func should be a cryptographically secure random number generator.
+
Note
If the result is not kEpidNoErr the content of ctx is undefined.
+
See also
EpidMemberDelete
+
+EpidMemberWritePrecomp
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + +
void EpidMemberDelete (MemberCtx ** ctx)
+
+ +

Deletes an existing member context.

+

Must be called to safely release a member context created using EpidMemberCreate().

+

De-initializes the context, frees memory used by the context, and sets the context pointer to NULL.

+
Parameters
+ + +
[in,out]ctxThe member context. Can be NULL.
+
+
+
See also
EpidMemberCreate
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus EpidMemberSetHashAlg (MemberCtxctx,
HashAlg hash_alg 
)
+
+ +

Sets the hash algorithm to be used by a member.

+
Parameters
+ + + +
[in]ctxThe member context.
[in]hash_algThe hash algorithm to use.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr, the hash algorithm used by the member is undefined.
+
See also
EpidMemberCreate
+
+HashAlg
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus EpidMemberWritePrecomp (MemberCtx const * ctx,
MemberPrecompprecomp 
)
+
+ +

Serializes the pre-computed member settings.

+
Parameters
+ + + +
[in]ctxThe member context.
[out]precompThe Serialized pre-computed member settings.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr, the content of precomp is undefined.
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidNrProve (MemberCtx const * ctx,
void const * msg,
size_t msg_len,
BasicSignature const * sig,
SigRlEntry const * sigrl_entry,
NrProofproof 
)
+
+ +

Calculates a non-revoked proof for a single signature based revocation list entry.

+

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

+
Parameters
+ + + + + + + +
[in]ctxThe member context.
[in]msgThe message.
[in]msg_lenThe length of message in bytes.
[in]sigThe basic signature.
[in]sigrl_entryThe signature based revocation list entry.
[out]proofThe generated non-revoked proof.
+
+
+
Returns
EpidStatus
+
Note
This function should be used in conjunction with EpidSignBasic().
+
+If the result is not kEpidNoErr, the content of proof is undefined.
+
See also
EpidMemberCreate
+
+EpidSignBasic
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidRegisterBaseName (MemberCtxctx,
void const * basename,
size_t basename_len 
)
+
+ +

Registers a basename with a member.

+

To prevent loss of privacy, the member keeps a list of basenames (corresponding to authorized verifiers). The member signs a message with a basename only if the basename is in the member's basename list.

+
Warning
The use of a name-based signature creates a platform unique pseudonymous identifier. Because it reduces the member's privacy, the user should be notified when it is used and should have control over its use.
+
Parameters
+ + + + +
[in]ctxThe member context.
[in]basenameThe basename.
[in]basename_lenLength of the basename.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidDuplicateErrThe basename was already registered.
+
+
+
Note
If the result is not kEpidNoErr or kEpidDuplicateErr it is undefined if the basename is registered.
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidRequestJoin (GroupPubKey const * pub_key,
IssuerNonce const * ni,
FpElemStr const * f,
BitSupplier rnd_func,
void * rnd_param,
HashAlg hash_alg,
JoinRequestjoin_request 
)
+
+ +

Creates a request to join a group.

+

The created request is part of the interaction with an issuer needed to join a group. This interaction with the issuer is outside the scope of this API.

+
Parameters
+ + + + + + + + +
[in]pub_keyThe group certificate of group to join.
[in]niThe nonce chosen by issuer as part of join protocol.
[in]fA randomly selected integer in [1, p-1].
[in]rnd_funcRandom number generator.
[in]rnd_paramPass through context data for rnd_func.
[in]hash_algThe hash algorithm to be used.
[out]join_requestThe join request.
+
+
+
Returns
EpidStatus
+
Warning
For security rnd_func should be a cryptographically secure random number generator.
+
Note
The default hash algorithm in Member is SHA-512. This is the recommended option if you do not override the hash algorithm elsewhere.
+
+If the result is not kEpidNoErr, the content of join_request is undefined.
+
See also
HashAlg
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidSign (MemberCtx const * ctx,
void const * msg,
size_t msg_len,
void const * basename,
size_t basename_len,
SigRl const * sig_rl,
size_t sig_rl_size,
EpidSignaturesig,
size_t sig_len 
)
+
+ +

Writes a Intel(R) EPID signature.

+
Parameters
+ + + + + + + + + + +
[in]ctxThe member context.
[in]msgThe message to sign.
[in]msg_lenThe length in bytes of message.
[in]basenameOptional basename. If basename is NULL a random basename is used. Signatures generated using random basenames are anonymous. Signatures generated using the same basename are linkable by the verifier. If a basename is provided, it must already be registered, or kEpidBadArgErr is returned.
[in]basename_lenThe size of basename in bytes. Must be 0 basename is NULL.
[in]sig_rlThe signature based revocation list.
[in]sig_rl_sizeThe size in bytes of the signature based revocation list.
[out]sigThe generated signature
[in]sig_lenThe size of signature in bytes. Must be equal to value returned by EpidGetSigSize().
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the content of sig is undefined.
+
See also
EpidMemberCreate
+
+EpidMemberSetHashAlg
+
+EpidGetSigSize
+
Examples:
signmsg.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidSignBasic (MemberCtx const * ctx,
void const * msg,
size_t msg_len,
void const * basename,
size_t basename_len,
BasicSignaturesig 
)
+
+ +

Creates a basic signature for use in constrained environment.

+

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

+
Parameters
+ + + + + + + +
[in]ctxThe member context.
[in]msgThe message.
[in]msg_lenThe length of message in bytes.
[in]basenameOptional basename. If basename is NULL a random basename is used. Signatures generated using random basenames are anonymous. Signatures generated using the same basename are linkable by the verifier. If a basename is provided it must already be registered or kEpidBadArgErr is returned.
[in]basename_lenThe size of basename in bytes. Must be 0 basename is NULL.
[out]sigThe generated basic signature
+
+
+
Returns
EpidStatus
+
Note
This function should be used in conjunction with EpidNrProve()
+
+If the result is not kEpidNoErr the content of sig, is undefined.
+
See also
EpidMemberCreate
+
+EpidNrProve
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidWritePreSigs (MemberCtxctx,
PreComputedSignaturepresigs,
size_t number_presigs 
)
+
+ +

Serializes pre-computed signatures from the member's pool.

+

Removes requested number of pre-computed signatures from member's pool and stores them in presigs array. Use EpidAddPreSigs to add pre-computed signatures to the pool.

+
Parameters
+ + + + +
[in]ctxThe member context.
[out]presigsAn existing buffer of pre-computed signatures.
[in]number_presigsNumber of pre-computed signatures to read. Number_presigs must not be greater than the value returned by EpidGetNumPreSigs.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the state of the pre-computed signature pool, and of presigs, is undefined.
+
See also
EpidMemberCreate
+
+EpidGetNumPreSigs
+
+EpidAddPreSigs
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_member_module.js b/external/epid/doc/html/group___epid_member_module.js new file mode 100644 index 0000000000..1a6c7f47ae --- /dev/null +++ b/external/epid/doc/html/group___epid_member_module.js @@ -0,0 +1,37 @@ +var group___epid_member_module = +[ + [ "MemberPrecomp", "struct_member_precomp.html", [ + [ "e12", "struct_member_precomp.html#a55e5c4b25c8f0f426969a8d745260fe5", null ], + [ "e22", "struct_member_precomp.html#a4e7412969bed3964f813b093b948e7b4", null ], + [ "e2w", "struct_member_precomp.html#a879d5a7b0c30088b23f6e5c5fc62f834", null ], + [ "ea2", "struct_member_precomp.html#a573551f6494e372f44fd3bdf5b02aeda", null ] + ] ], + [ "PreComputedSignature", "struct_pre_computed_signature.html", [ + [ "a", "struct_pre_computed_signature.html#af23f3f9693857a33fe8564644612ea37", null ], + [ "B", "struct_pre_computed_signature.html#a9cc2eb61572a1aca9e6bc3d5e6f4c1fe", null ], + [ "b", "struct_pre_computed_signature.html#a666710432d9d54ca896647a976892c4f", null ], + [ "K", "struct_pre_computed_signature.html#a2a4eaffe2717bd9c8c360599612adbe6", null ], + [ "R1", "struct_pre_computed_signature.html#a72be597624957e3d668c95ff6f445f94", null ], + [ "R2", "struct_pre_computed_signature.html#a79f06fb57842597372e00dd34c1a804a", null ], + [ "ra", "struct_pre_computed_signature.html#a54462643b8a2b4f2741bf8d2e6909d11", null ], + [ "rb", "struct_pre_computed_signature.html#a6a1db672c609943fe7af84320dc68ba3", null ], + [ "rf", "struct_pre_computed_signature.html#ac244bd559a96812bcee7671abc299b66", null ], + [ "rx", "struct_pre_computed_signature.html#acd0674d5b5e96244645e9abef7bdbddc", null ], + [ "T", "struct_pre_computed_signature.html#a73471643dc757115701833ca2e831a72", null ] + ] ], + [ "EpidAddPreSigs", "group___epid_member_module.html#gad2e3de5c6ce641a318f8a46b61e75236", null ], + [ "EpidDecompressPrivKey", "group___epid_member_module.html#gaf8cd05388f017486f14da2ee48d067ef", null ], + [ "EpidGetNumPreSigs", "group___epid_member_module.html#gad78ca056dfea2565bbacd5734d9dc075", null ], + [ "EpidGetSigSize", "group___epid_member_module.html#ga76e535722467af7c16809b5b521e0000", null ], + [ "EpidIsPrivKeyInGroup", "group___epid_member_module.html#ga8e3f201d1e9dc668659e08a3bdf543b6", null ], + [ "EpidMemberCreate", "group___epid_member_module.html#ga561c4d544a78ee1bf59c3f4f919aa7bb", null ], + [ "EpidMemberDelete", "group___epid_member_module.html#ga3824589c683c5e0e59d483462fce65d6", null ], + [ "EpidMemberSetHashAlg", "group___epid_member_module.html#ga9998eb454838ff5d232ff22ecbab31bf", null ], + [ "EpidMemberWritePrecomp", "group___epid_member_module.html#ga5c35798d62cf81c4ca62b22c38809721", null ], + [ "EpidNrProve", "group___epid_member_module.html#gac8e2c6c1fead8030785a40427905a2cc", null ], + [ "EpidRegisterBaseName", "group___epid_member_module.html#gad92d3c3266ae1833ffb1dba9ad76035d", null ], + [ "EpidRequestJoin", "group___epid_member_module.html#ga13dd0d72be9babf8194d472d7712a361", null ], + [ "EpidSign", "group___epid_member_module.html#ga759155a719254f734157722716dac640", null ], + [ "EpidSignBasic", "group___epid_member_module.html#gae04a250d5981fcf9bd6f9f57e0468faa", null ], + [ "EpidWritePreSigs", "group___epid_member_module.html#ga9e12c7cec8d0c4e07b12c0e26a278c9d", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_module.html b/external/epid/doc/html/group___epid_module.html new file mode 100644 index 0000000000..3b36d18879 --- /dev/null +++ b/external/epid/doc/html/group___epid_module.html @@ -0,0 +1,97 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
epid
+
+
+ +

Core Intel® EPID functionality. +More...

+ + + + + + + + + + + +

+Modules

 common
 Common code shared between core sub-components.
 
 member
 Member functionality.
 
 verifier
 Verifier functionality.
 
+

Detailed Description

+

Core Intel® EPID functionality.

+

Contains core functionality used to provide or implement APIs in the Intel(R) EPID SDK.

+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_module.js b/external/epid/doc/html/group___epid_module.js new file mode 100644 index 0000000000..892eddf409 --- /dev/null +++ b/external/epid/doc/html/group___epid_module.js @@ -0,0 +1,6 @@ +var group___epid_module = +[ + [ "common", "group___epid_common.html", "group___epid_common" ], + [ "member", "group___epid_member_module.html", "group___epid_member_module" ], + [ "verifier", "group___epid_verifier_module.html", "group___epid_verifier_module" ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_print.html b/external/epid/doc/html/group___epid_print.html new file mode 100644 index 0000000000..f4b0a4d894 --- /dev/null +++ b/external/epid/doc/html/group___epid_print.html @@ -0,0 +1,660 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: print_utils + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
print_utils
+
+
+ +

Debug print routines. +More...

+ + + + + +

+Enumerations

enum  PrintUtilFormat { kPrintUtilUnannotated = 0, +kPrintUtilAnnotated = 1 + }
 Print format. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

void PrintBigNum (BigNum const *big_num, char const *var_name)
 Prints BigNum. More...
 
void PrintFfElement (FiniteField const *ff, FfElement const *ff_element, char const *var_name, PrintUtilFormat format)
 Prints finite field element. More...
 
void PrintEcPoint (EcGroup const *g, EcPoint const *ec_point, char const *var_name, PrintUtilFormat format)
 Prints elliptic curve group element. More...
 
void PrintBigNumStr (BigNumStr const *big_num_str, char const *var_name)
 Prints serialized BigNum. More...
 
void PrintFpElemStr (FpElemStr const *fp_elem_str, char const *var_name)
 Prints serialized Fp element. More...
 
void PrintFqElemStr (FqElemStr const *fq_elem_str, char const *var_name)
 Prints serialized Fq element. More...
 
void PrintFq2ElemStr (Fq2ElemStr const *fq2_elem_str, char const *var_name, PrintUtilFormat format)
 Prints serialized Fq2 element. More...
 
void PrintFq6ElemStr (Fq6ElemStr const *fq6_elem_str, char const *var_name, PrintUtilFormat format)
 Prints serialized Fq6 element. More...
 
void PrintFq12ElemStr (Fq12ElemStr const *fq12_elem_str, char const *var_name, PrintUtilFormat format)
 Prints serialized Fq12 element. More...
 
void PrintG1ElemStr (G1ElemStr const *g1_elem_str, char const *var_name, PrintUtilFormat format)
 Prints serialized G1 element. More...
 
void PrintG2ElemStr (G2ElemStr const *g2_elem_str, char const *var_name, PrintUtilFormat format)
 Prints serialized G2 element. More...
 
void PrintGtElemStr (GtElemStr const *gt_elem_str, char const *var_name, PrintUtilFormat format)
 Prints serialized Gt element. More...
 
+

Detailed Description

+

Debug print routines.

+

Defines an API to print formatted versions of the types used for mathematical operations.

+

If the symbol EPID_ENABLE_DEBUG_PRINT is not defined, all calls to the functions in this module are ignored.

+

Enumeration Type Documentation

+ +
+
+ + + + +
enum PrintUtilFormat
+
+ +

Print format.

+ + + +
Enumerator
kPrintUtilUnannotated  +

Unannotated output format.

+
kPrintUtilAnnotated  +

Annotated output format.

+
+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void PrintBigNum (BigNum const * big_num,
char const * var_name 
)
+
+ +

Prints BigNum.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + +
[in]big_numBigNum to be printed
[in]var_nameResult variable name
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PrintBigNumStr (BigNumStr const * big_num_str,
char const * var_name 
)
+
+ +

Prints serialized BigNum.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + +
[in]big_num_strSerialized BigNum to be printed
[in]var_nameResult variable name
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void PrintEcPoint (EcGroup const * g,
EcPoint const * ec_point,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints elliptic curve group element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + + +
[in]gElliptic curve group that element to be printed belongs to
[in]ec_pointElliptic curve group element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void PrintFfElement (FiniteField const * ff,
FfElement const * ff_element,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints finite field element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + + +
[in]ffFinite field that element to be printed belongs to
[in]ff_elementFinite field element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PrintFpElemStr (FpElemStr const * fp_elem_str,
char const * var_name 
)
+
+ +

Prints serialized Fp element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + +
[in]fp_elem_strSerialized Fp element to be printed
[in]var_nameResult variable name
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void PrintFq12ElemStr (Fq12ElemStr const * fq12_elem_str,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints serialized Fq12 element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + +
[in]fq12_elem_strSerialized Intel(R) EPID Fq12 element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void PrintFq2ElemStr (Fq2ElemStr const * fq2_elem_str,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints serialized Fq2 element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + +
[in]fq2_elem_strSerialized Fq2 element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void PrintFq6ElemStr (Fq6ElemStr const * fq6_elem_str,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints serialized Fq6 element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + +
[in]fq6_elem_strSerialized Fq6 element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void PrintFqElemStr (FqElemStr const * fq_elem_str,
char const * var_name 
)
+
+ +

Prints serialized Fq element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + +
[in]fq_elem_strSerialized Fq element to be printed
[in]var_nameResult variable name
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void PrintG1ElemStr (G1ElemStr const * g1_elem_str,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints serialized G1 element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + +
[in]g1_elem_strSerialized G1 element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void PrintG2ElemStr (G2ElemStr const * g2_elem_str,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints serialized G2 element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + +
[in]g2_elem_strSerialized G2 element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void PrintGtElemStr (GtElemStr const * gt_elem_str,
char const * var_name,
PrintUtilFormat format 
)
+
+ +

Prints serialized Gt element.

+

Macro EPID_ENABLE_DEBUG_PRINT needs to be defined in order to activate this routine; otherwise, it prints nothing.

+
Parameters
+ + + + +
[in]gt_elem_strSerialized G2 element to be printed
[in]var_nameResult variable name
[in]formatOutput format
+
+
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_print.js b/external/epid/doc/html/group___epid_print.js new file mode 100644 index 0000000000..00d8c84e1f --- /dev/null +++ b/external/epid/doc/html/group___epid_print.js @@ -0,0 +1,19 @@ +var group___epid_print = +[ + [ "PrintUtilFormat", "group___epid_print.html#ga3e215d157eb205ad596bb84bce694a83", [ + [ "kPrintUtilUnannotated", "group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83aeb475b793d8d357087d7fcc74702ffae", null ], + [ "kPrintUtilAnnotated", "group___epid_print.html#gga3e215d157eb205ad596bb84bce694a83ae2d5345c14f57fc992a613003c3c443d", null ] + ] ], + [ "PrintBigNum", "group___epid_print.html#ga45a933b44fc1dfe926e3af89c198070a", null ], + [ "PrintBigNumStr", "group___epid_print.html#ga5f249c594ed12e4a9b11b7bc101da85d", null ], + [ "PrintEcPoint", "group___epid_print.html#ga0d6377d9c1651d0101ec6b61feaa78ca", null ], + [ "PrintFfElement", "group___epid_print.html#gaa3b1cbbfc6f78562658953113e5798cf", null ], + [ "PrintFpElemStr", "group___epid_print.html#gae553c3a156a0e4968b89635ab0757580", null ], + [ "PrintFq12ElemStr", "group___epid_print.html#gaf185fe3df270cd8b4a2969bf3cfc5d5f", null ], + [ "PrintFq2ElemStr", "group___epid_print.html#ga883a834ab1703365bb0bca4abd3104de", null ], + [ "PrintFq6ElemStr", "group___epid_print.html#ga3f2961ef6b4c44a6205d422d8a293476", null ], + [ "PrintFqElemStr", "group___epid_print.html#ga6c9fea48fa0477f4a98abb50f891a5e4", null ], + [ "PrintG1ElemStr", "group___epid_print.html#ga87168a3ce5306f9839b8e8d6c9a5f84f", null ], + [ "PrintG2ElemStr", "group___epid_print.html#gab76a4cf0385dc4a76bb56ee9f0e3e87a", null ], + [ "PrintGtElemStr", "group___epid_print.html#ga138cd388247a58680d4701d59d6976d2", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_types.html b/external/epid/doc/html/group___epid_types.html new file mode 100644 index 0000000000..efdfd1d41b --- /dev/null +++ b/external/epid/doc/html/group___epid_types.html @@ -0,0 +1,266 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: types + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+ +
+ +

SDK data types. +More...

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Data Structures

struct  OctStr8
 8 bit octet string More...
 
struct  OctStr16
 16 bit octet string More...
 
struct  OctStr32
 32 bit octet string More...
 
struct  OctStr64
 64 bit octet string More...
 
struct  OctStr128
 128 bit octet string More...
 
struct  OctStr256
 256 bit octet string More...
 
struct  OctStr512
 512 bit octet string More...
 
struct  BigNumStr
 Serialized BigNum. More...
 
struct  FpElemStr
 a number in [0, p-1] More...
 
struct  FqElemStr
 a number in [0, q-1] More...
 
struct  G1ElemStr
 Serialized G1 element. More...
 
struct  G2ElemStr
 Serialized G2 element. More...
 
struct  GtElemStr
 Serialized GT element. More...
 
struct  Epid2Params
 Intel(R) EPID 2.0 Parameters. More...
 
struct  GroupPubKey
 Intel(R) EPID 2.0 group public key. More...
 
struct  IPrivKey
 Intel(R) EPID 2.0 issuing private key. More...
 
struct  PrivKey
 Intel(R) EPID 2.0 private key. More...
 
struct  CompressedPrivKey
 Compressed private key. More...
 
struct  MembershipCredential
 Membership credential. More...
 
struct  JoinRequest
 Join request. More...
 
struct  BasicSignature
 Intel(R) EPID 2.0 basic signature. More...
 
struct  NrProof
 non-revoked Proof. More...
 
struct  EpidSignature
 Intel(R) EPID 2.0 Signature. More...
 
struct  PrivRl
 private-key based revocation list. More...
 
struct  SigRlEntry
 entry in SigRL (B,K) More...
 
struct  SigRl
 signature based revocation list More...
 
struct  GroupRl
 group revocation list More...
 
struct  VerifierRl
 
struct  Fq2ElemStr
 Serialized Fq2 element. More...
 
struct  Fq6ElemStr
 Serialized Fq2^3 element. More...
 
struct  Fq12ElemStr
 Serialized Fq2^3^2 element. More...
 
struct  EcdsaSignature
 ECDSA Signature using NIST 256-bit curve secp256r1. More...
 
struct  EcdsaPublicKey
 ECDSA Public Key. More...
 
struct  EcdsaPrivateKey
 ECDSA Private Key. More...
 
+ + + + + + + + + + + + + +

+Typedefs

+typedef OctStr128 GroupId
 group ID
 
+typedef OctStr256 Seed
 256 bit seed derived from fuse key
 
+typedef OctStr256 IssuerNonce
 256 bit nonce chosen by issuer
 
+typedef G1ElemStr ReKeySeed
 element to store seed values for later rekey
 
+ + + + +

+Enumerations

enum  HashAlg {
+  kSha256 = 0, +kSha384 = 1, +kSha512 = 2, +kSha512_256 = 3, +
+  kSha3_256 = 4, +kSha3_384 = 5, +kSha3_512 = 6 +
+ }
 Recognized hash algorithms. More...
 
+

Detailed Description

+

SDK data types.

+

Defines serialized data types used by the SDK.

+

Most of the types defined here are fixed size binary buffers of various sizes that are semantically mapped to the types of various inputs to the EPID APIs.

+

For example GtElemStr is a 384 byte buffer that represents a serialized value that is compatible with a FfElement belonging to the FiniteField GT.

+

Enumeration Type Documentation

+ +
+
+ + + + +
enum HashAlg
+
+ +

Recognized hash algorithms.

+ + + + + + + + +
Enumerator
kSha256  +

SHA-256.

+
kSha384  +

SHA-384.

+
kSha512  +

SHA-512.

+
kSha512_256  +

SHA-512/256.

+
kSha3_256  +

Reserved for SHA3/256.

+
kSha3_384  +

Reserved for SHA3/384.

+
kSha3_512  +

Reserved for SHA3/512.

+
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_types.js b/external/epid/doc/html/group___epid_types.js new file mode 100644 index 0000000000..f473312478 --- /dev/null +++ b/external/epid/doc/html/group___epid_types.js @@ -0,0 +1,169 @@ +var group___epid_types = +[ + [ "OctStr8", "struct_oct_str8.html", [ + [ "data", "struct_oct_str8.html#a5e6c56fda48c88b419e621b464b03bef", null ] + ] ], + [ "OctStr16", "struct_oct_str16.html", [ + [ "data", "struct_oct_str16.html#a86ed6671693a3f60ec4ff7de2c1206c3", null ] + ] ], + [ "OctStr32", "struct_oct_str32.html", [ + [ "data", "struct_oct_str32.html#a5588a7e70f3d73f6ce58b567a9f5c5c8", null ] + ] ], + [ "OctStr64", "struct_oct_str64.html", [ + [ "data", "struct_oct_str64.html#a0e107d78192a5ae0b48ed9e5c4eab0fc", null ] + ] ], + [ "OctStr128", "struct_oct_str128.html", [ + [ "data", "struct_oct_str128.html#a7482aa9b0b580fdd50bd65419d52d4b9", null ] + ] ], + [ "OctStr256", "struct_oct_str256.html", [ + [ "data", "struct_oct_str256.html#a359781bb84f5717a16094583a00ef14e", null ] + ] ], + [ "OctStr512", "struct_oct_str512.html", [ + [ "data", "struct_oct_str512.html#abd4d1b97fe49321571da86de1aeac653", null ] + ] ], + [ "BigNumStr", "struct_big_num_str.html", [ + [ "data", "struct_big_num_str.html#a442dcf33889b4f85c5b1228d2c8e6838", null ] + ] ], + [ "FpElemStr", "struct_fp_elem_str.html", [ + [ "data", "struct_fp_elem_str.html#a5ddb96a5567750f2834335851c906c45", null ] + ] ], + [ "FqElemStr", "struct_fq_elem_str.html", [ + [ "data", "struct_fq_elem_str.html#aac1a876b51a8d2c6d1510e4df2fd3f14", null ] + ] ], + [ "G1ElemStr", "struct_g1_elem_str.html", [ + [ "x", "struct_g1_elem_str.html#a3b0e658d6e5697763ad9c633c11d4ec4", null ], + [ "y", "struct_g1_elem_str.html#a8f2455ca314e885ea180dadf84bf27c3", null ] + ] ], + [ "G2ElemStr", "struct_g2_elem_str.html", [ + [ "x", "struct_g2_elem_str.html#a145ec5b20a6f4f00b080e11c8680afc3", null ], + [ "y", "struct_g2_elem_str.html#a43141b2458aecceed8ee2748270f7908", null ] + ] ], + [ "GtElemStr", "struct_gt_elem_str.html", [ + [ "x", "struct_gt_elem_str.html#aeaeb0e9e1c6efd378a475eb9a6c42132", null ] + ] ], + [ "Epid2Params", "struct_epid2_params.html", [ + [ "b", "struct_epid2_params.html#a2f868edb49be49f645101ef5ebbbc551", null ], + [ "beta", "struct_epid2_params.html#ac2d7507c6f58c3451beacacb91b52695", null ], + [ "g1", "struct_epid2_params.html#a4c5195b4fa9393a07a121336202531ad", null ], + [ "g2", "struct_epid2_params.html#a609b0aac17fca34fe39bee29676a9618", null ], + [ "neg", "struct_epid2_params.html#af23f07fb0e1745c0ad14aceeaa946928", null ], + [ "p", "struct_epid2_params.html#ac0e0dad45b10927860cd5fa4f8101f08", null ], + [ "q", "struct_epid2_params.html#a023603228fed2854ddae2e228938940f", null ], + [ "t", "struct_epid2_params.html#a200a0cba1c9e4ad512bece23f2461a5f", null ], + [ "xi", "struct_epid2_params.html#ae1d8f5d6036a82064e91bc137b278e74", null ] + ] ], + [ "GroupPubKey", "struct_group_pub_key.html", [ + [ "gid", "struct_group_pub_key.html#ae8e77ab4d5eb3c8e566c24a64cce56ee", null ], + [ "h1", "struct_group_pub_key.html#a8c22c758ea186f95e3bf4b2ef8451da5", null ], + [ "h2", "struct_group_pub_key.html#a2a4320ec99fd1a15df412fbf2a8d49f1", null ], + [ "w", "struct_group_pub_key.html#a86be439104fb60b324784baf24a943f9", null ] + ] ], + [ "IPrivKey", "struct_i_priv_key.html", [ + [ "gamma", "struct_i_priv_key.html#a6d484175317aef09fb959c3ca55fc70a", null ], + [ "gid", "struct_i_priv_key.html#ad400a4237b6d50855538fd40580eb1bb", null ] + ] ], + [ "PrivKey", "struct_priv_key.html", [ + [ "A", "struct_priv_key.html#a266c7e369b8b868ef5755e9cd3c0c849", null ], + [ "f", "struct_priv_key.html#ad7ee0392a583edd2e287cf8c1f9066ba", null ], + [ "gid", "struct_priv_key.html#ab416dcb4366427c24b44c2a02e4ae7c8", null ], + [ "x", "struct_priv_key.html#aa805f9e124f05bdb733c85cb93614cbd", null ] + ] ], + [ "CompressedPrivKey", "struct_compressed_priv_key.html", [ + [ "ax", "struct_compressed_priv_key.html#a0b0535f0567eb0e48f799d27991d0f66", null ], + [ "gid", "struct_compressed_priv_key.html#ac6689899f1d9a6a8c5e4915563679840", null ], + [ "seed", "struct_compressed_priv_key.html#a54b9af7699f517bbaef3d52d03e3fed8", null ] + ] ], + [ "MembershipCredential", "struct_membership_credential.html", [ + [ "A", "struct_membership_credential.html#a6d38ac3a9c5417833b8adb9b22bc9dc8", null ], + [ "gid", "struct_membership_credential.html#afbff64ec55888c7e2a658eabb5e16671", null ], + [ "x", "struct_membership_credential.html#a2c5c0d22999d6917fea5ad6618883bcf", null ] + ] ], + [ "JoinRequest", "struct_join_request.html", [ + [ "c", "struct_join_request.html#a55e30a274e83b808db6fbab5ae6c6cb8", null ], + [ "F", "struct_join_request.html#a005651506fd4511e8a3537f6c3634532", null ], + [ "s", "struct_join_request.html#a73bf8989df5f90eb3d06e7a42ad74d1d", null ] + ] ], + [ "BasicSignature", "struct_basic_signature.html", [ + [ "B", "struct_basic_signature.html#ae90cb6af66b010ae39913f033c1e65ac", null ], + [ "c", "struct_basic_signature.html#a4daa94db5068db3f10960f3dd178d603", null ], + [ "K", "struct_basic_signature.html#a0078cc83ecf6c7e31f96b7d44aa60e21", null ], + [ "sa", "struct_basic_signature.html#a69115a4776d15b48411dd6c3a76d0f3d", null ], + [ "sb", "struct_basic_signature.html#a91daebc5b577688afeed2a7ee7913245", null ], + [ "sf", "struct_basic_signature.html#a79d8dec8c5da176e497abf22e4c43adb", null ], + [ "sx", "struct_basic_signature.html#a0e8ea6a2cd3af10e9b59d96d7d06bc69", null ], + [ "T", "struct_basic_signature.html#a730f74d85cfb4fa4089d43c87b97a624", null ] + ] ], + [ "NrProof", "struct_nr_proof.html", [ + [ "c", "struct_nr_proof.html#a0de1aa69acf3d93da34cf4a613b359a1", null ], + [ "smu", "struct_nr_proof.html#a717ec36a6c91acd01d9b642bb20fc178", null ], + [ "snu", "struct_nr_proof.html#ae2e9f22089793a4d44a0f7f5cdb78a0c", null ], + [ "T", "struct_nr_proof.html#ace535065bbf96502b893ac677dc8dcd3", null ] + ] ], + [ "EpidSignature", "struct_epid_signature.html", [ + [ "n2", "struct_epid_signature.html#a62a6b0ffcd5f68dd3d2786a58fe43017", null ], + [ "rl_ver", "struct_epid_signature.html#a4155f3f4f1223fc4ae50c94f5305def1", null ], + [ "sigma", "struct_epid_signature.html#a89d2e38223944310b6eeeadf6061a2dd", null ], + [ "sigma0", "struct_epid_signature.html#ab0fe5f98bff737fcfbfe0b4d658e83f2", null ] + ] ], + [ "PrivRl", "struct_priv_rl.html", [ + [ "f", "struct_priv_rl.html#a60d73f9ef5fc81f117b3abadf8c18466", null ], + [ "gid", "struct_priv_rl.html#af7317529b8e55476bd06b66ed8131d64", null ], + [ "n1", "struct_priv_rl.html#a6da9639ec4061689d1c30a58e0befd14", null ], + [ "version", "struct_priv_rl.html#a4c6b51cec760f7e81ca8635422ac6a50", null ] + ] ], + [ "SigRlEntry", "struct_sig_rl_entry.html", [ + [ "b", "struct_sig_rl_entry.html#ac6a47ff0d1b8ea1512e0ff14983ac5ce", null ], + [ "k", "struct_sig_rl_entry.html#a0dfeb058614e81878bfbf86ae3edac3c", null ] + ] ], + [ "SigRl", "struct_sig_rl.html", [ + [ "bk", "struct_sig_rl.html#ac23a919993d99d24a5150302f1778102", null ], + [ "gid", "struct_sig_rl.html#a12757d30fcccd310716433948e0b603e", null ], + [ "n2", "struct_sig_rl.html#a9dfb6b508db9051f4dc480a51d702af2", null ], + [ "version", "struct_sig_rl.html#ac9d4c343c539dba799e1f42eb38b351f", null ] + ] ], + [ "GroupRl", "struct_group_rl.html", [ + [ "gid", "struct_group_rl.html#a51022e172ab8b945efc69f1e63170107", null ], + [ "n3", "struct_group_rl.html#a9067f01c63cdefbc8e23c3cf67a10172", null ], + [ "version", "struct_group_rl.html#a69c41d99cdfc5b6ece7442f466f7ec3f", null ] + ] ], + [ "VerifierRl", "struct_verifier_rl.html", [ + [ "B", "struct_verifier_rl.html#a5d9a9265fffa96fd5f9260543eb08c68", null ], + [ "gid", "struct_verifier_rl.html#ab85c4666d16145ff16443e84468d2d7d", null ], + [ "K", "struct_verifier_rl.html#ac7d3dceab4772096bbbeb3fa735d18a9", null ], + [ "n4", "struct_verifier_rl.html#a1e3f84b873bccc0c882aa6432c42d2f7", null ], + [ "version", "struct_verifier_rl.html#afa44ab69ffff5a3508366aeb2131fdaa", null ] + ] ], + [ "Fq2ElemStr", "struct_fq2_elem_str.html", [ + [ "a", "struct_fq2_elem_str.html#ab1d253eb24ba30eaf516ac429daab915", null ] + ] ], + [ "Fq6ElemStr", "struct_fq6_elem_str.html", [ + [ "a", "struct_fq6_elem_str.html#a89d656e5c815b4a2382d11ef6932a7d2", null ] + ] ], + [ "Fq12ElemStr", "struct_fq12_elem_str.html", [ + [ "a", "struct_fq12_elem_str.html#a0520947335aaf52de90af1dec5bdd112", null ] + ] ], + [ "EcdsaSignature", "struct_ecdsa_signature.html", [ + [ "x", "struct_ecdsa_signature.html#a64b623605a55a267a36df18f29142d0d", null ], + [ "y", "struct_ecdsa_signature.html#a2efd6bf37b12f35135bf325fa491b029", null ] + ] ], + [ "EcdsaPublicKey", "struct_ecdsa_public_key.html", [ + [ "x", "struct_ecdsa_public_key.html#a37c51614faf022eec491b4de8f3a13e1", null ], + [ "y", "struct_ecdsa_public_key.html#a4503c4613386cbc78add1dc245c99284", null ] + ] ], + [ "EcdsaPrivateKey", "struct_ecdsa_private_key.html", [ + [ "data", "struct_ecdsa_private_key.html#a97efee9b4079f95d94a104f9a6d8c96d", null ] + ] ], + [ "GroupId", "group___epid_types.html#gada666b48d0cbc301985405fde896f1de", null ], + [ "IssuerNonce", "group___epid_types.html#ga55eb2193045bde31af3f551565126042", null ], + [ "ReKeySeed", "group___epid_types.html#ga54bd22670f2e348593db7ab631131d10", null ], + [ "Seed", "group___epid_types.html#ga888541b8148df69c634a92c64ed51317", null ], + [ "HashAlg", "group___epid_types.html#ga5e450438f6f9a5eacd0cf5ce354ec890", [ + [ "kSha256", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890aefb89989305b5c34120b0f18ee8e2c5d", null ], + [ "kSha384", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a0f4dde6e82b84f5769873f6704fcd290", null ], + [ "kSha512", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890afb78d98f37fecc53dd1637d94c5c0055", null ], + [ "kSha512_256", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a9746b5049a62bca2f7b844925e6136ba", null ], + [ "kSha3_256", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a4fa16d3867498f5e2f8ae5c94b0fab85", null ], + [ "kSha3_384", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890a90d21c8885ab138f7cf91f253dd6ef86", null ], + [ "kSha3_512", "group___epid_types.html#gga5e450438f6f9a5eacd0cf5ce354ec890ade8e74cf7910b3a71fe902a40abf7eee", null ] + ] ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___epid_verifier_module.html b/external/epid/doc/html/group___epid_verifier_module.html new file mode 100644 index 0000000000..1e2f5d1f79 --- /dev/null +++ b/external/epid/doc/html/group___epid_verifier_module.html @@ -0,0 +1,834 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: verifier + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
verifier
+
+
+ +

Verifier functionality. +More...

+ + + + + +

+Data Structures

struct  VerifierPrecomp
 Pre-computed member settings. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus EpidVerifierCreate (GroupPubKey const *pub_key, VerifierPrecomp const *precomp, VerifierCtx **ctx)
 Creates a new verifier context. More...
 
void EpidVerifierDelete (VerifierCtx **ctx)
 Deletes an existing verifier context. More...
 
EpidStatus EpidVerifierWritePrecomp (VerifierCtx const *ctx, VerifierPrecomp *precomp)
 Serializes the pre-computed verifier settings. More...
 
EpidStatus EpidVerifierSetPrivRl (VerifierCtx *ctx, PrivRl const *priv_rl, size_t priv_rl_size)
 Sets the private key based revocation list. More...
 
EpidStatus EpidVerifierSetSigRl (VerifierCtx *ctx, SigRl const *sig_rl, size_t sig_rl_size)
 Sets the signature based revocation list. More...
 
EpidStatus EpidVerifierSetGroupRl (VerifierCtx *ctx, GroupRl const *grp_rl, size_t grp_rl_size)
 Sets the group based revocation list. More...
 
EpidStatus EpidVerifierSetVerifierRl (VerifierCtx *ctx, VerifierRl const *ver_rl, size_t ver_rl_size)
 Sets the verifier revocation list. More...
 
EpidStatus EpidVerifierSetHashAlg (VerifierCtx *ctx, HashAlg hash_alg)
 Sets the hash algorithm to be used by a verifier. More...
 
EpidStatus EpidVerify (VerifierCtx const *ctx, EpidSignature const *sig, size_t sig_len, void const *msg, size_t msg_len, void const *basename, size_t basename_len)
 Verifies a signature and checks revocation status. More...
 
bool EpidAreSigsLinked (BasicSignature const *sig1, BasicSignature const *sig2)
 Determines if two signatures are linked. More...
 
EpidStatus EpidVerifyBasicSig (VerifierCtx const *ctx, BasicSignature const *sig, void const *msg, size_t msg_len, void const *basename, size_t basename_len)
 Verifies a member signature without revocation checks. More...
 
EpidStatus EpidNrVerify (VerifierCtx const *ctx, BasicSignature const *sig, void const *msg, size_t msg_len, SigRlEntry const *sigrl_entry, NrProof const *proof)
 Verifies the non-revoked proof for a single signature based revocation list entry. More...
 
EpidStatus EpidCheckPrivRlEntry (VerifierCtx const *ctx, BasicSignature const *sig, FpElemStr const *f)
 Verifies a signature has not been revoked in the private key based revocation list. More...
 
+

Detailed Description

+

Verifier functionality.

+

Defines the APIs needed by Intel(R) EPID verifiers. Each verifier context (VerifierCtx) represents a verifier for a single group.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
bool EpidAreSigsLinked (BasicSignature const * sig1,
BasicSignature const * sig2 
)
+
+ +

Determines if two signatures are linked.

+

The Intel(R) EPID scheme allows signatures to be linked. If basename option is specified when signing, signatures with the same basename are linkable. This linking capability allows the verifier, or anyone, to know whether two Intel(R) EPID signatures are generated by the same member.

+
Parameters
+ + + +
[in]sig1A basic signature.
[in]sig2A basic signature.
+
+
+
Returns
bool
+
Return values
+ + + +
trueif the signatures were generated by the same member
falseif it couldn't be determined if the signatures were generated by the same member
+
+
+
Note
The input signatures should be verified using EpidVerifyBasicSig() before invocation. Behavior is undefined if either of the signatures cannot be verified.
+
See also
EpidVerifyBasicSig
+
+EpidSignBasic
+
+EpidSign
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidCheckPrivRlEntry (VerifierCtx const * ctx,
BasicSignature const * sig,
FpElemStr const * f 
)
+
+ +

Verifies a signature has not been revoked in the private key based revocation list.

+

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

+
Parameters
+ + + + +
[in]ctxThe verifier context.
[in]sigThe basic signature.
[in]fThe private key based revocation list entry.
+
+
+
Note
Sig should be verified using EpidVerifyBasicSig() before invocation. Behavior is undefined if sig cannot be verified.
+
+This function should be used in conjunction with EpidNrVerify() and EpidVerifyBasicSig().
+
+If the result is not kEpidNoErr the verify should be considered to have failed.
+
Returns
EpidStatus
+
See also
EpidVerifierCreate
+
+EpidNrVerify
+
+EpidVerifyBasicSig
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidNrVerify (VerifierCtx const * ctx,
BasicSignature const * sig,
void const * msg,
size_t msg_len,
SigRlEntry const * sigrl_entry,
NrProof const * proof 
)
+
+ +

Verifies the non-revoked proof for a single signature based revocation list entry.

+

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

+
Parameters
+ + + + + + + +
[in]ctxThe verifier context.
[in]sigThe basic signature.
[in]msgThe message that was signed.
[in]msg_lenThe size of msg in bytes.
[in]sigrl_entryThe signature based revocation list entry.
[in]proofThe non-revoked proof.
+
+
+
Returns
EpidStatus
+
Note
Sig should be verified using EpidVerifyBasicSig() before invocation. Behavior is undefined if sig cannot be verified.
+
+This function should be used in conjunction with EpidVerifyBasicSig() and EpidCheckPrivRlEntry().
+
+If the result is not kEpidNoErr, the verification should be considered to have failed.
+
See also
EpidVerifierCreate
+
+EpidVerifyBasicSig
+
+EpidCheckPrivRlEntry
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierCreate (GroupPubKey const * pub_key,
VerifierPrecomp const * precomp,
VerifierCtx ** ctx 
)
+
+ +

Creates a new verifier context.

+

Must be called to create the verifier context that is used by other "Verifier" APIs.

+

Allocates memory for the context, then initializes it.

+

EpidVerifierDelete() must be called to safely release the member context.

+
Parameters
+ + + + +
[in]pub_keyThe group certificate.
[in]precompOptional pre-computed data. If NULL the value is computed internally and is readable using EpidVerifierWritePrecomp().
[out]ctxNewly constructed verifier context.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the content of ctx is undefined.
+
See also
EpidVerifierDelete
+
+EpidVerifierWritePrecomp
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + +
void EpidVerifierDelete (VerifierCtx ** ctx)
+
+ +

Deletes an existing verifier context.

+

Must be called to safely release a verifier context created using EpidVerifierCreate().

+

De-initializes the context, frees memory used by the context, and sets the context pointer to NULL.

+
Parameters
+ + +
[in,out]ctxThe verifier context. Can be NULL.
+
+
+
See also
EpidVerifierCreate
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierSetGroupRl (VerifierCtxctx,
GroupRl const * grp_rl,
size_t grp_rl_size 
)
+
+ +

Sets the group based revocation list.

+

The caller is responsible for insuring the revocation list is authorized, e.g signed by the issuer. The caller is also responsible checking the version of the revocation list. The call fails if trying to set an older version of the revocation list than was last set.

+
Attention
The memory pointed to by grp_rl is accessed directly by the verifier until a new list is set or the verifier is destroyed. Do not modify the contents of this memory. The behavior of subsequent operations that rely on the revocation list is undefined if the memory is modified.
+
+It is the responsibility of the caller to free the memory pointed to by grp_rl after the verifier is no longer using it.
+
Parameters
+ + + + +
[in,out]ctxThe verifier context.
[in]grp_rlThe group based revocation list.
[in]grp_rl_sizeThe size of the group based revocation list in bytes.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the group based revocation list pointed to by the verifier is undefined.
+
See also
EpidVerifierCreate
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierSetHashAlg (VerifierCtxctx,
HashAlg hash_alg 
)
+
+ +

Sets the hash algorithm to be used by a verifier.

+
Parameters
+ + + +
[in]ctxThe verifier context.
[in]hash_algThe hash algorithm to use.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr, the hash algorithm used by the verifier is undefined.
+
See also
EpidVerifierCreate
+
+HashAlg
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierSetPrivRl (VerifierCtxctx,
PrivRl const * priv_rl,
size_t priv_rl_size 
)
+
+ +

Sets the private key based revocation list.

+

The caller is responsible for insuring the revocation list is authorized, e.g signed by the issuer. The caller is also responsible checking the version of the revocation list. The call fails if trying to set an older version of the revocation list than was last set.

+
Attention
The memory pointed to by priv_rl is accessed directly by the verifier until a new list is set or the verifier is destroyed. Do not modify the contents of this memory. The behavior of subsequent operations that rely on the revocation list is undefined if the memory is modified.
+
+It is the responsibility of the caller to free the memory pointed to by priv_rl after the verifier is no longer using it.
+
Parameters
+ + + + +
[in,out]ctxThe verifier context.
[in]priv_rlThe private key based revocation list.
[in]priv_rl_sizeThe size of the private key based revocation list in bytes.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the private key based revocation list pointed to by the verifier is undefined.
+
See also
EpidVerifierCreate
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierSetSigRl (VerifierCtxctx,
SigRl const * sig_rl,
size_t sig_rl_size 
)
+
+ +

Sets the signature based revocation list.

+

The caller is responsible for insuring the revocation list is authorized, e.g signed by the issuer. The caller is also responsible checking the version of the revocation list. The call fails if trying to set an older version of the revocation list than was last set.

+
Attention
The memory pointed to by sig_rl is accessed directly by the verifier until a new list is set or the verifier is destroyed. Do not modify the contents of this memory. The behavior of subsequent operations that rely on the revocation list is undefined if the memory is modified.
+
+It is the responsibility of the caller to free the memory pointed to by sig_rl after the verifier is no longer using it.
+
Parameters
+ + + + +
[in,out]ctxThe verifier context.
[in]sig_rlThe signature based revocation list.
[in]sig_rl_sizeThe size of the signature based revocation list in bytes.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the signature based revocation list pointed to by the verifier is undefined.
+
See also
EpidVerifierCreate
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierSetVerifierRl (VerifierCtxctx,
VerifierRl const * ver_rl,
size_t ver_rl_size 
)
+
+ +

Sets the verifier revocation list.

+

The caller is responsible for insuring the revocation list is authorized, e.g signed by the issuer. The caller is also responsible checking the version of the revocation list. The call fails if trying to set an older version of the revocation list than was last set.

+
Attention
The memory pointed to by ver_rl is accessed directly by the verifier until a new list is set or the verifier is destroyed. Do not modify the contents of this memory. The behavior of subsequent operations that rely on the revocation list is undefined if the memory is modified.
+
+It is the responsibility of the caller to free the memory pointed to by ver_rl after the verifier is no longer using it.
+
Parameters
+ + + + +
[in,out]ctxThe verifier context.
[in]ver_rlThe verifier revocation list.
[in]ver_rl_sizeThe size of the verifier revocation list in bytes.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the verifier revocation list pointed to by the verifier is undefined.
+
See also
EpidVerifierCreate
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifierWritePrecomp (VerifierCtx const * ctx,
VerifierPrecompprecomp 
)
+
+ +

Serializes the pre-computed verifier settings.

+
Parameters
+ + + +
[in]ctxThe verifier context.
[out]precompThe Serialized pre-computed verifier settings.
+
+
+
Returns
EpidStatus
+
Note
If the result is not kEpidNoErr the content of precomp is undefined.
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerify (VerifierCtx const * ctx,
EpidSignature const * sig,
size_t sig_len,
void const * msg,
size_t msg_len,
void const * basename,
size_t basename_len 
)
+
+ +

Verifies a signature and checks revocation status.

+
Parameters
+ + + + + + + + +
[in]ctxThe verifier context.
[in]sigThe signature.
[in]sig_lenThe size of sig in bytes.
[in]msgThe message that was signed.
[in]msg_lenThe size of msg in bytes.
[in]basenameThe basename. Pass NULL if not specified
[in]basename_lenNumber of bytes in basename buffer. Must be 0 if basename is NULL.
+
+
+
Returns
EpidStatus
+
Return values
+ + + + + + + +
kEpidSigValidSignature validated successfully
kEpidSigInvalidSignature is invalid
kEpidSigRevokedinGroupRlSignature revoked in GroupRl
kEpidSigRevokedinPrivRlSignature revoked in PrivRl
kEpidSigRevokedinSigRlSignature revoked in SigRl
kEpidSigRevokedinVerifierRlSignature revoked in VerifierRl
+
+
+
Note
If the result is not kEpidNoErr or one of the values listed above the verify should be considered to have failed.
+
See also
EpidVerifierCreate
+
+EpidSignBasic
+
+EpidSign
+
Examples:
verifysig.c.
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidVerifyBasicSig (VerifierCtx const * ctx,
BasicSignature const * sig,
void const * msg,
size_t msg_len,
void const * basename,
size_t basename_len 
)
+
+ +

Verifies a member signature without revocation checks.

+

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

+
Parameters
+ + + + + + + +
[in]ctxThe verifier context.
[in]sigThe basic signature.
[in]msgThe message that was signed.
[in]msg_lenThe size of msg in bytes.
[in]basenameThe basename. Pass NULL if not specified
[in]basename_lenNumber of bytes in basename buffer. Must be 0 if basename is NULL.
+
+
+
Returns
EpidStatus
+
Note
This function should be used in conjunction with EpidNrVerify() and EpidCheckPrivRlEntry().
+
+If the result is not kEpidNoErr the verify should be considered to have failed.
+
See also
EpidVerifierCreate
+
+EpidSignBasic
+
+EpidSign
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___epid_verifier_module.js b/external/epid/doc/html/group___epid_verifier_module.js new file mode 100644 index 0000000000..cabf2b5c64 --- /dev/null +++ b/external/epid/doc/html/group___epid_verifier_module.js @@ -0,0 +1,22 @@ +var group___epid_verifier_module = +[ + [ "VerifierPrecomp", "struct_verifier_precomp.html", [ + [ "e12", "struct_verifier_precomp.html#ad1106376f12772942af0331eb74de6e5", null ], + [ "e22", "struct_verifier_precomp.html#af8fd90f3a5a2be932a97dcd86099d5b2", null ], + [ "e2w", "struct_verifier_precomp.html#a8caf79578e3c0baf91921460391103ca", null ], + [ "eg12", "struct_verifier_precomp.html#ab061d6cc07d1467eeb5bf25f3ea7e306", null ] + ] ], + [ "EpidAreSigsLinked", "group___epid_verifier_module.html#gae44bd8acbc1e7205aeedff0c7e2632a8", null ], + [ "EpidCheckPrivRlEntry", "group___epid_verifier_module.html#gaeb05e6faea6f09c0665b13adc6e7ddea", null ], + [ "EpidNrVerify", "group___epid_verifier_module.html#gac6e2fab59e3af8a33a74a5b201642700", null ], + [ "EpidVerifierCreate", "group___epid_verifier_module.html#ga1d116daaee5466a1485d26ebc4e3ab70", null ], + [ "EpidVerifierDelete", "group___epid_verifier_module.html#ga6707e691f4b3916f9c684d5bbd463d12", null ], + [ "EpidVerifierSetGroupRl", "group___epid_verifier_module.html#ga1d41d6ef4dabbc30ec28452edd6baffb", null ], + [ "EpidVerifierSetHashAlg", "group___epid_verifier_module.html#ga97b58b2382f24756b66a357f1e825c92", null ], + [ "EpidVerifierSetPrivRl", "group___epid_verifier_module.html#gafab08180a43b58ce2e1d56c4b070bb0e", null ], + [ "EpidVerifierSetSigRl", "group___epid_verifier_module.html#ga4c7c9820409ee06f30bb8dc75fdd5dcf", null ], + [ "EpidVerifierSetVerifierRl", "group___epid_verifier_module.html#ga0909703a0a4dfe080374d0d99077465a", null ], + [ "EpidVerifierWritePrecomp", "group___epid_verifier_module.html#ga92df4d00ea4ee59d7bfd35b23da03392", null ], + [ "EpidVerify", "group___epid_verifier_module.html#ga39b240a17f310894e9f5946c9a731798", null ], + [ "EpidVerifyBasicSig", "group___epid_verifier_module.html#ga974b92a62e8b65ea75cf802e8cc6bb6a", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___error_codes.html b/external/epid/doc/html/group___error_codes.html new file mode 100644 index 0000000000..557e3e73fc --- /dev/null +++ b/external/epid/doc/html/group___error_codes.html @@ -0,0 +1,225 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: errors + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
errors
+
+
+ +

Error reporting interface. +More...

+ + + + + +

+Enumerations

enum  EpidStatus {
+  kEpidNoErr = 0, +kEpidSigValid = 0, +kEpidSigInvalid = 1, +kEpidSigRevokedinGroupRl = 2, +
+  kEpidSigRevokedinPrivRl = 3, +kEpidSigRevokedinSigRl = 4, +kEpidSigRevokedinVerifierRl = 5, +kEpidErr = -999, +
+  kEpidNotImpl, +kEpidBadArgErr, +kEpidNoMemErr, +kEpidMemAllocErr, +
+  kEpidMathErr, +kEpidDivByZeroErr, +kEpidUnderflowErr, +kEpidHashAlgorithmNotSupported, +
+  kEpidRandMaxIterErr, +kEpidDuplicateErr +
+ }
 Return status for SDK functions. More...
 
+ + + + +

+Functions

char const * EpidStatusToString (EpidStatus e)
 Returns string representation of error code. More...
 
+

Detailed Description

+

Error reporting interface.

+

This module defines the return status type. It also provides tools for interactions with status values, such as converting them to a string.

+

Enumeration Type Documentation

+ +
+
+ + + + +
enum EpidStatus
+
+ +

Return status for SDK functions.

+

Convention for status values is as follows:

    +
  • Zero indicates "success"
  • +
  • Any positive number indicates "success with status"
  • +
  • Any negative number indicates "failure"
  • +
+ + + + + + + + + + + + + + + + + + + +
Enumerator
kEpidNoErr  +

no error

+
kEpidSigValid  +

Signature is valid.

+
kEpidSigInvalid  +

Signature is invalid.

+
kEpidSigRevokedinGroupRl  +

Signature revoked in GroupRl.

+
kEpidSigRevokedinPrivRl  +

Signature revoked in PrivRl.

+
kEpidSigRevokedinSigRl  +

Signature revoked in SigRl.

+
kEpidSigRevokedinVerifierRl  +

Signature revoked in VerifierRl.

+
kEpidErr  +

unspecified error

+
kEpidNotImpl  +

not implemented error

+
kEpidBadArgErr  +

incorrect arg to function

+
kEpidNoMemErr  +

not enough memory for the operation

+
kEpidMemAllocErr  +

insufficient memory allocated for operation

+
kEpidMathErr  +

internal math error

+
kEpidDivByZeroErr  +

an attempt to divide by zero

+
kEpidUnderflowErr  +

a value became less than minimum supported level

+
kEpidHashAlgorithmNotSupported  +

unsupported hash algorithm type

+
kEpidRandMaxIterErr  +

reached max iteration for random number generation

+
kEpidDuplicateErr  +

argument would add duplicate entry

+
+
Examples:
verifysig.c.
+
+
+
+

Function Documentation

+ +
+
+ + + + + + + + +
char const* EpidStatusToString (EpidStatus e)
+
+ +

Returns string representation of error code.

+
Parameters
+ + +
eThe status value.
+
+
+
Returns
The string describing the status.
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___error_codes.js b/external/epid/doc/html/group___error_codes.js new file mode 100644 index 0000000000..6121a1ddb8 --- /dev/null +++ b/external/epid/doc/html/group___error_codes.js @@ -0,0 +1,24 @@ +var group___error_codes = +[ + [ "EpidStatus", "group___error_codes.html#gafdb27c77c2c4b32c807e326a8a0da360", [ + [ "kEpidNoErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a8a6861e14322ca9193498ffc955537f9", null ], + [ "kEpidSigValid", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab45ad60085d03c03ea30b40a0519897e", null ], + [ "kEpidSigInvalid", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aeedd19b8a1cbdecf963f90b4860e02b8", null ], + [ "kEpidSigRevokedinGroupRl", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a2b38f44424cecd7b432194a2012dc9c7", null ], + [ "kEpidSigRevokedinPrivRl", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a780a20821863553b88ca617a6fc0f718", null ], + [ "kEpidSigRevokedinSigRl", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aff83186b61d48f9fee5f691c5b219bc1", null ], + [ "kEpidSigRevokedinVerifierRl", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360addbba767bb884b4459a567056b4d3f86", null ], + [ "kEpidErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360aa08f0d2e394b37694117a6a32bc71e6e", null ], + [ "kEpidNotImpl", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a5252da1ff519a098446723e9edd30cc7", null ], + [ "kEpidBadArgErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad134d6cc95a9dcb1b1a9f9c358047cbf", null ], + [ "kEpidNoMemErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ab7dfec784192a827a91a4b8a6054d01c", null ], + [ "kEpidMemAllocErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a11a4d2f1c37064eb663de08dc57bcda8", null ], + [ "kEpidMathErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a1739ecb620f4bede2e1b84e52a96cee6", null ], + [ "kEpidDivByZeroErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a893cd0d417b139bb376d09c93695c3f3", null ], + [ "kEpidUnderflowErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a83a867b4f71ee13edbfca2f1b72abbec", null ], + [ "kEpidHashAlgorithmNotSupported", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360ad4d4ff24a7ef2cd7a50b8082265e9ff4", null ], + [ "kEpidRandMaxIterErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a61234ad9610406da6bf7977afd72a357", null ], + [ "kEpidDuplicateErr", "group___error_codes.html#ggafdb27c77c2c4b32c807e326a8a0da360a3706f895a660260033b5b91890516c0f", null ] + ] ], + [ "EpidStatusToString", "group___error_codes.html#ga59e8680ce52509302fd58a987e45004d", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___file_parser.html b/external/epid/doc/html/group___file_parser.html new file mode 100644 index 0000000000..70cd3af34e --- /dev/null +++ b/external/epid/doc/html/group___file_parser.html @@ -0,0 +1,439 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: fileparser + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+ +
+ +

Parser for issuer material. +More...

+ + + + + + + + +

+Data Structures

struct  EpidFileHeader
 Intel(R) EPID binary file header. More...
 
struct  EpidCaCertificate
 IoT CA Certificate binary format. More...
 
+ + + + +

+Enumerations

enum  EpidFileType {
+  kIssuingCaPubKeyFile, +kGroupPubKeyFile, +kPrivRlFile, +kSigRlFile, +
+  kGroupRlFile, +kPrivRlRequestFile, +kSigRlRequestFile, +kGroupRlRequestFile, +
+  kNumFileTypes +
+ }
 Recognized Intel(R) EPID file types. More...
 
+ + + + + + + + + + + + + +

+Functions

EpidStatus EpidParseGroupPubKeyFile (void const *buf, size_t len, EpidCaCertificate const *cert, GroupPubKey *pubkey)
 Extracts group public key from buffer in issuer binary format. More...
 
EpidStatus EpidParsePrivRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, PrivRl *rl, size_t *rl_len)
 Extracts private key revocation list from buffer in issuer binary format. More...
 
EpidStatus EpidParseSigRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, SigRl *rl, size_t *rl_len)
 Extracts signature revocation list from buffer in issuer binary format. More...
 
EpidStatus EpidParseGroupRlFile (void const *buf, size_t len, EpidCaCertificate const *cert, GroupRl *rl, size_t *rl_len)
 Extracts group revocation list from buffer in issuer binary format. More...
 
+ + + + +

+Variables

+const OctStr16 kEpidFileTypeCode [kNumFileTypes]
 Encoding of issuer material file types.
 
+

Detailed Description

+

Parser for issuer material.

+

Provides an API for parsing buffers formatted according to the various IoT Intel(R) EPID binary file formats.

+

Enumeration Type Documentation

+ +
+
+ + + + +
enum EpidFileType
+
+ +

Recognized Intel(R) EPID file types.

+ + + + + + + + + + +
Enumerator
kIssuingCaPubKeyFile  +

IoT Issuing CA public key file.

+
kGroupPubKeyFile  +

Group Public Key Output File Format.

+
kPrivRlFile  +

Binary Private Key Revocation List.

+
kSigRlFile  +

Binary Signature Revocation List.

+
kGroupRlFile  +

Binary Group Revocation List.

+
kPrivRlRequestFile  +

Binary Private Key Revocation Request.

+
kSigRlRequestFile  +

Binary Signature Revocation Request.

+
kGroupRlRequestFile  +

Binary Group Revocation Request.

+
kNumFileTypes  +

Maximum number of file types.

+
+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidParseGroupPubKeyFile (void const * buf,
size_t len,
EpidCaCertificate const * cert,
GroupPubKeypubkey 
)
+
+ +

Extracts group public key from buffer in issuer binary format.

+

Extracts the first group public key from a buffer with format of Intel(R) EPID 2.0 Group Public Key Certificate Binary File. The function validates that the first public key was signed by the private key corresponding to the provided CA certificate and the size of the input buffer is correct.

+
Warning
It is the responsibility of the caller to authenticate the EpidCaCertificate.
+
Parameters
+ + + + + +
[in]bufPointer to buffer containing public key to extract.
[in]lenThe size of buf in bytes.
[in]certThe issuing CA public key certificate.
[out]pubkeyThe extracted group public key.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidSigInvalidParsing failed due to data authentication failure.
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidParseGroupRlFile (void const * buf,
size_t len,
EpidCaCertificate const * cert,
GroupRlrl,
size_t * rl_len 
)
+
+ +

Extracts group revocation list from buffer in issuer binary format.

+

Extracts the group revocation list from a buffer with format of Binary Group Certificate Revocation List File. The function validates that the revocation list was signed by the private key corresponding to the provided CA certificate and the size of the input buffer is correct.

+

To determine the required size of the revocation list output buffer, provide a null pointer for the output buffer.

+
Warning
It is the responsibility of the caller to authenticate the EpidCaCertificate.
+
Parameters
+ + + + + + +
[in]bufPointer to buffer containing the revocation list to extract.
[in]lenThe size of buf in bytes.
[in]certThe issuing CA public key certificate.
[out]rlThe extracted revocation list. If Null, rl_len is filled with the required output buffer size.
[in,out]rl_lenThe size of rl in bytes.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidSigInvalidParsing failed due to data authentication failure.
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidParsePrivRlFile (void const * buf,
size_t len,
EpidCaCertificate const * cert,
PrivRlrl,
size_t * rl_len 
)
+
+ +

Extracts private key revocation list from buffer in issuer binary format.

+

Extracts the private key revocation list from a buffer with format of Binary Private Key Revocation List File. The function validates that the revocation list was signed by the private key corresponding to the provided CA certificate and the size of the input buffer is correct.

+

To determine the required size of the revocation list output buffer, provide a null pointer for the output buffer.

+
Warning
It is the responsibility of the caller to authenticate the EpidCaCertificate.
+
Parameters
+ + + + + + +
[in]bufPointer to buffer containing the revocation list to extract.
[in]lenThe size of buf in bytes.
[in]certThe issuing CA public key certificate.
[out]rlThe extracted revocation list. If Null, rl_len is filled with the required output buffer size.
[in,out]rl_lenThe size of rl in bytes.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidSigInvalidParsing failed due to data authentication failure.
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus EpidParseSigRlFile (void const * buf,
size_t len,
EpidCaCertificate const * cert,
SigRlrl,
size_t * rl_len 
)
+
+ +

Extracts signature revocation list from buffer in issuer binary format.

+

Extracts the signature based revocation list from a buffer with format of Binary Signature Revocation List File. The function validates that the revocation list was signed by the private key corresponding to the provided CA certificate and the size of the input buffer is correct.

+

To determine the required size of the revocation list output buffer, provide a null pointer for the output buffer.

+
Warning
It is the responsibility of the caller to authenticate the EpidCaCertificate.
+
Parameters
+ + + + + + +
[in]bufPointer to buffer containing the revocation list to extract.
[in]lenThe size of buf in bytes.
[in]certThe issuing CA public key certificate.
[out]rlThe extracted revocation list. If Null, rl_len is filled with the required output buffer size.
[in,out]rl_lenThe size of rl in bytes.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidSigInvalidParsing failed due to data authentication failure.
+
+
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___file_parser.js b/external/epid/doc/html/group___file_parser.js new file mode 100644 index 0000000000..0d7346c603 --- /dev/null +++ b/external/epid/doc/html/group___file_parser.js @@ -0,0 +1,34 @@ +var group___file_parser = +[ + [ "EpidFileHeader", "struct_epid_file_header.html", [ + [ "epid_version", "struct_epid_file_header.html#a35d43c51c1739940381e4898ca87b824", null ], + [ "file_type", "struct_epid_file_header.html#af5d48c739cc6c00c6e1ce35abf4f1473", null ] + ] ], + [ "EpidCaCertificate", "struct_epid_ca_certificate.html", [ + [ "a", "struct_epid_ca_certificate.html#a2811c1914ffae913820f13da914c8f01", null ], + [ "b", "struct_epid_ca_certificate.html#a280e0b0238cf45834c21849ab8a7e124", null ], + [ "header", "struct_epid_ca_certificate.html#ac03cf7257c52ad14e3dd3201b930dd50", null ], + [ "prime", "struct_epid_ca_certificate.html#a3a44e8050ca2f5085652b2b4e15b779c", null ], + [ "pubkey", "struct_epid_ca_certificate.html#a9d2fc21f46cf9fc96e2ea557b70e5356", null ], + [ "r", "struct_epid_ca_certificate.html#ab9d4c318b1fc8d38d3ce53b29f2dfee2", null ], + [ "signature", "struct_epid_ca_certificate.html#a2f8f09ae02919c379c38386668b47418", null ], + [ "x", "struct_epid_ca_certificate.html#a4f77996f90ed7da1d0503c4236b2c9d1", null ], + [ "y", "struct_epid_ca_certificate.html#abd69cce8d5e3940787ee0d17f72184ab", null ] + ] ], + [ "EpidFileType", "group___file_parser.html#ga9a33be7edc6b4c7a867fb07bd2bddecb", [ + [ "kIssuingCaPubKeyFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac24554caafe2db01e2daed413188cd92", null ], + [ "kGroupPubKeyFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba1f8d8c4b253403a35c51e05d34a7ca1e", null ], + [ "kPrivRlFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba692b4141bff8225bee6000750b0da322", null ], + [ "kSigRlFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8aead4b6aab87a1efb2d7e8c77a9b710", null ], + [ "kGroupRlFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecba8e5247daee3999540e6cb24d4c2b3770", null ], + [ "kPrivRlRequestFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac708ba9e56eaeac0f1256457cbd45911", null ], + [ "kSigRlRequestFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac52e5fe24a12424316f655b9b7c62600", null ], + [ "kGroupRlRequestFile", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbab772fa1e3f221af125ffb34b86b3f24c", null ], + [ "kNumFileTypes", "group___file_parser.html#gga9a33be7edc6b4c7a867fb07bd2bddecbac6d742ea3dd3b17f6d763970ac84b811", null ] + ] ], + [ "EpidParseGroupPubKeyFile", "group___file_parser.html#ga43fdbc1bf2edd3695d21cb457365afbb", null ], + [ "EpidParseGroupRlFile", "group___file_parser.html#gad767f72dc55307b872a8b5600da3fd6f", null ], + [ "EpidParsePrivRlFile", "group___file_parser.html#gadc033fb23e3cbda56aa7e3d412060b7e", null ], + [ "EpidParseSigRlFile", "group___file_parser.html#ga237ef5a43076aa6fc6eb18829a93da3f", null ], + [ "kEpidFileTypeCode", "group___file_parser.html#ga3770c39a0546c79447c9d4159d794c33", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___finite_field_primitives.html b/external/epid/doc/html/group___finite_field_primitives.html new file mode 100644 index 0000000000..1c40c12d63 --- /dev/null +++ b/external/epid/doc/html/group___finite_field_primitives.html @@ -0,0 +1,1048 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: finitefield + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
finitefield
+
+
+ +

Finite field operations. +More...

+ + + + + + + + +

+Typedefs

+typedef struct FiniteField FiniteField
 A finite field.
 
+typedef struct FfElement FfElement
 An element in a finite field.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

EpidStatus NewFiniteField (BigNumStr const *prime, FiniteField **ff)
 Creates new finite field. More...
 
EpidStatus NewFiniteFieldViaBinomalExtension (FiniteField const *ground_field, FfElement const *ground_element, int degree, FiniteField **ff)
 Creates a new finite field using binomial extension. More...
 
void DeleteFiniteField (FiniteField **ff)
 Frees a previously allocated FiniteField. More...
 
EpidStatus NewFfElement (FiniteField const *ff, FfElement **new_ff_elem)
 Creates a new finite field element. More...
 
void DeleteFfElement (FfElement **ff_elem)
 Frees a previously allocated FfElement. More...
 
EpidStatus ReadFfElement (FiniteField *ff, void const *ff_elem_str, size_t strlen, FfElement *ff_elem)
 Deserializes a FfElement from a string. More...
 
EpidStatus WriteFfElement (FiniteField *ff, FfElement const *ff_elem, void *ff_elem_str, size_t strlen)
 Serializes a finite field element to a string. More...
 
EpidStatus FfNeg (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the additive inverse of a finite field element. More...
 
EpidStatus FfInv (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the multiplicative inverse of a finite field element. More...
 
EpidStatus FfAdd (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Adds two finite field elements. More...
 
EpidStatus FfMul (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Multiplies two finite field elements. More...
 
EpidStatus FfIsZero (FiniteField *ff, FfElement const *a, bool *is_zero)
 Checks if given finite field element is the additive identity (zero). More...
 
EpidStatus FfExp (FiniteField *ff, FfElement const *a, BigNum const *b, FfElement *r)
 Raises an element of a finite field to a power. More...
 
EpidStatus FfMultiExp (FiniteField *ff, FfElement const **a, BigNumStr const **b, size_t m, FfElement *r)
 Multi-exponentiates finite field elements. More...
 
EpidStatus FfSscmMultiExp (FiniteField *ff, FfElement const **a, BigNumStr const **b, size_t m, FfElement *r)
 Software side-channel mitigated implementation of FfMultiExp. More...
 
EpidStatus FfIsEqual (FiniteField *ff, FfElement const *a, FfElement const *b, bool *is_equal)
 Checks if two finite field elements are equal. More...
 
EpidStatus FfHash (FiniteField *ff, void const *msg, size_t msg_len, HashAlg hash_alg, FfElement *r)
 Hashes an arbitrary message to an element in a finite field. More...
 
EpidStatus FfGetRandom (FiniteField *ff, BigNumStr const *low_bound, BitSupplier rnd_func, void *rnd_param, FfElement *r)
 Generate random finite field element. More...
 
+

Detailed Description

+

Finite field operations.

+

provides APIs for working with finite fields. Finite fields allow simple mathematical operations based on a finite set of discrete values. the results of these operations are also contained in the same set.

+

A simple example of a finite field is all integers from zero that are less than a given value.

+

The elements (FfElement) of a finite field can be used in a variety of simple mathematical operations that result in elements of the same field.

+

Function Documentation

+ +
+
+ + + + + + + + +
void DeleteFfElement (FfElement ** ff_elem)
+
+ +

Frees a previously allocated FfElement.

+

Frees memory pointed to by ff_elem. Nulls the pointer.

+
Parameters
+ + +
[in]ff_elemThe finite field element. Can be NULL.
+
+
+
See also
NewFfElement
+ +
+
+ +
+
+ + + + + + + + +
void DeleteFiniteField (FiniteField ** ff)
+
+ +

Frees a previously allocated FiniteField.

+

Frees memory pointed to by finite field. Nulls the pointer.

+
Parameters
+ + +
[in]ffThe Finite field. Can be NULL.
+
+
+
See also
NewFiniteField
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfAdd (FiniteFieldff,
FfElement const * a,
FfElement const * b,
FfElementr 
)
+
+ +

Adds two finite field elements.

+
Parameters
+ + + + + +
[in]ffThe finite field.
[out]aThe left hand parameter.
[out]bThe right hand parameter.
[out]rThe result of adding a and b.
+
+
+
Returns
EpidStatus
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfExp (FiniteFieldff,
FfElement const * a,
BigNum const * b,
FfElementr 
)
+
+ +

Raises an element of a finite field to a power.

+
Parameters
+ + + + + +
[in]ffThe finite field in which to perform the operation
[in]aThe base.
[in]bThe power.
[out]rThe result of raising a to the power b.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfGetRandom (FiniteFieldff,
BigNumStr const * low_bound,
BitSupplier rnd_func,
void * rnd_param,
FfElementr 
)
+
+ +

Generate random finite field element.

+
Parameters
+ + + + + + +
[in]ffThe finite field associated with the random finite field element.
[in]low_boundLower bound of the random finite field to be generated.
[in]rnd_funcRandom number generator.
[in]rnd_paramPass through context data for rnd_func.
[in,out]rThe random finite field element.
+
+
+
Returns
EpidStatus
+
Return values
+ + +
kEpidRandMaxIterErrthe function should be called again with different random data.
+
+
+
See also
NewFfElement
+
+BitSupplier
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfHash (FiniteFieldff,
void const * msg,
size_t msg_len,
HashAlg hash_alg,
FfElementr 
)
+
+ +

Hashes an arbitrary message to an element in a finite field.

+
Parameters
+ + + + + + +
[in]ffThe finite field.
[in]msgThe message.
[in]msg_lenThe size of msg in bytes.
[in]hash_algThe hash algorithm.
[out]rThe hashed value.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfInv (FiniteFieldff,
FfElement const * a,
FfElementr 
)
+
+ +

Calculates the multiplicative inverse of a finite field element.

+
Parameters
+ + + + +
[in]ffThe finite field.
[in]aThe element.
[out]rThe inverted element.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfIsEqual (FiniteFieldff,
FfElement const * a,
FfElement const * b,
boolis_equal 
)
+
+ +

Checks if two finite field elements are equal.

+
Parameters
+ + + + + +
[in]ffThe finite field.
[in]aAn element to check.
[in]bAnother element to check.
[out]is_equalThe result of the check.
+
+
+
Returns
EpidStatus
+
See also
NewEcGroup
+
+NewEcPoint
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfIsZero (FiniteFieldff,
FfElement const * a,
boolis_zero 
)
+
+ +

Checks if given finite field element is the additive identity (zero).

+
Parameters
+ + + + +
[in]ffThe finite field.
[out]aThe element.
[out]is_zeroThe result of the check.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfMul (FiniteFieldff,
FfElement const * a,
FfElement const * b,
FfElementr 
)
+
+ +

Multiplies two finite field elements.

+
Parameters
+ + + + + +
[in]ffThe finite field.
[out]aThe left hand parameter.
[out]bThe right hand parameter. If ff is an extension field of a field F then this parameter may be an element of either ff or F.
[out]rThe result of multiplying a and b.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfMultiExp (FiniteFieldff,
FfElement const ** a,
BigNumStr const ** b,
size_t m,
FfElementr 
)
+
+ +

Multi-exponentiates finite field elements.

+

Calculates FfExp(p[0],b[0]) * ... * FfExp(p[m-1],b[m-1]) for m > 1

+
Parameters
+ + + + + + +
[in]ffThe finite field in which to perform the operation
[in]aThe bases.
[in]bThe powers.
[in]mNumber of entries in a and b.
[out]rThe result of raising each a to the corresponding power b and multiplying the results.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfNeg (FiniteFieldff,
FfElement const * a,
FfElementr 
)
+
+ +

Calculates the additive inverse of a finite field element.

+
Parameters
+ + + + +
[in]ffThe finite field.
[in]aThe element.
[out]rThe inverted element.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus FfSscmMultiExp (FiniteFieldff,
FfElement const ** a,
BigNumStr const ** b,
size_t m,
FfElementr 
)
+
+ +

Software side-channel mitigated implementation of FfMultiExp.

+

Calculates FfExp(p[0],b[0]) * ... * FfExp(p[m-1],b[m-1]) for m > 1

+
Attention
The reference implementation of FfSscmMultiExp calls FfMultiExp directly because the implementation of FfMultiExp is already side channel mitigated. Implementers providing their own versions of this function are responsible for ensuring that FfSscmMultiExp is side channel mitigated per section 8 of the Intel(R) EPID 2.0 spec.
+
Parameters
+ + + + + + +
[in]ffThe finite field in which to perform the operation.
[in]aThe bases.
[in]bThe powers.
[in]mNumber of entries in a and b.
[out]rThe result of raising each a to the corresponding power b and multiplying the results.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+NewFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus NewFfElement (FiniteField const * ff,
FfElement ** new_ff_elem 
)
+
+ +

Creates a new finite field element.

+

Allocates memory and creates a new finite field element.

+

Use DeleteFfElement() to free memory.

+
Parameters
+ + + +
[in]ffThe finite field.
[out]new_ff_elemThe Newly constructed finite field element.
+
+
+
Returns
EpidStatus
+
See also
NewFiniteField
+
+DeleteFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
EpidStatus NewFiniteField (BigNumStr const * prime,
FiniteField ** ff 
)
+
+ +

Creates new finite field.

+

Allocates memory and creates a new finite field GF(prime).

+

Use DeleteFiniteField() to free memory.

+
Parameters
+ + + +
[in]primeThe order of finite field.
[out]ffThe Newly constructed finite field.
+
+
+
Returns
EpidStatus
+
See also
DeleteFiniteField
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus NewFiniteFieldViaBinomalExtension (FiniteField const * ground_field,
FfElement const * ground_element,
int degree,
FiniteField ** ff 
)
+
+ +

Creates a new finite field using binomial extension.

+

Allocates memory and creates a finite field using binomial extension.

+

Use DeleteFiniteField() to free memory.

+
Parameters
+ + + + + +
[in]ground_fieldThe ground field.
[in]ground_elementThe low-order term of the extension.
[in]degreeThe degree of the extension.
[out]ffThe Newly constructed finite field.
+
+
+
Returns
EpidStatus
+
See also
DeleteFiniteField
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus ReadFfElement (FiniteFieldff,
void const * ff_elem_str,
size_t strlen,
FfElementff_elem 
)
+
+ +

Deserializes a FfElement from a string.

+
Parameters
+ + + + + +
[in]ffThe the finite field.
[in]ff_elem_strThe serialized value.
[in]strlenThe size of ff_elem_str in bytes.
[out]ff_elemthe target FfElement.
+
+
+
Returns
EpidStatus
+
See also
NewFfElement
+
+WriteFfElement
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus WriteFfElement (FiniteFieldff,
FfElement const * ff_elem,
void * ff_elem_str,
size_t strlen 
)
+
+ +

Serializes a finite field element to a string.

+
Parameters
+ + + + + +
[in]ffThe finite field.
[in]ff_elemThe FfElement to be serialized.
[out]ff_elem_strThe target string.
[in]strlenThe size of ff_elem_str in bytes.
+
+
+
Returns
EpidStatus
+
See also
NewFfElement
+
+FpElemStr
+
+FqElemStr
+
+GtElemStr
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___finite_field_primitives.js b/external/epid/doc/html/group___finite_field_primitives.js new file mode 100644 index 0000000000..462a90c1c5 --- /dev/null +++ b/external/epid/doc/html/group___finite_field_primitives.js @@ -0,0 +1,23 @@ +var group___finite_field_primitives = +[ + [ "FfElement", "group___finite_field_primitives.html#ga6cff5c7c06b07a87442b810ccc0a86fa", null ], + [ "FiniteField", "group___finite_field_primitives.html#gab281b24e336a8b3d7d90079d862d969e", null ], + [ "DeleteFfElement", "group___finite_field_primitives.html#ga1bad3c6945d1d709fceb07a1dd03000e", null ], + [ "DeleteFiniteField", "group___finite_field_primitives.html#gacbdd2871ecf93dadaac9d2c5b16e1e5f", null ], + [ "FfAdd", "group___finite_field_primitives.html#ga1a6e6d3c2319bb24eae8670b021e223b", null ], + [ "FfExp", "group___finite_field_primitives.html#gaf0ddbc1bad048d67771cba119eb44a6c", null ], + [ "FfGetRandom", "group___finite_field_primitives.html#ga6622db072782fd9e53b4d59dd3dbd8e8", null ], + [ "FfHash", "group___finite_field_primitives.html#ga18a952cebb4a1274c73e6cb0c19e8aea", null ], + [ "FfInv", "group___finite_field_primitives.html#ga26069d035d0f6ade33af2b5d5c14949a", null ], + [ "FfIsEqual", "group___finite_field_primitives.html#gaed2acb8583e9c9f6b49fdb660c672625", null ], + [ "FfIsZero", "group___finite_field_primitives.html#ga20d9140e5670d679ef8183d9b5115f53", null ], + [ "FfMul", "group___finite_field_primitives.html#ga4613a75bd001a974b3e3e494c3a112a5", null ], + [ "FfMultiExp", "group___finite_field_primitives.html#ga84d21decc1c957bcf6e98e1492eb2ac3", null ], + [ "FfNeg", "group___finite_field_primitives.html#gae7a8c7503b6fc7a41bcaab4d45ca37b2", null ], + [ "FfSscmMultiExp", "group___finite_field_primitives.html#ga0d0c31a22bbfb665a16b2d25b0cd2634", null ], + [ "NewFfElement", "group___finite_field_primitives.html#gacc54f315ede2dbeb8c5990c024a0de6c", null ], + [ "NewFiniteField", "group___finite_field_primitives.html#ga7d99fdc5e4573668a5744e49df7ab67c", null ], + [ "NewFiniteFieldViaBinomalExtension", "group___finite_field_primitives.html#ga83041e3be9984a4bd8f1021934bfa3a2", null ], + [ "ReadFfElement", "group___finite_field_primitives.html#ga884d9e1baadf29a410244a735853e3c7", null ], + [ "WriteFfElement", "group___finite_field_primitives.html#ga678694636708463b078d842d5c58a900", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___hash_primitives.html b/external/epid/doc/html/group___hash_primitives.html new file mode 100644 index 0000000000..3125c01dc9 --- /dev/null +++ b/external/epid/doc/html/group___hash_primitives.html @@ -0,0 +1,142 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: hash + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
hash
+
+
+ +

Hash primitives. +More...

+ + + + + +

+Data Structures

struct  Sha256Digest
 SHA256 digest. More...
 
+ + + + +

+Functions

EpidStatus Sha256MessageDigest (void const *msg, size_t len, Sha256Digest *digest)
 Computes SHA256 digest of a message. More...
 
+

Detailed Description

+

Hash primitives.

+

Provides APIs for computing digests of messages.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus Sha256MessageDigest (void const * msg,
size_t len,
Sha256Digestdigest 
)
+
+ +

Computes SHA256 digest of a message.

+
Parameters
+ + + + +
[in]msgMessage to compute digest for.
[in]lenThe size of msg in bytes.
[out]digestThe resulting message digest.
+
+
+
Returns
EpidStatus
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___hash_primitives.js b/external/epid/doc/html/group___hash_primitives.js new file mode 100644 index 0000000000..14b92829cf --- /dev/null +++ b/external/epid/doc/html/group___hash_primitives.js @@ -0,0 +1,7 @@ +var group___hash_primitives = +[ + [ "Sha256Digest", "struct_sha256_digest.html", [ + [ "data", "struct_sha256_digest.html#a4b6462ddd3f89e4c40220ceb6b1c7f28", null ] + ] ], + [ "Sha256MessageDigest", "group___hash_primitives.html#ga86d62aac9efd7445acee311b41846c6c", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/group___pairing_primitives.html b/external/epid/doc/html/group___pairing_primitives.html new file mode 100644 index 0000000000..6b31f6182c --- /dev/null +++ b/external/epid/doc/html/group___pairing_primitives.html @@ -0,0 +1,249 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: pairing + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
pairing
+
+
+ +

Pairing operations. +More...

+ + + + + +

+Typedefs

+typedef struct PairingState PairingState
 A pairing.
 
+ + + + + + + + + + +

+Functions

EpidStatus NewPairingState (EcGroup const *ga, EcGroup const *gb, FiniteField *ff, BigNumStr const *t, bool neg, PairingState **ps)
 Constructs a new Pairing State. More...
 
void DeletePairingState (PairingState **ps)
 Frees a previously allocated by PairingState. More...
 
EpidStatus Pairing (PairingState *ps, FfElement *d, EcPoint const *a, EcPoint const *b)
 Computes an Optimal Ate Pairing for two parameters. More...
 
+

Detailed Description

+

Pairing operations.

+

Provides APIs for defining and using a pairing relationship between two Elliptic Curve Groups.

+

Function Documentation

+ +
+
+ + + + + + + + +
void DeletePairingState (PairingState ** ps)
+
+ +

Frees a previously allocated by PairingState.

+

Frees memory pointed to by pairing state. Nulls the pointer.

+
Parameters
+ + +
[in]psThe Pairing state. Can be NULL.
+
+
+
See also
NewPairingState
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus NewPairingState (EcGroup const * ga,
EcGroup const * gb,
FiniteFieldff,
BigNumStr const * t,
bool neg,
PairingState ** ps 
)
+
+ +

Constructs a new Pairing State.

+

Allocates memory and creates a new Pairing State for Optimal Ate Pairing.

+

Use DeletePairingState() to free memory.

+
Parameters
+ + + + + + + +
[in]gaThe EcGroup from which the first parameter of the pairing is taken.
[in]gbThe EcGroup from which the second parameter of the pairing is taken.
[in]ffThe result finite field. Must be a Fq12 field.
[in]tA positive integer such that 6(t^2) == q - p, where p and q are parameters of G1.
[in]negSelect the alternate "negate" processing path for Optimal Ate Pairing.
[out]psNewly constructed Pairing State.
+
+
+
Returns
EpidStatus
+
See also
DeletePairingState
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EpidStatus Pairing (PairingStateps,
FfElementd,
EcPoint const * a,
EcPoint const * b 
)
+
+ +

Computes an Optimal Ate Pairing for two parameters.

+
Parameters
+ + + + + +
[in]psThe pairing state.
[out]dThe result of the pairing. Will be in ff used to create the pairing state.
[in]aThe first value to pair. Must be in ga used to create ps.
[in]bThe second value to pair. Must be in gb used to create ps
+
+
+
Returns
EpidStatus
+ +
+
+
+
+ + + + + diff --git a/external/epid/doc/html/group___pairing_primitives.js b/external/epid/doc/html/group___pairing_primitives.js new file mode 100644 index 0000000000..4f7612011c --- /dev/null +++ b/external/epid/doc/html/group___pairing_primitives.js @@ -0,0 +1,7 @@ +var group___pairing_primitives = +[ + [ "PairingState", "group___pairing_primitives.html#ga3f1fa61d25487f96dfb0ffef4ad35607", null ], + [ "DeletePairingState", "group___pairing_primitives.html#gad54aebdc331d39b73000fdca9e04f94d", null ], + [ "NewPairingState", "group___pairing_primitives.html#ga29f79a645871830754d396b9b4a2a0cc", null ], + [ "Pairing", "group___pairing_primitives.html#ga5dd07d13536e27c37eaeee285297066c", null ] +]; \ No newline at end of file diff --git a/external/epid/doc/html/grouppubkey_8c.html b/external/epid/doc/html/grouppubkey_8c.html new file mode 100644 index 0000000000..009cf4253e --- /dev/null +++ b/external/epid/doc/html/grouppubkey_8c.html @@ -0,0 +1,96 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/grouppubkey.c File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
grouppubkey.c File Reference
+
+
+ +

Group public key implementation. +More...

+ + + + + + + + +

+Functions

EpidStatus CreateGroupPubKey (GroupPubKey const *pub_key_str, EcGroup *G1, EcGroup *G2, GroupPubKey_ **pub_key)
 Constructs internal representation of GroupPubKey. More...
 
void DeleteGroupPubKey (GroupPubKey_ **pub_key)
 Deallocates storage for internal representation of GroupPubKey. More...
 
+

Detailed Description

+

Group public key implementation.

+
+
+ + + + + diff --git a/external/epid/doc/html/grouppubkey_8h.html b/external/epid/doc/html/grouppubkey_8h.html new file mode 100644 index 0000000000..a179e826a0 --- /dev/null +++ b/external/epid/doc/html/grouppubkey_8h.html @@ -0,0 +1,104 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/grouppubkey.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
grouppubkey.h File Reference
+
+
+ +

Group public key interface. +More...

+ + + + + +

+Data Structures

struct  GroupPubKey_
 Internal representation of GroupPubKey. More...
 
+ + + + + + + +

+Functions

EpidStatus CreateGroupPubKey (GroupPubKey const *pub_key_str, EcGroup *G1, EcGroup *G2, GroupPubKey_ **pub_key)
 Constructs internal representation of GroupPubKey. More...
 
void DeleteGroupPubKey (GroupPubKey_ **pub_key)
 Deallocates storage for internal representation of GroupPubKey. More...
 
+

Detailed Description

+

Group public key interface.

+
+
+ + + + + diff --git a/external/epid/doc/html/hash_8h.html b/external/epid/doc/html/hash_8h.html new file mode 100644 index 0000000000..fb3b6f669a --- /dev/null +++ b/external/epid/doc/html/hash_8h.html @@ -0,0 +1,102 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: epid/common/math/hash.h File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+ +
+
hash.h File Reference
+
+
+ +

Hash primitives. +More...

+
#include <stddef.h>
+#include <stdint.h>
+#include <limits.h>
+#include "epid/common/errors.h"
+
+ + + + +

+Data Structures

struct  Sha256Digest
 SHA256 digest. More...
 
+ + + + +

+Functions

EpidStatus Sha256MessageDigest (void const *msg, size_t len, Sha256Digest *digest)
 Computes SHA256 digest of a message. More...
 
+

Detailed Description

+

Hash primitives.

+
+
+ + + + + diff --git a/external/epid/doc/html/implementation__notes_8dox.html b/external/epid/doc/html/implementation__notes_8dox.html new file mode 100644 index 0000000000..be407ab5bb --- /dev/null +++ b/external/epid/doc/html/implementation__notes_8dox.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: doc/docsrc/implementation_notes.dox File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
doc/docsrc/implementation_notes.dox File Reference
+
+
+ +

This file is used by Doxygen to generate documentation. +More...

+

Detailed Description

+

This file is used by Doxygen to generate documentation.

+
+
+ + + + + diff --git a/external/epid/doc/html/index.html b/external/epid/doc/html/index.html new file mode 100644 index 0000000000..3a81885cd2 --- /dev/null +++ b/external/epid/doc/html/index.html @@ -0,0 +1,78 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: Introducing the Intel® EPID SDK + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
Introducing the Intel® EPID SDK
+
+
+

Intel® EPID is a cryptographic protocol which enables the remote authentication of a trusted platform whilst preserving the user's privacy.

+

The Intel® EPID Software Development Kit provides an implementation of the Intel® EPID specification that developers can use when developing their own applications using Intel® EPID technology.

+
+
+ + + + + diff --git a/external/epid/doc/html/issuer__material_8dox.html b/external/epid/doc/html/issuer__material_8dox.html new file mode 100644 index 0000000000..b8c991864e --- /dev/null +++ b/external/epid/doc/html/issuer__material_8dox.html @@ -0,0 +1,82 @@ + + + + + + + +Intel® Enhanced Privacy ID SDK: doc/docsrc/issuer_material.dox File Reference + + + + + + + + + + + + +
+
+ + + + + + +
+ +
+
+ + +
+
+ +
+
+
+ +
+
+
+
doc/docsrc/issuer_material.dox File Reference
+
+
+ +

This file is used by Doxygen to generate documentation. +More...

+

Detailed Description

+

This file is used by Doxygen to generate documentation.

+
+
+ + + + + diff --git a/external/epid/doc/html/jquery.js b/external/epid/doc/html/jquery.js new file mode 100644 index 0000000000..1f4d0b47ce --- /dev/null +++ b/external/epid/doc/html/jquery.js @@ -0,0 +1,68 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
t
";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bRe[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="

";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="
";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT0){for(bB=bA;bB=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div
","
"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1>");try{for(var bw=0,bv=this.length;bw1&&bw0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]===""&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("
").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"":"")+"");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*! + * jQuery UI 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/*! + * jQuery UI Widget 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Widget + */ +(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/*! + * jQuery UI Mouse 1.8.18 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Mouse + * + * Depends: + * jquery.ui.widget.js + */ +(function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g
');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(hl.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*! + * jQuery hashchange event - v1.3 - 7/21/2010 + * http://benalman.com/projects/jquery-hashchange-plugin/ + * + * Copyright (c) 2010 "Cowboy" Ben Alman + * Dual licensed under the MIT and GPL licenses. + * http://benalman.com/about/license/ + */ +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('

U>FrX=aeouz>n884Fw7q?Aw&E#7|GiYW~Y~;7;rmNb( z`sZaI0tooBzLD0dDP(R`iz-EhF}YleJHBW4`ht??I;w3Be;pVmtp~i15VTeWObUc$ ztw43zzO*dRp+7u;KBr3SjdSP0%Y;v;I3+f4dyP{s(o9F&1G1=`&sSliSVN3#sUHHf zX@oLhjW>T1Z@|_S8wixUC*em+(avO2aJhAS>KR_{vPpQoG-Ui4ogn7d)JGU4*m7hi z&ck~CXIPYF#{wj@K1}=9j?9^%mNgfLE1q2IQvT?lPT@k!H0@u1W#|{Sptu3#YR2As z8R2hFsj4Z6-G4HoNS{=DJntk`nG9F;qNzC@{4V~uWx-^|nk8#_FB1Hyy-;|obyX2s zBA@iAm$p>$QX4fzF42EDC4{2 zzqMPl;mzmZosF$+sBH><{piLoj*}3$()I7Bv$G#E33tk1nWI4Xw=7{x0Q$q?)K&ie z$i*j-6t_o>oTq5k47~$t#oW3Ho$|3MQKbAoNe5Qnw^9TeLQ1|WdXLc}DeoJLQE$eE z&Hl?qvB%F0vKl<)Pf#c{)io$ObpW^KP)LYqi|t!MNR12-xI=%4FN+J&^8AzP#RT2_ zaU07N?wOo}8e|qt3kzH>(8Z$UzLP_EQJ;VBA$94duY0gE!J(epZ02IG(zoY(2TtUT z+&9-@0<%R5e%3AGvrr0ToLD(-<%s(;+;OSWnOE~M31{}vu?}EG^D_Dz<DN8i(L8IYMre>A-LIu;#%DGE6ZYxm{?691V@*94cIerJXPCL;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plugins/com.intel.sgx.userguide/html/Resources/Images/Import_or_Re_Generate_Enclave_Signing_Key.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Import_or_Re_Generate_Enclave_Signing_Key.png new file mode 100644 index 0000000000000000000000000000000000000000..d9545448413925f0d9a5cd043337b3e46cd08dfe GIT binary patch literal 82732 zcmZ^~byQp1^F9oP7MGUdUfkW?iaV47#fzjA_aeb5rMNp3cXx;49$Z3NJU9fm{BrO8 zeBb}xtd(S)vyy%G?3q0?&oi?lwKNoQFv&2HkdSbcmE?7hkY4;mLPBOle}TATEBPS_ z@rCTBqbQ41Jw*XUT%g*@sLLQB)x}~xTD(MDV>l}rx*;Lq4*c^*9(F4IjD!R)QkIv| z^EN$tx-z32Z$6FA?b&)5fOU4?toxqCccs=4zI=f!J44^v(P1BmAB>8D8X@iM72JV% z4Y*rt{2^VCNKdC7T{UcO8h$=vxAF2=C_Om%wq*CzqB_ATX|?xmh?r+1Ioo20kY_4l z=-JTf^?MSF(AV#mAtR{F_dhYXJ*{7iScEs=VJqe%MWCR{LSra$a_UiYdC{VO$JLP58>`dr~Ap>-@S}_cFVvhJ+H|4ht%f9d?b?b2!I=z zk%yp`fDieD6fbfFa8VKmATwmZ$PBZ^;3!453C^%!EPYaBv>P$AcmHn~^Z_-baESQ} zUVpn6KP?!0$!&zMdYzR*FlKJCL^%GOO|LT1aEx4xp%(cg=fBkNQ`1tIKy^5a$1u9_ z;wAe>8WIaQ86(LJ5RU)}N=JZ%&4;|qJ>V13fOljo%n`VsjDi0Uk74&n+JOs@u}Q-i z>%-)A;V`G+JgayvJ{nHuWal3g_4 z>pi+D6>elPAYZvuU?UCQ1nP=aIB}$Jpf4Rg{|VbkOCD9OWka5XB)^OmFeo15p9MmU z7Nw39%f*cxC&`Z(Y`}%Fca5;zS~5DgUqPNGyP980Ih*f-~rtb3o8vVS+!$KNf$L z4yAvGX(!FS_-@Gs%Zu$*b1iyxzpG{Cl%o1u% za$d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 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Configurations_Specific_to_Intel_SGX_Technology.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Configurations_Specific_to_Intel_SGX_Technology.png new file mode 100644 index 0000000000000000000000000000000000000000..f36ca69c05ddfa76158c5d6078a1033ea58cc60f GIT binary patch literal 34117 zcmV*zKs>*RP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>DgxX0&K~#8N?frLD z6MNk?b>xhUXClGh$4z8 z;?KhqvNCKDMHEp)5q}<@kdb1ED58iWium*J1dqoQQA80%6!GWb330K%iYTIpB8vF) z@PxnL6%l_S^z#)_#9s@AjQ`ie6K}r%PQ-5aX#JJJep6p-btaHM{#TO$%he@`Vj>`lt0^nMEr%3Z=A+fnnIg^oX(?nqM^eaeMHKN@MIm=Ml0t6vN%I8%n)9;}jw+P$Nf0ix*bw;c&OWh6 zVM2M{5(Roka^KW8e@1R?Z9RIp*wfiOJv|90BDD1*5>^&=7vG(OrF7Zuvo-UL@Bp{?)Fr%#{ZttFiPGjeTfYkO-8 zPGRlPrjN|cO>o6sIMzPl_bwy?;m6~Lb6Zb$p^t@1{fvaB*o9d0M>NGj8-7bL+?D0| zob>3T{Pf+O9igqj!;S+*p6@|5-fslsC*!m2omYF$zj^lZo98dTe)i(|&MsJqP@dy? z0_)fxBIH|n_z?K;;VSlrz$!|4ieHF@iX2JE34;6R;qtRxtnGxh9^w;d<*#48c(%I@ z!v1XM={GNSzkacY{e8asdwER;RTpRHu$wn0 z#>epi+qaoP0goa$%)9v3KsVNpCS+TCv@$o{H$BlYGtv2$lidq*BOB{$V3R^cga~z5 zn44*7tePAjfl3N(72p~)`-^AWyHDZTD75Ll2nU*Uq6%ej#% z_`SKg4OKd@^(P>7&eqP0t=+GHo7>Ov#I>i}FIVP=mS(!1?!5X*>i|c8^l)~5vSn_( zVQ#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Y8du_y9sSgc%2>!UOFE z8<+fzy`aIqqX+Pi*aHtiRMC3yI01x#!$G%B4i1eiEd?!f0|Nsosj1XB#5?g+iUu&P zcqac{`i3x26xj#wifzXdrsr5Zl-mFVJSHI^_d^hN*4Nn!4wxkjm~oD-M>Ts=6j;R4&#G;#n96v4sMbH zim*Rmr&{2s6k(7|i9XVGAb+bu3FPX)8XXiNF+`%fg~UVIqS zUvN|c|Ia!U4xMK*u-xDS8X^4-oP0~T;nLUa^-J%AEaP`hrk2AGn!GJ8*-eQ)@78@Pi49wT|9EZN}GnET6wS1NdiDr11!=xbdDY(I-*q*5)Pn;o9%7SC{P4+}z zcE=gBIh1OG7^?39@5z1p)^&A<3nbh=KhM_rejCG?vuAB9Kd}I{|nHX{H4 literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Configure_SGX_Hardware_Release_Mode.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Configure_SGX_Hardware_Release_Mode.png new file mode 100644 index 0000000000000000000000000000000000000000..f7151654d05f3b3807832b501e28cb9e2c672af9 GIT binary patch literal 23884 zcmb5VWmsEH*EU>QtY|6jP^@Thinp|Qakm7gI5for6ev*K3Mo!0QrtZR*B~wK?i$?T zO|SdDp6C1V{dnIwjwG|QCu`QMS#qwmCt>QU^7uGZIFBAZ!dFyyr}^j++8F9Zg8dlv z4Q+{f4C(_7tSK+^sC0;C8+Czh^G4;(qem4nxVL5)sOzUL3I^auj|e*czR-G{e_1|y zWW22S?v1u5aKG6@TYI;015sahlL@~#edX~fW|Zx;&sQe1d1ApnwB{VxjHkZFK%xGI z_j5LSST=TG)~}a1=Fz`Q-=Sm3qIJo9B*^WQQ6f@Q;y0~5Fgm%j6SLQ4(9%AVT&0v9 zFLur=+`JnXk+vQebTO&~sCwb+6s{?|>&p)B^whOu}C4 zUt&>-Pyahb>&(c%oSE7(X62z;hB>wVcWMnSR8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C_i9EZogejqZh^J-7-$ zx})z>FQSrtqm5|+w+nJ?XqDpXbPu(S|7Dp0n~`Q(BYJ_IC~7fjDU*IS@MtGB`l4P6 z&;QPV1+xRy-lPOPr68O#unp}1zIllM4SIjl2}KXrV$Q12@!#Mb+b;uSdL+*W!pG;+ z@P)#HoTIc=(AIP)&=-BmF$Yt=nnqw47ZvTaLmayc=~zJXJRAsSbZN|joB{aBY$ckK zeG;#h8-hehoStmPqZC9`A}`o>8v}pNEiMW-2aCw-K;R`76jNY}0q14<-YvYT@-qah zKj8@We#G5tJho^cxaV26!&Ek-8Y6Ae!Fxm_u8(q^U$)Pe!U*o8bAr QH=u9AVeHV4EW8r`2fdo*aR2}S literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Copying_the_Untrusted_Module_to_a_Project.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Copying_the_Untrusted_Module_to_a_Project.png new file mode 100644 index 0000000000000000000000000000000000000000..fb363ea78d7b882f81e2126faca2122da1757355 GIT binary patch literal 23980 zcmV*vKtR8VP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>DT|r4iK~#8N?Y)I} z8{3}e`~HKO?w&iV@2t1hgVk@%%$u3+c|F}14~03gV`he!ZJC*wnVFfH*_K(BZAm8C zvcTdJ^Q)5N#L3C&o8yz5C^!4Fe%313^{c&i$zT0;!LR-|(|`XT^#A7XOA|Ag9QNty z>F(~XOeRzPCHMl#$oTZ!WUGL-3Xv8!W;?2?8g}t##l6dS{L7z))po5ODV5s79}A^i zB9SVzGb+heS4mzon*En6`!V5O;MOs#Ie;I|KjOuCRaMfXQYrV$ZatuaMEV^8F0H`S!7GM9txq?8$hS z*u}A)uJ+c}_QBchOR;vjlzF@`)Cn&fUEb%&)r(|D8Fu;xUg=Fu4P7&96q#r&(bd=~ zzOJ>st)p-0fO^$i3i9rJUwd;~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4wnx;yD&rBrZX0u79QeD*PY}3;wlS!x3 z_4W0&DHIZk#A>xBlLQVS-5fa_?T7Tn>9LEG*dVcGzCk)nzuD=jZ3) zIM&zJcv%MlM3BWmhvOTu;Y&k5w6|;2YNyjVJL`hWFrXdi=~B+w?~q9%ok>Fvd5L=i z$Ck@x;YM%faK|S2v6wG z36>UYL_Ef_EH7~n;9Db+b)V1c_5M}>p1}kDLI9#jvKTn#a3~~^G-DWs%s1wue-;ek6>l6)L^XuH}q*;DTwZ}wdkI66PNdFIf_H;2u=je#Y1 zA@X(lZWPLLecS0r#O?-V^Oavc{NeZ99%{L*sb9wAZv9F8+)+ualB+3Cq#ADH4r^iRzkKZ+Z7qBV4hErC>2fF%qumNc_vX&RY&ngoHe-LGn z?_20e@aM@9Lrd+L>_bCijqc>TmnFvn4}9F`aMen($^*eQDHGTP`ti?`RkstHGM=9@ zcF$q@-~AqNavDnF%Lm2Z(qM?$bT*ya%4}|>vd<`ng(?TMw-)hV7>aLfR2;NX1y&s* lVpU+(AtG7@Rs|xW(U$;D*%2gdF0B9n002ovPDHLkV1hr+6!8E6 literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Enclave_Configuration_Settings.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Enclave_Configuration_Settings.png new file mode 100644 index 0000000000000000000000000000000000000000..42217bd09722ad3bdd9f20804b3a1996d56ffff9 GIT binary patch literal 43019 zcmbSS1yfwj5=8^S6Wjv{5?q421QOic-Q8_*mjrirTO1ZxG(hm+&f?DEzQE)A3-4A< z-I_boQ(aS2J$=sU8>OTmjfqBr1_uX+`SXXQ3LG4~^;^S6MR@yy-Bf7s_JVg+krs!m zogh1W>mXT*$&10k)hD3CjFI2^@11^VyTZX?_5au4haAhz;NZ&ge@cp}c^RBMoBNV2 z%(KMqIc6*F`zKu&W9NK(nr9Q+k!vi%k1F?s zi`r?lJ+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_%hBJH6@-?0)wP zJwKG&IUMf}fcE|a=jcBk+9=H}-5`uy@TyfH)qE1>zNz?1u!PzWfk>ApSLTZMsuU^76t{>6~7 zCf5Qe<9gkl^ajH>Ha0GDawaDyA08eS6%|1R=9QM7TyD0zUv7*}Pfw4Jk57(|kB(06 zeM+p)%rbLG$w4D;?_IqYXvc%*vRP3yBpaUX`m+l+1WSe_#wy5azu5*WG6rws=H_O{ zEbc%$z%K40A|hgBWaQ|`Chn!Jy?WLCuCK1{+uhWZpTE1?AEuPU9~voCifW231H=%h zpuepHyQaXN_$M5s?Ji&B+{T6mVLZrkLEq=QKl{ToST2QKU8IGD#l^*KZO=eOy5$ZCU}1cgu3o{AqE~GB(pOl>#MH82#QCS|Dnt( zXedJdgaOh5{Q$LqPCx|J<>mYLP*^`KrgKCjq05jK@NI2vmHqD?9^Qmjrt>!u*6d;+ PfRBuXqIi|4VbK2pHc1JW literal 0 HcmV?d00001 diff --git a/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generate_Signed_Enclave_Dialog.png b/Linux_SGXEclipsePlugin/build_directory/plugins/com.intel.sgx.userguide/html/Resources/Images/Generate_Signed_Enclave_Dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..9eebe98c661a4349021ae715bb216774662f06d0 GIT binary patch literal 108783 zcmXt81ymbb*M(w53PlRV3vF?C*W&IJFYdt|0;LoyP^=V(;_ey<#XY#YdvHmB@bljL z{;XtW%}jD<*1c!%bN1OcQe9Q<6&4v55)#rY1^G{!NJuZNk&uw%U%q%gBf+`9@%)AC zt|=#lR0*Ltcs@Y2kyMdHLaK?we)xj+e2nQL|JfZ03Ag*74{|@C*b)ipsX*bAq_&UA z@#D2O#b6^_)Xmy?pO5%5=PLQ>vOh%3U$QCH%DQRA*{w-|SUR~>yHqnWH8qvR`uSDT z(>tPE%Acp`1v;Vgu4+&{ZFh?ubF;Sm`-3$8GCDQ+Y!HD6`s6d7V!8~!Il4Cm`r@IW zA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